| Server IP : 3.111.61.48 / Your IP : 216.73.216.67 Web Server : Apache System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.2.31 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3.10/test/__pycache__/ |
Upload File : |
o
�9jD8 � @ sL d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlmZ d dlm Z d dl
Z
d dlZd dlZ
d dlZ
d dlZe�d� dd � Zd
d� Ze�de
jv d
�Zee
jje
jj�ZG dd� de�Zeee jd�Zeee j d�Z!eee j d�Z"G dd� dej#�Z$G dd� dej#�Z%G dd� dej#�Z&G dd� dej#�Z'e(dkr�e�)� dS dS )� N)�support)� os_helper)�
socket_helper)�ResourceDenied)�sanepathname2url�networkc O sN t d�D ] }z
| |i |��W S |y$ } z|}W Y d }~qd }~ww |�)N� )�range)�func�exc�args�kwargs�i�e�last_exc� r �+/usr/lib/python3.10/test/test_urllib2net.py�
_retry_thrice s ��r c s � �fdd�}|S )Nc s t �� g| �R i |��S �N)r )r r
�r r
r r �wrapped s z(_wrap_with_retry_thrice.<locals>.wrappedr )r
r r r r r �_wrap_with_retry_thrice s r �TRAVISz%bpo-35411: skip FTP test on Travis CIc @ s* e Zd ZdZdd� Zdd� Zd dd�ZdS )
�TransientResourcez�Raise ResourceDenied if an exception is raised while the context manager
is in effect that matches the specified exception and attributes.c K s || _ || _d S r )r �attrs)�selfr r
r r r �__init__2 s
zTransientResource.__init__c C s | S r r �r r r r � __enter__6 � zTransientResource.__enter__Nc C s\ |dur*t | j|�r,| j�� D ]\}}t||�s dS t||�|kr% dS qtd��dS dS )z�If type_ is a subclass of self.exc and value has attributes matching
self.attrs, raise ResourceDenied. Otherwise let the exception
propagate (if any).Nz%an optional resource is not available)�
issubclassr r �items�hasattr�getattrr )r �type_�value� traceback�attr�
attr_valuer r r �__exit__9 s
��zTransientResource.__exit__)NNN)�__name__�
__module__�__qualname__�__doc__r r r) r r r r r - s
r )�errnoc @ s e Zd ZdZdS )� AuthTestsz&Tests urllib2 authentication features.N)r* r+ r, r- r r r r r/ N s r/ c @ s e Zd Zdd� ZdS )�CloseSocketTestc C sr | � tjj� tj}t�|�� t|�}|j }| �
|j� |�� | �
|j� W d � d S 1 s2w Y d S r )�
addCleanup�urllib�request�
urlcleanupr �
TEST_HTTP_URLr �transient_internet�_urlopen_with_retry�fp�assertFalse�closed�close�
assertTrue)r �url�response�sockr r r �
test_closew s "�zCloseSocketTest.test_closeN)r* r+ r, r@ r r r r r0 u s r0 c @ sd e Zd Zdd� Zedd� �Zdd� Zdd� Zd d
� Zdd� Z e
�d
�dd� �Zddd�Z
dd� ZdS )�OtherNetworkTestsc C s d S r )�logging� getLogger�
addHandler�
StreamHandler)r rB �loggerr r r �setUp� r zOtherNetworkTests.setUpc C s&