Current File : /home/mmdealscpanel/yummmdeals.com/__pycache__.tar
gnu.cpython-38.opt-1.pyc000064400000000315150330450050010716 0ustar00U

e5dH�@sdZddlTdS)z,Provide the _gdbm module as a dbm submodule.�)�*N)�__doc__Z_gdbm�rr�/usr/lib64/python3.8/dbm/gnu.py�<module>sgnu.cpython-38.pyc000064400000000315150330450050007757 0ustar00U

e5dH�@sdZddlTdS)z,Provide the _gdbm module as a dbm submodule.�)�*N)�__doc__Z_gdbm�rr�/usr/lib64/python3.8/dbm/gnu.py�<module>s__init__.cpython-38.opt-1.pyc000064400000010142150330450050011663 0ustar00U

e5d��@s�dZdddgZddlZddlZddlZddlZGdd�de�Zddd	gZda	iZ
eefZzdd
lm
Z
Wnek
r�dZ
YnXdd
d�Zdd�Zedkr�ejdd�D]Zeee�p�de�q�dS)aNGeneric interface to all dbm clones.

Use

        import dbm
        d = dbm.open(file, 'w', 0o666)

The returned object is a dbm.gnu, dbm.ndbm or dbm.dumb object, dependent on the
type of database being opened (determined by the whichdb function) in the case
of an existing dbm. If the dbm does not exist and the create or new flag ('c'
or 'n') was specified, the dbm type will be determined by the availability of
the modules (tested in the above order).

It has the following interface (key and data are strings):

        d[key] = data   # store data at key (may override data at
                        # existing key)
        data = d[key]   # retrieve data at key (raise KeyError if no
                        # such key)
        del d[key]      # delete data stored at key (raises KeyError
                        # if no such key)
        flag = key in d # true if the key exists
        list = d.keys() # return a list of all existing keys (slow!)

Future versions may change the order in which implementations are
tested for existence, and add interfaces to other dbm-like
implementations.
�open�whichdb�error�Nc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�$/usr/lib64/python3.8/dbm/__init__.pyr&s�dbm.gnu�dbm.ndbm�dbm.dumb)�ndbm�r�c	Cs�tdkr^tD]@}zt|dgd�}Wntk
r:YqYnXtsD|a|t|<qts^tdt��d|krnt|�nd}|dkr�d|ks�d|kr�t}q�tdd��n:|d	kr�tdd
��n$|tkr�tdd�|���nt|}|�|||�S)a�Open or create database at path given by *file*.

    Optional argument *flag* can be 'r' (default) for read-only access, 'w'
    for read-write access of an existing database, 'c' for read-write access
    to a new or existing database, and 'n' for read-write access to a new
    database.

    Note: 'r' and 'w' fail if the database doesn't exist; 'c' creates it
    only if it doesn't exist; and 'n' always creates a new database.
    Nr)�fromlistzno dbm clone found; tried %s�n�crz=db file doesn't exist; use 'c' or 'n' flag to create a new db�zdb type could not be determinedz/db type is {0}, but the module is not available)	�_defaultmod�_names�
__import__�ImportError�_modulesrr�formatr)�file�flag�mode�name�mod�resultrrr	r5s0


�cCs�z6t�|dd�}|��t�|dd�}|��WdStk
r�z>t�|dd�}|��tdk	r�t�|�}|��WYdSWntk
r�YnXYnXzht�|d�t�|d�j}|dkr�Wd	St�|dd�}z|�d
�dkr�W�
Wd	SW5|��XWntk
�rYnXzt�|d�}Wntk
�rHYdSX|�|�d�}W5QRX|dd
�}t	|�d
k�r�dSzt
�d|�\}Wnt
jk
�r�YdSX|dk�r�dSzt
�d|dd��\}Wnt
jk
�r�YdSXdS)auGuess which db package to use to open a db file.

    Return values:

    - None if the database file can't be read;
    - empty string if the file can be read but can't be recognized
    - the name of the dbm submodule (e.g. "ndbm" or "gnu") if recognized.

    Importing the given module may still fail, and opening the
    database using that module may still fail.
    z.pag�rbz.dirrz.dbNz.datrr�)�'�"��rz=l)iΚWi͚WiϚWr
���)
�ior�close�OSErrorr
�os�stat�st_size�read�len�structZunpackr)�filename�f�d�sizeZs16�s�magicrrr	rbs`

�__main__r!ZUNKNOWN)rr)�__doc__�__all__r'r*r/�sys�	Exceptionrrrrr)Zdbmr
rrrr�argvr0�printrrrr	�<module>s&



-Yndbm.cpython-38.pyc000064400000000314150330450050010105 0ustar00U

e5dF�@sdZddlTdS)z+Provide the _dbm module as a dbm submodule.�)�*N)�__doc__Z_dbm�rr� /usr/lib64/python3.8/dbm/ndbm.py�<module>s__init__.cpython-38.opt-2.pyc000064400000004313150330450050011667 0ustar00U

e5d��@s�dddgZddlZddlZddlZddlZGdd�de�ZdddgZdaiZ	ee
fZzdd	lmZWne
k
r|dZYnXddd�Zd
d�Zedkr�ejdd�D]Zeee�p�de�q�dS)�open�whichdb�error�Nc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�$/usr/lib64/python3.8/dbm/__init__.pyr&s�dbm.gnu�dbm.ndbm�dbm.dumb)�ndbm�r�c	Cs�tdkr^tD]@}zt|dgd�}Wntk
r:YqYnXtsD|a|t|<qts^tdt��d|krnt|�nd}|dkr�d|ks�d|kr�t}q�tdd��n:|dkr�tdd	��n$|tkr�tdd
�|���nt|}|�|||�S)Nr)�fromlistzno dbm clone found; tried %s�n�crz=db file doesn't exist; use 'c' or 'n' flag to create a new db�zdb type could not be determinedz/db type is {0}, but the module is not available)	�_defaultmod�_names�
__import__�ImportError�_modulesrr�formatr)�file�flag�mode�name�mod�resultrrr	r5s0


�cCs�z6t�|dd�}|��t�|dd�}|��WdStk
r�z>t�|dd�}|��tdk	r�t�|�}|��WYdSWntk
r�YnXYnXzht�|d�t�|d�j}|dkr�WdSt�|dd�}z|�d	�d
kr�W�
WdSW5|��XWntk
�rYnXzt�|d�}Wntk
�rHYdSX|�|�d�}W5QRX|dd�}t	|�dk�r�d
Szt
�d|�\}Wnt
jk
�r�Yd
SX|dk�r�dSzt
�d|dd��\}Wnt
jk
�r�Yd
SXd
S)Nz.pag�rbz.dirrz.dbz.datrr�)�'�"��rz=l)iΚWi͚WiϚWr
���)
�ior�close�OSErrorr
�os�stat�st_size�read�len�structZunpackr)�filename�f�d�sizeZs16�s�magicrrr	rbs`

�__main__r!ZUNKNOWN)rr)�__all__r'r*r/�sys�	Exceptionrrrrr)Zdbmr
rrrr�argvr0�printrrrr	�<module>s$



-Ydumb.cpython-38.pyc000064400000017137150330450050010127 0ustar00U

e5d-�@sVdZddlZddlZddlZddlZddgZ	dZ
eZGdd�dej
j�Zdd
d�ZdS)a�A dumb and slow but simple dbm clone.

For database spam, spam.dir contains the index (a text file),
spam.bak *may* contain a backup of the index (also a text file),
while spam.dat contains the data (a binary file).

XXX TO DO:

- seems to contain a bug when updating...

- reclaim free space (currently, space once occupied by deleted or expanded
items is never reused)

- support concurrent access (currently, if two processes take turns making
updates, they can mess up the index)

- support efficient access to large databases (currently, the whole index
is read when the database is opened, and some updates rewrite the whole index)

- support opening for read-only (flag = 'm')

�N�error�openic@s�eZdZeZeZd+dd�Zdd�Zdd�Zdd	�ZeZ	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZeZd d!�Zd"d#�ZeZd$d%�Zd&d'�Zd(d)�Zd*S),�	_Database�ccCsL||_|dk|_|d|_|d|_|d|_d|_|�|�|�|�dS)N�rz.dirz.datz.bak)�_mode�	_readonly�_dirfile�_datfile�_bakfile�_index�_create�_update)�selfZfilebasename�mode�flag�r� /usr/lib64/python3.8/dbm/dumb.py�__init__0s




z_Database.__init__cCs�|dkrB|j|j|jfD](}zt�|�Wqtk
r>YqXqztj|jddd�}WnHtk
r�|dkrr�tj|jddd��}|�|j�W5QRXYn
X|�	�dS)N�nr�Latin-1��encoding�rr�w)
r
rr	�_os�remove�OSError�_ior�_chmod�close)rr�filename�frrrr
Isz_Database._createc	Cs�d|_i|_ztj|jddd�}Wn$tk
rF|dkr<�d|_YnFX|�:|D].}|��}t�|�\}}|�	d�}||j|<qRW5QRXdS)NFrrrrT)
�	_modifiedrrrr	r�rstrip�_astZliteral_eval�encode)rrr"�line�key�pos_and_siz_pairrrrr\s
z_Database._updatec	Cs�|jdks|jsdSz|j�|j�Wntk
r:YnXz|j�|j|j�Wntk
rfYnX|jj	|jddd��B}|�
|j�|j��D]$\}}d|�d�|f}|�
|�q�W5QRXdS)Nrrr�%r, %r
)rr#r�unlinkrr�renamer	rrr�items�decode�write)rr"r(r)�entryrrr�_commitpsz_Database._commitcCs|jdkrtd��dS�N�"DBM object has already been closed)rr�rrrr�_verify_open�s
z_Database._verify_openc	Cs\t|t�r|�d�}|��|j|\}}t�|jd��}|�|�|�	|�}W5QRX|S)N�utf-8�rb)
�
isinstance�strr&r5rrrr
�seek�read)rr(�pos�sizr"Zdatrrr�__getitem__�s


z_Database.__getitem__c	Csrt�|jd��R}|�dd�t|���}|tdtt}|�d||�|}|�|�W5QRX|t|�fS)N�rb+r���)	rrr
r:�int�tell�
_BLOCKSIZEr/�len)r�valr"r<Znposrrr�_addval�sz_Database._addvalc	Cs:t�|jd��}|�|�|�|�W5QRX|t|�fS)Nr?)rrr
r:r/rF)rr<rGr"rrr�_setval�s
z_Database._setvalc	CsP||j|<tj|jddd��*}|�|j�|�d|�d�|f�W5QRXdS)N�arrr*)rrrr	rr/r.)rr(r)r"rrr�_addkey�s
z_Database._addkeycCs�|jrtd��t|t�r$|�d�}nt|ttf�s:td��t|t�rP|�d�}nt|ttf�sftd��|��d|_	||j
kr�|�||�|��n^|j
|\}}|t
dt
}t|�t
dt
}||kr�|�||�|j
|<n|�|�|j
|<dS)N�'The database is opened for reading onlyr6zkeys must be bytes or stringszvalues must be bytes or stringsTrA)rrr8r9r&�bytes�	bytearray�	TypeErrorr5r#rrKrHrErFrI)rr(rGr<r=Z	oldblocksZ	newblocksrrr�__setitem__�s(


z_Database.__setitem__cCsD|jrtd��t|t�r"|�d�}|��d|_|j|=|��dS)NrLr6T)	rrr8r9r&r5r#rr1�rr(rrr�__delitem__�s

z_Database.__delitem__cCs0zt|j�WStk
r*td�d�YnXdSr2)�listrrOrr4rrr�keys�sz_Database.keyscs ����fdd��j��D�S)Ncsg|]}|�|f�qSrr)�.0r(r4rr�
<listcomp>�sz#_Database.items.<locals>.<listcomp>)r5rrTr4rr4rr-�sz_Database.itemscCsRt|t�r|�d�}z||jkWStk
rL|jdkrFtd�d�n�YnXdS)Nr6r3)r8r9r&rrOrrQrrr�__contains__�s


z_Database.__contains__cCs0zt|j�WStk
r*td�d�YnXdSr2)�iterrrOrr4rrr�iterkeyssz_Database.iterkeyscCs0zt|j�WStk
r*td�d�YnXdSr2)rFrrOrr4rrr�__len__
sz_Database.__len__c	Cs,z|��W5d|_|_|_|_XdS�N)rr
r	rr1r4rrrr sz_Database.closecCs|j�||j�dSr[)r�chmodr)r�filerrrrsz_Database._chmodcCs|Sr[rr4rrr�	__enter__sz_Database.__enter__cGs|��dSr[)r )r�argsrrr�__exit__sz_Database.__exit__N)r)�__name__�
__module__�__qualname__rrrr
rr1�syncr5r>rHrIrKrPrRrTr-rWrY�__iter__rZr �__del__rr^r`rrrrr#s2

	%rr�cCsVzt�d�}t�|�Wntk
r,YnX||@}|dkrHtd��t|||d�S)aEOpen the database file, filename, and return corresponding object.

    The flag argument, used to control how the database is opened in the
    other DBM implementations, supports only the semantics of 'c' and 'n'
    values.  Other values will default to the semantics of 'c' value:
    the database will always opened for update and will be created if it
    does not exist.

    The optional mode argument is the UNIX mode of the file, used only when
    the database has to be created.  It defaults to octal code 0o666 (and
    will be modified by the prevailing umask).

    r)rrrrz)Flag must be one of 'r', 'w', 'c', or 'n')r)r�umask�AttributeError�
ValueErrorr)r]rrZumrrrr"s

)rrg)�__doc__Zastr%�ior�osrZcollections.abc�collections�__all__rErr�abc�MutableMappingrrrrrr�<module>sdumb.cpython-38.opt-2.pyc000064400000014525150330450050011065 0ustar00U

e5d-�@sRddlZddlZddlZddlZddgZdZ	e
ZGdd�dejj
�Zd
d	d�ZdS)�N�error�openic@s�eZdZeZeZd+dd�Zdd�Zdd�Zdd	�ZeZ	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZeZd d!�Zd"d#�ZeZd$d%�Zd&d'�Zd(d)�Zd*S),�	_Database�ccCsL||_|dk|_|d|_|d|_|d|_d|_|�|�|�|�dS)N�rz.dirz.datz.bak)�_mode�	_readonly�_dirfile�_datfile�_bakfile�_index�_create�_update)�selfZfilebasename�mode�flag�r� /usr/lib64/python3.8/dbm/dumb.py�__init__0s




z_Database.__init__cCs�|dkrB|j|j|jfD](}zt�|�Wqtk
r>YqXqztj|jddd�}WnHtk
r�|dkrr�tj|jddd��}|�|j�W5QRXYn
X|�	�dS)N�nr�Latin-1��encoding�rr�w)
r
rr	�_os�remove�OSError�_ior�_chmod�close)rr�filename�frrrr
Isz_Database._createc	Cs�d|_i|_ztj|jddd�}Wn$tk
rF|dkr<�d|_YnFX|�:|D].}|��}t�|�\}}|�	d�}||j|<qRW5QRXdS)NFrrrrT)
�	_modifiedrrrr	r�rstrip�_astZliteral_eval�encode)rrr"�line�key�pos_and_siz_pairrrrr\s
z_Database._updatec	Cs�|jdks|jsdSz|j�|j�Wntk
r:YnXz|j�|j|j�Wntk
rfYnX|jj	|jddd��B}|�
|j�|j��D]$\}}d|�d�|f}|�
|�q�W5QRXdS)Nrrr�%r, %r
)rr#r�unlinkrr�renamer	rrr�items�decode�write)rr"r(r)�entryrrr�_commitpsz_Database._commitcCs|jdkrtd��dS�N�"DBM object has already been closed)rr�rrrr�_verify_open�s
z_Database._verify_openc	Cs\t|t�r|�d�}|��|j|\}}t�|jd��}|�|�|�	|�}W5QRX|S)N�utf-8�rb)
�
isinstance�strr&r5rrrr
�seek�read)rr(�pos�sizr"Zdatrrr�__getitem__�s


z_Database.__getitem__c	Csrt�|jd��R}|�dd�t|���}|tdtt}|�d||�|}|�|�W5QRX|t|�fS)N�rb+r���)	rrr
r:�int�tell�
_BLOCKSIZEr/�len)r�valr"r<Znposrrr�_addval�sz_Database._addvalc	Cs:t�|jd��}|�|�|�|�W5QRX|t|�fS)Nr?)rrr
r:r/rF)rr<rGr"rrr�_setval�s
z_Database._setvalc	CsP||j|<tj|jddd��*}|�|j�|�d|�d�|f�W5QRXdS)N�arrr*)rrrr	rr/r.)rr(r)r"rrr�_addkey�s
z_Database._addkeycCs�|jrtd��t|t�r$|�d�}nt|ttf�s:td��t|t�rP|�d�}nt|ttf�sftd��|��d|_	||j
kr�|�||�|��n^|j
|\}}|t
dt
}t|�t
dt
}||kr�|�||�|j
|<n|�|�|j
|<dS)N�'The database is opened for reading onlyr6zkeys must be bytes or stringszvalues must be bytes or stringsTrA)rrr8r9r&�bytes�	bytearray�	TypeErrorr5r#rrKrHrErFrI)rr(rGr<r=Z	oldblocksZ	newblocksrrr�__setitem__�s(


z_Database.__setitem__cCsD|jrtd��t|t�r"|�d�}|��d|_|j|=|��dS)NrLr6T)	rrr8r9r&r5r#rr1�rr(rrr�__delitem__�s

z_Database.__delitem__cCs0zt|j�WStk
r*td�d�YnXdSr2)�listrrOrr4rrr�keys�sz_Database.keyscs ����fdd��j��D�S)Ncsg|]}|�|f�qSrr)�.0r(r4rr�
<listcomp>�sz#_Database.items.<locals>.<listcomp>)r5rrTr4rr4rr-�sz_Database.itemscCsRt|t�r|�d�}z||jkWStk
rL|jdkrFtd�d�n�YnXdS)Nr6r3)r8r9r&rrOrrQrrr�__contains__�s


z_Database.__contains__cCs0zt|j�WStk
r*td�d�YnXdSr2)�iterrrOrr4rrr�iterkeyssz_Database.iterkeyscCs0zt|j�WStk
r*td�d�YnXdSr2)rFrrOrr4rrr�__len__
sz_Database.__len__c	Cs,z|��W5d|_|_|_|_XdS�N)rr
r	rr1r4rrrr sz_Database.closecCs|j�||j�dSr[)r�chmodr)r�filerrrrsz_Database._chmodcCs|Sr[rr4rrr�	__enter__sz_Database.__enter__cGs|��dSr[)r )r�argsrrr�__exit__sz_Database.__exit__N)r)�__name__�
__module__�__qualname__rrrr
rr1�syncr5r>rHrIrKrPrRrTr-rWrY�__iter__rZr �__del__rr^r`rrrrr#s2

	%rr�cCsVzt�d�}t�|�Wntk
r,YnX||@}|dkrHtd��t|||d�S)Nr)rrrrz)Flag must be one of 'r', 'w', 'c', or 'n')r)r�umask�AttributeError�
ValueErrorr)r]rrZumrrrr"s

)rrg)Zastr%�ior�osrZcollections.abc�collections�__all__rErr�abc�MutableMappingrrrrrr�<module>sndbm.cpython-38.opt-2.pyc000064400000000220150330450050011041 0ustar00U

e5dF�@sddlTdS)�)�*N)Z_dbm�rr� /usr/lib64/python3.8/dbm/ndbm.py�<module>�dumb.cpython-38.opt-1.pyc000064400000017137150330450050011066 0ustar00U

e5d-�@sVdZddlZddlZddlZddlZddgZ	dZ
eZGdd�dej
j�Zdd
d�ZdS)a�A dumb and slow but simple dbm clone.

For database spam, spam.dir contains the index (a text file),
spam.bak *may* contain a backup of the index (also a text file),
while spam.dat contains the data (a binary file).

XXX TO DO:

- seems to contain a bug when updating...

- reclaim free space (currently, space once occupied by deleted or expanded
items is never reused)

- support concurrent access (currently, if two processes take turns making
updates, they can mess up the index)

- support efficient access to large databases (currently, the whole index
is read when the database is opened, and some updates rewrite the whole index)

- support opening for read-only (flag = 'm')

�N�error�openic@s�eZdZeZeZd+dd�Zdd�Zdd�Zdd	�ZeZ	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZeZd d!�Zd"d#�ZeZd$d%�Zd&d'�Zd(d)�Zd*S),�	_Database�ccCsL||_|dk|_|d|_|d|_|d|_d|_|�|�|�|�dS)N�rz.dirz.datz.bak)�_mode�	_readonly�_dirfile�_datfile�_bakfile�_index�_create�_update)�selfZfilebasename�mode�flag�r� /usr/lib64/python3.8/dbm/dumb.py�__init__0s




z_Database.__init__cCs�|dkrB|j|j|jfD](}zt�|�Wqtk
r>YqXqztj|jddd�}WnHtk
r�|dkrr�tj|jddd��}|�|j�W5QRXYn
X|�	�dS)N�nr�Latin-1��encoding�rr�w)
r
rr	�_os�remove�OSError�_ior�_chmod�close)rr�filename�frrrr
Isz_Database._createc	Cs�d|_i|_ztj|jddd�}Wn$tk
rF|dkr<�d|_YnFX|�:|D].}|��}t�|�\}}|�	d�}||j|<qRW5QRXdS)NFrrrrT)
�	_modifiedrrrr	r�rstrip�_astZliteral_eval�encode)rrr"�line�key�pos_and_siz_pairrrrr\s
z_Database._updatec	Cs�|jdks|jsdSz|j�|j�Wntk
r:YnXz|j�|j|j�Wntk
rfYnX|jj	|jddd��B}|�
|j�|j��D]$\}}d|�d�|f}|�
|�q�W5QRXdS)Nrrr�%r, %r
)rr#r�unlinkrr�renamer	rrr�items�decode�write)rr"r(r)�entryrrr�_commitpsz_Database._commitcCs|jdkrtd��dS�N�"DBM object has already been closed)rr�rrrr�_verify_open�s
z_Database._verify_openc	Cs\t|t�r|�d�}|��|j|\}}t�|jd��}|�|�|�	|�}W5QRX|S)N�utf-8�rb)
�
isinstance�strr&r5rrrr
�seek�read)rr(�pos�sizr"Zdatrrr�__getitem__�s


z_Database.__getitem__c	Csrt�|jd��R}|�dd�t|���}|tdtt}|�d||�|}|�|�W5QRX|t|�fS)N�rb+r���)	rrr
r:�int�tell�
_BLOCKSIZEr/�len)r�valr"r<Znposrrr�_addval�sz_Database._addvalc	Cs:t�|jd��}|�|�|�|�W5QRX|t|�fS)Nr?)rrr
r:r/rF)rr<rGr"rrr�_setval�s
z_Database._setvalc	CsP||j|<tj|jddd��*}|�|j�|�d|�d�|f�W5QRXdS)N�arrr*)rrrr	rr/r.)rr(r)r"rrr�_addkey�s
z_Database._addkeycCs�|jrtd��t|t�r$|�d�}nt|ttf�s:td��t|t�rP|�d�}nt|ttf�sftd��|��d|_	||j
kr�|�||�|��n^|j
|\}}|t
dt
}t|�t
dt
}||kr�|�||�|j
|<n|�|�|j
|<dS)N�'The database is opened for reading onlyr6zkeys must be bytes or stringszvalues must be bytes or stringsTrA)rrr8r9r&�bytes�	bytearray�	TypeErrorr5r#rrKrHrErFrI)rr(rGr<r=Z	oldblocksZ	newblocksrrr�__setitem__�s(


z_Database.__setitem__cCsD|jrtd��t|t�r"|�d�}|��d|_|j|=|��dS)NrLr6T)	rrr8r9r&r5r#rr1�rr(rrr�__delitem__�s

z_Database.__delitem__cCs0zt|j�WStk
r*td�d�YnXdSr2)�listrrOrr4rrr�keys�sz_Database.keyscs ����fdd��j��D�S)Ncsg|]}|�|f�qSrr)�.0r(r4rr�
<listcomp>�sz#_Database.items.<locals>.<listcomp>)r5rrTr4rr4rr-�sz_Database.itemscCsRt|t�r|�d�}z||jkWStk
rL|jdkrFtd�d�n�YnXdS)Nr6r3)r8r9r&rrOrrQrrr�__contains__�s


z_Database.__contains__cCs0zt|j�WStk
r*td�d�YnXdSr2)�iterrrOrr4rrr�iterkeyssz_Database.iterkeyscCs0zt|j�WStk
r*td�d�YnXdSr2)rFrrOrr4rrr�__len__
sz_Database.__len__c	Cs,z|��W5d|_|_|_|_XdS�N)rr
r	rr1r4rrrr sz_Database.closecCs|j�||j�dSr[)r�chmodr)r�filerrrrsz_Database._chmodcCs|Sr[rr4rrr�	__enter__sz_Database.__enter__cGs|��dSr[)r )r�argsrrr�__exit__sz_Database.__exit__N)r)�__name__�
__module__�__qualname__rrrr
rr1�syncr5r>rHrIrKrPrRrTr-rWrY�__iter__rZr �__del__rr^r`rrrrr#s2

	%rr�cCsVzt�d�}t�|�Wntk
r,YnX||@}|dkrHtd��t|||d�S)aEOpen the database file, filename, and return corresponding object.

    The flag argument, used to control how the database is opened in the
    other DBM implementations, supports only the semantics of 'c' and 'n'
    values.  Other values will default to the semantics of 'c' value:
    the database will always opened for update and will be created if it
    does not exist.

    The optional mode argument is the UNIX mode of the file, used only when
    the database has to be created.  It defaults to octal code 0o666 (and
    will be modified by the prevailing umask).

    r)rrrrz)Flag must be one of 'r', 'w', 'c', or 'n')r)r�umask�AttributeError�
ValueErrorr)r]rrZumrrrr"s

)rrg)�__doc__Zastr%�ior�osrZcollections.abc�collections�__all__rErr�abc�MutableMappingrrrrrr�<module>sgnu.cpython-38.opt-2.pyc000064400000000220150330450050010712 0ustar00U

e5dH�@sddlTdS)�)�*N)Z_gdbm�rr�/usr/lib64/python3.8/dbm/gnu.py�<module>�ndbm.cpython-38.opt-1.pyc000064400000000314150330450050011044 0ustar00U

e5dF�@sdZddlTdS)z+Provide the _dbm module as a dbm submodule.�)�*N)�__doc__Z_dbm�rr� /usr/lib64/python3.8/dbm/ndbm.py�<module>s__init__.cpython-38.pyc000064400000010142150330450050010724 0ustar00U

e5d��@s�dZdddgZddlZddlZddlZddlZGdd�de�Zddd	gZda	iZ
eefZzdd
lm
Z
Wnek
r�dZ
YnXdd
d�Zdd�Zedkr�ejdd�D]Zeee�p�de�q�dS)aNGeneric interface to all dbm clones.

Use

        import dbm
        d = dbm.open(file, 'w', 0o666)

The returned object is a dbm.gnu, dbm.ndbm or dbm.dumb object, dependent on the
type of database being opened (determined by the whichdb function) in the case
of an existing dbm. If the dbm does not exist and the create or new flag ('c'
or 'n') was specified, the dbm type will be determined by the availability of
the modules (tested in the above order).

It has the following interface (key and data are strings):

        d[key] = data   # store data at key (may override data at
                        # existing key)
        data = d[key]   # retrieve data at key (raise KeyError if no
                        # such key)
        del d[key]      # delete data stored at key (raises KeyError
                        # if no such key)
        flag = key in d # true if the key exists
        list = d.keys() # return a list of all existing keys (slow!)

Future versions may change the order in which implementations are
tested for existence, and add interfaces to other dbm-like
implementations.
�open�whichdb�error�Nc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�$/usr/lib64/python3.8/dbm/__init__.pyr&s�dbm.gnu�dbm.ndbm�dbm.dumb)�ndbm�r�c	Cs�tdkr^tD]@}zt|dgd�}Wntk
r:YqYnXtsD|a|t|<qts^tdt��d|krnt|�nd}|dkr�d|ks�d|kr�t}q�tdd��n:|d	kr�tdd
��n$|tkr�tdd�|���nt|}|�|||�S)a�Open or create database at path given by *file*.

    Optional argument *flag* can be 'r' (default) for read-only access, 'w'
    for read-write access of an existing database, 'c' for read-write access
    to a new or existing database, and 'n' for read-write access to a new
    database.

    Note: 'r' and 'w' fail if the database doesn't exist; 'c' creates it
    only if it doesn't exist; and 'n' always creates a new database.
    Nr)�fromlistzno dbm clone found; tried %s�n�crz=db file doesn't exist; use 'c' or 'n' flag to create a new db�zdb type could not be determinedz/db type is {0}, but the module is not available)	�_defaultmod�_names�
__import__�ImportError�_modulesrr�formatr)�file�flag�mode�name�mod�resultrrr	r5s0


�cCs�z6t�|dd�}|��t�|dd�}|��WdStk
r�z>t�|dd�}|��tdk	r�t�|�}|��WYdSWntk
r�YnXYnXzht�|d�t�|d�j}|dkr�Wd	St�|dd�}z|�d
�dkr�W�
Wd	SW5|��XWntk
�rYnXzt�|d�}Wntk
�rHYdSX|�|�d�}W5QRX|dd
�}t	|�d
k�r�dSzt
�d|�\}Wnt
jk
�r�YdSX|dk�r�dSzt
�d|dd��\}Wnt
jk
�r�YdSXdS)auGuess which db package to use to open a db file.

    Return values:

    - None if the database file can't be read;
    - empty string if the file can be read but can't be recognized
    - the name of the dbm submodule (e.g. "ndbm" or "gnu") if recognized.

    Importing the given module may still fail, and opening the
    database using that module may still fail.
    z.pag�rbz.dirrz.dbNz.datrr�)�'�"��rz=l)iΚWi͚WiϚWr
���)
�ior�close�OSErrorr
�os�stat�st_size�read�len�structZunpackr)�filename�f�d�sizeZs16�s�magicrrr	rbs`

�__main__r!ZUNKNOWN)rr)�__doc__�__all__r'r*r/�sys�	Exceptionrrrrr)Zdbmr
rrrr�argvr0�printrrrr	�<module>s&



-Ybisect.cpython-36.pyc000064400000005166150335715140010457 0ustar003


 \#
�@sZdZddd�ZeZd
dd�ZeZddd�Zdd	d
�ZyddlTWnek
rTYnXdS)zBisection algorithms.�NcCsd|dkrtd��|dkr t|�}x2||krR||d}|||krH|}q"|d}q"W|j||�dS)z�Insert item x in list a, and keep it sorted assuming a is sorted.

    If x is already in a, insert it to the right of the rightmost x.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    rzlo must be non-negativeN��)�
ValueError�len�insert)�a�x�lo�hi�mid�r�/usr/lib64/python3.6/bisect.py�insort_rights	
rcCsX|dkrtd��|dkr t|�}x2||krR||d}|||krH|}q"|d}q"W|S)a�Return the index where to insert item x in list a, assuming a is sorted.

    The return value i is such that all e in a[:i] have e <= x, and all e in
    a[i:] have e > x.  So if x already appears in the list, a.insert(x) will
    insert just after the rightmost x already there.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    rzlo must be non-negativeNrr)rr)rrr	r
rrrr
�bisect_rights
rcCsd|dkrtd��|dkr t|�}x2||krR||d}|||krL|d}q"|}q"W|j||�dS)z�Insert item x in list a, and keep it sorted assuming a is sorted.

    If x is already in a, insert it to the left of the leftmost x.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    rzlo must be non-negativeNrr)rrr)rrr	r
rrrr
�insort_left/s	

rcCsX|dkrtd��|dkr t|�}x2||krR||d}|||krL|d}q"|}q"W|S)a�Return the index where to insert item x in list a, assuming a is sorted.

    The return value i is such that all e in a[:i] have e < x, and all e in
    a[i:] have e >= x.  So if x already appears in the list, a.insert(x) will
    insert just before the leftmost x already there.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    rzlo must be non-negativeNrr)rr)rrr	r
rrrr
�bisect_leftCs

r)�*)rN)rN)rN)rN)	�__doc__rZinsortrZbisectrrZ_bisect�ImportErrorrrrr
�<module>s



pty.cpython-36.pyc000064400000007427150335715140010024 0ustar003


 \��@s�dZddlmZddlZddlZdddgZdZdZdZdZd	d�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zeefdd�Zeefdd�ZdS)zPseudo terminal utilities.�)�selectN�openpty�fork�spawn��cCs<ytj�Sttfk
r YnXt�\}}t|�}||fS)zdopenpty() -> (master_fd, slave_fd)
    Open a pty master/slave pair, using os.openpty() if possible.)�osr�AttributeError�OSError�_open_terminal�
slave_open)�	master_fd�
slave_name�slave_fd�r�/usr/lib64/python3.6/pty.pyrs
cCsLytj�\}}Wnttfk
r(YnXtj|�}tj|�||fSt�S)z�master_open() -> (master_fd, slave_name)
    Open a pty master and return the fd, and the filename of the slave end.
    Deprecated, use openpty() instead.)rrr	r
�ttyname�closer)r
rrrrr�master_open!s

rc
Cslx^dD]V}xPdD]H}d||}ytj|tj�}Wntk
rHwYnX|d||fSWqWtd��dS)z1Open pty master and return (master_fd, tty_name).ZpqrstuvwxyzPQRSTZ0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devicesN)r�open�O_RDWRr
)�x�yZpty_name�fdrrrr1s

rcCsntj|tj�}yddlm}m}Wntk
r6|SXy|||d�|||d�Wntk
rhYnX|S)z�slave_open(tty_name) -> slave_fd
    Open the pty slave and acquire the controlling terminal, returning
    opened filedescriptor.
    Deprecated, use openpty() instead.r)�ioctl�I_PUSHZptemZldterm)rrrZfcntlrr�ImportErrorr
)Ztty_name�resultrrrrrr=srcCs�ytj�\}}Wnttfk
r(Yn4X|tkrTytj�Wntk
rRYnX||fSt�\}}tj�}|tkr�tj�tj|�tj	|t
�tj	|t�tj	|t�|tkr�tj|�tj
tjt�tj�}tj|�n
tj|�||fS)zdfork() -> (pid, master_fd)
    Fork and make the child a session leader with a controlling terminal.)r�forkptyr	r
�CHILD�setsidrrr�dup2�STDIN_FILENO�
STDOUT_FILENO�
STDERR_FILENOrrr)�pidrr
rZtmp_fdrrrrOs0



cCs&x |r tj||�}||d�}qWdS)z#Write all the data to a descriptor.N)r�write)r�data�nrrr�_writenwsr)cCstj|d�S)zDefault read function.i)r�read)rrrr�_read}sr+cCsz|tg}xlt|gg�\}}}||krH||�}|s<|j|�ntjt|�t|kr
|t�}|sh|jt�q
t||�q
WdS)z�Parent copy loop.
    Copies
            pty master -> standard output   (master_read)
            standard input -> pty master    (stdin_read)N)r"r�removerr&r#r))r
�master_read�
stdin_readZfdsZrfdsZwfdsZxfdsr'rrr�_copy�sr/cCs�t|�td�kr|f}t�\}}|tkr<tj|df|��ytjt�}tjt�d}Wntj	k
rrd}YnXyt
|||�Wn(tk
r�|r�tjttj
|�YnXtj|�tj|d�dS)zCreate a spawned process.�rr)�typerrr�execlp�ttyZ	tcgetattrr"Zsetraw�errorr/r
Z	tcsetattrZ	TCSAFLUSHr�waitpid)�argvr-r.r%r
�modeZrestorerrrr�s$




)�__doc__rrr3�__all__r"r#r$rrrrrrr)r+r/rrrrr�<module>s"
(binhex.cpython-36.opt-2.pyc000064400000026443150335715140011424 0ustar003


 \�6�@s�ddlZddlZddlZddlZdddgZGdd�de�ZdZdZdZ	dZ
d	ZGd
d�d�Zdd
�Z
Gdd�d�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�ZdS)�N�binhex�hexbin�Errorc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/binhex.pyrs�i��@��c@seZdZdd�ZdS)�FInfocCsd|_d|_d|_dS)Nz????r)�Type�Creator�Flags)�selfrrr	�__init__0szFInfo.__init__N)rrrrrrrr	r
/sr
cCstt�}tj|d��2}|jd�}d|kr,d|_|jdd�|j�}WdQRXtjj	|�\}}|j
ddd�}|||dfS)	N�rbirZTEXT��:�-r
)r
�io�open�readr�seek�tell�os�path�split�replace)�name�finfo�fp�dataZdsize�dir�filerrr	�getfileinfo5s
r&c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�openrsrccGsdS)Nr)r�argsrrr	rCszopenrsrc.__init__cGsdS)N�r)rr(rrr	rFsz
openrsrc.readcGsdS)Nr)rr(rrr	�writeIszopenrsrc.writecCsdS)Nr)rrrr	�closeLszopenrsrc.closeN)rrrrrr*r+rrrr	r'Bsr'c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_HqxcoderenginecCs ||_d|_d|_td|_dS)Nr)r
)�ofpr#�hqxdata�LINELEN�linelen)rr-rrr	rRsz_Hqxcoderengine.__init__cCsh|j||_t|j�}|dd}|jd|�}|j|d�|_|sHdS|jtj|�|_|jd�dS)N�r)r#�lenr.�binascii�b2a_hqx�_flush)rr#ZdatalenZtodorrr	r*Xs
z_Hqxcoderengine.writecCsvd}xF|t|j�|jkrJ||j}|jj|j||�d�t|_|}qW|j|d�|_|rr|jj|jd�dS)Nr�
s:
)r2r.r0r-r*r/)rZforce�firstZlastrrr	r5cs
z_Hqxcoderengine._flushcCs6|jr|jtj|j�|_|jd�|jj�|`dS)Nr
)r#r.r3r4r5r-r+)rrrr	r+ns


z_Hqxcoderengine.closeN)rrrrr*r5r+rrrr	r,Osr,c@s$eZdZdd�Zdd�Zdd�ZdS)�_RlecoderenginecCs||_d|_dS)Nr))r-r#)rr-rrr	rxsz_Rlecoderengine.__init__cCs@|j||_t|j�tkrdStj|j�}|jj|�d|_dS)Nr))r#r2�REASONABLY_LARGEr3�rlecode_hqxr-r*)rr#�rledatarrr	r*|sz_Rlecoderengine.writecCs0|jrtj|j�}|jj|�|jj�|`dS)N)r#r3r:r-r*r+)rr;rrr	r+�s

z_Rlecoderengine.closeN)rrrrr*r+rrrr	r8usr8c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�BinHexc
	Cs�|\}}}}d}t|t�r.|}tj|d�}d}yR|jd�t|�}	t|	�|_d|_|dkr`t	�}||_
||_|j||�t
|_Wn|r�|j��YnXdS)NF�wbTs0(This file must be converted with BinHex 4.0)

:r)�
isinstance�strrrr*r,r8r-�crcr
�dlen�rlen�
_writeinfo�_DID_HEADER�stater+)
rZname_finfo_dlen_rlenr-r r!rArBZclose_on_errorZofnameZhqxerrrr	r�s*



zBinHex.__init__cCs�t|�}|dkrtd��t|g�|jd�d}|j|j}}t|t�rR|jd�}t|t�rf|jd�}||}tj	d|j
�}tj	d|j|j�}	||||	}
|j
|
�|j�dS)N�?zFilename too longzlatin-1�z>hz>ii)r2r�bytes�encoderrr>r?�struct�packrrArB�_write�	_writecrc)rr r!�nl�d�tpZcrZd2Zd3Zd4�inforrr	rC�s




zBinHex._writeinfocCs tj||j�|_|jj|�dS)N)r3�crc_hqxr@r-r*)rr#rrr	rL�sz
BinHex._writecCs4|jdkrd}nd}|jjtj||j��d|_dS)Nrz>hz>H)r@r-r*rJrK)rZfmtrrr	rM�s

zBinHex._writecrccCs0|jtkrtd��|jt|�|_|j|�dS)NzWriting data at the wrong time)rErDrrAr2rL)rr#rrr	r*�s
zBinHex.writecCs,|jdkrtd|jf��|j�t|_dS)NrzIncorrect data size, diff=%r)rArrBrM�	_DID_DATArE)rrrr	�
close_data�s
zBinHex.close_datacCsB|jtkr|j�|jtkr$td��|jt|�|_|j|�dS)Nz'Writing resource data at the wrong time)rErSrTrrBr2rL)rr#rrr	�
write_rsrc�s

zBinHex.write_rsrccCsx|jdkrdSzJ|jtkr"|j�|jtkr4td��|jdkrNtd|jf��|j�Wdd|_|j}|`|j�XdS)NzClose at the wrong timerz$Incorrect resource-datasize, diff=%r)rErSrTrrBrMr-r+)rr-rrr	r+�s



zBinHex.closeN)rrrrrCrLrMr*rTrUr+rrrr	r<�s
r<c
Cs�t|�}t||�}tj|d��.}x|jd�}|s2P|j|�q"W|j�WdQRXt|d�}x|jd�}|snP|j|�q^W|j	�|j	�dS)Nri�)
r&r<rrrr*rTr'rUr+)�inp�outr!r-�ifprOrrr	r�s"



c@s$eZdZdd�Zdd�Zdd�ZdS)�_HqxdecoderenginecCs||_d|_dS)Nr)rX�eof)rrXrrr	rsz_Hqxdecoderengine.__init__cCs�d}|}x�|dkr�|jr|S|ddd}|jj|�}xRytj|�\}|_PWntjk
rfYnX|jjd�}|s�td��||}q:W||}|t|�}|r
|jr
td��q
W|S)Nr)rrr1�r
zPremature EOF on binhex file)rZrXrr3Za2b_hqxZ
Incompleterr2)rZtotalwtdZdecdata�wtdr#Z
decdatacur�newdatarrr	rs,
z_Hqxdecoderengine.readcCs|jj�dS)N)rXr+)rrrr	r+%sz_Hqxdecoderengine.closeN)rrrrrr+rrrr	rY�s rYc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_RledecoderenginecCs||_d|_d|_d|_dS)Nr)r)rX�
pre_buffer�post_bufferrZ)rrXrrr	r+sz_Rledecoderengine.__init__cCsD|t|j�kr"|j|t|j��|jd|�}|j|d�|_|S)N)r2r`�_fill)rr\�rvrrr	r1s
z_Rledecoderengine.readcCs�|j|jj|d�|_|jjr>|jtj|j�|_d|_dSt|j�}|jdd�tdtkrl|d}nX|jdd�tkr�|d}n<|jd	d�tdkr�|d}n|jd
d�tkr�n|d}|jtj|jd|��|_|j|d�|_dS)Nr[r)r1rGr
r���������rerd)	r_rXrrZr`r3Z
rledecode_hqxr2�RUNCHAR)rr\Zmarkrrr	ra8s&



z_Rledecoderengine._fillcCs|jj�dS)N)rXr+)rrrr	r+[sz_Rledecoderengine.closeN)rrrrrrar+rrrr	r^(s#r^c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�HexBincCsjt|t�rtj|d�}x.|jd�}|s.td��|dkr8q|dkrPqWt|�}t|�|_d|_	|j
�dS)Nrr
zNo binhex data found�
�:r)r>r?rrrrrYr^rXr@�_readheader)rrXZchZhqxifprrr	r_s


zHexBin.__init__cCs |jj|�}tj||j�|_|S)N)rXrr3rRr@)rr2r#rrr	�_readuszHexBin._readcCsNtjd|jjd��dd@}|jd@|_||jkrDtd|j|f��d|_dS)Nz>hrri��zCRC error, computed %x, read %x)rJ�unpackrXrr@r)rZfilecrcrrr	�	_checkcrczs
zHexBin._checkcrccCs�|jd�}|jt|��}|jd�}|j�|dd�}|dd�}tjd|dd��d}tjd	|dd
��d|_tjd	|d
d��d|_||_t�|_||j_	||j_
||j_t|_
dS)Nr
r[r��	z>h�rz>l��rnrorprqrr)rk�ordrmrJrlrArB�FNamer
rrrrDrE)rr2Zfname�rest�typeZcreator�flagsrrr	rj�s

zHexBin._readheadercGsn|jtkrtd��|r,|d}t||j�}n|j}d}x&t|�|kr\||j|t|��}q8W|j||_|S)NzRead data at wrong timerr))rErDr�minrAr2rk)r�nrbrrr	r�s
zHexBin.readcCs6|jtkrtd��|jr$|j|j�}|j�t|_dS)Nzclose_data at wrong time)rErDrrArkrmrS)r�dummyrrr	rT�s
zHexBin.close_datacGsZ|jtkr|j�|jtkr$td��|r>|d}t||j�}n|j}|j||_|j|�S)Nz Read resource data at wrong timer)rErDrTrSrrxrBrk)rryrrr	�	read_rsrc�s

zHexBin.read_rsrccCsD|jdkrdSz|jr"|j|j�}|j�Wdd|_|jj�XdS)N)rErBr{rmrXr+)rrzrrr	r+�s
zHexBin.closeN)rrrrrkrmrjrrTr{r+rrrr	rg^s

rgc
Cs�t|�}|j}|s|j}tj|d��&}x|jd�}|s8P|j|�q(WWdQRX|j�|jd�}|r�t	|d�}|j|�x|jd�}|s�P|j|�q|W|j
�|j
�dS)Nr=i�)rgr
rtrrrr*rTr{r'r+)rVrWrXr!r-rOrrr	r�s,




)rrrJr3�__all__�	ExceptionrrDrSr9r/rfr
r&r'r,r8r<rrYr^rgrrrrr	�<module>s*


&^*6htextwrap.cpython-36.opt-1.pyc000064400000032454150335715140012023 0ustar003


 \fL�@s�dZddlZddddddgZd	ZGd
d�d�Zddd�Zdd
d�Zdd�Zejdej	�Z
ejdej	�Zdd�Zddd�Z
edkr�eed��dS)zText wrapping and filling.
�N�TextWrapper�wrap�fill�dedent�indent�shortenz	

 c
@s�eZdZdZiZed�ZxeD]Zeeee�<qWdZ	dZ
deje�Z
de
dd�Zejd	e	e
e
ed
�ej�Z[	[
[ejde
�Z[
ejd�Zd&ddd�dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdS)'ra	
    Object for wrapping/filling text.  The public interface consists of
    the wrap() and fill() methods; the other methods are just there for
    subclasses to override in order to tweak the default behaviour.
    If you want to completely replace the main wrapping algorithm,
    you'll probably have to override _wrap_chunks().

    Several instance attributes control various aspects of wrapping:
      width (default: 70)
        the maximum width of wrapped lines (unless break_long_words
        is false)
      initial_indent (default: "")
        string that will be prepended to the first line of wrapped
        output.  Counts towards the line's width.
      subsequent_indent (default: "")
        string that will be prepended to all lines save the first
        of wrapped output; also counts towards each line's width.
      expand_tabs (default: true)
        Expand tabs in input text to spaces before further processing.
        Each tab will become 0 .. 'tabsize' spaces, depending on its position
        in its line.  If false, each tab is treated as a single character.
      tabsize (default: 8)
        Expand tabs in input text to 0 .. 'tabsize' spaces, unless
        'expand_tabs' is false.
      replace_whitespace (default: true)
        Replace all whitespace characters in the input text by spaces
        after tab expansion.  Note that if expand_tabs is false and
        replace_whitespace is true, every tab will be converted to a
        single space!
      fix_sentence_endings (default: false)
        Ensure that sentence-ending punctuation is always followed
        by two spaces.  Off by default because the algorithm is
        (unavoidably) imperfect.
      break_long_words (default: true)
        Break words longer than 'width'.  If false, those words will not
        be broken, and some lines might be longer than 'width'.
      break_on_hyphens (default: true)
        Allow breaking hyphenated words. If true, wrapping will occur
        preferably on whitespaces and right after hyphens part of
        compound words.
      drop_whitespace (default: true)
        Drop leading and trailing whitespace from lines.
      max_lines (default: None)
        Truncate wrapped lines.
      placeholder (default: ' [...]')
        Append to the last line of truncated text.
    � z[\w!"\'&.,?]z[^\d\W]z[%s]z[^�Na�
        ( # any whitespace
          %(ws)s+
        | # em-dash between words
          (?<=%(wp)s) -{2,} (?=\w)
        | # word, possibly hyphenated
          %(nws)s+? (?:
            # hyphenated word
              -(?: (?<=%(lt)s{2}-) | (?<=%(lt)s-%(lt)s-))
              (?= %(lt)s -? %(lt)s)
            | # end of word
              (?=%(ws)s|\Z)
            | # em-dash
              (?<=%(wp)s) (?=-{2,}\w)
            )
        ))Zwp�ltZwsZnwsz(%s+)z[a-z][\.\!\?][\"\']?\Z�F�TF�z [...])�	max_lines�placeholderc
CsL||_||_||_||_||_||_||_||_|	|_|
|_	||_
||_dS)N)�width�initial_indent�subsequent_indent�expand_tabs�replace_whitespace�fix_sentence_endings�break_long_words�drop_whitespace�break_on_hyphens�tabsizerr)
�selfrrrrrrrrrrrr�r� /usr/lib64/python3.6/textwrap.py�__init__sszTextWrapper.__init__cCs(|jr|j|j�}|jr$|j|j�}|S)z�_munge_whitespace(text : string) -> string

        Munge whitespace in text: expand tabs and convert all other
        whitespace characters to spaces.  Eg. " foo\tbar\n\nbaz"
        becomes " foo    bar  baz".
        )r�
expandtabsrr�	translate�unicode_whitespace_trans)r�textrrr�_munge_whitespace�s
zTextWrapper._munge_whitespacecCs6|jdkr|jj|�}n|jj|�}dd�|D�}|S)aN_split(text : string) -> [string]

        Split the text to wrap into indivisible chunks.  Chunks are
        not quite the same as words; see _wrap_chunks() for full
        details.  As an example, the text
          Look, goof-ball -- use the -b option!
        breaks into the following chunks:
          'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ',
          'use', ' ', 'the', ' ', '-b', ' ', 'option!'
        if break_on_hyphens is True, or in:
          'Look,', ' ', 'goof-ball', ' ', '--', ' ',
          'use', ' ', 'the', ' ', '-b', ' ', option!'
        otherwise.
        TcSsg|]}|r|�qSrr)�.0�crrr�
<listcomp>�sz&TextWrapper._split.<locals>.<listcomp>)r�
wordsep_re�split�wordsep_simple_re)rr!�chunksrrr�_split�s

zTextWrapper._splitcCs`d}|jj}xN|t|�dkrZ||ddkrP|||�rPd||d<|d7}q|d7}qWdS)ag_fix_sentence_endings(chunks : [string])

        Correct for sentence endings buried in 'chunks'.  Eg. when the
        original text contains "... foo.\nBar ...", munge_whitespace()
        and split() will convert that to [..., "foo.", " ", "Bar", ...]
        which has one too few spaces; this method simply changes the one
        space to two.
        rr	rz  �N)�sentence_end_re�search�len)rr)�iZ	patsearchrrr�_fix_sentence_endings�s	
z!TextWrapper._fix_sentence_endingscCs^|dkrd}n||}|jrH|j|dd|��|d|d�|d<n|sZ|j|j��dS)a
_handle_long_word(chunks : [string],
                             cur_line : [string],
                             cur_len : int, width : int)

        Handle a chunk of text (most likely a word, not whitespace) that
        is too long to fit in any line.
        r	N���r1r1)r�append�pop)rZreversed_chunks�cur_line�cur_lenrZ
space_leftrrr�_handle_long_word�s
zTextWrapper._handle_long_wordc	Cs�g}|jdkrtd|j��|jdk	rb|jdkr8|j}n|j}t|�t|jj��|jkrbtd��|j��x&|�r�g}d}|r�|j}n|j}|jt|�}|j	r�|dj
�dkr�|r�|d=x:|r�t|d	�}|||kr�|j|j��||7}q�Pq�W|�r.t|d
�|k�r.|j
||||�ttt|��}|j	�rd|�rd|dj
�dk�rd|t|d�8}|d
=|rn|jdk�s�t|�d|jk�s�|�s�|j	�r�t|�dk�r�|dj
��r�||k�r�|j|dj|��qnx�|�r<|dj
��r"|t|j�|k�r"|j|j�|j|dj|��P|t|d�8}|d=�q�W|�rz|dj�}t|�t|j�|jk�rz||j|d<P|j||jj��PqnW|S)a�_wrap_chunks(chunks : [string]) -> [string]

        Wrap a sequence of text chunks and return a list of lines of
        length 'self.width' or less.  (If 'break_long_words' is false,
        some lines may be longer than this.)  Chunks correspond roughly
        to words and the whitespace between them: each chunk is
        indivisible (modulo 'break_long_words'), but a line break can
        come between any two chunks.  Chunks should not have internal
        whitespace; ie. a chunk is either all whitespace or a "word".
        Whitespace chunks will be removed from the beginning and end of
        lines, but apart from that whitespace is preserved.
        rzinvalid width %r (must be > 0)Nr	z#placeholder too large for max widthrr1r1r1r1r1r1r1r1r1r1r1r1)r�
ValueErrorrrrr.r�lstrip�reverser�stripr2r3r6�sum�map�join�rstrip)	rr)�linesrr4r5r�lZ	prev_linerrr�_wrap_chunks�sp





 
zTextWrapper._wrap_chunkscCs|j|�}|j|�S)N)r"r*)rr!rrr�
_split_chunksPs
zTextWrapper._split_chunkscCs$|j|�}|jr|j|�|j|�S)a^wrap(text : string) -> [string]

        Reformat the single paragraph in 'text' so it fits in lines of
        no more than 'self.width' columns, and return a list of wrapped
        lines.  Tabs in 'text' are expanded with string.expandtabs(),
        and all other whitespace characters (including newline) are
        converted to space.
        )rBrr0rA)rr!r)rrrrVs	

zTextWrapper.wrapcCsdj|j|��S)z�fill(text : string) -> string

        Reformat the single paragraph in 'text' to fit in lines of no
        more than 'self.width' columns, and return a new string
        containing the entire wrapped paragraph.
        �
)r=r)rr!rrrrdszTextWrapper.fill)
rrrTTFTTTr
)�__name__�
__module__�__qualname__�__doc__r �ordZuspace�_whitespace�xZ
word_punctZletter�re�escapeZ
whitespaceZnowhitespace�compile�VERBOSEr&r(r,rr"r*r0r6rArBrrrrrrrsJ/


!grcKstfd|i|��}|j|�S)a�Wrap a single paragraph of text, returning a list of wrapped lines.

    Reformat the single paragraph in 'text' so it fits in lines of no
    more than 'width' columns, and return a list of wrapped lines.  By
    default, tabs in 'text' are expanded with string.expandtabs(), and
    all other whitespace characters (including newline) are converted to
    space.  See TextWrapper class for available keyword args to customize
    wrapping behaviour.
    r)rr)r!r�kwargs�wrrrrps
cKstfd|i|��}|j|�S)a�Fill a single paragraph of text, returning a new string.

    Reformat the single paragraph in 'text' to fit in lines of no more
    than 'width' columns, and return a new string containing the entire
    wrapped paragraph.  As with wrap(), tabs are expanded and other
    whitespace characters converted to space.  See TextWrapper class for
    available keyword args to customize wrapping behaviour.
    r)rr)r!rrOrPrrrr}s	cKs,tf|dd�|��}|jdj|j�j���S)a�Collapse and truncate the given text to fit in the given width.

    The text first has its whitespace collapsed.  If it then fits in
    the *width*, it is returned as is.  Otherwise, as many words
    as possible are joined and then the placeholder is appended::

        >>> textwrap.shorten("Hello  world!", width=12)
        'Hello world!'
        >>> textwrap.shorten("Hello  world!", width=11)
        'Hello [...]'
    r	)rrr)rrr=r:r')r!rrOrPrrrr�sz^[ 	]+$z(^[ 	]*)(?:[^ 	
])cCs�d}tjd|�}tj|�}x||D]t}|dkr2|}q |j|�r>q |j|�rN|}q xDtt||��D]"\}\}}||kr^|d|�}Pq^W|dt|��}q Wdr�|r�x|jd�D]}q�W|r�t	jd|d|�}|S)a:Remove any common leading whitespace from every line in `text`.

    This can be used to make triple-quoted strings line up with the left
    edge of the display, while still presenting them in the source code
    in indented form.

    Note that tabs and spaces are both treated as whitespace, but they
    are not equal: the lines "  hello" and "\thello" are
    considered to have no common leading whitespace.  (This behaviour is
    new in Python 2.5; older versions of this module incorrectly
    expanded tabs before searching for common leading whitespace.)
    NrrrCz(?m)^)
�_whitespace_only_re�sub�_leading_whitespace_re�findall�
startswith�	enumerate�zipr.r'rK)r!Zmargin�indentsrr/rJ�y�linerrrr�s*



cs,�dkrdd�����fdd�}dj|��S)aFAdds 'prefix' to the beginning of selected lines in 'text'.

    If 'predicate' is provided, 'prefix' will only be added to the lines
    where 'predicate(line)' is True. If 'predicate' is not provided,
    it will default to adding 'prefix' to all non-empty lines that do not
    consist solely of whitespace characters.
    NcSs|j�S)N)r:)rZrrr�	predicate�szindent.<locals>.predicatec3s.x(�jd�D]}�|�r �|n|VqWdS)NT)�
splitlines)rZ)r[�prefixr!rr�prefixed_lines�szindent.<locals>.prefixed_linesr)r=)r!r]r[r^r)r[r]r!rr�s�__main__z Hello there.
  This is indented.)r)r)N)rGrK�__all__rIrrrrrM�	MULTILINErQrSrrrD�printrrrr�<module>sa

5
decimal.cpython-36.pyc000064400000000541150335715140010574 0ustar003


 \@�@svy0ddlTddlmZddlmZddlmZWn@ek
rpddlTddlmZddlmZddlmZYnXdS)�)�*)�__doc__)�__version__)�__libmpdec_version__N)Z_decimalrrr�ImportErrorZ
_pydecimal�rr�/usr/lib64/python3.6/decimal.py�<module>ssndhdr.cpython-36.pyc000064400000015403150335715140010463 0ustar003


 \��@s2dZddgZddlmZedd�Zdej_dej_d	ej_d
ej_dej	_dd�Z
d
d�ZgZdd�Z
eje
�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zed*k�r.e�d+S),a�Routines to help recognizing sound files.

Function whathdr() recognizes various types of sound file headers.
It understands almost all headers that SOX can decode.

The return tuple contains the following items, in this order:
- file type (as SOX understands it)
- sampling rate (0 if unknown or hard to decode)
- number of channels (0 if unknown or hard to decode)
- number of frames in the file (-1 if unknown or hard to decode)
- number of bits/sample, or 'U' for U-LAW, or 'A' for A-LAW

If the file doesn't have a recognizable type, it returns None.
If the file can't be opened, OSError is raised.

To compute the total time, divide the number of frames by the
sampling rate (a frame contains a sample for each channel).

Function what() calls whathdr().  (It used to also use some
heuristics for raw data, but this doesn't work very well.)

Finally, the function test() is a simple main program that calls
what() for all files mentioned on the argument list.  For directory
arguments it calls what() for all files in that directory.  Default
argument is "." (testing all files in the current directory).  The
option -r tells it to recurse down directories found inside
explicitly given directories.
�what�whathdr�)�
namedtuple�
SndHeadersz.filetype framerate nchannels nframes sampwidthz�The value for type indicates the data type
and will be one of the strings 'aifc', 'aiff', 'au','hcom',
'sndr', 'sndt', 'voc', 'wav', '8svx', 'sb', 'ub', or 'ul'.zYThe sampling_rate will be either the actual
value or 0 if unknown or difficult to decode.z^The number of channels or 0 if it cannot be
determined or if the value is difficult to decode.z?The value for frames will be either the number
of frames or -1.zAEither the sample size in bits or
'A' for A-LAW or 'U' for u-LAW.cCst|�}|S)zGuess the type of a sound file.)r)�filename�res�r�/usr/lib64/python3.6/sndhdr.pyr4scCsHt|d��4}|jd�}x"tD]}|||�}|rt|�SqWdSQRXdS)zRecognize sound headers.�rbiN)�open�read�testsr)r�f�hZtfrrrr	r:s


cCs�ddl}|jd�sdS|dd�dkr,d}n|dd�dkrBd}ndS|jd�y|j|d	�}Wnt|jfk
rzdSX||j�|j�|j�d|j	�fS)
NrsFORM��sAIFC�aifcsAIFFZaiff�r)
r�
startswith�seekr�EOFError�Error�getframerate�getnchannels�
getnframes�getsampwidth)rrrZfmt�arrr	�	test_aifcKs

rc
Cs�|jd�rt}n|dd�dkr&t}ndSd}||dd��}||dd��}||dd��}||dd	��}||d	d
��}d}	|dkr�d}
n$|d
kr�d}
n|dkr�d}
d
}	nd}
|	|}|r�||}nd}|||||
fS)Ns.snd��ds.�dns.Zaurr�����U���?)rr ���)r�get_long_be�get_long_le)
rr�func�filetypeZhdr_sizeZ	data_size�encoding�rate�	nchannelsZsample_sizeZsample_bitsZ
frame_sizeZnframerrr	�test_au`s2

r1cCsT|dd�dks |dd�dkr$dSt|dd��}|rBd	|}nd
}d|ddd
fS)N�A�EsFSSD��sHCOM��i"VrZhcomr$rr))r*)rrZdivisorr/rrr	�	test_hcom�s 
r8cCst|jd�sdSt|dd��}d}d|ko4dknrf||dkrfd||d}|rftd	|�}d
|dddfS)
NsCreative Voice Filer"�ri�r$�rg��.AZvocrr))r�get_short_le�int)rrZsbseekr/Zratecoderrr	�test_voc�s
$r=cCs�ddl}|jd�s4|dd�dks4|dd�dkr8dS|jd�y|j|d�}Wnt|jfk
rldSXd	|j�|j�|j�d|j	�fS)
NrsRIFFrrsWAVEr!sfmt rZwav)
�waverrZopenfprrrrrr)rrr>�wrrr	�test_wav�s,
r@cCs$|jd�s|dd�dkr dSdS)	NsFORMrrs8SVX�8svxrr$)rArr$rr)r)rrrrr	�	test_8svx�srBcCs<|jd�r8t|dd��}t|dd��}d|d|dfSdS)NsSOUNDrrr"r9Zsndtr$)rr+r;)rrZnsamplesr/rrr	�	test_sndt�s
rCcCsD|jd�r@t|dd��}d|ko,dknr@d|dd	dfSdS)
Nsr&ri�i�aZsndrr$rr))rr;)rrr/rrr	�	test_sndr�s
rDcCs,|dd>|dd>B|dd>B|dBS)Nrr#r$r!r&rr'r)�brrr	r*�sr*cCs,|dd>|dd>B|dd>B|dBS)Nr'r#r&r!r$rrr)rErrr	r+�sr+cCs|dd>|dBS)Nrrr$r)rErrr	�get_short_be�srFcCs|dd>|dBS)Nr$rrr)rErrr	r;�sr;cCs�ddl}d}|jdd�r8|jddkr8|jdd�=d}y8|jdd�r`t|jdd�|d�ntdg|d�Wn*tk
r�|jjd�|jd�YnXdS)Nrr$z-rr&�.z
[Interrupted]
)�sys�argv�testall�KeyboardInterrupt�stderr�write�exit)rH�	recursiverrr	�test�srPcCs�ddl}ddl}x�|D]�}|jj|�rzt|ddd�|s>|rptd�ddl}|j|jj|d��}t||d�q�td�qt|ddd�|jj	�ytt
|��Wqtk
r�td	�YqXqWdS)
Nrz/:� )�endzrecursing down:�*z*** directory (use -r) ***�:z*** not found ***)rH�os�path�isdir�print�glob�joinrJ�stdout�flushr�OSError)�listrOZtoplevelrHrUrrY�namesrrr	rJ�s"


rJ�__main__N)�__doc__�__all__�collectionsrrr-Z	framerater0ZnframesZ	sampwidthrrr
r�appendr1r8r=r@rBrCrDr*r+rFr;rPrJ�__name__rrrr	�<module>sH









difflib.cpython-36.opt-1.pyc000064400000164326150335715140011550 0ustar003


 \�I�@s8dZddddddddd	d
ddgZd
dlmZd
dlmZedd�Zdd�Z	Gdd�d�Z
d8dd�Zdd�ZGdd�d�Z
d
dlZejd�jfdd�Zd9dd�Zdd �Zd:d#d	�Zd$d%�Zd;d&d�Zd'd(�Zd<d+d
�Zdefd,d�Zddefd-d.�Zd/Zd0Zd1Zd2ZGd3d�de�Z [d4d�Z!d5d6�Z"e#d7k�r4e"�dS)=ae
Module difflib -- helpers for computing deltas between objects.

Function get_close_matches(word, possibilities, n=3, cutoff=0.6):
    Use SequenceMatcher to return list of the best "good enough" matches.

Function context_diff(a, b):
    For two lists of strings, return a delta in context diff format.

Function ndiff(a, b):
    Return a delta: the difference between `a` and `b` (lists of strings).

Function restore(delta, which):
    Return one of the two sequences that generated an ndiff delta.

Function unified_diff(a, b):
    For two lists of strings, return a delta in unified diff format.

Class SequenceMatcher:
    A flexible class for comparing pairs of sequences of any type.

Class Differ:
    For producing human-readable deltas from sequences of lines of text.

Class HtmlDiff:
    For producing HTML side by side comparison with change highlights.
�get_close_matches�ndiff�restore�SequenceMatcher�Differ�IS_CHARACTER_JUNK�IS_LINE_JUNK�context_diff�unified_diff�
diff_bytes�HtmlDiff�Match�)�nlargest)�
namedtupleza b sizecCs|rd||SdS)Ng@g�?�)�matches�lengthrr�/usr/lib64/python3.6/difflib.py�_calculate_ratio&src@steZdZdZddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zddd�Zdd�Z
dd�Zdd�ZdS) ra�
    SequenceMatcher is a flexible class for comparing pairs of sequences of
    any type, so long as the sequence elements are hashable.  The basic
    algorithm predates, and is a little fancier than, an algorithm
    published in the late 1980's by Ratcliff and Obershelp under the
    hyperbolic name "gestalt pattern matching".  The basic idea is to find
    the longest contiguous matching subsequence that contains no "junk"
    elements (R-O doesn't address junk).  The same idea is then applied
    recursively to the pieces of the sequences to the left and to the right
    of the matching subsequence.  This does not yield minimal edit
    sequences, but does tend to yield matches that "look right" to people.

    SequenceMatcher tries to compute a "human-friendly diff" between two
    sequences.  Unlike e.g. UNIX(tm) diff, the fundamental notion is the
    longest *contiguous* & junk-free matching subsequence.  That's what
    catches peoples' eyes.  The Windows(tm) windiff has another interesting
    notion, pairing up elements that appear uniquely in each sequence.
    That, and the method here, appear to yield more intuitive difference
    reports than does diff.  This method appears to be the least vulnerable
    to synching up on blocks of "junk lines", though (like blank lines in
    ordinary text files, or maybe "<P>" lines in HTML files).  That may be
    because this is the only method of the 3 that has a *concept* of
    "junk" <wink>.

    Example, comparing two strings, and considering blanks to be "junk":

    >>> s = SequenceMatcher(lambda x: x == " ",
    ...                     "private Thread currentThread;",
    ...                     "private volatile Thread currentThread;")
    >>>

    .ratio() returns a float in [0, 1], measuring the "similarity" of the
    sequences.  As a rule of thumb, a .ratio() value over 0.6 means the
    sequences are close matches:

    >>> print(round(s.ratio(), 3))
    0.866
    >>>

    If you're only interested in where the sequences match,
    .get_matching_blocks() is handy:

    >>> for block in s.get_matching_blocks():
    ...     print("a[%d] and b[%d] match for %d elements" % block)
    a[0] and b[0] match for 8 elements
    a[8] and b[17] match for 21 elements
    a[29] and b[38] match for 0 elements

    Note that the last tuple returned by .get_matching_blocks() is always a
    dummy, (len(a), len(b), 0), and this is the only case in which the last
    tuple element (number of elements matched) is 0.

    If you want to know how to change the first sequence into the second,
    use .get_opcodes():

    >>> for opcode in s.get_opcodes():
    ...     print("%6s a[%d:%d] b[%d:%d]" % opcode)
     equal a[0:8] b[0:8]
    insert a[8:8] b[8:17]
     equal a[8:29] b[17:38]

    See the Differ class for a fancy human-friendly file differencer, which
    uses SequenceMatcher both to compare sequences of lines, and to compare
    sequences of characters within similar (near-matching) lines.

    See also function get_close_matches() in this module, which shows how
    simple code building on SequenceMatcher can be used to do useful work.

    Timing:  Basic R-O is cubic time worst case and quadratic time expected
    case.  SequenceMatcher is quadratic time for the worst case and has
    expected-case behavior dependent in a complicated way on how many
    elements the sequences have in common; best case time is linear.

    Methods:

    __init__(isjunk=None, a='', b='')
        Construct a SequenceMatcher.

    set_seqs(a, b)
        Set the two sequences to be compared.

    set_seq1(a)
        Set the first sequence to be compared.

    set_seq2(b)
        Set the second sequence to be compared.

    find_longest_match(alo, ahi, blo, bhi)
        Find longest matching block in a[alo:ahi] and b[blo:bhi].

    get_matching_blocks()
        Return list of triples describing matching subsequences.

    get_opcodes()
        Return list of 5-tuples describing how to turn a into b.

    ratio()
        Return a measure of the sequences' similarity (float in [0,1]).

    quick_ratio()
        Return an upper bound on .ratio() relatively quickly.

    real_quick_ratio()
        Return an upper bound on ratio() very quickly.
    N�TcCs(||_d|_|_||_|j||�dS)a!Construct a SequenceMatcher.

        Optional arg isjunk is None (the default), or a one-argument
        function that takes a sequence element and returns true iff the
        element is junk.  None is equivalent to passing "lambda x: 0", i.e.
        no elements are considered to be junk.  For example, pass
            lambda x: x in " \t"
        if you're comparing lines as sequences of characters, and don't
        want to synch up on blanks or hard tabs.

        Optional arg a is the first of two sequences to be compared.  By
        default, an empty string.  The elements of a must be hashable.  See
        also .set_seqs() and .set_seq1().

        Optional arg b is the second of two sequences to be compared.  By
        default, an empty string.  The elements of b must be hashable. See
        also .set_seqs() and .set_seq2().

        Optional arg autojunk should be set to False to disable the
        "automatic junk heuristic" that treats popular elements as junk
        (see module documentation for more information).
        N)�isjunk�a�b�autojunk�set_seqs)�selfrrrrrrr�__init__�s;zSequenceMatcher.__init__cCs|j|�|j|�dS)z�Set the two sequences to be compared.

        >>> s = SequenceMatcher()
        >>> s.set_seqs("abcd", "bcde")
        >>> s.ratio()
        0.75
        N)�set_seq1�set_seq2)rrrrrrr�s	
zSequenceMatcher.set_seqscCs$||jkrdS||_d|_|_dS)aMSet the first sequence to be compared.

        The second sequence to be compared is not changed.

        >>> s = SequenceMatcher(None, "abcd", "bcde")
        >>> s.ratio()
        0.75
        >>> s.set_seq1("bcde")
        >>> s.ratio()
        1.0
        >>>

        SequenceMatcher computes and caches detailed information about the
        second sequence, so if you want to compare one sequence S against
        many sequences, use .set_seq2(S) once and call .set_seq1(x)
        repeatedly for each of the other sequences.

        See also set_seqs() and set_seq2().
        N)r�matching_blocks�opcodes)rrrrrr�s
zSequenceMatcher.set_seq1cCs2||jkrdS||_d|_|_d|_|j�dS)aMSet the second sequence to be compared.

        The first sequence to be compared is not changed.

        >>> s = SequenceMatcher(None, "abcd", "bcde")
        >>> s.ratio()
        0.75
        >>> s.set_seq2("abcd")
        >>> s.ratio()
        1.0
        >>>

        SequenceMatcher computes and caches detailed information about the
        second sequence, so if you want to compare one sequence S against
        many sequences, use .set_seq2(S) once and call .set_seq1(x)
        repeatedly for each of the other sequences.

        See also set_seqs() and set_seq1().
        N)rrr �
fullbcount�_SequenceMatcher__chain_b)rrrrrr�s
zSequenceMatcher.set_seq2cCs�|j}i|_}x*t|�D]\}}|j|g�}|j|�qWt�|_}|j}|r�x"|j�D]}||�r\|j	|�q\Wx|D]
}||=q|Wt�|_
}t|�}	|jr�|	dkr�|	dd}
x*|j
�D]\}}t|�|
kr�|j	|�q�Wx|D]
}||=q�WdS)N���d�)r�b2j�	enumerate�
setdefault�append�set�bjunkr�keys�addZbpopular�lenr�items)rrr&�i�elt�indicesZjunkrZpopular�nZntestZidxsrrrZ	__chain_b)s,



zSequenceMatcher.__chain_bcCsN|j|j|j|jjf\}}}}||d}	}
}i}g}
x�t||�D]�}|j}i}xn|j|||
�D]Z}||krpqb||krzP||dd�d}||<||krb||d||d|}	}
}qbW|}qBWxb|	|k�r*|
|k�r*|||
d��r*||	d||
dk�r*|	d|
d|d}	}
}q�WxX|	||k�r�|
||k�r�|||
|��r�||	|||
|k�r�|d7}�q.Wxb|	|k�r�|
|k�r�|||
d��r�||	d||
dk�r�|	d|
d|d}	}
}�q�WxV|	||k�r@|
||k�r@|||
|��r@||	|||
|k�r@|d}�q�Wt|	|
|�S)a�Find longest matching block in a[alo:ahi] and b[blo:bhi].

        If isjunk is not defined:

        Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where
            alo <= i <= i+k <= ahi
            blo <= j <= j+k <= bhi
        and for all (i',j',k') meeting those conditions,
            k >= k'
            i <= i'
            and if i == i', j <= j'

        In other words, of all maximal matching blocks, return one that
        starts earliest in a, and of all those maximal matching blocks that
        start earliest in a, return the one that starts earliest in b.

        >>> s = SequenceMatcher(None, " abcd", "abcd abcd")
        >>> s.find_longest_match(0, 5, 0, 9)
        Match(a=0, b=4, size=5)

        If isjunk is defined, first the longest matching block is
        determined as above, but with the additional restriction that no
        junk element appears in the block.  Then that block is extended as
        far as possible by matching (only) junk elements on both sides.  So
        the resulting block never matches on junk except as identical junk
        happens to be adjacent to an "interesting" match.

        Here's the same example as before, but considering blanks to be
        junk.  That prevents " abcd" from matching the " abcd" at the tail
        end of the second sequence directly.  Instead only the "abcd" can
        match, and matches the leftmost "abcd" in the second sequence:

        >>> s = SequenceMatcher(lambda x: x==" ", " abcd", "abcd abcd")
        >>> s.find_longest_match(0, 5, 0, 9)
        Match(a=1, b=0, size=4)

        If no blocks match, return (alo, blo, 0).

        >>> s = SequenceMatcher(None, "ab", "c")
        >>> s.find_longest_match(0, 2, 0, 1)
        Match(a=0, b=0, size=0)
        r
r%)rrr&r+�__contains__�range�getr)r�alo�ahi�blo�bhirrr&ZisbjunkZbestiZbestjZbestsizeZj2lenZnothingr0Zj2lengetZnewj2len�j�krrr�find_longest_matchPsB8$ 	"z"SequenceMatcher.find_longest_matchcCs�|jdk	r|jSt|j�t|j�}}d|d|fg}g}x�|r�|j�\}}}}|j||||�\}	}
}}|r:|j|�||	kr�||
kr�|j||	||
f�|	||kr:|
||kr:|j|	|||
||f�q:W|j�d}
}}g}x^|D]V\}}}|
||k�r|||k�r||7}q�|�r2|j|
||f�|||}
}}q�W|�r\|j|
||f�|j||df�tt	t
j|��|_|jS)aReturn list of triples describing matching subsequences.

        Each triple is of the form (i, j, n), and means that
        a[i:i+n] == b[j:j+n].  The triples are monotonically increasing in
        i and in j.  New in Python 2.5, it's also guaranteed that if
        (i, j, n) and (i', j', n') are adjacent triples in the list, and
        the second is not the last triple in the list, then i+n != i' or
        j+n != j'.  IOW, adjacent triples never describe adjacent equal
        blocks.

        The last triple is a dummy, (len(a), len(b), 0), and is the only
        triple with n==0.

        >>> s = SequenceMatcher(None, "abxcd", "abcd")
        >>> list(s.get_matching_blocks())
        [Match(a=0, b=0, size=2), Match(a=3, b=2, size=2), Match(a=5, b=4, size=0)]
        Nr
)rr.rr�popr=r)�sort�list�mapr�_make)r�la�lbZqueuerr7r8r9r:r0r;r<�x�i1�j1Zk1Znon_adjacent�i2�j2Zk2rrr�get_matching_blocks�s8


z#SequenceMatcher.get_matching_blockscCs�|jdk	r|jSd}}g|_}x�|j�D]�\}}}d}||krP||krPd}n||kr^d}n||krjd}|r�|j|||||f�||||}}|r,|jd||||f�q,W|S)a[Return list of 5-tuples describing how to turn a into b.

        Each tuple is of the form (tag, i1, i2, j1, j2).  The first tuple
        has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the
        tuple preceding it, and likewise for j1 == the previous j2.

        The tags are strings, with these meanings:

        'replace':  a[i1:i2] should be replaced by b[j1:j2]
        'delete':   a[i1:i2] should be deleted.
                    Note that j1==j2 in this case.
        'insert':   b[j1:j2] should be inserted at a[i1:i1].
                    Note that i1==i2 in this case.
        'equal':    a[i1:i2] == b[j1:j2]

        >>> a = "qabxcd"
        >>> b = "abycdf"
        >>> s = SequenceMatcher(None, a, b)
        >>> for tag, i1, i2, j1, j2 in s.get_opcodes():
        ...    print(("%7s a[%d:%d] (%s) b[%d:%d] (%s)" %
        ...           (tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2])))
         delete a[0:1] (q) b[0:0] ()
          equal a[1:3] (ab) b[0:2] (ab)
        replace a[3:4] (x) b[2:3] (y)
          equal a[4:6] (cd) b[3:5] (cd)
         insert a[6:6] () b[5:6] (f)
        Nr
r�replace�delete�insert�equal)r rJr))rr0r;Zanswer�ai�bj�size�tagrrr�get_opcodess$

zSequenceMatcher.get_opcodes�c

csr|j�}|sdg}|dddkrZ|d\}}}}}|t|||�|t|||�|f|d<|dddkr�|d\}}}}}||t|||�|t|||�f|d<||}g}	x�|D]�\}}}}}|dko�|||k�r(|	j||t|||�|t|||�f�|	Vg}	t|||�t|||�}}|	j|||||f�q�W|	�rnt|	�dk�ob|	dddk�rn|	VdS)	a� Isolate change clusters by eliminating ranges with no changes.

        Return a generator of groups with up to n lines of context.
        Each group is in the same format as returned by get_opcodes().

        >>> from pprint import pprint
        >>> a = list(map(str, range(1,40)))
        >>> b = a[:]
        >>> b[8:8] = ['i']     # Make an insertion
        >>> b[20] += 'x'       # Make a replacement
        >>> b[23:28] = []      # Make a deletion
        >>> b[30] += 'y'       # Make another replacement
        >>> pprint(list(SequenceMatcher(None,a,b).get_grouped_opcodes()))
        [[('equal', 5, 8, 5, 8), ('insert', 8, 8, 8, 9), ('equal', 8, 11, 9, 12)],
         [('equal', 16, 19, 17, 20),
          ('replace', 19, 20, 20, 21),
          ('equal', 20, 22, 21, 23),
          ('delete', 22, 27, 23, 23),
          ('equal', 27, 30, 23, 26)],
         [('equal', 31, 34, 27, 30),
          ('replace', 34, 35, 30, 31),
          ('equal', 35, 38, 31, 34)]]
        rNr
r%N)rNr
r%r
r%���rUrU)rS�max�minr)r.)
rr3ZcodesrRrFrHrGrIZnn�grouprrr�get_grouped_opcodes<s(&&((z#SequenceMatcher.get_grouped_opcodescCs0tdd�|j�D��}t|t|j�t|j��S)a�Return a measure of the sequences' similarity (float in [0,1]).

        Where T is the total number of elements in both sequences, and
        M is the number of matches, this is 2.0*M / T.
        Note that this is 1 if the sequences are identical, and 0 if
        they have nothing in common.

        .ratio() is expensive to compute if you haven't already computed
        .get_matching_blocks() or .get_opcodes(), in which case you may
        want to try .quick_ratio() or .real_quick_ratio() first to get an
        upper bound.

        >>> s = SequenceMatcher(None, "abcd", "bcde")
        >>> s.ratio()
        0.75
        >>> s.quick_ratio()
        0.75
        >>> s.real_quick_ratio()
        1.0
        css|]}|dVqdS)r%NrUr)�.0Ztriplerrr�	<genexpr>�sz(SequenceMatcher.ratio.<locals>.<genexpr>)�sumrJrr.rr)rrrrr�rationszSequenceMatcher.ratiocCs�|jdkr8i|_}x"|jD]}|j|d�d||<qW|j}i}|jd}}xH|jD]>}||�rl||}n|j|d�}|d||<|dkrV|d}qVWt|t|j�t|j��S)z�Return an upper bound on ratio() relatively quickly.

        This isn't defined beyond that it is an upper bound on .ratio(), and
        is faster to compute.
        Nr
r%)r!rr6r4rrr.)rr!r1ZavailZavailhasrZnumbrrr�quick_ratio�s



zSequenceMatcher.quick_ratiocCs*t|j�t|j�}}tt||�||�S)z�Return an upper bound on ratio() very quickly.

        This isn't defined beyond that it is an upper bound on .ratio(), and
        is faster to compute than either .ratio() or .quick_ratio().
        )r.rrrrW)rrCrDrrr�real_quick_ratio�sz SequenceMatcher.real_quick_ratio)NrrT)rT)�__name__�
__module__�__qualname__�__doc__rrrrr"r=rJrSrYr]r^r_rrrrr+sj
@,'nG7
2rT�333333�?cCs�|dkstd|f��d|ko(dkns<td|f��g}t�}|j|�xL|D]D}|j|�|j�|krV|j�|krV|j�|krV|j|j�|f�qVWt||�}dd�|D�S)a�Use SequenceMatcher to return list of the best "good enough" matches.

    word is a sequence for which close matches are desired (typically a
    string).

    possibilities is a list of sequences against which to match word
    (typically a list of strings).

    Optional arg n (default 3) is the maximum number of close matches to
    return.  n must be > 0.

    Optional arg cutoff (default 0.6) is a float in [0, 1].  Possibilities
    that don't score at least that similar to word are ignored.

    The best (no more than n) matches among the possibilities are returned
    in a list, sorted by similarity score, most similar first.

    >>> get_close_matches("appel", ["ape", "apple", "peach", "puppy"])
    ['apple', 'ape']
    >>> import keyword as _keyword
    >>> get_close_matches("wheel", _keyword.kwlist)
    ['while']
    >>> get_close_matches("Apple", _keyword.kwlist)
    []
    >>> get_close_matches("accept", _keyword.kwlist)
    ['except']
    r
zn must be > 0: %rgg�?z cutoff must be in [0.0, 1.0]: %rcSsg|]\}}|�qSrr)rZZscorerErrr�
<listcomp>�sz%get_close_matches.<locals>.<listcomp>)	�
ValueErrorrrrr_r^r]r)�	_nlargest)ZwordZ
possibilitiesr3�cutoff�result�srErrrr�s



cCs4dt|�}}x ||kr.|||kr.|d7}qW|S)z}
    Return number of `ch` characters at the start of `line`.

    Example:

    >>> _count_leading('   abc', ' ')
    3
    r
r%)r.)�line�chr0r3rrr�_count_leading�s
rmc@sJeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)ra�

    Differ is a class for comparing sequences of lines of text, and
    producing human-readable differences or deltas.  Differ uses
    SequenceMatcher both to compare sequences of lines, and to compare
    sequences of characters within similar (near-matching) lines.

    Each line of a Differ delta begins with a two-letter code:

        '- '    line unique to sequence 1
        '+ '    line unique to sequence 2
        '  '    line common to both sequences
        '? '    line not present in either input sequence

    Lines beginning with '? ' attempt to guide the eye to intraline
    differences, and were not present in either input sequence.  These lines
    can be confusing if the sequences contain tab characters.

    Note that Differ makes no claim to produce a *minimal* diff.  To the
    contrary, minimal diffs are often counter-intuitive, because they synch
    up anywhere possible, sometimes accidental matches 100 pages apart.
    Restricting synch points to contiguous matches preserves some notion of
    locality, at the occasional cost of producing a longer diff.

    Example: Comparing two texts.

    First we set up the texts, sequences of individual single-line strings
    ending with newlines (such sequences can also be obtained from the
    `readlines()` method of file-like objects):

    >>> text1 = '''  1. Beautiful is better than ugly.
    ...   2. Explicit is better than implicit.
    ...   3. Simple is better than complex.
    ...   4. Complex is better than complicated.
    ... '''.splitlines(keepends=True)
    >>> len(text1)
    4
    >>> text1[0][-1]
    '\n'
    >>> text2 = '''  1. Beautiful is better than ugly.
    ...   3.   Simple is better than complex.
    ...   4. Complicated is better than complex.
    ...   5. Flat is better than nested.
    ... '''.splitlines(keepends=True)

    Next we instantiate a Differ object:

    >>> d = Differ()

    Note that when instantiating a Differ object we may pass functions to
    filter out line and character 'junk'.  See Differ.__init__ for details.

    Finally, we compare the two:

    >>> result = list(d.compare(text1, text2))

    'result' is a list of strings, so let's pretty-print it:

    >>> from pprint import pprint as _pprint
    >>> _pprint(result)
    ['    1. Beautiful is better than ugly.\n',
     '-   2. Explicit is better than implicit.\n',
     '-   3. Simple is better than complex.\n',
     '+   3.   Simple is better than complex.\n',
     '?     ++\n',
     '-   4. Complex is better than complicated.\n',
     '?            ^                     ---- ^\n',
     '+   4. Complicated is better than complex.\n',
     '?           ++++ ^                      ^\n',
     '+   5. Flat is better than nested.\n']

    As a single multi-line string it looks like this:

    >>> print(''.join(result), end="")
        1. Beautiful is better than ugly.
    -   2. Explicit is better than implicit.
    -   3. Simple is better than complex.
    +   3.   Simple is better than complex.
    ?     ++
    -   4. Complex is better than complicated.
    ?            ^                     ---- ^
    +   4. Complicated is better than complex.
    ?           ++++ ^                      ^
    +   5. Flat is better than nested.

    Methods:

    __init__(linejunk=None, charjunk=None)
        Construct a text differencer, with optional filters.

    compare(a, b)
        Compare two sequences of lines; generate the resulting delta.
    NcCs||_||_dS)a�
        Construct a text differencer, with optional filters.

        The two optional keyword parameters are for filter functions:

        - `linejunk`: A function that should accept a single string argument,
          and return true iff the string is junk. The module-level function
          `IS_LINE_JUNK` may be used to filter out lines without visible
          characters, except for at most one splat ('#').  It is recommended
          to leave linejunk None; the underlying SequenceMatcher class has
          an adaptive notion of "noise" lines that's better than any static
          definition the author has ever been able to craft.

        - `charjunk`: A function that should accept a string of length 1. The
          module-level function `IS_CHARACTER_JUNK` may be used to filter out
          whitespace characters (a blank or tab; **note**: bad idea to include
          newline in this!).  Use of IS_CHARACTER_JUNK is recommended.
        N)�linejunk�charjunk)rrnrorrrrMszDiffer.__init__c
cs�t|j||�}x�|j�D]�\}}}}}|dkrD|j||||||�}	n\|dkr^|jd|||�}	nB|dkrx|jd|||�}	n(|dkr�|jd|||�}	ntd|f��|	Ed	HqWd	S)
a�
        Compare two sequences of lines; generate the resulting delta.

        Each sequence must contain individual single-line strings ending with
        newlines. Such sequences can be obtained from the `readlines()` method
        of file-like objects.  The delta generated also consists of newline-
        terminated strings, ready to be printed as-is via the writeline()
        method of a file-like object.

        Example:

        >>> print(''.join(Differ().compare('one\ntwo\nthree\n'.splitlines(True),
        ...                                'ore\ntree\nemu\n'.splitlines(True))),
        ...       end="")
        - one
        ?  ^
        + ore
        ?  ^
        - two
        - three
        ?  -
        + tree
        + emu
        rKrL�-rM�+rN� zunknown tag %rN)rrnrS�_fancy_replace�_dumprf)
rrr�cruncherrRr7r8r9r:�grrr�comparedszDiffer.compareccs*x$t||�D]}d|||fVqWdS)z4Generate comparison results for a same-tagged range.z%s %sN)r5)rrRrE�lo�hir0rrrrt�szDiffer._dumpc
csr||||kr2|jd|||�}|jd|||�}n |jd|||�}|jd|||�}x||fD]}	|	EdHq\WdS)Nrqrp)rt)
rrr7r8rr9r:�first�secondrvrrr�_plain_replace�szDiffer._plain_replaceccsHd\}}t|j�}	d\}
}x�t||�D]�}||}
|	j|
�xxt||�D]j}||}||
krp|
dkrH||}
}qH|	j|�|	j�|krH|	j�|krH|	j�|krH|	j�||}}}qHWq&W||k�r�|
dkr�|j||||||�EdHdS|
|d}}}nd}
|j	||||||�EdH||||}}|
dk�rd}}|	j
||�x�|	j�D]�\}}}}}||||}}|dk�r�|d|7}|d|7}nb|dk�r�|d	|7}nJ|d
k�r�|d|7}n2|dk�r�|d
|7}|d
|7}ntd|f���qTW|j
||||�EdHn
d|V|j	||d|||d|�EdHdS)aL
        When replacing one block of lines with another, search the blocks
        for *similar* lines; the best-matching pair (if any) is used as a
        synch point, and intraline difference marking is done on the
        similar pair. Lots of work, but often worth it.

        Example:

        >>> d = Differ()
        >>> results = d._fancy_replace(['abcDefghiJkl\n'], 0, 1,
        ...                            ['abcdefGhijkl\n'], 0, 1)
        >>> print(''.join(results), end="")
        - abcDefghiJkl
        ?    ^  ^  ^
        + abcdefGhijkl
        ?    ^  ^  ^
        �G�z��?��?Ng�?rrK�^rLrprMrqrNrrzunknown tag %rz  r%)r}r~)NN)rror5rrr_r^r]r|�
_fancy_helperrrSrf�_qformat)rrr7r8rr9r:Z
best_ratiorhruZeqiZeqjr;rPr0rOZbest_iZbest_jZaeltZbelt�atags�btagsrRZai1Zai2Zbj1Zbj2rCrDrrrrs�sX










zDiffer._fancy_replaceccsbg}||kr<||kr*|j||||||�}qT|jd|||�}n||krT|jd|||�}|EdHdS)Nrprq)rsrt)rrr7r8rr9r:rvrrrr��szDiffer._fancy_helperccs�tt|d�t|d��}t|t|d|�d��}t|t|d|�d��}||d�j�}||d�j�}d|V|r�dd||fVd|V|r�dd||fVdS)a�
        Format "?" output and deal with leading tabs.

        Example:

        >>> d = Differ()
        >>> results = d._qformat('\tabcDefghiJkl\n', '\tabcdefGhijkl\n',
        ...                      '  ^ ^  ^      ', '  ^ ^  ^      ')
        >>> for line in results: print(repr(line))
        ...
        '- \tabcDefghiJkl\n'
        '? \t ^ ^  ^\n'
        '+ \tabcdefGhijkl\n'
        '? \t ^ ^  ^\n'
        �	Nrrz- z? %s%s
z+ )rWrm�rstrip)rZalineZbliner�r��commonrrrr�
s


zDiffer._qformat)NN)r`rarbrcrrwrtr|rsr�r�rrrrr�s\
)^Nz
\s*(?:#\s*)?$cCs||�dk	S)z�
    Return 1 for ignorable line: iff `line` is blank or contains a single '#'.

    Examples:

    >>> IS_LINE_JUNK('\n')
    True
    >>> IS_LINE_JUNK('  #   \n')
    True
    >>> IS_LINE_JUNK('hello\n')
    False
    Nr)rkZpatrrrr>s� 	cCs||kS)z�
    Return 1 for ignorable character: iff `ch` is a space or tab.

    Examples:

    >>> IS_CHARACTER_JUNK(' ')
    True
    >>> IS_CHARACTER_JUNK('\t')
    True
    >>> IS_CHARACTER_JUNK('\n')
    False
    >>> IS_CHARACTER_JUNK('x')
    False
    r)rlZwsrrrrNscCs:|d}||}|dkr"dj|�S|s.|d8}dj||�S)z Convert range to the "ed" formatr%z{}z{},{})�format)�start�stop�	beginningrrrr�_format_range_unifiedes
r�r�
ccsht|||||||�d}�xHtd||�j|�D�]0}	|s�d}|rJdj|�nd}
|r\dj|�nd}dj||
|�Vdj|||�V|	d|	d}}
t|d	|
d
�}t|d|
d�}d
j|||�Vx�|	D]�\}}}}}|dk�rx|||�D]}d|Vq�Wq�|dk�r2x |||�D]}d|V�qW|dkr�x |||�D]}d|V�qHWq�Wq.WdS)a�
    Compare two sequences of lines; generate the delta as a unified diff.

    Unified diffs are a compact way of showing line changes and a few
    lines of context.  The number of context lines is set by 'n' which
    defaults to three.

    By default, the diff control lines (those with ---, +++, or @@) are
    created with a trailing newline.  This is helpful so that inputs
    created from file.readlines() result in diffs that are suitable for
    file.writelines() since both the inputs and outputs have trailing
    newlines.

    For inputs that do not have trailing newlines, set the lineterm
    argument to "" so that the output will be uniformly newline free.

    The unidiff format normally has a header for filenames and modification
    times.  Any or all of these may be specified using strings for
    'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.
    The modification times are normally expressed in the ISO 8601 format.

    Example:

    >>> for line in unified_diff('one two three four'.split(),
    ...             'zero one tree four'.split(), 'Original', 'Current',
    ...             '2005-01-26 23:30:50', '2010-04-02 10:20:52',
    ...             lineterm=''):
    ...     print(line)                 # doctest: +NORMALIZE_WHITESPACE
    --- Original        2005-01-26 23:30:50
    +++ Current         2010-04-02 10:20:52
    @@ -1,4 +1,4 @@
    +zero
     one
    -two
    -three
    +tree
     four
    FNTz	{}rz
--- {}{}{}z
+++ {}{}{}r
r%�rT�z@@ -{} +{} @@{}rNrrrKrLrprMrqrU>rKrL>rMrK)�_check_typesrrYr�r�)rr�fromfile�tofile�fromfiledate�
tofiledater3�lineterm�startedrX�fromdate�todaterz�last�file1_range�file2_rangerRrFrHrGrIrkrrrr	ps0)

cCsB|d}||}|s|d8}|dkr.dj|�Sdj|||d�S)z Convert range to the "ed" formatr%z{}z{},{})r�)r�r�r�rrrr�_format_range_context�s
r�ccs�t|||||||�tddddd�}d}	�xztd||�j|�D�]b}
|	s�d}	|rZd	j|�nd
}|rld	j|�nd
}dj|||�Vdj|||�V|
d
|
d}
}d|Vt|
d|d�}dj||�Vtdd�|
D���r&xD|
D]<\}}}}}|dkr�x$|||�D]}|||V�q
Wq�Wt|
d|d�}dj||�Vtdd�|
D��r>xH|
D]@\}}}}}|dk�r^x$|||�D]}|||V�q�W�q^Wq>WdS)ah
    Compare two sequences of lines; generate the delta as a context diff.

    Context diffs are a compact way of showing line changes and a few
    lines of context.  The number of context lines is set by 'n' which
    defaults to three.

    By default, the diff control lines (those with *** or ---) are
    created with a trailing newline.  This is helpful so that inputs
    created from file.readlines() result in diffs that are suitable for
    file.writelines() since both the inputs and outputs have trailing
    newlines.

    For inputs that do not have trailing newlines, set the lineterm
    argument to "" so that the output will be uniformly newline free.

    The context diff format normally has a header for filenames and
    modification times.  Any or all of these may be specified using
    strings for 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.
    The modification times are normally expressed in the ISO 8601 format.
    If not specified, the strings default to blanks.

    Example:

    >>> print(''.join(context_diff('one\ntwo\nthree\nfour\n'.splitlines(True),
    ...       'zero\none\ntree\nfour\n'.splitlines(True), 'Original', 'Current')),
    ...       end="")
    *** Original
    --- Current
    ***************
    *** 1,4 ****
      one
    ! two
    ! three
      four
    --- 1,4 ----
    + zero
      one
    ! tree
      four
    z+ z- z! z  )rMrLrKrNFNTz	{}rz
*** {}{}{}z
--- {}{}{}r
r%z***************r�z
*** {} ****{}css |]\}}}}}|dkVqdS)rKrLN>rKrLr)rZrR�_rrrr[szcontext_diff.<locals>.<genexpr>rMrTr�z
--- {} ----{}css |]\}}}}}|dkVqdS)rKrMN>rMrKr)rZrRr�rrrr[srLrU)r��dictrrYr�r��any)rrr�r�r�r�r3r��prefixr�rXr�r�rzr�r�rRrFrHr�rkr�rGrIrrrr�s4,

cGs�|r2t|dt�r2tdt|d�j|df��|rdt|dt�rdtdt|d�j|df��x$|D]}t|t�sjtd|f��qjWdS)Nr
z)lines to compare must be str, not %s (%r)z"all arguments must be str, not: %r)�
isinstance�str�	TypeError�typer`)rr�args�argrrrr�s

r���
c		cs�dd�}	tt|	|��}tt|	|��}|	|�}|	|�}|	|�}|	|�}|	|�}|||||||||�}
x|
D]}|jdd�VqhWdS)a�
    Compare `a` and `b`, two sequences of lines represented as bytes rather
    than str. This is a wrapper for `dfunc`, which is typically either
    unified_diff() or context_diff(). Inputs are losslessly converted to
    strings so that `dfunc` only has to worry about strings, and encoded
    back to bytes on return. This is necessary to compare files with
    unknown or inconsistent encoding. All other inputs (except `n`) must be
    bytes rather than str.
    cSsPy|jdd�Stk
rJ}z"dt|�j|f}t|�|�WYdd}~XnXdS)N�ascii�surrogateescapez(all arguments must be bytes, not %s (%r))�decode�AttributeErrorr�r`r�)rj�err�msgrrrr�-szdiff_bytes.<locals>.decoder�r�N)r@rA�encode)Zdfuncrrr�r�r�r�r3r�r��linesrkrrrr
"s
cCst||�j||�S)aJ
    Compare `a` and `b` (lists of strings); return a `Differ`-style delta.

    Optional keyword parameters `linejunk` and `charjunk` are for filter
    functions, or can be None:

    - linejunk: A function that should accept a single string argument and
      return true iff the string is junk.  The default is None, and is
      recommended; the underlying SequenceMatcher class has an adaptive
      notion of "noise" lines.

    - charjunk: A function that accepts a character (string of length
      1), and returns true iff the character is junk. The default is
      the module-level function IS_CHARACTER_JUNK, which filters out
      whitespace characters (a blank or tab; note: it's a bad idea to
      include newline in this!).

    Tools/scripts/ndiff.py is a command-line front-end to this function.

    Example:

    >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
    ...              'ore\ntree\nemu\n'.splitlines(keepends=True))
    >>> print(''.join(diff), end="")
    - one
    ?  ^
    + ore
    ?  ^
    - two
    - three
    ?  -
    + tree
    + emu
    )rrw)rrrnrorrrr@s#c#s�ddl}|jd��t||||��ddgf�fdd�	���fdd���fdd	�}|�}|dkrj|EdH�n.|d
7}d}�xddg|}	}
d}xR|dkr�yt|�\}}
}Wntk
r�dSX|	|}||
|f|
|<|	d
7}	q�W|	|k�r�dV|}n|	}d}	x.|�r.|	|}|	d
7}	|
|V|d
8}�qW|d
}yDx>|�rxt|�\}}
}|�r`|d
}n|d
8}||
|fV�q<WWqztk
�r�dSXqzWdS)
a�Returns generator yielding marked up from/to side by side differences.

    Arguments:
    fromlines -- list of text lines to compared to tolines
    tolines -- list of text lines to be compared to fromlines
    context -- number of context lines to display on each side of difference,
               if None, all from/to text lines will be generated.
    linejunk -- passed on to ndiff (see ndiff documentation)
    charjunk -- passed on to ndiff (see ndiff documentation)

    This function returns an iterator which returns a tuple:
    (from line tuple, to line tuple, boolean flag)

    from/to line tuple -- (line num, line text)
        line num -- integer or None (to indicate a context separation)
        line text -- original line text with following markers inserted:
            '\0+' -- marks start of added text
            '\0-' -- marks start of deleted text
            '\0^' -- marks start of changed text
            '\1' -- marks end of added/deleted/changed text

    boolean flag -- None indicates context separation, True indicates
        either "from" or "to" line contains a change, otherwise False.

    This function/iterator was originally developed to generate side by side
    file difference for making HTML pages (see HtmlDiff class for example
    usage).

    Note, this function utilizes the ndiff function to generate the side by
    side difference markup.  Optional ndiff arguments may be passed to this
    function and they in turn will be passed to ndiff.
    r
Nz
(\++|\-+|\^+)cs�||d7<|dkr2|||jd�dd�fS|dkr�|jd�|jd�}}g}|fdd�}�j||�xHt|�D]<\}\}	}
|d|	�d|||	|
�d	||
d�}qvW|dd�}n*|jd�dd�}|s�d
}d||d	}|||fS)aReturns line of text with user's change markup and line formatting.

        lines -- list of lines from the ndiff generator to produce a line of
                 text from.  When producing the line of text to return, the
                 lines used are removed from this list.
        format_key -- '+' return first line in list with "add" markup around
                          the entire line.
                      '-' return first line in list with "delete" markup around
                          the entire line.
                      '?' return first line in list with add/delete/change
                          intraline markup (indices obtained from second line)
                      None return first line in list with no markup
        side -- indice into the num_lines list (0=from,1=to)
        num_lines -- from/to current line number.  This is NOT intended to be a
                     passed parameter.  It is present as a keyword argument to
                     maintain memory of the current line numbers between calls
                     of this function.

        Note, this function is purposefully not defined at the module scope so
        that data it needs from its parent function (within whose context it
        is defined) does not need to be of module scope.
        r%Nr
r��?cSs&|j|jd�d|j�g�|jd�S)Nr%r
)r)rX�span)Zmatch_object�sub_inforrr�record_sub_info�sz3_mdiff.<locals>._make_line.<locals>.record_sub_info��rr)r>�sub�reversed)r�Z
format_key�sideZ	num_lines�textZmarkersr�r��keyZbegin�end)�	change_rerr�
_make_line�s 4z_mdiff.<locals>._make_linec3s�g}d\}}�xlx t|�dkr0|jt�d��qWdjdd�|D��}|jd�rX|}�n�|jd�r��|dd��|dd	�d
fVq�n�|jd�r�|d	8}�|dd�d
d
fVq�nl|jd�rވ|dd�d
}}|d	d}}�n>|jd��r�|d
d��|dd	�d
fVq�n|jd��r8�|dd��|d
d	�d
fVqn�|jd��rd|d	8}�|dd�d
d
fVqn�|jd��r�|d	7}d
�|dd	�d
fVqn�|jd��r�d
�|dd	�}}|d	d}}n^|jd��r�|d	7}d
�|dd	�d
fVqn2|jd��r�|d
d
�d
d��|d
d	�dfVqx|dk�r:|d	7}dV�qWx|dk�rZ|d	8}d V�q>W|jd��rld
S||d
fVqWd
S)!a�Yields from/to lines of text with a change indication.

        This function is an iterator.  It itself pulls lines from a
        differencing iterator, processes them and yields them.  When it can
        it yields both a "from" and a "to" line, otherwise it will yield one
        or the other.  In addition to yielding the lines of from/to text, a
        boolean flag is yielded to indicate if the text line(s) have
        differences in them.

        Note, this function is purposefully not defined at the module scope so
        that data it needs from its parent function (within whose context it
        is defined) does not need to be of module scope.
        r
r��XrcSsg|]}|d�qS)r
r)rZrkrrrre�sz2_mdiff.<locals>._line_iterator.<locals>.<listcomp>z-?+?r�r%Tz--++rpN�--?+�--+�- z-+?z-?+z+--rq�+ �+-rrFr�)r
r
)r�r�r�)r�r��rr�)Nr�T�rr�)r�NT)r.r)�next�join�
startswith)r�Znum_blanks_pendingZnum_blanks_to_yieldrj�	from_line�to_line)r��diff_lines_iteratorrr�_line_iterator�sf



$z_mdiff.<locals>._line_iteratorc3s���}gg}}x�xpt|�dks,t|�dkr�yt|�\}}}Wntk
rRdSX|dk	rj|j||f�|dk	r|j||f�qW|jd�\}}|jd�\}}|||p�|fVqWdS)atYields from/to lines of text with a change indication.

        This function is an iterator.  It itself pulls lines from the line
        iterator.  Its difference from that iterator is that this function
        always yields a pair of from/to text lines (with the change
        indication).  If necessary it will collect single from/to lines
        until it has a matching pair from/to pair to yield.

        Note, this function is purposefully not defined at the module scope so
        that data it needs from its parent function (within whose context it
        is defined) does not need to be of module scope.
        r
N)r.r��
StopIterationr)r>)Z
line_iterator�	fromlines�tolinesr�r��
found_diffZfromDiffZto_diff)r�rr�_line_pair_iterators

z#_mdiff.<locals>._line_pair_iteratorr%F)NNN)�re�compilerr�r�)r�r��contextrnror�r�Zline_pair_iteratorZlines_to_write�indexZcontextLinesr�r�r�r0r)r�r�r�r�r�_mdiffesT"
8X!



r�an
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>
    <meta http-equiv="Content-Type"
          content="text/html; charset=%(charset)s" />
    <title></title>
    <style type="text/css">%(styles)s
    </style>
</head>

<body>
    %(table)s%(legend)s
</body>

</html>aH
        table.diff {font-family:Courier; border:medium;}
        .diff_header {background-color:#e0e0e0}
        td.diff_header {text-align:right}
        .diff_next {background-color:#c0c0c0}
        .diff_add {background-color:#aaffaa}
        .diff_chg {background-color:#ffff77}
        .diff_sub {background-color:#ffaaaa}aZ
    <table class="diff" id="difflib_chg_%(prefix)s_top"
           cellspacing="0" cellpadding="0" rules="groups" >
        <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
        <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
        %(header_row)s
        <tbody>
%(data_rows)s        </tbody>
    </table>a�
    <table class="diff" summary="Legends">
        <tr> <th colspan="2"> Legends </th> </tr>
        <tr> <td> <table border="" summary="Colors">
                      <tr><th> Colors </th> </tr>
                      <tr><td class="diff_add">&nbsp;Added&nbsp;</td></tr>
                      <tr><td class="diff_chg">Changed</td> </tr>
                      <tr><td class="diff_sub">Deleted</td> </tr>
                  </table></td>
             <td> <table border="" summary="Links">
                      <tr><th colspan="2"> Links </th> </tr>
                      <tr><td>(f)irst change</td> </tr>
                      <tr><td>(n)ext change</td> </tr>
                      <tr><td>(t)op</td> </tr>
                  </table></td> </tr>
    </table>c@s�eZdZdZeZeZeZeZdZddde	fdd�Z
dd
d�dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zddd�ZdS) ra{For producing HTML side by side comparison with change highlights.

    This class can be used to create an HTML table (or a complete HTML file
    containing the table) showing a side by side, line by line comparison
    of text with inter-line and intra-line change highlights.  The table can
    be generated in either full or contextual difference mode.

    The following methods are provided for HTML generation:

    make_table -- generates HTML for a single side by side table
    make_file -- generates complete HTML file with a single side by side table

    See tools/scripts/diff.py for an example usage of this class.
    r
�NcCs||_||_||_||_dS)a�HtmlDiff instance initializer

        Arguments:
        tabsize -- tab stop spacing, defaults to 8.
        wrapcolumn -- column number where lines are broken and wrapped,
            defaults to None where lines are not wrapped.
        linejunk,charjunk -- keyword arguments passed into ndiff() (used by
            HtmlDiff() to generate the side by side HTML differences).  See
            ndiff() documentation for argument default values and descriptions.
        N)�_tabsize�_wrapcolumn�	_linejunk�	_charjunk)r�tabsizeZ
wrapcolumnrnrorrrr�szHtmlDiff.__init__rF�zutf-8)�charsetcCs:|jt|j|j|j||||||d�|d�j|d�j|�S)aReturns HTML file of side by side comparison with change highlights

        Arguments:
        fromlines -- list of "from" lines
        tolines -- list of "to" lines
        fromdesc -- "from" file column header string
        todesc -- "to" file column header string
        context -- set to True for contextual differences (defaults to False
            which shows full differences).
        numlines -- number of context lines.  When context is set True,
            controls number of lines displayed before and after the change.
            When context is False, controls the number of lines to place
            the "next" link anchors before the next change (so click of
            "next" link jumps to just before the change).
        charset -- charset of the HTML document
        )r��numlines)ZstylesZlegend�tabler��xmlcharrefreplace)�_file_templater��_styles�_legend�
make_tabler�r�)rr�r��fromdesc�todescr�r�r�rrr�	make_file�s
zHtmlDiff.make_filecs8�fdd���fdd�|D�}�fdd�|D�}||fS)aReturns from/to line lists with tabs expanded and newlines removed.

        Instead of tab characters being replaced by the number of spaces
        needed to fill in to the next tab stop, this function will fill
        the space with tab characters.  This is done so that the difference
        algorithms can identify changes in a file when tabs are replaced by
        spaces and vice versa.  At the end of the HTML generation, the tab
        characters will be replaced with a nonbreakable space.
        cs6|jdd�}|j�j�}|jdd�}|jdd�jd�S)Nrrr�r�r�)rK�
expandtabsr�r�)rk)rrr�expand_tabs�sz2HtmlDiff._tab_newline_replace.<locals>.expand_tabscsg|]}�|��qSrr)rZrk)r�rrresz1HtmlDiff._tab_newline_replace.<locals>.<listcomp>csg|]}�|��qSrr)rZrk)r�rrresr)rr�r�r)r�rr�_tab_newline_replace�s
	zHtmlDiff._tab_newline_replacecCs|s|j||f�dSt|�}|j}||ksB||jd�d|krT|j||f�dSd}d}d}xd||kr�||kr�||dkr�|d7}||}|d7}qb||dkr�|d7}d}qb|d7}|d7}qbW|d|�}	||d�}
|r�|	d}	d||
}
|j||	f�|j|d|
�dS)	a�Builds list of text lines by splitting text lines at wrap point

        This function will determine if the input text line needs to be
        wrapped (split) into separate lines.  If so, the first wrap point
        will be determined and the first line appended to the output
        text line list.  This function is used recursively to handle
        the second part of the split line to further split it.
        Nr�rTr
rr%r��>)r)r.r��count�_split_line)rZ	data_listZline_numr�rQrVr0r3ZmarkZline1Zline2rrrr�s8

zHtmlDiff._split_lineccs�x�|D]�\}}}|dkr&|||fVq||\}}\}}gg}	}
|j|	||�|j|
||�x@|	sh|
r�|	rx|	jd�}nd}|
r�|
jd�}nd}|||fVq`WqWdS)z5Returns iterator that splits (wraps) mdiff text linesNr
rrr)rrr)rrr)r�r>)r�diffs�fromdata�todata�flagZfromlineZfromtextZtolineZtotext�fromlist�tolistrrr�
_line_wrapper;s 

zHtmlDiff._line_wrappercCs�ggg}}}xz|D]r\}}}y4|j|jd|f|���|j|jd|f|���Wn(tk
r||jd�|jd�YnX|j|�qW|||fS)z�Collects mdiff output into separate lists

        Before storing the mdiff from/to data into a list, it is converted
        into a single line of text with HTML markup.
        r
r%N)r)�_format_liner�)rr�r�r��flaglistr�r�r�rrr�_collect_linesWs
zHtmlDiff._collect_linescCsryd|}d|j||f}Wntk
r6d}YnX|jdd�jdd�jdd	�}|jd
d�j�}d|||fS)
aReturns HTML markup of "from" / "to" text lines

        side -- 0 or 1 indicating "from" or "to" text
        flag -- indicates if difference on line
        linenum -- line number (used for line number column)
        text -- line text to be marked up
        z%dz
 id="%s%s"r�&z&amp;r�z&gt;�<z&lt;rrz&nbsp;z<<td class="diff_header"%s>%s</td><td nowrap="nowrap">%s</td>)�_prefixr�rKr�)rr�r�Zlinenumr��idrrrr�ls
zHtmlDiff._format_linecCs0dtj}dtj}tjd7_||g|_dS)zCreate unique anchor prefixeszfrom%d_zto%d_r%N)r�_default_prefixr�)rZ
fromprefix�toprefixrrr�_make_prefix�s

zHtmlDiff._make_prefixcCs�|jd}dgt|�}dgt|�}d\}	}
d}xbt|�D]V\}}
|
r�|
s�d}
|}td||g�}d||	f||<|	d7}	d||	f||<q<d}
q<W|s�dg}dg}dg}d}|r�dg}|}n
d	g}}|ds�d
||d<d|||<|||||fS)
zMakes list of "next" linksr%rr
FTz id="difflib_chg_%s_%d"z"<a href="#difflib_chg_%s_%d">n</a>z2<td></td><td>&nbsp;No Differences Found&nbsp;</td>z(<td></td><td>&nbsp;Empty File&nbsp;</td>z!<a href="#difflib_chg_%s_0">f</a>z#<a href="#difflib_chg_%s_top">t</a>)r
F)r�r.r'rV)rr�r�r�r�r�r��next_id�	next_hrefZnum_chgZ	in_changer�r0r�rrr�_convert_flags�s:

zHtmlDiff._convert_flagsc	CsV|j�|j||�\}}|r"|}nd}t||||j|jd�}|jrL|j|�}|j|�\}	}
}|j|	|
|||�\}	}
}}}
g}d}x`t	t
|��D]P}||dkr�|dkr�|jd�q�|j||
||||	||||
|f�q�W|s�|�rddd	|dd	|f}nd
}|jt
d
j|�||jdd�}|jd
d�jdd�jdd�jdd�jdd�S)a�Returns HTML table of side by side comparison with change highlights

        Arguments:
        fromlines -- list of "from" lines
        tolines -- list of "to" lines
        fromdesc -- "from" file column header string
        todesc -- "to" file column header string
        context -- set to True for contextual differences (defaults to False
            which shows full differences).
        numlines -- number of context lines.  When context is set True,
            controls number of lines displayed before and after the change.
            When context is False, controls the number of lines to place
            the "next" link anchors before the next change (so click of
            "next" link jumps to just before the change).
        N)rnroz1            <tr><td class="diff_next"%s>%s</td>%sz%<td class="diff_next">%s</td>%s</tr>
r
z)        </tbody>        
        <tbody>
z <thead><tr>%s%s%s%s</tr></thead>z!<th class="diff_next"><br /></th>z+<th colspan="2" class="diff_header">%s</th>rr%)Z	data_rows�
header_rowr�z+z<span class="diff_add">z-z<span class="diff_sub">z^z<span class="diff_chg">r�z</span>r�z&nbsp;zV            <tr><td class="diff_next"%s>%s</td>%s<td class="diff_next">%s</td>%s</tr>
)rr�r�r�r�r�r�r�rr5r.r)�_table_templater�r�r�rK)rr�r�r�r�r�r�Z
context_linesr�r�r�r�rrrjZfmtr0rr�rrrr��sJ


zHtmlDiff.make_table)rrFr�)rrFr�)r`rarbrcr�r�rr�r�rrr�r�r�r�r�r�rrr�rrrrr�s&7/ccspyddd�t|�}Wn tk
r6td|��YnXd|f}x*|D]"}|dd�|krF|dd�VqFWdS)a0
    Generate one of the two sequences that generated a delta.

    Given a `delta` produced by `Differ.compare()` or `ndiff()`, extract
    lines originating from file 1 or 2 (parameter `which`), stripping off line
    prefixes.

    Examples:

    >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
    ...              'ore\ntree\nemu\n'.splitlines(keepends=True))
    >>> diff = list(diff)
    >>> print(''.join(restore(diff, 1)), end="")
    one
    two
    three
    >>> print(''.join(restore(diff, 2)), end="")
    ore
    tree
    emu
    z- z+ )r%r�z)unknown delta choice (must be 1 or 2): %rz  Nr�)�int�KeyErrorrf)ZdeltaZwhichrR�prefixesrkrrrrs
cCsddl}ddl}|j|�S)Nr
)�doctest�difflibZtestmod)r	r
rrr�_test,sr�__main__)rTrd)r�)rrrrrTr�)rrrrrTr�)r�r�r�r�rTr�)$rc�__all__�heapqrrg�collectionsrZ_namedtuplerrrrrmrr�r��matchrrr�r	r�rr�r
rr�r�r�rr��objectrrrr`rrrr�<module>s^


0O

H
K
%!	
a 
uu.cpython-36.pyc000064400000006654150335715140007642 0ustar003


 \k�@sddZddlZddlZddlZdddgZGdd�de�Zd
dd�Zdd	d�Zd
d�Z	e
dkr`e	�dS)z�Implementation of the UUencode and UUdecode functions.

encode(in_file, out_file [,name, mode])
decode(in_file [, out_file, mode])
�N�Error�encode�decodec@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/uu.pyr'scCsBg}�z|dkrtjj}n`t|t�rz|dkr8tjj|�}|dkrfytj|�j	}Wnt
k
rdYnXt|d�}|j|�|dkr�tj
j}nt|t�r�t|d�}|j|�|dkr�d}|dkr�d}|jd|d@|fjd��|jd	�}x,t|�d
k�r|jtj|��|jd	�}q�W|jd�Wdx|D]}|j��q*WXdS)z
Uuencode file�-N�rb�wbi�zbegin %o %s
i��ascii�-rs 
end
)�sys�stdin�buffer�
isinstance�str�os�path�basename�stat�st_mode�AttributeError�open�append�stdout�writer�read�len�binasciiZb2a_uu�close)�in_file�out_file�name�mode�opened_files�data�frrr	r*s>









Fc
Cs:g}|dkrtjj}nt|t�r4t|d�}|j|��z�xr|j�}|sNtd��|j	d�sZq:|j
dd�}t|�dkr:|ddkr:yt|d	d
�PWq:t
k
r�Yq:Xq:W|dkr�|djd�jd
�}tjj|�r�td|��|dkr�t|d	d
�}|dk�r
tjj}nNt|t��rXt|d�}ytjj||�Wntk
�rHYnX|}|j|�|j�}x�|�r|jd�dk�rytj|�}	Wnjtjk
�r�}
zJ|ddd@ddd}tj|d|��}	|�s�tjjd|
�WYdd}
~
XnX|j|	�|j�}�qbW|�std��Wdx|D]}|j��q"WXdS)zDecode uuencoded filer
rz'No valid begin line found in input filesbegin� ��r��Ns 	
r
z"Cannot overwrite existing file: %srsend� �?��zWarning: %s
zTruncated input file)rrrrrrr�readliner�
startswith�splitr�int�
ValueError�rstriprrr�existsr�chmodr�stripr Za2b_uu�stderrrr!)
r"r#r%�quietr&ZhdrZ	hdrfields�fp�sr'�v�nbytesr(rrr	rZsf









"

cCs4ddl}|jdd�}|jddddd	d
d�|jdd
ddd	d
d�|j�\}}t|�dkrl|jd�tjd�tjj	}tj
j	}t|�dkr�|d}t|�dkr�|d}|jr�|jr�t
|t�r�t|d�}nttjdd�tjd�t||�nD|j�r&t
|t��rt|d�}nttjdd�tjd�t||�dS)zuuencode/uudecode main programrNz'usage: %prog [-d] [-t] [input [output]])Zusagez-dz--decoderzDecode (instead of encode)?F�
store_true)�dest�help�default�actionz-tz--text�textz2data is text, encoded format unix-compatible text?r*zincorrect number of argumentsr,rz: cannot do -t to stdoutrz: cannot do -t from stdin)�optparseZOptionParserZ
add_option�
parse_argsr�errorr�exitrrrrrFrrr�print�argvr)rG�parserZoptions�args�input�outputrrr	�test�s6




rQ�__main__)NN)NNF)�__doc__r rr�__all__�	ExceptionrrrrQrrrrr	�<module>s

0
F&pstats.cpython-36.opt-2.pyc000064400000045715150335715140011470 0ustar003


 \�g�@sbddlZddlZddlZddlZddlZddlmZdgZGdd�d�ZGdd�d�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dd�Zdd�Zdd�Zedk�r^ddlZyddlZWnek
r�YnXGdd�dej�Zeej�dkr�ejdZndZyTee�Zx"ejdd�D]Zeje��qWedejd�ej�edejd�Wne k
�r\YnXdS)�N)�
cmp_to_key�Statsc@s�eZdZdd�dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�ZdAdEdIdMdPdSdVdYd\dadedhdldpd �Z	d!d"�Z
d#d$�Zd%d&�Zd'd(�Z
d)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zdqd8d9�Zd:d;�Zd<d=�ZdS)rrN)�streamcGsF|ptj|_t|�sd}n|d}|dd�}|j|�|j|�dS)Nr�)�sys�stdoutr�len�init�add)�selfr�args�arg�r�/usr/lib64/python3.6/pstats.py�__init__As
zStats.__init__cCs�d|_g|_d|_d|_d|_d|_d|_t�|_i|_	i|_
|j|�y|j�Wn8t
k
r�td|jrx|jdnd|jd��YnXdS)NrzInvalid timing data %sr�)�file���)�all_callees�files�fcn_list�total_tt�total_calls�
prim_calls�max_name_len�set�	top_level�stats�
sort_arg_dict�
load_stats�get_top_level_stats�	Exception�printr)rr
rrrr	Ks"
z
Stats.initcCs�|dkri|_dSt|t�rxt|d��}tj|�|_WdQRXy"tj|�}tj	|j
�d|}WnYnX|g|_n t|d�r�|j
�|j|_i|_|js�td|j|f��dS)N�rbz    �create_statsz.Cannot create or construct a %r object from %r)r�
isinstance�str�open�marshal�load�os�stat�timeZctime�st_mtimer�hasattrr$�	TypeError�	__class__)rr
�fZ
file_statsrrrr^s(



zStats.load_statscCs�x~|jj�D]p\}\}}}}}|j|7_|j|7_|j|7_d|kr\|jj|�tt|��|j	krtt|��|_	qWdS)N�jprofiler�profiler)r2rr3)
r�itemsrrrrr
r�func_std_stringr)r�func�cc�nc�tt�ct�callersrrrr tszStats.get_top_level_statscGs�|s|Sx�t|�D]�}t|�t|�kr.t|�}|j|j7_|j|j7_|j|j7_|j|j7_x|jD]}|jj|�qvW|j	|j	kr�|j	|_	d|_
xJ|jj�D]<\}}||jkr�|j|}nddddif}t
||�|j|<q�WqW|S)Nr)�reversed�typerrrrrrr
rrrr4�add_func_stats)r�arg_list�itemr6r+Z
old_func_statrrrr
~s(
z	Stats.addc
Cs(t|d��}tj|j|�WdQRXdS)N�wb)r'r(�dumpr)r�filenamer1rrr�
dump_stats�szStats.dump_statsr�
call count��cumulative time��	file name��line number��
function name�name/file/liner�primitive call count��
standard name��
internal time)�callsZncallsZcumtime�
cumulativerrC�line�module�nameZnflZpcalls�stdnamer,ZtottimecCs�|jszi|_}i}xP|jj�D]B\}}|}x4|r`|s8P||krJd||<P|||<|dd�}q.Wq Wx|D]
}||=qlW|jS)Nrrr)r�sort_arg_dict_defaultr4)r�dictZbad_list�word�tupZfragmentrrr�get_sort_arg_defs�s 


zStats.get_sort_arg_defscGs"|sd|_|St|�dkrFt|dt�rFddddddddi|dg}|j�}f}d|_d}x:|D]2}|||d}|j|||d7_d	}qbWg}xB|jj�D]4\}\}}	}
}}|j||	|
|f|t	|�|f�q�W|j
tt|�j
�d
�g|_}
x|D]}|
j|d��qW|S)
NrrrYrTr,rRrUrz, )�keyrr)rrr%�intr^�	sort_typerr4�appendr5�sortr�	TupleComp�compare)rZfieldZ
sort_arg_defsZ
sort_tupleZ	connectorr\Z
stats_listr6r7r8r9r:r;r�tuplerrr�
sort_stats�s2


zStats.sort_statscCs|jr|jj�|S)N)r�reverse)rrrr�
reverse_order�s
zStats.reverse_ordercCs�|j}i|_}d}x�|j�D]�\}\}}}}}	t|�}
tt|
��|krTtt|
��}i}x |	j�D]\}}
|
|t|�<qbW|
|kr�t||
|||||f�||
<q|||||f||
<qW|j}t�|_}x|D]}|jt|��q�W||_	d|_
d|_|S)Nr)rr4�func_strip_pathrr5r>rrr
rrr)rZoldstatsZnewstatsrr6r7r8r9r:r;ZnewfuncZ
newcallers�func2�callerZold_topZnew_toprrr�
strip_dirs�s.

zStats.strip_dirsc
Cs||jr
dSi|_}xb|jj�D]T\}\}}}}}||krBi||<x0|j�D]$\}}	||krdi||<|	|||<qLWq WdS)N)rrr4)
rrr6r7r8r9r:r;rkrlrrr�calc_calleess
zStats.calc_calleesc
Cs|}t|t�rpytj|�}Wn&tjk
rB|d|7}||fSXg}x�|D]}|jt|��rN|j|�qNWnzt|�}t|t	�r�d|ko�dknr�t
||d�}|d|�}n2t|t
�r�d|ko�|knr�|}|d|�}t|�t|�k�r|dt|�t|�|f7}||fS)Nz#   <Invalid regular expression %r>
gg�?g�?rz6   List reduced from %r to %r due to restriction <%r>
)r%r&�re�compile�error�searchr5rbr�floatr`)rZsel�list�msgZnew_listZrexr6�countrrr�eval_print_amounts,


""zStats.eval_print_amountcCs�|j}|jr*|jdd�}d|jd}nt|jj��}d}x|D]}|j|||�\}}qBWt|�}|spd|fSt||j	d�|t|j�kr�d}x(|D] }tt
|��|kr�tt
|��}q�W|d|fS)Nz   Ordered by: �
z!   Random listing order was used
r)rrR)rrrartr�keysrwrr"rr5)rZsel_list�widthZ	stat_listruZ	selectionrvr6rrr�get_print_list2s$

zStats.get_print_listcGs�x|jD]}t||jd�qW|jr0t|jd�d}x"|jD]}t|t|�|jd�q<Wt||jdd|jd�|j|jkr�td|jd|jd�td|j|jd�t|jd�|j|�\}}|r�|j	�x|D]}|j
|�q�Wt|jd�t|jd�|S)	N)r� �zfunction calls)�endrz(%d primitive calls)zin %.3f secondsz        )rr"rr�func_get_function_namerrrr{�print_title�
print_line)r�amountrC�indentr6rzrtrrr�print_statsJs(
zStats.print_statscGs~|j|�\}}|rz|j�|j|d�x:|D]2}||jkrP|j|||j|�q,|j||i�q,Wt|jd�t|jd�|S)Nz	called...)r)r{rn�print_call_headingr�print_call_liner"r)rr�rzrtr6rrr�
print_calleesas

zStats.print_calleesc
Gsl|j|�\}}|rh|j|d�x0|D](}|j|\}}}}}	|j|||	d�q$Wt|jd�t|jd�|S)Nzwas called by...z<-)r)r{r�rr�r"r)
rr�rzrtr6r7r8r9r:r;rrr�
print_callersps
zStats.print_callersc
Csxtdj|�||jd�d}x<|jj�D].\}}}}}|r(tt|j���}	t|	t�}Pq(W|rttd|d|jd�dS)Nz	Function )rFr|z    ncalls  tottime  cumtime)	r"�ljustrr�values�next�iterr%rf)
r�	name_sizeZcolumn_titleZ	subheaderr7r8r9r:r;�valuerrrr�{s
zStats.print_call_heading�->cCstt|�j|�|d|jd�|s2t|jd�dSt|j��}d}x�|D]�}t|�}||}	t|	t�r�|	\}
}}}
|
|kr�d|
|f}n
d|
f}d|jdd	t	|��t
|�t
|
�|f}|d
}n$d||	t
|j|d�f}|d}t||||jd�d}qHWdS)
Nr|)r~r)rrz%d/%dz%dz%s %s %s  %srPrRrz	%s(%r) %srF)r"r5r�r�sortedryr%rf�rjustr�f8r)rr��sourceZ	call_dictZarrowZclistr�r6rXr�r8r7r9r:ZsubstatsZ
left_widthrrrr��s*



zStats.print_call_linecCs"tdd|jd�td|jd�dS)Nz-   ncalls  tottime  percall  cumtime  percallr|)r~rzfilename:lineno(function))r)r"r)rrrrr��szStats.print_titlecCs�|j|\}}}}}t|�}||kr4|dt|�}t|jd�d|jd�tt|�d|jd�|dkrxtdd|jd�ntt||�d|jd�tt|�d|jd�|dkr�td	d|jd�ntt||�d|jd�tt|�|jd�dS)
N�/�	r|)r~rrr})rz        z        )rr&r"r�rr�r5)rr6r7r8r9r:r;�crrrr��szStats.print_liner�rr�r�)r�rEr�rr�r�)r�rEr�rFr�r�)r�rGr�rFr�r�)r�rG�rHr�r�)r�rI�rHr�r�)r�rI�rJr�r�)r�rK�rHr�r�)r�rI�rLr�r�)r�rM�rLr�rHr�rJr�r�r�r�)r�rNr�rr�r�)r�rO�rPr�r�)r�rQr�rRr�r�)r�rSr�rRr�r�)r�rS)r�)�__name__�
__module__�__qualname__rr	rr r
rDrZr^rgrirmrnrwr{r�r�r�r�r�r�r�rrrrr sD!

 
c@seZdZdd�Zdd�ZdS)rdcCs
||_dS)N)�comp_select_list)rr�rrrr�szTupleComp.__init__cCsBx<|jD]2\}}||}||}||kr.|S||kr|SqWdS)Nr)r�)r�left�right�index�	direction�l�rrrrre�szTupleComp.compareN)r�r�r�rrerrrrrd�srdcCs|\}}}tjj|�||fS)N)r*�path�basename)�	func_namerCrVrXrrrrj�s
rjcCs|dS)NrRr)r6rrrr�srcCsN|dd�d	krB|d}|jd�r<|jd�r<d|dd
�S|Snd|SdS)NrR�~r�<�>z{%s}rz	%s:%d(%s))r�rr)�
startswith�endswith)r�rXrrrr5�sr5cCs@|\}}}}}|\}}}	}
}||||||	||
t||�fS)N)�add_callers)�targetr�r7r8r9r:r;Zt_ccZt_ncZt_ttZt_ctZ	t_callersrrrr>�sr>cCs�i}x|j�D]\}}|||<qWxb|j�D]V\}}||krzt|t�rhtdd�t|||�D��||<q�|||7<q,|||<q,W|S)NcSsg|]}|d|d�qS)rrr)�.0�irrr�
<listcomp>�szadd_callers.<locals>.<listcomp>)r4r%rf�zip)r�r�Znew_callersr6rlrrrr��s
r�cCs"d}x|j�D]}||7}qW|S)Nr)r�)r;r8rTrrr�count_callssr�cCsd|S)Nz%8.3fr)�xrrrr�sr��__main__c@s�eZdZd6dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)7�ProfileBrowserNcCs6tjj|�d|_d|_tj|_|dk	r2|j|�dS)Nz% )	�cmd�Cmdr�promptrrrr�do_read)r�profilerrrrszProfileBrowser.__init__cCs�|j�}g}x�|D]�}y|jt|��wWntk
r>YnXy8t|�}|dksZ|dkrjtd|jd�w|j|�wWntk
r�YnX|j|�qW|jr�t|j|�|�ntd|jd�dS)Nrrz#Fraction argument must be in [0, 1])rzNo statistics object is loaded.)	�splitrbr`�
ValueErrorrsr"rr�getattr)r�fnrVrZ	processedZtermZfracrrr�generic"s,

zProfileBrowser.genericcCsXtd|jd�td|jd�td|jd�td|jd�td|jd�td|jd�dS)NzArguments may be:)rz0* An integer maximum number of entries to print.z:* A decimal fractional number between 0 and 1, controllingz-  what fraction of selected entries to print.z8* A regular expression; only entries with function namesz  that match it are printed.)r"r)rrrr�generic_help:szProfileBrowser.generic_helpcCsd|jrRy|jj|�Wq`tk
rN}ztd||f|jd�WYdd}~Xq`Xntd|jd�dS)Nz$Failed to load statistics for %s: %s)rzNo statistics object is loaded.r)rr
�IOErrorr"r)rrV�errr�do_addBs*zProfileBrowser.do_addcCstd|jd�dS)Nz>Add profile info from given file to current statistics object.)r)r"r)rrrr�help_addKszProfileBrowser.help_addcCs|jd|�S)Nr�)r�)rrVrrr�
do_calleesNszProfileBrowser.do_calleescCstd|jd�|j�dS)Nz6Print callees statistics from the current stat object.)r)r"rr�)rrrr�help_calleesPszProfileBrowser.help_calleescCs|jd|�S)Nr�)r�)rrVrrr�
do_callersTszProfileBrowser.do_callerscCstd|jd�|j�dS)Nz6Print callers statistics from the current stat object.)r)r"rr�)rrrr�help_callersVszProfileBrowser.help_callerscCstd|jd�dS)Nr)rr)r"r)rrVrrr�do_EOFZszProfileBrowser.do_EOFcCstd|jd�dS)NzLeave the profile brower.)r)r"r)rrrr�help_EOF]szProfileBrowser.help_EOFcCsdS)Nrr)rrVrrr�do_quit`szProfileBrowser.do_quitcCstd|jd�dS)NzLeave the profile brower.)r)r"r)rrrr�	help_quitbszProfileBrowser.help_quitcCs�|r�yt|�|_Wnjtk
rF}zt|jd|jd�dSd}~Xn8tk
r|}zt|jjd||jd�dSd}~XnX|d|_	n6t
|j	�dkr�|j	dd�}|j|�ntd|jd�dS)	Nr)r�:z% rRz1No statistics object is current -- cannot reload.r���)rr�OSErrorr"rrr!r0r�r�rr�)rrV�errrrrr�eszProfileBrowser.do_readcCs td|jd�td|jd�dS)Nz+Read in profile data from a specified file.)rz*Without argument, reload the current file.)r"r)rrrr�	help_readvszProfileBrowser.help_readcCs$|jr|jj�ntd|jd�dS)NzNo statistics object is loaded.)rr)rrir"r)rrVrrr�
do_reversezszProfileBrowser.do_reversecCstd|jd�dS)Nz/Reverse the sort order of the profiling report.)r)r"r)rrrr�help_reverse�szProfileBrowser.help_reversecs�|jstd|jd�dS|jj��|rRt�fdd�|j�D��rR|jj|j��n@td|jd�x0tjj	�D]"\}}td||df|jd�qlWdS)	NzNo statistics object is loaded.)rc3s|]}|�kVqdS)Nr)r�r�)�abbrevsrr�	<genexpr>�sz)ProfileBrowser.do_sort.<locals>.<genexpr>z/Valid sort keys (unique prefixes are accepted):z%s -- %srr)
rr"rr^�allr�rgrrZr4)rrVr_r�r)r�r�do_sort�s
zProfileBrowser.do_sortcCs td|jd�td|jd�dS)Nz.Sort profile data according to specified keys.)rz3(Typing `sort' without arguments lists valid keys.))r"r)rrrr�	help_sort�szProfileBrowser.help_sortcs�fdd�tjD�S)Ncsg|]}|j��r|�qSr)r�)r��a)�textrrr��sz0ProfileBrowser.complete_sort.<locals>.<listcomp>)rrZ)rr�rr)r�r�
complete_sort�szProfileBrowser.complete_sortcCs|jd|�S)Nr�)r�)rrVrrr�do_stats�szProfileBrowser.do_statscCstd|jd�|j�dS)Nz.Print statistics from the current stat object.)r)r"rr�)rrrr�
help_stats�szProfileBrowser.help_statscCs$|jr|jj�ntd|jd�dS)NzNo statistics object is loaded.)r)rrmr"r)rrVrrr�do_strip�szProfileBrowser.do_stripcCstd|jd�dS)Nz<Strip leading path information from filenames in the report.)r)r"r)rrrr�
help_strip�szProfileBrowser.help_stripcCstd|jd�dS)NzShow help for a given command.)r)r"r)rrrr�	help_help�szProfileBrowser.help_helpcCs|r|SdS)Nr)r�stoprVrrr�postcmd�szProfileBrowser.postcmd)N)r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�s4
	r�rrRz*Welcome to the profile statistics browser.)rzGoodbye.)!rr*r,r(ro�	functoolsr�__all__rrdrjrr5r>r�r�r�r�r��readline�ImportErrorr�r�r�argvZinitprofileZbrowserr�r�r"rZcmdloop�KeyboardInterruptrrrr�<module>sL
asynchat.cpython-36.opt-2.pyc000064400000012501150335715140011747 0ustar003


 \@,�@s@ddlZddlmZGdd�dej�ZGdd�d�Zdd�ZdS)	�N)�dequec@s�eZdZdZdZdZdZd'dd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZdS)(�
async_chatirzlatin-1NcCs(d|_g|_t�|_tjj|||�dS)N�)�ac_in_buffer�incomingr�
producer_fifo�asyncore�
dispatcher�__init__)�selfZsock�map�r
� /usr/lib64/python3.6/asynchat.pyr
Cszasync_chat.__init__cCstd��dS)Nzmust be implemented in subclass)�NotImplementedError)r�datar
r
r�collect_incoming_dataQsz async_chat.collect_incoming_datacCs|jj|�dS)N)r�append)rrr
r
r�_collect_incoming_dataTsz!async_chat._collect_incoming_datacCsdj|j�}|jdd�=|S)Nr)�joinr)r�dr
r
r�	_get_dataWszasync_chat._get_datacCstd��dS)Nzmust be implemented in subclass)r)rr
r
r�found_terminator\szasync_chat.found_terminatorcCsBt|t�r|jrt||j�}nt|t�r8|dkr8td��||_dS)Nrz-the number of received bytes must be positive)�
isinstance�str�use_encoding�bytes�encoding�int�
ValueError�
terminator)rZtermr
r
r�set_terminator_s
zasync_chat.set_terminatorcCs|jS)N)r)rr
r
r�get_terminatorjszasync_chat.get_terminatorcCs�y|j|j�}Wn:tk
r$dStk
rJ}z|j�dSd}~XnXt|t�rh|jrhtt|j	�}|j
||_
�xV|j
�r�t|j
�}|j�}|s�|j
|j
�d|_
qxt|t��r|}||kr�|j
|j
�d|_
|j||_n2|j
|j
d|��|j
|d�|_
d|_|j�qxt|�}|j
j|�}|dk�rp|dk�rR|j
|j
d|��|j
||d�|_
|j�qxt|j
|�}|�r�||k�r�|j
|j
d|��|j
|d�|_
Pqx|j
|j
�d|_
qxWdS)Nrr����)Zrecv�ac_in_buffer_size�BlockingIOError�OSError�handle_errorrrrrrr�lenr!rrrr�find�find_prefix_at_end)rrZwhyZlbr�nZterminator_len�indexr
r
r�handle_readrsR

	



zasync_chat.handle_readcCs|j�dS)N)�
initiate_send)rr
r
r�handle_write�szasync_chat.handle_writecCs|j�dS)N)�close)rr
r
r�handle_close�szasync_chat.handle_closecCs|t|tttf�stdt|���|j}t|�|krdx>tdt|�|�D]}|j	j
||||��qBWn|j	j
|�|j�dS)Nz#data argument must be byte-ish (%r)r)rr�	bytearray�
memoryview�	TypeError�type�ac_out_buffer_sizer(�rangerrr.)rrZsabs�ir
r
r�push�s
zasync_chat.pushcCs|jj|�|j�dS)N)rrr.)rZproducerr
r
r�push_with_producer�szasync_chat.push_with_producercCsdS)Nr"r
)rr
r
r�readable�szasync_chat.readablecCs|jp|jS)N)r�	connected)rr
r
r�writable�szasync_chat.writablecCs|jjd�dS)N)rr)rr
r
r�close_when_done�szasync_chat.close_when_donecCs�x|jo|j�r|jd}|s<|jd=|dkr<|j�dS|j}y|d|�}Wn8tk
r�|j�}|r||jj|�n|jd=wYnXt|t�r�|j	r�t
||j�}y|j|�}Wnt
k
r�|j�dSX|�r|t|�ks�|t|�k�r||d�|jd<n|jd=dSWdS)Nr)rr<r1r6r4�more�
appendleftrrrrr�sendr&r'r()r�firstZobsrZnum_sentr
r
rr.�s8
zasync_chat.initiate_sendcCs d|_|jdd�=|jj�dS)Nr)rrr�clear)rr
r
r�discard_buffersszasync_chat.discard_buffers)NN)�__name__�
__module__�__qualname__r$r6rrr
rrrrr r!r-r/r1r9r:r;r=r>r.rDr
r
r
rr4s*
H(rc@seZdZddd�Zdd�ZdS)�simple_producer�cCs||_||_dS)N)r�buffer_size)rrrJr
r
rr
szsimple_producer.__init__cCsJt|j�|jkr6|jd|j�}|j|jd�|_|S|j}d|_|SdS)Nr)r(rrJ)r�resultr
r
rr?szsimple_producer.moreN)rI)rErFrGr
r?r
r
r
rrHs
rHcCs6t|�d}x$|r0|j|d|��r0|d8}qW|S)Nr")r(�endswith)ZhaystackZneedle�lr
r
rr*/sr*)r�collectionsrr	rrHr*r
r
r
r�<module>0s
\ formatter.cpython-36.pyc000064400000042255150335715140011211 0ustar003


 \';�@s�dZddlZddlZejdedd�dZGdd�d�ZGdd	�d	�ZGd
d�d�ZGdd
�d
e�Z	Gdd�de�Z
ddd�Zedkr�e�dS)aGeneric output formatting.

Formatter objects transform an abstract flow of formatting events into
specific output events on writer objects. Formatters manage several stack
structures to allow various properties of a writer object to be changed and
restored; writers need not be able to handle relative changes nor any sort
of ``change back'' operation. Specific writer properties which may be
controlled via formatter objects are horizontal alignment, font, and left
margin indentations. A mechanism is provided which supports providing
arbitrary, non-exclusive style settings to a writer as well. Additional
interfaces facilitate formatting events which are not reversible, such as
paragraph separation.

Writer objects encapsulate device interfaces. Abstract devices, such as
file formats, are supported as well as physical devices. The provided
implementations all work with abstract devices. The interface makes
available mechanisms for setting the properties which formatter objects
manage and inserting data into the output.
�Nz"the formatter module is deprecated�)�
stacklevelc@s�eZdZdZd(dd�Zdd�Zdd�Zd	d
�Zd)dd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd*d$d%�Zd+d&d'�ZdS),�
NullFormattera=A formatter which does nothing.

    If the writer parameter is omitted, a NullWriter instance is created.
    No methods of the writer are called by NullFormatter instances.

    Implementations should inherit from this class if implementing a writer
    interface but don't need to inherit any implementation.

    NcCs|dkrt�}||_dS)N)�
NullWriter�writer)�selfr�r�!/usr/lib64/python3.6/formatter.py�__init__)szNullFormatter.__init__cCsdS)Nr)r�	blanklinerrr	�
end_paragraph-szNullFormatter.end_paragraphcCsdS)Nr)rrrr	�add_line_break.szNullFormatter.add_line_breakcOsdS)Nr)r�args�kwrrr	�add_hor_rule/szNullFormatter.add_hor_rulecCsdS)Nr)r�format�counterrrrr	�add_label_data0szNullFormatter.add_label_datacCsdS)Nr)r�datarrr	�add_flowing_data1szNullFormatter.add_flowing_datacCsdS)Nr)rrrrr	�add_literal_data2szNullFormatter.add_literal_datacCsdS)Nr)rrrr	�flush_softspace3szNullFormatter.flush_softspacecCsdS)Nr)r�alignrrr	�push_alignment4szNullFormatter.push_alignmentcCsdS)Nr)rrrr	�
pop_alignment5szNullFormatter.pop_alignmentcCsdS)Nr)r�xrrr	�	push_font6szNullFormatter.push_fontcCsdS)Nr)rrrr	�pop_font7szNullFormatter.pop_fontcCsdS)Nr)r�marginrrr	�push_margin8szNullFormatter.push_margincCsdS)Nr)rrrr	�
pop_margin9szNullFormatter.pop_margincCsdS)Nr)r�spacingrrr	�set_spacing:szNullFormatter.set_spacingcGsdS)Nr)r�stylesrrr	�
push_style;szNullFormatter.push_style�cCsdS)Nr)r�nrrr	�	pop_style<szNullFormatter.pop_stylecCsdS)Nr)r�flagrrr	�assert_line_data=szNullFormatter.assert_line_data)N)N)r%)r%)�__name__�
__module__�__qualname__�__doc__r
rr
rrrrrrrrrrr r"r$r'r)rrrr	rs&	


rc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd.dd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd/d*d+�Zd0d,d-�Zd
S)1�AbstractFormatterz�The standard formatter.

    This implementation has demonstrated wide applicability to many writers,
    and may be used directly in most circumstances.  It has been used to
    implement a full-featured World Wide Web browser.

    cCsR||_d|_g|_g|_g|_d|_g|_d|_d|_d|_	d|_
d|_d|_dS)Nr%r)
rr�align_stack�
font_stack�margin_stackr!�style_stack�nospace�	softspace�para_end�parskip�
hard_break�
have_label)rrrrr	r
NszAbstractFormatter.__init__cCsb|js|jj�d|_|j|krF|jrF|jj||j�||_d|_d|_|_|_d|_dS)Nrr%)	r7r�send_line_breakr8r6�send_paragraphr3r5r4)rrrrr	r]s
zAbstractFormatter.end_paragraphcCs8|jp
|js"|jj�d|_|_d|_|_d|_dS)Nrr%)r7r5rr9r8r6r3r4)rrrr	r
hs

z AbstractFormatter.add_line_breakcOsF|js|jj�|jj||�d|_|_d|_|_|_|_dS)Nr%r)	r7rr9�
send_hor_ruler3r8r5r4r6)rrrrrr	ros

zAbstractFormatter.add_hor_ruleNcCs�|js|jr|jj�|js2|jj|r,dp.d�t|t�rR|jj|j	||��n|jj|�d|_
|_|_|_d|_|_dS)Nr%r)
r8r7rr9r5r:�
isinstance�str�send_label_data�format_counterr3r4r6)rrrrrrr	rvs

z AbstractFormatter.add_label_datacCsxd}xn|D]f}|dkr$|d|}q
|dkrF|dkrp||j||�}q
|dkrh|dkrp||j||�}q
||}q
W|S)N��1z%dZaArZiI)�
format_letter�format_roman)rrr�label�crrr	r?�s
z AbstractFormatter.format_countercCs@d}x6|dkr:t|dd�\}}tt|�|�}||}qW|S)Nr@rr%�)�divmod�chr�ord)r�caserrDr�srrr	rB�s
zAbstractFormatter.format_letterc	Cs�ddddg}dddg}d\}}x�|d	kr�t|d
�\}}|dkrX||||d|}nT|d
krv|||||}n6|dkr�||}|d}nd}||||}||}|d}q W|dkr�|j�S|S)N�irrE�m�v�l�dr@r�
�	r%���I)r@r)rG�upper)	rrJrZonesZfivesrD�indexrrKrrr	rC�s&


zAbstractFormatter.format_romancCs�|sdS|dd�j�}|dd�j�}dj|j��}|jrF|rFdS|sP|jrx|sj|jsfd|_d|_dS|jsxd|}d|_|_|_|_|_||_|j	j
|�dS)Nr%� r���)�isspace�join�splitr3r4r6r7r5r8r�send_flowing_data)rrZprespaceZ	postspacerrr	r�s$
z"AbstractFormatter.add_flowing_datacCsZ|sdS|jr|jjd�|dd�dk|_d|_|_|_|_|_|jj|�dS)NrXr%�
rrY)	r4rr]r7r3r5r6r8�send_literal_data)rrrrr	r�sz"AbstractFormatter.add_literal_datacCs:|jr6d|_|_|_|_|_d|_|jjd�dS)Nrr%rX)r4r7r5r6r8r3rr])rrrr	r�sz!AbstractFormatter.flush_softspacecCs@|r.||jkr.|jj|�||_|jj|�n|jj|j�dS)N)rr�
new_alignmentr/�append)rrrrr	r�s
z AbstractFormatter.push_alignmentcCsH|jr|jd=|jr2|jd|_}|jj|�nd|_|jjd�dS)Nr%rYrY)r/rrr`)rrrrr	r�szAbstractFormatter.pop_alignmentc
Cs�|\}}}}|jr6d|_|_|_d|_|jjd�|jr~|jd\}}}}	|tkrZ|}|tkrf|}|tkrr|}|tkr~|	}||||f}|jj|�|jj	|�dS)Nrr%rXrY)
r4r7r5r3rr]r0�AS_ISra�new_font)
r�font�sizerL�bZttZcsizeZci�cbZcttrrr	r�s$zAbstractFormatter.push_fontcCs4|jr|jd=|jr |jd}nd}|jj|�dS)Nr%rYrY)r0rrc)rrdrrr	r�szAbstractFormatter.pop_fontcCsD|jj|�dd�|jD�}|r.|r.|d}|jj|t|��dS)NcSsg|]}|r|�qSrr)�.0rMrrr	�
<listcomp>sz1AbstractFormatter.push_margin.<locals>.<listcomp>r%rY)r1rar�
new_margin�len)rr�fstackrrr	rs

zAbstractFormatter.push_margincCsF|jr|jd=dd�|jD�}|r,|d}nd}|jj|t|��dS)Nr%cSsg|]}|r|�qSrr)rhrMrrr	ri
sz0AbstractFormatter.pop_margin.<locals>.<listcomp>rYrY)r1rrjrk)rrlrrrr	r 
s
zAbstractFormatter.pop_margincCs||_|jj|�dS)N)r!r�new_spacing)rr!rrr	r"szAbstractFormatter.set_spacingcGsZ|jr*d|_|_|_d|_|jjd�x|D]}|jj|�q0W|jjt	|j��dS)Nrr%rX)
r4r7r5r3rr]r2ra�
new_styles�tuple)rr#Zstylerrr	r$s
zAbstractFormatter.push_styler%cCs$|j|d�=|jjt|j��dS)N)r2rrnro)rr&rrr	r'!szAbstractFormatter.pop_stylecCs$||_|_d|_|_|_dS)Nr)r3r7r5r6r8)rr(rrr	r)%sz"AbstractFormatter.assert_line_data)N)r%)r%)r*r+r,r-r
rr
rrr?rBrCrrrrrrrrr r"r$r'r)rrrr	r.@s,
	
	
	
r.c@sxeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)raMinimal writer interface to use in testing & inheritance.

    A writer which only provides the interface definition; no actions are
    taken on any methods.  This should be the base class for all writers
    which do not need to inherit any implementation methods.

    cCsdS)Nr)rrrr	r
2szNullWriter.__init__cCsdS)Nr)rrrr	�flush3szNullWriter.flushcCsdS)Nr)rrrrr	r`4szNullWriter.new_alignmentcCsdS)Nr)rrdrrr	rc5szNullWriter.new_fontcCsdS)Nr)rr�levelrrr	rj6szNullWriter.new_margincCsdS)Nr)rr!rrr	rm7szNullWriter.new_spacingcCsdS)Nr)rr#rrr	rn8szNullWriter.new_stylescCsdS)Nr)rrrrr	r:9szNullWriter.send_paragraphcCsdS)Nr)rrrr	r9:szNullWriter.send_line_breakcOsdS)Nr)rrrrrr	r;;szNullWriter.send_hor_rulecCsdS)Nr)rrrrr	r><szNullWriter.send_label_datacCsdS)Nr)rrrrr	r]=szNullWriter.send_flowing_datacCsdS)Nr)rrrrr	r_>szNullWriter.send_literal_dataN)r*r+r,r-r
rpr`rcrjrmrnr:r9r;r>r]r_rrrr	r*src@sheZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�AbstractWriterz�A writer which can be used in debugging formatters, but not much else.

    Each method simply announces itself by printing its name and
    arguments on standard output.

    cCstd|f�dS)Nznew_alignment(%r))�print)rrrrr	r`IszAbstractWriter.new_alignmentcCstd|f�dS)Nznew_font(%r))rs)rrdrrr	rcLszAbstractWriter.new_fontcCstd||f�dS)Nznew_margin(%r, %d))rs)rrrqrrr	rjOszAbstractWriter.new_margincCstd|f�dS)Nznew_spacing(%r))rs)rr!rrr	rmRszAbstractWriter.new_spacingcCstd|f�dS)Nznew_styles(%r))rs)rr#rrr	rnUszAbstractWriter.new_stylescCstd|f�dS)Nzsend_paragraph(%r))rs)rrrrr	r:XszAbstractWriter.send_paragraphcCstd�dS)Nzsend_line_break())rs)rrrr	r9[szAbstractWriter.send_line_breakcOstd�dS)Nzsend_hor_rule())rs)rrrrrr	r;^szAbstractWriter.send_hor_rulecCstd|f�dS)Nzsend_label_data(%r))rs)rrrrr	r>aszAbstractWriter.send_label_datacCstd|f�dS)Nzsend_flowing_data(%r))rs)rrrrr	r]dsz AbstractWriter.send_flowing_datacCstd|f�dS)Nzsend_literal_data(%r))rs)rrrrr	r_gsz AbstractWriter.send_literal_dataN)r*r+r,r-r`rcrjrmrnr:r9r;r>r]r_rrrr	rrAsrrc@sJeZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dS)�
DumbWritera;Simple writer class which writes output on the file object passed in
    as the file parameter or, if file is omitted, on standard output.  The
    output is simply word-wrapped to the number of columns specified by
    the maxcol parameter.  This class is suitable for reflowing a sequence
    of paragraphs.

    N�HcCs(|ptj|_||_tj|�|j�dS)N)�sys�stdout�file�maxcolrr
�reset)rrxryrrr	r
ts
zDumbWriter.__init__cCsd|_d|_dS)Nr)�col�atbreak)rrrr	rzzszDumbWriter.resetcCs |jjd|�d|_d|_dS)Nr^r)rx�writer{r|)rrrrr	r:~szDumbWriter.send_paragraphcCs|jjd�d|_d|_dS)Nr^r)rxr}r{r|)rrrr	r9�szDumbWriter.send_line_breakcOs:|jjd�|jjd|j�|jjd�d|_d|_dS)Nr^�-r)rxr}ryr{r|)rrrrrr	r;�s
zDumbWriter.send_hor_rulecCsV|jj|�|jd�}|dkr4d|_||dd�}|j�}|jt|�|_d|_dS)Nr^rr%)rxr}�rfindr{�
expandtabsrkr|)rrrLrrr	r_�s
zDumbWriter.send_literal_datacCs�|sdS|jp|dj�}|j}|j}|jj}xZ|j�D]N}|rn|t|�|kr^|d�d}n|d�|d}||�|t|�}d}q8W||_|dj�|_dS)Nrr^rXr%rY)r|rZr{ryrxr}r\rk)rrr|r{ryr}Zwordrrr	r]�s$zDumbWriter.send_flowing_data)Nru)r*r+r,r-r
rzr:r9r;r_r]rrrr	rtks

rtcCs�t�}t|�}|dk	r t|�}n$tjdd�r>ttjd�}ntj}z0x*|D]"}|dkrd|jd�qL|j|�qLWWd|tjk	r�|j�X|jd�dS)Nr%r^r)	rtr.�openrv�argv�stdinrr�close)rx�w�f�fp�linerrr	�test�s



r��__main__)N)
r-rv�warnings�warn�DeprecationWarningrbrr.rrrrtr�r*rrrr	�<module>s"k*C
cmd.cpython-36.opt-2.pyc000064400000015742150335715140010712 0ustar003


 \:�@s<ddlZddlZdgZdZejejdZGdd�d�ZdS)�N�Cmdz(Cmd) �_c@s�eZdZeZeZdZdZdZ	dZ
dZdZdZ
dZdZd/d
d�Zd0dd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Z d1d-d.�Z!dS)2r�=�Nz(Documented commands (type help <topic>):zMiscellaneous help topics:zUndocumented commands:z*** No help on %s��tabcCs@|dk	r||_ntj|_|dk	r(||_ntj|_g|_||_dS)N)�stdin�sys�stdout�cmdqueue�completekey)�selfrrr
�r�/usr/lib64/python3.6/cmd.py�__init__LszCmd.__init__cCs�|j�|jr\|jr\y2ddl}|j�|_|j|j�|j|jd�Wnt	k
rZYnXz�|dk	rl||_
|j
r�|jjt
|j
�d�d}x�|�s6|jr�|jjd�}nl|jr�yt|j�}Wntk
r�d}YnXn<|jj|j�|jj�|jj�}t|��s
d}n
|jd�}|j|�}|j|�}|j||�}q�W|j�Wd|j�r�|j�r�yddl}|j|j�Wnt	k
�r�YnXXdS)Nrz
: complete�
�EOFz
)�preloop�use_rawinputr�readlineZ
get_completerZ
old_completerZ
set_completer�complete�parse_and_bind�ImportError�intror
�write�strr�pop�input�prompt�EOFError�flushr�len�rstrip�precmd�onecmd�postcmd�postloop)r
rr�stop�linerrr�cmdloopbsN






zCmd.cmdloopcCs|S)Nr)r
r(rrrr#�sz
Cmd.precmdcCs|S)Nr)r
r'r(rrrr%�szCmd.postcmdcCsdS)Nr)r
rrrr�szCmd.preloopcCsdS)Nr)r
rrrr&�szCmd.postloopcCs�|j�}|sdd|fS|ddkr4d|dd�}n2|ddkrft|d�r\d|dd�}n
dd|fSdt|�}}x"||kr�|||jkr�|d}qvW|d|�||d�j�}}|||fS)Nr�?zhelp r�!Zdo_shellzshell )�strip�hasattrr!�
identchars)r
r(�i�n�cmd�argrrr�	parseline�s


z
Cmd.parselinecCs�|j|�\}}}|s|j�S|dkr.|j|�S||_|dkrBd|_|dkrT|j|�Syt|d|�}Wntk
r�|j|�SX||�SdS)Nrr�do_)r3�	emptyline�default�lastcmd�getattr�AttributeError)r
r(r1r2�funcrrrr$�s


z
Cmd.onecmdcCs|jr|j|j�SdS)N)r7r$)r
rrrr5�sz
Cmd.emptylinecCs|jjd|�dS)Nz*** Unknown syntax: %s
)r
r)r
r(rrrr6�szCmd.defaultcGsgS)Nr)r
�ignoredrrr�completedefault�szCmd.completedefaultcsd|��fdd�|j�D�S)Nr4cs"g|]}|j��r|dd��qS)�N)�
startswith)�.0�a)�dotextrr�
<listcomp>�sz%Cmd.completenames.<locals>.<listcomp>)�	get_names)r
�textr;r)rAr�
completenames�szCmd.completenamesc
Cs�|dkr�ddl}|j�}|j�}t|�t|�}|j�|}|j�|}|dkr�|j|�\}	}
}|	dkrp|j}q�yt|d|	�}Wq�t	k
r�|j}Yq�Xn|j
}|||||�|_y
|j|Stk
r�dSXdS)NrrZ	complete_)
rZget_line_buffer�lstripr!Z
get_begidxZ
get_endidxr3r<r8r9rEZcompletion_matches�
IndexError)
r
rD�staterZorigliner(�strippedZbegidxZendidxr1�argsZfooZcompfuncrrrr�s*
zCmd.completecCs
t|j�S)N)�dir�	__class__)r
rrrrCsz
Cmd.get_namescs4t|j���}t�fdd�|j�D��}t||B�S)Nc3s,|]$}|jd�d�r|dd�VqdS)�help_r�N)r>)r?r@)rJrr�	<genexpr> sz$Cmd.complete_help.<locals>.<genexpr>)�setrErC�list)r
rJZcommandsZtopicsr)rJr�
complete_helpszCmd.complete_helpcCs�|r�yt|d|�}Wnvtk
r�y0t|d|�j}|rT|jjdt|��dSWntk
rjYnX|jjdt|j|f��dSX|��n|j�}g}g}i}x,|D]$}|dd�dkr�d||dd�<q�W|j�d}	xx|D]p}|dd�dkr�||	k�rq�|}	|dd�}
|
|k�r8|j	|
�||
=q�t||�j�rR|j	|
�q�|j	|
�q�W|jjdt|j
��|j|j|dd	�|j|j
t|j��dd	�|j|j|dd	�dS)
NrMr4z%s
rNrrr=��P)r8r9�__doc__r
rr�nohelprC�sort�append�
doc_leader�print_topics�
doc_header�misc_headerrQ�keys�undoc_header)r
r2r:�doc�namesZcmds_docZ
cmds_undoc�help�nameZprevnamer1rrr�do_help$sN





zCmd.do_helpcCs\|rX|jjdt|��|jr<|jjdt|jt|���|j||d�|jjd�dS)Nz%s
rr)r
rr�rulerr!�	columnize)r
�headerZcmdsZcmdlenZmaxcolrrrrZRszCmd.print_topicsrTcs��s|jjd�dS�fdd�tt���D�}|rJtddjtt|����t��}|dkrv|jjdt�d��dSx�tdt���D]�}||d|}g}d}xrt|�D]f}	d}
x<t|�D]0}|||	}||kr�P�|}
t|
t|
��}
q�W|j	|
�||
d	7}||kr�Pq�W||kr�Pq�Wt��}d}dg}x�t|�D]�}g}x@t|�D]4}	|||	}||k�rrd
}
n�|}
|j	|
��qRWx|�r�|d
�r�|d=�q�Wx,tt|��D]}	||	j
||	�||	<�q�W|jjdtdj|����q@WdS)Nz<empty>
csg|]}t�|t�s|�qSr)�
isinstancer)r?r/)rQrrrBdsz!Cmd.columnize.<locals>.<listcomp>z list[i] not a string for i in %sz, rz%s
r�rz  ������rj)r
r�ranger!�	TypeError�join�mapr�maxrX�ljust)r
rQZdisplaywidthZ
nonstrings�sizeZnrowsZncolsZ	colwidthsZtotwidth�colZcolwidth�rowr/�xZtextsr)rQrreZsZ

z
Cmd.columnize)rNN)N)rT)"�__name__�
__module__�__qualname__�PROMPTr�
IDENTCHARSr.rdr7rrYr[r\r^rVrrr)r#r%rr&r3r$r5r6r<rErrCrRrcrZrerrrrr4s:

4
		.)�stringr	�__all__rxZ
ascii_lettersZdigitsryrrrrr�<module>-ssecrets.cpython-36.pyc000064400000004164150335715140010653 0ustar003


 \��@s�dZddddddddgZd	d
lZd	d
lZd	d
lZd	dlmZd	dlmZe�Z	e	j
Ze	jZd
d�Z
dZddd�Zddd�Zddd�Zd
S)z�Generate cryptographically strong pseudo-random numbers suitable for
managing secrets such as account authentication, tokens, and similar.

See PEP 506 for more information.
https://www.python.org/dev/peps/pep-0506/

�choice�	randbelow�randbits�SystemRandom�token_bytes�	token_hex�
token_urlsafe�compare_digest�N)r)rcCs|dkrtd��tj|�S)z(Return a random int in the range [0, n).r	zUpper bound must be positive.)�
ValueError�_sysrandZ
_randbelow)Zexclusive_upper_bound�r�/usr/lib64/python3.6/secrets.pyrs� cCs|dkrt}tj|�S)z�Return a random byte string containing *nbytes* bytes.

    If *nbytes* is ``None`` or not supplied, a reasonable
    default is used.

    >>> token_bytes(16)  #doctest:+SKIP
    b'\xebr\x17D*t\xae\xd4\xe3S\xb6\xe2\xebP1\x8b'

    N)�DEFAULT_ENTROPY�os�urandom)�nbytesrrr
r#s
cCstjt|��jd�S)a"Return a random text string, in hexadecimal.

    The string has *nbytes* random bytes, each byte converted to two
    hex digits.  If *nbytes* is ``None`` or not supplied, a reasonable
    default is used.

    >>> token_hex(16)  #doctest:+SKIP
    'f9bf78b9a18ce6d46a0cd2b0b86df9da'

    �ascii)�binasciiZhexlifyr�decode)rrrr
r1scCst|�}tj|�jd�jd�S)z�Return a random URL-safe text string, in Base64 encoding.

    The string has *nbytes* random bytes.  If *nbytes* is ``None``
    or not supplied, a reasonable default is used.

    >>> token_urlsafe(16)  #doctest:+SKIP
    'Drmhze6EPcv0fN_81Bj-nA'

    �=r)r�base64Zurlsafe_b64encode�rstripr)r�tokrrr
r>s
)N)N)N)�__doc__�__all__rrrZhmacrZrandomrrZgetrandbitsrrrrrrrrrrr
�<module>s 


sre_parse.cpython-36.pyc000064400000047610150335715140011171 0ustar003


 \���@s�dZddlTdZdZed�Zed�Zed�Zed�Zed	�Z	ee
eh�Zee
eeeeeh�Zeed
�feed�feed�feed
�feed�feed�feed�feed�fd�Zeefeefeefeeefgfeeefgfeeefgfeeefgfeeefgfeeefgfee fd�
Z!e"e#e$e%e&e'e(e)d�Z*e'e#Be)Be+Be(BZ,Gdd�de-�Z.Gdd�d�Z/Gdd�d�Z0Gdd�d�Z1dd�Z2dd �Z3d!d"�Z4d#d$�Z5d3d&d'�Z6d(d)�Z7d*d+�Z8d4d-d.�Z9d/d0�Z:d1d2�Z;d,S)5zInternal support module for sre�)�*z.\[{()*+?^$|z*+?{�
0123456789Z01234567Z0123456789abcdefABCDEFZ4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZz 	

����
�
�	��\)z\az\bz\fz\nz\rz\tz\vz\\)
z\Az\bz\Bz\dz\Dz\sz\Sz\wz\Wz\Z)�i�L�m�s�x�a�t�uc@seZdZdS)�VerboseN)�__name__�
__module__�__qualname__�rr�!/usr/lib64/python3.6/sre_parse.pyrGsrc@sBeZdZdd�Zedd��Zddd�Zdd	�Zd
d�Zdd
�Z	dS)�PatterncCsd|_i|_dg|_d|_dS)Nr)�flags�	groupdict�groupwidths�lookbehindgroups)�selfrrr�__init__LszPattern.__init__cCs
t|j�S)N)�lenr)rrrr�groupsQszPattern.groupsNcCsb|j}|jjd�|jtkr$td��|dk	r^|jj|d�}|dk	rTtd|||f��||j|<|S)Nztoo many groupsz7redefinition of group name %r as group %d; was group %d)r"r�append�	MAXGROUPS�errorr�get)r�name�gid�ogidrrr�	opengroupTs

zPattern.opengroupcCs|j�|j|<dS)N)�getwidthr)rr(�prrr�
closegroup`szPattern.closegroupcCs||jko|j|dk	S)N)r"r)rr(rrr�
checkgroupbszPattern.checkgroupcCs6|jdk	r2|j|�s|jd��||jkr2|jd��dS)Nzcannot refer to an open groupz?cannot refer to group defined in the same lookbehind subpattern)rr.r%)rr(�sourcerrr�checklookbehindgroupes




zPattern.checklookbehindgroup)N)
rrrr �propertyr"r*r-r.r0rrrrrJs
rc@s`eZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�ZdS)�
SubPatternNcCs"||_|dkrg}||_d|_dS)N)�pattern�data�width)rr3r4rrrr os
zSubPattern.__init__rcCs�d}ttf}�x�|jD�]�\}}t|dt|�dd�|tkrtt�x*|D]"\}}t|ddt|�|�qLWq|tkr�t�x:t|d�D]*\}}|r�t|dd�|j|d�q�Wq|t	k�r|\}}	}
td|�|	j|d�|
�r�t|dd�|
j|d�qt
||��r�d}x\|D]T}t
|t��rX|�sDt�|j|d�d}n"|�sjtd	dd�t|dd�d}�q(W|�s�t�qtd|�qWdS)
NTz  �)�end��OR�ELSEF� )�tuple�listr4�print�str�IN�BRANCH�	enumerate�dump�GROUPREF_EXISTS�
isinstancer2)r�level�nl�seqtypes�op�avrr�	condgroup�item_yes�item_norrrrCusH 




zSubPattern.dumpcCs
t|j�S)N)�reprr4)rrrr�__repr__�szSubPattern.__repr__cCs
t|j�S)N)r!r4)rrrr�__len__�szSubPattern.__len__cCs|j|=dS)N)r4)r�indexrrr�__delitem__�szSubPattern.__delitem__cCs&t|t�rt|j|j|�S|j|S)N)rE�slicer2r3r4)rrQrrr�__getitem__�s
zSubPattern.__getitem__cCs||j|<dS)N)r4)rrQ�coderrr�__setitem__�szSubPattern.__setitem__cCs|jj||�dS)N)r4�insert)rrQrUrrrrW�szSubPattern.insertcCs|jj|�dS)N)r4r#)rrUrrrr#�szSubPattern.appendc	Cs�|jdk	r|jSd}}�x�|jD�]�\}}|tkr�td}d}x0|dD]$}|j�\}}t||�}t||�}qJW||}||}q"|tkr�|j�\}}||}||}q"|tkr�|dj�\}}||}||}q"|t	k�r|dj�\}}|||d}|||d}q"|t
k�r,|d}|d}q"|tk�rX|jj
|\}}||}||}q"|tk�r�|dj�\}}|ddk	�r�|dj�\}}t||�}t||�}nd}||}||}q"|tkr"Pq"Wt|td�t|t�f|_|jS)Nrr8����)r5r4rA�	MAXREPEATr+�min�max�CALL�
SUBPATTERN�_REPEATCODES�
_UNITCODES�GROUPREFr3rrD�SUCCESS)	r�lo�hirIrJr�j�l�hrrrr+�sZ












zSubPattern.getwidth)N)r)
rrrr rCrOrPrRrTrVrWr#r+rrrrr2ms

(r2c@sbeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Ze	d
d��Z
dd�Zdd�Zddd�Z
dS)�	TokenizercCs@t|t�|_||_|js"t|d�}||_d|_d|_|j�dS)N�latin1r)rEr?�istext�string�decoded_stringrQ�next�_Tokenizer__next)rrkrrrr �s
zTokenizer.__init__cCs�|j}y|j|}Wntk
r.d|_dSX|dkr�|d7}y||j|7}Wn.tk
r�td|jt|j�d�d�YnX|d|_||_dS)Nrr8zbad escape (end of pattern))rQrl�
IndexErrorrmr%rkr!)rrQ�charrrr�__next�s
zTokenizer.__nextcCs||jkr|j�dSdS)NTF)rmrn)rrprrr�match�s
zTokenizer.matchcCs|j}|j�|S)N)rmrn)r�thisrrrr&�sz
Tokenizer.getcCs:d}x0t|�D]$}|j}||kr"P||7}|j�qW|S)Nr6)�rangermrn)r�n�charset�result�_�crrr�getwhileszTokenizer.getwhilecCshd}x^|j}|j�|dkr>|s*|jd��|jd|t|���||krX|sV|jdd��P||7}qW|S)Nr6zmissing group namezmissing %s, unterminated namer8)rmrnr%r!)r�
terminatorrwryrrr�getuntil
s


zTokenizer.getuntilcCs|jt|jpd�S)Nr6)rQr!rm)rrrr�possz
Tokenizer.poscCs|jt|jpd�S)Nr6)rQr!rm)rrrr�tellszTokenizer.tellcCs||_|j�dS)N)rQrn)rrQrrr�seekszTokenizer.seekrcCst||j|j�|�S)N)r%rkr~)r�msg�offsetrrrr%#szTokenizer.errorN)r)rrrr rnrrr&rzr|r1r}r~rr%rrrrrh�s		rhcCstj|�}|r|Stj|�}|r0|dtkr0|S�y�|dd�}|dkr�||jdt�7}t|�dkrx|jd|t|���tt	|dd�d�fS|dkr�|j
r�||jdt�7}t|�d	kr�|jd|t|���tt	|dd�d�fS|d
ko�|j
�rF||jdt�7}t|�dk�r$|jd|t|���t	|dd�d�}t|�t|fS|tk�r�||jdt�7}t	|dd�d�}|d
k�r�|jd|t|���t|fS|t
k�r�t�t|�dk�r�|tk�r�|jd|t|���tt|d�fSWntk
�r�YnX|jd|t|���dS)Nrr8rXr�zincomplete escape %s�r��U��
�z.octal escape value %s outside of range 0-0o377z
bad escape %s)�ESCAPESr&�
CATEGORIESr@rz�	HEXDIGITSr!r%�LITERAL�intrj�chr�	OCTDIGITS�DIGITS�
ValueError�ASCIILETTERS�ord)r/�escaperUryrrr�
_class_escape&sR





r�cCs�tj|�}|r|Stj|�}|r$|S�yt|dd�}|dkr�||jdt�7}t|�dkrl|jd|t|���tt|dd�d�fS|dkr�|j	r�||jdt�7}t|�dkr�|jd|t|���tt|dd�d�fS|d	ko�|j	�r:||jd
t�7}t|�dk�r|jd|t|���t|dd�d�}t
|�t|fS|dk�rj||jdt�7}tt|dd�d
�fS|tk�r\|j
tk�r�||j�7}|dtk�r�|dtk�r�|j
tk�r�||j�7}t|dd�d
�}|d
k�r�|jd|t|���t|fSt|dd��}||jk�rD|j|��s0|jdt|���|j||�t|fS|jd|t|�d��t|�dk�r�|tk�r�|jd|t|���tt|d�fSWntk
�r�YnX|jd|t|���dS)Nr8rXrr�zincomplete escape %sr�rr�r�r�r��0r�z.octal escape value %s outside of range 0-0o377zcannot refer to an open groupzinvalid group reference %dz
bad escape %s)r�r&r�rzr�r!r%r�r�rjr�r�r�rmr"r.r0rar�r�r�)r/r��staterUry�grouprrr�_escapeVsn







r�cCs$g}|j}|j}|j�}x.|t||||d|o4|��|d�sPqWt|�dkr\|dSt|�}|j}	x\d}
xP|D]*}|s�P|
dkr�|d}
qv|d|
krvPqvWx|D]
}|d=q�W|	|
�qlPqlWxD|D]"}t|�dks�|ddtk	r�Pq�W|	tdd�|D�f�|S|jtd|ff�|S)Nr8�|rcSsg|]}|d�qS)rr)�.0�itemrrr�
<listcomp>�sz_parse_sub.<locals>.<listcomp>)	r#rrr~�_parser!r2r�r@rA)r/r��verbose�nested�items�itemsappend�sourcematch�start�
subpattern�subpatternappend�prefixr�rrr�
_parse_sub�sD




r�cCsht||||d�}|jd�rDt||||d�}|jdkrH|jd��nd}t|�}|jt|||ff�|S)Nr8r�z/conditional backref with more than two branches)r�rrrmr%r2r#rD)r/r�rKr�r�rLrMr�rrr�_parse_sub_cond�s

r�Fc)Cst|�}|j}|j}|j}t}	t}
�
x�|j}|dkr6P|dkr@P|�|r||tkrTq&|dkr|x|�}|dkst|dkr^Pq^Wq&|ddkr�t|||�}||�q&|t	kr�|t
|
|�f�q&|dk�r4|j�d}
g}|j}|d�r�|tdf�|dd�}�x�|�}|dk�r |j
d	|j�|
��|d
k�r8||k�r8Pn&|ddk�rRt||�}nt
|
|�f}|d��r�|�}|dk�r�|j
d	|j�|
��|d
k�r�|dtk�r�|dd}||�|t
|
d�f�P|ddk�r�t||�}nt
|
|�f}|dt
k�s|dt
k�r4d||f}|j
|t|�dt|���|d}|d}||k�rvd||f}|j
|t|�dt|���|t||ff�n"|dtk�r�|dd}||��q�W|	|�dk�r�|ddt
k�r�||d�nT|	|�d
k�r&|ddtk�r&|ddt
k�r&|t|ddf�n|t|f�q&|tk�rb|j�}
|dk�r\d7\}}�nJ|dk�rtdt}}�n2|dk�r�dt}}�n|dk�r�|jdk�r�|t
|
|�f�q&dt}}d}}x|jtk�r�||�7}�q�W|d��rx"|jtk�r
||�7}�q�Wn|}|d��s8|t
|
|�f�|j|
�q&|�rXt|�}|tk�rXtd��|�r�t|�}|tk�rxtd��||k�r�|j
d|j�|
��ntd|f��|�r�|d8d�}nd}|�s�|	|�dk�r|ddtk�r|j
d|j�|
t|���|ddtk�r0|j
d|j�|
t|���|d��rNt|||ff|d9<nt|||ff|d:<q&|dk�rz|tdf�q&|dk�
r�|j�d}d}d}d}d}d}|d��	r�|�}|dk�r�|j
d��|dk�r�|d��r|jd �}|j��s�d!|}|j
|t|�d��n�|d"��r�|jd#�}|j��sHd!|}|j
|t|�d��|j j|�} | dk�rzd$|}|j
|t|�d��|j!| ��s�|j
d%t|�d��|j"| |�|t#| f�q&n2|�}|dk�r�|j
d��|j
d&|t|�d
���n�|d'k�r�d}�n�|dk�rDx4|jdk�r*|j
d(|j�|��|�d#k�r
P�q
Wq&�n�|d)k�r0d}!|dk�r�|�}|dk�rv|j
d��|d*k�r�|j
d+|t|�d
��d;}!|j$}"|"dk�r�|j%|_$t&||||d�}#|!dk�r�|"dk�r�d|_$|d#��s�|j
d,|j�|��|d"k�r|t'|!|#ff�q&|t(|!|#ff�q&�n�|dk�	r$|jd#�}$d}|$j��r�|j j|$�}|dk�	rd$|$}|j
|t|$�d��n�yt|$�}|dk�r�t)�Wn4t)k
�r�d!|$}|j
|t|$�d�d�YnX|�s�|j
d-t|$�d��|t*k�	rd.|}|j
|t|$�d��|j"||�n�|t+k�	s8|dk�	r�t,|||�}%|%dk�	r�|�	s\|�	r�ddl-}&|&j.d/|j/dd0�t|j/�d0k�	r�d1ndft0|d2d3�|j1t2@r&|r&t3�q&|%\}}d}n|j
d4|t|�d��|dk	�
r0y|j4|�}Wn<t
k
�
r.}'z|j
|'j5t|�d�d�WYdd}'~'XnX|�
rLt6|||||d�}#n,|�
s\|t2@�
od|t2@}(t&|||(|d�}#|jd#��
s�|j
d,|j�|��|dk	�
r�|j7||#�|t8||||#ff�q&|dk�
r�|tt9f�q&|d5k�
r�|jtt:f�q&td6|f��q&W|S)<Nz|)�#rrr�[r8�^zunterminated character set�]�-zbad character range %s-%srX�?r�+�{�}r6�,z"the repetition number is too largez"min repeat greater than max repeatzunsupported quantifier %rznothing to repeatzmultiple repeat�.�(Tzunexpected end of pattern�P�<�>zbad character in group name %r�=�)zunknown group name %rzcannot refer to an open groupzunknown extension ?P�:zmissing ), unterminated commentz=!<z=!zunknown extension ?<z"missing ), unterminated subpatternzbad group numberzinvalid group reference %dz-Flags not at the start of the expression %r%s�z (truncated)r�)�
stacklevelzunknown extension ?�$z unsupported special character %r)rr8rYrYrYrY);r2r#r&rrr!r�rm�
WHITESPACEr��
SPECIAL_CHARSr�r~�NEGATEr%r�r@�RANGE�NOT_LITERAL�REPEAT_CHARSrZr�rr��
OverflowError�AssertionError�ATr_�
MIN_REPEAT�
MAX_REPEAT�ANYr|�isidentifierrr.r0rarr"r��ASSERT�
ASSERT_NOTr�r$�FLAGS�_parse_flags�warnings�warnrk�DeprecationWarningr�SRE_FLAG_VERBOSErr*r�r�r-r^�AT_BEGINNING�AT_END))r/r�r�r��firstr�r��	sourcegetr��_len�_ordrsrU�here�set�	setappendr��code1�that�code2r�rcrdr[r\rpr�r�r'rK�	add_flags�	del_flagsr(�dirrr,�condnamerr��err�sub_verboserrrr��s






 2











(






































*



r�cCs�|j}d}d}|dkrrxZ|t|O}|�}|dkr<|jd��|dkrFP|tkr|j�rZdnd}|j|t|���qW|dkr�|j|O_dS|t@r�|jdd��|dk�rL|�}|dkr�|jd	��|tkr�|j�r�dnd	}|j|t|���x`|t|O}|�}|dk�r|jd
��|dk�rP|tkr�|j��r4dnd
}|j|t|���q�W|dk�sZt�|t@�rp|jdd��||@�r�|jd
d��||fS)Nrr�zmissing -, : or )z)-:zunknown flagr�z,bad inline flags: cannot turn on global flagr8zmissing flagz	missing :r�z-bad inline flags: cannot turn off global flagz(bad inline flags: flag turned on and off)r&r�r%�isalphar!r�GLOBAL_FLAGSr�)r/r�rpr�r�r�r�rrrr�sT







r�cCsjt|t�r>|t@rtd��|t@s,|tO}qf|t@rftd��n(|t@rNtd��|t@rf|t@rftd��|S)Nz)cannot use LOCALE flag with a str patternz(ASCII and UNICODE flags are incompatiblez,cannot use UNICODE flag with a bytes patternz'ASCII and LOCALE flags are incompatible)rEr?�SRE_FLAG_LOCALEr��SRE_FLAG_ASCII�SRE_FLAG_UNICODE)�srcrrrr�	fix_flags<s


r�NcCs�t|�}|dkrt�}||_||_yt|||t@d�}WnBtk
rzt�}|tB|_||_|jd�t||dd�}YnXt||j	j�|j	_|j
dk	r�|j
dks�t�|jd��|t
@r�|j�|S)NrTr�zunbalanced parenthesis)rhrrr?r�r�rrr�r3rmr�r%�SRE_FLAG_DEBUGrC)r?rr3r/r,rrr�parseLs(



r�cs�t|���j}g�g�g��j}�����fdd�}�j}�x�|�}|dkrNP|ddk�r�|d}|dk�rJd}�jd�s��jd	���jd
�}|j�r�y||}	Wn tk
r�t	d|��YnXnlyt
|�}	|	dkr�t�Wn0tk
�r�jd|t|�d�d�YnX|	t
k�r4�jd
|	t|�d��||	t|�d��q�|dk�r��jtk�r�||�7}�jtk�r�||�7}|tt
|dd�d�d@���q�|tk�rZd}
�jtk�r4||�7}|tk�r4|dtk�r4�jtk�r4||�7}d}
t
|dd�d�}|dk�r(�jd|t|���|t|��|
�s�|t
|dd��t|�d�nZytt|d�}Wn<tk
�r�|tk�r�ddl}|jd|tdd�YnX||�q>||�q>W��r؈jdj���t|t��s�dd��D����fS)NcsX|�jkr�jd||���r8�jdj����dd�=�jt��|f��jd�dS)Nzinvalid group reference %dr6)r"r%r#�joinr!)rQr})r"�literal�literalsr3rrr�addgroupus

z parse_template.<locals>.addgrouprrr8�gr6r�z	missing <r�zunknown group name %rzbad character in group name %rzinvalid group reference %dr�r�r�FrXTz.octal escape value %s outside of range 0-0o377z
bad escape %sr�)r�cSs"g|]}|dkrdn|jd��qS)Nzlatin-1)�encode)r�rrrrr��sz"parse_template.<locals>.<listcomp>)rhr&r#�
groupindexrrr%r|r��KeyErrorror�r�r!r$rmr�r�r�r�r�r�r�r�r�rEr?)r/r3�sget�lappendr�r�rsryr'rQ�isoctalr�r)r"r�r�r3rr�parse_templatels�









"



 


r�cCsz|j}|jdd�}|\}}|dd�}y&x |D]\}}||�pB|||<q0WWn tk
rntd|��YnX|j|�S)Nrzinvalid group reference %d)r�rkror%r�)�templaterrr��emptyr"r�rQr�rrr�expand_template�sr�)F)rN)<�__doc__�
sre_constantsr�r��	frozensetr�r�r�r�r�r�r�r_r�r�r@r�r��CATEGORYr`r�r�r�ZAT_BEGINNING_STRINGZAT_BOUNDARYZAT_NON_BOUNDARYZCATEGORY_DIGITZCATEGORY_NOT_DIGITZCATEGORY_SPACEZCATEGORY_NOT_SPACEZ
CATEGORY_WORDZCATEGORY_NOT_WORDZ
AT_END_STRINGr��SRE_FLAG_IGNORECASEr��SRE_FLAG_MULTILINE�SRE_FLAG_DOTALLr�r��SRE_FLAG_TEMPLATEr�r�r�r��	Exceptionrrr2rhr�r�r�r�r�r�r�r�r�r�rrrr�<module>sj






#qH0A3
<,
 Wre.cpython-36.opt-2.pyc000064400000013224150335715140010546 0ustar003


 \�<�#@s�ddlZddlZddlZddlZyddlZWnek
rDdZYnXdddddddd	d
ddd
dddddddddddddddgZdZGdd�dej�Z	e
�je	j�ej
Z
d<d d�Zd=d!d�Zd>d"d�Zd?d#d�Zd@d$d�ZdAd%d�ZdBd&d�ZdCd'd	�ZdDd(d
�Zd)d�ZdEd*d�Zed+�Zed,�Zd-d
�ZiZeejd.d��Zd/Z d0d1�Z!ej"e �d2d3��Z#d4d5�Z$d6d7�Z%ddl&Z&d8d9�Z'e&j(ee'e!�Gd:d;�d;�Z)dS)F�N�match�	fullmatch�search�sub�subn�split�findall�finditer�compile�purge�template�escape�error�A�I�L�M�S�X�U�ASCII�
IGNORECASE�LOCALE�	MULTILINE�DOTALL�VERBOSE�UNICODEz2.2.1c@sbeZdZejZejZejZ	ej
ZejZ
ejZejZeZeZe	ZeZe
ZeZeZejZeZejZdS)�	RegexFlagN)�__name__�
__module__�__qualname__�sre_compile�SRE_FLAG_ASCIIr�SRE_FLAG_IGNORECASEr�SRE_FLAG_LOCALEr�SRE_FLAG_UNICODEr�SRE_FLAG_MULTILINEr�SRE_FLAG_DOTALLr�SRE_FLAG_VERBOSErrrrrrrr�SRE_FLAG_TEMPLATE�TEMPLATE�T�SRE_FLAG_DEBUG�DEBUG�r.r.�/usr/lib64/python3.6/re.pyr�s"rcCst||�j|�S)N)�_compiler)�pattern�string�flagsr.r.r/r�scCst||�j|�S)N)r0r)r1r2r3r.r.r/r�scCst||�j|�S)N)r0r)r1r2r3r.r.r/r�scCst||�j|||�S)N)r0r)r1�replr2�countr3r.r.r/r�scCst||�j|||�S)N)r0r)r1r4r2r5r3r.r.r/r�s	cCst||�j||�S)N)r0r)r1r2�maxsplitr3r.r.r/r�scCst||�j|�S)N)r0r)r1r2r3r.r.r/r�scCst||�j|�S)N)r0r	)r1r2r3r.r.r/r	�scCs
t||�S)N)r0)r1r3r.r.r/r
�scCstj�tj�dS)N)�_cache�clear�
_compile_repl�cache_clearr.r.r.r/r�scCst||tB�S)N)r0r+)r1r3r.r.r/r�sZ@_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890s@_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890cCs�t|t�r\t}t|�}x:t|�D].\}}||kr |dkrBd||<q d|||<q Wdj|�St}g}td�}xH|D]@}||kr�|j|�qr|dkr�|j	d�qr|j|�|j|�qrWt
|�SdS)N�z\000�\��\rs\000)�
isinstance�str�
_alphanum_str�list�	enumerate�join�_alphanum_bytes�ord�append�extend�bytes)r1�alphanum�s�i�c�escr.r.r/r
�s(




r=ic
Cs�y6tt|�||f\}}|dks0|tjtj�kr4|SWntk
rJYnXt|t�rf|rbtd��|St	j
|�sxtd��t	j||�}|t
@s�tt�tkr�tj�|jt@r�ts�|Stjtj�}nd}||ftt|�||f<|S)Nz5cannot process flags argument with a compiled patternz1first argument must be string or compiled pattern)r7�type�_locale�	setlocale�LC_CTYPE�KeyErrorr?�
_pattern_type�
ValueErrorr!�isstring�	TypeErrorr
r-�len�	_MAXCACHEr8r3r)r1r3�p�locr.r.r/r0s0


r0cCstj||�S)N)�	sre_parse�parse_template)r4r1r.r.r/r9:sr9cCstj||�}tj||�S)N)r\r]�expand_template)r1rrr.r.r/�_expand?sr_cCs@t||�}|dr0t|d�dkr0|ddS|fdd�}|S)Nr�cSstj||�S)N)r\r^)rrr.r.r/�filterJsz_subx.<locals>.filter)r9rX)r1rrar.r.r/�_subxDs

rbcCst|j|jffS)N)r0r1r3)rZr.r.r/�_pickleRsrcc@seZdZddd�Zdd�ZdS)�Scannerrc
Cs�ddlm}m}||_g}tj�}||_xP|D]H\}}|j�}	|jtj	|||	ddtj
||�ffg��|j|	|d�q.Wtj	||d|ffg�}tj
|�|_dS)Nr)�BRANCH�
SUBPATTERNr`���)�
sre_constantsrerf�lexiconr\�Patternr3�	opengrouprG�
SubPattern�parse�
closegroupr!r
�scanner)
�selfrir3rerfrZrK�phrase�action�gidr.r.r/�__init__[s
zScanner.__init__c	Cs�g}|j}|jj|�j}d}xf|�}|s*P|j�}||kr<P|j|jdd}t|�rl||_|||j��}|dk	r|||�|}qW|||d�fS)Nrr`)rGror�endri�	lastindex�callable�group)	rpr2�resultrGrrL�m�jrrr.r.r/�scanjs&zScanner.scanN)r)rrr rtr|r.r.r.r/rdZs
rd)r)r)r)rr)rr)rr)r)r)r)r)*�enumr!r\�	functoolsrP�ImportError�__all__�__version__�IntFlagr�globals�update�__members__rrrrrrrrr	r
rr�	frozensetrArEr
r7rOrTrYr0�	lru_cacher9r_rb�copyregrc�picklerdr.r.r.r/�<module>zsV




	







 glob.cpython-36.opt-1.pyc000064400000010140150335715140011054 0ustar003


 \�@s�dZddlZddlZddlZdddgZdd�dd�Zdd�d	d�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zejd�Zejd�Zdd�Zdd�Zd d!�Zd"d�ZdS)#zFilename globbing utility.�N�glob�iglob�escapeF)�	recursivecCstt||d��S)ayReturn a list of paths matching a pathname pattern.

    The pattern may contain simple shell-style wildcards a la
    fnmatch. However, unlike fnmatch, filenames starting with a
    dot are special cases that are not matched by '*' and '?'
    patterns.

    If recursive is true, the pattern '**' will match any files and
    zero or more directories and subdirectories.
    )r)�listr)�pathnamer�r�/usr/lib64/python3.6/glob.pyr	scCs$t||d�}|r t|�r t|�}|S)a�Return an iterator which yields the paths matching a pathname pattern.

    The pattern may contain simple shell-style wildcards a la
    fnmatch. However, unlike fnmatch, filenames starting with a
    dot are special cases that are not matched by '*' and '?'
    patterns.

    If recursive is true, the pattern '**' will match any files and
    zero or more directories and subdirectories.
    F)�_iglob�_isrecursive�next)rr�it�srrr	rsccstjj|�\}}t|�sF|r0tjj|�rB|Vntjj|�rB|VdS|s�|rjt|�rjt|||�EdHnt|||�EdHdS||kr�t|�r�t	||d�}n|g}t|�r�|r�t|�r�t}q�t}nt
}x2|D]*}x$||||�D]}tjj||�Vq�Wq�WdS)NT)�os�path�split�	has_magic�lexists�isdirr�_glob2�_glob1r
�_glob0�join)rr�dironly�dirname�basename�dirsZglob_in_dir�namerrr	r
's0
r
cCs0tt||��}t|�s$dd�|D�}tj||�S)Ncss|]}t|�s|VqdS)N)�	_ishidden)�.0�xrrr	�	<genexpr>Rsz_glob1.<locals>.<genexpr>)r�_iterdirr�fnmatch�filter)r�patternr�namesrrr	rOsrcCs8|stjj|�r4|gSntjjtjj||��r4|gSgS)N)rrrrr)rrrrrr	rUsrcCst||d�S)NF)r)rr%rrr	�glob0bsr'cCst||d�S)NF)r)rr%rrr	�glob1esr(ccs"|dd�Vt||�EdHdS)Nr)�	_rlistdir)rr%rrrr	rksrccs�|s"t|t�rttjd�}ntj}yXtj|��D}x<|D]4}y|sJ|j�rR|jVWq6tk
rhYq6Xq6WWdQRXWntk
r�dSXdS)N�ASCII)�
isinstance�bytesr�curdir�scandir�is_dirr�OSError)rrr
�entryrrr	r"rs

r"ccshtt||��}xT|D]L}t|�s|V|r8tjj||�n|}x"t||�D]}tjj||�VqHWqWdS)N)rr"rrrrr))rrr&r r�yrrr	r)�s
r)z([*?[])s([*?[])cCs(t|t�rtj|�}n
tj|�}|dk	S)N)r+r,�magic_check_bytes�search�magic_check)r�matchrrr	r�s

rcCs|ddkS)Nr�.�.�.)r7r9r)rrrr	r�srcCst|t�r|dkS|dkSdS)Ns**z**)r+r,)r%rrr	r�s
rcCs<tjj|�\}}t|t�r(tjd|�}ntjd|�}||S)z#Escape all special characters.
    s[\1]z[\1])rr�
splitdriver+r,r3�subr5)rZdriverrr	r�s

)�__doc__r�rer#�__all__rrr
rrr'r(rr"r)�compiler5r3rrrrrrrr	�<module>s(

(



poplib.cpython-36.opt-2.pyc000064400000020320150335715140011420 0ustar003


 \t:�
@shddlZddlZddlZyddlZdZWnek
r@dZYnXddgZGdd�de�ZdZ	dZ
d	Zd
ZeeZ
dZGdd�d�Zer�Gd
d�de�Zejd�edk�rdddlZeejd�Zeej��ejejd�ejejd�ej�ej�\ZZxXeded�D]FZej e�\Z!Z"Z#ede�xe"D]Z$ede$��q8Wed��qWej%�dS)�NTF�POP3�error_protoc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/poplib.pyrs�ni��
�
ic@seZdZdZeejfdd�Zdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd<dd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zejd/�Zd0d1�Z d2d3�Z!d=d4d5�Z"d6d7�Z#d8d9�Z$d>d:d;�Z%dS)?rzUTF-8cCs@||_||_d|_|j|�|_|jjd�|_d|_|j�|_	dS)NF�rbr)
�host�port�_tls_established�_create_socket�sock�makefile�file�
_debugging�_getresp�welcome)�selfr
r�timeoutrrr�__init__asz
POP3.__init__cCstj|j|jf|�S)N)�socketZcreate_connectionr
r)rrrrrrkszPOP3._create_socketcCs,|jdkrtdt|��|jj|t�dS)N�z*put*)r�print�reprrZsendall�CRLF)r�linerrr�_putlinens
z
POP3._putlinecCs.|jrtdt|��t||j�}|j|�dS)Nz*cmd*)rrr�bytes�encodingr )rrrrr�_putcmduszPOP3._putcmdcCs�|jjtd�}t|�tkr$td��|jdkr<tdt|��|sHtd��t|�}|dd�tkrp|dd�|fS|dd�t	kr�|dd�|fS|dd	�|fS)
Nrz
line too longz*get*z-ERR EOF����r%���r&)
r�readline�_MAXLINE�lenrrrrr�CR)rr�octetsrrr�_getlines
z
POP3._getlinecCs:|j�\}}|jdkr$tdt|��|jd�s6t|��|S)Nrz*resp*�+)r,rrr�
startswithr)r�resp�orrrr�s

z
POP3._getrespcCsp|j�}g}d}|j�\}}xH|dkrd|jd�rD|d}|dd�}||}|j|�|j�\}}qW|||fS)Nr�.s..r)rr,r.�append)rr/�listr+rr0rrr�_getlongresp�s


zPOP3._getlongrespcCs|j|�|j�S)N)r#r)rrrrr�	_shortcmd�s
zPOP3._shortcmdcCs|j|�|j�S)N)r#r4)rrrrr�_longcmd�s
z
POP3._longcmdcCs|jS)N)r)rrrr�
getwelcome�szPOP3.getwelcomecCs
||_dS)N)r)r�levelrrr�set_debuglevel�szPOP3.set_debuglevelcCs|jd|�S)NzUSER %s)r5)r�userrrrr:�sz	POP3.usercCs|jd|�S)NzPASS %s)r5)rZpswdrrr�pass_�sz
POP3.pass_cCsF|jd�}|j�}|jr&tdt|��t|d�}t|d�}||fS)NZSTATz*stat*rr$)r5�splitrrr�int)rZretvalZretsZnumMessagesZsizeMessagesrrr�stat�s
z	POP3.statNcCs |dk	r|jd|�S|jd�S)NzLIST %sZLIST)r5r6)r�whichrrrr3�s	z	POP3.listcCs|jd|�S)NzRETR %s)r6)rr?rrr�retr�sz	POP3.retrcCs|jd|�S)NzDELE %s)r5)rr?rrr�dele�sz	POP3.delecCs
|jd�S)NZNOOP)r5)rrrr�noopsz	POP3.noopcCs
|jd�S)NZRSET)r5)rrrr�rsetsz	POP3.rsetcCs|jd�}|j�|S)NZQUIT)r5�close)rr/rrr�quits
z	POP3.quitcCs�z |j}d|_|dk	r|j�Wd|j}d|_|dk	r�zVy|jtj�Wn@tk
r�}z$|jtjkrxt	|dd�dkrx�WYdd}~XnXWd|j�XXdS)NZwinerrorri&')
rrDrZshutdownrZ	SHUT_RDWR�OSError�errnoZENOTCONN�getattr)rrr�excrrrrDsz
POP3.closecCs|jd|�S)NzRPOP %s)r5)rr:rrr�rpop2sz	POP3.rpops\+OK.[^<]*(<.*>)cCs\t||j�}|jj|j�}|s&td��ddl}|jd�|}|j|�j	�}|j
d||f�S)Nz!-ERR APOP not supported by serverrrz
APOP %s %s)r!r"�	timestamp�matchrr�hashlib�groupZmd5Z	hexdigestr5)rr:ZpasswordZsecret�mrMZdigestrrr�apop9sz	POP3.apopcCs|jd||f�S)Nz	TOP %s %s)r6)rr?Zhowmuchrrr�topNszPOP3.topcCs |dk	r|jd|�S|jd�S)NzUIDL %sZUIDL)r5r6)rr?rrr�uidlWsz	POP3.uidlcCs
|jd�S)NZUTF8)r5)rrrr�utf8csz	POP3.utf8c	Cstdd�}i}y8|jd�}|d}x |D]}||�\}}|||<q&WWn*tk
rn}ztd��WYdd}~XnX|S)NcSs"|jd�j�}|d|dd�fS)N�asciirr)�decoder<)rZlstrrr�	_parsecapvszPOP3.capa.<locals>._parsecapZCAPArz!-ERR CAPA not supported by server)r6r)	rrV�capsr/ZrawcapsZcaplineZcapnmZcapargsZ_errrrr�capais


z	POP3.capacCsxtstd��|jrtd��|j�}d|kr2td��|dkrBtj�}|jd�}|j|j|j	d�|_|jj
d�|_d|_|S)Nz-ERR TLS support missingz$-ERR TLS session already establishedZSTLSz!-ERR STLS not supported by server)�server_hostnamerT)�HAVE_SSLrrrX�ssl�_create_stdlib_contextr5�wrap_socketrr
rr)r�contextrWr/rrr�stls�s
z	POP3.stls)N)N)N)&rrrr"�	POP3_PORTr�_GLOBAL_DEFAULT_TIMEOUTrrr r#r,rr4r5r6r7r9r:r;r>r3r@rArBrCrErDrJ�re�compilerKrPrQrRrSrXr_rrrrr2s>-	




	
c@s4eZdZeddejdfdd�Zdd�Zddd�ZdS)	�POP3_SSLNcCs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}|jdtd�||_||_|dkrxtj||d�}||_t	j
||||�dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadr$)�certfile�keyfile)�
ValueError�warnings�warn�DeprecationWarningrfrer[r\r^rr)rr
rrfrerr^rhrrrr�szPOP3_SSL.__init__cCs"tj||�}|jj||jd�}|S)N)rY)rrr^r]r
)rrrrrrr�s
zPOP3_SSL._create_socketcCstd��dS)Nz$-ERR TLS session already established)r)rrfrer^rrrr_�sz
POP3_SSL.stls)NNN)	rrr�
POP3_SSL_PORTrrarrr_rrrrrd�srd�__main__rr$�zMessage %d:z   z-----------------------)&rGrbrr[rZ�ImportError�__all__�	Exceptionrr`rkr*ZLFrr(rrdr2r�sys�argv�arr7r:r;r3r>ZnumMsgsZ	totalSize�range�ir@�header�msgr+rrErrrr�<module>sH
l0


webbrowser.cpython-36.opt-1.pyc000064400000036626150335715140012333 0ustar003


 \U�@s�dZddlZddlZddlZddlZddlZddddddgZGd	d�de�ZiZ	gZ
dOdd�ZdPdd�ZdQdd�Z
dd�Zdd�ZdRdd�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd �d e�ZGd!d"�d"e�ZeZGd#d$�d$e�ZGd%d&�d&e�ZGd'd(�d(e�ZGd)d*�d*e�Zd+d,�Zej jd-��rle�ej jd.��rej!d/��r�ed/ded/��ej!d0��r�ed0ded0��ej!d1��r�ed1ded1��ej!d2��r�ed2ded2��ej!d3��red3ded3��ej"dd4�d5k�r�Gd6d7�d7e�Z#gZ
iZ	ed8e#�ej$j%ej jd9d:�d;�Z&x8d<d=d>d?d@dAe&fD]"Z'ej!e'��rhee'dee'���qhWej"dBk�rGdCdD�dDe�Z(GdEdF�dFe�Z)edGde)dG�dS�ed<de)d<�dT�edHde)dH�dU�edDde)dI�dV�dJej k�rtej dJj*ej+�Z,e,j-�xBe,D]:Z.e.dKk�r.ee.dW�Z/e/d
dk�r.ee.dee.�dX��q.WdZ.[.[,dLdM�Z0e1dNk�r�e0�dS)Yz?Interfaces for launching and remotely controlling Web browsers.�N�Error�open�open_new�open_new_tab�get�registerc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�"/usr/lib64/python3.6/webbrowser.pyr
s�cCs<||gt|j�<|dkr$tj|�n|dkr8tjd|�dS)z9Register a browser connector and, optionally, connection.rN)�	_browsers�lower�	_tryorder�append�insert)�name�klass�instance�update_tryorderrrrrs
cCs�|dk	r|g}nt}x�|D]�}d|krVtj|�}|ddkrLt|dd��St|�Sqyt|j�}Wntk
r�t|�}YnX|ddk	r�|dS|ddk	r|d�SqWt	d��dS)	zCReturn a browser launcher instance appropriate for the environment.Nz%sr
�&rz!could not locate runnable browser���r)
r�shlex�split�BackgroundBrowser�GenericBrowserrr�KeyError�_synthesizer)ZusingZalternatives�browser�commandrrrrs$


TcCs,x&tD]}t|�}|j|||�rdSqWdS)NTF)rrr)�url�new�	autoraiserrrrrr9s

cCs
t|d�S)Nr
)r)r!rrrr@scCs
t|d�S)N�)r)r!rrrrCsc
Cs�|j�d}tj|�sddgStjj|�}yt|j�}Wntk
rRddgSX|d}|r�|j�|jkr�ddl	}|j	|�}||_
tjj|�|_t|d||�d|gSddgS)a�Attempt to synthesize a controller base on existing controllers.

    This is useful to create a controller when a user specifies a path to
    an entry in the BROWSER environment variable -- we can copy a general
    controller to operate using a specific installation of the desired
    browser in this way.

    If we can't create a controller in this way, or if there is no
    executable for the requested browser, return [None, None].

    rNr
)r�shutil�which�os�path�basenamerrr�copyrr)rr�cmdrr Z
controllerr*rrrrGs"


rc@s:eZdZdZdgZddd�Zddd	�Zd
d�Zdd
�ZdS)�BaseBrowserz3Parent class for all browsers. Do not use directly.z%s�cCs||_||_dS)N)rr))�selfrrrr�__init__nszBaseBrowser.__init__rTcCst�dS)N)�NotImplementedError)r.r!r"r#rrrrrszBaseBrowser.opencCs|j|d�S)Nr
)r)r.r!rrrruszBaseBrowser.open_newcCs|j|d�S)Nr$)r)r.r!rrrrxszBaseBrowser.open_new_tabN)r-)rT)	rr	r
�__doc__�argsr/rrrrrrrr,is

r,c@s"eZdZdZdd�Zd	dd�ZdS)
rzVClass for all browsers started with a command
       and without remote functionality.cCsFt|t�r||_dg|_n|d|_|dd�|_tjj|j�|_dS)Nz%srr
)�
isinstance�strrr2r'r(r))r.rrrrr/�s


zGenericBrowser.__init__rTcsl|jg�fdd�|jD�}y6tjdd�dkr<tj|�}ntj|dd�}|j�Stk
rfdSXdS)Ncsg|]}|jd���qS)z%s)�replace)�.0�arg)r!rr�
<listcomp>�sz'GenericBrowser.open.<locals>.<listcomp>��winT)�	close_fdsF)rr2�sys�platform�
subprocess�Popen�wait�OSError)r.r!r"r#�cmdline�pr)r!rr�s
zGenericBrowser.openN)rT)rr	r
r1r/rrrrrr|s
rc@seZdZdZddd�ZdS)rzHClass for all browsers which are to be started in the
       background.rTcsp|jg�fdd�|jD�}y:tjdd�dkr<tj|�}ntj|ddd�}|j�dkStk
rjdSXdS)Ncsg|]}|jd���qS)z%s)r5)r6r7)r!rrr8�sz*BackgroundBrowser.open.<locals>.<listcomp>r9r:T)r;�start_new_sessionF)rr2r<r=r>r?�pollrA)r.r!r"r#rBrCr)r!rr�szBackgroundBrowser.openN)rT)rr	r
r1rrrrrr�src@sBeZdZdZdZdZdZddgZdZdZ	dZ
dd�Zdd
d�ZdS)
�UnixBrowserz=Parent class for all Unix browsers with remote functionality.NFTz%actionz%sc
Cs�g}|r*|jr*t|�}|j|}|r*|g}|jg||}|sD|jrLtj}nd}tj|d||jrd|pfd|dd�}|r�y|jd�}	|	Stj	k
r�dSXn&|jr�|j
�dkr�dSdSn
|j�SdS)NT)r;�stdin�stdout�stderrrD�F)�
raise_opts�intr�
backgroundr>�DEVNULLr?�redirect_stdoutr@ZTimeoutExpiredrE)
r.r2Zremoter#Z	raise_opt�optrBZinoutrC�rcrrr�_invoke�s0





zUnixBrowser._invokercs�|dkr|j�nB|dkr |j�n2|dkrB|jdkr:|j�qR|j�ntdd|����fdd�|jD�}dd�|D�}|j|d	|�}|s��fd
d�|jD�}|j|dd�Sd	SdS)Nrr
r$zBad 'new' parameter to open(); zexpected 0, 1, or 2, got %scs g|]}|jd��jd���qS)z%sz%action)r5)r6r7)�actionr!rrr8�sz$UnixBrowser.open.<locals>.<listcomp>cSsg|]}|r|�qSrr)r6r7rrrr8�sTcsg|]}|jd���qS)z%s)r5)r6r7)r!rrr8�sF)�
remote_action�remote_action_newwin�remote_action_newtabr�remote_argsrRr2)r.r!r"r#r2Zsuccessr)rSr!rr�s$

zUnixBrowser.open)rT)
rr	r
r1rKrMrOrWrTrUrVrRrrrrrrF�s#rFc@s(eZdZdZddgZdZdZdZdZdS)	�Mozillaz$Launcher class for Mozilla browsers.z%actionz%sr-z-new-windowz-new-tabTN)	rr	r
r1rWrTrUrVrMrrrrrX�srXc@s0eZdZdZddgZddgZdZdZdZd	Z	d
S)�Netscapez$Launcher class for Netscape browser.z-noraisez-raisez-remotezopenURL(%s%action)r-z,new-windowz,new-tabTN)
rr	r
r1rKrWrTrUrVrMrrrrrYsrYc@s,eZdZdZddgZddgZdZdZdZd	S)
�Galeonz,Launcher class for Galeon/Epiphany browsers.z-noraiser-z%actionz%sz-nz-wTN)	rr	r
r1rKrWrTrUrMrrrrrZsrZc@s(eZdZdZddgZdZdZdZdZdS)�Chromez)Launcher class for Google Chrome browser.z%actionz%sr-z--new-windowTN)	rr	r
r1rWrTrUrVrMrrrrr[sr[c@s(eZdZdZddgZdZdZdZdZdS)�Operaz!Launcher class for Opera browser.z%actionz%sr-z--new-windowTN)	rr	r
r1rWrTrUrVrMrrrrr\"sr\c@s,eZdZdZddgZdZdZdZdZdZ	dS)	�Elinksz#Launcher class for Elinks browsers.z-remotezopenURL(%s%action)r-z,new-windowz,new-tabFN)
rr	r
r1rWrTrUrVrMrOrrrrr],sr]c@seZdZdZddd�ZdS)�	Konquerorz�Controller for the KDE File Manager (kfm, or Konqueror).

    See the output of ``kfmclient --commands``
    for more information on the Konqueror remote-control interface.
    rTcCs�|dkrd}nd}tj}ytjd||gd|||d�}Wntk
rJYnX|j�dSy tjdd|gd|||dd	�}Wntk
r�YnX|j�dkr�dSy tjd
d|gd|||dd	�}Wntk
r�dSX|j�dkSdS)
Nr$ZnewTabZopenURL�	kfmclientT)r;rGrHrI�	konquerorz--silent)r;rGrHrIrD�kfmz-dF)r>rNr?rAr@rE)r.r!r"r#rS�devnullrCrrrrAs:zKonqueror.openN)rT)rr	r
r1rrrrrr^:sr^c@s&eZdZdd�Zdd�Zd
dd�Zd	S)�GrailcCs�ddl}ddl}ddl}ddl}tjj|j�d�}|jtj	��d}tjj||d�}|j|�}|shdS|j|j
|j�}	xX|D]P}
y|	j|
�Wn8t
k
r�ytj|
�Wnt
k
r�YnXYq~X|	Sq~WdS)Nrz.grail-unixz-*)�glob�pwd�socket�tempfiler'r(�joinZ
gettempdir�getpwuid�getuidZAF_UNIXZSOCK_STREAMZconnectrA�unlink)r.rdrerfrgZtempdir�user�filenameZmaybes�s�fnrrr�_find_grail_rcrs*

zGrail._find_grail_rccCs&|j�}|sdS|j|�|j�dS)Nrr
)rp�send�close)r.rSrnrrr�_remote�s
z
Grail._remoterTcCs&|r|jd|�}n|jd|�}|S)NzLOADNEW zLOAD )rs)r.r!r"r#�okrrrr�sz
Grail.openN)rT)rr	r
rprsrrrrrrcnsrccCs�tjd�rtddtd��dtjkr>tjd�r>tddtd��dtjkrbtjd�rbtddtd��dtjkr�tjd�r�tdttd��tjd�r�tddtd��x&dD]}tj|�r�t|dt|��q�Wx&dD]}tj|�r�t|dt|��q�Wtjd��rtdttd��ntjd��r*tdttd��x*dD]"}tj|��r0t|dt	|���q0Wtjd��rrtddtd��x*d D]"}tj|��rxt|dt
|���qxWtjd��r�tddtd��tjd��r�tddtd��tjd��r�tdtd�dS)!Nzxdg-openZGNOME_DESKTOP_SESSION_IDz	gvfs-openz
gnome-openZKDE_FULL_SESSIONr_z
x-www-browser�firefox�	iceweasel�iceape�	seamonkey�mozilla-firefox�mozilla-firebird�firebird�mozilla�netscaperar`�galeon�epiphanyZ	skipstone�
google-chrome�chrome�chromium�chromium-browser�operaZmosaicZgrail)rurvrwrx)ryrzr{r|r})r~r)r�r�r�r�)
r%r&rrr'�environr^rXrYrZr[r\rc)rrrr�register_X_browsers�sH






r�ZDISPLAYZTERMzwww-browserZlinksZelinksZlynxZw3mr9r:c@seZdZddd�ZdS)�WindowsDefaultrTcCs,ytj|�Wntk
r"dSXdSdS)NFT)r'Z	startfilerA)r.r!r"r#rrrr�s
zWindowsDefault.openN)rT)rr	r
rrrrrr��sr�zwindows-defaultZPROGRAMFILESzC:\Program FileszInternet Explorer\IEXPLORE.EXErur{rxr|r}r��darwinc@s"eZdZdZdd�Zd	dd�ZdS)
�MacOSXa{Launcher class for Aqua browsers on Mac OS X

        Optionally specify a browser name on instantiation.  Note that this
        will not work for Aqua browsers if the user has moved the application
        package after installation.

        If no browser is specified, the default browser, as specified in the
        Internet System Preferences panel, will be used.
        cCs
||_dS)N)r)r.rrrrr/&szMacOSX.__init__rTc	Cs�d|krd|}tt|��}|jdkr8d|jdd�}n<|jdkrHd}nd	|d
}d|jdd�}d|j||f}tjd
d�}|dkr�dS|j|�|j�}|S)N�:zfile:�defaultzopen location "%s"�"z%22ZOmniWebr-ztoWindow %dr
zOpenURL "%s"z�tell application "%s"
                                activate
                                %s %s
                            end tell�	osascript�wF)rL�boolrr5r'�popen�writerr)	r.r!r"r#�scriptZtoWindowr+�osapiperQrrrr)s 


zMacOSX.openN)rT)rr	r
r1r/rrrrrr�s	r�c@seZdZdd�Zddd�ZdS)	�MacOSXOSAScriptcCs
||_dS)N)�_name)r.rrrrr/KszMacOSXOSAScript.__init__rTcCsb|jdkrd|jdd�}nd|j|jdd�f}tjdd�}|dkrJdS|j|�|j�}|S)	Nr�zopen location "%s"r�z%22z�
                   tell application "%s"
                       activate
                       open location "%s"
                   end
                   r�r�F)r�r5r'r�r�rr)r.r!r"r#r�r�rQrrrrNs

zMacOSXOSAScript.openN)rT)rr	r
r/rrrrrr�Jsr�Zsafarir�r�ZBROWSERr-c	Cs�ddl}dtjd}y|jtjdd�d�\}}WnJ|jk
r~}z,t|tjd�t|tjd�tjd�WYdd}~XnXd}x*|D]"\}}|dkr�d}q�|dkr�d}q�Wt|�dkr�t|tjd�tjd�|d}t||�td	�dS)
NrzDUsage: %s [-n | -t] url
    -n: open new window
    -t: open new tabr
Zntd)�filez-nz-tr$�)	�getoptr<�argv�error�printrI�exit�lenr)	r�ZusageZoptsr2�msgZnew_win�o�ar!rrr�main~s(

r��__main__)Nr
)N)rT)r
rrrrrr)2r1r'rr%r<r>�__all__�	Exceptionrrrrrrrrr�objectr,rrrFrXrYrZr[ZChromiumr\r]r^rcr�r�r&r=r�r(rhZiexplorerr�r�r�pathsepZ_userchoices�reverserBr+r�rrrrr�<module>s�



"N

	
45B

.



datetime.cpython-36.opt-2.pyc000064400000126262150335715140011743 0ustar003


 \r@�
@s ddlZddlZddlZdd�ZdZdZdZd]dddd	dd	ddd	dd	dg
Z	d^gZ
dZx&e	dd�D]Ze
j
e�ee7ZqbW[[d
d�Zdd
�Zdd�Zdd�Zdd�Zed�Zed�Zed�Zdd�Zddddddddd d!d"d#d$g
Zdd%d&d'd(d)d*d+gZd,d-�Zd_d/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#GdCdD�dD�Z$e$d`�e$_%e$dEdFdGdGdHdI�e$_&e$ddJ�e$_'GdKdL�dL�Z(e(Z)e(ddd�e(_%e(ddMd�e(_&e$ddN�e(_'GdOdP�dP�Z*e*Z+GdQdR�dR�ZeZ,eddd�e_%edFdGdGdH�e_&e$ddJ�e_'GdSdT�dTe(�Z-e-ddd�e-_%e-ddMddFdGdGdH�e-_&e$ddJ�e-_'dUdV�Z.GdWdX�dXe*�Z/e/j0e$d��e/_1e/j0e/j2�e/_%e/j0e/j3�e/_&e-dYdde/j1dZ�Z4ydd[l5TWne6k
�r�YnPX[[
[	[[[[4[[[[[[ [![[[["[)[[[[[[.[[[[,[+[[[#dd\l5m7Z7dS)a�NcCs||krdS||krdSdS)Nr�����)�x�yrr� /usr/lib64/python3.6/datetime.py�_cmpsrri'i۹7���cCs$|ddko"|ddkp"|ddkS)N�r�di�r)�yearrrr�_is_leap%srcCs(|d}|d|d|d|dS)Nrimrr
i�r)rrrrr�_days_before_year)srcCs|dkrt|�rdSt|S)N��)r�_DAYS_IN_MONTH)r�monthrrr�_days_in_month.srcCst||dkot|�S)Nr)�_DAYS_BEFORE_MONTHr)rrrrr�_days_before_month5srcCs t||�}t|�t||�|S)N)rrr)rr�day�dimrrr�_ymd2ord:s
ri��e�c	Cs�|d8}t|t�\}}|dd}t|t�\}}t|t�\}}t|d�\}}||d|d|7}|dkst|dkr�|dddfS|dko�|d	kp�|dk}|d
d?}t||dko�|}||kr�|d8}|t||dko�|8}||8}|||dfS)
Nri�imr
r�r	���2rr)�divmod�_DI400Y�_DI100Y�_DI4Yrr)	�nZn400rZn100Zn4Zn1ZleapyearrZ	precedingrrr�_ord2ymdSs"r&ZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecZMonZTueZWedZThuZFriZSatZSunc	
Cs>t|||�dd}t||�|}tj|||||||||f	�S)N��)rr�_timeZstruct_time)	r�m�d�hh�mm�ssZdstflagZwdayZdnumrrr�_build_struct_time�sr/�autoc
Cstdddddd�}|dkr&|r dnd	}n|d
kr6|d}y||}Wntk
r^td��YnX|j||||�SdS)
Nz{:02d}z
{:02d}:{:02d}z{:02d}:{:02d}:{:02d}z{:02d}:{:02d}:{:02d}.{:03d}z{:02d}:{:02d}:{:02d}.{:06d})�hours�minutes�seconds�milliseconds�microsecondsr0r5r3r4i�zUnknown timespec value)�KeyError�
ValueError�format)r,r-r.�us�timespecZspecs�fmtrrr�_format_time�sr<cCs�d}d}d}g}|j}dt|�}}	�xj||	k�r�||}
|d7}|
dk�r�||	k�r|||}
|d7}|
dkr�|dkr�dt|dd�}|j|�n�|
dk�r|dk�rd}t|d	��r|j�}|dk	�rd
}|jdkr�|}d}t|tdd��\}
}|tdd
�}d||
|f}|j|�n^|
dk�rj|dk�r^d}t|d��r^|j�}|dk	�r^|j	dd�}|j|�n|d�||
�n|d�q(||
�q(Wdj
|�}tj||�S)Nrr�%�fz%06d�microsecond�z��	utcoffset�+�-)r1)r2z
%c%02d%02d�Z�tznamez%%)
�append�len�getattr�hasattrrB�daysr!�	timedeltarF�replace�joinr)�strftime)�objectr8�	timetupleZfreplaceZzreplaceZZreplaceZ	newformat�push�ir%Zch�offset�sign�hr*�srrr�_wrap_strftime�s\












rXcCs(|dk	r$t|t�r$tdt|���dS)Nz4tzinfo.tzname() must return None or string, not '%s')�
isinstance�str�	TypeError�type)�namerrr�
_check_tzname�sr^cCsv|dkrdSt|t�s*td|t|�f��|jr@td||f��td�|ko\td�knsrtd||f��dS)Nz3tzinfo.%s() must return None or timedelta, not '%s'z9tzinfo.%s() must return a whole number of seconds, got %srzN%s()=%s, must be strictly between -timedelta(hours=24) and timedelta(hours=24))rYrLr[r\r5r7)r]rTrrr�_check_utc_offset�s
"r_cCsxt|t�r|St|t�sly|j�}Wntk
r8Yn"Xt|t�rH|Stdt|�j��tdt|�j��td��dS)Nz"__int__ returned non-int (type %s)z$an integer is required (got type %s)z$integer argument expected, got float)rY�int�float�__int__�AttributeErrorr[r\�__name__)�valuerrr�_check_int_fields


rfcCs�t|�}t|�}t|�}t|ko*tknsBtdttf|��d|koTdknsdtd|��t||�}d|ko�|kns�td||��|||fS)Nzyear must be in %d..%drrzmonth must be in 1..12zday must be in 1..%d)rf�MINYEAR�MAXYEARr7r)rrrrrrr�_check_date_fieldss

ricCs�t|�}t|�}t|�}t|�}d|ko2dknsBtd|��d|koTdknsdtd|��d|kovdkns�td|��d|ko�dkns�td|��|dkr�td
|��|||||fS)Nr�zhour must be in 0..23�;zminute must be in 0..59zsecond must be in 0..59i?Bz microsecond must be in 0..999999rzfold must be either 0 or 1)rr)rfr7)�hour�minute�secondr?�foldrrr�_check_time_fields$s




rpcCs |dk	rt|t�rtd��dS)Nz4tzinfo argument must be None or of a tzinfo subclass)rY�tzinfor[)�tzrrr�_check_tzinfo_arg5srscCs tdt|�jt|�jf��dS)Nzcan't compare '%s' to '%s')r[r\rd)rrrrr�	_cmperror9srtcCsRt||�\}}|d9}|dkr&||kn||k}|sF||krN|ddkrN|d7}|S)Nrrr)r!)�a�b�q�rZgreater_than_halfrrr�_divide_and_round=sryc@seZdZdAZdBdd�Zdd	�Zd
d�Zdd
�Zedd��Z	edd��Z
edd��Zdd�ZeZ
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�ZeZd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Z d:d;�Z!d<d=�Z"d>d?�Z#d@S)CrL�_days�_seconds�
_microseconds�	_hashcodercCs�d}}	}
||d7}||d|d7}||d7}t|t�rttj|�\}}tj|d�\}}
t|
�}	t|�}nd}|}t|t�r�tj|�\}}t|�}||7}n|}t|d�\}}||7}|	t|�7}	|d
}t|t��rt||�}t|d�\}}t|d�\}}||7}|	|7}	n@t|�}t|d�\}}t|d�\}}||7}|	|7}	t||�}t|d�\}}
|	|7}	t|	d�\}}	||7}t|�dk�r�td
|��t	j
|�}||_|	|_|
|_
d|_|S)Nrr(�<ii�g8@g �@grg��.Ai@Bi�ɚ;z$timedelta # of days is too large: %drg�@i�Qi�Qi�Qi�Qr)rYra�_math�modfr`r!�round�abs�
OverflowErrorrP�__new__rzr{r|r})�clsrKr3r5r4r2r1Zweeksr+rWr9ZdayfracZdaysecondsfracZdaysecondswholeZsecondsfracZusdouble�selfrrrr�dsZ




ztimedelta.__new__cCs`|jr&d|jj|jj|j|j|jfS|jrHd|jj|jj|j|jfSd|jj|jj|jfS)Nz%s.%s(%d, %d, %d)z
%s.%s(%d, %d)z	%s.%s(%d))r|�	__class__�
__module__�__qualname__rzr{)r�rrr�__repr__�s

ztimedelta.__repr__cCsdt|jd�\}}t|d�\}}d|||f}|jrLdd�}d||j�|}|jr`|d|j}|S)Nr~z%d:%02d:%02dcSs|t|�dkrdpdfS)NrrWrA)r�)r%rrr�plural�sz!timedelta.__str__.<locals>.pluralz
%d day%s, z.%06d)r!r{rzr|)r�r-r.r,rWr�rrr�__str__�sztimedelta.__str__cCs|jd|jd|jdS)Ni�Q�
r'i@Bi@B)rKr3r5)r�rrr�
total_seconds�sztimedelta.total_secondscCs|jS)N)rz)r�rrrrK�sztimedelta.dayscCs|jS)N)r{)r�rrrr3�sztimedelta.secondscCs|jS)N)r|)r�rrrr5�sztimedelta.microsecondscCs2t|t�r.t|j|j|j|j|j|j�StS)N)rYrLrzr{r|�NotImplemented)r��otherrrr�__add__�s


ztimedelta.__add__cCs2t|t�r.t|j|j|j|j|j|j�StS)N)rYrLrzr{r|r�)r�r�rrr�__sub__s


ztimedelta.__sub__cCst|t�r||StS)N)rYrLr�)r�r�rrr�__rsub__s

ztimedelta.__rsub__cCst|j|j|j�S)N)rLrzr{r|)r�rrr�__neg__sztimedelta.__neg__cCs|S)Nr)r�rrr�__pos__sztimedelta.__pos__cCs|jdkr|S|SdS)Nr)rz)r�rrr�__abs__s
ztimedelta.__abs__cCs`t|t�r(t|j||j||j|�St|t�r\|j�}|j�\}}tddt	|||��St
S)Nr)rYr`rLrzr{r|ra�_to_microseconds�as_integer_ratioryr�)r�r��usecrurvrrr�__mul__#s


ztimedelta.__mul__cCs|jd|jd|jS)Nrii@Bi�Q)rzr{r|)r�rrrr�2sztimedelta._to_microsecondscCsNt|ttf�stS|j�}t|t�r0||j�St|t�rJtdd||�SdS)Nr)rYr`rLr�r�)r�r�r�rrr�__floordiv__6s

ztimedelta.__floordiv__cCs~t|tttf�stS|j�}t|t�r2||j�St|t�rNtddt||��St|t�rz|j�\}}tddt|||��SdS)Nr)rYr`rarLr�r�ryr�)r�r�r�rurvrrr�__truediv__?s


ztimedelta.__truediv__cCs*t|t�r&|j�|j�}tdd|�StS)Nr)rYrLr�r�)r�r�rxrrr�__mod__Ks
ztimedelta.__mod__cCs4t|t�r0t|j�|j��\}}|tdd|�fStS)Nr)rYrLr!r�r�)r�r�rwrxrrr�
__divmod__Qs

ztimedelta.__divmod__cCs t|t�r|j|�dkSdSdS)NrF)rYrLr)r�r�rrr�__eq__Zs
ztimedelta.__eq__cCs&t|t�r|j|�dkSt||�dS)Nr)rYrLrrt)r�r�rrr�__le__`s
ztimedelta.__le__cCs&t|t�r|j|�dkSt||�dS)Nr)rYrLrrt)r�r�rrr�__lt__fs
ztimedelta.__lt__cCs&t|t�r|j|�dkSt||�dS)Nr)rYrLrrt)r�r�rrr�__ge__ls
ztimedelta.__ge__cCs&t|t�r|j|�dkSt||�dS)Nr)rYrLrrt)r�r�rrr�__gt__rs
ztimedelta.__gt__cCst|j�|j��S)N)r�	_getstate)r�r�rrrrxsztimedelta._cmpcCs|jdkrt|j��|_|jS)Nrr)r}�hashr�)r�rrr�__hash__|s
ztimedelta.__hash__cCs|jdkp|jdkp|jdkS)Nr)rzr{r|)r�rrr�__bool__�s

ztimedelta.__bool__cCs|j|j|jfS)N)rzr{r|)r�rrrr��sztimedelta._getstatecCs|j|j�fS)N)r�r�)r�rrr�
__reduce__�sztimedelta.__reduce__N)rzr{r|r})rrrrrrr)$rdr�r��	__slots__r�r�r�r��propertyrKr3r5r��__radd__r�r�r�r�r�r��__rmul__r�r�r�r�r�r�r�r�r�r�rr�r�r�r�rrrrrLQsB
d		
		rLi�ɚ;rjrki?B)rKr1r2r3r5)r5c@s$eZdZdBZdCdd�Zedd	��Zed
d��Zedd
��Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
e
Zedd��Zedd��Zedd��Zdd�Zd d!�ZdDd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�ZeZd4d5�Zd6d7�Z d8d9�Z!d:d;�Z"d<d=�Z#d>d?�Z$d@dA�Z%dS)E�date�_year�_month�_dayr}NcCs�|dkr�t|ttf�r�t|�dkr�dt|dd��ko@dknr�t|t�r|y|jd�}Wntk
rztd��YnXtj	|�}|j
|�d|_|St|||�\}}}tj	|�}||_
||_||_d	|_|S)
Nrrrrr�latin1znFailed to encode latin1 string when unpickling a date object. pickle.load(data, encoding='latin1') is assumed.rr)rY�bytesrZrH�ord�encode�UnicodeEncodeErrorr7rPr��_date__setstater}rir�r�r�)r�rrrr�rrrr��s($



zdate.__new__c	Cs(tj|�\	}}}}}}}}	}
||||�S)N)r)�	localtime)r��trr*r+r,r-r.�weekday�jday�dstrrr�
fromtimestamp�szdate.fromtimestampcCstj�}|j|�S)N)r)�timer�)r�r�rrr�today�sz
date.todaycCst|�\}}}||||�S)N)r&)r�r%rr*r+rrr�fromordinal�szdate.fromordinalcCs d|jj|jj|j|j|jfS)Nz%s.%s(%d, %d, %d))r�r�r�r�r�r�)r�rrrr��s
z
date.__repr__cCs.|j�dpd}dt|t|j|j|jfS)Nr(z%s %s %2d 00:00:00 %04d)�	toordinal�	_DAYNAMES�_MONTHNAMESr�r�r�)r�r�rrr�ctimes
z
date.ctimecCst|||j��S)N)rXrQ)r�r;rrrrO	sz
date.strftimecCs:t|t�stdt|�j��t|�dkr2|j|�St|�S)Nzmust be str, not %sr)rYrZr[r\rdrHrO)r�r;rrr�
__format__
s


zdate.__format__cCsd|j|j|jfS)Nz%04d-%02d-%02d)r�r�r�)r�rrr�	isoformats	zdate.isoformatcCs|jS)N)r�)r�rrrr"sz	date.yearcCs|jS)N)r�)r�rrrr'sz
date.monthcCs|jS)N)r�)r�rrrr,szdate.daycCst|j|j|jdddd�S)Nrrr)r/r�r�r�)r�rrrrQ4szdate.timetuplecCst|j|j|j�S)N)rr�r�r�)r�rrrr�9szdate.toordinalcCs:|dkr|j}|dkr|j}|dkr*|j}t|�|||�S)N)r�r�r�r\)r�rrrrrrrMAszdate.replacecCst|t�r|j|�dkStS)Nr)rYr�rr�)r�r�rrrr�Ms
zdate.__eq__cCst|t�r|j|�dkStS)Nr)rYr�rr�)r�r�rrrr�Rs
zdate.__le__cCst|t�r|j|�dkStS)Nr)rYr�rr�)r�r�rrrr�Ws
zdate.__lt__cCst|t�r|j|�dkStS)Nr)rYr�rr�)r�r�rrrr�\s
zdate.__ge__cCst|t�r|j|�dkStS)Nr)rYr�rr�)r�r�rrrr�as
zdate.__gt__cCsB|j|j|j}}}|j|j|j}}}t|||f|||f�S)N)r�r�r�r)r�r�rr*r+Zy2�m2Zd2rrrrfsz	date._cmpcCs|jdkrt|j��|_|jS)Nrr)r}r�r�)r�rrrr�ls
z
date.__hash__cCsFt|t�rB|j�|j}d|ko*tknr:tj|�Std��tS)Nrzresult out of range)	rYrLr�rK�_MAXORDINALr�r�r�r�)r�r��orrrr�ts

zdate.__add__cCsDt|t�r|t|j�St|t�r@|j�}|j�}t||�StS)N)rYrLrKr�r�r�)r�r��days1�days2rrrr�s

zdate.__sub__cCs|j�ddS)Nr'r()r�)r�rrrr��szdate.weekdaycCs|j�dpdS)Nr()r�)r�rrr�
isoweekday�szdate.isoweekdaycCs�|j}t|�}t|j|j|j�}t||d�\}}|dkr^|d8}t|�}t||d�\}}n$|dkr�|t|d�kr�|d7}d}||d|dfS)Nr(rr�4)r��_isoweek1mondayrr�r�r!)r�r�week1mondayr�Zweekrrrr�isocalendar�s
zdate.isocalendarcCs&t|jd�\}}t|||j|jg�fS)N�)r!r�r�r�r�)r��yhi�ylorrrr��szdate._getstatecCs"|\}}|_|_|d||_dS)Nr�)r�r�r�)r��stringr�r�rrr�
__setstate�szdate.__setstatecCs|j|j�fS)N)r�r�)r�rrrr��szdate.__reduce__)r�r�r�r})NN)NNN)&rdr�r�r�r��classmethodr�r�r�r�r�rOr�r�r�r�rrrrQr�rMr�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�rrrrr��sB
"
	
r�r)rKc@s8eZdZfZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)rqcCstd��dS)Nz&tzinfo subclass must override tzname())�NotImplementedError)r��dtrrrrF�sz
tzinfo.tznamecCstd��dS)Nz)tzinfo subclass must override utcoffset())r�)r�r�rrrrB�sztzinfo.utcoffsetcCstd��dS)Nz#tzinfo subclass must override dst())r�)r�r�rrrr��sz
tzinfo.dstcCs�t|t�std��|j|k	r$td��|j�}|dkr<td��|j�}|dkrTtd��||}|r�||7}|j�}|dkr�td��||S)Nz&fromutc() requires a datetime argumentzdt.tzinfo is not selfz0fromutc() requires a non-None utcoffset() resultz*fromutc() requires a non-None dst() resultz;fromutc(): dt.dst gave inconsistent results; cannot convert)rY�datetimer[rqr7rBr�)r�r�ZdtoffZdtdst�deltarrr�fromutc�s"

ztzinfo.fromutccCsft|dd�}|r|�}nf}t|dd�}|r4|�}nt|dd�pBd}|dkrV|j|fS|j||fSdS)N�__getinitargs__�__getstate__�__dict__)rIr�)r�Zgetinitargs�args�getstate�staterrrr��s
ztzinfo.__reduce__N)	rdr�r�r�rFrBr�r�r�rrrrrq�srqc@seZdZdFZdGdd
�dd�Zed
d��Zedd��Zedd��Zedd��Z	edd��Z
edd��Zdd�Zdd�Z
dd�Zdd �Zd!d"�ZdHd$d%�Zd&d'�ZdId)d*�Zd+d,�ZdJd.d/�ZeZd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�ZdKd	d
�d;d<�ZdLd>d?�Zd@dA�ZdBdC�ZdDdE�Z d	S)Mr��_hour�_minute�_second�_microsecond�_tzinfor}�_foldrN)rocCs�t|ttf�r�t|�dkr�t|dd��d@dkr�t|t�rhy|jd�}Wntk
rftd��YnXtj	|�}|j
||p~d�d|_|St|||||�\}}}}}t
|�tj	|�}||_||_||_||_||_d	|_||_|S)
Nr'rr�rr�znFailed to encode latin1 string when unpickling a time object. pickle.load(data, encoding='latin1') is assumed.rr)rYr�rZrHr�r�r�r7rPr��_time__setstater}rprsr�r�r�r�r�r�)r�rlrmrnr?rqror�rrrr�#s0



ztime.__new__cCs|jS)N)r�)r�rrrrlKsz	time.hourcCs|jS)N)r�)r�rrrrmPsztime.minutecCs|jS)N)r�)r�rrrrnUsztime.secondcCs|jS)N)r�)r�rrrr?Zsztime.microsecondcCs|jS)N)r�)r�rrrrq_sztime.tzinfocCs|jS)N)r�)r�rrrrodsz	time.foldcCs$t|t�r|j|dd�dkSdSdS)NT)�allow_mixedrF)rYr�r)r�r�rrrr�ls
ztime.__eq__cCs&t|t�r|j|�dkSt||�dS)Nr)rYr�rrt)r�r�rrrr�rs
ztime.__le__cCs&t|t�r|j|�dkSt||�dS)Nr)rYr�rrt)r�r�rrrr�xs
ztime.__lt__cCs&t|t�r|j|�dkSt||�dS)Nr)rYr�rrt)r�r�rrrr�~s
ztime.__ge__cCs&t|t�r|j|�dkSt||�dS)Nr)rYr�rrt)r�r�rrrr��s
ztime.__gt__Fc
Cs�|j}|j}d}}||kr"d}n|j�}|j�}||k}|rht|j|j|j|jf|j|j|j|jf�S|dksx|dkr�|r�dStd��|jd|j|tdd�}|jd|j|tdd�}	t||j|jf|	|j|jf�S)NTrz$cannot compare naive and aware timesr~r)r2)	r�rBrr�r�r�r�r[rL)
r�r�r��mytz�ottz�myoff�otoff�base_compareZmyhhmmZothhmmrrrr�s*
z	time._cmpcCs�|jdkr�|jr|jdd�}n|}|j�}|sBt|j�d�|_nztt|j|j	d�|tdd��\}}|tdd�}d|ko�dknr�tt
|||j|j��|_nt|||j|jf�|_|jS)	Nrr)ro)r1r2)r1)r2rr)
r}rorMrBr�r�r!rLrlrmr�rnr?)r�r��tzoffrVr*rrrr��s
z
time.__hash__�:cCsx|j�}|dk	rt|jdkr&d}|}nd}t|tdd��\}}t|tdd��\}}d||||f}|rt|d|j7}|S)	NrrDrCr)r1)r2z%s%02d%s%02dz:%02d)rBrKr!rLr3)r��sep�offrUr,r-r.rrr�_tzstr�s
ztime._tzstrcCs�|jdkrd|j|jf}n|jdkr2d|j}nd}d|jj|jj|j|j|f}|jdk	rx|dd
�d|jd}|jr�|dd�d	}|S)Nrz, %d, %dz, %drAz%s.%s(%d, %d%s)rz, tzinfo=%r�)z	, fold=1)rr)	r�r�r�r�r�r�r�r�r�)r�rWrrrr��s


z
time.__repr__r0cCs0t|j|j|j|j|�}|j�}|r,||7}|S)N)r<r�r�r�r�r�)r�r:rWrrrrrr��s	
ztime.isoformatc	Cs(ddd|j|j|jdddf	}t|||�S)Nilrrr)r�r�r�rX)r�r;rQrrrrO�s
z
time.strftimecCs:t|t�stdt|�j��t|�dkr2|j|�St|�S)Nzmust be str, not %sr)rYrZr[r\rdrHrO)r�r;rrrr��s


ztime.__format__cCs(|jdkrdS|jjd�}td|�|S)NrB)r�rBr_)r�rTrrrrBs


ztime.utcoffsetcCs&|jdkrdS|jjd�}t|�|S)N)r�rFr^)r�r]rrrrFs

ztime.tznamecCs(|jdkrdS|jjd�}td|�|S)Nr�)r�r�r_)r�rTrrrr�s
	

ztime.dstTcCsl|dkr|j}|dkr|j}|dkr*|j}|dkr8|j}|dkrF|j}|dkrT|j}t|�||||||d�S)NT)ro)rlrmrnr?rqr�r\)r�rlrmrnr?rqrorrrrM,sztime.replacercCspt|jd�\}}t|d�\}}|j}|jr:|dkr:|d7}t||j|j|||g�}|jdkrb|fS||jfSdS)Nr�r�)r!r�r�r�r�r�r�r�)r��protocol�us2�us3�us1rV�	basestaterrrr�?s
ztime._getstatecCsv|dk	rt|t�rtd��|\}|_|_}}}|dkrJd|_|d|_nd|_||_|d>|Bd>|B|_||_dS)Nzbad tzinfo state argr�rr�r�)	rY�
_tzinfo_classr[r�r�r�r�r�r�)r�r�rqrVr�r�r�rrrr�Lsztime.__setstatecCst|j|�fS)N)r�r�)r�r�rrr�
__reduce_ex__Ysztime.__reduce_ex__cCs
|jd�S)Nr)r�)r�rrrr�\sztime.__reduce__)r�r�r�r�r�r}r�)rrrrN)F)r�)r0)NNNNT)r)!rdr�r�r�r�r�rlrmrnr?rqror�r�r�r�r�rr�r�r�r�r�rOr�rBrFr�rMr�r�r�r�rrrrr�
s<(


		



r�c@s�eZdZejejZdadd�dd�Zedd��Zedd	��Z	ed
d��Z
edd
��Zedd��Zedd��Z
edd��Zedbdd��Zedd��Zedcdd��Zedd��Zedddd��Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zdedd�d-d.�Zd/d0�Zdfd1d2�Zd3d4�Zdgd7d8�Zd9d:�Zd;d<�Z ed=d>��Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dhdPdQ�Z*dRdS�Z+e+Z,dTdU�Z-dVdW�Z.didYdZ�Z/d[d\�Z0d]d^�Z1d_d`�Z2dS)jr�Nr)roc	Cst|ttf�r�t|�dkr�dt|dd��d@ko<dknr�t|t�rxyt|d�}Wntk
rvtd��YnXtj|�}
|
j	||�d	|
_
|
St|||�\}}}t|||||	�\}}}}}	t
|�tj|�}
||
_||
_||
_||
_||
_||
_||
_||
_d
|
_
|	|
_|
S)Nr�rrrr�rr�zrFailed to encode latin1 string when unpickling a datetime object. pickle.load(data, encoding='latin1') is assumed.rr)rYr�rZrHr�r�r7rPr��_datetime__setstater}rirprsr�r�r�r�r�r�r�r�r�)r�rrrrlrmrnr?rqror�rrrr�ms8(


zdatetime.__new__cCs|jS)N)r�)r�rrrrl�sz
datetime.hourcCs|jS)N)r�)r�rrrrm�szdatetime.minutecCs|jS)N)r�)r�rrrrn�szdatetime.secondcCs|jS)N)r�)r�rrrr?�szdatetime.microsecondcCs|jS)N)r�)r�rrrrq�szdatetime.tzinfocCs|jS)N)r�)r�rrrro�sz
datetime.foldc	Csptj|�\}}t|d�}|dkr4|d7}|d8}n|dkrL|d8}|d7}|rVtjntj}||�\	}}}	}
}}}
}}t|d�}||||	|
||||�}|dk�rbd
}||kr�tjj	d�r�|S|||�dd	�\}}}	}
}}||||	|
||||�}||t
d|�}|jdk�rl|||t
dd��dd	�\}}}	}
}}||||	|
||||�}||k�rld|_n
|j
|�}|S)Ng��.Ai@Brrrkri�winr'i�Q)rr�r�r)�gmtimer��min�sys�platform�
startswithrLrKr�r�)r�r��utcrrZfracr9Z	converterrr*r+r,r-r.r�r�r��result�max_fold_secondsZprobe1ZtransZprobe2rrr�_fromtimestamp�s4


 *

zdatetime._fromtimestampcCst|�|j||dk	|�S)N)rsr)r�r�rrrrrr��szdatetime.fromtimestampcCs|j|dd�S)NT)r)r�r�rrr�utcfromtimestamp�szdatetime.utcfromtimestampcCstj�}|j||�S)N)r)r�r�)r�rrr�rrr�now�szdatetime.nowcCstj�}|j|�S)N)r)r�r	)r�r�rrr�utcnow�szdatetime.utcnowTcCs\t|t�std��t|t�s$td��|dkr2|j}||j|j|j|j|j	|j
|j||jd�	S)Nz%date argument must be a date instancez%time argument must be a time instanceT)ro)
rY�_date_classr[�_time_classrqrrrrlrmrnr?ro)r�r�r�rqrrr�combine�s

zdatetime.combinecCsD|j�}|dkrd}n|r d}nd}t|j|j|j|j|j|j|�S)Nrrr)r�r/rrrrlrmrn)r�r�rrrrQszdatetime.timetuplec
s�tddd��d}|�tdd�}�fdd�}||�|}||}||�}||kr�|||f|j}||�|}||kr�|Sn||}||}||�}	|	|kr�|S||kr�|Sttf|j||�S)	Ni�rrircs>tj|�dd�\}}}}}}t||||||��tdd�S)Nr'rr)r)r�r�rL)�urr*r+r,r-r.)�epochrr�localszdatetime._mktime.<locals>.locali�Q)r�rLro�maxr)
r�rr�rruZu1Zt1Zu2rvZt2r)rr�_mktimes(zdatetime._mktimecCs0|jdkr |j�}||jdS|tj�SdS)Ng��.A)r�rr?�_EPOCHr�)r�rWrrr�	timestamp2s
zdatetime.timestampcCsT|j�}|r||8}|j|j|j}}}|j|j|j}}}t||||||d�S)Nr)rBrrrrlrmrnr/)r�rTrr*r+r,r-r.rrr�utctimetuple:szdatetime.utctimetuplecCst|j|j|j�S)N)r�r�r�r�)r�rrrr�Csz
datetime.datecCst|j|j|j|j|jd�S)N)ro)r�rlrmrnr?ro)r�rrrr�Gsz
datetime.timecCs t|j|j|j|j|j|jd�S)N)ro)r�rlrmrnr?r�ro)r�rrr�timetzKszdatetime.timetzc	
Cs�|dkr|j}|dkr|j}|dkr*|j}|dkr8|j}|dkrF|j}|dkrT|j}|dkrb|j}|dkrp|j}|	dkr~|j}	t	|�|||||||||	d�	S)NT)ro)
rrrrlrmrnr?rqror\)
r�rrrrlrmrnr?rqrorrrrMPs(zdatetime.replacecCs�|jdkr|j�}n|ttdd�}tj|�}t|dd��}y|j}|j}WnDt	k
r�|ttj
|�dd��}tjd|�}t||�}YnXtt|d�|�}|S)Nr)r3r'z%Z)
rqrrrLr)r�r�Z	tm_gmtoffZtm_zonercrrO�timezone)r�ZtsZlocaltmrZgmtoffZzoner�rrrrr�_local_timezoneis



zdatetime._local_timezonecCs�|dkr|j�}nt|t�s$td��|j}|dkrF|j�}|j|�}n,|j|�}|dkrr|jdd�j�}|j|�}||kr~|S||j|d�}|j|�S)Nz)tz argument must be an instance of tzinfo)rq)rrYrqr[rBrMr�)r�rrr�Zmyoffsetrrrr�
astimezone|s 



zdatetime.astimezonecCs:|j�dpd}dt|t|j|j|j|j|j|jfS)Nr(z%s %s %2d %02d:%02d:%02d %04d)	r�r�r�r�r�r�r�r�r�)r�r�rrrr��szdatetime.ctime�Tr0c	Cs�d|j|j|j|ft|j|j|j|j|�}|j�}|dk	r�|j	dkrTd}|}nd}t
|tdd��\}}t
|tdd��\}}|d|||f7}|r�|d	|j7}|S)
Nz%04d-%02d-%02d%crrDrCr)r1)r2z%s%02d:%02dz:%02d)
r�r�r�r<r�r�r�r�rBrKr!rLr3)	r�r�r:rWr�rUr,r-r.rrrr��s
zdatetime.isoformatcCs�|j|j|j|j|j|j|jg}|ddkr2|d	=|d
dkrD|d=d|jj|jj	dj
tt|��f}|j
dk	r�|dd�d|j
d}|jr�|dd
�d}|S)Nrrz	%s.%s(%s)z, z, tzinfo=%rr�z	, fold=1)rrrrrr)r�r�r�r�r�r�r�r�r�r�rN�maprZr�r�)r��LrWrrrr��s
zdatetime.__repr__cCs|jdd�S)N� )r�)r�)r�rrrr��szdatetime.__str__cCsddl}|j|||�S)Nr)�	_strptimeZ_strptime_datetime)r�Zdate_stringr8rrrr�strptime�szdatetime.strptimecCs(|jdkrdS|jj|�}td|�|S)NrB)r�rBr_)r�rTrrrrB�s


zdatetime.utcoffsetcCs&|jdkrdS|jj|�}t|�|S)N)r�rFr^)r�r]rrrrF�s

zdatetime.tznamecCs(|jdkrdS|jj|�}td|�|S)Nr�)r�r�r_)r�rTrrrr��s
	

zdatetime.dstcCs2t|t�r|j|dd�dkSt|t�s*tSdSdS)NT)r�rF)rYr�rr�r�)r�r�rrrr�s


zdatetime.__eq__cCs4t|t�r|j|�dkSt|t�s&tSt||�dS)Nr)rYr�rr�r�rt)r�r�rrrr�s


zdatetime.__le__cCs4t|t�r|j|�dkSt|t�s&tSt||�dS)Nr)rYr�rr�r�rt)r�r�rrrr�s


zdatetime.__lt__cCs4t|t�r|j|�dkSt|t�s&tSt||�dS)Nr)rYr�rr�r�rt)r�r�rrrr�s


zdatetime.__ge__cCs4t|t�r|j|�dkSt|t�s&tSt||�dS)Nr)rYr�rr�r�rt)r�r�rrrr�'s


zdatetime.__gt__Fc		Cs|j}|j}d}}||kr"d}nT|j�}|j�}|rn||j|jd�j�krRdS||j|jd�j�krndS||k}|r�t|j|j|j|j|j	|j
|jf|j|j|j|j|j	|j
|jf�S|dks�|dkr�|r�dStd��||}|j
dkr�dS|o�d�p�dS)NT)rorz(cannot compare naive and aware datetimesrrr)r�rBrMrorr�r�r�r�r�r�r�r[rK)	r�r�r�r�r�r�r�r�Zdiffrrrr/s8

z
datetime._cmpc	Cs�t|t�stSt|j�|j|j|j|jd�}||7}t|j	d�\}}t|d�\}}d|j
koftknr�tj
tj|j
�t||||j|jd��Std��dS)N)r1r2r3r5ir~r)rqzresult out of range)rYrLr�r�r�r�r�r�r!r3rKr�r�rr�r�r�r5r�r�)r�r�r�rlZremrmrnrrrr�Ts 

zdatetime.__add__c	Cs�t|t�s"t|t�r||StS|j�}|j�}|j|jd|jd}|j|jd|jd}t|||||j|j�}|j	|j	kr�|S|j
�}|j
�}||kr�|S|dks�|dkr�td��|||S)Nr~iz(cannot mix naive and timezone-aware time)rYr�rLr�r�r�r�r�r�r�rBr[)	r�r�r�r�Zsecs1Zsecs2�baser�r�rrrr�is(


zdatetime.__sub__cCs�|jdkr�|jr|jdd�}n|}|j�}|dkrFt|j�d�|_nDt|j|j|j	�}|j
d|jd|j}tt
|||j�|�|_|jS)Nrr)roir~r)r}rorMrBr�r�rrrrrlrmrnrLr?)r�r�r�rKr3rrrr��s
zdatetime.__hash__rc	Cs�t|jd�\}}t|jd�\}}t|d�\}}|j}|jrJ|dkrJ|d7}t||||j|j|j|j	|||g
�}|j
dkr~|fS||j
fSdS)Nr�rr�)r!r�r�r�r�r�r�r�r�r�r�)	r�r�r�r�r�r�r�r*r�rrrr��s
zdatetime._getstatec	
Cs�|dk	rt|t�rtd��|\
}}}|_|_|_|_}}}|dkrVd|_|d|_nd|_||_|d||_	|d>|Bd>|B|_
||_dS)Nzbad tzinfo state argr�rr�rr�r�)rYr�r[r�r�r�r�r�r�r�r�r�)	r�r�rqr�r�r*r�r�r�rrrr��s zdatetime.__setstatecCs|j|j|�fS)N)r�r�)r�r�rrrr��szdatetime.__reduce_ex__cCs
|jd�S)Nr)r�)r�rrrr��szdatetime.__reduce__)NNrrrrN)N)N)T)NNNNNNNT)N)rr0)F)r)3rdr�r�r�r�r�r�r�rlrmrnr?rqror�rr�r	r
rrrQrrrrrMrrr�r�r�r�r rBrFr�r�r�r�r�r�rr�r�r�r�r�r�r�r�rrrrr�esh#,	
#	


"	

%
r�cCs8d}t|dd�}|dd}||}||kr4|d7}|S)Nrrr'r()r)rZTHURSDAYZfirstdayZfirstweekdayr�rrrr��sr�c@s�eZdZdZe�Zefdd�Zed dd��Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zeddd�ZeZedd��ZdS)!r�_offset�_namecCs�t|t�std��||jkr,|s&|jSd}nt|t�s>td��|j|koT|jknsbtd��|j	dksz|j
ddkr�td��|j||�S)Nzoffset must be a timedeltazname must be a stringzYoffset must be a timedelta strictly between -timedelta(hours=24) and timedelta(hours=24).rr~zAoffset must be a timedelta representing a whole number of minutes)rYrLr[�_OmittedrrZ�
_minoffset�
_maxoffsetr7r5r3�_create)r�rTr]rrrr��s


ztimezone.__new__NcCstj|�}||_||_|S)N)rqr�r"r#)r�rTr]r�rrrr'�s
ztimezone._createcCs|jdkr|jfS|j|jfS)N)r#r")r�rrrr��s
ztimezone.__getinitargs__cCst|�tkrdS|j|jkS)NF)r\rr")r�r�rrrr��sztimezone.__eq__cCs
t|j�S)N)r�r")r�rrrr��sztimezone.__hash__cCsL||jkrdS|jdkr0d|jj|jj|jfSd|jj|jj|j|jfS)Nzdatetime.timezone.utcz	%s.%s(%r)z
%s.%s(%r, %r))rr#r�r�r�r")r�rrrr��s



ztimezone.__repr__cCs
|jd�S)N)rF)r�rrrr�sztimezone.__str__cCs$t|t�s|dkr|jStd��dS)Nz8utcoffset() argument must be a datetime instance or None)rYr�r"r[)r�r�rrrrB
sztimezone.utcoffsetcCs:t|t�s|dkr.|jdkr(|j|j�S|jStd��dS)Nz5tzname() argument must be a datetime instance or None)rYr�r#�_name_from_offsetr"r[)r�r�rrrrFs

ztimezone.tznamecCs"t|t�s|dkrdStd��dS)Nz2dst() argument must be a datetime instance or None)rYr�r[)r�r�rrrr�sztimezone.dstcCs2t|t�r&|j|k	rtd��||jStd��dS)Nzfromutc: dt.tzinfo is not selfz6fromutc() argument must be a datetime instance or None)rYr�rqr7r"r[)r�r�rrrr�s



ztimezone.fromutcrjrk)r1r2cCsT|sdS|td�kr d}|}nd}t|tdd��\}}|tdd�}dj|||�S)	NZUTCrrDrCr)r1)r2zUTC{}{:02d}:{:02d})rLr!r8)r�rUr1�restr2rrrr(*sztimezone._name_from_offset)r"r#)N)rdr�r�r�rPr$r�r�r'r�r�r�r�r�rBrFr�r�rLr&r%�staticmethodr(rrrrr�s"	ri�)rq)�*)�__doc__rr)r0i6e�)8r�r)Zmathrrrrgrhr�rrZdbmrrGrrrrrr"r#r$r&r�r�r/r<rXr^r_rfrirprsrtryrLrrZ
resolutionr�rrqr�r
r�r�rr'rr%r&rZ	_datetime�ImportErrorr,rrrr�<module>s�
	?
:
?


,DWVpG




operator.cpython-36.opt-1.pyc000064400000033133150335715140011773 0ustar003


 \o*�6@s(dZddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6g6Zd7d8lmZd9d&�Zd:d#�Zd;d	�Zd<d+�Zd=d�Z	d>d
�Z
d?d-�Zd@d5�ZdAd�Z
dBd�ZdCd�ZdDd�ZdEd�ZdFd
�ZdGd�ZdHd�ZeZdId%�ZdJd)�ZdKd*�ZdLd'�ZdMd,�ZdNd.�ZdOd/�ZdPd0�ZdQd1�ZdRd3�ZdSd4�ZdTd6�Z dUd�Z!dVd�Z"dWd�Z#dXd�Z$dYd�Z%dZd�Z&d[d2�Z'dqd\d$�Z(Gd]d�d�Z)Gd^d �d �Z*Gd_d(�d(�Z+d`d�Z,dad�Z-dbd�Z.dcd�Z/ddd�Z0ded�Z1dfd�Z2dgd�Z3dhd�Z4did�Z5djd�Z6dkd�Z7dld!�Z8dmd"�Z9yd7dnl:TWne;k
�rbYnXd7dol:mZeZ<eZ=eZ>eZ?e	Z@e
ZAeZBeZCeZDeZEeZFeZGeZHeZIeZJeZKeZLeZMeZNeZOeZPeZQeZReZSeZTe ZUe!ZVe"ZWe$ZXe%ZYe'ZZe,Z[e-Z\e.Z]e/Z^e0Z_e1Z`e2Zae3Zbe4Zce5Zde6Zee7Zfe8Zge9ZhdpS)ras
Operator Interface

This module exports a set of functions corresponding to the intrinsic
operators of Python.  For example, operator.add(x, y) is equivalent
to the expression x+y.  The function names are those used for special
methods; variants without leading and trailing '__' are also provided
for convenience.

This is the pure Python implementation of the module.
�abs�add�and_�
attrgetter�concat�contains�countOf�delitem�eq�floordiv�ge�getitem�gt�iadd�iand�iconcat�	ifloordiv�ilshift�imatmul�imod�imul�index�indexOf�inv�invert�ior�ipow�irshift�is_�is_not�isub�
itemgetter�itruediv�ixor�le�length_hint�lshift�lt�matmul�methodcaller�mod�mul�ne�neg�not_�or_�pos�pow�rshift�setitem�sub�truediv�truth�xor�)rcCs||kS)zSame as a < b.�)�a�br8r8� /usr/lib64/python3.6/operator.pyr&scCs||kS)zSame as a <= b.r8)r9r:r8r8r;r#scCs||kS)zSame as a == b.r8)r9r:r8r8r;r	#scCs||kS)zSame as a != b.r8)r9r:r8r8r;r+'scCs||kS)zSame as a >= b.r8)r9r:r8r8r;r+scCs||kS)zSame as a > b.r8)r9r:r8r8r;r
/scCs|S)zSame as not a.r8)r9r8r8r;r-5scCs|rdSdS)z*Return True if a is true, False otherwise.TFr8)r9r8r8r;r59scCs||kS)zSame as a is b.r8)r9r:r8r8r;r=scCs||k	S)zSame as a is not b.r8)r9r:r8r8r;rAscCst|�S)zSame as abs(a).)�_abs)r9r8r8r;rGscCs||S)zSame as a + b.r8)r9r:r8r8r;rKscCs||@S)zSame as a & b.r8)r9r:r8r8r;rOscCs||S)zSame as a // b.r8)r9r:r8r8r;r
SscCs|j�S)zSame as a.__index__().)�	__index__)r9r8r8r;rWscCs|S)zSame as ~a.r8)r9r8r8r;r[scCs||>S)zSame as a << b.r8)r9r:r8r8r;r%`scCs||S)zSame as a % b.r8)r9r:r8r8r;r)dscCs||S)zSame as a * b.r8)r9r:r8r8r;r*hscCs||S)zSame as a @ b.r8)r9r:r8r8r;r'lscCs|S)zSame as -a.r8)r9r8r8r;r,pscCs||BS)zSame as a | b.r8)r9r:r8r8r;r.tscCs|
S)zSame as +a.r8)r9r8r8r;r/xscCs||S)zSame as a ** b.r8)r9r:r8r8r;r0|scCs||?S)zSame as a >> b.r8)r9r:r8r8r;r1�scCs||S)zSame as a - b.r8)r9r:r8r8r;r3�scCs||S)zSame as a / b.r8)r9r:r8r8r;r4�scCs||AS)zSame as a ^ b.r8)r9r:r8r8r;r6�scCs(t|d�s dt|�j}t|��||S)z%Same as a + b, for a and b sequences.�__getitem__z!'%s' object can't be concatenated)�hasattr�type�__name__�	TypeError)r9r:�msgr8r8r;r�s
cCs||kS)z(Same as b in a (note reversed operands).r8)r9r:r8r8r;r�scCs&d}x|D]}||kr
|d7}q
W|S)z)Return the number of times b occurs in a.r7�r8)r9r:�count�ir8r8r;r�s

cCs
||=dS)zSame as del a[b].Nr8)r9r:r8r8r;r�scCs||S)z
Same as a[b].r8)r9r:r8r8r;r�scCs.x(t|�D]\}}||kr
|Sq
Wtd��dS)z!Return the first index of b in a.z$sequence.index(x): x not in sequenceN)�	enumerate�
ValueError)r9r:rF�jr8r8r;r�scCs|||<dS)zSame as a[b] = c.Nr8)r9r:�cr8r8r;r2�scCs�t|t�s dt|�j}t|��yt|�Stk
r<YnXyt|�j}Wntk
r`|SXy||�}Wntk
r�|SX|tkr�|St|t�s�dt|�j}t|��|dkr�d}t	|��|S)a2
    Return an estimate of the number of items in obj.
    This is useful for presizing containers when building from an iterable.

    If the object supports len(), the result will be exact. Otherwise, it may
    over- or under-estimate by an arbitrary amount. The result will be an
    integer >= 0.
    z/'%s' object cannot be interpreted as an integerz'__length_hint__ must be integer, not %sr7z$__length_hint__() should return >= 0)
�
isinstance�intr@rArB�len�__length_hint__�AttributeError�NotImplementedrH)�obj�defaultrCZhint�valr8r8r;r$�s4	

c@s4eZdZdZd
Zdd�Zdd�Zdd	�Zd
d�ZdS)raV
    Return a callable object that fetches the given attribute(s) from its operand.
    After f = attrgetter('name'), the call f(r) returns r.name.
    After g = attrgetter('name', 'date'), the call g(r) returns (r.name, r.date).
    After h = attrgetter('name.first', 'name.last'), the call h(r) returns
    (r.name.first, r.name.last).
    �_attrs�_callcsn|s<t|t�std��|f|_|jd���fdd�}||_n.|f||_ttt|j����fdd�}||_dS)Nzattribute name must be a string�.csx�D]}t||�}qW|S)N)�getattr)rQ�name)�namesr8r;�func�s
z!attrgetter.__init__.<locals>.funccst�fdd��D��S)Nc3s|]}|��VqdS)Nr8)�.0�getter)rQr8r;�	<genexpr>�sz4attrgetter.__init__.<locals>.func.<locals>.<genexpr>)�tuple)rQ)�getters)rQr;rZ�s)	rK�strrBrT�splitrUr^�mapr)�self�attrZattrsrZr8)r_rYr;�__init__�s

zattrgetter.__init__cCs
|j|�S)N)rU)rcrQr8r8r;�__call__�szattrgetter.__call__cCs$d|jj|jjdjtt|j��fS)Nz	%s.%s(%s)z, )�	__class__�
__module__�__qualname__�joinrb�reprrT)rcr8r8r;�__repr__szattrgetter.__repr__cCs|j|jfS)N)rgrT)rcr8r8r;�
__reduce__szattrgetter.__reduce__N)rTrU)	rArhri�__doc__�	__slots__rerfrlrmr8r8r8r;r�sc@s4eZdZdZd
Zdd�Zdd�Zdd	�Zd
d�ZdS)r z�
    Return a callable object that fetches the given item(s) from its operand.
    After f = itemgetter(2), the call f(r) returns r[2].
    After g = itemgetter(2, 5, 3), the call g(r) returns (r[2], r[5], r[3])
    �_itemsrUcsF�s �f|_�fdd�}||_n"�f�|_��fdd�}||_dS)Ncs|�S)Nr8)rQ)�itemr8r;rZsz!itemgetter.__init__.<locals>.funccst�fdd��D��S)Nc3s|]}�|VqdS)Nr8)r[rF)rQr8r;r]sz4itemgetter.__init__.<locals>.func.<locals>.<genexpr>)r^)rQ)�items)rQr;rZs)rprU)rcrqrrrZr8)rqrrr;reszitemgetter.__init__cCs
|j|�S)N)rU)rcrQr8r8r;rfszitemgetter.__call__cCs$d|jj|jjdjtt|j��fS)Nz	%s.%s(%s)z, )rgrhrArjrbrkrp)rcr8r8r;rl szitemgetter.__repr__cCs|j|jfS)N)rgrp)rcr8r8r;rm%szitemgetter.__reduce__N)rprU)	rArhrirnrorerfrlrmr8r8r8r;r 	sc@s4eZdZdZdZdd�Zdd�Zd	d
�Zdd�Zd
S)r(z�
    Return a callable object that calls the given method on its operand.
    After f = methodcaller('name'), the call f(r) returns r.name().
    After g = methodcaller('name', 'date', foo=1), the call g(r) returns
    r.name('date', foo=1).
    �_name�_args�_kwargscOsVt|�dkrd}t|��|d}|d|_t|jt�s>td��|dd�|_||_dS)N�z9methodcaller needs at least one argument, the method namer7rDzmethod name must be a string)rMrBrsrKr`rtru)�args�kwargsrCrcr8r8r;re1s
zmethodcaller.__init__cCst||j�|j|j�S)N)rWrsrtru)rcrQr8r8r;rf<szmethodcaller.__call__cCsTt|j�g}|jtt|j��|jdd�|jj�D��d|jj|jj	dj
|�fS)Ncss|]\}}d||fVqdS)z%s=%rNr8)r[�k�vr8r8r;r]Bsz(methodcaller.__repr__.<locals>.<genexpr>z	%s.%s(%s)z, )rkrs�extendrbrtrurrrgrhrArj)rcrwr8r8r;rl?szmethodcaller.__repr__cCsD|js|j|jf|jfSddlm}||j|jf|j�|jfSdS)Nr7)�partial)rurgrsrt�	functoolsr|)rcr|r8r8r;rmGszmethodcaller.__reduce__N)rsrtru)	rArhrirnrorerfrlrmr8r8r8r;r((scCs||7}|S)zSame as a += b.r8)r9r:r8r8r;rQscCs||M}|S)zSame as a &= b.r8)r9r:r8r8r;rVscCs,t|d�s dt|�j}t|��||7}|S)z&Same as a += b, for a and b sequences.r>z!'%s' object can't be concatenated)r?r@rArB)r9r:rCr8r8r;r[s

cCs||}|S)zSame as a //= b.r8)r9r:r8r8r;rcscCs||K}|S)zSame as a <<= b.r8)r9r:r8r8r;rhscCs||;}|S)zSame as a %= b.r8)r9r:r8r8r;rmscCs||9}|S)zSame as a *= b.r8)r9r:r8r8r;rrscCs||}|S)zSame as a @= b.r8)r9r:r8r8r;rwscCs||O}|S)zSame as a |= b.r8)r9r:r8r8r;r|scCs||C}|S)zSame as a **= b.r8)r9r:r8r8r;r�scCs||L}|S)zSame as a >>= b.r8)r9r:r8r8r;r�scCs||8}|S)zSame as a -= b.r8)r9r:r8r8r;r�scCs||}|S)zSame as a /= b.r8)r9r:r8r8r;r!�scCs||N}|S)zSame as a ^= b.r8)r9r:r8r8r;r"�s)�*)rnN)r7)irn�__all__�builtinsrr<r&r#r	r+rr
r-r5rrrrr
rrrr%r)r*r'r,r.r/r0r1r3r4r6rrrrrrr2r$rr r(rrrrrrrrrrrrr!r"�	_operator�ImportError�__lt__�__le__�__eq__�__ne__�__ge__�__gt__�__not__�__abs__�__add__�__and__�__floordiv__r=�__inv__�
__invert__�
__lshift__�__mod__�__mul__�
__matmul__�__neg__�__or__�__pos__�__pow__�
__rshift__�__sub__�__truediv__�__xor__�
__concat__�__contains__�__delitem__r>�__setitem__�__iadd__�__iand__�__iconcat__�
__ifloordiv__�__ilshift__�__imod__�__imul__�__imatmul__�__ior__�__ipow__�__irshift__�__isub__�__itruediv__�__ixor__r8r8r8r;�<module>s�
)')os.cpython-36.opt-1.pyc000064400000071676150335715140010577 0ustar003


 \���0@s�dZddlZddlZddlZddlZejZddddddd	d
ddd
ddddddddgZdd�Z	dd�Z
dekr�dZdZddl
Tyddl
mZejd�Wnek
r�YnXddlZyddl
mZWnek
r�YnXddl
Z
eje
e
��[
n�d ek�r�d Zd!ZddlTyddlmZejd�Wnek
�r>YnXddlZddlZeje
e��[yddlmZWnek
�r�YnXned"��eejd#<dd$lmZmZmZmZmZmZmZm Z [e	d%��r�e!�Z"d&d'�Z#e$�Z%e#d(d)�e#d*d+�e#d,d-�e#d.d/�e#d0d1�e#d2d3�e#d4d5�e#d6d7�e#d8d9�e#d:d;�e#d<d=�e#d>d?�e#d@dA�e#dBdC�e#dBdD�e#dEd1�e%Z&e$�Z%e#d(d)�e%Z'e$�Z%e#dFdG�e#dHd+�e#dId-�e#dJdK�e#dLdM�e%j(e�e#dNdO�e#dPd1�e#dQd1�e#dRdS�e	dT��r$e	dU��r$e#dVdT�e%Z)e$�Z%e#d(d)�e#d,d-�e#d.d/�e#dWdX�e#dYd+�e	dZ��rte#d[d-�e#d2d3�e#d\d1�e#d]d/�e#d.d/�e#dEd1�e#d^d/�e%Z*[%[["[#dZ+d_Z,d`Z-d�dcdd�Z.dedf�Z/dgdh�Z0ejdddfdhg�d�djdk�Z1ejdk�e2ehe&k�rFe3ehe)k�rFd�dbddm�dndo�Z4dpdq�Z5ejdo�ye6Wne7k
�rhiZ6YnXdrds�Z8dtdu�Z9dvdw�Z:dxdy�Z;dzd{�Z<d|d}�Z=ejdsdudwdyd{d}g�d�d~d�Z>d�d�d�Z?dd�l@mAZAGd�d��d�eA�ZByeCZDWne7k
�rd�d��ZDYnXd�ek�rejd��yeEZFWne7k
�rBd�d��ZFYnXd�ek�rXejd��d�d��ZGeG�Z6[Gd�d�d��ZHed kZIejd��eI�r�d�d��ZJeBe6jKeJeLeJeLeDeF�ZM[Jd�d�d��ZNejd��d�d��ZOeO�\ZPZQ[Oe	d���rHe	d���rHe	d���rHdZRd_ZSZTejd�d�d�g�d�d��ZUd�d��ZVd�d��ZWd�d��ZXd�d��ZYejd�d�d�d�g�e	d���rpd�d��ZZd�d��Z[ejd�d�g�e	d���r�d�d��Z\d�d��Z]ejd�d�g�d�d�d�Z^Gd�d��d��Z_d�d�Z`d�d��Zae	d���s�eaZbd�eb_cGd�d��d�ejd�ZedS)�aNOS routines for NT or Posix depending on what system we're on.

This exports:
  - all functions from posix or nt, e.g. unlink, stat, etc.
  - os.path is either posixpath or ntpath
  - os.name is either 'posix' or 'nt'
  - os.curdir is a string representing the current directory (always '.')
  - os.pardir is a string representing the parent directory (always '..')
  - os.sep is the (or a most common) pathname separator ('/' or '\\')
  - os.extsep is the extension separator (always '.')
  - os.altsep is the alternate pathname separator (None or '/')
  - os.pathsep is the component separator used in $PATH etc
  - os.linesep is the line separator in text files ('\r' or '\n' or '\r\n')
  - os.defpath is the default search path for executables
  - os.devnull is the file path of the null device ('/dev/null', etc.)

Programs that import and use 'os' stand a better chance of being
portable between different platforms.  Of course, they must then
only use functions that are defined by all platforms (e.g., unlink
and opendir), and leave all pathname manipulation to os.path
(e.g., split and join).
�N�altsep�curdir�pardir�sep�pathsep�linesep�defpath�name�path�devnull�SEEK_SET�SEEK_CUR�SEEK_END�fsencode�fsdecode�
get_exec_path�fdopen�popen�extsepcCs
|t�kS)N)�globals)r	�r�/usr/lib64/python3.6/os.py�_exists%srcCs2y
t|j�Stk
r,dd�t|�D�SXdS)NcSsg|]}|ddkr|�qS)r�_r)�.0�nrrr�
<listcomp>,sz%_get_exports_list.<locals>.<listcomp>)�list�__all__�AttributeError�dir)�modulerrr�_get_exports_list(s
r"�posix�
)�*)�_exitr&)�_have_functions�ntz
zno os specific module foundzos.path)rrrrrrrrr'cCs"|tkr|tkrtjt|�dS)N)�_globalsr'�_set�add)�str�fnrrr�_adddsr.�HAVE_FACCESSAT�access�
HAVE_FCHMODAT�chmod�
HAVE_FCHOWNAT�chown�HAVE_FSTATAT�stat�HAVE_FUTIMESAT�utime�HAVE_LINKAT�link�HAVE_MKDIRAT�mkdir�
HAVE_MKFIFOAT�mkfifo�HAVE_MKNODAT�mknod�HAVE_OPENAT�open�HAVE_READLINKAT�readlink�
HAVE_RENAMEAT�rename�HAVE_SYMLINKAT�symlink�
HAVE_UNLINKAT�unlink�rmdir�HAVE_UTIMENSAT�HAVE_FCHDIR�chdir�HAVE_FCHMOD�HAVE_FCHOWN�HAVE_FDOPENDIR�listdir�HAVE_FEXECVE�execve�HAVE_FTRUNCATE�truncate�
HAVE_FUTIMENS�HAVE_FUTIMES�HAVE_FPATHCONF�pathconf�statvfs�fstatvfs�
HAVE_FSTATVFS�
HAVE_LCHFLAGSZchflags�HAVE_LCHMOD�lchown�HAVE_LCHOWN�HAVE_LUTIMES�
HAVE_LSTATZ
MS_WINDOWS���FcCs�tj|�\}}|s tj|�\}}|r~|r~tj|�r~yt|||�Wntk
rXYnXt}t|t�rrttd�}||kr~dSyt||�Wn(t	k
r�|s�tj
|�r��YnXdS)a�makedirs(name [, mode=0o777][, exist_ok=False])

    Super-mkdir; create a leaf directory and all intermediate ones.  Works like
    mkdir, except that any intermediate path segment (not just the rightmost)
    will be created if it does not exist. If the target directory already
    exists, raise an OSError if exist_ok is False. Otherwise no exception is
    raised.  This is recursive.

    �ASCIIN)r
�split�exists�makedirs�FileExistsErrorr�
isinstance�bytesr<�OSError�isdir)r	�mode�exist_ok�head�tail�cdirrrrrj�s$


rjcCslt|�tj|�\}}|s(tj|�\}}x>|rf|rfyt|�Wntk
rTPYnXtj|�\}}q*WdS)a�removedirs(name)

    Super-rmdir; remove a leaf directory and all empty intermediate
    ones.  Works like rmdir except that, if the leaf directory is
    successfully removed, directories corresponding to rightmost path
    segments will be pruned away until either the whole path is
    consumed or an error occurs.  Errors during this latter phase are
    ignored -- they generally mean that a directory was not empty.

    N)rKr
rhrn)r	rrrsrrr�
removedirs�s
rucCsptj|�\}}|r*|r*tj|�r*t|�t||�tj|�\}}|rl|rlyt|�Wntk
rjYnXdS)a<renames(old, new)

    Super-rename; create directories as necessary and delete any left
    empty.  Works like rename, except creation of any intermediate
    directories needed to make the new pathname good is attempted
    first.  After the rename, directories corresponding to rightmost
    path segments of the old name will be pruned until either the
    whole path is consumed or a nonempty directory is found.

    Note: this function can fail with the new directory structure made
    if you lack permissions needed to unlink the leaf directory or
    file.

    N)r
rhrirjrFrurn)�old�newrrrsrrr�renames�s
rxTc6cs�t|�}g}g}g}yt|�}Wn0tk
rP}z|dk	rB||�dSd}~XnX|���x�y(yt|�}	Wntk
r�PYnXWn0tk
r�}z|dk	r�||�dSd}~XnXy|	j�}
Wntk
r�d}
YnX|
r�|j|	j�n|j|	j�|r^|
r^|�rd}n.y|	j�}Wntk
�r8d}YnX|}|r^|j|	j	�q^WWdQRX|�r�|||fVt	j
t	j}
}xp|D]6}|||�}|�s�|
|��r�t||||�EdH�q�Wn0x"|D]}t||||�EdH�q�W|||fVdS)a�
Directory tree generator.

    For each directory in the directory tree rooted at top (including top
    itself, but excluding '.' and '..'), yields a 3-tuple

        dirpath, dirnames, filenames

    dirpath is a string, the path to the directory.  dirnames is a list of
    the names of the subdirectories in dirpath (excluding '.' and '..').
    filenames is a list of the names of the non-directory files in dirpath.
    Note that the names in the lists are just names, with no path components.
    To get a full path (which begins with top) to a file or directory in
    dirpath, do os.path.join(dirpath, name).

    If optional arg 'topdown' is true or not specified, the triple for a
    directory is generated before the triples for any of its subdirectories
    (directories are generated top down).  If topdown is false, the triple
    for a directory is generated after the triples for all of its
    subdirectories (directories are generated bottom up).

    When topdown is true, the caller can modify the dirnames list in-place
    (e.g., via del or slice assignment), and walk will only recurse into the
    subdirectories whose names remain in dirnames; this can be used to prune the
    search, or to impose a specific order of visiting.  Modifying dirnames when
    topdown is false is ineffective, since the directories in dirnames have
    already been generated by the time dirnames itself is generated. No matter
    the value of topdown, the list of subdirectories is retrieved before the
    tuples for the directory and its subdirectories are generated.

    By default errors from the os.scandir() call are ignored.  If
    optional arg 'onerror' is specified, it should be a function; it
    will be called with one argument, an OSError instance.  It can
    report the error to continue with the walk, or raise the exception
    to abort the walk.  Note that the filename is available as the
    filename attribute of the exception object.

    By default, os.walk does not follow symbolic links to subdirectories on
    systems that support them.  In order to get this functionality, set the
    optional argument 'followlinks' to true.

    Caution:  if you pass a relative pathname for top, don't change the
    current working directory between resumptions of walk.  walk never
    changes the current directory, and assumes that the client doesn't
    either.

    Example:

    import os
    from os.path import join, getsize
    for root, dirs, files in os.walk('python/Lib/email'):
        print(root, "consumes", end="")
        print(sum([getsize(join(root, name)) for name in files]), end="")
        print("bytes in", len(files), "non-directory files")
        if 'CVS' in dirs:
            dirs.remove('CVS')  # don't visit CVS directories

    NFT)
�fspath�scandirrn�next�
StopIteration�is_dir�appendr	�
is_symlinkr
�islink�join�walk)�top�topdown�onerror�followlinks�dirs�nondirs�	walk_dirs�
scandir_it�error�entryr}�	walk_intorr�r��dirname�new_pathrrrr�s`:





r��.)�follow_symlinks�dir_fdccs�t|t�st|d�r t|�}t|d|d�}t|t|d�}z:|s^tj|j	�rtt
j|t|��rtt|||||�EdHWdt
|�XdS)aDirectory tree generator.

        This behaves exactly like walk(), except that it yields a 4-tuple

            dirpath, dirnames, filenames, dirfd

        `dirpath`, `dirnames` and `filenames` are identical to walk() output,
        and `dirfd` is a file descriptor referring to the directory `dirpath`.

        The advantage of fwalk() over walk() is that it's safe against symlink
        races (when follow_symlinks is False).

        If dir_fd is not None, it should be a file descriptor open to a directory,
          and top should be relative; top will then be relative to that directory.
          (dir_fd is always supported for fwalk.)

        Caution:
        Since fwalk() yields file descriptors, those are only valid until the
        next iteration step, so you should dup() them if you want to keep them
        for a longer period.

        Example:

        import os
        for root, dirs, files, rootfd in os.fwalk('python/Lib/email'):
            print(root, "consumes", end="")
            print(sum([os.stat(name, dir_fd=rootfd).st_size for name in files]),
                  end="")
            print("bytes in", len(files), "non-directory files")
            if 'CVS' in dirs:
                dirs.remove('CVS')  # don't visit CVS directories
        �	__index__F)r�r�)r�N)rl�int�hasattrryr6rB�O_RDONLY�st�S_ISDIR�st_moder
�samestat�_fwalk�close)r�r�r�r�r��orig_st�topfdrrr�fwalk�s!r�c
cs|t|�}gg}}x�|D]�}y.tjt||d�j�r>|j|�n
|j|�Wqtk
r�y$tjt||dd�j�r||j|�Wntk
r�wYnXYqXqW|r�||||fVx�|D]�}y t|||d�}	t|t	|d�}
Wn8tk
�r}z|dk	�r||�w�WYdd}~XnXz>|�s0t
j|	t|
���rRt
j||�}t
|
||||�EdHWdt|
�Xq�W|�sx||||fVdS)N)r�F)r�r�)rRr�r�r6r�r~rn�S_ISLNKrBr�r
r�r�r�r�)
r��toppathr�r�r��namesr�r�r	r��dirfd�err�dirpathrrrr��s<



r�cGst||�dS)zpexecl(file, *args)

    Execute the executable file with argument list args, replacing the
    current process. N)�execv)�file�argsrrr�execl
sr�cGs |d}t||dd�|�dS)z�execle(file, *args, env)

    Execute the executable file with argument list args and
    environment env, replacing the current process. rdN���r�)rT)r�r��envrrr�execlesr�cGst||�dS)z�execlp(file, *args)

    Execute the executable file (which is searched for along $PATH)
    with argument list args, replacing the current process. N)�execvp)r�r�rrr�execlpsr�cGs |d}t||dd�|�dS)z�execlpe(file, *args, env)

    Execute the executable file (which is searched for along $PATH)
    with argument list args and environment env, replacing the current
    process. rdNr�r�)�execvpe)r�r�r�rrr�execlpe sr�cCst||�dS)z�execvp(file, args)

    Execute the executable file (which is searched for along $PATH)
    with argument list args, replacing the current process.
    args may be a list or tuple of strings. N)�_execvpe)r�r�rrrr�)sr�cCst|||�dS)z�execvpe(file, args, env)

    Execute the executable file (which is searched for along $PATH)
    with argument list args and environment env , replacing the
    current process.
    args may be a list or tuple of strings. N)r�)r�r�r�rrrr�1sr�cCs|dk	rt}||f}nt}|f}t}tj|�\}}|rH||f|��dSd}}d}	t|�}
tdkrvt|�}tt|
�}
x�|
D]~}tj	||�}y||f|��Wq|t
k
r�}
z>|
}tj�d}|
j
t
jkr�|
j
t
jkr�|dkr�|
}|}	WYdd}
~
Xq|Xq|W|�r|j|	��|j|��dS)Nr(re)rTr��environr
rhrr	r�mapr�rn�sys�exc_info�errno�ENOENT�ENOTDIR�with_traceback)r�r�r��	exec_func�argrestrrrs�last_exc�	saved_exc�saved_tb�	path_listr �fullname�e�tbrrrr�<s<



r�cCs�ddl}|dkrt}|j���|jdt�y|jd�}Wntk
rPd}YnXtr�y|d}Wnttfk
rzYnX|dk	r�t	d��|}|dk	r�t
|t�r�t|�}WdQRX|dkr�t
}|jt�S)z�Returns the sequence of directories that will be searched for the
    named executable (similar to a shell) when launching a process.

    *env* must be an environment variable dict or None.  If *env* is None,
    os.environ will be used.
    rN�ignore�PATHsPATHz*env cannot contain 'PATH' and b'PATH' keys)�warningsr��catch_warnings�simplefilter�BytesWarning�get�	TypeError�supports_bytes_environ�KeyError�
ValueErrorrlrmrrrhr)r�r�r��
path_listbrrrr_s.


)�MutableMappingc@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�_EnvironcCs.||_||_||_||_||_||_||_dS)N)�	encodekey�	decodekey�encodevalue�decodevalue�putenv�unsetenv�_data)�self�datar�r�r�r�r�r�rrr�__init__�sz_Environ.__init__cCs>y|j|j|�}Wntk
r2t|�d�YnX|j|�S)N)r�r�r�r�)r��key�valuerrr�__getitem__�s
z_Environ.__getitem__cCs.|j|�}|j|�}|j||�||j|<dS)N)r�r�r�r�)r�r�r�rrr�__setitem__�s

z_Environ.__setitem__cCsD|j|�}|j|�y|j|=Wntk
r>t|�d�YnXdS)N)r�r�r�r�)r�r��
encodedkeyrrr�__delitem__�s

z_Environ.__delitem__ccs(t|j�}x|D]}|j|�VqWdS)N)rr�r�)r��keysr�rrr�__iter__�s

z_Environ.__iter__cCs
t|j�S)N)�lenr�)r�rrr�__len__�sz_Environ.__len__cs$djdj�fdd��jj�D���S)Nzenviron({{{}}})z, c3s*|]"\}}dj�j|��j|��VqdS)z
{!r}: {!r}N)�formatr�r�)rr�r�)r�rr�	<genexpr>�sz$_Environ.__repr__.<locals>.<genexpr>)r�r�r��items)r�r)r�r�__repr__�s
z_Environ.__repr__cCst|�S)N)�dict)r�rrr�copy�sz
_Environ.copycCs||kr|||<||S)Nr)r�r�r�rrr�
setdefault�sz_Environ.setdefaultN)�__name__�
__module__�__qualname__r�r�r�r�r�r�r�r�r�rrrrr��s		r�cCsdS)Nr)r�r�rrr�<lambda>�sr�r�cCs
t|d�S)N�)�_putenv)r�rrrr��sr�cs�tdkrLdd�}|�t}�fdd�}i}xJtj�D]\}}||||�<q2Wn(tj���fdd���fdd	�}�}t}t|||�|tt�S)
Nr(cSs t|t�stdt|�j��|S)Nzstr expected, not %s)rlr,r��typer�)r�rrr�	check_str�s
z!_createenviron.<locals>.check_strcs�|�j�S)N)�upper)r�)�encoderrr��sz!_createenviron.<locals>.encodekeycs(t|t�stdt|�j��|j�d�S)Nzstr expected, not %s�surrogateescape)rlr,r�r�r�r�)r�)�encodingrrr��s
z_createenviron.<locals>.encodecs|j�d�S)Nr�)�decode)r�)r�rrr��sz_createenviron.<locals>.decode)	r	r,r�r�r��getfilesystemencodingr�r��	_unsetenv)r�r�r�r�r�r�r)r�r�r�_createenviron�s"r�cCstj||�S)z�Get an environment variable, return None if it doesn't exist.
    The optional second argument can specify an alternate default.
    key, default and the result are str.)r�r�)r��defaultrrr�getenv�sr�r�cCs t|t�stdt|�j��|S)Nzbytes expected, not %s)rlrmr�r�r�)r�rrr�_check_bytess
r�cCstj||�S)z�Get an environment variable, return None if it doesn't exist.
        The optional second argument can specify an alternate default.
        key, default and the result are bytes.)�environbr�)r�r�rrr�getenvbsrr�cs4tj��tj����fdd�}��fdd�}||fS)Ncs&t|�}t|t�r|j���S|SdS)aEncode filename (an os.PathLike, bytes, or str) to the filesystem
        encoding with 'surrogateescape' error handler, return bytes unchanged.
        On Windows, use 'strict' error handler if the file system encoding is
        'mbcs' (which is the default encoding).
        N)ryrlr,r�)�filename)r��errorsrrrs
z_fscodec.<locals>.fsencodecs&t|�}t|t�r|j���S|SdS)aDecode filename (an os.PathLike, bytes, or str) from the filesystem
        encoding with 'surrogateescape' error handler, return str unchanged. On
        Windows, use 'strict' error handler if the file system encoding is
        'mbcs' (which is the default encoding).
        N)ryrlrmr�)r)r�rrrr&s
z_fscodec.<locals>.fsdecode)r�r��getfilesystemencodeerrors)rrr)r�rr�_fscodecs
r�fork�spawnvr��P_WAIT�P_NOWAIT�	P_NOWAITOc
Cs�t|ttf�std��|s&|dr.td��t�}|sty$|dkrN|||�n||||�Wq�td�Yq�XnV|tkr�|SxHt|d�\}}t	|�r�q�q�t
|�r�t|�St|�r�t
|�Std��q�WdS)Nzargv must be a tuple or a listrz"argv first element cannot be empty�z"Not stopped, signaled or exited???)rl�tuplerr�r�rr&r�waitpid�
WIFSTOPPED�WIFSIGNALED�WTERMSIG�	WIFEXITED�WEXITSTATUSrn)rpr�r�r��func�pid�wpid�stsrrr�	_spawnvefCs.
rcCst|||dt�S)aspawnv(mode, file, args) -> integer

Execute file with arguments from args in a subprocess.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. N)rr�)rpr�r�rrrrbscCst||||t�S)a:spawnve(mode, file, args, env) -> integer

Execute file with arguments from args in a subprocess with the
specified environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. )rrT)rpr�r�r�rrr�spawnveksrcCst|||dt�S)a8spawnvp(mode, file, args) -> integer

Execute file (which is looked for along $PATH) with arguments from
args in a subprocess.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. N)rr�)rpr�r�rrr�spawnvpwsrcCst||||t�S)a\spawnvpe(mode, file, args, env) -> integer

Execute file (which is looked for along $PATH) with arguments from
args in a subprocess with the supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. )rr�)rpr�r�r�rrr�spawnvpe�srcGst|||�S)aspawnl(mode, file, *args) -> integer

Execute file with arguments from args in a subprocess.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. )r)rpr�r�rrr�spawnl�srcGs|d}t|||dd�|�S)a:spawnle(mode, file, *args, env) -> integer

Execute file with arguments from args in a subprocess with the
supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. rdNr�r�)r)rpr�r�r�rrr�spawnle�srcGst|||�S)aWspawnlp(mode, file, *args) -> integer

Execute file (which is looked for along $PATH) with arguments from
args in a subprocess with the supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. )r)rpr�r�rrr�spawnlp�srcGs|d}t|||dd�|�S)a]spawnlpe(mode, file, *args, env) -> integer

Execute file (which is looked for along $PATH) with arguments from
args in a subprocess with the supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. rdNr�r�)r)rpr�r�r�rrr�spawnlpe�sr�rcCs�t|t�stdt|���|d
kr.td|��|dks>|dkrFtd��ddl}ddl}|dkr�|j|d|j|d�}t	|j
|j�|�S|j|d|j|d	�}t	|j
|j�|�SdS)Nz&invalid cmd type (%s, expected string)r�wzinvalid mode %rrz+popen() does not support unbuffered streamsT)�shell�stdout�bufsize)r �stdinr")rr)
rlr,r�r�r��
subprocess�io�Popen�PIPE�_wrap_close�
TextIOWrapperr!r#)�cmdrp�	bufferingr$r%�procrrrr�s$
c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)r(cCs||_||_dS)N)�_stream�_proc)r��streamr,rrrr��sz_wrap_close.__init__cCs8|jj�|jj�}|dkr dStdkr,|S|d>SdS)Nrr(�)r-r�r.�waitr	)r��
returncoderrrr��s

z_wrap_close.closecCs|S)Nr)r�rrr�	__enter__�sz_wrap_close.__enter__cGs|j�dS)N)r�)r�r�rrr�__exit__�sz_wrap_close.__exit__cCst|j|�S)N)�getattrr-)r�r	rrr�__getattr__�sz_wrap_close.__getattr__cCs
t|j�S)N)�iterr-)r�rrrr��sz_wrap_close.__iter__N)	r�r�r�r�r�r3r4r6r�rrrrr(�s	r(cOs4t|t�stdt|���ddl}|j|f|�|�S)Nz&invalid fd type (%s, expected integer)r)rlr�r�r�r%rB)�fdr��kwargsr%rrrr�s
c
Cs�t|ttf�r|St|�}y|j|�}Wn0tk
rXt|d�rF�ntd|j��YnXt|ttf�rl|Stdj	|jt|�j���dS)aaReturn the path representation of a path-like object.

    If str or bytes is passed in, it is returned unchanged. Otherwise the
    os.PathLike interface is used to get the path representation. If the
    path representation is not str or bytes, TypeError is raised. If the
    provided path is not str, bytes, or os.PathLike, TypeError is raised.
    �
__fspath__z/expected str, bytes or os.PathLike object, not z7expected {}.__fspath__() to return str or bytes, not {}N)
rlr,rmr�r:rr�r�r�r�)r
�	path_type�	path_reprrrr�_fspath�s
r=ryc@s*eZdZdZejdd��Zedd��ZdS)�PathLikezCAbstract base class for implementing the file system path protocol.cCst�dS)z9Return the file system path representation of the object.N)�NotImplementedError)r�rrrr:&szPathLike.__fspath__cCs
t|d�S)Nr:)r�)�cls�subclassrrr�__subclasshook__+szPathLike.__subclasshook__N)	r�r�r��__doc__�abc�abstractmethodr:�classmethodrBrrrrr>"sr>)rfF)TNF)r�TN)N)N)N)r�r�)N)r�rr�)rr�)frCrDr�r�r6r��builtin_module_namesZ_namesrrr"r	rr#r&r~�ImportError�	posixpathr
r'�extendr(Zntpath�modulesZos.pathrrrrrrrrrr)r.�setr*�supports_dir_fd�supports_effective_idsr+�supports_fd�supports_follow_symlinksrr
rrjrurxr�rBrRr�r�r��	NameErrorr�r�r�r�r�r�r�r�_collections_abcr�r�r�r�r�r�r�r�r�r�r�rmr�rrrrrrr	rrrrrrrrrrr(rr=ryr��ABCr>rrrr�<module>s|


(










































 

./

		
#
-7








 	

	


	
abc.cpython-36.pyc000064400000016535150335715140007735 0ustar003


 \"�@svdZddlmZdd�ZGdd�de�ZGdd�de�ZGd	d
�d
e�Z	Gdd�de
�ZGd
d�ded�Zdd�Z
dS)z3Abstract Base Classes (ABCs) according to PEP 3119.�)�WeakSetcCs
d|_|S)a�A decorator indicating abstract methods.

    Requires that the metaclass is ABCMeta or derived from it.  A
    class that has a metaclass derived from ABCMeta cannot be
    instantiated unless all of its abstract methods are overridden.
    The abstract methods can be called using any of the normal
    'super' call mechanisms.

    Usage:

        class C(metaclass=ABCMeta):
            @abstractmethod
            def my_abstract_method(self, ...):
                ...
    T)�__isabstractmethod__)�funcobj�r�/usr/lib64/python3.6/abc.py�abstractmethod	srcs$eZdZdZdZ�fdd�Z�ZS)�abstractclassmethodaO
    A decorator indicating abstract classmethods.

    Similar to abstractmethod.

    Usage:

        class C(metaclass=ABCMeta):
            @abstractclassmethod
            def my_abstract_classmethod(cls, ...):
                ...

    'abstractclassmethod' is deprecated. Use 'classmethod' with
    'abstractmethod' instead.
    Tcsd|_t�j|�dS)NT)r�super�__init__)�self�callable)�	__class__rrr
0szabstractclassmethod.__init__)�__name__�
__module__�__qualname__�__doc__rr
�
__classcell__rr)r
rrsrcs$eZdZdZdZ�fdd�Z�ZS)�abstractstaticmethodaO
    A decorator indicating abstract staticmethods.

    Similar to abstractmethod.

    Usage:

        class C(metaclass=ABCMeta):
            @abstractstaticmethod
            def my_abstract_staticmethod(...):
                ...

    'abstractstaticmethod' is deprecated. Use 'staticmethod' with
    'abstractmethod' instead.
    Tcsd|_t�j|�dS)NT)rr	r
)rr)r
rrr
Hszabstractstaticmethod.__init__)rrrrrr
rrr)r
rr5src@seZdZdZdZdS)�abstractpropertyak
    A decorator indicating abstract properties.

    Requires that the metaclass is ABCMeta or derived from it.  A
    class that has a metaclass derived from ABCMeta cannot be
    instantiated unless all of its abstract properties are overridden.
    The abstract properties can be called using any of the normal
    'super' call mechanisms.

    Usage:

        class C(metaclass=ABCMeta):
            @abstractproperty
            def my_abstract_property(self):
                ...

    This defines a read-only property; you can also define a read-write
    abstract property using the 'long' form of property declaration:

        class C(metaclass=ABCMeta):
            def getx(self): ...
            def setx(self, value): ...
            x = abstractproperty(getx, setx)

    'abstractproperty' is deprecated. Use 'property' with 'abstractmethod'
    instead.
    TN)rrrrrrrrrrMsrcsFeZdZdZdZ�fdd�Zdd�Zddd	�Zd
d�Zdd
�Z	�Z
S)�ABCMetaaiMetaclass for defining Abstract Base Classes (ABCs).

    Use this metaclass to create an ABC.  An ABC can be subclassed
    directly, and then acts as a mix-in class.  You can also register
    unrelated concrete classes (even built-in classes) and unrelated
    ABCs as 'virtual subclasses' -- these and their descendants will
    be considered subclasses of the registering ABC by the built-in
    issubclass() function, but the registering ABC won't show up in
    their MRO (Method Resolution Order) nor will method
    implementations defined by the registering ABC be callable (not
    even via super()).

    rc	s�t�j||||f|�}dd�|j�D�}xF|D]>}x8t|dt��D]&}t||d�}t|dd�rB|j|�qBWq.Wt|�|_t�|_	t�|_
t�|_tj
|_|S)NcSs h|]\}}t|dd�r|�qS)rF)�getattr)�.0�name�valuerrr�	<setcomp>�sz"ABCMeta.__new__.<locals>.<setcomp>�__abstractmethods__rF)r	�__new__�itemsr�set�add�	frozensetrr�
_abc_registry�
_abc_cache�_abc_negative_cacher�_abc_invalidation_counter�_abc_negative_cache_version)	�mclsr�bases�	namespace�kwargs�cls�	abstracts�baser)r
rrr�s

zABCMeta.__new__cCsPt|t�std��t||�r |St||�r2td��|jj|�tjd7_|S)zsRegister a virtual subclass of an ABC.

        Returns the subclass, to allow usage as a class decorator.
        zCan only register classesz'Refusing to create an inheritance cycle�)	�
isinstance�type�	TypeError�
issubclass�RuntimeErrorr!rrr$)r*�subclassrrr�register�s


zABCMeta.registerNcCs|td|j|jf|d�tdtj|d�xLt|j�D]>}|jd�r6t||�}t	|t
�r`t|�}td||f|d�q6WdS)z'Debug helper to print the ABC registry.zClass: %s.%s)�filezInv.counter: %s�_abc_z%s: %rN)�printrrrr$�sorted�__dict__�
startswithrr.rr)r*r5rrrrr�_dump_registry�s


zABCMeta._dump_registrycsb|j}|�jkrdSt|�}||krH�jtjkr>|�jkr>dS�j|�St�fdd�||hD��S)z'Override for isinstance(instance, cls).TFc3s|]}�j|�VqdS)N)�__subclasscheck__)r�c)r*rr�	<genexpr>�sz,ABCMeta.__instancecheck__.<locals>.<genexpr>)	r
r"r/r%rr$r#r<�any)r*�instancer3�subtyper)r*r�__instancecheck__�s


zABCMeta.__instancecheck__cCs||jkrdS|jtjkr,t�|_tj|_n||jkr:dS|j|�}|tk	r|t|t	�sZt
�|rl|jj|�n|jj|�|S|t|df�kr�|jj|�dSx(|j
D]}t||�r�|jj|�dSq�Wx*|j�D]}t||�r�|jj|�dSq�W|jj|�dS)z'Override for issubclass(subclass, cls).TF�__mro__)r"r%rr$rr#�__subclasshook__�NotImplementedr.�bool�AssertionErrorrrr!r1�__subclasses__)r*r3�ok�rcls�sclsrrrr<�s6





zABCMeta.__subclasscheck__)N)rrrrr$rr4r;rBr<rrr)r
rrms
rc@seZdZdZdS)�ABCzVHelper class that provides a standard way to create an ABC using
    inheritance.
    N)rrrrrrrrrL�srL)�	metaclasscCstjS)z�Returns the current ABC cache token.

    The token is an opaque object (supporting equality testing) identifying the
    current version of the ABC cache for virtual subclasses. The token changes
    with every call to ``register()`` on any ABC.
    )rr$rrrr�get_cache_token�srNN)r�_weakrefsetrr�classmethodr�staticmethodr�propertyrr/rrLrNrrrr�<module>s tarfile.cpython-36.opt-1.pyc000064400000222047150335715140011572 0ustar003

�\dh���'@sBdZdZdZdZdZdZddlmZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZyddlZWnek
r�dZYnXyddlZWnek
r�dZYnXeefZyeef7ZWnek
r�YnXd	d
ddd
ddddddddddgZdZdZdZdZedZ dZ!dZ"dZ#dZ$d Z%d!Z&dZ'd"Z(d#Z)d$Z*d%Z+d&Z,d'Z-d(Z.d)Z/d*Z0d+Z1d,Z2d-Z3d.Z4dZ5d/Z6d0Z7e6Z8e&e'e(e)e,e-e.e*e+e/e0e1fZ9e&e'e.e1fZ:e/e0e1fZ;d�Z<d1d2d7d8hZ=e>e>e>e?e?e?d9�Z@e
jAd:k�r�d;ZBne	jC�ZBd<d=�ZDd>d?�ZEd@dA�ZFdBe8fdCdD�ZGdEdF�ZHdedfdGdH�ZIdIdJ�ZJdKdL�ZKGdMd�deL�ZMGdNd�deM�ZNGdOd
�d
eM�ZOGdPd�deM�ZPGdQd�deM�ZQGdRd�deM�ZRGdSdT�dTeR�ZSGdUdV�dVeR�ZTGdWdX�dXeR�ZUGdYdZ�dZeR�ZVGd[d\�d\eR�ZWGd]d^�d^�ZXGd_d`�d`�ZYGdadb�dbeZ�Z[Gdcdd�ddeZ�Z\Gdedf�dfej]�Z^Gdgdh�dheM�Z_Gdidj�dje_�Z`Gdkdl�dle_�ZaGdmdn�dne_�ZbGdodp�dpe_�ZcGdqdr�dre_�ZdGdsdt�dte_�Zee_eeNfZfd�dudv�Zgdwdx�Zhdydz�Zid{d|�Zjeheiejd}�ZkeZ�Zlejmd~�ZnGdd
�d
eZ�ZoGd�d	�d	eZ�Zpd�d�ZqepjZd�d��Zresd�k�r>er�dS)�z,Read from and write to tar format archives.
z0.9.0u"Lars Gustäbel (lars@gustaebel.de)z5$Date: 2011-02-25 17:42:01 +0200 (Fri, 25 Feb 2011) $z?$Id: tarfile.py 88586 2011-02-25 15:42:01Z marc-andre.lemburg $u4Gustavo Niemeyer, Niels Gustäbel, Richard Townsend.�)�openN�TarFile�TarInfo�
is_tarfile�TarError�	ReadError�CompressionError�StreamError�ExtractError�HeaderError�ENCODING�USTAR_FORMAT�
GNU_FORMAT�
PAX_FORMAT�DEFAULT_FORMATrTz/etc/python/tarfile.cfg�i�sustar  sustar00�d��0�1�2�3�4�5�6�7�L�K�S�x�g�X���path�linkpath�size�mtime�uid�gid�uname�gname)ZatimeZctimer(r)r*r'�ntzutf-8cCs8|dkrtd��|j||�}|d|�|t|�tS)z8Convert a string to a null-terminated bytes object.
    Nzmetadata cannot contain None)�
ValueError�encode�len�NUL)�s�length�encoding�errors�r6�/usr/lib64/python3.6/tarfile.py�stn�sr8cCs*|jd�}|dkr|d|�}|j||�S)z8Convert a null-terminated bytes object to a string.
    rr#N���)�find�decode)r2r4r5�pr6r6r7�nts�s
r=cCs�|ddkrfd}x0tt|�d�D]}|dK}|||d7}q"W|ddkr�dt|�d|}n@y"t|dd�}t|j�p�d	d�}Wntk
r�td
��YnX|S)z/Convert a number field to a python number.
    r��r#���ascii�strict�0zinvalid header)r>r?)�ranger0r=�int�stripr.�InvalidHeaderError)r2�n�ir6r6r7�nti�srKr@cCs�t|�}d|ko"d|dknrDtd|d|fd�t}n�|tkr�d|d|kopd|dknr�|dkr�tdg�}ntdg�}d||}x6t|d�D]}|jd|d@�|dL}q�Wntd	��|S)
z/Convert a python number to a number field.
    rr@r#z%0*orBrAr>r?zoverflow in number field)rF�bytesr1r�	bytearrayrE�insertr.)rI�digits�formatr2rJr6r6r7�itn�s 2
rQcCs0dttjd|��}dttjd|��}||fS)a�Calculate the checksum for a member's header by summing up all
       characters except for the chksum field which is treated as if
       it was filled with spaces. According to the GNU tar sources,
       some tars (Sun and NeXT) calculate chksum with signed char,
       which will be different if there are chars in the buffer with
       the high bit set. So we calculate two checksums, unsigned and
       signed.
    rAZ
148B8x356BZ
148b8x356b)�sum�structZunpack_from)�bufZunsigned_chksumZ
signed_chksumr6r6r7�calc_chksums�s	rUc	Cs�|pd}|dkrdS|dkr.tj|||�dSt||�\}}x8t|�D],}|j|�}t|�|krh|d��|j|�qFW|dkr�|j|�}t|�|kr�|d��|j|�dS)zjCopy length bytes from fileobj src to fileobj dst.
       If length is None, copy the entire content.
    �irNzunexpected end of datai@)�shutil�copyfileobj�divmodrE�readr0�write)	�src�dstr3�	exception�bufsize�blocks�	remainder�brTr6r6r7rX�s$


rXcCs ddl}|jdtd�tj|�S)z/Deprecated in this location; use stat.filemode.rNz$deprecated in favor of stat.filemoder$)�warnings�warn�DeprecationWarning�stat�filemode)�modercr6r6r7rgsrgcCs8ttjdd�}|dk	r(|j|d�j|�}t|dd�dS)Nr4�backslashreplace� )�end)�getattr�sys�stdoutr/r;�print)r2r4r6r6r7�_safe_printsrpc@seZdZdZdS)rzBase exception.N)�__name__�
__module__�__qualname__�__doc__r6r6r6r7rsc@seZdZdZdS)r
z%General exception for extract errors.N)rqrrrsrtr6r6r6r7r
!sc@seZdZdZdS)rz&Exception for unreadable tar archives.N)rqrrrsrtr6r6r6r7r$sc@seZdZdZdS)rz.Exception for unavailable compression methods.N)rqrrrsrtr6r6r6r7r'sc@seZdZdZdS)r	z=Exception for unsupported operations on stream-like TarFiles.N)rqrrrsrtr6r6r6r7r	*sc@seZdZdZdS)rz!Base exception for header errors.N)rqrrrsrtr6r6r6r7r-sc@seZdZdZdS)�EmptyHeaderErrorzException for empty headers.N)rqrrrsrtr6r6r6r7ru0sruc@seZdZdZdS)�TruncatedHeaderErrorz Exception for truncated headers.N)rqrrrsrtr6r6r6r7rv3srvc@seZdZdZdS)�EOFHeaderErrorz"Exception for end of file headers.N)rqrrrsrtr6r6r6r7rw6srwc@seZdZdZdS)rHzException for invalid headers.N)rqrrrsrtr6r6r6r7rH9srHc@seZdZdZdS)�SubsequentHeaderErrorz3Exception for missing and invalid extended headers.N)rqrrrsrtr6r6r6r7rx<srxc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
_LowLevelFilez�Low-level file object. Supports reading and writing.
       It is used instead of a regular file object for streaming
       access.
    cCsFtjtjtjBtjBd�|}ttd�r2|tjO}tj||d�|_dS)N)�r�w�O_BINARYi�)	�os�O_RDONLY�O_WRONLY�O_CREAT�O_TRUNC�hasattrr|r�fd)�self�namerhr6r6r7�__init__Is

z_LowLevelFile.__init__cCstj|j�dS)N)r}�closer�)r�r6r6r7r�Rsz_LowLevelFile.closecCstj|j|�S)N)r}rZr�)r�r'r6r6r7rZUsz_LowLevelFile.readcCstj|j|�dS)N)r}r[r�)r�r2r6r6r7r[Xsz_LowLevelFile.writeN)rqrrrsrtr�r�rZr[r6r6r6r7ryCs
	ryc@steZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zddd�Zddd�Z
dd�Zdd�ZdS)�_Streama�Class that serves as an adapter between TarFile and
       a stream-like object.  The stream-like object only
       needs to have a read() or write() method and is accessed
       blockwise.  Use of gzip or bzip2 compression is possible.
       A stream-like object could be for example: sys.stdin,
       sys.stdout, a socket, a tape device etc.

       _Stream is intended to be used only internally.
    c	Cs�d|_|dkrt||�}d|_|dkr6t|�}|j�}|p<d|_||_||_||_||_d|_	d|_
d|_�yL|dkr�yddl}Wnt
k
r�td	��YnX||_|jd�|_|d
kr�|j�|j|_n|j�n�|dk�r:yddl}Wnt
k
�r
td��YnX|d
k�r.d|_|j�|_t|_n
|j�|_n||d
k�r�yddl}Wnt
k
�rntd��YnX|d
k�r�d|_|j�|_|j|_n
|j�|_n|dk�r�td|��Wn&|j�s�|jj�d|_�YnXdS)z$Construct a _Stream object.
        TNF�*��r�gzzzlib module is not availablerz�bz2zbz2 module is not available�xzzlzma module is not available�tarzunknown compression type %r) �_extfileobjry�_StreamProxy�getcomptyper�rh�comptype�fileobjr_rT�pos�closed�zlib�ImportErrorr�crc32�crc�
_init_read_gz�errorr^�_init_write_gzr��dbufZBZ2Decompressor�cmp�OSErrorZ
BZ2Compressor�lzmaZLZMADecompressor�	LZMAErrorZLZMACompressorr�)	r�r�rhr�r�r_r�r�r�r6r6r7r�fsl












z_Stream.__init__cCst|d�r|jr|j�dS)Nr�)r�r�r�)r�r6r6r7�__del__�sz_Stream.__del__cCs�|jjd|jj|jj|jjd�|_tjdtt	j	���}|j
d|d�|jjd�rf|jdd�|_|j
|jj
d	d
�t�dS)z6Initialize for writing with gzip compression.
        �	rz<Ls�s�z.gzN�z
iso-8859-1�replace���)r�ZcompressobjZDEFLATED�	MAX_WBITSZ
DEF_MEM_LEVELr�rS�packrF�time�_Stream__writer��endswithr/r1)r�Z	timestampr6r6r7r��sz_Stream._init_write_gzcCsR|jdkr|jj||j�|_|jt|�7_|jdkrD|jj|�}|j|�dS)z&Write string s to the stream.
        r�r�N)	r�r�r�r�r�r0r��compressr�)r�r2r6r6r7r[�s

z
_Stream.writecCsR|j|7_x>t|j�|jkrL|jj|jd|j��|j|jd�|_qWdS)z]Write string s to the stream if a whole new block
           is ready to be written.
        N)rTr0r_r�r[)r�r2r6r6r7Z__write�sz_Stream.__writecCs�|jr
dSd|_z�|jdkr:|jdkr:|j|jj�7_|jdkr�|jr�|jj|j�d|_|jdkr�|jjtj	d|j
��|jjtj	d|jd@��Wd|js�|jj
�XdS)	z[Close the _Stream object. No operation should be
           done on it afterwards.
        NTr{r�r�r�z<Ll��)r�rhr�rTr��flushr�r[rSr�r�r�r�r�)r�r6r6r7r��s
z
_Stream.closecCs�|jj|jj�|_d|_|jd�dkr0td��|jd�dkrFtd��t|jd��}|jd�|d	@r�t|jd��d
t|jd��}|j	|�|d@r�x|jd�}|s�|t
kr�Pq�W|d@r�x|jd�}|s�|t
kr�Pq�W|d@r�|jd�d
S)z:Initialize for reading a gzip compressed fileobj.
        r�r$s�znot a gzip filer#�zunsupported compression method��rAr@rVN)r�Z
decompressobjr�r�r��
_Stream__readrr�ordrZr1)r��flagZxlenr2r6r6r7r��s.
 


z_Stream._init_read_gzcCs|jS)z3Return the stream's file pointer position.
        )r�)r�r6r6r7�tellsz_Stream.tellrcCs\||jdkrNt||j|j�\}}xt|�D]}|j|j�q.W|j|�ntd��|jS)zXSet the stream's file pointer to pos. Negative seeking
           is forbidden.
        rz seeking backwards is not allowed)r�rYr_rErZr	)r�r�r`rarJr6r6r7�seeksz_Stream.seekNcCsZ|dkr:g}x |j|j�}|s P|j|�qWdj|�}n
|j|�}|jt|�7_|S)z�Return the next size number of bytes from the stream.
           If size is not defined, return all bytes of the stream
           up to EOF.
        Nr�)�_readr_�append�joinr�r0)r�r'�trTr6r6r7rZs
z_Stream.readcCs�|jdkr|j|�St|j�}|jg}xd||kr�|j|j�}|sBPy|jj|�}Wn|jk
rptd��YnX|j	|�|t|�7}q(Wdj
|�}||d�|_|d|�S)z+Return size bytes from the stream.
        r�zinvalid compressed datar�N)r�r�r0r�r_r�Z
decompressr^rr�r�)r�r'�cr�rTr6r6r7r�*s"





z
_Stream._readcCsnt|j�}|jg}x6||krH|jj|j�}|s0P|j|�|t|�7}qWdj|�}||d�|_|d|�S)zsReturn size bytes from stream. If internal buffer is empty,
           read another block from the stream.
        r�N)r0rTr�rZr_r�r�)r�r'r�r�rTr6r6r7Z__read@s



z_Stream.__read)r)N)rqrrrsrtr�r�r�r[r�r�r�r�r�rZr�r�r6r6r6r7r�[s	F
	

r�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r�zsSmall proxy class that enables transparent compression
       detection for the Stream interface (mode 'r|*').
    cCs||_|jjt�|_dS)N)r�rZ�	BLOCKSIZErT)r�r�r6r6r7r�Vsz_StreamProxy.__init__cCs|jj|_|jS)N)r�rZrT)r�r'r6r6r7rZZs
z_StreamProxy.readcCsP|jjd�rdS|jdd�dkr8|jdd�dkr8d	S|jjd�rHdSd
SdS)Ns�r�rr�sBZhr��
s1AY&SYr��]���7zXZr�r�)r�r�)rT�
startswith)r�r6r6r7r�^s$z_StreamProxy.getcomptypecCs|jj�dS)N)r�r�)r�r6r6r7r�hsz_StreamProxy.closeN)rqrrrsrtr�rZr�r�r6r6r6r7r�Qs

r�c@sjeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	e
jfdd�Zddd�Z
dd�Zdd�ZdS)�_FileInFilezA thin wrapper around an existing file object that
       provides a part of its data as an individual file
       object.
    NcCs�||_||_||_d|_t|dd�|_d|_|dkr>d|fg}d|_g|_d}|j}xT|D]L\}}||kr~|jj	d||df�|jj	d||||f�||7}||}qZW||jkr�|jj	d||jdf�dS)Nrr�FT)
r��offsetr'�positionrlr�r��	map_index�mapr�)r�r�r�r'Z	blockinfoZlastposZrealposr6r6r7r�us(

z_FileInFile.__init__cCsdS)Nr6)r�r6r6r7r��sz_FileInFile.flushcCsdS)NTr6)r�r6r6r7�readable�sz_FileInFile.readablecCsdS)NFr6)r�r6r6r7�writable�sz_FileInFile.writablecCs
|jj�S)N)r��seekable)r�r6r6r7r��sz_FileInFile.seekablecCs|jS)z*Return the current file position.
        )r�)r�r6r6r7r��sz_FileInFile.tellcCs�|tjkr tt|d�|j�|_nj|tjkr\|dkrFt|j|d�|_q�t|j||j�|_n.|tjkr�tt|j||j�d�|_ntd��|jS)z(Seek to a position in the file.
        rzInvalid argument)	�io�SEEK_SET�min�maxr'r��SEEK_CUR�SEEK_ENDr.)r�r��whencer6r6r7r��s


z_FileInFile.seekc	Cs|dkr|j|j}nt||j|j�}d}x�|dk�rxZ|j|j\}}}}||jkob|knrlPq:|jd7_|jt|j�kr:d|_q:Wt|||j�}|r�|jj||j|�|jj|�}t|�|kr�t	d��||7}n|t
|7}||8}|j|7_q.W|S)z!Read data from the file.
        Nr�rr#zunexpected end of data)r'r�r�r�r�r0r�r�rZrr1)	r�r'rT�data�start�stopr�r3rbr6r6r7rZ�s.

z_FileInFile.readcCs&|jt|��}||dt|��<t|�S)N)rZr0)r�rbrTr6r6r7�readinto�sz_FileInFile.readintocCs
d|_dS)NT)r�)r�r6r6r7r��sz_FileInFile.close)N)N)rqrrrsrtr�r�r�r�r�r�r�r�r�rZr�r�r6r6r6r7r�os

r�cseZdZ�fdd�Z�ZS)�ExFileObjectcs&t|j|j|j|j�}t�j|�dS)N)r�r��offset_datar'�sparse�superr�)r��tarfile�tarinfor�)�	__class__r6r7r��s
zExFileObject.__init__)rqrrrsr��
__classcell__r6r6)r�r7r��sr�c@seZdZdS)�FilterErrorN)rqrrrsr6r6r6r7r��sr�cseZdZ�fdd�Z�ZS)�AbsolutePathErrorcs ||_t�jd|j�d��dS)Nzmember z has an absolute path)r�r�r�r�)r�r�)r�r6r7r��szAbsolutePathError.__init__)rqrrrsr�r�r6r6)r�r7r��sr�cseZdZ�fdd�Z�ZS)�OutsideDestinationErrorcs.||_||_t�j|j�d|�d�d�dS)Nz would be extracted to z, z which is outside the destination)r��_pathr�r�r�)r�r�r%)r�r6r7r��sz OutsideDestinationError.__init__)rqrrrsr�r�r6r6)r�r7r��sr�cseZdZ�fdd�Z�ZS)�SpecialFileErrorcs||_t�j|j�d��dS)Nz is a special file)r�r�r�r�)r�r�)r�r6r7r��szSpecialFileError.__init__)rqrrrsr�r�r6r6)r�r7r��sr�cseZdZ�fdd�Z�ZS)�AbsoluteLinkErrorcs||_t�j|j�d��dS)Nz! is a symlink to an absolute path)r�r�r�r�)r�r�)r�r6r7r��szAbsoluteLinkError.__init__)rqrrrsr�r�r6r6)r�r7r��sr�cseZdZ�fdd�Z�ZS)�LinkOutsideDestinationErrorcs.||_||_t�j|j�d|�d�d�dS)Nz would link to z, z which is outside the destination)r�r�r�r�r�)r�r�r%)r�r6r7r��sz$LinkOutsideDestinationError.__init__)rqrrrsr�r�r6r6)r�r7r��sr�cseZdZ�fdd�Z�ZS)�LinkFallbackErrorcs2||_||_t�jd|j�d�d|�d��dS)Nzlink z would be extracted as a zcopy of z, which was rejected)r�r�r�r�r�)r�r�r%)r�r6r7r�szLinkFallbackError.__init__)rqrrrsr�r�r6r6)r�r7r�sr�cCs$i}|j}tjj|tjjd�}|jdtjf�rH|jjdtj�}|d<tjj|�r\t	|��tjjtjj
||�tjjd�}tjj||g�|kr�t||��|j
}|dk	�r|d@}|�r�|j�s�|j�r�|d@s�|dM}|dO}n|j�s�|j�r�d}nt|��||j
k�r||d<|�r |jdk	�r,d|d	<|jdk	�r@d|d
<|jdk	�rTd|d<|jdk	�rhd|d<|j��s||j��r tjj|j��r�t|��tjj|j�}||jk�r�||d
<|j��r�tjj
|tjj|�|j�}ntjj
||j�}tjj|tjjd�}tjj||g�|k�r t||��|S)N)rC�/r�i��@�Ii�rhr)r*r+r,�linknamei����)r�r}r%�realpath�
ALLOW_MISSINGr��sep�lstrip�isabsr�r��
commonpathr�rh�isreg�islnk�isdir�issymr�r)r*r+r,r�r��normpath�dirnamer�)�member�	dest_pathZfor_data�	new_attrsr�Ztarget_pathrhZ
normalizedr6r6r7�_get_filtered_attrssd






r�cCs|S)Nr6)r�r�r6r6r7�fully_trusted_filterTsr�cCs(t||d�}|r$|jf|ddi��S|S)NF�deep)r�r�)r�r�r�r6r6r7�
tar_filterWsr�cCs(t||d�}|r$|jf|ddi��S|S)NTr�F)r�r�)r�r�r�r6r6r7�data_filter]sr�)Z
fully_trustedr�r�s([0-9]{1,20}) c@s�eZdZdZdmZdndd�Zdd�Zdd�Zeee�Z	dd�Z
dd �Zee
e�Zd!d"�Z
eeeeeeeed#ed$�
d%d&�Zd'd(�Zeed)fd*d+�Zd,d-�Zd.d/�Zd0d1�Zed2d3��Zd4d5�Zed6d7��Zed8d9��Zed:d;��Zed<d=��Zed>d?��Zed@dA��Z dBdC�Z!dDdE�Z"dFdG�Z#dHdI�Z$dJdK�Z%dLdM�Z&dNdO�Z'dPdQ�Z(dRdS�Z)dTdU�Z*dVdW�Z+dXdY�Z,dZd[�Z-d\d]�Z.d^d_�Z/d`da�Z0dbdc�Z1ddde�Z2dfdg�Z3dhdi�Z4djdk�Z5dlS)oraInformational class which holds the details about an
       archive member given by a tar header block.
       TarInfo objects are returned by TarFile.getmember(),
       TarFile.getmembers() and TarFile.gettarinfo() and are
       usually created internally.
    r�rhr)r*r'r(�chksum�typer�r+r,�devmajor�devminorr�r��pax_headersr�r��_sparse_structs�_link_targetr�cCsj||_d|_d|_d|_d|_d|_d|_t|_d|_	d|_
d|_d|_d|_
d|_d|_d|_i|_dS)zXConstruct a TarInfo object. name is the optional name
           of the member.
        i�rr�N)r�rhr)r*r'r(r��REGTYPEr�r�r+r,r�r�r�r�r�r)r�r�r6r6r7r��s"zTarInfo.__init__cCs|jS)N)r�)r�r6r6r7�_getpath�szTarInfo._getpathcCs
||_dS)N)r�)r�r�r6r6r7�_setpath�szTarInfo._setpathcCs|jS)N)r�)r�r6r6r7�_getlinkpath�szTarInfo._getlinkpathcCs
||_dS)N)r�)r�r�r6r6r7�_setlinkpath�szTarInfo._setlinkpathcCsd|jj|jt|�fS)Nz<%s %r at %#x>)r�rqr��id)r�r6r6r7�__repr__�szTarInfo.__repr__T)
r�r(rhr�r)r*r+r,r��_KEEPc
Cs�|	rtj|�}n
tj|�}||
k	r(||_||
k	r6||_||
k	rD||_||
k	rR||_||
k	r`||_||
k	rn||_||
k	r|||_||
k	r�||_	|S)zGReturn a deep copy of self with the given attributes replaced.
        )
�copy�deepcopyr�r(rhr�r)r*r+r,)r�r�r(rhr�r)r*r+r,r�r
�resultr6r6r7r��s(
zTarInfo.replacecCs�|jdkrd}n
|jd@}|j||j|j|j|j|j|j|j|j	|j
|j|jd�
}|dt
kr~|djd�r~|dd7<|S)z9Return the TarInfo's attributes as a dictionary.
        Ni�)
r�rhr)r*r'r(r�r�r�r+r,r�r�r�r�r�)rhr�r)r*r'r(r�r�r�r+r,r�r��DIRTYPEr�)r�rh�infor6r6r7�get_info�s&


zTarInfo.get_info�surrogateescapecCs~|j�}x(|j�D]\}}|dkrtd|��qW|tkrH|j|||�S|tkr^|j|||�S|tkrr|j||�Std��dS)z<Return a tar header as a string of 512 byte blocks.
        Nz%s may not be Nonezinvalid format)	r�itemsr.r
�create_ustar_headerr�create_gnu_headerr�create_pax_header)r�rPr4r5rr��valuer6r6r7�tobuf�sz
TarInfo.tobufcCsnt|d<t|dj||��tkr(td��t|dj||��tkr^|j|d||�\|d<|d<|j|t||�S)z3Return the object as a ustar header block.
        �magicr�zlinkname is too longr��prefix)	�POSIX_MAGICr0r/�LENGTH_LINKr.�LENGTH_NAME�_posix_split_name�_create_headerr
)r�rr4r5r6r6r7r�szTarInfo.create_ustar_headercCs�t|d<d}t|dj||��tkr<||j|dt||�7}t|dj||��tkrl||j|dt||�7}||j|t	||�S)z:Return the object as a GNU header block sequence.
        rr�r�r�)
�	GNU_MAGICr0r/r�_create_gnu_long_header�GNUTYPE_LONGLINKr�GNUTYPE_LONGNAMErr)r�rr4r5rTr6r6r7rszTarInfo.create_gnu_headerc
Cs4t|d<|jj�}x�ddtfddtfddfD]h\}}}||kr@q,y||jd	d
�Wn"tk
rv||||<w,YnXt||�|kr,||||<q,WxldD]d\}}||kr�d||<q�||}d|ko�d|dkn�s�t|t	�r�t
|�||<d||<q�W|�r|j|t|�}	nd}	|	|j
|td	d�S)z�Return the object as a ustar header block. If it cannot be
           represented this way, prepend a pax extended header sequence
           with supplement information.
        rr�r%r�r&r+� r,rBrCr)r@r*r'�r(rr#r�r�)r+r+r#)r,r,r#�r)r@�r*r@�r'r$�r(r$)r%r&r'r()rrrrrr/�UnicodeEncodeErrorr0�
isinstance�float�str�_create_pax_generic_header�XHDTYPErr
)
r�rr4rr�Zhnamer3rO�valrTr6r6r7rs4
.zTarInfo.create_pax_headercCs|j|td�S)zAReturn the object as a pax global header block sequence.
        zutf-8)r-�XGLTYPE)�clsrr6r6r7�create_pax_global_header?sz TarInfo.create_pax_global_headercCs�|jd�}xltdt|��D]R}dj|d|��}dj||d��}t|j||��tkrt|j||��tkrPqWtd��||fS)zUSplit a name longer than 100 chars into a prefix
           and a name part.
        r�r#Nzname is too long)�splitrEr0r�r/�
LENGTH_PREFIXrr.)r�r�r4r5Z
componentsrJrr6r6r7rEs
zTarInfo._posix_split_namecCs�|jd�ttfk}|r@t|jdd�d|�}t|jdd�d|�}ntdd||�}tdd||�}|jdt�}|dkrxtd��t|jd	d�d
||�t|jdd�d@d|�t|jd
d�d|�t|jdd�d|�t|jdd�d|�t|jdd�d|�d|t|jdd�d
||�|jdt�t|jdd�d||�t|jdd�d||�t|jdd�d|�t|jdd�d|�t|jdd�d||�g}tj	dt
dj|��}	t|	t
d��d}
|	dd �t
d|
d�|	d!d�}	|	S)"z�Return a header block. info is a dictionary with file
           information, format must be one of the *_FORMAT constants.
        r�r�rr@r�r�NzTarInfo.type must not be Noner�rrhi�r)r*r'r$r(s        r�rr+r#r,rrz%dsr�ilz%06orBiei����i����)�get�CHRTYPE�BLKTYPErQr8rr.rrSr�r�r�rUrL)rrPr4r5Zhas_device_fieldsr�r�Zfiletype�partsrTr�r6r6r7rUs8
&zTarInfo._create_headercCs.tt|�t�\}}|dkr*|t|t7}|S)zdReturn the string payload filled with zero bytes
           up to the next 512 byte border.
        r)rYr0r�r1)Zpayloadr`rar6r6r7�_create_payloadszTarInfo._create_payloadcCsR|j||�t}i}d|d<||d<t|�|d<t|d<|j|t||�|j|�S)zTReturn a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence
           for name.
        z
././@LongLinkr�r�r'r)r/r1r0rrr
r9)r1r�r�r4r5rr6r6r7r �szTarInfo._create_gnu_long_headercCs:d}x@|j�D]4\}}y|jdd�Wqtk
r@d}PYqXqWd}|rV|d7}x�|j�D]�\}}|jd�}|r�|j|d�}n
|jd�}t|�t|�d}d	}	}
x"|tt|
��}	|	|
kr�P|	}
q�W|tt|
�d
�d|d|d
7}q`Wi}d|d<||d<t|�|d<t|d<|j|td
d�|j	|�S)z�Return a POSIX.1-2008 extended or global header sequence
           that contains a list of keyword, value pairs. The values
           must be strings.
        Fzutf-8rCTr�s21 hdrcharset=BINARY
rr�rrB� �=�
z././@PaxHeaderr�r�r'rr�)
rr/r)r0r,rLrrr
r9)r1rr�r4Zbinary�keywordrZrecords�lrIr<rr6r6r7r-�s<

*z"TarInfo._create_pax_generic_headercCstt|�dkrtd��t|�tkr(td��|jt�tkr>td��t|dd��}|t|�krbt	d��|�}t
|dd�||�|_t|dd	��|_t|d	d
��|_
t|d
d��|_t|dd��|_t|dd��|_||_|dd
�|_t
|d
d�||�|_t
|dd�||�|_t
|dd�||�|_t|dd��|_t|dd��|_t
|dd�||�}|jtk�r�|jjd��r�t|_|jtk�r6d}g}xrtd�D]f}	y0t|||d��}
t||d|d��}Wntk
�r�PYnX|j|
|f�|d7}�q�Wt|d�}t|dd��}
|||
f|_ |j!��rN|jj"d�|_|�rp|jt#k�rp|d|j|_|S)zAConstruct a TarInfo object from a 512 byte bytes object.
        rzempty headerztruncated headerzend of file header��zbad checksumr�l�t�|��ii	i)iIiQiYi�r�i�r�r$�i�i�i�)$r0rur�rv�countr1rwrKrUrHr=r�rhr)r*r'r(r�r�r�r+r,r�r��AREGTYPEr�r�GNUTYPE_SPARSErEr.r��boolrr��rstrip�	GNU_TYPES)r1rTr4r5r��objrr��structsrJr��numbytes�
isextended�origsizer6r6r7�frombuf�sZ
zTarInfo.frombufcCs8|jjt�}|j||j|j�}|jj�t|_|j|�S)zOReturn the next TarInfo object from TarFile object
           tarfile.
        )	r�rZr�rRr4r5r�r��_proc_member)r1r�rTrMr6r6r7�fromtarfileszTarInfo.fromtarfilecCsT|jttfkr|j|�S|jtkr,|j|�S|jtttfkrF|j	|�S|j
|�SdS)zYChoose the right processing method depending on
           the type and call it.
        N)r�r"r!�
_proc_gnulongrI�_proc_sparser.r0�SOLARIS_XHDTYPE�	_proc_pax�
_proc_builtin)r�r�r6r6r7rS!s



zTarInfo._proc_membercCsR|jj�|_|j}|j�s$|jtkr4||j|j�7}||_|j	|j
|j|j�|S)zfProcess a builtin type or an unknown type which
           will be treated as a regular file.
        )
r�r�r�r�r��SUPPORTED_TYPES�_blockr'r��_apply_pax_inforr4r5)r�r�r�r6r6r7rY.szTarInfo._proc_builtincCs�|jj|j|j��}y|j|�}Wntk
r>td��YnX|j|_|jt	krft
||j|j�|_
n|jtkr�t
||j|j�|_|S)zSProcess the blocks that hold a GNU longname
           or longlink member.
        z missing or bad subsequent header)r�rZr[r'rTrrxr�r�r"r=r4r5r�r!r�)r�r�rT�nextr6r6r7rU?s

zTarInfo._proc_gnulongc
Cs�|j\}}}|`x�|r�|jjt�}d}xvtd�D]j}y0t|||d��}t||d|d��}	Wntk
rzPYnX|r�|	r�|j||	f�|d7}q0Wt|d�}qW||_	|jj
�|_|j|j|j
�|_||_
|S)z8Process a GNU sparse header plus extra headers.
        r�r$rFi�)rr�rZr�rErKr.r�rJr�r�r�r[r'r�)
r�r�rNrPrQrTr�rJr�rOr6r6r7rVUs(zTarInfo._proc_sparsecCs�|jj|j|j��}|jtkr&|j}n
|jj�}d}d}g}�x0t|�|koV||dk�rnt	j
||�}|srtd��yt|j
d��}Wntk
r�td��YnX|dkr�td��||t|�kr�td��|jd�|d}	||jd�d|	�}
|
jd�\}}}
|�s"|dk�s"||	dk�r*td��|j|||
f�|dk�rd|dk�rd|
d	k�r`|j}nd
}||7}q@W|dk�r~d
}x`|D]X\}}}
|j|d
d
|j�}|tk�r�|j|
||j|j�}n|j|
d
d
|j�}|||<�q�Wy|j|�}Wntk
�rtd��YnXd|k�r&|j||�nFd
|k�r>|j||�n.|jd�dk�rl|jd�dk�rl|j|||�|jttfk�r�|j ||j|j�|j!|_!d|k�r�|j"}|j#��s�|jt$k�r�||j|j�7}||_!|S)zVProcess an extended or global header as described in
           POSIX.1-2008.
        rNzinvalid headerr#�r;r�s
hdrcharsetsBINARYzutf-8z missing or bad subsequent headerzGNU.sparse.mapzGNU.sparse.sizezGNU.sparse.major�1zGNU.sparse.minorrDr')%r�rZr[r'r�r0rrr0�_header_length_prefix_re�matchrHrF�groupr.r�rk�	partitionr�r4�_decode_pax_fieldr5�PAX_NAME_FIELDSrTrrx�_proc_gnusparse_01�_proc_gnusparse_00r5�_proc_gnusparse_10r.rWr\r�r�r�rZ)r�r�rTrr�r4�raw_headersrbr3Zheader_value_end_offsetZkeyword_and_valueZraw_keywordZequalsZ	raw_valuer=rr]r�r6r6r7rXqsx

 







 
zTarInfo._proc_paxcCs�g}g}x�|D]�\}}}|dkrVy|jt|j���Wq�tk
rRtd��Yq�Xq|dkry|jt|j���Wqtk
r�td��YqXqWtt||��|_dS)z?Process a GNU tar extended sparse header, version 0.0.
        sGNU.sparse.offsetzinvalid headersGNU.sparse.numbytesN)r�rFr;r.rH�list�zipr�)r�r]rjZoffsetsrO�_r=rr6r6r7rh�szTarInfo._proc_gnusparse_00cCs@dd�|djd�D�}tt|ddd�|ddd���|_dS)z?Process a GNU tar extended sparse header, version 0.1.
        cSsg|]}t|��qSr6)rF)�.0�xr6r6r7�
<listcomp>sz.TarInfo._proc_gnusparse_01.<locals>.<listcomp>zGNU.sparse.map�,Nr$r#)r3rkrlr�)r�r]rr�r6r6r7rg�szTarInfo._proc_gnusparse_01cCs�d}g}|jjt�}|jdd�\}}t|�}xJt|�|dkrvd|krV||jjt�7}|jdd�\}}|jt|��q.W|jj�|_t	t
|ddd�|ddd���|_dS)z?Process a GNU tar extended sparse header, version 1.0.
        Nr<r#r$)r�rZr�r3rFr0r�r�r�rkrlr�)r�r]rr�Zfieldsr�rTZnumberr6r6r7riszTarInfo._proc_gnusparse_10c
Cs�x�|j�D]�\}}|dkr(t|d|�q
|dkrBt|dt|��q
|dkr\t|dt|��q
|tkr
|tkr�yt||�}Wntk
r�d}YnX|dkr�|jd�}t|||�q
W|j�|_dS)	zoReplace fields with supplemental information from a previous
           pax extended or global header.
        zGNU.sparse.namer%zGNU.sparse.sizer'zGNU.sparse.realsizerr�N)	r�setattrrF�
PAX_FIELDS�PAX_NUMBER_FIELDSr.rKrr)r�rr4r5r=rr6r6r7r\s"

zTarInfo._apply_pax_infocCs.y|j|d�Stk
r(|j||�SXdS)z1Decode a single field from a pax record.
        rCN)r;�UnicodeDecodeError)r�rr4Zfallback_encodingZfallback_errorsr6r6r7re,szTarInfo._decode_pax_fieldcCs"t|t�\}}|r|d7}|tS)z_Round up a byte count by BLOCKSIZE and return it,
           e.g. _block(834) => 1024.
        r#)rYr�)r�rGr`rar6r6r7r[4szTarInfo._blockcCs
|jtkS)N)r��
REGULAR_TYPES)r�r6r6r7r�=sz
TarInfo.isregcCs|j�S)N)r�)r�r6r6r7�isfile?szTarInfo.isfilecCs
|jtkS)N)r�r)r�r6r6r7r�Asz
TarInfo.isdircCs
|jtkS)N)r��SYMTYPE)r�r6r6r7r�Csz
TarInfo.issymcCs
|jtkS)N)r��LNKTYPE)r�r6r6r7r�Esz
TarInfo.islnkcCs
|jtkS)N)r�r6)r�r6r6r7�ischrGsz
TarInfo.ischrcCs
|jtkS)N)r�r7)r�r6r6r7�isblkIsz
TarInfo.isblkcCs
|jtkS)N)r��FIFOTYPE)r�r6r6r7�isfifoKszTarInfo.isfifocCs
|jdk	S)N)r�)r�r6r6r7�issparseMszTarInfo.issparsecCs|jtttfkS)N)r�r6r7r|)r�r6r6r7�isdevOsz
TarInfo.isdevN)r�rhr)r*r'r(r�r�r�r+r,r�r�r�r�rr�r�rr)r�)6rqrrrsrt�	__slots__r�rr�propertyr%rrr&r	r
r�rrrrrrr�classmethodr2r�staticmethodrr9r r-rRrTrSrYrUrVrXrhrgrir\rer[r�rwr�r�r�rzr{r}r~rr6r6r6r7rssf



1*
3?
z	c
@s�eZdZdZdZdZdZdZeZ	e
ZdZe
ZeZdZdkdd	�Zedddefd
d��Zedldd
��Zedmdd��Zedndd��Zedodd��Zddddd�Zdd�Zdd�Zdd�Zd d!�Zdpd"d#�Zdqdd%�d&d'�Z drdd(�d)d*�Z!dsd+d,�Z"d-d.�Z#dtddd0�d1d2�Z$d3d4�Z%duddd0�d6d7�Z&d8d9�Z'dvd:d;�Z(d<d=�Z)d>d?�Z*d@dA�Z+dwdddB�dCdD�Z,dEdF�Z-dGdH�Z.dIdJ�Z/dKdL�Z0dMdN�Z1dOdP�Z2dQdR�Z3dSdT�Z4dUdV�Z5dWdX�Z6dYdZ�Z7dxd[d\�Z8d]d^�Z9dyd_d`�Z:dadb�Z;dcdd�Z<dedf�Z=dgdh�Z>didj�Z?dS)zrz=The TarFile Class provides an interface to tar archives.
    rFr#NrzrcCs�ddddd�}||krtd��||_|||_|sj|jdkrVtjj|�rVd|_d|_t||j�}d	|_n@|d
kr�t|d�r�t	|j
ttf�r�|j
}t|d�r�|j|_d
|_|r�tjj
|�nd
|_
||_|d
k	r�||_|d
k	r�||_|d
k	r�||_|d
k	�r||_|d
k	�r||_|	|_|
d
k	�r4|jtk�r4|
|_ni|_|d
k	�rJ||_|d
k	�rZ||_|
|_d	|_g|_d	|_|jj�|_i|_�y�|jdk�r�d
|_ |j!�|_ |jdk�r8x�|jj"|j�y|jj#|�}|jj$|�WnTt%k
�r|jj"|j�PYn0t&k
�r0}zt't|���WYd
d
}~XnX�q�W|jdk�r�d
|_|j�r�|jj(|jj)��}|jj*|�|jt+|�7_Wn&|j�s�|jj,�d
|_�YnXd
S)a�Open an (uncompressed) tar archive `name'. `mode' is either 'r' to
           read from an existing archive, 'a' to append data to an existing
           file or 'w' to create a new file overwriting an existing one. `mode'
           defaults to 'r'.
           If `fileobj' is given, it is used for reading or writing data. If it
           can be determined, `mode' is overridden by `fileobj's mode.
           `fileobj' is not closed, when TarFile is closed.
        �rbzr+b�wbZxb)rz�ar{roz!mode must be 'r', 'a', 'w' or 'x'r�r{FNr�rhTrzro)r�r{ro)-r.rh�_moder}r%�exists�	bltn_openr�r�r*r�r,rL�abspathr�rPr��dereference�ignore_zerosr4r5rr�debug�
errorlevel�copybufsizer��members�_loadedr�r��inodes�firstmemberr]r�rTr�rwrrr2rr[r0r�)r�r�rhr�rPr�r�r�r4r5rr�r�r�Zmodes�erTr6r6r7r�os�






$
zTarFile.__init__c

s�|r|rtd��|dkr��fdd�}xtt�j|d�D]b}t��j|�}|dk	r\|j�}	y||d|f|�Sttfk
r�|dk	r�|j|	�w8Yq8Xq8Wtd���nd	|k�r|jd	d
�\}
}|
p�d}
|p�d}|�jkr�t��j|�}ntd|��|||
|f|�Sd
|k�r�|jd
d
�\}
}|
�p.d}
|�p8d}|
dk�rLtd��t	||
|||�}y�||
|f|�}Wn|j
��YnXd|_|S|dk�r��j|||f|�Std��dS)a�Open a tar archive for reading, writing or appending. Return
           an appropriate TarFile class.

           mode:
           'r' or 'r:*' open for reading with transparent compression
           'r:'         open for reading exclusively uncompressed
           'r:gz'       open for reading with gzip compression
           'r:bz2'      open for reading with bzip2 compression
           'r:xz'       open for reading with lzma compression
           'a' or 'a:'  open for appending, creating the file if necessary
           'w' or 'w:'  open for writing without compression
           'w:gz'       open for writing with gzip compression
           'w:bz2'      open for writing with bzip2 compression
           'w:xz'       open for writing with lzma compression

           'x' or 'x:'  create a tarfile exclusively without compression, raise
                        an exception if the file is already created
           'x:gz'       create a gzip compressed tarfile, raise an exception
                        if the file is already created
           'x:bz2'      create a bzip2 compressed tarfile, raise an exception
                        if the file is already created
           'x:xz'       create an lzma compressed tarfile, raise an exception
                        if the file is already created

           'r|*'        open a stream of tar blocks with transparent compression
           'r|'         open an uncompressed stream of tar blocks for reading
           'r|gz'       open a gzip compressed stream of tar blocks
           'r|bz2'      open a bzip2 compressed stream of tar blocks
           'r|xz'       open an lzma compressed stream of tar blocks
           'w|'         open an uncompressed stream for writing
           'w|gz'       open a gzip compressed stream for writing
           'w|bz2'      open a bzip2 compressed stream for writing
           'w|xz'       open an lzma compressed stream for writing
        znothing to openrz�r:*cs�j|dkS)N�taropen)�	OPEN_METH)r�)r1r6r7�not_compressedsz$TarFile.open.<locals>.not_compressed)�keyNz%file could not be opened successfully�:r#r�zunknown compression type %r�|r{zmode must be 'r' or 'w'Fr�rozundiscernible mode)rzr�)rzr{)r�r{ro)
r.�sortedr�rlr�rrr�r3r�r�r�r�)
r1r�rhr�r_�kwargsr�r��funcZ	saved_posrg�streamr�r6)r1r7r�sP%







zTarFile.opencKs |dkrtd��||||f|�S)zCOpen uncompressed tar archive name for reading or writing.
        rzr�r{roz!mode must be 'r', 'a', 'w' or 'x')rzr�r{ro)r.)r1r�rhr�r�r6r6r7r�9szTarFile.taropenr�cKs�|dkrtd��yddl}|jWn ttfk
rBtd��YnXy|j||d||�}Wn.tk
r�|dk	r�|dkr�td	���YnXy|j|||f|�}WnBtk
r�|j	�|dkr�td	���Yn|j	��YnXd
|_
|S)zkOpen gzip compressed tar archive name for reading or writing.
           Appending is not allowed.
        rzr{rozmode must be 'r', 'w' or 'x'rNzgzip module is not availablerbznot a gzip fileF)rzr{ro)r.�gzipZGzipFiler��AttributeErrorrr�rr�r�r�)r1r�rhr��
compresslevelr�r�r�r6r6r7�gzopenAs2
zTarFile.gzopencKs�|dkrtd��yddl}Wntk
r8td��YnX|j|pD|||d�}y|j|||f|�}WnFttfk
r�|j�|dkr�t	d	���Yn|j��YnXd
|_
|S)zlOpen bzip2 compressed tar archive name for reading or writing.
           Appending is not allowed.
        rzr{rozmode must be 'r', 'w' or 'x'rNzbz2 module is not available)r�znot a bzip2 fileF)rzr{ro)r.r�r�rZBZ2Filer�r��EOFErrorr�rr�)r1r�rhr�r�r�r�r�r6r6r7�bz2opencs(zTarFile.bz2opencKs�|dkrtd��yddl}Wntk
r8td��YnX|j|pD|||d�}y|j|||f|�}WnH|jtfk
r�|j�|dkr�t	d	���Yn|j��YnXd
|_
|S)zkOpen lzma compressed tar archive name for reading or writing.
           Appending is not allowed.
        rzr{rozmode must be 'r', 'w' or 'x'rNzlzma module is not available)�presetznot an lzma fileF)rzr{ro)r.r�r�rZLZMAFiler�r�r�r�rr�)r1r�rhr�r�r�r�r�r6r6r7�xzopen�s&zTarFile.xzopenr�r�r�r�)r�r�r�r�c
Cs�|jr
dSd|_z`|jdkrn|jjttd�|jtd7_t|jt�\}}|dkrn|jjtt|�Wd|j	s�|jj
�XdS)	zlClose the TarFile. In write-mode, two finishing zero blocks are
           appended to the archive.
        NTr�r{ror$r)r�r{ro)r�rhr�r[r1r�r�rY�
RECORDSIZEr�r�)r�r`rar6r6r7r��s
z
TarFile.closecCs"|j|�}|dkrtd|��|S)aReturn a TarInfo object for member `name'. If `name' can not be
           found in the archive, KeyError is raised. If a member occurs more
           than once in the archive, its last occurrence is assumed to be the
           most up-to-date version.
        Nzfilename %r not found)�
_getmember�KeyError)r�r�r�r6r6r7�	getmember�s
zTarFile.getmembercCs|j�|js|j�|jS)z�Return the members of the archive as a list of TarInfo objects. The
           list has the same order as the members in the archive.
        )�_checkr��_loadr�)r�r6r6r7�
getmembers�szTarFile.getmemberscCsdd�|j�D�S)z�Return the members of the archive as a list of their names. It has
           the same order as the list returned by getmembers().
        cSsg|]
}|j�qSr6)r�)rnr�r6r6r7rp�sz$TarFile.getnames.<locals>.<listcomp>)r�)r�r6r6r7�getnames�szTarFile.getnamescCsp|jd�|dk	r|j}|dkr$|}tjj|�\}}|jtjd�}|jd�}|j�}||_	|dkr�t
td�r�|jr�tj|�}q�tj
|�}ntj|j��}d}|j}t
j|��r|j|jf}	|jr�|jdkr�|	|jkr�||j|	kr�t}
|j|	}nt}
|	d�rx||j|	<nht
j|��r"t}
nVt
j|��r4t}
nDt
j|��rPt}
tj|�}n(t
j|��rbt }
nt
j!|��rtt"}
ndS||_||_#|j$|_%|j&|_'|
tk�r�|j(|_)nd|_)|j*|_+|
|_,||_-t.�r�yt.j/|j%�d|_0Wnt1k
�r�YnXt2�r*yt2j3|j'�d|_4Wnt1k
�r(YnX|
t t"fk�rlt
td��rlt
td	��rltj5|j6�|_7tj8|j6�|_9|S)
a�Create a TarInfo object from the result of os.stat or equivalent
           on an existing file. The file is either named by `name', or
           specified as a file object `fileobj' with a file descriptor. If
           given, `arcname' specifies an alternative name for the file in the
           archive, otherwise, the name is taken from the 'name' attribute of
           'fileobj', or the 'name' argument. The name should be a text
           string.
        �awxNr��lstatr�r#r�major�minor):r�r�r}r%�
splitdriver�r�r�r�r�r�r�r�rf�fstat�fileno�st_mode�S_ISREG�st_ino�st_dev�st_nlinkr�ryr�S_ISDIRr�S_ISFIFOr|�S_ISLNKrx�readlink�S_ISCHRr6�S_ISBLKr7rh�st_uidr)�st_gidr*�st_sizer'�st_mtimer(r�r��pwd�getpwuidr+r��grpZgetgrgidr,r��st_rdevr�r�r�)r�r��arcnamer�Zdrvr�Zstatresr�Zstmd�inoder�r6r6r7�
gettarinfo�s~	




zTarFile.gettarinfoT)r�cCs0|j�|dkr|}�x|D�]
}|r�|jdkr:td�nttj|j��td|jpX|j|jpb|jf�|j	�sz|j
�r�tdd|j|jf�ntd|j
�|jdkr�td�ntdtj|j�dd	��t|j|j�r�d
nd�|�r"|j��r
td|j�|j��r"td
|j�t�qWdS)aPrint a table of contents to sys.stdout. If `verbose' is False, only
           the names of the members are printed. If it is True, an `ls -l'-like
           output is produced. `members' is optional and must be a subset of the
           list returned by getmembers().
        Nz
??????????z%s/%sz%10sz%d,%dz%10dz????-??-?? ??:??:??z%d-%02d-%02d %02d:%02d:%02dr�r�r�z-> zlink to )r�rhrprfrgr+r)r,r*rzr{r�r�r'r(r�Z	localtimer�r�r�r�r�ro)r��verboser�r�r6r6r7rk;s2





zTarFile.list)�filterc	
Csv|jd�|dkr|}|dk	rPddl}|jdtd�||�rP|jdd|�dS|jdk	r�tjj|�|jkr�|jdd|�dS|jd|�|j	||�}|dkr�|jdd	|�dS|dk	r�||�}|dkr�|jdd|�dS|j
��rt|d
��}|j||�WdQRXnd|j
��rh|j|�|�rrxHtj|�D].}|jtjj||�tjj||�|||d��q4Wn
|j|�dS)a~Add the file `name' to the archive. `name' may be any type of file
           (directory, fifo, symbolic link, etc.). If given, `arcname'
           specifies an alternative name for the file in the archive.
           Directories are added recursively by default. This can be avoided by
           setting `recursive' to False. `exclude' is a function that should
           return True for each filename to be excluded. `filter' is a function
           that expects a TarInfo object argument and returns the changed
           TarInfo object, if it returns None the TarInfo object will be
           excluded from the archive.
        r�Nrzuse the filter argument insteadr$ztarfile: Excluded %rztarfile: Skipped %rr#ztarfile: Unsupported type %rr�)r�)r�rcrdre�_dbgr�r}r%r�r�r�r��addfiler��listdir�addr�)	r�r�r��	recursiveZexcluder�rcr��fr6r6r7r�asB



zTarFile.addcCs�|jd�tj|�}|j|j|j|j�}|jj|�|jt	|�7_|j
}|dk	r�t||j|j|d�t
|jt�\}}|dkr�|jjtt|�|d7}|j|t7_|jj|�dS)aAdd the TarInfo object `tarinfo' to the archive. If `fileobj' is
           given, it should be a binary file, and tarinfo.size bytes are read
           from it and added to the archive. You can create TarInfo objects
           directly, or by using gettarinfo().
        r�N)r_rr#)r�rrrPr4r5r�r[r�r0r�rXr'rYr�r1r�r�)r�r�r�rTr_r`rar6r6r7r��s

zTarFile.addfilec"CsH|dk�r|j}|dk�r�tjjd�}|dkr�ytt�}Wntk
rNYnBXddl}|jddd�}|�|j	|�WdQRX|jdddd�}|r�yt
|}Wn&tk
r�td|�d	��d�YnX||_|St
�r�tjdt�tStSt|t��rtd��|St|��r|Syt
|Stk
�rBtd|�d	��d�YnXdS)NZ PYTHON_TARFILE_EXTRACTION_FILTERr�#)Z
interpolationZcomment_prefixesr�r�)Zfallbackzfilter z
 not foundz4The default behavior of tarfile extraction has been z$changed to disallow common exploits z(including CVE-2007-4559). z1By default, absolute/parent paths are disallowed z and some mode bits are cleared. z/See https://access.redhat.com/articles/7004769 zfor more details.z#String names are not supported for z2TarFile.extraction_filter. Use a function such as ztarfile.data_filter directly.)r�zXThe default behavior of tarfile extraction has been changed to disallow common exploits zsThe default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). z�The default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed z�The default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. z�The default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. See https://access.redhat.com/articles/7004769 aThe default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. See https://access.redhat.com/articles/7004769 for more details.zUString names are not supported for TarFile.extraction_filter. Use a function such as zrString names are not supported for TarFile.extraction_filter. Use a function such as tarfile.data_filter directly.)�extraction_filterr}�environr5r��_CONFIG_FILENAME�FileNotFoundError�configparserZConfigParserZ	read_file�_NAMED_FILTERSr�r.�_RH_SAFER_DEFAULTrcrd�RuntimeWarningr�r�r*r,�	TypeError�callable)r�r�r��filer�Zconfr6r6r7�_get_filter_function�sR


zTarFile._get_filter_function�.)�
numeric_ownerr�c"Cs�g}|j|�}|dkr|}xT|D]L}|j|||�\}}	|dkr@q |j�rR|j|	�|j|||j�||d�q W|jdd�dd��x$|D�]}	y�y||	|�}Wn4tk
r�}
z|j|	t|
��w�WYdd}
~
XnX|dkr�|j|	d�w�t	j
j||j�}yt	j
|�}Wn$tk
�r.|j|d�w�YnXtj|j��sL|j|d	�w�|j|||d
�|j||�|j||�Wq�tk
�r�}
z|j|
�WYdd}
~
Xq�Xq�WdS)a�Extract all members from the archive to the current working
           directory and set owner, modification time and permissions on
           directories afterwards. `path' specifies a different directory
           to extract to. `members' is optional and must be a subset of the
           list returned by getmembers(). If `numeric_owner` is True, only
           the numbers for user/group names are used and not the names.

           The `filter` function will be called on each member just
           before extraction.
           It can return a changed TarInfo or None to skip the member.
           String names of common filters are accepted.
        N)�	set_attrsr��filter_functioncSs|jS)N)r�)r�r6r6r7�<lambda>	sz$TarFile.extractall.<locals>.<lambda>T)r��reversezexcluded by filterZmissingznot a directory)r�)r��_get_extract_tarinfor�r��_extract_one�sort�_FILTER_ERRORS�_log_no_directory_fixup�reprr}r%r�r�r�r�rfr�r��chown�utime�chmodr
�_handle_nonfatal_error)r�r%r�r�r�Zdirectoriesr�r�r��
unfiltered�exc�dirpathr�r�r6r6r7�
extractall�sP


zTarFile.extractallcCs|jdd|j|f�dS)Nr$z(tarfile: Not fixing up directory %r (%s))r�r�)r�r��reasonr6r6r7r�1	szTarFile._log_no_directory_fixupr�c	Cs8|j|�}|j|||�\}}|dk	r4|j||||�dS)a�Extract a member from the archive to the current working directory,
           using its full name. Its file information is extracted as accurately
           as possible. `member' may be a filename or a TarInfo object. You can
           specify a different directory using `path'. File attributes (owner,
           mtime, mode) are set unless `set_attrs' is False. If `numeric_owner`
           is True, only the numbers for user/group names are used and not
           the names.

           The `filter` function will be called before extraction.
           It can return a changed TarInfo or None to skip the member.
           String names of common filters are accepted.
        N)r�r�r�)	r�r�r%r�r�r�r�r�r�r6r6r7�extract5	s

zTarFile.extractcCs�t|t�r|j|�}n|}d}y|||�}WnZttfk
r\}z|j|�WYdd}~Xn,tk
r�}z|j|�WYdd}~XnX|dkr�|jdd|j	�dS|j
�r�tj|�}tj
j||j�|_||fS)z�Get (filtered, unfiltered) TarInfos from *member*

        *member* might be a string.

        Return (None, None) if not found.
        Nr$ztarfile: Excluded %r)NN)r*r,r�r�r��_handle_fatal_errorr
r�r�r�r�rr}r%r�r�r)r�r�r�r%r��filteredr�r6r6r7r�I	s"

zTarFile._get_extract_tarinfocCs�|jd�y&|j|tjj||j�||||d�WnVtk
r\}z|j|�WYdd}~Xn,tk
r�}z|j	|�WYdd}~XnXdS)z�Extract from filtered tarinfo to disk.

           filter_function is only used when extracting a *different*
           member (e.g. as fallback to creating a symlink)
        rz)r�r�r��extraction_rootN)
r��_extract_memberr}r%r�r�r�r�r
r�)r�r�r%r�r�r�r�r6r6r7r�g	s
zTarFile._extract_onecCs"|jdkr�n|jdd|�dS)z=Handle non-fatal error (ExtractError) according to errorlevelr#ztarfile: %sN)r�r�)r�r�r6r6r7r�{	s
zTarFile._handle_nonfatal_errorcCsn|jdkr�n\t|t�rP|jdkr6|jdd|j�qj|jdd|j|jf�n|jddt|�j|f�dS)z1Handle "fatal" error according to self.errorlevelrNr#ztarfile: %sztarfile: %s %rztarfile: %s %s)r�r*r��filenamer��strerrorr�rq)r�r�r6r6r7r��	s


zTarFile._handle_fatal_errorcCs�|jd�t|t�r |j|�}n|}|j�s6|jtkrB|j||�S|j�sR|j	�rzt|j
t�rhtd��q~|j
|j|��SndSdS)z�Extract a member from the archive as a file object. `member' may be
           a filename or a TarInfo object. If `member' is a regular file or a
           link, an io.BufferedReader object is returned. Otherwise, None is
           returned.
        rzz'cannot extract (sym)link as file objectN)r�r*r,r�r�r�rZ�
fileobjectr�r�r�r�r	�extractfile�_find_link_target)r�r�r�r6r6r7r��	s


zTarFile.extractfile)r�r�cCs\|jd�}|jdtj�}tjj|�}|r@tjj|�r@tj|�|j�sP|j	�rj|j
dd|j|jf�n|j
d|j�|j
�r�|j||�n�|j�r�|j||�n~|j�r�|j||�nh|j�s�|j�r�|j||�nJ|j�s�|j	�r�|j||||d�n&|jtk�r|j||�n|j||�|�rX|j|||�|j	��sX|j||�|j||�dS)z�Extract the filtered TarInfo object tarinfo to a physical
           file called targetpath.

           filter_function is only used when extracting a *different*
           member (e.g. as fallback to creating a symlink)
        r�r#z%s -> %s)r�r�N)rKr�r}r�r%r�r��makedirsr�r�r�r�r�r��makefiler��makedirr}�makefiforzr{�makedev�makelink_with_filterr�rZ�makeunknownr�r�r�)r�r��
targetpathr�r�r�r�Z	upperdirsr6r6r7r��	s:



zTarFile._extract_membercCs@y&|jdkrtj|�ntj|d�Wntk
r:YnXdS)z,Make a directory called targetpath.
        Ni�)rhr}�mkdir�FileExistsError)r�r�rr6r6r7r�	s
zTarFile.makedircCs�|j}|j|j�|j}t|d��f}|jdk	rrx,|jD]"\}}|j|�t|||t|�q6W|j|j�|j	�nt|||jt|�WdQRXdS)z'Make a file called targetpath.
        r�N)
r�r�r�r�r�r�rXrr'�truncate)r�r�r�sourcer_�targetr�r'r6r6r7r�	s


zTarFile.makefilecCs"|j||�|jdd|j�dS)zYMake a file from a TarInfo object with an unknown type
           at targetpath.
        r#z9tarfile: Unknown file type %r, extracted as regular file.N)rr�r�)r�r�rr6r6r7r
szTarFile.makeunknowncCs"ttd�rtj|�ntd��dS)z'Make a fifo called targetpath.
        �mkfifozfifo not supported by systemN)r�r}rr
)r�r�rr6r6r7r
s
zTarFile.makefifocCsnttd�sttd�r td��|j}|dkr2d}|j�rF|tjO}n
|tjO}tj||tj	|j
|j��dS)z<Make a character or block device called targetpath.
        �mknodrz'special devices not supported by systemNi�)r�r}r
rhr{rf�S_IFBLK�S_IFCHRrrr�r�)r�r�rrhr6r6r7r
s
zTarFile.makedevcCs|j||dd�S)N)r)r�r�rr6r6r7�makelink%
szTarFile.makelinkc	$Cs&d}yT|j�r6tjj|�r$tj|�tj|j|�dStjj|j�rVtj	|j|�dSWnt
k
rpd}YnXy|j|�}Wn$tk
r�|r�t
d��n�YnX|dkr�|}nR|dkr�t
d��y|||�}Wn2tk
�r}zt||j�|�WYdd}~XnX|dk	�r"|j||||d�dS)	a3Make a (symbolic) link called targetpath. If it cannot be created
          (platform limitation), we try to make a copy of the referenced file
          instead of a link.

          filter_function is only used when extracting a *different*
          member (e.g. as fallback to creating a link).
        FNTz%unable to resolve link inside archivez6makelink_with_filter: if filter_function is not None, z%extraction_root must also not be None)r�r�z[makelink_with_filter: if filter_function is not None, extraction_root must also not be None)r�r}r%�lexists�unlink�symlinkr�r�r�link�symlink_exceptionrr�r
r�r�r�r�)	r�r�rr�r�Zkeyerror_to_extracterrorr�r��causer6r6r7r(
sB	

 
zTarFile.makelink_with_filtercCs�ttd�r�tj�dkr�|j}|j}|s�ytrB|jrBtj|j�d}Wntk
rXYnXyt	rv|j
rvt	j|j
�d}Wntk
r�YnX|dkr�d}|dkr�d	}y4|j�r�ttd�r�tj
|||�ntj|||�Wntk
r�td��YnXdS)
z�Set owner of targetpath according to tarinfo. If numeric_owner
           is True, use .gid/.uid instead of .gname/.uname. If numeric_owner
           is False, fall back to .gid/.uid when the search based on name
           fails.
        �geteuidrr$Nr#�lchownzcould not change ownerr9r9)r�r}rr*r)r�r,Zgetgrnamr�r�r+�getpwnamr�rr�r�r
)r�r�rr��g�ur6r6r7r�Z
s0

z
TarFile.chowncCsL|jdkrdSttd�rHytj||j�Wntk
rFtd��YnXdS)zASet file permissions of targetpath according to tarinfo.
        Nr�zcould not change mode)rhr�r}r�r�r
)r�r�rr6r6r7r�{
s

z
TarFile.chmodcCsV|j}|dkrdSttd�s dSytj|||f�Wntk
rPtd��YnXdS)zBSet modification time of targetpath according to tarinfo.
        Nr�z"could not change modification time)r(r�r}r�r�r
)r�r�rr(r6r6r7r��
s
z
TarFile.utimecCs�|jd�|jdk	r$|j}d|_|S|j|jj�krZ|jj|jd�|jjd�sZtd��d}�xby|jj	|�}W�nHt
k
r�}z2|jr�|jdd|j|f�|jt
7_wbWYdd}~Xn�tk
�r,}zN|j�r|jdd|j|f�|jt
7_wbn|jdk�rtt|���WYdd}~Xn�tk
�rT|jdk�rPtd��Ynjtk
�r�}z|jdk�r~tt|���WYdd}~Xn0tk
�r�}ztt|���WYdd}~XnXPqbW|dk	�r�|jj|�nd	|_|S)
z�Return the next member of the archive as a TarInfo object, when
           TarFile is opened for reading. Return None if there is no more
           available.
        ZraNr#zunexpected end of datar$z0x%X: %srz
empty fileT)r�r�r�r�r�r�rZrr�rTrwr�r�r�rHr,rurvrxr�r�r�)r��mr�r�r6r6r7r]�
sL


zTarFile.nextc	Cs�|j�}d}|dk	rHy|j|�}Wntk
r:d}YnX|d|�}|rXtjj|�}xLt|�D]@}|r||j|jkrbd}qb|r�tjj|j�}n|j}||krb|SqbW|r�t|��dS)z}Find an archive member by name from bottom to top.
           If tarinfo is given, it is used as the starting point.
        FNT)	r��indexr.r}r%r��reversedr�r�)	r�r�r��	normalizer�Zskippingrr��member_namer6r6r7r��
s,
zTarFile._getmembercCs"x|j�}|dkrPqWd|_dS)zWRead through the entire archive file and look for readable
           members.
        NT)r]r�)r�r�r6r6r7r��
s
z
TarFile._loadcCs:|jrtd|jj��|dk	r6|j|kr6td|j��dS)znCheck if TarFile is still open, and if the operation's mode
           corresponds to TarFile's mode.
        z%s is closedNzbad operation for mode %r)r�r�r�rqrh)r�rhr6r6r7r��
szTarFile._checkcCs`|j�r.djtdtjj|j�|jf��}d}n
|j}|}|j||dd�}|dkr\t	d|��|S)zZFind the target member of a symlink or hardlink member in the
           archive.
        r�NT)r�r!zlinkname %r not found)
r�r�r�r}r%r�r�r�r�r�)r�r�r��limitr�r6r6r7rs zTarFile._find_link_targetccs�|jr|jEdHdSd}|jdk	r:|j�}|d7}|VxN|t|j�krV|j|}n"|jst|j�}|sxd|_dSndS|d7}|Vq<WdS)z$Provide an iterator object.
        Nrr#T)r�r�r�r]r0)r�rr�r6r6r7�__iter__s&
zTarFile.__iter__cCs||jkrt|tjd�dS)z.Write debugging output to sys.stderr.
        )r�N)r�rorm�stderr)r��level�msgr6r6r7r�7s
zTarFile._dbgcCs|j�|S)N)r�)r�r6r6r7�	__enter__=szTarFile.__enter__cCs,|dkr|j�n|js"|jj�d|_dS)NT)r�r�r�r�)r�r�r�	tracebackr6r6r7�__exit__As


zTarFile.__exit__)
NrzNNNNNNrNNNN)rzN)rzNr�)rzNr�)rzNN)NNN)T)NTN)N)r�N)r�T)N)TF)NF)N)@rqrrrsrtr�r�r�r�rrPrr4r5rr�r�r�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�rkr�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrr�r�r�r]r�r�r�rr$r�r(r*r6r6r6r7rSs�
lZ!

d&=
5D
62!6
(

	cCs.yt|�}|j�dStk
r(dSXdS)zfReturn True if name points to a tar archive that we
       are able to handle, else return False.
    TFN)rr�r)r�r�r6r6r7rOscCsddl}d}|j|d�}|jdddddd	�|jd
dtdd
�|j�}|jddddd�|jdddd5dd�|jdddd6dd�|jdddd d�|j�}|jr�|jr�|jd!d"�|j	�r*|j	}t
|��rt|d#�� }|j�t
|j�tjd$�WdQRX|j�r&t
d%j|��n|jd!d&j|���n�|j�r�|j}t
|��rjtj|d'��}|j|jd(�WdQRXn|jd!d&j|���n�|j�rPt|j�d!k�r�|jd}tj}n,t|j�d)k�r�|j\}}n|jd!|j��t
|��r<tj|d'��}|j||jd*�WdQRX|j�rN|d+k�r&d,j|�}	nd-j||�}	t
|	�n|jd!d&j|��n�|j�r�|jjd�}
tjj|
�\}}d.d.d/d/d0d0d0d0d1�}
||
k�r�d2|
|nd3}|j}tj|
|�� }x|D]}|j|��q�WWdQRX|j�rt
d4j|
��n|jd!|j��dS)7Nrz3A simple command line interface for tarfile module.)�descriptionz-vz	--verbose�
store_trueFzVerbose output)�action�default�helpz--filterz<filtername>zFilter for extraction)�metavar�choicesr/z-lz--list�	<tarfile>zShow listing of a tarfile)r0r/z-ez	--extract�+�<output_dir>zExtract tarfile into target dir)�nargsr0r/z-cz--create�<name>�<file>zCreate tarfile from sourcesz-tz--testzTest if a tarfile is validr#z&--filter is only valid for extraction
rz)r�z{!r} is a tar archive.z{!r} is not a tar archive.
zr:*)r�r$)r%r�r�z{!r} file is extracted.z+{!r} file is extracted into {!r} directory.r�r�r�)z.gzz.tgzz.xzz.txzz.bz2z.tbzz.tbz2z.tb2zw:r{z{!r} file created.)r2r4)r6r7)�argparse�ArgumentParser�add_argumentr�Zadd_mutually_exclusive_group�
parse_argsr�r��exitZtestrrr�rormr%r�rPrkrr0r}�curdirZformat_helpr�Zcreate�popr%�splitextr�)r8r+�parserrc�argsr\r�Ztfr=r'Ztar_namermZextZcompressionsZtar_modeZ	tar_files�	file_namer6r6r7�main]s�










rC�__main__)r%r&r'r(r)r*r+r,)T)trt�version�
__author__Z__date__Z	__cvsid__�__credits__�builtinsrr�rmr}r�rWrfr�rSr�rercr�r�r�r��NotImplementedErrorrr��	NameError�__all__r�r�r1r�r�rrrrr4rrHryrxr6r7rr|ZCONTTYPEr"r!rIr.r0rWr
rrrrZrvrLrsrfr+rFrtr�r�getfilesystemencodingr8r=rKrQrUrXrgrp�	Exceptionrr
rrr	rrurvrwrHrxryr��objectr�r��BufferedReaderr�r�r�r�r�r�r�r�r�r�r�r�r�r�r
�compilerarrrrCrqr6r6r6r7�<module>s&



wh



D
eb
fileinput.cpython-36.opt-2.pyc000064400000016677150335715140012156 0ustar003


 \�8�@s�ddlZddlZdddddddd	d
ddd
gZdad dd�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd	�Zdd
�ZGdd�d�Z
dd�Zd!dd
�Zdd�Zedkr�e�dS)"�N�input�close�nextfile�filename�lineno�
filelineno�fileno�isfirstline�isstdin�	FileInput�hook_compressed�hook_encodedF��rcCs(trtjrtd��t||||||�atS)Nzinput() already active)�_state�_file�RuntimeErrorr)�files�inplace�backup�bufsize�mode�openhook�r�!/usr/lib64/python3.6/fileinput.pyrSs	
cCst}da|r|j�dS)N)rr)�staterrrrascCststd��tj�S)Nzno active input())rrrrrrrris
cCststd��tj�S)Nzno active input())rrrrrrrrwscCststd��tj�S)Nzno active input())rrrrrrrr�scCststd��tj�S)Nzno active input())rrrrrrrr�scCststd��tj�S)Nzno active input())rrrrrrrr�scCststd��tj�S)Nzno active input())rrr	rrrrr	�scCststd��tj�S)Nzno active input())rrr
rrrrr
�sc@s�eZdZd(dd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�ZdS))rNFrrrcCs�t|t�r|f}n(|dkr(tjdd�}|s2d}nt|�}||_||_||_|rhddl}|j	dt
dd�d|_d|_d|_
d|_d|_d|_d|_d|_|dkr�td��d
|kr�ddl}|j	d
t
d�||_|r�|r�td��t|�s�td��||_dS)N��-rz!bufsize is deprecated and ignored�)�
stacklevelFr�rU�U�rbz=FileInput opening mode must be one of 'r', 'rU', 'U' and 'rb'z'U' mode is deprecatedz4FileInput cannot use an opening hook in inplace modez#FileInput openhook must be callable)r)rr r!r")�
isinstance�str�sys�argv�tuple�_files�_inplace�_backup�warnings�warn�DeprecationWarning�_savestdout�_output�	_filename�_startlineno�_filelinenor�_isstdin�_backupfilename�
ValueError�_mode�callable�	_openhook)�selfrrrrrrr+rrr�__init__�sF

zFileInput.__init__cCs|j�dS)N)r)r9rrr�__del__�szFileInput.__del__cCsz|j�Wdf|_XdS)N)rr()r9rrrr�szFileInput.closecCs|S)Nr)r9rrr�	__enter__�szFileInput.__enter__cCs|j�dS)N)r)r9�type�value�	tracebackrrr�__exit__�szFileInput.__exit__cCs|S)Nr)r9rrr�__iter__�szFileInput.__iter__cCs:x4|j�}|r |jd7_|S|js*t�|j�qWdS)Nr)�	_readliner2r�
StopIterationr)r9�linerrr�__next__�szFileInput.__next__cCs>||j�krtd��y|j�Stk
r8td��YnXdS)Nzaccessing lines out of orderzend of input reached)rrrErC�
IndexError)r9�irrr�__getitem__szFileInput.__getitem__c%Cs�|j}d|_|r|t_|j}d|_z|r0|j�Wd|j}d|_y|`Wntk
r\YnXz|rt|jrt|j�Wd|j	}d|_	|r�|j
r�ytj|�Wnt
k
r�YnXd|_XXdS)NF)r.r%�stdoutr/rrrB�AttributeErrorr3r4r*�os�unlink�OSError)r9Z
savestdout�output�fileZbackupfilenamerrrrs4zFileInput.nextfilecCs:x4|j�}|r |jd7_|S|js*|S|j�qWdS)Nr)rBr2rr)r9rDrrr�readline)szFileInput.readlinecCs�|jsd|jkrdSdS|jd|_|jdd�|_|j�|_d|_d|_d|_d|_|jdkr�d|_d|jkr�t	t
jd	t
j�|_nt
j|_d
|_�nV|j�r�|j|j
p�d|_ytj|j�Wntk
r�YnXtj|j|j�t|j|j�|_ytj|jj��j}Wn$tk
�r0t|jd�|_Yn~XtjtjBtjB}ttd
��rZ|tjO}tj|j||�}tj|d�|_yttd��r�tj|j|�Wntk
�r�YnXt
j|_|jt
_n,|j �r�|j |j|j�|_nt|j|j�|_|jj!|_"|j"�S)N�b�rrrFrz<stdin>�bufferTz.bak�w�O_BINARY�chmod)#r(r6r0rr1r2rr3r4�getattrr%�stdinr)r*rKrLrM�rename�open�fstatr�st_moder/�O_CREAT�O_WRONLY�O_TRUNC�hasattrrU�fdopenrVrIr.r8rPrB)r9Zpermr�fdrrrrB4s\







zFileInput._readlinecCs|jS)N)r0)r9rrrrnszFileInput.filenamecCs|j|jS)N)r1r2)r9rrrrqszFileInput.linenocCs|jS)N)r2)r9rrrrtszFileInput.filelinenocCs0|jr(y
|jj�Stk
r$dSXndSdS)Nr���rc)rrr5)r9rrrrws
zFileInput.filenocCs
|jdkS)Nr)r2)r9rrrr	�szFileInput.isfirstlinecCs|jS)N)r3)r9rrrr
�szFileInput.isstdin)NFrrrN)�__name__�
__module__�__qualname__r:r;rr<r@rArErHrrPrBrrrrr	r
rrrrr�s$

):	cCsVtjj|�d}|dkr,ddl}|j||�S|dkrHddl}|j||�St||�SdS)Nrz.gzrz.bz2)rK�path�splitext�gziprZ�bz2ZBZ2File)rrZextrirjrrrr�scs��fdd�}|S)Ncst||��d�S)N)�encoding�errors)rZ)rr)rkrlrrr�szhook_encoded.<locals>.openhookr)rkrlrr)rkrlrr
�scCs�ddl}d}d}|jtjdd�d�\}}x(|D] \}}|dkrDd}|dkr0|}q0Wxtt|||d�D]b}|dd�d	kr�|dd�}|dd�d
kr�|dd�}tdt�t�t�t�r�dp�d
|f�qdWtdt�t�t�f�dS)NrFrzib:z-iTz-b)rr�
�
z%d: %s[%d]%s %s�*rz
%d: %s[%d]rcrcrcrc)	�getoptr%r&r�printrrrr	)rprrZopts�args�o�arDrrr�_test�s"ru�__main__)NFrrrN)N)r%rK�__all__rrrrrrrrr	r
rrr
rurdrrrr�<module>Ks*


	

			Y
socket.cpython-36.opt-2.pyc000064400000034315150335715140011434 0ustar003


 \3k�
@slddlZddlTddlZddlZddlZddlZddlmZmZyddlZWne	k
rddZYnXe
edd�Ze
edd�Ze
edd�Z
d	d
ddd
gZejeje��ejdedd��ejd
edd��ejdedd��ejdedd��dZdZdd�ZeZejj�jd��r�iZded<ded<ded<d ed!<d"ed#<d$ed%<d&ed'<d(ed)<d*ed+<d,ed-<d.ed/<d0ed1<d2ed3<d4ed5<d6ed7<ejd8�Gd9d:�d:e�ZGd;d<�d<ej�ZdLd=d	�Ze ejd>��r�d?d@�Z!ejd@�e edA��rde"dfdBdA�Z#ne$e"dfdCdA�Z#ejdA�dDe#_%ee
hZ&GdEdF�dFej'�Z(dMdHd
�Z)e*�Z+e+dfdId�Z,dNdJdK�Z-dS)O�N)�*)�IntEnum�IntFlag�EBADF�	�EAGAIN��EWOULDBLOCK�fromfd�getfqdn�create_connection�
AddressFamily�
SocketKindcCs|j�o|jd�S)NZAF_)�isupper�
startswith)�C�r�/usr/lib64/python3.6/socket.py�<lambda>LsrcCs|j�o|jd�S)NZSOCK_)rr)rrrrrQsZMsgFlagcCs|j�o|jd�S)NZMSG_)rr)rrrrrVsZAddressInfocCs|j�o|jd�S)NZAI_)rr)rrrrr[sz	127.0.0.1z::1cCs"y||�Stk
r|SXdS)N)�
ValueError)�valueZ
enum_klassrrr�_intenum_converterasr�winzThe operation was interrupted.i'zA bad file handle was passed.i'zPermission denied.i'z!A fault occurred on the network??i'z#An invalid operation was attempted.i&'z The socket operation would blocki3'z,A blocking operation is already in progress.i4'zThe network address is in use.i@'zThe connection has been reset.iF'zThe network has been shut down.iJ'zThe operation timed out.iL'zConnection refused.iM'zThe name is too long.iO'zThe host is down.iP'zThe host is unreachable.iQ'�errorTabc@seZdZdS)�_GiveupOnSendfileN)�__name__�
__module__�__qualname__rrrrr�srcs0eZdZdddgZeeddfdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zd7dddd�dd�Z
eed�r~d8dd�Zn
d9dd�Zd:dd�Zdd�Zd;d d!�Zd"d#�Zejfd$d%�Zd&d'�Z�fd(d)�Ze�fd*d+��Ze�fd,d-��Zejd.k�rd/d0�Zd1d2�Znd3d0�Zd4d2�Zd5e_ d6e_ �Z!S)<�socket�__weakref__�_io_refs�_closedrNcCs$tjj|||||�d|_d|_dS)NrF)�_socketr�__init__r r!)�self�family�type�proto�filenorrrr#�szsocket.__init__cCs|S)Nr)r$rrr�	__enter__�szsocket.__enter__cGs|js|j�dS)N)r!�close)r$�argsrrr�__exit__�szsocket.__exit__cCs�t|dd�}d|jj|jj|r"dnd|j�|j|j|jf}|s�y |j�}|r^|dt	|�7}Wnt
k
rtYnXy |j�}|r�|dt	|�7}Wnt
k
r�YnX|d7}|S)	Nr!Fz,<%s.%s%s fd=%i, family=%s, type=%s, proto=%iz	 [closed]�z
, laddr=%sz
, raddr=%s�>)�getattr�	__class__rrr(r%r&r'�getsockname�str�errorZgetpeername)r$�closed�sZladdrZraddrrrr�__repr__�s0

zsocket.__repr__cCstd��dS)NzCannot serialize socket object)�	TypeError)r$rrr�__getstate__�szsocket.__getstate__cCs6t|j��}|j|j|j|j|d�}|j|j��|S)N)r()�dupr(r0r%r&r'�
settimeout�
gettimeout)r$�fd�sockrrrr9�sz
socket.dupcCsZ|j�\}}|jt�jdd�@}t|j||j|d�}t�dkrR|j�rR|j	d�||fS)NZ
SOCK_NONBLOCKr)r(T)
Z_acceptr&�globals�getrr%r'Zgetdefaulttimeoutr;�setblocking)r$r<�addrr&r=rrr�accept�s
z
socket.accept�r)�encoding�errors�newlinec
Cs�t|�dddhks td|f��d|k}d|kp4|}d|k}d}	|rN|	d7}	|rZ|	d7}	t||	�}
|jd7_|dkr~d	}|dkr�tj}|dkr�|s�td��|
S|r�|r�tj|
|
|�}n|r�tj|
|�}ntj|
|�}|r�|Stj	||||�}||_
|S)
NrC�w�bz&invalid mode %r (only r, w, b allowed)r-�rz!unbuffered streams must be binary���)�setr�SocketIOr �io�DEFAULT_BUFFER_SIZE�BufferedRWPair�BufferedReader�BufferedWriter�
TextIOWrapper�mode)
r$rS�	bufferingrDrErFZwritingZreadingZbinaryZrawmode�raw�buffer�textrrr�makefile�s<
zsocket.makefile�sendfilec2Cs�|j|||�|j�}y|j�}Wn0ttjfk
rR}zt|��WYdd}~XnXytj|�j}Wn*t	k
r�}zt|��WYdd}~XnX|s�dS|s�|n|}|j
�}	|	dkr�td��tt
d�r�t
j�}
nt
j�}
|
j|t
j�d}|
j}tj}
z�x�|	�r||	��rtjd��|�r0||}|dk�r0Py|
||||�}Wn^tk
�rf|	�s`|�w�Yq�t	k
�r�}z|dk�r�t|��|d�WYdd}~Xq�X|dk�r�P||7}||7}q�W|S|dk�r�t|d��r�|j|�XdS)Nrz&non-blocking sockets are not supported�PollSelectorz	timed out�seek)�_check_sendfile_paramsr(�AttributeErrorrM�UnsupportedOperationr�os�fstat�st_size�OSErrorr;r�hasattr�	selectorsrZZSelectSelector�registerZEVENT_WRITEZselectrYr"�timeout�BlockingIOErrorr[)r$�file�offset�countZsocknor(�errZfsize�	blocksizerfZselector�
total_sentZselector_selectZos_sendfile�sentrrr�_sendfile_use_sendfiles`





zsocket._sendfile_use_sendfilecCstd��dS)Nz,os.sendfile() not available on this platform)r)r$rhrirjrrrroGsc
Cs|j|||�|j�dkr"td��|r0|j|�|r>t|d�nd}d}|j}|j}z�x�|rrt|||�}|dkrrPt||��}|s�PxLy||�}	Wntk
r�w�Yq�X||	7}|	t	|�kr�||	d�}q�Pq�WqVW|S|dko�t
|d��r�|j||�XdS)Nrz&non-blocking sockets are not supportedi r[)r\r;rr[�min�read�send�
memoryviewrg�lenrc)
r$rhrirjrlrmZ	file_readZ	sock_send�datarnrrr�_sendfile_use_sendKs<

zsocket._sendfile_use_sendcCsddt|dd�krtd��|jt@s*td��|dk	r`t|t�sJtdj|���|dkr`tdj|���dS)NrHrSz$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})r)r/rr&�SOCK_STREAM�
isinstance�intr7�format)r$rhrirjrrrr\os

zsocket._check_sendfile_paramscCs2y|j|||�Stk
r,|j|||�SXdS)N)rorrv)r$rhrirjrrrrY|szsocket.sendfilecCs*|jdkr|jd8_|jr&|j�dS)NrrI)r r!r*)r$rrr�_decref_socketios�s
zsocket._decref_socketioscCs|j|�dS)N)r*)r$Z_ssrrr�_real_close�szsocket._real_closecCsd|_|jdkr|j�dS)NTr)r!r r|)r$rrrr*�s
zsocket.closecsd|_t�j�S)NT)r!�super�detach)r$)r0rrr~�sz
socket.detachcstt�jt�S)N)rr}r%r
)r$)r0rrr%�sz
socket.familycstt�jt�S)N)rr}r&r)r$)r0rrr&�szsocket.type�ntcCstj|j��S)N)r_Zget_handle_inheritabler()r$rrr�get_inheritable�szsocket.get_inheritablecCstj|j�|�dS)N)r_Zset_handle_inheritabler()r$�inheritablerrr�set_inheritable�szsocket.set_inheritablecCstj|j��S)N)r_r�r()r$rrrr��scCstj|j�|�dS)N)r_r�r()r$r�rrrr��sz&Get the inheritable flag of the socketz&Set the inheritable flag of the socket)rCN)rN)rN)rN)rN)"rrr�	__slots__�AF_INETrwr#r)r,r6r8r9rBrXrcr_rorvr\rYr{r"rr|r*r~�propertyr%r&�namer�r��__doc__�
__classcell__rr)r0rr�s:
	)
A

$


rcCst|�}t||||�S)N)r9r)r<r%r&r'Znfdrrrr
�sZsharecCstddd|�S)Nr)r)�inforrr�	fromshare�sr��
socketpairc
Csh|dkr*yt}Wntk
r(t}YnXtj|||�\}}t||||j��}t||||j��}||fS)N)ZAF_UNIX�	NameErrorr�r"r�rr~)r%r&r'�arHrrrr��s
c
Cs|tkrt}n|tkrt}ntd��|tkr4td��|dkrDtd��t|||�}z�|j|df�|j�|j	�dd�\}}t|||�}yP|j
d�y|j||f�Wntt
fk
r�YnX|j
d�|j�\}}	Wn|j��YnXWd|j�X||fS)Nz?Only AF_INET and AF_INET6 socket address families are supportedz)Only SOCK_STREAM socket type is supportedrzOnly protocol zero is supported�FT)r��
_LOCALHOSTZAF_INET6�
_LOCALHOST_V6rrwr�bindZlistenr1r@�connectrg�InterruptedErrorrBr*)
r%r&r'�hostZlsockrA�portZcsockZssock�_rrrr��s8


a8socketpair([family[, type[, proto]]]) -> (socket object, socket object)
Create a pair of socket objects from the sockets returned by the platform
socketpair() function.
The arguments are the same as for socket() except the default family is AF_UNIX
if defined on the platform; otherwise, the default is AF_INET.
csleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Z�fdd�Zd
d�Z	e
dd��Ze
dd��Zdd�Z
�ZS)rLcCsZ|d
krtd|��tjj|�||_d|kr6|d7}||_d|k|_d|k|_d	|_dS)NrCrG�rw�rb�wb�rwbzinvalid mode: %rrHF)rCrGr�r�r�r�)	rrM�	RawIOBaser#�_sock�_mode�_reading�_writing�_timeout_occurred)r$r=rSrrrr#0s

zSocketIO.__init__cCs�|j�|j�|jrtd��xby|jj|�Stk
rHd|_�Yq tk
r|}z|jdt	krjdS�WYdd}~Xq Xq WdS)Nz!cannot read from timed out objectTr)
�_checkClosed�_checkReadabler�rbr�Z	recv_intorfr3r+�_blocking_errnos)r$rH�errr�readinto<szSocketIO.readintocCsX|j�|j�y|jj|�Stk
rR}z|jdtkr@dS�WYdd}~XnXdS)Nr)r��_checkWritabler�rrr3r+r�)r$rHr�rrr�writeSszSocketIO.writecCs|jrtd��|jS)NzI/O operation on closed socket.)r4rr�)r$rrr�readablecszSocketIO.readablecCs|jrtd��|jS)NzI/O operation on closed socket.)r4rr�)r$rrr�writablejszSocketIO.writablecs|jrtd��t�j�S)NzI/O operation on closed socket.)r4rr}�seekable)r$)r0rrr�qszSocketIO.seekablecCs|j�|jj�S)N)r�r�r()r$rrrr(xszSocketIO.filenocCs|js|j�SdSdS)NrIrJ)r4r()r$rrrr�~sz
SocketIO.namecCs|jS)N)r�)r$rrrrS�sz
SocketIO.modecCs*|jr
dStjj|�|jj�d|_dS)N)r4rMr�r*r�r{)r$rrrr*�s

zSocketIO.close)rrrr#r�r�r�r�r�r(r�r�rSr*r�rr)r0rrLsrLr-cCsp|j�}|s|dkrt�}yt|�\}}}Wntk
rBYn*X|jd|�x|D]}d|krVPqVW|}|S)Nz0.0.0.0r�.)�stripZgethostnameZ
gethostbyaddrr3�insert)r�Zhostname�aliasesZipaddrsrrrr�s	
cCs�|\}}d}x�t||dt�D]�}|\}}}	}
}d}y>t|||	�}|tk	rR|j|�|r`|j|�|j|�d}|Stk
r�}
z|
}|dk	r�|j�WYdd}
~
XqXqW|dk	r�|�ntd��dS)Nrz!getaddrinfo returns an empty list)	�getaddrinforwr�_GLOBAL_DEFAULT_TIMEOUTr:r�r�r3r*)ZaddressrfZsource_addressr�r�rk�res�af�socktyper'�	canonname�sar=r�rrrr�s*


cCsTg}xJtj||||||�D]2}|\}}	}}
}|jt|t�t|	t�||
|f�qW|S)N)r"r��appendrr
r)r�r�r%r&r'�flagsZaddrlistr�r�r�r�r�rrrr��sr�)r)r-)rrrr).r"r_�sysrMrd�enumrr�errno�ImportErrorr/rrr	�__all__�extend�_get_exports_list�_convertrr�r�rrZ_realsocket�platform�lowerrrr��	Exceptionrr
rcr�rwr�r�r�r�r�rLr�objectr�rr�rrrr�<module>1s� 






C
	
$
u
'token.cpython-36.opt-1.pyc000064400000006372150335715140011265 0ustar003


 \�@sRdZddddgZdZdZdZdZd	Zd
ZdZdZ	d
Z
dZdZdZ
dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Zd"Zd#Z d$Z!d%Z"d&Z#d'Z$d(Z%d)Z&d*Z'd+Z(d,Z)d-Z*d.Z+d/Z,d0Z-d1Z.d2Z/d3Z0d4Z1d5Z2d6Z3d7Z4d8Z5d9Z6d:Z7d;Z8d<Z9d=Z:d>Z;d?Z<d@dA�e=�j>�D�Z?ej@e?jA��dBd�ZBdCd�ZCdDd�ZDdEdF�ZEeFdGk�rNeE�dHS)Iz!Token constants (from "token.h").�tok_name�
ISTERMINAL�
ISNONTERMINAL�ISEOF����������	�
���
������������������� �!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�0�1�2�3�4�5�6�7�8�9�cCs,i|]$\}}t|t�r|jd�r||�qS)�_)�
isinstance�int�
startswith)�.0�name�value�rG�/usr/lib64/python3.6/token.py�
<dictcomp>JsrIcCs|tkS)N)�	NT_OFFSET)�xrGrGrHrOscCs|tkS)N)rJ)rKrGrGrHrRscCs|tkS)N)�	ENDMARKER)rKrGrGrHrUscJCspddl}ddl}|jdd�}|r*|dp,d}d}t|�dkrF|d}yt|�}Wn@tk
r�}z$|jjdt|��|j	d�WYdd}~XnX|�|j
�jd�}WdQRX|jd|j
�}i}	x:|D]2}
|j|
�}|r�|jdd�\}}
t|
�}
||	|
<q�Wt|	j��}yt|�}WnBtk
�rZ}z$|jjdt|��|j	d�WYdd}~XnX|�|j
�jd�}WdQRXy|jd	�d}|jd
�}Wn,tk
�r�|jjd�|j	d�YnXg}x$|D]}
|jd
|	|
|
f��q�W||||�<yt|d�}WnBtk
�rJ}z$|jjdt|��|j	d�WYdd}~XnX|�|jdj|��WdQRXdS)NrrzInclude/token.hzLib/token.pyzI/O error: %s
�
z:#define[ 	][ 	]*([A-Z0-9][A-Z0-9_]*)[ 	][ 	]*([0-9][0-9]*)rz#--start constants--z#--end constants--z&target does not contain format markersrz%s = %d�wr	)�re�sys�argv�len�open�OSError�stdout�write�str�exit�read�split�compile�
IGNORECASE�match�grouprB�sorted�keys�stderr�index�
ValueError�append�join)rOrP�args�
inFileName�outFileName�fp�err�lines�prog�tokens�liner]rE�valr`�format�start�endrGrGrH�_mainYsb


rs�__main__N)G�__doc__�__all__rL�NAME�NUMBER�STRING�NEWLINE�INDENT�DEDENT�LPAR�RPAR�LSQB�RSQB�COLON�COMMA�SEMI�PLUS�MINUS�STAR�SLASH�VBAR�AMPER�LESS�GREATER�EQUAL�DOT�PERCENT�LBRACE�RBRACE�EQEQUAL�NOTEQUAL�	LESSEQUAL�GREATEREQUAL�TILDE�
CIRCUMFLEX�	LEFTSHIFT�
RIGHTSHIFT�
DOUBLESTAR�	PLUSEQUAL�MINEQUAL�	STAREQUAL�
SLASHEQUAL�PERCENTEQUAL�
AMPEREQUAL�	VBAREQUAL�CIRCUMFLEXEQUAL�LEFTSHIFTEQUAL�RIGHTSHIFTEQUAL�DOUBLESTAREQUAL�DOUBLESLASH�DOUBLESLASHEQUAL�AT�ATEQUAL�RARROW�ELLIPSIS�OP�AWAIT�ASYNC�
ERRORTOKEN�N_TOKENSrJ�globals�itemsr�extend�valuesrrrrs�__name__rGrGrGrH�<module>s�
5
colorsys.cpython-36.opt-1.pyc000064400000006361150335715140012020 0ustar003


 \��@s\dZddddddgZdZdZdZdd�Zdd�Zd
d�Zdd�Zdd�Z	dd�Z
dd�ZdS)aJConversion functions between RGB and other color systems.

This modules provides two functions for each color system ABC:

  rgb_to_abc(r, g, b) --> a, b, c
  abc_to_rgb(a, b, c) --> r, g, b

All inputs and outputs are triples of floats in the range [0.0...1.0]
(with the exception of I and Q, which covers a slightly larger range).
Inputs outside the valid range may cause exceptions or invalid outputs.

Supported color systems:
RGB: Red, Green, Blue components
YIQ: Luminance, Chrominance (used by composite video signals)
HLS: Hue, Luminance, Saturation
HSV: Hue, Saturation, Value
�
rgb_to_yiq�
yiq_to_rgb�
rgb_to_hls�
hls_to_rgb�
rgb_to_hsv�
hsv_to_rgbg�?g@g@g@cCsRd|d|d|}d||d||}d||d||}|||fS)Ng333333�?g�z�G��?g)\��(�?g�G�z��?gH�z�G�?g���Q��?g=
ףp=�?�)�r�g�b�y�i�qrr� /usr/lib64/python3.6/colorsys.pyr(scCs�|d|d|}|d|d|}|d|d|}|dkrHd}|dkrTd}|dkr`d}|dkrld}|dkrxd}|dkr�d}|||fS)	Ng2r��L�?g����,��?g:�����?g�nєW�?g6�޷���?gJ"�X�?gg�?r)rrr
rr	r
rrrr.s cCs�t|||�}t|||�}||d}||kr6d|dfS|dkrP||||}n||d||}||||}||||}||||}	||kr�|	|}
n"||kr�d||	}
nd||}
|
dd}
|
||fS)Ng@gg�?g@g@g�?)�max�min)rr	r
�maxc�minc�l�s�rc�gc�bc�hrrrrKs$

cCsn|dkr|||fS|dkr(|d|}n||||}d||}t|||t�t|||�t|||t�fS)Ngg�?g�?g@)�_v�	ONE_THIRD)rrr�m2�m1rrrrbs
cCsT|d}|tkr$||||dS|dkr0|S|tkrP|||t|dS|S)Ng�?g@g�?)�	ONE_SIXTH�	TWO_THIRD)rrZhuerrrrlsrcCs�t|||�}t|||�}|}||kr.dd|fS|||}||||}||||}||||}	||kr||	|}
n"||kr�d||	}
nd||}
|
dd}
|
||fS)Ngg@g@g@g�?)rr)rr	r
rr�vrrrrrrrrr|s 

cCs�|dkr|||fSt|d�}|d|}|d|}|d||}|d|d|}|d}|dkrt|||fS|dkr�|||fS|dkr�|||fS|dkr�|||fS|d	kr�|||fS|d
kr�|||fSdS)Ngg@g�?�������)�int)rrrr�f�pr
�trrrr�s(





NgUUUUUU�?gUUUUUU�?gUUUUUU�?)�__doc__�__all__rrrrrrrrrrrrrr�<module>s	
lzma.cpython-36.pyc000064400000027332150335715140010150 0ustar003


 \�2�$@s�dZddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$g$Zd%d&lZd%d&lZd%d&lZd%d'lTd%d(lmZmZd%d&lZd%Z	d)Z
d*ZGd+d�dej�Z
d1d&d2d&d&d&d&d&d-�d.d!�Zed3d&d&fd/d"�Zed&d&fd0d#�Zd&S)4aSInterface to the liblzma compression library.

This module provides a class for reading and writing compressed files,
classes for incremental (de)compression, and convenience functions for
one-shot (de)compression.

These classes and functions support both the XZ and legacy LZMA
container formats, as well as raw compressed data streams.
Z
CHECK_NONEZCHECK_CRC32ZCHECK_CRC64ZCHECK_SHA256ZCHECK_ID_MAXZ
CHECK_UNKNOWNZFILTER_LZMA1ZFILTER_LZMA2ZFILTER_DELTAZ
FILTER_X86ZFILTER_IA64Z
FILTER_ARMZFILTER_ARMTHUMBZFILTER_POWERPCZFILTER_SPARC�FORMAT_AUTO�	FORMAT_XZZFORMAT_ALONEZ
FORMAT_RAWZMF_HC3ZMF_HC4ZMF_BT2ZMF_BT3ZMF_BT4Z	MODE_FASTZMODE_NORMALZPRESET_DEFAULTZPRESET_EXTREME�LZMACompressor�LZMADecompressor�LZMAFile�	LZMAError�open�compress�
decompressZis_check_supported�N)�*)�_encode_filter_properties�_decode_filter_properties��c@s�eZdZdZd"dd#ddd�dd�Zdd	�Zed
d��Zdd
�Zdd�Z	dd�Z
dd�Zd%dd�Zd'dd�Z
d)dd�Zd+dd�Zdd�Zejfdd�Zd d!�ZdS),ra@A file object providing transparent LZMA (de)compression.

    An LZMAFile can act as a wrapper for an existing file object, or
    refer directly to a named file on disk.

    Note that LZMAFile provides a *binary* file interface - data read
    is returned as bytes, and data to be written must be given as bytes.
    N�rr)�format�check�preset�filtersc	Cs&d|_d|_t|_|dkrL|dkr*td��|dk	r:td��|dkrFt}t}n@|dkr~|dkr`t}t}t	||||d�|_
d|_ntdj|���t
|tttjf�r�d|kr�|d7}tj||�|_d|_||_n*t|d�s�t|d�r�||_||_ntd��|jtk�r"tj|jtt||d�}tj|�|_dS)a�Open an LZMA-compressed file in binary mode.

        filename can be either an actual file name (given as a str,
        bytes, or PathLike object), in which case the named file is
        opened, or it can be an existing file object to read from or
        write to.

        mode can be "r" for reading (default), "w" for (over)writing,
        "x" for creating exclusively, or "a" for appending. These can
        equivalently be given as "rb", "wb", "xb" and "ab" respectively.

        format specifies the container format to use for the file.
        If mode is "r", this defaults to FORMAT_AUTO. Otherwise, the
        default is FORMAT_XZ.

        check specifies the integrity check to use. This argument can
        only be used when opening a file for writing. For FORMAT_XZ,
        the default is CHECK_CRC64. FORMAT_ALONE and FORMAT_RAW do not
        support integrity checks - for these formats, check must be
        omitted, or be CHECK_NONE.

        When opening a file for reading, the *preset* argument is not
        meaningful, and should be omitted. The *filters* argument should
        also be omitted, except when format is FORMAT_RAW (in which case
        it is required).

        When opening a file for writing, the settings used by the
        compressor can be specified either as a preset compression
        level (with the *preset* argument), or in detail as a custom
        filter chain (with the *filters* argument). For FORMAT_XZ and
        FORMAT_ALONE, the default is to use the PRESET_DEFAULT preset
        level. For FORMAT_RAW, the caller must always specify a filter
        chain; the raw compressor does not support preset compression
        levels.

        preset (if provided) should be an integer in the range 0-9,
        optionally OR-ed with the constant PRESET_EXTREME.

        filters (if provided) should be a sequence of dicts. Each dict
        should have an entry for "id" indicating ID of the filter, plus
        additional entries for options to the filter.
        NFr�rbrzACannot specify an integrity check when opening a file for readingzICannot specify a preset compression level when opening a file for reading�w�wb�a�ab�x�xb)rrrrr
zInvalid mode: {!r}�bT�read�writez6filename must be a str, bytes, file or PathLike object)Ztrailing_errorrr)rr���)rrrrrr)�_fp�_closefp�_MODE_CLOSED�_mode�
ValueErrorr�
_MODE_READr�_MODE_WRITEr�_compressor�_posr�
isinstance�str�bytes�os�PathLike�builtinsr�hasattr�	TypeError�_compressionZDecompressReaderrr�io�BufferedReader�_buffer)	�self�filename�moderrrrZ	mode_code�raw�r9�/usr/lib64/python3.6/lzma.py�__init__1sB,
zLZMAFile.__init__cCs�|jtkrdSzB|jtkr,|jj�d|_n"|jtkrN|jj|jj	��d|_Wdz|j
rd|jj�Wdd|_d|_
t|_XXdS)z�Flush and close the file.

        May be called more than once without error. Once the file is
        closed, any other operation on it will raise a ValueError.
        NF)r#r"r%r4�closer&r rr'�flushr!)r5r9r9r:r<�s




zLZMAFile.closecCs
|jtkS)zTrue if this file is closed.)r#r")r5r9r9r:�closed�szLZMAFile.closedcCs|j�|jj�S)z3Return the file descriptor for the underlying file.)�_check_not_closedr �fileno)r5r9r9r:r@�szLZMAFile.filenocCs|j�o|jj�S)z)Return whether the file supports seeking.)�readabler4�seekable)r5r9r9r:rB�szLZMAFile.seekablecCs|j�|jtkS)z/Return whether the file was opened for reading.)r?r#r%)r5r9r9r:rA�szLZMAFile.readablecCs|j�|jtkS)z/Return whether the file was opened for writing.)r?r#r&)r5r9r9r:�writable�szLZMAFile.writablecCs|j�|jj|�S)z�Return buffered data without advancing the file position.

        Always returns at least one byte of data, unless at EOF.
        The exact number of bytes returned is unspecified.
        )�_check_can_readr4�peek)r5�sizer9r9r:rE�sz
LZMAFile.peekcCs|j�|jj|�S)z�Read up to size uncompressed bytes from the file.

        If size is negative or omitted, read until EOF is reached.
        Returns b"" if the file is already at EOF.
        )rDr4r)r5rFr9r9r:r�sz
LZMAFile.readcCs"|j�|dkrtj}|jj|�S)z�Read up to size uncompressed bytes, while trying to avoid
        making multiple reads from the underlying stream. Reads up to a
        buffer's worth of data if size is negative.

        Returns b"" if the file is at EOF.
        r
)rDr2�DEFAULT_BUFFER_SIZEr4�read1)r5rFr9r9r:rH�szLZMAFile.read1cCs|j�|jj|�S)a
Read a line of uncompressed bytes from the file.

        The terminating newline (if present) is retained. If size is
        non-negative, no more than size bytes will be read (in which
        case the line may be incomplete). Returns b'' if already at EOF.
        )rDr4�readline)r5rFr9r9r:rI�szLZMAFile.readlinecCs:|j�|jj|�}|jj|�|jt|�7_t|�S)z�Write a bytes object to the file.

        Returns the number of uncompressed bytes written, which is
        always len(data). Note that due to buffering, the file on disk
        may not reflect the data written until close() is called.
        )Z_check_can_writer'rr rr(�len)r5�dataZ
compressedr9r9r:r�s
zLZMAFile.writecCs|j�|jj||�S)a�Change the file position.

        The new position is specified by offset, relative to the
        position indicated by whence. Possible values for whence are:

            0: start of stream (default): offset must not be negative
            1: current stream position
            2: end of stream; offset must not be positive

        Returns the new file position.

        Note that seeking is emulated, so depending on the parameters,
        this operation may be extremely slow.
        )Z_check_can_seekr4�seek)r5�offset�whencer9r9r:rL�sz
LZMAFile.seekcCs"|j�|jtkr|jj�S|jS)z!Return the current file position.)r?r#r%r4�tellr()r5r9r9r:rO�s

z
LZMAFile.tell)Nrrr)rr)rr)rr)r)�__name__�
__module__�__qualname__�__doc__r;r<�propertyr>r@rBrArCrErrHrIrr2�SEEK_SETrLrOr9r9r9r:r&s 	T

	



r)rrrr�encoding�errors�newlinecCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|jdd�}	t||	||||d	�}
d|kr�tj|
|||�S|
SdS)
a�Open an LZMA-compressed file in binary or text mode.

    filename can be either an actual file name (given as a str, bytes,
    or PathLike object), in which case the named file is opened, or it
    can be an existing file object to read from or write to.

    The mode argument can be "r", "rb" (default), "w", "wb", "x", "xb",
    "a", or "ab" for binary mode, or "rt", "wt", "xt", or "at" for text
    mode.

    The format, check, preset and filters arguments specify the
    compression settings, as for LZMACompressor, LZMADecompressor and
    LZMAFile.

    For binary mode, this function is equivalent to the LZMAFile
    constructor: LZMAFile(filename, mode, ...). In this case, the
    encoding, errors and newline arguments must not be provided.

    For text mode, an LZMAFile object is created, and wrapped in an
    io.TextIOWrapper instance with the specified encoding, error
    handling behavior, and line ending(s).

    �trzInvalid mode: %rNz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary mode�)rrrr)r$�replacerr2�
TextIOWrapper)r6r7rrrrrVrWrXZlz_modeZbinary_filer9r9r:rs

cCs t||||�}|j|�|j�S)z�Compress a block of data.

    Refer to LZMACompressor's docstring for a description of the
    optional arguments *format*, *check*, *preset* and *filters*.

    For incremental compression, use an LZMACompressor instead.
    )rrr=)rKrrrr�compr9r9r:r6scCsrg}xbt|||�}y|j|�}Wntk
r>|r8Pn�YnX|j|�|jsXtd��|j}|sPqWdj|�S)z�Decompress a block of data.

    Refer to LZMADecompressor's docstring for a description of the
    optional arguments *format*, *check* and *filters*.

    For incremental decompression, use an LZMADecompressor instead.
    zACompressed data ended before the end-of-stream marker was reached�)rr	r�append�eofZunused_data�join)rKrZmemlimitrZresultsZdecomp�resr9r9r:r	Bs 
)rrr)rS�__all__r.r2r,Z_lzmarr
r1r"r%r&Z
BaseStreamrrrrrr	r9r9r9r:�<module>	s2

b-_dummy_thread.cpython-36.pyc000064400000011365150335715140012025 0ustar003


 \��@sxdZdddddddgZdZeZifd
d�Zdd�Zdd�Zd
d�Zddd�Z	dd�Z
Gdd�de�Zda
dadd�ZdS)a/Drop-in replacement for the thread module.

Meant to be used as a brain-dead substitute so that threaded code does
not need to be rewritten for when the thread module is not present.

Suggested usage is::

    try:
        import _thread
    except ImportError:
        import _dummy_thread as _thread

�error�start_new_thread�exit�	get_ident�
allocate_lock�interrupt_main�LockType��cCs�t|�tt��krtd��t|�tt��kr4td��day|||�Wn.tk
rZYnddl}|j�YnXdatr�dat	�dS)a�Dummy implementation of _thread.start_new_thread().

    Compatibility is maintained by making sure that ``args`` is a
    tuple and ``kwargs`` is a dictionary.  If an exception is raised
    and it is SystemExit (which can be done by _thread.exit()) it is
    caught and nothing is done; all other exceptions are printed out
    by using traceback.print_exc().

    If the executed function calls interrupt_main the KeyboardInterrupt will be
    raised when the function returns.

    z2nd arg must be a tuplez3rd arg must be a dictF�NT)
�type�tuple�	TypeError�dict�_main�
SystemExit�	traceback�	print_exc�
_interrupt�KeyboardInterrupt)Zfunction�args�kwargsr�r�%/usr/lib64/python3.6/_dummy_thread.pyrs 
cCst�dS)z'Dummy implementation of _thread.exit().N)rrrrrr=scCsdS)z�Dummy implementation of _thread.get_ident().

    Since this module should only be used when _threadmodule is not
    available, it is safe to assume that the current process is the
    only thread.  Thus a constant can be safely returned.
    ����rrrrrrAscCst�S)z0Dummy implementation of _thread.allocate_lock().)rrrrrrJsNcCs|dk	rtd��dS)z-Dummy implementation of _thread.stack_size().Nz'setting thread stack size not supportedr
)r)�sizerrr�
stack_sizeNsrcCst�S)z0Dummy implementation of _thread._set_sentinel().)rrrrr�
_set_sentinelTsrc@sFeZdZdZdd�Zddd�ZeZdd	�Zd
d�Zdd
�Z	dd�Z
dS)ra�Class implementing dummy implementation of _thread.LockType.

    Compatibility is maintained by maintaining self.locked_status
    which is a boolean that stores the state of the lock.  Pickling of
    the lock, though, should not be done since if the _thread module is
    then used with an unpickled ``lock()`` from here problems could
    occur from this class not having atomic methods.

    cCs
d|_dS)NF)�
locked_status)�selfrrr�__init__cszLockType.__init__NrcCsH|dks|rd|_dS|js&d|_dS|dkr@ddl}|j|�dSdS)a�Dummy implementation of acquire().

        For blocking calls, self.locked_status is automatically set to
        True and returned appropriately based on value of
        ``waitflag``.  If it is non-blocking, then the value is
        actually checked and not set if it is already acquired.  This
        is all done so that threading.Condition's assert statements
        aren't triggered and throw a little fit.

        NTr
F)r�timeZsleep)rZwaitflagZtimeoutr!rrr�acquirefs
zLockType.acquirecCs|j�dS)N)�release)r�typ�val�tbrrr�__exit__�szLockType.__exit__cCs|js
t�d|_dS)zRelease the dummy lock.FT)rr)rrrrr#�szLockType.releasecCs|jS)N)r)rrrr�locked�szLockType.lockedcCs*d|jrdnd|jj|jjtt|��fS)Nz<%s %s.%s object at %s>r(Zunlocked)r�	__class__�
__module__�__qualname__�hex�id)rrrr�__repr__�s
zLockType.__repr__r)Nr)�__name__r*r+�__doc__r r"�	__enter__r'r#r(r.rrrrrXs	
	FTcCstr
t�ndadS)z^Set _interrupt flag to True to have start_new_thread raise
    KeyboardInterrupt upon exiting.TN)rrrrrrrr�sl)N)r0�__all__�TIMEOUT_MAX�RuntimeErrorrrrrrrr�objectrrrrrrrr�<module>
s
 	
@runpy.cpython-36.opt-2.pyc000064400000014451150335715140011320 0ustar003


 \�.�@s�ddlZddlZddlZddlZddlmZmZddgZGdd�de	�Z
Gdd�de	�Zdd	d
�Zd dd�Z
efd
d�ZGdd�de�Zd!dd�Zd"dd�Zefdd�Zdd�Zd#dd�Zedk�r�eej�dk�r�edejd�nejd=eejd�dS)$�N)�	read_code�get_importer�
run_module�run_pathc@s$eZdZdd�Zdd�Zdd�ZdS)�_TempModulecCs||_tj|�|_g|_dS)N)�mod_name�types�
ModuleType�module�
_saved_module)�selfr�r
�/usr/lib64/python3.6/runpy.py�__init__sz_TempModule.__init__cCsB|j}y|jjtj|�Wntk
r0YnX|jtj|<|S)N)rr�append�sys�modules�KeyErrorr
)rrr
r
r�	__enter__sz_TempModule.__enter__cGs.|jr|jdtj|j<n
tj|j=g|_dS)Nr)rrrr)r�argsr
r
r�__exit__'s
z_TempModule.__exit__N)�__name__�
__module__�__qualname__rrrr
r
r
rrs	rc@s$eZdZdd�Zdd�Zdd�ZdS)�_ModifiedArgv0cCs||_t�|_|_dS)N)�value�object�_saved_value�	_sentinel)rrr
r
rr/sz_ModifiedArgv0.__init__cCs0|j|jk	rtd��tjd|_|jtjd<dS)NzAlready preserving saved valuer)rr�RuntimeErrorr�argvr)rr
r
rr3sz_ModifiedArgv0.__enter__cGs|j|_|jtjd<dS)Nr)rrrrr )rrr
r
rr9sz_ModifiedArgv0.__exit__N)rrrrrrr
r
r
rr.src
	Csn|dk	r|j|�|dkr(d}|}d}	n |j}|j}|j}	|dkrH|j}|j|||	d|||d�t||�|S)N)r�__file__�
__cached__�__doc__�
__loader__�__package__�__spec__)�update�loader�origin�cached�parent�exec)
�codeZrun_globals�init_globalsr�mod_spec�pkg_name�script_namer(�fnamer*r
r
r�	_run_code>s(

r3c	Cs^|dkr|n|j}t|��6}t|��"|jj}t|||||||�WdQRXWdQRX|j�S)N)r)rrr
�__dict__r3�copy)	r-r.rr/r0r1r2�temp_module�mod_globalsr
r
r�_run_module_codeXs r8c
;Cs4|jd�r|d��|jd�\}}}|r�yt|�WnJtk
r|}z.|jdksj|j|krl|j|jd�rl�WYdd}~XnXtjj|�}|dk	r�t|d�r�ddl	m
}dj||d�}|t|��yt
jj|�}WnJttttfk
�r}	z$d}||j|t|	�j|	��|	�WYdd}	~	XnX|dk�r6|d	|��|jdk	�r�|d
k�sX|jd��r`|d��y|d}
t|
|�S|k
�r�}z$|tjk�r��|d||f��WYdd}~XnX|j}|dk�r�|d|��y|j|�}Wn2tk
�r}z|t|��|�WYdd}~XnX|dk�r*|d|��|||fS)N�.z#Relative module names not supported�__path__r)�warnz�{mod_name!r} found in sys.modules after import of package {pkg_name!r}, but prior to execution of {mod_name!r}; this may result in unpredictable behaviour)rr0z:Error while finding module specification for {!r} ({}: {})zNo module named %s�__main__z	.__main__z%Cannot use package as __main__ modulez%s; %r is a package and cannot zbe directly executedz0%r is a namespace package and cannot be executedzNo code object available for %sz3%s; %r is a package and cannot be directly executed)�
startswith�
rpartition�
__import__�ImportError�namerr�get�hasattr�warningsr;�format�RuntimeWarning�	importlib�util�	find_spec�AttributeError�	TypeError�
ValueError�typer�submodule_search_locations�endswith�_get_module_detailsr(�get_code)
r�errorr0�_�eZexistingr;�msg�specZexZ
pkg_main_namer(r-r
r
rrPfsZ

,

 
 
rPc@seZdZdS)�_ErrorN)rrrr
r
r
rrW�srWTcCs�y0|s|dkr t|t�\}}}ntt�\}}}Wn:tk
rj}zdtj|f}tj|�WYdd}~XnXtjdj}|r�|jtj	d<t
||dd|�S)Nr<z%s: %sr)rPrW�_get_main_module_detailsr�
executable�exitrr4r)r r3)rZ
alter_argvr/r-�excrUZmain_globalsr
r
r�_run_module_as_main�sr\FcCs@t|�\}}}|dkr|}|r,t||||�St|i|||�SdS)N)rPr8r3)rr.�run_nameZ	alter_sysr/r-r
r
rr�scCs~d}tj|}tj|=zVyt|�Stk
rh}z,|t|�krV|d|tjdf�|��WYdd}~XnXWd|tj|<XdS)Nr<zcan't find %r module in %rr)rrrPr@�str�path)rRZ	main_nameZ
saved_mainr[r
r
rrX�s
rXcCsTt|d��}t|�}WdQRX|dkrLt|d��}t|j�|d�}WdQRX||fS)N�rbr,)�openr�compile�read)r]r2�fr-r
r
r�_get_code_from_file�srec Cs|dkrd}|jd�d}t|�}d}t|�jdkrFt|�jdkrFd}t|td��sX|rxt||�\}}t|||||d�Stj	j
d|�zRt�\}}	}t|��4}
t
|�� |
jj}t|||||	|�j�SQRXWdQRXWdytj	j|�Wntk
�rYnXXdS)	Nz
<run_path>r9rFZimpZNullImporterT)r0r1)r>rrMrr�
isinstancerer8rr_�insertrXrrr
r4r3r5�removerL)Z	path_namer.r]r0ZimporterZis_NullImporterr-r2rr/r6r7r
r
rr�s0



"r<�z!No module specified for execution)�file)NNNNN)NNNNN)T)NNF)NN)r�importlib.machineryrG�importlib.utilrZpkgutilrr�__all__rrrr3r8r@rP�	ExceptionrWr\rrXrerr�lenr �print�stderrr
r
r
r�<module>
s4

:



1
_sysconfigdata_dm_linux_x86_64-linux-gnu.cpython-36.pyc000064400000056413150335715140017045 0ustar003

�\dh�u��@sdddddddddddd	d
dddd
dddddddddddddddddddddddd dd!d"d#d$d%dddd&d'd
d(d)d*d&d+dd!dddd,d-ddddddd.d&d&d&d&dd&dd&d&d&d&d&dddddddddd&dd&d&d&d&d&d&d&d&dd&d&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&ddd&d&dd&dddd&d&d&ddd&d&dddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&d&d&d&d&d&ddd&d&dd&d&ddd&d&d&d&d&d&d&dddddd&dd&d&ddddddd&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd/ddd0d1d0d0d2d3d4d
d5d6dd7dd
d8ddd9dd:d;dd<d=d>d
d
d?d@dAdBdd+ddCdDdddEddddddd&dFdGdHddIdJd
dKdLd&dMd
dNdddddddd
dOdPdQd
dRdSdd
ddTd&dddddUddddVdWd
d
ddXd&dYdZdd[d6d\d]dd&d&d&dd^d_d`dadbd9dddcd?dddddedfdgdfdedgdededfded]dededededfd&dhdidjd&dkdlddmd:d&d&dddddnddodpdqdd&dd
ddrd&d&dsdtdd&d&d&dddd&d&d&ddudvdtdwdxdxdtdy���ZdzS){Zdm��ar�rcsz!-Wno-unused-result -Wsign-comparez-IObjects -IInclude -IPython�z/usr/binz/usr/lib64/python3.6z-L. -lpython3.6dmzOgcc -pthread -shared -Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g�pythonzx86_64-redhat-linux-gnu�\zgcc -pthreadz-fPICav-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz?configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.ina-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapva=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-typez-Wl,-z,relro  -Wl,-z,now  -gz�-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -ga�'--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-ipv6' '--enable-shared' '--with-computed-gotos=yes' '--with-dbmliborder=gdbm:ndbm:bdb' '--with-system-expat' '--with-system-ffi' '--enable-loadable-sqlite-extensions' '--with-dtrace' '--with-lto' '--with-ssl-default-suites=openssl' '--with-valgrind' '--without-ensurepip' '--with-pydebug' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS= -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv ' 'LDFLAGS= -Wl,-z,relro  -Wl,-z,now  -g ' 'CPPFLAGS=' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'z/usr/includez/usr/include/python3.6dm�:z</builddir/build/BUILD/Python-3.6.8/build/debug/coverage.infoz:/builddir/build/BUILD/Python-3.6.8/build/debug/lcov-reportz2--no-branch-coverage --title "CPython lcov report"zM-IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.6.8/Includezg++ -pthreadzE/usr /usr/lib64 /usr/lib64/python3.6 /usr/lib64/python3.6/lib-dynloadz /usr/lib64/python3.6/lib-dynloadi�zkREADME ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Ext-dummyzInclude Lib Misc Ext-dummyzPREADME ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in�.�z/usr/bin/dtracezInclude/pydtrace_probes.hzPython/pydtrace.ozdynload_shlib.o�noz!.cpython-36dm-x86_64-linux-gnu.soi��yeszK/usr/include /usr/include /usr/include/python3.6dm /usr/include/python3.6dmz/usr/bin/install -cz/usr/bin/install -c -m 644z/usr/bin/install -c -m 555zlibpython3.6dm.so.1.0zModules/_io/_iomodule.hzg++ -pthread -sharedz:-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -gzlibpython3.6dm.soz3.6dmz
/usr/lib64z-lmzPython/z/usr/lib64/pkgconfigz2/usr/lib64/python3.6/config-3.6dm-x86_64-linux-gnuzlibpython3.6dm.az-lpthread -ldl  -lutilz0tkinter tkinter/test tkinter/test/test_tkinter \�gccz-Xlinker -export-dynamic�true�ln�linuxz4/builddir/build/BUILD/Python-3.6.8/Modules/makesetupz/usr/share/manz/usr/bin/mkdir -pz�_thread posix errno pwd _sre _codecs _weakref _functools _operator _collections itertools atexit _signal _stat time _locale _io zipimport faulthandler _tracemalloc _symtable xxsubtypea{Modules/_threadmodule.o  Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/zipimport.o  Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  Modules/symtablemodule.o  Modules/xxsubtype.ozx86_64-linux-gnuz -DMULTIARCH=\"x86_64-linux-gnu\"z-Wl,--no-as-neededa1-DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz:\ Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.ozParser/pgenz\ \z-fprofile-generatez"-fprofile-use -fprofile-correctionz
-m test --pgozno-frameworkz./python -Ez	python3.6a�-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Oga�-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Og -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.6.8/Include -fPIC -DPy_BUILD_COREaT-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g -lcryptoz"z"a-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g�z)-x test_subprocess test_io test_lib2to3 \�readelfzMac/Resources/framework�voidz>LD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/debugz/bin/shz.so���zcpython-36dm-x86_64-linux-gnuz&Parser Objects Python Modules Programsz9/builddir/build/BUILD/Python-3.6.8/Tools/gdb/libpython.pyz"/* Don't use ncurses extensions */z-szInclude Lib MisczGLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/debug ./pythonz�LD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/debug ./python /builddir/build/BUILD/Python-3.6.8/Tools/scripts/run_tests.pyi�zPython/thread.ozIpython3.6 /builddir/build/BUILD/Python-3.6.8/Tools/scripts/update_file.pyz3.6z"/builddir/build/BUILD/Python-3.6.8z)xml xml/dom xml/etree xml/parsers xml/saxz./builddir/build/BUILD/Python-3.6.8/build/debugz
/usr/sharez/usr(��ABIFLAGS�AC_APPLE_UNIVERSAL_BUILD�AIX_GENUINE_CPLUSPLUS�ANDROID_API_LEVEL�AR�ARFLAGS�
BASECFLAGS�BASECPPFLAGS�BASEMODLIBS�BINDIR�
BINLIBDEST�
BLDLIBRARY�	BLDSHARED�BUILDEXE�BUILDPYTHON�BUILD_GNU_TYPE�BYTESTR_DEPS�CC�CCSHARED�CFLAGS�CFLAGSFORSHARED�CFLAGS_ALIASING�CONFIGFILES�CONFIGURE_CFLAGS�CONFIGURE_CFLAGS_NODIST�CONFIGURE_CPPFLAGS�CONFIGURE_LDFLAGS�CONFIGURE_LDFLAGS_NODIST�CONFIG_ARGS�CONFINCLUDEDIR�
CONFINCLUDEPY�COREPYTHONPATH�
COVERAGE_INFO�COVERAGE_REPORT�COVERAGE_REPORT_OPTIONS�CPPFLAGS�CXX�DESTDIRS�DESTLIB�DESTPATH�
DESTSHARED�DFLAGS�DIRMODE�DIST�DISTDIRS�	DISTFILES�	DLINCLDIR�
DLLLIBRARY�"DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754�DOUBLE_IS_BIG_ENDIAN_IEEE754�DOUBLE_IS_LITTLE_ENDIAN_IEEE754�DTRACE�DTRACE_DEPS�DTRACE_HEADERS�DTRACE_OBJS�DYNLOADFILE�ENABLE_IPV6�	ENSUREPIP�EXE�EXEMODE�EXTRAMACHDEPPATH�
EXTRATESTOPTS�EXTRA_CFLAGS�
EXT_SUFFIX�FILEMODE�FLOCK_NEEDS_LIBBSD�GETPGRP_HAVE_ARG�GETTIMEOFDAY_NO_TZ�	GITBRANCH�GITTAG�
GITVERSION�GNULD�HAVE_ACCEPT4�
HAVE_ACOSH�
HAVE_ADDRINFO�
HAVE_ALARM�HAVE_ALIGNED_REQUIRED�
HAVE_ALLOCA_H�HAVE_ALTZONE�
HAVE_ASINH�HAVE_ASM_TYPES_H�
HAVE_ATANH�HAVE_BIND_TEXTDOMAIN_CODESET�HAVE_BLUETOOTH_BLUETOOTH_H�HAVE_BLUETOOTH_H�HAVE_BROKEN_MBSTOWCS�HAVE_BROKEN_NICE�HAVE_BROKEN_PIPE_BUF�HAVE_BROKEN_POLL�HAVE_BROKEN_POSIX_SEMAPHORES�HAVE_BROKEN_PTHREAD_SIGMASK�HAVE_BROKEN_SEM_GETVALUE�HAVE_BROKEN_UNSETENV�HAVE_BUILTIN_ATOMIC�HAVE_CHFLAGS�
HAVE_CHOWN�HAVE_CHROOT�
HAVE_CLOCK�HAVE_CLOCK_GETRES�HAVE_CLOCK_GETTIME�HAVE_CLOCK_SETTIME�HAVE_COMPUTED_GOTOS�HAVE_CONFSTR�HAVE_CONIO_H�
HAVE_COPYSIGN�HAVE_CRYPT_H�HAVE_CTERMID�HAVE_CTERMID_R�HAVE_CURSES_FILTER�
HAVE_CURSES_H�HAVE_CURSES_HAS_KEY�HAVE_CURSES_IMMEDOK�HAVE_CURSES_IS_PAD�HAVE_CURSES_IS_TERM_RESIZED�HAVE_CURSES_RESIZETERM�HAVE_CURSES_RESIZE_TERM�HAVE_CURSES_SYNCOK�HAVE_CURSES_TYPEAHEAD�HAVE_CURSES_USE_ENV�HAVE_CURSES_WCHGAT�HAVE_DECL_ISFINITE�HAVE_DECL_ISINF�HAVE_DECL_ISNAN�HAVE_DECL_RTLD_DEEPBIND�HAVE_DECL_RTLD_GLOBAL�HAVE_DECL_RTLD_LAZY�HAVE_DECL_RTLD_LOCAL�HAVE_DECL_RTLD_NODELETE�HAVE_DECL_RTLD_NOLOAD�HAVE_DECL_RTLD_NOW�HAVE_DECL_TZNAME�HAVE_DEVICE_MACROS�HAVE_DEV_PTC�
HAVE_DEV_PTMX�
HAVE_DIRECT_H�HAVE_DIRENT_D_TYPE�
HAVE_DIRENT_H�
HAVE_DIRFD�HAVE_DLFCN_H�HAVE_DLOPEN�	HAVE_DUP2�	HAVE_DUP3�HAVE_DYNAMIC_LOADING�
HAVE_ENDIAN_H�
HAVE_EPOLL�HAVE_EPOLL_CREATE1�HAVE_ERF�	HAVE_ERFC�HAVE_ERRNO_H�
HAVE_EXECV�
HAVE_EXPM1�HAVE_FACCESSAT�HAVE_FCHDIR�HAVE_FCHMOD�
HAVE_FCHMODAT�HAVE_FCHOWN�
HAVE_FCHOWNAT�HAVE_FCNTL_H�HAVE_FDATASYNC�HAVE_FDOPENDIR�HAVE_FEXECVE�HAVE_FINITE�
HAVE_FLOCK�	HAVE_FORK�HAVE_FORKPTY�HAVE_FPATHCONF�HAVE_FSEEK64�HAVE_FSEEKO�HAVE_FSTATAT�
HAVE_FSTATVFS�
HAVE_FSYNC�HAVE_FTELL64�HAVE_FTELLO�
HAVE_FTIME�HAVE_FTRUNCATE�
HAVE_FUTIMENS�HAVE_FUTIMES�HAVE_FUTIMESAT�HAVE_GAI_STRERROR�
HAVE_GAMMA�HAVE_GCC_ASM_FOR_MC68881�HAVE_GCC_ASM_FOR_X64�HAVE_GCC_ASM_FOR_X87�HAVE_GCC_UINT128_T�HAVE_GETADDRINFO�HAVE_GETC_UNLOCKED�HAVE_GETENTROPY�HAVE_GETGROUPLIST�HAVE_GETGROUPS�HAVE_GETHOSTBYNAME�HAVE_GETHOSTBYNAME_R�HAVE_GETHOSTBYNAME_R_3_ARG�HAVE_GETHOSTBYNAME_R_5_ARG�HAVE_GETHOSTBYNAME_R_6_ARG�HAVE_GETITIMER�HAVE_GETLOADAVG�
HAVE_GETLOGIN�HAVE_GETNAMEINFO�HAVE_GETPAGESIZE�HAVE_GETPEERNAME�HAVE_GETPGID�HAVE_GETPGRP�HAVE_GETPID�HAVE_GETPRIORITY�
HAVE_GETPWENT�HAVE_GETRANDOM�HAVE_GETRANDOM_SYSCALL�HAVE_GETRESGID�HAVE_GETRESUID�HAVE_GETSID�
HAVE_GETSPENT�
HAVE_GETSPNAM�HAVE_GETTIMEOFDAY�
HAVE_GETWD�HAVE_GLIBC_MEMMOVE_BUG�
HAVE_GRP_H�HAVE_HSTRERROR�HAVE_HTOLE64�
HAVE_HYPOT�
HAVE_IEEEFP_H�HAVE_IF_NAMEINDEX�HAVE_INET_ATON�HAVE_INET_PTON�HAVE_INITGROUPS�HAVE_INTTYPES_H�	HAVE_IO_H�HAVE_IPA_PURE_CONST_BUG�	HAVE_KILL�HAVE_KILLPG�HAVE_KQUEUE�HAVE_LANGINFO_H�HAVE_LARGEFILE_SUPPORT�
HAVE_LCHFLAGS�HAVE_LCHMOD�HAVE_LCHOWN�HAVE_LGAMMA�
HAVE_LIBDL�HAVE_LIBDLD�HAVE_LIBIEEE�HAVE_LIBINTL_H�HAVE_LIBREADLINE�HAVE_LIBRESOLV�HAVE_LIBSENDFILE�HAVE_LIBUTIL_H�	HAVE_LINK�HAVE_LINKAT�HAVE_LINUX_CAN_BCM_H�HAVE_LINUX_CAN_H�HAVE_LINUX_CAN_RAW_FD_FRAMES�HAVE_LINUX_CAN_RAW_H�HAVE_LINUX_NETLINK_H�HAVE_LINUX_RANDOM_H�HAVE_LINUX_TIPC_H�
HAVE_LOCKF�
HAVE_LOG1P�	HAVE_LOG2�HAVE_LONG_DOUBLE�
HAVE_LSTAT�HAVE_LUTIMES�HAVE_MAKEDEV�HAVE_MBRTOWC�HAVE_MEMMOVE�
HAVE_MEMORY_H�HAVE_MEMRCHR�HAVE_MKDIRAT�HAVE_MKFIFO�
HAVE_MKFIFOAT�
HAVE_MKNOD�HAVE_MKNODAT�HAVE_MKTIME�	HAVE_MMAP�HAVE_MREMAP�HAVE_NCURSES_H�HAVE_NDIR_H�HAVE_NETPACKET_PACKET_H�
HAVE_NET_IF_H�	HAVE_NICE�HAVE_OPENAT�HAVE_OPENPTY�
HAVE_PATHCONF�
HAVE_PAUSE�
HAVE_PIPE2�
HAVE_PLOCK�	HAVE_POLL�HAVE_POLL_H�HAVE_POSIX_FADVISE�HAVE_POSIX_FALLOCATE�
HAVE_PREAD�HAVE_PRLIMIT�HAVE_PROCESS_H�HAVE_PROTOTYPES�HAVE_PTHREAD_ATFORK�HAVE_PTHREAD_CONDATTR_SETCLOCK�HAVE_PTHREAD_DESTRUCTOR�HAVE_PTHREAD_H�HAVE_PTHREAD_INIT�HAVE_PTHREAD_KILL�HAVE_PTHREAD_SIGMASK�
HAVE_PTY_H�HAVE_PUTENV�HAVE_PWRITE�
HAVE_READLINK�HAVE_READLINKAT�
HAVE_READV�
HAVE_REALPATH�
HAVE_RENAMEAT�HAVE_RL_APPEND_HISTORY�HAVE_RL_CALLBACK�HAVE_RL_CATCH_SIGNAL�#HAVE_RL_COMPLETION_APPEND_CHARACTER�'HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK�HAVE_RL_COMPLETION_MATCHES�"HAVE_RL_COMPLETION_SUPPRESS_APPEND�HAVE_RL_PRE_INPUT_HOOK�HAVE_RL_RESIZE_TERMINAL�
HAVE_ROUND�HAVE_SCHED_GET_PRIORITY_MAX�HAVE_SCHED_H�HAVE_SCHED_RR_GET_INTERVAL�HAVE_SCHED_SETAFFINITY�HAVE_SCHED_SETPARAM�HAVE_SCHED_SETSCHEDULER�HAVE_SELECT�HAVE_SEM_GETVALUE�
HAVE_SEM_OPEN�HAVE_SEM_TIMEDWAIT�HAVE_SEM_UNLINK�
HAVE_SENDFILE�HAVE_SETEGID�HAVE_SETEUID�HAVE_SETGID�HAVE_SETGROUPS�HAVE_SETHOSTNAME�HAVE_SETITIMER�HAVE_SETLOCALE�HAVE_SETPGID�HAVE_SETPGRP�HAVE_SETPRIORITY�
HAVE_SETREGID�HAVE_SETRESGID�HAVE_SETRESUID�
HAVE_SETREUID�HAVE_SETSID�HAVE_SETUID�HAVE_SETVBUF�
HAVE_SHADOW_H�HAVE_SIGACTION�HAVE_SIGALTSTACK�HAVE_SIGINTERRUPT�
HAVE_SIGNAL_H�HAVE_SIGPENDING�
HAVE_SIGRELSE�HAVE_SIGTIMEDWAIT�HAVE_SIGWAIT�HAVE_SIGWAITINFO�
HAVE_SNPRINTF�HAVE_SOCKADDR_ALG�HAVE_SOCKADDR_SA_LEN�HAVE_SOCKADDR_STORAGE�HAVE_SOCKETPAIR�HAVE_SPAWN_H�HAVE_SSIZE_T�HAVE_STATVFS�HAVE_STAT_TV_NSEC�HAVE_STAT_TV_NSEC2�HAVE_STDARG_PROTOTYPES�
HAVE_STDINT_H�
HAVE_STDLIB_H�HAVE_STD_ATOMIC�HAVE_STRDUP�
HAVE_STRFTIME�HAVE_STRINGS_H�
HAVE_STRING_H�HAVE_STRLCPY�HAVE_STROPTS_H�HAVE_STRUCT_PASSWD_PW_GECOS�HAVE_STRUCT_PASSWD_PW_PASSWD�HAVE_STRUCT_STAT_ST_BIRTHTIME�HAVE_STRUCT_STAT_ST_BLKSIZE�HAVE_STRUCT_STAT_ST_BLOCKS�HAVE_STRUCT_STAT_ST_FLAGS�HAVE_STRUCT_STAT_ST_GEN�HAVE_STRUCT_STAT_ST_RDEV�HAVE_STRUCT_TM_TM_ZONE�HAVE_SYMLINK�HAVE_SYMLINKAT�	HAVE_SYNC�HAVE_SYSCONF�HAVE_SYSEXITS_H�HAVE_SYS_AUDIOIO_H�HAVE_SYS_BSDTTY_H�HAVE_SYS_DEVPOLL_H�HAVE_SYS_DIR_H�HAVE_SYS_ENDIAN_H�HAVE_SYS_EPOLL_H�HAVE_SYS_EVENT_H�HAVE_SYS_FILE_H�HAVE_SYS_IOCTL_H�HAVE_SYS_KERN_CONTROL_H�HAVE_SYS_LOADAVG_H�HAVE_SYS_LOCK_H�HAVE_SYS_MKDEV_H�HAVE_SYS_MODEM_H�HAVE_SYS_NDIR_H�HAVE_SYS_PARAM_H�HAVE_SYS_POLL_H�HAVE_SYS_RANDOM_H�HAVE_SYS_RESOURCE_H�HAVE_SYS_SELECT_H�HAVE_SYS_SENDFILE_H�HAVE_SYS_SOCKET_H�HAVE_SYS_STATVFS_H�HAVE_SYS_STAT_H�HAVE_SYS_SYSCALL_H�HAVE_SYS_SYSMACROS_H�HAVE_SYS_SYS_DOMAIN_H�HAVE_SYS_TERMIO_H�HAVE_SYS_TIMES_H�HAVE_SYS_TIME_H�HAVE_SYS_TYPES_H�HAVE_SYS_UIO_H�
HAVE_SYS_UN_H�HAVE_SYS_UTSNAME_H�HAVE_SYS_WAIT_H�HAVE_SYS_XATTR_H�HAVE_TCGETPGRP�HAVE_TCSETPGRP�HAVE_TEMPNAM�HAVE_TERMIOS_H�HAVE_TERM_H�HAVE_TGAMMA�HAVE_TIMEGM�
HAVE_TIMES�HAVE_TMPFILE�HAVE_TMPNAM�
HAVE_TMPNAM_R�HAVE_TM_ZONE�
HAVE_TRUNCATE�HAVE_TZNAME�
HAVE_UCS4_TCL�
HAVE_UNAME�
HAVE_UNISTD_H�
HAVE_UNLINKAT�
HAVE_UNSETENV�HAVE_USABLE_WCHAR_T�HAVE_UTIL_H�HAVE_UTIMENSAT�HAVE_UTIMES�HAVE_UTIME_H�
HAVE_WAIT3�
HAVE_WAIT4�HAVE_WAITID�HAVE_WAITPID�HAVE_WCHAR_H�HAVE_WCSCOLL�
HAVE_WCSFTIME�HAVE_WCSXFRM�HAVE_WMEMCMP�HAVE_WORKING_TZSET�HAVE_WRITEV�HAVE_ZLIB_COPY�HAVE__GETPTY�
HOST_GNU_TYPE�INCLDIRSTOMAKE�
INCLUDEDIR�	INCLUDEPY�INSTALL�INSTALL_DATA�INSTALL_PROGRAM�INSTALL_SCRIPT�INSTALL_SHARED�
INSTSONAME�IO_H�IO_OBJS�LDCXXSHARED�LDFLAGS�LDLAST�	LDLIBRARY�LDLIBRARYDIR�LDSHARED�	LDVERSION�LIBC�LIBDEST�LIBDIR�LIBFFI_INCLUDEDIR�LIBM�	LIBOBJDIR�LIBOBJS�LIBPC�LIBPL�LIBRARY�LIBRARY_OBJS�LIBRARY_OBJS_OMIT_FROZEN�LIBS�
LIBSUBDIRS�LINKCC�
LINKFORSHARED�LIPO_32BIT_FLAGS�
LLVM_PROF_ERR�LLVM_PROF_FILE�LLVM_PROF_MERGER�LN�LOCALMODLIBS�LOG1P_DROPS_ZERO_SIGN�MACHDEP�MACHDEPPATH�MACHDEP_OBJS�MACHDESTLIB�MACOSX_DEPLOYMENT_TARGET�MAINCC�MAJOR_IN_MKDEV�MAJOR_IN_SYSMACROS�	MAKESETUP�MANDIR�MKDIR_P�MODLIBS�MODNAMES�MODOBJS�MODULE_OBJS�	MULTIARCH�MULTIARCH_CPPFLAGS�MVWDELCH_IS_EXPRESSION�NO_AS_NEEDED�OBJECT_OBJS�OPT�OTHER_LIBTOOL_OPT�PACKAGE_BUGREPORT�PACKAGE_NAME�PACKAGE_STRING�PACKAGE_TARNAME�PACKAGE_URL�PACKAGE_VERSION�PARSER_HEADERS�PARSER_OBJS�PGEN�PGENOBJS�PGOBJS�PGO_PROF_GEN_FLAG�PGO_PROF_USE_FLAG�PLATDIR�POBJS�POSIX_SEMAPHORES_NOT_ENABLED�PROFILE_TASK�PTHREAD_SYSTEM_SCHED_SUPPORTED�
PY3LIBRARY�PYLONG_BITS_IN_DIGIT�PYTHON�PYTHONFRAMEWORK�PYTHONFRAMEWORKDIR�PYTHONFRAMEWORKINSTALLDIR�PYTHONFRAMEWORKPREFIX�
PYTHONPATH�PYTHON_FOR_BUILD�PYTHON_FOR_REGEN�PYTHON_HEADERS�PYTHON_OBJS�	PY_CFLAGS�PY_CFLAGS_NODIST�PY_COERCE_C_LOCALE�PY_CORE_CFLAGS�PY_CORE_LDFLAGS�PY_CPPFLAGS�PY_FORMAT_SIZE_T�
PY_LDFLAGS�PY_LDFLAGS_NODIST�PY_SSL_DEFAULT_CIPHERS�PY_SSL_DEFAULT_CIPHER_STRING�PY_WARN_ON_C_LOCALE�Py_DEBUG�Py_ENABLE_SHARED�Py_HASH_ALGORITHM�
QUICKTESTOPTS�READELF�	RESSRCDIR�
RETSIGTYPE�	RUNSHARED�	SCRIPTDIR�SETPGRP_HAVE_ARG�SGI_ABI�SHELL�SHLIBS�SHLIB_SUFFIX�SIGNED_RIGHT_SHIFT_ZERO_FILLS�SITEPATH�
SIZEOF_DOUBLE�SIZEOF_FLOAT�
SIZEOF_FPOS_T�
SIZEOF_INT�SIZEOF_LONG�SIZEOF_LONG_DOUBLE�SIZEOF_LONG_LONG�SIZEOF_OFF_T�SIZEOF_PID_T�SIZEOF_PTHREAD_T�SIZEOF_SHORT�
SIZEOF_SIZE_T�
SIZEOF_TIME_T�SIZEOF_UINTPTR_T�
SIZEOF_VOID_P�SIZEOF_WCHAR_T�SIZEOF__BOOL�SOABI�SRCDIRS�
SRC_GDB_HOOKS�STDC_HEADERS�STRICT_SYSV_CURSES�	STRIPFLAG�SUBDIRS�
SUBDIRSTOO�SYSLIBS�SYS_SELECT_WITH_SYS_TIME�TANH_PRESERVES_ZERO_SIGN�TCLTK_INCLUDES�
TCLTK_LIBS�TESTOPTS�TESTPATH�
TESTPYTHON�TESTPYTHONOPTS�
TESTRUNNER�TESTTIMEOUT�	THREADOBJ�TIMEMODULE_LIB�TIME_WITH_SYS_TIME�TM_IN_SYS_TIME�UNICODE_DEPS�UNIVERSALSDK�UPDATE_FILE�USE_COMPUTED_GOTOS�
USE_INLINE�VERSION�VPATH�WANT_SIGFPE_HANDLER�WINDOW_HAS_FLAGS�WITH_DOC_STRINGS�WITH_DTRACE�	WITH_DYLD�WITH_LIBINTL�WITH_NEXT_FRAMEWORK�
WITH_PYMALLOC�WITH_THREAD�
WITH_VALGRIND�X87_DOUBLE_ROUNDING�
XMLLIBSUBDIRS�abs_builddir�
abs_srcdir�datarootdir�exec_prefix�prefix�srcdirN)�build_time_vars�r�r��@/usr/lib64/python3.6/_sysconfigdata_dm_linux_x86_64-linux-gnu.py�<module>s*_markupbase.cpython-36.opt-2.pyc000064400000016424150335715140012436 0ustar003


 \9�@sRddlZejd�jZejd�jZejd�Zejd�Zejd�Z[Gdd�d�ZdS)	�Nz[a-zA-Z][-_.a-zA-Z0-9]*\s*z(\'[^\']*\'|"[^"]*")\s*z--\s*>z	]\s*]\s*>z]\s*>c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdZdd
�Z	d"dd�Z
d#dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!S)$�
ParserBasecCs|jtkrtd��dS)Nz)_markupbase.ParserBase must be subclassed)�	__class__r�RuntimeError)�self�r�#/usr/lib64/python3.6/_markupbase.py�__init__s
zParserBase.__init__cCstd��dS)Nz.subclasses of ParserBase must override error())�NotImplementedError)r�messagerrr�error szParserBase.errorcCsd|_d|_dS)N�r)�lineno�offset)rrrr�reset$szParserBase.resetcCs|j|jfS)N)r
r)rrrr�getpos(szParserBase.getposcCsb||kr|S|j}|jd||�}|rN|j||_|jd||�}||d|_n|j|||_|S)N�
r)�rawdata�countr
�rindexr)r�i�jrZnlines�posrrr�	updatepos0szParserBase.updatepos�c
Cs�|j}|d}|||d�dkr*|dS|||d�dkrBdSt|�}|||d�dkrh|j|�S||dkr~|j|�S|j||�\}}|dkr�|S|d	kr�d|_�x||k�r�||}|dk�r�||d|�}|d	kr�|j|�n
|j|�|dS|d
k�r&t||�}|�sdS|j	�}n�|dk�rB|j||�\}	}nt||jk�rX|d}n^|dk�r�|d	k�r~|j
|d|�}n$|dk�r�|jd|�n
|jd�n|jd||�|dkr�|Sq�WdS)N�r�>�-rz--�[rZdoctypez"'Z4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ�attlist�linktype�link�elementz&unsupported '[' char in %s declarationz"unexpected '[' char in declarationz!unexpected %r char in declaration)rr���r">r r!rrr")r�len�
parse_comment�parse_marked_section�
_scan_name�_decl_othercharsZhandle_decl�unknown_decl�_declstringlit_match�end�_parse_doctype_subsetr)
rrrr�nZdecltype�c�data�m�namerrr�parse_declaration@sX











zParserBase.parse_declarationrcCs�|j}|j|d|�\}}|dkr&|S|d
kr@tj||d�}n4|dkrZtj||d�}n|jd||d|��|s|dS|r�|jd�}|j||d|��|jd�S)N�r�temp�cdata�ignore�include�rcdata�if�else�endifz+unknown status keyword %r in marked sectionr>r7r3r5r6r4>r8r9r:r")	rr&�_markedsectionclose�search�_msmarkedsectioncloser�startr(r*)rr�reportrZsectNamer�matchrrrr%�s
zParserBase.parse_marked_sectioncCsj|j}|||d�dkr$|jd�tj||d�}|s<dS|r`|jd�}|j||d|��|jd�S)N�z<!--z"unexpected call to parse_comment()rrr")rr�
_commentcloser<r>Zhandle_commentr*)rrr?rr@rrrrr$�s

zParserBase.parse_commentc
Cs4|j}t|�}|}�x||k�r.||}|dk�r4|||d�}|dkrNdS|dkrt|j||d�|jd|�|d|kr�dS|d|kr�dS|||d�dkr�|j|dd	�}|dkr|Sq|j|d|�\}}|dkr�dS|dk�r|j||d�|jd|�t|d|�}	|	||�}|dk�r,|Sq|dk�r�|d|k�rPdS|j|d|�\}}|dk�rr|S||dk�r,|d}q|dk�r�|d}x&||k�r�||j��r�|d}�q�W||k�r�||dk�r�|S|j||�|jd�ndSq|j��r|d}q|j||�|jd|�qWdS)N�<rrz<!z*unexpected char in internal subset (in %r)rAz<!--r)r?rr!�entity�notationz)unknown declaration %r in internal subsetZ_parse_doctype_�%�;�]rz%unexpected char after internal subsetz%unexpected char %r in internal subsetr"r"r"r"r">rr!rDrEr"r"r")rr#rrr$r&�getattr�isspace)
rr�declstartposrr,rr-�sr0�methrrrr+�sn











z ParserBase._parse_doctype_subsetcCsF|j||�\}}|dkrdS|j}d||d�krB|jd|�dSdS)Nrrr"r"r")r&r�find)rrrKr0rrrrr�_parse_doctype_element�sz!ParserBase._parse_doctype_elementcCs�|j}|j||�\}}|||d�}|dkr2d	S|dkrB|dS�xv|j||�\}}|dkrb|S|||d�}|dkr~d
S|dkr�d||d�kr�|jd|�d}ndSx |||d�j�r�|d}q�W||d�s�dSn|j||�\}}|||d�}|�s
d
S|dk�rLt||�}|�r.|j�}ndS|||d�}|�sLdS|dk�r�||d�dk�rldS|j|d|�\}}|dk�r�|S|||d�}|�s�dS|dkrF|dSqFWdS)Nrrrr�(�)z'"�#r"r"r"r"r"r"r"r"r")rr&rNrJr)r*)rrrKrr0rr-r/rrr�_parse_doctype_attlistsZ




z!ParserBase._parse_doctype_attlistcCs�|j||�\}}|dkr|S|j}xl|||d�}|s<dS|dkrL|dS|dkrpt||�}|sfdS|j�}q$|j||�\}}|dkr$|Sq$WdS)Nrrrz'"r"r")r&rr)r*)rrrKr0rrr-r/rrr�_parse_doctype_notation=s$

z"ParserBase._parse_doctype_notationcCs�|j}|||d�dkrV|d}x6|||d�}|s<dS|j�rN|d}q$Pq$Wn|}|j||�\}}|dkrv|Sxp|j||d�}|s�dS|dkr�t||�}|r�|j�}q�dSqx|dkr�|dS|j||�\}}|dkrx|SqxWdS)	NrrFrz'"rr"r"r")rrJr&r)r*)rrrKrrr-r0r/rrr�_parse_doctype_entityTs8


z ParserBase._parse_doctype_entitycCs�|j}t|�}||krdSt||�}|r\|j�}|j�}|t|�|krLdS|j�|j�fS|j||�|jd|||d��dS)Nrzexpected name token at %r�r")Nr"r")Nr")	rr#�_declname_match�group�strip�lowerr*rr)rrrKrr,r/rLr0rrrr&xs
zParserBase._scan_namecCsdS)Nr)rr.rrrr(�szParserBase.unknown_declN)r)r)�__name__�
__module__�__qualname__rrrrrr'r1r%r$r+rOrSrTrUr&r(rrrrrs 
R

C9$r)	�re�compiler@rWr)rBr;r=rrrrr�<module>s


threading.cpython-36.pyc000064400000111047150335715140011147 0ustar003

�\dh���@s�dZddlZddlZddlmZmZddl	m
Zddlm
Z
ddlmZmZyddlmZWn ek
r|ddlmZYnXdd	d
ddd
dddddddddddddddgZejZejZejZejZejZ y
ej!Z"Wne#k
r�dZ"YnXej$Z$[da%da&dd�Z'dd�Z(eZ)dd�Z!Gd d!�d!�Z*e*Z+Gd"d
�d
�Z,Gd#d�d�Z-Gd$d�de-�Z.Gd%d�d�Z/Gd&d�d�Z0Gd'd�de1�Z2e�j3Z4e4�d@d)d*�Z5e!�a6iZ7iZ8e
�Z9Gd+d�d�Z:Gd,d�de:�Z;Gd-d.�d.e:�Z<Gd/d0�d0e:�Z=d1d�Z>e>Z?d2d	�Z@e@ZAd3d4�ZBd5d�ZCdd6lmDZDe<�aEd7d8�ZFd9d:�ZGd;d
�ZHydd<lmIZJWn"ek
�rrdd=lKmJZJYnXd>d?�ZLdS)Az;Thread module emulating a subset of Java's threading model.�N)�	monotonic�sleep)�
format_exc)�WeakSet)�islice�count)�deque�	get_ident�active_count�	Condition�current_thread�	enumerate�main_thread�TIMEOUT_MAX�Event�Lock�RLock�	Semaphore�BoundedSemaphore�Thread�Barrier�BrokenBarrierError�Timer�ThreadError�
setprofile�settrace�local�
stack_sizecCs|adS)z�Set a profile function for all threads started from the threading module.

    The func will be passed to sys.setprofile() for each thread, before its
    run() method is called.

    N)�
_profile_hook)�func�r �!/usr/lib64/python3.6/threading.pyr2scCs|adS)z�Set a trace function for all threads started from the threading module.

    The func will be passed to sys.settrace() for each thread, before its run()
    method is called.

    N)�_trace_hook)rr r r!r<scOstdkrt||�St||�S)a2Factory function that returns a new reentrant lock.

    A reentrant lock must be released by the thread that acquired it. Once a
    thread has acquired a reentrant lock, the same thread may acquire it again
    without blocking; the thread must release it once for each time it has
    acquired it.

    N)�_CRLock�_PyRLock)�args�kwargsr r r!rJs	
c@sVeZdZdZdd�Zdd�Zddd	�ZeZd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)�_RLocka,This class implements reentrant lock objects.

    A reentrant lock must be released by the thread that acquired it. Once a
    thread has acquired a reentrant lock, the same thread may acquire it
    again without blocking; the thread must release it once for each time it
    has acquired it.

    cCst�|_d|_d|_dS)Nr)�_allocate_lock�_block�_owner�_count)�selfr r r!�__init__asz_RLock.__init__cCs^|j}yt|j}Wntk
r(YnXd|jj�r:dnd|jj|jj||j	t
t|��fS)Nz)<%s %s.%s object owner=%r count=%d at %s>�lockedZunlocked)r*�_active�name�KeyErrorr)r.�	__class__�
__module__�__qualname__r+�hex�id)r,�ownerr r r!�__repr__fsz_RLock.__repr__T�cCsDt�}|j|kr"|jd7_dS|jj||�}|r@||_d|_|S)aAcquire a lock, blocking or non-blocking.

        When invoked without arguments: if this thread already owns the lock,
        increment the recursion level by one, and return immediately. Otherwise,
        if another thread owns the lock, block until the lock is unlocked. Once
        the lock is unlocked (not owned by any thread), then grab ownership, set
        the recursion level to one, and return. If more than one thread is
        blocked waiting until the lock is unlocked, only one at a time will be
        able to grab ownership of the lock. There is no return value in this
        case.

        When invoked with the blocking argument set to true, do the same thing
        as when called without arguments, and return true.

        When invoked with the blocking argument set to false, do not block. If a
        call without an argument would block, return false immediately;
        otherwise, do the same thing as when called without arguments, and
        return true.

        When invoked with the floating-point timeout argument set to a positive
        value, block for at most the number of seconds specified by timeout
        and as long as the lock cannot be acquired.  Return true if the lock has
        been acquired, false if the timeout has elapsed.

        r9)r	r*r+r)�acquire)r,�blocking�timeout�me�rcr r r!r:us
z_RLock.acquirecCs<|jt�krtd��|jd|_}|s8d|_|jj�dS)amRelease a lock, decrementing the recursion level.

        If after the decrement it is zero, reset the lock to unlocked (not owned
        by any thread), and if any other threads are blocked waiting for the
        lock to become unlocked, allow exactly one of them to proceed. If after
        the decrement the recursion level is still nonzero, the lock remains
        locked and owned by the calling thread.

        Only call this method when the calling thread owns the lock. A
        RuntimeError is raised if this method is called when the lock is
        unlocked.

        There is no return value.

        zcannot release un-acquired lockr9N)r*r	�RuntimeErrorr+r)�release)r,rr r r!r@�sz_RLock.releasecCs|j�dS)N)r@)r,�t�v�tbr r r!�__exit__�sz_RLock.__exit__cCs|jj�|\|_|_dS)N)r)r:r+r*)r,�stater r r!�_acquire_restore�s
z_RLock._acquire_restorecCs<|jdkrtd��|j}d|_|j}d|_|jj�||fS)Nrzcannot release un-acquired lock)r+r?r*r)r@)r,rr7r r r!�
_release_save�s

z_RLock._release_savecCs|jt�kS)N)r*r	)r,r r r!�	_is_owned�sz_RLock._is_ownedN���)TrI)
�__name__r3r4�__doc__r-r8r:�	__enter__r@rDrFrGrHr r r r!r'Ws
$
r'c@steZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
ddd�Zddd�Zddd�Z
dd�ZeZdS)rajClass that implements a condition variable.

    A condition variable allows one or more threads to wait until they are
    notified by another thread.

    If the lock argument is given and not None, it must be a Lock or RLock
    object, and it is used as the underlying lock. Otherwise, a new RLock object
    is created and used as the underlying lock.

    NcCs�|dkrt�}||_|j|_|j|_y|j|_Wntk
rDYnXy|j|_Wntk
rfYnXy|j|_Wntk
r�YnXt�|_	dS)N)
r�_lockr:r@rG�AttributeErrorrFrH�_deque�_waiters)r,�lockr r r!r-�s$zCondition.__init__cCs
|jj�S)N)rMrL)r,r r r!rL�szCondition.__enter__cGs|jj|�S)N)rMrD)r,r%r r r!rD�szCondition.__exit__cCsd|jt|j�fS)Nz<Condition(%s, %d)>)rM�lenrP)r,r r r!r8�szCondition.__repr__cCs|jj�dS)N)rMr@)r,r r r!rG�szCondition._release_savecCs|jj�dS)N)rMr:)r,�xr r r!rF�szCondition._acquire_restorecCs"|jjd�r|jj�dSdSdS)NrFT)rMr:r@)r,r r r!rH�s
zCondition._is_ownedcCs�|j�std��t�}|j�|jj|�|j�}d}z�|dkrN|j�d}nj|dkr�t�|}d}xR|jd�}|rvPt|t�|�}|dkr�Pt|d|d�}t	|�qfWn
|jd�}|S|j
|�|s�y|jj|�Wntk
r�YnXXdS)	akWait until notified or until a timeout occurs.

        If the calling thread has not acquired the lock when this method is
        called, a RuntimeError is raised.

        This method releases the underlying lock, and then blocks until it is
        awakened by a notify() or notify_all() call for the same condition
        variable in another thread, or until the optional timeout occurs. Once
        awakened or timed out, it re-acquires the lock and returns.

        When the timeout argument is present and not None, it should be a
        floating point number specifying a timeout for the operation in seconds
        (or fractions thereof).

        When the underlying lock is an RLock, it is not released using its
        release() method, since this may not actually unlock the lock when it
        was acquired multiple times recursively. Instead, an internal interface
        of the RLock class is used, which really unlocks it even when it has
        been recursively acquired several times. Another internal interface is
        then used to restore the recursion level when the lock is reacquired.

        zcannot wait on un-acquired lockFNTrg����Mb@?�g�������?)
rHr?r(r:rP�appendrG�_time�min�_sleeprF�remove�
ValueError)r,r<�waiterZsaved_stateZgotit�endtimeZdelayZ	remainingr r r!�waits>	



zCondition.waitcCs\d}|}|�}xH|sV|dk	rD|dkr0t�|}n|t�}|dkrDP|j|�|�}qW|S)z�Wait until a condition evaluates to True.

        predicate should be a callable which result will be interpreted as a
        boolean value.  A timeout may be provided giving the maximum time to
        wait.

        Nr)rVr])r,Z	predicater<r\Zwaittime�resultr r r!�wait_forIs


zCondition.wait_forr9cCsj|j�std��|j}tt||��}|s,dSx8|D]0}|j�y|j|�Wq2tk
r`Yq2Xq2WdS)aKWake up one or more threads waiting on this condition, if any.

        If the calling thread has not acquired the lock when this method is
        called, a RuntimeError is raised.

        This method wakes up at most n of the threads waiting for the condition
        variable; it is a no-op if no threads are waiting.

        z!cannot notify on un-acquired lockN)rHr?rPrO�_islicer@rYrZ)r,�nZall_waitersZwaiters_to_notifyr[r r r!�notify`s

zCondition.notifycCs|jt|j��dS)z�Wake up all threads waiting on this condition.

        If the calling thread has not acquired the lock when this method
        is called, a RuntimeError is raised.

        N)rbrRrP)r,r r r!�
notify_allwszCondition.notify_all)N)N)N)r9)rJr3r4rKr-rLrDr8rGrFrHr]r_rbrcZ	notifyAllr r r r!r�s

	
B

	c@s8eZdZdZd
dd�Zddd�ZeZd	d
�Zdd�ZdS)raGThis class implements semaphore objects.

    Semaphores manage a counter representing the number of release() calls minus
    the number of acquire() calls, plus an initial value. The acquire() method
    blocks if necessary until it can return without making the counter
    negative. If not given, value defaults to 1.

    r9cCs&|dkrtd��tt��|_||_dS)Nrz$semaphore initial value must be >= 0)rZrr�_cond�_value)r,�valuer r r!r-�szSemaphore.__init__TNc
Cs�|r|dk	rtd��d}d}|j�jxb|jdkrv|s8P|dk	rh|dkrTt�|}n|t�}|dkrhP|jj|�q(W|jd8_d}WdQRX|S)a�Acquire a semaphore, decrementing the internal counter by one.

        When invoked without arguments: if the internal counter is larger than
        zero on entry, decrement it by one and return immediately. If it is zero
        on entry, block, waiting until some other thread has called release() to
        make it larger than zero. This is done with proper interlocking so that
        if multiple acquire() calls are blocked, release() will wake exactly one
        of them up. The implementation may pick one at random, so the order in
        which blocked threads are awakened should not be relied on. There is no
        return value in this case.

        When invoked with blocking set to true, do the same thing as when called
        without arguments, and return true.

        When invoked with blocking set to false, do not block. If a call without
        an argument would block, return false immediately; otherwise, do the
        same thing as when called without arguments, and return true.

        When invoked with a timeout other than None, it will block for at
        most timeout seconds.  If acquire does not complete successfully in
        that interval, return false.  Return true otherwise.

        Nz.can't specify timeout for non-blocking acquireFrr9T)rZrdrerVr])r,r;r<r>r\r r r!r:�s$
zSemaphore.acquirec
Cs.|j�|jd7_|jj�WdQRXdS)z�Release a semaphore, incrementing the internal counter by one.

        When the counter is zero on entry and another thread is waiting for it
        to become larger than zero again, wake up that thread.

        r9N)rdrerb)r,r r r!r@�szSemaphore.releasecCs|j�dS)N)r@)r,rArBrCr r r!rD�szSemaphore.__exit__)r9)TN)	rJr3r4rKr-r:rLr@rDr r r r!r�s

-c@s"eZdZdZddd�Zdd�ZdS)	ra�Implements a bounded semaphore.

    A bounded semaphore checks to make sure its current value doesn't exceed its
    initial value. If it does, ValueError is raised. In most situations
    semaphores are used to guard resources with limited capacity.

    If the semaphore is released too many times it's a sign of a bug. If not
    given, value defaults to 1.

    Like regular semaphores, bounded semaphores manage a counter representing
    the number of release() calls minus the number of acquire() calls, plus an
    initial value. The acquire() method blocks if necessary until it can return
    without making the counter negative. If not given, value defaults to 1.

    r9cCstj||�||_dS)N)rr-�_initial_value)r,rfr r r!r-�szBoundedSemaphore.__init__c
CsB|j�2|j|jkrtd��|jd7_|jj�WdQRXdS)a6Release a semaphore, incrementing the internal counter by one.

        When the counter is zero on entry and another thread is waiting for it
        to become larger than zero again, wake up that thread.

        If the number of releases exceeds the number of acquires,
        raise a ValueError.

        z!Semaphore released too many timesr9N)rdrergrZrb)r,r r r!r@�s

zBoundedSemaphore.releaseN)r9)rJr3r4rKr-r@r r r r!r�s
c@sFeZdZdZdd�Zdd�Zdd�ZeZdd	�Zd
d�Z	dd
d�Z
dS)rz�Class implementing event objects.

    Events manage a flag that can be set to true with the set() method and reset
    to false with the clear() method. The wait() method blocks until the flag is
    true.  The flag is initially false.

    cCstt��|_d|_dS)NF)rrrd�_flag)r,r r r!r-szEvent.__init__cCs|jjt��dS)N)rdr-r)r,r r r!�_reset_internal_locksszEvent._reset_internal_lockscCs|jS)z5Return true if and only if the internal flag is true.)rh)r,r r r!�is_setszEvent.is_setc	Cs&|j�d|_|jj�WdQRXdS)z�Set the internal flag to true.

        All threads waiting for it to become true are awakened. Threads
        that call wait() once the flag is true will not block at all.

        TN)rdrhrc)r,r r r!�setsz	Event.setc	Cs|j�d|_WdQRXdS)z�Reset the internal flag to false.

        Subsequently, threads calling wait() will block until set() is called to
        set the internal flag to true again.

        FN)rdrh)r,r r r!�clearszEvent.clearNc	Cs,|j�|j}|s|jj|�}|SQRXdS)aHBlock until the internal flag is true.

        If the internal flag is true on entry, return immediately. Otherwise,
        block until another thread calls set() to set the flag to true, or until
        the optional timeout occurs.

        When the timeout argument is present and not None, it should be a
        floating point number specifying a timeout for the operation in seconds
        (or fractions thereof).

        This method returns the internal flag on exit, so it will always return
        True except if a timeout is given and the operation times out.

        N)rdrhr])r,r<Zsignaledr r r!r]'s
z
Event.wait)N)rJr3r4rKr-rirjZisSetrkrlr]r r r r!r�s
c@s�eZdZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Ze
dd��Ze
dd��Ze
dd��ZdS)rz�Implements a Barrier.

    Useful for synchronizing a fixed number of threads at known synchronization
    points.  Threads block on 'wait()' and are simultaneously once they have all
    made that call.

    NcCs.tt��|_||_||_||_d|_d|_dS)aWCreate a barrier, initialised to 'parties' threads.

        'action' is a callable which, when supplied, will be called by one of
        the threads after they have all entered the barrier and just prior to
        releasing them all. If a 'timeout' is provided, it is uses as the
        default for all subsequent 'wait()' calls.

        rN)rrrd�_action�_timeout�_parties�_stater+)r,�parties�actionr<r r r!r-Qs	zBarrier.__init__cCs�|dkr|j}|j�b|j�|j}|jd7_z&|d|jkrL|j�n
|j|�|S|jd8_|j�XWdQRXdS)aNWait for the barrier.

        When the specified number of threads have started waiting, they are all
        simultaneously awoken. If an 'action' was provided for the barrier, one
        of the threads will have executed that callback prior to returning.
        Returns an individual index number from 0 to 'parties-1'.

        Nr9)rnrd�_enterr+ro�_release�_wait�_exit)r,r<�indexr r r!r]as	

zBarrier.waitcCs:x|jdkr|jj�qW|jdkr(t�|jdks6t�dS)Nr9rrI)rIr9)rprdr]r�AssertionError)r,r r r!rss

zBarrier._enterc	Cs>y"|jr|j�d|_|jj�Wn|j��YnXdS)Nr9)rmrprdrc�_break)r,r r r!rt�szBarrier._releasecsB�jj�fdd�|�s"�j�t��jdkr0t��jdks>t�dS)Ncs
�jdkS)Nr)rpr )r,r r!�<lambda>�szBarrier._wait.<locals>.<lambda>rr9)rdr_ryrrprx)r,r<r )r,r!ru�s
z
Barrier._waitcCs(|jdkr$|jdkr$d|_|jj�dS)Nrr9rI)rIr9)r+rprdrc)r,r r r!rv�s

z
Barrier._exitc	CsT|j�D|jdkr6|jdkr$d|_q<|jdkr<d|_nd|_|jj�WdQRXdS)z�Reset the barrier to the initial state.

        Any threads currently waiting will get the BrokenBarrier exception
        raised.

        rr9rTNrI���rI)rdr+rprc)r,r r r!�reset�s


z
Barrier.resetc	Cs|j�|j�WdQRXdS)z�Place the barrier into a 'broken' state.

        Useful in case of error.  Any currently waiting threads and threads
        attempting to 'wait()' will have BrokenBarrierError raised.

        N)rdry)r,r r r!�abort�sz
Barrier.abortcCsd|_|jj�dS)NrTr{)rprdrc)r,r r r!ry�szBarrier._breakcCs|jS)z:Return the number of threads required to trip the barrier.)ro)r,r r r!rq�szBarrier.partiescCs|jdkr|jSdS)z>Return the number of threads currently waiting at the barrier.r)rpr+)r,r r r!�	n_waiting�s
zBarrier.n_waitingcCs
|jdkS)z0Return True if the barrier is in a broken state.rTr{)rp)r,r r r!�broken�szBarrier.broken)NN)N)rJr3r4rKr-r]rsrtrurvr|r}ry�propertyrqr~rr r r r!rHs


	c@seZdZdS)rN)rJr3r4r r r r!r�s�	Thread-%dcCs
|t�S)N)�_counter)�templater r r!�_newname�sr�c@seZdZdZdZejZdddfdfdd�dd�Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd3dd�Zd5dd �Zed!d"��Zejd#d"��Zed$d%��Zd&d'�ZeZed(d)��Zejd*d)��Zd+d,�Zd-d.�Zd/d0�Zd1d2�ZdS)6raA class that represents a thread of control.

    This class can be safely subclassed in a limited fashion. There are two ways
    to specify the activity: by passing a callable object to the constructor, or
    by overriding the run() method in a subclass.

    FN)�daemoncCs�|dkstd��|dkri}||_t|p,t��|_||_||_|dk	rN||_n
t�j	|_d|_
d|_t�|_
d|_d|_tj|_tj|�dS)aKThis constructor should always be called with keyword arguments. Arguments are:

        *group* should be None; reserved for future extension when a ThreadGroup
        class is implemented.

        *target* is the callable object to be invoked by the run()
        method. Defaults to None, meaning nothing is called.

        *name* is the thread name. By default, a unique name is constructed of
        the form "Thread-N" where N is a small decimal number.

        *args* is the argument tuple for the target invocation. Defaults to ().

        *kwargs* is a dictionary of keyword arguments for the target
        invocation. Defaults to {}.

        If a subclass overrides the constructor, it must make sure to invoke
        the base class constructor (Thread.__init__()) before doing anything
        else to the thread.

        Nz#group argument must be None for nowFT)rx�_target�strr��_name�_args�_kwargs�	_daemonicrr��_ident�_tstate_lockr�_started�_is_stopped�_initialized�_sys�stderr�_stderr�	_dangling�add)r,�group�targetr0r%r&r�r r r!r-
s"
zThread.__init__cCs(|jj�|r|j�nd|_d|_dS)NT)r�ri�_set_tstate_lockr�r�)r,�is_aliver r r!ri7s


zThread._reset_internal_lockscCsl|jstd��d}|jj�r d}|j�|jr2d}|jr@|d7}|jdk	rX|d|j7}d|jj	|j
|fS)Nz Thread.__init__() was not called�initialZstartedZstoppedz daemonz %sz<%s(%s, %s)>)r�rxr�rjr�r�r�r�r2rJr�)r,Zstatusr r r!r8Cs

zThread.__repr__cCs�|jstd��|jj�r td��t�|t|<WdQRXyt|jf�Wn,tk
rtt�t|=WdQRX�YnX|jj	�dS)a-Start the thread's activity.

        It must be called at most once per thread object. It arranges for the
        object's run() method to be invoked in a separate thread of control.

        This method will raise a RuntimeError if called more than once on the
        same thread object.

        zthread.__init__() not calledz threads can only be started onceN)
r�r?r�rj�_active_limbo_lock�_limbo�_start_new_thread�
_bootstrap�	Exceptionr])r,r r r!�startQs

zThread.startc
Cs.z|jr|j|j|j�Wd|`|`|`XdS)aXMethod representing the thread's activity.

        You may override this method in a subclass. The standard run() method
        invokes the callable object passed to the object's constructor as the
        target argument, if any, with sequential and keyword arguments taken
        from the args and kwargs arguments, respectively.

        N)r�r�r�)r,r r r!�runjs	z
Thread.runc	Cs2y|j�Wn |jr&tdkr&dS�YnXdS)N)�_bootstrap_innerr�r�)r,r r r!r�{s
zThread._bootstrapcCst�|_dS)N)r	r�)r,r r r!�
_set_ident�szThread._set_identcCst�|_|jj�dS)z�
        Set a lock object which will be released by the interpreter when
        the underlying thread state (see pystate.h) gets deleted.
        N)�
_set_sentinelr�r:)r,r r r!r��szThread._set_tstate_lockc2Cs��zT|j�|j�|jj�t�|t|j<t|=WdQRXtrLt	j
t�trZt	jt�z�y|j
�Wn�tk
r|Yn�t	r�t	jdk	r�td|jt�ft	jd�n�|jdk	�rH|j�\}}}zxtd|jd|jd�td|jd�x6|�r$td|jjj|j|jjjf|jd�|j}q�Wtd||f|jd�Wd~~~XYnXWdXWdt� ytt�=WnYnXWdQRXXdS)NzException in thread %s:
%s)�filezException in thread z2 (most likely raised during interpreter shutdown):z"Traceback (most recent call last):z  File "%s", line %s, in %sz%s: %s)r�r�r�rkr�r/r�r�r"r�rrrr��
SystemExitr��printr0�_format_excr��	_exc_info�tb_frame�f_code�co_filename�	tb_lineno�co_name�tb_nextr	)r,�exc_type�	exc_valueZexc_tbr r r!r��sT




zThread._bootstrap_innercCs,|j}|dk	r|j�st�d|_d|_dS)NT)r�r.rxr�)r,rQr r r!�_stop�s
zThread._stopcCsByt�tt�=WdQRXWn tk
r<dtjkr8�YnXdS)zARemove current thread from the dict of currently running threads.NZdummy_threading)r�r/r	r1r��modules)r,r r r!�_delete�s
zThread._deletecCsZ|jstd��|jj�s td��|t�kr2td��|dkrD|j�n|jt|d�d�dS)aWait until the thread terminates.

        This blocks the calling thread until the thread whose join() method is
        called terminates -- either normally or through an unhandled exception
        or until the optional timeout occurs.

        When the timeout argument is present and not None, it should be a
        floating point number specifying a timeout for the operation in seconds
        (or fractions thereof). As join() always returns None, you must call
        isAlive() after join() to decide whether a timeout happened -- if the
        thread is still alive, the join() call timed out.

        When the timeout argument is not present or None, the operation will
        block until the thread terminates.

        A thread can be join()ed many times.

        join() raises a RuntimeError if an attempt is made to join the current
        thread as that would cause a deadlock. It is also an error to join() a
        thread before it has been started and attempts to do so raises the same
        exception.

        zThread.__init__() not calledz'cannot join thread before it is startedzcannot join current threadNr)r<)r�r?r�rjr�_wait_for_tstate_lock�max)r,r<r r r!�joins


zThread.joinTr9cCs:|j}|dkr|js6t�n|j||�r6|j�|j�dS)N)r�r�rxr:r@r�)r,�blockr<rQr r r!r�;szThread._wait_for_tstate_lockcCs|jstd��|jS)z�A string used for identification purposes only.

        It has no semantics. Multiple threads may be given the same name. The
        initial name is set by the constructor.

        zThread.__init__() not called)r�rxr�)r,r r r!r0IszThread.namecCs|jstd��t|�|_dS)NzThread.__init__() not called)r�rxr�r�)r,r0r r r!r0TscCs|jstd��|jS)a4Thread identifier of this thread or None if it has not been started.

        This is a nonzero integer. See the get_ident() function. Thread
        identifiers may be recycled when a thread exits and another thread is
        created. The identifier is available even after the thread has exited.

        zThread.__init__() not called)r�rxr�)r,r r r!�identYs	zThread.identcCs6|jstd��|js |jj�r$dS|jd�|jS)z�Return whether the thread is alive.

        This method returns True just before the run() method starts until just
        after the run() method terminates. The module function enumerate()
        returns a list of all alive threads.

        zThread.__init__() not calledF)r�rxr�r�rjr�)r,r r r!r�es

zThread.is_alivecCs|jstd��|jS)a�A boolean value indicating whether this thread is a daemon thread.

        This must be set before start() is called, otherwise RuntimeError is
        raised. Its initial value is inherited from the creating thread; the
        main thread is not a daemon thread and therefore all threads created in
        the main thread default to daemon = False.

        The entire Python program exits when no alive non-daemon threads are
        left.

        zThread.__init__() not called)r�rxr�)r,r r r!r�us
z
Thread.daemoncCs*|jstd��|jj�r td��||_dS)NzThread.__init__() not calledz)cannot set daemon status of active thread)r�r?r�rjr�)r,�daemonicr r r!r��s

cCs|jS)N)r�)r,r r r!�isDaemon�szThread.isDaemoncCs
||_dS)N)r�)r,r�r r r!�	setDaemon�szThread.setDaemoncCs|jS)N)r0)r,r r r!�getName�szThread.getNamecCs
||_dS)N)r0)r,r0r r r!�setName�szThread.setName)NrI)TrI) rJr3r4rKr�r��exc_infor�r-rir8r�r�r�r�r�r�r�r�r�r�r�r0�setterr�r�ZisAliver�r�r�r�r�r r r r!r�s8,A#
&
c@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
rz�Call a function after a specified number of seconds:

            t = Timer(30.0, f, args=None, kwargs=None)
            t.start()
            t.cancel()     # stop the timer's action if it's still waiting

    NcCsFtj|�||_||_|dk	r"|ng|_|dk	r4|ni|_t�|_dS)N)rr-�interval�functionr%r&r�finished)r,r�r�r%r&r r r!r-�s
zTimer.__init__cCs|jj�dS)z)Stop the timer if it hasn't finished yet.N)r�rk)r,r r r!�cancel�szTimer.cancelcCs6|jj|j�|jj�s(|j|j|j�|jj�dS)N)r�r]r�rjr�r%r&rk)r,r r r!r��s
z	Timer.run)NN)rJr3r4rKr-r�r�r r r r!r�s
c@seZdZdd�ZdS)�_MainThreadc
CsHtj|ddd�|j�|jj�|j�t�|t|j<WdQRXdS)NZ
MainThreadF)r0r�)	rr-r�r�rkr�r�r/r�)r,r r r!r-�s
z_MainThread.__init__N)rJr3r4r-r r r r!r��sr�c@s.eZdZdd�Zdd�Zdd�Zd
dd	�ZdS)�_DummyThreadc
CsDtj|td�dd�|jj�|j�t�|t|j<WdQRXdS)NzDummy-%dT)r0r�)	rr-r�r�rkr�r�r/r�)r,r r r!r-�s

z_DummyThread.__init__cCsdS)Nr )r,r r r!r��sz_DummyThread._stopcCs|jr|jj�st�dS)NT)r�r�rjrx)r,r r r!r��sz_DummyThread.is_aliveNcCsdstd��dS)NFzcannot join a dummy thread)rx)r,r<r r r!r��sz_DummyThread.join)N)rJr3r4r-r�r�r�r r r r!r��sr�cCs&y
tt�Stk
r t�SXdS)z�Return the current Thread object, corresponding to the caller's thread of control.

    If the caller's thread of control was not created through the threading
    module, a dummy thread object with limited functionality is returned.

    N)r/r	r1r�r r r r!r�s
c
Cs t�tt�tt�SQRXdS)z�Return the number of Thread objects currently alive.

    The returned count is equal to the length of the list returned by
    enumerate().

    N)r�rRr/r�r r r r!r
�scCsttj��ttj��S)N)�listr/�valuesr�r r r r!�
_enumerate�sr�c
Cs(t�ttj��ttj��SQRXdS)z�Return a list of all Thread objects currently alive.

    The list includes daemonic threads, dummy thread objects created by
    current_thread(), and the main thread. It excludes terminated threads and
    threads that have not yet been started.

    N)r�r�r/r�r�r r r r!r
s)rcCsPtj}|dk	st�|j�st�|j�tj�t�}x|rJ|j�t�}q6WdS)N)�_main_threadr�rxr.r@r��_pickSomeNonDaemonThreadr�)ZtlockrAr r r!�	_shutdownsr�cCs(x"t�D]}|jr|j�r|SqWdS)N)r
r�r�)rAr r r!r�&sr�cCstS)z�Return the main thread object.

    In normal conditions, the main thread is the thread from which the
    Python interpreter was started.
    )r�r r r r!r,s)�_local)rcCs�t�ai}t�}|at��tt��}|jt�xF|D]>}||kr`|jd�t	�}||_
|||<q4|jd�|j�q4Wtj
�tj
�tj|�tt�dks�t�WdQRXdS)NTFr9)rr�rr�rkr��updater�rir	r�r�r�rlr/rRrx)Z
new_activeZcurrentZthreadsZthreadr�r r r!�_after_fork=s&






r�)r�)MrK�sysr��_threadZtimerrVrrX�	tracebackrr��_weakrefsetr�	itertoolsrr`rr+�_collectionsrrO�ImportError�collections�__all__�start_new_threadr��
allocate_lockr(r�r	�errorrrr#rNrrr"rrrr'r$rrrrrr?r�__next__r�r�r�r/r�r�rrr�r�rZ
currentThreadr
ZactiveCountr�r
rr�r�r�rr�rZ_threading_localr�r r r r!�<module>s�



q9P&O
'
_markupbase.cpython-36.pyc000064400000017471150335715140011501 0ustar003


 \9�@sVdZddlZejd�jZejd�jZejd�Zejd�Zejd�Z[Gdd	�d	�Z	dS)
z�Shared support for scanning document type declarations in HTML and XHTML.

This module is used as a foundation for the html.parser module.  It has no
documented public API and should not be used directly.

�Nz[a-zA-Z][-_.a-zA-Z0-9]*\s*z(\'[^\']*\'|"[^"]*")\s*z--\s*>z	]\s*]\s*>z]\s*>c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdZ	d
d�Z
d#dd�Zd$dd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"S)%�
ParserBaseziParser base class which provides some common support methods used
    by the SGML/HTML and XHTML parsers.cCs|jtkrtd��dS)Nz)_markupbase.ParserBase must be subclassed)�	__class__r�RuntimeError)�self�r�#/usr/lib64/python3.6/_markupbase.py�__init__s
zParserBase.__init__cCstd��dS)Nz.subclasses of ParserBase must override error())�NotImplementedError)r�messagerrr�error szParserBase.errorcCsd|_d|_dS)N�r)�lineno�offset)rrrr�reset$szParserBase.resetcCs|j|jfS)z&Return current line number and offset.)r
r)rrrr�getpos(szParserBase.getposcCsb||kr|S|j}|jd||�}|rN|j||_|jd||�}||d|_n|j|||_|S)N�
r)�rawdata�countr
�rindexr)r�i�jrZnlines�posrrr�	updatepos0szParserBase.updatepos�c
Cs�|j}|d}|||�dks&td��|||d�dkrB|dS|||d�dkrZdSt|�}|||d�dkr�|j|�S||d	kr�|j|�S|j||�\}}|d
kr�|S|dkr�d|_�x||k�r�||}|dk�r||d|�}|dk�r|j|�n
|j|�|dS|dk�r@t	||�}|�s6dS|j
�}n�|d
k�r\|j||�\}	}nt||jk�rr|d}n^|d	k�r�|dk�r�|j|d|�}n$|dk�r�|jd|�n
|jd�n|jd||�|d
kr�|Sq�WdS)N�z<!z$unexpected call to parse_declarationr�>�-rz--�[rZdoctypez"'Z4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ�attlist�linktype�link�elementz&unsupported '[' char in %s declarationz"unexpected '[' char in declarationz!unexpected %r char in declaration)rr���r">r r!rrr")
r�AssertionError�len�
parse_comment�parse_marked_section�
_scan_name�_decl_othercharsZhandle_decl�unknown_decl�_declstringlit_match�end�_parse_doctype_subsetr)
rrrr�nZdecltype�c�data�m�namerrr�parse_declaration@sZ












zParserBase.parse_declarationrcCs�|j}|||d�dks"td��|j|d|�\}}|dkrB|S|dkr\tj||d�}n4|dkrvtj||d�}n|jd
||d|��|s�dS|r�|jd�}|j||d|��|j	d�S)N�z<![z)unexpected call to parse_marked_section()r�temp�cdata�ignore�include�rcdata�if�else�endifz+unknown status keyword %r in marked sectionr>r8r4r6r7r5>r9r:r;r")
rr#r'�_markedsectionclose�search�_msmarkedsectioncloser�startr)r+)rr�reportrZsectNamer�matchrrrr&�s 
zParserBase.parse_marked_sectioncCsj|j}|||d�dkr$|jd�tj||d�}|s<dS|r`|jd�}|j||d|��|jd�S)N�z<!--z"unexpected call to parse_comment()rrr")rr�
_commentcloser=r?Zhandle_commentr+)rrr@rrArrrrr%�s

zParserBase.parse_commentc
Cs4|j}t|�}|}�x||k�r.||}|dk�r4|||d�}|dkrNdS|dkrt|j||d�|jd|�|d|kr�dS|d|kr�dS|||d�dkr�|j|dd	�}|dkr|Sq|j|d|�\}}|dkr�dS|dk�r|j||d�|jd|�t|d|�}	|	||�}|dk�r,|Sq|dk�r�|d|k�rPdS|j|d|�\}}|dk�rr|S||dk�r,|d}q|dk�r�|d}x&||k�r�||j��r�|d}�q�W||k�r�||dk�r�|S|j||�|jd�ndSq|j��r|d}q|j||�|jd|�qWdS)N�<rrz<!z*unexpected char in internal subset (in %r)rBz<!--r)r@rr!�entity�notationz)unknown declaration %r in internal subsetZ_parse_doctype_�%�;�]rz%unexpected char after internal subsetz%unexpected char %r in internal subsetr"r"r"r"r">rr!rErFr"r"r")rr$rrr%r'�getattr�isspace)
rr�declstartposrr-rr.�sr1�methrrrr,�sn











z ParserBase._parse_doctype_subsetcCsF|j||�\}}|dkrdS|j}d||d�krB|jd|�dSdS)Nrrr"r"r")r'r�find)rrrLr1rrrrr�_parse_doctype_element�sz!ParserBase._parse_doctype_elementcCs�|j}|j||�\}}|||d�}|dkr2d	S|dkrB|dS�xv|j||�\}}|dkrb|S|||d�}|dkr~d
S|dkr�d||d�kr�|jd|�d}ndSx |||d�j�r�|d}q�W||d�s�dSn|j||�\}}|||d�}|�s
d
S|dk�rLt||�}|�r.|j�}ndS|||d�}|�sLdS|dk�r�||d�dk�rldS|j|d|�\}}|dk�r�|S|||d�}|�s�dS|dkrF|dSqFWdS)Nrrrr�(�)z'"�#r"r"r"r"r"r"r"r"r")rr'rOrKr*r+)rrrLrr1rr.r0rrr�_parse_doctype_attlistsZ




z!ParserBase._parse_doctype_attlistcCs�|j||�\}}|dkr|S|j}xl|||d�}|s<dS|dkrL|dS|dkrpt||�}|sfdS|j�}q$|j||�\}}|dkr$|Sq$WdS)Nrrrz'"r"r")r'rr*r+)rrrLr1rrr.r0rrr�_parse_doctype_notation=s$

z"ParserBase._parse_doctype_notationcCs�|j}|||d�dkrV|d}x6|||d�}|s<dS|j�rN|d}q$Pq$Wn|}|j||�\}}|dkrv|Sxp|j||d�}|s�dS|dkr�t||�}|r�|j�}q�dSqx|dkr�|dS|j||�\}}|dkrx|SqxWdS)	NrrGrz'"rr"r"r")rrKr'r*r+)rrrLrrr.r1r0rrr�_parse_doctype_entityTs8


z ParserBase._parse_doctype_entitycCs�|j}t|�}||krdSt||�}|r\|j�}|j�}|t|�|krLdS|j�|j�fS|j||�|jd|||d��dS)Nrzexpected name token at %r�r")Nr"r")Nr")	rr$�_declname_match�group�strip�lowerr+rr)rrrLrr-r0rMr1rrrr'xs
zParserBase._scan_namecCsdS)Nr)rr/rrrr)�szParserBase.unknown_declN)r)r)�__name__�
__module__�__qualname__�__doc__rrrrrr(r2r&r%r,rPrTrUrVr'r)rrrrrs"
R

C9$r)
r_�re�compilerArXr*rCr<r>rrrrr�<module>s


_sitebuiltins.cpython-36.opt-1.pyc000064400000006555150335715140013025 0ustar003


 \+�@s@dZddlZGdd�de�ZGdd�de�ZGdd�de�ZdS)	z=
The objects used by the site module to add custom builtins.
�Nc@s&eZdZdd�Zdd�Zddd�ZdS)	�QuittercCs||_||_dS)N)�name�eof)�selfrr�r�%/usr/lib64/python3.6/_sitebuiltins.py�__init__szQuitter.__init__cCsd|j|jfS)NzUse %s() or %s to exit)rr)rrrr�__repr__szQuitter.__repr__Nc	Cs(ytjj�WnYnXt|��dS)N)�sys�stdin�close�
SystemExit)r�coderrr�__call__s
zQuitter.__call__)N)�__name__�
__module__�__qualname__rr	rrrrrr
src@s:eZdZdZdZfffdd�Zdd�Zdd�Zd	d
�ZdS)�_Printerzninteractive prompt objects for printing the license text, a list of
    contributors and the copyright notice.�cs4ddl�||_||_d|_��fdd�|D�|_dS)Nrcs$g|]}�D]}�jj||��qqSr)�path�join)�.0�dir�filename)�files�osrr�
<listcomp>(sz%_Printer.__init__.<locals>.<listcomp>)r�_Printer__name�_Printer__data�_Printer__lines�_Printer__filenames)rr�datar�dirsr)rrrr#sz_Printer.__init__cCs~|jr
dSd}xH|jD]>}y$t|d��}|j�}WdQRXPWqtk
rRYqXqW|sb|j}|jd�|_t|j�|_dS)N�r�
)	rr �open�read�OSErrorr�split�len�_Printer__linecnt)rr!r�fprrr�__setup,s
z_Printer.__setupcCs8|j�t|j�|jkr$dj|j�Sd|jfdSdS)Nr$z!Type %s() to see the full %s text�)�_Printer__setupr)r�MAXLINESrr)rrrrr	<sz_Printer.__repr__cCs�|j�d}d}x�y,x&t|||j�D]}t|j|�q&WWntk
rTPYqX||j7}d}x |dkr�t|�}|dkrfd}qfW|dkrPqWdS)Nz0Hit Return for more, or q (and Return) to quit: r��q)r0r1)r.�ranger/�printr�
IndexError�input)r�prompt�lineno�i�keyrrrrCs"

z_Printer.__call__N)	rrr�__doc__r/rr.r	rrrrrrs	rc@s eZdZdZdd�Zdd�ZdS)�_Helpera3Define the builtin 'help'.

    This is a wrapper around pydoc.help that provides a helpful message
    when 'help' is typed at the Python interactive prompt.

    Calling help() at the Python prompt starts an interactive help session.
    Calling help(thing) prints help for the python object 'thing'.
    cCsdS)NzHType help() for interactive help, or help(object) for help about object.r)rrrrr	bsz_Helper.__repr__cOsddl}|j||�S)Nr)�pydoc�help)r�args�kwdsr<rrrresz_Helper.__call__N)rrrr:r	rrrrrr;Xsr;)r:r
�objectrrr;rrrr�<module>s;asynchat.cpython-36.pyc000064400000015241150335715140011013 0ustar003


 \@,�@sDdZddlZddlmZGdd�dej�ZGdd�d�Zdd	�ZdS)
a�A class supporting chat-style (command/response) protocols.

This class adds support for 'chat' style protocols - where one side
sends a 'command', and the other sends a response (examples would be
the common internet protocols - smtp, nntp, ftp, etc..).

The handle_read() method looks at the input stream for the current
'terminator' (usually '\r\n' for single-line responses, '\r\n.\r\n'
for multi-line output), calling self.found_terminator() on its
receipt.

for example:
Say you build an async nntp client using this class.  At the start
of the connection, you'll have self.terminator set to '\r\n', in
order to process the single-line greeting.  Just before issuing a
'LIST' command you'll set it to '\r\n.\r\n'.  The output of the LIST
command will be accumulated (using your own 'collect_incoming_data'
method) up to the terminator, and then control will be returned to
you - by calling your self.found_terminator() method.
�N)�dequec@s�eZdZdZdZdZdZdZd(dd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�ZdS))�
async_chatz�This is an abstract class.  You must derive from this class, and add
    the two methods collect_incoming_data() and found_terminator()irzlatin-1NcCs(d|_g|_t�|_tjj|||�dS)N�)�ac_in_buffer�incomingr�
producer_fifo�asyncore�
dispatcher�__init__)�selfZsock�map�r
� /usr/lib64/python3.6/asynchat.pyr
Cszasync_chat.__init__cCstd��dS)Nzmust be implemented in subclass)�NotImplementedError)r�datar
r
r�collect_incoming_dataQsz async_chat.collect_incoming_datacCs|jj|�dS)N)r�append)rrr
r
r�_collect_incoming_dataTsz!async_chat._collect_incoming_datacCsdj|j�}|jdd�=|S)Nr)�joinr)r�dr
r
r�	_get_dataWszasync_chat._get_datacCstd��dS)Nzmust be implemented in subclass)r)rr
r
r�found_terminator\szasync_chat.found_terminatorcCsBt|t�r|jrt||j�}nt|t�r8|dkr8td��||_dS)zdSet the input delimiter.

        Can be a fixed string of any length, an integer, or None.
        rz-the number of received bytes must be positiveN)�
isinstance�str�use_encoding�bytes�encoding�int�
ValueError�
terminator)rZtermr
r
r�set_terminator_s
zasync_chat.set_terminatorcCs|jS)N)r)rr
r
r�get_terminatorjszasync_chat.get_terminatorcCs�y|j|j�}Wn:tk
r$dStk
rJ}z|j�dSd}~XnXt|t�rh|jrhtt|j	�}|j
||_
�xV|j
�r�t|j
�}|j�}|s�|j
|j
�d|_
qxt|t��r|}||kr�|j
|j
�d|_
|j||_n2|j
|j
d|��|j
|d�|_
d|_|j�qxt|�}|j
j|�}|dk�rp|dk�rR|j
|j
d|��|j
||d�|_
|j�qxt|j
|�}|�r�||k�r�|j
|j
d|��|j
|d�|_
Pqx|j
|j
�d|_
qxWdS)Nrr����)Zrecv�ac_in_buffer_size�BlockingIOError�OSError�handle_errorrrrrrr�lenr!rrrr�find�find_prefix_at_end)rrZwhyZlbr�nZterminator_len�indexr
r
r�handle_readrsR

	



zasync_chat.handle_readcCs|j�dS)N)�
initiate_send)rr
r
r�handle_write�szasync_chat.handle_writecCs|j�dS)N)�close)rr
r
r�handle_close�szasync_chat.handle_closecCs|t|tttf�stdt|���|j}t|�|krdx>tdt|�|�D]}|j	j
||||��qBWn|j	j
|�|j�dS)Nz#data argument must be byte-ish (%r)r)rr�	bytearray�
memoryview�	TypeError�type�ac_out_buffer_sizer(�rangerrr.)rrZsabs�ir
r
r�push�s
zasync_chat.pushcCs|jj|�|j�dS)N)rrr.)rZproducerr
r
r�push_with_producer�szasync_chat.push_with_producercCsdS)z4predicate for inclusion in the readable for select()r"r
)rr
r
r�readable�szasync_chat.readablecCs|jp|jS)z4predicate for inclusion in the writable for select())r�	connected)rr
r
r�writable�szasync_chat.writablecCs|jjd�dS)zAautomatically close this channel once the outgoing queue is emptyN)rr)rr
r
r�close_when_done�szasync_chat.close_when_donecCs�x|jo|j�r|jd}|s<|jd=|dkr<|j�dS|j}y|d|�}Wn8tk
r�|j�}|r||jj|�n|jd=wYnXt|t�r�|j	r�t
||j�}y|j|�}Wnt
k
r�|j�dSX|�r|t|�ks�|t|�k�r||d�|jd<n|jd=dSWdS)Nr)rr<r1r6r4�more�
appendleftrrrrr�sendr&r'r()r�firstZobsrZnum_sentr
r
rr.�s8
zasync_chat.initiate_sendcCs d|_|jdd�=|jj�dS)Nr)rrr�clear)rr
r
r�discard_buffersszasync_chat.discard_buffers)NN)�__name__�
__module__�__qualname__�__doc__r$r6rrr
rrrrr r!r-r/r1r9r:r;r=r>r.rDr
r
r
rr4s,
H(rc@seZdZddd�Zdd�ZdS)�simple_producer�cCs||_||_dS)N)r�buffer_size)rrrKr
r
rr
szsimple_producer.__init__cCsJt|j�|jkr6|jd|j�}|j|jd�|_|S|j}d|_|SdS)Nr)r(rrK)r�resultr
r
rr?szsimple_producer.moreN)rJ)rErFrGr
r?r
r
r
rrIs
rIcCs6t|�d}x$|r0|j|d|��r0|d8}qW|S)Nr")r(�endswith)ZhaystackZneedle�lr
r
rr*/sr*)rHr�collectionsrr	rrIr*r
r
r
r�<module>/s\ rlcompleter.cpython-36.opt-2.pyc000064400000006057150335715140012476 0ustar003


 \��@s~ddlZddlZddlZdgZGdd�d�Zdd�ZyddlZWnek
rXdZYn"Xej	e�j
�ejdd��d	ZdS)
�N�	Completerc@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rNcCs8|rt|t�rtd��|dkr(d|_nd|_||_dS)Nznamespace must be a dictionary�r)�
isinstance�dict�	TypeError�use_main_ns�	namespace)�selfr�r
�#/usr/lib64/python3.6/rlcompleter.py�__init__'szCompleter.__init__cCs�|jrtj|_|j�sB|dkr>tr8tjd�tj�dSdSndS|dkrld|kr`|j	|�|_
n|j|�|_
y
|j
|Stk
r�dSXdS)Nr�	��.)
r�__main__�__dict__r�strip�_readline_available�readlineZinsert_textZ	redisplay�attr_matches�matches�global_matches�
IndexError)r	�text�stater
r
r�completeBs$

zCompleter.completecCst|�r|d}|S)N�()�callable)r	�val�wordr
r
r�_callable_postfixaszCompleter._callable_postfixc		Cs�ddl}g}dh}t|�}xT|jD]J}|d|�|kr"|j|�|dkrR|d}n|dkrb|d
}|j|�q"Wx^|jtjgD]N}xH|j�D]<\}}|d|�|kr�||kr�|j|�|j|j	||��q�Wq~W|S)Nr�__builtins__�finally�try�:�False�None�True�break�continue�pass�else� >r"r#>r)r'r+r%r*r(r&)
�keyword�len�kwlist�add�appendr�builtinsr�itemsr )	r	rr-r�seen�nrZnspacerr
r
rrfs(


zCompleter.global_matchescCsnddl}|jd|�}|sgS|jdd�\}}yt||j�}Wntk
rPgSXtt|��}|jd�t	|d�r�|j
d�|jt|j
��g}t|�}	|dkr�d}
n|dkr�d	}
nd}
x�x~|D]v}|d|	�|ko�|
o�|d|	d�|
kr�d
||f}yt||�}
Wntk
�rYnX|j|
|�}|j|�q�W|�sH|
�rJP|
dk�rZd	}
q�d}
q�W|j�|S)Nrz(\w+(\.\w+)*)\.(\w*)r�r!�	__class__r�_�__z%s.%s)�re�match�group�evalr�	Exception�set�dir�discard�hasattrr0�update�get_class_membersr7r.�getattrr r1�sort)r	rr:�m�expr�attrZ
thisobjectZwordsrr5Znoprefixrr;rr
r
rr�sN




zCompleter.attr_matches)N)�__name__�
__module__�__qualname__rrr rrr
r
r
rr&s

cCs2t|�}t|d�r.x|jD]}|t|�}qW|S)N�	__bases__)r@rBrMrD)�klassZret�baser
r
rrD�s

rDFcCs
tjd�S)N)r�
set_completerr
r
r
r�<lambda>�srQT)�atexitr2r�__all__rrDr�ImportErrorrrPr�registerr
r
r
r�<module> s
signal.cpython-36.opt-1.pyc000064400000004725150335715140011422 0ustar003


 \K�@s
ddlZddlTddlmZddlmZe�Zej	de
dd��ej	de
d	d��d
ekrlej	de
dd��d
d�Zdd�Zeej
�dd��Z
eej�dd��Zd
ekr�eej�dd
��Zejje_dekr�eej�dd��Zdek�reej�dd��Zeje_[[dS)�N)�*)�wraps)�IntEnum�SignalscCs(|j�r|jd�r|jd�p&|jd�S)NZSIGZSIG_ZCTRL_)�isupper�
startswith)�name�r	�/usr/lib64/python3.6/signal.py�<lambda>
sr�HandlerscCs|dkS)N�SIG_DFL�SIG_IGN)r
rr	)rr	r	r
rs�pthread_sigmaskZSigmaskscCs|dkS)N�	SIG_BLOCK�SIG_UNBLOCK�SIG_SETMASK)rrrr	)rr	r	r
rscCs"y||�Stk
r|SXdS)zsConvert a numeric value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    N)�
ValueError)�valueZ
enum_klassr	r	r
�_int_to_enumsrcCs&yt|�Sttfk
r |SXdS)zmConvert an IntEnum member to a numeric value.
    If it's not an IntEnum member return the value itself.
    N)�intr�	TypeError)rr	r	r
�_enum_to_int#srcCstjt|�t|��}t|t�S)N)�_signal�signalrrr)�	signalnum�handlerr	r	r
r-srcCstj|�}t|t�S)N)r�	getsignalrr)rrr	r	r
r3s
rcCstj||�}tdd�|D��S)Ncss|]}t|t�VqdS)N)rr)�.0�xr	r	r
�	<genexpr>=sz"pthread_sigmask.<locals>.<genexpr>)rr�set)Zhow�maskZsigs_setr	r	r
r:s�
sigpendingcCstj�}tdd�|D��S)Ncss|]}t|t�VqdS)N)rr)rrr	r	r
r Eszsigpending.<locals>.<genexpr>)rr#r!)Zsigsr	r	r
r#Bs�sigwaitcCstj|�}t|t�S)N)rr$rr)ZsigsetZretsigr	r	r
r$Is
)r�	functoolsrZ_wraps�enumrZ_IntEnum�globalsZ_globals�_convert�__name__rrrrr�__doc__r#r$r	r	r	r
�<module>s6






linecache.cpython-36.pyc000064400000007304150335715140011115 0ustar003


 \��@sndZddlZddlZddlZddlZdddgZddd�Ziadd�Zddd	�Z	dd
d�Z
ddd�Zd
d�ZdS)z�Cache lines from Python source files.

This is intended to read lines from modules imported -- hence if a filename
is not found, it will look down the module search path for a file by
that name.
�N�getline�
clearcache�
checkcachecCs:t||�}d|ko t|�knr2||dSdSdS)N��)�getlines�len)�filename�lineno�module_globals�lines�r
�!/usr/lib64/python3.6/linecache.pyrs
cCsiadS)zClear the cache entirely.N)�cacher
r
r
rrscCsR|tkr(t|}t|�dkr(t|dSy
t||�Stk
rLt�gSXdS)z�Get the lines for a Python source file from the cache.
    Update the cache if it doesn't contain an entry for this file already.r�N)rr�updatecache�MemoryErrorr)r	r�entryr
r
rr%s
rcCs�|dkrttj��}n|tkr&|g}ndSx~|D]v}t|}t|�dkrJq0|\}}}}|dkr`q0ytj|�}Wntk
r�t|=w0YnX||jks�||jkr0t|=q0WdS)zUDiscard cache entries that are out of date.
    (This is not checked upon each call!)Nr)	�listr�keysr�os�stat�OSError�st_size�st_mtime)r	�	filenamesr�size�mtimer�fullnamerr
r
rr5s&
c"Cs�|tkrtt|�dkrt|=|s8|jd�r<|jd�r<gS|}ytj|�}W�ntk
�rV|}t||�r�yt|d�}Wnttfk
r�Yn<X|dkr�gSt|�ddd�|j	�D�|ft|<t|dStj
j|�r�gSxjtj
D]\}ytj
j
||�}Wnttfk
�r w�YnXytj|�}PWq�tk
�rHYq�Xq�WgSYnXy"tj|��}|j�}WdQRXWntk
�r�gSX|�r�|d
jd	��r�|dd	7<|j|j}	}
|	|
||ft|<|S)z�Update a cache entry and return its list of lines.
    If something's wrong, print a message, discard the cache entry,
    and return an empty list.r�<�>rNcSsg|]}|d�qS)�
r
)�.0�liner
r
r�
<listcomp>qszupdatecache.<locals>.<listcomp>rr!���r%)rr�
startswith�endswithrrr�	lazycache�ImportError�
splitlines�path�isabs�sys�join�	TypeError�AttributeError�tokenize�open�	readlinesrr)r	rrr�basename�data�dirname�fprrrr
r
rrRsV



rcCs�|tkr tt|�dkrdSdS|s:|jd�r>|jd�r>dS|r�d|kr�|jd�}|d}t|dd	�}|r�|r�tj||�}|ft|<dSdS)
a�Seed the cache for filename with module_globals.

    The module loader will be asked for the source only when getlines is
    called, not immediately.

    If there is an entry in the cache already, it is not altered.

    :return: True if a lazy load is registered in the cache,
        otherwise False. To register such a load a module loader with a
        get_source method must be found, the filename must be a cachable
        filename, and the filename must not be already cached.
    rTFrr �
__loader__�__name__�
get_sourceN)rrr&r'�get�getattr�	functools�partial)r	r�name�loaderr:�	get_linesr
r
rr(�s


r()N)N)N)N)
�__doc__r=r-rr1�__all__rrrrrrr(r
r
r
r�<module>s




Astat.cpython-36.pyc000064400000007415150335715140010160 0ustar003


 \��
@s"dZdZdZdZdZdZdZdZdZd	Z	d
Z
dd�Zd
d�ZdZ
dZdZdZdZdZdZdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$Zd%ZeZd&Zd'Zd(Z d)Z!d*Z"d'Z#d(Z$d)Z%d+Z&d,Z'd-Z(d	Z)dZ*dZ+dZ,dZ-dZ.dZ/dZ0d	Z1d-Z2d,Z3dZ4d.Z5d/Z6d0Z7d1Z8d2Z9ed3fed4fed5fe
d6fed7fed8ffe#d9ffe$d:ffe%eBd;fed<fe%d=ffe'd9ffe(d:ffe)eBd;fed<fe)d=ffe+d9ffe,d:ffe-eBd>fed?fe-d=fff
Z:d@dA�Z;d,Z<d$Z=d)Z>d-Z?dZ@dZAdZBd(ZCdZDd/ZEdZFdZGd%ZHd&ZIdZJd'ZKd.ZLyddBlMTWneNk
�rYnXdCS)DzoConstants/functions for interpreting results of os.stat() and os.lstat().

Suggested usage: from stat import *
����������	cCs|d@S)zMReturn the portion of the file's mode that can be set by
    os.chmod().
    i��)�moderr�/usr/lib64/python3.6/stat.py�S_IMODEsrcCs|d@S)zLReturn the portion of the file's mode that describes the
    file type.
    i�r)rrrr
�S_IFMTsri@i i`i�ii�i�cCst|�tkS)z(Return True if mode is from a directory.)r�S_IFDIR)rrrr
�S_ISDIR.srcCst|�tkS)z<Return True if mode is from a character special device file.)r�S_IFCHR)rrrr
�S_ISCHR2srcCst|�tkS)z8Return True if mode is from a block special device file.)r�S_IFBLK)rrrr
�S_ISBLK6srcCst|�tkS)z+Return True if mode is from a regular file.)r�S_IFREG)rrrr
�S_ISREG:srcCst|�tkS)z0Return True if mode is from a FIFO (named pipe).)r�S_IFIFO)rrrr
�S_ISFIFO>srcCst|�tkS)z,Return True if mode is from a symbolic link.)r�S_IFLNK)rrrr
�S_ISLNKBsrcCst|�tkS)z%Return True if mode is from a socket.)r�S_IFSOCK)rrrr
�S_ISSOCKFsriii���@i��8� �iiiii �l�-�b�d�c�p�r�w�s�S�x�t�TcCsPg}x@tD]8}x2|D] \}}||@|kr|j|�PqW|jd�q
Wdj|�S)z;Convert a file's mode to a string of the form '-rwxrwxrwx'.r%�)�_filemode_table�append�join)rZperm�table�bit�charrrr
�filemode�s

r8)�*N)O�__doc__�ST_MODE�ST_INO�ST_DEV�ST_NLINK�ST_UID�ST_GID�ST_SIZE�ST_ATIME�ST_MTIME�ST_CTIMErrrrrrrrrrrrrrrr�S_ISUID�S_ISGID�S_ENFMT�S_ISVTX�S_IREAD�S_IWRITE�S_IEXEC�S_IRWXU�S_IRUSR�S_IWUSR�S_IXUSR�S_IRWXG�S_IRGRP�S_IWGRP�S_IXGRP�S_IRWXO�S_IROTH�S_IWOTH�S_IXOTH�	UF_NODUMP�UF_IMMUTABLE�	UF_APPEND�	UF_OPAQUE�UF_NOUNLINK�
UF_COMPRESSED�	UF_HIDDEN�SF_ARCHIVED�SF_IMMUTABLE�	SF_APPEND�SF_NOUNLINK�SF_SNAPSHOTr2r8�FILE_ATTRIBUTE_ARCHIVE�FILE_ATTRIBUTE_COMPRESSED�FILE_ATTRIBUTE_DEVICE�FILE_ATTRIBUTE_DIRECTORY�FILE_ATTRIBUTE_ENCRYPTED�FILE_ATTRIBUTE_HIDDEN�FILE_ATTRIBUTE_INTEGRITY_STREAM�FILE_ATTRIBUTE_NORMAL�"FILE_ATTRIBUTE_NOT_CONTENT_INDEXED�FILE_ATTRIBUTE_NO_SCRUB_DATA�FILE_ATTRIBUTE_OFFLINE�FILE_ATTRIBUTE_READONLY�FILE_ATTRIBUTE_REPARSE_POINT�FILE_ATTRIBUTE_SPARSE_FILE�FILE_ATTRIBUTE_SYSTEM�FILE_ATTRIBUTE_TEMPORARY�FILE_ATTRIBUTE_VIRTUAL�_stat�ImportErrorrrrr
�<module>s�	


cgi.cpython-36.opt-1.pyc000064400000067720150335715140010713 0ustar003

�\dhc��@s�dZdZddlmZmZmZddlmZddlZddl	Z	ddl
Zddlm
Z
ddlmZddlmZddlZddlZddlZd	d
ddd
ddddddddddgZdadadd�Zdd�Zdd�Zdd �Zeadade	jdddfd!d�Zd5d"d�Z d6d#d
�Z!d$d�Z"d%d&�Z#d'd�Z$Gd(d	�d	�Z%Gd)d
�d
�Z&e	jfd*d�Z'd7d+d�Z(e	jfd,d�Z)d-d�Z*d.d�Z+d/d�Z,d0d�Z-d8d1d�Z.d2d3�Z/e0d4k�r�e'�dS)9z�Support module for CGI (Common Gateway Interface) scripts.

This module defines a number of utilities for use by CGI scripts
written in Python.
z2.6�)�StringIO�BytesIO�
TextIOWrapper)�MappingN)�
FeedParser)�Message)�warn�MiniFieldStorage�FieldStorage�parse�parse_qs�	parse_qsl�parse_multipart�parse_header�test�print_exception�
print_environ�
print_form�print_directory�print_arguments�print_environ_usage�escape�cGsHtr.tr.yttd�aWntk
r,YnXts8tantat|�dS)a�Write a log message, if there is a log file.

    Even though this function is called initlog(), you should always
    use log(); log is a variable that is set either to initlog
    (initially), to dolog (once the log file has been opened), or to
    nolog (when logging is disabled).

    The first argument is a format string; the remaining arguments (if
    any) are arguments to the % operator, so e.g.
        log("%s: %s", "a", "b")
    will write "a: b" to the log file, followed by a newline.

    If the global logfp is not None, it should be a file object to
    which log data is written.

    If the global logfp is None, the global logfile may be a string
    giving a filename to open, in append mode.  This file should be
    world writable!!!  If the file can't be opened, logging is
    silently disabled (since there is no safe place where we could
    send an error message).

    �aN)�logfile�logfp�open�OSError�nolog�log�dolog)�allargs�r"�/usr/lib64/python3.6/cgi.py�initlog:s
r$cGstj||d�dS)z=Write a log message to the log file.  See initlog() for docs.�
N)r�write)Zfmt�argsr"r"r#r ]sr cGsdS)z9Dummy function, assigned to log when logging is disabled.Nr")r!r"r"r#rasrcCsdatrtj�datadS)zClose the log file.rN)rr�closer$rr"r"r"r#�closeloges
r)c
Cs\|dkrtj}t|d�r |j}nd}t|t�r4|j}d|krDd|d<|ddk�rt|d�\}}|dkrxt|||d	�S|d
kr�t	|d�}t
r�|t
kr�td��|j|�j
|�}	nd
}	d|kr�|	r�|	d}	|	|d}	n*tjdd��r|	r�|	d}	|	tjd}	|	|d<n<d|k�r |d}	n(tjdd��r<tjd}	nd
}	|	|d<tjj|	|||d�S)avParse a query in the environment or from a file (default stdin)

        Arguments, all optional:

        fp              : file pointer; default: sys.stdin.buffer

        environ         : environment dictionary; default: os.environ

        keep_blank_values: flag indicating whether blank values in
            percent-encoded forms should be treated as blank strings.
            A true value indicates that blanks should be retained as
            blank strings.  The default false value indicates that
            blank values are to be ignored and treated as if they were
            not included.

        strict_parsing: flag indicating what to do with parsing errors.
            If false (the default), errors are silently ignored.
            If true, errors raise a ValueError exception.

        separator: str. The symbol to use for separating the query arguments.
    N�encodingzlatin-1�REQUEST_METHOD�GET�POST�CONTENT_TYPEzmultipart/form-data)�	separatorz!application/x-www-form-urlencoded�CONTENT_LENGTHzMaximum content length exceededr�QUERY_STRING�&�)r*)�sys�stdin�hasattrr*�
isinstancer�bufferrr�int�maxlen�
ValueError�read�decode�argv�urllibrr)
�fp�environ�keep_blank_values�strict_parsingr/r*�ctype�pdict�clength�qsr"r"r#rxsH




cCs tdtd�tjj||||d�S)z)Parse a query given as a string argument.z=cgi.parse_qs is deprecated, use urllib.parse.parse_qs instead�)r/)r�DeprecationWarningr?rr)rGrBrCr/r"r"r#r�scCs tdtd�tjj||||d�S)z)Parse a query given as a string argument.z?cgi.parse_qsl is deprecated, use urllib.parse.parse_qsl insteadrH)r/)rrIr?rr
)rGrBrCr/r"r"r#r
�scCs�ddl}d}d|kr|d}t|�s2td|f��d|}d|d}i}d}�x�||k�r�d}d}	|r�|jj|�}
|
jd�}|r�yt|�}Wntk
r�YnX|dkr�tr�|tkr�td	��|j|�}	nd}	g}xD|j	�}
|
s�|}P|
j
d��r|
j�}|||fk�rP|j|
�q�W|	dk�r&qR|dk�r�|�r�|d}
|
dd�dk�r^|
dd�}
n|
dd�dk�r||
dd�}
|
|d<dj
|�}	|
d
}
|
�s�qRt|
�\}}|dk�r�qRd|krR|d}nqR||k�r�||j|	�qR|	g||<qRW|S)a�Parse multipart input.

    Arguments:
    fp   : input file
    pdict: dictionary containing other parameters of content-type header

    Returns a dictionary just like parse_qs(): keys are the field names, each
    value is a list of values for that field.  This is easy to use but not
    much good if you are expecting megabytes to be uploaded -- in that case,
    use the FieldStorage class instead which is much more flexible.  Note
    that content-type is the raw, unparsed contents of the content-type
    header.

    XXX This does not parse nested multipart parts -- use FieldStorage for
    that.

    XXX This should really be subsumed by FieldStorage altogether -- no
    point in having two implementations of the same parsing algorithm.
    Also, FieldStorage protects itself better against certain DoS attacks
    by limiting the size of the data read in one chunk.  The API here
    does not support that kind of protection.  This also affects parse()
    since it can call parse_multipart().

    rN��boundaryz&Invalid boundary in multipart form: %rs--r3zcontent-lengthzMaximum content length exceededrHs
�
zcontent-dispositionz	form-data�name���rN���rOrNrNrN)Zhttp.client�valid_boundaryr;ZclientZ
parse_headers�getr9r:r<�readline�
startswith�rstrip�append�joinr)r@rEZhttprKZnextpartZlastpartZpartdict�
terminator�bytes�data�headersrF�lines�line�keyZparamsrMr"r"r#r�s|







ccs�x�|dd�dkr�|dd�}|jd�}x<|dkrd|jdd|�|jdd|�drd|jd|d�}q*W|dkrvt|�}|d|�}|j�V||d�}qWdS)Nr3�;r�"z\"rH)�find�count�len�strip)�s�end�fr"r"r#�_parseparam/s
*
rgcCs�td|�}|j�}i}x�|D]�}|jd�}|dkr|d|�j�j�}||dd�j�}t|�dkr�|d|dko�dknr�|dd�}|jdd	�jd
d�}|||<qW||fS)
zfParse a Content-type like header.

    Return the main content-type and a dictionary of options.

    r^�=rNr3rHr_z\\�\z\"rNrN)rg�__next__r`rc�lowerrb�replace)r\�partsr]rE�p�irM�valuer"r"r#r;s

,c@s@eZdZdZdZdZdZdZiZdZ	iZ
iZdd�Zdd�Z
dS)r	z=Like FieldStorage, for use when no file uploads are possible.NcCs||_||_dS)z&Constructor from field name and value.N)rMrp)�selfrMrpr"r"r#�__init__aszMiniFieldStorage.__init__cCsd|j|jfS)z Return printable representation.zMiniFieldStorage(%r, %r))rMrp)rqr"r"r#�__repr__gszMiniFieldStorage.__repr__)�__name__�
__module__�__qualname__�__doc__�filename�list�type�file�type_options�disposition�disposition_optionsrZrrrsr"r"r"r#r	Ssc@s�eZdZdZdddejdddddddfdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
d;dd�Zd<dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZdZd'd(�Zd)d*�Zd=Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Z dS)>r
a�Store a sequence of fields, reading multipart/form-data.

    This class provides naming, typing, files stored on disk, and
    more.  At the top level, it is accessible like a dictionary, whose
    keys are the field names.  (Note: None can occur as a field name.)
    The items are either a Python list (if there's multiple values) or
    another FieldStorage or MiniFieldStorage object.  If it's a single
    object, it has the following attributes:

    name: the field name, if specified; otherwise None

    filename: the filename, if specified; otherwise None; this is the
        client side filename, *not* the file name on which it is
        stored (that's a temporary file you don't deal with)

    value: the value as a *string*; for file uploads, this
        transparently reads the file every time you request the value
        and returns *bytes*

    file: the file(-like) object from which you can read the data *as
        bytes* ; None if the data is stored a simple string

    type: the content-type, or None if not specified

    type_options: dictionary of options specified on the content-type
        line

    disposition: content-disposition, or None if not specified

    disposition_options: dictionary of corresponding options

    headers: a dictionary(-like) object (sometimes email.message.Message or a
        subclass thereof) containing *all* headers

    The class is subclassable, mostly for the purpose of overriding
    the make_file() method, which is called internally to come up with
    a file open for reading and writing.  This makes it possible to
    override the default choice of storing all files in a temporary
    directory and unlinking them as soon as they have been opened.

    NrJrzutf-8rlcCsRd}||_||_|
|_||_d|kr0|dj�}d|_|dksF|dkr�d|krX|d}
ntjdd�rrtjd}
nd}
|
jt	j
�d�}
t|
�}|dkr�d	d
i}|dkr�i}|dkr�d
|d	<d|kr�|d|d	<d|kr�|d|_d
|kr�|d
|d<nt|t
tf��std��||_|dk�r*tjj|_n<t|t��r@|j|_n&t|d��oTt|d��s`td��||_||_|	|_t|t��s�tdt|�j��||_d|_||_di}}d|jk�r�t|jd�\}}||_||_ d|_!d|k�r�|d|_!d|_"d|k�r
|d|_"|j"dk	|_#d	|jk�r6t|jd	�\}}n(|j�sH|dk�rTdi}}n
d
i}}||_||_$d|k�r�|dj|j�|_%nd|_%d}d|jk�r�yt&|jd�}Wnt'k
�r�YnXt(�r�|t(k�r�t'd��||_)|jdk�r�|�r�||_d|_*|_+d|_,|d
k�r$|j-�n*|dd�dk�rF|j.|||�n|j/�dS)a$Constructor.  Read multipart/* until last part.

        Arguments, all optional:

        fp              : file pointer; default: sys.stdin.buffer
            (not used when the request method is GET)
            Can be :
            1. a TextIOWrapper object
            2. an object whose read() and readline() methods return bytes

        headers         : header dictionary-like object; default:
            taken from environ as per CGI spec

        outerboundary   : terminating multipart boundary
            (for internal use only)

        environ         : environment dictionary; default: os.environ

        keep_blank_values: flag indicating whether blank values in
            percent-encoded forms should be treated as blank strings.
            A true value indicates that blanks should be retained as
            blank strings.  The default false value indicates that
            blank values are to be ignored and treated as if they were
            not included.

        strict_parsing: flag indicating what to do with parsing errors.
            If false (the default), errors are silently ignored.
            If true, errors raise a ValueError exception.

        limit : used internally to read parts of multipart/form-data forms,
            to exit from the reading loop when reached. It is the difference
            between the form content-length and the number of bytes already
            read

        encoding, errors : the encoding and error handler used to decode the
            binary stream to strings. Must be the same as the charset defined
            for the page sending the form (content-type : meta http-equiv or
            header)

        max_num_fields: int. If set, then __init__ throws a ValueError
            if there are more than n fields read by parse_qsl().

        r,r+NZHEADr1r3r�surrogateescapezcontent-typez!application/x-www-form-urlencodedr-r.r0zcontent-lengthz?headers must be mapping or an instance of email.message.Messager<rRzfp must be file pointerz#outerboundary must be bytes, not %srzcontent-dispositionrMrxz
text/plainrKrJzMaximum content length exceeded�
z
multipart/rN)0rBrC�max_num_fieldsr/�upper�
qs_on_postr4r>�encode�locale�getpreferredencodingrr7rr�	TypeErrorrZr5r8r@rr6r*�errorsrXrzrt�
outerboundary�
bytes_read�limitrr}r~rMrx�_binary_filer|�
innerboundaryr9r;r:�lengthryr{�done�read_urlencoded�
read_multi�read_single)rqr@rZr�rArBrCr�r*r�r�r/�methodrGZcdisprErDZclenr"r"r#rr�s�/












zFieldStorage.__init__cCs(y|jj�Wntk
r"YnXdS)N)r{r(�AttributeError)rqr"r"r#�__del__;szFieldStorage.__del__cCs|S)Nr")rqr"r"r#�	__enter__AszFieldStorage.__enter__cGs|jj�dS)N)r{r()rqr'r"r"r#�__exit__DszFieldStorage.__exit__cCsd|j|j|jfS)z"Return a printable representation.zFieldStorage(%r, %r, %r))rMrxrp)rqr"r"r#rsGszFieldStorage.__repr__cCst|j��S)N)�iter�keys)rqr"r"r#�__iter__LszFieldStorage.__iter__cCsT|dkrt|��|jr:|jjd�|jj�}|jjd�n|jdk	rL|j}nd}|S)Nrpr)r�r{�seekr<ry)rqrMrpr"r"r#�__getattr__Os

zFieldStorage.__getattr__cCsb|jdkrtd��g}x"|jD]}|j|kr|j|�qW|sFt|��t|�dkrZ|dS|SdS)zDictionary style indexing.Nz
not indexabler3r)ryr�rMrU�KeyErrorrb)rqr]�found�itemr"r"r#�__getitem__\s

zFieldStorage.__getitem__cCs8||kr0||}t|t�r(dd�|D�S|jSn|SdS)z8Dictionary style get() method, including 'value' lookup.cSsg|]
}|j�qSr")rp)�.0�xr"r"r#�
<listcomp>osz)FieldStorage.getvalue.<locals>.<listcomp>N)r7ryrp)rqr]�defaultrpr"r"r#�getvaluejs
zFieldStorage.getvaluecCs4||kr,||}t|t�r$|djS|jSn|SdS)z! Return the first value received.rN)r7ryrp)rqr]r�rpr"r"r#�getfirstus

zFieldStorage.getfirstcCs:||kr2||}t|t�r(dd�|D�S|jgSngSdS)z  Return list of received values.cSsg|]
}|j�qSr")rp)r�r�r"r"r#r��sz(FieldStorage.getlist.<locals>.<listcomp>N)r7ryrp)rqr]rpr"r"r#�getlist�s

zFieldStorage.getlistcCs*|jdkrtd��ttdd�|jD���S)zDictionary style keys() method.Nz
not indexablecss|]}|jVqdS)N)rM)r�r�r"r"r#�	<genexpr>�sz$FieldStorage.keys.<locals>.<genexpr>)ryr��set)rqr"r"r#r��s
zFieldStorage.keyscs*|jdkrtd��t�fdd�|jD��S)z%Dictionary style __contains__ method.Nz
not indexablec3s|]}|j�kVqdS)N)rM)r�r�)r]r"r#r��sz,FieldStorage.__contains__.<locals>.<genexpr>)ryr��any)rqr]r")r]r#�__contains__�s
zFieldStorage.__contains__cCst|j��S)z Dictionary style len(x) support.)rbr�)rqr"r"r#�__len__�szFieldStorage.__len__cCs|jdkrtd��t|j�S)NzCannot be converted to bool.)ryr��bool)rqr"r"r#�__bool__�s
zFieldStorage.__bool__c	Cs�|jj|j�}t|t�s0td|jt|�jf��|j|j	|j
�}|jrT|d|j7}tj
j||j|j|j	|j
|j|jd�}dd�|D�|_|j�dS)z+Internal: read data in query string format.z%s should return bytes, got %sr2)r*r�r�r/cSsg|]\}}t||��qSr")r	)r�r]rpr"r"r#r��sz0FieldStorage.read_urlencoded.<locals>.<listcomp>N)r@r<r�r7rXr;rzrtr=r*r�r�r?rr
rBrCr�r/ry�
skip_lines)rqrG�queryr"r"r#r��s

zFieldStorage.read_urlencodedc
CsB|j}t|�std|f��g|_|jrftjj|j|j|j	|j
|j|j|j
d�}|jjdd�|D��|jpp|j}|jj�}t|t�s�td|jt|�jf��|jt|�7_x6|j�d|jkr�|r�|jj�}|jt|�7_q�W|j}|dk	�r|t|j�8}�x,t�}	d}
x$|jj�}|
|7}
|j��sP�qW|
�sBP|jt|
�7_|	j|
j|j
|j��|	j�}d	|k�r�|d	=||j||||||j|j|j
|j||j
d
�}
|dk	�r�|d8}|
j�r�|t|
j�8}|dk�r�td
��|j|
j7_|jj|
�|
j �s.|j|j!k�o&dkn�r
P�q
W|j"�dS)z/Internal: read a part that is itself multipart.z&Invalid boundary in multipart form: %r)r*r�r�r/css|]\}}t||�VqdS)N)r	)r�r]rpr"r"r#r��sz*FieldStorage.read_multi.<locals>.<genexpr>z%s should return bytes, got %ss--NrJzcontent-length)r/r3rzMax number of fields exceeded)#r�rPr;ryr�r?rr
rBrCr*r�r�r/�extend�FieldStorageClass�	__class__r@rRr7rXrzrtr�rbrcrZfeedr=r(r�rUr�r�r�)rqrArBrCZibr��klassZ
first_liner��parserZhdr_textrYrZ�partr"r"r#r��sj










(zFieldStorage.read_multicCs4|jdkr|j�|j�n|j�|jjd�dS)zInternal: read an atomic part.rN)r��read_binaryr��
read_linesr{r�)rqr"r"r#r��s


zFieldStorage.read_single�icCs�|j�|_|j}|dkr�xx|dkr�|jjt||j��}t|t�sXt	d|jt
|�jf��|jt
|�7_|svd|_P|jj|�|t
|�}qWdS)zInternal: read binary data.rz%s should return bytes, got %sr3NrN)�	make_filer{r�r@r<�min�bufsizer7rXr;rzrtr�rbr�r&)rqZtodorYr"r"r#r�s


zFieldStorage.read_binarycCs@|jrt�|_|_nt�|_|_|jr4|j�n|j�dS)z0Internal: read lines until EOF or outerboundary.N)r�rr{�_FieldStorage__filerr��read_lines_to_outerboundary�read_lines_to_eof)rqr"r"r#r�s
zFieldStorage.read_linescCsv|jdk	rF|jj�t|�dkrF|j�|_|jj�}|jj|�d|_|jrZ|jj|�n|jj|j|j	|j
��dS)z line is always bytes, not stringNi�)r��tellrbr�r{r�r&r�r=r*r�)rqr\rYr"r"r#Z__writes


zFieldStorage.__writecCs>x8|jjd�}|jt|�7_|s,d|_P|j|�qWdS)zInternal: read lines until EOF.r3�NirN)r@rRr�rbr��_FieldStorage__write)rqr\r"r"r#r�,szFieldStorage.read_lines_to_eofc	Cs,d|j}|d}d}d}d}�x||jkr.P|jjd
�}|jt|�7_|t|�7}|sdd|_P|dkrx||}d}|jd�r�|r�|j�}||kr�P||kr�d|_P|}|j	d�r�d}|d	d�}d}nJ|j	d�r�d}|d	d�}d}n*|j	d��rd}|d	d�}d}nd}d}|j
||�q"Wd	S)z�Internal: read lines until outerboundary.
        Data is read as bytes: boundaries and line ends must be converted
        to bytes for comparisons.
        s--rJTrr3r��
s
NrHrLFirNrOrNrN)r�r�r@rRr�rbr�rSrT�endswithr�)	rq�
next_boundary�
last_boundaryZdelim�last_line_lfendZ_readr\�strippedlineZodelimr"r"r#r�6sP



z(FieldStorage.read_lines_to_outerboundarycCs�|js|jrdSd|j}|d}d}xh|jjd�}|jt|�7_|sTd|_P|jd�r�|r�|j�}||krtP||kr�d|_P|jd�}q*WdS)	z5Internal: skip lines until outer boundary if defined.Ns--Tr3r�rLirN)r�r�r@rRr�rbr�rc)rqr�r�r�r\r�r"r"r#r�gs&
zFieldStorage.skip_linescCs&|jrtjd�Stjd|jdd�SdS)a�Overridable: return a readable & writable file.

        The file will be used as follows:
        - data is written to it
        - seek(0)
        - data is read from it

        The file is opened in binary mode for files, in text mode
        for other fields

        This version opens a temporary file for reading and writing,
        and immediately deletes (unlinks) it.  The trick (on Unix!) is
        that the file can still be used, but it can't be opened by
        another process, and it will automatically be deleted when it
        is closed or when the current process terminates.

        If you want a more permanent file, you derive a class which
        overrides this method.  If you want a visible temporary file
        that is nevertheless automatically deleted when the script
        terminates, try defining a __del__ method in a derived class
        which unlinks the temporary files you have created.

        zwb+zw+r%)r*�newlineN)r��tempfileZ
TemporaryFiler*)rqr"r"r#r�}s
zFieldStorage.make_file)N)Ni )!rtrurvrw�osrArrr�r�r�rsr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r"r"r"r#r
ls@*"


D	
1cCs�td�t�tjt_yNt�}t�t�t|�t|�t	�dd�}|fdd�}td�|�Wnt
�YnXtd�day&t�}t�t�t|�t|�Wnt
�YnXd	S)
z�Robust test CGI script, usable as main program.

    Write minimal HTTP headers and dump all information provided to
    the script in HTML form.

    zContent-type: text/htmlcSstd�dS)Nz,testing print_exception() -- <I>italics?</I>)�execr"r"r"r#rf�sztest.<locals>.fcSs
|�dS)Nr")rfr"r"r#�g�sztest.<locals>.gz9<H3>What follows is a test, not an actual exception:</H3>z*<H1>Second try with a small maxlen...</H1>�2N)�printr4�stdout�stderrr
rrrrrrr:)rA�formrfr�r"r"r#r�s4
cCsx|dkrtj�\}}}ddl}t�td�|j||�|j||�}tdtjdj|dd���tj|d�f�~dS)Nrz+<H3>Traceback (most recent call last):</H3>z<PRE>%s<B>%s</B></PRE>rr3rNrN)	r4�exc_info�	tracebackr��	format_tb�format_exception_only�htmlrrV)rzrp�tbr�r�ryr"r"r#r�s
cCs`t|j��}t�td�td�x*|D]"}tdtj|�dtj||��q(Wtd�t�dS)z#Dump the shell environment as HTML.z<H3>Shell Environment:</H3>z<DL>z<DT>z<DD>z</DL>N)�sortedr�r�r�r)rAr�r]r"r"r#r�s
"cCs�t|j��}t�td�|s&td�td�xb|D]Z}tdtj|�ddd�||}tdtjtt|���d	�td
tjt|���q4Wtd�t�dS)
z$Dump the contents of a form as HTML.z<H3>Form Contents:</H3>z<P>No form fields.z<DL>z<DT>�:� )rez<i>z</i>z<DD>z</DL>N)r�r�r�r�r�reprrz)r�r�r]rpr"r"r#r�s
cCsjt�td�ytj�}Wn6tk
rP}ztdtjt|���WYdd}~XnXttj|��t�dS)z#Dump the current directory as HTML.z#<H3>Current Working Directory:</H3>zOSError:N)r�r��getcwdrr�r�str)�pwd�msgr"r"r#r�s&cCs(t�td�t�ttj�t�dS)Nz <H3>Command Line Arguments:</H3>)r�r4r>r"r"r"r#r�s

cCstd�dS)z9Dump a list of environment variables used by CGI as HTML.a�
<H3>These environment variables could have been set:</H3>
<UL>
<LI>AUTH_TYPE
<LI>CONTENT_LENGTH
<LI>CONTENT_TYPE
<LI>DATE_GMT
<LI>DATE_LOCAL
<LI>DOCUMENT_NAME
<LI>DOCUMENT_ROOT
<LI>DOCUMENT_URI
<LI>GATEWAY_INTERFACE
<LI>LAST_MODIFIED
<LI>PATH
<LI>PATH_INFO
<LI>PATH_TRANSLATED
<LI>QUERY_STRING
<LI>REMOTE_ADDR
<LI>REMOTE_HOST
<LI>REMOTE_IDENT
<LI>REMOTE_USER
<LI>REQUEST_METHOD
<LI>SCRIPT_NAME
<LI>SERVER_NAME
<LI>SERVER_PORT
<LI>SERVER_PROTOCOL
<LI>SERVER_ROOT
<LI>SERVER_SOFTWARE
</UL>
In addition, HTTP headers sent by the server may be passed in the
environment as well.  Here are some common variable names:
<UL>
<LI>HTTP_ACCEPT
<LI>HTTP_CONNECTION
<LI>HTTP_HOST
<LI>HTTP_PRAGMA
<LI>HTTP_REFERER
<LI>HTTP_USER_AGENT
</UL>
N)r�r"r"r"r#rs'cCsFtdtdd�|jdd�}|jdd�}|jdd	�}|rB|jd
d�}|S)zDeprecated API.z1cgi.escape is deprecated, use html.escape insteadrH)�
stacklevelr2z&amp;�<z&lt;�>z&gt;r_z&quot;)rrIrl)rdZquoter"r"r#r1s
cCs(ddl}t|t�rd}nd}|j||�S)Nrs^[ -~]{0,200}[!-~]$z^[ -~]{0,200}[!-~]$)�rer7rX�match)rdr�Z_vb_patternr"r"r#rP=s

rP�__main__)rrN)rrN)NNNN)N)1rw�__version__�iorrr�collectionsrr4r�Zurllib.parser?Zemail.parserrZ
email.messager�warningsrr�r�r��__all__rrr$r rr)rr:rArrr
rrgrr	r
rrrrrrrrrPrtr"r"r"r#�<module>sb#	E

c7'
/

__phello__.foo.cpython-36.opt-1.pyc000064400000000171150335715140012775 0ustar003


 \@�@sdS)N�rrr�&/usr/lib64/python3.6/__phello__.foo.py�<module>sbinhex.cpython-36.opt-1.pyc000064400000027470150335715140011424 0ustar003


 \�6�@s�dZddlZddlZddlZddlZdddgZGdd�de�ZdZdZ	dZ
d	Zd
ZGdd�d�Z
d
d�ZGdd�d�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�ZdS)z�Macintosh binhex compression/decompression.

easy interface:
binhex(inputfilename, outputfilename)
hexbin(inputfilename, outputfilename)
�N�binhex�hexbin�Errorc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/binhex.pyrs�i��@��c@seZdZdd�ZdS)�FInfocCsd|_d|_d|_dS)Nz????r)�Type�Creator�Flags)�selfrrr	�__init__0szFInfo.__init__N)rrrrrrrr	r
/sr
cCstt�}tj|d��2}|jd�}d|kr,d|_|jdd�|j�}WdQRXtjj	|�\}}|j
ddd�}|||dfS)	N�rbirZTEXT��:�-r
)r
�io�open�readr�seek�tell�os�path�split�replace)�name�finfo�fp�dataZdsize�dir�filerrr	�getfileinfo5s
r&c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�openrsrccGsdS)Nr)r�argsrrr	rCszopenrsrc.__init__cGsdS)N�r)rr(rrr	rFsz
openrsrc.readcGsdS)Nr)rr(rrr	�writeIszopenrsrc.writecCsdS)Nr)rrrr	�closeLszopenrsrc.closeN)rrrrrr*r+rrrr	r'Bsr'c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_Hqxcoderenginez(Write data to the coder in 3-byte chunkscCs ||_d|_d|_td|_dS)Nr)r
)�ofpr#�hqxdata�LINELEN�linelen)rr-rrr	rRsz_Hqxcoderengine.__init__cCsh|j||_t|j�}|dd}|jd|�}|j|d�|_|sHdS|jtj|�|_|jd�dS)N�r)r#�lenr.�binascii�b2a_hqx�_flush)rr#ZdatalenZtodorrr	r*Xs
z_Hqxcoderengine.writecCsvd}xF|t|j�|jkrJ||j}|jj|j||�d�t|_|}qW|j|d�|_|rr|jj|jd�dS)Nr�
s:
)r2r.r0r-r*r/)rZforce�firstZlastrrr	r5cs
z_Hqxcoderengine._flushcCs6|jr|jtj|j�|_|jd�|jj�|`dS)Nr
)r#r.r3r4r5r-r+)rrrr	r+ns


z_Hqxcoderengine.closeN)rrr�__doc__rr*r5r+rrrr	r,Os
r,c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_Rlecoderenginez4Write data to the RLE-coder in suitably large chunkscCs||_d|_dS)Nr))r-r#)rr-rrr	rxsz_Rlecoderengine.__init__cCs@|j||_t|j�tkrdStj|j�}|jj|�d|_dS)Nr))r#r2�REASONABLY_LARGEr3�rlecode_hqxr-r*)rr#�rledatarrr	r*|sz_Rlecoderengine.writecCs0|jrtj|j�}|jj|�|jj�|`dS)N)r#r3r;r-r*r+)rr<rrr	r+�s

z_Rlecoderengine.closeN)rrrr8rr*r+rrrr	r9usr9c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�BinHexc
	Cs�|\}}}}d}t|t�r.|}tj|d�}d}yR|jd�t|�}	t|	�|_d|_|dkr`t	�}||_
||_|j||�t
|_Wn|r�|j��YnXdS)NF�wbTs0(This file must be converted with BinHex 4.0)

:r)�
isinstance�strrrr*r,r9r-�crcr
�dlen�rlen�
_writeinfo�_DID_HEADER�stater+)
rZname_finfo_dlen_rlenr-r r!rBrCZclose_on_errorZofnameZhqxerrrr	r�s*



zBinHex.__init__cCs�t|�}|dkrtd��t|g�|jd�d}|j|j}}t|t�rR|jd�}t|t�rf|jd�}||}tj	d|j
�}tj	d|j|j�}	||||	}
|j
|
�|j�dS)N�?zFilename too longzlatin-1�z>hz>ii)r2r�bytes�encoderrr?r@�struct�packrrBrC�_write�	_writecrc)rr r!�nl�d�tpZcrZd2Zd3Zd4�inforrr	rD�s




zBinHex._writeinfocCs tj||j�|_|jj|�dS)N)r3�crc_hqxrAr-r*)rr#rrr	rM�sz
BinHex._writecCs4|jdkrd}nd}|jjtj||j��d|_dS)Nrz>hz>H)rAr-r*rKrL)rZfmtrrr	rN�s

zBinHex._writecrccCs0|jtkrtd��|jt|�|_|j|�dS)NzWriting data at the wrong time)rFrErrBr2rM)rr#rrr	r*�s
zBinHex.writecCs,|jdkrtd|jf��|j�t|_dS)NrzIncorrect data size, diff=%r)rBrrCrN�	_DID_DATArF)rrrr	�
close_data�s
zBinHex.close_datacCsB|jtkr|j�|jtkr$td��|jt|�|_|j|�dS)Nz'Writing resource data at the wrong time)rFrTrUrrCr2rM)rr#rrr	�
write_rsrc�s

zBinHex.write_rsrccCsx|jdkrdSzJ|jtkr"|j�|jtkr4td��|jdkrNtd|jf��|j�Wdd|_|j}|`|j�XdS)NzClose at the wrong timerz$Incorrect resource-datasize, diff=%r)rFrTrUrrCrNr-r+)rr-rrr	r+�s



zBinHex.closeN)rrrrrDrMrNr*rUrVr+rrrr	r=�s
r=c
Cs�t|�}t||�}tj|d��.}x|jd�}|s2P|j|�q"W|j�WdQRXt|d�}x|jd�}|snP|j|�q^W|j	�|j	�dS)zEbinhex(infilename, outfilename): create binhex-encoded copy of a fileri�N)
r&r=rrrr*rUr'rVr+)�inp�outr!r-�ifprPrrr	r�s"



c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_Hqxdecoderenginez*Read data via the decoder in 4-byte chunkscCs||_d|_dS)Nr)rY�eof)rrYrrr	rsz_Hqxdecoderengine.__init__cCs�d}|}x�|dkr�|jr|S|ddd}|jj|�}xRytj|�\}|_PWntjk
rfYnX|jjd�}|s�td��||}q:W||}|t|�}|r
|jr
td��q
W|S)z&Read at least wtd bytes (or until EOF)r)rrr1�r
zPremature EOF on binhex file)r[rYrr3Za2b_hqxZ
Incompleterr2)rZtotalwtdZdecdata�wtdr#Z
decdatacur�newdatarrr	rs,
z_Hqxdecoderengine.readcCs|jj�dS)N)rYr+)rrrr	r+%sz_Hqxdecoderengine.closeN)rrrr8rrr+rrrr	rZ�s rZc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_RledecoderenginezRead data via the RLE-codercCs||_d|_d|_d|_dS)Nr)r)rY�
pre_buffer�post_bufferr[)rrYrrr	r+sz_Rledecoderengine.__init__cCsD|t|j�kr"|j|t|j��|jd|�}|j|d�|_|S)N)r2ra�_fill)rr]�rvrrr	r1s
z_Rledecoderengine.readcCs�|j|jj|d�|_|jjr>|jtj|j�|_d|_dSt|j�}|jdd�tdtkrl|d}nX|jdd�tkr�|d}n<|jd	d�tdkr�|d}n|jd
d�tkr�n|d}|jtj|jd|��|_|j|d�|_dS)Nr\r)r1rHr
r���������rfre)	r`rYrr[rar3Z
rledecode_hqxr2�RUNCHAR)rr]Zmarkrrr	rb8s&



z_Rledecoderengine._fillcCs|jj�dS)N)rYr+)rrrr	r+[sz_Rledecoderengine.closeN)rrrr8rrrbr+rrrr	r_(s
#r_c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�HexBincCsjt|t�rtj|d�}x.|jd�}|s.td��|dkr8q|dkrPqWt|�}t|�|_d|_	|j
�dS)Nrr
zNo binhex data found�
�:r)r?r@rrrrrZr_rYrA�_readheader)rrYZchZhqxifprrr	r_s


zHexBin.__init__cCs |jj|�}tj||j�|_|S)N)rYrr3rSrA)rr2r#rrr	�_readuszHexBin._readcCsNtjd|jjd��dd@}|jd@|_||jkrDtd|j|f��d|_dS)Nz>hrri��zCRC error, computed %x, read %x)rK�unpackrYrrAr)rZfilecrcrrr	�	_checkcrczs
zHexBin._checkcrccCs�|jd�}|jt|��}|jd�}|j�|dd�}|dd�}tjd|dd��d}tjd	|dd
��d|_tjd	|d
d��d|_||_t�|_||j_	||j_
||j_t|_
dS)Nr
r\r��	z>h�rz>l��rorprqrrrs)rl�ordrnrKrmrBrC�FNamer
rrrrErF)rr2Zfname�rest�typeZcreator�flagsrrr	rk�s

zHexBin._readheadercGsn|jtkrtd��|r,|d}t||j�}n|j}d}x&t|�|kr\||j|t|��}q8W|j||_|S)NzRead data at wrong timerr))rFrEr�minrBr2rl)r�nrcrrr	r�s
zHexBin.readcCs6|jtkrtd��|jr$|j|j�}|j�t|_dS)Nzclose_data at wrong time)rFrErrBrlrnrT)r�dummyrrr	rU�s
zHexBin.close_datacGsZ|jtkr|j�|jtkr$td��|r>|d}t||j�}n|j}|j||_|j|�S)Nz Read resource data at wrong timer)rFrErUrTrryrCrl)rrzrrr	�	read_rsrc�s

zHexBin.read_rsrccCsD|jdkrdSz|jr"|j|j�}|j�Wdd|_|jj�XdS)N)rFrCr|rnrYr+)rr{rrr	r+�s
zHexBin.closeN)rrrrrlrnrkrrUr|r+rrrr	rh^s

rhc
Cs�t|�}|j}|s|j}tj|d��&}x|jd�}|s8P|j|�q(WWdQRX|j�|jd�}|r�t	|d�}|j|�x|jd�}|s�P|j|�q|W|j
�|j
�dS)z6hexbin(infilename, outfilename) - Decode binhexed filer>i�N)rhr
rurrrr*rUr|r'r+)rWrXrYr!r-rPrrr	r�s,




)r8rrrKr3�__all__�	ExceptionrrErTr:r/rgr
r&r'r,r9r=rrZr_rhrrrrr	�<module>s,


&^*6hconfigparser.cpython-36.opt-2.pyc000064400000073536150335715140012636 0ustar003


 \X��@s�ddlmZddlmZmZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
dddddd	d
ddd
dddddddddddgZdZdZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGd d�de�ZGd!d�de�ZGd"d
�d
e�ZGd#d�de�ZGd$d	�d	e�ZGd%d�de�ZGd&d
�d
e�Ze�ZGd'd�d�ZGd(d�de�Z Gd)d�de�Z!Gd*d�de�Z"Gd+d�de�Z#Gd,d�de#�Z$Gd-d�de$�Z%Gd.d�de�Z&Gd/d�de�Z'dS)0�)�MutableMapping)�OrderedDict�ChainMapN�NoSectionError�DuplicateOptionError�DuplicateSectionError�
NoOptionError�InterpolationError�InterpolationDepthError�InterpolationMissingOptionError�InterpolationSyntaxError�ParsingError�MissingSectionHeaderError�ConfigParser�SafeConfigParser�RawConfigParser�
Interpolation�BasicInterpolation�ExtendedInterpolation�LegacyInterpolation�SectionProxy�ConverterMapping�DEFAULTSECT�MAX_INTERPOLATION_DEPTHZDEFAULT�
c@s"eZdZddd�Zdd�ZeZdS)�Error�cCs||_tj||�dS)N)�message�	Exception�__init__)�self�msg�r"�$/usr/lib64/python3.6/configparser.pyr�szError.__init__cCs|jS)N)r)r r"r"r#�__repr__�szError.__repr__N)r)�__name__�
__module__�__qualname__rr$�__str__r"r"r"r#r�s
rc@seZdZdd�ZdS)rcCs$tj|d|f�||_|f|_dS)NzNo section: %r)rr�section�args)r r)r"r"r#r�szNoSectionError.__init__N)r%r&r'rr"r"r"r#r�sc@seZdZddd�ZdS)rNcCs�t|�dg}|dk	rRdt|�g}|dk	r8|jdj|��|jd�|j|�|}n|jdd�tj|dj|��||_||_	||_
|||f|_dS)Nz already existszWhile reading from z [line {0:2d}]z
: section rzSection r)�repr�append�format�extend�insertrr�joinr)�source�linenor*)r r)r1r2r!rr"r"r#r�s

zDuplicateSectionError.__init__)NN)r%r&r'rr"r"r"r#r�sc@seZdZddd�ZdS)rNcCs�t|�dt|�dg}|dk	rZdt|�g}|dk	r@|jdj|��|jd�|j|�|}n|jdd�tj|dj|��||_||_	||_
||_||||f|_dS)	Nz in section z already existszWhile reading from z [line {0:2d}]z	: option rzOption r)
r+r,r-r.r/rrr0r)�optionr1r2r*)r r)r3r1r2r!rr"r"r#r�s 

zDuplicateOptionError.__init__)NN)r%r&r'rr"r"r"r#r�sc@seZdZdd�ZdS)rcCs.tj|d||f�||_||_||f|_dS)NzNo option %r in section: %r)rrr3r)r*)r r3r)r"r"r#r�s
zNoOptionError.__init__N)r%r&r'rr"r"r"r#r�sc@seZdZdd�ZdS)r	cCs(tj||�||_||_|||f|_dS)N)rrr3r)r*)r r3r)r!r"r"r#rszInterpolationError.__init__N)r%r&r'rr"r"r"r#r	�sc@seZdZdd�ZdS)rcCs8dj||||�}tj||||�||_||||f|_dS)Nz�Bad value substitution: option {!r} in section {!r} contains an interpolation key {!r} which is not a valid option name. Raw value: {!r})r-r	r�	referencer*)r r3r)�rawvalr4r!r"r"r#r
s
z(InterpolationMissingOptionError.__init__N)r%r&r'rr"r"r"r#rsc@seZdZdS)rN)r%r&r'r"r"r"r#rsc@seZdZdd�ZdS)r
cCs0dj||t|�}tj||||�|||f|_dS)Nz�Recursion limit exceeded in value substitution: option {!r} in section {!r} contains an interpolation key which cannot be substituted in {} steps. Raw value: {!r})r-rr	rr*)r r3r)r5r!r"r"r#rs
z InterpolationDepthError.__init__N)r%r&r'rr"r"r"r#r
sc@s8eZdZd	dd�Zedd��Zejdd��Zdd�ZdS)
r
NcCsX|r|rtd��n|r(|r(td��n|r0|}tj|d|�||_g|_|f|_dS)Nz:Cannot specify both `filename' and `source'. Use `source'.z%Required argument `source' not given.z"Source contains parsing errors: %r)�
ValueErrorrrr1�errorsr*)r r1�filenamer"r"r#r+s

zParsingError.__init__cCstjdtdd�|jS)NzSThe 'filename' attribute will be removed in future versions.  Use 'source' instead.�)�
stacklevel)�warnings�warn�DeprecationWarningr1)r r"r"r#r8:s
zParsingError.filenamecCstjdtdd�||_dS)NzSThe 'filename' attribute will be removed in future versions.  Use 'source' instead.r9)r:)r;r<r=r1)r �valuer"r"r#r8Ds
cCs*|jj||f�|jd||f7_dS)Nz
	[line %2d]: %s)r7r,r)r r2�liner"r"r#r,NszParsingError.append)NN)r%r&r'r�propertyr8�setterr,r"r"r"r#r
(s


c@seZdZdd�ZdS)rcCs8tj|d|||f�||_||_||_|||f|_dS)Nz7File contains no section headers.
file: %r, line: %d
%r)rrr1r2r?r*)r r8r2r?r"r"r#rVsz"MissingSectionHeaderError.__init__N)r%r&r'rr"r"r"r#rSsc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rcCs|S)Nr")r �parserr)r3r>�defaultsr"r"r#�
before_getjszInterpolation.before_getcCs|S)Nr")r rBr)r3r>r"r"r#�
before_setmszInterpolation.before_setcCs|S)Nr")r rBr)r3r>r"r"r#�before_readpszInterpolation.before_readcCs|S)Nr")r rBr)r3r>r"r"r#�before_writesszInterpolation.before_writeN)r%r&r'rDrErFrGr"r"r"r#rgsc@s.eZdZejd�Zdd�Zdd�Zdd�ZdS)	rz
%\(([^)]+)\)scCs$g}|j||||||d�dj|�S)N�r)�_interpolate_somer0)r rBr)r3r>rC�Lr"r"r#rD�szBasicInterpolation.before_getcCs<|jdd�}|jjd|�}d|kr8td||jd�f��|S)Nz%%r�%z1invalid interpolation syntax in %r at position %d)�replace�_KEYCRE�subr6�find)r rBr)r3r>�	tmp_valuer"r"r#rE�szBasicInterpolation.before_setcCsp|j||d|d�}|tkr&t|||���xB|�rj|jd�}	|	dkrP|j|�dS|	dkrv|j|d|	��||	d�}|dd�}
|
dkr�|jd�|dd�}q*|
dk�rV|jj|�}|dkr�t||d|��|j|j	d��}||j
�d�}y||}
Wn&tk
�r"t||||�d�YnXd|
k�rJ|j
||||
|||d�n
|j|
�q*t||d	|f��q*WdS)
NT)�raw�fallbackrKrrHr9�(z'bad interpolation variable reference %rz/'%%' must be followed by '%%' or '(', found: %r)�getrr
rOr,rM�matchr�optionxform�group�end�KeyErrorrrI)r rBr3�accum�restr)�map�depthr5�p�c�m�var�vr"r"r#rI�sF






z$BasicInterpolation._interpolate_someN)	r%r&r'�re�compilerMrDrErIr"r"r"r#rws
c@s.eZdZejd�Zdd�Zdd�Zdd�ZdS)	rz
\$\{([^}]+)\}cCs$g}|j||||||d�dj|�S)NrHr)rIr0)r rBr)r3r>rCrJr"r"r#rD�sz ExtendedInterpolation.before_getcCs<|jdd�}|jjd|�}d|kr8td||jd�f��|S)Nz$$r�$z1invalid interpolation syntax in %r at position %d)rLrMrNr6rO)r rBr)r3r>rPr"r"r#rE�sz ExtendedInterpolation.before_setcCs�|j||d|d�}|tkr&t|||���x�|�r�|jd�}	|	dkrP|j|�dS|	dkrv|j|d|	��||	d�}|dd�}
|
dkr�|jd�|dd�}q*|
dk�r�|jj|�}|dkr�t||d|��|jd�j	d	�}||j
�d�}|}
|}yrt|�dk�r |j|d�}||}nHt|�dk�rV|d}
|j|d�}|j|
|dd
�}nt||d|f��Wn2t
ttfk
�r�t|||d	j|��d�YnXd|k�r�|j|||||
t|j|
dd
��|d�n
|j|�q*t||d|f��q*WdS)
NT)rQrRrerrHr9�{z'bad interpolation variable reference %r�:)rQzMore than one ':' found: %rz-'$' must be followed by '$' or '{', found: %r)rTrr
rOr,rMrUrrW�splitrX�lenrVrYrrrr0rI�dict�items)r rBr3rZr[r)r\r]r5r^r_r`�pathZsect�optrbr"r"r#rI�s^







z'ExtendedInterpolation._interpolate_someN)	r%r&r'rcrdrMrDrErIr"r"r"r#r�s
c@s2eZdZejd�Zdd�Zdd�Zedd��Z	dS)	rz%\(([^)]*)\)s|.c
Cs�|}t}x�|r�|d8}|r�d|kr�tj|j|d�}|jj||�}y||}Wq�tk
r�}	zt||||	jd�d�WYdd}	~	Xq�Xq
Pq
W|r�d|kr�t	|||��|S)NrHz%()rBr)
r�	functools�partial�_interpolation_replacerMrNrYrr*r
)
r rBr)r3r>�varsr5r]rL�er"r"r#rDs"(zLegacyInterpolation.before_getcCs|S)Nr")r rBr)r3r>r"r"r#rE#szLegacyInterpolation.before_setcCs,|jd�}|dkr|j�Sd|j|�SdS)NrHz%%(%s)s)rWrV)rUrB�sr"r"r#rp&s
z*LegacyInterpolation._interpolation_replaceN)
r%r&r'rcrdrMrDrE�staticmethodrpr"r"r"r#r	s
c
s*eZdZdZdZdZe�Zej	eej
�Zej	ejdd�ej
�Z
ej	ejdd�ej
�Zej	d�Zddddddddd	�Zd
edfdcddd
ddeeed�dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdedd�Zdfdd�Zdgd!d"�Zdhd$d%�Zdid&d'�Zdd
ed(�d)d*�Zd+d,�Z dd
ed(�d-d.�Z!dd
ed(�d/d0�Z"dd
ed(�d1d2�Z#dd
ed(�d3d4�Z$edd
f�fd5d6�	Z%d7d8�Z&d9d:�Z'd;d<�Z(djd=d>�Z)dkd?d@�Z*dAdB�Z+dCdD�Z,dEdF�Z-dGdH�Z.dIdJ�Z/dKdL�Z0dMdN�Z1dOdP�Z2dQdR�Z3dSdT�Z4dUdV�Z5dWdX�Z6dYdZ�Z7d[d\�Z8d]d]d]d^�d_d`�Z9e:dadb��Z;�Z<S)lrz�
        \[                                 # [
        (?P<header>[^]]+)                  # very permissive!
        \]                                 # ]
        a�
        (?P<option>.*?)                    # very permissive!
        \s*(?P<vi>{delim})\s*              # any number of space/tab,
                                           # followed by any of the
                                           # allowed delimiters,
                                           # followed by any space/tab
        (?P<value>.*)$                     # everything up to eol
        a�
        (?P<option>.*?)                    # very permissive!
        \s*(?:                             # any number of space/tab,
        (?P<vi>{delim})\s*                 # optionally followed by
                                           # any of the allowed
                                           # delimiters, followed by any
                                           # space/tab
        (?P<value>.*))?$                   # everything up to eol
        z=|:)�delimz\STF)�1�yes�trueZon�0�noZfalseZoffN�=rg�#�;)�
delimiters�comment_prefixes�inline_comment_prefixes�strict�empty_lines_in_values�default_section�
interpolation�
converterscCsX||_|j�|_|j�|_t|�|_|j�|_t||	�|j|	<|rhx$|j�D]\}}
|
|j|j|�<qLWt	|�|_
|dkr�|r�|jn|j|_
nNdjdd�|D��}|r�tj|jj|d�tj�|_
ntj|jj|d�tj�|_
t	|p�f�|_t	|p�f�|_||_||_||_|	|_|
|_|jtk�r*|j|_|jdk�r>t�|_|tk	�rT|jj|�dS)Nr{rg�|css|]}tj|�VqdS)N)rc�escape)�.0�dr"r"r#�	<genexpr>lsz+RawConfigParser.__init__.<locals>.<genexpr>)ru)r{rg) �_dict�	_sections�	_defaultsr�_converters�_proxiesrrkrV�tuple�_delimiters�	OPTCRE_NV�OPTCRE�_optcrer0rcrd�_OPT_NV_TMPLr-�VERBOSE�	_OPT_TMPL�_comment_prefixes�_inline_comment_prefixes�_strict�_allow_no_value�_empty_lines_in_valuesr��_interpolation�_UNSET�_DEFAULT_INTERPOLATIONr�update)r rCZ	dict_typeZallow_no_valuer~rr�r�r�r�r�r��keyr>r�r"r"r#rXs>






zRawConfigParser.__init__cCs|jS)N)r�)r r"r"r#rC�szRawConfigParser.defaultscCst|jj��S)N)�listr��keys)r r"r"r#�sections�szRawConfigParser.sectionscCsJ||jkrtd|��||jkr(t|��|j�|j|<t||�|j|<dS)NzInvalid section name: %r)r�r6r�rr�rr�)r r)r"r"r#�add_section�s

zRawConfigParser.add_sectioncCs
||jkS)N)r�)r r)r"r"r#�has_section�szRawConfigParser.has_sectioncCsJy|j|j�}Wntk
r0t|�d�YnX|j|j�t|j��S)N)r��copyrYrr�r�r�r�)r r)Zoptsr"r"r#�options�szRawConfigParser.optionscCs�t|ttjf�r|g}g}xl|D]d}y(t||d��}|j||�WdQRXWntk
rbw YnXt|tj�rztj|�}|j|�q W|S)N)�encoding)	�
isinstance�str�os�PathLike�open�_read�OSError�fspathr,)r �	filenamesr�Zread_okr8�fpr"r"r#�read�s

zRawConfigParser.readcCs<|dkr,y
|j}Wntk
r*d}YnX|j||�dS)Nz<???>)�name�AttributeErrorr�)r �fr1r"r"r#�	read_file�s

zRawConfigParser.read_file�<string>cCstj|�}|j||�dS)N)�io�StringIOr�)r �stringr1Zsfiler"r"r#�read_string�s
zRawConfigParser.read_string�<dict>cCs�t�}x�|j�D]�\}}t|�}y|j|�Wn(ttfk
rV|jrR||krR�YnX|j|�xl|j�D]`\}}|jt|��}|dk	r�t|�}|jr�||f|kr�t	|||��|j||f�|j|||�qlWqWdS)N)
�setrkr�r�rr6r��addrVr)r Z
dictionaryr1�elements_addedr)r�r�r>r"r"r#�	read_dict�s"

zRawConfigParser.read_dictcCs"tjdtdd�|j||d�dS)NzRThis method will be removed in future versions.  Use 'parser.read_file()' instead.r9)r:)r1)r;r<r=r�)r r�r8r"r"r#�readfp�s
zRawConfigParser.readfp)rQrqrRcCs�y|j||�}Wn$tk
r4|tkr,�n|SYnX|j|�}y||}Wn,tk
rx|tkrpt||��n|SYnX|s�|dkr�|S|jj|||||�SdS)N)�
_unify_valuesrr�rVrYrr�rD)r r)r3rQrqrRr�r>r"r"r#rT�s"


zRawConfigParser.getcKs||j||f|��S)N)rT)r r)�convr3�kwargsr"r"r#�_get"szRawConfigParser._getcKsDy|j|||f||d�|��Sttfk
r>|tkr:�|SXdS)N)rQrq)r�rrr�)r r)r3r�rQrqrRr�r"r"r#�	_get_conv%szRawConfigParser._get_convcKs|j||tf|||d�|��S)N)rQrqrR)r��int)r r)r3rQrqrRr�r"r"r#�getint0szRawConfigParser.getintcKs|j||tf|||d�|��S)N)rQrqrR)r��float)r r)r3rQrqrRr�r"r"r#�getfloat5szRawConfigParser.getfloatcKs |j|||jf|||d�|��S)N)rQrqrR)r��_convert_to_boolean)r r)r3rQrqrRr�r"r"r#�
getboolean:szRawConfigParser.getbooleanc
s��tkrt�j�S�jj��y�j�j��Wn&tk
rV��jkrRt	���YnX|r�x"|j�D]\}}|��j
|�<qfW���fdd��|r��fdd���fdd��j�D�S)Ncs�jj��|�|��S)N)r�rD)r3)r�r)r r"r#�<lambda>Vsz'RawConfigParser.items.<locals>.<lambda>cs�|S)Nr")r3)r�r"r#r�Yscsg|]}|�|�f�qSr"r")r�r3)�value_getterr"r#�
<listcomp>Zsz)RawConfigParser.items.<locals>.<listcomp>)r��superrkr�r�r�r�rYr�rrVr�)r r)rQrqr�r>)�	__class__)r�r)r r�r#rk?s


zRawConfigParser.itemscCs.x$|j�D]}||}||=||fSWt�dS)N)r�rY)r r�r>r"r"r#�popitem\s

zRawConfigParser.popitemcCs|j�S)N)�lower)r Z	optionstrr"r"r#rViszRawConfigParser.optionxformcCsX|s||jkr$|j|�}||jkS||jkr2dS|j|�}||j|kpR||jkSdS)NF)r�rVr�r�)r r)r3r"r"r#�
has_optionls



zRawConfigParser.has_optioncCsn|r|jj||||�}|s&||jkr.|j}n.y|j|}Wntk
rZt|�d�YnX|||j|�<dS)N)r�rEr�r�r�rYrrV)r r)r3r>�sectdictr"r"r#r�zszRawConfigParser.setcCsl|rdj|jd�}n
|jd}|jr>|j||j|jj�|�x(|jD]}|j|||j|j�|�qFWdS)Nz {} r)r-r�r��_write_sectionr�rkr�)r r�Zspace_around_delimitersr�r)r"r"r#�write�s

zRawConfigParser.writecCs~|jdj|��x^|D]V\}}|jj||||�}|dk	s@|jrV|t|�jdd�}nd}|jdj||��qW|jd�dS)Nz[{}]
�
z
	rz{}{}
)r�r-r�rGr�r�rL)r r�Zsection_nameZ
section_itemsZ	delimiterr�r>r"r"r#r��szRawConfigParser._write_sectioncCsf|s||jkr|j}n.y|j|}Wntk
rDt|�d�YnX|j|�}||k}|rb||=|S)N)r�r�r�rYrrV)r r)r3r��existedr"r"r#�
remove_option�s
zRawConfigParser.remove_optioncCs"||jk}|r|j|=|j|=|S)N)r�r�)r r)r�r"r"r#�remove_section�s

zRawConfigParser.remove_sectioncCs(||jkr|j|�rt|��|j|S)N)r�r�rYr�)r r�r"r"r#�__getitem__�szRawConfigParser.__getitem__cCs@||jkr|jj�n||jkr.|j|j�|j||i�dS)N)r�r��clearr�r�)r r�r>r"r"r#�__setitem__�s


zRawConfigParser.__setitem__cCs2||jkrtd��|j|�s$t|��|j|�dS)Nz"Cannot remove the default section.)r�r6r�rYr�)r r�r"r"r#�__delitem__�s


zRawConfigParser.__delitem__cCs||jkp|j|�S)N)r�r�)r r�r"r"r#�__contains__�szRawConfigParser.__contains__cCst|j�dS)NrH)rir�)r r"r"r#�__len__�szRawConfigParser.__len__cCstj|jf|jj��S)N)�	itertools�chainr�r�r�)r r"r"r#�__iter__�szRawConfigParser.__iter__cCs2t�}d}d}d}d}d}d}	�x�t|dd�D�]�\}}
tj}dd�|jD�}x||tjkr�|r�i}
x`|j�D]T\}}|
j||d�}|dkr�ql||
|<|dks�|dkrl|
|dj�rlt||�}qlW|
}qPWx"|j	D]}|
j
�j|�r�d}Pq�W|tjk�rd}|
d|�j
�}|�s^|j�rV|dk�r\|dk	�r\|�r\||dk	�r\||j
d�q.tj}q.|jj|
�}|�rx|j�nd}|dk	�r�|�r�||k�r�||j
|�q.|}|jj|�}|�rL|jd�}||jk�r|j�r�||k�r�t|||��|j|}|j|�n@||jk�r|j}n,|j�}||j|<t||�|j|<|j|�d}q.|dk�rdt|||
��q.|jj|�}|�r|jdd	d
�\}}}|�s�|j|	|||
�}	|j |j!��}|j�r�||f|k�r�t"||||��|j||f�|dk	�r�|j
�}|g||<nd||<q.|j|	|||
�}	q.W|j#�|	�r.|	�dS)NrrH)�startcSsi|]
}d|�qS)rH���r")r�r^r"r"r#�
<dictcomp>�sz)RawConfigParser._read.<locals>.<dictcomp>r�headerr3�vir>r�)$r��	enumerate�sys�maxsizer�rkrO�isspace�minr��strip�
startswithr�r,�NONSPACECRE�searchr��SECTCRErUrWr�r�rr�r�r�r�rr�rr��
_handle_errorrV�rstripr�_join_multiline_values)r r��fpnamer�ZcursectZsectnameZoptnamer2Zindent_levelrrr?Z
comment_startZinline_prefixesZ
next_prefixes�prefix�indexr>Zfirst_nonspaceZcur_indent_levelZmor�Zoptvalr"r"r#r��s� 









zRawConfigParser._readcCsz|j|jf}tj|f|jj��}xT|D]L\}}xB|j�D]6\}}t|t�rXdj|�j	�}|j
j||||�||<q8Wq&WdS)Nr�)r�r�r�r�r�rkr�r�r0r�r�rF)r rCZall_sectionsr)r�r��valr"r"r#r�Ys
z&RawConfigParser._join_multiline_valuescCs |st|�}|j|t|��|S)N)r
r,r+)r �excr�r2r?r"r"r#r�eszRawConfigParser._handle_errorc
Cs�i}y|j|}Wn&tk
r8||jkr4t|��YnXi}|rvx2|j�D]&\}}|dk	rdt|�}|||j|�<qLWt|||j�S)N)	r�rYr�rrkr�rV�	_ChainMapr�)r r)rqZsectiondictZvardictr�r>r"r"r#r�ks
zRawConfigParser._unify_valuescCs(|j�|jkrtd|��|j|j�S)NzNot a boolean: %s)r��BOOLEAN_STATESr6)r r>r"r"r#r�sz#RawConfigParser._convert_to_booleanr)r)r3r>cCsFt|t�std��t|t�s$td��|js0|rBt|t�sBtd��dS)Nzsection names must be stringszoption keys must be stringszoption values must be strings)r�r��	TypeErrorr�)r r)r3r>r"r"r#�_validate_value_types�s


z%RawConfigParser._validate_value_typescCs|jS)N)r�)r r"r"r#r��szRawConfigParser.converters)r{rg)r|r})N)N)r�)r�)N)N)T)=r%r&r'Z
_SECT_TMPLr�r�rr�rcrdr�r�r-r�r�r�r��
_default_dictrr�rrCr�r�r�r�r�r�r�r�r�rTr�r�r�r�r�rkr�rVr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr@r��
__classcell__r"r")r�r#r/st	
$	




	%




zcs0eZdZe�Zd�fdd�	Z�fdd�Z�ZS)rNcs"|j||d�t�j|||�dS)N)r3r>)rr�r�)r r)r3r>)r�r"r#r��szConfigParser.setcs|j|d�t�j|�dS)N)r))rr�r�)r r))r�r"r#r��szConfigParser.add_section)N)r%r&r'rr�r�r�rr"r")r�r#r�scseZdZ�fdd�Z�ZS)rcs"t�j||�tjdtdd�dS)Nz�The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.r9)r:)r�rr;r<r=)r r*r�)r�r"r#r�szSafeConfigParser.__init__)r%r&r'rrr"r")r�r#r�sc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zedd��Z
edd��Zddddd�dd�ZdS)rcCsJ||_||_x8|jD].}d|}tj|jt||�d�}t|||�qWdS)NrT)�_impl)�_parser�_namer�rnrorT�getattr�setattr)r rBr�r�r��getterr"r"r#r�szSectionProxy.__init__cCsdj|j�S)Nz
<Section: {}>)r-r)r r"r"r#r$�szSectionProxy.__repr__cCs(|jj|j|�st|��|jj|j|�S)N)rr�rrYrT)r r�r"r"r#r��szSectionProxy.__getitem__cCs"|jj||d�|jj|j||�S)N)r3r>)rrr�r)r r�r>r"r"r#r��szSectionProxy.__setitem__cCs,|jj|j|�o|jj|j|�s(t|��dS)N)rr�rr�rY)r r�r"r"r#r��szSectionProxy.__delitem__cCs|jj|j|�S)N)rr�r)r r�r"r"r#r��szSectionProxy.__contains__cCst|j��S)N)ri�_options)r r"r"r#r��szSectionProxy.__len__cCs|j�j�S)N)r
r�)r r"r"r#r��szSectionProxy.__iter__cCs*|j|jjkr|jj|j�S|jj�SdS)N)rrr�r�rC)r r"r"r#r
�szSectionProxy._optionscCs|jS)N)r)r r"r"r#rB�szSectionProxy.parsercCs|jS)N)r)r r"r"r#r��szSectionProxy.nameNF)rQrqrcKs(|s|jj}||j|f|||d�|��S)N)rQrqrR)rrTr)r r3rRrQrqrr�r"r"r#rT�s
zSectionProxy.get)N)r%r&r'rr$r�r�r�r�r�r�r
r@rBr�rTr"r"r"r#r�s	c@sFeZdZejd�Zdd�Zdd�Zdd�Zdd	�Z	d
d�Z
dd
�ZdS)rz^get(?P<name>.+)$cCsZ||_i|_xHt|j�D]:}|jj|�}|stt|j|��rBqd|j|jd�<qWdS)Nr�)r�_data�dir�	GETTERCRErU�callablerrW)r rBr	r`r"r"r#rszConverterMapping.__init__cCs
|j|S)N)r)r r�r"r"r#r�szConverterMapping.__getitem__c
Cs�yd|}Wn(tk
r4tdj|t|����YnX|dkrFtd��||j|<tj|jj|d�}||_	t
|j||�x.|jj�D] }tj|j|d�}t
|||�q�WdS)NrTzIncompatible key: {} (type: {})z)Incompatible key: cannot use "" as a name)r�)r)
rr6r-�typerrnrorr�Z	converterr�valuesrT)r r�r>�k�func�proxyr	r"r"r#r�s
zConverterMapping.__setitem__cCs�yd|p
d}Wntk
r,t|��YnX|j|=xDtj|jf|jj��D]*}yt||�WqNtk
rvwNYqNXqNWdS)NrT)	rrYrr�r�rr�delattrr�)r r�rZinstr"r"r#r�,szConverterMapping.__delitem__cCs
t|j�S)N)�iterr)r r"r"r#r�:szConverterMapping.__iter__cCs
t|j�S)N)rir)r r"r"r#r�=szConverterMapping.__len__N)r%r&r'rcrdr
rr�r�r�r�r�r"r"r"r#rs
	)(�collections.abcr�collectionsrrrr�rnr�r�r�rcr�r;�__all__rrrrrrrrr	rrr
r
r�objectr�rrrrrrrrrr"r"r"r#�<module>�sV
	

+HJ&u
Ftextwrap.cpython-36.pyc000064400000032566150335715140011070 0ustar003


 \fL�@s�dZddlZddddddgZd	ZGd
d�d�Zddd�Zdd
d�Zdd�Zejdej	�Z
ejdej	�Zdd�Zddd�Z
edkr�eed��dS)zText wrapping and filling.
�N�TextWrapper�wrap�fill�dedent�indent�shortenz	

 c
@s�eZdZdZiZed�ZxeD]Zeeee�<qWdZ	dZ
deje�Z
de
dd�Zejd	e	e
e
ed
�ej�Z[	[
[ejde
�Z[
ejd�Zd&ddd�dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdS)'ra	
    Object for wrapping/filling text.  The public interface consists of
    the wrap() and fill() methods; the other methods are just there for
    subclasses to override in order to tweak the default behaviour.
    If you want to completely replace the main wrapping algorithm,
    you'll probably have to override _wrap_chunks().

    Several instance attributes control various aspects of wrapping:
      width (default: 70)
        the maximum width of wrapped lines (unless break_long_words
        is false)
      initial_indent (default: "")
        string that will be prepended to the first line of wrapped
        output.  Counts towards the line's width.
      subsequent_indent (default: "")
        string that will be prepended to all lines save the first
        of wrapped output; also counts towards each line's width.
      expand_tabs (default: true)
        Expand tabs in input text to spaces before further processing.
        Each tab will become 0 .. 'tabsize' spaces, depending on its position
        in its line.  If false, each tab is treated as a single character.
      tabsize (default: 8)
        Expand tabs in input text to 0 .. 'tabsize' spaces, unless
        'expand_tabs' is false.
      replace_whitespace (default: true)
        Replace all whitespace characters in the input text by spaces
        after tab expansion.  Note that if expand_tabs is false and
        replace_whitespace is true, every tab will be converted to a
        single space!
      fix_sentence_endings (default: false)
        Ensure that sentence-ending punctuation is always followed
        by two spaces.  Off by default because the algorithm is
        (unavoidably) imperfect.
      break_long_words (default: true)
        Break words longer than 'width'.  If false, those words will not
        be broken, and some lines might be longer than 'width'.
      break_on_hyphens (default: true)
        Allow breaking hyphenated words. If true, wrapping will occur
        preferably on whitespaces and right after hyphens part of
        compound words.
      drop_whitespace (default: true)
        Drop leading and trailing whitespace from lines.
      max_lines (default: None)
        Truncate wrapped lines.
      placeholder (default: ' [...]')
        Append to the last line of truncated text.
    � z[\w!"\'&.,?]z[^\d\W]z[%s]z[^�Na�
        ( # any whitespace
          %(ws)s+
        | # em-dash between words
          (?<=%(wp)s) -{2,} (?=\w)
        | # word, possibly hyphenated
          %(nws)s+? (?:
            # hyphenated word
              -(?: (?<=%(lt)s{2}-) | (?<=%(lt)s-%(lt)s-))
              (?= %(lt)s -? %(lt)s)
            | # end of word
              (?=%(ws)s|\Z)
            | # em-dash
              (?<=%(wp)s) (?=-{2,}\w)
            )
        ))Zwp�ltZwsZnwsz(%s+)z[a-z][\.\!\?][\"\']?\Z�F�TF�z [...])�	max_lines�placeholderc
CsL||_||_||_||_||_||_||_||_|	|_|
|_	||_
||_dS)N)�width�initial_indent�subsequent_indent�expand_tabs�replace_whitespace�fix_sentence_endings�break_long_words�drop_whitespace�break_on_hyphens�tabsizerr)
�selfrrrrrrrrrrrr�r� /usr/lib64/python3.6/textwrap.py�__init__sszTextWrapper.__init__cCs(|jr|j|j�}|jr$|j|j�}|S)z�_munge_whitespace(text : string) -> string

        Munge whitespace in text: expand tabs and convert all other
        whitespace characters to spaces.  Eg. " foo\tbar\n\nbaz"
        becomes " foo    bar  baz".
        )r�
expandtabsrr�	translate�unicode_whitespace_trans)r�textrrr�_munge_whitespace�s
zTextWrapper._munge_whitespacecCs6|jdkr|jj|�}n|jj|�}dd�|D�}|S)aN_split(text : string) -> [string]

        Split the text to wrap into indivisible chunks.  Chunks are
        not quite the same as words; see _wrap_chunks() for full
        details.  As an example, the text
          Look, goof-ball -- use the -b option!
        breaks into the following chunks:
          'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ',
          'use', ' ', 'the', ' ', '-b', ' ', 'option!'
        if break_on_hyphens is True, or in:
          'Look,', ' ', 'goof-ball', ' ', '--', ' ',
          'use', ' ', 'the', ' ', '-b', ' ', option!'
        otherwise.
        TcSsg|]}|r|�qSrr)�.0�crrr�
<listcomp>�sz&TextWrapper._split.<locals>.<listcomp>)r�
wordsep_re�split�wordsep_simple_re)rr!�chunksrrr�_split�s

zTextWrapper._splitcCs`d}|jj}xN|t|�dkrZ||ddkrP|||�rPd||d<|d7}q|d7}qWdS)ag_fix_sentence_endings(chunks : [string])

        Correct for sentence endings buried in 'chunks'.  Eg. when the
        original text contains "... foo.\nBar ...", munge_whitespace()
        and split() will convert that to [..., "foo.", " ", "Bar", ...]
        which has one too few spaces; this method simply changes the one
        space to two.
        rr	rz  �N)�sentence_end_re�search�len)rr)�iZ	patsearchrrr�_fix_sentence_endings�s	
z!TextWrapper._fix_sentence_endingscCs^|dkrd}n||}|jrH|j|dd|��|d|d�|d<n|sZ|j|j��dS)a
_handle_long_word(chunks : [string],
                             cur_line : [string],
                             cur_len : int, width : int)

        Handle a chunk of text (most likely a word, not whitespace) that
        is too long to fit in any line.
        r	N���r1r1)r�append�pop)rZreversed_chunks�cur_line�cur_lenrZ
space_leftrrr�_handle_long_word�s
zTextWrapper._handle_long_wordc	Cs�g}|jdkrtd|j��|jdk	rb|jdkr8|j}n|j}t|�t|jj��|jkrbtd��|j��x&|�r�g}d}|r�|j}n|j}|jt|�}|j	r�|dj
�dkr�|r�|d=x:|r�t|d	�}|||kr�|j|j��||7}q�Pq�W|�r.t|d
�|k�r.|j
||||�ttt|��}|j	�rd|�rd|dj
�dk�rd|t|d�8}|d
=|rn|jdk�s�t|�d|jk�s�|�s�|j	�r�t|�dk�r�|dj
��r�||k�r�|j|dj|��qnx�|�r<|dj
��r"|t|j�|k�r"|j|j�|j|dj|��P|t|d�8}|d=�q�W|�rz|dj�}t|�t|j�|jk�rz||j|d<P|j||jj��PqnW|S)a�_wrap_chunks(chunks : [string]) -> [string]

        Wrap a sequence of text chunks and return a list of lines of
        length 'self.width' or less.  (If 'break_long_words' is false,
        some lines may be longer than this.)  Chunks correspond roughly
        to words and the whitespace between them: each chunk is
        indivisible (modulo 'break_long_words'), but a line break can
        come between any two chunks.  Chunks should not have internal
        whitespace; ie. a chunk is either all whitespace or a "word".
        Whitespace chunks will be removed from the beginning and end of
        lines, but apart from that whitespace is preserved.
        rzinvalid width %r (must be > 0)Nr	z#placeholder too large for max widthrr1r1r1r1r1r1r1r1r1r1r1r1)r�
ValueErrorrrrr.r�lstrip�reverser�stripr2r3r6�sum�map�join�rstrip)	rr)�linesrr4r5r�lZ	prev_linerrr�_wrap_chunks�sp





 
zTextWrapper._wrap_chunkscCs|j|�}|j|�S)N)r"r*)rr!rrr�
_split_chunksPs
zTextWrapper._split_chunkscCs$|j|�}|jr|j|�|j|�S)a^wrap(text : string) -> [string]

        Reformat the single paragraph in 'text' so it fits in lines of
        no more than 'self.width' columns, and return a list of wrapped
        lines.  Tabs in 'text' are expanded with string.expandtabs(),
        and all other whitespace characters (including newline) are
        converted to space.
        )rBrr0rA)rr!r)rrrrVs	

zTextWrapper.wrapcCsdj|j|��S)z�fill(text : string) -> string

        Reformat the single paragraph in 'text' to fit in lines of no
        more than 'self.width' columns, and return a new string
        containing the entire wrapped paragraph.
        �
)r=r)rr!rrrrdszTextWrapper.fill)
rrrTTFTTTr
)�__name__�
__module__�__qualname__�__doc__r �ordZuspace�_whitespace�xZ
word_punctZletter�re�escapeZ
whitespaceZnowhitespace�compile�VERBOSEr&r(r,rr"r*r0r6rArBrrrrrrrsJ/


!grcKstfd|i|��}|j|�S)a�Wrap a single paragraph of text, returning a list of wrapped lines.

    Reformat the single paragraph in 'text' so it fits in lines of no
    more than 'width' columns, and return a list of wrapped lines.  By
    default, tabs in 'text' are expanded with string.expandtabs(), and
    all other whitespace characters (including newline) are converted to
    space.  See TextWrapper class for available keyword args to customize
    wrapping behaviour.
    r)rr)r!r�kwargs�wrrrrps
cKstfd|i|��}|j|�S)a�Fill a single paragraph of text, returning a new string.

    Reformat the single paragraph in 'text' to fit in lines of no more
    than 'width' columns, and return a new string containing the entire
    wrapped paragraph.  As with wrap(), tabs are expanded and other
    whitespace characters converted to space.  See TextWrapper class for
    available keyword args to customize wrapping behaviour.
    r)rr)r!rrOrPrrrr}s	cKs,tf|dd�|��}|jdj|j�j���S)a�Collapse and truncate the given text to fit in the given width.

    The text first has its whitespace collapsed.  If it then fits in
    the *width*, it is returned as is.  Otherwise, as many words
    as possible are joined and then the placeholder is appended::

        >>> textwrap.shorten("Hello  world!", width=12)
        'Hello world!'
        >>> textwrap.shorten("Hello  world!", width=11)
        'Hello [...]'
    r	)rrr)rrr=r:r')r!rrOrPrrrr�sz^[ 	]+$z(^[ 	]*)(?:[^ 	
])cCs�d}tjd|�}tj|�}x||D]t}|dkr2|}q |j|�r>q |j|�rN|}q xDtt||��D]"\}\}}||kr^|d|�}Pq^W|dt|��}q Wdr�|r�x2|jd�D]$}|s�|j|�s�t	d||f��q�W|r�t
jd|d|�}|S)a:Remove any common leading whitespace from every line in `text`.

    This can be used to make triple-quoted strings line up with the left
    edge of the display, while still presenting them in the source code
    in indented form.

    Note that tabs and spaces are both treated as whitespace, but they
    are not equal: the lines "  hello" and "\thello" are
    considered to have no common leading whitespace.  (This behaviour is
    new in Python 2.5; older versions of this module incorrectly
    expanded tabs before searching for common leading whitespace.)
    NrrrCzline = %r, margin = %rz(?m)^)�_whitespace_only_re�sub�_leading_whitespace_re�findall�
startswith�	enumerate�zipr.r'�AssertionErrorrK)r!Zmargin�indentsrr/rJ�y�linerrrr�s,



cs,�dkrdd�����fdd�}dj|��S)aFAdds 'prefix' to the beginning of selected lines in 'text'.

    If 'predicate' is provided, 'prefix' will only be added to the lines
    where 'predicate(line)' is True. If 'predicate' is not provided,
    it will default to adding 'prefix' to all non-empty lines that do not
    consist solely of whitespace characters.
    NcSs|j�S)N)r:)r[rrr�	predicate�szindent.<locals>.predicatec3s.x(�jd�D]}�|�r �|n|VqWdS)NT)�
splitlines)r[)r\�prefixr!rr�prefixed_lines�szindent.<locals>.prefixed_linesr)r=)r!r^r\r_r)r\r^r!rr�s�__main__z Hello there.
  This is indented.)r)r)N)rGrK�__all__rIrrrrrM�	MULTILINErQrSrrrD�printrrrr�<module>sa

5
chunk.cpython-36.opt-2.pyc000064400000005304150335715140011250 0ustar003


 \1�@sGdd�d�ZdS)c@sZeZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zddd�Zdd�Z	ddd�Z
dd�ZdS)�ChunkTFcCs�ddl}d|_||_|rd}nd}||_|jd�|_t|j�dkrFt�y |j|d|jd��d|_	Wn|j
k
r�t�YnX|r�|j	d|_	d|_y|jj�|_
Wnttfk
r�d|_YnXd|_dS)	N�F�>�<��L�T)�struct�closed�align�file�read�	chunkname�len�EOFErrorZunpack_from�	chunksize�error�	size_read�tell�offset�AttributeError�OSError�seekable)�selfrr
Z	bigendianZ
inclheaderrZstrflag�r�/usr/lib64/python3.6/chunk.py�__init__4s, 
zChunk.__init__cCs|jS)N)r
)rrrr�getnameNsz
Chunk.getnamecCs|jS)N)r)rrrr�getsizeRsz
Chunk.getsizecCs |jsz|j�Wdd|_XdS)NT)r	�skip)rrrr�closeVszChunk.closecCs|jrtd��dS)NzI/O operation on closed fileF)r	�
ValueError)rrrr�isatty]szChunk.isattyrcCsv|jrtd��|jstd��|dkr0||j}n|dkrB||j}|dksT||jkrXt�|jj|j	|d�||_dS)NzI/O operation on closed filezcannot seek��r)
r	r rrrr�RuntimeErrorr�seekr)r�pos�whencerrrr%bs
z
Chunk.seekcCs|jrtd��|jS)NzI/O operation on closed file)r	r r)rrrrrusz
Chunk.tellr"cCs�|jrtd��|j|jkrdS|dkr2|j|j}||j|jkrN|j|j}|jj|�}|jt|�|_|j|jkr�|jr�|jd@r�|jjd�}|jt|�|_|S)NzI/O operation on closed file�rr")r	r rrrrrr
)r�size�data�dummyrrrrzs 
z
Chunk.readcCs�|jrtd��|jrlyB|j|j}|jr:|jd@r:|d}|jj|d�|j||_dStk
rjYnXx4|j|jkr�t	d|j|j�}|j
|�}|snt�qnWdS)NzI/O operation on closed filer"i )r	r rrrr
rr%r�minrr)r�nr+rrrr�s"
z
Chunk.skipN)TTF)r���)r.)�__name__�
__module__�__qualname__rrrrr!r%rrrrrrrr3s


rN)rrrrr�<module>3ssunau.cpython-36.opt-2.pyc000064400000030076150335715140011277 0ustar003


 \�F�@s�ddlmZedd�ZdZdZdZdZdZd	Zd
Z	dZ
dZd
ZdZ
dZdZdZeeeeeegZGdd�de�Zdd�Zdd�ZGdd�d�ZGdd�d�Zddd�ZeZdS) �)�
namedtuple�
_sunau_paramsz7nchannels sampwidth framerate nframes comptype compnameidns.������������l��c@seZdZdS)�ErrorN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/sunau.pyr�srcCs<d}x2td�D]&}|jd�}|s$t�|dt|�}qW|S)Nrrr�)�range�read�EOFError�ord)�file�x�iZbyterrr�	_read_u32�s
rcCsJg}x2td�D]&}t|d�\}}|jdt|��|}qW|jt|��dS)Nrrr)r�divmod�insert�int�write�bytes)rr�datar�d�mrrr�
_write_u32�sr'c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)S)*�Au_readcCs@t|�td�kr,ddl}|j|d�}d|_nd|_|j|�dS)N�r�rbTF)�type�builtins�open�_opened�initfp)�self�fr,rrr�__init__�szAu_read.__init__cCs|jr|j�dS)N)�_file�close)r0rrr�__del__�szAu_read.__del__cCs|S)Nr)r0rrr�	__enter__�szAu_read.__enter__cGs|j�dS)N)r4)r0�argsrrr�__exit__�szAu_read.__exit__cCs�||_d|_tt|��}|tkr(td��tt|��|_|jdkrHtd��|jdkrZtd��t|�|_|jtkrzt|j�|_tt|��|_	|j	t
kr�td��|j	ttfkr�d|_
d	|_nj|j	tkr�d	|_|_
nR|j	tkr�d|_|_
n:|j	tkr�d
|_|_
n"|j	tk�rd|_|_
ntd��tt|��|_tt|��|_|j|j|_|jdk�r~|j|jd�|_|jjd
�\|_}}nd|_y|j�|_Wn ttfk
�r�d|_YnXdS)Nrzbad magic numberrzheader size too small�dzheader size ridiculously largezencoding not (yet) supportedrrrrzunknown encoding��)r3�	_soundposr!r�AUDIO_FILE_MAGICrZ	_hdr_size�
_data_size�AUDIO_UNKNOWN_SIZE�	_encoding�_simple_encodings�AUDIO_FILE_ENCODING_MULAW_8�AUDIO_FILE_ENCODING_ALAW_8�
_sampwidth�
_framesize�AUDIO_FILE_ENCODING_LINEAR_8�AUDIO_FILE_ENCODING_LINEAR_16�AUDIO_FILE_ENCODING_LINEAR_24�AUDIO_FILE_ENCODING_LINEAR_32�
_framerate�
_nchannelsr�_info�	partition�tell�	_data_pos�AttributeError�OSError)r0r�magic�_rrrr/�sP







zAu_read.initfpcCs|jS)N)r3)r0rrr�getfp�sz
Au_read.getfpcCs|jS)N)rK)r0rrr�getnchannels�szAu_read.getnchannelscCs|jS)N)rD)r0rrr�getsampwidth�szAu_read.getsampwidthcCs|jS)N)rJ)r0rrr�getframerate�szAu_read.getframeratecCs(|jtkrtS|jtkr$|j|jSdS)Nr)r>r?r@rArE)r0rrr�
getnframes�s


zAu_read.getnframescCs$|jtkrdS|jtkrdSdSdS)N�ULAW�ALAW�NONE)r@rBrC)r0rrr�getcomptype�s


zAu_read.getcomptypecCs$|jtkrdS|jtkrdSdSdS)NzCCITT G.711 u-lawzCCITT G.711 A-lawznot compressed)r@rBrC)r0rrr�getcompname�s


zAu_read.getcompnamecCs*t|j�|j�|j�|j�|j�|j��S)N)rrUrVrWrXr\r])r0rrr�	getparamsszAu_read.getparamscCsdS)Nr)r0rrr�
getmarkersszAu_read.getmarkerscCstd��dS)Nzno marks)r)r0�idrrr�getmarkszAu_read.getmarkcCsp|jtkrl|tkr|jj�}n|jj||j�}|jt|�|j7_|jtkrhddl	}|j
||j�}|SdS)Nr)r@rAr?r3rrEr<�lenrB�audioopZulaw2linrD)r0�nframesr$rcrrr�
readframess

zAu_read.readframescCs*|jdkrtd��|jj|j�d|_dS)Nzcannot seekr)rOrQr3�seekr<)r0rrr�rewinds
zAu_read.rewindcCs|jS)N)r<)r0rrrrNszAu_read.tellcCsP|dks||j�krtd��|jdkr.td��|jj|j||j�||_dS)Nrzposition not in rangezcannot seek)rXrrOrQr3rfrEr<)r0�posrrr�setpos!s
zAu_read.setposcCs"|j}|rd|_|jr|j�dS)N)r3r.r4)r0rrrrr4)s
z
Au_read.closeN)rrrr2r5r6r8r/rTrUrVrWrXr\r]r^r_rarergrNrir4rrrrr(�s(	,
r(c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3S)4�Au_writecCs@t|�td�kr,ddl}|j|d�}d|_nd|_|j|�dS)Nr)r�wbTF)r+r,r-r.r/)r0r1r,rrrr22szAu_write.__init__cCs|jr|j�d|_dS)N)r3r4)r0rrrr5;szAu_write.__del__cCs|S)Nr)r0rrrr6@szAu_write.__enter__cGs|j�dS)N)r4)r0r7rrrr8CszAu_write.__exit__cCsF||_d|_d|_d|_d|_t|_d|_d|_d|_	d|_
d|_dS)Nrr;rY)r3rJrKrDrEr?�_nframes�_nframeswritten�_datawritten�_datalengthrL�	_comptype)r0rrrrr/FszAu_write.initfpcCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerrrz"only 1, 2, or 4 channels supported)rrr)rmrrK)r0�	nchannelsrrr�setnchannelsSs
zAu_write.setnchannelscCs|jstd��|jS)Nznumber of channels not set)rKr)r0rrrrUZszAu_write.getnchannelscCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerrrrzbad sample width)rrrr)rmrrD)r0�	sampwidthrrr�setsampwidth_s
zAu_write.setsampwidthcCs|jstd��|jS)Nzsample width not specified)rJrrD)r0rrrrVfszAu_write.getsampwidthcCs|jrtd��||_dS)Nz0cannot change parameters after starting to write)rmrrJ)r0�	frameraterrr�setframeratekszAu_write.setframeratecCs|jstd��|jS)Nzframe rate not set)rJr)r0rrrrWpszAu_write.getframeratecCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerz# of frames cannot be negative)rmrrl)r0rdrrr�
setnframesus
zAu_write.setnframescCs|jS)N)rm)r0rrrrX|szAu_write.getnframescCs|dkr||_ntd��dS)Nr[rYzunknown compression type)r[rY)rpr)r0r+�namerrr�setcomptypeszAu_write.setcomptypecCs|jS)N)rp)r0rrrr\�szAu_write.getcomptypecCs$|jdkrdS|jdkrdSdSdS)NrYzCCITT G.711 u-lawrZzCCITT G.711 A-lawznot compressed)rp)r0rrrr]�s


zAu_write.getcompnamecCsH|\}}}}}}|j|�|j|�|j|�|j|�|j||�dS)N)rrrtrvrwry)r0ZparamsrqrsrurdZcomptypeZcompnamerrr�	setparams�s



zAu_write.setparamscCs*t|j�|j�|j�|j�|j�|j��S)N)rrUrVrWrXr\r])r0rrrr^�szAu_write.getparamscCs|jS)N)rm)r0rrrrN�sz
Au_write.tellcCs~t|ttf�st|�jd�}|j�|jdkrDddl}|j||j	�}t
|�|j}|jj
|�|j||_|jt
|�|_dS)N�BrYr)�
isinstancer#�	bytearray�
memoryview�cast�_ensure_header_writtenrprcZlin2ulawrDrbrEr3r"rmrn)r0r$rcrdrrr�writeframesraw�s
zAu_write.writeframesrawcCs.|j|�|j|jks"|j|jkr*|j�dS)N)r�rmrlrorn�_patchheader)r0r$rrr�writeframes�s
zAu_write.writeframescCs^|jrZz6|j�|j|jks(|j|jkr0|j�|jj�Wd|j}d|_|jrX|j	�XdS)N)
r3r�rmrlrornr��flushr.r4)r0rrrrr4�szAu_write.closecCs<|js8|jstd��|js"td��|js0td��|j�dS)Nz# of channels not specifiedzsample width not specifiedzframe rate not specified)rmrKrrDrJ�
_write_header)r0rrrr��szAu_write._ensure_header_writtenc
Cs�|jdkrl|jdkr t}d|_q�|jdkr6t}d|_q�|jdkrLt}d|_q�|jdkrbt}d|_q�td��n|jdkr�t}d|_ntd��|j|j	|_t
|jt�dt
|j�}|d	d@}t
|j|�|jtkr�t}n|j|j}y|jj�|_Wn ttfk
�rd|_YnXt
|j|�||_t
|j|�t
|j|j�t
|j|j	�|jj|j�|jjd
|t
|j�d�dS)
Nr[rrrrzinternal errorrYr
r
r:ri����)rprDrFrErGrHrIrrBrKr'r3r=rbrLrlr?rN�_form_length_posrPrQrorJr")r0�encodingZheader_sizeZlengthrrrr��sJ







zAu_write._write_headercCsH|jdkrtd��|jj|j�t|j|j�|j|_|jjdd�dS)Nzcannot seekrr)r�rQr3rfr'rnro)r0rrrr��s
zAu_write._patchheaderN)rrrr2r5r6r8r/rrrUrtrVrvrWrwrXryr\r]rzr^rNr�r�r4r�r�r�rrrrrj0s2	

*rjNcCsJ|dkrt|d�r|j}nd}|dkr.t|�S|dkr>t|�Std��dS)	N�moder*�r�wrkz$mode must be 'r', 'rb', 'w', or 'wb')r�r*)r�rk)�hasattrr�r(rjr)r1r�rrrr-s
r-)N)�collectionsrrr=rBrFrGrHrIZAUDIO_FILE_ENCODING_FLOATZAUDIO_FILE_ENCODING_DOUBLEZAUDIO_FILE_ENCODING_ADPCM_G721ZAUDIO_FILE_ENCODING_ADPCM_G722Z AUDIO_FILE_ENCODING_ADPCM_G723_3Z AUDIO_FILE_ENCODING_ADPCM_G723_5rCr?rA�	Exceptionrrr'r(rjr-Zopenfprrrr�<module>js>	Q

inspect.cpython-36.opt-2.pyc000064400000151412150335715140011607 0ustar003


 \���@s�d�ZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlmZddlmZmZe�Zx"ejj�D]\ZZeede<q�Wd�Zd	d
�Zdd�Z d
d�Z!dd�Z"dd�Z#e$ed��rdd�Z%ndd�Z%e$ed��r2dd�Z&ndd�Z&dd�Z'dd�Z(dd �Z)d!d"�Z*d#d$�Z+d%d&�Z,d'd(�Z-d)d*�Z.d+d,�Z/d-d.�Z0d/d0�Z1d1d2�Z2d3d4�Z3d5d6�Z4d�d7d8�Z5ed9d:�Z6d;d<�Z7d=d>�Z8dd?�d@dA�Z9dBdC�Z:dDdE�Z;dFdG�Z<dHdI�Z=dJdK�Z>dLdM�Z?dNdO�Z@dPdQ�ZAd�dRdS�ZBiZCiZDd�dTdU�ZEdVdW�ZFdXdY�ZGGdZd[�d[eH�ZIGd\d]�d]�ZJd^d_�ZKd`da�ZLdbdc�ZMddde�ZNd�dgdh�ZOedidj�ZPdkdl�ZQdmdn�ZRedodp�ZSdqdr�ZTedsdt�ZUdudv�ZVedwdx�ZWdydz�ZXd�d{d|�ZYd}d~�ZZdddfiie[dd��d�d��d�d��d�d��eYfd�d��Z\e[d�d��d�d��d�d��fd�d��Z]d�d��Z^d�d��Z_d�d��Z`ed�d��Zad�d��Zbed�d��Zcd�d�d��Zdd�d��Zeed�d�ecjf�Zgd�d�d��Zhd�d�d��Zid�d��Zjd�d�d��Zkd�d�d��Zlem�Znd�d��Zod�d��Zpd�d��Zqd�d��Zrd�d��Zsenfd�d��Ztd�Zud�Zvd�Zwd�Zxd�d��Zyd�d��Zzd�Z{d�Z|d�Z}d�Z~d�d��Zd�d„Z�e�e�j��Z�e�e�j��Z�e�e�j�d��Z�e�e�e�ej�fZ�d�dńZ�ffd�dDŽZ�d�dɄZ�d�d˄Z�d�d̈́Z�d�dτZ�d�dфZ��dd�dԄZ��dd�dքZ�d�d؄Z�d�d�dٜd�dۄZ�Gd�d݄d݃Z�Gd�d߄d߃Z�Gd�d�d�ej��Z�e�j�Z�e�j�Z�e�j�Z�e�j�Z�e�j�Z�e�d�e�d�e�d�e�d�e�d�iZ�e�j�Z�Gd�d�d�Z�Gd�d�d�Z�Gd�d�d�Z�d�d�d�d�Z�d�d�Z�e�d�k�r�e��dS(�Ka-Ping Yee <ping@lfw.org>�'Yury Selivanov <yselivanov@sprymix.com>�N)�
attrgetter)�
namedtuple�OrderedDictZCO_��cCst|tj�S)N)�
isinstance�types�
ModuleType)�object�r
�/usr/lib64/python3.6/inspect.py�ismodule@srcCs
t|t�S)N)r	�type)rr
r
r�isclassIsrcCst|tj�S)N)r	r
�
MethodType)rr
r
r�ismethodQsrcCs:t|�st|�st|�rdSt|�}t|d�o8t|d�S)NF�__get__�__set__)rr�
isfunctionr�hasattr)r�tpr
r
r�ismethoddescriptor[srcCs8t|�st|�st|�rdSt|�}t|d�o6t|d�S)NFrr)rrrrr)rrr
r
r�isdatadescriptorosr�MemberDescriptorTypecCst|tj�S)N)r	r
r)rr
r
r�ismemberdescriptorsrcCsdS)NFr
)rr
r
rr�s�GetSetDescriptorTypecCst|tj�S)N)r	r
r)rr
r
r�isgetsetdescriptor�srcCsdS)NFr
)rr
r
rr�scCst|tj�S)N)r	r
�FunctionType)rr
r
rr�srcCs tt|�st|�o|jjt@�S)N)�boolrr�__code__�co_flagsZCO_GENERATOR)rr
r
r�isgeneratorfunction�sr#cCs tt|�st|�o|jjt@�S)N)r rrr!r"ZCO_COROUTINE)rr
r
r�iscoroutinefunction�sr$cCs tt|�st|�o|jjt@�S)N)r rrr!r"ZCO_ASYNC_GENERATOR)rr
r
r�isasyncgenfunction�sr%cCst|tj�S)N)r	r
�AsyncGeneratorType)rr
r
r�
isasyncgen�sr'cCst|tj�S)N)r	r
�
GeneratorType)rr
r
r�isgenerator�sr)cCst|tj�S)N)r	r
�
CoroutineType)rr
r
r�iscoroutine�sr+cCs6t|tj�p4t|tj�r(t|jjt@�p4t|tj	j
�S)N)r	r
r*r(r �gi_coder"ZCO_ITERABLE_COROUTINE�collections�abc�	Awaitable)rr
r
r�isawaitable�sr0cCst|tj�S)N)r	r
�
TracebackType)rr
r
r�istraceback�sr2cCst|tj�S)N)r	r
�	FrameType)rr
r
r�isframe�sr4cCst|tj�S)N)r	r
�CodeType)rr
r
r�iscode�sr6cCst|tj�S)N)r	r
�BuiltinFunctionType)rr
r
r�	isbuiltinsr8cCs t|�pt|�pt|�pt|�S)N)r8rrr)rr
r
r�	isroutinesr9cCs�t|t�sdS|jt@rdStt|�tj�s0dSt|d�r>dSx&|jj	�D]\}}t
|dd�rJdSqJWx@|jD]6}x0t
|df�D] }t
||d�}t
|dd�r�dSq�WqnWdS)NFT�__abstractmethods__�__isabstractmethod__)r	r�	__flags__�TPFLAGS_IS_ABSTRACT�
issubclassr.�ABCMetar�__dict__�items�getattr�	__bases__)r�name�value�baser
r
r�
isabstract%s"


rGcCs&t|�r|ft|�}nf}g}t�}t|�}yBx<|jD]2}x,|jj�D]\}}t|tj	�rH|j
|�qHWq8WWntk
r�YnXx�|D]�}	yt||	�}
|	|kr�t�Wn:tk
r�x$|D]}|	|jkr�|j|	}
Pq�Ww�YnX|s�||
��r|j
|	|
f�|j
|	�q�W|jdd�d�|S)NcSs|dS)Nrr
)Zpairr
r
r�<lambda>fszgetmembers.<locals>.<lambda>)�key)r�getmro�set�dirrCr@rAr	r
�DynamicClassAttribute�append�AttributeErrorrB�add�sort)rZ	predicate�mro�results�	processed�namesrF�k�vrIrEr
r
r�
getmembers=s:




rX�	Attributezname kind defining_class objectcCs\t|�}tt|��}tdd�|D��}|f|}||}t|�}x:|D]2}x,|jj�D]\}}t|tj�rV|j	|�qVWqFWg}	t
�}
�x�|D�]�}d}d}
d}||
k�r�y|dkr�td��t||�}
Wn"tk
r�}zWYdd}~Xn�Xt|
d|�}||k�r�d}d}x(|D] }t||d�}||
k�r|}�qWxH|D]@}y|j
||�}Wntk
�rh�w:YnX||
k�r:|}�q:W|dk	�r�|}x4|D],}||jk�r�|j|}||k�r�|}P�q�W|dk�r�q�|
dk	�r�|
n|}t|t��r�d}|}n@t|t��rd}|}n*t|t��r"d}|}nt|��r2d	}nd
}|	j	t||||��|
j|�q�W|	S)NcSsg|]}|ttfkr|�qSr
)rr)�.0�clsr
r
r�
<listcomp>�sz(classify_class_attrs.<locals>.<listcomp>r@z)__dict__ is special, don't want the proxy�__objclass__z
static methodzclass method�property�method�data)rJr�tuplerLr@rAr	r
rMrNrK�	ExceptionrB�__getattr__rO�staticmethod�classmethodr^r9rYrP)r[rRZmetamroZclass_basesZ	all_basesrUrFrVrW�resultrTrDZhomeclsZget_objZdict_obj�excZlast_clsZsrch_clsZsrch_obj�obj�kindr
r
r�classify_class_attrsks�

















rjcCs|jS)N)�__mro__)r[r
r
rrJ�srJ)�stopcs��dkrdd�}n�fdd�}|}t|�|i}tj�}xD||�rz|j}t|�}||ksbt|�|krptdj|���|||<q8W|S)NcSs
t|d�S)N�__wrapped__)r)�fr
r
r�_is_wrapper�szunwrap.<locals>._is_wrappercst|d�o�|�S)Nrm)r)rn)rlr
rro�sz!wrapper loop when unwrapping {!r})�id�sys�getrecursionlimitrm�len�
ValueError�format)�funcrlrorn�memoZrecursion_limitZid_funcr
)rlr�unwrap�s

rxcCs|j�}t|�t|j��S)N)�
expandtabsrs�lstrip)�lineZexpliner
r
r�
indentsize	sr|cCsRtjj|j�}|dkrdSx&|jjd�dd�D]}t||�}q0Wt|�sNdS|S)N�.r���)rq�modules�get�
__module__�__qualname__�splitrBr)rvr[rDr
r
r�
_findclasssr�cCs�t|�rRxD|jD]:}|tk	ry
|j}Wntk
r<wYnX|dk	r|SqWdSt|�r�|jj}|j}t|�r�t	t	||d�d�|jkr�|}n|j
}n�t|�r�|j}t|�}|dks�t	||�|k	r�dSn�t
|��r
|j}|j}t|�o�|jd||jk�r|}n|j
}nzt|t��rJ|j}|j}t|�}|dk�sDt	||�|k	�r�dSn:t|��s^t|��r�|j}|j}t	||�|k	�r�dSndSxJ|jD]@}yt	||�j}Wntk
�r��w�YnX|dk	�r�|S�q�WdS)N�__func__r})rrkr�__doc__rOrr��__name__�__self__rB�	__class__rr�r8r�r	r^�fgetrrr])rhrF�docrD�selfr[rvr
r
r�_finddocsb




r�cCsdy
|j}Wntk
rdSX|dkrNyt|�}Wnttfk
rLdSXt|t�s\dSt|�S)N)r�rOr��	TypeErrorr	�str�cleandoc)rr�r
r
r�getdocSs

r�cCs�y|j�jd�}Wntk
r&dSXtj}x:|dd�D]*}t|j��}|r<t|�|}t||�}q<W|r~|dj�|d<|tjkr�x*tdt|��D]}|||d�||<q�Wx|r�|dr�|j	�q�Wx|r�|dr�|j	d�q�Wdj
|�SdS)N�
rrr~)ryr��UnicodeErrorrq�maxsizersrz�min�range�pop�join)r��linesZmarginr{Zcontent�indent�ir
r
rr�fs(
r�cCs�t|�r&t|d�r|jStdj|���t|�rdt|d�rVtjj|j	�}t|d�rV|jStdj|���t
|�rr|j}t|�r�|j
}t|�r�|j}t|�r�|j}t|�r�|jStdj|���dS)N�__file__z{!r} is a built-in moduler�z{!r} is a built-in classzO{!r} is not a module, class, method, function, traceback, frame, or code object)rrr�r�rurrqrr�r�rr�rr!r2�tb_framer4�f_coder6�co_filename)rr
r
r�getfile�s,


r�cCsTtjj|�}dd�tjj�D�}|j�x&|D]\}}|j|�r.|d|�Sq.WdS)NcSsg|]}t|�|f�qSr
)rs)rZ�suffixr
r
rr\�sz!getmodulename.<locals>.<listcomp>)�os�path�basename�	importlib�	machinery�all_suffixesrQ�endswith)r�Zfname�suffixesZneglenr�r
r
r�
getmodulename�s
r�cs�t|��tjjdd�}|tjjdd�7}t�fdd�|D��r`tjj��dtjj	d�nt�fdd�tjj
D��r~dStjj��r��Stt
|��dd�dk	r��S�tjkr��SdS)Nc3s|]}�j|�VqdS)N)r�)rZ�s)�filenamer
r�	<genexpr>�sz getsourcefile.<locals>.<genexpr>rc3s|]}�j|�VqdS)N)r�)rZr�)r�r
rr��s�
__loader__)r�r�r��DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXES�anyr�r��splitext�SOURCE_SUFFIXES�EXTENSION_SUFFIXES�existsrB�	getmodule�	linecache�cache)rZall_bytecode_suffixesr
)r�r�
getsourcefile�s
r�cCs,|dkrt|�pt|�}tjjtjj|��S)N)r�r�r�r��normcase�abspath)r�	_filenamer
r
r�
getabsfile�sr�c

Cs�t|�r|St|d�r$tjj|j�S|dk	rD|tkrDtjjt|�Syt||�}Wntk
rfdSX|tkr�tjjt|�Sxnt	tjj
��D]\\}}t|�r�t|d�r�|j}|tj|d�kr�q�|t|<t|�}|j
t|<ttjj|�<q�W|tk�r
tjjt|�Stjd}t|d��s$dSt||j
��rLt||j
�}||k�rL|Stjd}t||j
��r~t||j
�}	|	|k�r~|SdS)Nr�r��__main__r��builtins)rrrqrr�r��
modulesbyfiler�r��listrAr��_filesbymodnamer�r�r��realpathrB)
rr��file�modname�modulern�mainZ
mainobjectZbuiltinZ
builtinobjectr
r
rr��sD





r�c
Cs�t|�}|rtj|�n$t|�}|jd�o2|jd�s<td��t||�}|rZtj||j	�}n
tj|�}|sptd��t
|�r�|dfSt|��r |j}t
jd|d�}g}xRtt|��D]B}|j||�}|r�||ddkr�||fS|j|jd	�|f�q�W|�r|j�||dd	fStd
��t|��r0|j}t|��r@|j}t|��rP|j}t|��r`|j}t|��r�t|d��s~td��|jd	}	t
jd
�}x*|	dk�r�|j||	��r�P|	d	}	�q�W||	fStd��dS)N�<�>zsource code not availablezcould not get source coderz^(\s*)class\s*z\b�crzcould not find class definition�co_firstlinenoz"could not find function definitionz>^(\s*def\s)|(\s*async\s+def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)zcould not find code object) r�r��
checkcacher��
startswithr��OSErrorr��getlinesr@rrr��re�compiler�rs�matchrN�grouprQrr�rr!r2r�r4r�r6rr�)
rr�r�r�rDZpatZ
candidatesr�r��lnumr
r
r�
findsource�s^









r�cCs>yt|�\}}Wnttfk
r(dSXt|�r�d}|rR|ddd�dkrRd}x(|t|�krz||j�dkrz|d}qTW|t|�kr�||dd�dkr�g}|}x>|t|�kr�||dd�dkr�|j||j��|d}q�Wdj|�S�nH|dk�r:t	||�}|d}|dk�r:||j
�dd�dk�r:t	||�|k�r:||j�j
�g}|dk�r�|d}||j�j
�}x\|dd�dk�r�t	||�|k�r�|g|dd�<|d}|dk�r�P||j�j
�}�q|Wx*|�r|dj�dk�rg|dd�<�q�Wx*|�r.|dj�dk�r.g|d	d�<�qWdj|�SdS)
Nr�z#!r��#)r�r�r~r~)r�r�r�rrs�striprNryr�r|rz)rr�r��startZcomments�endr�Zcommentr
r
r�getcommentsAsJ "
$
&
r�c@seZdZdS)�
EndOfBlockN)r�r�r�r
r
r
rr�nsr�c@seZdZdd�Zdd�ZdS)�BlockFindercCs.d|_d|_d|_d|_d|_d|_d|_dS)NrFr)r��islambda�started�passline�indecorator�decoratorhasargs�last)r�r
r
r�__init__rszBlockFinder.__init__cCs&|jrD|jrD|dkr d|_n|dkr<|dkr6d|_d|_d|_n�|dkrZ|jrXd|_n�|dkrv|jrtd|_d|_n�|tjkr�d|_|d	|_|jr�t�|jr�|jr�d|_nr|jr�nj|tj	kr�|j
d
|_
d|_nL|tjk�r|j
d
|_
|j
d	k�r"t�n"|j
d	k�r"|tjtj
fk�r"t�dS)N�@T�def�class�lambda�(�)Frr)r�r�r�)r�r�r�r�r��tokenize�NEWLINEr�r��INDENTr��DEDENT�COMMENT�NL)r�r�tokenZsrowcolZerowcolr{r
r
r�
tokeneater{sB


zBlockFinder.tokeneaterN)r�r�r�r�r�r
r
r
rr�ps	r�cCsZt�}y,tjt|�j�}x|D]}|j|�qWWnttfk
rJYnX|d|j�S)N)	r�r��generate_tokens�iter�__next__r�r��IndentationErrorr�)r�Zblockfinder�tokensZ_tokenr
r
r�getblock�s
r�cCsbt|�}t|�\}}t|�r"|j}t|�s>t|�rF|jjdkrF|dfSt||d��|dfSdS)Nz<module>rr)	rxr�r2r�rr4r��co_namer�)rr�r�r
r
r�getsourcelines�sr�cCst|�\}}dj|�S)Nr�)r�r�)rr�r�r
r
r�	getsource�sr�cCsVg}|jtdd�d�x:|D]2}|j||jf�||kr|jt||||��qW|S)Nr�r�)rI)rQrrNrC�walktree)�classes�children�parentrSr�r
r
rr��s
r�FcCs�i}g}xn|D]f}|jrbxZ|jD]<}||kr4g||<|||krN||j|�|r ||kr Pq Wq||kr|j|�qWx|D]}||kr~|j|�q~Wt||d�S)N)rCrNr�)r��uniquer��rootsr�rr
r
r�getclasstree�s"	

r�	Argumentszargs, varargs, varkwcCs t|�\}}}}t||||�S)N)�_getfullargsr)�co�args�varargs�
kwonlyargs�varkwr
r
r�getargs�src	Cs�t|�stdj|���|j}|j}|j}t|d|��}t||||��}d}||7}d}|jt@rx|j|}|d}d}|jt	@r�|j|}||||fS)Nz{!r} is not a code objectrr)
r6r�ru�co_argcount�co_varnames�co_kwonlyargcountr�r"�
CO_VARARGS�CO_VARKEYWORDS)	r�nargsrUZnkwargsrr	�steprr
r
r
rrs"



r�ArgSpeczargs varargs keywords defaultscCsDtjdtdd�t|�\}}}}}}}|s.|r6td��t||||�S)Nzhinspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()r�)�
stacklevelzdFunction has keyword-only parameters or annotations, use getfullargspec() API which can support them)�warnings�warn�DeprecationWarning�getfullargspecrtr)rvrrr
�defaultsr	�kwonlydefaults�annr
r
r�
getargspec s
r�FullArgSpeczGargs, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotationsc
Cs`yt|ddtd�}Wn,tk
r@}ztd�|�WYdd}~XnXg}d}d}g}f}i}f}i}	|j|jk	rx|j|d<x�|jj�D]�}
|
j}|
j	}|t
kr�|j|�nv|tkr�|j|�|
j
|
jk	r�||
j
f7}nJ|tkr�|}n<|tk�r|j|�|
j
|
jk	�r|
j
|	|<n|tk�r|}|
j|
jk	r�|
j||<q�W|	�sBd}	|�sLd}t||||||	|�S)NF)�follow_wrapper_chains�skip_bound_arg�sigclszunsupported callable�return)�_signature_from_callable�	Signaturerbr��return_annotation�empty�
parameters�valuesrirD�_POSITIONAL_ONLYrN�_POSITIONAL_OR_KEYWORD�default�_VAR_POSITIONAL�
_KEYWORD_ONLY�_VAR_KEYWORD�
annotationr)
rv�sig�exrrr
r	r�annotations�
kwdefaults�paramrirDr
r
rrAsT





r�ArgInfozargs varargs keywords localscCs t|j�\}}}t||||j�S)N)rr�r4�f_locals)�framerrr
r
r
r�getargvalues�sr7cCsVt|dd�dkr t|�jdd�St|t�rN|jd|fkr>|jS|jd|jSt|�S)Nr�Ztypingztyping.r�r�r})rB�repr�replacer	rr�r�)r.Zbase_moduler
r
r�formatannotation�s
r:cst|dd���fdd�}|S)Nr�cs
t|��S)N)r:)r.)r�r
r�_formatannotation�sz5formatannotationrelativeto.<locals>._formatannotation)rB)rr;r
)r�r�formatannotationrelativeto�sr<cCsd|S)N�*r
)rDr
r
rrH�srHcCsd|S)Nz**r
)rDr
r
rrH�scCsdt|�S)N�=)r8)rEr
r
rrH�scCsd|S)Nz -> r
)�textr
r
rrH�sc
s(���fdd�}
g}|r(t|�t|�}xFt|�D]:\}}|
|�}|rb||krb||
|||�}|j|�q2W|dk	r�|j||
|���n|r�|jd�|r�x:|D]2}|
|�}|r�||kr�||
||�7}|j|�q�W|dk	r�|j|	|
|���ddj|�d}d�k�r$||��d��7}|S)Ncs(�|�}|�kr$|d��|�7}|S)Nz: r
)�argrf)r1r:�	formatargr
r�formatargandannotation�sz-formatargspec.<locals>.formatargandannotationr=r�z, r�r!)rs�	enumeraterNr�)rrr
rr	rr1rA�
formatvarargs�formatvarkw�formatvalueZ
formatreturnsr:rB�specsZfirstdefaultr�r@�specZ	kwonlyargrfr
)r1r:rAr�
formatargspec�s2


rIcCsd|S)Nr=r
)rDr
r
rrH�scCsd|S)Nz**r
)rDr
r
rrH�scCsdt|�S)Nr>)r8)rEr
r
rrH�scCs�|||fdd�}g}	x&tt|��D]}
|	j|||
��q"W|rZ|	j||�|||��|rx|	j||�|||��ddj|	�dS)NcSs||�|||�S)Nr
)rD�localsrArFr
r
r�convert�sz formatargvalues.<locals>.convertr�z, r�)r�rsrNr�)rrr
rJrArDrErFrKrGr�r
r
r�formatargvalues�srLcs��fdd�|D�}t|�}|dkr,|d}n>|dkr@dj|�}n*dj|dd��}|dd�=dj|�|}td	|||rzd
nd|dkr�dnd
|f��dS)Ncsg|]}|�krt|��qSr
)r8)rZrD)r'r
rr\�sz&_missing_arguments.<locals>.<listcomp>rrr�z	{} and {}z, {} and {}z, z*%s() missing %i required %s argument%s: %s�
positionalzkeyword-onlyr�r����rN)rsrur�r�)�f_nameZargnames�posr'rU�missingr��tailr
)r'r�_missing_arguments�s


rSc
	s�t|�|}t�fdd�|D��}|r:|dk}	d|f}
n2|rTd}	d|t|�f}
nt|�dk}	tt|��}
d}|r�d}||dkr�d	nd||dkr�d	ndf}td
||
|	r�d	nd|||dkr�|r�dndf��dS)
Ncsg|]}|�kr|�qSr
r
)rZr@)r'r
rr\sz_too_many.<locals>.<listcomp>rzat least %dTz
from %d to %dr�z7 positional argument%s (and %d keyword-only argument%s)r�z5%s() takes %s positional argument%s but %d%s %s givenZwasZwere)rsr�r�)
rOrZkwonlyrZdefcountZgivenr'ZatleastZkwonly_givenZpluralr/Z
kwonly_sig�msgr
)r'r�	_too_manys$rUcOs6|d}|dd�}t|�}|\}}}}}	}
}|j}i}
t|�rV|jdk	rV|jf|}t|�}t|�}|rrt|�nd}t||�}x t|�D]}|||
||<q�W|r�t||d��|
|<t||	�}|r�i|
|<xd|j	�D]X\}}||k�r|�st
d||f��||
||<q�||
k�r,t
d||f��||
|<q�W||k�r^|�r^t|||	||||
�||k�r�|d||�}x&|D]}||
k�r~t||d|
��q~Wx8t
|||d��D] \}}||
k�r�|||
|<�q�Wd}x>|	D]6}||
k�r�|
�r||
k�r|
||
|<n|d7}�q�W|�r2t||	d|
�|
S)Nrrz*%s() got an unexpected keyword argument %rz(%s() got multiple values for argument %rTF)rr�rr�rsr�r�rarKrAr�rUrSrC)Zfunc_and_positionalZnamedrvrMrHrrr
rr	rrrOZ	arg2valueZnum_posZnum_argsZnum_defaults�nr�Zpossible_kwargs�kwrEZreqr@rQ�kwargr
r
r�getcallargs!sd








rY�ClosureVarsz"nonlocals globals builtins unboundc	Cst|�r|j}t|�s$tdj|���|j}|jdkr:i}ndd�t|j|j�D�}|j	}|j
dtj�}t
|�rt|j}i}i}t�}xn|jD]d}|dkr�q�y||||<Wq�tk
r�y||||<Wntk
r�|j|�YnXYq�Xq�Wt||||�S)	Nz'{!r}' is not a Python functioncSsi|]\}}|j|�qSr
)�
cell_contents)rZ�varZcellr
r
r�
<dictcomp>vsz"getclosurevars.<locals>.<dictcomp>�__builtins__�None�True�False)r_r`ra)rr�rr�rur!�__closure__�zip�co_freevars�__globals__r�r�r@rrK�co_names�KeyErrorrPrZ)	rv�codeZ
nonlocal_varsZ	global_nsZ
builtin_nsZglobal_varsZbuiltin_varsZ
unbound_namesrDr
r
r�getclosurevarsas8	
ri�	Tracebackz+filename lineno function code_context indexcCs�t|�r|j}|j}n|j}t|�s2tdj|���t|�p@t|�}|dkr�|d|d}yt	|�\}}Wnt
k
r�d}}Yq�Xtdt|t
|�|��}||||�}|d|}nd}}t|||jj||�S)Nz'{!r} is not a frame or traceback objectrrr�)r2�	tb_linenor��f_linenor4r�rur�r�r�r��maxr�rsrjr�r�)r6�context�linenor�r�r�r��indexr
r
r�getframeinfo�s$rqcCs|jS)N)rl)r6r
r
r�	getlineno�srr�	FrameInfor6cCs6g}x,|r0|ft||�}|jt|��|j}qW|S)N)rqrNrs�f_back)r6rn�	framelist�	frameinfor
r
r�getouterframes�s
rwcCs8g}x.|r2|jft||�}|jt|��|j}qW|S)N)r�rqrNrs�tb_next)�tbrnrurvr
r
r�getinnerframes�s
rzcCsttd�rtjd�SdS)N�	_getframer)rrqr{r
r
r
r�currentframe�sr|cCsttjd�|�S)Nr)rwrqr{)rnr
r
r�stack�sr}cCsttj�d|�S)Nr�)rzrq�exc_info)rnr
r
r�trace�srcCstjdj|�S)Nrk)rr@r)�klassr
r
r�_static_getmro�sr�cCs8i}ytj|d�}Wntk
r(YnXtj||t�S)Nr@)r�__getattribute__rO�dictr��	_sentinel)rh�attrZ
instance_dictr
r
r�_check_instance�sr�cCsFx@t|�D]4}tt|��tkr
y
|j|Stk
r<Yq
Xq
WtS)N)r��_shadowed_dictrr�r@rg)r�r��entryr
r
r�_check_class�s

r�cCs&yt|�Wntk
r dSXdS)NFT)r�r�)rhr
r
r�_is_type�s
r�cCsntjd}x^t|�D]R}y|j|�d}Wntk
r>YqXt|�tjko`|jdko`|j|ks|SqWt	S)Nr@)
rr@r�rrgr
rr�r]r�)r��	dict_attrr�Z
class_dictr
r
rr�s


r�cCst}t|�s>t|�}t|�}|tks2t|�tjkrBt||�}n|}t||�}|tk	r�|tk	r�tt|�d�tk	r�tt|�d�tk	r�|S|tk	r�|S|tk	r�|S||kr�xDtt|��D]4}tt|��tkr�y
|j	|St
k
r�Yq�Xq�W|tk	r�|St|��dS)Nrr)r�r�rr�r
rr�r�r�r@rgrO)rhr�r*Zinstance_resultr�r�Zklass_resultr�r
r
r�getattr_statics6


r��GEN_CREATED�GEN_RUNNING�
GEN_SUSPENDED�
GEN_CLOSEDcCs,|jr
tS|jdkrtS|jjdkr(tStS)Nrr~)�
gi_runningr��gi_framer��f_lastir�r�)�	generatorr
r
r�getgeneratorstateGs	
r�cCs:t|�stdj|���t|dd�}|dk	r2|jjSiSdS)Nz '{!r}' is not a Python generatorr�)r)r�rurBr�r5)r�r6r
r
r�getgeneratorlocalsYsr��CORO_CREATED�CORO_RUNNING�CORO_SUSPENDED�CORO_CLOSEDcCs,|jr
tS|jdkrtS|jjdkr(tStS)Nrr~)�
cr_runningr��cr_framer�r�r�r�)�	coroutiner
r
r�getcoroutinestateqs	
r�cCs"t|dd�}|dk	r|jSiSdS)Nr�)rBr5)r�r6r
r
r�getcoroutinelocals�sr��
from_bytescCs6yt||�}Wntk
r"dSXt|t�s2|SdS)N)rBrOr	�_NonUserDefinedCallables)r[Zmethod_name�methr
r
r�"_signature_get_user_defined_method�s
r�cCs�|j}t|j��}|jpf}|jp$i}|r2||}y|j||�}Wn6tk
rx}zdj|�}	t|	�|�WYdd}~XnXd}
�x
|j�D�]�\}}y|j	|}
Wnt
k
r�YnlX|jtkr�|j
|�q�|jtk�r||kr�d}
|j|
d�||<n|j
|j�q�|jtk�r"|j|
d�||<|
r�|jtk�rV||jtd�}|||<|j|�q�|jttfk�rr|j|�q�|jtkr�|j
|j�q�W|j|j�d�S)Nz+partial object {!r} has incorrect argumentsFT)r*)ri)r&)r&rrAr�keywords�bind_partialr�rurt�	argumentsrgrir(r�r)r9rDr,�move_to_endr-r+r')�wrapped_sig�partialZ
extra_argsZ
old_params�
new_paramsZpartial_argsZpartial_keywordsZbar0rTZtransform_to_kwonly�
param_namer3Z	arg_valueZ	new_paramr
r
r�_signature_get_partial�sL






r�cCsnt|jj��}|s&|djttfkr.td��|dj}|ttfkrR|dd�}n|t	k	rbtd��|j
|d�S)Nrzinvalid method signaturerzinvalid argument type)r&)rar&r'rir-r,rtr)r(r+r9)r/�paramsrir
r
r�_signature_bound_method�s
r�cCs&t|�p$t|�p$t|t�p$|ttfkS)N)r8rr	r�rr)rhr
r
r�_signature_is_builtins
r�cCs�t|�st|�rdSt|dd�}t|dd�}t|dt�}t|dt�}t|dd�}t|tj�o�t|t�o�|dkszt|t�o�|dks�t|t	�o�t|t	�S)NFr�r!�__defaults__�__kwdefaults__�__annotations__)
�callablerrB�_voidr	r
r5r�rar�)rhrDrhrr2r1r
r
r�_signature_is_functionlike!s
r�cCs<|jd�}|dkr|jd�}|jd�}|jd�}|d|�S)N�,rr��:r>r�r~)�find)rHrPZcposr
r
r�_signature_get_bound_param:s




r�cCs$|s|ddfSd}d}dd�|jd�D�}t|�j}tj|�}d}d}g}|j}	d}
tj}tj}t|�}
x�|D]�}
|
j	|
j
}}||kr�|dkr�|r�d}qnd}|
d7}
qn|d	kr�d}|
d}qn||kr�|d
kr�|
}qn|r�d}||ko�|dks�|	d�|	|�|dkrn|	d
�qnWdj|�}|||fS)NcSsg|]}|jd��qS)�ascii)�encode)rZ�lr
r
rr\dsz6_signature_strip_non_python_syntax.<locals>.<listcomp>r�Frr�Tr�/�$r�z, � r�)r�r�r�r�rNr��OP�
ERRORTOKEN�nextr�stringr�)�	signature�self_parameter�last_positional_onlyr�r�Ztoken_streamZ
delayed_commaZskip_next_commar?rPZcurrent_parameterr�r��trr��clean_signaturer
r
r�"_signature_strip_non_python_syntaxQsP





r�TcsV|j�t|�\}}}d|d}ytj|�}Wntk
rFd}YnXt|tj�sbtdj|���|j	d}	g��j
�t��d}i�t|dd�}
|
r�t
jj|
d�}|r�|j�t
jj��dd����fdd	��	G�	fd
d�dtj���f�������fdd
�	}t|	jj�}t|	jj�}
tj||
dd�}|dk	�r8�j�n�j�x<ttt|���D](\}\}}|||�||k�rP�j��qPW|	jj�r��j�||	jj���j�x*t|	jj |	jj!�D]\}}|||��q�W|	jj"�r�j#�||	jj"��|dk	�rHt|dd�}|dk	}t$|�}|�r.|�s"|�r.�j%d�n�dj&�jd�}|�d<|�|j
d�S)Nzdef fooz: passz"{!r} builtin has invalid signaturerr�cSs|jdkrtd��|jS)Nz'Annotations are not currently supported)r.rtr@)�noder
r
r�
parse_name�s
z&_signature_fromstr.<locals>.parse_namecs�yt|��}Wn>tk
rLyt|��}Wntk
rFt��YnXYnXt|t�rbtj|�St|ttf�rztj	|�St|t
�r�tj|�S|dkr�tj|�St��dS)NTF)TFN)
�eval�	NameError�RuntimeErrorr	r��astZStr�int�floatZNum�bytesZBytesZNameConstant)r�rE)�module_dict�sys_module_dictr
r�
wrap_value�s 





z&_signature_fromstr.<locals>.wrap_valuecs$eZdZ�fdd�Z�fdd�ZdS)z,_signature_fromstr.<locals>.RewriteSymbolicscs`g}|}x"t|tj�r*|j|j�|j}q
Wt|tj�s>t��|j|j�dj	t
|��}�|�S)Nr})r	r�rYrNr�rE�Namer�rpr��reversed)r�r��arVrE)r�r
r�visit_Attribute�s
z<_signature_fromstr.<locals>.RewriteSymbolics.visit_Attributecst|jtj�st���|j�S)N)r	Zctxr�ZLoadrtrp)r�r�)r�r
r�
visit_Name�sz7_signature_fromstr.<locals>.RewriteSymbolics.visit_NameN)r�r�r�r�r�r
)r�r
r�RewriteSymbolics�sr�cs��|�}|�krdS|rp|tk	rpy��j|�}tj|�}Wntk
rR�}YnX|�kr`dS|�k	rl|n|}�j�|�|�d��dS)N)r*r.)�_emptyZvisitr�Zliteral_evalrtrN)Z	name_nodeZdefault_noder*rD�o)�	Parameterr�r%�invalidrir&r�r
r�p�s
z_signature_fromstr.<locals>.p)�	fillvaluer�)ri)r$)'�_parameter_clsr�r��parse�SyntaxErrorr	ZModulertruZbodyr%rrBrqrr�r@�copyZNodeTransformerr�rr�	itertools�zip_longest�POSITIONAL_ONLY�POSITIONAL_OR_KEYWORDrCr�Zvararg�VAR_POSITIONAL�KEYWORD_ONLYrcr	Zkw_defaultsrX�VAR_KEYWORDrr�r9)r[rhr�rr�r�r�Zprogramr�rnZmodule_namer�rrr�r�rDr*�_selfZself_isboundZ
self_ismoduler
)
r�r�r%r�rir�r&r�r�r�r�_signature_fromstr�sj








r�cCsBt|�stdj|���t|dd�}|s4tdj|���t||||�S)Nz%{!r} is not a Python builtin function�__text_signature__z#no signature found for builtin {!r})r�r�rurBrtr�)r[rvrr�r
r
r�_signature_from_builtin&sr�cCs�d}t|�s(t|�rd}ntdj|���|j}|j}|j}|j}t|d|��}|j	}||||�}	|j
}
|j}|j}|r�t
|�}
nd}
g}||
}x4|d|�D]$}|
j|t�}|j|||td��q�WxBt||d��D].\}}|
j|t�}|j|||t||d��q�W|jt@�rH|||}|
j|t�}|j|||td��xJ|	D]B}t}|dk	�rl|j|t�}|
j|t�}|j|||t|d���qNW|jt@�r�||}|jt@�r�|d7}||}|
j|t�}|j|||td��|||
jdt�|d	�S)
NFTz{!r} is not a Python functionr)r.ri)r.rir*rr!)r$�__validate_parameters__)rr�r�rur�r!rr
rarr�r�r�rsr�r�rNr)rCr"rr+r,rr-)r[rvZis_duck_functionr�Z	func_codeZ	pos_countZ	arg_namesrMZkeyword_only_countZkeyword_onlyr1rr2Zpos_default_countr&Znon_default_countrDr.�offsetr*rpr
r
r�_signature_from_function6sj










r�)rrc!Cs�t|�stdj|���t|tj�rDt|j|||d�}|r@t|�S|S|rtt	|dd�d�}t|tj�rtt||||d�Sy
|j
}Wntk
r�Yn&X|dk	r�t|t�s�tdj|���|Sy
|j
}Wntk
r�YnvXt|tj��rLt|j|||d�}t||d�}t|jj��d}|jtjk�r(|St|jj��}|f|}	|j|	d�St|��s`t|��rjt||�St|��r�t|||d	�St|tj��r�t|j|||d�}t||�Sd}t|t��r�t t|�d
�}
|
dk	�r�t|
|||d�}nJt |d�}|dk	�rt||||d�}n$t |d�}|dk	�r0t||||d�}|dk�r:xL|j!dd�D]:}
y
|
j"}Wntk
�rnYnX|�rJt#|||�S�qJWt|j!k�r:|j$t%j$k�r�|j&t%j&k�r�t't%�St(dj|���nrt|t)��s:t t|�d
�}
|
dk	�r:yt|
|||d�}Wn8t(k
�r8}zdj|�}t(|�|�WYdd}~XnX|dk	�rV|�rRt|�S|St|tj*��rvdj|�}t(|��t(dj|���dS)Nz{!r} is not a callable object)rrr cSs
t|d�S)N�
__signature__)r)rnr
r
rrH�sz*_signature_from_callable.<locals>.<lambda>)rlz1unexpected object {!r} in __signature__ attributer)r&)r�__call__�__new__r�rz(no signature found for builtin type {!r}zno signature found for {!r}z,no signature found for builtin function {!r}z+callable {!r} is not supported by signature)Nr~)+r�r�rur	r
rr"r�r�rxr�rOr#�_partialmethod�	functools�
partialmethodrvr�rar&r'rir�r�r9rr�r�r�r�r�rr�rkr�r�r�rr�r�rtr�r7)rhrrr r/r�r�Zfirst_wrapped_paramZ
sig_paramsr�Zcall�newZinitrFZtext_sigr0rTr
r
rr"�s�	



















r"c@seZdZdS)r�N)r�r�r�r
r
r
rr�P	sr�c@seZdZdS)r�N)r�r�r�r
r
r
rr�T	sr�c@s(eZdZdZdZdZdZdZdd�ZdS)	�_ParameterKindrrr���cCs|jS)N)�_name_)r�r
r
r�__str___	sz_ParameterKind.__str__N)	r�r�r�r�r�r�r�r�r�r
r
r
rr�X	sr�zpositional-onlyzpositional or keywordzvariadic positionalzkeyword-onlyzvariadic keywordc@s�eZdZd ZeZeZeZ	e
ZeZ
eZeed�dd�Zdd	�Zd
d�Zedd
��Zedd��Zedd��Zedd��Zeeeed�dd�Zdd�Zdd�Zdd�Zdd�ZdS)!r��_name�_kind�_default�_annotation)r*r.cCs"yt|�|_Wn$tk
r2td|�d���YnX|tk	rf|jttfkrfd}|jt|j��}t|��||_||_	|tkr�td��t
|t�s�djt|�j
�}t|��|ddko�|dd�j��r|jtkr�d	}|jt|j��}t|��t|_d
j|dd��}|j��stdj|���||_dS)Nzvalue z is not a valid Parameter.kindz({} parameters cannot have default valuesz*name is a required attribute for Parameterzname must be a str, not a {}rr}rzLimplicit arguments must be passed as positional or keyword arguments, not {}z
implicit{}z"{!r} is not a valid parameter name)r�rrtr�r+r-ru�_get_paramkind_descrrrr	r�rr�r��isdigitr)r(�isidentifierr)r�rDrir*r.rTr
r
rr��	s4


zParameter.__init__cCs t|�|j|jf|j|jd�fS)N)rr)rrrrr)r�r
r
r�
__reduce__�	s
zParameter.__reduce__cCs|d|_|d|_dS)Nrr)rr)r��stater
r
r�__setstate__�	s
zParameter.__setstate__cCs|jS)N)r)r�r
r
rrD�	szParameter.namecCs|jS)N)r)r�r
r
rr*�	szParameter.defaultcCs|jS)N)r)r�r
r
rr.�	szParameter.annotationcCs|jS)N)r)r�r
r
rri�	szParameter.kind)rDrir.r*cCsL|tkr|j}|tkr|j}|tkr*|j}|tkr8|j}t|�||||d�S)N)r*r.)r�rrrrr)r�rDrir.r*r
r
rr9�	szParameter.replacecCsj|j}|j}|jtk	r(dj|t|j��}|jtk	rDdj|t|j��}|tkrVd|}n|t	krfd|}|S)Nz{}:{}z{}={}r=z**)
rirrr�rur:rr8r+r-)r�ri�	formattedr
r
rr��	s


zParameter.__str__cCsdj|jj|�S)Nz	<{} "{}">)rur�r�)r�r
r
r�__repr__�	szParameter.__repr__cCst|j|j|j|jf�S)N)�hashrDrir.r*)r�r
r
r�__hash__�	szParameter.__hash__cCsJ||krdSt|t�stS|j|jkoH|j|jkoH|j|jkoH|j|jkS)NT)r	r��NotImplementedrrrr)r��otherr
r
r�__eq__
s
zParameter.__eq__N)rrrr)r�r�r��	__slots__r(r�r)r�r+r�r,r�r-r�r�r%r�rr	r^rDr*r.rir�r9r�rr
rr
r
r
rr�t	s((r�c@sdeZdZdZdd�Zedd��Zedd	��Zed
d��Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�BoundArgumentsr��
_signature�__weakref__cCs||_||_dS)N)r�r)r�r�r�r
r
rr�
szBoundArguments.__init__cCs|jS)N)r)r�r
r
rr�#
szBoundArguments.signaturecCs|g}xn|jjj�D]^\}}|jttfkr*Py|j|}Wntk
rNPYqX|jtkrf|j	|�q|j
|�qWt|�S)N)rr&rArir-r,r�rgr+�extendrNra)r�rr�r3r@r
r
rr'
s
zBoundArguments.argscCs�i}d}x�|jjj�D]x\}}|sF|jttfkr6d}n||jkrFd}q|sLqy|j|}Wntk
rnYqX|jtkr�|j|�q|||<qW|S)NFT)	rr&rArir-r,r�rg�update)r��kwargsZkwargs_startedr�r3r@r
r
rr>
s&

zBoundArguments.kwargscCs�|j}g}x�|jjj�D]v\}}y|j|||f�Wqtk
r�|jtk	rX|j}n"|jt	krhf}n|jt
krxi}nw|j||f�YqXqWt|�|_dS)N)r�rr&rArNrgr*r�rir+r-r)r�r�Z
new_argumentsrDr3�valr
r
r�apply_defaults\
s	


zBoundArguments.apply_defaultscCs2||krdSt|t�stS|j|jko0|j|jkS)NT)r	rrr�r�)r�rr
r
rrx
s
zBoundArguments.__eq__cCs|d|_|d|_dS)Nrr�)rr�)r�rr
r
rr	�
s
zBoundArguments.__setstate__cCs|j|jd�S)N)rr�)rr�)r�r
r
r�__getstate__�
szBoundArguments.__getstate__cCsDg}x(|jj�D]\}}|jdj||��qWdj|jjdj|��S)Nz{}={!r}z	<{} ({})>z, )r�rArNrur�r�r�)r�rr@rEr
r
rr�
szBoundArguments.__repr__N)r�rr)r�r�r�rr�r^r�rrrrr	rrr
r
r
rr
src@s�eZdZd,ZeZeZeZ	d-edd�dd�Z
edd	��Zed
d��Z
edd�d
d��Zedd��Zedd��Zeed�dd�Zdd�Zdd�Zdd�Zdd�dd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�ZdS).r#�_return_annotation�_parametersNT)r$r�cCs�|dkrt�}n�|r�t�}t}d}x�t|�D]�\}}|j}	|j}
|	|krjd}|jt|�t|	��}t|��n|	|krzd}|	}|	ttfkr�|j	t
kr�|r�d}t|��nd}|
|kr�dj|
�}t|��|||
<q,Wntdd�|D��}tj|�|_
||_dS)NFz7wrong parameter order: {} parameter before {} parameterz-non-default argument follows default argumentTzduplicate parameter name: {!r}css|]}|j|fVqdS)N)rD)rZr3r
r
rr��
sz%Signature.__init__.<locals>.<genexpr>)rr(rCrirDrurrtr)r*r�r
�MappingProxyTyperr)r�r&r$r�r�Ztop_kindZ
kind_defaults�idxr3rirDrTr
r
rr��
s>






zSignature.__init__cCstjdtdd�t||�S)Nz_inspect.Signature.from_function() is deprecated since Python 3.5, use Signature.from_callable()r�)r)rrrr�)r[rvr
r
r�
from_function�
s
zSignature.from_functioncCstjdtdd�t||�S)Nz^inspect.Signature.from_builtin() is deprecated since Python 3.5, use Signature.from_callable()r�)r)rrrr�)r[rvr
r
r�from_builtin�
s
zSignature.from_builtin)�follow_wrappedcCst|||d�S)N)r r)r")r[rhr!r
r
r�
from_callable�
szSignature.from_callablecCs|jS)N)r)r�r
r
rr&szSignature.parameterscCs|jS)N)r)r�r
r
rr$szSignature.return_annotation)r&r$cCs0|tkr|jj�}|tkr |j}t|�||d�S)N)r$)r�r&r'rr)r�r&r$r
r
rr9	s
zSignature.replacecCs8tdd�|jj�D��}dd�|jj�D�}|||jfS)Ncss|]}|jtkr|VqdS)N)rir,)rZr3r
r
rr�sz(Signature._hash_basis.<locals>.<genexpr>cSsi|]}|jtkr||j�qSr
)rir,rD)rZr3r
r
rr]sz)Signature._hash_basis.<locals>.<dictcomp>)rar&r'r$)r�r��
kwo_paramsr
r
r�_hash_basisszSignature._hash_basiscCs(|j�\}}}t|j��}t|||f�S)N)r$�	frozensetr'r)r�r�r#r$r
r
rr
!szSignature.__hash__cCs*||krdSt|t�stS|j�|j�kS)NT)r	r#rr$)r�rr
r
rr&s

zSignature.__eq__F)r�cCs�t�}t|jj��}f}t|�}�xxyt|�}Wn�tk
r�yt|�}	Wntk
rbPYn�X|	jtkrrPn�|	j|kr�|	jt	kr�d}
|
j
|	jd�}
t|
�d�|	f}PnH|	jtks�|	j
tk	r�|	f}Pn*|r�|	f}Pnd}
|
j
|	jd�}
t|
�d�Yq$Xyt|�}	Wn tk
�r&td�d�Yq$X|	jttfk�rBtd�d�|	jtk�rn|g}|j|�t|�||	j<P|	j|k�r�tdj
|	jd��d�|||	j<q$Wd}x�tj||�D]�}	|	jtk�r�|	}�q�|	jtk�r֐q�|	j}
y|j|
�}WnHtk
�r2|�r.|	jtk�r.|	j
tk�r.tdj
|
d��d�Yn(X|	jt	k�rRtdj
|	jd���|||
<�q�W|�r�|dk	�r||||j<ntdj
tt|��d���|j||�S)NzA{arg!r} parameter is positional only, but was passed as a keyword)r@z$missing a required argument: {arg!r}ztoo many positional argumentsz$multiple values for argument {arg!r}z*got an unexpected keyword argument {arg!r})rr�r&r'r��
StopIterationrir+rDr(rur�r-r*r�r,rrar��chainr�rg�_bound_arguments_cls)r�rrr�r�r&Z
parameters_exZarg_valsZarg_valr3rTr'Zkwargs_paramr�r
r
r�_bind-s�







zSignature._bindcOs|dj|dd�|�S)Nrr)r))rrr
r
r�bind�szSignature.bindcOs|dj|dd�|dd�S)NrrT)r�)r))rrr
r
rr��szSignature.bind_partialcCs t|�t|jj��fd|jifS)Nr)rrarr'r)r�r
r
rr�szSignature.__reduce__cCs|d|_dS)Nr)r)r�rr
r
rr	�szSignature.__setstate__cCsdj|jj|�S)Nz<{} {}>)rur�r�)r�r
r
rr�szSignature.__repr__c	Cs�g}d}d}xr|jj�D]d}t|�}|j}|tkr8d}n|rJ|jd�d}|tkrXd}n|tkrr|rr|jd�d}|j|�qW|r�|jd�djdj	|��}|j
tk	r�t|j
�}|dj|�7}|S)NFTr�r=z({})z, z -> {})
r&r'r�rir(rNr+r,rur�r$r�r:)	r�rfZrender_pos_only_separatorZrender_kw_only_separatorr3r
riZrenderedZannor
r
rr��s0




zSignature.__str__)rr)N)r�r�r�rr�r�rr(r�r%r�rerr r"r^r&r$r�r9r$r
rr)r*r�rr	rr�r
r
r
rr#�
s06	r#)r!cCstj||d�S)N)r!)r#r")rhr!r
r
rr��sr�cCs�ddl}ddl}|j�}|jddd�|jddddd	�|j�}|j}|jd
�\}}}y|j|�}}	WnLtk
r�}
z0dj	|t
|
�j|
�}t|t
jd�td
�WYdd}
~
XnX|r�|jd�}|	}x|D]}
t||
�}q�W|	jt
jk�rtdt
jd�td�|j�r�tdj	|��tdj	t|	���tdj	|	j��||	k�rxtdj	t|	j���t|	d��r�tdj	|	j��n6yt|�\}}Wntk
�r�YnXtdj	|��td�ntt|��dS)NrrzCThe object to be analysed. It supports the 'module:qualname' syntax)�helpz-dz	--details�
store_truez9Display info about the module rather than its source code)�actionr+r�zFailed to import {} ({}: {}))r�r�r}z#Can't get info for builtin modules.rz
Target: {}z
Origin: {}z
Cached: {}z
Loader: {}�__path__zSubmodule search path: {}zLine: {}r�)�argparser��ArgumentParser�add_argument�
parse_argsr�	partition�
import_modulerbrurr��printrq�stderr�exitr�rB�builtin_module_namesZdetailsr��
__cached__r8r�rr.r�r�)r/r��parserr�targetZmod_nameZ	has_attrsZattrsrhr�rgrT�parts�part�__ror
r
r�_main�sV



r?r�)rri)N)N)N)F)N)r)r6)r)r)r)r)T)T)��
__author__r.r�Zdis�collections.abcr-�enum�importlib.machineryr�r�r�r�r�rqr�r�r
rr�r��operatorrrr�globalsZmod_dictZCOMPILER_FLAG_NAMESrArVrWr=rrrrrrrrrr#r$r%r'r)r+r0r2r4r6r8r9rGrXrYrjrJrxr|r�r�r�r�r�r�r�r�r�r�r�r�r�rbr�r�r�r�r�r�rrrrrrrrr4r7r:r<r�rIrLrSrUrYrZrirjrqrr�_fieldsrsrwrzr|r}rrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�Z_WrapperDescriptor�allZ_MethodWrapperr�r@Z_ClassMethodWrapperr7r�r�r�r�r�r�r�r�r�r�r�r"r�r��IntEnumr�r�r(r�r)r�r+r�r,r�r-Z_PARAM_NAME_MAPPING�__getitem__rr�rr#r�r?r�r
r
r
r�<module>sd	



	
	
,
t$
;
	
.I-7





[


	(>
5

 



		0

LHRHk:
stringprep.cpython-36.opt-1.pyc000064400000023366150335715140012344 0ustar003


 \u2��@s�dZddlmZdd�Zeddddd	d
ddd
ddgeedd���Zdd�Zddddddddddddd d!d"d#d$d%d&d'dd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCd<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdDdEdFdGdHdIdJdKdLdMdNdOdPdMddQdRdSdTdUdRdVddWdXdYddZd[d\d]d^d_d`dad^dbdcdddedfdgdgdgdhdhdidjdkdldmdndndndodpdqdrdrdsdcdtdudvdwd%dxdydzd{d|d}d~dd�d�d�d�d�d�d�d�d�d�d�d�d|d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dcdxd�d�d�djd�dldmdd�d�d�d�d�d�drd�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dsdxdtdud�d�d�didvdjd�dldmdd�d�d�d�d�d�d�dsdxdtdud�dhd�d�didvd�dd�d�d�d�d�d�d�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�ddwd�d(d�d�d dd&d�dd�d�d�d%d'd dd�d!d$d�d�d�dd�ddwd�d(d�d�d dd&d�dd�d�d�d%d'd dd�d!d$d�d�d�dd�ddwd�d(d�d�d dd&d�dd�d�d�d%d'd dd�d!d$d�d�d�dd�ddwd�d(d�d�d dd&d�dd�d�d�d%d'd dd�d!d$d�d�d�dd�ddwd�d(d�d�d dd&d�dd�d�d�d%d'd dd�d!d$d�d�d�ddʐ��Z	d�d̄Z
d�d΄Zd�dЄZd�d҄Z
d�dԄZd�dքZed�d�d�dd
d�d�dgeedd܃�eed�dރ�eed�d��eed�d���Zd�d�Zd�d�Zd�d�Zd�d�Zd�d�Zeed�d��Zd�d�Zeed�d��Zd�d�Zed�d�d�d�geed�d���eed�dރ��Zd�d��Zed�geed�d����Zd��d�Z�d�d�Z�d�d�Z�dS(z�Library that exposes various tables found in the StringPrep RFC 3454.

There are two kinds of tables: sets, for which a member test is provided,
and mappings, for which a mapping function is provided.
�)�	ucd_3_2_0cCsBtj|�dkrdSt|�}d|ko,dknr6dS|d@dkS)NZCnFi�i���)rr)�unicodedata�category�ord)�code�c�r
�"/usr/lib64/python3.6/stringprep.py�in_table_a1sr�iOiiii
i i i
 i` i��i�i�cCst|�tkS)N)r�b1_set)rr
r
r�in_table_b1sruμZssui̇uʼn�suǰuιu ιuΐuΰuσuβuθuυuύuϋuφuπuκuρuεuեւuẖuẗuẘuẙuaʾuṡuὐuὒuὔuὖuἀιuἁιuἂιuἃιuἄιuἅιuἆιuἇιuἠιuἡιuἢιuἣιuἤιuἥιuἦιuἧιuὠιuὡιuὢιuὣιuὤιuὥιuὦιuὧιuὰιuαιuάιuᾶuᾶιuὴιuηιuήιuῆuῆιuῒuῖuῗuῢuῤuῦuῧuὼιuωιuώιuῶuῶιZrsr	u°cuɛu°f�h�i�l�n�no�p�q�rZsmZtelZtm�z�b�e�f�muγ�dZhpaZauZovZpaZnauμaZmaZkaZkbZmbZgbZpfZnfuμf�hzZkhzZmhzZghzZthzZkpaZmpaZgpaZpvZnvuμvZmvZkvZpwZnwuμwZmw�kwukωumωZbquc∕kgzco.ZdbZgyZhpZkkZkmZphZppmZprZsv�wbZffZfiZflZffiZffl�stuմնuմեuմիuվնuմխ�a�g�j�k�o�t�u�v�w�x�yuαuδuζuηuλuνuξuοuτuχuψuω(����i0iIii�iEizi�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�iPiRiTiVi�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i� i!i!i!i	!i!i!i
!i!i!i!i!i!i!i!i!i!i!i !i!!i"!i$!i(!i,!i-!i0!i1!i3!i>!i?!iE!iq3is3iu3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i	�i
�i�i�i
�i�i�i�i�i�i�i�i�i�i�i�i�i4�i5�i6�i7�i8�i9�i:�i;�i<�i=�i>�i?�i@�iA�iB�iC�iD�iE�iF�iG�iH�iI�iJ�iK�iL�iM�ih�ii�ij�ik�il�im�in�io�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i�i�i�i�i	�i
�i
�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i8�i9�i;�i<�i=�i>�i@�iA�iB�iC�iD�iF�iJ�iK�iL�iM�iN�iO�iP�il�im�in�io�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i�i	�i
�i�i�i
�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i �i!�i<�i=�i>�i?�i@�iA�iB�iC�iD�iE�iF�iG�iH�iI�iJ�iK�iL�iM�iN�iO�iP�iQ�iR�iS�iT�iU�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i
�i�i�i�i�i �i!�i"�i#�i$�i%�i&�i'�i(�i)�i*�i+�i,�i-�i.�i/�i0�i1�i2�i3�i4�iG�iV�iW�iX�iY�iZ�i[�i\�i]�i^�i_�i`�ia�ib�ic�id�ie�if�ig�ih�ii�ij�ik�il�im�in�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��cCs"tjt|��}|dk	r|S|j�S)N)�
b3_exceptions�getr�lower)rrr
r
r�map_table_b3�sr3cCsHt|�}tjd|�}djdd�|D��}tjd|�}||kr@|S|SdS)NZNFKC�cSsg|]}t|��qSr
)r3)�.0Zchr
r
r�
<listcomp>�sz map_table_b2.<locals>.<listcomp>)r3rZ	normalize�join)r#ZalrZblr	r
r
r�map_table_b2�sr8cCs|dkS)N� r
)rr
r
r�in_table_c11�sr:cCstj|�dko|dkS)N�Zsr9)rr)rr
r
r�in_table_c12�sr<cCstj|�dkS)Nr;)rr)rr
r
r�in_table_c11_c12�sr=cCst|�dkotj|�dkS)N��Cc)rrr)rr
r
r�in_table_c21�sr@i�iii( i) id ij ip i��i��is�i{�cCs.t|�}|dkrdStj|�dkr&dS|tkS)Nr>Fr?T)rrr�c22_specials)rr	r
r
r�in_table_c22�srBcCstj|�dkpt|�tkS)Nr?)rrrrA)rr
r
r�in_table_c21_c22�srCcCstj|�dkS)NZCo)rr)rr
r
r�in_table_c3�srDcCs0t|�}|dkrdS|dkr dSt|�d@dkS)Ni�Fi�T��)rFrE)r)rr	r
r
r�in_table_c4�srGcCstj|�dkS)NZCs)rr)rr
r
r�in_table_c5�srHi��cCst|�tkS)N)r�c6_set)rr
r
r�in_table_c6�srJi�/i�/cCst|�tkS)N)r�c7_set)rr
r
r�in_table_c7�srLi@iAi i i* i/ cCst|�tkS)N)r�c8_set)rr
r
r�in_table_c8srNii i�cCst|�tkS)N)r�c9_set)rr
r
r�in_table_c9srPcCstj|�dkS)N�R�AL)rQrR)r�
bidirectional)rr
r
r�in_table_d1srTcCstj|�dkS)N�L)rrS)rr
r
r�in_table_d2srVN) �__doc__rrr�set�list�rangerrr0r3r8r:r<r=r@rArBrCrDrGrHrIrJrKrLrMrNrOrPrTrVr
r
r
r�<module>sz,P,
queue.cpython-36.pyc000064400000021065150335715140010326 0ustar003


 \L"�
@s�dZyddlZWnek
r,ddlZYnXddlmZddlmZmZddl	m
Z	dddd	d
gZGdd�de�Z
Gdd�de�ZGd
d�d�ZGdd	�d	e�ZGdd
�d
e�ZdS)z'A multi-producer, multi-consumer queue.�N)�deque)�heappush�heappop)�	monotonic�Empty�Full�Queue�
PriorityQueue�	LifoQueuec@seZdZdZdS)rz4Exception raised by Queue.get(block=0)/get_nowait().N)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.6/queue.pyr
sc@seZdZdZdS)rz4Exception raised by Queue.put(block=0)/put_nowait().N)rrr
rrrrrrsc@s�eZdZdZd!dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	d"dd�Z
d#dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �ZdS)$rzjCreate a queue object with a given maximum size.

    If maxsize is <= 0, the queue size is infinite.
    rcCsN||_|j|�tj�|_tj|j�|_tj|j�|_tj|j�|_d|_	dS)Nr)
�maxsize�_init�	threadingZLock�mutexZ	Condition�	not_empty�not_full�all_tasks_done�unfinished_tasks)�selfrrrr�__init__s

zQueue.__init__c	CsH|j�8|jd}|dkr4|dkr*td��|jj�||_WdQRXdS)a.Indicate that a formerly enqueued task is complete.

        Used by Queue consumer threads.  For each get() used to fetch a task,
        a subsequent call to task_done() tells the queue that the processing
        on the task is complete.

        If a join() is currently blocking, it will resume when all items
        have been processed (meaning that a task_done() call was received
        for every item that had been put() into the queue).

        Raises a ValueError if called more times than there were items
        placed in the queue.
        �rz!task_done() called too many timesN)rr�
ValueErrorZ
notify_all)rZ
unfinishedrrr�	task_done2s

zQueue.task_donec	Cs,|j�x|jr|jj�q
WWdQRXdS)a�Blocks until all items in the Queue have been gotten and processed.

        The count of unfinished tasks goes up whenever an item is added to the
        queue. The count goes down whenever a consumer thread calls task_done()
        to indicate the item was retrieved and all work on it is complete.

        When the count of unfinished tasks drops to zero, join() unblocks.
        N)rr�wait)rrrr�joinHs	z
Queue.joinc	Cs|j�
|j�SQRXdS)z9Return the approximate size of the queue (not reliable!).N)r�_qsize)rrrr�qsizeUszQueue.qsizec	Cs|j�|j�SQRXdS)a�Return True if the queue is empty, False otherwise (not reliable!).

        This method is likely to be removed at some point.  Use qsize() == 0
        as a direct substitute, but be aware that either approach risks a race
        condition where a queue can grow before the result of empty() or
        qsize() can be used.

        To create code that needs to wait for all queued tasks to be
        completed, the preferred technique is to use the join() method.
        N)rr )rrrr�emptyZszQueue.emptyc
Cs0|j� d|jko |j�kSSQRXdS)aOReturn True if the queue is full, False otherwise (not reliable!).

        This method is likely to be removed at some point.  Use qsize() >= n
        as a direct substitute, but be aware that either approach risks a race
        condition where a queue can shrink before the result of full() or
        qsize() can be used.
        rN)rrr )rrrr�fullhsz
Queue.fullTNc
Cs�|j��|jdkr�|s*|j�|jkr�t�nz|dkrRxp|j�|jkrN|jj�q4WnR|dkrdtd��n@t�|}x4|j�|jkr�|t�}|dkr�t�|jj|�qpW|j|�|jd7_|j	j
�WdQRXdS)aPut an item into the queue.

        If optional args 'block' is true and 'timeout' is None (the default),
        block if necessary until a free slot is available. If 'timeout' is
        a non-negative number, it blocks at most 'timeout' seconds and raises
        the Full exception if no free slot was available within that time.
        Otherwise ('block' is false), put an item on the queue if a free slot
        is immediately available, else raise the Full exception ('timeout'
        is ignored in that case).
        rNz''timeout' must be a non-negative numbergr)rrr rrr�time�_putrr�notify)r�item�block�timeout�endtime�	remainingrrr�putss&




z	Queue.putc	Cs�|j��|s|j�s�t�nn|dkr<xd|j�s8|jj�q$WnL|dkrNtd��n:t�|}x.|j�s�|t�}|dkrxt�|jj|�qZW|j�}|jj�|SQRXdS)aRemove and return an item from the queue.

        If optional args 'block' is true and 'timeout' is None (the default),
        block if necessary until an item is available. If 'timeout' is
        a non-negative number, it blocks at most 'timeout' seconds and raises
        the Empty exception if no item was available within that time.
        Otherwise ('block' is false), return an item if one is immediately
        available, else raise the Empty exception ('timeout' is ignored
        in that case).
        Nrz''timeout' must be a non-negative numberg)	rr rrrr$�_getrr&)rr(r)r*r+r'rrr�get�s$





z	Queue.getcCs|j|dd�S)z�Put an item into the queue without blocking.

        Only enqueue the item if a free slot is immediately available.
        Otherwise raise the Full exception.
        F)r()r,)rr'rrr�
put_nowait�szQueue.put_nowaitcCs|jdd�S)z�Remove and return an item from the queue without blocking.

        Only get an item if one is immediately available. Otherwise
        raise the Empty exception.
        F)r()r.)rrrr�
get_nowait�szQueue.get_nowaitcCst�|_dS)N)r�queue)rrrrrr�szQueue._initcCs
t|j�S)N)�lenr1)rrrrr �szQueue._qsizecCs|jj|�dS)N)r1�append)rr'rrrr%�sz
Queue._putcCs
|jj�S)N)r1�popleft)rrrrr-�sz
Queue._get)r)TN)TN)rrr
rrrrr!r"r#r,r.r/r0rr r%r-rrrrrs


 

c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r	z�Variant of Queue that retrieves open entries in priority order (lowest first).

    Entries are typically tuples of the form:  (priority number, data).
    cCs
g|_dS)N)r1)rrrrrr�szPriorityQueue._initcCs
t|j�S)N)r2r1)rrrrr �szPriorityQueue._qsizecCst|j|�dS)N)rr1)rr'rrrr%�szPriorityQueue._putcCs
t|j�S)N)rr1)rrrrr-�szPriorityQueue._getN)rrr
rrr r%r-rrrrr	�s
c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r
zBVariant of Queue that retrieves most recently added entries first.cCs
g|_dS)N)r1)rrrrrr�szLifoQueue._initcCs
t|j�S)N)r2r1)rrrrr �szLifoQueue._qsizecCs|jj|�dS)N)r1r3)rr'rrrr%�szLifoQueue._putcCs
|jj�S)N)r1�pop)rrrrr-�szLifoQueue._getN)rrr
rrr r%r-rrrrr
�s
)rr�ImportErrorZdummy_threading�collectionsr�heapqrrr$r�__all__�	Exceptionrrrr	r
rrrr�<module>sBsched.cpython-36.opt-2.pyc000064400000006706150335715140011235 0ustar003


 \o�@s�ddlZddlZddlmZyddlZWnek
rDddlZYnXddlmZdgZ	Gdd�dedd��Z
de
j_d	e
j_d
e
j
_de
j_de
j_e�ZGd
d�d�ZdS)�N)�
namedtuple)�	monotonic�	schedulerc@s8eZdZgZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�EventcCs|j|jf|j|jfkS)N)�time�priority)�s�o�r
�/usr/lib64/python3.6/sched.py�__eq__'szEvent.__eq__cCs|j|jf|j|jfkS)N)rr)rr	r
r
r�__lt__(szEvent.__lt__cCs|j|jf|j|jfkS)N)rr)rr	r
r
r�__le__)szEvent.__le__cCs|j|jf|j|jfkS)N)rr)rr	r
r
r�__gt__*szEvent.__gt__cCs|j|jf|j|jfkS)N)rr)rr	r
r
r�__ge__+szEvent.__ge__N)	�__name__�
__module__�__qualname__�	__slots__rr
rrrr
r
r
rr%srz(time, priority, action, argument, kwargszaNumeric type compatible with the return value of the
timefunc function passed to the constructor.zSEvents scheduled for the same time will be executed
in the order of their priority.z?Executing the event means executing
action(*argument, **kwargs)zGargument is a sequence holding the positional
arguments for the action.zDkwargs is a dictionary holding the keyword
arguments for the action.c@s^eZdZeejfdd�Zfefdd�Zfefdd�Z	dd�Z
d	d
�Zddd
�Ze
dd��ZdS)rcCs g|_tj�|_||_||_dS)N)�_queue�	threading�RLock�_lock�timefunc�	delayfunc)�selfrrr
r
r�__init__<s
zscheduler.__init__c
Cs@|tkri}t|||||�}|j�tj|j|�WdQRX|S)N)�	_sentinelrr�heapq�heappushr)rrr�action�argument�kwargs�eventr
r
r�enterabsDszscheduler.enterabscCs|j�|}|j|||||�S)N)rr$)r�delayrr r!r"rr
r
r�enterRszscheduler.enterc	Cs.|j�|jj|�tj|j�WdQRXdS)N)rr�remover�heapify)rr#r
r
r�cancel[szscheduler.cancelc	Cs|j�
|jSQRXdS)N)rr)rr
r
r�emptyfszscheduler.emptyTcCs�|j}|j}|j}|j}tj}x||�>|s,P|d\}}}	}
}|�}||krRd}
nd}
||�WdQRX|
r�|sx||S|||�q |	|
|�|d�q WdS)NrTF)rrrrr�heappop)rZblocking�lock�qrr�poprrr r!r"Znowr%r
r
r�runks*
z
scheduler.runc
Cs:|j�|jdd�}WdQRXtttj|gt|���S)N)rr�list�maprr+�len)rZeventsr
r
r�queue�szscheduler.queueN)T)rrr�_timerZsleeprrr$r&r)r*r/�propertyr3r
r
r
rr:s	
2)rr�collectionsrr�ImportErrorZdummy_threadingrr4�__all__r�__doc__rr r!r"�objectrrr
r
r
r�<module>s 	_sysconfigdata_dm_linux_x86_64-linux-gnu.cpython-36.opt-2.pyc000064400000056413150335715140020005 0ustar003

�\dh�u��@sdddddddddddd	d
dddd
dddddddddddddddddddddddd dd!d"d#d$d%dddd&d'd
d(d)d*d&d+dd!dddd,d-ddddddd.d&d&d&d&dd&dd&d&d&d&d&dddddddddd&dd&d&d&d&d&d&d&d&dd&d&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&ddd&d&dd&dddd&d&d&ddd&d&dddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&d&d&d&d&d&ddd&d&dd&d&ddd&d&d&d&d&d&d&dddddd&dd&d&ddddddd&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd/ddd0d1d0d0d2d3d4d
d5d6dd7dd
d8ddd9dd:d;dd<d=d>d
d
d?d@dAdBdd+ddCdDdddEddddddd&dFdGdHddIdJd
dKdLd&dMd
dNdddddddd
dOdPdQd
dRdSdd
ddTd&dddddUddddVdWd
d
ddXd&dYdZdd[d6d\d]dd&d&d&dd^d_d`dadbd9dddcd?dddddedfdgdfdedgdededfded]dededededfd&dhdidjd&dkdlddmd:d&d&dddddnddodpdqdd&dd
ddrd&d&dsdtdd&d&d&dddd&d&d&ddudvdtdwdxdxdtdy���ZdzS){Zdm��ar�rcsz!-Wno-unused-result -Wsign-comparez-IObjects -IInclude -IPython�z/usr/binz/usr/lib64/python3.6z-L. -lpython3.6dmzOgcc -pthread -shared -Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g�pythonzx86_64-redhat-linux-gnu�\zgcc -pthreadz-fPICav-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz?configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.ina-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapva=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-typez-Wl,-z,relro  -Wl,-z,now  -gz�-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -ga�'--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-ipv6' '--enable-shared' '--with-computed-gotos=yes' '--with-dbmliborder=gdbm:ndbm:bdb' '--with-system-expat' '--with-system-ffi' '--enable-loadable-sqlite-extensions' '--with-dtrace' '--with-lto' '--with-ssl-default-suites=openssl' '--with-valgrind' '--without-ensurepip' '--with-pydebug' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS= -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv ' 'LDFLAGS= -Wl,-z,relro  -Wl,-z,now  -g ' 'CPPFLAGS=' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'z/usr/includez/usr/include/python3.6dm�:z</builddir/build/BUILD/Python-3.6.8/build/debug/coverage.infoz:/builddir/build/BUILD/Python-3.6.8/build/debug/lcov-reportz2--no-branch-coverage --title "CPython lcov report"zM-IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.6.8/Includezg++ -pthreadzE/usr /usr/lib64 /usr/lib64/python3.6 /usr/lib64/python3.6/lib-dynloadz /usr/lib64/python3.6/lib-dynloadi�zkREADME ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Ext-dummyzInclude Lib Misc Ext-dummyzPREADME ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in�.�z/usr/bin/dtracezInclude/pydtrace_probes.hzPython/pydtrace.ozdynload_shlib.o�noz!.cpython-36dm-x86_64-linux-gnu.soi��yeszK/usr/include /usr/include /usr/include/python3.6dm /usr/include/python3.6dmz/usr/bin/install -cz/usr/bin/install -c -m 644z/usr/bin/install -c -m 555zlibpython3.6dm.so.1.0zModules/_io/_iomodule.hzg++ -pthread -sharedz:-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -gzlibpython3.6dm.soz3.6dmz
/usr/lib64z-lmzPython/z/usr/lib64/pkgconfigz2/usr/lib64/python3.6/config-3.6dm-x86_64-linux-gnuzlibpython3.6dm.az-lpthread -ldl  -lutilz0tkinter tkinter/test tkinter/test/test_tkinter \�gccz-Xlinker -export-dynamic�true�ln�linuxz4/builddir/build/BUILD/Python-3.6.8/Modules/makesetupz/usr/share/manz/usr/bin/mkdir -pz�_thread posix errno pwd _sre _codecs _weakref _functools _operator _collections itertools atexit _signal _stat time _locale _io zipimport faulthandler _tracemalloc _symtable xxsubtypea{Modules/_threadmodule.o  Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/zipimport.o  Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  Modules/symtablemodule.o  Modules/xxsubtype.ozx86_64-linux-gnuz -DMULTIARCH=\"x86_64-linux-gnu\"z-Wl,--no-as-neededa1-DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz:\ Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.ozParser/pgenz\ \z-fprofile-generatez"-fprofile-use -fprofile-correctionz
-m test --pgozno-frameworkz./python -Ez	python3.6a�-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Oga�-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Og -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.6.8/Include -fPIC -DPy_BUILD_COREaT-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g -lcryptoz"z"a-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g�z)-x test_subprocess test_io test_lib2to3 \�readelfzMac/Resources/framework�voidz>LD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/debugz/bin/shz.so���zcpython-36dm-x86_64-linux-gnuz&Parser Objects Python Modules Programsz9/builddir/build/BUILD/Python-3.6.8/Tools/gdb/libpython.pyz"/* Don't use ncurses extensions */z-szInclude Lib MisczGLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/debug ./pythonz�LD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/debug ./python /builddir/build/BUILD/Python-3.6.8/Tools/scripts/run_tests.pyi�zPython/thread.ozIpython3.6 /builddir/build/BUILD/Python-3.6.8/Tools/scripts/update_file.pyz3.6z"/builddir/build/BUILD/Python-3.6.8z)xml xml/dom xml/etree xml/parsers xml/saxz./builddir/build/BUILD/Python-3.6.8/build/debugz
/usr/sharez/usr(��ABIFLAGS�AC_APPLE_UNIVERSAL_BUILD�AIX_GENUINE_CPLUSPLUS�ANDROID_API_LEVEL�AR�ARFLAGS�
BASECFLAGS�BASECPPFLAGS�BASEMODLIBS�BINDIR�
BINLIBDEST�
BLDLIBRARY�	BLDSHARED�BUILDEXE�BUILDPYTHON�BUILD_GNU_TYPE�BYTESTR_DEPS�CC�CCSHARED�CFLAGS�CFLAGSFORSHARED�CFLAGS_ALIASING�CONFIGFILES�CONFIGURE_CFLAGS�CONFIGURE_CFLAGS_NODIST�CONFIGURE_CPPFLAGS�CONFIGURE_LDFLAGS�CONFIGURE_LDFLAGS_NODIST�CONFIG_ARGS�CONFINCLUDEDIR�
CONFINCLUDEPY�COREPYTHONPATH�
COVERAGE_INFO�COVERAGE_REPORT�COVERAGE_REPORT_OPTIONS�CPPFLAGS�CXX�DESTDIRS�DESTLIB�DESTPATH�
DESTSHARED�DFLAGS�DIRMODE�DIST�DISTDIRS�	DISTFILES�	DLINCLDIR�
DLLLIBRARY�"DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754�DOUBLE_IS_BIG_ENDIAN_IEEE754�DOUBLE_IS_LITTLE_ENDIAN_IEEE754�DTRACE�DTRACE_DEPS�DTRACE_HEADERS�DTRACE_OBJS�DYNLOADFILE�ENABLE_IPV6�	ENSUREPIP�EXE�EXEMODE�EXTRAMACHDEPPATH�
EXTRATESTOPTS�EXTRA_CFLAGS�
EXT_SUFFIX�FILEMODE�FLOCK_NEEDS_LIBBSD�GETPGRP_HAVE_ARG�GETTIMEOFDAY_NO_TZ�	GITBRANCH�GITTAG�
GITVERSION�GNULD�HAVE_ACCEPT4�
HAVE_ACOSH�
HAVE_ADDRINFO�
HAVE_ALARM�HAVE_ALIGNED_REQUIRED�
HAVE_ALLOCA_H�HAVE_ALTZONE�
HAVE_ASINH�HAVE_ASM_TYPES_H�
HAVE_ATANH�HAVE_BIND_TEXTDOMAIN_CODESET�HAVE_BLUETOOTH_BLUETOOTH_H�HAVE_BLUETOOTH_H�HAVE_BROKEN_MBSTOWCS�HAVE_BROKEN_NICE�HAVE_BROKEN_PIPE_BUF�HAVE_BROKEN_POLL�HAVE_BROKEN_POSIX_SEMAPHORES�HAVE_BROKEN_PTHREAD_SIGMASK�HAVE_BROKEN_SEM_GETVALUE�HAVE_BROKEN_UNSETENV�HAVE_BUILTIN_ATOMIC�HAVE_CHFLAGS�
HAVE_CHOWN�HAVE_CHROOT�
HAVE_CLOCK�HAVE_CLOCK_GETRES�HAVE_CLOCK_GETTIME�HAVE_CLOCK_SETTIME�HAVE_COMPUTED_GOTOS�HAVE_CONFSTR�HAVE_CONIO_H�
HAVE_COPYSIGN�HAVE_CRYPT_H�HAVE_CTERMID�HAVE_CTERMID_R�HAVE_CURSES_FILTER�
HAVE_CURSES_H�HAVE_CURSES_HAS_KEY�HAVE_CURSES_IMMEDOK�HAVE_CURSES_IS_PAD�HAVE_CURSES_IS_TERM_RESIZED�HAVE_CURSES_RESIZETERM�HAVE_CURSES_RESIZE_TERM�HAVE_CURSES_SYNCOK�HAVE_CURSES_TYPEAHEAD�HAVE_CURSES_USE_ENV�HAVE_CURSES_WCHGAT�HAVE_DECL_ISFINITE�HAVE_DECL_ISINF�HAVE_DECL_ISNAN�HAVE_DECL_RTLD_DEEPBIND�HAVE_DECL_RTLD_GLOBAL�HAVE_DECL_RTLD_LAZY�HAVE_DECL_RTLD_LOCAL�HAVE_DECL_RTLD_NODELETE�HAVE_DECL_RTLD_NOLOAD�HAVE_DECL_RTLD_NOW�HAVE_DECL_TZNAME�HAVE_DEVICE_MACROS�HAVE_DEV_PTC�
HAVE_DEV_PTMX�
HAVE_DIRECT_H�HAVE_DIRENT_D_TYPE�
HAVE_DIRENT_H�
HAVE_DIRFD�HAVE_DLFCN_H�HAVE_DLOPEN�	HAVE_DUP2�	HAVE_DUP3�HAVE_DYNAMIC_LOADING�
HAVE_ENDIAN_H�
HAVE_EPOLL�HAVE_EPOLL_CREATE1�HAVE_ERF�	HAVE_ERFC�HAVE_ERRNO_H�
HAVE_EXECV�
HAVE_EXPM1�HAVE_FACCESSAT�HAVE_FCHDIR�HAVE_FCHMOD�
HAVE_FCHMODAT�HAVE_FCHOWN�
HAVE_FCHOWNAT�HAVE_FCNTL_H�HAVE_FDATASYNC�HAVE_FDOPENDIR�HAVE_FEXECVE�HAVE_FINITE�
HAVE_FLOCK�	HAVE_FORK�HAVE_FORKPTY�HAVE_FPATHCONF�HAVE_FSEEK64�HAVE_FSEEKO�HAVE_FSTATAT�
HAVE_FSTATVFS�
HAVE_FSYNC�HAVE_FTELL64�HAVE_FTELLO�
HAVE_FTIME�HAVE_FTRUNCATE�
HAVE_FUTIMENS�HAVE_FUTIMES�HAVE_FUTIMESAT�HAVE_GAI_STRERROR�
HAVE_GAMMA�HAVE_GCC_ASM_FOR_MC68881�HAVE_GCC_ASM_FOR_X64�HAVE_GCC_ASM_FOR_X87�HAVE_GCC_UINT128_T�HAVE_GETADDRINFO�HAVE_GETC_UNLOCKED�HAVE_GETENTROPY�HAVE_GETGROUPLIST�HAVE_GETGROUPS�HAVE_GETHOSTBYNAME�HAVE_GETHOSTBYNAME_R�HAVE_GETHOSTBYNAME_R_3_ARG�HAVE_GETHOSTBYNAME_R_5_ARG�HAVE_GETHOSTBYNAME_R_6_ARG�HAVE_GETITIMER�HAVE_GETLOADAVG�
HAVE_GETLOGIN�HAVE_GETNAMEINFO�HAVE_GETPAGESIZE�HAVE_GETPEERNAME�HAVE_GETPGID�HAVE_GETPGRP�HAVE_GETPID�HAVE_GETPRIORITY�
HAVE_GETPWENT�HAVE_GETRANDOM�HAVE_GETRANDOM_SYSCALL�HAVE_GETRESGID�HAVE_GETRESUID�HAVE_GETSID�
HAVE_GETSPENT�
HAVE_GETSPNAM�HAVE_GETTIMEOFDAY�
HAVE_GETWD�HAVE_GLIBC_MEMMOVE_BUG�
HAVE_GRP_H�HAVE_HSTRERROR�HAVE_HTOLE64�
HAVE_HYPOT�
HAVE_IEEEFP_H�HAVE_IF_NAMEINDEX�HAVE_INET_ATON�HAVE_INET_PTON�HAVE_INITGROUPS�HAVE_INTTYPES_H�	HAVE_IO_H�HAVE_IPA_PURE_CONST_BUG�	HAVE_KILL�HAVE_KILLPG�HAVE_KQUEUE�HAVE_LANGINFO_H�HAVE_LARGEFILE_SUPPORT�
HAVE_LCHFLAGS�HAVE_LCHMOD�HAVE_LCHOWN�HAVE_LGAMMA�
HAVE_LIBDL�HAVE_LIBDLD�HAVE_LIBIEEE�HAVE_LIBINTL_H�HAVE_LIBREADLINE�HAVE_LIBRESOLV�HAVE_LIBSENDFILE�HAVE_LIBUTIL_H�	HAVE_LINK�HAVE_LINKAT�HAVE_LINUX_CAN_BCM_H�HAVE_LINUX_CAN_H�HAVE_LINUX_CAN_RAW_FD_FRAMES�HAVE_LINUX_CAN_RAW_H�HAVE_LINUX_NETLINK_H�HAVE_LINUX_RANDOM_H�HAVE_LINUX_TIPC_H�
HAVE_LOCKF�
HAVE_LOG1P�	HAVE_LOG2�HAVE_LONG_DOUBLE�
HAVE_LSTAT�HAVE_LUTIMES�HAVE_MAKEDEV�HAVE_MBRTOWC�HAVE_MEMMOVE�
HAVE_MEMORY_H�HAVE_MEMRCHR�HAVE_MKDIRAT�HAVE_MKFIFO�
HAVE_MKFIFOAT�
HAVE_MKNOD�HAVE_MKNODAT�HAVE_MKTIME�	HAVE_MMAP�HAVE_MREMAP�HAVE_NCURSES_H�HAVE_NDIR_H�HAVE_NETPACKET_PACKET_H�
HAVE_NET_IF_H�	HAVE_NICE�HAVE_OPENAT�HAVE_OPENPTY�
HAVE_PATHCONF�
HAVE_PAUSE�
HAVE_PIPE2�
HAVE_PLOCK�	HAVE_POLL�HAVE_POLL_H�HAVE_POSIX_FADVISE�HAVE_POSIX_FALLOCATE�
HAVE_PREAD�HAVE_PRLIMIT�HAVE_PROCESS_H�HAVE_PROTOTYPES�HAVE_PTHREAD_ATFORK�HAVE_PTHREAD_CONDATTR_SETCLOCK�HAVE_PTHREAD_DESTRUCTOR�HAVE_PTHREAD_H�HAVE_PTHREAD_INIT�HAVE_PTHREAD_KILL�HAVE_PTHREAD_SIGMASK�
HAVE_PTY_H�HAVE_PUTENV�HAVE_PWRITE�
HAVE_READLINK�HAVE_READLINKAT�
HAVE_READV�
HAVE_REALPATH�
HAVE_RENAMEAT�HAVE_RL_APPEND_HISTORY�HAVE_RL_CALLBACK�HAVE_RL_CATCH_SIGNAL�#HAVE_RL_COMPLETION_APPEND_CHARACTER�'HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK�HAVE_RL_COMPLETION_MATCHES�"HAVE_RL_COMPLETION_SUPPRESS_APPEND�HAVE_RL_PRE_INPUT_HOOK�HAVE_RL_RESIZE_TERMINAL�
HAVE_ROUND�HAVE_SCHED_GET_PRIORITY_MAX�HAVE_SCHED_H�HAVE_SCHED_RR_GET_INTERVAL�HAVE_SCHED_SETAFFINITY�HAVE_SCHED_SETPARAM�HAVE_SCHED_SETSCHEDULER�HAVE_SELECT�HAVE_SEM_GETVALUE�
HAVE_SEM_OPEN�HAVE_SEM_TIMEDWAIT�HAVE_SEM_UNLINK�
HAVE_SENDFILE�HAVE_SETEGID�HAVE_SETEUID�HAVE_SETGID�HAVE_SETGROUPS�HAVE_SETHOSTNAME�HAVE_SETITIMER�HAVE_SETLOCALE�HAVE_SETPGID�HAVE_SETPGRP�HAVE_SETPRIORITY�
HAVE_SETREGID�HAVE_SETRESGID�HAVE_SETRESUID�
HAVE_SETREUID�HAVE_SETSID�HAVE_SETUID�HAVE_SETVBUF�
HAVE_SHADOW_H�HAVE_SIGACTION�HAVE_SIGALTSTACK�HAVE_SIGINTERRUPT�
HAVE_SIGNAL_H�HAVE_SIGPENDING�
HAVE_SIGRELSE�HAVE_SIGTIMEDWAIT�HAVE_SIGWAIT�HAVE_SIGWAITINFO�
HAVE_SNPRINTF�HAVE_SOCKADDR_ALG�HAVE_SOCKADDR_SA_LEN�HAVE_SOCKADDR_STORAGE�HAVE_SOCKETPAIR�HAVE_SPAWN_H�HAVE_SSIZE_T�HAVE_STATVFS�HAVE_STAT_TV_NSEC�HAVE_STAT_TV_NSEC2�HAVE_STDARG_PROTOTYPES�
HAVE_STDINT_H�
HAVE_STDLIB_H�HAVE_STD_ATOMIC�HAVE_STRDUP�
HAVE_STRFTIME�HAVE_STRINGS_H�
HAVE_STRING_H�HAVE_STRLCPY�HAVE_STROPTS_H�HAVE_STRUCT_PASSWD_PW_GECOS�HAVE_STRUCT_PASSWD_PW_PASSWD�HAVE_STRUCT_STAT_ST_BIRTHTIME�HAVE_STRUCT_STAT_ST_BLKSIZE�HAVE_STRUCT_STAT_ST_BLOCKS�HAVE_STRUCT_STAT_ST_FLAGS�HAVE_STRUCT_STAT_ST_GEN�HAVE_STRUCT_STAT_ST_RDEV�HAVE_STRUCT_TM_TM_ZONE�HAVE_SYMLINK�HAVE_SYMLINKAT�	HAVE_SYNC�HAVE_SYSCONF�HAVE_SYSEXITS_H�HAVE_SYS_AUDIOIO_H�HAVE_SYS_BSDTTY_H�HAVE_SYS_DEVPOLL_H�HAVE_SYS_DIR_H�HAVE_SYS_ENDIAN_H�HAVE_SYS_EPOLL_H�HAVE_SYS_EVENT_H�HAVE_SYS_FILE_H�HAVE_SYS_IOCTL_H�HAVE_SYS_KERN_CONTROL_H�HAVE_SYS_LOADAVG_H�HAVE_SYS_LOCK_H�HAVE_SYS_MKDEV_H�HAVE_SYS_MODEM_H�HAVE_SYS_NDIR_H�HAVE_SYS_PARAM_H�HAVE_SYS_POLL_H�HAVE_SYS_RANDOM_H�HAVE_SYS_RESOURCE_H�HAVE_SYS_SELECT_H�HAVE_SYS_SENDFILE_H�HAVE_SYS_SOCKET_H�HAVE_SYS_STATVFS_H�HAVE_SYS_STAT_H�HAVE_SYS_SYSCALL_H�HAVE_SYS_SYSMACROS_H�HAVE_SYS_SYS_DOMAIN_H�HAVE_SYS_TERMIO_H�HAVE_SYS_TIMES_H�HAVE_SYS_TIME_H�HAVE_SYS_TYPES_H�HAVE_SYS_UIO_H�
HAVE_SYS_UN_H�HAVE_SYS_UTSNAME_H�HAVE_SYS_WAIT_H�HAVE_SYS_XATTR_H�HAVE_TCGETPGRP�HAVE_TCSETPGRP�HAVE_TEMPNAM�HAVE_TERMIOS_H�HAVE_TERM_H�HAVE_TGAMMA�HAVE_TIMEGM�
HAVE_TIMES�HAVE_TMPFILE�HAVE_TMPNAM�
HAVE_TMPNAM_R�HAVE_TM_ZONE�
HAVE_TRUNCATE�HAVE_TZNAME�
HAVE_UCS4_TCL�
HAVE_UNAME�
HAVE_UNISTD_H�
HAVE_UNLINKAT�
HAVE_UNSETENV�HAVE_USABLE_WCHAR_T�HAVE_UTIL_H�HAVE_UTIMENSAT�HAVE_UTIMES�HAVE_UTIME_H�
HAVE_WAIT3�
HAVE_WAIT4�HAVE_WAITID�HAVE_WAITPID�HAVE_WCHAR_H�HAVE_WCSCOLL�
HAVE_WCSFTIME�HAVE_WCSXFRM�HAVE_WMEMCMP�HAVE_WORKING_TZSET�HAVE_WRITEV�HAVE_ZLIB_COPY�HAVE__GETPTY�
HOST_GNU_TYPE�INCLDIRSTOMAKE�
INCLUDEDIR�	INCLUDEPY�INSTALL�INSTALL_DATA�INSTALL_PROGRAM�INSTALL_SCRIPT�INSTALL_SHARED�
INSTSONAME�IO_H�IO_OBJS�LDCXXSHARED�LDFLAGS�LDLAST�	LDLIBRARY�LDLIBRARYDIR�LDSHARED�	LDVERSION�LIBC�LIBDEST�LIBDIR�LIBFFI_INCLUDEDIR�LIBM�	LIBOBJDIR�LIBOBJS�LIBPC�LIBPL�LIBRARY�LIBRARY_OBJS�LIBRARY_OBJS_OMIT_FROZEN�LIBS�
LIBSUBDIRS�LINKCC�
LINKFORSHARED�LIPO_32BIT_FLAGS�
LLVM_PROF_ERR�LLVM_PROF_FILE�LLVM_PROF_MERGER�LN�LOCALMODLIBS�LOG1P_DROPS_ZERO_SIGN�MACHDEP�MACHDEPPATH�MACHDEP_OBJS�MACHDESTLIB�MACOSX_DEPLOYMENT_TARGET�MAINCC�MAJOR_IN_MKDEV�MAJOR_IN_SYSMACROS�	MAKESETUP�MANDIR�MKDIR_P�MODLIBS�MODNAMES�MODOBJS�MODULE_OBJS�	MULTIARCH�MULTIARCH_CPPFLAGS�MVWDELCH_IS_EXPRESSION�NO_AS_NEEDED�OBJECT_OBJS�OPT�OTHER_LIBTOOL_OPT�PACKAGE_BUGREPORT�PACKAGE_NAME�PACKAGE_STRING�PACKAGE_TARNAME�PACKAGE_URL�PACKAGE_VERSION�PARSER_HEADERS�PARSER_OBJS�PGEN�PGENOBJS�PGOBJS�PGO_PROF_GEN_FLAG�PGO_PROF_USE_FLAG�PLATDIR�POBJS�POSIX_SEMAPHORES_NOT_ENABLED�PROFILE_TASK�PTHREAD_SYSTEM_SCHED_SUPPORTED�
PY3LIBRARY�PYLONG_BITS_IN_DIGIT�PYTHON�PYTHONFRAMEWORK�PYTHONFRAMEWORKDIR�PYTHONFRAMEWORKINSTALLDIR�PYTHONFRAMEWORKPREFIX�
PYTHONPATH�PYTHON_FOR_BUILD�PYTHON_FOR_REGEN�PYTHON_HEADERS�PYTHON_OBJS�	PY_CFLAGS�PY_CFLAGS_NODIST�PY_COERCE_C_LOCALE�PY_CORE_CFLAGS�PY_CORE_LDFLAGS�PY_CPPFLAGS�PY_FORMAT_SIZE_T�
PY_LDFLAGS�PY_LDFLAGS_NODIST�PY_SSL_DEFAULT_CIPHERS�PY_SSL_DEFAULT_CIPHER_STRING�PY_WARN_ON_C_LOCALE�Py_DEBUG�Py_ENABLE_SHARED�Py_HASH_ALGORITHM�
QUICKTESTOPTS�READELF�	RESSRCDIR�
RETSIGTYPE�	RUNSHARED�	SCRIPTDIR�SETPGRP_HAVE_ARG�SGI_ABI�SHELL�SHLIBS�SHLIB_SUFFIX�SIGNED_RIGHT_SHIFT_ZERO_FILLS�SITEPATH�
SIZEOF_DOUBLE�SIZEOF_FLOAT�
SIZEOF_FPOS_T�
SIZEOF_INT�SIZEOF_LONG�SIZEOF_LONG_DOUBLE�SIZEOF_LONG_LONG�SIZEOF_OFF_T�SIZEOF_PID_T�SIZEOF_PTHREAD_T�SIZEOF_SHORT�
SIZEOF_SIZE_T�
SIZEOF_TIME_T�SIZEOF_UINTPTR_T�
SIZEOF_VOID_P�SIZEOF_WCHAR_T�SIZEOF__BOOL�SOABI�SRCDIRS�
SRC_GDB_HOOKS�STDC_HEADERS�STRICT_SYSV_CURSES�	STRIPFLAG�SUBDIRS�
SUBDIRSTOO�SYSLIBS�SYS_SELECT_WITH_SYS_TIME�TANH_PRESERVES_ZERO_SIGN�TCLTK_INCLUDES�
TCLTK_LIBS�TESTOPTS�TESTPATH�
TESTPYTHON�TESTPYTHONOPTS�
TESTRUNNER�TESTTIMEOUT�	THREADOBJ�TIMEMODULE_LIB�TIME_WITH_SYS_TIME�TM_IN_SYS_TIME�UNICODE_DEPS�UNIVERSALSDK�UPDATE_FILE�USE_COMPUTED_GOTOS�
USE_INLINE�VERSION�VPATH�WANT_SIGFPE_HANDLER�WINDOW_HAS_FLAGS�WITH_DOC_STRINGS�WITH_DTRACE�	WITH_DYLD�WITH_LIBINTL�WITH_NEXT_FRAMEWORK�
WITH_PYMALLOC�WITH_THREAD�
WITH_VALGRIND�X87_DOUBLE_ROUNDING�
XMLLIBSUBDIRS�abs_builddir�
abs_srcdir�datarootdir�exec_prefix�prefix�srcdirN)�build_time_vars�r�r��@/usr/lib64/python3.6/_sysconfigdata_dm_linux_x86_64-linux-gnu.py�<module>s*binhex.cpython-36.pyc000064400000027470150335715140010465 0ustar003


 \�6�@s�dZddlZddlZddlZddlZdddgZGdd�de�ZdZdZ	dZ
d	Zd
ZGdd�d�Z
d
d�ZGdd�d�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�ZdS)z�Macintosh binhex compression/decompression.

easy interface:
binhex(inputfilename, outputfilename)
hexbin(inputfilename, outputfilename)
�N�binhex�hexbin�Errorc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/binhex.pyrs�i��@��c@seZdZdd�ZdS)�FInfocCsd|_d|_d|_dS)Nz????r)�Type�Creator�Flags)�selfrrr	�__init__0szFInfo.__init__N)rrrrrrrr	r
/sr
cCstt�}tj|d��2}|jd�}d|kr,d|_|jdd�|j�}WdQRXtjj	|�\}}|j
ddd�}|||dfS)	N�rbirZTEXT��:�-r
)r
�io�open�readr�seek�tell�os�path�split�replace)�name�finfo�fp�dataZdsize�dir�filerrr	�getfileinfo5s
r&c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�openrsrccGsdS)Nr)r�argsrrr	rCszopenrsrc.__init__cGsdS)N�r)rr(rrr	rFsz
openrsrc.readcGsdS)Nr)rr(rrr	�writeIszopenrsrc.writecCsdS)Nr)rrrr	�closeLszopenrsrc.closeN)rrrrrr*r+rrrr	r'Bsr'c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_Hqxcoderenginez(Write data to the coder in 3-byte chunkscCs ||_d|_d|_td|_dS)Nr)r
)�ofpr#�hqxdata�LINELEN�linelen)rr-rrr	rRsz_Hqxcoderengine.__init__cCsh|j||_t|j�}|dd}|jd|�}|j|d�|_|sHdS|jtj|�|_|jd�dS)N�r)r#�lenr.�binascii�b2a_hqx�_flush)rr#ZdatalenZtodorrr	r*Xs
z_Hqxcoderengine.writecCsvd}xF|t|j�|jkrJ||j}|jj|j||�d�t|_|}qW|j|d�|_|rr|jj|jd�dS)Nr�
s:
)r2r.r0r-r*r/)rZforce�firstZlastrrr	r5cs
z_Hqxcoderengine._flushcCs6|jr|jtj|j�|_|jd�|jj�|`dS)Nr
)r#r.r3r4r5r-r+)rrrr	r+ns


z_Hqxcoderengine.closeN)rrr�__doc__rr*r5r+rrrr	r,Os
r,c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_Rlecoderenginez4Write data to the RLE-coder in suitably large chunkscCs||_d|_dS)Nr))r-r#)rr-rrr	rxsz_Rlecoderengine.__init__cCs@|j||_t|j�tkrdStj|j�}|jj|�d|_dS)Nr))r#r2�REASONABLY_LARGEr3�rlecode_hqxr-r*)rr#�rledatarrr	r*|sz_Rlecoderengine.writecCs0|jrtj|j�}|jj|�|jj�|`dS)N)r#r3r;r-r*r+)rr<rrr	r+�s

z_Rlecoderengine.closeN)rrrr8rr*r+rrrr	r9usr9c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�BinHexc
	Cs�|\}}}}d}t|t�r.|}tj|d�}d}yR|jd�t|�}	t|	�|_d|_|dkr`t	�}||_
||_|j||�t
|_Wn|r�|j��YnXdS)NF�wbTs0(This file must be converted with BinHex 4.0)

:r)�
isinstance�strrrr*r,r9r-�crcr
�dlen�rlen�
_writeinfo�_DID_HEADER�stater+)
rZname_finfo_dlen_rlenr-r r!rBrCZclose_on_errorZofnameZhqxerrrr	r�s*



zBinHex.__init__cCs�t|�}|dkrtd��t|g�|jd�d}|j|j}}t|t�rR|jd�}t|t�rf|jd�}||}tj	d|j
�}tj	d|j|j�}	||||	}
|j
|
�|j�dS)N�?zFilename too longzlatin-1�z>hz>ii)r2r�bytes�encoderrr?r@�struct�packrrBrC�_write�	_writecrc)rr r!�nl�d�tpZcrZd2Zd3Zd4�inforrr	rD�s




zBinHex._writeinfocCs tj||j�|_|jj|�dS)N)r3�crc_hqxrAr-r*)rr#rrr	rM�sz
BinHex._writecCs4|jdkrd}nd}|jjtj||j��d|_dS)Nrz>hz>H)rAr-r*rKrL)rZfmtrrr	rN�s

zBinHex._writecrccCs0|jtkrtd��|jt|�|_|j|�dS)NzWriting data at the wrong time)rFrErrBr2rM)rr#rrr	r*�s
zBinHex.writecCs,|jdkrtd|jf��|j�t|_dS)NrzIncorrect data size, diff=%r)rBrrCrN�	_DID_DATArF)rrrr	�
close_data�s
zBinHex.close_datacCsB|jtkr|j�|jtkr$td��|jt|�|_|j|�dS)Nz'Writing resource data at the wrong time)rFrTrUrrCr2rM)rr#rrr	�
write_rsrc�s

zBinHex.write_rsrccCsx|jdkrdSzJ|jtkr"|j�|jtkr4td��|jdkrNtd|jf��|j�Wdd|_|j}|`|j�XdS)NzClose at the wrong timerz$Incorrect resource-datasize, diff=%r)rFrTrUrrCrNr-r+)rr-rrr	r+�s



zBinHex.closeN)rrrrrDrMrNr*rUrVr+rrrr	r=�s
r=c
Cs�t|�}t||�}tj|d��.}x|jd�}|s2P|j|�q"W|j�WdQRXt|d�}x|jd�}|snP|j|�q^W|j	�|j	�dS)zEbinhex(infilename, outfilename): create binhex-encoded copy of a fileri�N)
r&r=rrrr*rUr'rVr+)�inp�outr!r-�ifprPrrr	r�s"



c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_Hqxdecoderenginez*Read data via the decoder in 4-byte chunkscCs||_d|_dS)Nr)rY�eof)rrYrrr	rsz_Hqxdecoderengine.__init__cCs�d}|}x�|dkr�|jr|S|ddd}|jj|�}xRytj|�\}|_PWntjk
rfYnX|jjd�}|s�td��||}q:W||}|t|�}|r
|jr
td��q
W|S)z&Read at least wtd bytes (or until EOF)r)rrr1�r
zPremature EOF on binhex file)r[rYrr3Za2b_hqxZ
Incompleterr2)rZtotalwtdZdecdata�wtdr#Z
decdatacur�newdatarrr	rs,
z_Hqxdecoderengine.readcCs|jj�dS)N)rYr+)rrrr	r+%sz_Hqxdecoderengine.closeN)rrrr8rrr+rrrr	rZ�s rZc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_RledecoderenginezRead data via the RLE-codercCs||_d|_d|_d|_dS)Nr)r)rY�
pre_buffer�post_bufferr[)rrYrrr	r+sz_Rledecoderengine.__init__cCsD|t|j�kr"|j|t|j��|jd|�}|j|d�|_|S)N)r2ra�_fill)rr]�rvrrr	r1s
z_Rledecoderengine.readcCs�|j|jj|d�|_|jjr>|jtj|j�|_d|_dSt|j�}|jdd�tdtkrl|d}nX|jdd�tkr�|d}n<|jd	d�tdkr�|d}n|jd
d�tkr�n|d}|jtj|jd|��|_|j|d�|_dS)Nr\r)r1rHr
r���������rfre)	r`rYrr[rar3Z
rledecode_hqxr2�RUNCHAR)rr]Zmarkrrr	rb8s&



z_Rledecoderengine._fillcCs|jj�dS)N)rYr+)rrrr	r+[sz_Rledecoderengine.closeN)rrrr8rrrbr+rrrr	r_(s
#r_c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�HexBincCsjt|t�rtj|d�}x.|jd�}|s.td��|dkr8q|dkrPqWt|�}t|�|_d|_	|j
�dS)Nrr
zNo binhex data found�
�:r)r?r@rrrrrZr_rYrA�_readheader)rrYZchZhqxifprrr	r_s


zHexBin.__init__cCs |jj|�}tj||j�|_|S)N)rYrr3rSrA)rr2r#rrr	�_readuszHexBin._readcCsNtjd|jjd��dd@}|jd@|_||jkrDtd|j|f��d|_dS)Nz>hrri��zCRC error, computed %x, read %x)rK�unpackrYrrAr)rZfilecrcrrr	�	_checkcrczs
zHexBin._checkcrccCs�|jd�}|jt|��}|jd�}|j�|dd�}|dd�}tjd|dd��d}tjd	|dd
��d|_tjd	|d
d��d|_||_t�|_||j_	||j_
||j_t|_
dS)Nr
r\r��	z>h�rz>l��rorprqrrrs)rl�ordrnrKrmrBrC�FNamer
rrrrErF)rr2Zfname�rest�typeZcreator�flagsrrr	rk�s

zHexBin._readheadercGsn|jtkrtd��|r,|d}t||j�}n|j}d}x&t|�|kr\||j|t|��}q8W|j||_|S)NzRead data at wrong timerr))rFrEr�minrBr2rl)r�nrcrrr	r�s
zHexBin.readcCs6|jtkrtd��|jr$|j|j�}|j�t|_dS)Nzclose_data at wrong time)rFrErrBrlrnrT)r�dummyrrr	rU�s
zHexBin.close_datacGsZ|jtkr|j�|jtkr$td��|r>|d}t||j�}n|j}|j||_|j|�S)Nz Read resource data at wrong timer)rFrErUrTrryrCrl)rrzrrr	�	read_rsrc�s

zHexBin.read_rsrccCsD|jdkrdSz|jr"|j|j�}|j�Wdd|_|jj�XdS)N)rFrCr|rnrYr+)rr{rrr	r+�s
zHexBin.closeN)rrrrrlrnrkrrUr|r+rrrr	rh^s

rhc
Cs�t|�}|j}|s|j}tj|d��&}x|jd�}|s8P|j|�q(WWdQRX|j�|jd�}|r�t	|d�}|j|�x|jd�}|s�P|j|�q|W|j
�|j
�dS)z6hexbin(infilename, outfilename) - Decode binhexed filer>i�N)rhr
rurrrr*rUr|r'r+)rWrXrYr!r-rPrrr	r�s,




)r8rrrKr3�__all__�	ExceptionrrErTr:r/rgr
r&r'r,r9r=rrZr_rhrrrrr	�<module>s,


&^*6hcontextlib.cpython-36.opt-1.pyc000064400000025630150335715140012316 0ustar003


 \j3�@s�dZddlZddlZddlZddlmZddlmZddddd	d
ddgZGd
d�dej	�Z
Gdd�de�ZGdd�dee
�Z
dd�ZGdd�de
�ZGdd�de
�ZGdd
�d
e�ZGdd�de�ZGdd�de
�ZGdd	�d	e
�ZdS)z4Utilities for with-statement contexts.  See PEP 343.�N)�deque)�wraps�contextmanager�closing�AbstractContextManager�ContextDecorator�	ExitStack�redirect_stdout�redirect_stderr�suppressc@s2eZdZdZdd�Zejdd��Zedd��Z	dS)	rz,An abstract base class for context managers.cCs|S)z0Return `self` upon entering the runtime context.�)�selfrr�"/usr/lib64/python3.6/contextlib.py�	__enter__sz AbstractContextManager.__enter__cCsdS)z9Raise any exception triggered within the runtime context.Nr)r
�exc_type�	exc_value�	tracebackrrr�__exit__szAbstractContextManager.__exit__cCs|tkrtj|dd�StS)Nrr)r�_collections_abc�_check_methods�NotImplemented)�cls�Crrr�__subclasshook__sz'AbstractContextManager.__subclasshook__N)
�__name__�
__module__�__qualname__�__doc__r�abc�abstractmethodr�classmethodrrrrrr
sc@s eZdZdZdd�Zdd�ZdS)rzJA base class or mixin that enables context managers to work as decorators.cCs|S)a6Return a recreated instance of self.

        Allows an otherwise one-shot context manager like
        _GeneratorContextManager to support use as
        a decorator via implicit recreation.

        This is a private interface just for _GeneratorContextManager.
        See issue #11647 for details.
        r)r
rrr�_recreate_cm$s
zContextDecorator._recreate_cmcst����fdd��}|S)Nc
s�j���||�SQRXdS)N)r!)�args�kwds)�funcr
rr�inner1s
z(ContextDecorator.__call__.<locals>.inner)r)r
r$r%r)r$r
r�__call__0szContextDecorator.__call__N)rrrrr!r&rrrrr!sc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_GeneratorContextManagerz%Helper for @contextmanager decorator.cCsJ|||�|_||||_|_|_t|dd�}|dkr@t|�j}||_dS)Nr)�genr$r"r#�getattr�typer)r
r$r"r#�docrrr�__init__;s
z!_GeneratorContextManager.__init__cCs|j|j|j|j�S)N)�	__class__r$r"r#)r
rrrr!Isz%_GeneratorContextManager._recreate_cmcCs.y
t|j�Stk
r(td�d�YnXdS)Nzgenerator didn't yield)�nextr(�
StopIteration�RuntimeError)r
rrrrOs
z"_GeneratorContextManager.__enter__cCs�|dkr6yt|j�Wntk
r*dSXtd��n�|dkrD|�}y|jj|||�Wn�tk
r|}z||k	Sd}~Xnftk
r�}z*||kr�dS|tkr�|j|kr�dS�WYdd}~Xn"tj�d|kr�dS�YnXtd��dS)NFzgenerator didn't stop�z#generator didn't stop after throw())r.r(r/r0�throw�	__cause__�sys�exc_info)r
r*�valuer�excrrrrUs.
z!_GeneratorContextManager.__exit__N)rrrrr,r!rrrrrrr'8s
r'cst���fdd��}|S)a�@contextmanager decorator.

    Typical usage:

        @contextmanager
        def some_generator(<arguments>):
            <setup>
            try:
                yield <value>
            finally:
                <cleanup>

    This makes this:

        with some_generator(<arguments>) as <variable>:
            <body>

    equivalent to this:

        <setup>
        try:
            <variable> = <value>
            <body>
        finally:
            <cleanup>

    cst�||�S)N)r')r"r#)r$rr�helper�szcontextmanager.<locals>.helper)r)r$r8r)r$rr�sc@s(eZdZdZdd�Zdd�Zdd�ZdS)	ra2Context to automatically close something at the end of a block.

    Code like this:

        with closing(<module>.open(<arguments>)) as f:
            <block>

    is equivalent to this:

        f = <module>.open(<arguments>)
        try:
            <block>
        finally:
            f.close()

    cCs
||_dS)N)�thing)r
r9rrrr,�szclosing.__init__cCs|jS)N)r9)r
rrrr�szclosing.__enter__cGs|jj�dS)N)r9�close)r
r5rrrr�szclosing.__exit__N)rrrrr,rrrrrrr�sc@s(eZdZdZdd�Zdd�Zdd�ZdS)�_RedirectStreamNcCs||_g|_dS)N)�_new_target�_old_targets)r
�
new_targetrrrr,�sz_RedirectStream.__init__cCs*|jjtt|j��tt|j|j�|jS)N)r=�appendr)r4�_stream�setattrr<)r
rrrr�sz_RedirectStream.__enter__cCstt|j|jj��dS)N)rAr4r@r=�pop)r
�exctype�excinst�exctbrrrr�sz_RedirectStream.__exit__)rrrr@r,rrrrrrr;�sr;c@seZdZdZdZdS)r	aAContext manager for temporarily redirecting stdout to another file.

        # How to send help() to stderr
        with redirect_stdout(sys.stderr):
            help(dir)

        # How to write help() to a file
        with open('help.txt', 'w') as f:
            with redirect_stdout(f):
                help(pow)
    �stdoutN)rrrrr@rrrrr	�sc@seZdZdZdZdS)r
zCContext manager for temporarily redirecting stderr to another file.�stderrN)rrrrr@rrrrr
�sc@s(eZdZdZdd�Zdd�Zdd�ZdS)	ra?Context manager to suppress specified exceptions

    After the exception is suppressed, execution proceeds with the next
    statement following the with statement.

         with suppress(FileNotFoundError):
             os.remove(somefile)
         # Execution still resumes here if the file was already removed
    cGs
||_dS)N)�_exceptions)r
�
exceptionsrrrr,�szsuppress.__init__cCsdS)Nr)r
rrrr�szsuppress.__enter__cCs|dk	ot||j�S)N)�
issubclassrH)r
rCrDrErrrr�s
zsuppress.__exit__N)rrrrr,rrrrrrr�s	c@sPeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)ra�Context manager for dynamic management of a stack of exit callbacks

    For example:

        with ExitStack() as stack:
            files = [stack.enter_context(open(fname)) for fname in filenames]
            # All opened files will automatically be closed at the end of
            # the with statement, even if attempts to open files later
            # in the list raise an exception

    cCst�|_dS)N)r�_exit_callbacks)r
rrrr,szExitStack.__init__cCst|��}|j|_t�|_|S)z?Preserve the context stack by transferring it to a new instance)r*rKr)r
�	new_stackrrr�pop_alls
zExitStack.pop_allcs"��fdd�}�|_|j|�dS)z:Helper to correctly register callbacks to __exit__ methodscs��f|��S)Nr)�exc_details)�cm�cm_exitrr�
_exit_wrappersz.ExitStack._push_cm_exit.<locals>._exit_wrapperN)�__self__�push)r
rOrPrQr)rOrPr�
_push_cm_exitszExitStack._push_cm_exitcCsDt|�}y
|j}Wn tk
r2|jj|�YnX|j||�|S)aRegisters a callback with the standard __exit__ method signature

        Can suppress exceptions the same way __exit__ methods can.

        Also accepts any object with an __exit__ method (registering a call
        to the method instead of the object itself)
        )r*r�AttributeErrorrKr?rT)r
�exit�_cb_type�exit_methodrrrrS s

zExitStack.pushcs$���fdd�}�|_|j|��S)z\Registers an arbitrary callback and arguments.

        Cannot suppress exceptions.
        cs����dS)Nr)rr7�tb)r"�callbackr#rrrQ9sz)ExitStack.callback.<locals>._exit_wrapper)�__wrapped__rS)r
rZr"r#rQr)r"rZr#rrZ4s
zExitStack.callbackcCs(t|�}|j}|j|�}|j||�|S)z�Enters the supplied context manager

        If successful, also pushes its __exit__ method as a callback and
        returns the result of the __enter__ method.
        )r*rrrT)r
rO�_cm_type�_exit�resultrrr�
enter_contextAs

zExitStack.enter_contextcCs|jddd�dS)z$Immediately unwind the context stackN)r)r
rrrr:NszExitStack.closec	s�|ddk	}tj�d��fdd�}d}d}x\|jr�|jj�}y||�rTd}d}d}Wq.tj�}||d|d�d}|}Yq.Xq.W|r�y|dj}|d�Wn tk
r�||d_�YnX|o�|S)Nrr1cs8x,|j}||krdS|dks$|�kr&P|}qW||_dS)N)�__context__)�new_exc�old_exc�exc_context)�	frame_excrr�_fix_exception_contextXsz2ExitStack.__exit__.<locals>._fix_exception_contextFT)NNN)r4r5rKrBr`�
BaseException)	r
rN�received_excre�suppressed_exc�
pending_raise�cb�new_exc_details�	fixed_ctxr)rdrrRs2


zExitStack.__exit__N)rrrrr,rMrTrSrZr_r:rrrrrrs

)rrr4r�collectionsr�	functoolsr�__all__�ABCr�objectrr'rrr;r	r
rrrrrr�<module>s$I"telnetlib.cpython-36.opt-2.pyc000064400000024535150335715140012131 0ustar003


 \`Z�@sFddlZddlZddlZddlmZdgZdZdZe	dg�Z
e	dg�Ze	dg�Ze	dg�Z
e	d	g�Ze	dg�Ze	d
g�Ze	dg�Ze	dg�Ze	d
g�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Z e	dg�Z!e	dg�Z"e	dg�Z#e	dg�Z$e	dg�Z%e	dg�Z&e	d g�Z'e	d!g�Z(e	d"g�Z)e	d#g�Z*e	d$g�Z+e	d%g�Z,e	d&g�Z-e	d'g�Z.e	d(g�Z/e	d)g�Z0e	d*g�Z1e	dg�Z2e	d+g�Z3e	d,g�Z4e	d-g�Z5e	d.g�Z6e	d/g�Z7e	d0g�Z8e	d1g�Z9e	d2g�Z:e	d3g�Z;e	d4g�Z<e	d5g�Z=e	d6g�Z>e	d7g�Z?e	d8g�Z@e	d9g�ZAe	d:g�ZBe	d;g�ZCe	d<g�ZDe	d=g�ZEe	d>g�ZFe	d?g�ZGe	d@g�ZHe	dAg�ZIe	dBg�ZJe	dCg�ZKe	dDg�ZLe	dEg�ZMe	dFg�ZNe	dGg�ZOe	dg�ZPe	dg�ZQeRedH��rejSZTnejUZTGdId�d�ZVdJdK�ZWeXdLk�rBeW�dS)M�N)�	monotonic�Telnet�������������������������������	�
���
������������������ �!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�0�1����PollSelectorc@seZdZddejfdd�Zdejfdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
d;dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd<d5d6�Zd7d8�Zd9d:�Z dS)=rNrcCsht|_||_||_||_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
|dk	rd|j|||�dS)N�r)�
DEBUGLEVEL�
debuglevel�host�port�timeout�sock�rawq�irawq�cookedq�eof�iacseq�sb�sbdataq�option_callback�open)�selfrLrMrN�rZ�!/usr/lib64/python3.6/telnetlib.py�__init__�szTelnet.__init__cCs6d|_|st}||_||_||_tj||f|�|_dS)Nr)rS�TELNET_PORTrLrMrN�socketZcreate_connectionrO)rYrLrMrNrZrZr[rX�szTelnet.opencCs|j�dS)N)�close)rYrZrZr[�__del__�szTelnet.__del__cGs@|jdkr<td|j|jfdd�|r4t||�nt|�dS)NrzTelnet(%s,%s):� )�end)rK�printrLrM)rY�msg�argsrZrZr[rd�s

z
Telnet.msgcCs
||_dS)N)rK)rYrKrZrZr[�set_debuglevel�szTelnet.set_debuglevelcCs.|j}d|_d|_d|_d|_|r*|j�dS)NTrIr)rOrSrTrUr_)rYrOrZrZr[r_szTelnet.closecCs|jS)N)rO)rYrZrZr[�
get_socketszTelnet.get_socketcCs
|jj�S)N)rO�fileno)rYrZrZr[rhsz
Telnet.filenocCs4t|kr|jttt�}|jd|�|jj|�dS)Nzsend %r)�IAC�replacerdrO�sendall)rY�bufferrZrZr[�writeszTelnet.writecCs t|�}|j�|jj|�}|dkrN||}|jd|�}|j|d�|_|S|dk	r`t�|}t���}|j|tj�x�|j	�s|j
|�r�tdt|j�|�}|j�|j�|jj||�}|dkr�||}|jd|�}|j|d�|_|S|dk	rx|t�}|dkrxPqxWWdQRX|j
�S)Nr)�len�process_rawqrR�find�_time�_TelnetSelector�register�	selectors�
EVENT_READrS�select�max�	fill_rawq�read_very_lazy)rY�matchrN�n�i�buf�deadline�selectorrZrZr[�
read_until$s8



zTelnet.read_untilcCs4|j�x|js"|j�|j�q
W|j}d|_|S)NrI)rorSrxrR)rYr}rZrZr[�read_allIszTelnet.read_allcCs>|j�x$|jr,|jr,|j�|j�q
W|j}d|_|S)NrI)rorRrSrx)rYr}rZrZr[�	read_someSszTelnet.read_somecCs6|j�x$|jr,|j�r,|j�|j�q
W|j�S)N)rorS�
sock_availrxry)rYrZrZr[�read_very_eagerbs
zTelnet.read_very_eagercCs>|j�x,|jr4|jr4|j�r4|j�|j�q
W|j�S)N)rorRrSr�rxry)rYrZrZr[�
read_eagerps
zTelnet.read_eagercCs|j�|j�S)N)rory)rYrZrZr[�	read_lazy~szTelnet.read_lazycCs,|j}d|_|r(|jr(|jr(td��|S)NrIztelnet connection closed)rRrSrP�EOFError)rYr}rZrZr[ry�s
zTelnet.read_very_lazycCs|j}d|_|S)NrI)rV)rYr}rZrZr[�read_sb_data�szTelnet.read_sb_datacCs
||_dS)N)rW)rY�callbackrZrZr[�set_option_negotiation_callback�sz&Telnet.set_option_negotiation_callbackcCsXddg}�y�x�|j�r|j�}|jsj|tkr0q|dkr:q|tkrZ||j|||j<qn|j|7_qt|j�dk�r(|ttt	t
fkr�|j|7_qd|_|tkr�||j|||j<nh|tkr�d|_d|_n&|t
kr�d|_|j|d|_d|d<|j�r|j|j|t�n|jdt|��qt|j�dkr|jdd�}d|_|}|ttfk�r�|jd|tk�rrd�ptd	t|��|j�r�|j|j||�n|jjtt
|�q|t	t
fkr|jd|t	k�r�d
�p�dt|��|j�r�|j|j||�q|jjtt|�qWWn"tk
�r2d|_d|_YnX|j|d|_|j|d|_dS)NrI�rrzIAC %d not recognizedrz	IAC %s %d�DO�DONT�WILL�WONT)rP�rawq_getcharrT�theNULLrirUrnr�r�r�r��SBrV�SErWrO�NOOPTrd�ordrkr�rR)rYr}�c�cmd�optrZrZr[ro�shzTelnet.process_rawqcCsZ|js|j�|jrt�|j|j|jd�}|jd|_|jt|j�krVd|_d|_|S)NrrIr)rPrxrSr�rQrn)rYr�rZrZr[r��szTelnet.rawq_getcharcCsL|jt|j�krd|_d|_|jjd�}|jd|�||_|j||_dS)NrIr�2zrecv %r)rQrnrPrOZrecvrdrS)rYr}rZrZr[rxszTelnet.fill_rawqc
Cs.t��}|j|tj�t|jd��SQRXdS)Nr)rrrsrtru�boolrv)rYrrZrZr[r�szTelnet.sock_availcCs�tjdkr|j�dSt���}|j|tj�|jtjtj�x�x�|j�D]�\}}|j	|kr�y|j
�}Wntk
r�td�dSX|r�tj
j|jd��tj
j�qH|j	tjkrHtjj�jd�}|s�dS|j|�qHWq>WWdQRXdS)NZwin32z(*** Connection closed by remote host ***�ascii)�sys�platform�mt_interactrrrsrtru�stdinrvZfileobjr�r�rc�stdoutrm�decode�flush�readline�encode)rYr�keyZevents�text�linerZrZr[�interacts,

zTelnet.interactcCs@ddl}|j|jf�x$tjj�}|s(P|j|jd��qWdS)Nrr�)�_thread�start_new_thread�listenerr�r�r�rmr�)rYr�r�rZrZr[r�1s
zTelnet.mt_interactcCsVxPy|j�}Wntk
r*td�dSX|rDtjj|jd��qtjj�qWdS)Nz(*** Connection closed by remote host ***r�)r�r�rcr�r�rmr�r�)rY�datarZrZr[r�;szTelnet.listenercCsPd}|dd�}tt|��}x8|D]0}t||d�s"|s@ddl}|j||�||<q"W|dk	rht�|}t���}|j|tj	�x�|j
�s|j�xP|D]H}||j|j
�}|r�|j�}	|j
d|	�}
|j
|	d�|_
|||
fSq�W|dk	�r|j|�}|t�}|�s|dkr�Pnq�|j�q�WWdQRX|j�}
|
�rF|j
�rFt�dd|
fS)N�searchrr���)�rangern�hasattr�re�compilerqrrrsrtrurSror�rRrbrvrxryr�)rY�listrNr��indicesr|r~r�m�er�ZreadyrZrZr[�expectHsB






z
Telnet.expectcCs|S)NrZ)rYrZrZr[�	__enter__�szTelnet.__enter__cCs|j�dS)N)r_)rY�type�value�	tracebackrZrZr[�__exit__�szTelnet.__exit__)N)N)!�__name__�
__module__�__qualname__r^Z_GLOBAL_DEFAULT_TIMEOUTr\rXr`rdrfr_rgrhrmr�r�r�r�r�r�ryr�r�ror�rxr�r�r�r�r�r�r�rZrZrZr[r�s:7

%

H

8cCs�d}x0tjdd�r4tjddkr4|d}tjd=qWd}tjdd�rRtjd}d}tjdd�r�tjd}yt|�}Wn tk
r�tj|d�}YnXt��(}|j|�|j||dd�|j	�WdQRXdS)	Nrrz-dZ	localhostrZtcpg�?)rN)
r��argv�int�
ValueErrorr^Z
getservbynamerrfrXr�)rKrLrMZportstrZtnrZrZr[�test�s$


r��__main__)Yr�r^rtZtimerrq�__all__rJr]�bytesrir�r�r�r�r�r�ZNOPZDMZBRKZIPZAOZAYTZECZELZGAr�ZBINARYZECHOZRCPZSGAZNAMSZSTATUSZTMZRCTEZNAOLZNAOPZNAOCRDZNAOHTSZNAOHTDZNAOFFDZNAOVTSZNAOVTDZNAOLFDZXASCIIZLOGOUTZBMZDETZSUPDUPZSUPDUPOUTPUTZSNDLOCZTTYPEZEORZTUIDZOUTMRKZTTYLOCZVT3270REGIMEZX3PADZNAWSZTSPEEDZLFLOWZLINEMODEZXDISPLOCZOLD_ENVIRONZAUTHENTICATIONZENCRYPTZNEW_ENVIRONZTN3270EZXAUTH�CHARSETZRSPZCOM_PORT_OPTIONZSUPPRESS_LOCAL_ECHOZTLSZKERMITZSEND_URLZ	FORWARD_XZPRAGMA_LOGONZ
SSPI_LOGONZPRAGMA_HEARTBEATZEXOPLr�r�rHrrZSelectSelectorrr�r�rZrZrZr[�<module>$s�







































































}
_pyio.cpython-36.pyc000064400000213334150335715140010323 0ustar003


 \!X�@sbdZddlZddlZddlZddlZddlZddlZyddlmZ	Wn e
k
rdddlmZ	YnXejd5kr~ddl
mZndZddlZddlmZmZmZmZddd	hZeed
�r�ejej�ejej�d6ZeZd8dd�ZGdd�d�ZGdd�d�Zy
ejZWn(e k
�r.Gdd�de!e"�ZYnXGdd�dej#d�Z$ej$j%e$�Gdd�de$�Z&ej&j%e&�ddl'm(Z(e&j%e(�Gdd�de$�Z)ej)j%e)�Gdd �d e)�Z*Gd!d"�d"e)�Z+Gd#d$�d$e*�Z,Gd%d&�d&e*�Z-Gd'd(�d(e)�Z.Gd)d*�d*e-e,�Z/Gd+d,�d,e&�Z(Gd-d.�d.e$�Z0ej0j%e0�Gd/d0�d0ej1�Z2Gd1d2�d2e0�Z3Gd3d4�d4e3�Z4dS)9z)
Python implementation of the io module.
�N)�
allocate_lock�win32�cygwin)�setmode)�__all__�SEEK_SET�SEEK_CUR�SEEK_END���	SEEK_HOLE�i�rTcCs~t|t�stj|�}t|tttf�s0td|��t|t�sFtd|��t|t�s\td|��|dk	r|t|t�r|td|��|dk	r�t|t�r�td|��t|�}|td�s�t|�t|�kr�t	d|��d|k}	d	|k}
d
|k}d|k}d|k}
d
|k}d|k}d|k�rH|	�s&|�s&|�s&|
�r.t	d��ddl
}|jdtd�d}
|�r\|�r\t	d��|	|
||dk�rzt	d��|	�p�|
�p�|�p�|�s�t	d��|�r�|dk	�r�t	d��|�r�|dk	�r�t	d��|�r�|dk	�r�t	d��t
||	�r�d�p�d|
�rd	�pd|�rd
�pd|�r d�p"d|
�r0d�p2d||d�}|}�yd}|dk�sh|dk�rp|j��rpd"}d}|dk�r�t}ytj|j��j}Wnttfk
�r�YnX|dk�r�|}|dk�r�t	d��|dk�r�|�r�|St	d ��|
�r�t||�}n<|	�s|�s|�rt||�}n|
�r,t||�}nt	d!|��|}|�rF|St|||||�}|}||_|S|j��YnXdS)#a�Open file and return a stream.  Raise OSError upon failure.

    file is either a text or byte string giving the name (and the path
    if the file isn't in the current working directory) of the file to
    be opened or an integer file descriptor of the file to be
    wrapped. (If a file descriptor is given, it is closed when the
    returned I/O object is closed, unless closefd is set to False.)

    mode is an optional string that specifies the mode in which the file is
    opened. It defaults to 'r' which means open for reading in text mode. Other
    common values are 'w' for writing (truncating the file if it already
    exists), 'x' for exclusive creation of a new file, and 'a' for appending
    (which on some Unix systems, means that all writes append to the end of the
    file regardless of the current seek position). In text mode, if encoding is
    not specified the encoding used is platform dependent. (For reading and
    writing raw bytes use binary mode and leave encoding unspecified.) The
    available modes are:

    ========= ===============================================================
    Character Meaning
    --------- ---------------------------------------------------------------
    'r'       open for reading (default)
    'w'       open for writing, truncating the file first
    'x'       create a new file and open it for writing
    'a'       open for writing, appending to the end of the file if it exists
    'b'       binary mode
    't'       text mode (default)
    '+'       open a disk file for updating (reading and writing)
    'U'       universal newline mode (deprecated)
    ========= ===============================================================

    The default mode is 'rt' (open for reading text). For binary random
    access, the mode 'w+b' opens and truncates the file to 0 bytes, while
    'r+b' opens the file without truncation. The 'x' mode implies 'w' and
    raises an `FileExistsError` if the file already exists.

    Python distinguishes between files opened in binary and text modes,
    even when the underlying operating system doesn't. Files opened in
    binary mode (appending 'b' to the mode argument) return contents as
    bytes objects without any decoding. In text mode (the default, or when
    't' is appended to the mode argument), the contents of the file are
    returned as strings, the bytes having been first decoded using a
    platform-dependent encoding or using the specified encoding if given.

    'U' mode is deprecated and will raise an exception in future versions
    of Python.  It has no effect in Python 3.  Use newline to control
    universal newlines mode.

    buffering is an optional integer used to set the buffering policy.
    Pass 0 to switch buffering off (only allowed in binary mode), 1 to select
    line buffering (only usable in text mode), and an integer > 1 to indicate
    the size of a fixed-size chunk buffer.  When no buffering argument is
    given, the default buffering policy works as follows:

    * Binary files are buffered in fixed-size chunks; the size of the buffer
      is chosen using a heuristic trying to determine the underlying device's
      "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
      On many systems, the buffer will typically be 4096 or 8192 bytes long.

    * "Interactive" text files (files for which isatty() returns True)
      use line buffering.  Other text files use the policy described above
      for binary files.

    encoding is the str name of the encoding used to decode or encode the
    file. This should only be used in text mode. The default encoding is
    platform dependent, but any encoding supported by Python can be
    passed.  See the codecs module for the list of supported encodings.

    errors is an optional string that specifies how encoding errors are to
    be handled---this argument should not be used in binary mode. Pass
    'strict' to raise a ValueError exception if there is an encoding error
    (the default of None has the same effect), or pass 'ignore' to ignore
    errors. (Note that ignoring encoding errors can lead to data loss.)
    See the documentation for codecs.register for a list of the permitted
    encoding error strings.

    newline is a string controlling how universal newlines works (it only
    applies to text mode). It can be None, '', '\n', '\r', and '\r\n'.  It works
    as follows:

    * On input, if newline is None, universal newlines mode is
      enabled. Lines in the input can end in '\n', '\r', or '\r\n', and
      these are translated into '\n' before being returned to the
      caller. If it is '', universal newline mode is enabled, but line
      endings are returned to the caller untranslated. If it has any of
      the other legal values, input lines are only terminated by the given
      string, and the line ending is returned to the caller untranslated.

    * On output, if newline is None, any '\n' characters written are
      translated to the system default line separator, os.linesep. If
      newline is '', no translation takes place. If newline is any of the
      other legal values, any '\n' characters written are translated to
      the given string.

    closedfd is a bool. If closefd is False, the underlying file descriptor will
    be kept open when the file is closed. This does not work when a file name is
    given and must be True in that case.

    The newly created file is non-inheritable.

    A custom opener can be used by passing a callable as *opener*. The
    underlying file descriptor for the file object is then obtained by calling
    *opener* with (*file*, *flags*). *opener* must return an open file
    descriptor (passing os.open as *opener* results in functionality similar to
    passing None).

    open() returns a file object whose type depends on the mode, and
    through which the standard file operations such as reading and writing
    are performed. When open() is used to open a file in a text mode ('w',
    'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open
    a file in a binary mode, the returned class varies: in read binary
    mode, it returns a BufferedReader; in write binary and append binary
    modes, it returns a BufferedWriter, and in read/write mode, it returns
    a BufferedRandom.

    It is also possible to use a string or bytearray as a file for both
    reading and writing. For strings StringIO can be used like a file
    opened in a text mode, and for bytes a BytesIO can be used like a file
    opened in a binary mode.
    zinvalid file: %rzinvalid mode: %rzinvalid buffering: %rNzinvalid encoding: %rzinvalid errors: %rzaxrwb+tU�xr�w�a�+�t�b�Uz4mode U cannot be combined with 'x', 'w', 'a', or '+'rz'U' mode is deprecatedrTz'can't have text and binary mode at oncer
z)can't have read/write/append mode at oncez/must have exactly one of read/write/append modez-binary mode doesn't take an encoding argumentz+binary mode doesn't take an errors argumentz+binary mode doesn't take a newline argument�)�openerFzinvalid buffering sizezcan't have unbuffered text I/Ozunknown mode: %r���)�
isinstance�int�os�fspath�str�bytes�	TypeError�set�len�
ValueError�warnings�warn�DeprecationWarning�FileIO�isatty�DEFAULT_BUFFER_SIZE�fstat�fileno�
st_blksize�OSError�AttributeError�BufferedRandom�BufferedWriter�BufferedReader�
TextIOWrapper�mode�close)�filer2�	buffering�encoding�errors�newline�closefdrZmodesZcreatingZreadingZwritingZ	appendingZupdating�textZbinaryr#�raw�result�line_bufferingZbs�buffer�r?�/usr/lib64/python3.6/_pyio.py�open(s�{




>




rAc@seZdZdZdd�ZdS)�
DocDescriptorz%Helper for builtins.open.__doc__
    cCs
dtjS)Nz\open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True)

)rA�__doc__)�self�obj�typr?r?r@�__get__�szDocDescriptor.__get__N)�__name__�
__module__�__qualname__rCrGr?r?r?r@rB�srBc@seZdZdZe�Zdd�ZdS)�OpenWrapperz�Wrapper for builtins.open

    Trick so that open won't become a bound method when stored
    as a class variable (as dbm.dumb does).

    See initstdio() in Python/pylifecycle.c.
    cOs
t||�S)N)rA)�cls�args�kwargsr?r?r@�__new__szOpenWrapper.__new__N)rHrIrJrCrBrOr?r?r?r@rKsrKc@seZdZdS)�UnsupportedOperationN)rHrIrJr?r?r?r@rPsrPc@s�eZdZdZdd�Zd6dd�Zdd�Zd7d
d�Zdd
�ZdZ	dd�Z
dd�Zdd�Zd8dd�Z
dd�Zd9dd�Zdd�Zd:dd�Zedd ��Zd;d!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd=d,d-�Zd.d/�Zd0d1�Zd>d2d3�Zd4d5�Zd	S)?�IOBaseagThe abstract base class for all I/O classes, acting on streams of
    bytes. There is no public constructor.

    This class provides dummy implementations for many methods that
    derived classes can override selectively; the default implementations
    represent a file that cannot be read, written or seeked.

    Even though IOBase does not declare read, readinto, or write because
    their signatures will vary, implementations and clients should
    consider those methods part of the interface. Also, implementations
    may raise UnsupportedOperation when operations they do not support are
    called.

    The basic type used for binary data read from or written to a file is
    bytes. Other bytes-like objects are accepted as method arguments too. In
    some cases (such as readinto), a writable object is required. Text I/O
    classes work with str data.

    Note that calling any method (even inquiries) on a closed stream is
    undefined. Implementations may raise OSError in this case.

    IOBase (and its subclasses) support the iterator protocol, meaning
    that an IOBase object can be iterated over yielding the lines in a
    stream.

    IOBase also supports the :keyword:`with` statement. In this example,
    fp is closed after the suite of the with statement is complete:

    with open('spam.txt', 'r') as fp:
        fp.write('Spam and eggs!')
    cCstd|jj|f��dS)z@Internal: raise an OSError exception for unsupported operations.z%s.%s() not supportedN)rP�	__class__rH)rD�namer?r?r@�_unsupported@szIOBase._unsupportedrcCs|jd�dS)a$Change stream position.

        Change the stream position to byte offset pos. Argument pos is
        interpreted relative to the position indicated by whence.  Values
        for whence are ints:

        * 0 -- start of stream (the default); offset should be zero or positive
        * 1 -- current stream position; offset may be negative
        * 2 -- end of stream; offset is usually negative
        Some operating systems / file systems could provide additional values.

        Return an int indicating the new absolute position.
        �seekN)rT)rD�pos�whencer?r?r@rUGszIOBase.seekcCs|jdd�S)z5Return an int indicating the current stream position.rr
)rU)rDr?r?r@�tellWszIOBase.tellNcCs|jd�dS)z�Truncate file to size bytes.

        Size defaults to the current IO position as reported by tell().  Return
        the new size.
        �truncateN)rT)rDrVr?r?r@rY[szIOBase.truncatecCs|j�dS)zuFlush write buffers, if applicable.

        This is not implemented for read-only and non-blocking streams.
        N)�_checkClosed)rDr?r?r@�flusheszIOBase.flushFcCs |jsz|j�Wdd|_XdS)ziFlush and close the IO object.

        This method has no effect if the file is already closed.
        NT)�_IOBase__closedr[)rDr?r?r@r3oszIOBase.closec	Csy|j�WnYnXdS)zDestructor.  Calls close().N)r3)rDr?r?r@�__del__zszIOBase.__del__cCsdS)z�Return a bool indicating whether object supports random access.

        If False, seek(), tell() and truncate() will raise OSError.
        This method may need to do a test seek().
        Fr?)rDr?r?r@�seekable�szIOBase.seekablecCs |j�st|dkrdn|��dS)zEInternal: raise UnsupportedOperation if file is not seekable
        NzFile or stream is not seekable.)r^rP)rD�msgr?r?r@�_checkSeekable�szIOBase._checkSeekablecCsdS)zvReturn a bool indicating whether object was opened for reading.

        If False, read() will raise OSError.
        Fr?)rDr?r?r@�readable�szIOBase.readablecCs |j�st|dkrdn|��dS)zEInternal: raise UnsupportedOperation if file is not readable
        NzFile or stream is not readable.)rarP)rDr_r?r?r@�_checkReadable�szIOBase._checkReadablecCsdS)z�Return a bool indicating whether object was opened for writing.

        If False, write() and truncate() will raise OSError.
        Fr?)rDr?r?r@�writable�szIOBase.writablecCs |j�st|dkrdn|��dS)zEInternal: raise UnsupportedOperation if file is not writable
        NzFile or stream is not writable.)rcrP)rDr_r?r?r@�_checkWritable�szIOBase._checkWritablecCs|jS)z�closed: bool.  True iff the file has been closed.

        For backwards compatibility, this is a property, not a predicate.
        )r\)rDr?r?r@�closed�sz
IOBase.closedcCs|jrt|dkrdn|��dS)z7Internal: raise a ValueError if file is closed
        NzI/O operation on closed file.)rer")rDr_r?r?r@rZ�szIOBase._checkClosedcCs|j�|S)zCContext management protocol.  Returns self (an instance of IOBase).)rZ)rDr?r?r@�	__enter__�szIOBase.__enter__cGs|j�dS)z+Context management protocol.  Calls close()N)r3)rDrMr?r?r@�__exit__�szIOBase.__exit__cCs|jd�dS)z�Returns underlying file descriptor (an int) if one exists.

        An OSError is raised if the IO object does not use a file descriptor.
        r*N)rT)rDr?r?r@r*�sz
IOBase.filenocCs|j�dS)z{Return a bool indicating whether this is an 'interactive' stream.

        Return False if it can't be determined.
        F)rZ)rDr?r?r@r'�sz
IOBase.isattyr
cs�t�d�r��fdd�}ndd�}�dkr0d
�nt�t�sBtd��t�}x>�dks^t|��kr��j|��}|spP||7}|jd	�rJPqJWt|�S)aNRead and return a line of bytes from the stream.

        If size is specified, at most size bytes will be read.
        Size should be an int.

        The line terminator is always b'\n' for binary files; for text
        files, the newlines argument to open can be used to select the line
        terminator(s) recognized.
        �peekcs>�jd�}|sdS|jd�dp&t|�}�dkr:t|��}|S)Nr
�
r)rh�findr!�min)Z	readahead�n)rD�sizer?r@�
nreadahead�s

z#IOBase.readline.<locals>.nreadaheadcSsdS)Nr
r?r?r?r?r@rn�sNr
zsize must be an integerrrir)	�hasattrrrr�	bytearrayr!�read�endswithr)rDrmrn�resrr?)rDrmr@�readline�s 
	

zIOBase.readlinecCs|j�|S)N)rZ)rDr?r?r@�__iter__szIOBase.__iter__cCs|j�}|st�|S)N)rt�
StopIteration)rD�liner?r?r@�__next__szIOBase.__next__cCsR|dks|dkrt|�Sd}g}x,|D]$}|j|�|t|�7}||kr&Pq&W|S)z�Return a list of lines from the stream.

        hint can be specified to control the number of lines read: no more
        lines will be read if the total size (in bytes/characters) of all
        lines so far exceeds hint.
        Nr)�list�appendr!)rDZhintrl�linesrwr?r?r@�	readliness

zIOBase.readlinescCs$|j�x|D]}|j|�qWdS)N)rZ�write)rDr{rwr?r?r@�
writelines#s
zIOBase.writelines)r)N)N)N)N)Nr)r)N)rHrIrJrCrTrUrXrYr[r\r3r]r^r`rarbrcrd�propertyrerZrfrgr*r'rtrurxr|r~r?r?r?r@rQs4 






	

%
rQ)�	metaclassc@s2eZdZdZd
dd�Zdd�Zdd�Zd	d
�ZdS)�	RawIOBasezBase class for raw binary I/O.r
cCsP|dkrd}|dkr|j�St|j��}|j|�}|dkr>dS||d�=t|�S)z�Read and return up to size bytes, where size is an int.

        Returns an empty bytes object on EOF, or None if the object is
        set not to block and has no data to read.
        Nr
rr)�readallrp�	__index__�readintor)rDrmrrlr?r?r@rq9s

zRawIOBase.readcCs8t�}x|jt�}|sP||7}qW|r0t|�S|SdS)z+Read until EOF, using multiple read() call.N)rprqr(r)rDrs�datar?r?r@r�Js
zRawIOBase.readallcCs|jd�dS)z�Read bytes into a pre-allocated bytes-like object b.

        Returns an int representing the number of bytes read (0 for EOF), or
        None if the object is set not to block and has no data to read.
        r�N)rT)rDrr?r?r@r�XszRawIOBase.readintocCs|jd�dS)z�Write the given buffer to the IO stream.

        Returns the number of bytes written, which may be less than the
        length of b in bytes.
        r}N)rT)rDrr?r?r@r}`szRawIOBase.writeNr)r)rHrIrJrCrqr�r�r}r?r?r?r@r�+s

r�)r&c@sLeZdZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�BufferedIOBaseaBase class for buffered IO objects.

    The main difference with RawIOBase is that the read() method
    supports omitting the size argument, and does not have a default
    implementation that defers to readinto().

    In addition, read(), readinto() and write() may raise
    BlockingIOError if the underlying raw stream is in non-blocking
    mode and not ready; unlike their raw counterparts, they will never
    return None.

    A typical implementation should not inherit from a RawIOBase
    implementation, but wrap one.
    NcCs|jd�dS)a�Read and return up to size bytes, where size is an int.

        If the argument is omitted, None, or negative, reads and
        returns all data until EOF.

        If the argument is positive, and the underlying raw stream is
        not 'interactive', multiple raw reads may be issued to satisfy
        the byte count (unless EOF is reached first).  But for
        interactive raw streams (XXX and for pipes?), at most one raw
        read will be issued, and a short result does not imply that
        EOF is imminent.

        Returns an empty bytes array on EOF.

        Raises BlockingIOError if the underlying raw stream has no
        data at the moment.
        rqN)rT)rDrmr?r?r@rq~szBufferedIOBase.readcCs|jd�dS)zaRead up to size bytes with at most one read() system call,
        where size is an int.
        �read1N)rT)rDrmr?r?r@r��szBufferedIOBase.read1cCs|j|dd�S)afRead bytes into a pre-allocated bytes-like object b.

        Like read(), this may issue multiple reads to the underlying raw
        stream, unless the latter is 'interactive'.

        Returns an int representing the number of bytes read (0 for EOF).

        Raises BlockingIOError if the underlying raw stream has no
        data at the moment.
        F)r�)�	_readinto)rDrr?r?r@r��szBufferedIOBase.readintocCs|j|dd�S)z�Read bytes into buffer *b*, using at most one system call

        Returns an int representing the number of bytes read (0 for EOF).

        Raises BlockingIOError if the underlying raw stream has no
        data at the moment.
        T)r�)r�)rDrr?r?r@�	readinto1�s	zBufferedIOBase.readinto1cCsVt|t�st|�}|jd�}|r0|jt|��}n|jt|��}t|�}||d|�<|S)N�B)r�
memoryview�castr�r!rq)rDrr�r�rlr?r?r@r��s

zBufferedIOBase._readintocCs|jd�dS)aWrite the given bytes buffer to the IO stream.

        Return the number of bytes written, which is always the length of b
        in bytes.

        Raises BlockingIOError if the buffer is full and the
        underlying raw stream cannot accept more data at the moment.
        r}N)rT)rDrr?r?r@r}�s	zBufferedIOBase.writecCs|jd�dS)z�
        Separate the underlying raw stream from the buffer and return it.

        After the raw stream has been detached, the buffer is in an unusable
        state.
        �detachN)rT)rDr?r?r@r��szBufferedIOBase.detach)N)N)rHrIrJrCrqr�r�r�r�r}r�r?r?r?r@r�ms

r�c@s�eZdZdZdd�Zd$dd�Zdd�Zd%d
d�Zdd
�Zdd�Z	dd�Z
dd�Zedd��Z
edd��Zedd��Zedd��Zdd�Zdd�Zd d!�Zd"d#�Zd	S)&�_BufferedIOMixinz�A mixin implementation of BufferedIOBase with an underlying raw stream.

    This passes most requests on to the underlying raw stream.  It
    does *not* provide implementations of read(), readinto() or
    write().
    cCs
||_dS)N)�_raw)rDr;r?r?r@�__init__�sz_BufferedIOMixin.__init__rcCs"|jj||�}|dkrtd��|S)Nrz#seek() returned an invalid position)r;rUr,)rDrVrWZnew_positionr?r?r@rU�sz_BufferedIOMixin.seekcCs|jj�}|dkrtd��|S)Nrz#tell() returned an invalid position)r;rXr,)rDrVr?r?r@rX�s
z_BufferedIOMixin.tellNcCs$|j�|dkr|j�}|jj|�S)N)r[rXr;rY)rDrVr?r?r@rY�sz_BufferedIOMixin.truncatecCs|jrtd��|jj�dS)Nzflush of closed file)rer"r;r[)rDr?r?r@r[�sz_BufferedIOMixin.flushc
Cs0|jdk	r,|jr,z|j�Wd|jj�XdS)N)r;rer[r3)rDr?r?r@r3sz_BufferedIOMixin.closecCs*|jdkrtd��|j�|j}d|_|S)Nzraw stream already detached)r;r"r[r�)rDr;r?r?r@r�s
z_BufferedIOMixin.detachcCs
|jj�S)N)r;r^)rDr?r?r@r^sz_BufferedIOMixin.seekablecCs|jS)N)r�)rDr?r?r@r;sz_BufferedIOMixin.rawcCs|jjS)N)r;re)rDr?r?r@resz_BufferedIOMixin.closedcCs|jjS)N)r;rS)rDr?r?r@rS!sz_BufferedIOMixin.namecCs|jjS)N)r;r2)rDr?r?r@r2%sz_BufferedIOMixin.modecCstdj|jj���dS)Nz can not serialize a '{0}' object)r�formatrRrH)rDr?r?r@�__getstate__)sz_BufferedIOMixin.__getstate__cCsJ|jj}|jj}y
|j}Wntk
r6dj||�SXdj|||�SdS)Nz<{}.{}>z<{}.{} name={!r}>)rRrIrJrS�	Exceptionr�)rD�modnameZclsnamerSr?r?r@�__repr__-s
z_BufferedIOMixin.__repr__cCs
|jj�S)N)r;r*)rDr?r?r@r*9sz_BufferedIOMixin.filenocCs
|jj�S)N)r;r')rDr?r?r@r'<sz_BufferedIOMixin.isatty)r)N)rHrIrJrCr�rUrXrYr[r3r�r^rr;rerSr2r�r�r*r'r?r?r?r@r��s"


r�cs�eZdZdZd dd�Zdd�Zdd�Zd	d
�Z�fdd�Zd!d
d�Z	dd�Z
dd�Zd"dd�Zdd�Z
d#dd�Zdd�Zdd�Zdd�Z�ZS)$�BytesIOz<Buffered I/O implementation using an in-memory bytes buffer.NcCs&t�}|dk	r||7}||_d|_dS)Nr)rp�_buffer�_pos)rDZ
initial_bytes�bufr?r?r@r�Ds
zBytesIO.__init__cCs|jrtd��|jj�S)Nz__getstate__ on closed file)rer"�__dict__�copy)rDr?r?r@r�KszBytesIO.__getstate__cCs|jrtd��t|j�S)z8Return the bytes value (contents) of the buffer
        zgetvalue on closed file)rer"rr�)rDr?r?r@�getvaluePszBytesIO.getvaluecCs|jrtd��t|j�S)z;Return a readable and writable view of the buffer.
        zgetbuffer on closed file)rer"r�r�)rDr?r?r@�	getbufferWszBytesIO.getbuffercs|jj�t�j�dS)N)r��clear�superr3)rD)rRr?r@r3^s
z
BytesIO.closecCst|jrtd��|dkrd}|dkr,t|j�}t|j�|jkr@dStt|j�|j|�}|j|j|�}||_t|�S)Nzread from closed filer
r�r)rer"r!r�r�rkr)rDrmZnewposrr?r?r@rqbs
zBytesIO.readcCs
|j|�S)z"This is the same as read.
        )rq)rDrmr?r?r@r�psz
BytesIO.read1cCs�|jrtd��t|t�r td��t|��}|j}WdQRX|dkrFdS|j}|t|j	�krzd|t|j	�}|j	|7_	||j	|||�<|j|7_|S)Nzwrite to closed filez can't write str to binary streamr�)
rer"rrrr��nbytesr�r!r�)rDrZviewrlrVZpaddingr?r?r@r}us

z
BytesIO.writercCs�|jrtd��y
|jWn,tk
rD}ztd�|�WYdd}~XnX|dkrl|dkrdtd|f��||_nD|dkr�td|j|�|_n(|dkr�tdt|j�|�|_ntd��|jS)Nzseek on closed filezan integer is requiredrznegative seek position %rr
rzunsupported whence value)	rer"r�r-rr��maxr!r�)rDrVrW�errr?r?r@rU�s 
zBytesIO.seekcCs|jrtd��|jS)Nztell on closed file)rer"r�)rDr?r?r@rX�szBytesIO.tellcCs||jrtd��|dkr|j}nNy
|jWn,tk
rT}ztd�|�WYdd}~XnX|dkrltd|f��|j|d�=|S)Nztruncate on closed filezan integer is requiredrznegative truncate position %r)rer"r�r�r-rr�)rDrVr�r?r?r@rY�s
zBytesIO.truncatecCs|jrtd��dS)NzI/O operation on closed file.T)rer")rDr?r?r@ra�szBytesIO.readablecCs|jrtd��dS)NzI/O operation on closed file.T)rer")rDr?r?r@rc�szBytesIO.writablecCs|jrtd��dS)NzI/O operation on closed file.T)rer")rDr?r?r@r^�szBytesIO.seekable)N)N)r)N)rHrIrJrCr�r�r�r�r3rqr�r}rUrXrYrarcr^�
__classcell__r?r?)rRr@r�@s



r�c@sveZdZdZefdd�Zdd�Zdd�Zdd	d
�Zddd�Z	ddd�Z
ddd�Zdd�Zdd�Z
dd�Zddd�ZdS)r0aBufferedReader(raw[, buffer_size])

    A buffer for a readable, sequential BaseRawIO object.

    The constructor creates a BufferedReader for the given readable raw
    stream and buffer_size. If buffer_size is omitted, DEFAULT_BUFFER_SIZE
    is used.
    cCsF|j�std��tj||�|dkr,td��||_|j�t�|_dS)zMCreate a new buffered reader using the given readable raw IO object.
        z "raw" argument must be readable.rzinvalid buffer sizeN)	rar,r�r�r"�buffer_size�_reset_read_buf�Lock�
_read_lock)rDr;r�r?r?r@r��szBufferedReader.__init__cCs
|jj�S)N)r;ra)rDr?r?r@ra�szBufferedReader.readablecCsd|_d|_dS)Nr�r)�	_read_buf�	_read_pos)rDr?r?r@r��szBufferedReader._reset_read_bufNc	Cs4|dk	r|dkrtd��|j�|j|�SQRXdS)z�Read size bytes.

        Returns exactly size bytes of data unless the underlying raw IO
        stream reaches EOF or if the call would block in non-blocking
        mode. If size is negative, read until EOF or until read() would
        block.
        Nr
zinvalid number of bytes to readr)r"r��_read_unlocked)rDrmr?r?r@rq�szBufferedReader.readcCs�d}d}|j}|j}|dks$|dkr�|j�t|jd�rj|jj�}|dkrZ||d�pXdS||d�|S||d�g}d}x2|jj�}||kr�|}P|t|�7}|j|�q~Wdj	|�p�|St|�|}	||	kr�|j|7_||||�S||d�g}t
|j|�}
xB|	|k�rL|jj|
�}||k�r2|}P|	t|�7}	|j|��qWt||	�}dj	|�}||d�|_d|_|�r�|d|�S|S)Nr�r
r�r)r�Nr)
r�r�r�ror;r�rqr!rz�joinr�r�rk)rDrlZ
nodata_valZempty_valuesr�rV�chunkZchunksZcurrent_size�availZwanted�outr?r?r@r��sN




zBufferedReader._read_unlockedrc	Cs|j�|j|�SQRXdS)z�Returns buffered bytes without advancing the position.

        The argument indicates a desired minimal number of bytes; we
        do at most one raw read to satisfy it.  We never return more
        than self.buffer_size.
        N)r��_peek_unlocked)rDrmr?r?r@rhszBufferedReader.peekcCsrt||j�}t|j�|j}||ks,|dkrb|j|}|jj|�}|rb|j|jd�||_d|_|j|jd�S)Nr)rkr�r!r�r�r;rq)rDrlZwantZhaveZto_readZcurrentr?r?r@r�)s
zBufferedReader._peek_unlockedcCsT|dkrtd��|dkrdS|j�(|jd�|jt|t|j�|j��SQRXdS)z<Reads up to size bytes, with at most one read() system call.rz(number of bytes to read must be positiver�r
N)r"r�r�r�rkr!r�r�)rDrmr?r?r@r�4s
zBufferedReader.read1cCst|t�st|�}|jdkr dS|jd�}d}|j��x�|t|�k�rtt|j�|jt|��}|r�|j|j|j|�||||�<|j|7_||7}|t|�kr�Pt|�||j	kr�|j
j||d��}|s�P||7}n|o�|s�|jd�s�P|r8|r8Pq8WWdQRX|S)z2Read data into *buf* with at most one system call.rr�Nr
)
rr�r�r�r�r!rkr�r�r�r;r�r�)rDr�r��writtenr�rlr?r?r@r�Fs4


"

zBufferedReader._readintocCstj|�t|j�|jS)N)r�rXr!r�r�)rDr?r?r@rXtszBufferedReader.tellcCsX|tkrtd��|j�8|dkr4|t|j�|j8}tj|||�}|j�|SQRXdS)Nzinvalid whence valuer
)	�valid_seek_flagsr"r�r!r�r�r�rUr�)rDrVrWr?r?r@rUwszBufferedReader.seek)N)N)r)r)r)rHrIrJrCr(r�rar�rqr�rhr�r�r�rXrUr?r?r?r@r0�s	


4


.r0c@sXeZdZdZefdd�Zdd�Zdd�Zdd	d
�Zdd�Z	d
d�Z
dd�Zddd�ZdS)r/z�A buffer for a writeable sequential RawIO object.

    The constructor creates a BufferedWriter for the given writeable raw
    stream. If the buffer_size is not given, it defaults to
    DEFAULT_BUFFER_SIZE.
    cCsF|j�std��tj||�|dkr,td��||_t�|_t�|_	dS)Nz "raw" argument must be writable.rzinvalid buffer size)
rcr,r�r�r"r�rp�
_write_bufr��_write_lock)rDr;r�r?r?r@r��szBufferedWriter.__init__cCs
|jj�S)N)r;rc)rDr?r?r@rc�szBufferedWriter.writablecCs�|jrtd��t|t�r td��|j��t|j�|jkr@|j	�t|j�}|jj
|�t|j�|}t|j�|jkr�y|j	�Wnltk
r�}zPt|j�|jkr�t|j�|j}||8}|jd|j�|_t|j|j
|��WYdd}~XnX|SQRXdS)Nzwrite to closed filez can't write str to binary stream)rer"rrrr�r!r�r��_flush_unlocked�extend�BlockingIOError�errno�strerror)rDrZbeforer��eZoverager?r?r@r}�s(

"zBufferedWriter.writeNc	Cs8|j�(|j�|dkr"|jj�}|jj|�SQRXdS)N)r�r�r;rXrY)rDrVr?r?r@rY�s

zBufferedWriter.truncatec	Cs|j�|j�WdQRXdS)N)r�r�)rDr?r?r@r[�szBufferedWriter.flushcCs�|jrtd��xz|jr�y|jj|j�}Wntk
rDtd��YnX|dkr\ttjdd��|t	|j�ksr|dkrzt
d��|jd|�=qWdS)Nzflush of closed filezHself.raw should implement RawIOBase: it should not raise BlockingIOErrorz)write could not complete without blockingrz*write() returned incorrect number of bytes)rer"r�r;r}r��RuntimeErrorr�ZEAGAINr!r,)rDrlr?r?r@r��szBufferedWriter._flush_unlockedcCstj|�t|j�S)N)r�rXr!r�)rDr?r?r@rX�szBufferedWriter.tellrcCs8|tkrtd��|j�|j�tj|||�SQRXdS)Nzinvalid whence value)r�r"r�r�r�rU)rDrVrWr?r?r@rU�s
zBufferedWriter.seek)N)r)
rHrIrJrCr(r�rcr}rYr[r�rXrUr?r?r?r@r/�s
r/c@s�eZdZdZefdd�Zddd�Zdd�Zd	d
�Zddd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zedd��ZdS) �BufferedRWPaira�A buffered reader and writer object together.

    A buffered reader object and buffered writer object put together to
    form a sequential IO object that can read and write. This is typically
    used with a socket or two-way pipe.

    reader and writer are RawIOBase objects that are readable and
    writeable respectively. If the buffer_size is omitted it defaults to
    DEFAULT_BUFFER_SIZE.
    cCs<|j�std��|j�s td��t||�|_t||�|_dS)zEConstructor.

        The arguments are two RawIO instances.
        z#"reader" argument must be readable.z#"writer" argument must be writable.N)rar,rcr0�readerr/�writer)rDr�r�r�r?r?r@r��szBufferedRWPair.__init__NcCs|dkrd}|jj|�S)Nr
r)r�rq)rDrmr?r?r@rq�szBufferedRWPair.readcCs|jj|�S)N)r�r�)rDrr?r?r@r��szBufferedRWPair.readintocCs|jj|�S)N)r�r})rDrr?r?r@r}szBufferedRWPair.writercCs|jj|�S)N)r�rh)rDrmr?r?r@rhszBufferedRWPair.peekcCs|jj|�S)N)r�r�)rDrmr?r?r@r�szBufferedRWPair.read1cCs|jj|�S)N)r�r�)rDrr?r?r@r�
szBufferedRWPair.readinto1cCs
|jj�S)N)r�ra)rDr?r?r@ra
szBufferedRWPair.readablecCs
|jj�S)N)r�rc)rDr?r?r@rcszBufferedRWPair.writablecCs
|jj�S)N)r�r[)rDr?r?r@r[szBufferedRWPair.flushc
Cs z|jj�Wd|jj�XdS)N)r�r3r�)rDr?r?r@r3szBufferedRWPair.closecCs|jj�p|jj�S)N)r�r'r�)rDr?r?r@r'szBufferedRWPair.isattycCs|jjS)N)r�re)rDr?r?r@reszBufferedRWPair.closed)N)r)rHrIrJrCr(r�rqr�r}rhr�r�rarcr[r3r'rrer?r?r?r@r��s

r�c@sleZdZdZefdd�Zddd�Zdd�Zdd
d�Zddd
�Z	dd�Z
ddd�Zdd�Zdd�Z
dd�Zd	S)r.z�A buffered interface to random access streams.

    The constructor creates a reader and writer for a seekable stream,
    raw, given in the first argument. If the buffer_size is omitted it
    defaults to DEFAULT_BUFFER_SIZE.
    cCs(|j�tj|||�tj|||�dS)N)r`r0r�r/)rDr;r�r?r?r@r�-szBufferedRandom.__init__rcCs�|tkrtd��|j�|jrJ|j� |jj|jt|j�d�WdQRX|jj||�}|j�|j	�WdQRX|dkr�t
d��|S)Nzinvalid whence valuer
rz seek() returned invalid position)r�r"r[r�r�r;rUr�r!r�r,)rDrVrWr?r?r@rU2s$zBufferedRandom.seekcCs|jrtj|�Stj|�SdS)N)r�r/rXr0)rDr?r?r@rXCs
zBufferedRandom.tellNcCs|dkr|j�}tj||�S)N)rXr/rY)rDrVr?r?r@rYIszBufferedRandom.truncatecCs |dkrd}|j�tj||�S)Nr
r)r[r0rq)rDrmr?r?r@rqOszBufferedRandom.readcCs|j�tj||�S)N)r[r0r�)rDrr?r?r@r�UszBufferedRandom.readintocCs|j�tj||�S)N)r[r0rh)rDrmr?r?r@rhYszBufferedRandom.peekcCs|j�tj||�S)N)r[r0r�)rDrmr?r?r@r�]szBufferedRandom.read1cCs|j�tj||�S)N)r[r0r�)rDrr?r?r@r�aszBufferedRandom.readinto1cCsF|jr:|j�(|jj|jt|j�d�|j�WdQRXtj||�S)Nr
)	r�r�r;rUr�r!r�r/r})rDrr?r?r@r}es
zBufferedRandom.write)r)N)N)r)rHrIrJrCr(r�rUrXrYrqr�rhr�r�r}r?r?r?r@r.$s



r.cs�eZdZd0ZdZdZdZdZdZdZ	d1dd�Z
dd	�Zd
d�Zdd
�Z
dd�Zd2dd�Zd3dd�Zdd�Zdd�Zdd�Zefdd�Zdd�Zd4dd�Z�fd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zed,d-��Zed.d/��Z �Z!S)5r&r
FNTrc
Cs
|jdkr*z|jrtj|j�Wdd|_Xt|t�r<td��t|t�r\|}|dkr`td��nd}t|t	�sxtd|f��t
|�t
d�ks�td|f��tdd	�|D��dks�|jd
�dkr�td��d|kr�d
|_
d
|_tjtjB}nVd|k�r�d
|_d}n@d|k�rd
|_tjtjB}n"d|k�r:d
|_d
|_tjtjB}d
|k�rPd
|_d
|_|j�rl|j�rl|tjO}n|j�r�|tjO}n
|tjO}|ttdd�O}ttdd��p�ttdd�}||O}d}�y|dk�r<|�s�td��|dk�r�tj||d�}n0|||�}t|t��std��|dk�r&td��|}|�s<tj|d�||_tj|�}	y(tj|	j��rrt t!j"tj#t!j"�|��Wnt$k
�r�YnXt|	dd�|_%|j%dk�r�t&|_%t'�r�t'|tj(�||_)|j�r�tj*|dt+�Wn"|dk	�r�tj|��YnX||_dS)adOpen a file.  The mode can be 'r' (default), 'w', 'x' or 'a' for reading,
        writing, exclusive creation or appending.  The file will be created if it
        doesn't exist when opened for writing or appending; it will be truncated
        when opened for writing.  A FileExistsError will be raised if it already
        exists when opened for creating. Opening a file for creating implies
        writing so this mode behaves in a similar way to 'w'. Add a '+' to the mode
        to allow simultaneous reading and writing. A custom opener can be used by
        passing a callable as *opener*. The underlying file descriptor for the file
        object is then obtained by calling opener with (*name*, *flags*).
        *opener* must return an open file descriptor (passing os.open as *opener*
        results in functionality similar to passing None).
        rNr
z$integer argument expected, got floatznegative file descriptorzinvalid mode: %szxrwab+css|]}|dkVqdS)ZrwaxNr?)�.0�cr?r?r@�	<genexpr>�sz"FileIO.__init__.<locals>.<genexpr>rzKMust have exactly one of create/read/write/append mode and at most one plusrTrrr�O_BINARYZO_NOINHERIT�	O_CLOEXECz'Cannot use closefd=False with file namei�zexpected integer from openerzNegative file descriptorFr+rr),�_fd�_closefdrr3r�floatrrr"rr �sum�count�_created�	_writable�O_EXCL�O_CREAT�	_readable�O_TRUNC�
_appending�O_APPEND�O_RDWR�O_RDONLY�O_WRONLY�getattrrAr,�set_inheritabler)�stat�S_ISDIR�st_mode�IsADirectoryErrorr�ZEISDIRr�r-�_blksizer(�_setmoder�rS�lseekr	)
rDr4r2r9r�fd�flagsZnoinherit_flagZowned_fdZfdfstatr?r?r@r�ws�




$











zFileIO.__init__cCsD|jdkr@|jr@|jr@ddl}|jd|ftd|d�|j�dS)Nrzunclosed file %rr)�
stacklevel�source)r�r�rer#r$�ResourceWarningr3)rDr#r?r?r@r]�s

zFileIO.__del__cCstd|jj��dS)Nzcannot serialize '%s' object)rrRrH)rDr?r?r@r��szFileIO.__getstate__c
Csld|jj|jjf}|jr"d|Sy
|j}Wn&tk
rRd||j|j|jfSXd|||j|jfSdS)Nz%s.%sz
<%s [closed]>z<%s fd=%d mode=%r closefd=%r>z<%s name=%r mode=%r closefd=%r>)	rRrIrJrerSr-r�r2r�)rD�
class_namerSr?r?r@r��s
zFileIO.__repr__cCs|jstd��dS)NzFile not open for reading)r�rP)rDr?r?r@rbszFileIO._checkReadablecCs|jstd��dS)NzFile not open for writing)r�rP)rDr_r?r?r@rdszFileIO._checkWritablecCsP|j�|j�|dks |dkr(|j�Sytj|j|�Stk
rJdSXdS)z�Read at most size bytes, returned as bytes.

        Only makes one system call, so less data may be returned than requested
        In non-blocking mode, returns None if no data is available.
        Return an empty bytes object at EOF.
        Nr)rZrbr�rrqr�r�)rDrmr?r?r@rqszFileIO.readcCs�|j�|j�t}y6tj|jdt�}tj|j�j}||krH||d}Wnt	k
r^YnXt
�}xnt|�|kr�t|�}|t|t�7}|t|�}ytj
|j|�}Wntk
r�|r�PdSX|s�P||7}qhWt|�S)z�Read all data from the file, returned as bytes.

        In non-blocking mode, returns as much as is immediately available,
        or None if no data is available.  Return an empty bytes object at EOF.
        rr
N)rZrbr(rr�r�rr)�st_sizer,rpr!r�rqr�r)rD�bufsizerV�endr<rlr�r?r?r@r�s4zFileIO.readallcCs4t|�jd�}|jt|��}t|�}||d|�<|S)zSame as RawIOBase.readinto().r�N)r�r�rqr!)rDr�mr�rlr?r?r@r�?s
zFileIO.readintocCs8|j�|j�ytj|j|�Stk
r2dSXdS)aWrite bytes b to file, return number written.

        Only makes one system call, so not all of the data may be written.
        The number of bytes actually written is returned.  In non-blocking mode,
        returns None if the write would block.
        N)rZrdrr}r�r�)rDrr?r?r@r}GszFileIO.writecCs*t|t�rtd��|j�tj|j||�S)a�Move to new file position.

        Argument offset is a byte count.  Optional argument whence defaults to
        SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values
        are SEEK_CUR or 1 (move relative to current position, positive or negative),
        and SEEK_END or 2 (move relative to end of file, usually negative, although
        many platforms allow seeking beyond the end of a file).

        Note that not all file objects are seekable.
        zan integer is required)rr�rrZrr�r�)rDrVrWr?r?r@rUUs
zFileIO.seekcCs|j�tj|jdt�S)zYtell() -> int.  Current file position.

        Can raise OSError for non seekable files.r)rZrr�r�r)rDr?r?r@rXeszFileIO.tellcCs2|j�|j�|dkr |j�}tj|j|�|S)z�Truncate the file to at most size bytes.

        Size defaults to the current file position, as returned by tell().
        The current file position is changed to the value of size.
        N)rZrdrXr�	ftruncater�)rDrmr?r?r@rYlszFileIO.truncatec
s.|js*z|jrtj|j�Wdt�j�XdS)z�Close the file.

        A closed file cannot be used for further I/O operations.  close() may be
        called more than once without error.
        N)rer�rr3r�r�)rD)rRr?r@r3ys
zFileIO.closecCsF|j�|jdkr@y|j�Wntk
r8d|_YnXd|_|jS)z$True if file supports random-access.NFT)rZ�	_seekablerXr,)rDr?r?r@r^�s
zFileIO.seekablecCs|j�|jS)z'True if file was opened in a read mode.)rZr�)rDr?r?r@ra�szFileIO.readablecCs|j�|jS)z(True if file was opened in a write mode.)rZr�)rDr?r?r@rc�szFileIO.writablecCs|j�|jS)z3Return the underlying file descriptor (an integer).)rZr�)rDr?r?r@r*�sz
FileIO.filenocCs|j�tj|j�S)z.True if the file is connected to a TTY device.)rZrr'r�)rDr?r?r@r'�sz
FileIO.isattycCs|jS)z6True if the file descriptor will be closed by close().)r�)rDr?r?r@r9�szFileIO.closefdcCsJ|jr|jrdSdSn0|jr,|jr&dSdSn|jrB|jr<dSdSndSdS)	zString giving the file modezxb+Zxbzab+Zabzrb+�rb�wbN)r�r�r�r�)rDr?r?r@r2�szFileIO.moder)rTN)N)N)N)"rHrIrJr�r�r�r�r�r�r�r�r]r�r�rbrdrqr�r�r}rrUrXrYr3r^rarcr*r'rr9r2r�r?r?)rRr@r&ns8
u

#


r&c@s`eZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
�Ze	dd��Z
e	dd��Ze	dd��ZdS)�
TextIOBasez�Base class for text I/O.

    This class provides a character and line based interface to stream
    I/O. There is no readinto method because Python's character strings
    are immutable. There is no public constructor.
    r
cCs|jd�dS)z�Read at most size characters from stream, where size is an int.

        Read from underlying buffer until we have size characters or we hit EOF.
        If size is negative or omitted, read until EOF.

        Returns a string.
        rqN)rT)rDrmr?r?r@rq�szTextIOBase.readcCs|jd�dS)z.Write string s to stream and returning an int.r}N)rT)rD�sr?r?r@r}�szTextIOBase.writeNcCs|jd�dS)z*Truncate size to pos, where pos is an int.rYN)rT)rDrVr?r?r@rY�szTextIOBase.truncatecCs|jd�dS)z_Read until newline or EOF.

        Returns an empty string if EOF is hit immediately.
        rtN)rT)rDr?r?r@rt�szTextIOBase.readlinecCs|jd�dS)z�
        Separate the underlying buffer from the TextIOBase and return it.

        After the underlying buffer has been detached, the TextIO is in an
        unusable state.
        r�N)rT)rDr?r?r@r��szTextIOBase.detachcCsdS)zSubclasses should override.Nr?)rDr?r?r@r6�szTextIOBase.encodingcCsdS)z�Line endings translated so far.

        Only line endings translated during reading are considered.

        Subclasses should override.
        Nr?)rDr?r?r@�newlines�szTextIOBase.newlinescCsdS)zMError setting of the decoder or encoder.

        Subclasses should override.Nr?)rDr?r?r@r7�szTextIOBase.errorsr)r)N)
rHrIrJrCrqr}rYrtr�rr6r�r7r?r?r?r@r��s


	
r�c@sTeZdZdZddd�Zddd�Zdd	�Zd
d�Zdd
�ZdZ	dZ
dZedd��Z
dS)�IncrementalNewlineDecodera+Codec used when reading a file in universal newlines mode.  It wraps
    another incremental decoder, translating \r\n and \r into \n.  It also
    records the types of newlines encountered.  When used with
    translate=False, it ensures that the newline sequence is returned in
    one piece.
    �strictcCs,tjj||d�||_||_d|_d|_dS)N)r7rF)�codecs�IncrementalDecoderr��	translate�decoder�seennl�	pendingcr)rDr�r�r7r?r?r@r�s
z"IncrementalNewlineDecoder.__init__FcCs�|jdkr|}n|jj||d�}|jr<|s.|r<d|}d|_|jd�r^|r^|dd�}d|_|jd�}|jd�|}|jd�|}|j|o�|j|o�|jB|o�|jBO_|j	r�|r�|j
dd�}|r�|j
dd�}|S)	N)�final�
Fr
Tz
�
r)r��decoder�rrr�r��_LF�_CR�_CRLFr��replace)rD�inputr��outputZcrlfZcrZlfr?r?r@r�s(

"z IncrementalNewlineDecoder.decodecCs@|jdkrd}d}n|jj�\}}|dK}|jr8|dO}||fS)Nr�rr
)r��getstater�)rDr��flagr?r?r@r2s
z"IncrementalNewlineDecoder.getstatecCs8|\}}t|d@�|_|jdk	r4|jj||d?f�dS)Nr
)�boolr�r��setstate)rD�stater�rr?r?r@r=s
z"IncrementalNewlineDecoder.setstatecCs$d|_d|_|jdk	r |jj�dS)NrF)r�r�r��reset)rDr?r?r@rCs
zIncrementalNewlineDecoder.resetr
r�c
Cs
d|jS)	Nr�r��
�r�r��r�r�r�r�r�r�r)Nr�r�r	rr
rr)r�)rDr?r?r@r�Msz"IncrementalNewlineDecoder.newlinesN)r�)F)rHrIrJrCr�r�rrrr�r�r�rr�r?r?r?r@r�s

r�c@s>eZdZdZdZdFdd�Zdd�Zed	d
��Zedd��Z	ed
d��Z
edd��Zdd�Zdd�Z
dd�Zdd�Zdd�Zedd��Zedd��Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�ZdGd+d,�Zd-d.�Zd/d0�ZdHd2d3�Zd4d5�Zd6d7�ZdId8d9�Zd:d;�Z dJd<d=�Z!dKd>d?�Z"d@dA�Z#dLdBdC�Z$edDdE��Z%dS)Mr1aCharacter and line based layer over a BufferedIOBase object, buffer.

    encoding gives the name of the encoding that the stream will be
    decoded or encoded with. It defaults to locale.getpreferredencoding(False).

    errors determines the strictness of encoding and decoding (see the
    codecs.register) and defaults to "strict".

    newline can be None, '', '\n', '\r', or '\r\n'.  It controls the
    handling of line endings. If it is None, universal newlines is
    enabled.  With this enabled, on input, the lines endings '\n', '\r',
    or '\r\n' are translated to '\n' before being returned to the
    caller. Conversely, on output, '\n' is translated to the system
    default line separator, os.linesep. If newline is any other of its
    legal values, that newline becomes the newline when the file is read
    and it is returned untranslated. On output, '\n' is converted to the
    newline.

    If line_buffering is True, a call to flush is implied when a call to
    write contains a newline character.
    iNFc
Cs�|dk	r&t|t�r&tdt|�f��|dkr<td|f��|dkr�ytj|j��}Wntt	fk
rnYnX|dkr�yddl
}Wntk
r�d}YnX|jd	�}t|t�s�td
|��t
j|�js�d}t||��|dkr�d}nt|t��std
|��||_||_||_||_||_|dk|_||_|dk|_|�pDtj|_d|_d|_d|_d|_d|_|j j!�|_"|_#t$|j d�|_%d|_&|j"�r�|j'��r�|j j(�}	|	dk�r�y|j)�j*d�Wntk
�r�YnXdS)Nzillegal newline type: %rrr�r��
zillegal newline value: %rr�asciiFzinvalid encoding: %rzG%r is not a text encoding; use codecs.open() to handle arbitrary codecsr�zinvalid errors: %rr�g)Nrr�r�r
)+rrr�typer"r�device_encodingr*r-rP�locale�ImportError�getpreferredencodingr��lookup�_is_text_encoding�LookupErrorr��_line_buffering�	_encoding�_errors�_readuniversal�_readtranslate�_readnl�_writetranslate�linesep�_writenl�_encoder�_decoder�_decoded_chars�_decoded_chars_used�	_snapshotr>r^r��_tellingro�
_has_read1�	_b2cratiorcrX�_get_encoderr)
rDr>r6r7r8r=�
write_throughrr_�positionr?r?r@r�ws`






zTextIOWrapper.__init__cCs�dj|jj|jj�}y
|j}Wntk
r2YnX|dj|�7}y
|j}Wntk
r`YnX|dj|�7}|dj|j�S)Nz<{}.{}z name={0!r}z mode={0!r}z encoding={0!r}>)r�rRrIrJrSr�r2r6)rDr<rSr2r?r?r@r��s



zTextIOWrapper.__repr__cCs|jS)N)r)rDr?r?r@r6�szTextIOWrapper.encodingcCs|jS)N)r)rDr?r?r@r7�szTextIOWrapper.errorscCs|jS)N)r)rDr?r?r@r=�szTextIOWrapper.line_bufferingcCs|jS)N)r�)rDr?r?r@r>�szTextIOWrapper.buffercCs|jrtd��|jS)NzI/O operation on closed file.)rer"r�)rDr?r?r@r^�szTextIOWrapper.seekablecCs
|jj�S)N)r>ra)rDr?r?r@ra�szTextIOWrapper.readablecCs
|jj�S)N)r>rc)rDr?r?r@rc�szTextIOWrapper.writablecCs|jj�|j|_dS)N)r>r[r�r%)rDr?r?r@r[�s
zTextIOWrapper.flushc
Cs0|jdk	r,|jr,z|j�Wd|jj�XdS)N)r>rer[r3)rDr?r?r@r3�szTextIOWrapper.closecCs|jjS)N)r>re)rDr?r?r@re�szTextIOWrapper.closedcCs|jjS)N)r>rS)rDr?r?r@rS�szTextIOWrapper.namecCs
|jj�S)N)r>r*)rDr?r?r@r*�szTextIOWrapper.filenocCs
|jj�S)N)r>r')rDr?r?r@r'�szTextIOWrapper.isattycCs�|jrtd��t|t�s(td|jj��t|�}|js<|j	oBd|k}|rf|jrf|j
dkrf|jd|j
�}|jpr|j
�}|j|�}|jj|�|j	r�|s�d|kr�|j�|jd�d|_|jr�|jj�|S)zWrite data, where s is a strzwrite to closed filezcan't write %s to text streamr�r�rN)rer"rrrrRrHr!rrrr�r r(�encoder>r}r[�_set_decoded_charsr$r!r)rDr�ZlengthZhaslf�encoderrr?r?r@r}s&



zTextIOWrapper.writecCstj|j�}||j�|_|jS)N)r��getincrementalencoderrrr )rDZmake_encoderr?r?r@r(szTextIOWrapper._get_encodercCs2tj|j�}||j�}|jr(t||j�}||_|S)N)r��getincrementaldecoderrrrr�rr!)rDZmake_decoderr�r?r?r@�_get_decoders
zTextIOWrapper._get_decodercCs||_d|_dS)zSet the _decoded_chars buffer.rN)r"r#)rD�charsr?r?r@r,)sz TextIOWrapper._set_decoded_charscCsF|j}|dkr|j|d�}n|j|||�}|jt|�7_|S)z'Advance into the _decoded_chars buffer.N)r#r"r!)rDrl�offsetr1r?r?r@�_get_decoded_chars.sz TextIOWrapper._get_decoded_charscCs$|j|krtd��|j|8_dS)z!Rewind the _decoded_chars buffer.z"rewind decoded_chars out of boundsN)r#�AssertionError)rDrlr?r?r@�_rewind_decoded_chars8s
z#TextIOWrapper._rewind_decoded_charscCs�|jdkrtd��|jr&|jj�\}}|jr<|jj|j�}n|jj|j�}|}|jj	||�}|j
|�|r�t|�t|j�|_
nd|_
|jr�|||f|_|S)zQ
        Read and decode the next chunk of data from the BufferedReader.
        Nz
no decoderg)r!r"r%rr&r>r��_CHUNK_SIZErqr�r,r!r"r'r$)rD�
dec_buffer�	dec_flags�input_chunk�eofZ
decoded_charsr?r?r@�_read_chunk>s 

zTextIOWrapper._read_chunkrcCs(||d>B|d>B|d>Bt|�d>BS)N�@���)r)rDr*r8�
bytes_to_feed�need_eof�
chars_to_skipr?r?r@�_pack_cookiehszTextIOWrapper._pack_cookiecCsFt|d�\}}t|d�\}}t|d�\}}t|d�\}}|||||fS)Nr
r<llll)�divmod)rDZbigint�restr*r8r@rArBr?r?r@�_unpack_cookiers
zTextIOWrapper._unpack_cookiecCsN|jstd��|jstd��|j�|jj�}|j}|dksF|jdkrX|j	rTt
d��|S|j\}}|t|�8}|j}|dkr�|j
||�S|j�}�z�t|j|�}d}|t|�ks�t
�x�|dk�r4|jd|f�t|j|d|���}	|	|k�r"|j�\}
}|
�s|}||	8}P|t|
�8}d}q�||8}|d}q�Wd}|jd|f�||}|}
|dk�rj|j
||
�Sd}d}d}x�t|t|��D]v}|d7}|t|j|||d���7}|j�\}}|�r�||k�r�||7}||8}|dd}
}}||k�r�P�q�W|t|jddd	��7}d}||k�r,td
��|j
||
|||�S|j|�XdS)Nz!underlying stream is not seekablez(telling position disabled by next() callzpending decoded textrr
r�rT)r�z'can't reconstruct logical file position)r�rPr%r,r[r>rXr!r$r"r4r!r#rCrrr'rr��range)rDr*r�r8Z
next_inputrBZsaved_stateZ
skip_bytesZ	skip_backrlr�d�	start_posZstart_flagsZ	bytes_fedrAZ
chars_decoded�ir7r?r?r@rXysx





zTextIOWrapper.tellcCs$|j�|dkr|j�}|jj|�S)N)r[rXr>rY)rDrVr?r?r@rY�szTextIOWrapper.truncatecCs*|jdkrtd��|j�|j}d|_|S)Nzbuffer is already detached)r>r"r[r�)rDr>r?r?r@r��s
zTextIOWrapper.detachcs��fdd�}�jrtd���js(td��|dkrL|dkr@td��d}�j�}|dkr�|dkrdtd	���j��jjdd�}�jd
�d�_	�j
r��j
j�||�|S|dkr�td|f��|dkr�td|f���j��j|�\}}}}}	�jj|��jd
�d�_	|dk�r(�j
�r(�j
j�n@�j
�s<|�s<|	�rh�j
�pJ�j
��_
�j
jd
|f�|d
f�_	|	�r��jj|�}
�j�j
j|
|��||
f�_	t�j�|	k�r�td��|	�_||�|S)NcsHy�jp�j�}Wntk
r&YnX|dkr<|jd�n|j�dS)z9Reset the encoder (merely useful for proper BOM handling)rN)r r(rrr)r*r-)rDr?r@�_reset_encoder�sz*TextIOWrapper.seek.<locals>._reset_encoderztell on closed filez!underlying stream is not seekabler
rz#can't do nonzero cur-relative seeksrz#can't do nonzero end-relative seeksrzunsupported whence (%r)znegative seek position %rr�z#can't restore logical file position)rer"r�rPrXr[r>rUr,r$r!rrFr0rrqr�r!r"r,r#)rDZcookierWrKr*rIr8r@rArBr9r?)rDr@rU�s\





zTextIOWrapper.seekcCs�|j�|dkrd}|jp |j�}y
|jWn,tk
rX}ztd�|�WYdd}~XnX|dkr�|j�|j|jj	�dd�}|j
d�d|_|Sd}|j|�}x6t|�|kr�|r�|j
�}||j|t|��7}q�W|SdS)	Nr
zan integer is requiredrT)r�rFr)rbr!r0r�r-rr3r�r>rqr,r$r!r;)rDrmr�r�r<r:r?r?r@rq5	s(



zTextIOWrapper.readcCs(d|_|j�}|s$d|_|j|_t�|S)NF)r%rtr$r�rv)rDrwr?r?r@rxN	szTextIOWrapper.__next__cCs�|jrtd��|dkrd	}nt|t�s.td��|j�}d}|jsH|j�d}}�xR|jr�|j	d|�}|dkrz|d}Pnt
|�}n�|j�r|j	d|�}|j	d|�}|d
kr�|dkr�t
|�}n
|d}PnL|dkr�|d}Pn8||kr�|d}Pn$||dk�r|d}Pn
|d}Pn&|j	|j�}|dk�r>|t
|j�}P|dk�r\t
|�|k�r\|}Px|j
��rv|j�r^P�q^W|j�r�||j�7}qT|jd�d|_|SqTW|dk�r�||k�r�|}|jt
|�|�|d|�S)
Nzread from closed filer
zsize must be an integerrr�r�rrrrrr)rer"rrrr3r!r0rrjr!rrr;r"r,r$r5)rDrmrw�startrV�endposZnlposZcrposr?r?r@rtW	sp




zTextIOWrapper.readlinecCs|jr|jjSdS)N)r!r�)rDr?r?r@r��	szTextIOWrapper.newlines)NNNFF)N)rrrr)N)r)N)N)&rHrIrJrCr6r�r�rr6r7r=r>r^rarcr[r3rerSr*r'r}r(r0r,r3r5r;rCrFrXrYr�rUrqrxrtr�r?r?r?r@r1ZsH
E

*
	c

K
	
Xr1csReZdZdZd�fdd�	Zdd�Zdd	�Zed
d��Zedd
��Z	dd�Z
�ZS)�StringIOz�Text I/O implementation using an in-memory buffer.

    The initial_value argument sets the value of object.  The newline
    argument is like the one of TextIOWrapper's constructor.
    rr�csftt|�jt�dd|d�|dkr(d|_|dk	rbt|t�sNtdjt	|�j
���|j|�|jd�dS)Nzutf-8�
surrogatepass)r6r7r8Fz*initial_value must be str or None, not {0}r)
r�rNr�r�rrrrr�rrHr}rU)rDZ
initial_valuer8)rRr?r@r��	s

zStringIO.__init__cCsL|j�|jp|j�}|j�}|j�z|j|jj�dd�S|j|�XdS)NT)r�)	r[r!r0rrr�r>r�r)rDr�Z	old_stater?r?r@r��	szStringIO.getvaluecCs
tj|�S)N)�objectr�)rDr?r?r@r��	szStringIO.__repr__cCsdS)Nr?)rDr?r?r@r7�	szStringIO.errorscCsdS)Nr?)rDr?r?r@r6�	szStringIO.encodingcCs|jd�dS)Nr�)rT)rDr?r?r@r��	szStringIO.detach)rr�)rHrIrJrCr�r�r�rr7r6r�r�r?r?)rRr@rN�	s
rN>rri r)rrNNNTN)5rCr�abcr�r�r��sys�_threadrr�rZ
_dummy_thread�platformZmsvcrtrr��iorrrr	r�ro�addr�	SEEK_DATAr(r�rArBrKrPr-r,r"�ABCMetarQ�registerr��_ior&r�r�r�r0r/r�r.r�r�r�r1rNr?r?r?r@�<module>sv



T	
=
giCZIJUAU^tracemalloc.cpython-36.pyc000064400000041517150335715140011474 0ustar003


 \A�@sddlmZmZddlmZddlZddlZddlZddl	Z	ddl
Tddl
mZmZdd�Z
Gdd	�d	�ZGd
d�d�Zdd
�ZeGdd�d��ZeGdd�de��Zdd�ZGdd�d�ZGdd�de�Zdd�ZGdd�d�ZGdd�de�ZGdd�de�ZGd d!�d!�Zd"d#�ZdS)$�)�Sequence�Iterable)�total_orderingN)�*)�_get_object_traceback�_get_tracescCszxtd
D]l}t|�dkr:|dkr:|r.d||fSd||fSt|�dksN|dkrj|r^d||fSd||fS|d
}qWdS)N�B�KiB�MiB�GiB�TiB�dz%+.1f %sz%.1f %s�
iz%+.0f %sz%.0f %s)rr	r
rri()�abs)�sizeZsignZunit�r�#/usr/lib64/python3.6/tracemalloc.py�_format_size
s
rc@sDeZdZdZdZdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�	StatisticzS
    Statistic difference on memory allocations between two Snapshot instance.
    �	tracebackr�countcCs||_||_||_dS)N)rrr)�selfrrrrrr�__init__%szStatistic.__init__cCst|j|j|jf�S)N)�hashrrr)rrrr�__hash__*szStatistic.__hash__cCs$|j|jko"|j|jko"|j|jkS)N)rrr)r�otherrrr�__eq__-szStatistic.__eq__cCsBd|jt|jd�|jf}|jr>|j|j}|dt|d�7}|S)Nz%s: size=%s, count=%iFz, average=%s)rrrr)r�text�averagerrr�__str__2s

zStatistic.__str__cCsd|j|j|jfS)Nz)<Statistic traceback=%r size=%i count=%i>)rrr)rrrr�__repr__<szStatistic.__repr__cCs|j|j|jfS)N)rrr)rrrr�	_sort_key@szStatistic._sort_keyN)rrr)�__name__�
__module__�__qualname__�__doc__�	__slots__rrrrr r!rrrrrs
rc@sDeZdZdZdZdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dS)�
StatisticDiffzd
    Statistic difference on memory allocations between an old and a new
    Snapshot instance.
    rr�	size_diffr�
count_diffcCs"||_||_||_||_||_dS)N)rrr(rr))rrrr(rr)rrrrKs
zStatisticDiff.__init__cCst|j|j|j|j|jf�S)N)rrrr(rr))rrrrrRszStatisticDiff.__hash__cCs<|j|jko:|j|jko:|j|jko:|j|jko:|j|jkS)N)rrr(rr))rrrrrrVs
zStatisticDiff.__eq__cCsPd|jt|jd�t|jd�|j|jf}|jrL|j|j}|dt|d�7}|S)Nz %s: size=%s (%s), count=%i (%+i)FTz, average=%s)rrrr(rr))rrrrrrr]s


zStatisticDiff.__str__cCsd|j|j|j|j|jfS)Nz9<StatisticDiff traceback=%r size=%i (%+i) count=%i (%+i)>)rrr(rr))rrrrr iszStatisticDiff.__repr__cCs t|j�|jt|j�|j|jfS)N)rr(rr)rr)rrrrr!nszStatisticDiff._sort_keyN)rrr(rr))r"r#r$r%r&rrrrr r!rrrrr'Dsr'cCs�g}xp|j�D]d\}}|j|d�}|dk	rPt||j|j|j|j|j|j�}nt||j|j|j|j�}|j|�qWx6|j�D]*\}}t|d|jd|j�}|j|�q�W|S)Nr)�items�popr'rr�append)�	old_group�	new_group�
statisticsr�statZpreviousrrr�_compare_grouped_statstsr1c@s\eZdZdZdZdd�Zedd��Zedd��Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dS)�Framez
    Frame of a traceback.
    �_framecCs
||_dS)N)r3)r�framerrrr�szFrame.__init__cCs
|jdS)Nr)r3)rrrr�filename�szFrame.filenamecCs
|jdS)N�)r3)rrrr�lineno�szFrame.linenocCs|j|jkS)N)r3)rrrrrr�szFrame.__eq__cCs|j|jkS)N)r3)rrrrr�__lt__�szFrame.__lt__cCs
t|j�S)N)rr3)rrrrr�szFrame.__hash__cCsd|j|jfS)Nz%s:%s)r5r7)rrrrr�sz
Frame.__str__cCsd|j|jfS)Nz<Frame filename=%r lineno=%r>)r5r7)rrrrr �szFrame.__repr__N)r3)r"r#r$r%r&r�propertyr5r7rr8rrr rrrrr2�sr2c@sfeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
ddd�ZdS)�	Tracebackz`
    Sequence of Frame instances sorted from the most recent frame
    to the oldest frame.
    �_framescCstj|�||_dS)N)rrr;)r�framesrrrr�s
zTraceback.__init__cCs
t|j�S)N)�lenr;)rrrr�__len__�szTraceback.__len__cCs4t|t�r"tdd�|j|D��St|j|�SdS)Ncss|]}t|�VqdS)N)r2)�.0�tracerrr�	<genexpr>�sz(Traceback.__getitem__.<locals>.<genexpr>)�
isinstance�slice�tupler;r2)r�indexrrr�__getitem__�s
zTraceback.__getitem__cCs|j|jkS)N)r3r;)rr4rrr�__contains__�szTraceback.__contains__cCs
t|j�S)N)rr;)rrrrr�szTraceback.__hash__cCs|j|jkS)N)r;)rrrrrr�szTraceback.__eq__cCs|j|jkS)N)r;)rrrrrr8�szTraceback.__lt__cCst|d�S)Nr)�str)rrrrr�szTraceback.__str__cCsdt|�fS)Nz<Traceback %r>)rD)rrrrr �szTraceback.__repr__NcCsng}|dk	r|dkr|SxP|d|�D]@}|jd|j|jf�tj|j|j�j�}|r&|jd|�q&W|S)Nrz  File "%s", line %sz    %s)r,r5r7�	linecache�getline�strip)r�limit�linesr4�linerrr�format�szTraceback.format)r;)N)r"r#r$r%r&rr>rFrGrrr8rr rOrrrrr:�sr:cCs t|�}|dk	rt|�SdSdS)z�
    Get the traceback where the Python object *obj* was allocated.
    Return a Traceback instance.

    Return None if the tracemalloc module is not tracing memory allocations or
    did not trace the allocation of the object.
    N)rr:)�objr<rrr�get_object_traceback�srQc@s`eZdZdZdZdd�Zedd��Zedd��Zed	d
��Z	dd�Z
d
d�Zdd�Zdd�Z
dS)�Tracez"
    Trace of a memory block.
    �_tracecCs
||_dS)N)rS)rr@rrrr�szTrace.__init__cCs
|jdS)Nr)rS)rrrr�domain�szTrace.domaincCs
|jdS)Nr6)rS)rrrrr�sz
Trace.sizecCst|jd�S)N�)r:rS)rrrrrszTrace.tracebackcCs|j|jkS)N)rS)rrrrrrszTrace.__eq__cCs
t|j�S)N)rrS)rrrrr
szTrace.__hash__cCsd|jt|jd�fS)Nz%s: %sF)rrr)rrrrr
sz
Trace.__str__cCsd|jt|jd�|jfS)Nz'<Trace domain=%s size=%s, traceback=%r>F)rTrrr)rrrrr szTrace.__repr__N)rS)r"r#r$r%r&rr9rTrrrrrr rrrrrR�srRc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�_TracescCstj|�||_dS)N)rr�_traces)r�tracesrrrrs
z_Traces.__init__cCs
t|j�S)N)r=rW)rrrrr>sz_Traces.__len__cCs4t|t�r"tdd�|j|D��St|j|�SdS)Ncss|]}t|�VqdS)N)rR)r?r@rrrrA sz&_Traces.__getitem__.<locals>.<genexpr>)rBrCrDrWrR)rrErrrrFs
z_Traces.__getitem__cCs|j|jkS)N)rSrW)rr@rrrrG$sz_Traces.__contains__cCs|j|jkS)N)rW)rrrrrr'sz_Traces.__eq__cCsdt|�S)Nz<Traces len=%s>)r=)rrrrr *sz_Traces.__repr__N)	r"r#r$rr>rFrGrr rrrrrVsrVcCs&tjj|�}|jd�r"|dd�}|S)Nz.pycr6���)�os�path�normcase�endswith)r5rrr�_normalize_filename.s
r^c@seZdZdd�Zdd�ZdS)�
BaseFiltercCs
||_dS)N)�	inclusive)rr`rrrr6szBaseFilter.__init__cCst�dS)N)�NotImplementedError)rr@rrr�_match9szBaseFilter._matchN)r"r#r$rrbrrrrr_5sr_csJeZdZd�fdd�	Zedd��Zdd�Zd	d
�Zdd�Zd
d�Z	�Z
S)�FilterNFcs2t�j|�||_t|�|_||_||_||_dS)N)�superrr`r^�_filename_patternr7�
all_framesrT)rr`�filename_patternr7rfrT)�	__class__rrr>s
zFilter.__init__cCs|jS)N)re)rrrrrgGszFilter.filename_patterncCs6t|�}tj||j�sdS|jdkr(dS||jkSdS)NFT)r^�fnmatchrer7)rr5r7rrr�_match_frame_implKs
zFilter._match_frame_implcCs|j||�|jAS)N)rjr`)rr5r7rrr�_match_frameTszFilter._match_framecsH�jr,t�fdd�|D��r"�jS�jSn|d\}}�j||�SdS)Nc3s|]\}}�j||�VqdS)N)rj)r?r5r7)rrrrAYsz*Filter._match_traceback.<locals>.<genexpr>r)rf�anyr`rk)rrr5r7r)rr�_match_tracebackWs

zFilter._match_tracebackcCsD|\}}}|j|�}|jdk	r@|jr2|o0||jkS|p>||jkS|S)N)rmrTr`)rr@rTrr�resrrrrbbs


z
Filter._match)NFN)r"r#r$rr9rgrjrkrmrb�
__classcell__rr)rhrrc=s	rccs0eZdZ�fdd�Zedd��Zdd�Z�ZS)�DomainFiltercst�j|�||_dS)N)rdr�_domain)rr`rT)rhrrrnszDomainFilter.__init__cCs|jS)N)rq)rrrrrTrszDomainFilter.domaincCs|\}}}||jk|jAS)N)rTr`)rr@rTrrrrrrbvs
zDomainFilter._match)r"r#r$rr9rTrbrorr)rhrrpmsrpc@sXeZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z	dd
�Z
ddd�Zddd�ZdS)�SnapshotzB
    Snapshot of traces of memory blocks allocated by Python.
    cCst|�|_||_dS)N)rVrX�traceback_limit)rrXrsrrrr�s
zSnapshot.__init__cCs*t|d��}tj||tj�WdQRXdS)z1
        Write the snapshot into a file.
        �wbN)�open�pickle�dumpZHIGHEST_PROTOCOL)rr5�fprrrrw�sz
Snapshot.dumpc	Cs t|d��}tj|�SQRXdS)z.
        Load a snapshot from a file.
        �rbN)rurv�load)r5rxrrrrz�sz
Snapshot.loadcs@|rt�fdd�|D��sdS|r<t�fdd�|D��r<dSdS)Nc3s|]}|j��VqdS)N)rb)r?�trace_filter)r@rrrA�sz)Snapshot._filter_trace.<locals>.<genexpr>Fc3s|]}|j��VqdS)N)rb)r?r{)r@rrrA�sT)rl)r�include_filters�exclude_filtersr@r)r@r�
_filter_trace�s

zSnapshot._filter_tracecs�t|t�stdt|�j��|rng�g�x(|D] }|jrD�j|�q.�j|�q.W���fdd��jjD�}n�jjj	�}t
|�j�S)z�
        Create a new Snapshot instance with a filtered traces sequence, filters
        is a list of Filter or DomainFilter instances.  If filters is an empty
        list, return a new Snapshot instance with a copy of the traces.
        z)filters must be a list of filters, not %scsg|]}�j��|�r|�qSr)r~)r?r@)r}r|rrr�
<listcomp>�sz*Snapshot.filter_traces.<locals>.<listcomp>)rBr�	TypeError�typer"r`r,rXrW�copyrrrs)r�filtersr{Z
new_tracesr)r}r|rr�
filter_traces�s

zSnapshot.filter_tracesc
Cs�|dkrtd|f��|r.|d	kr.td|��i}i}|�sx�|jjD]�}|\}}}y||}	WnZtk
r�|dkr~|}
n(|dkr�|dd�}
n|dddff}
t|
�}	|	||<YnXy(||	}|j|7_|jd7_WqFtk
�r
t|	|d�||	<YqFXqFWn�x�|jjD]�}|\}}}x�|D]�}y||}	WnFtk
�r�|dk�rd|f}
n|ddff}
t|
�}	|	||<YnXy(||	}|j|7_|jd7_Wn&tk
�r�t|	|d�||	<YnX�q0W�qW|S)
Nrr5r7zunknown key_type: %rz/cumulative mode cannot by used with key type %rr6r)rr5r7)r7r5)�
ValueErrorrXrW�KeyErrorr:rrr)
r�key_type�
cumulativeZstatsZ
tracebacksr@rTrZtrace_tracebackrr<r0r4rrr�	_group_by�sX



"zSnapshot._group_byFcCs,|j||�}t|j��}|jdtjd�|S)zd
        Group statistics by key_type. Return a sorted list of Statistic
        instances.
        T)�reverse�key)r��list�values�sortrr!)rr�r�Zgroupedr/rrrr/�szSnapshot.statisticscCs6|j||�}|j||�}t||�}|jdtjd�|S)z�
        Compute the differences with an old snapshot old_snapshot. Get
        statistics as a sorted list of StatisticDiff instances, grouped by
        group_by.
        T)r�r�)r�r1r�r'r!)rZold_snapshotr�r�r.r-r/rrr�
compare_to�s

zSnapshot.compare_toN)F)F)
r"r#r$r%rrw�staticmethodrzr~r�r�r/r�rrrrrr{s3

rrcCs$t�std��t�}t�}t||�S)zI
    Take a snapshot of traces of memory blocks allocated by Python.
    zLthe tracemalloc module must be tracing memory allocations to take a snapshot)Z
is_tracing�RuntimeErrorrZget_traceback_limitrr)rXrsrrr�
take_snapshots
r�)�collectionsrr�	functoolsrrirIZos.pathrZrvZ_tracemallocrrrrr'r1r2r:rQrRrVr^r_rcrprrr�rrrr�<module>s0&0#5%0	ssl.cpython-36.pyc000064400000107120150335715140010000 0ustar003

�\dhݭ�@spdZddlZddlZddlZddlZddlZddlmZddlm	Z
mZm
ZddlZddlmZmZmZddlmZmZmZddlmZmZmZmZmZmZddlmZmZdd	lm Z m!Z!m"Z"m#Z#ydd
lm$Z$Wne%k
r�YnXddlm&Z&m'Z'm(Z(m)Z)m*Z*ddlm+Z+dd
lm,Z,ej-de.dd�ed�ej-de.dd�ed�ej-de.dd�ed�ej-de.dd�ed�ej-de.dd�ed�ej-de.dd�ed�e/j0Z1e/_1dd�e/j2j3�D�Z4e5e/dd�Z6ej7dk�r�dd lm8Z8m9Z9dd!l:m:Z:m;Z;m<Z<m=Z=dd"l:m>Z>m?Z?ddl@Z@ddlAZAddlBZBeCZDejE�r>d#gZFngZFe+ZGGd$d%�d%eH�ZIdRd'd(�ZJd)d*�ZKd+d,�ZLed-d.�ZMd/d0�ZNGd1d2�d2ed2d3��ZOGd4d5�d5eOe
�ZPGd6d7�d7e�ZQePjRfdddd8�d9d:�ZSe0feTd;ePjRdddddd<�d=d>�ZUeSZVeUZWGd?d@�d@�ZXGdAdB�dBe:�ZYddd;eTe0ddCdCdf	dDdE�ZZdFdG�Z[dHZ\dIZ]dJdK�Z^dLdM�Z_e0dfdNdO�Z`dPdQ�ZadS)Sa�
This module provides some more Pythonic support for SSL.

Object types:

  SSLSocket -- subtype of socket.socket which does SSL over the socket

Exceptions:

  SSLError -- exception raised for I/O errors

Functions:

  cert_time_to_seconds -- convert time string used for certificate
                          notBefore and notAfter functions to integer
                          seconds past the Epoch (the time values
                          returned from time.time())

  fetch_server_certificate (HOST, PORT) -- fetch the certificate provided
                          by the server running on HOST at port PORT.  No
                          validation of the certificate is performed.

Integer constants:

SSL_ERROR_ZERO_RETURN
SSL_ERROR_WANT_READ
SSL_ERROR_WANT_WRITE
SSL_ERROR_WANT_X509_LOOKUP
SSL_ERROR_SYSCALL
SSL_ERROR_SSL
SSL_ERROR_WANT_CONNECT

SSL_ERROR_EOF
SSL_ERROR_INVALID_ERROR_CODE

The following group define certificate requirements that one side is
allowing/requiring from the other side:

CERT_NONE - no certificates from the other side are required (or will
            be looked at if provided)
CERT_OPTIONAL - certificates are not required, but if provided will be
                validated, and if validation fails, the connection will
                also fail
CERT_REQUIRED - certificates are required, and will be validated, and
                if validation fails, the connection will also fail

The following constants identify various SSL protocol variants:

PROTOCOL_SSLv2
PROTOCOL_SSLv3
PROTOCOL_SSLv23
PROTOCOL_TLS
PROTOCOL_TLS_CLIENT
PROTOCOL_TLS_SERVER
PROTOCOL_TLSv1
PROTOCOL_TLSv1_1
PROTOCOL_TLSv1_2

The following constants identify various SSL alert message descriptions as per
http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-6

ALERT_DESCRIPTION_CLOSE_NOTIFY
ALERT_DESCRIPTION_UNEXPECTED_MESSAGE
ALERT_DESCRIPTION_BAD_RECORD_MAC
ALERT_DESCRIPTION_RECORD_OVERFLOW
ALERT_DESCRIPTION_DECOMPRESSION_FAILURE
ALERT_DESCRIPTION_HANDSHAKE_FAILURE
ALERT_DESCRIPTION_BAD_CERTIFICATE
ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE
ALERT_DESCRIPTION_CERTIFICATE_REVOKED
ALERT_DESCRIPTION_CERTIFICATE_EXPIRED
ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN
ALERT_DESCRIPTION_ILLEGAL_PARAMETER
ALERT_DESCRIPTION_UNKNOWN_CA
ALERT_DESCRIPTION_ACCESS_DENIED
ALERT_DESCRIPTION_DECODE_ERROR
ALERT_DESCRIPTION_DECRYPT_ERROR
ALERT_DESCRIPTION_PROTOCOL_VERSION
ALERT_DESCRIPTION_INSUFFICIENT_SECURITY
ALERT_DESCRIPTION_INTERNAL_ERROR
ALERT_DESCRIPTION_USER_CANCELLED
ALERT_DESCRIPTION_NO_RENEGOTIATION
ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION
ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
ALERT_DESCRIPTION_UNRECOGNIZED_NAME
ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE
ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE
ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY
�N)�
namedtuple)�Enum�IntEnum�IntFlag)�OPENSSL_VERSION_NUMBER�OPENSSL_VERSION_INFO�OPENSSL_VERSION)�_SSLContext�	MemoryBIO�
SSLSession)�SSLError�SSLZeroReturnError�SSLWantReadError�SSLWantWriteError�SSLSyscallError�SSLEOFError)�txt2obj�nid2obj)�RAND_status�RAND_add�
RAND_bytes�RAND_pseudo_bytes)�RAND_egd)�HAS_SNI�HAS_ECDH�HAS_NPN�HAS_ALPN�HAS_TLSv1_3)�_DEFAULT_CIPHERS)�_OPENSSL_API_VERSION�
_SSLMethodcCs|jd�o|dkS)NZ	PROTOCOL_�PROTOCOL_SSLv23)�
startswith)�name�r$�/usr/lib64/python3.6/ssl.py�<lambda>}sr&)�source�OptionscCs
|jd�S)NZOP_)r")r#r$r$r%r&�sZAlertDescriptioncCs
|jd�S)NZALERT_DESCRIPTION_)r")r#r$r$r%r&�sZSSLErrorNumbercCs
|jd�S)NZ
SSL_ERROR_)r")r#r$r$r%r&�s�VerifyFlagscCs
|jd�S)NZVERIFY_)r")r#r$r$r%r&�s�
VerifyModecCs
|jd�S)NZCERT_)r")r#r$r$r%r&�scCsi|]\}}||�qSr$r$)�.0r#�valuer$r$r%�
<dictcomp>�sr-ZPROTOCOL_SSLv2�win32)�enum_certificates�	enum_crls)�socket�AF_INET�SOCK_STREAM�create_connection)�
SOL_SOCKET�SO_TYPEz
tls-uniquec@seZdZdS)�CertificateErrorN)�__name__�
__module__�__qualname__r$r$r$r%r7�sr7�c	Cs�g}|sdS|jd�^}}|jd�}||kr<tdt|���|sP|j�|j�kS|dkrd|jd�n>|jd�sx|jd�r�|jtj|��n|jtj|�j	dd��x|D]}|jtj|��q�Wtj
d	d
j|�dtj�}|j
|�S)zhMatching according to RFC 6125, section 6.4.3

    http://tools.ietf.org/html/rfc6125#section-6.4.3
    F�.�*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)�split�countr7�repr�lower�appendr"�re�escape�replace�compile�join�
IGNORECASE�match)	Zdn�hostnameZ
max_wildcardsZpatsZleftmostZ	remainderZ	wildcardsZfragZpatr$r$r%�_dnsname_match�s&

rKcCstj|j��}||kS)z�Exact matching of IP addresses.

    RFC 6125 explicitly doesn't define an algorithm for this
    (section 1.7.2 - "Out of Scope").
    )�	ipaddress�
ip_address�rstrip)Zipname�host_ipZipr$r$r%�_ipaddress_match�srPcCsP|std��ytj|�}Wntk
r2d}YnXg}|jdf�}xb|D]Z\}}|dkr||dkrpt||�rpdS|j|�qJ|dkrJ|dk	r�t||�r�dS|j|�qJW|s�xF|jdf�D]6}x0|D](\}}|dkr�t||�r�dS|j|�q�Wq�Wt|�dk�r td	|d
j	t
t|��f��n,t|�dk�rDtd||df��ntd
��dS)a)Verify that *cert* (in decoded format as returned by
    SSLSocket.getpeercert()) matches the *hostname*.  RFC 2818 and RFC 6125
    rules are followed, but IP addresses are not accepted for *hostname*.

    CertificateError is raised on failure. On success, the function
    returns nothing.
    ztempty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIREDNZsubjectAltNameZDNSz
IP AddressZsubjectZ
commonNamer;z&hostname %r doesn't match either of %sz, zhostname %r doesn't match %rrz=no appropriate commonName or subjectAltName fields were found)�
ValueErrorrLrM�getrKrBrP�lenr7rG�mapr@)�certrJrOZdnsnamesZsan�keyr,�subr$r$r%�match_hostname�s>

rX�DefaultVerifyPathszQcafile capath openssl_cafile_env openssl_cafile openssl_capath_env openssl_capathcCsdtj�}tjj|d|d�}tjj|d|d�}ttjj|�rF|ndtjj|�rX|ndf|��S)z/Return paths to default cafile and capath.
    rr;��N)	�_ssl�get_default_verify_paths�os�environrRrY�path�isfile�isdir)�parts�cafile�capathr$r$r%r]-sr]csDeZdZdZfZ�fdd�Ze�fdd��Ze�fdd��Z�Z	S)�_ASN1Objectz#ASN.1 object identifier lookup
    cst�j|ft|dd���S)NF)r#)�super�__new__�_txt2obj)�cls�oid)�	__class__r$r%rh@sz_ASN1Object.__new__cst�j|ft|���S)z3Create _ASN1Object from OpenSSL numeric ID
        )rgrh�_nid2obj)rjZnid)rlr$r%�fromnidCsz_ASN1Object.fromnidcst�j|ft|dd���S)z=Create _ASN1Object from short name, long name or OID
        T)r#)rgrhri)rjr#)rlr$r%�fromnameIsz_ASN1Object.fromname)
r8r9r:�__doc__�	__slots__rh�classmethodrnro�
__classcell__r$r$)rlr%rf;s
rfznid shortname longname oidc@seZdZdZdZdZdS)�PurposezDSSLContext purpose flags with X509v3 Extended Key Usage objects
    z1.3.6.1.5.5.7.3.1z1.3.6.1.5.5.7.3.2N)r8r9r:rp�SERVER_AUTHZCLIENT_AUTHr$r$r$r%rtPsrtcs�eZdZdZd"Zd#Zefdd�Zefdd	�Zd$d
d�Z	d%dd�Z
dd�Zdd�Zdd�Z
ejfdd�Ze�fdd��Zej�fdd��Ze�fdd��Zej�fdd��Ze�fdd ��Zej�fd!d ��Z�ZS)&�
SSLContextz|An SSLContext holds various SSL-related configuration options and
    data, such as certificates and possibly a private key.�protocol�__weakref__�CA�ROOTcOstj||�}|S)N)r	rh)rjrw�args�kwargs�selfr$r$r%rh^szSSLContext.__new__cCs
||_dS)N)rw)r}rwr$r$r%�__init__bszSSLContext.__init__FTNc	Cst|||||||d�S)N)�sock�server_side�do_handshake_on_connect�suppress_ragged_eofs�server_hostname�_context�_session)�	SSLSocket)r}rr�r�r�r��sessionr$r$r%�wrap_socketes
zSSLContext.wrap_socketcCs|j||||d�}t||d�S)N)r�r�)r�)Z	_wrap_bio�	SSLObject)r}ZincomingZoutgoingr�r�r��sslobjr$r$r%�wrap_bioos
zSSLContext.wrap_biocCsdt�}xN|D]F}t|d�}t|�dks2t|�dkr:td��|jt|��|j|�qW|j|�dS)N�asciir�z(NPN protocols must be 1 to 255 in length)�	bytearray�bytesrSrrB�extendZ_set_npn_protocols)r}�
npn_protocols�protosrw�br$r$r%�set_npn_protocolsus

zSSLContext.set_npn_protocolscCsdt�}xN|D]F}t|d�}t|�dks2t|�dkr:td��|jt|��|j|�qW|j|�dS)Nr�rr�z)ALPN protocols must be 1 to 255 in length)r�r�rSrrBr�Z_set_alpn_protocols)r}Zalpn_protocolsr�rwr�r$r$r%�set_alpn_protocols�s

zSSLContext.set_alpn_protocolscCszt�}y@x:t|�D].\}}}|dkr|dks6|j|kr|j|�qWWntk
rdtjd�YnX|rv|j|d�|S)NZx509_asnTz-unable to enumerate Windows certificate store)�cadata)r�r/rkr��PermissionError�warnings�warn�load_verify_locations)r}�	storename�purposeZcertsrU�encodingZtrustr$r$r%�_load_windows_store_certs�sz$SSLContext._load_windows_store_certscCsDt|t�st|��tjdkr8x|jD]}|j||�q$W|j�dS)Nr.)�
isinstancerf�	TypeError�sys�platform�_windows_cert_storesr�Zset_default_verify_paths)r}r�r�r$r$r%�load_default_certs�s

zSSLContext.load_default_certscstt�j�S)N)r(rg�options)r})rlr$r%r��szSSLContext.optionscsttt�jj||�dS)N)rgrvr��__set__)r}r,)rlr$r%r��scstt�j�S)N)r)rg�verify_flags)r})rlr$r%r��szSSLContext.verify_flagscsttt�jj||�dS)N)rgrvr�r�)r}r,)rlr$r%r��scs*t�j}yt|�Stk
r$|SXdS)N)rg�verify_moder*rQ)r}r,)rlr$r%r��s
zSSLContext.verify_modecsttt�jj||�dS)N)rgrvr�r�)r}r,)rlr$r%r��s)rwrx)ryrz)FTTNN)FNN)r8r9r:rprqr��PROTOCOL_TLSrhr~r�r�r�r�r�rtrur��propertyr��setterr�r�rsr$r$)rlr%rvWs*

rv)rdrer�cCsdt|t�st|��tt�}|tjkr0t|_d|_	|s<|s<|rL|j
|||�n|jtkr`|j|�|S)z�Create a SSLContext object with default settings.

    NOTE: The protocol and settings may change anytime without prior
          deprecation. The values represent a fair balance between maximum
          compatibility and security.
    T)
r�rfr�rvr�rtru�
CERT_REQUIREDr��check_hostnamer��	CERT_NONEr�)r�rdrer��contextr$r$r%�create_default_context�s



r�F)�	cert_reqsr�r��certfile�keyfilerdrer�c
Cs�t|t�st|��t|�}	|s$d|	_|dk	r2||	_|r<d|	_|rN|rNtd��|sV|rb|	j||�|sn|sn|r~|	j|||�n|	jt	kr�|	j
|�|	S)a/Create a SSLContext object for Python stdlib modules

    All Python stdlib modules shall use this function to create SSLContext
    objects in order to keep common settings in one place. The configuration
    is less restrict than create_default_context()'s to increase backward
    compatibility.
    FNTzcertfile must be specified)r�rfr�rvr�r�rQ�load_cert_chainr�r�r�)
rwr�r�r�r�r�rdrer�r�r$r$r%�_create_unverified_context�s$



r�c@s�eZdZdZd0dd�Zedd��Zejdd��Zedd	��Zejd
d	��Zedd��Z	ed
d��Z
edd��Zd1dd�Zdd�Z
d2dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd3d*d+�Zd,d-�Zd.d/�ZdS)4r�aThis class implements an interface on top of a low-level SSL object as
    implemented by OpenSSL. This object captures the state of an SSL connection
    but does not provide any network IO itself. IO needs to be performed
    through separate "BIO" objects which are OpenSSL's IO abstraction layer.

    This class does not have a public constructor. Instances are returned by
    ``SSLContext.wrap_bio``. This class is typically used by framework authors
    that want to implement asynchronous IO for SSL through memory buffers.

    When compared to ``SSLSocket``, this object lacks the following features:

     * Any form of network IO, including methods such as ``recv`` and ``send``.
     * The ``do_handshake_on_connect`` and ``suppress_ragged_eofs`` machinery.
    NcCs&||_|p||j_|dk	r"||j_dS)N)�_sslobj�ownerr�)r}r�r�r�r$r$r%r~szSSLObject.__init__cCs|jjS)z(The SSLContext that is currently in use.)r�r�)r}r$r$r%r�%szSSLObject.contextcCs||j_dS)N)r�r�)r}�ctxr$r$r%r�*scCs|jjS)z!The SSLSession for client socket.)r�r�)r}r$r$r%r�.szSSLObject.sessioncCs||j_dS)N)r�r�)r}r�r$r$r%r�3scCs|jjS)z.Was the client session reused during handshake)r��session_reused)r}r$r$r%r�7szSSLObject.session_reusedcCs|jjS)z%Whether this is a server-side socket.)r�r�)r}r$r$r%r�<szSSLObject.server_sidecCs|jjS)z]The currently set server hostname (for SNI), or ``None`` if no
        server hostame is set.)r�r�)r}r$r$r%r�AszSSLObject.server_hostname�cCs(|dk	r|jj||�}n|jj|�}|S)z�Read up to 'len' bytes from the SSL object and return them.

        If 'buffer' is provided, read into this buffer and return the number of
        bytes read.
        N)r��read)r}rS�buffer�vr$r$r%r�GszSSLObject.readcCs|jj|�S)z�Write 'data' to the SSL object and return the number of bytes
        written.

        The 'data' argument must support the buffer interface.
        )r��write)r}�datar$r$r%r�SszSSLObject.writeFcCs|jj|�S)z�Returns a formatted version of the data in the certificate provided
        by the other end of the SSL channel.

        Return None if no certificate was provided, {} if a certificate was
        provided, but not validated.
        )r�Zpeer_certificate)r}�binary_formr$r$r%�getpeercert[szSSLObject.getpeercertcCstjr|jj�SdS)z�Return the currently selected NPN protocol as a string, or ``None``
        if a next protocol was not negotiated or if NPN is not supported by one
        of the peers.N)r\rr��selected_npn_protocol)r}r$r$r%r�dszSSLObject.selected_npn_protocolcCstjr|jj�SdS)z�Return the currently selected ALPN protocol as a string, or ``None``
        if a next protocol was not negotiated or if ALPN is not supported by one
        of the peers.N)r\rr��selected_alpn_protocol)r}r$r$r%r�ksz SSLObject.selected_alpn_protocolcCs
|jj�S)z_Return the currently selected cipher as a 3-tuple ``(name,
        ssl_version, secret_bits)``.)r��cipher)r}r$r$r%r�rszSSLObject.ciphercCs
|jj�S)z�Return a list of ciphers shared by the client during the handshake or
        None if this is not a valid server connection.
        )r��shared_ciphers)r}r$r$r%r�wszSSLObject.shared_cipherscCs
|jj�S)z�Return the current compression algorithm in use, or ``None`` if
        compression was not negotiated or not supported by one of the peers.)r��compression)r}r$r$r%r�}szSSLObject.compressioncCs
|jj�S)z8Return the number of bytes that can be read immediately.)r��pending)r}r$r$r%r��szSSLObject.pendingcCs4|jj�|jjr0|js td��t|j�|j�dS)zStart the SSL/TLS handshake.z-check_hostname needs server_hostname argumentN)r��do_handshaker�r�r�rQrXr�)r}r$r$r%r��s

zSSLObject.do_handshakecCs
|jj�S)z!Start the SSL shutdown handshake.)r��shutdown)r}r$r$r%�unwrap�szSSLObject.unwrap�
tls-uniquecCs0|tkrtd��|dkr&tdj|���|jj�S)z�Get channel binding data for current connection.  Raise ValueError
        if the requested `cb_type` is not supported.  Return bytes of the data
        or None if the data is not available (e.g. before the handshake).z Unsupported channel binding typez
tls-uniquez({0} channel binding type not implemented)�CHANNEL_BINDING_TYPESrQ�NotImplementedError�formatr�Z
tls_unique_cb)r}�cb_typer$r$r%�get_channel_binding�szSSLObject.get_channel_bindingcCs
|jj�S)zZReturn a string identifying the protocol version used by the
        current SSL channel. )r��version)r}r$r$r%r��szSSLObject.versioncCs
|jj�S)N)r��verify_client_post_handshake)r}r$r$r%r��sz&SSLObject.verify_client_post_handshake)NN)r�N)F)r�)r8r9r:rpr~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r$r$r$r%r�s.


		
r�cs�eZdZdZddddeeddeeddddddddfdd�Ze	dd	��Z
e
jd
d	��Z
e	dd��Zejd
d��Ze	dd��Z
dd�ZdVdd�Zdd�ZdWdd�Zdd�ZdXdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZdYd'd(�ZdZd)d*�Zd+d,�Zd[d-d.�Zd\�fd/d0�	Zd]d1d2�Zd^d3d4�Zd_d5d6�Z d`d7d8�Z!d9d:�Z"d;d<�Z#d=d>�Z$d?d@�Z%dAdB�Z&dCdD�Z'dEdF�Z(dadGdH�Z)dIdJ�Z*dKdL�Z+dMdN�Z,dOdP�Z-dbdRdS�Z.dTdU�Z/�Z0S)cr�z�This class implements a subtype of socket.socket that wraps
    the underlying OS socket in an SSL context when necessary, and
    provides read and write methods over that channel.NFTrc6Cs:d|_|r||_n�|r$|r$td��|r6|r6td��|rD|rD|}t|�|_||j_|rf|jj|�|rx|jj||�|r�|jj|�|r�|jj|�||_	||_
||_||_||_
||_|jtt�tkr�td��|r�|r�td��|dk	r�td��|jj�r|�rtd��||_||_||_||_|
|_|dk	�rftj||j|j|j|j�d�|j �}|j!�n,|dk	�r�tj||d�ntj||	|
|d	�y|j"�Wn�t#k
�r�}z�|j$t$j%k�r‚d
}|j �dk}|j&d
�y|j'd�}Wn>t#k
�r(}z |j$t$j%t$j(fk�r�d
}WYdd}~XnX|j&|�|�r�d}t)|j$|�}||_*d|_+y|j,�Wnt#k
�rxYnXz|�Wdd}XWYdd}~XnXd}|j-|�d
|_.d|_||_/|�r6yN|jj0|||�}t1|||jd�|_|�r|j �}|dk�rtd��|j2�Wn$t#tfk
�r4|j,��YnXdS)Nz5certfile must be specified for server-side operationszcertfile must be specifiedz!only stream sockets are supportedz4server_hostname can only be specified in client modez,session can only be specified in client modez'check_hostname requires server_hostname)�family�type�proto�fileno)r�)r�r�r�Frr;�z5Closed before TLS handshake with data in recv buffer.T)r�r�gzHdo_handshake_on_connect should not be specified for non-blocking sockets)3r�r�rQrvr�r�r�r�Zset_ciphersr�r�r��ssl_version�ca_certs�ciphersZ
getsockoptr5r6r3r�r�r�r�r�r�r�r1r~r�r�r�r��
gettimeout�detach�getpeername�OSError�errnoZENOTCONNZsetblocking�recvZEINVALr�reasonZlibrary�close�
settimeoutZ_closed�
_connected�_wrap_socketr�r�)r}rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Zsock_timeout�eZ	connectedZblockingZnotconn_pre_handshake_datar�Z notconn_pre_handshake_data_errorr��timeoutr$r$r%r~�s�











zSSLSocket.__init__cCs|jS)N)r�)r}r$r$r%r�0szSSLSocket.contextcCs||_||j_dS)N)r�r�r�)r}r�r$r$r%r�4scCs|jdk	r|jjSdS)z!The SSLSession for client socket.N)r�r�)r}r$r$r%r�9s
zSSLSocket.sessioncCs||_|jdk	r||j_dS)N)r�r�r�)r}r�r$r$r%r�?s
cCs|jdk	r|jjSdS)z.Was the client session reused during handshakeN)r�r�)r}r$r$r%r�Es
zSSLSocket.session_reusedcCstd|jj��dS)NzCan't dup() %s instances)r�rlr8)r}r$r$r%�dupKsz
SSLSocket.dupcCsdS)Nr$)r}�msgr$r$r%�_checkClosedOszSSLSocket._checkClosedcCs|js|j�dS)N)r�r�)r}r$r$r%�_check_connectedSszSSLSocket._check_connected�cCst|j�|jstd��y|jj||�Stk
rn}z.|jdtkr\|jr\|dk	rVdSdSn�WYdd}~XnXdS)zORead up to LEN bytes and return them.
        Return zero-length string on EOF.z'Read on closed or unwrapped SSL socket.rNr�)r�r�rQr�rr{Z
SSL_ERROR_EOFr�)r}rSr��xr$r$r%r�[szSSLSocket.readcCs"|j�|jstd��|jj|�S)zhWrite DATA to the underlying SSL channel.  Returns
        number of bytes of DATA actually transmitted.z(Write on closed or unwrapped SSL socket.)r�r�rQr�)r}r�r$r$r%r�mszSSLSocket.writecCs|j�|j�|jj|�S)z�Returns a formatted version of the data in the
        certificate provided by the other end of the SSL channel.
        Return None if no certificate was provided, {} if a
        certificate was provided, but not validated.)r�r�r�r�)r}r�r$r$r%r�vszSSLSocket.getpeercertcCs*|j�|jstjrdS|jj�SdS)N)r�r�r\rr�)r}r$r$r%r��szSSLSocket.selected_npn_protocolcCs*|j�|jstjrdS|jj�SdS)N)r�r�r\rr�)r}r$r$r%r��sz SSLSocket.selected_alpn_protocolcCs |j�|jsdS|jj�SdS)N)r�r�r�)r}r$r$r%r��szSSLSocket.ciphercCs|j�|jsdS|jj�S)N)r�r�r�)r}r$r$r%r��szSSLSocket.shared_cipherscCs |j�|jsdS|jj�SdS)N)r�r�r�)r}r$r$r%r��szSSLSocket.compressioncCsB|j�|jr0|dkr$td|j��|jj|�Stj|||�SdS)Nrz3non-zero flags not allowed in calls to send() on %s)r�r�rQrlr�r1�send)r}r��flagsr$r$r%r��s
zSSLSocket.sendcCsH|j�|jrtd|j��n&|dkr4tj|||�Stj||||�SdS)Nz%sendto not allowed on instances of %s)r�r�rQrlr1�sendto)r}r�Z
flags_or_addr�addrr$r$r%r��szSSLSocket.sendtocOstd|j��dS)Nz&sendmsg not allowed on instances of %s)r�rl)r}r{r|r$r$r%�sendmsg�szSSLSocket.sendmsgcCs�|j�|jr�|dkr$td|j��d}t|��L}|jd��6}t|�}x&||krl|j||d��}||7}qHWWdQRXWdQRXntj	|||�SdS)Nrz6non-zero flags not allowed in calls to sendall() on %s�B)
r�r�rQrl�
memoryview�castrSr�r1�sendall)r}r�r�r?ZviewZ	byte_viewZamountr�r$r$r%r��s

"zSSLSocket.sendallcs,|jdkrt�j|||�S|j|||�SdS)z�Send a file, possibly by using os.sendfile() if this is a
        clear-text socket.  Return the total number of bytes sent.
        N)r�rg�sendfileZ_sendfile_use_send)r}�file�offsetr?)rlr$r%r��s
zSSLSocket.sendfilecCs@|j�|jr.|dkr$td|j��|j|�Stj|||�SdS)Nrz3non-zero flags not allowed in calls to recv() on %s)r�r�rQrlr�r1r�)r}�buflenr�r$r$r%r��s

zSSLSocket.recvcCsf|j�|r|dkrt|�}n|dkr*d}|jrR|dkrFtd|j��|j||�Stj||||�SdS)Nirz8non-zero flags not allowed in calls to recv_into() on %s)r�rSr�rQrlr�r1�	recv_into)r}r��nbytesr�r$r$r%r��s

zSSLSocket.recv_intocCs0|j�|jrtd|j��ntj|||�SdS)Nz'recvfrom not allowed on instances of %s)r�r�rQrlr1�recvfrom)r}r�r�r$r$r%r��s
zSSLSocket.recvfromcCs2|j�|jrtd|j��ntj||||�SdS)Nz,recvfrom_into not allowed on instances of %s)r�r�rQrlr1�
recvfrom_into)r}r�r�r�r$r$r%r��s
zSSLSocket.recvfrom_intocOstd|j��dS)Nz&recvmsg not allowed on instances of %s)r�rl)r}r{r|r$r$r%�recvmsgszSSLSocket.recvmsgcOstd|j��dS)Nz+recvmsg_into not allowed on instances of %s)r�rl)r}r{r|r$r$r%�recvmsg_intoszSSLSocket.recvmsg_intocCs |j�|jr|jj�SdSdS)Nr)r�r�r�)r}r$r$r%r�	s
zSSLSocket.pendingcCs|j�d|_tj||�dS)N)r�r�r1r�)r}Zhowr$r$r%r�szSSLSocket.shutdowncCs.|jr|jj�}d|_|Stdt|���dS)NzNo SSL wrapper around )r�r�rQ�str)r}�sr$r$r%r�s

zSSLSocket.unwrapcCs$|jr|jj�Stdt|���dS)NzNo SSL wrapper around )r�r�rQr)r}r$r$r%r�s
z&SSLSocket.verify_client_post_handshakecCsd|_tj|�dS)N)r�r1�_real_close)r}r$r$r%r#szSSLSocket._real_closecCsF|j�|j�}z$|dkr(|r(|jd�|jj�Wd|j|�XdS)zPerform a TLS/SSL handshake.gN)r�r�r�r�r�)r}�blockr�r$r$r%r�'s
zSSLSocket.do_handshakecCs�|jrtd��|jrtd��|jj|d|j�}t|||jd�|_y>|rTt	j
||�}nd}t	j||�|s|d|_|jr||j
�|Sttfk
r�d|_�YnXdS)Nz!can't connect in server-side modez/attempt to connect already-connected SSLSocket!F)r�r�T)r�rQr�r�r�r�r�r�r�r1�
connect_ex�connectr�r�r�)r}r�rr�Zrcr$r$r%�
_real_connect2s(zSSLSocket._real_connectcCs|j|d�dS)zQConnects to remote ADDR, and then wraps the connection in
        an SSL channel.FN)r)r}r�r$r$r%rKszSSLSocket.connectcCs|j|d�S)zQConnects to remote ADDR, and then wraps the connection in
        an SSL channel.T)r)r}r�r$r$r%rPszSSLSocket.connect_excCs.tj|�\}}|jj||j|jdd�}||fS)z�Accepts a new connection from a remote client, and returns
        a tuple containing that new connection wrapped with a server-side
        SSL channel, and the address of the remote client.T)r�r�r�)r1�acceptr�r�r�r�)r}Znewsockr�r$r$r%rUszSSLSocket.accept�
tls-uniquecCs|jdkrdS|jj|�S)z�Get channel binding data for current connection.  Raise ValueError
        if the requested `cb_type` is not supported.  Return bytes of the data
        or None if the data is not available (e.g. before the handshake).
        N)r�r�)r}r�r$r$r%r�as
zSSLSocket.get_channel_bindingcCs|jdkrdS|jj�S)z�
        Return a string identifying the protocol version used by the
        current SSL channel, or None if there is no established channel.
        N)r�r�)r}r$r$r%r�js
zSSLSocket.version)N)r�N)F)r)N)r)rN)r�r)Nr)r�r)Nr)F)r	)1r8r9r:rpr�r�r2r3r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�r�r�r�rr�rrrrr�r�rsr$r$)rlr%r��s`|

	












	r�Tc

Cst||||||||||	d�
S)N)
rr�r�r�r�r�r�r�r�r�)r�)
rr�r�r�r�r�r�r�r�r�r$r$r%r�tsr�c
Cs�ddlm}ddlm}d}d}y|j|dd�j��d}Wn$tk
rbtd||f��Yn0X||dd�|�}||d|f|dd��SdS)a�Return the time in seconds since the Epoch, given the timestring
    representing the "notBefore" or "notAfter" date from a certificate
    in ``"%b %d %H:%M:%S %Y %Z"`` strptime format (C locale).

    "notBefore" or "notAfter" dates must use UTC (RFC 5280).

    Month is one of: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
    UTC should be specified as GMT (see ASN1_TIME_print())
    r)�strptime)�timegm�Jan�Feb�Mar�Apr�May�Jun�Jul�Aug�Sep�Oct�Nov�Decz %d %H:%M:%S %Y GMTNr[r;z*time data %r does not match format "%%b%s"rZ�)rr
rrrrrrrrrr)Ztimer
Zcalendarr�index�titlerQ)Z	cert_timer
rZmonthsZtime_formatZmonth_numberZttr$r$r%�cert_time_to_seconds�s
rz-----BEGIN CERTIFICATE-----z-----END CERTIFICATE-----cCs2ttj|�dd�}tdtj|d�dtdS)z[Takes a certificate in binary DER format and returns the
    PEM version of it as a string.�ASCII�strict�
�@)r�base64Zstandard_b64encode�
PEM_HEADER�textwrapZfill�
PEM_FOOTER)Zder_cert_bytes�fr$r$r%�DER_cert_to_PEM_cert�sr%cCs\|jt�stdt��|j�jt�s0tdt��|j�tt�tt��}tj|j	dd��S)zhTakes a certificate in ASCII PEM format and returns the
    DER-encoded version of it as a byte sequencez(Invalid PEM encoding; must start with %sz&Invalid PEM encoding; must end with %srr)
r"r!rQ�strip�endswithr#rSr Zdecodebytes�encode)Zpem_cert_string�dr$r$r%�PEM_cert_to_DER_cert�s
r*c
Csd|\}}|dk	rt}nt}t|||d�}t|��&}|j|��}|jd�}	WdQRXWdQRXt|	�S)z�Retrieve the certificate from the server at the specified address,
    and return it as a PEM-encoded string.
    If 'ca_certs' is specified, validate the server cert against it.
    If 'ssl_version' is specified, use it in the connection attempt.N)r�rdT)r�r��_create_stdlib_contextr4r�r�r%)
r�r�r��hostZportr�r�rZsslsockZdercertr$r$r%�get_server_certificate�s
r-cCstj|d�S)Nz	<unknown>)�_PROTOCOL_NAMESrR)Z
protocol_coder$r$r%�get_protocol_name�sr/)r;)brprLr"rCr�r^�collectionsr�enumrZ_EnumrZ_IntEnumrZ_IntFlagr\rrrr	r
rrr
rrrrrrirrmrrrrr�ImportErrorrrrrrrr�_convertr8r r�r!�__members__�itemsr.�getattrZ_SSLv2_IF_EXISTSr�r/r0r1r2r3r4r5r6r r�r�r�Zsocket_errorZHAS_TLS_UNIQUEr�Z_RESTRICTED_SERVER_CIPHERSrQr7rKrPrXrYr]rfrtrvrur�r�r�Z_create_default_https_contextr+r�r�r�rr!r#r%r*r-r/r$r$r$r%�<module>[s� 
14g(O
	
struct.cpython-36.opt-2.pyc000064400000000472150335715140011465 0ustar003


 \�@s8ddddddddgZdd	lTdd
lmZddlmZdS)
ZcalcsizeZpackZ	pack_intoZunpackZunpack_fromZiter_unpackZStruct�error�)�*)�_clearcache)�__doc__N)�__all__Z_structrr�rr�/usr/lib64/python3.6/struct.py�<module>s
webbrowser.cpython-36.pyc000064400000036667150335715140011401 0ustar003


 \U�@s�dZddlZddlZddlZddlZddlZddddddgZGd	d�de�ZiZ	gZ
dOdd�ZdPdd�ZdQdd�Z
dd�Zdd�ZdRdd�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd �d e�ZGd!d"�d"e�ZeZGd#d$�d$e�ZGd%d&�d&e�ZGd'd(�d(e�ZGd)d*�d*e�Zd+d,�Zej jd-��rle�ej jd.��rej!d/��r�ed/ded/��ej!d0��r�ed0ded0��ej!d1��r�ed1ded1��ej!d2��r�ed2ded2��ej!d3��red3ded3��ej"dd4�d5k�r�Gd6d7�d7e�Z#gZ
iZ	ed8e#�ej$j%ej jd9d:�d;�Z&x8d<d=d>d?d@dAe&fD]"Z'ej!e'��rhee'dee'���qhWej"dBk�rGdCdD�dDe�Z(GdEdF�dFe�Z)edGde)dG�dS�ed<de)d<�dT�edHde)dH�dU�edDde)dI�dV�dJej k�rtej dJj*ej+�Z,e,j-�xBe,D]:Z.e.dKk�r.ee.dW�Z/e/d
dk�r.ee.dee.�dX��q.WdZ.[.[,dLdM�Z0e1dNk�r�e0�dS)Yz?Interfaces for launching and remotely controlling Web browsers.�N�Error�open�open_new�open_new_tab�get�registerc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�"/usr/lib64/python3.6/webbrowser.pyr
s�cCs<||gt|j�<|dkr$tj|�n|dkr8tjd|�dS)z9Register a browser connector and, optionally, connection.rN)�	_browsers�lower�	_tryorder�append�insert)�name�klass�instance�update_tryorderrrrrs
cCs�|dk	r|g}nt}x�|D]�}d|krVtj|�}|ddkrLt|dd��St|�Sqyt|j�}Wntk
r�t|�}YnX|ddk	r�|dS|ddk	r|d�SqWt	d��dS)	zCReturn a browser launcher instance appropriate for the environment.Nz%sr
�&rz!could not locate runnable browser���r)
r�shlex�split�BackgroundBrowser�GenericBrowserrr�KeyError�_synthesizer)ZusingZalternatives�browser�commandrrrrs$


TcCs,x&tD]}t|�}|j|||�rdSqWdS)NTF)rrr)�url�new�	autoraiserrrrrr9s

cCs
t|d�S)Nr
)r)r!rrrr@scCs
t|d�S)N�)r)r!rrrrCsc
Cs�|j�d}tj|�sddgStjj|�}yt|j�}Wntk
rRddgSX|d}|r�|j�|jkr�ddl	}|j	|�}||_
tjj|�|_t|d||�d|gSddgS)a�Attempt to synthesize a controller base on existing controllers.

    This is useful to create a controller when a user specifies a path to
    an entry in the BROWSER environment variable -- we can copy a general
    controller to operate using a specific installation of the desired
    browser in this way.

    If we can't create a controller in this way, or if there is no
    executable for the requested browser, return [None, None].

    rNr
)r�shutil�which�os�path�basenamerrr�copyrr)rr�cmdrr Z
controllerr*rrrrGs"


rc@s:eZdZdZdgZddd�Zddd	�Zd
d�Zdd
�ZdS)�BaseBrowserz3Parent class for all browsers. Do not use directly.z%s�cCs||_||_dS)N)rr))�selfrrrr�__init__nszBaseBrowser.__init__rTcCst�dS)N)�NotImplementedError)r.r!r"r#rrrrrszBaseBrowser.opencCs|j|d�S)Nr
)r)r.r!rrrruszBaseBrowser.open_newcCs|j|d�S)Nr$)r)r.r!rrrrxszBaseBrowser.open_new_tabN)r-)rT)	rr	r
�__doc__�argsr/rrrrrrrr,is

r,c@s"eZdZdZdd�Zd	dd�ZdS)
rzVClass for all browsers started with a command
       and without remote functionality.cCsFt|t�r||_dg|_n|d|_|dd�|_tjj|j�|_dS)Nz%srr
)�
isinstance�strrr2r'r(r))r.rrrrr/�s


zGenericBrowser.__init__rTcsl|jg�fdd�|jD�}y6tjdd�dkr<tj|�}ntj|dd�}|j�Stk
rfdSXdS)Ncsg|]}|jd���qS)z%s)�replace)�.0�arg)r!rr�
<listcomp>�sz'GenericBrowser.open.<locals>.<listcomp>��winT)�	close_fdsF)rr2�sys�platform�
subprocess�Popen�wait�OSError)r.r!r"r#�cmdline�pr)r!rr�s
zGenericBrowser.openN)rT)rr	r
r1r/rrrrrr|s
rc@seZdZdZddd�ZdS)rzHClass for all browsers which are to be started in the
       background.rTcsp|jg�fdd�|jD�}y:tjdd�dkr<tj|�}ntj|ddd�}|j�dkStk
rjdSXdS)Ncsg|]}|jd���qS)z%s)r5)r6r7)r!rrr8�sz*BackgroundBrowser.open.<locals>.<listcomp>r9r:T)r;�start_new_sessionF)rr2r<r=r>r?�pollrA)r.r!r"r#rBrCr)r!rr�szBackgroundBrowser.openN)rT)rr	r
r1rrrrrr�src@sBeZdZdZdZdZdZddgZdZdZ	dZ
dd�Zdd
d�ZdS)
�UnixBrowserz=Parent class for all Unix browsers with remote functionality.NFTz%actionz%sc
Cs�g}|r*|jr*t|�}|j|}|r*|g}|jg||}|sD|jrLtj}nd}tj|d||jrd|pfd|dd�}|r�y|jd�}	|	Stj	k
r�dSXn&|jr�|j
�dkr�dSdSn
|j�SdS)NT)r;�stdin�stdout�stderrrD�F)�
raise_opts�intr�
backgroundr>�DEVNULLr?�redirect_stdoutr@ZTimeoutExpiredrE)
r.r2Zremoter#Z	raise_opt�optrBZinoutrC�rcrrr�_invoke�s0





zUnixBrowser._invokercs�|dkr|j�nB|dkr |j�n2|dkrB|jdkr:|j�qR|j�ntdd|����fdd�|jD�}dd�|D�}|j|d	|�}|s��fd
d�|jD�}|j|dd�Sd	SdS)Nrr
r$zBad 'new' parameter to open(); zexpected 0, 1, or 2, got %scs g|]}|jd��jd���qS)z%sz%action)r5)r6r7)�actionr!rrr8�sz$UnixBrowser.open.<locals>.<listcomp>cSsg|]}|r|�qSrr)r6r7rrrr8�sTcsg|]}|jd���qS)z%s)r5)r6r7)r!rrr8�sF)�
remote_action�remote_action_newwin�remote_action_newtabr�remote_argsrRr2)r.r!r"r#r2Zsuccessr)rSr!rr�s$

zUnixBrowser.open)rT)
rr	r
r1rKrMrOrWrTrUrVrRrrrrrrF�s#rFc@s(eZdZdZddgZdZdZdZdZdS)	�Mozillaz$Launcher class for Mozilla browsers.z%actionz%sr-z-new-windowz-new-tabTN)	rr	r
r1rWrTrUrVrMrrrrrX�srXc@s0eZdZdZddgZddgZdZdZdZd	Z	d
S)�Netscapez$Launcher class for Netscape browser.z-noraisez-raisez-remotezopenURL(%s%action)r-z,new-windowz,new-tabTN)
rr	r
r1rKrWrTrUrVrMrrrrrYsrYc@s,eZdZdZddgZddgZdZdZdZd	S)
�Galeonz,Launcher class for Galeon/Epiphany browsers.z-noraiser-z%actionz%sz-nz-wTN)	rr	r
r1rKrWrTrUrMrrrrrZsrZc@s(eZdZdZddgZdZdZdZdZdS)�Chromez)Launcher class for Google Chrome browser.z%actionz%sr-z--new-windowTN)	rr	r
r1rWrTrUrVrMrrrrr[sr[c@s(eZdZdZddgZdZdZdZdZdS)�Operaz!Launcher class for Opera browser.z%actionz%sr-z--new-windowTN)	rr	r
r1rWrTrUrVrMrrrrr\"sr\c@s,eZdZdZddgZdZdZdZdZdZ	dS)	�Elinksz#Launcher class for Elinks browsers.z-remotezopenURL(%s%action)r-z,new-windowz,new-tabFN)
rr	r
r1rWrTrUrVrMrOrrrrr],sr]c@seZdZdZddd�ZdS)�	Konquerorz�Controller for the KDE File Manager (kfm, or Konqueror).

    See the output of ``kfmclient --commands``
    for more information on the Konqueror remote-control interface.
    rTcCs�|dkrd}nd}tj}ytjd||gd|||d�}Wntk
rJYnX|j�dSy tjdd|gd|||dd	�}Wntk
r�YnX|j�dkr�dSy tjd
d|gd|||dd	�}Wntk
r�dSX|j�dkSdS)
Nr$ZnewTabZopenURL�	kfmclientT)r;rGrHrI�	konquerorz--silent)r;rGrHrIrD�kfmz-dF)r>rNr?rAr@rE)r.r!r"r#rS�devnullrCrrrrAs:zKonqueror.openN)rT)rr	r
r1rrrrrr^:sr^c@s&eZdZdd�Zdd�Zd
dd�Zd	S)�GrailcCs�ddl}ddl}ddl}ddl}tjj|j�d�}|jtj	��d}tjj||d�}|j|�}|shdS|j|j
|j�}	xX|D]P}
y|	j|
�Wn8t
k
r�ytj|
�Wnt
k
r�YnXYq~X|	Sq~WdS)Nrz.grail-unixz-*)�glob�pwd�socket�tempfiler'r(�joinZ
gettempdir�getpwuid�getuidZAF_UNIXZSOCK_STREAMZconnectrA�unlink)r.rdrerfrgZtempdir�user�filenameZmaybes�s�fnrrr�_find_grail_rcrs*

zGrail._find_grail_rccCs&|j�}|sdS|j|�|j�dS)Nrr
)rp�send�close)r.rSrnrrr�_remote�s
z
Grail._remoterTcCs&|r|jd|�}n|jd|�}|S)NzLOADNEW zLOAD )rs)r.r!r"r#�okrrrr�sz
Grail.openN)rT)rr	r
rprsrrrrrrcnsrccCs�tjd�rtddtd��dtjkr>tjd�r>tddtd��dtjkrbtjd�rbtddtd��dtjkr�tjd�r�tdttd��tjd�r�tddtd��x&dD]}tj|�r�t|dt|��q�Wx&dD]}tj|�r�t|dt|��q�Wtjd��rtdttd��ntjd��r*tdttd��x*dD]"}tj|��r0t|dt	|���q0Wtjd��rrtddtd��x*d D]"}tj|��rxt|dt
|���qxWtjd��r�tddtd��tjd��r�tddtd��tjd��r�tdtd�dS)!Nzxdg-openZGNOME_DESKTOP_SESSION_IDz	gvfs-openz
gnome-openZKDE_FULL_SESSIONr_z
x-www-browser�firefox�	iceweasel�iceape�	seamonkey�mozilla-firefox�mozilla-firebird�firebird�mozilla�netscaperar`�galeon�epiphanyZ	skipstone�
google-chrome�chrome�chromium�chromium-browser�operaZmosaicZgrail)rurvrwrx)ryrzr{r|r})r~r)r�r�r�r�)
r%r&rrr'�environr^rXrYrZr[r\rc)rrrr�register_X_browsers�sH






r�ZDISPLAYZTERMzwww-browserZlinksZelinksZlynxZw3mr9r:c@seZdZddd�ZdS)�WindowsDefaultrTcCs,ytj|�Wntk
r"dSXdSdS)NFT)r'Z	startfilerA)r.r!r"r#rrrr�s
zWindowsDefault.openN)rT)rr	r
rrrrrr��sr�zwindows-defaultZPROGRAMFILESzC:\Program FileszInternet Explorer\IEXPLORE.EXErur{rxr|r}r��darwinc@s"eZdZdZdd�Zd	dd�ZdS)
�MacOSXa{Launcher class for Aqua browsers on Mac OS X

        Optionally specify a browser name on instantiation.  Note that this
        will not work for Aqua browsers if the user has moved the application
        package after installation.

        If no browser is specified, the default browser, as specified in the
        Internet System Preferences panel, will be used.
        cCs
||_dS)N)r)r.rrrrr/&szMacOSX.__init__rTc	Cs�d|kst�d|krd|}tt|��}|jdkrDd|jdd�}n<|jdkrTd	}nd
|d}d|jdd�}d
|j||f}tjdd�}|dkr�dS|j|�|j�}|S)N�'�:zfile:�defaultzopen location "%s"�"z%22ZOmniWebr-ztoWindow %dr
zOpenURL "%s"z�tell application "%s"
                                activate
                                %s %s
                            end tell�	osascript�wF)	�AssertionErrorrL�boolrr5r'�popen�writerr)	r.r!r"r#�scriptZtoWindowr+�osapiperQrrrr)s"


zMacOSX.openN)rT)rr	r
r1r/rrrrrr�s	r�c@seZdZdd�Zddd�ZdS)	�MacOSXOSAScriptcCs
||_dS)N)�_name)r.rrrrr/KszMacOSXOSAScript.__init__rTcCsb|jdkrd|jdd�}nd|j|jdd�f}tjdd�}|dkrJdS|j|�|j�}|S)	Nr�zopen location "%s"r�z%22z�
                   tell application "%s"
                       activate
                       open location "%s"
                   end
                   r�r�F)r�r5r'r�r�rr)r.r!r"r#r�r�rQrrrrNs

zMacOSXOSAScript.openN)rT)rr	r
r/rrrrrr�Jsr�Zsafarir�r�ZBROWSERr-c	Cs�ddl}dtjd}y|jtjdd�d�\}}WnJ|jk
r~}z,t|tjd�t|tjd�tjd�WYdd}~XnXd}x*|D]"\}}|dkr�d}q�|dkr�d}q�Wt|�dkr�t|tjd�tjd�|d}t||�td	�dS)
NrzDUsage: %s [-n | -t] url
    -n: open new window
    -t: open new tabr
Zntd)�filez-nz-tr$�)	�getoptr<�argv�error�printrI�exit�lenr)	r�ZusageZoptsr2�msgZnew_win�o�ar!rrr�main~s(

r��__main__)Nr
)N)rT)r
rrrrrr)2r1r'rr%r<r>�__all__�	Exceptionrrrrrrrrr�objectr,rrrFrXrYrZr[ZChromiumr\r]r^rcr�r�r&r=r�r(rhZiexplorerr�r�r�pathsepZ_userchoices�reverserBr+r�rrrrr�<module>s�



"N

	
45B

.



pipes.cpython-36.opt-1.pyc000064400000017202150335715140011257 0ustar003


 \�"�@spdZddlZddlZddlZddlmZdgZdZdZdZ	dZ
d	Zd
Zeee	e
eegZ
Gdd�d�Zdd
�ZdS)a�Conversion pipeline templates.

The problem:
------------

Suppose you have some data that you want to convert to another format,
such as from GIF image format to PPM image format.  Maybe the
conversion involves several steps (e.g. piping it through compress or
uuencode).  Some of the conversion steps may require that their input
is a disk file, others may be able to read standard input; similar for
their output.  The input to the entire conversion may also be read
from a disk file or from an open file, and similar for its output.

The module lets you construct a pipeline template by sticking one or
more conversion steps together.  It will take care of creating and
removing temporary files if they are necessary to hold intermediate
data.  You can then use the template to do conversions from many
different sources to many different destinations.  The temporary
file names used are different each time the template is used.

The templates are objects so you can create templates for many
different conversion steps and store them in a dictionary, for
instance.


Directions:
-----------

To create a template:
    t = Template()

To add a conversion step to a template:
   t.append(command, kind)
where kind is a string of two characters: the first is '-' if the
command reads its standard input or 'f' if it requires a file; the
second likewise for the output. The command must be valid /bin/sh
syntax.  If input or output files are required, they are passed as
$IN and $OUT; otherwise, it must be  possible to use the command in
a pipeline.

To add a conversion step at the beginning:
   t.prepend(command, kind)

To convert a file to another file using a template:
  sts = t.copy(infile, outfile)
If infile or outfile are the empty string, standard input is read or
standard output is written, respectively.  The return value is the
exit status of the conversion pipeline.

To open a file for reading or writing through a conversion pipeline:
   fp = t.open(file, mode)
where mode is 'r' to read the file, or 'w' to write it -- just like
for the built-in function open() or for os.popen().

To create a new template object initialized to a given one:
   t2 = t.clone()
�N)�quote�TemplateZffz-fzf-z--z.-z-.c@speZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)rz'Class representing a pipeline template.cCsd|_|j�dS)z-Template() returns a fresh pipeline template.rN)�	debugging�reset)�self�r�/usr/lib64/python3.6/pipes.py�__init__UszTemplate.__init__cCsd|jfS)z t.__repr__() implements repr(t).z<Template instance, steps=%r>)�steps)rrrr�__repr__ZszTemplate.__repr__cCs
g|_dS)z<t.reset() restores a pipeline template to its initial state.N)r
)rrrrr^szTemplate.resetcCs"t�}|jdd�|_|j|_|S)zbt.clone() returns a new pipeline template with identical
        initial state as the current one.N)rr
r)r�trrr�clonebszTemplate.clonecCs
||_dS)z(t.debug(flag) turns debugging on or off.N)r)r�flagrrr�debugjszTemplate.debugcCs�t|�td�k	rtd��|tkr.td|f��|tkr>td��|jr^|jddtkr^td��|ddkr�tjd	|�r�td
��|ddkr�tjd|�r�td��|jj	||f�d
S)z/t.append(cmd, kind) adds a new step at the end.�z%Template.append: cmd must be a stringzTemplate.append: bad kind %rz-Template.append: SOURCE can only be prepended�z'Template.append: already ends with SINKr�fz\$IN\bz#Template.append: missing $IN in cmdz\$OUT\bz$Template.append: missing $OUT in cmdN���)
�type�	TypeError�	stepkinds�
ValueError�SOURCEr
�SINK�re�search�append)r�cmd�kindrrrrnszTemplate.appendcCs�t|�td�k	rtd��|tkr.td|f��|tkr>td��|jr^|jddtkr^td��|ddkr�tjd	|�r�td
��|ddkr�tjd|�r�td��|jj	d||f�d
S)z2t.prepend(cmd, kind) adds a new step at the front.rz&Template.prepend: cmd must be a stringzTemplate.prepend: bad kind %rz+Template.prepend: SINK can only be appendedrrz,Template.prepend: already begins with SOURCErz\$IN\bz$Template.prepend: missing $IN in cmdz\$OUT\bz%Template.prepend: missing $OUT in cmdN)
rrrrrr
rrr�insert)rrrrrr�prepend~szTemplate.prependcCs6|dkr|j|�S|dkr$|j|�Std|f��dS)z~t.open(file, rw) returns a pipe or file object open for
        reading or writing; the file is the other end of the pipeline.�r�wz,Template.open: rw must be 'r' or 'w', not %rN)�open_r�open_wr)r�fileZrwrrr�open�s

z
Template.opencCsB|jst|d�S|jddtkr*td��|j|d�}tj|d�S)zit.open_r(file) and t.open_w(file) implement
        t.open(file, 'r') and t.open(file, 'w') respectively.r!rz)Template.open_r: pipeline ends width SINKrr)r
r&rr�makepipeline�os�popen)rr%rrrrr#�s
zTemplate.open_rcCsB|jst|d�S|jddtkr*td��|jd|�}tj|d�S)Nr"rrz,Template.open_w: pipeline begins with SOURCEr)r
r&rrr'r(r))rr%rrrrr$�s
zTemplate.open_wcCstj|j||��S)N)r(�systemr')r�infile�outfilerrr�copy�sz
Template.copycCs(t||j|�}|jr$t|�d|}|S)Nzset -x; )r'r
r�print)rr+r,rrrrr'�s
zTemplate.makepipelineN)�__name__�
__module__�__qualname__�__doc__r	rrr
rrr r&r#r$r-r'rrrrrRs

cCs�g}x"|D]\}}|jd||dg�q
W|s>|jddddg�|ddd�\}}|ddkrx|rx|jdddddg�||dd<|ddd�\}}|ddkr�|r�|jddddg�||dd<g}x�tdt|��D]v}||dd}||d}	|ddk�s|	ddkr�tj�\}
}tj|
�|j|�|||dd<||d<q�Wx�|D]�}|\}
}}}|ddk�r�d	t|�d
|}|ddk�r�dt|
�d
|}|ddk�r�|
�r�|d
t|
�}|ddk�r�|�r�|dt|�}||d<�q\W|dd}xd|dd�D]T}|dd�\}}|ddk�rfd|k�rXd|d}|d|}n|d|}�q W|�r�d}x|D]}|dt|�}�q�Wdt|d�d}|d|d|}|S)Nr�catz--rr�r�zOUT=z; zIN=�-z <z >z{ z; }z |
�
zrm -f� ztrap z; exitz 1 2 3 13 14 15rrrr)	rr�range�len�tempfileZmkstempr(�closer)r+r
r,�listrrZgarbage�iZlkindZrkind�fdZtemp�item�infZoutfZcmdlistZrmcmdr%Ztrapcmdrrrr'�s`

 


r')r2rr(r;Zshlexr�__all__ZFILEIN_FILEOUTZ
STDIN_FILEOUTZ
FILEIN_STDOUTZSTDIN_STDOUTrrrrr'rrrr�<module>9scbz2.cpython-36.opt-1.pyc000064400000026024150335715140010636 0ustar003


 \�0�
@s�dZddddddgZdZdd	lmZdd
lZdd
lZdd
lZdd
l	Z	yddl
mZWn ek
rtddl
mZYnXddlmZmZdZd
ZdZGdd�de	j�Zddd�Zddd�Zdd�Zd
S)z�Interface to the libbzip2 compression library.

This module provides a file interface, classes for incremental
(de)compression, and functions for one-shot (de)compression.
�BZ2File�
BZ2Compressor�BZ2Decompressor�open�compress�
decompressz%Nadeem Vawda <nadeem.vawda@gmail.com>�)rN)�RLock)rr��c@s�eZdZdZd)dd�Zdd�Zed	d
��Zdd�Zd
d�Z	dd�Z
dd�Zd*dd�Zd,dd�Z
d.dd�Zdd�Zd0dd�Zd2dd �Zd!d"�Zd#d$�Zejfd%d&�Zd'd(�ZdS)3ra@A file object providing transparent bzip2 (de)compression.

    A BZ2File can act as a wrapper for an existing file object, or refer
    directly to a named file on disk.

    Note that BZ2File provides a *binary* file interface - data read is
    returned as bytes, and data to be written should be given as bytes.
    �rN�	cCsTt�|_d|_d|_t|_|dk	r.tjdt�d|ko@dknsNt	d��|dkr`d	}t
}nb|dkr|d}t}t|�|_
nF|dkr�d
}t}t|�|_
n*|dkr�d}t}t|�|_
nt	d|f��t|tttjf��r�t||�|_d|_||_n.t|d��st|d��r||_||_ntd��|jt
k�rJtj|jttd�}tj|�|_nd|_dS)a>Open a bzip2-compressed file.

        If filename is a str, bytes, or PathLike object, it gives the
        name of the file to be opened. Otherwise, it should be a file
        object, which will be used to read or write the compressed data.

        mode can be 'r' for reading (default), 'w' for (over)writing,
        'x' for creating exclusively, or 'a' for appending. These can
        equivalently be given as 'rb', 'wb', 'xb', and 'ab'.

        buffering is ignored. Its use is deprecated.

        If mode is 'w', 'x' or 'a', compresslevel can be a number between 1
        and 9 specifying the level of compression: 1 produces the least
        compression, and 9 (default) produces the most compression.

        If mode is 'r', the input file may be the concatenation of
        multiple compressed streams.
        NFz)Use of 'buffering' argument is deprecatedr	rz%compresslevel must be between 1 and 9�r�rb�w�wb�x�xb�a�abzInvalid mode: %rT�read�writez6filename must be a str, bytes, file or PathLike object)Ztrailing_errorr)r
rr)rr)rr)rr)r�_lock�_fp�_closefp�_MODE_CLOSED�_mode�warnings�warn�DeprecationWarning�
ValueError�
_MODE_READ�_MODE_WRITEr�_compressor�
isinstance�str�bytes�os�PathLike�
_builtin_open�hasattr�	TypeError�_compressionZDecompressReaderr�OSError�io�BufferedReader�_buffer�_pos)�self�filename�mode�	buffering�
compresslevelZ	mode_code�raw�r7�/usr/lib64/python3.6/bz2.py�__init__+sL
zBZ2File.__init__cCs�|j��|jtkrdSz<|jtkr.|jj�n"|jtkrP|jj|j	j
��d|_	Wdz|jrf|jj�Wdd|_d|_t|_d|_XXWdQRXdS)z�Flush and close the file.

        May be called more than once without error. Once the file is
        closed, any other operation on it will raise a ValueError.
        NF)rrrr r/�closer!rrr"�flushr)r1r7r7r8r:ps 



z
BZ2File.closecCs
|jtkS)zTrue if this file is closed.)rr)r1r7r7r8�closed�szBZ2File.closedcCs|j�|jj�S)z3Return the file descriptor for the underlying file.)�_check_not_closedr�fileno)r1r7r7r8r>�szBZ2File.filenocCs|j�o|jj�S)z)Return whether the file supports seeking.)�readabler/�seekable)r1r7r7r8r@�szBZ2File.seekablecCs|j�|jtkS)z/Return whether the file was opened for reading.)r=rr )r1r7r7r8r?�szBZ2File.readablecCs|j�|jtkS)z/Return whether the file was opened for writing.)r=rr!)r1r7r7r8�writable�szBZ2File.writablerc	Cs&|j�|j�|jj|�SQRXdS)z�Return buffered data without advancing the file position.

        Always returns at least one byte of data, unless at EOF.
        The exact number of bytes returned is unspecified.
        N)r�_check_can_readr/�peek)r1�nr7r7r8rC�szBZ2File.peekr	c	Cs&|j�|j�|jj|�SQRXdS)z�Read up to size uncompressed bytes from the file.

        If size is negative or omitted, read until EOF is reached.
        Returns b'' if the file is already at EOF.
        N)rrBr/r)r1�sizer7r7r8r�szBZ2File.readc	Cs4|j�$|j�|dkrtj}|jj|�SQRXdS)z�Read up to size uncompressed bytes, while trying to avoid
        making multiple reads from the underlying stream. Reads up to a
        buffer's worth of data if size is negative.

        Returns b'' if the file is at EOF.
        rN)rrBr-�DEFAULT_BUFFER_SIZEr/�read1)r1rEr7r7r8rG�s
z
BZ2File.read1c	Cs&|j�|j�|jj|�SQRXdS)zRRead bytes into b.

        Returns the number of bytes read (0 for EOF).
        N)rrBr/�readinto)r1�br7r7r8rH�szBZ2File.readintoc	CsJt|t�s$t|d�std��|j�}|j�|j�|jj|�SQRXdS)a
Read a line of uncompressed bytes from the file.

        The terminating newline (if present) is retained. If size is
        non-negative, no more than size bytes will be read (in which
        case the line may be incomplete). Returns b'' if already at EOF.
        �	__index__zInteger argument expectedN)	r#�intr)r*rJrrBr/�readline)r1rEr7r7r8rL�s

zBZ2File.readlinec	CsJt|t�s$t|d�std��|j�}|j�|j�|jj|�SQRXdS)z�Read a list of lines of uncompressed bytes from the file.

        size can be specified to control the number of lines read: no
        further lines will be read once the total size of the lines read
        so far equals or exceeds size.
        rJzInteger argument expectedN)	r#rKr)r*rJrrBr/�	readlines)r1rEr7r7r8rM�s

zBZ2File.readlinescCsL|j�<|j�|jj|�}|jj|�|jt|�7_t|�SQRXdS)z�Write a byte string to the file.

        Returns the number of uncompressed bytes written, which is
        always len(data). Note that due to buffering, the file on disk
        may not reflect the data written until close() is called.
        N)rZ_check_can_writer"rrrr0�len)r1�dataZ
compressedr7r7r8r�sz
BZ2File.writec
Cs |j�tjj||�SQRXdS)z�Write a sequence of byte strings to the file.

        Returns the number of uncompressed bytes written.
        seq can be any iterable yielding byte strings.

        Line separators are not added between the written byte strings.
        N)rr+�
BaseStream�
writelines)r1�seqr7r7r8rQ�szBZ2File.writelinesc
Cs(|j�|j�|jj||�SQRXdS)a�Change the file position.

        The new position is specified by offset, relative to the
        position indicated by whence. Values for whence are:

            0: start of stream (default); offset must not be negative
            1: current stream position
            2: end of stream; offset must not be positive

        Returns the new file position.

        Note that seeking is emulated, so depending on the parameters,
        this operation may be extremely slow.
        N)rZ_check_can_seekr/�seek)r1�offset�whencer7r7r8rSszBZ2File.seekc	Cs4|j�$|j�|jtkr$|jj�S|jSQRXdS)z!Return the current file position.N)rr=rr r/�tellr0)r1r7r7r8rVs


zBZ2File.tell)rNr)r���)rWrW)rWrW)rWrW)rW)�__name__�
__module__�__qualname__�__doc__r9r:�propertyr<r>r@r?rArCrrGrHrLrMrrQr-�SEEK_SETrSrVr7r7r7r8r s$	
E




	

rrcCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|jdd�}t|||d	�}d|kr�tj||||�S|SdS)
aOpen a bzip2-compressed file in binary or text mode.

    The filename argument can be an actual filename (a str, bytes, or
    PathLike object), or an existing file object to read from or write
    to.

    The mode argument can be "r", "rb", "w", "wb", "x", "xb", "a" or
    "ab" for binary mode, or "rt", "wt", "xt" or "at" for text mode.
    The default mode is "rb", and the default compresslevel is 9.

    For binary mode, this function is equivalent to the BZ2File
    constructor: BZ2File(filename, mode, compresslevel). In this case,
    the encoding, errors and newline arguments must not be provided.

    For text mode, a BZ2File object is created, and wrapped in an
    io.TextIOWrapper instance with the specified encoding, error
    handling behavior, and line ending(s).

    �trIzInvalid mode: %rNz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary moder
)r5)r�replacerr-�
TextIOWrapper)r2r3r5�encoding�errors�newlineZbz_modeZbinary_filer7r7r8r!scCst|�}|j|�|j�S)z�Compress a block of data.

    compresslevel, if given, must be a number between 1 and 9.

    For incremental compression, use a BZ2Compressor object instead.
    )rrr;)rOr5�compr7r7r8rJscCsjg}xZ|r^t�}y|j|�}Wntk
r<|r6Pn�YnX|j|�|jsVtd��|j}qWdj|�S)zjDecompress a block of data.

    For incremental decompression, use a BZ2Decompressor object instead.
    zACompressed data ended before the end-of-stream marker was reached�)rrr,�append�eofrZunused_data�join)rOZresultsZdecomp�resr7r7r8rUs

)rrNNN)r)r[�__all__�
__author__�builtinsrr(r-r&rr+Z	threadingr�ImportErrorZdummy_threadingZ_bz2rrrr r!rPrrrr7r7r7r8�<module>s.

(
reprlib.cpython-36.opt-1.pyc000064400000012432150335715140011576 0ustar003


 \��@s�dZdddgZddlZddlmZyddlmZWn ek
rRddlmZYnXd
d	d�Z	Gd
d�d�Z
dd�Ze
�Zej
Z
dS)zGRedo the builtin repr() (representation) but with limits on most sizes.�Repr�repr�recursive_repr�N)�islice)�	get_ident�...cs�fdd�}|S)zGDecorator to make a repr function return fillvalue for a recursive callcsXt�����fdd�}t�d�|_t�d�|_t�d�|_t�d�|_t�di�|_|S)NcsBt|�t�f}|�kr�S�j|�z�|�}Wd�j|�X|S)N)�idr�add�discard)�self�key�result)�	fillvalue�repr_running�
user_function��/usr/lib64/python3.6/reprlib.py�wrappers
z<recursive_repr.<locals>.decorating_function.<locals>.wrapper�
__module__�__doc__�__name__�__qualname__�__annotations__)�set�getattrrrrrr)rr)r)rrr�decorating_functionsz+recursive_repr.<locals>.decorating_functionr)rrr)rrrsc@s~eZdZdd�Zdd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS) rcCsFd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
dS)N�����()�maxlevel�maxtuple�maxlist�maxarray�maxdict�maxset�maxfrozenset�maxdeque�	maxstring�maxlong�maxother)rrrr�__init__)sz
Repr.__init__cCs|j||j�S)N)�repr1r!)r�xrrrr6sz	Repr.reprcCsVt|�j}d|kr$|j�}dj|�}t|d|�rFt|d|�||�S|j||�SdS)N� �_�repr_)�typer�split�join�hasattrr�
repr_instance)rr.�level�typename�partsrrrr-9s

z
Repr.repr1�c
s�t|�}|dkr|rd}nX|d�|j���fdd�t||�D�}	||krT|	jd�dj|	�}|dkrr|rr||}d|||fS)Nrz...�csg|]}�|���qSrr)�.0�elem)�newlevelr-rr�
<listcomp>Jsz'Repr._repr_iterable.<locals>.<listcomp>z, z%s%s%s)�lenr-r�appendr4)
rr.r7�left�right�maxiter�trail�n�s�piecesr)r>r-r�_repr_iterableCs

zRepr._repr_iterablecCs|j||dd|jd�S)N�(�)�,)rIr")rr.r7rrr�
repr_tuplePszRepr.repr_tuplecCs|j||dd|j�S)N�[�])rIr#)rr.r7rrr�	repr_listSszRepr.repr_listcCs,|sd|jSd|j}|j|||d|j�S)Nzarray('%s')z
array('%s', [z]))�typecoderIr$)rr.r7�headerrrr�
repr_arrayVs

zRepr.repr_arraycCs$|sdSt|�}|j||dd|j�S)Nzset()�{�})�_possibly_sortedrIr&)rr.r7rrr�repr_set\sz
Repr.repr_setcCs$|sdSt|�}|j||dd|j�S)Nzfrozenset()zfrozenset({z}))rVrIr')rr.r7rrr�repr_frozensetbs
zRepr.repr_frozensetcCs|j||dd|j�S)Nzdeque([z]))rIr()rr.r7rrr�
repr_dequeiszRepr.repr_dequecCs�t|�}|dkrdS|dkr dS|d}|j}g}xBtt|�|j�D].}|||�}||||�}	|jd||	f�qDW||jkr�|jd�dj|�}
d|
fS)	Nrz{}z{...}r;z%s: %sz...z, z{%s})r@r-rrVr%rAr4)rr.r7rFr>r-rHr�keyrepr�valreprrGrrr�	repr_dictls 



zRepr.repr_dictcCs�tj|d|j��}t|�|jkr�td|jdd�}td|jd|�}tj|d|�|t|�|d��}|d|�d|t|�|d�}|S)Nr��z...)�builtinsrr)r@�max)rr.r7rG�i�jrrr�repr_str{s&$z
Repr.repr_strcCshtj|�}t|�|jkrdtd|jdd�}td|jd|�}|d|�d|t|�|d�}|S)Nrr]r^z...)r_rr@r*r`)rr.r7rGrarbrrr�repr_int�s
$z
Repr.repr_intcCs�ytj|�}Wn$tk
r2d|jjt|�fSXt|�|jkr�td|jdd�}td|jd|�}|d|�d|t|�|d�}|S)Nz<%s instance at %#x>rr]r^z...)	r_r�	Exception�	__class__rrr@r+r`)rr.r7rGrarbrrrr6�s$zRepr.repr_instanceN)r:)rrrr,rr-rIrMrPrSrWrXrYr\rcrdr6rrrrr's



	cCs&yt|�Stk
r t|�SXdS)N)�sortedre�list)r.rrrrV�srV)r)r�__all__r_�	itertoolsr�_threadr�ImportErrorZ
_dummy_threadrrrV�aReprrrrrr�<module>s

s	zipfile.cpython-36.pyc000064400000143254150335715140010651 0ustar003

�\dh48�2@s�dZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZyddlZWne
k
r|ddlZYnXyddlZejZWne
k
r�dZejZYnXyddlZWne
k
r�dZYnXyddlZWne
k
r�dZYnXddddddd	d
ddd
dgZGdd�de�ZGdd�de�ZeZZdfZdhZdjZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&e
j'e%�Z(dZ)dZ*dZ+dZ,dZ-d Z.d!Z/d"Z0dZ1d#Z2d$Z3d%Z4e
j'e3�Z5dZ6dZ7dZ8dZ9dZ:d Z;d!Z<d"Z=dZ>d#Z?d&Z@d'ZAdZBd(ZCdZDd)ZEdZFd*ZGd+ZHd,ZId-ZJe
j'eI�ZKdZLdZMdZNdZOdZPd ZQd!ZRd"ZSdZTd#ZUd&ZVd'ZWd.ZXd/ZYe
j'eX�ZZd0Z[d1Z\e
j'e[�Z]dZ^dZ_dZ`dZadZbd Zcd!Zdd"ZedZfd#Zgd2Zhe
jid3�Zjd4d5�Zkd6d7�Zld8d
�Zmd9d:�Znd;d<�ZoGd=d�dep�ZqGd>d?�d?�ZrGd@dA�dA�ZsGdBdC�dC�ZtdDdEdFdFdFdFdGdHdIdJdGdKdLdMdNdOdPdQ�ZudRdS�ZvdTdU�ZwdVdW�ZxGdXdY�dY�ZyGdZd[�d[�ZzGd\d]�d]ej{�Z|Gd^d_�d_ej{�Z}Gd`d�d�Z~Gdad
�d
e~�Zdkdbdc�Z�e�ddk�r�e��dS)lzP
Read and write ZIP files.

XXX references to utf-8 need further investigation.
�N�
BadZipFile�
BadZipfile�error�
ZIP_STORED�ZIP_DEFLATED�	ZIP_BZIP2�ZIP_LZMA�
is_zipfile�ZipInfo�ZipFile�	PyZipFile�LargeZipFilec@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/zipfile.pyr+sc@seZdZdZdS)r
zu
    Raised when writing a zipfile, the zipfile requires ZIP64 extensions
    and those extensions are disabled.
    N)rrr�__doc__rrrrr
/s��������-�.�?s<4s4H2LHsPK�������	z<4s4B4HL2L5H2LsPK�
��
���z<4s2B4HL2L2HsPKz<4sLQLsPKz
<4sQ2H2L4QsPKiPKz<HHc
Cs�tj}d}g}d}}xf|dt|�kr|||||d��\}}|d|}	||krv||krn|j|||��|	}d}|	}qW|s�|Sdj|�S)NFrr T�)�_EXTRA_FIELD_STRUCT�unpack�len�append�join)
�extraZxidsr-Zmodified�buffer�start�iZxidZxlen�jrrr�_strip_extra�s r6cCs*yt|�rdSWntk
r$YnXdS)NTF)�_EndRecData�OSError)�fprrr�_check_zipfile�sr:cCsVd}y8t|d�rt|d�}nt|d��}t|�}WdQRXWntk
rPYnX|S)z�Quickly see if a file is a ZIP file by checking the magic number.

    The filename argument may be a file or file-like object too.
    F�read)r9�rbN)�hasattrr:�openr8)�filename�resultr9rrrr	�s
cCsy|j|td�Wntk
r(|SX|jt�}t|�tkrD|Stjt|�\}}}}|tkrd|S|dkst|dkr|t	d��|j|tt
d�|jt
�}t|�t
kr�|Stjt|�\
}}}	}
}}}
}}}|tkr�|S||t
<||t<||t<|
|t<||t<||t<||t<|S)zM
    Read the ZIP64 end-of-archive records and use that to update endrec
    rrrz3zipfiles that span multiple disks are not supported)�seek�sizeEndCentDir64Locatorr8r;r.�structr-�structEndArchive64Locator�stringEndArchive64Locatorr�sizeEndCentDir64�structEndArchive64�stringEndArchive64�_ECD_SIGNATURE�_ECD_DISK_NUMBER�_ECD_DISK_START�_ECD_ENTRIES_THIS_DISK�_ECD_ENTRIES_TOTAL�	_ECD_SIZE�_ECD_OFFSET)�fpin�offset�endrec�dataZsigZdisknoZreloffZdisksZsz�create_versionZread_versionZdisk_numZdisk_dirZdircountZ	dircount2ZdirsizeZ	diroffsetrrr�
_EndRecData64�s6

 rUc	Csf|jdd�|j�}y|jtd�Wntk
r:dSX|j�}t|�tkr�|dd�tkr�|d	d�dkr�tjt	|�}t
|�}|jd�|j|t�t|t|�St
|d
td�}|j|d�|j�}|jt�}|dk�rb|||t�}t|�tk�rdSt
tjt	|��}|t}||t|t|�}|j|�|j||�t|||||�SdS)z�Return data from the "End of Central Directory" record, or None.

    The data is a list of the nine items in the ZIP "End of central dir"
    record followed by a tenth item, the file seek offset of this record.rrNr sr+rr���i)rA�tell�sizeEndCentDirr8r;r.�stringEndArchiverCr-�structEndArchive�listr/rU�max�rfind�_ECD_COMMENT_SIZE)	rPZfilesizerSrRZmaxCommentStartr3ZrecDataZcommentSize�commentrrrr7s>



r7c@sVeZdZdZd)Zd+dd�Zdd�Zd,dd �Zd!d"�Zd#d$�Z	e
d-d%d&��Zd'd(�ZdS).r
z>Class with attributes describing each file in the ZIP archive.�
orig_filenamer?�	date_time�
compress_typer_r1�
create_systemrT�extract_version�reserved�	flag_bits�volume�
internal_attr�
external_attr�
header_offset�CRC�
compress_size�	file_size�	_raw_time�_end_offset�NoName�rrcCs�||_|jtd��}|dkr(|d|�}tjdkrJtj|krJ|jtjd�}||_||_|ddkrjtd��t	|_
d|_d|_t
jdkr�d|_nd|_t|_t|_d|_d|_d|_d|_d|_d|_dS)Nr�/i�z+ZIP does not support timestamps before 1980r+Zwin32r)r`�find�chr�os�sep�replacer?ra�
ValueErrorrrbr_r1�sys�platformrc�DEFAULT_VERSIONrTrdrerfrgrhriro)�selfr?raZ	null_byterrr�__init__Xs0
zZipInfo.__init__cCs�d|jj|jfg}|jtkr8|jdtj|j|j��|jd?}|jd@}|rd|jdt	j
|��|rv|jd|�|j�}|s�|jr�|jd|j�|s�|j
r�|jtks�|j|j
kr�|jd|j
�|jd	�d
j|�S)Nz<%s filename=%rz compress_type=%sri��z filemode=%rz external_attr=%#xz
 file_size=%rz compress_size=%r�>�)�	__class__rr?rbrr/�compressor_names�getri�stat�filemode�is_dirrmrlr0)r|r@�hi�lo�isdirrrr�__repr__�s(




zZipInfo.__repr__NcCs||j}|ddd>|dd>B|dB}|dd>|d	d>B|ddB}|jd
@rfd}}}n|j}|j}|j}|j}d}	|dkr�|tkp�|tk}|r�d}
|tj|
dtj	|
�d	||�}|tks�|tkr�|s�t
d
��d}d}t}	|jt
k�rtt|	�}	n|jtk�rtt|	�}	t|	|j�|_t|	|j�|_|j�\}}tjtt|j|j||j|||||t|�t|��
}
|
||S)z-Return the per-file header as a bytes object.ri�r$rr!rrr&r rNz<HHQQz'Filesize would require ZIP64 extensionsl��)rarfrkrlrmr1�ZIP64_LIMITrC�pack�calcsizer
�
ZIP64_VERSIONrbrr\�
BZIP2_VERSIONr�LZMA_VERSIONrdrT�_encodeFilenameFlags�structFileHeader�stringFileHeaderrer.)r|�zip64�dt�dosdate�dostimerkrlrmr1�min_version�fmtr?rf�headerrrr�
FileHeader�sF$$



zZipInfo.FileHeadercCs>y|jjd�|jfStk
r8|jjd�|jdBfSXdS)N�asciizutf-8i)r?�encoderf�UnicodeEncodeError)r|rrrr��szZipInfo._encodeFilenameFlagscCs(|j}tj}�xt|�dk�r"|d|dd��\}}|dk�r|dkrZ|d|dd��}nV|dkrv|d|dd	��}n:|d
kr�|d|dd��}n|d
kr�f}ntd||f��d
}|jdkr�|||_|d7}|jdkr�|||_|d7}|jdk�r|j}|||_|d7}||dd�}qWdS)Nr z<HHr�z<QQQ�rz<QQrrz<Qrrz"Corrupt extra field %04x (size=%d)��������)r�r�)r1rCr-r.rrmrlrj)r|r1r-�tp�lnZcounts�idx�oldrrr�_decodeExtra�s4





zZipInfo._decodeExtracCs�t|tj�rtj|�}tj|�}tj|j�}tj|j	�}|dd�}|dkrP|}tj
jtj
j|�d�}x$|dtj
tjfkr�|dd�}qjW|r�|d7}|||�}|jd@d>|_|r�d|_|jdO_n|j|_|S)a_Construct an appropriate ZipInfo for a file on the filesystem.

        filename should be the path to a file or directory on the filesystem.

        arcname is the name which it will have within the archive (by default,
        this will be the same as filename, but without a drive letter and with
        leading path separators removed).
        rr"Nrrri��r)�
isinstanceru�PathLike�fspathr��S_ISDIR�st_mode�time�	localtime�st_mtime�path�normpath�
splitdriverv�altseprirm�st_size)�clsr?�arcname�str��mtimera�zinforrr�	from_file�s(



zZipInfo.from_filecCs|jddkS)z2Return True if this archive member is a directory.rrr���)r?)r|rrrr�szZipInfo.is_dir)r`r?rarbr_r1rcrTrdrerfrgrhrirjrkrlrmrnro�rqrrrrr)rpr�)N)N)
rrrr�	__slots__r}r�r�r�r��classmethodr�r�rrrrr
>s:
+
.$!c@s<eZdZdZdd�ZdZdd�Zdd�Zd	d
�Zdd�Z	dS)
�
_ZipDecrypteraClass to handle decryption of files stored within a ZIP archive.

    ZIP supports a password-based form of encryption. Even though known
    plaintext attacks have been found against it, it is still useful
    to be able to get data out of such a file.

    Usage:
        zd = _ZipDecrypter(mypwd)
        plain_char = zd(cypher_char)
        plain_text = map(zd, cypher_text)
    cCshd}dgd}xTtd�D]H}|}x6td�D]*}|d@rH|d?d@|A}q*|d?d@}q*W|||<qW|S)z�Generate a CRC-32 table.

        ZIP encryption uses the CRC32 one-byte primitive for scrambling some
        internal keys. We noticed that a direct implementation is faster than
        relying on binascii.crc32().
        l q[r�rri���)�range)Zpoly�tabler4�crcr5rrr�_GenerateCRCTable%s
z_ZipDecrypter._GenerateCRCTableNcCs|d?d@|j||Ad@AS)z(Compute the CRC32 primitive on one byte.ri����)�crctable)r|Zchr�rrr�_crc329sz_ZipDecrypter._crc32cCsBtjdkrtj�t_d|_d|_d|_x|D]}|j|�q,WdS)NixV4i�gE#i�xV4)r�r�r��key0�key1�key2�_UpdateKeys)r|�pwd�prrrr}=s


z_ZipDecrypter.__init__cCsX|j||j�|_|j|jd@d@|_|jddd@|_|j|jd?d@|j�|_dS)Nr�l��i�rr�)r�r�r�r�)r|�crrrr�Fsz_ZipDecrypter._UpdateKeyscCs>t|t�st�|jdB}|||dAd?d@A}|j|�|S)zDecrypt a single character.rrrr�)r��int�AssertionErrorr�r�)r|r��krrr�__call__Ls


z_ZipDecrypter.__call__)
rrrrr�r�r�r}r�r�rrrrr�s	r�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�LZMACompressorcCs
d|_dS)N)�_comp)r|rrrr}WszLZMACompressor.__init__cCsFtjdtji�}tjtjtjtj|�gd�|_tjdddt	|��|S)N�id)�filtersz<BBHr$r )
�lzmaZ_encode_filter_properties�FILTER_LZMA1r��
FORMAT_RAW�_decode_filter_propertiesr�rCr�r.)r|Zpropsrrr�_initZszLZMACompressor._initcCs*|jdkr|j�|jj|�S|jj|�S)N)r�r��compress)r|rSrrrr�as
zLZMACompressor.compresscCs&|jdkr|j�|jj�S|jj�S)N)r�r��flush)r|rrrr�fs
zLZMACompressor.flushN)rrrr}r�r�r�rrrrr�Usr�c@seZdZdd�Zdd�ZdS)�LZMADecompressorcCsd|_d|_d|_dS)Nr+F)�_decomp�_unconsumed�eof)r|rrrr}nszLZMADecompressor.__init__cCs�|jdkr�|j|7_t|j�dkr*dStjd|jdd��\}t|j�d|krXdStjtjtjtj	|jdd|��gd�|_|jd|d�}|`|jj
|�}|jj|_|S)Nr r+z<Hr)r�)r�r�r.rCr-r�r�r�r�r��
decompressr�)r|rSZpsizer@rrrr�ss

zLZMADecompressor.decompressN)rrrr}r�rrrrr�lsr�ZstoreZshrink�reduceZimplode�tokenizeZdeflateZ	deflate64Zbzip2r�ZterseZlz77ZwavpackZppmd)rrrrr r!r"r#rr$r%rrr*��a�bcCsX|tkr
nJ|tkr tsTtd��n4|tkr6tsTtd��n|tkrLtsTtd��ntd��dS)Nz.Compression requires the (missing) zlib modulez-Compression requires the (missing) bz2 modulez.Compression requires the (missing) lzma modulez(That compression method is not supported)	rr�zlib�RuntimeErrorr�bz2rr��NotImplementedError)�compressionrrr�_check_compression�sr�cCs@|tkrtjtjtjd�S|tkr*tj�S|tkr8t	�SdSdS)Nr(i�)
rr�ZcompressobjZZ_DEFAULT_COMPRESSIONZDEFLATEDrr�Z
BZ2Compressorrr�)rbrrr�_get_compressor�s
r�cCsn|tkrdS|tkrtjd�S|tkr.tj�S|tkr<t�St	j
|�}|r\td||f��ntd|f��dS)Nr(zcompression type %d (%s)zcompression type %di�)rrr�Z
decompressobjrr�ZBZ2Decompressorrr�r�r�r�)rbZdescrrrr�_get_decompressor�s

r�c@s0eZdZdd�Zddd�Zddd�Zd	d
�ZdS)�_SharedFilecCs2||_||_||_||_||_|j|_|j|_dS)N)�_file�_pos�_close�_lock�_writing�seekablerW)r|�file�pos�close�lock�writingrrrr}�sz_SharedFile.__init__rc	CsB|j�2|j�rtd��|jj|j�|jj�|_|jSQRXdS)Nz}Can't reposition in the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.)r�r�rxr�rAr�rW)r|rQ�whencerrrrA�sz_SharedFile.seekrc	CsL|j�<|j�rtd��|jj|j�|jj|�}|jj�|_|SQRXdS)NzyCan't read from the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.)r�r�rxr�rAr�r;rW)r|�nrSrrrr;�sz_SharedFile.readcCs$|jdk	r |j}d|_|j|�dS)N)r�r�)r|�fileobjrrrr��s
z_SharedFile.closeN)rr�)r�)rrrr}rAr;r�rrrrr��s	


r�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�	_TellablecCs||_d|_dS)Nr)r9rQ)r|r9rrrr}�sz_Tellable.__init__cCs|jj|�}|j|7_|S)N)r9�writerQ)r|rSr�rrrr��sz_Tellable.writecCs|jS)N)rQ)r|rrrrW�sz_Tellable.tellcCs|jj�dS)N)r9r�)r|rrrr��sz_Tellable.flushcCs|jj�dS)N)r9r�)r|rrrr�sz_Tellable.closeN)rrrr}r�rWr�r�rrrrr��s
r�cs�eZdZdZd&ZdZd'Zd(dd	�Zd
d�Zd*dd
�Z	d+dd�Z
dd�Zd-dd�Zdd�Z
dd�Zdd�Zdd�Z�fdd�Zdd�Zd.d!d"�Zd#d$�Z�ZS)/�
ZipExtFilezZFile-like object for reading an archive member.
       Is returned by ZipFile.open().
    rrir�NFcCs�||_||_||_|j|_|j|_|j|_t	|j�|_
d|_d|_d|_
d|_|jdk	rf|jd8_||_|j|_t|d�r�|j|_td�|_nd|_d|_y4|j�r�|j�|_|j|_|j|_|j|_d|_Wntk
r�YnXdS)NFr+rrrkT)�_fileobj�
_decrypter�_close_fileobjrb�_compress_typerl�_compress_leftrm�_leftr��
_decompressor�_eof�_readbuffer�_offset�newlines�moder?�namer=rk�
_expected_crc�crc32�_running_crc�	_seekabler�rW�_orig_compress_start�_orig_compress_size�_orig_file_size�_orig_start_crc�AttributeError)r|r�r�zipinfoZ	decrypterZ
close_fileobjrrrr}s:



zZipExtFile.__init__cCsvd|jj|jjfg}|jsX|jd|j|jf�|jtkrb|jdt	j
|j|j��n
|jd�|jd�dj|�S)Nz<%s.%sz name=%r mode=%rz compress_type=%sz	 [closed]r~r)r�rr�closedr/r
rrrr�r�r0)r|r@rrrr�?s


zZipExtFile.__repr__cCsL|dkr>|jjd|j�d}|dkr>|j|j|�}||_|Stjj||�S)zrRead and return a line from the stream.

        If limit is specified, at most limit bytes will be read.
        r�
r)r	rsr
�io�BufferedIOBase�readline)r|�limitr4�linerrrrMszZipExtFile.readlinecCsr|t|j�|jkr\|j|�}t|�|jkrJ||j|jd�|_d|_n|jt|�8_|j|j|jd�S)z6Returns buffered bytes without advancing the position.Nri)r.r	r
r;)r|r��chunkrrr�peek]s
zZipExtFile.peekcCsdS)NTr)r|rrr�readablejszZipExtFile.readablecCs|dks|dkrL|j|jd�}d|_d|_x|jsF||j|j�7}q.W|S||j}|t|j�kr~|j|j|�}||_|S|t|j�}|j|jd�}d|_d|_x^|dko�|j�r|j|�}|t|�kr�||_||_||d|�7}P||7}|t|�8}q�W|S)z�Read and return up to n bytes.
        If the argument is omitted, None, or negative, data is read and returned until EOF is reached..
        Nrr+)r	r
r�_read1�MAX_Nr.)r|r��buf�endrSrrrr;ms4

zZipExtFile.readcCs@|jdkrdSt||j�|_|jr<|j|jkr<td|j��dS)NzBad CRC-32 for file %r)rrrrrr
)r|�newdatarrr�_update_crc�s

zZipExtFile._update_crccCs|dks|dkrV|j|jd�}d|_d|_x$|jsP|j|j�}|r.||7}Pq.W|S||j}|t|j�kr�|j|j|�}||_|S|t|j�}|j|jd�}d|_d|_|dk�rxN|j�s
|j|�}|t|�kr�||_||_||d|�7}P|r�||7}Pq�W|S)z7Read up to n bytes with at most one read() system call.Nrr+)r	r
rr"r#r.)r|r�r$rSr%rrr�read1�s>



zZipExtFile.read1cCs"|js|dkrdS|jtkrH|jj}|t|�krR||j|t|��7}n
|j|�}|jtkrj|jdk|_nx|jtkr�t	||j
�}|jj||�}|jjp�|jdko�|jj|_|jr�||jj
�7}n |jj|�}|jjp�|jdk|_|d|j�}|jt|�8_|jdk�rd|_|j|�|S)Nrr+T)rrrrZunconsumed_tailr.�_read2rrr\�
MIN_READ_SIZEr�r�r�rr')r|r�rSrrrr"�s2





zZipExtFile._read1cCsj|jdkrdSt||j�}t||j�}|jj|�}|jt|�8_|sLt�|jdk	rft	t
|j|��}|S)Nrr+)rr\r*�minrr;r.�EOFErrorr�bytes�map)r|r�rSrrrr)�s

zZipExtFile._read2c
s&z|jr|jj�Wdt�j�XdS)N)rrr��super)r|)r�rrr��szZipExtFile.closecCs|jS)N)r)r|rrrr��szZipExtFile.seekablercCs,|jstjd��|j�}|dkr&|}n.|dkr8||}n|dkrL|j|}ntd��||jkrd|j}|dkrpd}||}||j}|dkr�|t|j�kr�||_d}nR|dkr�|j	j
|j�|j|_
|j|_|j|_d|_d|_tj|j�|_d|_|}x,|dk�r"t|j|�}|j|�||8}q�W|j�S)Nz!underlying stream is not seekablerrrzCwhence must be os.SEEK_SET (0), os.SEEK_CUR (1), or os.SEEK_END (2)r+F)rr�UnsupportedOperationrWrrxr
r.r	rrArrrrrrZzipfiler�rrrr+�
MAX_SEEK_READr;)r|rQr�Zcurr_posZnew_posZread_offsetZbuff_offsetZread_lenrrrrA�sD




zZipExtFile.seekcCs0|jstjd��|j|jt|j�|j}|S)Nz!underlying stream is not seekable)rrr0rrr.r	r
)r|ZfileposrrrrW*s
zZipExtFile.tell�i@i)NFr�)r�)rr�)r�)r)rrrrr#r*r1r}r�rr r!r;r'r(r"r)r�r�rArW�
__classcell__rr)r�rrs&
*



!
%$
/rcs@eZdZdd�Zedd��Zdd�Zdd�Z�fd	d
�Z�Z	S)�
_ZipWriteFilecCs4||_||_||_t|j�|_d|_d|_d|_dS)Nr)	�_zinfo�_zip64�_zipfiler�rb�_compressor�
_file_size�_compress_size�_crc)r|�zfr�r�rrrr}2sz_ZipWriteFile.__init__cCs|jjS)N)r7r9)r|rrrr;sz_ZipWriteFile._fileobjcCsdS)NTr)r|rrr�writable?sz_ZipWriteFile.writablecCsf|jrtd��t|�}|j|7_t||j�|_|jrV|jj|�}|jt|�7_|j	j
|�|S)NzI/O operation on closed file.)rrxr.r9rr;r8r�r:rr�)r|rS�nbytesrrrr�Bsz_ZipWriteFile.writecsX|jr
dSt�j�|jrN|jj�}|jt|�7_|jj|�|j|j	_
n
|j|j	_
|j|j	_
|j|j	_|j	jd@r�|jr�dnd}|jjtj|t|j	j
|j	j
|j	j��|jj�|j_nn|js�|jtkr�td��|jtkr�td��|jj�|j_|jj|j	j�|jj|j	j|j��|jj|jj�d|j_|jjj|j	�|j	|jj|j	j <dS)Nrz<LLQQz<LLLLz+File size unexpectedly exceeded ZIP64 limitz1Compressed size unexpectedly exceeded ZIP64 limitF)!rr/r�r8r�r:r.rr�r5rlr9r;rkrmrfr6rCr��
_DD_SIGNATURErWr7�	start_dirr�r�rArjr�r��filelistr/�
NameToInfor?)r|r$r�)r�rrr�Ns8






z_ZipWriteFile.close)
rrrr}�propertyrr=r�r�r3rr)r�rr41s
	r4c@seZdZdZdZdZdedfdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
d<dd�Zdd�Zdd�Zdd�Zedd��Zejdd��Zd=dd�Zd>d d!�d"d#�Zd?d$d%�Zd@d&d'�ZdAd(d)�Zed*d+��Zd,d-�Zd.d/�ZdBd0d1�ZdCd2d3�Zd4d5�Z d6d7�Z!d8d9�Z"d:d;�Z#dS)Dra� Class with methods to open, read, write, close, list zip files.

    z = ZipFile(file, mode="r", compression=ZIP_STORED, allowZip64=True)

    file: Either the path to the file, or a file-like object.
          If it is a path, the file will be opened and closed by ZipFile.
    mode: The mode can be either read 'r', write 'w', exclusive create 'x',
          or append 'a'.
    compression: ZIP_STORED (no compression), ZIP_DEFLATED (requires zlib),
                 ZIP_BZIP2 (requires bz2) or ZIP_LZMA (requires lzma).
    allowZip64: if True ZipFile will create files with ZIP64 extensions when
                needed, otherwise it will raise an exception when this would
                be necessary.

    N�rTcCsF|dkrtd��t|�||_d|_d|_i|_g|_||_||_d|_	d	|_
t|tj
�rdtj|�}t|t�r�d|_||_d
ddd
dddd�}||}x^ytj||�|_Wn(tk
r�||kr�||}w��YnXPq�Wnd|_||_t|dd�|_d|_tj�|_d|_d|_�y|dk�r*|j�n�|dk�r�d|_y|jj�|_Wn2t tfk
�r|t!|j�|_d|_d|_Yn6Xy|jj"|j�Wn t tfk
�r�d|_YnXnf|dk�ry|j�|jj"|j�Wn6t#k
�r|jj"dd�d|_|jj�|_YnXntd��Wn$|j}d|_|j$|��YnXdS)z]Open the ZIP file with mode read 'r', write 'w', exclusive create 'x',
        or append 'a'.rD�w�x�az+ZipFile requires mode 'r', 'w', 'x', or 'a'FrNr+r<zw+bzx+bzr+b�wbZxb)rDrErFrGzr+bzw+bzx+brr
Trz"Mode must be 'r', 'w', 'x', or 'a')rDrErFrG)rErF)%rxr��_allowZip64�
_didModify�debugrBrAr�rr��_commentr�rur�r��str�_filePassedr?rr>r9r8�getattr�_fileRefCnt�	threading�RLockr�rr��_RealGetContentsrWr@rr�rAr�_fpclose)r|r�rr��
allowZip64ZmodeDictr�r9rrrr}�s�







zZipFile.__init__cCs|S)Nr)r|rrr�	__enter__�szZipFile.__enter__cCs|j�dS)N)r�)r|�type�value�	tracebackrrr�__exit__�szZipFile.__exit__cCs�d|jj|jjfg}|jdk	rd|jr8|jd|j�n|jdk	rR|jd|j�|jd|j�n
|jd�|jd�dj|�S)Nz<%s.%sz file=%rz filename=%rz mode=%rz	 [closed]r~r)	r�rrr9rNr/r?rr0)r|r@rrrr��s



zZipFile.__repr__cCs�|j}yt|�}Wntk
r.td��YnX|s<td��|jdkrNt|�|t}|t}|t|_	|t
||}|ttkr�|t
t8}|jdkr�||}td|||�|||_|j|jd�|j|�}tj|�}d}�x�||k�r�|jt�}	t|	�tk�rtd��tjt|	�}	|	ttk�r0td��|jdk�rDt|	�|j|	t�}
|	d}|d	@�rp|
jd
�}
n
|
jd�}
t|
�}|j|	t�|_|j|	t �|_!|	t"|_#|	dd�\|_$|_%|_&|_'|_(|_)}
}|_*|_+|_,|j&t-k�r�t.d
|j&d��|	dd�\|_/|_0|_1|
|_2|d?d|d?d@|d@|
d?|
d?d@|
d@df|_3|j4�|j#||_#|j5j6|�||j7|j8<|t|	t|	t|	t }|jdkr�td|�q�W|j}x*t9|j5dd�dd�D]}||_:|j#}�q�WdS)z/Read in the table of contents for the ZIP file.zFile is not a zip filerrzgiven, inferred, offsetrzTruncated central directoryz&Bad magic number for central directoryr!izutf-8�cp437rzzip file version %.1fr%r(r*r$i�rr&r�totalcSs|jS)N)rj)r�rrr�<lambda>Isz*ZipFile._RealGetContents.<locals>.<lambda>T)�key�reverseN);r9r7r8rrK�printrNrO�_ECD_COMMENTrL�
_ECD_LOCATIONrIrHrFrBr@rAr;r�BytesIO�sizeCentralDirr.rCr-�structCentralDir�
_CD_SIGNATURE�stringCentralDir�_CD_FILENAME_LENGTH�decoder
�_CD_EXTRA_FIELD_LENGTHr1�_CD_COMMENT_LENGTHr_�_CD_LOCAL_HEADER_OFFSETrjrTrcrdrerfrbrkrlrm�MAX_EXTRACT_VERSIONr�rgrhrirnrar�rAr/rBr?�sortedro)r|r9rRZsize_cdZ	offset_cd�concatZinferredrSr\�centdirr?�flagsrF�t�dZ
end_offsetr�rrrrS�s|









4  
zZipFile._RealGetContentscCsdd�|jD�S)z+Return a list of file names in the archive.cSsg|]
}|j�qSr)r?)�.0rSrrr�
<listcomp>Psz$ZipFile.namelist.<locals>.<listcomp>)rA)r|rrr�namelistNszZipFile.namelistcCs|jS)zJReturn a list of class ZipInfo instances for files in the
        archive.)rA)r|rrr�infolistRszZipFile.infolistcCsPtdd
|d�x:|jD]0}d|jdd�}td	|j||jf|d�qWdS)z+Print a table of contents for the zip file.z%-46s %19s %12s�	File Name�Modified    �Size)r�z%d-%02d-%02d %02d:%02d:%02dNr"z
%-46s %s %12d)rxryrz)r`rArar?rm)r|r�r�Zdaterrr�printdirWszZipFile.printdircCs^d}xT|jD]J}y.|j|jd��}x|j|�r0q$WWdQRXWqtk
rT|jSXqWdS)z%Read all the files and check the CRC.rrrDNi)rAr>r?r;r)r|Z
chunk_sizer��frrr�testzip`szZipFile.testzipcCs$|jj|�}|dkr td|��|S)z,Return the instance of ZipInfo given 'name'.Nz(There is no item named %r in the archive)rBr��KeyError)r|r
�inforrr�getinfoms

zZipFile.getinfocCs8|r"t|t�r"tdt|�j��|r.||_nd|_dS)z)Set default password for encrypted files.zpwd: expected bytes, got %sN)r�r-�	TypeErrorrWrr�)r|r�rrr�setpasswordvs
zZipFile.setpasswordcCs|jS)z.The comment text associated with the ZIP file.)rL)r|rrrr_szZipFile.commentcCs^t|t�stdt|�j��t|�tkrNddl}|jdtdd�|dt�}||_	d|_
dS)Nzcomment: expected bytes, got %srz3Archive comment is too long; truncating to %d bytesr)�
stacklevelT)r�r-r�rWrr.�ZIP_MAX_COMMENT�warnings�warnrLrJ)r|r_r�rrrr_�s
c	Cs"|j|d|��
}|j�SQRXdS)zReturn file bytes for name.rDN)r>r;)r|r
r�r9rrrr;�szZipFile.readF)�force_zip64cs�|d"krtd��|r2t|t�r2tdt|�j��|rF|dkrFtd���jsTtd��t|t�rd|}n$|dkr~t|�}�j|_	n
�j
|�}|dkr��j||d�S�jr�td���j
d	7_
t�j|j�j�j�fd
d��}�y�|jt�}t|�tk�r�td��tjt|�}|ttk�r td
��|j|t�}|t�rF|j|t�|jd@�rZtd��|jd@�rntd��|jd@�r�|jd�}	n
|jd�}	|	|j k�r�td|j |f��|j!dk	�r�|j"�|j#|j!k�r�td|j �d���|jd	@}
d}|
�r�|�s�j$}|�st%d|��t&|�}|jd�}t't(||dd���}
|jd@�rX|j)d?d@}n|j*d?d@}|
d|k�r�t%d |��t+||||d!�S|j,��YnXdS)#auReturn file-like object for 'name'.

        name is a string for the file name within the ZIP file, or a ZipInfo
        object.

        mode should be 'r' to read a file already in the ZIP file, or 'w' to
        write to a file newly added to the archive.

        pwd is the password to decrypt files (only used for reading).

        When writing, if the file size is not known in advance but may exceed
        2 GiB, pass force_zip64 to use the ZIP64 format, which can handle large
        files.  If the size is known in advance, it is best to pass a ZipInfo
        instance for name, with zinfo.file_size set.
        rDrEzopen() requires mode "r" or "w"zpwd: expected bytes, got %sz'pwd is only supported for reading filesz2Attempt to use ZIP archive that was already closed)r�zyCan't read from the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.rcs�jS)N)r�r)r|rrr]�szZipFile.open.<locals>.<lambda>zTruncated file headerz Bad magic number for file header� z$compressed patched data (flag bit 5)�@zstrong encryption (flag bit 6)izutf-8r[z/File name in directory %r and header %r differ.NzOverlapped entries: z (possible zip bomb)z6File %r is encrypted, password required for extractionrrrr�r�r&zBad password for file %rT>rErD)-rxr�r-r�rWrr9r
r�rbr��_open_to_writer�rPr�rjrTr�r;�sizeFileHeaderr.rrCr-r��
_FH_SIGNATUREr��_FH_FILENAME_LENGTH�_FH_EXTRA_FIELD_LENGTHrfr�rir`rorWrlr�r�r�r[r.rnrkrr�)r|r
rr�r�r�Zzef_fileZfheader�fnameZ	fname_strZis_encryptedZzdr��hZ
check_byter)r|rr>�s�








zZipFile.opencCs�|r|jrtd��|jr"td��t|d�s2d|_d|_d|_d|_|jt	kr\|jdO_|j
sp|jdO_|js|d|_|jo�|p�|jd	tk}|j
r�|j
j|j�|j
j�|_|j|�d
|_|j
j|j|��d
|_t|||�S)NzHforce_zip64 is True, but allowZip64 was False when opening the ZIP file.zzCan't write to the ZIP file while there is another write handle open on it. Close the first handle before opening another.rmrrri�rg�������?Ti�)rIrxr�r=rmrlrkrfrbrrrir�r9rAr@rWrj�_writecheckrJr�r�r4)r|r�r�r�rrrr�s4


zZipFile._open_to_writecCs*|dkrtj�}n
tj|�}|j|||�S)a#Extract a member from the archive to the current working directory,
           using its full name. Its file information is extracted as accurately
           as possible. `member' may be a filename or a ZipInfo object. You can
           specify a different directory using `path'.
        N)ru�getcwdr��_extract_member)r|�memberr�r�rrr�extract6s

zZipFile.extractcCsL|dkr|j�}|dkr"tj�}n
tj|�}x|D]}|j|||�q2WdS)z�Extract all members from the archive to the current working
           directory. `path' specifies a different directory to extract to.
           `members' is optional and must be a subset of the list returned
           by namelist().
        N)rvrur�r�r�)r|r��membersr�rrrr�
extractallCs


zZipFile.extractallcCs^|j}|s(d}tj|dt|��}||_|j|�}dd�|j|�D�}|jdd�|D��}|S)z;Replace bad characters and remove trailing dots from parts.z:<>|"?*�_css|]}|jd�VqdS)�.N)�rstrip)rtrFrrr�	<genexpr>^sz1ZipFile._sanitize_windows_name.<locals>.<genexpr>css|]}|r|VqdS)Nr)rtrFrrrr�`s)�!_windows_illegal_name_trans_tablerM�	maketransr.�	translate�splitr0)r�r��pathsepr�Zillegalrrr�_sanitize_windows_nameTs
zZipFile._sanitize_windows_namecsNt|t�s|j|�}|jjdtjj�}tjjrB|jtjjtjj�}tjj	|�d}dtjj
tjjf�tjjj�fdd�|j
tjj�D��}tjjdkr�|j|tjj�}tjj||�}tjj|�}tjj|�}|r�tjj|�r�tj|�|j��rtjj|��s
tj|�|S|j||d��(}t|d��}tj||�Wd	QRXWd	QRX|S)
zbExtract the ZipInfo object 'member' to a physical
           file on the path targetpath.
        rrrrc3s|]}|�kr|VqdS)Nr)rtrF)�invalid_path_partsrrr�tsz*ZipFile._extract_member.<locals>.<genexpr>�\)r�rHN)r�r
r�r?rwrur�rvr�r��curdir�pardirr0r�r�r��dirname�exists�makedirsr�r��mkdirr>�shutil�copyfileobj)r|r�Z
targetpathr�r�Z	upperdirs�source�targetr)r�rr�cs.

&


 zZipFile._extract_membercCs�|j|jkr(ddl}|jd|jdd�|jdkr:td	��|jsHtd
��t|j�|j	s�d}t
|j�tkrpd}n|j
tkr�d}n|jtkr�d
}|r�t|d��dS)z6Check for errors before writing a file to the archive.rNzDuplicate name: %rr)r�rErFrGz&write() requires mode 'w', 'x', or 'a'z4Attempt to write ZIP archive that was already closedzFiles countZFilesizezZipfile sizez would require ZIP64 extensions)rErFrG)r?rBr�r�rrxr9r�rbrIr.rA�ZIP_FILECOUNT_LIMITrmr�rjr
)r|r�r��requires_zip64rrrr��s(



zZipFile._writecheckcCs0|jstd��|jrtd��tj||�}|j�r>d|_d|_n|dk	rN||_n|j	|_|j�r�|j
��|jrz|jj|j
�|jj�|_|jtkr�|jdO_|j|�d|_|jj|�||j|j<|jj|jd��|jj�|_
WdQRXn<t|d��,}|j|d	��}tj||d�WdQRXWdQRXdS)
zLPut the bytes from filename into the archive under the name
        arcname.z7Attempt to write to ZIP archive that was already closedz>Can't write to ZIP archive while an open writing handle existsrNrTFr<rEiri )r9rxr�r
r�r�rlrkrbr�r�rrAr@rWrjrrfr�rJrAr/rBr?r�r�r>r�r�)r|r?r�rbr��src�destrrrr��s8

z
ZipFile.writecCs�t|t�r|jd�}t|t�spt|tjtj��dd�d�}|j|_|jddkrhd|_	|j	dO_	qtd|_	n|}|j
s�td
��|jr�td��|dk	r�||_t
|�|_|j�*|j|dd
��}|j|�WdQRXWdQRXdS)aWrite a file into the archive.  The contents is 'data', which
        may be either a 'str' or a 'bytes' instance; if it is a 'str',
        it is encoded as UTF-8 first.
        'zinfo_or_arcname' is either a ZipInfo instance or
        the name of the file in the archive.zutf-8Nr")r?rarrri�Ari�z7Attempt to write to ZIP archive that was already closedz?Can't write to ZIP archive while an open writing handle exists.rE)rr�i�Ai�)r�rMr�r
r�r�r�rbr?rir9rxr�r.rmr�r>r�)r|Zzinfo_or_arcnamerSrbr�r�rrr�writestr�s.



zZipFile.writestrcCs|j�dS)z2Call the "close()" method in case the user forgot.N)r�)r|rrr�__del__�szZipFile.__del__cCs||jdkrdS|jrtd��zB|jdkr\|jr\|j�"|jrJ|jj|j�|j	�WdQRXWd|j}d|_|j
|�XdS)zOClose the file, and for mode 'w', 'x' and 'a' write the ending
        records.NzvCan't close the ZIP file while there is an open writing handle on it. Close the writing handle before closing the zip.rErFrG)rErFrG)r9r�rxrrJr�rrAr@�_write_end_recordrT)r|r9rrrr��s
z
ZipFile.closecCsr�xP|jD�]D}|j}|ddd>|dd>B|dB}|dd>|d	d>B|ddB}g}|jtksv|jtkr�|j|j�|j|j�d
}d
}n|j}|j}|jtkr�|j|j�d
}n|j}|j}	d}
|�rt|	d�}	t	j
ddt|�dd
t|�f|��|	}	t}
|j
tk�r(tt|
�}
n|j
tk�r>tt|
�}
t|
|j�}t|
|j�}yZ|j�\}
}t	j
tt||j||j||j
|||j||t|
�t|	�t|j�d|j|j|�}Wnltk
�rttt||j||j|j |j
|||j||t|j!�t|	�t|j�d|j|j|ft"j#d��YnX|j$j%|�|j$j%|
�|j$j%|	�|j$j%|j�q
W|j$j&�}t|j�}||j'}|j'}d}|t(k�r�d}n|tk�r�d}n|tk�r�d}|�r*|j)�s�t*|d��t	j
t+t,ddddd||||�}|j$j%|�t	j
t-t.d|d�}|j$j%|�t/|d�}t/|d
�}t/|d
�}t	j
t0t1dd||||t|j2��	}|j$j%|�|j$j%|j2�|j$j3�dS)Nri�r$rr!rrr&r l��z<HH�Qr)r�zFiles countzCentral directory offsetzCentral directory sizez would require ZIP64 extensions�,ri��)r)4rArarmr�rlr/rjr1r6rCr�r.r�rbrr\r�rr�rdrTr�rergrcrerkr_rhri�DeprecationWarningr`rfr?ry�stderrr9r�rWr@r�rIr
rGrHrDrEr+rZrYrLr�)r|r�r�r�r�r1rmrlrjZ
extra_datar�rdrTr?rfrpZpos2ZcentDirCountZcentDirSizeZ
centDirOffsetr�Zzip64endrecZzip64locrecrRrrrr�s�$$



















zZipFile._write_end_recordcCs8|jdkst�|jd8_|jr4|jr4|j�dS)Nrr)rPr�rNr�)r|r9rrrrTrszZipFile._fpclose)N)N)rDN)F)NN)NNN)NN)N)$rrrrr9r�rr}rVrZr�rSrvrwr{r}r�r�rCr_�setterr;r>r�r�r�r�r�r�r�r�r�r�r�r�rTrrrrr{s<WT
	
		
u
+

*
*
$fc@s4eZdZdZdedd
fdd�Zdd	d
�Zdd�ZdS)rzDClass to create ZIP archives with Python library files and packages.rDTrcCstj|||||d�||_dS)N)rr�rU)rr}�	_optimize)r|r�rr�rU�optimizerrrr}|szPyZipFile.__init__rNcCs�tj|�}|rF||�rF|jrBtjj|�r.dnd}td||f�dStjj|�\}}tjj|��rntjj|d�}tjj|��r�|r�d||f}n|}|jr�td|d|�|j	|d	d�|�\}}	|jr�td|	�|j
||	�tj|�}
|
jd�x�|
D]�}tjj||�}tjj
|�\}
}tjj|��rRtjjtjj|d���r�|j|||d�q�|d
kr�|�r�||��r�|jr�td|�q�|j	|d	d�|�\}}	|j�r�td|	�|j
||	�q�Wn�|j�r�td|�x�tj|�D]�}tjj||�}tjj
|�\}
}|d
k�r�|�r0||��r0|j�r�td|��q�|j	|d	d�|�\}}	|j�rZtd|	�|j
||	��q�WnP|dd�d
k�r�td��|j	|d	d�|�\}}	|j�r�td|	�|j
||	�dS)a�Add all files from "pathname" to the ZIP archive.

        If pathname is a package directory, search the directory and
        all package subdirectories recursively for all *.py and enter
        the modules into the archive.  If pathname is a plain
        directory, listdir *.py and enter all modules.  Else, pathname
        must be a Python *.py file and the module will be put into the
        archive.  Added modules are always module.pyc.
        This method will compile the module.py into module.pyc if
        necessary.
        If filterfunc(pathname) is given, it is called with every argument.
        When it is False, the file or directory is skipped.
        r�r�z%s %r skipped by filterfuncNz__init__.pyz%s/%szAdding package in�asrrZAdding)�
filterfuncz.pyzfile %r skipped by filterfunczAdding files from directoryz.Files added with writepy() must end with ".py"zAdding file���r�r�r�r�)rur�rKr�r�r`r�r0�isfile�
_get_codenamer��listdir�remove�splitext�writepyr�)r|�pathname�basenamer�Zlabel�dirr
Zinitnamer�r�Zdirlistr?r��rootZextrrrr��sx












zPyZipFile.writepyc
sd�fdd�	}|d}|d}tjj|dd�}tjj|dd�}tjj|dd�}�jdk�r\tjj|�r�tj|�jtj|�jkr�|}	}
n�tjj|�r�tj|�jtj|�jkr�|}
|}	n�tjj|�r�tj|�jtj|�jkr�|}
|}	nvtjj|��rtj|�jtj|�jk�r|}
|}	nD||��rRt	j
jd	k�r4|}
nt	j
jdk�rH|}
n|}
|}	n|}
}	n��jd	k�rr|}
|}	n<|}	�jdk�r�|}
n&�jdk�r�|}
nd
j�j�}t
|��tjj|
��o�tj|
�jtj|�jk�s�||�jd��s�|}
}	tjj|	�d}|�rd||f}|
|fS)aReturn (filename, archivename) for the path.

        Given a module name path, return the correct file path and
        archive name, compiling if necessary.  For example, given
        /python/lib/string, return (/python/lib/string.pyc, string).
        rcs^ddl}�jrtd|�y|j|d|d�Wn,|jk
rX}zt|j�dSd}~XnXdS)NrZ	CompilingT)�doraiser�F)�
py_compilerKr`�compile�PyCompileError�msg)r�r�r��err)r|rr�_compile�s

z)PyZipFile._get_codename.<locals>._compilez.pyz.pycr)�optimizationrrz"invalid value for 'optimize': {!r})r�z%s/%sr�)r�r�)�	importlib�util�cache_from_sourcer�rur�r�r�r�ryrqr��formatrxr�)
r|r�r�r�Zfile_pyZfile_pycZpycache_opt0Zpycache_opt1Zpycache_opt2r�r�r�Zarchivenamer)r|rr��s`


zPyZipFile._get_codenamer�)rN)rrrrrr}r�r�rrrrrys

Rcsddl}|jd�}|dkr(tjdd�}|s:|ddkrLt|�tjd�|ddkr�t|�dkrvt|�tjd�t|dd	��}|j�WdQRX�n||ddk�r
t|�dkr�t|�tjd�t|dd	��}|j	�}WdQRX|�r�td
j
|��td��n|ddk�rbt|�dk�r8t|�tjd�t|dd	��}|j|d�WdQRXn�|ddk�rt|�dk�r�t|�tjd��fd
d��t|dd��h}x`|dd�D]P}tj
j|�}|�s�tj
jtj
j|��}|dtjtjfk�r�d}�|||��q�WWdQRXdS)NraE        Usage:
            zipfile.py -l zipfile.zip        # Show listing of a zipfile
            zipfile.py -t zipfile.zip        # Test if a zipfile is valid
            zipfile.py -e zipfile.zip target # Extract zipfile into target dir
            zipfile.py -c zipfile.zip src ... # Create zipfile from sources
        r�-l�-c�-e�-trrDz.The following enclosed file is corrupted: {!r}zDone testingrcsptjj|�r|j||t�nPtjj|�rl|r8|j||�x2tj|�D]$}�|tjj||�tjj||��qDWdS)N)rur�r�r�rr�r�r0)r<r��zippathZnm)�addToZiprrr�Uszmain.<locals>.addToZiprEr)r�r�r�r�)�textwrap�dedentry�argvr`�exitr.rr{r}r�r�rur�r�r�r�r�)�argsr�ZUSAGEr<Zbadfiler�r�r)r�r�main'sT




r��__main__li���ii��ii��)N)�rrru�re�importlib.utilr�ryr�r�r�rCZbinasciirQ�ImportErrorZdummy_threadingr�rr�r��__all__�	Exceptionrr
rrr�r�r�rrrrr{r�r�r�rmrZrYr�rXrIrJrKrLrMrNrOr^rarbrergrdrfZ_CD_CREATE_VERSIONZ_CD_CREATE_SYSTEMZ_CD_EXTRACT_VERSIONZ_CD_EXTRACT_SYSTEMZ
_CD_FLAG_BITSZ_CD_COMPRESS_TYPEZ_CD_TIMEZ_CD_DATEZ_CD_CRCZ_CD_COMPRESSED_SIZEZ_CD_UNCOMPRESSED_SIZErhrjrkZ_CD_DISK_NUMBER_STARTZ_CD_INTERNAL_FILE_ATTRIBUTESZ_CD_EXTERNAL_FILE_ATTRIBUTESrlr�r�r�r�Z_FH_EXTRACT_VERSIONZ_FH_EXTRACT_SYSTEMZ_FH_GENERAL_PURPOSE_FLAG_BITSZ_FH_COMPRESSION_METHODZ_FH_LAST_MOD_TIMEZ_FH_LAST_MOD_DATEZ_FH_CRCZ_FH_COMPRESSED_SIZEZ_FH_UNCOMPRESSED_SIZEr�r�rDrErBrGrHrFZ_CD64_SIGNATUREZ_CD64_DIRECTORY_RECSIZEZ_CD64_CREATE_VERSIONZ_CD64_EXTRACT_VERSIONZ_CD64_DISK_NUMBERZ_CD64_DISK_NUMBER_STARTZ_CD64_NUMBER_ENTRIES_THIS_DISKZ_CD64_NUMBER_ENTRIES_TOTALZ_CD64_DIRECTORY_SIZEZ_CD64_OFFSET_START_CENTDIRr?ZStructr,r6r:r	rUr7�objectr
r�r�r�r�r�r�r�r�r�rrr4rrr�rrrrr�<module>sD









+=[=&-J/
B
copyreg.cpython-36.opt-1.pyc000064400000010163150335715140011606 0ustar003


 \_�@s�dZdddddgZiZddd�Zdd�ZyeWnek
rDYnXd	d
�Zeeee�dd�ZdZ	dd�Z
dd�Zdd�Zdd�Z
iZiZiZdd�Zdd�Zdd�ZdS)z�Helper to provide extensibility for pickle.

This is only useful to add pickle support for extension types defined in
C, not for instances of user-defined classes.
�pickle�constructor�
add_extension�remove_extension�clear_extension_cacheNcCs,t|�std��|t|<|dk	r(t|�dS)Nz$reduction functions must be callable)�callable�	TypeError�dispatch_tabler)�ob_type�pickle_function�constructor_ob�r�/usr/lib64/python3.6/copyreg.pyrs
cCst|�std��dS)Nzconstructors must be callable)rr)�objectrrr
rscCst|j|jffS)N)�complex�real�imag)�crrr
�pickle_complex"srcCs<|tkrtj|�}n$|j||�}|jtjkr8|j||�|S)N)r�__new__�__init__)�cls�base�state�objrrr
�_reconstructor)sr��	cCs�x,|jjD]}t|d�r
|jt@r
Pq
Wt}|tkr<d}n ||jkrTtd|j��||�}|j||f}y
|j}WnLt	k
r�t
|dd�r�td��y
|j}Wnt	k
r�d}YnXYnX|�}|r�t||fSt|fSdS)N�	__flags__zcan't pickle %s objects�	__slots__zNa class that defines __slots__ without defining __getstate__ cannot be pickled)
�	__class__�__mro__�hasattrr�	_HEAPTYPErr�__name__�__getstate__�AttributeError�getattr�__dict__r)�self�protorr�args�getstate�dictrrr
�
_reduce_ex6s.



r-cGs|j|f|��S)N)r)rr*rrr
�
__newobj__Wsr.cCs|j|f|�|�S)zUsed by pickle protocol 4, instead of __newobj__ to allow classes with
    keyword-only arguments to be pickled correctly.
    )r)rr*�kwargsrrr
�
__newobj_ex__Zsr0c	Cs�|jjd�}|dk	r|Sg}t|d�s(n�x�|jD]�}d|jkr0|jd}t|t�rX|f}xh|D]`}|d	krnq^q^|jd�r�|jd�r�|jj	d�}|r�|j
d||f�q�|j
|�q^|j
|�q^Wq0Wy
||_WnYnX|S)
a�Return a list of slot names for a given class.

    This needs to find slots defined by the class and its bases, so we
    can't simply return the __slots__ attribute.  We must walk down
    the Method Resolution Order and concatenate the __slots__ of each
    class found there.  (This assumes classes don't modify their
    __slots__ attribute to misrepresent their slots after the class is
    defined.)
    �
__slotnames__Nrr'�__weakref__�__�_z_%s%s)r'r2)r'�getr!r �
isinstance�str�
startswith�endswithr#�lstrip�appendr1)r�namesr�slots�name�strippedrrr
�
_slotnames`s2





r@cCs�t|�}d|kodkns(td��||f}tj|�|krPtj|�|krPdS|tkrltd|t|f��|tkr�td|t|f��|t|<|t|<dS)zRegister an extension code.ri���zcode out of rangeNz)key %s is already registered with code %sz$code %s is already in use for key %s)�int�
ValueError�_extension_registryr5�_inverted_registry)�moduler>�code�keyrrr
r�scCsR||f}tj|�|ks$tj|�|kr4td||f��t|=t|=|tkrNt|=dS)z0Unregister an extension code.  For testing only.z%key %s is not registered with code %sN)rCr5rDrB�_extension_cache)rEr>rFrGrrr
r�scCstj�dS)N)rH�clearrrrr
r�s)Ni)�__doc__�__all__rrrr�	NameErrorrrr"r-r.r0r@rCrDrHrrrrrrr
�<module>s.


	!<codecs.cpython-36.pyc000064400000102156150335715140010443 0ustar003


 \���:@s�dZddlZddlZyddlTWn.ek
rNZzede��WYddZ[XnXddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0g,Zd1Zd2Z	Z
d3ZZd4Z
d5Zejd6kr�e
ZZe
ZneZZeZe
ZeZe
ZeZGd7d�de�ZGd8d�d�ZGd9d�de�ZGd:d;�d;e�ZGd<d�de�ZGd=d>�d>e�ZGd?d�de�ZGd@d�de�Z GdAd�d�Z!GdBd�d�Z"d\dFd�Z#d]dGd�Z$dHd�Z%dId �Z&dJd!�Z'dKd"�Z(dLd#�Z)dMd$�Z*d^dNd'�Z+d_dOd(�Z,dPdQ�Z-dRdS�Z.y4e/dD�Z0e/dT�Z1e/dU�Z2e/dV�Z3e/dW�Z4e/dX�Z5Wn.e6k
�r`dZ0dZ1dZ2dZ3dZ4dZ5YnXdZ7e7�rtddl8Z8e9dYk�r�e$ej:dZd[�e_:e$ej;d[dZ�e_;dS)`z� codecs -- Python Codec Registry, API and helpers.


Written by Marc-Andre Lemburg (mal@lemburg.com).

(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.

�N)�*z%Failed to load the builtin codecs: %s�register�lookup�open�EncodedFile�BOM�BOM_BE�BOM_LE�BOM32_BE�BOM32_LE�BOM64_BE�BOM64_LE�BOM_UTF8�	BOM_UTF16�BOM_UTF16_LE�BOM_UTF16_BE�	BOM_UTF32�BOM_UTF32_LE�BOM_UTF32_BE�	CodecInfo�Codec�IncrementalEncoder�IncrementalDecoder�StreamReader�StreamWriter�StreamReaderWriter�
StreamRecoder�
getencoder�
getdecoder�getincrementalencoder�getincrementaldecoder�	getreader�	getwriter�encode�decode�
iterencode�
iterdecode�
strict_errors�
ignore_errors�replace_errors�xmlcharrefreplace_errors�backslashreplace_errors�namereplace_errors�register_error�lookup_errorss��s��s��s���littlec@s,eZdZdZdZd	dd�dd�Zdd�ZdS)
rz0Codec details when looking up the codec registryTN)�_is_text_encodingc
CsPtj|||||f�}	||	_||	_||	_||	_||	_||	_||	_|dk	rL||	_	|	S)N)
�tuple�__new__�namer#r$�incrementalencoder�incrementaldecoder�streamwriter�streamreaderr0)
�clsr#r$r7r6r4r5r3r0�self�r:�/usr/lib64/python3.6/codecs.pyr2]szCodecInfo.__new__cCsd|jj|jj|jt|�fS)Nz%<%s.%s object for encoding %s at %#x>)�	__class__�
__module__�__qualname__r3�id)r9r:r:r;�__repr__lszCodecInfo.__repr__)NNNNN)�__name__r=r>�__doc__r0r2r@r:r:r:r;rRs
c@s$eZdZdZddd�Zd	dd�ZdS)
ra9 Defines the interface for stateless encoders/decoders.

        The .encode()/.decode() methods may use different error
        handling schemes by providing the errors argument. These
        string values are predefined:

         'strict' - raise a ValueError error (or a subclass)
         'ignore' - ignore the character and continue with the next
         'replace' - replace with a suitable replacement character;
                    Python will use the official U+FFFD REPLACEMENT
                    CHARACTER for the builtin Unicode codecs on
                    decoding and '?' on encoding.
         'surrogateescape' - replace with private code points U+DCnn.
         'xmlcharrefreplace' - Replace with the appropriate XML
                               character reference (only for encoding).
         'backslashreplace'  - Replace with backslashed escape sequences.
         'namereplace'       - Replace with \N{...} escape sequences
                               (only for encoding).

        The set of allowed values can be extended via register_error.

    �strictcCst�dS)a# Encodes the object input and returns a tuple (output
            object, length consumed).

            errors defines the error handling to apply. It defaults to
            'strict' handling.

            The method may not store state in the Codec instance. Use
            StreamWriter for codecs which have to keep state in order to
            make encoding efficient.

            The encoder must be able to handle zero length input and
            return an empty object of the output object type in this
            situation.

        N)�NotImplementedError)r9�input�errorsr:r:r;r#�szCodec.encodecCst�dS)a� Decodes the object input and returns a tuple (output
            object, length consumed).

            input must be an object which provides the bf_getreadbuf
            buffer slot. Python strings, buffer objects and memory
            mapped files are examples of objects providing this slot.

            errors defines the error handling to apply. It defaults to
            'strict' handling.

            The method may not store state in the Codec instance. Use
            StreamReader for codecs which have to keep state in order to
            make decoding efficient.

            The decoder must be able to handle zero length input and
            return an empty object of the output object type in this
            situation.

        N)rD)r9rErFr:r:r;r$�szCodec.decodeN)rC)rC)rAr=r>rBr#r$r:r:r:r;rqs
c@s<eZdZdZddd�Zddd�Zdd	�Zd
d�Zdd
�ZdS)rz�
    An IncrementalEncoder encodes an input in multiple steps. The input can
    be passed piece by piece to the encode() method. The IncrementalEncoder
    remembers the state of the encoding process between calls to encode().
    rCcCs||_d|_dS)z�
        Creates an IncrementalEncoder instance.

        The IncrementalEncoder may use different error handling schemes by
        providing the errors keyword argument. See the module docstring
        for a list of possible values.
        �N)rF�buffer)r9rFr:r:r;�__init__�szIncrementalEncoder.__init__FcCst�dS)zA
        Encodes input and returns the resulting object.
        N)rD)r9rE�finalr:r:r;r#�szIncrementalEncoder.encodecCsdS)z:
        Resets the encoder to the initial state.
        Nr:)r9r:r:r;�reset�szIncrementalEncoder.resetcCsdS)z:
        Return the current state of the encoder.
        rr:)r9r:r:r;�getstate�szIncrementalEncoder.getstatecCsdS)zl
        Set the current state of the encoder. state must have been
        returned by getstate().
        Nr:)r9�stater:r:r;�setstate�szIncrementalEncoder.setstateN)rC)F)	rAr=r>rBrIr#rKrLrNr:r:r:r;r�s

c@sDeZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dS)�BufferedIncrementalEncoderz�
    This subclass of IncrementalEncoder can be used as the baseclass for an
    incremental encoder if the encoder must keep some of the output in a
    buffer between calls to encode().
    rCcCstj||�d|_dS)NrG)rrIrH)r9rFr:r:r;rI�sz#BufferedIncrementalEncoder.__init__cCst�dS)N)rD)r9rErFrJr:r:r;�_buffer_encode�sz)BufferedIncrementalEncoder._buffer_encodeFcCs0|j|}|j||j|�\}}||d�|_|S)N)rHrPrF)r9rErJ�data�result�consumedr:r:r;r#�s
z!BufferedIncrementalEncoder.encodecCstj|�d|_dS)NrG)rrKrH)r9r:r:r;rK�s
z BufferedIncrementalEncoder.resetcCs
|jpdS)Nr)rH)r9r:r:r;rL�sz#BufferedIncrementalEncoder.getstatecCs|pd|_dS)NrG)rH)r9rMr:r:r;rN�sz#BufferedIncrementalEncoder.setstateN)rC)F)
rAr=r>rBrIrPr#rKrLrNr:r:r:r;rO�s

rOc@s<eZdZdZddd�Zddd�Zdd	�Zd
d�Zdd
�ZdS)rz�
    An IncrementalDecoder decodes an input in multiple steps. The input can
    be passed piece by piece to the decode() method. The IncrementalDecoder
    remembers the state of the decoding process between calls to decode().
    rCcCs
||_dS)z�
        Create an IncrementalDecoder instance.

        The IncrementalDecoder may use different error handling schemes by
        providing the errors keyword argument. See the module docstring
        for a list of possible values.
        N)rF)r9rFr:r:r;rIszIncrementalDecoder.__init__FcCst�dS)z@
        Decode input and returns the resulting object.
        N)rD)r9rErJr:r:r;r$
szIncrementalDecoder.decodecCsdS)z9
        Reset the decoder to the initial state.
        Nr:)r9r:r:r;rKszIncrementalDecoder.resetcCsdS)a	
        Return the current state of the decoder.

        This must be a (buffered_input, additional_state_info) tuple.
        buffered_input must be a bytes object containing bytes that
        were passed to decode() that have not yet been converted.
        additional_state_info must be a non-negative integer
        representing the state of the decoder WITHOUT yet having
        processed the contents of buffered_input.  In the initial state
        and after reset(), getstate() must return (b"", 0).
        �r)rTrr:)r9r:r:r;rLszIncrementalDecoder.getstatecCsdS)z�
        Set the current state of the decoder.

        state must have been returned by getstate().  The effect of
        setstate((b"", 0)) must be equivalent to reset().
        Nr:)r9rMr:r:r;rN&szIncrementalDecoder.setstateN)rC)F)	rAr=r>rBrIr$rKrLrNr:r:r:r;r�s


c@sDeZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dS)�BufferedIncrementalDecoderz�
    This subclass of IncrementalDecoder can be used as the baseclass for an
    incremental decoder if the decoder must be able to handle incomplete
    byte sequences.
    rCcCstj||�d|_dS)NrT)rrIrH)r9rFr:r:r;rI4sz#BufferedIncrementalDecoder.__init__cCst�dS)N)rD)r9rErFrJr:r:r;�_buffer_decode9sz)BufferedIncrementalDecoder._buffer_decodeFcCs0|j|}|j||j|�\}}||d�|_|S)N)rHrVrF)r9rErJrQrRrSr:r:r;r$>s
z!BufferedIncrementalDecoder.decodecCstj|�d|_dS)NrT)rrKrH)r9r:r:r;rKFs
z BufferedIncrementalDecoder.resetcCs
|jdfS)Nr)rH)r9r:r:r;rLJsz#BufferedIncrementalDecoder.getstatecCs|d|_dS)Nr)rH)r9rMr:r:r;rNNsz#BufferedIncrementalDecoder.setstateN)rC)F)
rAr=r>rBrIrVr$rKrLrNr:r:r:r;rU.s

rUc@sTeZdZddd�Zdd�Zdd�Zdd	�Zddd�Zefd
d�Z	dd�Z
dd�ZdS)rrCcCs||_||_dS)aw Creates a StreamWriter instance.

            stream must be a file-like object open for writing.

            The StreamWriter may use different error handling
            schemes by providing the errors keyword argument. These
            parameters are predefined:

             'strict' - raise a ValueError (or a subclass)
             'ignore' - ignore the character and continue with the next
             'replace'- replace with a suitable replacement character
             'xmlcharrefreplace' - Replace with the appropriate XML
                                   character reference.
             'backslashreplace'  - Replace with backslashed escape
                                   sequences.
             'namereplace'       - Replace with \N{...} escape sequences.

            The set of allowed parameter values can be extended via
            register_error.
        N)�streamrF)r9rWrFr:r:r;rI[szStreamWriter.__init__cCs"|j||j�\}}|jj|�dS)z> Writes the object's contents encoded to self.stream.
        N)r#rFrW�write)r9�objectrQrSr:r:r;rXtszStreamWriter.writecCs|jdj|��dS)z[ Writes the concatenated list of strings to the stream
            using .write().
        rGN)rX�join)r9�listr:r:r;�
writelines{szStreamWriter.writelinescCsdS)a5 Flushes and resets the codec buffers used for keeping state.

            Calling this method should ensure that the data on the
            output is put into a clean state, that allows appending
            of new fresh data without having to rescan the whole
            stream to recover state.

        Nr:)r9r:r:r;rK�s
zStreamWriter.resetrcCs*|jj||�|dkr&|dkr&|j�dS)Nr)rW�seekrK)r9�offset�whencer:r:r;r]�szStreamWriter.seekcCs||j|�S)z? Inherit all other methods from the underlying stream.
        )rW)r9r3�getattrr:r:r;�__getattr__�szStreamWriter.__getattr__cCs|S)Nr:)r9r:r:r;�	__enter__�szStreamWriter.__enter__cCs|jj�dS)N)rW�close)r9�type�value�tbr:r:r;�__exit__�szStreamWriter.__exit__N)rC)r)rAr=r>rIrXr\rKr]r`rarbrgr:r:r:r;rYs

c@s�eZdZeZddd�Zd dd�Zd#dd	�Zd$dd
�Zd%dd�Z	dd�Z
d&dd�Zdd�Zdd�Z
efdd�Zdd�Zdd�Zd
S)'rrCcCs.||_||_d|_|j�|_|j|_d|_dS)a� Creates a StreamReader instance.

            stream must be a file-like object open for reading.

            The StreamReader may use different error handling
            schemes by providing the errors keyword argument. These
            parameters are predefined:

             'strict' - raise a ValueError (or a subclass)
             'ignore' - ignore the character and continue with the next
             'replace'- replace with a suitable replacement character
             'backslashreplace' - Replace with backslashed escape sequences;

            The set of allowed parameter values can be extended via
            register_error.
        rTN)rWrF�
bytebuffer�charbuffertype�_empty_charbuffer�
charbuffer�
linebuffer)r9rWrFr:r:r;rI�s
zStreamReader.__init__cCst�dS)N)rD)r9rErFr:r:r;r$�szStreamReader.decode�FcCsL|jr|jj|j�|_d|_|dkr(|}x�|dkrBt|j�|krBP|dkrV|jj�}n|jj|�}|j|}|srPy|j||j	�\}}Wn`t
k
r�}zD|r�|j|d|j�|j	�\}}|jdd�}	t|	�dkr؂n�WYdd}~XnX||d�|_|j|7_|s*Pq*W|dk�r*|j}
|j|_n|jd|�}
|j|d�|_|
S)a� Decodes data from the stream self.stream and returns the
            resulting object.

            chars indicates the number of decoded code points or bytes to
            return. read() will never return more data than requested,
            but it might return less, if there is not enough available.

            size indicates the approximate maximum number of decoded
            bytes or code points to read for decoding. The decoder
            can modify this setting as appropriate. The default value
            -1 indicates to read and decode as much as possible.  size
            is intended to prevent having to decode huge files in one
            step.

            If firstline is true, and a UnicodeDecodeError happens
            after the first line terminator in the input only the first line
            will be returned, the rest of the input will be kept until the
            next call to read().

            The method should use a greedy read strategy, meaning that
            it should read as much data as is allowed within the
            definition of the encoding and the given size, e.g.  if
            optional encoding endings or state markers are available
            on the stream, these should be read too.
        NrT)�keependsrm)
rlrjrZrk�lenrW�readrhr$rF�UnicodeDecodeError�start�
splitlines)r9�size�chars�	firstline�newdatarQ�newchars�decodedbytes�exc�linesrRr:r:r;rp�sD


zStreamReader.readNTc	Cs�|jrP|jd}|jd=t|j�dkr8|jd|_d|_|sL|jdd�d}|S|pVd}|j}�xr|j|dd�}|r�t|t�r�|jd	�s�t|t	�r�|jd
�r�||jddd�7}||7}|jdd�}|�r�t|�dk�r:|d}|d=t|�dk�r|d|j7<||_d|_n|d|j|_|�s8|jdd�d}P|d}|djdd�d}||k�r�|jj
|dd��|j|_|�r�|}n|}P|�s�|dk	�r�|�r�|�r�|jdd�d}P|dkrb|d
9}qbW|S)z� Read one line from the input stream and return the
            decoded data.

            size, if given, is passed as size argument to the
            read() method.

        rrmNF)rn�HT)rv�
�
)rtrui@����)rlrorkrsrjrp�
isinstance�str�endswith�bytesrZ)	r9rtrn�line�readsizerQr{�line0withend�line0withoutendr:r:r;�readlines^


zStreamReader.readlinecCs|j�}|j|�S)aS Read all lines available on the input stream
            and return them as a list.

            Line breaks are implemented using the codec's decoder
            method and are included in the list entries.

            sizehint, if given, is ignored since there is no efficient
            way to finding the true end-of-line.

        )rprs)r9�sizehintrnrQr:r:r;�	readlines]szStreamReader.readlinescCsd|_|j|_d|_dS)z� Resets the codec buffers used for keeping state.

            Note that no stream repositioning should take place.
            This method is primarily intended to be able to recover
            from decoding errors.

        rTN)rhrjrkrl)r9r:r:r;rKls	zStreamReader.resetrcCs|jj||�|j�dS)zp Set the input stream's current position.

            Resets the codec buffers used for keeping state.
        N)rWr]rK)r9r^r_r:r:r;r]yszStreamReader.seekcCs|j�}|r|St�dS)z4 Return the next decoded line from the input stream.N)r��
StopIteration)r9r�r:r:r;�__next__�szStreamReader.__next__cCs|S)Nr:)r9r:r:r;�__iter__�szStreamReader.__iter__cCs||j|�S)z? Inherit all other methods from the underlying stream.
        )rW)r9r3r`r:r:r;ra�szStreamReader.__getattr__cCs|S)Nr:)r9r:r:r;rb�szStreamReader.__enter__cCs|jj�dS)N)rWrc)r9rdrerfr:r:r;rg�szStreamReader.__exit__)rC)rCr�r�)r�r�F)NT)NT)r)rAr=r>r�rirIr$rpr�r�rKr]r�r�r`rarbrgr:r:r:r;r�s


P
K

c@s�eZdZdZdZd!dd�Zd#dd�Zd$d
d�Zd%dd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
d&dd�Zefdd�Zdd�Zdd �Zd	S)'ra StreamReaderWriter instances allow wrapping streams which
        work in both read and write modes.

        The design is such that one can use the factory functions
        returned by the codec.lookup() function to construct the
        instance.

    �unknownrCcCs(||_|||�|_|||�|_||_dS)aR Creates a StreamReaderWriter instance.

            stream must be a Stream-like object.

            Reader, Writer must be factory functions or classes
            providing the StreamReader, StreamWriter interface resp.

            Error handling is done in the same way as defined for the
            StreamWriter/Readers.

        N)rW�reader�writerrF)r9rW�Reader�WriterrFr:r:r;rI�s
zStreamReaderWriter.__init__rmcCs|jj|�S)N)r�rp)r9rtr:r:r;rp�szStreamReaderWriter.readNcCs|jj|�S)N)r�r�)r9rtr:r:r;r��szStreamReaderWriter.readlinecCs|jj|�S)N)r�r�)r9r�r:r:r;r��szStreamReaderWriter.readlinescCs
t|j�S)z4 Return the next decoded line from the input stream.)�nextr�)r9r:r:r;r��szStreamReaderWriter.__next__cCs|S)Nr:)r9r:r:r;r��szStreamReaderWriter.__iter__cCs|jj|�S)N)r�rX)r9rQr:r:r;rX�szStreamReaderWriter.writecCs|jj|�S)N)r�r\)r9r[r:r:r;r\�szStreamReaderWriter.writelinescCs|jj�|jj�dS)N)r�rKr�)r9r:r:r;rK�s
zStreamReaderWriter.resetrcCs6|jj||�|jj�|dkr2|dkr2|jj�dS)Nr)rWr]r�rKr�)r9r^r_r:r:r;r]�s
zStreamReaderWriter.seekcCs||j|�S)z? Inherit all other methods from the underlying stream.
        )rW)r9r3r`r:r:r;ra�szStreamReaderWriter.__getattr__cCs|S)Nr:)r9r:r:r;rb�szStreamReaderWriter.__enter__cCs|jj�dS)N)rWrc)r9rdrerfr:r:r;rg�szStreamReaderWriter.__exit__)rCr�)r�)N)N)r)rAr=r>rB�encodingrIrpr�r�r�r�rXr\rKr]r`rarbrgr:r:r:r;r�s	




c@s�eZdZdZdZdZddd�Zd dd�Zd!d
d�Zd"dd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zefdd�Zdd�Zdd�Zd	S)#raB StreamRecoder instances translate data from one encoding to another.

        They use the complete set of APIs returned by the
        codecs.lookup() function to implement their task.

        Data written to the StreamRecoder is first decoded into an
        intermediate format (depending on the "decode" codec) and then
        written to the underlying stream using an instance of the provided
        Writer class.

        In the other direction, data is read from the underlying stream using
        a Reader instance and then encoded and returned to the caller.

    r�rCcCs4||_||_||_|||�|_|||�|_||_dS)a� Creates a StreamRecoder instance which implements a two-way
            conversion: encode and decode work on the frontend (the
            data visible to .read() and .write()) while Reader and Writer
            work on the backend (the data in stream).

            You can use these objects to do transparent
            transcodings from e.g. latin-1 to utf-8 and back.

            stream must be a file-like object.

            encode and decode must adhere to the Codec interface; Reader and
            Writer must be factory functions or classes providing the
            StreamReader and StreamWriter interfaces resp.

            Error handling is done in the same way as defined for the
            StreamWriter/Readers.

        N)rWr#r$r�r�rF)r9rWr#r$r�r�rFr:r:r;rIszStreamRecoder.__init__rmcCs"|jj|�}|j||j�\}}|S)N)r�rpr#rF)r9rtrQ�bytesencodedr:r:r;rp"szStreamRecoder.readNcCs6|dkr|jj�}n|jj|�}|j||j�\}}|S)N)r�r�r#rF)r9rtrQr�r:r:r;r�(s
zStreamRecoder.readlinecCs(|jj�}|j||j�\}}|jdd�S)NT)rn)r�rpr#rFrs)r9r�rQr�r:r:r;r�1s
zStreamRecoder.readlinescCs t|j�}|j||j�\}}|S)z4 Return the next decoded line from the input stream.)r�r�r#rF)r9rQr�r:r:r;r�7s
zStreamRecoder.__next__cCs|S)Nr:)r9r:r:r;r�>szStreamRecoder.__iter__cCs|j||j�\}}|jj|�S)N)r$rFr�rX)r9rQ�bytesdecodedr:r:r;rXAszStreamRecoder.writecCs(dj|�}|j||j�\}}|jj|�S)NrG)rZr$rFr�rX)r9r[rQr�r:r:r;r\Fs
zStreamRecoder.writelinescCs|jj�|jj�dS)N)r�rKr�)r9r:r:r;rKLs
zStreamRecoder.resetcCs||j|�S)z? Inherit all other methods from the underlying stream.
        )rW)r9r3r`r:r:r;raQszStreamRecoder.__getattr__cCs|S)Nr:)r9r:r:r;rbXszStreamRecoder.__enter__cCs|jj�dS)N)rWrc)r9rdrerfr:r:r;rg[szStreamRecoder.__exit__)rCr�)r�)N)N)rAr=r>rB�
data_encoding�
file_encodingrIrpr�r�r�r�rXr\rKr`rarbrgr:r:r:r;r�s


	
�rrCrmcCsV|dk	rd|kr|d}tj|||�}|dkr2|St|�}t||j|j|�}||_|S)a> Open an encoded file using the given mode and return
        a wrapped version providing transparent encoding/decoding.

        Note: The wrapped version will only accept the object format
        defined by the codecs, i.e. Unicode objects for most builtin
        codecs. Output is also codec dependent and will usually be
        Unicode as well.

        Underlying encoded files are always opened in binary mode.
        The default file mode is 'r', meaning to open the file in read mode.

        encoding specifies the encoding which is to be used for the
        file.

        errors may be given to define the error handling. It defaults
        to 'strict' which causes ValueErrors to be raised in case an
        encoding error occurs.

        buffering has the same meaning as for the builtin open() API.
        It defaults to line buffered.

        The returned wrapped file object provides an extra attribute
        .encoding which allows querying the used encoding. This
        attribute is only available if an encoding was specified as
        parameter.

    N�b)�builtinsrrrr7r6r�)�filename�moder�rF�	buffering�file�info�srwr:r:r;r`scCsF|dkr|}t|�}t|�}t||j|j|j|j|�}||_||_|S)a� Return a wrapped version of file which provides transparent
        encoding translation.

        Data written to the wrapped file is decoded according
        to the given data_encoding and then encoded to the underlying
        file using file_encoding. The intermediate data type
        will usually be Unicode but depends on the specified codecs.

        Bytes read from the file are decoded using file_encoding and then
        passed back to the caller encoded using data_encoding.

        If file_encoding is not given, it defaults to data_encoding.

        errors may be given to define the error handling. It defaults
        to 'strict' which causes ValueErrors to be raised in case an
        encoding error occurs.

        The returned wrapped file object provides two extra attributes
        .data_encoding and .file_encoding which reflect the given
        parameters of the same name. The attributes can be used for
        introspection by Python programs.

    N)rrr#r$r7r6r�r�)r�r�r�rF�	data_info�	file_info�srr:r:r;r�scCs
t|�jS)z� Lookup up the codec for the given encoding and return
        its encoder function.

        Raises a LookupError in case the encoding cannot be found.

    )rr#)r�r:r:r;r�scCs
t|�jS)z� Lookup up the codec for the given encoding and return
        its decoder function.

        Raises a LookupError in case the encoding cannot be found.

    )rr$)r�r:r:r;r�scCst|�j}|dkrt|��|S)z� Lookup up the codec for the given encoding and return
        its IncrementalEncoder class or factory function.

        Raises a LookupError in case the encoding cannot be found
        or the codecs doesn't provide an incremental encoder.

    N)rr4�LookupError)r��encoderr:r:r;r�s	
cCst|�j}|dkrt|��|S)z� Lookup up the codec for the given encoding and return
        its IncrementalDecoder class or factory function.

        Raises a LookupError in case the encoding cannot be found
        or the codecs doesn't provide an incremental decoder.

    N)rr5r�)r��decoderr:r:r;r �s	
cCs
t|�jS)z� Lookup up the codec for the given encoding and return
        its StreamReader class or factory function.

        Raises a LookupError in case the encoding cannot be found.

    )rr7)r�r:r:r;r!�scCs
t|�jS)z� Lookup up the codec for the given encoding and return
        its StreamWriter class or factory function.

        Raises a LookupError in case the encoding cannot be found.

    )rr6)r�r:r:r;r"�scksLt|�|f|�}x |D]}|j|�}|r|VqW|jdd�}|rH|VdS)z�
    Encoding iterator.

    Encodes the input strings from the iterator using an IncrementalEncoder.

    errors and kwargs are passed through to the IncrementalEncoder
    constructor.
    rGTN)rr#)�iteratorr�rF�kwargsr�rE�outputr:r:r;r%�s	


cksLt|�|f|�}x |D]}|j|�}|r|VqW|jdd�}|rH|VdS)z�
    Decoding iterator.

    Decodes the input strings from the iterator using an IncrementalDecoder.

    errors and kwargs are passed through to the IncrementalDecoder
    constructor.
    rTTN)r r$)r�r�rFr�r�rEr�r:r:r;r&s	


cCsdd�|D�S)z� make_identity_dict(rng) -> dict

        Return a dictionary where elements of the rng sequence are
        mapped to themselves.

    cSsi|]
}||�qSr:r:)�.0�ir:r:r;�
<dictcomp>"sz&make_identity_dict.<locals>.<dictcomp>r:)�rngr:r:r;�make_identity_dictsr�cCs8i}x.|j�D]"\}}||kr(|||<qd||<qW|S)a� Creates an encoding map from a decoding map.

        If a target mapping in the decoding map occurs multiple
        times, then that target is mapped to None (undefined mapping),
        causing an exception when encountered by the charmap codec
        during translation.

        One example where this happens is cp875.py which decodes
        multiple character to \u001a.

    N)�items)�decoding_map�m�k�vr:r:r;�make_encoding_map$s

r��ignore�replace�xmlcharrefreplace�backslashreplace�namereplace�__main__zlatin-1zutf-8)r�NrCrm)NrC)rC)rC)<rBr��sys�_codecs�ImportErrorZwhy�SystemError�__all__rr	rrrrr�	byteorderrrrrr
r
rr1rrrYrrOrrUrrrrrrrrrr r!r"r%r&r�r�r.r'r(r)r*r+r,r��_falseZ	encodingsrA�stdout�stdinr:r:r:r;�<module>s�

B("1+IzWn
*
&








tabnanny.cpython-36.opt-2.pyc000064400000013634150335715140011757 0ustar003


 \�,�@s�dZddlZddlZddlZddlZeed�s6ed��dddgZdada	dd	�Z
d
d�ZGdd�de�Z
d
d�ZGdd�d�Zdd�Zdd�Zedkr�e�dS)�6�N�NLz4tokenize.NL doesn't exist -- tokenize module too old�check�NannyNag�process_tokenscGs:d}x$|D]}tjj|t|��d}q
Wtjjd�dS)N�� �
)�sys�stderr�write�str)�args�sep�arg�r� /usr/lib64/python3.6/tabnanny.py�errprint#s

rcCs�ytjtjdd�d�\}}Wn*tjk
rH}zt|�dSd}~XnXx0|D](\}}|dkrhtda|dkrPtdaqPW|s�tdtjdd�dSx|D]}t|�q�WdS)N�Zqvz-qz-vzUsage:rz[-v] file_or_directory ...)�getoptr
�argv�errorr�
filename_only�verboser)Zoptsr�msg�o�arrrr�main*s
rc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rcCs||||_|_|_dS)N)�linenor�line)�selfrrrrrr�__init__AszNannyNag.__init__cCs|jS)N)r)r rrr�
get_linenoCszNannyNag.get_linenocCs|jS)N)r)r rrr�get_msgEszNannyNag.get_msgcCs|jS)N)r)r rrr�get_lineGszNannyNag.get_lineN)�__name__�
__module__�__qualname__r!r"r#r$rrrrr<sc	%Cs"tjj|�r�tjj|�r�tr,td|f�tj|�}xT|D]L}tjj||�}tjj|�rhtjj|�s�tjj|dd��dkr<t	|�q<WdSyt
j|�}Wn0tk
r�}zt
d||f�dSd}~XnXtdkr�td|��zytt
j|j��W�n�t
jk
�r2}zt
d||f�dSd}~Xn�tk
�rb}zt
d||f�dSd}~Xn�tk
�r�}z||j�}|j�}t�r�td	||f�td
|f�t|j��n6d|k�r�d|d}t�r�t|�nt||t|��dSd}~XnXWd|j�Xt�rtd
|f�dS)Nz%r: listing directory�z.pyz%r: I/O Error: %srzchecking %r ...z%r: Token Error: %sz%r: Indentation Error: %sz)%r: *** Line %d: trouble in tab city! ***zoffending line: %rr�"z%r: Clean bill of health.���)�os�path�isdir�islinkr�print�listdir�join�normcaser�tokenize�open�OSErrorrr�generate_tokens�readline�
TokenError�IndentationErrorrr"r$r#r�repr�close)	�file�names�name�fullname�frZnag�badlinerrrrrJsT





c@sLeZdZd\ZZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZdS)�
Whitespacez 	c	Cs�||_tjtj}}g}d}}}x~|jD]t}||krJ|d}|d}q,||kr�|d}|d}|t|�kr�|dg|t|�d}||d||<d}q,Pq,W||_||_t|�|f|_t|�dk|_	dS)Nrr)
�rawrB�S�T�len�n�nt�tuple�norm�	is_simple)	r ZwsrDrE�count�brGrHZchrrrr!�s(
zWhitespace.__init__cCs|j\}}tt|�d|�S)Nr)rJ�maxrF)r rL�trailingrrr�longest_run_of_spaces�s
z Whitespace.longest_run_of_spacescCsL|j\}}d}x*t|t|��D]}|||||}qW||||jS)Nr)rJ�rangerFrH)r �tabsizerLrOZil�irrr�indent_level�s

zWhitespace.indent_levelcCs|j|jkS)N)rJ)r �otherrrr�equal�szWhitespace.equalcCsft|j�|j��d}g}xFtd|d�D]4}|j|�|j|�kr*|j||j|�|j|�f�q*W|S)Nr)rNrPrQrT�append)r rUrGr�tsrrr�not_equal_witness�szWhitespace.not_equal_witnesscCsr|j|jkrdS|jr(|jr(|j|jkSt|j�|j��d}x.td|d�D]}|j|�|j|�krNdSqNWdS)NFr�T)rGrKrHrNrPrQrT)r rUrGrXrrr�less�szWhitespace.lesscCsft|j�|j��d}g}xFtd|d�D]4}|j|�|j|�kr*|j||j|�|j|�f�q*W|S)Nr)rNrPrQrTrW)r rUrGrrXrrr�not_less_witnessszWhitespace.not_less_witnessN)r%r&r'rDrEr!rPrTrVrYr[r\rrrrrB�srBcCs8dd�|D�}d}t|�dkr&|d}|ddj|�S)Ncss|]}t|d�VqdS)rN)r
)�.0�tuprrr�	<genexpr>sz#format_witnesses.<locals>.<genexpr>zat tab sizer�srz, )rFr1)�wZfirsts�prefixrrr�format_witnesses
s
rccCstj}tj}tj}tjtjf}td�g}d}x�|D]�\}}}	}
}||krNd}q2||kr�d}t|�}|dj|�s�|dj|�}
dt	|
�}t
|	d||��|j|�q2||kr�d}|d=q2|o�||kr2d}t|�}|d	j|�s2|d
j
|�}
dt	|
�}t
|	d||��q2WdS)Nrrrzindent not greater e.g. zindent not equal e.g. ���rdrdrdrd)r3�INDENT�DEDENT�NEWLINE�COMMENTrrBr[r\rcrrWrVrY)�tokensrerfrgZJUNK�indentsZcheck_equal�type�token�start�endrZthisguyZwitnessrrrrrs6

�__main__)�__version__r+r
rr3�hasattr�
ValueError�__all__rrrr�	ExceptionrrrBrcrr%rrrr�<module>s&

=7sre_compile.cpython-36.pyc000064400000024050150335715140011500 0ustar003


 \�K�@s�dZddlZddlZddlTejeks.td��eehZe	e
ehZe
ehZeehZdWZd&d'�eD�Zd(d)�ZdXd*d+�Zd,d-�Zejd.Zd/e>d/Zd0d1d2Zeefd3d4�Zd5d6�Zd7d8�Zd9d:�Z d;d<�Z!d=d>�Z"d?d@�Z#dAdB�Z$dCdD�Z%dYdEdF�Z&dS)ZzInternal support module for sre�N)�*zSRE module mismatch�i�1�s����E����������������������������������a�����cs.i|]&}|D]�t�fdd�|D����qqS)c3s|]}�|kr|VqdS)N�)�.0�j)�ir$�#/usr/lib64/python3.6/sre_compile.py�	<genexpr>=sz<dictcomp>.<genexpr>)�tuple)r%�tr$)r'r(�
<dictcomp>=sr,cCsr|j}t}t}t}t}t}|t@rD|t@rD|t@rD|t	@rDt
}	nd}	�x"|D�]\}
}|
|k�r|t@�rtj||�}|	r�||	kr�|t
�||�}
|d�|
tkr�|t�x&|f|	|D]}|t�||�q�W|t�||�|
||
<n|t|
�||�n||
�||�qP|
tk�r�|t@�rF|t|
�|fdd�}n||
�d}||�}
|d�t|||||	�||�|
||
<qP|
tk�r�|t@�r�|t�n|t�qP|
|k�r�|t@�r�td|
f��n�t|��rR|
tk	�rR|
tk�r�|t�n|t�||�}
|d�||d�||d�t||d|�|t �||�|
||
<nl|t�||�}
|d�||d�||d�t||d|�||�|
||
<|
tk�r�|t!�n|t"�qP|
t#k�r.|\}}}}|�r�|t$�||dd�t||||B|@�|�rj|t$�||ddd�qP|
|k�rB||
�qP|
|k�r�||
�||�}
|d�|ddk�r||d�n*|dj%�\}}||k�r�td��||�t||d|�|t �||�|
||
<qP|
t&k�r||
�||�}
|d�t|||�|t �||�|
||
<qP|
t'k�r�||
�|t(@�r@t)j*||�}|t@�rXt+j*||�}n"|t@�rz|t	@�rzt,j*||�}||�qP|
t-k�r&||
�g}|j}xZ|dD]N}||�}
|d�t|||�|t.�|||��|d�||�|
||
<�q�W|t�x|D]}||�|||<�q
WqP|
t/k�rt||
�|t@�rLt0|}n|t@�rj|t	@�rjt1|}||�qP|
t2k�r�|t@�r�|t|
�n||
�||d�qP|
t3k�r\||
�||dd�||�}|d�t||d|�|d�rF|t.�||�}|d�||�|d||<t||d|�||�|||<n||�|d||<qPtd|
f��qPWdS)	NrcSstj||�S)N)�_sre�getlower)�literal�flagsr$r$r(�fixupfsz_compile.<locals>.fixupz*internal: unsupported template operator %r��z(look-behind requires fixed-width patternz%internal: unsupported operand type %r)4�append�len�_LITERAL_CODES�_REPEATING_CODES�_SUCCESS_CODES�
_ASSERT_CODES�SRE_FLAG_IGNORECASE�SRE_FLAG_LOCALE�SRE_FLAG_UNICODE�SRE_FLAG_ASCII�_ignorecase_fixesr-r.�	IN_IGNORE�NOT_LITERAL�NEGATE�LITERAL�FAILURE�	OP_IGNORE�IN�_compile_charset�ANY�SRE_FLAG_DOTALL�ANY_ALL�SRE_FLAG_TEMPLATE�error�_simple�REPEAT�
MAX_REPEAT�
REPEAT_ONE�MIN_REPEAT_ONE�_compile�SUCCESS�	MAX_UNTIL�	MIN_UNTIL�
SUBPATTERN�MARK�getwidth�CALL�AT�SRE_FLAG_MULTILINE�AT_MULTILINE�get�	AT_LOCALE�
AT_UNICODE�BRANCH�JUMP�CATEGORY�	CH_LOCALE�
CH_UNICODE�GROUPREF�GROUPREF_EXISTS)�code�patternr0�emit�_len�
LITERAL_CODES�REPEATING_CODES�
SUCCESS_CODES�ASSERT_CODES�fixes�op�av�lo�skip�kr1�group�	add_flags�	del_flags�p�hi�tail�
tailappend�skipyes�skipnor$r$r(rQ@s.







































rQcCs�|j}x�t|||�D]�\}}||�|tkr.q|tkr@||�q|tksP|tkrj||d�||d�q|tkr~|j|�q|tkr�|j|�q|t	kr�|t
@r�|t|�q�|t@r�|t
@r�|t|�q�||�qtd|f��qW|t�dS)Nrr2z%internal: unsupported set operator %r)r4�_optimize_charsetrArB�RANGE�RANGE_IGNORE�CHARSET�extend�
BIGCHARSETrar;rbr<r=rcrKrC)�charsetr0rfr1rnrhrorpr$r$r(rF�s,

rFcCsdg}g}td�}�xt|D�]j\}}�x^�y|tkrx|rn||�}d||<|rv||krvx"||D]}	d||	<q\Wnd||<n�|tkr�t|d|dd�}
|r�t||
�}
|r�|r�xN|
D].}d||<||kr�x||D]}	d||	<q�Wq�Wnx>|
D]}d||<q�Wn(|tk�r|j||f�n|j||f�WnTtk
�r|t|�dk�rV|dd7}w&|�rj|tk�rjt	}|j||f�YnXPq&WqWg}d}
xj|j
d|
�}|dk�r�Pt|�dk�r�d}P|j
d|�}
|
dk�r�|j|t|�f�P|j||
f��q�W|dk	�rvxF|D]>\}}
|
|dk�r2|jt|f�n|jt||
dff��qW||7}|�snt|�t|�k�rr|S|St|�dk�r�t|�}|jt|f�||7}|St
|�}i}td�}d}t�}xftddd�D]V}|||d�}||k�r||||d<n$|||d<||<|d7}||7}�q�Wt|�}|gt|�|dd�<|jt|f�||7}|S)N�r2r�i�r3i)�	bytearrayrBr~�range�maprAr4�
IndexErrorr5r�find�
_mk_bitmapr��bytes�_bytes_to_codesr�)r�r1rn�outry�charmaprorprqrs�rr'�runs�qrw�data�comps�mapping�block�chunkr$r$r(r}�s�









r}�r2�0�1�cs8|jt�ddd�����fdd�tt��d��D�S)Nr2cs"g|]}��|�|�d��qS)r3r$)r%r')�	_CODEBITS�_int�sr$r(�
<listcomp>zsz_mk_bitmap.<locals>.<listcomp>r���)�	translate�_BITS_TRANSr�r5)�bitsr�r�r$)r�r�r�r(r�xsr�cCs@t|�jd�}|jtjkst�t|�|jt|�ks8t�|j�S)N�I)�
memoryview�cast�itemsizer-�CODESIZE�AssertionErrorr5�tolist)�b�ar$r$r(r�}sr�cCs<|dj�\}}||ko"dkno:|dddtkS)Nr3r2r)rWrU)rprqrxr$r$r(rL�srLcCsvdgt|�}xbtdt|��D]P}||d}x>||||kr`|dkrRd||<P||d}q0W|d||<qW|S)aj
    Generate an overlap table for the following prefix.
    An overlap table is a table of the same size as the prefix which
    informs about the potential self-overlap for each index in the prefix:
    - if overlap[i] == 0, prefix[i:] can't overlap prefix[0:...]
    - if overlap[i] == k with 0 < k <= i, prefix[i-k+1:i+1] overlaps with
      prefix[0:k]
    rr2)r5r�)�prefix�tabler'�idxr$r$r(�_generate_overlap_table�s	r�c
Cs�g}|j}d}x�|jD]�\}}|tkr0||�q|tkr�|\}}}}	|t@rNPt|	�\}
}}|dkr�|dk	rvt|�}n|dk	r�t|�|}|j|
�|s�PqPqW||dfS||dfS)NTF)r4r�rBrUr:�_get_literal_prefixr5r�)
rgr��prefixappend�prefix_skiprorprtrurvrw�prefix1�prefix_skip1�got_allr$r$r(r��s,



r�cCs"g}|j}|j�r|jd\}}|tkr�|\}}}}|r�|t@r�|d\}}|tkrd|||f�nR|tkr�g}	|	j}
x�|dD].}|s�P|d\}}|tkr�|
||f�q�Pq�W|	}nf|tk�rg}	|	j}
xP|dD]0}|s�P|d\}}|tk�r|
||f�q�Pq�W|	}n|tk�r|}|S)Nrr2)r4r�rUr:rBr_rE)rgr��
charsetappendrorprtrurvrw�c�cappendr$r$r(�_get_charset_prefix�sF


r�cCsZ|j�\}}|tkrt}|dkr8|jtdd||g�dSg}d}g}|t@sft|�\}}}|sft|�}|j}	|	t�t|�}
|	d�d}|r�t	}|dkr�|r�|t
B}n|r�|tB}|	|�|tkr�|	|�n|	t�|dt�}|	t|t��|�r4|	t|��|dk�rt|�}|	|�|j|�|jt
|��n|�rFt|||�t|�|
||
<dS)Nr�)rW�MAXCODEr��INFOr:r�r�r4r5�SRE_INFO_PREFIX�SRE_INFO_LITERAL�SRE_INFO_CHARSET�minr�rF)rfrgr0rqrxr�r�r�r�rhrr�maskr$r$r(�
_compile_info�sP



r�cCst|ttf�S)N)�
isinstance�strr�)�objr$r$r(�isstringsr�cCs8|jj|B}g}t|||�t||j|�|jt�|S)N)rgr0r�rQr�r4rR)rwr0rfr$r$r(�_codes
r�cCs�t|�r|}tj||�}nd}t||�}|jj}dg|jj}x|j�D]\}}|||<qHWtj	|||jj
B||jjd||�S)Nr2)r��	sre_parse�parser�rg�	groupdict�groups�itemsr-�compiler0)rwr0rgrf�
groupindex�
indexgrouprsr'r$r$r(r�-s

r��rr�rr�rr�r	r
r�rr
�rr�rr�rr�rr�rr�rr�rr�rr�rr�r r!�r"r#)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�)NN)r)'�__doc__r-r��
sre_constants�MAGICr�rBr@r6rM�
MIN_REPEATrNr7rRrCr8�ASSERT�
ASSERT_NOTr9�
_equivalencesr>rQrFr}r�r�r�r��intr�r�rLr�r�r�r�r�r�r�r$r$r$r(�<module>sV
 
{
)9_markupbase.cpython-36.opt-1.pyc000064400000017220150335715140012430 0ustar003


 \9�@sVdZddlZejd�jZejd�jZejd�Zejd�Zejd�Z[Gdd	�d	�Z	dS)
z�Shared support for scanning document type declarations in HTML and XHTML.

This module is used as a foundation for the html.parser module.  It has no
documented public API and should not be used directly.

�Nz[a-zA-Z][-_.a-zA-Z0-9]*\s*z(\'[^\']*\'|"[^"]*")\s*z--\s*>z	]\s*]\s*>z]\s*>c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdZ	d
d�Z
d#dd�Zd$dd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"S)%�
ParserBaseziParser base class which provides some common support methods used
    by the SGML/HTML and XHTML parsers.cCs|jtkrtd��dS)Nz)_markupbase.ParserBase must be subclassed)�	__class__r�RuntimeError)�self�r�#/usr/lib64/python3.6/_markupbase.py�__init__s
zParserBase.__init__cCstd��dS)Nz.subclasses of ParserBase must override error())�NotImplementedError)r�messagerrr�error szParserBase.errorcCsd|_d|_dS)N�r)�lineno�offset)rrrr�reset$szParserBase.resetcCs|j|jfS)z&Return current line number and offset.)r
r)rrrr�getpos(szParserBase.getposcCsb||kr|S|j}|jd||�}|rN|j||_|jd||�}||d|_n|j|||_|S)N�
r)�rawdata�countr
�rindexr)r�i�jrZnlines�posrrr�	updatepos0szParserBase.updatepos�c
Cs�|j}|d}|||d�dkr*|dS|||d�dkrBdSt|�}|||d�dkrh|j|�S||dkr~|j|�S|j||�\}}|dkr�|S|d	kr�d|_�x||k�r�||}|dk�r�||d|�}|d	kr�|j|�n
|j|�|dS|d
k�r&t||�}|�sdS|j	�}n�|dk�rB|j||�\}	}nt||jk�rX|d}n^|dk�r�|d	k�r~|j
|d|�}n$|dk�r�|jd|�n
|jd�n|jd||�|dkr�|Sq�WdS)N�r�>�-rz--�[rZdoctypez"'Z4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ�attlist�linktype�link�elementz&unsupported '[' char in %s declarationz"unexpected '[' char in declarationz!unexpected %r char in declaration)rr���r">r r!rrr")r�len�
parse_comment�parse_marked_section�
_scan_name�_decl_othercharsZhandle_decl�unknown_decl�_declstringlit_match�end�_parse_doctype_subsetr)
rrrr�nZdecltype�c�data�m�namerrr�parse_declaration@sX











zParserBase.parse_declarationrcCs�|j}|j|d|�\}}|dkr&|S|d
kr@tj||d�}n4|dkrZtj||d�}n|jd||d|��|s|dS|r�|jd�}|j||d|��|jd�S)N�r�temp�cdata�ignore�include�rcdata�if�else�endifz+unknown status keyword %r in marked sectionr>r7r3r5r6r4>r8r9r:r")	rr&�_markedsectionclose�search�_msmarkedsectioncloser�startr(r*)rr�reportrZsectNamer�matchrrrr%�s
zParserBase.parse_marked_sectioncCsj|j}|||d�dkr$|jd�tj||d�}|s<dS|r`|jd�}|j||d|��|jd�S)N�z<!--z"unexpected call to parse_comment()rrr")rr�
_commentcloser<r>Zhandle_commentr*)rrr?rr@rrrrr$�s

zParserBase.parse_commentc
Cs4|j}t|�}|}�x||k�r.||}|dk�r4|||d�}|dkrNdS|dkrt|j||d�|jd|�|d|kr�dS|d|kr�dS|||d�dkr�|j|dd	�}|dkr|Sq|j|d|�\}}|dkr�dS|dk�r|j||d�|jd|�t|d|�}	|	||�}|dk�r,|Sq|dk�r�|d|k�rPdS|j|d|�\}}|dk�rr|S||dk�r,|d}q|dk�r�|d}x&||k�r�||j��r�|d}�q�W||k�r�||dk�r�|S|j||�|jd�ndSq|j��r|d}q|j||�|jd|�qWdS)N�<rrz<!z*unexpected char in internal subset (in %r)rAz<!--r)r?rr!�entity�notationz)unknown declaration %r in internal subsetZ_parse_doctype_�%�;�]rz%unexpected char after internal subsetz%unexpected char %r in internal subsetr"r"r"r"r">rr!rDrEr"r"r")rr#rrr$r&�getattr�isspace)
rr�declstartposrr,rr-�sr0�methrrrr+�sn











z ParserBase._parse_doctype_subsetcCsF|j||�\}}|dkrdS|j}d||d�krB|jd|�dSdS)Nrrr"r"r")r&r�find)rrrKr0rrrrr�_parse_doctype_element�sz!ParserBase._parse_doctype_elementcCs�|j}|j||�\}}|||d�}|dkr2d	S|dkrB|dS�xv|j||�\}}|dkrb|S|||d�}|dkr~d
S|dkr�d||d�kr�|jd|�d}ndSx |||d�j�r�|d}q�W||d�s�dSn|j||�\}}|||d�}|�s
d
S|dk�rLt||�}|�r.|j�}ndS|||d�}|�sLdS|dk�r�||d�dk�rldS|j|d|�\}}|dk�r�|S|||d�}|�s�dS|dkrF|dSqFWdS)Nrrrr�(�)z'"�#r"r"r"r"r"r"r"r"r")rr&rNrJr)r*)rrrKrr0rr-r/rrr�_parse_doctype_attlistsZ




z!ParserBase._parse_doctype_attlistcCs�|j||�\}}|dkr|S|j}xl|||d�}|s<dS|dkrL|dS|dkrpt||�}|sfdS|j�}q$|j||�\}}|dkr$|Sq$WdS)Nrrrz'"r"r")r&rr)r*)rrrKr0rrr-r/rrr�_parse_doctype_notation=s$

z"ParserBase._parse_doctype_notationcCs�|j}|||d�dkrV|d}x6|||d�}|s<dS|j�rN|d}q$Pq$Wn|}|j||�\}}|dkrv|Sxp|j||d�}|s�dS|dkr�t||�}|r�|j�}q�dSqx|dkr�|dS|j||�\}}|dkrx|SqxWdS)	NrrFrz'"rr"r"r")rrJr&r)r*)rrrKrrr-r0r/rrr�_parse_doctype_entityTs8


z ParserBase._parse_doctype_entitycCs�|j}t|�}||krdSt||�}|r\|j�}|j�}|t|�|krLdS|j�|j�fS|j||�|jd|||d��dS)Nrzexpected name token at %r�r")Nr"r")Nr")	rr#�_declname_match�group�strip�lowerr*rr)rrrKrr,r/rLr0rrrr&xs
zParserBase._scan_namecCsdS)Nr)rr.rrrr(�szParserBase.unknown_declN)r)r)�__name__�
__module__�__qualname__�__doc__rrrrrr'r1r%r$r+rOrSrTrUr&r(rrrrrs"
R

C9$r)
r^�re�compiler@rWr)rBr;r=rrrrr�<module>s


gzip.cpython-36.pyc000064400000037544150335715140010164 0ustar003


 \nO�@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddddgZ	d\Z
ZZZ
Zd\ZZddd�Zdd�ZGdd�d�ZGdd�dej�ZGdd�dej�Zddd�Zdd�Zdd�Zedkr�e�dS)z�Functions that read and write gzipped files.

The user of the file doesn't have to worry about the compression,
but random access is not allowed.�N�GzipFile�open�compress�
decompress������rb�	cCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|jdd�}t|tttjf�r|t|||�}n,t|d	�s�t|d
�r�td|||�}nt	d��d|kr�t
j||||�S|SdS)aOpen a gzip-compressed file in binary or text mode.

    The filename argument can be an actual filename (a str or bytes object), or
    an existing file object to read from or write to.

    The mode argument can be "r", "rb", "w", "wb", "x", "xb", "a" or "ab" for
    binary mode, or "rt", "wt", "xt" or "at" for text mode. The default mode is
    "rb", and the default compresslevel is 9.

    For binary mode, this function is equivalent to the GzipFile constructor:
    GzipFile(filename, mode, compresslevel). In this case, the encoding, errors
    and newline arguments must not be provided.

    For text mode, a GzipFile object is created, and wrapped in an
    io.TextIOWrapper instance with the specified encoding, error handling
    behavior, and line ending(s).

    �t�bzInvalid mode: %rNz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary mode��read�writez1filename must be a str or bytes object, or a file)�
ValueError�replace�
isinstance�str�bytes�os�PathLiker�hasattr�	TypeError�io�
TextIOWrapper)�filename�mode�
compresslevel�encoding�errors�newlineZgz_modeZbinary_file�r#�/usr/lib64/python3.6/gzip.pyrs$cCs|jtjd|��dS)Nz<L)r�structZpack)�output�valuer#r#r$�write32u@sr(c@s<eZdZdZddd�Zdd�Zddd�Zd	d
�Zdd�Zd
S)�_PaddedFilez�Minimal read-only file object that prepends a string to the contents
    of an actual file. Shouldn't be used outside of gzip.py, as it lacks
    essential functionality.�cCs ||_t|�|_||_d|_dS)Nr)�_buffer�len�_length�file�_read)�self�f�prependr#r#r$�__init__Js
z_PaddedFile.__init__cCs~|jdkr|jj|�S|j||jkrJ|j}|j|7_|j||j�S|j}d|_|j|d�|jj||j|�SdS)N)r/r.rr-r+)r0�sizerr#r#r$rPs
z_PaddedFile.readcCs>|jdkr||_n|jt|�8_dSt|j�|_d|_dS)Nr)r/r+r,r-)r0r2r#r#r$r2]s
z_PaddedFile.prependcCsd|_d|_|jj|�S)N)r/r+r.�seek)r0Zoffr#r#r$r5fsz_PaddedFile.seekcCsdS)NTr#)r0r#r#r$�seekableksz_PaddedFile.seekableN)r*)r*)	�__name__�
__module__�__qualname__�__doc__r3rr2r5r6r#r#r#r$r)Es

	r)c@s�eZdZdZdZd-dd�Zedd��Zedd	��Zd
d�Z	dd
�Z
dd�Zdd�Zd/dd�Z
d1dd�Zdd�Zedd��Zdd�Zejfdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zejfd)d*�Zd3d+d,�ZdS)4ra
The GzipFile class simulates most of the methods of a file object with
    the exception of the truncate() method.

    This class only supports opening files in binary mode. If you need to open a
    compressed file in text mode, use the gzip.open() function.

    NrcCs2|r"d|ksd|kr"tdj|���|r6d|kr6|d7}|dkrTtj||pJd�}|_|dkr|t|dd�}t|ttf�s�d}n
t	j
|�}|dkr�t|d	d�}|jd
�r�t|_
t|�}tj|�|_||_nN|jd��rt|_
|j|�tj|tjtjtjd�|_||_ntdj|���||_|j
tk�r.|j�dS)aGConstructor for the GzipFile class.

        At least one of fileobj and filename must be given a
        non-trivial value.

        The new class instance is based on fileobj, which can be a regular
        file, an io.BytesIO object, or any other object which simulates a file.
        It defaults to None, in which case filename is opened to provide
        a file object.

        When fileobj is not None, the filename argument is only used to be
        included in the gzip file header, which may include the original
        filename of the uncompressed file.  It defaults to the filename of
        fileobj, if discernible; otherwise, it defaults to the empty string,
        and in this case the original filename is not included in the header.

        The mode argument can be any of 'r', 'rb', 'a', 'ab', 'w', 'wb', 'x', or
        'xb' depending on whether the file will be read or written.  The default
        is the mode of fileobj if discernible; otherwise, the default is 'rb'.
        A mode of 'r' is equivalent to one of 'rb', and similarly for 'w' and
        'wb', 'a' and 'ab', and 'x' and 'xb'.

        The compresslevel argument is an integer from 0 to 9 controlling the
        level of compression; 1 is fastest and produces the least compression,
        and 9 is slowest and produces the most compression. 0 is no compression
        at all. The default is 9.

        The mtime argument is an optional numeric timestamp to be written
        to the last modification time field in the stream when compressing.
        If omitted or None, the current time is used.

        r
�UzInvalid mode: {!r}rNr�namerr�r�w�a�xr)r>r?r@)r�format�builtinsr�	myfileobj�getattrrrrr�fspath�
startswith�READr�_GzipReaderr�BufferedReaderr+r<�WRITE�_init_write�zlibZcompressobjZDEFLATED�	MAX_WBITSZ
DEF_MEM_LEVELr�_write_mtime�fileobj�_write_gzip_header)r0rrrrO�mtime�rawr#r#r$r3{s>#


zGzipFile.__init__cCsBddl}|jdtd�|jtkr<|jdd�dkr<|jdS|jS)Nrzuse the name attributer�z.gz���)�warnings�warn�DeprecationWarningrrJr<)r0rUr#r#r$r�s

zGzipFile.filenamecCs
|jjjS)z0Last modification time read from stream, or None)r+rR�_last_mtime)r0r#r#r$rQ�szGzipFile.mtimecCs.t|j�}d|dd�dtt|��dS)Nz<gzip r� �>���)�reprrO�hex�id)r0�sr#r#r$�__repr__�s
zGzipFile.__repr__cCs.||_tjd�|_d|_g|_d|_d|_dS)Nr*r)r<rL�crc32�crcr4Zwritebuf�bufsize�offset)r0rr#r#r$rK�szGzipFile._init_writecCs�|jjd�|jjd�y<tjj|j�}t|t�s<|jd�}|j	d�rR|dd�}Wnt
k
rld}YnXd}|rzt}|jjt|�jd��|j
}|dkr�tj�}t|jt|��|jjd�|jjd	�|r�|jj|d
�dS)Ns��zlatin-1s.gzrSr*r����rT)rOrr�path�basenamer<rr�encode�endswith�UnicodeEncodeError�FNAME�chrrN�timer(�int)r0Zfname�flagsrQr#r#r$rP�s,



zGzipFile._write_gzip_headercCs�|j�|jtkr&ddl}t|jd��|jdkr8td��t|t	�rLt
|�}nt|�}|j}|dkr�|jj
|jj|��|j|7_tj||j�|_|j|7_|S)Nrz$write() on read-only GzipFile objectz!write() on closed GzipFile object)�_check_not_closedrrJ�errno�OSError�EBADFrOrrrr,�
memoryview�nbytesrrr4rLrarbrd)r0�datartZlengthr#r#r$r�s 



zGzipFile.writercCs2|j�|jtkr&ddl}t|jd��|jj|�S)Nrz$read() on write-only GzipFile object)rsrrGrtrurvr+r)r0r4rtr#r#r$rs

z
GzipFile.readcCs@|j�|jtkr&ddl}t|jd��|dkr4tj}|jj	|�S)zdImplements BufferedIOBase.read1()

        Reads up to a buffer's worth of data is size is negative.rNz%read1() on write-only GzipFile object)
rsrrGrtrurvr�DEFAULT_BUFFER_SIZEr+�read1)r0r4rtr#r#r$r{s
zGzipFile.read1cCs2|j�|jtkr&ddl}t|jd��|jj|�S)Nrz$peek() on write-only GzipFile object)rsrrGrtrurvr+�peek)r0�nrtr#r#r$r|#s

z
GzipFile.peekcCs
|jdkS)N)rO)r0r#r#r$�closed*szGzipFile.closedcCs�|j}|dkrdSd|_zP|jtkrR|j|jj��t||j�t||jd@�n|jt	krf|j
j�Wd|j}|r�d|_|j�XdS)Nl��)
rOrrJrr�flushr(rbr4rGr+�closerC)r0rOrCr#r#r$r�.s

zGzipFile.closecCs4|j�|jtkr0|jj|jj|��|jj�dS)N)rsrrJrOrrr)r0Z	zlib_moder#r#r$rAs
zGzipFile.flushcCs
|jj�S)z�Invoke the underlying file object's fileno() method.

        This will raise AttributeError if the underlying file object
        doesn't support fileno().
        )rO�fileno)r0r#r#r$r�HszGzipFile.filenocCs"|jtkrtd��|jjd�dS)z[Return the uncompressed stream file position indicator to the
        beginning of the filezCan't rewind in write moderN)rrGrur+r5)r0r#r#r$�rewindPs
zGzipFile.rewindcCs
|jtkS)N)rrG)r0r#r#r$�readableWszGzipFile.readablecCs
|jtkS)N)rrJ)r0r#r#r$�writableZszGzipFile.writablecCsdS)NTr#)r0r#r#r$r6]szGzipFile.seekablecCs�|jtkr�|tjkr2|tjkr*|j|}ntd��||jkrDtd��||j}dd}xt|d�D]}|j	|�qdW|j	d|d�n |jt
kr�|j�|jj
||�S|jS)NzSeek from end not supportedzNegative seek in write moderhi)rrJr�SEEK_SET�SEEK_CURrdrru�rangerrGrsr+r5)r0rd�whence�count�chunk�ir#r#r$r5`s 





z
GzipFile.seekcCs|j�|jj|�S)N)rsr+�readline)r0r4r#r#r$r�tszGzipFile.readline)NNrNNr[)r[r[)r[r[)r[)r7r8r9r:rCr3�propertyrrQr`rKrPrrr{r|r~r�rLZZ_SYNC_FLUSHrr�r�r�r�r6rr�r5r�r#r#r#r$rns.
H


csZeZdZ�fdd�Zdd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Z	�fdd�Z
�ZS)rHcs,t�jt|�tjtjd�d|_d|_dS)N)ZwbitsT)�superr3r)rLZ
decompressobjrM�_new_memberrX)r0�fp)�	__class__r#r$r3zsz_GzipReader.__init__cCstjd�|_d|_dS)Nr*r)rLra�_crc�_stream_size)r0r#r#r$�
_init_read�sz_GzipReader._init_readcCsJ|jj|�}x8t|�|krD|jj|t|��}|s:td��||7}qW|S)z�Read exactly *n* bytes from `self._fp`

        This method is required because self._fp may be unbuffered,
        i.e. return short reads.
        zACompressed file ended before the end-of-stream marker was reached)�_fprr,�EOFError)r0r}ryrr#r#r$�_read_exact�sz_GzipReader._read_exactcCs�|jjd�}|dkrdS|dkr,td|��tjd|jd��\}}|_|dkrVtd��|t@r|tjd	|jd��\}|j|�|t@r�x |jjd
�}|s�|dkr�Pq�W|t	@r�x |jjd
�}|s�|dkr�Pq�W|t
@r�|jd�dS)
Nrr*Fs�zNot a gzipped file (%r)z<BBIxxr	zUnknown compression methodz<HrrhT)r�rrur%�unpackr�rX�FEXTRArn�FCOMMENT�FHCRC)r0�magic�method�flagZ	extra_lenr_r#r#r$�_read_gzip_header�s0

z_GzipReader._read_gzip_headerrcCs�|dkr|j�S|sdSx�|jjr@|j�d|_|jf|j�|_|jrh|j�|j�sb|j	|_
dSd|_|jjt
j�}|jj||�}|jjdkr�|jj|jj�n|jjdkr�|jj|jj�|dkr�P|dkrtd��qW|j|�|j	t|�7_	|S)Nrr*TFzACompressed file ended before the end-of-stream marker was reached)�readallZ
_decompressor�eof�	_read_eofr�Z_decomp_factoryZ_decomp_argsr�r�Z_posZ_sizer�rrrzrZunconsumed_tailr2Zunused_datar��_add_read_datar,)r0r4�bufZ
uncompressr#r#r$r�s:

z_GzipReader.readcCs$tj||j�|_|jt|�|_dS)N)rLrar�r�r,)r0ryr#r#r$r��sz_GzipReader._add_read_datacCs�tjd|jd��\}}||jkr<tdt|�t|j�f��n||jd@krRtd��d}x|dkrn|jjd�}qXW|r�|jj	|�dS)Nz<IIr	zCRC check failed %s != %sl��z!Incorrect length of data producedrhr)
r%r�r�r�rur]r�r�rr2)r0raZisize�cr#r#r$r��s


z_GzipReader._read_eofcst�j�d|_dS)NT)r��_rewindr�)r0)r�r#r$r�s
z_GzipReader._rewindr[)r[)r7r8r9r3r�r�r�rr�r�r��
__classcell__r#r#)r�r$rHys!
3rHc	Cs4tj�}t|d|d��}|j|�WdQRX|j�S)z�Compress data in one shot and return the compressed string.
    Optional argument is the compression level, in range of 0-9.
    �wb)rOrrN)r�BytesIOrr�getvalue)ryrr�r1r#r#r$rsc	Cs$ttj|�d��
}|j�SQRXdS)zYDecompress a gzip compressed string in one shot.
    Return the decompressed string.
    )rON)rrr�r)ryr1r#r#r$rscCs>tjdd�}|o|ddk}|r.|dd�}|s8dg}�x�|D]�}|r�|dkrltddtjjd�}tjj}q�|d
d�d	kr�td
t|��q@t|d�}t	j|dd�d�}n>|dkr�tjj}tddtjjd�}nt	j|d�}t|d	d�}x |j
d�}|�s�P|j|�q�W|tjjk	�r"|j�|tjjk	r@|j�q@WdS)Nrrz-d�-rr)rrrOrSz.gzzfilename doesn't end in .gz:r�irTrT)
�sys�argvr�stdin�buffer�stdout�printr\rrBrrr�)�argsr�argr1�gr�r#r#r$�_tests<


r��__main__)rrrr	r
)rr)rrNNN)r)r:r%r�rprrLrBrZ_compression�__all__ZFTEXTr�r�rnr�rGrJrr(r)Z
BaseStreamrZDecompressReaderrHrrr�r7r#r#r#r$�<module>s, 
+)

	&zipapp.cpython-36.opt-2.pyc000064400000010410150335715140011435 0ustar003


 \��@s�ddlZddlZddlZddlZddlZddlZddlZdddgZdZej	j
d�rXdZnej�ZGdd�de
�Zejd	d
��Zdd�Zdd
d�Zddd�Zdd�Zddd�Zedkr�e�dS)�N�ZipAppError�create_archive�get_interpreterz8# -*- coding: utf-8 -*-
import {module}
{module}.{fn}()
�winzutf-8c@seZdZdS)rN)�__name__�
__module__�__qualname__�r	r	�/usr/lib64/python3.6/zipapp.pyr!sc	csFt|tj�rt|�}t|t�r<t||��}|VWdQRXn|VdS)N)�
isinstance�pathlib�Path�str�open)�archive�mode�fr	r	r
�_maybe_open%s
rcCs$|r d|jt�d}|j|�dS)Ns#!�
)�encode�shebang_encoding�write)r�interpreterZshebangr	r	r
�_write_file_prefix0srcCs�t|d��Z}|jd�}|dkr*d}|j�t|d��&}t||�|j|�tj||�WdQRXWdQRX|r�t|t�r�t	j
|t	j|�jtj
B�dS)N�rb�s#!��wb)r�read�readlinerr�shutilZcopyfileobjrr�os�chmod�stat�st_mode�S_IEXEC)rZnew_archiver�srcZfirst_2�dstr	r	r
�
_copy_archive7s


 r(cCs�d}t|d�rt|d�rd}ntj|�}|j�r4d}|rHt|||�dS|j�sXtd��|dj�}|rt|rttd��|pz|s�td��d}|r�|jd	�\}}}	td
d�|j	d�D��}
td
d�|	j	d�D��}|d	ko�|
o�|s�td|��t
j||	d�}|dk�r|jd�}nt|d��s"tj|�}t
|d��~}t||�tj|d��\}
tj|�}x2|jd�D]$}t|j|��}|
jt|�|��q\W|�r�|
jd|jd��WdQRXWdQRX|�r�t|d��r�|j|j�jtjB�dS)NFrrTzSource does not existz__main__.pyz8Cannot specify entry point if the source has __main__.pyzArchive has no entry point�:css|]}|j�VqdS)N)�isidentifier)�.0�partr	r	r
�	<genexpr>|sz!create_archive.<locals>.<genexpr>�.css|]}|j�VqdS)N)r*)r+r,r	r	r
r-}szInvalid entry point: )�module�fnz.pyzrr�w�*zutf-8)�hasattrrr
�is_filer(�existsr�	partition�all�split�
MAIN_TEMPLATE�formatZwith_suffixrr�zipfileZZipFileZrglobrZrelative_torZwritestrrr"r#r$r%)�source�targetr�mainZsource_is_fileZhas_mainZmain_py�mod�sepr0Zmod_okZfn_ok�fd�z�rootZchildZarcnamer	r	r
rNsP




&c	Cs:t|d��&}|jd�dkr,|j�j�jt�SWdQRXdS)Nrrs#!)rrr�strip�decoder)rrr	r	r
r�scCs ddl}|j�}|jddddd�|jddddd�|jd	d
ddd�|jdd
ddd�|jddd�|j|�}|jr�tjj|j�s�t	d��t
|j�}tdj|p�d��t
jd�tjj|j��r|jdks�tjj|j�r�tjj|j|j�r�t	d��|j�rt	d��t|j|j|j|jd�dS)Nrz--outputz-ozAThe name of the output archive. Required if SOURCE is an archive.)�default�helpz--pythonz-pzEThe name of the Python interpreter to use (default: no shebang line).z--mainz-mzLThe main function of the application (default: use an existing __main__.py).z--infoF�
store_truez)Display the interpreter from the archive.)rF�actionrGr<z'Source directory (or existing archive).)rGz%Can only get info for an archive filezInterpreter: {}z<none>z-In-place editing of archives is not supportedz,Cannot change the main function when copying)rr>)�argparse�ArgumentParser�add_argument�
parse_args�infor!�path�isfiler<�
SystemExitr�printr:�sys�exit�outputr5�samefiler>r�python)�argsrJ�parserrr	r	r
r>�s6







r>�__main__)N)NNN)N)�
contextlibr!rr r#rSr;�__all__r9�platform�
startswithr�getfilesystemencoding�
ValueErrorr�contextmanagerrrr(rrr>rr	r	r	r
�<module>s(


G
-macpath.cpython-36.opt-2.pyc000064400000010431150335715140011552 0ustar003


 \S� @s.dZdZdZdZdZdZdZdZddlZddl	Tddl
Z
ddl
Tdd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'g Zd(d)�Zd*d�Z
d+d	�Zd,d
�Zd-d�Zd.d
�Ze
jje_d/d�Zd0d�Zd1d�Zd2d3�Zd4d�Zd5d�Zd6d�Zd7d�ZGd8d9�d9e�Zd:d�Zd;d�Zd<d&�Z d=Z!dS)>�:z::�.�
NzDev:Null�)�*�normcase�isabs�join�
splitdrive�split�splitext�basename�dirname�commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�
expanduser�
expandvars�normpath�abspath�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenamescCst|t�rdSdSdS)N�:r)�
isinstance�bytes)�path�r*�/usr/lib64/python3.6/macpath.py�
_get_colons
r,cCs(t|ttf�s tdj|jj���|j�S)Nz2normcase() argument must be str or bytes, not '{}')r'r(�str�	TypeError�format�	__class__�__name__�lower)r)r*r*r+r#scCs t|�}||ko|dd�|kS)N�)r,)�s�colonr*r*r+r*sc
Gs�y�t|�}|}|s"|dd�|xl|D]d}|s:t|�r@|}q(|dd�|kr\|dd�}||krl||}|dd�|kr�||}||}q(W|Stttfk
r�tjd|f|���YnXdS)Nrr3r���)r,rr.�AttributeError�BytesWarning�genericpath�_check_arg_types)r4�pr5r)�tr*r*r+r5s(
cCs�t|�}||kr |dd�|fSd}x0tt|��D] }|||d�|kr2|d}q2W|d|d�||d�}}|r�||kr�||}||fS)Nrr3)r,�range�len)r4r5�col�ir)�filer*r*r+r
LscCs.t|t�rtj|dtd�Stj|ttt�SdS)Nr&�.)r'r(r9�	_splitextr!rr")r;r*r*r+r\s
cCs|dd�|fS)Nrr*)r;r*r*r+r	cscCst|�dS)Nr)r
)r4r*r*r+r
oscCst|�dS)Nr3)r
)r4r*r*r+rpscCs*t|�sdSt|�}t|�dko(|dS)NF�r3)rr
r>)r4�
componentsr*r*r+�ismountrsrFc	Cs*yddl}|jj|d�dSdSdS)NrrDF)�Carbon.File�FileZResolveAliasFile)r4�Carbonr*r*r+rxs
cCs(ytj|�}Wntk
r"dSXdS)NFT)�os�lstat�OSError)r)�str*r*r+r�s
cCs|S)Nr*)r)r*r*r+r�scCs|S)Nr*)r)r*r*r+r�sc@seZdZdS)�
norm_errorN)r1�
__module__�__qualname__r*r*r*r+rN�srNcCs�t|�}||kr||S|j|�}d}x`|t|�dkr�||r|||dr||dkrr||d|d�=|d}q�td��q(|d}q(W|j|�}|dd�|kr�t|�dkr�||t|�kr�|dd�}|S)Nr3z+Cannot use :: immediately after volume namerDr6r6)r,r
r>rNr)r4r5�compsr@r*r*r+r�s 



,cCs6t|�s.t|t�rtj�}ntj�}t||�}t|�S)N)rr'r(rJ�getcwdb�getcwdrr)r)�cwdr*r*r+r�s


cCs�t|�}yddl}Wntk
r(|SX|s2|St|�}|j|�}|d|}xR|dd�D]B}t||�}y|jj|d�dj�}Wq^|jj	k
r�Yq^Xq^W|S)Nrr3)
rrG�ImportErrorr,r
rrHZFSResolveAliasFileZas_pathname�Error)r)rIr5rE�cr*r*r+r$�s"


T)"rrr"rrr r!r#rJ�statr9�__all__r,rrrr
rrC�__doc__r	r
rrFrrrr�	ExceptionrNrrr$r%r*r*r*r+�<module>sJ


	ipaddress.cpython-36.opt-1.pyc000064400000177050150335715140012125 0ustar003

�\dh�/�@s�dZdZddlZdZdZGdd�de�ZGdd	�d	e�Zd
d�Zd=d
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�ZGd#d$�d$�ZejGd%d&�d&e��ZejGd'd(�d(e��ZGd)d*�d*�ZGd+d,�d,ee�ZGd-d.�d.e�ZGd/d0�d0ee�ZGd1d2�d2�Zee_Gd3d4�d4�ZGd5d6�d6ee�ZGd7d8�d8e�Z Gd9d:�d:ee�Z!Gd;d<�d<�Z"e"e_dS)>z�A fast, lightweight IPv4/IPv6 manipulation library in Python.

This library is used to create/poke/manipulate IPv4 and IPv6 addresses
and networks.

z1.0�N� �c@seZdZdZdS)�AddressValueErrorz%A Value Error related to the address.N)�__name__�
__module__�__qualname__�__doc__�r	r	�!/usr/lib64/python3.6/ipaddress.pyrsrc@seZdZdZdS)�NetmaskValueErrorz%A Value Error related to the netmask.N)rrrrr	r	r	r
rsrcCsTyt|�Sttfk
r YnXyt|�Sttfk
rBYnXtd|��dS)a�Take an IP string/int and return an object of the correct type.

    Args:
        address: A string or integer, the IP address.  Either IPv4 or
          IPv6 addresses may be supplied; integers less than 2**32 will
          be considered to be IPv4 by default.

    Returns:
        An IPv4Address or IPv6Address object.

    Raises:
        ValueError: if the *address* passed isn't either a v4 or a v6
          address

    z0%r does not appear to be an IPv4 or IPv6 addressN)�IPv4Addressrr�IPv6Address�
ValueError)�addressr	r	r
�
ip_addresssrTcCsXy
t||�Sttfk
r"YnXy
t||�Sttfk
rFYnXtd|��dS)a�Take an IP string/int and return an object of the correct type.

    Args:
        address: A string or integer, the IP network.  Either IPv4 or
          IPv6 networks may be supplied; integers less than 2**32 will
          be considered to be IPv4 by default.

    Returns:
        An IPv4Network or IPv6Network object.

    Raises:
        ValueError: if the string passed isn't either a v4 or a v6
          address. Or if the network has host bits set.

    z0%r does not appear to be an IPv4 or IPv6 networkN)�IPv4Networkrr�IPv6Networkr)r�strictr	r	r
�
ip_network9s

rcCsTyt|�Sttfk
r YnXyt|�Sttfk
rBYnXtd|��dS)agTake an IP string/int and return an object of the correct type.

    Args:
        address: A string or integer, the IP address.  Either IPv4 or
          IPv6 addresses may be supplied; integers less than 2**32 will
          be considered to be IPv4 by default.

    Returns:
        An IPv4Interface or IPv6Interface object.

    Raises:
        ValueError: if the string passed isn't either a v4 or a v6
          address.

    Notes:
        The IPv?Interface classes describe an Address on a particular
        Network, so they're basically a combination of both the Address
        and Network classes.

    z2%r does not appear to be an IPv4 or IPv6 interfaceN)�
IPv4Interfacerr�
IPv6Interfacer)rr	r	r
�ip_interfaceWsrcCs.y|jdd�Stk
r(td��YnXdS)a`Represent an address as 4 packed bytes in network (big-endian) order.

    Args:
        address: An integer representation of an IPv4 IP address.

    Returns:
        The integer address packed as 4 bytes in network (big-endian) order.

    Raises:
        ValueError: If the integer is negative or too large to be an
          IPv4 IP address.

    ��bigz&Address negative or too large for IPv4N)�to_bytes�
OverflowErrorr)rr	r	r
�v4_int_to_packedzsrcCs.y|jdd�Stk
r(td��YnXdS)z�Represent an address as 16 packed bytes in network (big-endian) order.

    Args:
        address: An integer representation of an IPv6 IP address.

    Returns:
        The integer address packed as 16 bytes in network (big-endian) order.

    �rz&Address negative or too large for IPv6N)rrr)rr	r	r
�v6_int_to_packed�s
rcCs*t|�jd�}t|�dkr&td|��|S)zAHelper to split the netmask and raise AddressValueError if needed�/�zOnly one '/' permitted in %r)�str�split�lenr)r�addrr	r	r
�_split_optional_netmask�sr%ccsRt|�}t|�}}x.|D]&}|j|jdkr<||fV|}|}qW||fVdS)z�Find a sequence of sorted deduplicated IPv#Address.

    Args:
        addresses: a list of IPv#Address objects.

    Yields:
        A tuple containing the first and last IP addresses in the sequence.

    �N)�iter�next�_ip)�	addresses�it�first�last�ipr	r	r
�_find_address_range�s


r/cCs$|dkr|St|||d@j��S)z�Count the number of zero bits on the right hand side.

    Args:
        number: an integer.
        bits: maximum number of bits to count.

    Returns:
        The number of zero bits on the right hand side of the number.

    rr&)�min�
bit_length)Znumber�bitsr	r	r
�_count_righthand_zero_bits�sr3ccs�t|t�ot|t�std��|j|jkr8td||f��||krHtd��|jdkrXt}n|jdkrht}ntd��|j}|j}|j}x^||kr�t	t
||�||dj�d�}||||f�}|V|d|>7}|d|jkr�Pq�WdS)	a�Summarize a network range given the first and last IP addresses.

    Example:
        >>> list(summarize_address_range(IPv4Address('192.0.2.0'),
        ...                              IPv4Address('192.0.2.130')))
        ...                                #doctest: +NORMALIZE_WHITESPACE
        [IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/31'),
         IPv4Network('192.0.2.130/32')]

    Args:
        first: the first IPv4Address or IPv6Address in the range.
        last: the last IPv4Address or IPv6Address in the range.

    Returns:
        An iterator of the summarized IPv(4|6) network objects.

    Raise:
        TypeError:
            If the first and last objects are not IP addresses.
            If the first and last objects are not the same version.
        ValueError:
            If the last object is not greater than the first.
            If the version of the first address is not 4 or 6.

    z1first and last must be IP addresses, not networksz%%s and %s are not of the same versionz*last IP address must be greater than firstr�zunknown IP versionr&N)
�
isinstance�_BaseAddress�	TypeError�versionrrr�_max_prefixlenr)r0r3r1�	_ALL_ONES)r,r-r.Zip_bitsZ	first_intZlast_intZnbits�netr	r	r
�summarize_address_range�s0





r<ccs�t|�}i}xL|rX|j�}|j�}|j|�}|dkr>|||<q||kr||=|j|�qWd}x4t|j��D]$}|dk	r�|j|jkr�ql|V|}qlWdS)auLoops through the addresses, collapsing concurrent netblocks.

    Example:

        ip1 = IPv4Network('192.0.2.0/26')
        ip2 = IPv4Network('192.0.2.64/26')
        ip3 = IPv4Network('192.0.2.128/26')
        ip4 = IPv4Network('192.0.2.192/26')

        _collapse_addresses_internal([ip1, ip2, ip3, ip4]) ->
          [IPv4Network('192.0.2.0/24')]

        This shouldn't be called directly; it is called via
          collapse_addresses([]).

    Args:
        addresses: A list of IPv4Network's or IPv6Network's

    Returns:
        A list of IPv4Network's or IPv6Network's depending on what we were
        passed.

    N)�list�pop�supernet�get�append�sorted�values�broadcast_address)r*Zto_merge�subnetsr;r?Zexistingr-r	r	r
�_collapse_addresses_internals$

rFcCs8g}g}g}x�|D]�}t|t�rT|rH|dj|jkrHtd||df��|j|�q|j|jkr�|r�|dj|jkr�td||df��y|j|j�Wq�tk
r�|j|j	�Yq�Xq|r�|dj|jkr�td||df��|j|�qWt
t|��}|�r,x&t|�D]\}}|j
t||���qWt||�S)	a�Collapse a list of IP objects.

    Example:
        collapse_addresses([IPv4Network('192.0.2.0/25'),
                            IPv4Network('192.0.2.128/25')]) ->
                           [IPv4Network('192.0.2.0/24')]

    Args:
        addresses: An iterator of IPv4Network or IPv6Network objects.

    Returns:
        An iterator of the collapsed IPv(4|6)Network objects.

    Raises:
        TypeError: If passed a list of mixed version objects.

    r&z%%s and %s are not of the same version���rGrGrGrGrG)r5r6�_versionr7rA�
_prefixlenr9r.�AttributeError�network_addressrB�setr/�extendr<rF)r*ZaddrsZipsZnetsr.r,r-r	r	r
�collapse_addresses2s4

rNcCs(t|t�r|j�St|t�r$|j�StS)a2Return a key suitable for sorting between networks and addresses.

    Address and Network objects are not sortable by default; they're
    fundamentally different so the expression

        IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24')

    doesn't make any sense.  There are some times however, where you may wish
    to have ipaddress sort these for you anyway. If you need to do this, you
    can use this function as the key= argument to sorted().

    Args:
      obj: either a Network or Address object.
    Returns:
      appropriate key.

    )r5�_BaseNetwork�_get_networks_keyr6�_get_address_key�NotImplemented)�objr	r	r
�get_mixed_type_keyhs


rTc@s�eZdZdZfZedd��Zedd��Zedd��Zedd	��Z	d
d�Z
dd
�Zedd��Z
edd��Zedd��Zedd��Zedd��Zdd�ZdS)�_IPAddressBasezThe mother class.cCs|j�S)z:Return the longhand version of the IP address as a string.)�_explode_shorthand_ip_string)�selfr	r	r
�exploded�sz_IPAddressBase.explodedcCst|�S)z;Return the shorthand version of the IP address as a string.)r!)rWr	r	r
�
compressed�sz_IPAddressBase.compressedcCs|j�S)aIThe name of the reverse DNS pointer for the IP address, e.g.:
            >>> ipaddress.ip_address("127.0.0.1").reverse_pointer
            '1.0.0.127.in-addr.arpa'
            >>> ipaddress.ip_address("2001:db8::1").reverse_pointer
            '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa'

        )�_reverse_pointer)rWr	r	r
�reverse_pointer�s	z_IPAddressBase.reverse_pointercCsdt|�f}t|��dS)Nz%200s has no version specified)�type�NotImplementedError)rW�msgr	r	r
r8�sz_IPAddressBase.versioncCsF|dkrd}t|||jf��||jkrBd}t|||j|jf��dS)Nrz-%d (< 0) is not permitted as an IPv%d addressz2%d (>= 2**%d) is not permitted as an IPv%d address)rrHr:r9)rWrr^r	r	r
�_check_int_address�s

z!_IPAddressBase._check_int_addresscCs.t|�}||kr*d}t|||||jf��dS)Nz6%r (len %d != %d) is not permitted as an IPv%d address)r#rrH)rWrZexpected_lenZaddress_lenr^r	r	r
�_check_packed_address�s
z$_IPAddressBase._check_packed_addresscCs|j|j|?AS)z�Turn the prefix length into a bitwise netmask

        Args:
            prefixlen: An integer, the prefix length.

        Returns:
            An integer.

        )r:)�cls�	prefixlenr	r	r
�_ip_int_from_prefix�sz"_IPAddressBase._ip_int_from_prefixc	Cs\t||j�}|j|}||?}d|>d}||krX|jd}|j|d�}d}t||��|S)aReturn prefix length from the bitwise netmask.

        Args:
            ip_int: An integer, the netmask in expanded bitwise format

        Returns:
            An integer, the prefix length.

        Raises:
            ValueError: If the input intermingles zeroes & ones
        r&�rz&Netmask pattern %r mixes zeroes & ones)r3r9rr)	ra�ip_intZtrailing_zeroesrbZleading_onesZall_onesZbyteslenZdetailsr^r	r	r
�_prefix_from_ip_int�s


z"_IPAddressBase._prefix_from_ip_intcCsd|}t|�d�dS)Nz%r is not a valid netmask)r)raZnetmask_strr^r	r	r
�_report_invalid_netmask�sz&_IPAddressBase._report_invalid_netmaskcCsjtjj|�s|j|�yt|�}Wntk
r@|j|�YnXd|koV|jknsf|j|�|S)a	Return prefix length from a numeric string

        Args:
            prefixlen_str: The string to be converted

        Returns:
            An integer, the prefix length.

        Raises:
            NetmaskValueError: If the input is not a valid netmask
        r)�_BaseV4�_DECIMAL_DIGITS�
issupersetrg�intrr9)raZ
prefixlen_strrbr	r	r
�_prefix_from_prefix_string�s

z)_IPAddressBase._prefix_from_prefix_stringcCs�y|j|�}Wntk
r,|j|�YnXy
|j|�Stk
rLYnX||jN}y
|j|�Stk
r�|j|�YnXdS)aTurn a netmask/hostmask string into a prefix length

        Args:
            ip_str: The netmask/hostmask to be converted

        Returns:
            An integer, the prefix length.

        Raises:
            NetmaskValueError: If the input is not a valid netmask/hostmask
        N)�_ip_int_from_stringrrgrfrr:)ra�ip_strrer	r	r
�_prefix_from_ip_string�s


z%_IPAddressBase._prefix_from_ip_stringcCs|jt|�ffS)N)�	__class__r!)rWr	r	r
�
__reduce__sz_IPAddressBase.__reduce__N)rrrr�	__slots__�propertyrXrYr[r8r_r`�classmethodrcrfrgrlrorqr	r	r	r
rU�s	
"rUc@sdeZdZdZfZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�ZdS)r6z�A generic IP object.

    This IP class contains the version independent methods which are
    used by single IP addresses.
    cCs|jS)N)r))rWr	r	r
�__int__&sz_BaseAddress.__int__cCs2y|j|jko|j|jkStk
r,tSXdS)N)r)rHrJrR)rW�otherr	r	r
�__eq__)s
z_BaseAddress.__eq__cCsFt|t�stS|j|jkr*td||f��|j|jkrB|j|jkSdS)Nz%%s and %s are not of the same versionF)r5r6rRrHr7r))rWrvr	r	r
�__lt__0s
z_BaseAddress.__lt__cCs t|t�stS|jt|�|�S)N)r5rkrRrp)rWrvr	r	r
�__add__<s
z_BaseAddress.__add__cCs t|t�stS|jt|�|�S)N)r5rkrRrp)rWrvr	r	r
�__sub__As
z_BaseAddress.__sub__cCsd|jjt|�fS)Nz%s(%r))rprr!)rWr	r	r
�__repr__Fsz_BaseAddress.__repr__cCst|j|j��S)N)r!�_string_from_ip_intr))rWr	r	r
�__str__Isz_BaseAddress.__str__cCsttt|j���S)N)�hash�hexrkr))rWr	r	r
�__hash__Lsz_BaseAddress.__hash__cCs
|j|fS)N)rH)rWr	r	r
rQOsz_BaseAddress._get_address_keycCs|j|jffS)N)rpr))rWr	r	r
rqRsz_BaseAddress.__reduce__N)rrrrrrrurwrxryrzr{r}r�rQrqr	r	r	r
r6sr6c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zedd��Zedd��Zedd��Zedd��Zed d!��Zed"d#��Zed$d%��Zed&d'��Zd(d)�Zd*d+�Zd,d-�ZdBd0d1�ZdCd2d3�Zed4d5��Zed6d7��Zed8d9��Zed:d;��Z ed<d=��Z!ed>d?��Z"ed@dA��Z#d/S)DrOz~A generic IP network object.

    This IP class contains the version independent methods which are
    used by networks.

    cCs
i|_dS)N)�_cache)rWrr	r	r
�__init___sz_BaseNetwork.__init__cCsd|jjt|�fS)Nz%s(%r))rprr!)rWr	r	r
r{bsz_BaseNetwork.__repr__cCsd|j|jfS)Nz%s/%d)rKrb)rWr	r	r
r}esz_BaseNetwork.__str__ccs<t|j�}t|j�}x"t|d|�D]}|j|�Vq$WdS)z�Generate Iterator over usable hosts in a network.

        This is like __iter__ except it doesn't return the network
        or broadcast addresses.

        r&N)rkrKrD�range�_address_class)rW�network�	broadcast�xr	r	r
�hostshs

z_BaseNetwork.hostsccs<t|j�}t|j�}x"t||d�D]}|j|�Vq$WdS)Nr&)rkrKrDr�r�)rWr�r�r�r	r	r
�__iter__ts

z_BaseNetwork.__iter__cCslt|j�}t|j�}|dkr>|||kr0td��|j||�S|d7}|||krZtd��|j||�SdS)Nrzaddress out of ranger&)rkrKrD�
IndexErrorr�)rW�nr�r�r	r	r
�__getitem__zs

z_BaseNetwork.__getitem__cCs^t|t�stS|j|jkr*td||f��|j|jkrB|j|jkS|j|jkrZ|j|jkSdS)Nz%%s and %s are not of the same versionF)r5rOrRrHr7rK�netmask)rWrvr	r	r
rx�s
z_BaseNetwork.__lt__cCsFy,|j|jko,|j|jko,t|j�t|j�kStk
r@tSXdS)N)rHrKrkr�rJrR)rWrvr	r	r
rw�sz_BaseNetwork.__eq__cCstt|j�t|j�A�S)N)r~rkrKr�)rWr	r	r
r��sz_BaseNetwork.__hash__cCsL|j|jkrdSt|t�rdSt|j�t|j�koBt|j�kSSdS)NF)rHr5rOrkrKr)rD)rWrvr	r	r
�__contains__�s
z_BaseNetwork.__contains__cCs(|j|kp&|j|kp&|j|kp&|j|kS)z*Tell if self is partly contained in other.)rKrD)rWrvr	r	r
�overlaps�s


z_BaseNetwork.overlapscCs<|jjd�}|dkr8|jt|j�t|j�B�}||jd<|S)NrD)r�r@r�rkrK�hostmask)rWr�r	r	r
rD�s
z_BaseNetwork.broadcast_addresscCs8|jjd�}|dkr4|jt|j�|jA�}||jd<|S)Nr�)r�r@r�rkr�r:)rWr�r	r	r
r��s

z_BaseNetwork.hostmaskcCsd|j|jfS)Nz%s/%d)rKrI)rWr	r	r
�with_prefixlen�sz_BaseNetwork.with_prefixlencCsd|j|jfS)Nz%s/%s)rKr�)rWr	r	r
�with_netmask�sz_BaseNetwork.with_netmaskcCsd|j|jfS)Nz%s/%s)rKr�)rWr	r	r
�
with_hostmask�sz_BaseNetwork.with_hostmaskcCst|j�t|j�dS)z&Number of hosts in the current subnet.r&)rkrDrK)rWr	r	r
�
num_addresses�sz_BaseNetwork.num_addressescCsdt|�f}t|��dS)Nz%%200s has no associated address class)r\r])rWr^r	r	r
r��sz_BaseNetwork._address_classcCs|jS)N)rI)rWr	r	r
rb�sz_BaseNetwork.prefixlenccsD|j|jkstd||f��t|t�s2td|��|j|jkoH|j|jksZtd||f��||krfdS|jd|j|jf�}|j	�\}}x�||ko�||k�r|j|jkr�|j|jkr�|V|j	�\}}q�|j|jkr�|j|jkr�|V|j	�\}}q�t
d|||f��q�W||k�r|Vn$||k�r.|Vnt
d|||f��dS)a�Remove an address from a larger block.

        For example:

            addr1 = ip_network('192.0.2.0/28')
            addr2 = ip_network('192.0.2.1/32')
            list(addr1.address_exclude(addr2)) =
                [IPv4Network('192.0.2.0/32'), IPv4Network('192.0.2.2/31'),
                 IPv4Network('192.0.2.4/30'), IPv4Network('192.0.2.8/29')]

        or IPv6:

            addr1 = ip_network('2001:db8::1/32')
            addr2 = ip_network('2001:db8::1/128')
            list(addr1.address_exclude(addr2)) =
                [ip_network('2001:db8::1/128'),
                 ip_network('2001:db8::2/127'),
                 ip_network('2001:db8::4/126'),
                 ip_network('2001:db8::8/125'),
                 ...
                 ip_network('2001:db8:8000::/33')]

        Args:
            other: An IPv4Network or IPv6Network object of the same type.

        Returns:
            An iterator of the IPv(4|6)Network objects which is self
            minus other.

        Raises:
            TypeError: If self and other are of differing address
              versions, or if other is not a network object.
            ValueError: If other is not completely contained by self.

        z%%s and %s are not of the same versionz%s is not a network objectz%s not contained in %sNz%s/%sz3Error performing exclusion: s1: %s s2: %s other: %s)rHr7r5rOrKrDrrprbrE�AssertionError)rWrv�s1�s2r	r	r
�address_exclude�s<$



z_BaseNetwork.address_excludecCs`|j|jkrtd||f��|j|jkr,dS|j|jkr<dS|j|jkrLdS|j|jkr\dSdS)a�Compare two IP objects.

        This is only concerned about the comparison of the integer
        representation of the network addresses.  This means that the
        host bits aren't considered at all in this method.  If you want
        to compare host bits, you can easily enough do a
        'HostA._ip < HostB._ip'

        Args:
            other: An IP object.

        Returns:
            If the IP versions of self and other are the same, returns:

            -1 if self < other:
              eg: IPv4Network('192.0.2.0/25') < IPv4Network('192.0.2.128/25')
              IPv6Network('2001:db8::1000/124') <
                  IPv6Network('2001:db8::2000/124')
            0 if self == other
              eg: IPv4Network('192.0.2.0/24') == IPv4Network('192.0.2.0/24')
              IPv6Network('2001:db8::1000/124') ==
                  IPv6Network('2001:db8::1000/124')
            1 if self > other
              eg: IPv4Network('192.0.2.128/25') > IPv4Network('192.0.2.0/25')
                  IPv6Network('2001:db8::2000/124') >
                      IPv6Network('2001:db8::1000/124')

          Raises:
              TypeError if the IP versions are different.

        z"%s and %s are not of the same typer&rrGrG)rHr7rKr�)rWrvr	r	r
�compare_networks.s!z_BaseNetwork.compare_networkscCs|j|j|jfS)z�Network-only key function.

        Returns an object that identifies this address' network and
        netmask. This function is a suitable "key" argument for sorted()
        and list.sort().

        )rHrKr�)rWr	r	r
rP^sz_BaseNetwork._get_networks_keyr&Nc	cs�|j|jkr|VdS|dk	rJ||jkr0td��|dkr@td��||j}|dkrZtd��|j|}||jkr~td||f��t|j�}t|j�d}t|j�d|?}x(t|||�D]}|j||f�}|Vq�WdS)a�The subnets which join to make the current subnet.

        In the case that self contains only one IP
        (self._prefixlen == 32 for IPv4 or self._prefixlen == 128
        for IPv6), yield an iterator with just ourself.

        Args:
            prefixlen_diff: An integer, the amount the prefix length
              should be increased by. This should not be set if
              new_prefix is also set.
            new_prefix: The desired new prefix length. This must be a
              larger number (smaller prefix) than the existing prefix.
              This should not be set if prefixlen_diff is also set.

        Returns:
            An iterator of IPv(4|6) objects.

        Raises:
            ValueError: The prefixlen_diff is too small or too large.
                OR
            prefixlen_diff and new_prefix are both set or new_prefix
              is a smaller number than the current prefix (smaller
              number means a larger network)

        Nznew prefix must be longerr&z(cannot set prefixlen_diff and new_prefixrzprefix length diff must be > 0z0prefix length diff %d is invalid for netblock %s)	rIr9rrkrKrDr�r�rp)	rW�prefixlen_diff�
new_prefix�
new_prefixlen�start�end�stepZnew_addrZcurrentr	r	r
rEhs,




z_BaseNetwork.subnetscCs�|jdkr|S|dk	rB||jkr(td��|dkr8td��|j|}|j|}|dkrftd|j|f��|jt|j�t|j�|>@|f�S)a�The supernet containing the current network.

        Args:
            prefixlen_diff: An integer, the amount the prefix length of
              the network should be decreased by.  For example, given a
              /24 network and a prefixlen_diff of 3, a supernet with a
              /21 netmask is returned.

        Returns:
            An IPv4 network object.

        Raises:
            ValueError: If self.prefixlen - prefixlen_diff < 0. I.e., you have
              a negative prefix length.
                OR
            If prefixlen_diff and new_prefix are both set or new_prefix is a
              larger number than the current prefix (larger number means a
              smaller network)

        rNznew prefix must be shorterr&z(cannot set prefixlen_diff and new_prefixz;current prefixlen is %d, cannot have a prefixlen_diff of %d)rIrrbrprkrKr�)rWr�r�r�r	r	r
r?�s 



z_BaseNetwork.supernetcCs|jjo|jjS)z�Test if the address is reserved for multicast use.

        Returns:
            A boolean, True if the address is a multicast address.
            See RFC 2373 2.7 for details.

        )rK�is_multicastrD)rWr	r	r
r��s	z_BaseNetwork.is_multicastcCs|jjo|jjS)z�Test if the address is otherwise IETF reserved.

        Returns:
            A boolean, True if the address is within one of the
            reserved IPv6 Network ranges.

        )rK�is_reservedrD)rWr	r	r
r��s	z_BaseNetwork.is_reservedcCs|jjo|jjS)z�Test if the address is reserved for link-local.

        Returns:
            A boolean, True if the address is reserved per RFC 4291.

        )rK�
is_link_localrD)rWr	r	r
r��sz_BaseNetwork.is_link_localcCs|jjo|jjS)z�Test if this address is allocated for private networks.

        Returns:
            A boolean, True if the address is reserved per
            iana-ipv4-special-registry or iana-ipv6-special-registry.

        )rK�
is_privaterD)rWr	r	r
r��s	z_BaseNetwork.is_privatecCs|jS)z�Test if this address is allocated for public networks.

        Returns:
            A boolean, True if the address is not reserved per
            iana-ipv4-special-registry or iana-ipv6-special-registry.

        )r�)rWr	r	r
�	is_global�s	z_BaseNetwork.is_globalcCs|jjo|jjS)z�Test if the address is unspecified.

        Returns:
            A boolean, True if this is the unspecified address as defined in
            RFC 2373 2.5.2.

        )rK�is_unspecifiedrD)rWr	r	r
r�s	z_BaseNetwork.is_unspecifiedcCs|jjo|jjS)z�Test if the address is a loopback address.

        Returns:
            A boolean, True if the address is a loopback address as defined in
            RFC 2373 2.5.3.

        )rK�is_loopbackrD)rWr	r	r
r�s	z_BaseNetwork.is_loopback)r&N)r&N)$rrrrr�r{r}r�r�r�rxrwr�r�r�rsrDr�r�r�r�r�r�rbr�r�rPrEr?r�r�r�r�r�r�r�r	r	r	r
rOVs@

	N0

5
)rOc
@s�eZdZdZfZdZdedZed�Z	edddd	d
ddd
dh	�Z
eZiZdd�Z
edd��Zedd��Zedd��Zedd��Zdd�Zdd�Zdd�Zedd ��Zed!d"��Zd#S)$rhzyBase IPv4 object.

    The following methods are used by IPv4 objects in both single IP
    addresses and networks.

    rr r&�
0123456789���������rrcCst|�S)N)r!)rWr	r	r
rV0sz$_BaseV4._explode_shorthand_ip_stringcCsn||jkrdt|t�r|}n.y|j|�}Wntk
rF|j|�}YnXt|j|��}||f|j|<|j|S)aMake a (netmask, prefix_len) tuple from the given argument.

        Argument can be:
        - an integer (the prefix length)
        - a string representing the prefix length (e.g. "24")
        - a string representing the prefix netmask (e.g. "255.255.255.0")
        )�_netmask_cacher5rkrlrrorrc)ra�argrbr�r	r	r
�
_make_netmask3s	

z_BaseV4._make_netmaskcCs||std��|jd�}t|�dkr.td|��ytjt|j|�d�Stk
rv}ztd||f�d�WYdd}~XnXdS)aTurn the given IP string into an integer for comparison.

        Args:
            ip_str: A string, the IP ip_str.

        Returns:
            The IP ip_str as an integer.

        Raises:
            AddressValueError: if ip_str isn't a valid IPv4 Address.

        zAddress cannot be empty�.rzExpected 4 octets in %rrz%s in %rN)rr"r#rk�
from_bytes�map�_parse_octetr)rarnZoctets�excr	r	r
rmKs
z_BaseV4._ip_int_from_stringcCs�|std��|jj|�s(d}t||��t|�dkrDd}t||��t|d�}|dkrr|ddkrrd	}t||��|d
kr�td|��|S)aConvert a decimal octet into an integer.

        Args:
            octet_str: A string, the number to parse.

        Returns:
            The octet as an integer.

        Raises:
            ValueError: if the octet isn't strictly a decimal from [0..255].

        zEmpty octet not permittedz#Only decimal digits permitted in %r�z$At most 3 characters permitted in %r�
�r�0z3Ambiguous (octal/decimal) value in %r not permittedr�zOctet %d (> 255) not permitted)rrirjr#rk)raZ	octet_strr^Z	octet_intr	r	r
r�es
z_BaseV4._parse_octetcCsdjtt|jdd���S)z�Turns a 32-bit integer into dotted decimal notation.

        Args:
            ip_int: An integer, the IP address.

        Returns:
            The IP address as a string in dotted decimal notation.

        r�rr)�joinr�r!r)rarer	r	r
r|�sz_BaseV4._string_from_ip_intcCs�|jd�}t|�dkr�y$x|D]}t|�|jkrdSqWWntk
rNdSXx0t|�D]$\}}|dkrZ|||dkrZdSqZWdSyt|�}Wntk
r�dSXd|ko�|jkSS)z�Verify that the netmask is valid.

        Args:
            netmask: A string, either a prefix or dotted decimal
              netmask.

        Returns:
            A boolean, True if the prefix represents a valid IPv4
            netmask.

        r�rFrr&T)r"r#rk�_valid_mask_octetsr�	enumerater9)rWr��maskr��idx�yr	r	r
�_is_valid_netmask�s"

z_BaseV4._is_valid_netmaskcsh|jd�}y�fdd�tt|�D�}Wntk
r:dSXt|�t|�krPdS|d|dkrddSdS)	z�Test if the IP string is a hostmask (rather than a netmask).

        Args:
            ip_str: A string, the potential hostmask.

        Returns:
            A boolean, True if the IP string is a hostmask.

        r�csg|]}|�jkr|�qSr	)r�)�.0r�)rWr	r
�
<listcomp>�sz(_BaseV4._is_hostmask.<locals>.<listcomp>Frr&TrG)r"r�rkrr#)rWrnr2�partsr	)rWr
�_is_hostmask�s

z_BaseV4._is_hostmaskcCs&t|�jd�ddd�}dj|�dS)z�Return the reverse DNS pointer name for the IPv4 address.

        This implements the method described in RFC1035 3.5.

        r�Nr&z
.in-addr.arparG)r!r"r�)rWZreverse_octetsr	r	r
rZ�sz_BaseV4._reverse_pointercCs|jS)N)r9)rWr	r	r
�
max_prefixlen�sz_BaseV4.max_prefixlencCs|jS)N)rH)rWr	r	r
r8�sz_BaseV4.versionN)rrrrrrrH�
IPV4LENGTHr:�	frozensetrir�r9r�rVrtr�rmr�r|r�r�rZrsr�r8r	r	r	r
rhs$%
	rhc@s�eZdZdZdZdd�Zedd��Zedd	��Zee	j
�d
d���Zee	j
�dd
���Zedd��Z
edd��Zedd��Zedd��ZdS)rz/Represent and manipulate single IPv4 Addresses.r)�__weakref__cCsrt|t�r|j|�||_dSt|t�rF|j|d�tj|d�|_dSt|�}d|krbtd|��|j	|�|_dS)a�
        Args:
            address: A string or integer representing the IP

              Additionally, an integer can be passed, so
              IPv4Address('192.0.2.1') == IPv4Address(3221225985).
              or, more generally
              IPv4Address(int(IPv4Address('192.0.2.1'))) ==
                IPv4Address('192.0.2.1')

        Raises:
            AddressValueError: If ipaddress isn't a valid IPv4 address.

        NrrrzUnexpected '/' in %r)
r5rkr_r)�bytesr`r�r!rrm)rWr�addr_strr	r	r
r��s


zIPv4Address.__init__cCs
t|j�S)z*The binary representation of this address.)rr))rWr	r	r
�packedszIPv4Address.packedcCs||jjkS)z�Test if the address is otherwise IETF reserved.

         Returns:
             A boolean, True if the address is within the
             reserved IPv4 Network range.

        )�
_constants�_reserved_network)rWr	r	r
r�s	zIPv4Address.is_reservedcs4t�fdd��jjD��o2t�fdd��jjD��S)a�``True`` if the address is defined as not globally reachable by
        iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
        (for IPv6) with the following exceptions:

        * ``is_private`` is ``False`` for ``100.64.0.0/10``
        * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
            semantics of the underlying IPv4 addresses and the following condition holds
            (see :attr:`IPv6Address.ipv4_mapped`)::

                address.is_private == address.ipv4_mapped.is_private

        ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10``
        IPv4 range where they are both ``False``.
        c3s|]}�|kVqdS)Nr	)r�r;)rWr	r
�	<genexpr>(sz)IPv4Address.is_private.<locals>.<genexpr>c3s|]}�|kVqdS)Nr	)r�r;)rWr	r
r�)s)�anyr��_private_networks�all�_private_networks_exceptions)rWr	)rWr
r�szIPv4Address.is_privatecCs||jjko|jS)ar``True`` if the address is defined as globally reachable by
        iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
        (for IPv6) with the following exception:

        For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
        semantics of the underlying IPv4 addresses and the following condition holds
        (see :attr:`IPv6Address.ipv4_mapped`)::

            address.is_global == address.ipv4_mapped.is_global

        ``is_global`` has value opposite to :attr:`is_private`, except for the ``100.64.0.0/10``
        IPv4 range where they are both ``False``.
        )r��_public_networkr�)rWr	r	r
r�,szIPv4Address.is_globalcCs||jjkS)z�Test if the address is reserved for multicast use.

        Returns:
            A boolean, True if the address is multicast.
            See RFC 3171 for details.

        )r��_multicast_network)rWr	r	r
r�>s	zIPv4Address.is_multicastcCs||jjkS)z�Test if the address is unspecified.

        Returns:
            A boolean, True if this is the unspecified address as defined in
            RFC 5735 3.

        )r��_unspecified_address)rWr	r	r
r�Is	zIPv4Address.is_unspecifiedcCs||jjkS)z�Test if the address is a loopback address.

        Returns:
            A boolean, True if the address is a loopback per RFC 3330.

        )r��_loopback_network)rWr	r	r
r�TszIPv4Address.is_loopbackcCs||jjkS)z�Test if the address is reserved for link-local.

        Returns:
            A boolean, True if the address is link-local per RFC 3927.

        )r��_linklocal_network)rWr	r	r
r�^szIPv4Address.is_link_localN)r)r�)rrrrrrr�rsr�r��	functools�	lru_cacher�r�r�r�r�r�r	r	r	r
r�s#
rc@sjeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zej	Z	e
dd��Ze
d
d��Ze
dd��Z
e
dd��ZdS)rcCs�t|ttf�r2tj||�t|j�|_|j|_	dSt|t
�r�tj||d�t|�dkrht|d�|_	n|j|_	t|dd�|_|jj|_|jj
|_
dSt|�}tj||d�t|dd�|_|jj	|_	|jj|_|jj
|_
dS)Nrr&F)r)r5r�rkrr�rr)r�r9rI�tupler#r�r�r%)rWrr$r	r	r
r�ks(




zIPv4Interface.__init__cCsd|j|j�|jjfS)Nz%s/%d)r|r)r�rb)rWr	r	r
r}�szIPv4Interface.__str__cCsDtj||�}|s|tkr|Sy|j|jkStk
r>dSXdS)NF)rrwrRr�rJ)rWrv�
address_equalr	r	r
rw�szIPv4Interface.__eq__cCsNtj||�}|tkrtSy|j|jkp4|j|jko4|Stk
rHdSXdS)NF)rrxrRr�rJ)rWrv�address_lessr	r	r
rx�szIPv4Interface.__lt__cCst|j|jt|jj�f�S)N)r~r)rIrkr�rK)rWr	r	r
r��szIPv4Interface.__hash__cCs
t|j�S)N)rr))rWr	r	r
r.�szIPv4Interface.ipcCsd|j|j�|jfS)Nz%s/%s)r|r)rI)rWr	r	r
r��szIPv4Interface.with_prefixlencCsd|j|j�|jfS)Nz%s/%s)r|r)r�)rWr	r	r
r��szIPv4Interface.with_netmaskcCsd|j|j�|jfS)Nz%s/%s)r|r)r�)rWr	r	r
r��szIPv4Interface.with_hostmaskN)rrrr�r}rwrxr�rUrqrsr.r�r�r�r	r	r	r
risrc@s2eZdZdZeZddd�Zeej	�dd���Z
dS)	raeThis class represents and manipulates 32-bit IPv4 network + addresses..

    Attributes: [examples for IPv4Network('192.0.2.0/27')]
        .network_address: IPv4Address('192.0.2.0')
        .hostmask: IPv4Address('0.0.0.31')
        .broadcast_address: IPv4Address('192.0.2.32')
        .netmask: IPv4Address('255.255.255.224')
        .prefixlen: 27

    TcCs�tj||�t|ttf�r&|}|j}n^t|t�rT|d}t|�dkrL|dn|j}n0t|�}|j	|d�}t|�dkr~|dn|j}t
|�|_|j|�\|_
|_t|j�}|t|j
�@|kr�|r�td|��nt
|t|j
�@�|_|j|jdkr�|j|_dS)aInstantiate a new IPv4 network object.

        Args:
            address: A string or integer representing the IP [& network].
              '192.0.2.0/24'
              '192.0.2.0/255.255.255.0'
              '192.0.0.2/0.0.0.255'
              are all functionally the same in IPv4. Similarly,
              '192.0.2.1'
              '192.0.2.1/255.255.255.255'
              '192.0.2.1/32'
              are also functionally equivalent. That is to say, failing to
              provide a subnetmask will create an object with a mask of /32.

              If the mask (portion after the / in the argument) is given in
              dotted quad form, it is treated as a netmask if it starts with a
              non-zero field (e.g. /255.0.0.0 == /8) and as a hostmask if it
              starts with a zero field (e.g. 0.255.255.255 == /8), with the
              single exception of an all-zero mask which is treated as a
              netmask == /0. If no mask is given, a default of /32 is used.

              Additionally, an integer can be passed, so
              IPv4Network('192.0.2.1') == IPv4Network(3221225985)
              or, more generally
              IPv4Interface(int(IPv4Interface('192.0.2.1'))) ==
                IPv4Interface('192.0.2.1')

        Raises:
            AddressValueError: If ipaddress isn't a valid IPv4 address.
            NetmaskValueError: If the netmask isn't valid for
              an IPv4 address.
            ValueError: If strict is True and a network address is not
              supplied.

        rr&r z%s has host bits setN)rOr�r5rkr�r9r�r#r%rmrrKr�r�rIrr�r�)rWrrr$r��argsr�r	r	r
r��s(%


zIPv4Network.__init__cCs&|jtd�ko|jtd�ko$|jS)z�Test if this address is allocated for public networks.

        Returns:
            A boolean, True if the address is not reserved per
            iana-ipv4-special-registry.

        z
100.64.0.0/10)rKrrDr�)rWr	r	r
r�s
zIPv4Network.is_globalN)T)rrrrrr�r�rsr�r�r�r	r	r	r
r�s

Crc@s�eZdZed�Zed�Zed�Zed�Zed�ed�ed�ed�ed�ed�ed	�ed
�ed�ed�ed
�ed�ed�ed�gZed�ed�gZ	ed�Z
ed�ZdS)�_IPv4Constantsz169.254.0.0/16z127.0.0.0/8z224.0.0.0/4z
100.64.0.0/10z	0.0.0.0/8z
10.0.0.0/8z
172.16.0.0/12z192.0.0.0/24z192.0.0.170/31z192.0.2.0/24z192.168.0.0/16z
198.18.0.0/15z198.51.100.0/24z203.0.113.0/24z240.0.0.0/4z255.255.255.255/32z192.0.0.9/32z
192.0.0.10/32z0.0.0.0N)
rrrrr�r�r�r�r�r�r�rr�r	r	r	r
r�s,

r�c@s�eZdZdZfZdZdedZdZe	d�Z
eZiZe
dd��Ze
d	d
��Ze
dd��Ze
d
d��Ze
ddd��Zdd�Zdd�Zedd��Zedd��ZdS)�_BaseV6zyBase IPv6 object.

    The following methods are used by IPv6 objects in both single IP
    addresses and networks.

    r4r r&rdZ0123456789ABCDEFabcdefcCsJ||jkr@t|t�r|}n
|j|�}t|j|��}||f|j|<|j|S)aMake a (netmask, prefix_len) tuple from the given argument.

        Argument can be:
        - an integer (the prefix length)
        - a string representing the prefix length (e.g. "24")
        - a string representing the prefix netmask (e.g. "255.255.255.0")
        )r�r5rkrlr
rc)rar�rbr�r	r	r
r�Zs	


z_BaseV6._make_netmaskcCs�|std��|jd�}d}t|�|kr:d||f}t|��d|dkr�yt|j��j}Wn4tk
r�}ztd||f�d�WYdd}~XnX|jd	|d
?d@�|jd	|d@�|jd}t|�|kr�d|d|f}t|��d}xDtdt|�d�D].}	||	�s�|dk	�r$d
|}t|��|	}�q�W|dk	�r�|}
t|�|d}|d�st|
d8}
|
�rtd}t||��|d�s�|d8}|�r�d}t||��|j|
|}|dk�r:d}t||jd|f��njt|�|jk�r�d}t||j|f��|d�sd}t||��|d�s*d}t||��t|�}
d}d}ytd}
x,t|
�D] }	|
d
K}
|
|j	||	�O}
�qJW|
d
|K}
x0t|d�D] }	|
d
K}
|
|j	||	�O}
�q�W|
St
k
�r�}ztd||f�d�WYdd}~XnXdS)z�Turn an IPv6 ip_str into an integer.

        Args:
            ip_str: A string, the IPv6 ip_str.

        Returns:
            An int, the IPv6 address

        Raises:
            AddressValueError: if ip_str isn't a valid IPv6 Address.

        zAddress cannot be empty�:r�z At least %d parts expected in %rr�r&z%s in %rNz%xri��z!At most %d colons permitted in %rz At most one '::' permitted in %rrz0Leading ':' only permitted as part of '::' in %rz1Trailing ':' only permitted as part of '::' in %rz/Expected at most %d other parts with '::' in %rz,Exactly %d parts expected without '::' in %rrGrGrG)rr"r#rr>r)rA�
_HEXTET_COUNTr��
_parse_hextetr)rarnr�Z
_min_partsr^Zipv4_intr�Z
_max_partsZ
skip_index�iZparts_hiZparts_loZ
parts_skippedrer	r	r
rmls�
$









z_BaseV6._ip_int_from_stringcCs>|jj|�std|��t|�dkr4d}t||��t|d�S)a&Convert an IPv6 hextet string into an integer.

        Args:
            hextet_str: A string, the number to parse.

        Returns:
            The hextet as an integer.

        Raises:
            ValueError: if the input isn't strictly a hex number from
              [0..FFFF].

        zOnly hex digits permitted in %rrz$At most 4 characters permitted in %rr)�_HEX_DIGITSrjrr#rk)raZ
hextet_strr^r	r	r
r��sz_BaseV6._parse_hextetc	Cs�d}d}d}d}xJt|�D]>\}}|dkrP|d7}|dkr>|}||krX|}|}qd}d}qW|dkr�||}|t|�kr�|dg7}dg|||�<|dkr�dg|}|S)	a�Compresses a list of hextets.

        Compresses a list of strings, replacing the longest continuous
        sequence of "0" in the list with "" and adding empty strings at
        the beginning or at the end of the string such that subsequently
        calling ":".join(hextets) will produce the compressed version of
        the IPv6 address.

        Args:
            hextets: A list of strings, the hextets to compress.

        Returns:
            A list of strings.

        r&rr��rGrGrGrG)r�r#)	ra�hextetsZbest_doublecolon_startZbest_doublecolon_lenZdoublecolon_startZdoublecolon_len�indexZhextetZbest_doublecolon_endr	r	r
�_compress_hextets�s.

z_BaseV6._compress_hextetsNcsZ|dkrt|j�}||jkr$td��d|��fdd�tddd�D�}|j|�}d	j|�S)
a,Turns a 128-bit integer into hexadecimal notation.

        Args:
            ip_int: An integer, the IP address.

        Returns:
            A string, the hexadecimal representation of the address.

        Raises:
            ValueError: The address is bigger than 128 bits of all ones.

        NzIPv6 address is too largez%032xcs&g|]}dt�||d�d��qS)z%xrr)rk)r�r�)�hex_strr	r
r�3sz/_BaseV6._string_from_ip_int.<locals>.<listcomp>rrrr�)rkr)r:rr�r�r�)rarer�r	)r�r
r|s


z_BaseV6._string_from_ip_intcs�t|t�rt|j�}nt|t�r,t|j�}nt|�}|j|�}d|��fdd�tddd�D�}t|ttf�r�ddj	|�|j
fSdj	|�S)	z�Expand a shortened IPv6 address.

        Args:
            ip_str: A string, the IPv6 address.

        Returns:
            A string, the expanded IPv6 address.

        z%032xcsg|]}�||d��qS)rr	)r�r�)r�r	r
r�Ksz8_BaseV6._explode_shorthand_ip_string.<locals>.<listcomp>rrrz%s/%dr�)r5rr!rKrr.rmr�rOr�rI)rWrnrer�r	)r�r
rV8s



z$_BaseV6._explode_shorthand_ip_stringcCs&|jddd�jdd�}dj|�dS)z�Return the reverse DNS pointer name for the IPv6 address.

        This implements the method described in RFC3596 2.5.

        Nr&r�r�r�z	.ip6.arparG)rX�replacer�)rWZ
reverse_charsr	r	r
rZPsz_BaseV6._reverse_pointercCs|jS)N)r9)rWr	r	r
r�Ysz_BaseV6.max_prefixlencCs|jS)N)rH)rWr	r	r
r8]sz_BaseV6.version)N)rrrrrrrH�
IPV6LENGTHr:r�r�r�r9r�rtr�rmr�r�r|rVrZrsr�r8r	r	r	r
r�Fs$h0	r�c@s�eZdZdZdZdd�Zedd��Zedd	��Zed
d��Z	edd
��Z
edd��Zeej
�dd���Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��ZdS) r
z/Represent and manipulate single IPv6 Addresses.r)r�cCsrt|t�r|j|�||_dSt|t�rF|j|d�tj|d�|_dSt|�}d|krbtd|��|j	|�|_dS)aInstantiate a new IPv6 address object.

        Args:
            address: A string or integer representing the IP

              Additionally, an integer can be passed, so
              IPv6Address('2001:db8::') ==
                IPv6Address(42540766411282592856903984951653826560)
              or, more generally
              IPv6Address(int(IPv6Address('2001:db8::'))) ==
                IPv6Address('2001:db8::')

        Raises:
            AddressValueError: If address isn't a valid IPv6 address.

        NrrrzUnexpected '/' in %r)
r5rkr_r)r�r`r�r!rrm)rWrr�r	r	r
r�hs


zIPv6Address.__init__cCs
t|j�S)z*The binary representation of this address.)rr))rWr	r	r
r��szIPv6Address.packedcCs||jjkS)z�Test if the address is reserved for multicast use.

        Returns:
            A boolean, True if the address is a multicast address.
            See RFC 2373 2.7 for details.

        )r�r�)rWr	r	r
r��s	zIPv6Address.is_multicastcst�fdd��jjD��S)z�Test if the address is otherwise IETF reserved.

        Returns:
            A boolean, True if the address is within one of the
            reserved IPv6 Network ranges.

        c3s|]}�|kVqdS)Nr	)r�r�)rWr	r
r��sz*IPv6Address.is_reserved.<locals>.<genexpr>)r�r��_reserved_networks)rWr	)rWr
r��s	zIPv6Address.is_reservedcCs||jjkS)z�Test if the address is reserved for link-local.

        Returns:
            A boolean, True if the address is reserved per RFC 4291.

        )r�r�)rWr	r	r
r��szIPv6Address.is_link_localcCs||jjkS)a`Test if the address is reserved for site-local.

        Note that the site-local address space has been deprecated by RFC 3879.
        Use is_private to test if this address is in the space of unique local
        addresses as defined by RFC 4193.

        Returns:
            A boolean, True if the address is reserved per RFC 3513 2.5.6.

        )r��_sitelocal_network)rWr	r	r
�
is_site_local�szIPv6Address.is_site_localcsH�j}|dk	r|jSt�fdd��jjD��oFt�fdd��jjD��S)a�``True`` if the address is defined as not globally reachable by
        iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
        (for IPv6) with the following exceptions:

        * ``is_private`` is ``False`` for ``100.64.0.0/10``
        * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
            semantics of the underlying IPv4 addresses and the following condition holds
            (see :attr:`IPv6Address.ipv4_mapped`)::

                address.is_private == address.ipv4_mapped.is_private

        ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10``
        IPv4 range where they are both ``False``.
        Nc3s|]}�|kVqdS)Nr	)r�r;)rWr	r
r��sz)IPv6Address.is_private.<locals>.<genexpr>c3s|]}�|kVqdS)Nr	)r�r;)rWr	r
r��s)�ipv4_mappedr�r�r�r�r�r�)rWr�r	)rWr
r��s
zIPv6Address.is_privatecCs|jS)ar``True`` if the address is defined as globally reachable by
        iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
        (for IPv6) with the following exception:

        For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
        semantics of the underlying IPv4 addresses and the following condition holds
        (see :attr:`IPv6Address.ipv4_mapped`)::

            address.is_global == address.ipv4_mapped.is_global

        ``is_global`` has value opposite to :attr:`is_private`, except for the ``100.64.0.0/10``
        IPv4 range where they are both ``False``.
        )r�)rWr	r	r
r��szIPv6Address.is_globalcCs
|jdkS)z�Test if the address is unspecified.

        Returns:
            A boolean, True if this is the unspecified address as defined in
            RFC 2373 2.5.2.

        r)r))rWr	r	r
r��s	zIPv6Address.is_unspecifiedcCs
|jdkS)z�Test if the address is a loopback address.

        Returns:
            A boolean, True if the address is a loopback address as defined in
            RFC 2373 2.5.3.

        r&)r))rWr	r	r
r��s	zIPv6Address.is_loopbackcCs |jd?dkrdSt|jd@�S)z�Return the IPv4 mapped address.

        Returns:
            If the IPv6 address is a v4 mapped address, return the
            IPv4 mapped address. Return None otherwise.

        ri��Nl��)r)r)rWr	r	r
r��s	zIPv6Address.ipv4_mappedcCs4|jd?dkrdSt|jd?d@�t|jd@�fS)z�Tuple of embedded teredo IPs.

        Returns:
            Tuple of the (server, client) IPs or None if the address
            doesn't appear to be a teredo address (doesn't start with
            2001::/32)

        �`i N�@l��)r)r)rWr	r	r
�teredos
zIPv6Address.teredocCs$|jd?dkrdSt|jd?d@�S)z�Return the IPv4 6to4 embedded address.

        Returns:
            The IPv4 6to4-embedded address if present or None if the
            address doesn't appear to contain a 6to4 embedded address.

        �pi N�Pl��)r)r)rWr	r	r
�	sixtofours	zIPv6Address.sixtofourN)r)r�)rrrrrrr�rsr�r�r�r�r�r�r�r�r�r�r�r�r�r�r	r	r	r
r
bs $

r
c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zej	Z	e
dd��Ze
d
d��Ze
dd��Z
e
dd��Ze
dd��Ze
dd��ZdS)rcCs�t|ttf�r2tj||�t|j�|_|j|_	dSt|t
�r�tj||d�t|�dkrht|d�|_	n|j|_	t|dd�|_|jj|_|jj
|_
dSt|�}tj||d�t|dd�|_|jj|_|jj	|_	|jj
|_
dS)Nrr&F)r)r5r�rkr
r�rr)r�r9rIr�r#r�r�r%)rWrr$r	r	r
r�+s(




zIPv6Interface.__init__cCsd|j|j�|jjfS)Nz%s/%d)r|r)r�rb)rWr	r	r
r}CszIPv6Interface.__str__cCsDtj||�}|s|tkr|Sy|j|jkStk
r>dSXdS)NF)r
rwrRr�rJ)rWrvr�r	r	r
rwGszIPv6Interface.__eq__cCsNtj||�}|tkrtSy|j|jkp4|j|jko4|Stk
rHdSXdS)NF)r
rxrRr�rJ)rWrvr�r	r	r
rxSszIPv6Interface.__lt__cCst|j|jt|jj�f�S)N)r~r)rIrkr�rK)rWr	r	r
r�_szIPv6Interface.__hash__cCs
t|j�S)N)r
r))rWr	r	r
r.dszIPv6Interface.ipcCsd|j|j�|jfS)Nz%s/%s)r|r)rI)rWr	r	r
r�hszIPv6Interface.with_prefixlencCsd|j|j�|jfS)Nz%s/%s)r|r)r�)rWr	r	r
r�mszIPv6Interface.with_netmaskcCsd|j|j�|jfS)Nz%s/%s)r|r)r�)rWr	r	r
r�rszIPv6Interface.with_hostmaskcCs|jdko|jjS)Nr)r)r�r�)rWr	r	r
r�wszIPv6Interface.is_unspecifiedcCs|jdko|jjS)Nr&)r)r�r�)rWr	r	r
r�{szIPv6Interface.is_loopbackN)rrrr�r}rwrxr�rUrqrsr.r�r�r�r�r�r	r	r	r
r)src@s2eZdZdZeZd
dd�Zdd�Zedd��Z	d	S)ravThis class represents and manipulates 128-bit IPv6 networks.

    Attributes: [examples for IPv6('2001:db8::1000/124')]
        .network_address: IPv6Address('2001:db8::1000')
        .hostmask: IPv6Address('::f')
        .broadcast_address: IPv6Address('2001:db8::100f')
        .netmask: IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff0')
        .prefixlen: 124

    TcCs�tj||�t|ttf�r&|}|j}n^t|t�rT|d}t|�dkrL|dn|j}n0t|�}|j	|d�}t|�dkr~|dn|j}t
|�|_|j|�\|_
|_t|j�}|t|j
�@|kr�|r�td|��nt
|t|j
�@�|_|j|jdkr�|j|_dS)a�Instantiate a new IPv6 Network object.

        Args:
            address: A string or integer representing the IPv6 network or the
              IP and prefix/netmask.
              '2001:db8::/128'
              '2001:db8:0000:0000:0000:0000:0000:0000/128'
              '2001:db8::'
              are all functionally the same in IPv6.  That is to say,
              failing to provide a subnetmask will create an object with
              a mask of /128.

              Additionally, an integer can be passed, so
              IPv6Network('2001:db8::') ==
                IPv6Network(42540766411282592856903984951653826560)
              or, more generally
              IPv6Network(int(IPv6Network('2001:db8::'))) ==
                IPv6Network('2001:db8::')

            strict: A boolean. If true, ensure that we have been passed
              A true network address, eg, 2001:db8::1000/124 and not an
              IP address on a network, eg, 2001:db8::1/124.

        Raises:
            AddressValueError: If address isn't a valid IPv6 address.
            NetmaskValueError: If the netmask isn't valid for
              an IPv6 address.
            ValueError: If strict was True and a network address was not
              supplied.

        rr&r z%s has host bits setN)rOr�r5rkr�r9r�r#r%rmr
rKr�r�rIrr�r�)rWrrr$r�r�r�r	r	r
r��s( 


zIPv6Network.__init__ccs@t|j�}t|j�}x&t|d|d�D]}|j|�Vq(WdS)z�Generate Iterator over usable hosts in a network.

          This is like __iter__ except it doesn't return the
          Subnet-Router anycast address.

        r&N)rkrKrDr�r�)rWr�r�r�r	r	r
r��s

zIPv6Network.hostscCs|jjo|jjS)a`Test if the address is reserved for site-local.

        Note that the site-local address space has been deprecated by RFC 3879.
        Use is_private to test if this address is in the space of unique local
        addresses as defined by RFC 4193.

        Returns:
            A boolean, True if the address is reserved per RFC 3513 2.5.6.

        )rKr�rD)rWr	r	r
r��szIPv6Network.is_site_localN)T)
rrrrr
r�r�r�rsr�r	r	r	r
r�s

>rc@s�eZdZed�Zed�Zed�ed�ed�ed�ed�ed�ed	�ed
�ed�ed�g
Zed�ed
�ed�ed�ed�ed�gZed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed �gZed!�Z	d"S)#�_IPv6Constantsz	fe80::/10zff00::/8z::1/128z::/128z
::ffff:0:0/96z64:ff9b:1::/48z100::/64z	2001::/23z
2001:db8::/32z	2002::/16zfc00::/7z
2001:1::1/128z
2001:1::2/128z2001:3::/32z2001:4:112::/48z2001:20::/28z2001:30::/28z::/8z100::/8z200::/7z400::/6z800::/5z1000::/4z4000::/3z6000::/3z8000::/3zA000::/3zC000::/3zE000::/4zF000::/5zF800::/6zFE00::/9z	fec0::/10N)
rrrrr�r�r�r�r�r�r	r	r	r
r��s6


r�)T)#r�__version__r�r�r�rrrrrrrrr%r/r3r<rFrNrTrU�total_orderingr6rOrhrrrr�r�r�r
rrr�r	r	r	r
�<module>	sX
#716:EE
Sa&HWj-hmac.cpython-36.pyc000064400000013577150335715140010123 0ustar003

�\dh��@s�dZddlZddlmZddlZddlZddl	Z	e
dd�ed�D��Ze
dd�ed�D��Z
dZGdd	�d	�Zd
d�ZGdd
�d
e	j�Zej�r�eZddd�ZdS)zxHMAC (Keyed-Hashing for Message Authentication) Python module.

Implements the HMAC algorithm as described by RFC 2104.
�N)�_compare_digestccs|]}|dAVqdS)�\N�)�.0�xrr�/usr/lib64/python3.6/hmac.py�	<genexpr>sr�ccs|]}|dAVqdS)�6Nr)rrrrrr
sc@sReZdZdZdZddd�Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�ZdS)�HMACz~RFC 2104 HMAC class.  Also complies with RFC 4231.

    This supports the API for Cryptographic Hash Functions (PEP 247).
    �@Ncsftj�rtd��t|ttf�s0tdt|�j���dkrLt	j
dtd�tj
�t��r\�|_n,t�t�rxd�fdd	�	|_nd�fd
d	�	|_|j�|_|j�|_|jj|_t|jd�r�|jj}|dkr�t	j
d
||jftd�|j}nt	j
d|jtd�|j}||_t|�|k�r|j|�j�}|j|d�}|jj|jt��|jj|jt��|dk	�rb|j|�dS)a1Create a new HMAC object.

        key:       key for the keyed hash object.
        msg:       Initial input for the hash, if provided.
        digestmod: A module supporting PEP 247.  *OR*
                   A hashlib constructor returning a new hash object. *OR*
                   A hash name suitable for hashlib.new().
                   Defaults to hashlib.md5.
                   Implicit default to hashlib.md5 is deprecated and will be
                   removed in Python 3.6.

        Note: key and msg must be a bytes or bytearray objects.
        z*This class is not available in FIPS mode. zUse hmac.new().z,key: expected bytes or bytearray, but got %rNz<HMAC() without an explicit digestmod argument is deprecated.��cstj�|�S)N)�_hashlib�new)�d)�	digestmodrr�<lambda>;szHMAC.__init__.<locals>.<lambda>cs
�j|�S)N)r)r)rrrr=s�
block_size�z:block_size of %d seems too small; using our default of %d.z<No block_size attribute on given digest object; Assuming %d.�z9This class is not available in FIPS mode. Use hmac.new().)r)r)�_hashlibopenssl�
get_fips_mode�
ValueError�
isinstance�bytes�	bytearray�	TypeError�type�__name__�	_warnings�warn�PendingDeprecationWarningrZmd5�callable�digest_cons�str�outer�inner�digest_size�hasattrr�	blocksize�RuntimeWarning�len�digest�ljust�update�	translate�trans_5C�trans_36)�self�key�msgrr*r)rr�__init__sJ





z
HMAC.__init__cCsd|jjS)Nzhmac-)r'�name)r3rrrr7]sz	HMAC.namecCs tj�rtd��|jj|�dS)z8Update this hashing object with the string msg.
        z'hmac.HMAC is not available in FIPS modeN)rrrr'r/)r3r5rrrr/aszHMAC.updatecCs:|jj|j�}|j|_|j|_|jj�|_|jj�|_|S)zyReturn a separate copy of this hashing object.

        An update to this copy won't affect the original object.
        )�	__class__�__new__r$r(r'�copyr&)r3�otherrrrr:hsz	HMAC.copycCs|jj�}|j|jj��|S)zwReturn a hash object for the current state.

        To be used only internally with digest() and hexdigest().
        )r&r:r/r'r-)r3�hrrr�_currentus
z
HMAC._currentcCs|j�}|j�S)z�Return the hash value of this hashing object.

        This returns a string containing 8-bit data.  The object is
        not altered in any way by this function; you can continue
        updating the object after calling this function.
        )r=r-)r3r<rrrr-~szHMAC.digestcCs|j�}|j�S)zKLike digest(), but returns a string of hexadecimal digits instead.
        )r=�	hexdigest)r3r<rrrr>�szHMAC.hexdigest)NN)
r�
__module__�__qualname__�__doc__r*r6�propertyr7r/r:r=r-r>rrrrrs
A
	
rcCsX|dkrtd��t|t�r"|j�St|�r2|d�}t|tj�sFtd��|jj�j	dd�S)Nz.'digestmod' argument is mandatory in FIPS moderz6Only OpenSSL hashlib hashes are accepted in FIPS mode.�_�-)
rrr%�lowerr#rZHASHrr7�replace)rrrr�_get_openssl_name�s
rGc@seZdZddd�ZdS)�HMAC_opensslNcCsLt|ttf�s tdt|�j��t|�}tjj	|||d�}|rH|j
|�|S)Nz,key: expected bytes or bytearray, but got %r)r)rrrrrrrG�_hmacopensslrr9r/)�clsr4r5rr7�resultrrrr9�s
zHMAC_openssl.__new__)NN)rr?r@r9rrrrrH�srHcCst|||�S)aVCreate a new hashing object and return it.

    key: The starting key for the hash.
    msg: if available, will immediately be hashed into the object's starting
    state.

    You can now feed arbitrary strings into the object using its update()
    method, and can ask for the hash value at any time by calling its digest()
    method.
    )r)r4r5rrrrr�sr)NN)rA�warningsr �	_operatorrZcompare_digestZhashlibrrrIr�ranger1r2r(rrGrHrrrrrr�<module>sz_pyio.cpython-36.opt-1.pyc000064400000213312150335715140011256 0ustar003


 \!X�@sbdZddlZddlZddlZddlZddlZddlZyddlmZ	Wn e
k
rdddlmZ	YnXejd5kr~ddl
mZndZddlZddlmZmZmZmZddd	hZeed
�r�ejej�ejej�d6ZeZd8dd�ZGdd�d�ZGdd�d�Zy
ejZWn(e k
�r.Gdd�de!e"�ZYnXGdd�dej#d�Z$ej$j%e$�Gdd�de$�Z&ej&j%e&�ddl'm(Z(e&j%e(�Gdd�de$�Z)ej)j%e)�Gdd �d e)�Z*Gd!d"�d"e)�Z+Gd#d$�d$e*�Z,Gd%d&�d&e*�Z-Gd'd(�d(e)�Z.Gd)d*�d*e-e,�Z/Gd+d,�d,e&�Z(Gd-d.�d.e$�Z0ej0j%e0�Gd/d0�d0ej1�Z2Gd1d2�d2e0�Z3Gd3d4�d4e3�Z4dS)9z)
Python implementation of the io module.
�N)�
allocate_lock�win32�cygwin)�setmode)�__all__�SEEK_SET�SEEK_CUR�SEEK_END���	SEEK_HOLE�i�rTcCs~t|t�stj|�}t|tttf�s0td|��t|t�sFtd|��t|t�s\td|��|dk	r|t|t�r|td|��|dk	r�t|t�r�td|��t|�}|td�s�t|�t|�kr�t	d|��d|k}	d	|k}
d
|k}d|k}d|k}
d
|k}d|k}d|k�rH|	�s&|�s&|�s&|
�r.t	d��ddl
}|jdtd�d}
|�r\|�r\t	d��|	|
||dk�rzt	d��|	�p�|
�p�|�p�|�s�t	d��|�r�|dk	�r�t	d��|�r�|dk	�r�t	d��|�r�|dk	�r�t	d��t
||	�r�d�p�d|
�rd	�pd|�rd
�pd|�r d�p"d|
�r0d�p2d||d�}|}�yd}|dk�sh|dk�rp|j��rpd"}d}|dk�r�t}ytj|j��j}Wnttfk
�r�YnX|dk�r�|}|dk�r�t	d��|dk�r�|�r�|St	d ��|
�r�t||�}n<|	�s|�s|�rt||�}n|
�r,t||�}nt	d!|��|}|�rF|St|||||�}|}||_|S|j��YnXdS)#a�Open file and return a stream.  Raise OSError upon failure.

    file is either a text or byte string giving the name (and the path
    if the file isn't in the current working directory) of the file to
    be opened or an integer file descriptor of the file to be
    wrapped. (If a file descriptor is given, it is closed when the
    returned I/O object is closed, unless closefd is set to False.)

    mode is an optional string that specifies the mode in which the file is
    opened. It defaults to 'r' which means open for reading in text mode. Other
    common values are 'w' for writing (truncating the file if it already
    exists), 'x' for exclusive creation of a new file, and 'a' for appending
    (which on some Unix systems, means that all writes append to the end of the
    file regardless of the current seek position). In text mode, if encoding is
    not specified the encoding used is platform dependent. (For reading and
    writing raw bytes use binary mode and leave encoding unspecified.) The
    available modes are:

    ========= ===============================================================
    Character Meaning
    --------- ---------------------------------------------------------------
    'r'       open for reading (default)
    'w'       open for writing, truncating the file first
    'x'       create a new file and open it for writing
    'a'       open for writing, appending to the end of the file if it exists
    'b'       binary mode
    't'       text mode (default)
    '+'       open a disk file for updating (reading and writing)
    'U'       universal newline mode (deprecated)
    ========= ===============================================================

    The default mode is 'rt' (open for reading text). For binary random
    access, the mode 'w+b' opens and truncates the file to 0 bytes, while
    'r+b' opens the file without truncation. The 'x' mode implies 'w' and
    raises an `FileExistsError` if the file already exists.

    Python distinguishes between files opened in binary and text modes,
    even when the underlying operating system doesn't. Files opened in
    binary mode (appending 'b' to the mode argument) return contents as
    bytes objects without any decoding. In text mode (the default, or when
    't' is appended to the mode argument), the contents of the file are
    returned as strings, the bytes having been first decoded using a
    platform-dependent encoding or using the specified encoding if given.

    'U' mode is deprecated and will raise an exception in future versions
    of Python.  It has no effect in Python 3.  Use newline to control
    universal newlines mode.

    buffering is an optional integer used to set the buffering policy.
    Pass 0 to switch buffering off (only allowed in binary mode), 1 to select
    line buffering (only usable in text mode), and an integer > 1 to indicate
    the size of a fixed-size chunk buffer.  When no buffering argument is
    given, the default buffering policy works as follows:

    * Binary files are buffered in fixed-size chunks; the size of the buffer
      is chosen using a heuristic trying to determine the underlying device's
      "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
      On many systems, the buffer will typically be 4096 or 8192 bytes long.

    * "Interactive" text files (files for which isatty() returns True)
      use line buffering.  Other text files use the policy described above
      for binary files.

    encoding is the str name of the encoding used to decode or encode the
    file. This should only be used in text mode. The default encoding is
    platform dependent, but any encoding supported by Python can be
    passed.  See the codecs module for the list of supported encodings.

    errors is an optional string that specifies how encoding errors are to
    be handled---this argument should not be used in binary mode. Pass
    'strict' to raise a ValueError exception if there is an encoding error
    (the default of None has the same effect), or pass 'ignore' to ignore
    errors. (Note that ignoring encoding errors can lead to data loss.)
    See the documentation for codecs.register for a list of the permitted
    encoding error strings.

    newline is a string controlling how universal newlines works (it only
    applies to text mode). It can be None, '', '\n', '\r', and '\r\n'.  It works
    as follows:

    * On input, if newline is None, universal newlines mode is
      enabled. Lines in the input can end in '\n', '\r', or '\r\n', and
      these are translated into '\n' before being returned to the
      caller. If it is '', universal newline mode is enabled, but line
      endings are returned to the caller untranslated. If it has any of
      the other legal values, input lines are only terminated by the given
      string, and the line ending is returned to the caller untranslated.

    * On output, if newline is None, any '\n' characters written are
      translated to the system default line separator, os.linesep. If
      newline is '', no translation takes place. If newline is any of the
      other legal values, any '\n' characters written are translated to
      the given string.

    closedfd is a bool. If closefd is False, the underlying file descriptor will
    be kept open when the file is closed. This does not work when a file name is
    given and must be True in that case.

    The newly created file is non-inheritable.

    A custom opener can be used by passing a callable as *opener*. The
    underlying file descriptor for the file object is then obtained by calling
    *opener* with (*file*, *flags*). *opener* must return an open file
    descriptor (passing os.open as *opener* results in functionality similar to
    passing None).

    open() returns a file object whose type depends on the mode, and
    through which the standard file operations such as reading and writing
    are performed. When open() is used to open a file in a text mode ('w',
    'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open
    a file in a binary mode, the returned class varies: in read binary
    mode, it returns a BufferedReader; in write binary and append binary
    modes, it returns a BufferedWriter, and in read/write mode, it returns
    a BufferedRandom.

    It is also possible to use a string or bytearray as a file for both
    reading and writing. For strings StringIO can be used like a file
    opened in a text mode, and for bytes a BytesIO can be used like a file
    opened in a binary mode.
    zinvalid file: %rzinvalid mode: %rzinvalid buffering: %rNzinvalid encoding: %rzinvalid errors: %rzaxrwb+tU�xr�w�a�+�t�b�Uz4mode U cannot be combined with 'x', 'w', 'a', or '+'rz'U' mode is deprecatedrTz'can't have text and binary mode at oncer
z)can't have read/write/append mode at oncez/must have exactly one of read/write/append modez-binary mode doesn't take an encoding argumentz+binary mode doesn't take an errors argumentz+binary mode doesn't take a newline argument�)�openerFzinvalid buffering sizezcan't have unbuffered text I/Ozunknown mode: %r���)�
isinstance�int�os�fspath�str�bytes�	TypeError�set�len�
ValueError�warnings�warn�DeprecationWarning�FileIO�isatty�DEFAULT_BUFFER_SIZE�fstat�fileno�
st_blksize�OSError�AttributeError�BufferedRandom�BufferedWriter�BufferedReader�
TextIOWrapper�mode�close)�filer2�	buffering�encoding�errors�newline�closefdrZmodesZcreatingZreadingZwritingZ	appendingZupdating�textZbinaryr#�raw�result�line_bufferingZbs�buffer�r?�/usr/lib64/python3.6/_pyio.py�open(s�{




>




rAc@seZdZdZdd�ZdS)�
DocDescriptorz%Helper for builtins.open.__doc__
    cCs
dtjS)Nz\open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True)

)rA�__doc__)�self�obj�typr?r?r@�__get__�szDocDescriptor.__get__N)�__name__�
__module__�__qualname__rCrGr?r?r?r@rB�srBc@seZdZdZe�Zdd�ZdS)�OpenWrapperz�Wrapper for builtins.open

    Trick so that open won't become a bound method when stored
    as a class variable (as dbm.dumb does).

    See initstdio() in Python/pylifecycle.c.
    cOs
t||�S)N)rA)�cls�args�kwargsr?r?r@�__new__szOpenWrapper.__new__N)rHrIrJrCrBrOr?r?r?r@rKsrKc@seZdZdS)�UnsupportedOperationN)rHrIrJr?r?r?r@rPsrPc@s�eZdZdZdd�Zd6dd�Zdd�Zd7d
d�Zdd
�ZdZ	dd�Z
dd�Zdd�Zd8dd�Z
dd�Zd9dd�Zdd�Zd:dd�Zedd ��Zd;d!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd=d,d-�Zd.d/�Zd0d1�Zd>d2d3�Zd4d5�Zd	S)?�IOBaseagThe abstract base class for all I/O classes, acting on streams of
    bytes. There is no public constructor.

    This class provides dummy implementations for many methods that
    derived classes can override selectively; the default implementations
    represent a file that cannot be read, written or seeked.

    Even though IOBase does not declare read, readinto, or write because
    their signatures will vary, implementations and clients should
    consider those methods part of the interface. Also, implementations
    may raise UnsupportedOperation when operations they do not support are
    called.

    The basic type used for binary data read from or written to a file is
    bytes. Other bytes-like objects are accepted as method arguments too. In
    some cases (such as readinto), a writable object is required. Text I/O
    classes work with str data.

    Note that calling any method (even inquiries) on a closed stream is
    undefined. Implementations may raise OSError in this case.

    IOBase (and its subclasses) support the iterator protocol, meaning
    that an IOBase object can be iterated over yielding the lines in a
    stream.

    IOBase also supports the :keyword:`with` statement. In this example,
    fp is closed after the suite of the with statement is complete:

    with open('spam.txt', 'r') as fp:
        fp.write('Spam and eggs!')
    cCstd|jj|f��dS)z@Internal: raise an OSError exception for unsupported operations.z%s.%s() not supportedN)rP�	__class__rH)rD�namer?r?r@�_unsupported@szIOBase._unsupportedrcCs|jd�dS)a$Change stream position.

        Change the stream position to byte offset pos. Argument pos is
        interpreted relative to the position indicated by whence.  Values
        for whence are ints:

        * 0 -- start of stream (the default); offset should be zero or positive
        * 1 -- current stream position; offset may be negative
        * 2 -- end of stream; offset is usually negative
        Some operating systems / file systems could provide additional values.

        Return an int indicating the new absolute position.
        �seekN)rT)rD�pos�whencer?r?r@rUGszIOBase.seekcCs|jdd�S)z5Return an int indicating the current stream position.rr
)rU)rDr?r?r@�tellWszIOBase.tellNcCs|jd�dS)z�Truncate file to size bytes.

        Size defaults to the current IO position as reported by tell().  Return
        the new size.
        �truncateN)rT)rDrVr?r?r@rY[szIOBase.truncatecCs|j�dS)zuFlush write buffers, if applicable.

        This is not implemented for read-only and non-blocking streams.
        N)�_checkClosed)rDr?r?r@�flusheszIOBase.flushFcCs |jsz|j�Wdd|_XdS)ziFlush and close the IO object.

        This method has no effect if the file is already closed.
        NT)�_IOBase__closedr[)rDr?r?r@r3oszIOBase.closec	Csy|j�WnYnXdS)zDestructor.  Calls close().N)r3)rDr?r?r@�__del__zszIOBase.__del__cCsdS)z�Return a bool indicating whether object supports random access.

        If False, seek(), tell() and truncate() will raise OSError.
        This method may need to do a test seek().
        Fr?)rDr?r?r@�seekable�szIOBase.seekablecCs |j�st|dkrdn|��dS)zEInternal: raise UnsupportedOperation if file is not seekable
        NzFile or stream is not seekable.)r^rP)rD�msgr?r?r@�_checkSeekable�szIOBase._checkSeekablecCsdS)zvReturn a bool indicating whether object was opened for reading.

        If False, read() will raise OSError.
        Fr?)rDr?r?r@�readable�szIOBase.readablecCs |j�st|dkrdn|��dS)zEInternal: raise UnsupportedOperation if file is not readable
        NzFile or stream is not readable.)rarP)rDr_r?r?r@�_checkReadable�szIOBase._checkReadablecCsdS)z�Return a bool indicating whether object was opened for writing.

        If False, write() and truncate() will raise OSError.
        Fr?)rDr?r?r@�writable�szIOBase.writablecCs |j�st|dkrdn|��dS)zEInternal: raise UnsupportedOperation if file is not writable
        NzFile or stream is not writable.)rcrP)rDr_r?r?r@�_checkWritable�szIOBase._checkWritablecCs|jS)z�closed: bool.  True iff the file has been closed.

        For backwards compatibility, this is a property, not a predicate.
        )r\)rDr?r?r@�closed�sz
IOBase.closedcCs|jrt|dkrdn|��dS)z7Internal: raise a ValueError if file is closed
        NzI/O operation on closed file.)rer")rDr_r?r?r@rZ�szIOBase._checkClosedcCs|j�|S)zCContext management protocol.  Returns self (an instance of IOBase).)rZ)rDr?r?r@�	__enter__�szIOBase.__enter__cGs|j�dS)z+Context management protocol.  Calls close()N)r3)rDrMr?r?r@�__exit__�szIOBase.__exit__cCs|jd�dS)z�Returns underlying file descriptor (an int) if one exists.

        An OSError is raised if the IO object does not use a file descriptor.
        r*N)rT)rDr?r?r@r*�sz
IOBase.filenocCs|j�dS)z{Return a bool indicating whether this is an 'interactive' stream.

        Return False if it can't be determined.
        F)rZ)rDr?r?r@r'�sz
IOBase.isattyr
cs�t�d�r��fdd�}ndd�}�dkr0d
�nt�t�sBtd��t�}x>�dks^t|��kr��j|��}|spP||7}|jd	�rJPqJWt|�S)aNRead and return a line of bytes from the stream.

        If size is specified, at most size bytes will be read.
        Size should be an int.

        The line terminator is always b'\n' for binary files; for text
        files, the newlines argument to open can be used to select the line
        terminator(s) recognized.
        �peekcs>�jd�}|sdS|jd�dp&t|�}�dkr:t|��}|S)Nr
�
r)rh�findr!�min)Z	readahead�n)rD�sizer?r@�
nreadahead�s

z#IOBase.readline.<locals>.nreadaheadcSsdS)Nr
r?r?r?r?r@rn�sNr
zsize must be an integerrrir)	�hasattrrrr�	bytearrayr!�read�endswithr)rDrmrn�resrr?)rDrmr@�readline�s 
	

zIOBase.readlinecCs|j�|S)N)rZ)rDr?r?r@�__iter__szIOBase.__iter__cCs|j�}|st�|S)N)rt�
StopIteration)rD�liner?r?r@�__next__szIOBase.__next__cCsR|dks|dkrt|�Sd}g}x,|D]$}|j|�|t|�7}||kr&Pq&W|S)z�Return a list of lines from the stream.

        hint can be specified to control the number of lines read: no more
        lines will be read if the total size (in bytes/characters) of all
        lines so far exceeds hint.
        Nr)�list�appendr!)rDZhintrl�linesrwr?r?r@�	readliness

zIOBase.readlinescCs$|j�x|D]}|j|�qWdS)N)rZ�write)rDr{rwr?r?r@�
writelines#s
zIOBase.writelines)r)N)N)N)N)Nr)r)N)rHrIrJrCrTrUrXrYr[r\r3r]r^r`rarbrcrd�propertyrerZrfrgr*r'rtrurxr|r~r?r?r?r@rQs4 






	

%
rQ)�	metaclassc@s2eZdZdZd
dd�Zdd�Zdd�Zd	d
�ZdS)�	RawIOBasezBase class for raw binary I/O.r
cCsP|dkrd}|dkr|j�St|j��}|j|�}|dkr>dS||d�=t|�S)z�Read and return up to size bytes, where size is an int.

        Returns an empty bytes object on EOF, or None if the object is
        set not to block and has no data to read.
        Nr
rr)�readallrp�	__index__�readintor)rDrmrrlr?r?r@rq9s

zRawIOBase.readcCs8t�}x|jt�}|sP||7}qW|r0t|�S|SdS)z+Read until EOF, using multiple read() call.N)rprqr(r)rDrs�datar?r?r@r�Js
zRawIOBase.readallcCs|jd�dS)z�Read bytes into a pre-allocated bytes-like object b.

        Returns an int representing the number of bytes read (0 for EOF), or
        None if the object is set not to block and has no data to read.
        r�N)rT)rDrr?r?r@r�XszRawIOBase.readintocCs|jd�dS)z�Write the given buffer to the IO stream.

        Returns the number of bytes written, which may be less than the
        length of b in bytes.
        r}N)rT)rDrr?r?r@r}`szRawIOBase.writeNr)r)rHrIrJrCrqr�r�r}r?r?r?r@r�+s

r�)r&c@sLeZdZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�BufferedIOBaseaBase class for buffered IO objects.

    The main difference with RawIOBase is that the read() method
    supports omitting the size argument, and does not have a default
    implementation that defers to readinto().

    In addition, read(), readinto() and write() may raise
    BlockingIOError if the underlying raw stream is in non-blocking
    mode and not ready; unlike their raw counterparts, they will never
    return None.

    A typical implementation should not inherit from a RawIOBase
    implementation, but wrap one.
    NcCs|jd�dS)a�Read and return up to size bytes, where size is an int.

        If the argument is omitted, None, or negative, reads and
        returns all data until EOF.

        If the argument is positive, and the underlying raw stream is
        not 'interactive', multiple raw reads may be issued to satisfy
        the byte count (unless EOF is reached first).  But for
        interactive raw streams (XXX and for pipes?), at most one raw
        read will be issued, and a short result does not imply that
        EOF is imminent.

        Returns an empty bytes array on EOF.

        Raises BlockingIOError if the underlying raw stream has no
        data at the moment.
        rqN)rT)rDrmr?r?r@rq~szBufferedIOBase.readcCs|jd�dS)zaRead up to size bytes with at most one read() system call,
        where size is an int.
        �read1N)rT)rDrmr?r?r@r��szBufferedIOBase.read1cCs|j|dd�S)afRead bytes into a pre-allocated bytes-like object b.

        Like read(), this may issue multiple reads to the underlying raw
        stream, unless the latter is 'interactive'.

        Returns an int representing the number of bytes read (0 for EOF).

        Raises BlockingIOError if the underlying raw stream has no
        data at the moment.
        F)r�)�	_readinto)rDrr?r?r@r��szBufferedIOBase.readintocCs|j|dd�S)z�Read bytes into buffer *b*, using at most one system call

        Returns an int representing the number of bytes read (0 for EOF).

        Raises BlockingIOError if the underlying raw stream has no
        data at the moment.
        T)r�)r�)rDrr?r?r@�	readinto1�s	zBufferedIOBase.readinto1cCsVt|t�st|�}|jd�}|r0|jt|��}n|jt|��}t|�}||d|�<|S)N�B)r�
memoryview�castr�r!rq)rDrr�r�rlr?r?r@r��s

zBufferedIOBase._readintocCs|jd�dS)aWrite the given bytes buffer to the IO stream.

        Return the number of bytes written, which is always the length of b
        in bytes.

        Raises BlockingIOError if the buffer is full and the
        underlying raw stream cannot accept more data at the moment.
        r}N)rT)rDrr?r?r@r}�s	zBufferedIOBase.writecCs|jd�dS)z�
        Separate the underlying raw stream from the buffer and return it.

        After the raw stream has been detached, the buffer is in an unusable
        state.
        �detachN)rT)rDr?r?r@r��szBufferedIOBase.detach)N)N)rHrIrJrCrqr�r�r�r�r}r�r?r?r?r@r�ms

r�c@s�eZdZdZdd�Zd$dd�Zdd�Zd%d
d�Zdd
�Zdd�Z	dd�Z
dd�Zedd��Z
edd��Zedd��Zedd��Zdd�Zdd�Zd d!�Zd"d#�Zd	S)&�_BufferedIOMixinz�A mixin implementation of BufferedIOBase with an underlying raw stream.

    This passes most requests on to the underlying raw stream.  It
    does *not* provide implementations of read(), readinto() or
    write().
    cCs
||_dS)N)�_raw)rDr;r?r?r@�__init__�sz_BufferedIOMixin.__init__rcCs"|jj||�}|dkrtd��|S)Nrz#seek() returned an invalid position)r;rUr,)rDrVrWZnew_positionr?r?r@rU�sz_BufferedIOMixin.seekcCs|jj�}|dkrtd��|S)Nrz#tell() returned an invalid position)r;rXr,)rDrVr?r?r@rX�s
z_BufferedIOMixin.tellNcCs$|j�|dkr|j�}|jj|�S)N)r[rXr;rY)rDrVr?r?r@rY�sz_BufferedIOMixin.truncatecCs|jrtd��|jj�dS)Nzflush of closed file)rer"r;r[)rDr?r?r@r[�sz_BufferedIOMixin.flushc
Cs0|jdk	r,|jr,z|j�Wd|jj�XdS)N)r;rer[r3)rDr?r?r@r3sz_BufferedIOMixin.closecCs*|jdkrtd��|j�|j}d|_|S)Nzraw stream already detached)r;r"r[r�)rDr;r?r?r@r�s
z_BufferedIOMixin.detachcCs
|jj�S)N)r;r^)rDr?r?r@r^sz_BufferedIOMixin.seekablecCs|jS)N)r�)rDr?r?r@r;sz_BufferedIOMixin.rawcCs|jjS)N)r;re)rDr?r?r@resz_BufferedIOMixin.closedcCs|jjS)N)r;rS)rDr?r?r@rS!sz_BufferedIOMixin.namecCs|jjS)N)r;r2)rDr?r?r@r2%sz_BufferedIOMixin.modecCstdj|jj���dS)Nz can not serialize a '{0}' object)r�formatrRrH)rDr?r?r@�__getstate__)sz_BufferedIOMixin.__getstate__cCsJ|jj}|jj}y
|j}Wntk
r6dj||�SXdj|||�SdS)Nz<{}.{}>z<{}.{} name={!r}>)rRrIrJrS�	Exceptionr�)rD�modnameZclsnamerSr?r?r@�__repr__-s
z_BufferedIOMixin.__repr__cCs
|jj�S)N)r;r*)rDr?r?r@r*9sz_BufferedIOMixin.filenocCs
|jj�S)N)r;r')rDr?r?r@r'<sz_BufferedIOMixin.isatty)r)N)rHrIrJrCr�rUrXrYr[r3r�r^rr;rerSr2r�r�r*r'r?r?r?r@r��s"


r�cs�eZdZdZd dd�Zdd�Zdd�Zd	d
�Z�fdd�Zd!d
d�Z	dd�Z
dd�Zd"dd�Zdd�Z
d#dd�Zdd�Zdd�Zdd�Z�ZS)$�BytesIOz<Buffered I/O implementation using an in-memory bytes buffer.NcCs&t�}|dk	r||7}||_d|_dS)Nr)rp�_buffer�_pos)rDZ
initial_bytes�bufr?r?r@r�Ds
zBytesIO.__init__cCs|jrtd��|jj�S)Nz__getstate__ on closed file)rer"�__dict__�copy)rDr?r?r@r�KszBytesIO.__getstate__cCs|jrtd��t|j�S)z8Return the bytes value (contents) of the buffer
        zgetvalue on closed file)rer"rr�)rDr?r?r@�getvaluePszBytesIO.getvaluecCs|jrtd��t|j�S)z;Return a readable and writable view of the buffer.
        zgetbuffer on closed file)rer"r�r�)rDr?r?r@�	getbufferWszBytesIO.getbuffercs|jj�t�j�dS)N)r��clear�superr3)rD)rRr?r@r3^s
z
BytesIO.closecCst|jrtd��|dkrd}|dkr,t|j�}t|j�|jkr@dStt|j�|j|�}|j|j|�}||_t|�S)Nzread from closed filer
r�r)rer"r!r�r�rkr)rDrmZnewposrr?r?r@rqbs
zBytesIO.readcCs
|j|�S)z"This is the same as read.
        )rq)rDrmr?r?r@r�psz
BytesIO.read1cCs�|jrtd��t|t�r td��t|��}|j}WdQRX|dkrFdS|j}|t|j	�krzd|t|j	�}|j	|7_	||j	|||�<|j|7_|S)Nzwrite to closed filez can't write str to binary streamr�)
rer"rrrr��nbytesr�r!r�)rDrZviewrlrVZpaddingr?r?r@r}us

z
BytesIO.writercCs�|jrtd��y
|jWn,tk
rD}ztd�|�WYdd}~XnX|dkrl|dkrdtd|f��||_nD|dkr�td|j|�|_n(|dkr�tdt|j�|�|_ntd��|jS)Nzseek on closed filezan integer is requiredrznegative seek position %rr
rzunsupported whence value)	rer"r�r-rr��maxr!r�)rDrVrW�errr?r?r@rU�s 
zBytesIO.seekcCs|jrtd��|jS)Nztell on closed file)rer"r�)rDr?r?r@rX�szBytesIO.tellcCs||jrtd��|dkr|j}nNy
|jWn,tk
rT}ztd�|�WYdd}~XnX|dkrltd|f��|j|d�=|S)Nztruncate on closed filezan integer is requiredrznegative truncate position %r)rer"r�r�r-rr�)rDrVr�r?r?r@rY�s
zBytesIO.truncatecCs|jrtd��dS)NzI/O operation on closed file.T)rer")rDr?r?r@ra�szBytesIO.readablecCs|jrtd��dS)NzI/O operation on closed file.T)rer")rDr?r?r@rc�szBytesIO.writablecCs|jrtd��dS)NzI/O operation on closed file.T)rer")rDr?r?r@r^�szBytesIO.seekable)N)N)r)N)rHrIrJrCr�r�r�r�r3rqr�r}rUrXrYrarcr^�
__classcell__r?r?)rRr@r�@s



r�c@sveZdZdZefdd�Zdd�Zdd�Zdd	d
�Zddd�Z	ddd�Z
ddd�Zdd�Zdd�Z
dd�Zddd�ZdS)r0aBufferedReader(raw[, buffer_size])

    A buffer for a readable, sequential BaseRawIO object.

    The constructor creates a BufferedReader for the given readable raw
    stream and buffer_size. If buffer_size is omitted, DEFAULT_BUFFER_SIZE
    is used.
    cCsF|j�std��tj||�|dkr,td��||_|j�t�|_dS)zMCreate a new buffered reader using the given readable raw IO object.
        z "raw" argument must be readable.rzinvalid buffer sizeN)	rar,r�r�r"�buffer_size�_reset_read_buf�Lock�
_read_lock)rDr;r�r?r?r@r��szBufferedReader.__init__cCs
|jj�S)N)r;ra)rDr?r?r@ra�szBufferedReader.readablecCsd|_d|_dS)Nr�r)�	_read_buf�	_read_pos)rDr?r?r@r��szBufferedReader._reset_read_bufNc	Cs4|dk	r|dkrtd��|j�|j|�SQRXdS)z�Read size bytes.

        Returns exactly size bytes of data unless the underlying raw IO
        stream reaches EOF or if the call would block in non-blocking
        mode. If size is negative, read until EOF or until read() would
        block.
        Nr
zinvalid number of bytes to readr)r"r��_read_unlocked)rDrmr?r?r@rq�szBufferedReader.readcCs�d}d}|j}|j}|dks$|dkr�|j�t|jd�rj|jj�}|dkrZ||d�pXdS||d�|S||d�g}d}x2|jj�}||kr�|}P|t|�7}|j|�q~Wdj	|�p�|St|�|}	||	kr�|j|7_||||�S||d�g}t
|j|�}
xB|	|k�rL|jj|
�}||k�r2|}P|	t|�7}	|j|��qWt||	�}dj	|�}||d�|_d|_|�r�|d|�S|S)Nr�r
r�r)r�Nr)
r�r�r�ror;r�rqr!rz�joinr�r�rk)rDrlZ
nodata_valZempty_valuesr�rV�chunkZchunksZcurrent_size�availZwanted�outr?r?r@r��sN




zBufferedReader._read_unlockedrc	Cs|j�|j|�SQRXdS)z�Returns buffered bytes without advancing the position.

        The argument indicates a desired minimal number of bytes; we
        do at most one raw read to satisfy it.  We never return more
        than self.buffer_size.
        N)r��_peek_unlocked)rDrmr?r?r@rhszBufferedReader.peekcCsrt||j�}t|j�|j}||ks,|dkrb|j|}|jj|�}|rb|j|jd�||_d|_|j|jd�S)Nr)rkr�r!r�r�r;rq)rDrlZwantZhaveZto_readZcurrentr?r?r@r�)s
zBufferedReader._peek_unlockedcCsT|dkrtd��|dkrdS|j�(|jd�|jt|t|j�|j��SQRXdS)z<Reads up to size bytes, with at most one read() system call.rz(number of bytes to read must be positiver�r
N)r"r�r�r�rkr!r�r�)rDrmr?r?r@r�4s
zBufferedReader.read1cCst|t�st|�}|jdkr dS|jd�}d}|j��x�|t|�k�rtt|j�|jt|��}|r�|j|j|j|�||||�<|j|7_||7}|t|�kr�Pt|�||j	kr�|j
j||d��}|s�P||7}n|o�|s�|jd�s�P|r8|r8Pq8WWdQRX|S)z2Read data into *buf* with at most one system call.rr�Nr
)
rr�r�r�r�r!rkr�r�r�r;r�r�)rDr�r��writtenr�rlr?r?r@r�Fs4


"

zBufferedReader._readintocCstj|�t|j�|jS)N)r�rXr!r�r�)rDr?r?r@rXtszBufferedReader.tellcCsX|tkrtd��|j�8|dkr4|t|j�|j8}tj|||�}|j�|SQRXdS)Nzinvalid whence valuer
)	�valid_seek_flagsr"r�r!r�r�r�rUr�)rDrVrWr?r?r@rUwszBufferedReader.seek)N)N)r)r)r)rHrIrJrCr(r�rar�rqr�rhr�r�r�rXrUr?r?r?r@r0�s	


4


.r0c@sXeZdZdZefdd�Zdd�Zdd�Zdd	d
�Zdd�Z	d
d�Z
dd�Zddd�ZdS)r/z�A buffer for a writeable sequential RawIO object.

    The constructor creates a BufferedWriter for the given writeable raw
    stream. If the buffer_size is not given, it defaults to
    DEFAULT_BUFFER_SIZE.
    cCsF|j�std��tj||�|dkr,td��||_t�|_t�|_	dS)Nz "raw" argument must be writable.rzinvalid buffer size)
rcr,r�r�r"r�rp�
_write_bufr��_write_lock)rDr;r�r?r?r@r��szBufferedWriter.__init__cCs
|jj�S)N)r;rc)rDr?r?r@rc�szBufferedWriter.writablecCs�|jrtd��t|t�r td��|j��t|j�|jkr@|j	�t|j�}|jj
|�t|j�|}t|j�|jkr�y|j	�Wnltk
r�}zPt|j�|jkr�t|j�|j}||8}|jd|j�|_t|j|j
|��WYdd}~XnX|SQRXdS)Nzwrite to closed filez can't write str to binary stream)rer"rrrr�r!r�r��_flush_unlocked�extend�BlockingIOError�errno�strerror)rDrZbeforer��eZoverager?r?r@r}�s(

"zBufferedWriter.writeNc	Cs8|j�(|j�|dkr"|jj�}|jj|�SQRXdS)N)r�r�r;rXrY)rDrVr?r?r@rY�s

zBufferedWriter.truncatec	Cs|j�|j�WdQRXdS)N)r�r�)rDr?r?r@r[�szBufferedWriter.flushcCs�|jrtd��xz|jr�y|jj|j�}Wntk
rDtd��YnX|dkr\ttjdd��|t	|j�ksr|dkrzt
d��|jd|�=qWdS)Nzflush of closed filezHself.raw should implement RawIOBase: it should not raise BlockingIOErrorz)write could not complete without blockingrz*write() returned incorrect number of bytes)rer"r�r;r}r��RuntimeErrorr�ZEAGAINr!r,)rDrlr?r?r@r��szBufferedWriter._flush_unlockedcCstj|�t|j�S)N)r�rXr!r�)rDr?r?r@rX�szBufferedWriter.tellrcCs8|tkrtd��|j�|j�tj|||�SQRXdS)Nzinvalid whence value)r�r"r�r�r�rU)rDrVrWr?r?r@rU�s
zBufferedWriter.seek)N)r)
rHrIrJrCr(r�rcr}rYr[r�rXrUr?r?r?r@r/�s
r/c@s�eZdZdZefdd�Zddd�Zdd�Zd	d
�Zddd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zedd��ZdS) �BufferedRWPaira�A buffered reader and writer object together.

    A buffered reader object and buffered writer object put together to
    form a sequential IO object that can read and write. This is typically
    used with a socket or two-way pipe.

    reader and writer are RawIOBase objects that are readable and
    writeable respectively. If the buffer_size is omitted it defaults to
    DEFAULT_BUFFER_SIZE.
    cCs<|j�std��|j�s td��t||�|_t||�|_dS)zEConstructor.

        The arguments are two RawIO instances.
        z#"reader" argument must be readable.z#"writer" argument must be writable.N)rar,rcr0�readerr/�writer)rDr�r�r�r?r?r@r��szBufferedRWPair.__init__NcCs|dkrd}|jj|�S)Nr
r)r�rq)rDrmr?r?r@rq�szBufferedRWPair.readcCs|jj|�S)N)r�r�)rDrr?r?r@r��szBufferedRWPair.readintocCs|jj|�S)N)r�r})rDrr?r?r@r}szBufferedRWPair.writercCs|jj|�S)N)r�rh)rDrmr?r?r@rhszBufferedRWPair.peekcCs|jj|�S)N)r�r�)rDrmr?r?r@r�szBufferedRWPair.read1cCs|jj|�S)N)r�r�)rDrr?r?r@r�
szBufferedRWPair.readinto1cCs
|jj�S)N)r�ra)rDr?r?r@ra
szBufferedRWPair.readablecCs
|jj�S)N)r�rc)rDr?r?r@rcszBufferedRWPair.writablecCs
|jj�S)N)r�r[)rDr?r?r@r[szBufferedRWPair.flushc
Cs z|jj�Wd|jj�XdS)N)r�r3r�)rDr?r?r@r3szBufferedRWPair.closecCs|jj�p|jj�S)N)r�r'r�)rDr?r?r@r'szBufferedRWPair.isattycCs|jjS)N)r�re)rDr?r?r@reszBufferedRWPair.closed)N)r)rHrIrJrCr(r�rqr�r}rhr�r�rarcr[r3r'rrer?r?r?r@r��s

r�c@sleZdZdZefdd�Zddd�Zdd�Zdd
d�Zddd
�Z	dd�Z
ddd�Zdd�Zdd�Z
dd�Zd	S)r.z�A buffered interface to random access streams.

    The constructor creates a reader and writer for a seekable stream,
    raw, given in the first argument. If the buffer_size is omitted it
    defaults to DEFAULT_BUFFER_SIZE.
    cCs(|j�tj|||�tj|||�dS)N)r`r0r�r/)rDr;r�r?r?r@r�-szBufferedRandom.__init__rcCs�|tkrtd��|j�|jrJ|j� |jj|jt|j�d�WdQRX|jj||�}|j�|j	�WdQRX|dkr�t
d��|S)Nzinvalid whence valuer
rz seek() returned invalid position)r�r"r[r�r�r;rUr�r!r�r,)rDrVrWr?r?r@rU2s$zBufferedRandom.seekcCs|jrtj|�Stj|�SdS)N)r�r/rXr0)rDr?r?r@rXCs
zBufferedRandom.tellNcCs|dkr|j�}tj||�S)N)rXr/rY)rDrVr?r?r@rYIszBufferedRandom.truncatecCs |dkrd}|j�tj||�S)Nr
r)r[r0rq)rDrmr?r?r@rqOszBufferedRandom.readcCs|j�tj||�S)N)r[r0r�)rDrr?r?r@r�UszBufferedRandom.readintocCs|j�tj||�S)N)r[r0rh)rDrmr?r?r@rhYszBufferedRandom.peekcCs|j�tj||�S)N)r[r0r�)rDrmr?r?r@r�]szBufferedRandom.read1cCs|j�tj||�S)N)r[r0r�)rDrr?r?r@r�aszBufferedRandom.readinto1cCsF|jr:|j�(|jj|jt|j�d�|j�WdQRXtj||�S)Nr
)	r�r�r;rUr�r!r�r/r})rDrr?r?r@r}es
zBufferedRandom.write)r)N)N)r)rHrIrJrCr(r�rUrXrYrqr�rhr�r�r}r?r?r?r@r.$s



r.cs�eZdZd0ZdZdZdZdZdZdZ	d1dd�Z
dd	�Zd
d�Zdd
�Z
dd�Zd2dd�Zd3dd�Zdd�Zdd�Zdd�Zefdd�Zdd�Zd4dd�Z�fd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zed,d-��Zed.d/��Z �Z!S)5r&r
FNTrc
Cs
|jdkr*z|jrtj|j�Wdd|_Xt|t�r<td��t|t�r\|}|dkr`td��nd}t|t	�sxtd|f��t
|�t
d�ks�td|f��tdd	�|D��dks�|jd
�dkr�td��d|kr�d
|_
d
|_tjtjB}nVd|k�r�d
|_d}n@d|k�rd
|_tjtjB}n"d|k�r:d
|_d
|_tjtjB}d
|k�rPd
|_d
|_|j�rl|j�rl|tjO}n|j�r�|tjO}n
|tjO}|ttdd�O}ttdd��p�ttdd�}||O}d}�y|dk�r<|�s�td��|dk�r�tj||d�}n0|||�}t|t��std��|dk�r&td��|}|�s<tj|d�||_tj|�}	y(tj|	j��rrt t!j"tj#t!j"�|��Wnt$k
�r�YnXt|	dd�|_%|j%dk�r�t&|_%t'�r�t'|tj(�||_)|j�r�tj*|dt+�Wn"|dk	�r�tj|��YnX||_dS)adOpen a file.  The mode can be 'r' (default), 'w', 'x' or 'a' for reading,
        writing, exclusive creation or appending.  The file will be created if it
        doesn't exist when opened for writing or appending; it will be truncated
        when opened for writing.  A FileExistsError will be raised if it already
        exists when opened for creating. Opening a file for creating implies
        writing so this mode behaves in a similar way to 'w'. Add a '+' to the mode
        to allow simultaneous reading and writing. A custom opener can be used by
        passing a callable as *opener*. The underlying file descriptor for the file
        object is then obtained by calling opener with (*name*, *flags*).
        *opener* must return an open file descriptor (passing os.open as *opener*
        results in functionality similar to passing None).
        rNr
z$integer argument expected, got floatznegative file descriptorzinvalid mode: %szxrwab+css|]}|dkVqdS)ZrwaxNr?)�.0�cr?r?r@�	<genexpr>�sz"FileIO.__init__.<locals>.<genexpr>rzKMust have exactly one of create/read/write/append mode and at most one plusrTrrr�O_BINARYZO_NOINHERIT�	O_CLOEXECz'Cannot use closefd=False with file namei�zexpected integer from openerzNegative file descriptorFr+rr),�_fd�_closefdrr3r�floatrrr"rr �sum�count�_created�	_writable�O_EXCL�O_CREAT�	_readable�O_TRUNC�
_appending�O_APPEND�O_RDWR�O_RDONLY�O_WRONLY�getattrrAr,�set_inheritabler)�stat�S_ISDIR�st_mode�IsADirectoryErrorr�ZEISDIRr�r-�_blksizer(�_setmoder�rS�lseekr	)
rDr4r2r9r�fd�flagsZnoinherit_flagZowned_fdZfdfstatr?r?r@r�ws�




$











zFileIO.__init__cCsD|jdkr@|jr@|jr@ddl}|jd|ftd|d�|j�dS)Nrzunclosed file %rr)�
stacklevel�source)r�r�rer#r$�ResourceWarningr3)rDr#r?r?r@r]�s

zFileIO.__del__cCstd|jj��dS)Nzcannot serialize '%s' object)rrRrH)rDr?r?r@r��szFileIO.__getstate__c
Csld|jj|jjf}|jr"d|Sy
|j}Wn&tk
rRd||j|j|jfSXd|||j|jfSdS)Nz%s.%sz
<%s [closed]>z<%s fd=%d mode=%r closefd=%r>z<%s name=%r mode=%r closefd=%r>)	rRrIrJrerSr-r�r2r�)rD�
class_namerSr?r?r@r��s
zFileIO.__repr__cCs|jstd��dS)NzFile not open for reading)r�rP)rDr?r?r@rbszFileIO._checkReadablecCs|jstd��dS)NzFile not open for writing)r�rP)rDr_r?r?r@rdszFileIO._checkWritablecCsP|j�|j�|dks |dkr(|j�Sytj|j|�Stk
rJdSXdS)z�Read at most size bytes, returned as bytes.

        Only makes one system call, so less data may be returned than requested
        In non-blocking mode, returns None if no data is available.
        Return an empty bytes object at EOF.
        Nr)rZrbr�rrqr�r�)rDrmr?r?r@rqszFileIO.readcCs�|j�|j�t}y6tj|jdt�}tj|j�j}||krH||d}Wnt	k
r^YnXt
�}xnt|�|kr�t|�}|t|t�7}|t|�}ytj
|j|�}Wntk
r�|r�PdSX|s�P||7}qhWt|�S)z�Read all data from the file, returned as bytes.

        In non-blocking mode, returns as much as is immediately available,
        or None if no data is available.  Return an empty bytes object at EOF.
        rr
N)rZrbr(rr�r�rr)�st_sizer,rpr!r�rqr�r)rD�bufsizerV�endr<rlr�r?r?r@r�s4zFileIO.readallcCs4t|�jd�}|jt|��}t|�}||d|�<|S)zSame as RawIOBase.readinto().r�N)r�r�rqr!)rDr�mr�rlr?r?r@r�?s
zFileIO.readintocCs8|j�|j�ytj|j|�Stk
r2dSXdS)aWrite bytes b to file, return number written.

        Only makes one system call, so not all of the data may be written.
        The number of bytes actually written is returned.  In non-blocking mode,
        returns None if the write would block.
        N)rZrdrr}r�r�)rDrr?r?r@r}GszFileIO.writecCs*t|t�rtd��|j�tj|j||�S)a�Move to new file position.

        Argument offset is a byte count.  Optional argument whence defaults to
        SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values
        are SEEK_CUR or 1 (move relative to current position, positive or negative),
        and SEEK_END or 2 (move relative to end of file, usually negative, although
        many platforms allow seeking beyond the end of a file).

        Note that not all file objects are seekable.
        zan integer is required)rr�rrZrr�r�)rDrVrWr?r?r@rUUs
zFileIO.seekcCs|j�tj|jdt�S)zYtell() -> int.  Current file position.

        Can raise OSError for non seekable files.r)rZrr�r�r)rDr?r?r@rXeszFileIO.tellcCs2|j�|j�|dkr |j�}tj|j|�|S)z�Truncate the file to at most size bytes.

        Size defaults to the current file position, as returned by tell().
        The current file position is changed to the value of size.
        N)rZrdrXr�	ftruncater�)rDrmr?r?r@rYlszFileIO.truncatec
s.|js*z|jrtj|j�Wdt�j�XdS)z�Close the file.

        A closed file cannot be used for further I/O operations.  close() may be
        called more than once without error.
        N)rer�rr3r�r�)rD)rRr?r@r3ys
zFileIO.closecCsF|j�|jdkr@y|j�Wntk
r8d|_YnXd|_|jS)z$True if file supports random-access.NFT)rZ�	_seekablerXr,)rDr?r?r@r^�s
zFileIO.seekablecCs|j�|jS)z'True if file was opened in a read mode.)rZr�)rDr?r?r@ra�szFileIO.readablecCs|j�|jS)z(True if file was opened in a write mode.)rZr�)rDr?r?r@rc�szFileIO.writablecCs|j�|jS)z3Return the underlying file descriptor (an integer).)rZr�)rDr?r?r@r*�sz
FileIO.filenocCs|j�tj|j�S)z.True if the file is connected to a TTY device.)rZrr'r�)rDr?r?r@r'�sz
FileIO.isattycCs|jS)z6True if the file descriptor will be closed by close().)r�)rDr?r?r@r9�szFileIO.closefdcCsJ|jr|jrdSdSn0|jr,|jr&dSdSn|jrB|jr<dSdSndSdS)	zString giving the file modezxb+Zxbzab+Zabzrb+�rb�wbN)r�r�r�r�)rDr?r?r@r2�szFileIO.moder)rTN)N)N)N)"rHrIrJr�r�r�r�r�r�r�r�r]r�r�rbrdrqr�r�r}rrUrXrYr3r^rarcr*r'rr9r2r�r?r?)rRr@r&ns8
u

#


r&c@s`eZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
�Ze	dd��Z
e	dd��Ze	dd��ZdS)�
TextIOBasez�Base class for text I/O.

    This class provides a character and line based interface to stream
    I/O. There is no readinto method because Python's character strings
    are immutable. There is no public constructor.
    r
cCs|jd�dS)z�Read at most size characters from stream, where size is an int.

        Read from underlying buffer until we have size characters or we hit EOF.
        If size is negative or omitted, read until EOF.

        Returns a string.
        rqN)rT)rDrmr?r?r@rq�szTextIOBase.readcCs|jd�dS)z.Write string s to stream and returning an int.r}N)rT)rD�sr?r?r@r}�szTextIOBase.writeNcCs|jd�dS)z*Truncate size to pos, where pos is an int.rYN)rT)rDrVr?r?r@rY�szTextIOBase.truncatecCs|jd�dS)z_Read until newline or EOF.

        Returns an empty string if EOF is hit immediately.
        rtN)rT)rDr?r?r@rt�szTextIOBase.readlinecCs|jd�dS)z�
        Separate the underlying buffer from the TextIOBase and return it.

        After the underlying buffer has been detached, the TextIO is in an
        unusable state.
        r�N)rT)rDr?r?r@r��szTextIOBase.detachcCsdS)zSubclasses should override.Nr?)rDr?r?r@r6�szTextIOBase.encodingcCsdS)z�Line endings translated so far.

        Only line endings translated during reading are considered.

        Subclasses should override.
        Nr?)rDr?r?r@�newlines�szTextIOBase.newlinescCsdS)zMError setting of the decoder or encoder.

        Subclasses should override.Nr?)rDr?r?r@r7�szTextIOBase.errorsr)r)N)
rHrIrJrCrqr}rYrtr�rr6r�r7r?r?r?r@r��s


	
r�c@sTeZdZdZddd�Zddd�Zdd	�Zd
d�Zdd
�ZdZ	dZ
dZedd��Z
dS)�IncrementalNewlineDecodera+Codec used when reading a file in universal newlines mode.  It wraps
    another incremental decoder, translating \r\n and \r into \n.  It also
    records the types of newlines encountered.  When used with
    translate=False, it ensures that the newline sequence is returned in
    one piece.
    �strictcCs,tjj||d�||_||_d|_d|_dS)N)r7rF)�codecs�IncrementalDecoderr��	translate�decoder�seennl�	pendingcr)rDr�r�r7r?r?r@r�s
z"IncrementalNewlineDecoder.__init__FcCs�|jdkr|}n|jj||d�}|jr<|s.|r<d|}d|_|jd�r^|r^|dd�}d|_|jd�}|jd�|}|jd�|}|j|o�|j|o�|jB|o�|jBO_|j	r�|r�|j
dd�}|r�|j
dd�}|S)	N)�final�
Fr
Tz
�
r)r��decoder�rrr�r��_LF�_CR�_CRLFr��replace)rD�inputr��outputZcrlfZcrZlfr?r?r@r�s(

"z IncrementalNewlineDecoder.decodecCs@|jdkrd}d}n|jj�\}}|dK}|jr8|dO}||fS)Nr�rr
)r��getstater�)rDr��flagr?r?r@r2s
z"IncrementalNewlineDecoder.getstatecCs8|\}}t|d@�|_|jdk	r4|jj||d?f�dS)Nr
)�boolr�r��setstate)rD�stater�rr?r?r@r=s
z"IncrementalNewlineDecoder.setstatecCs$d|_d|_|jdk	r |jj�dS)NrF)r�r�r��reset)rDr?r?r@rCs
zIncrementalNewlineDecoder.resetr
r�c
Cs
d|jS)	Nr�r��
�r�r��r�r�r�r�r�r�r)Nr�r�r	rr
rr)r�)rDr?r?r@r�Msz"IncrementalNewlineDecoder.newlinesN)r�)F)rHrIrJrCr�r�rrrr�r�r�rr�r?r?r?r@r�s

r�c@s>eZdZdZdZdFdd�Zdd�Zed	d
��Zedd��Z	ed
d��Z
edd��Zdd�Zdd�Z
dd�Zdd�Zdd�Zedd��Zedd��Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�ZdGd+d,�Zd-d.�Zd/d0�ZdHd2d3�Zd4d5�Zd6d7�ZdId8d9�Zd:d;�Z dJd<d=�Z!dKd>d?�Z"d@dA�Z#dLdBdC�Z$edDdE��Z%dS)Mr1aCharacter and line based layer over a BufferedIOBase object, buffer.

    encoding gives the name of the encoding that the stream will be
    decoded or encoded with. It defaults to locale.getpreferredencoding(False).

    errors determines the strictness of encoding and decoding (see the
    codecs.register) and defaults to "strict".

    newline can be None, '', '\n', '\r', or '\r\n'.  It controls the
    handling of line endings. If it is None, universal newlines is
    enabled.  With this enabled, on input, the lines endings '\n', '\r',
    or '\r\n' are translated to '\n' before being returned to the
    caller. Conversely, on output, '\n' is translated to the system
    default line separator, os.linesep. If newline is any other of its
    legal values, that newline becomes the newline when the file is read
    and it is returned untranslated. On output, '\n' is converted to the
    newline.

    If line_buffering is True, a call to flush is implied when a call to
    write contains a newline character.
    iNFc
Cs�|dk	r&t|t�r&tdt|�f��|dkr<td|f��|dkr�ytj|j��}Wntt	fk
rnYnX|dkr�yddl
}Wntk
r�d}YnX|jd	�}t|t�s�td
|��t
j|�js�d}t||��|dkr�d}nt|t��std
|��||_||_||_||_||_|dk|_||_|dk|_|�pDtj|_d|_d|_d|_d|_d|_|j j!�|_"|_#t$|j d�|_%d|_&|j"�r�|j'��r�|j j(�}	|	dk�r�y|j)�j*d�Wntk
�r�YnXdS)Nzillegal newline type: %rrr�r��
zillegal newline value: %rr�asciiFzinvalid encoding: %rzG%r is not a text encoding; use codecs.open() to handle arbitrary codecsr�zinvalid errors: %rr�g)Nrr�r�r
)+rrr�typer"r�device_encodingr*r-rP�locale�ImportError�getpreferredencodingr��lookup�_is_text_encoding�LookupErrorr��_line_buffering�	_encoding�_errors�_readuniversal�_readtranslate�_readnl�_writetranslate�linesep�_writenl�_encoder�_decoder�_decoded_chars�_decoded_chars_used�	_snapshotr>r^r��_tellingro�
_has_read1�	_b2cratiorcrX�_get_encoderr)
rDr>r6r7r8r=�
write_throughrr_�positionr?r?r@r�ws`






zTextIOWrapper.__init__cCs�dj|jj|jj�}y
|j}Wntk
r2YnX|dj|�7}y
|j}Wntk
r`YnX|dj|�7}|dj|j�S)Nz<{}.{}z name={0!r}z mode={0!r}z encoding={0!r}>)r�rRrIrJrSr�r2r6)rDr<rSr2r?r?r@r��s



zTextIOWrapper.__repr__cCs|jS)N)r)rDr?r?r@r6�szTextIOWrapper.encodingcCs|jS)N)r)rDr?r?r@r7�szTextIOWrapper.errorscCs|jS)N)r)rDr?r?r@r=�szTextIOWrapper.line_bufferingcCs|jS)N)r�)rDr?r?r@r>�szTextIOWrapper.buffercCs|jrtd��|jS)NzI/O operation on closed file.)rer"r�)rDr?r?r@r^�szTextIOWrapper.seekablecCs
|jj�S)N)r>ra)rDr?r?r@ra�szTextIOWrapper.readablecCs
|jj�S)N)r>rc)rDr?r?r@rc�szTextIOWrapper.writablecCs|jj�|j|_dS)N)r>r[r�r%)rDr?r?r@r[�s
zTextIOWrapper.flushc
Cs0|jdk	r,|jr,z|j�Wd|jj�XdS)N)r>rer[r3)rDr?r?r@r3�szTextIOWrapper.closecCs|jjS)N)r>re)rDr?r?r@re�szTextIOWrapper.closedcCs|jjS)N)r>rS)rDr?r?r@rS�szTextIOWrapper.namecCs
|jj�S)N)r>r*)rDr?r?r@r*�szTextIOWrapper.filenocCs
|jj�S)N)r>r')rDr?r?r@r'�szTextIOWrapper.isattycCs�|jrtd��t|t�s(td|jj��t|�}|js<|j	oBd|k}|rf|jrf|j
dkrf|jd|j
�}|jpr|j
�}|j|�}|jj|�|j	r�|s�d|kr�|j�|jd�d|_|jr�|jj�|S)zWrite data, where s is a strzwrite to closed filezcan't write %s to text streamr�r�rN)rer"rrrrRrHr!rrrr�r r(�encoder>r}r[�_set_decoded_charsr$r!r)rDr�ZlengthZhaslf�encoderrr?r?r@r}s&



zTextIOWrapper.writecCstj|j�}||j�|_|jS)N)r��getincrementalencoderrrr )rDZmake_encoderr?r?r@r(szTextIOWrapper._get_encodercCs2tj|j�}||j�}|jr(t||j�}||_|S)N)r��getincrementaldecoderrrrr�rr!)rDZmake_decoderr�r?r?r@�_get_decoders
zTextIOWrapper._get_decodercCs||_d|_dS)zSet the _decoded_chars buffer.rN)r"r#)rD�charsr?r?r@r,)sz TextIOWrapper._set_decoded_charscCsF|j}|dkr|j|d�}n|j|||�}|jt|�7_|S)z'Advance into the _decoded_chars buffer.N)r#r"r!)rDrl�offsetr1r?r?r@�_get_decoded_chars.sz TextIOWrapper._get_decoded_charscCs$|j|krtd��|j|8_dS)z!Rewind the _decoded_chars buffer.z"rewind decoded_chars out of boundsN)r#�AssertionError)rDrlr?r?r@�_rewind_decoded_chars8s
z#TextIOWrapper._rewind_decoded_charscCs�|jdkrtd��|jr&|jj�\}}|jr<|jj|j�}n|jj|j�}|}|jj	||�}|j
|�|r�t|�t|j�|_
nd|_
|jr�|||f|_|S)zQ
        Read and decode the next chunk of data from the BufferedReader.
        Nz
no decoderg)r!r"r%rr&r>r��_CHUNK_SIZErqr�r,r!r"r'r$)rD�
dec_buffer�	dec_flags�input_chunk�eofZ
decoded_charsr?r?r@�_read_chunk>s 

zTextIOWrapper._read_chunkrcCs(||d>B|d>B|d>Bt|�d>BS)N�@���)r)rDr*r8�
bytes_to_feed�need_eof�
chars_to_skipr?r?r@�_pack_cookiehszTextIOWrapper._pack_cookiecCsFt|d�\}}t|d�\}}t|d�\}}t|d�\}}|||||fS)Nr
r<llll)�divmod)rDZbigint�restr*r8r@rArBr?r?r@�_unpack_cookiers
zTextIOWrapper._unpack_cookiecCs>|jstd��|jstd��|j�|jj�}|j}|dksF|jdkrX|j	rTt
d��|S|j\}}|t|�8}|j}|dkr�|j
||�S|j�}�z�t|j|�}d}x�|dk�r$|jd|f�t|j|d|���}	|	|k�r|j�\}
}|
�s|}||	8}P|t|
�8}d}q�||8}|d}q�Wd}|jd|f�||}|}
|dk�rZ|j
||
�Sd}d}d}x�t|t|��D]v}|d7}|t|j|||d���7}|j�\}}|�r�||k�r�||7}||8}|dd}
}}||k�rvP�qvW|t|jddd	��7}d}||k�rtd
��|j
||
|||�S|j|�XdS)Nz!underlying stream is not seekablez(telling position disabled by next() callzpending decoded textrr
r�rT)r�z'can't reconstruct logical file position)r�rPr%r,r[r>rXr!r$r"r4r!r#rCrrr'rr��range)rDr*r�r8Z
next_inputrBZsaved_stateZ
skip_bytesZ	skip_backrlr�d�	start_posZstart_flagsZ	bytes_fedrAZ
chars_decoded�ir7r?r?r@rXysv





zTextIOWrapper.tellcCs$|j�|dkr|j�}|jj|�S)N)r[rXr>rY)rDrVr?r?r@rY�szTextIOWrapper.truncatecCs*|jdkrtd��|j�|j}d|_|S)Nzbuffer is already detached)r>r"r[r�)rDr>r?r?r@r��s
zTextIOWrapper.detachcs��fdd�}�jrtd���js(td��|dkrL|dkr@td��d}�j�}|dkr�|dkrdtd	���j��jjdd�}�jd
�d�_	�j
r��j
j�||�|S|dkr�td|f��|dkr�td|f���j��j|�\}}}}}	�jj|��jd
�d�_	|dk�r(�j
�r(�j
j�n@�j
�s<|�s<|	�rh�j
�pJ�j
��_
�j
jd
|f�|d
f�_	|	�r��jj|�}
�j�j
j|
|��||
f�_	t�j�|	k�r�td��|	�_||�|S)NcsHy�jp�j�}Wntk
r&YnX|dkr<|jd�n|j�dS)z9Reset the encoder (merely useful for proper BOM handling)rN)r r(rrr)r*r-)rDr?r@�_reset_encoder�sz*TextIOWrapper.seek.<locals>._reset_encoderztell on closed filez!underlying stream is not seekabler
rz#can't do nonzero cur-relative seeksrz#can't do nonzero end-relative seeksrzunsupported whence (%r)znegative seek position %rr�z#can't restore logical file position)rer"r�rPrXr[r>rUr,r$r!rrFr0rrqr�r!r"r,r#)rDZcookierWrKr*rIr8r@rArBr9r?)rDr@rU�s\





zTextIOWrapper.seekcCs�|j�|dkrd}|jp |j�}y
|jWn,tk
rX}ztd�|�WYdd}~XnX|dkr�|j�|j|jj	�dd�}|j
d�d|_|Sd}|j|�}x6t|�|kr�|r�|j
�}||j|t|��7}q�W|SdS)	Nr
zan integer is requiredrT)r�rFr)rbr!r0r�r-rr3r�r>rqr,r$r!r;)rDrmr�r�r<r:r?r?r@rq5	s(



zTextIOWrapper.readcCs(d|_|j�}|s$d|_|j|_t�|S)NF)r%rtr$r�rv)rDrwr?r?r@rxN	szTextIOWrapper.__next__cCs�|jrtd��|dkrd	}nt|t�s.td��|j�}d}|jsH|j�d}}�xR|jr�|j	d|�}|dkrz|d}Pnt
|�}n�|j�r|j	d|�}|j	d|�}|d
kr�|dkr�t
|�}n
|d}PnL|dkr�|d}Pn8||kr�|d}Pn$||dk�r|d}Pn
|d}Pn&|j	|j�}|dk�r>|t
|j�}P|dk�r\t
|�|k�r\|}Px|j
��rv|j�r^P�q^W|j�r�||j�7}qT|jd�d|_|SqTW|dk�r�||k�r�|}|jt
|�|�|d|�S)
Nzread from closed filer
zsize must be an integerrr�r�rrrrrr)rer"rrrr3r!r0rrjr!rrr;r"r,r$r5)rDrmrw�startrV�endposZnlposZcrposr?r?r@rtW	sp




zTextIOWrapper.readlinecCs|jr|jjSdS)N)r!r�)rDr?r?r@r��	szTextIOWrapper.newlines)NNNFF)N)rrrr)N)r)N)N)&rHrIrJrCr6r�r�rr6r7r=r>r^rarcr[r3rerSr*r'r}r(r0r,r3r5r;rCrFrXrYr�rUrqrxrtr�r?r?r?r@r1ZsH
E

*
	c

K
	
Xr1csReZdZdZd�fdd�	Zdd�Zdd	�Zed
d��Zedd
��Z	dd�Z
�ZS)�StringIOz�Text I/O implementation using an in-memory buffer.

    The initial_value argument sets the value of object.  The newline
    argument is like the one of TextIOWrapper's constructor.
    rr�csftt|�jt�dd|d�|dkr(d|_|dk	rbt|t�sNtdjt	|�j
���|j|�|jd�dS)Nzutf-8�
surrogatepass)r6r7r8Fz*initial_value must be str or None, not {0}r)
r�rNr�r�rrrrr�rrHr}rU)rDZ
initial_valuer8)rRr?r@r��	s

zStringIO.__init__cCsL|j�|jp|j�}|j�}|j�z|j|jj�dd�S|j|�XdS)NT)r�)	r[r!r0rrr�r>r�r)rDr�Z	old_stater?r?r@r��	szStringIO.getvaluecCs
tj|�S)N)�objectr�)rDr?r?r@r��	szStringIO.__repr__cCsdS)Nr?)rDr?r?r@r7�	szStringIO.errorscCsdS)Nr?)rDr?r?r@r6�	szStringIO.encodingcCs|jd�dS)Nr�)rT)rDr?r?r@r��	szStringIO.detach)rr�)rHrIrJrCr�r�r�rr7r6r�r�r?r?)rRr@rN�	s
rN>rri r)rrNNNTN)5rCr�abcr�r�r��sys�_threadrr�rZ
_dummy_thread�platformZmsvcrtrr��iorrrr	r�ro�addr�	SEEK_DATAr(r�rArBrKrPr-r,r"�ABCMetarQ�registerr��_ior&r�r�r�r0r/r�r.r�r�r�r1rNr?r?r?r@�<module>sv



T	
=
giCZIJUAU^fileinput.cpython-36.pyc000064400000031542150335715140011202 0ustar003


 \�8�@s�dZddlZddlZddddddd	d
ddd
dgZdad!dd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd	�Zdd
�Zdd�Z
Gdd�d�Zdd
�Zd"dd�Zdd�Zed kr�e�dS)#a�Helper class to quickly write a loop over all standard input files.

Typical use is:

    import fileinput
    for line in fileinput.input():
        process(line)

This iterates over the lines of all files listed in sys.argv[1:],
defaulting to sys.stdin if the list is empty.  If a filename is '-' it
is also replaced by sys.stdin.  To specify an alternative list of
filenames, pass it as the argument to input().  A single file name is
also allowed.

Functions filename(), lineno() return the filename and cumulative line
number of the line that has just been read; filelineno() returns its
line number in the current file; isfirstline() returns true iff the
line just read is the first line of its file; isstdin() returns true
iff the line was read from sys.stdin.  Function nextfile() closes the
current file so that the next iteration will read the first line from
the next file (if any); lines not read from the file will not count
towards the cumulative line count; the filename is not changed until
after the first line of the next file has been read.  Function close()
closes the sequence.

Before any lines have been read, filename() returns None and both line
numbers are zero; nextfile() has no effect.  After all lines have been
read, filename() and the line number functions return the values
pertaining to the last line read; nextfile() has no effect.

All files are opened in text mode by default, you can override this by
setting the mode parameter to input() or FileInput.__init__().
If an I/O error occurs during opening or reading a file, the OSError
exception is raised.

If sys.stdin is used more than once, the second and further use will
return no lines, except perhaps for interactive use, or if it has been
explicitly reset (e.g. using sys.stdin.seek(0)).

Empty files are opened and immediately closed; the only time their
presence in the list of filenames is noticeable at all is when the
last file opened is empty.

It is possible that the last line of a file doesn't end in a newline
character; otherwise lines are returned including the trailing
newline.

Class FileInput is the implementation; its methods filename(),
lineno(), fileline(), isfirstline(), isstdin(), nextfile() and close()
correspond to the functions in the module.  In addition it has a
readline() method which returns the next input line, and a
__getitem__() method which implements the sequence behavior.  The
sequence must be accessed in strictly sequential order; sequence
access and readline() cannot be mixed.

Optional in-place filtering: if the keyword argument inplace=1 is
passed to input() or to the FileInput constructor, the file is moved
to a backup file and standard output is directed to the input file.
This makes it possible to write a filter that rewrites its input file
in place.  If the keyword argument backup=".<some extension>" is also
given, it specifies the extension for the backup file, and the backup
file remains around; by default, the extension is ".bak" and it is
deleted when the output file is closed.  In-place filtering is
disabled when standard input is read.  XXX The current implementation
does not work for MS-DOS 8+3 filesystems.

XXX Possible additions:

- optional getopt argument processing
- isatty()
- read(), read(size), even readlines()

�N�input�close�nextfile�filename�lineno�
filelineno�fileno�isfirstline�isstdin�	FileInput�hook_compressed�hook_encodedF��rcCs(trtjrtd��t||||||�atS)aReturn an instance of the FileInput class, which can be iterated.

    The parameters are passed to the constructor of the FileInput class.
    The returned instance, in addition to being an iterator,
    keeps global state for the functions of this module,.
    zinput() already active)�_state�_file�RuntimeErrorr)�files�inplace�backup�bufsize�mode�openhook�r�!/usr/lib64/python3.6/fileinput.pyrSs	
cCst}da|r|j�dS)zClose the sequence.N)rr)�staterrrrascCststd��tj�S)a�
    Close the current file so that the next iteration will read the first
    line from the next file (if any); lines not read from the file will
    not count towards the cumulative line count. The filename is not
    changed until after the first line of the next file has been read.
    Before the first line has been read, this function has no effect;
    it cannot be used to skip the first file. After the last line of the
    last file has been read, this function has no effect.
    zno active input())rrrrrrrris
cCststd��tj�S)zr
    Return the name of the file currently being read.
    Before the first line has been read, returns None.
    zno active input())rrrrrrrrwscCststd��tj�S)z�
    Return the cumulative line number of the line that has just been read.
    Before the first line has been read, returns 0. After the last line
    of the last file has been read, returns the line number of that line.
    zno active input())rrrrrrrr�scCststd��tj�S)z�
    Return the line number in the current file. Before the first line
    has been read, returns 0. After the last line of the last file has
    been read, returns the line number of that line within the file.
    zno active input())rrrrrrrr�scCststd��tj�S)zg
    Return the file number of the current file. When no file is currently
    opened, returns -1.
    zno active input())rrrrrrrr�scCststd��tj�S)ze
    Returns true the line just read is the first line of its file,
    otherwise returns false.
    zno active input())rrr	rrrrr	�scCststd��tj�S)z]
    Returns true if the last line was read from sys.stdin,
    otherwise returns false.
    zno active input())rrr
rrrrr
�sc@s�eZdZdZd)dd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�ZdS)*ra?FileInput([files[, inplace[, backup[, bufsize, [, mode[, openhook]]]]]])

    Class FileInput is the implementation of the module; its methods
    filename(), lineno(), fileline(), isfirstline(), isstdin(), fileno(),
    nextfile() and close() correspond to the functions of the same name
    in the module.
    In addition it has a readline() method which returns the next
    input line, and a __getitem__() method which implements the
    sequence behavior. The sequence must be accessed in strictly
    sequential order; random access and readline() cannot be mixed.
    NFrrrcCs�t|t�r|f}n(|dkr(tjdd�}|s2d}nt|�}||_||_||_|rhddl}|j	dt
dd�d|_d|_d|_
d|_d|_d|_d|_d|_|dkr�td��d
|kr�ddl}|j	d
t
d�||_|r�|r�td��t|�s�td��||_dS)N��-rz!bufsize is deprecated and ignored�)�
stacklevelFr�rU�U�rbz=FileInput opening mode must be one of 'r', 'rU', 'U' and 'rb'z'U' mode is deprecatedz4FileInput cannot use an opening hook in inplace modez#FileInput openhook must be callable)r)rr r!r")�
isinstance�str�sys�argv�tuple�_files�_inplace�_backup�warnings�warn�DeprecationWarning�_savestdout�_output�	_filename�_startlineno�_filelinenor�_isstdin�_backupfilename�
ValueError�_mode�callable�	_openhook)�selfrrrrrrr+rrr�__init__�sF

zFileInput.__init__cCs|j�dS)N)r)r9rrr�__del__�szFileInput.__del__cCsz|j�Wdf|_XdS)N)rr()r9rrrr�szFileInput.closecCs|S)Nr)r9rrr�	__enter__�szFileInput.__enter__cCs|j�dS)N)r)r9�type�value�	tracebackrrr�__exit__�szFileInput.__exit__cCs|S)Nr)r9rrr�__iter__�szFileInput.__iter__cCs:x4|j�}|r |jd7_|S|js*t�|j�qWdS)Nr)�	_readliner2r�
StopIterationr)r9�linerrr�__next__�szFileInput.__next__cCs>||j�krtd��y|j�Stk
r8td��YnXdS)Nzaccessing lines out of orderzend of input reached)rrrErC�
IndexError)r9�irrr�__getitem__szFileInput.__getitem__c%Cs�|j}d|_|r|t_|j}d|_z|r0|j�Wd|j}d|_y|`Wntk
r\YnXz|rt|jrt|j�Wd|j	}d|_	|r�|j
r�ytj|�Wnt
k
r�YnXd|_XXdS)NF)r.r%�stdoutr/rrrB�AttributeErrorr3r4r*�os�unlink�OSError)r9Z
savestdout�output�fileZbackupfilenamerrrrs4zFileInput.nextfilecCs:x4|j�}|r |jd7_|S|js*|S|j�qWdS)Nr)rBr2rr)r9rDrrr�readline)szFileInput.readlinecCs�|jsd|jkrdSdS|jd|_|jdd�|_|j�|_d|_d|_d|_d|_|jdkr�d|_d|jkr�t	t
jd	t
j�|_nt
j|_d
|_�nV|j�r�|j|j
p�d|_ytj|j�Wntk
r�YnXtj|j|j�t|j|j�|_ytj|jj��j}Wn$tk
�r0t|jd�|_Yn~XtjtjBtjB}ttd
��rZ|tjO}tj|j||�}tj|d�|_yttd��r�tj|j|�Wntk
�r�YnXt
j|_|jt
_n,|j �r�|j |j|j�|_nt|j|j�|_|jj!|_"|j"�S)N�b�rrrFrz<stdin>�bufferTz.bak�w�O_BINARY�chmod)#r(r6r0rr1r2rr3r4�getattrr%�stdinr)r*rKrLrM�rename�open�fstatr�st_moder/�O_CREAT�O_WRONLY�O_TRUNC�hasattrrU�fdopenrVrIr.r8rPrB)r9Zpermr�fdrrrrB4s\







zFileInput._readlinecCs|jS)N)r0)r9rrrrnszFileInput.filenamecCs|j|jS)N)r1r2)r9rrrrqszFileInput.linenocCs|jS)N)r2)r9rrrrtszFileInput.filelinenocCs0|jr(y
|jj�Stk
r$dSXndSdS)Nr���rc)rrr5)r9rrrrws
zFileInput.filenocCs
|jdkS)Nr)r2)r9rrrr	�szFileInput.isfirstlinecCs|jS)N)r3)r9rrrr
�szFileInput.isstdin)NFrrrN)�__name__�
__module__�__qualname__�__doc__r:r;rr<r@rArErHrrPrBrrrrr	r
rrrrr�s&
):	cCsVtjj|�d}|dkr,ddl}|j||�S|dkrHddl}|j||�St||�SdS)Nrz.gzrz.bz2)rK�path�splitext�gziprZ�bz2ZBZ2File)rrZextrjrkrrrr�scs��fdd�}|S)Ncst||��d�S)N)�encoding�errors)rZ)rr)rlrmrrr�szhook_encoded.<locals>.openhookr)rlrmrr)rlrmrr
�scCs�ddl}d}d}|jtjdd�d�\}}x(|D] \}}|dkrDd}|dkr0|}q0Wxtt|||d�D]b}|dd�d	kr�|dd�}|dd�d
kr�|dd�}tdt�t�t�t�r�dp�d
|f�qdWtdt�t�t�f�dS)NrFrzib:z-iTz-b)rr�
�
z%d: %s[%d]%s %s�*rz
%d: %s[%d]rcrcrcrc)	�getoptr%r&r�printrrrr	)rqrrZopts�args�o�arDrrr�_test�s"rv�__main__)NFrrrN)N)rgr%rK�__all__rrrrrrrrr	r
rrr
rvrdrrrr�<module>Is,


	

			Y
difflib.cpython-36.pyc000064400000164374150335715140010614 0ustar003


 \�I�@s8dZddddddddd	d
ddgZd
dlmZd
dlmZedd�Zdd�Z	Gdd�d�Z
d8dd�Zdd�ZGdd�d�Z
d
dlZejd�jfdd�Zd9dd�Zdd �Zd:d#d	�Zd$d%�Zd;d&d�Zd'd(�Zd<d+d
�Zdefd,d�Zddefd-d.�Zd/Zd0Zd1Zd2ZGd3d�de�Z [d4d�Z!d5d6�Z"e#d7k�r4e"�dS)=ae
Module difflib -- helpers for computing deltas between objects.

Function get_close_matches(word, possibilities, n=3, cutoff=0.6):
    Use SequenceMatcher to return list of the best "good enough" matches.

Function context_diff(a, b):
    For two lists of strings, return a delta in context diff format.

Function ndiff(a, b):
    Return a delta: the difference between `a` and `b` (lists of strings).

Function restore(delta, which):
    Return one of the two sequences that generated an ndiff delta.

Function unified_diff(a, b):
    For two lists of strings, return a delta in unified diff format.

Class SequenceMatcher:
    A flexible class for comparing pairs of sequences of any type.

Class Differ:
    For producing human-readable deltas from sequences of lines of text.

Class HtmlDiff:
    For producing HTML side by side comparison with change highlights.
�get_close_matches�ndiff�restore�SequenceMatcher�Differ�IS_CHARACTER_JUNK�IS_LINE_JUNK�context_diff�unified_diff�
diff_bytes�HtmlDiff�Match�)�nlargest)�
namedtupleza b sizecCs|rd||SdS)Ng@g�?�)�matches�lengthrr�/usr/lib64/python3.6/difflib.py�_calculate_ratio&src@steZdZdZddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zddd�Zdd�Z
dd�Zdd�ZdS) ra�
    SequenceMatcher is a flexible class for comparing pairs of sequences of
    any type, so long as the sequence elements are hashable.  The basic
    algorithm predates, and is a little fancier than, an algorithm
    published in the late 1980's by Ratcliff and Obershelp under the
    hyperbolic name "gestalt pattern matching".  The basic idea is to find
    the longest contiguous matching subsequence that contains no "junk"
    elements (R-O doesn't address junk).  The same idea is then applied
    recursively to the pieces of the sequences to the left and to the right
    of the matching subsequence.  This does not yield minimal edit
    sequences, but does tend to yield matches that "look right" to people.

    SequenceMatcher tries to compute a "human-friendly diff" between two
    sequences.  Unlike e.g. UNIX(tm) diff, the fundamental notion is the
    longest *contiguous* & junk-free matching subsequence.  That's what
    catches peoples' eyes.  The Windows(tm) windiff has another interesting
    notion, pairing up elements that appear uniquely in each sequence.
    That, and the method here, appear to yield more intuitive difference
    reports than does diff.  This method appears to be the least vulnerable
    to synching up on blocks of "junk lines", though (like blank lines in
    ordinary text files, or maybe "<P>" lines in HTML files).  That may be
    because this is the only method of the 3 that has a *concept* of
    "junk" <wink>.

    Example, comparing two strings, and considering blanks to be "junk":

    >>> s = SequenceMatcher(lambda x: x == " ",
    ...                     "private Thread currentThread;",
    ...                     "private volatile Thread currentThread;")
    >>>

    .ratio() returns a float in [0, 1], measuring the "similarity" of the
    sequences.  As a rule of thumb, a .ratio() value over 0.6 means the
    sequences are close matches:

    >>> print(round(s.ratio(), 3))
    0.866
    >>>

    If you're only interested in where the sequences match,
    .get_matching_blocks() is handy:

    >>> for block in s.get_matching_blocks():
    ...     print("a[%d] and b[%d] match for %d elements" % block)
    a[0] and b[0] match for 8 elements
    a[8] and b[17] match for 21 elements
    a[29] and b[38] match for 0 elements

    Note that the last tuple returned by .get_matching_blocks() is always a
    dummy, (len(a), len(b), 0), and this is the only case in which the last
    tuple element (number of elements matched) is 0.

    If you want to know how to change the first sequence into the second,
    use .get_opcodes():

    >>> for opcode in s.get_opcodes():
    ...     print("%6s a[%d:%d] b[%d:%d]" % opcode)
     equal a[0:8] b[0:8]
    insert a[8:8] b[8:17]
     equal a[8:29] b[17:38]

    See the Differ class for a fancy human-friendly file differencer, which
    uses SequenceMatcher both to compare sequences of lines, and to compare
    sequences of characters within similar (near-matching) lines.

    See also function get_close_matches() in this module, which shows how
    simple code building on SequenceMatcher can be used to do useful work.

    Timing:  Basic R-O is cubic time worst case and quadratic time expected
    case.  SequenceMatcher is quadratic time for the worst case and has
    expected-case behavior dependent in a complicated way on how many
    elements the sequences have in common; best case time is linear.

    Methods:

    __init__(isjunk=None, a='', b='')
        Construct a SequenceMatcher.

    set_seqs(a, b)
        Set the two sequences to be compared.

    set_seq1(a)
        Set the first sequence to be compared.

    set_seq2(b)
        Set the second sequence to be compared.

    find_longest_match(alo, ahi, blo, bhi)
        Find longest matching block in a[alo:ahi] and b[blo:bhi].

    get_matching_blocks()
        Return list of triples describing matching subsequences.

    get_opcodes()
        Return list of 5-tuples describing how to turn a into b.

    ratio()
        Return a measure of the sequences' similarity (float in [0,1]).

    quick_ratio()
        Return an upper bound on .ratio() relatively quickly.

    real_quick_ratio()
        Return an upper bound on ratio() very quickly.
    N�TcCs(||_d|_|_||_|j||�dS)a!Construct a SequenceMatcher.

        Optional arg isjunk is None (the default), or a one-argument
        function that takes a sequence element and returns true iff the
        element is junk.  None is equivalent to passing "lambda x: 0", i.e.
        no elements are considered to be junk.  For example, pass
            lambda x: x in " \t"
        if you're comparing lines as sequences of characters, and don't
        want to synch up on blanks or hard tabs.

        Optional arg a is the first of two sequences to be compared.  By
        default, an empty string.  The elements of a must be hashable.  See
        also .set_seqs() and .set_seq1().

        Optional arg b is the second of two sequences to be compared.  By
        default, an empty string.  The elements of b must be hashable. See
        also .set_seqs() and .set_seq2().

        Optional arg autojunk should be set to False to disable the
        "automatic junk heuristic" that treats popular elements as junk
        (see module documentation for more information).
        N)�isjunk�a�b�autojunk�set_seqs)�selfrrrrrrr�__init__�s;zSequenceMatcher.__init__cCs|j|�|j|�dS)z�Set the two sequences to be compared.

        >>> s = SequenceMatcher()
        >>> s.set_seqs("abcd", "bcde")
        >>> s.ratio()
        0.75
        N)�set_seq1�set_seq2)rrrrrrr�s	
zSequenceMatcher.set_seqscCs$||jkrdS||_d|_|_dS)aMSet the first sequence to be compared.

        The second sequence to be compared is not changed.

        >>> s = SequenceMatcher(None, "abcd", "bcde")
        >>> s.ratio()
        0.75
        >>> s.set_seq1("bcde")
        >>> s.ratio()
        1.0
        >>>

        SequenceMatcher computes and caches detailed information about the
        second sequence, so if you want to compare one sequence S against
        many sequences, use .set_seq2(S) once and call .set_seq1(x)
        repeatedly for each of the other sequences.

        See also set_seqs() and set_seq2().
        N)r�matching_blocks�opcodes)rrrrrr�s
zSequenceMatcher.set_seq1cCs2||jkrdS||_d|_|_d|_|j�dS)aMSet the second sequence to be compared.

        The first sequence to be compared is not changed.

        >>> s = SequenceMatcher(None, "abcd", "bcde")
        >>> s.ratio()
        0.75
        >>> s.set_seq2("abcd")
        >>> s.ratio()
        1.0
        >>>

        SequenceMatcher computes and caches detailed information about the
        second sequence, so if you want to compare one sequence S against
        many sequences, use .set_seq2(S) once and call .set_seq1(x)
        repeatedly for each of the other sequences.

        See also set_seqs() and set_seq1().
        N)rrr �
fullbcount�_SequenceMatcher__chain_b)rrrrrr�s
zSequenceMatcher.set_seq2cCs�|j}i|_}x*t|�D]\}}|j|g�}|j|�qWt�|_}|j}|r�x"|j�D]}||�r\|j	|�q\Wx|D]
}||=q|Wt�|_
}t|�}	|jr�|	dkr�|	dd}
x*|j
�D]\}}t|�|
kr�|j	|�q�Wx|D]
}||=q�WdS)N���d�)r�b2j�	enumerate�
setdefault�append�set�bjunkr�keys�addZbpopular�lenr�items)rrr&�i�elt�indicesZjunkrZpopular�nZntestZidxsrrrZ	__chain_b)s,



zSequenceMatcher.__chain_bcCsN|j|j|j|jjf\}}}}||d}	}
}i}g}
x�t||�D]�}|j}i}xn|j|||
�D]Z}||krpqb||krzP||dd�d}||<||krb||d||d|}	}
}qbW|}qBWxb|	|k�r*|
|k�r*|||
d��r*||	d||
dk�r*|	d|
d|d}	}
}q�WxX|	||k�r�|
||k�r�|||
|��r�||	|||
|k�r�|d7}�q.Wxb|	|k�r�|
|k�r�|||
d��r�||	d||
dk�r�|	d|
d|d}	}
}�q�WxV|	||k�r@|
||k�r@|||
|��r@||	|||
|k�r@|d}�q�Wt|	|
|�S)a�Find longest matching block in a[alo:ahi] and b[blo:bhi].

        If isjunk is not defined:

        Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where
            alo <= i <= i+k <= ahi
            blo <= j <= j+k <= bhi
        and for all (i',j',k') meeting those conditions,
            k >= k'
            i <= i'
            and if i == i', j <= j'

        In other words, of all maximal matching blocks, return one that
        starts earliest in a, and of all those maximal matching blocks that
        start earliest in a, return the one that starts earliest in b.

        >>> s = SequenceMatcher(None, " abcd", "abcd abcd")
        >>> s.find_longest_match(0, 5, 0, 9)
        Match(a=0, b=4, size=5)

        If isjunk is defined, first the longest matching block is
        determined as above, but with the additional restriction that no
        junk element appears in the block.  Then that block is extended as
        far as possible by matching (only) junk elements on both sides.  So
        the resulting block never matches on junk except as identical junk
        happens to be adjacent to an "interesting" match.

        Here's the same example as before, but considering blanks to be
        junk.  That prevents " abcd" from matching the " abcd" at the tail
        end of the second sequence directly.  Instead only the "abcd" can
        match, and matches the leftmost "abcd" in the second sequence:

        >>> s = SequenceMatcher(lambda x: x==" ", " abcd", "abcd abcd")
        >>> s.find_longest_match(0, 5, 0, 9)
        Match(a=1, b=0, size=4)

        If no blocks match, return (alo, blo, 0).

        >>> s = SequenceMatcher(None, "ab", "c")
        >>> s.find_longest_match(0, 2, 0, 1)
        Match(a=0, b=0, size=0)
        r
r%)rrr&r+�__contains__�range�getr)r�alo�ahi�blo�bhirrr&ZisbjunkZbestiZbestjZbestsizeZj2lenZnothingr0Zj2lengetZnewj2len�j�krrr�find_longest_matchPsB8$ 	"z"SequenceMatcher.find_longest_matchcCs�|jdk	r|jSt|j�t|j�}}d|d|fg}g}x�|r�|j�\}}}}|j||||�\}	}
}}|r:|j|�||	kr�||
kr�|j||	||
f�|	||kr:|
||kr:|j|	|||
||f�q:W|j�d}
}}g}x^|D]V\}}}|
||k�r|||k�r||7}q�|�r2|j|
||f�|||}
}}q�W|�r\|j|
||f�|j||df�tt	t
j|��|_|jS)aReturn list of triples describing matching subsequences.

        Each triple is of the form (i, j, n), and means that
        a[i:i+n] == b[j:j+n].  The triples are monotonically increasing in
        i and in j.  New in Python 2.5, it's also guaranteed that if
        (i, j, n) and (i', j', n') are adjacent triples in the list, and
        the second is not the last triple in the list, then i+n != i' or
        j+n != j'.  IOW, adjacent triples never describe adjacent equal
        blocks.

        The last triple is a dummy, (len(a), len(b), 0), and is the only
        triple with n==0.

        >>> s = SequenceMatcher(None, "abxcd", "abcd")
        >>> list(s.get_matching_blocks())
        [Match(a=0, b=0, size=2), Match(a=3, b=2, size=2), Match(a=5, b=4, size=0)]
        Nr
)rr.rr�popr=r)�sort�list�mapr�_make)r�la�lbZqueuerr7r8r9r:r0r;r<�x�i1�j1Zk1Znon_adjacent�i2�j2Zk2rrr�get_matching_blocks�s8


z#SequenceMatcher.get_matching_blockscCs�|jdk	r|jSd}}g|_}x�|j�D]�\}}}d}||krP||krPd}n||kr^d}n||krjd}|r�|j|||||f�||||}}|r,|jd||||f�q,W|S)a[Return list of 5-tuples describing how to turn a into b.

        Each tuple is of the form (tag, i1, i2, j1, j2).  The first tuple
        has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the
        tuple preceding it, and likewise for j1 == the previous j2.

        The tags are strings, with these meanings:

        'replace':  a[i1:i2] should be replaced by b[j1:j2]
        'delete':   a[i1:i2] should be deleted.
                    Note that j1==j2 in this case.
        'insert':   b[j1:j2] should be inserted at a[i1:i1].
                    Note that i1==i2 in this case.
        'equal':    a[i1:i2] == b[j1:j2]

        >>> a = "qabxcd"
        >>> b = "abycdf"
        >>> s = SequenceMatcher(None, a, b)
        >>> for tag, i1, i2, j1, j2 in s.get_opcodes():
        ...    print(("%7s a[%d:%d] (%s) b[%d:%d] (%s)" %
        ...           (tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2])))
         delete a[0:1] (q) b[0:0] ()
          equal a[1:3] (ab) b[0:2] (ab)
        replace a[3:4] (x) b[2:3] (y)
          equal a[4:6] (cd) b[3:5] (cd)
         insert a[6:6] () b[5:6] (f)
        Nr
r�replace�delete�insert�equal)r rJr))rr0r;Zanswer�ai�bj�size�tagrrr�get_opcodess$

zSequenceMatcher.get_opcodes�c

csr|j�}|sdg}|dddkrZ|d\}}}}}|t|||�|t|||�|f|d<|dddkr�|d\}}}}}||t|||�|t|||�f|d<||}g}	x�|D]�\}}}}}|dko�|||k�r(|	j||t|||�|t|||�f�|	Vg}	t|||�t|||�}}|	j|||||f�q�W|	�rnt|	�dk�ob|	dddk�rn|	VdS)	a� Isolate change clusters by eliminating ranges with no changes.

        Return a generator of groups with up to n lines of context.
        Each group is in the same format as returned by get_opcodes().

        >>> from pprint import pprint
        >>> a = list(map(str, range(1,40)))
        >>> b = a[:]
        >>> b[8:8] = ['i']     # Make an insertion
        >>> b[20] += 'x'       # Make a replacement
        >>> b[23:28] = []      # Make a deletion
        >>> b[30] += 'y'       # Make another replacement
        >>> pprint(list(SequenceMatcher(None,a,b).get_grouped_opcodes()))
        [[('equal', 5, 8, 5, 8), ('insert', 8, 8, 8, 9), ('equal', 8, 11, 9, 12)],
         [('equal', 16, 19, 17, 20),
          ('replace', 19, 20, 20, 21),
          ('equal', 20, 22, 21, 23),
          ('delete', 22, 27, 23, 23),
          ('equal', 27, 30, 23, 26)],
         [('equal', 31, 34, 27, 30),
          ('replace', 34, 35, 30, 31),
          ('equal', 35, 38, 31, 34)]]
        rNr
r%N)rNr
r%r
r%���rUrU)rS�max�minr)r.)
rr3ZcodesrRrFrHrGrIZnn�grouprrr�get_grouped_opcodes<s(&&((z#SequenceMatcher.get_grouped_opcodescCs0tdd�|j�D��}t|t|j�t|j��S)a�Return a measure of the sequences' similarity (float in [0,1]).

        Where T is the total number of elements in both sequences, and
        M is the number of matches, this is 2.0*M / T.
        Note that this is 1 if the sequences are identical, and 0 if
        they have nothing in common.

        .ratio() is expensive to compute if you haven't already computed
        .get_matching_blocks() or .get_opcodes(), in which case you may
        want to try .quick_ratio() or .real_quick_ratio() first to get an
        upper bound.

        >>> s = SequenceMatcher(None, "abcd", "bcde")
        >>> s.ratio()
        0.75
        >>> s.quick_ratio()
        0.75
        >>> s.real_quick_ratio()
        1.0
        css|]}|dVqdS)r%NrUr)�.0Ztriplerrr�	<genexpr>�sz(SequenceMatcher.ratio.<locals>.<genexpr>)�sumrJrr.rr)rrrrr�rationszSequenceMatcher.ratiocCs�|jdkr8i|_}x"|jD]}|j|d�d||<qW|j}i}|jd}}xH|jD]>}||�rl||}n|j|d�}|d||<|dkrV|d}qVWt|t|j�t|j��S)z�Return an upper bound on ratio() relatively quickly.

        This isn't defined beyond that it is an upper bound on .ratio(), and
        is faster to compute.
        Nr
r%)r!rr6r4rrr.)rr!r1ZavailZavailhasrZnumbrrr�quick_ratio�s



zSequenceMatcher.quick_ratiocCs*t|j�t|j�}}tt||�||�S)z�Return an upper bound on ratio() very quickly.

        This isn't defined beyond that it is an upper bound on .ratio(), and
        is faster to compute than either .ratio() or .quick_ratio().
        )r.rrrrW)rrCrDrrr�real_quick_ratio�sz SequenceMatcher.real_quick_ratio)NrrT)rT)�__name__�
__module__�__qualname__�__doc__rrrrr"r=rJrSrYr]r^r_rrrrr+sj
@,'nG7
2rT�333333�?cCs�|dkstd|f��d|ko(dkns<td|f��g}t�}|j|�xL|D]D}|j|�|j�|krV|j�|krV|j�|krV|j|j�|f�qVWt||�}dd�|D�S)a�Use SequenceMatcher to return list of the best "good enough" matches.

    word is a sequence for which close matches are desired (typically a
    string).

    possibilities is a list of sequences against which to match word
    (typically a list of strings).

    Optional arg n (default 3) is the maximum number of close matches to
    return.  n must be > 0.

    Optional arg cutoff (default 0.6) is a float in [0, 1].  Possibilities
    that don't score at least that similar to word are ignored.

    The best (no more than n) matches among the possibilities are returned
    in a list, sorted by similarity score, most similar first.

    >>> get_close_matches("appel", ["ape", "apple", "peach", "puppy"])
    ['apple', 'ape']
    >>> import keyword as _keyword
    >>> get_close_matches("wheel", _keyword.kwlist)
    ['while']
    >>> get_close_matches("Apple", _keyword.kwlist)
    []
    >>> get_close_matches("accept", _keyword.kwlist)
    ['except']
    r
zn must be > 0: %rgg�?z cutoff must be in [0.0, 1.0]: %rcSsg|]\}}|�qSrr)rZZscorerErrr�
<listcomp>�sz%get_close_matches.<locals>.<listcomp>)	�
ValueErrorrrrr_r^r]r)�	_nlargest)ZwordZ
possibilitiesr3�cutoff�result�srErrrr�s



cCs4dt|�}}x ||kr.|||kr.|d7}qW|S)z}
    Return number of `ch` characters at the start of `line`.

    Example:

    >>> _count_leading('   abc', ' ')
    3
    r
r%)r.)�line�chr0r3rrr�_count_leading�s
rmc@sJeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)ra�

    Differ is a class for comparing sequences of lines of text, and
    producing human-readable differences or deltas.  Differ uses
    SequenceMatcher both to compare sequences of lines, and to compare
    sequences of characters within similar (near-matching) lines.

    Each line of a Differ delta begins with a two-letter code:

        '- '    line unique to sequence 1
        '+ '    line unique to sequence 2
        '  '    line common to both sequences
        '? '    line not present in either input sequence

    Lines beginning with '? ' attempt to guide the eye to intraline
    differences, and were not present in either input sequence.  These lines
    can be confusing if the sequences contain tab characters.

    Note that Differ makes no claim to produce a *minimal* diff.  To the
    contrary, minimal diffs are often counter-intuitive, because they synch
    up anywhere possible, sometimes accidental matches 100 pages apart.
    Restricting synch points to contiguous matches preserves some notion of
    locality, at the occasional cost of producing a longer diff.

    Example: Comparing two texts.

    First we set up the texts, sequences of individual single-line strings
    ending with newlines (such sequences can also be obtained from the
    `readlines()` method of file-like objects):

    >>> text1 = '''  1. Beautiful is better than ugly.
    ...   2. Explicit is better than implicit.
    ...   3. Simple is better than complex.
    ...   4. Complex is better than complicated.
    ... '''.splitlines(keepends=True)
    >>> len(text1)
    4
    >>> text1[0][-1]
    '\n'
    >>> text2 = '''  1. Beautiful is better than ugly.
    ...   3.   Simple is better than complex.
    ...   4. Complicated is better than complex.
    ...   5. Flat is better than nested.
    ... '''.splitlines(keepends=True)

    Next we instantiate a Differ object:

    >>> d = Differ()

    Note that when instantiating a Differ object we may pass functions to
    filter out line and character 'junk'.  See Differ.__init__ for details.

    Finally, we compare the two:

    >>> result = list(d.compare(text1, text2))

    'result' is a list of strings, so let's pretty-print it:

    >>> from pprint import pprint as _pprint
    >>> _pprint(result)
    ['    1. Beautiful is better than ugly.\n',
     '-   2. Explicit is better than implicit.\n',
     '-   3. Simple is better than complex.\n',
     '+   3.   Simple is better than complex.\n',
     '?     ++\n',
     '-   4. Complex is better than complicated.\n',
     '?            ^                     ---- ^\n',
     '+   4. Complicated is better than complex.\n',
     '?           ++++ ^                      ^\n',
     '+   5. Flat is better than nested.\n']

    As a single multi-line string it looks like this:

    >>> print(''.join(result), end="")
        1. Beautiful is better than ugly.
    -   2. Explicit is better than implicit.
    -   3. Simple is better than complex.
    +   3.   Simple is better than complex.
    ?     ++
    -   4. Complex is better than complicated.
    ?            ^                     ---- ^
    +   4. Complicated is better than complex.
    ?           ++++ ^                      ^
    +   5. Flat is better than nested.

    Methods:

    __init__(linejunk=None, charjunk=None)
        Construct a text differencer, with optional filters.

    compare(a, b)
        Compare two sequences of lines; generate the resulting delta.
    NcCs||_||_dS)a�
        Construct a text differencer, with optional filters.

        The two optional keyword parameters are for filter functions:

        - `linejunk`: A function that should accept a single string argument,
          and return true iff the string is junk. The module-level function
          `IS_LINE_JUNK` may be used to filter out lines without visible
          characters, except for at most one splat ('#').  It is recommended
          to leave linejunk None; the underlying SequenceMatcher class has
          an adaptive notion of "noise" lines that's better than any static
          definition the author has ever been able to craft.

        - `charjunk`: A function that should accept a string of length 1. The
          module-level function `IS_CHARACTER_JUNK` may be used to filter out
          whitespace characters (a blank or tab; **note**: bad idea to include
          newline in this!).  Use of IS_CHARACTER_JUNK is recommended.
        N)�linejunk�charjunk)rrnrorrrrMszDiffer.__init__c
cs�t|j||�}x�|j�D]�\}}}}}|dkrD|j||||||�}	n\|dkr^|jd|||�}	nB|dkrx|jd|||�}	n(|dkr�|jd|||�}	ntd|f��|	Ed	HqWd	S)
a�
        Compare two sequences of lines; generate the resulting delta.

        Each sequence must contain individual single-line strings ending with
        newlines. Such sequences can be obtained from the `readlines()` method
        of file-like objects.  The delta generated also consists of newline-
        terminated strings, ready to be printed as-is via the writeline()
        method of a file-like object.

        Example:

        >>> print(''.join(Differ().compare('one\ntwo\nthree\n'.splitlines(True),
        ...                                'ore\ntree\nemu\n'.splitlines(True))),
        ...       end="")
        - one
        ?  ^
        + ore
        ?  ^
        - two
        - three
        ?  -
        + tree
        + emu
        rKrL�-rM�+rN� zunknown tag %rN)rrnrS�_fancy_replace�_dumprf)
rrr�cruncherrRr7r8r9r:�grrr�comparedszDiffer.compareccs*x$t||�D]}d|||fVqWdS)z4Generate comparison results for a same-tagged range.z%s %sN)r5)rrRrE�lo�hir0rrrrt�szDiffer._dumpc
cs�||kr||kst�||||krF|jd|||�}|jd|||�}n |jd|||�}|jd|||�}x||fD]}	|	EdHqpWdS)Nrqrp)�AssertionErrorrt)
rrr7r8rr9r:�first�secondrvrrr�_plain_replace�szDiffer._plain_replaceccsHd\}}t|j�}	d\}
}x�t||�D]�}||}
|	j|
�xxt||�D]j}||}||
krp|
dkrH||}
}qH|	j|�|	j�|krH|	j�|krH|	j�|krH|	j�||}}}qHWq&W||k�r�|
dkr�|j||||||�EdHdS|
|d}}}nd}
|j	||||||�EdH||||}}|
dk�rd}}|	j
||�x�|	j�D]�\}}}}}||||}}|dk�r�|d|7}|d|7}nb|dk�r�|d	|7}nJ|d
k�r�|d|7}n2|dk�r�|d
|7}|d
|7}ntd|f���qTW|j
||||�EdHn
d|V|j	||d|||d|�EdHdS)aL
        When replacing one block of lines with another, search the blocks
        for *similar* lines; the best-matching pair (if any) is used as a
        synch point, and intraline difference marking is done on the
        similar pair. Lots of work, but often worth it.

        Example:

        >>> d = Differ()
        >>> results = d._fancy_replace(['abcDefghiJkl\n'], 0, 1,
        ...                            ['abcdefGhijkl\n'], 0, 1)
        >>> print(''.join(results), end="")
        - abcDefghiJkl
        ?    ^  ^  ^
        + abcdefGhijkl
        ?    ^  ^  ^
        �G�z��?��?Ng�?rrK�^rLrprMrqrNrrzunknown tag %rz  r%)r~r)NN)rror5rrr_r^r]r}�
_fancy_helperrrSrf�_qformat)rrr7r8rr9r:Z
best_ratiorhruZeqiZeqjr;rPr0rOZbest_iZbest_jZaeltZbelt�atags�btagsrRZai1Zai2Zbj1Zbj2rCrDrrrrs�sX










zDiffer._fancy_replaceccsbg}||kr<||kr*|j||||||�}qT|jd|||�}n||krT|jd|||�}|EdHdS)Nrprq)rsrt)rrr7r8rr9r:rvrrrr��szDiffer._fancy_helperccs�tt|d�t|d��}t|t|d|�d��}t|t|d|�d��}||d�j�}||d�j�}d|V|r�dd||fVd|V|r�dd||fVdS)a�
        Format "?" output and deal with leading tabs.

        Example:

        >>> d = Differ()
        >>> results = d._qformat('\tabcDefghiJkl\n', '\tabcdefGhijkl\n',
        ...                      '  ^ ^  ^      ', '  ^ ^  ^      ')
        >>> for line in results: print(repr(line))
        ...
        '- \tabcDefghiJkl\n'
        '? \t ^ ^  ^\n'
        '+ \tabcdefGhijkl\n'
        '? \t ^ ^  ^\n'
        �	Nrrz- z? %s%s
z+ )rWrm�rstrip)rZalineZbliner�r��commonrrrr�
s


zDiffer._qformat)NN)r`rarbrcrrwrtr}rsr�r�rrrrr�s\
)^Nz
\s*(?:#\s*)?$cCs||�dk	S)z�
    Return 1 for ignorable line: iff `line` is blank or contains a single '#'.

    Examples:

    >>> IS_LINE_JUNK('\n')
    True
    >>> IS_LINE_JUNK('  #   \n')
    True
    >>> IS_LINE_JUNK('hello\n')
    False
    Nr)rkZpatrrrr>s� 	cCs||kS)z�
    Return 1 for ignorable character: iff `ch` is a space or tab.

    Examples:

    >>> IS_CHARACTER_JUNK(' ')
    True
    >>> IS_CHARACTER_JUNK('\t')
    True
    >>> IS_CHARACTER_JUNK('\n')
    False
    >>> IS_CHARACTER_JUNK('x')
    False
    r)rlZwsrrrrNscCs:|d}||}|dkr"dj|�S|s.|d8}dj||�S)z Convert range to the "ed" formatr%z{}z{},{})�format)�start�stop�	beginningrrrr�_format_range_unifiedes
r�r�
ccsht|||||||�d}�xHtd||�j|�D�]0}	|s�d}|rJdj|�nd}
|r\dj|�nd}dj||
|�Vdj|||�V|	d|	d}}
t|d	|
d
�}t|d|
d�}d
j|||�Vx�|	D]�\}}}}}|dk�rx|||�D]}d|Vq�Wq�|dk�r2x |||�D]}d|V�qW|dkr�x |||�D]}d|V�qHWq�Wq.WdS)a�
    Compare two sequences of lines; generate the delta as a unified diff.

    Unified diffs are a compact way of showing line changes and a few
    lines of context.  The number of context lines is set by 'n' which
    defaults to three.

    By default, the diff control lines (those with ---, +++, or @@) are
    created with a trailing newline.  This is helpful so that inputs
    created from file.readlines() result in diffs that are suitable for
    file.writelines() since both the inputs and outputs have trailing
    newlines.

    For inputs that do not have trailing newlines, set the lineterm
    argument to "" so that the output will be uniformly newline free.

    The unidiff format normally has a header for filenames and modification
    times.  Any or all of these may be specified using strings for
    'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.
    The modification times are normally expressed in the ISO 8601 format.

    Example:

    >>> for line in unified_diff('one two three four'.split(),
    ...             'zero one tree four'.split(), 'Original', 'Current',
    ...             '2005-01-26 23:30:50', '2010-04-02 10:20:52',
    ...             lineterm=''):
    ...     print(line)                 # doctest: +NORMALIZE_WHITESPACE
    --- Original        2005-01-26 23:30:50
    +++ Current         2010-04-02 10:20:52
    @@ -1,4 +1,4 @@
    +zero
     one
    -two
    -three
    +tree
     four
    FNTz	{}rz
--- {}{}{}z
+++ {}{}{}r
r%�rT�z@@ -{} +{} @@{}rNrrrKrLrprMrqrU>rKrL>rMrK)�_check_typesrrYr�r�)rr�fromfile�tofile�fromfiledate�
tofiledater3�lineterm�startedrX�fromdate�todater{�last�file1_range�file2_rangerRrFrHrGrIrkrrrr	ps0)

cCsB|d}||}|s|d8}|dkr.dj|�Sdj|||d�S)z Convert range to the "ed" formatr%z{}z{},{})r�)r�r�r�rrrr�_format_range_context�s
r�ccs�t|||||||�tddddd�}d}	�xztd||�j|�D�]b}
|	s�d}	|rZd	j|�nd
}|rld	j|�nd
}dj|||�Vdj|||�V|
d
|
d}
}d|Vt|
d|d�}dj||�Vtdd�|
D���r&xD|
D]<\}}}}}|dkr�x$|||�D]}|||V�q
Wq�Wt|
d|d�}dj||�Vtdd�|
D��r>xH|
D]@\}}}}}|dk�r^x$|||�D]}|||V�q�W�q^Wq>WdS)ah
    Compare two sequences of lines; generate the delta as a context diff.

    Context diffs are a compact way of showing line changes and a few
    lines of context.  The number of context lines is set by 'n' which
    defaults to three.

    By default, the diff control lines (those with *** or ---) are
    created with a trailing newline.  This is helpful so that inputs
    created from file.readlines() result in diffs that are suitable for
    file.writelines() since both the inputs and outputs have trailing
    newlines.

    For inputs that do not have trailing newlines, set the lineterm
    argument to "" so that the output will be uniformly newline free.

    The context diff format normally has a header for filenames and
    modification times.  Any or all of these may be specified using
    strings for 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.
    The modification times are normally expressed in the ISO 8601 format.
    If not specified, the strings default to blanks.

    Example:

    >>> print(''.join(context_diff('one\ntwo\nthree\nfour\n'.splitlines(True),
    ...       'zero\none\ntree\nfour\n'.splitlines(True), 'Original', 'Current')),
    ...       end="")
    *** Original
    --- Current
    ***************
    *** 1,4 ****
      one
    ! two
    ! three
      four
    --- 1,4 ----
    + zero
      one
    ! tree
      four
    z+ z- z! z  )rMrLrKrNFNTz	{}rz
*** {}{}{}z
--- {}{}{}r
r%z***************r�z
*** {} ****{}css |]\}}}}}|dkVqdS)rKrLN>rKrLr)rZrR�_rrrr[szcontext_diff.<locals>.<genexpr>rMrTr�z
--- {} ----{}css |]\}}}}}|dkVqdS)rKrMN>rMrKr)rZrRr�rrrr[srLrU)r��dictrrYr�r��any)rrr�r�r�r�r3r��prefixr�rXr�r�r{r�r�rRrFrHr�rkr�rGrIrrrr�s4,

cGs�|r2t|dt�r2tdt|d�j|df��|rdt|dt�rdtdt|d�j|df��x$|D]}t|t�sjtd|f��qjWdS)Nr
z)lines to compare must be str, not %s (%r)z"all arguments must be str, not: %r)�
isinstance�str�	TypeError�typer`)rr�args�argrrrr�s

r���
c		cs�dd�}	tt|	|��}tt|	|��}|	|�}|	|�}|	|�}|	|�}|	|�}|||||||||�}
x|
D]}|jdd�VqhWdS)a�
    Compare `a` and `b`, two sequences of lines represented as bytes rather
    than str. This is a wrapper for `dfunc`, which is typically either
    unified_diff() or context_diff(). Inputs are losslessly converted to
    strings so that `dfunc` only has to worry about strings, and encoded
    back to bytes on return. This is necessary to compare files with
    unknown or inconsistent encoding. All other inputs (except `n`) must be
    bytes rather than str.
    cSsPy|jdd�Stk
rJ}z"dt|�j|f}t|�|�WYdd}~XnXdS)N�ascii�surrogateescapez(all arguments must be bytes, not %s (%r))�decode�AttributeErrorr�r`r�)rj�err�msgrrrr�-szdiff_bytes.<locals>.decoder�r�N)r@rA�encode)Zdfuncrrr�r�r�r�r3r�r��linesrkrrrr
"s
cCst||�j||�S)aJ
    Compare `a` and `b` (lists of strings); return a `Differ`-style delta.

    Optional keyword parameters `linejunk` and `charjunk` are for filter
    functions, or can be None:

    - linejunk: A function that should accept a single string argument and
      return true iff the string is junk.  The default is None, and is
      recommended; the underlying SequenceMatcher class has an adaptive
      notion of "noise" lines.

    - charjunk: A function that accepts a character (string of length
      1), and returns true iff the character is junk. The default is
      the module-level function IS_CHARACTER_JUNK, which filters out
      whitespace characters (a blank or tab; note: it's a bad idea to
      include newline in this!).

    Tools/scripts/ndiff.py is a command-line front-end to this function.

    Example:

    >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
    ...              'ore\ntree\nemu\n'.splitlines(keepends=True))
    >>> print(''.join(diff), end="")
    - one
    ?  ^
    + ore
    ?  ^
    - two
    - three
    ?  -
    + tree
    + emu
    )rrw)rrrnrorrrr@s#c#s�ddl}|jd��t||||��ddgf�fdd�	���fdd���fdd	�}|�}|dkrj|EdH�n.|d
7}d}�xddg|}	}
d}xR|dkr�yt|�\}}
}Wntk
r�dSX|	|}||
|f|
|<|	d
7}	q�W|	|k�r�dV|}n|	}d}	x.|�r.|	|}|	d
7}	|
|V|d
8}�qW|d
}yDx>|�rxt|�\}}
}|�r`|d
}n|d
8}||
|fV�q<WWqztk
�r�dSXqzWdS)
a�Returns generator yielding marked up from/to side by side differences.

    Arguments:
    fromlines -- list of text lines to compared to tolines
    tolines -- list of text lines to be compared to fromlines
    context -- number of context lines to display on each side of difference,
               if None, all from/to text lines will be generated.
    linejunk -- passed on to ndiff (see ndiff documentation)
    charjunk -- passed on to ndiff (see ndiff documentation)

    This function returns an iterator which returns a tuple:
    (from line tuple, to line tuple, boolean flag)

    from/to line tuple -- (line num, line text)
        line num -- integer or None (to indicate a context separation)
        line text -- original line text with following markers inserted:
            '\0+' -- marks start of added text
            '\0-' -- marks start of deleted text
            '\0^' -- marks start of changed text
            '\1' -- marks end of added/deleted/changed text

    boolean flag -- None indicates context separation, True indicates
        either "from" or "to" line contains a change, otherwise False.

    This function/iterator was originally developed to generate side by side
    file difference for making HTML pages (see HtmlDiff class for example
    usage).

    Note, this function utilizes the ndiff function to generate the side by
    side difference markup.  Optional ndiff arguments may be passed to this
    function and they in turn will be passed to ndiff.
    r
Nz
(\++|\-+|\^+)cs�||d7<|dkr2|||jd�dd�fS|dkr�|jd�|jd�}}g}|fdd�}�j||�xHt|�D]<\}\}	}
|d|	�d|||	|
�d	||
d�}qvW|dd�}n*|jd�dd�}|s�d
}d||d	}|||fS)aReturns line of text with user's change markup and line formatting.

        lines -- list of lines from the ndiff generator to produce a line of
                 text from.  When producing the line of text to return, the
                 lines used are removed from this list.
        format_key -- '+' return first line in list with "add" markup around
                          the entire line.
                      '-' return first line in list with "delete" markup around
                          the entire line.
                      '?' return first line in list with add/delete/change
                          intraline markup (indices obtained from second line)
                      None return first line in list with no markup
        side -- indice into the num_lines list (0=from,1=to)
        num_lines -- from/to current line number.  This is NOT intended to be a
                     passed parameter.  It is present as a keyword argument to
                     maintain memory of the current line numbers between calls
                     of this function.

        Note, this function is purposefully not defined at the module scope so
        that data it needs from its parent function (within whose context it
        is defined) does not need to be of module scope.
        r%Nr
r��?cSs&|j|jd�d|j�g�|jd�S)Nr%r
)r)rX�span)Zmatch_object�sub_inforrr�record_sub_info�sz3_mdiff.<locals>._make_line.<locals>.record_sub_info��rr)r>�sub�reversed)r�Z
format_key�sideZ	num_lines�textZmarkersr�r��keyZbegin�end)�	change_rerr�
_make_line�s 4z_mdiff.<locals>._make_linec3s�g}d\}}�xlx t|�dkr0|jt�d��qWdjdd�|D��}|jd�rX|}�n�|jd�r��|dd��|dd	�d
fVq�n�|jd�r�|d	8}�|dd�d
d
fVq�nl|jd�rވ|dd�d
}}|d	d}}�n>|jd��r�|d
d��|dd	�d
fVq�n|jd��r8�|dd��|d
d	�d
fVqn�|jd��rd|d	8}�|dd�d
d
fVqn�|jd��r�|d	7}d
�|dd	�d
fVqn�|jd��r�d
�|dd	�}}|d	d}}n^|jd��r�|d	7}d
�|dd	�d
fVqn2|jd��r�|d
d
�d
d��|d
d	�dfVqx|dk�r:|d	7}dV�qWx|dk�rZ|d	8}d V�q>W|jd��rld
S||d
fVqWd
S)!a�Yields from/to lines of text with a change indication.

        This function is an iterator.  It itself pulls lines from a
        differencing iterator, processes them and yields them.  When it can
        it yields both a "from" and a "to" line, otherwise it will yield one
        or the other.  In addition to yielding the lines of from/to text, a
        boolean flag is yielded to indicate if the text line(s) have
        differences in them.

        Note, this function is purposefully not defined at the module scope so
        that data it needs from its parent function (within whose context it
        is defined) does not need to be of module scope.
        r
r��XrcSsg|]}|d�qS)r
r)rZrkrrrre�sz2_mdiff.<locals>._line_iterator.<locals>.<listcomp>z-?+?r�r%Tz--++rpN�--?+�--+�- z-+?z-?+z+--rq�+ �+-rrFr�)r
r
)r�r�r�)r�r��rr�)Nr�T�rr�)r�NT)r.r)�next�join�
startswith)r�Znum_blanks_pendingZnum_blanks_to_yieldrj�	from_line�to_line)r��diff_lines_iteratorrr�_line_iterator�sf



$z_mdiff.<locals>._line_iteratorc3s���}gg}}x�xpt|�dks,t|�dkr�yt|�\}}}Wntk
rRdSX|dk	rj|j||f�|dk	r|j||f�qW|jd�\}}|jd�\}}|||p�|fVqWdS)atYields from/to lines of text with a change indication.

        This function is an iterator.  It itself pulls lines from the line
        iterator.  Its difference from that iterator is that this function
        always yields a pair of from/to text lines (with the change
        indication).  If necessary it will collect single from/to lines
        until it has a matching pair from/to pair to yield.

        Note, this function is purposefully not defined at the module scope so
        that data it needs from its parent function (within whose context it
        is defined) does not need to be of module scope.
        r
N)r.r��
StopIterationr)r>)Z
line_iterator�	fromlines�tolinesr�r��
found_diffZfromDiffZto_diff)r�rr�_line_pair_iterators

z#_mdiff.<locals>._line_pair_iteratorr%F)NNN)�re�compilerr�r�)r�r��contextrnror�r�Zline_pair_iteratorZlines_to_write�indexZcontextLinesr�r�r�r0r)r�r�r�r�r�_mdiffesT"
8X!



r�an
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>
    <meta http-equiv="Content-Type"
          content="text/html; charset=%(charset)s" />
    <title></title>
    <style type="text/css">%(styles)s
    </style>
</head>

<body>
    %(table)s%(legend)s
</body>

</html>aH
        table.diff {font-family:Courier; border:medium;}
        .diff_header {background-color:#e0e0e0}
        td.diff_header {text-align:right}
        .diff_next {background-color:#c0c0c0}
        .diff_add {background-color:#aaffaa}
        .diff_chg {background-color:#ffff77}
        .diff_sub {background-color:#ffaaaa}aZ
    <table class="diff" id="difflib_chg_%(prefix)s_top"
           cellspacing="0" cellpadding="0" rules="groups" >
        <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
        <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
        %(header_row)s
        <tbody>
%(data_rows)s        </tbody>
    </table>a�
    <table class="diff" summary="Legends">
        <tr> <th colspan="2"> Legends </th> </tr>
        <tr> <td> <table border="" summary="Colors">
                      <tr><th> Colors </th> </tr>
                      <tr><td class="diff_add">&nbsp;Added&nbsp;</td></tr>
                      <tr><td class="diff_chg">Changed</td> </tr>
                      <tr><td class="diff_sub">Deleted</td> </tr>
                  </table></td>
             <td> <table border="" summary="Links">
                      <tr><th colspan="2"> Links </th> </tr>
                      <tr><td>(f)irst change</td> </tr>
                      <tr><td>(n)ext change</td> </tr>
                      <tr><td>(t)op</td> </tr>
                  </table></td> </tr>
    </table>c@s�eZdZdZeZeZeZeZdZddde	fdd�Z
dd
d�dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zddd�ZdS) ra{For producing HTML side by side comparison with change highlights.

    This class can be used to create an HTML table (or a complete HTML file
    containing the table) showing a side by side, line by line comparison
    of text with inter-line and intra-line change highlights.  The table can
    be generated in either full or contextual difference mode.

    The following methods are provided for HTML generation:

    make_table -- generates HTML for a single side by side table
    make_file -- generates complete HTML file with a single side by side table

    See tools/scripts/diff.py for an example usage of this class.
    r
�NcCs||_||_||_||_dS)a�HtmlDiff instance initializer

        Arguments:
        tabsize -- tab stop spacing, defaults to 8.
        wrapcolumn -- column number where lines are broken and wrapped,
            defaults to None where lines are not wrapped.
        linejunk,charjunk -- keyword arguments passed into ndiff() (used by
            HtmlDiff() to generate the side by side HTML differences).  See
            ndiff() documentation for argument default values and descriptions.
        N)�_tabsize�_wrapcolumn�	_linejunk�	_charjunk)r�tabsizeZ
wrapcolumnrnrorrrr�szHtmlDiff.__init__rF�zutf-8)�charsetcCs:|jt|j|j|j||||||d�|d�j|d�j|�S)aReturns HTML file of side by side comparison with change highlights

        Arguments:
        fromlines -- list of "from" lines
        tolines -- list of "to" lines
        fromdesc -- "from" file column header string
        todesc -- "to" file column header string
        context -- set to True for contextual differences (defaults to False
            which shows full differences).
        numlines -- number of context lines.  When context is set True,
            controls number of lines displayed before and after the change.
            When context is False, controls the number of lines to place
            the "next" link anchors before the next change (so click of
            "next" link jumps to just before the change).
        charset -- charset of the HTML document
        )r��numlines)ZstylesZlegend�tabler��xmlcharrefreplace)�_file_templater��_styles�_legend�
make_tabler�r�)rr�r��fromdesc�todescr�r�r�rrr�	make_file�s
zHtmlDiff.make_filecs8�fdd���fdd�|D�}�fdd�|D�}||fS)aReturns from/to line lists with tabs expanded and newlines removed.

        Instead of tab characters being replaced by the number of spaces
        needed to fill in to the next tab stop, this function will fill
        the space with tab characters.  This is done so that the difference
        algorithms can identify changes in a file when tabs are replaced by
        spaces and vice versa.  At the end of the HTML generation, the tab
        characters will be replaced with a nonbreakable space.
        cs6|jdd�}|j�j�}|jdd�}|jdd�jd�S)Nrrr�r�r�)rK�
expandtabsr�r�)rk)rrr�expand_tabs�sz2HtmlDiff._tab_newline_replace.<locals>.expand_tabscsg|]}�|��qSrr)rZrk)r�rrresz1HtmlDiff._tab_newline_replace.<locals>.<listcomp>csg|]}�|��qSrr)rZrk)r�rrresr)rr�r�r)r�rr�_tab_newline_replace�s
	zHtmlDiff._tab_newline_replacecCs|s|j||f�dSt|�}|j}||ksB||jd�d|krT|j||f�dSd}d}d}xd||kr�||kr�||dkr�|d7}||}|d7}qb||dkr�|d7}d}qb|d7}|d7}qbW|d|�}	||d�}
|r�|	d}	d||
}
|j||	f�|j|d|
�dS)	a�Builds list of text lines by splitting text lines at wrap point

        This function will determine if the input text line needs to be
        wrapped (split) into separate lines.  If so, the first wrap point
        will be determined and the first line appended to the output
        text line list.  This function is used recursively to handle
        the second part of the split line to further split it.
        Nr�rTr
rr%r��>)r)r.r��count�_split_line)rZ	data_listZline_numr�rQrVr0r3ZmarkZline1Zline2rrrr�s8

zHtmlDiff._split_lineccs�x�|D]�\}}}|dkr&|||fVq||\}}\}}gg}	}
|j|	||�|j|
||�x@|	sh|
r�|	rx|	jd�}nd}|
r�|
jd�}nd}|||fVq`WqWdS)z5Returns iterator that splits (wraps) mdiff text linesNr
rrr)rrr)rrr)r�r>)r�diffs�fromdata�todata�flagZfromlineZfromtextZtolineZtotext�fromlist�tolistrrr�
_line_wrapper;s 

zHtmlDiff._line_wrappercCs�ggg}}}xz|D]r\}}}y4|j|jd|f|���|j|jd|f|���Wn(tk
r||jd�|jd�YnX|j|�qW|||fS)z�Collects mdiff output into separate lists

        Before storing the mdiff from/to data into a list, it is converted
        into a single line of text with HTML markup.
        r
r%N)r)�_format_liner�)rr�r�r��flaglistr�r�r�rrr�_collect_linesWs
zHtmlDiff._collect_linescCsryd|}d|j||f}Wntk
r6d}YnX|jdd�jdd�jdd	�}|jd
d�j�}d|||fS)
aReturns HTML markup of "from" / "to" text lines

        side -- 0 or 1 indicating "from" or "to" text
        flag -- indicates if difference on line
        linenum -- line number (used for line number column)
        text -- line text to be marked up
        z%dz
 id="%s%s"r�&z&amp;r�z&gt;�<z&lt;rrz&nbsp;z<<td class="diff_header"%s>%s</td><td nowrap="nowrap">%s</td>)�_prefixr�rKr�)rr�r�Zlinenumr��idrrrr�ls
zHtmlDiff._format_linecCs0dtj}dtj}tjd7_||g|_dS)zCreate unique anchor prefixeszfrom%d_zto%d_r%N)r�_default_prefixr�)rZ
fromprefix�toprefixrrr�_make_prefix�s

zHtmlDiff._make_prefixcCs�|jd}dgt|�}dgt|�}d\}	}
d}xbt|�D]V\}}
|
r�|
s�d}
|}td||g�}d||	f||<|	d7}	d||	f||<q<d}
q<W|s�dg}dg}dg}d}|r�dg}|}n
d	g}}|ds�d
||d<d|||<|||||fS)
zMakes list of "next" linksr%rr
FTz id="difflib_chg_%s_%d"z"<a href="#difflib_chg_%s_%d">n</a>z2<td></td><td>&nbsp;No Differences Found&nbsp;</td>z(<td></td><td>&nbsp;Empty File&nbsp;</td>z!<a href="#difflib_chg_%s_0">f</a>z#<a href="#difflib_chg_%s_top">t</a>)r
F)r�r.r'rV)rr�r�r�r�r�r�next_id�	next_hrefZnum_chgZ	in_changer�r0r�rrr�_convert_flags�s:

zHtmlDiff._convert_flagsc	CsV|j�|j||�\}}|r"|}nd}t||||j|jd�}|jrL|j|�}|j|�\}	}
}|j|	|
|||�\}	}
}}}
g}d}x`t	t
|��D]P}||dkr�|dkr�|jd�q�|j||
||||	||||
|f�q�W|s�|�rddd	|dd	|f}nd
}|jt
d
j|�||jdd�}|jd
d�jdd�jdd�jdd�jdd�S)a�Returns HTML table of side by side comparison with change highlights

        Arguments:
        fromlines -- list of "from" lines
        tolines -- list of "to" lines
        fromdesc -- "from" file column header string
        todesc -- "to" file column header string
        context -- set to True for contextual differences (defaults to False
            which shows full differences).
        numlines -- number of context lines.  When context is set True,
            controls number of lines displayed before and after the change.
            When context is False, controls the number of lines to place
            the "next" link anchors before the next change (so click of
            "next" link jumps to just before the change).
        N)rnroz1            <tr><td class="diff_next"%s>%s</td>%sz%<td class="diff_next">%s</td>%s</tr>
r
z)        </tbody>        
        <tbody>
z <thead><tr>%s%s%s%s</tr></thead>z!<th class="diff_next"><br /></th>z+<th colspan="2" class="diff_header">%s</th>rr%)Z	data_rows�
header_rowr�z+z<span class="diff_add">z-z<span class="diff_sub">z^z<span class="diff_chg">r�z</span>r�z&nbsp;zV            <tr><td class="diff_next"%s>%s</td>%s<td class="diff_next">%s</td>%s</tr>
)rr�r�r�r�r�r�r�rr5r.r)�_table_templater�r�r�rK)rr�r�r�r�r�r�Z
context_linesr�r�r�r�rrrjZfmtr0rr�rrrr��sJ


zHtmlDiff.make_table)rrFr�)rrFr�)r`rarbrcr�r�rr�r�rrr�r�r�r�r�r�rrr�rrrrr�s&7/ccspyddd�t|�}Wn tk
r6td|��YnXd|f}x*|D]"}|dd�|krF|dd�VqFWdS)a0
    Generate one of the two sequences that generated a delta.

    Given a `delta` produced by `Differ.compare()` or `ndiff()`, extract
    lines originating from file 1 or 2 (parameter `which`), stripping off line
    prefixes.

    Examples:

    >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
    ...              'ore\ntree\nemu\n'.splitlines(keepends=True))
    >>> diff = list(diff)
    >>> print(''.join(restore(diff, 1)), end="")
    one
    two
    three
    >>> print(''.join(restore(diff, 2)), end="")
    ore
    tree
    emu
    z- z+ )r%r�z)unknown delta choice (must be 1 or 2): %rz  Nr�)�int�KeyErrorrf)ZdeltaZwhichrR�prefixesrkrrrrs
cCsddl}ddl}|j|�S)Nr
)�doctest�difflibZtestmod)r
rrrr�_test,sr�__main__)rTrd)r�)rrrrrTr�)rrrrrTr�)r�r�r�r�rTr�)$rc�__all__�heapqrrg�collectionsrZ_namedtuplerrrrrmrr�r��matchrrr�r	r�rr�r
rr�r�r�rr��objectrrrr`rrrr�<module>s^


0O

H
K
%!	
a 
imghdr.cpython-36.pyc000064400000010070150335715140010446 0ustar003


 \��@s2dZddlmZdgZd%dd�ZgZdd�Zeje�dd	�Zeje�d
d�Z	eje	�dd
�Z
eje
�dd�Zeje�dd�Zeje�dd�Z
eje
�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�d d!�Zd"d#�Zed$k�r.e�dS)&z<Recognize image file formats based on their first few bytes.�)�PathLike�whatNc
Cs�d}zl|dkrNt|ttf�r2t|d�}|jd�}n|j�}|jd�}|j|�xtD]}|||�}|rT|SqTWWd|r~|j�XdS)N�rb� )	�
isinstance�strr�open�read�tell�seek�tests�close)�file�h�f�locationZtf�res�r�/usr/lib64/python3.6/imghdr.pyrs 





cCs|dd�dkrdSdS)z JPEG data in JFIF or Exif format��
�JFIF�ExifZjpegN)rrr)rrrrr�	test_jpeg%srcCs|jd�rdSdS)Ns�PNG

Zpng)�
startswith)rrrrr�test_png,s
rcCs|dd�dkrdSdS)zGIF ('87 and '89 variants)Nr�GIF87a�GIF89aZgif)rrr)rrrrr�test_gif2srcCs|dd�dkrdSdS)z-TIFF (can be in Motorola or Intel byte order)N��MM�IIZtiff)r r!r)rrrrr�	test_tiff9sr"cCs|jd�rdSdS)zSGI image librarys�ZrgbN)r)rrrrr�test_rgb@s
r#cCs<t|�dkr8|dtd�kr8|ddkr8|ddkr8dSd	S)
zPBM (portable bitmap)�r�P�s14rs 	

ZpbmN)�len�ord)rrrrr�test_pbmGs(r)cCs<t|�dkr8|dtd�kr8|ddkr8|ddkr8dSd	S)
zPGM (portable graymap)r$rr%r&s25rs 	

ZpgmN)r'r()rrrrr�test_pgmOs(r*cCs<t|�dkr8|dtd�kr8|ddkr8|ddkr8dSd	S)
zPPM (portable pixmap)r$rr%r&s36rs 	

ZppmN)r'r()rrrrr�test_ppmWs(r+cCs|jd�rdSdS)zSun raster filesY�j�ZrastN)r)rrrrr�	test_rast_s
r,cCs|jd�rdSdS)zX bitmap (X10 or X11)s#define ZxbmN)r)rrrrr�test_xbmfs
r-cCs|jd�rdSdS)NsBMZbmp)r)rrrrr�test_bmpms
r.cCs"|jd�r|dd�dkrdSdS)NsRIFF��sWEBPZwebp)r)rrrrr�	test_webpssr1cCs|jd�rdSdS)Nsv/1Zexr)r)rrrrr�test_exrys
r2cCs�ddl}d}|jdd�r8|jddkr8|jdd�=d}y8|jdd�r`t|jdd�|d�ntdg|d�Wn*tk
r�|jjd�|jd�YnXdS)Nrr&z-rr�.z
[Interrupted]
)�sys�argv�testall�KeyboardInterrupt�stderr�write�exit)r4�	recursiverrr�test�sr<cCs�ddl}ddl}x�|D]�}|jj|�rzt|ddd�|s>|rptd�ddl}|j|jj|d��}t||d�q�td�qt|ddd�|jj	�ytt
|��Wqtk
r�td	�YqXqWdS)
Nrz/:� )�endzrecursing down:�*z*** directory (use -r) ***�:z*** not found ***)r4�os�path�isdir�print�glob�joinr6�stdout�flushr�OSError)�listr;Ztoplevelr4rA�filenamerE�namesrrrr6�s"


r6�__main__)N)�__doc__rAr�__all__rrr�appendrrr"r#r)r*r+r,r-r.r1r2r<r6�__name__rrrr�<module>sD














formatter.cpython-36.opt-2.pyc000064400000035445150335715140012154 0ustar003


 \';�@s�ddlZddlZejdedd�dZGdd�d�ZGdd�d�ZGd	d
�d
�ZGdd�de�ZGd
d�de�Z	ddd�Z
edkr�e
�dS)�Nz"the formatter module is deprecated�)�
stacklevelc@s�eZdZd'dd�Zdd�Zdd�Zdd	�Zd(d
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd)d#d$�Zd*d%d&�ZdS)+�
NullFormatterNcCs|dkrt�}||_dS)N)�
NullWriter�writer)�selfr�r�!/usr/lib64/python3.6/formatter.py�__init__)szNullFormatter.__init__cCsdS)Nr)r�	blanklinerrr	�
end_paragraph-szNullFormatter.end_paragraphcCsdS)Nr)rrrr	�add_line_break.szNullFormatter.add_line_breakcOsdS)Nr)r�args�kwrrr	�add_hor_rule/szNullFormatter.add_hor_rulecCsdS)Nr)r�format�counterrrrr	�add_label_data0szNullFormatter.add_label_datacCsdS)Nr)r�datarrr	�add_flowing_data1szNullFormatter.add_flowing_datacCsdS)Nr)rrrrr	�add_literal_data2szNullFormatter.add_literal_datacCsdS)Nr)rrrr	�flush_softspace3szNullFormatter.flush_softspacecCsdS)Nr)r�alignrrr	�push_alignment4szNullFormatter.push_alignmentcCsdS)Nr)rrrr	�
pop_alignment5szNullFormatter.pop_alignmentcCsdS)Nr)r�xrrr	�	push_font6szNullFormatter.push_fontcCsdS)Nr)rrrr	�pop_font7szNullFormatter.pop_fontcCsdS)Nr)r�marginrrr	�push_margin8szNullFormatter.push_margincCsdS)Nr)rrrr	�
pop_margin9szNullFormatter.pop_margincCsdS)Nr)r�spacingrrr	�set_spacing:szNullFormatter.set_spacingcGsdS)Nr)r�stylesrrr	�
push_style;szNullFormatter.push_style�cCsdS)Nr)r�nrrr	�	pop_style<szNullFormatter.pop_stylecCsdS)Nr)r�flagrrr	�assert_line_data=szNullFormatter.assert_line_data)N)N)r%)r%)�__name__�
__module__�__qualname__r
rr
rrrrrrrrrrr r"r$r'r)rrrr	rs$


rc@s�eZdZdd�Zdd�Zdd�Zdd�Zd-d
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd.d)d*�Zd/d+d,�Zd	S)0�AbstractFormattercCsR||_d|_g|_g|_g|_d|_g|_d|_d|_d|_	d|_
d|_d|_dS)Nr%r)
rr�align_stack�
font_stack�margin_stackr!�style_stack�nospace�	softspace�para_end�parskip�
hard_break�
have_label)rrrrr	r
NszAbstractFormatter.__init__cCsb|js|jj�d|_|j|krF|jrF|jj||j�||_d|_d|_|_|_d|_dS)Nrr%)	r6r�send_line_breakr7r5�send_paragraphr2r4r3)rrrrr	r]s
zAbstractFormatter.end_paragraphcCs8|jp
|js"|jj�d|_|_d|_|_d|_dS)Nrr%)r6r4rr8r7r5r2r3)rrrr	r
hs

z AbstractFormatter.add_line_breakcOsF|js|jj�|jj||�d|_|_d|_|_|_|_dS)Nr%r)	r6rr8�
send_hor_ruler2r7r4r3r5)rrrrrr	ros

zAbstractFormatter.add_hor_ruleNcCs�|js|jr|jj�|js2|jj|r,dp.d�t|t�rR|jj|j	||��n|jj|�d|_
|_|_|_d|_|_dS)Nr%r)
r7r6rr8r4r9�
isinstance�str�send_label_data�format_counterr2r3r5)rrrrrrr	rvs

z AbstractFormatter.add_label_datacCsxd}xn|D]f}|dkr$|d|}q
|dkrF|dkrp||j||�}q
|dkrh|dkrp||j||�}q
||}q
W|S)N��1z%dZaArZiI)�
format_letter�format_roman)rrr�label�crrr	r>�s
z AbstractFormatter.format_countercCs@d}x6|dkr:t|dd�\}}tt|�|�}||}qW|S)Nr?rr%�)�divmod�chr�ord)r�caserrCr�srrr	rA�s
zAbstractFormatter.format_letterc	Cs�ddddg}dddg}d\}}x�|d	kr�t|d
�\}}|dkrX||||d|}nT|d
krv|||||}n6|dkr�||}|d}nd}||||}||}|d}q W|dkr�|j�S|S)N�irrD�m�v�l�dr?r�
�	r%���I)r?r)rF�upper)	rrIrZonesZfivesrC�indexrrJrrr	rB�s&


zAbstractFormatter.format_romancCs�|sdS|dd�j�}|dd�j�}dj|j��}|jrF|rFdS|sP|jrx|sj|jsfd|_d|_dS|jsxd|}d|_|_|_|_|_||_|j	j
|�dS)Nr%� r���)�isspace�join�splitr2r3r5r6r4r7r�send_flowing_data)rrZprespaceZ	postspacerrr	r�s$
z"AbstractFormatter.add_flowing_datacCsZ|sdS|jr|jjd�|dd�dk|_d|_|_|_|_|_|jj|�dS)NrWr%�
rrX)	r3rr\r6r2r4r5r7�send_literal_data)rrrrr	r�sz"AbstractFormatter.add_literal_datacCs:|jr6d|_|_|_|_|_d|_|jjd�dS)Nrr%rW)r3r6r4r5r7r2rr\)rrrr	r�sz!AbstractFormatter.flush_softspacecCs@|r.||jkr.|jj|�||_|jj|�n|jj|j�dS)N)rr�
new_alignmentr.�append)rrrrr	r�s
z AbstractFormatter.push_alignmentcCsH|jr|jd=|jr2|jd|_}|jj|�nd|_|jjd�dS)Nr%rXrX)r.rrr_)rrrrr	r�szAbstractFormatter.pop_alignmentc
Cs�|\}}}}|jr6d|_|_|_d|_|jjd�|jr~|jd\}}}}	|tkrZ|}|tkrf|}|tkrr|}|tkr~|	}||||f}|jj|�|jj	|�dS)Nrr%rWrX)
r3r6r4r2rr\r/�AS_ISr`�new_font)
r�font�sizerK�bZttZcsizeZci�cbZcttrrr	r�s$zAbstractFormatter.push_fontcCs4|jr|jd=|jr |jd}nd}|jj|�dS)Nr%rXrX)r/rrb)rrcrrr	r�szAbstractFormatter.pop_fontcCsD|jj|�dd�|jD�}|r.|r.|d}|jj|t|��dS)NcSsg|]}|r|�qSrr)�.0rLrrr	�
<listcomp>sz1AbstractFormatter.push_margin.<locals>.<listcomp>r%rX)r0r`r�
new_margin�len)rr�fstackrrr	rs

zAbstractFormatter.push_margincCsF|jr|jd=dd�|jD�}|r,|d}nd}|jj|t|��dS)Nr%cSsg|]}|r|�qSrr)rgrLrrr	rh
sz0AbstractFormatter.pop_margin.<locals>.<listcomp>rXrX)r0rrirj)rrkrrrr	r 
s
zAbstractFormatter.pop_margincCs||_|jj|�dS)N)r!r�new_spacing)rr!rrr	r"szAbstractFormatter.set_spacingcGsZ|jr*d|_|_|_d|_|jjd�x|D]}|jj|�q0W|jjt	|j��dS)Nrr%rW)
r3r6r4r2rr\r1r`�
new_styles�tuple)rr#Zstylerrr	r$s
zAbstractFormatter.push_styler%cCs$|j|d�=|jjt|j��dS)N)r1rrmrn)rr&rrr	r'!szAbstractFormatter.pop_stylecCs$||_|_d|_|_|_dS)Nr)r2r6r4r5r7)rr(rrr	r)%sz"AbstractFormatter.assert_line_data)N)r%)r%)r*r+r,r
rr
rrr>rArBrrrrrrrrr r"r$r'r)rrrr	r-@s*
	
	
	
r-c@steZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)rcCsdS)Nr)rrrr	r
2szNullWriter.__init__cCsdS)Nr)rrrr	�flush3szNullWriter.flushcCsdS)Nr)rrrrr	r_4szNullWriter.new_alignmentcCsdS)Nr)rrcrrr	rb5szNullWriter.new_fontcCsdS)Nr)rr�levelrrr	ri6szNullWriter.new_margincCsdS)Nr)rr!rrr	rl7szNullWriter.new_spacingcCsdS)Nr)rr#rrr	rm8szNullWriter.new_stylescCsdS)Nr)rrrrr	r99szNullWriter.send_paragraphcCsdS)Nr)rrrr	r8:szNullWriter.send_line_breakcOsdS)Nr)rrrrrr	r:;szNullWriter.send_hor_rulecCsdS)Nr)rrrrr	r=<szNullWriter.send_label_datacCsdS)Nr)rrrrr	r\=szNullWriter.send_flowing_datacCsdS)Nr)rrrrr	r^>szNullWriter.send_literal_dataN)r*r+r,r
ror_rbrirlrmr9r8r:r=r\r^rrrr	r*src@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�AbstractWritercCstd|f�dS)Nznew_alignment(%r))�print)rrrrr	r_IszAbstractWriter.new_alignmentcCstd|f�dS)Nznew_font(%r))rr)rrcrrr	rbLszAbstractWriter.new_fontcCstd||f�dS)Nznew_margin(%r, %d))rr)rrrprrr	riOszAbstractWriter.new_margincCstd|f�dS)Nznew_spacing(%r))rr)rr!rrr	rlRszAbstractWriter.new_spacingcCstd|f�dS)Nznew_styles(%r))rr)rr#rrr	rmUszAbstractWriter.new_stylescCstd|f�dS)Nzsend_paragraph(%r))rr)rrrrr	r9XszAbstractWriter.send_paragraphcCstd�dS)Nzsend_line_break())rr)rrrr	r8[szAbstractWriter.send_line_breakcOstd�dS)Nzsend_hor_rule())rr)rrrrrr	r:^szAbstractWriter.send_hor_rulecCstd|f�dS)Nzsend_label_data(%r))rr)rrrrr	r=aszAbstractWriter.send_label_datacCstd|f�dS)Nzsend_flowing_data(%r))rr)rrrrr	r\dsz AbstractWriter.send_flowing_datacCstd|f�dS)Nzsend_literal_data(%r))rr)rrrrr	r^gsz AbstractWriter.send_literal_dataN)r*r+r,r_rbrirlrmr9r8r:r=r\r^rrrr	rqAsrqc@sFeZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dS)�
DumbWriterN�HcCs(|ptj|_||_tj|�|j�dS)N)�sys�stdout�file�maxcolrr
�reset)rrwrxrrr	r
ts
zDumbWriter.__init__cCsd|_d|_dS)Nr)�col�atbreak)rrrr	ryzszDumbWriter.resetcCs |jjd|�d|_d|_dS)Nr]r)rw�writerzr{)rrrrr	r9~szDumbWriter.send_paragraphcCs|jjd�d|_d|_dS)Nr]r)rwr|rzr{)rrrr	r8�szDumbWriter.send_line_breakcOs:|jjd�|jjd|j�|jjd�d|_d|_dS)Nr]�-r)rwr|rxrzr{)rrrrrr	r:�s
zDumbWriter.send_hor_rulecCsV|jj|�|jd�}|dkr4d|_||dd�}|j�}|jt|�|_d|_dS)Nr]rr%)rwr|�rfindrz�
expandtabsrjr{)rrrKrrr	r^�s
zDumbWriter.send_literal_datacCs�|sdS|jp|dj�}|j}|j}|jj}xZ|j�D]N}|rn|t|�|kr^|d�d}n|d�|d}||�|t|�}d}q8W||_|dj�|_dS)Nrr]rWr%rX)r{rYrzrxrwr|r[rj)rrr{rzrxr|Zwordrrr	r\�s$zDumbWriter.send_flowing_data)Nrt)
r*r+r,r
ryr9r8r:r^r\rrrr	rsks	

rscCs�t�}t|�}|dk	r t|�}n$tjdd�r>ttjd�}ntj}z0x*|D]"}|dkrd|jd�qL|j|�qLWWd|tjk	r�|j�X|jd�dS)Nr%r]r)	rsr-�openru�argv�stdinrr�close)rw�w�f�fp�linerrr	�test�s



r��__main__)N)ru�warnings�warn�DeprecationWarningrarr-rrqrsr�r*rrrr	�<module>s"k*C
imaplib.cpython-36.pyc000064400000122234150335715140010617 0ustar003


 \/��2@s�dZdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZmZm
Z
ddlmZyddlZdZWnek
r�dZYnXdd	d
ddd
gZdZdZdZdZdgZdZdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�)Zejd�Zejd�Zejd�Zejdej�Z ejd�Z!ejd�Z"ejd�Z#ejdej�Z$dZ%dZ&Gd d�d�Z'e�r�Gd!d"�d"e'�Z(ej)d"�Gd#d	�d	e'�Z*Gd$d%�d%�Z+d&j,d'�Z-d(d)�e.e-d*d��D�Z/d+d
�Z0d,d�Z1d-d�Z2d.d
�Z3e4d/k�r�ddl5Z5ddl6Z6ye5j5ej7d*d�d0�\Z8Z9Wn0e5j:k
�rrZ;zffZ8Z9WYddZ;[;XnXdZ<x@e8D]8\Z=Z;e=d1k�r�e>e;�Zne=d2k�r~e;Z<e9�s~e<fZ9�q~We9�s�d�Z9e9dZ?e6j@�ZAe6j6d4eAe?�p�d5f�ZBd6eAd7d8�ZCd9eAeBffd�d�d�d@d?ddeCffd�d�d�d�d�dNffdOffdPffdQfffZDdDffd�d�d�d@dddeCffdPffdXfffZEdYdZ�ZF�y&e<�r�e*e<�ZGne'e?�ZGeGjHdk�r�eDd*d�ZDeGjId[eGjJ�eGjId\eGjKf�xeDD]\ZLZ9eFeLe9��q�WxJeFdAd��D]<ZMejNd_eM�ZOeO�reOjPd*�ZQneMj,�d�ZQeFd`eQf��q�Wx\eED]T\ZLZ9eFeLe9�ZReLe9fd�k�rZ�q6eRd�j,�ZSeS�sp�q6eFdTdadbeSd�dcf��q6WeTdd�Wn.eTde�e�s�eTdfej7d��YnXdS)�z�IMAP4 client.

Based on RFC 2060.

Public class:           IMAP4
Public variable:        Debug
Public functions:       Internaldate2tuple
                        Int2AP
                        ParseFlags
                        Time2Internaldate
z2.58�N)�datetime�timezone�	timedelta)�DEFAULT_BUFFER_SIZETF�IMAP4�IMAP4_stream�Internaldate2tuple�Int2AP�
ParseFlags�Time2Internaldates
�i��	IMAP4REV1i@B�AUTH�SELECTED�NONAUTH�LOGOUT))�APPEND�AUTHENTICATE�
CAPABILITY�CHECK�CLOSE�COPY�CREATE�DELETE�	DELETEACL�ENABLE�EXAMINE�EXPUNGE�FETCH�GETACL�
GETANNOTATION�GETQUOTA�GETQUOTAROOT�MYRIGHTS�LIST�LOGINr�LSUBZMOVE�	NAMESPACE�NOOP�PARTIAL�	PROXYAUTH�RENAME�SEARCH�SELECT�SETACL�
SETANNOTATION�SETQUOTA�SORT�STARTTLS�STATUS�STORE�	SUBSCRIBE�THREAD�UID�UNSUBSCRIBEs\+( (?P<data>.*))?s.*FLAGS \((?P<flags>[^\)]*)\)s�.*INTERNALDATE "(?P<day>[ 0123][0-9])-(?P<mon>[A-Z][a-z][a-z])-(?P<year>[0-9][0-9][0-9][0-9]) (?P<hour>[0-9][0-9]):(?P<min>[0-9][0-9]):(?P<sec>[0-9][0-9]) (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])"s.*{(?P<size>\d+)}$s
\r\n|\r|\ns%\[(?P<type>[A-Z-]+)( (?P<data>.*))?\]s$\* (?P<type>[A-Z-]+)( (?P<data>.*))?s3\* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?c@s�eZdZdZGdd�de�ZGdd�de�ZGdd�de�Zdefd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdefdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Z d9d:�Z!d;d<�Z"d=d>�Z#d?d@�Z$dAdB�Z%dCdD�Z&dEdF�Z'dGdH�Z(d�dKdL�Z)dMdN�Z*dOdP�Z+dQdR�Z,dSdT�Z-d�dUdV�Z.dWdX�Z/dYdZ�Z0d[d\�Z1d]d^�Z2d_d`�Z3dadb�Z4dcdd�Z5d�dgdh�Z6didj�Z7dkdl�Z8dmdn�Z9dodp�Z:d�drds�Z;dtdu�Z<dvdw�Z=dxdy�Z>dzd{�Z?d|d}�Z@d~d�ZAd�d��ZBd�d��ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGd�d��ZHd�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOd�d�d��ZPd�d��ZQd�d��ZRd�d��ZSdqS)�ra�IMAP4 client class.

    Instantiate with: IMAP4([host[, port]])

            host - host's name (default: localhost);
            port - port number (default: standard IMAP4 port).

    All IMAP4rev1 commands are supported by methods of the same
    name (in lower-case).

    All arguments to commands are converted to strings, except for
    AUTHENTICATE, and the last argument to APPEND which is passed as
    an IMAP4 literal.  If necessary (the string contains any
    non-printing characters or white-space and isn't enclosed with
    either parentheses or double quotes) each string is quoted.
    However, the 'password' argument to the LOGIN command is always
    quoted.  If you want to avoid having an argument string quoted
    (eg: the 'flags' argument to STORE) then enclose the string in
    parentheses (eg: "(\Deleted)").

    Each command returns a tuple: (type, [data, ...]) where 'type'
    is usually 'OK' or 'NO', and 'data' is either the text from the
    tagged response, or untagged results from command. Each 'data'
    is either a string, or a tuple. If a tuple, then the first part
    is the header of the response, and the second part contains
    the data (ie: 'literal' value).

    Errors raise the exception class <instance>.error("<reason>").
    IMAP4 server errors raise <instance>.abort("<reason>"),
    which is a sub-class of 'error'. Mailbox status changes
    from READ-WRITE to READ-ONLY raise the exception class
    <instance>.readonly("<reason>"), which is a sub-class of 'abort'.

    "error" exceptions imply a program error.
    "abort" exceptions imply the connection should be reset, and
            the command re-tried.
    "readonly" exceptions imply the command should be re-tried.

    Note: to use this module, you must read the RFCs pertaining to the
    IMAP4 protocol, as the semantics of the arguments to each IMAP4
    command are left to the invoker, not to mention the results. Also,
    most IMAP servers implement a sub-set of the commands available here.
    c@seZdZdS)zIMAP4.errorN)�__name__�
__module__�__qualname__�r<r<�/usr/lib64/python3.6/imaplib.py�error�sr>c@seZdZdS)zIMAP4.abortN)r9r:r;r<r<r<r=�abort�sr?c@seZdZdS)zIMAP4.readonlyN)r9r:r;r<r<r<r=�readonly�sr@�cCs�t|_d|_d|_i|_i|_d|_d|_d|_d|_	|j
�|j||�y|j�Wn8t
k
r�y|j�Wntk
r�YnX�YnXdS)NrrAFr)�Debug�debug�state�literal�tagged_commands�untagged_responses�continuation_response�is_readonly�tagnum�_tls_established�_mode_ascii�open�_connect�	Exception�shutdown�OSError)�self�host�portr<r<r=�__init__�s&zIMAP4.__init__cCs0d|_d|_tjttj�|_tjttj�|_dS)NF�ascii)	�utf8_enabled�	_encoding�re�compile�_Literal�ASCII�Literal�_Untagged_status�Untagged_status)rRr<r<r=rL�szIMAP4._mode_asciicCs(d|_d|_tjt�|_tjt�|_dS)NTzutf-8)rWrXrYrZr[r]r^r_)rRr<r<r=�
_mode_utf8�szIMAP4._mode_utf8cCs�ttjdd��|_tjd|jdtj�|_d|_d|_	i|_
|jdkrf|jdt
�|jd	|j�|j�|_d
|jkr�d|_nd|jkr�d
|_n|j|j��|j�|jdkr�|jd|jf�x tD]}||jkr�q�||_dSW|jd��dS)Nii��s(?P<tag>s"\d+) (?P<type>[A-Z]+) (?P<data>.*)�
r�zimaplib version %sznew IMAP4 connection, tag=%sZPREAUTHr�OKr�zCAPABILITIES: %rzserver not IMAP4 compliant)r	�randomZrandint�tagprerYrZr\�tagre�_cmd_log_len�_cmd_log_idx�_cmd_logrC�_mesg�__version__�
_get_responseZwelcomerGrDr>�_get_capabilities�capabilities�AllowedVersions�PROTOCOL_VERSION)rR�versionr<r<r=rN�s0






zIMAP4._connectcCs&|tkrt||j��Std|��dS)NzUnknown IMAP4 command: '%s')�Commands�getattr�lower�AttributeError)rR�attrr<r<r=�__getattr__	szIMAP4.__getattr__cCs|S)Nr<)rRr<r<r=�	__enter__szIMAP4.__enter__cGs&y|j�Wntk
r YnXdS)N)�logoutrQ)rR�argsr<r<r=�__exit__szIMAP4.__exit__cCs |js
dn|j}tj||jf�S)N)rS�socketZcreate_connectionrT)rRrSr<r<r=�_create_socketszIMAP4._create_socketcCs(||_||_|j�|_|jjd�|_dS)z�Setup connection to remote server on "host:port"
            (default: localhost:standard IMAP4 port).
        This connection will be used by the routines:
            read, readline, send, shutdown.
        �rbN)rSrTr~�sock�makefile�file)rRrSrTr<r<r=rM#s
z
IMAP4.opencCs|jj|�S)zRead 'size' bytes from remote.)r��read)rR�sizer<r<r=r�/sz
IMAP4.readcCs.|jjtd�}t|�tkr*|jdt��|S)zRead line from remote.rbzgot more than %d bytes)r��readline�_MAXLINE�lenr>)rR�liner<r<r=r�4szIMAP4.readlinecCs|jj|�dS)zSend data to remote.N)r�Zsendall)rR�datar<r<r=�send<sz
IMAP4.sendcCst|jj�zXy|jjtj�Wn@tk
r^}z$|jtjkrNt	|dd�dkrN�WYdd}~XnXWd|jj�XdS)z Close I/O established in "open".Zwinerrorri&'N)
r��closer�rPr}Z	SHUT_RDWRrQ�errnoZENOTCONNrt)rR�excr<r<r=rPAs
zIMAP4.shutdowncCs|jS)zfReturn socket instance used to connect to IMAP4 server.

        socket = <instance>.socket()
        )r�)rRr<r<r=r}QszIMAP4.socketcCsBd}|jddg|�\}}|dr(||fS|j�\}}|j|||�S)aReturn most recent 'RECENT' responses if any exist,
        else prompt server for an update using the 'NOOP' command.

        (typ, [data]) = <instance>.recent()

        'data' is None if no new messages,
        else list of RECENT responses, most recent last.
        ZRECENTrcNrb���)�_untagged_response�noop)rR�name�typ�datr<r<r=�recent]s	zIMAP4.recentcCs|j|dg|j��S)z�Return data for response 'code' if received, or None.

        Old value for response 'code' is cleared.

        (code, [data]) = <instance>.response(code)
        N)r��upper)rR�coder<r<r=�responsenszIMAP4.responsecCsxd}|sd}|r.|d|dfdkr2d|}nd}|r@t|�}nd}tjt|�}|jrbd	|d
}||_|j||||�S)
z�Append message to named mailbox.

        (typ, [data]) = <instance>.append(mailbox, flags, date_time, message)

                All args except `message' can be None.
        r�INBOXrrb�(�)z(%s)NsUTF8 (�)r�)r�r�)r�MapCRLF�sub�CRLFrWrE�_simple_command)rR�mailbox�flags�	date_time�messager�rEr<r<r=�append|s

zIMAP4.appendcCsP|j�}t|�j|_|jd|�\}}|dkrB|j|djdd���d|_||fS)asAuthenticate command - requires response processing.

        'mechanism' specifies which authentication mechanism is to
        be used - it must appear in <instance>.capabilities in the
        form AUTH=<mechanism>.

        'authobject' must be a callable object:

                data = authobject(response)

        It will be called to process server continuation responses; the
        response argument it is passed will be a bytes.  It should return bytes
        data that will be base64 encoded and sent to the server.  It should
        return None if the client abort response '*' should be sent instead.
        rrcrbzutf-8�replacerr�)r��_Authenticator�processrEr�r>�decoderD)rRZ	mechanismZ
authobject�mechr�r�r<r<r=�authenticate�szIMAP4.authenticatecCs d}|j|�\}}|j|||�S)zT(typ, [data]) = <instance>.capability()
        Fetch capabilities list from server.r)r�r�)rRr�r�r�r<r<r=�
capability�szIMAP4.capabilitycCs
|jd�S)zRCheckpoint mailbox on server.

        (typ, [data]) = <instance>.check()
        r)r�)rRr<r<r=�check�szIMAP4.checkcCs$z|jd�\}}Wdd|_X||fS)z�Close currently selected mailbox.

        Deleted messages are removed from writable mailbox.
        This is the recommended command before 'LOGOUT'.

        (typ, [data]) = <instance>.close()
        rNr)r�rD)rRr�r�r<r<r=r��szIMAP4.closecCs|jd||�S)z�Copy 'message_set' messages onto end of 'new_mailbox'.

        (typ, [data]) = <instance>.copy(message_set, new_mailbox)
        r)r�)rR�message_setZnew_mailboxr<r<r=�copy�sz
IMAP4.copycCs|jd|�S)zPCreate new mailbox.

        (typ, [data]) = <instance>.create(mailbox)
        r)r�)rRr�r<r<r=�create�szIMAP4.createcCs|jd|�S)zPDelete old mailbox.

        (typ, [data]) = <instance>.delete(mailbox)
        r)r�)rRr�r<r<r=�delete�szIMAP4.deletecCs|jd||�S)z�Delete the ACLs (remove any rights) set for who on mailbox.

        (typ, [data]) = <instance>.deleteacl(mailbox, who)
        r)r�)rRr��whor<r<r=�	deleteacl�szIMAP4.deleteaclcCsHd|jkrtjd��|jd|�\}}|dkr@d|j�kr@|j�||fS)zkSend an RFC5161 enable string to the server.

        (typ, [data]) = <intance>.enable(capability)
        rzServer does not support ENABLErczUTF8=ACCEPT)rorr>r�r�r`)rRr�r�r�r<r<r=�enable�s

zIMAP4.enablecCs d}|j|�\}}|j|||�S)z�Permanently remove deleted items from selected mailbox.

        Generates 'EXPUNGE' response for each deleted message.

        (typ, [data]) = <instance>.expunge()

        'data' is list of 'EXPUNGE'd message numbers in order received.
        r)r�r�)rRr�r�r�r<r<r=�expunge�s	z
IMAP4.expungecCs$d}|j|||�\}}|j|||�S)a#Fetch (parts of) messages.

        (typ, [data, ...]) = <instance>.fetch(message_set, message_parts)

        'message_parts' should be a string of selected parts
        enclosed in parentheses, eg: "(UID BODY[TEXT])".

        'data' are tuples of message part envelope and data.
        r)r�r�)rRr�Z
message_partsr�r�r�r<r<r=�fetchs
zIMAP4.fetchcCs|jd|�\}}|j||d�S)zXGet the ACLs for a mailbox.

        (typ, [data]) = <instance>.getacl(mailbox)
        rZACL)r�r�)rRr�r�r�r<r<r=�getaclszIMAP4.getaclcCs"|jd|||�\}}|j||d�S)za(typ, [data]) = <instance>.getannotation(mailbox, entry, attribute)
        Retrieve ANNOTATIONs.r �
ANNOTATION)r�r�)rRr��entryZ	attributer�r�r<r<r=�
getannotation#szIMAP4.getannotationcCs|jd|�\}}|j||d�S)z�Get the quota root's resource usage and limits.

        Part of the IMAP4 QUOTA extension defined in rfc2087.

        (typ, [data]) = <instance>.getquota(root)
        r!�QUOTA)r�r�)rR�rootr�r�r<r<r=�getquota+szIMAP4.getquotacCs@|jd|�\}}|j||d�\}}|j||d�\}}|||gfS)z�Get the list of quota roots for the named mailbox.

        (typ, [[QUOTAROOT responses...], [QUOTA responses]]) = <instance>.getquotaroot(mailbox)
        r"r�Z	QUOTAROOT)r�r�)rRr�r�r�ZquotaZ	quotarootr<r<r=�getquotaroot6szIMAP4.getquotaroot�""�*cCs$d}|j|||�\}}|j|||�S)z�List mailbox names in directory matching pattern.

        (typ, [data]) = <instance>.list(directory='""', pattern='*')

        'data' is list of LIST responses.
        r$)r�r�)rR�	directory�patternr�r�r�r<r<r=�listAsz
IMAP4.listcCs<|jd||j|��\}}|dkr.|j|d��d|_||fS)z�Identify client using plaintext password.

        (typ, [data]) = <instance>.login(user, password)

        NB: 'password' will be quoted.
        r%rcrbrr�)r��_quoter>rD)rR�user�passwordr�r�r<r<r=�loginMs
zIMAP4.logincCs|||_|_|jd|j�S)zr Force use of CRAM-MD5 authentication.

        (typ, [data]) = <instance>.login_cram_md5(user, password)
        zCRAM-MD5)r�r�r��_CRAM_MD5_AUTH)rRr�r�r<r<r=�login_cram_md5[szIMAP4.login_cram_md5cCsBddl}t|jt�r |jjd�n|j}|jd|j||d�j�S)z1 Authobject to use with CRAM-MD5 authentication. rNzutf-8� Zmd5)�hmac�
isinstancer��str�encoder�ZHMACZ	hexdigest)rRZ	challenger��pwdr<r<r=r�dszIMAP4._CRAM_MD5_AUTHcCsjd|_y|jd�\}}Wn(ddtj�dd�g}}YnX|j�d|jkrbd|jdfS||fS)z|Shutdown connection to server.

        (typ, [data]) = <instance>.logout()

        Returns server 'BYE' response.
        r�NOz%s: %sN��BYE)rDr��sys�exc_inforPrG)rRr�r�r<r<r=rzls"
zIMAP4.logoutcCs$d}|j|||�\}}|j|||�S)z�List 'subscribed' mailbox names in directory matching pattern.

        (typ, [data, ...]) = <instance>.lsub(directory='""', pattern='*')

        'data' are tuples of message part envelope and data.
        r&)r�r�)rRr�r�r�r�r�r<r<r=�lsub|sz
IMAP4.lsubcCs|jd|�\}}|j||d�S)z�Show my ACLs for a mailbox (i.e. the rights that I have on mailbox).

        (typ, [data]) = <instance>.myrights(mailbox)
        r#)r�r�)rRr�r�r�r<r<r=�myrights�szIMAP4.myrightscCs d}|j|�\}}|j|||�S)zb Returns IMAP namespaces ala rfc2342

        (typ, [data, ...]) = <instance>.namespace()
        r')r�r�)rRr�r�r�r<r<r=�	namespace�szIMAP4.namespacecCs |jdkr|j|j�|jd�S)zFSend NOOP command.

        (typ, [data]) = <instance>.noop()
        rdr()rC�_dump_urrGr�)rRr<r<r=r��s
z
IMAP4.noopcCs(d}|j|||||�\}}|j||d�S)z�Fetch truncated part of a message.

        (typ, [data, ...]) = <instance>.partial(message_num, message_part, start, length)

        'data' is tuple of message part envelope and data.
        r)r)r�r�)rRZmessage_numZmessage_part�startZlengthr�r�r�r<r<r=�partial�sz
IMAP4.partialcCsd}|jd|�S)z�Assume authentication as "user".

        Allows an authorised administrator to proxy into any user's
        mailbox.

        (typ, [data]) = <instance>.proxyauth(user)
        r*)r�)rRr�r�r<r<r=�	proxyauth�s	zIMAP4.proxyauthcCs|jd||�S)zkRename old mailbox name to new.

        (typ, [data]) = <instance>.rename(oldmailbox, newmailbox)
        r+)r�)rRZ
oldmailboxZ
newmailboxr<r<r=�rename�szIMAP4.renamecGsTd}|r2|jrtjd��|j|d|f|��\}}n|j|f|��\}}|j|||�S)z�Search mailbox for matching messages.

        (typ, [data]) = <instance>.search(charset, criterion, ...)

        'data' is space separated list of matching message numbers.
        If UTF8 is enabled, charset MUST be None.
        r,z'Non-None charset not valid in UTF8 mode�CHARSET)rWrr>r�r�)rR�charsetZcriteriar�r�r�r<r<r=�search�s
zIMAP4.searchr�FcCs�i|_||_|rd}nd}|j||�\}}|dkr@d|_||fSd|_d|jkrz|rz|jdkrl|j|j�|jd|��||jjd	d
g�fS)atSelect a mailbox.

        Flush all untagged responses.

        (typ, [data]) = <instance>.select(mailbox='INBOX', readonly=False)

        'data' is count of messages in mailbox ('EXISTS' response).

        Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY'), so
        other responses should be obtained via <instance>.response('FLAGS') etc.
        rr-rcrrz	READ-ONLYrbz%s is not writable�EXISTSN)rGrIr�rDrCr�r@�get)rRr�r@r�r�r�r<r<r=�select�s 

zIMAP4.selectcCs|jd|||�S)zZSet a mailbox acl.

        (typ, [data]) = <instance>.setacl(mailbox, who, what)
        r.)r�)rRr�r�Zwhatr<r<r=�setacl�szIMAP4.setaclcGs |jd|��\}}|j||d�S)z_(typ, [data]) = <instance>.setannotation(mailbox[, entry, attribute]+)
        Set ANNOTATIONs.r/r�)r/)r�r�)rRr{r�r�r<r<r=�
setannotation�szIMAP4.setannotationcCs |jd||�\}}|j||d�S)ziSet the quota root's resource limits.

        (typ, [data]) = <instance>.setquota(root, limits)
        r0r�)r�r�)rRr�Zlimitsr�r�r<r<r=�setquotaszIMAP4.setquotacGsFd}|d|dfdkr d|}|j|||f|��\}}|j|||�S)	z�IMAP4rev1 extension SORT command.

        (typ, [data]) = <instance>.sort(sort_criteria, charset, search_criteria, ...)
        r1rrbr�r�z(%s)r�)r�r�)r�r�)rRZ
sort_criteriar��search_criteriar�r�r�r<r<r=�sorts
z
IMAP4.sortNcCs�d}ts|jd��|jr"|jd��||jkr6|jd��|dkrFtj�}|j|�\}}|dkr�|j|j	|j
d�|_	|j	jd�|_d|_|j
�n
|jd	��|j|||�S)
Nr2zSSL support missingzTLS session already establishedzTLS not supported by serverrc)�server_hostnamerTzCouldn't establish TLS session)�HAVE_SSLr>rKr?ro�ssl�_create_stdlib_contextr��wrap_socketr�rSr�r�rnr�)rR�ssl_contextr�r�r�r<r<r=�starttlss$





zIMAP4.starttlscCs$d}|j|||�\}}|j|||�S)zpRequest named status conditions for mailbox.

        (typ, [data]) = <instance>.status(mailbox, names)
        r3)r�r�)rRr��namesr�r�r�r<r<r=�status5szIMAP4.statuscCs>|d|dfd	krd|}|jd|||�\}}|j||d�S)
z�Alters flag dispositions for messages in mailbox.

        (typ, [data]) = <instance>.store(message_set, command, flags)
        rrbr�r�z(%s)r4rr�)r�r�)r�r�)rRr��commandr�r�r�r<r<r=�storeAszIMAP4.storecCs|jd|�S)zYSubscribe to new mailbox.

        (typ, [data]) = <instance>.subscribe(mailbox)
        r5)r�)rRr�r<r<r=�	subscribeLszIMAP4.subscribecGs*d}|j|||f|��\}}|j|||�S)z�IMAPrev1 extension THREAD command.

        (type, [data]) = <instance>.thread(threading_algorithm, charset, search_criteria, ...)
        r6)r�r�)rRZthreading_algorithmr�r�r�r�r�r<r<r=�threadTszIMAP4.threadcGs�|j�}|tkr|jd|��|jt|krL|jd||jdjt|�f��d}|j||f|��\}}|d	krt|}nd}|j|||�S)
z�Execute "command arg ..." with messages identified by UID,
                rather than message number.

        (typ, [data]) = <instance>.uid(command, arg1, arg2, ...)

        Returns response appropriate to 'command'.
        zUnknown IMAP4 UID command: %sz9command %s illegal in state %s, only allowed in states %sz, r7r,r1r6r)r,r1r6)r�rsr>rD�joinr�r�)rRr�r{r�r�r�r<r<r=�uid^sz	IMAP4.uidcCs|jd|�S)z_Unsubscribe from old mailbox.

        (typ, [data]) = <instance>.unsubscribe(mailbox)
        r8)r�)rRr�r<r<r=�unsubscribewszIMAP4.unsubscribecGs,|j�}|tkr|jft|<|j|f|��S)aAllow simple extension commands
                notified by server in CAPABILITY response.

        Assumes command is legal in current state.

        (typ, [data]) = <instance>.xatom(name, arg, ...)

        Returns response appropriate to extension command `name'.
        )r�rsrDr�)rRr�r{r<r<r=�xatoms
zIMAP4.xatomcCsb|dkrd}|j}|jdkr<|jd|t|j|d��|f�||krT||j|�n
|g||<dS)N��z#untagged_responses[%s] %s += ["%r"]rA)rGrCrkr�r�r�)rRr�r�Zurr<r<r=�_append_untagged�s
zIMAP4._append_untaggedcCs,|jjd�}|r(|j|dj|jd���dS)Nr�rbr�r�)rGr�r?r�rX)rRZbyer<r<r=�
_check_bye�szIMAP4._check_byec
GsB|jt|kr4d|_|jd||jdjt|�f��xdD]}||jkr:|j|=q:Wd|jkrp|jrp|jd��|j�}t	||j
�}|d|}x8|D]0}|dkr�q�t|t�r�t	||j
�}|d|}q�W|j}|dk	�rd|_t
|�t
|j�kr�|}nd}|t	d	t|�|j
�}|jd
k�r0|jd|�n|jd|�y|j|t�Wn2tk
�r�}	z|jd|	��WYdd}	~	XnX|dk�r�|Sx�x |j��r�|j|�r�|S�q�W|�r�||j�}|jd
k�r�|jd
t|��y|j|�|jt�Wn2tk
�r.}	z|jd|	��WYdd}	~	XnX|�s�P�q�W|S)Nz9command %s illegal in state %s, only allowed in states %sz, rcr��BADz	READ-ONLYz#mailbox status changed to READ-ONLY� z {%s}�z> %rzsocket error: %szwrite literal size %s)rcr�r�)rDrsrEr>r�rGrIr@�_new_tag�bytesrXr�r��type�_commandr�rCrk�_logr�r�rQr?rmrFrH)
rRr�r{r��tagr��argrEZ	literator�valr<r<r=r�sh






 



 zIMAP4._commandcCs�|dkr|j�y|j|�\}}Wnj|jk
rX}z|jd||f��WYdd}~Xn6|jk
r�}z|jd||f��WYdd}~XnX|dkr�|j�|dkr�|jd|||f��||fS)Nrzcommand: %s => %sr�z%s command error: %s %s)r��_get_tagged_responser?r>)rRr�rr�r�rr<r<r=�_command_complete�s"$zIMAP4._command_completecCsJ|j�\}}|dgkr |jd��t|d|j�}|j�}t|j��|_dS)Nz"no CAPABILITY response from serverrbr�)r�r>r�rXr��tuple�splitro)rRr�r�r<r<r=rns

zIMAP4._get_capabilitiescCs�|j�}|j|j|�rr|jjd�}||jkr:|jd|��|jjd�}t||j�}|jjd�}||gf|j|<�nd}|jt	|�s�|j|j
|�r�|jjd�}|jdkr�|jt|�r�|jjd�|_dS|jd|��|jjd�}t||j�}|jjd�}|dk�rd}|�r|d|}xb|j|j
|��rxt|jjd	��}|jd
k�rR|jd|�|j|�}|j|||f�|j�}�qW|j||�|dk�r�|jt|��r�|jjd�}t||j�}|j||jjd��|jdk�r�|dk�r�|jd||f�|S)Nrzunexpected tagged response: %rrr�Zdata2zunexpected response: %rr�r�r�r�zread literal size %srcr�r�rbr�z%s response: %r)rcr�r�)r�r�r�)�	_get_line�_matchrg�mo�grouprFr?r�rX�Untagged_responser_�ContinuationrHr]�intrCrkr�r��
Response_code)rR�resprr�r�Zdat2r�r�r<r<r=rmsP



zIMAP4._get_responsecCsvxp|j|}|dk	r |j|=|S|j�y|j�Wq|jk
rl}z|jdkrZ|j��WYdd}~XqXqWdS)Nrb)rFr�rmr?rC�	print_log)rRr�resultrr<r<r=r`s

zIMAP4._get_tagged_responsecCsf|j�}|s|jd��|jd�s.|jd|��|dd�}|jdkrT|jd|�n|jd|�|S)Nzsocket error: EOFs
z#socket error: unterminated line: %rr�r�z< %r���)r�r?�endswithrCrkr)rRr�r<r<r=r{s


zIMAP4._get_linecCsD|j|�|_|jdk	r:|jdkr:|jd|j|jj�f�|jdk	S)Nr�z	matched r'%r' => %r)�matchr
rCrkr��groups)rRZcre�sr<r<r=r�szIMAP4._matchcCs2|jtt|j�|j�}|jd|_d|j|<|S)Nrb)rfrr�rJrXrF)rRrr<r<r=r��s
zIMAP4._new_tagcCs$|jdd�}|jdd�}d|dS)N�\z\\�"z\")r�)rRrr<r<r=r��szIMAP4._quotecGs|j||j|f|���S)N)rr)rRr�r{r<r<r=r��szIMAP4._simple_commandcCsT|dkr||fS||jkr$|dgfS|jj|�}|jdkrL|jd||f�||fS)Nr�r�zuntagged_responses[%s] => %s)rG�poprCrk)rRr�r�r�r�r<r<r=r��s


zIMAP4._untagged_responsecCsN|dkrtj�}tjdtj|��}tjjd||dd|f�tjj�dS)Nz%M:%Sz
  %s.%02d %s
�d)�time�strftime�	localtimer��stderr�write�flush)rRrZsecsZtmr<r<r=rk�s
zIMAP4._mesgcCs>|j�}|sdSd}tdd�|�}|jd||j|�f�dS)Nz
		cSs*d|d|ddr"dj|d�p$dfS)Nz%s: "%s"rrbz" "rA)r�)�xr<r<r=�<lambda>�sz IMAP4._dump_ur.<locals>.<lambda>zuntagged responses dump:%s%s)�items�maprkr�)rR�dict�l�tr<r<r=r��szIMAP4._dump_urcCs8|tj�f|j|j<|jd7_|j|jkr4d|_dS)Nrbr)rrjrirh)rRr�r<r<r=r�sz
IMAP4._logc	Csp|jdt|j��|j|j}}xH|rjy|j|j|�WnYnX|d7}||jkr`d}|d8}q$WdS)Nzlast %d IMAP4 interactions:rbr)rkr�rjrirh)rR�i�nr<r<r=r�s
zIMAP4.print_log)r�r�)r�r�)r�F)N)N)Tr9r:r;�__doc__rOr>r?r@�
IMAP4_PORTrUrLr`rNrxryr|r~rMr�r�r�rPr}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rzr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrnrmrrrr�r�r�r�rkr�rrr<r<r<r=r�s�,*
		
	



 	

M	P
c@s:eZdZdZdedddfdd�Zdd�Zdefdd	�ZdS)
�	IMAP4_SSLa3IMAP4 client class over SSL connection

        Instantiate with: IMAP4_SSL([host[, port[, keyfile[, certfile[, ssl_context]]]]])

                host - host's name (default: localhost);
                port - port number (default: standard IMAP4 SSL port);
                keyfile - PEM formatted file that contains your private key (default: None);
                certfile - PEM formatted certificate chain file (default: None);
                ssl_context - a SSLContext object that contains your certificate chain
                              and private key (default: None)
                Note: if ssl_context is provided, then parameters keyfile or
                certfile should not be set otherwise ValueError is raised.

        for more documentation see the docstring of the parent class IMAP4.
        rANcCs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}|jdtd�||_||_|dkrxtj||d�}||_t	j
|||�dS)Nz8ssl_context and keyfile arguments are mutually exclusivez9ssl_context and certfile arguments are mutually exclusiverzEkeyfile and certfile are deprecated, use a custom ssl_context insteadr�)�certfile�keyfile)�
ValueError�warnings�warn�DeprecationWarningr2r1r�r�r�rrU)rRrSrTr2r1r�r4r<r<r=rU�szIMAP4_SSL.__init__cCstj|�}|jj||jd�S)N)r�)rr~r�r�rS)rRr�r<r<r=r~
s
zIMAP4_SSL._create_socketcCstj|||�dS)z�Setup connection to remote server on "host:port".
                (default: localhost:standard IMAP4 SSL port).
            This connection will be used by the routines:
                read, readline, send, shutdown.
            N)rrM)rRrSrTr<r<r=rMszIMAP4_SSL.open)r9r:r;r.�IMAP4_SSL_PORTrUr~rMr<r<r<r=r0�s
r0c@sBeZdZdZdd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)rz�IMAP4 client class over a stream

    Instantiate with: IMAP4_stream(command)

            "command" - a string that can be passed to subprocess.Popen()

    for more documentation see the docstring of the parent class IMAP4.
    cCs||_tj|�dS)N)r�rrU)rRr�r<r<r=rU&szIMAP4_stream.__init__NcCsNd|_d|_d|_d|_tj|jttjtjddd�|_	|j	j
|_|j	j|_
dS)z�Setup a stream connection.
        This connection will be used by the routines:
            read, readline, send, shutdown.
        NT)�bufsize�stdin�stdout�shellZ	close_fds)rSrTr�r��
subprocess�Popenr�r�PIPEr�r9�	writefiler:�readfile)rRrSrTr<r<r=rM+s
zIMAP4_stream.opencCs|jj|�S)zRead 'size' bytes from remote.)r@r�)rRr�r<r<r=r�;szIMAP4_stream.readcCs
|jj�S)zRead line from remote.)r@r�)rRr<r<r=r�@szIMAP4_stream.readlinecCs|jj|�|jj�dS)zSend data to remote.N)r?r#r$)rRr�r<r<r=r�EszIMAP4_stream.sendcCs"|jj�|jj�|jj�dS)z Close I/O established in "open".N)r@r�r?r��wait)rRr<r<r=rPKs

zIMAP4_stream.shutdown)NN)
r9r:r;r.rUrMr�r�r�rPr<r<r<r=rs	
c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r�zcPrivate class to provide en/decoding
            for base64-based authentication conversation.
    cCs
||_dS)N)r�)rRZmechinstr<r<r=rUYsz_Authenticator.__init__cCs&|j|j|��}|dkrdS|j|�S)N�*)r�r�r�)rRr�Zretr<r<r=r�\sz_Authenticator.processcCsrd}t|t�r|jd�}xT|rlt|�dkrD|dd�}|dd�}n|}d}tj|�}|r||dd�}qW|S)Nr�zutf-8�0rbr�)r�r�r�r��binasciiZ
b2a_base64)rR�inpZoupr+�er<r<r=r�bs	


z_Authenticator.encodecCs|sdStj|�S)Nr�)rDZ
a2b_base64)rRrEr<r<r=r�zsz_Authenticator.decodeN)r9r:r;r.rUr�r�r�r<r<r<r=r�Ss
r�z0 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Decr�cCsi|]\}}|d|j��qS)rb)r�)�.0r-rr<r<r=�
<dictcomp>�srHrbc	Cs�tj|�}|sdSt|jd�}|jd�}t|jd��}t|jd��}t|jd��}t|jd��}t|jd��}t|jd	��}	t|jd
��}
|	d|
d}|dkr�|}||||||dddf	}tj|�|}
tj|
�S)z�Parse an IMAP4 INTERNALDATE string.

    Return corresponding local time.  The return value is a
    time.struct_time tuple or None if the string has wrong format.
    N�mon�zonen�day�year�hour�min�sec�zoneh�zonem�<�-rbr�r�r�)	�InternalDater�Mon2numrr�calendarZtimegmrr!)rr
rIrJrKrLrMrNrOrPrQZzoneZtt�utcr<r<r=r�s$

cCsDd}d}tt|��}x*|r>t|d�\}}|||d�|}qW|S)z-Convert integer to A-P string representation.r�sABCDEFGHIJKLMNOP�rb)r�abs�divmod)ZnumrZAP�modr<r<r=r	�scCs$tj|�}|sfSt|jd�j��S)z-Convert IMAP4 flags response to python tuple.r�)�Flagsrr	rr
)rr
r<r<r=r
�s
c
Cs t|ttf�r"tj|tj�j�}n�t|t�r�y
|j	}WnZt
k
r�tjr�|d}|dkrptj
tj|��d}tjtjf|}ntj}YnXt|d�}t|dd�dt|�i�}nNt|t�r�|jdkr�td��|}n,t|t�o�|d|d
fdk�r�|Std
��djt|j�}|j|�S)a�Convert date_time to IMAP4 INTERNALDATE representation.

    Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'.  The
    date_time argument can be a number (int or float) representing
    seconds since epoch (as returned by time.time()), a 9-tuple
    representing local time, an instance of time.struct_time (as
    returned by time.localtime()), an aware datetime instance or a
    double-quoted string.  In the last case, it is assumed to already
    be in the correct format.
    �rb)ZsecondsN��tzinfozdate_time must be awarerrzdate_time not of a known typez"%d-{}-%Y %H:%M:%S %z"r�r�)rr)r�r�floatrZ
fromtimestamprrWZ
astimezoner	Z	tm_gmtoffrvrZdaylightr!ZmktimeZaltzonerr_r3r��format�MonthsZmonthr )r�ZdtZgmtoff�dstZdeltaZfmtr<r<r=r�s0




 �__main__zd:s:z-dz-srAzIMAP password for %s on %s: Z	localhostzJFrom: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)s�
)r�Zlfr�r��
/tmp/xxx 1r��/tmp/yyyr�
/tmp/yyz 2r�r��/tmp�yy*r�r��SUBJECT�testr��1�(FLAGS INTERNALDATE RFC822)r��FLAGS�
(\Deleted)r�r�r�r�r��UIDVALIDITYr�r,�ALLr�rzcCsLtjd||f�tt|�|�\}}tjd|||f�|dkrH|d�|S)Nz%s %sz%s => %s %sr�r)�Mrkrt)�cmdr{r�r�r<r<r=�runsruzPROTOCOL_VERSION = %szCAPABILITIES = %r�/tmp/�yy%z.*"([^"]+)"$r�rz%sz:(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)z
All tests OK.z
Tests failed.z8
If you would like to see debugging output,
try: %s -d5
)r
r)rr)r)rrrr)r)r)r)rr)rr)rr)r)rr)r)r)rr)rr)rr)rr)rr)rr)r)rrrr)rr)r)rr)rrrr)r)r)rr)r)rr)rr)rr)rr)r)r)rr)r)rr)r)r)rr)rA�rf)r�rx�rfrg)r�ry�rh)rrz�rirj)r�r{�rh)r�r|�Nrkrl)r�r}�rmrn)r�r~�rmrorp)r�r�rq)r�r��r,rr)r�r��r�)r�r�)rvrwr��r,rr)r�r�r�r�)Ur.rlrDr�rerYr}r<r�rrVrrr�iorr�r��ImportError�__all__r�rBr/r7rpr�rsrZrr\rTr\r]r�rrr_r[r^rr0r�rr�r
rb�	enumeraterUrr	r
rr9ZgetoptZgetpass�argvZoptlistr{r>rZstream_command�optrrSZgetuserZUSERZPASSWDZ	test_mesgZ	test_seq1Z	test_seq2rursrDrkrqrortZmlrr
r�pathr�r��printr<r<r<r=�<module>sFH

	



	


c4
9,
#
)








functools.cpython-36.opt-2.pyc000064400000043255150335715140012163 0ustar003


 \rz�+@s�dddddddddd	d
gZyddlmZWnek
r>YnXdd
lmZddlmZddlm	Z	ddl
mZddlm
Z
yddlmZWn"ek
r�Gdd�d�ZYnXdYZdZZeefdd�Zeefdd�Zefdd�Zefdd �Zefd!d"�Zefd#d$�Zefd%d&�Zefd'd(�Zefd)d*�Zefd+d,�Zefd-d.�Zefd/d0�Zefd1d2�Zefd3d4�Z d5efd6efd7efgd7efd8efd5efgd8efd7efd6efgd6efd5efd8e fgd9�Z!d:d�Z"d;d�Z#ydd<lm#Z#Wnek
�r�YnXGd=d�d�Z$ydd>lm$Z$Wnek
�r&YnXGd?d	�d	e%�Z&ed@dAdBdCdDg�Z'GdEdF�dFe(�Z)e%�fe*e+e,e-dG�he.e-e/fdHdI�Z0d[dLd�Z1dMdN�Z2yddOlm2Z2Wnek
�r�YnXdPdQ�Z3d\dRdS�Z4dTdU�Z5dVdW�Z6dXd
�Z7dGS)]�update_wrapper�wraps�WRAPPER_ASSIGNMENTS�WRAPPER_UPDATES�total_ordering�
cmp_to_key�	lru_cache�reduce�partial�
partialmethod�singledispatch�)r)�get_cache_token)�
namedtuple)�MappingProxyType)�WeakKeyDictionary)�recursive_repr)�RLockc@seZdZdd�Zdd�ZdS)rcCsdS)N�)�selfrr�!/usr/lib64/python3.6/functools.py�	__enter__szRLock.__enter__cCsdS)Nr)r�exctype�excinst�exctbrrr�__exit__szRLock.__exit__N)�__name__�
__module__�__qualname__rrrrrrrsrrrr�__doc__�__annotations__�__dict__c
Csnx<|D]4}yt||�}Wntk
r,YqXt|||�qWx$|D]}t||�jt||i��qDW||_|S)N)�getattr�AttributeError�setattr�update�__wrapped__)�wrapper�wrapped�assigned�updated�attr�valuerrrr,s

cCstt|||d�S)N)r'r(r))r	r)r'r(r)rrrrJscCs$|j|�}||kr|S|o"||kS)N)�__lt__)r�other�NotImplemented�	op_resultrrr�_gt_from_ltbs
r0cCs|j|�}|p||kS)N)r,)rr-r.r/rrr�_le_from_ltis
r1cCs|j|�}||kr|S|S)N)r,)rr-r.r/rrr�_ge_from_ltns
r2cCs$|j|�}||kr|S|p"||kS)N)�__le__)rr-r.r/rrr�_ge_from_leus
r4cCs"|j|�}||kr|S|o ||kS)N)r3)rr-r.r/rrr�_lt_from_le|s
r5cCs|j|�}||kr|S|S)N)r3)rr-r.r/rrr�_gt_from_le�s
r6cCs$|j|�}||kr|S|o"||kS)N)�__gt__)rr-r.r/rrr�_lt_from_gt�s
r8cCs|j|�}|p||kS)N)r7)rr-r.r/rrr�_ge_from_gt�s
r9cCs|j|�}||kr|S|S)N)r7)rr-r.r/rrr�_le_from_gt�s
r:cCs$|j|�}||kr|S|p"||kS)N)�__ge__)rr-r.r/rrr�_le_from_ge�s
r<cCs"|j|�}||kr|S|o ||kS)N)r;)rr-r.r/rrr�_gt_from_ge�s
r=cCs|j|�}||kr|S|S)N)r;)rr-r.r/rrr�_lt_from_ge�s
r>r7r3r;r,)r,r3r7r;csZ�fdd�tD�}|std��t|�}x.t|D]"\}}||kr0||_t�||�q0W�S)Ncs(g|] }t�|d�tt|d�k	r|�qS)N)r!�object)�.0�op)�clsrr�
<listcomp>�sz"total_ordering.<locals>.<listcomp>z6must define at least one ordering operation: < > <= >=)�_convert�
ValueError�maxrr#)rB�roots�root�opname�opfuncr)rBrr�scsG�fdd�dt�}|S)NcsZeZdZdgZdd�Z�fdd�Z�fdd�Z�fdd	�Z�fd
d�Z�fdd
�Z	dZ
dS)zcmp_to_key.<locals>.K�objcSs
||_dS)N)rK)rrKrrr�__init__�szcmp_to_key.<locals>.K.__init__cs�|j|j�dkS)Nr)rK)rr-)�mycmprrr,�szcmp_to_key.<locals>.K.__lt__cs�|j|j�dkS)Nr)rK)rr-)rMrrr7�szcmp_to_key.<locals>.K.__gt__cs�|j|j�dkS)Nr)rK)rr-)rMrr�__eq__�szcmp_to_key.<locals>.K.__eq__cs�|j|j�dkS)Nr)rK)rr-)rMrrr3�szcmp_to_key.<locals>.K.__le__cs�|j|j�dkS)Nr)rK)rr-)rMrrr;�szcmp_to_key.<locals>.K.__ge__N)rrr�	__slots__rLr,r7rNr3r;�__hash__r)rMrr�K�srQ)r?)rMrQr)rMrr�s)rcsFeZdZdZ�fdd�Zdd	�Ze�d
d��Zdd
�Zdd�Z	�Z
S)r	�func�args�keywordsr �__weakref__cs�|std��t|�dkr td��|^}}}t|�s:td��t|�}t|d�rv|j|}|jj�}|j|�|}~|j	}t
t|�j|�}||_	||_||_|S)Nz1descriptor '__new__' of partial needs an argument�z*type 'partial' takes at least one argumentz#the first argument must be callablerR)
�	TypeError�len�callable�tuple�hasattrrSrT�copyr$rR�superr	�__new__)rSrTrBrRZtmpkwr)�	__class__rrr^�s(




zpartial.__new__cOs:|std��|^}}|jj�}|j|�|j|j|�|�S)Nz2descriptor '__call__' of partial needs an argument)rWrTr\r$rRrS)rSrTrZnewkeywordsrrr�__call__s

zpartial.__call__cCs�t|�j}t|j�g}|jdd�|jD��|jdd�|jj�D��t|�jdkrld|�ddj	|��d�S|�ddj	|��d�S)	Ncss|]}t|�VqdS)N)�repr)r@�xrrr�	<genexpr>sz#partial.__repr__.<locals>.<genexpr>css |]\}}|�d|��VqdS)�=Nr)r@�k�vrrrrcs�	functoolsz
functools.�(z, �))
�typerrarR�extendrSrT�itemsr�join)r�qualnamerSrrr�__repr__s
zpartial.__repr__cCs*t|�|jf|j|j|jpd|jp$dffS)N)rjrRrSrTr )rrrr�
__reduce__#szpartial.__reduce__cCs�t|t�std��t|�dkr0tdt|�����|\}}}}t|�szt|t�sz|dk	rft|t�sz|dk	r�t|t�r�td��t|�}|dkr�i}nt|�tk	r�t|�}|dkr�i}||_||_||_	||_
dS)Nz(argument to __setstate__ must be a tuple�zexpected 4 items in state, got zinvalid partial state)�
isinstancerZrWrXrY�dictrjr rRrSrT)r�staterRrS�kwds�	namespacerrr�__setstate__'s(
zpartial.__setstate__)rRrSrTr rU)rrrrOr^r`rrorprw�
__classcell__rr)r_rr	�s
)r	c@s8eZdZdd�Zdd�Zdd�Zdd�Zed	d
��ZdS)r
cOsrt|�r$t|d�r$tdj|���t|t�r\|j|_|j||_|jj	�|_|jj
|�n||_||_||_dS)N�__get__z${!r} is not callable or a descriptor)rYr[rW�formatrrr
rRrSrTr\r$)rrRrSrTrrrrLMs
zpartialmethod.__init__cCsNdjtt|j��}djdd�|jj�D��}d}|j|jj|jj	|j
||d�S)Nz, css|]\}}dj||�VqdS)z{}={!r}N)rz)r@rerfrrrrccsz)partialmethod.__repr__.<locals>.<genexpr>z*{module}.{cls}({func}, {args}, {keywords}))�modulerBrRrSrT)rm�maprarSrTrlrzr_rrrR)rrSrT�
format_stringrrrroas

zpartialmethod.__repr__cs�fdd�}�j|_�|_|S)Ncs<�jj�}|j|�|^}}|f�jt|�}�j||�S)N)rTr\r$rSrZrR)rSrT�
call_keywords�cls_or_self�rest�	call_args)rrr�_methodms


z3partialmethod._make_unbound_method.<locals>._method)�__isabstractmethod__�_partialmethod)rr�r)rr�_make_unbound_methodlsz"partialmethod._make_unbound_methodcCs�t|jdd�}d}|dk	rd|||�}||jk	rdt|f|j�|j�}y|j|_Wntk
rbYnX|dkr||j�j||�}|S)Nry)	r!rRr	rSrT�__self__r"r�ry)rrKrB�get�result�new_funcrrrryws

zpartialmethod.__get__cCst|jdd�S)Nr�F)r!rR)rrrrr��sz"partialmethod.__isabstractmethod__N)	rrrrLror�ry�propertyr�rrrrr
Es
�	CacheInfo�hits�misses�maxsize�currsizec@s$eZdZdZefdd�Zdd�ZdS)�
_HashedSeq�	hashvaluecCs||dd�<||�|_dS)N)r�)r�tup�hashrrrrL�sz_HashedSeq.__init__cCs|jS)N)r�)rrrrrP�sz_HashedSeq.__hash__N)rrrrOr�rLrPrrrrr��sr�Nc
s�|}|r*||7}x|j�D]}	||	7}qW|rl||�fdd�|D��7}|r�||�fdd�|j�D��7}n$||�dkr��|d�|kr�|dSt|�S)Nc3s|]}�|�VqdS)Nr)r@rf)rjrrrc�sz_make_key.<locals>.<genexpr>c3s|]}�|�VqdS)Nr)r@rf)rjrrrc�s�r)rl�valuesr�)
rSru�typed�kwd_mark�	fasttypesrZrjrX�key�itemr)rjr�	_make_key�s r��Fcs.�dk	rt�t�rtd����fdd�}|S)Nz)Expected maxsize to be an integer or Nonecst|��t�}t||�S)N)�_lru_cache_wrapper�
_CacheInfor)�
user_functionr&)r�r�rr�decorating_function�sz&lru_cache.<locals>.decorating_function)rr�intrW)r�r�r�r)r�r�rr�scs�t��t�d\����i�d�	�
d��j��j�t��
g���ddg�dd�<�dkrh�
�fdd�}nN�dkr����	��
���fdd�}n*���������	�
���
���fd	d�}���	�
��
fd
d�}���	�
�
�fdd
�}||_||_|S)Nrr�rV�Fcs�||�}�d7�|S)Nr�r)rSrur�)r�r�rrr&�s
z#_lru_cache_wrapper.<locals>.wrappercsH�||��}�|��}|�k	r*�d7�|S�||�}|�|<�d7�|S)Nr�r)rSrur�r�)�cache�	cache_getr��make_keyr��sentinelr�r�rrr&�s

cs2�
||��}�	�f�|�}|dk	rr|\}}}}||�<||�<�
�}||�<�
�<||�<�
|�<�d7�|SWdQRX�||�}�	��|�kr�n��r�
}	||	�<||	�<|	��
�
�}
�
�}d�
�<�
�<�|
=|	�|<n6�
�}|�
||g}||�<�
�<�|<���k��d7�WdQRX|S)Nr�r)rSrur��linkZ	link_prevZ	link_nextZ_keyr�ZlastZoldrootZoldkeyZ	oldresult)�KEY�NEXT�PREV�RESULTr�r��	cache_len�fullr��lockr�r�r�rHr�r�rrr&sB


cs ���������SQRXdS)Nrr)r�r�r�r�r�r�rr�
cache_infoGsz&_lru_cache_wrapper.<locals>.cache_infocs<��.�j���ddg�dd�<d��d�WdQRXdS)NrF)�clearr)r�r�r�r�r�rHrr�cache_clearLs
z'_lru_cache_wrapper.<locals>.cache_clear)rr�rVr�)r?r�r��__len__rr�r�)r�r�r�r�r&r�r�r)r�r�r�r�r�r�r�r�r�r�r�r�r�r�rHr�r�r�rr��s**9	r�)r�cCs�g}x�dd�|D�}|s|Sx:|D]2}|d}x$|D]}||dd�kr4d}Pq4WPq"W|dkrhtd��|j|�x|D]}|d|krx|d=qxWqWdS)NcSsg|]}|r|�qSrr)r@�srrrrCksz_c3_merge.<locals>.<listcomp>rr�zInconsistent hierarchy)�RuntimeError�append)�	sequencesr��s1�	candidate�s2�seqrrr�	_c3_mergecs$



r�c
s&x8tt|j��D]"\}�t�d�rt|j�|}PqWd}�rFt��ng�t|jd|��}g}t|j|d��}x:�D]2�t|��rxt�fdd�|jD��rx|j��qxWx|D]��j	��q�W�fdd�|D�}�fdd�|D�}�fdd�|D�}	t
|gg|||	|g|g|g�S)	N�__abstractmethods__rc3s|]}t|��VqdS)N)�
issubclass)r@�b)�baserrrc�sz_c3_mro.<locals>.<genexpr>csg|]}t|�d��qS))�abcs)�_c3_mro)r@r�)r�rrrC�sz_c3_mro.<locals>.<listcomp>csg|]}t|�d��qS))r�)r�)r@r�)r�rrrC�scsg|]}t|�d��qS))r�)r�)r@r�)r�rrrC�s)�	enumerate�reversed�	__bases__r[rX�listr��anyr��remover�)
rBr��i�boundary�explicit_bases�abstract_bases�other_bases�explicit_c3_mros�abstract_c3_mros�
other_c3_mrosr)r�r�rr�~s(


r�cs�t�j����fdd���fdd��D���fdd���fdd��D��t���g}x��D]�}g}x<|j�D]0}|�krlt�|�rl|j�fdd�|jD��qlW|s�|j|�qZ|jtd	d
�x,|D]$}x|D]}||kr�|j|�q�Wq�WqZWt�|d�S)Ncs|�kot|d�ot�|�S)N�__mro__)r[r�)�typ)�basesrBrr�
is_related�sz _compose_mro.<locals>.is_relatedcsg|]}�|�r|�qSrr)r@�n)r�rrrC�sz _compose_mro.<locals>.<listcomp>cs(x"�D]}||kr||jkrdSqWdS)NTF)r�)r�r-)�typesrr�is_strict_base�s
z$_compose_mro.<locals>.is_strict_basecsg|]}�|�s|�qSrr)r@r�)r�rrrC�scsg|]}|�kr|�qSrr)r@r�)�type_setrrrC�sT)r��reverse)r�)�setr��__subclasses__r�r��sortrXr�)rBr��mror��found�sub�subclsr)r�rBr�r�r�r�r�_compose_mro�s*




r�cCsxt||j��}d}xZ|D]R}|dk	r^||kr\||jkr\||jkr\t||�r\tdj||���P||kr|}qW|j|�S)NzAmbiguous dispatch: {} or {})r��keysr�r�r�rzr�)rB�registryr��match�trrr�
_find_impl�s



r�cs�i�t��d����fdd��d	����fdd�	���fdd�}t|dd��|�t<�|_�|_t��|_�j|_t	||�|S)
Ncs|�dk	r"t�}�|kr"�j�|�y�|}WnHtk
rvy�|}Wntk
rht|��}YnX|�|<YnX|S)N)r
r��KeyErrorr�)rB�
current_token�impl)�cache_token�dispatch_cacher�rr�dispatch�sz singledispatch.<locals>.dispatchcsB|dkr��fdd�S|��<�dkr6t�d�r6t���j�|S)Ncs
��|�S)Nr)�f)rB�registerrr�<lambda>sz2singledispatch.<locals>.register.<locals>.<lambda>r�)r[r
r�)rBrR)r�r�r�r�)rBrr�sz singledispatch.<locals>.registercs&|st��d����|dj�||�S)Nz( requires at least 1 positional argumentr)rWr_)rS�kw)r��funcnamerrr&"szsingledispatch.<locals>.wrapperrzsingledispatch function)N)
rr!r?r�r�rr�r��_clear_cacher)rRr&r)r�r�r�r�r�r�rr�s


)rrrrr)r )r�F)N)8�__all__�
_functoolsr�ImportError�abcr
�collectionsrr�r�weakrefr�reprlibr�_threadrrrrrr.r0r1r2r4r5r6r8r9r:r<r=r>rDrrr	r?r
r�r�r�r��str�	frozensetrjrZrXr�rr�r�r�r�r�rrrrr�<module>s�

NN
%t
-)reprlib.cpython-36.pyc000064400000012432150335715140010637 0ustar003


 \��@s�dZdddgZddlZddlmZyddlmZWn ek
rRddlmZYnXd
d	d�Z	Gd
d�d�Z
dd�Ze
�Zej
Z
dS)zGRedo the builtin repr() (representation) but with limits on most sizes.�Repr�repr�recursive_repr�N)�islice)�	get_ident�...cs�fdd�}|S)zGDecorator to make a repr function return fillvalue for a recursive callcsXt�����fdd�}t�d�|_t�d�|_t�d�|_t�d�|_t�di�|_|S)NcsBt|�t�f}|�kr�S�j|�z�|�}Wd�j|�X|S)N)�idr�add�discard)�self�key�result)�	fillvalue�repr_running�
user_function��/usr/lib64/python3.6/reprlib.py�wrappers
z<recursive_repr.<locals>.decorating_function.<locals>.wrapper�
__module__�__doc__�__name__�__qualname__�__annotations__)�set�getattrrrrrr)rr)r)rrr�decorating_functionsz+recursive_repr.<locals>.decorating_functionr)rrr)rrrsc@s~eZdZdd�Zdd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS) rcCsFd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
dS)N�����()�maxlevel�maxtuple�maxlist�maxarray�maxdict�maxset�maxfrozenset�maxdeque�	maxstring�maxlong�maxother)rrrr�__init__)sz
Repr.__init__cCs|j||j�S)N)�repr1r!)r�xrrrr6sz	Repr.reprcCsVt|�j}d|kr$|j�}dj|�}t|d|�rFt|d|�||�S|j||�SdS)N� �_�repr_)�typer�split�join�hasattrr�
repr_instance)rr.�level�typename�partsrrrr-9s

z
Repr.repr1�c
s�t|�}|dkr|rd}nX|d�|j���fdd�t||�D�}	||krT|	jd�dj|	�}|dkrr|rr||}d|||fS)Nrz...�csg|]}�|���qSrr)�.0�elem)�newlevelr-rr�
<listcomp>Jsz'Repr._repr_iterable.<locals>.<listcomp>z, z%s%s%s)�lenr-r�appendr4)
rr.r7�left�right�maxiter�trail�n�s�piecesr)r>r-r�_repr_iterableCs

zRepr._repr_iterablecCs|j||dd|jd�S)N�(�)�,)rIr")rr.r7rrr�
repr_tuplePszRepr.repr_tuplecCs|j||dd|j�S)N�[�])rIr#)rr.r7rrr�	repr_listSszRepr.repr_listcCs,|sd|jSd|j}|j|||d|j�S)Nzarray('%s')z
array('%s', [z]))�typecoderIr$)rr.r7�headerrrr�
repr_arrayVs

zRepr.repr_arraycCs$|sdSt|�}|j||dd|j�S)Nzset()�{�})�_possibly_sortedrIr&)rr.r7rrr�repr_set\sz
Repr.repr_setcCs$|sdSt|�}|j||dd|j�S)Nzfrozenset()zfrozenset({z}))rVrIr')rr.r7rrr�repr_frozensetbs
zRepr.repr_frozensetcCs|j||dd|j�S)Nzdeque([z]))rIr()rr.r7rrr�
repr_dequeiszRepr.repr_dequecCs�t|�}|dkrdS|dkr dS|d}|j}g}xBtt|�|j�D].}|||�}||||�}	|jd||	f�qDW||jkr�|jd�dj|�}
d|
fS)	Nrz{}z{...}r;z%s: %sz...z, z{%s})r@r-rrVr%rAr4)rr.r7rFr>r-rHr�keyrepr�valreprrGrrr�	repr_dictls 



zRepr.repr_dictcCs�tj|d|j��}t|�|jkr�td|jdd�}td|jd|�}tj|d|�|t|�|d��}|d|�d|t|�|d�}|S)Nr��z...)�builtinsrr)r@�max)rr.r7rG�i�jrrr�repr_str{s&$z
Repr.repr_strcCshtj|�}t|�|jkrdtd|jdd�}td|jd|�}|d|�d|t|�|d�}|S)Nrr]r^z...)r_rr@r*r`)rr.r7rGrarbrrr�repr_int�s
$z
Repr.repr_intcCs�ytj|�}Wn$tk
r2d|jjt|�fSXt|�|jkr�td|jdd�}td|jd|�}|d|�d|t|�|d�}|S)Nz<%s instance at %#x>rr]r^z...)	r_r�	Exception�	__class__rrr@r+r`)rr.r7rGrarbrrrr6�s$zRepr.repr_instanceN)r:)rrrr,rr-rIrMrPrSrWrXrYr\rcrdr6rrrrr's



	cCs&yt|�Stk
r t|�SXdS)N)�sortedre�list)r.rrrrV�srV)r)r�__all__r_�	itertoolsr�_threadr�ImportErrorZ
_dummy_threadrrrV�aReprrrrrr�<module>s

s	bdb.cpython-36.opt-2.pyc000064400000035715150335715140010700 0ustar003


 \\�@s�ddlZddlZddlZddlmZmZmZdddgZeeBeBZGdd�de	�Z
Gdd�d�Zdd	�ZGd
d�d�Z
dd�Zd
d�ZGdd�de�Zdd�Zdd�Zdd�ZdS)�N)�CO_GENERATOR�CO_COROUTINE�CO_ASYNC_GENERATOR�BdbQuit�Bdb�
Breakpointc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/bdb.pyr
sc@sleZdZdYdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�ZdZd%d&�Zd[d'd(�Zd)d*�Zd+d,�Zd-d.�Zd\d/d0�Zd1d2�Zd3d4�Zd]d6d7�Zd8d9�Zd:d;�Zd<d=�Zd>d?�Z d@dA�Z!dBdC�Z"dDdE�Z#dFdG�Z$dHdI�Z%dJdK�Z&dLdM�Z'd^dOdP�Z(d_dQdR�Z)d`dSdT�Z*dUdV�Z+dWdX�Z,dS)arNcCs(|rt|�nd|_i|_i|_d|_dS)N)�set�skip�breaks�fncache�frame_returning)�selfrrrr�__init__szBdb.__init__cCsR|d|dd�dkr|S|jj|�}|sNtjj|�}tjj|�}||j|<|S)N�<��>���)r�get�os�path�abspath�normcase)r�filename�canonicrrrrs
zBdb.canoniccCs&ddl}|j�d|_|jdd�dS)Nr)�	linecache�
checkcache�botframe�
_set_stopinfo)rrrrr�reset)sz	Bdb.resetcCs�|jr
dS|dkr|j|�S|dkr0|j||�S|dkrD|j||�S|dkrX|j||�S|dkrf|jS|dkrt|jS|dkr�|jStdt|��|jS)	N�lineZcall�returnZ	exceptionZc_callZc_exceptionZc_returnz*bdb.Bdb.dispatch: unknown debugging event:)�quitting�
dispatch_line�
dispatch_call�dispatch_return�dispatch_exception�trace_dispatch�print�repr)r�frameZevent�argrrrr+/s$
zBdb.trace_dispatchcCs.|j|�s|j|�r(|j|�|jr(t�|jS)N)�	stop_here�
break_here�	user_liner&rr+)rr.rrrr'Cs

zBdb.dispatch_linecCsd|jdkr|j|_|jS|j|�p*|j|�s0dS|jrH|jjt@rH|jS|j	||�|j
r^t�|jS)N)r!�f_backr+r0�break_anywhere�	stopframe�f_code�co_flags�GENERATOR_AND_COROUTINE_FLAGS�	user_callr&r)rr.r/rrrr(Is
zBdb.dispatch_callcCs||j|�s||jkrv|jr,|jjt@r,|jSz||_|j||�Wdd|_X|j	rVt
�|j|krv|jdkrv|jdd�|jS)Nrr)
r0�returnframer5r6r7r8r+r�user_returnr&r�
stoplinenor")rr.r/rrrr)YszBdb.dispatch_returncCs�|j|�rF|jjt@o,|dtko,|ddks�|j||�|jr�t�nD|jr�||jk	r�|jjjt@r�|dtt	fkr�|j||�|jr�t�|j
S)Nr�)r0r6r7r8�
StopIteration�user_exceptionr&rr5�
GeneratorExitr+)rr.r/rrrr*is
zBdb.dispatch_exceptioncCs$x|jD]}tj||�rdSqWdS)NTF)r�fnmatch)rZmodule_name�patternrrr�is_skipped_module�szBdb.is_skipped_modulecCsN|jr|j|jjd��rdS||jkr@|jdkr4dS|j|jkS|jsJdSdS)NrFrTr)rrC�	f_globalsrr5r<�f_lineno)rr.rrrr0�s

z
Bdb.stop_herecCs�|j|jj�}||jkrdS|j}||j|krJ|jj}||j|krJdSt|||�\}}|r�|j|_|r�|j	r�|j
t|j��dSdSdS)NFT)rr6�co_filenamerrE�co_firstlineno�	effective�numberZ	currentbp�	temporary�do_clear�str)rr.r�lineno�bp�flagrrrr1�s

zBdb.break_herecCstd��dS)Nz)subclass of bdb must implement do_clear())�NotImplementedError)rr/rrrrK�szBdb.do_clearcCs|j|jj�|jkS)N)rr6rFr)rr.rrrr4�szBdb.break_anywherecCsdS)Nr)rr.Z
argument_listrrrr9�sz
Bdb.user_callcCsdS)Nr)rr.rrrr2�sz
Bdb.user_linecCsdS)Nr)rr.Zreturn_valuerrrr;�szBdb.user_returncCsdS)Nr)rr.�exc_inforrrr?�szBdb.user_exceptionrcCs||_||_d|_||_dS)NF)r5r:r&r<)rr5r:r<rrrr"�szBdb._set_stopinfocCs$|dkr|jd}|j|||�dS)Nr)rEr")rr.rMrrr�	set_until�s
z
Bdb.set_untilcCs2|jr"|jj}|r"|jr"|j|_|jdd�dS)N)rr3�f_tracer+r")rZcaller_framerrr�set_step�s
zBdb.set_stepcCs|j|d�dS)N)r")rr.rrr�set_next�szBdb.set_nextcCs.|jjt@r|j|dd�n|j|j|�dS)Nrr)r6r7r8r"r3)rr.rrr�
set_return�szBdb.set_returncCsP|dkrtj�j}|j�x|r6|j|_||_|j}qW|j�tj|j�dS)N)	�sys�	_getframer3r#r+rSr!rT�settrace)rr.rrr�	set_trace�s

z
Bdb.set_tracecCsL|j|jdd�|jsHtjd�tj�j}x|rF||jk	rF|`|j}q,WdS)Nrr)r"r!rrWrYrXr3rS)rr.rrr�set_continues

zBdb.set_continuecCs"|j|_d|_d|_tjd�dS)NT)r!r5r:r&rWrY)rrrr�set_quitszBdb.set_quitFc
Csb|j|�}ddl}|j||�}|s.d||fS|jj|g�}||krN|j|�t|||||�}	dS)NrzLine %s:%d does not exist)rr�getliner�
setdefault�appendr)
rrrMrJ�cond�funcnamerr$�listrNrrr�	set_breaks

z
Bdb.set_breakcCs4||ftjkr|j|j|�|j|s0|j|=dS)N)r�bplistr�remove)rrrMrrr�
_prune_breaks$s
zBdb._prune_breakscCsn|j|�}||jkrd|S||j|kr6d||fSx&tj||fdd�D]}|j�qNW|j||�dS)NzThere are no breakpoints in %szThere is no breakpoint at %s:%d)rrrrd�deleteMerf)rrrMrNrrr�clear_break*s

zBdb.clear_breakcCsPy|j|�}Wn$tk
r2}zt|�Sd}~XnX|j�|j|j|j�dS)N)�get_bpbynumber�
ValueErrorrLrgrf�filer$)rr/rN�errrrr�clear_bpbynumber6szBdb.clear_bpbynumbercCs`|j|�}||jkrd|Sx6|j|D](}tj||f}x|D]}|j�q@Wq(W|j|=dS)NzThere are no breakpoints in %s)rrrrdrg)rrr$ZblistrNrrr�clear_all_file_breaks>s


zBdb.clear_all_file_breakscCs0|js
dSxtjD]}|r|j�qWi|_dS)NzThere are no breakpoints)rr�
bpbynumberrg)rrNrrr�clear_all_breaksHszBdb.clear_all_breakscCs�|std��yt|�}Wn tk
r8td|��YnXytj|}Wn tk
rhtd|��YnX|dkr~td|��|S)NzBreakpoint number expectedz Non-numeric breakpoint number %sz!Breakpoint number %d out of rangezBreakpoint %d already deleted)rj�intrro�
IndexError)rr/rIrNrrrriPszBdb.get_bpbynumbercCs"|j|�}||jko ||j|kS)N)rr)rrrMrrr�	get_break_s

z
Bdb.get_breakcCs4|j|�}||jkr0||j|kr0tj||fp2gS)N)rrrrd)rrrMrrr�
get_breaksds

zBdb.get_breakscCs&|j|�}||jkr|j|SgSdS)N)rr)rrrrr�get_file_breaksjs


zBdb.get_file_breakscCs|jS)N)r)rrrr�get_all_breaksqszBdb.get_all_breakscCs�g}|r|j|kr|j}x.|dk	rF|j||jf�||jkr>P|j}qW|j�tdt|�d�}x$|dk	r�|j|j|j	f�|j}qdW|dkr�tdt|�d�}||fS)Nrr)
�tb_frame�tb_nextr_rEr!r3�reverse�max�len�	tb_lineno)r�f�t�stack�irrr�	get_stackws 




z
Bdb.get_stack�: cCs�ddl}ddl}|\}}|j|jj�}d||f}|jjrH||jj7}n|d7}d|jkrf|jd}	nd}	|	r~||j|	�7}n|d7}d|jkr�|jd}
|d7}||j|
�7}|j|||j	�}|r�|||j
�7}|S)Nrz%s(%r)z<lambda>Z__args__z()Z
__return__z->)r�reprlibrr6rF�co_name�f_localsr-r]rD�strip)rZframe_linenoZlprefixrr�r.rMr�s�args�rvr$rrr�format_stack_entry�s*


zBdb.format_stack_entrycCs�|dkrddl}|j}|dkr"|}|j�t|t�r@t|dd�}tj|j�z*yt	|||�Wnt
k
rrYnXWdd|_tjd�XdS)Nrz<string>�execT)�__main__�__dict__r#�
isinstancerL�compilerWrYr+r�rr&)r�cmd�globals�localsr�rrr�run�s

zBdb.runcCst|dkrddl}|j}|dkr"|}|j�tj|j�z&yt|||�Stk
rXYnXWdd|_tjd�XdS)NrT)	r�r�r#rWrYr+�evalrr&)r�exprr�r�r�rrr�runeval�s
zBdb.runevalcCs|j|||�dS)N)r�)rr�r�r�rrr�runctx�sz
Bdb.runctxcOsX|j�tj|j�d}z(y|||�}Wntk
r<YnXWdd|_tjd�X|S)NT)r#rWrYr+rr&)r�funcr��kwds�resrrr�runcall�s
zBdb.runcall)N)r)N)N)FNN)r�)NN)NN)-rr	r
rrr#r+r'r(r)r*rCr0r1rKr4r9r2r;r?r"rRrTrUrVrZr[r\rcrfrhrmrnrprirsrtrurvr�r�r�r�r�r�rrrrrsV










cCst�j�dS)N)rrZrrrrrZ�srZc@sVeZdZdZiZdgZddd�Zdd�Zdd	�Zd
d�Z	ddd
�Z
dd�Zdd�ZdS)rrNFcCs�||_d|_||_||_||_||_d|_d|_d|_t	j
|_t	j
d7_
|jj
|�||f|jkr||j||fj
|�n|g|j||f<dS)NTrr)ra�func_first_executable_linerkr$rJr`�enabled�ignore�hitsr�nextrIror_rd)rrkr$rJr`rarrrr�szBreakpoint.__init__cCs>|j|jf}d|j|j<|j|j|�|j|s:|j|=dS)N)rkr$rorIrdre)r�indexrrrrgs

zBreakpoint.deleteMecCs
d|_dS)NT)r�)rrrr�enableszBreakpoint.enablecCs
d|_dS)NF)r�)rrrr�disableszBreakpoint.disablecCs"|dkrtj}t|j�|d�dS)N)rk)rW�stdoutr,�bpformat)r�outrrr�bpprintszBreakpoint.bpprintcCs�|jrd}nd}|jr |d}n|d}d|j||j|jf}|jrT|d|jf7}|jrj|d|jf7}|jr�|jdkr�d	}nd
}|d|j|f7}|S)Nzdel  zkeep zyes  zno   z%-4dbreakpoint   %s at %s:%dz
	stop only if %sz
	ignore next %d hitsrr��z"
	breakpoint already hit %d time%s)rJr�rIrkr$r`r�r�)rZdispZretZssrrrr�s$

zBreakpoint.bpformatcCsd|j|j|jfS)Nzbreakpoint %s at %s:%s)rIrkr$)rrrr�__str__6szBreakpoint.__str__)FNN)N)
rr	r
r�rdrorrgr�r�r�r�r�rrrrr�s

cCsN|js|j|jkrdSdS|jj|jkr,dS|js:|j|_|j|jkrJdSdS)NFT)rar$rEr6r�r�)�br.rrr�
checkfuncname;sr�cCs�tj||f}x�|D]�}|js qt||�s,q|jd7_|jsf|jdkr\|jd8_qq�|dfSqy<t|j|j|j	�}|r�|jdkr�|jd8_n|dfSWq|dfSqWdS)NrrTF)NN)
rrdr�r�r�r`r�r�rDr�)rkr$r.Z	possiblesr��valrrrrHWs*




rHc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TdbcCs |jj}|sd}td||�dS)Nz???z+++ call)r6r�r,)rr.r��namerrrr9�sz
Tdb.user_callcCsTddl}|jj}|sd}|j|jj�}|j||j|j�}td||j|d|j	��dS)Nrz???z+++�:)
rr6r�rrFr]rErDr,r�)rr.rr��fnr$rrrr2�sz
Tdb.user_linecCstd|�dS)Nz
+++ return)r,)rr.Zretvalrrrr;�szTdb.user_returncCstd|�|j�dS)Nz
+++ exception)r,r[)rr.Z	exc_stuffrrrr?�s
zTdb.user_exceptionN)rr	r
r9r2r;r?rrrrr��sr�cCs&td|d�t|d�}td|�dS)Nzfoo(�)�
zbar returned)r,�bar)�n�xrrr�foo�sr�cCstd|d�|dS)Nzbar(r�r=)r,)�arrrr��sr�cCst�}|jd�dS)Nzimport bdb; bdb.foo(10))r�r�)r~rrr�test�sr�)rArWr�inspectrrr�__all__r8�	ExceptionrrrZrr�rHr�r�r�r�rrrr�<module>s$
OZ0codecs.cpython-36.opt-2.pyc000064400000043206150335715140011403 0ustar003


 \���:@s�ddlZddlZyddlTWn.ek
rJZzede��WYddZ[XnXdddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/g,Zd0Zd1ZZ	d2Z
Zd3Zd4Z
ejd5kr�e	ZZeZneZZe
Ze	ZeZeZe
ZGd6d�de�ZGd7d�d�ZGd8d�de�ZGd9d:�d:e�ZGd;d�de�ZGd<d=�d=e�ZGd>d�de�ZGd?d�de�ZGd@d�d�Z GdAd�d�Z!d[dEd�Z"d\dFd�Z#dGd�Z$dHd�Z%dId �Z&dJd!�Z'dKd"�Z(dLd#�Z)d]dMd&�Z*d^dNd'�Z+dOdP�Z,dQdR�Z-y4e.dC�Z/e.dS�Z0e.dT�Z1e.dU�Z2e.dV�Z3e.dW�Z4Wn.e5k
�r\dZ/dZ0dZ1dZ2dZ3dZ4YnXdZ6e6�rpddl7Z7e8dXk�r�e#ej9dYdZ�e_9e#ej:dZdY�e_:dS)_�N)�*z%Failed to load the builtin codecs: %s�register�lookup�open�EncodedFile�BOM�BOM_BE�BOM_LE�BOM32_BE�BOM32_LE�BOM64_BE�BOM64_LE�BOM_UTF8�	BOM_UTF16�BOM_UTF16_LE�BOM_UTF16_BE�	BOM_UTF32�BOM_UTF32_LE�BOM_UTF32_BE�	CodecInfo�Codec�IncrementalEncoder�IncrementalDecoder�StreamReader�StreamWriter�StreamReaderWriter�
StreamRecoder�
getencoder�
getdecoder�getincrementalencoder�getincrementaldecoder�	getreader�	getwriter�encode�decode�
iterencode�
iterdecode�
strict_errors�
ignore_errors�replace_errors�xmlcharrefreplace_errors�backslashreplace_errors�namereplace_errors�register_error�lookup_errorss��s��s��s���littlec@s(eZdZdZddd�dd�Zdd�ZdS)	rTN)�_is_text_encodingc
CsPtj|||||f�}	||	_||	_||	_||	_||	_||	_||	_|dk	rL||	_	|	S)N)
�tuple�__new__�namer#r$�incrementalencoder�incrementaldecoder�streamwriter�streamreaderr0)
�clsr#r$r7r6r4r5r3r0�self�r:�/usr/lib64/python3.6/codecs.pyr2]szCodecInfo.__new__cCsd|jj|jj|jt|�fS)Nz%<%s.%s object for encoding %s at %#x>)�	__class__�
__module__�__qualname__r3�id)r9r:r:r;�__repr__lszCodecInfo.__repr__)NNNNN)�__name__r=r>r0r2r@r:r:r:r;rRs
	
c@s eZdZddd�Zddd�ZdS)	r�strictcCst�dS)N)�NotImplementedError)r9�input�errorsr:r:r;r#�szCodec.encodecCst�dS)N)rC)r9rDrEr:r:r;r$�szCodec.decodeN)rB)rB)rAr=r>r#r$r:r:r:r;rqs
c@s8eZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
S)rrBcCs||_d|_dS)N�)rE�buffer)r9rEr:r:r;�__init__�szIncrementalEncoder.__init__FcCst�dS)N)rC)r9rD�finalr:r:r;r#�szIncrementalEncoder.encodecCsdS)Nr:)r9r:r:r;�reset�szIncrementalEncoder.resetcCsdS)Nrr:)r9r:r:r;�getstate�szIncrementalEncoder.getstatecCsdS)Nr:)r9�stater:r:r;�setstate�szIncrementalEncoder.setstateN)rB)F)rAr=r>rHr#rJrKrMr:r:r:r;r�s


c@s@eZdZddd�Zdd�Zddd�Zd	d
�Zdd�Zd
d�ZdS)�BufferedIncrementalEncoderrBcCstj||�d|_dS)NrF)rrHrG)r9rEr:r:r;rH�sz#BufferedIncrementalEncoder.__init__cCst�dS)N)rC)r9rDrErIr:r:r;�_buffer_encode�sz)BufferedIncrementalEncoder._buffer_encodeFcCs0|j|}|j||j|�\}}||d�|_|S)N)rGrOrE)r9rDrI�data�result�consumedr:r:r;r#�s
z!BufferedIncrementalEncoder.encodecCstj|�d|_dS)NrF)rrJrG)r9r:r:r;rJ�s
z BufferedIncrementalEncoder.resetcCs
|jpdS)Nr)rG)r9r:r:r;rK�sz#BufferedIncrementalEncoder.getstatecCs|pd|_dS)NrF)rG)r9rLr:r:r;rM�sz#BufferedIncrementalEncoder.setstateN)rB)F)	rAr=r>rHrOr#rJrKrMr:r:r:r;rN�s

rNc@s8eZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
S)rrBcCs
||_dS)N)rE)r9rEr:r:r;rHszIncrementalDecoder.__init__FcCst�dS)N)rC)r9rDrIr:r:r;r$
szIncrementalDecoder.decodecCsdS)Nr:)r9r:r:r;rJszIncrementalDecoder.resetcCsdS)N�r)rSrr:)r9r:r:r;rKszIncrementalDecoder.getstatecCsdS)Nr:)r9rLr:r:r;rM&szIncrementalDecoder.setstateN)rB)F)rAr=r>rHr$rJrKrMr:r:r:r;r�s



c@s@eZdZddd�Zdd�Zddd�Zd	d
�Zdd�Zd
d�ZdS)�BufferedIncrementalDecoderrBcCstj||�d|_dS)NrS)rrHrG)r9rEr:r:r;rH4sz#BufferedIncrementalDecoder.__init__cCst�dS)N)rC)r9rDrErIr:r:r;�_buffer_decode9sz)BufferedIncrementalDecoder._buffer_decodeFcCs0|j|}|j||j|�\}}||d�|_|S)N)rGrUrE)r9rDrIrPrQrRr:r:r;r$>s
z!BufferedIncrementalDecoder.decodecCstj|�d|_dS)NrS)rrJrG)r9r:r:r;rJFs
z BufferedIncrementalDecoder.resetcCs
|jdfS)Nr)rG)r9r:r:r;rKJsz#BufferedIncrementalDecoder.getstatecCs|d|_dS)Nr)rG)r9rLr:r:r;rMNsz#BufferedIncrementalDecoder.setstateN)rB)F)	rAr=r>rHrUr$rJrKrMr:r:r:r;rT.s

rTc@sTeZdZddd�Zdd�Zdd�Zdd	�Zddd�Zefd
d�Z	dd�Z
dd�ZdS)rrBcCs||_||_dS)N)�streamrE)r9rVrEr:r:r;rH[szStreamWriter.__init__cCs"|j||j�\}}|jj|�dS)N)r#rErV�write)r9�objectrPrRr:r:r;rWtszStreamWriter.writecCs|jdj|��dS)NrF)rW�join)r9�listr:r:r;�
writelines{szStreamWriter.writelinescCsdS)Nr:)r9r:r:r;rJ�s
zStreamWriter.resetrcCs*|jj||�|dkr&|dkr&|j�dS)Nr)rV�seekrJ)r9�offset�whencer:r:r;r\�szStreamWriter.seekcCs||j|�S)N)rV)r9r3�getattrr:r:r;�__getattr__�szStreamWriter.__getattr__cCs|S)Nr:)r9r:r:r;�	__enter__�szStreamWriter.__enter__cCs|jj�dS)N)rV�close)r9�type�value�tbr:r:r;�__exit__�szStreamWriter.__exit__N)rB)r)rAr=r>rHrWr[rJr\r_r`rarfr:r:r:r;rYs

c@s�eZdZeZddd�Zd dd�Zd#dd	�Zd$dd
�Zd%dd�Z	dd�Z
d&dd�Zdd�Zdd�Z
efdd�Zdd�Zdd�Zd
S)'rrBcCs.||_||_d|_|j�|_|j|_d|_dS)NrS)rVrE�
bytebuffer�charbuffertype�_empty_charbuffer�
charbuffer�
linebuffer)r9rVrEr:r:r;rH�s
zStreamReader.__init__cCst�dS)N)rC)r9rDrEr:r:r;r$�szStreamReader.decode�FcCsL|jr|jj|j�|_d|_|dkr(|}x�|dkrBt|j�|krBP|dkrV|jj�}n|jj|�}|j|}|srPy|j||j	�\}}Wn`t
k
r�}zD|r�|j|d|j�|j	�\}}|jdd�}	t|	�dkr؂n�WYdd}~XnX||d�|_|j|7_|s*Pq*W|dk�r*|j}
|j|_n|jd|�}
|j|d�|_|
S)NrT)�keependsrl)
rkrirYrj�lenrV�readrgr$rE�UnicodeDecodeError�start�
splitlines)r9�size�chars�	firstline�newdatarP�newchars�decodedbytes�exc�linesrQr:r:r;ro�sD


zStreamReader.readNTc	Cs�|jrP|jd}|jd=t|j�dkr8|jd|_d|_|sL|jdd�d}|S|pVd}|j}�xr|j|dd�}|r�t|t�r�|jd�s�t|t	�r�|jd	�r�||jddd
�7}||7}|jdd�}|�r�t|�dk�r:|d}|d=t|�dk�r|d
|j7<||_d|_n|d|j|_|�s8|jdd�d}P|d}|djdd�d}||k�r�|jj
|dd��|j|_|�r�|}n|}P|�s�|dk	�r�|�r�|�r�|jdd�d}P|dkrb|d9}qbW|S)NrrlF)rm�HT)ru�
�
)rsrti@����)rkrnrjrrriro�
isinstance�str�endswith�bytesrY)	r9rsrm�line�readsizerPrz�line0withend�line0withoutendr:r:r;�readlines^


zStreamReader.readlinecCs|j�}|j|�S)N)rorr)r9�sizehintrmrPr:r:r;�	readlines]szStreamReader.readlinescCsd|_|j|_d|_dS)NrS)rgrirjrk)r9r:r:r;rJls	zStreamReader.resetrcCs|jj||�|j�dS)N)rVr\rJ)r9r]r^r:r:r;r\yszStreamReader.seekcCs|j�}|r|St�dS)N)r��
StopIteration)r9r�r:r:r;�__next__�szStreamReader.__next__cCs|S)Nr:)r9r:r:r;�__iter__�szStreamReader.__iter__cCs||j|�S)N)rV)r9r3r_r:r:r;r`�szStreamReader.__getattr__cCs|S)Nr:)r9r:r:r;ra�szStreamReader.__enter__cCs|jj�dS)N)rVrb)r9rcrdrer:r:r;rf�szStreamReader.__exit__)rB)rBrr)rrF)NT)NT)r)rAr=r>r�rhrHr$ror�r�rJr\r�r�r_r`rarfr:r:r:r;r�s


P
K

c@s�eZdZdZd dd�Zd"dd�Zd#d	d
�Zd$dd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zd%dd�Z
efdd�Zdd�Zdd�ZdS)&r�unknownrBcCs(||_|||�|_|||�|_||_dS)N)rV�reader�writerrE)r9rV�Reader�WriterrEr:r:r;rH�s
zStreamReaderWriter.__init__rlcCs|jj|�S)N)r�ro)r9rsr:r:r;ro�szStreamReaderWriter.readNcCs|jj|�S)N)r�r�)r9rsr:r:r;r��szStreamReaderWriter.readlinecCs|jj|�S)N)r�r�)r9r�r:r:r;r��szStreamReaderWriter.readlinescCs
t|j�S)N)�nextr�)r9r:r:r;r��szStreamReaderWriter.__next__cCs|S)Nr:)r9r:r:r;r��szStreamReaderWriter.__iter__cCs|jj|�S)N)r�rW)r9rPr:r:r;rW�szStreamReaderWriter.writecCs|jj|�S)N)r�r[)r9rZr:r:r;r[�szStreamReaderWriter.writelinescCs|jj�|jj�dS)N)r�rJr�)r9r:r:r;rJ�s
zStreamReaderWriter.resetrcCs6|jj||�|jj�|dkr2|dkr2|jj�dS)Nr)rVr\r�rJr�)r9r]r^r:r:r;r\�s
zStreamReaderWriter.seekcCs||j|�S)N)rV)r9r3r_r:r:r;r`�szStreamReaderWriter.__getattr__cCs|S)Nr:)r9r:r:r;ra�szStreamReaderWriter.__enter__cCs|jj�dS)N)rVrb)r9rcrdrer:r:r;rf�szStreamReaderWriter.__exit__)rBr)r)N)N)r)rAr=r>�encodingrHror�r�r�r�rWr[rJr\r_r`rarfr:r:r:r;r�s




c@s�eZdZdZdZddd�Zddd�Zd d	d
�Zd!dd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
efdd�Zdd�Zdd�ZdS)"rr�rBcCs4||_||_||_|||�|_|||�|_||_dS)N)rVr#r$r�r�rE)r9rVr#r$r�r�rEr:r:r;rHszStreamRecoder.__init__rlcCs"|jj|�}|j||j�\}}|S)N)r�ror#rE)r9rsrP�bytesencodedr:r:r;ro"szStreamRecoder.readNcCs6|dkr|jj�}n|jj|�}|j||j�\}}|S)N)r�r�r#rE)r9rsrPr�r:r:r;r�(s
zStreamRecoder.readlinecCs(|jj�}|j||j�\}}|jdd�S)NT)rm)r�ror#rErr)r9r�rPr�r:r:r;r�1s
zStreamRecoder.readlinescCs t|j�}|j||j�\}}|S)N)r�r�r#rE)r9rPr�r:r:r;r�7s
zStreamRecoder.__next__cCs|S)Nr:)r9r:r:r;r�>szStreamRecoder.__iter__cCs|j||j�\}}|jj|�S)N)r$rEr�rW)r9rP�bytesdecodedr:r:r;rWAszStreamRecoder.writecCs(dj|�}|j||j�\}}|jj|�S)NrF)rYr$rEr�rW)r9rZrPr�r:r:r;r[Fs
zStreamRecoder.writelinescCs|jj�|jj�dS)N)r�rJr�)r9r:r:r;rJLs
zStreamRecoder.resetcCs||j|�S)N)rV)r9r3r_r:r:r;r`QszStreamRecoder.__getattr__cCs|S)Nr:)r9r:r:r;raXszStreamRecoder.__enter__cCs|jj�dS)N)rVrb)r9rcrdrer:r:r;rf[szStreamRecoder.__exit__)rBr)r)N)N)rAr=r>�
data_encoding�
file_encodingrHror�r�r�r�rWr[rJr_r`rarfr:r:r:r;r�s


	
�rrBrlcCsV|dk	rd|kr|d}tj|||�}|dkr2|St|�}t||j|j|�}||_|S)N�b)�builtinsrrrr7r6r�)�filename�moder�rE�	buffering�file�info�srwr:r:r;r`scCsF|dkr|}t|�}t|�}t||j|j|j|j|�}||_||_|S)N)rrr#r$r7r6r�r�)r�r�r�rE�	data_info�	file_info�srr:r:r;r�scCs
t|�jS)N)rr#)r�r:r:r;r�scCs
t|�jS)N)rr$)r�r:r:r;r�scCst|�j}|dkrt|��|S)N)rr4�LookupError)r��encoderr:r:r;r�s	
cCst|�j}|dkrt|��|S)N)rr5r�)r��decoderr:r:r;r �s	
cCs
t|�jS)N)rr7)r�r:r:r;r!�scCs
t|�jS)N)rr6)r�r:r:r;r"�scksLt|�|f|�}x |D]}|j|�}|r|VqW|jdd�}|rH|VdS)NrFT)rr#)�iteratorr�rE�kwargsr�rD�outputr:r:r;r%�s	


cksLt|�|f|�}x |D]}|j|�}|r|VqW|jdd�}|rH|VdS)NrST)r r$)r�r�rEr�r�rDr�r:r:r;r&s	


cCsdd�|D�S)NcSsi|]
}||�qSr:r:)�.0�ir:r:r;�
<dictcomp>"sz&make_identity_dict.<locals>.<dictcomp>r:)�rngr:r:r;�make_identity_dictsr�cCs8i}x.|j�D]"\}}||kr(|||<qd||<qW|S)N)�items)�decoding_map�m�k�vr:r:r;�make_encoding_map$s

r��ignore�replace�xmlcharrefreplace�backslashreplace�namereplace�__main__zlatin-1zutf-8)r�NrBrl)NrB)rB)rB);r��sys�_codecs�ImportErrorZwhy�SystemError�__all__rr	rrrrr�	byteorderrrrrr
r
rr1rrrXrrNrrTrrrrrrrrrr r!r"r%r&r�r�r.r'r(r)r*r+r,r��_falseZ	encodingsrA�stdout�stdinr:r:r:r;�<module>
s�

B("1+IzWn
*
&








string.cpython-36.opt-2.pyc000064400000015314150335715140011450 0ustar003


 \.�@s�dddddddddd	d
dgZdd
lZdZdZdZeeZdZeddZdZdZ	eee	eZ
ddd�Zdd
lZ
ddlmZGdd�de�ZGdd�ded�ZGdd
�d
�Zd
S)�
ascii_letters�ascii_lowercase�ascii_uppercase�capwords�digits�	hexdigits�	octdigits�	printable�punctuation�
whitespace�	Formatter�Template�Nz 	

ZabcdefghijklmnopqrstuvwxyzZABCDEFGHIJKLMNOPQRSTUVWXYZ�
0123456789ZabcdefZABCDEFZ01234567z !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~cCs|pdjdd�|j|�D��S)N� css|]}|j�VqdS)N)�
capitalize)�.0�x�r�/usr/lib64/python3.6/string.py�	<genexpr>0szcapwords.<locals>.<genexpr>)�join�split)�s�seprrrr%s)�ChainMapcs eZdZdZ�fdd�Z�ZS)�_TemplateMetaclassa/
    %(delim)s(?:
      (?P<escaped>%(delim)s) |   # Escape sequence of two delimiters
      (?P<named>%(id)s)      |   # delimiter and a Python identifier
      {(?P<braced>%(id)s)}   |   # delimiter and a braced identifier
      (?P<invalid>)              # Other ill-formed delimiter exprs
    )
    csXtt|�j|||�d|kr$|j}ntjtj|j�|jd�}tj||j	tj
B�|_dS)N�pattern)Zdelim�id)�superr�__init__r�_re�escape�	delimiter�	idpattern�compile�flags�VERBOSE)�cls�name�basesZdctr)�	__class__rrrAs
z_TemplateMetaclass.__init__)�__name__�
__module__�__qualname__rr�
__classcell__rr)r*rr7src@s:eZdZdZdZejZdd�Zdd�Z	dd�Z
d	d
�ZdS)r�$z(?-i:[_a-zA-Z][_a-zA-Z0-9]*)cCs
||_dS)N)�template)�selfr0rrrrXszTemplate.__init__cCsd|jd�}|jd|�jdd�}|s.d}d}n"|tdj|dd���}t|�}td||f��dS)N�invalidT)�keepends��z.Invalid placeholder in string: line %d, col %d���)�startr0�
splitlines�lenr�
ValueError)r1�mo�i�lines�colno�linenorrr�_invalid]s
zTemplate._invalidcsl|std��|^�}t|�dkr(td��|s2|�n|rFt||d��n|d���fdd�}�jj|�j�S)Nz>descriptor 'substitute' of 'Template' object needs an argumentr4zToo many positional argumentsr
csd|jd�p|jd�}|dk	r(t�|�S|jd�dk	r<�jS|jd�dk	rT�j|�td�j��dS)N�named�braced�escapedr2z#Unrecognized named group in pattern)�group�strr"r@r:r)r;rA)�mappingr1rr�convertws
z$Template.substitute.<locals>.convert)�	TypeErrorr9�	_ChainMapr�subr0)�args�kwsrGr)rFr1r�
substituteiszTemplate.substitutecsl|std��|^�}t|�dkr(td��|s2|�n|rFt||d��n|d���fdd�}�jj|�j�S)NzCdescriptor 'safe_substitute' of 'Template' object needs an argumentr4zToo many positional argumentsr
cs||jd�p|jd�}|dk	rByt�|�Stk
r@|j�SX|jd�dk	rV�jS|jd�dk	rl|j�Std�j��dS)NrArBrCr2z#Unrecognized named group in pattern)rDrE�KeyErrorr"r:r)r;rA)rFr1rrrG�s
z)Template.safe_substitute.<locals>.convert)rHr9rIrrJr0)rKrLrGr)rFr1r�safe_substitute�s
zTemplate.safe_substituteN)r+r,r-r"r#r �
IGNORECASEr%rr@rMrOrrrrrMs)�	metaclassc@sVeZdZdd�Zdd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)rcOsz|std��|^}}y|^}}WnJtk
rjd|kr\|jd�}ddl}|jdtdd�n
td�d�YnX|j|||�S)Nz;descriptor 'format' of 'Formatter' object needs an argument�
format_stringr
z9Passing 'format_string' as keyword argument is deprecated�)�
stacklevelz@format() missing 1 required positional argument: 'format_string')rHr:�pop�warnings�warn�DeprecationWarning�vformat)rK�kwargsr1rRrVrrr�format�s

zFormatter.formatcCs.t�}|j||||d�\}}|j|||�|S)NrS)�set�_vformat�check_unused_args)r1rRrKrZ�	used_args�result�_rrrrY�szFormatter.vformatr
c	Cs�|dkrtd��g}x�|j|�D]�\}}	}
}|r:|j|�|	dk	r |	dkrl|dkrZtd��t|�}	|d7}n|	j�r�|r�td��d}|j|	||�\}}
|j|
�|j||�}|j|
||||d|d�\}
}|j|j	||
��q Wdj
|�|fS)Nr
zMax string recursion exceededr5FzJcannot switch from manual field specification to automatic field numberingr4)�auto_arg_index)r:�parse�appendrE�isdigit�	get_field�add�
convert_fieldr]�format_fieldr)r1rRrKrZr_Zrecursion_depthrbr`Zliteral_text�
field_name�format_spec�
conversion�objZarg_usedrrrr]�s4


zFormatter._vformatcCst|t�r||S||SdS)N)�
isinstance�int)r1�keyrKrZrrr�	get_value�s
zFormatter.get_valuecCsdS)Nr)r1r_rKrZrrrr^szFormatter.check_unused_argscCs
t||�S)N)r[)r1�valuerkrrrriszFormatter.format_fieldcCsN|dkr|S|dkrt|�S|dkr,t|�S|dkr<t|�Stdj|���dS)Nr�r�az"Unknown conversion specifier {0!s})rE�repr�asciir:r[)r1rrrlrrrrhszFormatter.convert_fieldcCs
tj|�S)N)�_stringZformatter_parser)r1rRrrrrcszFormatter.parsec	CsNtj|�\}}|j|||�}x(|D] \}}|r:t||�}q"||}q"W||fS)N)rwZformatter_field_name_splitrq�getattr)	r1rjrKrZ�first�restrmZis_attrr<rrrrf(szFormatter.get_fieldN)r
)r+r,r-r[rYr]rqr^rirhrcrfrrrrr�s
5	)N)�__all__rwr
rrrrrrr	rr�rer �collectionsrrI�typerrrrrrr�<module>s$


`opcode.cpython-36.opt-2.pyc000064400000012233150335715140011410 0ustar003


 \��@s�dddddddddd	d
ddg
Zyd
dlmZejd�Wnek
rLYnX�dZgZgZgZgZ	gZ
gZgZgZ
iZdd�ed�D�Zdd �Zd!d"�Zd#d$�Zd%d&�Zed'd(�ed)d*�ed+d,�ed-d.�ed/d0�ed1d2�ed3d4�ed5d6�ed7d8�ed9d:�ed;d<�ed=d>�ed?d@�edAdB�edCdD�edEdF�edGdH�edIdJ�edKdL�edMdN�edOdP�edQdR�edSdT�edUdV�edWdX�edYdZ�ed[d\�ed]d^�ed_d`�edadb�edcdd�ededf�edgdh�edidj�edkdl�edmdn�edodp�edqdr�edsdt�edudv�edwdx�edydz�ed{d|�ed}d~�edd��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��d�Zed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ejd��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ejd��ed�d��ed�d��ed�dƒed�dăed�dƃed�dȃed�dʃed�d̃ed�d΃ed�dЃed�d҃ed�dԃed�dփed�d؃e
jd؃ed�dڃe
jdڃed�d܃e
jd܃ed�dރed�d�ed�d�ed�d�ed�d�ed�d�ejd�ed�d�ejd�ed�d�ejd�ed�d�ejd�ed�d�ed�d�ed�d�ed�d��ed�d��ed�d��ed�d��ejd��edd��d�Zed�d��e�d�d�e�d�d�e�d�d�e�d�d�e�d�d	�e�d
�d�e�d�d
�e�d�d�e�d�d�[[[[�dS(�cmp_op�hasconst�hasname�hasjrel�hasjabs�haslocal�
hascompare�hasfree�opname�opmap�
HAVE_ARGUMENT�EXTENDED_ARG�hasnargs�)�stack_effectr�<�<=�==�!=�>�>=�in�not in�is�is not�exception match�BADcCsg|]}d|f�qS)z<%r>�)�.0�oprr�/usr/lib64/python3.6/opcode.py�
<listcomp>%sr �cCs|t|<|t|<dS)N)r	r
)�namerrrr�def_op'sr#cCst||�tj|�dS)N)r#r�append)r"rrrr�name_op+s
r%cCst||�tj|�dS)N)r#rr$)r"rrrr�jrel_op/s
r&cCst||�tj|�dS)N)r#rr$)r"rrrr�jabs_op3s
r'ZPOP_TOP�ZROT_TWO�Z	ROT_THREE�ZDUP_TOP�ZDUP_TOP_TWO�ZNOP�	ZUNARY_POSITIVE�
ZUNARY_NEGATIVE�Z	UNARY_NOT�ZUNARY_INVERT�ZBINARY_MATRIX_MULTIPLY�ZINPLACE_MATRIX_MULTIPLY�ZBINARY_POWER�ZBINARY_MULTIPLY�Z
BINARY_MODULO�Z
BINARY_ADD�ZBINARY_SUBTRACT�Z
BINARY_SUBSCR�ZBINARY_FLOOR_DIVIDE�ZBINARY_TRUE_DIVIDE�ZINPLACE_FLOOR_DIVIDE�ZINPLACE_TRUE_DIVIDE�Z	GET_AITER�2Z	GET_ANEXT�3ZBEFORE_ASYNC_WITH�4ZINPLACE_ADD�7ZINPLACE_SUBTRACT�8ZINPLACE_MULTIPLY�9ZINPLACE_MODULO�;ZSTORE_SUBSCR�<Z
DELETE_SUBSCR�=Z
BINARY_LSHIFT�>Z
BINARY_RSHIFT�?Z
BINARY_AND�@Z
BINARY_XOR�AZ	BINARY_OR�BZ
INPLACE_POWER�CZGET_ITER�DZGET_YIELD_FROM_ITER�EZ
PRINT_EXPR�FZLOAD_BUILD_CLASS�GZ
YIELD_FROM�HZ
GET_AWAITABLE�IZINPLACE_LSHIFT�KZINPLACE_RSHIFT�LZINPLACE_AND�MZINPLACE_XOR�NZ
INPLACE_OR�OZ
BREAK_LOOP�PZWITH_CLEANUP_START�QZWITH_CLEANUP_FINISH�RZRETURN_VALUE�SZIMPORT_STAR�TZSETUP_ANNOTATIONS�UZYIELD_VALUE�VZ	POP_BLOCK�WZEND_FINALLY�XZ
POP_EXCEPT�Y�ZZ
STORE_NAMEZDELETE_NAME�[ZUNPACK_SEQUENCE�\ZFOR_ITER�]Z	UNPACK_EX�^Z
STORE_ATTR�_ZDELETE_ATTR�`ZSTORE_GLOBAL�aZ
DELETE_GLOBAL�bZ
LOAD_CONST�dZ	LOAD_NAME�eZBUILD_TUPLE�fZ
BUILD_LIST�gZ	BUILD_SET�hZ	BUILD_MAP�iZ	LOAD_ATTR�jZ
COMPARE_OP�kZIMPORT_NAME�lZIMPORT_FROM�mZJUMP_FORWARD�nZJUMP_IF_FALSE_OR_POP�oZJUMP_IF_TRUE_OR_POP�pZ
JUMP_ABSOLUTE�qZPOP_JUMP_IF_FALSE�rZPOP_JUMP_IF_TRUE�sZLOAD_GLOBAL�tZ
CONTINUE_LOOP�wZ
SETUP_LOOP�xZSETUP_EXCEPT�yZ
SETUP_FINALLY�zZ	LOAD_FAST�|Z
STORE_FAST�}ZDELETE_FAST�~ZSTORE_ANNOTATION�Z
RAISE_VARARGS�Z
CALL_FUNCTION�Z
MAKE_FUNCTION�ZBUILD_SLICE�ZLOAD_CLOSURE�Z
LOAD_DEREF�ZSTORE_DEREF�ZDELETE_DEREF�ZCALL_FUNCTION_KW�ZCALL_FUNCTION_EX�Z
SETUP_WITH�ZLIST_APPEND�ZSET_ADD�ZMAP_ADD�ZLOAD_CLASSDEREF��ZBUILD_LIST_UNPACK�ZBUILD_MAP_UNPACK�ZBUILD_MAP_UNPACK_WITH_CALL�ZBUILD_TUPLE_UNPACK�ZBUILD_SET_UNPACK�ZSETUP_ASYNC_WITH�ZFORMAT_VALUE�ZBUILD_CONST_KEY_MAP�ZBUILD_STRING�ZBUILD_TUPLE_UNPACK_WITH_CALL�N)rrrrrrrrrrrr)�__all__Z_opcoderr$�ImportErrorrrrrrrrrr
r
�ranger	r#r%r&r'rrrrrr�<module>s4


	






















































































































contextlib.cpython-36.opt-2.pyc000064400000017206150335715140012317 0ustar003


 \j3�@s�ddlZddlZddlZddlmZddlmZdddddd	d
dgZGdd�dej�Z	Gd
d�de
�ZGdd�dee	�Zdd�Z
Gdd�de	�ZGdd�de	�ZGdd	�d	e�ZGdd
�d
e�ZGdd�de	�ZGdd�de	�ZdS)�N)�deque)�wraps�contextmanager�closing�AbstractContextManager�ContextDecorator�	ExitStack�redirect_stdout�redirect_stderr�suppressc@s.eZdZdd�Zejdd��Zedd��ZdS)rcCs|S)N�)�selfrr�"/usr/lib64/python3.6/contextlib.py�	__enter__sz AbstractContextManager.__enter__cCsdS)Nr)r
�exc_type�	exc_value�	tracebackrrr�__exit__szAbstractContextManager.__exit__cCs|tkrtj|dd�StS)Nrr)r�_collections_abc�_check_methods�NotImplemented)�cls�Crrr�__subclasshook__sz'AbstractContextManager.__subclasshook__N)	�__name__�
__module__�__qualname__r�abc�abstractmethodr�classmethodrrrrrr
sc@seZdZdd�Zdd�ZdS)rcCs|S)Nr)r
rrr�_recreate_cm$s
zContextDecorator._recreate_cmcst����fdd��}|S)Nc
s�j���||�SQRXdS)N)r )�args�kwds)�funcr
rr�inner1s
z(ContextDecorator.__call__.<locals>.inner)r)r
r#r$r)r#r
r�__call__0szContextDecorator.__call__N)rrrr r%rrrrr!sc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_GeneratorContextManagercCsJ|||�|_||||_|_|_t|dd�}|dkr@t|�j}||_dS)N�__doc__)�genr#r!r"�getattr�typer')r
r#r!r"�docrrr�__init__;s
z!_GeneratorContextManager.__init__cCs|j|j|j|j�S)N)�	__class__r#r!r")r
rrrr Isz%_GeneratorContextManager._recreate_cmcCs.y
t|j�Stk
r(td�d�YnXdS)Nzgenerator didn't yield)�nextr(�
StopIteration�RuntimeError)r
rrrrOs
z"_GeneratorContextManager.__enter__cCs�|dkr6yt|j�Wntk
r*dSXtd��n�|dkrD|�}y|jj|||�Wn�tk
r|}z||k	Sd}~Xnftk
r�}z*||kr�dS|tkr�|j|kr�dS�WYdd}~Xn"tj�d|kr�dS�YnXtd��dS)NFzgenerator didn't stop�z#generator didn't stop after throw())r.r(r/r0�throw�	__cause__�sys�exc_info)r
r*�valuer�excrrrrUs.
z!_GeneratorContextManager.__exit__N)rrrr,r rrrrrrr&8sr&cst���fdd��}|S)Ncst�||�S)N)r&)r!r")r#rr�helper�szcontextmanager.<locals>.helper)r)r#r8r)r#rr�sc@s$eZdZdd�Zdd�Zdd�ZdS)rcCs
||_dS)N)�thing)r
r9rrrr,�szclosing.__init__cCs|jS)N)r9)r
rrrr�szclosing.__enter__cGs|jj�dS)N)r9�close)r
r5rrrr�szclosing.__exit__N)rrrr,rrrrrrr�sc@s(eZdZdZdd�Zdd�Zdd�ZdS)�_RedirectStreamNcCs||_g|_dS)N)�_new_target�_old_targets)r
�
new_targetrrrr,�sz_RedirectStream.__init__cCs*|jjtt|j��tt|j|j�|jS)N)r=�appendr)r4�_stream�setattrr<)r
rrrr�sz_RedirectStream.__enter__cCstt|j|jj��dS)N)rAr4r@r=�pop)r
�exctype�excinst�exctbrrrr�sz_RedirectStream.__exit__)rrrr@r,rrrrrrr;�sr;c@seZdZdZdS)r	�stdoutN)rrrr@rrrrr	�s
c@seZdZdZdS)r
�stderrN)rrrr@rrrrr
�sc@s$eZdZdd�Zdd�Zdd�ZdS)rcGs
||_dS)N)�_exceptions)r
�
exceptionsrrrr,�szsuppress.__init__cCsdS)Nr)r
rrrr�szsuppress.__enter__cCs|dk	ot||j�S)N)�
issubclassrH)r
rCrDrErrrr�s
zsuppress.__exit__N)rrrr,rrrrrrr�sc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)rcCst�|_dS)N)r�_exit_callbacks)r
rrrr,szExitStack.__init__cCst|��}|j|_t�|_|S)N)r*rKr)r
�	new_stackrrr�pop_alls
zExitStack.pop_allcs"��fdd�}�|_|j|�dS)Ncs��f|��S)Nr)�exc_details)�cm�cm_exitrr�
_exit_wrappersz.ExitStack._push_cm_exit.<locals>._exit_wrapper)�__self__�push)r
rOrPrQr)rOrPr�
_push_cm_exitszExitStack._push_cm_exitcCsDt|�}y
|j}Wn tk
r2|jj|�YnX|j||�|S)N)r*r�AttributeErrorrKr?rT)r
�exit�_cb_type�exit_methodrrrrS s

zExitStack.pushcs$���fdd�}�|_|j|��S)Ncs����dS)Nr)rr7�tb)r!�callbackr"rrrQ9sz)ExitStack.callback.<locals>._exit_wrapper)�__wrapped__rS)r
rZr!r"rQr)r!rZr"rrZ4s
zExitStack.callbackcCs(t|�}|j}|j|�}|j||�|S)N)r*rrrT)r
rO�_cm_type�_exit�resultrrr�
enter_contextAs

zExitStack.enter_contextcCs|jddd�dS)N)r)r
rrrr:NszExitStack.closec	s�|ddk	}tj�d��fdd�}d}d}x\|jr�|jj�}y||�rTd}d}d}Wq.tj�}||d|d�d}|}Yq.Xq.W|r�y|dj}|d�Wn tk
r�||d_�YnX|o�|S)Nrr1cs8x,|j}||krdS|dks$|�kr&P|}qW||_dS)N)�__context__)�new_exc�old_exc�exc_context)�	frame_excrr�_fix_exception_contextXsz2ExitStack.__exit__.<locals>._fix_exception_contextFT)NNN)r4r5rKrBr`�
BaseException)	r
rN�received_excre�suppressed_exc�
pending_raise�cb�new_exc_details�	fixed_ctxr)rdrrRs2


zExitStack.__exit__N)rrrr,rMrTrSrZr_r:rrrrrrs

)rr4r�collectionsr�	functoolsr�__all__�ABCr�objectrr&rrr;r	r
rrrrrr�<module>s"I"crypt.cpython-36.pyc000064400000004304150335715140010340 0ustar003


 \H�@s�dZddlZddlZddlmZddlmZ	ej
ejdZe�Z
Gdd�de	dd��Zdd	d
�Zddd�Zed
ddd�Zedddd�Zedddd�Zedddd�ZgZx:eeeefD]*Zede�Zer�ee�ejkr�eje�q�W[[dS)zEWrapper to the POSIX crypt library call and associated functionality.�N)�SystemRandom)�
namedtuplez./c@seZdZdZdd�ZdS)�_MethodziClass representing a salt method per the Modular Crypt Format or the
    legacy 2-character crypt method.cCsdj|j�S)Nz<crypt.METHOD_{}>)�format�name)�self�r�/usr/lib64/python3.6/crypt.py�__repr__sz_Method.__repr__N)�__name__�
__module__�__qualname__�__doc__r
rrrr	r
srz name ident salt_chars total_sizecCsH|dkrtd}|jr"dj|j�nd}|djdd�t|j�D��7}|S)zsGenerate a salt for the specified method.

    If not specified, the strongest available method will be used.

    Nrz${}$�css|]}tjt�VqdS)N)�_srZchoice�
_saltchars)�.0�charrrr	�	<genexpr>szmksalt.<locals>.<genexpr>)�methodsZidentr�join�rangeZ
salt_chars)�method�srrr	�mksalts
rcCs&|dkst|t�rt|�}tj||�S)aRReturn a string representing the one-way hash of a password, with a salt
    prepended.

    If ``salt`` is not specified or is ``None``, the strongest
    available method will be selected and a salt generated.  Otherwise,
    ``salt`` may be one of the ``crypt.METHOD_*`` values, or a string as
    returned by ``crypt.mksalt()``.

    N)�
isinstancerr�_crypt�crypt)ZwordZsaltrrr	r#s
rZCRYPT��
ZMD5�1��"ZSHA256�5��?ZSHA512�6�jr)N)N)rr�stringZ_stringZrandomrZ
_SystemRandom�collectionsrZ_namedtupleZ
ascii_lettersZdigitsrrrrrZMETHOD_CRYPTZ
METHOD_MD5Z
METHOD_SHA256Z
METHOD_SHA512r�_methodZ_result�lenZ
total_size�appendrrrr	�<module>s&	


_strptime.cpython-36.opt-1.pyc000064400000037135150335715140012154 0ustar003


 \�`�@s�dZddlZddlZddlZddlmZddlmZddlmZ	ddl
mZm
ZmZyddlmZWn ek
r�ddlmZYnXgZdd	�ZGd
d�de�ZGdd
�d
e�Ze�Ze�adZiadd�Z dd�Z!ddd�Z"ddd�Z#ddd�Z$dS)a�Strptime-related classes and functions.

CLASSES:
    LocaleTime -- Discovers and stores locale-specific time information
    TimeRE -- Creates regexes for pattern matching a string of text containing
                time information

FUNCTIONS:
    _getlang -- Figure out what language is being used for the locale
    strptime -- Calculates the time struct represented by the passed-in string

�N)�compile)�
IGNORECASE)�escape)�date�	timedelta�timezone)�
allocate_lockcCstjtj�S)N)�localeZ	getlocale�LC_TIME�rr�!/usr/lib64/python3.6/_strptime.py�_getlangsr
c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�
LocaleTimeakStores and handles locale-specific information related to time.

    ATTRIBUTES:
        f_weekday -- full weekday names (7-item list)
        a_weekday -- abbreviated weekday names (7-item list)
        f_month -- full month names (13-item list; dummy value in [0], which
                    is added by code)
        a_month -- abbreviated month names (13-item list, dummy value in
                    [0], which is added by code)
        am_pm -- AM/PM representation (2-item list)
        LC_date_time -- format string for date/time representation (string)
        LC_date -- format string for date representation (string)
        LC_time -- format string for time representation (string)
        timezone -- daylight- and non-daylight-savings timezone representation
                    (2-item list of sets)
        lang -- Language used by instance (2-item tuple)
    cCsht�|_|j�|j�|j�|j�|j�t�|jkrDtd��tj	|j	ks\tj
|j
krdtd��dS)a�Set all attributes.

        Order of methods called matters for dependency reasons.

        The locale language is set at the offset and then checked again before
        exiting.  This is to make sure that the attributes were not set with a
        mix of information from more than one locale.  This would most likely
        happen when using threads where one thread calls a locale-dependent
        function while another thread changes the locale while the function in
        the other thread is still running.  Proper coding would call for
        locks to prevent changing the locale while locale-dependent code is
        running.  The check here is done in case someone does not think about
        doing this.

        Only other possible issue is if someone changed the timezone and did
        not call tz.tzset .  That is an issue for the programmer, though,
        since changing the timezone is worthless without that call.

        z$locale changed during initializationz&timezone changed during initializationN)r
�lang�_LocaleTime__calc_weekday�_LocaleTime__calc_month�_LocaleTime__calc_am_pm�_LocaleTime__calc_timezone�_LocaleTime__calc_date_time�
ValueError�time�tzname�daylight)�selfrrr�__init__4szLocaleTime.__init__cCs(t|�}|r|jdd�n
|jd�|S)Nr�)�list�insert�append)r�seq�frontrrrZ__padSs

zLocaleTime.__padcCs4dd�td�D�}dd�td�D�}||_||_dS)NcSsg|]}tj|j��qSr)�calendarZday_abbr�lower)�.0�irrr�
<listcomp>_sz-LocaleTime.__calc_weekday.<locals>.<listcomp>�cSsg|]}tj|j��qSr)r!Zday_namer")r#r$rrrr%`s)�range�	a_weekday�	f_weekday)rr(r)rrrZ__calc_weekday\szLocaleTime.__calc_weekdaycCs4dd�td�D�}dd�td�D�}||_||_dS)NcSsg|]}tj|j��qSr)r!Z
month_abbrr")r#r$rrrr%fsz+LocaleTime.__calc_month.<locals>.<listcomp>�
cSsg|]}tj|j��qSr)r!Z
month_namer")r#r$rrrr%gs)r'�a_month�f_month)rr+r,rrrZ__calc_monthdszLocaleTime.__calc_monthcCsNg}x>dD]6}tjddd|dddd	d
f	�}|jtjd|�j��q
W||_dS)
N��i����,�7��Lrz%p)r-r.)r�struct_timer�strftimer"�am_pm)rr7�hour�
time_tuplerrrZ__calc_am_pmks

zLocaleTime.__calc_am_pmc
CsXtjd1�}dddg}tjd
|�j�|d	<tjd|�j�|d<tjd
|�j�|d<d2|jddf|jddf|jddf|jddf|jddfd3d4d5d6d7d8d9d:d;d<d=g}|j	d*d+�|j
D��xvdAD]n\}}||}x$|D]\}}|�r�|j||�}�q�WtjdB�}d-tj||�k�rd.}	nd/}	|jd0|	�||<�q�W|d	|_|d|_
|d|_dS)CN��r/r0r.r1r2r3r4r�%c�%xr-�%X�%�%%z%Az%Bz%az%bz%p�1999�%Y�99�%y�22�%H�44�%M�55�%S�76�%j�17�%d�03�%m�3�2�%w�10�%IcSsg|]}|D]}|df�qqS)z%Zr)r#�	tz_values�tzrrrr%�sz/LocaleTime.__calc_date_time.<locals>.<listcomp>�Z00z%Wz%UZ11)	r:r/r0r.r1r2r3r4r)r>r?)r@rA)rBrC)rDrE)rFrG)rHrI)rJrK)rLrM)rNrO)rPrO)rQrR)rSrT�rr;�r-r<�r3r=)rXrYrZ)	r:r-r/r-r-r-rWr/r)rr5r6r"r)r,r(r+r7�extendr�replace�LC_date_time�LC_date�LC_time)
rr9Z	date_timeZreplacement_pairs�offset�	directiveZcurrent_format�old�newZU_WrrrZ__calc_date_timews4




zLocaleTime.__calc_date_timec
Cszytj�Wntk
r YnXtj|_tj|_tdd|jdj�h�}|jrft|jdj�h�}nt�}||f|_dS)N�utc�gmtrr-)rZtzset�AttributeErrorrr�	frozensetr"r)rZ	no_savingZ
has_savingrrrZ__calc_timezone�szLocaleTime.__calc_timezoneN)�__name__�
__module__�__qualname__�__doc__rZ_LocaleTime__padrrrrrrrrrr!s	-rcs:eZdZdZd�fdd�	Zdd�Zdd�Zd	d
�Z�ZS)�TimeREz4Handle conversion from format directives to regexes.Ncs|r||_nt�|_t�}|jddddddddd	d
ddd
ddd|j|jjd�|j|jjd�|j|jjdd�d�|j|jjdd�d�|j|jj	d�|jdd�|jj
D�d�dd��|jd|jd�j
dd��|jd|j|jj��|jd |j|jj��|jd!|j|jj��dS)"z^Create keys/values.

        Order of execution is important for dependency reasons.

        z)(?P<d>3[0-1]|[1-2]\d|0[1-9]|[1-9]| [1-9])z(?P<f>[0-9]{1,6})z(?P<H>2[0-3]|[0-1]\d|\d)z(?P<I>1[0-2]|0[1-9]|[1-9])z(?P<G>\d\d\d\d)zG(?P<j>36[0-6]|3[0-5]\d|[1-2]\d\d|0[1-9]\d|00[1-9]|[1-9]\d|0[1-9]|[1-9])z(?P<m>1[0-2]|0[1-9]|[1-9])z(?P<M>[0-5]\d|\d)z(?P<S>6[0-1]|[0-5]\d|\d)z(?P<U>5[0-3]|[0-4]\d|\d)z(?P<w>[0-6])z(?P<u>[1-7])z(?P<V>5[0-3]|0[1-9]|[1-4]\d|\d)z(?P<y>\d\d)z(?P<Y>\d\d\d\d)z(?P<z>[+-]\d\d[0-5]\d)�A�ar-N�B�b�pcss|]}|D]
}|Vq
qdS)Nr)r#Ztz_namesrVrrr�	<genexpr>�sz"TimeRE.__init__.<locals>.<genexpr>�Zr>)�d�f�H�I�G�j�m�M�S�U�w�u�V�y�Y�zrmrnrorprqrsr>�Wr}�c�x�X)�locale_timer�superr�_TimeRE__seqToREr)r(r,r+r7r�__setitem__�__getitem__r\�patternr]r^r_)rr��base)�	__class__rrr�sB
zTimeRE.__init__cCsRt|tdd�}x|D]}|dkrPqWdSdjdd�|D��}d||f}d|S)	aeConvert a list to a regex string for matching a directive.

        Want possible matching values to be from longest to shortest.  This
        prevents the possibility of a match occurring for a value that also
        a substring of a larger value that should have matched (e.g., 'abc'
        matching when 'abcdef' should have been the match).

        T)�key�reverser�|css|]}t|�VqdS)N)�	re_escape)r#Zstuffrrrrr�sz#TimeRE.__seqToRE.<locals>.<genexpr>z	(?P<%s>%sz%s))�sorted�len�join)rZ
to_convertra�valueZregexrrrZ	__seqToRE�s	
zTimeRE.__seqToREcCs�d}td�}|jd|�}td�}|jd|�}xLd|krx|jd�d}d||d	|d�|||f}||dd	�}q.Wd
||fS)z�Return regex pattern for the format string.

        Need to make sure that any characters that might be interpreted as
        regex syntax are escaped.

        rz([\\.^$*+?\(\){}\[\]|])z\\\1z\s+z\\s+r>r-z%s%s%sNz%s%s)�
re_compile�sub�index)r�formatZprocessed_formatZregex_charsZwhitespace_replacementZdirective_indexrrrr��s
zTimeRE.patterncCst|j|�t�S)z2Return a compiled re object for the format string.)r�r�r)rr�rrrrszTimeRE.compile)N)	rhrirjrkrr�r�r�
__classcell__rr)r�rrl�s
.rl�cCslt|dd�j�}|s,|dd}|dd}d|d}|dkrLd||S|d|d}d||SdS)z�Calculate the Julian day based on the year, week of the year, and day of
    the week, with week_start_day representing whether the week of the year
    assumes the week starts on Sunday or Monday (6 or 0).r-r&rN)�
datetime_date�weekday)�year�week_of_yearZday_of_week�week_starts_MonZ
first_weekdayZ
week_0_lengthZdays_to_weekrrr�_calc_julian_from_U_or_Wsr�cCsdt|dd�j�d}|d||}|dkr\|t|dd�j�7}|d8}|t|dd�j�8}||fS)z�Calculate the Julian day based on the ISO 8601 year, week, and weekday.
    ISO weeks start on Mondays, with week 01 being the week containing 4 Jan.
    ISO week days range from 1 (Monday) to 7 (Sunday).
    r-�r/r&)r�Z
isoweekday�	toordinal)�iso_year�iso_weekZiso_weekdayZ
correctionZordinalrrr�_calc_julian_from_V1sr��%a %b %d %H:%M:%S %Yc' Cslx:t||g�D]*\}}t|t�sd}t|j|t|����qWt��tj}t	�|j
ksltj|jksltj
|j
kr�t�atj�tj}tt�tkr�tj�tj|�}|�s,ytj|�}Wnptk
�r}z0|jd}|dkr�d}~td||f�d�WYdd}~Xn$tk
�r"td|�d�YnX|t|<WdQRX|j|�}	|	�sVtd||f��t|�|	j�k�r�td	||	j�d���d}
}d
}}
d}}}}d:}d}d}}d}d}}|	j�}�x�|j�D�]�}|dk�rt|d�}|dk�r|d
7}n|d7}�q�|dk�r&t|d�}�q�|dk�r@t|d�}
�q�|dk�rZt|d�}�q�|dk�r||jj|dj ��}�q�|dk�r�|j!j|dj ��}�q�|dk�r�t|d�}
�q�|dk�r�t|d�}�q�|dk�rBt|d�}|jdd�j �}|d|j"dfk�r|dk�r>d}n"||j"d
k�rT|dk�rT|d7}�q�|dk�r\t|d�}�q�|dk�rvt|d�}�q�|dk�r�|d}|ddt|�7}t|�}�q�|dk�r�|j#j|dj ��}�q�|d k�r�|j$j|d j ��}�q�|d!k�rt|d!�}|dk�rd}n|d
8}�q�|d"k�r@t|d"�}|d
8}�q�|d#k�rZt|d#�}�q�|d;k�r�t||�}|d$k�r�d}nd}n�|d&k�r�t|d&�}n�|d'k�r�|d'}t|d
d(��d)t|d(d*��}|j%d+��rT|}nl|d,k�r�|d,j �}xTt|j&�D]F\}} || k�r
tjdtjd
k�rHtj
�rH|d<k�rHPn|}P�q
W�q�W|dk�r�|
dk	�r�|dk�s�|dk�r�td/��|dk	�r�td0��n0|dk�r�|dk	�r�|dk�r�td1��ntd2��d3}!|dk�r�|d4k�r�|
d5k�r�d6}d7}!n|dk�rd}|dk�r�|dk	�r�|dk	�rH|dk�r4d7nd3}"t'||||"�}n(|
dk	�rp|dk	�rpt(|
||d
�\}}|dk	�r�|dk�r�|d
8}t)j*|��r�d8nd9}#||#7}|dk�r�t+|||
�j,�t+|d
d
�j,�d
}n0t+j-|d
t+|d
d
�j,��}$|$j.}|$j/}|$j0}
|dk�r"t+|||
�j1�}|jd,�}%|dk	�r@|d)}&nd}&|!�rNd}|||
|||||||%|&f|fS)=z�Return a 2-tuple consisting of a time struct and an int containing
    the number of microseconds based on the input string and the
    format string.z*strptime() argument {} must be str, not {}r�\r>z&'%s' is a bad directive in format '%s'Nzstray %% in format '%s'z%time data %r does not match format %rzunconverted data remains: %sr-r��Di�ilr�rxrzrorprtrvrwrqr�r{r|ru�0rWrmrnr~rryr}r�r�r�r/�<r��-rsrdrezzISO year directive '%G' must be used with the ISO week directive '%V' and a weekday directive ('%A', '%a', '%w', or '%u').z`Day of the year directive '%j' is not compatible with ISO year directive '%G'. Use '%Y' instead.zzISO week directive '%V' must be used with the ISO year directive '%G' and a weekday directive ('%A', '%a', '%w', or '%u').zdISO week directive '%V' is incompatible with the year directive '%Y'. Use the ISO year '%G' instead.Fr3�ipTinim���)r}r�)rdre)2�	enumerate�
isinstance�str�	TypeErrorr��type�_cache_lock�
_TimeRE_cacher�r
rrrrrl�_regex_cache�clearr��_CACHE_MAX_SIZE�getr�KeyError�argsr�
IndexError�match�end�	groupdict�keys�intr,r�r"r+r7r)r(�
startswithrr�r�r!Zisleapr�r�Zfromordinalr��month�dayr�)'�data_stringr�r��arg�msgr�Zformat_regex�errZ
bad_directive�foundr�r�r�r�r8Zminute�second�fractionrVZtzoffsetr�r�Zweek_of_year_startr�ZjulianZ
found_dictZ	group_keyZampm�sr�Z
found_zoner�rUZ
leap_year_fixr�ZydayZdatetime_resultr�gmtoffrrr�	_strptimeAsB





























$








&



r�cCs"t||�d}tj|dtj��S)zIReturn a time struct based on the input string and the
    format string.rN)r�rr5Z_STRUCT_TM_ITEMS)r�r��ttrrr�_strptime_time,sr�c
Cslt||�\}}|dd�\}}|dd�|f}|dk	rdt|d�}|rRt||�}	nt|�}	||	f7}||�S)zPReturn a class cls instance based on the input string and the
    format string.r3NrW)Zseconds���)r��datetime_timedelta�datetime_timezone)
�clsr�r�r�r�rr�r�ZtzdeltarVrrr�_strptime_datetime2s

r�)r�)r�)r�)%rkrr	r!�rerr�rrr�Zdatetimerr�rr�rr��_threadrZ_thread_allocate_lock�ImportErrorZ
_dummy_thread�__all__r
�objectr�dictrlr�r�r�r�r�r�r�r�r�rrrr�<module>s4_
l
random.cpython-36.opt-1.pyc000064400000045604150335715140011426 0ustar003


 \2k�@s�dZddlmZddlmZmZddl	m
ZmZ
mZmZmZddl	mZmZmZmZddlmZddlm Z!m"Z#ddl$m%Z&dd	l'Z(dd	l)Z*d
ddd
ddddddddddddddddddd d!gZ+d"e
d2�ed$�Z,d$eZ-ed%�Z.d&ed'�Z/d(Z0d)e0Z1dd	l2Z2Gd*d
�d
e2j3�Z3Gd+d!�d!e3�Z4d,d-�Z5d3d/d0�Z6e3�Z7e7j8Z8e7j9Z9e7j:Z:e7j;Z;e7j<Z<e7j=Z=e7j>Z>e7j?Z?e7j@Z@e7jAZAe7jBZBe7jCZCe7jDZDe7jEZEe7jFZFe7jGZGe7jHZHe7jIZIe7jJZJe7jKZKe7jLZLe7jMZMeNd1k�r�e6�d	S)4a�Random variable generators.

    integers
    --------
           uniform within range

    sequences
    ---------
           pick random element
           pick random sample
           pick weighted random sample
           generate random permutation

    distributions on the real line:
    ------------------------------
           uniform
           triangular
           normal (Gaussian)
           lognormal
           negative exponential
           gamma
           beta
           pareto
           Weibull

    distributions on the circle (angles 0 to 2pi)
    ---------------------------------------------
           circular uniform
           von Mises

General notes on the underlying Mersenne Twister core generator:

* The period is 2**19937-1.
* It is one of the most extensively tested generators in existence.
* The random() method is implemented in C, executes in a single Python step,
  and is, therefore, threadsafe.

�)�warn)�
MethodType�BuiltinMethodType)�log�exp�pi�e�ceil)�sqrt�acos�cos�sin)�urandom)�Set�Sequence)�sha512N�Random�seed�random�uniform�randint�choice�sample�	randrange�shuffle�
normalvariate�lognormvariate�expovariate�vonmisesvariate�gammavariate�
triangular�gauss�betavariate�
paretovariate�weibullvariate�getstate�setstate�getrandbits�choices�SystemRandom�g�?g@g@g�?g@�5�cseZdZdZdZd;dd�Zd<�fdd�	Z�fd	d
�Z�fdd�Zd
d�Z	dd�Z
dd�Zddefdd�Z
dd�Zede>eeefdd�Zdd�Zd=dd�Zdd�Zd>ddd �d!d"�Zd#d$�Zd?d'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Z d7d8�Z!d9d:�Z"�Z#S)@ra�Random number generator base class used by bound module functions.

    Used to instantiate instances of Random to get generators that don't
    share state.

    Class Random can also be subclassed if you want to use a different basic
    generator of your own devising: in that case, override the following
    methods:  random(), seed(), getstate(), and setstate().
    Optionally, implement a getrandbits() method so that randrange()
    can cover arbitrarily large ranges.

    �NcCs|j|�d|_dS)zeInitialize an instance.

        Optional argument x controls seeding, as for Random.seed().
        N)r�
gauss_next)�self�x�r1�/usr/lib64/python3.6/random.py�__init__Ws
zRandom.__init__r,cs�|dkr�t|ttf�r�t|t�r*|jd�n|}|rBt|d�d>nd}x"tt|�D]}d||Ad@}qRW|t|�N}|d
kr�dn|}|dkr�t|tttf�r�t|t�r�|j�}|t	|�j
�7}tj|d�}t
�j|�d	|_d	S)aInitialize internal state from hashable object.

        None or no argument seeds from current time or from an operating
        system specific randomness source if available.

        If *a* is an int, all bits are used.

        For version 2 (the default), all of the bits are used if *a* is a str,
        bytes, or bytearray.  For version 1 (provided for reproducing random
        sequences from older versions of Python), the algorithm for str and
        bytes generates a narrower range of seeds.

        �zlatin-1r�iCBl����r,�bigN������)�
isinstance�str�bytes�decode�ord�map�len�	bytearray�encode�_sha512Zdigest�int�
from_bytes�superrr.)r/�a�versionr0�c)�	__class__r1r2r`s
zRandom.seedcs|jt�j�|jfS)z9Return internal state; can be passed to setstate() later.)�VERSIONrEr%r.)r/)rIr1r2r%�szRandom.getstatecs�|d}|dkr*|\}}|_t�j|�nt|dkr�|\}}|_ytdd�|D��}Wn(tk
r|}zt|�WYdd}~XnXt�j|�ntd||jf��dS)z:Restore internal state from object returned by getstate().rr-r,css|]}|dVqdS)r,� Nlr1)�.0r0r1r1r2�	<genexpr>�sz"Random.setstate.<locals>.<genexpr>Nz?state with version %s passed to Random.setstate() of version %s)r.rEr&�tuple�
ValueError�	TypeErrorrJ)r/�staterGZ
internalstater)rIr1r2r&�szRandom.setstatecCs|j�S)N)r%)r/r1r1r2�__getstate__�szRandom.__getstate__cCs|j|�dS)N)r&)r/rQr1r1r2�__setstate__�szRandom.__setstate__cCs|jf|j�fS)N)rIr%)r/r1r1r2�
__reduce__�szRandom.__reduce__r4c
Cs||�}||krtd��|dkr:|dkr2|j|�Std��||�}||krRtd��||}|dkrx|dkrx||j|�S|dkr�td|||f��||�}||kr�td��|dkr�||d|}	n"|dkr�||d|}	ntd	��|	dkr�td��|||j|	�S)
z�Choose a random item from range(start, stop[, step]).

        This fixes the problem with randint() which includes the
        endpoint; in Python this is usually not what you want.

        z!non-integer arg 1 for randrange()Nrzempty range for randrange()z non-integer stop for randrange()r4z'empty range for randrange() (%d,%d, %d)z non-integer step for randrange()zzero step for randrange())rO�
_randbelow)
r/�start�stop�step�_intZistartZistop�widthZistep�nr1r1r2r�s4

zRandom.randrangecCs|j||d�S)zJReturn random integer in range [a, b], including both end points.
        r4)r)r/rF�br1r1r2r�szRandom.randintc
Cs�|j}|j}||�|ks$||�|krN|j�}	||	�}
x|
|krH||	�}
q6W|
S||krltd�||�|�S|dkr|td��||}|||}|�}
x|
|kr�|�}
q�W||
|�|S)zCReturn a random int in the range [0,n).  Raises ValueError if n==0.z�Underlying random() generator does not supply 
enough bits to choose from a population range this large.
To remove the range limitation, add a getrandbits() method.rzBoundary cannot be zero)rr'�
bit_length�_warnrO)
r/r[rC�maxsize�typeZMethodZ
BuiltinMethodrr'�k�rZrem�limitr1r1r2rU�s&


zRandom._randbelowcCs:y|jt|��}Wntk
r0td�d�YnX||S)z2Choose a random element from a non-empty sequence.z$Cannot choose from an empty sequenceN)rUr?rO�
IndexError)r/�seq�ir1r1r2r�s
z
Random.choicecCs�|dkrR|j}x�ttdt|���D]*}||d�}||||||<||<q"WnLt}xFttdt|���D]0}||�|d�}||||||<||<qjWdS)z�Shuffle list x in place, and return None.

        Optional argument random is a 0-argument function returning a
        random float in [0.0, 1.0); if it is the default None, the
        standard random.random will be used.

        Nr4)rU�reversed�ranger?rC)r/r0r�	randbelowrf�jrYr1r1r2rs	 zRandom.shufflecCs(t|t�rt|�}t|t�s$td��|j}t|�}d|koD|knsRtd��dg|}d}|dkr�|dtt	|dd��7}||kr�t
|�}x�t|�D]0}|||�}	||	||<|||d	||	<q�WnRt�}
|
j
}xDt|�D]8}||�}	x|	|
k�r
||�}	q�W||	�||	||<q�W|S)
a=Chooses k unique random elements from a population sequence or set.

        Returns a new list containing elements from the population while
        leaving the original population unchanged.  The resulting list is
        in selection order so that all sub-slices will also be valid random
        samples.  This allows raffle winners (the sample) to be partitioned
        into grand prize and second place winners (the subslices).

        Members of the population need not be hashable or unique.  If the
        population contains repeats, then each occurrence is a possible
        selection in the sample.

        To choose a sample in a range of integers, use range as an argument.
        This is especially fast and space efficient for sampling from a
        large population:   sample(range(10000000), 60)
        z>Population must be a sequence or set.  For dicts, use list(d).rz,Sample larger than population or is negativeN��r*r-r4)r9�_SetrN�	_SequencerPrUr?rO�_ceil�_log�listrh�set�add)r/�
populationrarir[�resultZsetsizeZpoolrfrjZselectedZselected_addr1r1r2rs6


z
Random.sample)�cum_weightsracs�|j��dkrN|dkr>t�t�������fdd�t|�D�Sttj|���n|dk	r^td��t��t��krvtd��t	j
��d�t��d�������fdd�t|�D�S)	z�Return a k sized list of population elements chosen with replacement.

        If the relative weights or cumulative weights are not specified,
        the selections are made with equal probability.

        Ncsg|]}�������qSr1r1)rLrf)rYrtr�totalr1r2�
<listcomp>csz"Random.choices.<locals>.<listcomp>z2Cannot specify both weights and cumulative weightsz3The number of weights does not match the populationr4cs$g|]}������d���qS)rr1)rLrf)�bisectrv�hirtrrwr1r2rxlsr7)rrCr?rhrq�
_itertools�
accumulaterPrO�_bisectry)r/rtZweightsrvrar1)rYryrvrzrtrrwr2r(Ws zRandom.choicescCs||||j�S)zHGet a random number in the range [a, b) or [a, b] depending on rounding.)r)r/rFr\r1r1r2rsszRandom.uniform���?cCsx|j�}y |dkrdn||||}Wntk
r<|SX||kr`d|}d|}||}}|||||dS)z�Triangular distribution.

        Continuous distribution bounded by given lower and upper limits,
        and having a given mode value in-between.

        http://en.wikipedia.org/wiki/Triangular_distribution

        Ng�?g�?)r�ZeroDivisionError)r/ZlowZhigh�mode�urHr1r1r2r ys	 
zRandom.triangularcCsT|j}x@|�}d|�}t|d|}||d}|t|�krPqW|||S)z\Normal distribution.

        mu is the mean, and sigma is the standard deviation.

        g�?g�?g@)r�
NV_MAGICCONSTrp)r/�mu�sigmar�u1�u2�zZzzr1r1r2r�s

zRandom.normalvariatecCst|j||��S)z�Log normal distribution.

        If you take the natural logarithm of this distribution, you'll get a
        normal distribution with mean mu and standard deviation sigma.
        mu can have any value, and sigma must be greater than zero.

        )�_expr)r/r�r�r1r1r2r�szRandom.lognormvariatecCstd|j��|S)a^Exponential distribution.

        lambd is 1.0 divided by the desired mean.  It should be
        nonzero.  (The parameter would be called "lambda", but that is
        a reserved word in Python.)  Returned values range from 0 to
        positive infinity if lambd is positive, and from negative
        infinity to 0 if lambd is negative.

        g�?)rpr)r/Zlambdr1r1r2r�szRandom.expovariatecCs�|j}|dkrt|�Sd|}|td||�}xN|�}tt|�}|||}|�}	|	d||ks~|	d|t|�kr6Pq6Wd|}
|
|d|
|}|�}|dkr�|t|�t}
n|t|�t}
|
S)aFCircular data distribution.

        mu is the mean angle, expressed in radians between 0 and 2*pi, and
        kappa is the concentration parameter, which must be greater than or
        equal to zero.  If kappa is equal to zero, this distribution reduces
        to a uniform random angle over the range 0 to 2*pi.

        g���ư>g�?g�?)r�TWOPI�_sqrt�_cos�_pir��_acos)r/r�Zkappar�srbr�r��dr��q�fZu3Zthetar1r1r2r�s&
$zRandom.vonmisesvariatecCs�|dks|dkrtd��|j}|dkr�td|d�}|t}||}x�|�}d|ko`dknshqHd|�}t|d|�|}	|t|	�}
|||}|||	|
}|td|dks�|t|�krH|
|SqHWn�|dk�r|�}
x|
dk�r|�}
q�Wt|
�|Sx�|�}
t|t}||
}|dk�rD|d|}
nt|||�}
|�}|dk�r|||
|dk�r�Pn|t|
�k�rP�qW|
|SdS)	aZGamma distribution.  Not the gamma function!

        Conditions on the parameters are alpha > 0 and beta > 0.

        The probability distribution function is:

                    x ** (alpha - 1) * math.exp(-x / beta)
          pdf(x) =  --------------------------------------
                      math.gamma(alpha) * beta ** alpha

        gz*gammavariate: alpha and beta must be > 0.0g�?g@gH�����z>g�P���?g@N)rOrr��LOG4rpr��
SG_MAGICCONST�_e)r/�alpha�betarZainvZbbbZcccr�r��vr0r�rbr�r\�pr1r1r2r�sJ
 



zRandom.gammavariatecCs`|j}|j}d|_|dkrT|�t}tdtd|���}t|�|}t|�||_|||S)z�Gaussian distribution.

        mu is the mean, and sigma is the standard deviation.  This is
        slightly faster than the normalvariate() function.

        Not thread-safe without a lock around calls.

        Ng@g�?g�)rr.r�r�rpr��_sin)r/r�r�rr�Zx2piZg2radr1r1r2r!?s
zRandom.gausscCs0|j|d�}|dkrdS|||j|d�SdS)z�Beta distribution.

        Conditions on the parameters are alpha > 0 and beta > 0.
        Returned values range between 0 and 1.

        g�?rgN)r)r/r�r��yr1r1r2r"ts
zRandom.betavariatecCsd|j�}d|d|S)z3Pareto distribution.  alpha is the shape parameter.g�?)r)r/r�r�r1r1r2r#�szRandom.paretovariatecCs"d|j�}|t|�d|S)zfWeibull distribution.

        alpha is the scale parameter and beta is the shape parameter.

        g�?)rrp)r/r�r�r�r1r1r2r$�szRandom.weibullvariate)N)Nr,)N)N)r~rN)$�__name__�
__module__�__qualname__�__doc__rJr3rr%r&rRrSrTrCrr�BPFr`�_MethodType�_BuiltinMethodTyperUrrrr(rr rrrrrr!r"r#r$�
__classcell__r1r1)rIr2rGs8
	 ,

:
0H5	c@s8eZdZdZdd�Zdd�Zdd�Zdd	�ZeZZ	d
S)r)z�Alternate random number generator using sources provided
    by the operating system (such as /dev/urandom on Unix or
    CryptGenRandom on Windows).

     Not available on all systems (see os.urandom() for details).
    cCstjtd�d�d?tS)z3Get the next random number in the range [0.0, 1.0).r5r6r-)rCrD�_urandom�	RECIP_BPF)r/r1r1r2r�szSystemRandom.randomcCsP|dkrtd��|t|�kr$td��|dd}tjt|�d�}||d|?S)z:getrandbits(k) -> x.  Generates an int with k random bits.rz(number of bits must be greater than zeroz#number of bits should be an integerr5�r6)rOrCrPrDr�)r/raZnumbytesr0r1r1r2r'�szSystemRandom.getrandbitscOsdS)z<Stub method.  Not used for a system random number generator.Nr1)r/�args�kwdsr1r1r2r�szSystemRandom.seedcOstd��dS)zAMethod should not be called for a system random number generator.z*System entropy source does not have state.N)�NotImplementedError)r/r�r�r1r1r2�_notimplemented�szSystemRandom._notimplementedN)
r�r�r�r�rr'rr�r%r&r1r1r1r2r)�s
cCs�ddl}t|d|j�d}d}d}d
}|j�}x@t|�D]4}	||�}
||
7}||
|
}t|
|�}t|
|�}q8W|j�}tt||d�ddd�||}t||||�}
td	||
||f�dS)Nr�timesgg _�Br-zsec,� )�endz"avg %g, stddev %g, min %g, max %g
g _��)�time�printr�rh�min�max�roundr�)r[�funcr�r�rwZsqsumZsmallestZlargestZt0rfr0Zt1ZavgZstddevr1r1r2�_test_generator�s&
r���cCs�t|tf�t|td�t|td�t|td
�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�dS)N���?�{�G�z�?皙�����?�@��?��������?�4@�i@�@)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r��UUUUUU�?)r�r�r�)	r�rrrrrr!r"r )�Nr1r1r2�_test�s r��__main__g�)r�)Or��warningsrr^�typesrr�rr�Zmathrrprr�rr�rr�r	ror
r�rr�rr�r
r��osrr��_collections_abcrrmrrnZhashlibrrB�	itertoolsr{ryr}�__all__r�r�r�r�r�r�Z_randomrr)r�r�Z_instrrrr rrrrrr(rrrrrr!r"r#r$r%r&r'r�r1r1r1r2�<module>&sn
Y!

cgitb.cpython-36.opt-2.pyc000064400000020443150335715140011231 0ustar003


 \�.�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	dd�Z
gZdd�Zdd�Z
dd	�Zd
d�Zdd
�Zddd�Zddd�ZGdd�d�Ze�jZddd�ZdS)�NcCsdS)Na'<!--: spam
Content-Type: text/html

<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> -->
<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> -->
</font> </font> </font> </script> </object> </blockquote> </pre>
</table> </table> </table> </table> </table> </font> </font> </font>�rrr�/usr/lib64/python3.6/cgitb.py�reset#srcCs|rd|dSdSdS)Nz<small>z</small>�r)�textrrr�small.srcCs|rd|dSdSdS)Nz<strong>z	</strong>rr)rrrr�strong4srcCs|rd|dSdSdS)Nz<font color="#909090">z</font>rr)rrrr�grey:sr	cCs�||krd||fS||jkr,d|j|fSd|jkr~|jd}t|�ti�krf||kr~d||fSnt||�r~dt||�fSdtfS)N�local�global�__builtins__�builtin)�	f_globals�type�hasattr�getattr�	__UNDEF__)�name�frame�locals�builtinsrrr�lookup@s



rcCs�gdddtf\}}}}}x�tj|�D]�\}}	}
}}|tjkr>P|tjkr�|	tjkr�|dkr�|tk	r�t||	t�}|j||	||f�q�t	|	||�\}
}|j|	|
|f�n"|	dkr�||d7}|}nd\}}|	}q$W|S)Nr�.)Nr)
r�tokenize�generate_tokens�NEWLINE�NAME�keyword�kwlistr�appendr)�readerrr�varsZ	lasttoken�parent�prefix�valueZttype�token�start�end�line�whererrr�scanvarsPs"
r*�c"	s�|\}}}t|t�r|j}dtjj�ddtj}tjtj��}dt	j
jdtt	j
j
t|���dd|d|�d	}d
tdd�d
}g}	tj||�}
�xJ|
D�]@\}�}}
}}�r�tjj���d�t	j
j
��f}nd�}tj|�\}}}}d}|
dk�r2dtt	j
j
|
��tj||||dd�d�}i�|gf��fdd�	}t|||�}dd||fg}|dk	�r||}x�|D]�}tddtt|��t|��d}|�k�r�d|t	j
j|�f}|jd|�n&d|t	j
j|�f}|jdt|��|d7}�q~Wig}}x�|D]�\}}} ||k�r0�qd||<| tk	�r�|d,k�r^d |t|�}n*|d!k�rrt|�}n|t|jd"�d-�}|jd#|t	j
j| �f�n|j|d$��qW|jdttd%j|����|	jd&d'j|��q�Wd(tt	j
j
t|���t	j
j
t|��fg}!xNt|�D]B}|dd�d)k�r:�q t	j
jt ||��} |!jd*||| f��q W|dj|	�dj|!�d+t	j
j
djt!j"|||���S).NzPython rz: z<body bgcolor="#f0f0f8">z<big><big>%s</big></big>z#ffffffz#6622aaz<br>z�
<p>A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.</p>z<tt>z&nbsp;r+z&nbsp;</tt>z<a href="file://%s">%s</a>�?rzin cSsdtjj|�S)N�=)�pydoc�html�repr)r$rrr�<lambda>�szhtml.<locals>.<lambda>)�formatvaluec
s4d�|d<ztj�|d�S|dd7<XdS)N�r)�	linecache�getline)�lnum)�file�	highlightrrr �szhtml.<locals>.readerz+<tr><td bgcolor="#d8bbff">%s%s %s</td></tr>z<big>&nbsp;</big>z<tt>=&gt;%s%s</tt>z&<tr><td bgcolor="#ffccee">%s</td></tr>z<tt>&nbsp;&nbsp;%s%s</tt>z<tr><td>%s</td></tr>r3rr
z<em>%s</em> r
rz%s&nbsp;= %sz <em>undefined</em>z, zF
<table width="100%%" cellspacing=0 cellpadding=0 border=0>
%s</table>�
z	<p>%s: %s�_z
<br>%s%s&nbsp;=
%sz�


<!-- The above is a description of an error in a Python program, formatted
     for a Web browser because the 'cgitb' module was enabled.  In case you
     are not reading this in a Web browser, here is the original traceback:

%s
-->
)rr
���)#�
isinstancer�__name__�sys�version�split�
executable�time�ctimer.r/Zheadingr�escape�strr�inspect�getinnerframes�os�path�abspath�getargvalues�formatargvaluesr*�lenZ	preformatrr	rr0�join�dirr�	traceback�format_exception)"�einfo�context�etype�evalue�etb�pyver�date�head�indent�frames�recordsrr6�func�lines�index�link�args�varargs�varkwr�callr r!�rows�ir(�num�done�dumprr)r$�	exceptionr)r7r8rr/es|

0


$






	r/c 	s�|\}}}t|t�r|j}dtjj�ddtj}tjtj��}dt	|�||fd}g}t
j||�}	�x�|	D�]�\}
�}}}
}�r�tj
j��p�d�t
j|
�\}}}}d}|dkr�d|t
j||||d	d
�d�}i�|gf��fdd
�	}t||
|�}d�|fg}|dk	�rL||}x0|
D](}d|}|j||j��|d7}�q Wig}}x�|D]�\}}}||k�rt�q\d||<|tk	�r�|dk�r�d|}n|dk�r�||jd�d}|jd|tjj|�f�n|j|d��q\W|jdj|��|jddj|��qrWdt	|�t	|�fg}x8t|�D],}tjjt||��}|jdd||f��q.W|dj|�dj|�ddjtj|||��S) NzPython rz: z	%s
%s
%s
z�
A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.
r,rzin cSsdtjj|�S)Nr-)r.rr0)r$rrrr1�sztext.<locals>.<lambda>)r2c
s4d�|d<ztj�|d�S|dd7<XdS)Nr3r)r4r5)r6)r7r8rrr �sztext.<locals>.readerz %s %sz%5d r3rzglobal r
rz%s = %sz
 undefinedr9z
%s
z%s: %sz

%s%s = %s� �zc

The above is a description of an error in a Python program.  Here is
the original traceback:

%s
r;z    )r<rr=r>r?r@rArBrCrErFrGrHrIrJrKrLr*r�rstriprr.rr0rNrOrrPrQ) rRrSrTrUrVrWrXrYr[r\rr6r]r^r_rarbrcrrdr r!rerfr(rgrhrirr)r$rjr)r7r8rr�s^









rc@s(eZdZddd�Zdd�Zdd	d
�ZdS)
�Hookr3Nr+r/cCs(||_||_||_|ptj|_||_dS)N)�display�logdirrSr>�stdoutr7�format)�selfrorprSr7rrrrr�__init__s
z
Hook.__init__cCs|j|||f�dS)N)�handle)rsrTrUrVrrr�__call__sz
Hook.__call__c
Csz|p
tj�}|jdkr$|jjt��|jdkr2tp4t}d}y|||j�}Wn dj	t
j|��}d}YnX|jr�|r�t
jj|�}|jjd|d�q�|jj|d�n|jjd�|jdk	�rZd	d
g|jdk}tj||jd�\}}y.tj|d��}|j|�WdQRXd
|}	Wnd|}	YnX|jdk�rJ|jjd|	�n|jj|	d�y|jj�WnYnXdS)Nr/FrTz<pre>z</pre>
r9z*<p>A problem occurred in a Python script.
z.txtz.html)�suffixrO�wz*%s contains the description of this error.z*Tried to save traceback to %s, but failed.z
<p>%s</p>
)r>�exc_inforrr7�writerr/rrSrNrPrQror.rDrp�tempfileZmkstemprH�fdopen�flush)
rs�infoZ	formatterZplain�docrw�fdrIr7�msgrrrrus@

zHook.handle)r3Nr+Nr/)N)r=�
__module__�__qualname__rtrvrurrrrrns
rnr3cCst||||d�t_dS)N)rorprSrr)rnr>�
excepthook)rorprSrrrrr�enable8sr�)r+)r+)r3Nr+r/)rFrr4rHr.r>r{rBrrPrrrrr	rr*r/rrnruZhandlerr�rrrr�<module>s*

Z
A7base64.cpython-36.pyc000064400000041245150335715140010270 0ustar003


 \�O�@s�dZddlZddlZddlZddddddd	d
ddd
dddddddgZeefZdd�ZdCdd�Z	dDdd�Z
dd�Zdd�Zej
dd�Zej
dd�Zdd�Zdd�Zd Zdadad!d	�ZdEd"d
�Zd#d�ZdFd$d�Zdadad%Zd&ZdGd'd(�Zddddd)�d*d�Zddd+d,�d-d�Zd.Z da!da"da#dHd/d
�Z$d0d�Z%d1Z&e&d2d3Z'd4d�Z(d5d�Z)d6d7�Z*d8d�Z+d9d:�Z,d;d�Z-d<d=�Z.d>d?�Z/d@dA�Z0e1dBk�r�e/�dS)IzDBase16, Base32, Base64 (RFC 3548), Base85 and Ascii85 data encodings�N�encode�decode�encodebytes�decodebytes�	b64encode�	b64decode�	b32encode�	b32decode�	b16encode�	b16decode�	b85encode�	b85decode�	a85encode�	a85decode�standard_b64encode�standard_b64decode�urlsafe_b64encode�urlsafe_b64decodecCsxt|t�r2y
|jd�Stk
r0td��YnXt|t�r@|Syt|�j�Stk
rrtd|j	j
�d�YnXdS)N�asciiz4string argument should contain only ASCII charactersz>argument should be a bytes-like object or ASCII string, not %r)�
isinstance�strr�UnicodeEncodeError�
ValueError�bytes_types�
memoryview�tobytes�	TypeError�	__class__�__name__)�s�r �/usr/lib64/python3.6/base64.py�_bytes_from_decode_data"s


r"cCsDtj|dd�}|dk	r@t|�dks.tt|���|jtjd|��S|S)a*Encode the bytes-like object s using Base64 and return a bytes object.

    Optional altchars should be a byte string of length 2 which specifies an
    alternative alphabet for the '+' and '/' characters.  This allows an
    application to e.g. generate url or filesystem safe Base64 strings.
    F)�newlineN�s+/)�binascii�
b2a_base64�len�AssertionError�repr�	translate�bytes�	maketrans)r�altchars�encodedr r r!r3s
FcCsht|�}|dk	rBt|�}t|�dks0tt|���|jtj|d��}|r^tjd|�r^t	j
d��t	j|�S)anDecode the Base64 encoded bytes-like object or ASCII string s.

    Optional altchars must be a bytes-like object or ASCII string of length 2
    which specifies the alternative alphabet used instead of the '+' and '/'
    characters.

    The result is returned as a bytes object.  A binascii.Error is raised if
    s is incorrectly padded.

    If validate is False (the default), characters that are neither in the
    normal base-64 alphabet nor the alternative alphabet are discarded prior
    to the padding check.  If validate is True, these non-alphabet characters
    in the input result in a binascii.Error.
    Nr$s+/s^[A-Za-z0-9+/]*={0,2}$zNon-base64 digit found)r"r'r(r)r*r+r,�re�matchr%�Error�
a2b_base64)rr-Zvalidater r r!rAs
cCst|�S)zrEncode bytes-like object s using the standard Base64 alphabet.

    The result is returned as a bytes object.
    )r)rr r r!rZscCst|�S)aQDecode bytes encoded with the standard Base64 alphabet.

    Argument s is a bytes-like object or ASCII string to decode.  The result
    is returned as a bytes object.  A binascii.Error is raised if the input
    is incorrectly padded.  Characters that are not in the standard alphabet
    are discarded prior to the padding check.
    )r)rr r r!rass+/s-_cCst|�jt�S)z�Encode bytes using the URL- and filesystem-safe Base64 alphabet.

    Argument s is a bytes-like object to encode.  The result is returned as a
    bytes object.  The alphabet uses '-' instead of '+' and '_' instead of
    '/'.
    )rr*�_urlsafe_encode_translation)rr r r!roscCst|�}|jt�}t|�S)a�Decode bytes using the URL- and filesystem-safe Base64 alphabet.

    Argument s is a bytes-like object or ASCII string to decode.  The result
    is returned as a bytes object.  A binascii.Error is raised if the input
    is incorrectly padded.  Characters that are not in the URL-safe base-64
    alphabet, and are not a plus '+' or slash '/', are discarded prior to the
    padding check.

    The alphabet uses '-' instead of '+' and '_' instead of '/'.
    )r"r*�_urlsafe_decode_translationr)rr r r!rxs
s ABCDEFGHIJKLMNOPQRSTUVWXYZ234567csBtdkr,dd�tD���fdd��D�ad�t|t�sBt|�j�}t|�d}|rb|dd|}t�}tj	}t}xjt
dt|�d�D]V}||||d�d�}|||d	?||d
?d@||d?d@||d@7}q�W|d
kr�d|dd�<nF|dk�rd|dd�<n.|dk�r$d|dd�<n|dk�r:d|dd�<t|�S)zKEncode the bytes-like object s using Base32 and return a bytes object.
    NcSsg|]}t|f��qSr )r+)�.0�ir r r!�
<listcomp>�szb32encode.<locals>.<listcomp>csg|]}�D]}||�qqSr r )r5�a�b)�b32tabr r!r7�s��r�big��i��
�s======�r$s====��s===�=i�������������)�_b32tab2�_b32alphabetrrrrr'�	bytearray�int�
from_bytes�ranger+)r�leftoverr.rMZb32tab2r6�cr )r:r!r�s4
*


c

Cs�tdkrdd�tt�D�at|�}t|�dr8tjd��|dk	rvt|�}t|�dks`tt|���|j	t
jdd|��}|r�|j�}t|�}|j
d	�}|t|�}t�}t}x�td
t|�d�D]n}|||d�}d
}	y"x|D]}
|	d>||
}	q�WWn"tk
�rtjd�d�YnX||	jdd
�7}q�W|d�sB|dk�rLtjd��|�r�|�r�|	d|K}	|	jdd
�}dd|d}|d|�|dd�<t
|�S)aZDecode the Base32 encoded bytes-like object or ASCII string s.

    Optional casefold is a flag specifying whether a lowercase alphabet is
    acceptable as input.  For security purposes, the default is False.

    RFC 3548 allows for optional mapping of the digit 0 (zero) to the
    letter O (oh), and for optional mapping of the digit 1 (one) to
    either the letter I (eye) or letter L (el).  The optional argument
    map01 when not None, specifies which letter the digit 1 should be
    mapped to (when map01 is not None, the digit 0 is always mapped to
    the letter O).  For security purposes the default is None, so that
    0 and 1 are not allowed in the input.

    The result is returned as a bytes object.  A binascii.Error is raised if
    the input is incorrectly padded or if there are non-alphabet
    characters present in the input.
    NcSsi|]\}}||�qSr r )r5�k�vr r r!�
<dictcomp>�szb32decode.<locals>.<dictcomp>�zIncorrect paddingrAs01�OrErr;zNon-base32 digit foundr=rDrCrB�+>rrArDrCrB���)�_b32rev�	enumeraterJr"r'r%r1r(r)r*r+r,�upper�rstriprKrN�KeyError�to_bytes)
r�casefoldZmap01�lZpadchars�decodedZb32revr6Zquanta�accrPZlastrOr r r!r	�sB



cCstj|�j�S)zKEncode the bytes-like object s using Base16 and return a bytes object.
    )r%ZhexlifyrZ)rr r r!r
�scCs4t|�}|r|j�}tjd|�r*tjd��tj|�S)a�Decode the Base16 encoded bytes-like object or ASCII string s.

    Optional casefold is a flag specifying whether a lowercase alphabet is
    acceptable as input.  For security purposes, the default is False.

    The result is returned as a bytes object.  A binascii.Error is raised if
    s is incorrectly padded or if there are non-alphabet characters present
    in the input.
    s	[^0-9A-F]zNon-base16 digit found)r"rZr/�searchr%r1Z	unhexlify)rr^r r r!r�s

s<~s~>c	s�t|t�st|�j�}t|�d}|r4|d|}tjdt|�d�j|�}����fdd�|D�}|r�|r�|ddkr��dd	|d<|d
d|�|d<d
j|�S)NrCr<z!%dIcsRg|]J}�r|rdn6�r&|dkr&dn&�|d�|dd�|d�qS)�zi    �yi�^	�Ui9r )r5Zword)�chars�chars2�foldnuls�
foldspacesr r!r7!sz_85encode.<locals>.<listcomp>rArcrr;�rHrHrHrH)	rrrrr'�struct�StructZunpack�join)	r9rfrg�padrhri�paddingZwords�chunksr )rfrgrhrir!�	_85encodes

rq)ri�wrapcolrn�adobecs�tdkr*dd�tdd�D�add�tD�at|tt|d|��|rHt���r�t|rVdnd	�����fd
d�tdt����D�}|r�t|d�d�kr�|jd�d
j|��|r��t	7��S)a�Encode bytes-like object b using Ascii85 and return a bytes object.

    foldspaces is an optional flag that uses the special short sequence 'y'
    instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This
    feature is not supported by the "standard" Adobe encoding.

    wrapcol controls whether the output should have newline (b'\n') characters
    added to it. If this is non-zero, each output line will be at most this
    many characters long.

    pad controls whether the input is padded to a multiple of 4 before
    encoding. Note that the btoa implementation always pads.

    adobe controls whether the encoded byte sequence is framed with <~ and ~>,
    which is used by the Adobe implementation.
    NcSsg|]}t|f��qSr )r+)r5r6r r r!r7Dsza85encode.<locals>.<listcomp>�!�vcSsg|]}tD]}||�qqSr )�	_a85chars)r5r8r9r r r!r7EsTr$rAcsg|]}�||���qSr r )r5r6)�resultrrr r!r7Msrrj�
rH)
rvrN�
_a85chars2rq�	_A85START�maxr'�appendrm�_A85END)r9rirrrnrsrpr )rwrrr!r/s"

s 	

)rirs�ignorecharscCs�t|�}|rH|jt�s$tdjt���|jt�r<|dd�}n|dd�}tjd�j	}g}|j
}g}|j
}|j}	�x|dD�]�}
d|
ko�dkn�r||
�t|�d	k�rrd}x|D]}
d
||
d}q�Wy|||��Wn"tj
k
�rtd�d�YnX|	�qz|
dk�r0|�r&td��|d�qz|�rX|
dk�rX|�rNtd��|d�qz|
|k�rfqzqztd|
��qzWdj|�}dt|�}
|
�r�|d|
�}|S)a�Decode the Ascii85 encoded bytes-like object or ASCII string b.

    foldspaces is a flag that specifies whether the 'y' short sequence should be
    accepted as shorthand for 4 consecutive spaces (ASCII 0x20). This feature is
    not supported by the "standard" Adobe encoding.

    adobe controls whether the input sequence is in Adobe Ascii85 format (i.e.
    is framed with <~ and ~>).

    ignorechars should be a byte string containing characters to ignore from the
    input. This should only contain whitespace characters, and by default
    contains all whitespace characters in ASCII.

    The result is returned as a bytes object.
    z1Ascii85 encoded byte sequences must end with {!r}r$Nz!I�urC�!rr;rertzAscii85 overflowrczz inside Ascii85 5-tuplesrdzy inside Ascii85 5-tuples    zNon-Ascii85 digit found: %crj���r�suuuurt�u�z�y)r"�endswithr}r�format�
startswithrzrkrl�packr|�clearr'�errorrm)r9rirsr~�packIr`Zdecoded_appendZcurrZcurr_appendZ
curr_clear�xrarwror r r!rXsV







sU0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~cCs2tdkr$dd�tD�add�tD�at|tt|�S)z�Encode bytes-like object b in base85 format and return a bytes object.

    If pad is true, the input is padded with b'\0' so its length is a multiple of
    4 bytes before encoding.
    NcSsg|]}t|f��qSr )r+)r5r6r r r!r7�szb85encode.<locals>.<listcomp>cSsg|]}tD]}||�qqSr )�	_b85chars)r5r8r9r r r!r7�s)r��_b85alphabet�
_b85chars2rq)r9rnr r r!r�s	c
CsZtdkr0dgdaxtt�D]\}}|t|<qWt|�}t|�d}|d|}g}tjd�j}x�tdt|�d�D]�}|||d�}d}y"x|D]}|dt|}q�WWnJt	k
r�x2t|�D]&\}}t|dkr�t
d||�d�q�W�YnXy|j||��Wqttjk
�r2t
d	|�d�YqtXqtWd
j
|�}	|�rV|	d|�}	|	S)zqDecode the base85-encoded bytes-like object or ASCII string b

    The result is returned as a bytes object.
    N�r;�~z!Irrez#bad base85 character at position %dz+base85 overflow in hunk starting at byte %drj)�_b85decrYr�r"r'rkrlr�rNrrr|r�rm)
r9r6rPro�outr��chunkra�jrwr r r!r
�s<


�LrCrDcCs`xZ|jt�}|sPx0t|�tkrB|jtt|��}|s8P||7}qWtj|�}|j|�qWdS)z1Encode a file; input and output are binary files.N)�read�
MAXBINSIZEr'r%r&�write)�input�outputr�ns�liner r r!r�s

cCs,x&|j�}|sPtj|�}|j|�qWdS)z1Decode a file; input and output are binary files.N)�readliner%r2r�)r�r�r�rr r r!r�s
cCs�yt|�}Wn8tk
rD}zd|jj}t|�|�WYdd}~XnX|jdkrjd|j|jjf}t|��|jdkr�d|j|jjf}t|��dS)	Nz"expected bytes-like object, not %srPr9�Bz-expected single byte elements, not %r from %srAz(expected 1-D data, not %d-D data from %s)rPr9r�)rrrrr��ndim)r�m�err�msgr r r!�_input_type_check�s

r�cCsPt|�g}x8tdt|�t�D]$}|||t�}|jtj|��qWdj|�S)zVEncode a bytestring into a bytes object containing multiple lines
    of base-64 data.rrj)r�rNr'r�r|r%r&rm)r�piecesr6r�r r r!rscCsddl}|jdtd�t|�S)zLegacy alias of encodebytes().rNzAencodestring() is a deprecated alias since 3.1, use encodebytes()r$)�warnings�warn�DeprecationWarningr)rr�r r r!�encodestringsr�cCst|�tj|�S)z8Decode a bytestring of base-64 data into a bytes object.)r�r%r2)rr r r!rscCsddl}|jdtd�t|�S)zLegacy alias of decodebytes().rNzHdecodestring() is a deprecated alias since Python 3.1, use decodebytes()r$)r�r�r�r)rr�r r r!�decodestring$sr�c	Csddl}ddl}y|j|jdd�d�\}}WnP|jk
r~}z2|j|_t|�td|jd�|jd�WYdd}~XnXt}xF|D]>\}}|dkr�t}|dkr�t	}|d	kr�t	}|d
kr�t
�dSq�W|o�|ddk�rt|dd��}|||jj�WdQRXn||j
j|jj�dS)
zSmall main programrNrAZdeutz�usage: %s [-d|-e|-u|-t] [file|-]
        -d, -u: decode
        -e: encode (default)
        -t: encode and decode string 'Aladdin:open sesame'r$z-ez-dz-uz-t�-�rb)�sys�getopt�argvr��stderr�stdout�print�exitrr�test�open�buffer�stdin)	r�r�Zopts�argsr��func�or8�fr r r!�main.s0r�cCsHd}tt|��t|�}tt|��t|�}tt|��||ksDt�dS)NsAladdin:open sesame)r�r)rrr()Zs0�s1�s2r r r!r�Hsr��__main__)N)NF)FN)F)FFF)F)2�__doc__r/rkr%�__all__r+rKrr"rrrrr,r3r4rrrJrIrXrr	r
rrvryrzr}rqrrr�r�r�r�rr
ZMAXLINESIZEr�rrr�rr�rr�r�r�rr r r r!�<module>sh

	&
C

)H
-	
	


bdb.cpython-36.pyc000064400000041213150335715140007726 0ustar003


 \\�@s�dZddlZddlZddlZddlmZmZmZdddgZeeBeBZ	Gdd�de
�ZGdd�d�Zd	d
�Z
Gdd�d�Zdd
�Zdd�ZGdd�de�Zdd�Zdd�Zdd�ZdS)zDebugger basics�N)�CO_GENERATOR�CO_COROUTINE�CO_ASYNC_GENERATOR�BdbQuit�Bdb�
Breakpointc@seZdZdZdS)rz Exception to give up completely.N)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.6/bdb.pyr
sc@speZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd[d&d'�Zd\d(d)�Zd*d+�Zd,d-�Zd.d/�Zd]d0d1�Zd2d3�Zd4d5�Zd^d7d8�Zd9d:�Zd;d<�Zd=d>�Z d?d@�Z!dAdB�Z"dCdD�Z#dEdF�Z$dGdH�Z%dIdJ�Z&dKdL�Z'dMdN�Z(d_dPdQ�Z)d`dRdS�Z*dadTdU�Z+dVdW�Z,dXdY�Z-dS)brz�Generic Python debugger base class.

    This class takes care of details of the trace facility;
    a derived class should implement user interaction.
    The standard debugger class (pdb.Pdb) is an example.
    NcCs(|rt|�nd|_i|_i|_d|_dS)N)�set�skip�breaks�fncache�frame_returning)�selfrrrr
�__init__szBdb.__init__cCsR|d|dd�dkr|S|jj|�}|sNtjj|�}tjj|�}||j|<|S)N�<��>���)r�get�os�path�abspath�normcase)r�filename�canonicrrr
rs
zBdb.canoniccCs&ddl}|j�d|_|jdd�dS)Nr)�	linecache�
checkcache�botframe�
_set_stopinfo)rr rrr
�reset)sz	Bdb.resetcCs�|jr
dS|dkr|j|�S|dkr0|j||�S|dkrD|j||�S|dkrX|j||�S|dkrf|jS|dkrt|jS|dkr�|jStdt|��|jS)	N�lineZcall�returnZ	exceptionZc_callZc_exceptionZc_returnz*bdb.Bdb.dispatch: unknown debugging event:)�quitting�
dispatch_line�
dispatch_call�dispatch_return�dispatch_exception�trace_dispatch�print�repr)r�frameZevent�argrrr
r,/s$
zBdb.trace_dispatchcCs.|j|�s|j|�r(|j|�|jr(t�|jS)N)�	stop_here�
break_here�	user_liner'rr,)rr/rrr
r(Cs

zBdb.dispatch_linecCsd|jdkr|j|_|jS|j|�p*|j|�s0dS|jrH|jjt@rH|jS|j	||�|j
r^t�|jS)N)r"�f_backr,r1�break_anywhere�	stopframe�f_code�co_flags�GENERATOR_AND_COROUTINE_FLAGS�	user_callr'r)rr/r0rrr
r)Is
zBdb.dispatch_callcCs||j|�s||jkrv|jr,|jjt@r,|jSz||_|j||�Wdd|_X|j	rVt
�|j|krv|jdkrv|jdd�|jS)Nrr)
r1�returnframer6r7r8r9r,r�user_returnr'r�
stoplinenor#)rr/r0rrr
r*YszBdb.dispatch_returncCs�|j|�rF|jjt@o,|dtko,|ddks�|j||�|jr�t�nD|jr�||jk	r�|jjjt@r�|dtt	fkr�|j||�|jr�t�|j
S)Nr�)r1r7r8r9�
StopIteration�user_exceptionr'rr6�
GeneratorExitr,)rr/r0rrr
r+is
zBdb.dispatch_exceptioncCs$x|jD]}tj||�rdSqWdS)NTF)r�fnmatch)rZmodule_name�patternrrr
�is_skipped_module�szBdb.is_skipped_modulecCsN|jr|j|jjd��rdS||jkr@|jdkr4dS|j|jkS|jsJdSdS)NrFrTr)rrD�	f_globalsrr6r=�f_lineno)rr/rrr
r1�s

z
Bdb.stop_herecCs�|j|jj�}||jkrdS|j}||j|krJ|jj}||j|krJdSt|||�\}}|r�|j|_|r�|j	r�|j
t|j��dSdSdS)NFT)rr7�co_filenamerrF�co_firstlineno�	effective�numberZ	currentbp�	temporary�do_clear�str)rr/r�lineno�bp�flagrrr
r2�s

zBdb.break_herecCstd��dS)Nz)subclass of bdb must implement do_clear())�NotImplementedError)rr0rrr
rL�szBdb.do_clearcCs|j|jj�|jkS)N)rr7rGr)rr/rrr
r5�szBdb.break_anywherecCsdS)znThis method is called when there is the remote possibility
        that we ever need to stop in this function.Nr)rr/Z
argument_listrrr
r:�sz
Bdb.user_callcCsdS)z9This method is called when we stop or break at this line.Nr)rr/rrr
r3�sz
Bdb.user_linecCsdS)z5This method is called when a return trap is set here.Nr)rr/Zreturn_valuerrr
r<�szBdb.user_returncCsdS)zmThis method is called if an exception occurs,
        but only if we are to stop at or just below this level.Nr)rr/�exc_inforrr
r@�szBdb.user_exceptionrcCs||_||_d|_||_dS)NF)r6r;r'r=)rr6r;r=rrr
r#�szBdb._set_stopinfocCs$|dkr|jd}|j|||�dS)zxStop when the line with the line no greater than the current one is
        reached or when returning from current frameNr)rFr#)rr/rNrrr
�	set_until�s
z
Bdb.set_untilcCs2|jr"|jj}|r"|jr"|j|_|jdd�dS)zStop after one line of code.N)rr4�f_tracer,r#)rZcaller_framerrr
�set_step�s
zBdb.set_stepcCs|j|d�dS)z2Stop on the next line in or below the given frame.N)r#)rr/rrr
�set_next�szBdb.set_nextcCs.|jjt@r|j|dd�n|j|j|�dS)z)Stop when returning from the given frame.Nrr)r7r8r9r#r4)rr/rrr
�
set_return�szBdb.set_returncCsP|dkrtj�j}|j�x|r6|j|_||_|j}qW|j�tj|j�dS)zpStart debugging from `frame`.

        If frame is not specified, debugging starts from caller's frame.
        N)	�sys�	_getframer4r$r,rTr"rU�settrace)rr/rrr
�	set_trace�s

z
Bdb.set_tracecCsL|j|jdd�|jsHtjd�tj�j}x|rF||jk	rF|`|j}q,WdS)Nrr)r#r"rrXrZrYr4rT)rr/rrr
�set_continues

zBdb.set_continuecCs"|j|_d|_d|_tjd�dS)NT)r"r6r;r'rXrZ)rrrr
�set_quitszBdb.set_quitFc
Csb|j|�}ddl}|j||�}|s.d||fS|jj|g�}||krN|j|�t|||||�}	dS)NrzLine %s:%d does not exist)rr �getliner�
setdefault�appendr)
rrrNrK�cond�funcnamer r%�listrOrrr
�	set_breaks

z
Bdb.set_breakcCs4||ftjkr|j|j|�|j|s0|j|=dS)N)r�bplistr�remove)rrrNrrr
�
_prune_breaks$s
zBdb._prune_breakscCsn|j|�}||jkrd|S||j|kr6d||fSx&tj||fdd�D]}|j�qNW|j||�dS)NzThere are no breakpoints in %szThere is no breakpoint at %s:%d)rrrre�deleteMerg)rrrNrOrrr
�clear_break*s

zBdb.clear_breakcCsPy|j|�}Wn$tk
r2}zt|�Sd}~XnX|j�|j|j|j�dS)N)�get_bpbynumber�
ValueErrorrMrhrg�filer%)rr0rO�errrrr
�clear_bpbynumber6szBdb.clear_bpbynumbercCs`|j|�}||jkrd|Sx6|j|D](}tj||f}x|D]}|j�q@Wq(W|j|=dS)NzThere are no breakpoints in %s)rrrrerh)rrr%ZblistrOrrr
�clear_all_file_breaks>s


zBdb.clear_all_file_breakscCs0|js
dSxtjD]}|r|j�qWi|_dS)NzThere are no breakpoints)rr�
bpbynumberrh)rrOrrr
�clear_all_breaksHszBdb.clear_all_breakscCs�|std��yt|�}Wn tk
r8td|��YnXytj|}Wn tk
rhtd|��YnX|dkr~td|��|S)NzBreakpoint number expectedz Non-numeric breakpoint number %sz!Breakpoint number %d out of rangezBreakpoint %d already deleted)rk�intrrp�
IndexError)rr0rJrOrrr
rjPszBdb.get_bpbynumbercCs"|j|�}||jko ||j|kS)N)rr)rrrNrrr
�	get_break_s

z
Bdb.get_breakcCs4|j|�}||jkr0||j|kr0tj||fp2gS)N)rrrre)rrrNrrr
�
get_breaksds

zBdb.get_breakscCs&|j|�}||jkr|j|SgSdS)N)rr)rrrrr
�get_file_breaksjs


zBdb.get_file_breakscCs|jS)N)r)rrrr
�get_all_breaksqszBdb.get_all_breakscCs�g}|r|j|kr|j}x.|dk	rF|j||jf�||jkr>P|j}qW|j�tdt|�d�}x$|dk	r�|j|j|j	f�|j}qdW|dkr�tdt|�d�}||fS)Nrr)
�tb_frame�tb_nextr`rFr"r4�reverse�max�len�	tb_lineno)r�f�t�stack�irrr
�	get_stackws 




z
Bdb.get_stack�: cCs�ddl}ddl}|\}}|j|jj�}d||f}|jjrH||jj7}n|d7}d|jkrf|jd}	nd}	|	r~||j|	�7}n|d7}d|jkr�|jd}
|d7}||j|
�7}|j|||j	�}|r�|||j
�7}|S)Nrz%s(%r)z<lambda>Z__args__z()Z
__return__z->)r �reprlibrr7rG�co_name�f_localsr.r^rE�strip)rZframe_linenoZlprefixr r�r/rNr�s�args�rvr%rrr
�format_stack_entry�s*


zBdb.format_stack_entrycCs�|dkrddl}|j}|dkr"|}|j�t|t�r@t|dd�}tj|j�z*yt	|||�Wnt
k
rrYnXWdd|_tjd�XdS)Nrz<string>�execT)�__main__�__dict__r$�
isinstancerM�compilerXrZr,r�rr')r�cmd�globals�localsr�rrr
�run�s

zBdb.runcCst|dkrddl}|j}|dkr"|}|j�tj|j�z&yt|||�Stk
rXYnXWdd|_tjd�XdS)NrT)	r�r�r$rXrZr,�evalrr')r�exprr�r�r�rrr
�runeval�s
zBdb.runevalcCs|j|||�dS)N)r�)rr�r�r�rrr
�runctx�sz
Bdb.runctxcOsX|j�tj|j�d}z(y|||�}Wntk
r<YnXWdd|_tjd�X|S)NT)r$rXrZr,rr')r�funcr��kwds�resrrr
�runcall�s
zBdb.runcall)N)r)N)N)FNN)r�)NN)NN).rr	r
rrrr$r,r(r)r*r+rDr1r2rLr5r:r3r<r@r#rSrUrVrWr[r\r]rdrgrirnrorqrjrtrurvrwr�r�r�r�r�r�rrrr
rsX










cCst�j�dS)N)rr[rrrr
r[�sr[c@sZeZdZdZdZiZdgZddd�Zdd�Zd	d
�Z	dd�Z
dd
d�Zdd�Zdd�Z
dS)ra�Breakpoint class.

    Implements temporary breakpoints, ignore counts, disabling and
    (re)-enabling, and conditionals.

    Breakpoints are indexed by number through bpbynumber and by
    the file,line tuple using bplist.  The former points to a
    single instance of class Breakpoint.  The latter points to a
    list of such instances since there may be more than one
    breakpoint per line.

    rNFcCs�||_d|_||_||_||_||_d|_d|_d|_t	j
|_t	j
d7_
|jj
|�||f|jkr||j||fj
|�n|g|j||f<dS)NTrr)rb�func_first_executable_linerlr%rKra�enabled�ignore�hitsr�nextrJrpr`re)rrlr%rKrarbrrr
r�szBreakpoint.__init__cCs>|j|jf}d|j|j<|j|j|�|j|s:|j|=dS)N)rlr%rprJrerf)r�indexrrr
rhs

zBreakpoint.deleteMecCs
d|_dS)NT)r�)rrrr
�enableszBreakpoint.enablecCs
d|_dS)NF)r�)rrrr
�disableszBreakpoint.disablecCs"|dkrtj}t|j�|d�dS)N)rl)rX�stdoutr-�bpformat)r�outrrr
�bpprintszBreakpoint.bpprintcCs�|jrd}nd}|jr |d}n|d}d|j||j|jf}|jrT|d|jf7}|jrj|d|jf7}|jr�|jdkr�d	}nd
}|d|j|f7}|S)Nzdel  zkeep zyes  zno   z%-4dbreakpoint   %s at %s:%dz
	stop only if %sz
	ignore next %d hitsrr��z"
	breakpoint already hit %d time%s)rKr�rJrlr%rar�r�)rZdispZretZssrrr
r�s$

zBreakpoint.bpformatcCsd|j|j|jfS)Nzbreakpoint %s at %s:%s)rJrlr%)rrrr
�__str__6szBreakpoint.__str__)FNN)N)rr	r
rr�rerprrhr�r�r�r�r�rrrr
r�s

cCsN|js|j|jkrdSdS|jj|jkr,dS|js:|j|_|j|jkrJdSdS)z;Check whether we should break here because of `b.funcname`.FT)rbr%rFr7r�r�)�br/rrr
�
checkfuncname;sr�cCs�tj||f}x�|D]�}|js qt||�s,q|jd7_|jsf|jdkr\|jd8_qq�|dfSqy<t|j|j|j	�}|r�|jdkr�|jd8_n|dfSWq|dfSqWdS)z�Determine which breakpoint for this file:line is to be acted upon.

    Called only if we know there is a bpt at this
    location.  Returns breakpoint that was triggered and a flag
    that indicates if it is ok to delete a temporary bp.

    rrTFN)NN)
rrer�r�r�rar�r�rEr�)rlr%r/Z	possiblesr��valrrr
rIWs*




rIc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TdbcCs |jj}|sd}td||�dS)Nz???z+++ call)r7r�r-)rr/r��namerrr
r:�sz
Tdb.user_callcCsTddl}|jj}|sd}|j|jj�}|j||j|j�}td||j|d|j	��dS)Nrz???z+++�:)
r r7r�rrGr^rFrEr-r�)rr/r r��fnr%rrr
r3�sz
Tdb.user_linecCstd|�dS)Nz
+++ return)r-)rr/Zretvalrrr
r<�szTdb.user_returncCstd|�|j�dS)Nz
+++ exception)r-r\)rr/Z	exc_stuffrrr
r@�s
zTdb.user_exceptionN)rr	r
r:r3r<r@rrrr
r��sr�cCs&td|d�t|d�}td|�dS)Nzfoo(�)�
zbar returned)r-�bar)�n�xrrr
�foo�sr�cCstd|d�|dS)Nzbar(r�r>)r-)�arrr
r��sr�cCst�}|jd�dS)Nzimport bdb; bdb.foo(10))r�r�)rrrr
�test�sr�)rrBrXr�inspectrrr�__all__r9�	Exceptionrrr[rr�rIr�r�r�r�rrrr
�<module>s&
OZ0optparse.cpython-36.opt-2.pyc000064400000105461150335715140012002 0ustar003


 \���@s�dZddddddddd	d
ddd
ddddgZdZddlZddlZddlZdd�ZyddlmZmZWn$e	k
r�dd�Zdd�ZYnXeZ
Gdd�de�ZGdd
�d
e�Z
Gdd�de
�ZGdd�de�ZGd d�de�ZGd!d"�d"e�ZGd#d	�d	�ZGd$d
�d
e�ZGd%d�de�Zd&d'�Zd(d)�Zee
d*�fee
d*�fee
d+�fee
d,�fd-�Zd.d/�Zd0d�Zd=ZGd3d�d�Zd>Zd?ZGd7d�d�Z Gd8d�d�Z!Gd9d�de!�Z"Gd:d�de!�Z#d;d<�Z$eZ%dS)@z1.5.3�Option�make_option�
SUPPRESS_HELP�SUPPRESS_USAGE�Values�OptionContainer�OptionGroup�OptionParser�
HelpFormatter�IndentedHelpFormatter�TitledHelpFormatter�
OptParseError�OptionError�OptionConflictError�OptionValueError�BadOptionError�check_choicea"
Copyright (c) 2001-2006 Gregory P. Ward.  All rights reserved.
Copyright (c) 2002-2006 Python Software Foundation.  All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

  * Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.

  * Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.

  * Neither the name of the author nor the names of its
    contributors may be used to endorse or promote products derived from
    this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
�NcCsd|jjt|�|fS)Nz<%s at 0x%x: %s>)�	__class__�__name__�id)�self�r� /usr/lib64/python3.6/optparse.py�_reprOsr)�gettext�ngettextcCs|S)Nr)�messagerrrr\srcCs|dkr|S|S)N�r)ZsingularZplural�nrrrr_src@seZdZdd�Zdd�ZdS)rcCs
||_dS)N)�msg)rrrrr�__init__hszOptParseError.__init__cCs|jS)N)r)rrrr�__str__kszOptParseError.__str__N)r�
__module__�__qualname__r r!rrrrrgsc@seZdZdd�Zdd�ZdS)r
cCs||_t|�|_dS)N)r�str�	option_id)rr�optionrrrr uszOptionError.__init__cCs |jrd|j|jfS|jSdS)Nz
option %s: %s)r%r)rrrrr!yszOptionError.__str__N)rr"r#r r!rrrrr
osc@seZdZdS)rN)rr"r#rrrrrsc@seZdZdS)rN)rr"r#rrrrr�sc@seZdZdd�Zdd�ZdS)rcCs
||_dS)N)�opt_str)rr'rrrr �szBadOptionError.__init__cCstd�|jS)Nzno such option: %s)�_r')rrrrr!�szBadOptionError.__str__N)rr"r#r r!rrrrr�sc@seZdZdd�Zdd�ZdS)�AmbiguousOptionErrorcCstj||�||_dS)N)rr �
possibilities)rr'r*rrrr �szAmbiguousOptionError.__init__cCstd�|jdj|j�fS)Nzambiguous option: %s (%s?)z, )r(r'�joinr*)rrrrr!�szAmbiguousOptionError.__str__N)rr"r#r r!rrrrr)�sr)c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd S)!r	ZnonecCs�d|_||_|dkrLyttjd�}Wnttfk
rBd}YnX|d8}||_t|t	|d|d��|_
|_d|_d|_
d|_||_d|_i|_d|_d|_dS)	NZCOLUMNS�P��rz%defaultz%s %sz%s=%s)�parser�indent_increment�int�os�environ�KeyError�
ValueError�width�min�max�
help_position�max_help_position�current_indent�level�
help_width�short_first�default_tag�option_strings�_short_opt_fmt�
_long_opt_fmt)rr0r:r6r>rrrr �s$
 zHelpFormatter.__init__cCs
||_dS)N)r/)rr/rrr�
set_parser�szHelpFormatter.set_parsercCs&|dkrtd|��d|d|_dS)N�� z/invalid metavar delimiter for short options: %rz%s)rDrE)r5rA)r�delimrrr�set_short_opt_delimiter�s
z%HelpFormatter.set_short_opt_delimitercCs&|dkrtd|��d|d|_dS)N�=rEz.invalid metavar delimiter for long options: %rz%s)rHrE)r5rB)rrFrrr�set_long_opt_delimiter�s
z$HelpFormatter.set_long_opt_delimitercCs"|j|j7_|jd7_dS)Nr)r;r0r<)rrrr�indent�szHelpFormatter.indentcCs"|j|j8_|jd8_dS)Nr)r;r0r<)rrrr�dedent�szHelpFormatter.dedentcCstd��dS)Nzsubclasses must implement)�NotImplementedError)r�usagerrr�format_usage�szHelpFormatter.format_usagecCstd��dS)Nzsubclasses must implement)rL)r�headingrrr�format_headingszHelpFormatter.format_headingcCs.t|j|jd�}d|j}tj||||d�S)N�rE)Zinitial_indentZsubsequent_indent)r8r6r;�textwrapZfill)r�textZ
text_widthrJrrr�_format_texts
zHelpFormatter._format_textcCs|r|j|�dSdSdS)N�
rD)rT)r�descriptionrrr�format_descriptionsz HelpFormatter.format_descriptioncCs|rd|j|�dSdSdS)NrUrD)rT)r�epilogrrr�
format_epilogszHelpFormatter.format_epilogcCsR|jdks|jr|jS|jjj|j�}|tks8|dkr>|j}|jj|jt	|��S)N)
r/r?�help�defaults�get�dest�
NO_DEFAULT�NO_DEFAULT_VALUE�replacer$)rr&Z
default_valuerrr�expand_defaultszHelpFormatter.expand_defaultcs�g}�j|}�j�jd}t|�|krBd�jd|f}�j}nd�jd||f}d}|j|�|jr��j|�}tj|�j	�}|jd|d|df�|j
�fdd�|dd�D��n|d
d	kr�|jd	�dj|�S)Nr-z%*s%s
rDz	%*s%-*s  rcsg|]}d�jd|f�qS)z%*s%s
rD)r9)�.0�line)rrr�
<listcomp>Esz/HelpFormatter.format_option.<locals>.<listcomp>rrU���)r@r9r;�len�appendrZrarRZwrapr=�extendr+)rr&�result�optsZ	opt_widthZindent_firstZ	help_textZ
help_linesr)rr�
format_option(s$



zHelpFormatter.format_optioncCs�|j�d}x6|jD],}|j|�}||j|<t|t|�|j�}qW|j�xF|jD]<}x6|jD],}|j|�}||j|<t|t|�|j�}q`WqTW|j�|j�t	|d|j
�|_t|j|jd�|_
dS)Nrr-rQ)rJ�option_list�format_option_stringsr@r8rfr;�
option_groupsrKr7r:r9r6r=)rr/Zmax_len�optZstrings�grouprrr�store_option_stringsKs 



z"HelpFormatter.store_option_stringscst|j�rF|jp|jj����fdd�|jD�}��fdd�|jD�}n|j}|j}�jrb||}n||}dj|�S)Ncsg|]}�j|�f�qSr)rA)rbZsopt)�metavarrrrrdasz7HelpFormatter.format_option_strings.<locals>.<listcomp>csg|]}�j|�f�qSr)rB)rbZlopt)rrrrrrdcsz, )�takes_valuerrr]�upper�_short_opts�
_long_optsr>r+)rr&Z
short_optsZ	long_optsrjr)rrrrrm]s

z#HelpFormatter.format_option_stringsN)rr"r#r_r rCrGrIrJrKrNrPrTrWrYrarkrqrmrrrrr	�s +
#c@s&eZdZddd�Zdd�Zd	d
�ZdS)r
r-�NrcCstj|||||�dS)N)r	r )rr0r:r6r>rrrr tszIndentedHelpFormatter.__init__cCstd�|S)Nz
Usage: %s
)r()rrMrrrrN|sz"IndentedHelpFormatter.format_usagecCsd|jd|fS)Nz%*s%s:
rD)r;)rrOrrrrPsz$IndentedHelpFormatter.format_heading)r-rwNr)rr"r#r rNrPrrrrr
ps
c@s&eZdZd
dd�Zdd�Zdd	�ZdS)rrrwNcCstj|||||�dS)N)r	r )rr0r:r6r>rrrr �szTitledHelpFormatter.__init__cCsd|jtd��|fS)Nz%s  %s
ZUsage)rPr()rrMrrrrN�sz TitledHelpFormatter.format_usagecCsd|d|jt|�fS)Nz%s
%s
z=-)r<rf)rrOrrrrP�sz"TitledHelpFormatter.format_heading)rrwNr)rr"r#r rNrPrrrrr�s
cCsh|dd�j�dkrd}nD|dd�j�dkrDd}|dd�p@d}n|dd�dkrZd}nd}|||�S)	Nr-Z0x�Z0b�0r��
)�lower)�val�type�radixrrr�
_parse_num�sr�cCs
t|t�S)N)r�r1)r}rrr�
_parse_int�sr�Zintegerzfloating-point�complex)r1�long�floatr�cCsFt|j\}}y||�Stk
r@ttd�|||f��YnXdS)Nzoption %s: invalid %s value: %r)�_builtin_cvtr~r5rr()r&ro�valueZcvtZwhatrrr�
check_builtin�sr�cCs:||jkr|Sdjtt|j��}ttd�|||f��dS)Nz, z.option %s: invalid choice: %r (choose from %s))�choicesr+�map�reprrr()r&ror�r�rrrr�s
�NO�DEFAULTc@s�eZdZddddddddd	d
ddgZdAZdBZdCZdDZdEZdFZ	e
e
e
e
ed�ZdZ
dd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�ZeeeeeeegZ
d3d4�ZeZd5d6�Zd7d8�Zd9d:�Zd;d<�Zd=d>�Z d?d@�Z!dS)Gr�actionr~r]�default�nargs�constr��callback�
callback_args�callback_kwargsrZrr�store�store_const�
store_true�store_falserg�append_const�count�version�stringr1r�r�r��choice)r1r�r�r�r�NcOsFg|_g|_|j|�}|j|�|j|�x|jD]}||�q2WdS)N)rurv�_check_opt_strings�_set_opt_strings�
_set_attrs�
CHECK_METHODS)rrj�attrs�checkerrrrr 4s


zOption.__init__cCsdd�|D�}|std��|S)NcSsg|]}|r|�qSrr)rbrorrrrdKsz-Option._check_opt_strings.<locals>.<listcomp>z+at least one option string must be supplied)�	TypeError)rrjrrrr�GszOption._check_opt_stringscCs�x�|D]�}t|�dkr&td||��qt|�dkrf|ddkoH|ddksXtd||��|jj|�q|dd�dko�|ddks�td||��|jj|�qWdS)	Nr-z>invalid option string %r: must be at least two characters longr�-rzMinvalid short option string %r: must be of the form -x, (x any non-dash char)z--zGinvalid long option string %r: must start with --, followed by non-dash)rfr
rurgrv)rrjrorrrr�Ps$
zOption._set_opt_stringscCszxP|jD]F}||kr,t||||�||=q|dkrBt||t�qt||d�qW|rvt|j��}tddj|�|��dS)Nr�zinvalid keyword arguments: %sz, )�ATTRS�setattrr^�sorted�keysr
r+)rr��attrrrrr�eszOption._set_attrscCs2|jdkrd|_n|j|jkr.td|j|��dS)Nr�zinvalid action: %r)r��ACTIONSr
)rrrr�
_check_actionxs
zOption._check_actioncCs�|jdkr0|j|jkr�|jdk	r(d|_q�d|_n^t|jt�rF|jj|_|jdkrVd|_|j|jkrrtd|j|��|j|jkr�td|j|��dS)Nr�r�r$zinvalid option type: %rz$must not supply a type for action %r)	r~r��ALWAYS_TYPED_ACTIONSr��
isinstancer�TYPESr
�
TYPED_ACTIONS)rrrr�_check_type~s



zOption._check_typecCsr|jdkrT|jdkr td|��qnt|jttf�sntdtt|j��jd�d|��n|jdk	rntd|j|��dS)Nr�z/must supply a list of choices for type 'choice'z1choices must be a list of strings ('%s' supplied)�'rz#must not supply choices for type %r)r~r�r
r��tuple�listr$�split)rrrr�
_check_choice�s


 
zOption._check_choicecCs\|j|jkp|jdk	}|jdkrX|rX|jrH|jddd�jdd�|_n|jdd|_dS)Nrr-r�r(r)r��
STORE_ACTIONSr~r]rvr`ru)rrsrrr�_check_dest�s
zOption._check_destcCs*|j|jkr&|jdk	r&td|j|��dS)Nz*'const' must not be supplied for action %r)r��
CONST_ACTIONSr�r
)rrrr�_check_const�szOption._check_constcCs<|j|jkr|jdkr8d|_n|jdk	r8td|j|��dS)Nrz*'nargs' must not be supplied for action %r)r�r�r�r
)rrrr�_check_nargs�s

zOption._check_nargscCs�|jdkrvt|j�s$td|j|��|jdk	rLt|jt�rLtd|j|��|jdk	r�t|jt�r�td|j|��nB|jdk	r�td|j|��|jdk	r�td|��|jdk	r�td|��dS)Nr�zcallback not callable: %rz3callback_args, if supplied, must be a tuple: not %rz4callback_kwargs, if supplied, must be a dict: not %rz.callback supplied (%r) for non-callback optionz.callback_args supplied for non-callback optionz0callback_kwargs supplied for non-callback option)	r��callabler�r
r�r�r�r��dict)rrrr�_check_callback�s0






zOption._check_callbackcCsdj|j|j�S)N�/)r+rurv)rrrrr!�szOption.__str__cCs
|jdk	S)N)r~)rrrrrs�szOption.takes_valuecCs|jr|jdS|jdSdS)Nr)rvru)rrrr�get_opt_string�s
zOption.get_opt_stringcCs*|jj|j�}|dkr|S||||�SdS)N)�TYPE_CHECKERr\r~)rror�r�rrr�check_value�szOption.check_valuecs:|dk	r6�jdkr�j�|�St��fdd�|D��SdS)Nrcsg|]}�j�|��qSr)r�)rb�v)rorrrrdsz(Option.convert_value.<locals>.<listcomp>)r�r�r�)rror�r)rorr�
convert_values
zOption.convert_valuecCs$|j||�}|j|j|j||||�S)N)r��take_actionr�r])rror��valuesr/rrr�processszOption.processc	Cs:|dkrt|||��n|dkr2t|||j��n|dkrHt||d�n�|dkr^t||d�n�|dkrz|j|g�j|�n�|dkr�|j|g�j|j�n�|d	kr�t|||j|d
�d�n||dkr�|jp�f}|jp�i}|j||||f|�|�nF|d
k�r|j�|j�n*|dk�r(|j	�|j�nt
d|j��dS)Nr�r�r�Tr�Frgr�r�rrr�rZr�zunknown action %r)r�r��ensure_valuergr�r�r��
print_help�exit�
print_versionr5r�)	rr�r]ror�r�r/�args�kwargsrrrr�s4





zOption.take_action)
r�r�r�r�rgr�r�r�rZr�)r�r�r�r�rgr�r�)r�rgr�)r�rg)r�r�)r�r1r�r�r�r�)"rr"r#r�r�r�r�r�r�r�r�rr�r�r r�r�r�r�r�r�r�r�r�r�r!r�__repr__rsr�r�r�r�r�rrrrr�s�	
		ZSUPPRESSZHELPZUSAGEc@s^eZdZddd�Zdd�ZeZdd�Zdd	�Zd
d�Z	dd
�Z
ddd�Zddd�Zdd�Z
dS)rNcCs*|r&x |j�D]\}}t|||�qWdS)N)�itemsr�)rr[r�r}rrrr 9szValues.__init__cCs
t|j�S)N)r$�__dict__)rrrrr!>szValues.__str__cCs2t|t�r|j|jkSt|t�r*|j|kStSdS)N)r�rr�r��NotImplemented)r�otherrrr�__eq__Cs



z
Values.__eq__cCs:x4t|�D](}||kr
||}|dk	r
t|||�q
WdS)N)�dirr�)rr�r�Zdvalrrr�_update_carefulKs
zValues._update_carefulcCs|jj|�dS)N)r��update)rr�rrr�
_update_looseXszValues._update_loosecCs8|dkr|j|�n |dkr(|j|�ntd|��dS)N�carefulZloosezinvalid update mode: %r)r�r�r5)rr��moderrr�_update`s
zValues._updater�cCs&t|�tj|}|jt|�|�dS)N)�
__import__�sys�modulesr��vars)r�modnamer��modrrr�read_modulehs
zValues.read_modulecCs&i}tt|�j�|�|j||�dS)N)�exec�open�readr�)r�filenamer�r�rrr�	read_filemszValues.read_filecCs0t||�st||�dkr&t|||�t||�S)N)�hasattr�getattrr�)rr�r�rrrr�rszValues.ensure_value)N)r�)r�)rr"r#r r!rr�r�r�r�r�r�r�r�rrrrr7s



c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!S)"rcCs&|j�||_|j|�|j|�dS)N)�_create_option_list�option_class�set_conflict_handler�set_description)rr��conflict_handlerrVrrrr �s
zOptionContainer.__init__cCsi|_i|_i|_dS)N)�
_short_opt�	_long_optr[)rrrr�_create_option_mappings�sz'OptionContainer._create_option_mappingscCs|j|_|j|_|j|_dS)N)r�r�r[)rr/rrr�_share_option_mappings�sz&OptionContainer._share_option_mappingscCs|dkrtd|��||_dS)N�error�resolvez$invalid conflict_resolution value %r)r�r�)r5r�)r�handlerrrrr��sz$OptionContainer.set_conflict_handlercCs
||_dS)N)rV)rrVrrrr��szOptionContainer.set_descriptioncCs|jS)N)rV)rrrr�get_description�szOptionContainer.get_descriptioncCs|`|`|`dS)N)r�r�r[)rrrr�destroy�szOptionContainer.destroycCs�g}x,|jD]"}||jkr|j||j|f�qWx,|jD]"}||jkr:|j||j|f�q:W|r�|j}|dkr�tddjdd�|D��|��nh|dkr�x^|D]V\}}|jd�r�|jj	|�|j|=n|jj	|�|j|=|jp�|js�|j
jj	|�q�WdS)Nr�z conflicting option string(s): %sz, cSsg|]}|d�qS)rr)rb�corrrrd�sz3OptionContainer._check_conflict.<locals>.<listcomp>r�z--)rur�rgrvr�r�rr+�
startswith�remove�	containerrl)rr&Z
conflict_optsror�Zc_optionrrr�_check_conflict�s.



zOptionContainer._check_conflictcOs�t|dt�r|j||�}n:t|�dkrN|rN|d}t|t�sVtd|��ntd��|j|�|jj|�||_	x|j
D]}||j|<qzWx|jD]}||j
|<q�W|jdk	r�|jtk	r�|j|j|j<n|j|jkr�d|j|j<|S)Nrrznot an Option instance: %rzinvalid arguments)r�r$r�rfrr�r�rlrgr�rur�rvr�r]r�r^r[)rr�r�r&rorrr�
add_option�s(



zOptionContainer.add_optioncCsx|D]}|j|�qWdS)N)r�)rrlr&rrr�add_optionss
zOptionContainer.add_optionscCs|jj|�p|jj|�S)N)r�r\r�)rr'rrr�
get_optionszOptionContainer.get_optioncCs||jkp||jkS)N)r�r�)rr'rrr�
has_options
zOptionContainer.has_optioncCsv|jj|�}|dkr |jj|�}|dkr4td|��x|jD]}|j|=q<Wx|jD]}|j|=qTW|jjj|�dS)Nzno such option %r)	r�r\r�r5rurvr�rlr�)rr'r&rorrr�
remove_optionszOptionContainer.remove_optioncCsB|js
dSg}x(|jD]}|jtk	r|j|j|��qWdj|�S)NrD)rlrZrrgrkr+)r�	formatterrir&rrr�format_option_helps
z"OptionContainer.format_option_helpcCs|j|j��S)N)rWr�)rrrrrrW(sz"OptionContainer.format_descriptioncCs:g}|jr|j|j|��|jr0|j|j|��dj|�S)NrU)rVrgrWrlrr+)rrrirrr�format_help+szOptionContainer.format_helpN)rr"r#r r�r�r�r�r�r�r�r�r�r�r�r�rrWrrrrrrxs  			c@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rNcCs$||_tj||j|j|�||_dS)N)r/rr r�r��title)rr/rrVrrrr 6szOptionGroup.__init__cCsg|_|j|j�dS)N)rlr�r/)rrrrr�<szOptionGroup._create_option_listcCs
||_dS)N)r)rrrrr�	set_title@szOptionGroup.set_titlecCstj|�|`dS)N)rr�rl)rrrrr�Cs
zOptionGroup.destroycCs0|j|j�}|j�|tj||�7}|j�|S)N)rPrrJrrrK)rrrirrrrJs
zOptionGroup.format_help)N)rr"r#r r�rr�rrrrrr4s

c
@s^eZdZgZddedddddddf
dd�Zdd�Zdd	�Zd
d�Zdd
�Z	dOdd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�ZdPd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�ZdQd;d<�Z d=d>�Z!d?d@�Z"dRdAdB�Z#dCdD�Z$dSdEdF�Z%dTdGdH�Z&dIdJ�Z'dUdKdL�Z(dVdMdN�Z)dS)WrNr�TcCsrtj||||�|j|�|	|_||_d|_d|_|dkr@t�}||_|jj	|�|
|_
|j||d�|j�dS)NT)�add_help)
rr �	set_usage�progr��allow_interspersed_args�process_default_valuesr
rrCrX�_populate_option_list�_init_parsing_state)rrMrlr�r�r�rVrZadd_help_optionrrXrrrr �s
zOptionParser.__init__cCs2tj|�x|jD]}|j�qW|`|`|`dS)N)rr�rnrlr)rrprrrr��s
zOptionParser.destroycCsg|_g|_|j�dS)N)rlrnr�)rrrrr��sz OptionParser._create_option_listcCs|jdddtd�d�dS)Nz-hz--helprZzshow this help message and exit)r�rZ)r�r()rrrr�_add_help_option�szOptionParser._add_help_optioncCs|jddtd�d�dS)Nz	--versionr�z&show program's version number and exit)r�rZ)r�r()rrrr�_add_version_option�sz OptionParser._add_version_optioncCs>|jr|j|j�|r |j|�|jr.|j�|r:|j�dS)N)�standard_option_listr�r�r
r)rrlrrrrr
�s
z"OptionParser._populate_option_listcCsd|_d|_d|_dS)N)�rargs�largsr�)rrrrr�sz OptionParser._init_parsing_statecCsL|dkrtd�|_n4|tkr$d|_n$|j�jd�rB|dd�|_n||_dS)Nz%prog [options]zusage: �)r(rMrr|r�)rrMrrrr�szOptionParser.set_usagecCs
d|_dS)NT)r)rrrr�enable_interspersed_args�sz%OptionParser.enable_interspersed_argscCs
d|_dS)NF)r)rrrr�disable_interspersed_argssz&OptionParser.disable_interspersed_argscCs
||_dS)N)r	)rr�rrr�set_process_default_valuessz'OptionParser.set_process_default_valuescCs||j|<dS)N)r[)rr]r�rrr�set_defaultszOptionParser.set_defaultcKs|jj|�dS)N)r[r�)rr�rrr�set_defaultsszOptionParser.set_defaultscCs.|jdd�}x|jD]}|j|j�qW|S)N)rlrnrh)rZoptionsrprrr�_get_all_optionsszOptionParser._get_all_optionscCsd|jst|j�S|jj�}x@|j�D]4}|j|j�}t|t�r$|j	�}|j
||�||j<q$Wt|�S)N)r	rr[�copyrr\r]r�r$r�r�)rr[r&r�r'rrr�get_default_valuess


zOptionParser.get_default_valuescOs|t|dt�r t|f|�|�}nLt|�dkrd|rd|d}t|t�sPtd|��|j|k	rltd��ntd��|jj|�|S)Nrrznot an OptionGroup instance: %rz"invalid OptionGroup (wrong parser)zinvalid arguments)	r�r$rrfr�r/r5rnrg)rr�r�rprrr�add_option_group+s


zOptionParser.add_option_groupcCs0|jj|�p|jj|�}|r,|j|k	r,|jSdS)N)r�r\r�r�)rr'r&rrr�get_option_group;s
zOptionParser.get_option_groupcCs&|dkrtjdd�S|dd�SdS)Nr)r��argv)rr�rrr�	_get_argsEszOptionParser._get_argscCs�|j|�}|dkr|j�}||_g|_}||_y|j|||�}Wn4ttfk
rv}z|jt	|��WYdd}~XnX||}|j
||�S)N)rrrrr��
_process_argsrrr�r$�check_values)rr�r�rr�stop�errrrr�
parse_argsKs

 zOptionParser.parse_argscCs||fS)Nr)rr�r�rrrrrszOptionParser.check_valuescCs�x�|r�|d}|dkr |d=dS|dd�dkr>|j||�q|dd�dkrht|�dkrh|j||�q|jr�|j|�|d=qdSqWdS)Nrz--r-rr�)�_process_long_optrf�_process_short_optsrrg)rrrr��argrrrrs

zOptionParser._process_argscCst||j�S)N)�
_match_abbrevr�)rrorrr�_match_long_opt�szOptionParser._match_long_optc
Cs�|jd�}d|kr4|jdd�\}}|jd|�d}n|}d}|j|�}|j|}|j�r�|j}t|�|kr�|jt	dd|�||d��q�|dkr�|jd�}	q�t
|d|��}	|d|�=n|r�|jtd	�|�nd}	|j||	||�dS)
NrrHrTFz.%(option)s option requires %(number)d argumentz/%(option)s option requires %(number)d arguments)r&�numberz%s option does not take a value)
�popr��insertr'r�rsr�rfr�rr�r(r�)
rrr�r%roZnext_argZhad_explicit_valuer&r�r�rrrr#�s0


zOptionParser._process_long_optcCs�|jd�}d}d}x�|dd�D]�}d|}|jj|�}|d7}|sLt|��|j�r�|t|�krx|jd||d��d}|j}	t|�|	kr�|jt	dd|	�||	d��q�|	dkr�|jd�}
q�t
|d|	��}
|d|	�=nd}
|j||
||�|r Pq WdS)	NrFrr�Tz.%(option)s option requires %(number)d argumentz/%(option)s option requires %(number)d arguments)r&r()r)r�r\rrsrfr*r�r�rr�r�)rrr�r%r �iZchror&r�r�rrrr$�s6
z OptionParser._process_short_optscCs&|jdkrtjjtjd�S|jSdS)Nr)rr2�path�basenamer�r)rrrr�
get_prog_names
zOptionParser.get_prog_namecCs|jd|j��S)Nz%prog)r`r.)r�srrr�expand_prog_nameszOptionParser.expand_prog_namecCs|j|j�S)N)r0rV)rrrrr�szOptionParser.get_descriptionrcCs|rtjj|�tj|�dS)N)r��stderr�writer�)rZstatusrrrrr�szOptionParser.exitcCs(|jtj�|jdd|j�|f�dS)Nr-z%s: error: %s
)�print_usager�r1r�r.)rrrrrr�szOptionParser.errorcCs"|jr|jj|j|j��SdSdS)NrD)rMrrNr0)rrrr�	get_usage#szOptionParser.get_usagecCs|jrt|j�|d�dS)N)�file)rM�printr4)rr5rrrr3*s	zOptionParser.print_usagecCs|jr|j|j�SdSdS)NrD)r�r0)rrrr�get_version6szOptionParser.get_versioncCs|jrt|j�|d�dS)N)r5)r�r6r7)rr5rrrr�<szOptionParser.print_versioncCs�|dkr|j}|j|�g}|j|jtd���|j�|jrZ|jtj||��|jd�x(|j	D]}|j|j
|��|jd�qbW|j�dj|dd��S)NZOptionsrUrDrre)
rrqrgrPr(rJrlrrrnrrKr+)rrrirprrrrGs

zOptionParser.format_option_helpcCs|j|j�S)N)rYrX)rrrrrrYXszOptionParser.format_epilogcCsn|dkr|j}g}|jr*|j|j�d�|jrD|j|j|�d�|j|j|��|j|j|��dj|�S)NrUrD)	rrMrgr4rVrWrrYr+)rrrirrrr[szOptionParser.format_helpcCs |dkrtj}|j|j��dS)N)r��stdoutr2r)rr5rrrr�gszOptionParser.print_help)T)NN)rN)N)N)N)N)N)*rr"r#rrr r�r�rr
r
rrrrrrrrrrrrr"rrr'r#r$r.r0r�r�r�r4r3r7r�rrYrr�rrrrrRs^F

	

'
3	$)





csZ�|kr�S�fdd�|j�D�}t|�dkr6|dS|sDt���n|j�t�|��dS)Ncsg|]}|j��r|�qSr)r�)rbZword)r/rrrd�sz!_match_abbrev.<locals>.<listcomp>rr)r�rfr�sortr))r/Zwordmapr*r)r/rr&ts
r&)r�r�ZSUPPRESSHELPZ
SUPPRESSUSAGE)&�__version__�__all__Z
__copyright__r�r2rRrrr�ImportErrorr(�	Exceptionrr
rrrr)r	r
rr�r�r�r�r�r�rr^rrrrrrrr&rrrrr�<module>s| 


P



uA=&genericpath.cpython-36.pyc000064400000010206150335715140011466 0ustar003

�\dh��@s�dZddlZddlZddddddd	d
ddd
dgZdd�Zdd
�Zdd	�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd
�Zdd�Z
dd�Zdd�Zdd�ZejGdd�d��ZdS)z�
Path operations common to more than one OS
Do not use directly.  The OS specific modules import the appropriate
functions from this module themselves.
�N�commonprefix�exists�getatime�getctime�getmtime�getsize�isdir�isfile�samefile�sameopenfile�samestat�
ALLOW_MISSINGcCs(ytj|�Wntk
r"dSXdS)zDTest whether a path exists.  Returns False for broken symbolic linksFT)�os�stat�OSError)�path�r�#/usr/lib64/python3.6/genericpath.pyrs
cCs0ytj|�}Wntk
r"dSXtj|j�S)z%Test whether a path is a regular fileF)rrr�S_ISREG�st_mode)r�strrrr	s
cCs0ytj|�}Wntk
r"dSXtj|j�S)z<Return true if the pathname refers to an existing directory.F)rrr�S_ISDIRr)�srrrrr's
cCstj|�jS)z1Return the size of a file, reported by os.stat().)rr�st_size)�filenamerrrr0scCstj|�jS)zCReturn the last modification time of a file, reported by os.stat().)rr�st_mtime)rrrrr5scCstj|�jS)z=Return the last access time of a file, reported by os.stat().)rr�st_atime)rrrrr:scCstj|�jS)zAReturn the metadata change time of a file, reported by os.stat().)rr�st_ctime)rrrrr?scCsl|sdSt|dttf�s*tttj|��}t|�}t|�}x,t|�D] \}}|||krD|d|�SqDW|S)zGGiven a list of pathnames, returns the longest common leading component�rN)	�
isinstance�list�tuple�mapr�fspath�min�max�	enumerate)�m�s1�s2�i�crrrrEscCs|j|jko|j|jkS)z5Test whether two stat buffers reference the same file)�st_ino�st_dev)r(r)rrrrWscCstj|�}tj|�}t||�S)z9Test whether two pathnames reference the same actual file)rrr)�f1�f2r(r)rrrr
^s

cCstj|�}tj|�}t||�S)z:Test whether two open file objects reference the same file)r�fstatr)�fp1�fp2r(r)rrrrgs

cCs�|j|�}|r"|j|�}t||�}|j|�}||kr~|d}x@||kr||||d�|krr|d|�||d�fS|d7}q>W||dd�fS)z�Split the extension from a pathname.

    Extension is everything from the last dot to the end, ignoring
    leading dots.  Returns "(root, ext)"; ext may be empty.�Nr)�rfindr%)�p�sep�altsep�extsep�sepIndex�altsepIndex�dotIndex�
filenameIndexrrr�	_splitextus




r=cGsbd}}xB|D]:}t|t�r"d}qt|t�r2d}qtd||jjf�d�qW|r^|r^td�d�dS)NFTz*%s() argument must be str or bytes, not %rz.Can't mix strings and bytes in path components)r�str�bytes�	TypeError�	__class__�__name__)�funcname�args�hasstr�hasbytesrrrr�_check_arg_types�s


rGc@s eZdZdZdd�Zdd�ZdS)r
z$Special value for use in realpath().cCsdS)Nzos.path.ALLOW_MISSINGr)�selfrrr�__repr__�szALLOW_MISSING.__repr__cCs|jjS)N)rArB)rHrrr�
__reduce__�szALLOW_MISSING.__reduce__N)rB�
__module__�__qualname__�__doc__rIrJrrrrr
�s)rMrr�__all__rr	rrrrrrrr
rr=rG�object�__new__r
rrrr�<module>s&

		code.cpython-36.opt-2.pyc000064400000010722150335715140011052 0ustar003


 \v)�@s�ddlZddlZddlZddlmZmZddddgZGdd�d�ZGdd�de�Zdd	d�Z	e
d
kr�ej�Zej
ddd
d�ej�Zejs�ejjr�dZndZe	e�dS)�N)�CommandCompiler�compile_command�InteractiveInterpreter�InteractiveConsole�interactrc@sBeZdZddd�Zddd�Zdd	�Zdd
d�Zdd
�Zdd�ZdS)rNcCs$|dkrddd�}||_t�|_dS)NZ__console__)�__name__�__doc__)�localsr�compile)�selfr	�r�/usr/lib64/python3.6/code.py�__init__s	
zInteractiveInterpreter.__init__�<input>�singlec
CsRy|j|||�}Wn$tttfk
r6|j|�dSX|dkrDdS|j|�dS)NFT)r
�
OverflowError�SyntaxError�
ValueError�showsyntaxerror�runcode)r�source�filenameZsymbol�coderrr
�	runsource's

z InteractiveInterpreter.runsourcecCs>yt||j�Wn(tk
r&�Yn|j�YnXdS)N)�execr	�
SystemExit�
showtraceback)rrrrr
rNszInteractiveInterpreter.runcodecCs�tj�\}}}|t_|t_|t_|rp|tkrpy|j\}\}}}}	Wntk
rVYnXt|||||	f�}|t_tjtj	kr�t
j||�}
|jdj
|
��ntj|||�dS)N�)�sys�exc_info�	last_type�
last_value�last_tracebackr�argsr�
excepthook�__excepthook__�	traceback�format_exception_only�write�join)rr�type�value�tb�msgZdummy_filename�lineno�offset�line�linesrrr
rasz&InteractiveInterpreter.showsyntaxerrorcCs|tj�\t_t_}}|t_zPtj|d|d|j�}tjtj	krT|j
dj|��ntj|d|d|�Wdd}}XdS)Nr�r)rrr r!r"r&�format_exception�tb_nextr$r%r(r))rZlast_tbZeir1rrr
r�sz$InteractiveInterpreter.showtracebackcCstjj|�dS)N)r�stderrr()r�datarrr
r(�szInteractiveInterpreter.write)N)rr)N)	r�
__module__�__qualname__rrrrrr(rrrr
rs	

'
#c@s:eZdZddd�Zdd�Zddd�Zd	d
�Zddd
�ZdS)rN�	<console>cCstj||�||_|j�dS)N)rrr�resetbuffer)rr	rrrr
r�s
zInteractiveConsole.__init__cCs
g|_dS)N)�buffer)rrrr
r:�szInteractiveConsole.resetbufferc!CsPy
tjWntk
r$dt_YnXy
tjWntk
rJdt_YnXd}|dkrx|jdtjtj||jjf�n|r�|jdt	|��d}x�yP|r�tj}ntj}y|j
|�}Wn tk
r�|jd�PYnX|j|�}Wq�t
k
�r|jd�|j�d}Yq�Xq�W|dk�r4|jd	|jj�n|d
k�rL|jd|�dS)Nz>>> z... zFType "help", "copyright", "credits" or "license" for more information.zPython %s on %s
%s
(%s)
z%s
r�
z
KeyboardInterrupt
znow exiting %s...
r)rZps1�AttributeErrorZps2r(�version�platform�	__class__r�str�	raw_input�EOFError�push�KeyboardInterruptr:)r�banner�exitmsgZcprt�more�promptr0rrr
r�sF






zInteractiveConsole.interactcCs6|jj|�dj|j�}|j||j�}|s2|j�|S)Nr<)r;�appendr)rrr:)rr0rrHrrr
rD�szInteractiveConsole.pushrcCst|�S)N)�input)rrIrrr
rBszInteractiveConsole.raw_input)Nr9)NN)r)rr7r8rr:rrDrBrrrr
r�s


6cCsJt|�}|dk	r||_n"yddl}Wntk
r8YnX|j||�dS)Nr)rrB�readline�ImportErrorr)rFZreadfuncZlocalrGZconsolerLrrr
rs�__main__z-q�
store_truez*don't print version and copyright messages)�action�helpr)NNNN)rr&�argparseZcodeoprr�__all__rrrr�ArgumentParser�parser�add_argument�
parse_argsr#�q�flags�quietrFrrrr
�<module>s$t
_dummy_thread.cpython-36.opt-1.pyc000064400000011365150335715140012764 0ustar003


 \��@sxdZdddddddgZdZeZifd
d�Zdd�Zdd�Zd
d�Zddd�Z	dd�Z
Gdd�de�Zda
dadd�ZdS)a/Drop-in replacement for the thread module.

Meant to be used as a brain-dead substitute so that threaded code does
not need to be rewritten for when the thread module is not present.

Suggested usage is::

    try:
        import _thread
    except ImportError:
        import _dummy_thread as _thread

�error�start_new_thread�exit�	get_ident�
allocate_lock�interrupt_main�LockType��cCs�t|�tt��krtd��t|�tt��kr4td��day|||�Wn.tk
rZYnddl}|j�YnXdatr�dat	�dS)a�Dummy implementation of _thread.start_new_thread().

    Compatibility is maintained by making sure that ``args`` is a
    tuple and ``kwargs`` is a dictionary.  If an exception is raised
    and it is SystemExit (which can be done by _thread.exit()) it is
    caught and nothing is done; all other exceptions are printed out
    by using traceback.print_exc().

    If the executed function calls interrupt_main the KeyboardInterrupt will be
    raised when the function returns.

    z2nd arg must be a tuplez3rd arg must be a dictF�NT)
�type�tuple�	TypeError�dict�_main�
SystemExit�	traceback�	print_exc�
_interrupt�KeyboardInterrupt)Zfunction�args�kwargsr�r�%/usr/lib64/python3.6/_dummy_thread.pyrs 
cCst�dS)z'Dummy implementation of _thread.exit().N)rrrrrr=scCsdS)z�Dummy implementation of _thread.get_ident().

    Since this module should only be used when _threadmodule is not
    available, it is safe to assume that the current process is the
    only thread.  Thus a constant can be safely returned.
    ����rrrrrrAscCst�S)z0Dummy implementation of _thread.allocate_lock().)rrrrrrJsNcCs|dk	rtd��dS)z-Dummy implementation of _thread.stack_size().Nz'setting thread stack size not supportedr
)r)�sizerrr�
stack_sizeNsrcCst�S)z0Dummy implementation of _thread._set_sentinel().)rrrrr�
_set_sentinelTsrc@sFeZdZdZdd�Zddd�ZeZdd	�Zd
d�Zdd
�Z	dd�Z
dS)ra�Class implementing dummy implementation of _thread.LockType.

    Compatibility is maintained by maintaining self.locked_status
    which is a boolean that stores the state of the lock.  Pickling of
    the lock, though, should not be done since if the _thread module is
    then used with an unpickled ``lock()`` from here problems could
    occur from this class not having atomic methods.

    cCs
d|_dS)NF)�
locked_status)�selfrrr�__init__cszLockType.__init__NrcCsH|dks|rd|_dS|js&d|_dS|dkr@ddl}|j|�dSdS)a�Dummy implementation of acquire().

        For blocking calls, self.locked_status is automatically set to
        True and returned appropriately based on value of
        ``waitflag``.  If it is non-blocking, then the value is
        actually checked and not set if it is already acquired.  This
        is all done so that threading.Condition's assert statements
        aren't triggered and throw a little fit.

        NTr
F)r�timeZsleep)rZwaitflagZtimeoutr!rrr�acquirefs
zLockType.acquirecCs|j�dS)N)�release)r�typ�val�tbrrr�__exit__�szLockType.__exit__cCs|js
t�d|_dS)zRelease the dummy lock.FT)rr)rrrrr#�szLockType.releasecCs|jS)N)r)rrrr�locked�szLockType.lockedcCs*d|jrdnd|jj|jjtt|��fS)Nz<%s %s.%s object at %s>r(Zunlocked)r�	__class__�
__module__�__qualname__�hex�id)rrrr�__repr__�s
zLockType.__repr__r)Nr)�__name__r*r+�__doc__r r"�	__enter__r'r#r(r.rrrrrXs	
	FTcCstr
t�ndadS)z^Set _interrupt flag to True to have start_new_thread raise
    KeyboardInterrupt upon exiting.TN)rrrrrrrr�sl)N)r0�__all__�TIMEOUT_MAX�RuntimeErrorrrrrrrr�objectrrrrrrrr�<module>
s
 	
@dis.cpython-36.pyc000064400000033547150335715140007771 0ustar003


 \�F�@s�dZddlZddlZddlZddlZddlTddlmZddddd	d
ddd
ddgeZ[ejej	ej
eee
fZedZdd�ZdKdd�dd�ZdLdd�dd�Zddddddddddd �
Zd!d"�Zd#d$�Zd%d�Zd&d'�Zdd�d(d�Zejd)d*�Zd+ej_d,ej_d-ej_d.ej_d/ej_d0ej _d1ej!_d2ej"_Gd3d�de�Z#dd4�d5d
�Z$d6d7�Z%d8d9�Z&dMd:d;�Z'dOdd�d=d�Z(dQddd>�d?d@�Z)dd�dAdB�Z*e(Z+dCdD�Z,dEd�Z-dFd
�Z.GdGd�d�Z/dHdI�Z0e1dJk�r�e0�dS)Rz0Disassembler of Python byte code into mnemonics.�N)�*)�__all__�	code_info�dis�disassemble�distb�disco�findlinestarts�
findlabels�	show_code�get_instructions�Instruction�Bytecode�FORMAT_VALUEcCs6yt||d�}Wn tk
r0t||d�}YnX|S)z�Attempts to compile the given source, first as an expression and
       then as a statement if the first approach fails.

       Utility function to accept strings in functions that otherwise
       expect code objects
    �eval�exec)�compile�SyntaxError)�source�name�c�r�/usr/lib64/python3.6/dis.py�_try_compiles
r)�filecCs>|dkrt|d�dSt|d�r&|j}t|d�r6|j}t|d�rF|j}t|d�r�t|jj��}x�|D]n\}}t|t	�rdt
d||d�yt||d�Wn0tk
r�}zt
d||d�WYdd}~XnXt
|d�qdWnbt|d	�r�t
||d�nJt|ttf��rt||d�n,t|t��r(t||d�ntd
t|�j��dS)zzDisassemble classes, methods, functions, generators, or code.

    With no argument, disassemble the last traceback.

    N)r�__func__�__code__�gi_code�__dict__zDisassembly of %s:zSorry:�co_codez(don't know how to disassemble %s objects)r�hasattrrrr�sortedr�items�
isinstance�
_have_code�printr�	TypeErrorr�bytes�	bytearray�_disassemble_bytes�str�_disassemble_str�type�__name__)�xrr"rZx1�msgrrrr"s6





 
c
CsZ|dkrBy
tj}Wntk
r.td��YnXx|jr@|j}q2Wt|jj|j|d�dS)z2Disassemble a traceback (default: last traceback).Nz no last traceback to disassemble)r)	�sys�last_traceback�AttributeError�RuntimeError�tb_nextr�tb_frame�f_code�tb_lasti)�tbrrrrrEs

Z	OPTIMIZEDZ	NEWLOCALSZVARARGSZVARKEYWORDSZNESTEDZ	GENERATORZNOFREEZ	COROUTINEZITERABLE_COROUTINEZASYNC_GENERATOR)
������ �@��icCsbg}xRtd�D]8}d|>}||@r|jtj|t|���||N}|sPqW|jt|��dj|�S)z+Return pretty representation of code flags.r>r9z, )�range�append�COMPILER_FLAG_NAMES�get�hex�join)�flags�names�i�flagrrr�pretty_flags_srLcCsht|d�r|j}t|d�r |j}t|d�r0|j}t|t�rDt|d�}t|d�rR|Stdt|�j	��dS)zMHelper to handle methods, functions, generators, strings and raw code objectsrrrz
<disassembly>rz(don't know how to disassemble %s objectsN)
r rrrr#r*rr&r,r-)r.rrr�_get_code_objectms





rMcCstt|��S)z1Formatted details of methods, functions, or code.)�_format_code_inforM)r.rrrr|scCs�g}|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jdt|j��|j	r�|jd�x t
|j	�D]}|jd	|�q�W|jr�|jd
�x t
|j�D]}|jd|�q�W|j�r|jd�x t
|j�D]}|jd|�q�W|j
�rF|jd
�x"t
|j
�D]}|jd|��q.W|j�r||jd�x"t
|j�D]}|jd|��qdWdj|�S)NzName:              %szFilename:          %szArgument count:    %szKw-only arguments: %szNumber of locals:  %szStack size:        %szFlags:             %sz
Constants:z%4d: %rzNames:z%4d: %szVariable names:zFree variables:zCell variables:�
)rC�co_name�co_filename�co_argcount�co_kwonlyargcount�
co_nlocals�co_stacksizerL�co_flags�	co_consts�	enumerate�co_names�co_varnames�co_freevars�co_cellvarsrG)�co�linesZi_cZi_nrrrrN�s:




rNcCstt|�|d�dS)z}Print details of methods, functions, or code to *file*.

    If *file* is not provided, the output is printed on stdout.
    )rN)r%r)r]rrrrr�s�_InstructionzBopname opcode arg argval argrepr offset starts_line is_jump_targetz!Human readable name for operationzNumeric code for operationz6Numeric argument to operation (if any), otherwise Nonez4Resolved arg value (if known), otherwise same as argz0Human readable description of operation argumentz1Start index of operation within bytecode sequencez4Line started by this opcode (if any), otherwise Nonez1True if other code jumps to here, otherwise Falsec@seZdZdZddd�ZdS)r
aKDetails for a bytecode operation

       Defined fields:
         opname - human readable name for operation
         opcode - numeric code for operation
         arg - numeric argument to operation (if any), otherwise None
         argval - resolved arg value (if known), otherwise same as arg
         argrepr - human readable description of operation argument
         offset - start index of operation within bytecode sequence
         starts_line - line started by this opcode (if any), otherwise None
         is_jump_target - True if other code jumps to here, otherwise False
    �FcCs�g}|r:|jdk	r,d|}|j||j�n|jd|�|rJ|jd�n
|jd�|jrf|jd�n
|jd�|jt|j�jd��|j|jjd	��|jdk	r�|jt|j�jd
��|j	r�|jd|j	d�dj
|�j�S)
z�Format instruction details for inclusion in disassembly output

        *lineno_width* sets the width of the line number field (0 omits it)
        *mark_as_current* inserts a '-->' marker arrow as part of the line
        Nz%%%dd� z-->z   z>>z  r;���(�))�starts_linerC�is_jump_target�repr�offset�rjust�opname�ljust�arg�argreprrG�rstrip)�self�lineno_widthZmark_as_currentZfieldsZ
lineno_fmtrrr�_disassemble�s&



zInstruction._disassembleN)r`F)r-�
__module__�__qualname__�__doc__rrrrrrr
�s)�
first_linecCsTt|�}|j|j}tt|��}|dk	r4||j}nd}t|j|j|j	|j
|||�S)a�Iterator for the opcodes in methods, functions or code

    Generates a series of Instruction named tuples giving the details of
    each operations in the supplied code.

    If *first_line* is not None, it indicates the line number that should
    be reported for the first source line in the disassembled code.
    Otherwise, the source line information (if any) is taken directly from
    the disassembled code object.
    Nr)rMr\r[�dictr	�co_firstlineno�_get_instructions_bytesrrZrYrW)r.rvr]�
cell_names�
linestarts�line_offsetrrrr�scCs |}|dk	r||}|t|�fS)z�Helper to get optional details about const references

       Returns the dereferenced constant and its repr if the constant
       list is defined.
       Otherwise returns the constant index and its repr().
    N)rh)Zconst_indexZ
const_list�argvalrrr�_get_const_info�sr~cCs*|}|dk	r||}|}nt|�}||fS)z�Helper to get optional details about named references

       Returns the dereferenced name as both value and repr if the name
       list is defined.
       Otherwise returns the name index and its repr().
    N)rh)Z
name_indexZ	name_listr}rnrrr�_get_name_infosrc
csxt|�}d}�xdt|�D�]V\}	}
}|dk	rH|j|	d�}|dk	rH||7}|	|k}d}
d}|dk	�rT|}
|
tkr~t||�\}
}n�|
tkr�t||�\}
}n�|
tkr�|	d|}
dt|
�}n�|
t	kr�t||�\}
}n�|
t
kr�t|}
|
}nn|
tkr�t||�\}
}nV|
t
k�rTdtttf|d@t|d@�f}
d
|d@}|
d
�rT|�rL|d7}|d7}tt|
|
||
||	||�VqWdS)a&Iterate over the instructions in a bytecode string.

    Generates a sequence of Instruction namedtuples giving the details of each
    opcode.  Additional information about the code's runtime environment
    (e.g. variable names, constants) can be specified using optional
    arguments.

    N�r:zto r`r;r*rh�asciir9z, zwith format)r�r*rhr�)r
�_unpack_opargsrEZhasconstr~Zhasnamer�hasjrelrhZhaslocalZ
hascompareZcmp_opZhasfreerr*r��boolr
rk)�code�varnamesrI�	constants�cellsr{r|�labelsrfri�oprmrgr}rnrrrrysH


 

ryr9c
Cs<|j|j}tt|��}t|j||j|j|j|||d�dS)zDisassemble a code object.)rN)	r\r[rwr	r)rrZrYrW)r]�lastirrzr{rrrrJs)rr|c	Cs||dk	}	|	rdnd}
xbt|||||||d�D]H}|	oF|jdk	oF|jdk}|rVt|d�|j|k}
t|j|
|
�|d�q,WdS)Nr`r)r|)r)ryrfrir%rr)r�r�r�rIr�r�r{rr|Zshow_linenorqZinstrZnew_source_lineZis_current_instrrrrr)Qs




r)cCstt|d�|d�dS)z<Compile the source string, then disassemble the code object.z<dis>)rN)rr)rrrrrr+csr+ccshd}x^tdt|�d�D]J}||}|tkrP||d|B}|tkrJ|d>nd}nd}|||fVqWdS)Nrr:r9r<)rB�lenZ
HAVE_ARGUMENTZEXTENDED_ARG)r�Zextended_argrJr�rmrrrr�isr�cCs`g}xVt|�D]J\}}}|dk	r|tkr6|d|}n|tkr|}nq||kr|j|�qW|S)z`Detect all offsets in a byte code which are jump targets.

    Return the list of offsets.

    Nr:)r�r�ZhasjabsrC)r�r�rir�rmZlabelrrrr
tsccs�|jddd�}|jddd�}d}|j}d}xPt||�D]B\}}|rd||kr\||fV|}||7}|dkrt|d8}||7}q:W||kr�||fVdS)z�Find the offsets in a byte code which are start of lines in the source.

    Generate pairs (offset, lineno) as described in Python/compile.c.

    rNr:r9r@rA)�	co_lnotabrx�zip)r�Zbyte_incrementsZline_incrementsZ
lastlineno�linenoZaddrZ	byte_incrZ	line_incrrrrr	�s 
c@sLeZdZdZddd�dd�Zdd�Zdd	�Zed
d��Zdd
�Z	dd�Z
dS)rz�The bytecode operations of a piece of code

    Instantiate this with a function, method, string of code, or a code object
    (as returned by compile()).

    Iterating over this yields the bytecode operations as Instruction instances.
    N)rv�current_offsetcCsdt|�|_}|dkr&|j|_d|_n||_||j|_|j|j|_tt	|��|_
||_||_dS)Nr)
rM�codeobjrxrv�_line_offsetr\r[�_cell_namesrwr	�_linestarts�_original_objectr�)rpr.rvr�r]rrr�__init__�szBytecode.__init__c	Cs*|j}t|j|j|j|j|j|j|jd�S)N)r|)	r�ryrrZrYrWr�r�r�)rpr]rrr�__iter__�s
zBytecode.__iter__cCsdj|jj|j�S)Nz{}({!r}))�format�	__class__r-r�)rprrr�__repr__�s
zBytecode.__repr__cCs$x|jr|j}qW||jj|jd�S)z/ Construct a Bytecode from the given traceback )r�)r4r5r6r7)�clsr8rrr�from_traceback�s
zBytecode.from_tracebackcCs
t|j�S)z3Return formatted information about the code object.)rNr�)rprrr�info�sz
Bytecode.infocCs`|j}|jdk	r|j}nd}tj��2}t|j|j|j|j|j	|j
|j||d�	|j�SQRXdS)z3Return a formatted view of the bytecode operations.Nr9)r�rIr�r�r{r|rr����)
r�r��io�StringIOr)rrZrYrWr�r�r��getvalue)rpr]ri�outputrrrr�s


zBytecode.dis)r-rsrtrur�r�r��classmethodr�r�rrrrrr�s
cCsdddl}|j�}|jd|j�ddd�|j�}|j�}|j�}WdQRXt||jjd�}t	|�dS)z*Simple test program to disassemble a file.rN�infile�?�-)r,�nargs�defaultr)
�argparse�ArgumentParser�add_argumentZFileType�
parse_argsr��readrrr)r��parser�argsr�rr�rrr�_test�sr��__main__)N)N)NNNNNrr�)r�r�)r�NNNNN)2rur0�types�collectionsr�ZopcoderZ_opcodes_all�
MethodType�FunctionType�CodeTyper��staticmethodr,r$ZopmaprrrrrDrLrMrrNr�
namedtupler_rkrmr}rnrirfrgr
rr~rryrr)r+rr�r
r	rr�r-rrrr�<module>sx


#3
2=
gettext.cpython-36.opt-2.pyc000064400000032304150335715140011624 0ustar003


 \T�@s�ddlZddlZddlZddlZddlZddlZddlZddlmZddddddd	d
ddd
ddddddgZ	ej
jejdd�Z
ejdejejB�Zdd�Zdd�ZdOZd(d)�eed*�D�Zd+d,d-d.�ZdQd/d0�Zd1d2�Zd3d4�Zd5d6�ZGd7d�d�ZGd8d�de�ZdRd:d�ZiZdSd;d�ZdTd<d�Z ia!ia"d=a#dUd>d	�Z$dVd?d
�Z%dWd@d�Z&dAd�Z'dBd�Z(dCd
�Z)dDd�Z*dEd�Z+dFd�Z,dGd�Z-dHd�Z.eZ/dS)X�N)�ENOENT�NullTranslations�GNUTranslations�Catalog�find�translation�install�
textdomain�bindtextdomain�bind_textdomain_codeset�dgettext�	dngettext�gettext�lgettext�	ldgettext�
ldngettext�	lngettext�ngettextZshare�localea�
        (?P<WHITESPACES>[ \t]+)                    | # spaces and horizontal tabs
        (?P<NUMBER>[0-9]+\b)                       | # decimal integer
        (?P<NAME>n\b)                              | # only n is allowed
        (?P<PARENTHESIS>[()])                      |
        (?P<OPERATOR>[-*/%+?:]|[><!]=?|==|&&|\|\|) | # !, *, /, %, +, -, <, >,
                                                     # <=, >=, ==, !=, &&, ||,
                                                     # ? :
                                                     # unary and bitwise ops
                                                     # not allowed
        (?P<INVALID>\w+|.)                           # invalid token
    ccsTxHtjt|�D]8}|j}|dkr"q|j|�}|dkr@td|��|VqWdVdS)NZWHITESPACESZINVALIDz invalid token in plural form: %s�)�re�finditer�_token_pattern�	lastgroup�group�
ValueError)�pluralZmoZkind�value�r�/usr/lib64/python3.6/gettext.py�	_tokenizeTs

r cCs|rtd|�Std�SdS)Nz#unexpected token in plural form: %szunexpected end of plural form)r)rrrr�_error_sr!�||�&&�==�!=�<�>�<=�>=�+�-�*�/�%cCs i|]\}}|D]
}||�qqSrr)�.0�iZops�oprrr�
<dictcomp>msr2��or�andz//)z||z&&r-cCs�d}t|�}x|dkr(|d7}t|�}qW|dkr\t|�\}}d||f}|dkr�td��nP|dkrrd	||f}n:yt|d
�}Wntk
r�t|�d�YnXd||f}t|�}d}xh|tk�r t|}||kr�P|dkr�|dkr�d|}tj||�}t||d�\}	}d|||	f}|}q�W||k�o6dkn�rFd|}|dk�r�|dk�r�t|d�\}
}|dk�rzt|��t|�\}}d|
||f}|dk�r�d|}||fS)Nr�!znot �(z%s(%s)�)z%unbalanced parenthesis in plural form�nz%s%s�
z%s%d�d��z(%s)r3z%s %s %s�?r�:z%s if %s else %s)r<r=)r<r=)�next�_parser�intr!�_binary_ops�	_c2py_ops�get)�tokensZpriority�result�nexttok�subr�jr0r1�rightZif_trueZif_falserrrrApsP



rAcCs:yt|�}Wn(tk
r4td|jjf�d�YnX|S)Nz'Plural value must be an integer, got %s)�round�	TypeError�	__class__�__name__)r9r0rrr�_as_int�srPcCs�t|�dkrtd��y~tt|��\}}|r2t|��d}x>|D]6}|dkrb|d7}|dkrrtd��q<|dkr<|d8}q<Wd	ti}td
||�|dStk
r�td��YnXdS)Ni�z"plural form expression is too longrr7r3�z%plural form expression is too complexr8rPz�if True:
            def func(n):
                if not isinstance(n, int):
                    n = _as_int(n)
                return int(%s)
            �func)�lenrrAr r!rP�exec�RecursionError)rrGrHZdepth�c�nsrrr�c2py�s(

rXc
Cs:tj|�}d}d	}d
}d}|jd�}|dkrN||d�}|d|�}||O}nd}|jd�}|dkr�||d�}|d|�}||O}nd}|jd�}|dkr�||d�}|d|�}||O}nd}|}	g}
xbt|d�D]R}||@s�|	}||@�r�||7}||@�r||7}||@�r ||7}|
j|�q�W|
j�|
S)Nr3r��@r�.�_r3rYr=)rZ	normalizer�range�append�reverse)
�locZCOMPONENT_CODESETZCOMPONENT_TERRITORYZCOMPONENT_MODIFIER�mask�posZmodifier�codesetZ	territoryZlanguageZretr0�valrrr�_expand_lang�sJ










rec@speZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
ddd�ZdS)rNcCs.i|_d|_d|_d|_|dk	r*|j|�dS)N)�_info�_charset�_output_charset�	_fallbackrA)�self�fprrr�__init__�szNullTranslations.__init__cCsdS)Nr)rjrkrrrrAszNullTranslations._parsecCs|jr|jj|�n||_dS)N)ri�add_fallback)rj�fallbackrrrrmszNullTranslations.add_fallbackcCs|jr|jj|�S|S)N)rir)rj�messagerrrr	szNullTranslations.gettextcCs2|jr|jj|�S|jr$|j|j�S|jtj��S)N)rirrh�encoder�getpreferredencoding)rjrorrrrs
zNullTranslations.lgettextcCs*|jr|jj|||�S|dkr"|S|SdS)Nr3)rir)rj�msgid1�msgid2r9rrrrs
zNullTranslations.ngettextcCsH|jr|jj|||�S|dkr$|}n|}|jr:|j|j�S|jtj��S)Nr3)rirrhrprrq)rjrrrsr9�tmsgrrrrszNullTranslations.lngettextcCs|jS)N)rf)rjrrr�info(szNullTranslations.infocCs|jS)N)rg)rjrrr�charset+szNullTranslations.charsetcCs|jS)N)rh)rjrrr�output_charset.szNullTranslations.output_charsetcCs
||_dS)N)rh)rjrvrrr�set_output_charset1sz#NullTranslations.set_output_charsetcCsvddl}|j|jd<t|d�rrd|kr6|jd|jd<d|krJ|j|jd<d|kr^|j|jd<d|krr|j|jd<dS)Nrr\�__contains__rrrr)�builtinsr�__dict__�hasattrrrr)rj�namesrzrrrr4s
zNullTranslations.install)N)N)rO�
__module__�__qualname__rlrArmrrrrrurvrwrxrrrrrr�s
c@sHeZdZdZdZdZdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)rl�*l�$<rr3cCs|d?|d@fS)N�i��r)rj�versionrrr�
_get_versionsJszGNUTranslations._get_versionsc"Cs�tj}t|dd�}i|_}dd�|_|j�}t|�}|d|dd��d}||jkrv|d|dd	��\}}	}
}d
}n6||jkr�|d|dd	��\}}	}
}d}nt	dd
|��|j
|�\}
}|
|jkr�t	ddt|
�|���xt
d|	�D�]�}||||
|
d��\}}||}|||||d��\}}||}||k�r^||k�r^|||�}|||�}nt	dd|��|dk�rRd}x�|jd�D]�}|j�j�}|�s��q�d}}d|k�r�|jdd�\}}|j�j�}|j�}||j|<|}n|�r|j|d|7<|dk�r|jd�d|_n0|dk�r�|jd�}|djd�d}t|�|_�q�W|j�p\d}d|k�r�|jd�\}} |jd�}t||�}x>t|�D]\}}!t|!|�|||f<�q�Wnt||�|t||�<|
d7}
|d7}q�WdS)N�namercSst|dk�S)Nr3)rB)r9rrr�<lambda>Usz(GNUTranslations._parse.<locals>.<lambda>z<Ir=rz<4IrQz<IIz>4Iz>IIzBad magic numberzBad version number �zFile is corrupt�
r?r3�
zcontent-typezcharset=zplural-forms�;zplural=�ascii�)�struct�unpack�getattr�_catalogr�readrS�LE_MAGIC�BE_MAGIC�OSErrorr��VERSIONS�strr]�split�decode�strip�lowerrfrgrX�	enumerate)"rjrkr��filenameZcatalogZbufZbuflen�magicr�ZmsgcountZ	masteridxZtransidxZiiZ
major_versionZ
minor_versionr0ZmlenZmoffZmendZtlenZtoffZtend�msgrtZlastkZb_item�item�k�vrrvrrrs�xrrrrANsr














zGNUTranslations._parsecCsRt�}|jj||�}||kr2|jr.|jj|�S|}|jrD|j|j�S|jtj��S)N)	�objectr�rErirrhrprrq)rjro�missingrtrrrr�szGNUTranslations.lgettextcCsvy|j||j|�f}Wn<tk
rT|jr>|jj|||�S|dkrL|}n|}YnX|jrh|j|j�S|jtj��S)Nr3)	r�r�KeyErrorrirrhrprrq)rjrrrsr9rtrrrr�s
zGNUTranslations.lngettextcCs6t�}|jj||�}||kr2|jr.|jj|�S|S|S)N)r�r�rErir)rjror�rtrrrr�szGNUTranslations.gettextcCsZy|j||j|�f}Wn<tk
rT|jr>|jj|||�S|dkrL|}n|}YnX|S)Nr3)r�rr�rir)rjrrrsr9rtrrrr�s
zGNUTranslations.ngettextN)rr3)rOr~rr�r�r�r�rArrrrrrrrrBsT	FcCs�|dkrt}|dkrTg}x(dD] }tjj|�}|r|jd�}PqWd|krT|jd�g}x0|D](}x"t|�D]}||krl|j|�qlWq^W|r�g}	nd}	xL|D]D}|dkr�Ptjj||dd|�}
tjj	|
�r�|r�|	j|
�q�|
Sq�W|	S)	N�LANGUAGE�LC_ALL�LC_MESSAGES�LANGr?�Cz%s.mo)r�r�r�r�)
�_default_localedir�os�environrEr�r^re�path�join�exists)�domain�	localedir�	languages�allZenvarrdZnelangsZlangZnelangrG�mofilerrrr�s8




cCs�|dkrt}t|||dd�}|s6|r*t�Sttd|��d}x�|D]|}|tjj|�f}	tj	|	�}
|
dkr�t
|d��}tj|	||��}
WdQRXtj|
�}
|r�|
j
|�|dkr�|
}q@|j|
�q@W|S)NT)r�z$No translation file found for domain�rb)rrrr�rr�r��abspath�
_translationsrE�open�
setdefault�copyrxrm)r�r�r�Zclass_rnrcZmofilesrGr��key�trkrrrr�s*



cCst||d|d�}|j|�dS)NT)rnrc)rr)r�r�rcr}r�rrrrsZmessagescCs|dk	r|atS)N)�_current_domain)r�rrrr	'scCs|dk	r|t|<tj|t�S)N)�_localedirsrEr�)r�r�rrrr
.scCs|dk	r|t|<tj|�S)N)�_localecodesetsrE)r�rcrrrr5scCs@y t|tj|d�tj|�d�}Wntk
r4|SX|j|�S)N)rc)rr�rEr�r�r)r�ror�rrrr<scCsRtj|�}yt|tj|d�|d�}Wn"tk
rF|j|pBtj��SX|j|�S)N)rc)	r�rErr�r�rprrqr)r�rorcr�rrrrDs
cCsTy t|tj|d�tj|�d�}Wn$tk
rD|dkr<|S|SYnX|j|||�S)N)rcr3)rr�rEr�r�r)r�rrrsr9r�rrrr
Ls
cCshtj|�}yt|tj|d�|d�}Wn4tk
rX|dkrB|}n|}|j|pTtj��SX|j|||�S)N)rcr3)	r�rErr�r�rprrqr)r�rrrsr9rcr�rtrrrrWs
cCs
tt|�S)N)rr�)rorrrrcscCs
tt|�S)N)rr�)rorrrrfscCstt|||�S)N)r
r�)rrrsr9rrrriscCstt|||�S)N)rr�)rrrsr9rrrrls�r"�r#�r$r%�r&r'r(r)�r*r+�r,r-r.)r�r�r�r�r�r����)r�)NNF)NNNFN)NNN)N)N)N)0rr��ior�rr��sys�errnor�__all__r�r��base_prefixr��compile�VERBOSE�DOTALLrr r!rCr�rDrArPrXrerrrr�rrr�r�r�r	r
rrrr
rrrrrrrrrr�<module>1s\8



1$*K
&




mailbox.cpython-36.opt-2.pyc000064400000152375150335715140011606 0ustar003


 \ 3�@sNddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
Z
ddlZyddlZWne
k
r�dZYnXdddddddd	d
ddd
dddddgZejjd�ZGdd�d�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�dejj�ZGdd	�d	e�ZGd d!�d!e�ZGd"d
�d
e�ZGd#d�de�ZGd$d�de�ZGd%d
�d
e�Z Gd&d'�d'�Z!Gd(d)�d)e!�Z"d<d+d,�Z#d-d.�Z$d/d0�Z%d1d2�Z&d3d4�Z'd5d6�Z(Gd7d�de)�Z*Gd8d�de*�Z+Gd9d�de*�Z,Gd:d�de*�Z-Gd;d�de*�Z.dS)=�N�Mailbox�Maildir�mbox�MH�Babyl�MMDF�Message�MaildirMessage�mboxMessage�	MHMessage�BabylMessage�MMDFMessage�Error�NoSuchMailboxError�
NotEmptyError�ExternalClashError�FormatError�asciic@seZdZdBdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�ZdCdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�ZdDd/d0�Zd1d2�ZdEd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Zd=d>�Z d?Z!dFd@dA�Z"dS)GrNTcCs tjjtjj|��|_||_dS)N)�os�path�abspath�
expanduser�_path�_factory)�selfr�factory�create�r�/usr/lib64/python3.6/mailbox.py�__init__$szMailbox.__init__cCstd��dS)Nz&Method must be implemented by subclass)�NotImplementedError)r�messagerrr�add)szMailbox.addcCstd��dS)Nz&Method must be implemented by subclass)r )r�keyrrr�remove-szMailbox.removecCs|j|�dS)N)r$)rr#rrr�__delitem__1szMailbox.__delitem__cCs(y|j|�Wntk
r"YnXdS)N)r$�KeyError)rr#rrr�discard4szMailbox.discardcCstd��dS)Nz&Method must be implemented by subclass)r )rr#r!rrr�__setitem__;szMailbox.__setitem__cCs$y
|j|�Stk
r|SXdS)N)�__getitem__r&)rr#�defaultrrr�get?s
zMailbox.getc	Cs6|js|j|�Stj|j|���}|j|�SQRXdS)N)r�get_message�
contextlib�closing�get_file)rr#�filerrrr)Fs
zMailbox.__getitem__cCstd��dS)Nz&Method must be implemented by subclass)r )rr#rrrr,NszMailbox.get_messagecCstj|j|��j�S)N)�email�message_from_bytes�	get_bytes�	as_string)rr#rrr�
get_stringRszMailbox.get_stringcCstd��dS)Nz&Method must be implemented by subclass)r )rr#rrrr3YszMailbox.get_bytescCstd��dS)Nz&Method must be implemented by subclass)r )rr#rrrr/]szMailbox.get_filecCstd��dS)Nz&Method must be implemented by subclass)r )rrrr�iterkeysaszMailbox.iterkeyscCst|j��S)N)�listr6)rrrr�keyseszMailbox.keysccs@x:|j�D].}y||}Wntk
r0w
YnX|Vq
WdS)N)r6r&)rr#�valuerrr�
itervaluesiszMailbox.itervaluescCs|j�S)N)r:)rrrr�__iter__rszMailbox.__iter__cCst|j��S)N)r7r:)rrrr�valuesuszMailbox.valuesccsDx>|j�D]2}y||}Wntk
r0w
YnX||fVq
WdS)N)r6r&)rr#r9rrr�	iteritemsyszMailbox.iteritemscCst|j��S)N)r7r=)rrrr�items�sz
Mailbox.itemscCstd��dS)Nz&Method must be implemented by subclass)r )rr#rrr�__contains__�szMailbox.__contains__cCstd��dS)Nz&Method must be implemented by subclass)r )rrrr�__len__�szMailbox.__len__cCs x|j�D]}|j|�q
WdS)N)r8r')rr#rrr�clear�sz
Mailbox.clearcCs0y||}Wntk
r |SX|j|�|S)N)r&r')rr#r*�resultrrr�pop�s
zMailbox.popcCs*x$|j�D]}||j|�fSWtd��dS)NzNo messages in mailbox)r6rCr&)rr#rrr�popitem�szMailbox.popitemcCsxt|d�r|j�}nt|d�r(|j�}n|}d}x6|D].\}}y|||<Wq6tk
rbd}Yq6Xq6W|rttd��dS)Nr=r>FTzNo message with key(s))�hasattrr=r>r&)r�arg�sourceZbad_keyr#r!rrr�update�s



zMailbox.updatecCstd��dS)Nz&Method must be implemented by subclass)r )rrrr�flush�sz
Mailbox.flushcCstd��dS)Nz&Method must be implemented by subclass)r )rrrr�lock�szMailbox.lockcCstd��dS)Nz&Method must be implemented by subclass)r )rrrr�unlock�szMailbox.unlockcCstd��dS)Nz&Method must be implemented by subclass)r )rrrr�close�sz
Mailbox.closecCs,y
|jd�Stk
r&td��YnXdS)Nrz?String input must be ASCII-only; use bytes or a Message instead)�encode�UnicodeError�
ValueError)rr!rrr�_string_to_bytes�s
zMailbox._string_to_bytesFc	Cst|tjj�rxtj�}tjj||d�}|j|�|j	d�|j
�}|jdt�}|j
|�|jrt|jt�rt|j
t��n�t|tttjf��rt|tj�r�tjdtd�|j�}t|t�r�|j|�}|r�|jdd�}|jdt�}|j
|�|jo�|jt��r�|j
t�n�t|d��r�t|d��r4tjd	td�|j}d}x�|j�}|jd
��r`|dd�d}n|jd��r||dd�d}|�s�P|�r�|jd��r�d|dd�}|jdt�}|j
|�|}�q:W|j�r�|�r�|jt��r�|j
t�ntdt|���dS)Nr�
z8Use of StringIO input is deprecated, use BytesIO instead�s
From s
>From �read�bufferzDUse of text mode files is deprecated, use a binary mode file insteads
��
�sFrom s>From �zInvalid message type: %s������)�
isinstancer1r!r�io�BytesIO�	generator�BytesGenerator�flatten�seekrS�replace�linesep�write�_append_newline�endswith�str�bytes�StringIO�warnings�warn�DeprecationWarning�getvaluerPrErT�readline�
startswith�	TypeError�type)	rr!�targetZmangle_from_rT�gen�dataZlastline�linerrr�
_dump_message�sZ







zMailbox._dump_message)NT)N)N)N)F)#�__name__�
__module__�__qualname__rr"r$r%r'r(r+r)r,r5r3r/r6r8r:r;r<r=r>r?r@rArCrDrHrIrJrKrLrPrervrrrrr!s@

		
	
c@s�eZdZdZd5dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,Zd-d.�Zd/d0�Zd1d2�Zd3d4�ZdS)6r�:NTcCs�tj||||�tjj|jd�tjj|jd�tjj|jd�d�|_tjj|j�s�|r�tj|jd�x*|jj	�D]}tj|d�qnWn
t
|j��i|_ddd�|_d|_
d|_dS)	N�tmp�new�cur)r{r|r}i�r)r}r|g�������?)rrrr�joinr�_paths�exists�mkdirr<r�_toc�_toc_mtimes�
_last_read�_skewfactor)r�dirnamerrrrrrr
s
zMaildir.__init__cCs~|j�}y|j||�Wn*tk
rB|j�tj|j��YnXt|�t|t	�r||j
�}|j|j�}||jkr�d}nd}d}tj
j|j�j|j�d}tj
j|j|||�}t|t	�r�tj|jtj
j|j�|j�f�yLytj|j|�Wn(ttfk
�rtj|j|�YnXtj|j�WnNtk
�rx}z0tj|j�|jtjk�rftd|��n�WYdd}~XnX|S)N�r|rz$Name clash with existing message: %s)�_create_tmprv�
BaseExceptionrLrr$�name�_sync_closer[r	�
get_subdir�colon�get_infor�basename�splitr~r�utime�getatime�get_date�link�AttributeError�PermissionError�rename�OSError�errnoZEEXISTr)rr!Ztmp_file�subdir�suffix�uniq�dest�errrr"!sB



zMaildir.addcCs tjtjj|j|j|���dS)N)rr$rr~r�_lookup)rr#rrrr$KszMaildir.removecCs,y|j|�Wnttfk
r&YnXdS)N)r$r&�FileNotFoundError)rr#rrrr'OszMaildir.discardcCs�|j|�}|j|�}|j|�}t|t�r.|}n|}tjj|�}|j|kr`|j|j|j�d}nd}|j	|�tjj
|j|�}	tjj
|j|||�}
t|t�r�tj|	tjj
|	�|j�f�tj|	|
�dS)NrWr�rZ)r�r"r[r	rrr�r�r�r'r~rr�r�r�r�)rr#r!Zold_subpathZtemp_keyZtemp_subpathZdominant_subpathr�r�Ztmp_path�new_pathrrrr(Ws"






zMaildir.__setitem__cCs�|j|�}ttjj|j|�d�� }|jr4|j|�}nt|�}WdQRXtjj|�\}}|j	|�|j
|kr�|j|j|j
�d�|jtjj
tjj|j|���|S)N�rbrWrZ)r��openrrr~rrr	r��
set_subdirr��set_info�set_date�getmtime)rr#Zsubpath�f�msgr�r�rrrr,rs


zMaildir.get_messagec
Cs8ttjj|j|j|��d��}|j�jtd�SQRXdS)Nr�rQ)	r�rrr~rr�rSrbrc)rr#r�rrrr3�szMaildir.get_bytescCs$ttjj|j|j|��d�}t|�S)Nr�)r�rrr~rr��
_ProxyFile)rr#r�rrrr/�szMaildir.get_fileccsH|j�x:|jD]0}y|j|�Wntk
r8wYnX|VqWdS)N)�_refreshr�r�r&)rr#rrrr6�szMaildir.iterkeyscCs|j�||jkS)N)r�r�)rr#rrrr?�szMaildir.__contains__cCs|j�t|j�S)N)r��lenr�)rrrrr@�szMaildir.__len__cCsdS)Nr)rrrrrI�sz
Maildir.flushcCsdS)Nr)rrrrrJ�szMaildir.lockcCsdS)Nr)rrrrrK�szMaildir.unlockcCsdS)Nr)rrrrrL�sz
Maildir.closecCs`g}xVtj|j�D]F}t|�dkr|ddkrtjjtjj|j|��r|j|dd��qW|S)NrWr�.)r�listdirrr�r�isdirr~�append)rrB�entryrrr�list_folders�szMaildir.list_folderscCs ttjj|jd|�|jdd�S)Nr�F)rr)rrrr~rr)r�folderrrr�
get_folder�szMaildir.get_foldercCs\tjj|jd|�}t||jd�}tjj|d�}tjj|�sXtjtj|tj	tj
Bd��|S)Nr�)rZ
maildirfolderi�)rrr~rrrr�rLr��O_CREAT�O_WRONLY)rr�rrBZmaildirfolder_pathrrr�
add_folder�szMaildir.add_foldercCs,tjj|jd|�}xTtjtjj|d��tjtjj|d��D](}t|�dksZ|ddkr>td|��q>WxPtj|�D]B}|dkrv|dkrv|dkrvtjjtjj||��rvtd||f��qvWx`tj|d	d
�D]N\}}}x |D]}tj	tjj||��q�Wx |D]}tj
tjj||��q�Wq�Wtj
|�dS)Nr�r|r}rWrzFolder contains message(s): %sr{z%Folder contains subdirectory '%s': %sF)�topdown)rrr~rr�r�rr��walkr$�rmdir)rr�rr��root�dirs�filesrrr�
remove_folder�s 

zMaildir.remove_foldercCs\tj�}xNtjtjj|jd��D]4}tjj|jd|�}|tjj|�dkr tj|�q WdS)Nr{i@�)�timerr�rr~rr�r$)r�nowr�rrrr�clean�s
z
Maildir.cleanrWcCs�tj�}tj�}d|kr$|jdd�}d|kr8|jdd�}dt|�t|dd�tj�tj|f}tj	j
|jd|�}ytj|�Wn@t
k
r�tjd7_yt|�Stk
r�YnXYnXtd	|��dS)
N�/z\057rzz\072z%s.M%sP%sQ%s.%srWg��.Ar{z&Name clash prevented file creation: %s)r��socket�gethostnamerb�intr�getpidr�_countrr~r�statr��_create_carefully�FileExistsErrorr)rr�Zhostnamer�rrrrr��s&zMaildir._create_tmpcCs�tj�|jd|jkrbd}x<|jD]2}tjj|j|�}||j|krLd}||j|<q$W|sbdSi|_xl|jD]b}|j|}xRtj	|�D]D}tjj
||�}tjj|�r�q�|j|j
�d}tjj
||�|j|<q�WqpWtj�|_dS)NrUFTr)r�r�r�r�rrr�rr�r�r~r�r�r�)rZrefreshr��mtimerr��pr�rrrr��s&
zMaildir._refreshcCszy,tjjtjj|j|j|��r*|j|SWntk
r@YnX|j�y
|j|Stk
rttd|��YnXdS)NzNo message with key: %s)rrr�r~rr�r&r�)rr#rrrr�#s
zMaildir._lookupcCsVt|d�s|j�|_x<y|t|j�Stk
r8dStk
rLwYqXqWdS)N�
_onetime_keys)rEr6r��next�
StopIterationr&)rrrrr�1s

zMaildir.next)NT)rwrxryr�rr"r$r'r(r,r3r/r6r?r@rIrJrKrLr�r�r�r�r�r�r�r�r�r�rrrrrs4
*
	
$c@s�eZdZd#dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd$dd �Zd!d"�ZdS)%�_singlefileMailboxNTcCs�tj||||�yt|jd�}Wnntk
r�}zR|jtjkr\|rPt|jd�}q~t|j��n"|jtjtj	fkr|t|jd�}n�WYdd}~XnX||_
d|_d|_d|_
d|_d|_d|_dS)Nzrb+zwb+r�rF)rrr�rr�r��ENOENTr�EACCES�EROFS�_filer��	_next_key�_pending�
_pending_sync�_locked�_file_length)rrrrr�r�rrrrAs$z_singlefileMailbox.__init__cCs8|j�|j|�|j|j<|jd7_d|_|jdS)NrWT)r��_append_messager�r�r�)rr!rrrr"Xs
z_singlefileMailbox.addcCs|j|�|j|=d|_dS)NT)r�r�r�)rr#rrrr$bs
z_singlefileMailbox.removecCs$|j|�|j|�|j|<d|_dS)NT)r�r�r�r�)rr#r!rrrr(hs
z_singlefileMailbox.__setitem__ccs|j�|jj�EdHdS)N)r�r�r8)rrrrr6nsz_singlefileMailbox.iterkeyscCs|j�||jkS)N)r�r�)rr#rrrr?ssz_singlefileMailbox.__contains__cCs|j�t|j�S)N)r�r�r�)rrrrr@xsz_singlefileMailbox.__len__cCs|jst|j�d|_dS)NT)r��
_lock_filer�)rrrrrJ}s
z_singlefileMailbox.lockcCs|jrt|j�d|_dS)NF)r��_unlock_filer�)rrrrrK�s
z_singlefileMailbox.unlockc
Cs�|js |jrt|j�d|_dS|jjdd�|jj�}||jkrTtd|j|f��t|j	�}y�i}|j
|�x�t|jj
��D]|}|j|\}}|jj|�|j|�|j�}x0|jjtd||jj���}|s�P|j|�q�W||j�f||<|j|�q~W|j�|_Wn"|j�tj|j��YnXt|�|jj�tj|j	�j}	tj|j|	�ytj|j|j	�Wn2tk
�r�tj|j	�tj|j|j	�YnXt|j	d�|_||_d|_d|_|j�r�t|jdd�dS)NFrrUz4Size of mailbox file changed (expected %i, found %i)izrb+)�dotlock) r�r��_sync_flushr�ra�tellr�r�_create_temporaryr�_pre_mailbox_hook�sortedr�r8�_pre_message_hookrS�minrd�_post_message_hookrLrr$r�r�r��st_mode�chmodr�r�r�r�r�)
rZcur_lenZnew_fileZnew_tocr#�start�stopZ	new_startrT�moderrrrI�s^
	






z_singlefileMailbox.flushcCsdS)Nr)rr�rrrr��sz$_singlefileMailbox._pre_mailbox_hookcCsdS)Nr)rr�rrrr��sz$_singlefileMailbox._pre_message_hookcCsdS)Nr)rr�rrrr��sz%_singlefileMailbox._post_message_hookcCs4z|j�Wdz|jr|j�Wd|jj�XXdS)N)rIr�rKr�rL)rrrrrL�sz_singlefileMailbox.closecCsJ|jdkr|j�|dk	rFy
|j|Stk
rDtd|��YnXdS)NzNo message with key: %s)r��
_generate_tocr&)rr#rrrr��s

z_singlefileMailbox._lookupcCs�|jjdd�|jj�}t|j�dkr:|jr:|j|j�y&|j|j�|j|�}|j	|j�Wn"t
k
r�|jj|��YnX|jj�|jj�|_
|S)NrrU)r�rar�r�r�r�r�r��_install_messager�r��truncaterIr�)rr!ZbeforeZoffsetsrrrr��s


z"_singlefileMailbox._append_message)NT)N)rwrxryrr"r$r(r6r?r@rJrKrIr�r�r�rLr�r�rrrrr�>s 

@

r�c@s>eZdZdZdd�Zddd�Zddd�Zdd	d
�Zdd�Zd
S)�	_mboxMMDFTcCsp|j|�\}}|jj|�|jj�jtd�}|jj||jj��}|j|jtd��}|j	|dd�j
d��|S)N�rQrXr)r�r�rarnrbrcrSr��_message_factory�set_from�decode)rr#r�r��	from_line�stringr�rrrr,sz_mboxMMDF.get_messageFcCstj|j|��j|d�S)N)�unixfrom)r1r2r3r4)rr#�from_rrrr5sz_mboxMMDF.get_stringcCsJ|j|�\}}|jj|�|s(|jj�|jj||jj��}|jtd�S)NrQ)r�r�rarnrSr�rbrc)rr#r�r�r�r�rrrr3s
z_mboxMMDF.get_bytescCs<|j|�\}}|jj|�|s(|jj�t|j|jj�|�S)N)r�r�rarn�_PartialFiler�)rr#r�r�r�rrrr/s

z_mboxMMDF.get_filecCsd}t|t�r|j|�}t|t�rf|jd�rf|jd�}|dkr\|d|�}||dd�}q�|}d}nJt|t�r�|j�jd�}d|}n(t|t	j
j�r�|j�}|dk	r�|jd�}|dkr�dt
jt
j��j�}|jj�}|jj|t�|j||j|j�|jj�}||fS)NsFrom rQrWr�rsFrom MAILER-DAEMON rZ)r[rgrPrhro�find�_mboxMMDFMessage�get_fromrMr1r!r�get_unixfromr��asctime�gmtimer�r�rdrcrv�
_mangle_from_)rr!r��newlineZauthorr�r�rrrr�&s0







z_mboxMMDF._install_messageN)F)F)F)	rwrxryr�r,r5r3r/r�rrrrr�s


	
r�c@s.eZdZdZdZd	dd�Zdd�Zdd�ZdS)
rTNcCst|_tj||||�dS)N)r
r�r�r)rrrrrrrrLsz
mbox.__init__cCs|jt�dS)N)rdrc)rr�rrrr�Qszmbox._post_message_hookcCs�gg}}d}|jjd�x�|jj�}|jj�}|jd�r|t|�t|�krl|rb|j|tt��n
|j|�|j|�d}q|s�|r�|j|tt��n
|j|�Pq|tkr�d}qd}qWtt	t
||���|_t|j�|_|jj�|_
dS)NFrsFrom T)r�rar�rnror�r�rc�dict�	enumerate�zipr�r�r�)r�starts�stopsZlast_was_empty�line_posrurrrr�Us0






zmbox._generate_toc)NT)rwrxryr�rerr�r�rrrrrCs

c@s.eZdZddd�Zdd�Zdd�Zd	d
�ZdS)rNTcCst|_tj||||�dS)N)r
r�r�r)rrrrrrrrzsz
MMDF.__init__cCs|jdt�dS)Ns)rdrc)rr�rrrr�szMMDF._pre_message_hookcCs|jtdt�dS)Ns)rdrc)rr�rrrr��szMMDF._post_message_hookcCs�gg}}|jjd�d}x�|}|jj�}|jj�}|jdt�r�|j|�xV|}|jj�}|jj�}|dtkr�|j|tt��PqN|sN|j|�PqNWq|sPqWtt	t
||���|_t|j�|_|jjdd�|jj�|_
dS)NrsrU)r�rarnr�rorcr�r�rrrr�r�r�)rrr�next_posrrurrrr��s2






zMMDF._generate_toc)NT)rwrxryrr�r�r�rrrrrws
c@s�eZdZd/dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�ZdS)0rNTcCsttj||||�tjj|j�sj|r`tj|jd�tjtjtjj	|jd�tj
tjBtjBd��n
t
|j��d|_dS)Ni�z
.mh_sequencesi�F)rrrrr�rr�rLr�r~r��O_EXCLr�rr�)rrrrrrrr�s
zMH.__init__cCs�|j�}t|�dkrd}nt|�d}tjj|jt|��}t|�}d}z�|j	rVt
|�zfy|j||�Wn:tk
r�|j	r�t
|�t|�d}tj|��YnXt|t�r�|j||�Wd|j	r�t
|�XWd|s�t|�X|S)NrrWFT)r8r��maxrrr~rrgr�r�r�rvr�r�r�r$r[r�_dump_sequences)rr!r8Znew_keyr�r��closedrrrr"�s6


zMH.addcCsxtjj|jt|��}yt|d�}Wn>tk
r`}z"|jtjkrNt	d|��n�WYdd}~XnX|j
�tj|�dS)Nzrb+zNo message with key: %s)rrr~rrgr�r�r�r�r&rLr$)rr#rr�r�rrrr$�sz	MH.removecCs�tjj|jt|��}yt|d�}Wn>tk
r`}z"|jtjkrNt	d|��n�WYdd}~XnXzd|j
rrt|�z@tjtj|tj
tjB��|j||�t|t�r�|j||�Wd|j
r�t|�XWdt|�XdS)Nzrb+zNo message with key: %s)rrr~rrgr�r�r�r�r&r�r�rLr��O_TRUNCrvr[rr	r�r�)rr#r!rr�r�rrrr(�s$
zMH.__setitem__c Cs�y@|jr$ttjj|jt|��d�}nttjj|jt|��d�}Wn>tk
r~}z"|jtj	krlt
d|��n�WYdd}~XnX|�2|jr�t|�zt|�}Wd|jr�t
|�XWdQRXx*|j�j�D]\}}||kr�|j|�q�W|S)Nzrb+r�zNo message with key: %s)r�r�rrr~rrgr�r�r�r&r�rr��
get_sequencesr>�add_sequence)rr#r�r�r�r��key_listrrrr,�s&zMH.get_messagec Cs�y@|jr$ttjj|jt|��d�}nttjj|jt|��d�}Wn>tk
r~}z"|jtj	krlt
d|��n�WYdd}~XnX|�6|jr�t|�z|j�j
td�S|jr�t|�XWdQRXdS)Nzrb+r�zNo message with key: %srQ)r�r�rrr~rrgr�r�r�r&r�rSrbrcr�)rr#r�r�rrrr3szMH.get_bytescCsfyttjj|jt|��d�}Wn>tk
r\}z"|jtjkrJt	d|��n�WYdd}~XnXt
|�S)Nr�zNo message with key: %s)r�rrr~rrgr�r�r�r&r�)rr#r�r�rrrr/)szMH.get_filecCsttdd�tj|j�D���S)Ncss|]}|j�rt|�VqdS)N)�isdigitr�)�.0r�rrr�	<genexpr>6szMH.iterkeys.<locals>.<genexpr>)�iterr�rr�r)rrrrr64szMH.iterkeyscCstjjtjj|jt|���S)N)rrr�r~rrg)rr#rrrr?9szMH.__contains__cCstt|j���S)N)r�r7r6)rrrrr@=sz
MH.__len__cCs2|js.ttjj|jd�d�|_t|j�d|_dS)Nz
.mh_sequenceszrb+T)r�r�rrr~rr�r�)rrrrrJAs
zMH.lockcCs(|jr$t|j�t|j�|`d|_dS)NF)r�r�r�r�)rrrrrKHs


z	MH.unlockcCsdS)Nr)rrrrrIPszMH.flushcCs|jr|j�dS)N)r�rK)rrrrrLTszMH.closecCs@g}x6tj|j�D]&}tjjtjj|j|��r|j|�qW|S)N)rr�rrr�r~r�)rrBr�rrrr�Ys
zMH.list_folderscCsttjj|j|�|jdd�S)NF)rr)rrrr~rr)rr�rrrr�asz
MH.get_foldercCsttjj|j|�|jd�S)N)r)rrrr~rr)rr�rrrr�fsz
MH.add_foldercCs`tjj|j|�}tj|�}|dgkr:tjtjj|d��n|gkrDntd|j��tj|�dS)Nz
.mh_sequenceszFolder not empty: %s)rrr~rr�r$rr�)rr�rZentriesrrrr�ks

zMH.remove_folderc
si}ttjj|jd�ddd���}t|j���x�|D]�}y�|jd�\}}t�}xT|j�D]H}|j�rr|j	t
|��qVdd�|jd�D�\}}	|jt||	d	��qVW�fd
d�t
|�D�||<t||�dkr�||=Wq2tk
r�td
|j���Yq2Xq2WWdQRX|S)Nz
.mh_sequences�r�ASCII)�encodingrzcss|]}t|�VqdS)N)r�)r�xrrrr�sz#MH.get_sequences.<locals>.<genexpr>�-rWcsg|]}|�kr|�qSrr)rr#)�all_keysrr�
<listcomp>�sz$MH.get_sequences.<locals>.<listcomp>rz"Invalid sequence specification: %s)r�rrr~r�setr8r�rr"r�rH�ranger�r�rOr�rstrip)
rZresultsr�rur��contentsr8�specr�r�r)rrrws&

 zMH.get_sequencescCs
ttjj|jd�ddd�}z�tjtj|jtjtjB��x�|j	�D]�\}}t
|�dkrXqB|j|d�d}d}xbtt
|��D]R}|d|kr�|s�d	}|jd
�n*|r�d}|jd||f�n|jd|�|}q|W|r�|jt|�d
�qB|jd
�qBWWdt|�XdS)Nz
.mh_sequenceszr+r)rrrzFrWTrz%s %sz %s�
)r�rrr~rrLr�r�rr>r�rdr�rrgr�)r�	sequencesr�r�r8�prevZ
completingr#rrr�
set_sequences�s.zMH.set_sequencesc	CsL|j�}d}g}x�|j�D]�}|d|kr�|j||df�y4tjtjj|jt|��tjj|jt|d���WnHt	t
fk
r�tjtjj|jt|��tjj|jt|d���YnXtjtjj|jt|���|d7}qW|d|_
t|�dkr�dSxB|j�D]6\}}x*|D]"\}}||k�r|||j|�<�qW�qW|j|�dS)NrrW)rr6r�rr�rr~rrgr�r�r��unlinkr�r�r>�indexr")	rr r!Zchangesr#r�r�oldr|rrr�pack�s, 

zMH.packcCs||j�}|j�}x<|j�D]0\}}||kr6|j|�q||kr||j|�=qWx|D]}||krT|g||<qTW|j|�dS)N)rr>r�r$r")rr!r#Zpending_sequencesZ
all_sequencesr�r�sequencerrrr	�s
zMH._dump_sequences)NT)rwrxryrr"r$r(r,r3r/r6r?r@rJrKrIrLr�r�r�r�rr"r&r	rrrrr�s,
"c@s�eZdZedddddddh�Zd$d
d�Zdd
�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd d!�Zd"d#�ZdS)%r�unseen�deletedZfiled�answered�	forwardedZedited�resentNTcCstj||||�i|_dS)N)r�r�_labels)rrrrrrrr�szBabyl.__init__cCs(tj||�}t|t�r$|j�|j|<|S)N)r�r"r[r�
get_labelsr-)rr!r#rrrr"�s
z	Babyl.addcCs"tj||�||jkr|j|=dS)N)r�r$r-)rr#rrrr$�s
zBabyl.removecCs*tj|||�t|t�r&|j�|j|<dS)N)r�r(r[rr.r-)rr#r!rrrr(�s
zBabyl.__setitem__c
Cs�|j|�\}}|jj|�|jj�tj�}x4|jj�}|dtksJ|rLP|j|jtd��q.Wtj�}x0|jj�}|tks�|r�P|j|jtd��qlW||jj	�}|jj
|�}|jtd�}t|j�|�}	|	j
|j��||jkr�|	j|j|�|	S)Ns*** EOOH ***rQ)r�r�rarnr\r]rcrdrbr�rSrrm�set_visibler-�
set_labels)
rr#r�r��original_headersruZvisible_headers�nZbodyr�rrrr,�s.



zBabyl.get_messagec	Cs�|j|�\}}|jj|�|jj�tj�}x4|jj�}|dtksJ|rLP|j|jtd��q.Wx|jj�}|tks||rdPqdW|j	�}||jj
�}|jj|�}|jtd�}||S)Ns*** EOOH ***rQ)r�r�rarnr\r]rcrdrbrmr�rS)	rr#r�r�r1ruZheadersr2rtrrrr3s$


zBabyl.get_bytescCstj|j|�jdt��S)NrQ)r\r]r3rbrc)rr#rrrr/%szBabyl.get_filecCs@|j�t�}x|jj�D]}|j|�qW|j|j�t|�S)N)r�rr-r<rH�difference_update�_special_labelsr7)r�labelsZ
label_listrrrr.)szBabyl.get_labelscCs>gg}}|jjd�d}g}x�|}|jj�}|jj�}|dtkr�t|�t|�krf|j|tt��|j|�dd�|jj�dd�jd�D�}|j|�q |dks�|dtkr�t|�t|�kr�|j|tt��q |s |j|tt��Pq Wtt	t
||���|_tt	|��|_t|j�|_
|jjdd�|jj�|_dS)	NrscSsg|]}|j�r|j��qSr)�strip)r�labelrrrr@sz'Babyl._generate_toc.<locals>.<listcomp>rW�,�rU)r�rarnr�rcr�r�r�rrrr�r-r�r�)rrrrZlabel_listsrrur5rrrr�2s4



zBabyl._generate_toccCsVdt}|dt7}|j�}dd�|D�}|ddj|�t7}|d7}|j|�dS)NsBABYL OPTIONS:s
Version: 5css|]}|j�VqdS)N)rM)rr7rrrrUsz*Babyl._pre_mailbox_hook.<locals>.<genexpr>sLabels:r8r9)rcr.r~rd)rr�Zbabylr5rrrr�PszBabyl._pre_mailbox_hookcCs|jdt�dS)N�)rdrc)rr�rrrr�ZszBabyl._pre_message_hookcCs|jtd�dS)Nr9)rdrc)rr�rrrr�^szBabyl._post_message_hookcCs�|jj�}t|t�r�g}g}x0|j�D]$}||jkr@|j|�q&|j|�q&W|jjd�x |D]}|jjd|j��q`W|jjd�x$|D]}|jjd|j�d�q�W|jjt	�n|jjdt	�t|t
jj��r0t
j�}t
jj|dd�}|j|�|jd�x6|j�}|jj|jd	t	��|d	k�s8|�r
P�q
W|jjd
t	�t|t��r�t
j�}	t
jj|	dd�}
|
j|j��xz|	j�}|jj|jd	t	��|d	k�s�|�r�P�q�WnB|jd�x6|j�}|jj|jd	t	��|d	k�s�|�r�P�q�Wx,|jd�}|�sP|jj|jd	t	���qW�nZt|ttt
jf��r,t|t
j��rhtjdtd
�|j�}t|t��r~|j|�}|jd�d}|ddk�r|jj|d|�jd	t	��|jjd
t	�|jj|d|�jd	t	��|jj||d�jd	t	��n(|jjd
t	t	�|jj|jd	t	���n^t |d��rzt |d��rXtjdtd
�|j!}|j�}
d}x�|j�}|j"d��r�|dd�d	}n|j"d��r�|dd�d	}|jj|jd	t	��|d	k�s�|�rf|�r�d}|jjd
t	�|j|
�nP�qfWx�|j�}|�sP|j"d��r,|dd�t	}n:|j"d��rJ|dd�t	}n|j"d	��rf|dd�t	}|jj|��q�Wnt#dt$|���|jj�}||fS)N�1s, s,,� r8s1,,FrrQs*** EOOH ***iz8Use of StringIO input is deprecated, use BytesIO insteadrRs

rUrWrnrTzDUse of text mode files is deprecated, use a binary mode file insteadTs
rVzInvalid message type: %srZrYrZrYrZrZ)%r�r�r[rr.r4r�rdrMrcr1r!rr\r]r^r_r`rarnrb�get_visiblerSrhrgrirjrkrlrmrPr�rErTrfrprq)rr!r�Zspecial_labelsr5r7Zorig_bufferZorig_generatorruZ
vis_bufferZ
vis_generatorrTZ
body_startZoriginal_posZ
first_passr�rrrr�bs�











zBabyl._install_message)NT)rwrxry�	frozensetr4rr"r$r(r,r3r/r.r�r�r�r�r�rrrrr�s

	
c@s&eZdZddd�Zdd�Zdd�ZdS)	rNcCs�t|tjj�r4|jtj|��t|t�r�|j|�n�t|t�rP|jtj	|��n~t|t
�rl|jtj|��nbt|tj
�r�|jtj|��nDt|d�r�|jtj|��n(|dkr�tjjj|�ntdt|���dS)NrSzInvalid message type: %s)r[r1r!r�_become_message�copy�deepcopy�_explain_torhr2rgZmessage_from_stringr\�
TextIOWrapperZmessage_from_filerEZmessage_from_binary_filerrprq)rr!rrrr�s



zMessage.__init__cCs8t|dg�}x&|jD]}||kr|j||j|<qWdS)N�_type_specific_attributes)�getattr�__dict__)rr!Z
type_specificr�rrrr?�szMessage._become_messagecCst|t�rdStd��dS)Nz Cannot convert to specified type)r[rrp)rr!rrrrB�s
zMessage._explain_to)N)rwrxryrr?rBrrrrr�s
c@sxeZdZdddgZddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)r	�_subdir�_info�_dateNcCs&d|_d|_tj�|_tj||�dS)Nr|r�)rGrHr�rIrr)rr!rrrr�s
zMaildirMessage.__init__cCs|jS)N)rG)rrrrr��szMaildirMessage.get_subdircCs(|dks|dkr||_ntd|��dS)Nr|r}z!subdir must be 'new' or 'cur': %s)rGrO)rr�rrrr�szMaildirMessage.set_subdircCs"|jjd�r|jdd�SdSdS)Nz2,rUr�)rHro)rrrr�	get_flags
szMaildirMessage.get_flagscCsddjt|��|_dS)Nz2,r�)r~r�rH)r�flagsrrr�	set_flagsszMaildirMessage.set_flagscCs$|jdjt|j��t|�B��dS)Nr�)rLr~rrJ)r�flagrrr�add_flagszMaildirMessage.add_flagcCs,|j�r(|jdjt|j��t|���dS)Nr�)rJrLr~r)rrMrrr�remove_flagszMaildirMessage.remove_flagcCs|jS)N)rI)rrrrr�szMaildirMessage.get_datecCs4yt|�|_Wn tk
r.td|��YnXdS)Nzcan't convert to float: %s)�floatrIrOrp)rZdaterrrr�"szMaildirMessage.set_datecCs|jS)N)rH)rrrrr�)szMaildirMessage.get_infocCs&t|t�r||_ntdt|���dS)Nzinfo must be a string: %s)r[rgrHrprq)r�inforrrr�-s
zMaildirMessage.set_infocCs�t|t�r8|j|j��|j|j��|j|j���nht|t�r�t	|j��}d|kr`|j
d�|j�dkrv|j
d�d|kr�|j
d�d|kr�|j
d�d|kr�|j
d�|jd	tj
|j���n�t|t��rt	|j��}d|kr�|jd
�d|k�r|jd�d|k�r�|jd�n�t|t��r�t	|j��}d|k�rD|jd
�d|k�rX|jd
�d|k�rl|jd�d|k�r�|jd�nt|t��r�ntdt|���dS)N�S�Rr}�O�T�D�F�Az
MAILER-DAEMONr(�replied�flaggedr)r*�Pr+z$Cannot convert to specified type: %s)r[r	rLrJr�r�r�r�r�rrNr�r�r�rr
r�	add_labelrrprq)rr!rKrrrrB4sN

















zMaildirMessage._explain_to)N)rwrxryrDrr�r�rJrLrNrOr�r�r�r�rBrrrrr	�s

c@sVeZdZdgZddd�Zdd�Zddd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)r��_fromNcCsV|jdd�t|tjj�rF|j�}|dk	rF|jd�rF|j|dd��tj||�dS)Nz
MAILER-DAEMONTzFrom rX)r�r[r1r!rr�ror)rr!r�rrrresz_mboxMMDFMessage.__init__cCs|jS)N)r])rrrrr�nsz_mboxMMDFMessage.get_fromcCs4|dk	r*|dkrtj�}|dtj|�7}||_dS)NT� )r�r�r�r])rr�Ztime_rrrr�rs
z_mboxMMDFMessage.set_fromcCs|jdd�|jdd�S)N�Statusr�zX-Status)r+)rrrrrJzsz_mboxMMDFMessage.get_flagscCs�t|�}d	\}}x&d
D]}||kr||7}|j|�qWx&dD]}||kr>||7}|j|�q>W|djt|��7}y|jd|�Wn tk
r�|jd|�YnXy|jd|�Wn tk
r�|jd|�YnXdS)Nr�rSrTrVrWrXr_zX-Status)r�r�)rSrT)rVrWrX)rr$r~r��replace_headerr&Z
add_header)rrKZstatus_flagsZ
xstatus_flagsrMrrrrL~s&

z_mboxMMDFMessage.set_flagscCs$|jdjt|j��t|�B��dS)Nr�)rLr~rrJ)rrMrrrrN�sz_mboxMMDFMessage.add_flagcCs4d|ksd|kr0|jdjt|j��t|���dS)Nr_zX-Statusr�)rLr~rrJ)rrMrrrrO�sz_mboxMMDFMessage.remove_flagcCs�t|t�r�t|j��}d|kr(|jd�d|kr:|jd�d|krL|jd�d|kr^|jd�d|krp|jd�|d	=|d
=dj|j�j�dd��}y|j	t
jtj
|d
���Wnttfk
r�YnX�n
t|t�r�|j|j��|j|j��n�t|t��rZt|j��}d|k�r$|jd�d|k�r8|jd�d|k�rL|jd�|d	=|d
=n�t|t��r�t|j��}d|k�r�|jd�d|k�r�|jd�d|k�r�|jd�|d	=|d
=nt|t��r�ntdt|���dS)NrTr}rWrXrSrRrVrUZstatuszx-statusr^rXz%a %b %d %H:%M:%S %Yr(rYrZr)r*z$Cannot convert to specified type: %s���)r[r	rrJr�rNr~r�r�r��calendarZtimegmr�ZstrptimerO�
OverflowErrorr�rLr�rr
rr\rrprq)rr!rKZ
maybe_daterrrrB�s^



















z_mboxMMDFMessage._explain_to)N)N)rwrxryrDrr�r�rJrLrNrOrBrrrrr�`s
	
r�c@seZdZdS)r
N)rwrxryrrrrr
�sc@sDeZdZdgZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)r�
_sequencesNcCsg|_tj||�dS)N)rdrr)rr!rrrr�szMHMessage.__init__cCs|jdd�S)N)rd)rrrrr�szMHMessage.get_sequencescCst|�|_dS)N)r7rd)rr rrrr"�szMHMessage.set_sequencescCs6t|t�r"||jkr2|jj|�ntdt|���dS)Nzsequence type must be str: %s)r[rgrdr�rprq)rr'rrrr
�s

zMHMessage.add_sequencecCs*y|jj|�Wntk
r$YnXdS)N)rdr$rO)rr'rrr�remove_sequence�szMHMessage.remove_sequencecCsJt|t�rdt|j��}d|kr*|jd�n|jd�|jd�d|krP|jd�d|krb|jd�n�t|t�r�t|j��}d|kr�|jd�n
|jd	�d|kr�|jd�d|kr�|jd
�n�t|t�r�x||j�D]}|j|�q�Wn`t|t	��r(t|j��}d|k�r|j
d�d|k�rF|j
d�nt|t��r6ntdt
|���dS)
Nr(r}rRrZrWrYrS�ROrTrXr*z$Cannot convert to specified type: %s)r[r	rrr�rNr�rr
rr\rrprq)rr!r r'rrrrB�s@










zMHMessage._explain_to)N)
rwrxryrDrrr"r
rerBrrrrr�s
c@s^eZdZddgZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�ZdS)rr-�_visibleNcCsg|_t�|_tj||�dS)N)r-rrgr)rr!rrrr"szBabylMessage.__init__cCs|jdd�S)N)r-)rrrrr.(szBabylMessage.get_labelscCst|�|_dS)N)r7r-)rr5rrrr0,szBabylMessage.set_labelscCs6t|t�r"||jkr2|jj|�ntdt|���dS)Nzlabel must be a string: %s)r[rgr-r�rprq)rr7rrrr\0s

zBabylMessage.add_labelcCs*y|jj|�Wntk
r$YnXdS)N)r-r$rO)rr7rrr�remove_label8szBabylMessage.remove_labelcCs
t|j�S)N)rrg)rrrrr=?szBabylMessage.get_visiblecCst|�|_dS)N)rrg)rZvisiblerrrr/CszBabylMessage.set_visiblecCsjx6|jj�D](}||kr,|jj|||�q|j|=qWx,dD]$}||kr>||jkr>|||j|<q>WdS)N�Date�From�Reply-To�To�CC�Subject)rirjrkrlrmrn)rgr8r`)r�headerrrr�update_visibleGs
zBabylMessage.update_visiblecCsvt|t�r~t|j��}d|kr*|jd�n|jd�|jd�d|ksNd|krX|jd�d|krj|jd�d	|kr||jd
�n�t|t�r�t|j��}d|kr�|jd�n
|jd�d	|kr�|jd
�d|kr�|jd�n�t|t��rt|j��}d|k�r|jd�d|k�rr|jd�nXt|t	��rT|j
|j��x<|j�D]}|j|��q>Wnt|t
��rbntdt|���dS)Nr(r}rRr+r,r[r*rSr)rUrfrTrVrXrYz$Cannot convert to specified type: %s)r[r	rr.r�rNr�rr
rr/r=r\rrprq)rr!r5r7rrrrBRsF










zBabylMessage._explain_to)N)
rwrxryrDrr.r0r\rhr=r/rprBrrrrrs
c@seZdZdS)r
N)rwrxryrrrrr
|sc@s�eZdZd%dd�Zd&dd�Zd'dd�Zd(dd	�Zd)d
d�Zdd
�Zdd�Z	d*dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �Zd!d"�Zed#d$��ZdS)+r�NcCs$||_|dkr|j�|_n||_dS)N)r�r��_pos)rr��posrrrr�sz_ProxyFile.__init__cCs|j||jj�S)N)�_readr�rS)r�sizerrrrS�sz_ProxyFile.readcCs|j||jj�S)N)rsr��read1)rrtrrrru�sz_ProxyFile.read1cCs|j||jj�S)N)rsr�rn)rrtrrrrn�sz_ProxyFile.readlinecCs>g}x4|D],}|j|�|dk	r
|t|�8}|dkr
Pq
W|S)Nr)r�r�)r�sizehintrBrurrr�	readlines�s

z_ProxyFile.readlinesccs x|j�}|sdS|VqWdS)N)rn)rrurrrr;�s
z_ProxyFile.__iter__cCs|jS)N)rq)rrrrr��sz_ProxyFile.tellrcCs4|dkr|jj|j�|jj||�|jj�|_dS)NrW)r�rarqr�)r�offset�whencerrrra�sz_ProxyFile.seekc
Cs0t|d�r,zt|jd�r"|jj�Wd|`XdS)Nr�rL)rEr�rL)rrrrrL�s

z_ProxyFile.closecCs2|dkrd}|jj|j�||�}|jj�|_|S)NrWrZ)r�rarqr�)rrt�read_methodrBrrrrs�sz_ProxyFile._readcCs|S)Nr)rrrr�	__enter__�sz_ProxyFile.__enter__cGs|j�dS)N)rL)r�excrrr�__exit__�sz_ProxyFile.__exit__cCs
|jj�S)N)r��readable)rrrrr~�sz_ProxyFile.readablecCs
|jj�S)N)r��writable)rrrrr�sz_ProxyFile.writablecCs
|jj�S)N)r��seekable)rrrrr��sz_ProxyFile.seekablecCs
|jj�S)N)r�rI)rrrrrI�sz_ProxyFile.flushcCs&t|d�sdSt|jd�sdS|jjS)Nr�Tr
F)rEr�r
)rrrrr
�s

z_ProxyFile.closed)N)N)N)N)N)r)rwrxryrrSrurnrwr;r�rarLrsr{r}r~rr�rI�propertyr
rrrrr��s"





		r�c@s8eZdZd
dd�Zdd�Zddd�Zd	d
�Zdd�ZdS)r�NcCstj|||�||_||_dS)N)r�r�_start�_stop)rr�r�r�rrrr�sz_PartialFile.__init__cCstj|�|jS)N)r�r�r�)rrrrr��sz_PartialFile.tellrcCs<|dkr|j|_d}n|dkr*|j|_d}tj|||�dS)NrrWrU)r�rqr�r�ra)rrxryrrrra�sz_PartialFile.seekcCsB|j|j}|dkrdS|dks0|dks0||kr4|}tj|||�S)Nrr�)r�rqr�rs)rrtrzZ	remainingrrrrs�sz_PartialFile._readcCst|d�r|`dS)Nr�)rEr�)rrrrrLs
z_PartialFile.close)NN)r)rwrxryrr�rarsrLrrrrr��s



	r�Tc4Cs�d}�yZtrpytj|tjtjB�WnJtk
rn}z.|jtjtjtjfkr\t	d|j
��n�WYdd}~XnX|�r^yt|j
d�}|j�Wn:tk
r�}z|jtjtjfkr�dS�WYdd}~XnXy`yt
j|j
|j
d�d}Wn2ttfk
�rt
j|j
|j
d�d}YnXt
j|j
�Wn0tk
�r\t
j|j
�t	d|j
��YnXWn8t�r|tj|tj�|�r�t
j|j
d��YnXdS)NFzlockf: lock unavailable: %sz.lockTzdot lock unavailable: %s)�fcntl�lockfZLOCK_EXZLOCK_NBr�r�ZEAGAINr�r�rr�r�rLrr�r�r�r�r#r�r$�LOCK_UN)r�r�Zdotlock_doner�Zpre_lockrrrr�
sH
r�cCs8trtj|tj�tjj|jd�r4tj|jd�dS)Nz.lock)r�r�r�rrr�r�r$)r�rrrr�4sr�cCs8tj|tjtjBtjBd�}z
t|d�Stj|�XdS)Ni�zrb+)rr�r�r�O_RDWRrL)r�fdrrrr�;s
r�cCs$td|ttj��tj�tj�f�S)Nz%s.%s.%s.%s)r�r�r�r�r�rr�)rrrrr�Csr�cCs$|j�ttd�r tj|j��dS)N�fsync)rIrErr��fileno)r�rrrr�Is
r�cCst|�|j�dS)N)r�rL)r�rrrr�Osr�c@seZdZdS)rN)rwrxryrrrrrUsc@seZdZdS)rN)rwrxryrrrrrXsc@seZdZdS)rN)rwrxryrrrrr[sc@seZdZdS)rN)rwrxryrrrrr^sc@seZdZdS)rN)rwrxryrrrrras)T)/rr�rbr�r�r@rjr1Z
email.messageZemail.generatorr\r-r��ImportError�__all__rcrMrrr�r�rrrrr!rr	r�r
rrr
r�r�r�r�r�r�r�r��	Exceptionrrrrrrrrr�<module>	sn

h8DB4-3z%mqH_c'
*getopt.cpython-36.pyc000064400000014113150335715140010500 0ustar003


 \A�@s�dZddddgZddlZyddlmZWnek
rDdd	�ZYnXGd
d�de�ZeZgfdd�Z	gfdd�Z
d
d�Zdd�Zdd�Z
dd�Zedkr�ddlZee	ejdd�dddg��dS)a�Parser for command line options.

This module helps scripts to parse the command line arguments in
sys.argv.  It supports the same conventions as the Unix getopt()
function (including the special meanings of arguments of the form `-'
and `--').  Long options similar to those supported by GNU software
may be used as well via an optional third argument.  This module
provides two functions and an exception:

getopt() -- Parse command line options
gnu_getopt() -- Like getopt(), but allow option and non-option arguments
to be intermixed.
GetoptError -- exception (class) raised with 'opt' attribute, which is the
option involved with the exception.
�GetoptError�error�getopt�
gnu_getopt�N)�gettextcCs|S)N�)�srr�/usr/lib64/python3.6/getopt.py�_)sr
c@s&eZdZdZdZddd�Zdd�ZdS)r�cCs||_||_tj|||�dS)N)�msg�opt�	Exception�__init__)�selfrr
rrr	r.szGetoptError.__init__cCs|jS)N)r)rrrr	�__str__3szGetoptError.__str__N)r)�__name__�
__module__�__qualname__r
rrrrrrr	r+s
cCs�g}t|�td�kr|g}nt|�}x�|r�|djd�r�|ddkr�|ddkr^|dd�}P|djd�r�t||ddd�||dd��\}}q&t||ddd�||dd��\}}q&W||fS)a@getopt(args, options[, long_options]) -> opts, args

    Parses command line options and parameter list.  args is the
    argument list to be parsed, without the leading reference to the
    running program.  Typically, this means "sys.argv[1:]".  shortopts
    is the string of option letters that the script wants to
    recognize, with options that require an argument followed by a
    colon (i.e., the same format that Unix getopt() uses).  If
    specified, longopts is a list of strings with the names of the
    long options which should be supported.  The leading '--'
    characters should not be included in the option name.  Options
    which require an argument should be followed by an equal sign
    ('=').

    The return value consists of two elements: the first is a list of
    (option, value) pairs; the second is the list of program arguments
    left after the option list was stripped (this is a trailing slice
    of the first argument).  Each option-and-value pair returned has
    the option as its first element, prefixed with a hyphen (e.g.,
    '-x'), and the option argument as its second element, or an empty
    string if the option has no argument.  The options occur in the
    list in the same order in which they were found, thus allowing
    multiple occurrences.  Long and short options may be mixed.

    rr�-z--�N�)�type�list�
startswith�do_longs�	do_shorts)�args�	shortopts�longopts�optsrrr	r8s (*cCs6g}g}t|t�r|g}nt|�}|jd�r>|dd�}d}ntjjd�rPd}nd}x�|�r,|ddkrz||dd�7}P|ddd	�dkr�t||dd	d�||dd��\}}qV|ddd�d
kr�|dd
kr�t||ddd�||dd��\}}qV|�r||7}PqV|j	|d�|dd�}qVW||fS)agetopt(args, options[, long_options]) -> opts, args

    This function works like getopt(), except that GNU style scanning
    mode is used by default. This means that option and non-option
    arguments may be intermixed. The getopt() function stops
    processing options as soon as a non-option argument is
    encountered.

    If the first character of the option string is `+', or if the
    environment variable POSIXLY_CORRECT is set, then option
    processing stops as soon as a non-option argument is encountered.

    �+rNTZPOSIXLY_CORRECTFrz--rr)
�
isinstance�strrr�os�environ�getrr�append)rrrr Z	prog_argsZall_options_firstrrr	rcs2

( (cCs�y|jd�}Wntk
r&d}Yn X|d|�||dd�}}t||�\}}|r�|dkr�|svttd�||��|d|dd�}}n|dk	r�ttd�||��|jd||p�df�||fS)N�=rzoption --%s requires argumentrz%option --%s must not have an argumentz--r)�index�
ValueError�
long_has_argsrr
r')r r
rr�i�optarg�has_argrrr	r�s
rcs��fdd�|D�}|s(ttd������|kr8d�fS�d|krLd�fSt|�dkrjttd�����t|�dkszt�|d	}|jd�}|r�|dd
�}||fS)Ncsg|]}|j��r|�qSr)r)�.0�o)r
rr	�
<listcomp>�sz!long_has_args.<locals>.<listcomp>zoption --%s not recognizedFr(Trzoption --%s not a unique prefixr���)rr
�len�AssertionError�endswith)r
rZ
possibilitiesZunique_matchr.r)r
r	r+�s
r+cCs�x�|dkr�|d|dd�}}t||�rj|dkr^|sHttd�||��|d|dd�}}|d}}nd}|jd||f�qW||fS)Nrrrzoption -%s requires argumentr)�
short_has_argrr
r')r Z	optstringrrr
r-rrr	r�s

rcCsXx@tt|��D]0}|||ko(dknr|jd|d�SqWttd�||��dS)N�:rzoption -%s not recognized)�ranger3rrr
)r
rr,rrr	r6�sr6�__main__rza:bzalpha=Zbeta)�__doc__�__all__r$rr
�ImportErrorrrrrrrr+rr6r�sys�print�argvrrrr	�<module>s"+2pkgutil.cpython-36.opt-2.pyc000064400000025373150335715140011627 0ustar003


 \CS�@stddlmZddlmZddlZddlZddlZddlZddl	Zddl
Z
ddlmZddl
Z
ddddd	d
ddd
dddgZedd�Zde_dd�Zdd�Zd*dd	�Zd+dd
�Zed,dd��Zd-dd�Zejejje�dd�ZGdd�d�ZGd d
�d
�Zy.ddlZdd!lmZd.d"d#�Zejee�Wne k
�r<YnXd$d�Z!d/d%d�Z"d&d�Z#d'd�Z$d(d�Z%d)d�Z&dS)0�)�
namedtuple)�singledispatchN)�
ModuleType�get_importer�iter_importers�
get_loader�find_loader�
walk_packages�iter_modules�get_data�ImpImporter�	ImpLoader�	read_code�extend_path�
ModuleInfozmodule_finder name ispkgz.A namedtuple with minimal info about a module.cCsLy
|j}Wn4tk
r>|j|�}|dkr0dStjj||�SX||�SdS)N)�	find_spec�AttributeError�find_module�	importlib�util�spec_from_loader)�finder�namer�loader�r�/usr/lib64/python3.6/pkgutil.py�	_get_specs

rcCs6ddl}|jd�}|tjjkr"dS|jd�|j|�S)Nr��)�marshal�readrr�MAGIC_NUMBER�load)�streamr�magicrrrr(s

�c
#s�ifdd��x�t||�D]�}|V|jryt|j�WnNtk
r\|dk	rX||j�Yqtk
r�|dk	r~||j�n�YqXttj|jdd�p�g}�fdd�|D�}t	||jd|�EdHqWdS)NcSs||krdSd||<dS)NTr)�p�mrrr�seenRszwalk_packages.<locals>.seen�__path__csg|]}�|�s|�qSrr)�.0r&)r(rr�
<listcomp>isz!walk_packages.<locals>.<listcomp>�.)
r
�ispkg�
__import__r�ImportError�	Exception�getattr�sys�modulesr	)�path�prefix�onerror�infor)r(rr	5s ccsf|dkrt�}n
tt|�}i}xB|D]:}x4t||�D]&\}}||kr4d||<t|||�Vq4Wq$WdS)N�)r�mapr�iter_importer_modulesr)r4r5Z	importers�yielded�irr-rrrr
ns


cCst|d�sgS|j|�S)Nr
)�hasattrr
)�importerr5rrrr:�s
r:ccs0|jdkstjj|j�rdSi}ddl}ytj|j�}Wntk
rRg}YnX|j�x�|D]�}|j|�}|dksb||kr�qbtjj|j|�}d}|o�tjj|�o�d|k�r|}ytj|�}	Wntk
r�g}	YnXx&|	D]}|j|�}
|
dkr�d}Pq�Wqb|rbd|krbd||<|||fVqbWdS)Nr�__init__Fr,Tr8)	r4�os�isdir�inspect�listdir�OSError�sort�
getmodulename�join)r>r5r;rB�	filenames�fn�modnamer4r-�dircontents�subnamerrr�_iter_file_finder_modules�s<





rMc
Cs.tj��tjdt�tjd�aWdQRXdS)N�ignore�imp)�warnings�catch_warnings�simplefilter�DeprecationWarningr�
import_modulerOrrrr�_import_imp�s
rUc@s*eZdZd	dd�Zd
dd�Zddd�ZdS)rNcCstjdt�t�||_dS)Nz5This emulation is deprecated, use 'importlib' instead)rP�warnrSrUr4)�selfr4rrrr?�szImpImporter.__init__c
Cs~|jd�d}||kr$|jdkr$dS|jdkr4d}ntjj|j�g}ytj||�\}}}Wntk
rndSXt||||�S)Nr,r8���)�splitr4r@�realpathrOrr/r
)rW�fullnamer4rL�file�filename�etcrrrr�s
zImpImporter.find_moduler%ccs0|jdkstjj|j�rdSi}ddl}ytj|j�}Wntk
rRg}YnX|j�x�|D]�}|j|�}|dksb||kr�qbtjj|j|�}d}|o�tjj|�o�d|k�r|}ytj|�}	Wntk
r�g}	YnXx&|	D]}|j|�}
|
dkr�d}Pq�Wqb|rbd|krbd||<|||fVqbWdS)Nrr?Fr,Tr8)	r4r@rArBrCrDrErFrG)rWr5r;rBrHrIrJr4r-rKrLrrrr
�s<





zImpImporter.iter_modules)N)N)r%)�__name__�
__module__�__qualname__r?rr
rrrrr�s

c@sjeZdZdZZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
ddd�Zddd�Zdd�Z
ddd�ZdS)r
NcCs.tjdt�t�||_||_||_||_dS)Nz5This emulation is deprecated, use 'importlib' instead)rPrVrSrUr\r]r[r^)rWr[r\r]r^rrrr?szImpLoader.__init__cCs:|j�ztj||j|j|j�}Wd|jr4|jj�X|S)N)�_reopenrO�load_moduler\r]r^�close)rWr[�modrrrrcszImpLoader.load_modulec	Cst|d��
}|j�SQRXdS)N�rb)�openr )rW�pathnamer\rrrr"szImpLoader.get_datacCsT|jrP|jjrP|jd}|tjkr2t|jd�|_n|tjtjfkrPt|jd�|_dS)N��rrf)	r\�closedr^rO�	PY_SOURCErgr]�PY_COMPILED�C_EXTENSION)rW�mod_typerrrrb&s

zImpLoader._reopencCs0|dkr|j}n||jkr,td|j|f��|S)Nz,Loader for module %s cannot handle module %s)r[r/)rWr[rrr�	_fix_name.s
zImpLoader._fix_namecCs|j|�}|jdtjkS)Nri)rpr^rO�
PKG_DIRECTORY)rWr[rrr�
is_package6s
zImpLoader.is_packagec
Cs�|j|�}|jdkr�|jd}|tjkrD|j|�}t||jd�|_nJ|tjkrv|j	�zt
|j�|_Wd|jj�Xn|tj
kr�|j�j�|_|jS)Nri�exec)rp�coder^rOrl�
get_source�compiler]rmrbrr\rdrq�
_get_delegate�get_code)rWr[ro�sourcerrrrx:s






zImpLoader.get_codec
Cs�|j|�}|jdkr�|jd}|tjkrP|j�z|jj�|_Wd|jj�Xnd|tj	kr�t
jj|j
dd��r�t|j
dd�d��}|j�|_WdQRXn|tjkr�|j�j�|_|jS)Nrir8rjrXrX)rpryr^rOrlrbr\r rdrmr@r4�existsr]rgrqrwru)rWr[ro�frrrruKs





zImpLoader.get_sourcecCst|j�}t|d�}|jS)Nr?)rr]rr)rWr�specrrrrw]s

zImpLoader._get_delegatecCsH|j|�}|jd}|tjkr*|j�j�S|tjtjtjfkrD|j	SdS)Nri)
rpr^rOrqrw�get_filenamerlrmrnr])rWr[rorrrr}bs


zImpLoader.get_filename)N)N)N)r_r`rartryr?rcrrbrprrrxrurwr}rrrrr
	s	

)�zipimporterc	cs�ttj|j�}|j}t|�}i}ddl}x�|D]�}|j|�s@q0||d�jt	j
�}t|�dkr�|djd�r�|d|kr�d||d<||ddfVt|�dkr�q0|j|d�}|dkr�q0|r0d|kr0||kr0d||<||dfVq0WdS)	Nrrir8z__init__.pyTr?r,F)�sorted�	zipimport�_zip_directory_cache�archiver5�lenrB�
startswithrYr@�seprF)	r>r5Zdirlist�_prefixZplenr;rBrIrJrrr�iter_zipimport_modulesps*

r�cCsnytj|}WnZtk
rhxDtjD]6}y||�}tjj||�PWq&tk
rZYq&Xq&Wd}YnX|S)N)r2�path_importer_cache�KeyError�
path_hooks�
setdefaultr/)Z	path_itemr>�	path_hookrrrr�s	

ccs�|jd�rdj|�}t|��d|krV|jd�d}tj|�}t|dd�}|dkrhdSntjEdHtj	}x|D]}t
|�VqnWdS)Nr,z'Relative module name {!r} not supportedrr))r��formatr/�
rpartitionrrTr1r2�	meta_pathr4r)r[�msgZpkg_nameZpkgr4�itemrrrr�s



cCsn|tjkr tj|}|dkr dSt|t�rb|}t|dd�}|dk	rF|St|dd�dkrZdS|j}n|}t|�S)N�
__loader__�__spec__)r2r3�
isinstancerr1r_r)Zmodule_or_name�modulerr[rrrr�s


cCs�|jd�rdj|�}t|��ytjj|�}WnFttttfk
rr}z"d}t|j|t	|�|��|�WYdd}~XnX|dk	r�|j
SdS)Nr,z'Relative module name {!r} not supportedz,Error while finding loader for {!r} ({}: {}))r�r�r/rrrr�	TypeError�
ValueError�typer)r[r�r|Zexrrrr�s

*cCs�t|t�s|S|d}|dd�}|jd�\}}}|rbytj|j}Wqhttfk
r^|SXntj}�x:|D�]0}t|t	�s�qpt
|�}|dk	r�g}	t|d�r�|j|�}
|
dk	r�|
j
p�g}	nt|d�r�|j|�\}}	x|	D]}||kr�|j|�q�Wtjj||�}tjj|�rpyt|�}
Wn8tk
�rT}ztjjd||f�WYdd}~XqpX|
�Bx:|
D]2}|jd�}|�sb|jd��r��qb|j|��qbWWdQRXqpW|S)Nz.pkgr,rrzCan't open %s: %s
�
�#)r��listr�r2r3r)r�rr4�strrr=r�submodule_search_locationsr�appendr@rG�isfilergrD�stderr�write�rstripr�)r4rZ	sname_pkgZparent_package�_Z
final_nameZsearch_path�dirr�portionsr|ZportionZpkgfiler{r��linerrrr�sP!







cCs�tjj|�}|dkrdS|j}|dks2t|d�r6dStjj|�pLtjj	|�}|dksbt|d�rfdS|j
d�}|jdtj
j|j��tj
j|�}|j|�S)Nr�__file__�/r)rrrrr=r2r3�get�
_bootstrap�_loadrY�insertr@r4�dirnamer�rGr)�packageZresourcer|rre�partsZ
resource_namerrrrRs
)Nr%N)Nr%)r%)r%)r%)r%)'�collectionsr�	functoolsrZ
simplegenericr�importlib.util�importlib.machineryr@Zos.pathr2�typesrrP�__all__r�__doc__rrr	r
r:rM�register�	machinery�
FileFinderrUrr
r�r~r�r/rrrrrrrrrr�<module>sP

9

(Jc

^plistlib.cpython-36.opt-1.pyc000064400000066021150335715140011764 0ustar003

�\dh#~�@sbdZddddddddd	d
ddd
dgZddlZddlZddlZddlZddlZddlmZddl	Z	ddl
Z
ddlZddlZddl
mZddlmZejdded�Ze�jej�Gdd�de�ZGdd�de�Zejdd��ZGdd�de�Zdd�Zdd�Zdd�Zd d�Z Gd!d�d�Z!d"Z"ej#d#�Z$dPd%d&�Z%d'd(�Z&ej#d)ej'�Z(d*d+�Z)d,d-�Z*d.d/�Z+Gd0d1�d1�Z,Gd2d3�d3�Z-Gd4d5�d5e-�Z.d6d7�Z/Gd8d�de0�Z1d9d:d;d<d=�Z2e3�Z4Gd>d?�d?�Z5d@dA�Z6e7e8e9eje:fZ;GdBdC�dCe3�Z<dDdE�Z=e>ee/e,e.dF�e?ee=e5e<dF�iZ@ddGedH�dId�ZAddGedH�dJd
�ZBe>dGdKdL�dMd�ZCe>dKdGdN�dOd�ZDdS)Qa�plistlib.py -- a tool to generate and parse MacOSX .plist files.

The property list (.plist) file format is a simple XML pickle supporting
basic object types, like dictionaries, lists, numbers and strings.
Usually the top level object is a dictionary.

To write out a plist file, use the dump(value, file)
function. 'value' is the top level object, 'file' is
a (writable) file object.

To parse a plist from a file, use the load(file) function,
with a (readable) file object as the only argument. It
returns the top level object (again, usually a dictionary).

To work with plist data in bytes objects, you can use loads()
and dumps().

Values can be strings, integers, floats, booleans, tuples, lists,
dictionaries (but only with string keys), Data, bytes, bytearray, or
datetime.datetime objects.

Generate Plist example:

    pl = dict(
        aString = "Doodah",
        aList = ["A", "B", 12, 32.1, [1, 2, 3]],
        aFloat = 0.1,
        anInt = 728,
        aDict = dict(
            anotherString = "<hello & hi there!>",
            aUnicodeValue = "M\xe4ssig, Ma\xdf",
            aTrueValue = True,
            aFalseValue = False,
        ),
        someData = b"<binary gunk>",
        someMoreData = b"<lots of binary gunk>" * 10,
        aDate = datetime.datetime.fromtimestamp(time.mktime(time.gmtime())),
    )
    with open(fileName, 'wb') as fp:
        dump(pl, fp)

Parse Plist example:

    with open(fileName, 'rb') as fp:
        pl = load(fp)
    print(pl["aKey"])
�	readPlist�
writePlist�readPlistFromBytes�writePlistToBytes�Plist�Data�Dict�InvalidFileException�FMT_XML�
FMT_BINARY�load�dump�loads�dumps�N)�BytesIO)�warn)�ParserCreate�PlistFormatzFMT_XML FMT_BINARY)�modulec@s(eZdZfZdd�Zdd�Zdd�ZdS)�
_InternalDictcCs:y||}Wntk
r(t|��YnXtdtd�|S)NzLAttribute access from plist dicts is deprecated, use d[key] notation instead�)�KeyError�AttributeErrorr�DeprecationWarning)�self�attr�value�r� /usr/lib64/python3.6/plistlib.py�__getattr__Vsz_InternalDict.__getattr__cCstdtd�|||<dS)NzLAttribute access from plist dicts is deprecated, use d[key] notation insteadr)rr)rrrrrr�__setattr___sz_InternalDict.__setattr__cCs8y
||=Wntk
r&t|��YnXtdtd�dS)NzLAttribute access from plist dicts is deprecated, use d[key] notation insteadr)rrrr)rrrrr�__delattr__ds
z_InternalDict.__delattr__N)�__name__�
__module__�__qualname__�	__slots__rr r!rrrrrOs	rcseZdZ�fdd�Z�ZS)rcstdtd�t�jf|�dS)Nz?The plistlib.Dict class is deprecated, use builtin dict insteadr)rr�super�__init__)r�kwargs)�	__class__rrr'osz
Dict.__init__)r"r#r$r'�
__classcell__rr)r)rrmsc	cs2t|t�r(t||��}|VWdQRXn|VdS)N)�
isinstance�str�open)�
pathOrFile�mode�fprrr�_maybe_openus
r1cs4eZdZdZ�fdd�Zedd��Zdd�Z�ZS)rzuThis class has been deprecated. Use dump() and load()
    functions instead, together with regular dict objects.
    cstdtd�t�jf|�dS)NzJThe Plist class is deprecated, use the load() and dump() functions insteadr)rrr&r')rr()r)rrr'�szPlist.__init__c	Cs2t|d��}t|�}WdQRX|�}|j|�|S)z,Deprecated. Use the load() function instead.�rbN)r1r�update)�clsr.r0rZplistrrr�fromFile�s

zPlist.fromFilec
Cs$t|d��}t||�WdQRXdS)z,Deprecated. Use the dump() function instead.�wbN)r1r)rr.r0rrr�write�szPlist.write)	r"r#r$�__doc__r'�classmethodr5r7r*rr)r)rrs	c
Cs2tdtd�t|d��}t|ddtd�SQRXdS)z�
    Read a .plist from a path or file. pathOrFile should either
    be a file name, or a readable binary file object.

    This function is deprecated, use load instead.
    z8The readPlist function is deprecated, use load() insteadrr2NF)�fmt�use_builtin_types�	dict_type)rrr1rr)r.r0rrrr�s
cCs8tdtd�t|d��}t||tddd�WdQRXdS)z�
    Write 'value' to a .plist file. 'pathOrFile' may either be a
    file name or a (writable) file object.

    This function is deprecated, use dump instead.
    z9The writePlist function is deprecated, use dump() insteadrr6TF)r:�	sort_keys�skipkeysN)rrr1rr	)rr.r0rrrr�scCs tdtd�tt|�ddtd�S)z}
    Read a plist data from a bytes object. Return the root object.

    This function is deprecated, use loads instead.
    zBThe readPlistFromBytes function is deprecated, use loads() insteadrNF)r:r;r<)rrrrr)�datarrrr�scCs,tdtd�t�}t||tddd�|j�S)zp
    Return 'value' as a plist-formatted bytes object.

    This function is deprecated, use dumps instead.
    zAThe writePlistToBytes function is deprecated, use dumps() insteadrTF)r:r=r>)rrrrr	�getvalue)r�frrrr�s
c@s>eZdZdZdd�Zedd��Zddd�Zd	d
�Zdd�Z	d
S)rz]
    Wrapper for binary data.

    This class is deprecated, use a bytes object instead.
    cCst|t�std��||_dS)Nzdata must be as bytes)r+�bytes�	TypeErrorr?)rr?rrrr'�s
z
Data.__init__cCs|t|��S)N)�_decode_base64)r4r?rrr�
fromBase64�szData.fromBase64�LcCst|j|�S)N)�_encode_base64r?)r�
maxlinelengthrrr�asBase64�sz
Data.asBase64cCs4t||j�r|j|jkSt|t�r,|j|kStSdS)N)r+r)r?rB�NotImplemented)r�otherrrr�__eq__�s


zData.__eq__cCsd|jjt|j�fS)Nz%s(%s))r)r"�reprr?)rrrr�__repr__�sz
Data.__repr__N)rF)
r"r#r$r8r'r9rErIrLrNrrrrr�s
s�<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
zv[\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]rFcCsT|dd}g}x8tdt|�|�D]$}||||�}|jtj|��q"Wdj|�S)N��r�)�range�len�append�binasciiZ
b2a_base64�join)�srHZ
maxbinsize�pieces�i�chunkrrrrGsrGcCs(t|t�rtj|jd��Stj|�SdS)Nzutf-8)r+r,rUZ
a2b_base64�encode)rWrrrrD
s
rDz{(?P<year>\d\d\d\d)(?:-(?P<month>\d\d)(?:-(?P<day>\d\d)(?:T(?P<hour>\d\d)(?::(?P<minute>\d\d)(?::(?P<second>\d\d))?)?)?)?)?ZcCsNd}tj|�j�}g}x,|D]$}||}|dkr2P|jt|��qWtj|�S)N�year�month�day�hour�minute�second)r\r]r^r_r`ra)�_dateParser�match�	groupdictrT�int�datetime)rW�orderZgdZlst�key�valrrr�_date_from_strings
rjcCs d|j|j|j|j|j|jfS)Nz%04d-%02d-%02dT%02d:%02d:%02dZ)r\r]r^r_r`ra)�drrr�_date_to_string&srlcCsZtj|�}|dk	rtd��|jdd�}|jdd�}|jdd�}|jdd�}|jd	d
�}|S)Nz<strings can't contains control characters; use bytes insteadz
�
�
�&z&amp;�<z&lt;�>z&gt;)�_controlCharPat�search�
ValueError�replace)�text�mrrr�_escape,s
rxc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'S)(�_PlistParsercCs"g|_d|_d|_||_||_dS)N)�stack�current_key�root�_use_builtin_types�
_dict_type)rr;r<rrrr'9s
z_PlistParser.__init__cCs8t�|_|j|j_|j|j_|j|j_|jj|�|j	S)N)
r�parser�handle_begin_elementZStartElementHandler�handle_end_elementZEndElementHandler�handle_dataZCharacterDataHandlerZ	ParseFiler|)rZfileobjrrr�parse@s


z_PlistParser.parsecCs*g|_t|d|d�}|dk	r&||�dS)NZbegin_)r?�getattr)r�element�attrs�handlerrrrr�Hsz!_PlistParser.handle_begin_elementcCs"t|d|d�}|dk	r|�dS)NZend_)r�)rr�r�rrrr�Nsz_PlistParser.handle_end_elementcCs|jj|�dS)N)r?rT)rr?rrrr�Ssz_PlistParser.handle_datacCs�|jdk	rFt|jdti��s.td|jj��||jd|j<d|_nB|jsT||_n4t|jdtg��sxtd|jj��|jdj|�dS)N�zunexpected element at line %d���r�r�r�)	r{r+rz�typertr�CurrentLineNumberr|rT)rrrrr�
add_objectVs
z_PlistParser.add_objectcCsdj|j�}g|_|S)N�)rVr?)rr?rrr�get_datafsz_PlistParser.get_datacCs"|j�}|j|�|jj|�dS)N)r~r�rzrT)rr�rkrrr�
begin_dictms
z_PlistParser.begin_dictcCs*|jrtd|j|jjf��|jj�dS)Nz%missing value for key '%s' at line %d)r{rtrr�rz�pop)rrrr�end_dictrsz_PlistParser.end_dictcCs:|jst|jdti��r,td|jj��|j�|_dS)Nr�zunexpected key at line %dr�)r{r+rzr�rtrr�r�)rrrr�end_keyxsz_PlistParser.end_keycCsg}|j|�|jj|�dS)N)r�rzrT)rr��arrr�begin_array~s
z_PlistParser.begin_arraycCs|jj�dS)N)rzr�)rrrr�	end_array�sz_PlistParser.end_arraycCs|jd�dS)NT)r�)rrrr�end_true�sz_PlistParser.end_truecCs|jd�dS)NF)r�)rrrr�	end_false�sz_PlistParser.end_falsecCs|jt|j���dS)N)r�rer�)rrrr�end_integer�sz_PlistParser.end_integercCs|jt|j���dS)N)r��floatr�)rrrr�end_real�sz_PlistParser.end_realcCs|j|j��dS)N)r�r�)rrrr�
end_string�sz_PlistParser.end_stringcCs2|jr|jt|j���n|jtj|j���dS)N)r}r�rDr�rrE)rrrr�end_data�sz_PlistParser.end_datacCs|jt|j���dS)N)r�rjr�)rrrr�end_date�sz_PlistParser.end_dateN)r"r#r$r'r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrry8s&ryc@s8eZdZddd�Zdd�Zdd�Zdd
d�Zdd
�Zd	S)�_DumbXMLWriterr�	cCs||_g|_||_||_dS)N)�filerz�
_indent_level�indent)rr��indent_levelr�rrrr'�sz_DumbXMLWriter.__init__cCs,|jj|�|jd|�|jd7_dS)Nz<%s>r�)rzrT�writelnr�)rr�rrr�
begin_element�sz_DumbXMLWriter.begin_elementcCs |jd8_|jd|�dS)Nr�z</%s>)r�r�)rr�rrr�end_element�sz_DumbXMLWriter.end_elementNcCs8|dk	r&t|�}|jd|||f�n|jd|�dS)Nz<%s>%s</%s>z<%s/>)rxr�)rr�rrrr�simple_element�sz_DumbXMLWriter.simple_elementcCsH|r8t|t�r|jd�}|jj|j|j�|jj|�|jjd�dS)Nzutf-8�
)r+r,r[r�r7r�r�)r�linerrrr��s

z_DumbXMLWriter.writeln)rr�)N)r"r#r$r'r�r�r�r�rrrrr��s


r�c@sFeZdZddd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Z	dS)�_PlistWriterr�	r�TFcCs.|r|jt�tj||||�||_||_dS)N)r7�PLISTHEADERr�r'�
_sort_keys�	_skipkeys)rr�r�r�ZwriteHeaderr=r>rrrr'�s

z_PlistWriter.__init__cCs"|jd�|j|�|jd�dS)Nz<plist version="1.0">z</plist>)r��write_value)rrrrrr7�s

z_PlistWriter.writecCs4t|t�r|jd|��n|dkr0|jd��n|dkrD|jd�n�t|t�r�d|ko`dknrx|jd	d
|�nt|��n�t|t�r�|jdt|��n�t|t�r�|j|�n|t|t	�r�|j
|�nft|ttf�r�|j
|�nLt|tj��r|jdt|��n,t|ttf��r |j|�ntd
t|���dS)N�stringT�trueFZfalser��?�@Zintegerz%d�realZdatezunsupported type: %sr�l����l)r+r,r�re�
OverflowErrorr�rM�dict�
write_dictr�
write_datarB�	bytearray�write_bytesrfrl�tuple�list�write_arrayrCr�)rrrrrr��s.





z_PlistWriter.write_valuecCs|j|j�dS)N)r�r?)rr?rrrr��sz_PlistWriter.write_datacCs~|jd�|jd8_tddt|jjdd	�|j��}x&t||�jd�D]}|rL|j|�qLW|jd7_|j	d�dS)
Nr?r��rFr�� �r�s        )
r�r��maxrSr�rurG�splitr�r�)rr?rHr�rrrr��s
z_PlistWriter.write_bytescCs�|rx|jd�|jr"t|j��}n|j�}x@|D]8\}}t|t�sR|jrJq0td��|jd|�|j	|�q0W|j
d�n
|jd�dS)Nr�zkeys must be stringsrh)r�r��sorted�itemsr+r,r�rCr�r�r�)rrkr�rhrrrrr�s

z_PlistWriter.write_dictcCs@|r2|jd�x|D]}|j|�qW|jd�n
|jd�dS)N�array)r�r�r�r�)rr�rrrrr�s

z_PlistWriter.write_arrayN)rr�r�TF)
r"r#r$r'r7r�r�r�r�r�rrrrr��s
%
r�cCs�d	}x|D]}|j|�r
dSq
WxntjdftjdftjdffD]N\}}|j|�sRq>x8|D]0}||jd�j|�}|dt|��|krXdSqXWq>WdS)
N�<?xml�<plistTzutf-8z	utf-16-bez	utf-16-le�asciiF)r�r�)�
startswith�codecs�BOM_UTF8�BOM_UTF16_BE�BOM_UTF16_LE�decoder[rS)�header�prefixesZpfxZbom�encoding�start�prefixrrr�_is_fmt_xml*s



r�c@seZdZddd�ZdS)r�Invalid filecCstj||�dS)N)rtr')r�messagerrrr'LszInvalidFileException.__init__N)r�)r"r#r$r'rrrrrKs�B�H�L�Q)r�rrOr�c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�_BinaryPlistParsera
    Read or write a binary plist file, following the description of the binary
    format.  Raise InvalidFileException in case of error, otherwise return the
    root object.

    see also: http://opensource.apple.com/source/CF/CF-744.18/CFBinaryPList.c
    cCs||_||_dS)N)r}r~)rr;r<rrrr'[sz_BinaryPlistParser.__init__cCs�y|||_|jjdtj�|jjd�}t|�dkr6t��tjd|�\}|_	}}}|jj|�|j
||�|_tg||_
|j|�Stttjttfk
r�t��YnXdS)N� z>6xBBQQQi��)�_fp�seek�os�SEEK_END�readrSr�struct�unpack�	_ref_size�
_read_ints�_object_offsets�
_undefined�_objects�_read_object�OSError�
IndexError�errorr�rt)rr0�trailer�offset_size�num_objects�
top_object�offset_table_offsetrrrr�_s
z_BinaryPlistParser.parsecCsL|dkrH|jjd�dd@}d|>}dt|}tj||jj|��dS|S)z$ return the size of the next object.�r�rrPrq)r�r��_BINARY_FORMATr�r�)r�tokenLrwrWrArrr�	_get_sizexsz_BinaryPlistParser._get_sizecsv|jj�|���tkr2tjd|�t�����S�sHt���|krNt��t��fdd�td�|��D��SdS)Nrqc3s&|]}tj�||��d�VqdS)�bigN)re�
from_bytes)�.0rY)r?�sizerr�	<genexpr>�sz0_BinaryPlistParser._read_ints.<locals>.<genexpr>r)	r�r�r�r�r�rSrr�rR)r�nr�r)r?r�rr��sz_BinaryPlistParser._read_intscCs|j||j�S)N)r�r�)rr�rrr�
_read_refs�sz_BinaryPlistParser._read_refscs��j|}|tk	r|S�j|}�jj|��jjd�d}|d@|d@}}|dkr^d}�n�|dkrnd}�n||dkr~d	}�nl|dkr�d
}�n\|dkr�tj�jjd|>�d|d
kd�}�n0|dkr�tj	d�jjd��d}�n|dk�rtj	d�jjd��d}�n�|dk�rDtj	d�jjd��d}t
j
ddd�t
j|d�}�n�|dk�r��j|�}�jj|�}t
|�|k�rxt���j�s�t|�}�n^|dk�rΈj|�}�jj|�}	t
|	�|k�r�t��|	jd�}�n|dk�r�j|�d}�jj|�}	t
|	�|k�rt��|	jd�}n�|dk�rX�j|�}�j|�}
g}|�j|<|j�fdd�|
D��n�|d k�r�j|�}�j|�}�j|�}
�j�}|�j|<y2x,t||
�D]\}}
�j|
�|�j|�<�q�WWntk
�r�t��YnXnt��|�j|<|S)!zx
        read the object by reference.

        May recursively read sub-objects (content of an array/dict/set)
        r�r��r�Nr�F�	TrQr�r�rP)�signed�"z>frO�#z>d�3i�)Zsecondsr��Pr��`rzutf-16be�c3s|]}�j|�VqdS)N)r�)r��x)rrrr��sz2_BinaryPlistParser._read_object.<locals>.<genexpr>��)r�r�r�r�r�r�rer�r�r�rfZ	timedeltar�rSrr}rr�r��extendr~�zipr�rC)r�ref�result�offset�tokenZtokenHr�rArWr?Zobj_refsZkey_refs�k�or)rrr��s�


















z_BinaryPlistParser._read_objectN)
r"r#r$r8r'r�r�r�r�r�rrrrr�Ss

r�cCs0|dkrdS|dkrdS|d>d>r(dSdSdS)	Nr�r�r�rr�rO�ir)�countrrr�_count_to_size�src@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�_BinaryPlistWritercCs||_||_||_dS)N)r�r�r�)rr0r=r>rrrr'sz_BinaryPlistWriter.__init__c
Cs�g|_i|_i|_|j|�t|j�}dg||_t|�|_t|j|_	|j
jd�x|jD]}|j|�q\W|j
|�}|j
j�}t|�}dt||}|j
jtj|f|j���d}|||j|||f}	|j
jtjd|	���dS)Nrsbplist00rq�	>5xBBBQQQ)r)�_objlist�	_objtable�_objidtable�_flattenrSr�rr�r��_ref_formatr�r7�
_write_object�
_getrefnum�tellr��pack)
rrr��objr�r�r�Z
offset_formatZsort_versionr�rrrr7
s(





z_BinaryPlistWriter.writec	Cs~t|t�r"t|�|f|jkrZdSn8t|t�rHt|j�|jf|jkrZdSnt|�|jkrZdSt|j	�}|j	j
|�t|t�r�||jt|�|f<n0t|t�r�||jt|j�|jf<n||jt|�<t|t��rPg}g}|j�}|j
r�t|�}xB|D]:\}}t|t��s|j�rq�td��|j
|�|j
|�q�WxLtj||�D]}|j|��q:Wn*t|ttf��rzx|D]}|j|��qfWdS)Nzkeys must be strings)r+�_scalarsr�rrr?�idrrSrrTr�r�r�r�r,r�rC�	itertools�chainrr�r�)	rrZrefnum�keys�valuesr�r�vrrrrr7sB






z_BinaryPlistWriter._flattencCsNt|t�r|jt|�|fSt|t�r<|jt|j�|jfS|jt|�SdS)N)r+rrr�rr?rr )rrrrrrgs


z_BinaryPlistWriter._getrefnumcCs�|dkr"|jjtjd||B��n�|dkrH|jjtjd|dBd|��nh|dkrn|jjtjd|dBd|��nB|dkr�|jjtjd
|dBd|��n|jjtjd|dBd
|��dS)Nr�z>Br�r�z>BBBr�z>BBH�r�z>BBL�z>BBQ�ril)r�r7r�r)rr
r�rrr�_write_sizeosz_BinaryPlistWriter._write_sizecs��j|�}�jj��j|<|dkr2�jjd��n�|dkrJ�jjd��n�|dkrb�jjd��n�t|t��rl|dkr�y�jjtjdd|��Wn tj	k
r�t
|�d�YnXn�|d'krԈjjtjdd|��n�|d(kr�jjtjd
d|��nt|d)k�r�jjtjdd|��nR|d*k�r8�jjtjdd|��n0|d+k�r`�jjd|jdddd��nt
|���nxt|t��r��jjtjdd|���nRt|t
j
��r�|t
j
dd	d	�j�}�jjtjdd|���nt|t��r�jdt|j���jj|j��n�t|ttf��r0�jdt|���jj|��n�t|t��r�y|jd�}�jdt|��Wn4tk
�r�|jd�}�jdt|�d �YnX�jj|��nDt|ttf��r��fd!d"�|D�}t|�}�jd#|��jjtjd$�j|f|���n�t|t��r�gg}}�j�r&t|j��}	n|j�}	xR|	D]J\}
}t|
t��s\�j�rT�q4t d%��|j!�j|
��|j!�j|���q4Wt|�}�jd&|��jjtjd$�j|f|����jjtjd$�j|f|���nt |��dS),N�F�Tr�rz>Bqr(r�r�z>BBr�z>BHr&r�z>BLr'r�z>BQr��r�)r�z>Bdri�rr�rzutf-16berrcsg|]}�j|��qSr)r)r�r)rrr�
<listcomp>�sz4_BinaryPlistWriter._write_object.<locals>.<listcomp>rrqzkeys must be stringsrrilll)"rr�rr�r7r+rer�rr�r��to_bytesr�rfZ
total_secondsrr)rSr?rBr�r,r[�UnicodeEncodeErrorr�r�rr�r�r�r�r�rCrT)rrr
rA�tZrefsrWZkeyRefsZvalRefsZ	rootItemsrr%r)rrrs�





$
"$z _BinaryPlistWriter._write_objectN)	r"r#r$r'r7rrr)rrrrrrs-0rcCs|dd�dkS)Nr�sbplist00r)r�rrr�_is_fmt_binary�sr1)�detectr�writerT)r:r;r<cCsn|dkrL|jd�}|jd�x:tj�D]}|d|�r&|d}Pq&Wt��nt|d}|||d�}|j|�S)z�Read a .plist file. 'fp' should be (readable) file object.
    Return the unpacked root object (which usually is a dictionary).
    Nr�rr2r)r;r<)r�r��_FORMATSr$rr�)r0r:r;r<r��info�P�prrrr�s

cCst|�}t||||d�S)zqRead a .plist file from a bytes object.
    Return the unpacked root object (which usually is a dictionary).
    )r:r;r<)rr)rr:r;r<r0rrrr
sF)r:r=r>cCs:|tkrtd|f��t|d|||d�}|j|�dS)zQWrite 'value' to a .plist file. 'fp' should be a (writable)
    file object.
    zUnsupported format: %rr3)r=r>N)r4rtr7)rr0r:r=r>r3rrrrs)r:r>r=cCs t�}t|||||d�|j�S)z?Return a bytes object with the contents for a .plist file.
    )r:r>r=)rrr@)rr:r>r=r0rrrrs)rF)Er8�__all__rUr��
contextlibrf�enum�iorr!r��rer��warningsrZxml.parsers.expatr�Enumr"r�globalsr3�__members__r�rr�contextmanagerr1rrrrrrr��compilerrrGrD�ASCIIrbrjrlrxryr�r�r�rtrr��objectr�r�rr,rer�rBrrr1r	r
r4rr
rrrrrr�<module>/sz



0
	
h&d!#
S	
	profile.cpython-36.opt-2.pyc000064400000024733150335715140011607 0ustar003


 \
V�@s�ddlZddlZddlZddlZddlmZdddgZGdd�d�Zdd	d�Zdd
d�Z	Gdd�d�Z
dd
�Zedkr|e�dS)�N)�OptionParser�run�runctx�Profilec@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_UtilscCs
||_dS)N)�profiler)�selfr�r	�/usr/lib64/python3.6/profile.py�__init__1sz_Utils.__init__cCsF|j�}z(y|j|�Wntk
r,YnXWd|j|||�XdS)N)rr�
SystemExit�_show)r�	statement�filename�sort�profr	r	r
r4s
z
_Utils.runcCsJ|j�}z,y|j|||�Wntk
r0YnXWd|j|||�XdS)N)rrrr
)rr�globals�localsrrrr	r	r
r=s
z
_Utils.runctxcCs"|dk	r|j|�n
|j|�dS)N)�
dump_stats�print_stats)rrrrr	r	r
r
Fsz_Utils._showN)�__name__�
__module__�__qualname__rrrr
r	r	r	r
r+s		r�cCstt�j|||�S)N)rrr)rrrr	r	r
rRscCstt�j|||||�S)N)rrr)rrrrrr	r	r
r_sc@s�eZdZdZd3dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Ze
e	eeeed�Z
dd�ZGdd�d�ZGdd�d�Zdd�Zdd�Zd5d!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd6d/d0�Zd1d2�ZdS)7rrNcCs�i|_d|_d|_d|_|dkr&|j}||_|sHtj|_|_|j	|_
nl||_|j�}yt|�}Wn"tk
r�||_|j	|_
Yn0X|dkr�|j
|_
n|j|_
|tfdd�}||_|j�|_|jd�dS)N��cSs
||��S)Nr	)�timer�sumr	r	r
�get_time_timer�sz(Profile.__init__.<locals>.get_time_timerr)�timings�cur�cmd�c_func_name�bias�timeZprocess_timer�get_time�trace_dispatch_i�
dispatcher�len�	TypeError�trace_dispatch�trace_dispatch_lr�t�
simulate_call)rrr#r,Zlengthrr	r	r
r�s0


zProfile.__init__cCs�|j}|�}|d|d|j|j}|dkr8|j|_|j||||�rd|�}|d|d|_n|�}|d|d||_dS)Nrr�c_call)rr,r#rr"�dispatch)r�frame�event�argrr,�rr	r	r
r*�szProfile.trace_dispatchcCsT|j}|�|j|j}|dkr(|j|_|j||||�rD|�|_n|�||_dS)Nr.)rr,r#rr"r/)rr0r1r2rr,r	r	r
r&�s
zProfile.trace_dispatch_icCs`|j}|�d|j|j}|dkr,|j|_|j||||�rL|�d|_n|�d||_dS)NgN@r.)rr,r#rr"r/)rr0r1r2rr,r	r	r
�trace_dispatch_mac�szProfile.trace_dispatch_maccCsT|j}|�|j|j}|dkr(|j|_|j||||�rD|�|_n|�||_dS)Nr.)r%r,r#rr"r/)rr0r1r2r%r,r	r	r
r+�s
zProfile.trace_dispatch_lc	CsD|j\}}}}}}||k	r*|r*|j||�S|||||||f|_dS)Nr)r �trace_dispatch_return)	rr0r,�rpt�rit�ret�rfn�rframe�rcurr	r	r
�trace_dispatch_exception�s
z Profile.trace_dispatch_exceptioncCs�|jr@|j|jdk	r@|j\}}}}}}t|tj�s@|j|d�|j}	|	j|	j|	j	f}
|dd|
||jf|_|j
}|
|kr�||
\}}
}}}||
d|||f||
<nddddif||
<dS)Nrrr���)r �f_back�
isinstancer�
fake_framer5�f_code�co_filename�co_firstlineno�co_namer)rr0r,r6r7r8r9r:r;Zfcode�fnr�cc�ns�tt�ct�callersr	r	r
�trace_dispatch_callszProfile.trace_dispatch_callc
Csndd|jf}|dd|||jf|_|j}||krX||\}}}}}	||d|||	f||<nddddif||<dS)Nrrr)r"r r)
rr0r,rErrFrGrHrIrJr	r	r
�trace_dispatch_c_callszProfile.trace_dispatch_c_callcCs�||jdk	r |j|jdd�|j\}}}}}}||}||}|\}	}
}}}
}|	|
|||||
|f|_|j}||\}}}}}|s�||}|d}||kr�||d||<nd||<||d||||f||<dS)Nrrrr=r=)r r5r)rr0r,r6r7r8r9r;Zframe_totalZpptZpitZpetZpfn�pframeZpcurrrFrGrHrIrJr	r	r
r5#s"zProfile.trace_dispatch_return)�callZ	exception�returnr.Zc_exceptionZc_returncCs"|jdrdS||_|j|�dS)Nr���)r r!r-)rr!r	r	r
�set_cmdYs
zProfile.set_cmdc@seZdZdd�Zdd�ZdS)zProfile.fake_codecCs||_||_||_d|_dS)Nr)rB�co_linerDrC)rr�line�namer	r	r
r_szProfile.fake_code.__init__cCst|j|j|jf�S)N)�reprrBrRrD)rr	r	r
�__repr__eszProfile.fake_code.__repr__N)rrrrrVr	r	r	r
�	fake_code^srWc@seZdZdd�ZdS)zProfile.fake_framecCs||_||_dS)N)rAr>)r�codeZpriorr	r	r
riszProfile.fake_frame.__init__N)rrrrr	r	r	r
r@hsr@cCsF|jdd|�}|jr |jd}nd}|j||�}|jd||d�dS)NZprofilerrrNr=)rWr r@r/)rrTrXrMr0r	r	r
r-mszProfile.simulate_callcCsN|j}|�|j}x*|jdr<|jd||jd|�d}qW|�||_dS)NrrOrrrPr=)r%r,r r/)rr%r,r	r	r
�simulate_cmd_completeyszProfile.simulate_cmd_completercCs$ddl}|j|�j�j|�j�dS)Nr)�pstatsZStatsZ
strip_dirsZ
sort_statsr)rrrZr	r	r
r�szProfile.print_statsc
Cs0t|d��}|j�tj|j|�WdQRXdS)N�wb)�open�create_stats�marshal�dump�stats)r�file�fr	r	r
r�szProfile.dump_statscCs|j�|j�dS)N)rY�snapshot_stats)rr	r	r
r]�szProfile.create_statsc	Csfi|_xZ|jj�D]L\}\}}}}}|j�}d}x|j�D]}||7}q:W|||||f|j|<qWdS)Nr)r`r�items�copy�values)	r�funcrFrGrHrIrJZncZcallcntr	r	r
rc�szProfile.snapshot_statscCsddl}|j}|j|||�S)Nr)�__main__�__dict__r)rr!rh�dictr	r	r
r�szProfile.runcCs8|j|�tj|j�zt|||�Wdtjd�X|S)N)rQ�sys�
setprofiler'�exec)rr!rrr	r	r
r�s
zProfile.runctxcOs6|jt|��tj|j�z
|||�Stjd�XdS)N)rQrUrkrlr')rrg�args�kwr	r	r
�runcall�s

zProfile.runcallcCs8|jtk	rtd��|j}d|_z|j||�S||_XdS)Nz&Subclasses must override .calibrate().r)�	__class__rr)r#�_calibrate_inner)r�m�verboseZ
saved_biasr	r	r
�	calibrate�s
zProfile.calibratecCs$|j}dd�}|fdd�}||�|�}||�|�}||}|rLtd|�t�}	|�}|	jdt�t��|�}||}
|r�td|
�d}d}x>|	jj�D]0\\}
}}\}}}}}|dkr�||7}||7}q�W|r�td|�td|�||d
k�rtd|��||d|}|�r td|�|S)NcSsxt|�D]}d}q
WdS)Nr)�range)�n�i�xr	r	r
�f1�sz$Profile._calibrate_inner.<locals>.f1cSsxt|�D]}|d�q
WdS)N�d)rv)rsrzrxr	r	r
rb�sz#Profile._calibrate_inner.<locals>.fz elapsed time without profiling =zf(m)zelapsed time with profiling =grbrzz!'CPU seconds' profiler reported =ztotal # calls =rz internal error: total calls = %dg@z+mean stopwatch overhead per profile event =)rbrz)	r%�printrrrrrrd�
ValueError)rrsrtr%rzrbZt0Zt1Zelapsed_noprofile�pZelapsed_profileZtotal_callsZ
reported_timerrS�funcnamerFrGrHrIrJZmeanr	r	r
rr�sB

"


zProfile._calibrate_inner)NNrP)rP)r)rrrr#rr*r&r4r+r<rKrLr5r/rQrWr@r-rYrrr]rcrrrprurrr	r	r	r
rhs<'
''




1
c
Cs�d}t|d�}d|_|jdddddd�|jd	d
dddd�tjd
d�s\|j�tjd�|j�\}}|tjdd�<t|�dkr�|d}tj	j
dtj	j|��t
|d��}t|j�|d�}WdQRX|dddd�}t||d|j|j�n|j�|S)Nz?profile.py [-o output_file_path] [-s sort] scriptfile [arg] ...)�usageFz-oz	--outfile�outfilezSave stats to <outfile>)�dest�help�defaultz-sz--sortrz?Sort order when printing to stdout, based on pstats.Stats classrrr�rbrmrh)�__file__r�__package__�
__cached__rP)rZallow_interspersed_argsZ
add_optionrk�argvZprint_usage�exit�
parse_argsr(�path�insert�os�dirnamer\�compile�readrr�r)r��parserZoptionsrnZprogname�fprXZglobsr	r	r
�main*s2




r�rhrP)NrPrP)NrP)
rkr�r$r^Zoptparser�__all__rrrrr�rr	r	r	r
�<module>s

'

	E"enum.cpython-36.opt-1.pyc000064400000055637150335715140011121 0ustar003


 \F��@s>ddlZddlmZmZddlmZddlmZyddl	m
Z
Wn ek
r`ddlm
Z
YnXdddd	d
ddgZ
d
d�Zdd�Zdd�Zdd�Ze�ZGdd�d�ZGdd�de�ZdZGdd�de�ZGdd�ded�ZGdd�dee�Zdd�ZGdd	�d	e�ZGdd
�d
ee�Zd d!�Zd"d�Z d#d$�Z!d%d&�Z"dS)'�N)�MappingProxyType�DynamicClassAttribute)�reduce)�or_)�OrderedDict�EnumMeta�Enum�IntEnum�Flag�IntFlag�auto�uniquecCst|d�pt|d�pt|d�S)z5Returns True if obj is a descriptor, False otherwise.�__get__�__set__�
__delete__)�hasattr)�obj�r�/usr/lib64/python3.6/enum.py�_is_descriptors

rcCsT|dd�|dd�ko"dknoR|dd�dkoR|dd	�dkoRt|�dkS)
z3Returns True if a __dunder__ name, False otherwise.N��__��_�������r)�len)�namerrr�
_is_dunders(rcCsL|d|dkodknoJ|dd�dkoJ|dd�dkoJt|�dkS)z1Returns True if a _sunder_ name, False otherwise.r�rr���rr!)r)rrrr�
_is_sunder$s r"cCsdd�}||_d|_dS)z"Make the given class un-picklable.cSstd|��dS)Nz%r cannot be pickled)�	TypeError)�self�protorrr�_break_on_call_reduce-sz6_make_class_unpicklable.<locals>._break_on_call_reducez	<unknown>N)�
__reduce_ex__�
__module__)�clsr&rrr�_make_class_unpicklable+sr*c@seZdZdZeZdS)rzP
    Instances are replaced with an appropriate value in Enum class suites.
    N)�__name__r(�__qualname__�__doc__�
_auto_null�valuerrrrr3scs,eZdZdZ�fdd�Z�fdd�Z�ZS)�	_EnumDictz�Track enum member order and ensure member names are not reused.

    EnumMeta will use the names found in self._member_names as the
    enumeration member names.

    cst�j�g|_g|_dS)N)�super�__init__�
_member_names�_last_values)r$)�	__class__rrr2As
z_EnumDict.__init__cs�t|�r.|dkrtd��|dkr�t|d|�n�t|�rD|dkr�d}n�||jkr\td|��nxt|�s�||kr�td	|||f��t|t�r�|j	t
kr�|j|d
t|j�|j
dd��|_	|j	}|jj|�|j
j|�t�j||�dS)
z�Changes anything not dundered or not a descriptor.

        If an enum member name is used twice, an error is raised; duplicate
        values are not checked for.

        Single underscore (sunder) names are reserved.

        �_order_�_create_pseudo_member_�_generate_next_value_�	_missing_z(_names_ are reserved for future Enum use�_generate_next_value�	__order__zAttempted to reuse key: %rz%r already defined as: %rr N)r6r7r8r9)r"�
ValueError�setattrrr3r#r�
isinstancerr/r.r:rr4�appendr1�__setitem__)r$�keyr/)r5rrr@Fs,	


"z_EnumDict.__setitem__)r+r(r,r-r2r@�
__classcell__rr)r5rr0:sr0cs�eZdZdZedd��Z�fdd�Zdd�Zd)dddd	d
�dd�Zd
d�Z	�fdd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zedd��Zdd�Zdd �Z�fd!d"�Zdddd	d
�d#d$�Zed%d&��Zed'd(��Z�ZS)*rzMetaclass for EnumcCs0t�}|j|�\}}|dk	r,t|dd�|d<|S)Nr8)r0�_get_mixins_�getattr)�metaclsr)�bases�	enum_dict�member_type�
first_enumrrr�__prepare__rs
zEnumMeta.__prepare__cs�|j|�\�}|j��|�\}}}�fdd��jD�}x�jD]
}	�|	=q>W�jdd�}
t|�dh@}|r~tdjdj|����d�kr�d�d<t�j	|||��}g|_
t�|_�|_
d	d
�|j�D�}
i|_d�k�r�tk	�rd}t�fdd�|D���st|��x6�jD�]*}||}t|t��s0|f}n|}�tk�rD|f}|�sf||�}t|d��s�||_n6||f|��}t|d��s��tk�r�||_n
�|�|_|j}||_||_|j|�x8|jj�D]\}	}|j|jk�r�|}P�q�W|j
j|�||
k�rt|||�||j|<y||j|<Wntk
�r6YnX�qWxPdD]H}	t||	�}t�|	d�}t||	d�}|dk	�rD||k�rDt||	|��qDWtdk	�r�|�r�||_ tj	|_	|
dk	�r�t|
t!��r�|
j"dd�j#�}
|
|j
k�r�td��|S)Ncsi|]}�||�qSrr)�.0�k)�	classdictrr�
<dictcomp>�sz$EnumMeta.__new__.<locals>.<dictcomp>r6�mrozInvalid enum member name: {0}�,r-zAn enumeration.cSs.h|]&}|jj�D]\}}t|t�r|�qqSr)�__dict__�itemsr>r)rK�crL�vrrr�	<setcomp>�sz#EnumMeta.__new__.<locals>.<setcomp>r'�__getnewargs_ex__�__getnewargs__�
__reduce__c3s|]}|�jkVqdS)N)rQ)rK�m)rHrr�	<genexpr>�sz#EnumMeta.__new__.<locals>.<genexpr>�_value_�__repr__�__str__�
__format__� z#member order does not match _order_)rVrWr'rX)r\r]r^r')$rC�
_find_new_r3�pop�setr<�format�joinr1�__new__�_member_names_r�_member_map_�
_member_type_rO�_value2member_map_�object�anyr*r>�tuplerr[�_name_�__objclass__r2rRr?r=r#rDr�__new_member__�str�replace�split)rEr)rFrMrIre�save_new�use_args�enum_membersrr6�
invalid_names�
enum_class�dynamic_attributes�methods�member_namer/�args�enum_member�canonical_member�class_method�
obj_method�enum_method)r5)rMrHrre|s�












zEnumMeta.__new__cCsdS)z6
        classes/types should always be True.
        Tr)r$rrr�__bool__szEnumMeta.__bool__Nr )�module�qualname�type�startcCs*|dkr|j||�S|j||||||d�S)aEither returns an existing member, or creates a new enum class.

        This method is used both when an enum class is given a value to match
        to an enumeration member (i.e. Color(3)) and for the functional API
        (i.e. Color = Enum('Color', names='RED GREEN BLUE')).

        When used for the functional API:

        `value` will be the name of the new class.

        `names` should be either a string of white-space/comma delimited names
        (values will start at `start`), or an iterator/mapping of name, value pairs.

        `module` should be set to the module this class is being created in;
        if it is not set, an attempt to find that module will be made, but if
        it fails the class will not be picklable.

        `qualname` should be set to the actual location this class can be found
        at in its module; by default it is set to the global scope.  If this is
        not correct, unpickling will fail in some circumstances.

        `type`, if set, will be mixed in as the first base class.

        N)r�r�r�r�)re�_create_)r)r/�namesr�r�r�r�rrr�__call__szEnumMeta.__call__cCst||�o|j|jkS)N)r>rmrg)r)�memberrrr�__contains__)szEnumMeta.__contains__cs(||jkrtd|j��t�j|�dS)Nz%s: cannot delete Enum member.)rg�AttributeErrorr+r1�__delattr__)r)�attr)r5rrr�,s
zEnumMeta.__delattr__cCsddddg|jS)Nr5r-�__members__r()rf)r$rrr�__dir__4s
zEnumMeta.__dir__cCs>t|�rt|��y
|j|Stk
r8t|�d�YnXdS)a5Return the enum member matching `name`

        We use __getattr__ instead of descriptors or inserting into the enum
        class' __dict__ in order to support `name` and `value` being both
        properties for enum members (which live in the class' __dict__) and
        enum members themselves.

        N)rr�rg�KeyError)r)rrrr�__getattr__8s	
zEnumMeta.__getattr__cCs
|j|S)N)rg)r)rrrr�__getitem__HszEnumMeta.__getitem__cs�fdd��jD�S)Nc3s|]}�j|VqdS)N)rg)rKr)r)rrrZLsz$EnumMeta.__iter__.<locals>.<genexpr>)rf)r)r)r)r�__iter__KszEnumMeta.__iter__cCs
t|j�S)N)rrf)r)rrr�__len__NszEnumMeta.__len__cCs
t|j�S)z�Returns a mapping of member name->value.

        This mapping lists all enum members, including aliases. Note that this
        is a read-only view of the internal mapping.

        )rrg)r)rrrr�QszEnumMeta.__members__cCs
d|jS)Nz	<enum %r>)r+)r)rrrr\[szEnumMeta.__repr__cs�fdd�t�j�D�S)Nc3s|]}�j|VqdS)N)rg)rKr)r)rrrZ_sz(EnumMeta.__reversed__.<locals>.<genexpr>)�reversedrf)r)r)r)r�__reversed__^szEnumMeta.__reversed__cs0|jjdi�}||krtd��t�j||�dS)z�Block attempts to reassign Enum members.

        A simple assignment to the class namespace only changes one of the
        several possible ways to get an Enum member from the Enum class,
        resulting in an inconsistent Enumeration.

        rgzCannot reassign members.N)rQ�getr�r1�__setattr__)r)rr/�
member_map)r5rrr�aszEnumMeta.__setattr__cCs�|j}|dkr|fn||f}|j|�\}	}
|j||�}t|t�rP|jdd�j�}t|ttf�r�|r�t|dt�r�|g}}g}
xDt	|�D]8\}}|
j
||||
dd��}|
j|�|j||f�q�Wx6|D].}t|t�r�|||}}n|\}}|||<q�W|j||||�}|dk�rTyt
jd�jd}Wn(ttfk
�rR}zWYdd}~XnX|dk�rht|�n||_|dk	�r~||_|S)a�Convenience method to create a new Enum class.

        `names` can be:

        * A string containing member names, separated either with spaces or
          commas.  Values are incremented by 1 from `start`.
        * An iterable of member names.  Values are incremented by 1 from `start`.
        * An iterable of (member name, value) pairs.
        * A mapping of member name -> value pairs.

        NrPr_rrr+)r5rCrJr>rprqrrrl�list�	enumerater8r?re�sys�	_getframe�	f_globalsr�r<r*r(r,)r)�
class_namer�r�r�r�r�rErFrrIrM�original_names�last_values�countrr/�itemrz�member_valuerw�excrrrr�ns<
 







zEnumMeta._create_cCs�|sttfSd}}x,|D]$}|tk	rt|t�r|jrtd��qWt|t�sTtd��t|dt�st|d}|d}n8x6|djD](}t|t�r�|dkr�|}q�|dkr�|}q�W||fS)z�Returns the type for creating enum members, and the first inherited
        enum class.

        bases: the tuple of bases that was given to __new__

        NzCannot extend enumerationszHnew enumerations must be created as `ClassName([mixin_type,] enum_type)`rr r!)rjr�
issubclassrfr#�__mro__)rFrHrI�baserrrrC�s(




zEnumMeta._get_mixins_c	Cs�|jdd�}|dk	}|dkrtxVdD]H}x8||fD],}t||d�}|ddjtjtjhkr0|}Pq0W|dk	r"Pq"Wtj}|tjkr�d}nd}|||fS)a
Returns the __new__ to be used for creating the enum members.

        classdict: the class dictionary given to __new__
        member_type: the data type whose __new__ will be used by default
        first_enum: enumeration to check for an overriding __new__

        reNroFT)rore)r�rDrerjr)	rMrHrIrers�method�possible�targetrtrrrr`�s(


zEnumMeta._find_new_)N)r+r(r,r-�classmethodrJrer�r�r�r�r�r�r�r�r��propertyr�r\r�r�r��staticmethodrCr`rBrr)r5rrps(



5-c@s�eZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
edd��Zedd��Zeddd��ZdS)rzRGeneric enumeration.

    Derive from this class to define new enumerations.

    cCsjt|�|kr|Sy||jkr&|j|SWn6tk
r^x |jj�D]}|j|krD|SqDWYnX|j|�S)N)r�rir#rg�valuesr[r9)r)r/r�rrrres

zEnum.__new__cCs8x2t|�D]"}y|dStk
r*Yq
Xq
W|SdS)Nr )r�r#)rr�r�r��
last_valuerrrr8s
zEnum._generate_next_value_cCstd||jf��dS)Nz%r is not a valid %s)r<r+)r)r/rrrr9"szEnum._missing_cCsd|jj|j|jfS)Nz<%s.%s: %r>)r5r+rmr[)r$rrrr\&sz
Enum.__repr__cCsd|jj|jfS)Nz%s.%s)r5r+rm)r$rrrr]*szEnum.__str__cs&�fdd��jj�D�}dddg|S)Ncs2g|]*}|jD]}|ddkr|�jkr|�qqS)rr)rQrg)rKr)rY)r$rr�
<listcomp>/s
z Enum.__dir__.<locals>.<listcomp>r5r-r()r5rO)r$�added_behaviorr)r$rr�-s
zEnum.__dir__cCs0|jtkrt}t|�}n|j}|j}|j||�S)N)rhrjrpr[r^)r$�format_specr)�valrrrr^6s

zEnum.__format__cCs
t|j�S)N)�hashrm)r$rrr�__hash__Esz
Enum.__hash__cCs|j|jffS)N)r5r[)r$r%rrrr'HszEnum.__reduce_ex__cCs|jS)zThe name of the Enum member.)rm)r$rrrrRsz	Enum.namecCs|jS)zThe value of the Enum member.)r[)r$rrrr/Wsz
Enum.valueNc
s�ttj|�}�rt���n|���fdd��j�D�}y|jdd�d�Wn$tk
rp|jdd�d�YnX||||d�}t|_|j|j	�|||<|S)z[
        Create a new Enum subclass that replaces a collection of global constants
        cs g|]}�|�r|�|f�qSrr)rKr)�filter�sourcerrr�qsz!Enum._convert.<locals>.<listcomp>cSs|d|dfS)Nr rr)�trrr�<lambda>vszEnum._convert.<locals>.<lambda>)rAcSs|dS)Nrr)r�rrrr�ys)r�)
�varsr��modules�keys�sortr#�_reduce_ex_by_namer'�updater�)r)rr�r�r��module_globals�membersr)r�r�r�_convert\s

z
Enum._convert)N)r+r(r,r-rer8r�r9r\r]r�r^r�r'rrr/r�rrrrr�s		
)�	metaclassc@seZdZdZdS)r	z.Enum where members are also (and must be) intsN)r+r(r,r-rrrrr	�scCs|jS)N)r)r$r%rrrr��sr�c@speZdZdZdd�Zedd��Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)r
zSupport for flagscCsd|s|dk	r|SdSxBt|�D]6}yt|�}PWqtk
rRtd|�d�YqXqWd|dS)z�
        Generate the next value when not given.

        name: the name of the member
        start: the initital start value or None
        count: the number of existing members
        last_value: the last value assigned or None
        Nr zInvalid Flag value: %rr)r��	_high_bit�	Exceptionr#)rr�r�r�r��high_bitrrrr8�s	zFlag._generate_next_value_cCs.|}|dkr|}|j|�}|dkr*|}|S)Nr)r7)r)r/�original_value�possible_memberrrrr9�s
zFlag._missing_cCsb|jj|d�}|dkr^t||�\}}|r:td||jf��tj|�}d|_||_|jj	||�}|S)zL
        Create a composite member iff value contains only members.
        Nz%r is not a valid %s)
rir��
_decomposer<r+rjrermr[�
setdefault)r)r/�
pseudo_memberr�extra_flagsrrrr7�s
zFlag._create_pseudo_member_cCs"t||j�stS|j|j@|jkS)N)r>r5�NotImplementedr[)r$�otherrrrr��szFlag.__contains__cCsV|j}|jdk	r$d|j|j|jfSt||j�\}}d|jdjdd�|D��|jfS)Nz<%s.%s: %r>�|cSsg|]}t|jp|j��qSr)rprmr[)rKrYrrrr��sz!Flag.__repr__.<locals>.<listcomp>)r5rmr+r[r�rd)r$r)r��	uncoveredrrrr\�s
z
Flag.__repr__cCs�|j}|jdk	r d|j|jfSt||j�\}}t|�dkr^|djdkr^d|j|djfSd|jdjdd�|D��fSdS)Nz%s.%sr rz%s.%rr�cSsg|]}t|jp|j��qSr)rprmr[)rKrYrrrr��sz Flag.__str__.<locals>.<listcomp>)r5rmr+r�r[rrd)r$r)r�r�rrrr]�s
zFlag.__str__cCs
t|j�S)N)�boolr[)r$rrrr��sz
Flag.__bool__cCs"t||j�stS|j|j|jB�S)N)r>r5r�r[)r$r�rrr�__or__�szFlag.__or__cCs"t||j�stS|j|j|j@�S)N)r>r5r�r[)r$r�rrr�__and__�szFlag.__and__cCs"t||j�stS|j|j|jA�S)N)r>r5r�r[)r$r�rrr�__xor__�szFlag.__xor__csDt�j�j�\�}��fdd��jD�}tt|�jd��}�j|�S)Ncs&g|]}|�kr|j�j@r|�qSr)r[)rKrY)r�r$rrr��sz#Flag.__invert__.<locals>.<listcomp>r)r�r5r[r�_or_)r$r��inverted_members�invertedr)r�r$r�
__invert__�szFlag.__invert__N)r+r(r,r-r8r�r9r7r�r\r]r�r�r�r�r�rrrrr
�s

c@sTeZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	eZ
eZe	Zdd
�Z
dS)rzSupport for integer-based FlagscCs*t|t�std||jf��|j|�}|S)Nz%r is not a valid %s)r>�intr<r+r7)r)r/�
new_memberrrrr9�s

zIntFlag._missing_cCs�|jj|d�}|dkr�|g}t||�\}}xL|rvt|�}d|}||jkr\||kr\|j|�||krld}q,||N}q,Wx6t|�D]*}tj||�}d|_||_	|jj
||�}q�W|S)Nrr)rir�r�r�r?r�r�rermr[r�)r)r/r��need_to_createrr��bit�
flag_valuerrrr7�s&


zIntFlag._create_pseudo_member_cCs0t||jtf�stS|j|j|j|�jB�}|S)N)r>r5r�r�r[)r$r��resultrrrr�szIntFlag.__or__cCs,t||jtf�stS|j|j|j|�j@�S)N)r>r5r�r�r[)r$r�rrrr�#szIntFlag.__and__cCs,t||jtf�stS|j|j|j|�jA�S)N)r>r5r�r�r[)r$r�rrrr�(szIntFlag.__xor__cCs|j|j�}|S)N)r5r[)r$r�rrrr�1szIntFlag.__invert__N)r+r(r,r-r�r9r7r�r�r��__ror__�__rand__�__rxor__r�rrrrr�scCs|j�dS)z@returns index of highest bit, or -1 if value is zero or negativer )�
bit_length)r/rrrr�6sr�cCsbg}x0|jj�D]"\}}||jkr|j||jf�qW|r^djdd�|D��}td||f��|S)z?Class decorator for enumerations ensuring unique member values.z, cSsg|]\}}d||f�qS)z%s -> %sr)rK�aliasrrrrr�Bszunique.<locals>.<listcomp>z duplicate values found in %r: %s)r�rRrr?rdr<)�enumeration�
duplicatesrr��
alias_detailsrrrr
:s
cCs�|}|dk}|r*dd�t|jj��D�}ndd�t|jj��D�}g}x4|D],\}}|rL||@|krL|j|�||M}qLW|r�||jkr�|j|j|�|jdd�dd�t|�d	kr�|dj|kr�|jd�||fS)
z#Extract all members from the value.rcSs"g|]\}}|jdk	r||f�qS)N)r)rKrTrYrrrr�Rsz_decompose.<locals>.<listcomp>cSs*g|]"\}}|jdk	st|�r||f�qS)N)r�
_power_of_two)rKrTrYrrrr�YscSs|jS)N)r[)rYrrrr�dsz_decompose.<locals>.<lambda>T)rA�reverser )r�rirRr?r�rr/ra)�flagr/�not_covered�negative�flags_to_checkr�r�r�rrrr�Gs$

r�cCs|dkrdS|dt|�kS)Nr Fr)r�)r/rrrr�jsr�)#r��typesrr�	functoolsr�operatorrr��_collectionsr�ImportError�collections�__all__rrr"r*rjr.r�dictr0rr�rr�r	r�r
rr�r
r�r�rrrr�<module>s@3mA
#subprocess.cpython-36.pyc000064400000105237150335715140011376 0ustar003


 \���@s8dZddlZejdkZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZGdd�de
�ZGdd�de�ZGd	d
�d
e�Zer�ddlZddlZddlZGdd�d�ZnhddlZddlZddlZyddlZWnek
r�ddlZYnXeed
d�Zeed��rejZnejZddddddddddddd
dgZ e�r�ddlm!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(e j)ddddd d!d"d#dg	�Gd$d%�d%e*�Z+gZ,d&d'�Z-d<Z.d=Z/d>Z0d+d,�Z1d-d.�Z2dd/�d0d�Z3d1d�Z4dd/�d2d�Z5Gd3d�de6�Z7ddd4d5�d6d�Z8d7d8�Z9d9d�Z:d:d�Z;e6�Z<Gd;d�de6�Z=dS)?a�Subprocesses with accessible I/O streams

This module allows you to spawn processes, connect to their
input/output/error pipes, and obtain their return codes.

For a complete description of this module see the Python documentation.

Main API
========
run(...): Runs a command, waits for it to complete, then returns a
          CompletedProcess instance.
Popen(...): A class for flexibly executing a command in a new process

Constants
---------
DEVNULL: Special value that indicates that os.devnull should be used
PIPE:    Special value that indicates a pipe should be created
STDOUT:  Special value that indicates that stderr should go to stdout


Older API
=========
call(...): Runs a command, waits for it to complete, then returns
    the return code.
check_call(...): Same as call() but raises CalledProcessError()
    if return code is not 0
check_output(...): Same as check_call() but returns the contents of
    stdout instead of a return code
getoutput(...): Runs a command in the shell, waits for it to complete,
    then returns the output
getstatusoutput(...): Runs a command in the shell, waits for it to complete,
    then returns a (exitcode, output) tuple
�NZwin32)�	monotonicc@seZdZdS)�SubprocessErrorN)�__name__�
__module__�__qualname__�rr�"/usr/lib64/python3.6/subprocess.pyr9src@s<eZdZdZd
dd�Zdd�Zedd��Zejd	d��ZdS)�CalledProcessErrorz�Raised when run() is called with check=True and the process
    returns a non-zero exit status.

    Attributes:
      cmd, returncode, stdout, stderr, output
    NcCs||_||_||_||_dS)N)�
returncode�cmd�output�stderr)�selfr
rrr
rrr�__init__CszCalledProcessError.__init__cCsb|jrN|jdkrNyd|jtj|j�fStk
rJd|j|jfSXnd|j|jfSdS)NrzCommand '%s' died with %r.z)Command '%s' died with unknown signal %d.z.Command '%s' returned non-zero exit status %d.)r
r�signalZSignals�
ValueError)rrrr�__str__IszCalledProcessError.__str__cCs|jS)z+Alias for output attribute, to match stderr)r)rrrr�stdoutUszCalledProcessError.stdoutcCs
||_dS)N)r)r�valuerrrrZs)NN)	rrr�__doc__rr�propertyr�setterrrrrr	<s

r	c@s<eZdZdZd
dd�Zdd�Zedd��Zejd	d��ZdS)�TimeoutExpiredz�This exception is raised when the timeout expires while waiting for a
    child process.

    Attributes:
        cmd, output, stdout, stderr, timeout
    NcCs||_||_||_||_dS)N)r�timeoutrr
)rrrrr
rrrrhszTimeoutExpired.__init__cCsd|j|jfS)Nz'Command '%s' timed out after %s seconds)rr)rrrrrnszTimeoutExpired.__str__cCs|jS)N)r)rrrrrrszTimeoutExpired.stdoutcCs
||_dS)N)r)rrrrrrvs)NN)	rrrrrrrrrrrrrras

rc@s eZdZdZdZdZdZdZdS)�STARTUPINFOrN)rrr�dwFlags�	hStdInput�
hStdOutput�	hStdError�wShowWindowrrrrr�s
rZPIPE_BUFi�PollSelector�Popen�PIPE�STDOUT�call�
check_call�getstatusoutput�	getoutput�check_output�run�DEVNULL�CompletedProcess)�CREATE_NEW_CONSOLE�CREATE_NEW_PROCESS_GROUP�STD_INPUT_HANDLE�STD_OUTPUT_HANDLE�STD_ERROR_HANDLE�SW_HIDE�STARTF_USESTDHANDLES�STARTF_USESHOWWINDOWr,r-r.r/r0r1r2r3c@s6eZdZdZejfdd�Zdd�Zdd�ZeZ	eZ
dS)	�HandleFcCs|jsd|_||�dS)NT)�closed)r�CloseHandlerrr�Close�szHandle.ClosecCs |jsd|_t|�Std��dS)NTzalready closed)r5�intr)rrrr�Detach�sz
Handle.DetachcCsd|jjt|�fS)Nz%s(%d))�	__class__rr8)rrrr�__repr__�szHandle.__repr__N)rrrr5�_winapir6r7r9r;�__del__rrrrrr4�sr4cCsTxNtdd�D]>}|jtjd�}|dk	rytj|�Wqtk
rJYqXqWdS)N)�
_deadstate)�_active�_internal_poll�sys�maxsize�remover)Zinst�resrrr�_cleanup�srE���cCs*g}tjj}|dkr&|jdd|�|S)zgReturn a list of command-line arguments reproducing the current
    optimization settings in sys.flags.r�-�O)rA�flags�optimize�append)�argsrrrr�"_optim_args_from_interpreter_flags�s
rOcCsddddddd�}t�}x:|j�D].\}}ttj|�}|dkr"|jd	||�q"Wtjjrh|jd
�n$tjjrz|jd�tjjr�|jd�xtj	D]}|jd
|�q�Wttdi�}xDdD]<}||kr�||}|dkr�|}nd||f}|j
d|f�q�W|S)z}Return a list of command-line arguments reproducing the current
    settings in sys.flags, sys.warnoptions and sys._xoptions.�d�B�S�v�b�q)�debug�dont_write_bytecode�no_site�verbose�
bytes_warning�quietrrIz-Iz-Ez-sz-W�	_xoptions�faulthandler�tracemalloc�showalloccount�showrefcount�utf8Tz%s=%sz-X)r]r^r_r`ra)rO�items�getattrrArKrM�isolated�ignore_environment�no_user_site�warnoptions�extend)Zflag_opt_maprN�flag�optrSZxoptionsr�argrrr�_args_from_interpreter_flags�s:

rl)rcOsFt||��2}y|j|d�S|j�|j��YnXWdQRXdS)z�Run command with arguments.  Wait for command to complete or
    timeout, then return the returncode attribute.

    The arguments are the same as for the Popen constructor.  Example:

    retcode = call(["ls", "-l"])
    )rN)r!�wait�kill)r�	popenargs�kwargs�prrrr$scOs6t||�}|r2|jd�}|dkr(|d}t||��dS)aORun command with arguments.  Wait for command to complete.  If
    the exit code was zero then return, otherwise raise
    CalledProcessError.  The CalledProcessError object will have the
    return code in the returncode attribute.

    The arguments are the same as for the call function.  Example:

    check_call(["ls", "-l"])
    rNNr)r$�getr	)rorp�retcoderrrrr%(s



cOsTd|krtd��d|kr<|ddkr<|jdd�r4dnd|d<t|t|d	d
�|��jS)a(Run command with arguments and return its output.

    If the exit code was non-zero it raises a CalledProcessError.  The
    CalledProcessError object will have the return code in the returncode
    attribute and output in the output attribute.

    The arguments are the same as for the Popen constructor.  Example:

    >>> check_output(["ls", "-l", "/dev/null"])
    b'crw-rw-rw- 1 root root 1, 3 Oct 18  2007 /dev/null\n'

    The stdout argument is not allowed as it is used internally.
    To capture standard error in the result, use stderr=STDOUT.

    >>> check_output(["/bin/sh", "-c",
    ...               "ls -l non_existent_file ; exit 0"],
    ...              stderr=STDOUT)
    b'ls: non_existent_file: No such file or directory\n'

    There is an additional optional argument, "input", allowing you to
    pass a string to the subprocess's stdin.  If you use this argument
    you may not also use the Popen constructor's "stdin" argument, as
    it too will be used internally.  Example:

    >>> check_output(["sed", "-e", "s/foo/bar/"],
    ...              input=b"when in the course of fooman events\n")
    b'when in the course of barman events\n'

    If universal_newlines=True is passed, the "input" argument must be a
    string and the return value will be a string rather than bytes.
    rz3stdout argument not allowed, it will be overridden.�inputN�universal_newlinesF��T)rr�check)rrrr)r"r)rrorprrrr(;s c@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
r+aEA process that has finished running.

    This is returned by run().

    Attributes:
      args: The list or str args passed to run().
      returncode: The exit code of the process, negative for signals.
      stdout: The standard output (None if not captured).
      stderr: The standard error (None if not captured).
    NcCs||_||_||_||_dS)N)rNr
rr
)rrNr
rr
rrrrrszCompletedProcess.__init__cCshdj|j�dj|j�g}|jdk	r4|jdj|j��|jdk	rP|jdj|j��djt|�jdj|��S)Nz	args={!r}zreturncode={!r}zstdout={!r}zstderr={!r}z{}({})z, )	�formatrNr
rrMr
�typer�join)rrNrrrr;xs


zCompletedProcess.__repr__cCs |jrt|j|j|j|j��dS)z6Raise CalledProcessError if the exit code is non-zero.N)r
r	rNrr
)rrrr�check_returncode�sz!CompletedProcess.check_returncode)NN)rrrrrr;r|rrrrr+gs

	F)rtrrxc	Os�|dk	r d|krtd��t|d<t||���}y|j||d�\}}WnVtk
r||j�|j�\}}t|j|||d��Yn|j�|j��YnX|j�}|r�|r�t	||j||d��WdQRXt
|j|||�S)afRun command with arguments and return a CompletedProcess instance.

    The returned instance will have attributes args, returncode, stdout and
    stderr. By default, stdout and stderr are not captured, and those attributes
    will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them.

    If check is True and the exit code was non-zero, it raises a
    CalledProcessError. The CalledProcessError object will have the return code
    in the returncode attribute, and output & stderr attributes if those streams
    were captured.

    If timeout is given, and the process takes too long, a TimeoutExpired
    exception will be raised.

    There is an optional argument "input", allowing you to
    pass a string to the subprocess's stdin.  If you use this argument
    you may not also use the Popen constructor's "stdin" argument, as
    it will be used internally.

    The other arguments are the same as for the Popen constructor.

    If universal_newlines=True is passed, the "input" argument must be a
    string and stdout/stderr in the returned object will be strings rather than
    bytes.
    N�stdinz/stdin and input arguments may not both be used.)r)rr
)rr"r!�communicaterrnrNrm�pollr	r+)	rtrrxrorpZprocessrr
rsrrrr)�s*
cCs�g}d}x�|D]�}g}|r$|jd�d|kp8d|kp8|}|rH|jd�xj|D]b}|dkrf|j|�qN|dkr�|jdt|�d�g}|jd�qN|r�|j|�g}|j|�qNW|r�|j|�|r|j|�|jd�qWdj|�S)	a�
    Translate a sequence of arguments into a command line
    string, using the same rules as the MS C runtime:

    1) Arguments are delimited by white space, which is either a
       space or a tab.

    2) A string surrounded by double quotation marks is
       interpreted as a single argument, regardless of white space
       contained within.  A quoted string can be embedded in an
       argument.

    3) A double quotation mark preceded by a backslash is
       interpreted as a literal double quotation mark.

    4) Backslashes are interpreted literally, unless they
       immediately precede a double quotation mark.

    5) If backslashes immediately precede a double quotation mark,
       every pair of backslashes is interpreted as a literal
       backslash.  If the number of backslashes is odd, the last
       backslash escapes the next double quotation mark as
       described in rule 3.
    F� �	�"�\rGz\"rv)rM�lenrhr{)�seq�resultZ	needquoterkZbs_buf�crrr�list2cmdline�s4






r�cCslyt|ddtd�}d}Wn.tk
rF}z|j}|j}WYdd}~XnX|dd�dkrd|dd�}||fS)	a�Return (exitcode, output) of executing cmd in a shell.

    Execute the string 'cmd' in a shell with 'check_output' and
    return a 2-tuple (status, output). The locale encoding is used
    to decode the output and process newlines.

    A trailing newline is stripped from the output.
    The exit status for the command can be interpreted
    according to the rules for the function 'wait'. Example:

    >>> import subprocess
    >>> subprocess.getstatusoutput('ls /bin/ls')
    (0, '/bin/ls')
    >>> subprocess.getstatusoutput('cat /bin/junk')
    (1, 'cat: /bin/junk: No such file or directory')
    >>> subprocess.getstatusoutput('/bin/junk')
    (127, 'sh: /bin/junk: not found')
    >>> subprocess.getstatusoutput('/bin/kill $$')
    (-15, '')
    T)�shellrur
rNrF�
���r�)r(r#r	rr
)r�dataZexitcodeZexrrrr&scCst|�dS)a%Return output (stdout or stderr) of executing cmd in a shell.

    Like getstatusoutput(), except the exit status is ignored and the return
    value is a string containing the command's output.  Example:

    >>> import subprocess
    >>> subprocess.getoutput('ls /bin/ls')
    '/bin/ls'
    rF)r&)rrrrr'"s
c@s�eZdZdZdZd?dddddeddddddddffddd�dd	�Zd
d�Zdd
�Zdd�Z	e
jej
fdd�Zdd�Zdd�Zd@dd�Zdd�Zdd�Zdd�Ze�rdd�Zd d!�Zd"d#�Zdejejejfd$d%�ZdAd&d'�Zd(d)�Zd*d+�Z d,d-�Z!d.d/�Z"e"Z#n�d0d�Zd1d#�Ze$j%e$j&e$j'e$j(e$j)e$j*fd2d3�Z+de$j,e$j-e.j/fd4d%�Zd5d6�Z0dBd7d'�Zd8d+�Z d9d:�Z1d;d-�Z!d<d/�Z"d=d>�Z#dS)Cr!a� Execute a child program in a new process.

    For a complete description of the arguments see the Python documentation.

    Arguments:
      args: A string, or a sequence of program arguments.

      bufsize: supplied as the buffering argument to the open() function when
          creating the stdin/stdout/stderr pipe file objects

      executable: A replacement program to execute.

      stdin, stdout and stderr: These specify the executed programs' standard
          input, standard output and standard error file handles, respectively.

      preexec_fn: (POSIX only) An object to be called in the child process
          just before the child is executed.

      close_fds: Controls closing or inheriting of file descriptors.

      shell: If true, the command will be executed through the shell.

      cwd: Sets the current directory before the child is executed.

      env: Defines the environment variables for the new process.

      universal_newlines: If true, use universal line endings for file
          objects stdin, stdout and stderr.

      startupinfo and creationflags (Windows only)

      restore_signals (POSIX only)

      start_new_session (POSIX only)

      pass_fds (POSIX only)

      encoding and errors: Text mode encoding and error handling to use for
          file objects stdin, stdout and stderr.

    Attributes:
        stdin, stdout, stderr, pid, returncode
    FrFNrT)�encoding�errorscCsrt�tj�|_d|_d|_|dkr(d}t|t�s:td��t	r�|dk	rNt
d��|dk	pd|dk	pd|dk	}|tkr~|rxd}q�d}q�|r�|r�t
d��nF|tkr�d}|r�|r�tj
dt�d}|
dk	r�t
d	��|d
kr�t
d��||_d|_d|_d|_d|_d|_||_||_||_|j|||�\}}}}}}t	�rz|dk�rFtj|j�d
�}|dk�r`tj|j�d
�}|dk�rztj|j�d
�}|�p�|�p�|}d|_y�|dk�r�tj|d|�|_|�r�tj|jd|dk||d
�|_|dk�rtj|d|�|_|�rtj|j||d�|_|dk�r6tj|d|�|_|�r6tj|j||d�|_|j ||||||
||
||	||||||||�W�nxDt!d|j|j|jf�D]*}y|j"�Wnt#k
�r�YnX�q�W|j�sfg}|t$k�r�|j%|�|t$k�r�|j%|�|t$k�r�|j%|�t&|d��r|j%|j'�xP|D]H}y*t	�r<t|t(��r<|j)�n
t*j"|�Wnt#k
�r^YnX�qW�YnXdS)zCreate new Popen instance.NFrFzbufsize must be an integerz0preexec_fn is not supported on Windows platformsTzSclose_fds is not supported on Windows platforms if you redirect stdin/stdout/stderrzpass_fds overriding close_fds.z2startupinfo is only supported on Windows platformsrz4creationflags is only supported on Windows platforms�wb)�
write_through�line_bufferingr�r��rb)r�r��_devnullr�r�r�r�r�r�r�)+rE�	threadingZLock�
_waitpid_lock�_input�_communication_started�
isinstancer8�	TypeError�
_mswindowsr�_PLATFORM_DEFAULT_CLOSE_FDS�warnings�warn�RuntimeWarningrNr}rr
�pidr
rur�r��_get_handles�msvcrtZopen_osfhandler9�_closed_child_pipe_fds�io�open�
TextIOWrapper�_execute_child�filter�close�OSErrorr"rM�hasattrr�r4r7�os)rrN�bufsize�
executabler}rr
�
preexec_fn�	close_fdsr��cwd�envru�startupinfo�
creationflags�restore_signals�start_new_session�pass_fdsr�r�Z
any_stdio_set�p2cread�p2cwrite�c2pread�c2pwrite�errread�errwriteZ	text_mode�fZto_close�fdrrrr`s�

















zPopen.__init__cCs |j||�}|jdd�jdd�S)Nz
r��
)�decode�replace)rr�r�r�rrr�_translate_newlines�szPopen._translate_newlinescCs|S)Nr)rrrr�	__enter__�szPopen.__enter__c
CsD|jr|jj�|jr |jj�z|jr2|jj�Wd|j�XdS)N)rr�r
r}rm)rrzr�	tracebackrrr�__exit__�s

zPopen.__exit__cCsT|js
dS|jdkr(|d|jt|d�|j|d�|jdkrPtdk	rPtj|�dS)Nzsubprocess %s is still running)�source)r>)�_child_createdr
r��ResourceWarningr@r?rM)rZ_maxsizeZ_warnrrrr=
s


z
Popen.__del__cCs"t|d�stjtjtj�|_|jS)Nr�)r�r�r��devnull�O_RDWRr�)rrrr�_get_devnulls
zPopen._get_devnullcCs�|rZy|jj|�WnDtk
r(Yn2tk
rX}z|jtjkrFn�WYdd}~XnXy|jj�WnDtk
r|Yn2tk
r�}z|jtjkr�n�WYdd}~XnXdS)N)r}�write�BrokenPipeErrorr��errnoZEINVALr�)rrt�excrrr�_stdin_writes"zPopen._stdin_writecCs�|jr|rtd��|dkr�|jr�|j|j|jgjd�dkr�d}d}|jrV|j|�n6|jrr|jj�}|jj�n|jr�|jj�}|jj�|j	�nJ|dk	r�t
�|}nd}z|j|||�\}}Wdd|_X|j	|j|�d�}||fS)a4Interact with process: Send data to stdin.  Read data from
        stdout and stderr, until end-of-file is reached.  Wait for
        process to terminate.

        The optional "input" argument should be data to be sent to the
        child process (if self.universal_newlines is True, this should
        be a string; if it is False, "input" should be bytes), or
        None, if no data should be sent to the child.

        communicate() returns a tuple (stdout, stderr).  These will be
        bytes or, if self.universal_newlines was True, a string.
        z.Cannot send input after starting communicationNrGT)r)
r�rr}rr
�countr��readr�rm�_time�_communicate�_remaining_time)rrtrrr
�endtime�stsrrrr~7s.




zPopen.communicatecCs|j�S)zSCheck if child process has terminated. Set and return returncode
        attribute.)r@)rrrrrhsz
Popen.pollcCs|dkrdS|t�SdS)z5Convenience for _communicate when computing timeouts.N)r�)rr�rrrr�nszPopen._remaining_timecCs&|dkrdSt�|kr"t|j|��dS)z2Convenience for checking if a timeout has expired.N)r�rrN)rr��orig_timeoutrrr�_check_timeoutvs
zPopen._check_timeoutcCs�|dkr|dkr|dkrd
Sd
\}}d\}}d\}}	|dkrttjtj�}|dkrrtjdd�\}}
t|�}tj|
�nj|tkr�tjdd�\}}t|�t|�}}n>|tkr�tj	|j
��}n&t|t��r�tj	|�}ntj	|j
��}|j|�}|dk�r,tjtj�}|dk�r�tjdd�\}
}t|�}tj|
�nn|tk�rZtjdd�\}}t|�t|�}}n@|tk�rttj	|j
��}n&t|t��r�tj	|�}ntj	|j
��}|j|�}|dk�r�tjtj�}	|	dk�rftjdd�\}
}	t|	�}	tj|
�n~|tk�rtjdd�\}}	t|�t|	�}}	nP|tk�r&|}	n@|tk�r@tj	|j
��}	n&t|t��rXtj	|�}	ntj	|j
��}	|j|	�}	||||||	fS)z|Construct and return tuple with IO objects:
            p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
            NrFrr�r�r�r�r�r�)r�r�r�r�r�r�r�r�)r�r�r�r�)r�r�r�r�)r�r�)r<ZGetStdHandler.Z
CreatePiper4r6r"r*r�Z
get_osfhandler�r�r8�fileno�_make_inheritabler/r0r#)rr}rr
r�r�r�r�r�r��_rrrr��sn











zPopen._get_handlescCs&tjtj�|tj�ddtj�}t|�S)z2Return a duplicate of handle, which is inheritablerrF)r<ZDuplicateHandleZGetCurrentProcessZDUPLICATE_SAME_ACCESSr4)rZhandle�hrrrr��s

zPopen._make_inheritablecCsJ|std��t|t�s t|�}|dkr.t�}d	|||fkr^|jtjO_||_||_	||_
|
r�|jtjO_tj|_
tjjdd�}dj||�}z>tj||ddt|�|	||dk	r�tj|�nd|�	\}}}}Wd|d
kr�|j�|dkr�|j�|dk�r|j�t|d��rtj|j�d|_Xd|_t|�|_||_tj|�dS)
z$Execute program (MS Windows version)z"pass_fds not supported on Windows.NrFZCOMSPECzcmd.exez
{} /c "{}"r�Tr�r�r�r�)�AssertionErrorr��strr�rrr<r2rrrr3r1rr��environrrryZ
CreateProcessr8�fspathr7r�r�r�r�r�r4�_handler�r6)rrNr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Zunused_restore_signalsZunused_start_new_sessionZcomspecZhpZhtr��tidrrrr��sH	


zPopen._execute_childcCs,|jdkr&||jd�|kr&||j�|_|jS)z�Check if child process has terminated.  Returns returncode
            attribute.

            This method is called by __del__, so it can only refer to objects
            in its local scope.

            Nr)r
r�)rr>Z_WaitForSingleObjectZ_WAIT_OBJECT_0Z_GetExitCodeProcessrrrr@s
zPopen._internal_pollcCs�|dk	r"tjdtdd�|j|�}|dkr2tj}nt|d�}|jdkrztj|j	|�}|tj
krlt|j|��tj
|j	�|_|jS)zOWait for child process to terminate.  Returns returncode
            attribute.Nz0'endtime' argument is deprecated; use 'timeout'.rG)�
stackleveli�)r�r��DeprecationWarningr�r<ZINFINITEr8r
�WaitForSingleObjectr�ZWAIT_TIMEOUTrrN�GetExitCodeProcess)rrr�Ztimeout_millisr�rrrrm$s 


z
Popen.waitcCs|j|j��|j�dS)N)rMr�r�)rZfh�bufferrrr�
_readerthread:szPopen._readerthreadcCs`|jrDt|d�rDg|_tj|j|j|jfd�|_d|j_|jj�|j	r�t|d�r�g|_
tj|j|j	|j
fd�|_d|j_|jj�|jr�|j
|�|jdk	r�|jj|j|��|jj�r�t|j|��|j	dk	r�|jj|j|��|jj�r�t|j|��d}d}|j�r|j}|jj�|j	�r4|j
}|j	j�|dk	�rF|d}|dk	�rX|d}||fS)N�_stdout_buff)�targetrNT�_stderr_buffr)rr�r�r�ZThreadr�Z
stdout_threadZdaemon�startr
r�Z
stderr_threadr}r�r{r�Zis_aliverrNr�)rrtr�r�rr
rrrr�?sF










zPopen._communicatecCsl|jdk	rdS|tjkr"|j�nF|tjkr>tj|jtj�n*|tjkrZtj|jtj�nt	dj
|���dS)zSend a signal to the process.NzUnsupported signal: {})r
r�SIGTERM�	terminateZCTRL_C_EVENTr�rnr�ZCTRL_BREAK_EVENTrry)r�sigrrr�send_signalss




zPopen.send_signalcCsX|jdk	rdSytj|jd�Wn2tk
rRtj|j�}|tjkrH�||_YnXdS)zTerminates the process.NrF)r
r<ZTerminateProcessr��PermissionErrorr�ZSTILL_ACTIVE)rZrcrrrr��s

zPopen.terminatec
Cs.d\}}d\}}d\}}	|dkr"n@|tkr8tj�\}}n*|tkrJ|j�}nt|t�rZ|}n|j�}|dkrln@|tkr�tj�\}}n*|tkr�|j�}nt|t�r�|}n|j�}|dkr�nh|tkr�tj�\}}	nR|tk�r�|dkr�|}	n
t	j
j�}	n.|tk�r|j�}	nt|t��r|}	n|j�}	||||||	fS)
z|Construct and return tuple with IO objects:
            p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
            rFNr�r�)r�r�r�r�)r�r�r�r�)r�r�r�)r"r��piper*r�r�r8r�r#rA�
__stdout__)
rr}rr
r�r�r�r�r�r�rrrr��sJ






c)"s�t|ttf�r|g}nt|�}|
r:ddg|}�r:�|d<�dkrJ|d��}tj�\}}g}x |dkr~|j|�tj|�}q`Wx|D]}tj|�q�W�z�z�|dk	r�g}xL|j	�D]:\}}tj
|�}d|kr�td��|j|dtj
|��q�Wnd}tj
���tjj
���r�f}nt�fdd	�tj|�D��}t|�}|j|�tj|||tttt|���|||||
||||||||�|_d
|_Wdtj|�Xt|dd�}|dk�r�|dk�r�||k�r�tj|�|dk�r�|
dk�r�||k�r�tj|�|dk�r|dk�r||k�rtj|�|dk	�r.tj|�d
|_t�}x2tj|d
�}||7}|�sft|�d
k�r<P�q<WWdtj|�X|�r�y6tj|jd�\} }!| |jk�r�|j|!�nt j!|_"Wnt#k
�r�YnXy|j$dd�\}"}#}$|$j%�}$Wn,tk
�rd}"d}#dj&t|��}$YnXtt'|"j%d�t(�}%t)|%t*��r�|#�r�t|#d�}&|$dk}'|'�rdd}$|}(n|}(|&dk�r�tj+|&�}$|&t,j-k�r�|$dt.|(�7}$|%|&|$|(��|%|$��dS)zExecute program (POSIX version)z/bin/shz-crNrH�=z!illegal environment variable namec3s"|]}tjjtj|���VqdS)N)r��pathr{�fsencode)�.0�dir)r�rr�	<genexpr>sz'Popen._execute_child.<locals>.<genexpr>Tr�rFiP��:rGsSubprocessError�0z#Bad exception data from child: {!r}�ascii�Znoexecrvz: r�r�r�r�r�r�)/r�r��bytes�listr�r�rM�dupr�rbr�rr��dirname�tuple�
get_exec_path�set�add�_posixsubprocessZ	fork_exec�sorted�mapr8r�r�rcr��	bytearrayr�r��waitpid�_handle_exitstatusrArBr
�ChildProcessError�splitr�ry�builtinsr�
issubclassr��strerrorr��ENOENT�repr))rrNr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Zorig_executableZerrpipe_readZ
errpipe_writeZlow_fds_to_closeZlow_fdZenv_list�krSZexecutable_listZfds_to_keepZ
devnull_fdZerrpipe_data�partr�r�Zexception_nameZ	hex_errnoZerr_msgZchild_exception_typeZ	errno_numZchild_exec_never_calledZerr_filenamer)r�rr��s�	
















cCsL||�r||�|_n2||�r*||�|_n||�r@||�|_ntd��dS)z:All callers to this function MUST hold self._waitpid_lock.zUnknown child exit status!N)r
r)rr�Z_WIFSIGNALEDZ	_WTERMSIGZ
_WIFEXITEDZ_WEXITSTATUSZ_WIFSTOPPEDZ	_WSTOPSIGrrrrXszPopen._handle_exitstatuscCs�|jdkr�|jjd�sdSz�y8|jdk	r.|jS||j|�\}}||jkrR|j|�WnBtk
r�}z&|dk	rv||_n|j|kr�d|_WYdd}~XnXWd|jj�X|jS)z�Check if child process has terminated.  Returns returncode
            attribute.

            This method is called by __del__, so it cannot reference anything
            outside of the local scope (nor can any methods it calls).

            NFr)r
r��acquirer�rr�r��release)rr>Z_waitpidZ_WNOHANGZ_ECHILDr�r��errrr@js 	



cCs>ytj|j|�\}}Wntk
r4|j}d}YnX||fS)z:All callers to this function MUST hold self._waitpid_lock.r)r�rr�r
)rZ
wait_flagsr�r�rrr�	_try_wait�s
zPopen._try_waitcCsp|jdk	r|jS|dk	r(tjdtdd�|dk	s8|dk	r^|dkrLt�|}n|dkr^|j|�}|dk	�rd}x�|jjd�r�zL|jdk	r�P|jt	j
�\}}||jks�|dks�t�||jkr�|j
|�PWd|jj�X|j|�}|dkr�t|j|��t|d|d�}tj|�qnWnXxV|jdk�rh|j�8|jdk	�r6P|jd�\}}||jk�rZ|j
|�WdQRX�qW|jS)	zOWait for child process to terminate.  Returns returncode
            attribute.Nz0'endtime' argument is deprecated; use 'timeout'.rG)r�g����Mb@?Frg�������?)r
r�r�r�r�r�r�rrr��WNOHANGr�r�rrrrN�min�timeZsleep)rrr�Zdelayr�r�Z	remainingrrrrm�sL






c#Cs|jrZ|jrZy|jj�Wntk
r0YnX|sZy|jj�Wntk
rXYnXd}d}|js�i|_|jr�g|j|j<|jr�g|j|j<|jr�|j|j}|jr�|j|j}|j|�|j	r�t
|j	�}t����}|jr�|r�|j|jt
j�|j�r|j|jt
j�|j�r$|j|jt
j��xJ|j��rp|j|�}|dk	�r\|dk�r\t|j|��|j|�}	|j||�x�|	D]�\}
}|
j|jk�r||j|jt�}y|jtj|
j|�7_Wn,tk
�r�|j|
j�|
jj�Yn*X|jt|j	�k�rf|j|
j�|
jj�nP|
j|j|jfk�rxtj|
jd�}
|
�sT|j|
j�|
jj�|j|
jj|
��qxW�q(WWdQRX|j |j|�d�|dk	�r�dj!|�}|dk	�r�dj!|�}|j"�s�|j#�s�|j$�r|dk	�r�|j%||jj"|jj#�}|dk	�r|j%||jj"|jj#�}||fS)Nri�)rrw)&r}r��flushr�r�Z_fileobj2outputrr
�_save_inputr��
memoryview�_PopenSelector�register�	selectorsZEVENT_WRITEZ
EVENT_READZget_mapr�rrN�selectr�Zfileobj�
_input_offset�	_PIPE_BUFr�r�r�Z
unregisterr�r�rMrmr{r�r�rur�)rrtr�r�rr
Z
input_viewZselectorrZready�keyZevents�chunkr�rrrr��s�






(







cCsR|jrN|jdkrNd|_||_|dk	rN|js6|js6|jrN|jj|jj|jj�|_dS)Nr)r}r�r$r�r�ru�encode)rrtrrrr/szPopen._save_inputcCs|jdkrtj|j|�dS)zSend a signal to the process.N)r
r�rnr�)rr�rrrr�<s
cCs|jtj�dS)z/Terminate the process with SIGTERM
            N)r�rr�)rrrrr�BscCs|jtj�dS)z*Kill the process with SIGKILL
            N)r�r�SIGKILL)rrrrrnGsz
Popen.killr�)NN)NN)NN)2rrrrr�r�rr�r�r�rArBr�r�r=r�r�r~rr�r�r�r�r�r�r<r�Z
WAIT_OBJECT_0r�r@rmr�r�r�r�rnr��WIFSIGNALED�WTERMSIG�	WIFEXITED�WEXITSTATUS�
WIFSTOPPED�WSTOPSIGrrrr�ZECHILDrrrrrrr!2sd+
1H	@
46
"
4a
r�������)>rrA�platformr�r�r�rrrr�r�rr��	Exceptionrr	rr�r�r<rrr#r"�ImportErrorZdummy_threadingrcr%r�r r ZSelectSelector�__all__r,r-r.r/r0r1r2r3rhr8r4r?rEr"r#r*rOrlr$r%r(�objectr+r)r�r&r'r�r!rrrr�<module>*sr
%

(
.,!2I
pickletools.cpython-36.opt-1.pyc000064400000177223150335715140012501 0ustar003


 \f�I@s�
dZddlZddlZddlZddlZddlZdddgZejZ�d�Z�d�Z	�d�Z
�d�Z�d�ZGdd�de
�Zdd
lmZdd�Zeddedd�Zdd�Zeddedd�Zdd�Zedd	edd�Zdd�Zedd	edd�Zdd �Zed!d"ed#d�Z�d�d%d&�Zed'eed(d�Zd)d*�Zed+eed,d�Zd-d.�Z ed/ee d0d�Z!d1d2�Z"ed3e	e"d4d�Z#d5d6�Z$ed7e
e$d8d�Z%d9d:�Z&ed;e	e&d<d�Z'd=d:�Z&ed;e	e&d>d�Z'd?d@�Z(edAee(dBd�Z)dCdD�Z*edEee*dFd�Z+dGdH�Z,edIee,dJd�Z-dKdL�Z.edMe	e.dNd�Z/dOdP�Z0edQee0dRd�Z1dSdT�Z2edUee2dVd�Z3dWdX�Z4dYdZ�Z5ed[ee4d\d�Z6ed]ee5d^d�Z7d_d`�Z8edaee8dbd�Z9dcdd�Z:eded"e:dfd�Z;ddglm<Z<dhdi�Z=edje	e=dkd�Z>dldm�Z?edne
e?dod�Z@Gdpdq�dqe
�ZAeAdreBdsdt�ZCZDeAdueBeEfdvdt�ZFeAdweEdxdt�ZGeAdyeHdzdt�ZIeAd{eJeKfd|dt�ZLZMeAd}eJd~dt�ZNeAdeKd�dt�ZOeAd�ePd�d�dt�ZQeAd�eRd�dt�ZSeAd�eTd�dt�ZUeAd�eVd�dt�ZWeAd�eXd�dt�ZYeAd�eXd�dt�ZZeAd�e
d�dt�Z[eAd�eAd�dt�Z\eAd�eAd�dt�Z]Gd�d��d�e
�Z^e^Z_e_d�d�e6geFgdd�d��e_d�d�egeCgdd�d��e_d�d�egeCgdd�d��e_d�d�egeCgdd�d��e_d�d�e7geCgdd�d��e_d�d�e>geCgdd�d��e_d�d�e@geCgdd�d��e_d�d�egeLgdd�d��e_d�d�e%geLgdd�d��e_d�d�e#geLgdd�d��e_d�d�e)geNgdd�d��e_d�d�e'geNgdd�d��e_d�d�e+geNgd	d�d��e_d�d�dgeQgdd�d��e_d�d�dgeGgdd�d��e_d�d�dgeGgdd�d��e_d�d�e-geOgdd�d��e_d�d�e/geOgd	d�d��e_d�d�e1geOgdd�d��e_d�d�e3geOgd	d�d��e_d�d�e9geIgdd�d��e_d�d�e;geIgdd�d��e_d�d�dgeUgdd�d��e_d�d�deUe[geUgdd�d��e_d�d�deUe\e]geUgdd�d��e_d�d�de\e]geUgdd�d��e_d�d�dgeSgdd�d��e_d�d�de\e]geSgdd�d��e_d�d�de[geSgdd�d��e_d�d�de[e[geSgdd�d��e_d�d�de[e[e[geSgdd�d��e_d�d�dgeWgdd�d��e_d�d�de\e]geWgdd�d��e_d�d�deWe[e[geWgdd�d��e_d�d�deWe\e]geWgdd�d��e_d��ddgeYgd	�dd��e_�d�ddeYe\e]geYgd	�dd��e_�d�dde\e]geZgd	�dd��e_�d�d	de[ggd�d
d��e_�d�dde[ge[e[gd�d
d��e_�d�ddge\gd�dd��e_�d�dde\e]ggd�dd��e_�d�de6ge[gd�dd��e_�d�dege[gd�dd��e_�d�dege[gd�dd��e_�d�de6ggd�dd��e_�d �d!eggd�d"d��e_�d#�d$eggd�d%d��e_�d&�d'de[ge[gd	�d(d��e_�d)�d*ege[gd�d+d��e_�d,�d-ege[gd�d.d��e_�d/�d0ege[gd�d1d��e_�d2�d3e!ge[gd�d4d��e_�d5�d6deOeOge[gd	�d7d��e_�d8�d9de[e[ge[gd�d:d��e_�d;�d<de[e[ge[gd�d=d��e_�d>�d?e!e\e]ge[gd�d@d��e_�dA�dBde\e[e]ge[gd�dCd��e_�dD�dEde[e[ge[gd�dFd��e_�dG�dHde[e[e[ge[gd	�dId��e_�dJ�dKeggd�dLd��e_�dM�dNde[ggd�dOd��e_�dP�dQeggd	�dRd��e_�dS�dTege[gd�dUd��e_�dV�dWde[ge[gd�dXd��gAZ`[_iZaiZbxzece`�D]n\ZdZeeejfeak�
r�eg�dYeejfeaeejfedf��eejhebk�
r�eg�dZeejhebeejhedf��edeaeejf<edebeejh<�
q�W[a[b[d[eiZixe`D]Zeeeeieejh<�qW[e�d��d\�d]�Zjej�[j�d��d^�d_�Zk�d`d�Zl�dad�Zm�d��dbd�ZnG�dc�dd��dd�Zo�deZp�dfZqepeq�dg�Zr�dh�di�Zset�djk�
r�ddluZueujv�dk�dl�Zwewjx�dmeujy�dn��do�dp�dq�ewjx�dr�dsejzeujy�dt��du�dv�ewjx�dw�dx�dy�dz�d{�ewjx�d|�d}d	eB�d~�dv�ewjx�d�d��dy�d��d{�ewjx�d��d��d��d��d��ewjx�d��d��dy�d��d{�ewjx�d��dy�d��d{�ewj{�Z|e|j}�r�es�n�e|j~�r�d�ndZ~e|j�s�ewj��n�e�e|j�dk�
r*ene|jde|j�de|j�e~�nZe|j��
r6indZ�xHe|jD]>Z�e|j�j�e�jf�d��Z�e|j�j�e��d��ene�e|j�e�e|j�e~��
qBWdS(�ar"Executable documentation" for the pickle module.

Extensive comments about the pickle protocols and pickle-machine opcodes
can be found here.  Some functions meant for external use:

genops(pickle)
   Generate all the opcodes in a pickle, as (opcode, arg, position) triples.

dis(pickle, out=None, memo=None, indentlevel=4)
   Print a symbolic disassembly of a pickle.
�N�dis�genops�optimize�����c@seZdZdZdd�ZdS)	�ArgumentDescriptor�name�n�reader�doccCs||_||_||_||_dS)N)rrr
r)�selfrrr
r�r�#/usr/lib64/python3.6/pickletools.py�__init__�szArgumentDescriptor.__init__N)rrr
r)�__name__�
__module__�__qualname__�	__slots__rrrrrr
�s
r
)�unpackcCs"|jd�}|r|dStd��dS)zG
    >>> import io
    >>> read_uint1(io.BytesIO(b'\xff'))
    255
    rrz'not enough data in stream to read uint1N)�read�
ValueError)�f�datarrr�
read_uint1�s
r�uint1zOne-byte unsigned integer.)rrr
rcCs0|jd�}t|�dkr$td|�dStd��dS)z�
    >>> import io
    >>> read_uint2(io.BytesIO(b'\xff\x00'))
    255
    >>> read_uint2(io.BytesIO(b'\xff\xff'))
    65535
    rz<Hrz'not enough data in stream to read uint2N)r�len�_unpackr)rrrrr�
read_uint2�s	
r �uint2z)Two-byte unsigned integer, little-endian.cCs0|jd�}t|�dkr$td|�dStd��dS)z�
    >>> import io
    >>> read_int4(io.BytesIO(b'\xff\x00\x00\x00'))
    255
    >>> read_int4(io.BytesIO(b'\x00\x00\x00\x80')) == -(2**31)
    True
    rz<irz&not enough data in stream to read int4N)rrrr)rrrrr�	read_int4�s	
r"�int4z8Four-byte signed integer, little-endian, 2's complement.cCs0|jd�}t|�dkr$td|�dStd��dS)z�
    >>> import io
    >>> read_uint4(io.BytesIO(b'\xff\x00\x00\x00'))
    255
    >>> read_uint4(io.BytesIO(b'\x00\x00\x00\x80')) == 2**31
    True
    rz<Irz'not enough data in stream to read uint4N)rrrr)rrrrr�
read_uint4s	
r$�uint4z*Four-byte unsigned integer, little-endian.cCs0|jd�}t|�dkr$td|�dStd��dS)z�
    >>> import io
    >>> read_uint8(io.BytesIO(b'\xff\x00\x00\x00\x00\x00\x00\x00'))
    255
    >>> read_uint8(io.BytesIO(b'\xff' * 8)) == 2**64-1
    True
    �z<Qrz'not enough data in stream to read uint8N)rrrr)rrrrr�
read_uint8&s	
r'�uint8r&z+Eight-byte unsigned integer, little-endian.TcCs�|j�}|jd�std��|dd�}|rvxJdD]6}|j|�r0|j|�sXtd||f��|dd
�}Pq0Wtd|��|r�tj|�d	jd
�}|S)au
    >>> import io
    >>> read_stringnl(io.BytesIO(b"'abcd'\nefg\n"))
    'abcd'

    >>> read_stringnl(io.BytesIO(b"\n"))
    Traceback (most recent call last):
    ...
    ValueError: no string quotes around b''

    >>> read_stringnl(io.BytesIO(b"\n"), stripquotes=False)
    ''

    >>> read_stringnl(io.BytesIO(b"''\n"))
    ''

    >>> read_stringnl(io.BytesIO(b'"abcd"'))
    Traceback (most recent call last):
    ...
    ValueError: no newline found when trying to read stringnl

    Embedded escapes are undone in the result.
    >>> read_stringnl(io.BytesIO(br"'a\n\\b\x00c\td'" + b"\n'e'"))
    'a\n\\b\x00c\td'
    �
z-no newline found when trying to read stringnlNr�"�'z,strinq quote %r not found at both ends of %rzno string quotes around %rr�ascii���)r*r+r-)�readline�endswithr�
startswith�codecs�
escape_decode�decode)rr3�stripquotesr�qrrr�
read_stringnl;s 



r6�stringnlz�A newline-terminated string.

                   This is a repr-style string, with embedded escapes, and
                   bracketing quotes.
                   cCst|dd�S)NF)r4)r6)rrrr�read_stringnl_noescapetsr8�stringnl_noescapeaA newline-terminated string.

                        This is a str-style string, without embedded escapes,
                        or bracketing quotes.  It should consist solely of
                        printable ASCII characters.
                        cCsdt|�t|�fS)zp
    >>> import io
    >>> read_stringnl_noescape_pair(io.BytesIO(b"Queue\nEmpty\njunk"))
    'Queue Empty'
    z%s %s)r8)rrrr�read_stringnl_noescape_pair�sr:�stringnl_noescape_paira�A pair of newline-terminated strings.

                             These are str-style strings, without embedded
                             escapes, or bracketing quotes.  They should
                             consist solely of printable ASCII characters.
                             The pair is returned as a single string, with
                             a single blank separating the two strings.
                             cCs@t|�}|j|�}t|�|kr(|jd�Std|t|�f��dS)z�
    >>> import io
    >>> read_string1(io.BytesIO(b"\x00"))
    ''
    >>> read_string1(io.BytesIO(b"\x03abcdef"))
    'abc'
    zlatin-1z2expected %d bytes in a string1, but only %d remainN)rrrr3r)rrrrrr�read_string1�s	

r<�string1z�A counted string.

              The first argument is a 1-byte unsigned int giving the number
              of bytes in the string, and the second argument is that many
              bytes.
              cCsTt|�}|dkrtd|��|j|�}t|�|kr<|jd�Std|t|�f��dS)aP
    >>> import io
    >>> read_string4(io.BytesIO(b"\x00\x00\x00\x00abc"))
    ''
    >>> read_string4(io.BytesIO(b"\x03\x00\x00\x00abcdef"))
    'abc'
    >>> read_string4(io.BytesIO(b"\x00\x00\x00\x03abcdef"))
    Traceback (most recent call last):
    ...
    ValueError: expected 50331648 bytes in a string4, but only 6 remain
    rzstring4 byte count < 0: %dzlatin-1z2expected %d bytes in a string4, but only %d remainN)r"rrrr3)rrrrrr�read_string4�s


r>�string4z�A counted string.

              The first argument is a 4-byte little-endian signed int giving
              the number of bytes in the string, and the second argument is
              that many bytes.
              cCs:t|�}|j|�}t|�|kr"|Std|t|�f��dS)z�
    >>> import io
    >>> read_bytes1(io.BytesIO(b"\x00"))
    b''
    >>> read_bytes1(io.BytesIO(b"\x03abcdef"))
    b'abc'
    z1expected %d bytes in a bytes1, but only %d remainN)rrrr)rrrrrr�read_bytes1�s	
r@�bytes1z�A counted bytes string.

              The first argument is a 1-byte unsigned int giving the number
              of bytes in the string, and the second argument is that many
              bytes.
              cCs:t|�}|j|�}t|�|kr"|Std|t|�f��dS)z�
    >>> import io
    >>> read_bytes1(io.BytesIO(b"\x00"))
    b''
    >>> read_bytes1(io.BytesIO(b"\x03abcdef"))
    b'abc'
    z1expected %d bytes in a bytes1, but only %d remainN)rrrr)rrrrrrr@�s	
z�A counted bytes string.

              The first argument is a 1-byte unsigned int giving the number
              of bytes, and the second argument is that many bytes.
              cCsPt|�}|tjkrtd|��|j|�}t|�|kr8|Std|t|�f��dS)aN
    >>> import io
    >>> read_bytes4(io.BytesIO(b"\x00\x00\x00\x00abc"))
    b''
    >>> read_bytes4(io.BytesIO(b"\x03\x00\x00\x00abcdef"))
    b'abc'
    >>> read_bytes4(io.BytesIO(b"\x00\x00\x00\x03abcdef"))
    Traceback (most recent call last):
    ...
    ValueError: expected 50331648 bytes in a bytes4, but only 6 remain
    z#bytes4 byte count > sys.maxsize: %dz1expected %d bytes in a bytes4, but only %d remainN)r$�sys�maxsizerrr)rrrrrr�read_bytes4s


rD�bytes4z�A counted bytes string.

              The first argument is a 4-byte little-endian unsigned int giving
              the number of bytes, and the second argument is that many bytes.
              cCsPt|�}|tjkrtd|��|j|�}t|�|kr8|Std|t|�f��dS)a�
    >>> import io, struct, sys
    >>> read_bytes8(io.BytesIO(b"\x00\x00\x00\x00\x00\x00\x00\x00abc"))
    b''
    >>> read_bytes8(io.BytesIO(b"\x03\x00\x00\x00\x00\x00\x00\x00abcdef"))
    b'abc'
    >>> bigsize8 = struct.pack("<Q", sys.maxsize//3)
    >>> read_bytes8(io.BytesIO(bigsize8 + b"abcdef"))  #doctest: +ELLIPSIS
    Traceback (most recent call last):
    ...
    ValueError: expected ... bytes in a bytes8, but only 6 remain
    z#bytes8 byte count > sys.maxsize: %dz1expected %d bytes in a bytes8, but only %d remainN)r'rBrCrrr)rrrrrr�read_bytes83s

rF�bytes8z�A counted bytes string.

              The first argument is an 8-byte little-endian unsigned int giving
              the number of bytes, and the second argument is that many bytes.
              cCs0|j�}|jd�std��|dd�}t|d�S)zm
    >>> import io
    >>> read_unicodestringnl(io.BytesIO(b"abc\\uabcd\njunk")) == 'abc\uabcd'
    True
    r)z4no newline found when trying to read unicodestringnlNrzraw-unicode-escaper-)r.r/r�str)rrrrr�read_unicodestringnlUs

rI�unicodestringnlz�A newline-terminated Unicode string.

                      This is raw-unicode-escape encoded, so consists of
                      printable ASCII characters, and may contain embedded
                      escape sequences.
                      cCsBt|�}|j|�}t|�|kr*t|dd�Std|t|�f��dS)a�
    >>> import io
    >>> s = 'abcd\uabcd'
    >>> enc = s.encode('utf-8')
    >>> enc
    b'abcd\xea\xaf\x8d'
    >>> n = bytes([len(enc)])  # little-endian 1-byte length
    >>> t = read_unicodestring1(io.BytesIO(n + enc + b'junk'))
    >>> s == t
    True

    >>> read_unicodestring1(io.BytesIO(n + enc[:-1]))
    Traceback (most recent call last):
    ...
    ValueError: expected 7 bytes in a unicodestring1, but only 6 remain
    zutf-8�
surrogatepassz9expected %d bytes in a unicodestring1, but only %d remainN)rrrrHr)rrrrrr�read_unicodestring1os
rL�unicodestring1aAA counted Unicode string.

                    The first argument is a 1-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    cCsXt|�}|tjkrtd|��|j|�}t|�|kr@t|dd�Std|t|�f��dS)a�
    >>> import io
    >>> s = 'abcd\uabcd'
    >>> enc = s.encode('utf-8')
    >>> enc
    b'abcd\xea\xaf\x8d'
    >>> n = bytes([len(enc), 0, 0, 0])  # little-endian 4-byte length
    >>> t = read_unicodestring4(io.BytesIO(n + enc + b'junk'))
    >>> s == t
    True

    >>> read_unicodestring4(io.BytesIO(n + enc[:-1]))
    Traceback (most recent call last):
    ...
    ValueError: expected 7 bytes in a unicodestring4, but only 6 remain
    z+unicodestring4 byte count > sys.maxsize: %dzutf-8rKz9expected %d bytes in a unicodestring4, but only %d remainN)r$rBrCrrrrH)rrrrrr�read_unicodestring4�s

rN�unicodestring4aAA counted Unicode string.

                    The first argument is a 4-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    cCsXt|�}|tjkrtd|��|j|�}t|�|kr@t|dd�Std|t|�f��dS)a�
    >>> import io
    >>> s = 'abcd\uabcd'
    >>> enc = s.encode('utf-8')
    >>> enc
    b'abcd\xea\xaf\x8d'
    >>> n = bytes([len(enc)]) + b'\0' * 7  # little-endian 8-byte length
    >>> t = read_unicodestring8(io.BytesIO(n + enc + b'junk'))
    >>> s == t
    True

    >>> read_unicodestring8(io.BytesIO(n + enc[:-1]))
    Traceback (most recent call last):
    ...
    ValueError: expected 7 bytes in a unicodestring8, but only 6 remain
    z+unicodestring8 byte count > sys.maxsize: %dzutf-8rKz9expected %d bytes in a unicodestring8, but only %d remainN)r'rBrCrrrrH)rrrrrr�read_unicodestring8�s

rP�unicodestring8aBA counted Unicode string.

                    The first argument is an 8-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    cCs.t|ddd�}|dkrdS|dkr&dSt|�S)z�
    >>> import io
    >>> read_decimalnl_short(io.BytesIO(b"1234\n56"))
    1234

    >>> read_decimalnl_short(io.BytesIO(b"1234L\n56"))
    Traceback (most recent call last):
    ...
    ValueError: invalid literal for int() with base 10: b'1234L'
    F)r3r4s00s01T)r6�int)r�srrr�read_decimalnl_short�srTcCs2t|ddd�}|dd�dkr*|dd�}t|�S)z�
    >>> import io

    >>> read_decimalnl_long(io.BytesIO(b"1234L\n56"))
    1234

    >>> read_decimalnl_long(io.BytesIO(b"123456789012345678901234L\n6"))
    123456789012345678901234
    F)r3r4rN�Lr-r-)r6rR)rrSrrr�read_decimalnl_long�srV�decimalnl_shorta�A newline-terminated decimal integer literal.

                          This never has a trailing 'L', and the integer fit
                          in a short Python int on the box where the pickle
                          was written -- but there's no guarantee it will fit
                          in a short Python int on the box where the pickle
                          is read.
                          �decimalnl_longz�A newline-terminated decimal integer literal.

                         This has a trailing 'L', and can represent integers
                         of any size.
                         cCst|ddd�}t|�S)zO
    >>> import io
    >>> read_floatnl(io.BytesIO(b"-1.25\n6"))
    -1.25
    F)r3r4)r6�float)rrSrrr�read_floatnl'srZ�floatnla�A newline-terminated decimal floating literal.

              In general this requires 17 significant digits for roundtrip
              identity, and pickling then unpickling infinities, NaNs, and
              minus zero doesn't work across boxes, or on some boxes even
              on itself (e.g., Windows can't read the strings it produces
              for infinities or NaNs).
              cCs0|jd�}t|�dkr$td|�dStd��dS)z�
    >>> import io, struct
    >>> raw = struct.pack(">d", -1.25)
    >>> raw
    b'\xbf\xf4\x00\x00\x00\x00\x00\x00'
    >>> read_float8(io.BytesIO(raw + b"\n"))
    -1.25
    r&z>drz(not enough data in stream to read float8N)rrrr)rrrrr�read_float8=s

r\�float8aAn 8-byte binary representation of a float, big-endian.

             The format is unique to Python, and shared with the struct
             module (format string '>d') "in theory" (the struct and pickle
             implementations don't share the code -- they should).  It's
             strongly related to the IEEE-754 double format, and, in normal
             cases, is in fact identical to the big-endian 754 double format.
             On other boxes the dynamic range is limited to that of a 754
             double, and "add a half and chop" rounding is used to reduce
             the precision to 53 bits.  However, even on a 754 box,
             infinities, NaNs, and minus zero may not be handled correctly
             (may not survive roundtrip pickling intact).
             )�decode_longcCs.t|�}|j|�}t|�|kr&td��t|�S)a+
    >>> import io
    >>> read_long1(io.BytesIO(b"\x00"))
    0
    >>> read_long1(io.BytesIO(b"\x02\xff\x00"))
    255
    >>> read_long1(io.BytesIO(b"\x02\xff\x7f"))
    32767
    >>> read_long1(io.BytesIO(b"\x02\x00\xff"))
    -256
    >>> read_long1(io.BytesIO(b"\x02\x00\x80"))
    -32768
    z'not enough data in stream to read long1)rrrrr^)rrrrrr�
read_long1cs

r_�long1aA binary long, little-endian, using 1-byte size.

    This first reads one byte as an unsigned size, then reads that
    many bytes and interprets them as a little-endian 2's-complement long.
    If the size is 0, that's taken as a shortcut for the long 0L.
    cCsBt|�}|dkrtd|��|j|�}t|�|kr:td��t|�S)ag
    >>> import io
    >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\xff\x00"))
    255
    >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\xff\x7f"))
    32767
    >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\x00\xff"))
    -256
    >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\x00\x80"))
    -32768
    >>> read_long1(io.BytesIO(b"\x00\x00\x00\x00"))
    0
    rzlong4 byte count < 0: %dz'not enough data in stream to read long4)r"rrrr^)rrrrrr�
read_long4�s
ra�long4a�A binary representation of a long, little-endian.

    This first reads four bytes as a signed size (but requires the
    size to be >= 0), then reads that many bytes and interprets them
    as a little-endian 2's-complement long.  If the size is 0, that's taken
    as a shortcut for the int 0, although LONG1 should really be used
    then instead (and in any case where # of bytes < 256).
    c@s eZdZd	Zdd�Zdd�ZdS)
�StackObjectr�obtypercCs.||_t|t�rx|D]}qW||_||_dS)N)r�
isinstance�tuplerdr)rrrdrZ	containedrrrr�s

zStackObject.__init__cCs|jS)N)r)rrrr�__repr__�szStackObject.__repr__N)rrdr)rrrrrrgrrrrrc�s

rcrRzA Python integer object.)rrdrZint_or_boolz#A Python integer or boolean object.�boolzA Python boolean object.rYzA Python float object.Zbytes_or_strz*A Python bytes or (Unicode) string object.�byteszA Python bytes object.rHz!A Python (Unicode) string object.�NonezThe Python None object.rfzA Python tuple object.�listzA Python list object.�dictzA Python dict object.�setzA Python set object.�	frozensetzA Python frozenset object.�anyzAny kind of object whatsoever.Zmarkaz'The mark' is a unique object.

Opcodes that operate on a variable number of objects
generally don't embed the count of objects in the opcode,
or pull it off the stack.  Instead the MARK opcode is used
to push a special marker object on the stack, and then
some other opcodes grab all the objects from the top of
the stack down to (but not including) the topmost marker
object.
�
stackslicea�An object representing a contiguous slice of the stack.

This is used in conjunction with markobject, to represent all
of the stack following the topmost markobject.  For example,
the POP_MARK opcode changes the stack from

    [..., markobject, stackslice]
to
    [...]

No matter how many object are on the stack after the topmost
markobject, POP_MARK gets rid of all of them (including the
topmost markobject too).
c@seZdZdZdd	�Zd
S)�
OpcodeInfor�code�arg�stack_before�stack_after�protorc	CsJ||_||_||_x|D]}qW||_x|D]}q,W||_||_||_dS)N)rrrrsrtrurvr)	rrrrrsrtrurvr�xrrrrTs

zOpcodeInfo.__init__N)rrrrsrtrurvr)rrrrrrrrrrq5srqZINT�Ia�Push an integer or bool.

      The argument is a newline-terminated decimal literal string.

      The intent may have been that this always fit in a short Python int,
      but INT can be generated in pickles written on a 64-bit box that
      require a Python long on a 32-bit box.  The difference between this
      and LONG then is that INT skips a trailing 'L', and produces a short
      int whenever possible.

      Another difference is due to that, when bool was introduced as a
      distinct type in 2.3, builtin names True and False were also added to
      2.2.2, mapping to ints 1 and 0.  For compatibility in both directions,
      True gets pickled as INT + "I01\n", and False as INT + "I00\n".
      Leading zeroes are never produced for a genuine integer.  The 2.3
      (and later) unpicklers special-case these and return bool instead;
      earlier unpicklers ignore the leading "0" and return the int.
      )rrrrsrtrurvrZBININT�Ja1Push a four-byte signed integer.

      This handles the full range of Python (short) integers on a 32-bit
      box, directly as binary bytes (1 for the opcode and 4 for the integer).
      If the integer is non-negative and fits in 1 or 2 bytes, pickling via
      BININT1 or BININT2 saves space.
      ZBININT1�Kz�Push a one-byte unsigned integer.

      This is a space optimization for pickling very small non-negative ints,
      in range(256).
      ZBININT2�Mz�Push a two-byte unsigned integer.

      This is a space optimization for pickling small positive ints, in
      range(256, 2**16).  Integers in range(256) can also be pickled via
      BININT2, but BININT1 instead saves a byte.
      ZLONG�La�Push a long integer.

      The same as INT, except that the literal ends with 'L', and always
      unpickles to a Python long.  There doesn't seem a real purpose to the
      trailing 'L'.

      Note that LONG takes time quadratic in the number of digits when
      unpickling (this is simply due to the nature of decimal->binary
      conversion).  Proto 2 added linear-time (in C; still quadratic-time
      in Python) LONG1 and LONG4 opcodes.
      ZLONG1�Šz|Long integer using one-byte length.

      A more efficient encoding of a Python long; the long1 encoding
      says it all.ZLONG4�‹z~Long integer using found-byte length.

      A more efficient encoding of a Python long; the long4 encoding
      says it all.�STRING�Sa�Push a Python string object.

      The argument is a repr-style string, with bracketing quote characters,
      and perhaps embedded escapes.  The argument extends until the next
      newline character.  These are usually decoded into a str instance
      using the encoding given to the Unpickler constructor. or the default,
      'ASCII'.  If the encoding given was 'bytes' however, they will be
      decoded as bytes object instead.
      Z	BINSTRING�Ta�Push a Python string object.

      There are two arguments: the first is a 4-byte little-endian
      signed int giving the number of bytes in the string, and the
      second is that many bytes, which are taken literally as the string
      content.  These are usually decoded into a str instance using the
      encoding given to the Unpickler constructor. or the default,
      'ASCII'.  If the encoding given was 'bytes' however, they will be
      decoded as bytes object instead.
      ZSHORT_BINSTRING�Ua�Push a Python string object.

      There are two arguments: the first is a 1-byte unsigned int giving
      the number of bytes in the string, and the second is that many
      bytes, which are taken literally as the string content.  These are
      usually decoded into a str instance using the encoding given to
      the Unpickler constructor. or the default, 'ASCII'.  If the
      encoding given was 'bytes' however, they will be decoded as bytes
      object instead.
      ZBINBYTES�Bz�Push a Python bytes object.

      There are two arguments:  the first is a 4-byte little-endian unsigned int
      giving the number of bytes, and the second is that many bytes, which are
      taken literally as the bytes content.
      ZSHORT_BINBYTES�Cz�Push a Python bytes object.

      There are two arguments:  the first is a 1-byte unsigned int giving
      the number of bytes, and the second is that many bytes, which are taken
      literally as the string content.
      Z	BINBYTES8�Žz�Push a Python bytes object.

      There are two arguments:  the first is an 8-byte unsigned int giving
      the number of bytes in the string, and the second is that many bytes,
      which are taken literally as the string content.
      ZNONE�NzPush None on the stack.ZNEWTRUE�ˆzPush True onto the stack.ZNEWFALSE�‰zPush False onto the stack.�UNICODE�Vz�Push a Python Unicode string object.

      The argument is a raw-unicode-escape encoding of a Unicode string,
      and so may contain embedded escape sequences.  The argument extends
      until the next newline character.
      ZSHORT_BINUNICODE�ŒaPush a Python Unicode string object.

      There are two arguments:  the first is a 1-byte little-endian signed int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      Z
BINUNICODE�XaPush a Python Unicode string object.

      There are two arguments:  the first is a 4-byte little-endian unsigned int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      ZBINUNICODE8�aPush a Python Unicode string object.

      There are two arguments:  the first is an 8-byte little-endian signed int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      ZFLOAT�Fa�Newline-terminated decimal float literal.

      The argument is repr(a_float), and in general requires 17 significant
      digits for roundtrip conversion to be an identity (this is so for
      IEEE-754 double precision values, which is what Python float maps to
      on most boxes).

      In general, FLOAT cannot be used to transport infinities, NaNs, or
      minus zero across boxes (or even on a single box, if the platform C
      library can't read the strings it produces for such things -- Windows
      is like that), but may do less damage than BINFLOAT on boxes with
      greater precision or dynamic range than IEEE-754 double.
      ZBINFLOAT�Ga�Float stored in binary form, with 8 bytes of data.

      This generally requires less than half the space of FLOAT encoding.
      In general, BINFLOAT cannot be used to transport infinities, NaNs, or
      minus zero, raises an exception if the exponent exceeds the range of
      an IEEE-754 double, and retains no more than 53 bits of precision (if
      there are more than that, "add a half and chop" rounding is used to
      cut it back to 53 significant bits).
      Z
EMPTY_LIST�]zPush an empty list.ZAPPEND�az�Append an object to a list.

      Stack before:  ... pylist anyobject
      Stack after:   ... pylist+[anyobject]

      although pylist is really extended in-place.
      ZAPPENDS�ez�Extend a list by a slice of stack objects.

      Stack before:  ... pylist markobject stackslice
      Stack after:   ... pylist+stackslice

      although pylist is really extended in-place.
      ZLIST�lasBuild a list out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python list, which single list object replaces all of the
      stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... [1, 2, 3, 'abc']
      ZEMPTY_TUPLE�)zPush an empty tuple.ZTUPLE�tavBuild a tuple out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python tuple, which single tuple object replaces all of the
      stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... (1, 2, 3, 'abc')
      ZTUPLE1�…z�Build a one-tuple out of the topmost item on the stack.

      This code pops one value off the stack and pushes a tuple of
      length 1 whose one item is that value back onto it.  In other
      words:

          stack[-1] = tuple(stack[-1:])
      ZTUPLE2�†aBuild a two-tuple out of the top two items on the stack.

      This code pops two values off the stack and pushes a tuple of
      length 2 whose items are those values back onto it.  In other
      words:

          stack[-2:] = [tuple(stack[-2:])]
      ZTUPLE3�‡aBuild a three-tuple out of the top three items on the stack.

      This code pops three values off the stack and pushes a tuple of
      length 3 whose items are those values back onto it.  In other
      words:

          stack[-3:] = [tuple(stack[-3:])]
      Z
EMPTY_DICT�}zPush an empty dict.ZDICT�da�Build a dict out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python dict, which single dict object replaces all of the
      stack from the topmost markobject onward.  The stack slice alternates
      key, value, key, value, ....  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... {1: 2, 3: 'abc'}
      ZSETITEMrSz�Add a key+value pair to an existing dict.

      Stack before:  ... pydict key value
      Stack after:   ... pydict

      where pydict has been modified via pydict[key] = value.
      ZSETITEMS�ua\Add an arbitrary number of key+value pairs to an existing dict.

      The slice of the stack following the topmost markobject is taken as
      an alternating sequence of keys and values, added to the dict
      immediately under the topmost markobject.  Everything at and after the
      topmost markobject is popped, leaving the mutated dict at the top
      of the stack.

      Stack before:  ... pydict markobject key_1 value_1 ... key_n value_n
      Stack after:   ... pydict

      where pydict has been modified via pydict[key_i] = value_i for i in
      1, 2, ..., n, and in that order.
      Z	EMPTY_SET�zPush an empty set.ZADDITEMS�a$Add an arbitrary number of items to an existing set.

      The slice of the stack following the topmost markobject is taken as
      a sequence of items, added to the set immediately under the topmost
      markobject.  Everything at and after the topmost markobject is popped,
      leaving the mutated set at the top of the stack.

      Stack before:  ... pyset markobject item_1 ... item_n
      Stack after:   ... pyset

      where pyset has been modified via pyset.add(item_i) = item_i for i in
      1, 2, ..., n, and in that order.
      Z	FROZENSET�‘azBuild a frozenset out of the topmost slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python frozenset, which single frozenset object replaces all
      of the stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3
      Stack after:  ... frozenset({1, 2, 3})
      �POP�0z<Discard the top stack item, shrinking the stack by one item.ZDUP�2z=Push the top stack item onto the stack again, duplicating it.�MARK�(z�Push markobject onto the stack.

      markobject is a unique object, used by other opcodes to identify a
      region of the stack containing a variable number of objects for them
      to work on.  See markobject.doc for more detail.
      ZPOP_MARK�1aPop all the stack objects at and above the topmost markobject.

      When an opcode using a variable number of stack objects is done,
      POP_MARK is used to remove those objects, and to remove the markobject
      that delimited their starting position on the stack.
      �GET�gz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the newline-terminated
      decimal string following.  BINGET and LONG_BINGET are space-optimized
      versions.
      �BINGET�hz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the 1-byte unsigned
      integer following.
      �LONG_BINGET�jz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the 4-byte unsigned
      little-endian integer following.
      �PUT�pz�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the newline-
      terminated decimal string following.  BINPUT and LONG_BINPUT are
      space-optimized versions.
      �BINPUTr5z�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the 1-byte
      unsigned integer following.
      �LONG_BINPUT�rz�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the 4-byte
      unsigned little-endian integer following.
      �MEMOIZE�”z�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write is the number of
      elements currently present in the memo.
      ZEXT1�‚a�Extension code.

      This code and the similar EXT2 and EXT4 allow using a registry
      of popular objects that are pickled by name, typically classes.
      It is envisioned that through a global negotiation and
      registration process, third parties can set up a mapping between
      ints and object names.

      In order to guarantee pickle interchangeability, the extension
      code registry ought to be global, although a range of codes may
      be reserved for private use.

      EXT1 has a 1-byte integer argument.  This is used to index into the
      extension registry, and the object at that index is pushed on the stack.
      ZEXT2�ƒzNExtension code.

      See EXT1.  EXT2 has a two-byte integer argument.
      ZEXT4�„zOExtension code.

      See EXT1.  EXT4 has a four-byte integer argument.
      ZGLOBAL�ca�Push a global object (module.attr) on the stack.

      Two newline-terminated strings follow the GLOBAL opcode.  The first is
      taken as a module name, and the second as a class name.  The class
      object module.class is pushed on the stack.  More accurately, the
      object returned by self.find_class(module, class) is pushed on the
      stack, so unpickling subclasses can override this form of lookup.
      ZSTACK_GLOBAL�“z7Push a global object (module.attr) on the stack.
      ZREDUCE�RaLPush an object built from a callable and an argument tuple.

      The opcode is named to remind of the __reduce__() method.

      Stack before: ... callable pytuple
      Stack after:  ... callable(*pytuple)

      The callable and the argument tuple are the first two items returned
      by a __reduce__ method.  Applying the callable to the argtuple is
      supposed to reproduce the original object, or at least get it started.
      If the __reduce__ method returns a 3-tuple, the last component is an
      argument to be passed to the object's __setstate__, and then the REDUCE
      opcode is followed by code to create setstate's argument, and then a
      BUILD opcode to apply  __setstate__ to that argument.

      If not isinstance(callable, type), REDUCE complains unless the
      callable has been registered with the copyreg module's
      safe_constructors dict, or the callable has a magic
      '__safe_for_unpickling__' attribute with a true value.  I'm not sure
      why it does this, but I've sure seen this complaint often enough when
      I didn't want to <wink>.
      ZBUILD�ba�Finish building an object, via __setstate__ or dict update.

      Stack before: ... anyobject argument
      Stack after:  ... anyobject

      where anyobject may have been mutated, as follows:

      If the object has a __setstate__ method,

          anyobject.__setstate__(argument)

      is called.

      Else the argument must be a dict, the object must have a __dict__, and
      the object is updated via

          anyobject.__dict__.update(argument)
      ZINST�iaqBuild a class instance.

      This is the protocol 0 version of protocol 1's OBJ opcode.
      INST is followed by two newline-terminated strings, giving a
      module and class name, just as for the GLOBAL opcode (and see
      GLOBAL for more details about that).  self.find_class(module, name)
      is used to get a class object.

      In addition, all the objects on the stack following the topmost
      markobject are gathered into a tuple and popped (along with the
      topmost markobject), just as for the TUPLE opcode.

      Now it gets complicated.  If all of these are true:

        + The argtuple is empty (markobject was at the top of the stack
          at the start).

        + The class object does not have a __getinitargs__ attribute.

      then we want to create an old-style class instance without invoking
      its __init__() method (pickle has waffled on this over the years; not
      calling __init__() is current wisdom).  In this case, an instance of
      an old-style dummy class is created, and then we try to rebind its
      __class__ attribute to the desired class object.  If this succeeds,
      the new instance object is pushed on the stack, and we're done.

      Else (the argtuple is not empty, it's not an old-style class object,
      or the class object does have a __getinitargs__ attribute), the code
      first insists that the class object have a __safe_for_unpickling__
      attribute.  Unlike as for the __safe_for_unpickling__ check in REDUCE,
      it doesn't matter whether this attribute has a true or false value, it
      only matters whether it exists (XXX this is a bug).  If
      __safe_for_unpickling__ doesn't exist, UnpicklingError is raised.

      Else (the class object does have a __safe_for_unpickling__ attr),
      the class object obtained from INST's arguments is applied to the
      argtuple obtained from the stack, and the resulting instance object
      is pushed on the stack.

      NOTE:  checks for __safe_for_unpickling__ went away in Python 2.3.
      NOTE:  the distinction between old-style and new-style classes does
             not make sense in Python 3.
      ZOBJ�oa�Build a class instance.

      This is the protocol 1 version of protocol 0's INST opcode, and is
      very much like it.  The major difference is that the class object
      is taken off the stack, allowing it to be retrieved from the memo
      repeatedly if several instances of the same class are created.  This
      can be much more efficient (in both time and space) than repeatedly
      embedding the module and class names in INST opcodes.

      Unlike INST, OBJ takes no arguments from the opcode stream.  Instead
      the class object is taken off the stack, immediately above the
      topmost markobject:

      Stack before: ... markobject classobject stackslice
      Stack after:  ... new_instance_object

      As for INST, the remainder of the stack above the markobject is
      gathered into an argument tuple, and then the logic seems identical,
      except that no __safe_for_unpickling__ check is done (XXX this is
      a bug).  See INST for the gory details.

      NOTE:  In Python 2.3, INST and OBJ are identical except for how they
      get the class object.  That was always the intent; the implementations
      had diverged for accidental reasons.
      ZNEWOBJ�aLBuild an object instance.

      The stack before should be thought of as containing a class
      object followed by an argument tuple (the tuple being the stack
      top).  Call these cls and args.  They are popped off the stack,
      and the value returned by cls.__new__(cls, *args) is pushed back
      onto the stack.
      Z	NEWOBJ_EX�’auBuild an object instance.

      The stack before should be thought of as containing a class
      object followed by an argument tuple and by a keyword argument dict
      (the dict being the stack top).  Call these cls and args.  They are
      popped off the stack, and the value returned by
      cls.__new__(cls, *args, *kwargs) is  pushed back  onto the stack.
      �PROTO�€z�Protocol version indicator.

      For protocol 2 and above, a pickle must start with this opcode.
      The argument is the protocol version, an int in range(2, 256).
      ZSTOP�.z�Stop the unpickling machine.

      Every pickle ends with this opcode.  The object at the top of the stack
      is popped, and that's the result of unpickling.  The stack should be
      empty then.
      �FRAME�•z�Indicate the beginning of a new frame.

      The unpickler may use this opcode to safely prefetch data from its
      underlying stream.
      ZPERSID�PaPush an object identified by a persistent ID.

      The pickle module doesn't define what a persistent ID means.  PERSID's
      argument is a newline-terminated str-style (no embedded escapes, no
      bracketing quote characters) string, which *is* "the persistent ID".
      The unpickler passes this string to self.persistent_load().  Whatever
      object that returns is pushed on the stack.  There is no implementation
      of persistent_load() in Python's unpickler:  it must be supplied by an
      unpickler subclass.
      Z	BINPERSID�QaXPush an object identified by a persistent ID.

      Like PERSID, except the persistent ID is popped off the stack (instead
      of being a string embedded in the opcode bytestream).  The persistent
      ID is passed to self.persistent_load(), and whatever object that
      returns is pushed on the stack.  See PERSID for more detail.
      z%repeated name %r at indices %d and %dz%repeated code %r at indices %d and %dFcCstj�}x�tjD]�}tjd|�s2|rtd|�qtt|�}t|t	�sTt
|�dkrj|rtd||f�q|jd�}||kr�|r�td||f�||}|j|kr�t
d|||jf��||=qt
d||f��qW|�rd	g}x(|j�D]\}}|jd
|j|f�q�Wt
dj|���dS)Nz[A-Z][A-Z0-9_]+$z0skipping %r: it doesn't look like an opcode namerz5skipping %r: value %r doesn't look like a pickle codezlatin-1z+checking name %r w/ code %r for consistencyzBfor pickle code %r, pickle.py uses name %r but we're using name %rzPpickle.py appears to have a pickle opcode with name %r and code %r, but we don'tz=we appear to have pickle opcodes that pickle.py doesn't have:z    name %r with code %r�
)�code2op�copy�pickle�__all__�re�match�print�getattrrerirr3rr�items�append�join)�verboser�rZ
picklecoder��msgrrrrr�assure_pickle_consistencys>


r�ccs�t|t�rtj|�}t|d�r&|j}ndd�}x�|�}|jd�}tj|j	d��}|dkr�|dkrjt
d��nt
d|dkrzd	n||f��|jdkr�d}n|jj|�}|r�||||�fVn|||fV|d
kr0Pq0WdS)N�tellcSsdS)Nrrrrr�<lambda>�sz_genops.<locals>.<lambda>rzlatin-1�z#pickle exhausted before seeing STOPz!at position %s, opcode %r unknownz	<unknown>�.)
re�bytes_types�io�BytesIO�hasattrr�rr��getr3rrsr
)r�
yield_end_posZgetpos�posrr�opcodersrrr�_genops�s.






r�cCst|�S)axGenerate all the opcodes in a pickle.

    'pickle' is a file-like object, or string, containing the pickle.

    Each opcode in the pickle is generated, from the current pickle position,
    stopping after a STOP opcode is delivered.  A triple is generated for
    each opcode:

        opcode, arg, pos

    opcode is an OpcodeInfo record, describing the current opcode.

    If the opcode has an argument embedded in the pickle, arg is its decoded
    value, as a Python object.  If the opcode doesn't have an argument, arg
    is None.

    If the pickle has a tell() method, pos was the value of pickle.tell()
    before reading the current opcode.  If the pickle is a bytes object,
    it's wrapped in a BytesIO object, and the latter's tell() result is
    used.  Else (the pickle doesn't have a tell(), and it's not obvious how
    to query its current position) pos is None.
    )r�)r�rrrr�scCs�d}d}t�}i}g}d}d}x�t|dd�D]�\}}	}
}d|jkr\|j|	�|j||	f�q,|jdkr�t|�}|j|�|j||f�q,d|jkr�q,d|jkr�|j|kr�|j}d	||	<|j||	f�q,|jd
k�r|	|kr�|	}|
dkr�||
|�}n|j|
|f�q,|j|
|f�q,W~tj�}
|
j	|�t
j|
|�}|dk�rJ|jj
�d}x�|D]x\}}	||k�r�|	|k�rt�qT|j|�}|||	<|d7}n&||k�r�|j||	�}n|||	�}|jj�|j	|��qTW|jj�|
j�S)
z7Optimize a pickle string by removing unused PUT opcodesr�r�rr�T)r�r�r�Nr�rr)rmr�r�addr�rrvr�r��writer�Z_PicklerZframerZ
start_framing�putr�Zcommit_frameZend_framing�getvalue)r�r�r�ZoldidsZnewids�opcodesrvZprotoheaderr�rsr�Zend_pos�idx�outZpickler�oprrrrr�sd
















cCsg}|dkri}d}g}d|}d}	|}
�x�t|�D�]�\}}}
|
dk	rZtd|
d|d�dt|j�dd �|t|�|jf}t||j�}|j}|j	}t|�}d}t
|ks�|jdko�|o�|d!t
k�rD|�r<|j�}|dkr�d}nd	|}x|d"t
k	�r|j�q�W|j�y|jt
�}Wnt
k
�r8d
}YnXnd}	}|jd#k�r�|jdk�rnt|�}d|}n|}||k�r�d|}	n,|�s�d}	n |d$t
k�r�d}	n|d%||<n*|jd&k�r�||k�r�||g}nd|}	|dk	�s�|�r0|ddt|j�7}|dk	�r|dt|�7}|�r0|d|7}|�rz|d|
t|�7}t|�}
|
dk�r`|}
|d|jjdd�d
7}t||d�|	�r�t
|	��t|�|k�r�t
d|t|�f��|�r�||d�=t
|k�r�|j|
�|j|�q4Wtd||d�|�r
t
d|��dS)'aKProduce a symbolic disassembly of a pickle.

    'pickle' is a file-like object, or string, containing a (at least one)
    pickle.  The pickle is disassembled from the current position, through
    the first STOP opcode encountered.

    Optional arg 'out' is a file-like object to which the disassembly is
    printed.  It defaults to sys.stdout.

    Optional arg 'memo' is a Python dict, used as the pickle's memo.  It
    may be mutated by dis(), if the pickle contains PUT or BINPUT opcodes.
    Passing the same memo object to another dis() call then allows disassembly
    to proceed across multiple pickles that were all created by the same
    pickler with the same memo.  Ordinarily you don't need to worry about this.

    Optional arg 'indentlevel' is the number of blanks by which to indent
    a new MARK level.  It defaults to 4.

    Optional arg 'annotate' if nonzero instructs dis() to add short
    description of the opcode on each line of disassembled output.
    The value given to 'annotate' must be an integer and is used as a
    hint for the column where annotation should start.  The default
    value is 0, meaning no annotations.

    In addition to printing the disassembly, some sanity checks are made:

    + All embedded opcode arguments "make sense".

    + Explicit and implicit pop operations have enough items on the stack.

    + When an opcode implicitly refers to a markobject, a markobject is
      actually on the stack.

    + A memo entry isn't referenced before it's defined.

    + The markobject isn't stored in the memo.

    + A memo entry isn't redefined.
    Nr� z%5d:)�end�filez	%-4s %s%sr�z(MARK at unknown opcode offset)z(MARK at %d)rzno MARK exists on stackr�r�r�r�z(as %d)zmemo key %r already definedz'stack is empty -- can't store into memoz"can't store markobject in the memor�r�r�z&memo key %r has never been stored into�
�2r�)r�z3tries to pop %d items from stack with only %d itemsz highest protocol among opcodes =zstack not empty after STOP: %rr-r-r-r-)r�r�r�r�r-r-)r�r�r�)rr��reprrrrr�maxrvrtru�
markobject�pop�indexrr�splitr��extend)r�r��memo�indentlevel�annotate�stackZmaxprotoZ	markstackZindentchunkZerrormsgZannocolr�rsr��lineZbefore�afterZnumtopopZmarkmsgZmarkposZmemo_idxrrrr%	s�-









c@seZdZdd�ZdS)�_ExamplecCs
||_dS)N)�value)rr�rrrr�	sz_Example.__init__N)rrrrrrrrr��	sr�a�
>>> import pickle
>>> x = [1, 2, (3, 4), {b'abc': "def"}]
>>> pkl0 = pickle.dumps(x, 0)
>>> dis(pkl0)
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: L    LONG       1
    9: a    APPEND
   10: L    LONG       2
   14: a    APPEND
   15: (    MARK
   16: L        LONG       3
   20: L        LONG       4
   24: t        TUPLE      (MARK at 15)
   25: p    PUT        1
   28: a    APPEND
   29: (    MARK
   30: d        DICT       (MARK at 29)
   31: p    PUT        2
   34: c    GLOBAL     '_codecs encode'
   50: p    PUT        3
   53: (    MARK
   54: V        UNICODE    'abc'
   59: p        PUT        4
   62: V        UNICODE    'latin1'
   70: p        PUT        5
   73: t        TUPLE      (MARK at 53)
   74: p    PUT        6
   77: R    REDUCE
   78: p    PUT        7
   81: V    UNICODE    'def'
   86: p    PUT        8
   89: s    SETITEM
   90: a    APPEND
   91: .    STOP
highest protocol among opcodes = 0

Try again with a "binary" pickle.

>>> pkl1 = pickle.dumps(x, 1)
>>> dis(pkl1)
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: K        BININT1    1
    6: K        BININT1    2
    8: (        MARK
    9: K            BININT1    3
   11: K            BININT1    4
   13: t            TUPLE      (MARK at 8)
   14: q        BINPUT     1
   16: }        EMPTY_DICT
   17: q        BINPUT     2
   19: c        GLOBAL     '_codecs encode'
   35: q        BINPUT     3
   37: (        MARK
   38: X            BINUNICODE 'abc'
   46: q            BINPUT     4
   48: X            BINUNICODE 'latin1'
   59: q            BINPUT     5
   61: t            TUPLE      (MARK at 37)
   62: q        BINPUT     6
   64: R        REDUCE
   65: q        BINPUT     7
   67: X        BINUNICODE 'def'
   75: q        BINPUT     8
   77: s        SETITEM
   78: e        APPENDS    (MARK at 3)
   79: .    STOP
highest protocol among opcodes = 1

Exercise the INST/OBJ/BUILD family.

>>> import pickletools
>>> dis(pickle.dumps(pickletools.dis, 0))
    0: c    GLOBAL     'pickletools dis'
   17: p    PUT        0
   20: .    STOP
highest protocol among opcodes = 0

>>> from pickletools import _Example
>>> x = [_Example(42)] * 2
>>> dis(pickle.dumps(x, 0))
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: c    GLOBAL     'copy_reg _reconstructor'
   30: p    PUT        1
   33: (    MARK
   34: c        GLOBAL     'pickletools _Example'
   56: p        PUT        2
   59: c        GLOBAL     '__builtin__ object'
   79: p        PUT        3
   82: N        NONE
   83: t        TUPLE      (MARK at 33)
   84: p    PUT        4
   87: R    REDUCE
   88: p    PUT        5
   91: (    MARK
   92: d        DICT       (MARK at 91)
   93: p    PUT        6
   96: V    UNICODE    'value'
  103: p    PUT        7
  106: L    LONG       42
  111: s    SETITEM
  112: b    BUILD
  113: a    APPEND
  114: g    GET        5
  117: a    APPEND
  118: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(x, 1))
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: c        GLOBAL     'copy_reg _reconstructor'
   29: q        BINPUT     1
   31: (        MARK
   32: c            GLOBAL     'pickletools _Example'
   54: q            BINPUT     2
   56: c            GLOBAL     '__builtin__ object'
   76: q            BINPUT     3
   78: N            NONE
   79: t            TUPLE      (MARK at 31)
   80: q        BINPUT     4
   82: R        REDUCE
   83: q        BINPUT     5
   85: }        EMPTY_DICT
   86: q        BINPUT     6
   88: X        BINUNICODE 'value'
   98: q        BINPUT     7
  100: K        BININT1    42
  102: s        SETITEM
  103: b        BUILD
  104: h        BINGET     5
  106: e        APPENDS    (MARK at 3)
  107: .    STOP
highest protocol among opcodes = 1

Try "the canonical" recursive-object test.

>>> L = []
>>> T = L,
>>> L.append(T)
>>> L[0] is T
True
>>> T[0] is L
True
>>> L[0][0] is L
True
>>> T[0][0] is T
True
>>> dis(pickle.dumps(L, 0))
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: (    MARK
    6: g        GET        0
    9: t        TUPLE      (MARK at 5)
   10: p    PUT        1
   13: a    APPEND
   14: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(L, 1))
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: h        BINGET     0
    6: t        TUPLE      (MARK at 3)
    7: q    BINPUT     1
    9: a    APPEND
   10: .    STOP
highest protocol among opcodes = 1

Note that, in the protocol 0 pickle of the recursive tuple, the disassembler
has to emulate the stack in order to realize that the POP opcode at 16 gets
rid of the MARK at 0.

>>> dis(pickle.dumps(T, 0))
    0: (    MARK
    1: (        MARK
    2: l            LIST       (MARK at 1)
    3: p        PUT        0
    6: (        MARK
    7: g            GET        0
   10: t            TUPLE      (MARK at 6)
   11: p        PUT        1
   14: a        APPEND
   15: 0        POP
   16: 0        POP        (MARK at 0)
   17: g    GET        1
   20: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(T, 1))
    0: (    MARK
    1: ]        EMPTY_LIST
    2: q        BINPUT     0
    4: (        MARK
    5: h            BINGET     0
    7: t            TUPLE      (MARK at 4)
    8: q        BINPUT     1
   10: a        APPEND
   11: 1        POP_MARK   (MARK at 0)
   12: h    BINGET     1
   14: .    STOP
highest protocol among opcodes = 1

Try protocol 2.

>>> dis(pickle.dumps(L, 2))
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: h    BINGET     0
    7: \x85 TUPLE1
    8: q    BINPUT     1
   10: a    APPEND
   11: .    STOP
highest protocol among opcodes = 2

>>> dis(pickle.dumps(T, 2))
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: h    BINGET     0
    7: \x85 TUPLE1
    8: q    BINPUT     1
   10: a    APPEND
   11: 0    POP
   12: h    BINGET     1
   14: .    STOP
highest protocol among opcodes = 2

Try protocol 3 with annotations:

>>> dis(pickle.dumps(T, 3), annotate=1)
    0: \x80 PROTO      3 Protocol version indicator.
    2: ]    EMPTY_LIST   Push an empty list.
    3: q    BINPUT     0 Store the stack top into the memo.  The stack is not popped.
    5: h    BINGET     0 Read an object from the memo and push it on the stack.
    7: \x85 TUPLE1       Build a one-tuple out of the topmost item on the stack.
    8: q    BINPUT     1 Store the stack top into the memo.  The stack is not popped.
   10: a    APPEND       Append an object to a list.
   11: 0    POP          Discard the top stack item, shrinking the stack by one item.
   12: h    BINGET     1 Read an object from the memo and push it on the stack.
   14: .    STOP         Stop the unpickling machine.
highest protocol among opcodes = 2

a=
>>> import pickle
>>> import io
>>> f = io.BytesIO()
>>> p = pickle.Pickler(f, 2)
>>> x = [1, 2, 3]
>>> p.dump(x)
>>> p.dump(x)
>>> f.seek(0)
0
>>> memo = {}
>>> dis(f, memo=memo)
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: (    MARK
    6: K        BININT1    1
    8: K        BININT1    2
   10: K        BININT1    3
   12: e        APPENDS    (MARK at 5)
   13: .    STOP
highest protocol among opcodes = 2
>>> dis(f, memo=memo)
   14: \x80 PROTO      2
   16: h    BINGET     0
   18: .    STOP
highest protocol among opcodes = 2
)Zdisassembler_testZdisassembler_memo_testcCsddl}|j�S)Nr)�doctestZtestmod)r�rrr�_test�
sr��__main__z$disassemble one or more pickle files)Zdescription�pickle_file�br�*zthe pickle file)�type�nargs�helpz-oz--output�wz+the file where the output should be written)�defaultrrz-mz--memo�
store_truez#preserve memo between disassemblies)�actionrz-lz
--indentlevelz8the number of blanks by which to indent a new MARK levelz-az
--annotatez2annotate each line with a short opcode descriptionz-pz
--preamblez==> {name} <==zMif more than one pickle file is specified, print this before each disassembly)rrz-tz--testzrun self-test suitez-vz)run verbosely; only affects self-test run�)rr�r-������������)TT)F)F)NNrr)��__doc__r1r�r�r�rBr�r�Z
UP_TO_NEWLINEZTAKEN_FROM_ARGUMENT1ZTAKEN_FROM_ARGUMENT4ZTAKEN_FROM_ARGUMENT4UZTAKEN_FROM_ARGUMENT8U�objectr
Zstructrrrrr r!r"r#r$r%r'r(r6r7r8r9r:r;r<r=r>r?r@rArDrErFrGrIrJrLrMrNrOrPrQrTrVrWrXrZr[r\r]r^r_r`rarbrcrRZpyintZpylongrhZpyinteger_or_boolZpyboolrYZpyfloatrirHZpybytes_or_strZpystringZpybytesZ	pyunicoderZpynonerfZpytuplerkZpylistrlZpydictrmZpysetZpyfrozensetZ	anyobjectr�rprqrxr�Zname2iZcode2i�	enumerater�r�rrrrr�r�r�rrrr�Z	_dis_testZ
_memo_testZ__test__r�r�argparse�ArgumentParser�parser�add_argumentZFileType�stdout�
parse_args�argsZtestr�r�Z
print_helpr�outputr�r�rZpreamble�formatr�rrrr�<module>s�
$/		
	
;	


			

	+


& 

>

keyword.cpython-36.pyc000064400000003347150335715140010671 0ustar003


 \��!@svdZddgZddddddd	d
ddd
ddddddddddddddddddd d!d"d#g!Zee�jZd$d%�Zed&krre�d'S)(z�Keywords (from "graminit.c")

This file is automatically generated; please don't muck it up!

To update the symbols in this file, 'cd' to the top directory of
the python source tree after building the interpreter and run:

    ./python Lib/keyword.py
�	iskeyword�kwlist�False�None�True�and�as�assert�break�class�continue�def�del�elif�else�except�finally�for�from�global�if�import�in�is�lambda�nonlocal�not�or�pass�raise�return�try�while�with�yieldcCs|ddl}ddl}|jdd�}|r*|dp,d}t|�dkrD|d}nd}t|dd��}|j�}WdQRX|r�|dt|dj��d�nd}t|��T}|jd�}g}	x>|D]6}
d	|
kr�|j|
�}|r�|	j	d
|j
d�d|�q�WWdQRX|	j�y0|jd|�d}|jd
|�}
|	|||
�<Wn,t
k
�rR|jjd�|jd�YnXt|ddd��}|j|�WdQRXdS)N��zPython/graminit.czLib/keyword.py�)�newline�
z	"([^"]+)"z{1, "z	        'z',z#--start keywords--z#--end keywords--z'target does not contain format markers
�w)�sys�re�argv�len�open�	readlines�strip�compile�search�append�group�sort�index�
ValueError�stderr�write�exit�
writelines)r*r+�args�iptfile�optfile�fp�format�nl�strprog�lines�line�match�start�end�rH�/usr/lib64/python3.6/keyword.py�main7s6
$



*rJ�__main__N)�__doc__�__all__r�	frozenset�__contains__rrJ�__name__rHrHrHrI�<module>sL
&secrets.cpython-36.opt-1.pyc000064400000004164150335715140011612 0ustar003


 \��@s�dZddddddddgZd	d
lZd	d
lZd	d
lZd	dlmZd	dlmZe�Z	e	j
Ze	jZd
d�Z
dZddd�Zddd�Zddd�Zd
S)z�Generate cryptographically strong pseudo-random numbers suitable for
managing secrets such as account authentication, tokens, and similar.

See PEP 506 for more information.
https://www.python.org/dev/peps/pep-0506/

�choice�	randbelow�randbits�SystemRandom�token_bytes�	token_hex�
token_urlsafe�compare_digest�N)r)rcCs|dkrtd��tj|�S)z(Return a random int in the range [0, n).r	zUpper bound must be positive.)�
ValueError�_sysrandZ
_randbelow)Zexclusive_upper_bound�r�/usr/lib64/python3.6/secrets.pyrs� cCs|dkrt}tj|�S)z�Return a random byte string containing *nbytes* bytes.

    If *nbytes* is ``None`` or not supplied, a reasonable
    default is used.

    >>> token_bytes(16)  #doctest:+SKIP
    b'\xebr\x17D*t\xae\xd4\xe3S\xb6\xe2\xebP1\x8b'

    N)�DEFAULT_ENTROPY�os�urandom)�nbytesrrr
r#s
cCstjt|��jd�S)a"Return a random text string, in hexadecimal.

    The string has *nbytes* random bytes, each byte converted to two
    hex digits.  If *nbytes* is ``None`` or not supplied, a reasonable
    default is used.

    >>> token_hex(16)  #doctest:+SKIP
    'f9bf78b9a18ce6d46a0cd2b0b86df9da'

    �ascii)�binasciiZhexlifyr�decode)rrrr
r1scCst|�}tj|�jd�jd�S)z�Return a random URL-safe text string, in Base64 encoding.

    The string has *nbytes* random bytes.  If *nbytes* is ``None``
    or not supplied, a reasonable default is used.

    >>> token_urlsafe(16)  #doctest:+SKIP
    'Drmhze6EPcv0fN_81Bj-nA'

    �=r)r�base64Zurlsafe_b64encode�rstripr)r�tokrrr
r>s
)N)N)N)�__doc__�__all__rrrZhmacrZrandomrrZgetrandbitsrrrrrrrrrrr
�<module>s 


genericpath.cpython-36.opt-1.pyc000064400000010206150335715140012425 0ustar003

�\dh��@s�dZddlZddlZddddddd	d
ddd
dgZdd�Zdd
�Zdd	�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd
�Zdd�Z
dd�Zdd�Zdd�ZejGdd�d��ZdS)z�
Path operations common to more than one OS
Do not use directly.  The OS specific modules import the appropriate
functions from this module themselves.
�N�commonprefix�exists�getatime�getctime�getmtime�getsize�isdir�isfile�samefile�sameopenfile�samestat�
ALLOW_MISSINGcCs(ytj|�Wntk
r"dSXdS)zDTest whether a path exists.  Returns False for broken symbolic linksFT)�os�stat�OSError)�path�r�#/usr/lib64/python3.6/genericpath.pyrs
cCs0ytj|�}Wntk
r"dSXtj|j�S)z%Test whether a path is a regular fileF)rrr�S_ISREG�st_mode)r�strrrr	s
cCs0ytj|�}Wntk
r"dSXtj|j�S)z<Return true if the pathname refers to an existing directory.F)rrr�S_ISDIRr)�srrrrr's
cCstj|�jS)z1Return the size of a file, reported by os.stat().)rr�st_size)�filenamerrrr0scCstj|�jS)zCReturn the last modification time of a file, reported by os.stat().)rr�st_mtime)rrrrr5scCstj|�jS)z=Return the last access time of a file, reported by os.stat().)rr�st_atime)rrrrr:scCstj|�jS)zAReturn the metadata change time of a file, reported by os.stat().)rr�st_ctime)rrrrr?scCsl|sdSt|dttf�s*tttj|��}t|�}t|�}x,t|�D] \}}|||krD|d|�SqDW|S)zGGiven a list of pathnames, returns the longest common leading component�rN)	�
isinstance�list�tuple�mapr�fspath�min�max�	enumerate)�m�s1�s2�i�crrrrEscCs|j|jko|j|jkS)z5Test whether two stat buffers reference the same file)�st_ino�st_dev)r(r)rrrrWscCstj|�}tj|�}t||�S)z9Test whether two pathnames reference the same actual file)rrr)�f1�f2r(r)rrrr
^s

cCstj|�}tj|�}t||�S)z:Test whether two open file objects reference the same file)r�fstatr)�fp1�fp2r(r)rrrrgs

cCs�|j|�}|r"|j|�}t||�}|j|�}||kr~|d}x@||kr||||d�|krr|d|�||d�fS|d7}q>W||dd�fS)z�Split the extension from a pathname.

    Extension is everything from the last dot to the end, ignoring
    leading dots.  Returns "(root, ext)"; ext may be empty.�Nr)�rfindr%)�p�sep�altsep�extsep�sepIndex�altsepIndex�dotIndex�
filenameIndexrrr�	_splitextus




r=cGsbd}}xB|D]:}t|t�r"d}qt|t�r2d}qtd||jjf�d�qW|r^|r^td�d�dS)NFTz*%s() argument must be str or bytes, not %rz.Can't mix strings and bytes in path components)r�str�bytes�	TypeError�	__class__�__name__)�funcname�args�hasstr�hasbytesrrrr�_check_arg_types�s


rGc@s eZdZdZdd�Zdd�ZdS)r
z$Special value for use in realpath().cCsdS)Nzos.path.ALLOW_MISSINGr)�selfrrr�__repr__�szALLOW_MISSING.__repr__cCs|jjS)N)rArB)rHrrr�
__reduce__�szALLOW_MISSING.__reduce__N)rB�
__module__�__qualname__�__doc__rIrJrrrrr
�s)rMrr�__all__rr	rrrrrrrr
rr=rG�object�__new__r
rrrr�<module>s&

		sndhdr.cpython-36.opt-1.pyc000064400000015403150335715140011422 0ustar003


 \��@s2dZddgZddlmZedd�Zdej_dej_d	ej_d
ej_dej	_dd�Z
d
d�ZgZdd�Z
eje
�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zed*k�r.e�d+S),a�Routines to help recognizing sound files.

Function whathdr() recognizes various types of sound file headers.
It understands almost all headers that SOX can decode.

The return tuple contains the following items, in this order:
- file type (as SOX understands it)
- sampling rate (0 if unknown or hard to decode)
- number of channels (0 if unknown or hard to decode)
- number of frames in the file (-1 if unknown or hard to decode)
- number of bits/sample, or 'U' for U-LAW, or 'A' for A-LAW

If the file doesn't have a recognizable type, it returns None.
If the file can't be opened, OSError is raised.

To compute the total time, divide the number of frames by the
sampling rate (a frame contains a sample for each channel).

Function what() calls whathdr().  (It used to also use some
heuristics for raw data, but this doesn't work very well.)

Finally, the function test() is a simple main program that calls
what() for all files mentioned on the argument list.  For directory
arguments it calls what() for all files in that directory.  Default
argument is "." (testing all files in the current directory).  The
option -r tells it to recurse down directories found inside
explicitly given directories.
�what�whathdr�)�
namedtuple�
SndHeadersz.filetype framerate nchannels nframes sampwidthz�The value for type indicates the data type
and will be one of the strings 'aifc', 'aiff', 'au','hcom',
'sndr', 'sndt', 'voc', 'wav', '8svx', 'sb', 'ub', or 'ul'.zYThe sampling_rate will be either the actual
value or 0 if unknown or difficult to decode.z^The number of channels or 0 if it cannot be
determined or if the value is difficult to decode.z?The value for frames will be either the number
of frames or -1.zAEither the sample size in bits or
'A' for A-LAW or 'U' for u-LAW.cCst|�}|S)zGuess the type of a sound file.)r)�filename�res�r�/usr/lib64/python3.6/sndhdr.pyr4scCsHt|d��4}|jd�}x"tD]}|||�}|rt|�SqWdSQRXdS)zRecognize sound headers.�rbiN)�open�read�testsr)r�f�hZtfrrrr	r:s


cCs�ddl}|jd�sdS|dd�dkr,d}n|dd�dkrBd}ndS|jd�y|j|d	�}Wnt|jfk
rzdSX||j�|j�|j�d|j	�fS)
NrsFORM��sAIFC�aifcsAIFFZaiff�r)
r�
startswith�seekr�EOFError�Error�getframerate�getnchannels�
getnframes�getsampwidth)rrrZfmt�arrr	�	test_aifcKs

rc
Cs�|jd�rt}n|dd�dkr&t}ndSd}||dd��}||dd��}||dd��}||dd	��}||d	d
��}d}	|dkr�d}
n$|d
kr�d}
n|dkr�d}
d
}	nd}
|	|}|r�||}nd}|||||
fS)Ns.snd��ds.�dns.Zaurr�����U���?)rr ���)r�get_long_be�get_long_le)
rr�func�filetypeZhdr_sizeZ	data_size�encoding�rate�	nchannelsZsample_sizeZsample_bitsZ
frame_sizeZnframerrr	�test_au`s2

r1cCsT|dd�dks |dd�dkr$dSt|dd��}|rBd	|}nd
}d|ddd
fS)N�A�EsFSSD��sHCOM��i"VrZhcomr$rr))r*)rrZdivisorr/rrr	�	test_hcom�s 
r8cCst|jd�sdSt|dd��}d}d|ko4dknrf||dkrfd||d}|rftd	|�}d
|dddfS)
NsCreative Voice Filer"�ri�r$�rg��.AZvocrr))r�get_short_le�int)rrZsbseekr/Zratecoderrr	�test_voc�s
$r=cCs�ddl}|jd�s4|dd�dks4|dd�dkr8dS|jd�y|j|d�}Wnt|jfk
rldSXd	|j�|j�|j�d|j	�fS)
NrsRIFFrrsWAVEr!sfmt rZwav)
�waverrZopenfprrrrrr)rrr>�wrrr	�test_wav�s,
r@cCs$|jd�s|dd�dkr dSdS)	NsFORMrrs8SVX�8svxrr$)rArr$rr)r)rrrrr	�	test_8svx�srBcCs<|jd�r8t|dd��}t|dd��}d|d|dfSdS)NsSOUNDrrr"r9Zsndtr$)rr+r;)rrZnsamplesr/rrr	�	test_sndt�s
rCcCsD|jd�r@t|dd��}d|ko,dknr@d|dd	dfSdS)
Nsr&ri�i�aZsndrr$rr))rr;)rrr/rrr	�	test_sndr�s
rDcCs,|dd>|dd>B|dd>B|dBS)Nrr#r$r!r&rr'r)�brrr	r*�sr*cCs,|dd>|dd>B|dd>B|dBS)Nr'r#r&r!r$rrr)rErrr	r+�sr+cCs|dd>|dBS)Nrrr$r)rErrr	�get_short_be�srFcCs|dd>|dBS)Nr$rrr)rErrr	r;�sr;cCs�ddl}d}|jdd�r8|jddkr8|jdd�=d}y8|jdd�r`t|jdd�|d�ntdg|d�Wn*tk
r�|jjd�|jd�YnXdS)Nrr$z-rr&�.z
[Interrupted]
)�sys�argv�testall�KeyboardInterrupt�stderr�write�exit)rH�	recursiverrr	�test�srPcCs�ddl}ddl}x�|D]�}|jj|�rzt|ddd�|s>|rptd�ddl}|j|jj|d��}t||d�q�td�qt|ddd�|jj	�ytt
|��Wqtk
r�td	�YqXqWdS)
Nrz/:� )�endzrecursing down:�*z*** directory (use -r) ***�:z*** not found ***)rH�os�path�isdir�print�glob�joinrJ�stdout�flushr�OSError)�listrOZtoplevelrHrUrrY�namesrrr	rJ�s"


rJ�__main__N)�__doc__�__all__�collectionsrrr-Z	framerater0ZnframesZ	sampwidthrrr
r�appendr1r8r=r@rBrCrDr*r+rFr;rPrJ�__name__rrrr	�<module>sH









selectors.cpython-36.opt-1.pyc000064400000042443150335715140012147 0ustar003


 \�K�@s�dZddlmZmZddlmZmZddlZddlZddl	Z	d)Z
d*Zdd�Zedd	d
ddg�Z
d
e
_e	jd+kr�de
j_de
j_de
j_de
j_Gdd�de�ZGdd�ded�ZGdd�de�ZGdd�de�Zeed�r�Gdd�de�Zeed ��rGd!d"�d"e�Zeed#��r"Gd$d%�d%e�Zeed&��r>Gd'd(�d(e�Zd(e�k�rPeZn:d"e�k�rbeZn(d%e�k�rteZnde�k�r�eZneZdS),z|Selectors module.

This module allows high-level and efficient I/O multiplexing, built upon the
`select` module primitives.
�)�ABCMeta�abstractmethod)�
namedtuple�MappingN�c
Csft|t�r|}n<yt|j��}Wn*tttfk
rJtdj|��d�YnX|dkrbtdj|���|S)z�Return a file descriptor from a file object.

    Parameters:
    fileobj -- file object or file descriptor

    Returns:
    corresponding file descriptor

    Raises:
    ValueError if the object is invalid
    zInvalid file object: {!r}NrzInvalid file descriptor: {})�
isinstance�int�fileno�AttributeError�	TypeError�
ValueError�format)�fileobj�fd�r�!/usr/lib64/python3.6/selectors.py�_fileobj_to_fds
r�SelectorKeyrr�events�dataz�SelectorKey(fileobj, fd, events, data)

    Object used to associate a file object to its backing
    file descriptor, selected event mask, and attached data.
��zFile object registered.zUnderlying file descriptor.z3Events that must be waited for on this file object.zzOptional opaque data associated to this file object.
    For example, this could be used to store a per-client session ID.c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_SelectorMappingz)Mapping of file objects to selector keys.cCs
||_dS)N)�	_selector)�selfZselectorrrr�__init__>sz_SelectorMapping.__init__cCst|jj�S)N)�lenr�
_fd_to_key)rrrr�__len__Asz_SelectorMapping.__len__cCsBy|jj|�}|jj|Stk
r<tdj|��d�YnXdS)Nz{!r} is not registered)r�_fileobj_lookupr�KeyErrorr
)rrrrrr�__getitem__Ds
z_SelectorMapping.__getitem__cCst|jj�S)N)�iterrr)rrrr�__iter__Ksz_SelectorMapping.__iter__N)�__name__�
__module__�__qualname__�__doc__rrr!r#rrrrr;s
rc@sneZdZdZeddd��Zedd��Zddd�Zedd	d
��Zdd�Z	d
d�Z
edd��Zdd�Zdd�Z
dS)�BaseSelectora-Selector abstract base class.

    A selector supports registering file objects to be monitored for specific
    I/O events.

    A file object is a file descriptor or any object with a `fileno()` method.
    An arbitrary object can be attached to the file object, which can be used
    for example to store context information, a callback, etc.

    A selector can use various implementations (select(), poll(), epoll()...)
    depending on the platform. The default `Selector` class uses the most
    efficient implementation on the current platform.
    NcCst�dS)a3Register a file object.

        Parameters:
        fileobj -- file object or file descriptor
        events  -- events to monitor (bitwise mask of EVENT_READ|EVENT_WRITE)
        data    -- attached data

        Returns:
        SelectorKey instance

        Raises:
        ValueError if events is invalid
        KeyError if fileobj is already registered
        OSError if fileobj is closed or otherwise is unacceptable to
                the underlying system call (if a system call is made)

        Note:
        OSError may or may not be raised
        N)�NotImplementedError)rrrrrrr�register^szBaseSelector.registercCst�dS)ajUnregister a file object.

        Parameters:
        fileobj -- file object or file descriptor

        Returns:
        SelectorKey instance

        Raises:
        KeyError if fileobj is not registered

        Note:
        If fileobj is registered but has since been closed this does
        *not* raise OSError (even if the wrapped syscall does)
        N)r))rrrrr�
unregisteruszBaseSelector.unregistercCs|j|�|j|||�S)ayChange a registered file object monitored events or attached data.

        Parameters:
        fileobj -- file object or file descriptor
        events  -- events to monitor (bitwise mask of EVENT_READ|EVENT_WRITE)
        data    -- attached data

        Returns:
        SelectorKey instance

        Raises:
        Anything that unregister() or register() raises
        )r+r*)rrrrrrr�modify�s
zBaseSelector.modifycCst�dS)aqPerform the actual selection, until some monitored file objects are
        ready or a timeout expires.

        Parameters:
        timeout -- if timeout > 0, this specifies the maximum wait time, in
                   seconds
                   if timeout <= 0, the select() call won't block, and will
                   report the currently ready file objects
                   if timeout is None, select() will block until a monitored
                   file object becomes ready

        Returns:
        list of (key, events) for ready file objects
        `events` is a bitwise mask of EVENT_READ|EVENT_WRITE
        N)r))r�timeoutrrr�select�szBaseSelector.selectcCsdS)zmClose the selector.

        This must be called to make sure that any underlying resource is freed.
        Nr)rrrr�close�szBaseSelector.closecCsJ|j�}|dkrtd��y||Stk
rDtdj|��d�YnXdS)zzReturn the key associated to a registered file object.

        Returns:
        SelectorKey for this file object
        NzSelector is closedz{!r} is not registered)�get_map�RuntimeErrorr r
)rr�mappingrrr�get_key�szBaseSelector.get_keycCst�dS)z2Return a mapping of file objects to selector keys.N)r))rrrrr0�szBaseSelector.get_mapcCs|S)Nr)rrrr�	__enter__�szBaseSelector.__enter__cGs|j�dS)N)r/)r�argsrrr�__exit__�szBaseSelector.__exit__)N)N)N)r$r%r&r'rr*r+r,r.r/r3r0r4r6rrrrr(Os

r()�	metaclassc@sTeZdZdZdd�Zdd�Zddd�Zd	d
�Zddd�Zd
d�Z	dd�Z
dd�ZdS)�_BaseSelectorImplzBase selector implementation.cCsi|_t|�|_dS)N)rr�_map)rrrrr�sz_BaseSelectorImpl.__init__cCsHyt|�Stk
rBx"|jj�D]}|j|kr$|jSq$W�YnXdS)alReturn a file descriptor from a file object.

        This wraps _fileobj_to_fd() to do an exhaustive search in case
        the object is invalid but we still have it in our map.  This
        is used by unregister() so we can unregister an object that
        was previously registered even if it is closed.  It is also
        used by _SelectorMapping.
        N)rrr�valuesrr)rr�keyrrrr�s	

z!_BaseSelectorImpl._fileobj_lookupNcCsd|s|ttB@r"tdj|���t||j|�||�}|j|jkrTtdj||j���||j|j<|S)NzInvalid events: {!r}z"{!r} (FD {}) is already registered)	�
EVENT_READ�EVENT_WRITErr
rrrrr )rrrrr;rrrr*�sz_BaseSelectorImpl.registercCs@y|jj|j|��}Wn$tk
r:tdj|��d�YnX|S)Nz{!r} is not registered)r�poprr r
)rrr;rrrr+�s
z_BaseSelectorImpl.unregistercCs�y|j|j|�}Wn$tk
r8tdj|��d�YnX||jkr^|j|�|j|||�}n"||jkr�|j|d�}||j|j	<|S)Nz{!r} is not registered)r)
rrr r
rr+r*r�_replacer)rrrrr;rrrr,�s


z_BaseSelectorImpl.modifycCs|jj�d|_dS)N)r�clearr9)rrrrr/s
z_BaseSelectorImpl.closecCs|jS)N)r9)rrrrr0sz_BaseSelectorImpl.get_mapcCs$y
|j|Stk
rdSXdS)z�Return the key associated to a given file descriptor.

        Parameters:
        fd -- file descriptor

        Returns:
        corresponding key, or None if not found
        N)rr )rrrrr�_key_from_fds	
z_BaseSelectorImpl._key_from_fd)N)N)r$r%r&r'rrr*r+r,r/r0rArrrrr8�s


r8cs`eZdZdZ�fdd�Zd�fdd�	Z�fdd�Zejd	krHdd
d�Z	ne
j
Z	ddd
�Z
�ZS)�SelectSelectorzSelect-based selector.cst�j�t�|_t�|_dS)N)�superr�set�_readers�_writers)r)�	__class__rrr%s
zSelectSelector.__init__Ncs@t�j|||�}|t@r&|jj|j�|t@r<|jj|j�|S)N)rCr*r<rE�addrr=rF)rrrrr;)rGrrr**szSelectSelector.registercs,t�j|�}|jj|j�|jj|j�|S)N)rCr+rE�discardrrF)rrr;)rGrrr+2szSelectSelector.unregisterZwin32cCs$tj||||�\}}}|||gfS)N)r.)r�r�w�_r-�xrrr�_select9szSelectSelector._selectc	
Cs�|dkrdnt|d�}g}y|j|j|jg|�\}}}Wntk
rL|SXt|�}t|�}xV||BD]J}d}||kr�|tO}||kr�|tO}|j|�}|rh|j	|||j
@f�qhW|S)Nr)�maxrNrErF�InterruptedErrorrDr<r=rA�appendr)	rr-�readyrJrKrLrrr;rrrr.?s$
zSelectSelector.select)N)N)N)r$r%r&r'rr*r+�sys�platformrNr.�
__classcell__rr)rGrrB"s
rB�pollcsDeZdZdZ�fdd�Zd�fdd�	Z�fdd�Zdd	d
�Z�ZS)
�PollSelectorzPoll-based selector.cst�j�tj�|_dS)N)rCrr.rV�_poll)r)rGrrrZs
zPollSelector.__init__NcsLt�j|||�}d}|t@r&|tjO}|t@r8|tjO}|jj|j|�|S)Nr)	rCr*r<r.�POLLINr=�POLLOUTrXr)rrrrr;�poll_events)rGrrr*^s

zPollSelector.registercst�j|�}|jj|j�|S)N)rCr+rXr)rrr;)rGrrr+hszPollSelector.unregisterc
Cs�|dkrd}n|dkrd}ntj|d�}g}y|jj|�}Wntk
rR|SXx^|D]V\}}d}|tj@rz|tO}|tj@r�|t	O}|j
|�}|rZ|j|||j@f�qZW|S)Nrg@�@)
�math�ceilrXrVrPr.rYr=rZr<rArQr)rr-rR�
fd_event_listr�eventrr;rrrr.ms(
zPollSelector.select)N)N)	r$r%r&r'rr*r+r.rUrr)rGrrWWs

rW�epollcsXeZdZdZ�fdd�Zdd�Zd�fdd�	Z�fd	d
�Zddd�Z�fd
d�Z	�Z
S)�
EpollSelectorzEpoll-based selector.cst�j�tj�|_dS)N)rCrr.r`�_epoll)r)rGrrr�s
zEpollSelector.__init__cCs
|jj�S)N)rbr	)rrrrr	�szEpollSelector.filenoNcstt�j|||�}d}|t@r&|tjO}|t@r8|tjO}y|jj|j|�Wn"t	k
rnt�j
|��YnX|S)Nr)rCr*r<r.�EPOLLINr=�EPOLLOUTrbr�
BaseExceptionr+)rrrrr;Zepoll_events)rGrrr*�s

zEpollSelector.registercs8t�j|�}y|jj|j�Wntk
r2YnX|S)N)rCr+rbr�OSError)rrr;)rGrrr+�szEpollSelector.unregisterc	
Cs�|dkrd}n |dkrd}ntj|d�d}tt|j�d�}g}y|jj||�}Wntk
rh|SXx^|D]V\}}d}|tj	@r�|t
O}|tj@r�|tO}|j
|�}|rp|j|||j@f�qpW|S)Nrrg@�@g����MbP?���)r\r]rOrrrbrVrPr.rcr=rdr<rArQr)	rr-�max_evrRr^rr_rr;rrrr.�s*
zEpollSelector.selectcs|jj�t�j�dS)N)rbr/rC)r)rGrrr/�s
zEpollSelector.close)N)N)r$r%r&r'rr	r*r+r.r/rUrr)rGrra�s

 ra�devpollcsXeZdZdZ�fdd�Zdd�Zd�fdd�	Z�fd	d
�Zddd�Z�fd
d�Z	�Z
S)�DevpollSelectorzSolaris /dev/poll selector.cst�j�tj�|_dS)N)rCrr.ri�_devpoll)r)rGrrr�s
zDevpollSelector.__init__cCs
|jj�S)N)rkr	)rrrrr	�szDevpollSelector.filenoNcsLt�j|||�}d}|t@r&|tjO}|t@r8|tjO}|jj|j|�|S)Nr)	rCr*r<r.rYr=rZrkr)rrrrr;r[)rGrrr*�s

zDevpollSelector.registercst�j|�}|jj|j�|S)N)rCr+rkr)rrr;)rGrrr+�szDevpollSelector.unregisterc
Cs�|dkrd}n|dkrd}ntj|d�}g}y|jj|�}Wntk
rR|SXx^|D]V\}}d}|tj@rz|tO}|tj@r�|t	O}|j
|�}|rZ|j|||j@f�qZW|S)Nrg@�@)
r\r]rkrVrPr.rYr=rZr<rArQr)rr-rRr^rr_rr;rrrr.�s(
zDevpollSelector.selectcs|jj�t�j�dS)N)rkr/rC)r)rGrrr/s
zDevpollSelector.close)N)N)r$r%r&r'rr	r*r+r.r/rUrr)rGrrj�s

rj�kqueuecsXeZdZdZ�fdd�Zdd�Zd�fdd�	Z�fd	d
�Zddd�Z�fd
d�Z	�Z
S)�KqueueSelectorzKqueue-based selector.cst�j�tj�|_dS)N)rCrr.rl�_kqueue)r)rGrrrs
zKqueueSelector.__init__cCs
|jj�S)N)rnr	)rrrrr	szKqueueSelector.filenoNcs�t�j|||�}y`|t@r@tj|jtjtj�}|jj	|gdd�|t
@rntj|jtjtj�}|jj	|gdd�Wn"tk
r�t�j
|��YnX|S)Nr)rCr*r<r.�keventr�KQ_FILTER_READZ	KQ_EV_ADDrn�controlr=�KQ_FILTER_WRITErer+)rrrrr;�kev)rGrrr*szKqueueSelector.registercs�t�j|�}|jt@rVtj|jtjtj�}y|j	j
|gdd�Wntk
rTYnX|jt@r�tj|jtj
tj�}y|j	j
|gdd�Wntk
r�YnX|S)Nr)rCr+rr<r.rorrpZKQ_EV_DELETErnrqrfr=rr)rrr;rs)rGrrr+'s 

zKqueueSelector.unregisterc

Cs�|dkrdnt|d�}t|j�}g}y|jjd||�}Wntk
rL|SXxb|D]Z}|j}|j}d}|tj	krz|t
O}|tjkr�|tO}|j
|�}	|	rT|j|	||	j@f�qTW|S)Nr)rOrrrnrqrPZident�filterr.rpr<rrr=rArQr)
rr-rhrRZkev_listrsr�flagrr;rrrr.<s&




zKqueueSelector.selectcs|jj�t�j�dS)N)rnr/rC)r)rGrrr/Rs
zKqueueSelector.close)N)N)r$r%r&r'rr	r*r+r.r/rUrr)rGrrm
s
rmr�)rr)r'�abcrr�collectionsrrr\r.rSr<r=rr�version_inforrrrrr(r8rB�hasattrrWrarjrm�globalsZDefaultSelectorrrrr�<module>sH
~U3
1G8Mtracemalloc.cpython-36.opt-1.pyc000064400000041517150335715140012433 0ustar003


 \A�@sddlmZmZddlmZddlZddlZddlZddl	Z	ddl
Tddl
mZmZdd�Z
Gdd	�d	�ZGd
d�d�Zdd
�ZeGdd�d��ZeGdd�de��Zdd�ZGdd�d�ZGdd�de�Zdd�ZGdd�d�ZGdd�de�ZGdd�de�ZGd d!�d!�Zd"d#�ZdS)$�)�Sequence�Iterable)�total_orderingN)�*)�_get_object_traceback�_get_tracescCszxtd
D]l}t|�dkr:|dkr:|r.d||fSd||fSt|�dksN|dkrj|r^d||fSd||fS|d
}qWdS)N�B�KiB�MiB�GiB�TiB�dz%+.1f %sz%.1f %s�
iz%+.0f %sz%.0f %s)rr	r
rri()�abs)�sizeZsignZunit�r�#/usr/lib64/python3.6/tracemalloc.py�_format_size
s
rc@sDeZdZdZdZdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�	StatisticzS
    Statistic difference on memory allocations between two Snapshot instance.
    �	tracebackr�countcCs||_||_||_dS)N)rrr)�selfrrrrrr�__init__%szStatistic.__init__cCst|j|j|jf�S)N)�hashrrr)rrrr�__hash__*szStatistic.__hash__cCs$|j|jko"|j|jko"|j|jkS)N)rrr)r�otherrrr�__eq__-szStatistic.__eq__cCsBd|jt|jd�|jf}|jr>|j|j}|dt|d�7}|S)Nz%s: size=%s, count=%iFz, average=%s)rrrr)r�text�averagerrr�__str__2s

zStatistic.__str__cCsd|j|j|jfS)Nz)<Statistic traceback=%r size=%i count=%i>)rrr)rrrr�__repr__<szStatistic.__repr__cCs|j|j|jfS)N)rrr)rrrr�	_sort_key@szStatistic._sort_keyN)rrr)�__name__�
__module__�__qualname__�__doc__�	__slots__rrrrr r!rrrrrs
rc@sDeZdZdZdZdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dS)�
StatisticDiffzd
    Statistic difference on memory allocations between an old and a new
    Snapshot instance.
    rr�	size_diffr�
count_diffcCs"||_||_||_||_||_dS)N)rrr(rr))rrrr(rr)rrrrKs
zStatisticDiff.__init__cCst|j|j|j|j|jf�S)N)rrrr(rr))rrrrrRszStatisticDiff.__hash__cCs<|j|jko:|j|jko:|j|jko:|j|jko:|j|jkS)N)rrr(rr))rrrrrrVs
zStatisticDiff.__eq__cCsPd|jt|jd�t|jd�|j|jf}|jrL|j|j}|dt|d�7}|S)Nz %s: size=%s (%s), count=%i (%+i)FTz, average=%s)rrrr(rr))rrrrrrr]s


zStatisticDiff.__str__cCsd|j|j|j|j|jfS)Nz9<StatisticDiff traceback=%r size=%i (%+i) count=%i (%+i)>)rrr(rr))rrrrr iszStatisticDiff.__repr__cCs t|j�|jt|j�|j|jfS)N)rr(rr)rr)rrrrr!nszStatisticDiff._sort_keyN)rrr(rr))r"r#r$r%r&rrrrr r!rrrrr'Dsr'cCs�g}xp|j�D]d\}}|j|d�}|dk	rPt||j|j|j|j|j|j�}nt||j|j|j|j�}|j|�qWx6|j�D]*\}}t|d|jd|j�}|j|�q�W|S)Nr)�items�popr'rr�append)�	old_group�	new_group�
statisticsr�statZpreviousrrr�_compare_grouped_statstsr1c@s\eZdZdZdZdd�Zedd��Zedd��Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dS)�Framez
    Frame of a traceback.
    �_framecCs
||_dS)N)r3)r�framerrrr�szFrame.__init__cCs
|jdS)Nr)r3)rrrr�filename�szFrame.filenamecCs
|jdS)N�)r3)rrrr�lineno�szFrame.linenocCs|j|jkS)N)r3)rrrrrr�szFrame.__eq__cCs|j|jkS)N)r3)rrrrr�__lt__�szFrame.__lt__cCs
t|j�S)N)rr3)rrrrr�szFrame.__hash__cCsd|j|jfS)Nz%s:%s)r5r7)rrrrr�sz
Frame.__str__cCsd|j|jfS)Nz<Frame filename=%r lineno=%r>)r5r7)rrrrr �szFrame.__repr__N)r3)r"r#r$r%r&r�propertyr5r7rr8rrr rrrrr2�sr2c@sfeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
ddd�ZdS)�	Tracebackz`
    Sequence of Frame instances sorted from the most recent frame
    to the oldest frame.
    �_framescCstj|�||_dS)N)rrr;)r�framesrrrr�s
zTraceback.__init__cCs
t|j�S)N)�lenr;)rrrr�__len__�szTraceback.__len__cCs4t|t�r"tdd�|j|D��St|j|�SdS)Ncss|]}t|�VqdS)N)r2)�.0�tracerrr�	<genexpr>�sz(Traceback.__getitem__.<locals>.<genexpr>)�
isinstance�slice�tupler;r2)r�indexrrr�__getitem__�s
zTraceback.__getitem__cCs|j|jkS)N)r3r;)rr4rrr�__contains__�szTraceback.__contains__cCs
t|j�S)N)rr;)rrrrr�szTraceback.__hash__cCs|j|jkS)N)r;)rrrrrr�szTraceback.__eq__cCs|j|jkS)N)r;)rrrrrr8�szTraceback.__lt__cCst|d�S)Nr)�str)rrrrr�szTraceback.__str__cCsdt|�fS)Nz<Traceback %r>)rD)rrrrr �szTraceback.__repr__NcCsng}|dk	r|dkr|SxP|d|�D]@}|jd|j|jf�tj|j|j�j�}|r&|jd|�q&W|S)Nrz  File "%s", line %sz    %s)r,r5r7�	linecache�getline�strip)r�limit�linesr4�linerrr�format�szTraceback.format)r;)N)r"r#r$r%r&rr>rFrGrrr8rr rOrrrrr:�sr:cCs t|�}|dk	rt|�SdSdS)z�
    Get the traceback where the Python object *obj* was allocated.
    Return a Traceback instance.

    Return None if the tracemalloc module is not tracing memory allocations or
    did not trace the allocation of the object.
    N)rr:)�objr<rrr�get_object_traceback�srQc@s`eZdZdZdZdd�Zedd��Zedd��Zed	d
��Z	dd�Z
d
d�Zdd�Zdd�Z
dS)�Tracez"
    Trace of a memory block.
    �_tracecCs
||_dS)N)rS)rr@rrrr�szTrace.__init__cCs
|jdS)Nr)rS)rrrr�domain�szTrace.domaincCs
|jdS)Nr6)rS)rrrrr�sz
Trace.sizecCst|jd�S)N�)r:rS)rrrrrszTrace.tracebackcCs|j|jkS)N)rS)rrrrrrszTrace.__eq__cCs
t|j�S)N)rrS)rrrrr
szTrace.__hash__cCsd|jt|jd�fS)Nz%s: %sF)rrr)rrrrr
sz
Trace.__str__cCsd|jt|jd�|jfS)Nz'<Trace domain=%s size=%s, traceback=%r>F)rTrrr)rrrrr szTrace.__repr__N)rS)r"r#r$r%r&rr9rTrrrrrr rrrrrR�srRc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�_TracescCstj|�||_dS)N)rr�_traces)r�tracesrrrrs
z_Traces.__init__cCs
t|j�S)N)r=rW)rrrrr>sz_Traces.__len__cCs4t|t�r"tdd�|j|D��St|j|�SdS)Ncss|]}t|�VqdS)N)rR)r?r@rrrrA sz&_Traces.__getitem__.<locals>.<genexpr>)rBrCrDrWrR)rrErrrrFs
z_Traces.__getitem__cCs|j|jkS)N)rSrW)rr@rrrrG$sz_Traces.__contains__cCs|j|jkS)N)rW)rrrrrr'sz_Traces.__eq__cCsdt|�S)Nz<Traces len=%s>)r=)rrrrr *sz_Traces.__repr__N)	r"r#r$rr>rFrGrr rrrrrVsrVcCs&tjj|�}|jd�r"|dd�}|S)Nz.pycr6���)�os�path�normcase�endswith)r5rrr�_normalize_filename.s
r^c@seZdZdd�Zdd�ZdS)�
BaseFiltercCs
||_dS)N)�	inclusive)rr`rrrr6szBaseFilter.__init__cCst�dS)N)�NotImplementedError)rr@rrr�_match9szBaseFilter._matchN)r"r#r$rrbrrrrr_5sr_csJeZdZd�fdd�	Zedd��Zdd�Zd	d
�Zdd�Zd
d�Z	�Z
S)�FilterNFcs2t�j|�||_t|�|_||_||_||_dS)N)�superrr`r^�_filename_patternr7�
all_framesrT)rr`�filename_patternr7rfrT)�	__class__rrr>s
zFilter.__init__cCs|jS)N)re)rrrrrgGszFilter.filename_patterncCs6t|�}tj||j�sdS|jdkr(dS||jkSdS)NFT)r^�fnmatchrer7)rr5r7rrr�_match_frame_implKs
zFilter._match_frame_implcCs|j||�|jAS)N)rjr`)rr5r7rrr�_match_frameTszFilter._match_framecsH�jr,t�fdd�|D��r"�jS�jSn|d\}}�j||�SdS)Nc3s|]\}}�j||�VqdS)N)rj)r?r5r7)rrrrAYsz*Filter._match_traceback.<locals>.<genexpr>r)rf�anyr`rk)rrr5r7r)rr�_match_tracebackWs

zFilter._match_tracebackcCsD|\}}}|j|�}|jdk	r@|jr2|o0||jkS|p>||jkS|S)N)rmrTr`)rr@rTrr�resrrrrbbs


z
Filter._match)NFN)r"r#r$rr9rgrjrkrmrb�
__classcell__rr)rhrrc=s	rccs0eZdZ�fdd�Zedd��Zdd�Z�ZS)�DomainFiltercst�j|�||_dS)N)rdr�_domain)rr`rT)rhrrrnszDomainFilter.__init__cCs|jS)N)rq)rrrrrTrszDomainFilter.domaincCs|\}}}||jk|jAS)N)rTr`)rr@rTrrrrrrbvs
zDomainFilter._match)r"r#r$rr9rTrbrorr)rhrrpmsrpc@sXeZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z	dd
�Z
ddd�Zddd�ZdS)�SnapshotzB
    Snapshot of traces of memory blocks allocated by Python.
    cCst|�|_||_dS)N)rVrX�traceback_limit)rrXrsrrrr�s
zSnapshot.__init__cCs*t|d��}tj||tj�WdQRXdS)z1
        Write the snapshot into a file.
        �wbN)�open�pickle�dumpZHIGHEST_PROTOCOL)rr5�fprrrrw�sz
Snapshot.dumpc	Cs t|d��}tj|�SQRXdS)z.
        Load a snapshot from a file.
        �rbN)rurv�load)r5rxrrrrz�sz
Snapshot.loadcs@|rt�fdd�|D��sdS|r<t�fdd�|D��r<dSdS)Nc3s|]}|j��VqdS)N)rb)r?�trace_filter)r@rrrA�sz)Snapshot._filter_trace.<locals>.<genexpr>Fc3s|]}|j��VqdS)N)rb)r?r{)r@rrrA�sT)rl)r�include_filters�exclude_filtersr@r)r@r�
_filter_trace�s

zSnapshot._filter_tracecs�t|t�stdt|�j��|rng�g�x(|D] }|jrD�j|�q.�j|�q.W���fdd��jjD�}n�jjj	�}t
|�j�S)z�
        Create a new Snapshot instance with a filtered traces sequence, filters
        is a list of Filter or DomainFilter instances.  If filters is an empty
        list, return a new Snapshot instance with a copy of the traces.
        z)filters must be a list of filters, not %scsg|]}�j��|�r|�qSr)r~)r?r@)r}r|rrr�
<listcomp>�sz*Snapshot.filter_traces.<locals>.<listcomp>)rBr�	TypeError�typer"r`r,rXrW�copyrrrs)r�filtersr{Z
new_tracesr)r}r|rr�
filter_traces�s

zSnapshot.filter_tracesc
Cs�|dkrtd|f��|r.|d	kr.td|��i}i}|�sx�|jjD]�}|\}}}y||}	WnZtk
r�|dkr~|}
n(|dkr�|dd�}
n|dddff}
t|
�}	|	||<YnXy(||	}|j|7_|jd7_WqFtk
�r
t|	|d�||	<YqFXqFWn�x�|jjD]�}|\}}}x�|D]�}y||}	WnFtk
�r�|dk�rd|f}
n|ddff}
t|
�}	|	||<YnXy(||	}|j|7_|jd7_Wn&tk
�r�t|	|d�||	<YnX�q0W�qW|S)
Nrr5r7zunknown key_type: %rz/cumulative mode cannot by used with key type %rr6r)rr5r7)r7r5)�
ValueErrorrXrW�KeyErrorr:rrr)
r�key_type�
cumulativeZstatsZ
tracebacksr@rTrZtrace_tracebackrr<r0r4rrr�	_group_by�sX



"zSnapshot._group_byFcCs,|j||�}t|j��}|jdtjd�|S)zd
        Group statistics by key_type. Return a sorted list of Statistic
        instances.
        T)�reverse�key)r��list�values�sortrr!)rr�r�Zgroupedr/rrrr/�szSnapshot.statisticscCs6|j||�}|j||�}t||�}|jdtjd�|S)z�
        Compute the differences with an old snapshot old_snapshot. Get
        statistics as a sorted list of StatisticDiff instances, grouped by
        group_by.
        T)r�r�)r�r1r�r'r!)rZold_snapshotr�r�r.r-r/rrr�
compare_to�s

zSnapshot.compare_toN)F)F)
r"r#r$r%rrw�staticmethodrzr~r�r�r/r�rrrrrr{s3

rrcCs$t�std��t�}t�}t||�S)zI
    Take a snapshot of traces of memory blocks allocated by Python.
    zLthe tracemalloc module must be tracing memory allocations to take a snapshot)Z
is_tracing�RuntimeErrorrZget_traceback_limitrr)rXrsrrr�
take_snapshots
r�)�collectionsrr�	functoolsrrirIZos.pathrZrvZ_tracemallocrrrrr'r1r2r:rQrRrVr^r_rcrprrr�rrrr�<module>s0&0#5%0	socket.cpython-36.pyc000064400000052777150335715140010510 0ustar003


 \3k�
@spdZddlZddlTddlZddlZddlZddlZddlmZmZyddl	Z	Wne
k
rhdZ	YnXee	dd�Zee	dd�Z
ee	d	d�Zd
ddd
dgZejeje��ejd
edd��ejdedd��ejdedd��ejdedd��dZdZdd�ZeZejj�jd��r�iZded<ded<ded <d!ed"<d#ed$<d%ed&<d'ed(<d)ed*<d+ed,<d-ed.<d/ed0<d1ed2<d3ed4<d5ed6<d7ed8<ejd9�Gd:d;�d;e�ZGd<d=�d=ej�ZdMd>d
�Z e!ejd?��r�d@dA�Z"ejdA�e!edB��r
de#dfdCdB�Z$ne%e#dfdDdB�Z$ejdB�dEe$_e
ehZ&GdFdG�dGej'�Z(dNdId�Z)e*�Z+e+dfdJd�Z,dOdKdL�Z-dS)Pa0This module provides socket operations and some related functions.
On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
On other systems, it only supports IP. Functions specific for a
socket are available as methods of the socket object.

Functions:

socket() -- create a new socket object
socketpair() -- create a pair of new socket objects [*]
fromfd() -- create a socket object from an open file descriptor [*]
fromshare() -- create a socket object from data received from socket.share() [*]
gethostname() -- return the current hostname
gethostbyname() -- map a hostname to its IP number
gethostbyaddr() -- map an IP number or hostname to DNS info
getservbyname() -- map a service name and a protocol name to a port number
getprotobyname() -- map a protocol name (e.g. 'tcp') to a number
ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order
htons(), htonl() -- convert 16, 32 bit int from host to network byte order
inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format
inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89)
socket.getdefaulttimeout() -- get the default timeout value
socket.setdefaulttimeout() -- set the default timeout value
create_connection() -- connects to an address, with an optional timeout and
                       optional source address.

 [*] not available on all platforms!

Special objects:

SocketType -- type object for socket objects
error -- exception raised for I/O errors
has_ipv6 -- boolean value indicating if IPv6 is supported

IntEnum constants:

AF_INET, AF_UNIX -- socket domains (first argument to socket() call)
SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument)

Integer constants:

Many other constants may be defined; these may be used in calls to
the setsockopt() and getsockopt() methods.
�N)�*)�IntEnum�IntFlag�EBADF�	�EAGAIN��EWOULDBLOCK�fromfd�getfqdn�create_connection�
AddressFamily�
SocketKindcCs|j�o|jd�S)NZAF_)�isupper�
startswith)�C�r�/usr/lib64/python3.6/socket.py�<lambda>LsrcCs|j�o|jd�S)NZSOCK_)rr)rrrrrQsZMsgFlagcCs|j�o|jd�S)NZMSG_)rr)rrrrrVsZAddressInfocCs|j�o|jd�S)NZAI_)rr)rrrrr[sz	127.0.0.1z::1cCs"y||�Stk
r|SXdS)z{Convert a numeric family value to an IntEnum member.

    If it's not a known member, return the numeric value itself.
    N)�
ValueError)�valueZ
enum_klassrrr�_intenum_converterasr�winzThe operation was interrupted.i'zA bad file handle was passed.i'zPermission denied.i'z!A fault occurred on the network??i'z#An invalid operation was attempted.i&'z The socket operation would blocki3'z,A blocking operation is already in progress.i4'zThe network address is in use.i@'zThe connection has been reset.iF'zThe network has been shut down.iJ'zThe operation timed out.iL'zConnection refused.iM'zThe name is too long.iO'zThe host is down.iP'zThe host is unreachable.iQ'�errorTabc@seZdZdS)�_GiveupOnSendfileN)�__name__�
__module__�__qualname__rrrrr�srcs4eZdZdZdddgZeeddfdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
d8dddd�dd�Zeed�r�d9dd�Zn
d:dd�Zd;dd�Zdd �Zd<d!d"�Zd#d$�Zejfd%d&�Zd'd(�Z�fd)d*�Ze�fd+d,��Ze�fd-d.��Zejd/k�rd0d1�Zd2d3�Z nd4d1�Zd5d3�Z d6e_d7e _�Z!S)=�socketz:A subclass of _socket.socket adding the makefile() method.�__weakref__�_io_refs�_closedrNcCs$tjj|||||�d|_d|_dS)NrF)�_socketr�__init__r r!)�self�family�type�proto�filenorrrr#�szsocket.__init__cCs|S)Nr)r$rrr�	__enter__�szsocket.__enter__cGs|js|j�dS)N)r!�close)r$�argsrrr�__exit__�szsocket.__exit__cCs�t|dd�}d|jj|jj|r"dnd|j�|j|j|jf}|s�y |j�}|r^|dt	|�7}Wnt
k
rtYnXy |j�}|r�|dt	|�7}Wnt
k
r�YnX|d7}|S)	zVWrap __repr__() to reveal the real class name and socket
        address(es).
        r!Fz,<%s.%s%s fd=%i, family=%s, type=%s, proto=%iz	 [closed]�z
, laddr=%sz
, raddr=%s�>)�getattr�	__class__rrr(r%r&r'�getsockname�str�errorZgetpeername)r$�closed�sZladdrZraddrrrr�__repr__�s0

zsocket.__repr__cCstd��dS)NzCannot serialize socket object)�	TypeError)r$rrr�__getstate__�szsocket.__getstate__cCs6t|j��}|j|j|j|j|d�}|j|j��|S)z�dup() -> socket object

        Duplicate the socket. Return a new socket object connected to the same
        system resource. The new socket is non-inheritable.
        )r()�dupr(r0r%r&r'�
settimeout�
gettimeout)r$�fd�sockrrrr9�sz
socket.dupcCsZ|j�\}}|jt�jdd�@}t|j||j|d�}t�dkrR|j�rR|j	d�||fS)z�accept() -> (socket object, address info)

        Wait for an incoming connection.  Return a new socket
        representing the connection, and the address of the client.
        For IP sockets, the address info is a pair (hostaddr, port).
        Z
SOCK_NONBLOCKr)r(NT)
Z_acceptr&�globals�getrr%r'Zgetdefaulttimeoutr;�setblocking)r$r<�addrr&r=rrr�accept�s
z
socket.accept�r)�encoding�errors�newlinec
Cst|�dddhks td|f��d|k}d|kp4|}|sB|sBt�d|k}d}	|rZ|	d7}	|rf|	d7}	t||	�}
|jd7_|dkr�d
}|dkr�tj}|dkr�|s�td	��|
S|r�|r�tj|
|
|�}n&|r�tj|
|�}n|s�t�tj	|
|�}|r�|Stj
||||�}||_|S)z�makefile(...) -> an I/O stream connected to the socket

        The arguments are as for io.open() after the filename, except the only
        supported mode values are 'r' (default), 'w' and 'b'.
        rC�w�bz&invalid mode %r (only r, w, b allowed)r-�Nrz!unbuffered streams must be binary���)�setr�AssertionError�SocketIOr �io�DEFAULT_BUFFER_SIZE�BufferedRWPair�BufferedReader�BufferedWriter�
TextIOWrapper�mode)
r$rT�	bufferingrDrErFZwritingZreadingZbinaryZrawmode�raw�buffer�textrrr�makefile�s@
zsocket.makefile�sendfilec2Cs�|j|||�|j�}y|j�}Wn0ttjfk
rR}zt|��WYdd}~XnXytj|�j}Wn*t	k
r�}zt|��WYdd}~XnX|s�dS|s�|n|}|j
�}	|	dkr�td��tt
d�r�t
j�}
nt
j�}
|
j|t
j�d}|
j}tj}
z�x�|	�r||	��rtjd��|�r0||}|dk�r0Py|
||||�}Wn^tk
�rf|	�s`|�w�Yq�t	k
�r�}z|dk�r�t|��|d�WYdd}~Xq�X|dk�r�P||7}||7}q�W|S|dk�r�t|d��r�|j|�XdS)Nrz&non-blocking sockets are not supported�PollSelectorz	timed out�seek)�_check_sendfile_paramsr(�AttributeErrorrN�UnsupportedOperationr�os�fstat�st_size�OSErrorr;r�hasattr�	selectorsr[ZSelectSelector�registerZEVENT_WRITEZselectrZr"�timeout�BlockingIOErrorr\)r$�file�offset�countZsocknor(�errZfsize�	blocksizergZselector�
total_sentZselector_selectZos_sendfile�sentrrr�_sendfile_use_sendfiles`





zsocket._sendfile_use_sendfilecCstd��dS)Nz,os.sendfile() not available on this platform)r)r$rirjrkrrrrpGsc
Cs|j|||�|j�dkr"td��|r0|j|�|r>t|d�nd}d}|j}|j}z�x�|rrt|||�}|dkrrPt||��}|s�PxLy||�}	Wntk
r�w�Yq�X||	7}|	t	|�kr�||	d�}q�Pq�WqVW|S|dko�t
|d��r�|j||�XdS)Nrz&non-blocking sockets are not supportedi r\)r]r;rr\�min�read�send�
memoryviewrh�lenrd)
r$rirjrkrmrnZ	file_readZ	sock_send�datarorrr�_sendfile_use_sendKs<

zsocket._sendfile_use_sendcCsddt|dd�krtd��|jt@s*td��|dk	r`t|t�sJtdj|���|dkr`tdj|���dS)NrHrTz$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})r)r/rr&�SOCK_STREAM�
isinstance�intr7�format)r$rirjrkrrrr]os

zsocket._check_sendfile_paramscCs2y|j|||�Stk
r,|j|||�SXdS)a_sendfile(file[, offset[, count]]) -> sent

        Send a file until EOF is reached by using high-performance
        os.sendfile() and return the total number of bytes which
        were sent.
        *file* must be a regular file object opened in binary mode.
        If os.sendfile() is not available (e.g. Windows) or file is
        not a regular file socket.send() will be used instead.
        *offset* tells from where to start reading the file.
        If specified, *count* is the total number of bytes to transmit
        as opposed to sending the file until EOF is reached.
        File position is updated on return or also in case of error in
        which case file.tell() can be used to figure out the number of
        bytes which were sent.
        The socket must be of SOCK_STREAM type.
        Non-blocking sockets are not supported.
        N)rprrw)r$rirjrkrrrrZ|szsocket.sendfilecCs*|jdkr|jd8_|jr&|j�dS)NrrI)r r!r*)r$rrr�_decref_socketios�s
zsocket._decref_socketioscCs|j|�dS)N)r*)r$Z_ssrrr�_real_close�szsocket._real_closecCsd|_|jdkr|j�dS)NTr)r!r r})r$rrrr*�s
zsocket.closecsd|_t�j�S)adetach() -> file descriptor

        Close the socket object without closing the underlying file descriptor.
        The object cannot be used after this call, but the file descriptor
        can be reused for other purposes.  The file descriptor is returned.
        T)r!�super�detach)r$)r0rrr�sz
socket.detachcstt�jt�S)z@Read-only access to the address family for this socket.
        )rr~r%r
)r$)r0rrr%�sz
socket.familycstt�jt�S)z-Read-only access to the socket type.
        )rr~r&r)r$)r0rrr&�szsocket.type�ntcCstj|j��S)N)r`Zget_handle_inheritabler()r$rrr�get_inheritable�szsocket.get_inheritablecCstj|j�|�dS)N)r`Zset_handle_inheritabler()r$�inheritablerrr�set_inheritable�szsocket.set_inheritablecCstj|j��S)N)r`r�r()r$rrrr��scCstj|j�|�dS)N)r`r�r()r$r�rrrr��sz&Get the inheritable flag of the socketz&Set the inheritable flag of the socket)rCN)rN)rN)rN)rN)"rrr�__doc__�	__slots__�AF_INETrxr#r)r,r6r8r9rBrYrdr`rprwr]rZr|r"rr}r*r�propertyr%r&�namer�r��
__classcell__rr)r0rr�s<
	)
A

$


rcCst|�}t||||�S)z� fromfd(fd, family, type[, proto]) -> socket object

    Create a socket object from a duplicate of the given file
    descriptor.  The remaining arguments are the same as for socket().
    )r9r)r<r%r&r'Znfdrrrr
�sZsharecCstddd|�S)z� fromshare(info) -> socket object

        Create a socket object from the bytes object returned by
        socket.share(pid).
        r)r)�inforrr�	fromshare�sr��
socketpairc
Csh|dkr*yt}Wntk
r(t}YnXtj|||�\}}t||||j��}t||||j��}||fS)aasocketpair([family[, type[, proto]]]) -> (socket object, socket object)

        Create a pair of socket objects from the sockets returned by the platform
        socketpair() function.
        The arguments are the same as for socket() except the default family is
        AF_UNIX if defined on the platform; otherwise, the default is AF_INET.
        N)ZAF_UNIX�	NameErrorr�r"r�rr)r%r&r'�arHrrrr��s
c
Cs|tkrt}n|tkrt}ntd��|tkr4td��|dkrDtd��t|||�}z�|j|df�|j�|j	�dd�\}}t|||�}yP|j
d�y|j||f�Wntt
fk
r�YnX|j
d�|j�\}}	Wn|j��YnXWd|j�X||fS)Nz?Only AF_INET and AF_INET6 socket address families are supportedz)Only SOCK_STREAM socket type is supportedrzOnly protocol zero is supported�FT)r��
_LOCALHOSTZAF_INET6�
_LOCALHOST_V6rrxr�bindZlistenr1r@�connectrh�InterruptedErrorrBr*)
r%r&r'�hostZlsockrA�portZcsockZssock�_rrrr��s8


a8socketpair([family[, type[, proto]]]) -> (socket object, socket object)
Create a pair of socket objects from the sockets returned by the platform
socketpair() function.
The arguments are the same as for socket() except the default family is AF_UNIX
if defined on the platform; otherwise, the default is AF_INET.
cspeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Z�fdd
�Z	dd�Z
edd��Zedd��Z
dd�Z�ZS)rMz�Raw I/O implementation for stream sockets.

    This class supports the makefile() method on sockets.  It provides
    the raw I/O interface on top of a socket object.
    cCsZ|d
krtd|��tjj|�||_d|kr6|d7}||_d|k|_d|k|_d	|_dS)NrCrG�rw�rb�wb�rwbzinvalid mode: %rrHF)rCrGr�r�r�r�)	rrN�	RawIOBaser#�_sock�_mode�_reading�_writing�_timeout_occurred)r$r=rTrrrr#0s

zSocketIO.__init__cCs�|j�|j�|jrtd��xby|jj|�Stk
rHd|_�Yq tk
r|}z|jdt	krjdS�WYdd}~Xq Xq WdS)a3Read up to len(b) bytes into the writable buffer *b* and return
        the number of bytes read.  If the socket is non-blocking and no bytes
        are available, None is returned.

        If *b* is non-empty, a 0 return value indicates that the connection
        was shutdown at the other end.
        z!cannot read from timed out objectTrN)
�_checkClosed�_checkReadabler�rcr�Z	recv_intorgr3r+�_blocking_errnos)r$rH�errr�readinto<szSocketIO.readintocCsX|j�|j�y|jj|�Stk
rR}z|jdtkr@dS�WYdd}~XnXdS)aWrite the given bytes or bytearray object *b* to the socket
        and return the number of bytes written.  This can be less than
        len(b) if not all data could be written.  If the socket is
        non-blocking and no bytes could be written None is returned.
        rN)r��_checkWritabler�rsr3r+r�)r$rHr�rrr�writeSszSocketIO.writecCs|jrtd��|jS)z2True if the SocketIO is open for reading.
        zI/O operation on closed socket.)r4rr�)r$rrr�readablecszSocketIO.readablecCs|jrtd��|jS)z2True if the SocketIO is open for writing.
        zI/O operation on closed socket.)r4rr�)r$rrr�writablejszSocketIO.writablecs|jrtd��t�j�S)z2True if the SocketIO is open for seeking.
        zI/O operation on closed socket.)r4rr~�seekable)r$)r0rrr�qszSocketIO.seekablecCs|j�|jj�S)z=Return the file descriptor of the underlying socket.
        )r�r�r()r$rrrr(xszSocketIO.filenocCs|js|j�SdSdS)NrIrJ)r4r()r$rrrr�~sz
SocketIO.namecCs|jS)N)r�)r$rrrrT�sz
SocketIO.modecCs*|jr
dStjj|�|jj�d|_dS)z�Close the SocketIO object.  This doesn't close the underlying
        socket, except if all references to it have disappeared.
        N)r4rNr�r*r�r|)r$rrrr*�s

zSocketIO.close)rrrr�r#r�r�r�r�r�r(r�r�rTr*r�rr)r0rrMsrMr-cCsp|j�}|s|dkrt�}yt|�\}}}Wntk
rBYn*X|jd|�x|D]}d|krVPqVW|}|S)aGet fully qualified domain name from name.

    An empty argument is interpreted as meaning the local host.

    First the hostname returned by gethostbyaddr() is checked, then
    possibly existing aliases. In case no FQDN is available, hostname
    from gethostname() is returned.
    z0.0.0.0r�.)�stripZgethostnameZ
gethostbyaddrr3�insert)r�Zhostname�aliasesZipaddrsrrrr�s	
cCs�|\}}d}x�t||dt�D]�}|\}}}	}
}d}y>t|||	�}|tk	rR|j|�|r`|j|�|j|�d}|Stk
r�}
z|
}|dk	r�|j�WYdd}
~
XqXqW|dk	r�|�ntd��dS)acConnect to *address* and return the socket object.

    Convenience function.  Connect to *address* (a 2-tuple ``(host,
    port)``) and return the socket object.  Passing the optional
    *timeout* parameter will set the timeout on the socket instance
    before attempting to connect.  If no *timeout* is supplied, the
    global default timeout setting returned by :func:`getdefaulttimeout`
    is used.  If *source_address* is set it must be a tuple of (host, port)
    for the socket to bind as a source address before making the connection.
    A host of '' or port 0 tells the OS to use the default.
    Nrz!getaddrinfo returns an empty list)	�getaddrinforxr�_GLOBAL_DEFAULT_TIMEOUTr:r�r�r3r*)ZaddressrgZsource_addressr�r�rl�res�af�socktyper'�	canonname�sar=r�rrrr�s*


cCsTg}xJtj||||||�D]2}|\}}	}}
}|jt|t�t|	t�||
|f�qW|S)a�Resolve host and port into list of address info entries.

    Translate the host/port argument into a sequence of 5-tuples that contain
    all the necessary arguments for creating a socket connected to that service.
    host is a domain name, a string representation of an IPv4/v6 address or
    None. port is a string service name such as 'http', a numeric port number or
    None. By passing None as the value of host and port, you can pass NULL to
    the underlying C API.

    The family, type and proto arguments can be optionally specified in order to
    narrow the list of addresses returned. Passing zero as a value for each of
    these arguments selects the full range of results.
    )r"r��appendrr
r)r�r�r%r&r'�flagsZaddrlistr�r�r�r�r�rrrr��sr�)r)r-)rrrr).r�r"r`�sysrNre�enumrr�errno�ImportErrorr/rrr	�__all__�extend�_get_exports_list�_convertrr�r�rrZ_realsocket�platform�lowerrrr��	Exceptionrr
rdr�rxr�r�r�r�rMr�objectr�rr�rrrr�<module>/s� 






C
	
$
u
'cgitb.cpython-36.opt-1.pyc000064400000023542150335715140011233 0ustar003


 \�.�@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
dd�ZgZdd�Z
dd�Zd	d
�Zdd�Zd
d�Zddd�Zddd�ZGdd�d�Ze�jZddd�ZdS)a�More comprehensive traceback formatting for Python scripts.

To enable this module, do:

    import cgitb; cgitb.enable()

at the top of your script.  The optional arguments to enable() are:

    display     - if true, tracebacks are displayed in the web browser
    logdir      - if set, tracebacks are written to files in this directory
    context     - number of lines of source code to show for each stack frame
    format      - 'text' or 'html' controls the output format

By default, tracebacks are displayed but not saved, the context is 5 lines
and the output format is 'html' (for backwards compatibility with the
original use of this module)

Alternatively, if you have caught an exception and want cgitb to display it
for you, call cgitb.handler().  The optional argument to handler() is a
3-item tuple (etype, evalue, etb) just like the value of sys.exc_info().
The default handler displays output as HTML.

�NcCsdS)zAReturn a string that resets the CGI and browser to a known state.a'<!--: spam
Content-Type: text/html

<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> -->
<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> -->
</font> </font> </font> </script> </object> </blockquote> </pre>
</table> </table> </table> </table> </table> </font> </font> </font>�rrr�/usr/lib64/python3.6/cgitb.py�reset#srcCs|rd|dSdSdS)Nz<small>z</small>�r)�textrrr�small.srcCs|rd|dSdSdS)Nz<strong>z	</strong>rr)rrrr�strong4srcCs|rd|dSdSdS)Nz<font color="#909090">z</font>rr)rrrr�grey:sr	cCs�||krd||fS||jkr,d|j|fSd|jkr~|jd}t|�ti�krf||kr~d||fSnt||�r~dt||�fSdtfS)z9Find the value for a given name in the given environment.�local�global�__builtins__�builtinN)�	f_globals�type�hasattr�getattr�	__UNDEF__)�name�frame�locals�builtinsrrr�lookup@s



rcCs�gdddtf\}}}}}x�tj|�D]�\}}	}
}}|tjkr>P|tjkr�|	tjkr�|dkr�|tk	r�t||	t�}|j||	||f�q�t	|	||�\}
}|j|	|
|f�n"|	dkr�||d7}|}nd\}}|	}q$W|S)zEScan one logical line of Python and look up values of variables used.Nr�.)Nr)
r�tokenize�generate_tokens�NEWLINE�NAME�keyword�kwlistr�appendr)�readerrr�varsZ	lasttoken�parent�prefix�valueZttype�token�start�end�line�whererrr�scanvarsPs"
r*�c"	s�|\}}}t|t�r|j}dtjj�ddtj}tjtj��}dt	j
jdtt	j
j
t|���dd|d|�d	}d
tdd�d
}g}	tj||�}
�xJ|
D�]@\}�}}
}}�r�tjj���d�t	j
j
��f}nd�}tj|�\}}}}d}|
dk�r2dtt	j
j
|
��tj||||dd�d�}i�|gf��fdd�	}t|||�}dd||fg}|dk	�r||}x�|D]�}tddtt|��t|��d}|�k�r�d|t	j
j|�f}|jd|�n&d|t	j
j|�f}|jdt|��|d7}�q~Wig}}x�|D]�\}}} ||k�r0�qd||<| tk	�r�|d-k�r^d!|t|�}n*|d"k�rrt|�}n|t|jd#�d.�}|jd$|t	j
j| �f�n|j|d%��qW|jdttd&j|����|	jd'd(j|��q�Wd)tt	j
j
t|���t	j
j
t|��fg}!xNt|�D]B}|dd�d*k�r:�q t	j
jt ||��} |!jd+||| f��q W|dj|	�dj|!�d,t	j
j
djt!j"|||���S)/z9Return a nice HTML document describing a given traceback.zPython rz: z<body bgcolor="#f0f0f8">z<big><big>%s</big></big>z#ffffffz#6622aaz<br>z�
<p>A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.</p>z<tt>z&nbsp;r+z&nbsp;</tt>z<a href="file://%s">%s</a>�?rzin cSsdtjj|�S)N�=)�pydoc�html�repr)r$rrr�<lambda>�szhtml.<locals>.<lambda>)�formatvaluec
s4d�|d<ztj�|d�S|dd7<XdS)N�r)�	linecache�getline)�lnum)�file�	highlightrrr �szhtml.<locals>.readerz+<tr><td bgcolor="#d8bbff">%s%s %s</td></tr>z<big>&nbsp;</big>Nz<tt>=&gt;%s%s</tt>z&<tr><td bgcolor="#ffccee">%s</td></tr>z<tt>&nbsp;&nbsp;%s%s</tt>z<tr><td>%s</td></tr>r3rr
z<em>%s</em> r
rz%s&nbsp;= %sz <em>undefined</em>z, zF
<table width="100%%" cellspacing=0 cellpadding=0 border=0>
%s</table>�
z	<p>%s: %s�_z
<br>%s%s&nbsp;=
%sz�


<!-- The above is a description of an error in a Python program, formatted
     for a Web browser because the 'cgitb' module was enabled.  In case you
     are not reading this in a Web browser, here is the original traceback:

%s
-->
)rr
���)#�
isinstancer�__name__�sys�version�split�
executable�time�ctimer.r/Zheadingr�escape�strr�inspect�getinnerframes�os�path�abspath�getargvalues�formatargvaluesr*�lenZ	preformatrr	rr0�join�dirr�	traceback�format_exception)"�einfo�context�etype�evalue�etb�pyver�date�head�indent�frames�recordsrr6�func�lines�index�link�args�varargs�varkwr�callr r!�rows�ir(�num�done�dumprr)r$�	exceptionr)r7r8rr/es|

0


$






	r/c 	s�|\}}}t|t�r|j}dtjj�ddtj}tjtj��}dt	|�||fd}g}t
j||�}	�x�|	D�]�\}
�}}}
}�r�tj
j��p�d�t
j|
�\}}}}d}|dkr�d|t
j||||d	d
�d�}i�|gf��fdd
�	}t||
|�}d�|fg}|dk	�rL||}x0|
D](}d|}|j||j��|d7}�q Wig}}x�|D]�\}}}||k�rt�q\d||<|tk	�r�|dk�r�d|}n|dk�r�||jd�d}|jd|tjj|�f�n|j|d��q\W|jdj|��|jddj|��qrWdt	|�t	|�fg}x8t|�D],}tjjt||��}|jdd ||f��q.W|dj|�dj|�ddjtj|||��S)!z:Return a plain text document describing a given traceback.zPython rz: z	%s
%s
%s
z�
A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.
r,rzin cSsdtjj|�S)Nr-)r.rr0)r$rrrr1�sztext.<locals>.<lambda>)r2c
s4d�|d<ztj�|d�S|dd7<XdS)Nr3r)r4r5)r6)r7r8rrr �sztext.<locals>.readerz %s %sNz%5d r3rzglobal r
rz%s = %sz
 undefinedr9z
%s
z%s: %sz

%s%s = %s� �zc

The above is a description of an error in a Python program.  Here is
the original traceback:

%s
r;z    )r<rr=r>r?r@rArBrCrErFrGrHrIrJrKrLr*r�rstriprr.rr0rNrOrrPrQ) rRrSrTrUrVrWrXrYr[r\rr6r]r^r_rarbrcrrdr r!rerfr(rgrhrirr)r$rjr)r7r8rr�s^









rc@s,eZdZdZddd�Zdd	�Zd
d
d�ZdS)�Hookz?A hook to replace sys.excepthook that shows tracebacks in HTML.r3Nr+r/cCs(||_||_||_|ptj|_||_dS)N)�display�logdirrSr>�stdoutr7�format)�selfrorprSr7rrrrr�__init__s
z
Hook.__init__cCs|j|||f�dS)N)�handle)rsrTrUrVrrr�__call__sz
Hook.__call__c
Csz|p
tj�}|jdkr$|jjt��|jdkr2tp4t}d}y|||j�}Wn dj	t
j|��}d}YnX|jr�|r�t
jj|�}|jjd|d�q�|jj|d�n|jjd�|jdk	�rZd	d
g|jdk}tj||jd�\}}y.tj|d��}|j|�WdQRXd
|}	Wnd|}	YnX|jdk�rJ|jjd|	�n|jj|	d�y|jj�WnYnXdS)Nr/FrTz<pre>z</pre>
r9z*<p>A problem occurred in a Python script.
z.txtz.html)�suffixrO�wz*%s contains the description of this error.z*Tried to save traceback to %s, but failed.z
<p>%s</p>
)r>�exc_inforrr7�writerr/rrSrNrPrQror.rDrp�tempfileZmkstemprH�fdopen�flush)
rs�infoZ	formatterZplain�docrw�fdrIr7�msgrrrrus@

zHook.handle)r3Nr+Nr/)N)r=�
__module__�__qualname__�__doc__rtrvrurrrrrns

rnr3cCst||||d�t_dS)aInstall an exception handler that formats tracebacks as HTML.

    The optional argument 'display' can be set to 0 to suppress sending the
    traceback to the browser, and 'logdir' can be set to a directory to cause
    tracebacks to be written to files there.)rorprSrrN)rnr>�
excepthook)rorprSrrrrr�enable8sr�)r+)r+)r3Nr+r/)r�rFrr4rHr.r>r{rBrrPrrrrr	rr*r/rrnruZhandlerr�rrrr�<module>s,

Z
A7_sysconfigdata_m_linux_x86_64-linux-gnu.cpython-36.pyc000064400000056616150335715140016706 0ustar003

�]dh�v��@sdddddddddddd	d
dddd
dddddddddddddddddddddddd dd!d"d#d$d%dddd&d'd
d(d)d*d&d+dd!dddd,d-ddddddd.d&d&d&d&dd&dd&d&d&d&d&dddddddddd&dd&d&d&d&d&d&d&d&dd&d&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&ddd&d&dd&dddd&d&d&ddd&d&dddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&d&d&d&d&d&ddd&d&dd&d&ddd&d&d&d&d&d&d&dddddd&dd&d&ddddddd&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd/ddd0d1d0d0d2d3d4d
d5d6dd7dd
d8ddd9dd:d;dd<d=d>d
d
d?d@dAdBdd+ddCdDdddEddddddd&dFdGdHddIdJd
dKdLd&dMd
dNdddddddd
dOdPdQd
dRdSdd
ddTd&dUddddVddddWdXd
d
ddYd&dZd[dd\d6d]d^dd&dd&dd_d`dadbdcd9ddddd?dedddfdgdhdgdfdhdfdfdgdfd^dfdfdfdfdgd&didjdkd&dldmddnd:d&d&dddddoddpdqdrdd&dd
ddsd&d&dtdudd&d&d&dddd&d&d&ddvdwdudxdydydudz���Zd{S)|�m��ar�rcsz!-Wno-unused-result -Wsign-comparez-IObjects -IInclude -IPython�z/usr/binz/usr/lib64/python3.6z-L. -lpython3.6mzOgcc -pthread -shared -Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g�pythonzx86_64-redhat-linux-gnu�\zgcc -pthreadz-fPICa-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz?configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.ina-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapva=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-typez-Wl,-z,relro  -Wl,-z,now  -gz�-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -ga�'--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-ipv6' '--enable-shared' '--with-computed-gotos=yes' '--with-dbmliborder=gdbm:ndbm:bdb' '--with-system-expat' '--with-system-ffi' '--enable-loadable-sqlite-extensions' '--with-dtrace' '--with-lto' '--with-ssl-default-suites=openssl' '--with-valgrind' '--without-ensurepip' '--enable-optimizations' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS= -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv ' 'LDFLAGS= -Wl,-z,relro  -Wl,-z,now  -g ' 'CPPFLAGS=' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'z/usr/includez/usr/include/python3.6m�:z@/builddir/build/BUILD/Python-3.6.8/build/optimized/coverage.infoz>/builddir/build/BUILD/Python-3.6.8/build/optimized/lcov-reportz2--no-branch-coverage --title "CPython lcov report"zM-IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.6.8/Includezg++ -pthreadzE/usr /usr/lib64 /usr/lib64/python3.6 /usr/lib64/python3.6/lib-dynloadz /usr/lib64/python3.6/lib-dynloadi�zkREADME ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Ext-dummyzInclude Lib Misc Ext-dummyzPREADME ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in�.�z/usr/bin/dtracezInclude/pydtrace_probes.hzPython/pydtrace.ozdynload_shlib.o�noz .cpython-36m-x86_64-linux-gnu.soi��yeszI/usr/include /usr/include /usr/include/python3.6m /usr/include/python3.6mz/usr/bin/install -cz/usr/bin/install -c -m 644z/usr/bin/install -c -m 555zlibpython3.6m.so.1.0zModules/_io/_iomodule.hzg++ -pthread -sharedz:-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -gzlibpython3.6m.soz3.6mz
/usr/lib64z-lmzPython/z/usr/lib64/pkgconfigz1/usr/lib64/python3.6/config-3.6m-x86_64-linux-gnuzlibpython3.6m.az-lpthread -ldl  -lutilz0tkinter tkinter/test tkinter/test/test_tkinter \�gccz-Xlinker -export-dynamic�true�ln�linuxz4/builddir/build/BUILD/Python-3.6.8/Modules/makesetupz/usr/share/manz/usr/bin/mkdir -pz�_thread posix errno pwd _sre _codecs _weakref _functools _operator _collections itertools atexit _signal _stat time _locale _io zipimport faulthandler _tracemalloc _symtable xxsubtypea{Modules/_threadmodule.o  Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/zipimport.o  Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  Modules/symtablemodule.o  Modules/xxsubtype.ozx86_64-linux-gnuz -DMULTIARCH=\"x86_64-linux-gnu\"z-Wl,--no-as-neededa:-DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz:\ Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.ozParser/pgenz\ \z-fprofile-generatez"-fprofile-use -fprofile-correctionz
-m test --pgoz
libpython3.sozno-frameworkz./python -Ez	python3.6a�-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -O3 -fprofile-use -fprofile-correctiona�-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -O3 -fprofile-use -fprofile-correction -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.6.8/Include -fPIC -DPy_BUILD_COREaT-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g -lcryptoz"z"a-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g�z)-x test_subprocess test_io test_lib2to3 \�readelfzMac/Resources/framework�voidzBLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/optimizedz/bin/shz.so���zcpython-36m-x86_64-linux-gnuz&Parser Objects Python Modules Programsz9/builddir/build/BUILD/Python-3.6.8/Tools/gdb/libpython.pyz"/* Don't use ncurses extensions */z-szInclude Lib MisczKLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/optimized ./pythonz�LD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/optimized ./python /builddir/build/BUILD/Python-3.6.8/Tools/scripts/run_tests.pyi�zPython/thread.ozIpython3.6 /builddir/build/BUILD/Python-3.6.8/Tools/scripts/update_file.pyz3.6z"/builddir/build/BUILD/Python-3.6.8z)xml xml/dom xml/etree xml/parsers xml/saxz2/builddir/build/BUILD/Python-3.6.8/build/optimizedz
/usr/sharez/usr(��ABIFLAGS�AC_APPLE_UNIVERSAL_BUILD�AIX_GENUINE_CPLUSPLUS�ANDROID_API_LEVEL�AR�ARFLAGS�
BASECFLAGS�BASECPPFLAGS�BASEMODLIBS�BINDIR�
BINLIBDEST�
BLDLIBRARY�	BLDSHARED�BUILDEXE�BUILDPYTHON�BUILD_GNU_TYPE�BYTESTR_DEPS�CC�CCSHARED�CFLAGS�CFLAGSFORSHARED�CFLAGS_ALIASING�CONFIGFILES�CONFIGURE_CFLAGS�CONFIGURE_CFLAGS_NODIST�CONFIGURE_CPPFLAGS�CONFIGURE_LDFLAGS�CONFIGURE_LDFLAGS_NODIST�CONFIG_ARGS�CONFINCLUDEDIR�
CONFINCLUDEPY�COREPYTHONPATH�
COVERAGE_INFO�COVERAGE_REPORT�COVERAGE_REPORT_OPTIONS�CPPFLAGS�CXX�DESTDIRS�DESTLIB�DESTPATH�
DESTSHARED�DFLAGS�DIRMODE�DIST�DISTDIRS�	DISTFILES�	DLINCLDIR�
DLLLIBRARY�"DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754�DOUBLE_IS_BIG_ENDIAN_IEEE754�DOUBLE_IS_LITTLE_ENDIAN_IEEE754�DTRACE�DTRACE_DEPS�DTRACE_HEADERS�DTRACE_OBJS�DYNLOADFILE�ENABLE_IPV6�	ENSUREPIP�EXE�EXEMODE�EXTRAMACHDEPPATH�
EXTRATESTOPTS�EXTRA_CFLAGS�
EXT_SUFFIX�FILEMODE�FLOCK_NEEDS_LIBBSD�GETPGRP_HAVE_ARG�GETTIMEOFDAY_NO_TZ�	GITBRANCH�GITTAG�
GITVERSION�GNULD�HAVE_ACCEPT4�
HAVE_ACOSH�
HAVE_ADDRINFO�
HAVE_ALARM�HAVE_ALIGNED_REQUIRED�
HAVE_ALLOCA_H�HAVE_ALTZONE�
HAVE_ASINH�HAVE_ASM_TYPES_H�
HAVE_ATANH�HAVE_BIND_TEXTDOMAIN_CODESET�HAVE_BLUETOOTH_BLUETOOTH_H�HAVE_BLUETOOTH_H�HAVE_BROKEN_MBSTOWCS�HAVE_BROKEN_NICE�HAVE_BROKEN_PIPE_BUF�HAVE_BROKEN_POLL�HAVE_BROKEN_POSIX_SEMAPHORES�HAVE_BROKEN_PTHREAD_SIGMASK�HAVE_BROKEN_SEM_GETVALUE�HAVE_BROKEN_UNSETENV�HAVE_BUILTIN_ATOMIC�HAVE_CHFLAGS�
HAVE_CHOWN�HAVE_CHROOT�
HAVE_CLOCK�HAVE_CLOCK_GETRES�HAVE_CLOCK_GETTIME�HAVE_CLOCK_SETTIME�HAVE_COMPUTED_GOTOS�HAVE_CONFSTR�HAVE_CONIO_H�
HAVE_COPYSIGN�HAVE_CRYPT_H�HAVE_CTERMID�HAVE_CTERMID_R�HAVE_CURSES_FILTER�
HAVE_CURSES_H�HAVE_CURSES_HAS_KEY�HAVE_CURSES_IMMEDOK�HAVE_CURSES_IS_PAD�HAVE_CURSES_IS_TERM_RESIZED�HAVE_CURSES_RESIZETERM�HAVE_CURSES_RESIZE_TERM�HAVE_CURSES_SYNCOK�HAVE_CURSES_TYPEAHEAD�HAVE_CURSES_USE_ENV�HAVE_CURSES_WCHGAT�HAVE_DECL_ISFINITE�HAVE_DECL_ISINF�HAVE_DECL_ISNAN�HAVE_DECL_RTLD_DEEPBIND�HAVE_DECL_RTLD_GLOBAL�HAVE_DECL_RTLD_LAZY�HAVE_DECL_RTLD_LOCAL�HAVE_DECL_RTLD_NODELETE�HAVE_DECL_RTLD_NOLOAD�HAVE_DECL_RTLD_NOW�HAVE_DECL_TZNAME�HAVE_DEVICE_MACROS�HAVE_DEV_PTC�
HAVE_DEV_PTMX�
HAVE_DIRECT_H�HAVE_DIRENT_D_TYPE�
HAVE_DIRENT_H�
HAVE_DIRFD�HAVE_DLFCN_H�HAVE_DLOPEN�	HAVE_DUP2�	HAVE_DUP3�HAVE_DYNAMIC_LOADING�
HAVE_ENDIAN_H�
HAVE_EPOLL�HAVE_EPOLL_CREATE1�HAVE_ERF�	HAVE_ERFC�HAVE_ERRNO_H�
HAVE_EXECV�
HAVE_EXPM1�HAVE_FACCESSAT�HAVE_FCHDIR�HAVE_FCHMOD�
HAVE_FCHMODAT�HAVE_FCHOWN�
HAVE_FCHOWNAT�HAVE_FCNTL_H�HAVE_FDATASYNC�HAVE_FDOPENDIR�HAVE_FEXECVE�HAVE_FINITE�
HAVE_FLOCK�	HAVE_FORK�HAVE_FORKPTY�HAVE_FPATHCONF�HAVE_FSEEK64�HAVE_FSEEKO�HAVE_FSTATAT�
HAVE_FSTATVFS�
HAVE_FSYNC�HAVE_FTELL64�HAVE_FTELLO�
HAVE_FTIME�HAVE_FTRUNCATE�
HAVE_FUTIMENS�HAVE_FUTIMES�HAVE_FUTIMESAT�HAVE_GAI_STRERROR�
HAVE_GAMMA�HAVE_GCC_ASM_FOR_MC68881�HAVE_GCC_ASM_FOR_X64�HAVE_GCC_ASM_FOR_X87�HAVE_GCC_UINT128_T�HAVE_GETADDRINFO�HAVE_GETC_UNLOCKED�HAVE_GETENTROPY�HAVE_GETGROUPLIST�HAVE_GETGROUPS�HAVE_GETHOSTBYNAME�HAVE_GETHOSTBYNAME_R�HAVE_GETHOSTBYNAME_R_3_ARG�HAVE_GETHOSTBYNAME_R_5_ARG�HAVE_GETHOSTBYNAME_R_6_ARG�HAVE_GETITIMER�HAVE_GETLOADAVG�
HAVE_GETLOGIN�HAVE_GETNAMEINFO�HAVE_GETPAGESIZE�HAVE_GETPEERNAME�HAVE_GETPGID�HAVE_GETPGRP�HAVE_GETPID�HAVE_GETPRIORITY�
HAVE_GETPWENT�HAVE_GETRANDOM�HAVE_GETRANDOM_SYSCALL�HAVE_GETRESGID�HAVE_GETRESUID�HAVE_GETSID�
HAVE_GETSPENT�
HAVE_GETSPNAM�HAVE_GETTIMEOFDAY�
HAVE_GETWD�HAVE_GLIBC_MEMMOVE_BUG�
HAVE_GRP_H�HAVE_HSTRERROR�HAVE_HTOLE64�
HAVE_HYPOT�
HAVE_IEEEFP_H�HAVE_IF_NAMEINDEX�HAVE_INET_ATON�HAVE_INET_PTON�HAVE_INITGROUPS�HAVE_INTTYPES_H�	HAVE_IO_H�HAVE_IPA_PURE_CONST_BUG�	HAVE_KILL�HAVE_KILLPG�HAVE_KQUEUE�HAVE_LANGINFO_H�HAVE_LARGEFILE_SUPPORT�
HAVE_LCHFLAGS�HAVE_LCHMOD�HAVE_LCHOWN�HAVE_LGAMMA�
HAVE_LIBDL�HAVE_LIBDLD�HAVE_LIBIEEE�HAVE_LIBINTL_H�HAVE_LIBREADLINE�HAVE_LIBRESOLV�HAVE_LIBSENDFILE�HAVE_LIBUTIL_H�	HAVE_LINK�HAVE_LINKAT�HAVE_LINUX_CAN_BCM_H�HAVE_LINUX_CAN_H�HAVE_LINUX_CAN_RAW_FD_FRAMES�HAVE_LINUX_CAN_RAW_H�HAVE_LINUX_NETLINK_H�HAVE_LINUX_RANDOM_H�HAVE_LINUX_TIPC_H�
HAVE_LOCKF�
HAVE_LOG1P�	HAVE_LOG2�HAVE_LONG_DOUBLE�
HAVE_LSTAT�HAVE_LUTIMES�HAVE_MAKEDEV�HAVE_MBRTOWC�HAVE_MEMMOVE�
HAVE_MEMORY_H�HAVE_MEMRCHR�HAVE_MKDIRAT�HAVE_MKFIFO�
HAVE_MKFIFOAT�
HAVE_MKNOD�HAVE_MKNODAT�HAVE_MKTIME�	HAVE_MMAP�HAVE_MREMAP�HAVE_NCURSES_H�HAVE_NDIR_H�HAVE_NETPACKET_PACKET_H�
HAVE_NET_IF_H�	HAVE_NICE�HAVE_OPENAT�HAVE_OPENPTY�
HAVE_PATHCONF�
HAVE_PAUSE�
HAVE_PIPE2�
HAVE_PLOCK�	HAVE_POLL�HAVE_POLL_H�HAVE_POSIX_FADVISE�HAVE_POSIX_FALLOCATE�
HAVE_PREAD�HAVE_PRLIMIT�HAVE_PROCESS_H�HAVE_PROTOTYPES�HAVE_PTHREAD_ATFORK�HAVE_PTHREAD_CONDATTR_SETCLOCK�HAVE_PTHREAD_DESTRUCTOR�HAVE_PTHREAD_H�HAVE_PTHREAD_INIT�HAVE_PTHREAD_KILL�HAVE_PTHREAD_SIGMASK�
HAVE_PTY_H�HAVE_PUTENV�HAVE_PWRITE�
HAVE_READLINK�HAVE_READLINKAT�
HAVE_READV�
HAVE_REALPATH�
HAVE_RENAMEAT�HAVE_RL_APPEND_HISTORY�HAVE_RL_CALLBACK�HAVE_RL_CATCH_SIGNAL�#HAVE_RL_COMPLETION_APPEND_CHARACTER�'HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK�HAVE_RL_COMPLETION_MATCHES�"HAVE_RL_COMPLETION_SUPPRESS_APPEND�HAVE_RL_PRE_INPUT_HOOK�HAVE_RL_RESIZE_TERMINAL�
HAVE_ROUND�HAVE_SCHED_GET_PRIORITY_MAX�HAVE_SCHED_H�HAVE_SCHED_RR_GET_INTERVAL�HAVE_SCHED_SETAFFINITY�HAVE_SCHED_SETPARAM�HAVE_SCHED_SETSCHEDULER�HAVE_SELECT�HAVE_SEM_GETVALUE�
HAVE_SEM_OPEN�HAVE_SEM_TIMEDWAIT�HAVE_SEM_UNLINK�
HAVE_SENDFILE�HAVE_SETEGID�HAVE_SETEUID�HAVE_SETGID�HAVE_SETGROUPS�HAVE_SETHOSTNAME�HAVE_SETITIMER�HAVE_SETLOCALE�HAVE_SETPGID�HAVE_SETPGRP�HAVE_SETPRIORITY�
HAVE_SETREGID�HAVE_SETRESGID�HAVE_SETRESUID�
HAVE_SETREUID�HAVE_SETSID�HAVE_SETUID�HAVE_SETVBUF�
HAVE_SHADOW_H�HAVE_SIGACTION�HAVE_SIGALTSTACK�HAVE_SIGINTERRUPT�
HAVE_SIGNAL_H�HAVE_SIGPENDING�
HAVE_SIGRELSE�HAVE_SIGTIMEDWAIT�HAVE_SIGWAIT�HAVE_SIGWAITINFO�
HAVE_SNPRINTF�HAVE_SOCKADDR_ALG�HAVE_SOCKADDR_SA_LEN�HAVE_SOCKADDR_STORAGE�HAVE_SOCKETPAIR�HAVE_SPAWN_H�HAVE_SSIZE_T�HAVE_STATVFS�HAVE_STAT_TV_NSEC�HAVE_STAT_TV_NSEC2�HAVE_STDARG_PROTOTYPES�
HAVE_STDINT_H�
HAVE_STDLIB_H�HAVE_STD_ATOMIC�HAVE_STRDUP�
HAVE_STRFTIME�HAVE_STRINGS_H�
HAVE_STRING_H�HAVE_STRLCPY�HAVE_STROPTS_H�HAVE_STRUCT_PASSWD_PW_GECOS�HAVE_STRUCT_PASSWD_PW_PASSWD�HAVE_STRUCT_STAT_ST_BIRTHTIME�HAVE_STRUCT_STAT_ST_BLKSIZE�HAVE_STRUCT_STAT_ST_BLOCKS�HAVE_STRUCT_STAT_ST_FLAGS�HAVE_STRUCT_STAT_ST_GEN�HAVE_STRUCT_STAT_ST_RDEV�HAVE_STRUCT_TM_TM_ZONE�HAVE_SYMLINK�HAVE_SYMLINKAT�	HAVE_SYNC�HAVE_SYSCONF�HAVE_SYSEXITS_H�HAVE_SYS_AUDIOIO_H�HAVE_SYS_BSDTTY_H�HAVE_SYS_DEVPOLL_H�HAVE_SYS_DIR_H�HAVE_SYS_ENDIAN_H�HAVE_SYS_EPOLL_H�HAVE_SYS_EVENT_H�HAVE_SYS_FILE_H�HAVE_SYS_IOCTL_H�HAVE_SYS_KERN_CONTROL_H�HAVE_SYS_LOADAVG_H�HAVE_SYS_LOCK_H�HAVE_SYS_MKDEV_H�HAVE_SYS_MODEM_H�HAVE_SYS_NDIR_H�HAVE_SYS_PARAM_H�HAVE_SYS_POLL_H�HAVE_SYS_RANDOM_H�HAVE_SYS_RESOURCE_H�HAVE_SYS_SELECT_H�HAVE_SYS_SENDFILE_H�HAVE_SYS_SOCKET_H�HAVE_SYS_STATVFS_H�HAVE_SYS_STAT_H�HAVE_SYS_SYSCALL_H�HAVE_SYS_SYSMACROS_H�HAVE_SYS_SYS_DOMAIN_H�HAVE_SYS_TERMIO_H�HAVE_SYS_TIMES_H�HAVE_SYS_TIME_H�HAVE_SYS_TYPES_H�HAVE_SYS_UIO_H�
HAVE_SYS_UN_H�HAVE_SYS_UTSNAME_H�HAVE_SYS_WAIT_H�HAVE_SYS_XATTR_H�HAVE_TCGETPGRP�HAVE_TCSETPGRP�HAVE_TEMPNAM�HAVE_TERMIOS_H�HAVE_TERM_H�HAVE_TGAMMA�HAVE_TIMEGM�
HAVE_TIMES�HAVE_TMPFILE�HAVE_TMPNAM�
HAVE_TMPNAM_R�HAVE_TM_ZONE�
HAVE_TRUNCATE�HAVE_TZNAME�
HAVE_UCS4_TCL�
HAVE_UNAME�
HAVE_UNISTD_H�
HAVE_UNLINKAT�
HAVE_UNSETENV�HAVE_USABLE_WCHAR_T�HAVE_UTIL_H�HAVE_UTIMENSAT�HAVE_UTIMES�HAVE_UTIME_H�
HAVE_WAIT3�
HAVE_WAIT4�HAVE_WAITID�HAVE_WAITPID�HAVE_WCHAR_H�HAVE_WCSCOLL�
HAVE_WCSFTIME�HAVE_WCSXFRM�HAVE_WMEMCMP�HAVE_WORKING_TZSET�HAVE_WRITEV�HAVE_ZLIB_COPY�HAVE__GETPTY�
HOST_GNU_TYPE�INCLDIRSTOMAKE�
INCLUDEDIR�	INCLUDEPY�INSTALL�INSTALL_DATA�INSTALL_PROGRAM�INSTALL_SCRIPT�INSTALL_SHARED�
INSTSONAME�IO_H�IO_OBJS�LDCXXSHARED�LDFLAGS�LDLAST�	LDLIBRARY�LDLIBRARYDIR�LDSHARED�	LDVERSION�LIBC�LIBDEST�LIBDIR�LIBFFI_INCLUDEDIR�LIBM�	LIBOBJDIR�LIBOBJS�LIBPC�LIBPL�LIBRARY�LIBRARY_OBJS�LIBRARY_OBJS_OMIT_FROZEN�LIBS�
LIBSUBDIRS�LINKCC�
LINKFORSHARED�LIPO_32BIT_FLAGS�
LLVM_PROF_ERR�LLVM_PROF_FILE�LLVM_PROF_MERGER�LN�LOCALMODLIBS�LOG1P_DROPS_ZERO_SIGN�MACHDEP�MACHDEPPATH�MACHDEP_OBJS�MACHDESTLIB�MACOSX_DEPLOYMENT_TARGET�MAINCC�MAJOR_IN_MKDEV�MAJOR_IN_SYSMACROS�	MAKESETUP�MANDIR�MKDIR_P�MODLIBS�MODNAMES�MODOBJS�MODULE_OBJS�	MULTIARCH�MULTIARCH_CPPFLAGS�MVWDELCH_IS_EXPRESSION�NO_AS_NEEDED�OBJECT_OBJS�OPT�OTHER_LIBTOOL_OPT�PACKAGE_BUGREPORT�PACKAGE_NAME�PACKAGE_STRING�PACKAGE_TARNAME�PACKAGE_URL�PACKAGE_VERSION�PARSER_HEADERS�PARSER_OBJS�PGEN�PGENOBJS�PGOBJS�PGO_PROF_GEN_FLAG�PGO_PROF_USE_FLAG�PLATDIR�POBJS�POSIX_SEMAPHORES_NOT_ENABLED�PROFILE_TASK�PTHREAD_SYSTEM_SCHED_SUPPORTED�
PY3LIBRARY�PYLONG_BITS_IN_DIGIT�PYTHON�PYTHONFRAMEWORK�PYTHONFRAMEWORKDIR�PYTHONFRAMEWORKINSTALLDIR�PYTHONFRAMEWORKPREFIX�
PYTHONPATH�PYTHON_FOR_BUILD�PYTHON_FOR_REGEN�PYTHON_HEADERS�PYTHON_OBJS�	PY_CFLAGS�PY_CFLAGS_NODIST�PY_COERCE_C_LOCALE�PY_CORE_CFLAGS�PY_CORE_LDFLAGS�PY_CPPFLAGS�PY_FORMAT_SIZE_T�
PY_LDFLAGS�PY_LDFLAGS_NODIST�PY_SSL_DEFAULT_CIPHERS�PY_SSL_DEFAULT_CIPHER_STRING�PY_WARN_ON_C_LOCALE�Py_DEBUG�Py_ENABLE_SHARED�Py_HASH_ALGORITHM�
QUICKTESTOPTS�READELF�	RESSRCDIR�
RETSIGTYPE�	RUNSHARED�	SCRIPTDIR�SETPGRP_HAVE_ARG�SGI_ABI�SHELL�SHLIBS�SHLIB_SUFFIX�SIGNED_RIGHT_SHIFT_ZERO_FILLS�SITEPATH�
SIZEOF_DOUBLE�SIZEOF_FLOAT�
SIZEOF_FPOS_T�
SIZEOF_INT�SIZEOF_LONG�SIZEOF_LONG_DOUBLE�SIZEOF_LONG_LONG�SIZEOF_OFF_T�SIZEOF_PID_T�SIZEOF_PTHREAD_T�SIZEOF_SHORT�
SIZEOF_SIZE_T�
SIZEOF_TIME_T�SIZEOF_UINTPTR_T�
SIZEOF_VOID_P�SIZEOF_WCHAR_T�SIZEOF__BOOL�SOABI�SRCDIRS�
SRC_GDB_HOOKS�STDC_HEADERS�STRICT_SYSV_CURSES�	STRIPFLAG�SUBDIRS�
SUBDIRSTOO�SYSLIBS�SYS_SELECT_WITH_SYS_TIME�TANH_PRESERVES_ZERO_SIGN�TCLTK_INCLUDES�
TCLTK_LIBS�TESTOPTS�TESTPATH�
TESTPYTHON�TESTPYTHONOPTS�
TESTRUNNER�TESTTIMEOUT�	THREADOBJ�TIMEMODULE_LIB�TIME_WITH_SYS_TIME�TM_IN_SYS_TIME�UNICODE_DEPS�UNIVERSALSDK�UPDATE_FILE�USE_COMPUTED_GOTOS�
USE_INLINE�VERSION�VPATH�WANT_SIGFPE_HANDLER�WINDOW_HAS_FLAGS�WITH_DOC_STRINGS�WITH_DTRACE�	WITH_DYLD�WITH_LIBINTL�WITH_NEXT_FRAMEWORK�
WITH_PYMALLOC�WITH_THREAD�
WITH_VALGRIND�X87_DOUBLE_ROUNDING�
XMLLIBSUBDIRS�abs_builddir�
abs_srcdir�datarootdir�exec_prefix�prefix�srcdirN)�build_time_vars�r�r��?/usr/lib64/python3.6/_sysconfigdata_m_linux_x86_64-linux-gnu.py�<module>s*symtable.cpython-36.pyc000064400000024276150335715140011031 0ustar003


 \m�@sNdZddlZddlmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZddlZdddddgZd	d�ZGd
d�d�Ze�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�Zedk�rJddlZddlZeejd��Zej �Z!WdQRXee!ej"j#ejd�dd�Z$x0e$j%�D]$Z&e$j'e&�Z(e)e(e(j*�e(j+���q"WdS)z2Interface to the compiler's internal symbol tables�N)�USE�
DEF_GLOBAL�	DEF_LOCAL�	DEF_PARAM�
DEF_IMPORT�	DEF_BOUND�	DEF_ANNOT�	SCOPE_OFF�
SCOPE_MASK�FREE�LOCAL�GLOBAL_IMPLICIT�GLOBAL_EXPLICIT�CELL�symtable�SymbolTable�Class�Function�SymbolcCstj|||�}t||�S)N)�	_symtabler�_newSymbolTable)�code�filenameZcompile_type�top�r� /usr/lib64/python3.6/symtable.pyrsc@s$eZdZdd�Zdd�Zdd�ZdS)�SymbolTableFactorycCstj�|_dS)N)�weakref�WeakValueDictionary�_SymbolTableFactory__memo)�selfrrr�__init__szSymbolTableFactory.__init__cCs6|jtjkrt||�S|jtjkr,t||�St||�S)N)�typer�
TYPE_FUNCTIONr�
TYPE_CLASSrr)r �tablerrrr�news


zSymbolTableFactory.newcCs8||f}|jj|d�}|dkr4|j||�}|j|<|S)N)r�getr&)r r%r�key�objrrr�__call__s
zSymbolTableFactory.__call__N)�__name__�
__module__�__qualname__r!r&r*rrrrrsrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS) rcCs||_||_i|_dS)N)�_table�	_filename�_symbols)r Z	raw_tablerrrrr!'szSymbolTable.__init__cCsN|jtkrd}nd|jj}|jjdkr6dj||j�Sdj||jj|j�SdS)N�z%s �globalz<{0}SymbolTable for module {1}>z<{0}SymbolTable for {1} in {2}>)�	__class__rr+r.�name�formatr/)r Zkindrrr�__repr__,s
zSymbolTable.__repr__cCsX|jjtjkrdS|jjtjkr$dS|jjtjkr6dS|jjdksTtdj|jj���dS)	N�moduleZfunction�class���zunexpected type: {0})r9r:r;)r.r"rZTYPE_MODULEr#r$�AssertionErrorr5)r rrr�get_type9szSymbolTable.get_typecCs|jjS)N)r.�id)r rrr�get_idCszSymbolTable.get_idcCs|jjS)N)r.r4)r rrr�get_nameFszSymbolTable.get_namecCs|jjS)N)r.�lineno)r rrr�
get_linenoIszSymbolTable.get_linenocCst|jjtjk�S)N)�boolr.r"rr#)r rrr�is_optimizedLszSymbolTable.is_optimizedcCst|jj�S)N)rCr.�nested)r rrr�	is_nestedOszSymbolTable.is_nestedcCst|jj�S)N)rCr.�children)r rrr�has_childrenRszSymbolTable.has_childrencCsdS)z7Return true if the scope uses exec.  Deprecated method.Fr)r rrr�has_execUszSymbolTable.has_execcCs|jjj�S)N)r.�symbols�keys)r rrr�get_identifiersYszSymbolTable.get_identifierscCsD|jj|�}|dkr@|jj|}|j|�}t|||�}|j|<|S)N)r0r'r.rJ�_SymbolTable__check_childrenr)r r4Zsym�flags�
namespacesrrr�lookup\s
zSymbolTable.lookupcs�fdd��j�D�S)Ncsg|]}�j|��qSr)rP)�.0�ident)r rr�
<listcomp>esz+SymbolTable.get_symbols.<locals>.<listcomp>)rL)r r)r r�get_symbolsdszSymbolTable.get_symbolscs��fdd��jjD�S)Ncs"g|]}|j�krt|�j��qSr)r4rr/)rQ�st)r4r rrrShsz0SymbolTable.__check_children.<locals>.<listcomp>)r.rG)r r4r)r4r rZ__check_childrengszSymbolTable.__check_childrencs�fdd��jjD�S)Ncsg|]}t|�j��qSr)rr/)rQrU)r rrrSmsz,SymbolTable.get_children.<locals>.<listcomp>)r.rG)r r)r r�get_childrenls
zSymbolTable.get_childrenN)r+r,r-r!r6r=r?r@rBrDrFrHrIrLrPrTrMrVrrrrr%s

c@sDeZdZdZdZdZdZdd�Zdd�Zdd�Z	dd	�Z
d
d�ZdS)rNcst��fdd��j�D��S)Ncs g|]}��jj|�r|�qSr)r.rJ)rQrR)r �	test_funcrrrSzsz.Function.__idents_matching.<locals>.<listcomp>)�tuplerL)r rWr)r rWrZ__idents_matchingyszFunction.__idents_matchingcCs |jdkr|jdd��|_|jS)NcSs|t@S)N)r)�xrrr�<lambda>sz)Function.get_parameters.<locals>.<lambda>)�_Function__params�_Function__idents_matching)r rrr�get_parameters}s
zFunction.get_parameterscs0|jdkr*ttf��fdd�}|j|�|_|jS)Ncs|t?t@�kS)N)r	r
)rY)�locsrrrZ�sz%Function.get_locals.<locals>.<lambda>)�_Function__localsrrr\)r �testr)r^r�
get_locals�s

zFunction.get_localscs0|jdkr*ttf��fdd�}|j|�|_|jS)Ncs|t?t@�kS)N)r	r
)rY)�globrrrZ�sz&Function.get_globals.<locals>.<lambda>)�_Function__globalsr
rr\)r r`r)rbr�get_globals�s

zFunction.get_globalscCs$|jdkrdd�}|j|�|_|jS)NcSs|t?t@tkS)N)r	r
r)rYrrrrZ�sz$Function.get_frees.<locals>.<lambda>)�_Function__freesr\)r �is_freerrr�	get_frees�s
zFunction.get_frees)r+r,r-r[r_rercr\r]rardrgrrrrrqsc@seZdZdZdd�ZdS)rNcCs:|jdkr4i}x|jjD]}d||j<qWt|�|_|jS)Nr9)�_Class__methodsr.rGr4rX)r �drUrrr�get_methods�s

zClass.get_methods)r+r,r-rhrjrrrrr�sc@s�eZdZd dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)!rNcCs(||_||_|t?t@|_|p f|_dS)N)�
_Symbol__name�_Symbol__flagsr	r
�_Symbol__scope�_Symbol__namespaces)r r4rNrOrrrr!�szSymbol.__init__cCsdj|j�S)Nz<symbol {0!r}>)r5rk)r rrrr6�szSymbol.__repr__cCs|jS)N)rk)r rrrr@�szSymbol.get_namecCst|jtj@�S)N)rCrlrr)r rrr�
is_referenced�szSymbol.is_referencedcCst|jt@�S)N)rCrlr)r rrr�is_parameter�szSymbol.is_parametercCst|jttfk�S)N)rCrmr
r)r rrr�	is_global�szSymbol.is_globalcCst|jtk�S)N)rCrmr)r rrr�is_declared_global�szSymbol.is_declared_globalcCst|jt@�S)N)rCrlr)r rrr�is_local�szSymbol.is_localcCst|jt@�S)N)rCrlr)r rrr�is_annotated�szSymbol.is_annotatedcCst|jtk�S)N)rCrmr)r rrrrf�szSymbol.is_freecCst|jt@�S)N)rCrlr)r rrr�is_imported�szSymbol.is_importedcCst|jt@�S)N)rCrlr)r rrr�is_assigned�szSymbol.is_assignedcCs
t|j�S)a�Returns true if name binding introduces new namespace.

        If the name is used as the target of a function or class
        statement, this will be true.

        Note that a single name can be bound to multiple objects.  If
        is_namespace() is true, the name may also be bound to other
        objects, like an int or list, that does not introduce a new
        namespace.
        )rCrn)r rrr�is_namespace�szSymbol.is_namespacecCs|jS)z.Return a list of namespaces bound to this name)rn)r rrr�get_namespaces�szSymbol.get_namespacescCs t|j�dkrtd��|jdS)z�Returns the single namespace bound to this name.

        Raises ValueError if the name is bound to multiple namespaces.
        r9z$name is bound to multiple namespacesr)�lenrn�
ValueError)r rrr�
get_namespace�szSymbol.get_namespace)N)r+r,r-r!r6r@rorprqrrrsrtrfrurvrwrxr{rrrrr�s

�__main__r9�exec),�__doc__rrrrrrrrr	r
rrr
rrr�__all__rrr�objectrrrrr+�os�sys�open�argv�f�read�src�path�split�modrLrRrP�info�printrsrwrrrr�<module>s&@L&
C

colorsys.cpython-36.opt-2.pyc000064400000005223150335715140012015 0ustar003


 \��@sXddddddgZdZdZdZd
d�Zdd�Zdd�Zd
d�Zdd�Zdd�Z	dd�Z
dS)�
rgb_to_yiq�
yiq_to_rgb�
rgb_to_hls�
hls_to_rgb�
rgb_to_hsv�
hsv_to_rgbg�?g@g@g@cCsRd|d|d|}d||d||}d||d||}|||fS)Ng333333�?g�z�G��?g)\��(�?g�G�z��?gH�z�G�?g���Q��?g=
ףp=�?�)�r�g�b�y�i�qrr� /usr/lib64/python3.6/colorsys.pyr(scCs�|d|d|}|d|d|}|d|d|}|dkrHd}|dkrTd}|dkr`d}|dkrld}|dkrxd}|dkr�d}|||fS)	Ng2r��L�?g����,��?g:�����?g�nєW�?g6�޷���?gJ"�X�?gg�?r)rrr
rr	r
rrrr.s cCs�t|||�}t|||�}||d}||kr6d|dfS|dkrP||||}n||d||}||||}||||}||||}	||kr�|	|}
n"||kr�d||	}
nd||}
|
dd}
|
||fS)Ng@gg�?g@g@g�?)�max�min)rr	r
�maxc�minc�l�s�rc�gc�bc�hrrrrKs$

cCsn|dkr|||fS|dkr(|d|}n||||}d||}t|||t�t|||�t|||t�fS)Ngg�?g�?g@)�_v�	ONE_THIRD)rrr�m2�m1rrrrbs
cCsT|d}|tkr$||||dS|dkr0|S|tkrP|||t|dS|S)Ng�?g@g�?)�	ONE_SIXTH�	TWO_THIRD)rrZhuerrrrlsrcCs�t|||�}t|||�}|}||kr.dd|fS|||}||||}||||}||||}	||kr||	|}
n"||kr�d||	}
nd||}
|
dd}
|
||fS)Ngg@g@g@g�?)rr)rr	r
rr�vrrrrrrrrr|s 

cCs�|dkr|||fSt|d�}|d|}|d|}|d||}|d|d|}|d}|dkrt|||fS|dkr�|||fS|dkr�|||fS|dkr�|||fS|d	kr�|||fS|d
kr�|||fSdS)Ngg@g�?�������)�int)rrrr�f�pr
�trrrr�s(





NgUUUUUU�?gUUUUUU�?gUUUUUU�?)�__all__rrrrrrrrrrrrrr�<module>s	
fnmatch.cpython-36.opt-1.pyc000064400000005474150335715140011567 0ustar003


 \^�@sjdZddlZddlZddlZddlZddddgZdd�Zejdd	d
�dd��Zd
d�Z	dd�Z
dd�ZdS)a�Filename matching with shell patterns.

fnmatch(FILENAME, PATTERN) matches according to the local convention.
fnmatchcase(FILENAME, PATTERN) always takes case in account.

The functions operate by translating the pattern into a regular
expression.  They cache the compiled regular expressions for speed.

The function translate(PATTERN) returns a regular expression
corresponding to PATTERN.  (It does not compile it.)
�N�filter�fnmatch�fnmatchcase�	translatecCs"tjj|�}tjj|�}t||�S)a�Test whether FILENAME matches PATTERN.

    Patterns are Unix shell style:

    *       matches everything
    ?       matches any single character
    [seq]   matches any character in seq
    [!seq]  matches any char not in seq

    An initial period in FILENAME is not special.
    Both FILENAME and PATTERN are first case-normalized
    if the operating system requires it.
    If you don't want this, use fnmatchcase(FILENAME, PATTERN).
    )�os�path�normcaser)�name�pat�r�/usr/lib64/python3.6/fnmatch.pyrs�T)�maxsize�typedcCs<t|t�r(t|d�}t|�}t|d�}nt|�}tj|�jS)Nz
ISO-8859-1)�
isinstance�bytes�strr�re�compile�match)r
Zpat_strZres_str�resrrr�_compile_pattern&s

rcCspg}tjj|�}t|�}tjtkrDxH|D]}||�r(|j|�q(Wn(x&|D]}|tjj|��rJ|j|�qJW|S)z3Return the subset of the list NAMES that match PAT.)rrrr�	posixpath�append)�namesr
�resultrr	rrrr0s


cCst|�}||�dk	S)z�Test whether FILENAME matches PATTERN, including case.

    This is a version of fnmatch() which doesn't case-normalize
    its arguments.
    N)r)r	r
rrrrr@scCsHdt|�}}d}�x*||k�r>||}|d}|dkrB|d}q|dkrT|d}q|dk�r.|}||kr~||d	kr~|d}||kr�||d
kr�|d}x ||kr�||d
kr�|d}q�W||kr�|d}n^|||�jdd
�}|d}|dd	k�r
d|dd�}n|ddk�r d|}d||f}q|tj|�}qWd|S)zfTranslate a shell PATTERN to a regular expression.

    There is no way to quote meta-characters.
    r���*z.*�?�.�[�!�]z\[�\z\\�^Nz%s[%s]z	(?s:%s)\Z)�len�replacer�escape)r
�i�nr�c�jZstuffrrrrJs8



)�__doc__rrr�	functools�__all__r�	lru_cacherrrrrrrr�<module>s

secrets.cpython-36.opt-2.pyc000064400000002122150335715140011603 0ustar003


 \��@s�ddddddddgZdd	lZdd	lZdd	lZdd
lmZddlmZe�Zej	Z
ejZdd�Zd
Z
ddd�Zddd�Zddd�Zd	S)�choice�	randbelow�randbits�SystemRandom�token_bytes�	token_hex�
token_urlsafe�compare_digest�N)r)rcCs|dkrtd��tj|�S)Nr	zUpper bound must be positive.)�
ValueError�_sysrandZ
_randbelow)Zexclusive_upper_bound�r�/usr/lib64/python3.6/secrets.pyrs� cCs|dkrt}tj|�S)N)�DEFAULT_ENTROPY�os�urandom)�nbytesrrr
r#s
cCstjt|��jd�S)N�ascii)�binasciiZhexlifyr�decode)rrrr
r1scCst|�}tj|�jd�jd�S)N�=r)r�base64Zurlsafe_b64encode�rstripr)r�tokrrr
r>s
)N)N)N)�__all__rrrZhmacrZrandomrrZgetrandbitsrrrrrrrrrrr
�<module>	s


asynchat.cpython-36.opt-1.pyc000064400000015241150335715140011752 0ustar003


 \@,�@sDdZddlZddlmZGdd�dej�ZGdd�d�Zdd	�ZdS)
a�A class supporting chat-style (command/response) protocols.

This class adds support for 'chat' style protocols - where one side
sends a 'command', and the other sends a response (examples would be
the common internet protocols - smtp, nntp, ftp, etc..).

The handle_read() method looks at the input stream for the current
'terminator' (usually '\r\n' for single-line responses, '\r\n.\r\n'
for multi-line output), calling self.found_terminator() on its
receipt.

for example:
Say you build an async nntp client using this class.  At the start
of the connection, you'll have self.terminator set to '\r\n', in
order to process the single-line greeting.  Just before issuing a
'LIST' command you'll set it to '\r\n.\r\n'.  The output of the LIST
command will be accumulated (using your own 'collect_incoming_data'
method) up to the terminator, and then control will be returned to
you - by calling your self.found_terminator() method.
�N)�dequec@s�eZdZdZdZdZdZdZd(dd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�ZdS))�
async_chatz�This is an abstract class.  You must derive from this class, and add
    the two methods collect_incoming_data() and found_terminator()irzlatin-1NcCs(d|_g|_t�|_tjj|||�dS)N�)�ac_in_buffer�incomingr�
producer_fifo�asyncore�
dispatcher�__init__)�selfZsock�map�r
� /usr/lib64/python3.6/asynchat.pyr
Cszasync_chat.__init__cCstd��dS)Nzmust be implemented in subclass)�NotImplementedError)r�datar
r
r�collect_incoming_dataQsz async_chat.collect_incoming_datacCs|jj|�dS)N)r�append)rrr
r
r�_collect_incoming_dataTsz!async_chat._collect_incoming_datacCsdj|j�}|jdd�=|S)Nr)�joinr)r�dr
r
r�	_get_dataWszasync_chat._get_datacCstd��dS)Nzmust be implemented in subclass)r)rr
r
r�found_terminator\szasync_chat.found_terminatorcCsBt|t�r|jrt||j�}nt|t�r8|dkr8td��||_dS)zdSet the input delimiter.

        Can be a fixed string of any length, an integer, or None.
        rz-the number of received bytes must be positiveN)�
isinstance�str�use_encoding�bytes�encoding�int�
ValueError�
terminator)rZtermr
r
r�set_terminator_s
zasync_chat.set_terminatorcCs|jS)N)r)rr
r
r�get_terminatorjszasync_chat.get_terminatorcCs�y|j|j�}Wn:tk
r$dStk
rJ}z|j�dSd}~XnXt|t�rh|jrhtt|j	�}|j
||_
�xV|j
�r�t|j
�}|j�}|s�|j
|j
�d|_
qxt|t��r|}||kr�|j
|j
�d|_
|j||_n2|j
|j
d|��|j
|d�|_
d|_|j�qxt|�}|j
j|�}|dk�rp|dk�rR|j
|j
d|��|j
||d�|_
|j�qxt|j
|�}|�r�||k�r�|j
|j
d|��|j
|d�|_
Pqx|j
|j
�d|_
qxWdS)Nrr����)Zrecv�ac_in_buffer_size�BlockingIOError�OSError�handle_errorrrrrrr�lenr!rrrr�find�find_prefix_at_end)rrZwhyZlbr�nZterminator_len�indexr
r
r�handle_readrsR

	



zasync_chat.handle_readcCs|j�dS)N)�
initiate_send)rr
r
r�handle_write�szasync_chat.handle_writecCs|j�dS)N)�close)rr
r
r�handle_close�szasync_chat.handle_closecCs|t|tttf�stdt|���|j}t|�|krdx>tdt|�|�D]}|j	j
||||��qBWn|j	j
|�|j�dS)Nz#data argument must be byte-ish (%r)r)rr�	bytearray�
memoryview�	TypeError�type�ac_out_buffer_sizer(�rangerrr.)rrZsabs�ir
r
r�push�s
zasync_chat.pushcCs|jj|�|j�dS)N)rrr.)rZproducerr
r
r�push_with_producer�szasync_chat.push_with_producercCsdS)z4predicate for inclusion in the readable for select()r"r
)rr
r
r�readable�szasync_chat.readablecCs|jp|jS)z4predicate for inclusion in the writable for select())r�	connected)rr
r
r�writable�szasync_chat.writablecCs|jjd�dS)zAautomatically close this channel once the outgoing queue is emptyN)rr)rr
r
r�close_when_done�szasync_chat.close_when_donecCs�x|jo|j�r|jd}|s<|jd=|dkr<|j�dS|j}y|d|�}Wn8tk
r�|j�}|r||jj|�n|jd=wYnXt|t�r�|j	r�t
||j�}y|j|�}Wnt
k
r�|j�dSX|�r|t|�ks�|t|�k�r||d�|jd<n|jd=dSWdS)Nr)rr<r1r6r4�more�
appendleftrrrrr�sendr&r'r()r�firstZobsrZnum_sentr
r
rr.�s8
zasync_chat.initiate_sendcCs d|_|jdd�=|jj�dS)Nr)rrr�clear)rr
r
r�discard_buffersszasync_chat.discard_buffers)NN)�__name__�
__module__�__qualname__�__doc__r$r6rrr
rrrrr r!r-r/r1r9r:r;r=r>r.rDr
r
r
rr4s,
H(rc@seZdZddd�Zdd�ZdS)�simple_producer�cCs||_||_dS)N)r�buffer_size)rrrKr
r
rr
szsimple_producer.__init__cCsJt|j�|jkr6|jd|j�}|j|jd�|_|S|j}d|_|SdS)Nr)r(rrK)r�resultr
r
rr?szsimple_producer.moreN)rJ)rErFrGr
r?r
r
r
rrIs
rIcCs6t|�d}x$|r0|j|d|��r0|d8}qW|S)Nr")r(�endswith)ZhaystackZneedle�lr
r
rr*/sr*)rHr�collectionsrr	rrIr*r
r
r
r�<module>/s\ trace.cpython-36.opt-1.pyc000064400000046051150335715140011241 0ustar003


 \=p�@s,dZddgZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZyddlZWn"ek
r�ejZdd�ZYnXdd	�Zd
d�ZdZGdd
�d
�Zdd�Zdd�ZGdd�d�Zdd�Zdd�Zddd�Zdd�ZGdd�d�Zdd�Ze dk�r(e�dS) a�program/module to trace Python program or function execution

Sample use, command line:
  trace.py -c -f counts --ignore-dir '$prefix' spam.py eggs
  trace.py -t --ignore-dir '$prefix' spam.py eggs
  trace.py --trackcalls spam.py eggs

Sample use, programmatically
  import sys

  # create a Trace object, telling it what to ignore, and whether to
  # do tracing or line-counting or both.
  tracer = trace.Trace(ignoredirs=[sys.base_prefix, sys.base_exec_prefix,],
                       trace=0, count=1)
  # run the new command using the given tracer
  tracer.run('main()')
  # make a report, placing output in /tmp
  r = tracer.results()
  r.write_results(show_missing=True, coverdir="/tmp")
�Trace�CoverageResults�N)�	monotoniccCstjd�dS)N)�sys�settrace�rr�/usr/lib64/python3.6/trace.py�_unsettraceEsr	cCstj|�tj|�dS)N)�	threadingrr)�funcrrr�	_settraceHs
rcCstjd�tjd�dS)N)rrr
rrrrr	Ls
z#pragma NO COVERc@seZdZddd�Zdd�ZdS)�_IgnoreNcCs:|s
t�nt|�|_|sgndd�|D�|_ddi|_dS)NcSsg|]}tjj|��qSr)�os�path�normpath)�.0�drrr�
<listcomp>Usz$_Ignore.__init__.<locals>.<listcomp>z<string>�)�set�_mods�_dirs�_ignore)�self�modules�dirsrrr�__init__Ss
z_Ignore.__init__cCs�||jkr|j|S||jkr,d|j|<dSx*|jD] }|j|d�r4d|j|<dSq4W|dkrnd|j|<dSx,|jD]"}|j|tj�rvd|j|<dSqvWd|j|<dS)Nr�.r)rr�
startswithrr�sep)r�filename�
modulename�modrrrr�namesYs$







z
_Ignore.names)NN)�__name__�
__module__�__qualname__rr#rrrrr
Rs
r
cCs tjj|�}tjj|�\}}|S)z-Return a plausible module name for the patch.)rr�basename�splitext)r�baser �extrrr�_modname�sr+cCs�tjj|�}d}xJtjD]@}tjj|�}|j|�r|t|�tjkrt|�t|�kr|}qW|rv|t|�dd�}n|}tjj|�\}}|jtjd�}tj	r�|jtj	d�}tjj
|�\}}|jd�S)z,Return a plausible module name for the path.�rNr)rr�normcaserr�lenr�
splitdrive�replace�altsepr(�lstrip)rZcomparepathZlongest�dirr)Zdriver r*rrr�_fullmodname�s r4c@s:eZdZddd�Zdd�Zdd�Zdd
d�Zddd
�ZdS)rNcCs�||_|jdkri|_|jj�|_||_|jdkr8i|_|jj�|_||_|jdkrZi|_|jj�|_||_||_|jr�y@t|jd��}tj	|�\}}}WdQRX|j
|j|||��Wn@tt
tfk
r�}ztd|j|ftjd�WYdd}~XnXdS)N�rbzSkipping counts file %r: %s)�file)�counts�copyZcounter�calledfuncs�callers�infile�outfile�open�pickle�load�update�	__class__�OSError�EOFError�
ValueError�printr�stderr)rr7r9r;r:r<�f�errrrrr�s,


zCoverageResults.__init__cCs|jd�o|jd�S)z_Return True if the filename does not refer to a file
        we want to have reported.
        �<�>)r�endswith)rr rrr�is_ignored_filename�sz#CoverageResults.is_ignored_filenamec	Csz|j}|j}|j}|j}|j}|j}x$|D]}|j|d�||||<q*Wx|D]}d||<qPWx|D]}d||<qfWdS)z.Merge in the data from another CoverageResultsrrN)r7r9r:�get)	r�otherr7r9r:Zother_countsZother_calledfuncsZ
other_callers�keyrrrr@�s


zCoverageResults.updateTFc!Cs�|jrDt�td�|j}x(t|�D]\}}}td|||f�q$W|jr�t�td�d}}	xvt|j�D]h\\}
}}\}
}}|
|kr�t�td|
d�|
}d}	|
|
kr�|	|
kr�td|
�|
}	td||||f�qlWi}x8|jD].\}}|j|i�}||<|j||f||<q�Wi}�x$|j�D�]\}}|j|��r@�q&|jd��rX|d	d�}|d	k�r�t	j
jt	j
j|��}t
|�}n$|}t	j
j|��s�t	j|�t|�}|�r�t|�}ni}tj|�}t	j
j||d�}t|d��}tj|j�\}}Wd	QRX|j|||||�\}}|�r&|�r&td
||�}||||f||<�q&W|�r�|�r�td�x2t|�D]&}||\}}}}td||��q`W|j�r�y&tj|j|j|jft|jd�d
�Wn6tk
�r�} ztd| tj d�WYd	d	} ~ XnXd	S)af
        Write the coverage results.

        :param show_missing: Show lines that had no hits.
        :param summary: Include coverage summary per module.
        :param coverdir: If None, the results of each module are placed in its
                         directory, otherwise it is included in the directory
                         specified.
        zfunctions called:z*filename: %s, modulename: %s, funcname: %szcalling relationships:r,z***z  -->z    %s.%s -> %s.%sz.pycNrz.coverr5�dzlines   cov%   module   (path)z%5d   %3d%%   %s   (%s)�wbz"Can't save counts files because %s)r6���)!r9rE�sortedr:r7rM�itemsrLrKrr�dirname�abspathr+�exists�makedirsr4�_find_executable_linenos�	linecache�getlines�joinr=�tokenize�detect_encoding�readline�write_results_file�intr<r>�dumprBrrF)!rZshow_missing�summary�coverdirZcallsr r!�funcnameZlastfileZ	lastcfileZpfileZpmodZpfunc�cfileZcmodZcfuncZper_file�lineno�	lines_hitZsums�countr3�lnotab�sourceZ	coverpath�fp�encoding�_�n_hits�n_linesZpercent�mrHrrr�
write_results�s|






zCoverageResults.write_resultscCs�yt|d|d�}Wn6tk
rH}ztd||ftjd�dSd}~XnXd}d}	|��x�t|d�D]r\}
}|
|kr�|jd||
�|	d7}	|d7}n.|
|kr�t|kr�|jd	�|d7}n
|jd
�|j|jd��qdWWdQRX|	|fS)
z'Return a coverage results file in path.�w)rmz3trace: Could not open %r for writing: %s - skipping)r6rNrz%5d: z>>>>>> z       �)rr)	r=rBrErrF�	enumerate�write�PRAGMA_NOCOVER�
expandtabs)rr�linesrjrhrmr<rHrprorg�linerrrr`5s(



z"CoverageResults.write_results_file)NNNNN)TFN)N)r$r%r&rrLr@rrr`rrrrr�s

[cCs0i}x&tj|�D]\}}||krd||<qW|S)z:Return dict where keys are lines in the line number table.r)�disZfindlinestarts)�code�strs�linenosrnrgrrr�_find_lines_from_codeUs
rcCs8t||�}x(|jD]}tj|�r|jt||��qW|S)z<Return lineno dict for all code objects reachable from code.)r�	co_consts�inspectZiscoder@�_find_lines)r|r}r~�crrrr�_s


r�c
Cs�i}tj}t||d��r}tj|j�}x^|D]V\}}}}	}
|tjkr||tjkr||\}}|	\}
}xt||
d�D]}d||<qlW|}q*WWdQRX|S)z�Return a dict of possible docstring positions.

    The dict maps line numbers to strings.  There is an entry for
    line that contains only a string or a part of a triple-quoted
    string.
    )rmrN)�token�INDENTr=r]�generate_tokensr_�STRING�range)r rmrZ
prev_ttyperG�tokZttypeZtstr�start�endrzZslineZscolZelineZecol�irrr�
_find_stringsks

r�cCs�y(tj|��}|j�}|j}WdQRXWn6tk
r^}ztd||ftjd�iSd}~XnXt||d�}t	||�}t
||�S)zAReturn dict where keys are line numbers in the line number table.Nz%Not printing coverage data for %r: %s)r6�exec)r]r=�readrmrBrErrF�compiler�r�)r rG�progrmrHr|r}rrrrY�s
rYc	@s�eZdZddddffdddf	dd�Zdd�Zdd	d
�Zdd�Zd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rrrNFc

Cs�||_||_t||�|_i|_i|_d|_||_i|_i|_	i|_
d|_|	rTt�|_|rb|j
|_nZ|rp|j|_nL|r�|r�|j|_|j|_n2|r�|j|_|j|_n|r�|j|_|j|_nd|_dS)ax
        @param count true iff it should count number of times each
                     line is executed
        @param trace true iff it should print out each line that is
                     being counted
        @param countfuncs true iff it should just output a list of
                     (filename, modulename, funcname,) for functions
                     that were called at least once;  This overrides
                     `count' and `trace'
        @param ignoremods a list of the names of modules to ignore
        @param ignoredirs a list of the names of directories to ignore
                     all of the (recursive) contents of
        @param infile file from which to read stored counts to be
                     added into the results
        @param outfile file in which to write the results
        @param timing true iff timing information be displayed
        rNr)r;r<r
�ignorer7Zpathtobasename�	donothing�trace�_calledfuncs�_callers�
_caller_cache�
start_time�_time�globaltrace_trackcallers�globaltrace�globaltrace_countfuncs�globaltrace_lt�localtrace_trace_and_count�
localtrace�localtrace_trace�localtrace_count)
rrir��
countfuncs�countcallers�
ignoremods�
ignoredirsr;r<�timingrrrr�s6




zTrace.__init__cCs ddl}|j}|j|||�dS)Nr)�__main__�__dict__�runctx)r�cmdr��dictrrr�run�sz	Trace.runc
CsL|dkri}|dkri}|js(t|j�zt|||�Wd|jsFt�XdS)N)r�rr�r�r	)rr��globals�localsrrrr��s
zTrace.runctxcOs<d}|jstj|j�z|||�}Wd|js6tjd�X|S)N)r�rrr�)rr�args�kw�resultrrr�runfunc�sz
Trace.runfuncc
Cs�|j}|j}|rt|�}nd}|j}d}||jkrL|j|dk	r�|j|}n�d|j|<dd�tj|�D�}t|�dkr�dd�tj|d�D�}t|�dkr�dd�tj|d�D�}	t|	�dkr�|	dj}||j|<|dk	r�d||f}|||fS)NcSsg|]}tj|�r|�qSr)r�Z
isfunction)rrGrrrr�sz1Trace.file_module_function_of.<locals>.<listcomp>rcSsg|]}t|t�r|�qSr)�
isinstancer�)rrrrrr�srcSsg|]}t|d�r|�qS)�	__bases__)�hasattr)rr�rrrr�sz%s.%s)	�f_code�co_filenamer+�co_namer��gcZ
get_referrersr.r$)
r�framer|r r!reZclsnameZfuncsZdicts�classesrrr�file_module_function_of�s,




zTrace.file_module_function_ofcCs0|dkr,|j|�}|j|j�}d|j||f<dS)zkHandler for call events.

        Adds information about who called who to the self._callers dict.
        �callrN)r��f_backr�)rr��why�arg�	this_funcZparent_funcrrrr�s
zTrace.globaltrace_trackcallerscCs |dkr|j|�}d|j|<dS)zoHandler for call events.

        Adds (filename, modulename, funcname) to the self._calledfuncs dict.
        r�rN)r�r�)rr�r�r�r�rrrr�s
zTrace.globaltrace_countfuncscCsj|dkrf|j}|jjdd�}|rbt|�}|dk	rf|jj||�}|sf|jrZtd||jf�|j	SndSdS)z�Handler for call events.

        If the code block being entered is to be ignored, returns `None',
        else returns self.localtrace.
        r��__file__Nz! --- modulename: %s, funcname: %s)
r��	f_globalsrMr+r�r#r�rEr�r�)rr�r�r�r|r r!Z	ignore_itrrrr�szTrace.globaltrace_ltcCs�|dkr~|jj}|j}||f}|jj|d�d|j|<|jrTtdt�|jdd�tj	j
|�}td||tj||�fdd�|j
S)	Nrzrrz%.2f� )r�z
%s(%d): %sr,)r�r��f_linenor7rMr�rEr�rrr'rZ�getliner�)rr�r�r�r rgrO�bnamerrrr�2sz Trace.localtrace_trace_and_countcCsd|dkr^|jj}|j}|jr4tdt�|jdd�tjj|�}td||t	j
||�fdd�|jS)Nrzz%.2fr�)r�z
%s(%d): %sr,)r�r�r�r�rEr�rrr'rZr�r�)rr�r�r�r rgr�rrrr�AszTrace.localtrace_tracecCs<|dkr6|jj}|j}||f}|jj|d�d|j|<|jS)Nrzrr)r�r�r�r7rMr�)rr�r�r�r rgrOrrrr�NszTrace.localtrace_countcCst|j|j|j|j|jd�S)N)r;r<r9r:)rr7r;r<r�r�)rrrr�resultsVs
z
Trace.results)NN)r$r%r&rr�r�r�r�r�r�r�r�r�r�r�rrrrr�s0
)	
cs�tj�}|jdddd�|jdd�}|jddd	d
d�|jdd
d	dd�|jddd	dd�|jddd	dd�|jd�}|j�}|jddd	dd�|jddd	dd�|jdddd�|jd d!d"d�|jd#d$d	d%d�|jd&d'd	d(d�|jd)d*d	d+d�|jd,d-�}|jd.d/gd0d1�|jd2d/gd3d1�|jd4d5d6d7�|jd8tjd9d7�|j�}|j�r�d:d;jt	j
�f}tjj
t	jf|���tjj
t	jf|�����fd<d=��d>d?�|jD�|_�fd@d?�|jD�|_|j�r|j�s�|jdA�t|j|jdB�}|j|j|j|j�St|j|j|j|jg��s*|jdC�|j�rL|j�sB|j�rL|jdD�|j�rh|j�rh|jdE�|jdk�r~|jdF�|jf|j�t	_ tjj!|j�t	jdG<t"|j|j|j|j|j|j|j|j|j#dH�	}yJt$|j��}t%|j&�|jdI�}WdQRX|jdJdddK�}	|j'||	|	�WnPt(k
�rT}
zt	j)dLt	j dG|
f�WYdd}
~
Xnt*k
�rhYnX|j+�}|j,�s�|j|j|j|j�dS)MNz	--version�versionz	trace 2.0)�actionr�zMain optionsz(One of these (or --report) must be givenz-cz--count�
store_truez�Count the number of times each line is executed and write the counts to <module>.cover for each module executed, in the module's directory. See also --coverdir, --file, --no-report below.)r��helpz-tz--tracez3Print each line to sys.stdout before it is executedz-lz--listfuncsz�Keep track of which functions are executed at least once and write the results to sys.stdout after the program exits. Cannot be specified alongside --trace or --count.z-Tz--trackcallsz^Keep track of caller/called pairs and write the results to sys.stdout after the program exits.Z	Modifiersz-rz--reportz�Generate a report from a counts file; does not execute any code. --file must specify the results file to read, which must have been created in a previous run with --count --file=FILEz-Rz--no-reportz^Do not generate the coverage report files. Useful if you want to accumulate over several runs.z-fz--filez+File to accumulate counts over several runs)r�z-Cz
--coverdirz�Directory where the report files go. The coverage report for <package>.<module> will be written to file <dir>/<package>/<module>.coverz-mz	--missingz?Annotate executable lines that were not executed with ">>>>>> "z-sz	--summaryz\Write a brief summary for each file to sys.stdout. Can only be used with --count or --reportz-gz--timingzQPrefix each line with the time since the program started. Only used while tracingZFilterszCan be specified multiple timesz--ignore-module�appendzqIgnore the given module(s) and its submodules (if it is a package). Accepts comma separated list of module names.)r��defaultr�z--ignore-dirzWIgnore files in the given directory (multiple directories can be joined by os.pathsep).r �?zfile to run as main program)�nargsr��	argumentszarguments to the program�libzpython{0.major}.{0.minor}cs4tjjtjj|��}|jd��jd��}tjj|�S)Nz$prefixz$exec_prefix)rr�
expanduser�
expandvarsr0r)�s)�_exec_prefix�_prefixrr�parse_ignore_dir�szmain.<locals>.parse_ignore_dircSs$g|]}|jd�D]}|j��qqS)�,)�split�strip)rr�r"rrrr�szmain.<locals>.<listcomp>cs&g|]}|jtj�D]}�|��qqSr)r�r�pathsep)rr�r�)r�rrr�sz-r/--report requires -f/--file)r;r<zLmust specify one of --trace, --count, --report, --listfuncs, or --trackcallsz8cannot specify both --listfuncs and (--trace or --count)z3--summary can only be used with --count or --reportz3filename is missing: required with the main optionsr)r�r�r�r�r;r<r�r�r�)r�r$�__package__�
__cached__zCannot run file %r because: %s)-�argparse�ArgumentParser�add_argumentZadd_argument_groupZadd_mutually_exclusive_groupZ	REMAINDER�
parse_argsZ
ignore_dir�formatr�version_inforrr\�base_prefix�base_exec_prefixZ
ignore_moduleZreportr6�errorrrrZmissingrcrd�anyr�riZ	listfuncsZ
trackcallsr r��argvrUrr�r=r�r�r�rB�exit�
SystemExitr�Z	no_report)�parserZgrpZ_grpZoptsZrel_pathr��trlr|ZglobsrHr)r�r�r�r�main\s�


















(r�r�)N)!�__doc__�__all__r�rZr�rerr�r]r�r�r{r>Ztimerr�r
�ImportErrorrrr	rwr
r+r4rrr�r�rYrr�r$rrrr�<module>1sH2/

M
imghdr.cpython-36.opt-2.pyc000064400000007375150335715140011424 0ustar003


 \��@s.ddlmZdgZd$dd�ZgZdd�Zeje�dd�Zeje�d	d
�Zeje�dd�Z	eje	�d
d�Z
eje
�dd�Zeje�dd�Zeje�dd�Z
eje
�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd �Zd!d"�Zed#k�r*e�dS)%�)�PathLike�whatNc
Cs�d}zl|dkrNt|ttf�r2t|d�}|jd�}n|j�}|jd�}|j|�xtD]}|||�}|rT|SqTWWd|r~|j�XdS)N�rb� )	�
isinstance�strr�open�read�tell�seek�tests�close)�file�h�f�locationZtf�res�r�/usr/lib64/python3.6/imghdr.pyrs 





cCs|dd�dkrdSdS)N��
�JFIF�ExifZjpeg)rrr)rrrrr�	test_jpeg%srcCs|jd�rdSdS)Ns�PNG

Zpng)�
startswith)rrrrr�test_png,s
rcCs|dd�dkrdSdS)Nr�GIF87a�GIF89aZgif)rrr)rrrrr�test_gif2srcCs|dd�dkrdSdS)N��MM�IIZtiff)r r!r)rrrrr�	test_tiff9sr"cCs|jd�rdSdS)Ns�Zrgb)r)rrrrr�test_rgb@s
r#cCs<t|�dkr8|dtd�kr8|ddkr8|ddkr8dSdS)	N�r�P�s14rs 	

Zpbm)�len�ord)rrrrr�test_pbmGs(r)cCs<t|�dkr8|dtd�kr8|ddkr8|ddkr8dSdS)	Nr$rr%r&s25rs 	

Zpgm)r'r()rrrrr�test_pgmOs(r*cCs<t|�dkr8|dtd�kr8|ddkr8|ddkr8dSdS)	Nr$rr%r&s36rs 	

Zppm)r'r()rrrrr�test_ppmWs(r+cCs|jd�rdSdS)NsY�j�Zrast)r)rrrrr�	test_rast_s
r,cCs|jd�rdSdS)Ns#define Zxbm)r)rrrrr�test_xbmfs
r-cCs|jd�rdSdS)NsBMZbmp)r)rrrrr�test_bmpms
r.cCs"|jd�r|dd�dkrdSdS)NsRIFF��sWEBPZwebp)r)rrrrr�	test_webpssr1cCs|jd�rdSdS)Nsv/1Zexr)r)rrrrr�test_exrys
r2cCs�ddl}d}|jdd�r8|jddkr8|jdd�=d}y8|jdd�r`t|jdd�|d�ntdg|d�Wn*tk
r�|jjd�|jd�YnXdS)Nrr&z-rr�.z
[Interrupted]
)�sys�argv�testall�KeyboardInterrupt�stderr�write�exit)r4�	recursiverrr�test�sr<cCs�ddl}ddl}x�|D]�}|jj|�rzt|ddd�|s>|rptd�ddl}|j|jj|d��}t||d�q�td�qt|ddd�|jj	�ytt
|��Wqtk
r�td	�YqXqWdS)
Nrz/:� )�endzrecursing down:�*z*** directory (use -r) ***�:z*** not found ***)r4�os�path�isdir�print�glob�joinr6�stdout�flushr�OSError)�listr;Ztoplevelr4rA�filenamerE�namesrrrr6�s"


r6�__main__)N)rAr�__all__rrr�appendrrr"r#r)r*r+r,r-r.r1r2r<r6�__name__rrrr�<module>sB














trace.cpython-36.opt-2.pyc000064400000040156150335715140011242 0ustar003


 \=p�@s(ddgZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
ZyddlZWn"ek
r�ejZdd�ZYnXdd�Zd	d�Zd
ZGdd�d�Zd
d�Zdd�ZGdd�d�Zdd�Zdd�Zddd�Zdd�ZGdd�d�Zdd�Zedk�r$e�dS)�Trace�CoverageResults�N)�	monotoniccCstjd�dS)N)�sys�settrace�rr�/usr/lib64/python3.6/trace.py�_unsettraceEsr	cCstj|�tj|�dS)N)�	threadingrr)�funcrrr�	_settraceHs
rcCstjd�tjd�dS)N)rrr
rrrrr	Ls
z#pragma NO COVERc@seZdZddd�Zdd�ZdS)�_IgnoreNcCs:|s
t�nt|�|_|sgndd�|D�|_ddi|_dS)NcSsg|]}tjj|��qSr)�os�path�normpath)�.0�drrr�
<listcomp>Usz$_Ignore.__init__.<locals>.<listcomp>z<string>�)�set�_mods�_dirs�_ignore)�self�modules�dirsrrr�__init__Ss
z_Ignore.__init__cCs�||jkr|j|S||jkr,d|j|<dSx*|jD] }|j|d�r4d|j|<dSq4W|dkrnd|j|<dSx,|jD]"}|j|tj�rvd|j|<dSqvWd|j|<dS)Nr�.r)rr�
startswithrr�sep)r�filename�
modulename�modrrrr�namesYs$







z
_Ignore.names)NN)�__name__�
__module__�__qualname__rr#rrrrr
Rs
r
cCs tjj|�}tjj|�\}}|S)N)rr�basename�splitext)r�baser �extrrr�_modname�sr+cCs�tjj|�}d}xJtjD]@}tjj|�}|j|�r|t|�tjkrt|�t|�kr|}qW|rv|t|�dd�}n|}tjj|�\}}|jtjd�}tj	r�|jtj	d�}tjj
|�\}}|jd�S)N�rr)rr�normcaserr�lenr�
splitdrive�replace�altsepr(�lstrip)rZcomparepathZlongest�dirr)Zdriver r*rrr�_fullmodname�s r4c@s:eZdZddd�Zdd�Zdd�Zdd
d�Zddd
�ZdS)rNcCs�||_|jdkri|_|jj�|_||_|jdkr8i|_|jj�|_||_|jdkrZi|_|jj�|_||_||_|jr�y@t|jd��}tj	|�\}}}WdQRX|j
|j|||��Wn@tt
tfk
r�}ztd|j|ftjd�WYdd}~XnXdS)N�rbzSkipping counts file %r: %s)�file)�counts�copyZcounter�calledfuncs�callers�infile�outfile�open�pickle�load�update�	__class__�OSError�EOFError�
ValueError�printr�stderr)rr7r9r;r:r<�f�errrrrr�s,


zCoverageResults.__init__cCs|jd�o|jd�S)N�<�>)r�endswith)rr rrr�is_ignored_filename�sz#CoverageResults.is_ignored_filenamec	Csz|j}|j}|j}|j}|j}|j}x$|D]}|j|d�||||<q*Wx|D]}d||<qPWx|D]}d||<qfWdS)Nrr)r7r9r:�get)	r�otherr7r9r:Zother_countsZother_calledfuncsZ
other_callers�keyrrrr@�s


zCoverageResults.updateTFc!Cs�|jrDt�td�|j}x(t|�D]\}}}td|||f�q$W|jr�t�td�d}}	xvt|j�D]h\\}
}}\}
}}|
|kr�t�td|
d�|
}d}	|
|
kr�|	|
kr�td|
�|
}	td||||f�qlWi}x8|jD].\}}|j|i�}||<|j||f||<q�Wi}�x$|j�D�]\}}|j|��r@�q&|jd��rX|dd�}|dk�r�t	j
jt	j
j|��}t
|�}n$|}t	j
j|��s�t	j|�t|�}|�r�t|�}ni}tj|�}t	j
j||d
�}t|d��}tj|j�\}}WdQRX|j|||||�\}}|�r&|�r&td||�}||||f||<�q&W|�r�|�r�td
�x2t|�D]&}||\}}}}td||��q`W|j�r�y&tj|j|j|jft|jd�d	�Wn6tk
�r�} ztd| tj d�WYdd} ~ XnXdS)Nzfunctions called:z*filename: %s, modulename: %s, funcname: %szcalling relationships:r,z***z  -->z    %s.%s -> %s.%sz.pycrz.coverr5�dzlines   cov%   module   (path)z%5d   %3d%%   %s   (%s)�wbz"Can't save counts files because %s)r6���)!r9rE�sortedr:r7rM�itemsrLrKrr�dirname�abspathr+�exists�makedirsr4�_find_executable_linenos�	linecache�getlines�joinr=�tokenize�detect_encoding�readline�write_results_file�intr<r>�dumprBrrF)!rZshow_missing�summary�coverdirZcallsr r!�funcnameZlastfileZ	lastcfileZpfileZpmodZpfunc�cfileZcmodZcfuncZper_file�lineno�	lines_hitZsums�countr3�lnotab�sourceZ	coverpath�fp�encoding�_�n_hits�n_linesZpercent�mrHrrr�
write_results�s|






zCoverageResults.write_resultscCs�yt|d|d�}Wn6tk
rH}ztd||ftjd�dSd}~XnXd}d}	|��x�t|d�D]r\}
}|
|kr�|jd||
�|	d7}	|d7}n.|
|kr�t|kr�|jd�|d7}n
|jd	�|j|jd
��qdWWdQRX|	|fS)N�w)rmz3trace: Could not open %r for writing: %s - skipping)r6rrz%5d: z>>>>>> z       �)rr)	r=rBrErrF�	enumerate�write�PRAGMA_NOCOVER�
expandtabs)rr�linesrjrhrmr<rHrprorg�linerrrr`5s(



z"CoverageResults.write_results_file)NNNNN)TFN)N)r$r%r&rrLr@rrr`rrrrr�s

[cCs0i}x&tj|�D]\}}||krd||<qW|S)Nr)�disZfindlinestarts)�code�strs�linenosrnrgrrr�_find_lines_from_codeUs
rcCs8t||�}x(|jD]}tj|�r|jt||��qW|S)N)r�	co_consts�inspectZiscoder@�_find_lines)r|r}r~�crrrr�_s


r�c
Cs�i}tj}t||d��r}tj|j�}x^|D]V\}}}}	}
|tjkr||tjkr||\}}|	\}
}xt||
d�D]}d||<qlW|}q*WWdQRX|S)N)rmr)�token�INDENTr=r]�generate_tokensr_�STRING�range)r rmrZ
prev_ttyperG�tokZttypeZtstr�start�endrzZslineZscolZelineZecol�irrr�
_find_stringsks

r�cCs�y(tj|��}|j�}|j}WdQRXWn6tk
r^}ztd||ftjd�iSd}~XnXt||d�}t	||�}t
||�S)Nz%Not printing coverage data for %r: %s)r6�exec)r]r=�readrmrBrErrF�compiler�r�)r rG�progrmrHr|r}rrrrY�s
rYc	@s�eZdZddddffdddf	dd�Zdd�Zdd	d
�Zdd�Zd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rrrNFc

Cs�||_||_t||�|_i|_i|_d|_||_i|_i|_	i|_
d|_|	rTt�|_|rb|j
|_nZ|rp|j|_nL|r�|r�|j|_|j|_n2|r�|j|_|j|_n|r�|j|_|j|_nd|_dS)Nrr)r;r<r
�ignorer7Zpathtobasename�	donothing�trace�_calledfuncs�_callers�
_caller_cache�
start_time�_time�globaltrace_trackcallers�globaltrace�globaltrace_countfuncs�globaltrace_lt�localtrace_trace_and_count�
localtrace�localtrace_trace�localtrace_count)
rrir��
countfuncs�countcallers�
ignoremods�
ignoredirsr;r<�timingrrrr�s6




zTrace.__init__cCs ddl}|j}|j|||�dS)Nr)�__main__�__dict__�runctx)r�cmdr��dictrrr�run�sz	Trace.runc
CsL|dkri}|dkri}|js(t|j�zt|||�Wd|jsFt�XdS)N)r�rr�r�r	)rr��globals�localsrrrr��s
zTrace.runctxcOs<d}|jstj|j�z|||�}Wd|js6tjd�X|S)N)r�rrr�)rr�args�kw�resultrrr�runfunc�sz
Trace.runfuncc
Cs�|j}|j}|rt|�}nd}|j}d}||jkrL|j|dk	r�|j|}n�d|j|<dd�tj|�D�}t|�dkr�dd�tj|d�D�}t|�dkr�dd�tj|d�D�}	t|	�dkr�|	dj}||j|<|dk	r�d||f}|||fS)NcSsg|]}tj|�r|�qSr)r�Z
isfunction)rrGrrrr�sz1Trace.file_module_function_of.<locals>.<listcomp>rcSsg|]}t|t�r|�qSr)�
isinstancer�)rrrrrr�srcSsg|]}t|d�r|�qS)�	__bases__)�hasattr)rr�rrrr�sz%s.%s)	�f_code�co_filenamer+�co_namer��gcZ
get_referrersr.r$)
r�framer|r r!reZclsnameZfuncsZdicts�classesrrr�file_module_function_of�s,




zTrace.file_module_function_ofcCs0|dkr,|j|�}|j|j�}d|j||f<dS)N�callr)r��f_backr�)rr��why�arg�	this_funcZparent_funcrrrr�s
zTrace.globaltrace_trackcallerscCs |dkr|j|�}d|j|<dS)Nr�r)r�r�)rr�r�r�r�rrrr�s
zTrace.globaltrace_countfuncscCsj|dkrf|j}|jjdd�}|rbt|�}|dk	rf|jj||�}|sf|jrZtd||jf�|j	SndSdS)Nr��__file__z! --- modulename: %s, funcname: %s)
r��	f_globalsrMr+r�r#r�rEr�r�)rr�r�r�r|r r!Z	ignore_itrrrr�szTrace.globaltrace_ltcCs�|dkr~|jj}|j}||f}|jj|d�d|j|<|jrTtdt�|jdd�tj	j
|�}td||tj||�fdd�|j
S)	Nrzrrz%.2f� )r�z
%s(%d): %sr,)r�r��f_linenor7rMr�rEr�rrr'rZ�getliner�)rr�r�r�r rgrO�bnamerrrr�2sz Trace.localtrace_trace_and_countcCsd|dkr^|jj}|j}|jr4tdt�|jdd�tjj|�}td||t	j
||�fdd�|jS)Nrzz%.2fr�)r�z
%s(%d): %sr,)r�r�r�r�rEr�rrr'rZr�r�)rr�r�r�r rgr�rrrr�AszTrace.localtrace_tracecCs<|dkr6|jj}|j}||f}|jj|d�d|j|<|jS)Nrzrr)r�r�r�r7rMr�)rr�r�r�r rgrOrrrr�NszTrace.localtrace_countcCst|j|j|j|j|jd�S)N)r;r<r9r:)rr7r;r<r�r�)rrrr�resultsVs
z
Trace.results)NN)r$r%r&rr�r�r�r�r�r�r�r�r�r�r�rrrrr�s0
)	
cs�tj�}|jdddd�|jdd�}|jddd	d
d�|jdd
d	dd�|jddd	dd�|jddd	dd�|jd�}|j�}|jddd	dd�|jddd	dd�|jdddd�|jd d!d"d�|jd#d$d	d%d�|jd&d'd	d(d�|jd)d*d	d+d�|jd,d-�}|jd.d/gd0d1�|jd2d/gd3d1�|jd4d5d6d7�|jd8tjd9d7�|j�}|j�r�d:d;jt	j
�f}tjj
t	jf|���tjj
t	jf|�����fd<d=��d>d?�|jD�|_�fd@d?�|jD�|_|j�r|j�s�|jdA�t|j|jdB�}|j|j|j|j�St|j|j|j|jg��s*|jdC�|j�rL|j�sB|j�rL|jdD�|j�rh|j�rh|jdE�|jdk�r~|jdF�|jf|j�t	_ tjj!|j�t	jdG<t"|j|j|j|j|j|j|j|j|j#dH�	}yJt$|j��}t%|j&�|jdI�}WdQRX|jdJdddK�}	|j'||	|	�WnPt(k
�rT}
zt	j)dLt	j dG|
f�WYdd}
~
Xnt*k
�rhYnX|j+�}|j,�s�|j|j|j|j�dS)MNz	--version�versionz	trace 2.0)�actionr�zMain optionsz(One of these (or --report) must be givenz-cz--count�
store_truez�Count the number of times each line is executed and write the counts to <module>.cover for each module executed, in the module's directory. See also --coverdir, --file, --no-report below.)r��helpz-tz--tracez3Print each line to sys.stdout before it is executedz-lz--listfuncsz�Keep track of which functions are executed at least once and write the results to sys.stdout after the program exits. Cannot be specified alongside --trace or --count.z-Tz--trackcallsz^Keep track of caller/called pairs and write the results to sys.stdout after the program exits.Z	Modifiersz-rz--reportz�Generate a report from a counts file; does not execute any code. --file must specify the results file to read, which must have been created in a previous run with --count --file=FILEz-Rz--no-reportz^Do not generate the coverage report files. Useful if you want to accumulate over several runs.z-fz--filez+File to accumulate counts over several runs)r�z-Cz
--coverdirz�Directory where the report files go. The coverage report for <package>.<module> will be written to file <dir>/<package>/<module>.coverz-mz	--missingz?Annotate executable lines that were not executed with ">>>>>> "z-sz	--summaryz\Write a brief summary for each file to sys.stdout. Can only be used with --count or --reportz-gz--timingzQPrefix each line with the time since the program started. Only used while tracingZFilterszCan be specified multiple timesz--ignore-module�appendzqIgnore the given module(s) and its submodules (if it is a package). Accepts comma separated list of module names.)r��defaultr�z--ignore-dirzWIgnore files in the given directory (multiple directories can be joined by os.pathsep).r �?zfile to run as main program)�nargsr��	argumentszarguments to the program�libzpython{0.major}.{0.minor}cs4tjjtjj|��}|jd��jd��}tjj|�S)Nz$prefixz$exec_prefix)rr�
expanduser�
expandvarsr0r)�s)�_exec_prefix�_prefixrr�parse_ignore_dir�szmain.<locals>.parse_ignore_dircSs$g|]}|jd�D]}|j��qqS)�,)�split�strip)rr�r"rrrr�szmain.<locals>.<listcomp>cs&g|]}|jtj�D]}�|��qqSr)r�r�pathsep)rr�r�)r�rrr�sz-r/--report requires -f/--file)r;r<zLmust specify one of --trace, --count, --report, --listfuncs, or --trackcallsz8cannot specify both --listfuncs and (--trace or --count)z3--summary can only be used with --count or --reportz3filename is missing: required with the main optionsr)r�r�r�r�r;r<r�r�r�)r�r$�__package__�
__cached__zCannot run file %r because: %s)-�argparse�ArgumentParser�add_argumentZadd_argument_groupZadd_mutually_exclusive_groupZ	REMAINDER�
parse_argsZ
ignore_dir�formatr�version_inforrr\�base_prefix�base_exec_prefixZ
ignore_moduleZreportr6�errorrrrZmissingrcrd�anyr�riZ	listfuncsZ
trackcallsr r��argvrUrr�r=r�r�r�rB�exit�
SystemExitr�Z	no_report)�parserZgrpZ_grpZoptsZrel_pathr��trlr|ZglobsrHr)r�r�r�r�main\s�


















(r�r�)N) �__all__r�rZr�rerr�r]r�r�r{r>Ztimerr�r
�ImportErrorrrr	rwr
r+r4rrr�r�rYrr�r$rrrr�<module>2sF2/

M
argparse.cpython-36.pyc000064400000165440150335715140011014 0ustar003


 \a�@s0dZdZdddddddd	d
ddd
dddddgZddlZddlZddlZddl	Z
ddlZddl
ZddlmZmZdZdZdZdZdZdZdZGdd�de�Zdd �ZGd!d�de�ZGd"d�de�ZGd#d	�d	e�ZGd$d�de�ZGd%d
�d
e�Z d&d'�Z!Gd(d�de"�Z#Gd)d�de"�Z$Gd*d�de�Z%Gd+d,�d,e%�Z&Gd-d.�d.e%�Z'Gd/d0�d0e'�Z(Gd1d2�d2e'�Z)Gd3d4�d4e%�Z*Gd5d6�d6e%�Z+Gd7d8�d8e%�Z,Gd9d:�d:e%�Z-Gd;d<�d<e%�Z.Gd=d>�d>e%�Z/Gd?d�de�Z0Gd@d�de�Z1GdAdB�dBe�Z2GdCdD�dDe2�Z3GdEdF�dFe3�Z4GdGd�dee2�Z5dS)Ha�
Command-line parsing library

This module is an optparse-inspired command-line parsing library that:

    - handles both optional and positional arguments
    - produces highly informative usage messages
    - supports parsers that dispatch to sub-parsers

The following is a simple usage example that sums integers from the
command-line and writes the result to a file::

    parser = argparse.ArgumentParser(
        description='sum the integers at the command line')
    parser.add_argument(
        'integers', metavar='int', nargs='+', type=int,
        help='an integer to be summed')
    parser.add_argument(
        '--log', default=sys.stdout, type=argparse.FileType('w'),
        help='the file where the sum should be written')
    args = parser.parse_args()
    args.log.write('%s' % sum(args.integers))
    args.log.close()

The module contains the following public classes:

    - ArgumentParser -- The main entry point for command-line parsing. As the
        example above shows, the add_argument() method is used to populate
        the parser with actions for optional and positional arguments. Then
        the parse_args() method is invoked to convert the args at the
        command-line into an object with attributes.

    - ArgumentError -- The exception raised by ArgumentParser objects when
        there are errors with the parser's actions. Errors raised while
        parsing the command-line are caught by ArgumentParser and emitted
        as command-line messages.

    - FileType -- A factory for defining types of files to be created. As the
        example above shows, instances of FileType are typically passed as
        the type= argument of add_argument() calls.

    - Action -- The base class for parser actions. Typically actions are
        selected by passing strings like 'store_true' or 'append_const' to
        the action= argument of add_argument(). However, for greater
        customization of ArgumentParser actions, subclasses of Action may
        be defined and passed as the action= argument.

    - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter,
        ArgumentDefaultsHelpFormatter -- Formatter classes which
        may be passed as the formatter_class= argument to the
        ArgumentParser constructor. HelpFormatter is the default,
        RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser
        not to change the formatting for help text, and
        ArgumentDefaultsHelpFormatter adds information about argument defaults
        to the help.

All other classes in this module are considered implementation details.
(Also note that HelpFormatter and RawDescriptionHelpFormatter are only
considered public as object names -- the API of the formatter objects is
still considered an implementation detail.)
z1.1�ArgumentParser�
ArgumentError�ArgumentTypeError�FileType�
HelpFormatter�ArgumentDefaultsHelpFormatter�RawDescriptionHelpFormatter�RawTextHelpFormatter�MetavarTypeHelpFormatter�	Namespace�Action�ONE_OR_MORE�OPTIONAL�PARSER�	REMAINDER�SUPPRESS�ZERO_OR_MORE�N)�gettext�ngettextz==SUPPRESS==�?�*�+zA...z...Z_unrecognized_argsc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_AttributeHolderaAbstract base class that provides __repr__.

    The __repr__ method returns a string in the format::
        ClassName(attr=name, attr=name, ...)
    The attributes are determined either by a class-level attribute,
    '_kwarg_names', or by inspecting the instance __dict__.
    cCs�t|�j}g}i}x|j�D]}|jt|��qWx8|j�D],\}}|j�r`|jd||f�q<|||<q<W|r�|jdt|��d|dj|�fS)Nz%s=%rz**%sz%s(%s)z, )�type�__name__�	_get_args�append�repr�_get_kwargs�isidentifier�join)�selfZ	type_name�arg_stringsZ	star_args�arg�name�value�r&� /usr/lib64/python3.6/argparse.py�__repr__vs
z_AttributeHolder.__repr__cCst|jj��S)N)�sorted�__dict__�items)r!r&r&r'r�sz_AttributeHolder._get_kwargscCsgS)Nr&)r!r&r&r'r�sz_AttributeHolder._get_argsN)r�
__module__�__qualname__�__doc__r(rrr&r&r&r'rmsrcCs&t||d�dkrt|||�t||�S)N)�getattr�setattr)�	namespacer$r%r&r&r'�
_ensure_value�sr2c@s�eZdZdZd;dd�Zdd�Zd	d
�ZGdd�de�Zd
d�Z	dd�Z
dd�Zdd�Zd<dd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�ZdS)=rz�Formatter for generating usage messages and argument help strings.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    ��NcCs�|dkr@yttjd�}Wnttfk
r6d}YnX|d8}||_||_||_t|t	|d|d��|_||_
d|_d|_d|_
|j|d�|_|j|_tjdtj�|_tjd�|_dS)NZCOLUMNS�Pr3�rz\s+z\n\n\n+)�int�_os�environ�KeyError�
ValueError�_prog�_indent_increment�_max_help_position�min�max�_width�_current_indent�_level�_action_max_length�_Section�
_root_section�_current_section�_re�compile�ASCII�_whitespace_matcher�_long_break_matcher)r!�progZindent_incrementZmax_help_position�widthr&r&r'�__init__�s&
zHelpFormatter.__init__cCs"|j|j7_|jd7_dS)N�)rBr=rC)r!r&r&r'�_indent�szHelpFormatter._indentcCs4|j|j8_|jdks"td��|jd8_dS)NrzIndent decreased below 0.rP)rBr=�AssertionErrorrC)r!r&r&r'�_dedent�szHelpFormatter._dedentc@seZdZddd�Zdd�ZdS)zHelpFormatter._SectionNcCs||_||_||_g|_dS)N)�	formatter�parent�headingr+)r!rTrUrVr&r&r'rO�szHelpFormatter._Section.__init__cCs�|jdk	r|jj�|jj}|dd�|jD��}|jdk	rD|jj�|sLdS|jtk	rz|jdk	rz|jj}d|d|jf}nd}|d||dg�S)NcSsg|]\}}||��qSr&r&)�.0�func�argsr&r&r'�
<listcomp>�sz6HelpFormatter._Section.format_help.<locals>.<listcomp>�z%*s%s:
�
)	rUrTrQ�_join_partsr+rSrVrrB)r!r Z	item_helpZcurrent_indentrVr&r&r'�format_help�s



z"HelpFormatter._Section.format_help)N)rr,r-rOr^r&r&r&r'rE�s
rEcCs|jjj||f�dS)N)rGr+r)r!rXrYr&r&r'�	_add_item�szHelpFormatter._add_itemcCs0|j�|j||j|�}|j|jg�||_dS)N)rQrErGr_r^)r!rVZsectionr&r&r'�
start_section�szHelpFormatter.start_sectioncCs|jj|_|j�dS)N)rGrUrS)r!r&r&r'�end_section�s
zHelpFormatter.end_sectioncCs$|tk	r |dk	r |j|j|g�dS)N)rr_�_format_text)r!�textr&r&r'�add_text�szHelpFormatter.add_textcCs&|tk	r"||||f}|j|j|�dS)N)rr_�
_format_usage)r!�usage�actions�groups�prefixrYr&r&r'�	add_usage�szHelpFormatter.add_usagecCsz|jtk	rv|j}||�g}x |j|�D]}|j||��q&Wtdd�|D��}||j}t|j|�|_|j|j	|g�dS)NcSsg|]}t|��qSr&)�len)rW�sr&r&r'rZ
sz.HelpFormatter.add_argument.<locals>.<listcomp>)
�helpr�_format_action_invocation�_iter_indented_subactionsrr@rBrDr_�_format_action)r!�actionZget_invocationZinvocations�	subactionZinvocation_lengthZ
action_lengthr&r&r'�add_arguments


zHelpFormatter.add_argumentcCsx|D]}|j|�qWdS)N)rs)r!rgrqr&r&r'�
add_argumentss
zHelpFormatter.add_argumentscCs.|jj�}|r*|jjd|�}|jd�d}|S)Nz

r\)rFr^rL�sub�strip)r!rmr&r&r'r^s

zHelpFormatter.format_helpcCsdjdd�|D��S)Nr[cSsg|]}|r|tk	r|�qSr&)r)rW�partr&r&r'rZ!sz-HelpFormatter._join_parts.<locals>.<listcomp>)r )r!Zpart_stringsr&r&r'r] s
zHelpFormatter._join_partscs<|dkrtd�}|dk	r,|t|jd�}�n|dkrN|rNdt|jd�}�n�|dk�r0dt|jd�}g}g}x(|D] }|jr�|j|�qv|j|�qvW|j}	|	|||�}
djdd�||
gD��}|j|j�t	|�t	|��k�r0d}|	||�}|	||�}
t
j||�}t
j||
�}dj|�|k�s,t�dj|�|
k�s@t�d�fdd	�	}t	|�t	|�d
�k�r�dt	|�t	|�d}|�r�||g|||�}|j
|||��n |�r�||g|||�}n|g}nZdt	|�}||}|||�}t	|�dk�rg}|j
|||��|j
|||��|g|}dj|�}d
||fS)Nzusage: )rMz%(prog)s� cSsg|]}|r|�qSr&r&)rWrlr&r&r'rZAsz/HelpFormatter._format_usage.<locals>.<listcomp>z%\(.*?\)+(?=\s|$)|\[.*?\]+(?=\s|$)|\S+cs�g}g}|dk	rt|�d}nt|�d}xb|D]Z}|dt|��krp|rp|j|dj|��g}t|�d}|j|�|t|�d7}q0W|r�|j|dj|��|dk	r�|dt|�d�|d<|S)NrPrxr)rkrr )�parts�indentri�lines�lineZline_lenrw)�
text_widthr&r'�	get_linesUs"

z.HelpFormatter._format_usage.<locals>.get_linesg�?rPr\z%s%s

)N)�_�dictr<�option_stringsr�_format_actions_usager rArBrkrH�findallrR�extend)r!rfrgrhrirMZ	optionals�positionalsrq�formatZaction_usageZpart_regexpZ	opt_usageZ	pos_usageZ	opt_partsZ	pos_partsr~rzr{ryr&)r}r're%sZ






zHelpFormatter._format_usagec
Cs�t�}i}x�|D]�}y|j|jd�}Wntk
r>wYqX|t|j�}|||�|jkrx|jD]}|j|�qhW|js�||kr�||d7<nd||<d||<n*||kr�||d7<nd||<d||<xt|d|�D]}	d	||	<q�WqWg}
�x2t|�D�]$\}	}|j	t
k�rj|
jd�|j|	�d	k�rF|j
|	�n"|j|	d�d	k�r.|j
|	d�n�|j�s�|j|�}|j||�}||k�r�|ddk�r�|ddk�r�|dd�}|
j|�nh|jd}
|jdk�r�d
|
}n"|j|�}|j||�}d|
|f}|j�r$||k�r$d|}|
j|��q
Wx(t|d
d�D]}	||	g|
|	|	�<�qBWdjdd�|
D��}d}d}tjd|d|�}tjd|d|�}tjd||fd|�}tjdd|�}|j�}|S)Nrz [�[�]z (�(�)rP�|z%sz%s %sz[%s]T)�reverserxcSsg|]}|dk	r|�qS)Nr&)rW�itemr&r&r'rZ�sz7HelpFormatter._format_actions_usage.<locals>.<listcomp>z[\[(]z[\])]z(%s) z\1z (%s)z%s *%sr[z\(([^|]*)\)���r�)�set�index�_group_actionsr;rk�add�required�range�	enumeratermrr�get�popr��#_get_default_metavar_for_positional�_format_args�nargs�!_get_default_metavar_for_optionalr)r rHrurv)r!rgrh�
group_actionsZinserts�group�start�endrq�iry�defaultrw�
option_string�args_stringrc�open�closer&r&r'r��sr







z#HelpFormatter._format_actions_usagecCsFd|kr|t|jd�}t|j|jd�}d|j}|j|||�dS)Nz%(prog))rM�rxz

)r�r<r@rArB�
_fill_text)r!rcr}rzr&r&r'rb�s

zHelpFormatter._format_textc
CsBt|jd|j�}t|j|d�}||jd}|j|�}|jsV|jd|f}d|}n@t|�|kr~|jd||f}d|}d}n|jd|f}d|}|}|g}|jr�|j	|�}	|j
|	|�}
|jd|d|
df�x@|
dd�D]}|jd|d|f�q�Wn|jd��s|jd�x$|j
|�D]}|j|j|���qW|j|�S)	Nr3r�r[z%*s%s
z	%*s%-*s  rrPr\)r?rDr>r@rArBrnrmrk�_expand_help�_split_linesr�endswithrorpr])
r!rqZ
help_positionZ
help_widthZaction_widthZ
action_header�tupZindent_firstryZ	help_textZ
help_linesr|rrr&r&r'rp�s6




zHelpFormatter._format_actioncCs�|js&|j|�}|j||�d�\}|Sg}|jdkrB|j|j�n8|j|�}|j||�}x |jD]}|jd||f�q`Wdj|�SdS)NrPrz%s %sz, )	r�r��_metavar_formatterr�r�r�r�rr )r!rqr��metavarryr�r�r&r&r'rns


z'HelpFormatter._format_action_invocationcsP|jdk	r|j�n.|jdk	r<dd�|jD�}ddj|��n|��fdd�}|S)NcSsg|]}t|��qSr&)�str)rWZchoicer&r&r'rZ8sz4HelpFormatter._metavar_formatter.<locals>.<listcomp>z{%s}�,cst�t�r�S�f|SdS)N)�
isinstance�tuple)Z
tuple_size)�resultr&r'r�=s
z0HelpFormatter._metavar_formatter.<locals>.format)r��choicesr )r!rq�default_metavarZchoice_strsr�r&)r�r'r�4s

z HelpFormatter._metavar_formattercCs�|j||�}|jdkr$d|d�}n�|jtkr<d|d�}n�|jtkrTd|d�}nh|jtkrld|d�}nP|jtkr|d}n@|jtkr�d|d�}n(d	d
�t|j�D�}dj|�||j�}|S)Nz%srPz[%s]z
[%s [%s ...]]r3z%s [%s ...]z...z%s ...cSsg|]}d�qS)z%sr&)rWrr&r&r'rZSsz.HelpFormatter._format_args.<locals>.<listcomp>rx)	r�r�r
rrrrr�r )r!rqr�Zget_metavarr�Zformatsr&r&r'r�Ds 





zHelpFormatter._format_argscCs�tt|�|jd�}x"t|�D]}||tkr||=qWx,t|�D] }t||d�r@||j||<q@W|jd�dk	r�djdd�|dD��}||d<|j	|�|S)N)rMrr�z, cSsg|]}t|��qSr&)r�)rW�cr&r&r'rZ`sz.HelpFormatter._expand_help.<locals>.<listcomp>)
r��varsr<�listr�hasattrrr�r �_get_help_string)r!rqZparamsr$Zchoices_strr&r&r'r�Ws
zHelpFormatter._expand_helpccs@y
|j}Wntk
rYnX|j�|�EdH|j�dS)N)�_get_subactions�AttributeErrorrQrS)r!rqZget_subactionsr&r&r'rods
z'HelpFormatter._iter_indented_subactionscCs|jjd|�j�}tj||�S)Nrx)rKrurv�	_textwrapZwrap)r!rcrNr&r&r'r�nszHelpFormatter._split_linescCs$|jjd|�j�}tj||||d�S)Nrx)Zinitial_indentZsubsequent_indent)rKrurvr�Zfill)r!rcrNrzr&r&r'r�rs
zHelpFormatter._fill_textcCs|jS)N)rm)r!rqr&r&r'r�wszHelpFormatter._get_help_stringcCs
|jj�S)N)�dest�upper)r!rqr&r&r'r�zsz/HelpFormatter._get_default_metavar_for_optionalcCs|jS)N)r�)r!rqr&r&r'r�}sz1HelpFormatter._get_default_metavar_for_positional)r3r4N)N) rr,r-r.rOrQrS�objectrEr_r`rardrjrsrtr^r]rer�rbrprnr�r�r�ror�r�r�r�r�r&r&r&r'r�s<

`a/

c@seZdZdZdd�ZdS)rz�Help message formatter which retains any formatting in descriptions.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cs dj�fdd�|jdd�D��S)Nr[c3s|]}�|VqdS)Nr&)rWr|)rzr&r'�	<genexpr>�sz9RawDescriptionHelpFormatter._fill_text.<locals>.<genexpr>T)�keepends)r �
splitlines)r!rcrNrzr&)rzr'r��sz&RawDescriptionHelpFormatter._fill_textN)rr,r-r.r�r&r&r&r'r�sc@seZdZdZdd�ZdS)rz�Help message formatter which retains formatting of all help text.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCs|j�S)N)r�)r!rcrNr&r&r'r��sz!RawTextHelpFormatter._split_linesN)rr,r-r.r�r&r&r&r'r�sc@seZdZdZdd�ZdS)rz�Help message formatter which adds default values to argument help.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCs>|j}d|jkr:|jtk	r:ttg}|js2|j|kr:|d7}|S)Nz
%(default)z (default: %(default)s))rmr�rr
rr�r�)r!rqrmZdefaulting_nargsr&r&r'r��s

z.ArgumentDefaultsHelpFormatter._get_help_stringN)rr,r-r.r�r&r&r&r'r�sc@s eZdZdZdd�Zdd�ZdS)r	aHelp message formatter which uses the argument 'type' as the default
    metavar value (instead of the argument 'dest')

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCs|jjS)N)rr)r!rqr&r&r'r��sz:MetavarTypeHelpFormatter._get_default_metavar_for_optionalcCs|jjS)N)rr)r!rqr&r&r'r��sz<MetavarTypeHelpFormatter._get_default_metavar_for_positionalN)rr,r-r.r�r�r&r&r&r'r	�scCsN|dkrdS|jrdj|j�S|jdtfkr2|jS|jdtfkrF|jSdSdS)N�/)r�r r�rr�)�argumentr&r&r'�_get_action_name�sr�c@s eZdZdZdd�Zdd�ZdS)rz�An error from creating or using an argument (optional or positional).

    The string value of this exception is the message, augmented with
    information about the argument that caused it.
    cCst|�|_||_dS)N)r��
argument_name�message)r!r�r�r&r&r'rO�s
zArgumentError.__init__cCs(|jdkrd}nd}|t|j|jd�S)Nz%(message)sz'argument %(argument_name)s: %(message)s)r�r�)r�r�r�)r!r�r&r&r'�__str__�s

zArgumentError.__str__N)rr,r-r.rOr�r&r&r&r'r�sc@seZdZdZdS)rz@An error from trying to convert a command line string to a type.N)rr,r-r.r&r&r&r'r�sc@s,eZdZdZd
dd�Zdd�Zddd	�ZdS)ra\	Information about how to convert command line strings to Python objects.

    Action objects are used by an ArgumentParser to represent the information
    needed to parse a single argument from one or more strings from the
    command line. The keyword arguments to the Action constructor are also
    all attributes of Action instances.

    Keyword Arguments:

        - option_strings -- A list of command-line option strings which
            should be associated with this action.

        - dest -- The name of the attribute to hold the created object(s)

        - nargs -- The number of command-line arguments that should be
            consumed. By default, one argument will be consumed and a single
            value will be produced.  Other values include:
                - N (an integer) consumes N arguments (and produces a list)
                - '?' consumes zero or one arguments
                - '*' consumes zero or more arguments (and produces a list)
                - '+' consumes one or more arguments (and produces a list)
            Note that the difference between the default and nargs=1 is that
            with the default, a single value will be produced, while with
            nargs=1, a list containing a single value will be produced.

        - const -- The value to be produced if the option is specified and the
            option uses an action that takes no values.

        - default -- The value to be produced if the option is not specified.

        - type -- A callable that accepts a single string argument, and
            returns the converted value.  The standard Python types str, int,
            float, and complex are useful examples of such callables.  If None,
            str is used.

        - choices -- A container of values that should be allowed. If not None,
            after a command-line argument has been converted to the appropriate
            type, an exception will be raised if it is not a member of this
            collection.

        - required -- True if the action must always be specified at the
            command line. This is only meaningful for optional command-line
            arguments.

        - help -- The help string describing the argument.

        - metavar -- The name to be used for the option's argument with the
            help string. If None, the 'dest' value will be used as the name.
    NFcCs@||_||_||_||_||_||_||_||_|	|_|
|_	dS)N)
r�r�r��constr�rr�r�rmr�)r!r�r�r�r�r�rr�r�rmr�r&r&r'rOszAction.__init__c	s(ddddddddd	g	}�fd
d�|D�S)Nr�r�r�r�r�rr�rmr�csg|]}|t�|�f�qSr&)r/)rWr$)r!r&r'rZ;sz&Action._get_kwargs.<locals>.<listcomp>r&)r!�namesr&)r!r'r/szAction._get_kwargscCsttd���dS)Nz.__call__() not defined)�NotImplementedErrorr)r!�parserr1�valuesr�r&r&r'�__call__=szAction.__call__)NNNNNFNN)N)rr,r-r.rOrr�r&r&r&r'r�s1
cs(eZdZd�fdd�	Zddd�Z�ZS)	�_StoreActionNFcsT|dkrtd��|dk	r,|tkr,tdt��tt|�j|||||||||	|
d�
dS)Nrz�nargs for store actions must be > 0; if you have nothing to store, actions such as store true or store const may be more appropriatez nargs must be %r to supply const)
r�r�r�r�r�rr�r�rmr�)r;r
�superr�rO)r!r�r�r�r�r�rr�r�rmr�)�	__class__r&r'rOCs
z_StoreAction.__init__cCst||j|�dS)N)r0r�)r!r�r1r�r�r&r&r'r�`sz_StoreAction.__call__)NNNNNFNN)N)rr,r-rOr��
__classcell__r&r&)r�r'r�Asr�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_StoreConstActionNFc	s"tt|�j||d||||d�dS)Nr)r�r�r�r�r�r�rm)r�r�rO)r!r�r�r�r�r�rmr�)r�r&r'rOfs
z_StoreConstAction.__init__cCst||j|j�dS)N)r0r�r�)r!r�r1r�r�r&r&r'r�wsz_StoreConstAction.__call__)NFNN)N)rr,r-rOr�r�r&r&)r�r'r�ds

r�cseZdZd�fdd�	Z�ZS)�_StoreTrueActionFNcs tt|�j||d|||d�dS)NT)r�r�r�r�r�rm)r�r�rO)r!r�r�r�r�rm)r�r&r'rO}s
z_StoreTrueAction.__init__)FFN)rr,r-rOr�r&r&)r�r'r�{sr�cseZdZd�fdd�	Z�ZS)�_StoreFalseActionTFNcs tt|�j||d|||d�dS)NF)r�r�r�r�r�rm)r�r�rO)r!r�r�r�r�rm)r�r&r'rO�s
z_StoreFalseAction.__init__)TFN)rr,r-rOr�r&r&)r�r'r��sr�cs(eZdZd�fdd�	Zddd�Z�ZS)	�
_AppendActionNFcsT|dkrtd��|dk	r,|tkr,tdt��tt|�j|||||||||	|
d�
dS)Nrz�nargs for append actions must be > 0; if arg strings are not supplying the value to append, the append const action may be more appropriatez nargs must be %r to supply const)
r�r�r�r�r�rr�r�rmr�)r;r
r�r�rO)r!r�r�r�r�r�rr�r�rmr�)r�r&r'rO�s
z_AppendAction.__init__cCs0tjt||jg��}|j|�t||j|�dS)N)�_copy�copyr2r�rr0)r!r�r1r�r�r+r&r&r'r��s
z_AppendAction.__call__)NNNNNFNN)N)rr,r-rOr�r�r&r&)r�r'r��sr�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_AppendConstActionNFc
s$tt|�j||d|||||d�dS)Nr)r�r�r�r�r�r�rmr�)r�r�rO)r!r�r�r�r�r�rmr�)r�r&r'rO�s
z_AppendConstAction.__init__cCs2tjt||jg��}|j|j�t||j|�dS)N)r�r�r2r�rr�r0)r!r�r1r�r�r+r&r&r'r��sz_AppendConstAction.__call__)NFNN)N)rr,r-rOr�r�r&r&)r�r'r��s
r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_CountActionNFcs tt|�j||d|||d�dS)Nr)r�r�r�r�r�rm)r�r�rO)r!r�r�r�r�rm)r�r&r'rO�s
z_CountAction.__init__cCs$t||jd�d}t||j|�dS)NrrP)r2r�r0)r!r�r1r�r�Z	new_countr&r&r'r��sz_CountAction.__call__)NFN)N)rr,r-rOr�r�r&r&)r�r'r��s	r�cs.eZdZeedf�fdd�	Zddd�Z�ZS)�_HelpActionNcstt|�j|||d|d�dS)Nr)r�r�r�r�rm)r�r�rO)r!r�r�r�rm)r�r&r'rO�s
z_HelpAction.__init__cCs|j�|j�dS)N)�
print_help�exit)r!r�r1r�r�r&r&r'r��sz_HelpAction.__call__)N)rr,r-rrOr�r�r&r&)r�r'r��sr�cs0eZdZdeedf�fdd�	Zddd�Z�ZS)�_VersionActionNz&show program's version number and exitcs$tt|�j|||d|d�||_dS)Nr)r�r�r�r�rm)r�r�rO�version)r!r�r�r�r�rm)r�r&r'rOs
z_VersionAction.__init__cCsD|j}|dkr|j}|j�}|j|�|j|j�tj�|j�dS)N)r��_get_formatterrd�_print_messager^�_sys�stdoutr�)r!r�r1r�r�r�rTr&r&r'r�s
z_VersionAction.__call__)N)rr,r-rrOr�r�r&r&)r�r'r�s
	r�csNeZdZGdd�de�Zeddf�fdd�	Zdd�Zdd	�Zdd
d�Z	�Z
S)
�_SubParsersActioncseZdZ�fdd�Z�ZS)z&_SubParsersAction._ChoicesPseudoActioncs@|}}|r|ddj|�7}ttj|�}|jg|||d�dS)Nz (%s)z, )r�r�rmr�)r r�r��_ChoicesPseudoActionrO)r!r$�aliasesrmr�r�Zsup)r�r&r'rO"s
z/_SubParsersAction._ChoicesPseudoAction.__init__)rr,r-rOr�r&r&)r�r'r� sr�Ncs>||_||_tj�|_g|_tt|�j||t	|j||d�dS)N)r�r�r�r�rmr�)
�_prog_prefix�
_parser_class�_collections�OrderedDict�_name_parser_map�_choices_actionsr�r�rOr)r!r�rM�parser_classr�rmr�)r�r&r'rO*s

z_SubParsersAction.__init__cKs�|jd�dkr d|j|f|d<|jdf�}d|krX|jd�}|j|||�}|jj|�|jf|�}||j|<x|D]}||j|<qtW|S)NrMz%s %sr�rm)r�r�r�r�r�rr�r�)r!r$�kwargsr�rmZ
choice_actionr��aliasr&r&r'�
add_parser?s


z_SubParsersAction.add_parsercCs|jS)N)r�)r!r&r&r'r�Vsz!_SubParsersAction._get_subactionsc
Cs�|d}|dd�}|jtk	r,t||j|�y|j|}Wn<tk
rv|dj|j�d�}td�|}t||��YnX|j|d�\}	}x$t	|	�j
�D]\}
}t||
|�q�W|r�t	|�jtg�t
|t�j|�dS)NrrPz, )�parser_namer�z5unknown parser %(parser_name)r (choices: %(choices)s))r�rr0r�r:r rr�parse_known_argsr�r+�
setdefault�_UNRECOGNIZED_ARGS_ATTRr/r�)r!r�r1r�r�r�r"rY�msgZsubnamespace�keyr%r&r&r'r�Ys"
	z_SubParsersAction.__call__)N)rr,r-rr�rrOr�r�r�r�r&r&)r�r'r�sr�c@s*eZdZdZddd�Zdd�Zd	d
�ZdS)
ra�Factory for creating file object types

    Instances of FileType are typically passed as type= arguments to the
    ArgumentParser add_argument() method.

    Keyword Arguments:
        - mode -- A string indicating how the file is to be opened. Accepts the
            same values as the builtin open() function.
        - bufsize -- The file's desired buffer size. Accepts the same values as
            the builtin open() function.
        - encoding -- The file's encoding. Accepts the same values as the
            builtin open() function.
        - errors -- A string indicating how encoding and decoding errors are to
            be handled. Accepts the same value as the builtin open() function.
    �rrPNcCs||_||_||_||_dS)N)�_mode�_bufsize�	_encoding�_errors)r!�mode�bufsize�encoding�errorsr&r&r'rO�szFileType.__init__cCs�|dkr>d|jkrtjSd|jkr(tjStd�|j}t|��yt||j|j|j|j	�St
k
r�}ztd�}t|||f��WYdd}~XnXdS)N�-r��wzargument "-" with mode %rzcan't open '%s': %s)r�r��stdinr�rr;r�r�r�r��OSErrorr)r!�stringr��er�r&r&r'r��s

zFileType.__call__cCsT|j|jf}d|jfd|jfg}djdd�|D�dd�|D��}dt|�j|fS)Nr�r�z, cSsg|]}|dkrt|��qS)rPr�)r)rWr#r&r&r'rZ�sz%FileType.__repr__.<locals>.<listcomp>cSs$g|]\}}|dk	rd||f�qS)Nz%s=%rr&)rW�kwr#r&r&r'rZ�sz%s(%s))r�r�r�r�r rr)r!rYr�Zargs_strr&r&r'r(�s
zFileType.__repr__r�)r�r�NN)rr,r-r.rOr�r(r&r&r&r'r~s
c@s(eZdZdZdd�Zdd�Zdd�ZdS)	r
z�Simple object for storing attributes.

    Implements equality by attribute names and values, and provides a simple
    string representation.
    cKs"x|D]}t||||�qWdS)N)r0)r!r�r$r&r&r'rO�s
zNamespace.__init__cCst|t�stSt|�t|�kS)N)r�r
�NotImplementedr�)r!�otherr&r&r'�__eq__�s
zNamespace.__eq__cCs
||jkS)N)r*)r!r�r&r&r'�__contains__�szNamespace.__contains__N)rr,r-r.rOr	r
r&r&r&r'r
�scs�eZdZ�fdd�Zdd�Zd&dd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd'dd�Zdd�Zd d!�Zd"d#�Zd$d%�Z�ZS)(�_ActionsContainercstt|�j�||_||_||_||_i|_|jddt	�|jddt	�|jddt
�|jddt�|jddt�|jddt
�|jddt�|jddt�|jdd	t�|jdd
t�|jddt�|j�g|_i|_g|_g|_i|_tjd�|_g|_dS)
NrqZstoreZstore_const�
store_trueZstore_falserZappend_const�countrmr��parsersz^-\d+$|^-\d*\.\d+$)r�rrO�description�argument_default�prefix_chars�conflict_handler�_registries�registerr�r�r�r�r�r�r�r�r�r��_get_handler�_actions�_option_string_actions�_action_groups�_mutually_exclusive_groups�	_defaultsrHrI�_negative_number_matcher�_has_negative_number_optionals)r!rrrr)r�r&r'rO�s2z_ActionsContainer.__init__cCs|jj|i�}|||<dS)N)rr�)r!�
registry_namer%r��registryr&r&r'r�sz_ActionsContainer.registerNcCs|j|j||�S)N)rr�)r!rr%r�r&r&r'�
_registry_getsz_ActionsContainer._registry_getcKs6|jj|�x$|jD]}|j|kr||j|_qWdS)N)r�updaterr�r�)r!r�rqr&r&r'�set_defaultss
z_ActionsContainer.set_defaultscCs8x(|jD]}|j|kr|jdk	r|jSqW|jj|d�S)N)rr�r�rr�)r!r�rqr&r&r'�get_defaults
z_ActionsContainer.get_defaultcOs0|j}|s(t|�dkrJ|dd|krJ|r<d|kr<td��|j||�}n|j||�}d|kr�|d}||jkr�|j||d<n|jdk	r�|j|d<|j|�}t|�s�td|f��|f|�}|j	d|j
|j
�}t|�s�td	|f��t|d
��r&y|j�j
|d�Wntk
�r$td��YnX|j|�S)z�
        add_argument(dest, ..., name=value, ...)
        add_argument(option_string, option_string, ..., name=value, ...)
        rPrr�z+dest supplied twice for positional argumentr�Nzunknown action "%s"rz%r is not callabler�z,length of metavar tuple does not match nargs)rrkr;�_get_positional_kwargs�_get_optional_kwargsrr�_pop_action_class�callablerrr�r�r��	TypeError�_add_action)r!rYr��charsr�Zaction_classrq�	type_funcr&r&r'rss2	"




z_ActionsContainer.add_argumentcOs t|f|�|�}|jj|�|S)N)�_ArgumentGrouprr)r!rYr�r�r&r&r'�add_argument_groupJsz$_ActionsContainer.add_argument_groupcKst|f|�}|jj|�|S)N)�_MutuallyExclusiveGrouprr)r!r�r�r&r&r'�add_mutually_exclusive_groupOsz._ActionsContainer.add_mutually_exclusive_groupcCsh|j|�|jj|�||_x|jD]}||j|<q$Wx,|jD]"}|jj|�r>|js>|jjd�q>W|S)NT)	�_check_conflictrr�	containerr�rr�matchr)r!rqr�r&r&r'r(Ts
z_ActionsContainer._add_actioncCs|jj|�dS)N)r�remove)r!rqr&r&r'�_remove_actionisz _ActionsContainer._remove_actioncCs�i}x8|jD].}|j|kr0td�}t||j��|||j<qWi}xR|jD]H}|j|krt|j|j|j|jd�||j<x|jD]}||j||<q|WqJWx4|jD]*}|j	|j
d�}x|jD]}|||<q�Wq�Wx |jD]}|j||�j
|�q�WdS)Nz.cannot merge actions - two groups are named %r)�titlerr)r�)rr4rr;r,rrr�rr.r�rr�r()r!r0Ztitle_group_mapr�r�Z	group_maprq�mutex_groupr&r&r'�_add_container_actionsls,


z(_ActionsContainer._add_container_actionscKs^d|krtd�}t|��|jd�ttgkr2d|d<|jd�tkrPd|krPd|d<t||gd�S)Nr�z1'required' is an invalid argument for positionalsr�Tr�)r�r�)rr'r�r
rr�)r!r�r�r�r&r&r'r#�sz(_ActionsContainer._get_positional_kwargsc	Os�g}g}xv|D]n}|d|jkr@||jd�}td�}t||��|j|�|d|jkrt|�dkr|d|jkr|j|�qW|jdd�}|dkr�|r�|d}n|d}|j|j�}|s�td�}t||��|jdd�}t|||d	�S)
Nr)�optionrzNinvalid option string %(option)r: must start with a character %(prefix_chars)rrPr�z%dest= is required for options like %rrr)r�r�)	rrr;rrkr��lstrip�replacer�)	r!rYr�r�Zlong_option_stringsr�r�r�Zdest_option_stringr&r&r'r$�s0



z&_ActionsContainer._get_optional_kwargscCs|jd|�}|jd||�S)Nrq)r�r)r!r�r�rqr&r&r'r%�sz#_ActionsContainer._pop_action_classcCsDd|j}y
t||�Stk
r>td�}t||j��YnXdS)Nz_handle_conflict_%sz%invalid conflict_resolution value: %r)rr/r�rr;)r!Zhandler_func_namer�r&r&r'r�s

z_ActionsContainer._get_handlercCsPg}x0|jD]&}||jkr|j|}|j||f�qW|rL|j�}|||�dS)N)r�rrr)r!rqZconfl_optionalsr�Zconfl_optionalrr&r&r'r/�s

z!_ActionsContainer._check_conflictcCs6tddt|��}djdd�|D��}t|||��dS)Nzconflicting option string: %szconflicting option strings: %sz, cSsg|]\}}|�qSr&r&)rWr�rqr&r&r'rZ�sz<_ActionsContainer._handle_conflict_error.<locals>.<listcomp>)rrkr r)r!rq�conflicting_actionsr�Zconflict_stringr&r&r'�_handle_conflict_error�s


z(_ActionsContainer._handle_conflict_errorcCsBx<|D]4\}}|jj|�|jj|d�|js|jj|�qWdS)N)r�r2rr�r0r3)r!rqr:r�r&r&r'�_handle_conflict_resolve�s
z*_ActionsContainer._handle_conflict_resolve)N)N)rr,r-rOrrr!r"rsr,r.r(r3r6r#r$r%rr/r;r<r�r&r&)r�r'r�s$4
	
/($
		rcs6eZdZd�fdd�	Z�fdd�Z�fdd�Z�ZS)	r+Ncs�|j}|d|j�|d|j�|d|j�tt|�j}|fd|i|��||_g|_|j	|_	|j
|_
|j|_|j|_|j
|_
|j|_dS)Nrrrr)r�rrrr�r+rOr4r�rrrrrr)r!r0r4rr�r Z
super_init)r�r&r'rO�sz_ArgumentGroup.__init__cs tt|�j|�}|jj|�|S)N)r�r+r(r�r)r!rq)r�r&r'r(sz_ArgumentGroup._add_actioncs tt|�j|�|jj|�dS)N)r�r+r3r�r2)r!rq)r�r&r'r3sz_ArgumentGroup._remove_action)NN)rr,r-rOr(r3r�r&r&)r�r'r+�sr+cs.eZdZd�fdd�	Zdd�Zdd�Z�ZS)	r-Fcs tt|�j|�||_||_dS)N)r�r-rOr��
_container)r!r0r�)r�r&r'rOsz _MutuallyExclusiveGroup.__init__cCs2|jrtd�}t|��|jj|�}|jj|�|S)Nz-mutually exclusive arguments must be optional)r�rr;r=r(r�r)r!rqr�r&r&r'r($sz#_MutuallyExclusiveGroup._add_actioncCs|jj|�|jj|�dS)N)r=r3r�r2)r!rqr&r&r'r3,sz&_MutuallyExclusiveGroup._remove_action)F)rr,r-rOr(r3r�r&r&)r�r'r-sr-cseZdZdZddddgeddddddf�fdd�	Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
d=dd�Zd>dd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd?d2d3�Zd@d4d5�ZdAd6d7�ZdBd9d:�Zd;d<�Z�Z S)Cra�Object for parsing command line strings into Python objects.

    Keyword Arguments:
        - prog -- The name of the program (default: sys.argv[0])
        - usage -- A usage message (default: auto-generated from arguments)
        - description -- A description of what the program does
        - epilog -- Text following the argument descriptions
        - parents -- Parsers whose arguments should be copied into this one
        - formatter_class -- HelpFormatter class for printing help messages
        - prefix_chars -- Characters that prefix optional arguments
        - fromfile_prefix_chars -- Characters that prefix files containing
            additional arguments
        - argument_default -- The default value for all arguments
        - conflict_handler -- String indicating how to handle conflicts
        - add_help -- Add a -h/-help option
        - allow_abbrev -- Allow long options to be abbreviated unambiguously
    Nr�errorTc
s&tt|�j}
|
|||	|
d�|dkr6tjjtjd�}||_||_	||_
||_||_||_
||_|j}|td��|_|td��|_d|_dd�}|jdd|�d|kr�dn|d}|j
r�|j|d	|d
ddttd�d
�xD|D]<}|j|�y
|j}Wntk
�rYq�X|jj|�q�WdS)N)rrrrrzpositional argumentszoptional argumentscSs|S)Nr&)rr&r&r'�identityjsz)ArgumentParser.__init__.<locals>.identityrr�hr3rmzshow this help message and exit)rqr�rm)r�rrOr8�path�basenamer��argvrMrf�epilog�formatter_class�fromfile_prefix_chars�add_help�allow_abbrevr,r�_positionals�
_optionals�_subparsersrrsrr6rr�r )r!rMrfrrD�parentsrErrFrrrGrHZ	superinitZ	add_groupr?Zdefault_prefixrUZdefaults)r�r&r'rODsB


zArgumentParser.__init__cs"ddddddg}�fdd�|D�S)	NrMrfrrErrGcsg|]}|t�|�f�qSr&)r/)rWr$)r!r&r'rZ�sz.ArgumentParser._get_kwargs.<locals>.<listcomp>r&)r!r�r&)r!r'r�szArgumentParser._get_kwargsc	Ks�|jdk	r|jtd��|jdt|��d|ks8d|krht|jdd��}t|jdd��}|j||�|_n|j|_|jd�dkr�|j	�}|j
�}|j}|j|j
||d�|j�j�|d<|j|d�}|fd	gi|��}|jj|�|S)
Nz(cannot have multiple subparser argumentsr�r4rZsubcommandsrMr[rr�)rKr>rr�rr�r,rIr�r��_get_positional_actionsrrjrfr^rvr%r()	r!r�r4rrTr�rhZ
parsers_classrqr&r&r'�add_subparsers�s$
zArgumentParser.add_subparserscCs$|jr|jj|�n|jj|�|S)N)r�rJr(rI)r!rqr&r&r'r(�szArgumentParser._add_actioncCsdd�|jD�S)NcSsg|]}|jr|�qSr&)r�)rWrqr&r&r'rZ�sz8ArgumentParser._get_optional_actions.<locals>.<listcomp>)r)r!r&r&r'�_get_optional_actions�sz$ArgumentParser._get_optional_actionscCsdd�|jD�S)NcSsg|]}|js|�qSr&)r�)rWrqr&r&r'rZ�sz:ArgumentParser._get_positional_actions.<locals>.<listcomp>)r)r!r&r&r'rM�sz&ArgumentParser._get_positional_actionscCs4|j||�\}}|r0td�}|j|dj|��|S)Nzunrecognized arguments: %srx)r�rr>r )r!rYr1rCr�r&r&r'�
parse_args�s
zArgumentParser.parse_argscCs|dkrtjdd�}nt|�}|dkr.t�}x>|jD]4}|jtk	r6t||j�s6|jtk	r6t	||j|j�q6Wx*|j
D] }t||�svt	|||j
|�qvWy<|j||�\}}t|t�r�|j
t|t��t|t�||fStk
�rtj�d}|jt|��YnXdS)NrP)r�rCr�r
rr�rr�r�r0r�_parse_known_argsr�r�r/�delattrr�exc_infor>r�)r!rYr1rqr��errr&r&r'r��s,




zArgumentParser.parse_known_argscs"�	jdk	r�	j���i�x`�	jD]V}|j}xJt|j�D]<\}}�j|g�}|j|d|��|j||dd��q6Wq Wi�g}t��}	xnt|	�D]b\}}
|
dkr�|jd�xF|	D]}
|jd�q�Wq��	j	|
�}|dkr�d}n|�|<d}|j|�q�Wdj
|��t��t��d�����	fdd�	������	�fd	d
�}
�	j������	�fdd�}g�d
�
��rpt
��}nd}x|�
|k�r�t�
fdd��D��}�
|k�r�|�
�}|�
k�r�|�
�qvn|�
�
�k�r��
|�}�j|�|�
|
�
��
�qvW|�
�}�j�|d��g}x��	jD]|}|�k�r|j�r>|jt|��nT|jdk	�rt|jt��rt�|j��r|jt�|j�k�rt�|j�	j||j���qW|�r��	jtd�dj
|��xb�	jD]X}|j�r�xH|jD]}|�k�r�P�q�Wdd�|jD�}td�}�	j|dj
|���q�W��fS)NrPz--r�A�Or[cs��j|��j||�}||jk	rf�j|�x:�j|g�D]*}|�kr8td�}t|�}t|||��q8W|tk	r||��||�dS)Nznot allowed with argument %s)r��_get_valuesr�r�rr�rr)rqZargument_stringsr�Zargument_valuesZconflict_actionr�Zaction_name)�action_conflictsr1�seen_actions�seen_non_default_actionsr!r&r'�take_actions


z5ArgumentParser._parse_known_args.<locals>.take_actioncs��|}|\}}}�j}g}�x>|dkr>�j�|�|dS|dk	�r||d�}�j}|dkr�|d|kr�|j|g|f�|d}	|	|d}|dd�p�d}
�j}||kr�||}|
}ntd�}t|||��n@|dkr�|d}
|g}|j|||f�Pntd�}t|||��q |d}�|d�}|||�}||}
�||
�}|j|||f�Pq W|�sht�x |D]\}}}�|||��qnW|
S)NrPrUrzignored explicit argument %r)�_match_argumentrrrrrrR)�start_index�option_tuplerqr��explicit_argZmatch_argumentZ
action_tuples�	arg_countr)�charZnew_explicit_argZ
optionals_mapr��stoprYr�Zselected_patterns)r"�arg_strings_pattern�extras�option_string_indicesr!r[r&r'�consume_optional3sP




z:ArgumentParser._parse_known_args.<locals>.consume_optionalcsr�j}�|d�}|�|�}x8t�|�D]*\}}�|||�}||7}�||�q(W�t|�d��dd�<|S)N)�_match_arguments_partial�ziprk)r]Z
match_partialZselected_patternZ
arg_countsrqr`rY)r"rcr�r!r[r&r'�consume_positionals�s
z=ArgumentParser._parse_known_args.<locals>.consume_positionalsrcsg|]}|�kr|�qSr&r&)rWr�)r]r&r'rZ�sz4ArgumentParser._parse_known_args.<locals>.<listcomp>z(the following arguments are required: %sz, cSsg|]}|jtk	rt|��qSr&)rmrr�)rWrqr&r&r'rZ�sz#one of the arguments %s is requiredrx)Nr�)rF�_read_args_from_filesrr�r�r�r��iterr�_parse_optionalr r�rMr@r?rr�r�r�r�r�r�r�r/r0�
_get_valuer>r)r!r"r1r5r�r�Zmutex_actionZ	conflictsZarg_string_pattern_partsZarg_strings_iter�
arg_stringr^�patternrfriZmax_option_string_indexZnext_option_string_indexZpositionals_end_indexZstringsZ
stop_indexZrequired_actionsrqr�r�r�r&)rXr"rcrdr1rer�rYrZr!r]r[r'rQ�s�





J










z ArgumentParser._parse_known_argscCs�g}x�|D]�}|s"|d|jkr.|j|�q
ylt|dd���R}g}x2|j�j�D]"}x|j|�D]}|j|�qdWqTW|j|�}|j|�WdQRXWq
tk
r�t	j
�d}|jt|��Yq
Xq
W|S)NrrP)
rFrr��readr��convert_arg_line_to_argsrjr�rr�rSr>r�)r!r"Znew_arg_stringsrnZ	args_file�arg_liner#rTr&r&r'rj�s 

z$ArgumentParser._read_args_from_filescCs|gS)Nr&)r!rrr&r&r'rq�sz'ArgumentParser.convert_arg_line_to_argscCst|j|�}tj||�}|dkrfdtd�ttd�ttd�i}tdd|j�|j}|j|j|�}t	||��t
|jd��S)Nzexpected one argumentzexpected at most one argumentzexpected at least one argumentzexpected %s argumentzexpected %s argumentsrP)�_get_nargs_patternrHr1rr
rrr�r�rrkr�)r!rqrc�
nargs_patternr1Znargs_errorsr�r�r&r&r'r\s

zArgumentParser._match_argumentcstg}xjtt|�dd�D]V}|d|�}dj�fdd�|D��}tj||�}|dk	r|jdd�|j�D��PqW|S)NrrPr[csg|]}�j|��qSr&)rs)rWrq)r!r&r'rZsz;ArgumentParser._match_arguments_partial.<locals>.<listcomp>cSsg|]}t|��qSr&)rk)rWrr&r&r'rZ!sr�)r�rkr rHr1r�rh)r!rgrcr�r�Z
actions_sliceror1r&)r!r'rgs
z'ArgumentParser._match_arguments_partialc
Cs|sdS|d|jkrdS||jkr8|j|}||dfSt|�dkrHdSd|kr~|jdd�\}}||jkr~|j|}|||fS|jr�|j|�}t|�dkr�djdd�|D��}||d�}td�}|j||�nt|�dkr�|\}	|	S|j	j
|��r|j�sdSd	|k�rdSd|dfS)
NrrP�=z, cSsg|]\}}}|�qSr&r&)rWrqr�r_r&r&r'rZGsz2ArgumentParser._parse_optional.<locals>.<listcomp>)r7Zmatchesz4ambiguous option: %(option)s could match %(matches)srx)rrrk�splitrH�_get_option_tuplesr rr>rr1r)
r!rnrqr�r_Z
option_tuplesZoptionsrYr�r^r&r&r'rl's>










zArgumentParser._parse_optionalc
Cs0g}|j}|d|kr~|d|kr~d|kr<|jdd�\}}n|}d}x�|jD],}|j|�rL|j|}|||f}|j|�qLWn�|d|ko�|d|k�r|}d}|dd�}|dd�}	xr|jD]T}||kr�|j|}|||	f}|j|�q�|j|�r�|j|}|||f}|j|�q�Wn|jtd�|�|S)NrrPrur3zunexpected option string: %s)rrvr�
startswithrr>r)
r!r�r�r)Z
option_prefixr_rqr�Zshort_option_prefixZshort_explicit_argr&r&r'rwbs8







z!ArgumentParser._get_option_tuplescCs�|j}|dkrd}nX|tkr"d}nJ|tkr0d}n<|tkr>d}n.|tkrLd}n |tkrZd}nddjd	|�}|jr�|jdd
�}|jdd
�}|S)Nz(-*A-*)z(-*A?-*)z	(-*[A-]*)z
(-*A[A-]*)z([-AO]*)z(-*A[-AO]*)z(-*%s-*)z-*rUr[r)	r�r
rrrrr r�r9)r!rqr�rtr&r&r'rs�s$z!ArgumentParser._get_nargs_patterncsx�jttgkr2y|jd�Wntk
r0YnX|rz�jtkrz�jrP�j}n�j}t	|t
�rx�j�|�}�j�|�n�|r��jt
kr��jr��jdk	r��j}n|}�j�|�n�t|�dkr�jdtgkr�|\}�j�|�}�j�|�n��jtk�r��fdd�|D�}nb�jtk�rD��fdd�|D�}�j�|d�n0��fdd�|D�}x|D]}�j�|��q^W|S)Nz--rPcsg|]}�j�|��qSr&)rm)rW�v)rqr!r&r'rZ�sz.ArgumentParser._get_values.<locals>.<listcomp>csg|]}�j�|��qSr&)rm)rWry)rqr!r&r'rZ�srcsg|]}�j�|��qSr&)rm)rWry)rqr!r&r'rZ�s)r�rrr2r;r
r�r�r�r�r�rm�_check_valuerrk)r!rqr"r%rnryr&)rqr!r'rW�s>


zArgumentParser._get_valuescCs�|jd|j|j�}t|�s0td�}t|||��y||�}Wn�tk
r~t|jdt|j��}tt	j
�d�}t||��YnLttfk
r�t|jdt|j��}||d�}td�}t|||��YnX|S)Nrz%r is not callablerrP)rr%z!invalid %(type)s value: %(value)r)
rrr&rrrr/rr�r�rSr'r;)r!rqrnr*r�r�r$rYr&r&r'rm�s 
zArgumentParser._get_valuecCsF|jdk	rB||jkrB|djtt|j��d�}td�}t|||��dS)Nz, )r%r�z3invalid choice: %(value)r (choose from %(choices)s))r�r �maprrr)r!rqr%rYr�r&r&r'rz	s
zArgumentParser._check_valuecCs$|j�}|j|j|j|j�|j�S)N)r�rjrfrrr^)r!rTr&r&r'�format_usage	szArgumentParser.format_usagecCsx|j�}|j|j|j|j�|j|j�x:|jD]0}|j|j	�|j|j�|j
|j�|j�q0W|j|j
�|j�S)N)r�rjrfrrrdrrr`r4rtr�rarDr^)r!rTZaction_groupr&r&r'r^	szArgumentParser.format_helpcCs|j|jd�S)N)rM)rErM)r!r&r&r'r�0	szArgumentParser._get_formattercCs"|dkrtj}|j|j�|�dS)N)r�r�r�r|)r!�filer&r&r'�print_usage6	szArgumentParser.print_usagecCs"|dkrtj}|j|j�|�dS)N)r�r�r�r^)r!r}r&r&r'r�;	szArgumentParser.print_helpcCs |r|dkrtj}|j|�dS)N)r��stderr�write)r!r�r}r&r&r'r�@	szArgumentParser._print_messagercCs |r|j|tj�tj|�dS)N)r�r�rr�)r!Zstatusr�r&r&r'r�I	szArgumentParser.exitcCs0|jtj�|j|d�}|jdtd�|�dS)z�error(message: string)

        Prints a usage message incorporating the message to stderr and
        exits.

        If you override this in a subclass, it should not return -- it
        should either exit or raise an exception.
        )rMr�r3z%(prog)s: error: %(message)s
N)r~r�rrMr�r)r!r�rYr&r&r'r>N	s	zArgumentParser.error)NN)NN)N)N)N)rN)!rr,r-r.rrOrrNr(rOrMrPr�rQrjrqr\rgrlrwrsrWrmrzr|r^r�r~r�r�r�r>r�r&r&)r�r'r1sP4

#w;,,4


	
)6r.�__version__�__all__�collectionsr�r�r��osr8�rerH�sysr��textwrapr�rrrrr
rrrrr�r�rr2rrrrr	r��	Exceptionrrrr�r�r�r�r�r�r�r�r�r�rr
rr+r-rr&r&r&r'�<module>>s�
n
	[#%`65"pathlib.cpython-36.opt-1.pyc000064400000117556150335715140011577 0ustar003

�\dh���@s$ddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
mZmZmZddlmZddlmZmZmZmZmZmZmZddlmZdZd	d
ddd
dgZdZ dZ!dZ"dd�Z#Gdd�de$�Z%Gdd�de%�Z&Gdd�de%�Z'e&�Z(e'�Z)Gdd�d�Z*Gdd�de*�Z+e+�Z,dd�Z-e.ed ��rTej/�e-�Z-Gd!d"�d"�Z0Gd#d$�d$�Z1Gd%d&�d&e0�Z2Gd'd(�d(e0�Z3Gd)d*�d*e0�Z4Gd+d,�d,e	�Z5Gd-d	�d	e$�Z6ej7j8e6�Gd.d
�d
e6�Z9Gd/d�de6�Z:Gd0d�de6�Z;Gd1d
�d
e;e9�Z<Gd2d�de;e:�Z=dS)3�N)�Sequence)�contextmanager)�EINVAL�ENOENT�ENOTDIR�ELOOP)�
attrgetter)�S_ISDIR�S_ISLNK�S_ISREG�S_ISSOCK�S_ISBLK�S_ISCHR�S_ISFIFO)�quote_from_bytesT�PurePath�
PurePosixPath�PureWindowsPath�Path�	PosixPath�WindowsPath��{i�cCsd|kpd|kpd|kS)N�*�?�[�)�patrr�/usr/lib64/python3.6/pathlib.py�_is_wildcard_pattern"src@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_FlavourzPA flavour implements a particular (platform-specific) set of path
    semantics.cCs|jj|_dS)N)�sep�join)�selfrrr�__init__,sz_Flavour.__init__cCs g}|j}|j}d}}t|�}x�|D]�}|s0q&|r@|j||�}|j|�\}}}	||	kr�xPt|	j|��D] }
|
rh|
dkrh|jtj|
��qhWn|	r�|	dkr�|jtj|	��|s�|r&|s�x6|D].}|s�q�|r�|j||�}|j|�d}|r�Pq�WPq&W|�s|�r|j||�|j	�|||fS)N��.r)
r!�altsep�reversed�replace�	splitroot�split�append�sys�intern�reverse)r#�partsZparsedr!r'�drv�root�it�partZrel�xrrr�parse_parts/s@

z_Flavour.parse_partscCs||r,|rr|rr||||g|dd�fSnF|rd||ksL|j|�|j|�krr||||dd�fSn||||fS|||fS)z�
        Join the two paths represented by the respective
        (drive, root, parts) tuples.  Return a new (drive, root, parts) tuple.
        �N)�casefold)r#r1r2r0Zdrv2Zroot2Zparts2rrr�join_parsed_partsUs
z_Flavour.join_parsed_partsN)�__name__�
__module__�__qualname__�__doc__r$r6r9rrrrr (s&r c@s�eZdZdZdZdZeZej	dkZ
edd�ee
d�e
d�d	�D��ed
d�ee
d�e
d�d	�D��BZd
Zddddhdd�ed	d�D�Bdd�ed	d�D�BZefdd�Zdd�Zdd�Zefdd�Zdd�Zd d!�Zd"d#�Zd$S)%�_WindowsFlavour�\�/T�ntccs|]}t|�VqdS)N)�chr)�.0r5rrr�	<genexpr>ssz_WindowsFlavour.<genexpr>�a�zr7ccs|]}t|�VqdS)N)rB)rCr5rrrrDts�A�Zz\\?\ZCONZPRNZAUXZNULcCsh|]}d|�qS)zCOM%dr)rC�irrr�	<setcomp>zsz_WindowsFlavour.<setcomp>�
cCsh|]}d|�qS)zLPT%dr)rCrIrrrrJ{scCsb|dd�}|dd�}||krP||krP|j|�\}}|dd�}|dd�}nd}|dd�}||kov||kov||k�r|j|d�}|dk�r|j||d�}||dk�r|dkr�t|�}|r�||d|�|||dd�fS|d|�|||dd�fSd}	}
|dk�r<||jk�r<|dd�}	|dd�}|}||k�rT|}
|j|�}||	|
|fS)	Nrr7�r%��:���rO)�_split_extended_path�find�len�
drive_letters�lstrip)r#r4r!�first�second�prefixZthird�indexZindex2r1r2rrrr*�s6
"

z_WindowsFlavour.splitrootcCs|j�S)N)�lower)r#�srrrr8�sz_WindowsFlavour.casefoldcCsdd�|D�S)NcSsg|]}|j��qSr)rY)rC�prrr�
<listcomp>�sz2_WindowsFlavour.casefold_parts.<locals>.<listcomp>r)r#r0rrr�casefold_parts�sz_WindowsFlavour.casefold_partscCsXd}|j|�rP|dd�}|dd�}|jd�rP||dd�7}d|dd�}||fS)Nr%�zUNC\rMr?)�
startswith)r#rZZ
ext_prefixrWrrrrP�s

z$_WindowsFlavour._split_extended_pathcCs6|sdS|djd�rdS|djd�dj�|jkS)NFrz\\r7r&rO)r_�	partition�upper�reserved_names)r#r0rrr�is_reserved�s
z_WindowsFlavour.is_reservedcCsd|j}t|�dkrJ|ddkrJ|j�dd�jd�}d|t|jd��fSdt|j�jd��SdS)NrLr7rNr@z
file:///%s/%szutf-8zfile:)�driverR�as_posixrT�urlquote_from_bytes�encode)r#�pathrd�restrrr�make_uri�sz_WindowsFlavour.make_uric
Cs�dtjkrtjd}n`dtjkr,tjd}nJdtjkrnytjd}Wntk
r\d}YnX|tjd}ntd��|r�tjd|kr�|j|f�\}}}|d
tjdkr�td	|��||d<|s�|r�|||j|dd��}n
|j|�}|S)N�HOMEZUSERPROFILEZHOMEPATHZ	HOMEDRIVEr%zCan't determine home directoryZUSERNAMEr7z%Can't determine home directory for %rrOrO)�os�environ�KeyError�RuntimeErrorr6r")r#�username�userhomer1r2r0rrr�
gethomedir�s,




z_WindowsFlavour.gethomedirN)r:r;r<r!r'�has_drv�ntpath�pathmodrl�name�is_supported�set�range�ordrSZext_namespace_prefixrbr*r8r]rPrcrjrrrrrrr>gs"
"&	'
r>c@sZeZdZdZdZdZeZej	dkZ
efdd�Zdd�Zd	d
�Z
dd�Zd
d�Zdd�ZdS)�
_PosixFlavourr@r%FrAcCsV|rH|d|krH|j|�}t|�t|�dkr<d|d|fSd||fSn
dd|fSdS)NrrLr%)rTrR)r#r4r!Z
stripped_partrrrr*�s
z_PosixFlavour.splitrootcCs|S)Nr)r#rZrrrr8	sz_PosixFlavour.casefoldcCs|S)Nr)r#r0rrrr]sz_PosixFlavour.casefold_partscCsdS)NFr)r#r0rrrrcsz_PosixFlavour.is_reservedcCst|�}dt|�S)Nzfile://)�bytesrf)r#rhZbpathrrrrjsz_PosixFlavour.make_uricCst|s:y
tjdStk
r6ddl}|jtj��jSXn6ddl}y|j|�jStk
rntd|��YnXdS)Nrkrz%Can't determine home directory for %r)	rlrmrn�pwd�getpwuid�getuid�pw_dir�getpwnamro)r#rpr}rrrrrs
z_PosixFlavour.gethomedirN)r:r;r<r!r'rs�	posixpathrurlrvrwr*r8r]rcrjrrrrrrr{�s
r{c@seZdZdZdS)�	_AccessorzjAn accessor implements a particular (system-specific or not) way of
    accessing paths on the filesystem.N)r:r;r<r=rrrrr�,sr�c@s�eZdZdd�Zdd�Zeej�Zeej�Zeej�Zeej	�Z	eej
�Z
eej�Zeed�rjeej
�Z
ndd�Z
eej�Zeej�Zeej�Zeej�Zeej�Zeed�r�ejZn
dd
d�Zeej�Zdd
�ZejZeejj�Zeejj�ZdS)�_NormalAccessorcstj���fdd��}t|�S)Ncs�t|�f|��S)N)�str)�pathobj�args)�strfuncrr�wrapped4sz._NormalAccessor._wrap_strfunc.<locals>.wrapped)�	functools�wraps�staticmethod)r�r�r)r�r�
_wrap_strfunc3sz_NormalAccessor._wrap_strfunccstj���fdd��}t|�S)Ncs�t|�t|�f|��S)N)r�)ZpathobjAZpathobjBr�)r�rrr�:sz5_NormalAccessor._wrap_binary_strfunc.<locals>.wrapped)r�r�r�)r�r�r)r�r�_wrap_binary_strfunc9sz$_NormalAccessor._wrap_binary_strfunc�lchmodcCstd��dS)Nz%lchmod() not available on this system)�NotImplementedError)r#r��moderrrr�Nsz_NormalAccessor.lchmod�symlinkFcCstd��dS)Nz)os.symlink() not available on this system)r�)r#�src�dst�target_is_directoryrrrr�^sz_NormalAccessor.symlinkcCs
tj|�S)N)rl�readlink)r#rhrrrr�esz_NormalAccessor.readlinkN)F)r:r;r<r�r�rl�stat�lstat�open�listdir�scandir�chmod�hasattrr��mkdir�unlink�rmdir�renamer)r��utimer��getcwdr�rh�
expanduser�realpathrrrrr�1s0














r�cCsP|d}|dd�}|dkr"t}n$d|kr4td��nt|�rBt}nt}|||�S)Nrr7z**z:Invalid pattern: '**' can only be an entire path component)�_RecursiveWildcardSelector�
ValueErrorr�_WildcardSelector�_PreciseSelector)�
pattern_partsr�child_parts�clsrrr�_make_selectorvs
r��	lru_cachec@s eZdZdZdd�Zdd�ZdS)�	_SelectorzYA selector matches a specific glob pattern part against the children
    of a given path.cCs.||_|rt|�|_d|_nt�|_d|_dS)NTF)r�r��	successor�dironly�_TerminatingSelector)r#r�rrrr$�s
z_Selector.__init__cCs<t|�}|j}|j}|jj}||�s,tg�S|j||||�S)zuIterate over all child paths of `parent_path` matched by this
        selector.  This can contain parent_path itself.)�type�is_dir�exists�	_accessorr��iter�_select_from)r#�parent_pathZpath_clsr�r�r�rrr�select_from�sz_Selector.select_fromN)r:r;r<r=r$r�rrrrr��s	r�c@seZdZdd�ZdS)r�ccs
|VdS)Nr)r#r�r�r�r�rrrr��sz!_TerminatingSelector._select_fromN)r:r;r<r�rrrrr��sr�c@seZdZdd�Zdd�ZdS)r�cCs||_tj||�dS)N)rvr�r$)r#rvr�rrrr$�sz_PreciseSelector.__init__ccs^yD|j|j�}|jr|n||�rBx |jj||||�D]
}|Vq4WWntk
rXdSXdS)N)�_make_child_relpathrvr�r�r��PermissionError)r#r�r�r�r�rhr[rrrr��sz_PreciseSelector._select_fromN)r:r;r<r$r�rrrrr��sr�c@seZdZdd�Zdd�ZdS)r�cCs"tjtj|��|_tj||�dS)N)�re�compile�fnmatch�	translaterr�r$)r#rr�rrrr$�sz_WildcardSelector.__init__ccs�y||jj}t||��}xb|D]Z}|js0|j�r|j}||�}	|jj|	�r|j|�}
x |j	j
|
|||�D]
}|VqhWqWWntk
r�dSXdS)N)�_flavourr8�listr�r�rvr�matchr�r�r�r�)r#r�r�r�r��cf�entries�entryrvZ
casefoldedrhr[rrrr��s

z_WildcardSelector._select_fromN)r:r;r<r$r�rrrrr��sr�c@s$eZdZdd�Zdd�Zdd�ZdS)r�cCstj||�dS)N)r�r$)r#rr�rrrr$�sz#_RecursiveWildcardSelector.__init__ccsz|VyZt||��}xH|D]@}|j�r|j�r|j|j�}x|j|||�D]
}|VqLWqWWntk
rtdSXdS)N)r�r��
is_symlinkr�rv�_iterate_directoriesr�)r#r�r�r�r�r�rhr[rrrr��s
z/_RecursiveWildcardSelector._iterate_directoriesc	cs�yjt�}zT|jj}xF|j|||�D]4}x.|||||�D]}||kr6|V|j|�q6Wq"WWd|j�XWntk
r~dSXdS)N)rxr�r�r��add�clearr�)	r#r�r�r�r�ZyieldedZsuccessor_selectZstarting_pointr[rrrr��sz'_RecursiveWildcardSelector._select_fromN)r:r;r<r$r�r�rrrrr��sr�c@s4eZdZdZdZdd�Zdd	�Zd
d�Zdd
�ZdS)�_PathParentszvThis object provides sequence-like access to the logical ancestors
    of a path.  Don't try to construct it yourself.�_pathcls�_drv�_root�_partscCs&t|�|_|j|_|j|_|j|_dS)N)r�r�r�r�r�)r#rhrrrr$�s
z_PathParents.__init__cCs(|js|jrt|j�dSt|j�SdS)Nr7)r�r�rRr�)r#rrr�__len__�sz_PathParents.__len__cCs@|dks|t|�krt|��|jj|j|j|jd|d��S)Nrr7)rR�
IndexErrorr��_from_parsed_partsr�r�r�)r#�idxrrr�__getitem__sz_PathParents.__getitem__cCsdj|jj�S)Nz<{}.parents>)�formatr�r:)r#rrr�__repr__
sz_PathParents.__repr__N)r�r�r�r�)	r:r;r<r=�	__slots__r$r�r�r�rrrrr��sr�c@s�eZdZdZdZZd	d
�Zdd�Zed
d��Zed[dd��Z	ed\dd��Z
edd��Zdd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zed&d'��Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zeed�d4d5�Zeed�d6d5�Zed7d8��Zed9d:��Z ed;d<��Z!ed=d>��Z"ed?d@��Z#dAdB�Z$dCdD�Z%dEdF�Z&edGdH��Z'dIdJ�Z(dKdL�Z)dMdN�Z*edOdP��Z+edQdR��Z,dSdT�Z-dUdV�Z.dWdX�Z/dYS)]ra|Base class for manipulating paths without I/O.

    PurePath represents a filesystem path and offers operations which
    don't imply any actual filesystem I/O.  Depending on your system,
    instantiating a PurePath will return either a PurePosixPath or a
    PureWindowsPath object.  You can also instantiate either of these classes
    directly, regardless of your system.
    r�r�r��_str�_hash�_pparts�_cached_cpartscGs$|tkrtjdkrtnt}|j|�S)z�Construct a PurePath from one or several strings and or existing
        PurePath objects.  The strings and path objects are combined so as
        to yield a canonicalized path, which is incorporated into the
        new PurePath object.
        rA)rrlrvrr�_from_parts)r�r�rrr�__new__szPurePath.__new__cCs|jt|j�fS)N)�	__class__�tupler�)r#rrr�
__reduce__&szPurePath.__reduce__cCshg}xV|D]N}t|t�r$||j7}q
tj|�}t|t�rH|jt|��q
tdt|���q
W|j	j
|�S)NzNargument should be a str object or an os.PathLike object returning str, not %r)�
isinstancerr�rl�fspathr�r,�	TypeErrorr�r�r6)r�r�r0rErrr�_parse_args+s



zPurePath._parse_argsTcCs<tj|�}|j|�\}}}||_||_||_|r8|j�|S)N)�objectr�r�r�r�r��_init)r�r��initr#r1r2r0rrrr�?s
zPurePath._from_partscCs,tj|�}||_||_||_|r(|j�|S)N)r�r�r�r�r�r�)r�r1r2r0r�r#rrrr�Ls
zPurePath._from_parsed_partscCs4|s|r$|||jj|dd��S|jj|�SdS)Nr7)r�r")r�r1r2r0rrr�_format_parsed_partsVszPurePath._format_parsed_partscCsdS)Nr)r#rrrr�]szPurePath._initcCs@|j|�\}}}|jj|j|j|j|||�\}}}|j|||�S)N)r�r�r9r�r�r�r�)r#r�r1r2r0rrr�_make_childaszPurePath._make_childcCs<y|jStk
r6|j|j|j|j�p,d|_|jSXdS)z[Return the string representation of the path, suitable for
        passing to system calls.r&N)r��AttributeErrorr�r�r�r�)r#rrr�__str__gszPurePath.__str__cCst|�S)N)r�)r#rrr�
__fspath__qszPurePath.__fspath__cCs|j}t|�j|jd�S)zNReturn the string representation of the path with forward (/)
        slashes.r@)r�r�r)r!)r#�frrrretszPurePath.as_posixcCstjt|��S)zaReturn the bytes representation of the path.  This is only
        recommended to use under Unix.)rl�fsencoder�)r#rrr�	__bytes__zszPurePath.__bytes__cCsdj|jj|j��S)Nz{}({!r}))r�r�r:re)r#rrrr�szPurePath.__repr__cCs|j�std��|jj|�S)z Return the path as a 'file' URI.z.relative path can't be expressed as a file URI)�is_absoluter�r�rj)r#rrr�as_uri�szPurePath.as_uricCs2y|jStk
r,|jj|j�|_|jSXdS)N)r�r�r�r]r�)r#rrr�_cparts�s
zPurePath._cpartscCs&t|t�stS|j|jko$|j|jkS)N)r�r�NotImplementedr�r�)r#�otherrrr�__eq__�s
zPurePath.__eq__cCs2y|jStk
r,tt|j��|_|jSXdS)N)r�r��hashr�r�)r#rrr�__hash__�s
zPurePath.__hash__cCs(t|t�s|j|jk	rtS|j|jkS)N)r�rr�r�r�)r#r�rrr�__lt__�szPurePath.__lt__cCs(t|t�s|j|jk	rtS|j|jkS)N)r�rr�r�r�)r#r�rrr�__le__�szPurePath.__le__cCs(t|t�s|j|jk	rtS|j|jkS)N)r�rr�r�r�)r#r�rrr�__gt__�szPurePath.__gt__cCs(t|t�s|j|jk	rtS|j|jkS)N)r�rr�r�r�)r#r�rrr�__ge__�szPurePath.__ge__z.The drive prefix (letter or UNC path), if any.)�doczThe root of the path, if any.cCs|j|j}|S)z/The concatenation of the drive and root, or ''.)r�r�)r#�anchorrrrr��szPurePath.anchorcCs.|j}t|�|js|jrdndkr&dS|dS)z!The final path component, if any.r7rr%rO)r�rRr�r�)r#r0rrrrv�sz
PurePath.namecCsD|j}|jd�}d|ko*t|�dknr<||d�SdSdS)z*The final component's last suffix, if any.r&rr7Nr%)rv�rfindrR)r#rvrIrrr�suffix�s

 zPurePath.suffixcCs:|j}|jd�rgS|jd�}dd�|jd�dd�D�S)z1A list of the final component's suffixes, if any.r&cSsg|]}d|�qS)r&r)rCr�rrrr\�sz%PurePath.suffixes.<locals>.<listcomp>r7N)rv�endswithrTr+)r#rvrrr�suffixes�s


zPurePath.suffixescCsD|j}|jd�}d|ko*t|�dknr<|d|�S|SdS)z0The final path component, minus its last suffix.r&rr7N)rvr�rR)r#rvrIrrr�stem�s

 z
PurePath.stemcCs�|jstd|f��|jj|f�\}}}|sZ|d|jj|jjgksZ|sZ|sZt|�dkrftd|��|j|j|j	|j
dd�|g�S)z-Return a new path with the file name changed.z%r has an empty namer7zInvalid name %rNrOrO)rvr�r�r6r!r'rRr�r�r�r�)r#rvr1r2r0rrr�	with_name�szPurePath.with_namecCs�|j}|j|ks |jr,|j|kr,td|��|r<|jd�sD|dkrPtd|��|j}|shtd|f��|j}|s|||}n|dt|��|}|j|j	|j
|jdd�|g�S)z�Return a new path with the file suffix changed.  If the path
        has no suffix, add given suffix.  If the given suffix is an empty
        string, remove the suffix from the path.
        zInvalid suffix %rr&z%r has an empty nameNr7rO)r�r!r'r�r_rvr�rRr�r�r�r�)r#r�r�rvZ
old_suffixrrr�with_suffix�s
zPurePath.with_suffixc
Gs�|std��|j}|j}|j}|r8||g|dd�}n|}|j|�\}}}|rf||g|dd�}	n|}	t|	�}
|jj}|
dkr�|p�|n||d|
��||	�kr�|j|||�}t	dj
t|�t|����|jd|
dkr�|nd||
d��S)z�Return the relative path to another path identified by the passed
        arguments.  If the operation is not possible (because this is not
        a subpath of the other path), raise ValueError.
        zneed at least one argumentr7Nrz{!r} does not start with {!r}r%)
r�r�r�r�r�rRr�r]r�r�r�r�r�)
r#r�r0r1r2Z	abs_partsZto_drvZto_rootZto_partsZto_abs_parts�nr�Z	formattedrrr�relative_tos(	(zPurePath.relative_tocCs.y|jStk
r(t|j�|_|jSXdS)zZAn object providing sequence-like access to the
        components in the filesystem path.N)r�r�r�r�)r#rrrr0"s
zPurePath.partscGs
|j|�S)z�Combine this path with one or several arguments, and return a
        new path representing either a subpath (if all arguments are relative
        paths) or a totally different path (if one of the arguments is
        anchored).
        )r�)r#r�rrr�joinpath.szPurePath.joinpathcCs|j|f�S)N)r�)r#�keyrrr�__truediv__6szPurePath.__truediv__cCs|j|g|j�S)N)r�r�)r#rrrr�__rtruediv__9szPurePath.__rtruediv__cCs@|j}|j}|j}t|�dkr*|s&|r*|S|j|||dd��S)zThe logical parent of the path.r7NrO)r�r�r�rRr�)r#r1r2r0rrr�parent<szPurePath.parentcCst|�S)z*A sequence of this path's logical parents.)r�)r#rrr�parentsFszPurePath.parentscCs|js
dS|jjpt|j�S)zSTrue if the path is absolute (has both a root and, if applicable,
        a drive).F)r�r�rs�boolr�)r#rrrr�KszPurePath.is_absolutecCs|jj|j�S)zaReturn True if the path contains one of the special names reserved
        by the system, if any.)r�rcr�)r#rrrrcRszPurePath.is_reservedc	Cs�|jj}||�}|jj|f�\}}}|s0td��|rF|||j�krFdS|r\|||j�kr\dS|j}|sj|r�t|�t|�kr~dS|dd�}nt|�t|�kr�dSx.tt	|�t	|��D]\}}t
j||�s�dSq�WdS)zE
        Return True if this path matches the given pattern.
        z
empty patternFr7NT)r�r8r6r�r�r�r�rR�zipr(r�Zfnmatchcase)	r#Zpath_patternr�r1r2Z	pat_partsr0r4rrrrr�Ws(zPurePath.matchN)r�r�r�r�r�r�r�)T)T)0r:r;r<r=r�r�r��classmethodr�r�r�r�r�r�r�r�rer�r�r��propertyr�r�r�r�r�r�r�rrdr2r�rvr�rrrrrr0rr	r
rrr�rcr�rrrrrs^
	
	
	
 
c@seZdZdZeZfZdS)rz�PurePath subclass for non-Windows systems.

    On a POSIX system, instantiating a PurePath should return this object.
    However, you can also instantiate it directly on any system.
    N)r:r;r<r=�_posix_flavourr�r�rrrrrusc@seZdZdZeZfZdS)rz�PurePath subclass for Windows systems.

    On a Windows system, instantiating a PurePath should return this object.
    However, you can also instantiate it directly on any system.
    N)r:r;r<r=�_windows_flavourr�r�rrrrrsc@s�eZdZdZdaZdd�Zdbdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dcdd�Zdddd�Ze
dd��Ze
dd��Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zded&d'�Zd(d)�Zd*d+�Zd,d-�Zdgd0d1�Zd2d3�Zdhd4d5�Zd6d7�Zdid8d9�Zdjd;d<�Zdkd=d>�Zd?d@�Z dAdB�Z!dCdD�Z"dEdF�Z#dGdH�Z$dIdJ�Z%dKdL�Z&dldMdN�Z'dOdP�Z(dQdR�Z)dSdT�Z*dUdV�Z+dWdX�Z,dYdZ�Z-d[d\�Z.d]d^�Z/d_d`�Z0dS)mra�PurePath subclass that can make system calls.

    Path represents a filesystem path but unlike PurePath, also offers
    methods to do system calls on path objects. Depending on your system,
    instantiating a Path will return either a PosixPath or a WindowsPath
    object. You can also instantiate a PosixPath or WindowsPath directly,
    but cannot instantiate a WindowsPath on a POSIX system or vice versa.
    r��_closedcOsL|tkrtjdkrtnt}|j|dd�}|jjs@td|j	f��|j
�|S)NrAF)r�z$cannot instantiate %r on your system)rrlrvrrr�r�rwr�r:r�)r�r��kwargsr#rrrr��szPath.__new__NcCs"d|_|dk	r|j|_nt|_dS)NF)rr��_normal_accessor)r#�templaterrrr��s
z
Path._initcCs|j|g}|j|j|j|�S)N)r�r�r�r�)r#r4r0rrrr��szPath._make_child_relpathcCs|jr|j�|S)N)r�
_raise_closed)r#rrr�	__enter__�szPath.__enter__cCs
d|_dS)NT)r)r#�t�v�tbrrr�__exit__�sz
Path.__exit__cCstd��dS)NzI/O operation on closed path)r�)r#rrrr�szPath._raise_closed�cCs|jj|||�S)N)r�r�)r#rv�flagsr�rrr�_opener�szPath._opener�cCs|jr|j�|jj|||�S)zm
        Open the file pointed by this path and return a file descriptor,
        as os.open() does.
        )rrr�r�)r#rr�rrr�	_raw_open�szPath._raw_opencCs|tj��S)zjReturn a new path pointing to the current working directory
        (as returned by os.getcwd()).
        )rlr�)r�rrr�cwd�szPath.cwdcCs||�jjd��S)zrReturn a new path pointing to the user's home directory (as
        returned by os.path.expanduser('~')).
        N)r�rr)r�rrr�home�sz	Path.homecCsB|j�}y|j�}Wntk
r2tj|�}YnXtjj||�S)zoReturn whether other_path is the same or not as this file
        (as returned by os.path.samefile()).
        )r�r�rlrh�samestat)r#Z
other_path�stZother_strrr�samefile�sz
Path.samefileccsL|jr|j�x8|jj|�D](}|dkr*q|j|�V|jr|j�qWdS)zyIterate over the files in this directory.  Does not yield any
        result for the special paths '.' and '..'.
        r&�..N>r&r')rrr�r�r�)r#rvrrr�iterdir�szPath.iterdirccsl|stdj|���|jj|�}|jj|f�\}}}|s:|rBtd��tt|��}x|j|�D]
}|VqZWdS)z�Iterate over this subtree and yield all existing files (of any
        kind, including directories) matching the given pattern.
        zUnacceptable pattern: {!r}z%Non-relative patterns are unsupportedN)	r�r�r�r8r6r�r�r�r�)r#�patternr1r2r��selectorr[rrr�glob�sz	Path.globccs^|jj|�}|jj|f�\}}}|s(|r0td��tdt|��}x|j|�D]
}|VqLWdS)z�Recursively yield all existing files (of any kind, including
        directories) matching the given pattern, anywhere in this subtree.
        z%Non-relative patterns are unsupported�**N)r,)r�r8r6r�r�r�r�)r#r)r1r2r�r*r[rrr�rglobsz
Path.rglobcCsD|jr|j�|j�r|S|jtj�g|jdd�}|j|d�|S)aReturn an absolute version of this path.  This function works
        even if the path doesn't point to anything.

        No normalization is done, i.e. all '.' and '..' will be kept along.
        Use resolve() to get the canonical path to a file.
        F)r�)r)rrr�r�rlr�r�r�)r#�objrrr�absolutesz
Path.absoluteFcCs�|jr|j�dd�}y|jj||d�}Wn,tk
rV}z||��WYdd}~XnX|j|f�}|s�y|j�Wn*tk
r�}z||�WYdd}~XnX|S)z�
        Make the path absolute, resolving all symlinks on the way and also
        normalizing it (for example turning slashes into backslashes under
        Windows).
        cSs0t|dd�}|jtks|tkr,td|j��dS)N�winerrorrzSymlink loop from %r)�getattr�errnor�_WINERROR_CANT_RESOLVE_FILENAMEro�filename)�er0rrr�check_eloop*sz!Path.resolve.<locals>.check_eloop)�strictN)rrr�r��OSErrorr�r�)r#r7r6rZr5r[rrr�resolve!szPath.resolvecCs|jj|�S)zh
        Return the result of the stat() system call on this path, like
        os.stat() does.
        )r�r�)r#rrrr�?sz	Path.statcCsddl}|j|j�j�jS)z:
        Return the login name of the file owner.
        rN)r}r~r��st_uidZpw_name)r#r}rrr�ownerFsz
Path.ownercCsddl}|j|j�j�jS)z8
        Return the group name of the file gid.
        rN)�grpZgetgrgidr��st_gidZgr_name)r#r<rrr�groupMsz
Path.group�rr7c	Cs,|jr|j�tjt|�||||||jd�S)z|
        Open the file pointed by this path and return a file object, as
        the built-in open() function does.
        )�opener)rr�ior�r�r)r#r��	buffering�encoding�errors�newlinerrrr�Tsz	Path.openc	Cs |jdd��
}|j�SQRXdS)zK
        Open the file in bytes mode, read it, and close the file.
        �rb)r�N)r��read)r#r�rrr�
read_bytes_szPath.read_bytesc	Cs$|jd||d��
}|j�SQRXdS)zJ
        Open the file in text mode, read it, and close the file.
        r?)r�rCrDN)r�rG)r#rCrDr�rrr�	read_textfszPath.read_textc	Cs*t|�}|jdd��}|j|�SQRXdS)zO
        Open the file in bytes mode, write to it, and close the file.
        �wb)r�N)�
memoryviewr��write)r#�dataZviewr�rrr�write_bytesmszPath.write_bytesc	Cs@t|t�std|jj��|jd||d��}|j|�SQRXdS)zN
        Open the file in text mode, write to it, and close the file.
        zdata must be str, not %s�w)r�rCrDN)r�r�r�r�r:r�rL)r#rMrCrDr�rrr�
write_textvs

zPath.write_textTcCsr|jr|j�|r>y|jj|d�Wntk
r8YnXdStjtjB}|sX|tjO}|j	||�}tj
|�dS)zS
        Create this file with the given access mode, if it doesn't exist.
        N)rrr�r�r8rl�O_CREAT�O_WRONLY�O_EXCLr!�close)r#r��exist_okr�fdrrr�touch�s
z
Path.touchcCs�|jr|j�y|jj||�Wnjtk
rf|s@|j|krB�|jjddd�|j|d|d�Yn&tk
r�|s�|j�r��YnXdS)z<
        Create a new directory at this given path.
        T)rrUFN)rrr�r��FileNotFoundErrorrr8r�)r#r�rrUrrrr��sz
Path.mkdircCs |jr|j�|jj||�dS)zF
        Change the permissions of the path, like os.chmod().
        N)rrr�r�)r#r�rrrr��sz
Path.chmodcCs |jr|j�|jj||�dS)z�
        Like chmod(), except if the path points to a symlink, the symlink's
        permissions are changed, rather than its target's.
        N)rrr�r�)r#r�rrrr��szPath.lchmodcCs|jr|j�|jj|�dS)zd
        Remove this file or link.
        If the path is a directory, use rmdir() instead.
        N)rrr�r�)r#rrrr��szPath.unlinkcCs|jr|j�|jj|�dS)zF
        Remove this directory.  The directory must be empty.
        N)rrr�r�)r#rrrr��sz
Path.rmdircCs|jr|j�|jj|�S)z�
        Like stat(), except if the path points to a symlink, the symlink's
        status information is returned, rather than its target's.
        )rrr�r�)r#rrrr��sz
Path.lstatcCs |jr|j�|jj||�dS)z5
        Rename this path to the given path.
        N)rrr�r�)r#�targetrrrr��szPath.renamecCs |jr|j�|jj||�dS)zo
        Rename this path to the given path, clobbering the existing
        destination if it exists.
        N)rrr�r))r#rYrrrr)�szPath.replacecCs"|jr|j�|jj|||�dS)z�
        Make this path a symlink pointing to the given path.
        Note the order of arguments (self, target) is the reverse of os.symlink's.
        N)rrr�r�)r#rYr�rrr�
symlink_to�szPath.symlink_tocCsBy|j�Wn0tk
r<}z|jttfkr.�dSd}~XnXdS)z+
        Whether this path exists.
        FNT)r�r8r2rr)r#r5rrrr��szPath.existscCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z3
        Whether this path is a directory.
        FN)r	r��st_moder8r2rr)r#r5rrrr��szPath.is_dircCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)zq
        Whether this path is a regular file (also True for symlinks pointing
        to regular files).
        FN)rr�r[r8r2rr)r#r5rrr�is_file
szPath.is_filecCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z7
        Whether this path is a symbolic link.
        FN)r
r�r[r8r2rr)r#r5rrrr�szPath.is_symlinkcCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z6
        Whether this path is a block device.
        FN)r
r�r[r8r2rr)r#r5rrr�is_block_device$szPath.is_block_devicecCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z:
        Whether this path is a character device.
        FN)rr�r[r8r2rr)r#r5rrr�is_char_device1szPath.is_char_devicecCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z.
        Whether this path is a FIFO.
        FN)rr�r[r8r2rr)r#r5rrr�is_fifo>szPath.is_fifocCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z0
        Whether this path is a socket.
        FN)rr�r[r8r2rr)r#r5rrr�	is_socketKszPath.is_socketcCsb|jp
|jr^|jr^|jddd�dkr^|jj|jddd��}|j|g|jdd��S|S)zl Return a new path with expanded ~ and ~user constructs
        (as returned by os.path.expanduser)
        rNr7�~)r�r�r�r�rrr�)r#Zhomedirrrrr�Xs
zPath.expanduser)r�r)N)r)r )FrO)r?rONNN)NN)NN)rT)r FF)F)1r:r;r<r=r�r�r�r�rrrrr!rr"r#r&r(r+r-r/r9r�r;r>r�rHrIrNrPrWr�r�r�r�r�r�r�r)rZr�r�r\r�r]r^r_r`r�rrrrr�s^






	



				





c@seZdZdZfZdS)rzsPath subclass for non-Windows systems.

    On a POSIX system, instantiating a Path should return this object.
    N)r:r;r<r=r�rrrrrdsc@s$eZdZdZfZdd�Zdd�ZdS)rzqPath subclass for Windows systems.

    On a Windows system, instantiating a Path should return this object.
    cCstd��dS)Nz*Path.owner() is unsupported on this system)r�)r#rrrr;rszWindowsPath.ownercCstd��dS)Nz*Path.group() is unsupported on this system)r�)r#rrrr>uszWindowsPath.groupN)r:r;r<r=r�r;r>rrrrrks)>r�r�rArtrlr�r�r-�collectionsr�
contextlibrr2rrrr�operatorrr�r	r
rrr
rrZurllib.parserrfZsupports_symlinks�__all__Z_WINERROR_NOT_READYZ_WINERROR_INVALID_NAMEr3rr�r r>r{rrr�r�rr�r�r�r�r�r�r�r�r�r�PathLike�registerrrrrrrrrr�<module>sd$
?6>
%f

[quopri.cpython-36.opt-2.pyc000064400000010724150335715140011461 0ustar003


 \^�@s�ddddgZdZdZdZdZydd	lmZmZWnek
rLd
Zd
ZYnXdd�Z	d
d�Z
ddd�Zddd�Zddd�Z
ddd�Zdd�Zdd�Zdd�Zedkr�e�d
S)�encode�decode�encodestring�decodestring�=�Ls0123456789ABCDEF��)�a2b_qp�b2a_qpNcCs:|dkr|S|dkr|S|tkp8d|ko2dknS)Ns 	�_� �~)�ESCAPE)�c�	quotetabs�header�r�/usr/lib64/python3.6/quopri.py�needsquotings
rcCs(t|�}ttt|dt|df�S)N�)�ordr�bytes�HEX)rrrr�quote$srFc
Cs<tdk	r,|j�}t|||d�}|j|�dS|dfdd�}d}x�|j�}|sNPg}	d}
|dd�dkrv|dd�}d}
xL|D]D}t|f�}t|||�r�t|�}|r�|dkr�|	jd�q||	j|�q|W|dk	r�||�tj	|	�}x:t
|�tk�r||dtd�d	d
�|tdd�}q�W|}q@W|dk	�r8|||
d
�dS)
N)rr�
cSsj|r<|dd�dkr<|j|dd�t|dd��|�n*|dkrX|jt|�|�n|j||�dS)N�s 	�.���rr)�writer)�s�output�lineEndrrrr;s
(zencode.<locals>.writerrrrs=
)r!rr)r
�readr�readlinerrr�append�EMPTYSTRING�join�len�MAXLINESIZE)
�inputr rr�data�odatarZprevline�lineZoutline�strippedrZthislinerrrr,s@	





cCsFtdk	rt|||d�Sddlm}||�}|�}t||||�|j�S)N)rrr)�BytesIO)r
�ior.r�getvalue)rrrr.�infp�outfprrrrjscCstdk	r*|j�}t||d�}|j|�dSd}�x�|j�}|s@Pdt|�}}|dkr�||d|�dkr�d}	|d}x.|dkr�||d|�dkr�|d}qxWnd}	�x.||k�r�|||d�}
|
dkr�|r�|d}|d}q�|
tk�r�||
}|d}q�|d|k�r|	�rd}	Pq�|d|k�rV||d|d	�tk�rV|t}|d	}q�|d	|k�r�t||d|d	���r�t||d	|d
���r�|tt||d|d
��f�}|d
}q�||
}|d}q�W|	s2|j|d�d}q2W|�r|j|�dS)N)rrrrrs 	
rr��)	r	r"rr#r'r�ishexr�unhex)r)r rr*r+�newr,�i�n�partialrrrrrusR



(
B"
cCsDtdk	rt||d�Sddlm}||�}|�}t|||d�|j�S)N)rr)r.)r	r/r.rr0)rrr.r1r2rrrr�scCsHd|kodknpFd|ko*dknpFd|koBdkSS)N�0�9�a�f�A�Fr)rrrrr5�sr5cCs�d}x�|D]�}t|f�}d|ko*dknr:td�}nLd|koLdknr`td�d}n&d	|kord
knr�td	�d}n|dt|�|}q
W|S)Nrr;r<�0r=r>�a�
r?r@r)rr)r�bitsrr8rrrr6�s


r6c(Cs�ddl}ddl}y|j|jdd�d�\}}WnV|jk
r�}z8|j|_t|�td�td�td�|jd�WYdd}~XnXd}d}x(|D] \}}|dkr�d}|d	kr�d}q�W|r�|r�|j|_td
�|jd�|s�dg}d}	x�|D]�}
|
dk�r|jj	}nNyt
|
d�}Wn>tk
�rR}z |jjd
|
|f�d}	w�WYdd}~XnXz*|�rlt
||jj	�nt||jj	|�Wd|
dk�r�|j�Xq�W|	�r�|j|	�dS)NrrZtdz"usage: quopri [-t | -d] [file] ...z-t: quote tabsz-d: decode; default encoder3z-tz-dz -t and -d are mutually exclusive�-�rbz%s: can't open (%s)
)�sys�getopt�argv�error�stderr�stdout�print�exit�stdin�buffer�open�OSErrorrrr�close)rGrHZopts�args�msgZdecoZtabs�orB�sts�file�fprrr�main�sT




rZ�__main__)F)FF)F)F)�__all__rr(rr%Zbinasciir	r
�ImportErrorrrrrrrr5r6rZ�__name__rrrr�<module>s(

>

+
.sunau.cpython-36.opt-1.pyc000064400000041054150335715140011274 0ustar003


 \�F�@s�dZddlmZedd�ZdZdZdZdZd	Zd
Z	dZ
dZd
ZdZ
dZdZdZdZeeeee	egZGdd�de�Zdd�Zdd�ZGdd�d�ZGdd�d�Zd dd�ZeZdS)!a�Stuff to parse Sun and NeXT audio files.

An audio file consists of a header followed by the data.  The structure
of the header is as follows.

        +---------------+
        | magic word    |
        +---------------+
        | header size   |
        +---------------+
        | data size     |
        +---------------+
        | encoding      |
        +---------------+
        | sample rate   |
        +---------------+
        | # of channels |
        +---------------+
        | info          |
        |               |
        +---------------+

The magic word consists of the 4 characters '.snd'.  Apart from the
info field, all header fields are 4 bytes in size.  They are all
32-bit unsigned integers encoded in big-endian byte order.

The header size really gives the start of the data.
The data size is the physical size of the data.  From the other
parameters the number of frames can be calculated.
The encoding gives the way in which audio samples are encoded.
Possible values are listed below.
The info field currently consists of an ASCII string giving a
human-readable description of the audio file.  The info field is
padded with NUL bytes to the header size.

Usage.

Reading audio files:
        f = sunau.open(file, 'r')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods read(), seek(), and close().
When the setpos() and rewind() methods are not used, the seek()
method is not  necessary.

This returns an instance of a class with the following public methods:
        getnchannels()  -- returns number of audio channels (1 for
                           mono, 2 for stereo)
        getsampwidth()  -- returns sample width in bytes
        getframerate()  -- returns sampling frequency
        getnframes()    -- returns number of audio frames
        getcomptype()   -- returns compression type ('NONE' or 'ULAW')
        getcompname()   -- returns human-readable version of
                           compression type ('not compressed' matches 'NONE')
        getparams()     -- returns a namedtuple consisting of all of the
                           above in the above order
        getmarkers()    -- returns None (for compatibility with the
                           aifc module)
        getmark(id)     -- raises an error since the mark does not
                           exist (for compatibility with the aifc module)
        readframes(n)   -- returns at most n frames of audio
        rewind()        -- rewind to the beginning of the audio stream
        setpos(pos)     -- seek to the specified position
        tell()          -- return the current position
        close()         -- close the instance (make it unusable)
The position returned by tell() and the position given to setpos()
are compatible and have nothing to do with the actual position in the
file.
The close() method is called automatically when the class instance
is destroyed.

Writing audio files:
        f = sunau.open(file, 'w')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods write(), tell(), seek(), and
close().

This returns an instance of a class with the following public methods:
        setnchannels(n) -- set the number of channels
        setsampwidth(n) -- set the sample width
        setframerate(n) -- set the frame rate
        setnframes(n)   -- set the number of frames
        setcomptype(type, name)
                        -- set the compression type and the
                           human-readable compression type
        setparams(tuple)-- set all parameters at once
        tell()          -- return current position in output file
        writeframesraw(data)
                        -- write audio frames without pathing up the
                           file header
        writeframes(data)
                        -- write audio frames and patch up the file header
        close()         -- patch up the file header and close the
                           output file
You should set the parameters before the first writeframesraw or
writeframes.  The total number of frames does not need to be set,
but when it is set to the correct value, the header does not have to
be patched up.
It is best to first set all parameters, perhaps possibly the
compression type, and then write audio frames using writeframesraw.
When all frames have been written, either call writeframes(b'') or
close() to patch up the sizes in the header.
The close() method is called automatically when the class instance
is destroyed.
�)�
namedtuple�
_sunau_paramsz7nchannels sampwidth framerate nframes comptype compnameidns.������������l��c@seZdZdS)�ErrorN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/sunau.pyr�srcCs<d}x2td�D]&}|jd�}|s$t�|dt|�}qW|S)Nrrr�)�range�read�EOFError�ord)�file�x�iZbyterrr�	_read_u32�s
rcCsJg}x2td�D]&}t|d�\}}|jdt|��|}qW|jt|��dS)Nrrr)r�divmod�insert�int�write�bytes)rr�datar�d�mrrr�
_write_u32�sr'c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)S)*�Au_readcCs@t|�td�kr,ddl}|j|d�}d|_nd|_|j|�dS)N�r�rbTF)�type�builtins�open�_opened�initfp)�self�fr,rrr�__init__�szAu_read.__init__cCs|jr|j�dS)N)�_file�close)r0rrr�__del__�szAu_read.__del__cCs|S)Nr)r0rrr�	__enter__�szAu_read.__enter__cGs|j�dS)N)r4)r0�argsrrr�__exit__�szAu_read.__exit__cCs�||_d|_tt|��}|tkr(td��tt|��|_|jdkrHtd��|jdkrZtd��t|�|_|jtkrzt|j�|_tt|��|_	|j	t
kr�td��|j	ttfkr�d|_
d	|_nj|j	tkr�d	|_|_
nR|j	tkr�d|_|_
n:|j	tkr�d
|_|_
n"|j	tk�rd|_|_
ntd��tt|��|_tt|��|_|j|j|_|jdk�r~|j|jd�|_|jjd
�\|_}}nd|_y|j�|_Wn ttfk
�r�d|_YnXdS)Nrzbad magic numberrzheader size too small�dzheader size ridiculously largezencoding not (yet) supportedrrrrzunknown encoding��)r3�	_soundposr!r�AUDIO_FILE_MAGICrZ	_hdr_size�
_data_size�AUDIO_UNKNOWN_SIZE�	_encoding�_simple_encodings�AUDIO_FILE_ENCODING_MULAW_8�AUDIO_FILE_ENCODING_ALAW_8�
_sampwidth�
_framesize�AUDIO_FILE_ENCODING_LINEAR_8�AUDIO_FILE_ENCODING_LINEAR_16�AUDIO_FILE_ENCODING_LINEAR_24�AUDIO_FILE_ENCODING_LINEAR_32�
_framerate�
_nchannelsr�_info�	partition�tell�	_data_pos�AttributeError�OSError)r0r�magic�_rrrr/�sP







zAu_read.initfpcCs|jS)N)r3)r0rrr�getfp�sz
Au_read.getfpcCs|jS)N)rK)r0rrr�getnchannels�szAu_read.getnchannelscCs|jS)N)rD)r0rrr�getsampwidth�szAu_read.getsampwidthcCs|jS)N)rJ)r0rrr�getframerate�szAu_read.getframeratecCs(|jtkrtS|jtkr$|j|jSdS)Nr)r>r?r@rArE)r0rrr�
getnframes�s


zAu_read.getnframescCs$|jtkrdS|jtkrdSdSdS)N�ULAW�ALAW�NONE)r@rBrC)r0rrr�getcomptype�s


zAu_read.getcomptypecCs$|jtkrdS|jtkrdSdSdS)NzCCITT G.711 u-lawzCCITT G.711 A-lawznot compressed)r@rBrC)r0rrr�getcompname�s


zAu_read.getcompnamecCs*t|j�|j�|j�|j�|j�|j��S)N)rrUrVrWrXr\r])r0rrr�	getparamsszAu_read.getparamscCsdS)Nr)r0rrr�
getmarkersszAu_read.getmarkerscCstd��dS)Nzno marks)r)r0�idrrr�getmarkszAu_read.getmarkcCsp|jtkrl|tkr|jj�}n|jj||j�}|jt|�|j7_|jtkrhddl	}|j
||j�}|SdS)Nr)r@rAr?r3rrEr<�lenrB�audioopZulaw2linrD)r0�nframesr$rcrrr�
readframess

zAu_read.readframescCs*|jdkrtd��|jj|j�d|_dS)Nzcannot seekr)rOrQr3�seekr<)r0rrr�rewinds
zAu_read.rewindcCs|jS)N)r<)r0rrrrNszAu_read.tellcCsP|dks||j�krtd��|jdkr.td��|jj|j||j�||_dS)Nrzposition not in rangezcannot seek)rXrrOrQr3rfrEr<)r0�posrrr�setpos!s
zAu_read.setposcCs"|j}|rd|_|jr|j�dS)N)r3r.r4)r0rrrrr4)s
z
Au_read.closeN)rrrr2r5r6r8r/rTrUrVrWrXr\r]r^r_rarergrNrir4rrrrr(�s(	,
r(c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3S)4�Au_writecCs@t|�td�kr,ddl}|j|d�}d|_nd|_|j|�dS)Nr)r�wbTF)r+r,r-r.r/)r0r1r,rrrr22szAu_write.__init__cCs|jr|j�d|_dS)N)r3r4)r0rrrr5;szAu_write.__del__cCs|S)Nr)r0rrrr6@szAu_write.__enter__cGs|j�dS)N)r4)r0r7rrrr8CszAu_write.__exit__cCsF||_d|_d|_d|_d|_t|_d|_d|_d|_	d|_
d|_dS)Nrr;rY)r3rJrKrDrEr?�_nframes�_nframeswritten�_datawritten�_datalengthrL�	_comptype)r0rrrrr/FszAu_write.initfpcCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerrrz"only 1, 2, or 4 channels supported)rrr)rmrrK)r0�	nchannelsrrr�setnchannelsSs
zAu_write.setnchannelscCs|jstd��|jS)Nznumber of channels not set)rKr)r0rrrrUZszAu_write.getnchannelscCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerrrrzbad sample width)rrrr)rmrrD)r0�	sampwidthrrr�setsampwidth_s
zAu_write.setsampwidthcCs|jstd��|jS)Nzsample width not specified)rJrrD)r0rrrrVfszAu_write.getsampwidthcCs|jrtd��||_dS)Nz0cannot change parameters after starting to write)rmrrJ)r0�	frameraterrr�setframeratekszAu_write.setframeratecCs|jstd��|jS)Nzframe rate not set)rJr)r0rrrrWpszAu_write.getframeratecCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerz# of frames cannot be negative)rmrrl)r0rdrrr�
setnframesus
zAu_write.setnframescCs|jS)N)rm)r0rrrrX|szAu_write.getnframescCs|dkr||_ntd��dS)Nr[rYzunknown compression type)r[rY)rpr)r0r+�namerrr�setcomptypeszAu_write.setcomptypecCs|jS)N)rp)r0rrrr\�szAu_write.getcomptypecCs$|jdkrdS|jdkrdSdSdS)NrYzCCITT G.711 u-lawrZzCCITT G.711 A-lawznot compressed)rp)r0rrrr]�s


zAu_write.getcompnamecCsH|\}}}}}}|j|�|j|�|j|�|j|�|j||�dS)N)rrrtrvrwry)r0ZparamsrqrsrurdZcomptypeZcompnamerrr�	setparams�s



zAu_write.setparamscCs*t|j�|j�|j�|j�|j�|j��S)N)rrUrVrWrXr\r])r0rrrr^�szAu_write.getparamscCs|jS)N)rm)r0rrrrN�sz
Au_write.tellcCs~t|ttf�st|�jd�}|j�|jdkrDddl}|j||j	�}t
|�|j}|jj
|�|j||_|jt
|�|_dS)N�BrYr)�
isinstancer#�	bytearray�
memoryview�cast�_ensure_header_writtenrprcZlin2ulawrDrbrEr3r"rmrn)r0r$rcrdrrr�writeframesraw�s
zAu_write.writeframesrawcCs.|j|�|j|jks"|j|jkr*|j�dS)N)r�rmrlrorn�_patchheader)r0r$rrr�writeframes�s
zAu_write.writeframescCs^|jrZz6|j�|j|jks(|j|jkr0|j�|jj�Wd|j}d|_|jrX|j	�XdS)N)
r3r�rmrlrornr��flushr.r4)r0rrrrr4�szAu_write.closecCs<|js8|jstd��|js"td��|js0td��|j�dS)Nz# of channels not specifiedzsample width not specifiedzframe rate not specified)rmrKrrDrJ�
_write_header)r0rrrr��szAu_write._ensure_header_writtenc
Cs�|jdkrl|jdkr t}d|_q�|jdkr6t}d|_q�|jdkrLt}d|_q�|jdkrbt}d|_q�td��n|jdkr�t}d|_ntd��|j|j	|_t
|jt�dt
|j�}|d	d@}t
|j|�|jtkr�t}n|j|j}y|jj�|_Wn ttfk
�rd|_YnXt
|j|�||_t
|j|�t
|j|j�t
|j|j	�|jj|j�|jjd
|t
|j�d�dS)
Nr[rrrrzinternal errorrYr
r
r:ri����)rprDrFrErGrHrIrrBrKr'r3r=rbrLrlr?rN�_form_length_posrPrQrorJr")r0�encodingZheader_sizeZlengthrrrr��sJ







zAu_write._write_headercCsH|jdkrtd��|jj|j�t|j|j�|j|_|jjdd�dS)Nzcannot seekrr)r�rQr3rfr'rnro)r0rrrr��s
zAu_write._patchheaderN)rrrr2r5r6r8r/rrrUrtrVrvrWrwrXryr\r]rzr^rNr�r�r4r�r�r�rrrrrj0s2	

*rjNcCsJ|dkrt|d�r|j}nd}|dkr.t|�S|dkr>t|�Std��dS)	N�moder*�r�wrkz$mode must be 'r', 'rb', 'w', or 'wb')r�r*)r�rk)�hasattrr�r(rjr)r1r�rrrr-s
r-)N)�__doc__�collectionsrrr=rBrFrGrHrIZAUDIO_FILE_ENCODING_FLOATZAUDIO_FILE_ENCODING_DOUBLEZAUDIO_FILE_ENCODING_ADPCM_G721ZAUDIO_FILE_ENCODING_ADPCM_G722Z AUDIO_FILE_ENCODING_ADPCM_G723_3Z AUDIO_FILE_ENCODING_ADPCM_G723_5rCr?rA�	Exceptionrrr'r(rjr-Zopenfprrrr�<module>hs@	Q

tempfile.cpython-36.opt-2.pyc000064400000040631150335715140011747 0ustar003

�\dh�m�@s>dddddddddd	d
ddg
Zd
dlZd
dlZd
dlZd
dlZd
dl	Z
d
dlZd
dl
mZd
dlZyd
dlZWnek
r�d
dlZYnXejZejejBejBZeed�r�eejOZeZeed�r�eejOZeed�r�ejZndZdZ e�Z!eed��rej"Z#need��rej$Z#ndd�Z#dd�Z%dd�Z&dd�Z'Gdd�d�Z(d d!�Z)d"d#�Z*da+d$d%�Z,d&d'�Z-d(d)�Z.d*d+�Z/d,d�Z0d-d�Z1da2d.d
�Z3d/d�Z4dCd1d�Z5dDd2d�Z6d3e dfd4d�Z7Gd5d6�d6�Z8Gd7d8�d8�Z9dFd<d�Z:ej;d=k�sej<j=d>k�re:Z>need?�a?dHd@d�Z>GdAd�d�Z@GdBd�deA�ZBdS)I�NamedTemporaryFile�
TemporaryFile�SpooledTemporaryFile�TemporaryDirectory�mkstemp�mkdtemp�mktemp�TMP_MAX�
gettempprefix�tempdir�
gettempdir�gettempprefixb�gettempdirb�N)�Random�
O_NOFOLLOW�O_BINARYi'Ztmp�lstat�statcCstj|tj�}tj|�dS)N)�_os�open�O_RDONLY�close)�fn�fd�r� /usr/lib64/python3.6/tempfile.py�_statTsrcCs*yt|�Wntk
r dSXdSdS)NFT)r�OSError)rrrr�_existsXs
rcGs`d}xJ|D]B}|dkrq
t|t�r8|tkr2td��t}q
|tkrHtd��t}q
W|dkr\tS|S)Nz1Can't mix bytes and non-bytes in path components.)�
isinstance�bytes�str�	TypeError)�argsZreturn_type�argrrr�_infer_return_typeas

r%cCsdt|||�}|dkr|�}|dkr:|tkr0t}n
tjt�}|dkrX|tkrRt�}nt�}||||fS)N)r%r!�templater�fsencoderr
)�prefix�suffix�dir�output_typerrr�_sanitize_paramsvs
r,c@s,eZdZdZedd��Zdd�Zdd�ZdS)	�_RandomNameSequenceZ%abcdefghijklmnopqrstuvwxyz0123456789_cCs,tj�}|t|dd�kr&t�|_||_|jS)N�_rng_pid)r�getpid�getattr�_RandomZ_rngr.)�selfZcur_pidrrr�rng�s
z_RandomNameSequence.rngcCs|S)Nr)r2rrr�__iter__�sz_RandomNameSequence.__iter__cs0|j�|jj���fdd�td�D�}dj|�S)Ncsg|]}����qSrr)�.0Zdummy)�c�chooserr�
<listcomp>�sz0_RandomNameSequence.__next__.<locals>.<listcomp>��)�
charactersr3Zchoice�range�join)r2Zlettersr)r6r7r�__next__�sz_RandomNameSequence.__next__N)�__name__�
__module__�__qualname__r;�propertyr3r4r>rrrrr-�sr-cCs�g}x$dD]}tj|�}|r
|j|�q
Wtjdkr\|jtjjd�tjjd�ddd	d
g�n|jddd
g�y|jtj��Wn$t	t
fk
r�|jtj�YnX|S)N�TMPDIR�TEMP�TMP�ntz~\AppData\Local\Tempz%SYSTEMROOT%\Tempzc:\tempzc:\tmpz\tempz\tmpz/tmpz/var/tmpz/usr/tmp)rCrDrE)r�getenv�append�name�extend�path�
expanduser�
expandvars�getcwd�AttributeErrorr�curdir)�dirlistZenvname�dirnamerrr�_candidate_tempdir_list�s



rScCs4t�}t�}�x|D�]}|tjkr0tjj|�}x�td�D]�}t|�}tjj||�}y\tj	|t
d�}z<z*tj	|ddd��}|jd�WdQRXWdtj
|�XWdtj|�X|Stk
r�Yq:tk
�rtjdkr�tjj|�r�tj|tj�r�w:PYq:tk
�rPYq:Xq:WqWttjd|��dS)	N�di��wbF)�closefdsblatrFz)No usable temporary directory found in %s)r-rSrrPrK�abspathr<�nextr=r�_bin_openflags�_io�writer�unlink�FileExistsError�PermissionErrorrI�isdir�access�W_OKr�FileNotFoundError�_errno�ENOENT)ZnamerrQr*�seqrI�filenamer�fprrr�_get_default_tempdir�s:	
rhc
Cs2tdkr.tj�ztdkr t�aWdtj�XtS)N)�_name_sequence�
_once_lock�acquirer-�releaserrrr�_get_candidate_names�s

rmc
Cs�t�}|tkrttj|�}x�tt�D]�}t|�}tjj	||||�}ytj
||d�}	WnRtk
rnw$Yn>tk
r�tj
dkr�tjj|�r�tj|tj�r�w$n�YnX|	tjj|�fSWttjd��dS)Ni�rFz#No usable temporary file name found)rmr �maprr'r<rrXrKr=rr]r^rIr_r`rarWrc�EEXIST)
r*ZpreZsuf�flagsr+�namesrerI�filerrrr�_mkstemp_inner�s$rscGsJ|tjkr ||f|�ddi�n&tjdks8tjj|�rF||f|��dS)N�follow_symlinksFrF)r�supports_follow_symlinksrIrK�islink)�funcrKr#rrr�_dont_follow_symlinkss
rxcCs>y
tj}Wntk
rYnXt||d�ttj|d�dS)Nri�)r�chflagsrOrx�chmod)rKryrrr�_resetpermss
r{cCstS)N)r&rrrrr	*scCstjt��S)N)rr'r	rrrrr.sc
Cs2tdkr.tj�ztdkr t�aWdtj�XtS)N)r
rjrkrhrlrrrrr4s

cCstjt��S)N)rr'rrrrrr
@sFcCs2t|||�\}}}}|rt}nt}t|||||�S)N)r,�_text_openflagsrYrs)r)r(r*�textr+rprrrrDs
cCs�t|||�\}}}}t�}|tkr.ttj|�}x�tt�D]�}t|�}tj	j
||||�}ytj|d�WnRtk
r�w8Yn>t
k
r�tjdkr�tj	j|�r�tj|tj�r�w8n�YnX|SWttjd��dS)Ni�rFz(No usable temporary directory name found)r,rmr rnrr'r<rrXrKr=�mkdirr]r^rIr_r`rarcro)r)r(r*r+rqrerIrrrrrrls&
r:cCs`|dkrt�}t�}x:tt�D].}t|�}tjj||||�}t|�s|SqWt	t
jd��dS)Nz"No usable temporary filename found)rrmr<rrXrrKr=rr]rcro)r)r(r*rqrerIrrrrrr�sc@sHeZdZdZdZddd�Zejdkr<ejfdd�Z	d	d
�Z
ndd�Z	dS)
�_TemporaryFileCloserNFTcCs||_||_||_dS)N)rrrI�delete)r2rrrIr�rrr�__init__�sz_TemporaryFileCloser.__init__rFcCs>|jr:|jdk	r:d|_z|jj�Wd|jr8||j�XdS)NT)�close_calledrrrr�rI)r2r\rrrr�sz_TemporaryFileCloser.closecCs|j�dS)N)r)r2rrr�__del__�sz_TemporaryFileCloser.__del__cCs|jsd|_|jj�dS)NT)r�rrr)r2rrrr�s)T)r?r@rArrr�r�rrIr\rr�rrrrr�s



rc@s>eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)�_TemporaryFileWrapperTcCs$||_||_||_t|||�|_dS)N)rrrIr�r�_closer)r2rrrIr�rrrr��sz_TemporaryFileWrapper.__init__cs^|jd}t||�}t|d�rD|�tj���fdd��}|j|_|}t|t�sZt|||�|S)Nrr�__call__cs
�||�S)Nr)r#�kwargs)rwrr�func_wrapper�sz7_TemporaryFileWrapper.__getattr__.<locals>.func_wrapper)	�__dict__r0�hasattr�
_functools�wrapsr�r�int�setattr)r2rIrr�ar�r)rwr�__getattr__�s



z!_TemporaryFileWrapper.__getattr__cCs|jj�|S)N)rr�	__enter__)r2rrrr�s
z_TemporaryFileWrapper.__enter__cCs|jj|||�}|j�|S)N)rr�__exit__r)r2�exc�value�tb�resultrrrr�sz_TemporaryFileWrapper.__exit__cCs|jj�dS)N)r�r)r2rrrrsz_TemporaryFileWrapper.closeccsx|jD]
}|VqWdS)N)rr)r2�linerrrr4sz_TemporaryFileWrapper.__iter__N)T)	r?r@rAr�r�r�r�rr4rrrrr��s
r��w+b�Tc

Cs�t|||�\}}}}t}	tjdkr0|r0|	tjO}	t||||	|�\}
}y tj|
||||d�}t|||�St	k
r�tj
|�tj|
��YnXdS)NrF)�	buffering�newline�encoding)r,rYrrIZO_TEMPORARYrsrZrr��
BaseExceptionr\r)
�moder�r�r�r)r(r*r�r+rprrIrrrrrrs




�posix�cygwin�	O_TMPFILEcCs�t|||�\}}}}t}tr�y$|tjBtj@}	tj||	d�}
Wn*tk
rXdaYnBtk
rjYn0Xyt	j|
||||d�Stj
|
��YnXt|||||�\}
}ytj|�t	j|
||||d�Stj
|
��YnXdS)Ni�F)r�r�r�)
r,rY�_O_TMPFILE_WORKSrr��O_CREATr�IsADirectoryErrorrrZrrsr\)r�r�r�r�r)r(r*r+rpZflags2rrIrrrrNs0






c@s�eZdZdZd7dd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
edd��Zedd��Z
dd�Zdd�Zdd�Zedd��Zed d!��Zed"d#��Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zed,d-��Zd.d/�Zd8d0d1�Zd2d3�Zd4d5�ZdS)9rFr�w+br�Nc		CsHd|krtj�|_ntjdd�|_||_d|_|||||||d�|_dS)N�b�
)r�F)r�r�r)r(r�r�r*)rZ�BytesIO�_file�StringIO�	_max_size�_rolled�_TemporaryFileArgs)	r2�max_sizer�r�r�r�r)r(r*rrrr��szSpooledTemporaryFile.__init__cCs,|jr
dS|j}|r(|j�|kr(|j�dS)N)r�r��tell�rollover)r2rrr�rrr�_check�s
zSpooledTemporaryFile._checkcCsN|jr
dS|j}tf|j�}|_|`|j|j��|j|j�d�d|_dS)NrT)r�r�rr�r[�getvalue�seekr�)r2rrZnewfilerrrr��szSpooledTemporaryFile.rollovercCs|jjrtd��|S)Nz%Cannot enter context with closed file)r��closed�
ValueError)r2rrrr��szSpooledTemporaryFile.__enter__cCs|jj�dS)N)r�r)r2r�r�r�rrrr��szSpooledTemporaryFile.__exit__cCs
|jj�S)N)r�r4)r2rrrr4�szSpooledTemporaryFile.__iter__cCs|jj�dS)N)r�r)r2rrrr�szSpooledTemporaryFile.closecCs|jjS)N)r�r�)r2rrrr��szSpooledTemporaryFile.closedcCs8y|jjStk
r2d|jdkr(�|jdSXdS)Nr�r�r�)r�r�rOr�)r2rrrr��szSpooledTemporaryFile.encodingcCs|j�|jj�S)N)r�r��fileno)r2rrrr��szSpooledTemporaryFile.filenocCs|jj�dS)N)r��flush)r2rrrr��szSpooledTemporaryFile.flushcCs
|jj�S)N)r��isatty)r2rrrr��szSpooledTemporaryFile.isattycCs(y|jjStk
r"|jdSXdS)Nr�)r�r�rOr�)r2rrrr��szSpooledTemporaryFile.modecCs"y|jjStk
rdSXdS)N)r�rIrO)r2rrrrI�szSpooledTemporaryFile.namecCs8y|jjStk
r2d|jdkr(�|jdSXdS)Nr�r�r�)r��newlinesrOr�)r2rrrr��szSpooledTemporaryFile.newlinescGs|jj|�S)N)r��read)r2r#rrrr��szSpooledTemporaryFile.readcGs|jj|�S)N)r��readline)r2r#rrrr��szSpooledTemporaryFile.readlinecGs|jj|�S)N)r��	readlines)r2r#rrrr��szSpooledTemporaryFile.readlinescGs|jj|�dS)N)r�r�)r2r#rrrr��szSpooledTemporaryFile.seekcCs|jjS)N)r��	softspace)r2rrrr�szSpooledTemporaryFile.softspacecCs
|jj�S)N)r�r�)r2rrrr�szSpooledTemporaryFile.tellcCs6|dkr|jj�n||jkr&|j�|jj|�dS)N)r��truncater�r�)r2�sizerrrr�s

zSpooledTemporaryFile.truncatecCs|j}|j|�}|j|�|S)N)r�r[r�)r2�srr�rvrrrr[s

zSpooledTemporaryFile.writecCs|j}|j|�}|j|�|S)N)r��
writelinesr�)r2�iterablerrr�rrrr�s

zSpooledTemporaryFile.writelines���)rr�r�NNNNN)N)r?r@rAr�r�r�r�r�r�r4rrBr�r�r�r�r�r�rIr�r�r�r�r�r�r�r�r[r�rrrrr�s6
		
c@sNeZdZddd�Zedd��Zedd��Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)rNcCs0t|||�|_tj||j|jdj|�d�|_dS)NzImplicitly cleaning up {!r})�warn_message)rrI�_weakref�finalize�_cleanup�format�
_finalizer)r2r)r(r*rrrr�(s
zTemporaryDirectory.__init__cs ��fdd�}tj�|d�dS)Ncs�t|dt�r|yV|�kr(ttjj|��t|�ytj|�Wn"ttfk
r`�j|�YnXWq�t	k
rxYq�Xnt|dt	�r�n�dS)Nr)
�
issubclassr^r{rrKrRr\r��_rmtreerb)rwrK�exc_info)�clsrIrr�onerror0sz+TemporaryDirectory._rmtree.<locals>.onerror)r�)�_shutilZrmtree)r�rIr�r)r�rIrr�.szTemporaryDirectory._rmtreecCs|j|�tj|t�dS)N)r��	_warnings�warn�ResourceWarning)r�rIr�rrrr�Es
zTemporaryDirectory._cleanupcCsdj|jj|j�S)Nz	<{} {!r}>)r��	__class__r?rI)r2rrr�__repr__JszTemporaryDirectory.__repr__cCs|jS)N)rI)r2rrrr�MszTemporaryDirectory.__enter__cCs|j�dS)N)�cleanup)r2r�r�r�rrrr�PszTemporaryDirectory.__exit__cCs|jj�r|j|j�dS)N)r��detachr�rI)r2rrrr�Ss
zTemporaryDirectory.cleanup)NNN)r?r@rAr��classmethodr�r�r�r�r�r�rrrrrs
)NNNF)NNNr�)r�r�NNNNNTr�)r�r�NNNNN)C�__all__�	functoolsr��warningsr��iorZ�osrZshutilr��errnorcZrandomrr1�weakrefr��_thread�ImportErrorZ
_dummy_thread�
allocate_lockZ_allocate_lock�O_RDWRr��O_EXCLr|r�rrYrrr&rjrrrrr%r,r-rSrhrirmrsrxr{r	rr
rr
rrrrr�rrI�sys�platformrr�r�objectrrrrr�<module>s�




	-
(
' +?
$

8tokenize.cpython-36.pyc000064400000044331150335715140011033 0ustar003


 \8s�-@s�dZdZdZddlmZddlmZmZddl	Z	ddl
mZddlm
Z
ddlZddlZddlZdd	lTejd
ej�Zejdej�ZddlZejdd
dddddgZ[eZdee<edZdee<edZdee<ed7Zeeeee e!e"e#e$e%e&e'e(e)e*e+e,e-e.e/e0e1e2e3e4e5e6e7e8e9e:e;e<e=e>e?e@eAeBeCeDeEeFeGd�,ZHGdd�de	jIdd��ZJdd�ZKdd�ZLdd�ZMdZNd ZOeNeLd!eN�eMeO�ZPd"ZQd#ZRd$ZSd%ZTd&ZUeKeReSeTeU�ZVd'ZWeKd(d)�eMeW�ZXd*eWZYeKeXeY�ZZeKd+eZd,�Z[eKe[eZeV�Z\d-d.�Z]d/d0�Z^eKe]��Z_d1Z`d2Zad3Zbd4ZceKe_d5e_d6�ZdeKe_d7e_d8�ZeeKd9d:d;d<d=d>d?d@�ZfdAZgeKdBdCdD�ZheKefegeh�ZieKe\eieeeQ�ZjePejZkeKe_dEeKdFd!�e_dGeKdHd!��ZleKdIeOed�ZmeNeKeme\eieleQ�ZniZox@e]�D]6Zpe`eoepdF<eaeoepdH<ebeoepd5<eceoepd6<�q�Weq�Zreq�Zsx\e]�D]RZtx$etdHetdFfD]Zuerjveu��q8Wx$etd6etd5fD]Zuesjveu��q^W�q"WdJZwGdKdL�dLex�ZyGdMdN�dNex�ZzGdOdP�dP�Z{dQd�Z|dRdS�Z}dTd�Z~dUdV�ZdWd
�ZdXdY�Z�dZd[�Z�d\d]�Z�e�d^k�r�e��dS)_aoTokenization help for Python programs.

tokenize(readline) is a generator that breaks a stream of bytes into
Python tokens.  It decodes the bytes according to PEP-0263 for
determining source file encoding.

It accepts a readline-like method which is called repeatedly to get the
next line of input (or b"" for EOF).  It generates 5-tuples with these
members:

    the token type (see token.py)
    the token (a string)
    the starting (row, column) indices of the token (a 2-tuple of ints)
    the ending (row, column) indices of the token (a 2-tuple of ints)
    the original line (string)

It is designed to match the working of the Python tokenizer exactly, except
that it produces COMMENT tokens for comments and gives type OP for all
operators.  Additionally, all token lists start with an ENCODING token
which tells you which encoding was used to decode the bytes stream.
zKa-Ping Yee <ping@lfw.org>zpGvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip Montanaro, Raymond Hettinger, Trent Nelson, Michael Foord�)�open)�lookup�BOM_UTF8N)�
TextIOWrapper)�chain)�*z&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)�COMMENT�tokenize�detect_encoding�NL�
untokenize�ENCODING�	TokenInfo���),�(�)�[�]�:�,�;�+�-r�/�|�&�<�>�=�.�%�{�}z==z!=z<=z>=�~�^z<<z>>z**z+=z-=z*=z/=z%=z&=z|=z^=z<<=z>>=z**=z//z//=�@z@=c@s eZdZdd�Zedd��ZdS)rcCs$d|jt|jf}d|j|d�S)Nz%d (%s)z8TokenInfo(type=%s, string=%r, start=%r, end=%r, line=%r))�type)r(�tok_name�_replace)�self�annotated_type�r-� /usr/lib64/python3.6/tokenize.py�__repr__dszTokenInfo.__repr__cCs(|jtkr|jtkrt|jS|jSdS)N)r(�OP�string�EXACT_TOKEN_TYPES)r+r-r-r.�
exact_typeis
zTokenInfo.exact_typeN)�__name__�
__module__�__qualname__r/�propertyr3r-r-r-r.rcsztype string start end linecGsddj|�dS)Nrrr)�join)�choicesr-r-r.�grouppsr:cGst|�dS)Nr)r:)r9r-r-r.�anyqsr;cGst|�dS)N�?)r:)r9r-r-r.�maybersr=z[ \f\t]*z	#[^\r\n]*z\\\r?\nz\w+z0[xX](?:_?[0-9a-fA-F])+z0[bB](?:_?[01])+z0[oO](?:_?[0-7])+z(?:0(?:_?0)*|[1-9](?:_?[0-9])*)z[eE][-+]?[0-9](?:_?[0-9])*z)[0-9](?:_?[0-9])*\.(?:[0-9](?:_?[0-9])*)?z\.[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*[jJ]z[jJ]cCsnddddddg}tdg�}xN|D]F}x@tj|�D]2}x,tjdd	�|D��D]}|jdj|��qJWq0Wq W|S)
N�b�r�u�f�br�fr�cSsg|]}||j�f�qSr-)�upper)�.0�cr-r-r.�
<listcomp>�sz(_all_string_prefixes.<locals>.<listcomp>)�set�
_itertools�permutations�product�addr8)�_valid_string_prefixes�result�prefix�tr@r-r-r.�_all_string_prefixes�s

rRcCstj|tj�S)N)�re�compile�UNICODE)�exprr-r-r.�_compile�srWz[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z'''z"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z!=z//=?z->z[+\-*/%&@|^=<>]=?r%z[][(){}]z\r?\nz\.\.\.z[:;.,@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*�'z"[^\n"\\]*(?:\\.[^\n"\\]*)*�"z
\\\r?\n|\Z�c@seZdZdS)�
TokenErrorN)r4r5r6r-r-r-r.r[�sr[c@seZdZdS)�StopTokenizingN)r4r5r6r-r-r-r.r\�sr\c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�UntokenizercCsg|_d|_d|_d|_dS)Nrr)�tokens�prev_row�prev_col�encoding)r+r-r-r.�__init__�szUntokenizer.__init__cCs�|\}}||jks&||jkr>||jkr>tdj|||j|j���||j}|rb|jjd|�d|_||j}|r�|jjd|�dS)Nz+start ({},{}) precedes previous end ({},{})z\
r� )r_r`�
ValueError�formatr^�append)r+�start�row�col�
row_offset�
col_offsetr-r-r.�add_whitespace�s

zUntokenizer.add_whitespacecCs4t|�}g}d}�x|D�]
}t|�dkr8|j||�P|\}}}}	}
|tkrV||_q|tkr`P|tkrv|j|�qnl|tkr�|j	�|	\|_
|_qnL|tt
fkr�d}n:|r�|r�|d}|dt|�kr�|jj|�t|�|_d}|j|�|jj|�|	\|_
|_|tt
fkr|j
d7_
d|_qWdj|j�S)NFrTrrrD���)�iter�len�compatr
ra�	ENDMARKER�INDENTrf�DEDENT�popr_r`�NEWLINErr^rlr8)r+�iterable�it�indents�	startlinerQ�tok_type�tokenrg�end�line�indentr-r-r.r�sF



zUntokenizer.untokenizec
Cs�g}|jj}|dttfk}d}x�t|g|�D]�}|dd�\}}	|tkrR|	|_q.|ttt	t
fkrj|	d7}	|tkr�|r~d|	}	d}nd}|tkr�|j|	�q.n>|t
kr�|j�q.n*|ttfkr�d}n|r�|r�||d�d}||	�q.WdS)NrFrrcTrrm)r^rfrurrr
ra�NAME�NUMBER�ASYNC�AWAIT�STRINGrrrsrt)
r+r{rvrx�toks_appendry�
prevstring�tok�toknum�tokvalr-r-r.rps8
zUntokenizer.compatN)r4r5r6rbrlrrpr-r-r-r.r]�s
%r]cCs*t�}|j|�}|jdk	r&|j|j�}|S)aTransform tokens back into Python source code.
    It returns a bytes object, encoded using the ENCODING
    token, which is the first token sequence output by tokenize.

    Each element returned by the iterable must be a token sequence
    with at least two elements, a token number and token value.  If
    only two tokens are passed, the resulting output is poor.

    Round-trip invariant for full input:
        Untokenized source will match input source exactly

    Round-trip invariant for limited input:
        # Output bytes will tokenize back to the input
        t1 = [tok[:2] for tok in tokenize(f.readline)]
        newcode = untokenize(t1)
        readline = BytesIO(newcode).readline
        t2 = [tok[:2] for tok in tokenize(readline)]
        assert t1 == t2
    N)r]rra�encode)rv�ut�outr-r-r.r=s


cCsH|dd�j�jdd�}|dks*|jd�r.dS|d
ks@|jd�rDdS|S)z(Imitates get_normal_name in tokenizer.c.N��_rzutf-8zutf-8-�latin-1�
iso-8859-1�iso-latin-1�latin-1-�iso-8859-1-�iso-latin-1-)r�r�r�)r�r�r�)�lower�replace�
startswith)�orig_enc�encr-r-r.�_get_normal_nameXs
r�cs�y�jj�Wntk
r$d�YnXd�d}d}�fdd�}��fdd�}|�}|jt�rpd�|d	d�}d
}|s||gfS||�}|r�||gfStj|�s�||gfS|�}|s�||gfS||�}|r�|||gfS|||gfS)a
    The detect_encoding() function is used to detect the encoding that should
    be used to decode a Python source file.  It requires one argument, readline,
    in the same way as the tokenize() generator.

    It will call readline a maximum of twice, and return the encoding used
    (as a string) and a list of any lines (left as bytes) it has read in.

    It detects the encoding from the presence of a utf-8 bom or an encoding
    cookie as specified in pep-0263.  If both a bom and a cookie are present,
    but disagree, a SyntaxError will be raised.  If the encoding cookie is an
    invalid charset, raise a SyntaxError.  Note that if a utf-8 bom is found,
    'utf-8-sig' is returned.

    If no encoding is specified, then the default of 'utf-8' will be returned.
    NFzutf-8cs y��Stk
rdSXdS)N�)�
StopIterationr-)�readliner-r.�read_or_stop{sz%detect_encoding.<locals>.read_or_stopcs�y|jd�}Wn4tk
rBd}�dk	r6dj|��}t|��YnXtj|�}|sVdSt|jd��}yt|�}Wn:t	k
r��dkr�d|}ndj�|�}t|��YnX�r�|dkr؈dkr�d}n
dj��}t|��|d	7}|S)
Nzutf-8z'invalid or missing encoding declarationz{} for {!r}rzunknown encoding: zunknown encoding for {!r}: {}zencoding problem: utf-8z encoding problem for {!r}: utf-8z-sig)
�decode�UnicodeDecodeErrorre�SyntaxError�	cookie_re�matchr�r:r�LookupError)r}�line_string�msgr�ra�codec)�	bom_found�filenamer-r.�find_cookie�s6


z$detect_encoding.<locals>.find_cookieTrz	utf-8-sig)�__self__�name�AttributeErrorr�r�blank_rer�)r�ra�defaultr�r��first�secondr-)r�r�r�r.r
cs8
&




cCsVt|d�}y0t|j�\}}|jd�t||dd�}d|_|S|j��YnXdS)zXOpen a file in read only mode using the encoding detected by
    detect_encoding().
    �rbrT)�line_bufferingr?N)�
_builtin_openr
r��seekr�mode�close)r��bufferra�lines�textr-r-r.r�s

rcCsBddlm}m}t|�\}}t|d�}|d�}t||||�j|�S)a�
    The tokenize() generator requires one argument, readline, which
    must be a callable object which provides the same interface as the
    readline() method of built-in file objects.  Each call to the function
    should return one line of input as bytes.  Alternatively, readline
    can be a callable function terminating with StopIteration:
        readline = open(myfile, 'rb').__next__  # Example of alternate readline

    The generator produces 5-tuples with these members: the token type; the
    token string; a 2-tuple (srow, scol) of ints specifying the row and
    column where the token begins in the source; a 2-tuple (erow, ecol) of
    ints specifying the row and column where the token ends in the source;
    and the line on which the token was found.  The line passed is the
    logical line; continuation lines are included.

    The first token sequence will always be an ENCODING token
    which tells you which encoding was used to decode the bytes stream.
    r)r�repeatr�)�	itertoolsrr�r
rn�	_tokenize�__next__)r�rr�ra�consumed�rl_gen�emptyr-r-r.r	�s

c!cs"d}}}d}d!\}}d}dg}	d}
d}d}d}
|dk	rX|dkrFd}tt|d"d#d�Vd}d}�xy|}|�}Wntk
r�d}YnX|dk	r�|j|�}|d7}dt|�}}|�r�|s�td	|��|j|�}|�r|jd�}}tt||d|�|||f||�Vd$\}}d}nf|�rn|d%d�dk�rn|d&d�d
k�rntt	||||t|�f|�Vd}d}qdn||}||}qd�n@|dk�r�|�r�|�s�Pd}xf||k�r||dk�r�|d7}n6||dk�r�|t
dt
}n||dk�r�d}nP|d7}�q�W||k�rP||dk�r�||dk�r�||d�jd�}|t|�}tt|||f||t|�f|�Vtt
||d�||f|t|�f|�Vqdtt
tf||dk||d�||f|t|�f|�Vqd||	d'k�r|	j|�tt|d|�|df||f|�Vxv||	d(k�r�||	k�r8tdd|||f��|	dd)�}	|�rd||	d*k�rdd}d}
d}ttd||f||f|�V�qW|�r�|
�r�||	d+k�r�d}d}
d}n|�s�td|df��d}�x�||k�rztt�j||�}|�rL|jd�\}}||f||f|}}}||k�r�q�|||�||}}||k�sZ|dk�rp|dk�rp|dk�rptt||||�V�qv|dk�r�|
�r�|
Vd}
|dk�r�tt
||||�Vntt||||�V|�rJd}
�qv|dk�r
|jd��s�t�|
�r�|
Vd}
tt||||�V�qv|tk�r~tt|�}|j||�}|�r`|jd�}|||�}tt||||f|�Vn||f}||d�}|}P�qv|tk�s�|dd
�tk�s�|dd�tk�r |d,dk�r
||f}ttj|��p�tj|d��p�tj|d
��}||d�d}}|}Pntt||||�V�qv|j��r�|d-k�r^|�r^t|dk�rJtnt||||�V�q�tt ||||�}|dk�r�|
�r�|}
�q�|dk�r�|
�r�|
j!t k�r�|
j"dk�r�d}|	d.}tt|
j"|
j#|
j|
j$�Vd}
|
�r�|
Vd}
|VnX|dk�rd}nH|dk�r|d7}n|d k�r(|d8}|
�r8|
Vd}
tt%||||�Vn*tt	||||f||df|�V|d7}�q�WqdW|
�r�|
Vd}
|�r�|d/dk�r�ttd|dt|�f|dt|�dfd�Vx0|	dd�D] } ttd|df|dfd�V�q�Wtt&d|df|dfd�VdS)0Nr�
0123456789rDFz	utf-8-sigzutf-8r�rzEOF in multi-line stringrz\
rz\
rc�	�z#
�#z
z3unindent does not match any outer indentation levelz
<tokenize>zEOF in multi-line statementr!z...T�
�async�await�def�\z([{z)]})rDr)rr)rr)rDr������rmrmrmrmrmrm)r�r�rmrm)'rr
r�r�ror[r�r|r��
ERRORTOKEN�tabsize�rstriprrrfrr�IndentationErrorrsrW�PseudoToken�spanr�ru�endswith�AssertionError�
triple_quoted�endpats�
single_quoted�get�isidentifierr�r�rr(r1rgr}r0rq)!r�ra�lnum�parenlev�	continued�numchars�contstr�needcont�contlinerx�stashed�	async_def�async_def_indent�async_def_nl�	last_liner}�pos�max�strstart�endprog�endmatchr|�column�
comment_token�nl_pos�pseudomatchrg�spos�eposr{�initialr�r~r-r-r.r��st




*



"
 
















. r�cCs
t|d�S)N)r�)r�r-r-r.�generate_tokens�sr�c
s(ddl}dd��d�fdd�	}|jdd�}|jdd	d
dd�|jd
ddddd�|j�}y�|jr�|j}t|d��}tt|j��}WdQRXnd}t	t
jjd�}xF|D]>}|j}|j
r�|j}d|j|j}	td|	t||jf�q�WW�n8tk
�r:}
z2|
jddd�\}}||
jd|||f�WYdd}
~
Xn�tk
�r�}
z*|
jd\}}||
jd|||f�WYdd}
~
Xn�tk
�r�}
z||
|�WYdd}
~
Xnxtk
�r�}
z||
�WYdd}
~
XnNtk
�r�td�Yn2tk
�r"}
z�d|
��WYdd}
~
XnXdS)NrcSst|tjd�dS)N)�file)�print�sys�stderr)�messager-r-r.�perror�szmain.<locals>.perrorcsR|r"|f||f}�d|�n"|r8�d||f�n�d|�tjd�dS)Nz%s:%d:%d: error: %sz
%s: error: %sz	error: %sr)r��exit)r�r��location�args)r�r-r.�error�szmain.<locals>.errorzpython -m tokenize)�progr�r<zfilename.pyz'the file to tokenize; defaults to stdin)�dest�nargs�metavar�helpz-ez--exact�exact�
store_truez(display token names using the exact type)r��actionrr�z<stdin>z%d,%d-%d,%d:z%-20s%-15s%-15rrrzinterrupted
zunexpected error: %s)NN)�argparse�ArgumentParser�add_argument�
parse_argsr�r��listr	r�r�r��stdinr(rr3rgr|r�r)r1r�r�r[r��OSError�KeyboardInterrupt�	Exception)
rr��parserr�r�rAr^r{�
token_type�token_range�errr}r�r-)r�r.�main�sN
&&r�__main__)��__doc__�
__author__�__credits__�builtinsrr��codecsrr�collections�iorr�rrJrSr�r{rT�ASCIIr�r��__all__�N_TOKENSrr)rr
�LPAR�RPAR�LSQB�RSQB�COLON�COMMA�SEMI�PLUS�MINUS�STAR�SLASH�VBAR�AMPER�LESS�GREATER�EQUAL�DOT�PERCENT�LBRACE�RBRACE�EQEQUAL�NOTEQUAL�	LESSEQUAL�GREATEREQUAL�TILDE�
CIRCUMFLEX�	LEFTSHIFT�
RIGHTSHIFT�
DOUBLESTAR�	PLUSEQUAL�MINEQUAL�	STAREQUAL�
SLASHEQUAL�PERCENTEQUAL�
AMPEREQUAL�	VBAREQUAL�CIRCUMFLEXEQUAL�LEFTSHIFTEQUAL�RIGHTSHIFTEQUAL�DOUBLESTAREQUAL�DOUBLESLASH�DOUBLESLASHEQUAL�AT�ATEQUALr2�
namedtuplerr:r;r=�
Whitespace�Comment�Ignore�Name�	Hexnumber�	Binnumber�	Octnumber�	Decnumber�	Intnumber�Exponent�
Pointfloat�Expfloat�Floatnumber�
Imagnumber�NumberrRrW�StringPrefix�Single�Double�Single3�Double3�Triple�String�Operator�Bracket�Special�Funny�
PlainToken�Token�ContStr�PseudoExtrasr�r��_prefixrIr�r�rQr@rMr�rr[r\r]rr�r
r	r�r�rr4r-r-r-r.�<module>s






_]x<
_sitebuiltins.cpython-36.opt-2.pyc000064400000005541150335715140013020 0ustar003


 \+�@s<ddlZGdd�de�ZGdd�de�ZGdd�de�ZdS)�Nc@s&eZdZdd�Zdd�Zddd�ZdS)	�QuittercCs||_||_dS)N)�name�eof)�selfrr�r�%/usr/lib64/python3.6/_sitebuiltins.py�__init__szQuitter.__init__cCsd|j|jfS)NzUse %s() or %s to exit)rr)rrrr�__repr__szQuitter.__repr__Nc	Cs(ytjj�WnYnXt|��dS)N)�sys�stdin�close�
SystemExit)r�coderrr�__call__s
zQuitter.__call__)N)�__name__�
__module__�__qualname__rr	rrrrrr
src@s6eZdZdZfffdd�Zdd�Zdd�Zdd	�Zd
S)�_Printer�cs4ddl�||_||_d|_��fdd�|D�|_dS)Nrcs$g|]}�D]}�jj||��qqSr)�path�join)�.0�dir�filename)�files�osrr�
<listcomp>(sz%_Printer.__init__.<locals>.<listcomp>)r�_Printer__name�_Printer__data�_Printer__lines�_Printer__filenames)rr�datar�dirsr)rrrr#sz_Printer.__init__cCs~|jr
dSd}xH|jD]>}y$t|d��}|j�}WdQRXPWqtk
rRYqXqW|sb|j}|jd�|_t|j�|_dS)N�r�
)	rr �open�read�OSErrorr�split�len�_Printer__linecnt)rr!r�fprrr�__setup,s
z_Printer.__setupcCs8|j�t|j�|jkr$dj|j�Sd|jfdSdS)Nr$z!Type %s() to see the full %s text�)�_Printer__setupr)r�MAXLINESrr)rrrrr	<sz_Printer.__repr__cCs�|j�d}d}x�y,x&t|||j�D]}t|j|�q&WWntk
rTPYqX||j7}d}x |dkr�t|�}|dkrfd}qfW|dkrPqWdS)Nz0Hit Return for more, or q (and Return) to quit: r��q)r0r1)r.�ranger/�printr�
IndexError�input)r�prompt�lineno�i�keyrrrrCs"

z_Printer.__call__N)rrrr/rr.r	rrrrrrs
	rc@seZdZdd�Zdd�ZdS)�_HelpercCsdS)NzHType help() for interactive help, or help(object) for help about object.r)rrrrr	bsz_Helper.__repr__cOsddl}|j||�S)Nr)�pydoc�help)r�args�kwdsr;rrrresz_Helper.__call__N)rrrr	rrrrrr:Xs
r:)r
�objectrrr:rrrr�<module>s;aifc.cpython-36.opt-2.pyc000064400000050404150335715140011043 0ustar003


 \�~�@s:ddlZddlZddlZdddgZGdd�de�ZdZdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdZdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd lmZdd!lmZed"d#�Zd$ej_d%ej_d&ej_d'ej_d(ej_d)ej_Gd*d+�d+�Z Gd,d-�d-�Z!d?d.d�Z"e"Z#e$d/k�r6ddl%Z%e%j&d0d��sDe%j&j'd1�e%j&d0Z(e"e(d2���Z)e*d3e(�e*d4e)j+��e*d5e)j,��e*d6e)j-��e*d7e)j.��e*d8e)j/��e*d9e)j0��e%j&d:d��r,e%j&d:Z1e*d;e1�e"e1d<��8Z2e2j3e)j4��x"e)j5d=�Z6e6�s
Pe2j7e6��q�WWdQRXe*d>�WdQRXdS)@�N�Error�open�openfpc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/aifc.pyr�sl@QEcCs6ytjd|jd��dStjk
r0t�YnXdS)Nz>l�r)�struct�unpack�read�error�EOFError)�filerrr	�
_read_long�srcCs6ytjd|jd��dStjk
r0t�YnXdS)Nz>Lr
r)rrr
rr)rrrr	�_read_ulong�srcCs6ytjd|jd��dStjk
r0t�YnXdS)Nz>h�r)rrr
rr)rrrr	�_read_short�srcCs6ytjd|jd��dStjk
r0t�YnXdS)Nz>Hrr)rrr
rr)rrrr	�_read_ushort�srcCs@t|jd��}|dkrd}n
|j|�}|d@dkr<|jd�}|S)N�r�)�ordr
)r�length�data�dummyrrr	�_read_string�s

rg�����cCs�t|�}d}|dkr d
}|d}t|�}t|�}||koL|koLdknrXd}n0|dkrft}n"|d}|d|td|d	�}||S)Nrri�gi�i�?lg@�?���)rr�	_HUGE_VAL�pow)�f�expon�sign�himant�lomantrrr	�_read_float�s"r&cCs|jtjd|��dS)Nz>h)�writer�pack)r!�xrrr	�_write_short�sr*cCs|jtjd|��dS)Nz>H)r'rr()r!r)rrr	�
_write_ushort�sr+cCs|jtjd|��dS)Nz>l)r'rr()r!r)rrr	�_write_long�sr,cCs|jtjd|��dS)Nz>L)r'rr()r!r)rrr	�_write_ulong�sr-cCsRt|�dkrtd��|jtjdt|���|j|�t|�d@dkrN|jd�dS)N�z%string exceeds maximum pstring length�Brr�)�len�
ValueErrorr'rr()r!�srrr	�
_write_string�s
r4c	Cs�ddl}|dkrd}|d}nd}|dkr8d}d}d}n�|j|�\}}|dks^|dks^||krp|dB}d}d}nh|d}|dkr�|j||�}d}||B}|j|d�}|j|�}t|�}|j||d�}|j|�}t|�}t||�t||�t||�dS)	Nri�ri@i�i�?� r)�mathZfrexpZldexpZfloor�intr+r-)	r!r)r6r#r"r$r%ZfmantZfsmantrrr	�_write_float�s8




r8)�Chunk)�
namedtuple�_aifc_paramsz7nchannels sampwidth framerate nframes comptype compnamez3Number of audio channels (1 for mono, 2 for stereo)zSample width in byteszSampling frequencyzNumber of audio framesz(Compression type ("NONE" for AIFF files)zRA human-readable version of the compression type
('not compressed' for AIFF files)c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�ZdS)2�	Aifc_readNcCs<d|_d|_g|_d|_||_t|�}|j�dkr:td��|jd�}|dkrTd|_	n|dkrdd|_	ntd��d|_
d|_x�d|_yt|j�}Wnt
k
r�PYnX|j�}|d	kr�|j|�d|_
nH|d
kr�||_|jd�}d|_n(|dkr�t|�|_n|d
k�r|j|�|j�qzW|j
�s0|j�r8td��dS)NrsFORMz file does not start with FORM idr
sAIFFsAIFCrznot an AIFF or AIFF-C filesCOMMsSSND�sFVERsMARKz$COMM chunk and/or SSND chunk missing)�_version�_convert�_markers�	_soundpos�_filer9Zgetnamerr
�_aifcZ_comm_chunk_read�_ssnd_chunk�_ssnd_seek_neededr�_read_comm_chunkr�	_readmark�skip)�selfr�chunkZformdataZ	chunknamerrrr	�initfp4sJ




zAifc_read.initfpc	CsLt|t�r>tj|d�}y|j|�WqH|j��YqHXn
|j|�dS)N�rb)�
isinstance�str�builtinsrrK�close)rIr!�file_objectrrr	�__init__\s

zAifc_read.__init__cCs|S)Nr)rIrrr	�	__enter__hszAifc_read.__enter__cGs|j�dS)N)rP)rI�argsrrr	�__exit__kszAifc_read.__exit__cCs|jS)N)rB)rIrrr	�getfpqszAifc_read.getfpcCsd|_d|_dS)Nrr)rErA)rIrrr	�rewindtszAifc_read.rewindcCs |j}|dk	rd|_|j�dS)N)rBrP)rIrrrr	rPxszAifc_read.closecCs|jS)N)rA)rIrrr	�tell~szAifc_read.tellcCs|jS)N)�
_nchannels)rIrrr	�getnchannels�szAifc_read.getnchannelscCs|jS)N)�_nframes)rIrrr	�
getnframes�szAifc_read.getnframescCs|jS)N)�
_sampwidth)rIrrr	�getsampwidth�szAifc_read.getsampwidthcCs|jS)N)�
_framerate)rIrrr	�getframerate�szAifc_read.getframeratecCs|jS)N)�	_comptype)rIrrr	�getcomptype�szAifc_read.getcomptypecCs|jS)N)�	_compname)rIrrr	�getcompname�szAifc_read.getcompnamecCs*t|j�|j�|j�|j�|j�|j��S)N)r;rZr^r`r\rbrd)rIrrr	�	getparams�szAifc_read.getparamscCst|j�dkrdS|jS)Nr)r1r@)rIrrr	�
getmarkers�szAifc_read.getmarkerscCs2x|jD]}||dkr|SqWtdj|���dS)Nrzmarker {0!r} does not exist)r@r�format)rI�id�markerrrr	�getmark�szAifc_read.getmarkcCs*|dks||jkrtd��||_d|_dS)Nrzposition not in ranger)r[rrArE)rI�posrrr	�setpos�szAifc_read.setposcCs�|jrD|jjd�|jjd�}|j|j}|r>|jj|d�d|_|dkrPdS|jj||j�}|jrv|rv|j|�}|jt|�|j|j	|_|S)Nrr=r)
rErD�seekr
rA�
_framesizer?r1rYr])rI�nframesrrkrrrr	�
readframes�s

zAifc_read.readframescCsddl}|j|d�S)Nrr)�audioopZalaw2lin)rIrrqrrr	�	_alaw2lin�szAifc_read._alaw2lincCsddl}|j|d�S)Nrr)rqZulaw2lin)rIrrqrrr	�	_ulaw2lin�szAifc_read._ulaw2lincCs2ddl}t|d�sd|_|j|d|j�\}|_|S)Nr�_adpcmstater)rq�hasattrrtZ	adpcm2lin)rIrrqrrr	�
_adpcm2lin�s

zAifc_read._adpcm2lincCs.t|�|_t|�|_t|�dd|_tt|��|_|j|j|_|j	�rd}|j
dkrld}tjd�d|_
|j
d�|_|r�t|jj
d��}|d@dkr�|d}|j
||_
|jjdd�t|�|_|jd	k�r*|jd
kr�|j|_n2|jdkr�|j|_n|jdk�r|j|_ntd��d|_nd	|_d|_dS)N�r=r�rzWarning: bad COMM chunk size�r
sNONEsG722�ulaw�ULAW�alaw�ALAWzunsupported compression typersnot compressedr)rzr{)r|r})rrYrr[r]r7r&r_rnrCZ	chunksize�warnings�warnr
rarrrmrrcrvr?rsrrr)rIrJZkludgerrrr	rF�s<









zAifc_read._read_comm_chunkcCs�t|�}yHxBt|�D]6}t|�}t|�}t|�}|s8|r|jj|||f�qWWnDtk
r�dt|j�t|j�dkr|dnd|f}tj	|�YnXdS)Nz;Warning: MARK chunk contains only %s marker%s instead of %sr�r3)
r�rangerrr@�appendrr1r~r)rIrJZnmarkers�irhrk�name�wrrr	rG�szAifc_read._readmark)rrrrBrKrRrSrUrVrWrPrXrZr\r^r`rbrdrerfrjrlrprrrsrvrFrGrrrr	r<s2$(&r<c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Z d<d=�Z!d>d?�Z"d@dA�Z#dBdC�Z$dDdE�Z%dFdG�Z&dHdI�Z'dS)J�
Aifc_writeNc	Cs\t|t�rNtj|d�}y|j|�Wn|j��YnX|jd�rXd|_n
|j|�dS)N�wbz.aiffr)rMrNrOrrKrP�endswithrC)rIr!rQrrr	rR+s

zAifc_write.__init__cCs^||_t|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_g|_
d|_d|_dS)NsNONEsnot compressedrr)rB�
_AIFC_versionr>rarcr?rYr]r_r[�_nframeswritten�_datawritten�_datalengthr@�_marklengthrC)rIrrrr	rK;szAifc_write.initfpcCs|j�dS)N)rP)rIrrr	�__del__LszAifc_write.__del__cCs|S)Nr)rIrrr	rSOszAifc_write.__enter__cGs|j�dS)N)rP)rIrTrrr	rURszAifc_write.__exit__cCs|jrtd��d|_dS)Nz0cannot change parameters after starting to writer)r�rrC)rIrrr	�aiffXszAifc_write.aiffcCs|jrtd��d|_dS)Nz0cannot change parameters after starting to writer)r�rrC)rIrrr	�aifc]szAifc_write.aifccCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerzbad # of channels)r�rrY)rI�	nchannelsrrr	�setnchannelsbs
zAifc_write.setnchannelscCs|jstd��|jS)Nznumber of channels not set)rYr)rIrrr	rZiszAifc_write.getnchannelscCs0|jrtd��|dks|dkr&td��||_dS)Nz0cannot change parameters after starting to writerr
zbad sample width)r�rr])rI�	sampwidthrrr	�setsampwidthns
zAifc_write.setsampwidthcCs|jstd��|jS)Nzsample width not set)r]r)rIrrr	r^uszAifc_write.getsampwidthcCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerzbad frame rate)r�rr_)rI�	frameraterrr	�setframeratezs
zAifc_write.setframeratecCs|jstd��|jS)Nzframe rate not set)r_r)rIrrr	r`�szAifc_write.getframeratecCs|jrtd��||_dS)Nz0cannot change parameters after starting to write)r�rr[)rIrorrr	�
setnframes�szAifc_write.setnframescCs|jS)N)r�)rIrrr	r\�szAifc_write.getnframescCs.|jrtd��|d	krtd��||_||_dS)
Nz0cannot change parameters after starting to write�NONE�ulaw�ULAW�alaw�ALAW�G722zunsupported compression type)r�r�r�r�r�r�)r�rrarc)rI�comptype�compnamerrr	�setcomptype�szAifc_write.setcomptypecCs|jS)N)ra)rIrrr	rb�szAifc_write.getcomptypecCs|jS)N)rc)rIrrr	rd�szAifc_write.getcompnamecCsf|\}}}}}}|jrtd��|d	kr.td��|j|�|j|�|j|�|j|�|j||�dS)
Nz0cannot change parameters after starting to write�NONE�ulaw�ULAW�alaw�ALAW�G722zunsupported compression type)r�r�r�r�r�r�)r�rr�r�r�r�r�)rIZparamsr�r�r�ror�r�rrr	�	setparams�s



zAifc_write.setparamscCs>|js|js|jr td��t|j|j|j|j|j|j�S)Nznot all parameters set)rYr]r_rr;r[rarc)rIrrr	re�szAifc_write.getparamscCs�|dkrtd��|dkr td��t|t�s2td��x<tt|j��D]*}||j|dkrB|||f|j|<dSqBW|jj|||f�dS)Nrzmarker ID must be > 0zmarker position must be >= 0zmarker name must be bytes)rrM�bytesr�r1r@r�)rIrhrkr�r�rrr	�setmark�s
zAifc_write.setmarkcCs2x|jD]}||dkr|SqWtdj|���dS)Nrzmarker {0!r} does not exist)r@rrg)rIrhrirrr	rj�szAifc_write.getmarkcCst|j�dkrdS|jS)Nr)r1r@)rIrrr	rf�szAifc_write.getmarkerscCs|jS)N)r�)rIrrr	rX�szAifc_write.tellcCszt|ttf�st|�jd�}|jt|��t|�|j|j}|j	rN|j	|�}|j
j|�|j||_|j
t|�|_
dS)Nr/)rMr��	bytearray�
memoryview�cast�_ensure_header_writtenr1r]rYr?rBr'r�r�)rIrrorrr	�writeframesraw�s
zAifc_write.writeframesrawcCs.|j|�|j|jks"|j|jkr*|j�dS)N)r�r�r[r�r��_patchheader)rIrrrr	�writeframes�s
zAifc_write.writeframescCs�|jdkrdSz^|jd�|jd@r<|jjd�|jd|_|j�|j|jksb|j|jksb|jrj|j	�Wdd|_
|j}d|_|j�XdS)Nrrr0)rBr�r�r'�
_writemarkersr�r[r�r�r�r?rP)rIr!rrr	rP�s 


zAifc_write.closecCsddl}|j|d�S)Nrr)rqZlin2alaw)rIrrqrrr	�	_lin2alaw�szAifc_write._lin2alawcCsddl}|j|d�S)Nrr)rqZlin2ulaw)rIrrqrrr	�	_lin2ulaw�szAifc_write._lin2ulawcCs2ddl}t|d�sd|_|j|d|j�\}|_|S)Nrrtr)rqrurtZ	lin2adpcm)rIrrqrrr	�
_lin2adpcms

zAifc_write._lin2adpcmcCsf|jsb|jdkr.|jsd|_|jdkr.td��|js<td��|jsJtd	��|jsXtd
��|j|�dS)N�ULAW�ulaw�ALAW�alaw�G722rzRsample width must be 2 when compressing with ulaw/ULAW, alaw/ALAW or G7.22 (ADPCM)z# channels not specifiedzsample width not specifiedzsampling rate not specified)r�r�r�r�r�)r�rar]rrYr_�
_write_header)rIZdatasizerrr	r�	s

z!Aifc_write._ensure_header_writtencCs>|jdkr|j|_n&|jdkr(|j|_n|jdkr:|j|_dS)NsG722�ulaw�ULAW�alaw�ALAW)r�r�)r�r�)rar�r?r�r�)rIrrr	�_init_compressions




zAifc_write._init_compressioncCsL|jr|jdkr|j�|jjd�|js<||j|j|_|j|j|j|_|jd@rf|jd|_|jr�|jdkr�|jd|_|jd@r�|jd|_n0|jd	kr�|jd
d|_|jd@r�|jd|_y|jj	�|_
Wn ttfk
�r�d|_
YnX|j
|j�}|j�rD|jjd�|jjd
�t|jd�t|j|j�n|jjd�|jjd�t|j|�t|j|j�|j
dk	�r�|jj	�|_t|j|j�|jdk�r�t|jd�nt|j|jd�t|j|j�|j�r�|jj|j�t|j|j�|jjd�|j
dk	�r|jj	�|_t|j|jd�t|jd�t|jd�dS)NsNONEsFORMr�ulaw�ULAW�alaw�ALAWr�G722�r
sAIFCsFVERsAIFFsCOMMr=sSSNDr)r�r�r�r�)r�r�r�r�r�)rCrar�rBr'r[rYr]r�rX�_form_length_pos�AttributeError�OSError�_write_form_lengthr-r>r*�_nframes_posr8r_r4rc�_ssnd_length_pos)rIZ
initlength�
commlengthrrr	r�!s^




zAifc_write._write_headercCs\|jr*d	t|j�}|d@r$|d}d}nd}d}t|jd||jd|d|�|S)
Nrx�r�rr
r=�ry)rCr1rcr-rBr�)rI�
datalengthr�Z
verslengthrrr	r�Ts zAifc_write._write_form_lengthcCs�|jj�}|jd@r,|jd}|jjd�n|j}||jkrd|j|jkrd|jdkrd|jj|d�dS|jj|j	d�|j
|�}|jj|jd�t|j|j�|jj|j
d�t|j|d�|jj|d�|j|_||_dS)Nrr0rr=)rBrXr�r'r�r[r�r�rmr�r�r�r-r�)rIZcurposr�rrrr	r�as&





zAifc_write._patchheadercCs�t|j�dkrdS|jjd�d}xD|jD]:}|\}}}|t|�dd}t|�d@dkr*|d}q*Wt|j|�|d|_t|jt|j��x<|jD]2}|\}}}t|j|�t|j|�t|j|�q�WdS)NrsMARKrr�r=)r1r@rBr'r-r�r*r4)rIrrirhrkr�rrr	r�ws"


zAifc_write._writemarkers)(rrrrBrRrKr�rSrUr�r�r�rZr�r^r�r`r�r\r�rbrdr�rer�rjrfrXr�r�rPr�r�r�r�r�r�r�r�r�rrrr	r�sJ	

3
r�cCsJ|dkrt|d�r|j}nd}|dkr.t|�S|dkr>t|�Std��dS)	N�moderL�rr�r�z$mode must be 'r', 'rb', 'w', or 'wb')r�rL)r�r�)rur�r<r�r)r!r�rrr	r�s
�__main__rz/usr/demos/data/audio/bach.aiffr�ZReadingznchannels =znframes   =zsampwidth =zframerate =zcomptype  =zcompname  =rZWritingr�izDone.)N)8rrOr~�__all__�	Exceptionrr�rrrrrrr&r*r+r,r-r4r8rJr9�collectionsr:r;r��__doc__r�r�ror�r�r<r�rrr�sys�argvr��fnr!�printrZr\r^r`rbrdZgn�gr�rerprr�rrrr	�<module>�sx

!~







pyclbr.cpython-36.opt-2.pyc000064400000012703150335715140011434 0ustar003


 \�4�@s�ddlZddlZddlZddlZddlmZmZmZddddgZ	iZ
Gdd�d�ZGdd�d�Zdd	d�Z
dd
d�Zddd�Zd
d�Zdd�Zdd�Zedkr�e�dS)�N)�NAME�DEDENT�OP�
readmodule�
readmodule_ex�Class�Functioncs$eZdZ�fdd�Zdd�Z�ZS)rcs4||_||_|dkrg}||_i|_||_||_dS)N)�module�name�super�methods�file�lineno)�selfr	r
rr
r)�	__class__��/usr/lib64/python3.6/pyclbr.py�__init__7szClass.__init__cCs||j|<dS)N)r)rr
rrrr�
_addmethodAszClass._addmethod)�__name__�
__module__�__qualname__rr�
__classcell__rr)rrr5s
c@seZdZdd�ZdS)rcCs||_||_||_||_dS)N)r	r
r
r)rr	r
r
rrrrrFszFunction.__init__N)rrrrrrrrrDscCs:i}x0t||pg�j�D]\}}t|t�r|||<qW|S)N)�_readmodule�items�
isinstancer)r	�path�res�key�valuerrrrLs

cCst||p
g�S)N)r)r	rrrrrXsc&!Cs�|dk	rd||f}n|}|tkr*t|Si}|tjkrL|dkrL|t|<|S|jd�}|dkr�|d|�}||dd�}t|||�}|dk	r�d||f}d|kr�tdj|���t||d|�Sd}	|dk	r�|}
n
|tj}
tj	j
||
�}|t|<|jdk	�r|j|d<y|jj
|�}|dk�r$|SWnttfk
�r@|SX|jj|�}
tj|�}	g}tj|	j�}�y<�x4|D�]*\}}}}}|tk�r�|\}}x$|�r�|dd|k�r�|d=�q�W�qt|dk�rl|\}}x$|�r�|dd|k�r�|d=�q�Wt|�dd�\}}}|tk�r�qt|�rH|dd}t|t��rZ|j||�nt|||
|�||<|jd|f��qt|d	k�rD|\}}x$|�r�|dd|k�r�|d=�q�Wt|�dd�\}}}|tk�rȐqtt|�dd�\}}}d}|d
k�rg}d}g}�xt|�dd�\}}}|dk�r�|dk�r�d
j|�}||k�rD||}nL|jd�}t|�dk�r�|d} |d}| tk�r�t| }!||!k�r�|!|}|j|�g}|d
k�r�|d7}nX|dk�r�|d8}|dk�r
Pn8|dk�r�|dk�r�n"|tt fk�r�|dk�r�|j|��q�W|}t||||
|�}|�s2|||<|j||f��qt|dk�r�|ddk�r�t!|�}"xl|"D]d\}#}$yL|dk�r�t|#|�n2yt|#||�Wn tk
�r�t|#g�YnXWnYnX�qjWn�|dk�rt|ddk�rtt"|�\}#}|#�st|dk�r�qtt!|�}yt|#||�}!Wn�wtYnXxd|D]\\}}%||!k�rd|!|||%�p`|<n4|dk�r>x(|!D] }|ddk�rt|!|||<�qtW�q>W�qtWWnt#k
�r�YnX|	j$�|S)Nz%s.%s�.r��__path__zNo package named {}�def��class�(�)�,���import�from�*�_���r/r/r/r/r/r/)r'r(���r/)%�_modules�sys�builtin_module_names�rfindr�ImportError�formatr�	importlib�util�_find_spec_from_path�submodule_search_locations�loader�
get_source�AttributeError�get_filename�io�StringIO�tokenize�generate_tokens�readliner�nextrrrrr�append�join�split�lenr�_getnamelist�_getname�
StopIteration�close)&r	rZ	inpackageZ
fullmodule�dict�i�packageZ	submodule�parent�fZsearch_path�spec�sourceZfname�stack�g�	tokentype�token�startZ_end�_linerZ
thisindentZ	meth_nameZ	cur_class�
class_nameZinherit�names�levelr�n�c�m�d�modules�modZ_mod2Zn2rrrras	


























"rcCstg}xjt|�\}}|sP|dkr.t|�\}}nd}|j||f�x |dkr`d|kr`t|�d}qBW|dkrPqW|S)N�asr(�
r!)rJrErD)rUr[r
rWZname2rrrrIsrIcCs�g}t|�dd�\}}|tkr0|dkr0d|fS|j|�xJt|�dd�\}}|dkrZPt|�dd�\}}|tkrxP|j|�q<Wdj|�|fS)Nrr*r-r )rDrrErF)rU�partsrVrWrrrrJ3s
rJc
Csddl}ddlm}tjd}|jj|�r`|jj|�g}|jj|�}|j	�j
d�rd|dd
�}ng}t||�}t|j
��}|jdd�d�x�|D]z}t|t�r�td	|j|j|j�t|jj�|d�d�}x@|D]\}}	|d
kr�td||	�q�Wq�t|t�r�td|j|j�q�WdS)Nr)�
itemgetterr!z.pyr$cSst|dd�S)Nrr)�getattr)�arrr�<lambda>Tsz_main.<locals>.<lambda>)rr%r"z  defr#���)�os�operatorrfr2�argvr�exists�dirname�basename�lower�endswithr�list�values�sortrr�printr
rr�sortedrrr)
rkrfrbrrMZobjs�objrr
rrrr�_mainFs*




ry�__main__)N)N)N)r?r2�importlib.utilr7rArWrrr�__all__r1rrrrrrIrJryrrrrr�<module>*s"

	
?keyword.cpython-36.opt-1.pyc000064400000003347150335715140011630 0ustar003


 \��!@svdZddgZddddddd	d
ddd
ddddddddddddddddddd d!d"d#g!Zee�jZd$d%�Zed&krre�d'S)(z�Keywords (from "graminit.c")

This file is automatically generated; please don't muck it up!

To update the symbols in this file, 'cd' to the top directory of
the python source tree after building the interpreter and run:

    ./python Lib/keyword.py
�	iskeyword�kwlist�False�None�True�and�as�assert�break�class�continue�def�del�elif�else�except�finally�for�from�global�if�import�in�is�lambda�nonlocal�not�or�pass�raise�return�try�while�with�yieldcCs|ddl}ddl}|jdd�}|r*|dp,d}t|�dkrD|d}nd}t|dd��}|j�}WdQRX|r�|dt|dj��d�nd}t|��T}|jd�}g}	x>|D]6}
d	|
kr�|j|
�}|r�|	j	d
|j
d�d|�q�WWdQRX|	j�y0|jd|�d}|jd
|�}
|	|||
�<Wn,t
k
�rR|jjd�|jd�YnXt|ddd��}|j|�WdQRXdS)N��zPython/graminit.czLib/keyword.py�)�newline�
z	"([^"]+)"z{1, "z	        'z',z#--start keywords--z#--end keywords--z'target does not contain format markers
�w)�sys�re�argv�len�open�	readlines�strip�compile�search�append�group�sort�index�
ValueError�stderr�write�exit�
writelines)r*r+�args�iptfile�optfile�fp�format�nl�strprog�lines�line�match�start�end�rH�/usr/lib64/python3.6/keyword.py�main7s6
$



*rJ�__main__N)�__doc__�__all__r�	frozenset�__contains__rrJ�__name__rHrHrHrI�<module>sL
&zipfile.cpython-36.opt-1.pyc000064400000143150150335715140011603 0ustar003

�\dh48�2@s�dZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZyddlZWne
k
r|ddlZYnXyddlZejZWne
k
r�dZejZYnXyddlZWne
k
r�dZYnXyddlZWne
k
r�dZYnXddddddd	d
ddd
dgZGdd�de�ZGdd�de�ZeZZdfZdhZdjZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&e
j'e%�Z(dZ)dZ*dZ+dZ,dZ-d Z.d!Z/d"Z0dZ1d#Z2d$Z3d%Z4e
j'e3�Z5dZ6dZ7dZ8dZ9dZ:d Z;d!Z<d"Z=dZ>d#Z?d&Z@d'ZAdZBd(ZCdZDd)ZEdZFd*ZGd+ZHd,ZId-ZJe
j'eI�ZKdZLdZMdZNdZOdZPd ZQd!ZRd"ZSdZTd#ZUd&ZVd'ZWd.ZXd/ZYe
j'eX�ZZd0Z[d1Z\e
j'e[�Z]dZ^dZ_dZ`dZadZbd Zcd!Zdd"ZedZfd#Zgd2Zhe
jid3�Zjd4d5�Zkd6d7�Zld8d
�Zmd9d:�Znd;d<�ZoGd=d�dep�ZqGd>d?�d?�ZrGd@dA�dA�ZsGdBdC�dC�ZtdDdEdFdFdFdFdGdHdIdJdGdKdLdMdNdOdPdQ�ZudRdS�ZvdTdU�ZwdVdW�ZxGdXdY�dY�ZyGdZd[�d[�ZzGd\d]�d]ej{�Z|Gd^d_�d_ej{�Z}Gd`d�d�Z~Gdad
�d
e~�Zdkdbdc�Z�e�ddk�r�e��dS)lzP
Read and write ZIP files.

XXX references to utf-8 need further investigation.
�N�
BadZipFile�
BadZipfile�error�
ZIP_STORED�ZIP_DEFLATED�	ZIP_BZIP2�ZIP_LZMA�
is_zipfile�ZipInfo�ZipFile�	PyZipFile�LargeZipFilec@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/zipfile.pyr+sc@seZdZdZdS)r
zu
    Raised when writing a zipfile, the zipfile requires ZIP64 extensions
    and those extensions are disabled.
    N)rrr�__doc__rrrrr
/s��������-�.�?s<4s4H2LHsPK�������	z<4s4B4HL2L5H2LsPK�
��
���z<4s2B4HL2L2HsPKz<4sLQLsPKz
<4sQ2H2L4QsPKiPKz<HHc
Cs�tj}d}g}d}}xf|dt|�kr|||||d��\}}|d|}	||krv||krn|j|||��|	}d}|	}qW|s�|Sdj|�S)NFrr T�)�_EXTRA_FIELD_STRUCT�unpack�len�append�join)
�extraZxidsr-Zmodified�buffer�start�iZxidZxlen�jrrr�_strip_extra�s r6cCs*yt|�rdSWntk
r$YnXdS)NTF)�_EndRecData�OSError)�fprrr�_check_zipfile�sr:cCsVd}y8t|d�rt|d�}nt|d��}t|�}WdQRXWntk
rPYnX|S)z�Quickly see if a file is a ZIP file by checking the magic number.

    The filename argument may be a file or file-like object too.
    F�read)r9�rbN)�hasattrr:�openr8)�filename�resultr9rrrr	�s
cCsy|j|td�Wntk
r(|SX|jt�}t|�tkrD|Stjt|�\}}}}|tkrd|S|dkst|dkr|t	d��|j|tt
d�|jt
�}t|�t
kr�|Stjt|�\
}}}	}
}}}
}}}|tkr�|S||t
<||t<||t<|
|t<||t<||t<||t<|S)zM
    Read the ZIP64 end-of-archive records and use that to update endrec
    rrrz3zipfiles that span multiple disks are not supported)�seek�sizeEndCentDir64Locatorr8r;r.�structr-�structEndArchive64Locator�stringEndArchive64Locatorr�sizeEndCentDir64�structEndArchive64�stringEndArchive64�_ECD_SIGNATURE�_ECD_DISK_NUMBER�_ECD_DISK_START�_ECD_ENTRIES_THIS_DISK�_ECD_ENTRIES_TOTAL�	_ECD_SIZE�_ECD_OFFSET)�fpin�offset�endrec�dataZsigZdisknoZreloffZdisksZsz�create_versionZread_versionZdisk_numZdisk_dirZdircountZ	dircount2ZdirsizeZ	diroffsetrrr�
_EndRecData64�s6

 rUc	Csf|jdd�|j�}y|jtd�Wntk
r:dSX|j�}t|�tkr�|dd�tkr�|d	d�dkr�tjt	|�}t
|�}|jd�|j|t�t|t|�St
|d
td�}|j|d�|j�}|jt�}|dk�rb|||t�}t|�tk�rdSt
tjt	|��}|t}||t|t|�}|j|�|j||�t|||||�SdS)z�Return data from the "End of Central Directory" record, or None.

    The data is a list of the nine items in the ZIP "End of central dir"
    record followed by a tenth item, the file seek offset of this record.rrNr sr+rr���i)rA�tell�sizeEndCentDirr8r;r.�stringEndArchiverCr-�structEndArchive�listr/rU�max�rfind�_ECD_COMMENT_SIZE)	rPZfilesizerSrRZmaxCommentStartr3ZrecDataZcommentSize�commentrrrr7s>



r7c@sVeZdZdZd)Zd+dd�Zdd�Zd,dd �Zd!d"�Zd#d$�Z	e
d-d%d&��Zd'd(�ZdS).r
z>Class with attributes describing each file in the ZIP archive.�
orig_filenamer?�	date_time�
compress_typer_r1�
create_systemrT�extract_version�reserved�	flag_bits�volume�
internal_attr�
external_attr�
header_offset�CRC�
compress_size�	file_size�	_raw_time�_end_offset�NoName�rrcCs�||_|jtd��}|dkr(|d|�}tjdkrJtj|krJ|jtjd�}||_||_|ddkrjtd��t	|_
d|_d|_t
jdkr�d|_nd|_t|_t|_d|_d|_d|_d|_d|_d|_dS)Nr�/i�z+ZIP does not support timestamps before 1980r+Zwin32r)r`�find�chr�os�sep�replacer?ra�
ValueErrorrrbr_r1�sys�platformrc�DEFAULT_VERSIONrTrdrerfrgrhriro)�selfr?raZ	null_byterrr�__init__Xs0
zZipInfo.__init__cCs�d|jj|jfg}|jtkr8|jdtj|j|j��|jd?}|jd@}|rd|jdt	j
|��|rv|jd|�|j�}|s�|jr�|jd|j�|s�|j
r�|jtks�|j|j
kr�|jd|j
�|jd	�d
j|�S)Nz<%s filename=%rz compress_type=%sri��z filemode=%rz external_attr=%#xz
 file_size=%rz compress_size=%r�>�)�	__class__rr?rbrr/�compressor_names�getri�stat�filemode�is_dirrmrlr0)r|r@�hi�lo�isdirrrr�__repr__�s(




zZipInfo.__repr__NcCs||j}|ddd>|dd>B|dB}|dd>|d	d>B|ddB}|jd
@rfd}}}n|j}|j}|j}|j}d}	|dkr�|tkp�|tk}|r�d}
|tj|
dtj	|
�d	||�}|tks�|tkr�|s�t
d
��d}d}t}	|jt
k�rtt|	�}	n|jtk�rtt|	�}	t|	|j�|_t|	|j�|_|j�\}}tjtt|j|j||j|||||t|�t|��
}
|
||S)z-Return the per-file header as a bytes object.ri�r$rr!rrr&r rNz<HHQQz'Filesize would require ZIP64 extensionsl��)rarfrkrlrmr1�ZIP64_LIMITrC�pack�calcsizer
�
ZIP64_VERSIONrbrr\�
BZIP2_VERSIONr�LZMA_VERSIONrdrT�_encodeFilenameFlags�structFileHeader�stringFileHeaderrer.)r|�zip64�dt�dosdate�dostimerkrlrmr1�min_version�fmtr?rf�headerrrr�
FileHeader�sF$$



zZipInfo.FileHeadercCs>y|jjd�|jfStk
r8|jjd�|jdBfSXdS)N�asciizutf-8i)r?�encoderf�UnicodeEncodeError)r|rrrr��szZipInfo._encodeFilenameFlagscCs(|j}tj}�xt|�dk�r"|d|dd��\}}|dk�r|dkrZ|d|dd��}nV|dkrv|d|dd	��}n:|d
kr�|d|dd��}n|d
kr�f}ntd||f��d
}|jdkr�|||_|d7}|jdkr�|||_|d7}|jdk�r|j}|||_|d7}||dd�}qWdS)Nr z<HHr�z<QQQ�rz<QQrrz<Qrrz"Corrupt extra field %04x (size=%d)��������)r�r�)r1rCr-r.rrmrlrj)r|r1r-�tp�lnZcounts�idx�oldrrr�_decodeExtra�s4





zZipInfo._decodeExtracCs�t|tj�rtj|�}tj|�}tj|j�}tj|j	�}|dd�}|dkrP|}tj
jtj
j|�d�}x$|dtj
tjfkr�|dd�}qjW|r�|d7}|||�}|jd@d>|_|r�d|_|jdO_n|j|_|S)a_Construct an appropriate ZipInfo for a file on the filesystem.

        filename should be the path to a file or directory on the filesystem.

        arcname is the name which it will have within the archive (by default,
        this will be the same as filename, but without a drive letter and with
        leading path separators removed).
        rr"Nrrri��r)�
isinstanceru�PathLike�fspathr��S_ISDIR�st_mode�time�	localtime�st_mtime�path�normpath�
splitdriverv�altseprirm�st_size)�clsr?�arcname�str��mtimera�zinforrr�	from_file�s(



zZipInfo.from_filecCs|jddkS)z2Return True if this archive member is a directory.rrr���)r?)r|rrrr�szZipInfo.is_dir)r`r?rarbr_r1rcrTrdrerfrgrhrirjrkrlrmrnro�rqrrrrr)rpr�)N)N)
rrrr�	__slots__r}r�r�r�r��classmethodr�r�rrrrr
>s:
+
.$!c@s<eZdZdZdd�ZdZdd�Zdd�Zd	d
�Zdd�Z	dS)
�
_ZipDecrypteraClass to handle decryption of files stored within a ZIP archive.

    ZIP supports a password-based form of encryption. Even though known
    plaintext attacks have been found against it, it is still useful
    to be able to get data out of such a file.

    Usage:
        zd = _ZipDecrypter(mypwd)
        plain_char = zd(cypher_char)
        plain_text = map(zd, cypher_text)
    cCshd}dgd}xTtd�D]H}|}x6td�D]*}|d@rH|d?d@|A}q*|d?d@}q*W|||<qW|S)z�Generate a CRC-32 table.

        ZIP encryption uses the CRC32 one-byte primitive for scrambling some
        internal keys. We noticed that a direct implementation is faster than
        relying on binascii.crc32().
        l q[r�rri���)�range)Zpoly�tabler4�crcr5rrr�_GenerateCRCTable%s
z_ZipDecrypter._GenerateCRCTableNcCs|d?d@|j||Ad@AS)z(Compute the CRC32 primitive on one byte.ri����)�crctable)r|Zchr�rrr�_crc329sz_ZipDecrypter._crc32cCsBtjdkrtj�t_d|_d|_d|_x|D]}|j|�q,WdS)NixV4i�gE#i�xV4)r�r�r��key0�key1�key2�_UpdateKeys)r|�pwd�prrrr}=s


z_ZipDecrypter.__init__cCsX|j||j�|_|j|jd@d@|_|jddd@|_|j|jd?d@|j�|_dS)Nr�l��i�rr�)r�r�r�r�)r|�crrrr�Fsz_ZipDecrypter._UpdateKeyscCs0|jdB}|||dAd?d@A}|j|�|S)zDecrypt a single character.rrrr�)r�r�)r|r��krrr�__call__Ls

z_ZipDecrypter.__call__)
rrrrr�r�r�r}r�r�rrrrr�s	r�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�LZMACompressorcCs
d|_dS)N)�_comp)r|rrrr}WszLZMACompressor.__init__cCsFtjdtji�}tjtjtjtj|�gd�|_tjdddt	|��|S)N�id)�filtersz<BBHr$r )
�lzmaZ_encode_filter_properties�FILTER_LZMA1r��
FORMAT_RAW�_decode_filter_propertiesr�rCr�r.)r|Zpropsrrr�_initZszLZMACompressor._initcCs*|jdkr|j�|jj|�S|jj|�S)N)r�r��compress)r|rSrrrr�as
zLZMACompressor.compresscCs&|jdkr|j�|jj�S|jj�S)N)r�r��flush)r|rrrr�fs
zLZMACompressor.flushN)rrrr}r�r�r�rrrrr�Usr�c@seZdZdd�Zdd�ZdS)�LZMADecompressorcCsd|_d|_d|_dS)Nr+F)�_decomp�_unconsumed�eof)r|rrrr}nszLZMADecompressor.__init__cCs�|jdkr�|j|7_t|j�dkr*dStjd|jdd��\}t|j�d|krXdStjtjtjtj	|jdd|��gd�|_|jd|d�}|`|jj
|�}|jj|_|S)Nr r+z<Hr)r�)r�r�r.rCr-r�r�r�r�r��
decompressr�)r|rSZpsizer@rrrr�ss

zLZMADecompressor.decompressN)rrrr}r�rrrrr�lsr�ZstoreZshrink�reduceZimplode�tokenizeZdeflateZ	deflate64Zbzip2r�ZterseZlz77ZwavpackZppmd)rrrrr r!r"r#rr$r%rrr*��a�bcCsX|tkr
nJ|tkr tsTtd��n4|tkr6tsTtd��n|tkrLtsTtd��ntd��dS)Nz.Compression requires the (missing) zlib modulez-Compression requires the (missing) bz2 modulez.Compression requires the (missing) lzma modulez(That compression method is not supported)	rr�zlib�RuntimeErrorr�bz2rr��NotImplementedError)�compressionrrr�_check_compression�sr�cCs@|tkrtjtjtjd�S|tkr*tj�S|tkr8t	�SdSdS)Nr(i�)
rr�ZcompressobjZZ_DEFAULT_COMPRESSIONZDEFLATEDrr�Z
BZ2Compressorrr�)rbrrr�_get_compressor�s
r�cCsn|tkrdS|tkrtjd�S|tkr.tj�S|tkr<t�St	j
|�}|r\td||f��ntd|f��dS)Nr(zcompression type %d (%s)zcompression type %di�)rrr�Z
decompressobjrr�ZBZ2Decompressorrr�r�r�r�)rbZdescrrrr�_get_decompressor�s

r�c@s0eZdZdd�Zddd�Zddd�Zd	d
�ZdS)�_SharedFilecCs2||_||_||_||_||_|j|_|j|_dS)N)�_file�_pos�_close�_lock�_writing�seekablerW)r|�file�pos�close�lock�writingrrrr}�sz_SharedFile.__init__rc	CsB|j�2|j�rtd��|jj|j�|jj�|_|jSQRXdS)Nz}Can't reposition in the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.)r�r�rxr�rAr�rW)r|rQ�whencerrrrA�sz_SharedFile.seekrc	CsL|j�<|j�rtd��|jj|j�|jj|�}|jj�|_|SQRXdS)NzyCan't read from the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.)r�r�rxr�rAr�r;rW)r|�nrSrrrr;�sz_SharedFile.readcCs$|jdk	r |j}d|_|j|�dS)N)r�r�)r|�fileobjrrrr��s
z_SharedFile.closeN)rr�)r�)rrrr}rAr;r�rrrrr��s	


r�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�	_TellablecCs||_d|_dS)Nr)r9rQ)r|r9rrrr}�sz_Tellable.__init__cCs|jj|�}|j|7_|S)N)r9�writerQ)r|rSr�rrrr��sz_Tellable.writecCs|jS)N)rQ)r|rrrrW�sz_Tellable.tellcCs|jj�dS)N)r9r�)r|rrrr��sz_Tellable.flushcCs|jj�dS)N)r9r�)r|rrrr�sz_Tellable.closeN)rrrr}r�rWr�r�rrrrr��s
r�cs�eZdZdZd&ZdZd'Zd(dd	�Zd
d�Zd*dd
�Z	d+dd�Z
dd�Zd-dd�Zdd�Z
dd�Zdd�Zdd�Z�fdd�Zdd�Zd.d!d"�Zd#d$�Z�ZS)/�
ZipExtFilezZFile-like object for reading an archive member.
       Is returned by ZipFile.open().
    rrir�NFcCs�||_||_||_|j|_|j|_|j|_t	|j�|_
d|_d|_d|_
d|_|jdk	rf|jd8_||_|j|_t|d�r�|j|_td�|_nd|_d|_y4|j�r�|j�|_|j|_|j|_|j|_d|_Wntk
r�YnXdS)NFr+rrrkT)�_fileobj�
_decrypter�_close_fileobjrb�_compress_typerl�_compress_leftrm�_leftr��
_decompressor�_eof�_readbuffer�_offset�newlines�moder?�namer=rk�
_expected_crc�crc32�_running_crc�	_seekabler�rW�_orig_compress_start�_orig_compress_size�_orig_file_size�_orig_start_crc�AttributeError)r|r�r
�zipinfoZ	decrypterZ
close_fileobjrrrr}s:



zZipExtFile.__init__cCsvd|jj|jjfg}|jsX|jd|j|jf�|jtkrb|jdt	j
|j|j��n
|jd�|jd�dj|�S)Nz<%s.%sz name=%r mode=%rz compress_type=%sz	 [closed]r~r)r�rr�closedr/rr
rrr�r�r0)r|r@rrrr�?s


zZipExtFile.__repr__cCsL|dkr>|jjd|j�d}|dkr>|j|j|�}||_|Stjj||�S)zrRead and return a line from the stream.

        If limit is specified, at most limit bytes will be read.
        r�
r)rrsr�io�BufferedIOBase�readline)r|�limitr4�linerrrrMszZipExtFile.readlinecCsr|t|j�|jkr\|j|�}t|�|jkrJ||j|jd�|_d|_n|jt|�8_|j|j|jd�S)z6Returns buffered bytes without advancing the position.Nri)r.rrr;)r|r��chunkrrr�peek]s
zZipExtFile.peekcCsdS)NTr)r|rrr�readablejszZipExtFile.readablecCs|dks|dkrL|j|jd�}d|_d|_x|jsF||j|j�7}q.W|S||j}|t|j�kr~|j|j|�}||_|S|t|j�}|j|jd�}d|_d|_x^|dko�|j�r|j|�}|t|�kr�||_||_||d|�7}P||7}|t|�8}q�W|S)z�Read and return up to n bytes.
        If the argument is omitted, None, or negative, data is read and returned until EOF is reached..
        Nrr+)rrr�_read1�MAX_Nr.)r|r��buf�endrSrrrr;ms4

zZipExtFile.readcCs@|jdkrdSt||j�|_|jr<|j|jkr<td|j��dS)NzBad CRC-32 for file %r)rr
rrrr)r|�newdatarrr�_update_crc�s

zZipExtFile._update_crccCs|dks|dkrV|j|jd�}d|_d|_x$|jsP|j|j�}|r.||7}Pq.W|S||j}|t|j�kr�|j|j|�}||_|S|t|j�}|j|jd�}d|_d|_|dk�rxN|j�s
|j|�}|t|�kr�||_||_||d|�7}P|r�||7}Pq�W|S)z7Read up to n bytes with at most one read() system call.Nrr+)rrrr r!r.)r|r�r"rSr#rrr�read1�s>



zZipExtFile.read1cCs"|js|dkrdS|jtkrH|jj}|t|�krR||j|t|��7}n
|j|�}|jtkrj|jdk|_nx|jtkr�t	||j
�}|jj||�}|jjp�|jdko�|jj|_|jr�||jj
�7}n |jj|�}|jjp�|jdk|_|d|j�}|jt|�8_|jdk�rd|_|j|�|S)Nrr+T)rrrrZunconsumed_tailr.�_read2rrr\�
MIN_READ_SIZEr�r�r�rr%)r|r�rSrrrr �s2





zZipExtFile._read1cCsj|jdkrdSt||j�}t||j�}|jj|�}|jt|�8_|sLt�|jdk	rft	t
|j|��}|S)Nrr+)rr\r(�minr�r;r.�EOFErrorr�bytes�map)r|r�rSrrrr'�s

zZipExtFile._read2c
s&z|jr|jj�Wdt�j�XdS)N)rr�r��super)r|)r�rrr��szZipExtFile.closecCs|jS)N)r)r|rrrr��szZipExtFile.seekablercCs,|jstjd��|j�}|dkr&|}n.|dkr8||}n|dkrL|j|}ntd��||jkrd|j}|dkrpd}||}||j}|dkr�|t|j�kr�||_d}nR|dkr�|j	j
|j�|j|_
|j|_|j|_d|_d|_tj|j�|_d|_|}x,|dk�r"t|j|�}|j|�||8}q�W|j�S)Nz!underlying stream is not seekablerrrzCwhence must be os.SEEK_SET (0), os.SEEK_CUR (1), or os.SEEK_END (2)r+F)rr�UnsupportedOperationrWrrxrr.rr�rArrrrrrZzipfiler�rrrr)�
MAX_SEEK_READr;)r|rQr�Zcurr_posZnew_posZread_offsetZbuff_offsetZread_lenrrrrA�sD




zZipExtFile.seekcCs0|jstjd��|j|jt|j�|j}|S)Nz!underlying stream is not seekable)rrr.rrr.rr)r|ZfileposrrrrW*s
zZipExtFile.tell�i@i)NFr�)r�)rr�)r�)r)rrrrr!r(r/r}r�rrrr;r%r&r r'r�r�rArW�
__classcell__rr)r�rr�s&
*



!
%$
/r�cs@eZdZdd�Zedd��Zdd�Zdd�Z�fd	d
�Z�Z	S)�
_ZipWriteFilecCs4||_||_||_t|j�|_d|_d|_d|_dS)Nr)	�_zinfo�_zip64�_zipfiler�rb�_compressor�
_file_size�_compress_size�_crc)r|�zfr�r�rrrr}2sz_ZipWriteFile.__init__cCs|jjS)N)r5r9)r|rrrr�;sz_ZipWriteFile._fileobjcCsdS)NTr)r|rrr�writable?sz_ZipWriteFile.writablecCsf|jrtd��t|�}|j|7_t||j�|_|jrV|jj|�}|jt|�7_|j	j
|�|S)NzI/O operation on closed file.)rrxr.r7r
r9r6r�r8r�r�)r|rS�nbytesrrrr�Bsz_ZipWriteFile.writecsX|jr
dSt�j�|jrN|jj�}|jt|�7_|jj|�|j|j	_
n
|j|j	_
|j|j	_
|j|j	_|j	jd@r�|jr�dnd}|jjtj|t|j	j
|j	j
|j	j��|jj�|j_nn|js�|jtkr�td��|jtkr�td��|jj�|j_|jj|j	j�|jj|j	j|j��|jj|jj�d|j_|jjj|j	�|j	|jj|j	j <dS)Nrz<LLQQz<LLLLz+File size unexpectedly exceeded ZIP64 limitz1Compressed size unexpectedly exceeded ZIP64 limitF)!rr-r�r6r�r8r.r�r�r3rlr7r9rkrmrfr4rCr��
_DD_SIGNATURErWr5�	start_dirr�r�rArjr�r��filelistr/�
NameToInfor?)r|r"r�)r�rrr�Ns8






z_ZipWriteFile.close)
rrrr}�propertyr�r;r�r�r1rr)r�rr21s
	r2c@seZdZdZdZdZdedfdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
d<dd�Zdd�Zdd�Zdd�Zedd��Zejdd��Zd=dd�Zd>d d!�d"d#�Zd?d$d%�Zd@d&d'�ZdAd(d)�Zed*d+��Zd,d-�Zd.d/�ZdBd0d1�ZdCd2d3�Zd4d5�Z d6d7�Z!d8d9�Z"d:d;�Z#dS)Dra� Class with methods to open, read, write, close, list zip files.

    z = ZipFile(file, mode="r", compression=ZIP_STORED, allowZip64=True)

    file: Either the path to the file, or a file-like object.
          If it is a path, the file will be opened and closed by ZipFile.
    mode: The mode can be either read 'r', write 'w', exclusive create 'x',
          or append 'a'.
    compression: ZIP_STORED (no compression), ZIP_DEFLATED (requires zlib),
                 ZIP_BZIP2 (requires bz2) or ZIP_LZMA (requires lzma).
    allowZip64: if True ZipFile will create files with ZIP64 extensions when
                needed, otherwise it will raise an exception when this would
                be necessary.

    N�rTcCsF|dkrtd��t|�||_d|_d|_i|_g|_||_||_d|_	d	|_
t|tj
�rdtj|�}t|t�r�d|_||_d
ddd
dddd�}||}x^ytj||�|_Wn(tk
r�||kr�||}w��YnXPq�Wnd|_||_t|dd�|_d|_tj�|_d|_d|_�y|dk�r*|j�n�|dk�r�d|_y|jj�|_Wn2t tfk
�r|t!|j�|_d|_d|_Yn6Xy|jj"|j�Wn t tfk
�r�d|_YnXnf|dk�ry|j�|jj"|j�Wn6t#k
�r|jj"dd�d|_|jj�|_YnXntd��Wn$|j}d|_|j$|��YnXdS)z]Open the ZIP file with mode read 'r', write 'w', exclusive create 'x',
        or append 'a'.rB�w�x�az+ZipFile requires mode 'r', 'w', 'x', or 'a'FrNr+r<zw+bzx+bzr+b�wbZxb)rBrCrDrEzr+bzw+bzx+brrTrz"Mode must be 'r', 'w', 'x', or 'a')rBrCrDrE)rCrD)%rxr��_allowZip64�
_didModify�debugr@r?r�r
r��_commentr�rur�r��str�_filePassedr?rr>r9r8�getattr�_fileRefCnt�	threading�RLockr�rr��_RealGetContentsrWr>rr�rAr�_fpclose)r|r�r
r��
allowZip64ZmodeDictr�r9rrrr}�s�







zZipFile.__init__cCs|S)Nr)r|rrr�	__enter__�szZipFile.__enter__cCs|j�dS)N)r�)r|�type�value�	tracebackrrr�__exit__�szZipFile.__exit__cCs�d|jj|jjfg}|jdk	rd|jr8|jd|j�n|jdk	rR|jd|j�|jd|j�n
|jd�|jd�dj|�S)Nz<%s.%sz file=%rz filename=%rz mode=%rz	 [closed]r~r)	r�rrr9rLr/r?r
r0)r|r@rrrr��s



zZipFile.__repr__cCs�|j}yt|�}Wntk
r.td��YnX|s<td��|jdkrNt|�|t}|t}|t|_	|t
||}|ttkr�|t
t8}|jdkr�||}td|||�|||_|j|jd�|j|�}tj|�}d}�x�||k�r�|jt�}	t|	�tk�rtd��tjt|	�}	|	ttk�r0td��|jdk�rDt|	�|j|	t�}
|	d}|d	@�rp|
jd
�}
n
|
jd�}
t|
�}|j|	t�|_|j|	t �|_!|	t"|_#|	dd�\|_$|_%|_&|_'|_(|_)}
}|_*|_+|_,|j&t-k�r�t.d
|j&d��|	dd�\|_/|_0|_1|
|_2|d?d|d?d@|d@|
d?|
d?d@|
d@df|_3|j4�|j#||_#|j5j6|�||j7|j8<|t|	t|	t|	t }|jdkr�td|�q�W|j}x*t9|j5dd�dd�D]}||_:|j#}�q�WdS)z/Read in the table of contents for the ZIP file.zFile is not a zip filerrzgiven, inferred, offsetrzTruncated central directoryz&Bad magic number for central directoryr!izutf-8�cp437rzzip file version %.1fr%r(r*r$i�rr&r�totalcSs|jS)N)rj)r�rrr�<lambda>Isz*ZipFile._RealGetContents.<locals>.<lambda>T)�key�reverseN);r9r7r8rrI�printrNrO�_ECD_COMMENTrJ�
_ECD_LOCATIONrIrHrFrBr>rAr;r�BytesIO�sizeCentralDirr.rCr-�structCentralDir�
_CD_SIGNATURE�stringCentralDir�_CD_FILENAME_LENGTH�decoder
�_CD_EXTRA_FIELD_LENGTHr1�_CD_COMMENT_LENGTHr_�_CD_LOCAL_HEADER_OFFSETrjrTrcrdrerfrbrkrlrm�MAX_EXTRACT_VERSIONr�rgrhrirnrar�r?r/r@r?�sortedro)r|r9rRZsize_cdZ	offset_cd�concatZinferredrSrZ�centdirr?�flagsrD�t�dZ
end_offsetr�rrrrQ�s|









4  
zZipFile._RealGetContentscCsdd�|jD�S)z+Return a list of file names in the archive.cSsg|]
}|j�qSr)r?)�.0rSrrr�
<listcomp>Psz$ZipFile.namelist.<locals>.<listcomp>)r?)r|rrr�namelistNszZipFile.namelistcCs|jS)zJReturn a list of class ZipInfo instances for files in the
        archive.)r?)r|rrr�infolistRszZipFile.infolistcCsPtdd
|d�x:|jD]0}d|jdd�}td	|j||jf|d�qWdS)z+Print a table of contents for the zip file.z%-46s %19s %12s�	File Name�Modified    �Size)r�z%d-%02d-%02d %02d:%02d:%02dNr"z
%-46s %s %12d)rvrwrx)r^r?rar?rm)r|r�r�Zdaterrr�printdirWszZipFile.printdircCs^d}xT|jD]J}y.|j|jd��}x|j|�r0q$WWdQRXWqtk
rT|jSXqWdS)z%Read all the files and check the CRC.rrrBNi)r?r>r?r;r)r|Z
chunk_sizer��frrr�testzip`szZipFile.testzipcCs$|jj|�}|dkr td|��|S)z,Return the instance of ZipInfo given 'name'.Nz(There is no item named %r in the archive)r@r��KeyError)r|r�inforrr�getinfoms

zZipFile.getinfocCs8|r"t|t�r"tdt|�j��|r.||_nd|_dS)z)Set default password for encrypted files.zpwd: expected bytes, got %sN)r�r+�	TypeErrorrUrr�)r|r�rrr�setpasswordvs
zZipFile.setpasswordcCs|jS)z.The comment text associated with the ZIP file.)rJ)r|rrrr_szZipFile.commentcCs^t|t�stdt|�j��t|�tkrNddl}|jdtdd�|dt�}||_	d|_
dS)Nzcomment: expected bytes, got %srz3Archive comment is too long; truncating to %d bytesr)�
stacklevelT)r�r+rrUrr.�ZIP_MAX_COMMENT�warnings�warnrJrH)r|r_r�rrrr_�s
c	Cs"|j|d|��
}|j�SQRXdS)zReturn file bytes for name.rBN)r>r;)r|rr�r9rrrr;�szZipFile.readF)�force_zip64cs�|d"krtd��|r2t|t�r2tdt|�j��|rF|dkrFtd���jsTtd��t|t�rd|}n$|dkr~t|�}�j|_	n
�j
|�}|dkr��j||d�S�jr�td���j
d	7_
t�j|j�j�j�fd
d��}�y�|jt�}t|�tk�r�td��tjt|�}|ttk�r td
��|j|t�}|t�rF|j|t�|jd@�rZtd��|jd@�rntd��|jd@�r�|jd�}	n
|jd�}	|	|j k�r�td|j |f��|j!dk	�r�|j"�|j#|j!k�r�td|j �d���|jd	@}
d}|
�r�|�s�j$}|�st%d|��t&|�}|jd�}t't(||dd���}
|jd@�rX|j)d?d@}n|j*d?d@}|
d|k�r�t%d |��t+||||d!�S|j,��YnXdS)#auReturn file-like object for 'name'.

        name is a string for the file name within the ZIP file, or a ZipInfo
        object.

        mode should be 'r' to read a file already in the ZIP file, or 'w' to
        write to a file newly added to the archive.

        pwd is the password to decrypt files (only used for reading).

        When writing, if the file size is not known in advance but may exceed
        2 GiB, pass force_zip64 to use the ZIP64 format, which can handle large
        files.  If the size is known in advance, it is best to pass a ZipInfo
        instance for name, with zinfo.file_size set.
        rBrCzopen() requires mode "r" or "w"zpwd: expected bytes, got %sz'pwd is only supported for reading filesz2Attempt to use ZIP archive that was already closed)r�zyCan't read from the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.rcs�jS)N)r�r)r|rrr[�szZipFile.open.<locals>.<lambda>zTruncated file headerz Bad magic number for file header� z$compressed patched data (flag bit 5)�@zstrong encryption (flag bit 6)izutf-8rYz/File name in directory %r and header %r differ.NzOverlapped entries: z (possible zip bomb)z6File %r is encrypted, password required for extractionrrrr�r�r&zBad password for file %rT>rCrB)-rxr�r+rrUrr9r
r�rbr~�_open_to_writer�rNr�rjrRr�r;�sizeFileHeaderr.rrCr-r��
_FH_SIGNATUREr��_FH_FILENAME_LENGTH�_FH_EXTRA_FIELD_LENGTHrfr�rgr`rorWrlr�r�r�r[r,rnrkr�r�)r|rr
r�r�r�Zzef_fileZfheader�fnameZ	fname_strZis_encryptedZzdr��hZ
check_byter)r|rr>�s�








zZipFile.opencCs�|r|jrtd��|jr"td��t|d�s2d|_d|_d|_d|_|jt	kr\|jdO_|j
sp|jdO_|js|d|_|jo�|p�|jd	tk}|j
r�|j
j|j�|j
j�|_|j|�d
|_|j
j|j|��d
|_t|||�S)NzHforce_zip64 is True, but allowZip64 was False when opening the ZIP file.zzCan't write to the ZIP file while there is another write handle open on it. Close the first handle before opening another.rmrrri�rg�������?Ti�)rGrxr�r=rmrlrkrfrbrrrir�r9rAr>rWrj�_writecheckrHr�r�r2)r|r�r�r�rrrr�s4


zZipFile._open_to_writecCs*|dkrtj�}n
tj|�}|j|||�S)a#Extract a member from the archive to the current working directory,
           using its full name. Its file information is extracted as accurately
           as possible. `member' may be a filename or a ZipInfo object. You can
           specify a different directory using `path'.
        N)ru�getcwdr��_extract_member)r|�memberr�r�rrr�extract6s

zZipFile.extractcCsL|dkr|j�}|dkr"tj�}n
tj|�}x|D]}|j|||�q2WdS)z�Extract all members from the archive to the current working
           directory. `path' specifies a different directory to extract to.
           `members' is optional and must be a subset of the list returned
           by namelist().
        N)rtrur�r�r�)r|r��membersr�rrrr�
extractallCs


zZipFile.extractallcCs^|j}|s(d}tj|dt|��}||_|j|�}dd�|j|�D�}|jdd�|D��}|S)z;Replace bad characters and remove trailing dots from parts.z:<>|"?*�_css|]}|jd�VqdS)�.N)�rstrip)rrrDrrr�	<genexpr>^sz1ZipFile._sanitize_windows_name.<locals>.<genexpr>css|]}|r|VqdS)Nr)rrrDrrrr�`s)�!_windows_illegal_name_trans_tablerK�	maketransr.�	translate�splitr0)r�r��pathsepr�Zillegalrrr�_sanitize_windows_nameTs
zZipFile._sanitize_windows_namecsNt|t�s|j|�}|jjdtjj�}tjjrB|jtjjtjj�}tjj	|�d}dtjj
tjjf�tjjj�fdd�|j
tjj�D��}tjjdkr�|j|tjj�}tjj||�}tjj|�}tjj|�}|r�tjj|�r�tj|�|j��rtjj|��s
tj|�|S|j||d��(}t|d��}tj||�Wd	QRXWd	QRX|S)
zbExtract the ZipInfo object 'member' to a physical
           file on the path targetpath.
        rrrrc3s|]}|�kr|VqdS)Nr)rrrD)�invalid_path_partsrrr�tsz*ZipFile._extract_member.<locals>.<genexpr>�\)r�rFN)r�r
r~r?rwrur�rvr�r��curdir�pardirr0r�r�r��dirname�exists�makedirsr�r��mkdirr>�shutil�copyfileobj)r|r�Z
targetpathr�r�Z	upperdirs�source�targetr)r�rr�cs.

&


 zZipFile._extract_membercCs�|j|jkr(ddl}|jd|jdd�|jdkr:td	��|jsHtd
��t|j�|j	s�d}t
|j�tkrpd}n|j
tkr�d}n|jtkr�d
}|r�t|d��dS)z6Check for errors before writing a file to the archive.rNzDuplicate name: %rr)r�rCrDrEz&write() requires mode 'w', 'x', or 'a'z4Attempt to write ZIP archive that was already closedzFiles countZFilesizezZipfile sizez would require ZIP64 extensions)rCrDrE)r?r@r�r�r
rxr9r�rbrGr.r?�ZIP_FILECOUNT_LIMITrmr�rjr
)r|r�r��requires_zip64rrrr��s(



zZipFile._writecheckcCs0|jstd��|jrtd��tj||�}|j�r>d|_d|_n|dk	rN||_n|j	|_|j�r�|j
��|jrz|jj|j
�|jj�|_|jtkr�|jdO_|j|�d|_|jj|�||j|j<|jj|jd��|jj�|_
WdQRXn<t|d��,}|j|d	��}tj||d�WdQRXWdQRXdS)
zLPut the bytes from filename into the archive under the name
        arcname.z7Attempt to write to ZIP archive that was already closedz>Can't write to ZIP archive while an open writing handle existsrNrTFr<rCiri )r9rxr�r
r�r�rlrkrbr�r�rrAr>rWrjrrfr�rHr?r/r@r?r�r�r>r�r�)r|r?r�rbr��src�destrrrr��s8

z
ZipFile.writecCs�t|t�r|jd�}t|t�spt|tjtj��dd�d�}|j|_|jddkrhd|_	|j	dO_	qtd|_	n|}|j
s�td
��|jr�td��|dk	r�||_t
|�|_|j�*|j|dd
��}|j|�WdQRXWdQRXdS)aWrite a file into the archive.  The contents is 'data', which
        may be either a 'str' or a 'bytes' instance; if it is a 'str',
        it is encoded as UTF-8 first.
        'zinfo_or_arcname' is either a ZipInfo instance or
        the name of the file in the archive.zutf-8Nr")r?rarrri�Ari�z7Attempt to write to ZIP archive that was already closedz?Can't write to ZIP archive while an open writing handle exists.rC)r
r�i�Ai�)r�rKr�r
r�r�r�rbr?rir9rxr�r.rmr�r>r�)r|Zzinfo_or_arcnamerSrbr�r�rrr�writestr�s.



zZipFile.writestrcCs|j�dS)z2Call the "close()" method in case the user forgot.N)r�)r|rrr�__del__�szZipFile.__del__cCs||jdkrdS|jrtd��zB|jdkr\|jr\|j�"|jrJ|jj|j�|j	�WdQRXWd|j}d|_|j
|�XdS)zOClose the file, and for mode 'w', 'x' and 'a' write the ending
        records.NzvCan't close the ZIP file while there is an open writing handle on it. Close the writing handle before closing the zip.rCrDrE)rCrDrE)r9r�rxr
rHr�rrAr>�_write_end_recordrR)r|r9rrrr��s
z
ZipFile.closecCsr�xP|jD�]D}|j}|ddd>|dd>B|dB}|dd>|d	d>B|ddB}g}|jtksv|jtkr�|j|j�|j|j�d
}d
}n|j}|j}|jtkr�|j|j�d
}n|j}|j}	d}
|�rt|	d�}	t	j
ddt|�dd
t|�f|��|	}	t}
|j
tk�r(tt|
�}
n|j
tk�r>tt|
�}
t|
|j�}t|
|j�}yZ|j�\}
}t	j
tt||j||j||j
|||j||t|
�t|	�t|j�d|j|j|�}Wnltk
�rttt||j||j|j |j
|||j||t|j!�t|	�t|j�d|j|j|ft"j#d��YnX|j$j%|�|j$j%|
�|j$j%|	�|j$j%|j�q
W|j$j&�}t|j�}||j'}|j'}d}|t(k�r�d}n|tk�r�d}n|tk�r�d}|�r*|j)�s�t*|d��t	j
t+t,ddddd||||�}|j$j%|�t	j
t-t.d|d�}|j$j%|�t/|d�}t/|d
�}t/|d
�}t	j
t0t1dd||||t|j2��	}|j$j%|�|j$j%|j2�|j$j3�dS)Nri�r$rr!rrr&r l��z<HH�Qr)r�zFiles countzCentral directory offsetzCentral directory sizez would require ZIP64 extensions�,ri��)r)4r?rarmr�rlr/rjr1r6rCr�r.r�rbrr\r�rr�rdrTr�rcrercrerkr_rhri�DeprecationWarningr^rfr?ry�stderrr9r�rWr>r�rGr
rGrHrDrEr)rZrYrJr�)r|r�r�r�r�r1rmrlrjZ
extra_datar�rdrTr?rfrnZpos2ZcentDirCountZcentDirSizeZ
centDirOffsetr�Zzip64endrecZzip64locrecrRrrrr�s�$$



















zZipFile._write_end_recordcCs*|jd8_|jr&|jr&|j�dS)Nr)rNrLr�)r|r9rrrrRrszZipFile._fpclose)N)N)rBN)F)NN)NNN)NN)N)$rrrrr9r�rr}rTrXr�rQrtruryr{r~r�rAr_�setterr;r>r�r�r�r�r�r�r�r�r�r�r�r�rRrrrrr{s<WT
	
		
u
+

*
*
$fc@s4eZdZdZdedd
fdd�Zdd	d
�Zdd�ZdS)rzDClass to create ZIP archives with Python library files and packages.rBTrcCstj|||||d�||_dS)N)r
r�rS)rr}�	_optimize)r|r�r
r�rS�optimizerrrr}|szPyZipFile.__init__rNcCs�tj|�}|rF||�rF|jrBtjj|�r.dnd}td||f�dStjj|�\}}tjj|��rntjj|d�}tjj|��r�|r�d||f}n|}|jr�td|d|�|j	|d	d�|�\}}	|jr�td|	�|j
||	�tj|�}
|
jd�x�|
D]�}tjj||�}tjj
|�\}
}tjj|��rRtjjtjj|d���r�|j|||d�q�|d
kr�|�r�||��r�|jr�td|�q�|j	|d	d�|�\}}	|j�r�td|	�|j
||	�q�Wn�|j�r�td|�x�tj|�D]�}tjj||�}tjj
|�\}
}|d
k�r�|�r0||��r0|j�r�td|��q�|j	|d	d�|�\}}	|j�rZtd|	�|j
||	��q�WnP|dd�d
k�r�td��|j	|d	d�|�\}}	|j�r�td|	�|j
||	�dS)a�Add all files from "pathname" to the ZIP archive.

        If pathname is a package directory, search the directory and
        all package subdirectories recursively for all *.py and enter
        the modules into the archive.  If pathname is a plain
        directory, listdir *.py and enter all modules.  Else, pathname
        must be a Python *.py file and the module will be put into the
        archive.  Added modules are always module.pyc.
        This method will compile the module.py into module.pyc if
        necessary.
        If filterfunc(pathname) is given, it is called with every argument.
        When it is False, the file or directory is skipped.
        r�r�z%s %r skipped by filterfuncNz__init__.pyz%s/%szAdding package in�asrrZAdding)�
filterfuncz.pyzfile %r skipped by filterfunczAdding files from directoryz.Files added with writepy() must end with ".py"zAdding file���r�r�r�r�)rur�rIr�r�r^r�r0�isfile�
_get_codenamer��listdir�remove�splitext�writepyr�)r|�pathname�basenamer�Zlabel�dirrZinitnamer�r�Zdirlistr?r��rootZextrrrr��sx












zPyZipFile.writepyc
sd�fdd�	}|d}|d}tjj|dd�}tjj|dd�}tjj|dd�}�jdk�r\tjj|�r�tj|�jtj|�jkr�|}	}
n�tjj|�r�tj|�jtj|�jkr�|}
|}	n�tjj|�r�tj|�jtj|�jkr�|}
|}	nvtjj|��rtj|�jtj|�jk�r|}
|}	nD||��rRt	j
jd	k�r4|}
nt	j
jdk�rH|}
n|}
|}	n|}
}	n��jd	k�rr|}
|}	n<|}	�jdk�r�|}
n&�jdk�r�|}
nd
j�j�}t
|��tjj|
��o�tj|
�jtj|�jk�s�||�jd��s�|}
}	tjj|	�d}|�rd||f}|
|fS)aReturn (filename, archivename) for the path.

        Given a module name path, return the correct file path and
        archive name, compiling if necessary.  For example, given
        /python/lib/string, return (/python/lib/string.pyc, string).
        rcs^ddl}�jrtd|�y|j|d|d�Wn,|jk
rX}zt|j�dSd}~XnXdS)NrZ	CompilingT)�doraiser�F)�
py_compilerIr^�compile�PyCompileError�msg)r�r�r��err)r|rr�_compile�s

z)PyZipFile._get_codename.<locals>._compilez.pyz.pycr)�optimizationrrz"invalid value for 'optimize': {!r})r�z%s/%sr�)r�r�)�	importlib�util�cache_from_sourcer�rur�r�r�r�ryror��formatrxr�)
r|r�r�r�Zfile_pyZfile_pycZpycache_opt0Zpycache_opt1Zpycache_opt2r�r�r�Zarchivenamer)r|rr��s`


zPyZipFile._get_codenamer�)rN)rrrrrr}r�r�rrrrrys

Rcsddl}|jd�}|dkr(tjdd�}|s:|ddkrLt|�tjd�|ddkr�t|�dkrvt|�tjd�t|dd	��}|j�WdQRX�n||ddk�r
t|�dkr�t|�tjd�t|dd	��}|j	�}WdQRX|�r�td
j
|��td��n|ddk�rbt|�dk�r8t|�tjd�t|dd	��}|j|d�WdQRXn�|ddk�rt|�dk�r�t|�tjd��fd
d��t|dd��h}x`|dd�D]P}tj
j|�}|�s�tj
jtj
j|��}|dtjtjfk�r�d}�|||��q�WWdQRXdS)NraE        Usage:
            zipfile.py -l zipfile.zip        # Show listing of a zipfile
            zipfile.py -t zipfile.zip        # Test if a zipfile is valid
            zipfile.py -e zipfile.zip target # Extract zipfile into target dir
            zipfile.py -c zipfile.zip src ... # Create zipfile from sources
        r�-l�-c�-e�-trrBz.The following enclosed file is corrupted: {!r}zDone testingrcsptjj|�r|j||t�nPtjj|�rl|r8|j||�x2tj|�D]$}�|tjj||�tjj||��qDWdS)N)rur�r�r�rr�r�r0)r:r��zippathZnm)�addToZiprrr�Uszmain.<locals>.addToZiprCr)r�r�r�r�)�textwrap�dedentry�argvr^�exitr.rryr{r�r�rur�r�r�r�r�)�argsr�ZUSAGEr:Zbadfiler�r�r)r�r�main'sT




r��__main__li���ii��ii��)N)�rrru�re�importlib.utilr�ryr�r�r�rCZbinasciirO�ImportErrorZdummy_threadingr�r
r�r��__all__�	Exceptionrr
rrr�r�r�rrrrr{r�r�r�rkrZrYr�rXrIrJrKrLrMrNrOr^r_r`rcrerbrdZ_CD_CREATE_VERSIONZ_CD_CREATE_SYSTEMZ_CD_EXTRACT_VERSIONZ_CD_EXTRACT_SYSTEMZ
_CD_FLAG_BITSZ_CD_COMPRESS_TYPEZ_CD_TIMEZ_CD_DATEZ_CD_CRCZ_CD_COMPRESSED_SIZEZ_CD_UNCOMPRESSED_SIZErfrhriZ_CD_DISK_NUMBER_STARTZ_CD_INTERNAL_FILE_ATTRIBUTESZ_CD_EXTERNAL_FILE_ATTRIBUTESrjr�r�r�r�Z_FH_EXTRACT_VERSIONZ_FH_EXTRACT_SYSTEMZ_FH_GENERAL_PURPOSE_FLAG_BITSZ_FH_COMPRESSION_METHODZ_FH_LAST_MOD_TIMEZ_FH_LAST_MOD_DATEZ_FH_CRCZ_FH_COMPRESSED_SIZEZ_FH_UNCOMPRESSED_SIZEr�r�rDrErBrGrHrFZ_CD64_SIGNATUREZ_CD64_DIRECTORY_RECSIZEZ_CD64_CREATE_VERSIONZ_CD64_EXTRACT_VERSIONZ_CD64_DISK_NUMBERZ_CD64_DISK_NUMBER_STARTZ_CD64_NUMBER_ENTRIES_THIS_DISKZ_CD64_NUMBER_ENTRIES_TOTALZ_CD64_DIRECTORY_SIZEZ_CD64_OFFSET_START_CENTDIRr=ZStructr,r6r:r	rUr7�objectr
r�r�r�r�r�r�r�r�r�rr�r2rrr�rrrrr�<module>sD









+=[=&-J/
B
platform.cpython-36.opt-1.pyc000064400000067751150335715140012001 0ustar003

�\dhn��@sBdZdZdZddlZddlZddlZddlZddlZddlZy
ej	Z
Wn(ek
rnejd�krfdZ
nd	Z
YnXd
Z
dddd
d
dddddd�
Zejd�Zdd�Zejdej�Zejdddfdd�Zdd�Zejdej�Zejdej�Zejdej�Zd�Zd/d0�Zddded1fd2d3�Zd4d5�Zdddefd6d7�Zd�d9d:�Zd�d;d<�Z ejd=�Z!d�d>d?�Z"d�dAd�dBd�dDd�dEd�dGd�dHd�dId�dKd�dLd�dMd�dNiZ#d�dDd�dOd�dPd�dQd�dRd�dSiZ$d�dTdU�Z%dVdW�Z&d�dXdY�Z'dZd[�Z(d�d\d]�Z)d^d_�Z*d`da�Z+d�dbdc�Z,ddde�Z-d�dfdg�Z.d�dhdi�Z/d�d�d�dm�Z0ejddfdndo�Z1ej2dpdq�Z3da4drds�Z5dtdu�Z6dvdw�Z7dxdy�Z8dzd{�Z9d|d}�Z:d~d�Z;ejd�ej�Z<ejd�ej�Z=ejd��Z>ejd��Z?iZ@d�d�d��ZAd�d��ZBd�d��ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGd�d��ZHiZId�d�d��ZeJd�k�r>d�ejKk�pd�ejKkZLd�ejKk�o$d�ejKkZMeNeeMeL��ejOd�dS)�a8 This module tries to retrieve as much platform-identifying data as
    possible. It makes this information available via function APIs.

    If called from the command line, it prints the platform
    information concatenated as single string to stdout. The output
    format is useable as part of a filename.

a
    Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
    Copyright (c) 2000-2010, eGenix.com Software GmbH; mailto:info@egenix.com

    Permission to use, copy, modify, and distribute this software and its
    documentation for any purpose and without fee or royalty is hereby granted,
    provided that the above copyright notice appear in all copies and that
    both that copyright notice and this permission notice appear in
    supporting documentation or portions thereof, including modifications,
    that you make.

    EGENIX.COM SOFTWARE GMBH DISCLAIMS ALL WARRANTIES WITH REGARD TO
    THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
    FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
    INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
    FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
    NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
    WITH THE USE OR PERFORMANCE OF THIS SOFTWARE !

z1.0.8�N�dos�win32�win16ZNULz	/dev/nullz/etc�
���(�2��)
ZdevZalpha�aZbeta�b�cZRC�rc�pl�pz([0-9]+|[._+-])cCsfg}x\tj|�D]N}|dkryt|d�}d}Wn tk
rNtj|d�}YnX|j||f�qW|S)Nz._+-r�dr)�
_component_re�split�int�
ValueError�_ver_stages�get�extend)�version�result�v�t�r� /usr/lib64/python3.6/platform.py�_comparable_version�s
rsC(__libc_init)|(GLIBC_([0-9.]+))|(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)�i@c
Cs�t}ttjd�rtjj|�}t|d���`}|j|�}d}�xH|t|�k�r�d|ksZd|krhtj	||�}nd}|s�|j
�t|�kr�|j|�}	|	r�|t|t|�d�d�|	}d}q<|s�Pdd	�|j�D�\}
}}}
}}|
r�|r�d
}n�|�r|dk�rd}|}n||�||�k�rx|}n^|
�rx|dk�rxd
}|�rR|�sN||�||�k�rR|}|�rx|t|�d�|k�rx||}|j
�}q<WWdQRX||fS)a Tries to determine the libc version that the file executable
        (which defaults to the Python interpreter) is linked against.

        Returns a tuple of strings (lib,version) which default to the
        given parameters in case the lookup fails.

        Note that the function has intimate knowledge of how different
        libc versions add symbols to the executable and thus is probably
        only useable for executables compiled using gcc.

        The file is read and scanned in chunks of chunksize bytes.

    �realpath�rbrslibcsGLIBCNi�cSs"g|]}|dk	r|jd�n|�qS)N�latin1)�decode)�.0�srrr�
<listcomp>�szlibc_ver.<locals>.<listcomp>Zlibc�glibc)
r�hasattr�os�pathr!�open�read�len�_libc_search�search�end�max�groups)�
executable�librZ	chunksize�V�fZbinary�pos�m�chunkZlibcinitr(ZglibcversionZsoZthreadsZ	soversionrrr�libc_ver�sJ




 r;cCsptjjd�r�d}td��`}xX|D]P}|j�}t|�dkr |\}}nq |dkrV|j�}q |dkr |jd�}|d}q WWdQRX|||fStjjd�r�td��D}x<|D]4}|jd�}	t|	�dkr�|	d	d
kr�d
|	d|fSq�WWdQRXtjjd��rftjd�}
x:t	t|
�ddd�D]"}|
|dd
�dk�r|
|=�qW|
�rf|
j
�d}|
dd
d�}|||fS|||fS)z� Tries some special tricks to get the distribution
        information in case the default method fails.

        Currently supports older SuSE Linux, Caldera OpenLinux and
        Slackware Linux distributions.

    z/var/adm/inst-log/info�SuSE�ZMIN_DIST_VERSIONZ
DIST_IDENT�-Nz/etc/.installedrZ	OpenLinux�z/usr/lib/setup�zslack-version-�	slackware���rBrB)r*r+�existsr,rr.�strip�isdir�listdir�range�sort)�distnamer�idr7�lineZtv�tag�value�valuesZpkgZverfiles�nrrr�_dist_try_harder�s>	










rPz(\w+)[-_](release|version)z'(.+) release ([\d.]+)[^(]*(?:\((.+)\))?z1([^0-9]+)(?: release )?([\d.]+)[^(]*(?:\((.+)\))?r<�debian�fedora�redhat�centos�	almalinux�mandrake�mandriva�rocksrA�	yellowdog�gentoo�UnitedLinux�
turbolinux�arch�mageiacCszd}d}tj|�}|dk	r&t|j��Stj|�}|dk	rDt|j��S|j�j�}|rp|d}t|�dkrp|d}d||fS)Nr rr?)�_lsb_release_version�match�tupler3�_release_versionrDrr.)�	firstlinerrJr9�lrrr�_parse_release_file0s

rer?cCs(ddl}|jdtdd�t|||||�S)NrzFdist() and linux_distribution() functions are deprecated in Python 3.5r=)�
stacklevel)�warnings�warn�PendingDeprecationWarning�_linux_distribution)rIrrJ�supported_dists�full_distribution_namergrrr�linux_distributionKs


rmcCs�ytjt�}Wntk
r(|||fSX|j�xD|D]0}tj|�}|dk	r8|j�\}}	||kr8|}Pq8Wt|||�St	tj
jt|�dddd��}
|
j�}WdQRXt
|�\}}}
|r�|r�|}|r�|}|
r�|
}|||fS)a� Tries to determine the name of the Linux OS distribution name.

        The function first looks for a distribution release file in
        /etc and then reverts to _dist_try_harder() in case no
        suitable files are found.

        supported_dists may be given to define the set of Linux
        distributions to look for. It defaults to a list of currently
        supported Linux distributions identified by their release file
        name.

        If full_distribution_name is true (default), the full
        distribution read from the OS is returned. Otherwise the short
        name taken from supported_dists is used.

        Returns a tuple (distname, version, id) which default to the
        args given as parameters.

    N�rzutf-8�surrogateescape)�encoding�errors)r*rF�_UNIXCONFDIR�OSErrorrH�_release_filenamer`r3rPr,r+�join�readlinere)rIrrJrkrlZetc�filer9Z	_distnameZdummyr7rcZ_versionZ_idrrrrjUs0

rjcCs*ddl}|jdtdd�t||||dd�S)aS Tries to determine the name of the Linux OS distribution name.

        The function first looks for a distribution release file in
        /etc and then reverts to _dist_try_harder() in case no
        suitable files are found.

        Returns a tuple (distname, version, id) which default to the
        args given as parameters.

    rNzFdist() and linux_distribution() functions are deprecated in Python 3.5r=)rf)rkrl)rgrhrirj)rIrrJrkrgrrr�dist�s
rxrncCs&ddl}|jdtdd�tj|||�S)z! Portable popen() interface.
    rNzuse os.popen insteadr=)rf)rgrh�DeprecationWarningr*�popen)�cmd�mode�bufsizergrrrrz�srzcCsd|jd�}|r|j|�ytt|�}Wntk
r>|}YnXttt|��}dj|dd��}|S)z� Normalize the version and build strings and return a single
        version string using the format major.minor.build (or patchlevel).
    �.N�)r�append�maprr�list�strru)r�buildrdZintsZstringsrrr�
_norm_version�s


r�z'(?:([\w ]+) ([\w.]+) .*\[.* ([\d.]+)\])c	Cs�tj|kr|||fSxddD]R}y&tj|�}|j�}|j�rBtd��Wn$tk
rh}zwWYdd}~XqXPqW|||fS|j�}tj	|�}|dk	r�|j
�\}}}|d	dkr�|dd
�}|ddkr�|dd�}t|�}|||fS)
a+ Tries to figure out the OS version used and returns
        a tuple (system, release, version).

        It uses the "ver" shell command for this which is known
        to exists on Windows, DOS. XXX Others too ?

        In case this fails, the given parameters are used as
        defaults.

    �ver�command /c ver�
cmd /c verzcommand failedNr?r~)r�r�r�rBrBrBrB)�sys�platformr*rzr-�closersrD�_ver_outputr`r3r�)	�system�releaserZsupported_platformsr{�pipe�infoZwhyr9rrr�_syscmd_ver�s,





r��Z2000ZXPr=Z
2003ServerZpost2003��Vista�7�8rz8.1zpost8.1Z10Zpost10Z
2008ServerZ2008ServerR2Z
2012ServerZ2012ServerR2Zpost2012ServerR2c(Cs�yddlm}Wntk
r,||||fSXyddlm}m}m}m}Wn,tk
rvddlm}m}m}m}YnX|�}	|	j	p�|	dd�\}
}}dj
|
||�}tj|
|f�p�tj|
df�p�|}|	dd�|
|fk�r$ydj
|	j
�}Wn8tk
�r"|dd�d	k�rd
|dd�}YnXt|	dd�dk�rZtj|
|f��pXtj|
df��pX|}d}
z.y||d�}
||
d
�d}WnYnXWd|
�r�||
�X||||fS)Nr)�getwindowsversion)�	OpenKeyEx�QueryValueEx�CloseKey�HKEY_LOCAL_MACHINErz{0}.{1}.{2}r=zSP{}�
z
Service Pack ZSPZproduct_typez,SOFTWARE\Microsoft\Windows NT\CurrentVersionZCurrentType)r�r��ImportError�winregr�r�r�r��_winregZplatform_version�format�_WIN32_CLIENT_RELEASESrZservice_pack_major�AttributeError�getattr�_WIN32_SERVER_RELEASES)r�r�csd�ptyper�r�r�r�r�ZwinverZmaj�minr��keyrrr�	win32_versD

r�cCs�d}tjj|�sdSyddl}Wntk
r4dSXt|d��}|j|�}WdQRX|d}d	}tj�j}|d
krxd}|||fS)Nz0/System/Library/CoreServices/SystemVersion.plistrr"ZProductVersionr �ppc�Power MacintoshZPowerPC)r r r )r�r�)	r*r+rC�plistlibr�r,�load�uname�machine)�fnr�r7rr��versioninfor�rrr�_mac_ver_xmlEs
r�cCst�}|dk	r|S|||fS)a< Get MacOS version information and return it as tuple (release,
        versioninfo, machine) with versioninfo being a tuple (version,
        dev_stage, non_release_version).

        Entries which cannot be determined are set to the parameter values
        which default to ''. All tuple entries are strings.
    N)r�)r�r�r�r�rrr�mac_ver[sr�cCs@ddlm}y|j|�}|dkr$|S|Stk
r:|SXdS)Nr)�System)�	java.langr�ZgetPropertyr�)�name�defaultr�rMrrr�
_java_getpropns
r�cCs�yddl}Wntk
r(||||fSXtd|�}td|�}|\}}}td|�}td|�}td|�}|||f}|\}}	}
td|
�}
td	|�}td
|	�}	||	|
f}||||fS)a] Version interface for Jython.

        Returns a tuple (release, vendor, vminfo, osinfo) with vminfo being
        a tuple (vm_name, vm_release, vm_vendor) and osinfo being a
        tuple (os_name, os_version, os_arch).

        Values which cannot be determined are set to the defaults
        given as parameters (which all default to '').

    rNzjava.vendorzjava.versionzjava.vm.namezjava.vm.vendorzjava.vm.versionzjava.os.archzjava.os.namezjava.os.version)r�r�r�)r��vendor�vminfo�osinfo�javaZvm_nameZ
vm_releaseZ	vm_vendor�os_name�
os_version�os_archrrr�java_verys"












r�cCs�|dkrd|||fS|dkr�|dkr0|||fS|jd�}|r�yt|d�}Wntk
rbYn X|d}t|�|d<dj|�}|dkr�d	}q�d	}n,|d
kr�d}|r�|d}q�d
}n|dkr�d}|||fS)z� Returns (system, release, version) aliased to common
        marketing names used for some systems.

        It also does some reordering of the information in some cases
        where it would otherwise cause confusion.

    ZRhapsodyzMacOS X ServerZSunOS�5r~rr�6ZSolarisZIRIX64ZIRIXz (64bit)�64bitrr�Windows)rr)rrrr�ru)r�r�rrd�majorrrr�system_alias�s2	



r�cGs�djdd�tt|�D��}|jdd�}|jdd�}|jdd�}|jdd�}|jd	d�}|jd
d�}|jdd�}|jdd�}|jd
d�}x|jdd�}||kr�P|}q�Wx|ddkr�|dd�}q�W|S)zq Helper to format the platform string in a filename
        compatible format e.g. "system-version-machine".
    r>css|]}|j�VqdS)N)rD)r%�xrrr�	<genexpr>�sz_platform.<locals>.<genexpr>� �_�/�\�:�;�"�(�)�unknownr z--r?NrBrB)ru�filterr.�replace)�argsr�Zcleanedrrr�	_platform�s$r�cCsDyddl}Wntk
r |SXy|j�Stk
r>|SXdS)z8 Helper to determine the node name of this machine.
    rN)�socketr�Zgethostnamers)r�r�rrr�_node�sr�cCsFtjj|�}x4tjj|�r@tjjtjjtjj|�tj|���}qW|S)zT In case filepath is a symlink, follow it until a
        real file is reached.
    )r*r+�abspath�islink�normpathru�dirname�readlink)�filepathrrr�_follow_symlinkss
"r�cCshtjdkr|Sytjd|tf�}Wnttfk
r<|SX|j�j�}|j	�}|s\|r`|S|SdS)z. Interface to the system's uname command.
    rrrzuname %s 2> %sN)rrr)
r�r�r*rz�DEV_NULLr�rsr-rDr�)Zoptionr�r7�outputrrrr�
_syscmd_unames

r�cCs|tjd	kr|St|�}ytjd|gtjtjd�}Wnttfk
rJ|SX|j	�dj
d�}|j�}|sp|rt|S|SdS)
z� Interface to the system's file command.

        The function uses the -b option of the file command to have it
        omit the filename in its output. Follow the symlinks. It returns
        default in case the command should fail.

    rrrrw)�stdout�stderrrzlatin-1N)rrr)r�r�r��
subprocess�Popen�PIPEZSTDOUTr�rsZcommunicater$�wait)�targetr��procr�rrrr�_syscmd_files	


r��	WindowsPEr��MSDOS)rrrcCs.|sLddl}y|jd�}Wn |jk
r:|jd�}YnXt|d�d}|r\t|d�}nd}|r�|tjkr�tjtkr�ttj\}}|r�|}|r�|}||fSd|kr�||fSd	|kr�d
}nd|kr�d}nd
|kr�d}d|kr�d}n@d|k�rd|k�rd}nd}n d|k�rd}nd|k�r&d}n||fS)a� Queries the given executable (defaults to the Python interpreter
        binary) for various architecture information.

        Returns a tuple (bits, linkage) which contains information about
        the bit architecture and the linkage format used for the
        executable. Both values are returned as strings.

        Values that cannot be determined are returned as given by the
        parameter presets. If bits is given as '', the sizeof(pointer)
        (or sizeof(long) on Python version < 1.5.2) is used as
        indicator for the supported pointer size.

        The function relies on the system's "file" command to do the
        actual work. This is available on most if not all Unix
        platforms. On some non-Unix platforms where the "file" command
        does not exist and the executable is set to the Python interpreter
        binary defaults from _default_architecture are used.

    rN�Prd��bitr r4z32-bit�32bitZN32Zn32bitz64-bitr�ZELFZPEr�r�ZCOFFzMS-DOSr�)	�structZcalcsize�errorr�r�r�r4r��_default_architecture)r4�bits�linkager��sizeZfileoutrrdrrr�architectureBsL





r��uname_resultz-system node release version machine processorcCs�d}tdk	rtSd}ytj�\}}}}}Wntk
rBd}YnX|sdttd|||||f���r�|r�tj}d}d}t�}d}d}|dkr�t	�\}}}}	|r�|r�d}|s�dtj
kr�tj
jdd�}ntj
jdd�}|s�tj
jd|�}|�r<t|�\}}}|d	k�rd
}n4|dk�r<|d
k�r<d
}d|dd
�k�r8d}nd}|dk�rf|�s`|dk�r\d}nd}d
}n8|dd�dk�r�t
�\}}
}}d}dj|�}|�s�|
}|dk�r
|�s�|dk�r�|}d}yddl}
Wntk
�r�Yn&X|
jdd�\}}|dk�rd}nd}|�stdd�}|dk�r(d}|dk�r6d}|dk�rDd}|dk�rRd}|dk�r`d}|dk�rnd}|dk�r�|d
k�r�d
}d}t||||||�atS)an Fairly portable uname interface. Returns a tuple
        of strings (system, node, release, version, machine, processor)
        identifying the underlying platform.

        Note that unlike the os.uname function this also returns
        possible processor information as an additional tuple entry.

        Entries which cannot be determined are set to ''.

    rNr r?rZPROCESSOR_ARCHITEW6432ZPROCESSOR_ARCHITECTUREZPROCESSOR_IDENTIFIERzMicrosoft Windowsr�Z	Microsoftz6.0rr�rr�Z16bit�r��Javaz, ZOpenVMS�0zSYI$_CPU�ZAlphaZVAXz-pr�)rr)�_uname_cacher*r�r�r�r�r�r�r�r��environrr�r�ru�vms_libr�Zgetsyir�r�)Zno_os_uname�	processorr��noder�rr�Zuse_syscmd_verr�r�r�r�r�rZcsidZ
cpu_numberrrrr��s�

 














r�cCst�jS)z� Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'.

        An empty string is returned if the value cannot be determined.

    )r�r�rrrrr�%sr�cCst�jS)z� Returns the computer's network name (which may not be fully
        qualified)

        An empty string is returned if the value cannot be determined.

    )r�rrrrrr.srcCst�jS)z� Returns the system's release, e.g. '2.2.0' or 'NT'

        An empty string is returned if the value cannot be determined.

    )r�r�rrrrr�8sr�cCst�jS)z� Returns the system's release version, e.g. '#3 on degas'

        An empty string is returned if the value cannot be determined.

    )r�rrrrrrAsrcCst�jS)zt Returns the machine type, e.g. 'i386'

        An empty string is returned if the value cannot be determined.

    )r�r�rrrrr�Jsr�cCst�jS)a Returns the (true) processor name, e.g. 'amdk6'

        An empty string is returned if the value cannot be
        determined. Note that many platforms do not provide this
        information or simply return the same value as for machine(),
        e.g.  NetBSD does this.

    )r�rrrrrrSs
rzL([\w.+]+)\s*\(#?([^,]+)(?:,\s*([\w ]*)(?:,\s*([\w :]*))?)?\)\s*\[([^\]]+)\]?z;IronPython\s*([\d\.]+)(?: \(([\d\.]+)\))? on (.NET [\d\.]+)zU([\d.]+)\s*\(IronPython\s*[\d.]+\s*\(([\d.]+)\) on ([\w.]+ [\d.]+(?: \(\d+-bit\))?)\)zE([\w.+]+)\s*\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*\[PyPy [^\]]+\]?cCs|dkrtj}tj|d�}|dk	r&|Sd|kr�d}|jd�rHtj|�}n
tj|�}|dkrjtdt	|���|j
�\}}}d}d}n�tjjd�r�d}tj|�}|dkr�tdt	|���|j
�\}}}}	}
|dkr�d}tj}n�d|k�r"d}t
j|�}|dk�rtd	t	|���|j
�\}}}}	d}n\tj|�}|dk�rFtd
t	|���|j
�\}}}}	}d}|dk�rld}n|	�r~|d|	}ttd
��r�tj\}
}}n<ttd��r�tj\}
}}n"ttd��r�tj\}
}}nd}d}|jd�}
t|
�dk�r|
jd�dj|
�}|||||||f}|t|<|S)a� Returns a parsed version of Python's sys.version as tuple
        (name, version, branch, revision, buildno, builddate, compiler)
        referring to the Python implementation name, version, branch,
        revision, build number, build date/time as string and the compiler
        identification string.

        Note that unlike the Python sys.version, the returned value
        for the Python version will always include the patchlevel (it
        defaults to '.0').

        The function returns empty strings for tuple entries that
        cannot be determined.

        sys_version may be given to parse an alternative version
        string, e.g. if the version was read from a different Python
        interpreter.

    NZ
IronPythonz*failed to parse IronPython sys.version: %sr r�ZJythonz&failed to parse Jython sys.version: %sZPyPyz$failed to parse PyPy sys.version: %sz'failed to parse CPython sys.version: %sZCPythonr��_git�
_mercurial�
subversionr~r=r�)r�r�_sys_version_cacher�
startswith�_ironpython_sys_version_parserr`� _ironpython26_sys_version_parserr�reprr3r��_sys_version_parser�_pypy_sys_version_parserr)rrrrr.r�ru)�sys_versionrr�r`rZalt_versionZcompilerZbuildnoZ	builddateZ	buildtimer�ZbranchZrevisionrdrrr�_sys_version}s|











rcCs
t�dS)aR Returns a string identifying the Python implementation.

        Currently, the following implementations are identified:
          'CPython' (C implementation of Python),
          'IronPython' (.NET implementation of Python),
          'Jython' (Java implementation of Python),
          'PyPy' (Python implementation of Python).

    r)rrrrr�python_implementation�srcCs
t�dS)z� Returns the Python version as string 'major.minor.patchlevel'

        Note that unlike the Python sys.version, the returned value
        will always include the patchlevel (it defaults to 0).

    r?)rrrrr�python_version�srcCstt�djd��S)z� Returns the Python version as tuple (major, minor, patchlevel)
        of strings.

        Note that unlike the Python sys.version, the returned value
        will always include the patchlevel (it defaults to 0).

    r?r~)rarrrrrr�python_version_tuple�s	rcCs
t�dS)z� Returns a string identifying the Python implementation
        branch.

        For CPython this is the Subversion branch from which the
        Python binary was built.

        If not available, an empty string is returned.

    r=)rrrrr�
python_branch
srcCs
t�dS)z� Returns a string identifying the Python implementation
        revision.

        For CPython this is the Subversion revision from which the
        Python binary was built.

        If not available, an empty string is returned.

    r)rrrrr�python_revisionsrcCst�dd�S)zh Returns a tuple (buildno, builddate) stating the Python
        build number and date as strings.

    r�r�)rrrrr�python_build%srcCs
t�dS)zS Returns a string identifying the compiler used for compiling
        Python.

    r�)rrrrr�python_compiler-srcCs�tj||fd�}|dk	r|St�\}}}}}}||kr:d}|rPt|||�\}}}|dkr�t|�\}	}
}}|rxt||�}
nt||||�}
�n.|dk�rtj��"tjddt	�t
d�\}}}WdQRX|r�|r�t||||d|||�}
n$ttj
�\}}t||||d||�}
n�|dk�r\t�\}}}\}}}|�s8|�rFt|||�}
nt|||d	|||�}
n\|d
k�r�|�rxt||�}
nt|||�}
n2|�r�t||�}
n ttj
�\}}t||||||�}
|
t||f<|
S)a� Returns a single string identifying the underlying platform
        with as much useful information as possible (but no more :).

        The output is intended to be human readable rather than
        machine parseable. It may look different on different
        platforms and this is intended.

        If "aliased" is true, the function will use aliases for
        various platforms that report system names which differ from
        their common names, e.g. SunOS will be reported as
        Solaris. The system_alias() function is used to implement
        this.

        Setting terse to true causes the function to return only the
        absolute minimum information needed to identify the platform.

    Nr r��Linux�ignorez?dist\(\) and linux_distribution\(\) functions are deprecated .*�withr�ZonZMacOS)r)�_platform_cacherr�r�r�r�rg�catch_warnings�filterwarningsrirxr;r�r4r�r�)�aliased�terserr�rr�rr�rZrelZversr�r�r�rIZdistversionZdistidZlibcnameZlibcversionrnrr�r�r�r�r�r�rrrr�9s\







r��__main__rz--terseZ
nonaliasedz--nonaliased)rrr)r<rQrRrSrTrUrVrWrXrArYrZr[r\r]r^rB)rnrB)r �rrr)r r r r)r�r)r�r?)r�r=)r�N)r�r)r�r?)r�r=)r�r)r�N)rr)rN)r�r=)r�r)r�r?)r�r=)r�r)r�N)r r r r �r r r )r r r �r r r �r r r )r r r!r")r )r )r )r r�)r r�)r r�)N)rr)P�__doc__Z
__copyright__�__version__�collectionsr�r*�rer�rg�devnullr�r�r�rrr�compilerr�ASCIIr/r4r;rPrtr_rbZ_supported_distsrermrjrxrzr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��
namedtupler�r�r�r�rr�rr�rrrr	rrrrrrrrrrr�__name__�argvrr�print�exitrrrr�<module>
s�e 




:26
	



0
0

#6 


T	
			
k




[
_strptime.cpython-36.pyc000064400000037135150335715140011215 0ustar003


 \�`�@s�dZddlZddlZddlZddlmZddlmZddlmZ	ddl
mZm
ZmZyddlmZWn ek
r�ddlmZYnXgZdd	�ZGd
d�de�ZGdd
�d
e�Ze�Ze�adZiadd�Z dd�Z!ddd�Z"ddd�Z#ddd�Z$dS)a�Strptime-related classes and functions.

CLASSES:
    LocaleTime -- Discovers and stores locale-specific time information
    TimeRE -- Creates regexes for pattern matching a string of text containing
                time information

FUNCTIONS:
    _getlang -- Figure out what language is being used for the locale
    strptime -- Calculates the time struct represented by the passed-in string

�N)�compile)�
IGNORECASE)�escape)�date�	timedelta�timezone)�
allocate_lockcCstjtj�S)N)�localeZ	getlocale�LC_TIME�rr�!/usr/lib64/python3.6/_strptime.py�_getlangsr
c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�
LocaleTimeakStores and handles locale-specific information related to time.

    ATTRIBUTES:
        f_weekday -- full weekday names (7-item list)
        a_weekday -- abbreviated weekday names (7-item list)
        f_month -- full month names (13-item list; dummy value in [0], which
                    is added by code)
        a_month -- abbreviated month names (13-item list, dummy value in
                    [0], which is added by code)
        am_pm -- AM/PM representation (2-item list)
        LC_date_time -- format string for date/time representation (string)
        LC_date -- format string for date representation (string)
        LC_time -- format string for time representation (string)
        timezone -- daylight- and non-daylight-savings timezone representation
                    (2-item list of sets)
        lang -- Language used by instance (2-item tuple)
    cCsht�|_|j�|j�|j�|j�|j�t�|jkrDtd��tj	|j	ks\tj
|j
krdtd��dS)a�Set all attributes.

        Order of methods called matters for dependency reasons.

        The locale language is set at the offset and then checked again before
        exiting.  This is to make sure that the attributes were not set with a
        mix of information from more than one locale.  This would most likely
        happen when using threads where one thread calls a locale-dependent
        function while another thread changes the locale while the function in
        the other thread is still running.  Proper coding would call for
        locks to prevent changing the locale while locale-dependent code is
        running.  The check here is done in case someone does not think about
        doing this.

        Only other possible issue is if someone changed the timezone and did
        not call tz.tzset .  That is an issue for the programmer, though,
        since changing the timezone is worthless without that call.

        z$locale changed during initializationz&timezone changed during initializationN)r
�lang�_LocaleTime__calc_weekday�_LocaleTime__calc_month�_LocaleTime__calc_am_pm�_LocaleTime__calc_timezone�_LocaleTime__calc_date_time�
ValueError�time�tzname�daylight)�selfrrr�__init__4szLocaleTime.__init__cCs(t|�}|r|jdd�n
|jd�|S)Nr�)�list�insert�append)r�seq�frontrrrZ__padSs

zLocaleTime.__padcCs4dd�td�D�}dd�td�D�}||_||_dS)NcSsg|]}tj|j��qSr)�calendarZday_abbr�lower)�.0�irrr�
<listcomp>_sz-LocaleTime.__calc_weekday.<locals>.<listcomp>�cSsg|]}tj|j��qSr)r!Zday_namer")r#r$rrrr%`s)�range�	a_weekday�	f_weekday)rr(r)rrrZ__calc_weekday\szLocaleTime.__calc_weekdaycCs4dd�td�D�}dd�td�D�}||_||_dS)NcSsg|]}tj|j��qSr)r!Z
month_abbrr")r#r$rrrr%fsz+LocaleTime.__calc_month.<locals>.<listcomp>�
cSsg|]}tj|j��qSr)r!Z
month_namer")r#r$rrrr%gs)r'�a_month�f_month)rr+r,rrrZ__calc_monthdszLocaleTime.__calc_monthcCsNg}x>dD]6}tjddd|dddd	d
f	�}|jtjd|�j��q
W||_dS)
N��i����,�7��Lrz%p)r-r.)r�struct_timer�strftimer"�am_pm)rr7�hour�
time_tuplerrrZ__calc_am_pmks

zLocaleTime.__calc_am_pmc
CsXtjd1�}dddg}tjd
|�j�|d	<tjd|�j�|d<tjd
|�j�|d<d2|jddf|jddf|jddf|jddf|jddfd3d4d5d6d7d8d9d:d;d<d=g}|j	d*d+�|j
D��xvdAD]n\}}||}x$|D]\}}|�r�|j||�}�q�WtjdB�}d-tj||�k�rd.}	nd/}	|jd0|	�||<�q�W|d	|_|d|_
|d|_dS)CN��r/r0r.r1r2r3r4r�%c�%xr-�%X�%�%%z%Az%Bz%az%bz%p�1999�%Y�99�%y�22�%H�44�%M�55�%S�76�%j�17�%d�03�%m�3�2�%w�10�%IcSsg|]}|D]}|df�qqS)z%Zr)r#�	tz_values�tzrrrr%�sz/LocaleTime.__calc_date_time.<locals>.<listcomp>�Z00z%Wz%UZ11)	r:r/r0r.r1r2r3r4r)r>r?)r@rA)rBrC)rDrE)rFrG)rHrI)rJrK)rLrM)rNrO)rPrO)rQrR)rSrT�rr;�r-r<�r3r=)rXrYrZ)	r:r-r/r-r-r-rWr/r)rr5r6r"r)r,r(r+r7�extendr�replace�LC_date_time�LC_date�LC_time)
rr9Z	date_timeZreplacement_pairs�offset�	directiveZcurrent_format�old�newZU_WrrrZ__calc_date_timews4




zLocaleTime.__calc_date_timec
Cszytj�Wntk
r YnXtj|_tj|_tdd|jdj�h�}|jrft|jdj�h�}nt�}||f|_dS)N�utc�gmtrr-)rZtzset�AttributeErrorrr�	frozensetr"r)rZ	no_savingZ
has_savingrrrZ__calc_timezone�szLocaleTime.__calc_timezoneN)�__name__�
__module__�__qualname__�__doc__rZ_LocaleTime__padrrrrrrrrrr!s	-rcs:eZdZdZd�fdd�	Zdd�Zdd�Zd	d
�Z�ZS)�TimeREz4Handle conversion from format directives to regexes.Ncs|r||_nt�|_t�}|jddddddddd	d
ddd
ddd|j|jjd�|j|jjd�|j|jjdd�d�|j|jjdd�d�|j|jj	d�|jdd�|jj
D�d�dd��|jd|jd�j
dd��|jd|j|jj��|jd |j|jj��|jd!|j|jj��dS)"z^Create keys/values.

        Order of execution is important for dependency reasons.

        z)(?P<d>3[0-1]|[1-2]\d|0[1-9]|[1-9]| [1-9])z(?P<f>[0-9]{1,6})z(?P<H>2[0-3]|[0-1]\d|\d)z(?P<I>1[0-2]|0[1-9]|[1-9])z(?P<G>\d\d\d\d)zG(?P<j>36[0-6]|3[0-5]\d|[1-2]\d\d|0[1-9]\d|00[1-9]|[1-9]\d|0[1-9]|[1-9])z(?P<m>1[0-2]|0[1-9]|[1-9])z(?P<M>[0-5]\d|\d)z(?P<S>6[0-1]|[0-5]\d|\d)z(?P<U>5[0-3]|[0-4]\d|\d)z(?P<w>[0-6])z(?P<u>[1-7])z(?P<V>5[0-3]|0[1-9]|[1-4]\d|\d)z(?P<y>\d\d)z(?P<Y>\d\d\d\d)z(?P<z>[+-]\d\d[0-5]\d)�A�ar-N�B�b�pcss|]}|D]
}|Vq
qdS)Nr)r#Ztz_namesrVrrr�	<genexpr>�sz"TimeRE.__init__.<locals>.<genexpr>�Zr>)�d�f�H�I�G�j�m�M�S�U�w�u�V�y�Y�zrmrnrorprqrsr>�Wr}�c�x�X)�locale_timer�superr�_TimeRE__seqToREr)r(r,r+r7r�__setitem__�__getitem__r\�patternr]r^r_)rr��base)�	__class__rrr�sB
zTimeRE.__init__cCsRt|tdd�}x|D]}|dkrPqWdSdjdd�|D��}d||f}d|S)	aeConvert a list to a regex string for matching a directive.

        Want possible matching values to be from longest to shortest.  This
        prevents the possibility of a match occurring for a value that also
        a substring of a larger value that should have matched (e.g., 'abc'
        matching when 'abcdef' should have been the match).

        T)�key�reverser�|css|]}t|�VqdS)N)�	re_escape)r#Zstuffrrrrr�sz#TimeRE.__seqToRE.<locals>.<genexpr>z	(?P<%s>%sz%s))�sorted�len�join)rZ
to_convertra�valueZregexrrrZ	__seqToRE�s	
zTimeRE.__seqToREcCs�d}td�}|jd|�}td�}|jd|�}xLd|krx|jd�d}d||d	|d�|||f}||dd	�}q.Wd
||fS)z�Return regex pattern for the format string.

        Need to make sure that any characters that might be interpreted as
        regex syntax are escaped.

        rz([\\.^$*+?\(\){}\[\]|])z\\\1z\s+z\\s+r>r-z%s%s%sNz%s%s)�
re_compile�sub�index)r�formatZprocessed_formatZregex_charsZwhitespace_replacementZdirective_indexrrrr��s
zTimeRE.patterncCst|j|�t�S)z2Return a compiled re object for the format string.)r�r�r)rr�rrrrszTimeRE.compile)N)	rhrirjrkrr�r�r�
__classcell__rr)r�rrl�s
.rl�cCslt|dd�j�}|s,|dd}|dd}d|d}|dkrLd||S|d|d}d||SdS)z�Calculate the Julian day based on the year, week of the year, and day of
    the week, with week_start_day representing whether the week of the year
    assumes the week starts on Sunday or Monday (6 or 0).r-r&rN)�
datetime_date�weekday)�year�week_of_yearZday_of_week�week_starts_MonZ
first_weekdayZ
week_0_lengthZdays_to_weekrrr�_calc_julian_from_U_or_Wsr�cCsdt|dd�j�d}|d||}|dkr\|t|dd�j�7}|d8}|t|dd�j�8}||fS)z�Calculate the Julian day based on the ISO 8601 year, week, and weekday.
    ISO weeks start on Mondays, with week 01 being the week containing 4 Jan.
    ISO week days range from 1 (Monday) to 7 (Sunday).
    r-�r/r&)r�Z
isoweekday�	toordinal)�iso_year�iso_weekZiso_weekdayZ
correctionZordinalrrr�_calc_julian_from_V1sr��%a %b %d %H:%M:%S %Yc' Cslx:t||g�D]*\}}t|t�sd}t|j|t|����qWt��tj}t	�|j
ksltj|jksltj
|j
kr�t�atj�tj}tt�tkr�tj�tj|�}|�s,ytj|�}Wnptk
�r}z0|jd}|dkr�d}~td||f�d�WYdd}~Xn$tk
�r"td|�d�YnX|t|<WdQRX|j|�}	|	�sVtd||f��t|�|	j�k�r�td	||	j�d���d}
}d
}}
d}}}}d:}d}d}}d}d}}|	j�}�x�|j�D�]�}|dk�rt|d�}|dk�r|d
7}n|d7}�q�|dk�r&t|d�}�q�|dk�r@t|d�}
�q�|dk�rZt|d�}�q�|dk�r||jj|dj ��}�q�|dk�r�|j!j|dj ��}�q�|dk�r�t|d�}
�q�|dk�r�t|d�}�q�|dk�rBt|d�}|jdd�j �}|d|j"dfk�r|dk�r>d}n"||j"d
k�rT|dk�rT|d7}�q�|dk�r\t|d�}�q�|dk�rvt|d�}�q�|dk�r�|d}|ddt|�7}t|�}�q�|dk�r�|j#j|dj ��}�q�|d k�r�|j$j|d j ��}�q�|d!k�rt|d!�}|dk�rd}n|d
8}�q�|d"k�r@t|d"�}|d
8}�q�|d#k�rZt|d#�}�q�|d;k�r�t||�}|d$k�r�d}nd}n�|d&k�r�t|d&�}n�|d'k�r�|d'}t|d
d(��d)t|d(d*��}|j%d+��rT|}nl|d,k�r�|d,j �}xTt|j&�D]F\}} || k�r
tjdtjd
k�rHtj
�rH|d<k�rHPn|}P�q
W�q�W|dk�r�|
dk	�r�|dk�s�|dk�r�td/��|dk	�r�td0��n0|dk�r�|dk	�r�|dk�r�td1��ntd2��d3}!|dk�r�|d4k�r�|
d5k�r�d6}d7}!n|dk�rd}|dk�r�|dk	�r�|dk	�rH|dk�r4d7nd3}"t'||||"�}n(|
dk	�rp|dk	�rpt(|
||d
�\}}|dk	�r�|dk�r�|d
8}t)j*|��r�d8nd9}#||#7}|dk�r�t+|||
�j,�t+|d
d
�j,�d
}n0t+j-|d
t+|d
d
�j,��}$|$j.}|$j/}|$j0}
|dk�r"t+|||
�j1�}|jd,�}%|dk	�r@|d)}&nd}&|!�rNd}|||
|||||||%|&f|fS)=z�Return a 2-tuple consisting of a time struct and an int containing
    the number of microseconds based on the input string and the
    format string.z*strptime() argument {} must be str, not {}r�\r>z&'%s' is a bad directive in format '%s'Nzstray %% in format '%s'z%time data %r does not match format %rzunconverted data remains: %sr-r��Di�ilr�rxrzrorprtrvrwrqr�r{r|ru�0rWrmrnr~rryr}r�r�r�r/�<r��-rsrdrezzISO year directive '%G' must be used with the ISO week directive '%V' and a weekday directive ('%A', '%a', '%w', or '%u').z`Day of the year directive '%j' is not compatible with ISO year directive '%G'. Use '%Y' instead.zzISO week directive '%V' must be used with the ISO year directive '%G' and a weekday directive ('%A', '%a', '%w', or '%u').zdISO week directive '%V' is incompatible with the year directive '%Y'. Use the ISO year '%G' instead.Fr3�ipTinim���)r}r�)rdre)2�	enumerate�
isinstance�str�	TypeErrorr��type�_cache_lock�
_TimeRE_cacher�r
rrrrrl�_regex_cache�clearr��_CACHE_MAX_SIZE�getr�KeyError�argsr�
IndexError�match�end�	groupdict�keys�intr,r�r"r+r7r)r(�
startswithrr�r�r!Zisleapr�r�Zfromordinalr��month�dayr�)'�data_stringr�r��arg�msgr�Zformat_regex�errZ
bad_directive�foundr�r�r�r�r8Zminute�second�fractionrVZtzoffsetr�r�Zweek_of_year_startr�ZjulianZ
found_dictZ	group_keyZampm�sr�Z
found_zoner�rUZ
leap_year_fixr�ZydayZdatetime_resultr�gmtoffrrr�	_strptimeAsB





























$








&



r�cCs"t||�d}tj|dtj��S)zIReturn a time struct based on the input string and the
    format string.rN)r�rr5Z_STRUCT_TM_ITEMS)r�r��ttrrr�_strptime_time,sr�c
Cslt||�\}}|dd�\}}|dd�|f}|dk	rdt|d�}|rRt||�}	nt|�}	||	f7}||�S)zPReturn a class cls instance based on the input string and the
    format string.r3NrW)Zseconds���)r��datetime_timedelta�datetime_timezone)
�clsr�r�r�r�rr�r�ZtzdeltarVrrr�_strptime_datetime2s

r�)r�)r�)r�)%rkrr	r!�rerr�rrr�Zdatetimerr�rr�rr��_threadrZ_thread_allocate_lock�ImportErrorZ
_dummy_thread�__all__r
�objectr�dictrlr�r�r�r�r�r�r�r�r�rrrr�<module>s4_
l
re.cpython-36.pyc000064400000033354150335715140007614 0ustar003


 \�<�#@s�dZddlZddlZddlZddlZyddlZWnek
rHdZYnXddddddd	d
ddd
ddddddddddddddddgZdZGdd �d ej	�Z
e�je
j
�ejZd=d!d�Zd>d"d�Zd?d#d�Zd@d$d�ZdAd%d�ZdBd&d�ZdCd'd	�ZdDd(d
�ZdEd)d�Zd*d�ZdFd+d
�Zed,�Zed-�Zd.d�ZiZeejd/d��Z d0Z!d1d2�Z"ej#e!�d3d4��Z$d5d6�Z%d7d8�Z&ddl'Z'd9d:�Z(e'j)e e(e"�Gd;d<�d<�Z*dS)Ga`Support for regular expressions (RE).

This module provides regular expression matching operations similar to
those found in Perl.  It supports both 8-bit and Unicode strings; both
the pattern and the strings being processed can contain null bytes and
characters outside the US ASCII range.

Regular expressions can contain both special and ordinary characters.
Most ordinary characters, like "A", "a", or "0", are the simplest
regular expressions; they simply match themselves.  You can
concatenate ordinary characters, so last matches the string 'last'.

The special characters are:
    "."      Matches any character except a newline.
    "^"      Matches the start of the string.
    "$"      Matches the end of the string or just before the newline at
             the end of the string.
    "*"      Matches 0 or more (greedy) repetitions of the preceding RE.
             Greedy means that it will match as many repetitions as possible.
    "+"      Matches 1 or more (greedy) repetitions of the preceding RE.
    "?"      Matches 0 or 1 (greedy) of the preceding RE.
    *?,+?,?? Non-greedy versions of the previous three special characters.
    {m,n}    Matches from m to n repetitions of the preceding RE.
    {m,n}?   Non-greedy version of the above.
    "\\"     Either escapes special characters or signals a special sequence.
    []       Indicates a set of characters.
             A "^" as the first character indicates a complementing set.
    "|"      A|B, creates an RE that will match either A or B.
    (...)    Matches the RE inside the parentheses.
             The contents can be retrieved or matched later in the string.
    (?aiLmsux) Set the A, I, L, M, S, U, or X flag for the RE (see below).
    (?:...)  Non-grouping version of regular parentheses.
    (?P<name>...) The substring matched by the group is accessible by name.
    (?P=name)     Matches the text matched earlier by the group named name.
    (?#...)  A comment; ignored.
    (?=...)  Matches if ... matches next, but doesn't consume the string.
    (?!...)  Matches if ... doesn't match next.
    (?<=...) Matches if preceded by ... (must be fixed length).
    (?<!...) Matches if not preceded by ... (must be fixed length).
    (?(id/name)yes|no) Matches yes pattern if the group with id/name matched,
                       the (optional) no pattern otherwise.

The special sequences consist of "\\" and a character from the list
below.  If the ordinary character is not on the list, then the
resulting RE will match the second character.
    \number  Matches the contents of the group of the same number.
    \A       Matches only at the start of the string.
    \Z       Matches only at the end of the string.
    \b       Matches the empty string, but only at the start or end of a word.
    \B       Matches the empty string, but not at the start or end of a word.
    \d       Matches any decimal digit; equivalent to the set [0-9] in
             bytes patterns or string patterns with the ASCII flag.
             In string patterns without the ASCII flag, it will match the whole
             range of Unicode digits.
    \D       Matches any non-digit character; equivalent to [^\d].
    \s       Matches any whitespace character; equivalent to [ \t\n\r\f\v] in
             bytes patterns or string patterns with the ASCII flag.
             In string patterns without the ASCII flag, it will match the whole
             range of Unicode whitespace characters.
    \S       Matches any non-whitespace character; equivalent to [^\s].
    \w       Matches any alphanumeric character; equivalent to [a-zA-Z0-9_]
             in bytes patterns or string patterns with the ASCII flag.
             In string patterns without the ASCII flag, it will match the
             range of Unicode alphanumeric characters (letters plus digits
             plus underscore).
             With LOCALE, it will match the set [0-9_] plus characters defined
             as letters for the current locale.
    \W       Matches the complement of \w.
    \\       Matches a literal backslash.

This module exports the following functions:
    match     Match a regular expression pattern to the beginning of a string.
    fullmatch Match a regular expression pattern to all of a string.
    search    Search a string for the presence of a pattern.
    sub       Substitute occurrences of a pattern found in a string.
    subn      Same as sub, but also return the number of substitutions made.
    split     Split a string by the occurrences of a pattern.
    findall   Find all occurrences of a pattern in a string.
    finditer  Return an iterator yielding a match object for each match.
    compile   Compile a pattern into a RegexObject.
    purge     Clear the regular expression cache.
    escape    Backslash all non-alphanumerics in a string.

Some of the functions in this module takes flags as optional parameters:
    A  ASCII       For string patterns, make \w, \W, \b, \B, \d, \D
                   match the corresponding ASCII character categories
                   (rather than the whole Unicode categories, which is the
                   default).
                   For bytes patterns, this flag is the only available
                   behaviour and needn't be specified.
    I  IGNORECASE  Perform case-insensitive matching.
    L  LOCALE      Make \w, \W, \b, \B, dependent on the current locale.
    M  MULTILINE   "^" matches the beginning of lines (after a newline)
                   as well as the string.
                   "$" matches the end of lines (before a newline) as well
                   as the end of the string.
    S  DOTALL      "." matches any character at all, including the newline.
    X  VERBOSE     Ignore whitespace and comments for nicer looking RE's.
    U  UNICODE     For compatibility only. Ignored for string patterns (it
                   is the default), and forbidden for bytes patterns.

This module also defines an exception 'error'.

�N�match�	fullmatch�search�sub�subn�split�findall�finditer�compile�purge�template�escape�error�A�I�L�M�S�X�U�ASCII�
IGNORECASE�LOCALE�	MULTILINE�DOTALL�VERBOSE�UNICODEz2.2.1c@sbeZdZejZejZejZ	ej
ZejZ
ejZejZeZeZe	ZeZe
ZeZeZejZeZejZdS)�	RegexFlagN)�__name__�
__module__�__qualname__�sre_compile�SRE_FLAG_ASCIIr�SRE_FLAG_IGNORECASEr�SRE_FLAG_LOCALEr�SRE_FLAG_UNICODEr�SRE_FLAG_MULTILINEr�SRE_FLAG_DOTALLr�SRE_FLAG_VERBOSErrrrrrrr�SRE_FLAG_TEMPLATE�TEMPLATE�T�SRE_FLAG_DEBUG�DEBUG�r.r.�/usr/lib64/python3.6/re.pyr�s"rcCst||�j|�S)zqTry to apply the pattern at the start of the string, returning
    a match object, or None if no match was found.)�_compiler)�pattern�string�flagsr.r.r/r�scCst||�j|�S)zkTry to apply the pattern to all of the string, returning
    a match object, or None if no match was found.)r0r)r1r2r3r.r.r/r�scCst||�j|�S)ztScan through string looking for a match to the pattern, returning
    a match object, or None if no match was found.)r0r)r1r2r3r.r.r/r�scCst||�j|||�S)aZReturn the string obtained by replacing the leftmost
    non-overlapping occurrences of the pattern in string by the
    replacement repl.  repl can be either a string or a callable;
    if a string, backslash escapes in it are processed.  If it is
    a callable, it's passed the match object and must return
    a replacement string to be used.)r0r)r1�replr2�countr3r.r.r/r�scCst||�j|||�S)a�Return a 2-tuple containing (new_string, number).
    new_string is the string obtained by replacing the leftmost
    non-overlapping occurrences of the pattern in the source
    string by the replacement repl.  number is the number of
    substitutions that were made. repl can be either a string or a
    callable; if a string, backslash escapes in it are processed.
    If it is a callable, it's passed the match object and must
    return a replacement string to be used.)r0r)r1r4r2r5r3r.r.r/r�s	cCst||�j||�S)a�Split the source string by the occurrences of the pattern,
    returning a list containing the resulting substrings.  If
    capturing parentheses are used in pattern, then the text of all
    groups in the pattern are also returned as part of the resulting
    list.  If maxsplit is nonzero, at most maxsplit splits occur,
    and the remainder of the string is returned as the final element
    of the list.)r0r)r1r2�maxsplitr3r.r.r/r�scCst||�j|�S)aReturn a list of all non-overlapping matches in the string.

    If one or more capturing groups are present in the pattern, return
    a list of groups; this will be a list of tuples if the pattern
    has more than one group.

    Empty matches are included in the result.)r0r)r1r2r3r.r.r/r�scCst||�j|�S)z�Return an iterator over all non-overlapping matches in the
    string.  For each match, the iterator returns a match object.

    Empty matches are included in the result.)r0r	)r1r2r3r.r.r/r	�scCs
t||�S)zACompile a regular expression pattern, returning a pattern object.)r0)r1r3r.r.r/r
�scCstj�tj�dS)z#Clear the regular expression cachesN)�_cache�clear�
_compile_repl�cache_clearr.r.r.r/r�scCst||tB�S)z6Compile a template pattern, returning a pattern object)r0r+)r1r3r.r.r/r�sZ@_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890s@_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890cCs�t|t�r\t}t|�}x:t|�D].\}}||kr |dkrBd||<q d|||<q Wdj|�St}g}td�}xH|D]@}||kr�|j|�qr|dkr�|j	d�qr|j|�|j|�qrWt
|�SdS)	zU
    Escape all the characters in pattern except ASCII letters, numbers and '_'.
    �z\000�\��\rs\000N)�
isinstance�str�
_alphanum_str�list�	enumerate�join�_alphanum_bytes�ord�append�extend�bytes)r1�alphanum�s�i�c�escr.r.r/r
�s(




r=ic
Cs�y6tt|�||f\}}|dks0|tjtj�kr4|SWntk
rJYnXt|t�rf|rbtd��|St	j
|�sxtd��t	j||�}|t
@s�tt�tkr�tj�|jt@r�ts�|Stjtj�}nd}||ftt|�||f<|S)Nz5cannot process flags argument with a compiled patternz1first argument must be string or compiled pattern)r7�type�_locale�	setlocale�LC_CTYPE�KeyErrorr?�
_pattern_type�
ValueErrorr!�isstring�	TypeErrorr
r-�len�	_MAXCACHEr8r3r)r1r3�p�locr.r.r/r0s0


r0cCstj||�S)N)�	sre_parse�parse_template)r4r1r.r.r/r9:sr9cCstj||�}tj||�S)N)r\r]�expand_template)r1rrr.r.r/�_expand?sr_cCs@t||�}|dr0t|d�dkr0|ddS|fdd�}|S)Nr�cSstj||�S)N)r\r^)rrr.r.r/�filterJsz_subx.<locals>.filter)r9rX)r1rrar.r.r/�_subxDs

rbcCst|j|jffS)N)r0r1r3)rZr.r.r/�_pickleRsrcc@seZdZddd�Zdd�ZdS)�Scannerrc
Cs�ddlm}m}||_g}tj�}||_xP|D]H\}}|j�}	|jtj	|||	ddtj
||�ffg��|j|	|d�q.Wtj	||d|ffg�}tj
|�|_dS)Nr)�BRANCH�
SUBPATTERNr`���)�
sre_constantsrerf�lexiconr\�Patternr3�	opengrouprG�
SubPattern�parse�
closegroupr!r
�scanner)
�selfrir3rerfrZrK�phrase�action�gidr.r.r/�__init__[s
zScanner.__init__c	Cs�g}|j}|jj|�j}d}xf|�}|s*P|j�}||kr<P|j|jdd}t|�rl||_|||j��}|dk	r|||�|}qW|||d�fS)Nrr`)rGror�endri�	lastindex�callable�group)	rpr2�resultrGrrL�m�jrrr.r.r/�scanjs&zScanner.scanN)r)rrr rtr|r.r.r.r/rdZs
rd)r)r)r)rr)rr)rr)r)r)r)r)+�__doc__�enumr!r\�	functoolsrP�ImportError�__all__�__version__�IntFlagr�globals�update�__members__rrrrrrrrr	r
rr�	frozensetrArEr
r7rOrTrYr0�	lru_cacher9r_rb�copyregrc�picklerdr.r.r.r/�<module>xsX




	







 uuid.cpython-36.opt-2.pyc000064400000033500150335715140011105 0ustar003

�\dh�]�@sddlZdZddddg\ZZZZeZeZ	Gdd�de
�Zd	d
�Zdd�Z
d
d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdZZy�ddlZddlZddlZdgZejjd�s�ejd�xLeD]DZyejej j!e��Z"Wne#k
r�w�YnXe$e"d�r�e"j%ZPq�W[ejdk�r<eej&�j'j(d �d�d!k�r<dZyej)j*Z"WndZ"YnXe+e"d"e+e"d#d��ZWnYnXd$d%�Z,d&d'�Z-d(d)�Z.da/e-eegZ0e,eeeeegZ1d*d+�Z2da3d8d,d-�Z4d.d/�Z5d0d1�Z6d2d3�Z7ed4�Z8ed5�Z9ed6�Z:ed7�Z;dS)9�NzKa-Ping Yee <ping@zesty.ca>zreserved for NCS compatibilityzspecified in RFC 4122z$reserved for Microsoft compatibilityzreserved for future definitionc@seZdZd6dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
edd��Zedd��Zedd��Zedd��Zed d!��Zed"d#��Zed$d%��Zed&d'��Zed(d)��Zed*d+��Zed,d-��Zed.d/��Zed0d1��Zed2d3��Zed4d5��ZdS)7�UUIDNcCs�|||||gjd�dkr td��|dk	rl|jdd�jdd�}|jd�jdd�}t|�dkrbtd	��t|d
�}|dk	r�t|�d
kr�td��|d'dd(�|d)d*d+�|d,d-d.�|dd�}|dk	�r�t|�d
kr�td��tj|dd�}|dk	�r"t|�d
k�r
td��|\}}}	}
}}d|k�o.d/kn�s>td��d|k�oRd0kn�sbtd��d|	k�ovd1kn�s�td��d|
k�o�d2kn�s�td��d|k�o�d3kn�s�td��d|k�o�d4kn�s�td��|
d>|B}
|d>|d>B|	d>B|
d>B|B}|dk	�rTd|k�oDdd>kn�sTtd��|dk	�r�d|k�ord kn�s�td!��|d6M}|d7O}|d9M}||d%>O}||jd&<dS):N�zGone of the hex, bytes, bytes_le, fields, or int arguments must be givenzurn:�zuuid:z{}�-� z$badly formed hexadecimal UUID string�z bytes_le is not a 16-char string���zbytes is not a 16-char string�big)�	byteorderzfields is not a 6-tuplerz*field 1 out of range (need a 32-bit value)z*field 2 out of range (need a 16-bit value)z*field 3 out of range (need a 16-bit value)z*field 4 out of range (need an 8-bit value)z*field 5 out of range (need an 8-bit value)�0z*field 6 out of range (need a 48-bit value)�`�P�@�z*int is out of range (need a 128-bit value)�zillegal version numberi�i�i��L�int����rrr�rrlii�rlll����lll����)	�count�	TypeError�replace�strip�len�
ValueError�int_�
from_bytes�__dict__)�self�hex�bytes�bytes_le�fieldsr�version�time_low�time_mid�time_hi_version�clock_seq_hi_variant�
clock_seq_low�node�	clock_seq�r/�/usr/lib64/python3.6/uuid.py�__init__jsZ
6

$
 
z
UUID.__init__cCst|t�r|j|jkStS)N)�
isinstancerr�NotImplemented)r"�otherr/r/r0�__eq__�s
zUUID.__eq__cCst|t�r|j|jkStS)N)r2rrr3)r"r4r/r/r0�__lt__�s
zUUID.__lt__cCst|t�r|j|jkStS)N)r2rrr3)r"r4r/r/r0�__gt__�s
zUUID.__gt__cCst|t�r|j|jkStS)N)r2rrr3)r"r4r/r/r0�__le__�s
zUUID.__le__cCst|t�r|j|jkStS)N)r2rrr3)r"r4r/r/r0�__ge__�s
zUUID.__ge__cCs
t|j�S)N)�hashr)r"r/r/r0�__hash__�sz
UUID.__hash__cCs|jS)N)r)r"r/r/r0�__int__�szUUID.__int__cCsd|jjt|�fS)Nz%s(%r))�	__class__�__name__�str)r"r/r/r0�__repr__�sz
UUID.__repr__cCstd��dS)NzUUID objects are immutable)r)r"�name�valuer/r/r0�__setattr__�szUUID.__setattr__cCsDd|j}d|dd�|dd�|dd�|dd�|dd�fS)Nz%032xz%s-%s-%s-%s-%sr
�r�)r)r"r#r/r/r0�__str__�s
zUUID.__str__cCs|jjdd�S)Nrr)r�to_bytes)r"r/r/r0r$�sz
UUID.bytescCs<|j}|ddd�|ddd	�|d
dd�|dd�S)
Nrrr	r
rrrrrrrr)r$)r"r$r/r/r0r%�s(z
UUID.bytes_lecCs|j|j|j|j|j|jfS)N)r(r)r*r+r,r-)r"r/r/r0r&�szUUID.fieldscCs
|jd?S)Nr)r)r"r/r/r0r(�sz
UUID.time_lowcCs|jd?d@S)Nri��)r)r"r/r/r0r)�sz
UUID.time_midcCs|jd?d@S)Nri��)r)r"r/r/r0r*�szUUID.time_hi_versioncCs|jd?d@S)N�8�)r)r"r/r/r0r+szUUID.clock_seq_hi_variantcCs|jd?d@S)Nr
rI)r)r"r/r/r0r,szUUID.clock_seq_lowcCs|jd@d>|jd>B|jBS)Ni�r
r)r*r)r()r"r/r/r0�time
sz	UUID.timecCs|jd@d>|jBS)N�?r
)r+r,)r"r/r/r0r.szUUID.clock_seqcCs
|jd@S)Nl���)r)r"r/r/r0r-sz	UUID.nodecCs
d|jS)Nz%032x)r)r"r/r/r0r#szUUID.hexcCsdt|�S)Nz	urn:uuid:)r?)r"r/r/r0�urnszUUID.urncCs2|jd@stS|jd@stS|jd@s*tStSdS)Ni�r
i@i lll)r�RESERVED_NCS�RFC_4122�RESERVED_MICROSOFT�RESERVED_FUTURE)r"r/r/r0�variant s


zUUID.variantcCs |jtkrt|jd?d@�SdS)Nr�)rQrNr)r"r/r/r0r'+s
zUUID.version)NNNNNN)r>�
__module__�__qualname__r1r5r6r7r8r9r;r<r@rCrF�propertyr$r%r&r(r)r*r+r,rJr.r-r#rLrQr'r/r/r/r0r:s60
Orc	Gs�ddl}ddl}ddl}|j|�}|dkrP|jjd�}|j||d�}|dkrPdSt|j�}d|d<|j|f||j	|j
|d�}|S)	Nr�/sbin�	/usr/sbin)�path�C�LC_ALL)�stdout�stderr�env)rVrW)�os�shutil�
subprocessZwhich�pathsep�join�dict�environ�Popen�PIPEZDEVNULL)	�command�argsr^r_r`�
executablerXr]�procr/r/r0�_popen1s

rkc
Cs�y�t|f|j���}|sdS|��x�|jD]z}|j�j�j�}xdtt|��D]T}|||krLy*|||�}t|jdd�d�}	|	r�|	SWqLt	t
fk
r�YqLXqLWq*WWdQRXWntk
r�YnXdS)N�:�r)rk�splitr[�lower�rstrip�rangerrrr�
IndexError�OSError)
rgrhZhw_identifiersZ	get_indexrj�line�words�i�word�macr/r/r0�	_find_macDs$rycCs0d}x&dD]}td||d	d
��}|r
|Sq
WdS)
N�hwaddr�ether�address:�lladdrr�-a�-avZifconfigcSs|dS)Nrr/)rvr/r/r0�<lambda>bsz#_ifconfig_getnode.<locals>.<lambda>)rzr{r|r})rr~r)ry)�keywordsrhrxr/r/r0�_ifconfig_getnode]s

r�cCs tdddgdd��}|r|SdS)NZip�links
link/ethercSs|dS)Nrr/)rvr/r/r0r�isz_ip_getnode.<locals>.<lambda>)ry)rxr/r/r0�_ip_getnodefsr�cCs�ddl}ddl}y|j|j��}Wntk
r6dSXtdd|j|�gdd��}|rZ|Stdd|j|�gdd��}|r||Stdd|jd|�gdd��}|r�|SdS)	NrZarpz-ancSsdS)Nrrr/)rvr/r/r0r�vsz_arp_getnode.<locals>.<lambda>cSs|dS)Nrr/)rvr/r/r0r�{sz(%s)cSs|dS)N�r/)rvr/r/r0r��s)r^�socketZ
gethostbynameZgethostnamersry�fsencode)r^r�Zip_addrrxr/r/r0�_arp_getnodems
r�cCstdddgdd��S)NZlanscanz-aislan0cSsdS)Nrr/)rvr/r/r0r��sz"_lanscan_getnode.<locals>.<lambda>)ryr/r/r/r0�_lanscan_getnode�sr�c"Cs�y�tdd�}|sdS|��|jj�j�j�}y|jd�}Wntk
rNdSXxt|jD]j}yL|j�j�}||}t|�dkr�|jd�dkr�t	|j
dd�d�}|r�|SWqXttfk
r�YqXXqXWWdQRXWntk
r�YnXdS)	NZnetstatz-iasAddress�rlrrmr)
rkr[�readlinerprn�indexrrrrrrrrs)rjrurvrtrwrxr/r/r0�_netstat_getnode�s,
r�c
Csddl}ddl}ddl}dddg}y:ddl}|jd�}|jjj|d�|jd|j	j
d��WnYnXx�|D]�}y$|j|jj
|d�dg|jd	d
�}Wntk
r�wpYnX|�JxB|jD]8}|jd�dj�j�}	|jd
|	�r�t|	jdd�d�Sq�WWdQRXqpWdS)Nrrzc:\windows\system32zc:\winnt\system32i,�mbcsZipconfigz/allZoem)r[�encoding�:rz((?:[0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]rrr)r^�rer`�ctypes�create_string_buffer�windllZkernel32ZGetSystemDirectoryA�insertrB�decodererXrbrfrsr[rnrro�	fullmatchrr)
r^r�r`�dirsr��buffer�dirrjrtrBr/r/r0�_ipconfig_getnode�s*


r�cCsddl}ddl}|j�}|j|_|j�|_}|j�|j|�dkrHdS|j	�x�t
|j�D]�}|j�|j
|_t|j|�|_|j|�dkr�q\|j�|j|_t|j|�|_djd�|_|j�|_}|j|�dkr�q\|j	�|jdd�}t|�dkr�q\tj|d�SWdS)Nr�*rr	r)�	win32wnet�netbiosZNCBZNCBENUMZCommandZ	LANA_ENUMZBufferZ_packZNetbiosZ_unpackrqZlengthZResetZNCBRESET�ordZlanaZLana_numZNCBASTAT�ljustZCallnameZADAPTER_STATUSZadapter_addressrrr )r�r�ZncbZadaptersrvZstatusr$r/r/r0�_netbios_getnode�s4r�Zuuid�win�c�uuid_generate_time�darwin�.�	ZUuidCreateSequentialZ
UuidCreatecCs$tjd�}t|�tt|j�d�jS)Nr)r$)r�r��_uuid_generate_timer�bytes_�rawr-)�_bufferr/r/r0�_unixdll_getnodes
r�cCs,tjd�}t|�dkr(tt|j�d�jSdS)Nrr)r$)r�r��_UuidCreaterr�r�r-)r�r/r/r0�_windll_getnodes
r�cCsddl}|jd�dBS)Nrr
l)�random�getrandbits)r�r/r/r0�_random_getnodesr�c
Cs~tdk	rtSddl}|jdkr$t}nt}xP|tgD]B}y
|�aWnw4YnXtdk	r4dtkoldknr4tSq4WdS)NrZwin32rr
l)�_node�sys�platform�_NODE_GETTERS_WIN32�_NODE_GETTERS_UNIXr�)r�Zgetters�getterr/r/r0�getnode&s


 r�cCs�tr>||kodknr>tjd�}t|�tt|j�d�Sddl}t|j�d�}t|d�d}tdk	r~|tkr~td}|a|dkr�ddl	}|j
d�}|d	@}|d
?d@}|d?d
@}	|d@}
|d?d@}|dkr�t�}t|||	||
|fdd�S)Nr)r$rge��A�dl@'Hw�
r�l��ri��r
i�rIr
rK)r&r')r�r�r�rr�r�rJr�_last_timestampr�r�r�)r-r.r�rJZnanosecondsZ	timestampr�r(r)r*r,r+r/r/r0�uuid1Ds,

r�cCs<ddlm}||jt|d�dd�j�}t|dd�dd�S)	Nr)�md5zutf-8F)Zusedforsecurityrr)r$r')�hashlibr�r$�digestr)�	namespacerAr�r�r/r/r0�uuid3gs
r�cCsttjd�dd�S)Nrr)r$r')rr^�urandomr/r/r/r0�uuid4psr�cCs8ddlm}||jt|d��j�}t|dd�dd�S)Nr)�sha1zutf-8rr)r$r')r�r�r$r�r)r�rAr�r:r/r/r0�uuid5tsr�z$6ba7b810-9dad-11d1-80b4-00c04fd430c8z$6ba7b811-9dad-11d1-80b4-00c04fd430c8z$6ba7b812-9dad-11d1-80b4-00c04fd430c8z$6ba7b814-9dad-11d1-80b4-00c04fd430c8)NN)<r^�
__author__rMrNrOrPrrr$r��objectrrkryr�r�r�r�r�r�r�r�r�r�Zctypes.utilr�Z	_libnamesr��
startswith�appendZlibnameZCDLL�utilZfind_library�lib�	Exception�hasattrr��uname�releasernr�Zrpcrt4�getattrr�r�r�r�r�r�r�r�r�r�r�r�Z
NAMESPACE_DNSZ
NAMESPACE_URLZ
NAMESPACE_OIDZNAMESPACE_X500r/r/r/r0�<module>/sxx	"


	




#	sre_compile.cpython-36.opt-1.pyc000064400000023634150335715140012446 0ustar003


 \�K�@s�dZddlZddlZddlTeehZeee	hZ
eehZ
eehZdVZd%d&�eD�Zd'd(�ZdWd)d*�Zd+d,�Zejd-Zd.e>d.Zd/d0d1Zeefd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Z d>d?�Z!d@dA�Z"dBdC�Z#dXdDdE�Z$dS)YzInternal support module for sre�N)�*�i�1�s����E����������������������������������a�����cs.i|]&}|D]�t�fdd�|D����qqS)c3s|]}�|kr|VqdS)N�)�.0�j)�ir$�#/usr/lib64/python3.6/sre_compile.py�	<genexpr>=sz<dictcomp>.<genexpr>)�tuple)r%�tr$)r'r(�
<dictcomp>=sr,cCsr|j}t}t}t}t}t}|t@rD|t@rD|t@rD|t	@rDt
}	nd}	�x"|D�]\}
}|
|k�r|t@�rtj||�}|	r�||	kr�|t
�||�}
|d�|
tkr�|t�x&|f|	|D]}|t�||�q�W|t�||�|
||
<n|t|
�||�n||
�||�qP|
tk�r�|t@�rF|t|
�|fdd�}n||
�d}||�}
|d�t|||||	�||�|
||
<qP|
tk�r�|t@�r�|t�n|t�qP|
|k�r�|t@�r�td|
f��n�t|��rR|
tk	�rR|
tk�r�|t�n|t�||�}
|d�||d�||d�t||d|�|t �||�|
||
<nl|t�||�}
|d�||d�||d�t||d|�||�|
||
<|
tk�r�|t!�n|t"�qP|
t#k�r.|\}}}}|�r�|t$�||dd�t||||B|@�|�rj|t$�||ddd�qP|
|k�rB||
�qP|
|k�r�||
�||�}
|d�|ddk�r||d�n*|dj%�\}}||k�r�td��||�t||d|�|t �||�|
||
<qP|
t&k�r||
�||�}
|d�t|||�|t �||�|
||
<qP|
t'k�r�||
�|t(@�r@t)j*||�}|t@�rXt+j*||�}n"|t@�rz|t	@�rzt,j*||�}||�qP|
t-k�r&||
�g}|j}xZ|dD]N}||�}
|d�t|||�|t.�|||��|d�||�|
||
<�q�W|t�x|D]}||�|||<�q
WqP|
t/k�rt||
�|t@�rLt0|}n|t@�rj|t	@�rjt1|}||�qP|
t2k�r�|t@�r�|t|
�n||
�||d�qP|
t3k�r\||
�||dd�||�}|d�t||d|�|d�rF|t.�||�}|d�||�|d||<t||d|�||�|||<n||�|d||<qPtd|
f��qPWdS)	NrcSstj||�S)N)�_sre�getlower)�literal�flagsr$r$r(�fixupfsz_compile.<locals>.fixupz*internal: unsupported template operator %r��z(look-behind requires fixed-width patternz%internal: unsupported operand type %r)4�append�len�_LITERAL_CODES�_REPEATING_CODES�_SUCCESS_CODES�
_ASSERT_CODES�SRE_FLAG_IGNORECASE�SRE_FLAG_LOCALE�SRE_FLAG_UNICODE�SRE_FLAG_ASCII�_ignorecase_fixesr-r.�	IN_IGNORE�NOT_LITERAL�NEGATE�LITERAL�FAILURE�	OP_IGNORE�IN�_compile_charset�ANY�SRE_FLAG_DOTALL�ANY_ALL�SRE_FLAG_TEMPLATE�error�_simple�REPEAT�
MAX_REPEAT�
REPEAT_ONE�MIN_REPEAT_ONE�_compile�SUCCESS�	MAX_UNTIL�	MIN_UNTIL�
SUBPATTERN�MARK�getwidth�CALL�AT�SRE_FLAG_MULTILINE�AT_MULTILINE�get�	AT_LOCALE�
AT_UNICODE�BRANCH�JUMP�CATEGORY�	CH_LOCALE�
CH_UNICODE�GROUPREF�GROUPREF_EXISTS)�code�patternr0�emit�_len�
LITERAL_CODES�REPEATING_CODES�
SUCCESS_CODES�ASSERT_CODES�fixes�op�av�lo�skip�kr1�group�	add_flags�	del_flags�p�hi�tail�
tailappend�skipyes�skipnor$r$r(rQ@s.







































rQcCs�|j}x�t|||�D]�\}}||�|tkr.q|tkr@||�q|tksP|tkrj||d�||d�q|tkr~|j|�q|tkr�|j|�q|t	kr�|t
@r�|t|�q�|t@r�|t
@r�|t|�q�||�qtd|f��qW|t�dS)Nrr2z%internal: unsupported set operator %r)r4�_optimize_charsetrArB�RANGE�RANGE_IGNORE�CHARSET�extend�
BIGCHARSETrar;rbr<r=rcrKrC)�charsetr0rfr1rnrhrorpr$r$r(rF�s,

rFcCsdg}g}td�}�xt|D�]j\}}�x^�y|tkrx|rn||�}d||<|rv||krvx"||D]}	d||	<q\Wnd||<n�|tkr�t|d|dd�}
|r�t||
�}
|r�|r�xN|
D].}d||<||kr�x||D]}	d||	<q�Wq�Wnx>|
D]}d||<q�Wn(|tk�r|j||f�n|j||f�WnTtk
�r|t|�dk�rV|dd7}w&|�rj|tk�rjt	}|j||f�YnXPq&WqWg}d}
xj|j
d|
�}|dk�r�Pt|�dk�r�d}P|j
d|�}
|
dk�r�|j|t|�f�P|j||
f��q�W|dk	�rvxF|D]>\}}
|
|dk�r2|jt|f�n|jt||
dff��qW||7}|�snt|�t|�k�rr|S|St|�dk�r�t|�}|jt|f�||7}|St
|�}i}td�}d}t�}xftddd�D]V}|||d�}||k�r||||d<n$|||d<||<|d7}||7}�q�Wt|�}|gt|�|dd�<|jt|f�||7}|S)N�r2r�i�r3i)�	bytearrayrBr~�range�maprAr4�
IndexErrorr5r�find�
_mk_bitmapr��bytes�_bytes_to_codesr�)r�r1rn�outry�charmaprorprqrs�rr'�runs�qrw�data�comps�mapping�block�chunkr$r$r(r}�s�









r}�r2�0�1�cs8|jt�ddd�����fdd�tt��d��D�S)Nr2cs"g|]}��|�|�d��qS)r3r$)r%r')�	_CODEBITS�_int�sr$r(�
<listcomp>zsz_mk_bitmap.<locals>.<listcomp>r���)�	translate�_BITS_TRANSr�r5)�bitsr�r�r$)r�r�r�r(r�xsr�cCst|�jd�}|j�S)N�I)�
memoryview�cast�tolist)�b�ar$r$r(r�}sr�cCs<|dj�\}}||ko"dkno:|dddtkS)Nr3r2r)rWrU)rprqrxr$r$r(rL�srLcCsvdgt|�}xbtdt|��D]P}||d}x>||||kr`|dkrRd||<P||d}q0W|d||<qW|S)aj
    Generate an overlap table for the following prefix.
    An overlap table is a table of the same size as the prefix which
    informs about the potential self-overlap for each index in the prefix:
    - if overlap[i] == 0, prefix[i:] can't overlap prefix[0:...]
    - if overlap[i] == k with 0 < k <= i, prefix[i-k+1:i+1] overlaps with
      prefix[0:k]
    rr2)r5r�)�prefix�tabler'�idxr$r$r(�_generate_overlap_table�s	r�c
Cs�g}|j}d}x�|jD]�\}}|tkr0||�q|tkr�|\}}}}	|t@rNPt|	�\}
}}|dkr�|dk	rvt|�}n|dk	r�t|�|}|j|
�|s�PqPqW||dfS||dfS)NTF)r4r�rBrUr:�_get_literal_prefixr5r�)
rgr��prefixappend�prefix_skiprorprtrurvrw�prefix1�prefix_skip1�got_allr$r$r(r��s,



r�cCs"g}|j}|j�r|jd\}}|tkr�|\}}}}|r�|t@r�|d\}}|tkrd|||f�nR|tkr�g}	|	j}
x�|dD].}|s�P|d\}}|tkr�|
||f�q�Pq�W|	}nf|tk�rg}	|	j}
xP|dD]0}|s�P|d\}}|tk�r|
||f�q�Pq�W|	}n|tk�r|}|S)Nrr2)r4r�rUr:rBr_rE)rgr��
charsetappendrorprtrurvrw�c�cappendr$r$r(�_get_charset_prefix�sF


r�cCsZ|j�\}}|tkrt}|dkr8|jtdd||g�dSg}d}g}|t@sft|�\}}}|sft|�}|j}	|	t�t|�}
|	d�d}|r�t	}|dkr�|r�|t
B}n|r�|tB}|	|�|tkr�|	|�n|	t�|dt�}|	t|t��|�r4|	t|��|dk�rt|�}|	|�|j|�|jt
|��n|�rFt|||�t|�|
||
<dS)Nr�)rW�MAXCODEr��INFOr:r�r�r4r5�SRE_INFO_PREFIX�SRE_INFO_LITERAL�SRE_INFO_CHARSET�minr�rF)rfrgr0rqrxr�r�r�r�rhrr�maskr$r$r(�
_compile_info�sP



r�cCst|ttf�S)N)�
isinstance�strr�)�objr$r$r(�isstringsr�cCs8|jj|B}g}t|||�t||j|�|jt�|S)N)rgr0r�rQr�r4rR)rwr0rfr$r$r(�_codes
r�cCs�t|�r|}tj||�}nd}t||�}|jj}dg|jj}x|j�D]\}}|||<qHWtj	|||jj
B||jjd||�S)Nr2)r��	sre_parse�parser�rg�	groupdict�groups�itemsr-�compiler0)rwr0rgrf�
groupindex�
indexgrouprsr'r$r$r(r�-s

r��rr�rr�rr�r	r
r�rr
�rr�rr�rr�rr�rr�rr�rr�rr�rr�r r!�r"r#)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�)NN)r)%�__doc__r-r��
sre_constantsrBr@r6rM�
MIN_REPEATrNr7rRrCr8�ASSERT�
ASSERT_NOTr9�
_equivalencesr>rQrFr}�CODESIZEr�r�r��intr�r�rLr�r�r�r�r�r�r�r$r$r$r(�<module>sT
 
{
)9symtable.cpython-36.opt-2.pyc000064400000022632150335715140011763 0ustar003


 \m�@sJddlZddlmZmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZddlZdddddgZdd�ZGd	d
�d
�Ze�ZGdd�de�ZGdd�de�ZGd
d�de�ZGdd�de�Zedk�rFddlZddlZeejd��Zej�Z WdQRXee ej!j"ejd�dd�Z#x0e#j$�D]$Z%e#j&e%�Z'e(e'e'j)�e'j*���qWdS)�N)�USE�
DEF_GLOBAL�	DEF_LOCAL�	DEF_PARAM�
DEF_IMPORT�	DEF_BOUND�	DEF_ANNOT�	SCOPE_OFF�
SCOPE_MASK�FREE�LOCAL�GLOBAL_IMPLICIT�GLOBAL_EXPLICIT�CELL�symtable�SymbolTable�Class�Function�SymbolcCstj|||�}t||�S)N)�	_symtabler�_newSymbolTable)�code�filenameZcompile_type�top�r� /usr/lib64/python3.6/symtable.pyrsc@s$eZdZdd�Zdd�Zdd�ZdS)�SymbolTableFactorycCstj�|_dS)N)�weakref�WeakValueDictionary�_SymbolTableFactory__memo)�selfrrr�__init__szSymbolTableFactory.__init__cCs6|jtjkrt||�S|jtjkr,t||�St||�S)N)�typer�
TYPE_FUNCTIONr�
TYPE_CLASSrr)r �tablerrrr�news


zSymbolTableFactory.newcCs8||f}|jj|d�}|dkr4|j||�}|j|<|S)N)r�getr&)r r%r�key�objrrr�__call__s
zSymbolTableFactory.__call__N)�__name__�
__module__�__qualname__r!r&r*rrrrrsrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS) rcCs||_||_i|_dS)N)�_table�	_filename�_symbols)r Z	raw_tablerrrrr!'szSymbolTable.__init__cCsN|jtkrd}nd|jj}|jjdkr6dj||j�Sdj||jj|j�SdS)N�z%s �globalz<{0}SymbolTable for module {1}>z<{0}SymbolTable for {1} in {2}>)�	__class__rr+r.�name�formatr/)r Zkindrrr�__repr__,s
zSymbolTable.__repr__cCs:|jjtjkrdS|jjtjkr$dS|jjtjkr6dSdS)N�moduleZfunction�class)r.r"rZTYPE_MODULEr#r$)r rrr�get_type9szSymbolTable.get_typecCs|jjS)N)r.�id)r rrr�get_idCszSymbolTable.get_idcCs|jjS)N)r.r4)r rrr�get_nameFszSymbolTable.get_namecCs|jjS)N)r.�lineno)r rrr�
get_linenoIszSymbolTable.get_linenocCst|jjtjk�S)N)�boolr.r"rr#)r rrr�is_optimizedLszSymbolTable.is_optimizedcCst|jj�S)N)r?r.�nested)r rrr�	is_nestedOszSymbolTable.is_nestedcCst|jj�S)N)r?r.�children)r rrr�has_childrenRszSymbolTable.has_childrencCsdS)NFr)r rrr�has_execUszSymbolTable.has_execcCs|jjj�S)N)r.�symbols�keys)r rrr�get_identifiersYszSymbolTable.get_identifierscCsD|jj|�}|dkr@|jj|}|j|�}t|||�}|j|<|S)N)r0r'r.rF�_SymbolTable__check_childrenr)r r4Zsym�flags�
namespacesrrr�lookup\s
zSymbolTable.lookupcs�fdd��j�D�S)Ncsg|]}�j|��qSr)rL)�.0�ident)r rr�
<listcomp>esz+SymbolTable.get_symbols.<locals>.<listcomp>)rH)r r)r r�get_symbolsdszSymbolTable.get_symbolscs��fdd��jjD�S)Ncs"g|]}|j�krt|�j��qSr)r4rr/)rM�st)r4r rrrOhsz0SymbolTable.__check_children.<locals>.<listcomp>)r.rC)r r4r)r4r rZ__check_childrengszSymbolTable.__check_childrencs�fdd��jjD�S)Ncsg|]}t|�j��qSr)rr/)rMrQ)r rrrOmsz,SymbolTable.get_children.<locals>.<listcomp>)r.rC)r r)r r�get_childrenls
zSymbolTable.get_childrenN)r+r,r-r!r6r9r;r<r>r@rBrDrErHrLrPrIrRrrrrr%s

c@sDeZdZdZdZdZdZdd�Zdd�Zdd�Z	dd	�Z
d
d�ZdS)rNcst��fdd��j�D��S)Ncs g|]}��jj|�r|�qSr)r.rF)rMrN)r �	test_funcrrrOzsz.Function.__idents_matching.<locals>.<listcomp>)�tuplerH)r rSr)r rSrZ__idents_matchingyszFunction.__idents_matchingcCs |jdkr|jdd��|_|jS)NcSs|t@S)N)r)�xrrr�<lambda>sz)Function.get_parameters.<locals>.<lambda>)�_Function__params�_Function__idents_matching)r rrr�get_parameters}s
zFunction.get_parameterscs0|jdkr*ttf��fdd�}|j|�|_|jS)Ncs|t?t@�kS)N)r	r
)rU)�locsrrrV�sz%Function.get_locals.<locals>.<lambda>)�_Function__localsrrrX)r �testr)rZr�
get_locals�s

zFunction.get_localscs0|jdkr*ttf��fdd�}|j|�|_|jS)Ncs|t?t@�kS)N)r	r
)rU)�globrrrV�sz&Function.get_globals.<locals>.<lambda>)�_Function__globalsr
rrX)r r\r)r^r�get_globals�s

zFunction.get_globalscCs$|jdkrdd�}|j|�|_|jS)NcSs|t?t@tkS)N)r	r
r)rUrrrrV�sz$Function.get_frees.<locals>.<lambda>)�_Function__freesrX)r �is_freerrr�	get_frees�s
zFunction.get_frees)r+r,r-rWr[rar_rXrYr]r`rcrrrrrqsc@seZdZdZdd�ZdS)rNcCs:|jdkr4i}x|jjD]}d||j<qWt|�|_|jS)N�)�_Class__methodsr.rCr4rT)r �drQrrr�get_methods�s

zClass.get_methods)r+r,r-rergrrrrr�sc@s�eZdZd dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)!rNcCs(||_||_|t?t@|_|p f|_dS)N)�
_Symbol__name�_Symbol__flagsr	r
�_Symbol__scope�_Symbol__namespaces)r r4rJrKrrrr!�szSymbol.__init__cCsdj|j�S)Nz<symbol {0!r}>)r5rh)r rrrr6�szSymbol.__repr__cCs|jS)N)rh)r rrrr<�szSymbol.get_namecCst|jtj@�S)N)r?rirr)r rrr�
is_referenced�szSymbol.is_referencedcCst|jt@�S)N)r?rir)r rrr�is_parameter�szSymbol.is_parametercCst|jttfk�S)N)r?rjr
r)r rrr�	is_global�szSymbol.is_globalcCst|jtk�S)N)r?rjr)r rrr�is_declared_global�szSymbol.is_declared_globalcCst|jt@�S)N)r?rir)r rrr�is_local�szSymbol.is_localcCst|jt@�S)N)r?rir)r rrr�is_annotated�szSymbol.is_annotatedcCst|jtk�S)N)r?rjr)r rrrrb�szSymbol.is_freecCst|jt@�S)N)r?rir)r rrr�is_imported�szSymbol.is_importedcCst|jt@�S)N)r?rir)r rrr�is_assigned�szSymbol.is_assignedcCs
t|j�S)N)r?rk)r rrr�is_namespace�szSymbol.is_namespacecCs|jS)N)rk)r rrr�get_namespaces�szSymbol.get_namespacescCs t|j�dkrtd��|jdS)Nrdz$name is bound to multiple namespacesr)�lenrk�
ValueError)r rrr�
get_namespace�szSymbol.get_namespace)N)r+r,r-r!r6r<rlrmrnrorprqrbrrrsrtrurxrrrrr�s

�__main__rd�exec)+rrrrrrrrr	r
rrr
rrr�__all__rrr�objectrrrrr+�os�sys�open�argv�f�read�src�path�split�modrHrNrL�info�printrprtrrrr�<module>s$@L&
C

pstats.cpython-36.pyc000064400000052543150335715140010525 0ustar003


 \�g�@sfdZddlZddlZddlZddlZddlZddlmZdgZGdd�d�Z	Gdd�d�Z
dd	�Zd
d�Zdd
�Z
dd�Zdd�Zdd�Zdd�Zedk�rbddlZyddlZWnek
r�YnXGdd�dej�Zeej�dkr�ejdZndZyTee�Zx"ejdd�D]Zeje��qWedejd�ej �edejd�Wne!k
�r`YnXdS)z3Class for printing reports on profiled python code.�N)�
cmp_to_key�Statsc@s�eZdZdZdd�dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dBdFdJdNdQdTdWdZd]dbdfdidmdqd!�Z
d"d#�Zd$d%�Zd&d'�Z
d(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zdrd9d:�Zd;d<�Zd=d>�ZdS)sra�This class is used for creating reports from data generated by the
    Profile class.  It is a "friend" of that class, and imports data either
    by direct access to members of Profile class, or by reading in a dictionary
    that was emitted (via marshal) from the Profile class.

    The big change from the previous Profiler (in terms of raw functionality)
    is that an "add()" method has been provided to combine Stats from
    several distinct profile runs.  Both the constructor and the add()
    method now take arbitrarily many file names as arguments.

    All the print methods now take an argument that indicates how many lines
    to print.  If the arg is a floating point number between 0 and 1.0, then
    it is taken as a decimal percentage of the available lines to be printed
    (e.g., .1 means print 10% of all available lines).  If it is an integer,
    it is taken to mean the number of lines of data that you wish to have
    printed.

    The sort_stats() method now processes some additional options (i.e., in
    addition to the old -1, 0, 1, or 2 that are respectively interpreted as
    'stdname', 'calls', 'time', and 'cumulative').  It takes an arbitrary number
    of quoted strings to select the sort order.

    For example sort_stats('time', 'name') sorts on the major key of 'internal
    function time', and on the minor key of 'the name of the function'.  Look at
    the two tables in sort_stats() and get_sort_arg_defs(self) for more
    examples.

    All methods return self, so you can string together commands like:
        Stats('foo', 'goo').strip_dirs().sort_stats('calls').                            print_stats(5).print_callers(5)
    N)�streamcGsF|ptj|_t|�sd}n|d}|dd�}|j|�|j|�dS)Nr�)�sys�stdoutr�len�init�add)�selfr�args�arg�r�/usr/lib64/python3.6/pstats.py�__init__As
zStats.__init__cCs�d|_g|_d|_d|_d|_d|_d|_t�|_i|_	i|_
|j|�y|j�Wn8t
k
r�td|jrx|jdnd|jd��YnXdS)NrzInvalid timing data %sr�)�file���)�all_callees�files�fcn_list�total_tt�total_calls�
prim_calls�max_name_len�set�	top_level�stats�
sort_arg_dict�
load_stats�get_top_level_stats�	Exception�printr)rr
rrrr	Ks"
z
Stats.initcCs�|dkri|_dSt|t�rxt|d��}tj|�|_WdQRXy"tj|�}tj	|j
�d|}WnYnX|g|_n t|d�r�|j
�|j|_i|_|js�td|j|f��dS)N�rbz    �create_statsz.Cannot create or construct a %r object from %r)r�
isinstance�str�open�marshal�load�os�stat�timeZctime�st_mtimer�hasattrr$�	TypeError�	__class__)rr
�fZ
file_statsrrrr^s(



zStats.load_statscCs�x~|jj�D]p\}\}}}}}|j|7_|j|7_|j|7_d|kr\|jj|�tt|��|j	krtt|��|_	qWdS)N�jprofiler�profiler)r2rr3)
r�itemsrrrrr
r�func_std_stringr)r�func�cc�nc�tt�ct�callersrrrr tszStats.get_top_level_statscGs�|s|Sx�t|�D]�}t|�t|�kr.t|�}|j|j7_|j|j7_|j|j7_|j|j7_x|jD]}|jj|�qvW|j	|j	kr�|j	|_	d|_
xJ|jj�D]<\}}||jkr�|j|}nddddif}t
||�|j|<q�WqW|S)Nr)�reversed�typerrrrrrr
rrrr4�add_func_stats)r�arg_list�itemr6r+Z
old_func_statrrrr
~s(
z	Stats.addc
Cs(t|d��}tj|j|�WdQRXdS)z:Write the profile data to a file we know how to load back.�wbN)r'r(�dumpr)r�filenamer1rrr�
dump_stats�szStats.dump_statsr�
call count��cumulative time��	file name��line number��
function name�name/file/liner�primitive call count��
standard name��
internal time)�callsZncallsZcumtime�
cumulativerrC�line�module�nameZnflZpcalls�stdnamer,ZtottimecCs�|jszi|_}i}xP|jj�D]B\}}|}x4|r`|s8P||krJd||<P|||<|dd�}q.Wq Wx|D]
}||=qlW|jS)z)Expand all abbreviations that are unique.rNrr)r�sort_arg_dict_defaultr4)r�dictZbad_list�word�tupZfragmentrrr�get_sort_arg_defs�s 


zStats.get_sort_arg_defscGs"|sd|_|St|�dkrFt|dt�rFddddddddi|dg}|j�}f}d|_d}x:|D]2}|||d}|j|||d7_d	}qbWg}xB|jj�D]4\}\}}	}
}}|j||	|
|f|t	|�|f�q�W|j
tt|�j
�d
�g|_}
x|D]}|
j|d��qW|S)
NrrrYrTr,rRrUrz, )�keyrr)rrr%�intr^�	sort_typerr4�appendr5�sortr�	TupleComp�compare)rZfieldZ
sort_arg_defsZ
sort_tupleZ	connectorr\Z
stats_listr6r7r8r9r:r;r�tuplerrr�
sort_stats�s2


zStats.sort_statscCs|jr|jj�|S)N)r�reverse)rrrr�
reverse_order�s
zStats.reverse_ordercCs�|j}i|_}d}x�|j�D]�\}\}}}}}	t|�}
tt|
��|krTtt|
��}i}x |	j�D]\}}
|
|t|�<qbW|
|kr�t||
|||||f�||
<q|||||f||
<qW|j}t�|_}x|D]}|jt|��q�W||_	d|_
d|_|S)Nr)rr4�func_strip_pathrr5r>rrr
rrr)rZoldstatsZnewstatsrr6r7r8r9r:r;ZnewfuncZ
newcallers�func2�callerZold_topZnew_toprrr�
strip_dirs�s.

zStats.strip_dirsc
Cs||jr
dSi|_}xb|jj�D]T\}\}}}}}||krBi||<x0|j�D]$\}}	||krdi||<|	|||<qLWq WdS)N)rrr4)
rrr6r7r8r9r:r;rkrlrrr�calc_calleess
zStats.calc_calleesc
Cs|}t|t�rpytj|�}Wn&tjk
rB|d|7}||fSXg}x�|D]}|jt|��rN|j|�qNWnzt|�}t|t	�r�d|ko�dknr�t
||d�}|d|�}n2t|t
�r�d|ko�|knr�|}|d|�}t|�t|�k�r|dt|�t|�|f7}||fS)Nz#   <Invalid regular expression %r>
gg�?g�?rz6   List reduced from %r to %r due to restriction <%r>
)r%r&�re�compile�error�searchr5rbr�floatr`)rZsel�list�msgZnew_listZrexr6�countrrr�eval_print_amounts,


""zStats.eval_print_amountcCs�|j}|jr*|jdd�}d|jd}nt|jj��}d}x|D]}|j|||�\}}qBWt|�}|spd|fSt||j	d�|t|j�kr�d}x(|D] }tt
|��|kr�tt
|��}q�W|d|fS)Nz   Ordered by: �
z!   Random listing order was used
r)rrR)rrrartr�keysrwrr"rr5)rZsel_list�widthZ	stat_listruZ	selectionrvr6rrr�get_print_list2s$

zStats.get_print_listcGs�x|jD]}t||jd�qW|jr0t|jd�d}x"|jD]}t|t|�|jd�q<Wt||jdd|jd�|j|jkr�td|jd|jd�td|j|jd�t|jd�|j|�\}}|r�|j	�x|D]}|j
|�q�Wt|jd�t|jd�|S)	N)r� �zfunction calls)�endrz(%d primitive calls)zin %.3f secondsz        )rr"rr�func_get_function_namerrrr{�print_title�
print_line)r�amountrC�indentr6rzrtrrr�print_statsJs(
zStats.print_statscGs~|j|�\}}|rz|j�|j|d�x:|D]2}||jkrP|j|||j|�q,|j||i�q,Wt|jd�t|jd�|S)Nz	called...)r)r{rn�print_call_headingr�print_call_liner"r)rr�rzrtr6rrr�
print_calleesas

zStats.print_calleesc
Gsl|j|�\}}|rh|j|d�x0|D](}|j|\}}}}}	|j|||	d�q$Wt|jd�t|jd�|S)Nzwas called by...z<-)r)r{r�rr�r"r)
rr�rzrtr6r7r8r9r:r;rrr�
print_callersps
zStats.print_callersc
Csxtdj|�||jd�d}x<|jj�D].\}}}}}|r(tt|j���}	t|	t�}Pq(W|rttd|d|jd�dS)Nz	Function )rFr|z    ncalls  tottime  cumtime)	r"�ljustrr�values�next�iterr%rf)
r�	name_sizeZcolumn_titleZ	subheaderr7r8r9r:r;�valuerrrr�{s
zStats.print_call_heading�->cCstt|�j|�|d|jd�|s2t|jd�dSt|j��}d}x�|D]�}t|�}||}	t|	t�r�|	\}
}}}
|
|kr�d|
|f}n
d|
f}d|jdd	t	|��t
|�t
|
�|f}|d
}n$d||	t
|j|d�f}|d}t||||jd�d}qHWdS)
Nr|)r~r)rrz%d/%dz%dz%s %s %s  %srPrRrz	%s(%r) %srF)r"r5r�r�sortedryr%rf�rjustr�f8r)rr��sourceZ	call_dictZarrowZclistr�r6rXr�r8r7r9r:ZsubstatsZ
left_widthrrrr��s*



zStats.print_call_linecCs"tdd|jd�td|jd�dS)Nz-   ncalls  tottime  percall  cumtime  percallr|)r~rzfilename:lineno(function))r)r"r)rrrrr��szStats.print_titlecCs�|j|\}}}}}t|�}||kr4|dt|�}t|jd�d|jd�tt|�d|jd�|dkrxtdd|jd�ntt||�d|jd�tt|�d|jd�|dkr�td	d|jd�ntt||�d|jd�tt|�|jd�dS)
N�/�	r|)r~rrr})rz        z        )rr&r"r�rr�r5)rr6r7r8r9r:r;�crrrr��szStats.print_liner�rr�r�)r�rEr�rr�r�)r�rEr�rFr�r�)r�rGr�rFr�r�)r�rG�rHr�r�)r�rI�rHr�r�)r�rI�rJr�r�)r�rK�rHr�r�)r�rI�rLr�r�)r�rM�rLr�rHr�rJr�r�r�r�)r�rNr�rr�r�)r�rO�rPr�r�)r�rQr�rRr�r�)r�rSr�rRr�r�)r�rS)r�)�__name__�
__module__�__qualname__�__doc__rr	rr r
rDrZr^rgrirmrnrwr{r�r�r�r�r�r�r�rrrrr sF

 
c@s eZdZdZdd�Zdd�ZdS)rda�This class provides a generic function for comparing any two tuples.
    Each instance records a list of tuple-indices (from most significant
    to least significant), and sort direction (ascending or decending) for
    each tuple-index.  The compare functions can then be used as the function
    argument to the system sort() function when a list of tuples need to be
    sorted in the instances order.cCs
||_dS)N)�comp_select_list)rr�rrrr�szTupleComp.__init__cCsBx<|jD]2\}}||}||}||kr.|S||kr|SqWdS)Nr)r�)r�left�right�index�	direction�l�rrrrre�szTupleComp.compareN)r�r�r�r�rrerrrrrd�srdcCs|\}}}tjj|�||fS)N)r*�path�basename)�	func_namerCrVrXrrrrj�s
rjcCs|dS)NrRr)r6rrrr�srcCsN|dd�d	krB|d}|jd�r<|jd�r<d|dd
�S|Snd|SdS)NrR�~r�<�>z{%s}rz	%s:%d(%s))r�rr)�
startswith�endswith)r�rXrrrr5�sr5cCs@|\}}}}}|\}}}	}
}||||||	||
t||�fS)z3Add together all the stats for two profile entries.)�add_callers)�targetr�r7r8r9r:r;Zt_ccZt_ncZt_ttZt_ctZ	t_callersrrrr>�sr>cCs�i}x|j�D]\}}|||<qWxb|j�D]V\}}||krzt|t�rhtdd�t|||�D��||<q�|||7<q,|||<q,W|S)z*Combine two caller lists in a single list.cSsg|]}|d|d�qS)rrr)�.0�irrr�
<listcomp>�szadd_callers.<locals>.<listcomp>)r4r%rf�zip)r�r�Znew_callersr6rlrrrr��s
r�cCs"d}x|j�D]}||7}qW|S)z@Sum the caller statistics to get total number of calls received.r)r�)r;r8rTrrr�count_callssr�cCsd|S)Nz%8.3fr)�xrrrr�sr��__main__c@s�eZdZd6dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)7�ProfileBrowserNcCs6tjj|�d|_d|_tj|_|dk	r2|j|�dS)Nz% )	�cmd�Cmdr�promptrrrr�do_read)r�profilerrrrszProfileBrowser.__init__cCs�|j�}g}x�|D]�}y|jt|��wWntk
r>YnXy8t|�}|dksZ|dkrjtd|jd�w|j|�wWntk
r�YnX|j|�qW|jr�t|j|�|�ntd|jd�dS)Nrrz#Fraction argument must be in [0, 1])rzNo statistics object is loaded.)	�splitrbr`�
ValueErrorrsr"rr�getattr)r�fnrVrZ	processedZtermZfracrrr�generic"s,

zProfileBrowser.genericcCsXtd|jd�td|jd�td|jd�td|jd�td|jd�td|jd�dS)NzArguments may be:)rz0* An integer maximum number of entries to print.z:* A decimal fractional number between 0 and 1, controllingz-  what fraction of selected entries to print.z8* A regular expression; only entries with function namesz  that match it are printed.)r"r)rrrr�generic_help:szProfileBrowser.generic_helpcCsd|jrRy|jj|�Wq`tk
rN}ztd||f|jd�WYdd}~Xq`Xntd|jd�dS)Nz$Failed to load statistics for %s: %s)rzNo statistics object is loaded.r)rr
�IOErrorr"r)rrV�errr�do_addBs*zProfileBrowser.do_addcCstd|jd�dS)Nz>Add profile info from given file to current statistics object.)r)r"r)rrrr�help_addKszProfileBrowser.help_addcCs|jd|�S)Nr�)r�)rrVrrr�
do_calleesNszProfileBrowser.do_calleescCstd|jd�|j�dS)Nz6Print callees statistics from the current stat object.)r)r"rr�)rrrr�help_calleesPszProfileBrowser.help_calleescCs|jd|�S)Nr�)r�)rrVrrr�
do_callersTszProfileBrowser.do_callerscCstd|jd�|j�dS)Nz6Print callers statistics from the current stat object.)r)r"rr�)rrrr�help_callersVszProfileBrowser.help_callerscCstd|jd�dS)Nr)rr)r"r)rrVrrr�do_EOFZszProfileBrowser.do_EOFcCstd|jd�dS)NzLeave the profile brower.)r)r"r)rrrr�help_EOF]szProfileBrowser.help_EOFcCsdS)Nrr)rrVrrr�do_quit`szProfileBrowser.do_quitcCstd|jd�dS)NzLeave the profile brower.)r)r"r)rrrr�	help_quitbszProfileBrowser.help_quitcCs�|r�yt|�|_Wnjtk
rF}zt|jd|jd�dSd}~Xn8tk
r|}zt|jjd||jd�dSd}~XnX|d|_	n6t
|j	�dkr�|j	dd�}|j|�ntd|jd�dS)	Nr)r�:z% rRz1No statistics object is current -- cannot reload.r���)rr�OSErrorr"rrr!r0r�r�rr�)rrV�errrrrr�eszProfileBrowser.do_readcCs td|jd�td|jd�dS)Nz+Read in profile data from a specified file.)rz*Without argument, reload the current file.)r"r)rrrr�	help_readvszProfileBrowser.help_readcCs$|jr|jj�ntd|jd�dS)NzNo statistics object is loaded.)rr)rrir"r)rrVrrr�
do_reversezszProfileBrowser.do_reversecCstd|jd�dS)Nz/Reverse the sort order of the profiling report.)r)r"r)rrrr�help_reverse�szProfileBrowser.help_reversecs�|jstd|jd�dS|jj��|rRt�fdd�|j�D��rR|jj|j��n@td|jd�x0tjj	�D]"\}}td||df|jd�qlWdS)	NzNo statistics object is loaded.)rc3s|]}|�kVqdS)Nr)r�r�)�abbrevsrr�	<genexpr>�sz)ProfileBrowser.do_sort.<locals>.<genexpr>z/Valid sort keys (unique prefixes are accepted):z%s -- %srr)
rr"rr^�allr�rgrrZr4)rrVr_r�r)r�r�do_sort�s
zProfileBrowser.do_sortcCs td|jd�td|jd�dS)Nz.Sort profile data according to specified keys.)rz3(Typing `sort' without arguments lists valid keys.))r"r)rrrr�	help_sort�szProfileBrowser.help_sortcs�fdd�tjD�S)Ncsg|]}|j��r|�qSr)r�)r��a)�textrrr��sz0ProfileBrowser.complete_sort.<locals>.<listcomp>)rrZ)rr�rr)r�r�
complete_sort�szProfileBrowser.complete_sortcCs|jd|�S)Nr�)r�)rrVrrr�do_stats�szProfileBrowser.do_statscCstd|jd�|j�dS)Nz.Print statistics from the current stat object.)r)r"rr�)rrrr�
help_stats�szProfileBrowser.help_statscCs$|jr|jj�ntd|jd�dS)NzNo statistics object is loaded.)r)rrmr"r)rrVrrr�do_strip�szProfileBrowser.do_stripcCstd|jd�dS)Nz<Strip leading path information from filenames in the report.)r)r"r)rrrr�
help_strip�szProfileBrowser.help_stripcCstd|jd�dS)NzShow help for a given command.)r)r"r)rrrr�	help_help�szProfileBrowser.help_helpcCs|r|SdS)Nr)r�stoprVrrr�postcmd�szProfileBrowser.postcmd)N)r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�s4
	r�rrRz*Welcome to the profile statistics browser.)rzGoodbye.)"r�rr*r,r(ro�	functoolsr�__all__rrdrjrr5r>r�r�r�r�r��readline�ImportErrorr�r�r�argvZinitprofileZbrowserr�r�r"rZcmdloop�KeyboardInterruptrrrr�<module>sN
asyncore.cpython-36.opt-2.pyc000064400000034454150335715140011773 0ustar003


 \�N�@sdddlZddlZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZee
ee
eeeh�ZyeWnek
r�iZYnXdd�ZGdd�de�ZeeefZdd�Zd	d
�Zdd�Z d
d�Z!d%dd�Z"d&dd�Z#e#Z$d'dd�Z%Gdd�d�Z&Gdd�de&�Z'dd�Z(d(dd�Z)ej*d k�r`Gd!d"�d"�Z+Gd#d$�d$e&�Z,dS))�N)
�EALREADY�EINPROGRESS�EWOULDBLOCK�
ECONNRESET�EINVAL�ENOTCONN�	ESHUTDOWN�EISCONN�EBADF�ECONNABORTED�EPIPE�EAGAIN�	errorcodec
Cs>y
tj|�Stttfk
r8|tkr0t|Sd|SXdS)NzUnknown error %s)�os�strerror�
ValueError�
OverflowError�	NameErrorr)�err�r� /usr/lib64/python3.6/asyncore.py�	_strerrorDs
rc@seZdZdS)�ExitNowN)�__name__�
__module__�__qualname__rrrrrLsrcCs:y|j�Wn(tk
r"�Yn|j�YnXdS)N)�handle_read_event�_reraised_exceptions�handle_error)�objrrr�readQsr cCs:y|j�Wn(tk
r"�Yn|j�YnXdS)N)�handle_write_eventrr)rrrr�writeYsr"cCs:y|j�Wn(tk
r"�Yn|j�YnXdS)N)�handle_expt_eventrr)rrrr�
_exceptionasr$cCs�yX|tj@r|j�|tj@r&|j�|tj@r8|j�|tjtjBtj	B@rV|j
�Wnhtk
r�}z&|jdt
kr�|j�n|j
�WYdd}~Xn(tk
r��Yn|j�YnXdS)Nr)�select�POLLINr�POLLOUTr!�POLLPRIr#ZPOLLHUPZPOLLERRZPOLLNVAL�handle_close�OSError�args�
_DISCONNECTEDrr)r�flags�errr�	readwriteis"



r/�c	CsN|dkrt}|�rJg}g}g}x^t|j��D]N\}}|j�}|j�}|rR|j|�|rh|jrh|j|�|sp|r,|j|�q,Wg|ko�|ko�|knr�tj|�dSt	j	||||�\}}}x(|D] }|j
|�}|dkr�q�t|�q�Wx*|D]"}|j
|�}|dk�rq�t|�q�Wx.|D]&}|j
|�}|dk�r<�q t
|��q WdS)N)�
socket_map�list�items�readable�writable�append�	accepting�timeZsleepr%�getr r"r$)	�timeout�map�r�wr.�fdrZis_rZis_wrrr�poll}sD

"








r?cCs�|dkrt}|dk	r t|d�}tj�}|r�x^t|j��D]N\}}d}|j�r^|tjtjBO}|j	�rx|j
rx|tjO}|r:|j||�q:W|j|�}x.|D]&\}}|j
|�}|dkr�q�t||�q�WdS)Ni�r)r1�intr%r?r2r3r4r&r(r5r7r'�registerr9r/)r:r;Zpollsterr>rr-r<rrr�poll2�s(


rB�>@FcCsj|dkrt}|r ttd�r t}nt}|dkrBx8|r>|||�q.Wn$x"|rd|dkrd|||�|d}qDWdS)Nr?r�)r1�hasattrr%rBr?)r:Zuse_pollr;�countZpoll_funrrr�loop�s
rGc@s6eZdZdZdZdZdZdZdZe	dh�Z
dAdd�Zdd�ZeZ
dBdd	�ZdCd
d�Zejejfdd
�ZdDdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdEd'd(�Z d)d*�Z!d+d,�Z"d-d.�Z#d/d0�Z$d1d2�Z%d3d4�Z&d5d6�Z'd7d8�Z(d9d:�Z)d;d<�Z*d=d>�Z+d?d@�Z,dS)F�
dispatcherFN�warningcCs�|dkrt|_n||_d|_|r�|jd�|j||�d|_y|j�|_Wq�tk
r�}z,|j	dt
tfkrvd|_n|j|��WYdd}~Xq�Xnd|_
dS)NrTF)r1�_map�_fileno�setblocking�
set_socket�	connectedZgetpeername�addrr*r+rr�del_channel�socket)�self�sockr;rrrr�__init__�s 

zdispatcher.__init__cCs�|jjd|jjg}|jr.|jr.|jd�n|jr>|jd�|jdk	r�y|jd|j�Wn$tk
r�|jt|j��YnXddj	|�t
|�fS)N�.Z	listeningrNz%s:%dz<%s at %#x>� )�	__class__rrr7rOr6rN�	TypeError�repr�join�id)rRZstatusrrr�__repr__�s

zdispatcher.__repr__cCs|dkr|j}|||j<dS)N)rJrK)rRr;rrr�add_channelszdispatcher.add_channelcCs,|j}|dkr|j}||kr"||=d|_dS)N)rKrJ)rRr;r>rrrrPszdispatcher.del_channelcCs.||f|_tj||�}|jd�|j|�dS)Nr)Zfamily_and_typerQrLrM)rRZfamily�typerSrrr�
create_sockets

zdispatcher.create_socketcCs||_|j�|_|j|�dS)N)rQ�filenorKr])rRrSr;rrrrM s
zdispatcher.set_socketcCsDy*|jjtjtj|jjtjtj�dB�Wntk
r>YnXdS)NrD)rQZ
setsockopt�
SOL_SOCKETZSO_REUSEADDR�
getsockoptr*)rRrrr�set_reuse_addr&s
zdispatcher.set_reuse_addrcCsdS)NTr)rRrrrr47szdispatcher.readablecCsdS)NTr)rRrrrr5:szdispatcher.writablecCs(d|_tjdkr|dkrd}|jj|�S)NT�nt�)r7r�namerQ�listen)rRZnumrrrrgAszdispatcher.listencCs||_|jj|�S)N)rOrQ�bind)rRrOrrrrhGszdispatcher.bindcCspd|_d|_|jj|�}|tttfks8|tkrBtj	dkrB||_
dS|dtfkr^||_
|j�nt
|t|��dS)NFTrdr)rN�
connectingrQZ
connect_exrrrrrrfrOr	�handle_connect_eventr*r)rRZaddressrrrr�connectKs
zdispatcher.connectcCsny|jj�\}}WnNtk
r&dStk
r`}z |jdtttfkrNdS�WYdd}~Xn
X||fSdS)Nr)rQ�acceptrXr*r+rrr
)rRZconnrO�whyrrrrlYszdispatcher.acceptcCsfy|jj|�}|Stk
r`}z4|jdtkr4dS|jdtkrN|j�dS�WYdd}~XnXdS)Nr)rQ�sendr*r+rr,r))rR�data�resultrmrrrrngszdispatcher.sendcCshy$|jj|�}|s|j�dS|SWn>tk
rb}z"|jdtkrP|j�dS�WYdd}~XnXdS)N�r)rQ�recvr)r*r+r,)rR�buffer_sizerormrrrrrtszdispatcher.recvcCsnd|_d|_d|_|j�|jdk	rjy|jj�Wn6tk
rh}z|jdtt	fkrX�WYdd}~XnXdS)NFr)
rNr7rirPrQ�closer*r+rr
)rRrmrrrrt�s
zdispatcher.closecCstjjdt|��dS)Nzlog: %s
)�sys�stderrr"�str)rR�messagerrr�log�szdispatcher.log�infocCs||jkrtd||f�dS)Nz%s: %s)�ignore_log_types�print)rRrxr^rrr�log_info�s
zdispatcher.log_infocCs:|jr|j�n&|js.|jr$|j�|j�n|j�dS)N)r7�
handle_acceptrNrirj�handle_read)rRrrrr�s

zdispatcher.handle_read_eventcCs@|jjtjtj�}|dkr(t|t|���|j�d|_d|_dS)NrTF)	rQrbra�SO_ERRORr*r�handle_connectrNri)rRrrrrrj�szdispatcher.handle_connect_eventcCs*|jr
dS|js|jr|j�|j�dS)N)r7rNrirj�handle_write)rRrrrr!�szdispatcher.handle_write_eventcCs0|jjtjtj�}|dkr$|j�n|j�dS)Nr)rQrbrar�r)�handle_expt)rRrrrrr#�s
zdispatcher.handle_expt_eventcCsXt�\}}}}yt|�}Wndt|�}YnX|jd||||fd�|j�dS)Nz)<__repr__(self) failed for object at %0x>z:uncaptured python exception, closing channel %s (%s:%s %s)�error)�compact_tracebackrYr[r}r))rRZnil�t�v�tbinfoZ	self_reprrrrr�szdispatcher.handle_errorcCs|jdd�dS)Nz!unhandled incoming priority eventrI)r})rRrrrr��szdispatcher.handle_exptcCs|jdd�dS)Nzunhandled read eventrI)r})rRrrrr�szdispatcher.handle_readcCs|jdd�dS)Nzunhandled write eventrI)r})rRrrrr��szdispatcher.handle_writecCs|jdd�dS)Nzunhandled connect eventrI)r})rRrrrr��szdispatcher.handle_connectcCs|j�}|dk	r|j|�dS)N)rl�handle_accepted)rRZpairrrrr~�szdispatcher.handle_acceptcCs|j�|jdd�dS)Nzunhandled accepted eventrI)rtr})rRrSrOrrrr��szdispatcher.handle_acceptedcCs|jdd�|j�dS)Nzunhandled close eventrI)r}rt)rRrrrr)�szdispatcher.handle_close)NN)N)N)N)rz)-rrr�debugrNr7ri�closingrO�	frozensetr{rTr\�__str__r]rPrQZAF_INETZSOCK_STREAMr_rMrcr4r5rgrhrkrlrnrrrtryr}rrjr!r#rr�rr�r�r~r�r)rrrrrH�sL

 


	


rHc@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�dispatcher_with_sendNcCstj|||�d|_dS)Nrq)rHrT�
out_buffer)rRrSr;rrrrT�szdispatcher_with_send.__init__cCs.d}tj||jdd��}|j|d�|_dS)Nri)rHrnr�)rRZnum_sentrrr�
initiate_sendsz"dispatcher_with_send.initiate_sendcCs|j�dS)N)r�)rRrrrr�sz!dispatcher_with_send.handle_writecCs|jpt|j�S)N)rN�lenr�)rRrrrr5szdispatcher_with_send.writablecCs0|jr|jdt|��|j||_|j�dS)Nz
sending %s)r�r}rYr�r�)rRrorrrrnszdispatcher_with_send.send)NN)rrrrTr�r�r5rnrrrrr��s

r�cCs�tj�\}}}g}|std��x0|rN|j|jjj|jjjt|j	�f�|j
}q W~|d\}}}djdd�|D��}|||f|||fS)Nztraceback does not existrDrVcSsg|]}d|�qS)z
[%s|%s|%s]r)�.0�xrrr�
<listcomp>)sz%compact_traceback.<locals>.<listcomp>���)ru�exc_info�AssertionErrorr6�tb_frame�f_code�co_filename�co_namerw�	tb_lineno�tb_nextrZ)r�r��tbr��fileZfunction�linerzrrrr�s
r�cCs�|dkrt}x~t|j��D]n}y|j�Wqtk
rb}z|jdtkrLn|sR�WYdd}~Xqtk
rv�Yq|s��YqXqW|j�dS)Nr)	r1r2�valuesrtr*r+r
r�clear)r;Z
ignore_allr�rrr�	close_all,s r��posixc@sNeZdZdd�Zdd�Zdd�Zdd�Zdd
d�ZeZeZ	dd
�Z
dd�Zd	S)�file_wrappercCstj|�|_dS)N)r�dupr>)rRr>rrrrTQszfile_wrapper.__init__cCs*|jdkrtjd|t|d�|j�dS)Nrzunclosed file %r)�source)r>�warnings�warn�ResourceWarningrt)rRrrr�__del__Ts
zfile_wrapper.__del__cGstj|jf|��S)N)rr r>)rRr+rrrrrZszfile_wrapper.recvcGstj|jf|��S)N)rr"r>)rRr+rrrrn]szfile_wrapper.sendNcCs*|tjkr|tjkr|rdStd��dS)Nrz-Only asyncore specific behaviour implemented.)rQrar��NotImplementedError)rR�levelZoptnameZbuflenrrrrb`s


zfile_wrapper.getsockoptcCs(|jdkrdS|j}d|_tj|�dS)NrrDr�)r>rrt)rRr>rrrrtks

zfile_wrapper.closecCs|jS)N)r>)rRrrrr`rszfile_wrapper.fileno)N)rrrrTr�rrrnrbr r"rtr`rrrrr�Ls
r�c@seZdZddd�Zdd�ZdS)�file_dispatcherNcCsPtj|d|�d|_y|j�}Wntk
r4YnX|j|�tj|d�dS)NTF)rHrTrNr`�AttributeError�set_filer�set_blocking)rRr>r;rrrrTws
zfile_dispatcher.__init__cCs"t|�|_|jj�|_|j�dS)N)r�rQr`rKr])rRr>rrrr��s
zfile_dispatcher.set_file)N)rrrrTr�rrrrr�us
r�)r0N)r0N)rCFNN)NF)-r%rQrur8r�r�errnorrrrrrrr	r
rrr
rr�r,r1rr�	Exceptionr�KeyboardInterrupt�
SystemExitrr r"r$r/r?rBZpoll3rGrHr�r�r�rfr�r�rrrr�<module>1s@<


'

-
)_compression.cpython-36.opt-2.pyc000064400000007462150335715140012647 0ustar003


 \��@s6ddlZejZGdd�dej�ZGdd�dej�ZdS)�Nc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
BaseStreamcCs|jrtd��dS)NzI/O operation on closed file)�closed�
ValueError)�self�r�$/usr/lib64/python3.6/_compression.py�_check_not_closedszBaseStream._check_not_closedcCs|j�stjd��dS)NzFile not open for reading)�readable�io�UnsupportedOperation)rrrr�_check_can_readszBaseStream._check_can_readcCs|j�stjd��dS)NzFile not open for writing)�writabler
r)rrrr�_check_can_writeszBaseStream._check_can_writecCs(|j�stjd��|j�s$tjd��dS)Nz3Seeking is only supported on files open for readingz3The underlying file object does not support seeking)r	r
r�seekable)rrrr�_check_can_seeks
zBaseStream._check_can_seekN)�__name__�
__module__�__qualname__rrrrrrrrr	srcsheZdZdd�Zffdd�Z�fdd�Zdd�Zd	d
�Zddd
�Zdd�Z	e
jfdd�Zdd�Z
�ZS)�DecompressReadercCsdS)NTr)rrrrr	$szDecompressReader.readablecKs>||_d|_d|_d|_||_||_|jf|j�|_||_dS)NFr����)�_fp�_eof�_pos�_size�_decomp_factory�_decomp_args�
_decompressor�_trailing_error)r�fpZdecomp_factoryZtrailing_errorZdecomp_argsrrr�__init__'szDecompressReader.__init__csd|_t�j�S)N)r�super�close)r)�	__class__rrr";szDecompressReader.closecCs
|jj�S)N)rr)rrrrr?szDecompressReader.seekablecCsPt|��:}|jd��$}|jt|��}||dt|��<WdQRXWdQRXt|�S)N�B)�
memoryview�cast�read�len)r�bZviewZ	byte_view�datarrr�readintoBs$zDecompressReader.readintorcCs�|dkr|j�S|s|jr dSd}x�|jjr�|jjp@|jjt�}|sHP|jf|j	�|_y|jj
||�}Wq�|jk
r�PYq�Xn4|jjr�|jjt�}|s�t
d��nd}|jj
||�}|r&Pq&W|s�d|_|j|_dS|jt|�7_|S)Nr�zACompressed file ended before the end-of-stream marker was reachedT)�readallrr�eofZunused_datarr'�BUFFER_SIZErrZ
decompressrZneeds_input�EOFErrorrrr()r�sizer*Zrawblockrrrr'Hs>


zDecompressReader.readcCs,|jjd�d|_d|_|jf|j�|_dS)NrF)r�seekrrrrr)rrrr�_rewindrszDecompressReader._rewindcCs�|tjkrnV|tjkr"|j|}n@|tjkrT|jdkrHx|jtj�rFq8W|j|}ntdj	|���||jkrv|j
�n
||j8}x0|dkr�|jttj|��}|s�P|t|�8}q�W|jS)NrzInvalid value for whence: {})
r
�SEEK_SET�SEEK_CURr�SEEK_ENDrr'�DEFAULT_BUFFER_SIZEr�formatr3�minr()r�offset�whencer*rrrr2xs&







zDecompressReader.seekcCs|jS)N)r)rrrr�tell�szDecompressReader.tellr)r)rrrr	r r"rr+r'r3r
r4r2r<�
__classcell__rr)r#rr!s
*r)r
r7r/�BufferedIOBaser�	RawIOBaserrrrr�<module>suuid.cpython-36.opt-1.pyc000064400000050514150335715140011110 0ustar003

�\dh�]�@s
dZddlZdZddddg\ZZZZeZe	Z
Gdd	�d	e�Zd
d�Z
dd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdZZy�ddlZddlZddlZdgZejjd�s�ejd�xLeD]DZyej ej!j"e��Z#Wne$k
r�w�YnXe%e#d�r�e#j&ZPq�W[ejd k�r@eej'�j(j)d!�d�d"k�r@dZyej*j+Z#WndZ#YnXe,e#d#e,e#d$d��ZWnYnXd%d&�Z-d'd(�Z.d)d*�Z/da0e.eegZ1e-eeeeegZ2d+d,�Z3da4d9d-d.�Z5d/d0�Z6d1d2�Z7d3d4�Z8ed5�Z9ed6�Z:ed7�Z;ed8�Z<dS):aQUUID objects (universally unique identifiers) according to RFC 4122.

This module provides immutable UUID objects (class UUID) and the functions
uuid1(), uuid3(), uuid4(), uuid5() for generating version 1, 3, 4, and 5
UUIDs as specified in RFC 4122.

If all you want is a unique ID, you should probably call uuid1() or uuid4().
Note that uuid1() may compromise privacy since it creates a UUID containing
the computer's network address.  uuid4() creates a random UUID.

Typical usage:

    >>> import uuid

    # make a UUID based on the host ID and current time
    >>> uuid.uuid1()    # doctest: +SKIP
    UUID('a8098c1a-f86e-11da-bd1a-00112444be1e')

    # make a UUID using an MD5 hash of a namespace UUID and a name
    >>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')
    UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')

    # make a random UUID
    >>> uuid.uuid4()    # doctest: +SKIP
    UUID('16fd2706-8baf-433b-82eb-8c7fada847da')

    # make a UUID using a SHA-1 hash of a namespace UUID and a name
    >>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')
    UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')

    # make a UUID from a string of hex digits (braces and hyphens ignored)
    >>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}')

    # convert a UUID to a string of hex digits in standard form
    >>> str(x)
    '00010203-0405-0607-0809-0a0b0c0d0e0f'

    # get the raw 16 bytes of the UUID
    >>> x.bytes
    b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f'

    # make a UUID from a 16-byte string
    >>> uuid.UUID(bytes=x.bytes)
    UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')
�NzKa-Ping Yee <ping@zesty.ca>zreserved for NCS compatibilityzspecified in RFC 4122z$reserved for Microsoft compatibilityzreserved for future definitionc@seZdZdZd7dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zedd��Zedd��Zedd��Zedd ��Zed!d"��Zed#d$��Zed%d&��Zed'd(��Zed)d*��Zed+d,��Zed-d.��Zed/d0��Zed1d2��Zed3d4��Zed5d6��ZdS)8�UUIDa�Instances of the UUID class represent UUIDs as specified in RFC 4122.
    UUID objects are immutable, hashable, and usable as dictionary keys.
    Converting a UUID to a string with str() yields something in the form
    '12345678-1234-1234-1234-123456789abc'.  The UUID constructor accepts
    five possible forms: a similar string of hexadecimal digits, or a tuple
    of six integer fields (with 32-bit, 16-bit, 16-bit, 8-bit, 8-bit, and
    48-bit values respectively) as an argument named 'fields', or a string
    of 16 bytes (with all the integer fields in big-endian order) as an
    argument named 'bytes', or a string of 16 bytes (with the first three
    fields in little-endian order) as an argument named 'bytes_le', or a
    single 128-bit integer as an argument named 'int'.

    UUIDs have these read-only attributes:

        bytes       the UUID as a 16-byte string (containing the six
                    integer fields in big-endian byte order)

        bytes_le    the UUID as a 16-byte string (with time_low, time_mid,
                    and time_hi_version in little-endian byte order)

        fields      a tuple of the six integer fields of the UUID,
                    which are also available as six individual attributes
                    and two derived attributes:

            time_low                the first 32 bits of the UUID
            time_mid                the next 16 bits of the UUID
            time_hi_version         the next 16 bits of the UUID
            clock_seq_hi_variant    the next 8 bits of the UUID
            clock_seq_low           the next 8 bits of the UUID
            node                    the last 48 bits of the UUID

            time                    the 60-bit timestamp
            clock_seq               the 14-bit sequence number

        hex         the UUID as a 32-character hexadecimal string

        int         the UUID as a 128-bit integer

        urn         the UUID as a URN as specified in RFC 4122

        variant     the UUID variant (one of the constants RESERVED_NCS,
                    RFC_4122, RESERVED_MICROSOFT, or RESERVED_FUTURE)

        version     the UUID version number (1 through 5, meaningful only
                    when the variant is RFC_4122)
    NcCs�|||||gjd�dkr td��|dk	rl|jdd�jdd�}|jd�jdd�}t|�d	krbtd
��t|d�}|dk	r�t|�dkr�td��|d(dd)�|d*d+d,�|d-d.d/�|dd�}|dk	�r�t|�dkr�td��tj|dd�}|dk	�r"t|�dk�r
td��|\}}}	}
}}d|k�o.d0kn�s>td��d|k�oRd1kn�sbtd��d|	k�ovd2kn�s�td��d|
k�o�d3kn�s�td��d|k�o�d4kn�s�td��d|k�o�d5kn�s�td��|
d>|B}
|d>|d>B|	d>B|
d>B|B}|dk	�rTd|k�oDd
d>kn�sTtd ��|dk	�r�d
|k�ord!kn�s�td"��|d7M}|d8O}|d:M}||d&>O}||jd'<dS);amCreate a UUID from either a string of 32 hexadecimal digits,
        a string of 16 bytes as the 'bytes' argument, a string of 16 bytes
        in little-endian order as the 'bytes_le' argument, a tuple of six
        integers (32-bit time_low, 16-bit time_mid, 16-bit time_hi_version,
        8-bit clock_seq_hi_variant, 8-bit clock_seq_low, 48-bit node) as
        the 'fields' argument, or a single 128-bit integer as the 'int'
        argument.  When a string of hex digits is given, curly braces,
        hyphens, and a URN prefix are all optional.  For example, these
        expressions all yield the same UUID:

        UUID('{12345678-1234-5678-1234-567812345678}')
        UUID('12345678123456781234567812345678')
        UUID('urn:uuid:12345678-1234-5678-1234-567812345678')
        UUID(bytes='\x12\x34\x56\x78'*4)
        UUID(bytes_le='\x78\x56\x34\x12\x34\x12\x78\x56' +
                      '\x12\x34\x56\x78\x12\x34\x56\x78')
        UUID(fields=(0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678))
        UUID(int=0x12345678123456781234567812345678)

        Exactly one of 'hex', 'bytes', 'bytes_le', 'fields', or 'int' must
        be given.  The 'version' argument is optional; if given, the resulting
        UUID will have its variant and version set according to RFC 4122,
        overriding the given 'hex', 'bytes', 'bytes_le', 'fields', or 'int'.
        N�zGone of the hex, bytes, bytes_le, fields, or int arguments must be givenzurn:�zuuid:z{}�-� z$badly formed hexadecimal UUID string�z bytes_le is not a 16-char string���zbytes is not a 16-char string�big)�	byteorderzfields is not a 6-tuplerz*field 1 out of range (need a 32-bit value)z*field 2 out of range (need a 16-bit value)z*field 3 out of range (need a 16-bit value)z*field 4 out of range (need an 8-bit value)z*field 5 out of range (need an 8-bit value)�0z*field 6 out of range (need a 48-bit value)�`�P�@�z*int is out of range (need a 128-bit value)�zillegal version numberi�i�i��L�int����rrr�rrlii�rlll����lll����)	�count�	TypeError�replace�strip�len�
ValueError�int_�
from_bytes�__dict__)�self�hex�bytes�bytes_le�fieldsr�version�time_low�time_mid�time_hi_version�clock_seq_hi_variant�
clock_seq_low�node�	clock_seq�r/�/usr/lib64/python3.6/uuid.py�__init__jsZ
6

$
 
z
UUID.__init__cCst|t�r|j|jkStS)N)�
isinstancerr�NotImplemented)r"�otherr/r/r0�__eq__�s
zUUID.__eq__cCst|t�r|j|jkStS)N)r2rrr3)r"r4r/r/r0�__lt__�s
zUUID.__lt__cCst|t�r|j|jkStS)N)r2rrr3)r"r4r/r/r0�__gt__�s
zUUID.__gt__cCst|t�r|j|jkStS)N)r2rrr3)r"r4r/r/r0�__le__�s
zUUID.__le__cCst|t�r|j|jkStS)N)r2rrr3)r"r4r/r/r0�__ge__�s
zUUID.__ge__cCs
t|j�S)N)�hashr)r"r/r/r0�__hash__�sz
UUID.__hash__cCs|jS)N)r)r"r/r/r0�__int__�szUUID.__int__cCsd|jjt|�fS)Nz%s(%r))�	__class__�__name__�str)r"r/r/r0�__repr__�sz
UUID.__repr__cCstd��dS)NzUUID objects are immutable)r)r"�name�valuer/r/r0�__setattr__�szUUID.__setattr__cCsDd|j}d|dd�|dd�|dd�|dd�|dd�fS)Nz%032xz%s-%s-%s-%s-%sr
�r�)r)r"r#r/r/r0�__str__�s
zUUID.__str__cCs|jjdd�S)Nrr)r�to_bytes)r"r/r/r0r$�sz
UUID.bytescCs<|j}|ddd�|ddd	�|d
dd�|dd�S)
Nrrr	r
rrrrrrrr)r$)r"r$r/r/r0r%�s(z
UUID.bytes_lecCs|j|j|j|j|j|jfS)N)r(r)r*r+r,r-)r"r/r/r0r&�szUUID.fieldscCs
|jd?S)Nr)r)r"r/r/r0r(�sz
UUID.time_lowcCs|jd?d@S)Nri��)r)r"r/r/r0r)�sz
UUID.time_midcCs|jd?d@S)Nri��)r)r"r/r/r0r*�szUUID.time_hi_versioncCs|jd?d@S)N�8�)r)r"r/r/r0r+szUUID.clock_seq_hi_variantcCs|jd?d@S)Nr
rI)r)r"r/r/r0r,szUUID.clock_seq_lowcCs|jd@d>|jd>B|jBS)Ni�r
r)r*r)r()r"r/r/r0�time
sz	UUID.timecCs|jd@d>|jBS)N�?r
)r+r,)r"r/r/r0r.szUUID.clock_seqcCs
|jd@S)Nl���)r)r"r/r/r0r-sz	UUID.nodecCs
d|jS)Nz%032x)r)r"r/r/r0r#szUUID.hexcCsdt|�S)Nz	urn:uuid:)r?)r"r/r/r0�urnszUUID.urncCs2|jd@stS|jd@stS|jd@s*tStSdS)Ni�r
i@i lll)r�RESERVED_NCS�RFC_4122�RESERVED_MICROSOFT�RESERVED_FUTURE)r"r/r/r0�variant s


zUUID.variantcCs |jtkrt|jd?d@�SdS)Nr�)rQrNr)r"r/r/r0r'+s
zUUID.version)NNNNNN)r>�
__module__�__qualname__�__doc__r1r5r6r7r8r9r;r<r@rCrF�propertyr$r%r&r(r)r*r+r,rJr.r-r#rLrQr'r/r/r/r0r:s8.
Orc	Gs�ddl}ddl}ddl}|j|�}|dkrP|jjd�}|j||d�}|dkrPdSt|j�}d|d<|j|f||j	|j
|d�}|S)	Nr�/sbin�	/usr/sbin)�path�C�LC_ALL)�stdout�stderr�env)rWrX)�os�shutil�
subprocessZwhich�pathsep�join�dict�environ�Popen�PIPEZDEVNULL)	�command�argsr_r`ra�
executablerYr^�procr/r/r0�_popen1s

rlc
Cs�y�t|f|j���}|sdS|��x�|jD]z}|j�j�j�}xdtt|��D]T}|||krLy*|||�}t|jdd�d�}	|	r�|	SWqLt	t
fk
r�YqLXqLWq*WWdQRXWntk
r�YnXdS)N�:�r)rl�splitr\�lower�rstrip�rangerrrr�
IndexError�OSError)
rhriZhw_identifiersZ	get_indexrk�line�words�i�word�macr/r/r0�	_find_macDs$rzcCs0d}x&d
D]}td||d	d
��}|r
|Sq
WdS)z5Get the hardware address on Unix by running ifconfig.�hwaddr�ether�address:�lladdrr�-a�-avZifconfigcSs|dS)Nrr/)rwr/r/r0�<lambda>bsz#_ifconfig_getnode.<locals>.<lambda>N)r{r|r}r~)rrr�)rz)�keywordsriryr/r/r0�_ifconfig_getnode]s

r�cCs tdddgdd��}|r|SdS)z/Get the hardware address on Unix by running ip.Zip�links
link/ethercSs|dS)Nrr/)rwr/r/r0r�isz_ip_getnode.<locals>.<lambda>N)rz)ryr/r/r0�_ip_getnodefsr�cCs�ddl}ddl}y|j|j��}Wntk
r6dSXtdd|j|�gdd��}|rZ|Stdd|j|�gdd��}|r||Stdd|jd|�gd	d��}|r�|SdS)
z0Get the hardware address on Unix by running arp.rNZarpz-ancSsdS)Nrrr/)rwr/r/r0r�vsz_arp_getnode.<locals>.<lambda>cSs|dS)Nrr/)rwr/r/r0r�{sz(%s)cSs|dS)N�r/)rwr/r/r0r��s)r_�socketZ
gethostbynameZgethostnamertrz�fsencode)r_r�Zip_addrryr/r/r0�_arp_getnodems
r�cCstdddgdd��S)z4Get the hardware address on Unix by running lanscan.Zlanscanz-aislan0cSsdS)Nrr/)rwr/r/r0r��sz"_lanscan_getnode.<locals>.<lambda>)rzr/r/r/r0�_lanscan_getnode�sr�c"Cs�y�tdd�}|sdS|��|jj�j�j�}y|jd�}Wntk
rNdSXxt|jD]j}yL|j�j�}||}t|�dkr�|jd�dkr�t	|j
dd�d	�}|r�|SWqXttfk
r�YqXXqXWWdQRXWntk
r�YnXdS)
z4Get the hardware address on Unix by running netstat.Znetstatz-iaNsAddress�rmrrnr)
rlr\�readlinerqro�indexrrrrrrsrt)rkrvrwrurxryr/r/r0�_netstat_getnode�s,
r�c
Csddl}ddl}ddl}dddg}y:ddl}|jd�}|jjj|d�|jd|j	j
d��WnYnXx�|D]�}y$|j|jj
|d�d	g|jd
d�}Wntk
r�wpYnX|�JxB|jD]8}|jd�dj�j�}	|jd|	�r�t|	jdd�d�Sq�WWdQRXqpWdS)z<Get the hardware address on Windows by running ipconfig.exe.rNrzc:\windows\system32zc:\winnt\system32i,�mbcsZipconfigz/allZoem)r\�encoding�:rz((?:[0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]rrr)r_�rera�ctypes�create_string_buffer�windllZkernel32ZGetSystemDirectoryA�insertrB�decoderfrYrcrgrtr\rorrp�	fullmatchrr)
r_r�ra�dirsr��buffer�dirrkrurBr/r/r0�_ipconfig_getnode�s*


r�cCsddl}ddl}|j�}|j|_|j�|_}|j�|j|�dkrHdS|j	�x�t
|j�D]�}|j�|j
|_t|j|�|_|j|�dkr�q\|j�|j|_t|j|�|_djd�|_|j�|_}|j|�dkr�q\|j	�|jdd�}t|�dkr�q\tj|d�SWdS)ztGet the hardware address on Windows using NetBIOS calls.
    See http://support.microsoft.com/kb/118623 for details.rN�*rr	r)�	win32wnet�netbiosZNCBZNCBENUMZCommandZ	LANA_ENUMZBufferZ_packZNetbiosZ_unpackrrZlengthZResetZNCBRESET�ordZlanaZLana_numZNCBASTAT�ljustZCallnameZADAPTER_STATUSZadapter_addressrrr )r�r�ZncbZadaptersrwZstatusr$r/r/r0�_netbios_getnode�s4r�Zuuid�win�c�uuid_generate_time�darwin�.�	ZUuidCreateSequentialZ
UuidCreatecCs$tjd�}t|�tt|j�d�jS)z.Get the hardware address on Unix using ctypes.r)r$)r�r��_uuid_generate_timer�bytes_�rawr-)�_bufferr/r/r0�_unixdll_getnodes
r�cCs,tjd�}t|�dkr(tt|j�d�jSdS)z1Get the hardware address on Windows using ctypes.rr)r$N)r�r��_UuidCreaterr�r�r-)r�r/r/r0�_windll_getnodes
r�cCsddl}|jd�dBS)zCGet a random node ID, with eighth bit set as suggested by RFC 4122.rNr
l)�random�getrandbits)r�r/r/r0�_random_getnodesr�c
Cs~tdk	rtSddl}|jdkr$t}nt}xP|tgD]B}y
|�aWnw4YnXtdk	r4dtkoldknr4tSq4WdS)a3Get the hardware address as a 48-bit positive integer.

    The first time this runs, it may launch a separate program, which could
    be quite slow.  If all attempts to obtain the hardware address fail, we
    choose a random 48-bit number with its eighth bit set to 1 as recommended
    in RFC 4122.
    NrZwin32rr
l)�_node�sys�platform�_NODE_GETTERS_WIN32�_NODE_GETTERS_UNIXr�)r�Zgetters�getterr/r/r0�getnode&s


 r�cCs�tr>||kodknr>tjd�}t|�tt|j�d�Sddl}t|j�d�}t|d�d}tdk	r~|tkr~td}|a|dkr�ddl	}|j
d	�}|d
@}|d?d@}|d
?d@}	|d@}
|d?d@}|dkr�t�}t|||	||
|fdd�S)aGenerate a UUID from a host ID, sequence number, and the current time.
    If 'node' is not given, getnode() is used to obtain the hardware
    address.  If 'clock_seq' is given, it is used as the sequence number;
    otherwise a random 14-bit sequence number is chosen.Nr)r$rge��A�dl@'Hw�
r�l��ri��r
i�rIr
rK)r&r')r�r�r�rr�r�rJr�_last_timestampr�r�r�)r-r.r�rJZnanosecondsZ	timestampr�r(r)r*r,r+r/r/r0�uuid1Ds,

r�cCs<ddlm}||jt|d�dd�j�}t|dd�dd	�S)
zAGenerate a UUID from the MD5 hash of a namespace UUID and a name.r)�md5zutf-8F)ZusedforsecurityNrr)r$r')�hashlibr�r$�digestr)�	namespacerAr�r�r/r/r0�uuid3gs
r�cCsttjd�dd�S)zGenerate a random UUID.rr)r$r')rr_�urandomr/r/r/r0�uuid4psr�cCs8ddlm}||jt|d��j�}t|dd�dd�S)zCGenerate a UUID from the SHA-1 hash of a namespace UUID and a name.r)�sha1zutf-8Nrr)r$r')r�r�r$r�r)r�rAr�r:r/r/r0�uuid5tsr�z$6ba7b810-9dad-11d1-80b4-00c04fd430c8z$6ba7b811-9dad-11d1-80b4-00c04fd430c8z$6ba7b812-9dad-11d1-80b4-00c04fd430c8z$6ba7b814-9dad-11d1-80b4-00c04fd430c8)NN)=rUr_�
__author__rMrNrOrPrrr$r��objectrrlrzr�r�r�r�r�r�r�r�r�r�Zctypes.utilr�Z	_libnamesr��
startswith�appendZlibnameZCDLL�utilZfind_library�lib�	Exception�hasattrr��uname�releaseror�Zrpcrt4�getattrr�r�r�r�r�r�r�r�r�r�r�r�Z
NAMESPACE_DNSZ
NAMESPACE_URLZ
NAMESPACE_OIDZNAMESPACE_X500r/r/r/r0�<module>-szx	"


	




#	dummy_threading.cpython-36.pyc000064400000002120150335715140012351 0ustar003


 \�
�@sdZddlmZddlZdZdZdZz�dekr:edZdZeded<dekr`edZ	dZed=d	ekrzed	Z
dZed	=ddlZeded
<ed=ed	ed<ed	=ddlTdd
lm
Z
Wder�e	ed<[	[er�e
ed	<[
[er�eed<[ned=[[[XdS)aaFaux ``threading`` version using ``dummy_thread`` instead of ``thread``.

The module ``_dummy_threading`` is added to ``sys.modules`` in order
to not have ``threading`` considered imported.  Had ``threading`` been
directly imported it would have made all subsequent imports succeed
regardless of whether ``_thread`` was available which is not desired.

�)�modulesNF�_threadT�
_dummy_thread�	threadingZ_threading_local�_dummy_threadingZ_dummy__threading_local)�*)�__all__)�__doc__�sysrZsys_modulesrZholding_threadZholding_threadingZholding__threading_localZheld_threadZheld_threadingZheld__threading_localrrr�rr�'/usr/lib64/python3.6/dummy_threading.py�<module>sPpkgutil.cpython-36.opt-1.pyc000064400000037607150335715140011631 0ustar003


 \CS�@sxdZddlmZddlmZddlZddlZddlZddl	Z	ddl
Z	ddlZddlm
Z
ddlZdddd	d
ddd
ddddgZedd�Zde_dd�Zdd�Zd+dd
�Zd,dd�Zed-dd��Zd.dd�Zejejje�dd�ZGd d
�d
�ZGd!d�d�Zy.ddlZdd"lmZd/d#d$�Zejee�Wne k
�r@YnXd%d�Z!d0d&d�Z"d'd�Z#d(d	�Z$d)d�Z%d*d�Z&dS)1zUtilities to support packages.�)�
namedtuple)�singledispatchN)�
ModuleType�get_importer�iter_importers�
get_loader�find_loader�
walk_packages�iter_modules�get_data�ImpImporter�	ImpLoader�	read_code�extend_path�
ModuleInfozmodule_finder name ispkgz.A namedtuple with minimal info about a module.cCsLy
|j}Wn4tk
r>|j|�}|dkr0dStjj||�SX||�SdS)z'Return the finder-specific module spec.N)�	find_spec�AttributeError�find_module�	importlib�util�spec_from_loader)�finder�namer�loader�r�/usr/lib64/python3.6/pkgutil.py�	_get_specs

rcCs6ddl}|jd�}|tjjkr"dS|jd�|j|�S)Nr��)�marshal�readrr�MAGIC_NUMBER�load)�streamr�magicrrrr(s

�c
#s�ifdd��x�t||�D]�}|V|jryt|j�WnNtk
r\|dk	rX||j�Yqtk
r�|dk	r~||j�n�YqXttj|jdd�p�g}�fdd�|D�}t	||jd|�EdHqWdS)a�Yields ModuleInfo for all modules recursively
    on path, or, if path is None, all accessible modules.

    'path' should be either None or a list of paths to look for
    modules in.

    'prefix' is a string to output on the front of every module name
    on output.

    Note that this function must import all *packages* (NOT all
    modules!) on the given path, in order to access the __path__
    attribute to find submodules.

    'onerror' is a function which gets called with one argument (the
    name of the package which was being imported) if any exception
    occurs while trying to import a package.  If no onerror function is
    supplied, ImportErrors are caught and ignored, while all other
    exceptions are propagated, terminating the search.

    Examples:

    # list all modules python can access
    walk_packages()

    # list all submodules of ctypes
    walk_packages(ctypes.__path__, ctypes.__name__+'.')
    cSs||krdSd||<dS)NTr)�p�mrrr�seenRszwalk_packages.<locals>.seenN�__path__csg|]}�|�s|�qSrr)�.0r&)r(rr�
<listcomp>isz!walk_packages.<locals>.<listcomp>�.)
r
�ispkg�
__import__r�ImportError�	Exception�getattr�sys�modulesr	)�path�prefix�onerror�infor)r(rr	5s ccsf|dkrt�}n
tt|�}i}xB|D]:}x4t||�D]&\}}||kr4d||<t|||�Vq4Wq$WdS)aYields ModuleInfo for all submodules on path,
    or, if path is None, all top-level modules on sys.path.

    'path' should be either None or a list of paths to look for
    modules in.

    'prefix' is a string to output on the front of every module name
    on output.
    N�)r�mapr�iter_importer_modulesr)r4r5Z	importers�yielded�irr-rrrr
ns


cCst|d�sgS|j|�S)Nr
)�hasattrr
)�importerr5rrrr:�s
r:ccs0|jdkstjj|j�rdSi}ddl}ytj|j�}Wntk
rRg}YnX|j�x�|D]�}|j|�}|dksb||kr�qbtjj|j|�}d}|o�tjj|�o�d|k�r|}ytj|�}	Wntk
r�g}	YnXx&|	D]}|j|�}
|
dkr�d}Pq�Wqb|rbd|krbd||<|||fVqbWdS)Nr�__init__Fr,Tr8)	r4�os�isdir�inspect�listdir�OSError�sort�
getmodulename�join)r>r5r;rB�	filenames�fn�modnamer4r-�dircontents�subnamerrr�_iter_file_finder_modules�s<





rMc
Cs.tj��tjdt�tjd�aWdQRXdS)N�ignore�imp)�warnings�catch_warnings�simplefilter�DeprecationWarningr�
import_modulerOrrrr�_import_imp�s
rUc@s.eZdZdZd
dd�Zddd�Zddd	�ZdS)
raPEP 302 Finder that wraps Python's "classic" import algorithm

    ImpImporter(dirname) produces a PEP 302 finder that searches that
    directory.  ImpImporter(None) produces a PEP 302 finder that searches
    the current sys.path, plus any modules that are frozen or built-in.

    Note that ImpImporter does not currently support being used by placement
    on sys.meta_path.
    NcCstjdt�t�||_dS)Nz5This emulation is deprecated, use 'importlib' instead)rP�warnrSrUr4)�selfr4rrrr?�szImpImporter.__init__c
Cs~|jd�d}||kr$|jdkr$dS|jdkr4d}ntjj|j�g}ytj||�\}}}Wntk
rndSXt||||�S)Nr,r8���)�splitr4r@�realpathrOrr/r
)rW�fullnamer4rL�file�filename�etcrrrr�s
zImpImporter.find_moduler%ccs0|jdkstjj|j�rdSi}ddl}ytj|j�}Wntk
rRg}YnX|j�x�|D]�}|j|�}|dksb||kr�qbtjj|j|�}d}|o�tjj|�o�d|k�r|}ytj|�}	Wntk
r�g}	YnXx&|	D]}|j|�}
|
dkr�d}Pq�Wqb|rbd|krbd||<|||fVqbWdS)Nrr?Fr,Tr8)	r4r@rArBrCrDrErFrG)rWr5r;rBrHrIrJr4r-rKrLrrrr
�s<





zImpImporter.iter_modules)N)N)r%)�__name__�
__module__�__qualname__�__doc__r?rr
rrrrr�s	

c@sneZdZdZdZZdd�Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zddd�Zddd�Z
dd�Zddd�ZdS)r
zBPEP 302 Loader that wraps Python's "classic" import algorithm
    NcCs.tjdt�t�||_||_||_||_dS)Nz5This emulation is deprecated, use 'importlib' instead)rPrVrSrUr\r]r[r^)rWr[r\r]r^rrrr?szImpLoader.__init__cCs:|j�ztj||j|j|j�}Wd|jr4|jj�X|S)N)�_reopenrO�load_moduler\r]r^�close)rWr[�modrrrrdszImpLoader.load_modulec	Cst|d��
}|j�SQRXdS)N�rb)�openr )rW�pathnamer\rrrr"szImpLoader.get_datacCsT|jrP|jjrP|jd}|tjkr2t|jd�|_n|tjtjfkrPt|jd�|_dS)N��rrg)	r\�closedr^rO�	PY_SOURCErhr]�PY_COMPILED�C_EXTENSION)rW�mod_typerrrrc&s

zImpLoader._reopencCs0|dkr|j}n||jkr,td|j|f��|S)Nz,Loader for module %s cannot handle module %s)r[r/)rWr[rrr�	_fix_name.s
zImpLoader._fix_namecCs|j|�}|jdtjkS)Nrj)rqr^rO�
PKG_DIRECTORY)rWr[rrr�
is_package6s
zImpLoader.is_packagec
Cs�|j|�}|jdkr�|jd}|tjkrD|j|�}t||jd�|_nJ|tjkrv|j	�zt
|j�|_Wd|jj�Xn|tj
kr�|j�j�|_|jS)Nrj�exec)rq�coder^rOrm�
get_source�compiler]rnrcrr\rerr�
_get_delegate�get_code)rWr[rp�sourcerrrry:s






zImpLoader.get_codec
Cs�|j|�}|jdkr�|jd}|tjkrP|j�z|jj�|_Wd|jj�Xnd|tj	kr�t
jj|j
dd��r�t|j
dd�d��}|j�|_WdQRXn|tjkr�|j�j�|_|jS)Nrjr8rkrXrX)rqrzr^rOrmrcr\r rernr@r4�existsr]rhrrrxrv)rWr[rp�frrrrvKs





zImpLoader.get_sourcecCst|j�}t|d�}|jS)Nr?)rr]rr)rWr�specrrrrx]s

zImpLoader._get_delegatecCsH|j|�}|jd}|tjkr*|j�j�S|tjtjtjfkrD|j	SdS)Nrj)
rqr^rOrrrx�get_filenamermrnror])rWr[rprrrr~bs


zImpLoader.get_filename)N)N)N)r_r`rarbrurzr?rdrrcrqrsryrvrxr~rrrrr
	s	

)�zipimporterc	cs�ttj|j�}|j}t|�}i}ddl}x�|D]�}|j|�s@q0||d�jt	j
�}t|�dkr�|djd�r�|d|kr�d||d<||ddfVt|�dkr�q0|j|d�}|dkr�q0|r0d|kr0||kr0d||<||dfVq0WdS)	Nrrjr8z__init__.pyTr?r,F)�sorted�	zipimport�_zip_directory_cache�archiver5�lenrB�
startswithrYr@�seprF)	r>r5Zdirlist�_prefixZplenr;rBrIrJrrr�iter_zipimport_modulesps*

r�cCsnytj|}WnZtk
rhxDtjD]6}y||�}tjj||�PWq&tk
rZYq&Xq&Wd}YnX|S)z�Retrieve a finder for the given path item

    The returned finder is cached in sys.path_importer_cache
    if it was newly created by a path hook.

    The cache (or part of it) can be cleared manually if a
    rescan of sys.path_hooks is necessary.
    N)r2�path_importer_cache�KeyError�
path_hooks�
setdefaultr/)Z	path_itemr>�	path_hookrrrr�s	

ccs�|jd�rdj|�}t|��d|krV|jd�d}tj|�}t|dd�}|dkrhdSntjEdHtj	}x|D]}t
|�VqnWdS)a�Yield finders for the given module name

    If fullname contains a '.', the finders will be for the package
    containing fullname, otherwise they will be all registered top level
    finders (i.e. those on both sys.meta_path and sys.path_hooks).

    If the named module is in a package, that package is imported as a side
    effect of invoking this function.

    If no module name is specified, all top level finders are produced.
    r,z'Relative module name {!r} not supportedrr)N)r��formatr/�
rpartitionrrTr1r2�	meta_pathr4r)r[�msgZpkg_nameZpkgr4�itemrrrr�s



cCsn|tjkr tj|}|dkr dSt|t�rb|}t|dd�}|dk	rF|St|dd�dkrZdS|j}n|}t|�S)z�Get a "loader" object for module_or_name

    Returns None if the module cannot be found or imported.
    If the named module is not already imported, its containing package
    (if any) is imported, in order to establish the package __path__.
    N�
__loader__�__spec__)r2r3�
isinstancerr1r_r)Zmodule_or_name�modulerr[rrrr�s


cCs�|jd�rdj|�}t|��ytjj|�}WnFttttfk
rr}z"d}t|j|t	|�|��|�WYdd}~XnX|dk	r�|j
SdS)z�Find a "loader" object for fullname

    This is a backwards compatibility wrapper around
    importlib.util.find_spec that converts most failures to ImportError
    and only returns the loader rather than the full spec
    r,z'Relative module name {!r} not supportedz,Error while finding loader for {!r} ({}: {})N)r�r�r/rrrr�	TypeError�
ValueError�typer)r[r�r}Zexrrrr�s

*cCs�t|t�s|S|d}|dd�}|jd�\}}}|rbytj|j}Wqhttfk
r^|SXntj}�x:|D�]0}t|t	�s�qpt
|�}|dk	r�g}	t|d�r�|j|�}
|
dk	r�|
j
p�g}	nt|d�r�|j|�\}}	x|	D]}||kr�|j|�q�Wtjj||�}tjj|�rpyt|�}
Wn8tk
�rT}ztjjd||f�WYdd}~XqpX|
�Bx:|
D]2}|jd�}|�sb|jd��r��qb|j|��qbWWdQRXqpW|S)	a�Extend a package's path.

    Intended use is to place the following code in a package's __init__.py:

        from pkgutil import extend_path
        __path__ = extend_path(__path__, __name__)

    This will add to the package's __path__ all subdirectories of
    directories on sys.path named after the package.  This is useful
    if one wants to distribute different parts of a single logical
    package as multiple directories.

    It also looks for *.pkg files beginning where * matches the name
    argument.  This feature is similar to *.pth files (see site.py),
    except that it doesn't special-case lines starting with 'import'.
    A *.pkg file is trusted at face value: apart from checking for
    duplicates, all entries found in a *.pkg file are added to the
    path, regardless of whether they are exist the filesystem.  (This
    is a feature.)

    If the input path is not a list (as is the case for frozen
    packages) it is returned unchanged.  The input path is not
    modified; an extended copy is returned.  Items are only appended
    to the copy at the end.

    It is assumed that sys.path is a sequence.  Items of sys.path that
    are not (unicode or 8-bit) strings referring to existing
    directories are ignored.  Unicode items of sys.path that cause
    errors when used as filenames may cause this function to raise an
    exception (in line with os.path.isdir() behavior).
    z.pkgNr,rrzCan't open %s: %s
�
�#)r��listr�r2r3r)r�rr4�strrr=r�submodule_search_locationsr�appendr@rG�isfilerhrD�stderr�write�rstripr�)r4rZ	sname_pkgZparent_package�_Z
final_nameZsearch_path�dirr�portionsr}ZportionZpkgfiler|r��linerrrr�sP!







cCs�tjj|�}|dkrdS|j}|dks2t|d�r6dStjj|�pLtjj	|�}|dksbt|d�rfdS|j
d�}|jdtj
j|j��tj
j|�}|j|�S)afGet a resource from a package.

    This is a wrapper round the PEP 302 loader get_data API. The package
    argument should be the name of a package, in standard module format
    (foo.bar). The resource argument should be in the form of a relative
    filename, using '/' as the path separator. The parent directory name '..'
    is not allowed, and nor is a rooted name (starting with a '/').

    The function returns a binary string, which is the contents of the
    specified resource.

    For packages located in the filesystem, which have already been imported,
    this is the rough equivalent of

        d = os.path.dirname(sys.modules[package].__file__)
        data = open(os.path.join(d, resource), 'rb').read()

    If the package cannot be located or loaded, or it uses a PEP 302 loader
    which does not support get_data(), then None is returned.
    Nr�__file__�/r)rrrrr=r2r3�get�
_bootstrap�_loadrY�insertr@r4�dirnamer�rGr)�packageZresourcer}rrf�partsZ
resource_namerrrrRs
)Nr%N)Nr%)r%)r%)r%)r%)'rb�collectionsr�	functoolsrZ
simplegenericr�importlib.util�importlib.machineryr@Zos.pathr2�typesrrP�__all__rrrr	r
r:rM�register�	machinery�
FileFinderrUrr
r�rr�r/rrrrrrrrrr�<module>sR

9

(Jc

^sunau.cpython-36.pyc000064400000041054150335715140010335 0ustar003


 \�F�@s�dZddlmZedd�ZdZdZdZdZd	Zd
Z	dZ
dZd
ZdZ
dZdZdZdZeeeee	egZGdd�de�Zdd�Zdd�ZGdd�d�ZGdd�d�Zd dd�ZeZdS)!a�Stuff to parse Sun and NeXT audio files.

An audio file consists of a header followed by the data.  The structure
of the header is as follows.

        +---------------+
        | magic word    |
        +---------------+
        | header size   |
        +---------------+
        | data size     |
        +---------------+
        | encoding      |
        +---------------+
        | sample rate   |
        +---------------+
        | # of channels |
        +---------------+
        | info          |
        |               |
        +---------------+

The magic word consists of the 4 characters '.snd'.  Apart from the
info field, all header fields are 4 bytes in size.  They are all
32-bit unsigned integers encoded in big-endian byte order.

The header size really gives the start of the data.
The data size is the physical size of the data.  From the other
parameters the number of frames can be calculated.
The encoding gives the way in which audio samples are encoded.
Possible values are listed below.
The info field currently consists of an ASCII string giving a
human-readable description of the audio file.  The info field is
padded with NUL bytes to the header size.

Usage.

Reading audio files:
        f = sunau.open(file, 'r')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods read(), seek(), and close().
When the setpos() and rewind() methods are not used, the seek()
method is not  necessary.

This returns an instance of a class with the following public methods:
        getnchannels()  -- returns number of audio channels (1 for
                           mono, 2 for stereo)
        getsampwidth()  -- returns sample width in bytes
        getframerate()  -- returns sampling frequency
        getnframes()    -- returns number of audio frames
        getcomptype()   -- returns compression type ('NONE' or 'ULAW')
        getcompname()   -- returns human-readable version of
                           compression type ('not compressed' matches 'NONE')
        getparams()     -- returns a namedtuple consisting of all of the
                           above in the above order
        getmarkers()    -- returns None (for compatibility with the
                           aifc module)
        getmark(id)     -- raises an error since the mark does not
                           exist (for compatibility with the aifc module)
        readframes(n)   -- returns at most n frames of audio
        rewind()        -- rewind to the beginning of the audio stream
        setpos(pos)     -- seek to the specified position
        tell()          -- return the current position
        close()         -- close the instance (make it unusable)
The position returned by tell() and the position given to setpos()
are compatible and have nothing to do with the actual position in the
file.
The close() method is called automatically when the class instance
is destroyed.

Writing audio files:
        f = sunau.open(file, 'w')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods write(), tell(), seek(), and
close().

This returns an instance of a class with the following public methods:
        setnchannels(n) -- set the number of channels
        setsampwidth(n) -- set the sample width
        setframerate(n) -- set the frame rate
        setnframes(n)   -- set the number of frames
        setcomptype(type, name)
                        -- set the compression type and the
                           human-readable compression type
        setparams(tuple)-- set all parameters at once
        tell()          -- return current position in output file
        writeframesraw(data)
                        -- write audio frames without pathing up the
                           file header
        writeframes(data)
                        -- write audio frames and patch up the file header
        close()         -- patch up the file header and close the
                           output file
You should set the parameters before the first writeframesraw or
writeframes.  The total number of frames does not need to be set,
but when it is set to the correct value, the header does not have to
be patched up.
It is best to first set all parameters, perhaps possibly the
compression type, and then write audio frames using writeframesraw.
When all frames have been written, either call writeframes(b'') or
close() to patch up the sizes in the header.
The close() method is called automatically when the class instance
is destroyed.
�)�
namedtuple�
_sunau_paramsz7nchannels sampwidth framerate nframes comptype compnameidns.������������l��c@seZdZdS)�ErrorN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/sunau.pyr�srcCs<d}x2td�D]&}|jd�}|s$t�|dt|�}qW|S)Nrrr�)�range�read�EOFError�ord)�file�x�iZbyterrr�	_read_u32�s
rcCsJg}x2td�D]&}t|d�\}}|jdt|��|}qW|jt|��dS)Nrrr)r�divmod�insert�int�write�bytes)rr�datar�d�mrrr�
_write_u32�sr'c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)S)*�Au_readcCs@t|�td�kr,ddl}|j|d�}d|_nd|_|j|�dS)N�r�rbTF)�type�builtins�open�_opened�initfp)�self�fr,rrr�__init__�szAu_read.__init__cCs|jr|j�dS)N)�_file�close)r0rrr�__del__�szAu_read.__del__cCs|S)Nr)r0rrr�	__enter__�szAu_read.__enter__cGs|j�dS)N)r4)r0�argsrrr�__exit__�szAu_read.__exit__cCs�||_d|_tt|��}|tkr(td��tt|��|_|jdkrHtd��|jdkrZtd��t|�|_|jtkrzt|j�|_tt|��|_	|j	t
kr�td��|j	ttfkr�d|_
d	|_nj|j	tkr�d	|_|_
nR|j	tkr�d|_|_
n:|j	tkr�d
|_|_
n"|j	tk�rd|_|_
ntd��tt|��|_tt|��|_|j|j|_|jdk�r~|j|jd�|_|jjd
�\|_}}nd|_y|j�|_Wn ttfk
�r�d|_YnXdS)Nrzbad magic numberrzheader size too small�dzheader size ridiculously largezencoding not (yet) supportedrrrrzunknown encoding��)r3�	_soundposr!r�AUDIO_FILE_MAGICrZ	_hdr_size�
_data_size�AUDIO_UNKNOWN_SIZE�	_encoding�_simple_encodings�AUDIO_FILE_ENCODING_MULAW_8�AUDIO_FILE_ENCODING_ALAW_8�
_sampwidth�
_framesize�AUDIO_FILE_ENCODING_LINEAR_8�AUDIO_FILE_ENCODING_LINEAR_16�AUDIO_FILE_ENCODING_LINEAR_24�AUDIO_FILE_ENCODING_LINEAR_32�
_framerate�
_nchannelsr�_info�	partition�tell�	_data_pos�AttributeError�OSError)r0r�magic�_rrrr/�sP







zAu_read.initfpcCs|jS)N)r3)r0rrr�getfp�sz
Au_read.getfpcCs|jS)N)rK)r0rrr�getnchannels�szAu_read.getnchannelscCs|jS)N)rD)r0rrr�getsampwidth�szAu_read.getsampwidthcCs|jS)N)rJ)r0rrr�getframerate�szAu_read.getframeratecCs(|jtkrtS|jtkr$|j|jSdS)Nr)r>r?r@rArE)r0rrr�
getnframes�s


zAu_read.getnframescCs$|jtkrdS|jtkrdSdSdS)N�ULAW�ALAW�NONE)r@rBrC)r0rrr�getcomptype�s


zAu_read.getcomptypecCs$|jtkrdS|jtkrdSdSdS)NzCCITT G.711 u-lawzCCITT G.711 A-lawznot compressed)r@rBrC)r0rrr�getcompname�s


zAu_read.getcompnamecCs*t|j�|j�|j�|j�|j�|j��S)N)rrUrVrWrXr\r])r0rrr�	getparamsszAu_read.getparamscCsdS)Nr)r0rrr�
getmarkersszAu_read.getmarkerscCstd��dS)Nzno marks)r)r0�idrrr�getmarkszAu_read.getmarkcCsp|jtkrl|tkr|jj�}n|jj||j�}|jt|�|j7_|jtkrhddl	}|j
||j�}|SdS)Nr)r@rAr?r3rrEr<�lenrB�audioopZulaw2linrD)r0�nframesr$rcrrr�
readframess

zAu_read.readframescCs*|jdkrtd��|jj|j�d|_dS)Nzcannot seekr)rOrQr3�seekr<)r0rrr�rewinds
zAu_read.rewindcCs|jS)N)r<)r0rrrrNszAu_read.tellcCsP|dks||j�krtd��|jdkr.td��|jj|j||j�||_dS)Nrzposition not in rangezcannot seek)rXrrOrQr3rfrEr<)r0�posrrr�setpos!s
zAu_read.setposcCs"|j}|rd|_|jr|j�dS)N)r3r.r4)r0rrrrr4)s
z
Au_read.closeN)rrrr2r5r6r8r/rTrUrVrWrXr\r]r^r_rarergrNrir4rrrrr(�s(	,
r(c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3S)4�Au_writecCs@t|�td�kr,ddl}|j|d�}d|_nd|_|j|�dS)Nr)r�wbTF)r+r,r-r.r/)r0r1r,rrrr22szAu_write.__init__cCs|jr|j�d|_dS)N)r3r4)r0rrrr5;szAu_write.__del__cCs|S)Nr)r0rrrr6@szAu_write.__enter__cGs|j�dS)N)r4)r0r7rrrr8CszAu_write.__exit__cCsF||_d|_d|_d|_d|_t|_d|_d|_d|_	d|_
d|_dS)Nrr;rY)r3rJrKrDrEr?�_nframes�_nframeswritten�_datawritten�_datalengthrL�	_comptype)r0rrrrr/FszAu_write.initfpcCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerrrz"only 1, 2, or 4 channels supported)rrr)rmrrK)r0�	nchannelsrrr�setnchannelsSs
zAu_write.setnchannelscCs|jstd��|jS)Nznumber of channels not set)rKr)r0rrrrUZszAu_write.getnchannelscCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerrrrzbad sample width)rrrr)rmrrD)r0�	sampwidthrrr�setsampwidth_s
zAu_write.setsampwidthcCs|jstd��|jS)Nzsample width not specified)rJrrD)r0rrrrVfszAu_write.getsampwidthcCs|jrtd��||_dS)Nz0cannot change parameters after starting to write)rmrrJ)r0�	frameraterrr�setframeratekszAu_write.setframeratecCs|jstd��|jS)Nzframe rate not set)rJr)r0rrrrWpszAu_write.getframeratecCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerz# of frames cannot be negative)rmrrl)r0rdrrr�
setnframesus
zAu_write.setnframescCs|jS)N)rm)r0rrrrX|szAu_write.getnframescCs|dkr||_ntd��dS)Nr[rYzunknown compression type)r[rY)rpr)r0r+�namerrr�setcomptypeszAu_write.setcomptypecCs|jS)N)rp)r0rrrr\�szAu_write.getcomptypecCs$|jdkrdS|jdkrdSdSdS)NrYzCCITT G.711 u-lawrZzCCITT G.711 A-lawznot compressed)rp)r0rrrr]�s


zAu_write.getcompnamecCsH|\}}}}}}|j|�|j|�|j|�|j|�|j||�dS)N)rrrtrvrwry)r0ZparamsrqrsrurdZcomptypeZcompnamerrr�	setparams�s



zAu_write.setparamscCs*t|j�|j�|j�|j�|j�|j��S)N)rrUrVrWrXr\r])r0rrrr^�szAu_write.getparamscCs|jS)N)rm)r0rrrrN�sz
Au_write.tellcCs~t|ttf�st|�jd�}|j�|jdkrDddl}|j||j	�}t
|�|j}|jj
|�|j||_|jt
|�|_dS)N�BrYr)�
isinstancer#�	bytearray�
memoryview�cast�_ensure_header_writtenrprcZlin2ulawrDrbrEr3r"rmrn)r0r$rcrdrrr�writeframesraw�s
zAu_write.writeframesrawcCs.|j|�|j|jks"|j|jkr*|j�dS)N)r�rmrlrorn�_patchheader)r0r$rrr�writeframes�s
zAu_write.writeframescCs^|jrZz6|j�|j|jks(|j|jkr0|j�|jj�Wd|j}d|_|jrX|j	�XdS)N)
r3r�rmrlrornr��flushr.r4)r0rrrrr4�szAu_write.closecCs<|js8|jstd��|js"td��|js0td��|j�dS)Nz# of channels not specifiedzsample width not specifiedzframe rate not specified)rmrKrrDrJ�
_write_header)r0rrrr��szAu_write._ensure_header_writtenc
Cs�|jdkrl|jdkr t}d|_q�|jdkr6t}d|_q�|jdkrLt}d|_q�|jdkrbt}d|_q�td��n|jdkr�t}d|_ntd��|j|j	|_t
|jt�dt
|j�}|d	d@}t
|j|�|jtkr�t}n|j|j}y|jj�|_Wn ttfk
�rd|_YnXt
|j|�||_t
|j|�t
|j|j�t
|j|j	�|jj|j�|jjd
|t
|j�d�dS)
Nr[rrrrzinternal errorrYr
r
r:ri����)rprDrFrErGrHrIrrBrKr'r3r=rbrLrlr?rN�_form_length_posrPrQrorJr")r0�encodingZheader_sizeZlengthrrrr��sJ







zAu_write._write_headercCsH|jdkrtd��|jj|j�t|j|j�|j|_|jjdd�dS)Nzcannot seekrr)r�rQr3rfr'rnro)r0rrrr��s
zAu_write._patchheaderN)rrrr2r5r6r8r/rrrUrtrVrvrWrwrXryr\r]rzr^rNr�r�r4r�r�r�rrrrrj0s2	

*rjNcCsJ|dkrt|d�r|j}nd}|dkr.t|�S|dkr>t|�Std��dS)	N�moder*�r�wrkz$mode must be 'r', 'rb', 'w', or 'wb')r�r*)r�rk)�hasattrr�r(rjr)r1r�rrrr-s
r-)N)�__doc__�collectionsrrr=rBrFrGrHrIZAUDIO_FILE_ENCODING_FLOATZAUDIO_FILE_ENCODING_DOUBLEZAUDIO_FILE_ENCODING_ADPCM_G721ZAUDIO_FILE_ENCODING_ADPCM_G722Z AUDIO_FILE_ENCODING_ADPCM_G723_3Z AUDIO_FILE_ENCODING_ADPCM_G723_5rCr?rA�	Exceptionrrr'r(rjr-Zopenfprrrr�<module>hs@	Q

stat.cpython-36.opt-1.pyc000064400000007415150335715140011117 0ustar003


 \��
@s"dZdZdZdZdZdZdZdZdZd	Z	d
Z
dd�Zd
d�ZdZ
dZdZdZdZdZdZdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$Zd%ZeZd&Zd'Zd(Z d)Z!d*Z"d'Z#d(Z$d)Z%d+Z&d,Z'd-Z(d	Z)dZ*dZ+dZ,dZ-dZ.dZ/dZ0d	Z1d-Z2d,Z3dZ4d.Z5d/Z6d0Z7d1Z8d2Z9ed3fed4fed5fe
d6fed7fed8ffe#d9ffe$d:ffe%eBd;fed<fe%d=ffe'd9ffe(d:ffe)eBd;fed<fe)d=ffe+d9ffe,d:ffe-eBd>fed?fe-d=fff
Z:d@dA�Z;d,Z<d$Z=d)Z>d-Z?dZ@dZAdZBd(ZCdZDd/ZEdZFdZGd%ZHd&ZIdZJd'ZKd.ZLyddBlMTWneNk
�rYnXdCS)DzoConstants/functions for interpreting results of os.stat() and os.lstat().

Suggested usage: from stat import *
����������	cCs|d@S)zMReturn the portion of the file's mode that can be set by
    os.chmod().
    i��)�moderr�/usr/lib64/python3.6/stat.py�S_IMODEsrcCs|d@S)zLReturn the portion of the file's mode that describes the
    file type.
    i�r)rrrr
�S_IFMTsri@i i`i�ii�i�cCst|�tkS)z(Return True if mode is from a directory.)r�S_IFDIR)rrrr
�S_ISDIR.srcCst|�tkS)z<Return True if mode is from a character special device file.)r�S_IFCHR)rrrr
�S_ISCHR2srcCst|�tkS)z8Return True if mode is from a block special device file.)r�S_IFBLK)rrrr
�S_ISBLK6srcCst|�tkS)z+Return True if mode is from a regular file.)r�S_IFREG)rrrr
�S_ISREG:srcCst|�tkS)z0Return True if mode is from a FIFO (named pipe).)r�S_IFIFO)rrrr
�S_ISFIFO>srcCst|�tkS)z,Return True if mode is from a symbolic link.)r�S_IFLNK)rrrr
�S_ISLNKBsrcCst|�tkS)z%Return True if mode is from a socket.)r�S_IFSOCK)rrrr
�S_ISSOCKFsriii���@i��8� �iiiii �l�-�b�d�c�p�r�w�s�S�x�t�TcCsPg}x@tD]8}x2|D] \}}||@|kr|j|�PqW|jd�q
Wdj|�S)z;Convert a file's mode to a string of the form '-rwxrwxrwx'.r%�)�_filemode_table�append�join)rZperm�table�bit�charrrr
�filemode�s

r8)�*N)O�__doc__�ST_MODE�ST_INO�ST_DEV�ST_NLINK�ST_UID�ST_GID�ST_SIZE�ST_ATIME�ST_MTIME�ST_CTIMErrrrrrrrrrrrrrrr�S_ISUID�S_ISGID�S_ENFMT�S_ISVTX�S_IREAD�S_IWRITE�S_IEXEC�S_IRWXU�S_IRUSR�S_IWUSR�S_IXUSR�S_IRWXG�S_IRGRP�S_IWGRP�S_IXGRP�S_IRWXO�S_IROTH�S_IWOTH�S_IXOTH�	UF_NODUMP�UF_IMMUTABLE�	UF_APPEND�	UF_OPAQUE�UF_NOUNLINK�
UF_COMPRESSED�	UF_HIDDEN�SF_ARCHIVED�SF_IMMUTABLE�	SF_APPEND�SF_NOUNLINK�SF_SNAPSHOTr2r8�FILE_ATTRIBUTE_ARCHIVE�FILE_ATTRIBUTE_COMPRESSED�FILE_ATTRIBUTE_DEVICE�FILE_ATTRIBUTE_DIRECTORY�FILE_ATTRIBUTE_ENCRYPTED�FILE_ATTRIBUTE_HIDDEN�FILE_ATTRIBUTE_INTEGRITY_STREAM�FILE_ATTRIBUTE_NORMAL�"FILE_ATTRIBUTE_NOT_CONTENT_INDEXED�FILE_ATTRIBUTE_NO_SCRUB_DATA�FILE_ATTRIBUTE_OFFLINE�FILE_ATTRIBUTE_READONLY�FILE_ATTRIBUTE_REPARSE_POINT�FILE_ATTRIBUTE_SPARSE_FILE�FILE_ATTRIBUTE_SYSTEM�FILE_ATTRIBUTE_TEMPORARY�FILE_ATTRIBUTE_VIRTUAL�_stat�ImportErrorrrrr
�<module>s�	


macurl2path.cpython-36.pyc000064400000003515150335715140011424 0ustar003


 \�
�@s8dZddlZddlZddgZdd�Zdd�Zdd�ZdS)	zqMacintosh-specific module for conversion between pathnames and URLs.

Do not import directly; use urllib instead.�N�url2pathname�pathname2urlcCsttjj|�d}|r$|dkr$td��|dd�dkrB|dd�}n|dd�dkrZtd��|jd	�}d}x�|t|�k�r||d
kr�||=qj||dkr�|dkr�||ddkr�||d|d�=|d}qj||d
kr�|dkr�||dd
kr�||=qj|d}qjW|d�s"dj|dd��}nFd}x2|t|�k�rX||dk�rXd
||<|d}�q(Wddj|�}tjj|�S)z{OS-specific conversion from a relative URL of the 'file' scheme
    to a file system path; not recommended for general use.r�filez(Cannot convert non-local URL to pathnameN�z///�z//�/�.�..���:)rr	)�urllib�parseZ	splittype�RuntimeError�split�len�joinZunquote)�pathname�tp�
components�i�rv�r�#/usr/lib64/python3.6/macurl2path.pyr
s6

$
cCs�d|krtd��|jd�}|ddkr,|d=|d	dkr>|d
=x(tt|��D]}||dkrLd||<qLWtt|�}tjj|�r�ddj	|�Sdj	|�SdS)z{OS-specific conversion from a file system path to a relative URL
    of the 'file' scheme; not recommended for general use.rz*Cannot convert pathname containing slashesrrrr
z..N���r)
rr�ranger�map�_pncomp2url�os�path�isabsr)rrrrrrr4s

cCstjj|dd�dd�S)N�r)Zsafe)r
rZquote)Z	componentrrrrKsr)�__doc__Zurllib.parser
r�__all__rrrrrrr�<module>s*optparse.cpython-36.pyc000064400000135670150335715140011047 0ustar003


 \���@s�dZdZdddddddd	d
ddd
dddddgZdZddlZddlZddlZdd�ZyddlmZm	Z	Wn$e
k
r�dd�Zdd�Z	YnXeZGdd
�d
e�Z
Gdd�de
�ZGdd�de�ZGd d�de
�ZGd!d�de
�ZGd"d#�d#e�ZGd$d
�d
�ZGd%d�de�ZGd&d�de�Zd'd(�Zd)d*�Zeed+�feed+�feed,�feed-�fd.�Zd/d0�Zd1d�Zd>ZGd4d�d�Zd?Zd@Z Gd8d�d�Z!Gd9d�d�Z"Gd:d�de"�Z#Gd;d	�d	e"�Z$d<d=�Z%eZ&dS)Aa�A powerful, extensible, and easy-to-use option parser.

By Greg Ward <gward@python.net>

Originally distributed as Optik.

For support, use the optik-users@lists.sourceforge.net mailing list
(http://lists.sourceforge.net/lists/listinfo/optik-users).

Simple usage example:

   from optparse import OptionParser

   parser = OptionParser()
   parser.add_option("-f", "--file", dest="filename",
                     help="write report to FILE", metavar="FILE")
   parser.add_option("-q", "--quiet",
                     action="store_false", dest="verbose", default=True,
                     help="don't print status messages to stdout")

   (options, args) = parser.parse_args()
z1.5.3�Option�make_option�
SUPPRESS_HELP�SUPPRESS_USAGE�Values�OptionContainer�OptionGroup�OptionParser�
HelpFormatter�IndentedHelpFormatter�TitledHelpFormatter�
OptParseError�OptionError�OptionConflictError�OptionValueError�BadOptionError�check_choicea"
Copyright (c) 2001-2006 Gregory P. Ward.  All rights reserved.
Copyright (c) 2002-2006 Python Software Foundation.  All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

  * Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.

  * Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.

  * Neither the name of the author nor the names of its
    contributors may be used to endorse or promote products derived from
    this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
�NcCsd|jjt|�|fS)Nz<%s at 0x%x: %s>)�	__class__�__name__�id)�self�r� /usr/lib64/python3.6/optparse.py�_reprOsr)�gettext�ngettextcCs|S)Nr)�messagerrrr\srcCs|dkr|S|S)N�r)ZsingularZplural�nrrrr_src@seZdZdd�Zdd�ZdS)rcCs
||_dS)N)�msg)rrrrr�__init__hszOptParseError.__init__cCs|jS)N)r)rrrr�__str__kszOptParseError.__str__N)r�
__module__�__qualname__r r!rrrrrgsc@s eZdZdZdd�Zdd�ZdS)r
z]
    Raised if an Option instance is created with invalid or
    inconsistent arguments.
    cCs||_t|�|_dS)N)r�str�	option_id)rr�optionrrrr uszOptionError.__init__cCs |jrd|j|jfS|jSdS)Nz
option %s: %s)r%r)rrrrr!yszOptionError.__str__N)rr"r#�__doc__r r!rrrrr
osc@seZdZdZdS)rzE
    Raised if conflicting options are added to an OptionParser.
    N)rr"r#r'rrrrrsc@seZdZdZdS)rzS
    Raised if an invalid option value is encountered on the command
    line.
    N)rr"r#r'rrrrr�sc@s eZdZdZdd�Zdd�ZdS)rzB
    Raised if an invalid option is seen on the command line.
    cCs
||_dS)N)�opt_str)rr(rrrr �szBadOptionError.__init__cCstd�|jS)Nzno such option: %s)�_r()rrrrr!�szBadOptionError.__str__N)rr"r#r'r r!rrrrr�sc@s eZdZdZdd�Zdd�ZdS)�AmbiguousOptionErrorzD
    Raised if an ambiguous option is seen on the command line.
    cCstj||�||_dS)N)rr �
possibilities)rr(r+rrrr �szAmbiguousOptionError.__init__cCstd�|jdj|j�fS)Nzambiguous option: %s (%s?)z, )r)r(�joinr+)rrrrr!�szAmbiguousOptionError.__str__N)rr"r#r'r r!rrrrr*�sr*c@s�eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!S)"r	a�
    Abstract base class for formatting option help.  OptionParser
    instances should use one of the HelpFormatter subclasses for
    formatting help; by default IndentedHelpFormatter is used.

    Instance attributes:
      parser : OptionParser
        the controlling OptionParser instance
      indent_increment : int
        the number of columns to indent per nesting level
      max_help_position : int
        the maximum starting column for option help text
      help_position : int
        the calculated starting column for option help text;
        initially the same as the maximum
      width : int
        total number of columns for output (pass None to constructor for
        this value to be taken from the $COLUMNS environment variable)
      level : int
        current indentation level
      current_indent : int
        current indentation level (in columns)
      help_width : int
        number of columns available for option help text (calculated)
      default_tag : str
        text to replace with each option's default value, "%default"
        by default.  Set to false value to disable default value expansion.
      option_strings : { Option : str }
        maps Option instances to the snippet of help text explaining
        the syntax of that option, e.g. "-h, --help" or
        "-fFILE, --file=FILE"
      _short_opt_fmt : str
        format string controlling how short options with values are
        printed in help text.  Must be either "%s%s" ("-fFILE") or
        "%s %s" ("-f FILE"), because those are the two syntaxes that
        Optik supports.
      _long_opt_fmt : str
        similar but for long options; must be either "%s %s" ("--file FILE")
        or "%s=%s" ("--file=FILE").
    ZnonecCs�d|_||_|dkrLyttjd�}Wnttfk
rBd}YnX|d8}||_t|t	|d|d��|_
|_d|_d|_
d|_||_d|_i|_d|_d|_dS)	NZCOLUMNS�P��rz%defaultz%s %sz%s=%s)�parser�indent_increment�int�os�environ�KeyError�
ValueError�width�min�max�
help_position�max_help_position�current_indent�level�
help_width�short_first�default_tag�option_strings�_short_opt_fmt�
_long_opt_fmt)rr1r;r7r?rrrr �s$
 zHelpFormatter.__init__cCs
||_dS)N)r0)rr0rrr�
set_parser�szHelpFormatter.set_parsercCs&|dkrtd|��d|d|_dS)N�� z/invalid metavar delimiter for short options: %rz%s)rErF)r6rB)r�delimrrr�set_short_opt_delimiter�s
z%HelpFormatter.set_short_opt_delimitercCs&|dkrtd|��d|d|_dS)N�=rFz.invalid metavar delimiter for long options: %rz%s)rIrF)r6rC)rrGrrr�set_long_opt_delimiter�s
z$HelpFormatter.set_long_opt_delimitercCs"|j|j7_|jd7_dS)Nr)r<r1r=)rrrr�indent�szHelpFormatter.indentcCs4|j|j8_|jdks"td��|jd8_dS)NrzIndent decreased below 0.r)r<r1�AssertionErrorr=)rrrr�dedent�szHelpFormatter.dedentcCstd��dS)Nzsubclasses must implement)�NotImplementedError)r�usagerrr�format_usage�szHelpFormatter.format_usagecCstd��dS)Nzsubclasses must implement)rN)r�headingrrr�format_headingszHelpFormatter.format_headingcCs.t|j|jd�}d|j}tj||||d�S)z�
        Format a paragraph of free-form text for inclusion in the
        help output at the current indentation level.
        �rF)Zinitial_indentZsubsequent_indent)r9r7r<�textwrapZfill)r�textZ
text_widthrKrrr�_format_texts
zHelpFormatter._format_textcCs|r|j|�dSdSdS)N�
rE)rV)r�descriptionrrr�format_descriptionsz HelpFormatter.format_descriptioncCs|rd|j|�dSdSdS)NrWrE)rV)r�epilogrrr�
format_epilogszHelpFormatter.format_epilogcCsR|jdks|jr|jS|jjj|j�}|tks8|dkr>|j}|jj|jt	|��S)N)
r0r@�help�defaults�get�dest�
NO_DEFAULT�NO_DEFAULT_VALUE�replacer$)rr&Z
default_valuerrr�expand_defaultszHelpFormatter.expand_defaultcs�g}�j|}�j�jd}t|�|krBd�jd|f}�j}nd�jd||f}d}|j|�|jr��j|�}tj|�j	�}|jd|d|df�|j
�fdd�|dd�D��n|d
d	kr�|jd	�dj|�S)Nr.z%*s%s
rEz	%*s%-*s  rcsg|]}d�jd|f�qS)z%*s%s
rE)r:)�.0�line)rrr�
<listcomp>Esz/HelpFormatter.format_option.<locals>.<listcomp>rrW���)rAr:r<�len�appendr\rcrTZwrapr>�extendr,)rr&�result�optsZ	opt_widthZindent_firstZ	help_textZ
help_linesr)rr�
format_option(s$



zHelpFormatter.format_optioncCs�|j�d}x6|jD],}|j|�}||j|<t|t|�|j�}qW|j�xF|jD]<}x6|jD],}|j|�}||j|<t|t|�|j�}q`WqTW|j�|j�t	|d|j
�|_t|j|jd�|_
dS)Nrr.rS)rK�option_list�format_option_stringsrAr9rhr<�
option_groupsrMr8r;r:r7r>)rr0Zmax_len�optZstrings�grouprrr�store_option_stringsKs 



z"HelpFormatter.store_option_stringscst|j�rF|jp|jj����fdd�|jD�}��fdd�|jD�}n|j}|j}�jrb||}n||}dj|�S)z@Return a comma-separated list of option strings & metavariables.csg|]}�j|�f�qSr)rB)rdZsopt)�metavarrrrrfasz7HelpFormatter.format_option_strings.<locals>.<listcomp>csg|]}�j|�f�qSr)rC)rdZlopt)rtrrrrfcsz, )�takes_valuertr_�upper�_short_opts�
_long_optsr?r,)rr&Z
short_optsZ	long_optsrlr)rtrrro]s

z#HelpFormatter.format_option_stringsN)rr"r#r'rar rDrHrJrKrMrPrRrVrYr[rcrmrsrorrrrr	�s")
#c@s*eZdZdZddd�Zdd	�Zd
d�ZdS)
r
z.Format help with indented section bodies.
    r.�NrcCstj|||||�dS)N)r	r )rr1r;r7r?rrrr tszIndentedHelpFormatter.__init__cCstd�|S)Nz
Usage: %s
)r))rrOrrrrP|sz"IndentedHelpFormatter.format_usagecCsd|jd|fS)Nz%*s%s:
rE)r<)rrQrrrrRsz$IndentedHelpFormatter.format_heading)r.ryNr)rr"r#r'r rPrRrrrrr
ps
c@s*eZdZdZddd�Zdd�Zd	d
�ZdS)rz1Format help with underlined section headers.
    rryNcCstj|||||�dS)N)r	r )rr1r;r7r?rrrr �szTitledHelpFormatter.__init__cCsd|jtd��|fS)Nz%s  %s
ZUsage)rRr))rrOrrrrP�sz TitledHelpFormatter.format_usagecCsd|d|jt|�fS)Nz%s
%s
z=-)r=rh)rrQrrrrR�sz"TitledHelpFormatter.format_heading)rryNr)rr"r#r'r rPrRrrrrr�s
cCsh|dd�j�dkrd}nD|dd�j�dkrDd}|dd�p@d}n|dd�dkrZd}nd}|||�S)	Nr.Z0x�Z0b�0r��
)�lower)�val�type�radixrrr�
_parse_num�sr�cCs
t|t�S)N)r�r2)rrrr�
_parse_int�sr�Zintegerzfloating-point�complex)r2�long�floatr�cCsFt|j\}}y||�Stk
r@ttd�|||f��YnXdS)Nzoption %s: invalid %s value: %r)�_builtin_cvtr�r6rr))r&rq�valueZcvtZwhatrrr�
check_builtin�sr�cCs:||jkr|Sdjtt|j��}ttd�|||f��dS)Nz, z.option %s: invalid choice: %r (choose from %s))�choicesr,�map�reprrr))r&rqr�r�rrrr�s
�NO�DEFAULTc@s�eZdZdZdddddddd	d
ddd
gZdBZdCZdDZdEZdFZ	dGZ
eeeeed�Z
dZdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�ZeeeeeeegZd4d5�ZeZd6d7�Zd8d9�Zd:d;�Zd<d=�Z d>d?�Z!d@dA�Z"dS)Hrar
    Instance attributes:
      _short_opts : [string]
      _long_opts : [string]

      action : string
      type : string
      dest : string
      default : any
      nargs : int
      const : any
      choices : [string]
      callback : function
      callback_args : (any*)
      callback_kwargs : { string : any }
      help : string
      metavar : string
    �actionr�r_�default�nargs�constr��callback�
callback_args�callback_kwargsr\rt�store�store_const�
store_true�store_falseri�append_const�count�version�stringr2r�r�r��choice)r2r�r�r�r�NcOsFg|_g|_|j|�}|j|�|j|�x|jD]}||�q2WdS)N)rwrx�_check_opt_strings�_set_opt_strings�
_set_attrs�
CHECK_METHODS)rrl�attrs�checkerrrrr 4s


zOption.__init__cCsdd�|D�}|std��|S)NcSsg|]}|r|�qSrr)rdrqrrrrfKsz-Option._check_opt_strings.<locals>.<listcomp>z+at least one option string must be supplied)�	TypeError)rrlrrrr�GszOption._check_opt_stringscCs�x�|D]�}t|�dkr&td||��qt|�dkrf|ddkoH|ddksXtd||��|jj|�q|dd�dko�|ddks�td||��|jj|�qWdS)	Nr.z>invalid option string %r: must be at least two characters longr�-rzMinvalid short option string %r: must be of the form -x, (x any non-dash char)z--zGinvalid long option string %r: must start with --, followed by non-dash)rhr
rwrirx)rrlrqrrrr�Ps$
zOption._set_opt_stringscCszxP|jD]F}||kr,t||||�||=q|dkrBt||t�qt||d�qW|rvt|j��}tddj|�|��dS)Nr�zinvalid keyword arguments: %sz, )�ATTRS�setattrr`�sorted�keysr
r,)rr��attrrrrr�eszOption._set_attrscCs2|jdkrd|_n|j|jkr.td|j|��dS)Nr�zinvalid action: %r)r��ACTIONSr
)rrrr�
_check_actionxs
zOption._check_actioncCs�|jdkr0|j|jkr�|jdk	r(d|_q�d|_n^t|jt�rF|jj|_|jdkrVd|_|j|jkrrtd|j|��|j|jkr�td|j|��dS)Nr�r�r$zinvalid option type: %rz$must not supply a type for action %r)	r�r��ALWAYS_TYPED_ACTIONSr��
isinstancer�TYPESr
�
TYPED_ACTIONS)rrrr�_check_type~s



zOption._check_typecCsr|jdkrT|jdkr td|��qnt|jttf�sntdtt|j��jd�d|��n|jdk	rntd|j|��dS)Nr�z/must supply a list of choices for type 'choice'z1choices must be a list of strings ('%s' supplied)�'rz#must not supply choices for type %r)r�r�r
r��tuple�listr$�split)rrrr�
_check_choice�s


 
zOption._check_choicecCs\|j|jkp|jdk	}|jdkrX|rX|jrH|jddd�jdd�|_n|jdd|_dS)Nrr.r�r)r)r��
STORE_ACTIONSr�r_rxrbrw)rrurrr�_check_dest�s
zOption._check_destcCs*|j|jkr&|jdk	r&td|j|��dS)Nz*'const' must not be supplied for action %r)r��
CONST_ACTIONSr�r
)rrrr�_check_const�szOption._check_constcCs<|j|jkr|jdkr8d|_n|jdk	r8td|j|��dS)Nrz*'nargs' must not be supplied for action %r)r�r�r�r
)rrrr�_check_nargs�s

zOption._check_nargscCs�|jdkrvt|j�s$td|j|��|jdk	rLt|jt�rLtd|j|��|jdk	r�t|jt�r�td|j|��nB|jdk	r�td|j|��|jdk	r�td|��|jdk	r�td|��dS)Nr�zcallback not callable: %rz3callback_args, if supplied, must be a tuple: not %rz4callback_kwargs, if supplied, must be a dict: not %rz.callback supplied (%r) for non-callback optionz.callback_args supplied for non-callback optionz0callback_kwargs supplied for non-callback option)	r��callabler�r
r�r�r�r��dict)rrrr�_check_callback�s0






zOption._check_callbackcCsdj|j|j�S)N�/)r,rwrx)rrrrr!�szOption.__str__cCs
|jdk	S)N)r�)rrrrru�szOption.takes_valuecCs|jr|jdS|jdSdS)Nr)rxrw)rrrr�get_opt_string�s
zOption.get_opt_stringcCs*|jj|j�}|dkr|S||||�SdS)N)�TYPE_CHECKERr^r�)rrqr�r�rrr�check_value�szOption.check_valuecs:|dk	r6�jdkr�j�|�St��fdd�|D��SdS)Nrcsg|]}�j�|��qSr)r�)rd�v)rqrrrrfsz(Option.convert_value.<locals>.<listcomp>)r�r�r�)rrqr�r)rqrr�
convert_values
zOption.convert_valuecCs$|j||�}|j|j|j||||�S)N)r��take_actionr�r_)rrqr��valuesr0rrr�processszOption.processc	Cs:|dkrt|||��n|dkr2t|||j��n|dkrHt||d�n�|dkr^t||d�n�|dkrz|j|g�j|�n�|dkr�|j|g�j|j�n�|d	kr�t|||j|d
�d�n||dkr�|jp�f}|jp�i}|j||||f|�|�nF|d
k�r|j�|j�n*|dk�r(|j	�|j�nt
d|j��dS)Nr�r�r�Tr�Frir�r�rrr�r\r�zunknown action %r)r�r��ensure_valuerir�r�r��
print_help�exit�
print_versionr6r�)	rr�r_rqr�r�r0�args�kwargsrrrr�s4





zOption.take_action)
r�r�r�r�rir�r�r�r\r�)r�r�r�r�rir�r�)r�rir�)r�ri)r�r�)r�r2r�r�r�r�)#rr"r#r'r�r�r�r�r�r�r�r�rr�r�r r�r�r�r�r�r�r�r�r�r�r!r�__repr__rur�r�r�r�r�rrrrr�s�	
		ZSUPPRESSZHELPZUSAGEc@s^eZdZddd�Zdd�ZeZdd�Zdd	�Zd
d�Z	dd
�Z
ddd�Zddd�Zdd�Z
dS)rNcCs*|r&x |j�D]\}}t|||�qWdS)N)�itemsr�)rr]r�rrrrr 9szValues.__init__cCs
t|j�S)N)r$�__dict__)rrrrr!>szValues.__str__cCs2t|t�r|j|jkSt|t�r*|j|kStSdS)N)r�rr�r��NotImplemented)r�otherrrr�__eq__Cs



z
Values.__eq__cCs:x4t|�D](}||kr
||}|dk	r
t|||�q
WdS)z�
        Update the option values from an arbitrary dictionary, but only
        use keys from dict that already have a corresponding attribute
        in self.  Any keys in dict without a corresponding attribute
        are silently ignored.
        N)�dirr�)rr�r�Zdvalrrr�_update_carefulKs
zValues._update_carefulcCs|jj|�dS)z�
        Update the option values from an arbitrary dictionary,
        using all keys from the dictionary regardless of whether
        they have a corresponding attribute in self or not.
        N)r��update)rr�rrr�
_update_looseXszValues._update_loosecCs8|dkr|j|�n |dkr(|j|�ntd|��dS)N�carefulZloosezinvalid update mode: %r)r�r�r6)rr��moderrr�_update`s
zValues._updater�cCs&t|�tj|}|jt|�|�dS)N)�
__import__�sys�modulesr��vars)r�modnamer��modrrr�read_modulehs
zValues.read_modulecCs&i}tt|�j�|�|j||�dS)N)�exec�open�readr�)r�filenamer�r�rrr�	read_filemszValues.read_filecCs0t||�st||�dkr&t|||�t||�S)N)�hasattr�getattrr�)rr�r�rrrr�rszValues.ensure_value)N)r�)r�)rr"r#r r!rr�r�r�r�r�r�r�r�rrrrr7s



c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"S)#ra�
    Abstract base class.

    Class attributes:
      standard_option_list : [Option]
        list of standard options that will be accepted by all instances
        of this parser class (intended to be overridden by subclasses).

    Instance attributes:
      option_list : [Option]
        the list of Option objects contained by this OptionContainer
      _short_opt : { string : Option }
        dictionary mapping short option strings, eg. "-f" or "-X",
        to the Option instances that implement them.  If an Option
        has multiple short option strings, it will appear in this
        dictionary multiple times. [1]
      _long_opt : { string : Option }
        dictionary mapping long option strings, eg. "--file" or
        "--exclude", to the Option instances that implement them.
        Again, a given Option can occur multiple times in this
        dictionary. [1]
      defaults : { string : any }
        dictionary mapping option destination names to default
        values for each destination [1]

    [1] These mappings are common to (shared by) all components of the
        controlling OptionParser, where they are initially created.

    cCs&|j�||_|j|�|j|�dS)N)�_create_option_list�option_class�set_conflict_handler�set_description)rr��conflict_handlerrXrrrr �s
zOptionContainer.__init__cCsi|_i|_i|_dS)N)�
_short_opt�	_long_optr])rrrr�_create_option_mappings�sz'OptionContainer._create_option_mappingscCs|j|_|j|_|j|_dS)N)r�r�r])rr0rrr�_share_option_mappings�sz&OptionContainer._share_option_mappingscCs|dkrtd|��||_dS)N�error�resolvez$invalid conflict_resolution value %r)r�r�)r6r�)r�handlerrrrr��sz$OptionContainer.set_conflict_handlercCs
||_dS)N)rX)rrXrrrr��szOptionContainer.set_descriptioncCs|jS)N)rX)rrrr�get_description�szOptionContainer.get_descriptioncCs|`|`|`dS)zsee OptionParser.destroy().N)r�r�r])rrrr�destroy�szOptionContainer.destroycCs�g}x,|jD]"}||jkr|j||j|f�qWx,|jD]"}||jkr:|j||j|f�q:W|r�|j}|dkr�tddjdd�|D��|��nh|dkr�x^|D]V\}}|jd�r�|jj	|�|j|=n|jj	|�|j|=|jp�|js�|j
jj	|�q�WdS)Nr�z conflicting option string(s): %sz, cSsg|]}|d�qS)rr)rd�corrrrf�sz3OptionContainer._check_conflict.<locals>.<listcomp>r�z--)rwr�rirxr�r�rr,�
startswith�remove�	containerrn)rr&Z
conflict_optsrqr�Zc_optionrrr�_check_conflict�s.



zOptionContainer._check_conflictcOs�t|dt�r|j||�}n:t|�dkrN|rN|d}t|t�sVtd|��ntd��|j|�|jj|�||_	x|j
D]}||j|<qzWx|jD]}||j
|<q�W|jdk	r�|jtk	r�|j|j|j<n|j|jkr�d|j|j<|S)zOadd_option(Option)
           add_option(opt_str, ..., kwarg=val, ...)
        rrznot an Option instance: %rzinvalid argumentsN)r�r$r�rhrr�r�rnrir�rwr�rxr�r_r�r`r])rr�r�r&rqrrr�
add_option�s(



zOptionContainer.add_optioncCsx|D]}|j|�qWdS)N)r�)rrnr&rrr�add_optionss
zOptionContainer.add_optionscCs|jj|�p|jj|�S)N)r�r^r�)rr(rrr�
get_optionszOptionContainer.get_optioncCs||jkp||jkS)N)r�r�)rr(rrr�
has_options
zOptionContainer.has_optioncCsv|jj|�}|dkr |jj|�}|dkr4td|��x|jD]}|j|=q<Wx|jD]}|j|=qTW|jjj|�dS)Nzno such option %r)	r�r^r�r6rwrxr�rnr�)rr(r&rqrrr�
remove_optionszOptionContainer.remove_optioncCsB|js
dSg}x(|jD]}|jtk	r|j|j|��qWdj|�S)NrE)rnr\rrirmr,)r�	formatterrkr&rrr�format_option_helps
z"OptionContainer.format_option_helpcCs|j|j��S)N)rYr�)rrrrrrY(sz"OptionContainer.format_descriptioncCs:g}|jr|j|j|��|jr0|j|j|��dj|�S)NrW)rXrirYrnrr,)rrrkrrr�format_help+szOptionContainer.format_helpN)rr"r#r'r r�r�r�r�r�r�r�r�r�r�rrrrYrrrrrrxs"			c@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rNcCs$||_tj||j|j|�||_dS)N)r0rr r�r��title)rr0rrXrrrr 6szOptionGroup.__init__cCsg|_|j|j�dS)N)rnr�r0)rrrrr�<szOptionGroup._create_option_listcCs
||_dS)N)r)rrrrr�	set_title@szOptionGroup.set_titlecCstj|�|`dS)zsee OptionParser.destroy().N)rr�rn)rrrrr�Cs
zOptionGroup.destroycCs0|j|j�}|j�|tj||�7}|j�|S)N)rRrrKrrrM)rrrkrrrrJs
zOptionGroup.format_help)N)rr"r#r r�rr�rrrrrr4s

c
@sbeZdZdZgZddedddddddf
dd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dPdd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�ZdQd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Z dRd<d=�Z!d>d?�Z"d@dA�Z#dSdBdC�Z$dDdE�Z%dTdFdG�Z&dUdHdI�Z'dJdK�Z(dVdLdM�Z)dWdNdO�Z*dS)Xra$
    Class attributes:
      standard_option_list : [Option]
        list of standard options that will be accepted by all instances
        of this parser class (intended to be overridden by subclasses).

    Instance attributes:
      usage : string
        a usage string for your program.  Before it is displayed
        to the user, "%prog" will be expanded to the name of
        your program (self.prog or os.path.basename(sys.argv[0])).
      prog : string
        the name of the current program (to override
        os.path.basename(sys.argv[0])).
      description : string
        A paragraph of text giving a brief overview of your program.
        optparse reformats this paragraph to fit the current terminal
        width and prints it when the user requests help (after usage,
        but before the list of options).
      epilog : string
        paragraph of help text to print after option help

      option_groups : [OptionGroup]
        list of option groups in this parser (option groups are
        irrelevant for parsing the command-line, but very useful
        for generating help)

      allow_interspersed_args : bool = true
        if true, positional arguments may be interspersed with options.
        Assuming -a and -b each take a single argument, the command-line
          -ablah foo bar -bboo baz
        will be interpreted the same as
          -ablah -bboo -- foo bar baz
        If this flag were false, that command line would be interpreted as
          -ablah -- foo bar -bboo baz
        -- ie. we stop processing options as soon as we see the first
        non-option argument.  (This is the tradition followed by
        Python's getopt module, Perl's Getopt::Std, and other argument-
        parsing libraries, but it is generally annoying to users.)

      process_default_values : bool = true
        if true, option default values are processed similarly to option
        values from the command line: that is, they are passed to the
        type-checking function for the option's type (as long as the
        default value is a string).  (This really only matters if you
        have defined custom types; see SF bug #955889.)  Set it to false
        to restore the behaviour of Optik 1.4.1 and earlier.

      rargs : [string]
        the argument list currently being parsed.  Only set when
        parse_args() is active, and continually trimmed down as
        we consume arguments.  Mainly there for the benefit of
        callback options.
      largs : [string]
        the list of leftover arguments that we have skipped while
        parsing options.  If allow_interspersed_args is false, this
        list is always empty.
      values : Values
        the set of option values currently being accumulated.  Only
        set when parse_args() is active.  Also mainly for callbacks.

    Because of the 'rargs', 'largs', and 'values' attributes,
    OptionParser is not thread-safe.  If, for some perverse reason, you
    need to parse command-line arguments simultaneously in different
    threads, use different OptionParser instances.

    Nr�TcCsrtj||||�|j|�|	|_||_d|_d|_|dkr@t�}||_|jj	|�|
|_
|j||d�|j�dS)NT)�add_help)
rr �	set_usage�progr��allow_interspersed_args�process_default_valuesr
rrDrZ�_populate_option_list�_init_parsing_state)rrOrnr�r�r�rXrZadd_help_optionr	rZrrrr �s
zOptionParser.__init__cCs2tj|�x|jD]}|j�qW|`|`|`dS)a
        Declare that you are done with this OptionParser.  This cleans up
        reference cycles so the OptionParser (and all objects referenced by
        it) can be garbage-collected promptly.  After calling destroy(), the
        OptionParser is unusable.
        N)rr�rprnr)rrrrrrr��s
zOptionParser.destroycCsg|_g|_|j�dS)N)rnrpr�)rrrrr��sz OptionParser._create_option_listcCs|jdddtd�d�dS)Nz-hz--helpr\zshow this help message and exit)r�r\)r�r))rrrr�_add_help_option�szOptionParser._add_help_optioncCs|jddtd�d�dS)Nz	--versionr�z&show program's version number and exit)r�r\)r�r))rrrr�_add_version_option�sz OptionParser._add_version_optioncCs>|jr|j|j�|r |j|�|jr.|j�|r:|j�dS)N)�standard_option_listr�r�rr)rrnrrrrr�s
z"OptionParser._populate_option_listcCsd|_d|_d|_dS)N)�rargs�largsr�)rrrrr
�sz OptionParser._init_parsing_statecCsL|dkrtd�|_n4|tkr$d|_n$|j�jd�rB|dd�|_n||_dS)Nz%prog [options]zusage: �)r)rOrr~r�)rrOrrrr�szOptionParser.set_usagecCs
d|_dS)aSet parsing to not stop on the first non-option, allowing
        interspersing switches with command arguments. This is the
        default behavior. See also disable_interspersed_args() and the
        class documentation description of the attribute
        allow_interspersed_args.TN)r
)rrrr�enable_interspersed_args�sz%OptionParser.enable_interspersed_argscCs
d|_dS)z�Set parsing to stop on the first non-option. Use this if
        you have a command processor which runs another command that
        has options of its own and you want to make sure these options
        don't get confused.
        FN)r
)rrrr�disable_interspersed_argssz&OptionParser.disable_interspersed_argscCs
||_dS)N)r)rr�rrr�set_process_default_valuessz'OptionParser.set_process_default_valuescCs||j|<dS)N)r])rr_r�rrr�set_defaultszOptionParser.set_defaultcKs|jj|�dS)N)r]r�)rr�rrr�set_defaultsszOptionParser.set_defaultscCs.|jdd�}x|jD]}|j|j�qW|S)N)rnrprj)rZoptionsrrrrr�_get_all_optionsszOptionParser._get_all_optionscCsd|jst|j�S|jj�}x@|j�D]4}|j|j�}t|t�r$|j	�}|j
||�||j<q$Wt|�S)N)rrr]�copyrr^r_r�r$r�r�)rr]r&r�r(rrr�get_default_valuess


zOptionParser.get_default_valuescOs|t|dt�r t|f|�|�}nLt|�dkrd|rd|d}t|t�sPtd|��|j|k	rltd��ntd��|jj|�|S)Nrrznot an OptionGroup instance: %rz"invalid OptionGroup (wrong parser)zinvalid arguments)	r�r$rrhr�r0r6rpri)rr�r�rrrrr�add_option_group+s


zOptionParser.add_option_groupcCs0|jj|�p|jj|�}|r,|j|k	r,|jSdS)N)r�r^r�r�)rr(r&rrr�get_option_group;s
zOptionParser.get_option_groupcCs&|dkrtjdd�S|dd�SdS)Nr)r��argv)rr�rrr�	_get_argsEszOptionParser._get_argscCs�|j|�}|dkr|j�}||_g|_}||_y|j|||�}Wn4ttfk
rv}z|jt	|��WYdd}~XnX||}|j
||�S)aR
        parse_args(args : [string] = sys.argv[1:],
                   values : Values = None)
        -> (values : Values, args : [string])

        Parse the command-line options found in 'args' (default:
        sys.argv[1:]).  Any errors result in a call to 'error()', which
        by default prints the usage message to stderr and calls
        sys.exit() with an error message.  On success returns a pair
        (values, args) where 'values' is a Values instance (with all
        your option values) and 'args' is the list of arguments left
        over after parsing options.
        N)rrrrr��
_process_argsrrr�r$�check_values)rr�r�rr�stop�errrrr�
parse_argsKs

 zOptionParser.parse_argscCs||fS)a�
        check_values(values : Values, args : [string])
        -> (values : Values, args : [string])

        Check that the supplied option values and leftover arguments are
        valid.  Returns the option values and leftover arguments
        (possibly adjusted, possibly completely new -- whatever you
        like).  Default implementation just returns the passed-in
        values; subclasses may override as desired.
        r)rr�r�rrrr!rszOptionParser.check_valuescCs�x�|r�|d}|dkr |d=dS|dd�dkr>|j||�q|dd�dkrht|�dkrh|j||�q|jr�|j|�|d=qdSqWdS)a�_process_args(largs : [string],
                         rargs : [string],
                         values : Values)

        Process command-line arguments and populate 'values', consuming
        options and arguments from 'rargs'.  If 'allow_interspersed_args' is
        false, stop at the first non-option argument.  If true, accumulate any
        interspersed non-option arguments in 'largs'.
        rz--Nr.rr�)�_process_long_optrh�_process_short_optsr
ri)rrrr��argrrrr s

zOptionParser._process_argscCst||j�S)a_match_long_opt(opt : string) -> string

        Determine which long option string 'opt' matches, ie. which one
        it is an unambiguous abbreviation for.  Raises BadOptionError if
        'opt' doesn't unambiguously match any long option string.
        )�
_match_abbrevr�)rrqrrr�_match_long_opt�szOptionParser._match_long_optc
Cs�|jd�}d|kr4|jdd�\}}|jd|�d}n|}d}|j|�}|j|}|j�r�|j}t|�|kr�|jt	dd|�||d��q�|dkr�|jd�}	q�t
|d|��}	|d|�=n|r�|jtd	�|�nd}	|j||	||�dS)
NrrIrTFz.%(option)s option requires %(number)d argumentz/%(option)s option requires %(number)d arguments)r&�numberz%s option does not take a value)
�popr��insertr)r�rur�rhr�rr�r)r�)
rrr�r'rqZnext_argZhad_explicit_valuer&r�r�rrrr%�s0


zOptionParser._process_long_optcCs�|jd�}d}d}x�|dd�D]�}d|}|jj|�}|d7}|sLt|��|j�r�|t|�krx|jd||d��d}|j}	t|�|	kr�|jt	dd|	�||	d��q�|	dkr�|jd�}
q�t
|d|	��}
|d|	�=nd}
|j||
||�|r Pq WdS)	NrFrr�Tz.%(option)s option requires %(number)d argumentz/%(option)s option requires %(number)d arguments)r&r*)r+r�r^rrurhr,r�r�rr�r�)rrr�r'r"�iZchrqr&r�r�rrrr&�s6
z OptionParser._process_short_optscCs&|jdkrtjjtjd�S|jSdS)Nr)r	r3�path�basenamer�r)rrrr�
get_prog_names
zOptionParser.get_prog_namecCs|jd|j��S)Nz%prog)rbr0)r�srrr�expand_prog_nameszOptionParser.expand_prog_namecCs|j|j�S)N)r2rX)rrrrr�szOptionParser.get_descriptionrcCs|rtjj|�tj|�dS)N)r��stderr�writer�)rZstatusrrrrr�szOptionParser.exitcCs(|jtj�|jdd|j�|f�dS)z�error(msg : string)

        Print a usage message incorporating 'msg' to stderr and exit.
        If you override this in a subclass, it should not return -- it
        should either exit or raise an exception.
        r.z%s: error: %s
N)�print_usager�r3r�r0)rrrrrr�szOptionParser.errorcCs"|jr|jj|j|j��SdSdS)NrE)rOrrPr2)rrrr�	get_usage#szOptionParser.get_usagecCs|jrt|j�|d�dS)aaprint_usage(file : file = stdout)

        Print the usage message for the current program (self.usage) to
        'file' (default stdout).  Any occurrence of the string "%prog" in
        self.usage is replaced with the name of the current program
        (basename of sys.argv[0]).  Does nothing if self.usage is empty
        or not defined.
        )�fileN)rO�printr6)rr7rrrr5*s	zOptionParser.print_usagecCs|jr|j|j�SdSdS)NrE)r�r2)rrrr�get_version6szOptionParser.get_versioncCs|jrt|j�|d�dS)aEprint_version(file : file = stdout)

        Print the version message for this program (self.version) to
        'file' (default stdout).  As with print_usage(), any occurrence
        of "%prog" in self.version is replaced by the current program's
        name.  Does nothing if self.version is empty or undefined.
        )r7N)r�r8r9)rr7rrrr�<szOptionParser.print_versioncCs�|dkr|j}|j|�g}|j|jtd���|j�|jrZ|jtj||��|jd�x(|j	D]}|j|j
|��|jd�qbW|j�dj|dd��S)NZOptionsrWrErrg)
rrsrirRr)rKrnrrrprrMr,)rrrkrrrrrrGs

zOptionParser.format_option_helpcCs|j|j�S)N)r[rZ)rrrrrr[XszOptionParser.format_epilogcCsn|dkr|j}g}|jr*|j|j�d�|jrD|j|j|�d�|j|j|��|j|j|��dj|�S)NrWrE)	rrOrir6rXrYrr[r,)rrrkrrrr[szOptionParser.format_helpcCs |dkrtj}|j|j��dS)z�print_help(file : file = stdout)

        Print an extended help message, listing all options and any
        help text provided with them, to 'file' (default stdout).
        N)r��stdoutr4r)rr7rrrr�gszOptionParser.print_help)T)NN)rN)N)N)N)N)N)+rr"r#r'rrr r�r�rrrr
rrrrrrrrrrrr$r!r r)r%r&r0r2r�r�r�r6r5r9r�rr[rr�rrrrrRs`D

	

'
3	$)





csZ�|kr�S�fdd�|j�D�}t|�dkr6|dS|sDt���n|j�t�|��dS)z�_match_abbrev(s : string, wordmap : {string : Option}) -> string

    Return the string key in 'wordmap' for which 's' is an unambiguous
    abbreviation.  If 's' is found to be ambiguous or doesn't match any of
    'words', raise BadOptionError.
    csg|]}|j��r|�qSr)r�)rdZword)r1rrrf�sz!_match_abbrev.<locals>.<listcomp>rrN)r�rhr�sortr*)r1Zwordmapr+r)r1rr(ts
r()r�r�ZSUPPRESSHELPZ
SUPPRESSUSAGE)'r'�__version__�__all__Z
__copyright__r�r3rTrrr�ImportErrorr)�	Exceptionrr
rrrr*r	r
rr�r�r�r�r�r�rr`rrrrrrrr(rrrrr�<module>s~ 


P



uA=&fractions.cpython-36.opt-2.pyc000064400000025606150335715140012137 0ustar003


 \W\�@s�ddlmZddlZddlZddlZddlZddlZddgZdd�Zdd�Z	ej
jZej
j
ZejdejejB�ZGd	d�dej�ZdS)
�)�DecimalN�Fraction�gcdcCsfddl}|jdtd�t|�tko0t|�knr\|p<|dkrPtj||�Stj||�St||�S)Nrz6fractions.gcd() is deprecated. Use math.gcd() instead.�)�warnings�warn�DeprecationWarning�type�int�mathr�_gcd)�a�br�r�!/usr/lib64/python3.6/fractions.pyrs cCsx|r|||}}qW|S)Nr)r
rrrrr sraC
    \A\s*                      # optional whitespace at the start, then
    (?P<sign>[-+]?)            # an optional sign, then
    (?=\d|\.\d)                # lookahead for digit or .digit
    (?P<num>\d*)               # numerator (possibly empty)
    (?:                        # followed by
       (?:/(?P<denom>\d+))?    # an optional denominator
    |                          # or
       (?:\.(?P<decimal>\d*))? # an optional fractional part
       (?:E(?P<exp>[-+]?\d+))? # and optional exponent
    )
    \s*\Z                      # and optional whitespace to finish
cs�eZdZdRZdSdd��fdd�Zed	d
��Zedd��ZdTdd�Ze	dd��Z
e	dd��Zdd�Zdd�Z
dd�Zdd�Zeeej�\ZZdd�Zeeej�\ZZdd�Zeeej�\ZZd d!�Zeeej�\ZZd"d#�Z d$d%�Z!d&d'�Z"d(d)�Z#d*d+�Z$d,d-�Z%d.d/�Z&d0d1�Z'd2d3�Z(d4d5�Z)d6d7�Z*d8d9�Z+dUd:d;�Z,d<d=�Z-d>d?�Z.d@dA�Z/dBdC�Z0dDdE�Z1dFdG�Z2dHdI�Z3dJdK�Z4dLdM�Z5dNdO�Z6dPdQ�Z7�Z8S)Vr�
_numerator�_denominatorrNT)�
_normalizecsRtt|�j|�}|dk�rdt|�tkr6||_d|_|St|tj	�rV|j
|_|j|_|St|tt
f�rx|j�\|_|_|St|t��rZtj|�}|dkr�td|��t|jd�p�d�}|jd�}|r�t|�}nvd}|jd�}|�rdt|�}||t|�}||9}|jd�}	|	�rBt|	�}	|	d	k�r4|d|	9}n|d|	9}|jd
�dk�rb|}ntd��nft|�tk�o�t|�kn�r�n@t|tj	��r�t|tj	��r�|j
|j|j
|j}}ntd
��|d	k�r�td|��|�rBt|�tk�ot|�kn�r(tj||�}
|d	k�r2|
}
n
t||�}
||
}||
}||_||_|S)N�z Invalid literal for Fraction: %rZnum�0�denom�decimal�
�exprZsign�-z2argument should be a string or a Rational instancez+both arguments should be Rational instanceszFraction(%s, 0))�superr�__new__r	r
rr�
isinstance�numbers�Rational�	numerator�denominator�floatr�as_integer_ratio�str�_RATIONAL_FORMAT�match�
ValueError�group�len�	TypeError�ZeroDivisionErrorrrr)�clsr r!r�self�mrrZscaler�g)�	__class__rrrTsr







$

$

zFraction.__new__cCsDt|tj�r||�St|t�s8td|j|t|�jf��||j��S)Nz.%s.from_float() only takes floats, not %r (%s))rr�Integralr"r*�__name__r	r#)r,�frrr�
from_float�s
zFraction.from_floatcCsVddlm}t|tj�r&|t|��}n$t||�sJtd|j|t|�jf��||j	��S)Nr)rz2%s.from_decimal() only takes Decimals, not %r (%s))
rrrrr1r
r*r2r	r#)r,Zdecrrrr�from_decimal�s
zFraction.from_decimal�@Bc
Cs�|dkrtd��|j|kr"t|�Sd\}}}}|j|j}}xP||}|||}	|	|kr\P||||||	f\}}}}||||}}q>W|||}
t||
|||
|�}t||�}t||�t||�kr�|S|SdS)Nrz$max_denominator should be at least 1r)rrrr)r'rrr�abs)
r-Zmax_denominatorZp0Zq0Zp1Zq1�n�dr
Zq2�kZbound1Zbound2rrr�limit_denominator�s& 

zFraction.limit_denominatorcCs|jS)N)r)r
rrrr szFraction.numeratorcCs|jS)N)r)r
rrrr!szFraction.denominatorcCsd|jj|j|jfS)Nz
%s(%s, %s))r0r2rr)r-rrr�__repr__szFraction.__repr__cCs(|jdkrt|j�Sd|j|jfSdS)Nrz%s/%s)rr$r)r-rrr�__str__s

zFraction.__str__csT��fdd�}d�jd|_�j|_��fdd�}d�jd|_�j|_||fS)NcsPt|ttf�r�||�St|t�r0�t|�|�St|t�rH�t|�|�StSdS)N)rr
rr"�complex�NotImplemented)r
r)�fallback_operator�monomorphic_operatorrr�forwardvs


z-Fraction._operator_fallbacks.<locals>.forward�__csZt|tj�r�||�St|tj�r4�t|�t|��St|tj�rR�t|�t|��StSdS)N)rrrZRealr"�Complexr>r?)rr
)r@rArr�reverse�s
z-Fraction._operator_fallbacks.<locals>.reverseZ__r)r2�__doc__)rAr@rBrEr)r@rAr�_operator_fallbacks&sP	
zFraction._operator_fallbackscCs,|j|j}}t|j||j|||�S)N)r!rr )r
r�da�dbrrr�_add�sz
Fraction._addcCs,|j|j}}t|j||j|||�S)N)r!rr )r
rrHrIrrr�_sub�sz
Fraction._subcCst|j|j|j|j�S)N)rr r!)r
rrrr�_mul�sz
Fraction._mulcCst|j|j|j|j�S)N)rr r!)r
rrrr�_div�sz
Fraction._divcCstj||�S)N)r�floor)r
rrrr�__floordiv__�szFraction.__floordiv__cCstj||�S)N)rrN)rr
rrr�
__rfloordiv__�szFraction.__rfloordiv__cCs||}|||S)Nr)r
r�divrrr�__mod__�szFraction.__mod__cCs||}|||S)Nr)rr
rQrrr�__rmod__�szFraction.__rmod__cCs�t|tj�r�|jdkr�|j}|dkr>t|j||j|dd�S|jdkrft|j||j|dd�St|j||j|dd�Sq�t|�t|�Snt|�|SdS)NrrF)r)	rrrr!r rrrr")r
rZpowerrrr�__pow__�s 




zFraction.__pow__cCs\|jdkr|jdkr||jSt|tj�r<t|j|j�|S|jdkrP||jS|t|�S)Nrr)	rrrrrrr r!r")rr
rrr�__rpow__�s


zFraction.__rpow__cCst|j|jdd�S)NF)r)rrr)r
rrr�__pos__�szFraction.__pos__cCst|j|jdd�S)NF)r)rrr)r
rrr�__neg__�szFraction.__neg__cCstt|j�|jdd�S)NF)r)rr7rr)r
rrr�__abs__�szFraction.__abs__cCs*|jdkr|j|jS|j|jSdS)Nr)rr)r
rrr�	__trunc__�s
zFraction.__trunc__cCs|j|jS)N)r r!)r
rrr�	__floor__�szFraction.__floor__cCs|j|jS)N)r r!)r
rrr�__ceil__szFraction.__ceil__cCs�|dkrZt|j|j�\}}|d|jkr,|S|d|jkrB|dS|ddkrR|S|dSdt|�}|dkr�tt||�|�Stt||�|�SdS)Nrrrr)�divmodr r!r7r�round)r-ZndigitsrNZ	remainderZshiftrrr�	__round__szFraction.__round__cCsPt|jtdt�}|st}nt|j�|t}|dkr:|n|}|dkrLdS|S)Nrrr������)�powr�_PyHASH_MODULUS�_PyHASH_INFr7r)r-ZdinvZhash_�resultrrr�__hash__!szFraction.__hash__cCs�t|�tkr |j|ko|jdkSt|tj�rD|j|jkoB|j|jkSt|tj	�r`|j
dkr`|j}t|t�r�t
j|�s~t
j|�r�d|kS||j|�kSntSdS)Nrrg)r	r
rrrrrr r!rD�imag�realr"r�isnan�isinfr4r?)r
rrrr�__eq__7s
zFraction.__eq__cCsht|tj�r&||j|j|j|j�St|t�r`tj	|�sDtj
|�rN|d|�S|||j|��SntSdS)Ng)
rrrrr!rr r"rrhrir4r?)r-�other�oprrr�_richcmpLs

zFraction._richcmpcCs|j|tj�S)N)rm�operator�lt)r
rrrr�__lt__bszFraction.__lt__cCs|j|tj�S)N)rmrn�gt)r
rrrr�__gt__fszFraction.__gt__cCs|j|tj�S)N)rmrn�le)r
rrrr�__le__jszFraction.__le__cCs|j|tj�S)N)rmrn�ge)r
rrrr�__ge__nszFraction.__ge__cCs
|jdkS)Nr)r)r
rrr�__bool__rszFraction.__bool__cCs|jt|�ffS)N)r0r$)r-rrr�
__reduce__xszFraction.__reduce__cCs t|�tkr|S|j|j|j�S)N)r	rr0rr)r-rrr�__copy__{szFraction.__copy__cCs t|�tkr|S|j|j|j�S)N)r	rr0rr)r-�memorrr�__deepcopy__�szFraction.__deepcopy__)rr)rN)r6)N)9r2�
__module__�__qualname__�	__slots__r�classmethodr4r5r;�propertyr r!r<r=rGrJrn�add�__add__�__radd__rK�sub�__sub__�__rsub__rL�mul�__mul__�__rmul__rM�truediv�__truediv__�__rtruediv__rOrPrRrSrTrUrVrWrXrYrZr[r^rerjrmrprrrtrvrwrxryr{�
__classcell__rr)r0rr<sTm
7k
)rrrrrn�re�sys�__all__rr�	hash_info�modulusrb�infrc�compile�VERBOSE�
IGNORECASEr%rrrrrr�<module>sheapq.cpython-36.pyc000064400000033726150335715140010307 0ustar003


 \�Y�#@sZdZdZdddddddd	gZd
d�Zdd�Zdd�Zd
d	�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zddd�d d�Zd)d!d�Zd*d"d�Zyd#d$lTWnek
r�YnXyd#d%lm	Z	Wnek
r�YnXyd#d&lm
Z
Wnek
�rYnXyd#d'lmZWnek
�r6YnXed(k�rVd#dlZeej��dS)+a�Heap queue algorithm (a.k.a. priority queue).

Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0.  For the sake of comparison,
non-existing elements are considered to be infinite.  The interesting
property of a heap is that a[0] is always its smallest element.

Usage:

heap = []            # creates an empty heap
heappush(heap, item) # pushes a new item on the heap
item = heappop(heap) # pops the smallest item from the heap
item = heap[0]       # smallest item on the heap without popping it
heapify(x)           # transforms list into a heap, in-place, in linear time
item = heapreplace(heap, item) # pops and returns smallest item, and adds
                               # new item; the heap size is unchanged

Our API differs from textbook heap algorithms as follows:

- We use 0-based indexing.  This makes the relationship between the
  index for a node and the indexes for its children slightly less
  obvious, but is more suitable since Python uses 0-based indexing.

- Our heappop() method returns the smallest item, not the largest.

These two make it possible to view the heap as a regular Python list
without surprises: heap[0] is the smallest item, and heap.sort()
maintains the heap invariant!
uoHeap queues

[explanation by François Pinard]

Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0.  For the sake of comparison,
non-existing elements are considered to be infinite.  The interesting
property of a heap is that a[0] is always its smallest element.

The strange invariant above is meant to be an efficient memory
representation for a tournament.  The numbers below are `k', not a[k]:

                                   0

                  1                                 2

          3               4                5               6

      7       8       9       10      11      12      13      14

    15 16   17 18   19 20   21 22   23 24   25 26   27 28   29 30


In the tree above, each cell `k' is topping `2*k+1' and `2*k+2'.  In
a usual binary tournament we see in sports, each cell is the winner
over the two cells it tops, and we can trace the winner down the tree
to see all opponents s/he had.  However, in many computer applications
of such tournaments, we do not need to trace the history of a winner.
To be more memory efficient, when a winner is promoted, we try to
replace it by something else at a lower level, and the rule becomes
that a cell and the two cells it tops contain three different items,
but the top cell "wins" over the two topped cells.

If this heap invariant is protected at all time, index 0 is clearly
the overall winner.  The simplest algorithmic way to remove it and
find the "next" winner is to move some loser (let's say cell 30 in the
diagram above) into the 0 position, and then percolate this new 0 down
the tree, exchanging values, until the invariant is re-established.
This is clearly logarithmic on the total number of items in the tree.
By iterating over all items, you get an O(n ln n) sort.

A nice feature of this sort is that you can efficiently insert new
items while the sort is going on, provided that the inserted items are
not "better" than the last 0'th element you extracted.  This is
especially useful in simulation contexts, where the tree holds all
incoming events, and the "win" condition means the smallest scheduled
time.  When an event schedule other events for execution, they are
scheduled into the future, so they can easily go into the heap.  So, a
heap is a good structure for implementing schedulers (this is what I
used for my MIDI sequencer :-).

Various structures for implementing schedulers have been extensively
studied, and heaps are good for this, as they are reasonably speedy,
the speed is almost constant, and the worst case is not much different
than the average case.  However, there are other representations which
are more efficient overall, yet the worst cases might be terrible.

Heaps are also very useful in big disk sorts.  You most probably all
know that a big sort implies producing "runs" (which are pre-sorted
sequences, which size is usually related to the amount of CPU memory),
followed by a merging passes for these runs, which merging is often
very cleverly organised[1].  It is very important that the initial
sort produces the longest runs possible.  Tournaments are a good way
to that.  If, using all the memory available to hold a tournament, you
replace and percolate items that happen to fit the current run, you'll
produce runs which are twice the size of the memory for random input,
and much better for input fuzzily ordered.

Moreover, if you output the 0'th item on disk and get an input which
may not fit in the current tournament (because the value "wins" over
the last output value), it cannot fit in the heap, so the size of the
heap decreases.  The freed memory could be cleverly reused immediately
for progressively building a second heap, which grows at exactly the
same rate the first heap is melting.  When the first heap completely
vanishes, you switch heaps and start a new run.  Clever and quite
effective!

In a word, heaps are useful memory structures to know.  I use them in
a few applications, and I think it is good to keep a `heap' module
around. :-)

--------------------
[1] The disk balancing algorithms which are current, nowadays, are
more annoying than clever, and this is a consequence of the seeking
capabilities of the disks.  On devices which cannot seek, like big
tape drives, the story was quite different, and one had to be very
clever to ensure (far in advance) that each tape movement will be the
most effective possible (that is, will best participate at
"progressing" the merge).  Some tapes were even able to read
backwards, and this was also used to avoid the rewinding time.
Believe me, real good tape sorts were quite spectacular to watch!
From all times, sorting has always been a Great Art! :-)
�heappush�heappop�heapify�heapreplace�merge�nlargest�	nsmallest�heappushpopcCs"|j|�t|dt|�d�dS)z4Push item onto heap, maintaining the heap invariant.��N)�append�	_siftdown�len)�heap�item�r�/usr/lib64/python3.6/heapq.pyr�s
cCs.|j�}|r*|d}||d<t|d�|S|S)zCPop the smallest item off the heap, maintaining the heap invariant.r	)�pop�_siftup)r�lastelt�
returnitemrrrr�s
cCs|d}||d<t|d�|S)a�Pop and return the current smallest value, and add the new item.

    This is more efficient than heappop() followed by heappush(), and can be
    more appropriate when using a fixed-size heap.  Note that the value
    returned may be larger than item!  That constrains reasonable uses of
    this routine unless written as part of a conditional replacement:

        if item > heap[0]:
            item = heapreplace(heap, item)
    r	)r)rrrrrrr�s
cCs0|r,|d|kr,|d|}|d<t|d�|S)z1Fast version of a heappush followed by a heappop.r	)r)rrrrrr�s
cCs0t|�}x"tt|d��D]}t||�qWdS)z8Transform list into a heap, in-place, in O(len(x)) time.�N)r
�reversed�ranger)�x�n�irrrr�scCs.|j�}|r*|d}||d<t|d�|S|S)zMaxheap version of a heappop.r	)r�_siftup_max)rrrrrr�_heappop_max�s
rcCs|d}||d<t|d�|S)z4Maxheap version of a heappop followed by a heappush.r	)r)rrrrrr�_heapreplace_max�s
rcCs0t|�}x"tt|d��D]}t||�qWdS)z;Transform list into a maxheap, in-place, in O(len(x)) time.rN)r
rrr)rrrrrr�_heapify_max�srcCsN||}x8||kr@|dd?}||}||kr<|||<|}q
Pq
W|||<dS)Nr
r)r�startpos�pos�newitem�	parentpos�parentrrrr�s
rcCs�t|�}|}||}d|d}xN||krn|d}||krP||||krP|}||||<|}d|d}q"W|||<t|||�dS)Nrr
)r
r)rr!�endposr r"�childpos�rightposrrrrs
rcCsN||}x8||kr@|dd?}||}||kr<|||<|}q
Pq
W|||<dS)zMaxheap variant of _siftdownr
Nr)rr r!r"r#r$rrr�
_siftdown_maxs
r(cCs�t|�}|}||}d|d}xN||krn|d}||krP||||krP|}||||<|}d|d}q"W|||<t|||�dS)zMaxheap variant of _siftuprr
N)r
r()rr!r%r r"r&r'rrrr%s
rNF)�key�reversecgs4g}|j}|r t}t}t}d}nt}t}t}d}|dk�r"xNttt	|��D]<\}	}
y|
j
}||�|	||g�WqJtk
r�YqJXqJW||�xdt|�dkr�y6x0|d\}}	}}
|V|�|
d<|||
�q�WWq�tk
r�||�Yq�Xq�W|�r|d\}}	}|V|j
EdHdSx\ttt	|��D]J\}	}
y(|
j
}|�}|||�|	|||g�Wntk
�rxYnX�q2W||�x~t|�dk�ryJxD|d\}}	}}}
|V|�}||�|
d<||
d<|||
��q�WWntk
�r||�YnX�q�W|�r0|d\}}	}}|V|j
EdHdS)akMerge multiple sorted inputs into a single sorted output.

    Similar to sorted(itertools.chain(*iterables)) but returns a generator,
    does not pull the data into memory all at once, and assumes that each of
    the input streams is already sorted (smallest to largest).

    >>> list(merge([1,3,5,7], [0,2,4,8], [5,10,15,20], [], [25]))
    [0, 1, 2, 3, 4, 5, 5, 7, 8, 10, 15, 20, 25]

    If *key* is not None, applies a key function to each element to determine
    its sort order.

    >>> list(merge(['dog', 'horse'], ['cat', 'fish', 'kangaroo'], key=len))
    ['dog', 'cat', 'fish', 'horse', 'kangaroo']

    r
Nr	r���)rrrrrrr�	enumerate�map�iter�__next__�
StopIterationr
�__self__)r)r*�	iterables�h�h_append�_heapify�_heappop�_heapreplace�	direction�order�it�next�value�s�	key_valuerrrr:sp


cs�|dkrLt|�}t�}�dkr,t||d�}nt||�d�}||krFgS|gSyt|�}Wnttfk
rpYnX||kr�t|�d�d|�S�dk�r*t|�}dd�tt|�|�D�}|s�|St	|�|dd}|}t
}	x6|D].}
|
|kr�|	||
|f�|dd}|d7}q�W|j�d	d�|D�St|�}�fd
d�tt|�|�D�}|�sX|St	|�|dd}|}t
}	xD|D]<}
�|
�}||k�rz|	||||
f�|dd}|d7}�qzW|j�dd�|D�S)zbFind the n smallest elements in a dataset.

    Equivalent to:  sorted(iterable, key=key)[:n]
    r
N)�default)r?r))r)cSsg|]\}}||f�qSrr)�.0r�elemrrr�
<listcomp>�sznsmallest.<locals>.<listcomp>r	cSsg|]}|d�qS)r	r)r@�rrrrrB�scsg|]\}}�|�||f�qSrr)r@rrA)r)rrrB�scSsg|]}|d�qS)rr)r@rCrrrrB
s)r.�object�minr
�	TypeError�AttributeError�sorted�ziprrr�sort)r�iterabler)r:�sentinel�result�size�topr9r7rA�kr)r)rr�sZ



cs�|dkrLt|�}t�}�dkr,t||d�}nt||�d�}||krFgS|gSyt|�}Wnttfk
rpYn X||kr�t|�dd�d|�S�dk�r8t|�}dd�ttd	|d�|�D�}|s�|St	|�|d	d	}|}t
}	x6|D].}
||
kr�|	||
|f�|d	d	}|d8}q�W|jdd
�dd�|D�St|�}�fdd�ttd	|d�|�D�}|�sl|St	|�|d	d	}|}t
}	xD|D]<}
�|
�}||k�r�|	||||
f�|d	d	}|d8}�q�W|jdd
�d
d�|D�S)zoFind the n largest elements in a dataset.

    Equivalent to:  sorted(iterable, key=key, reverse=True)[:n]
    r
N)r?)r?r)T)r)r*cSsg|]\}}||f�qSrr)r@rrArrrrB(sznlargest.<locals>.<listcomp>r	)r*cSsg|]}|d�qS)r	r)r@rCrrrrB5scsg|]\}}�|�||f�qSrr)r@rrA)r)rrrB9scSsg|]}|d�qS)rr)r@rCrrrrBGsr+r+)r.rD�maxr
rFrGrHrIrrrrJ)rrKr)r:rLrMrNrOr9r7rArPr)r)rrsZ

"

r	)�*)r)r)r�__main__)N)N)�__doc__�	__about__�__all__rrrrrrrrrrr(rrrr�_heapq�ImportError�__name__Zdoctest�printZtestmodrrrr�<module>sL`



	5
?
>
csv.cpython-36.opt-1.pyc000064400000027121150335715140010733 0ustar003


 \4?�@sLdZddlZddlmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZddlmZddlmZddlmZddd	d
ddd
ddddddddddddddgZGdd�d�ZGdd�de�Zede�Gdd�de�Zede�Gd d�de�Zed!e�Gd"d�d�ZGd#d�d�ZyeWnek
�r8eZYnXGd$d�d�ZdS)%z+
csv.py - read/write/investigate CSV files
�N)�Error�__version__�writer�reader�register_dialect�unregister_dialect�get_dialect�
list_dialects�field_size_limit�
QUOTE_MINIMAL�	QUOTE_ALL�QUOTE_NONNUMERIC�
QUOTE_NONE�__doc__)�Dialect)�OrderedDict)�StringIOrrr
rrrr�excel�	excel_tabr
rrrrr	�Snifferrr�
DictReader�
DictWriter�unix_dialectc@sDeZdZdZdZdZdZdZdZdZ	dZ
dZdZdd�Z
dd�ZdS)	rz�Describe a CSV dialect.

    This must be subclassed (see csv.excel).  Valid attributes are:
    delimiter, quotechar, escapechar, doublequote, skipinitialspace,
    lineterminator, quoting.

    �FNcCs|jtkrd|_|j�dS)NT)�	__class__r�_valid�	_validate)�self�r�/usr/lib64/python3.6/csv.py�__init__+s
zDialect.__init__cCs@yt|�Wn.tk
r:}ztt|���WYdd}~XnXdS)N)�_Dialect�	TypeErrorr�str)r�errrr0szDialect._validate)�__name__�
__module__�__qualname__r�_namer�	delimiter�	quotecharZ
escapechar�doublequote�skipinitialspace�lineterminator�quotingr rrrrrrsc@s(eZdZdZdZdZdZdZdZe	Z
dS)rz;Describe the usual properties of Excel-generated CSV files.�,�"TFz
N)r%r&r'rr)r*r+r,r-rr.rrrrr7sc@seZdZdZdZdS)rzEDescribe the usual properties of Excel-generated TAB-delimited files.�	N)r%r&r'rr)rrrrrAsz	excel-tabc@s(eZdZdZdZdZdZdZdZe	Z
dS)rz:Describe the usual properties of Unix-generated CSV files.r/r0TF�
N)r%r&r'rr)r*r+r,r-rr.rrrrrFsZunixc@s@eZdZddd�Zdd�Zedd��Zejd	d��Zd
d�ZdS)
rNrcOs6||_||_||_t||f|�|�|_||_d|_dS)Nr)�_fieldnames�restkey�restvalr�dialect�line_num)r�f�
fieldnamesr4r5r6�args�kwdsrrrr RszDictReader.__init__cCs|S)Nr)rrrr�__iter__[szDictReader.__iter__cCs@|jdkr0yt|j�|_Wntk
r.YnX|jj|_|jS)N)r3�nextr�
StopIterationr7)rrrrr9^s

zDictReader.fieldnamescCs
||_dS)N)r3)r�valuerrrr9hscCs�|jdkr|jt|j�}|jj|_x|gkr:t|j�}q&Wtt|j|��}t|j�}t|�}||krz||d�||j<n*||kr�x |j|d�D]}|j||<q�W|S)Nr)	r7r9r=rr�zip�lenr4r5)r�row�dZlfZlr�keyrrr�__next__ls




zDictReader.__next__)NNNr)	r%r&r'r r<�propertyr9�setterrErrrrrQs

c@s6eZdZddd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)rr�raisercOsB||_||_|j�dkr$td|��||_t||f|�|�|_dS)NrH�ignorez-extrasaction (%s) must be 'raise' or 'ignore')rHrI)r9r5�lower�
ValueError�extrasactionr)rr8r9r5rLr6r:r;rrrr �szDictWriter.__init__cCs tt|j|j��}|j|�dS)N)�dictr@r9�writerow)r�headerrrr�writeheader�szDictWriter.writeheadercsN�jdkr8�j��j}|r8tddjdd�|D������fdd��jD�S)NrHz(dict contains fields not in fieldnames: z, cSsg|]}t|��qSr)�repr)�.0�xrrr�
<listcomp>�sz,DictWriter._dict_to_list.<locals>.<listcomp>c3s|]}�j|�j�VqdS)N)�getr5)rRrD)�rowdictrrr�	<genexpr>�sz+DictWriter._dict_to_list.<locals>.<genexpr>)rL�keysr9rK�join)rrVZwrong_fieldsr)rVrr�
_dict_to_list�s
zDictWriter._dict_to_listcCs|jj|j|��S)N)rrNrZ)rrVrrrrN�szDictWriter.writerowcCs|jjt|j|��S)N)r�	writerows�maprZ)rZrowdictsrrrr[�szDictWriter.writerowsN)rrHr)r%r&r'r rPrZrNr[rrrrr�s
	c@s:eZdZdZdd�Zd
dd�Zdd�Zd	d
�Zdd�ZdS)rze
    "Sniffs" the format of a CSV file (i.e. delimiter, quotechar)
    Returns a Dialect object.
    cCsdddddg|_dS)Nr/r1�;� �:)�	preferred)rrrrr �szSniffer.__init__NcCsd|j||�\}}}}|s(|j||�\}}|s4td��Gdd�dt�}||_||_|pVd|_||_|S)zI
        Returns a dialect (or None) corresponding to the sample
        zCould not determine delimiterc@seZdZdZdZeZdS)zSniffer.sniff.<locals>.dialectZsniffedz
N)r%r&r'r(r-rr.rrrrr6�sr6r0)�_guess_quote_and_delimiter�_guess_delimiterrrr+r)r*r,)r�sample�
delimitersr*r+r)r,r6rrr�sniff�s

z
Sniffer.sniffcCs�g}x0dD](}tj|tjtjB�}|j|�}|r
Pq
W|s>dSi}i}d}|j}	x�|D]�}
|	d	d
}|
|}|r�|j|d�d
||<y|	dd
}|
|}Wntk
r�wVYnX|r�|dks�||kr�|j|d�d
||<y|	dd
}Wntk
�rwVYnX|
|rV|d
7}qVWt||jd
�}
|�rZt||jd
�}|||k}|dk�rbd}nd}d}tjdtj	|�|
d�tj�}|j
|��r�d}nd}|
|||fS)a�
        Looks for text enclosed between two identical quotes
        (the probable quotechar) which are preceded and followed
        by the same character (the probable delimiter).
        For example:
                         ,'some text',
        The quote with the most wins, same with the delimiter.
        If there is no quotechar the delimiter can't be determined
        this way.
        �I(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)�G(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)�G(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\n)�-(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?:$|\n)rFNr�quote��delimZspace)rDr2z]((%(delim)s)|^)\W*%(quote)s[^%(delim)s\n]*%(quote)s[^%(delim)s\n]*%(quote)s\W*((%(delim)s)|$))rlrjT)rfrgrhri)rFNr)�re�compile�DOTALL�	MULTILINE�findall�
groupindexrU�KeyError�max�escape�search)r�datardZmatchesZrestrZregexpZquotes�delimsZspacesrr�m�nrDr*rlr,Z	dq_regexpr+rrrra�s`


z"Sniffer._guess_quote_and_delimitercCsttd|jd���}dd�td�D�}tdt|��}d}i}i}i}dt|t|��}	}
�x|	t|�k�rn|d7}xT||	|
�D]D}x>|D]6}|j|i�}
|j|�}|
j|d�d|
|<|
||<q�Wq�Wx�|j�D]�}t||j	��}t|�dk�r|dddk�rq�t|�dk�rht
|d	d
�d�||<|j||�||d||dtdd
�|D��f||<q�|d||<q�W|j	�}t
||�}d}d}x�t|�dk�r||k�rx\|D]T\}}|ddk�r�|ddk�r�|d||k�r�|dk�s�||k�r�|||<�q�W|d8}�q�Wt|�dk�r`t|j��d}|dj|�|djd|�k}||fS|
}	|
|7}
q\W|�szdSt|�dk�r�xF|jD]<}||j�k�r�|dj|�|djd|�k}||fS�q�Wdd�|j	�D�}|j�|dd}|dj|�|djd|�k}||fS)a�
        The delimiter /should/ occur the same number of times on
        each row. However, due to malformed data, it may not. We don't want
        an all or nothing approach, so we allow for small variations in this
        number.
          1) build a table of the frequency of each character on every line.
          2) build a table of frequencies of this frequency (meta-frequency?),
             e.g.  'x occurred 5 times in 10 rows, 6 times in 1000 rows,
             7 times in 2 rows'
          3) use the mode of the meta-frequency to determine the /expected/
             frequency for that character
          4) find out how often the character actually meets that goal
          5) the character that best meets its goal is the delimiter
        For performance reasons, the data is evaluated in chunks, so it can
        try and evaluate the smallest portion of the data possible, evaluating
        additional chunks as necessary.
        Nr2cSsg|]}t|��qSr)�chr)rR�crrrrT.sz,Sniffer._guess_delimiter.<locals>.<listcomp>��
rrkcSs|dS)Nrkr)rSrrr�<lambda>Hsz*Sniffer._guess_delimiter.<locals>.<lambda>)rDcss|]}|dVqdS)rkNr)rR�itemrrrrWMsz+Sniffer._guess_delimiter.<locals>.<genexpr>g�?g�������?g{�G�z�?z%c rcSsg|]\}}||f�qSrr)rR�k�vrrrrTws)rr���)�list�filter�split�range�minrArU�countrX�itemsrt�remove�sum�floatr`�sort)rrwrd�asciiZchunkLengthZ	iterationZ
charFrequencyZmodesrx�start�end�line�charZ
metaFrequencyZfreqr�ZmodeListZtotalZconsistencyZ	thresholdr�r�rlr,rCrrrrbst

 zSniffer._guess_delimiterc
Cs�tt|�|j|��}t|�}t|�}i}xt|�D]}d||<q2Wd}x�|D]�}|dkrZP|d7}t|�|krpqLx�t|j��D]x}	xJtt	t
gD]0}
y|
||	�PWq�ttfk
r�Yq�Xq�Wt||	�}
|
||	kr~||	dkr�|
||	<q~||	=q~WqLWd}x�|j
�D]~\}	}t|�td�k�rLt||	�|k�rB|d7}n|d8}n<y|||	�Wn"ttfk
�r~|d7}Yn
X|d8}�qW|dkS)Nr�rk)rrrer=rAr�r�rX�intr��complexrK�
OverflowErrorr��typer")
rrcZrdrrO�columnsZcolumnTypes�iZcheckedrB�colZthisTypeZ	hasHeaderZcolTyperrr�
has_header�sJ





zSniffer.has_header)N)	r%r&r'rr rerarbr�rrrrr�s
Lg) rrmZ_csvrrrrrrrr	r
rrr
rrr!�collectionsr�ior�__all__rrrrrr��	NameErrorr�rrrrr�<module>s2@



2
warnings.cpython-36.opt-1.pyc000064400000030574150335715140011776 0ustar003


 \8H�
@sdZddlZddddddd	d
gZd;dd�Zd<dd�Zd
d�Zdd�ZeZdd�ZeZ	dd�Z
dedddfdd�Zeddfdd�Z
dd�Zdd	�ZGdd�de�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd=d+d�Zd>d,d�ZGd-d.�d.e�ZGd/d
�d
e�ZdZy0dd0lmZm Z m!Z!mZmZm"Z"e Z#e!Z$d1ZWn.e%k
�rfgZd2Z#iZ$d*a&d3d4�Z"YnXeej'�e�se(e)gZ*e*j+e,�xe*D]Z-e
d5e-d6��q�Wej.j/Z/e/d*k�r�d7Z0ne/�r�d2Z0nd5Z0e
e0e1d*d8�e2ed9��r�d:Z3nd5Z3e
e3e4d*d8�[dS)?z&Python part of the warnings subsystem.�N�warn�
warn_explicit�showwarning�
formatwarning�filterwarnings�simplefilter�
resetwarnings�catch_warningscCst||||||�}t|�dS)z7Hook to write a warning to a file; replace if you like.N)�WarningMessage�_showwarnmsg_impl)�message�category�filename�lineno�file�line�msg�r� /usr/lib64/python3.6/warnings.pyr
scCst||||d|�}t|�S)z.Function to format a warning the standard way.N)r
�_formatwarnmsg_impl)rr
rrrrrrrrscCsP|j}|dkr tj}|dkr dSt|�}y|j|�Wntk
rJYnXdS)N)r�sys�stderr�_formatwarnmsg�write�OSError)rr�textrrrrsrcCsLd|j|j|jj|jf}|jdkr`yddl}|j|j|j�}Wqftk
r\d}d}YqfXn|j}|r~|j	�}|d|7}|j
dk	�rHyddl}|j|j
�}Wntk
r�d}YnX|dk	�rH|d7}xx|D]p}|d|j|jf7}y$|dk	�r
|j|j|j�}nd}Wntk
�r*d}YnX|r�|j	�}|d|7}q�W|S)Nz%s:%s: %s: %s
rz  %s
z.Object allocated at (most recent call first):
z  File "%s", lineno %s
z    %s
)
rrr
�__name__rr�	linecache�getline�	Exception�strip�source�tracemalloc�get_object_traceback)r�srrr"�tb�framerrrr#sF






rcCsdyt}Wntk
rYn<X|tk	rXt|�s6td��||j|j|j|j|j	|j
�dSt|�dS)z7Hook to write a warning to a file; replace if you like.z:warnings.showwarning() must be set to a function or methodN)r�	NameError�_showwarning_orig�callable�	TypeErrorrr
rrrrr)r�swrrr�_showwarnmsgUsr,cCsJyt}Wntk
rYn&X|tk	rB||j|j|j|j|jd�St|�S)z.Function to format a warning the standard way.)r)	rr'�_formatwarning_origrr
rrrr)r�fwrrrrjs
r�FcCs0ddl}t||j||j�||j|�||d�dS)a�Insert an entry into the list of warnings filters (at the front).

    'action' -- one of "error", "ignore", "always", "default", "module",
                or "once"
    'message' -- a regex that the warning message must match
    'category' -- a class that the warning must be a subclass of
    'module' -- a regex that the module name must match
    'lineno' -- an integer line number, 0 matches all warnings
    'append' -- if true, append to the list of filters
    rN)�append)�re�_add_filter�compile�I)�actionrr
�modulerr0r1rrrrws	cCst|d|d||d�dS)a�Insert a simple entry into the list of warnings filters (at the front).

    A simple filter matches all modules and messages.
    'action' -- one of "error", "ignore", "always", "default", "module",
                or "once"
    'category' -- a class that the warning must be a subclass of
    'lineno' -- an integer line number, 0 matches all warnings
    'append' -- if true, append to the list of filters
    N)r0)r2)r5r
rr0rrrr�scGsR|s6ytj|�Wntk
r&YnXtjd|�n|tkrHtj|�t�dS)Nr)�filters�remove�
ValueError�insertr0�_filters_mutated)r0�itemrrrr2�s
r2cCsgtdd�<t�dS)zAClear the list of warning filters, so that no filters are active.N)r7r;rrrrr�sc@seZdZdZdS)�_OptionErrorz,Exception used by option processing helpers.N)r�
__module__�__qualname__�__doc__rrrrr=�sr=cCsRxL|D]D}yt|�Wqtk
rH}ztd|tjd�WYdd}~XqXqWdS)NzInvalid -W option ignored:)r)�
_setoptionr=�printrr)�args�argrrrr�_processoptions�s

rEcCs�ddl}|jd�}t|�dkr,td|f��xt|�dkrF|jd�q.Wdd�|D�\}}}}}t|�}|j|�}t|�}|j|�}|r�|d}|r�yt|�}|dkr�t	�Wq�t	t
fk
r�td	|f��Yq�Xnd}t|||||�dS)
Nr�:�ztoo many fields (max 5): %rr/cSsg|]}|j��qSr)r )�.0r$rrr�
<listcomp>�sz_setoption.<locals>.<listcomp>�$zinvalid lineno %r)r1�split�lenr=r0�
_getaction�escape�_getcategory�intr9�
OverflowErrorr)rDr1�partsr5rr
r6rrrrrA�s.


rAcCsB|sdS|dkrdSxd	D]}|j|�r|SqWtd|f��dS)
N�default�all�always�ignorer6�once�errorzinvalid action: %r)rSrUrVr6rWrX)�
startswithr=)r5�arrrrM�s

rMcCs�ddl}|stS|jd|�rNyt|�}Wq�tk
rJtd|f��Yq�Xn�|jd�}|d|�}||dd�}yt|dd|g�}Wn"tk
r�td|f��YnXyt	||�}Wn"t
k
r�td|f��YnXt|t�s�td|f��|S)Nrz^[a-zA-Z0-9_]+$zunknown warning category: %r�.�zinvalid module name: %rzinvalid warning category: %r)r1�Warning�match�evalr'r=�rfind�
__import__�ImportError�getattr�AttributeError�
issubclass)r
r1�cat�ir6�klass�mrrrrO�s,

rOcCs|jj}d|kod|kS)zFSignal whether the frame is an internal CPython implementation detail.�	importlib�
_bootstrap)�f_code�co_filename)r&rrrr�_is_internal_frame�srncCs&|j}x|dk	r t|�r |j}qW|S)z;Find the next frame that doesn't involve CPython internals.N)�f_backrn)r&rrr�_next_external_frames
rpr\cCsvt|t�r|j}|dkrt}t|t�o.t|t�sDtdjt|�j���yZ|dks\t	t
jd��rht
j|�}n4t
jd�}x(t|d�D]}t
|�}|dkr�t�q�WWntk
r�t
j}d}YnX|j}|j}d|kr�|d}nd}|jd�}	|	�r|	j�}
|
jd��rP|	dd�}	n>|dk�rFyt
jd	}	Wntk
�rDd}	YnX|	�sP|}	|jd
i�}t|||	|||||�dS)z:Issue a warning, or maybe ignore it or raise an exception.Nz/category must be a Warning subclass, not '{:s}'r\rz<string>�__file__z.pyc�__main__rZ__warningregistry__���)�
isinstancer]�	__class__�UserWarning�typerer*�formatrrnr�	_getframe�rangerpr9�__dict__�	f_globals�f_lineno�get�lower�endswith�argvrd�
setdefaultr)rr
�
stacklevelr!r&�x�globalsrr6rZfnl�registryrrrr
sL






cCs�t|�}|dkr8|pd}|dd�j�dkr8|dd�}|dkrDi}|jdd�tkrd|j�t|d<t|t�r~t|�}|j}n|}||�}|||f}	|j|	�r�dSx^t	D]R}
|
\}}}
}}|dks�|j
|�r�t||
�r�|dks�|j
|�r�|dks�||kr�Pq�Wt}|dk�rd||	<dSddl
}|j||�|dk�r:|�|d	k�rnd||	<||f}tj|��rddSdt|<nf|d
k�rznZ|dk�r�d||	<||df}|j|��r�dSd||<n$|dk�r�d||	<ntd
||
f��t|||||�}t|�dS)Nz	<unknown>�z.py�versionrrVr\rXrWrUr6rSz1Unrecognized action (%r) in warnings.filters:
 %s���r�)rPrr~�_filters_version�clearrtr]�strrur7r^re�
defaultactionr�getlines�onceregistry�RuntimeErrorr
r,)rr
rrr6r��module_globalsr!r�keyr<r5rrf�mod�lnrZoncekeyZaltkeyrrrrAsl














c@s"eZdZd
Zdd	d
�Zdd�ZdS)r
rr
rrrrr!Nc
Cs:t�}x|jD]}	t||	||	�qW|r0|jnd|_dS)N)�locals�_WARNING_DETAILS�setattrr�_category_name)
�selfrr
rrrrr!�local_values�attrrrr�__init__�szWarningMessage.__init__cCsd|j|j|j|j|jfS)NzD{message : %r, category : %r, filename : %r, lineno : %s, line : %r})rr�rrr)r�rrr�__str__�szWarningMessage.__str__)rr
rrrrr!)NNN)rr>r?r�r�r�rrrrr
�s

r
c@s8eZdZdZddd�dd�Zdd�Zd	d
�Zdd�ZdS)
r	a�A context manager that copies and restores the warnings filter upon
    exiting the context.

    The 'record' argument specifies whether warnings should be captured by a
    custom implementation of warnings.showwarning() and be appended to a list
    returned by the context manager. Otherwise None is returned by the context
    manager. The objects appended to the list are arguments whose attributes
    mirror the arguments to showwarning().

    The 'module' argument is to specify an alternative module to the module
    named 'warnings' and imported under that name. This argument is only useful
    when testing the warnings module itself.

    FN)�recordr6cCs(||_|dkrtjdn||_d|_dS)z�Specify whether to record warnings and if an alternative module
        should be used other than sys.modules['warnings'].

        For compatibility with Python 3.0, please consider all arguments to be
        keyword-only.

        N�warningsF)�_recordr�modules�_module�_entered)r�r�r6rrrr��szcatch_warnings.__init__cCsPg}|jr|jd�|jtjdk	r4|jd|j�t|�j}d|dj|�fS)Nzrecord=Truer�z	module=%rz%s(%s)z, )r�r0r�rr�rwr�join)r�rC�namerrr�__repr__�s

zcatch_warnings.__repr__cCs~|jrtd|��d|_|jj|_|jdd�|j_|jj�|jj|_|jj|_|j	rvg}|j
|j_|jj|j_|SdSdS)NzCannot enter %r twiceT)r�r�r�r7�_filtersr;r�_showwarningrr�r0r()r��logrrr�	__enter__�s




zcatch_warnings.__enter__cGs>|jstd|��|j|j_|jj�|j|j_|j|j_dS)Nz%Cannot exit %r without entering first)	r�r�r�r�r7r;r�rr)r��exc_inforrr�__exit__�s


zcatch_warnings.__exit__)rr>r?r@r�r�r�r�rrrrr	�s
	)r7�_defaultaction�
_onceregistryrrr;TrScCstd7adS)Nr\)r�rrrrr;�sr;rV)r
rX)r
r0�gettotalrefcountrU)NN)N)Nr\N)NNNN)5r@r�__all__rrrrr(r,r-rr]rrr2rrr=rErArMrOrnrprr�objectr
r	Z_warnings_defaults�	_warningsr7r�r�r;r�r�rbr��warnoptions�
ImportWarning�PendingDeprecationWarningZsilencer0�DeprecationWarning�cls�flags�
bytes_warningZbytes_action�BytesWarning�hasattrZresource_action�ResourceWarningrrrr�<module>sv

0

	
5
FJ 



_pyio.cpython-36.opt-2.pyc000064400000137517150335715140011273 0ustar003


 \!X�@s^ddlZddlZddlZddlZddlZddlZyddlmZWn e	k
r`ddl
mZYnXejd4krzddlm
ZndZddlZddlmZmZmZmZdddhZeed	�r�ejej�ejej�d5ZeZd7dd�ZGdd�d�ZGdd�d�Zy
ejZWn(ek
�r*Gdd�de e!�ZYnXGdd�dej"d�Z#ej#j$e#�Gdd�de#�Z%ej%j$e%�ddl&m'Z'e%j$e'�Gdd�de#�Z(ej(j$e(�Gdd�de(�Z)Gd d!�d!e(�Z*Gd"d#�d#e)�Z+Gd$d%�d%e)�Z,Gd&d'�d'e(�Z-Gd(d)�d)e,e+�Z.Gd*d+�d+e%�Z'Gd,d-�d-e#�Z/ej/j$e/�Gd.d/�d/ej0�Z1Gd0d1�d1e/�Z2Gd2d3�d3e2�Z3dS)8�N)�
allocate_lock�win32�cygwin)�setmode)�__all__�SEEK_SET�SEEK_CUR�SEEK_END���	SEEK_HOLE�i�rTcCs~t|t�stj|�}t|tttf�s0td|��t|t�sFtd|��t|t�s\td|��|dk	r|t|t�r|td|��|dk	r�t|t�r�td|��t|�}|td�s�t|�t|�kr�t	d|��d|k}	d|k}
d	|k}d
|k}d|k}
d|k}d
|k}d|k�rH|	�s&|�s&|�s&|
�r.t	d��ddl
}|jdtd�d}
|�r\|�r\t	d��|	|
||dk�rzt	d��|	�p�|
�p�|�p�|�s�t	d��|�r�|dk	�r�t	d��|�r�|dk	�r�t	d��|�r�|dk	�r�t	d��t
||	�r�d�p�d|
�rd�pd|�rd	�pd|�r d
�p"d|
�r0d�p2d||d�}|}�yd}|dk�sh|dk�rp|j��rpd!}d}|dk�r�t}ytj|j��j}Wnttfk
�r�YnX|dk�r�|}|dk�r�t	d��|dk�r�|�r�|St	d��|
�r�t||�}n<|	�s|�s|�rt||�}n|
�r,t||�}nt	d |��|}|�rF|St|||||�}|}||_|S|j��YnXdS)"Nzinvalid file: %rzinvalid mode: %rzinvalid buffering: %rzinvalid encoding: %rzinvalid errors: %rzaxrwb+tU�xr�w�a�+�t�b�Uz4mode U cannot be combined with 'x', 'w', 'a', or '+'rz'U' mode is deprecatedrTz'can't have text and binary mode at oncer
z)can't have read/write/append mode at oncez/must have exactly one of read/write/append modez-binary mode doesn't take an encoding argumentz+binary mode doesn't take an errors argumentz+binary mode doesn't take a newline argument�)�openerFzinvalid buffering sizezcan't have unbuffered text I/Ozunknown mode: %r���)�
isinstance�int�os�fspath�str�bytes�	TypeError�set�len�
ValueError�warnings�warn�DeprecationWarning�FileIO�isatty�DEFAULT_BUFFER_SIZE�fstat�fileno�
st_blksize�OSError�AttributeError�BufferedRandom�BufferedWriter�BufferedReader�
TextIOWrapper�mode�close)�filer2�	buffering�encoding�errors�newline�closefdrZmodesZcreatingZreadingZwritingZ	appendingZupdating�textZbinaryr#�raw�result�line_bufferingZbs�buffer�r?�/usr/lib64/python3.6/_pyio.py�open(s�{




>




rAc@seZdZdd�ZdS)�
DocDescriptorcCs
dtjS)Nz\open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True)

)rA�__doc__)�self�obj�typr?r?r@�__get__�szDocDescriptor.__get__N)�__name__�
__module__�__qualname__rGr?r?r?r@rB�srBc@seZdZe�Zdd�ZdS)�OpenWrappercOs
t||�S)N)rA)�cls�args�kwargsr?r?r@�__new__szOpenWrapper.__new__N)rHrIrJrBrCrOr?r?r?r@rKsrKc@seZdZdS)�UnsupportedOperationN)rHrIrJr?r?r?r@rPsrPc@s�eZdZdd�Zd5dd�Zdd�Zd6d	d
�Zdd�Zd
Zdd�Z	dd�Z
dd�Zd7dd�Zdd�Z
d8dd�Zdd�Zd9dd�Zedd��Zd:d d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd<d+d,�Zd-d.�Zd/d0�Zd=d1d2�Zd3d4�ZdS)>�IOBasecCstd|jj|f��dS)Nz%s.%s() not supported)rP�	__class__rH)rD�namer?r?r@�_unsupported@szIOBase._unsupportedrcCs|jd�dS)N�seek)rT)rD�pos�whencer?r?r@rUGszIOBase.seekcCs|jdd�S)Nrr
)rU)rDr?r?r@�tellWszIOBase.tellNcCs|jd�dS)N�truncate)rT)rDrVr?r?r@rY[szIOBase.truncatecCs|j�dS)N)�_checkClosed)rDr?r?r@�flusheszIOBase.flushFcCs |jsz|j�Wdd|_XdS)NT)�_IOBase__closedr[)rDr?r?r@r3oszIOBase.closec	Csy|j�WnYnXdS)N)r3)rDr?r?r@�__del__zszIOBase.__del__cCsdS)NFr?)rDr?r?r@�seekable�szIOBase.seekablecCs |j�st|dkrdn|��dS)NzFile or stream is not seekable.)r^rP)rD�msgr?r?r@�_checkSeekable�szIOBase._checkSeekablecCsdS)NFr?)rDr?r?r@�readable�szIOBase.readablecCs |j�st|dkrdn|��dS)NzFile or stream is not readable.)rarP)rDr_r?r?r@�_checkReadable�szIOBase._checkReadablecCsdS)NFr?)rDr?r?r@�writable�szIOBase.writablecCs |j�st|dkrdn|��dS)NzFile or stream is not writable.)rcrP)rDr_r?r?r@�_checkWritable�szIOBase._checkWritablecCs|jS)N)r\)rDr?r?r@�closed�sz
IOBase.closedcCs|jrt|dkrdn|��dS)NzI/O operation on closed file.)rer")rDr_r?r?r@rZ�szIOBase._checkClosedcCs|j�|S)N)rZ)rDr?r?r@�	__enter__�szIOBase.__enter__cGs|j�dS)N)r3)rDrMr?r?r@�__exit__�szIOBase.__exit__cCs|jd�dS)Nr*)rT)rDr?r?r@r*�sz
IOBase.filenocCs|j�dS)NF)rZ)rDr?r?r@r'�sz
IOBase.isattyr
cs�t�d�r��fdd�}ndd�}�dkr0d	�nt�t�sBtd��t�}x>�dks^t|��kr��j|��}|spP||7}|jd�rJPqJWt|�S)
N�peekcs>�jd�}|sdS|jd�dp&t|�}�dkr:t|��}|S)Nr
�
r)rh�findr!�min)Z	readahead�n)rD�sizer?r@�
nreadahead�s

z#IOBase.readline.<locals>.nreadaheadcSsdS)Nr
r?r?r?r?r@rn�sr
zsize must be an integerrrir)	�hasattrrrr�	bytearrayr!�read�endswithr)rDrmrn�resrr?)rDrmr@�readline�s 
	

zIOBase.readlinecCs|j�|S)N)rZ)rDr?r?r@�__iter__szIOBase.__iter__cCs|j�}|st�|S)N)rt�
StopIteration)rD�liner?r?r@�__next__szIOBase.__next__cCsR|dks|dkrt|�Sd}g}x,|D]$}|j|�|t|�7}||kr&Pq&W|S)Nr)�list�appendr!)rDZhintrl�linesrwr?r?r@�	readliness

zIOBase.readlinescCs$|j�x|D]}|j|�qWdS)N)rZ�write)rDr{rwr?r?r@�
writelines#s
zIOBase.writelines)r)N)N)N)N)Nr)r)N)rHrIrJrTrUrXrYr[r\r3r]r^r`rarbrcrd�propertyrerZrfrgr*r'rtrurxr|r~r?r?r?r@rQs2$






	

%
rQ)�	metaclassc@s.eZdZddd�Zdd�Zdd�Zdd	�Zd
S)
�	RawIOBaser
cCsP|dkrd}|dkr|j�St|j��}|j|�}|dkr>dS||d�=t|�S)Nr
rr)�readallrp�	__index__�readintor)rDrmrrlr?r?r@rq9s

zRawIOBase.readcCs8t�}x|jt�}|sP||7}qW|r0t|�S|SdS)N)rprqr(r)rDrs�datar?r?r@r�Js
zRawIOBase.readallcCs|jd�dS)Nr�)rT)rDrr?r?r@r�XszRawIOBase.readintocCs|jd�dS)Nr})rT)rDrr?r?r@r}`szRawIOBase.writeNr)r)rHrIrJrqr�r�r}r?r?r?r@r�+s
r�)r&c@sHeZdZddd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�BufferedIOBaseNcCs|jd�dS)Nrq)rT)rDrmr?r?r@rq~szBufferedIOBase.readcCs|jd�dS)N�read1)rT)rDrmr?r?r@r��szBufferedIOBase.read1cCs|j|dd�S)NF)r�)�	_readinto)rDrr?r?r@r��szBufferedIOBase.readintocCs|j|dd�S)NT)r�)r�)rDrr?r?r@�	readinto1�s	zBufferedIOBase.readinto1cCsVt|t�st|�}|jd�}|r0|jt|��}n|jt|��}t|�}||d|�<|S)N�B)r�
memoryview�castr�r!rq)rDrr�r�rlr?r?r@r��s

zBufferedIOBase._readintocCs|jd�dS)Nr})rT)rDrr?r?r@r}�s	zBufferedIOBase.writecCs|jd�dS)N�detach)rT)rDr?r?r@r��szBufferedIOBase.detach)N)N)
rHrIrJrqr�r�r�r�r}r�r?r?r?r@r�ms

r�c@s�eZdZdd�Zd#dd�Zdd�Zd$d	d
�Zdd�Zd
d�Zdd�Z	dd�Z
edd��Zedd��Z
edd��Zedd��Zdd�Zdd�Zdd �Zd!d"�ZdS)%�_BufferedIOMixincCs
||_dS)N)�_raw)rDr;r?r?r@�__init__�sz_BufferedIOMixin.__init__rcCs"|jj||�}|dkrtd��|S)Nrz#seek() returned an invalid position)r;rUr,)rDrVrWZnew_positionr?r?r@rU�sz_BufferedIOMixin.seekcCs|jj�}|dkrtd��|S)Nrz#tell() returned an invalid position)r;rXr,)rDrVr?r?r@rX�s
z_BufferedIOMixin.tellNcCs$|j�|dkr|j�}|jj|�S)N)r[rXr;rY)rDrVr?r?r@rY�sz_BufferedIOMixin.truncatecCs|jrtd��|jj�dS)Nzflush of closed file)rer"r;r[)rDr?r?r@r[�sz_BufferedIOMixin.flushc
Cs0|jdk	r,|jr,z|j�Wd|jj�XdS)N)r;rer[r3)rDr?r?r@r3sz_BufferedIOMixin.closecCs*|jdkrtd��|j�|j}d|_|S)Nzraw stream already detached)r;r"r[r�)rDr;r?r?r@r�s
z_BufferedIOMixin.detachcCs
|jj�S)N)r;r^)rDr?r?r@r^sz_BufferedIOMixin.seekablecCs|jS)N)r�)rDr?r?r@r;sz_BufferedIOMixin.rawcCs|jjS)N)r;re)rDr?r?r@resz_BufferedIOMixin.closedcCs|jjS)N)r;rS)rDr?r?r@rS!sz_BufferedIOMixin.namecCs|jjS)N)r;r2)rDr?r?r@r2%sz_BufferedIOMixin.modecCstdj|jj���dS)Nz can not serialize a '{0}' object)r�formatrRrH)rDr?r?r@�__getstate__)sz_BufferedIOMixin.__getstate__cCsJ|jj}|jj}y
|j}Wntk
r6dj||�SXdj|||�SdS)Nz<{}.{}>z<{}.{} name={!r}>)rRrIrJrS�	Exceptionr�)rD�modnameZclsnamerSr?r?r@�__repr__-s
z_BufferedIOMixin.__repr__cCs
|jj�S)N)r;r*)rDr?r?r@r*9sz_BufferedIOMixin.filenocCs
|jj�S)N)r;r')rDr?r?r@r'<sz_BufferedIOMixin.isatty)r)N)rHrIrJr�rUrXrYr[r3r�r^rr;rerSr2r�r�r*r'r?r?r?r@r��s 	


r�cs�eZdZddd�Zdd�Zdd�Zdd	�Z�fd
d�Zd dd
�Zdd�Z	dd�Z
d!dd�Zdd�Zd"dd�Z
dd�Zdd�Zdd�Z�ZS)#�BytesIONcCs&t�}|dk	r||7}||_d|_dS)Nr)rp�_buffer�_pos)rDZ
initial_bytes�bufr?r?r@r�Ds
zBytesIO.__init__cCs|jrtd��|jj�S)Nz__getstate__ on closed file)rer"�__dict__�copy)rDr?r?r@r�KszBytesIO.__getstate__cCs|jrtd��t|j�S)Nzgetvalue on closed file)rer"rr�)rDr?r?r@�getvaluePszBytesIO.getvaluecCs|jrtd��t|j�S)Nzgetbuffer on closed file)rer"r�r�)rDr?r?r@�	getbufferWszBytesIO.getbuffercs|jj�t�j�dS)N)r��clear�superr3)rD)rRr?r@r3^s
z
BytesIO.closecCst|jrtd��|dkrd}|dkr,t|j�}t|j�|jkr@dStt|j�|j|�}|j|j|�}||_t|�S)Nzread from closed filer
r�r)rer"r!r�r�rkr)rDrmZnewposrr?r?r@rqbs
zBytesIO.readcCs
|j|�S)N)rq)rDrmr?r?r@r�psz
BytesIO.read1cCs�|jrtd��t|t�r td��t|��}|j}WdQRX|dkrFdS|j}|t|j	�krzd|t|j	�}|j	|7_	||j	|||�<|j|7_|S)Nzwrite to closed filez can't write str to binary streamr�)
rer"rrrr��nbytesr�r!r�)rDrZviewrlrVZpaddingr?r?r@r}us

z
BytesIO.writercCs�|jrtd��y
|jWn,tk
rD}ztd�|�WYdd}~XnX|dkrl|dkrdtd|f��||_nD|dkr�td|j|�|_n(|dkr�tdt|j�|�|_ntd��|jS)Nzseek on closed filezan integer is requiredrznegative seek position %rr
rzunsupported whence value)	rer"r�r-rr��maxr!r�)rDrVrW�errr?r?r@rU�s 
zBytesIO.seekcCs|jrtd��|jS)Nztell on closed file)rer"r�)rDr?r?r@rX�szBytesIO.tellcCs||jrtd��|dkr|j}nNy
|jWn,tk
rT}ztd�|�WYdd}~XnX|dkrltd|f��|j|d�=|S)Nztruncate on closed filezan integer is requiredrznegative truncate position %r)rer"r�r�r-rr�)rDrVr�r?r?r@rY�s
zBytesIO.truncatecCs|jrtd��dS)NzI/O operation on closed file.T)rer")rDr?r?r@ra�szBytesIO.readablecCs|jrtd��dS)NzI/O operation on closed file.T)rer")rDr?r?r@rc�szBytesIO.writablecCs|jrtd��dS)NzI/O operation on closed file.T)rer")rDr?r?r@r^�szBytesIO.seekable)N)N)r)N)rHrIrJr�r�r�r�r3rqr�r}rUrXrYrarcr^�
__classcell__r?r?)rRr@r�@s



r�c@sreZdZefdd�Zdd�Zdd�Zddd	�Zdd
d�Zdd
d�Z	ddd�Z
dd�Zdd�Zdd�Z
ddd�ZdS)r0cCsF|j�std��tj||�|dkr,td��||_|j�t�|_dS)Nz "raw" argument must be readable.rzinvalid buffer size)	rar,r�r�r"�buffer_size�_reset_read_buf�Lock�
_read_lock)rDr;r�r?r?r@r��szBufferedReader.__init__cCs
|jj�S)N)r;ra)rDr?r?r@ra�szBufferedReader.readablecCsd|_d|_dS)Nr�r)�	_read_buf�	_read_pos)rDr?r?r@r��szBufferedReader._reset_read_bufNc	Cs4|dk	r|dkrtd��|j�|j|�SQRXdS)Nr
zinvalid number of bytes to readr)r"r��_read_unlocked)rDrmr?r?r@rq�szBufferedReader.readcCs�d}d}|j}|j}|dks$|dkr�|j�t|jd�rj|jj�}|dkrZ||d�pXdS||d�|S||d�g}d}x2|jj�}||kr�|}P|t|�7}|j|�q~Wdj	|�p�|St|�|}	||	kr�|j|7_||||�S||d�g}t
|j|�}
xB|	|k�rL|jj|
�}||k�r2|}P|	t|�7}	|j|��qWt||	�}dj	|�}||d�|_d|_|�r�|d|�S|S)Nr�r
r�r)r�Nr)
r�r�r�ror;r�rqr!rz�joinr�r�rk)rDrlZ
nodata_valZempty_valuesr�rV�chunkZchunksZcurrent_size�availZwanted�outr?r?r@r��sN




zBufferedReader._read_unlockedrc	Cs|j�|j|�SQRXdS)N)r��_peek_unlocked)rDrmr?r?r@rhszBufferedReader.peekcCsrt||j�}t|j�|j}||ks,|dkrb|j|}|jj|�}|rb|j|jd�||_d|_|j|jd�S)Nr)rkr�r!r�r�r;rq)rDrlZwantZhaveZto_readZcurrentr?r?r@r�)s
zBufferedReader._peek_unlockedcCsT|dkrtd��|dkrdS|j�(|jd�|jt|t|j�|j��SQRXdS)Nrz(number of bytes to read must be positiver�r
)r"r�r�r�rkr!r�r�)rDrmr?r?r@r�4s
zBufferedReader.read1cCst|t�st|�}|jdkr dS|jd�}d}|j��x�|t|�k�rtt|j�|jt|��}|r�|j|j|j|�||||�<|j|7_||7}|t|�kr�Pt|�||j	kr�|j
j||d��}|s�P||7}n|o�|s�|jd�s�P|r8|r8Pq8WWdQRX|S)Nrr�r
)
rr�r�r�r�r!rkr�r�r�r;r�r�)rDr�r��writtenr�rlr?r?r@r�Fs4


"

zBufferedReader._readintocCstj|�t|j�|jS)N)r�rXr!r�r�)rDr?r?r@rXtszBufferedReader.tellcCsX|tkrtd��|j�8|dkr4|t|j�|j8}tj|||�}|j�|SQRXdS)Nzinvalid whence valuer
)	�valid_seek_flagsr"r�r!r�r�r�rUr�)rDrVrWr?r?r@rUwszBufferedReader.seek)N)N)r)r)r)rHrIrJr(r�rar�rqr�rhr�r�r�rXrUr?r?r?r@r0�s


4


.r0c@sTeZdZefdd�Zdd�Zdd�Zddd	�Zd
d�Zdd
�Z	dd�Z
ddd�ZdS)r/cCsF|j�std��tj||�|dkr,td��||_t�|_t�|_	dS)Nz "raw" argument must be writable.rzinvalid buffer size)
rcr,r�r�r"r�rp�
_write_bufr��_write_lock)rDr;r�r?r?r@r��szBufferedWriter.__init__cCs
|jj�S)N)r;rc)rDr?r?r@rc�szBufferedWriter.writablecCs�|jrtd��t|t�r td��|j��t|j�|jkr@|j	�t|j�}|jj
|�t|j�|}t|j�|jkr�y|j	�Wnltk
r�}zPt|j�|jkr�t|j�|j}||8}|jd|j�|_t|j|j
|��WYdd}~XnX|SQRXdS)Nzwrite to closed filez can't write str to binary stream)rer"rrrr�r!r�r��_flush_unlocked�extend�BlockingIOError�errno�strerror)rDrZbeforer��eZoverager?r?r@r}�s(

"zBufferedWriter.writeNc	Cs8|j�(|j�|dkr"|jj�}|jj|�SQRXdS)N)r�r�r;rXrY)rDrVr?r?r@rY�s

zBufferedWriter.truncatec	Cs|j�|j�WdQRXdS)N)r�r�)rDr?r?r@r[�szBufferedWriter.flushcCs�|jrtd��xz|jr�y|jj|j�}Wntk
rDtd��YnX|dkr\ttjdd��|t	|j�ksr|dkrzt
d��|jd|�=qWdS)Nzflush of closed filezHself.raw should implement RawIOBase: it should not raise BlockingIOErrorz)write could not complete without blockingrz*write() returned incorrect number of bytes)rer"r�r;r}r��RuntimeErrorr�ZEAGAINr!r,)rDrlr?r?r@r��szBufferedWriter._flush_unlockedcCstj|�t|j�S)N)r�rXr!r�)rDr?r?r@rX�szBufferedWriter.tellrcCs8|tkrtd��|j�|j�tj|||�SQRXdS)Nzinvalid whence value)r�r"r�r�r�rU)rDrVrWr?r?r@rU�s
zBufferedWriter.seek)N)r)rHrIrJr(r�rcr}rYr[r�rXrUr?r?r?r@r/�s	
r/c@s�eZdZefdd�Zddd�Zdd�Zdd	�Zddd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zedd��ZdS)�BufferedRWPaircCs<|j�std��|j�s td��t||�|_t||�|_dS)Nz#"reader" argument must be readable.z#"writer" argument must be writable.)rar,rcr0�readerr/�writer)rDr�r�r�r?r?r@r��szBufferedRWPair.__init__NcCs|dkrd}|jj|�S)Nr
r)r�rq)rDrmr?r?r@rq�szBufferedRWPair.readcCs|jj|�S)N)r�r�)rDrr?r?r@r��szBufferedRWPair.readintocCs|jj|�S)N)r�r})rDrr?r?r@r}szBufferedRWPair.writercCs|jj|�S)N)r�rh)rDrmr?r?r@rhszBufferedRWPair.peekcCs|jj|�S)N)r�r�)rDrmr?r?r@r�szBufferedRWPair.read1cCs|jj|�S)N)r�r�)rDrr?r?r@r�
szBufferedRWPair.readinto1cCs
|jj�S)N)r�ra)rDr?r?r@ra
szBufferedRWPair.readablecCs
|jj�S)N)r�rc)rDr?r?r@rcszBufferedRWPair.writablecCs
|jj�S)N)r�r[)rDr?r?r@r[szBufferedRWPair.flushc
Cs z|jj�Wd|jj�XdS)N)r�r3r�)rDr?r?r@r3szBufferedRWPair.closecCs|jj�p|jj�S)N)r�r'r�)rDr?r?r@r'szBufferedRWPair.isattycCs|jjS)N)r�re)rDr?r?r@reszBufferedRWPair.closed)N)r)rHrIrJr(r�rqr�r}rhr�r�rarcr[r3r'rrer?r?r?r@r��s

r�c@sheZdZefdd�Zddd�Zdd�Zdd	d
�Zddd�Zd
d�Z	ddd�Z
dd�Zdd�Zdd�Z
dS)r.cCs(|j�tj|||�tj|||�dS)N)r`r0r�r/)rDr;r�r?r?r@r�-szBufferedRandom.__init__rcCs�|tkrtd��|j�|jrJ|j� |jj|jt|j�d�WdQRX|jj||�}|j�|j	�WdQRX|dkr�t
d��|S)Nzinvalid whence valuer
rz seek() returned invalid position)r�r"r[r�r�r;rUr�r!r�r,)rDrVrWr?r?r@rU2s$zBufferedRandom.seekcCs|jrtj|�Stj|�SdS)N)r�r/rXr0)rDr?r?r@rXCs
zBufferedRandom.tellNcCs|dkr|j�}tj||�S)N)rXr/rY)rDrVr?r?r@rYIszBufferedRandom.truncatecCs |dkrd}|j�tj||�S)Nr
r)r[r0rq)rDrmr?r?r@rqOszBufferedRandom.readcCs|j�tj||�S)N)r[r0r�)rDrr?r?r@r�UszBufferedRandom.readintocCs|j�tj||�S)N)r[r0rh)rDrmr?r?r@rhYszBufferedRandom.peekcCs|j�tj||�S)N)r[r0r�)rDrmr?r?r@r�]szBufferedRandom.read1cCs|j�tj||�S)N)r[r0r�)rDrr?r?r@r�aszBufferedRandom.readinto1cCsF|jr:|j�(|jj|jt|j�d�|j�WdQRXtj||�S)Nr
)	r�r�r;rUr�r!r�r/r})rDrr?r?r@r}es
zBufferedRandom.write)r)N)N)r)rHrIrJr(r�rUrXrYrqr�rhr�r�r}r?r?r?r@r.$s	



r.cs�eZdZd0ZdZdZdZdZdZdZ	d1dd�Z
dd	�Zd
d�Zdd
�Z
dd�Zd2dd�Zd3dd�Zdd�Zdd�Zdd�Zefdd�Zdd�Zd4dd�Z�fd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zed,d-��Zed.d/��Z �Z!S)5r&r
FNTrc
Cs
|jdkr*z|jrtj|j�Wdd|_Xt|t�r<td��t|t�r\|}|dkr`td��nd}t|t	�sxtd|f��t
|�t
d�ks�td|f��tdd�|D��dks�|jd	�dkr�td
��d|kr�d|_
d|_tjtjB}nVd
|k�r�d|_d}n@d|k�rd|_tjtjB}n"d|k�r:d|_d|_tjtjB}d	|k�rPd|_d|_|j�rl|j�rl|tjO}n|j�r�|tjO}n
|tjO}|ttdd�O}ttdd��p�ttdd�}||O}d}�y|dk�r<|�s�td��|dk�r�tj||d�}n0|||�}t|t��std��|dk�r&td��|}|�s<tj|d�||_tj|�}	y(tj|	j��rrt t!j"tj#t!j"�|��Wnt$k
�r�YnXt|	dd�|_%|j%dk�r�t&|_%t'�r�t'|tj(�||_)|j�r�tj*|dt+�Wn"|dk	�r�tj|��YnX||_dS)Nrr
z$integer argument expected, got floatznegative file descriptorzinvalid mode: %szxrwab+css|]}|dkVqdS)ZrwaxNr?)�.0�cr?r?r@�	<genexpr>�sz"FileIO.__init__.<locals>.<genexpr>rzKMust have exactly one of create/read/write/append mode and at most one plusrTrrr�O_BINARYZO_NOINHERIT�	O_CLOEXECz'Cannot use closefd=False with file namei�zexpected integer from openerzNegative file descriptorFr+rr),�_fd�_closefdrr3r�floatrrr"rr �sum�count�_created�	_writable�O_EXCL�O_CREAT�	_readable�O_TRUNC�
_appending�O_APPEND�O_RDWR�O_RDONLY�O_WRONLY�getattrrAr,�set_inheritabler)�stat�S_ISDIR�st_mode�IsADirectoryErrorr�ZEISDIRr�r-�_blksizer(�_setmoder�rS�lseekr	)
rDr4r2r9r�fd�flagsZnoinherit_flagZowned_fdZfdfstatr?r?r@r�ws�




$











zFileIO.__init__cCsD|jdkr@|jr@|jr@ddl}|jd|ftd|d�|j�dS)Nrzunclosed file %rr)�
stacklevel�source)r�r�rer#r$�ResourceWarningr3)rDr#r?r?r@r]�s

zFileIO.__del__cCstd|jj��dS)Nzcannot serialize '%s' object)rrRrH)rDr?r?r@r��szFileIO.__getstate__c
Csld|jj|jjf}|jr"d|Sy
|j}Wn&tk
rRd||j|j|jfSXd|||j|jfSdS)Nz%s.%sz
<%s [closed]>z<%s fd=%d mode=%r closefd=%r>z<%s name=%r mode=%r closefd=%r>)	rRrIrJrerSr-r�r2r�)rD�
class_namerSr?r?r@r��s
zFileIO.__repr__cCs|jstd��dS)NzFile not open for reading)r�rP)rDr?r?r@rbszFileIO._checkReadablecCs|jstd��dS)NzFile not open for writing)r�rP)rDr_r?r?r@rdszFileIO._checkWritablecCsP|j�|j�|dks |dkr(|j�Sytj|j|�Stk
rJdSXdS)Nr)rZrbr�rrqr�r�)rDrmr?r?r@rqszFileIO.readcCs�|j�|j�t}y6tj|jdt�}tj|j�j}||krH||d}Wnt	k
r^YnXt
�}xnt|�|kr�t|�}|t|t�7}|t|�}ytj
|j|�}Wntk
r�|r�PdSX|s�P||7}qhWt|�S)Nrr
)rZrbr(rr�r�rr)�st_sizer,rpr!r�rqr�r)rD�bufsizerV�endr<rlr�r?r?r@r�s4zFileIO.readallcCs4t|�jd�}|jt|��}t|�}||d|�<|S)Nr�)r�r�rqr!)rDr�mr�rlr?r?r@r�?s
zFileIO.readintocCs8|j�|j�ytj|j|�Stk
r2dSXdS)N)rZrdrr}r�r�)rDrr?r?r@r}GszFileIO.writecCs*t|t�rtd��|j�tj|j||�S)Nzan integer is required)rr�rrZrr�r�)rDrVrWr?r?r@rUUs
zFileIO.seekcCs|j�tj|jdt�S)Nr)rZrr�r�r)rDr?r?r@rXeszFileIO.tellcCs2|j�|j�|dkr |j�}tj|j|�|S)N)rZrdrXr�	ftruncater�)rDrmr?r?r@rYlszFileIO.truncatec
s.|js*z|jrtj|j�Wdt�j�XdS)N)rer�rr3r�r�)rD)rRr?r@r3ys
zFileIO.closecCsF|j�|jdkr@y|j�Wntk
r8d|_YnXd|_|jS)NFT)rZ�	_seekablerXr,)rDr?r?r@r^�s
zFileIO.seekablecCs|j�|jS)N)rZr�)rDr?r?r@ra�szFileIO.readablecCs|j�|jS)N)rZr�)rDr?r?r@rc�szFileIO.writablecCs|j�|jS)N)rZr�)rDr?r?r@r*�sz
FileIO.filenocCs|j�tj|j�S)N)rZrr'r�)rDr?r?r@r'�sz
FileIO.isattycCs|jS)N)r�)rDr?r?r@r9�szFileIO.closefdcCsJ|jr|jrdSdSn0|jr,|jr&dSdSn|jrB|jr<dSdSndSdS)Nzxb+Zxbzab+Zabzrb+�rb�wb)r�r�r�r�)rDr?r?r@r2�szFileIO.moder)rTN)N)N)N)"rHrIrJr�r�r�r�r�r�r�r�r]r�r�rbrdrqr�r�r}rrUrXrYr3r^rarcr*r'rr9r2r�r?r?)rRr@r&ns8
u

#


r&c@s\eZdZddd�Zdd�Zddd�Zd	d
�Zdd�Zed
d��Z	edd��Z
edd��ZdS)�
TextIOBaser
cCs|jd�dS)Nrq)rT)rDrmr?r?r@rq�szTextIOBase.readcCs|jd�dS)Nr})rT)rD�sr?r?r@r}�szTextIOBase.writeNcCs|jd�dS)NrY)rT)rDrVr?r?r@rY�szTextIOBase.truncatecCs|jd�dS)Nrt)rT)rDr?r?r@rt�szTextIOBase.readlinecCs|jd�dS)Nr�)rT)rDr?r?r@r��szTextIOBase.detachcCsdS)Nr?)rDr?r?r@r6�szTextIOBase.encodingcCsdS)Nr?)rDr?r?r@�newlines�szTextIOBase.newlinescCsdS)Nr?)rDr?r?r@r7�szTextIOBase.errorsr)r)N)rHrIrJrqr}rYrtr�rr6r�r7r?r?r?r@r��s	


	
r�c@sPeZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
ZdZ	dZ
edd��ZdS)�IncrementalNewlineDecoder�strictcCs,tjj||d�||_||_d|_d|_dS)N)r7rF)�codecs�IncrementalDecoderr��	translate�decoder�seennl�	pendingcr)rDr�r�r7r?r?r@r�s
z"IncrementalNewlineDecoder.__init__FcCs�|jdkr|}n|jj||d�}|jr<|s.|r<d|}d|_|jd�r^|r^|dd�}d|_|jd�}|jd�|}|jd�|}|j|o�|j|o�|jB|o�|jBO_|j	r�|r�|j
dd�}|r�|j
dd�}|S)	N)�final�
Fr
Tz
�
r)r��decoder�rrr�r��_LF�_CR�_CRLFr��replace)rD�inputr��outputZcrlfZcrZlfr?r?r@r�s(

"z IncrementalNewlineDecoder.decodecCs@|jdkrd}d}n|jj�\}}|dK}|jr8|dO}||fS)Nr�rr
)r��getstater�)rDr��flagr?r?r@r2s
z"IncrementalNewlineDecoder.getstatecCs8|\}}t|d@�|_|jdk	r4|jj||d?f�dS)Nr
)�boolr�r��setstate)rD�stater�rr?r?r@r=s
z"IncrementalNewlineDecoder.setstatecCs$d|_d|_|jdk	r |jj�dS)NrF)r�r�r��reset)rDr?r?r@rCs
zIncrementalNewlineDecoder.resetr
r�c
Cs
d|jS)	Nr�r��
�r�r��r�r�r�r�r�r�r)Nr�r�r	rr
rr)r�)rDr?r?r@r�Msz"IncrementalNewlineDecoder.newlinesN)r�)F)
rHrIrJr�r�rrrr�r�r�rr�r?r?r?r@r�s

r�c@s:eZdZdZdEdd�Zdd�Zedd	��Zed
d��Zedd
��Z	edd��Z
dd�Zdd�Zdd�Z
dd�Zdd�Zedd��Zedd��Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�ZdFd*d+�Zd,d-�Zd.d/�ZdGd1d2�Zd3d4�Zd5d6�ZdHd7d8�Zd9d:�ZdId;d<�Z dJd=d>�Z!d?d@�Z"dKdAdB�Z#edCdD��Z$dS)Lr1iNFc
Cs�|dk	r&t|t�r&tdt|�f��|dkr<td|f��|dkr�ytj|j��}Wntt	fk
rnYnX|dkr�yddl
}Wntk
r�d}YnX|jd	�}t|t�s�td
|��t
j|�js�d}t||��|dkr�d}nt|t��std
|��||_||_||_||_||_|dk|_||_|dk|_|�pDtj|_d|_d|_d|_d|_d|_|j j!�|_"|_#t$|j d�|_%d|_&|j"�r�|j'��r�|j j(�}	|	dk�r�y|j)�j*d�Wntk
�r�YnXdS)Nzillegal newline type: %rrr�r��
zillegal newline value: %rr�asciiFzinvalid encoding: %rzG%r is not a text encoding; use codecs.open() to handle arbitrary codecsr�zinvalid errors: %rr�g)Nrr�r�r
)+rrr�typer"r�device_encodingr*r-rP�locale�ImportError�getpreferredencodingr��lookup�_is_text_encoding�LookupErrorr��_line_buffering�	_encoding�_errors�_readuniversal�_readtranslate�_readnl�_writetranslate�linesep�_writenl�_encoder�_decoder�_decoded_chars�_decoded_chars_used�	_snapshotr>r^r��_tellingro�
_has_read1�	_b2cratiorcrX�_get_encoderr)
rDr>r6r7r8r=�
write_throughrr_�positionr?r?r@r�ws`






zTextIOWrapper.__init__cCs�dj|jj|jj�}y
|j}Wntk
r2YnX|dj|�7}y
|j}Wntk
r`YnX|dj|�7}|dj|j�S)Nz<{}.{}z name={0!r}z mode={0!r}z encoding={0!r}>)r�rRrIrJrSr�r2r6)rDr<rSr2r?r?r@r��s



zTextIOWrapper.__repr__cCs|jS)N)r)rDr?r?r@r6�szTextIOWrapper.encodingcCs|jS)N)r)rDr?r?r@r7�szTextIOWrapper.errorscCs|jS)N)r)rDr?r?r@r=�szTextIOWrapper.line_bufferingcCs|jS)N)r�)rDr?r?r@r>�szTextIOWrapper.buffercCs|jrtd��|jS)NzI/O operation on closed file.)rer"r�)rDr?r?r@r^�szTextIOWrapper.seekablecCs
|jj�S)N)r>ra)rDr?r?r@ra�szTextIOWrapper.readablecCs
|jj�S)N)r>rc)rDr?r?r@rc�szTextIOWrapper.writablecCs|jj�|j|_dS)N)r>r[r�r%)rDr?r?r@r[�s
zTextIOWrapper.flushc
Cs0|jdk	r,|jr,z|j�Wd|jj�XdS)N)r>rer[r3)rDr?r?r@r3�szTextIOWrapper.closecCs|jjS)N)r>re)rDr?r?r@re�szTextIOWrapper.closedcCs|jjS)N)r>rS)rDr?r?r@rS�szTextIOWrapper.namecCs
|jj�S)N)r>r*)rDr?r?r@r*�szTextIOWrapper.filenocCs
|jj�S)N)r>r')rDr?r?r@r'�szTextIOWrapper.isattycCs�|jrtd��t|t�s(td|jj��t|�}|js<|j	oBd|k}|rf|jrf|j
dkrf|jd|j
�}|jpr|j
�}|j|�}|jj|�|j	r�|s�d|kr�|j�|jd�d|_|jr�|jj�|S)Nzwrite to closed filezcan't write %s to text streamr�r�r)rer"rrrrRrHr!rrrr�r r(�encoder>r}r[�_set_decoded_charsr$r!r)rDr�ZlengthZhaslf�encoderrr?r?r@r}s&



zTextIOWrapper.writecCstj|j�}||j�|_|jS)N)r��getincrementalencoderrrr )rDZmake_encoderr?r?r@r(szTextIOWrapper._get_encodercCs2tj|j�}||j�}|jr(t||j�}||_|S)N)r��getincrementaldecoderrrrr�rr!)rDZmake_decoderr�r?r?r@�_get_decoders
zTextIOWrapper._get_decodercCs||_d|_dS)Nr)r"r#)rD�charsr?r?r@r,)sz TextIOWrapper._set_decoded_charscCsF|j}|dkr|j|d�}n|j|||�}|jt|�7_|S)N)r#r"r!)rDrl�offsetr1r?r?r@�_get_decoded_chars.sz TextIOWrapper._get_decoded_charscCs$|j|krtd��|j|8_dS)Nz"rewind decoded_chars out of bounds)r#�AssertionError)rDrlr?r?r@�_rewind_decoded_chars8s
z#TextIOWrapper._rewind_decoded_charscCs�|jdkrtd��|jr&|jj�\}}|jr<|jj|j�}n|jj|j�}|}|jj	||�}|j
|�|r�t|�t|j�|_
nd|_
|jr�|||f|_|S)Nz
no decoderg)r!r"r%rr&r>r��_CHUNK_SIZErqr�r,r!r"r'r$)rD�
dec_buffer�	dec_flags�input_chunk�eofZ
decoded_charsr?r?r@�_read_chunk>s 

zTextIOWrapper._read_chunkrcCs(||d>B|d>B|d>Bt|�d>BS)N�@���)r)rDr*r8�
bytes_to_feed�need_eof�
chars_to_skipr?r?r@�_pack_cookiehszTextIOWrapper._pack_cookiecCsFt|d�\}}t|d�\}}t|d�\}}t|d�\}}|||||fS)Nr
r<llll)�divmod)rDZbigint�restr*r8r@rArBr?r?r@�_unpack_cookiers
zTextIOWrapper._unpack_cookiecCs>|jstd��|jstd��|j�|jj�}|j}|dksF|jdkrX|j	rTt
d��|S|j\}}|t|�8}|j}|dkr�|j
||�S|j�}�z�t|j|�}d}x�|dk�r$|jd|f�t|j|d|���}	|	|k�r|j�\}
}|
�s|}||	8}P|t|
�8}d}q�||8}|d}q�Wd}|jd|f�||}|}
|dk�rZ|j
||
�Sd}d}d}x�t|t|��D]v}|d7}|t|j|||d���7}|j�\}}|�r�||k�r�||7}||8}|dd}
}}||k�rvP�qvW|t|jddd	��7}d}||k�rtd
��|j
||
|||�S|j|�XdS)Nz!underlying stream is not seekablez(telling position disabled by next() callzpending decoded textrr
r�rT)r�z'can't reconstruct logical file position)r�rPr%r,r[r>rXr!r$r"r4r!r#rCrrr'rr��range)rDr*r�r8Z
next_inputrBZsaved_stateZ
skip_bytesZ	skip_backrlr�d�	start_posZstart_flagsZ	bytes_fedrAZ
chars_decoded�ir7r?r?r@rXysv





zTextIOWrapper.tellcCs$|j�|dkr|j�}|jj|�S)N)r[rXr>rY)rDrVr?r?r@rY�szTextIOWrapper.truncatecCs*|jdkrtd��|j�|j}d|_|S)Nzbuffer is already detached)r>r"r[r�)rDr>r?r?r@r��s
zTextIOWrapper.detachcs��fdd�}�jrtd���js(td��|dkrL|dkr@td��d}�j�}|dkr�|dkrdtd	���j��jjdd�}�jd
�d�_	�j
r��j
j�||�|S|dkr�td|f��|dkr�td|f���j��j|�\}}}}}	�jj|��jd
�d�_	|dk�r(�j
�r(�j
j�n@�j
�s<|�s<|	�rh�j
�pJ�j
��_
�j
jd
|f�|d
f�_	|	�r��jj|�}
�j�j
j|
|��||
f�_	t�j�|	k�r�td��|	�_||�|S)NcsHy�jp�j�}Wntk
r&YnX|dkr<|jd�n|j�dS)Nr)r r(rrr)r*r-)rDr?r@�_reset_encoder�sz*TextIOWrapper.seek.<locals>._reset_encoderztell on closed filez!underlying stream is not seekabler
rz#can't do nonzero cur-relative seeksrz#can't do nonzero end-relative seeksrzunsupported whence (%r)znegative seek position %rr�z#can't restore logical file position)rer"r�rPrXr[r>rUr,r$r!rrFr0rrqr�r!r"r,r#)rDZcookierWrKr*rIr8r@rArBr9r?)rDr@rU�s\





zTextIOWrapper.seekcCs�|j�|dkrd}|jp |j�}y
|jWn,tk
rX}ztd�|�WYdd}~XnX|dkr�|j�|j|jj	�dd�}|j
d�d|_|Sd}|j|�}x6t|�|kr�|r�|j
�}||j|t|��7}q�W|SdS)	Nr
zan integer is requiredrT)r�rFr)rbr!r0r�r-rr3r�r>rqr,r$r!r;)rDrmr�r�r<r:r?r?r@rq5	s(



zTextIOWrapper.readcCs(d|_|j�}|s$d|_|j|_t�|S)NF)r%rtr$r�rv)rDrwr?r?r@rxN	szTextIOWrapper.__next__cCs�|jrtd��|dkrd	}nt|t�s.td��|j�}d}|jsH|j�d}}�xR|jr�|j	d|�}|dkrz|d}Pnt
|�}n�|j�r|j	d|�}|j	d|�}|d
kr�|dkr�t
|�}n
|d}PnL|dkr�|d}Pn8||kr�|d}Pn$||dk�r|d}Pn
|d}Pn&|j	|j�}|dk�r>|t
|j�}P|dk�r\t
|�|k�r\|}Px|j
��rv|j�r^P�q^W|j�r�||j�7}qT|jd�d|_|SqTW|dk�r�||k�r�|}|jt
|�|�|d|�S)
Nzread from closed filer
zsize must be an integerrr�r�rrrrrr)rer"rrrr3r!r0rrjr!rrr;r"r,r$r5)rDrmrw�startrV�endposZnlposZcrposr?r?r@rtW	sp




zTextIOWrapper.readlinecCs|jr|jjSdS)N)r!r�)rDr?r?r@r��	szTextIOWrapper.newlines)NNNFF)N)rrrr)N)r)N)N)%rHrIrJr6r�r�rr6r7r=r>r^rarcr[r3rerSr*r'r}r(r0r,r3r5r;rCrFrXrYr�rUrqrxrtr�r?r?r?r@r1ZsF
E

*
	c

K
	
Xr1csNeZdZd�fdd�	Zdd�Zdd�Zed	d
��Zedd��Zd
d�Z	�Z
S)�StringIOrr�csftt|�jt�dd|d�|dkr(d|_|dk	rbt|t�sNtdjt	|�j
���|j|�|jd�dS)Nzutf-8�
surrogatepass)r6r7r8Fz*initial_value must be str or None, not {0}r)
r�rNr�r�rrrrr�rrHr}rU)rDZ
initial_valuer8)rRr?r@r��	s

zStringIO.__init__cCsL|j�|jp|j�}|j�}|j�z|j|jj�dd�S|j|�XdS)NT)r�)	r[r!r0rrr�r>r�r)rDr�Z	old_stater?r?r@r��	szStringIO.getvaluecCs
tj|�S)N)�objectr�)rDr?r?r@r��	szStringIO.__repr__cCsdS)Nr?)rDr?r?r@r7�	szStringIO.errorscCsdS)Nr?)rDr?r?r@r6�	szStringIO.encodingcCs|jd�dS)Nr�)rT)rDr?r?r@r��	szStringIO.detach)rr�)rHrIrJr�r�r�rr7r6r�r�r?r?)rRr@rN�	s
rN>rri r)rrNNNTN)4r�abcr�r�r��sys�_threadrr�rZ
_dummy_thread�platformZmsvcrtrr��iorrrr	r�ro�addr�	SEEK_DATAr(r�rArBrKrPr-r,r"�ABCMetarQ�registerr��_ior&r�r�r�r0r/r�r.r�r�r�r1rNr?r?r?r@�<module>st



T	
=
giCZIJUAU^pdb.cpython-36.pyc000064400000132020150335715140007741 0ustar003


 \���"@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
Gdd�de�Zddddd	d
ddd
g	Zdd�Zdd�Zdd�ZGdd�de�ZdZGdd�dejej�Zedk	�rbd
ddddddddd d!d"d#d$d%d&d'd(dd)d*d+d,d-d.d/d0d1d2d3d4d5d6d7g"Zx*eD]"Zeeed8e�jj�d97Z�q,Weejj7Z[[dId:d�ZdJd;d�Z d<d	�Z!d=d
�Z"d>d�Z#dKd?d�Z$d@d�Z%dAZ&dBdC�Z'dDd
�Z(dEZ)dFdG�Z*e+dHk�r�ddl,Z,e,j*�dS)La�	
The Python Debugger Pdb
=======================

To use the debugger in its simplest form:

        >>> import pdb
        >>> pdb.run('<a statement>')

The debugger's prompt is '(Pdb) '.  This will stop in the first
function call in <a statement>.

Alternatively, if a statement terminated with an unhandled exception,
you can use pdb's post-mortem facility to inspect the contents of the
traceback:

        >>> <a statement>
        <exception traceback>
        >>> import pdb
        >>> pdb.pm()

The commands recognized by the debugger are listed in the next
section.  Most can be abbreviated as indicated; e.g., h(elp) means
that 'help' can be typed as 'h' or 'help' (but not as 'he' or 'hel',
nor as 'H' or 'Help' or 'HELP').  Optional arguments are enclosed in
square brackets.  Alternatives in the command syntax are separated
by a vertical bar (|).

A blank line repeats the previous command literally, except for
'list', where it lists the next 11 lines.

Commands that the debugger doesn't recognize are assumed to be Python
statements and are executed in the context of the program being
debugged.  Python statements can also be prefixed with an exclamation
point ('!').  This is a powerful way to inspect the program being
debugged; it is even possible to change variables or call functions.
When an exception occurs in such a statement, the exception name is
printed but the debugger's state is not changed.

The debugger supports aliases, which can save typing.  And aliases can
have parameters (see the alias help entry) which allows one a certain
level of adaptability to the context under examination.

Multiple commands may be entered on a single line, separated by the
pair ';;'.  No intelligence is applied to separating the commands; the
input is split at the first ';;', even if it is in the middle of a
quoted string.

If a file ".pdbrc" exists in your home directory or in the current
directory, it is read in and executed as if it had been typed at the
debugger prompt.  This is particularly useful for aliases.  If both
files exist, the one in the home directory is read first and aliases
defined there can be overridden by the local file.  This behavior can be
disabled by passing the "readrc=False" argument to the Pdb constructor.

Aside from aliases, the debugger is not directly programmable; but it
is implemented as a class from which you can derive your own debugger
class, which you can make as fancy as you like.


Debugger commands
=================

�Nc@seZdZdZdS)�RestartzBCauses a debugger to be restarted for the debugged python program.N)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.6/pdb.pyrUsr�run�pm�Pdb�runeval�runctx�runcall�	set_trace�post_mortem�helpcCsxtjdtj|��}yt|�}Wntk
r4dSX|�4x,t|dd�D]\}}|j|�rJ|||fSqJWWdQRXdS)Nzdef\s+%s\s*[(]�)�start)�re�compile�escape�open�OSError�	enumerate�match)�funcname�filenameZcre�fp�lineno�linerrr�
find_function\s
r cCsXtj|�\}}tj|�r,|j|jkr,|dfStj|�r>|dfStj||d��|dfS)Nr)�inspectZ
findsourceZisframe�	f_globals�f_localsZismoduleZgetblock)�obj�linesrrrr�getsourcelinesis
r&cCs8ttj|��}|j�x|D]\}}||kr|SqWdS)Nr)�list�disZfindlinestarts�reverse)�codeZlastiZ
linestarts�irrrr�lasti2linenorsr,c@seZdZdZdd�ZdS)�_rstrz#String that doesn't quote its repr.cCs|S)Nr)�selfrrr�__repr__}sz_rstr.__repr__N)rrrrr/rrrrr-{sr-z
-> c@seZdZdZd�dd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�ZeZd�d8d9�Zd:d;�ZeZ eZ!eZ"d<d=�Z#eZ$d>d?�Z%d@dA�Z&dBdC�Z'eZ(dDdE�Z)eZ*dFdG�Z+eZ,dHdI�Z-eZ.dJdK�Z/e/Z0eZ1eZ2dLdM�Z3e3Z4e3Z5dNdO�Z6dPdQ�Z7e7Z8dRdS�Z9e9Z:dTdU�Z;e;Z<dVdW�Z=e=Z>dXdY�Z?e?Z@dZd[�ZAeAZBd\d]�ZCeCZDd^d_�ZEeEZFZGd`da�ZHeHZIdbdc�ZJeZKddde�ZLeLZMeLZNdfdg�ZOdhdi�ZPePZQdjdk�ZReRZSdldm�ZTd�dndo�ZUdpdq�ZVdrds�ZWeZXeZYeZZdtdu�Z[e[Z\dvdw�Z]e]Z^dxdy�Z_eZ`fdfdzd{�Zad|d}�ZbeZcd~d�ZdeZed�d��Zfd�d��Zgd�d��Zhd�d��Zid�d��Zjd�d��Zkd�d�d�d�d�d�gZld�d��Zmenfd�d��Zod�d��ZpepZqd�d��Zrd�d��Zsd�d��Ztd�d��ZudS)�rN�tabFTc
$CsJtjj||d�tjj||||�|r,d|_d|_i|_i|_d|_	d|_
i|_yddl}|j
d�Wntk
rzYnXd|_||_g|_|�r(dtjkr�tjd}y.ttjj|d���}	|jj|	�WdQRXWntk
r�YnXy$td��}	|jj|	�WdQRXWntk
�r&YnXi|_i|_i|_d|_d|_dS)	N)�skiprz(Pdb) �Fz 	
`@#$%^&*()=+[{]}\|;:'",<>?�HOMEz.pdbrc)�bdb�Bdb�__init__�cmd�CmdZuse_rawinput�prompt�aliases�
displaying�
mainpyfile�_wait_for_mainpyfile�	tb_lineno�readlineZset_completer_delims�ImportError�allow_kbdint�nosigint�rcLines�os�environr�path�join�extendr�commands�commands_doprompt�commands_silent�commands_defining�
commands_bnum)
r.�completekey�stdin�stdoutr1rBZreadrcr?ZenvHomeZrcFilerrrr6�sH


zPdb.__init__cCs*|jr
t�|jd�|j�|j|�dS)Nz-
Program interrupted. (Use 'cont' to resume).)rA�KeyboardInterrupt�message�set_stepr)r.Zsignum�framerrr�sigint_handler�s

zPdb.sigint_handlercCstjj|�|j�dS)N)r4r5�reset�forget)r.rrrrV�sz	Pdb.resetcCs&d|_g|_d|_d|_|jj�dS)Nr)r�stack�curindex�curframer>�clear)r.rrrrW�s
z
Pdb.forgetcCsl|j�|j||�\|_|_x*|rFt|jj|j�}||j|j<|j	}qW|j|jd|_
|j
j|_|j
�S)Nr)rWZ	get_stackrXrYr,�tb_frame�f_code�tb_lastir>�tb_nextrZr#�curframe_locals�execRcLines)r.�f�tbrrrr�setup�s

z	Pdb.setupcCsh|js
dS|j}|j�g|_xD|rb|j�j�}|r |ddkr |j|�r |jt|�7_dSq WdS)Nr�#T)rCr)�pop�strip�onecmd�reversed)r.rCrrrrra�s
zPdb.execRcLinescCs.|jr
dS|j|�r*|jd�|j|d�dS)znThis method is called when there is the remote possibility
        that we ever need to stop in this function.Nz--Call--)r=Z	stop_hererR�interaction)r.rTZ
argument_listrrr�	user_call�s


z
Pdb.user_callcCsH|jr.|j|j|jj�ks$|jdkr(dSd|_|j|�rD|j|d�dS)z;This function is called when we stop or break at this line.rNF)r=r<�canonicr]�co_filename�f_lineno�bp_commandsrj)r.rTrrr�	user_line�s

z
Pdb.user_linecCs�t|dd�r�|j|jkr�|j}d|_|j}|j|d�x|j|D]}|j|�qBW||_|j|sv|j|j|j	�|j
|r�|j�|j�dSdS)z�Call every command that was set for the current active breakpoint
        (if there is one).

        Returns True if the normal interaction function must be called,
        False otherwise.�	currentbpFrNr)
�getattrrqrI�lastcmdrdrhrK�print_stack_entryrXrYrJ�_cmdlooprW)r.rTrqZlastcmd_backrrrrros 

zPdb.bp_commandscCs.|jr
dS||jd<|jd�|j|d�dS)z7This function is called when a return trap is set here.N�
__return__z
--Return--)r=r#rRrj)r.rTZreturn_valuerrr�user_returns


zPdb.user_returncCsj|jr
dS|\}}}||f|jd<|r4|tkr4dnd}|jd|tj||�dj�f�|j||�dS)zoThis function is called if an exception occurs,
        but only if we are to stop at or just below this level.NZ
__exception__z	Internal r2z%s%sr���)r=r#�
StopIterationrR�	traceback�format_exception_onlyrgrj)r.rT�exc_info�exc_type�	exc_value�
exc_traceback�prefixrrr�user_exception's
zPdb.user_exceptioncCsDx>yd|_|j�d|_PWqtk
r:|jd�YqXqWdS)NTFz--KeyboardInterrupt--)rA�cmdlooprQrR)r.rrrru;szPdb._cmdloopcCsb|jj|j�}|r^xJ|j�D]>\}}|j|�}||k	r||kr|||<|jd|||f�qWdS)Nzdisplay %s: %r  [old: %r])r;�getrZ�items�_getval_exceptrR)r.r;�exprZoldvalueZnewvaluerrr�preloopHs
zPdb.preloopcCsZtjrtjtjtj�dt_|j||�r4|j�dS|j|j|j�|j	�|j�dS)N)
r�_previous_sigint_handler�signal�SIGINTrdrWrtrXrYru)r.rTrzrrrrjUszPdb.interactioncCs|dk	r|jt|��dS)z{Custom displayhook for the exec in default(), which prevents
        assignment of the _ variable in the builtins.
        N)rR�repr)r.r$rrr�displayhookcszPdb.displayhookc	Cs�|dd�dkr|dd�}|j}|jj}ydt|ddd�}tj}tj}tj}z(|jt_|jt_|jt_t|||�Wd|t_|t_|t_XWn4tj	�dd�}|j
tj|�dj
��YnXdS)Nr�!�
z<stdin>Zsingle�rx)r`rZr"r�sysrPrOr��execr|�errorrzr{rg)	r.r�locals�globalsr*Zsave_stdoutZ
save_stdinZsave_displayhookr|rrr�defaultks(zPdb.defaultcCs�|j�s|S|j�}xx|d|jkr�|j|d}d}x0|dd�D] }|jdt|�|�}|d7}qDW|jddj|dd���}|j�}qW|ddkr�|jd�}|dkr�||d	d�j�}|jj	|�|d|�j
�}|S)
z*Handle alias expansion and ';;' separator.rrN�%z%*� �aliasz;;r�)rg�splitr:�replace�strrG�find�lstrip�cmdqueue�append�rstrip)r.r�argsZiiZtmpArgZmarker�nextrrr�precmd�s&
z
Pdb.precmdcCs"|jstjj||�S|j|�SdS)z�Interpret the argument as though it had been typed in response
        to the prompt.

        Checks whether this line is typed at the normal prompt or in
        a breakpoint command list definition.
        N)rLr7r8rh�handle_command_def)r.rrrrrh�sz
Pdb.onecmdcCs�|j|�\}}}|sdS|dkr0d|j|j<dS|dkrBg|_dS|j|j}|rf|j|d|�n
|j|�yt|d|�}Wntk
r�|j}YnX|j	|j
kr�d|j|j<g|_dSdS)	z8Handles one command line during command list definition.NZsilentT�endrr��do_F)Z	parselinerKrMr�rIr�rr�AttributeErrorr�r�commands_resumingrJ)r.rr7�argZcmdlist�funcrrrr��s,
zPdb.handle_command_defcCst||jd�dS)N)�file)�printrP)r.�msgrrrrR�szPdb.messagecCstd||jd�dS)Nz***)r�)r�rP)r.r�rrrr��sz	Pdb.errorcCs�|j�jd�rgSy|j||||�}Wntk
r>g}YnXtj|d�}xP|D]H}tjj|�rt|j|d�qTtjj	|�rT|j
�jd�rT|j|d�qTW|S)	N�:�,�*�/�.py�.pyw)r�r�)r�r�)rg�endswith�_complete_expression�	Exception�globrDrF�isdirr��isfile�lower)r.�textr�begidx�endidxZret�globs�fnrrr�_complete_location�s

zPdb._complete_locationcs�fdd�ttjj�D�S)Ncs.g|]&\}}|dk	rt|�j��rt|��qS)N)r��
startswith)�.0r+�bp)r�rr�
<listcomp>�sz*Pdb._complete_bpnumber.<locals>.<listcomp>)rr4�
Breakpoint�
bpbynumber)r.r�rr�r�r)r�r�_complete_bpnumber�szPdb._complete_bpnumbercs�|js
gS|jjj�}|j|j�d�kr��jd��y0|�d}x�dd�D]}t||�}qPWWnttfk
r|gSXdj	�dd��d���fdd�t
|�D�S�fdd�|j�D�SdS)	N�.rrcs"g|]}|j�d�r�|�qS)rrx)r�)r��n)�dottedr�rrr��sz,Pdb._complete_expression.<locals>.<listcomp>csg|]}|j��r|�qSr)r�)r�r�)r�rrr��srxrx)rZr"�copy�updater`r�rr�KeyErrorr�rG�dir�keys)r.r�rr�r��nsr$�partr)r�r�r�rr��s
zPdb._complete_expressioncCs(|sttjj�d}n"yt|�}Wn|jd�dS||_||jkrf|j||j||j	|f}nd}g|j|<d|j|<d|j	|<|j
}d|_
d|_zzy|j�Wnht
k
�r|r�|d|j|<|d|j|<|d|j	|<n|j|=|j|=|j	|=|jd	�YnXWdd|_||_
XdS)
a4commands [bpnumber]
        (com) ...
        (com) end
        (Pdb)

        Specify a list of commands for breakpoint number bpnumber.
        The commands themselves are entered on the following lines.
        Type a line containing just 'end' to terminate the commands.
        The commands are executed when the breakpoint is hit.

        To remove all commands from a breakpoint, type commands and
        follow it immediately with end; that is, give no commands.

        With no bpnumber argument, commands refers to the last
        breakpoint set.

        You can use breakpoint commands to start your program up
        again.  Simply use the continue command, or step, or any other
        command that resumes execution.

        Specifying any command resuming execution (currently continue,
        step, next, return, jump, quit and their abbreviations)
        terminates the command list (as if that command was
        immediately followed by end).  This is because any time you
        resume execution (even with a simple next or step), you may
        encounter another breakpoint -- which could have its own
        command list, leading to ambiguities about which list to
        execute.

        If you use the 'silent' command in the command list, the usual
        message about stopping at a breakpoint is not printed.  This
        may be desirable for breakpoints that are to print a specific
        message and then continue.  If none of the other commands
        print anything, you will see no sign that the breakpoint was
        reached.
        rz.Usage: commands [bnum]
        ...
        endNTFz(com) rr�z1command definition aborted, old commands restored)�lenr4r�r��intr�rMrIrJrKr9rLr�rQ)r.r�ZbnumZold_command_defsZprompt_backrrr�do_commandss@%




zPdb.do_commandsrcCs@|s<|jr8|jd�x"tjjD]}|r|j|j��qWdSd}d}d}|jd�}|dkr~||dd�j�}|d|�j�}|j	d�}d}	|dk�r|d|�j�}|j
|�}
|
s�|jd|�dS|
}||dd�j�}yt|�}Wn$t
k
�r|jd|�dSXn�yt|�}Wn�t
k
�r�yt||jj|j�}Wn|}YnXy.t|d	��rl|j}|j}|j}	|j}|j}Wn@|j|�\}
}}|
�s�|jd
|�dS|
}	t|�}YnXYnX|�s�|j�}|j||�}|�r<|j|||||	�}|�r|j|�n*|j||�d}|jd|j|j|jf�dS)
a�b(reak) [ ([filename:]lineno | function) [, condition] ]
        Without argument, list all breaks.

        With a line number argument, set a break at this line in the
        current file.  With a function name, set a break at the first
        executable line of that function.  If a second argument is
        present, it is a string specifying an expression which must
        evaluate to true before the breakpoint is honored.

        The line number may be prefixed with a filename and a colon,
        to specify a breakpoint in another file (probably one that
        hasn't been loaded yet).  The file is searched for on
        sys.path; the .py suffix may be omitted.
        z!Num Type         Disp Enb   WhereNr�rrr�z%r not found from sys.pathzBad lineno: %s�__func__zJThe specified object %r is not a function or was not found along sys.path.zBreakpoint %d at %s:%drx) �breaksrRr4r�r�Zbpformatr�r�r��rfind�lookupmoduler�r��
ValueError�evalrZr"r`�hasattrr��__code__�co_name�co_firstlinenorm�lineinfo�defaultFile�	checklineZ	set_break�
get_breaks�numberr�r)r.r�Z	temporaryr�rr�condZcommaZcolonrrbr�r*�ok�lnr�errrrr�do_breakTs~






zPdb.do_breakcCs"|jjj}|dkr|jr|j}|S)zProduce a reasonable default.z<string>)rZr]rmr<)r.rrrrr��s
zPdb.defaultFilecCs|j|d�dS)z�tbreak [ ([filename:]lineno | function) [, condition] ]
        Same arguments as break, but sets a temporary breakpoint: it
        is automatically deleted when first hit.
        rN)r�)r.r�rrr�	do_tbreak�sz
Pdb.do_tbreakc
Cs�d}|jd�}t|�dkr(|dj�}nt|�dkrB|dj�}n|S|dkrR|S|jd�}|ddkr~|d=t|�dkr~|S|j�}t|�dkr�|d}n|j|d�}|r�|}|d}t||�}	|	p�|S)	N�'rr�r2r�r.)NNN)r�r�rgr�r�r )
r.Z
identifierZfailedZidstring�id�partsZfname�itemrbZanswerrrrr��s.



zPdb.lineinfocCs�t|d�r|jjnd}tj|||�}|s6|jd�dS|j�}|sp|ddksp|dd�dksp|dd�dkr~|jd	�dS|S)
z�Check whether specified line seems to be executable.

        Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank
        line or EOF). Warning: testing is not comprehensive.
        rZNzEnd of filerrer�z"""z'''zBlank or comment)r�rZr"�	linecache�getlinerRrgr�)r.rrr�rrrrr��s
 
z
Pdb.checklinecCsl|j�}x^|D]V}y|j|�}Wn,tk
rL}z|j|�WYdd}~XqX|j�|jd|�qWdS)z�enable bpnumber [bpnumber ...]
        Enables the breakpoints given as a space separated list of
        breakpoint numbers.
        Nz
Enabled %s)r��get_bpbynumberr�r��enablerR)r.r�r�r+r�r�rrr�	do_enable�s
z
Pdb.do_enablecCsl|j�}x^|D]V}y|j|�}Wn,tk
rL}z|j|�WYdd}~XqX|j�|jd|�qWdS)aNdisable bpnumber [bpnumber ...]
        Disables the breakpoints given as a space separated list of
        breakpoint numbers.  Disabling a breakpoint means it cannot
        cause the program to stop execution, but unlike clearing a
        breakpoint, it remains in the list of breakpoints and can be
        (re-)enabled.
        NzDisabled %s)r�r�r�r��disablerR)r.r�r�r+r�r�rrr�
do_disable
s
zPdb.do_disablecCs�|jdd�}y|d}Wntk
r0d}YnXy|j|dj��}WnHtk
rf|jd�YnXtk
r�}z|j|�WYdd}~Xn.X||_|s�|jd|j�n|jd|j�dS)a#condition bpnumber [condition]
        Set a new condition for the breakpoint, an expression which
        must evaluate to true before the breakpoint is honored.  If
        condition is absent, any existing condition is removed; i.e.,
        the breakpoint is made unconditional.
        r�rNrzBreakpoint number expectedz#Breakpoint %d is now unconditional.z$New condition set for breakpoint %d.)	r��
IndexErrorr�rgr�r�r�rRr�)r.r�r�r�r�r�rrr�do_condition!s
zPdb.do_conditioncCs�|j�}yt|dj��}Wnd}YnXy|j|dj��}WnHtk
rb|jd�Ynvtk
r�}z|j|�WYdd}~XnLX||_|dkr�|dkr�d|}nd}|jd||j	f�n|jd|j	�dS)	a�ignore bpnumber [count]
        Set the ignore count for the given breakpoint number.  If
        count is omitted, the ignore count is set to 0.  A breakpoint
        becomes active when the ignore count is zero.  When non-zero,
        the count is decremented each time the breakpoint is reached
        and the breakpoint is not disabled and any associated
        condition evaluates to true.
        rrzBreakpoint number expectedNz%d crossingsz
1 crossingz%Will ignore next %s of breakpoint %d.z-Will stop next time breakpoint %d is reached.)
r�r�rgr�r�r�r��ignorerRr�)r.r�r��countr�r�Zcountstrrrr�	do_ignore<s(	

z
Pdb.do_ignorec
!Cs�|sxytd�}Wntk
r(d}YnX|j�j�}|dkrtdd�tjjD�}|j�x|D]}|jd|�q^WdSd	|k�r|j	d	�}|d|�}||d
d�}yt
|�}Wntk
r�d|}YnX|j||�}|j
||�}|�r�|j|�nx|D]}|jd|��qWdS|j�}	xd|	D]\}y|j|�}Wn.tk
�rl}z|j|�WYdd}~XnX|j|�|jd|��q,WdS)
a=cl(ear) filename:lineno
cl(ear) [bpnumber [bpnumber...]]
        With a space separated list of breakpoint numbers, clear
        those breakpoints.  Without argument, clear all breaks (but
        first ask confirmation).  With a filename:lineno argument,
        clear all breaks at that line in that file.
        zClear all breaks? �no�y�yescSsg|]}|r|�qSrr)r�r�rrrr�msz Pdb.do_clear.<locals>.<listcomp>z
Deleted %sNr�rzInvalid line number (%s))r�r�)�input�EOFErrorrgr�r4r�r�Zclear_all_breaksrRr�r�r�r�Zclear_breakr�r�r�Zclear_bpbynumber)
r.r�ZreplyZbplistr�r+rrr�Z
numberlistrrr�do_clear_sF






zPdb.do_clearcCs|j�dS)z�w(here)
        Print a stack trace, with the most recent frame at the bottom.
        An arrow indicates the "current frame", which determines the
        context of most commands.  'bt' is an alias for this command.
        N)�print_stack_trace)r.r�rrr�do_where�szPdb.do_wherecCs`d|kot|j�kns"t�||_|j|jd|_|jj|_|j|j|j�d|_dS)Nr)	r�rX�AssertionErrorrYrZr#r`rtr)r.r�rrr�
_select_frame�s"
zPdb._select_framecCsx|jdkr|jd�dSyt|p"d�}Wn"tk
rJ|jd|�dSX|dkrZd}ntd|j|�}|j|�dS)z�u(p) [count]
        Move the current frame count (default one) levels up in the
        stack trace (to an older frame).
        rzOldest frameNrzInvalid frame count (%s))rYr�r�r��maxr)r.r�r��newframerrr�do_up�s

z	Pdb.do_upcCs�|jdt|j�kr"|jd�dSyt|p,d�}Wn"tk
rT|jd|�dSX|dkrnt|j�d}ntt|j�d|j|�}|j|�dS)z�d(own) [count]
        Move the current frame count (default one) levels down in the
        stack trace (to a newer frame).
        rzNewest frameNzInvalid frame count (%s)r)rYr�rXr�r�r��minr)r.r�r�rrrr�do_down�s
zPdb.do_downcCsf|rPyt|�}Wn"tk
r2|jd|�dSX||jjkrT|jd�dSnd}|j|j|�dS)aNunt(il) [lineno]
        Without argument, continue execution until the line with a
        number greater than the current one is reached.  With a line
        number, continue execution until a line with a number greater
        or equal to that is reached.  In both cases, also stop when
        the current frame returns.
        zError in argument: %rNz7"until" line number is smaller than current line numberr)r�r�r�rZrnZ	set_until)r.r�rrrr�do_until�s
zPdb.do_untilcCs|j�dS)z�s(tep)
        Execute the current line, stop at the first possible occasion
        (either in a function that is called or in the current
        function).
        r)rS)r.r�rrr�do_step�szPdb.do_stepcCs|j|j�dS)zxn(ext)
        Continue execution until the next line in the current function
        is reached or it returns.
        r)Zset_nextrZ)r.r�rrr�do_next�szPdb.do_nextcCs<|r4ddl}tjdd�}|j|�t_|tjdd�<t�dS)arun [args...]
        Restart the debugged python program. If a string is supplied
        it is split with "shlex", and the result is used as the new
        sys.argv.  History, breakpoints, actions and debugger options
        are preserved.  "restart" is an alias for "run".
        rNr)�shlexr��argvr�r)r.r�r
Zargv0rrr�do_run�sz
Pdb.do_runcCs|j|j�dS)zPr(eturn)
        Continue execution until the current function returns.
        r)Z
set_returnrZ)r.r�rrr�	do_returnsz
Pdb.do_returncCs>|js2ytjtj|j�t_Wntk
r0YnX|j�dS)z]c(ont(inue))
        Continue execution, only stop when a breakpoint is encountered.
        r)rBr�r�rUrr�r�Zset_continue)r.r�rrr�do_continueszPdb.do_continuecCs�|jdt|j�kr"|jd�dSyt|�}Wntk
rL|jd�YnnXy:||j_|j|jd|f|j|j<|j|j|j�Wn0tk
r�}z|jd|�WYdd}~XnXdS)a�j(ump) lineno
        Set the next line that will be executed.  Only available in
        the bottom-most frame.  This lets you jump back and execute
        code again, or jump forward to skip code that you don't want
        to run.

        It should be noted that not all jumps are allowed -- for
        instance it is not possible to jump into the middle of a
        for loop or out of a finally clause.
        rz)You can only jump within the bottom frameNz)The 'jump' command requires a line numberrzJump failed: %s)	rYr�rXr�r�r�rZrnrt)r.r��errr�do_jump"s
zPdb.do_jumpcCsztjd�|jj}|j}t|j|j|j�}d|j	j
�|_	|jd�tj|j
|||f�|jd�tj|j�|j|_dS)z�debug code
        Enter a recursive debugger that steps through the code
        argument (which is an arbitrary expression or statement to be
        executed in the current environment).
        Nz(%s) zENTERING RECURSIVE DEBUGGERzLEAVING RECURSIVE DEBUGGER)r��settracerZr"r`rrNrOrPr9rgrR�call_tracingr	Ztrace_dispatchrs)r.r�r�r��prrr�do_debug?s


zPdb.do_debugcCsd|_|j�dS)z[q(uit)
exit
        Quit from the debugger. The program being executed is aborted.
        Tr)�_user_requested_quit�set_quit)r.r�rrr�do_quitRszPdb.do_quitcCs|jd�d|_|j�dS)z=EOF
        Handles the receipt of EOF as a command.
        r2Tr)rRrr)r.r�rrr�do_EOF]s
z
Pdb.do_EOFcCs�|jj}|j}|j}|jd@r&|d}|jd@r8|d}xJt|�D]>}|j|}||krp|jd|||f�qB|jd|f�qBWdS)zHa(rgs)
        Print the argument list of the current function.
        �r�z%s = %rz%s = *** undefined ***N)rZr]r`�co_argcount�co_flags�range�co_varnamesrR)r.r��co�dictr�r+�namerrr�do_argsfs


zPdb.do_argscCs.d|jkr |jt|jd��n
|jd�dS)zQretval
        Print the return value for the last return of a function.
        rvzNot yet returned!N)r`rRr�r�)r.r�rrr�	do_retvalws
z
Pdb.do_retvalc
CsNyt||jj|j�Stj�dd�}|jtj|�dj	���YnXdS)Nr�rrx)
r�rZr"r`r�r|r�rzr{rg)r.r�r|rrr�_getval�szPdb._getvalc
Cshy.|dkrt||jj|j�St||j|j�SWn4tj�dd�}tj|�dj	�}t
d|�SdS)Nr�rz** raised %s **rx)r�rZr"r`r#r�r|rzr{rgr-)r.r�rTr|r�rrrr��szPdb._getval_exceptc
Cs*y|jt|j|���WnYnXdS)z@p expression
        Print the value of the expression.
        N)rRr�r')r.r�rrr�do_p�szPdb.do_pc
Cs,y|jtj|j|���WnYnXdS)zHpp expression
        Pretty-print the value of the expression.
        N)rR�pprintZpformatr')r.r�rrr�do_pp�sz	Pdb.do_ppcCsdd|_d}|r�|dkr�y^d|krX|jd�\}}t|j��}t|j��}||krr||}nt|j��}td|d�}Wq�tk
r�|jd|�dSXn0|jdks�|dkr�td|jj	d�}n
|jd}|dkr�|d}|jj
j}|j|�}yZt
j||jj�}|j||d|�|||j�t|t|��|_t|�|k�rF|jd	�Wntk
�r^YnXdS)
a�l(ist) [first [,last] | .]

        List source code for the current file.  Without arguments,
        list 11 lines around the current line or continue the previous
        listing.  With . as argument, list 11 lines around the current
        line.  With one argument, list 11 lines starting at that line.
        With two arguments, list the given range; if the second
        argument is less than the first, it is a count.

        The current line in the current frame is indicated by "->".
        If an exception is being debugged, the line where the
        exception was originally raised or propagated is indicated by
        ">>", if it differs from the current line.
        r'Nr�r�r�zError in argument: %r�
z[EOF])rsr�r�rgrr�r�rrZrnr]rm�get_file_breaksr��getlinesr"�_print_linesrr�rRrQ)r.r�Zlast�firstr�	breaklistr%rrr�do_list�s>



zPdb.do_listcCsh|jjj}|j|�}yt|j�\}}Wn*tk
rP}z|j|�dSd}~XnX|j||||j�dS)z\longlist | ll
        List the whole source code for the current function or frame.
        N)rZr]rmr-r&rr�r/)r.r�rr1r%rr�rrr�do_longlist�s


zPdb.do_longlistcCsjy|j|�}Wn
dSyt|�\}}Wn.ttfk
rX}z|j|�dSd}~XnX|j||�dS)z^source expression
        Try to get source code for the given object and display it.
        N)r'r&r�	TypeErrorr�r/)r.r�r$r%rr�rrr�	do_source�s
z
Pdb.do_sourcec
Cs�|r|j}|jj|d
�}nd}}x�t||�D]|\}}t|�jd�}	t|	�dkrX|	d7}	||krj|	d7}	n|	d7}	||kr�|	d7}	n||kr�|	d7}	|j|	d|j��q.Wd	S)zPrint a range of lines.rr�rr��Bz->z>>�	Nrxrx)	rnr>r�rr��rjustr�rRr�)
r.r%rr�rTZcurrent_linenoZ
exc_linenorr�srrrr/�s 

zPdb._print_linescCs�y|j|�}Wn
dSd}y
|j}Wntk
r<YnX|rV|jd|j�dSy|jj}Wntk
rvYnX|r�|jd|j�dS|jtkr�|jd|j|j	f�dS|jt|��dS)z;whatis arg
        Print the type of the argument.
        NzFunction %sz	Method %szClass %s.%s)
r'r�r�rRr�r��	__class__�typerr)r.r��valuer*rrr�	do_whatiss.

z
Pdb.do_whatiscCsp|s<|jd�x\|jj|ji�j�D]}|jd|�q$Wn0|j|�}||jj|ji�|<|jd||f�dS)z�display [expression]

        Display the value of the expression if it changed, each time execution
        stops in the current frame.

        Without expression, list all display expressions for the current frame.
        zCurrently displaying:z%s: %rzdisplay %s: %rN)rRr;r�rZr�r��
setdefault)r.r�r��valrrr�
do_display4s

zPdb.do_displaycCsT|r@y|jj|ji�|=WqPtk
r<|jd|�YqPXn|jj|jd�dS)z�undisplay [expression]

        Do not display the expression any more in the current frame.

        Without expression, clear all display expressions for the current frame.
        znot displaying %sN)r;r�rZr�r�rf)r.r�rrr�do_undisplayGszPdb.do_undisplaycs�fdd�|jj|ji�D�S)Ncsg|]}|j��r|�qSr)r�)r�r)r�rrr�Wsz*Pdb.complete_undisplay.<locals>.<listcomp>)r;r�rZ)r.r�rr�r�r)r�r�complete_undisplayVszPdb.complete_undisplaycCs*|jjj�}|j|j�tjd|d�dS)z�interact

        Start an interactive interpreter whose global namespace
        contains all the (global and local) names found in the current scope.
        z
*interactive*)ZlocalN)rZr"r�r�r`r*�interact)r.r�r�rrr�do_interactZszPdb.do_interactcCs�|j�}t|�dkrLt|jj��}x$|D]}|jd||j|f�q(WdS|d|jkr�t|�dkr�|jd|d|j|df�ndj|dd��|j|d<dS)acalias [name [command [parameter parameter ...] ]]
        Create an alias called 'name' that executes 'command'.  The
        command must *not* be enclosed in quotes.  Replaceable
        parameters can be indicated by %1, %2, and so on, while %* is
        replaced by all the parameters.  If no command is given, the
        current alias for name is shown. If no name is given, all
        aliases are listed.

        Aliases may be nested and can contain anything that can be
        legally typed at the pdb prompt.  Note!  You *can* override
        internal pdb commands with aliases!  Those internal commands
        are then hidden until the alias is removed.  Aliasing is
        recursively applied to the first word of the command line; all
        other words in the line are left alone.

        As an example, here are two useful aliases (especially when
        placed in the .pdbrc file):

        # Print instance variables (usage "pi classInst")
        alias pi for k in %1.__dict__.keys(): print("%1.",k,"=",%1.__dict__[k])
        # Print instance variables in self
        alias ps pi self
        rz%s = %sNrr�)r�r��sortedr:r�rRrG)r.r�r�r�r�rrr�do_aliasds
"zPdb.do_aliascCs6|j�}t|�dkrdS|d|jkr2|j|d=dS)z9unalias name
        Delete the specified alias.
        rN)r�r�r:)r.r�r�rrr�
do_unalias�s
zPdb.do_unaliascs�fdd�|jD�S)Ncsg|]}|j��r|�qSr)r�)r��a)r�rrr��sz(Pdb.complete_unalias.<locals>.<listcomp>)r:)r.r�rr�r�r)r�r�complete_unalias�szPdb.complete_unaliasrrrrrrcCs8yx|jD]}|j|�q
WWntk
r2YnXdS)N)rXrtrQ)r.�frame_linenorrrr�s
zPdb.print_stack_tracecCs6|\}}||jkrd}nd}|j||j||��dS)Nz> z  )rZrRZformat_stack_entry)r.rJZ
prompt_prefixrTrr�rrrrt�s
zPdb.print_stack_entrycCs�|stjj||�Sy<yt|d|�}|�Stk
rJt|d|�}YnXWn"tk
rp|jd|�Yn0Xtjjdkr�|jd|�dS|j	|j
j��dS)z�h(elp)
        Without argument, print the list of available commands.
        With a command name as argument, print help about that command.
        "help pdb" shows the full pdb documentation.
        "help exec" gives help on the ! command.
        Zhelp_r�zNo help for %rr�zJNo help for %r; please do not run Python with -OO if you need command helpN)r7r8�do_helprrr�r�r��flags�optimizerRrr�)r.r�ZtopicZcommandrrrrK�szPdb.do_helpcCs|j|jjpdj��dS)a�(!) statement
        Execute the (one-line) statement in the context of the current
        stack frame.  The exclamation point can be omitted unless the
        first word of the statement resembles a debugger command.  To
        assign to a global variable you must always prefix the command
        with a 'global' command, e.g.:
        (Pdb) global list_options; list_options = ['-l']
        (Pdb)
        r2N)rR�	help_execrrg)r.rrrrN�s
z
Pdb.help_execcCs
t�dS)N)r)r.rrr�help_pdb�szPdb.help_pdbcCs�tjj|�rtjj|�r|Stjjtjd|�}tjj|�rP|j|�|jkrP|Stjj|�\}}|dkrp|d}tjj|�r�|SxHtjD]>}xtjj	|�r�tj
|�}q�Wtjj||�}tjj|�r�|Sq�WdS)z�Helper function for break/clear parsing -- may be overridden.

        lookupmodule() translates (possibly incomplete) file or module name
        into an absolute file name.
        rr2z.pyN)rDrF�isabs�existsrGr�rlr<�splitext�islink�readlink)r.rrb�rootZext�dirname�fullnamerrrr��s"zPdb.lookupmodulec
Cstddl}|jj�|jjd|td��d|_|j|�|_d|_t	|d��}d|j
�|jf}WdQRX|j|�dS)Nr�__main__)r�__file__�__builtins__TF�rbzexec(compile(%r, %r, 'exec')))rX�__dict__r[r�rZr=rlr<rr�readr	)r.rrXr�	statementrrr�
_runscript�s

zPdb._runscript)r0NNNFT)r)N)vrrrr�r6rUrVrWrdrarkrprorwr�rur�rjr�r�r�rhr�rRr�r�r�r�r�Zcomplete_commandsr�r�Zdo_bZcomplete_breakZ
complete_br�Zcomplete_tbreakr�r�r�Zcomplete_enabler�Zcomplete_disabler�Zcomplete_conditionr�Zcomplete_ignorerZdo_clZcomplete_clearZcomplete_clrZdo_wZdo_btrrZdo_ur	Zdo_dr
Zdo_untrZdo_srZdo_nrZ
do_restartrZdo_rrZdo_cZdo_contrZdo_jrZcomplete_debugrZdo_qZdo_exitrr%Zdo_ar&Zdo_rvr'r�r(r*Zcomplete_printZ
complete_pZcomplete_ppr2Zdo_lr3Zdo_llr5Zcomplete_sourcer/r=Zcomplete_whatisr@Zcomplete_displayrArBrDrFrGrIr�r�line_prefixrtrKZdo_hrNrOr�r_rrrrr�s�
/	


M
]!!.	
		1!
#	
�whereZdownZup�breakZtbreakr[r�r�r�Z	conditionrI�stepr�ZuntilZjump�returnZretval�continuer'Zlonglistr�rZppZwhatis�sourceZdisplayZ	undisplayrCr�Zunalias�debug�quitr�z

cCst�j|||�dS)N)rr	)r^r�r�rrrr	#scCst�j|||�S)N)rr)Z
expressionr�r�rrrr&scCst|||�dS)N)r	)r^r�r�rrrr
)scOst�j||�S)N)rr)r��kwdsrrrr-scCst�jtj�j�dS)N)rrr��	_getframe�f_backrrrrr0scCsB|dkrtj�d}|dkr$td��t�}|j�|jd|�dS)Nr�zAA valid traceback must be passed if no exception is being handled)r�r|r�rrVrj)�trrrrr5scCsttj�dS)N)rr��last_tracebackrrrrr
Cszimport x; x.main()cCstt�dS)N)r	�TESTCMDrrrr�testKsrocCsddl}|jt�dS)Nr)�pydocZpagerr)rprrrrOsa�usage: pdb.py [-c command] ... pyfile [arg] ...

Debug the Python program given by pyfile.

Initial commands are read from .pdbrc files in your home directory
and in the current directory, if they exist.  Commands supplied with
-c are executed after commands from .pdbrc files.

To let the script run until an exception occurs, use "-c continue".
To let the script run up to a given line X in the debugged file, use
"-c 'until X'".c	Cs�ddl}|jtjdd�dddg�\}}|s>tt�tjd�g}x<|D]4\}}|dkrjtt�tj�qH|dkrH|j|�qHW|d}tjj	|�s�td
|d�tjd�|tjdd�<tjj
|�tjd<t�}|jj
|�x�y|j|�|jr�Ptd�Wq�tk
�r0td
|d�tddj|��Yq�tk
�r`tddd�ttj�d�Yq�tk
�r�tj�tjd�Yq�tj�td�td�tj�d}|jd|�td|d�Yq�Xq�WdS)Nrrzhc:�--helpz
--command=r��-h�-c�	--commandzError:zdoes not existz*The program finished and will be restartedZ
Restartingzwith arguments:r7r�z/The program exited via sys.exit(). Exit status:)r�z2Uncaught exception. Entering post mortem debuggingz1Running 'cont' or 'step' will restart the programz#Post mortem debugger finished. The z will be restarted)rrrq)rsrt)�getoptr�rr��_usage�exitr�rDrFrQrVrrCrHr_rrrG�
SystemExitr|�SyntaxErrorrz�	print_excrj)	ruZoptsr�rI�optZoptargr<�pdbrlrrr�main`sV 



r}rX)NN)NN)N)-rrDrr�r7r4r(r*r�r)r�r!rzr�r�r�__all__r r&r,r�r-r`r5r8rZ_help_orderZ_commandrrrgrNr	rr
rrrr
rnrorrvr}rr|rrrr�<module>Bst
		

"


<
getpass.cpython-36.opt-1.pyc000064400000010123150335715140011600 0ustar003


 \j�@s�dZddlZddlZddlZddlZddlZdddgZGdd�de�Zddd	�Z	dd
d�Z
ddd
�Zddd�Zdd�Z
yddlZejejfWnBeefk
r�yddlZWnek
r�eZYnXe
ZYnXe	ZdS)a�Utilities to get a password and/or the current user name.

getpass(prompt[, stream]) - Prompt for a password, with echo turned off.
getuser() - Get the user name from the environment or password database.

GetPassWarning - This UserWarning is issued when getpass() cannot prevent
                 echoing of the password contents while reading.

On Windows, the msvcrt module will be used.

�N�getpass�getuser�GetPassWarningc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/getpass.pyrs�
Password: c.Cs�d}tj����}yJtjdtjtjB�}tj|d�}|j|�tj	|�}|j|�|sX|}Wnpt
k
r�}zT|j�ytj
j�}Wn&ttfk
r�d}t||�}YnXtj
}|s�tj}WYdd}~XnX|dk	�r�y�tj|�}|dd�}	|	dtjM<tj}
ttd��r|
tjO}
z tj||
|	�t|||d�}Wdtj||
|�|j�XWn@tjk
�r�|dk	�rz�||k	�r�|j�t||�}YnX|jd�|SQRXdS)aPrompt for a password, with echo turned off.

    Args:
      prompt: Written on stream to ask for the input.  Default: 'Password: '
      stream: A writable file object to display the prompt.  Defaults to
              the tty.  If no tty is available defaults to sys.stderr.
    Returns:
      The seKr3t input.
    Raises:
      EOFError: If our input tty or stdin was closed.
      GetPassWarning: When we were unable to turn echo off on the input.

    Always restores terminal settings before returning.
    Nz/dev/ttyzw+��TCSASOFT)�input�
)�
contextlib�	ExitStack�os�open�O_RDWR�O_NOCTTY�io�FileIO�
enter_context�
TextIOWrapper�OSError�close�sys�stdin�fileno�AttributeError�
ValueError�fallback_getpass�stderr�termios�	tcgetattrZECHOZ	TCSAFLUSH�hasattrr�	tcsetattr�
_raw_input�flush�error�write)�prompt�streamZpasswd�stack�fdZttyr
�e�old�newZtcsetattr_flagsrrr	�unix_getpasssR








r1cCs�tjtjk	rt||�Sx|D]}tj|�qWd}xHtj�}|dksL|dkrNP|dkrZt�|dkrp|dd�}q4||}q4Wtjd�tjd�|S)	z9Prompt for password with echo off, using Windows getch().��
r��N����)rr�	__stdin__r �msvcrtZputwchZgetwch�KeyboardInterrupt)r*r+�cZpwrrr	�win_getpassas"



r<cCs0tjdtdd�|stj}td|d�t||�S)Nz%Can not control echo on the terminal.�)�
stacklevelz&Warning: Password input may be echoed.)�file)�warnings�warnrrr!�printr&)r*r+rrr	r xsr r2cCs�|s
tj}|stj}t|�}|rpy|j|�Wn8tk
rf|j|jd�}|j|j�}|j|�YnX|j	�|j
�}|s�t�|ddkr�|dd�}|S)N�replacer6rr7r7)rr!r�strr)�UnicodeEncodeError�encode�encoding�decoder'�readline�EOFError)r*r+r
�linerrr	r&�s&r&cCs<x dD]}tjj|�}|r|SqWddl}|jtj��dS)z�Get the username from the environment or password database.

    First try various environment variables, then the password
    database.  This works on Windows as long as USERNAME is set.

    �LOGNAME�USER�LNAME�USERNAMErN)rLrMrNrO)r�environ�get�pwd�getpwuid�getuid)�name�userrRrrr	r�s
)r
N)r
N)r
N)r2NN)�__doc__rrrrr@�__all__�UserWarningrr1r<r r&rr"r#r%�ImportErrorrr9rrrrr	�<module>s,

D

	


queue.cpython-36.opt-1.pyc000064400000021065150335715140011265 0ustar003


 \L"�
@s�dZyddlZWnek
r,ddlZYnXddlmZddlmZmZddl	m
Z	dddd	d
gZGdd�de�Z
Gdd�de�ZGd
d�d�ZGdd	�d	e�ZGdd
�d
e�ZdS)z'A multi-producer, multi-consumer queue.�N)�deque)�heappush�heappop)�	monotonic�Empty�Full�Queue�
PriorityQueue�	LifoQueuec@seZdZdZdS)rz4Exception raised by Queue.get(block=0)/get_nowait().N)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.6/queue.pyr
sc@seZdZdZdS)rz4Exception raised by Queue.put(block=0)/put_nowait().N)rrr
rrrrrrsc@s�eZdZdZd!dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	d"dd�Z
d#dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �ZdS)$rzjCreate a queue object with a given maximum size.

    If maxsize is <= 0, the queue size is infinite.
    rcCsN||_|j|�tj�|_tj|j�|_tj|j�|_tj|j�|_d|_	dS)Nr)
�maxsize�_init�	threadingZLock�mutexZ	Condition�	not_empty�not_full�all_tasks_done�unfinished_tasks)�selfrrrr�__init__s

zQueue.__init__c	CsH|j�8|jd}|dkr4|dkr*td��|jj�||_WdQRXdS)a.Indicate that a formerly enqueued task is complete.

        Used by Queue consumer threads.  For each get() used to fetch a task,
        a subsequent call to task_done() tells the queue that the processing
        on the task is complete.

        If a join() is currently blocking, it will resume when all items
        have been processed (meaning that a task_done() call was received
        for every item that had been put() into the queue).

        Raises a ValueError if called more times than there were items
        placed in the queue.
        �rz!task_done() called too many timesN)rr�
ValueErrorZ
notify_all)rZ
unfinishedrrr�	task_done2s

zQueue.task_donec	Cs,|j�x|jr|jj�q
WWdQRXdS)a�Blocks until all items in the Queue have been gotten and processed.

        The count of unfinished tasks goes up whenever an item is added to the
        queue. The count goes down whenever a consumer thread calls task_done()
        to indicate the item was retrieved and all work on it is complete.

        When the count of unfinished tasks drops to zero, join() unblocks.
        N)rr�wait)rrrr�joinHs	z
Queue.joinc	Cs|j�
|j�SQRXdS)z9Return the approximate size of the queue (not reliable!).N)r�_qsize)rrrr�qsizeUszQueue.qsizec	Cs|j�|j�SQRXdS)a�Return True if the queue is empty, False otherwise (not reliable!).

        This method is likely to be removed at some point.  Use qsize() == 0
        as a direct substitute, but be aware that either approach risks a race
        condition where a queue can grow before the result of empty() or
        qsize() can be used.

        To create code that needs to wait for all queued tasks to be
        completed, the preferred technique is to use the join() method.
        N)rr )rrrr�emptyZszQueue.emptyc
Cs0|j� d|jko |j�kSSQRXdS)aOReturn True if the queue is full, False otherwise (not reliable!).

        This method is likely to be removed at some point.  Use qsize() >= n
        as a direct substitute, but be aware that either approach risks a race
        condition where a queue can shrink before the result of full() or
        qsize() can be used.
        rN)rrr )rrrr�fullhsz
Queue.fullTNc
Cs�|j��|jdkr�|s*|j�|jkr�t�nz|dkrRxp|j�|jkrN|jj�q4WnR|dkrdtd��n@t�|}x4|j�|jkr�|t�}|dkr�t�|jj|�qpW|j|�|jd7_|j	j
�WdQRXdS)aPut an item into the queue.

        If optional args 'block' is true and 'timeout' is None (the default),
        block if necessary until a free slot is available. If 'timeout' is
        a non-negative number, it blocks at most 'timeout' seconds and raises
        the Full exception if no free slot was available within that time.
        Otherwise ('block' is false), put an item on the queue if a free slot
        is immediately available, else raise the Full exception ('timeout'
        is ignored in that case).
        rNz''timeout' must be a non-negative numbergr)rrr rrr�time�_putrr�notify)r�item�block�timeout�endtime�	remainingrrr�putss&




z	Queue.putc	Cs�|j��|s|j�s�t�nn|dkr<xd|j�s8|jj�q$WnL|dkrNtd��n:t�|}x.|j�s�|t�}|dkrxt�|jj|�qZW|j�}|jj�|SQRXdS)aRemove and return an item from the queue.

        If optional args 'block' is true and 'timeout' is None (the default),
        block if necessary until an item is available. If 'timeout' is
        a non-negative number, it blocks at most 'timeout' seconds and raises
        the Empty exception if no item was available within that time.
        Otherwise ('block' is false), return an item if one is immediately
        available, else raise the Empty exception ('timeout' is ignored
        in that case).
        Nrz''timeout' must be a non-negative numberg)	rr rrrr$�_getrr&)rr(r)r*r+r'rrr�get�s$





z	Queue.getcCs|j|dd�S)z�Put an item into the queue without blocking.

        Only enqueue the item if a free slot is immediately available.
        Otherwise raise the Full exception.
        F)r()r,)rr'rrr�
put_nowait�szQueue.put_nowaitcCs|jdd�S)z�Remove and return an item from the queue without blocking.

        Only get an item if one is immediately available. Otherwise
        raise the Empty exception.
        F)r()r.)rrrr�
get_nowait�szQueue.get_nowaitcCst�|_dS)N)r�queue)rrrrrr�szQueue._initcCs
t|j�S)N)�lenr1)rrrrr �szQueue._qsizecCs|jj|�dS)N)r1�append)rr'rrrr%�sz
Queue._putcCs
|jj�S)N)r1�popleft)rrrrr-�sz
Queue._get)r)TN)TN)rrr
rrrrr!r"r#r,r.r/r0rr r%r-rrrrrs


 

c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r	z�Variant of Queue that retrieves open entries in priority order (lowest first).

    Entries are typically tuples of the form:  (priority number, data).
    cCs
g|_dS)N)r1)rrrrrr�szPriorityQueue._initcCs
t|j�S)N)r2r1)rrrrr �szPriorityQueue._qsizecCst|j|�dS)N)rr1)rr'rrrr%�szPriorityQueue._putcCs
t|j�S)N)rr1)rrrrr-�szPriorityQueue._getN)rrr
rrr r%r-rrrrr	�s
c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r
zBVariant of Queue that retrieves most recently added entries first.cCs
g|_dS)N)r1)rrrrrr�szLifoQueue._initcCs
t|j�S)N)r2r1)rrrrr �szLifoQueue._qsizecCs|jj|�dS)N)r1r3)rr'rrrr%�szLifoQueue._putcCs
|jj�S)N)r1�pop)rrrrr-�szLifoQueue._getN)rrr
rrr r%r-rrrrr
�s
)rr�ImportErrorZdummy_threading�collectionsr�heapqrrr$r�__all__�	Exceptionrrrr	r
rrrr�<module>sBcodeop.cpython-36.pyc000064400000014200150335715140010444 0ustar003


 \j�@sddZddlZdd�ejD�ZdddgZdZd	d
�Zdd�Zddd�ZGdd�d�Z	Gdd�d�Z
dS)a[Utilities to compile possibly incomplete Python source code.

This module provides two interfaces, broadly similar to the builtin
function compile(), which take program text, a filename and a 'mode'
and:

- Return code object if the command is complete and valid
- Return None if the command is incomplete
- Raise SyntaxError, ValueError or OverflowError if the command is a
  syntax error (OverflowError and ValueError can be produced by
  malformed literals).

Approach:

First, check if the source consists entirely of blank lines and
comments; if so, replace it with 'pass', because the built-in
parser doesn't always do the right thing for these.

Compile three times: as is, with \n, and with \n\n appended.  If it
compiles as is, it's complete.  If it compiles with one \n appended,
we expect more.  If it doesn't compile either way, we compare the
error we get when compiling with \n or \n\n appended.  If the errors
are the same, the code is broken.  But if the errors are different, we
expect more.  Not intuitive; not even guaranteed to hold in future
releases; but this matches the compiler's behavior from Python 1.4
through 2.2, at least.

Caveat:

It is possible (but not likely) that the parser stops parsing with a
successful outcome before reaching the end of the source; in this
case, trailing symbols may be ignored instead of causing an error.
For example, a backslash followed by two newlines may be followed by
arbitrary garbage.  This will be fixed once the API for the parser is
better.

The two interfaces are:

compile_command(source, filename, symbol):

    Compiles a single command in the manner described above.

CommandCompiler():

    Instances of this class have __call__ methods identical in
    signature to compile_command; the difference is that if the
    instance compiles program text containing a __future__ statement,
    the instance 'remembers' and compiles all subsequent program texts
    with the statement in force.

The module also provides another class:

Compile():

    Instances of this class act like the built-in function compile,
    but with 'memory' in the sense described above.
�NcCsg|]}tt|��qS�)�getattr�
__future__)�.0Zfnamerr�/usr/lib64/python3.6/codeop.py�
<listcomp>=sr�compile_command�Compile�CommandCompileric-Cs*x8|jd�D]}|j�}|r|ddkrPqW|dkr:d}d}}}d}}	}
y||||�}Wn"tk
r�}zWYdd}~XnXy||d||�}	Wn&tk
r�}z
|}WYdd}~XnXy||d||�}
Wn&tk
r�}z
|}WYdd}~XnX|�r|S|	�r&t|�t|�k�r&|�dS)N�
r�#�eval�passz

)�split�strip�SyntaxError�repr)�compiler�source�filename�symbol�line�errZerr1Zerr2�code�code1�code2�errr�_maybe_compileDs0rcCst|||t�S)N)�compile�PyCF_DONT_IMPLY_DEDENT)rrrrrr�_compileesr �<input>�singlecCstt|||�S)asCompile a command and determine whether it is incomplete.

    Arguments:

    source -- the source string; may contain \n characters
    filename -- optional filename from which source was read; default
                "<input>"
    symbol -- optional grammar start symbol; "single" (default) or "eval"

    Return value / exceptions raised:

    - Return a code object if the command is complete and valid
    - Return None if the command is incomplete
    - Raise SyntaxError, ValueError or OverflowError if the command is a
      syntax error (OverflowError and ValueError can be produced by
      malformed literals).
    )rr )rrrrrrrhsc@s eZdZdZdd�Zdd�ZdS)r	z�Instances of this class behave much like the built-in compile
    function, but if one is used to compile text containing a future
    statement, it "remembers" and compiles all subsequent program texts
    with the statement in force.cCs
t|_dS)N)r�flags)�selfrrr�__init__�szCompile.__init__cCs@t||||jd�}x(tD] }|j|j@r|j|jO_qW|S)N�)rr#�	_features�co_flagsZ
compiler_flag)r$rrrZcodeobZfeaturerrr�__call__�s

zCompile.__call__N)�__name__�
__module__�__qualname__�__doc__r%r)rrrrr	|sc@s"eZdZdZdd�Zd	dd�ZdS)
r
a(Instances of this class have __call__ methods identical in
    signature to compile_command; the difference is that if the
    instance compiles program text containing a __future__ statement,
    the instance 'remembers' and compiles all subsequent program texts
    with the statement in force.cCst�|_dS)N)r	r)r$rrrr%�szCommandCompiler.__init__�<input>r"cCst|j|||�S)a�Compile a command and determine whether it is incomplete.

        Arguments:

        source -- the source string; may contain \n characters
        filename -- optional filename from which source was read;
                    default "<input>"
        symbol -- optional grammar start symbol; "single" (default) or
                  "eval"

        Return value / exceptions raised:

        - Return a code object if the command is complete and valid
        - Return None if the command is incomplete
        - Raise SyntaxError, ValueError or OverflowError if the command is a
          syntax error (OverflowError and ValueError can be produced by
          malformed literals).
        )rr)r$rrrrrrr)�szCommandCompiler.__call__N)r.r")r*r+r,r-r%r)rrrrr
�s)r!r")r-rZall_feature_namesr'�__all__rrr rr	r
rrrr�<module>9s

!
locale.cpython-36.opt-1.pyc000064400000102377150335715140011406 0ustar003


 \�-�]@sdZddlZddlZddlZddlZddlZddlmZddl	Z	dddddd	d
ddd
dddddddddddddgZ
dd�Zdd�Zyddl
TWnLek
r�d Zd!Zd"ZdZd#Zd$Zd%Zd&ZeZd'd
�Z�d�d(d�ZYnXde�kr�eZde�kr�eZeZiZe	j e�d)d
��Zd*d+�Z!�d�d-d.�Z"d/d0�Z#ej$d1�Z%�d�d2d�Z&�d�d3d4�Z'�d�d5d�Z(�d�d7d�Z)d8d
�Zd9d:�Z*e+fd;d�Z,d<d�Z-d=d>�Z.eZ/d?d@�Z0dAdB�Z1dCd�Z2dDdE�Z3dFdG�Z4�d�dJd�Z5efdKd�Z6�d�dLd�ZefdMd	�Z7ej8j9dN��r�d�dOd�Z:n8ye;Wn"e<k
�r6�d�dPd�Z:YnX�d�dQd�Z:dRdRdSdTdTdUdVdWdXdYdSdZd[d\dSdSdSd]d^d_d`d\dadZdbdcd[dddedfdgdTdhdidUdjdkdldmdndodWdXdYdp�,Z=x2e>e=j?��D]"\Z@ZAe@jBdqdr�Z@e=jCe@eA��q�Wdsdsdsdtdudvdwdwdxdydzdzd{d|d}d~d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d~d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�dRd�dRdRd{d�dRdRd�d�d�d�d�d�d�d�d{d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d{d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d{d�d�d�d�d�d�d�d{d�d{dRd{d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d̐d�d�d�d�d�d�d�d�d�d�d�d�d�d	�d	�d
�dd��d�d
�d
�d
�d
�d
�d�d
�d�d�d�d�d�d�d�d�dd�d�d�d��d�d�d�dd͐d�d�d�d�d�d�d�d�d�d�d�d�d�dd�d�d��d�d�d �d �d �d!�d"�d#�d$�d%�d&�d&�d'�d(�d&�d&�d%�d%d{d�d{d�d{d�d)�d*�d)�d)�d+�d+�d+�d�d�d,�d-�d-�d-�d.�d.�d-�d-�d-�d-�d-�d/�d/�d/�d0�d/�d1�d2�d3�d3�d4�d5�d5�d6�d6�d6�d7�d6�d6�d8�d8�d9�d:�d;�d;�d<�d<�d=�d>�d?�d@�dA�dB�dC�dD�dD�dE�dE�dD�dB�dB�dF�dF�dG�dH�dI�dI�dJ�dK�dL�dM�dN�dN�dO�dP�dQ�dQ�dR�dR�dS�dT�dU�dU�dV�dV�dW�dW�dX�dYd�d��dZ�d[�d\�d]�d^�d_dǐd`d�dǐda�da�db�dc�db�db�db�db�dd�dd�de�de�dc�dc�da�df�df�dg�dh�di�di�dj�dk�dk�dl�dm�dn�do�dp�dq�dp�dr�dr�ds�ds�ds�dt�dudRdR�dv�dv�dw�dt�du�dt�dx�dy�dz�dz�dz�d{�d{�d|�dz�d}�d~�d~�d�d��d��d��d��d��d��d��d��d��d��d��d�d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d�d�d�d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d�d��d��d��d��d��d��d��d��d��d��dddddÐdÐdĐdĐdŐdƐdǐdȐdȐdɐdɐdʐdːd�d��d͐d�d��dϐdϐdАdѐd�d�d��dҐdҐdӐ�LZD�dԐdՐd֐dאdؐdِdڐdېdܐdݐdސdߐd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d��d��d��d��d��d��d��d��d��d��d��d�d�d�d�d�d�d�d�d�d	�d
�d�d�d
�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d �d!�d"�d#�d$�d%�d&�d'�d(�d)�d*�d+�d,�d-�d-�d.�d/�d0�d1�d2�d3�d4�d5�d6�d7�d8�d9�d:�d;�d<�d=�d>�d?�d@�dA�dB�dC�dD�dE�dF�dG�dH�dI�dJ�dK�dL�dM�dN�dO�dP�dQ�dR�dS�dT�dU�dV�dW�dX�dY�dZ�d[�d\�d]�d^�d_�d`�da�db�dc�dd�de�df�de�df�dg�dh�di�dj�dk�dl�dm�dl�dn�do�dp�dq�dr�ds�dt�du�dv�dw�dx�dy�dz�d{�d|�d}�d~�d�d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d���ZE�d��d��ZFyeWne<k
�
r�YnXe
jG�d��eH�d�k�reI�d��eI�eF�eI�eI�d��eI�e.�dS(�a�Locale support module.

The module provides low-level access to the C lib's locale APIs and adds high
level number formatting APIs as well as a locale aliasing engine to complement
these.

The aliasing engine includes support for many commonly used locale names and
maps them to values suitable for passing to the C lib's setlocale() function. It
also includes default encodings for all supported locale names.

�N)�str�	getlocale�getdefaultlocale�getpreferredencoding�Error�	setlocale�resetlocale�
localeconv�strcoll�strxfrmr�atof�atoi�format�
format_string�currency�	normalize�LC_CTYPE�
LC_COLLATE�LC_TIME�LC_MONETARY�
LC_NUMERIC�LC_ALL�CHAR_MAXcCs||k||kS)zZ strcoll(string,string) -> int.
        Compares two strings according to the locale.
    �)�a�brr�/usr/lib64/python3.6/locale.py�_strcoll!srcCs|S)z\ strxfrm(string) -> string.
        Returns a string that behaves for cmp locale-aware.
    r)�srrr�_strxfrm'sr)�*�������cCs,dgddddgddddddddddddd�S)zd localeconv() -> dict.
            Returns numeric and monetary locale-specific parameters.
        r!��.)�grouping�currency_symbol�n_sign_posn�
p_cs_precedes�
n_cs_precedes�mon_grouping�n_sep_by_space�
decimal_point�
negative_sign�
positive_sign�p_sep_by_space�int_curr_symbol�p_sign_posn�
thousands_sep�mon_thousands_sep�frac_digits�mon_decimal_point�int_frac_digitsrrrrrr	?s$cCs|dkrtd��dS)zd setlocale(integer,string=None) -> string.
            Activates/queries locale processing.
        Nr(�Cz*_locale emulation only supports "C" locale)Nr(r<)r)�category�valuerrrrWscCst�}tr|jt�|S)N)�_localeconv�_override_localeconv�update)�drrrr	ls
ccsPd}xF|D]>}|tkrdS|dkr>|dkr2td��x
|Vq4W|V|}q
WdS)Nrzinvalid grouping)r�
ValueError)r*Z
last_interval�intervalrrr�_grouping_intervalszs

rEFc
Cs�t�}||rdpd}||r dp"d}|s2|dfS|d
dkr\|j�}|t|�d�}|}nd}d}g}xNt|�D]B}	|s�|dd	kr�|}d}P|j||	d��|d|	�}qrW|r�|j|�|j�||j|�|t|�t|�dfS)Nr8r7r/r*rr&� r(�
0123456789���rH)r	�rstrip�lenrE�append�reverse�join)
r�monetary�convr7r*�strippedZright_spacesZleft_spaces�groupsrDrrr�_group�s0
rRcCsld}x$|r(||dkr(|d7}|d8}qWt|�d}x$|rZ||dkrZ|d8}|d8}q8W|||d�S)NrrFr&)rJ)rZamountZlposZrposrrr�_strip_padding�srSzG%(?:\((?P<key>.*?)\))?(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]cGsHtj|�}|s$t|j��t|�kr4tdt|���t||||f|��S)z�Returns the locale-aware substitution of a %? specifier
    (percent).

    additional is for format strings which contain one or more
    '*' modifiers.zHformat() must be given exactly one %%char format specifier, %s not valid)�_percent_re�matchrJ�grouprC�repr�_format)�percentr>r*rN�
additionalrUrrrr�s

c	Gs�|r||f|}n||}|d	dkr~d}|jd�}|rRt|d|d�\|d<}t�|r^dp`d}|j|�}|r�t||�}n2|d
dkr�d}|r�t||d�\}}|r�t||�}|S)Nr&ZeEfFgGrr))rNr:r1ZdiurHrH)�splitrRr	rMrS)	rYr>r*rNrZZ	formattedZseps�partsr1rrrrX�s(


rXc	Csttj|��}tjd|�}t|tj�rlg}x�|D]6}|j�ddkrP|jd�q0|jt	|j�||��q0Wn�t|t
�s||f}g}d}xz|D]r}|j�d	dkr�|jd�q�|jd�jd�}|jt|j�|||df||d|d|����|d|7}q�Wt
|�}||S)
z�Formats a string in the same way that the % formatting would use,
    but takes the current locale into account.
    Grouping is applied if the third parameter is true.z%sr&�%rZ	modifiersr FrHrH)
�listrT�finditer�sub�
isinstance�collections�MappingrVrKr�tuple�countrX)	�f�valr*ZpercentsZnew_fZnew_valZperc�iZ	starcountrrrr�s0


TcCsft�}||rdpd}|dkr&td��td|t|�|dd�}d|d	}|r�||rXd
pZd}||dkrld
pnd}||dkr�dp�d}	|r�||	r�dp�d|}n||	r�dp�d|}||dkr�dp�d}
||dkr�dp�d}|
dkr�d|d}n`|
dk�r||}nL|
dk�r||}n8|
dk�r2|jd|�}n |
dk�rJ|jd	|�}n||}|jdd�jd	d�S)zIFormats val according to the currency settings
    in the current locale.r;r9r!z9Currency formatting is not possible using the 'C' locale.z%%.%ifT)rN�<�>r5r+rr.r-r0r4rFr(r,r6r2r3�(�)r&r'r#r%)r	rCr�abs�replace)rgZsymbolr*Z
internationalrOZdigitsrZsmbZprecedesZ	separatedZsign_posZsignrrrr�s6





cCs
td|�S)z8Convert float to string, taking the locale into account.z%.12g)r)rgrrrr+scCs:t�}|d}|r|j|d�}|d}|r6|j|d�}|S)zHParses a string as a normalized number according to the locale settings.r7r(r1r))r	rn)�stringrO�tsZddrrr�
delocalize/srqcCs|t|��S)z<Parses a string as a float according to the locale settings.)rq)ro�funcrrrr?scCstt|��S)zAConverts a string to an integer according to the locale settings.)�intrq)rorrrr
CscCsBttd�tddd�}t|dt|��td�}t|dt|��dS)Nr(z%di�[r&�isg��Q�	@)rrr�printr
rr)�s1rrr�_testGs

rwcCs�d|kr|d|jd��}n|}tj|�}tjjj|j�|�}|}|j�}|tkr\t|}n(|jdd�}|jdd�}|tkr�t|}|d|S)Nr)�_r(�-)�index�	encodings�normalize_encoding�aliases�get�lower�locale_encoding_aliasrn)�code�encoding�langname�
norm_encodingrrr�_replace_encodingYs

r�cCsR|dkrFd|kr|dS|jd�\}}}|dkr4|S|dkrFt|d�S|d|S)	N�euror)z.ISO8859-15�
ISO8859-15�UTF-8z	ISO8859-1�@)r�r�)�	partitionr�)r��modifierrxr�rrr�_append_modifierps
r�c	Cs�|j�}d|kr|jdd�}d|kr6|jdd�\}}nd}d|krZ|jd�dd�\}}n|}d}|}|r�|jdd�}|jd	d�}|d|7}|}|r�|d|7}tj|d�}|dk	r�|S|�rtj|d�}|dk	�rd|kr�t||�S|jdd�dj�|k�r|S|�r�|}|�r"|d|7}tj|d�}|dk	�rnd|k�rLt||�S|jdd�\}}t||�d|S|�r�tj|d�}|dk	�r�d|k�r�t||�}t||�S|jdd�\}}|j�|k�r�t||�d|S|S)
a� Returns a normalized locale code for the given locale
        name.

        The returned locale code is formatted for use with
        setlocale().

        If normalization fails, the original name is returned
        unchanged.

        If the given encoding is not known, the function defaults to
        the default encoding for the locale code just like setlocale()
        does.

    �:r)r�r&r(Nr'ryrx)rrnr[�locale_aliasr~r�r�)	�
localenamer�r�r�r�Zlang_encr�Zlookup_nameZdefmodrrrr{s`








cCsrt|�}d|kr8|jdd�\}}|dkr8d|kr8|dfSd|krVt|jd�dd��S|dkrbd
Std	|��dS)a� Parses the locale code for localename and returns the
        result as tuple (language code, encoding).

        The localename is normalized and passed through the locale
        alias engine. A ValueError is raised in case the locale name
        cannot be parsed.

        The language code corresponds to RFC 1766.  code and encoding
        can be None in case the values cannot be determined or are
        unknown to this implementation.

    r�r&r�r)ziso-8859-15Nr'r<zunknown locale: %s)NN)rr[rdrC)r�r�r�rrr�_parse_localename�sr�cCsVy0|\}}|dkrd}|dkr"|S|d|SWn ttfk
rPtd��YnXdS)z� Builds a locale code from the given tuple (language code,
        encoding).

        No aliasing or normalizing takes place.

    Nr<r)zXLocale must be None, a string, or an iterable of two strings -- language code, encoding.)�	TypeErrorrC)ZlocaletupleZlanguager�rrr�_build_localename�sr��LANG�LANGUAGEcCs�yddl}|j�\}}Wnttfk
r0Yn8Xtjdkr`|r`|dd�dkr`tjt|d��}||fSddl	}|j
j}x6|D]*}||d�}|r~|dkr�|jd�d}Pq~Wd}t|�S)	a� Tries to determine the default locale settings and returns
        them as tuple (language code, encoding).

        According to POSIX, a program which has not called
        setlocale(LC_ALL, "") runs using the portable 'C' locale.
        Calling setlocale(LC_ALL, "") lets it use the default locale as
        defined by the LANG variable. Since we don't want to interfere
        with the current locale setting we thus emulate the behavior
        in the way described above.

        To maintain compatibility with other platforms, not only the
        LANG variable is tested, but a list of variables given as
        envvars parameter. The first found to be defined will be
        used. envvars defaults to the search path used in GNU gettext;
        it must always contain the variable name 'LANG'.

        Except for the code 'C', the language code corresponds to RFC
        1766.  code and encoding can be None in case the values cannot
        be determined.

    rNZwin32r'Z0xr�r�r<)
�_localeZ_getdefaultlocale�ImportError�AttributeError�sys�platform�windows_localer~rs�os�environr[r�)Zenvvarsr�r�r�r��lookupZvariabler�rrrrs$

cCs(t|�}|tkr d|kr td��t|�S)ap Returns the current setting for the given locale category as
        tuple (language code, encoding).

        category may be one of the LC_* value except LC_ALL. It
        defaults to LC_CTYPE.

        Except for the code 'C', the language code corresponds to RFC
        1766.  code and encoding can be None in case the values cannot
        be determined.

    �;z category LC_ALL is not supported)�
_setlocalerr�r�)r=r�rrrr5s
cCs&|rt|t�rtt|��}t||�S)a^ Set the locale for the given category.  The locale can be
        a string, an iterable of two strings (language code and encoding),
        or None.

        Iterables are converted to strings using the locale aliasing
        engine.  Locale strings are passed directly to the C lib.

        category may be given as one of the LC_* values.

    )ra�_builtin_strrr�r�)r=ZlocalerrrrGscCst|tt���dS)z� Sets the locale for category to the default setting.

        The default setting is determined by calling
        getdefaultlocale(). category defaults to LC_ALL.

    N)r�r�r)r=rrrrXs�wincCsddl}|jd�S)z1Return the charset that the user is likely using.rNF)�_bootlocaler)�do_setlocaler�rrrrdscCst�d}|dkrd}|S)zbReturn the charset that the user is likely using,
            by looking at environment variables.r&N�ascii)r)r��resrrrrns
cCsTddl}|r8tt�}yttd�Wntk
r6YnX|jd�}|rPtt|�|S)zdReturn the charset that the user is likely using,
            according to the system configuration.rNr(F)r�rrrr)r�r�Zoldloc�resultrrrrws

r<z	ISO8859-1ZJIS7ZeucJPzKOI8-CZCP1251ZCP1255ZCP1256z	ISO8859-2z	ISO8859-5z
ISO8859-15z
ISO8859-10z
ISO8859-11z
ISO8859-13z
ISO8859-14z
ISO8859-16z	ISO8859-3z	ISO8859-4z	ISO8859-6z	ISO8859-7z	ISO8859-8z	ISO8859-9ZSJISZTACTISZeucKRzUTF-8zKOI8-RzKOI8-TzKOI8-UZRK1048),�437�c�enZjisZjis7ZajecZkoi8cZmicrosoftcp1251Zmicrosoftcp1255Zmicrosoftcp1256Z88591Z88592Z88595Z885915r��latin_1�	iso8859_1�
iso8859_10�
iso8859_11�
iso8859_13�
iso8859_14�
iso8859_15�
iso8859_16�	iso8859_2�	iso8859_3�	iso8859_4�	iso8859_5�	iso8859_6�	iso8859_7�	iso8859_8�	iso8859_9�
iso2022_jp�	shift_jis�tactis�euc_jp�euc_kr�utf_8�koi8_rZkoi8_tZkoi8_u�kz1048�cp1251�cp1255�cp1256rxr(zaz_AZ.KOI8-Czaa_DJ.ISO8859-1zaa_ER.UTF-8zaa_ET.UTF-8zaf_ZA.ISO8859-1zagr_PE.UTF-8zak_GH.UTF-8zam_ET.UTF-8zen_US.ISO8859-1zan_ES.ISO8859-15zanp_IN.UTF-8zar_AA.ISO8859-6zar_AE.ISO8859-6zar_BH.ISO8859-6zar_DZ.ISO8859-6zar_EG.ISO8859-6zar_IN.UTF-8zar_IQ.ISO8859-6zar_JO.ISO8859-6zar_KW.ISO8859-6zar_LB.ISO8859-6zar_LY.ISO8859-6zar_MA.ISO8859-6zar_OM.ISO8859-6zar_QA.ISO8859-6zar_SA.ISO8859-6zar_SD.ISO8859-6zar_SS.UTF-8zar_SY.ISO8859-6zar_TN.ISO8859-6zar_YE.ISO8859-6zas_IN.UTF-8zast_ES.ISO8859-15zayc_PE.UTF-8zaz_AZ.ISO8859-9Ezaz_IR.UTF-8zbe_BY.CP1251zbe_BY.UTF-8@latinzbg_BG.UTF-8zbem_ZM.UTF-8zber_DZ.UTF-8zber_MA.UTF-8zbg_BG.CP1251zbhb_IN.UTF-8zbho_IN.UTF-8zbho_NP.UTF-8zbi_VU.UTF-8zbn_BD.UTF-8zbn_IN.UTF-8zbo_CN.UTF-8zbo_IN.UTF-8znb_NO.ISO8859-1zbr_FR.ISO8859-1zbrx_IN.UTF-8zbs_BA.ISO8859-2zbyn_ER.UTF-8zfr_CA.ISO8859-1zen_US.UTF-8zca_ES.ISO8859-1zca_AD.ISO8859-1zca_ES.UTF-8@valenciazca_FR.ISO8859-1zca_IT.ISO8859-1zce_RU.UTF-8zzh_CN.eucCNzzh_TW.eucTWzchr_US.UTF-8zckb_IQ.UTF-8zcmn_TW.UTF-8zcrh_UA.UTF-8zhr_HR.ISO8859-2zcs_CZ.ISO8859-2zcsb_PL.UTF-8zcv_RU.UTF-8zcy_GB.ISO8859-1zda_DK.ISO8859-1zde_DE.ISO8859-1zde_AT.ISO8859-1zde_BE.ISO8859-1zde_CH.ISO8859-1zde_IT.ISO8859-1zde_LI.UTF-8zde_LU.ISO8859-1zdoi_IN.UTF-8znl_NL.ISO8859-1znl_BE.ISO8859-1zdv_MV.UTF-8zdz_BT.UTF-8zee_EE.ISO8859-4zet_EE.ISO8859-1zel_GR.ISO8859-7zel_CY.ISO8859-7zel_GR.ISO8859-15zen_AG.UTF-8zen_AU.ISO8859-1zen_BE.ISO8859-1zen_BW.ISO8859-1zen_CA.ISO8859-1zen_DK.ISO8859-1zen_DL.UTF-8zen_GB.ISO8859-1zen_HK.ISO8859-1zen_IE.ISO8859-1zen_IL.UTF-8zen_IN.ISO8859-1zen_NG.UTF-8zen_NZ.ISO8859-1zen_PH.ISO8859-1zen_SC.UTF-8zen_SG.ISO8859-1zen_US.ISO8859-15zen_ZA.ISO8859-1zen_ZM.UTF-8zen_ZW.ISO8859-1zen_ZS.UTF-8zen_EN.ISO8859-1zeo_XX.ISO8859-3zeo.UTF-8zeo_EO.ISO8859-3zeo_US.UTF-8zes_ES.ISO8859-1zes_AR.ISO8859-1zes_BO.ISO8859-1zes_CL.ISO8859-1zes_CO.ISO8859-1zes_CR.ISO8859-1zes_CU.UTF-8zes_DO.ISO8859-1zes_EC.ISO8859-1zes_GT.ISO8859-1zes_HN.ISO8859-1zes_MX.ISO8859-1zes_NI.ISO8859-1zes_PA.ISO8859-1zes_PE.ISO8859-1zes_PR.ISO8859-1zes_PY.ISO8859-1zes_SV.ISO8859-1zes_US.ISO8859-1zes_UY.ISO8859-1zes_VE.ISO8859-1zet_EE.ISO8859-15zeu_ES.ISO8859-1zeu_FR.ISO8859-1zfa_IR.UTF-8zfa_IR.ISIRI-3342zff_SN.UTF-8zfi_FI.ISO8859-15zfil_PH.UTF-8zfi_FI.ISO8859-1zfo_FO.ISO8859-1zfr_FR.ISO8859-1zfr_BE.ISO8859-1zfr_CH.ISO8859-1zfr_LU.ISO8859-1zfur_IT.UTF-8zfy_DE.UTF-8zfy_NL.UTF-8zga_IE.ISO8859-1zgl_ES.ISO8859-1zgd_GB.ISO8859-1zgez_ER.UTF-8zgez_ET.UTF-8zgu_IN.UTF-8zgv_GB.ISO8859-1zha_NG.UTF-8zhak_TW.UTF-8zhe_IL.ISO8859-8zhi_IN.ISCII-DEVzhif_FJ.UTF-8zhne_IN.UTF-8zhsb_DE.ISO8859-2zht_HT.UTF-8zhu_HU.ISO8859-2zhy_AM.UTF-8zhy_AM.ARMSCII_8zia.UTF-8zia_FR.UTF-8zis_IS.ISO8859-1zid_ID.ISO8859-1zig_NG.UTF-8zik_CA.UTF-8zit_IT.ISO8859-1zit_CH.ISO8859-1ziu_CA.NUNACOM-8ziw_IL.UTF-8zja_JP.eucJPz
ja_JP.SJISzka_GE.GEORGIAN-ACADEMYzka_GE.GEORGIAN-PSzkab_DZ.UTF-8z
kk_KZ.ptcp154zkl_GL.ISO8859-1zkm_KH.UTF-8zkn_IN.UTF-8zko_KR.eucKRzkok_IN.UTF-8zks_IN.UTF-8zks_IN.UTF-8@devanagarizku_TR.ISO8859-9zkw_GB.ISO8859-1zky_KG.UTF-8zlb_LU.UTF-8zlg_UG.ISO8859-10zli_BE.UTF-8zli_NL.UTF-8zlij_IT.UTF-8zlt_LT.ISO8859-13zln_CD.UTF-8zlo_LA.MULELAO-1zlo_LA.IBM-CP1133zlv_LV.ISO8859-13zlzh_TW.UTF-8zmag_IN.UTF-8zmai_IN.UTF-8zmai_NP.UTF-8zmfe_MU.UTF-8zmg_MG.ISO8859-15zmhr_RU.UTF-8zmi_NZ.ISO8859-1zmiq_NI.UTF-8zmjw_IN.UTF-8zmk_MK.ISO8859-5zml_IN.UTF-8zmn_MN.UTF-8zmni_IN.UTF-8zmr_IN.UTF-8zms_MY.ISO8859-1zmt_MT.ISO8859-3zmy_MM.UTF-8znan_TW.UTF-8znds_DE.UTF-8znds_NL.UTF-8zne_NP.UTF-8znhn_MX.UTF-8zniu_NU.UTF-8zniu_NZ.UTF-8znl_AW.UTF-8znn_NO.ISO8859-1zno_NO.ISO8859-1zny_NO.ISO8859-1znr_ZA.ISO8859-1znso_ZA.ISO8859-15zoc_FR.ISO8859-1zom_ET.UTF-8zom_KE.ISO8859-1zor_IN.UTF-8zos_RU.UTF-8zpa_IN.UTF-8zpa_PK.UTF-8zpap_AN.UTF-8zpap_AW.UTF-8zpap_CW.UTF-8zpd_US.ISO8859-1zpd_DE.ISO8859-1zph_PH.ISO8859-1zpl_PL.ISO8859-2zpt_PT.ISO8859-1zpt_BR.ISO8859-1zpp_AN.ISO8859-1zps_AF.UTF-8zquz_PE.UTF-8zraj_IN.UTF-8zro_RO.ISO8859-2zru_RU.UTF-8zru_UA.KOI8-Uzru_RU.KOI8-Rzrw_RW.ISO8859-1zsa_IN.UTF-8zsat_IN.UTF-8zsc_IT.UTF-8zsd_IN.UTF-8zsd_IN.UTF-8@devanagarizsd_PK.UTF-8zse_NO.UTF-8zsr_RS.UTF-8@latinzsgs_LT.UTF-8zsr_CS.ISO8859-2zsh_HR.ISO8859-2zshn_MM.UTF-8zshs_CA.UTF-8zsi_LK.UTF-8zsid_ET.UTF-8zsk_SK.ISO8859-2zsl_SI.ISO8859-2zsl_CS.ISO8859-2zsm_WS.UTF-8zso_DJ.ISO8859-1zso_ET.UTF-8zso_KE.ISO8859-1zso_SO.ISO8859-1zsr_CS.ISO8859-5zsq_AL.ISO8859-2zsq_MK.UTF-8zsr_RS.UTF-8zsr_CS.UTF-8@latinzsr_CS.UTF-8zsr_ME.UTF-8zsr_CS.CP1251zss_ZA.ISO8859-1zst_ZA.ISO8859-1zsv_SE.ISO8859-1zsv_FI.ISO8859-1zsw_KE.UTF-8zsw_TZ.UTF-8zszl_PL.UTF-8z
ta_IN.TSCII-0zta_LK.UTF-8ztcy_IN.UTF-8zte_IN.UTF-8ztg_TJ.KOI8-Czth_TH.ISO8859-11zth_TH.TIS620zthe_NP.UTF-8zti_ER.UTF-8zti_ET.UTF-8ztig_ER.UTF-8ztk_TM.UTF-8ztl_PH.ISO8859-1ztn_ZA.ISO8859-15zto_TO.UTF-8ztpi_PG.UTF-8ztr_TR.ISO8859-9ztr_CY.ISO8859-9zts_ZA.ISO8859-1ztt_RU.TATAR-CYRztt_RU.UTF-8@iqtelifzug_CN.UTF-8zuk_UA.KOI8-Uz	en_US.utfzunm_US.UTF-8zur_PK.CP1256zur_IN.UTF-8zuz_UZ.UTF-8zve_ZA.UTF-8z
vi_VN.TCVNzvi_VN.VISCIIzwa_BE.ISO8859-1zwae_CH.UTF-8zwal_ET.UTF-8zwo_SN.UTF-8zxh_ZA.ISO8859-1zyi_US.CP1255zyo_NG.UTF-8zyue_HK.UTF-8zyuw_PG.UTF-8zzh_CN.gb2312z
zh_TW.big5zzh_HK.big5hkscszzh_SG.GB2312z	zh_SG.GBKzzu_ZA.ISO8859-1(LZa3Za3_azz
a3_az.koicZaa_djZaa_erZaa_etZafZaf_zaZagr_peZak_ghZamZam_etZamericanZan_esZanp_in�arZar_aaZar_aeZar_bhZar_dzZar_egZar_inZar_iqZar_joZar_kwZar_lbZar_lyZar_maZar_omZar_qaZar_saZar_sdZar_ssZar_syZar_tnZar_ye�arabic�asZas_inZast_esZayc_peZazZaz_azzaz_az.iso88599eZaz_irZbezbe@latinz
be_bg.utf8Zbe_byzbe_by@latinZbem_zmZber_dzZber_maZbgZbg_bgzbhb_in.utf8Zbho_inZbho_npZbi_vuZbn_bdZbn_inZbo_cnZbo_inZbokmalubokmål�brZbr_frZbrx_inZbsZbs_baZ	bulgarianZbyn_err�zc-frenchzc.asciizc.enz
c.iso88591zc.utf8Zc_czc_c.cZcaZca_adZca_eszca_es@valenciaZca_frZca_itZcatalanZce_ruZcextendz	chinese-sz	chinese-tZchr_usZckb_iqZcmn_twZcrh_uaZcroatianZcsZcs_csZcs_czZcsb_plZcv_ruZcyZcy_gbZczZcz_czZczechZdaZda_dkZdanishZdanskZdeZde_atZde_beZde_chZde_deZde_itz
de_li.utf8Zde_luZdeutschZdoi_inZdutchzdutch.iso88591Zdv_mvZdz_btZeeZee_eeZeestiZelZel_cyZel_grz
el_gr@euror�Zen_agZen_auZen_beZen_bwZen_caZen_dkz
en_dl.utf8Zen_gbZen_hkZen_ieZen_ilZen_inZen_ngZen_nzZen_phz
en_sc.utf8Zen_sgZen_ukZen_uszen_us@euro@euroZen_zaZen_zmZen_zwz
en_zw.utf8Zeng_gbZenglishzenglish.iso88591Z
english_ukzenglish_united-stateszenglish_united-states.437Z
english_usZeozeo.utf8Zeo_eoz
eo_us.utf8Zeo_xxZesZes_arZes_boZes_clZes_coZes_crZes_cuZes_doZes_ecZes_esZes_gtZes_hnZes_mxZes_niZes_paZes_peZes_prZes_pyZes_svZes_usZes_uyZes_veZestonianZetZet_eeZeuZeu_esZeu_frZfaZfa_irzfa_ir.isiri3342Zff_snZfiZfi_fiZfil_phZfinnishZfoZfo_fo�frZfr_beZfr_caZfr_chZfr_frZfr_luu	françaisZfre_frZfrenchzfrench.iso88591Z
french_franceZfur_itZfy_deZfy_nlZgaZga_ieZgalegoZgalicianZgdZgd_gbZger_deZgermanzgerman.iso88591Zgerman_germanyZgez_erZgez_etZglZgl_es�greekZgu_inZgvZgv_gbZha_ngZhak_twZheZhe_il�hebrew�hiZhi_inzhi_in.isciidevZhif_fjZhneZhne_inZhrZhr_hrZhrvatskiZhsb_deZht_htZhuZhu_huZ	hungarianZhy_amzhy_am.armscii8ZiaZia_frZ	icelandic�idZid_idZig_ngZik_ca�inZin_idrtZis_isz
iso-8859-1ziso-8859-15z	iso8859-1z
iso8859-15�
iso_8859_1�iso_8859_15�itZit_chZit_itZitalianZiuZiu_caziu_ca.nunacom8ZiwZiw_ilz
iw_il.utf8ZjaZja_jpz	ja_jp.euczja_jp.mscodez	ja_jp.pckZjapanZjapanesezjapanese-euczjapanese.eucZjp_jpZkaZka_gezka_ge.georgianacademyzka_ge.georgianpszka_ge.georgianrsZkab_dzZkk_kzZklZkl_glZkm_khZknZkn_inZkoZko_krz	ko_kr.eucZkok_in�koreanz
korean.eucZksZks_inzks_in@devanagari.utf8Zku_tr�kwZkw_gbZkyZky_kgZlb_luZlg_ugZli_beZli_nlZlij_itZ
lithuanianZln_cd�loZlo_lazlo_la.cp1133zlo_la.ibmcp1133zlo_la.mulelao1�ltZlt_ltZlvZlv_lvZlzh_twZmag_inZmaiZmai_inZmai_npZmfe_muZmg_mgZmhr_ruZmiZmi_nzZmiq_niZmjw_inZmkZmk_mkZmlZml_inZmn_mnZmni_inZmrZmr_inZmsZms_myZmtZmt_mtZmy_mmZnan_twZnbZnb_noZnds_deZnds_nlZne_npZnhn_mxZniu_nuZniu_nz�nlZnl_awZnl_beZnl_nlZnnZnn_no�noz
no@nynorskZno_nozno_no.iso88591@bokmalzno_no.iso88591@nynorskZ	norwegianZnrZnr_zaZnsoZnso_zaZnyZny_noZnynorskZocZoc_frZom_etZom_ke�orZor_inZos_ruZpaZpa_inZpa_pkZpap_anZpap_awZpap_cwZpdZpd_deZpd_usZphZph_phZplZpl_plZpolishZ
portugueseZportuguese_brazil�posixz
posix-utf2ZppZpp_anZps_afZptZpt_brZpt_ptZquz_peZraj_inZroZro_roZromanianZruZru_ruZru_uaZrumanianZrussianZrwZrw_rwZsa_inZsat_inZsc_itZsdZsd_inzsd_in@devanagari.utf8Zsd_pkZse_noZ
serbocroatianZsgs_ltZshzsh_ba.iso88592@bosniaZsh_hrzsh_hr.iso88592Zsh_spZsh_yuZshn_mmZshs_caZsiZsi_lkZsid_etZsinhalaZskZsk_skZslZsl_csZsl_siZslovakZsloveneZ	slovenianZsm_wsZso_djZso_etZso_keZso_soZspZsp_yuZspanishZ
spanish_spainZsqZsq_alZsq_mk�srzsr@cyrilliczsr@latnZsr_cszsr_cs.iso88592@latnz
sr_cs@latnZsr_meZsr_rsz
sr_rs@latnZsr_spZsr_yuzsr_yu.cp1251@cyrilliczsr_yu.iso88592zsr_yu.iso88595zsr_yu.iso88595@cyrilliczsr_yu.microsoftcp1251@cyrillicz
sr_yu.utf8zsr_yu.utf8@cyrilliczsr_yu@cyrillicZssZss_za�stZst_zaZsvZsv_fiZsv_seZsw_keZsw_tzZswedishZszl_plZtaZta_inzta_in.tsciizta_in.tscii0Zta_lkztcy_in.utf8ZteZte_inZtgZtg_tjZthZth_thzth_th.tactiszth_th.tis620�thaiZthe_npZti_erZti_etZtig_erZtk_tmZtlZtl_phZtnZtn_zaZto_toZtpi_pgZtrZtr_cyZtr_trrpZts_zaZttZtt_ruztt_ru.tatarcyrz
tt_ru@iqtelifZturkishZug_cnZukZuk_uaZunivZ	universalzuniversal.utf8@ucs4Zunm_usZurZur_inZur_pkZuzZuz_uzzuz_uz@cyrillicZveZve_zaZviZvi_vnz
vi_vn.tcvnzvi_vn.tcvn5712zvi_vn.visciizvi_vn.viscii111ZwaZwa_beZwae_chZwal_etZwo_snZxhZxh_zaZyiZyi_usZyo_ngZyue_hkZyuw_pgZzhZzh_cnz
zh_cn.big5z	zh_cn.eucZzh_hkzzh_hk.big5hkZzh_sgz	zh_sg.gbkZzh_twz	zh_tw.euczzh_tw.euctwZzuZzu_zaZaf_ZAZsq_ALZgsw_FRZam_ETZar_SAZar_IQZar_EGZar_LYZar_DZZar_MAZar_TNZar_OMZar_YEZar_SYZar_JOZar_LBZar_KWZar_AEZar_BHZar_QAZhy_AMZas_INZaz_AZZba_RUZeu_ESZbe_BYZbn_INZbs_BAZbr_FRZbg_BGZca_ESZzh_CHSZzh_TWZzh_CNZzh_HKZzh_SGZzh_MOZzh_CHTZco_FRZhr_HRZhr_BAZcs_CZZda_DKZgbz_AFZdiv_MVZnl_NLZnl_BEZen_USZen_GBZen_AUZen_CAZen_NZZen_IEZen_ZAZen_JAZen_CBZen_BZZen_TTZen_ZWZen_PHZen_INZen_MYZet_EEZfo_FOZfil_PHZfi_FIZfr_FRZfr_BEZfr_CAZfr_CHZfr_LUZfr_MCZfy_NLZgl_ESZka_GEZde_DEZde_CHZde_ATZde_LUZde_LIZel_GRZkl_GLZgu_INZha_NGZhe_ILZhi_INZhu_HUZis_ISZid_IDZiu_CAZga_IEZit_ITZit_CHZja_JPZkn_INZkk_KZZkh_KHZqut_GTZrw_RWZkok_INZko_KRZky_KGZlo_LAZlv_LVZlt_LTZdsb_DEZlb_LUZmk_MKZms_MYZms_BNZml_INZmt_MTZmi_NZZarn_CLZmr_INZmoh_CAZmn_MNZmn_CNZne_NPZnb_NOZnn_NOZoc_FRZor_INZps_AFZfa_IRZpl_PLZpt_BRZpt_PTZpa_INZquz_BOZquz_ECZquz_PEZro_ROZrm_CHZru_RUZsmn_FIZsmj_NOZsmj_SEZse_NOZse_SEZse_FIZsms_FIZsma_NOZsma_SEZsa_INZsr_SPZsr_BAZsi_LKZns_ZAZtn_ZAZsk_SKZsl_SIZes_ESZes_MXZes_GTZes_CRZes_PAZes_DOZes_VEZes_COZes_PEZes_ARZes_ECZes_CLZes_URZes_PYZes_BOZes_SVZes_HNZes_NIZes_PRZes_USZsw_KEZsv_SEZsv_FIZsyr_SYZtg_TJZtmz_DZZta_INZtt_RUZte_INZth_THZbo_BTZbo_CNZtr_TRZtk_TMZug_CNZuk_UAZwen_DEZur_PKZur_INZuz_UZZvi_VNZcy_GBZwo_SNZxh_ZAZsah_RUZii_CNZyo_NGZzu_ZA)�i6ii�i^iiiiiiii i$i(i,i0i4i8i<i@i+iMi,i,imi-i#iEi ii~iir%iiiiii|i�iiiii�ieiii	i	i	i	i	i	i	i	 i	$i	(i	,i	0i	4i	@i	Di	Hi%i8idiiiiiiiibiVi7iiiiiiioiGihi
i9iii!i]i]i<iiiiKi?iSi�i�iWii@iTi&i'i.ini/i>i>iLi:i�iziNi|iPiPiaiii�iHici)iiiiFikikikiiii;$i;i;i;i;i;i; i;i;iOiiiii[ili2ii$i
i
i
i
i
i
i
i
 i
$i
(i
,i
0i
4i
8i
<i
@i
Di
Hi
Li
Pi
TiAiiiZi(i_iIiDiJiiQiQiiBi�i"i.i i iCiCi*iRi�i4i�ixiji5c
Cs�i}|fdd�}|�|d=td�tdd�t�\}}td|pDd�td	|pRd�t�td
�tdd�xL|j�D]@\}}t|d�t|�\}}td|p�d�td
|p�d�t�qzWt�td�tdd�t�xP|j�D]D\}}t|d�t|�\}}td|�pd�td
|�p"d�t�q�Wyttd�Wn$td�td�td�YnpXt�td�tdd�xR|j�D]F\}}t|d�t|�\}}td|�p�d�td
|�p�d�t��q�WdS)z Test function.
    cSs4x.t�j�D] \}}|dd�dkr|||<qWdS)Nr#ZLC_)�globals�items)�
categories�k�vrrr�_init_categories�sz'_print_locale.<locals>._init_categoriesrz4Locale defaults as determined by getdefaultlocale():ry�Hz
Language: z(undefined)z
Encoding: zLocale settings on startup:z...z
   Language: z
   Encoding: z,Locale settings after calling resetlocale():r(zNOTE:z9setlocale(LC_ALL, "") does not support the default localez&given in the OS environment variables.z4Locale settings after calling setlocale(LC_ALL, ""):N)rurr�rrrr)r�r�Zlang�enc�namer=rrr�
_print_locale{sV





r��LC_MESSAGES�__main__zLocale aliasing:zNumber formatting:)N)F)FF)FF)F)TFF�rrr�r�)r�)N)T)T)T)J�__doc__r�r{Zencodings.aliases�rerb�builtinsrr��	functools�__all__rrr�r�rrrrr�rrrrCrr	rr�rr
r?r@�wrapsrErRrS�compilerTrrXrrrq�floatrr
rwr�r�r�rr�r�rrrr��
startswithr�CODESET�	NameErrorr��sortedr�r�r�rn�
setdefaultr�r�r�rK�__name__rurrrr�<module>s4


	



"-S5
	"}:

csv.cpython-36.opt-2.pyc000064400000023132150335715140010732 0ustar003


 \4?�@sHddlZddlmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZddlmZddlmZddlmZdddd	d
ddd
dddddddddddddgZGdd�d�ZGdd
�d
e�Zed
e�Gdd�de�Zede�Gdd�de�Zed e�Gd!d�d�ZGd"d�d�ZyeWnek
�r4eZYnXGd#d�d�ZdS)$�N)�Error�__version__�writer�reader�register_dialect�unregister_dialect�get_dialect�
list_dialects�field_size_limit�
QUOTE_MINIMAL�	QUOTE_ALL�QUOTE_NONNUMERIC�
QUOTE_NONE�__doc__)�Dialect)�OrderedDict)�StringIOrrr
rrrr�excel�	excel_tabr
rrrrr	�Snifferrr�
DictReader�
DictWriter�unix_dialectc@s@eZdZdZdZdZdZdZdZdZ	dZ
dZdd�Zdd�Z
dS)r�FNcCs|jtkrd|_|j�dS)NT)�	__class__r�_valid�	_validate)�self�r�/usr/lib64/python3.6/csv.py�__init__+s
zDialect.__init__cCs@yt|�Wn.tk
r:}ztt|���WYdd}~XnXdS)N)�_Dialect�	TypeErrorr�str)r�errrr0szDialect._validate)�__name__�
__module__�__qualname__�_namer�	delimiter�	quotecharZ
escapechar�doublequote�skipinitialspace�lineterminator�quotingr rrrrrrsc@s$eZdZdZdZdZdZdZeZ	dS)r�,�"TFz
N)
r%r&r'r)r*r+r,r-rr.rrrrr7sc@seZdZdZdS)r�	N)r%r&r'r)rrrrrAsz	excel-tabc@s$eZdZdZdZdZdZdZeZ	dS)rr/r0TF�
N)
r%r&r'r)r*r+r,r-rr.rrrrrFsZunixc@s@eZdZddd�Zdd�Zedd��Zejd	d��Zd
d�ZdS)
rNrcOs6||_||_||_t||f|�|�|_||_d|_dS)Nr)�_fieldnames�restkey�restvalr�dialect�line_num)r�f�
fieldnamesr4r5r6�args�kwdsrrrr RszDictReader.__init__cCs|S)Nr)rrrr�__iter__[szDictReader.__iter__cCs@|jdkr0yt|j�|_Wntk
r.YnX|jj|_|jS)N)r3�nextr�
StopIterationr7)rrrrr9^s

zDictReader.fieldnamescCs
||_dS)N)r3)r�valuerrrr9hscCs�|jdkr|jt|j�}|jj|_x|gkr:t|j�}q&Wtt|j|��}t|j�}t|�}||krz||d�||j<n*||kr�x |j|d�D]}|j||<q�W|S)Nr)	r7r9r=rr�zip�lenr4r5)r�row�dZlfZlr�keyrrr�__next__ls




zDictReader.__next__)NNNr)	r%r&r'r r<�propertyr9�setterrErrrrrQs

c@s6eZdZddd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)rr�raisercOsB||_||_|j�dkr$td|��||_t||f|�|�|_dS)NrH�ignorez-extrasaction (%s) must be 'raise' or 'ignore')rHrI)r9r5�lower�
ValueError�extrasactionr)rr8r9r5rLr6r:r;rrrr �szDictWriter.__init__cCs tt|j|j��}|j|�dS)N)�dictr@r9�writerow)r�headerrrr�writeheader�szDictWriter.writeheadercsN�jdkr8�j��j}|r8tddjdd�|D������fdd��jD�S)NrHz(dict contains fields not in fieldnames: z, cSsg|]}t|��qSr)�repr)�.0�xrrr�
<listcomp>�sz,DictWriter._dict_to_list.<locals>.<listcomp>c3s|]}�j|�j�VqdS)N)�getr5)rRrD)�rowdictrrr�	<genexpr>�sz+DictWriter._dict_to_list.<locals>.<genexpr>)rL�keysr9rK�join)rrVZwrong_fieldsr)rVrr�
_dict_to_list�s
zDictWriter._dict_to_listcCs|jj|j|��S)N)rrNrZ)rrVrrrrN�szDictWriter.writerowcCs|jjt|j|��S)N)r�	writerows�maprZ)rZrowdictsrrrr[�szDictWriter.writerowsN)rrHr)r%r&r'r rPrZrNr[rrrrr�s
	c@s6eZdZdd�Zddd�Zdd�Zdd	�Zd
d�ZdS)
rcCsdddddg|_dS)Nr/r1�;� �:)�	preferred)rrrrr �szSniffer.__init__NcCsd|j||�\}}}}|s(|j||�\}}|s4td��Gdd�dt�}||_||_|pVd|_||_|S)NzCould not determine delimiterc@seZdZdZdZeZdS)zSniffer.sniff.<locals>.dialectZsniffedz
N)r%r&r'r(r-rr.rrrrr6�sr6r0)�_guess_quote_and_delimiter�_guess_delimiterrrr+r)r*r,)r�sample�
delimitersr*r+r)r,r6rrr�sniff�s

z
Sniffer.sniffcCs�g}x0dD](}tj|tjtjB�}|j|�}|r
Pq
W|s>dSi}i}d}|j}	x�|D]�}
|	dd	}|
|}|r�|j|d�d	||<y|	d
d	}|
|}Wntk
r�wVYnX|r�|dks�||kr�|j|d�d	||<y|	dd	}Wntk
�rwVYnX|
|rV|d	7}qVWt||jd�}
|�rZt||jd�}|||k}|d
k�rbd}nd}d}tjdtj	|�|
d�tj�}|j
|��r�d}nd}|
|||fS)N�I(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)�G(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)�G(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\n)�-(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?:$|\n)rFr�quote��delimZspace)rDr2z]((%(delim)s)|^)\W*%(quote)s[^%(delim)s\n]*%(quote)s[^%(delim)s\n]*%(quote)s\W*((%(delim)s)|$))rlrjT)rfrgrhri)rFNr)�re�compile�DOTALL�	MULTILINE�findall�
groupindexrU�KeyError�max�escape�search)r�datardZmatchesZrestrZregexpZquotes�delimsZspacesrr�m�nrDr*rlr,Z	dq_regexpr+rrrra�s`


z"Sniffer._guess_quote_and_delimitercCsttd|jd���}dd�td�D�}tdt|��}d}i}i}i}dt|t|��}	}
�x|	t|�k�rn|d7}xT||	|
�D]D}x>|D]6}|j|i�}
|j|�}|
j|d�d|
|<|
||<q�Wq�Wx�|j�D]�}t||j	��}t|�dk�r|dddk�rq�t|�dk�rht
|dd	�d
�||<|j||�||d||dtdd�|D��f||<q�|d||<q�W|j	�}t
||�}d
}d}x�t|�dk�r||k�rx\|D]T\}}|ddk�r�|ddk�r�|d||k�r�|dk�s�||k�r�|||<�q�W|d8}�q�Wt|�dk�r`t|j��d}|dj|�|djd|�k}||fS|
}	|
|7}
q\W|�szdSt|�dk�r�xF|jD]<}||j�k�r�|dj|�|djd|�k}||fS�q�Wdd�|j	�D�}|j�|dd}|dj|�|djd|�k}||fS)Nr2cSsg|]}t|��qSr)�chr)rR�crrrrT.sz,Sniffer._guess_delimiter.<locals>.<listcomp>��
rrkcSs|dS)Nrkr)rSrrr�<lambda>Hsz*Sniffer._guess_delimiter.<locals>.<lambda>)rDcss|]}|dVqdS)rkNr)rR�itemrrrrWMsz+Sniffer._guess_delimiter.<locals>.<genexpr>g�?g�������?g{�G�z�?z%c rcSsg|]\}}||f�qSrr)rR�k�vrrrrTws)rr���)�list�filter�split�range�minrArU�countrX�itemsrt�remove�sum�floatr`�sort)rrwrd�asciiZchunkLengthZ	iterationZ
charFrequencyZmodesrx�start�end�line�charZ
metaFrequencyZfreqr�ZmodeListZtotalZconsistencyZ	thresholdr�r�rlr,rCrrrrbst

 zSniffer._guess_delimiterc
Cs�tt|�|j|��}t|�}t|�}i}xt|�D]}d||<q2Wd}x�|D]�}|dkrZP|d7}t|�|krpqLx�t|j��D]x}	xJtt	t
gD]0}
y|
||	�PWq�ttfk
r�Yq�Xq�Wt||	�}
|
||	kr~||	dkr�|
||	<q~||	=q~WqLWd}x�|j
�D]~\}	}t|�td�k�rLt||	�|k�rB|d7}n|d8}n<y|||	�Wn"ttfk
�r~|d7}Yn
X|d8}�qW|dkS)Nr�rk)rrrer=rAr�r�rX�intr��complexrK�
OverflowErrorr��typer")
rrcZrdrrO�columnsZcolumnTypes�iZcheckedrB�colZthisTypeZ	hasHeaderZcolTyperrr�
has_header�sJ





zSniffer.has_header)N)r%r&r'r rerarbr�rrrrr�s

Lg) rmZ_csvrrrrrrrr	r
rrr
rrrr!�collectionsr�ior�__all__rrrrrr��	NameErrorr�rrrrr�<module>s0@



2
sre_constants.cpython-36.opt-1.pyc000064400000013526150335715140013031 0ustar003


 \��@s8dZdZddlmZmZGdd�de�ZGdd�de�Zeed�Zd	d
�Z	e	d�Z
e
d.d
�=e	d�Ze	d�Ze
eeeeeeeeeiZeeeeiZeeee iZ!ee"ee#iZ$e%e%e&e&e'e'e(e(e)e*e+e,e-e-e.e.iZ/e%e0e&e1e'e2e(e3e)e4e+e5e-e6e.e7iZ8dZ9dZ:dZ;dZ<dZ=dZ>dZ?dZ@dZAdZBdZCdZDeEdk�r4dd�ZFeGdd���ZHeHjId�eHjIde�eFeHe
d�eFeHed �eFeHed �eHjId!e9�eHjId"e:�eHjId#e;�eHjId$e<�eHjId%e=�eHjId&e>�eHjId'e?�eHjId(e@�eHjId)eA�eHjId*eB�eHjId+eC�eHjId,eD�Wd
QRXeJd-�d
S)/zInternal support module for sreiuS3�)�	MAXREPEAT�	MAXGROUPScs"eZdZdZd�fdd�	Z�ZS)�erroraiException raised for invalid regular expressions.

    Attributes:

        msg: The unformatted error message
        pattern: The regular expression pattern
        pos: The index in the pattern where compilation failed (may be None)
        lineno: The line corresponding to pos (may be None)
        colno: The column corresponding to pos (may be None)
    Ncs�||_||_||_|dk	r�|dk	r�d||f}t|t�r>d}nd}|j|d|�d|_||j|d|�|_||kr�d||j|jf}nd|_|_t	�j
|�dS)Nz%s at position %d�
�
r�z%s (line %d, column %d))�msg�pattern�pos�
isinstance�str�count�lineno�rfind�colno�super�__init__)�selfrr	r
�newline)�	__class__��%/usr/lib64/python3.6/sre_constants.pyr#s
zerror.__init__)NN)�__name__�
__module__�__qualname__�__doc__r�
__classcell__rr)rrrs
rcs(eZdZ�fdd�Zdd�ZeZ�ZS)�_NamedIntConstantcstt|�j||�}||_|S)N)rr�__new__�name)�cls�valuerr)rrrr7sz_NamedIntConstant.__new__cCs|jS)N)r)rrrr�__str__<sz_NamedIntConstant.__str__)rrrrr"�__repr__rrr)rrr6srrcCs8|j�j�}dd�t|�D�}t�jdd�|D��|S)NcSsg|]\}}t||��qSr)r)�.0�irrrr�
<listcomp>Esz_makecodes.<locals>.<listcomp>cSsi|]}||j�qSr)r)r$�itemrrr�
<dictcomp>Fsz_makecodes.<locals>.<dictcomp>)�strip�split�	enumerate�globals�update)�names�itemsrrr�
_makecodesCsr0a�
    FAILURE SUCCESS

    ANY ANY_ALL
    ASSERT ASSERT_NOT
    AT
    BRANCH
    CALL
    CATEGORY
    CHARSET BIGCHARSET
    GROUPREF GROUPREF_EXISTS GROUPREF_IGNORE
    IN IN_IGNORE
    INFO
    JUMP
    LITERAL LITERAL_IGNORE
    MARK
    MAX_UNTIL
    MIN_UNTIL
    NOT_LITERAL NOT_LITERAL_IGNORE
    NEGATE
    RANGE
    REPEAT
    REPEAT_ONE
    SUBPATTERN
    MIN_REPEAT_ONE
    RANGE_IGNORE

    MIN_REPEAT MAX_REPEAT
�Nz�
    AT_BEGINNING AT_BEGINNING_LINE AT_BEGINNING_STRING
    AT_BOUNDARY AT_NON_BOUNDARY
    AT_END AT_END_LINE AT_END_STRING
    AT_LOC_BOUNDARY AT_LOC_NON_BOUNDARY
    AT_UNI_BOUNDARY AT_UNI_NON_BOUNDARY
a�
    CATEGORY_DIGIT CATEGORY_NOT_DIGIT
    CATEGORY_SPACE CATEGORY_NOT_SPACE
    CATEGORY_WORD CATEGORY_NOT_WORD
    CATEGORY_LINEBREAK CATEGORY_NOT_LINEBREAK
    CATEGORY_LOC_WORD CATEGORY_LOC_NOT_WORD
    CATEGORY_UNI_DIGIT CATEGORY_UNI_NOT_DIGIT
    CATEGORY_UNI_SPACE CATEGORY_UNI_NOT_SPACE
    CATEGORY_UNI_WORD CATEGORY_UNI_NOT_WORD
    CATEGORY_UNI_LINEBREAK CATEGORY_UNI_NOT_LINEBREAK
r���� �@���__main__cCs.t|�}x |D]}|jd|||f�qWdS)Nz#define %s_%s %d
)�sorted�write)�f�d�prefixr/r'rrr�dump�s
r?zsre_constants.h�wao/*
 * Secret Labs' Regular Expression Engine
 *
 * regular expression matching engine
 *
 * NOTE: This file is generated by sre_constants.py.  If you need
 * to change anything in here, edit sre_constants.py and run it.
 *
 * Copyright (c) 1997-2001 by Secret Labs AB.  All rights reserved.
 *
 * See the _sre.c file for information on usage and redistribution.
 */

z#define SRE_MAGIC %d
ZSRE_OPZSREz#define SRE_FLAG_TEMPLATE %d
z#define SRE_FLAG_IGNORECASE %d
z#define SRE_FLAG_LOCALE %d
z#define SRE_FLAG_MULTILINE %d
z#define SRE_FLAG_DOTALL %d
z#define SRE_FLAG_UNICODE %d
z#define SRE_FLAG_VERBOSE %d
z#define SRE_FLAG_DEBUG %d
z#define SRE_FLAG_ASCII %d
z#define SRE_INFO_PREFIX %d
z#define SRE_INFO_LITERAL %d
z#define SRE_INFO_CHARSET %d
�done���)Kr�MAGIC�_srerr�	Exceptionr�intrr0�OPCODES�ATCODES�CHCODES�GROUPREFZGROUPREF_IGNORE�IN�	IN_IGNORE�LITERALZLITERAL_IGNORE�NOT_LITERALZNOT_LITERAL_IGNORE�RANGE�RANGE_IGNORE�	OP_IGNORE�AT_BEGINNINGZAT_BEGINNING_LINE�AT_ENDZAT_END_LINE�AT_MULTILINEZAT_BOUNDARYZAT_LOC_BOUNDARYZAT_NON_BOUNDARYZAT_LOC_NON_BOUNDARY�	AT_LOCALEZAT_UNI_BOUNDARYZAT_UNI_NON_BOUNDARY�
AT_UNICODEZCATEGORY_DIGITZCATEGORY_NOT_DIGITZCATEGORY_SPACEZCATEGORY_NOT_SPACEZ
CATEGORY_WORDZCATEGORY_LOC_WORDZCATEGORY_NOT_WORDZCATEGORY_LOC_NOT_WORDZCATEGORY_LINEBREAKZCATEGORY_NOT_LINEBREAK�	CH_LOCALEZCATEGORY_UNI_DIGITZCATEGORY_UNI_NOT_DIGITZCATEGORY_UNI_SPACEZCATEGORY_UNI_NOT_SPACEZCATEGORY_UNI_WORDZCATEGORY_UNI_NOT_WORDZCATEGORY_UNI_LINEBREAKZCATEGORY_UNI_NOT_LINEBREAK�
CH_UNICODE�SRE_FLAG_TEMPLATE�SRE_FLAG_IGNORECASE�SRE_FLAG_LOCALE�SRE_FLAG_MULTILINE�SRE_FLAG_DOTALL�SRE_FLAG_UNICODE�SRE_FLAG_VERBOSE�SRE_FLAG_DEBUG�SRE_FLAG_ASCII�SRE_INFO_PREFIX�SRE_INFO_LITERAL�SRE_INFO_CHARSETrr?�openr<r;�printrrrr�<module>s�



tokenize.cpython-36.opt-1.pyc000064400000044253150335715140011775 0ustar003


 \8s�-@s�dZdZdZddlmZddlmZmZddl	Z	ddl
mZddlm
Z
ddlZddlZddlZdd	lTejd
ej�Zejdej�ZddlZejdd
dddddgZ[eZdee<edZdee<edZdee<ed7Zeeeee e!e"e#e$e%e&e'e(e)e*e+e,e-e.e/e0e1e2e3e4e5e6e7e8e9e:e;e<e=e>e?e@eAeBeCeDeEeFeGd�,ZHGdd�de	jIdd��ZJdd�ZKdd�ZLdd�ZMdZNd ZOeNeLd!eN�eMeO�ZPd"ZQd#ZRd$ZSd%ZTd&ZUeKeReSeTeU�ZVd'ZWeKd(d)�eMeW�ZXd*eWZYeKeXeY�ZZeKd+eZd,�Z[eKe[eZeV�Z\d-d.�Z]d/d0�Z^eKe]��Z_d1Z`d2Zad3Zbd4ZceKe_d5e_d6�ZdeKe_d7e_d8�ZeeKd9d:d;d<d=d>d?d@�ZfdAZgeKdBdCdD�ZheKefegeh�ZieKe\eieeeQ�ZjePejZkeKe_dEeKdFd!�e_dGeKdHd!��ZleKdIeOed�ZmeNeKeme\eieleQ�ZniZox@e]�D]6Zpe`eoepdF<eaeoepdH<ebeoepd5<eceoepd6<�q�Weq�Zreq�Zsx\e]�D]RZtx$etdHetdFfD]Zuerjveu��q8Wx$etd6etd5fD]Zuesjveu��q^W�q"WdJZwGdKdL�dLex�ZyGdMdN�dNex�ZzGdOdP�dP�Z{dQd�Z|dRdS�Z}dTd�Z~dUdV�ZdWd
�ZdXdY�Z�dZd[�Z�d\d]�Z�e�d^k�r�e��dS)_aoTokenization help for Python programs.

tokenize(readline) is a generator that breaks a stream of bytes into
Python tokens.  It decodes the bytes according to PEP-0263 for
determining source file encoding.

It accepts a readline-like method which is called repeatedly to get the
next line of input (or b"" for EOF).  It generates 5-tuples with these
members:

    the token type (see token.py)
    the token (a string)
    the starting (row, column) indices of the token (a 2-tuple of ints)
    the ending (row, column) indices of the token (a 2-tuple of ints)
    the original line (string)

It is designed to match the working of the Python tokenizer exactly, except
that it produces COMMENT tokens for comments and gives type OP for all
operators.  Additionally, all token lists start with an ENCODING token
which tells you which encoding was used to decode the bytes stream.
zKa-Ping Yee <ping@lfw.org>zpGvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip Montanaro, Raymond Hettinger, Trent Nelson, Michael Foord�)�open)�lookup�BOM_UTF8N)�
TextIOWrapper)�chain)�*z&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)�COMMENT�tokenize�detect_encoding�NL�
untokenize�ENCODING�	TokenInfo���),�(�)�[�]�:�,�;�+�-r�/�|�&�<�>�=�.�%�{�}z==z!=z<=z>=�~�^z<<z>>z**z+=z-=z*=z/=z%=z&=z|=z^=z<<=z>>=z**=z//z//=�@z@=c@s eZdZdd�Zedd��ZdS)rcCs$d|jt|jf}d|j|d�S)Nz%d (%s)z8TokenInfo(type=%s, string=%r, start=%r, end=%r, line=%r))�type)r(�tok_name�_replace)�self�annotated_type�r-� /usr/lib64/python3.6/tokenize.py�__repr__dszTokenInfo.__repr__cCs(|jtkr|jtkrt|jS|jSdS)N)r(�OP�string�EXACT_TOKEN_TYPES)r+r-r-r.�
exact_typeis
zTokenInfo.exact_typeN)�__name__�
__module__�__qualname__r/�propertyr3r-r-r-r.rcsztype string start end linecGsddj|�dS)Nrrr)�join)�choicesr-r-r.�grouppsr:cGst|�dS)Nr)r:)r9r-r-r.�anyqsr;cGst|�dS)N�?)r:)r9r-r-r.�maybersr=z[ \f\t]*z	#[^\r\n]*z\\\r?\nz\w+z0[xX](?:_?[0-9a-fA-F])+z0[bB](?:_?[01])+z0[oO](?:_?[0-7])+z(?:0(?:_?0)*|[1-9](?:_?[0-9])*)z[eE][-+]?[0-9](?:_?[0-9])*z)[0-9](?:_?[0-9])*\.(?:[0-9](?:_?[0-9])*)?z\.[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*[jJ]z[jJ]cCsnddddddg}tdg�}xN|D]F}x@tj|�D]2}x,tjdd	�|D��D]}|jdj|��qJWq0Wq W|S)
N�b�r�u�f�br�fr�cSsg|]}||j�f�qSr-)�upper)�.0�cr-r-r.�
<listcomp>�sz(_all_string_prefixes.<locals>.<listcomp>)�set�
_itertools�permutations�product�addr8)�_valid_string_prefixes�result�prefix�tr@r-r-r.�_all_string_prefixes�s

rRcCstj|tj�S)N)�re�compile�UNICODE)�exprr-r-r.�_compile�srWz[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z'''z"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z!=z//=?z->z[+\-*/%&@|^=<>]=?r%z[][(){}]z\r?\nz\.\.\.z[:;.,@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*�'z"[^\n"\\]*(?:\\.[^\n"\\]*)*�"z
\\\r?\n|\Z�c@seZdZdS)�
TokenErrorN)r4r5r6r-r-r-r.r[�sr[c@seZdZdS)�StopTokenizingN)r4r5r6r-r-r-r.r\�sr\c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�UntokenizercCsg|_d|_d|_d|_dS)Nrr)�tokens�prev_row�prev_col�encoding)r+r-r-r.�__init__�szUntokenizer.__init__cCs�|\}}||jks&||jkr>||jkr>tdj|||j|j���||j}|rb|jjd|�d|_||j}|r�|jjd|�dS)Nz+start ({},{}) precedes previous end ({},{})z\
r� )r_r`�
ValueError�formatr^�append)r+�start�row�col�
row_offset�
col_offsetr-r-r.�add_whitespace�s

zUntokenizer.add_whitespacecCs4t|�}g}d}�x|D�]
}t|�dkr8|j||�P|\}}}}	}
|tkrV||_q|tkr`P|tkrv|j|�qnl|tkr�|j	�|	\|_
|_qnL|tt
fkr�d}n:|r�|r�|d}|dt|�kr�|jj|�t|�|_d}|j|�|jj|�|	\|_
|_|tt
fkr|j
d7_
d|_qWdj|j�S)NFrTrrrD���)�iter�len�compatr
ra�	ENDMARKER�INDENTrf�DEDENT�popr_r`�NEWLINErr^rlr8)r+�iterable�it�indents�	startlinerQ�tok_type�tokenrg�end�line�indentr-r-r.r�sF



zUntokenizer.untokenizec
Cs�g}|jj}|dttfk}d}x�t|g|�D]�}|dd�\}}	|tkrR|	|_q.|ttt	t
fkrj|	d7}	|tkr�|r~d|	}	d}nd}|tkr�|j|	�q.n>|t
kr�|j�q.n*|ttfkr�d}n|r�|r�||d�d}||	�q.WdS)NrFrrcTrrm)r^rfrurrr
ra�NAME�NUMBER�ASYNC�AWAIT�STRINGrrrsrt)
r+r{rvrx�toks_appendry�
prevstring�tok�toknum�tokvalr-r-r.rps8
zUntokenizer.compatN)r4r5r6rbrlrrpr-r-r-r.r]�s
%r]cCs*t�}|j|�}|jdk	r&|j|j�}|S)aTransform tokens back into Python source code.
    It returns a bytes object, encoded using the ENCODING
    token, which is the first token sequence output by tokenize.

    Each element returned by the iterable must be a token sequence
    with at least two elements, a token number and token value.  If
    only two tokens are passed, the resulting output is poor.

    Round-trip invariant for full input:
        Untokenized source will match input source exactly

    Round-trip invariant for limited input:
        # Output bytes will tokenize back to the input
        t1 = [tok[:2] for tok in tokenize(f.readline)]
        newcode = untokenize(t1)
        readline = BytesIO(newcode).readline
        t2 = [tok[:2] for tok in tokenize(readline)]
        assert t1 == t2
    N)r]rra�encode)rv�ut�outr-r-r.r=s


cCsH|dd�j�jdd�}|dks*|jd�r.dS|d
ks@|jd�rDdS|S)z(Imitates get_normal_name in tokenizer.c.N��_rzutf-8zutf-8-�latin-1�
iso-8859-1�iso-latin-1�latin-1-�iso-8859-1-�iso-latin-1-)r�r�r�)r�r�r�)�lower�replace�
startswith)�orig_enc�encr-r-r.�_get_normal_nameXs
r�cs�y�jj�Wntk
r$d�YnXd�d}d}�fdd�}��fdd�}|�}|jt�rpd�|d	d�}d
}|s||gfS||�}|r�||gfStj|�s�||gfS|�}|s�||gfS||�}|r�|||gfS|||gfS)a
    The detect_encoding() function is used to detect the encoding that should
    be used to decode a Python source file.  It requires one argument, readline,
    in the same way as the tokenize() generator.

    It will call readline a maximum of twice, and return the encoding used
    (as a string) and a list of any lines (left as bytes) it has read in.

    It detects the encoding from the presence of a utf-8 bom or an encoding
    cookie as specified in pep-0263.  If both a bom and a cookie are present,
    but disagree, a SyntaxError will be raised.  If the encoding cookie is an
    invalid charset, raise a SyntaxError.  Note that if a utf-8 bom is found,
    'utf-8-sig' is returned.

    If no encoding is specified, then the default of 'utf-8' will be returned.
    NFzutf-8cs y��Stk
rdSXdS)N�)�
StopIterationr-)�readliner-r.�read_or_stop{sz%detect_encoding.<locals>.read_or_stopcs�y|jd�}Wn4tk
rBd}�dk	r6dj|��}t|��YnXtj|�}|sVdSt|jd��}yt|�}Wn:t	k
r��dkr�d|}ndj�|�}t|��YnX�r�|dkr؈dkr�d}n
dj��}t|��|d	7}|S)
Nzutf-8z'invalid or missing encoding declarationz{} for {!r}rzunknown encoding: zunknown encoding for {!r}: {}zencoding problem: utf-8z encoding problem for {!r}: utf-8z-sig)
�decode�UnicodeDecodeErrorre�SyntaxError�	cookie_re�matchr�r:r�LookupError)r}�line_string�msgr�ra�codec)�	bom_found�filenamer-r.�find_cookie�s6


z$detect_encoding.<locals>.find_cookieTrz	utf-8-sig)�__self__�name�AttributeErrorr�r�blank_rer�)r�ra�defaultr�r��first�secondr-)r�r�r�r.r
cs8
&




cCsVt|d�}y0t|j�\}}|jd�t||dd�}d|_|S|j��YnXdS)zXOpen a file in read only mode using the encoding detected by
    detect_encoding().
    �rbrT)�line_bufferingr?N)�
_builtin_openr
r��seekr�mode�close)r��bufferra�lines�textr-r-r.r�s

rcCsBddlm}m}t|�\}}t|d�}|d�}t||||�j|�S)a�
    The tokenize() generator requires one argument, readline, which
    must be a callable object which provides the same interface as the
    readline() method of built-in file objects.  Each call to the function
    should return one line of input as bytes.  Alternatively, readline
    can be a callable function terminating with StopIteration:
        readline = open(myfile, 'rb').__next__  # Example of alternate readline

    The generator produces 5-tuples with these members: the token type; the
    token string; a 2-tuple (srow, scol) of ints specifying the row and
    column where the token begins in the source; a 2-tuple (erow, ecol) of
    ints specifying the row and column where the token ends in the source;
    and the line on which the token was found.  The line passed is the
    logical line; continuation lines are included.

    The first token sequence will always be an ENCODING token
    which tells you which encoding was used to decode the bytes stream.
    r)r�repeatr�)�	itertoolsrr�r
rn�	_tokenize�__next__)r�rr�ra�consumed�rl_gen�emptyr-r-r.r	�s

c!csd}}}d}d!\}}d}dg}	d}
d}d}d}
|dk	rX|dkrFd}tt|d"d#d�Vd}d}�x
y|}|�}Wntk
r�d}YnX|dk	r�|j|�}|d7}dt|�}}|�r�|s�td	|��|j|�}|�r|jd�}}tt||d|�|||f||�Vd$\}}d}nf|�rn|d%d�dk�rn|d&d�d
k�rntt	||||t|�f|�Vd}d}qdn||}||}qd�n@|dk�r�|�r�|�s�Pd}xf||k�r||dk�r�|d7}n6||dk�r�|t
dt
}n||dk�r�d}nP|d7}�q�W||k�rP||dk�r�||dk�r�||d�jd�}|t|�}tt|||f||t|�f|�Vtt
||d�||f|t|�f|�Vqdtt
tf||dk||d�||f|t|�f|�Vqd||	d'k�r|	j|�tt|d|�|df||f|�Vxv||	d(k�r�||	k�r8tdd|||f��|	dd)�}	|�rd||	d*k�rdd}d}
d}ttd||f||f|�V�qW|�r�|
�r�||	d+k�r�d}d}
d}n|�s�td|df��d}�x�||k�rhtt�j||�}|�r:|jd�\}}||f||f|}}}||k�r�q�|||�||}}||k�sZ|dk�rp|dk�rp|dk�rptt||||�V�qd|dk�r�|
�r�|
Vd}
|dk�r�tt
||||�Vntt||||�V|�r8d}
�qd|dk�r�|
�r�|
Vd}
tt||||�V�qd|tk�rltt|�}|j||�}|�rN|jd�}|||�}tt||||f|�Vn||f}||d�}|}P�qd|tk�s�|dd
�tk�s�|dd�tk�r|d,dk�r�||f}ttj|��p�tj|d��p�tj|d
��}||d�d}}|}Pntt||||�V�qd|j��r�|d-k�rL|�rLt|dk�r8tnt||||�V�q�tt||||�}|dk�rv|
�rv|}
�q�|dk�r�|
�r�|
jtk�r�|
j dk�r�d}|	d.}tt|
j |
j!|
j|
j"�Vd}
|
�r�|
Vd}
|VnX|dk�r�d}nH|dk�r|d7}n|d k�r|d8}|
�r&|
Vd}
tt#||||�Vn*tt	||||f||df|�V|d7}�q�WqdW|
�r~|
Vd}
|�r�|d/dk�r�ttd|dt|�f|dt|�dfd�Vx0|	dd�D] } ttd|df|dfd�V�q�Wtt$d|df|dfd�VdS)0Nr�
0123456789rDFz	utf-8-sigzutf-8r�rzEOF in multi-line stringrz\
rz\
rc�	�z#
�#z
z3unindent does not match any outer indentation levelz
<tokenize>zEOF in multi-line statementr!z...T�
�async�await�def�\z([{z)]})rDr)rr)rr)rDr������rmrmrmrmrmrm)r�r�rmrm)%rr
r�r�ror[r�r|r��
ERRORTOKEN�tabsize�rstriprrrfrr�IndentationErrorrsrW�PseudoToken�spanr�ru�
triple_quoted�endpats�
single_quoted�get�isidentifierr�r�rr(r1rgr}r0rq)!r�ra�lnum�parenlev�	continued�numchars�contstr�needcont�contlinerx�stashed�	async_def�async_def_indent�async_def_nl�	last_liner}�pos�max�strstart�endprog�endmatchr|�column�
comment_token�nl_pos�pseudomatchrg�spos�eposr{�initialr�r~r-r-r.r��sr




*



"
 
















. r�cCs
t|d�S)N)r�)r�r-r-r.�generate_tokens�sr�c
s(ddl}dd��d�fdd�	}|jdd�}|jdd	d
dd�|jd
ddddd�|j�}y�|jr�|j}t|d��}tt|j��}WdQRXnd}t	t
jjd�}xF|D]>}|j}|j
r�|j}d|j|j}	td|	t||jf�q�WW�n8tk
�r:}
z2|
jddd�\}}||
jd|||f�WYdd}
~
Xn�tk
�r�}
z*|
jd\}}||
jd|||f�WYdd}
~
Xn�tk
�r�}
z||
|�WYdd}
~
Xnxtk
�r�}
z||
�WYdd}
~
XnNtk
�r�td�Yn2tk
�r"}
z�d|
��WYdd}
~
XnXdS)NrcSst|tjd�dS)N)�file)�print�sys�stderr)�messager-r-r.�perror�szmain.<locals>.perrorcsR|r"|f||f}�d|�n"|r8�d||f�n�d|�tjd�dS)Nz%s:%d:%d: error: %sz
%s: error: %sz	error: %sr)r��exit)r�r��location�args)r�r-r.�error�szmain.<locals>.errorzpython -m tokenize)�progr�r<zfilename.pyz'the file to tokenize; defaults to stdin)�dest�nargs�metavar�helpz-ez--exact�exact�
store_truez(display token names using the exact type)r��actionr�r�z<stdin>z%d,%d-%d,%d:z%-20s%-15s%-15rrrzinterrupted
zunexpected error: %s)NN)�argparse�ArgumentParser�add_argument�
parse_argsr�r��listr	r�r�r��stdinr(r�r3rgr|r�r)r1r�r�r[r��OSError�KeyboardInterrupt�	Exception)
rr��parserr�r�rAr^r{�
token_type�token_range�errr}r�r-)r�r.�main�sN
&&r�__main__)��__doc__�
__author__�__credits__�builtinsrr��codecsrr�collections�iorr�rrJrSr�r{rT�ASCIIr�r��__all__�N_TOKENSrr)rr
�LPAR�RPAR�LSQB�RSQB�COLON�COMMA�SEMI�PLUS�MINUS�STAR�SLASH�VBAR�AMPER�LESS�GREATER�EQUAL�DOT�PERCENT�LBRACE�RBRACE�EQEQUAL�NOTEQUAL�	LESSEQUAL�GREATEREQUAL�TILDE�
CIRCUMFLEX�	LEFTSHIFT�
RIGHTSHIFT�
DOUBLESTAR�	PLUSEQUAL�MINEQUAL�	STAREQUAL�
SLASHEQUAL�PERCENTEQUAL�
AMPEREQUAL�	VBAREQUAL�CIRCUMFLEXEQUAL�LEFTSHIFTEQUAL�RIGHTSHIFTEQUAL�DOUBLESTAREQUAL�DOUBLESLASH�DOUBLESLASHEQUAL�AT�ATEQUALr2�
namedtuplerr:r;r=�
Whitespace�Comment�Ignore�Name�	Hexnumber�	Binnumber�	Octnumber�	Decnumber�	Intnumber�Exponent�
Pointfloat�Expfloat�Floatnumber�
Imagnumber�NumberrRrW�StringPrefix�Single�Double�Single3�Double3�Triple�String�Operator�Bracket�Special�Funny�
PlainToken�Token�ContStr�PseudoExtrasr�r��_prefixrIr�r�rQr@rMr�r
r[r\r]rr�r
r	r�r�rr4r-r-r-r.�<module>s






_]x<
modulefinder.cpython-36.pyc000064400000036010150335715140011653 0ustar003


 \�Y�@sdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
e
j��e
jde
�ddlZWdQRXejdZejdZejdZejdZeefZejZiZdd	�ZiZd
d�ZGdd
�d
�ZGdd�d�Zdd�Zedk�ry
e�ZWnek
�re d�YnXdS)z3Find modules used by a script, using introspection.�N�ignore�
LOAD_CONST�IMPORT_NAME�
STORE_NAME�STORE_GLOBALcCstj|g�j|�dS)N)�packagePathMap�
setdefault�append)Zpackagename�path�r�$/usr/lib64/python3.6/modulefinder.py�AddPackagePath sr
cCs|t|<dS)N)�replacePackageMap)Zoldname�newnamerrr�ReplacePackage+src@seZdZddd�Zdd�ZdS)�ModuleNcCs(||_||_||_d|_i|_i|_dS)N)�__name__�__file__�__path__�__code__�globalnames�starimports)�self�name�filer
rrr�__init__1szModule.__init__cCsLd|jf}|jdk	r&|d|jf}|jdk	r@|d|jf}|d}|S)Nz	Module(%rz, %r�))rrr)r�srrr�__repr__>s

zModule.__repr__)NN)r�
__module__�__qualname__rrrrrrr/s

rc@s�eZdZddggfdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zd7dd�Z	d9dd�Z
dd�Zdd�Zd:dd�Z
dd�Zdd�Zdd�Zd d!�Zd<d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd=d,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)>�ModuleFinderNrcCsB|dkrtj}||_i|_i|_||_d|_||_||_g|_dS)Nr)	�sysr
�modules�
badmodules�debug�indent�excludes�
replace_paths�processed_paths)rr
r%r'r(rrrrIszModuleFinder.__init__cGs^||jkrZxt|j�D]}tddd�qWt|dd�x|D]}tt|�dd�q<Wt�dS)Nz   � )�end)r%�ranger&�print�repr)r�level�str�args�i�argrrr�msgUs

zModuleFinder.msgcGs,|d}||jkr(|jd|_|j|�dS)Nr�)r%r&r4)rr1r/rrr�msgin^s
zModuleFinder.msgincGs,|d}||jkr(|jd|_|j|�dS)Nrr5)r%r&r4)rr1r/rrr�msgoutds
zModuleFinder.msgoutcCsB|jdd|�t|��"}ddtjf}|jd|||�WdQRXdS)N��
run_script��r�__main__)r4�open�imp�	PY_SOURCE�load_module)r�pathname�fp�stuffrrrr9js
zModuleFinder.run_scriptcCsTtjj|�\}}tjj|�\}}t|��"}|dtjf}|j||||�WdQRXdS)Nr;)�osr
�split�splitextr=r>r?r@)rrA�dirrZextrBrCrrr�	load_fileps

zModuleFinder.load_filer5c	Cs\|jdd||||�|j||d�}|j||�\}}|j||�}|sF|S|jrX|j||�dS)N��import_hook)r/)r4�determine_parent�find_head_package�	load_tailr�ensure_fromlist)	rr�caller�fromlistr/�parent�q�tail�mrrrrJwszModuleFinder.import_hookcCsP|jdd||�|s|dkr.|jdd�dS|j}|dkr�|jrJ|d8}|dkrz|j|}||ksht�|jdd|�|S|jd�|kr�td��dj|j	d�d|��}|j|}|jdd|�|S|jr�|j|}||ks�t�|jdd|�|Sd|k�r@|j
d�}|d|�}|j|}|j|k�s.t�|jdd|�|S|jdd�dS)	N�rKrzdetermine_parent -> Noner5zdetermine_parent ->�.zrelative importpath too deep)r6r7rrr#�AssertionError�count�ImportError�joinrE�rfind)rrOr/ZpnamerQr2rrrrK�sB





zModuleFinder.determine_parentcCs�|jdd||�d|kr@|jd�}|d|�}||dd�}n|}d}|r\d|j|f}n|}|j|||�}|r�|jdd||f�||fS|r�|}d}|j|||�}|r�|jdd||f�||fS|jdd|�td	|��dS)
NrUrLrVr5r:z%s.%szfind_head_package ->z"raise ImportError: No module namedzNo module named )r6�findr�
import_moduler7rY)rrQrr2�headrSZqnamerRrrrrL�s.
zModuleFinder.find_head_packagecCs�|jdd||�|}xz|r�|jd�}|dkr4t|�}|d|�||dd�}}d|j|f}|j|||�}|s|jdd|�td|��qW|jdd	|�|S)
NrUrMrVrr5z%s.%sz"raise ImportError: No module namedzNo module named zload_tail ->)r6r\�lenrr]r7rY)rrRrSrTr2r^ZmnamerrrrM�s
zModuleFinder.load_tailcCs�|jdd|||�xl|D]d}|dkrF|s||j|�}|r||j||d�qt||�sd|j|f}|j|||�}|std|��qWdS)NrUrN�*r5z%s.%szNo module named )r4�find_all_submodulesrN�hasattrrr]rY)rrTrP�	recursive�sub�all�subnameZsubmodrrrrN�s


zModuleFinder.ensure_fromlistc
Cs�|js
dSi}g}|tjjdd�7}|tjjdd�7}|tjjdd�7}x�|jD]�}ytj|�}Wn$tk
r�|j	dd|�wVYnXx\|D]T}d}x6|D].}t
|�}	||	d�|kr�|d|	�}Pq�W|r�|dkr�|||<q�WqVW|j�S)Nr8zcan't list directoryr)r�	importlib�	machinery�EXTENSION_SUFFIXES�SOURCE_SUFFIXES�BYTECODE_SUFFIXESrD�listdir�OSErrorr4r_�keys)
rrTr#�suffixesrG�namesr�modZsuff�nrrrra�s.

z ModuleFinder.find_all_submodulescCs|jdd|||�y|j|}Wntk
r4YnX|jdd|�|S||jkrb|jdd�dS|r�|jdkr�|jdd�dSy|j||o�|j|�\}}}Wn"tk
r�|jddd�dSXz|j||||�}Wd|r�|j	�X|r�t
|||�|jdd|�|S)NrIr]zimport_module ->zimport_module -> None)r6r#�KeyErrorr7r$r�find_modulerYr@�close�setattr)rZpartname�fqnamerQrTrBrArCrrrr]�s6

zModuleFinder.import_modulecCs|\}}}|jdd||od|�|tjkrH|j||�}|jdd|�|S|tjkrht|j�d|d�}	nj|tjkr�yt	j
j|j��}
Wn:tk
r�}z|jddt
|�|��WYdd}~XnXtj|
�}	nd}	|j|�}||_|	�r
|jr�|j|	�}	|	|_|j|	|�|jdd|�|S)Nr8r@rBzload_module ->�
�execzraise ImportError: )r6r>Z
PKG_DIRECTORY�load_packager7r?�compile�readZPY_COMPILEDrg�_bootstrap_external�_validate_bytecode_headerrYr0�marshal�loads�
add_modulerr(�replace_paths_in_coder�	scan_code)rrwrBrA�	file_info�suffix�mode�typerT�coZmarshal_data�excrrrr@s2





zModuleFinder.load_modulecCs<||jkri|j|<|r*d|j||j<nd|j|d<dS)Nr5�-)r$r)rrrOrrr�_add_badmodule4s


zModuleFinder._add_badmodulecCs||jkr|j||�dSy|j|||d�Wn@tk
rn}z$|jddt|��|j||�WYdd}~Xn�X|�rx�|D]�}||jkr�|j||�q|y|j|||g|d�Wq|tk
r�}z0|jddt|��|d|}|j||�WYdd}~Xq|Xq|WdS)N)r/r8zImportError:rV)r$r�rJrYr4r0)rrrOrPr/r4rd�fullnamerrr�_safe_import_hook<s&


zModuleFinder._safe_import_hookccs�|j}|j}|j}dd�tj|�D�}x�t|�D]�\}\}}|tkrVd||ffVq0|tkr0|dkr0||dd||ddko�tknr0|||dd}	|||dd}
|	dkr�d|
||ffVq0d|	|
||ffVq0q0WdS)	NcSs"g|]\}}}|tkr||f�qSr)�EXTENDED_ARG)�.0�_�opr3rrr�
<listcomp>Xsz-ModuleFinder.scan_opcodes.<locals>.<listcomp>�storer8r5r�absolute_import�relative_import)	�co_code�co_names�	co_consts�disZ_unpack_opargs�	enumerate�	STORE_OPSrr)rr��coderp�constsZopargsr2r�Zopargr/rPrrr�scan_opcodesSs 0zModuleFinder.scan_opcodescCs�|j}|j}�xT||�D�]F\}}|dkr<|\}d|j|<q|dk�r|\}}d}	|dk	rtd|krfd}	dd�|D�}|j|||dd�|	�r`d}
|jr�|jj|jd	|�}
|
dkr�|jj|�}
|
dk	r�|jj|
j�|j	j|
j	�|
j
dkr�d|j	|<n
d|j	|<q|d
k�rX|\}}}|�r4|j||||d�n"|j||d�}|j|jd|dd�qt|��qWx,|j
D]"}
t|
t|���rl|j|
|��qlWdS)Nr�r5r�rr`cSsg|]}|dkr|�qS)r`r)r��frrrr�usz*ModuleFinder.scan_code.<locals>.<listcomp>)r/rVr�)r�r�rr�rr#�getr�updaterrrK�RuntimeErrorr��
isinstancer�r�)rr�rTr��scannerZwhatr1rrPZ	have_starZmmr/rQ�crrrr�hsH



zModuleFinder.scan_codecCs�|jdd||�tj|�}|r"|}|j|�}||_|g|_|jtj|g�|_|jd|j�\}}}z"|j||||�|j	dd|�|S|r�|j
�XdS)Nr8rzrzload_package ->)r6rr�r�rrrrtr@r7ru)rrwrArrTrBZbufrCrrrrz�s

zModuleFinder.load_packagecCs*||jkr|j|St|�|j|<}|S)N)r#r)rrwrTrrrr��s

zModuleFinder.add_modulecCsr|dk	r|jd|}n|}||jkr<|jdd|�t|��|dkrf|tjkr`ddddtjffS|j}tj	||�S)NrVrIzfind_module -> Excludedr:)
rr'r7rYr"�builtin_module_namesr>Z	C_BUILTINr
rt)rrr
rQr�rrrrt�s

zModuleFinder.find_modulecCs"t�tdd�tdd�t|jj��}xJ|D]B}|j|}|jrTtddd�ntddd�td	||jppd
�q2W|j�\}}|r�t�td�x2|D]*}t|j|j��}td|d
dj|��q�W|�rt�tddd�td�x2|D]*}t|j|j��}td|d
dj|��q�WdS)z�Print a report to stdout, listing the found modules with their
        paths, as well as modules that are missing, or seem to be missing.
        z
  %-25s %s�Name�File�----�Pr*)r+rTz%-25sr:zMissing modules:�?z
imported fromz, z7Submodules that appear to be missing, but could also bez#global names in the parent package:N)r�r�)r�r�)	r-�sortedr#rnrr�any_missing_mayber$rZ)rrn�keyrT�missing�mayberZmodsrrr�report�s0



zModuleFinder.reportcCs|j�\}}||S)z�Return a list of modules that appear to be missing. Use
        any_missing_maybe() if you want to know which modules are
        certain to be missing, and which *may* be missing.
        )r�)rr�r�rrr�any_missing�szModuleFinder.any_missingcCs�g}g}x�|jD]�}||jkr q|jd�}|dkr>|j|�q||dd�}|d|�}|jj|�}|dk	r�||j|kr�|j|�q�||jkr�q�|jr�|j|�q�|j|�q|j|�qW|j�|j�||fS)a�Return two lists, one with modules that are certainly missing
        and one with modules that *may* be missing. The latter names could
        either be submodules *or* just global names in the package.

        The reason it can't always be determined is that it's impossible to
        tell which names are imported when "from module import *" is done
        with an extension module, short of actually importing it.
        rVrr5N)	r$r'r[r	r#r�rr�sort)rr�r�rr2rfZpkgnameZpkgrrrr��s0	



zModuleFinder.any_missing_maybecCstjj|j�}}x2|jD](\}}|j|�r||t|�d�}PqW|jr�||jkr�||krt|j	dd||f�n|j	dd|f�|jj
|�t|j�}x8t
t|��D](}t||t|��r�|j||�||<q�Wtj|j|j|j|j|j|jt|�|j|j||j|j|j|j|j �S)Nr8zco_filename %r changed to %rz co_filename %r remains unchanged)!rDr
�normpath�co_filenamer(�
startswithr_r%r)r7r	�listr�r,r�r�r��types�CodeType�co_argcount�co_kwonlyargcount�
co_nlocals�co_stacksize�co_flagsr��tupler��co_varnames�co_name�co_firstlineno�	co_lnotab�co_freevars�co_cellvars)rr�Znew_filenameZoriginal_filenamer�r;r�r2rrrr�s,



z"ModuleFinder.replace_paths_in_code���)NNr�r�)r�)rr�)r�)N)rrr rr4r6r7r9rHrJrKrLrMrNrar]r@r�r�r�r�rzr�rtr�r�r�r�rrrrr!Gs2	

#

1
".r!cCs�ddl}y|jtjdd�d�\}}Wn*|jk
rP}zt|�dSd}~XnXd}d}g}g}xb|D]Z\}}	|dkr�|d}|dkr�d}|dkr�||	jtj�}|dkr�d}|dkrh|j|	�qhW|s�d	}
n|d}
tj	dd�}tj	j
|
�|d<||}|dk�r.td
�x|D]}tdt|���qWt|||�}
xp|dd�D]`}|dk�r^d}�qH|�r�|dd�d
k�r�|
j
|dd�ddg�n
|
j
|�n
|
j|��qHW|
j|
�|
j�|
S)Nrr5zdmp:qx:z-dz-mz-pz-qz-xzhello.pyzpath:z   r8z.*r`���r�)�getoptr"�argv�errorr-rErD�pathsepr	r
�dirnamer.r!rJrHr9r�)r�Zoptsr1r4r%ZdomodsZaddpathZexclude�o�aZscriptr
�item�mfr3rrr�test:sX



r�r<z
[interrupted])!�__doc__r�Zimportlib._bootstrap_externalrg�importlib.machineryrrDr"r�Zstruct�warnings�catch_warnings�simplefilter�DeprecationWarningr>Zopmaprrrrr�r�rr
rrrr!r�rr��KeyboardInterruptr-rrrr�<module>sB




v;

cProfile.cpython-36.opt-2.pyc000064400000007373150335715140011713 0ustar003


 \�@svdddgZddlZddlZddd�Zddd�Zejje_ejje_Gdd�dej�Zd	d
�Z	dd�Z
ed
krre
�dS)�run�runctx�Profile�N�cCstjt�j|||�S)N)�
_pyprofile�_Utilsrr)�	statement�filename�sort�r� /usr/lib64/python3.6/cProfile.pyrscCstjt�j|||||�S)N)rrrr)r�globals�localsr	r
rrrrsc@sFeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)rrcCs$ddl}|j|�j�j|�j�dS)Nr)�pstats�StatsZ
strip_dirsZ
sort_stats�print_stats)�selfr
rrrrr(szProfile.print_statsc
Cs8ddl}t|d��}|j�|j|j|�WdQRXdS)Nr�wb)�marshal�open�create_stats�dump�stats)r�filer�frrr�
dump_stats,szProfile.dump_statscCs|j�|j�dS)N)�disable�snapshot_stats)rrrrr2szProfile.create_statscCs6|j�}i|_i}xX|D]P}t|j�}|j}||j}|j}|j}i}	|	|t|j�<|||||	f|j|<qWx�|D]�}|j	rrt|j�}x�|j	D]�}
y|t|
j�}	Wnt
k
r�w�YnX|
j}||
j}|
j}|
j}||	k�r|	|}||d7}||d7}||d7}||d7}||||f|	|<q�WqrWdS)Nrr��)Zgetstatsr�label�codeZ	callcountZreccallcountZ
inlinetimeZ	totaltime�idZcalls�KeyError)rZentriesZcallersdicts�entry�funcZncZccZttZctZcallersZsubentry�prevrrrr6s>






zProfile.snapshot_statscCsddl}|j}|j|||�S)Nr)�__main__�__dict__r)r�cmdr'�dictrrrr\szProfile.runc
Cs(|j�zt|||�Wd|j�X|S)N)�enable�execr)rr)r
rrrrras

zProfile.runctxc
Os"|j�z
|||�S|j�XdS)N)r+r)rr%�args�kwrrr�runcalljs
zProfile.runcallN���)r0)
�__name__�
__module__�__qualname__rrrrrrr/rrrrrs
&	cCs(t|t�rdd|fS|j|j|jfSdS)N�~r)�
isinstance�str�co_filename�co_firstlineno�co_name)r!rrrr ss

r c
Cs&ddl}ddl}ddl}ddlm}d}||d�}d|_|jdddd	dd
�|jddd
ddt|jj	�d�|j
dd�s�|j�|jd�|j
�\}}||j
dd�<t|�dk�r|d}|jjd|jj|��t|d��}	t|	j�|d�}
WdQRX|dddd�}t|
|d|j|j�n|j�|S)Nr)�OptionParserz@cProfile.py [-o output_file_path] [-s sort] scriptfile [arg] ...)�usageFz-oz	--outfile�outfilezSave stats to <outfile>)�dest�help�defaultz-sz--sortr
z?Sort order when printing to stdout, based on pstats.Stats classr)r=r>r?�choicesr�rbr,r')�__file__r1�__package__�
__cached__r0)�os�sysrZoptparser:Zallow_interspersed_argsZ
add_option�sortedrZsort_arg_dict_default�argvZprint_usage�exit�
parse_args�len�path�insert�dirnamer�compile�readrr<r
)rErFrr:r;�parserZoptionsr-Zprogname�fpr!Zglobsrrr�main{s8




rSr'r0)Nr0r0)Nr0)�__all__Z_lsprofZprofilerrr�__doc__ZProfilerrr rSr1rrrr�<module>s




X%uuid.cpython-36.pyc000064400000050724150335715140010154 0ustar003

�\dh�]�@s
dZddlZdZddddg\ZZZZeZe	Z
Gdd	�d	e�Zd
d�Z
dd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdZZy�ddlZddlZddlZdgZejjd�s�ejd�xLeD]DZyej ej!j"e��Z#Wne$k
r�w�YnXe%e#d�r�e#j&ZPq�W[ejd k�r@eej'�j(j)d!�d�d"k�r@dZyej*j+Z#WndZ#YnXe,e#d#e,e#d$d��ZWnYnXd%d&�Z-d'd(�Z.d)d*�Z/da0e.eegZ1e-eeeeegZ2d+d,�Z3da4d9d-d.�Z5d/d0�Z6d1d2�Z7d3d4�Z8ed5�Z9ed6�Z:ed7�Z;ed8�Z<dS):aQUUID objects (universally unique identifiers) according to RFC 4122.

This module provides immutable UUID objects (class UUID) and the functions
uuid1(), uuid3(), uuid4(), uuid5() for generating version 1, 3, 4, and 5
UUIDs as specified in RFC 4122.

If all you want is a unique ID, you should probably call uuid1() or uuid4().
Note that uuid1() may compromise privacy since it creates a UUID containing
the computer's network address.  uuid4() creates a random UUID.

Typical usage:

    >>> import uuid

    # make a UUID based on the host ID and current time
    >>> uuid.uuid1()    # doctest: +SKIP
    UUID('a8098c1a-f86e-11da-bd1a-00112444be1e')

    # make a UUID using an MD5 hash of a namespace UUID and a name
    >>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')
    UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')

    # make a random UUID
    >>> uuid.uuid4()    # doctest: +SKIP
    UUID('16fd2706-8baf-433b-82eb-8c7fada847da')

    # make a UUID using a SHA-1 hash of a namespace UUID and a name
    >>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')
    UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')

    # make a UUID from a string of hex digits (braces and hyphens ignored)
    >>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}')

    # convert a UUID to a string of hex digits in standard form
    >>> str(x)
    '00010203-0405-0607-0809-0a0b0c0d0e0f'

    # get the raw 16 bytes of the UUID
    >>> x.bytes
    b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f'

    # make a UUID from a 16-byte string
    >>> uuid.UUID(bytes=x.bytes)
    UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')
�NzKa-Ping Yee <ping@zesty.ca>zreserved for NCS compatibilityzspecified in RFC 4122z$reserved for Microsoft compatibilityzreserved for future definitionc@seZdZdZd7dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zedd��Zedd��Zedd��Zedd ��Zed!d"��Zed#d$��Zed%d&��Zed'd(��Zed)d*��Zed+d,��Zed-d.��Zed/d0��Zed1d2��Zed3d4��Zed5d6��ZdS)8�UUIDa�Instances of the UUID class represent UUIDs as specified in RFC 4122.
    UUID objects are immutable, hashable, and usable as dictionary keys.
    Converting a UUID to a string with str() yields something in the form
    '12345678-1234-1234-1234-123456789abc'.  The UUID constructor accepts
    five possible forms: a similar string of hexadecimal digits, or a tuple
    of six integer fields (with 32-bit, 16-bit, 16-bit, 8-bit, 8-bit, and
    48-bit values respectively) as an argument named 'fields', or a string
    of 16 bytes (with all the integer fields in big-endian order) as an
    argument named 'bytes', or a string of 16 bytes (with the first three
    fields in little-endian order) as an argument named 'bytes_le', or a
    single 128-bit integer as an argument named 'int'.

    UUIDs have these read-only attributes:

        bytes       the UUID as a 16-byte string (containing the six
                    integer fields in big-endian byte order)

        bytes_le    the UUID as a 16-byte string (with time_low, time_mid,
                    and time_hi_version in little-endian byte order)

        fields      a tuple of the six integer fields of the UUID,
                    which are also available as six individual attributes
                    and two derived attributes:

            time_low                the first 32 bits of the UUID
            time_mid                the next 16 bits of the UUID
            time_hi_version         the next 16 bits of the UUID
            clock_seq_hi_variant    the next 8 bits of the UUID
            clock_seq_low           the next 8 bits of the UUID
            node                    the last 48 bits of the UUID

            time                    the 60-bit timestamp
            clock_seq               the 14-bit sequence number

        hex         the UUID as a 32-character hexadecimal string

        int         the UUID as a 128-bit integer

        urn         the UUID as a URN as specified in RFC 4122

        variant     the UUID variant (one of the constants RESERVED_NCS,
                    RFC_4122, RESERVED_MICROSOFT, or RESERVED_FUTURE)

        version     the UUID version number (1 through 5, meaningful only
                    when the variant is RFC_4122)
    NcCs�|||||gjd�dkr td��|dk	rl|jdd�jdd�}|jd�jdd�}t|�d	krbtd
��t|d�}|dk	r�t|�dkr�td��|d(dd)�|d*d+d,�|d-d.d/�|dd�}|dk	�rt|�dkr�td��t|t��s�t	t
|���tj|dd�}|dk	�r:t|�dk�r"td��|\}}}	}
}}d|k�oFd0kn�sVtd��d|k�ojd1kn�sztd��d|	k�o�d2kn�s�td��d|
k�o�d3kn�s�td��d|k�o�d4kn�s�td��d|k�o�d5kn�s
td��|
d>|B}
|d>|d>B|	d>B|
d>B|B}|dk	�rld|k�o\d
d>kn�sltd ��|dk	�r�d
|k�o�d!kn�s�td"��|d7M}|d8O}|d:M}||d&>O}||jd'<dS);amCreate a UUID from either a string of 32 hexadecimal digits,
        a string of 16 bytes as the 'bytes' argument, a string of 16 bytes
        in little-endian order as the 'bytes_le' argument, a tuple of six
        integers (32-bit time_low, 16-bit time_mid, 16-bit time_hi_version,
        8-bit clock_seq_hi_variant, 8-bit clock_seq_low, 48-bit node) as
        the 'fields' argument, or a single 128-bit integer as the 'int'
        argument.  When a string of hex digits is given, curly braces,
        hyphens, and a URN prefix are all optional.  For example, these
        expressions all yield the same UUID:

        UUID('{12345678-1234-5678-1234-567812345678}')
        UUID('12345678123456781234567812345678')
        UUID('urn:uuid:12345678-1234-5678-1234-567812345678')
        UUID(bytes='\x12\x34\x56\x78'*4)
        UUID(bytes_le='\x78\x56\x34\x12\x34\x12\x78\x56' +
                      '\x12\x34\x56\x78\x12\x34\x56\x78')
        UUID(fields=(0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678))
        UUID(int=0x12345678123456781234567812345678)

        Exactly one of 'hex', 'bytes', 'bytes_le', 'fields', or 'int' must
        be given.  The 'version' argument is optional; if given, the resulting
        UUID will have its variant and version set according to RFC 4122,
        overriding the given 'hex', 'bytes', 'bytes_le', 'fields', or 'int'.
        N�zGone of the hex, bytes, bytes_le, fields, or int arguments must be givenzurn:�zuuid:z{}�-� z$badly formed hexadecimal UUID string�z bytes_le is not a 16-char string���zbytes is not a 16-char string�big)�	byteorderzfields is not a 6-tuplerz*field 1 out of range (need a 32-bit value)z*field 2 out of range (need a 16-bit value)z*field 3 out of range (need a 16-bit value)z*field 4 out of range (need an 8-bit value)z*field 5 out of range (need an 8-bit value)�0z*field 6 out of range (need a 48-bit value)�`�P�@�z*int is out of range (need a 128-bit value)�zillegal version numberi�i�i��L�int����rrr�rrlii�rlll����lll����)
�count�	TypeError�replace�strip�len�
ValueError�int_�
isinstance�bytes_�AssertionError�repr�
from_bytes�__dict__)�self�hex�bytes�bytes_le�fieldsr�version�time_low�time_mid�time_hi_version�clock_seq_hi_variant�
clock_seq_low�node�	clock_seq�r3�/usr/lib64/python3.6/uuid.py�__init__js\
6

$
 
z
UUID.__init__cCst|t�r|j|jkStS)N)r rr�NotImplemented)r&�otherr3r3r4�__eq__�s
zUUID.__eq__cCst|t�r|j|jkStS)N)r rrr6)r&r7r3r3r4�__lt__�s
zUUID.__lt__cCst|t�r|j|jkStS)N)r rrr6)r&r7r3r3r4�__gt__�s
zUUID.__gt__cCst|t�r|j|jkStS)N)r rrr6)r&r7r3r3r4�__le__�s
zUUID.__le__cCst|t�r|j|jkStS)N)r rrr6)r&r7r3r3r4�__ge__�s
zUUID.__ge__cCs
t|j�S)N)�hashr)r&r3r3r4�__hash__�sz
UUID.__hash__cCs|jS)N)r)r&r3r3r4�__int__�szUUID.__int__cCsd|jjt|�fS)Nz%s(%r))�	__class__�__name__�str)r&r3r3r4�__repr__�sz
UUID.__repr__cCstd��dS)NzUUID objects are immutable)r)r&�name�valuer3r3r4�__setattr__�szUUID.__setattr__cCsDd|j}d|dd�|dd�|dd�|dd�|dd�fS)Nz%032xz%s-%s-%s-%s-%sr
�r�)r)r&r'r3r3r4�__str__�s
zUUID.__str__cCs|jjdd�S)Nrr)r�to_bytes)r&r3r3r4r(�sz
UUID.bytescCs<|j}|ddd�|ddd	�|d
dd�|dd�S)
Nrrr	r
rrrrrrrr)r()r&r(r3r3r4r)�s(z
UUID.bytes_lecCs|j|j|j|j|j|jfS)N)r,r-r.r/r0r1)r&r3r3r4r*�szUUID.fieldscCs
|jd?S)Nr)r)r&r3r3r4r,�sz
UUID.time_lowcCs|jd?d@S)Nri��)r)r&r3r3r4r-�sz
UUID.time_midcCs|jd?d@S)Nri��)r)r&r3r3r4r.�szUUID.time_hi_versioncCs|jd?d@S)N�8�)r)r&r3r3r4r/szUUID.clock_seq_hi_variantcCs|jd?d@S)Nr
rL)r)r&r3r3r4r0szUUID.clock_seq_lowcCs|jd@d>|jd>B|jBS)Ni�r
r)r.r-r,)r&r3r3r4�time
sz	UUID.timecCs|jd@d>|jBS)N�?r
)r/r0)r&r3r3r4r2szUUID.clock_seqcCs
|jd@S)Nl���)r)r&r3r3r4r1sz	UUID.nodecCs
d|jS)Nz%032x)r)r&r3r3r4r'szUUID.hexcCsdt|�S)Nz	urn:uuid:)rB)r&r3r3r4�urnszUUID.urncCs2|jd@stS|jd@stS|jd@s*tStSdS)Ni�r
i@i lll)r�RESERVED_NCS�RFC_4122�RESERVED_MICROSOFT�RESERVED_FUTURE)r&r3r3r4�variant s


zUUID.variantcCs |jtkrt|jd?d@�SdS)Nr�)rTrQr)r&r3r3r4r++s
zUUID.version)NNNNNN)rA�
__module__�__qualname__�__doc__r5r8r9r:r;r<r>r?rCrFrI�propertyr(r)r*r,r-r.r/r0rMr2r1r'rOrTr+r3r3r3r4r:s8.
Orc	Gs�ddl}ddl}ddl}|j|�}|dkrP|jjd�}|j||d�}|dkrPdSt|j�}d|d<|j|f||j	|j
|d�}|S)	Nr�/sbin�	/usr/sbin)�path�C�LC_ALL)�stdout�stderr�env)rZr[)�os�shutil�
subprocessZwhich�pathsep�join�dict�environ�Popen�PIPEZDEVNULL)	�command�argsrbrcrd�
executabler\ra�procr3r3r4�_popen1s

roc
Cs�y�t|f|j���}|sdS|��x�|jD]z}|j�j�j�}xdtt|��D]T}|||krLy*|||�}t|jdd�d�}	|	r�|	SWqLt	t
fk
r�YqLXqLWq*WWdQRXWntk
r�YnXdS)N�:�r)ro�splitr_�lower�rstrip�rangerrrr�
IndexError�OSError)
rkrlZhw_identifiersZ	get_indexrn�line�words�i�word�macr3r3r4�	_find_macDs$r}cCs0d}x&d
D]}td||d	d
��}|r
|Sq
WdS)z5Get the hardware address on Unix by running ifconfig.�hwaddr�ether�address:�lladdrr�-a�-avZifconfigcSs|dS)Nrr3)rzr3r3r4�<lambda>bsz#_ifconfig_getnode.<locals>.<lambda>N)r~rr�r�)rr�r�)r})�keywordsrlr|r3r3r4�_ifconfig_getnode]s

r�cCs tdddgdd��}|r|SdS)z/Get the hardware address on Unix by running ip.Zip�links
link/ethercSs|dS)Nrr3)rzr3r3r4r�isz_ip_getnode.<locals>.<lambda>N)r})r|r3r3r4�_ip_getnodefsr�cCs�ddl}ddl}y|j|j��}Wntk
r6dSXtdd|j|�gdd��}|rZ|Stdd|j|�gdd��}|r||Stdd|jd|�gd	d��}|r�|SdS)
z0Get the hardware address on Unix by running arp.rNZarpz-ancSsdS)Nrrr3)rzr3r3r4r�vsz_arp_getnode.<locals>.<lambda>cSs|dS)Nrr3)rzr3r3r4r�{sz(%s)cSs|dS)N�r3)rzr3r3r4r��s)rb�socketZ
gethostbynameZgethostnamerwr}�fsencode)rbr�Zip_addrr|r3r3r4�_arp_getnodems
r�cCstdddgdd��S)z4Get the hardware address on Unix by running lanscan.Zlanscanz-aislan0cSsdS)Nrr3)rzr3r3r4r��sz"_lanscan_getnode.<locals>.<lambda>)r}r3r3r3r4�_lanscan_getnode�sr�c"Cs�y�tdd�}|sdS|��|jj�j�j�}y|jd�}Wntk
rNdSXxt|jD]j}yL|j�j�}||}t|�dkr�|jd�dkr�t	|j
dd�d	�}|r�|SWqXttfk
r�YqXXqXWWdQRXWntk
r�YnXdS)
z4Get the hardware address on Unix by running netstat.Znetstatz-iaNsAddress�rprrqr)
ror_�readlinertrr�indexrrrrrrvrw)rnryrzrxr{r|r3r3r4�_netstat_getnode�s,
r�c
Csddl}ddl}ddl}dddg}y:ddl}|jd�}|jjj|d�|jd|j	j
d��WnYnXx�|D]�}y$|j|jj
|d�d	g|jd
d�}Wntk
r�wpYnX|�JxB|jD]8}|jd�dj�j�}	|jd|	�r�t|	jdd�d�Sq�WWdQRXqpWdS)z<Get the hardware address on Windows by running ipconfig.exe.rNrzc:\windows\system32zc:\winnt\system32i,�mbcsZipconfigz/allZoem)r_�encoding�:rz((?:[0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]rrr)rb�rerd�ctypes�create_string_buffer�windllZkernel32ZGetSystemDirectoryA�insertrE�decoderir\rfrjrwr_rrrrs�	fullmatchrr)
rbr�rd�dirsr��buffer�dirrnrxrEr3r3r4�_ipconfig_getnode�s*


r�cCsddl}ddl}|j�}|j|_|j�|_}|j�|j|�dkrHdS|j	�x�t
|j�D]�}|j�|j
|_t|j|�|_|j|�dkr�q\|j�|j|_t|j|�|_djd�|_|j�|_}|j|�dkr�q\|j	�|jdd�}t|�dkr�q\tj|d�SWdS)ztGet the hardware address on Windows using NetBIOS calls.
    See http://support.microsoft.com/kb/118623 for details.rN�*rr	r)�	win32wnet�netbiosZNCBZNCBENUMZCommandZ	LANA_ENUMZBufferZ_packZNetbiosZ_unpackruZlengthZResetZNCBRESET�ordZlanaZLana_numZNCBASTAT�ljustZCallnameZADAPTER_STATUSZadapter_addressrrr$)r�r�ZncbZadaptersrzZstatusr(r3r3r4�_netbios_getnode�s4r�Zuuid�win�c�uuid_generate_time�darwin�.�	ZUuidCreateSequentialZ
UuidCreatecCs$tjd�}t|�tt|j�d�jS)z.Get the hardware address on Unix using ctypes.r)r()r�r��_uuid_generate_timerr!�rawr1)�_bufferr3r3r4�_unixdll_getnodes
r�cCs,tjd�}t|�dkr(tt|j�d�jSdS)z1Get the hardware address on Windows using ctypes.rr)r(N)r�r��_UuidCreaterr!r�r1)r�r3r3r4�_windll_getnodes
r�cCsddl}|jd�dBS)zCGet a random node ID, with eighth bit set as suggested by RFC 4122.rNr
l)�random�getrandbits)r�r3r3r4�_random_getnodesr�c
Cs�tdk	rtSddl}|jdkr$t}nt}xP|tgD]B}y
|�aWnw4YnXtdk	r4dtkoldknr4tSq4Wds�tdjt���dS)	a3Get the hardware address as a 48-bit positive integer.

    The first time this runs, it may launch a separate program, which could
    be quite slow.  If all attempts to obtain the hardware address fail, we
    choose a random 48-bit number with its eighth bit set to 1 as recommended
    in RFC 4122.
    NrZwin32rr
Fz,_random_getnode() returned invalid value: {}l)�_node�sys�platform�_NODE_GETTERS_WIN32�_NODE_GETTERS_UNIXr�r"�format)r�Zgetters�getterr3r3r4�getnode&s


 r�cCs�tr>||kodknr>tjd�}t|�tt|j�d�Sddl}t|j�d�}t|d�d}tdk	r~|tkr~td}|a|dkr�ddl	}|j
d	�}|d
@}|d?d@}|d
?d@}	|d@}
|d?d@}|dkr�t�}t|||	||
|fdd�S)aGenerate a UUID from a host ID, sequence number, and the current time.
    If 'node' is not given, getnode() is used to obtain the hardware
    address.  If 'clock_seq' is given, it is used as the sequence number;
    otherwise a random 14-bit sequence number is chosen.Nr)r(rge��A�dl@'Hw�
r�l��ri��r
i�rLr
rN)r*r+)r�r�r�rr!r�rMr�_last_timestampr�r�r�)r1r2r�rMZnanosecondsZ	timestampr�r,r-r.r0r/r3r3r4�uuid1Ds,

r�cCs<ddlm}||jt|d�dd�j�}t|dd�dd	�S)
zAGenerate a UUID from the MD5 hash of a namespace UUID and a name.r)�md5zutf-8F)ZusedforsecurityNrr)r(r+)�hashlibr�r(�digestr)�	namespacerDr�r�r3r3r4�uuid3gs
r�cCsttjd�dd�S)zGenerate a random UUID.rr)r(r+)rrb�urandomr3r3r3r4�uuid4psr�cCs8ddlm}||jt|d��j�}t|dd�dd�S)zCGenerate a UUID from the SHA-1 hash of a namespace UUID and a name.r)�sha1zutf-8Nrr)r(r+)r�r�r(r�r)r�rDr�r=r3r3r4�uuid5tsr�z$6ba7b810-9dad-11d1-80b4-00c04fd430c8z$6ba7b811-9dad-11d1-80b4-00c04fd430c8z$6ba7b812-9dad-11d1-80b4-00c04fd430c8z$6ba7b814-9dad-11d1-80b4-00c04fd430c8)NN)=rXrb�
__author__rPrQrRrSrrr(r!�objectrror}r�r�r�r�r�r�r�r�r�r�Zctypes.utilr�Z	_libnamesr��
startswith�appendZlibnameZCDLL�utilZfind_library�lib�	Exception�hasattrr��uname�releaserrr�Zrpcrt4�getattrr�r�r�r�r�r�r�r�r�r�r�r�Z
NAMESPACE_DNSZ
NAMESPACE_URLZ
NAMESPACE_OIDZNAMESPACE_X500r3r3r3r4�<module>-szx	"


	




#	cgi.cpython-36.pyc000064400000067720150335715140007754 0ustar003

�\dhc��@s�dZdZddlmZmZmZddlmZddlZddl	Z	ddl
Zddlm
Z
ddlmZddlmZddlZddlZddlZd	d
ddd
ddddddddddgZdadadd�Zdd�Zdd�Zdd �Zeadade	jdddfd!d�Zd5d"d�Z d6d#d
�Z!d$d�Z"d%d&�Z#d'd�Z$Gd(d	�d	�Z%Gd)d
�d
�Z&e	jfd*d�Z'd7d+d�Z(e	jfd,d�Z)d-d�Z*d.d�Z+d/d�Z,d0d�Z-d8d1d�Z.d2d3�Z/e0d4k�r�e'�dS)9z�Support module for CGI (Common Gateway Interface) scripts.

This module defines a number of utilities for use by CGI scripts
written in Python.
z2.6�)�StringIO�BytesIO�
TextIOWrapper)�MappingN)�
FeedParser)�Message)�warn�MiniFieldStorage�FieldStorage�parse�parse_qs�	parse_qsl�parse_multipart�parse_header�test�print_exception�
print_environ�
print_form�print_directory�print_arguments�print_environ_usage�escape�cGsHtr.tr.yttd�aWntk
r,YnXts8tantat|�dS)a�Write a log message, if there is a log file.

    Even though this function is called initlog(), you should always
    use log(); log is a variable that is set either to initlog
    (initially), to dolog (once the log file has been opened), or to
    nolog (when logging is disabled).

    The first argument is a format string; the remaining arguments (if
    any) are arguments to the % operator, so e.g.
        log("%s: %s", "a", "b")
    will write "a: b" to the log file, followed by a newline.

    If the global logfp is not None, it should be a file object to
    which log data is written.

    If the global logfp is None, the global logfile may be a string
    giving a filename to open, in append mode.  This file should be
    world writable!!!  If the file can't be opened, logging is
    silently disabled (since there is no safe place where we could
    send an error message).

    �aN)�logfile�logfp�open�OSError�nolog�log�dolog)�allargs�r"�/usr/lib64/python3.6/cgi.py�initlog:s
r$cGstj||d�dS)z=Write a log message to the log file.  See initlog() for docs.�
N)r�write)Zfmt�argsr"r"r#r ]sr cGsdS)z9Dummy function, assigned to log when logging is disabled.Nr")r!r"r"r#rasrcCsdatrtj�datadS)zClose the log file.rN)rr�closer$rr"r"r"r#�closeloges
r)c
Cs\|dkrtj}t|d�r |j}nd}t|t�r4|j}d|krDd|d<|ddk�rt|d�\}}|dkrxt|||d	�S|d
kr�t	|d�}t
r�|t
kr�td��|j|�j
|�}	nd
}	d|kr�|	r�|	d}	|	|d}	n*tjdd��r|	r�|	d}	|	tjd}	|	|d<n<d|k�r |d}	n(tjdd��r<tjd}	nd
}	|	|d<tjj|	|||d�S)avParse a query in the environment or from a file (default stdin)

        Arguments, all optional:

        fp              : file pointer; default: sys.stdin.buffer

        environ         : environment dictionary; default: os.environ

        keep_blank_values: flag indicating whether blank values in
            percent-encoded forms should be treated as blank strings.
            A true value indicates that blanks should be retained as
            blank strings.  The default false value indicates that
            blank values are to be ignored and treated as if they were
            not included.

        strict_parsing: flag indicating what to do with parsing errors.
            If false (the default), errors are silently ignored.
            If true, errors raise a ValueError exception.

        separator: str. The symbol to use for separating the query arguments.
    N�encodingzlatin-1�REQUEST_METHOD�GET�POST�CONTENT_TYPEzmultipart/form-data)�	separatorz!application/x-www-form-urlencoded�CONTENT_LENGTHzMaximum content length exceededr�QUERY_STRING�&�)r*)�sys�stdin�hasattrr*�
isinstancer�bufferrr�int�maxlen�
ValueError�read�decode�argv�urllibrr)
�fp�environ�keep_blank_values�strict_parsingr/r*�ctype�pdict�clength�qsr"r"r#rxsH




cCs tdtd�tjj||||d�S)z)Parse a query given as a string argument.z=cgi.parse_qs is deprecated, use urllib.parse.parse_qs instead�)r/)r�DeprecationWarningr?rr)rGrBrCr/r"r"r#r�scCs tdtd�tjj||||d�S)z)Parse a query given as a string argument.z?cgi.parse_qsl is deprecated, use urllib.parse.parse_qsl insteadrH)r/)rrIr?rr
)rGrBrCr/r"r"r#r
�scCs�ddl}d}d|kr|d}t|�s2td|f��d|}d|d}i}d}�x�||k�r�d}d}	|r�|jj|�}
|
jd�}|r�yt|�}Wntk
r�YnX|dkr�tr�|tkr�td	��|j|�}	nd}	g}xD|j	�}
|
s�|}P|
j
d��r|
j�}|||fk�rP|j|
�q�W|	dk�r&qR|dk�r�|�r�|d}
|
dd�dk�r^|
dd�}
n|
dd�dk�r||
dd�}
|
|d<dj
|�}	|
d
}
|
�s�qRt|
�\}}|dk�r�qRd|krR|d}nqR||k�r�||j|	�qR|	g||<qRW|S)a�Parse multipart input.

    Arguments:
    fp   : input file
    pdict: dictionary containing other parameters of content-type header

    Returns a dictionary just like parse_qs(): keys are the field names, each
    value is a list of values for that field.  This is easy to use but not
    much good if you are expecting megabytes to be uploaded -- in that case,
    use the FieldStorage class instead which is much more flexible.  Note
    that content-type is the raw, unparsed contents of the content-type
    header.

    XXX This does not parse nested multipart parts -- use FieldStorage for
    that.

    XXX This should really be subsumed by FieldStorage altogether -- no
    point in having two implementations of the same parsing algorithm.
    Also, FieldStorage protects itself better against certain DoS attacks
    by limiting the size of the data read in one chunk.  The API here
    does not support that kind of protection.  This also affects parse()
    since it can call parse_multipart().

    rN��boundaryz&Invalid boundary in multipart form: %rs--r3zcontent-lengthzMaximum content length exceededrHs
�
zcontent-dispositionz	form-data�name���rN���rOrNrNrN)Zhttp.client�valid_boundaryr;ZclientZ
parse_headers�getr9r:r<�readline�
startswith�rstrip�append�joinr)r@rEZhttprKZnextpartZlastpartZpartdict�
terminator�bytes�data�headersrF�lines�line�keyZparamsrMr"r"r#r�s|







ccs�x�|dd�dkr�|dd�}|jd�}x<|dkrd|jdd|�|jdd|�drd|jd|d�}q*W|dkrvt|�}|d|�}|j�V||d�}qWdS)Nr3�;r�"z\"rH)�find�count�len�strip)�s�end�fr"r"r#�_parseparam/s
*
rgcCs�td|�}|j�}i}x�|D]�}|jd�}|dkr|d|�j�j�}||dd�j�}t|�dkr�|d|dko�dknr�|dd�}|jdd	�jd
d�}|||<qW||fS)
zfParse a Content-type like header.

    Return the main content-type and a dictionary of options.

    r^�=rNr3rHr_z\\�\z\"rNrN)rg�__next__r`rc�lowerrb�replace)r\�partsr]rE�p�irM�valuer"r"r#r;s

,c@s@eZdZdZdZdZdZdZiZdZ	iZ
iZdd�Zdd�Z
dS)r	z=Like FieldStorage, for use when no file uploads are possible.NcCs||_||_dS)z&Constructor from field name and value.N)rMrp)�selfrMrpr"r"r#�__init__aszMiniFieldStorage.__init__cCsd|j|jfS)z Return printable representation.zMiniFieldStorage(%r, %r))rMrp)rqr"r"r#�__repr__gszMiniFieldStorage.__repr__)�__name__�
__module__�__qualname__�__doc__�filename�list�type�file�type_options�disposition�disposition_optionsrZrrrsr"r"r"r#r	Ssc@s�eZdZdZdddejdddddddfdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
d;dd�Zd<dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZdZd'd(�Zd)d*�Zd=Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Z dS)>r
a�Store a sequence of fields, reading multipart/form-data.

    This class provides naming, typing, files stored on disk, and
    more.  At the top level, it is accessible like a dictionary, whose
    keys are the field names.  (Note: None can occur as a field name.)
    The items are either a Python list (if there's multiple values) or
    another FieldStorage or MiniFieldStorage object.  If it's a single
    object, it has the following attributes:

    name: the field name, if specified; otherwise None

    filename: the filename, if specified; otherwise None; this is the
        client side filename, *not* the file name on which it is
        stored (that's a temporary file you don't deal with)

    value: the value as a *string*; for file uploads, this
        transparently reads the file every time you request the value
        and returns *bytes*

    file: the file(-like) object from which you can read the data *as
        bytes* ; None if the data is stored a simple string

    type: the content-type, or None if not specified

    type_options: dictionary of options specified on the content-type
        line

    disposition: content-disposition, or None if not specified

    disposition_options: dictionary of corresponding options

    headers: a dictionary(-like) object (sometimes email.message.Message or a
        subclass thereof) containing *all* headers

    The class is subclassable, mostly for the purpose of overriding
    the make_file() method, which is called internally to come up with
    a file open for reading and writing.  This makes it possible to
    override the default choice of storing all files in a temporary
    directory and unlinking them as soon as they have been opened.

    NrJrzutf-8rlcCsRd}||_||_|
|_||_d|kr0|dj�}d|_|dksF|dkr�d|krX|d}
ntjdd�rrtjd}
nd}
|
jt	j
�d�}
t|
�}|dkr�d	d
i}|dkr�i}|dkr�d
|d	<d|kr�|d|d	<d|kr�|d|_d
|kr�|d
|d<nt|t
tf��std��||_|dk�r*tjj|_n<t|t��r@|j|_n&t|d��oTt|d��s`td��||_||_|	|_t|t��s�tdt|�j��||_d|_||_di}}d|jk�r�t|jd�\}}||_||_ d|_!d|k�r�|d|_!d|_"d|k�r
|d|_"|j"dk	|_#d	|jk�r6t|jd	�\}}n(|j�sH|dk�rTdi}}n
d
i}}||_||_$d|k�r�|dj|j�|_%nd|_%d}d|jk�r�yt&|jd�}Wnt'k
�r�YnXt(�r�|t(k�r�t'd��||_)|jdk�r�|�r�||_d|_*|_+d|_,|d
k�r$|j-�n*|dd�dk�rF|j.|||�n|j/�dS)a$Constructor.  Read multipart/* until last part.

        Arguments, all optional:

        fp              : file pointer; default: sys.stdin.buffer
            (not used when the request method is GET)
            Can be :
            1. a TextIOWrapper object
            2. an object whose read() and readline() methods return bytes

        headers         : header dictionary-like object; default:
            taken from environ as per CGI spec

        outerboundary   : terminating multipart boundary
            (for internal use only)

        environ         : environment dictionary; default: os.environ

        keep_blank_values: flag indicating whether blank values in
            percent-encoded forms should be treated as blank strings.
            A true value indicates that blanks should be retained as
            blank strings.  The default false value indicates that
            blank values are to be ignored and treated as if they were
            not included.

        strict_parsing: flag indicating what to do with parsing errors.
            If false (the default), errors are silently ignored.
            If true, errors raise a ValueError exception.

        limit : used internally to read parts of multipart/form-data forms,
            to exit from the reading loop when reached. It is the difference
            between the form content-length and the number of bytes already
            read

        encoding, errors : the encoding and error handler used to decode the
            binary stream to strings. Must be the same as the charset defined
            for the page sending the form (content-type : meta http-equiv or
            header)

        max_num_fields: int. If set, then __init__ throws a ValueError
            if there are more than n fields read by parse_qsl().

        r,r+NZHEADr1r3r�surrogateescapezcontent-typez!application/x-www-form-urlencodedr-r.r0zcontent-lengthz?headers must be mapping or an instance of email.message.Messager<rRzfp must be file pointerz#outerboundary must be bytes, not %srzcontent-dispositionrMrxz
text/plainrKrJzMaximum content length exceeded�
z
multipart/rN)0rBrC�max_num_fieldsr/�upper�
qs_on_postr4r>�encode�locale�getpreferredencodingrr7rr�	TypeErrorrZr5r8r@rr6r*�errorsrXrzrt�
outerboundary�
bytes_read�limitrr}r~rMrx�_binary_filer|�
innerboundaryr9r;r:�lengthryr{�done�read_urlencoded�
read_multi�read_single)rqr@rZr�rArBrCr�r*r�r�r/�methodrGZcdisprErDZclenr"r"r#rr�s�/












zFieldStorage.__init__cCs(y|jj�Wntk
r"YnXdS)N)r{r(�AttributeError)rqr"r"r#�__del__;szFieldStorage.__del__cCs|S)Nr")rqr"r"r#�	__enter__AszFieldStorage.__enter__cGs|jj�dS)N)r{r()rqr'r"r"r#�__exit__DszFieldStorage.__exit__cCsd|j|j|jfS)z"Return a printable representation.zFieldStorage(%r, %r, %r))rMrxrp)rqr"r"r#rsGszFieldStorage.__repr__cCst|j��S)N)�iter�keys)rqr"r"r#�__iter__LszFieldStorage.__iter__cCsT|dkrt|��|jr:|jjd�|jj�}|jjd�n|jdk	rL|j}nd}|S)Nrpr)r�r{�seekr<ry)rqrMrpr"r"r#�__getattr__Os

zFieldStorage.__getattr__cCsb|jdkrtd��g}x"|jD]}|j|kr|j|�qW|sFt|��t|�dkrZ|dS|SdS)zDictionary style indexing.Nz
not indexabler3r)ryr�rMrU�KeyErrorrb)rqr]�found�itemr"r"r#�__getitem__\s

zFieldStorage.__getitem__cCs8||kr0||}t|t�r(dd�|D�S|jSn|SdS)z8Dictionary style get() method, including 'value' lookup.cSsg|]
}|j�qSr")rp)�.0�xr"r"r#�
<listcomp>osz)FieldStorage.getvalue.<locals>.<listcomp>N)r7ryrp)rqr]�defaultrpr"r"r#�getvaluejs
zFieldStorage.getvaluecCs4||kr,||}t|t�r$|djS|jSn|SdS)z! Return the first value received.rN)r7ryrp)rqr]r�rpr"r"r#�getfirstus

zFieldStorage.getfirstcCs:||kr2||}t|t�r(dd�|D�S|jgSngSdS)z  Return list of received values.cSsg|]
}|j�qSr")rp)r�r�r"r"r#r��sz(FieldStorage.getlist.<locals>.<listcomp>N)r7ryrp)rqr]rpr"r"r#�getlist�s

zFieldStorage.getlistcCs*|jdkrtd��ttdd�|jD���S)zDictionary style keys() method.Nz
not indexablecss|]}|jVqdS)N)rM)r�r�r"r"r#�	<genexpr>�sz$FieldStorage.keys.<locals>.<genexpr>)ryr��set)rqr"r"r#r��s
zFieldStorage.keyscs*|jdkrtd��t�fdd�|jD��S)z%Dictionary style __contains__ method.Nz
not indexablec3s|]}|j�kVqdS)N)rM)r�r�)r]r"r#r��sz,FieldStorage.__contains__.<locals>.<genexpr>)ryr��any)rqr]r")r]r#�__contains__�s
zFieldStorage.__contains__cCst|j��S)z Dictionary style len(x) support.)rbr�)rqr"r"r#�__len__�szFieldStorage.__len__cCs|jdkrtd��t|j�S)NzCannot be converted to bool.)ryr��bool)rqr"r"r#�__bool__�s
zFieldStorage.__bool__c	Cs�|jj|j�}t|t�s0td|jt|�jf��|j|j	|j
�}|jrT|d|j7}tj
j||j|j|j	|j
|j|jd�}dd�|D�|_|j�dS)z+Internal: read data in query string format.z%s should return bytes, got %sr2)r*r�r�r/cSsg|]\}}t||��qSr")r	)r�r]rpr"r"r#r��sz0FieldStorage.read_urlencoded.<locals>.<listcomp>N)r@r<r�r7rXr;rzrtr=r*r�r�r?rr
rBrCr�r/ry�
skip_lines)rqrG�queryr"r"r#r��s

zFieldStorage.read_urlencodedc
CsB|j}t|�std|f��g|_|jrftjj|j|j|j	|j
|j|j|j
d�}|jjdd�|D��|jpp|j}|jj�}t|t�s�td|jt|�jf��|jt|�7_x6|j�d|jkr�|r�|jj�}|jt|�7_q�W|j}|dk	�r|t|j�8}�x,t�}	d}
x$|jj�}|
|7}
|j��sP�qW|
�sBP|jt|
�7_|	j|
j|j
|j��|	j�}d	|k�r�|d	=||j||||||j|j|j
|j||j
d
�}
|dk	�r�|d8}|
j�r�|t|
j�8}|dk�r�td
��|j|
j7_|jj|
�|
j �s.|j|j!k�o&dkn�r
P�q
W|j"�dS)z/Internal: read a part that is itself multipart.z&Invalid boundary in multipart form: %r)r*r�r�r/css|]\}}t||�VqdS)N)r	)r�r]rpr"r"r#r��sz*FieldStorage.read_multi.<locals>.<genexpr>z%s should return bytes, got %ss--NrJzcontent-length)r/r3rzMax number of fields exceeded)#r�rPr;ryr�r?rr
rBrCr*r�r�r/�extend�FieldStorageClass�	__class__r@rRr7rXrzrtr�rbrcrZfeedr=r(r�rUr�r�r�)rqrArBrCZibr��klassZ
first_liner��parserZhdr_textrYrZ�partr"r"r#r��sj










(zFieldStorage.read_multicCs4|jdkr|j�|j�n|j�|jjd�dS)zInternal: read an atomic part.rN)r��read_binaryr��
read_linesr{r�)rqr"r"r#r��s


zFieldStorage.read_single�icCs�|j�|_|j}|dkr�xx|dkr�|jjt||j��}t|t�sXt	d|jt
|�jf��|jt
|�7_|svd|_P|jj|�|t
|�}qWdS)zInternal: read binary data.rz%s should return bytes, got %sr3NrN)�	make_filer{r�r@r<�min�bufsizer7rXr;rzrtr�rbr�r&)rqZtodorYr"r"r#r�s


zFieldStorage.read_binarycCs@|jrt�|_|_nt�|_|_|jr4|j�n|j�dS)z0Internal: read lines until EOF or outerboundary.N)r�rr{�_FieldStorage__filerr��read_lines_to_outerboundary�read_lines_to_eof)rqr"r"r#r�s
zFieldStorage.read_linescCsv|jdk	rF|jj�t|�dkrF|j�|_|jj�}|jj|�d|_|jrZ|jj|�n|jj|j|j	|j
��dS)z line is always bytes, not stringNi�)r��tellrbr�r{r�r&r�r=r*r�)rqr\rYr"r"r#Z__writes


zFieldStorage.__writecCs>x8|jjd�}|jt|�7_|s,d|_P|j|�qWdS)zInternal: read lines until EOF.r3�NirN)r@rRr�rbr��_FieldStorage__write)rqr\r"r"r#r�,szFieldStorage.read_lines_to_eofc	Cs,d|j}|d}d}d}d}�x||jkr.P|jjd
�}|jt|�7_|t|�7}|sdd|_P|dkrx||}d}|jd�r�|r�|j�}||kr�P||kr�d|_P|}|j	d�r�d}|d	d�}d}nJ|j	d�r�d}|d	d�}d}n*|j	d��rd}|d	d�}d}nd}d}|j
||�q"Wd	S)z�Internal: read lines until outerboundary.
        Data is read as bytes: boundaries and line ends must be converted
        to bytes for comparisons.
        s--rJTrr3r��
s
NrHrLFirNrOrNrN)r�r�r@rRr�rbr�rSrT�endswithr�)	rq�
next_boundary�
last_boundaryZdelim�last_line_lfendZ_readr\�strippedlineZodelimr"r"r#r�6sP



z(FieldStorage.read_lines_to_outerboundarycCs�|js|jrdSd|j}|d}d}xh|jjd�}|jt|�7_|sTd|_P|jd�r�|r�|j�}||krtP||kr�d|_P|jd�}q*WdS)	z5Internal: skip lines until outer boundary if defined.Ns--Tr3r�rLirN)r�r�r@rRr�rbr�rc)rqr�r�r�r\r�r"r"r#r�gs&
zFieldStorage.skip_linescCs&|jrtjd�Stjd|jdd�SdS)a�Overridable: return a readable & writable file.

        The file will be used as follows:
        - data is written to it
        - seek(0)
        - data is read from it

        The file is opened in binary mode for files, in text mode
        for other fields

        This version opens a temporary file for reading and writing,
        and immediately deletes (unlinks) it.  The trick (on Unix!) is
        that the file can still be used, but it can't be opened by
        another process, and it will automatically be deleted when it
        is closed or when the current process terminates.

        If you want a more permanent file, you derive a class which
        overrides this method.  If you want a visible temporary file
        that is nevertheless automatically deleted when the script
        terminates, try defining a __del__ method in a derived class
        which unlinks the temporary files you have created.

        zwb+zw+r%)r*�newlineN)r��tempfileZ
TemporaryFiler*)rqr"r"r#r�}s
zFieldStorage.make_file)N)Ni )!rtrurvrw�osrArrr�r�r�rsr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r"r"r"r#r
ls@*"


D	
1cCs�td�t�tjt_yNt�}t�t�t|�t|�t	�dd�}|fdd�}td�|�Wnt
�YnXtd�day&t�}t�t�t|�t|�Wnt
�YnXd	S)
z�Robust test CGI script, usable as main program.

    Write minimal HTTP headers and dump all information provided to
    the script in HTML form.

    zContent-type: text/htmlcSstd�dS)Nz,testing print_exception() -- <I>italics?</I>)�execr"r"r"r#rf�sztest.<locals>.fcSs
|�dS)Nr")rfr"r"r#�g�sztest.<locals>.gz9<H3>What follows is a test, not an actual exception:</H3>z*<H1>Second try with a small maxlen...</H1>�2N)�printr4�stdout�stderrr
rrrrrrr:)rA�formrfr�r"r"r#r�s4
cCsx|dkrtj�\}}}ddl}t�td�|j||�|j||�}tdtjdj|dd���tj|d�f�~dS)Nrz+<H3>Traceback (most recent call last):</H3>z<PRE>%s<B>%s</B></PRE>rr3rNrN)	r4�exc_info�	tracebackr��	format_tb�format_exception_only�htmlrrV)rzrp�tbr�r�ryr"r"r#r�s
cCs`t|j��}t�td�td�x*|D]"}tdtj|�dtj||��q(Wtd�t�dS)z#Dump the shell environment as HTML.z<H3>Shell Environment:</H3>z<DL>z<DT>z<DD>z</DL>N)�sortedr�r�r�r)rAr�r]r"r"r#r�s
"cCs�t|j��}t�td�|s&td�td�xb|D]Z}tdtj|�ddd�||}tdtjtt|���d	�td
tjt|���q4Wtd�t�dS)
z$Dump the contents of a form as HTML.z<H3>Form Contents:</H3>z<P>No form fields.z<DL>z<DT>�:� )rez<i>z</i>z<DD>z</DL>N)r�r�r�r�r�reprrz)r�r�r]rpr"r"r#r�s
cCsjt�td�ytj�}Wn6tk
rP}ztdtjt|���WYdd}~XnXttj|��t�dS)z#Dump the current directory as HTML.z#<H3>Current Working Directory:</H3>zOSError:N)r�r��getcwdrr�r�str)�pwd�msgr"r"r#r�s&cCs(t�td�t�ttj�t�dS)Nz <H3>Command Line Arguments:</H3>)r�r4r>r"r"r"r#r�s

cCstd�dS)z9Dump a list of environment variables used by CGI as HTML.a�
<H3>These environment variables could have been set:</H3>
<UL>
<LI>AUTH_TYPE
<LI>CONTENT_LENGTH
<LI>CONTENT_TYPE
<LI>DATE_GMT
<LI>DATE_LOCAL
<LI>DOCUMENT_NAME
<LI>DOCUMENT_ROOT
<LI>DOCUMENT_URI
<LI>GATEWAY_INTERFACE
<LI>LAST_MODIFIED
<LI>PATH
<LI>PATH_INFO
<LI>PATH_TRANSLATED
<LI>QUERY_STRING
<LI>REMOTE_ADDR
<LI>REMOTE_HOST
<LI>REMOTE_IDENT
<LI>REMOTE_USER
<LI>REQUEST_METHOD
<LI>SCRIPT_NAME
<LI>SERVER_NAME
<LI>SERVER_PORT
<LI>SERVER_PROTOCOL
<LI>SERVER_ROOT
<LI>SERVER_SOFTWARE
</UL>
In addition, HTTP headers sent by the server may be passed in the
environment as well.  Here are some common variable names:
<UL>
<LI>HTTP_ACCEPT
<LI>HTTP_CONNECTION
<LI>HTTP_HOST
<LI>HTTP_PRAGMA
<LI>HTTP_REFERER
<LI>HTTP_USER_AGENT
</UL>
N)r�r"r"r"r#rs'cCsFtdtdd�|jdd�}|jdd�}|jdd	�}|rB|jd
d�}|S)zDeprecated API.z1cgi.escape is deprecated, use html.escape insteadrH)�
stacklevelr2z&amp;�<z&lt;�>z&gt;r_z&quot;)rrIrl)rdZquoter"r"r#r1s
cCs(ddl}t|t�rd}nd}|j||�S)Nrs^[ -~]{0,200}[!-~]$z^[ -~]{0,200}[!-~]$)�rer7rX�match)rdr�Z_vb_patternr"r"r#rP=s

rP�__main__)rrN)rrN)NNNN)N)1rw�__version__�iorrr�collectionsrr4r�Zurllib.parser?Zemail.parserrZ
email.messager�warningsrr�r�r��__all__rrr$r rr)rr:rArrr
rrgrr	r
rrrrrrrrrPrtr"r"r"r#�<module>sb#	E

c7'
/

getpass.cpython-36.pyc000064400000010123150335715140010641 0ustar003


 \j�@s�dZddlZddlZddlZddlZddlZdddgZGdd�de�Zddd	�Z	dd
d�Z
ddd
�Zddd�Zdd�Z
yddlZejejfWnBeefk
r�yddlZWnek
r�eZYnXe
ZYnXe	ZdS)a�Utilities to get a password and/or the current user name.

getpass(prompt[, stream]) - Prompt for a password, with echo turned off.
getuser() - Get the user name from the environment or password database.

GetPassWarning - This UserWarning is issued when getpass() cannot prevent
                 echoing of the password contents while reading.

On Windows, the msvcrt module will be used.

�N�getpass�getuser�GetPassWarningc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/getpass.pyrs�
Password: c.Cs�d}tj����}yJtjdtjtjB�}tj|d�}|j|�tj	|�}|j|�|sX|}Wnpt
k
r�}zT|j�ytj
j�}Wn&ttfk
r�d}t||�}YnXtj
}|s�tj}WYdd}~XnX|dk	�r�y�tj|�}|dd�}	|	dtjM<tj}
ttd��r|
tjO}
z tj||
|	�t|||d�}Wdtj||
|�|j�XWn@tjk
�r�|dk	�rz�||k	�r�|j�t||�}YnX|jd�|SQRXdS)aPrompt for a password, with echo turned off.

    Args:
      prompt: Written on stream to ask for the input.  Default: 'Password: '
      stream: A writable file object to display the prompt.  Defaults to
              the tty.  If no tty is available defaults to sys.stderr.
    Returns:
      The seKr3t input.
    Raises:
      EOFError: If our input tty or stdin was closed.
      GetPassWarning: When we were unable to turn echo off on the input.

    Always restores terminal settings before returning.
    Nz/dev/ttyzw+��TCSASOFT)�input�
)�
contextlib�	ExitStack�os�open�O_RDWR�O_NOCTTY�io�FileIO�
enter_context�
TextIOWrapper�OSError�close�sys�stdin�fileno�AttributeError�
ValueError�fallback_getpass�stderr�termios�	tcgetattrZECHOZ	TCSAFLUSH�hasattrr�	tcsetattr�
_raw_input�flush�error�write)�prompt�streamZpasswd�stack�fdZttyr
�e�old�newZtcsetattr_flagsrrr	�unix_getpasssR








r1cCs�tjtjk	rt||�Sx|D]}tj|�qWd}xHtj�}|dksL|dkrNP|dkrZt�|dkrp|dd�}q4||}q4Wtjd�tjd�|S)	z9Prompt for password with echo off, using Windows getch().��
r��N����)rr�	__stdin__r �msvcrtZputwchZgetwch�KeyboardInterrupt)r*r+�cZpwrrr	�win_getpassas"



r<cCs0tjdtdd�|stj}td|d�t||�S)Nz%Can not control echo on the terminal.�)�
stacklevelz&Warning: Password input may be echoed.)�file)�warnings�warnrrr!�printr&)r*r+rrr	r xsr r2cCs�|s
tj}|stj}t|�}|rpy|j|�Wn8tk
rf|j|jd�}|j|j�}|j|�YnX|j	�|j
�}|s�t�|ddkr�|dd�}|S)N�replacer6rr7r7)rr!r�strr)�UnicodeEncodeError�encode�encoding�decoder'�readline�EOFError)r*r+r
�linerrr	r&�s&r&cCs<x dD]}tjj|�}|r|SqWddl}|jtj��dS)z�Get the username from the environment or password database.

    First try various environment variables, then the password
    database.  This works on Windows as long as USERNAME is set.

    �LOGNAME�USER�LNAME�USERNAMErN)rLrMrNrO)r�environ�get�pwd�getpwuid�getuid)�name�userrRrrr	r�s
)r
N)r
N)r
N)r2NN)�__doc__rrrrr@�__all__�UserWarningrr1r<r r&rr"r#r%�ImportErrorrr9rrrrr	�<module>s,

D

	


smtpd.cpython-36.opt-2.pyc000064400000057002150335715140011271 0ustar003


 \���@sZddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZm
Z
dddddgZejdZd	ZGd
d�d�Ze�adZd
ZdZd$dd�ZGdd�dej�ZGdd�dej�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�d�Zdd�Z e!dk�rVe �Z"e"j#Z#de#k�rle#j$d�Z%e&e#de%�e'�e(�dg�Z)e#e%dd�Z#nddl*Z)e+e)e#�Z,e,e"j-e"j.fe"j/e"j0fe"j1e"j2d�Z3e"j4�r2yddl5Z5Wn.e6k
�r�e7dej8d �ej9d�YnXe5j:d!�d"Z;yej4e;�Wn.e<k
�r0e7d#ej8d �ej9d�YnXyej=�Wne>k
�rTYnXdS)%�N)�warn)�
get_addr_spec�get_angle_addr�SMTPChannel�
SMTPServer�DebuggingServer�	PureProxy�MailmanProxyzPython SMTP proxy version 0.3c@seZdZdd�Zdd�ZdS)�DevnullcCsdS)N�)�self�msgrr�/usr/lib64/python3.6/smtpd.py�writefsz
Devnull.writecCsdS)Nr)rrrr�flushgsz
Devnull.flushN)�__name__�
__module__�__qualname__rrrrrrr
esr
�
z, i�cCs4ttt�tjd�|r&t|tjd�tj|�dS)N)�file)�print�__doc__�globals�sys�stderr�exit)�coder
rrr�usagepsrc@s�eZdZdZdZdZejefdd��Ze	dd��Z
edd	d	fd
d�Zdd
�Z
dd�Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd ��Zejd!d ��Ze	d"d#��Zejd$d#��Ze	d%d&��Zejd'd&��Ze	d(d)��Zejd*d)��Ze	d+d,��Zejd-d,��Ze	d.d/��Zejd0d/��Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dS)Srr�icCs|S)Nr)�xrrr�<lambda>|szSMTPChannel.<lambda>cCs*yt|jj��Stk
r$|jSXdS)N)�max�command_size_limits�values�
ValueError�command_size_limit)rrrr�max_command_size_limit~sz"SMTPChannel.max_command_size_limitNFc	Cstjj|||d�||_||_||_||_||_||_|rF|rFt	d��|rdd|_
d|_d|_t
|_nd|_
d|_td�|_d	|_|j�d|_d
|_|jj�tj�|_y|j�|_Wn:tk
r�}z|j�|jdtjkr�dSd}~XnXtdt |j�t!d
�|j"d|jt#f�dS)N)�mapzFdecode_data and enable_SMTPUTF8 cannot be set to True at the same timerz
�.�s
�.�
FrzPeer:)rz	220 %s %s)$�asynchat�
async_chat�__init__�smtp_server�conn�addr�data_size_limit�enable_SMTPUTF8�_decode_datar%�_emptystring�_linesep�_dotsep�NEWLINE�_newline�ord�_set_rset_state�
seen_greeting�
extended_smtpr#�clear�socketZgetfqdn�fqdnZgetpeername�peer�OSError�close�args�errnoZENOTCONNr�repr�DEBUGSTREAM�push�__version__)	rZserverr1r2r3r(r4�decode_data�errrrrr/�s@


zSMTPChannel.__init__cCs.|j|_d|_g|_d|_d|_|jd�dS)NFrs
)�COMMAND�
smtp_state�mailfrom�rcpttos�require_SMTPUTF8�	num_bytes�set_terminator)rrrr�_set_post_data_state�sz SMTPChannel._set_post_data_statecCs|j�d|_g|_dS)Nr)rT�
received_data�received_lines)rrrrr<�szSMTPChannel._set_rset_statecCstdtd�|jS)NzTAccess to __server attribute on SMTPChannel is deprecated, use 'smtp_server' instead�)r�DeprecationWarningr0)rrrr�__server�szSMTPChannel.__servercCstdtd�||_dS)NzRSetting __server attribute on SMTPChannel is deprecated, set 'smtp_server' insteadrW)rrXr0)r�valuerrrrY�scCstdtd�|jS)NzUAccess to __line attribute on SMTPChannel is deprecated, use 'received_lines' insteadrW)rrXrV)rrrr�__line�szSMTPChannel.__linecCstdtd�||_dS)NzSSetting __line attribute on SMTPChannel is deprecated, set 'received_lines' insteadrW)rrXrV)rrZrrrr[�scCstdtd�|jS)NzRAccess to __state attribute on SMTPChannel is deprecated, use 'smtp_state' insteadrW)rrXrN)rrrr�__state�szSMTPChannel.__statecCstdtd�||_dS)NzPSetting __state attribute on SMTPChannel is deprecated, set 'smtp_state' insteadrW)rrXrN)rrZrrrr\�scCstdtd�|jS)NzXAccess to __greeting attribute on SMTPChannel is deprecated, use 'seen_greeting' insteadrW)rrXr=)rrrr�
__greeting�szSMTPChannel.__greetingcCstdtd�||_dS)NzVSetting __greeting attribute on SMTPChannel is deprecated, set 'seen_greeting' insteadrW)rrXr=)rrZrrrr]�scCstdtd�|jS)NzSAccess to __mailfrom attribute on SMTPChannel is deprecated, use 'mailfrom' insteadrW)rrXrO)rrrr�
__mailfrom�szSMTPChannel.__mailfromcCstdtd�||_dS)NzQSetting __mailfrom attribute on SMTPChannel is deprecated, set 'mailfrom' insteadrW)rrXrO)rrZrrrr^�scCstdtd�|jS)NzQAccess to __rcpttos attribute on SMTPChannel is deprecated, use 'rcpttos' insteadrW)rrXrP)rrrr�	__rcpttos�szSMTPChannel.__rcpttoscCstdtd�||_dS)NzOSetting __rcpttos attribute on SMTPChannel is deprecated, set 'rcpttos' insteadrW)rrXrP)rrZrrrr_�scCstdtd�|jS)NzTAccess to __data attribute on SMTPChannel is deprecated, use 'received_data' insteadrW)rrXrU)rrrr�__data�szSMTPChannel.__datacCstdtd�||_dS)NzRSetting __data attribute on SMTPChannel is deprecated, set 'received_data' insteadrW)rrXrU)rrZrrrr`scCstdtd�|jS)NzKAccess to __fqdn attribute on SMTPChannel is deprecated, use 'fqdn' insteadrW)rrXrA)rrrr�__fqdn
szSMTPChannel.__fqdncCstdtd�||_dS)NzISetting __fqdn attribute on SMTPChannel is deprecated, set 'fqdn' insteadrW)rrXrA)rrZrrrrascCstdtd�|jS)NzKAccess to __peer attribute on SMTPChannel is deprecated, use 'peer' insteadrW)rrXrB)rrrr�__peerszSMTPChannel.__peercCstdtd�||_dS)NzISetting __peer attribute on SMTPChannel is deprecated, set 'peer' insteadrW)rrXrB)rrZrrrrbscCstdtd�|jS)NzKAccess to __conn attribute on SMTPChannel is deprecated, use 'conn' insteadrW)rrXr1)rrrr�__conn szSMTPChannel.__conncCstdtd�||_dS)NzISetting __conn attribute on SMTPChannel is deprecated, set 'conn' insteadrW)rrXr1)rrZrrrrc%scCstdtd�|jS)NzKAccess to __addr attribute on SMTPChannel is deprecated, use 'addr' insteadrW)rrXr2)rrrr�__addr+szSMTPChannel.__addrcCstdtd�||_dS)NzISetting __addr attribute on SMTPChannel is deprecated, set 'addr' insteadrW)rrXr2)rrZrrrrd0scCs&tjj|t|d|jrdnd��dS)Nz
zutf-8�ascii)r-r.rI�bytesrQ)rr
rrrrI7s
zSMTPChannel.pushcCs|d}|j|jkr|j}n|j|jkr*|j}|r<|j|kr<dS|rR|jt|�7_|jrl|jj	t
|d��n|jj	|�dS)Nzutf-8)rNrMr'�DATAr3rR�lenr5rV�append�str)r�data�limitrrr�collect_incoming_data<sz!SMTPChannel.collect_incoming_datac
Cs|jj|j�}tdt|�td�g|_|j|jk�r|jd}|_|sT|j	d�dS|j
sdt|d�}|jd�}|dkr�|j
�}d}n$|d|�j
�}||dd�j�}|jr�|j|n|j}||kr�|j	d�dSt|d	|d�}|�s�|j	d
|�dS||�dS|j|jk�r*|j	d�d|_dS|j�rT|j|jk�rT|j	d�d|_dSg}xJ|j|j�D]:}	|	�r�|	d|jk�r�|j|	dd��n
|j|	��qfW|jj|�|_|j|j|j|jf}
i}|j
�s�|j|jd
�}|j j!|
|�}|j"�|�s|j	d�n
|j	|�dS)NzData:)rrz500 Error: bad syntaxzutf-8� rz500 Error: line too longZsmtp_z&500 Error: command "%s" not recognizedz451 Internal confusionz552 Error: Too much mail data)�mail_options�rcpt_optionsz250 OK)#r6�joinrVrrGrHrNrMrRrIr5rj�find�upper�stripr>r#r&�getattrrgr3�splitr7r8rir:rUrBrOrProrpr0�process_messagerT)
r�lineZsz�i�command�argZmax_sz�methodrk�textrE�kwargsZstatusrrr�found_terminatorLsd






zSMTPChannel.found_terminatorcCsH|s|jd�dS|jr&|jd�dS|j�||_|jd|j�dS)Nz501 Syntax: HELO hostnamez503 Duplicate HELO/EHLOz250 %s)rIr=r<rA)rr{rrr�	smtp_HELO�s

zSMTPChannel.smtp_HELOcCs�|s|jd�dS|jr&|jd�dS|j�||_d|_|jd|j�|jrr|jd|j�|jdd7<|js�|jd�|jr�|jd	�|jdd
7<|jd�dS)Nz501 Syntax: EHLO hostnamez503 Duplicate HELO/EHLOTz250-%sz250-SIZE %s�MAIL�z250-8BITMIMEz250-SMTPUTF8�
z250 HELP)	rIr=r<r>rAr3r#r5r4)rr{rrr�	smtp_EHLO�s&



zSMTPChannel.smtp_EHLOcCs|r|jd�n
|jd�dS)Nz501 Syntax: NOOPz250 OK)rI)rr{rrr�	smtp_NOOP�szSMTPChannel.smtp_NOOPcCs|jd�|j�dS)Nz221 Bye)rIZclose_when_done)rr{rrr�	smtp_QUIT�s
zSMTPChannel.smtp_QUITcCs0t|�}|d|�j�|kr,||d�j�SdS)Nr)rhrsrt)r�keywordr{Zkeylenrrr�_strip_command_keyword�sz"SMTPChannel._strip_command_keywordcCsF|sdS|j�jd�r$t|�\}}nt|�\}}|s<||fS|j|fS)Nr�<)rr)�lstrip�
startswithrrZ	addr_spec)rr{�address�restrrr�_getaddr�szSMTPChannel._getaddrcCsNi}xD|D]<}|jd�\}}}|j�s2|r6|r6dS|r>|nd||<q
W|S)N�=T)�	partition�isalnum)r�params�resultZparam�eqrZrrr�
_getparams�s
zSMTPChannel._getparamscCs|r�d}|j�}|dkr$|jd�q�|dkr8|jd�q�|dkr^d}|jrR||7}|j|�q�|dkr�d	}|jrx||7}|j|�q�|d
kr�|jd�q�|dkr�|jd
�q�|dkr�|jd�q�|dkr�|jd�q�|dkr�|jd�q�|jd�n
|jd�dS)Nz [SP <mail-parameters>]ZEHLOz250 Syntax: EHLO hostnameZHELOz250 Syntax: HELO hostnamer�z 250 Syntax: MAIL FROM: <address>ZRCPTz250 Syntax: RCPT TO: <address>rgz250 Syntax: DATAZRSETz250 Syntax: RSETZNOOPz250 Syntax: NOOPZQUITz250 Syntax: QUITZVRFYz250 Syntax: VRFY <address>zD501 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFYzD250 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFY)rsrIr>)rr{ZextendedZlc_argr
rrr�	smtp_HELP�s:zSMTPChannel.smtp_HELPcCs@|r2|j|�\}}|r"|jd�q<|jd|�n
|jd�dS)NzB252 Cannot VRFY user, but will accept message and attempt deliveryz502 Could not VRFY %sz501 Syntax: VRFY <address>)r�rI)rr{r�r�rrr�	smtp_VRFY�szSMTPChannel.smtp_VRFYcCs�|js|jd�dStd|td�d}|jr4|d7}|dkrJ|j|�dS|jd|�}|j|�\}}|sv|j|�dS|jr�|r�|j|�dS|jr�|jd�dS|j�j	�|_
|j|j
�}|dkr�|j|�dS|j�s|j
dd	�}|dk�r|jd�dS|j�r>|j
dd
�}|dk�r&d|_n|d
k	�r>|jd�dS|j
dd�}|�r�|j��sh|j|�dS|j�r�t|�|jk�r�|jd�dSt|j��dk�r�|jd�dS||_td|jtd�|jd�dS)Nz503 Error: send HELO firstz	===> MAIL)rz 501 Syntax: MAIL FROM: <address>z [SP <mail-parameters>]zFROM:z503 Error: nested MAIL commandZBODY�7BIT�8BITMIMEz1501 Error: BODY can only be one of 7BIT, 8BITMIMEZSMTPUTF8FTz&501 Error: SMTPUTF8 takes no argumentsZSIZEz:552 Error: message size exceeds fixed maximum message sizerz:555 MAIL FROM parameters not recognized or not implementedzsender:z250 OK)r�r�)r=rIrrHr>r�r�rOrsrvror�r5�popr4rQ�isdigitr3�intrh�keys)rr{�	syntaxerrr�r�Zbody�smtputf8�sizerrr�	smtp_MAILsh














zSMTPChannel.smtp_MAILcCs|js|jd�dStd|td�|js6|jd�dSd}|jrH|d7}|dkr^|j|�dS|jd|�}|j|�\}}|s�|j|�dS|jr�|r�|j|�dS|j�j	�|_
|j|j
�}|dkr�|j|�dSt|j
��dkr�|jd	�dS|jj|�td
|jtd�|jd�dS)Nz503 Error: send HELO firstz	===> RCPT)rz503 Error: need MAIL commandz501 Syntax: RCPT TO: <address>z [SP <mail-parameters>]zTO:rz8555 RCPT TO parameters not recognized or not implementedzrecips:z250 OK)r=rIrrHrOr>r�r�rsrvrpr�rhr�rPri)rr{r�r�r�rrr�	smtp_RCPT7s@






zSMTPChannel.smtp_RCPTcCs(|r|jd�dS|j�|jd�dS)Nz501 Syntax: RSETz250 OK)rIr<)rr{rrr�	smtp_RSETZs

zSMTPChannel.smtp_RSETcCsZ|js|jd�dS|js(|jd�dS|r:|jd�dS|j|_|jd�|jd�dS)Nz503 Error: send HELO firstz503 Error: need RCPT commandz501 Syntax: DATAs
.
z#354 End data with <CR><LF>.<CR><LF>)r=rIrPrgrNrS)rr{rrr�	smtp_DATAas



zSMTPChannel.smtp_DATAcCs|jd�dS)Nz502 EXPN not implemented)rI)rr{rrr�	smtp_EXPNpszSMTPChannel.smtp_EXPN),rrrrMrgr&�collections�defaultdictr#�propertyr'�DATA_SIZE_DEFAULTr/rTr<Z_SMTPChannel__server�setterZ_SMTPChannel__lineZ_SMTPChannel__stateZ_SMTPChannel__greetingZ_SMTPChannel__mailfromZ_SMTPChannel__rcpttosZ_SMTPChannel__dataZ_SMTPChannel__fqdnZ_SMTPChannel__peerZ_SMTPChannel__connZ_SMTPChannel__addrrIrmrr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrws`&	>#6#c@s2eZdZeZedddfdd�Zdd�Zdd�ZdS)	rNFcCs�||_||_||_||_||_|r.|r.td��tjj||d�yNt	j
|dt	ji�}|j|dd|dd�|j
�|j|�|jd�Wn|j��Yn(Xtd|jjtjtj��||ftd�dS)	NzFdecode_data and enable_SMTPUTF8 cannot be set to True at the same time)r(�typerr�z0%s started at %s
	Local addr: %s
	Remote addr:%s)r)Z
_localaddr�_remoteaddrr3r4r5r%�asyncore�
dispatcherr/r@ZgetaddrinfoZSOCK_STREAMZ
create_socketZset_reuse_addrZbindZlistenrDr�	__class__r�time�ctimerH)rZ	localaddrZ
remoteaddrr3r(r4rKZgai_resultsrrrr/xs*

zSMTPServer.__init__cCs6tdt|�td�|j||||j|j|j|j�}dS)NzIncoming connection from %s)r)rrGrH�
channel_classr3Z_mapr4r5)rr1r2Zchannelrrr�handle_accepted�szSMTPServer.handle_acceptedcKst�dS)N)�NotImplementedError)rrBrOrPrkr~rrrrw�szSMTPServer.process_message)	rrrrr�r�r/r�rwrrrrrts
c@seZdZdd�Zdd�ZdS)rcCsrd}|j�}x`|D]X}|rP|rPd|d}t|t�sDt|jd��}t|�d}t|t�sbt|�}t|�qWdS)NrzX-Peer: rzutf-8)�
splitlines�
isinstancerjrG�encoder)rrBrkZ	inheaders�linesrxZ
peerheaderrrr�_print_message_content�s



z&DebuggingServer._print_message_contentcKsXtd�|r@|jd�r&td|d�|jd�r@td|d�|j||�td�dS)Nz%---------- MESSAGE FOLLOWS ----------rozmail options: %srpzrcpt options: %s
z%------------ END MESSAGE ------------)r�getr�)rrBrOrPrkr~rrrrw�s

zDebuggingServer.process_messageN)rrrr�rwrrrrr�scs,eZdZ�fdd�Zdd�Zdd�Z�ZS)rcs.d|kr|drtd��tt|�j||�dS)Nr4z$PureProxy does not support SMTPUTF8.)r%�superrr/)rrEr~)r�rrr/�szPureProxy.__init__c	Csh|jd�}d}x|D]}|sP|d7}qW|j|d|d�tj|�}|j|||�}td|td�dS)Nrrrz
X-Peer: %szwe got some refusals:)r)rv�insertr9rq�_deliverrrH)	rrBrOrPrkr�ryrx�refusedrrrrw�s


zPureProxy.process_messagecCs�ddl}i}yB|j�}|j|jd|jd�z|j|||�}Wd|j�XWn�|jk
r�}ztdtd�|j	}WYdd}~Xnjt
|jfk
r�}zHtd|jtd�t
|dd	�}t
|dd�}	x|D]}
||	f||
<q�WWYdd}~XnX|S)
Nrrzgot SMTPRecipientsRefused)rZgotZ	smtp_codeZ
smtp_error�ignore���)�smtplibZSMTPZconnectr�Zsendmail�quitZSMTPRecipientsRefusedrrHZ
recipientsrCZ
SMTPExceptionr�ru)rrOrPrkr�r��s�eZerrcode�errmsg�rrrrr��s$
"zPureProxy._deliver)rrrr/rwr��
__classcell__rr)r�rr�scs$eZdZ�fdd�Zdd�Z�ZS)r	cs.d|kr|drtd��tt|�j||�dS)Nr4z'MailmanProxy does not support SMTPUTF8.)r%r�rr/)rrEr~)r�rrr/
szMailmanProxy.__init__cCs:ddlm}ddlm}ddlm}ddlm}g}	x~|D]v}
|
j�jd�d}|jd�}t|�dkrhq:|d}
t|�dkr�|d	}nd
}|j	|
�s:|d!kr�q:|	j
|
|
|f�q:Wx|	D]\}
}
}|j|
�q�Wtddj
|�td�|�r|j|||�}td|td�i}||�}|j|�}|jd��s2||d<|jd��sPtjtj��|d<x�|	D]�\}
}
}td|
td�|j|
�}|�s�|j|
dd�}|||
<|d
k�r�|j|d	d�n�|dk�r�|j|d	d�nh|dk�r�|j|d	d�nN|d
k�r�|j|d	d�n4|d"k�rV|dk�rd|d<nd |d<|j|d	d��qVWdS)#Nr)�StringIO)�Utils)�Message)�MailList�@�-rWrr�admin�owner�requestrq�leavezforwarding recips:rn)rzwe got refusals:�fromZFromZdateZDatezsending message to)�lock)�tolist)Ztoadmin)Ztoowner)Z	torequestZ	subscribeZSubjectZunsubscribe)rr�r�r�rqr�)rqr�)�ior�ZMailmanr�r�r��lowerrvrhZlist_existsri�removerrqrHr�r�r�r�ZEnqueue)rrBrOrPrkr�r�r�r�Z	listnamesZrcptZlocal�partsZlistnamerzr�Zmlistsr�r
Zmlistrrrrwsd











zMailmanProxy.process_message)rrrr/rwr�rr)r�rr	sc@seZdZdZdZdZdZdS)�OptionsTrNF)rrr�setuid�	classname�
size_limitr4rrrrr�_sr�c
!Csty.tjtjdd�dddddddd	g�\}}Wn.tjk
r\}ztd|�WYdd}~XnXt�}x�|D]�\}}|d'kr�td�qj|d(kr�tt�tjd�qj|d)kr�d|_	qj|d*kr�||_
qj|d+kr�tjaqj|d,kr�d|_
qj|d-krjyt|�}||_Wqjtd|tjd�tjd�YqjXqjWt|�dk�r@d}d}nPt|�dk�r\|d}d}n4t|�d k�r||d}|d}ntdd!tj|��|jd"�}	|	dk�r�tdd#|�|d|	�|_yt||	dd��|_Wn$tk
�r�tdd$|�YnX|jd"�}	|	dk�r"tdd%|�|d|	�|_yt||	dd��|_Wn$tk
�rntdd&|�YnX|S).Nrz	nVhc:s:duzclass=Znosetuid�version�helpzsize=�debugr��-h�--helpr�-V�	--version�-n�
--nosetuidF�-c�--class�-d�--debug�-u�
--smtputf8T�-s�--sizezInvalid size: )rzlocalhost:8025zlocalhost:25rW�zInvalid arguments: %s�:zBad local spec: %szBad local port: %szBad remote spec: %szBad remote port: %s)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)�getoptr�argv�errorrr�rrJrr�r�rrHr4r�r�rh�
COMMASPACErqrr�	localhost�	localportr%�
remotehost�
remoteport)
ZoptsrEr��options�optr{Zint_sizeZ	localspecZ
remotespecryrrr�	parseargsfsp






r��__main__r)r)r4z7Cannot import module "pwd"; try running with -n option.)r�nobodyrWz3Cannot setuid "nobody"; try running with -n option.)r)?r�osrFr�r�r@r�r-r��warningsrZemail._header_value_parserrr�__all__r�ZprogramrJr
rHr9r�r�rr.rr�rrrr	r�r�rr�r��rfindZlastdot�
__import__r�locals�modr�ruZclass_r�r�r�r�r�r4�proxyr��pwd�ImportErrorrrr�getpwnamr��PermissionErrorZloop�KeyboardInterruptrrrr�<module>Psv

M-SB




_collections_abc.cpython-36.opt-2.pyc000064400000056137150335715140013434 0ustar003


 \g�@snddlmZmZddlZddddddd	d
ddd
ddddddddddddddgZdZeed��Zeee	���Z
eeij���Zeeij
���Zeeij���Zeeg��Zeeeg���Zeeed���Zeeedd>���Zeee���Zeed ��Zeef��Zeee���Zeij��Zeij
��Zeij��Zeej �Z!ed!d"���Z"d#d$�Z#e#�Z#ee#�Z$e#j%�[#d%d&�Z&e&�Z&ee&�Z'[&d'd(�Z(Gd)d�ded*�Z)Gd+d�ded*�Z*Gd,d�de*�Z+e+j,e$�Gd-d�ded*�Z-Gd.d�de-�Z.Gd/d�de.�Z/e/j,e'�Gd0d	�d	ed*�Z0Gd1d
�d
e0�Z1e1j,e�e1j,e
�e1j,e�e1j,e�e1j,e�e1j,e�e1j,e�e1j,e�e1j,e�e1j,e�e1j,e�e1j,e�e1j,e�Gd2d�de0�Z2Gd3d�de1�Z3e3j,e"�Gd4d
�d
ed*�Z4Gd5d�ded*�Z5Gd6d�de4e0e5�Z6Gd7d�ded*�Z7Gd8d�de6�Z8e8j,e9�Gd9d�de8�Z:e:j,e�Gd:d�de6�Z;e;j,e!�Gd;d�de4�Z<Gd<d�de<e8�Z=e=j,e�Gd=d�de<e8�Z>e>j,e�Gd>d�de<�Z?e?j,e�Gd?d�de;�Z@e@j,eA�Gd@d�de2e6�ZBeBj,eC�eBj,eD�eBj,e�eBj,eE�GdAd�deB�ZFeFj,eG�eFj,e	�GdBd�deB�ZHeHj,eI�eHj,e	�dS)C�)�ABCMeta�abstractmethodN�	Awaitable�	Coroutine�
AsyncIterable�
AsyncIterator�AsyncGenerator�Hashable�Iterable�Iterator�	Generator�
Reversible�Sized�	Container�Callable�
Collection�Set�
MutableSet�Mapping�MutableMapping�MappingView�KeysView�	ItemsView�
ValuesView�Sequence�MutableSequence�
ByteStringzcollections.abc��i��ccsdVS)N�r r r �(/usr/lib64/python3.6/_collections_abc.py�<lambda>8sr"c�sdS)Nr r r r r!�_coro:sr#cCs
dVdS)Nr r r r r!�_ag@sr$cGsH|j}x<|D]4}x.|D]"}||jkr|j|dkr6tSPqWtSqWdS)NT)�__mro__�__dict__�NotImplemented)�C�methods�mro�method�Br r r!�_check_methodsHs


r-c@s(eZdZfZedd��Zedd��ZdS)r	cCsdS)Nrr )�selfr r r!�__hash__XszHashable.__hash__cCs|tkrt|d�StS)Nr/)r	r-r')�clsr(r r r!�__subclasshook__\s
zHashable.__subclasshook__N)�__name__�
__module__�__qualname__�	__slots__rr/�classmethodr1r r r r!r	Ts)�	metaclassc@s(eZdZfZedd��Zedd��ZdS)rccs
dVdS)Nr )r.r r r!�	__await__gszAwaitable.__await__cCs|tkrt|d�StS)Nr8)rr-r')r0r(r r r!r1ks
zAwaitable.__subclasshook__N)r2r3r4r5rr8r6r1r r r r!rcsc@s>eZdZfZedd��Zed
dd��Zdd�Zedd	��Z	dS)rcCst�dS)N)�
StopIteration)r.�valuer r r!�sendvszCoroutine.sendNcCs4|dkr|dkr|�|�}|dk	r,|j|�}|�dS)N)�with_traceback)r.�typ�val�tbr r r!�throw}s
zCoroutine.throwcCs4y|jt�Wnttfk
r&Yn
Xtd��dS)Nzcoroutine ignored GeneratorExit)r@�
GeneratorExitr9�RuntimeError)r.r r r!�close�s
zCoroutine.closecCs|tkrt|dddd�StS)Nr8r;r@rC)rr-r')r0r(r r r!r1�szCoroutine.__subclasshook__)NN)
r2r3r4r5rr;r@rCr6r1r r r r!rrs
c@s(eZdZfZedd��Zedd��ZdS)rcCst�S)N)r)r.r r r!�	__aiter__�szAsyncIterable.__aiter__cCs|tkrt|d�StS)NrD)rr-r')r0r(r r r!r1�s
zAsyncIterable.__subclasshook__N)r2r3r4r5rrDr6r1r r r r!r�sc@s0eZdZfZedd��Zdd�Zedd��ZdS)rc�st�dS)N)�StopAsyncIteration)r.r r r!�	__anext__�szAsyncIterator.__anext__cCs|S)Nr )r.r r r!rD�szAsyncIterator.__aiter__cCs|tkrt|dd�StS)NrFrD)rr-r')r0r(r r r!r1�szAsyncIterator.__subclasshook__N)	r2r3r4r5rrFrDr6r1r r r r!r�sc@sFeZdZfZdd�Zedd��Zeddd��Zdd	�Ze	d
d��Z
dS)
rc�s|jd�IdHS)N)�asend)r.r r r!rF�szAsyncGenerator.__anext__c�st�dS)N)rE)r.r:r r r!rG�szAsyncGenerator.asendNc�s4|dkr|dkr|�|�}|dk	r,|j|�}|�dS)N)r<)r.r=r>r?r r r!�athrow�s
zAsyncGenerator.athrowc�s:y|jt�IdHWnttfk
r,Yn
Xtd��dS)Nz,asynchronous generator ignored GeneratorExit)rHrArErB)r.r r r!�aclose�s
zAsyncGenerator.aclosecCs|tkrt|ddddd�StS)NrDrFrGrHrI)rr-r')r0r(r r r!r1�s
zAsyncGenerator.__subclasshook__)NN)r2r3r4r5rFrrGrHrIr6r1r r r r!r�s
c@s(eZdZfZedd��Zedd��ZdS)r
ccsdS)Nr )r.r r r!�__iter__�szIterable.__iter__cCs|tkrt|d�StS)NrJ)r
r-r')r0r(r r r!r1�s
zIterable.__subclasshook__N)r2r3r4r5rrJr6r1r r r r!r
�sc@s0eZdZfZedd��Zdd�Zedd��ZdS)rcCst�dS)N)r9)r.r r r!�__next__szIterator.__next__cCs|S)Nr )r.r r r!rJszIterator.__iter__cCs|tkrt|dd�StS)NrJrK)rr-r')r0r(r r r!r1szIterator.__subclasshook__N)	r2r3r4r5rrKrJr6r1r r r r!rsc@s(eZdZfZedd��Zedd��ZdS)r
ccsdS)Nr )r.r r r!�__reversed__)szReversible.__reversed__cCs|tkrt|dd�StS)NrLrJ)r
r-r')r0r(r r r!r1.szReversible.__subclasshook__N)r2r3r4r5rrLr6r1r r r r!r
%sc@sFeZdZfZdd�Zedd��Zeddd��Zdd	�Ze	d
d��Z
dS)
rcCs
|jd�S)N)r;)r.r r r!rK9szGenerator.__next__cCst�dS)N)r9)r.r:r r r!r;?szGenerator.sendNcCs4|dkr|dkr|�|�}|dk	r,|j|�}|�dS)N)r<)r.r=r>r?r r r!r@Fs
zGenerator.throwcCs4y|jt�Wnttfk
r&Yn
Xtd��dS)Nzgenerator ignored GeneratorExit)r@rAr9rB)r.r r r!rCSs
zGenerator.closecCs|tkrt|ddddd�StS)NrJrKr;r@rC)rr-r')r0r(r r r!r1]s
zGenerator.__subclasshook__)NN)r2r3r4r5rKrr;r@rCr6r1r r r r!r5s
c@s(eZdZfZedd��Zedd��ZdS)rcCsdS)Nrr )r.r r r!�__len__ksz
Sized.__len__cCs|tkrt|d�StS)NrM)rr-r')r0r(r r r!r1os
zSized.__subclasshook__N)r2r3r4r5rrMr6r1r r r r!rgsc@s(eZdZfZedd��Zedd��ZdS)rcCsdS)NFr )r.�xr r r!�__contains__zszContainer.__contains__cCs|tkrt|d�StS)NrO)rr-r')r0r(r r r!r1~s
zContainer.__subclasshook__N)r2r3r4r5rrOr6r1r r r r!rvsc@seZdZfZedd��ZdS)rcCs|tkrt|ddd�StS)NrMrJrO)rr-r')r0r(r r r!r1�szCollection.__subclasshook__N)r2r3r4r5r6r1r r r r!r�sc@s(eZdZfZedd��Zedd��ZdS)rcOsdS)NFr )r.�args�kwdsr r r!�__call__�szCallable.__call__cCs|tkrt|d�StS)NrR)rr-r')r0r(r r r!r1�s
zCallable.__subclasshook__N)r2r3r4r5rrRr6r1r r r r!r�sc@s�eZdZfZdd�Zdd�Zdd�Zdd�Zd	d
�Ze	dd��Z
d
d�ZeZdd�Z
dd�ZeZdd�Zdd�Zdd�ZeZdd�ZdS)rcCs@t|t�stSt|�t|�kr"dSx|D]}||kr(dSq(WdS)NFT)�
isinstancerr'�len)r.�other�elemr r r!�__le__�s

z
Set.__le__cCs(t|t�stSt|�t|�ko&|j|�S)N)rSrr'rTrW)r.rUr r r!�__lt__�s
z
Set.__lt__cCs(t|t�stSt|�t|�ko&|j|�S)N)rSrr'rT�__ge__)r.rUr r r!�__gt__�s
z
Set.__gt__cCs@t|t�stSt|�t|�kr"dSx|D]}||kr(dSq(WdS)NFT)rSrr'rT)r.rUrVr r r!rY�s

z
Set.__ge__cCs(t|t�stSt|�t|�ko&|j|�S)N)rSrr'rTrW)r.rUr r r!�__eq__�s
z
Set.__eq__cCs||�S)Nr )r0�itr r r!�_from_iterable�szSet._from_iterablecs&t|t�stS�j�fdd�|D��S)Nc3s|]}|�kr|VqdS)Nr )�.0r:)r.r r!�	<genexpr>�szSet.__and__.<locals>.<genexpr>)rSr
r'r])r.rUr )r.r!�__and__�s
zSet.__and__cCsx|D]}||krdSqWdS)NFTr )r.rUr:r r r!�
isdisjoint�s
zSet.isdisjointcCs*t|t�stSdd�||fD�}|j|�S)Ncss|]}|D]
}|Vq
qdS)Nr )r^�s�er r r!r_�szSet.__or__.<locals>.<genexpr>)rSr
r'r])r.rU�chainr r r!�__or__�s
z
Set.__or__cs:t�t�s"t�t�stS|j���|j�fdd�|D��S)Nc3s|]}|�kr|VqdS)Nr )r^r:)rUr r!r_�szSet.__sub__.<locals>.<genexpr>)rSrr
r'r])r.rUr )rUr!�__sub__�s



zSet.__sub__cs:t|t�s"t|t�stS�j|�}�j�fdd�|D��S)Nc3s|]}|�kr|VqdS)Nr )r^r:)r.r r!r_�szSet.__rsub__.<locals>.<genexpr>)rSrr
r'r])r.rUr )r.r!�__rsub__�s



zSet.__rsub__cCs2t|t�s"t|t�stS|j|�}||||BS)N)rSrr
r'r])r.rUr r r!�__xor__s



zSet.__xor__cCs�tj}d|d}t|�}d|d}||M}x4|D],}t|�}|||d>AdAdN}||M}q4W|dd}||M}||kr�||d8}|d
kr�d	}|S)N�riM��r�i�M[l�4~2i�
i��6i��8#���)�sys�maxsizerT�hash)r.�MAX�MASK�n�hrN�hxr r r!�_hash	s 
z	Set._hashN)r2r3r4r5rWrXrZrYr[r6r]r`�__rand__rare�__ror__rfrgrh�__rxor__rtr r r r!r�s"

	c@s`eZdZfZedd��Zedd��Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dS)rcCst�dS)N)�NotImplementedError)r.r:r r r!�add:szMutableSet.addcCst�dS)N)rx)r.r:r r r!�discard?szMutableSet.discardcCs||krt|��|j|�dS)N)�KeyErrorrz)r.r:r r r!�removeDszMutableSet.removecCs<t|�}yt|�}Wntk
r,t�YnX|j|�|S)N)�iter�nextr9r{rz)r.r\r:r r r!�popJs

zMutableSet.popcCs,yx|j�qWWntk
r&YnXdS)N)rr{)r.r r r!�clearTs
zMutableSet.clearcCsx|D]}|j|�qW|S)N)ry)r.r\r:r r r!�__ior__\s
zMutableSet.__ior__cCs x||D]}|j|�q
W|S)N)rz)r.r\r:r r r!�__iand__aszMutableSet.__iand__cCsV||kr|j�n@t|t�s&|j|�}x*|D]"}||krD|j|�q,|j|�q,W|S)N)r�rSrr]rzry)r.r\r:r r r!�__ixor__fs



zMutableSet.__ixor__cCs.||kr|j�nx|D]}|j|�qW|S)N)r�rz)r.r\r:r r r!�__isub__ss


zMutableSet.__isub__N)r2r3r4r5rryrzr|rr�r�r�r�r�r r r r!r,s

c@sReZdZfZedd��Zddd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZdZdS)rcCst�dS)N)r{)r.�keyr r r!�__getitem__�szMapping.__getitem__NcCs"y||Stk
r|SXdS)N)r{)r.r��defaultr r r!�get�szMapping.getcCs*y||Wntk
r dSXdSdS)NFT)r{)r.r�r r r!rO�s
zMapping.__contains__cCst|�S)N)r)r.r r r!�keys�szMapping.keyscCst|�S)N)r)r.r r r!�items�sz
Mapping.itemscCst|�S)N)r)r.r r r!�values�szMapping.valuescCs&t|t�stSt|j��t|j��kS)N)rSrr'�dictr�)r.rUr r r!r[�s
zMapping.__eq__)N)
r2r3r4r5rr�r�rOr�r�r�r[rLr r r r!r�s

c@s(eZdZd	Zdd�Zdd�Zdd�ZdS)
r�_mappingcCs
||_dS)N)r�)r.�mappingr r r!�__init__�szMappingView.__init__cCs
t|j�S)N)rTr�)r.r r r!rM�szMappingView.__len__cCs
dj|�S)Nz&{0.__class__.__name__}({0._mapping!r}))�format)r.r r r!�__repr__�szMappingView.__repr__N)r�)r2r3r4r5r�rMr�r r r r!r�sc@s,eZdZfZedd��Zdd�Zdd�ZdS)rcCst|�S)N)�set)r.r\r r r!r]�szKeysView._from_iterablecCs
||jkS)N)r�)r.r�r r r!rO�szKeysView.__contains__ccs|jEdHdS)N)r�)r.r r r!rJ�szKeysView.__iter__N)r2r3r4r5r6r]rOrJr r r r!r�sc@s,eZdZfZedd��Zdd�Zdd�ZdS)rcCst|�S)N)r�)r.r\r r r!r]�szItemsView._from_iterablecCs@|\}}y|j|}Wntk
r*dSX||kp:||kSdS)NF)r�r{)r.�itemr�r:�vr r r!rO�szItemsView.__contains__ccs$x|jD]}||j|fVqWdS)N)r�)r.r�r r r!rJ�szItemsView.__iter__N)r2r3r4r5r6r]rOrJr r r r!r�s	c@s eZdZfZdd�Zdd�ZdS)rcCs2x,|jD]"}|j|}||ks&||krdSqWdS)NTF)r�)r.r:r�r�r r r!rO�s

zValuesView.__contains__ccs x|jD]}|j|VqWdS)N)r�)r.r�r r r!rJ�szValuesView.__iter__N)r2r3r4r5rOrJr r r r!r�sc@s\eZdZfZedd��Zedd��Ze�Zefdd�Z	dd�Z
d	d
�Zdd�Zddd�Z
d
S)rcCst�dS)N)r{)r.r�r:r r r!�__setitem__szMutableMapping.__setitem__cCst�dS)N)r{)r.r�r r r!�__delitem__szMutableMapping.__delitem__cCs<y||}Wn tk
r,||jkr(�|SX||=|SdS)N)r{�_MutableMapping__marker)r.r�r�r:r r r!rs
zMutableMapping.popcCs@ytt|��}Wntk
r(t�YnX||}||=||fS)N)r~r}r9r{)r.r�r:r r r!�popitem$s
zMutableMapping.popitemcCs,yx|j�qWWntk
r&YnXdS)N)r�r{)r.r r r!r�0s
zMutableMapping.clearcOs�|std��|^}}t|�dkr0tdt|���|r�|d}t|t�rbx^|D]}||||<qLWnDt|d�r�x8|j�D]}||||<qvWnx|D]\}}|||<q�Wx|j�D]\}}|||<q�WdS)Nz@descriptor 'update' of 'MutableMapping' object needs an argumentrz+update expected at most 1 arguments, got %drr�)�	TypeErrorrTrSr�hasattrr�r�)rPrQr.rUr�r:r r r!�update8s$


zMutableMapping.updateNcCs*y||Stk
r$|||<YnX|S)N)r{)r.r�r�r r r!�
setdefaultSs
zMutableMapping.setdefault)N)r2r3r4r5rr�r��objectr�rr�r�r�r�r r r r!r�sc@sFeZdZfZedd��Zdd�Zdd�Zdd�Zddd�Z	d
d�Z
d
S)rcCst�dS)N)�
IndexError)r.�indexr r r!r�kszSequence.__getitem__ccs>d}y x||}|V|d7}qWWntk
r8dSXdS)Nrr)r�)r.�ir�r r r!rJoszSequence.__iter__cCs&x |D]}||ks||krdSqWdS)NTFr )r.r:r�r r r!rOys
zSequence.__contains__ccs(x"ttt|���D]}||VqWdS)N)�reversed�rangerT)r.r�r r r!rLszSequence.__reversed__rNcCs�|dk	r"|dkr"tt|�|d�}|dk	r>|dkr>|t|�7}|}xT|dksT||kr�y ||}||ksn||krr|SWntk
r�PYnX|d7}qDWt�dS)Nrr)�maxrTr��
ValueError)r.r:�start�stopr�r�r r r!r��szSequence.indexcst�fdd�|D��S)Nc3s"|]}|�ks|�krdVqdS)rNr )r^r�)r:r r!r_�sz!Sequence.count.<locals>.<genexpr>)�sum)r.r:r )r:r!�count�szSequence.count)rN)r2r3r4r5rr�rJrOrLr�r�r r r r!ras

c@seZdZfZdS)rN)r2r3r4r5r r r r!r�sc@sneZdZfZedd��Zedd��Zedd��Zdd�Zd	d
�Z	dd�Z
d
d�Zddd�Zdd�Z
dd�ZdS)rcCst�dS)N)r�)r.r�r:r r r!r��szMutableSequence.__setitem__cCst�dS)N)r�)r.r�r r r!r��szMutableSequence.__delitem__cCst�dS)N)r�)r.r�r:r r r!�insert�szMutableSequence.insertcCs|jt|�|�dS)N)r�rT)r.r:r r r!�append�szMutableSequence.appendcCs,yx|j�qWWntk
r&YnXdS)N)rr�)r.r r r!r��s
zMutableSequence.clearcCsLt|�}x>t|d�D].}|||d||||<|||d<qWdS)Nrir)rTr�)r.rqr�r r r!�reverse�szMutableSequence.reversecCsx|D]}|j|�qWdS)N)r�)r.r�r�r r r!�extend�s
zMutableSequence.extendrcCs||}||=|S)Nr )r.r�r�r r r!r�szMutableSequence.popcCs||j|�=dS)N)r�)r.r:r r r!r|�szMutableSequence.removecCs|j|�|S)N)r�)r.r�r r r!�__iadd__�s
zMutableSequence.__iadd__Nrk)rk)r2r3r4r5rr�r�r�r�r�r�r�rr|r�r r r r!r�s	
)J�abcrrrl�__all__r2�typer}�bytes_iterator�	bytearray�bytearray_iteratorr��dict_keyiteratorr��dict_valueiteratorr��dict_itemiterator�
list_iteratorr��list_reverseiteratorr��range_iterator�longrange_iteratorr��set_iterator�str_iterator�tuple_iterator�zip�zip_iterator�	dict_keys�dict_values�
dict_itemsr&�mappingproxy�	generatorr#�	coroutinerCr$�async_generatorr-r	rr�registerrrrr
rr
rrrrrr�	frozensetrrrrrrrr�r�tuple�str�
memoryviewr�bytesr�listr r r r!�<module>	s�
	
)
0













/



O
2



\
=



	

A
zipapp.cpython-36.opt-1.pyc000064400000012640150335715140011443 0ustar003


 \��@s�ddlZddlZddlZddlZddlZddlZddlZdddgZdZej	j
d�rXdZnej�ZGdd�de
�Zejd	d
��Zdd�Zdd
d�Zddd�Zdd�Zddd�Zedkr�e�dS)�N�ZipAppError�create_archive�get_interpreterz8# -*- coding: utf-8 -*-
import {module}
{module}.{fn}()
�winzutf-8c@seZdZdS)rN)�__name__�
__module__�__qualname__�r	r	�/usr/lib64/python3.6/zipapp.pyr!sc	csFt|tj�rt|�}t|t�r<t||��}|VWdQRXn|VdS)N)�
isinstance�pathlib�Path�str�open)�archive�mode�fr	r	r
�_maybe_open%s
rcCs$|r d|jt�d}|j|�dS)zWrite a shebang line.s#!�
N)�encode�shebang_encoding�write)r�interpreterZshebangr	r	r
�_write_file_prefix0srcCs�t|d��Z}|jd�}|dkr*d}|j�t|d��&}t||�|j|�tj||�WdQRXWdQRX|r�t|t�r�t	j
|t	j|�jtj
B�dS)z8Copy an application archive, modifying the shebang line.�rb�s#!��wbN)r�read�readlinerr�shutilZcopyfileobjrr�os�chmod�stat�st_mode�S_IEXEC)rZnew_archiver�srcZfirst_2�dstr	r	r
�
_copy_archive7s


 r(cCs�d}t|d�rt|d�rd}ntj|�}|j�r4d}|rHt|||�dS|j�sXtd��|dj�}|rt|rttd��|pz|s�td	��d}|r�|jd
�\}}}	tdd�|j	d
�D��}
tdd�|	j	d
�D��}|d
ko�|
o�|s�td|��t
j||	d�}|dk�r|jd�}nt|d��s"tj|�}t
|d��~}t||�tj|d��\}
tj|�}x2|jd�D]$}t|j|��}|
jt|�|��q\W|�r�|
jd|jd��WdQRXWdQRX|�r�t|d��r�|j|j�jtjB�dS)abCreate an application archive from SOURCE.

    The SOURCE can be the name of a directory, or a filename or a file-like
    object referring to an existing archive.

    The content of SOURCE is packed into an application archive in TARGET,
    which can be a filename or a file-like object.  If SOURCE is a directory,
    TARGET can be omitted and will default to the name of SOURCE with .pyz
    appended.

    The created application archive will have a shebang line specifying
    that it should run with INTERPRETER (there will be no shebang line if
    INTERPRETER is None), and a __main__.py which runs MAIN (if MAIN is
    not specified, an existing __main__.py will be used).  It is an error
    to specify MAIN for anything other than a directory source with no
    __main__.py, and it is an error to omit MAIN if the directory has no
    __main__.py.
    FrrTNzSource does not existz__main__.pyz8Cannot specify entry point if the source has __main__.pyzArchive has no entry point�:css|]}|j�VqdS)N)�isidentifier)�.0�partr	r	r
�	<genexpr>|sz!create_archive.<locals>.<genexpr>�.css|]}|j�VqdS)N)r*)r+r,r	r	r
r-}szInvalid entry point: )�module�fnz.pyzrr�w�*zutf-8)�hasattrrr
�is_filer(�existsr�	partition�all�split�
MAIN_TEMPLATE�formatZwith_suffixrr�zipfileZZipFileZrglobrZrelative_torZwritestrrr"r#r$r%)�source�targetr�mainZsource_is_fileZhas_mainZmain_py�mod�sepr0Zmod_okZfn_ok�fd�z�rootZchildZarcnamer	r	r
rNsP




&c	Cs:t|d��&}|jd�dkr,|j�j�jt�SWdQRXdS)Nrrs#!)rrr�strip�decoder)rrr	r	r
r�scCs ddl}|j�}|jddddd�|jdddd	d�|jd
dddd�|jd
dddd�|jddd�|j|�}|jr�tjj|j�s�t	d��t
|j�}tdj|p�d��t
jd�tjj|j��r|jdks�tjj|j�r�tjj|j|j�r�t	d��|j�rt	d��t|j|j|j|jd�dS)z�Run the zipapp command line interface.

    The ARGS parameter lets you specify the argument list directly.
    Omitting ARGS (or setting it to None) works as for argparse, using
    sys.argv[1:] as the argument list.
    rNz--outputz-ozAThe name of the output archive. Required if SOURCE is an archive.)�default�helpz--pythonz-pzEThe name of the Python interpreter to use (default: no shebang line).z--mainz-mzLThe main function of the application (default: use an existing __main__.py).z--infoF�
store_truez)Display the interpreter from the archive.)rF�actionrGr<z'Source directory (or existing archive).)rGz%Can only get info for an archive filezInterpreter: {}z<none>z-In-place editing of archives is not supportedz,Cannot change the main function when copying)rr>)�argparse�ArgumentParser�add_argument�
parse_args�infor!�path�isfiler<�
SystemExitr�printr:�sys�exit�outputr5�samefiler>r�python)�argsrJ�parserrr	r	r
r>�s6







r>�__main__)N)NNN)N)�
contextlibr!rr r#rSr;�__all__r9�platform�
startswithr�getfilesystemencoding�
ValueErrorr�contextmanagerrrr(rrr>rr	r	r	r
�<module>s(


G
-traceback.cpython-36.opt-2.pyc000064400000024773150335715140012072 0ustar003


 \�[�@s6ddlZddlZddlZddlZdddddddd	d
ddd
dddddddgZd2dd�Zdd�Zd3dd�Zd4dd�Zd5dd�Z	dZ
dZd6dd�Zd7dd�Z
d d�Zd!d"�Zd#d$�Zd8d%d	�Zd9d&d
�Zd:d'd�Zd;d(d
�Zd<d)d�Zd=d*d�Zd+d�ZGd,d�d�Zd-d�Zd.d�Zd/ZGd0d�de�ZGd1d�d�ZdS)>�N�
extract_stack�
extract_tb�format_exception�format_exception_only�format_list�format_stack�	format_tb�	print_exc�
format_exc�print_exception�
print_last�print_stack�print_tb�clear_frames�FrameSummary�StackSummary�TracebackException�
walk_stack�walk_tbcCs8|dkrtj}x$tj|�j�D]}t||dd�qWdS)N�)�file�end)�sys�stderrr�	from_list�format�print)�extracted_listr�item�r�!/usr/lib64/python3.6/traceback.py�
print_listsr!cCstj|�j�S)N)rrr)rrrr rscCstt||d�|d�dS)N)�limit)r)r!r)�tbr"rrrr r-scCst||d�j�S)N)r")rr)r#r"rrr r7scCstjt|�|d�S)N)r")r�extractr)r#r"rrr r;s
zG
The above exception was the direct cause of the following exception:

zF
During handling of the above exception, another exception occurred:

TcCsF|dkrtj}x2tt|�|||d�j|d�D]}t||dd�q,WdS)N)r")�chainr)rr)rrr�typerr)�etype�valuer#r"rr%�linerrr rWs
cCs ttt|�|||d�j|d��S)N)r")r%)�listrr&r)r'r(r#r"r%rrr rlscCstt||d�j��S)N)r*rr)r'r(rrr r|scCs0t|�}|dks|r d|}nd||f}|S)Nz%s
z%s: %s
)�	_some_str)r'r(�valuestrr)rrr �_format_final_exc_line�s

r-c	Cs"yt|�Sdt|�jSdS)Nz<unprintable %s object>)�strr&�__name__)r(rrr r+�sr+cCsttj�|||d��dS)N)r"rr%)rr�exc_info)r"rr%rrr r	�scCsdjttj�||d���S)Nr)r"r%)�joinrrr0)r"r%rrr r
�scCs.ttd�std��ttjtjtj|||�dS)N�	last_typezno last exception)�hasattrr�
ValueErrorrr2�
last_value�last_traceback)r"rr%rrr r�s
cCs*|dkrtj�j}tt||d�|d�dS)N)r")r)r�	_getframe�f_backr!r)�fr"rrrr r
�s
cCs"|dkrtj�j}tt||d��S)N)r")rr7r8rr)r9r"rrr r�s
cCs0|dkrtj�j}tjt|�|d�}|j�|S)N)r")rr7r8rr$r�reverse)r9r"�stackrrr r�s
	
cCs<x6|dk	r6y|jj�Wntk
r,YnX|j}qWdS)N)�tb_frame�clear�RuntimeError�tb_next)r#rrr r�s
c@sNeZdZdZdddd�d	d
�Zdd�Zd
d�Zdd�Zdd�Ze	dd��Z
dS)r�filename�lineno�name�_line�localsTN)�lookup_linerDr)cCsF||_||_||_||_|r"|j|r<tdd�|j�D��nd|_dS)Ncss|]\}}|t|�fVqdS)N)�repr)�.0�k�vrrr �	<genexpr>sz(FrameSummary.__init__.<locals>.<genexpr>)r@rArBrCr)�dict�itemsrD)�selfr@rArBrErDr)rrr �__init__�szFrameSummary.__init__cCs`t|t�r:|j|jko8|j|jko8|j|jko8|j|jkSt|t�r\|j|j|j|jf|kStS)N)	�
isinstancerr@rArBrD�tupler)�NotImplemented)rM�otherrrr �__eq__s

zFrameSummary.__eq__cCs|j|j|j|jf|S)N)r@rArBr))rM�posrrr �__getitem__szFrameSummary.__getitem__cCst|j|j|j|jg�S)N)�iterr@rArBr))rMrrr �__iter__szFrameSummary.__iter__cCsdj|j|j|jd�S)Nz7<FrameSummary file {filename}, line {lineno} in {name}>)r@rArB)rr@rArB)rMrrr �__repr__szFrameSummary.__repr__cCs&|jdkr tj|j|j�j�|_|jS)N)rC�	linecache�getliner@rA�strip)rMrrr r)s
zFrameSummary.line)r@rArBrCrD)r/�
__module__�__qualname__�	__slots__rNrSrUrWrX�propertyr)rrrr r�s
ccs8|dkrtj�jj}x|dk	r2||jfV|j}qWdS)N)rr7r8�f_lineno)r9rrr r"s

ccs&x |dk	r |j|jfV|j}qWdS)N)r<�	tb_linenor?)r#rrr r/s
�c@s6eZdZedddd�dd��Zedd��Zd	d
�ZdS)rNTF)r"�lookup_lines�capture_localsc
	Cs�|dkr(ttdd�}|dk	r(|dkr(d}|dk	rV|dkrFtj||�}ntj||d�}|�}t�}xb|D]Z\}}|j}	|	j}
|	j	}|j
|
�tj|
|j
�|r�|j}nd}|jt|
||d|d��qhWx|D]}
tj|
�q�W|r�x|D]
}|jq�W|S)N�tracebacklimitr)�maxlenF)rErD)�getattrr�	itertools�islice�collections�deque�set�f_code�co_filename�co_name�addrY�	lazycache�	f_globals�f_locals�appendr�
checkcacher))
�klass�	frame_genr"rcrd�result�fnamesr9rA�cor@rBrsrrr r$?s6



zStackSummary.extractcCsPt�}xD|D]<}t|t�r&|j|�q|\}}}}|jt||||d��qW|S)N)r))rrOrrt)rv�a_listrx�framer@rArBr)rrr ros


zStackSummary.from_listc
Csxg}d}d}d}d}�x$|D�]}|dksX||jksX|dksX||jksX|dksX||jkr�|tkr�|t8}|jd|�d|dkr�dnd�d��|j}|j}|j}d}|d7}|tkr�qg}|jdj|j|j|j��|jr�|jd	j|jj���|j�r(x0t	|jj
��D]\}}	|jd
j||	d���qW|jdj|��qW|tk�rt|t8}|jd|�d|dk�rhdnd�d��|S)Nrz  [Previous line repeated z
 more time��srz]
z  File "{}", line {}, in {}
z    {}
z    {name} = {value}
)rBr()r@rArB�_RECURSIVE_CUTOFFrtrr)r[rD�sortedrLr1)
rMrx�	last_file�	last_line�	last_name�countr|�rowrBr(rrr r�sD 
"zStackSummary.format)r/r\r]�classmethodr$rrrrrr r<s
.c@sZeZdZddddd�dd�Zedd��Zd	d
�Zdd�Zd
d�Zdd�Z	dd�dd�Z
dS)rNTF)r"rcrd�_seenc
	Cs<|dkrt�}|jt|��|r\|jdk	r\t|j�|kr\tt|j�|j|jj|d||d�}nd}|r�|jdk	r�t|j�|kr�tt|j�|j|jj|d||d�}	nd}	||_||_|	|_|r�|j	nd|_	t
jt|�|||d�|_
||_t|�|_|o�t|t��r*|j|_t|j�|_|j|_|j|_|j|_|�r8|j�dS)NF)r"rcrdr�)r"rcrd)rlrp�id�	__cause__rr&�
__traceback__�__context__�
exc_traceback�__suppress_context__rr$rr;�exc_typer+�_str�
issubclass�SyntaxErrorr@r.rA�text�offset�msg�_load_lines)
rMr��	exc_valuer�r"rcrdr��cause�contextrrr rN�sT




zTracebackException.__init__cOs|t|�||jf|�|�S)N)r&r�)�cls�exc�args�kwargsrrr �from_exceptionsz!TracebackException.from_exceptioncCs:x|jD]
}|jqW|jr&|jj�|jr6|jj�dS)N)r;r)r�r�r�)rMr|rrr r�s

zTracebackException._load_linescCs|j|jkS)N)�__dict__)rMrRrrr rSszTracebackException.__eq__cCs|jS)N)r�)rMrrr �__str__szTracebackException.__str__c	cs|jdkrtd|j�VdS|jj}|jj}|dkr@|d|}t|jt�s^t||j�VdS|jpfd}t|j	�ptd}dj
||�V|j}|j}|dk	�rdj
|j
��V|dk	�r|jd�}tt|�|�d	}|d|�j�}d
d�|D�}dj
d
j|��V|j�p
d}dj
||�VdS)N�__main__�builtins�.z<string>�?z  File "{}", line {}
z    {}
�
r}css|]}|j�r|pdVqdS)� N)�isspace)rG�crrr rJHsz;TracebackException.format_exception_only.<locals>.<genexpr>z    {}^
rz<no detail available>z{}: {}
)r�r�)r�r-r�r]r\r�r�r@r.rArr�r�r[�rstrip�min�len�lstripr1r�)	rM�stype�smodr@rA�badliner��
caretspacer�rrr r s2




z(TracebackException.format_exception_only)r%ccs�|rV|jdk	r*|jj|d�EdHtVn,|jdk	rV|jrV|jj|d�EdHtV|jdk	rfdV|jj�EdH|j�EdHdS)N)r%z#Traceback (most recent call last):
)	r�r�_cause_messager�r��_context_messager�r;r)rMr%rrr rMs


zTracebackException.format)r/r\r]rNr�r�r�rSr�rrrrrr r�s9	-)N)NN)N)N)NNT)NT)NNT)NT)NNT)NNN)NN)NN)rjrhrYr�__all__r!rrrrr�r�rrrr-r+r	r
rr
rrrrrrrr*rrrrrr �<module>sD












?
zcProfile.cpython-36.pyc000064400000010310150335715140010734 0ustar003


 \�@szdZdddgZddlZddlZddd�Zddd�Zejje_ejje_Gd	d�dej�Zd
d�Z	dd
�Z
edkrve
�dS)zUPython interface for the 'lsprof' profiler.
   Compatible with the 'profile' module.
�run�runctx�Profile�N�cCstjt�j|||�S)N)�
_pyprofile�_Utilsrr)�	statement�filename�sort�r� /usr/lib64/python3.6/cProfile.pyrscCstjt�j|||||�S)N)rrrr)r�globals�localsr	r
rrrrsc@sJeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)ra`Profile(timer=None, timeunit=None, subcalls=True, builtins=True)

    Builds a profiler object using the specified timer function.
    The default timer is a fast built-in one based on real time.
    For custom timer functions returning integers, timeunit can
    be a float specifying a scale (i.e. how long each integer unit
    is, in seconds).
    rcCs$ddl}|j|�j�j|�j�dS)Nr)�pstats�StatsZ
strip_dirsZ
sort_stats�print_stats)�selfr
rrrrr(szProfile.print_statsc
Cs8ddl}t|d��}|j�|j|j|�WdQRXdS)Nr�wb)�marshal�open�create_stats�dump�stats)r�filer�frrr�
dump_stats,szProfile.dump_statscCs|j�|j�dS)N)�disable�snapshot_stats)rrrrr2szProfile.create_statscCs6|j�}i|_i}xX|D]P}t|j�}|j}||j}|j}|j}i}	|	|t|j�<|||||	f|j|<qWx�|D]�}|j	rrt|j�}x�|j	D]�}
y|t|
j�}	Wnt
k
r�w�YnX|
j}||
j}|
j}|
j}||	k�r|	|}||d7}||d7}||d7}||d7}||||f|	|<q�WqrWdS)Nrr��)Zgetstatsr�label�codeZ	callcountZreccallcountZ
inlinetimeZ	totaltime�idZcalls�KeyError)rZentriesZcallersdicts�entry�funcZncZccZttZctZcallersZsubentry�prevrrrr6s>






zProfile.snapshot_statscCsddl}|j}|j|||�S)Nr)�__main__�__dict__r)r�cmdr'�dictrrrr\szProfile.runc
Cs(|j�zt|||�Wd|j�X|S)N)�enable�execr)rr)r
rrrrras

zProfile.runctxc
Os"|j�z
|||�S|j�XdS)N)r+r)rr%�args�kwrrr�runcalljs
zProfile.runcallN���)r0)�__name__�
__module__�__qualname__�__doc__rrrrrrr/rrrrrs
&	cCs(t|t�rdd|fS|j|j|jfSdS)N�~r)�
isinstance�str�co_filename�co_firstlineno�co_name)r!rrrr ss

r c
Cs&ddl}ddl}ddl}ddlm}d}||d�}d|_|jdddd	dd
�|jddd
ddt|jj	�d�|j
dd�s�|j�|jd�|j
�\}}||j
dd�<t|�dk�r|d}|jjd|jj|��t|d��}	t|	j�|d�}
WdQRX|dddd�}t|
|d|j|j�n|j�|S)Nr)�OptionParserz@cProfile.py [-o output_file_path] [-s sort] scriptfile [arg] ...)�usageFz-oz	--outfile�outfilezSave stats to <outfile>)�dest�help�defaultz-sz--sortr
z?Sort order when printing to stdout, based on pstats.Stats classr)r>r?r@�choicesr�rbr,r')�__file__r1�__package__�
__cached__r0)�os�sysrZoptparser;Zallow_interspersed_argsZ
add_option�sortedrZsort_arg_dict_default�argvZprint_usage�exit�
parse_args�len�path�insert�dirnamer�compile�readrr=r
)rFrGrr;r<�parserZoptionsr-Zprogname�fpr!Zglobsrrr�main{s8




rTr'r0)Nr0r0)Nr0)r4�__all__Z_lsprofZprofilerrrZProfilerrr rTr1rrrr�<module>s




X%_pydecimal.cpython-36.opt-1.pyc000064400000477114150335715140012261 0ustar003


 \T��$@sJdZddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$g$ZeZd%Zd&Zd'Zd(d)lZd(d)lZ	d(d)l
Z
yd(d*lmZ
e
dd+�ZWnek
r�d,d-�ZYnXdZdZdZdZdZdZdZdZd.Ze
jd�kr�d2Zd2Zd�Znd3Zd3Zd�Zeed1ZGd4d�de�ZGd5d�de�Z Gd6d	�d	e�Z!Gd7d�de!�Z"Gd8d
�d
ee#�Z$Gd9d�de!�Z%Gd:d�de!e#�Z&Gd;d�de�Z'Gd<d�de!�Z(Gd=d�de�Z)Gd>d
�d
e�Z*Gd?d�de'e)�Z+Gd@d�de'e)e*�Z,GdAd�dee-�Z.e e$e'e+e)e,e!e*e.g	Z/e"e!e%e!e&e!e(e!iZ0eeeeeeeefZ1yd(d)l2Z2Wn.ek
�rhGdBdC�dCe3�Z4e4�Z2[4YnXy
e2j5Wn>e6k
�r�e7e2j8�dD��r�e2j8�`9dEd�Z:dFd�Z;Yn6Xe2j5�Z5e7e5dD��r�e5`9e5fdGd�Z;e5fdHd�Z:[2[5d�dId�Z<GdJd�de3�Z=d�dLdM�Z>e	j?j@e=�GdNdO�dOe3�ZAGdPd�de3�ZBGdQdR�dRe3�ZCd�dSdT�ZDeEjFZGdUdV�ZHdWdX�ZIdYdZ�ZJd[d\�ZKd�d^d_�ZLd`da�ZMdbdc�ZNGddde�dee3�ZOeO�jPZQd�dfdg�ZRdhdi�ZSdjdk�ZTdldmdndodpdqdrdsdtdu�	fdvdw�ZUd�dxdy�ZVd�dzd{�ZWeBd|ee$e+e!ggd}d�d1d(d~�ZXeBdee$e+e!e e,ggd��ZYeBdeggd��ZZd(d)l[Z[e[j\d�e[j]e[j^B�j_Z`e[j\d��j_Zae[j\d��j_Zbe[j\d�e[j]e[jcB�Zd[[yd(d)leZfWnek
�r�YnXd�d�d��Zgd�d��Zhd�d��Zid�d�d��Zjd�d��Zkd�d��Zle=d��Zme=d��Zne=d��Zoe=d(�Zpe=d1�Zqe=d��ZremenfZse
jtjuZve
jtjwZxe
jtjyZze{dsevd/ev�Z|[
d)S)�a�	
This is an implementation of decimal floating point arithmetic based on
the General Decimal Arithmetic Specification:

    http://speleotrove.com/decimal/decarith.html

and IEEE standard 854-1987:

    http://en.wikipedia.org/wiki/IEEE_854-1987

Decimal floating point has finite precision with arbitrarily large bounds.

The purpose of this module is to support arithmetic using familiar
"schoolhouse" rules and to avoid some of the tricky representation
issues associated with binary floating point.  The package is especially
useful for financial applications or for contexts where users have
expectations that are at odds with binary floating point (for instance,
in binary floating point, 1.00 % 0.1 gives 0.09999999999999995 instead
of 0.0; Decimal('1.00') % Decimal('0.1') returns the expected
Decimal('0.00')).

Here are some examples of using the decimal module:

>>> from decimal import *
>>> setcontext(ExtendedContext)
>>> Decimal(0)
Decimal('0')
>>> Decimal('1')
Decimal('1')
>>> Decimal('-.0123')
Decimal('-0.0123')
>>> Decimal(123456)
Decimal('123456')
>>> Decimal('123.45e12345678')
Decimal('1.2345E+12345680')
>>> Decimal('1.33') + Decimal('1.27')
Decimal('2.60')
>>> Decimal('12.34') + Decimal('3.87') - Decimal('18.41')
Decimal('-2.20')
>>> dig = Decimal(1)
>>> print(dig / Decimal(3))
0.333333333
>>> getcontext().prec = 18
>>> print(dig / Decimal(3))
0.333333333333333333
>>> print(dig.sqrt())
1
>>> print(Decimal(3).sqrt())
1.73205080756887729
>>> print(Decimal(3) ** 123)
4.85192780976896427E+58
>>> inf = Decimal(1) / Decimal(0)
>>> print(inf)
Infinity
>>> neginf = Decimal(-1) / Decimal(0)
>>> print(neginf)
-Infinity
>>> print(neginf + inf)
NaN
>>> print(neginf * inf)
-Infinity
>>> print(dig / 0)
Infinity
>>> getcontext().traps[DivisionByZero] = 1
>>> print(dig / 0)
Traceback (most recent call last):
  ...
  ...
  ...
decimal.DivisionByZero: x / 0
>>> c = Context()
>>> c.traps[InvalidOperation] = 0
>>> print(c.flags[InvalidOperation])
0
>>> c.divide(Decimal(0), Decimal(0))
Decimal('NaN')
>>> c.traps[InvalidOperation] = 1
>>> print(c.flags[InvalidOperation])
1
>>> c.flags[InvalidOperation] = 0
>>> print(c.flags[InvalidOperation])
0
>>> print(c.divide(Decimal(0), Decimal(0)))
Traceback (most recent call last):
  ...
  ...
  ...
decimal.InvalidOperation: 0 / 0
>>> print(c.flags[InvalidOperation])
1
>>> c.flags[InvalidOperation] = 0
>>> c.traps[InvalidOperation] = 0
>>> print(c.divide(Decimal(0), Decimal(0)))
NaN
>>> print(c.flags[InvalidOperation])
1
>>>
�Decimal�Context�DecimalTuple�DefaultContext�BasicContext�ExtendedContext�DecimalException�Clamped�InvalidOperation�DivisionByZero�Inexact�Rounded�	Subnormal�Overflow�	Underflow�FloatOperation�DivisionImpossible�InvalidContext�ConversionSyntax�DivisionUndefined�
ROUND_DOWN�
ROUND_HALF_UP�ROUND_HALF_EVEN�
ROUND_CEILING�ROUND_FLOOR�ROUND_UP�ROUND_HALF_DOWN�
ROUND_05UP�
setcontext�
getcontext�localcontext�MAX_PREC�MAX_EMAX�MIN_EMIN�	MIN_ETINY�HAVE_THREADSZdecimalz1.70z2.4.2�N)�
namedtuplezsign digits exponentcGs|S)N�)�argsr'r'�"/usr/lib64/python3.6/_pydecimal.py�<lambda>�sr*T��?�l��N�Zoi@�Tc@seZdZdZdd�ZdS)ra1Base exception class.

    Used exceptions derive from this.
    If an exception derives from another exception besides this (such as
    Underflow (Inexact, Rounded, Subnormal) that indicates that it is only
    called if the others are present.  This isn't actually used for
    anything, though.

    handle  -- Called when context._raise_error is called and the
               trap_enabler is not set.  First argument is self, second is the
               context.  More arguments can be given, those being after
               the explanation in _raise_error (For example,
               context._raise_error(NewError, '(-x)!', self._sign) would
               call NewError().handle(context, self._sign).)

    To define a new exception, it should be sufficient to have it derive
    from DecimalException.
    cGsdS)Nr')�self�contextr(r'r'r)�handle�szDecimalException.handleN)�__name__�
__module__�__qualname__�__doc__r0r'r'r'r)r�sc@seZdZdZdS)ra)Exponent of a 0 changed to fit bounds.

    This occurs and signals clamped if the exponent of a result has been
    altered in order to fit the constraints of a specific concrete
    representation.  This may occur when the exponent of a zero result would
    be outside the bounds of a representation, or when a large normal
    number would have an encoded exponent that cannot be represented.  In
    this latter case, the exponent is reduced to fit and the corresponding
    number of zero digits are appended to the coefficient ("fold-down").
    N)r1r2r3r4r'r'r'r)r�s
c@seZdZdZdd�ZdS)r	a0An invalid operation was performed.

    Various bad things cause this:

    Something creates a signaling NaN
    -INF + INF
    0 * (+-)INF
    (+-)INF / (+-)INF
    x % 0
    (+-)INF % x
    x._rescale( non-integer )
    sqrt(-x) , x > 0
    0 ** 0
    x ** (non-integer)
    x ** (+-)INF
    An operand is invalid

    The result of the operation after these is a quiet positive NaN,
    except when the cause is a signaling NaN, in which case the result is
    also a quiet NaN, but with the original sign, and an optional
    diagnostic information.
    cGs,|r(t|dj|djdd�}|j|�StS)Nr%�nT)�_dec_from_triple�_sign�_int�_fix_nan�_NaN)r.r/r(�ansr'r'r)r0�s
zInvalidOperation.handleN)r1r2r3r4r0r'r'r'r)r	�sc@seZdZdZdd�ZdS)rz�Trying to convert badly formed string.

    This occurs and signals invalid-operation if a string is being
    converted to a number and it does not conform to the numeric string
    syntax.  The result is [0,qNaN].
    cGstS)N)r:)r.r/r(r'r'r)r0szConversionSyntax.handleN)r1r2r3r4r0r'r'r'r)r�sc@seZdZdZdd�ZdS)r
a�Division by 0.

    This occurs and signals division-by-zero if division of a finite number
    by zero was attempted (during a divide-integer or divide operation, or a
    power operation with negative right-hand operand), and the dividend was
    not zero.

    The result of the operation is [sign,inf], where sign is the exclusive
    or of the signs of the operands for divide, or is 1 for an odd power of
    -0, for power.
    cGst|S)N)�_SignedInfinity)r.r/�signr(r'r'r)r0szDivisionByZero.handleN)r1r2r3r4r0r'r'r'r)r
sc@seZdZdZdd�ZdS)rz�Cannot perform the division adequately.

    This occurs and signals invalid-operation if the integer result of a
    divide-integer or remainder operation had too many digits (would be
    longer than precision).  The result is [0,qNaN].
    cGstS)N)r:)r.r/r(r'r'r)r0szDivisionImpossible.handleN)r1r2r3r4r0r'r'r'r)rsc@seZdZdZdd�ZdS)rz�Undefined result of division.

    This occurs and signals invalid-operation if division by zero was
    attempted (during a divide-integer, divide, or remainder operation), and
    the dividend is also zero.  The result is [0,qNaN].
    cGstS)N)r:)r.r/r(r'r'r)r0)szDivisionUndefined.handleN)r1r2r3r4r0r'r'r'r)r!sc@seZdZdZdS)ra�Had to round, losing information.

    This occurs and signals inexact whenever the result of an operation is
    not exact (that is, it needed to be rounded and any discarded digits
    were non-zero), or if an overflow or underflow condition occurs.  The
    result in all cases is unchanged.

    The inexact signal may be tested (or trapped) to determine if a given
    operation (or sequence of operations) was inexact.
    N)r1r2r3r4r'r'r'r)r,s
c@seZdZdZdd�ZdS)ra�Invalid context.  Unknown rounding, for example.

    This occurs and signals invalid-operation if an invalid context was
    detected during an operation.  This can occur if contexts are not checked
    on creation and either the precision exceeds the capability of the
    underlying concrete representation or an unknown or unsupported rounding
    was specified.  These aspects of the context need only be checked when
    the values are required to be used.  The result is [0,qNaN].
    cGstS)N)r:)r.r/r(r'r'r)r0CszInvalidContext.handleN)r1r2r3r4r0r'r'r'r)r8s	c@seZdZdZdS)ra�Number got rounded (not  necessarily changed during rounding).

    This occurs and signals rounded whenever the result of an operation is
    rounded (that is, some zero or non-zero digits were discarded from the
    coefficient), or if an overflow or underflow condition occurs.  The
    result in all cases is unchanged.

    The rounded signal may be tested (or trapped) to determine if a given
    operation (or sequence of operations) caused a loss of precision.
    N)r1r2r3r4r'r'r'r)rFs
c@seZdZdZdS)r
a�Exponent < Emin before rounding.

    This occurs and signals subnormal whenever the result of a conversion or
    operation is subnormal (that is, its adjusted exponent is less than
    Emin, before any rounding).  The result in all cases is unchanged.

    The subnormal signal may be tested (or trapped) to determine if a given
    or operation (or sequence of operations) yielded a subnormal result.
    N)r1r2r3r4r'r'r'r)r
Rs	c@seZdZdZdd�ZdS)raNumerical overflow.

    This occurs and signals overflow if the adjusted exponent of a result
    (from a conversion or from an operation that is not an attempt to divide
    by zero), after rounding, would be greater than the largest value that
    can be handled by the implementation (the value Emax).

    The result depends on the rounding mode:

    For round-half-up and round-half-even (and for round-half-down and
    round-up, if implemented), the result of the operation is [sign,inf],
    where sign is the sign of the intermediate result.  For round-down, the
    result is the largest finite number that can be represented in the
    current precision, with the sign of the intermediate result.  For
    round-ceiling, the result is the same as for round-down if the sign of
    the intermediate result is 1, or is [0,inf] otherwise.  For round-floor,
    the result is the same as for round-down if the sign of the intermediate
    result is 0, or is [1,inf] otherwise.  In all cases, Inexact and Rounded
    will also be raised.
    cGs�|jttttfkrt|S|dkrR|jtkr4t|St|d|j|j	|jd�S|dkr�|jt
krlt|St|d|j|j	|jd�SdS)Nr%�9r-)�roundingrrrrr<rr6�prec�Emaxr)r.r/r=r(r'r'r)r0ss


zOverflow.handleN)r1r2r3r4r0r'r'r'r)r]sc@seZdZdZdS)raxNumerical underflow with result rounded to 0.

    This occurs and signals underflow if a result is inexact and the
    adjusted exponent of the result would be smaller (more negative) than
    the smallest value that can be handled by the implementation (the value
    Emin).  That is, the result is both inexact and subnormal.

    The result after an underflow will be a subnormal number rounded, if
    necessary, so that its exponent is not less than Etiny.  This may result
    in 0 with the sign of the intermediate result and an exponent of Etiny.

    In all cases, Inexact, Rounded, and Subnormal will also be raised.
    N)r1r2r3r4r'r'r'r)r�s
c@seZdZdZdS)ra�Enable stricter semantics for mixing floats and Decimals.

    If the signal is not trapped (default), mixing floats and Decimals is
    permitted in the Decimal() constructor, context.create_decimal() and
    all comparison operators. Both conversion and comparisons are exact.
    Any occurrence of a mixed operation is silently recorded by setting
    FloatOperation in the context flags.  Explicit conversions with
    Decimal.from_float() or context.create_decimal_from_float() do not
    set the flag.

    Otherwise (the signal is trapped), only equality comparisons and explicit
    conversions are silent. All other mixed operations raise FloatOperation.
    N)r1r2r3r4r'r'r'r)r�s
c@seZdZefdd�ZdS)�
MockThreadingcCs
|jtS)N)�modules�	__xname__)r.�sysr'r'r)�local�szMockThreading.localN)r1r2r3rErFr'r'r'r)rB�srB�__decimal_context__cCs,|tttfkr|j�}|j�|tj�_dS)z%Set this thread's context to context.N)rrr�copy�clear_flags�	threading�current_threadrG)r/r'r'r)r�scCs4y
tj�jStk
r.t�}|tj�_|SXdS)z�Returns this thread's context.

        If this thread does not yet have a context, returns
        a new context and sets this thread's context.
        New contexts are copies of DefaultContext.
        N)rJrKrG�AttributeErrorr)r/r'r'r)r�s

cCs,y|jStk
r&t�}||_|SXdS)z�Returns this thread's context.

        If this thread does not yet have a context, returns
        a new context and sets this thread's context.
        New contexts are copies of DefaultContext.
        N)rGrLr)�_localr/r'r'r)r�scCs(|tttfkr|j�}|j�||_dS)z%Set this thread's context to context.N)rrrrHrIrG)r/rMr'r'r)r�scCs|dkrt�}t|�S)abReturn a context manager for a copy of the supplied context

    Uses a copy of the current context if no context is specified
    The returned context manager creates a local decimal context
    in a with statement:
        def sin(x):
             with localcontext() as ctx:
                 ctx.prec += 2
                 # Rest of sin calculation algorithm
                 # uses a precision 2 greater than normal
             return +s  # Convert result to normal precision

         def sin(x):
             with localcontext(ExtendedContext):
                 # Rest of sin calculation algorithm
                 # uses the Extended Context from the
                 # General Decimal Arithmetic Specification
             return +s  # Convert result to normal context

    >>> setcontext(DefaultContext)
    >>> print(getcontext().prec)
    28
    >>> with localcontext():
    ...     ctx = getcontext()
    ...     ctx.prec += 2
    ...     print(ctx.prec)
    ...
    30
    >>> with localcontext(ExtendedContext):
    ...     print(getcontext().prec)
    ...
    9
    >>> print(getcontext().prec)
    28
    N)r�_ContextManager)Zctxr'r'r)r�s$c
@s�eZdZdZd�Zd�dd	�Zed
d��Zdd
�Zdd�Z	d�dd�Z
dd�Zdd�Zdd�Z
d�dd�Zd�dd�Zd�dd�Zd�dd�Zd�d d!�Zd�d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd�d-d.�Zd�d/d0�Z�dd1d2�Z�dd3d4�Z�dd6d7�Z�dd8d9�ZeZ�dd:d;�Z�dd<d=�Z �dd>d?�Z!e!Z"�dd@dA�Z#dBdC�Z$�ddDdE�Z%�d	dFdG�Z&�d
dHdI�Z'�ddJdK�Z(�ddLdM�Z)�d
dNdO�Z*�ddPdQ�Z+�ddRdS�Z,dTdU�Z-dVdW�Z.e.Z/dXdY�Z0e1e0�Z0dZd[�Z2e1e2�Z2d\d]�Z3d^d_�Z4d`da�Z5dbdc�Z6ddde�Z7dfdg�Z8dhdi�Z9djdk�Z:dldm�Z;dndo�Z<dpdq�Z=drds�Z>e?e7e8e9e:e;e<e=e>dt�Z@�ddudv�ZAdwdx�ZBdydz�ZC�dd{d|�ZD�dd}d~�ZEdd��ZF�dd�d��ZG�dd�d��ZH�dd�d��ZI�dd�d��ZJ�dd�d��ZKd�d��ZLd�d��ZM�dd�d��ZN�dd�d��ZOeOZP�dd�d��ZQ�dd�d��ZR�dd�d��ZSd�d��ZTd�d��ZUd�d��ZVd�d��ZW�dd�d��ZX�dd�d��ZY�dd�d��ZZd�d��Z[d�d��Z\�d d�d��Z]�d!d�d��Z^d�d��Z_d�d��Z`d�d��Zad�d��Zb�d"d�d��Zcd�d��Zdd�d��Zed�d��Zf�d#d�d��Zgd�d„Zhd�dĄZi�d$d�dƄZjd�dȄZk�d%d�dʄZl�d&d�d̄Zmd�d΄Znd�dЄZo�d'd�d҄Zp�d(d�dԄZq�d)d�dքZr�d*d�d؄Zs�d+d�dڄZt�d,d�d܄Zu�d-d�dބZv�d.d�d�Zw�d/d�d�Zx�d0d�d�Zyd�d�Zz�d1d�d�Z{�d2d�d�Z|�d3d�d�Z}d�d�Z~d�d�Zd�d�Z��d4d�d�Z�dS(5rz,Floating point class for decimal arithmetic.�_expr8r7�_is_special�0NcCs�tj|�}t|t��r$t|j�jdd��}|dkrP|dkr@t�}|jt	d|�S|j
d�dkrfd|_nd|_|j
d	�}|dk	r�|j
d
�p�d}t|j
d�p�d�}tt||��|_
|t|�|_d
|_nZ|j
d�}|dk	�rtt|p�d��jd�|_
|j
d��rd|_nd|_nd|_
d|_d|_|St|t��rf|dk�rBd|_nd|_d|_tt|��|_
d
|_|St|t��r�|j|_|j|_|j
|_
|j|_|St|t��r�|j|_t|j�|_
t|j�|_d
|_|St|ttf��r&t|�dk�r�td��t|dt��o|ddk�std��|d|_|ddk�rHd|_
|d|_d|_n�g}	x^|dD]R}
t|
t��r�d|
k�ozdkn�r�|	�s�|
dk�r�|	j|
�ntd���qVW|ddk�r�djtt|	��|_
|d|_d|_nDt|dt��rdjtt|	�pdg��|_
|d|_d
|_ntd��|St|t��r||dk�rBt�}|jtd�tj|�}|j|_|j|_|j
|_
|j|_|St d|��dS)a�Create a decimal point instance.

        >>> Decimal('3.14')              # string input
        Decimal('3.14')
        >>> Decimal((0, (3, 1, 4), -2))  # tuple (sign, digit_tuple, exponent)
        Decimal('3.14')
        >>> Decimal(314)                 # int
        Decimal('314')
        >>> Decimal(Decimal(314))        # another decimal instance
        Decimal('314')
        >>> Decimal('  3.14  \n')        # leading and trailing whitespace okay
        Decimal('3.14')
        �_�NzInvalid literal for Decimal: %rr=�-r-r%�intZfrac�exprQF�diag�signal�Nr5�FT�ztInvalid tuple size in creation of Decimal from list or tuple.  The list or tuple should have exactly three elements.z|Invalid sign.  The first value in the tuple should be an integer; either 0 for a positive number or 1 for a negative number.r+�	zTThe second value in the tuple must be composed of integers in the range 0 through 9.zUThe third value in the tuple must be an integer, or one of the strings 'F', 'n', 'N'.z;strict semantics for mixing floats and Decimals are enabledzCannot convert %r to Decimal)r%r-)r5rY)!�object�__new__�
isinstance�str�_parser�strip�replacer�_raise_errorr�groupr7rUr8�lenrOrP�lstrip�absr�_WorkRepr=rV�list�tuple�
ValueError�append�join�map�floatr�
from_float�	TypeError)�cls�valuer/r.�m�intpart�fracpartrVrW�digitsZdigitr'r'r)r^4s�







(



zDecimal.__new__cCs�t|t�r||�St|t�s$td��tj|�s8tj|�rD|t|��Stjd|�dkrZd}nd}t	|�j
�\}}|j�d}t|t
|d|�|�}|tkr�|S||�SdS)a.Converts a float to a decimal number, exactly.

        Note that Decimal.from_float(0.1) is not the same as Decimal('0.1').
        Since 0.1 is not exactly representable in binary floating point, the
        value is stored as the nearest representable value which is
        0x1.999999999999ap-4.  The exact equivalent of the value in decimal
        is 0.1000000000000000055511151231257827021181583404541015625.

        >>> Decimal.from_float(0.1)
        Decimal('0.1000000000000000055511151231257827021181583404541015625')
        >>> Decimal.from_float(float('nan'))
        Decimal('NaN')
        >>> Decimal.from_float(float('inf'))
        Decimal('Infinity')
        >>> Decimal.from_float(-float('inf'))
        Decimal('-Infinity')
        >>> Decimal.from_float(-0.0)
        Decimal('-0')

        zargument must be int or float.g�?r%r-�N)r_rUrprr�_mathZisinfZisnan�reprZcopysignrh�as_integer_ratio�
bit_lengthr6r`r)rs�fr=r5�d�k�resultr'r'r)rq�s

zDecimal.from_floatcCs(|jr$|j}|dkrdS|dkr$dSdS)zrReturns whether the number is not actually one.

        0 if a number
        1 if NaN
        2 if sNaN
        r5r-rYr+r%)rPrO)r.rVr'r'r)�_isnan�szDecimal._isnancCs|jdkr|jrdSdSdS)zyReturns whether the number is infinite

        0 if finite or not a number
        1 if +INF
        -1 if -INF
        rZr-r%���)rOr7)r.r'r'r)�_isinfinitys

zDecimal._isinfinitycCs||j�}|dkrd}n|j�}|s&|rx|dkr4t�}|dkrJ|jtd|�S|dkr`|jtd|�S|rn|j|�S|j|�SdS)z�Returns whether the number is not actually one.

        if self, other are sNaN, signal
        if self, other are NaN return nan
        return 0

        Done before operations.
        NFr+�sNaNr%)r�rrdr	r9)r.�otherr/�self_is_nan�other_is_nanr'r'r)�_check_nanss"


zDecimal._check_nanscCsv|dkrt�}|js|jrr|j�r0|jtd|�S|j�rF|jtd|�S|j�r\|jtd|�S|j�rr|jtd|�SdS)aCVersion of _check_nans used for the signaling comparisons
        compare_signal, __le__, __lt__, __ge__, __gt__.

        Signal InvalidOperation if either self or other is a (quiet
        or signaling) NaN.  Signaling NaNs take precedence over quiet
        NaNs.

        Return 0 if neither operand is a NaN.

        Nzcomparison involving sNaNzcomparison involving NaNr%)rrP�is_snanrdr	�is_qnan)r.r�r/r'r'r)�_compare_check_nans.s(zDecimal._compare_check_nanscCs|jp|jdkS)zuReturn True if self is nonzero; otherwise return False.

        NaNs and infinities are considered nonzero.
        rQ)rPr8)r.r'r'r)�__bool__OszDecimal.__bool__cCs|js|jr8|j�}|j�}||kr(dS||kr4dSdS|sP|sDdSd|jS|s^d|jS|j|jkrndS|j|jkr~dS|j�}|j�}||k�r�|jd|j|j}|jd|j|j}||kr�dS||kr�d	|jSd
|jSn ||k�rd|jSd|jSdS)
z�Compare the two non-NaN decimal instances self and other.

        Returns -1 if self < other, 0 if self == other and 1
        if self > other.  This routine is for internal use only.r%r-rQNr�r�r�r�r�r�r�r�)rPr�r7�adjustedr8rO)r.r�Zself_infZ	other_inf�
self_adjustedZother_adjusted�self_paddedZother_paddedr'r'r)�_cmpVs>



zDecimal._cmpcCs<t||dd�\}}|tkr|S|j||�r.dS|j|�dkS)NT)�equality_opFr%)�_convert_for_comparison�NotImplementedr�r�)r.r�r/r'r'r)�__eq__�szDecimal.__eq__cCs<t||�\}}|tkr|S|j||�}|r.dS|j|�dkS)NFr%)r�r�r�r�)r.r�r/r;r'r'r)�__lt__�szDecimal.__lt__cCs<t||�\}}|tkr|S|j||�}|r.dS|j|�dkS)NFr%)r�r�r�r�)r.r�r/r;r'r'r)�__le__�szDecimal.__le__cCs<t||�\}}|tkr|S|j||�}|r.dS|j|�dkS)NFr%)r�r�r�r�)r.r�r/r;r'r'r)�__gt__�szDecimal.__gt__cCs<t||�\}}|tkr|S|j||�}|r.dS|j|�dkS)NFr%)r�r�r�r�)r.r�r/r;r'r'r)�__ge__�szDecimal.__ge__cCs>t|dd�}|js|r0|jr0|j||�}|r0|St|j|��S)z�Compare self to other.  Return a decimal value:

        a or b is a NaN ==> Decimal('NaN')
        a < b           ==> Decimal('-1')
        a == b          ==> Decimal('0')
        a > b           ==> Decimal('1')
        T)�raiseit)�_convert_otherrPr�rr�)r.r�r/r;r'r'r)�compare�szDecimal.comparecCs�|jr4|j�rtd��n|j�r$tS|jr0tStS|jdkrNtd|jt	�}ntt
|jt	�}t|j�|t	}|dkr||n|}|dkr�dS|S)zx.__hash__() <==> hash(x)z"Cannot hash a signaling NaN value.r%�
r-r+r����)
rPr�rr�is_nan�_PyHASH_NANr7�_PyHASH_INFrO�pow�_PyHASH_MODULUS�
_PyHASH_10INVrUr8)r.Zexp_hashZhash_r;r'r'r)�__hash__�s

zDecimal.__hash__cCst|jttt|j��|j�S)zeRepresents the number as a triple tuple.

        To show the internals exactly as they are.
        )rr7rkrorUr8rO)r.r'r'r)�as_tuple�szDecimal.as_tuplecCs�|jr |j�rtd��ntd��|s(dSt|j�}|jdkrR|d|jd}}nr|j}x(|dkr�|ddkr�|d}|d8}q\W|j}t||@j�d|�}|r�||L}||8}d||>}|j	r�|}||fS)a�Express a finite Decimal instance in the form n / d.

        Returns a pair (n, d) of integers.  When called on an infinity
        or NaN, raises OverflowError or ValueError respectively.

        >>> Decimal('3.14').as_integer_ratio()
        (157, 50)
        >>> Decimal('-123e5').as_integer_ratio()
        (-12300000, 1)
        >>> Decimal('0.00').as_integer_ratio()
        (0, 1)

        z#cannot convert NaN to integer ratioz(cannot convert Infinity to integer ratior%r-r�ry)r%r-)
rPr�rl�
OverflowErrorrUr8rO�minr}r7)r.r5rZd5Zd2Zshift2r'r'r)r|�s,


zDecimal.as_integer_ratiocCsdt|�S)z0Represents the number as an instance of Decimal.z
Decimal('%s'))r`)r.r'r'r)�__repr__'szDecimal.__repr__Fc	Csdddg|j}|jrL|jdkr&|dS|jdkr>|d|jS|d|jS|jt|j�}|jdkrt|dkrt|}n6|s~d
}n,|jdkr�|d
dd
}n|d
dd
}|dkr�d}d
d||j}nN|t|j�k�r�|jd|t|j�}d}n |jd|�}d
|j|d�}||k�r*d}n*|dk�r:t�}ddg|jd||}||||S)z�Return string representation of the number in scientific notation.

        Captures all of the information in the underlying representation.
        rSrTrZZInfinityr5�NaNr�r%�r-rQr[�.N�e�Ez%+di����)r7rPrOr8rfr�capitals)	r.�engr/r=�
leftdigits�dotplacervrwrVr'r'r)�__str__,s:




zDecimal.__str__cCs|jd|d�S)a,Convert to a string, using engineering notation if an exponent is needed.

        Engineering notation has an exponent which is a multiple of 3.  This
        can leave up to 3 digits to the left of the decimal place and may
        require the addition of either one or two trailing zeros.
        T)r�r/)r�)r.r/r'r'r)�
to_eng_string`szDecimal.to_eng_stringcCsT|jr|j|d�}|r|S|dkr(t�}|rB|jtkrB|j�}n|j�}|j|�S)zRReturns a copy with the sign switched.

        Rounds, if it has reason.
        )r/N)rPr�rr?r�copy_abs�copy_negate�_fix)r.r/r;r'r'r)�__neg__is
zDecimal.__neg__cCsT|jr|j|d�}|r|S|dkr(t�}|rB|jtkrB|j�}nt|�}|j|�S)zhReturns a copy, unless it is a sNaN.

        Rounds the number (if more than precision digits)
        )r/N)rPr�rr?rr�rr�)r.r/r;r'r'r)�__pos__s
zDecimal.__pos__TcCsJ|s|j�S|jr&|j|d�}|r&|S|jr:|j|d�}n|j|d�}|S)z�Returns the absolute value of self.

        If the keyword argument 'round' is false, do not round.  The
        expression self.__abs__(round=False) is equivalent to
        self.copy_abs().
        )r/)r�rPr�r7r�r�)r.�roundr/r;r'r'r)�__abs__�szDecimal.__abs__c
Cslt|�}|tkr|S|dkr"t�}|js.|jr�|j||�}|rB|S|j�rr|j|jkrj|j�rj|jtd�St	|�S|j�r�t	|�St
|j|j�}d}|jt
kr�|j|jkr�d}|r�|r�t
|j|j�}|r�d}t|d|�}|j|�}|S|�s"t||j|jd�}|j||j�}|j|�}|S|�sZt||j|jd�}|j||j�}|j|�}|St|�}t|�}t|||j�\}}t�}	|j|jk�r�|j|jk�r�t|d|�}|j|�}|S|j|jk�r�||}}|jdk�r�d|	_|j|j|_|_nd|	_n&|jdk�rd|	_d\|_|_nd|	_|jdk�r@|j|j|	_n|j|j|	_|j|	_t	|	�}|j|�}|S)zbReturns self + other.

        -INF + INF (or the reverse) cause InvalidOperation errors.
        Nz
-INF + INFr%r-rQ)r%r%)r�r�rrPr�r�r7rdr	rr�rOr?rr6r��maxr@�_rescaleri�
_normalizer=rUrV)
r.r�r/r;rVZnegativezeror=�op1�op2r�r'r'r)�__add__�s|





zDecimal.__add__cCsHt|�}|tkr|S|js |jr6|j||d�}|r6|S|j|j�|d�S)zReturn self - other)r/)r�r�rPr�r�r�)r.r�r/r;r'r'r)�__sub__szDecimal.__sub__cCs"t|�}|tkr|S|j||d�S)zReturn other - self)r/)r�r�r�)r.r�r/r'r'r)�__rsub__szDecimal.__rsub__cCsDt|�}|tkr|S|dkr"t�}|j|jA}|js:|jr�|j||�}|rN|S|j�rn|sf|jtd�St	|S|j�r�|s�|jtd�St	|S|j
|j
}|s�|r�t|d|�}|j|�}|S|j
dkr�t||j
|�}|j|�}|S|j
dk�rt||j
|�}|j|�}|St|�}t|�}t|t|j|j�|�}|j|�}|S)z\Return self * other.

        (+-) INF * 0 (or its reverse) raise InvalidOperation.
        Nz(+-)INF * 0z0 * (+-)INFrQ�1)r�r�rr7rPr�r�rdr	r<rOr6r�r8rir`rU)r.r�r/Z
resultsignr;Z	resultexpr�r�r'r'r)�__mul__sH




zDecimal.__mul__cCs�t|�}|tkrtS|dkr"t�}|j|jA}|js:|jr�|j||�}|rN|S|j�rj|j�rj|jtd�S|j�rzt	|S|j�r�|jt
d�t|d|j��S|s�|s�|jt
d�S|jtd|�S|s�|j|j}d}n�t|j�t|j�|jd}|j|j|}t|�}t|�}	|dk�r:t|jd	||	j�\}}
nt|j|	jd	|�\}}
|
�rt|d
dk�r�|d7}n<|j|j}x.||k�r�|d	dk�r�|d	}|d7}�q�Wt|t|�|�}|j|�S)zReturn self / other.Nz(+-)INF/(+-)INFzDivision by infinityrQz0 / 0zx / 0r%r-r�ry)r�r�rr7rPr�r�rdr	r<rr6�Etinyrr
rOrfr8r@ri�divmodrUr`r�)r.r�r/r=r;rV�coeff�shiftr�r��	remainder�	ideal_expr'r'r)�__truediv__QsP

zDecimal.__truediv__cCs |j|jA}|j�r|j}nt|j|j�}|j�|j�}|sP|j�sP|dkrjt|dd�|j||j�fS||jk�rt	|�}t	|�}|j
|j
kr�|jd|j
|j
9_n|jd|j
|j
9_t|j|j�\}}	|d|jk�rt|t
|�d�t|jt
|	�|�fS|jtd�}
|
|
fS)z�Return (self // other, self % other), to context.prec precision.

        Assumes that neither self nor other is a NaN, that self is not
        infinite and that other is nonzero.
        r+rQr%r�z%quotient too large in //, % or divmodr�)r7r�rOr�r�r6r�r?r@rirVrUr�r`rdr)r.r�r/r=r��expdiffr�r��q�rr;r'r'r)�_divide�s*
zDecimal._dividecCs"t|�}|tkr|S|j||d�S)z)Swaps self/other and returns __truediv__.)r/)r�r�r�)r.r�r/r'r'r)�__rtruediv__�szDecimal.__rtruediv__cCs�t|�}|tkr|S|dkr"t�}|j||�}|r:||fS|j|jA}|j�r~|j�rj|jtd�}||fSt||jtd�fS|s�|s�|jt	d�}||fS|jt
d|�|jtd�fS|j||�\}}|j|�}||fS)z6
        Return (self // other, self % other)
        Nzdivmod(INF, INF)zINF % xzdivmod(0, 0)zx // 0zx % 0)
r�r�rr�r7r�rdr	r<rr
r�r�)r.r�r/r;r=Zquotientr�r'r'r)�
__divmod__�s0
zDecimal.__divmod__cCs"t|�}|tkr|S|j||d�S)z(Swaps self/other and returns __divmod__.)r/)r�r�r�)r.r�r/r'r'r)�__rdivmod__�szDecimal.__rdivmod__cCs�t|�}|tkr|S|dkr"t�}|j||�}|r6|S|j�rJ|jtd�S|sj|r^|jtd�S|jtd�S|j||�d}|j	|�}|S)z
        self % other
        NzINF % xzx % 0z0 % 0r-)
r�r�rr�r�rdr	rr�r�)r.r�r/r;r�r'r'r)�__mod__�s"
zDecimal.__mod__cCs"t|�}|tkr|S|j||d�S)z%Swaps self/other and returns __mod__.)r/)r�r�r�)r.r�r/r'r'r)�__rmod__�szDecimal.__rmod__cCs�|dkrt�}t|dd�}|j||�}|r.|S|j�rB|jtd�S|sb|rV|jtd�S|jtd�S|j�r|t|�}|j|�St	|j
|j
�}|s�t|jd|�}|j|�S|j
�|j
�}||jdkr�|jt�S|dkr�|j||j�}|j|�St|�}t|�}|j|jk�r(|jd
|j|j9_n|jd
|j|j9_t|j|j�\}}	d	|	|d@|jk�r~|	|j8}	|d7}|d
|jk�r�|jt�S|j}
|	dk�r�d|
}
|	}	t|
t|	�|�}|j|�S)
zI
        Remainder nearest to 0-  abs(remainder-near) <= other/2
        NT)r�zremainder_near(infinity, x)zremainder_near(x, 0)zremainder_near(0, 0)rQr-r+r�r%r�)rr�r�r�rdr	rrr�r�rOr6r7r�r@rr�r?rirVrUr�r`)r.r�r/r;�ideal_exponentr�r�r�r�r�r=r'r'r)�remainder_nearsZ






zDecimal.remainder_nearcCs�t|�}|tkr|S|dkr"t�}|j||�}|r6|S|j�rb|j�rR|jtd�St|j|jAS|s�|r�|jt	d|j|jA�S|jt
d�S|j||�dS)z
self // otherNz
INF // INFzx // 0z0 // 0r%)r�r�rr�r�rdr	r<r7r
rr�)r.r�r/r;r'r'r)�__floordiv__Ls$zDecimal.__floordiv__cCs"t|�}|tkr|S|j||d�S)z*Swaps self/other and returns __floordiv__.)r/)r�r�r�)r.r�r/r'r'r)�
__rfloordiv__hszDecimal.__rfloordiv__cCs8|j�r(|j�rtd��|jr"dnd}nt|�}t|�S)zFloat representation.z%Cannot convert signaling NaN to floatz-nan�nan)r�r�rlr7r`rp)r.�sr'r'r)�	__float__oszDecimal.__float__cCst|jr(|j�rtd��n|j�r(td��d|j}|jdkrT|t|j�d|jS|t|jd|j�pjd�SdS)	z1Converts self to an int, truncating if necessary.zCannot convert NaN to integerz"Cannot convert infinity to integerr-r%r�NrQr�)	rPr�rlr�r�r7rOrUr8)r.r�r'r'r)�__int__ys


zDecimal.__int__cCs|S)Nr')r.r'r'r)�real�szDecimal.realcCstd�S)Nr%)r)r.r'r'r)�imag�szDecimal.imagcCs|S)Nr')r.r'r'r)�	conjugate�szDecimal.conjugatecCstt|��S)N)�complexrp)r.r'r'r)�__complex__�szDecimal.__complex__cCsR|j}|j|j}t|�|krJ|t|�|d�jd�}t|j||jd�St|�S)z2Decapitate the payload of a NaN to fit the contextNrQT)	r8r@�clamprfrgr6r7rOr)r.r/ZpayloadZmax_payload_lenr'r'r)r9�szDecimal._fix_nancCsX|jr |j�r|j|�St|�S|j�}|j�}|s�|j|g|j}tt	|j
|�|�}||j
krx|jt�t
|jd|�St|�St|j�|j
|j}||kr�|jtd|j�}|jt�|jt�|S||k}|r�|}|j
|k�r�t|j�|j
|}	|	dk�rt
|jd|d�}d}	|j|j}
|
||	�}|jd|	��p>d}|dk�r~tt|�d�}t|�|jk�r~|dd�}|d7}||k�r�|jtd|j�}nt
|j||�}|�r�|�r�|jt�|�r�|jt�|�r�|jt�|jt�|�s�|jt�|S|�r|jt�|jdk�rP|j
|k�rP|jt�|jd|j
|}
t
|j|
|�St|�S)z�Round if it is necessary to keep self within prec precision.

        Rounds and fixes the exponent.  Does not raise on a sNaN.

        Arguments:
        self - Decimal instance
        context - context used.
        rQz
above Emaxr%r�r-Nr�)rPr�r9rr��EtoprAr�r�r�rOrdrr6r7rfr8r@rrr�_pick_rounding_functionr?r`rUrr
)r.r/r�r��exp_maxZnew_expZexp_minr;Zself_is_subnormalrxZrounding_method�changedr�r�r'r'r)r��sn
















zDecimal._fixcCst|j|�rdSdSdS)z(Also known as round-towards-0, truncate.r%r-Nr�)�
_all_zerosr8)r.r@r'r'r)�_round_downszDecimal._round_downcCs|j|�S)zRounds away from 0.)r�)r.r@r'r'r)�	_round_upszDecimal._round_upcCs*|j|dkrdSt|j|�r"dSdSdS)zRounds 5 up (away from 0)Z56789r-r%Nr�)r8r�)r.r@r'r'r)�_round_half_ups
zDecimal._round_half_upcCst|j|�rdS|j|�SdS)zRound 5 downr-Nr�)�_exact_halfr8r�)r.r@r'r'r)�_round_half_downszDecimal._round_half_downcCs8t|j|�r*|dks&|j|ddkr*dS|j|�SdS)z!Round 5 to even, rest to nearest.r%r-�02468Nr�)r�r8r�)r.r@r'r'r)�_round_half_even#szDecimal._round_half_evencCs |jr|j|�S|j|�SdS)z(Rounds up (not away from 0 if negative.)N)r7r�)r.r@r'r'r)�_round_ceiling+s
zDecimal._round_ceilingcCs |js|j|�S|j|�SdS)z'Rounds down (not towards 0 if negative)N)r7r�)r.r@r'r'r)�_round_floor2s
zDecimal._round_floorcCs0|r |j|ddkr |j|�S|j|�SdS)z)Round down unless digit prec-1 is 0 or 5.r-Z05N)r8r�)r.r@r'r'r)�_round_05up9s
zDecimal._round_05up)rrrrrrrrcCsb|dk	r2t|t�std��tdd|�}|j|�S|jrR|j�rJtd��ntd��t|j	dt
��S)a�Round self to the nearest integer, or to a given precision.

        If only one argument is supplied, round a finite Decimal
        instance self to the nearest integer.  If self is infinite or
        a NaN then a Python exception is raised.  If self is finite
        and lies exactly halfway between two integers then it is
        rounded to the integer with even last digit.

        >>> round(Decimal('123.456'))
        123
        >>> round(Decimal('-456.789'))
        -457
        >>> round(Decimal('-3.0'))
        -3
        >>> round(Decimal('2.5'))
        2
        >>> round(Decimal('3.5'))
        4
        >>> round(Decimal('Inf'))
        Traceback (most recent call last):
          ...
        OverflowError: cannot round an infinity
        >>> round(Decimal('NaN'))
        Traceback (most recent call last):
          ...
        ValueError: cannot round a NaN

        If a second argument n is supplied, self is rounded to n
        decimal places using the rounding mode for the current
        context.

        For an integer n, round(self, -n) is exactly equivalent to
        self.quantize(Decimal('1En')).

        >>> round(Decimal('123.456'), 0)
        Decimal('123')
        >>> round(Decimal('123.456'), 2)
        Decimal('123.46')
        >>> round(Decimal('123.456'), -2)
        Decimal('1E+2')
        >>> round(Decimal('-Infinity'), 37)
        Decimal('NaN')
        >>> round(Decimal('sNaN123'), 0)
        Decimal('NaN123')

        Nz+Second argument to round should be integralr%r�zcannot round a NaNzcannot round an infinity)r_rUrrr6�quantizerPr�rlr�r�r)r.r5rVr'r'r)�	__round__Ks/


zDecimal.__round__cCs0|jr |j�rtd��ntd��t|jdt��S)z�Return the floor of self, as an integer.

        For a finite Decimal instance self, return the greatest
        integer n such that n <= self.  If self is infinite or a NaN
        then a Python exception is raised.

        zcannot round a NaNzcannot round an infinityr%)rPr�rlr�rUr�r)r.r'r'r)�	__floor__�s

zDecimal.__floor__cCs0|jr |j�rtd��ntd��t|jdt��S)z�Return the ceiling of self, as an integer.

        For a finite Decimal instance self, return the least integer n
        such that n >= self.  If self is infinite or a NaN then a
        Python exception is raised.

        zcannot round a NaNzcannot round an infinityr%)rPr�rlr�rUr�r)r.r'r'r)�__ceil__�s

zDecimal.__ceil__cCst|dd�}t|dd�}|js$|jr�|dkr2t�}|jdkrJ|jtd|�S|jdkrb|jtd|�S|jdkrr|}nf|jdkr�|}nV|jdkr�|s�|jtd�St|j|jA}n*|jdkr�|s�|jtd	�St|j|jA}n0t|j|jAt	t
|j�t
|j��|j|j�}|j||�S)
a:Fused multiply-add.

        Returns self*other+third with no rounding of the intermediate
        product self*other.

        self and other are multiplied together, with no rounding of
        the result.  The third operand is then added to the result,
        and a single final rounding is performed.
        T)r�NrYr�r5rZzINF * 0 in fmaz0 * INF in fma)
r�rPrrOrdr	r<r7r6r`rUr8r�)r.r�Zthirdr/�productr'r'r)�fma�s6





zDecimal.fmacCs�t|�}|tkr|St|�}|tkr(|S|dkr6t�}|j�}|j�}|j�}|sZ|sZ|r�|dkrp|jtd|�S|dkr�|jtd|�S|dkr�|jtd|�S|r�|j|�S|r�|j|�S|j|�S|j�o�|j�o�|j�s�|jtd�S|dkr�|jtd�S|�s|jtd�S|j�|j	k�r(|jtd�S|�rD|�rD|jtd	�S|j
��rTd}n|j}tt
|��}t|j��}t|j��}	|j
|td
|j|�|}x t|	j�D]}
t|d
|�}�q�Wt||	j
|�}t|t|�d�S)z!Three argument version of __pow__Nr+r�z@pow() 3rd argument not allowed unless all arguments are integersr%zApow() 2nd argument cannot be negative when 3rd argument specifiedzpow() 3rd argument cannot be 0zSinsufficient precision: pow() 3rd argument must not have more than precision digitszXat least one of pow() 1st argument and 2nd argument must be nonzero; 0**0 is not definedr�)r�r�rr�rdr	r9�
_isintegerr�r@�_isevenr7rhrUri�to_integral_valuer�rV�ranger6r`)r.r��modulor/r�r�Z
modulo_is_nanr=�base�exponent�ir'r'r)�
_power_modulo�sl



zDecimal._power_modulocCst|�}|j|j}}x |ddkr6|d}|d7}qWt|�}|j|j}}x |ddkrn|d}|d7}qPW|dk�r||9}x |ddkr�|d}|d7}q�W|dkr�dS|d|}	|jdkr�|	}	|j�o�|jdk�r|jt|�}
t|	|
|d�}nd}tddd||	|�S|jdk�r�|d}|dk�r�||@|k�rPdSt	|�d}
|dd}|t
t|��k�r~dSt|
||�}
t|||�}|
dk�s�|dk�r�dS|
|k�r�dSd
|
}n�|d
k�r�t	|�dd}
t
d
|
|�\}}|�rdSx$|d
dk�r$|d
}|
d8}
�qW|dd}|t
t|��k�rHdSt|
||�}
t|||�}|
dk�sx|dk�r|dS|
|k�r�dSd|
}ndS|d|k�r�dS|
|}tdt|�|�S|dk�r�|d|d}}n�|dk�rt
tt||���|k�rdSt	|�}|dk�r>t
tt|�|��|k�r>dS|d|}}x:|d|dk�oldkn�r�|d}|d}�qPWx:|d
|d
k�o�dkn�r�|d
}|d
}�q�W|dk�rt|dk�r�||k�r�dSt
||�\}}|dk�rdSdt	|�|>}x>t
|||d�\}}||k�r>Pn||d||}�qW||k�oh|dk�spdS|}|dk�r�||dt|�k�r�dS||}||9}|d|k�r�dSt|�}|j��r�|jdk�r�|jt|�}
t||
|t
|��}nd}td|d|||�S)ahAttempt to compute self**other exactly.

        Given Decimals self and other and an integer p, attempt to
        compute an exact result for the power self**other, with p
        digits of precision.  Return None if self**other is not
        exactly representable in p digits.

        Assumes that elimination of special cases has already been
        performed: self and other must both be nonspecial; self must
        be positive and not numerically equal to 1; other must be
        nonzero.  For efficiency, other._exp should not be too large,
        so that 10**abs(other._exp) is a feasible calculation.r�r%r-Nr�rQr+�r���]�Ary�r[�d)r+rr�r)rirUrVr=r�r7rOr�r6�_nbitsrfr`�_decimal_lshift_exactr�rh�	_log10_lb)r.r��p�x�xc�xe�y�yc�yer�r�ZzerosZ
last_digitr�Zemaxr�rur5Zxc_bits�rem�ar�r�Zstr_xcr'r'r)�_power_exact(s�:









&&&&


 zDecimal._power_exactcCs@|dk	r|j|||�St|�}|tkr*|S|dkr8t�}|j||�}|rL|S|sd|s`|jtd�StSd}|jdkr�|j	�r�|j
�s�d}n|r�|jtd�S|j�}|s�|jdkr�t|dd�St
|S|j�r�|jdkr�t
|St|dd�S|tk�r�|j	��rZ|jdk�rd}n||jk�r"|j}nt|�}|j|}|d|jk�rxd|j}|jt�n|jt�|jt�d|j}t|dd||�S|j�}|j��r�|jdk|dkk�r�t|dd�St
|Sd}d}	|j�|j�}
|dk|jdkk�r|
tt|j��k�rHt|d|jd�}n,|j�}|
tt|��k�rHt|d|d�}|dk�r�|j||jd�}|dk	�r�|dk�r�td|j|j�}d	}	|dk�r:|j}t|�}
|
j|
j}}t|�}|j|j}}|jdk�r�|}d
}xJt||||||�\}}|ddtt|��|d�rP|d
7}�q�Wt|t|�|�}|	�r2|j	��r2t|j�|jk�r�|jdt|j�}t|j|jd||j|�}|j �}|j!�xt"D]}d|j#|<�q�W|j$|�}|jt�|j%t&�r�|jt'�|j%t(�r|jt(d
|j�x:t't&ttt)fD]}|j%|�r|j|��qWn
|j$|�}|S)aHReturn self ** other [ % modulo].

        With two arguments, compute self**other.

        With three arguments, compute (self**other) % modulo.  For the
        three argument form, the following restrictions on the
        arguments hold:

         - all three arguments must be integral
         - other must be nonnegative
         - either self or other (or both) must be nonzero
         - modulo must be nonzero and must have at most p digits,
           where p is the context precision.

        If any of these restrictions is violated the InvalidOperation
        flag is raised.

        The result of pow(self, other, modulo) is identical to the
        result that would be obtained by computing (self**other) %
        modulo with unbounded precision, but is computed more
        efficiently.  It is always exact.
        Nz0 ** 0r%r-z+x ** y with x negative and y not an integerrQr�FTr[ryr�z
above Emax)*rr�r�rr�rdr	�_Oner7r�r�r�r6r<r�r@rUrOrrr��_log10_exp_boundrfr`rAr�rr8rirVr=�_dpowerrHrI�_signals�trapsr��flagsr
rrr)r.r�r�r/r;Zresult_signZ
multiplierrVZself_adj�exactZboundr�rrr
rrrr�extrar�r�Z
newcontextZ	exceptionr'r'r)�__pow__	s�














"




zDecimal.__pow__cCs"t|�}|tkr|S|j||d�S)z%Swaps self/other and returns __pow__.)r/)r�r�r)r.r�r/r'r'r)�__rpow__�	szDecimal.__rpow__cCs�|dkrt�}|jr(|j|d�}|r(|S|j|�}|j�r>|S|sPt|jdd�S|j|j�g|j	}t
|j�}|j}x.|j|ddkr�||kr�|d7}|d8}qvWt|j|jd|�|�S)z?Normalize- strip trailing 0s, change anything equal to 0 to 0e0N)r/rQr%r-)
rrPr�r�r�r6r7rAr�r�rfr8rO)r.r/r;�dupr��endrVr'r'r)�	normalize�	s$

zDecimal.normalizecCs�t|dd�}|dkrt�}|dkr(|j}|js4|jr||j||�}|rH|S|j�sX|j�r||j�rp|j�rpt|�S|jtd�S|j	�|j
ko�|jkns�|jtd�S|s�t|j
d|j
�}|j|�S|j�}||jkr�|jtd�S||j
d|jk�r|jtd	�S|j|j
|�}|j�|jk�r0|jtd�St|j�|jk�rN|jtd	�S|�rn|j�|jk�rn|jt�|j
|j
k�r�||k�r�|jt�|jt�|j|�}|S)
z�Quantize self so its exponent is the same as that of exp.

        Similar to self._rescale(exp._exp) but with error checking.
        T)r�Nzquantize with one INFz)target exponent out of bounds in quantizerQz9exponent of quantize result too large for current contextr-z7quantize result has too many digits for current context)r�rr?rPr�r�rrdr	r�rOrAr6r7r�r�r@r�rfr8�Eminr
rr)r.rVr?r/r;r�r'r'r)r�
sT 






zDecimal.quantizecCsDt|dd�}|js|jr8|j�r(|j�p6|j�o6|j�S|j|jkS)a=Return True if self and other have the same exponent; otherwise
        return False.

        If either operand is a special value, the following rules are used:
           * return True if both operands are infinities
           * return True if both operands are NaNs
           * otherwise, return False.
        T)r�)r�rPr��is_infiniterO)r.r�r/r'r'r)�same_quantumJ
s
	zDecimal.same_quantumcCs�|jrt|�S|s t|jd|�S|j|krHt|j|jd|j||�St|j�|j|}|dkrzt|jd|d�}d}|j|}|||�}|jd|�p�d}|dkr�tt	|�d�}t|j||�S)asRescale self so that the exponent is exp, either by padding with zeros
        or by truncating digits, using the given rounding mode.

        Specials are returned without change.  This operation is
        quiet: it raises no flags, and uses no information from the
        context.

        exp = exp to scale to (an integer)
        rounding = rounding mode
        rQr%r�r-N)
rPrr6r7rOr8rfr�r`rU)r.rVr?rxZ
this_functionr�r�r'r'r)r�Y
s"


zDecimal._rescalecCsh|dkrtd��|js|r$t|�S|j|j�d||�}|j�|j�krd|j|j�d||�}|S)a"Round a nonzero, nonspecial Decimal to a fixed number of
        significant figures, using the given rounding mode.

        Infinities, NaNs and zeros are returned unaltered.

        This operation is quiet: it raises no flags, and uses no
        information from the context.

        r%z'argument should be at least 1 in _roundr-)rlrPrr�r�)r.�placesr?r;r'r'r)�_round{
s
zDecimal._roundcCs�|jr"|j|d�}|r|St|�S|jdkr4t|�S|sFt|jdd�S|dkrTt�}|dkrb|j}|jd|�}||kr�|j	t
�|j	t�|S)aVRounds to a nearby integer.

        If no rounding mode is specified, take the rounding mode from
        the context.  This method raises the Rounded and Inexact flags
        when appropriate.

        See also: to_integral_value, which does exactly the same as
        this method except that it doesn't raise Inexact or Rounded.
        )r/r%rQN)rPr�rrOr6r7rr?r�rdrr)r.r?r/r;r'r'r)�to_integral_exact�
s$



zDecimal.to_integral_exactcCs`|dkrt�}|dkr|j}|jr>|j|d�}|r6|St|�S|jdkrPt|�S|jd|�SdS)z@Rounds to the nearest integer, without raising inexact, rounded.N)r/r%)rr?rPr�rrOr�)r.r?r/r;r'r'r)r��
s
zDecimal.to_integral_valuecCs�|dkrt�}|jrB|j|d�}|r(|S|j�rB|jdkrBt|�S|sdt|jd|jd�}|j|�S|jdkrz|j	t
d�S|jd}t|�}|j
d?}|j
d@r�|jd}t|j�d?d}n|j}t|j�dd?}||}|dkr�|d	|9}d
}	nt|d	|�\}}
|
}	||8}d|}x(||}||k�r:Pn||d?}�q$W|	�o\|||k}	|	�r�|dk�r||d|}n|d|9}||7}n|ddk�r�|d7}tdt|�|�}|j�}|jt�}
|j|�}|
|_|S)zReturn the square root of self.N)r/r%rQr+r-zsqrt(-x), x > 0r�rTry)rrPr�r�r7rr6rOr�rdr	r@rirVrUrfr8r�r`�
_shallow_copy�
_set_roundingrr?)r.r/r;r@�opr��c�lr�rr�r5r�r?r'r'r)�sqrt�
s`










zDecimal.sqrtcCs�t|dd�}|dkrt�}|js&|jr~|j�}|j�}|s>|r~|dkrX|dkrX|j|�S|dkrr|dkrr|j|�S|j||�S|j|�}|dkr�|j|�}|dkr�|}n|}|j|�S)z�Returns the larger value.

        Like max(self, other) except if one is not a number, returns
        NaN (and signals if one is sNaN).  Also rounds.
        T)r�Nr-r%r�)r�rrPr�r�r�r��
compare_total)r.r�r/�sn�onr+r;r'r'r)r�%s&


	
zDecimal.maxcCs�t|dd�}|dkrt�}|js&|jr~|j�}|j�}|s>|r~|dkrX|dkrX|j|�S|dkrr|dkrr|j|�S|j||�S|j|�}|dkr�|j|�}|dkr�|}n|}|j|�S)z�Returns the smaller value.

        Like min(self, other) except if one is not a number, returns
        NaN (and signals if one is sNaN).  Also rounds.
        T)r�Nr-r%r�)r�rrPr�r�r�r�r.)r.r�r/r/r0r+r;r'r'r)r�Os&



zDecimal.mincCs8|jr
dS|jdkrdS|j|jd�}|dt|�kS)z"Returns whether self is an integerFr%TNrQ)rPrOr8rf)r.�restr'r'r)r�qs
zDecimal._isintegercCs(|s|jdkrdS|jd|jdkS)z:Returns True if self is even.  Assumes self is an integer.r%Tr-r�r�)rOr8)r.r'r'r)r�zszDecimal._isevencCs.y|jt|j�dStk
r(dSXdS)z$Return the adjusted exponent of selfr-r%N)rOrfr8rr)r.r'r'r)r��szDecimal.adjustedcCs|S)z�Returns the same Decimal object.

        As we do not have different encodings for the same number, the
        received object already is in its canonical form.
        r')r.r'r'r)�	canonical�szDecimal.canonicalcCs.t|dd�}|j||�}|r |S|j||d�S)z�Compares self to the other operand numerically.

        It's pretty much like compare(), but all NaNs signal, with signaling
        NaNs taking precedence over quiet NaNs.
        T)r�)r/)r�r�r�)r.r�r/r;r'r'r)�compare_signal�s
zDecimal.compare_signalcCsft|dd�}|jr|jrtS|jr0|jr0tS|j}|j�}|j�}|sP|�r||kr�t|j�|jf}t|j�|jf}||kr�|r�tStS||kr�|r�tStStS|r�|dkr�tS|dkr�tS|dkr�tS|dkr�tSn4|dkr�tS|dkr�tS|dk�rtS|dk�rtS||k�rtS||k�r*tS|j|jk�rF|�rBtStS|j|jk�rb|�r^tStStS)z�Compares self to other using the abstract representations.

        This is not like the standard compare, which use their numerical
        value. Note that a total ordering is defined for all possible abstract
        representations.
        T)r�r-r+)	r�r7�_NegativeOnerr�rfr8�_ZerorO)r.r�r/r=Zself_nanZ	other_nanZself_keyZ	other_keyr'r'r)r.�sf




zDecimal.compare_totalcCs&t|dd�}|j�}|j�}|j|�S)z�Compares self to other using abstract repr., ignoring sign.

        Like compare_total, but with operand's sign ignored and assumed to be 0.
        T)r�)r�r�r.)r.r�r/r��or'r'r)�compare_total_mag�szDecimal.compare_total_magcCstd|j|j|j�S)z'Returns a copy with the sign set to 0. r%)r6r8rOrP)r.r'r'r)r��szDecimal.copy_abscCs2|jrtd|j|j|j�Std|j|j|j�SdS)z&Returns a copy with the sign inverted.r%r-N)r7r6r8rOrP)r.r'r'r)r��szDecimal.copy_negatecCs"t|dd�}t|j|j|j|j�S)z$Returns self with the sign of other.T)r�)r�r6r7r8rOrP)r.r�r/r'r'r)�	copy_sign�s
zDecimal.copy_signcCs�|dkrt�}|j|d�}|r"|S|j�dkr2tS|s:tS|j�dkrNt|�S|j}|j�}|jdkr�|t	t
|jdd��kr�tdd|jd�}�n0|jdkr�|t	t
|j
�dd��kr�tdd|j
�d�}n�|jdko�||k�r
tddd|dd|�}n�|jdk�rB||dk�rBtdd|d|d�}n�t|�}|j|j}}|jdk�rj|}d}xFt||||�\}	}
|	d	d
t	t
|	��|d�r�P|d7}�qpWtdt
|	�|
�}|j�}|jt�}|j|�}||_|S)zReturns e ** self.N)r/r-r%r[r�rQr>ryr�r�)rr�r�r5rrr@r�r7rfr`rAr6r�rirUrVr=�_dexpr(r)rr�r?)r.r/r;r�adjr*r+r�rr�rVr?r'r'r)rVsJ$( "

zDecimal.expcCsdS)z�Return True if self is canonical; otherwise return False.

        Currently, the encoding of a Decimal instance is always
        canonical, so this method returns True for any Decimal.
        Tr')r.r'r'r)�is_canonicalLszDecimal.is_canonicalcCs|jS)z�Return True if self is finite; otherwise return False.

        A Decimal instance is considered finite if it is neither
        infinite nor a NaN.
        )rP)r.r'r'r)�	is_finiteTszDecimal.is_finitecCs
|jdkS)z8Return True if self is infinite; otherwise return False.rZ)rO)r.r'r'r)r#\szDecimal.is_infinitecCs
|jdkS)z>Return True if self is a qNaN or sNaN; otherwise return False.r5rY)r5rY)rO)r.r'r'r)r�`szDecimal.is_nancCs,|js|rdS|dkrt�}|j|j�kS)z?Return True if self is a normal number; otherwise return False.FN)rPrr"r�)r.r/r'r'r)�	is_normalds
zDecimal.is_normalcCs
|jdkS)z;Return True if self is a quiet NaN; otherwise return False.r5)rO)r.r'r'r)r�lszDecimal.is_qnancCs
|jdkS)z8Return True if self is negative; otherwise return False.r-)r7)r.r'r'r)�	is_signedpszDecimal.is_signedcCs
|jdkS)z?Return True if self is a signaling NaN; otherwise return False.rY)rO)r.r'r'r)r�tszDecimal.is_snancCs,|js|rdS|dkrt�}|j�|jkS)z9Return True if self is subnormal; otherwise return False.FN)rPrr�r")r.r/r'r'r)�is_subnormalxs
zDecimal.is_subnormalcCs|jo|jdkS)z6Return True if self is a zero; otherwise return False.rQ)rPr8)r.r'r'r)�is_zero�szDecimal.is_zerocCs�|jt|j�d}|dkr4tt|dd��dS|dkrXttd|dd��dSt|�}|j|j}}|dkr�t|d|�}t|�}t|�t|�||kS|ttd||��dS)z�Compute a lower bound for the adjusted exponent of self.ln().
        In other words, compute r such that self.ln() >= 10**r.  Assumes
        that self is finite and positive and that self != 1.
        r-�r�r+r%r�r�)rOrfr8r`rirUrV)r.r:r*r+r��num�denr'r'r)�
_ln_exp_bound�szDecimal._ln_exp_boundc
Cs|dkrt�}|j|d�}|r"|S|s*tS|j�dkr:tS|tkrFtS|jdkr\|jt	d�St
|�}|j|j}}|j
}||j�d}x>t|||�}|ddttt|���|dr�P|d7}q�Wtt|d	k�tt|��|�}|j�}|jt�}	|j|�}|	|_|S)
z/Returns the natural (base e) logarithm of self.N)r/r-zln of a negative valuer+ryr�r[r%)rr��_NegativeInfinityr��	_Infinityrr5r7rdr	rirUrVr@rD�_dlogrfr`rhr6r(r)rr�r?)
r.r/r;r*r+r�rr%r�r?r'r'r)�ln�s:
$

z
Decimal.lncCs�|jt|j�d}|dkr,tt|��dS|dkrHttd|��dSt|�}|j|j}}|dkr�t|d|�}td|�}t|�t|�||kdStd||�}t|�||dkdS)	z�Compute a lower bound for the adjusted exponent of self.log10().
        In other words, find r such that self.log10() >= 10**r.
        Assumes that self is finite and positive and that self != 1.
        r-r+r%r���Z231r�r�)rOrfr8r`rirUrV)r.r:r*r+r�rBrCr'r'r)r�szDecimal._log10_exp_boundc
CsH|dkrt�}|j|d�}|r"|S|s*tS|j�dkr:tS|jdkrP|jtd�S|jddkr�|jdd�dt	|j�dkr�t
|jt	|j�d�}n�t|�}|j
|j}}|j}||j�d}x>t|||�}|d	d
t	tt|���|dr�P|d7}q�Wtt
|dk�tt|��|�}|j�}|jt�}	|j|�}|	|_|S)z&Returns the base 10 logarithm of self.N)r/r-zlog10 of a negative valuer%r�rQr+ryr�r[)rr�rEr�rFr7rdr	r8rfrrOrirUrVr@r�_dlog10r`rhr6r(r)rr�r?)
r.r/r;r*r+r�rr%r�r?r'r'r)�log10�s:
.$

z
Decimal.log10cCsV|j|d�}|r|S|dkr"t�}|j�r.tS|s@|jtdd�St|j��}|j|�S)aM Returns the exponent of the magnitude of self's MSD.

        The result is the integer which is the exponent of the magnitude
        of the most significant digit of self (as though it were truncated
        to a single digit while maintaining the value of that digit and
        without limiting the resulting exponent).
        )r/Nzlogb(0)r-)	r�rr�rFrdr
rr�r�)r.r/r;r'r'r)�logb 
s	zDecimal.logbcCs8|jdks|jdkrdSx|jD]}|dkr dSq WdS)z�Return True if self is a logical operand.

        For being logical, it must be a finite number with a sign of 0,
        an exponent of 0, and a coefficient whose digits must all be
        either 0 or 1.
        r%FZ01T)r7rOr8)r.�digr'r'r)�
_islogical>
szDecimal._islogicalcCs�|jt|�}|dkr$d||}n|dkr<||jd�}|jt|�}|dkr`d||}n|dkrx||jd�}||fS)Nr%rQ)r@rf)r.r/�opa�opbZdifr'r'r)�
_fill_logicalL
szDecimal._fill_logicalcCs~|dkrt�}t|dd�}|j�s.|j�r8|jt�S|j||j|j�\}}djdd�t||�D��}t	d|j
d�pxdd�S)	z;Applies an 'and' operation between self and other's digits.NT)r�rScSs$g|]\}}tt|�t|�@��qSr')r`rU)�.0r�br'r'r)�
<listcomp>g
sz'Decimal.logical_and.<locals>.<listcomp>r%rQ)rr�rNrdr	rQr8rn�zipr6rg)r.r�r/rOrPr�r'r'r)�logical_andY
s
zDecimal.logical_andcCs(|dkrt�}|jtdd|jd�|�S)zInvert all its digits.Nr%r�)r�logical_xorr6r@)r.r/r'r'r)�logical_invertj
szDecimal.logical_invertcCs~|dkrt�}t|dd�}|j�s.|j�r8|jt�S|j||j|j�\}}djdd�t||�D��}t	d|j
d�pxdd�S)	z:Applies an 'or' operation between self and other's digits.NT)r�rScSs$g|]\}}tt|�t|�B��qSr')r`rU)rRrrSr'r'r)rT
sz&Decimal.logical_or.<locals>.<listcomp>r%rQ)rr�rNrdr	rQr8rnrUr6rg)r.r�r/rOrPr�r'r'r)�
logical_orq
s
zDecimal.logical_orcCs~|dkrt�}t|dd�}|j�s.|j�r8|jt�S|j||j|j�\}}djdd�t||�D��}t	d|j
d�pxdd�S)	z;Applies an 'xor' operation between self and other's digits.NT)r�rScSs$g|]\}}tt|�t|�A��qSr')r`rU)rRrrSr'r'r)rT�
sz'Decimal.logical_xor.<locals>.<listcomp>r%rQ)rr�rNrdr	rQr8rnrUr6rg)r.r�r/rOrPr�r'r'r)rW�
s
zDecimal.logical_xorcCs�t|dd�}|dkrt�}|js&|jr~|j�}|j�}|s>|r~|dkrX|dkrX|j|�S|dkrr|dkrr|j|�S|j||�S|j�j|j��}|dkr�|j|�}|dkr�|}n|}|j|�S)z8Compares the values numerically with their sign ignored.T)r�Nr-r%r�)	r�rrPr�r�r�r�r�r.)r.r�r/r/r0r+r;r'r'r)�max_mag�
s&


zDecimal.max_magcCs�t|dd�}|dkrt�}|js&|jr~|j�}|j�}|s>|r~|dkrX|dkrX|j|�S|dkrr|dkrr|j|�S|j||�S|j�j|j��}|dkr�|j|�}|dkr�|}n|}|j|�S)z8Compares the values numerically with their sign ignored.T)r�Nr-r%r�)	r�rrPr�r�r�r�r�r.)r.r�r/r/r0r+r;r'r'r)�min_mag�
s&


zDecimal.min_magcCs�|dkrt�}|j|d�}|r"|S|j�dkr2tS|j�dkrTtdd|j|j��S|j�}|jt	�|j
�|j|�}||kr�|S|jtdd|j
�d�|�S)z=Returns the largest representable number smaller than itself.N)r/r-r%r>r�r�)rr�r�rEr6r@r�rHr)r�_ignore_all_flagsr�r�r�)r.r/r;�new_selfr'r'r)�
next_minus�
s"

zDecimal.next_minuscCs�|dkrt�}|j|d�}|r"|S|j�dkr2tS|j�dkrTtdd|j|j��S|j�}|jt	�|j
�|j|�}||kr�|S|jtdd|j
�d�|�S)z=Returns the smallest representable number larger than itself.N)r/r-r>r%r�r�)rr�r�rFr6r@r�rHr)rr\r�r�r�)r.r/r;r]r'r'r)�	next_plus�
s"

zDecimal.next_pluscCs�t|dd�}|dkrt�}|j||�}|r.|S|j|�}|dkrJ|j|�S|dkr^|j|�}n
|j|�}|j�r�|jt	d|j
�|jt�|jt�nD|j
�|jkr�|jt�|jt�|jt�|jt�|s�|jt�|S)a�Returns the number closest to self, in the direction towards other.

        The result is the closest representable number to self
        (excluding self) that is in the direction towards other,
        unless both have the same value.  If the two operands are
        numerically equal, then the result is a copy of self with the
        sign set to be the same as the sign of other.
        T)r�Nr%r-z Infinite result from next_towardr�)r�rr�r�r8r_r^r�rdrr7rrr�r"rr
r)r.r�r/r;Z
comparisonr'r'r)�next_toward�
s4	








zDecimal.next_towardcCs�|j�rdS|j�rdS|j�}|dkr,dS|dkr8dS|j�rN|jrJdSdS|dkr\t�}|j|d	�rv|jrrd
SdS|jr�dSd
SdS)aReturns an indication of the class of self.

        The class is one of the following strings:
          sNaN
          NaN
          -Infinity
          -Normal
          -Subnormal
          -Zero
          +Zero
          +Subnormal
          +Normal
          +Infinity
        r�r�r-z	+Infinityz	-Infinityz-Zeroz+ZeroN)r/z
-Subnormalz
+Subnormalz-Normalz+Normalr�)r�r�r�r@r7rr?)r.r/�infr'r'r)�number_class+s,zDecimal.number_classcCstd�S)z'Just returns 10, as this is Decimal, :)r�)r)r.r'r'r)�radixUsz
Decimal.radixcCs�|dkrt�}t|dd�}|j||�}|r.|S|jdkrB|jt�S|jt|�ko^|jknsn|jt�S|j�r~t	|�St|�}|j
}|jt|�}|dkr�d||}n|dkr�||d�}||d�|d|�}t|j
|jd�p�d|j�S)z5Returns a rotated copy of self, value-of-other times.NT)r�r%rQ)rr�r�rOrdr	r@rUr�rr8rfr6r7rg)r.r�r/r;�torot�rotdig�topadZrotatedr'r'r)�rotateYs,

"
zDecimal.rotatecCs�|dkrt�}t|dd�}|j||�}|r.|S|jdkrB|jt�Sd|j|j}d|j|j}|t|�kox|kns�|jt�S|j	�r�t
|�St|j|j
|jt|��}|j|�}|S)z>Returns self operand after adding the second value to its exp.NT)r�r%r+r�)rr�r�rOrdr	rAr@rUr�rr6r7r8r�)r.r�r/r;ZliminfZlimsuprr'r'r)�scalebzs"



zDecimal.scalebcCs|dkrt�}t|dd�}|j||�}|r.|S|jdkrB|jt�S|jt|�ko^|jknsn|jt�S|j�r~t	|�St|�}|j
}|jt|�}|dkr�d||}n|dkr�||d�}|dkr�|d|�}n|d|}||jd�}t|j
|jd��pd|j�S)z5Returns a shifted copy of self, value-of-other times.NT)r�r%rQ)rr�r�rOrdr	r@rUr�rr8rfr6r7rg)r.r�r/r;rdrerfZshiftedr'r'r)r��s2

"
z
Decimal.shiftcCs|jt|�ffS)N)�	__class__r`)r.r'r'r)�
__reduce__�szDecimal.__reduce__cCst|�tkr|S|jt|��S)N)�typerrir`)r.r'r'r)�__copy__�szDecimal.__copy__cCst|�tkr|S|jt|��S)N)rkrrir`)r.�memor'r'r)�__deepcopy__�szDecimal.__deepcopy__cCsN|dkrt�}t||d�}|jrXt|j|�}t|j��}|ddkrL|d7}t|||�S|ddkrvddg|j|d<|ddkr�t	|j|j
|jd�}|j}|d}|dk	�r|dd	kr�|j
|d
|�}nF|ddkr�|j||�}n*|ddk�rt|j
�|k�r|j
||�}|�rB|jd
k�rB|ddk�rB|jd
|�}|jt|j
�}	|dd	k�r�|�r||dk	�r|d
|}
nd
}
nB|ddk�r�|	}
n.|ddk�r�|jd
k�r�|	dk�r�|	}
nd
}
|
d
k�r�d}d|
|j
}nP|
t|j
�k�r|j
d|
t|j
�}d}n"|j
d|
��p$d}|j
|
d�}|	|
}
t|j|||
|�S)a|Format a Decimal instance according to the given specifier.

        The specifier should be a standard format specifier, with the
        form described in PEP 3101.  Formatting types 'e', 'E', 'f',
        'F', 'g', 'G', 'n' and '%' are supported.  If the formatting
        type is omitted it defaults to 'g' or 'G', depending on the
        value of context.capitals.
        N)�_localeconvrk�%�g�Gr+�	precision�eEr-zfF%ZgGr%r�rQrSi����)r�_parse_format_specifierrP�_format_signr7r`r��
_format_alignr�r6r8rOr?r&r�rf�_format_number)r.Z	specifierr/ro�specr=�bodyr?rsr�r�rvrwrVr'r'r)�
__format__�sZ
"

zDecimal.__format__)rOr8r7rP)rQN)NN)N)N)N)N)N)N)FN)N)N)N)TN)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)NN)N)N)NN)N)NN)NN)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)NN)�r1r2r3r4�	__slots__r^�classmethodrqr�r�r�r�r�r�r�r�r�r�r�r�r�r�r|r�r�r�r�r�r�r��__radd__r�r�r��__rmul__r�r�r�r�r�r�r�r�r�r�r�r��	__trunc__r��propertyr�r�r�r9r�r�r�r�r�r�r�r�r��dictr�r�r�r�r�rrrrr!r�r$r�r&r'r��to_integralr-r�r�r�r�r�r2r3r.r7r�r�r8rVr;r<r#r�r=r�r>r�r?r@rDrHrrKrLrNrQrVrXrYrWrZr[r^r_r`rbrcrgrhr�rjrlrnr{r'r'r'r)r+s
(
 !@

	
	
	
	
2
4
	V7;!$K

f	>,UnY="c*"	IK23
.*!'FcCs&tjt�}||_||_||_||_|S)z�Create a decimal instance directly, without any validation,
    normalization (e.g. removal of leading zeros) or argument
    conversion.

    This function is for *internal use only*.
    )r]r^rr7r8rOrP)r=Zcoefficientr�Zspecialr.r'r'r)r6s
r6c@s(eZdZdZdd�Zdd�Zdd�ZdS)	rNz�Context manager class to support localcontext().

      Sets a copy of the supplied context in __enter__() and restores
      the previous decimal context in __exit__()
    cCs|j�|_dS)N)rH�new_context)r.r�r'r'r)�__init__9sz_ContextManager.__init__cCst�|_t|j�|jS)N)r�
saved_contextrr�)r.r'r'r)�	__enter__;s
z_ContextManager.__enter__cCst|j�dS)N)rr�)r.�t�v�tbr'r'r)�__exit__?sz_ContextManager.__exit__N)r1r2r3r4r�r�r�r'r'r'r)rN3srNc	@s�eZdZdZd�dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZeZd�dd�Zdd�Zdd�Zdd �ZdZd!d"�Zd#d$�Zd%d&�Zd�d(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Z d:d;�Z!d<d=�Z"d>d?�Z#d@dA�Z$dBdC�Z%dDdE�Z&dFdG�Z'dHdI�Z(dJdK�Z)dLdM�Z*dNdO�Z+dPdQ�Z,dRdS�Z-dTdU�Z.dVdW�Z/dXdY�Z0dZd[�Z1d\d]�Z2d^d_�Z3d`da�Z4dbdc�Z5ddde�Z6dfdg�Z7dhdi�Z8djdk�Z9dldm�Z:dndo�Z;dpdq�Z<drds�Z=dtdu�Z>dvdw�Z?dxdy�Z@dzd{�ZAd|d}�ZBd~d�ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGd�d�d��ZHd�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOd�d��ZPd�d��ZQd�d��ZRd�d��ZSd�d��ZTd�d��ZUd�d��ZVeVZWdS)�ra�Contains the context for a Decimal instance.

    Contains:
    prec - precision (for use in rounding, division, square roots..)
    rounding - rounding type (how you round)
    traps - If traps[exception] = 1, then the exception is
                    raised when it is caused.  Otherwise, a value is
                    substituted in.
    flags  - When an exception is caused, flags[exception] is set.
             (Whether or not the trap_enabler is set)
             Should be reset by user of Decimal instance.
    Emin -   Minimum exponent
    Emax -   Maximum exponent
    capitals -      If 1, 1*10^1 is printed as 1E+1.
                    If 0, printed as 1e1
    clamp -  If 1, change exponents if too high (Default 0)
    Nc
s>yt}
Wntk
rYnX|dk	r*|n|
j|_|dk	r>|n|
j|_|dk	rR|n|
j|_|dk	rf|n|
j|_|dk	rz|n|
j|_|dk	r�|n|
j|_|	dkr�g|_n|	|_�dkr�|
j	j
�|_	n.t�t�s�t�fdd�t
�D��|_	n�|_	�dk�r
tjt
d�|_n0t�t��s4t�fdd�t
�D��|_n�|_dS)Nc3s|]}|t|�k�fVqdS)N)rU)rRr�)rr'r)�	<genexpr>nsz#Context.__init__.<locals>.<genexpr>r%c3s|]}|t|�k�fVqdS)N)rU)rRr�)rr'r)r�us)r�	NameErrorr@r?r"rAr�r��_ignored_flagsrrHr_r�r�fromkeysr)r.r@r?r"rAr�r�rrr�Zdcr')rrr)r�Us.

zContext.__init__cCs�t|t�std|��|dkr<||kr�td||||f��nJ|dkrb||kr�td||||f��n$||ksr||kr�td||||f��tj|||�S)Nz%s must be an integerz-infz%s must be in [%s, %d]. got: %sraz%s must be in [%d, %s]. got: %sz%s must be in [%d, %d]. got %s)r_rUrrrlr]�__setattr__)r.�namertZvminZvmaxr'r'r)�_set_integer_checkys
zContext._set_integer_checkcCsht|t�std|��x |D]}|tkrtd|��qWx tD]}||kr>td|��q>Wtj|||�S)Nz%s must be a signal dictz%s is not a valid signal dict)r_r�rrr�KeyErrorr]r�)r.r�r�keyr'r'r)�_set_signal_dict�s


zContext._set_signal_dictcCs�|dkr|j||dd�S|dkr0|j||dd�S|dkrH|j||dd�S|dkr`|j||dd�S|d	krx|j||dd�S|d
kr�|tkr�td|��tj|||�S|dks�|d
kr�|j||�S|dkr�tj|||�Std|��dS)Nr@r-rar"z-infr%rAr�r�r?z%s: invalid rounding moderrr�z.'decimal.Context' object has no attribute '%s')r��_rounding_modesrrr]r�r�rL)r.r�rtr'r'r)r��s(zContext.__setattr__cCstd|��dS)Nz%s cannot be deleted)rL)r.r�r'r'r)�__delattr__�szContext.__delattr__c	CsNdd�|jj�D�}dd�|jj�D�}|j|j|j|j|j|j|j	||ffS)NcSsg|]\}}|r|�qSr'r')rR�sigr�r'r'r)rT�sz&Context.__reduce__.<locals>.<listcomp>cSsg|]\}}|r|�qSr'r')rRr�r�r'r'r)rT�s)
r�itemsrrir@r?r"rAr�r�)r.rrr'r'r)rj�s
zContext.__reduce__cCs|g}|jdt|��dd�|jj�D�}|jddj|�d�dd�|jj�D�}|jddj|�d�dj|�d	S)
zShow the current context.zrContext(prec=%(prec)d, rounding=%(rounding)s, Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d, clamp=%(clamp)dcSsg|]\}}|r|j�qSr')r1)rRr~r�r'r'r)rT�sz$Context.__repr__.<locals>.<listcomp>zflags=[z, �]cSsg|]\}}|r|j�qSr')r1)rRr�r�r'r'r)rT�sztraps=[�))rm�varsrr�rnr)r.r��namesr'r'r)r��szContext.__repr__cCsx|jD]}d|j|<qWdS)zReset all flags to zeror%N)r)r.�flagr'r'r)rI�szContext.clear_flagscCsx|jD]}d|j|<qWdS)zReset all traps to zeror%N)r)r.r�r'r'r)�clear_traps�szContext.clear_trapsc
Cs.t|j|j|j|j|j|j|j|j|j	�	}|S)z!Returns a shallow copy from self.)
rr@r?r"rAr�r�rrr�)r.�ncr'r'r)r(�szContext._shallow_copyc
Cs6t|j|j|j|j|j|j|jj�|j	j�|j
�	}|S)zReturns a deep copy from self.)rr@r?r"rAr�r�rrHrr�)r.r�r'r'r)rH�s
zContext.copycGsZtj||�}||jkr(|�j|f|��Sd|j|<|j|sN|�j|f|��S||��dS)a#Handles an error

        If the flag is in _ignored_flags, returns the default response.
        Otherwise, it sets the flag, then, if the corresponding
        trap_enabler is set, it reraises the exception.  Otherwise, it returns
        the default value after setting the flag.
        r-N)�_condition_map�getr�r0rr)r.Z	conditionZexplanationr(�errorr'r'r)rd�s


zContext._raise_errorcCs
|jt�S)z$Ignore all flags, if they are raised)�
_ignore_flagsr)r.r'r'r)r\�szContext._ignore_all_flagscGs|jt|�|_t|�S)z$Ignore the flags, if they are raised)r�rj)r.rr'r'r)r��szContext._ignore_flagscGs<|rt|dttf�r|d}x|D]}|jj|�q$WdS)z+Stop ignoring the flags, if they are raisedr%N)r_rkrjr��remove)r.rr�r'r'r)�
_regard_flags�s
zContext._regard_flagscCst|j|jd�S)z!Returns Etiny (= Emin - prec + 1)r-)rUr"r@)r.r'r'r)r�sz
Context.EtinycCst|j|jd�S)z,Returns maximum exponent (= Emax - prec + 1)r-)rUrAr@)r.r'r'r)r�szContext.EtopcCs|j}||_|S)a�Sets the rounding type.

        Sets the rounding type, and returns the current (previous)
        rounding type.  Often used like:

        context = context.copy()
        # so you don't change the calling context
        # if an error occurs in the middle.
        rounding = context._set_rounding(ROUND_UP)
        val = self.__sub__(other, context=context)
        context._set_rounding(rounding)

        This will make it round up for that operation.
        )r?)r.rkr?r'r'r)r)szContext._set_roundingrQcCsjt|t�r*||j�ksd|kr*|jtd�St||d�}|j�r`t|j�|j	|j
kr`|jtd�S|j|�S)z�Creates a new Decimal instance but using self as context.

        This method implements the to-number operation of the
        IBM Decimal specification.rRzAtrailing or leading whitespace and underscores are not permitted.)r/zdiagnostic info too long in NaN)r_r`rbrdrrr�rfr8r@r�r�)r.rBrr'r'r)�create_decimal#szContext.create_decimalcCstj|�}|j|�S)a�Creates a new Decimal instance from a float but rounding using self
        as the context.

        >>> context = Context(prec=5, rounding=ROUND_DOWN)
        >>> context.create_decimal_from_float(3.1415926535897932)
        Decimal('3.1415')
        >>> context = Context(prec=5, traps=[Inexact])
        >>> context.create_decimal_from_float(3.1415926535897932)
        Traceback (most recent call last):
            ...
        decimal.Inexact: None

        )rrqr�)r.r~rr'r'r)�create_decimal_from_float4s
z!Context.create_decimal_from_floatcCst|dd�}|j|d�S)a[Returns the absolute value of the operand.

        If the operand is negative, the result is the same as using the minus
        operation on the operand.  Otherwise, the result is the same as using
        the plus operation on the operand.

        >>> ExtendedContext.abs(Decimal('2.1'))
        Decimal('2.1')
        >>> ExtendedContext.abs(Decimal('-100'))
        Decimal('100')
        >>> ExtendedContext.abs(Decimal('101.5'))
        Decimal('101.5')
        >>> ExtendedContext.abs(Decimal('-101.5'))
        Decimal('101.5')
        >>> ExtendedContext.abs(-1)
        Decimal('1')
        T)r�)r/)r�r�)r.rr'r'r)rhFszContext.abscCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a�Return the sum of the two operands.

        >>> ExtendedContext.add(Decimal('12'), Decimal('7.00'))
        Decimal('19.00')
        >>> ExtendedContext.add(Decimal('1E+2'), Decimal('1.01E+4'))
        Decimal('1.02E+4')
        >>> ExtendedContext.add(1, Decimal(2))
        Decimal('3')
        >>> ExtendedContext.add(Decimal(8), 5)
        Decimal('13')
        >>> ExtendedContext.add(5, 5)
        Decimal('10')
        T)r�)r/zUnable to convert %s to DecimalN)r�r�r�rr)r.rrSr�r'r'r)�add[s
zContext.addcCst|j|��S)N)r`r�)r.rr'r'r)�_applypszContext._applycCst|t�std��|j�S)z�Returns the same Decimal object.

        As we do not have different encodings for the same number, the
        received object already is in its canonical form.

        >>> ExtendedContext.canonical(Decimal('2.50'))
        Decimal('2.50')
        z,canonical requires a Decimal as an argument.)r_rrrr2)r.rr'r'r)r2ss	
zContext.canonicalcCst|dd�}|j||d�S)a�Compares values numerically.

        If the signs of the operands differ, a value representing each operand
        ('-1' if the operand is less than zero, '0' if the operand is zero or
        negative zero, or '1' if the operand is greater than zero) is used in
        place of that operand for the comparison instead of the actual
        operand.

        The comparison is then effected by subtracting the second operand from
        the first and then returning a value according to the result of the
        subtraction: '-1' if the result is less than zero, '0' if the result is
        zero or negative zero, or '1' if the result is greater than zero.

        >>> ExtendedContext.compare(Decimal('2.1'), Decimal('3'))
        Decimal('-1')
        >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.1'))
        Decimal('0')
        >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.10'))
        Decimal('0')
        >>> ExtendedContext.compare(Decimal('3'), Decimal('2.1'))
        Decimal('1')
        >>> ExtendedContext.compare(Decimal('2.1'), Decimal('-3'))
        Decimal('1')
        >>> ExtendedContext.compare(Decimal('-3'), Decimal('2.1'))
        Decimal('-1')
        >>> ExtendedContext.compare(1, 2)
        Decimal('-1')
        >>> ExtendedContext.compare(Decimal(1), 2)
        Decimal('-1')
        >>> ExtendedContext.compare(1, Decimal(2))
        Decimal('-1')
        T)r�)r/)r�r�)r.rrSr'r'r)r��s!zContext.comparecCst|dd�}|j||d�S)aCompares the values of the two operands numerically.

        It's pretty much like compare(), but all NaNs signal, with signaling
        NaNs taking precedence over quiet NaNs.

        >>> c = ExtendedContext
        >>> c.compare_signal(Decimal('2.1'), Decimal('3'))
        Decimal('-1')
        >>> c.compare_signal(Decimal('2.1'), Decimal('2.1'))
        Decimal('0')
        >>> c.flags[InvalidOperation] = 0
        >>> print(c.flags[InvalidOperation])
        0
        >>> c.compare_signal(Decimal('NaN'), Decimal('2.1'))
        Decimal('NaN')
        >>> print(c.flags[InvalidOperation])
        1
        >>> c.flags[InvalidOperation] = 0
        >>> print(c.flags[InvalidOperation])
        0
        >>> c.compare_signal(Decimal('sNaN'), Decimal('2.1'))
        Decimal('NaN')
        >>> print(c.flags[InvalidOperation])
        1
        >>> c.compare_signal(-1, 2)
        Decimal('-1')
        >>> c.compare_signal(Decimal(-1), 2)
        Decimal('-1')
        >>> c.compare_signal(-1, Decimal(2))
        Decimal('-1')
        T)r�)r/)r�r3)r.rrSr'r'r)r3�s zContext.compare_signalcCst|dd�}|j|�S)a+Compares two operands using their abstract representation.

        This is not like the standard compare, which use their numerical
        value. Note that a total ordering is defined for all possible abstract
        representations.

        >>> ExtendedContext.compare_total(Decimal('12.73'), Decimal('127.9'))
        Decimal('-1')
        >>> ExtendedContext.compare_total(Decimal('-127'),  Decimal('12'))
        Decimal('-1')
        >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.3'))
        Decimal('-1')
        >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.30'))
        Decimal('0')
        >>> ExtendedContext.compare_total(Decimal('12.3'),  Decimal('12.300'))
        Decimal('1')
        >>> ExtendedContext.compare_total(Decimal('12.3'),  Decimal('NaN'))
        Decimal('-1')
        >>> ExtendedContext.compare_total(1, 2)
        Decimal('-1')
        >>> ExtendedContext.compare_total(Decimal(1), 2)
        Decimal('-1')
        >>> ExtendedContext.compare_total(1, Decimal(2))
        Decimal('-1')
        T)r�)r�r.)r.rrSr'r'r)r.�szContext.compare_totalcCst|dd�}|j|�S)z�Compares two operands using their abstract representation ignoring sign.

        Like compare_total, but with operand's sign ignored and assumed to be 0.
        T)r�)r�r7)r.rrSr'r'r)r7�szContext.compare_total_magcCst|dd�}|j�S)aReturns a copy of the operand with the sign set to 0.

        >>> ExtendedContext.copy_abs(Decimal('2.1'))
        Decimal('2.1')
        >>> ExtendedContext.copy_abs(Decimal('-100'))
        Decimal('100')
        >>> ExtendedContext.copy_abs(-1)
        Decimal('1')
        T)r�)r�r�)r.rr'r'r)r��s
zContext.copy_abscCst|dd�}t|�S)aReturns a copy of the decimal object.

        >>> ExtendedContext.copy_decimal(Decimal('2.1'))
        Decimal('2.1')
        >>> ExtendedContext.copy_decimal(Decimal('-1.00'))
        Decimal('-1.00')
        >>> ExtendedContext.copy_decimal(1)
        Decimal('1')
        T)r�)r�r)r.rr'r'r)�copy_decimal�s
zContext.copy_decimalcCst|dd�}|j�S)a(Returns a copy of the operand with the sign inverted.

        >>> ExtendedContext.copy_negate(Decimal('101.5'))
        Decimal('-101.5')
        >>> ExtendedContext.copy_negate(Decimal('-101.5'))
        Decimal('101.5')
        >>> ExtendedContext.copy_negate(1)
        Decimal('-1')
        T)r�)r�r�)r.rr'r'r)r�s
zContext.copy_negatecCst|dd�}|j|�S)aCopies the second operand's sign to the first one.

        In detail, it returns a copy of the first operand with the sign
        equal to the sign of the second operand.

        >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('7.33'))
        Decimal('1.50')
        >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('7.33'))
        Decimal('1.50')
        >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('-7.33'))
        Decimal('-1.50')
        >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('-7.33'))
        Decimal('-1.50')
        >>> ExtendedContext.copy_sign(1, -2)
        Decimal('-1')
        >>> ExtendedContext.copy_sign(Decimal(1), -2)
        Decimal('-1')
        >>> ExtendedContext.copy_sign(1, Decimal(-2))
        Decimal('-1')
        T)r�)r�r8)r.rrSr'r'r)r8szContext.copy_signcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a�Decimal division in a specified context.

        >>> ExtendedContext.divide(Decimal('1'), Decimal('3'))
        Decimal('0.333333333')
        >>> ExtendedContext.divide(Decimal('2'), Decimal('3'))
        Decimal('0.666666667')
        >>> ExtendedContext.divide(Decimal('5'), Decimal('2'))
        Decimal('2.5')
        >>> ExtendedContext.divide(Decimal('1'), Decimal('10'))
        Decimal('0.1')
        >>> ExtendedContext.divide(Decimal('12'), Decimal('12'))
        Decimal('1')
        >>> ExtendedContext.divide(Decimal('8.00'), Decimal('2'))
        Decimal('4.00')
        >>> ExtendedContext.divide(Decimal('2.400'), Decimal('2.0'))
        Decimal('1.20')
        >>> ExtendedContext.divide(Decimal('1000'), Decimal('100'))
        Decimal('10')
        >>> ExtendedContext.divide(Decimal('1000'), Decimal('1'))
        Decimal('1000')
        >>> ExtendedContext.divide(Decimal('2.40E+6'), Decimal('2'))
        Decimal('1.20E+6')
        >>> ExtendedContext.divide(5, 5)
        Decimal('1')
        >>> ExtendedContext.divide(Decimal(5), 5)
        Decimal('1')
        >>> ExtendedContext.divide(5, Decimal(5))
        Decimal('1')
        T)r�)r/zUnable to convert %s to DecimalN)r�r�r�rr)r.rrSr�r'r'r)�divide+s
zContext.dividecCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a/Divides two numbers and returns the integer part of the result.

        >>> ExtendedContext.divide_int(Decimal('2'), Decimal('3'))
        Decimal('0')
        >>> ExtendedContext.divide_int(Decimal('10'), Decimal('3'))
        Decimal('3')
        >>> ExtendedContext.divide_int(Decimal('1'), Decimal('0.3'))
        Decimal('3')
        >>> ExtendedContext.divide_int(10, 3)
        Decimal('3')
        >>> ExtendedContext.divide_int(Decimal(10), 3)
        Decimal('3')
        >>> ExtendedContext.divide_int(10, Decimal(3))
        Decimal('3')
        T)r�)r/zUnable to convert %s to DecimalN)r�r�r�rr)r.rrSr�r'r'r)�
divide_intPs
zContext.divide_intcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a�Return (a // b, a % b).

        >>> ExtendedContext.divmod(Decimal(8), Decimal(3))
        (Decimal('2'), Decimal('2'))
        >>> ExtendedContext.divmod(Decimal(8), Decimal(4))
        (Decimal('2'), Decimal('0'))
        >>> ExtendedContext.divmod(8, 4)
        (Decimal('2'), Decimal('0'))
        >>> ExtendedContext.divmod(Decimal(8), 4)
        (Decimal('2'), Decimal('0'))
        >>> ExtendedContext.divmod(8, Decimal(4))
        (Decimal('2'), Decimal('0'))
        T)r�)r/zUnable to convert %s to DecimalN)r�r�r�rr)r.rrSr�r'r'r)r�gs
zContext.divmodcCst|dd�}|j|d�S)a#Returns e ** a.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.exp(Decimal('-Infinity'))
        Decimal('0')
        >>> c.exp(Decimal('-1'))
        Decimal('0.367879441')
        >>> c.exp(Decimal('0'))
        Decimal('1')
        >>> c.exp(Decimal('1'))
        Decimal('2.71828183')
        >>> c.exp(Decimal('0.693147181'))
        Decimal('2.00000000')
        >>> c.exp(Decimal('+Infinity'))
        Decimal('Infinity')
        >>> c.exp(10)
        Decimal('22026.4658')
        T)r�)r/)r�rV)r.rr'r'r)rV|szContext.expcCst|dd�}|j|||d�S)aReturns a multiplied by b, plus c.

        The first two operands are multiplied together, using multiply,
        the third operand is then added to the result of that
        multiplication, using add, all with only one final rounding.

        >>> ExtendedContext.fma(Decimal('3'), Decimal('5'), Decimal('7'))
        Decimal('22')
        >>> ExtendedContext.fma(Decimal('3'), Decimal('-5'), Decimal('7'))
        Decimal('-8')
        >>> ExtendedContext.fma(Decimal('888565290'), Decimal('1557.96930'), Decimal('-86087.7578'))
        Decimal('1.38435736E+12')
        >>> ExtendedContext.fma(1, 3, 4)
        Decimal('7')
        >>> ExtendedContext.fma(1, Decimal(3), 4)
        Decimal('7')
        >>> ExtendedContext.fma(1, 3, Decimal(4))
        Decimal('7')
        T)r�)r/)r�r�)r.rrSr+r'r'r)r��szContext.fmacCst|t�std��|j�S)aReturn True if the operand is canonical; otherwise return False.

        Currently, the encoding of a Decimal instance is always
        canonical, so this method returns True for any Decimal.

        >>> ExtendedContext.is_canonical(Decimal('2.50'))
        True
        z/is_canonical requires a Decimal as an argument.)r_rrrr;)r.rr'r'r)r;�s	
zContext.is_canonicalcCst|dd�}|j�S)a,Return True if the operand is finite; otherwise return False.

        A Decimal instance is considered finite if it is neither
        infinite nor a NaN.

        >>> ExtendedContext.is_finite(Decimal('2.50'))
        True
        >>> ExtendedContext.is_finite(Decimal('-0.3'))
        True
        >>> ExtendedContext.is_finite(Decimal('0'))
        True
        >>> ExtendedContext.is_finite(Decimal('Inf'))
        False
        >>> ExtendedContext.is_finite(Decimal('NaN'))
        False
        >>> ExtendedContext.is_finite(1)
        True
        T)r�)r�r<)r.rr'r'r)r<�szContext.is_finitecCst|dd�}|j�S)aUReturn True if the operand is infinite; otherwise return False.

        >>> ExtendedContext.is_infinite(Decimal('2.50'))
        False
        >>> ExtendedContext.is_infinite(Decimal('-Inf'))
        True
        >>> ExtendedContext.is_infinite(Decimal('NaN'))
        False
        >>> ExtendedContext.is_infinite(1)
        False
        T)r�)r�r#)r.rr'r'r)r#�szContext.is_infinitecCst|dd�}|j�S)aOReturn True if the operand is a qNaN or sNaN;
        otherwise return False.

        >>> ExtendedContext.is_nan(Decimal('2.50'))
        False
        >>> ExtendedContext.is_nan(Decimal('NaN'))
        True
        >>> ExtendedContext.is_nan(Decimal('-sNaN'))
        True
        >>> ExtendedContext.is_nan(1)
        False
        T)r�)r�r�)r.rr'r'r)r��s
zContext.is_nancCst|dd�}|j|d�S)a�Return True if the operand is a normal number;
        otherwise return False.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.is_normal(Decimal('2.50'))
        True
        >>> c.is_normal(Decimal('0.1E-999'))
        False
        >>> c.is_normal(Decimal('0.00'))
        False
        >>> c.is_normal(Decimal('-Inf'))
        False
        >>> c.is_normal(Decimal('NaN'))
        False
        >>> c.is_normal(1)
        True
        T)r�)r/)r�r=)r.rr'r'r)r=�szContext.is_normalcCst|dd�}|j�S)aHReturn True if the operand is a quiet NaN; otherwise return False.

        >>> ExtendedContext.is_qnan(Decimal('2.50'))
        False
        >>> ExtendedContext.is_qnan(Decimal('NaN'))
        True
        >>> ExtendedContext.is_qnan(Decimal('sNaN'))
        False
        >>> ExtendedContext.is_qnan(1)
        False
        T)r�)r�r�)r.rr'r'r)r�szContext.is_qnancCst|dd�}|j�S)a�Return True if the operand is negative; otherwise return False.

        >>> ExtendedContext.is_signed(Decimal('2.50'))
        False
        >>> ExtendedContext.is_signed(Decimal('-12'))
        True
        >>> ExtendedContext.is_signed(Decimal('-0'))
        True
        >>> ExtendedContext.is_signed(8)
        False
        >>> ExtendedContext.is_signed(-8)
        True
        T)r�)r�r>)r.rr'r'r)r>szContext.is_signedcCst|dd�}|j�S)aTReturn True if the operand is a signaling NaN;
        otherwise return False.

        >>> ExtendedContext.is_snan(Decimal('2.50'))
        False
        >>> ExtendedContext.is_snan(Decimal('NaN'))
        False
        >>> ExtendedContext.is_snan(Decimal('sNaN'))
        True
        >>> ExtendedContext.is_snan(1)
        False
        T)r�)r�r�)r.rr'r'r)r�$s
zContext.is_snancCst|dd�}|j|d�S)a�Return True if the operand is subnormal; otherwise return False.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.is_subnormal(Decimal('2.50'))
        False
        >>> c.is_subnormal(Decimal('0.1E-999'))
        True
        >>> c.is_subnormal(Decimal('0.00'))
        False
        >>> c.is_subnormal(Decimal('-Inf'))
        False
        >>> c.is_subnormal(Decimal('NaN'))
        False
        >>> c.is_subnormal(1)
        False
        T)r�)r/)r�r?)r.rr'r'r)r?4szContext.is_subnormalcCst|dd�}|j�S)auReturn True if the operand is a zero; otherwise return False.

        >>> ExtendedContext.is_zero(Decimal('0'))
        True
        >>> ExtendedContext.is_zero(Decimal('2.50'))
        False
        >>> ExtendedContext.is_zero(Decimal('-0E+2'))
        True
        >>> ExtendedContext.is_zero(1)
        False
        >>> ExtendedContext.is_zero(0)
        True
        T)r�)r�r@)r.rr'r'r)r@JszContext.is_zerocCst|dd�}|j|d�S)a�Returns the natural (base e) logarithm of the operand.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.ln(Decimal('0'))
        Decimal('-Infinity')
        >>> c.ln(Decimal('1.000'))
        Decimal('0')
        >>> c.ln(Decimal('2.71828183'))
        Decimal('1.00000000')
        >>> c.ln(Decimal('10'))
        Decimal('2.30258509')
        >>> c.ln(Decimal('+Infinity'))
        Decimal('Infinity')
        >>> c.ln(1)
        Decimal('0')
        T)r�)r/)r�rH)r.rr'r'r)rH[sz
Context.lncCst|dd�}|j|d�S)a�Returns the base 10 logarithm of the operand.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.log10(Decimal('0'))
        Decimal('-Infinity')
        >>> c.log10(Decimal('0.001'))
        Decimal('-3')
        >>> c.log10(Decimal('1.000'))
        Decimal('0')
        >>> c.log10(Decimal('2'))
        Decimal('0.301029996')
        >>> c.log10(Decimal('10'))
        Decimal('1')
        >>> c.log10(Decimal('70'))
        Decimal('1.84509804')
        >>> c.log10(Decimal('+Infinity'))
        Decimal('Infinity')
        >>> c.log10(0)
        Decimal('-Infinity')
        >>> c.log10(1)
        Decimal('0')
        T)r�)r/)r�rK)r.rr'r'r)rKqsz
Context.log10cCst|dd�}|j|d�S)a4 Returns the exponent of the magnitude of the operand's MSD.

        The result is the integer which is the exponent of the magnitude
        of the most significant digit of the operand (as though the
        operand were truncated to a single digit while maintaining the
        value of that digit and without limiting the resulting exponent).

        >>> ExtendedContext.logb(Decimal('250'))
        Decimal('2')
        >>> ExtendedContext.logb(Decimal('2.50'))
        Decimal('0')
        >>> ExtendedContext.logb(Decimal('0.03'))
        Decimal('-2')
        >>> ExtendedContext.logb(Decimal('0'))
        Decimal('-Infinity')
        >>> ExtendedContext.logb(1)
        Decimal('0')
        >>> ExtendedContext.logb(10)
        Decimal('1')
        >>> ExtendedContext.logb(100)
        Decimal('2')
        T)r�)r/)r�rL)r.rr'r'r)rL�szContext.logbcCst|dd�}|j||d�S)a�Applies the logical operation 'and' between each operand's digits.

        The operands must be both logical numbers.

        >>> ExtendedContext.logical_and(Decimal('0'), Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.logical_and(Decimal('0'), Decimal('1'))
        Decimal('0')
        >>> ExtendedContext.logical_and(Decimal('1'), Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.logical_and(Decimal('1'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.logical_and(Decimal('1100'), Decimal('1010'))
        Decimal('1000')
        >>> ExtendedContext.logical_and(Decimal('1111'), Decimal('10'))
        Decimal('10')
        >>> ExtendedContext.logical_and(110, 1101)
        Decimal('100')
        >>> ExtendedContext.logical_and(Decimal(110), 1101)
        Decimal('100')
        >>> ExtendedContext.logical_and(110, Decimal(1101))
        Decimal('100')
        T)r�)r/)r�rV)r.rrSr'r'r)rV�szContext.logical_andcCst|dd�}|j|d�S)aInvert all the digits in the operand.

        The operand must be a logical number.

        >>> ExtendedContext.logical_invert(Decimal('0'))
        Decimal('111111111')
        >>> ExtendedContext.logical_invert(Decimal('1'))
        Decimal('111111110')
        >>> ExtendedContext.logical_invert(Decimal('111111111'))
        Decimal('0')
        >>> ExtendedContext.logical_invert(Decimal('101010101'))
        Decimal('10101010')
        >>> ExtendedContext.logical_invert(1101)
        Decimal('111110010')
        T)r�)r/)r�rX)r.rr'r'r)rX�szContext.logical_invertcCst|dd�}|j||d�S)a�Applies the logical operation 'or' between each operand's digits.

        The operands must be both logical numbers.

        >>> ExtendedContext.logical_or(Decimal('0'), Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.logical_or(Decimal('0'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.logical_or(Decimal('1'), Decimal('0'))
        Decimal('1')
        >>> ExtendedContext.logical_or(Decimal('1'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.logical_or(Decimal('1100'), Decimal('1010'))
        Decimal('1110')
        >>> ExtendedContext.logical_or(Decimal('1110'), Decimal('10'))
        Decimal('1110')
        >>> ExtendedContext.logical_or(110, 1101)
        Decimal('1111')
        >>> ExtendedContext.logical_or(Decimal(110), 1101)
        Decimal('1111')
        >>> ExtendedContext.logical_or(110, Decimal(1101))
        Decimal('1111')
        T)r�)r/)r�rY)r.rrSr'r'r)rY�szContext.logical_orcCst|dd�}|j||d�S)a�Applies the logical operation 'xor' between each operand's digits.

        The operands must be both logical numbers.

        >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('0'))
        Decimal('1')
        >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('1'))
        Decimal('0')
        >>> ExtendedContext.logical_xor(Decimal('1100'), Decimal('1010'))
        Decimal('110')
        >>> ExtendedContext.logical_xor(Decimal('1111'), Decimal('10'))
        Decimal('1101')
        >>> ExtendedContext.logical_xor(110, 1101)
        Decimal('1011')
        >>> ExtendedContext.logical_xor(Decimal(110), 1101)
        Decimal('1011')
        >>> ExtendedContext.logical_xor(110, Decimal(1101))
        Decimal('1011')
        T)r�)r/)r�rW)r.rrSr'r'r)rW�szContext.logical_xorcCst|dd�}|j||d�S)a�max compares two values numerically and returns the maximum.

        If either operand is a NaN then the general rules apply.
        Otherwise, the operands are compared as though by the compare
        operation.  If they are numerically equal then the left-hand operand
        is chosen as the result.  Otherwise the maximum (closer to positive
        infinity) of the two operands is chosen as the result.

        >>> ExtendedContext.max(Decimal('3'), Decimal('2'))
        Decimal('3')
        >>> ExtendedContext.max(Decimal('-10'), Decimal('3'))
        Decimal('3')
        >>> ExtendedContext.max(Decimal('1.0'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.max(Decimal('7'), Decimal('NaN'))
        Decimal('7')
        >>> ExtendedContext.max(1, 2)
        Decimal('2')
        >>> ExtendedContext.max(Decimal(1), 2)
        Decimal('2')
        >>> ExtendedContext.max(1, Decimal(2))
        Decimal('2')
        T)r�)r/)r�r�)r.rrSr'r'r)r�szContext.maxcCst|dd�}|j||d�S)a�Compares the values numerically with their sign ignored.

        >>> ExtendedContext.max_mag(Decimal('7'), Decimal('NaN'))
        Decimal('7')
        >>> ExtendedContext.max_mag(Decimal('7'), Decimal('-10'))
        Decimal('-10')
        >>> ExtendedContext.max_mag(1, -2)
        Decimal('-2')
        >>> ExtendedContext.max_mag(Decimal(1), -2)
        Decimal('-2')
        >>> ExtendedContext.max_mag(1, Decimal(-2))
        Decimal('-2')
        T)r�)r/)r�rZ)r.rrSr'r'r)rZ&szContext.max_magcCst|dd�}|j||d�S)a�min compares two values numerically and returns the minimum.

        If either operand is a NaN then the general rules apply.
        Otherwise, the operands are compared as though by the compare
        operation.  If they are numerically equal then the left-hand operand
        is chosen as the result.  Otherwise the minimum (closer to negative
        infinity) of the two operands is chosen as the result.

        >>> ExtendedContext.min(Decimal('3'), Decimal('2'))
        Decimal('2')
        >>> ExtendedContext.min(Decimal('-10'), Decimal('3'))
        Decimal('-10')
        >>> ExtendedContext.min(Decimal('1.0'), Decimal('1'))
        Decimal('1.0')
        >>> ExtendedContext.min(Decimal('7'), Decimal('NaN'))
        Decimal('7')
        >>> ExtendedContext.min(1, 2)
        Decimal('1')
        >>> ExtendedContext.min(Decimal(1), 2)
        Decimal('1')
        >>> ExtendedContext.min(1, Decimal(29))
        Decimal('1')
        T)r�)r/)r�r�)r.rrSr'r'r)r�7szContext.mincCst|dd�}|j||d�S)a�Compares the values numerically with their sign ignored.

        >>> ExtendedContext.min_mag(Decimal('3'), Decimal('-2'))
        Decimal('-2')
        >>> ExtendedContext.min_mag(Decimal('-3'), Decimal('NaN'))
        Decimal('-3')
        >>> ExtendedContext.min_mag(1, -2)
        Decimal('1')
        >>> ExtendedContext.min_mag(Decimal(1), -2)
        Decimal('1')
        >>> ExtendedContext.min_mag(1, Decimal(-2))
        Decimal('1')
        T)r�)r/)r�r[)r.rrSr'r'r)r[RszContext.min_magcCst|dd�}|j|d�S)a�Minus corresponds to unary prefix minus in Python.

        The operation is evaluated using the same rules as subtract; the
        operation minus(a) is calculated as subtract('0', a) where the '0'
        has the same exponent as the operand.

        >>> ExtendedContext.minus(Decimal('1.3'))
        Decimal('-1.3')
        >>> ExtendedContext.minus(Decimal('-1.3'))
        Decimal('1.3')
        >>> ExtendedContext.minus(1)
        Decimal('-1')
        T)r�)r/)r�r�)r.rr'r'r)�minuscsz
Context.minuscCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a�multiply multiplies two operands.

        If either operand is a special value then the general rules apply.
        Otherwise, the operands are multiplied together
        ('long multiplication'), resulting in a number which may be as long as
        the sum of the lengths of the two operands.

        >>> ExtendedContext.multiply(Decimal('1.20'), Decimal('3'))
        Decimal('3.60')
        >>> ExtendedContext.multiply(Decimal('7'), Decimal('3'))
        Decimal('21')
        >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('0.8'))
        Decimal('0.72')
        >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('-0'))
        Decimal('-0.0')
        >>> ExtendedContext.multiply(Decimal('654321'), Decimal('654321'))
        Decimal('4.28135971E+11')
        >>> ExtendedContext.multiply(7, 7)
        Decimal('49')
        >>> ExtendedContext.multiply(Decimal(7), 7)
        Decimal('49')
        >>> ExtendedContext.multiply(7, Decimal(7))
        Decimal('49')
        T)r�)r/zUnable to convert %s to DecimalN)r�r�r�rr)r.rrSr�r'r'r)�multiplyts
zContext.multiplycCst|dd�}|j|d�S)a"Returns the largest representable number smaller than a.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> ExtendedContext.next_minus(Decimal('1'))
        Decimal('0.999999999')
        >>> c.next_minus(Decimal('1E-1007'))
        Decimal('0E-1007')
        >>> ExtendedContext.next_minus(Decimal('-1.00000003'))
        Decimal('-1.00000004')
        >>> c.next_minus(Decimal('Infinity'))
        Decimal('9.99999999E+999')
        >>> c.next_minus(1)
        Decimal('0.999999999')
        T)r�)r/)r�r^)r.rr'r'r)r^�szContext.next_minuscCst|dd�}|j|d�S)aReturns the smallest representable number larger than a.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> ExtendedContext.next_plus(Decimal('1'))
        Decimal('1.00000001')
        >>> c.next_plus(Decimal('-1E-1007'))
        Decimal('-0E-1007')
        >>> ExtendedContext.next_plus(Decimal('-1.00000003'))
        Decimal('-1.00000002')
        >>> c.next_plus(Decimal('-Infinity'))
        Decimal('-9.99999999E+999')
        >>> c.next_plus(1)
        Decimal('1.00000001')
        T)r�)r/)r�r_)r.rr'r'r)r_�szContext.next_pluscCst|dd�}|j||d�S)a�Returns the number closest to a, in direction towards b.

        The result is the closest representable number from the first
        operand (but not the first operand) that is in the direction
        towards the second operand, unless the operands have the same
        value.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.next_toward(Decimal('1'), Decimal('2'))
        Decimal('1.00000001')
        >>> c.next_toward(Decimal('-1E-1007'), Decimal('1'))
        Decimal('-0E-1007')
        >>> c.next_toward(Decimal('-1.00000003'), Decimal('0'))
        Decimal('-1.00000002')
        >>> c.next_toward(Decimal('1'), Decimal('0'))
        Decimal('0.999999999')
        >>> c.next_toward(Decimal('1E-1007'), Decimal('-100'))
        Decimal('0E-1007')
        >>> c.next_toward(Decimal('-1.00000003'), Decimal('-10'))
        Decimal('-1.00000004')
        >>> c.next_toward(Decimal('0.00'), Decimal('-0.0000'))
        Decimal('-0.00')
        >>> c.next_toward(0, 1)
        Decimal('1E-1007')
        >>> c.next_toward(Decimal(0), 1)
        Decimal('1E-1007')
        >>> c.next_toward(0, Decimal(1))
        Decimal('1E-1007')
        T)r�)r/)r�r`)r.rrSr'r'r)r`�s zContext.next_towardcCst|dd�}|j|d�S)a�normalize reduces an operand to its simplest form.

        Essentially a plus operation with all trailing zeros removed from the
        result.

        >>> ExtendedContext.normalize(Decimal('2.1'))
        Decimal('2.1')
        >>> ExtendedContext.normalize(Decimal('-2.0'))
        Decimal('-2')
        >>> ExtendedContext.normalize(Decimal('1.200'))
        Decimal('1.2')
        >>> ExtendedContext.normalize(Decimal('-120'))
        Decimal('-1.2E+2')
        >>> ExtendedContext.normalize(Decimal('120.00'))
        Decimal('1.2E+2')
        >>> ExtendedContext.normalize(Decimal('0.00'))
        Decimal('0')
        >>> ExtendedContext.normalize(6)
        Decimal('6')
        T)r�)r/)r�r!)r.rr'r'r)r!�szContext.normalizecCst|dd�}|j|d�S)a�Returns an indication of the class of the operand.

        The class is one of the following strings:
          -sNaN
          -NaN
          -Infinity
          -Normal
          -Subnormal
          -Zero
          +Zero
          +Subnormal
          +Normal
          +Infinity

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.number_class(Decimal('Infinity'))
        '+Infinity'
        >>> c.number_class(Decimal('1E-10'))
        '+Normal'
        >>> c.number_class(Decimal('2.50'))
        '+Normal'
        >>> c.number_class(Decimal('0.1E-999'))
        '+Subnormal'
        >>> c.number_class(Decimal('0'))
        '+Zero'
        >>> c.number_class(Decimal('-0'))
        '-Zero'
        >>> c.number_class(Decimal('-0.1E-999'))
        '-Subnormal'
        >>> c.number_class(Decimal('-1E-10'))
        '-Normal'
        >>> c.number_class(Decimal('-2.50'))
        '-Normal'
        >>> c.number_class(Decimal('-Infinity'))
        '-Infinity'
        >>> c.number_class(Decimal('NaN'))
        'NaN'
        >>> c.number_class(Decimal('-NaN'))
        'NaN'
        >>> c.number_class(Decimal('sNaN'))
        'sNaN'
        >>> c.number_class(123)
        '+Normal'
        T)r�)r/)r�rb)r.rr'r'r)rb�s/zContext.number_classcCst|dd�}|j|d�S)a�Plus corresponds to unary prefix plus in Python.

        The operation is evaluated using the same rules as add; the
        operation plus(a) is calculated as add('0', a) where the '0'
        has the same exponent as the operand.

        >>> ExtendedContext.plus(Decimal('1.3'))
        Decimal('1.3')
        >>> ExtendedContext.plus(Decimal('-1.3'))
        Decimal('-1.3')
        >>> ExtendedContext.plus(-1)
        Decimal('-1')
        T)r�)r/)r�r�)r.rr'r'r)�plus)szContext.pluscCs:t|dd�}|j|||d�}|tkr2td|��n|SdS)aRaises a to the power of b, to modulo if given.

        With two arguments, compute a**b.  If a is negative then b
        must be integral.  The result will be inexact unless b is
        integral and the result is finite and can be expressed exactly
        in 'precision' digits.

        With three arguments, compute (a**b) % modulo.  For the
        three argument form, the following restrictions on the
        arguments hold:

         - all three arguments must be integral
         - b must be nonnegative
         - at least one of a or b must be nonzero
         - modulo must be nonzero and have at most 'precision' digits

        The result of pow(a, b, modulo) is identical to the result
        that would be obtained by computing (a**b) % modulo with
        unbounded precision, but is computed more efficiently.  It is
        always exact.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.power(Decimal('2'), Decimal('3'))
        Decimal('8')
        >>> c.power(Decimal('-2'), Decimal('3'))
        Decimal('-8')
        >>> c.power(Decimal('2'), Decimal('-3'))
        Decimal('0.125')
        >>> c.power(Decimal('1.7'), Decimal('8'))
        Decimal('69.7575744')
        >>> c.power(Decimal('10'), Decimal('0.301029996'))
        Decimal('2.00000000')
        >>> c.power(Decimal('Infinity'), Decimal('-1'))
        Decimal('0')
        >>> c.power(Decimal('Infinity'), Decimal('0'))
        Decimal('1')
        >>> c.power(Decimal('Infinity'), Decimal('1'))
        Decimal('Infinity')
        >>> c.power(Decimal('-Infinity'), Decimal('-1'))
        Decimal('-0')
        >>> c.power(Decimal('-Infinity'), Decimal('0'))
        Decimal('1')
        >>> c.power(Decimal('-Infinity'), Decimal('1'))
        Decimal('-Infinity')
        >>> c.power(Decimal('-Infinity'), Decimal('2'))
        Decimal('Infinity')
        >>> c.power(Decimal('0'), Decimal('0'))
        Decimal('NaN')

        >>> c.power(Decimal('3'), Decimal('7'), Decimal('16'))
        Decimal('11')
        >>> c.power(Decimal('-3'), Decimal('7'), Decimal('16'))
        Decimal('-11')
        >>> c.power(Decimal('-3'), Decimal('8'), Decimal('16'))
        Decimal('1')
        >>> c.power(Decimal('3'), Decimal('7'), Decimal('-16'))
        Decimal('11')
        >>> c.power(Decimal('23E12345'), Decimal('67E189'), Decimal('123456789'))
        Decimal('11729830')
        >>> c.power(Decimal('-0'), Decimal('17'), Decimal('1729'))
        Decimal('-0')
        >>> c.power(Decimal('-23'), Decimal('0'), Decimal('65537'))
        Decimal('1')
        >>> ExtendedContext.power(7, 7)
        Decimal('823543')
        >>> ExtendedContext.power(Decimal(7), 7)
        Decimal('823543')
        >>> ExtendedContext.power(7, Decimal(7), 2)
        Decimal('1')
        T)r�)r/zUnable to convert %s to DecimalN)r�rr�rr)r.rrSr�r�r'r'r)�power:s
Iz
Context.powercCst|dd�}|j||d�S)a
Returns a value equal to 'a' (rounded), having the exponent of 'b'.

        The coefficient of the result is derived from that of the left-hand
        operand.  It may be rounded using the current rounding setting (if the
        exponent is being increased), multiplied by a positive power of ten (if
        the exponent is being decreased), or is unchanged (if the exponent is
        already equal to that of the right-hand operand).

        Unlike other operations, if the length of the coefficient after the
        quantize operation would be greater than precision then an Invalid
        operation condition is raised.  This guarantees that, unless there is
        an error condition, the exponent of the result of a quantize is always
        equal to that of the right-hand operand.

        Also unlike other operations, quantize will never raise Underflow, even
        if the result is subnormal and inexact.

        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.001'))
        Decimal('2.170')
        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.01'))
        Decimal('2.17')
        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.1'))
        Decimal('2.2')
        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('1e+0'))
        Decimal('2')
        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('1e+1'))
        Decimal('0E+1')
        >>> ExtendedContext.quantize(Decimal('-Inf'), Decimal('Infinity'))
        Decimal('-Infinity')
        >>> ExtendedContext.quantize(Decimal('2'), Decimal('Infinity'))
        Decimal('NaN')
        >>> ExtendedContext.quantize(Decimal('-0.1'), Decimal('1'))
        Decimal('-0')
        >>> ExtendedContext.quantize(Decimal('-0'), Decimal('1e+5'))
        Decimal('-0E+5')
        >>> ExtendedContext.quantize(Decimal('+35236450.6'), Decimal('1e-2'))
        Decimal('NaN')
        >>> ExtendedContext.quantize(Decimal('-35236450.6'), Decimal('1e-2'))
        Decimal('NaN')
        >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e-1'))
        Decimal('217.0')
        >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e-0'))
        Decimal('217')
        >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e+1'))
        Decimal('2.2E+2')
        >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e+2'))
        Decimal('2E+2')
        >>> ExtendedContext.quantize(1, 2)
        Decimal('1')
        >>> ExtendedContext.quantize(Decimal(1), 2)
        Decimal('1')
        >>> ExtendedContext.quantize(1, Decimal(2))
        Decimal('1')
        T)r�)r/)r�r�)r.rrSr'r'r)r��s7zContext.quantizecCstd�S)zkJust returns 10, as this is Decimal, :)

        >>> ExtendedContext.radix()
        Decimal('10')
        r�)r)r.r'r'r)rc�sz
Context.radixcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)aReturns the remainder from integer division.

        The result is the residue of the dividend after the operation of
        calculating integer division as described for divide-integer, rounded
        to precision digits if necessary.  The sign of the result, if
        non-zero, is the same as that of the original dividend.

        This operation will fail under the same conditions as integer division
        (that is, if integer division on the same two operands would fail, the
        remainder cannot be calculated).

        >>> ExtendedContext.remainder(Decimal('2.1'), Decimal('3'))
        Decimal('2.1')
        >>> ExtendedContext.remainder(Decimal('10'), Decimal('3'))
        Decimal('1')
        >>> ExtendedContext.remainder(Decimal('-10'), Decimal('3'))
        Decimal('-1')
        >>> ExtendedContext.remainder(Decimal('10.2'), Decimal('1'))
        Decimal('0.2')
        >>> ExtendedContext.remainder(Decimal('10'), Decimal('0.3'))
        Decimal('0.1')
        >>> ExtendedContext.remainder(Decimal('3.6'), Decimal('1.3'))
        Decimal('1.0')
        >>> ExtendedContext.remainder(22, 6)
        Decimal('4')
        >>> ExtendedContext.remainder(Decimal(22), 6)
        Decimal('4')
        >>> ExtendedContext.remainder(22, Decimal(6))
        Decimal('4')
        T)r�)r/zUnable to convert %s to DecimalN)r�r�r�rr)r.rrSr�r'r'r)r��s
zContext.remaindercCst|dd�}|j||d�S)aGReturns to be "a - b * n", where n is the integer nearest the exact
        value of "x / b" (if two integers are equally near then the even one
        is chosen).  If the result is equal to 0 then its sign will be the
        sign of a.

        This operation will fail under the same conditions as integer division
        (that is, if integer division on the same two operands would fail, the
        remainder cannot be calculated).

        >>> ExtendedContext.remainder_near(Decimal('2.1'), Decimal('3'))
        Decimal('-0.9')
        >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('6'))
        Decimal('-2')
        >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('3'))
        Decimal('1')
        >>> ExtendedContext.remainder_near(Decimal('-10'), Decimal('3'))
        Decimal('-1')
        >>> ExtendedContext.remainder_near(Decimal('10.2'), Decimal('1'))
        Decimal('0.2')
        >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('0.3'))
        Decimal('0.1')
        >>> ExtendedContext.remainder_near(Decimal('3.6'), Decimal('1.3'))
        Decimal('-0.3')
        >>> ExtendedContext.remainder_near(3, 11)
        Decimal('3')
        >>> ExtendedContext.remainder_near(Decimal(3), 11)
        Decimal('3')
        >>> ExtendedContext.remainder_near(3, Decimal(11))
        Decimal('3')
        T)r�)r/)r�r�)r.rrSr'r'r)r��szContext.remainder_nearcCst|dd�}|j||d�S)aNReturns a rotated copy of a, b times.

        The coefficient of the result is a rotated copy of the digits in
        the coefficient of the first operand.  The number of places of
        rotation is taken from the absolute value of the second operand,
        with the rotation being to the left if the second operand is
        positive or to the right otherwise.

        >>> ExtendedContext.rotate(Decimal('34'), Decimal('8'))
        Decimal('400000003')
        >>> ExtendedContext.rotate(Decimal('12'), Decimal('9'))
        Decimal('12')
        >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('-2'))
        Decimal('891234567')
        >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('0'))
        Decimal('123456789')
        >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('+2'))
        Decimal('345678912')
        >>> ExtendedContext.rotate(1333333, 1)
        Decimal('13333330')
        >>> ExtendedContext.rotate(Decimal(1333333), 1)
        Decimal('13333330')
        >>> ExtendedContext.rotate(1333333, Decimal(1))
        Decimal('13333330')
        T)r�)r/)r�rg)r.rrSr'r'r)rgszContext.rotatecCst|dd�}|j|�S)a�Returns True if the two operands have the same exponent.

        The result is never affected by either the sign or the coefficient of
        either operand.

        >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('0.001'))
        False
        >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('0.01'))
        True
        >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('1'))
        False
        >>> ExtendedContext.same_quantum(Decimal('Inf'), Decimal('-Inf'))
        True
        >>> ExtendedContext.same_quantum(10000, -1)
        True
        >>> ExtendedContext.same_quantum(Decimal(10000), -1)
        True
        >>> ExtendedContext.same_quantum(10000, Decimal(-1))
        True
        T)r�)r�r$)r.rrSr'r'r)r$1szContext.same_quantumcCst|dd�}|j||d�S)a3Returns the first operand after adding the second value its exp.

        >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('-2'))
        Decimal('0.0750')
        >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('0'))
        Decimal('7.50')
        >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('3'))
        Decimal('7.50E+3')
        >>> ExtendedContext.scaleb(1, 4)
        Decimal('1E+4')
        >>> ExtendedContext.scaleb(Decimal(1), 4)
        Decimal('1E+4')
        >>> ExtendedContext.scaleb(1, Decimal(4))
        Decimal('1E+4')
        T)r�)r/)r�rh)r.rrSr'r'r)rhIszContext.scalebcCst|dd�}|j||d�S)a{Returns a shifted copy of a, b times.

        The coefficient of the result is a shifted copy of the digits
        in the coefficient of the first operand.  The number of places
        to shift is taken from the absolute value of the second operand,
        with the shift being to the left if the second operand is
        positive or to the right otherwise.  Digits shifted into the
        coefficient are zeros.

        >>> ExtendedContext.shift(Decimal('34'), Decimal('8'))
        Decimal('400000000')
        >>> ExtendedContext.shift(Decimal('12'), Decimal('9'))
        Decimal('0')
        >>> ExtendedContext.shift(Decimal('123456789'), Decimal('-2'))
        Decimal('1234567')
        >>> ExtendedContext.shift(Decimal('123456789'), Decimal('0'))
        Decimal('123456789')
        >>> ExtendedContext.shift(Decimal('123456789'), Decimal('+2'))
        Decimal('345678900')
        >>> ExtendedContext.shift(88888888, 2)
        Decimal('888888800')
        >>> ExtendedContext.shift(Decimal(88888888), 2)
        Decimal('888888800')
        >>> ExtendedContext.shift(88888888, Decimal(2))
        Decimal('888888800')
        T)r�)r/)r�r�)r.rrSr'r'r)r�\sz
Context.shiftcCst|dd�}|j|d�S)a�Square root of a non-negative number to context precision.

        If the result must be inexact, it is rounded using the round-half-even
        algorithm.

        >>> ExtendedContext.sqrt(Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.sqrt(Decimal('-0'))
        Decimal('-0')
        >>> ExtendedContext.sqrt(Decimal('0.39'))
        Decimal('0.624499800')
        >>> ExtendedContext.sqrt(Decimal('100'))
        Decimal('10')
        >>> ExtendedContext.sqrt(Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.sqrt(Decimal('1.0'))
        Decimal('1.0')
        >>> ExtendedContext.sqrt(Decimal('1.00'))
        Decimal('1.0')
        >>> ExtendedContext.sqrt(Decimal('7'))
        Decimal('2.64575131')
        >>> ExtendedContext.sqrt(Decimal('10'))
        Decimal('3.16227766')
        >>> ExtendedContext.sqrt(2)
        Decimal('1.41421356')
        >>> ExtendedContext.prec
        9
        T)r�)r/)r�r-)r.rr'r'r)r-zszContext.sqrtcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a&Return the difference between the two operands.

        >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('1.07'))
        Decimal('0.23')
        >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('1.30'))
        Decimal('0.00')
        >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('2.07'))
        Decimal('-0.77')
        >>> ExtendedContext.subtract(8, 5)
        Decimal('3')
        >>> ExtendedContext.subtract(Decimal(8), 5)
        Decimal('3')
        >>> ExtendedContext.subtract(8, Decimal(5))
        Decimal('3')
        T)r�)r/zUnable to convert %s to DecimalN)r�r�r�rr)r.rrSr�r'r'r)�subtract�s
zContext.subtractcCst|dd�}|j|d�S)a�Convert to a string, using engineering notation if an exponent is needed.

        Engineering notation has an exponent which is a multiple of 3.  This
        can leave up to 3 digits to the left of the decimal place and may
        require the addition of either one or two trailing zeros.

        The operation is not affected by the context.

        >>> ExtendedContext.to_eng_string(Decimal('123E+1'))
        '1.23E+3'
        >>> ExtendedContext.to_eng_string(Decimal('123E+3'))
        '123E+3'
        >>> ExtendedContext.to_eng_string(Decimal('123E-10'))
        '12.3E-9'
        >>> ExtendedContext.to_eng_string(Decimal('-123E-12'))
        '-123E-12'
        >>> ExtendedContext.to_eng_string(Decimal('7E-7'))
        '700E-9'
        >>> ExtendedContext.to_eng_string(Decimal('7E+1'))
        '70'
        >>> ExtendedContext.to_eng_string(Decimal('0E+1'))
        '0.00E+3'

        T)r�)r/)r�r�)r.rr'r'r)r��szContext.to_eng_stringcCst|dd�}|j|d�S)zyConverts a number to a string, using scientific notation.

        The operation is not affected by the context.
        T)r�)r/)r�r�)r.rr'r'r)�
to_sci_string�szContext.to_sci_stringcCst|dd�}|j|d�S)akRounds to an integer.

        When the operand has a negative exponent, the result is the same
        as using the quantize() operation using the given operand as the
        left-hand-operand, 1E+0 as the right-hand-operand, and the precision
        of the operand as the precision setting; Inexact and Rounded flags
        are allowed in this operation.  The rounding mode is taken from the
        context.

        >>> ExtendedContext.to_integral_exact(Decimal('2.1'))
        Decimal('2')
        >>> ExtendedContext.to_integral_exact(Decimal('100'))
        Decimal('100')
        >>> ExtendedContext.to_integral_exact(Decimal('100.0'))
        Decimal('100')
        >>> ExtendedContext.to_integral_exact(Decimal('101.5'))
        Decimal('102')
        >>> ExtendedContext.to_integral_exact(Decimal('-101.5'))
        Decimal('-102')
        >>> ExtendedContext.to_integral_exact(Decimal('10E+5'))
        Decimal('1.0E+6')
        >>> ExtendedContext.to_integral_exact(Decimal('7.89E+77'))
        Decimal('7.89E+77')
        >>> ExtendedContext.to_integral_exact(Decimal('-Inf'))
        Decimal('-Infinity')
        T)r�)r/)r�r')r.rr'r'r)r'�szContext.to_integral_exactcCst|dd�}|j|d�S)aLRounds to an integer.

        When the operand has a negative exponent, the result is the same
        as using the quantize() operation using the given operand as the
        left-hand-operand, 1E+0 as the right-hand-operand, and the precision
        of the operand as the precision setting, except that no flags will
        be set.  The rounding mode is taken from the context.

        >>> ExtendedContext.to_integral_value(Decimal('2.1'))
        Decimal('2')
        >>> ExtendedContext.to_integral_value(Decimal('100'))
        Decimal('100')
        >>> ExtendedContext.to_integral_value(Decimal('100.0'))
        Decimal('100')
        >>> ExtendedContext.to_integral_value(Decimal('101.5'))
        Decimal('102')
        >>> ExtendedContext.to_integral_value(Decimal('-101.5'))
        Decimal('-102')
        >>> ExtendedContext.to_integral_value(Decimal('10E+5'))
        Decimal('1.0E+6')
        >>> ExtendedContext.to_integral_value(Decimal('7.89E+77'))
        Decimal('7.89E+77')
        >>> ExtendedContext.to_integral_value(Decimal('-Inf'))
        Decimal('-Infinity')
        T)r�)r/)r�r�)r.rr'r'r)r��szContext.to_integral_value)	NNNNNNNNN)N)rQ)N)Xr1r2r3r4r�r�r�r�r�rjr�rIr�r(rHrlrdr\r�r�r�r�r�r)r�r�rhr�r�r2r�r3r.r7r�r�r�r8r�r�r�rVr�r;r<r#r�r=r�r>r�r?r@rHrKrLrVrXrYrWr�rZr�r[r�r�r^r_r`r!rbr�r�r�rcr�r�rgr$rhr�r-r�r�r�r'r�r�r'r'r'r)rBs�
"



$#


%
 #2
P:&" c@s&eZdZd	Zd
dd�Zdd�ZeZdS)rir=rUrVNcCsf|dkrd|_d|_d|_nFt|t�rD|j|_t|j�|_|j|_n|d|_|d|_|d|_dS)Nr%r-r+)r=rUrVr_rr7r8rO)r.rtr'r'r)r�s



z_WorkRep.__init__cCsd|j|j|jfS)Nz(%r, %r, %r))r=rUrV)r.r'r'r)r�(sz_WorkRep.__repr__)r=rUrV)N)r1r2r3r|r�r�r�r'r'r'r)ris
ricCs�|j|jkr|}|}n|}|}tt|j��}tt|j��}|jtd||d�}||jd|krpd|_||_|jd|j|j9_|j|_||fS)zcNormalizes op1, op2 to have the same exp and length of coefficient.

    Done during addition.
    r-r+r�r�)rVrfr`rUr�)r�r�r@Ztmpr�Ztmp_lenZ	other_lenrVr'r'r)r�/sr�cCsb|dkrdS|dkr |d|Stt|��}t|�t|jd��}||krPdS|d|SdS)a Given integers n and e, return n * 10**e if it's an integer, else None.

    The computation is designed to avoid computing large powers of 10
    unnecessarily.

    >>> _decimal_lshift_exact(3, 4)
    30000
    >>> _decimal_lshift_exact(300, -999999999)  # returns None

    r%r�rQN)r`rhrf�rstrip)r5r�Zstr_nZval_nr'r'r)r	Osr	cCsF|dks|dkrtd��d}x$||kr@||||d?}}qW|S)z�Closest integer to the square root of the positive integer n.  a is
    an initial approximation to the square root.  Any positive integer
    will do for a, but the closer a is to the square root of n the
    faster convergence will be.

    r%z3Both arguments to _sqrt_nearest should be positive.r-)rl)r5rrSr'r'r)�
_sqrt_nearestds
r�cCs2d|>||?}}|d||d@|d@|kS)z�Given an integer x and a nonnegative integer shift, return closest
    integer to x / 2**shift; use round-to-even in case of a tie.

    r-r+r')rr�rSr�r'r'r)�_rshift_nearestssr�cCs&t||�\}}|d||d@|kS)zaClosest integer to a/b, a and b positive integers; rounds to even
    in the case of a tie.

    r+r-)r�)rrSr�r�r'r'r)�_div_nearest{sr�rc		Cs�||}d}xn||kr*t|�||>|ksF||krzt|�||?|krzt||d>|t||t||�|��}|d7}qWtdtt|��d|�}t||�}t||�}x0t|ddd�D]}t||�t|||�}q�Wt|||�S)a�Integer approximation to M*log(x/M), with absolute error boundable
    in terms only of x/M.

    Given positive integers x and M, return an integer approximation to
    M * log(x/M).  For L = 8 and 0.1 <= x/M <= 10 the difference
    between the approximation and the exact result is at most 22.  For
    L = 8 and 1.0 <= x/M <= 10.0 the difference is at most 15.  In
    both cases these are upper bounds on the error; it will usually be
    much smaller.r%r-r�r[i����r�)rhr�r�r�rUrfr`r�)	r�M�Lr�R�TZyshift�wr�r'r'r)�_ilog�s

r�c
Cs�|d7}tt|��}||||dk}|dkr�d|}|||}|dkrZ|d|9}nt|d|�}t||�}t|�}t|||�}||}	nd}t|d|�}	t|	|d�S)z�Given integers c, e and p with c > 0, p >= 0, compute an integer
    approximation to 10**p * log10(c*10**e), with an absolute error of
    at most 1.  Assumes that c*10**e is not exactly 1.r+r-r%r�r)rfr`r�r��
_log10_digits)
r+r�rr,r~r�r��log_dZlog_10Zlog_tenpowerr'r'r)rJ�s 

rJc	Cs�|d7}tt|��}||||dk}|dkrr|||}|dkrR|d|9}nt|d|�}t|d|�}nd}|r�ttt|���d}||dkr�t|t||�d|�}q�d}nd}t||d�S)z�Given integers c, e and p with c > 0, compute an integer
    approximation to 10**p * log(c*10**e), with an absolute error of
    at most 1.  Assumes that c*10**e is not exactly 1.r+r-r%r�r)rfr`r�r�rhr�)	r+r�rr,r~r�r�rZ	f_log_tenr'r'r)rG�s"rGc@s eZdZdZdd�Zdd�ZdS)�
_Log10Memoizez�Class to compute, store, and allow retrieval of, digits of the
    constant log(10) = 2.302585....  This constant is needed by
    Decimal.ln, Decimal.log10, Decimal.exp and Decimal.__pow__.cCs
d|_dS)NZ/23025850929940456840179914546843642076011014886)rx)r.r'r'r)r�sz_Log10Memoize.__init__cCs�|dkrtd��|t|j�kr�d}xLd||d}tttd||�d��}||d�d|krdP|d7}q$W|jd�dd
�|_t|jd|d	��S)ztGiven an integer p >= 0, return floor(10**p)*log(10).

        For example, self.getdigits(3) returns 2302.
        r%zp should be nonnegativer[r�r+rNrQr-r�)rlrfrxr`r�r�r�rU)r.rrr�rxr'r'r)�	getdigitss	z_Log10Memoize.getdigitsN)r1r2r3r4r�r�r'r'r'r)r�sr�c	Cs�t||>|�}tdtt|��d|�}t||�}||>}x.t|ddd�D]}t|||||�}qRWx6t|ddd	�D]"}||d>}t||||�}q�W||S)
z�Given integers x and M, M > 0, such that x/M is small in absolute
    value, compute an integer approximation to M*exp(x/M).  For 0 <=
    x/M <= 2.4, the absolute error in the result is bounded by 60 (and
    is usually much smaller).r�r[r-r%r+i����r�r�r�)rrUrfr`r�r�)	rr�r�r�r�rZMshiftrr�r'r'r)�_iexp&s
r�c	Cs�|d7}td|tt|��d�}||}||}|dkrH|d|}n|d|}t|t|��\}}t|d|�}tt|d|�d�||dfS)a�Compute an approximation to exp(c*10**e), with p decimal places of
    precision.

    Returns integers d, f such that:

      10**(p-1) <= d <= 10**p, and
      (d-1)*10**f < exp(c*10**e) < (d+1)*10**f

    In other words, d*10**f is an approximation to exp(c*10**e) with p
    digits of precision, and with an error in d of at most 1.  This is
    almost, but not quite, the same as the error being < 1ulp: when d
    = 10**(p-1) the error could be up to 10 ulp.r+r%r-r�i�r[)r�rfr`r�r�r�r�)	r+r�rrr�r�ZcshiftZquotrr'r'r)r9Ksr9cCs�ttt|���|}t||||d�}||}|dkrJ||d|}nt||d|�}|dkr�tt|��|dk|dkkr�d|ddd|}	}
q�d|d|}	}
n,t||d|d�\}	}
t|	d�}	|
d7}
|	|
fS)a5Given integers xc, xe, yc and ye representing Decimals x = xc*10**xe and
    y = yc*10**ye, compute x**y.  Returns a pair of integers (c, e) such that:

      10**(p-1) <= c <= 10**p, and
      (c-1)*10**e < x**y < (c+1)*10**e

    in other words, c*10**e is an approximation to x**y with p digits
    of precision, and with an error in c of at most 1.  (This is
    almost, but not quite, the same as the error being < 1ulp: when c
    == 10**(p-1) we can only guarantee error < 10ulp.)

    We assume that: x is positive and not equal to 1, and y is nonzero.
    r-r%r�)rfr`rhrGr�r9)r
rrrrrSZlxcr�Zpcr�rVr'r'r)ros
rr�F�5�(�rA�r�ry)	r��2�3�4�5�6�7�8r>cCs0|dkrtd��t|�}dt|�||dS)z@Compute a lower bound for 100*log10(c) for a positive integer c.r%z0The argument to _log10_lb should be nonnegative.r)rlr`rf)r+Z
correctionZstr_cr'r'r)r
�sr
cCsLt|t�r|St|t�r t|�S|r8t|t�r8tj|�S|rHtd|��tS)z�Convert other to Decimal.

    Verifies that it's ok to use in an implicit construction.
    If allow_float is true, allow conversion from float;  this
    is used in the comparison methods (__eq__ and friends).

    zUnable to convert %s to Decimal)r_rrUrprqrrr�)r�r�Zallow_floatr'r'r)r��s


r�cCs�t|t�r||fSt|tj�rR|jsDt|jtt|j	�|j
�|j�}|t|j�fS|rrt|tj
�rr|jdkrr|j}t|t�r�t�}|r�d|jt<n|jtd�|tj|�fSttfS)z�Given a Decimal instance self and a Python object other, return
    a pair (s, o) of Decimal instances such that "s op o" is
    equivalent to "self op other" for any of the 6 comparison
    operators "op".

    r%r-z;strict semantics for mixing floats and Decimals are enabled)r_r�_numbersZRationalrPr6r7r`rUr8�denominatorrO�	numeratorZComplexr�r�rprrrrdrqr�)r.r�r�r/r'r'r)r��s$

r�ri?B)r@r?rrrAr"r�r�r\)r@r?rra�        # A numeric string consists of:
#    \s*
    (?P<sign>[-+])?              # an optional sign, followed by either...
    (
        (?=\d|\.\d)              # ...a number (with at least one digit)
        (?P<int>\d*)             # having a (possibly empty) integer part
        (\.(?P<frac>\d*))?       # followed by an optional fractional part
        (E(?P<exp>[-+]?\d+))?    # followed by an optional exponent, or...
    |
        Inf(inity)?              # ...an infinity, or...
    |
        (?P<signal>s)?           # ...an (optionally signaling)
        NaN                      # NaN
        (?P<diag>\d*)            # with (possibly empty) diagnostic info.
    )
#    \s*
    \Z
z0*$z50*$z�\A
(?:
   (?P<fill>.)?
   (?P<align>[<>=^])
)?
(?P<sign>[-+ ])?
(?P<alt>\#)?
(?P<zeropad>0)?
(?P<minimumwidth>(?!0)\d+)?
(?P<thousands_sep>,)?
(?:\.(?P<precision>0|(?!0)\d+))?
(?P<type>[eEfFgGn%])?
\Z
cCs�tj|�}|dkrtd|��|j�}|d}|d}|ddk	|d<|drv|dk	rbtd|��|dk	rvtd|��|p|d|d<|p�d	|d<|d
dkr�d|d
<t|dp�d
�|d<|ddk	r�t|d�|d<|ddkr�|ddks�|ddkr�d|d<|ddk�rfd|d<|dk�r&tj�}|ddk	�r@td|��|d|d<|d|d<|d|d<n*|ddk�r|d|d<ddg|d<d|d<|S)a�Parse and validate a format specifier.

    Turns a standard numeric format specifier into a dict, with the
    following entries:

      fill: fill character to pad field to minimum width
      align: alignment type, either '<', '>', '=' or '^'
      sign: either '+', '-' or ' '
      minimumwidth: nonnegative integer giving minimum width
      zeropad: boolean, indicating whether to pad with zeros
      thousands_sep: string to use as thousands separator, or ''
      grouping: grouping for thousands separators, in format
        used by localeconv
      decimal_point: string to use for decimal point
      precision: nonnegative integer giving precision, or None
      type: one of the characters 'eEfFgG%', or None

    NzInvalid format specifier: �fill�align�zeropadz7Fill character conflicts with '0' in format specifier: z2Alignment conflicts with '0' in format specifier: � �>r=rT�minimumwidthrQrsr%rkZgGnr-r5rq�
thousands_sepzJExplicit thousands separator conflicts with 'n' type in format specifier: �grouping�
decimal_pointrSr[r�)�_parse_format_specifier_regex�matchrl�	groupdictrU�_locale�
localeconv)�format_specroruZformat_dictr�r�r'r'r)ruDsN

ruc	Cs�|d}|d}||t|�t|�}|d}|dkrF|||}nj|dkr\|||}nT|dkrr|||}n>|dkr�t|�d}|d	|�||||d	�}ntd
��|S)z�Given an unpadded, non-aligned numeric string 'body' and sign
    string 'sign', add padding and alignment conforming to the given
    format specifier dictionary 'spec' (as produced by
    parse_format_specifier).

    r�r�r��<r��=�^r+NzUnrecognised alignment field)rfrl)	r=rzryr�r�Zpaddingr�r�Zhalfr'r'r)rw�s"rwcCspddlm}m}|sgS|ddkrJt|�dkrJ||dd�||d	��S|d
tjkrd|dd�Std��dS)zyConvert a localeconv-style grouping into a (possibly infinite)
    iterable of integers representing group lengths.

    r%)�chain�repeatr-r+Nz unrecognised format for groupingr�r�r�r�r�)�	itertoolsr�r�rfr��CHAR_MAXrl)r�r�r�r'r'r)�_group_lengths�s
r�cCs�|d}|d}g}x�t|�D]�}|dkr2td��ttt|�|d�|�}|jd|t|�||d��|d|�}||8}|r�|dkr�P|t|�8}qWtt|�|d�}|jd|t|�||d��|jt|��S)anInsert thousands separators into a digit string.

    spec is a dictionary whose keys should include 'thousands_sep' and
    'grouping'; typically it's the result of parsing the format
    specifier using _parse_format_specifier.

    The min_width keyword argument gives the minimum length of the
    result, which will be padded on the left with zeros if necessary.

    If necessary, the zero padding adds an extra '0' on the left to
    avoid a leading thousands separator.  For example, inserting
    commas every three digits in '123456', with min_width=8, gives
    '0,123,456', even though that has length 9.

    r�r�r%zgroup length should be positiver-rQN)r�rlr�r�rfrmrn�reversed)rxry�	min_width�sepr��groupsr,r'r'r)�_insert_thousands_sep�s $$r�cCs$|rdS|ddkr|dSdSdS)zDetermine sign character.rTr=z +rSNr')�is_negativeryr'r'r)rv�s
rvcCs�t||�}|s|dr"|d|}|dks6|ddkr\ddddd�|d}|d	j||�7}|dd
krp|d
7}|dr�|dt|�t|�}nd}t|||�}t||||�S)
acFormat a number, given the following data:

    is_negative: true if the number is negative, else false
    intpart: string of digits that must appear before the decimal point
    fracpart: string of digits that must come after the point
    exp: exponent, as an integer
    spec: dictionary resulting from parsing the format specifier

    This function uses the information in spec to:
      insert separators (decimal separator and thousands separators)
      format the sign
      format the exponent
      add trailing '%' for the '%' type
      zero-pad if necessary
      fill and align if necessary
    Zaltr�r%rkrtr�r�)r�r�rrrqz{0}{1:+}rpr�r�)rv�formatrfr�rw)r�rvrwrVryr=Zecharr�r'r'r)rx�s
rxZInfz-Infr�ll����l������N�Zoi���)N)F)r%)r)r)FF)Fi���)N)r-r�)}r4�__all__r1rD�__version__Z__libmpdec_version__ZmathrzZnumbersr�rE�collectionsr&Z_namedtupler�ImportErrorrrrrrrrrr$�maxsizer r!r"r#�ArithmeticErrorrrr	r�ZeroDivisionErrorr
rrrrrr
rrrrrrr�r�rJr]rBrFrL�hasattrrKrGrrrrr6�Number�registerrNrrir�rUr}rr	r�r�r�r�rJrGr�r�r�r�r9rr
r�r�rrr�re�compile�VERBOSE�
IGNORECASEr�rar�r��DOTALLr�Zlocaler�rurwr�r�rvrxrFrEr:r5rr4r<�	hash_info�modulusr�rar�r�r�r�r�r'r'r'r)�<module>qs�


&



.

^

0",#
%$+
	

*

P
%
)quopri.cpython-36.opt-1.pyc000064400000012740150335715140011460 0ustar003


 \^�@s�dZddddgZdZdZdZdZyd	d
lmZmZWne	k
rPdZdZYnXdd
�Z
dd�Zddd�Zddd�Z
ddd�Zddd�Zdd�Zdd�Zdd�Zedkr�e�dS) zHConversions to/from quoted-printable transport encoding as per RFC 1521.�encode�decode�encodestring�decodestring�=�Ls0123456789ABCDEF��)�a2b_qp�b2a_qpNcCs:|dkr|S|dkr|S|tkp8d|ko2dknS)z�Decide whether a particular byte ordinal needs to be quoted.

    The 'quotetabs' flag indicates whether embedded tabs and spaces should be
    quoted.  Note that line-ending tabs and spaces are always encoded, as per
    RFC 1521.
    s 	�_� �~)�ESCAPE)�c�	quotetabs�header�r�/usr/lib64/python3.6/quopri.py�needsquotings
rcCs(t|�}ttt|dt|df�S)zQuote a single character.�)�ordr�bytes�HEX)rrrr�quote$srFc
Cs<tdk	r,|j�}t|||d�}|j|�dS|dfdd�}d}x�|j�}|sNPg}	d}
|dd�dkrv|dd
�}d}
xL|D]D}t|f�}t|||�r�t|�}|r�|dkr�|	jd	�q||	j|�q|W|dk	r�||�tj	|	�}x:t
|�tk�r||dtd�d
d�|tdd�}q�W|}q@W|dk	�r8|||
d�dS)avRead 'input', apply quoted-printable encoding, and write to 'output'.

    'input' and 'output' are binary file objects. The 'quotetabs' flag
    indicates whether embedded tabs and spaces should be quoted. Note that
    line-ending tabs and spaces are always encoded, as per RFC 1521.
    The 'header' flag indicates whether we are encoding spaces as _ as per RFC
    1522.N)rr�
cSsj|r<|dd�dkr<|j|dd�t|dd��|�n*|dkrX|jt|�|�n|j||�dS)N�s 	�.���rr)�writer)�s�output�lineEndrrrr;s
(zencode.<locals>.writerrrrs=
)r!rr)r
�readr�readlinerrr�append�EMPTYSTRING�join�len�MAXLINESIZE)
�inputr rr�data�odatarZprevline�lineZoutline�strippedrZthislinerrrr,s@	





cCsFtdk	rt|||d�Sddlm}||�}|�}t||||�|j�S)N)rrr)�BytesIO)r
�ior.r�getvalue)rrrr.�infp�outfprrrrjscCstdk	r*|j�}t||d�}|j|�dSd}�x�|j�}|s@Pdt|�}}|dkr�||d|�dkr�d}	|d}x.|dkr�||d|�dkr�|d}qxWnd}	�x.||k�r�|||d�}
|
dkr�|r�|d	}|d}q�|
tk�r�||
}|d}q�|d|k�r|	�rd}	Pq�|d|k�rV||d|d
�tk�rV|t}|d
}q�|d
|k�r�t||d|d
���r�t||d
|d���r�|tt||d|d��f�}|d}q�||
}|d}q�W|	s2|j|d�d}q2W|�r|j|�dS)z�Read 'input', apply quoted-printable decoding, and write to 'output'.
    'input' and 'output' are binary file objects.
    If 'header' is true, decode underscore as space (per RFC 1522).N)rrrrrs 	
rr��)	r	r"rr#r'r�ishexr�unhex)r)r rr*r+�newr,�i�n�partialrrrrrusR



(
B"
cCsDtdk	rt||d�Sddlm}||�}|�}t|||d�|j�S)N)rr)r.)r	r/r.rr0)rrr.r1r2rrrr�scCsHd|kodknpFd|ko*dknpFd|koBdkSS)zDReturn true if the byte ordinal 'c' is a hexadecimal digit in ASCII.�0�9�a�f�A�Fr)rrrrr5�sr5cCs�d}x�|D]�}t|f�}d|ko*dknr:td�}nLd|koLdknr`td�d}n&d	|kord
knr�td	�d}n|dt|�|}q
W|S)z.Get the integer value of a hexadecimal number.rr;r<�0r=r>�a�
r?r@r)rr)r�bitsrr8rrrr6�s


r6c(Cs�ddl}ddl}y|j|jdd�d�\}}WnV|jk
r�}z8|j|_t|�td�td�td�|jd�WYdd}~XnXd}d}x(|D] \}}|dkr�d}|d	kr�d}q�W|r�|r�|j|_td
�|jd�|s�dg}d}	x�|D]�}
|
dk�r|jj	}nNyt
|
d�}Wn>tk
�rR}z |jjd
|
|f�d}	w�WYdd}~XnXz*|�rlt
||jj	�nt||jj	|�Wd|
dk�r�|j�Xq�W|	�r�|j|	�dS)NrrZtdz"usage: quopri [-t | -d] [file] ...z-t: quote tabsz-d: decode; default encoder3z-tz-dz -t and -d are mutually exclusive�-�rbz%s: can't open (%s)
)�sys�getopt�argv�error�stderr�stdout�print�exit�stdin�buffer�open�OSErrorrrr�close)rGrHZopts�args�msgZdecoZtabs�orB�sts�file�fprrr�main�sT




rZ�__main__)F)FF)F)F)�__doc__�__all__rr(rr%Zbinasciir	r
�ImportErrorrrrrrrr5r6rZ�__name__rrrr�<module>s*

>

+
.posixpath.cpython-36.opt-1.pyc000064400000024722150335715140012163 0ustar003

�\dh�?�'@sfdZdZdZdZdZdZdZdZdZddl	Z	ddl
Z
ddlZddlZdd	lTd
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0g'Z
d1d2�Zd3d
�Zd4d�Zd5d�Zd6d�Zd7d�Zejje_d8d
�Zd9d�Zd:d�Zd;d�Zd<d�Zd=d�Zd>d�Zdadad?d�Zd@d�ZdAd �Z dBdC�dDd,�Z!dEdF�Z"e
j#dGkZ$dJdHd.�Z%dId/�Z&dS)Ka�Common operations on Posix pathnames.

Instead of importing this module directly, import os and refer to
this module as os.path.  The "os.path" name is an alias for this
module on Posix systems; on other systems (e.g. Mac, Windows),
os.path provides the same operations in a manner specific to that
platform, and is an alias to another module (e.g. macpath, ntpath).

Some of this can actually be useful on non-Posix systems too, e.g.
for manipulation of the pathname component of URLs.
�.z..�/�:z:/bin:/usr/binNz	/dev/null�)�*�normcase�isabs�join�
splitdrive�split�splitext�basename�dirname�commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�ismount�
expanduser�
expandvars�normpath�abspath�samefile�sameopenfile�samestat�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenames�relpath�
commonpath�
ALLOW_MISSINGcCst|t�rdSdSdS)N�/r)�
isinstance�bytes)�path�r1�!/usr/lib64/python3.6/posixpath.py�_get_sep)s
r3cCs.tj|�}t|ttf�s*tdj|jj���|S)z6Normalize case of pathname.  Has no effect under Posixz2normcase() argument must be str or bytes, not '{}')	�os�fspathr.r/�str�	TypeError�format�	__class__�__name__)�sr1r1r2r4s

cCstj|�}t|�}|j|�S)zTest whether a path is absolute)r4r5r3�
startswith)r;r"r1r1r2r@s
c
Gs�tj|�}t|�}|}yd|s,|dd�|xJttj|�D]:}|j|�rN|}q:|s^|j|�rh||7}q:|||7}q:WWn.tttfk
r�t	j
d|f|���YnX|S)z�Join two or more pathname components, inserting '/' as needed.
    If any component is an absolute path, all previous path components
    will be discarded.  An empty last part will result in a path that
    ends with a separator.Nrr)r4r5r3�mapr<�endswithr7�AttributeError�BytesWarning�genericpath�_check_arg_types)�a�pr"r0�br1r1r2rKs 


cCs`tj|�}t|�}|j|�d}|d|�||d�}}|rX||t|�krX|j|�}||fS)z�Split a pathname.  Returns tuple "(head, tail)" where "tail" is
    everything after the final slash.  Either part may be empty.�N)r4r5r3�rfind�len�rstrip)rDr"�i�head�tailr1r1r2r
hs

cCs6tj|�}t|t�rd}d}nd}d}tj||d|�S)Nr-�.rr)r4r5r.r/rA�	_splitext)rDr"r&r1r1r2rys

cCstj|�}|dd�|fS)zJSplit a pathname into drive and path. On Posix, drive is always
    empty.Nr)r4r5)rDr1r1r2r	�s
cCs,tj|�}t|�}|j|�d}||d�S)z)Returns the final component of a pathnamerFN)r4r5r3rG)rDr"rJr1r1r2r�s
cCsNtj|�}t|�}|j|�d}|d|�}|rJ||t|�krJ|j|�}|S)z-Returns the directory component of a pathnamerFN)r4r5r3rGrHrI)rDr"rJrKr1r1r2r
�s

cCs4ytj|�}Wnttfk
r&dSXtj|j�S)z&Test whether a path is a symbolic linkF)r4�lstat�OSErrorr?�stat�S_ISLNK�st_mode)r0�str1r1r2r�s
cCs(ytj|�Wntk
r"dSXdS)zCTest whether a path exists.  Returns True for broken symbolic linksFT)r4rOrP)r0r1r1r2r�s
cCs�ytj|�}Wntk
r"dSXtj|j�r4dSt|t�rJt|d�}n
t|d�}t	|�}ytj|�}Wntk
r~dSX|j
}|j
}||kr�dS|j}|j}||kr�dSdS)z$Test whether a path is a mount pointFs..z..T)r4rOrPrQrRrSr.r/rr(�st_dev�st_ino)r0�s1�parent�s2�dev1�dev2�ino1�ino2r1r1r2r�s.

c	Cs4tj|�}t|t�rd}nd}|j|�s,|St|�}|j|d�}|dkrPt|�}|dkr�dtjkr�ddl	}y|j
tj��j}Wq�t
k
r�|SXq�tjd}nRddl	}|d|�}t|t�r�t|d�}y|j|�}Wnt
k
r�|SX|j}t|t��rtj|�}d}nd	}|j|�}|||d��p2|S)
zOExpand ~ and ~user constructions.  If user or $HOME is unknown,
    do nothing.�~�~rFr�HOMEN�ASCIIr-r)r4r5r.r/r<r3�findrH�environ�pwd�getpwuid�getuid�pw_dir�KeyErrorr6�getpwnam�fsencoderI)	r0�tilder"rJrd�userhome�name�pwent�rootr1r1r2r�sB







cCs\tj|�}t|t�rVd|kr |Sts:ddl}|jd|j�atj}d}d}t	tdd�}n:d|krb|St
s|ddl}|jd	|j�a
t
j}d
}d}tj}d}x�|||�}|s�P|jd�\}}|j
d�}	|	j|�r�|	j|�r�|	dd
�}	y.|dk�rtjtjtj|	��}
n||	}
Wntk
�r&|}Yq�X||d�}|d|�|
}t|�}||7}q�W|S)zZExpand shell variables of form $var and ${var}.  Unknown variables
    are left unchanged.�$rNs\$(\w+|\{[^}]*\})�{�}�environb�$z\$(\w+|\{[^}]*\})�{�}rF���)r4r5r.r/�	_varprogb�re�compilera�search�getattr�_varprogrc�span�groupr<r>rj�fsdecoderhrH)r0ryr{�start�endrcrJ�m�jrm�valuerLr1r1r2rsP





c	Cs�tj|�}t|t�r&d}d}d}d}nd}d}d}d}||krB|S|j|�}|rr|j|d	�rr|j|d
�rrd	}|j|�}g}xV|D]N}|||fkr�q�||ks�|r�|s�|r�|d|kr�|j|�q�|r�|j�q�W|}|j|�}|r�|||}|p�|S)
z0Normalize path, eliminating double slashes, etc.r-�rMs..r�rz..��rFrw)	r4r5r.r/r<r
�append�popr)	r0r"�empty�dot�dotdot�initial_slashes�comps�	new_comps�compr1r1r2rRs>





cCs@tj|�}t|�s8t|t�r&tj�}ntj�}t||�}t|�S)zReturn an absolute path.)	r4r5rr.r/�getcwdb�getcwdrr)r0�cwdr1r1r2rxs



F)�strictcCs,tj|�}t|dd�||i�\}}t|�S)zlReturn the canonical path of the specified filename, eliminating any
symbolic links encountered in the path.Nr)r4r5�
_joinrealpathr)�filenamer�r0�okr1r1r2r(�s
c
Cs�t|t�rd}d}d}nd}d}d}tj}|tkr8t}n|rBf}nt}d}	t|�rb|dd�}|}�x"|�r�|j|�\}
}}|
sf|
|kr�qf|
|kr�|r�t	|�\}}
|
|kr�t
|||�}qf|}qft
||
�}ytj|�}
Wn|k
r�d}YnXtj
|
j�}|�s
|}qf||k�rH||}|dk	�r(qf|�r:tj|�nt
||�dfSd||<t|tj|�||�\}}|�s|t
||�dfS|||<qfW|d	fS)
Nr-rMs..rrz..rFFT)r.r/r4r�r,�FileNotFoundErrorrPr�	partitionr
rrOrQrRrSr��readlink)r0�restr��seenr"r r!r��
ignored_error�maxlinksrm�_�newpathrT�is_linkr�r1r1r2r��sd





r��darwinc	Cs�|std��tj|�}t|t�r.d}d}d}nd}d}d}|dkrH|}n
tj|�}ynd	d
�t|�j|�D�}dd
�t|�j|�D�}tt||g��}|gt|�|||d�}|s�|St	|�St
ttt
fk
r�tjd||��YnXdS)
z#Return a relative version of a pathzno path specifiedrMr-s..rrz..NcSsg|]}|r|�qSr1r1)�.0�xr1r1r2�
<listcomp>�szrelpath.<locals>.<listcomp>cSsg|]}|r|�qSr1r1)r�r�r1r1r2r��sr*)�
ValueErrorr4r5r.r/rr
rHrrr7r?r@�DeprecationWarningrArB)	r0r�r r"r!�
start_list�	path_listrJ�rel_listr1r1r2r*�s0


c	s2|std��tttj|��}t|dt�r4d�d�nd�d�yƇfdd�|D�}yt�fd	d
�|D��\}Wntk
r�td�d�YnX�fd
d�|D�}t|�}t	|�}|}x.t
|�D]"\}}|||kr�|d|�}Pq�W|r�n
�dd�}|�j|�Stt
fk
�r,tjd|���YnXdS)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr-rMrrcsg|]}|j���qSr1)r
)r�r0)r"r1r2r�szcommonpath.<locals>.<listcomp>c3s|]}|dd��kVqdS)NrFr1)r�rD)r"r1r2�	<genexpr>szcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathsNcsg|]}�fdd�|D��qS)csg|]}|r|�kr|�qSr1r1)r��c)r r1r2r�sz)commonpath.<locals>.<listcomp>.<listcomp>r1)r�r;)r r1r2r�sr+)r+)r��tupler=r4r5r.r/�set�min�max�	enumeraterr7r?rArB)	�paths�split_pathsrrWrY�commonrJr��prefixr1)r r"r2r+s6)N)'�__doc__r r!r&r"r#r$r%r'r4�sysrQrA�__all__r3rrrr
rrNr	rr
rrrrr}rxrrrr(r��platformr)r*r+r1r1r1r2�<module>sZ

	
	

*25&	F

)aifc.cpython-36.opt-1.pyc000064400000062531150335715140011046 0ustar003


 \�~�@s>dZddlZddlZddlZdddgZGdd�de�ZdZdd	�Zd
d�Z	dd
�Z
dd�Zdd�ZdZ
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zdd!lmZdd"lmZed#d$�Zd%ej_d&ej_d'ej_d(ej_d)ej_d*ej_Gd+d,�d,�Z Gd-d.�d.�Z!d@d/d�Z"e"Z#e$d0k�r:ddl%Z%e%j&d1d��sHe%j&j'd2�e%j&d1Z(e"e(d3���Z)e*d4e(�e*d5e)j+��e*d6e)j,��e*d7e)j-��e*d8e)j.��e*d9e)j/��e*d:e)j0��e%j&d;d��r0e%j&d;Z1e*d<e1�e"e1d=��8Z2e2j3e)j4��x"e)j5d>�Z6e6�sPe2j7e6��q�WWdQRXe*d?�WdQRXdS)AaJStuff to parse AIFF-C and AIFF files.

Unless explicitly stated otherwise, the description below is true
both for AIFF-C files and AIFF files.

An AIFF-C file has the following structure.

  +-----------------+
  | FORM            |
  +-----------------+
  | <size>          |
  +----+------------+
  |    | AIFC       |
  |    +------------+
  |    | <chunks>   |
  |    |    .       |
  |    |    .       |
  |    |    .       |
  +----+------------+

An AIFF file has the string "AIFF" instead of "AIFC".

A chunk consists of an identifier (4 bytes) followed by a size (4 bytes,
big endian order), followed by the data.  The size field does not include
the size of the 8 byte header.

The following chunk types are recognized.

  FVER
      <version number of AIFF-C defining document> (AIFF-C only).
  MARK
      <# of markers> (2 bytes)
      list of markers:
          <marker ID> (2 bytes, must be > 0)
          <position> (4 bytes)
          <marker name> ("pstring")
  COMM
      <# of channels> (2 bytes)
      <# of sound frames> (4 bytes)
      <size of the samples> (2 bytes)
      <sampling frequency> (10 bytes, IEEE 80-bit extended
          floating point)
      in AIFF-C files only:
      <compression type> (4 bytes)
      <human-readable version of compression type> ("pstring")
  SSND
      <offset> (4 bytes, not used by this program)
      <blocksize> (4 bytes, not used by this program)
      <sound data>

A pstring consists of 1 byte length, a string of characters, and 0 or 1
byte pad to make the total length even.

Usage.

Reading AIFF files:
  f = aifc.open(file, 'r')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods read(), seek(), and close().
In some types of audio files, if the setpos() method is not used,
the seek() method is not necessary.

This returns an instance of a class with the following public methods:
  getnchannels()  -- returns number of audio channels (1 for
             mono, 2 for stereo)
  getsampwidth()  -- returns sample width in bytes
  getframerate()  -- returns sampling frequency
  getnframes()    -- returns number of audio frames
  getcomptype()   -- returns compression type ('NONE' for AIFF files)
  getcompname()   -- returns human-readable version of
             compression type ('not compressed' for AIFF files)
  getparams() -- returns a namedtuple consisting of all of the
             above in the above order
  getmarkers()    -- get the list of marks in the audio file or None
             if there are no marks
  getmark(id) -- get mark with the specified id (raises an error
             if the mark does not exist)
  readframes(n)   -- returns at most n frames of audio
  rewind()    -- rewind to the beginning of the audio stream
  setpos(pos) -- seek to the specified position
  tell()      -- return the current position
  close()     -- close the instance (make it unusable)
The position returned by tell(), the position given to setpos() and
the position of marks are all compatible and have nothing to do with
the actual position in the file.
The close() method is called automatically when the class instance
is destroyed.

Writing AIFF files:
  f = aifc.open(file, 'w')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods write(), tell(), seek(), and
close().

This returns an instance of a class with the following public methods:
  aiff()      -- create an AIFF file (AIFF-C default)
  aifc()      -- create an AIFF-C file
  setnchannels(n) -- set the number of channels
  setsampwidth(n) -- set the sample width
  setframerate(n) -- set the frame rate
  setnframes(n)   -- set the number of frames
  setcomptype(type, name)
          -- set the compression type and the
             human-readable compression type
  setparams(tuple)
          -- set all parameters at once
  setmark(id, pos, name)
          -- add specified mark to the list of marks
  tell()      -- return current position in output file (useful
             in combination with setmark())
  writeframesraw(data)
          -- write audio frames without pathing up the
             file header
  writeframes(data)
          -- write audio frames and patch up the file header
  close()     -- patch up the file header and close the
             output file
You should set the parameters before the first writeframesraw or
writeframes.  The total number of frames does not need to be set,
but when it is set to the correct value, the header does not have to
be patched up.
It is best to first set all parameters, perhaps possibly the
compression type, and then write audio frames using writeframesraw.
When all frames have been written, either call writeframes(b'') or
close() to patch up the sizes in the header.
Marks can be added anytime.  If there are any marks, you must call
close() after all frames have been written.
The close() method is called automatically when the class instance
is destroyed.

When a file is opened with the extension '.aiff', an AIFF file is
written, otherwise an AIFF-C file is written.  This default can be
changed by calling aiff() or aifc() before the first writeframes or
writeframesraw.
�N�Error�open�openfpc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/aifc.pyr�sl@QEcCs6ytjd|jd��dStjk
r0t�YnXdS)Nz>l�r)�struct�unpack�read�error�EOFError)�filerrr	�
_read_long�srcCs6ytjd|jd��dStjk
r0t�YnXdS)Nz>Lr
r)rrr
rr)rrrr	�_read_ulong�srcCs6ytjd|jd��dStjk
r0t�YnXdS)Nz>h�r)rrr
rr)rrrr	�_read_short�srcCs6ytjd|jd��dStjk
r0t�YnXdS)Nz>Hrr)rrr
rr)rrrr	�_read_ushort�srcCs@t|jd��}|dkrd}n
|j|�}|d@dkr<|jd�}|S)N�r�)�ordr
)r�length�data�dummyrrr	�_read_string�s

rg�����cCs�t|�}d}|dkr d
}|d}t|�}t|�}||koL|koLdknrXd}n0|dkrft}n"|d}|d|td|d	�}||S)Nrri�gi�i�?lg@�?���)rr�	_HUGE_VAL�pow)�f�expon�sign�himant�lomantrrr	�_read_float�s"r&cCs|jtjd|��dS)Nz>h)�writer�pack)r!�xrrr	�_write_short�sr*cCs|jtjd|��dS)Nz>H)r'rr()r!r)rrr	�
_write_ushort�sr+cCs|jtjd|��dS)Nz>l)r'rr()r!r)rrr	�_write_long�sr,cCs|jtjd|��dS)Nz>L)r'rr()r!r)rrr	�_write_ulong�sr-cCsRt|�dkrtd��|jtjdt|���|j|�t|�d@dkrN|jd�dS)N�z%string exceeds maximum pstring length�Brr�)�len�
ValueErrorr'rr()r!�srrr	�
_write_string�s
r4c	Cs�ddl}|dkrd}|d}nd}|dkr8d}d}d}n�|j|�\}}|dks^|dks^||krp|dB}d}d}nh|d}|dkr�|j||�}d}||B}|j|d�}|j|�}t|�}|j||d�}|j|�}t|�}t||�t||�t||�dS)	Nri�ri@i�i�?� r)�mathZfrexpZldexpZfloor�intr+r-)	r!r)r6r#r"r$r%ZfmantZfsmantrrr	�_write_float�s8




r8)�Chunk)�
namedtuple�_aifc_paramsz7nchannels sampwidth framerate nframes comptype compnamez3Number of audio channels (1 for mono, 2 for stereo)zSample width in byteszSampling frequencyzNumber of audio framesz(Compression type ("NONE" for AIFF files)zRA human-readable version of the compression type
('not compressed' for AIFF files)c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�ZdS)2�	Aifc_readNcCs<d|_d|_g|_d|_||_t|�}|j�dkr:td��|jd�}|dkrTd|_	n|dkrdd|_	ntd��d|_
d|_x�d|_yt|j�}Wnt
k
r�PYnX|j�}|d	kr�|j|�d|_
nH|d
kr�||_|jd�}d|_n(|dkr�t|�|_n|d
k�r|j|�|j�qzW|j
�s0|j�r8td��dS)NrsFORMz file does not start with FORM idr
sAIFFsAIFCrznot an AIFF or AIFF-C filesCOMMsSSND�sFVERsMARKz$COMM chunk and/or SSND chunk missing)�_version�_convert�_markers�	_soundpos�_filer9Zgetnamerr
�_aifcZ_comm_chunk_read�_ssnd_chunk�_ssnd_seek_neededr�_read_comm_chunkr�	_readmark�skip)�selfr�chunkZformdataZ	chunknamerrrr	�initfp4sJ




zAifc_read.initfpc	CsLt|t�r>tj|d�}y|j|�WqH|j��YqHXn
|j|�dS)N�rb)�
isinstance�str�builtinsrrK�close)rIr!�file_objectrrr	�__init__\s

zAifc_read.__init__cCs|S)Nr)rIrrr	�	__enter__hszAifc_read.__enter__cGs|j�dS)N)rP)rI�argsrrr	�__exit__kszAifc_read.__exit__cCs|jS)N)rB)rIrrr	�getfpqszAifc_read.getfpcCsd|_d|_dS)Nrr)rErA)rIrrr	�rewindtszAifc_read.rewindcCs |j}|dk	rd|_|j�dS)N)rBrP)rIrrrr	rPxszAifc_read.closecCs|jS)N)rA)rIrrr	�tell~szAifc_read.tellcCs|jS)N)�
_nchannels)rIrrr	�getnchannels�szAifc_read.getnchannelscCs|jS)N)�_nframes)rIrrr	�
getnframes�szAifc_read.getnframescCs|jS)N)�
_sampwidth)rIrrr	�getsampwidth�szAifc_read.getsampwidthcCs|jS)N)�
_framerate)rIrrr	�getframerate�szAifc_read.getframeratecCs|jS)N)�	_comptype)rIrrr	�getcomptype�szAifc_read.getcomptypecCs|jS)N)�	_compname)rIrrr	�getcompname�szAifc_read.getcompnamecCs*t|j�|j�|j�|j�|j�|j��S)N)r;rZr^r`r\rbrd)rIrrr	�	getparams�szAifc_read.getparamscCst|j�dkrdS|jS)Nr)r1r@)rIrrr	�
getmarkers�szAifc_read.getmarkerscCs2x|jD]}||dkr|SqWtdj|���dS)Nrzmarker {0!r} does not exist)r@r�format)rI�id�markerrrr	�getmark�szAifc_read.getmarkcCs*|dks||jkrtd��||_d|_dS)Nrzposition not in ranger)r[rrArE)rI�posrrr	�setpos�szAifc_read.setposcCs�|jrD|jjd�|jjd�}|j|j}|r>|jj|d�d|_|dkrPdS|jj||j�}|jrv|rv|j|�}|jt|�|j|j	|_|S)Nrr=r)
rErD�seekr
rA�
_framesizer?r1rYr])rI�nframesrrkrrrr	�
readframes�s

zAifc_read.readframescCsddl}|j|d�S)Nrr)�audioopZalaw2lin)rIrrqrrr	�	_alaw2lin�szAifc_read._alaw2lincCsddl}|j|d�S)Nrr)rqZulaw2lin)rIrrqrrr	�	_ulaw2lin�szAifc_read._ulaw2lincCs2ddl}t|d�sd|_|j|d|j�\}|_|S)Nr�_adpcmstater)rq�hasattrrtZ	adpcm2lin)rIrrqrrr	�
_adpcm2lin�s

zAifc_read._adpcm2lincCs.t|�|_t|�|_t|�dd|_tt|��|_|j|j|_|j	�rd}|j
dkrld}tjd�d|_
|j
d�|_|r�t|jj
d��}|d@dkr�|d}|j
||_
|jjdd�t|�|_|jd	k�r*|jd
kr�|j|_n2|jdkr�|j|_n|jdk�r|j|_ntd��d|_nd	|_d|_dS)N�r=r�rzWarning: bad COMM chunk size�r
sNONEsG722�ulaw�ULAW�alaw�ALAWzunsupported compression typersnot compressedr)rzr{)r|r})rrYrr[r]r7r&r_rnrCZ	chunksize�warnings�warnr
rarrrmrrcrvr?rsrrr)rIrJZkludgerrrr	rF�s<









zAifc_read._read_comm_chunkcCs�t|�}yHxBt|�D]6}t|�}t|�}t|�}|s8|r|jj|||f�qWWnDtk
r�dt|j�t|j�dkr|dnd|f}tj	|�YnXdS)Nz;Warning: MARK chunk contains only %s marker%s instead of %sr�r3)
r�rangerrr@�appendrr1r~r)rIrJZnmarkers�irhrk�name�wrrr	rG�szAifc_read._readmark)rrrrBrKrRrSrUrVrWrPrXrZr\r^r`rbrdrerfrjrlrprrrsrvrFrGrrrr	r<s2$(&r<c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Z d<d=�Z!d>d?�Z"d@dA�Z#dBdC�Z$dDdE�Z%dFdG�Z&dHdI�Z'dS)J�
Aifc_writeNc	Cs\t|t�rNtj|d�}y|j|�Wn|j��YnX|jd�rXd|_n
|j|�dS)N�wbz.aiffr)rMrNrOrrKrP�endswithrC)rIr!rQrrr	rR+s

zAifc_write.__init__cCs^||_t|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_g|_
d|_d|_dS)NsNONEsnot compressedrr)rB�
_AIFC_versionr>rarcr?rYr]r_r[�_nframeswritten�_datawritten�_datalengthr@�_marklengthrC)rIrrrr	rK;szAifc_write.initfpcCs|j�dS)N)rP)rIrrr	�__del__LszAifc_write.__del__cCs|S)Nr)rIrrr	rSOszAifc_write.__enter__cGs|j�dS)N)rP)rIrTrrr	rURszAifc_write.__exit__cCs|jrtd��d|_dS)Nz0cannot change parameters after starting to writer)r�rrC)rIrrr	�aiffXszAifc_write.aiffcCs|jrtd��d|_dS)Nz0cannot change parameters after starting to writer)r�rrC)rIrrr	�aifc]szAifc_write.aifccCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerzbad # of channels)r�rrY)rI�	nchannelsrrr	�setnchannelsbs
zAifc_write.setnchannelscCs|jstd��|jS)Nznumber of channels not set)rYr)rIrrr	rZiszAifc_write.getnchannelscCs0|jrtd��|dks|dkr&td��||_dS)Nz0cannot change parameters after starting to writerr
zbad sample width)r�rr])rI�	sampwidthrrr	�setsampwidthns
zAifc_write.setsampwidthcCs|jstd��|jS)Nzsample width not set)r]r)rIrrr	r^uszAifc_write.getsampwidthcCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerzbad frame rate)r�rr_)rI�	frameraterrr	�setframeratezs
zAifc_write.setframeratecCs|jstd��|jS)Nzframe rate not set)r_r)rIrrr	r`�szAifc_write.getframeratecCs|jrtd��||_dS)Nz0cannot change parameters after starting to write)r�rr[)rIrorrr	�
setnframes�szAifc_write.setnframescCs|jS)N)r�)rIrrr	r\�szAifc_write.getnframescCs.|jrtd��|d	krtd��||_||_dS)
Nz0cannot change parameters after starting to write�NONE�ulaw�ULAW�alaw�ALAW�G722zunsupported compression type)r�r�r�r�r�r�)r�rrarc)rI�comptype�compnamerrr	�setcomptype�szAifc_write.setcomptypecCs|jS)N)ra)rIrrr	rb�szAifc_write.getcomptypecCs|jS)N)rc)rIrrr	rd�szAifc_write.getcompnamecCsf|\}}}}}}|jrtd��|d	kr.td��|j|�|j|�|j|�|j|�|j||�dS)
Nz0cannot change parameters after starting to write�NONE�ulaw�ULAW�alaw�ALAW�G722zunsupported compression type)r�r�r�r�r�r�)r�rr�r�r�r�r�)rIZparamsr�r�r�ror�r�rrr	�	setparams�s



zAifc_write.setparamscCs>|js|js|jr td��t|j|j|j|j|j|j�S)Nznot all parameters set)rYr]r_rr;r[rarc)rIrrr	re�szAifc_write.getparamscCs�|dkrtd��|dkr td��t|t�s2td��x<tt|j��D]*}||j|dkrB|||f|j|<dSqBW|jj|||f�dS)Nrzmarker ID must be > 0zmarker position must be >= 0zmarker name must be bytes)rrM�bytesr�r1r@r�)rIrhrkr�r�rrr	�setmark�s
zAifc_write.setmarkcCs2x|jD]}||dkr|SqWtdj|���dS)Nrzmarker {0!r} does not exist)r@rrg)rIrhrirrr	rj�szAifc_write.getmarkcCst|j�dkrdS|jS)Nr)r1r@)rIrrr	rf�szAifc_write.getmarkerscCs|jS)N)r�)rIrrr	rX�szAifc_write.tellcCszt|ttf�st|�jd�}|jt|��t|�|j|j}|j	rN|j	|�}|j
j|�|j||_|j
t|�|_
dS)Nr/)rMr��	bytearray�
memoryview�cast�_ensure_header_writtenr1r]rYr?rBr'r�r�)rIrrorrr	�writeframesraw�s
zAifc_write.writeframesrawcCs.|j|�|j|jks"|j|jkr*|j�dS)N)r�r�r[r�r��_patchheader)rIrrrr	�writeframes�s
zAifc_write.writeframescCs�|jdkrdSz^|jd�|jd@r<|jjd�|jd|_|j�|j|jksb|j|jksb|jrj|j	�Wdd|_
|j}d|_|j�XdS)Nrrr0)rBr�r�r'�
_writemarkersr�r[r�r�r�r?rP)rIr!rrr	rP�s 


zAifc_write.closecCsddl}|j|d�S)Nrr)rqZlin2alaw)rIrrqrrr	�	_lin2alaw�szAifc_write._lin2alawcCsddl}|j|d�S)Nrr)rqZlin2ulaw)rIrrqrrr	�	_lin2ulaw�szAifc_write._lin2ulawcCs2ddl}t|d�sd|_|j|d|j�\}|_|S)Nrrtr)rqrurtZ	lin2adpcm)rIrrqrrr	�
_lin2adpcms

zAifc_write._lin2adpcmcCsf|jsb|jdkr.|jsd|_|jdkr.td��|js<td��|jsJtd	��|jsXtd
��|j|�dS)N�ULAW�ulaw�ALAW�alaw�G722rzRsample width must be 2 when compressing with ulaw/ULAW, alaw/ALAW or G7.22 (ADPCM)z# channels not specifiedzsample width not specifiedzsampling rate not specified)r�r�r�r�r�)r�rar]rrYr_�
_write_header)rIZdatasizerrr	r�	s

z!Aifc_write._ensure_header_writtencCs>|jdkr|j|_n&|jdkr(|j|_n|jdkr:|j|_dS)NsG722�ulaw�ULAW�alaw�ALAW)r�r�)r�r�)rar�r?r�r�)rIrrr	�_init_compressions




zAifc_write._init_compressioncCsL|jr|jdkr|j�|jjd�|js<||j|j|_|j|j|j|_|jd@rf|jd|_|jr�|jdkr�|jd|_|jd@r�|jd|_n0|jd	kr�|jd
d|_|jd@r�|jd|_y|jj	�|_
Wn ttfk
�r�d|_
YnX|j
|j�}|j�rD|jjd�|jjd
�t|jd�t|j|j�n|jjd�|jjd�t|j|�t|j|j�|j
dk	�r�|jj	�|_t|j|j�|jdk�r�t|jd�nt|j|jd�t|j|j�|j�r�|jj|j�t|j|j�|jjd�|j
dk	�r|jj	�|_t|j|jd�t|jd�t|jd�dS)NsNONEsFORMr�ulaw�ULAW�alaw�ALAWr�G722�r
sAIFCsFVERsAIFFsCOMMr=sSSNDr)r�r�r�r�)r�r�r�r�r�)rCrar�rBr'r[rYr]r�rX�_form_length_pos�AttributeError�OSError�_write_form_lengthr-r>r*�_nframes_posr8r_r4rc�_ssnd_length_pos)rIZ
initlength�
commlengthrrr	r�!s^




zAifc_write._write_headercCs\|jr*d	t|j�}|d@r$|d}d}nd}d}t|jd||jd|d|�|S)
Nrx�r�rr
r=�ry)rCr1rcr-rBr�)rI�
datalengthr�Z
verslengthrrr	r�Ts zAifc_write._write_form_lengthcCs�|jj�}|jd@r,|jd}|jjd�n|j}||jkrd|j|jkrd|jdkrd|jj|d�dS|jj|j	d�|j
|�}|jj|jd�t|j|j�|jj|j
d�t|j|d�|jj|d�|j|_||_dS)Nrr0rr=)rBrXr�r'r�r[r�r�rmr�r�r�r-r�)rIZcurposr�rrrr	r�as&





zAifc_write._patchheadercCs�t|j�dkrdS|jjd�d}xD|jD]:}|\}}}|t|�dd}t|�d@dkr*|d}q*Wt|j|�|d|_t|jt|j��x<|jD]2}|\}}}t|j|�t|j|�t|j|�q�WdS)NrsMARKrr�r=)r1r@rBr'r-r�r*r4)rIrrirhrkr�rrr	r�ws"


zAifc_write._writemarkers)(rrrrBrRrKr�rSrUr�r�r�rZr�r^r�r`r�r\r�rbrdr�rer�rjrfrXr�r�rPr�r�r�r�r�r�r�r�r�rrrr	r�sJ	

3
r�cCsJ|dkrt|d�r|j}nd}|dkr.t|�S|dkr>t|�Std��dS)	N�moderL�rr�r�z$mode must be 'r', 'rb', 'w', or 'wb')r�rL)r�r�)rur�r<r�r)r!r�rrr	r�s
�__main__rz/usr/demos/data/audio/bach.aiffr�ZReadingznchannels =znframes   =zsampwidth =zframerate =zcomptype  =zcompname  =rZWritingr�izDone.)N)8�__doc__rrOr~�__all__�	Exceptionrr�rrrrrrr&r*r+r,r-r4r8rJr9�collectionsr:r;r�r�r�ror�r�r<r�rrr�sys�argvr��fnr!�printrZr\r^r`rbrdZgn�gr�rerprr�rrrr	�<module>�sz

!~







copy.cpython-36.opt-2.pyc000064400000011235150335715140011112 0ustar003


 \o"�@sfddlZddlZddlmZGdd�de�ZeZyddlmZWne	k
rXdZYnXdddgZ
dd�ZiZZ
d	d
�ZxHed�eeeeeeeeeeeejee�ee�ejejfD]Zee
e<q�We edd�Zedk	r�ee
e<e!je
e!<e"je
e"<e#je
e#<e$je
e$<edk	�reje
e<[
[dgfdd�Z%iZ&Z
d
d�Z'e'e
ed�<e'e
ee�<e'e
ee�<e'e
e<e'e
e<e'e
e<e'e
e<e'e
e<e'e
e<ye'e
ej(<Wne)k
�r�YnXe'e
e<e'e
ej<e'e
ej<e'e
ej<e%fdd�Z*e*e
e!<e%fdd�Z+e+e
e<e%fdd�Z,e,e
e"<edk	�r.e,e
e<dd�Z-e-e
ej.<[
dd�Z/ddde%fdd�Z0[[[dS)�N)�dispatch_tablec@seZdZdS)�ErrorN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/copy.pyr7sr)�PyStringMap�copy�deepcopycCs�t|�}tj|�}|r||�Syt|t�}Wntk
rDd}YnX|rRt|�St|dd�}|rj||�Stj|�}|r�||�}n>t|dd�}|r�|d�}n$t|dd�}|r�|�}ntd|��t	|t
�r�|St|df|��S)NF�__copy__�
__reduce_ex__��
__reduce__z%un(shallow)copyable object of type %s)�type�_copy_dispatch�get�
issubclass�	TypeError�_copy_immutable�getattrrr�
isinstance�str�_reconstruct)�x�cls�copier�issc�reductor�rvrrrr
Bs4





cCs|S)Nr)rrrrrosr�CodeTypec
Cs8|dkri}t|�}|j||�}||k	r,|St|�}tj|�}|rN|||�}n�yt|t�}Wntk
rtd}YnX|r�t||�}n�t|dd�}|r�||�}nxtj|�}|r�||�}	n>t|dd�}|r�|d�}	n$t|dd�}|r�|�}	nt	d|��t
|	t��r|}nt||f|	��}||k	�r4|||<t
||�|S)Nr�__deepcopy__r
rrz"un(deep)copyable object of type %s)�idrr�_deepcopy_dispatchrr�_deepcopy_atomicrrrrrr�_keep_alive)
r�memoZ_nil�d�yrrrrrrrrr�sJ








cCs|S)Nr)rr&rrrr$�sr$cCs6g}||t|�<|j}x|D]}||||��qW|S)N)r"�append)rr&rr(r)�arrr�_deepcopy_list�s
r+csh��fdd�|D�}y�t|�Stk
r4YnXx,t||�D]\}}||k	rBt|�}PqBW|}|S)Ncsg|]}�|���qSrr)�.0r*)rr&rr�
<listcomp>�sz#_deepcopy_tuple.<locals>.<listcomp>)r"�KeyError�zip�tuple)rr&rr(�k�jr)rr&r�_deepcopy_tuple�sr3cCs>i}||t|�<x(|j�D]\}}|||�||||�<qW|S)N)r"�items)rr&rr(�key�valuerrr�_deepcopy_dict�s
r7cCst|�|jt|j|��S)N)r�__func__r�__self__)rr&rrr�_deepcopy_method�sr:cCs>y|t|�j|�Wn"tk
r8|g|t|�<YnXdS)N)r"r)r.)rr&rrrr%�s
r%csx�dk	}|r$|r$��fdd�|D�}||�}	|r<|	�t|�<|dk	r�|rR�|��}t|	d�rh|	j|�nbt|t�r�t|�dkr�|\}}
nd}
|dk	r�|	jj|�|
dk	r�x |
j�D]\}}t	|	||�q�W|dk	�r|r�x<|D]}
�|
��}
|	j
|
�q�Wnx|D]}
|	j
|
��qW|dk	�rt|�rXxL|D]&\}}�|��}�|��}||	|<�q,Wnx|D]\}}||	|<�q^W|	S)Nc3s|]}�|��VqdS)Nr)r,�arg)rr&rr�	<genexpr>sz_reconstruct.<locals>.<genexpr>�__setstate__�)r"�hasattrr=rr0�len�__dict__�updater4�setattrr))rr&�func�args�stateZlistiterZdictiterrZdeepr(Z	slotstater5r6�itemr)rr&rrsF









r)1�types�weakref�copyregr�	Exceptionr�errorZorg.python.corer	�ImportError�__all__r
rr'rr�int�float�bool�complexrr0�bytes�	frozenset�range�slice�BuiltinFunctionType�Ellipsis�NotImplemented�FunctionType�ref�tr�list�dict�set�	bytearrayrr#r$r �AttributeErrorr+r3r7r:�
MethodTyper%rrrrr�<module>3s|

+






8




+mimetypes.cpython-36.pyc000064400000036303150335715140011217 0ustar003


 \2R�@sdZddlZddlZddlZddlZyddlZWnek
rHdZYnXddddddd	d
ddd
ddg
Z	dddddddddg	Z
dadaGdd�d�Z
d6dd�Zd7dd�Zd8dd�Zd9dd	�Zd:dd
�Zd d�Zd!d"�Ze�ed#k�rddlZd$Zd;d&d'�Zy&ejejd(d�d)d*d+d,g�\ZZWn0ejk
�rRZzed(e�WYddZ[XnXd(ZdZxDeD]<\Z Z!e d<k�r~ed�ne d=k�r�dZne d>k�rbd(Z�qbWxheD]`Z"e�r�ee"e�Z#e#�s�e$d3e"�ne$e#�n.ee"e�\Z#Z%e#�s�e$d3e"�ne$d4e#d5e%��q�WdS)?a�Guess the MIME type of a file.

This module defines two useful functions:

guess_type(url, strict=True) -- guess the MIME type and encoding of a URL.

guess_extension(type, strict=True) -- guess the extension for a given MIME type.

It also contains the following, for tuning the behavior:

Data:

knownfiles -- list of files to parse
inited -- flag set when init() has been called
suffix_map -- dictionary mapping suffixes to suffixes
encodings_map -- dictionary mapping suffixes to encodings
types_map -- dictionary mapping suffixes to types

Functions:

init([files]) -- parse a list of files, default knownfiles (on Windows, the
  default values are taken from the registry)
read_mime_types(file) -- parse one file, return a dictionary or None
�N�
knownfiles�inited�	MimeTypes�
guess_type�guess_all_extensions�guess_extension�add_type�init�read_mime_types�
suffix_map�
encodings_map�	types_map�common_typesz/etc/mime.typesz/etc/httpd/mime.typesz/etc/httpd/conf/mime.typesz/etc/apache/mime.typesz/etc/apache2/mime.typesz$/usr/local/etc/httpd/conf/mime.typesz"/usr/local/lib/netscape/mime.typesz/usr/local/etc/mime.typesFc@sdeZdZdZfdfdd�Zddd�Zddd�Zdd	d
�Zddd�Zdd
d�Z	ddd�Z
ddd�ZdS)rz�MIME-types datastore.

    This datastore can handle information from mime.types-style files
    and supports basic determination of MIME type from a filename or
    URL, and can guess a reasonable extension given a MIME type.
    TcCs�ts
t�tj�|_tj�|_iif|_iif|_x"tj�D]\}}|j||d�q<Wx"t	j�D]\}}|j||d�q`Wx|D]}|j
||�q�WdS)NTF)rr	r�copyrr
�
types_map_inv�itemsrr�read)�self�	filenames�strict�ext�type�name�r�!/usr/lib64/python3.6/mimetypes.py�__init__Bs




zMimeTypes.__init__cCs6||j||<|j|j|g�}||kr2|j|�dS)a�Add a mapping between a type and an extension.

        When the extension is already known, the new
        type will replace the old one. When the type
        is already known the extension will be added
        to the list of known extensions.

        If strict is true, information will be added to
        list of standard types, else to the list of non-standard
        types.
        N)r
r�
setdefault�append)rrrrZextsrrrrPszMimeTypes.add_typecCsltjj|�\}}|dkrz|jd�}|dkr.dS|jdd|�}|dkrR|d|�}n|d|�}d|ksnd|krrd}|dfStj|�\}}x&||jkr�tj||j|�\}}q�W||jkr�|j|}	tj|�\}}nd}	|jd	}
||
kr�|
||	fS|j	�|
k�r|
|j	�|	fS|�r"d|	fS|jd
}
||
k�rB|
||	fS|j	�|
k�r`|
|j	�|	fSd|	fSdS)a:Guess the type of a file based on its URL.

        Return value is a tuple (type, encoding) where type is None if
        the type can't be guessed (no or unknown suffix) or a string
        of the form type/subtype, usable for a MIME Content-type
        header; and encoding is None for no encoding or the name of
        the program used to encode (e.g. compress or gzip).  The
        mappings are table driven.  Encoding suffixes are case
        sensitive; type suffixes are first tried case sensitive, then
        case insensitive.

        The suffixes .tgz, .taz and .tz (case sensitive!) are all
        mapped to '.tar.gz'.  (This is table-driven too, using the
        dictionary suffix_map.)

        Optional `strict' argument when False adds a bunch of commonly found,
        but non-standard types.
        �data�,rN�;�=�/z
text/plainTF)NN)
�urllib�parseZ	splittype�find�	posixpath�splitextrrr
�lower)r�urlr�schemeZcommaZsemir�baser�encodingr
rrrras@





zMimeTypes.guess_typecCsP|j�}|jdj|g�}|sLx,|jdj|g�D]}||kr2|j|�q2W|S)a�Guess the extensions for a file based on its MIME type.

        Return value is a list of strings giving the possible filename
        extensions, including the leading dot ('.').  The extension is not
        guaranteed to have been associated with any particular data stream,
        but would be mapped to the MIME type `type' by guess_type().

        Optional `strict' argument when false adds a bunch of commonly found,
        but non-standard types.
        TF)r(r�getr)rrr�
extensionsrrrrr�szMimeTypes.guess_all_extensionscCs|j||�}|sdS|dS)aGuess the extension for a file based on its MIME type.

        Return value is a string giving a filename extension,
        including the leading dot ('.').  The extension is not
        guaranteed to have been associated with any particular data
        stream, but would be mapped to the MIME type `type' by
        guess_type().  If no extension can be guessed for `type', None
        is returned.

        Optional `strict' argument when false adds a bunch of commonly found,
        but non-standard types.
        Nr)r)rrrr.rrrr�s
zMimeTypes.guess_extensionc
Cs(t|dd��}|j||�WdQRXdS)z�
        Read a single mime.types-format file, specified by pathname.

        If strict is true, information will be added to
        list of standard types, else to the list of non-standard
        types.
        zutf-8)r,N)�open�readfp)r�filenamer�fprrrr�szMimeTypes.readc	Cs�x�|j�}|sP|j�}x0tt|��D] }||ddkr&||d�=Pq&W|sPq|d|dd�}}x|D]}|j|d||�qlWqWdS)z�
        Read a single mime.types-format file.

        If strict is true, information will be added to
        list of standard types, else to the list of non-standard
        types.
        r�#N��.)�readline�split�range�lenr)	rr2r�lineZwords�ir�suffixesZsuffrrrr0�s

zMimeTypes.readfpcCs�tsdSdd�}tjtjd���}xz||�D]n}yRtj||��<}|jd�sJw*tj|d�\}}|tjkrfw*|j|||�WdQRXWq*tk
r�w*Yq*Xq*WWdQRXdS)z�
        Load the MIME types database from Windows registry.

        If strict is true, information will be added to
        list of standard types, else to the list of non-standard
        types.
        NcssLd}xBytj||�}Wntk
r,PYnXd|kr<|V|d7}qWdS)Nr�r4)�_winregZEnumKey�EnvironmentError)Zmimedbr;Zctyperrr�
enum_types�sz3MimeTypes.read_windows_registry.<locals>.enum_types�r5zContent Type)r>�OpenKeyZHKEY_CLASSES_ROOT�
startswithZQueryValueExZREG_SZrr?)rrr@ZhkcrZ
subkeynameZsubkeyZmimetypeZdatatyperrr�read_windows_registry�s 


zMimeTypes.read_windows_registryN)T)T)T)T)T)T)T)�__name__�
__module__�__qualname__�__doc__rrrrrrr0rDrrrrr:s

>



TcCstdkrt�tj||�S)a�Guess the type of a file based on its URL.

    Return value is a tuple (type, encoding) where type is None if the
    type can't be guessed (no or unknown suffix) or a string of the
    form type/subtype, usable for a MIME Content-type header; and
    encoding is None for no encoding or the name of the program used
    to encode (e.g. compress or gzip).  The mappings are table
    driven.  Encoding suffixes are case sensitive; type suffixes are
    first tried case sensitive, then case insensitive.

    The suffixes .tgz, .taz and .tz (case sensitive!) are all mapped
    to ".tar.gz".  (This is table-driven too, using the dictionary
    suffix_map).

    Optional `strict' argument when false adds a bunch of commonly found, but
    non-standard types.
    N)�_dbr	r)r)rrrrrscCstdkrt�tj||�S)a�Guess the extensions for a file based on its MIME type.

    Return value is a list of strings giving the possible filename
    extensions, including the leading dot ('.').  The extension is not
    guaranteed to have been associated with any particular data
    stream, but would be mapped to the MIME type `type' by
    guess_type().  If no extension can be guessed for `type', None
    is returned.

    Optional `strict' argument when false adds a bunch of commonly found,
    but non-standard types.
    N)rIr	r)rrrrrr&s
cCstdkrt�tj||�S)a�Guess the extension for a file based on its MIME type.

    Return value is a string giving a filename extension, including the
    leading dot ('.').  The extension is not guaranteed to have been
    associated with any particular data stream, but would be mapped to the
    MIME type `type' by guess_type().  If no extension can be guessed for
    `type', None is returned.

    Optional `strict' argument when false adds a bunch of commonly found,
    but non-standard types.
    N)rIr	r)rrrrrr7scCstdkrt�tj|||�S)aiAdd a mapping between a type and an extension.

    When the extension is already known, the new
    type will replace the old one. When the type
    is already known the extension will be added
    to the list of known extensions.

    If strict is true, information will be added to
    list of standard types, else to the list of non-standard
    types.
    N)rIr	r)rrrrrrrGscCsndat�}|dkr"tr|j�t}x"|D]}tjj|�r(|j|�q(W|j	a	|j
a
|jda|jda|a
dS)NTF)rrr>rDr�os�path�isfilerrrr
rrI)�files�db�filerrrr	Xs


cCsNyt|�}Wntk
r dSX|�t�}|j|d�|jdSQRXdS)NT)r/�OSErrorrr0r
)rO�frNrrrr
lsc�CsDddddddd�adddd	d
�addd
d
d
dddddddddddddddddddddddddd d d!d"d#d#d#d$d%dd&d'd(d(d)d*ddd+d$d,d-d.d.d/d'd'd'd'd0ddddd1d2d3d4d5d2d6dd7d8d9d9d:d9d9dd9d;d<d<d,d=d>d?d@dAdBdCdDdDdEdFdddGdHdIdJdKdBdLdMdNdOdOdPdPdBdQddRdSdTdUdd@dVdWdXdWdYd@dZd@d[d\d]��ad^d_d_d`d`d`dadbdc�adS)dNz.svg.gzz.tar.gzz.tar.bz2z.tar.xz)z.svgzz.tgzz.tazz.tzz.tbz2z.txzZgzip�compressZbzip2Zxz)z.gzz.Zz.bz2z.xzzapplication/octet-streamzapplication/postscriptzaudio/x-aiffzaudio/basiczvideo/x-msvideoz
text/plainzapplication/x-bcpiozimage/x-ms-bmpzapplication/x-cdfzapplication/x-netcdfzapplication/x-cpiozapplication/x-cshztext/cssztext/csvzapplication/mswordzapplication/x-dvizmessage/rfc822z
text/x-setextz	image/gifzapplication/x-gtarzapplication/x-hdfz	text/htmlzimage/vnd.microsoft.iconz	image/iefz
image/jpegzapplication/javascriptzapplication/jsonzapplication/x-latexz
video/mpegzapplication/vnd.apple.mpegurlzapplication/x-troff-manzapplication/x-troff-mezapplication/x-mifzvideo/quicktimezvideo/x-sgi-moviez
audio/mpegz	video/mp4zapplication/x-troff-mszapplication/odazapplication/x-pkcs12zapplication/pkcs7-mimezimage/x-portable-bitmapzapplication/pdfzimage/x-portable-graymapz	image/pngzimage/x-portable-anymapzapplication/vnd.ms-powerpointzimage/x-portable-pixmapz
text/x-pythonzapplication/x-python-codezaudio/x-pn-realaudiozapplication/x-pn-realaudiozimage/x-cmu-rasterzapplication/xmlzimage/x-rgbzapplication/x-troffz
text/richtextztext/x-sgmlzapplication/x-shzapplication/x-sharzapplication/x-wais-sourcezapplication/x-sv4cpiozapplication/x-sv4crcz
image/svg+xmlzapplication/x-shockwave-flashzapplication/x-tarzapplication/x-tclzapplication/x-texzapplication/x-texinfoz
image/tiffztext/tab-separated-valueszapplication/x-ustarztext/x-vcardzaudio/x-wavz
video/webmzimage/x-xbitmapzapplication/vnd.ms-excelzapplication/excelztext/xmlzimage/x-xpixmapzimage/x-xwindowdumpzapplication/zip)�z.az.aiz.aifz.aifcz.aiffz.auz.aviz.batz.bcpioz.binz.bmpz.cz.cdfz.cdfz.cpioz.cshz.cssz.csvz.dllz.docz.dotz.dviz.emlz.epsz.etxz.exez.gifz.gtarz.hz.hdfz.htmz.htmlz.icoz.iefz.jpez.jpegz.jpgz.jsz.jsonz.kshz.latexz.m1vz.m3uz.m3u8z.manz.mez.mhtz.mhtmlz.mifz.mjsz.movz.moviez.mp2z.mp3z.mp4z.mpaz.mpez.mpegz.mpgz.msz.ncz.nwsz.oz.objz.odaz.p12z.p7cz.pbmz.pdfz.pfxz.pgmz.plz.pngz.pnmz.potz.ppaz.ppmz.ppsz.pptz.psz.pwzz.pyz.pycz.pyoz.qtz.raz.ramz.rasz.rdfz.rgbz.roffz.rtxz.sgmz.sgmlz.shz.sharz.sndz.soz.srcz.sv4cpioz.sv4crcz.svgz.swfz.tz.tarz.tclz.texz.texiz.texinfoz.tifz.tiffz.trz.tsvz.txtz.ustarz.vcfz.wavz.webmz.wizz.wsdlz.xbmz.xlbz.xlsz.xlsz.xmlz.xpdlz.xpmz.xslz.xwdz.zipz	image/jpgz
audio/midiz
image/pictzapplication/rtfztext/xul)z.jpgz.midz.midiz.pctz.picz.pictz.rtfz.xul)rrr
rrrrr�_default_mime_typesws(	rS�__main__a4Usage: mimetypes.py [options] type

Options:
    --help / -h       -- print this message and exit
    --lenient / -l    -- additionally search of some common, but non-standard
                         types.
    --extension / -e  -- guess extension instead of type

More than one type argument may be given.
rAcCs"tt�|rt|�tj|�dS)N)�print�USAGE�sys�exit)�code�msgrrr�usage;sr[r4Zhle�helpZlenient�	extension�-h�--help�-l�	--lenient�-e�--extensionz I don't know anything about typeztype:z	encoding:)T)T)T)T)N)rA)r^r_)r`ra)rbrc)&rHrJrWr&Zurllib.parser#�winregr>�ImportError�__all__rrrIrrrrrr	r
rSrEZgetoptrVr[�argvZopts�args�errorrZrr]�opt�argZgtypeZguessrUr,rrrr�<module>s|
V




3









enum.cpython-36.pyc000064400000055637150335715140010162 0ustar003


 \F��@s>ddlZddlmZmZddlmZddlmZyddl	m
Z
Wn ek
r`ddlm
Z
YnXdddd	d
ddgZ
d
d�Zdd�Zdd�Zdd�Ze�ZGdd�d�ZGdd�de�ZdZGdd�de�ZGdd�ded�ZGdd�dee�Zdd�ZGdd	�d	e�ZGdd
�d
ee�Zd d!�Zd"d�Z d#d$�Z!d%d&�Z"dS)'�N)�MappingProxyType�DynamicClassAttribute)�reduce)�or_)�OrderedDict�EnumMeta�Enum�IntEnum�Flag�IntFlag�auto�uniquecCst|d�pt|d�pt|d�S)z5Returns True if obj is a descriptor, False otherwise.�__get__�__set__�
__delete__)�hasattr)�obj�r�/usr/lib64/python3.6/enum.py�_is_descriptors

rcCsT|dd�|dd�ko"dknoR|dd�dkoR|dd	�dkoRt|�dkS)
z3Returns True if a __dunder__ name, False otherwise.N��__��_�������r)�len)�namerrr�
_is_dunders(rcCsL|d|dkodknoJ|dd�dkoJ|dd�dkoJt|�dkS)z1Returns True if a _sunder_ name, False otherwise.r�rr���rr!)r)rrrr�
_is_sunder$s r"cCsdd�}||_d|_dS)z"Make the given class un-picklable.cSstd|��dS)Nz%r cannot be pickled)�	TypeError)�self�protorrr�_break_on_call_reduce-sz6_make_class_unpicklable.<locals>._break_on_call_reducez	<unknown>N)�
__reduce_ex__�
__module__)�clsr&rrr�_make_class_unpicklable+sr*c@seZdZdZeZdS)rzP
    Instances are replaced with an appropriate value in Enum class suites.
    N)�__name__r(�__qualname__�__doc__�
_auto_null�valuerrrrr3scs,eZdZdZ�fdd�Z�fdd�Z�ZS)�	_EnumDictz�Track enum member order and ensure member names are not reused.

    EnumMeta will use the names found in self._member_names as the
    enumeration member names.

    cst�j�g|_g|_dS)N)�super�__init__�
_member_names�_last_values)r$)�	__class__rrr2As
z_EnumDict.__init__cs�t|�r.|dkrtd��|dkr�t|d|�n�t|�rD|dkr�d}n�||jkr\td|��nxt|�s�||kr�td	|||f��t|t�r�|j	t
kr�|j|d
t|j�|j
dd��|_	|j	}|jj|�|j
j|�t�j||�dS)
z�Changes anything not dundered or not a descriptor.

        If an enum member name is used twice, an error is raised; duplicate
        values are not checked for.

        Single underscore (sunder) names are reserved.

        �_order_�_create_pseudo_member_�_generate_next_value_�	_missing_z(_names_ are reserved for future Enum use�_generate_next_value�	__order__zAttempted to reuse key: %rz%r already defined as: %rr N)r6r7r8r9)r"�
ValueError�setattrrr3r#r�
isinstancerr/r.r:rr4�appendr1�__setitem__)r$�keyr/)r5rrr@Fs,	


"z_EnumDict.__setitem__)r+r(r,r-r2r@�
__classcell__rr)r5rr0:sr0cs�eZdZdZedd��Z�fdd�Zdd�Zd)dddd	d
�dd�Zd
d�Z	�fdd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zedd��Zdd�Zdd �Z�fd!d"�Zdddd	d
�d#d$�Zed%d&��Zed'd(��Z�ZS)*rzMetaclass for EnumcCs0t�}|j|�\}}|dk	r,t|dd�|d<|S)Nr8)r0�_get_mixins_�getattr)�metaclsr)�bases�	enum_dict�member_type�
first_enumrrr�__prepare__rs
zEnumMeta.__prepare__cs�|j|�\�}|j��|�\}}}�fdd��jD�}x�jD]
}	�|	=q>W�jdd�}
t|�dh@}|r~tdjdj|����d�kr�d�d<t�j	|||��}g|_
t�|_�|_
d	d
�|j�D�}
i|_d�k�r�tk	�rd}t�fdd�|D���st|��x6�jD�]*}||}t|t��s0|f}n|}�tk�rD|f}|�sf||�}t|d��s�||_n6||f|��}t|d��s��tk�r�||_n
�|�|_|j}||_||_|j|�x8|jj�D]\}	}|j|jk�r�|}P�q�W|j
j|�||
k�rt|||�||j|<y||j|<Wntk
�r6YnX�qWxPdD]H}	t||	�}t�|	d�}t||	d�}|dk	�rD||k�rDt||	|��qDWtdk	�r�|�r�||_ tj	|_	|
dk	�r�t|
t!��r�|
j"dd�j#�}
|
|j
k�r�td��|S)Ncsi|]}�||�qSrr)�.0�k)�	classdictrr�
<dictcomp>�sz$EnumMeta.__new__.<locals>.<dictcomp>r6�mrozInvalid enum member name: {0}�,r-zAn enumeration.cSs.h|]&}|jj�D]\}}t|t�r|�qqSr)�__dict__�itemsr>r)rK�crL�vrrr�	<setcomp>�sz#EnumMeta.__new__.<locals>.<setcomp>r'�__getnewargs_ex__�__getnewargs__�
__reduce__c3s|]}|�jkVqdS)N)rQ)rK�m)rHrr�	<genexpr>�sz#EnumMeta.__new__.<locals>.<genexpr>�_value_�__repr__�__str__�
__format__� z#member order does not match _order_)rVrWr'rX)r\r]r^r')$rC�
_find_new_r3�pop�setr<�format�joinr1�__new__�_member_names_r�_member_map_�
_member_type_rO�_value2member_map_�object�anyr*r>�tuplerr[�_name_�__objclass__r2rRr?r=r#rDr�__new_member__�str�replace�split)rEr)rFrMrIre�save_new�use_args�enum_membersrr6�
invalid_names�
enum_class�dynamic_attributes�methods�member_namer/�args�enum_member�canonical_member�class_method�
obj_method�enum_method)r5)rMrHrre|s�












zEnumMeta.__new__cCsdS)z6
        classes/types should always be True.
        Tr)r$rrr�__bool__szEnumMeta.__bool__Nr )�module�qualname�type�startcCs*|dkr|j||�S|j||||||d�S)aEither returns an existing member, or creates a new enum class.

        This method is used both when an enum class is given a value to match
        to an enumeration member (i.e. Color(3)) and for the functional API
        (i.e. Color = Enum('Color', names='RED GREEN BLUE')).

        When used for the functional API:

        `value` will be the name of the new class.

        `names` should be either a string of white-space/comma delimited names
        (values will start at `start`), or an iterator/mapping of name, value pairs.

        `module` should be set to the module this class is being created in;
        if it is not set, an attempt to find that module will be made, but if
        it fails the class will not be picklable.

        `qualname` should be set to the actual location this class can be found
        at in its module; by default it is set to the global scope.  If this is
        not correct, unpickling will fail in some circumstances.

        `type`, if set, will be mixed in as the first base class.

        N)r�r�r�r�)re�_create_)r)r/�namesr�r�r�r�rrr�__call__szEnumMeta.__call__cCst||�o|j|jkS)N)r>rmrg)r)�memberrrr�__contains__)szEnumMeta.__contains__cs(||jkrtd|j��t�j|�dS)Nz%s: cannot delete Enum member.)rg�AttributeErrorr+r1�__delattr__)r)�attr)r5rrr�,s
zEnumMeta.__delattr__cCsddddg|jS)Nr5r-�__members__r()rf)r$rrr�__dir__4s
zEnumMeta.__dir__cCs>t|�rt|��y
|j|Stk
r8t|�d�YnXdS)a5Return the enum member matching `name`

        We use __getattr__ instead of descriptors or inserting into the enum
        class' __dict__ in order to support `name` and `value` being both
        properties for enum members (which live in the class' __dict__) and
        enum members themselves.

        N)rr�rg�KeyError)r)rrrr�__getattr__8s	
zEnumMeta.__getattr__cCs
|j|S)N)rg)r)rrrr�__getitem__HszEnumMeta.__getitem__cs�fdd��jD�S)Nc3s|]}�j|VqdS)N)rg)rKr)r)rrrZLsz$EnumMeta.__iter__.<locals>.<genexpr>)rf)r)r)r)r�__iter__KszEnumMeta.__iter__cCs
t|j�S)N)rrf)r)rrr�__len__NszEnumMeta.__len__cCs
t|j�S)z�Returns a mapping of member name->value.

        This mapping lists all enum members, including aliases. Note that this
        is a read-only view of the internal mapping.

        )rrg)r)rrrr�QszEnumMeta.__members__cCs
d|jS)Nz	<enum %r>)r+)r)rrrr\[szEnumMeta.__repr__cs�fdd�t�j�D�S)Nc3s|]}�j|VqdS)N)rg)rKr)r)rrrZ_sz(EnumMeta.__reversed__.<locals>.<genexpr>)�reversedrf)r)r)r)r�__reversed__^szEnumMeta.__reversed__cs0|jjdi�}||krtd��t�j||�dS)z�Block attempts to reassign Enum members.

        A simple assignment to the class namespace only changes one of the
        several possible ways to get an Enum member from the Enum class,
        resulting in an inconsistent Enumeration.

        rgzCannot reassign members.N)rQ�getr�r1�__setattr__)r)rr/�
member_map)r5rrr�aszEnumMeta.__setattr__cCs�|j}|dkr|fn||f}|j|�\}	}
|j||�}t|t�rP|jdd�j�}t|ttf�r�|r�t|dt�r�|g}}g}
xDt	|�D]8\}}|
j
||||
dd��}|
j|�|j||f�q�Wx6|D].}t|t�r�|||}}n|\}}|||<q�W|j||||�}|dk�rTyt
jd�jd}Wn(ttfk
�rR}zWYdd}~XnX|dk�rht|�n||_|dk	�r~||_|S)a�Convenience method to create a new Enum class.

        `names` can be:

        * A string containing member names, separated either with spaces or
          commas.  Values are incremented by 1 from `start`.
        * An iterable of member names.  Values are incremented by 1 from `start`.
        * An iterable of (member name, value) pairs.
        * A mapping of member name -> value pairs.

        NrPr_rrr+)r5rCrJr>rprqrrrl�list�	enumerater8r?re�sys�	_getframe�	f_globalsr�r<r*r(r,)r)�
class_namer�r�r�r�r�rErFrrIrM�original_names�last_values�countrr/�itemrz�member_valuerw�excrrrr�ns<
 







zEnumMeta._create_cCs�|sttfSd}}x,|D]$}|tk	rt|t�r|jrtd��qWt|t�sTtd��t|dt�st|d}|d}n8x6|djD](}t|t�r�|dkr�|}q�|dkr�|}q�W||fS)z�Returns the type for creating enum members, and the first inherited
        enum class.

        bases: the tuple of bases that was given to __new__

        NzCannot extend enumerationszHnew enumerations must be created as `ClassName([mixin_type,] enum_type)`rr r!)rjr�
issubclassrfr#�__mro__)rFrHrI�baserrrrC�s(




zEnumMeta._get_mixins_c	Cs�|jdd�}|dk	}|dkrtxVdD]H}x8||fD],}t||d�}|ddjtjtjhkr0|}Pq0W|dk	r"Pq"Wtj}|tjkr�d}nd}|||fS)a
Returns the __new__ to be used for creating the enum members.

        classdict: the class dictionary given to __new__
        member_type: the data type whose __new__ will be used by default
        first_enum: enumeration to check for an overriding __new__

        reNroFT)rore)r�rDrerjr)	rMrHrIrers�method�possible�targetrtrrrr`�s(


zEnumMeta._find_new_)N)r+r(r,r-�classmethodrJrer�r�r�r�r�r�r�r�r��propertyr�r\r�r�r��staticmethodrCr`rBrr)r5rrps(



5-c@s�eZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
edd��Zedd��Zeddd��ZdS)rzRGeneric enumeration.

    Derive from this class to define new enumerations.

    cCsjt|�|kr|Sy||jkr&|j|SWn6tk
r^x |jj�D]}|j|krD|SqDWYnX|j|�S)N)r�rir#rg�valuesr[r9)r)r/r�rrrres

zEnum.__new__cCs8x2t|�D]"}y|dStk
r*Yq
Xq
W|SdS)Nr )r�r#)rr�r�r��
last_valuerrrr8s
zEnum._generate_next_value_cCstd||jf��dS)Nz%r is not a valid %s)r<r+)r)r/rrrr9"szEnum._missing_cCsd|jj|j|jfS)Nz<%s.%s: %r>)r5r+rmr[)r$rrrr\&sz
Enum.__repr__cCsd|jj|jfS)Nz%s.%s)r5r+rm)r$rrrr]*szEnum.__str__cs&�fdd��jj�D�}dddg|S)Ncs2g|]*}|jD]}|ddkr|�jkr|�qqS)rr)rQrg)rKr)rY)r$rr�
<listcomp>/s
z Enum.__dir__.<locals>.<listcomp>r5r-r()r5rO)r$�added_behaviorr)r$rr�-s
zEnum.__dir__cCs0|jtkrt}t|�}n|j}|j}|j||�S)N)rhrjrpr[r^)r$�format_specr)�valrrrr^6s

zEnum.__format__cCs
t|j�S)N)�hashrm)r$rrr�__hash__Esz
Enum.__hash__cCs|j|jffS)N)r5r[)r$r%rrrr'HszEnum.__reduce_ex__cCs|jS)zThe name of the Enum member.)rm)r$rrrrRsz	Enum.namecCs|jS)zThe value of the Enum member.)r[)r$rrrr/Wsz
Enum.valueNc
s�ttj|�}�rt���n|���fdd��j�D�}y|jdd�d�Wn$tk
rp|jdd�d�YnX||||d�}t|_|j|j	�|||<|S)z[
        Create a new Enum subclass that replaces a collection of global constants
        cs g|]}�|�r|�|f�qSrr)rKr)�filter�sourcerrr�qsz!Enum._convert.<locals>.<listcomp>cSs|d|dfS)Nr rr)�trrr�<lambda>vszEnum._convert.<locals>.<lambda>)rAcSs|dS)Nrr)r�rrrr�ys)r�)
�varsr��modules�keys�sortr#�_reduce_ex_by_namer'�updater�)r)rr�r�r��module_globals�membersr)r�r�r�_convert\s

z
Enum._convert)N)r+r(r,r-rer8r�r9r\r]r�r^r�r'rrr/r�rrrrr�s		
)�	metaclassc@seZdZdZdS)r	z.Enum where members are also (and must be) intsN)r+r(r,r-rrrrr	�scCs|jS)N)r)r$r%rrrr��sr�c@speZdZdZdd�Zedd��Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)r
zSupport for flagscCsd|s|dk	r|SdSxBt|�D]6}yt|�}PWqtk
rRtd|�d�YqXqWd|dS)z�
        Generate the next value when not given.

        name: the name of the member
        start: the initital start value or None
        count: the number of existing members
        last_value: the last value assigned or None
        Nr zInvalid Flag value: %rr)r��	_high_bit�	Exceptionr#)rr�r�r�r��high_bitrrrr8�s	zFlag._generate_next_value_cCs.|}|dkr|}|j|�}|dkr*|}|S)Nr)r7)r)r/�original_value�possible_memberrrrr9�s
zFlag._missing_cCsb|jj|d�}|dkr^t||�\}}|r:td||jf��tj|�}d|_||_|jj	||�}|S)zL
        Create a composite member iff value contains only members.
        Nz%r is not a valid %s)
rir��
_decomposer<r+rjrermr[�
setdefault)r)r/�
pseudo_memberr�extra_flagsrrrr7�s
zFlag._create_pseudo_member_cCs"t||j�stS|j|j@|jkS)N)r>r5�NotImplementedr[)r$�otherrrrr��szFlag.__contains__cCsV|j}|jdk	r$d|j|j|jfSt||j�\}}d|jdjdd�|D��|jfS)Nz<%s.%s: %r>�|cSsg|]}t|jp|j��qSr)rprmr[)rKrYrrrr��sz!Flag.__repr__.<locals>.<listcomp>)r5rmr+r[r�rd)r$r)r��	uncoveredrrrr\�s
z
Flag.__repr__cCs�|j}|jdk	r d|j|jfSt||j�\}}t|�dkr^|djdkr^d|j|djfSd|jdjdd�|D��fSdS)Nz%s.%sr rz%s.%rr�cSsg|]}t|jp|j��qSr)rprmr[)rKrYrrrr��sz Flag.__str__.<locals>.<listcomp>)r5rmr+r�r[rrd)r$r)r�r�rrrr]�s
zFlag.__str__cCs
t|j�S)N)�boolr[)r$rrrr��sz
Flag.__bool__cCs"t||j�stS|j|j|jB�S)N)r>r5r�r[)r$r�rrr�__or__�szFlag.__or__cCs"t||j�stS|j|j|j@�S)N)r>r5r�r[)r$r�rrr�__and__�szFlag.__and__cCs"t||j�stS|j|j|jA�S)N)r>r5r�r[)r$r�rrr�__xor__�szFlag.__xor__csDt�j�j�\�}��fdd��jD�}tt|�jd��}�j|�S)Ncs&g|]}|�kr|j�j@r|�qSr)r[)rKrY)r�r$rrr��sz#Flag.__invert__.<locals>.<listcomp>r)r�r5r[r�_or_)r$r��inverted_members�invertedr)r�r$r�
__invert__�szFlag.__invert__N)r+r(r,r-r8r�r9r7r�r\r]r�r�r�r�r�rrrrr
�s

c@sTeZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	eZ
eZe	Zdd
�Z
dS)rzSupport for integer-based FlagscCs*t|t�std||jf��|j|�}|S)Nz%r is not a valid %s)r>�intr<r+r7)r)r/�
new_memberrrrr9�s

zIntFlag._missing_cCs�|jj|d�}|dkr�|g}t||�\}}xL|rvt|�}d|}||jkr\||kr\|j|�||krld}q,||N}q,Wx6t|�D]*}tj||�}d|_||_	|jj
||�}q�W|S)Nrr)rir�r�r�r?r�r�rermr[r�)r)r/r��need_to_createrr��bit�
flag_valuerrrr7�s&


zIntFlag._create_pseudo_member_cCs0t||jtf�stS|j|j|j|�jB�}|S)N)r>r5r�r�r[)r$r��resultrrrr�szIntFlag.__or__cCs,t||jtf�stS|j|j|j|�j@�S)N)r>r5r�r�r[)r$r�rrrr�#szIntFlag.__and__cCs,t||jtf�stS|j|j|j|�jA�S)N)r>r5r�r�r[)r$r�rrrr�(szIntFlag.__xor__cCs|j|j�}|S)N)r5r[)r$r�rrrr�1szIntFlag.__invert__N)r+r(r,r-r�r9r7r�r�r��__ror__�__rand__�__rxor__r�rrrrr�scCs|j�dS)z@returns index of highest bit, or -1 if value is zero or negativer )�
bit_length)r/rrrr�6sr�cCsbg}x0|jj�D]"\}}||jkr|j||jf�qW|r^djdd�|D��}td||f��|S)z?Class decorator for enumerations ensuring unique member values.z, cSsg|]\}}d||f�qS)z%s -> %sr)rK�aliasrrrrr�Bszunique.<locals>.<listcomp>z duplicate values found in %r: %s)r�rRrr?rdr<)�enumeration�
duplicatesrr��
alias_detailsrrrr
:s
cCs�|}|dk}|r*dd�t|jj��D�}ndd�t|jj��D�}g}x4|D],\}}|rL||@|krL|j|�||M}qLW|r�||jkr�|j|j|�|jdd�dd�t|�d	kr�|dj|kr�|jd�||fS)
z#Extract all members from the value.rcSs"g|]\}}|jdk	r||f�qS)N)r)rKrTrYrrrr�Rsz_decompose.<locals>.<listcomp>cSs*g|]"\}}|jdk	st|�r||f�qS)N)r�
_power_of_two)rKrTrYrrrr�YscSs|jS)N)r[)rYrrrr�dsz_decompose.<locals>.<lambda>T)rA�reverser )r�rirRr?r�rr/ra)�flagr/�not_covered�negative�flags_to_checkr�r�r�rrrr�Gs$

r�cCs|dkrdS|dt|�kS)Nr Fr)r�)r/rrrr�jsr�)#r��typesrr�	functoolsr�operatorrr��_collectionsr�ImportError�collections�__all__rrr"r*rjr.r�dictr0rr�rr�r	r�r
rr�r
r�r�rrrr�<module>s@3mA
#pickletools.cpython-36.pyc000064400000200746150335715140011537 0ustar003


 \f�I@s�
dZddlZddlZddlZddlZddlZdddgZejZ�d�Z�d�Z	�d�Z
�d�Z�d�ZGdd�de
�Zdd
lmZdd�Zeddedd�Zdd�Zeddedd�Zdd�Zedd	edd�Zdd�Zedd	edd�Zdd �Zed!d"ed#d�Z�d�d%d&�Zed'eed(d�Zd)d*�Zed+eed,d�Zd-d.�Z ed/ee d0d�Z!d1d2�Z"ed3e	e"d4d�Z#d5d6�Z$ed7e
e$d8d�Z%d9d:�Z&ed;e	e&d<d�Z'd=d:�Z&ed;e	e&d>d�Z'd?d@�Z(edAee(dBd�Z)dCdD�Z*edEee*dFd�Z+dGdH�Z,edIee,dJd�Z-dKdL�Z.edMe	e.dNd�Z/dOdP�Z0edQee0dRd�Z1dSdT�Z2edUee2dVd�Z3dWdX�Z4dYdZ�Z5ed[ee4d\d�Z6ed]ee5d^d�Z7d_d`�Z8edaee8dbd�Z9dcdd�Z:eded"e:dfd�Z;ddglm<Z<dhdi�Z=edje	e=dkd�Z>dldm�Z?edne
e?dod�Z@Gdpdq�dqe
�ZAeAdreBdsdt�ZCZDeAdueBeEfdvdt�ZFeAdweEdxdt�ZGeAdyeHdzdt�ZIeAd{eJeKfd|dt�ZLZMeAd}eJd~dt�ZNeAdeKd�dt�ZOeAd�ePd�d�dt�ZQeAd�eRd�dt�ZSeAd�eTd�dt�ZUeAd�eVd�dt�ZWeAd�eXd�dt�ZYeAd�eXd�dt�ZZeAd�e
d�dt�Z[eAd�eAd�dt�Z\eAd�eAd�dt�Z]Gd�d��d�e
�Z^e^Z_e_d�d�e6geFgdd�d��e_d�d�egeCgdd�d��e_d�d�egeCgdd�d��e_d�d�egeCgdd�d��e_d�d�e7geCgdd�d��e_d�d�e>geCgdd�d��e_d�d�e@geCgdd�d��e_d�d�egeLgdd�d��e_d�d�e%geLgdd�d��e_d�d�e#geLgdd�d��e_d�d�e)geNgdd�d��e_d�d�e'geNgdd�d��e_d�d�e+geNgd	d�d��e_d�d�dgeQgdd�d��e_d�d�dgeGgdd�d��e_d�d�dgeGgdd�d��e_d�d�e-geOgdd�d��e_d�d�e/geOgd	d�d��e_d�d�e1geOgdd�d��e_d�d�e3geOgd	d�d��e_d�d�e9geIgdd�d��e_d�d�e;geIgdd�d��e_d�d�dgeUgdd�d��e_d�d�deUe[geUgdd�d��e_d�d�deUe\e]geUgdd�d��e_d�d�de\e]geUgdd�d��e_d�d�dgeSgdd�d��e_d�d�de\e]geSgdd�d��e_d�d�de[geSgdd�d��e_d�d�de[e[geSgdd�d��e_d�d�de[e[e[geSgdd�d��e_d�d�dgeWgdd�d��e_d�d�de\e]geWgdd�d��e_d�d�deWe[e[geWgdd�d��e_d�d�deWe\e]geWgdd�d��e_d��ddgeYgd	�dd��e_�d�ddeYe\e]geYgd	�dd��e_�d�dde\e]geZgd	�dd��e_�d�d	de[ggd�d
d��e_�d�dde[ge[e[gd�d
d��e_�d�ddge\gd�dd��e_�d�dde\e]ggd�dd��e_�d�de6ge[gd�dd��e_�d�dege[gd�dd��e_�d�dege[gd�dd��e_�d�de6ggd�dd��e_�d �d!eggd�d"d��e_�d#�d$eggd�d%d��e_�d&�d'de[ge[gd	�d(d��e_�d)�d*ege[gd�d+d��e_�d,�d-ege[gd�d.d��e_�d/�d0ege[gd�d1d��e_�d2�d3e!ge[gd�d4d��e_�d5�d6deOeOge[gd	�d7d��e_�d8�d9de[e[ge[gd�d:d��e_�d;�d<de[e[ge[gd�d=d��e_�d>�d?e!e\e]ge[gd�d@d��e_�dA�dBde\e[e]ge[gd�dCd��e_�dD�dEde[e[ge[gd�dFd��e_�dG�dHde[e[e[ge[gd	�dId��e_�dJ�dKeggd�dLd��e_�dM�dNde[ggd�dOd��e_�dP�dQeggd	�dRd��e_�dS�dTege[gd�dUd��e_�dV�dWde[ge[gd�dXd��gAZ`[_iZaiZbxzece`�D]n\ZdZeeejfeak�
r�eg�dYeejfeaeejfedf��eejhebk�
r�eg�dZeejhebeejhedf��edeaeejf<edebeejh<�
q�W[a[b[d[eiZixe`D]Zeeeeieejh<�qW[e�d��d\�d]�Zjej�[j�d��d^�d_�Zk�d`d�Zl�dad�Zm�d��dbd�ZnG�dc�dd��dd�Zo�deZp�dfZqepeq�dg�Zr�dh�di�Zset�djk�
r�ddluZueujv�dk�dl�Zwewjx�dmeujy�dn��do�dp�dq�ewjx�dr�dsejzeujy�dt��du�dv�ewjx�dw�dx�dy�dz�d{�ewjx�d|�d}d	eB�d~�dv�ewjx�d�d��dy�d��d{�ewjx�d��d��d��d��d��ewjx�d��d��dy�d��d{�ewjx�d��dy�d��d{�ewj{�Z|e|j}�r�es�n�e|j~�r�d�ndZ~e|j�s�ewj��n�e�e|j�dk�
r*ene|jde|j�de|j�e~�nZe|j��
r6indZ�xHe|jD]>Z�e|j�j�e�jf�d��Z�e|j�j�e��d��ene�e|j�e�e|j�e~��
qBWdS(�ar"Executable documentation" for the pickle module.

Extensive comments about the pickle protocols and pickle-machine opcodes
can be found here.  Some functions meant for external use:

genops(pickle)
   Generate all the opcodes in a pickle, as (opcode, arg, position) triples.

dis(pickle, out=None, memo=None, indentlevel=4)
   Print a symbolic disassembly of a pickle.
�N�dis�genops�optimize�����c@seZdZdZdd�ZdS)	�ArgumentDescriptor�name�n�reader�doccCs`t|t�st�||_t|t�r8|dks<|ttttt	fks<t�||_
||_t|t�sVt�||_dS)Nr)
�
isinstance�str�AssertionErrorr�int�
UP_TO_NEWLINE�TAKEN_FROM_ARGUMENT1�TAKEN_FROM_ARGUMENT4�TAKEN_FROM_ARGUMENT4U�TAKEN_FROM_ARGUMENT8Urr
r)�selfrrr
r�r�#/usr/lib64/python3.6/pickletools.py�__init__�szArgumentDescriptor.__init__N)rrr
r)�__name__�
__module__�__qualname__�	__slots__rrrrrr
�s
r
)�unpackcCs"|jd�}|r|dStd��dS)zG
    >>> import io
    >>> read_uint1(io.BytesIO(b'\xff'))
    255
    rrz'not enough data in stream to read uint1N)�read�
ValueError)�f�datarrr�
read_uint1�s
r%�uint1zOne-byte unsigned integer.)rrr
rcCs0|jd�}t|�dkr$td|�dStd��dS)z�
    >>> import io
    >>> read_uint2(io.BytesIO(b'\xff\x00'))
    255
    >>> read_uint2(io.BytesIO(b'\xff\xff'))
    65535
    rz<Hrz'not enough data in stream to read uint2N)r!�len�_unpackr")r#r$rrr�
read_uint2�s	
r)�uint2z)Two-byte unsigned integer, little-endian.cCs0|jd�}t|�dkr$td|�dStd��dS)z�
    >>> import io
    >>> read_int4(io.BytesIO(b'\xff\x00\x00\x00'))
    255
    >>> read_int4(io.BytesIO(b'\x00\x00\x00\x80')) == -(2**31)
    True
    rz<irz&not enough data in stream to read int4N)r!r'r(r")r#r$rrr�	read_int4�s	
r+�int4z8Four-byte signed integer, little-endian, 2's complement.cCs0|jd�}t|�dkr$td|�dStd��dS)z�
    >>> import io
    >>> read_uint4(io.BytesIO(b'\xff\x00\x00\x00'))
    255
    >>> read_uint4(io.BytesIO(b'\x00\x00\x00\x80')) == 2**31
    True
    rz<Irz'not enough data in stream to read uint4N)r!r'r(r")r#r$rrr�
read_uint4s	
r-�uint4z*Four-byte unsigned integer, little-endian.cCs0|jd�}t|�dkr$td|�dStd��dS)z�
    >>> import io
    >>> read_uint8(io.BytesIO(b'\xff\x00\x00\x00\x00\x00\x00\x00'))
    255
    >>> read_uint8(io.BytesIO(b'\xff' * 8)) == 2**64-1
    True
    �z<Qrz'not enough data in stream to read uint8N)r!r'r(r")r#r$rrr�
read_uint8&s	
r0�uint8r/z+Eight-byte unsigned integer, little-endian.TcCs�|j�}|jd�std��|dd�}|rvxJdD]6}|j|�r0|j|�sXtd||f��|dd
�}Pq0Wtd|��|r�tj|�d	jd
�}|S)au
    >>> import io
    >>> read_stringnl(io.BytesIO(b"'abcd'\nefg\n"))
    'abcd'

    >>> read_stringnl(io.BytesIO(b"\n"))
    Traceback (most recent call last):
    ...
    ValueError: no string quotes around b''

    >>> read_stringnl(io.BytesIO(b"\n"), stripquotes=False)
    ''

    >>> read_stringnl(io.BytesIO(b"''\n"))
    ''

    >>> read_stringnl(io.BytesIO(b'"abcd"'))
    Traceback (most recent call last):
    ...
    ValueError: no newline found when trying to read stringnl

    Embedded escapes are undone in the result.
    >>> read_stringnl(io.BytesIO(br"'a\n\\b\x00c\td'" + b"\n'e'"))
    'a\n\\b\x00c\td'
    �
z-no newline found when trying to read stringnlNr�"�'z,strinq quote %r not found at both ends of %rzno string quotes around %rr�ascii���)r3r4r6)�readline�endswithr"�
startswith�codecs�
escape_decode�decode)r#r<�stripquotesr$�qrrr�
read_stringnl;s 



r?�stringnlz�A newline-terminated string.

                   This is a repr-style string, with embedded escapes, and
                   bracketing quotes.
                   cCst|dd�S)NF)r=)r?)r#rrr�read_stringnl_noescapetsrA�stringnl_noescapeaA newline-terminated string.

                        This is a str-style string, without embedded escapes,
                        or bracketing quotes.  It should consist solely of
                        printable ASCII characters.
                        cCsdt|�t|�fS)zp
    >>> import io
    >>> read_stringnl_noescape_pair(io.BytesIO(b"Queue\nEmpty\njunk"))
    'Queue Empty'
    z%s %s)rA)r#rrr�read_stringnl_noescape_pair�srC�stringnl_noescape_paira�A pair of newline-terminated strings.

                             These are str-style strings, without embedded
                             escapes, or bracketing quotes.  They should
                             consist solely of printable ASCII characters.
                             The pair is returned as a single string, with
                             a single blank separating the two strings.
                             cCsLt|�}|dkst�|j|�}t|�|kr4|jd�Std|t|�f��dS)z�
    >>> import io
    >>> read_string1(io.BytesIO(b"\x00"))
    ''
    >>> read_string1(io.BytesIO(b"\x03abcdef"))
    'abc'
    rzlatin-1z2expected %d bytes in a string1, but only %d remainN)r%rr!r'r<r")r#rr$rrr�read_string1�s	

rE�string1z�A counted string.

              The first argument is a 1-byte unsigned int giving the number
              of bytes in the string, and the second argument is that many
              bytes.
              cCsTt|�}|dkrtd|��|j|�}t|�|kr<|jd�Std|t|�f��dS)aP
    >>> import io
    >>> read_string4(io.BytesIO(b"\x00\x00\x00\x00abc"))
    ''
    >>> read_string4(io.BytesIO(b"\x03\x00\x00\x00abcdef"))
    'abc'
    >>> read_string4(io.BytesIO(b"\x00\x00\x00\x03abcdef"))
    Traceback (most recent call last):
    ...
    ValueError: expected 50331648 bytes in a string4, but only 6 remain
    rzstring4 byte count < 0: %dzlatin-1z2expected %d bytes in a string4, but only %d remainN)r+r"r!r'r<)r#rr$rrr�read_string4�s


rG�string4z�A counted string.

              The first argument is a 4-byte little-endian signed int giving
              the number of bytes in the string, and the second argument is
              that many bytes.
              cCsFt|�}|dkst�|j|�}t|�|kr.|Std|t|�f��dS)z�
    >>> import io
    >>> read_bytes1(io.BytesIO(b"\x00"))
    b''
    >>> read_bytes1(io.BytesIO(b"\x03abcdef"))
    b'abc'
    rz1expected %d bytes in a bytes1, but only %d remainN)r%rr!r'r")r#rr$rrr�read_bytes1�s	
rI�bytes1z�A counted bytes string.

              The first argument is a 1-byte unsigned int giving the number
              of bytes in the string, and the second argument is that many
              bytes.
              cCsFt|�}|dkst�|j|�}t|�|kr.|Std|t|�f��dS)z�
    >>> import io
    >>> read_bytes1(io.BytesIO(b"\x00"))
    b''
    >>> read_bytes1(io.BytesIO(b"\x03abcdef"))
    b'abc'
    rz1expected %d bytes in a bytes1, but only %d remainN)r%rr!r'r")r#rr$rrrrI�s	
z�A counted bytes string.

              The first argument is a 1-byte unsigned int giving the number
              of bytes, and the second argument is that many bytes.
              cCs\t|�}|dkst�|tjkr*td|��|j|�}t|�|krD|Std|t|�f��dS)aN
    >>> import io
    >>> read_bytes4(io.BytesIO(b"\x00\x00\x00\x00abc"))
    b''
    >>> read_bytes4(io.BytesIO(b"\x03\x00\x00\x00abcdef"))
    b'abc'
    >>> read_bytes4(io.BytesIO(b"\x00\x00\x00\x03abcdef"))
    Traceback (most recent call last):
    ...
    ValueError: expected 50331648 bytes in a bytes4, but only 6 remain
    rz#bytes4 byte count > sys.maxsize: %dz1expected %d bytes in a bytes4, but only %d remainN)r-r�sys�maxsizer"r!r')r#rr$rrr�read_bytes4s


rM�bytes4z�A counted bytes string.

              The first argument is a 4-byte little-endian unsigned int giving
              the number of bytes, and the second argument is that many bytes.
              cCs\t|�}|dkst�|tjkr*td|��|j|�}t|�|krD|Std|t|�f��dS)a�
    >>> import io, struct, sys
    >>> read_bytes8(io.BytesIO(b"\x00\x00\x00\x00\x00\x00\x00\x00abc"))
    b''
    >>> read_bytes8(io.BytesIO(b"\x03\x00\x00\x00\x00\x00\x00\x00abcdef"))
    b'abc'
    >>> bigsize8 = struct.pack("<Q", sys.maxsize//3)
    >>> read_bytes8(io.BytesIO(bigsize8 + b"abcdef"))  #doctest: +ELLIPSIS
    Traceback (most recent call last):
    ...
    ValueError: expected ... bytes in a bytes8, but only 6 remain
    rz#bytes8 byte count > sys.maxsize: %dz1expected %d bytes in a bytes8, but only %d remainN)r0rrKrLr"r!r')r#rr$rrr�read_bytes83s

rO�bytes8z�A counted bytes string.

              The first argument is an 8-byte little-endian unsigned int giving
              the number of bytes, and the second argument is that many bytes.
              cCs0|j�}|jd�std��|dd�}t|d�S)zm
    >>> import io
    >>> read_unicodestringnl(io.BytesIO(b"abc\\uabcd\njunk")) == 'abc\uabcd'
    True
    r2z4no newline found when trying to read unicodestringnlNrzraw-unicode-escaper6)r7r8r"r)r#r$rrr�read_unicodestringnlUs

rQ�unicodestringnlz�A newline-terminated Unicode string.

                      This is raw-unicode-escape encoded, so consists of
                      printable ASCII characters, and may contain embedded
                      escape sequences.
                      cCsNt|�}|dkst�|j|�}t|�|kr6t|dd�Std|t|�f��dS)a�
    >>> import io
    >>> s = 'abcd\uabcd'
    >>> enc = s.encode('utf-8')
    >>> enc
    b'abcd\xea\xaf\x8d'
    >>> n = bytes([len(enc)])  # little-endian 1-byte length
    >>> t = read_unicodestring1(io.BytesIO(n + enc + b'junk'))
    >>> s == t
    True

    >>> read_unicodestring1(io.BytesIO(n + enc[:-1]))
    Traceback (most recent call last):
    ...
    ValueError: expected 7 bytes in a unicodestring1, but only 6 remain
    rzutf-8�
surrogatepassz9expected %d bytes in a unicodestring1, but only %d remainN)r%rr!r'rr")r#rr$rrr�read_unicodestring1os
rT�unicodestring1aAA counted Unicode string.

                    The first argument is a 1-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    cCsdt|�}|dkst�|tjkr*td|��|j|�}t|�|krLt|dd�Std|t|�f��dS)a�
    >>> import io
    >>> s = 'abcd\uabcd'
    >>> enc = s.encode('utf-8')
    >>> enc
    b'abcd\xea\xaf\x8d'
    >>> n = bytes([len(enc), 0, 0, 0])  # little-endian 4-byte length
    >>> t = read_unicodestring4(io.BytesIO(n + enc + b'junk'))
    >>> s == t
    True

    >>> read_unicodestring4(io.BytesIO(n + enc[:-1]))
    Traceback (most recent call last):
    ...
    ValueError: expected 7 bytes in a unicodestring4, but only 6 remain
    rz+unicodestring4 byte count > sys.maxsize: %dzutf-8rSz9expected %d bytes in a unicodestring4, but only %d remainN)r-rrKrLr"r!r'r)r#rr$rrr�read_unicodestring4�s

rV�unicodestring4aAA counted Unicode string.

                    The first argument is a 4-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    cCsdt|�}|dkst�|tjkr*td|��|j|�}t|�|krLt|dd�Std|t|�f��dS)a�
    >>> import io
    >>> s = 'abcd\uabcd'
    >>> enc = s.encode('utf-8')
    >>> enc
    b'abcd\xea\xaf\x8d'
    >>> n = bytes([len(enc)]) + b'\0' * 7  # little-endian 8-byte length
    >>> t = read_unicodestring8(io.BytesIO(n + enc + b'junk'))
    >>> s == t
    True

    >>> read_unicodestring8(io.BytesIO(n + enc[:-1]))
    Traceback (most recent call last):
    ...
    ValueError: expected 7 bytes in a unicodestring8, but only 6 remain
    rz+unicodestring8 byte count > sys.maxsize: %dzutf-8rSz9expected %d bytes in a unicodestring8, but only %d remainN)r0rrKrLr"r!r'r)r#rr$rrr�read_unicodestring8�s

rX�unicodestring8aBA counted Unicode string.

                    The first argument is an 8-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    cCs.t|ddd�}|dkrdS|dkr&dSt|�S)z�
    >>> import io
    >>> read_decimalnl_short(io.BytesIO(b"1234\n56"))
    1234

    >>> read_decimalnl_short(io.BytesIO(b"1234L\n56"))
    Traceback (most recent call last):
    ...
    ValueError: invalid literal for int() with base 10: b'1234L'
    F)r<r=s00s01T)r?r)r#�srrr�read_decimalnl_short�sr[cCs2t|ddd�}|dd�dkr*|dd�}t|�S)z�
    >>> import io

    >>> read_decimalnl_long(io.BytesIO(b"1234L\n56"))
    1234

    >>> read_decimalnl_long(io.BytesIO(b"123456789012345678901234L\n6"))
    123456789012345678901234
    F)r<r=rN�Lr6r6)r?r)r#rZrrr�read_decimalnl_long�sr]�decimalnl_shorta�A newline-terminated decimal integer literal.

                          This never has a trailing 'L', and the integer fit
                          in a short Python int on the box where the pickle
                          was written -- but there's no guarantee it will fit
                          in a short Python int on the box where the pickle
                          is read.
                          �decimalnl_longz�A newline-terminated decimal integer literal.

                         This has a trailing 'L', and can represent integers
                         of any size.
                         cCst|ddd�}t|�S)zO
    >>> import io
    >>> read_floatnl(io.BytesIO(b"-1.25\n6"))
    -1.25
    F)r<r=)r?�float)r#rZrrr�read_floatnl'sra�floatnla�A newline-terminated decimal floating literal.

              In general this requires 17 significant digits for roundtrip
              identity, and pickling then unpickling infinities, NaNs, and
              minus zero doesn't work across boxes, or on some boxes even
              on itself (e.g., Windows can't read the strings it produces
              for infinities or NaNs).
              cCs0|jd�}t|�dkr$td|�dStd��dS)z�
    >>> import io, struct
    >>> raw = struct.pack(">d", -1.25)
    >>> raw
    b'\xbf\xf4\x00\x00\x00\x00\x00\x00'
    >>> read_float8(io.BytesIO(raw + b"\n"))
    -1.25
    r/z>drz(not enough data in stream to read float8N)r!r'r(r")r#r$rrr�read_float8=s

rc�float8aAn 8-byte binary representation of a float, big-endian.

             The format is unique to Python, and shared with the struct
             module (format string '>d') "in theory" (the struct and pickle
             implementations don't share the code -- they should).  It's
             strongly related to the IEEE-754 double format, and, in normal
             cases, is in fact identical to the big-endian 754 double format.
             On other boxes the dynamic range is limited to that of a 754
             double, and "add a half and chop" rounding is used to reduce
             the precision to 53 bits.  However, even on a 754 box,
             infinities, NaNs, and minus zero may not be handled correctly
             (may not survive roundtrip pickling intact).
             )�decode_longcCs.t|�}|j|�}t|�|kr&td��t|�S)a+
    >>> import io
    >>> read_long1(io.BytesIO(b"\x00"))
    0
    >>> read_long1(io.BytesIO(b"\x02\xff\x00"))
    255
    >>> read_long1(io.BytesIO(b"\x02\xff\x7f"))
    32767
    >>> read_long1(io.BytesIO(b"\x02\x00\xff"))
    -256
    >>> read_long1(io.BytesIO(b"\x02\x00\x80"))
    -32768
    z'not enough data in stream to read long1)r%r!r'r"re)r#rr$rrr�
read_long1cs

rf�long1aA binary long, little-endian, using 1-byte size.

    This first reads one byte as an unsigned size, then reads that
    many bytes and interprets them as a little-endian 2's-complement long.
    If the size is 0, that's taken as a shortcut for the long 0L.
    cCsBt|�}|dkrtd|��|j|�}t|�|kr:td��t|�S)ag
    >>> import io
    >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\xff\x00"))
    255
    >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\xff\x7f"))
    32767
    >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\x00\xff"))
    -256
    >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\x00\x80"))
    -32768
    >>> read_long1(io.BytesIO(b"\x00\x00\x00\x00"))
    0
    rzlong4 byte count < 0: %dz'not enough data in stream to read long4)r+r"r!r're)r#rr$rrr�
read_long4�s
rh�long4a�A binary representation of a long, little-endian.

    This first reads four bytes as a signed size (but requires the
    size to be >= 0), then reads that many bytes and interprets them
    as a little-endian 2's-complement long.  If the size is 0, that's taken
    as a shortcut for the int 0, although LONG1 should really be used
    then instead (and in any case where # of bytes < 256).
    c@s eZdZd	Zdd�Zdd�ZdS)
�StackObjectr�obtypercCspt|t�st�||_t|t�s,t|t�s,t�t|t�rRx|D]}t|t�s<t�q<W||_t|t�sft�||_dS)N)rrrr�type�tuplerkr)rrrkrZ	containedrrrr�s

zStackObject.__init__cCs|jS)N)r)rrrr�__repr__�szStackObject.__repr__N)rrkr)rrrrrrnrrrrrj�s

rjrzA Python integer object.)rrkrZint_or_boolz#A Python integer or boolean object.�boolzA Python boolean object.r`zA Python float object.Zbytes_or_strz*A Python bytes or (Unicode) string object.�byteszA Python bytes object.rz!A Python (Unicode) string object.�NonezThe Python None object.rmzA Python tuple object.�listzA Python list object.�dictzA Python dict object.�setzA Python set object.�	frozensetzA Python frozenset object.�anyzAny kind of object whatsoever.Zmarkaz'The mark' is a unique object.

Opcodes that operate on a variable number of objects
generally don't embed the count of objects in the opcode,
or pull it off the stack.  Instead the MARK opcode is used
to push a special marker object on the stack, and then
some other opcodes grab all the objects from the top of
the stack down to (but not including) the topmost marker
object.
�
stackslicea�An object representing a contiguous slice of the stack.

This is used in conjunction with markobject, to represent all
of the stack following the topmost markobject.  For example,
the POP_MARK opcode changes the stack from

    [..., markobject, stackslice]
to
    [...]

No matter how many object are on the stack after the topmost
markobject, POP_MARK gets rid of all of them (including the
topmost markobject too).
c@seZdZdZdd	�Zd
S)�
OpcodeInfor�code�arg�stack_before�stack_after�protorc	Cs�t|t�st�||_t|t�s"t�t|�dks2t�||_|dksNt|t�sNt�||_t|t�sbt�x|D]}t|t	�sht�qhW||_
t|t�s�t�x|D]}t|t	�s�t�q�W||_t|t�r�d|ko�t
jkns�t�||_t|t�s�t�||_dS)Nrr)rrrrr'ryr
rzrrrjr{r|r�pickleZHIGHEST_PROTOCOLr}r)	rrryrzr{r|r}r�xrrrrTs&

(zOpcodeInfo.__init__N)rryrzr{r|r}r)rrrrrrrrrrx5srxZINT�Ia�Push an integer or bool.

      The argument is a newline-terminated decimal literal string.

      The intent may have been that this always fit in a short Python int,
      but INT can be generated in pickles written on a 64-bit box that
      require a Python long on a 32-bit box.  The difference between this
      and LONG then is that INT skips a trailing 'L', and produces a short
      int whenever possible.

      Another difference is due to that, when bool was introduced as a
      distinct type in 2.3, builtin names True and False were also added to
      2.2.2, mapping to ints 1 and 0.  For compatibility in both directions,
      True gets pickled as INT + "I01\n", and False as INT + "I00\n".
      Leading zeroes are never produced for a genuine integer.  The 2.3
      (and later) unpicklers special-case these and return bool instead;
      earlier unpicklers ignore the leading "0" and return the int.
      )rryrzr{r|r}rZBININT�Ja1Push a four-byte signed integer.

      This handles the full range of Python (short) integers on a 32-bit
      box, directly as binary bytes (1 for the opcode and 4 for the integer).
      If the integer is non-negative and fits in 1 or 2 bytes, pickling via
      BININT1 or BININT2 saves space.
      ZBININT1�Kz�Push a one-byte unsigned integer.

      This is a space optimization for pickling very small non-negative ints,
      in range(256).
      ZBININT2�Mz�Push a two-byte unsigned integer.

      This is a space optimization for pickling small positive ints, in
      range(256, 2**16).  Integers in range(256) can also be pickled via
      BININT2, but BININT1 instead saves a byte.
      ZLONG�La�Push a long integer.

      The same as INT, except that the literal ends with 'L', and always
      unpickles to a Python long.  There doesn't seem a real purpose to the
      trailing 'L'.

      Note that LONG takes time quadratic in the number of digits when
      unpickling (this is simply due to the nature of decimal->binary
      conversion).  Proto 2 added linear-time (in C; still quadratic-time
      in Python) LONG1 and LONG4 opcodes.
      ZLONG1�Šz|Long integer using one-byte length.

      A more efficient encoding of a Python long; the long1 encoding
      says it all.ZLONG4�‹z~Long integer using found-byte length.

      A more efficient encoding of a Python long; the long4 encoding
      says it all.�STRING�Sa�Push a Python string object.

      The argument is a repr-style string, with bracketing quote characters,
      and perhaps embedded escapes.  The argument extends until the next
      newline character.  These are usually decoded into a str instance
      using the encoding given to the Unpickler constructor. or the default,
      'ASCII'.  If the encoding given was 'bytes' however, they will be
      decoded as bytes object instead.
      Z	BINSTRING�Ta�Push a Python string object.

      There are two arguments: the first is a 4-byte little-endian
      signed int giving the number of bytes in the string, and the
      second is that many bytes, which are taken literally as the string
      content.  These are usually decoded into a str instance using the
      encoding given to the Unpickler constructor. or the default,
      'ASCII'.  If the encoding given was 'bytes' however, they will be
      decoded as bytes object instead.
      ZSHORT_BINSTRING�Ua�Push a Python string object.

      There are two arguments: the first is a 1-byte unsigned int giving
      the number of bytes in the string, and the second is that many
      bytes, which are taken literally as the string content.  These are
      usually decoded into a str instance using the encoding given to
      the Unpickler constructor. or the default, 'ASCII'.  If the
      encoding given was 'bytes' however, they will be decoded as bytes
      object instead.
      ZBINBYTES�Bz�Push a Python bytes object.

      There are two arguments:  the first is a 4-byte little-endian unsigned int
      giving the number of bytes, and the second is that many bytes, which are
      taken literally as the bytes content.
      ZSHORT_BINBYTES�Cz�Push a Python bytes object.

      There are two arguments:  the first is a 1-byte unsigned int giving
      the number of bytes, and the second is that many bytes, which are taken
      literally as the string content.
      Z	BINBYTES8�Žz�Push a Python bytes object.

      There are two arguments:  the first is an 8-byte unsigned int giving
      the number of bytes in the string, and the second is that many bytes,
      which are taken literally as the string content.
      ZNONE�NzPush None on the stack.ZNEWTRUE�ˆzPush True onto the stack.ZNEWFALSE�‰zPush False onto the stack.�UNICODE�Vz�Push a Python Unicode string object.

      The argument is a raw-unicode-escape encoding of a Unicode string,
      and so may contain embedded escape sequences.  The argument extends
      until the next newline character.
      ZSHORT_BINUNICODE�ŒaPush a Python Unicode string object.

      There are two arguments:  the first is a 1-byte little-endian signed int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      Z
BINUNICODE�XaPush a Python Unicode string object.

      There are two arguments:  the first is a 4-byte little-endian unsigned int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      ZBINUNICODE8�aPush a Python Unicode string object.

      There are two arguments:  the first is an 8-byte little-endian signed int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      ZFLOAT�Fa�Newline-terminated decimal float literal.

      The argument is repr(a_float), and in general requires 17 significant
      digits for roundtrip conversion to be an identity (this is so for
      IEEE-754 double precision values, which is what Python float maps to
      on most boxes).

      In general, FLOAT cannot be used to transport infinities, NaNs, or
      minus zero across boxes (or even on a single box, if the platform C
      library can't read the strings it produces for such things -- Windows
      is like that), but may do less damage than BINFLOAT on boxes with
      greater precision or dynamic range than IEEE-754 double.
      ZBINFLOAT�Ga�Float stored in binary form, with 8 bytes of data.

      This generally requires less than half the space of FLOAT encoding.
      In general, BINFLOAT cannot be used to transport infinities, NaNs, or
      minus zero, raises an exception if the exponent exceeds the range of
      an IEEE-754 double, and retains no more than 53 bits of precision (if
      there are more than that, "add a half and chop" rounding is used to
      cut it back to 53 significant bits).
      Z
EMPTY_LIST�]zPush an empty list.ZAPPEND�az�Append an object to a list.

      Stack before:  ... pylist anyobject
      Stack after:   ... pylist+[anyobject]

      although pylist is really extended in-place.
      ZAPPENDS�ez�Extend a list by a slice of stack objects.

      Stack before:  ... pylist markobject stackslice
      Stack after:   ... pylist+stackslice

      although pylist is really extended in-place.
      ZLIST�lasBuild a list out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python list, which single list object replaces all of the
      stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... [1, 2, 3, 'abc']
      ZEMPTY_TUPLE�)zPush an empty tuple.ZTUPLE�tavBuild a tuple out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python tuple, which single tuple object replaces all of the
      stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... (1, 2, 3, 'abc')
      ZTUPLE1�…z�Build a one-tuple out of the topmost item on the stack.

      This code pops one value off the stack and pushes a tuple of
      length 1 whose one item is that value back onto it.  In other
      words:

          stack[-1] = tuple(stack[-1:])
      ZTUPLE2�†aBuild a two-tuple out of the top two items on the stack.

      This code pops two values off the stack and pushes a tuple of
      length 2 whose items are those values back onto it.  In other
      words:

          stack[-2:] = [tuple(stack[-2:])]
      ZTUPLE3�‡aBuild a three-tuple out of the top three items on the stack.

      This code pops three values off the stack and pushes a tuple of
      length 3 whose items are those values back onto it.  In other
      words:

          stack[-3:] = [tuple(stack[-3:])]
      Z
EMPTY_DICT�}zPush an empty dict.ZDICT�da�Build a dict out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python dict, which single dict object replaces all of the
      stack from the topmost markobject onward.  The stack slice alternates
      key, value, key, value, ....  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... {1: 2, 3: 'abc'}
      ZSETITEMrZz�Add a key+value pair to an existing dict.

      Stack before:  ... pydict key value
      Stack after:   ... pydict

      where pydict has been modified via pydict[key] = value.
      ZSETITEMS�ua\Add an arbitrary number of key+value pairs to an existing dict.

      The slice of the stack following the topmost markobject is taken as
      an alternating sequence of keys and values, added to the dict
      immediately under the topmost markobject.  Everything at and after the
      topmost markobject is popped, leaving the mutated dict at the top
      of the stack.

      Stack before:  ... pydict markobject key_1 value_1 ... key_n value_n
      Stack after:   ... pydict

      where pydict has been modified via pydict[key_i] = value_i for i in
      1, 2, ..., n, and in that order.
      Z	EMPTY_SET�zPush an empty set.ZADDITEMS�a$Add an arbitrary number of items to an existing set.

      The slice of the stack following the topmost markobject is taken as
      a sequence of items, added to the set immediately under the topmost
      markobject.  Everything at and after the topmost markobject is popped,
      leaving the mutated set at the top of the stack.

      Stack before:  ... pyset markobject item_1 ... item_n
      Stack after:   ... pyset

      where pyset has been modified via pyset.add(item_i) = item_i for i in
      1, 2, ..., n, and in that order.
      Z	FROZENSET�‘azBuild a frozenset out of the topmost slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python frozenset, which single frozenset object replaces all
      of the stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3
      Stack after:  ... frozenset({1, 2, 3})
      �POP�0z<Discard the top stack item, shrinking the stack by one item.ZDUP�2z=Push the top stack item onto the stack again, duplicating it.�MARK�(z�Push markobject onto the stack.

      markobject is a unique object, used by other opcodes to identify a
      region of the stack containing a variable number of objects for them
      to work on.  See markobject.doc for more detail.
      ZPOP_MARK�1aPop all the stack objects at and above the topmost markobject.

      When an opcode using a variable number of stack objects is done,
      POP_MARK is used to remove those objects, and to remove the markobject
      that delimited their starting position on the stack.
      �GET�gz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the newline-terminated
      decimal string following.  BINGET and LONG_BINGET are space-optimized
      versions.
      �BINGET�hz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the 1-byte unsigned
      integer following.
      �LONG_BINGET�jz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the 4-byte unsigned
      little-endian integer following.
      �PUT�pz�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the newline-
      terminated decimal string following.  BINPUT and LONG_BINPUT are
      space-optimized versions.
      �BINPUTr>z�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the 1-byte
      unsigned integer following.
      �LONG_BINPUT�rz�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the 4-byte
      unsigned little-endian integer following.
      �MEMOIZE�”z�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write is the number of
      elements currently present in the memo.
      ZEXT1�‚a�Extension code.

      This code and the similar EXT2 and EXT4 allow using a registry
      of popular objects that are pickled by name, typically classes.
      It is envisioned that through a global negotiation and
      registration process, third parties can set up a mapping between
      ints and object names.

      In order to guarantee pickle interchangeability, the extension
      code registry ought to be global, although a range of codes may
      be reserved for private use.

      EXT1 has a 1-byte integer argument.  This is used to index into the
      extension registry, and the object at that index is pushed on the stack.
      ZEXT2�ƒzNExtension code.

      See EXT1.  EXT2 has a two-byte integer argument.
      ZEXT4�„zOExtension code.

      See EXT1.  EXT4 has a four-byte integer argument.
      ZGLOBAL�ca�Push a global object (module.attr) on the stack.

      Two newline-terminated strings follow the GLOBAL opcode.  The first is
      taken as a module name, and the second as a class name.  The class
      object module.class is pushed on the stack.  More accurately, the
      object returned by self.find_class(module, class) is pushed on the
      stack, so unpickling subclasses can override this form of lookup.
      ZSTACK_GLOBAL�“z7Push a global object (module.attr) on the stack.
      ZREDUCE�RaLPush an object built from a callable and an argument tuple.

      The opcode is named to remind of the __reduce__() method.

      Stack before: ... callable pytuple
      Stack after:  ... callable(*pytuple)

      The callable and the argument tuple are the first two items returned
      by a __reduce__ method.  Applying the callable to the argtuple is
      supposed to reproduce the original object, or at least get it started.
      If the __reduce__ method returns a 3-tuple, the last component is an
      argument to be passed to the object's __setstate__, and then the REDUCE
      opcode is followed by code to create setstate's argument, and then a
      BUILD opcode to apply  __setstate__ to that argument.

      If not isinstance(callable, type), REDUCE complains unless the
      callable has been registered with the copyreg module's
      safe_constructors dict, or the callable has a magic
      '__safe_for_unpickling__' attribute with a true value.  I'm not sure
      why it does this, but I've sure seen this complaint often enough when
      I didn't want to <wink>.
      ZBUILD�ba�Finish building an object, via __setstate__ or dict update.

      Stack before: ... anyobject argument
      Stack after:  ... anyobject

      where anyobject may have been mutated, as follows:

      If the object has a __setstate__ method,

          anyobject.__setstate__(argument)

      is called.

      Else the argument must be a dict, the object must have a __dict__, and
      the object is updated via

          anyobject.__dict__.update(argument)
      ZINST�iaqBuild a class instance.

      This is the protocol 0 version of protocol 1's OBJ opcode.
      INST is followed by two newline-terminated strings, giving a
      module and class name, just as for the GLOBAL opcode (and see
      GLOBAL for more details about that).  self.find_class(module, name)
      is used to get a class object.

      In addition, all the objects on the stack following the topmost
      markobject are gathered into a tuple and popped (along with the
      topmost markobject), just as for the TUPLE opcode.

      Now it gets complicated.  If all of these are true:

        + The argtuple is empty (markobject was at the top of the stack
          at the start).

        + The class object does not have a __getinitargs__ attribute.

      then we want to create an old-style class instance without invoking
      its __init__() method (pickle has waffled on this over the years; not
      calling __init__() is current wisdom).  In this case, an instance of
      an old-style dummy class is created, and then we try to rebind its
      __class__ attribute to the desired class object.  If this succeeds,
      the new instance object is pushed on the stack, and we're done.

      Else (the argtuple is not empty, it's not an old-style class object,
      or the class object does have a __getinitargs__ attribute), the code
      first insists that the class object have a __safe_for_unpickling__
      attribute.  Unlike as for the __safe_for_unpickling__ check in REDUCE,
      it doesn't matter whether this attribute has a true or false value, it
      only matters whether it exists (XXX this is a bug).  If
      __safe_for_unpickling__ doesn't exist, UnpicklingError is raised.

      Else (the class object does have a __safe_for_unpickling__ attr),
      the class object obtained from INST's arguments is applied to the
      argtuple obtained from the stack, and the resulting instance object
      is pushed on the stack.

      NOTE:  checks for __safe_for_unpickling__ went away in Python 2.3.
      NOTE:  the distinction between old-style and new-style classes does
             not make sense in Python 3.
      ZOBJ�oa�Build a class instance.

      This is the protocol 1 version of protocol 0's INST opcode, and is
      very much like it.  The major difference is that the class object
      is taken off the stack, allowing it to be retrieved from the memo
      repeatedly if several instances of the same class are created.  This
      can be much more efficient (in both time and space) than repeatedly
      embedding the module and class names in INST opcodes.

      Unlike INST, OBJ takes no arguments from the opcode stream.  Instead
      the class object is taken off the stack, immediately above the
      topmost markobject:

      Stack before: ... markobject classobject stackslice
      Stack after:  ... new_instance_object

      As for INST, the remainder of the stack above the markobject is
      gathered into an argument tuple, and then the logic seems identical,
      except that no __safe_for_unpickling__ check is done (XXX this is
      a bug).  See INST for the gory details.

      NOTE:  In Python 2.3, INST and OBJ are identical except for how they
      get the class object.  That was always the intent; the implementations
      had diverged for accidental reasons.
      ZNEWOBJ�aLBuild an object instance.

      The stack before should be thought of as containing a class
      object followed by an argument tuple (the tuple being the stack
      top).  Call these cls and args.  They are popped off the stack,
      and the value returned by cls.__new__(cls, *args) is pushed back
      onto the stack.
      Z	NEWOBJ_EX�’auBuild an object instance.

      The stack before should be thought of as containing a class
      object followed by an argument tuple and by a keyword argument dict
      (the dict being the stack top).  Call these cls and args.  They are
      popped off the stack, and the value returned by
      cls.__new__(cls, *args, *kwargs) is  pushed back  onto the stack.
      �PROTO�€z�Protocol version indicator.

      For protocol 2 and above, a pickle must start with this opcode.
      The argument is the protocol version, an int in range(2, 256).
      �STOP�.z�Stop the unpickling machine.

      Every pickle ends with this opcode.  The object at the top of the stack
      is popped, and that's the result of unpickling.  The stack should be
      empty then.
      �FRAME�•z�Indicate the beginning of a new frame.

      The unpickler may use this opcode to safely prefetch data from its
      underlying stream.
      ZPERSID�PaPush an object identified by a persistent ID.

      The pickle module doesn't define what a persistent ID means.  PERSID's
      argument is a newline-terminated str-style (no embedded escapes, no
      bracketing quote characters) string, which *is* "the persistent ID".
      The unpickler passes this string to self.persistent_load().  Whatever
      object that returns is pushed on the stack.  There is no implementation
      of persistent_load() in Python's unpickler:  it must be supplied by an
      unpickler subclass.
      Z	BINPERSID�QaXPush an object identified by a persistent ID.

      Like PERSID, except the persistent ID is popped off the stack (instead
      of being a string embedded in the opcode bytestream).  The persistent
      ID is passed to self.persistent_load(), and whatever object that
      returns is pushed on the stack.  See PERSID for more detail.
      z%repeated name %r at indices %d and %dz%repeated code %r at indices %d and %dFcCstj�}x�tjD]�}tjd|�s2|rtd|�qtt|�}t|t	�sTt
|�dkrj|rtd||f�q|jd�}||kr�|r�td||f�||}|j|kr�t
d|||jf��||=qt
d||f��qW|�rd	g}x(|j�D]\}}|jd
|j|f�q�Wt
dj|���dS)Nz[A-Z][A-Z0-9_]+$z0skipping %r: it doesn't look like an opcode namerz5skipping %r: value %r doesn't look like a pickle codezlatin-1z+checking name %r w/ code %r for consistencyzBfor pickle code %r, pickle.py uses name %r but we're using name %rzPpickle.py appears to have a pickle opcode with name %r and code %r, but we don'tz=we appear to have pickle opcodes that pickle.py doesn't have:z    name %r with code %r�
)�code2op�copyr~�__all__�re�match�print�getattrrrpr'r<rr"�items�append�join)�verboser�rZ
picklecoder��msgryrrr�assure_pickle_consistencys>


r�ccs�t|t�rtj|�}t|d�r&|j}ndd�}x�|�}|jd�}tj|j	d��}|dkr�|dkrjt
d��nt
d|dkrzd	n||f��|jdkr�d}n|jj|�}|r�||||�fVn|||fV|d
kr0|j
dks�t�Pq0WdS)N�tellcSsdS)Nrrrrr�<lambda>�sz_genops.<locals>.<lambda>rzlatin-1�z#pickle exhausted before seeing STOPz!at position %s, opcode %r unknownz	<unknown>�.r�)r�bytes_types�io�BytesIO�hasattrr�r!r��getr<r"rzr
rr)r$�
yield_end_posZgetpos�posry�opcoderzrrr�_genops�s0






r�cCst|�S)axGenerate all the opcodes in a pickle.

    'pickle' is a file-like object, or string, containing the pickle.

    Each opcode in the pickle is generated, from the current pickle position,
    stopping after a STOP opcode is delivered.  A triple is generated for
    each opcode:

        opcode, arg, pos

    opcode is an OpcodeInfo record, describing the current opcode.

    If the opcode has an argument embedded in the pickle, arg is its decoded
    value, as a Python object.  If the opcode doesn't have an argument, arg
    is None.

    If the pickle has a tell() method, pos was the value of pickle.tell()
    before reading the current opcode.  If the pickle is a bytes object,
    it's wrapped in a BytesIO object, and the latter's tell() result is
    used.  Else (the pickle doesn't have a tell(), and it's not obvious how
    to query its current position) pos is None.
    )r�)r~rrrr�scCs�d}d}t�}i}g}d}d}x�t|dd�D]�\}}	}
}d|jkr\|j|	�|j||	f�q,|jdkr�t|�}|j|�|j||f�q,d|jkr�q,d|jkr�|j|kr�|j}d	||	<|j||	f�q,|jd
k�r|	|kr�|	}|
dkr�||
|�}n|j|
|f�q,|j|
|f�q,W~tj�}
|
j	|�t
j|
|�}|dk�rJ|jj
�d}x�|D]x\}}	||k�r�|	|k�rt�qT|j|�}|||	<|d7}n&||k�r�|j||	�}n|||	�}|jj�|j	|��qTW|jj�|
j�S)
z7Optimize a pickle string by removing unused PUT opcodesr�r�rr�T)r�r�r�Nr�rr)rtr�r�addr�r'r}r�r��writer~Z_PicklerZframerZ
start_framing�putr�Zcommit_frameZend_framing�getvalue)r�r�r�ZoldidsZnewids�opcodesr}Zprotoheaderr�rzr�Zend_pos�idx�outZpickler�opr$rrrr�sd
















cCstg}|dkri}d}g}d|}d}	|}
�x$t|�D�]\}}}
|
dk	rZtd|
d|d�dt|j�dd �|t|�|jf}t||j�}|j}|j	}t|�}d}t
|ks�|jdko�|o�|d!t
k�r|t
|ks�t�t
|kr�|d"tks�t�|�rt|j
�}|dk�r
d}nd	|}x|d#t
k	�r.|j
��qW|j
�y|jt
�}Wn*tk
�rp|jdk�sht�d
}YnXnd}	}|jd$k�r�|jdk�r�t|�}d|}n|dk	�s�t�|}||k�r�d|}	n,|�s�d}	n |d%t
k�r�d}	n|d&||<n<|jd'k�r6||k�r.t|�dk�s"t�||g}nd|}	|dk	�sF|�r�|ddt|j�7}|dk	�rv|dt|�7}|�r�|d|7}|�r�|d|
t|�7}t|�}
|
dk�r�|}
|d|jjdd�d
7}t||d�|	�r�t|	��t|�|k�rtd|t|�f��|�r ||d�=t
|k�rBt
|k�s8t�|j|
�|j|�q4Wtd||d�|�rptd|��dS)(aKProduce a symbolic disassembly of a pickle.

    'pickle' is a file-like object, or string, containing a (at least one)
    pickle.  The pickle is disassembled from the current position, through
    the first STOP opcode encountered.

    Optional arg 'out' is a file-like object to which the disassembly is
    printed.  It defaults to sys.stdout.

    Optional arg 'memo' is a Python dict, used as the pickle's memo.  It
    may be mutated by dis(), if the pickle contains PUT or BINPUT opcodes.
    Passing the same memo object to another dis() call then allows disassembly
    to proceed across multiple pickles that were all created by the same
    pickler with the same memo.  Ordinarily you don't need to worry about this.

    Optional arg 'indentlevel' is the number of blanks by which to indent
    a new MARK level.  It defaults to 4.

    Optional arg 'annotate' if nonzero instructs dis() to add short
    description of the opcode on each line of disassembled output.
    The value given to 'annotate' must be an integer and is used as a
    hint for the column where annotation should start.  The default
    value is 0, meaning no annotations.

    In addition to printing the disassembly, some sanity checks are made:

    + All embedded opcode arguments "make sense".

    + Explicit and implicit pop operations have enough items on the stack.

    + When an opcode implicitly refers to a markobject, a markobject is
      actually on the stack.

    + A memo entry isn't referenced before it's defined.

    + The markobject isn't stored in the memo.

    + A memo entry isn't redefined.
    Nr� z%5d:)�end�filez	%-4s %s%sr�z(MARK at unknown opcode offset)z(MARK at %d)rzno MARK exists on stackr�r�r�r�z(as %d)zmemo key %r already definedz'stack is empty -- can't store into memoz"can't store markobject in the memor�r�r�z&memo key %r has never been stored into�
�2r�)r�z3tries to pop %d items from stack with only %d itemsz highest protocol among opcodes =zstack not empty after STOP: %rr6r6r6r6r6)r�r�r�r�r6r6)r�r�r�)rr��reprryr'r�maxr}r{r|�
markobjectrrw�pop�indexr"r�splitr��extend)r~r��memo�indentlevel�annotate�stackZmaxprotoZ	markstackZindentchunkZerrormsgZannocolr�rzr��lineZbefore�afterZnumtopopZmarkmsgZmarkposZmemo_idxrrrr%	s�-










c@seZdZdd�ZdS)�_ExamplecCs
||_dS)N)�value)rrrrrr�	sz_Example.__init__N)rrrrrrrrr�	sra�
>>> import pickle
>>> x = [1, 2, (3, 4), {b'abc': "def"}]
>>> pkl0 = pickle.dumps(x, 0)
>>> dis(pkl0)
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: L    LONG       1
    9: a    APPEND
   10: L    LONG       2
   14: a    APPEND
   15: (    MARK
   16: L        LONG       3
   20: L        LONG       4
   24: t        TUPLE      (MARK at 15)
   25: p    PUT        1
   28: a    APPEND
   29: (    MARK
   30: d        DICT       (MARK at 29)
   31: p    PUT        2
   34: c    GLOBAL     '_codecs encode'
   50: p    PUT        3
   53: (    MARK
   54: V        UNICODE    'abc'
   59: p        PUT        4
   62: V        UNICODE    'latin1'
   70: p        PUT        5
   73: t        TUPLE      (MARK at 53)
   74: p    PUT        6
   77: R    REDUCE
   78: p    PUT        7
   81: V    UNICODE    'def'
   86: p    PUT        8
   89: s    SETITEM
   90: a    APPEND
   91: .    STOP
highest protocol among opcodes = 0

Try again with a "binary" pickle.

>>> pkl1 = pickle.dumps(x, 1)
>>> dis(pkl1)
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: K        BININT1    1
    6: K        BININT1    2
    8: (        MARK
    9: K            BININT1    3
   11: K            BININT1    4
   13: t            TUPLE      (MARK at 8)
   14: q        BINPUT     1
   16: }        EMPTY_DICT
   17: q        BINPUT     2
   19: c        GLOBAL     '_codecs encode'
   35: q        BINPUT     3
   37: (        MARK
   38: X            BINUNICODE 'abc'
   46: q            BINPUT     4
   48: X            BINUNICODE 'latin1'
   59: q            BINPUT     5
   61: t            TUPLE      (MARK at 37)
   62: q        BINPUT     6
   64: R        REDUCE
   65: q        BINPUT     7
   67: X        BINUNICODE 'def'
   75: q        BINPUT     8
   77: s        SETITEM
   78: e        APPENDS    (MARK at 3)
   79: .    STOP
highest protocol among opcodes = 1

Exercise the INST/OBJ/BUILD family.

>>> import pickletools
>>> dis(pickle.dumps(pickletools.dis, 0))
    0: c    GLOBAL     'pickletools dis'
   17: p    PUT        0
   20: .    STOP
highest protocol among opcodes = 0

>>> from pickletools import _Example
>>> x = [_Example(42)] * 2
>>> dis(pickle.dumps(x, 0))
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: c    GLOBAL     'copy_reg _reconstructor'
   30: p    PUT        1
   33: (    MARK
   34: c        GLOBAL     'pickletools _Example'
   56: p        PUT        2
   59: c        GLOBAL     '__builtin__ object'
   79: p        PUT        3
   82: N        NONE
   83: t        TUPLE      (MARK at 33)
   84: p    PUT        4
   87: R    REDUCE
   88: p    PUT        5
   91: (    MARK
   92: d        DICT       (MARK at 91)
   93: p    PUT        6
   96: V    UNICODE    'value'
  103: p    PUT        7
  106: L    LONG       42
  111: s    SETITEM
  112: b    BUILD
  113: a    APPEND
  114: g    GET        5
  117: a    APPEND
  118: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(x, 1))
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: c        GLOBAL     'copy_reg _reconstructor'
   29: q        BINPUT     1
   31: (        MARK
   32: c            GLOBAL     'pickletools _Example'
   54: q            BINPUT     2
   56: c            GLOBAL     '__builtin__ object'
   76: q            BINPUT     3
   78: N            NONE
   79: t            TUPLE      (MARK at 31)
   80: q        BINPUT     4
   82: R        REDUCE
   83: q        BINPUT     5
   85: }        EMPTY_DICT
   86: q        BINPUT     6
   88: X        BINUNICODE 'value'
   98: q        BINPUT     7
  100: K        BININT1    42
  102: s        SETITEM
  103: b        BUILD
  104: h        BINGET     5
  106: e        APPENDS    (MARK at 3)
  107: .    STOP
highest protocol among opcodes = 1

Try "the canonical" recursive-object test.

>>> L = []
>>> T = L,
>>> L.append(T)
>>> L[0] is T
True
>>> T[0] is L
True
>>> L[0][0] is L
True
>>> T[0][0] is T
True
>>> dis(pickle.dumps(L, 0))
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: (    MARK
    6: g        GET        0
    9: t        TUPLE      (MARK at 5)
   10: p    PUT        1
   13: a    APPEND
   14: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(L, 1))
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: h        BINGET     0
    6: t        TUPLE      (MARK at 3)
    7: q    BINPUT     1
    9: a    APPEND
   10: .    STOP
highest protocol among opcodes = 1

Note that, in the protocol 0 pickle of the recursive tuple, the disassembler
has to emulate the stack in order to realize that the POP opcode at 16 gets
rid of the MARK at 0.

>>> dis(pickle.dumps(T, 0))
    0: (    MARK
    1: (        MARK
    2: l            LIST       (MARK at 1)
    3: p        PUT        0
    6: (        MARK
    7: g            GET        0
   10: t            TUPLE      (MARK at 6)
   11: p        PUT        1
   14: a        APPEND
   15: 0        POP
   16: 0        POP        (MARK at 0)
   17: g    GET        1
   20: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(T, 1))
    0: (    MARK
    1: ]        EMPTY_LIST
    2: q        BINPUT     0
    4: (        MARK
    5: h            BINGET     0
    7: t            TUPLE      (MARK at 4)
    8: q        BINPUT     1
   10: a        APPEND
   11: 1        POP_MARK   (MARK at 0)
   12: h    BINGET     1
   14: .    STOP
highest protocol among opcodes = 1

Try protocol 2.

>>> dis(pickle.dumps(L, 2))
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: h    BINGET     0
    7: \x85 TUPLE1
    8: q    BINPUT     1
   10: a    APPEND
   11: .    STOP
highest protocol among opcodes = 2

>>> dis(pickle.dumps(T, 2))
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: h    BINGET     0
    7: \x85 TUPLE1
    8: q    BINPUT     1
   10: a    APPEND
   11: 0    POP
   12: h    BINGET     1
   14: .    STOP
highest protocol among opcodes = 2

Try protocol 3 with annotations:

>>> dis(pickle.dumps(T, 3), annotate=1)
    0: \x80 PROTO      3 Protocol version indicator.
    2: ]    EMPTY_LIST   Push an empty list.
    3: q    BINPUT     0 Store the stack top into the memo.  The stack is not popped.
    5: h    BINGET     0 Read an object from the memo and push it on the stack.
    7: \x85 TUPLE1       Build a one-tuple out of the topmost item on the stack.
    8: q    BINPUT     1 Store the stack top into the memo.  The stack is not popped.
   10: a    APPEND       Append an object to a list.
   11: 0    POP          Discard the top stack item, shrinking the stack by one item.
   12: h    BINGET     1 Read an object from the memo and push it on the stack.
   14: .    STOP         Stop the unpickling machine.
highest protocol among opcodes = 2

a=
>>> import pickle
>>> import io
>>> f = io.BytesIO()
>>> p = pickle.Pickler(f, 2)
>>> x = [1, 2, 3]
>>> p.dump(x)
>>> p.dump(x)
>>> f.seek(0)
0
>>> memo = {}
>>> dis(f, memo=memo)
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: (    MARK
    6: K        BININT1    1
    8: K        BININT1    2
   10: K        BININT1    3
   12: e        APPENDS    (MARK at 5)
   13: .    STOP
highest protocol among opcodes = 2
>>> dis(f, memo=memo)
   14: \x80 PROTO      2
   16: h    BINGET     0
   18: .    STOP
highest protocol among opcodes = 2
)Zdisassembler_testZdisassembler_memo_testcCsddl}|j�S)Nr)�doctestZtestmod)rrrr�_test�
sr�__main__z$disassemble one or more pickle files)Zdescription�pickle_file�br�*zthe pickle file)rl�nargs�helpz-oz--output�wz+the file where the output should be written)�defaultrlrz-mz--memo�
store_truez#preserve memo between disassemblies)�actionrz-lz
--indentlevelz8the number of blanks by which to indent a new MARK levelz-az
--annotatez2annotate each line with a short opcode descriptionz-pz
--preamblez==> {name} <==zMif more than one pickle file is specified, print this before each disassembly)r
rz-tz--testzrun self-test suitez-vz)run verbosely; only affects self-test run�)rr�r6������������)TT)F)F)NNrr)��__doc__r:r�r~r�rKr�r�rrrrr�objectr
Zstructr r(r%r&r)r*r+r,r-r.r0r1r?r@rArBrCrDrErFrGrHrIrJrMrNrOrPrQrRrTrUrVrWrXrYr[r]r^r_rarbrcrdrerfrgrhrirjrZpyintZpylongroZpyinteger_or_boolZpyboolr`ZpyfloatrprZpybytes_or_strZpystringZpybytesZ	pyunicoderlZpynonermZpytuplerrZpylistrsZpydictrtZpysetZpyfrozensetZ	anyobjectr�rwrxr�r�Zname2iZcode2i�	enumerater�r�rr"ryr�r�r�rrrrZ	_dis_testZ
_memo_testZ__test__rr�argparse�ArgumentParser�parser�add_argumentZFileType�stdout�
parse_args�argsZtestr�rZ
print_helpr'�outputr�r�r#Zpreamble�formatr�rrrr�<module>s�
$/		
	
;	


			

	+


& 

>

dummy_threading.cpython-36.opt-1.pyc000064400000002120150335715140013310 0ustar003


 \�
�@sdZddlmZddlZdZdZdZz�dekr:edZdZeded<dekr`edZ	dZed=d	ekrzed	Z
dZed	=ddlZeded
<ed=ed	ed<ed	=ddlTdd
lm
Z
Wder�e	ed<[	[er�e
ed	<[
[er�eed<[ned=[[[XdS)aaFaux ``threading`` version using ``dummy_thread`` instead of ``thread``.

The module ``_dummy_threading`` is added to ``sys.modules`` in order
to not have ``threading`` considered imported.  Had ``threading`` been
directly imported it would have made all subsequent imports succeed
regardless of whether ``_thread`` was available which is not desired.

�)�modulesNF�_threadT�
_dummy_thread�	threadingZ_threading_local�_dummy_threadingZ_dummy__threading_local)�*)�__all__)�__doc__�sysrZsys_modulesrZholding_threadZholding_threadingZholding__threading_localZheld_threadZheld_threadingZheld__threading_localrrr�rr�'/usr/lib64/python3.6/dummy_threading.py�<module>sPgzip.cpython-36.opt-2.pyc000064400000030206150335715140011110 0ustar003


 \nO�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddddgZd\Z	Z
ZZZ
d\ZZdd
d�Zdd�ZGdd�d�ZGdd�dej�ZGdd�dej�Zddd�Zdd�Zdd�Zedkr�e�dS)�N�GzipFile�open�compress�
decompress������rb�	cCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|jdd�}t|tttjf�r|t|||�}n,t|d�s�t|d	�r�td|||�}nt	d
��d|kr�t
j||||�S|SdS)N�t�bzInvalid mode: %rz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary mode��read�writez1filename must be a str or bytes object, or a file)�
ValueError�replace�
isinstance�str�bytes�os�PathLiker�hasattr�	TypeError�io�
TextIOWrapper)�filename�mode�
compresslevel�encoding�errors�newlineZgz_modeZbinary_file�r#�/usr/lib64/python3.6/gzip.pyrs$cCs|jtjd|��dS)Nz<L)r�structZpack)�output�valuer#r#r$�write32u@sr(c@s8eZdZd
dd�Zdd�Zddd�Zdd	�Zd
d�ZdS)�_PaddedFile�cCs ||_t|�|_||_d|_dS)Nr)�_buffer�len�_length�file�_read)�self�f�prependr#r#r$�__init__Js
z_PaddedFile.__init__cCs~|jdkr|jj|�S|j||jkrJ|j}|j|7_|j||j�S|j}d|_|j|d�|jj||j|�SdS)N)r/r.rr-r+)r0�sizerr#r#r$rPs
z_PaddedFile.readcCs>|jdkr||_n|jt|�8_dSt|j�|_d|_dS)Nr)r/r+r,r-)r0r2r#r#r$r2]s
z_PaddedFile.prependcCsd|_d|_|jj|�S)N)r/r+r.�seek)r0Zoffr#r#r$r5fsz_PaddedFile.seekcCsdS)NTr#)r0r#r#r$�seekableksz_PaddedFile.seekableN)r*)r*)�__name__�
__module__�__qualname__r3rr2r5r6r#r#r#r$r)Es


	r)c@s�eZdZdZd,dd�Zedd��Zedd��Zd	d
�Zdd�Z	d
d�Z
dd�Zd.dd�Zd0dd�Z
dd�Zedd��Zdd�Zejfdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zejfd(d)�Zd2d*d+�ZdS)3rNrcCs2|r"d|ksd|kr"tdj|���|r6d|kr6|d7}|dkrTtj||pJd�}|_|dkr|t|dd�}t|ttf�s�d}n
t	j
|�}|dkr�t|dd�}|jd	�r�t|_
t|�}tj|�|_||_nN|jd��rt|_
|j|�tj|tjtjtjd
�|_||_ntdj|���||_|j
tk�r.|j�dS)Nr
�UzInvalid mode: {!r}rr�namerr�r�w�a�xr)r=r>r?)r�format�builtinsr�	myfileobj�getattrrrrr�fspath�
startswith�READr�_GzipReaderr�BufferedReaderr+r;�WRITE�_init_write�zlibZcompressobjZDEFLATED�	MAX_WBITSZ
DEF_MEM_LEVELr�_write_mtime�fileobj�_write_gzip_header)r0rrrrN�mtime�rawr#r#r$r3{s>#


zGzipFile.__init__cCsBddl}|jdtd�|jtkr<|jdd�dkr<|jdS|jS)Nrzuse the name attributer�z.gz���)�warnings�warn�DeprecationWarningrrIr;)r0rTr#r#r$r�s

zGzipFile.filenamecCs
|jjjS)N)r+rQ�_last_mtime)r0r#r#r$rP�szGzipFile.mtimecCs.t|j�}d|dd�dtt|��dS)Nz<gzip r� �>���)�reprrN�hex�id)r0�sr#r#r$�__repr__�s
zGzipFile.__repr__cCs.||_tjd�|_d|_g|_d|_d|_dS)Nr*r)r;rK�crc32�crcr4Zwritebuf�bufsize�offset)r0rr#r#r$rJ�szGzipFile._init_writecCs�|jjd�|jjd�y<tjj|j�}t|t�s<|jd�}|j	d�rR|dd�}Wnt
k
rld}YnXd}|rzt}|jjt|�jd��|j
}|dkr�tj�}t|jt|��|jjd�|jjd	�|r�|jj|d
�dS)Ns��zlatin-1s.gzrRr*r����rS)rNrr�path�basenamer;rr�encode�endswith�UnicodeEncodeError�FNAME�chrrM�timer(�int)r0Zfname�flagsrPr#r#r$rO�s,



zGzipFile._write_gzip_headercCs�|j�|jtkr&ddl}t|jd��|jdkr8td��t|t	�rLt
|�}nt|�}|j}|dkr�|jj
|jj|��|j|7_tj||j�|_|j|7_|S)Nrz$write() on read-only GzipFile objectz!write() on closed GzipFile object)�_check_not_closedrrI�errno�OSError�EBADFrNrrrr,�
memoryview�nbytesrrr4rKr`rarc)r0�datarsZlengthr#r#r$r�s 



zGzipFile.writercCs2|j�|jtkr&ddl}t|jd��|jj|�S)Nrz$read() on write-only GzipFile object)rrrrFrsrtrur+r)r0r4rsr#r#r$rs

z
GzipFile.readcCs@|j�|jtkr&ddl}t|jd��|dkr4tj}|jj	|�S)Nrz%read1() on write-only GzipFile object)
rrrrFrsrtrur�DEFAULT_BUFFER_SIZEr+�read1)r0r4rsr#r#r$rzs
zGzipFile.read1cCs2|j�|jtkr&ddl}t|jd��|jj|�S)Nrz$peek() on write-only GzipFile object)rrrrFrsrtrur+�peek)r0�nrsr#r#r$r{#s

z
GzipFile.peekcCs
|jdkS)N)rN)r0r#r#r$�closed*szGzipFile.closedcCs�|j}|dkrdSd|_zP|jtkrR|j|jj��t||j�t||jd@�n|jt	krf|j
j�Wd|j}|r�d|_|j�XdS)Nl��)
rNrrIrr�flushr(rar4rFr+�closerB)r0rNrBr#r#r$r.s

zGzipFile.closecCs4|j�|jtkr0|jj|jj|��|jj�dS)N)rrrrIrNrrr~)r0Z	zlib_moder#r#r$r~As
zGzipFile.flushcCs
|jj�S)N)rN�fileno)r0r#r#r$r�HszGzipFile.filenocCs"|jtkrtd��|jjd�dS)NzCan't rewind in write moder)rrFrtr+r5)r0r#r#r$�rewindPs
zGzipFile.rewindcCs
|jtkS)N)rrF)r0r#r#r$�readableWszGzipFile.readablecCs
|jtkS)N)rrI)r0r#r#r$�writableZszGzipFile.writablecCsdS)NTr#)r0r#r#r$r6]szGzipFile.seekablecCs�|jtkr�|tjkr2|tjkr*|j|}ntd��||jkrDtd��||j}dd}xt|d�D]}|j	|�qdW|j	d|d�n |jt
kr�|j�|jj
||�S|jS)NzSeek from end not supportedzNegative seek in write modergi)rrIr�SEEK_SET�SEEK_CURrcrrt�rangerrFrrr+r5)r0rc�whence�count�chunk�ir#r#r$r5`s 





z
GzipFile.seekcCs|j�|jj|�S)N)rrr+�readline)r0r4r#r#r$r�tszGzipFile.readline)NNrNNrZ)rZrZ)rZrZ)rZ)r7r8r9rBr3�propertyrrPr_rJrOrrrzr{r}rrKZZ_SYNC_FLUSHr~r�r�r�r�r6rr�r5r�r#r#r#r$rns,
H


csZeZdZ�fdd�Zdd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Z	�fdd�Z
�ZS)rGcs,t�jt|�tjtjd�d|_d|_dS)N)ZwbitsT)�superr3r)rKZ
decompressobjrL�_new_memberrW)r0�fp)�	__class__r#r$r3zsz_GzipReader.__init__cCstjd�|_d|_dS)Nr*r)rKr`�_crc�_stream_size)r0r#r#r$�
_init_read�sz_GzipReader._init_readcCsJ|jj|�}x8t|�|krD|jj|t|��}|s:td��||7}qW|S)NzACompressed file ended before the end-of-stream marker was reached)�_fprr,�EOFError)r0r|rxrr#r#r$�_read_exact�sz_GzipReader._read_exactcCs�|jjd�}|dkrdS|dkr,td|��tjd|jd��\}}|_|dkrVtd��|t@r|tjd	|jd��\}|j|�|t@r�x |jjd
�}|s�|dkr�Pq�W|t	@r�x |jjd
�}|s�|dkr�Pq�W|t
@r�|jd�dS)
Nrr*Fs�zNot a gzipped file (%r)z<BBIxxr	zUnknown compression methodz<HrrgT)r�rrtr%�unpackr�rW�FEXTRArm�FCOMMENT�FHCRC)r0�magic�method�flagZ	extra_lenr^r#r#r$�_read_gzip_header�s0

z_GzipReader._read_gzip_headerrcCs�|dkr|j�S|sdSx�|jjr@|j�d|_|jf|j�|_|jrh|j�|j�sb|j	|_
dSd|_|jjt
j�}|jj||�}|jjdkr�|jj|jj�n|jjdkr�|jj|jj�|dkr�P|dkrtd��qW|j|�|j	t|�7_	|S)Nrr*TFzACompressed file ended before the end-of-stream marker was reached)�readallZ
_decompressor�eof�	_read_eofr�Z_decomp_factoryZ_decomp_argsr�r�Z_posZ_sizer�rrryrZunconsumed_tailr2Zunused_datar��_add_read_datar,)r0r4�bufZ
uncompressr#r#r$r�s:

z_GzipReader.readcCs$tj||j�|_|jt|�|_dS)N)rKr`r�r�r,)r0rxr#r#r$r��sz_GzipReader._add_read_datacCs�tjd|jd��\}}||jkr<tdt|�t|j�f��n||jd@krRtd��d}x|dkrn|jjd�}qXW|r�|jj	|�dS)Nz<IIr	zCRC check failed %s != %sl��z!Incorrect length of data producedrgr)
r%r�r�r�rtr\r�r�rr2)r0r`Zisize�cr#r#r$r��s


z_GzipReader._read_eofcst�j�d|_dS)NT)r��_rewindr�)r0)r�r#r$r�s
z_GzipReader._rewindrZ)rZ)r7r8r9r3r�r�r�rr�r�r��
__classcell__r#r#)r�r$rGys!
3rGc	Cs4tj�}t|d|d��}|j|�WdQRX|j�S)N�wb)rNrr)r�BytesIOrr�getvalue)rxrr�r1r#r#r$rsc	Cs$ttj|�d��
}|j�SQRXdS)N)rN)rrr�r)rxr1r#r#r$rscCs>tjdd�}|o|ddk}|r.|dd�}|s8dg}�x�|D]�}|r�|dkrltddtjjd�}tjj}q�|d
d�d	kr�td
t|��q@t|d�}t	j|dd�d�}n>|dkr�tjj}tddtjjd�}nt	j|d�}t|d	d�}x |j
d�}|�s�P|j|�q�W|tjjk	�r"|j�|tjjk	r@|j�q@WdS)Nrrz-d�-rr)rrrNrRz.gzzfilename doesn't end in .gz:r�irSrS)
�sys�argvr�stdin�buffer�stdout�printr[rrArrr)�argsr�argr1�gr�r#r#r$�_tests<


r��__main__)rrrr	r
)rr)rrNNN)r)r%r�rorrKrArZ_compression�__all__ZFTEXTr�r�rmr�rFrIrr(r)Z
BaseStreamrZDecompressReaderrGrrr�r7r#r#r#r$�<module>s* 
+)

	&smtplib.cpython-36.opt-2.pyc000064400000044665150335715140011627 0ustar003


 \���@sjddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Zddddddd	d
ddd
dgZdZdZdZdZdZejdej�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd	�d	e�Z Gdd
�d
e�Z!Gdd�de�Z"d d�Z#d!d"�Z$d#d
�Z%d$d%�Z&d&d'�Z'yddl(Z(Wne)k
�r�d(Z*YnXd)Z*Gd*d�d�Z+e*�r�Gd+d,�d,e+�Z,ej-d,�d-Z.Gd.d/�d/e+�Z/e0d0k�rfd1d2�Z1e1d3�Z2e1d4�j3d5�Z4e5d6�d7Z6x ej7j8�Z9e9�s Pe6e9Z6�qWe5d8e:e6��e+d9�Z;e;j<d:�e;j=e2e4e6�e;j>�dS);�N)�body_encode�
SMTPException�SMTPServerDisconnected�SMTPResponseException�SMTPSenderRefused�SMTPRecipientsRefused�
SMTPDataError�SMTPConnectError�
SMTPHeloError�SMTPAuthenticationError�	quoteaddr�	quotedata�SMTP�i�z
s
i z	auth=(.*)c@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/smtplib.pyrGsc@seZdZdS)�SMTPNotSupportedErrorN)rrrrrrrrJsrc@seZdZdS)rN)rrrrrrrrQsc@seZdZdd�ZdS)rcCs||_||_||f|_dS)N)�	smtp_code�
smtp_error�args)�self�code�msgrrr�__init__bszSMTPResponseException.__init__N)rrrrrrrrrYs	c@seZdZdd�ZdS)rcCs"||_||_||_|||f|_dS)N)rr�senderr)rrrrrrrrnszSMTPSenderRefused.__init__N)rrrrrrrrrgsc@seZdZdd�ZdS)rcCs||_|f|_dS)N)�
recipientsr)rrrrrr|szSMTPRecipientsRefused.__init__N)rrrrrrrrrtsc@seZdZdS)rN)rrrrrrrr�sc@seZdZdS)r	N)rrrrrrrr	�sc@seZdZdS)r
N)rrrrrrrr
�sc@seZdZdS)rN)rrrrrrrr�scCs>tjj|�\}}||fdkr6|j�jd�r.|Sd|Sd|S)N��<z<%s>)rr)�email�utils�	parseaddr�strip�
startswith)�
addrstring�displayname�addrrrrr�scCs$tjj|�\}}||fdkr |S|S)Nr)rr)r!r"r#)r&r'r(rrr�
_addr_only�sr)cCstjddtjdt|��S)Nz(?m)^\.z..z(?:\r\n|\n|\r(?!\n)))�re�sub�CRLF)�datarrrr
�scCstjdd|�S)Ns(?m)^\.s..)r*r+)Zbindatarrr�_quote_periods�sr.cCstjdt|�S)Nz(?:\r\n|\n|\r(?!\n)))r*r+r,)r-rrr�	_fix_eols�sr/FTc@s�eZdZdZdZdZdZdZdZe	Z
dddejdfdd�Z
dd�Zd	d
�Zdd�Zd
d�Zdd�ZdLdd�Zdd�ZdMdd�Zdd�ZdNdd�ZdOdd�ZdPdd�Zd d!�ZdQd"d#�Zd$d%�Zd&d'�Zd(d)�Zffd*d+�Zffd,d-�Z d.d/�Z!d0d1�Z"e"Z#d2d3�Z$d4d5�Z%d6d7�d8d9�Z&dRd:d;�Z'dSd<d=�Z(dTd>d?�Z)d6d7�d@dA�Z*dUdBdC�Z+fffdDdE�Z,ddfffdFdG�Z-dHdI�Z.dJdK�Z/dS)VrrN�ehlorc
Cs�||_||_i|_d|_||_|rL|j||�\}}|dkrL|j�t||��|dk	r\||_nPt	j
�}d|krt||_n8d}	yt	jt	j��}	Wnt	j
k
r�YnXd|	|_dS)N�ascii���.z	127.0.0.1z[%s])�_host�timeout�esmtp_features�command_encoding�source_address�connect�closer	�local_hostname�socketZgetfqdnZ
gethostbynameZgethostnameZgaierror)
r�host�portr;r5r8rrZfqdnr(rrrr�s*
z
SMTP.__init__cCs|S)Nr)rrrr�	__enter__szSMTP.__enter__cGsNz>y$|jd�\}}|dkr$t||��Wntk
r:YnXWd|j�XdS)NZQUIT��)�docmdrrr:)rrr�messagerrr�__exit__s
z
SMTP.__exit__cCs
||_dS)N)�
debuglevel)rrDrrr�set_debuglevelszSMTP.set_debuglevelcGs@|jdkr,ttjj�j�f|�dtji�nt|dtji�dS)N��file)rD�print�datetimeZnowZtime�sys�stderr)rrrrr�_print_debug's
"zSMTP._print_debugcCs2|jdkr|jd||f|j�tj||f||j�S)Nrzconnect: to)rDrLr8r<�create_connection)rr=r>r5rrr�_get_socket-s
zSMTP._get_socket�	localhostcCs�|r
||_|r~|jd�|jd�kr~|jd�}|dkr~|d|�||dd�}}yt|�}Wntk
r|td��YnX|s�|j}|jdkr�|jd||f�|j	|||j
�|_d|_|j
�\}}|jdkr�|jdt|��||fS)N�:rrFznonnumeric portzconnect:)r8�find�rfind�int�
ValueError�OSError�default_portrDrLrNr5�sockrG�getreply�repr)rr=r>r8�irrrrrr95s(


zSMTP.connectcCs�|jdkr|jdt|��t|d�rx|jrxt|t�r@|j|j�}y|jj	|�Wq�t
k
rt|j�td��Yq�Xntd��dS)Nrzsend:rWzServer not connectedzplease run connect() first)
rDrLrY�hasattrrW�
isinstance�str�encoder7ZsendallrUr:r)r�srrr�sendWs

z	SMTP.sendcCs2|dkrd|tf}nd||tf}|j|�dS)Nrz%s%sz%s %s%s)r,r`)r�cmdrr]rrr�putcmdiszSMTP.putcmdcCsPg}|jdkr|jjd�|_�xy|jjtd�}Wn:tk
rn}z|j�tdt|���WYdd}~XnX|s�|j�td��|j	dkr�|j
dt|��t|�tkr�|j�t
dd��|j|d	d�jd
��|dd�}yt|�}Wntk
�rd}PYnX|dd	�dkr Pq Wd
j|�}|j	dk�rH|j
d||f�||fS)N�rbrFz Connection unexpectedly closed: zConnection unexpectedly closedrzreply:i�zLine too long.�s 	
��-�
zreply: retcode (%s); Msg: %a���)rGrW�makefile�readline�_MAXLINErUr:rr]rDrLrY�lenr�appendr$rSrT�join)r�resp�line�erZerrcode�errmsgrrrrXqs>




z
SMTP.getreplycCs|j||�|j�S)N)rbrX)rrarrrrrA�sz
SMTP.docmdcCs,|jd|p|j�|j�\}}||_||fS)N�helo)rbr;rX�	helo_resp)r�namerrrrrrs�sz	SMTP.heloc
Cs2i|_|j|j|p|j�|j�\}}|dkrJt|�dkrJ|j�td��||_|dkr`||fSd|_	|jj
d�jd�}|d=x�|D]�}tj
|�}|r�|jjdd�d	|jd�d|jd<q�tj
d
|�}|r�|jd�j�}|j|jd�d�j�}	|dk�r|jj|d�d	|	|j|<q�|	|j|<q�W||fS)
NrFrzServer not connected�zlatin-1�
�authr� z((?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*) ?�featurerh)r6rb�ehlo_msgr;rXrlr:r�	ehlo_resp�
does_esmtp�decode�split�
OLDSTYLE_AUTH�match�get�groupsr*�group�lower�string�endr$)
rrurrro�eachZ
auth_match�mrzZparamsrrrr0�s2

&
z	SMTP.ehlocCs|j�|jkS)N)r�r6)r�optrrr�has_extn�sz
SMTP.has_extncCs|jd|�|j�dS)N�helprF)rbrX)rrrrrr��sz	SMTP.helpcCsd|_|jd�S)Nr1�rset)r7rA)rrrrr��sz	SMTP.rsetcCs&y|j�Wntk
r YnXdS)N)r�r)rrrr�_rset�sz
SMTP._rsetcCs
|jd�S)N�noop)rA)rrrrr�sz	SMTP.noopcCshd}|rH|jrHtdd�|D��r:|jd�r2d|_ntd��ddj|�}|jdd	t|�|f�|j�S)
Nrcss|]}|j�dkVqdS)�smtputf8N)r�)�.0�xrrr�	<genexpr>szSMTP.mail.<locals>.<genexpr>r�zutf-8z SMTPUTF8 not supported by serverry�mailz	FROM:%s%s)	r}�anyr�r7rrnrbrrX)rr�options�
optionlistrrrr�s	

z	SMTP.mailcCs<d}|r|jrddj|�}|jddt|�|f�|j�S)Nrry�rcptzTO:%s%s)r}rnrbrrX)rZrecipr�r�rrrr�s

z	SMTP.rcptcCs�|jd�|j�\}}|jdkr0|jd||f�|dkrDt||��n|t|t�r\t|�jd�}t	|�}|dd�t
kr||t
}|dt
}|j|�|j�\}}|jdkr�|jd||f�||fSdS)	Nr-rzdata:ibr1��.���)rbrXrDrLrr\r]r/r^r.�bCRLFr`)rrr�repl�qrrrr-!s"





z	SMTP.datacCs|jdt|��|j�S)N�vrfy)rbr)rX)r�addressrrr�verify>szSMTP.verifycCs|jdt|��|j�S)N�expn)rbr)rX)rr�rrrr�Esz	SMTP.expncCsf|jdkrb|jdkrbd|j�dko.dknsb|j�\}}d|koRdknsbt||��dS)N��ri+)rtr|r0rsr
)rrrorrr�ehlo_or_helo_if_neededLs
 zSMTP.ehlo_or_helo_if_neededT)�initial_response_okc	Cs�|j�}|r|�nd}|dk	rJt|jd�dd�}|jd|d|�\}}n|jd|�\}}|dkr�tj|�}t||�jd�dd�}|j|�\}}|d	kr�||fSt||��dS)
Nr1r)ZeolZAUTHryiN���)r�r�)�upper�
encode_base64r^rA�base64Zdecodebytesr)	rZ	mechanismZ
authobjectr�Zinitial_responseZresponserro�	challengerrrrx]s
z	SMTP.authcCs0|dkrdS|jdtj|jjd�|d�j�S)Nryr1Zmd5)�user�hmacZHMAC�passwordr^Z	hexdigest)rr�rrr�
auth_cram_md5�szSMTP.auth_cram_md5cCsd|j|jfS)Nz%s%s)r�r�)rr�rrr�
auth_plain�szSMTP.auth_plaincCs|dkr|jS|jSdS)N)r�r�)rr�rrr�
auth_login�szSMTP.auth_logincs�|j�|jd�std��|jdj��dddg}�fdd�|D�}|sPtd��|||_|_xv|D]n}d	|j�j	d
d�}y.|j
|t||�|d�\}}	|dkr�||	fSWqdtk
r�}
z
|
}WYdd}
~
XqdXqdW|�dS)Nrxz,SMTP AUTH extension not supported by server.zCRAM-MD5ZPLAINZLOGINcsg|]}|�kr|�qSrr)r�rx)�advertised_authlistrr�
<listcomp>�szSMTP.login.<locals>.<listcomp>z(No suitable authentication method found.Zauth_�-�_)r�r��)r�r�)
r�r�rr6rrr�r�r��replacerx�getattrr)rr�r�r�Zpreferred_authsZauthlistZ
authmethodZmethod_namerrorqZlast_exceptionr)r�r�login�s*



z
SMTP.logincCs�|j�|jd�std��|jd�\}}|dkr�ts<td��|dk	rT|dk	rTtd��|dk	rl|dk	rltd��|dk	s||dk	r�ddl}|jd	t	d
�|dkr�t
j||d�}|j|j
|jd�|_
d|_d|_d|_i|_d|_n
t||��||fS)
N�starttlsz+STARTTLS extension not supported by server.ZSTARTTLSr2z&No SSL support included in this Pythonz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadr�)�certfile�keyfile)�server_hostname)r�r�rrA�	_have_ssl�RuntimeErrorrT�warnings�warn�DeprecationWarning�ssl�_create_stdlib_context�wrap_socketrWr4rGrtr|r6r}r)rr�r��contextroZreplyr�rrrr��s8

z
SMTP.starttlscCsf|j�g}t|t�r$t|�jd�}|jr^|jd�rF|jdt|��x|D]}|j|�qLW|j	||�\}}	|dkr�|dkr�|j
�n|j�t||	|��i}
t|t�r�|g}xP|D]H}|j
||�\}}	|dkr�|dkr�||	f|
|<|dkr�|j
�t|
��q�Wt|
�t|�k�r$|j�t|
��|j|�\}}	|dk�rb|dk�rP|j
�n|j�t||	��|
S)Nr1�sizezsize=%drvi��)r�r\r]r/r^r}r�rmrlr�r:r�rr�rr-r)r�	from_addr�to_addrsr�mail_options�rcpt_optionsZ
esmtp_optsZoptionrroZsenderrsr�rrr�sendmailsF@









z
SMTP.sendmailcCs�|j�|jd�}|dkr d}nt|�dkr2d}ntd��|dkr||d|krZ||dn
||d}tjj|g�dd}|dkr�d	d
�||d||d||d
fD�}dd
�tjj|�D�}tj|�}	|	d=|	d=d}
ydj|f|��j	d�Wn.t
k
�r(|jd��s td��d}
YnXt
j��R}|
�r^tjj||jjdd�d�}|d�}ntjj|�}|j|	dd�|j�}
WdQRX|j|||
||�S)NzResent-DaterrFzResent-z0message has more than one 'Resent-' header blockZSender�FromrcSsg|]}|dk	r|�qS)Nr)r��frrrr��sz%SMTP.send_message.<locals>.<listcomp>�ToZBccZCccSsg|]}|d�qS)rFr)r��arrrr��sz
Resent-BccFr1r�z�One or more source or delivery addresses require internationalized email support, but the server does not advertise the required SMTPUTF8 capabilityT)�utf8)�policy�SMTPUTF8�
BODY=8BITMIMEz
)�linesep)r�r�)r�Zget_allrlrTr!r"Zgetaddresses�copyrnr^�UnicodeEncodeErrorr�r�io�BytesIO�	generatorZBytesGeneratorr�ZcloneZflatten�getvaluer�)rrr�r�r�r�ZresentZ
header_prefixZaddr_fieldsZmsg_copyZ
internationalZbytesmsg�gZflatmsgrrr�send_message|sJ





zSMTP.send_messagecCs<z|j}d|_|r|j�Wd|j}d|_|r6|j�XdS)N)rGr:rW)rrGrWrrrr:�sz
SMTP.closecCs.|jd�}d|_|_i|_d|_|j�|S)N�quitF)rAr|rtr6r}r:)r�resrrrr��s
z	SMTP.quit)rOrN)r)r)r)r)r)N)N)N)NNN)0rrrrDrGrtr{r|r}�	SMTP_PORTrVr<�_GLOBAL_DEFAULT_TIMEOUTrr?rCrErLrNr9r`rbrXrArsr0r�r�r�r�r�r�r�r-r�r�r�r�rxr�r�r�r�r�r�r�r:r�rrrrr�s\-
	
"
1



3
'
	

B
8gL
c@s4eZdZeZdddddejddfdd�Zdd�ZdS)�SMTP_SSLrrNc	
Cs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}	|	jdtd�||_||_|dkrxtj||d�}||_t	j
||||||�dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadr�)r�r�)rTr�r�r�r�r�r�r�r�rr)
rr=r>r;r�r�r5r8r�r�rrrr�s zSMTP_SSL.__init__cCsD|jdkr|jd||f�tj||f||j�}|jj||jd�}|S)Nrzconnect:)r�)rDrLr<rMr8r�r�r4)rr=r>r5Z
new_socketrrrrN	s

zSMTP_SSL._get_socket)	rrr�
SMTP_SSL_PORTrVr<r�rrNrrrrr��sr�i�c@s,eZdZdZdeddfdd�Zd
dd	�ZdS)�LMTPZlhlorNcCstj|||||d�dS)N)r;r8)rr)rr=r>r;r8rrrr)sz
LMTP.__init__rOrcCs�|ddkrtj||||d�Sy(tjtjtj�|_d|_|jj|�WnBtk
r�|jdkrl|j	d|�|jr||jj
�d|_�YnX|j�\}}|jdkr�|j	d|�||fS)Nr�/)r8z
connect fail:zconnect:)rr9r<ZAF_UNIXZSOCK_STREAMrWrGrUrDrLr:rX)rr=r>r8rrrrrr9/s"


zLMTP.connect)rOrN)rrrr{�	LMTP_PORTrr9rrrrr�sr��__main__cCs(tjj|d�tjj�tjj�j�S)Nz: )rJ�stdout�write�flush�stdinrjr$)�promptrrrr�Is
r�r�r��,zEnter message, end with ^D:rzMessage length is %drOrF)?r<r�r*Zemail.utilsr!Z
email.messageZemail.generatorr�r�r�rIrJZemail.base64mimerr��__all__r�r�r,r�rk�compile�Ir�rUrrrrrrrr	r
rrr)r
r.r/r��ImportErrorr�rr�rmr�r�rr�ZfromaddrrZtoaddrsrHrr�rjrprlZserverrEr�r�rrrr�<module>,s�



	
)0
/


profile.cpython-36.opt-1.pyc000064400000032601150335715140011577 0ustar003


 \
V�@s�dZddlZddlZddlZddlZddlmZdddgZGdd�d�Zdd
d�Z	ddd�Z
Gdd�d�Zd
d�Ze
dkr�e�dS)z Class for profiling Python code.�N)�OptionParser�run�runctx�Profilec@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_Utilsz�Support class for utility functions which are shared by
    profile.py and cProfile.py modules.
    Not supposed to be used directly.
    cCs
||_dS)N)�profiler)�selfr�r	�/usr/lib64/python3.6/profile.py�__init__1sz_Utils.__init__cCsF|j�}z(y|j|�Wntk
r,YnXWd|j|||�XdS)N)rr�
SystemExit�_show)r�	statement�filename�sort�profr	r	r
r4s
z
_Utils.runcCsJ|j�}z,y|j|||�Wntk
r0YnXWd|j|||�XdS)N)rrrr
)rr�globals�localsrrrr	r	r
r=s
z
_Utils.runctxcCs"|dk	r|j|�n
|j|�dS)N)�
dump_stats�print_stats)rrrrr	r	r
r
Fsz_Utils._showN)�__name__�
__module__�__qualname__�__doc__rrrr
r	r	r	r
r+s
		r�cCstt�j|||�S)aRun statement under profiler optionally saving results in filename

    This function takes a single argument that can be passed to the
    "exec" statement, and an optional file name.  In all cases this
    routine attempts to "exec" its first argument and gather profiling
    statistics from the execution. If no file name is present, then this
    function automatically prints a simple profiling report, sorted by the
    standard name string (file/line/function-name) that is presented in
    each line.
    )rrr)rrrr	r	r
rRscCstt�j|||||�S)z�Run statement under profiler, supplying your own globals and locals,
    optionally saving results in filename.

    statement and filename have the same semantics as profile.run
    )rrr)rrrrrr	r	r
r_sc@s�eZdZdZdZd4dd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
ee
e
ee
e
d�Zdd�ZGdd�d�ZGdd�d�Zdd�Zdd �Zd6d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd7d0d1�Zd2d3�ZdS)8raProfiler class.

    self.cur is always a tuple.  Each such tuple corresponds to a stack
    frame that is currently active (self.cur[-2]).  The following are the
    definitions of its members.  We use this external "parallel stack" to
    avoid contaminating the program that we are profiling. (old profiler
    used to write into the frames local dictionary!!) Derived classes
    can change the definition of some entries, as long as they leave
    [-2:] intact (frame and previous tuple).  In case an internal error is
    detected, the -3 element is used as the function name.

    [ 0] = Time that needs to be charged to the parent frame's function.
           It is used so that a function call will not have to access the
           timing data for the parent frame.
    [ 1] = Total time spent in this frame's function, excluding time in
           subfunctions (this latter is tallied in cur[2]).
    [ 2] = Total time spent in subfunctions, excluding time executing the
           frame's function (this latter is tallied in cur[1]).
    [-3] = Name of the function that corresponds to this frame.
    [-2] = Actual frame that we correspond to (used to sync exception handling).
    [-1] = Our parent 6-tuple (corresponds to frame.f_back).

    Timing data for each function is stored as a 5-tuple in the dictionary
    self.timings[].  The index is always the name stored in self.cur[-3].
    The following are the definitions of the members:

    [0] = The number of times this function was called, not counting direct
          or indirect recursion,
    [1] = Number of times this function appears on the stack, minus one
    [2] = Total time spent internal to this function
    [3] = Cumulative time that this function was present on the stack.  In
          non-recursive functions, this is the total execution time from start
          to finish of each invocation of a function, including time spent in
          all subfunctions.
    [4] = A dictionary indicating for each function name, the number of times
          it was called by us.
    rNcCs�i|_d|_d|_d|_|dkr&|j}||_|sHtj|_|_|j	|_
nl||_|j�}yt|�}Wn"tk
r�||_|j	|_
Yn0X|dkr�|j
|_
n|j|_
|tfdd�}||_|j�|_|jd�dS)N��cSs
||��S)Nr	)�timer�sumr	r	r
�get_time_timer�sz(Profile.__init__.<locals>.get_time_timerr)�timings�cur�cmd�c_func_name�bias�timeZprocess_timer�get_time�trace_dispatch_i�
dispatcher�len�	TypeError�trace_dispatch�trace_dispatch_lr�t�
simulate_call)rrr$r-Zlengthrr	r	r
r�s0


zProfile.__init__cCs�|j}|�}|d|d|j|j}|dkr8|j|_|j||||�rd|�}|d|d|_n|�}|d|d||_dS)Nrr�c_call)rr-r$rr#�dispatch)r�frame�event�argrr-�rr	r	r
r+�szProfile.trace_dispatchcCsT|j}|�|j|j}|dkr(|j|_|j||||�rD|�|_n|�||_dS)Nr/)rr-r$rr#r0)rr1r2r3rr-r	r	r
r'�s
zProfile.trace_dispatch_icCs`|j}|�d|j|j}|dkr,|j|_|j||||�rL|�d|_n|�d||_dS)NgN@r/)rr-r$rr#r0)rr1r2r3rr-r	r	r
�trace_dispatch_mac�szProfile.trace_dispatch_maccCsT|j}|�|j|j}|dkr(|j|_|j||||�rD|�|_n|�||_dS)Nr/)r&r-r$rr#r0)rr1r2r3r&r-r	r	r
r,�s
zProfile.trace_dispatch_lc	CsD|j\}}}}}}||k	r*|r*|j||�S|||||||f|_dS)Nr)r!�trace_dispatch_return)	rr1r-�rpt�rit�ret�rfn�rframe�rcurr	r	r
�trace_dispatch_exception�s
z Profile.trace_dispatch_exceptioncCs�|jr@|j|jdk	r@|j\}}}}}}t|tj�s@|j|d�|j}	|	j|	j|	j	f}
|dd|
||jf|_|j
}|
|kr�||
\}}
}}}||
d|||f||
<nddddif||
<dS)Nrrr���)r!�f_back�
isinstancer�
fake_framer6�f_code�co_filename�co_firstlineno�co_namer )rr1r-r7r8r9r:r;r<Zfcode�fnr �cc�ns�tt�ct�callersr	r	r
�trace_dispatch_callszProfile.trace_dispatch_callc
Csndd|jf}|dd|||jf|_|j}||krX||\}}}}}	||d|||	f||<nddddif||<dS)Nrrr)r#r!r )
rr1r-rFr rGrHrIrJrKr	r	r
�trace_dispatch_c_callszProfile.trace_dispatch_c_callcCs�||jdk	r |j|jdd�|j\}}}}}}||}||}|\}	}
}}}
}|	|
|||||
|f|_|j}||\}}}}}|s�||}|d}||kr�||d||<nd||<||d||||f||<dS)Nrrrr>r>)r!r6r )rr1r-r7r8r9r:r<Zframe_totalZpptZpitZpetZpfn�pframeZpcurr rGrHrIrJrKr	r	r
r6#s"zProfile.trace_dispatch_return)�callZ	exception�returnr/Zc_exceptionZc_returncCs"|jdrdS||_|j|�dS)Nr���)r!r"r.)rr"r	r	r
�set_cmdYs
zProfile.set_cmdc@seZdZdd�Zdd�ZdS)zProfile.fake_codecCs||_||_||_d|_dS)Nr)rC�co_linerErD)rr�line�namer	r	r
r_szProfile.fake_code.__init__cCst|j|j|jf�S)N)�reprrCrSrE)rr	r	r
�__repr__eszProfile.fake_code.__repr__N)rrrrrWr	r	r	r
�	fake_code^srXc@seZdZdd�ZdS)zProfile.fake_framecCs||_||_dS)N)rBr?)r�codeZpriorr	r	r
riszProfile.fake_frame.__init__N)rrrrr	r	r	r
rAhsrAcCsF|jdd|�}|jr |jd}nd}|j||�}|jd||d�dS)NZprofilerrrOr>)rXr!rAr0)rrUrYrNr1r	r	r
r.mszProfile.simulate_callcCsN|j}|�|j}x*|jdr<|jd||jd|�d}qW|�||_dS)NrrPrrrQr>)r&r-r!r0)rr&r-r	r	r
�simulate_cmd_completeyszProfile.simulate_cmd_completercCs$ddl}|j|�j�j|�j�dS)Nr)�pstatsZStatsZ
strip_dirsZ
sort_statsr)rrr[r	r	r
r�szProfile.print_statsc
Cs0t|d��}|j�tj|j|�WdQRXdS)N�wb)�open�create_stats�marshal�dump�stats)r�file�fr	r	r
r�szProfile.dump_statscCs|j�|j�dS)N)rZ�snapshot_stats)rr	r	r
r^�szProfile.create_statsc	Csfi|_xZ|jj�D]L\}\}}}}}|j�}d}x|j�D]}||7}q:W|||||f|j|<qWdS)Nr)rar �items�copy�values)	r�funcrGrHrIrJrKZncZcallcntr	r	r
rd�szProfile.snapshot_statscCsddl}|j}|j|||�S)Nr)�__main__�__dict__r)rr"ri�dictr	r	r
r�szProfile.runcCs8|j|�tj|j�zt|||�Wdtjd�X|S)N)rR�sys�
setprofiler(�exec)rr"rrr	r	r
r�s
zProfile.runctxcOs6|jt|��tj|j�z
|||�Stjd�XdS)N)rRrVrlrmr()rrh�args�kwr	r	r
�runcall�s

zProfile.runcallcCs8|jtk	rtd��|j}d|_z|j||�S||_XdS)Nz&Subclasses must override .calibrate().r)�	__class__rr*r$�_calibrate_inner)r�m�verboseZ
saved_biasr	r	r
�	calibrate�s
zProfile.calibratecCs$|j}dd�}|fdd�}||�|�}||�|�}||}|rLtd|�t�}	|�}|	jdt�t��|�}||}
|r�td|
�d}d}x>|	jj�D]0\\}
}}\}}}}}|dkr�||7}||7}q�W|r�td|�td|�||d
k�rtd|��||d|}|�r td|�|S)NcSsxt|�D]}d}q
WdS)Nr)�range)�n�i�xr	r	r
�f1�sz$Profile._calibrate_inner.<locals>.f1cSsxt|�D]}|d�q
WdS)N�d)rw)rtr{ryr	r	r
rc�sz#Profile._calibrate_inner.<locals>.fz elapsed time without profiling =zf(m)zelapsed time with profiling =grcr{z!'CPU seconds' profiler reported =ztotal # calls =rz internal error: total calls = %dg@z+mean stopwatch overhead per profile event =)rcr{)	r&�printrrrrr re�
ValueError)rrtrur&r{rcZt0Zt1Zelapsed_noprofile�pZelapsed_profileZtotal_callsZ
reported_timerrT�funcnamerGrHrIrJrKZmeanr	r	r
rs�sB

"


zProfile._calibrate_inner)NNrQ)rQ)r)rrrrr$rr+r'r5r,r=rLrMr6r0rRrXrAr.rZrrr^rdrrrqrvrsr	r	r	r
rhs>%
''




1
c
Cs�d}t|d�}d|_|jdddddd�|jd	d
dddd�tjd
d�s\|j�tjd�|j�\}}|tjdd�<t|�dkr�|d}tj	j
dtj	j|��t
|d��}t|j�|d�}WdQRX|dddd�}t||d|j|j�n|j�|S)Nz?profile.py [-o output_file_path] [-s sort] scriptfile [arg] ...)�usageFz-oz	--outfile�outfilezSave stats to <outfile>)�dest�help�defaultz-sz--sortrz?Sort order when printing to stdout, based on pstats.Stats classrrr�rbrnri)�__file__r�__package__�
__cached__rQ)rZallow_interspersed_argsZ
add_optionrl�argvZprint_usage�exit�
parse_argsr)�path�insert�os�dirnamer]�compile�readrr�r)r��parserZoptionsroZprogname�fprYZglobsr	r	r
�main*s2




r�rirQ)NrQrQ)NrQ)rrlr�r%r_Zoptparser�__all__rrrrr�rr	r	r	r
�<module>	s 

'

	E"base64.cpython-36.opt-1.pyc000064400000041007150335715140011223 0ustar003


 \�O�@s�dZddlZddlZddlZddddddd	d
ddd
dddddddgZeefZdd�ZdCdd�Z	dDdd�Z
dd�Zdd�Zej
dd�Zej
dd�Zdd�Zdd�Zd Zdadad!d	�ZdEd"d
�Zd#d�ZdFd$d�Zdadad%Zd&ZdGd'd(�Zddddd)�d*d�Zddd+d,�d-d�Zd.Z da!da"da#dHd/d
�Z$d0d�Z%d1Z&e&d2d3Z'd4d�Z(d5d�Z)d6d7�Z*d8d�Z+d9d:�Z,d;d�Z-d<d=�Z.d>d?�Z/d@dA�Z0e1dBk�r�e/�dS)IzDBase16, Base32, Base64 (RFC 3548), Base85 and Ascii85 data encodings�N�encode�decode�encodebytes�decodebytes�	b64encode�	b64decode�	b32encode�	b32decode�	b16encode�	b16decode�	b85encode�	b85decode�	a85encode�	a85decode�standard_b64encode�standard_b64decode�urlsafe_b64encode�urlsafe_b64decodecCsxt|t�r2y
|jd�Stk
r0td��YnXt|t�r@|Syt|�j�Stk
rrtd|j	j
�d�YnXdS)N�asciiz4string argument should contain only ASCII charactersz>argument should be a bytes-like object or ASCII string, not %r)�
isinstance�strr�UnicodeEncodeError�
ValueError�bytes_types�
memoryview�tobytes�	TypeError�	__class__�__name__)�s�r �/usr/lib64/python3.6/base64.py�_bytes_from_decode_data"s


r"cCs,tj|dd�}|dk	r(|jtjd|��S|S)a*Encode the bytes-like object s using Base64 and return a bytes object.

    Optional altchars should be a byte string of length 2 which specifies an
    alternative alphabet for the '+' and '/' characters.  This allows an
    application to e.g. generate url or filesystem safe Base64 strings.
    F)�newlineNs+/)�binascii�
b2a_base64�	translate�bytes�	maketrans)r�altchars�encodedr r r!r3sFcCsPt|�}|dk	r*t|�}|jtj|d��}|rFtjd|�rFtjd��tj|�S)anDecode the Base64 encoded bytes-like object or ASCII string s.

    Optional altchars must be a bytes-like object or ASCII string of length 2
    which specifies the alternative alphabet used instead of the '+' and '/'
    characters.

    The result is returned as a bytes object.  A binascii.Error is raised if
    s is incorrectly padded.

    If validate is False (the default), characters that are neither in the
    normal base-64 alphabet nor the alternative alphabet are discarded prior
    to the padding check.  If validate is True, these non-alphabet characters
    in the input result in a binascii.Error.
    Ns+/s^[A-Za-z0-9+/]*={0,2}$zNon-base64 digit found)	r"r&r'r(�re�matchr$�Error�
a2b_base64)rr)Zvalidater r r!rAs
cCst|�S)zrEncode bytes-like object s using the standard Base64 alphabet.

    The result is returned as a bytes object.
    )r)rr r r!rZscCst|�S)aQDecode bytes encoded with the standard Base64 alphabet.

    Argument s is a bytes-like object or ASCII string to decode.  The result
    is returned as a bytes object.  A binascii.Error is raised if the input
    is incorrectly padded.  Characters that are not in the standard alphabet
    are discarded prior to the padding check.
    )r)rr r r!rass+/s-_cCst|�jt�S)z�Encode bytes using the URL- and filesystem-safe Base64 alphabet.

    Argument s is a bytes-like object to encode.  The result is returned as a
    bytes object.  The alphabet uses '-' instead of '+' and '_' instead of
    '/'.
    )rr&�_urlsafe_encode_translation)rr r r!roscCst|�}|jt�}t|�S)a�Decode bytes using the URL- and filesystem-safe Base64 alphabet.

    Argument s is a bytes-like object or ASCII string to decode.  The result
    is returned as a bytes object.  A binascii.Error is raised if the input
    is incorrectly padded.  Characters that are not in the URL-safe base-64
    alphabet, and are not a plus '+' or slash '/', are discarded prior to the
    padding check.

    The alphabet uses '-' instead of '+' and '_' instead of '/'.
    )r"r&�_urlsafe_decode_translationr)rr r r!rxs
s ABCDEFGHIJKLMNOPQRSTUVWXYZ234567csBtdkr,dd�tD���fdd��D�ad�t|t�sBt|�j�}t|�d}|rb|dd|}t�}tj	}t}xjt
dt|�d�D]V}||||d�d�}|||d	?||d
?d@||d?d@||d@7}q�W|d
kr�d|dd�<nF|dk�rd|dd�<n.|dk�r$d|dd�<n|dk�r:d|dd�<t|�S)zKEncode the bytes-like object s using Base32 and return a bytes object.
    NcSsg|]}t|f��qSr )r')�.0�ir r r!�
<listcomp>�szb32encode.<locals>.<listcomp>csg|]}�D]}||�qqSr r )r1�a�b)�b32tabr r!r3�s��r�big��i��
�s======��s====��s===�=i�������������)�_b32tab2�_b32alphabetrrrr�len�	bytearray�int�
from_bytes�ranger')r�leftoverr*rKZb32tab2r2�cr )r6r!r�s4
*


c

Cs�tdkrdd�tt�D�at|�}t|�dr8tjd��|dk	r^t|�}|jtj	dd|��}|rj|j
�}t|�}|jd�}|t|�}t�}t}x�t
d	t|�d�D]l}|||d�}d	}	y"x|D]}
|	d
>||
}	q�WWn tk
r�tjd�d�YnX||	jd
d�7}q�W|d�s(|dk�r2tjd��|�rz|�rz|	d
|K}	|	jd
d�}dd
|d}|d|�|dd�<t|�S)aZDecode the Base32 encoded bytes-like object or ASCII string s.

    Optional casefold is a flag specifying whether a lowercase alphabet is
    acceptable as input.  For security purposes, the default is False.

    RFC 3548 allows for optional mapping of the digit 0 (zero) to the
    letter O (oh), and for optional mapping of the digit 1 (one) to
    either the letter I (eye) or letter L (el).  The optional argument
    map01 when not None, specifies which letter the digit 1 should be
    mapped to (when map01 is not None, the digit 0 is always mapped to
    the letter O).  For security purposes the default is None, so that
    0 and 1 are not allowed in the input.

    The result is returned as a bytes object.  A binascii.Error is raised if
    the input is incorrectly padded or if there are non-alphabet
    characters present in the input.
    NcSsi|]\}}||�qSr r )r1�k�vr r r!�
<dictcomp>�szb32decode.<locals>.<dictcomp>�zIncorrect paddings01�OrBrr7zNon-base32 digit foundr9r=rAr@r>�+>rr=rAr@r>���)�_b32rev�	enumeraterGr"rHr$r-r&r'r(�upper�rstriprIrL�KeyError�to_bytes)
r�casefoldZmap01�lZpadchars�decodedZb32revr2Zquanta�accrNZlastrMr r r!r	�s@



cCstj|�j�S)zKEncode the bytes-like object s using Base16 and return a bytes object.
    )r$ZhexlifyrX)rr r r!r
�scCs4t|�}|r|j�}tjd|�r*tjd��tj|�S)a�Decode the Base16 encoded bytes-like object or ASCII string s.

    Optional casefold is a flag specifying whether a lowercase alphabet is
    acceptable as input.  For security purposes, the default is False.

    The result is returned as a bytes object.  A binascii.Error is raised if
    s is incorrectly padded or if there are non-alphabet characters present
    in the input.
    s	[^0-9A-F]zNon-base16 digit found)r"rXr+�searchr$r-Z	unhexlify)rr\r r r!r�s

s<~s~>c	s�t|t�st|�j�}t|�d}|r4|d|}tjdt|�d�j|�}����fdd�|D�}|r�|r�|ddkr��dd	|d<|d
d|�|d<d
j|�S)Nr@r8z!%dIcsRg|]J}�r|rdn6�r&|dkr&dn&�|d�|dd�|d�qS)�zi    �yi�^	�Ui9r )r1Zword)�chars�chars2�foldnuls�
foldspacesr r!r3!sz_85encode.<locals>.<listcomp>r=rarr7�rErErErE)	rrrrrH�struct�StructZunpack�join)	r5rdre�padrfrg�paddingZwords�chunksr )rdrerfrgr!�	_85encodes

ro)rg�wrapcolrl�adobecs�tdkr*dd�tdd�D�add�tD�at|tt|d|��|rHt���r�t|rVdnd	�����fd
d�tdt����D�}|r�t|d�d�kr�|jd�d
j|��|r��t	7��S)a�Encode bytes-like object b using Ascii85 and return a bytes object.

    foldspaces is an optional flag that uses the special short sequence 'y'
    instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This
    feature is not supported by the "standard" Adobe encoding.

    wrapcol controls whether the output should have newline (b'\n') characters
    added to it. If this is non-zero, each output line will be at most this
    many characters long.

    pad controls whether the input is padded to a multiple of 4 before
    encoding. Note that the btoa implementation always pads.

    adobe controls whether the encoded byte sequence is framed with <~ and ~>,
    which is used by the Adobe implementation.
    NcSsg|]}t|f��qSr )r')r1r2r r r!r3Dsza85encode.<locals>.<listcomp>�!�vcSsg|]}tD]}||�qqSr )�	_a85chars)r1r4r5r r r!r3EsTr?r=csg|]}�||���qSr r )r1r2)�resultrpr r!r3Msrrh�
rE)
rtrL�
_a85chars2ro�	_A85START�maxrH�appendrk�_A85END)r5rgrprlrqrnr )rurpr!r/s"

s 	

)rgrq�ignorecharscCs�t|�}|rH|jt�s$tdjt���|jt�r<|dd�}n|dd�}tjd�j	}g}|j
}g}|j
}|j}	�x|dD�]�}
d|
ko�dkn�r||
�t|�d	k�rrd}x|D]}
d
||
d}q�Wy|||��Wn"tj
k
�rtd�d�YnX|	�qz|
dk�r0|�r&td��|d�qz|�rX|
dk�rX|�rNtd��|d�qz|
|k�rfqzqztd|
��qzWdj|�}dt|�}
|
�r�|d|
�}|S)a�Decode the Ascii85 encoded bytes-like object or ASCII string b.

    foldspaces is a flag that specifies whether the 'y' short sequence should be
    accepted as shorthand for 4 consecutive spaces (ASCII 0x20). This feature is
    not supported by the "standard" Adobe encoding.

    adobe controls whether the input sequence is in Adobe Ascii85 format (i.e.
    is framed with <~ and ~>).

    ignorechars should be a byte string containing characters to ignore from the
    input. This should only contain whitespace characters, and by default
    contains all whitespace characters in ASCII.

    The result is returned as a bytes object.
    z1Ascii85 encoded byte sequences must end with {!r}r?Nz!I�ur@�!rr7rcrrzAscii85 overflowrazz inside Ascii85 5-tuplesrbzy inside Ascii85 5-tuples    zNon-Ascii85 digit found: %crh���rsuuuurr�u�z�y)r"�endswithr{r�format�
startswithrxrirj�packrz�clearrH�errorrk)r5rgrqr|�packIr^Zdecoded_appendZcurrZcurr_appendZ
curr_clear�xr_rurmr r r!rXsV







sU0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~cCs2tdkr$dd�tD�add�tD�at|tt|�S)z�Encode bytes-like object b in base85 format and return a bytes object.

    If pad is true, the input is padded with b'\0' so its length is a multiple of
    4 bytes before encoding.
    NcSsg|]}t|f��qSr )r')r1r2r r r!r3�szb85encode.<locals>.<listcomp>cSsg|]}tD]}||�qqSr )�	_b85chars)r1r4r5r r r!r3�s)r��_b85alphabet�
_b85chars2ro)r5rlr r r!r�s	c
CsZtdkr0dgdaxtt�D]\}}|t|<qWt|�}t|�d}|d|}g}tjd�j}x�tdt|�d�D]�}|||d�}d}y"x|D]}|dt|}q�WWnJt	k
r�x2t|�D]&\}}t|dkr�t
d||�d�q�W�YnXy|j||��Wqttjk
�r2t
d	|�d�YqtXqtWd
j
|�}	|�rV|	d|�}	|	S)zqDecode the base85-encoded bytes-like object or ASCII string b

    The result is returned as a bytes object.
    N�r7�~z!Irrcz#bad base85 character at position %dz+base85 overflow in hunk starting at byte %drh)�_b85decrWr�r"rHrirjr�rLrrrzr�rk)
r5r2rNrm�outr��chunkr_�jrur r r!r
�s<


�Lr@rAcCs`xZ|jt�}|sPx0t|�tkrB|jtt|��}|s8P||7}qWtj|�}|j|�qWdS)z1Encode a file; input and output are binary files.N)�read�
MAXBINSIZErHr$r%�write)�input�outputr�ns�liner r r!r�s

cCs,x&|j�}|sPtj|�}|j|�qWdS)z1Decode a file; input and output are binary files.N)�readliner$r.r�)r�r�r�rr r r!r�s
cCs�yt|�}Wn8tk
rD}zd|jj}t|�|�WYdd}~XnX|jdkrjd|j|jjf}t|��|jdkr�d|j|jjf}t|��dS)	Nz"expected bytes-like object, not %srNr5�Bz-expected single byte elements, not %r from %sr=z(expected 1-D data, not %d-D data from %s)rNr5r�)rrrrr��ndim)r�m�err�msgr r r!�_input_type_check�s

r�cCsPt|�g}x8tdt|�t�D]$}|||t�}|jtj|��qWdj|�S)zVEncode a bytestring into a bytes object containing multiple lines
    of base-64 data.rrh)r�rLrHr�rzr$r%rk)r�piecesr2r�r r r!rscCsddl}|jdtd�t|�S)zLegacy alias of encodebytes().rNzAencodestring() is a deprecated alias since 3.1, use encodebytes()r?)�warnings�warn�DeprecationWarningr)rr�r r r!�encodestringsr�cCst|�tj|�S)z8Decode a bytestring of base-64 data into a bytes object.)r�r$r.)rr r r!rscCsddl}|jdtd�t|�S)zLegacy alias of decodebytes().rNzHdecodestring() is a deprecated alias since Python 3.1, use decodebytes()r?)r�r�r�r)rr�r r r!�decodestring$sr�c	Csddl}ddl}y|j|jdd�d�\}}WnP|jk
r~}z2|j|_t|�td|jd�|jd�WYdd}~XnXt}xF|D]>\}}|dkr�t}|dkr�t	}|d	kr�t	}|d
kr�t
�dSq�W|o�|ddk�rt|dd��}|||jj�WdQRXn||j
j|jj�dS)
zSmall main programrNr=Zdeutz�usage: %s [-d|-e|-u|-t] [file|-]
        -d, -u: decode
        -e: encode (default)
        -t: encode and decode string 'Aladdin:open sesame'r?z-ez-dz-uz-t�-�rb)�sys�getopt�argvr��stderr�stdout�print�exitrr�test�open�buffer�stdin)	r�r�Zopts�argsr��func�or4�fr r r!�main.s0r�cCs<d}tt|��t|�}tt|��t|�}tt|��dS)NsAladdin:open sesame)r��reprrr)Zs0�s1�s2r r r!r�Hsr��__main__)N)NF)FN)F)FFF)F)2�__doc__r+rir$�__all__r'rIrr"rrrrr(r/r0rrrGrFrVrr	r
rrtrwrxr{rorrr�r�r�r�rr
ZMAXLINESIZEr�rrr�rr�rr�r�r�rr r r r!�<module>sh

	&
C

)H
-	
	


__future__.cpython-36.opt-2.pyc000064400000004221150335715140012243 0ustar003


 \��	@s�dddddddddg	Zd	geZd
ZdZdZd
ZdZdZdZdZ	dZ
Gdd�d�Zed d!e�Zed"d#e�Z
ed$d%e�Zed&d'e�Zed(d)e�Zed*d+e�Zed,d-e�Zed.d/e	�Zed0d1e
�ZdS)2�
nested_scopes�
generators�division�absolute_import�with_statement�print_function�unicode_literals�barry_as_FLUFL�generator_stop�all_feature_names��i i@i�iiiic@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_FeaturecCs||_||_||_dS)N)�optional�	mandatory�
compiler_flag)�selfZoptionalReleaseZmandatoryReleaser�r�"/usr/lib64/python3.6/__future__.py�__init__Osz_Feature.__init__cCs|jS)N)r)rrrr�getOptionalReleaseTsz_Feature.getOptionalReleasecCs|jS)N)r)rrrr�getMandatoryRelease\sz_Feature.getMandatoryReleasecCsdt|j|j|jf�S)Nr
)�reprrrr)rrrr�__repr__esz_Feature.__repr__N)�__name__�
__module__�__qualname__rrrrrrrrr
Ns	r
���beta�alpha��final���	�N)rrrrr)rrrrr)rrrrr)rr rr!r)rrrrr)r rrrr)rr"rrr)r rrrr)rr"rrr)rr#rrr)rr#rrr)r rrrr)rr#rrr)r rrrr)r rrrr)r r$rrr)r r"rrr)r r%rrr)r
�__all__Z	CO_NESTEDZCO_GENERATOR_ALLOWEDZCO_FUTURE_DIVISIONZCO_FUTURE_ABSOLUTE_IMPORTZCO_FUTURE_WITH_STATEMENTZCO_FUTURE_PRINT_FUNCTIONZCO_FUTURE_UNICODE_LITERALSZCO_FUTURE_BARRY_AS_BDFLZCO_FUTURE_GENERATOR_STOPr
rrrrrrrrr	rrrr�<module>3s\
_compression.cpython-36.pyc000064400000010012150335715140011670 0ustar003


 \��@s:dZddlZejZGdd�dej�ZGdd�dej�ZdS)z7Internal classes used by the gzip, lzma and bz2 modules�Nc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
BaseStreamzMode-checking helper functions.cCs|jrtd��dS)NzI/O operation on closed file)�closed�
ValueError)�self�r�$/usr/lib64/python3.6/_compression.py�_check_not_closedszBaseStream._check_not_closedcCs|j�stjd��dS)NzFile not open for reading)�readable�io�UnsupportedOperation)rrrr�_check_can_readszBaseStream._check_can_readcCs|j�stjd��dS)NzFile not open for writing)�writabler
r)rrrr�_check_can_writeszBaseStream._check_can_writecCs(|j�stjd��|j�s$tjd��dS)Nz3Seeking is only supported on files open for readingz3The underlying file object does not support seeking)r	r
r�seekable)rrrr�_check_can_seeks
zBaseStream._check_can_seekN)�__name__�
__module__�__qualname__�__doc__rrrrrrrrr	s
rcsleZdZdZdd�Zffdd�Z�fdd�Zdd	�Zd
d�Zdd
d�Z	dd�Z
ejfdd�Z
dd�Z�ZS)�DecompressReaderz5Adapts the decompressor API to a RawIOBase reader APIcCsdS)NTr)rrrrr	$szDecompressReader.readablecKs>||_d|_d|_d|_||_||_|jf|j�|_||_dS)NFr����)�_fp�_eof�_pos�_size�_decomp_factory�_decomp_args�
_decompressor�_trailing_error)r�fpZdecomp_factoryZtrailing_errorZdecomp_argsrrr�__init__'szDecompressReader.__init__csd|_t�j�S)N)r�super�close)r)�	__class__rrr#;szDecompressReader.closecCs
|jj�S)N)rr)rrrrr?szDecompressReader.seekablecCsPt|��:}|jd��$}|jt|��}||dt|��<WdQRXWdQRXt|�S)N�B)�
memoryview�cast�read�len)r�bZviewZ	byte_view�datarrr�readintoBs$zDecompressReader.readintorcCs�|dkr|j�S|s|jr dSd}x�|jjr�|jjp@|jjt�}|sHP|jf|j	�|_y|jj
||�}Wq�|jk
r�PYq�Xn4|jjr�|jjt�}|s�t
d��nd}|jj
||�}|r&Pq&W|s�d|_|j|_dS|jt|�7_|S)Nr�zACompressed file ended before the end-of-stream marker was reachedT)�readallrr�eofZunused_datarr(�BUFFER_SIZErrZ
decompressrZneeds_input�EOFErrorrrr))r�sizer+Zrawblockrrrr(Hs>


zDecompressReader.readcCs,|jjd�d|_d|_|jf|j�|_dS)NrF)r�seekrrrrr)rrrr�_rewindrszDecompressReader._rewindcCs�|tjkrnV|tjkr"|j|}n@|tjkrT|jdkrHx|jtj�rFq8W|j|}ntdj	|���||jkrv|j
�n
||j8}x0|dkr�|jttj|��}|s�P|t|�8}q�W|jS)NrzInvalid value for whence: {})
r
�SEEK_SET�SEEK_CURr�SEEK_ENDrr(�DEFAULT_BUFFER_SIZEr�formatr4�minr))r�offset�whencer+rrrr3xs&







zDecompressReader.seekcCs|jS)z!Return the current file position.)r)rrrr�tell�szDecompressReader.tellr)r)rrrrr	r!r#rr,r(r4r
r5r3r=�
__classcell__rr)r$rr!s
*r)rr
r8r0�BufferedIOBaser�	RawIOBaserrrrr�<module>schunk.cpython-36.opt-1.pyc000064400000011446150335715140011253 0ustar003


 \1�@sdZGdd�d�ZdS)aSimple class to read IFF chunks.

An IFF chunk (used in formats such as AIFF, TIFF, RMFF (RealMedia File
Format)) has the following structure:

+----------------+
| ID (4 bytes)   |
+----------------+
| size (4 bytes) |
+----------------+
| data           |
| ...            |
+----------------+

The ID is a 4-byte string which identifies the type of chunk.

The size field (a 32-bit value, encoded using big-endian byte order)
gives the size of the whole chunk, including the 8-byte header.

Usually an IFF-type file consists of one or more chunks.  The proposed
usage of the Chunk class defined here is to instantiate an instance at
the start of each chunk and read from the instance until it reaches
the end, after which a new instance can be instantiated.  At the end
of the file, creating a new instance will fail with an EOFError
exception.

Usage:
while True:
    try:
        chunk = Chunk(file)
    except EOFError:
        break
    chunktype = chunk.getname()
    while True:
        data = chunk.read(nbytes)
        if not data:
            pass
        # do something with data

The interface is file-like.  The implemented methods are:
read, close, seek, tell, isatty.
Extra methods are: skip() (called by close, skips to the end of the chunk),
getname() (returns the name (ID) of the chunk)

The __init__ method has one required argument, a file-like object
(including a chunk instance), and one optional argument, a flag which
specifies whether or not chunks are aligned on 2-byte boundaries.  The
default is 1, i.e. aligned.
c@sZeZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zddd�Zdd�Z	ddd�Z
dd�ZdS)�ChunkTFcCs�ddl}d|_||_|rd}nd}||_|jd�|_t|j�dkrFt�y |j|d|jd��d|_	Wn|j
k
r�t�YnX|r�|j	d|_	d|_y|jj�|_
Wnttfk
r�d|_YnXd|_dS)	N�F�>�<��L�T)�struct�closed�align�file�read�	chunkname�len�EOFErrorZunpack_from�	chunksize�error�	size_read�tell�offset�AttributeError�OSError�seekable)�selfrr
Z	bigendianZ
inclheaderrZstrflag�r�/usr/lib64/python3.6/chunk.py�__init__4s, 
zChunk.__init__cCs|jS)z*Return the name (ID) of the current chunk.)r
)rrrr�getnameNsz
Chunk.getnamecCs|jS)z%Return the size of the current chunk.)r)rrrr�getsizeRsz
Chunk.getsizecCs |jsz|j�Wdd|_XdS)NT)r	�skip)rrrr�closeVszChunk.closecCs|jrtd��dS)NzI/O operation on closed fileF)r	�
ValueError)rrrr�isatty]szChunk.isattyrcCsv|jrtd��|jstd��|dkr0||j}n|dkrB||j}|dksT||jkrXt�|jj|j	|d�||_dS)z�Seek to specified position into the chunk.
        Default position is 0 (start of chunk).
        If the file is not seekable, this will result in an error.
        zI/O operation on closed filezcannot seek��rN)
r	r rrrr�RuntimeErrorr�seekr)r�pos�whencerrrr%bs
z
Chunk.seekcCs|jrtd��|jS)NzI/O operation on closed file)r	r r)rrrrrusz
Chunk.tellr"cCs�|jrtd��|j|jkrdS|dkr2|j|j}||j|jkrN|j|j}|jj|�}|jt|�|_|j|jkr�|jr�|jd@r�|jjd�}|jt|�|_|S)z�Read at most size bytes from the chunk.
        If size is omitted or negative, read until the end
        of the chunk.
        zI/O operation on closed file�rr")r	r rrrrrr
)r�size�data�dummyrrrrzs 
z
Chunk.readcCs�|jrtd��|jrlyB|j|j}|jr:|jd@r:|d}|jj|d�|j||_dStk
rjYnXx4|j|jkr�t	d|j|j�}|j
|�}|snt�qnWdS)z�Skip the rest of the chunk.
        If you are not interested in the contents of the chunk,
        this method should be called so that the file points to
        the start of the next chunk.
        zI/O operation on closed filer"Ni )r	r rrrr
rr%r�minrr)r�nr+rrrr�s"
z
Chunk.skipN)TTF)r���)r.)�__name__�
__module__�__qualname__rrrrr!r%rrrrrrrr3s


rN)�__doc__rrrrr�<module>1slinecache.cpython-36.opt-2.pyc000064400000005163150335715140012056 0ustar003


 \��@sjddlZddlZddlZddlZdddgZddd�Ziadd�Zddd�Zdd	d�Z	dd
d�Z
dd
�ZdS)�N�getline�
clearcache�
checkcachecCs:t||�}d|ko t|�knr2||dSdSdS)N��)�getlines�len)�filename�lineno�module_globals�lines�r
�!/usr/lib64/python3.6/linecache.pyrs
cCsiadS)N)�cacher
r
r
rrscCsR|tkr(t|}t|�dkr(t|dSy
t||�Stk
rLt�gSXdS)Nr�)rr�updatecache�MemoryErrorr)r	r�entryr
r
rr%s
rcCs�|dkrttj��}n|tkr&|g}ndSx~|D]v}t|}t|�dkrJq0|\}}}}|dkr`q0ytj|�}Wntk
r�t|=w0YnX||jks�||jkr0t|=q0WdS)Nr)	�listr�keysr�os�stat�OSError�st_size�st_mtime)r	�	filenamesr�size�mtimer�fullnamerr
r
rr5s&
c"Cs�|tkrtt|�dkrt|=|s8|jd�r<|jd�r<gS|}ytj|�}W�ntk
�rV|}t||�r�yt|d�}Wnttfk
r�Yn<X|dkr�gSt|�ddd�|j	�D�|ft|<t|dStj
j|�r�gSxjtj
D]\}ytj
j
||�}Wnttfk
�r w�YnXytj|�}PWq�tk
�rHYq�Xq�WgSYnXy"tj|��}|j�}WdQRXWntk
�r�gSX|�r�|d	jd��r�|d
d7<|j|j}	}
|	|
||ft|<|S)Nr�<�>rcSsg|]}|d�qS)�
r
)�.0�liner
r
r�
<listcomp>qszupdatecache.<locals>.<listcomp>rr!���r%)rr�
startswith�endswithrrr�	lazycache�ImportError�
splitlines�path�isabs�sys�join�	TypeError�AttributeError�tokenize�open�	readlinesrr)r	rrr�basename�data�dirname�fprrrr
r
rrRsV



rcCs�|tkr tt|�dkrdSdS|s:|jd�r>|jd�r>dS|r�d|kr�|jd�}|d}t|dd�}|r�|r�tj||�}|ft|<dSdS)	NrTFrr �
__loader__�__name__�
get_source)rrr&r'�get�getattr�	functools�partial)r	r�name�loaderr:�	get_linesr
r
rr(�s


r()N)N)N)N)r=r-rr1�__all__rrrrrrr(r
r
r
r�<module>s




Apoplib.cpython-36.opt-1.pyc000064400000032023150335715140011422 0ustar003


 \t:�
@sldZddlZddlZddlZyddlZdZWnek
rDdZYnXddgZGdd�de�Z	dZ
d	Zd
ZdZ
ee
ZdZGd
d�d�Zer�Gdd�de�Zejd�edk�rhddlZeejd�Zeej��ejejd�ejejd�ej�ej�\ZZxXeded�D]FZ ej!e �\Z"Z#Z$ede �xe#D]Z%ede%��q<Wed��qWej&�dS)z@A POP3 client class.

Based on the J. Myers POP3 draft, Jan. 96
�NTF�POP3�error_protoc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/poplib.pyrs�ni��
�
ic@seZdZdZdZeejfdd�Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd=d d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zejd0�Z d1d2�Z!d3d4�Z"d>d5d6�Z#d7d8�Z$d9d:�Z%d?d;d<�Z&dS)@raPThis class supports both the minimal and optional command sets.
    Arguments can be strings or integers (where appropriate)
    (e.g.: retr(1) and retr('1') both work equally well.

    Minimal Command Set:
            USER name               user(name)
            PASS string             pass_(string)
            STAT                    stat()
            LIST [msg]              list(msg = None)
            RETR msg                retr(msg)
            DELE msg                dele(msg)
            NOOP                    noop()
            RSET                    rset()
            QUIT                    quit()

    Optional Commands (some servers support these):
            RPOP name               rpop(name)
            APOP name digest        apop(name, digest)
            TOP msg n               top(msg, n)
            UIDL [msg]              uidl(msg = None)
            CAPA                    capa()
            STLS                    stls()
            UTF8                    utf8()

    Raises one exception: 'error_proto'.

    Instantiate with:
            POP3(hostname, port=110)

    NB:     the POP protocol locks the mailbox from user
            authorization until QUIT, so be sure to get in, suck
            the messages, and quit, each time you access the
            mailbox.

            POP is a line-based protocol, which means large mail
            messages consume lots of python cycles reading them
            line-by-line.

            If it's available on your mail server, use IMAP4
            instead, it doesn't suffer from the two problems
            above.
    zUTF-8cCs@||_||_d|_|j|�|_|jjd�|_d|_|j�|_	dS)NF�rbr)
�host�port�_tls_established�_create_socket�sock�makefile�file�
_debugging�_getresp�welcome)�selfr
r�timeoutrrr�__init__asz
POP3.__init__cCstj|j|jf|�S)N)�socketZcreate_connectionr
r)rrrrrrkszPOP3._create_socketcCs,|jdkrtdt|��|jj|t�dS)N�z*put*)r�print�reprrZsendall�CRLF)r�linerrr�_putlinens
z
POP3._putlinecCs.|jrtdt|��t||j�}|j|�dS)Nz*cmd*)rrr�bytes�encodingr )rrrrr�_putcmduszPOP3._putcmdcCs�|jjtd�}t|�tkr$td��|jdkr<tdt|��|sHtd��t|�}|dd�tkrp|dd�|fS|dd�t	kr�|dd�|fS|dd	�|fS)
Nrz
line too longz*get*z-ERR EOF����r%���r&)
r�readline�_MAXLINE�lenrrrrr�CR)rr�octetsrrr�_getlines
z
POP3._getlinecCs:|j�\}}|jdkr$tdt|��|jd�s6t|��|S)Nrz*resp*�+)r,rrr�
startswithr)r�resp�orrrr�s

z
POP3._getrespcCsp|j�}g}d}|j�\}}xH|dkrd|jd�rD|d}|dd�}||}|j|�|j�\}}qW|||fS)Nr�.s..r)rr,r.�append)rr/�listr+rr0rrr�_getlongresp�s


zPOP3._getlongrespcCs|j|�|j�S)N)r#r)rrrrr�	_shortcmd�s
zPOP3._shortcmdcCs|j|�|j�S)N)r#r4)rrrrr�_longcmd�s
z
POP3._longcmdcCs|jS)N)r)rrrr�
getwelcome�szPOP3.getwelcomecCs
||_dS)N)r)r�levelrrr�set_debuglevel�szPOP3.set_debuglevelcCs|jd|�S)zVSend user name, return response

        (should indicate password required).
        zUSER %s)r5)r�userrrrr:�sz	POP3.usercCs|jd|�S)z�Send password, return response

        (response includes message count, mailbox size).

        NB: mailbox is locked by server from here to 'quit()'
        zPASS %s)r5)rZpswdrrr�pass_�sz
POP3.pass_cCsF|jd�}|j�}|jr&tdt|��t|d�}t|d�}||fS)z]Get mailbox status.

        Result is tuple of 2 ints (message count, mailbox size)
        ZSTATz*stat*rr$)r5�splitrrr�int)rZretvalZretsZnumMessagesZsizeMessagesrrr�stat�s
z	POP3.statNcCs |dk	r|jd|�S|jd�S)aRequest listing, return result.

        Result without a message number argument is in form
        ['response', ['mesg_num octets', ...], octets].

        Result when a message number argument is given is a
        single response: the "scan listing" for that message.
        NzLIST %sZLIST)r5r6)r�whichrrrr3�s	z	POP3.listcCs|jd|�S)zoRetrieve whole message number 'which'.

        Result is in form ['response', ['line', ...], octets].
        zRETR %s)r6)rr?rrr�retr�sz	POP3.retrcCs|jd|�S)zFDelete message number 'which'.

        Result is 'response'.
        zDELE %s)r5)rr?rrr�dele�sz	POP3.delecCs
|jd�S)zXDoes nothing.

        One supposes the response indicates the server is alive.
        ZNOOP)r5)rrrr�noopsz	POP3.noopcCs
|jd�S)z(Unmark all messages marked for deletion.ZRSET)r5)rrrr�rsetsz	POP3.rsetcCs|jd�}|j�|S)zDSignoff: commit changes on server, unlock mailbox, close connection.ZQUIT)r5�close)rr/rrr�quits
z	POP3.quitcCs�z |j}d|_|dk	r|j�Wd|j}d|_|dk	r�zVy|jtj�Wn@tk
r�}z$|jtjkrxt	|dd�dkrx�WYdd}~XnXWd|j�XXdS)z8Close the connection without assuming anything about it.NZwinerrorri&')
rrDrZshutdownrZ	SHUT_RDWR�OSError�errnoZENOTCONN�getattr)rrr�excrrrrDsz
POP3.closecCs|jd|�S)zNot sure what this does.zRPOP %s)r5)rr:rrr�rpop2sz	POP3.rpops\+OK.[^<]*(<.*>)cCs\t||j�}|jj|j�}|s&td��ddl}|jd�|}|j|�j	�}|j
d||f�S)aAuthorisation

        - only possible if server has supplied a timestamp in initial greeting.

        Args:
                user     - mailbox user;
                password - mailbox password.

        NB: mailbox is locked by server from here to 'quit()'
        z!-ERR APOP not supported by serverrNrz
APOP %s %s)r!r"�	timestamp�matchrr�hashlib�groupZmd5Z	hexdigestr5)rr:ZpasswordZsecret�mrMZdigestrrr�apop9sz	POP3.apopcCs|jd||f�S)z�Retrieve message header of message number 'which'
        and first 'howmuch' lines of message body.

        Result is in form ['response', ['line', ...], octets].
        z	TOP %s %s)r6)rr?Zhowmuchrrr�topNszPOP3.topcCs |dk	r|jd|�S|jd�S)z�Return message digest (unique id) list.

        If 'which', result contains unique id for that message
        in the form 'response mesgnum uid', otherwise result is
        the list ['response', ['mesgnum uid', ...], octets]
        NzUIDL %sZUIDL)r5r6)rr?rrr�uidlWsz	POP3.uidlcCs
|jd�S)zITry to enter UTF-8 mode (see RFC 6856). Returns server response.
        ZUTF8)r5)rrrr�utf8csz	POP3.utf8c	Cstdd�}i}y8|jd�}|d}x |D]}||�\}}|||<q&WWn*tk
rn}ztd��WYdd}~XnX|S)aReturn server capabilities (RFC 2449) as a dictionary
        >>> c=poplib.POP3('localhost')
        >>> c.capa()
        {'IMPLEMENTATION': ['Cyrus', 'POP3', 'server', 'v2.2.12'],
         'TOP': [], 'LOGIN-DELAY': ['0'], 'AUTH-RESP-CODE': [],
         'EXPIRE': ['NEVER'], 'USER': [], 'STLS': [], 'PIPELINING': [],
         'UIDL': [], 'RESP-CODES': []}
        >>>

        Really, according to RFC 2449, the cyrus folks should avoid
        having the implementation split into multiple arguments...
        cSs"|jd�j�}|d|dd�fS)N�asciirr)�decoder<)rZlstrrr�	_parsecapvszPOP3.capa.<locals>._parsecapZCAPArz!-ERR CAPA not supported by serverN)r6r)	rrV�capsr/ZrawcapsZcaplineZcapnmZcapargsZ_errrrr�capais


z	POP3.capacCsxtstd��|jrtd��|j�}d|kr2td��|dkrBtj�}|jd�}|j|j|j	d�|_|jj
d�|_d|_|S)	z{Start a TLS session on the active connection as specified in RFC 2595.

                context - a ssl.SSLContext
        z-ERR TLS support missingz$-ERR TLS session already establishedZSTLSz!-ERR STLS not supported by serverN)�server_hostnamerT)�HAVE_SSLrrrX�ssl�_create_stdlib_contextr5�wrap_socketrr
rr)r�contextrWr/rrr�stls�s
z	POP3.stls)N)N)N)'rrr�__doc__r"�	POP3_PORTr�_GLOBAL_DEFAULT_TIMEOUTrrr r#r,rr4r5r6r7r9r:r;r>r3r@rArBrCrErDrJ�re�compilerKrPrQrRrSrXr_rrrrr2s@+	




	
c@s8eZdZdZeddejdfdd�Zdd�Zd	dd�Z	dS)
�POP3_SSLaPOP3 client class over SSL connection

        Instantiate with: POP3_SSL(hostname, port=995, keyfile=None, certfile=None,
                                   context=None)

               hostname - the hostname of the pop3 over ssl server
               port - port number
               keyfile - PEM formatted file that contains your private key
               certfile - PEM formatted certificate chain file
               context - a ssl.SSLContext

        See the methods of the parent class POP3 for more documentation.
        NcCs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}|jdtd�||_||_|dkrxtj||d�}||_t	j
||||�dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadr$)�certfile�keyfile)�
ValueError�warnings�warn�DeprecationWarningrgrfr[r\r^rr)rr
rrgrfrr^rirrrr�szPOP3_SSL.__init__cCs"tj||�}|jj||jd�}|S)N)rY)rrr^r]r
)rrrrrrr�s
zPOP3_SSL._create_socketcCstd��dS)z�The method unconditionally raises an exception since the
            STLS command doesn't make any sense on an already established
            SSL/TLS session.
            z$-ERR TLS session already establishedN)r)rrgrfr^rrrr_�sz
POP3_SSL.stls)NNN)
rrrr`�
POP3_SSL_PORTrrbrrr_rrrrre�s

re�__main__rr$�zMessage %d:z   z-----------------------)'r`rGrcrr[rZ�ImportError�__all__�	Exceptionrrarlr*ZLFrr(rrer2r�sys�argv�arr7r:r;r3r>ZnumMsgsZ	totalSize�range�ir@�header�msgr+rrErrrr�<module>sJ
l0


code.cpython-36.pyc000064400000023156150335715140010117 0ustar003


 \v)�@s�dZddlZddlZddlZddlmZmZddddgZGdd�d�ZGd	d�de�Z	dd
d�Z
edkr�ej�Z
e
jdd
dd�e
j�Zejs�ejjr�dZndZe
e�dS)z?Utilities needed to emulate Python's interactive interpreter.

�N)�CommandCompiler�compile_command�InteractiveInterpreter�InteractiveConsole�interactrc@sFeZdZdZddd�Zddd�Zd	d
�Zddd�Zd
d�Zdd�Z	dS)rz�Base class for InteractiveConsole.

    This class deals with parsing and interpreter state (the user's
    namespace); it doesn't deal with input buffering or prompting or
    input file naming (the filename is always passed in explicitly).

    NcCs$|dkrddd�}||_t�|_dS)aConstructor.

        The optional 'locals' argument specifies the dictionary in
        which code will be executed; it defaults to a newly created
        dictionary with key "__name__" set to "__console__" and key
        "__doc__" set to None.

        NZ__console__)�__name__�__doc__)�localsr�compile)�selfr	�r�/usr/lib64/python3.6/code.py�__init__s	
zInteractiveInterpreter.__init__�<input>�singlec
CsRy|j|||�}Wn$tttfk
r6|j|�dSX|dkrDdS|j|�dS)a�Compile and run some source in the interpreter.

        Arguments are as for compile_command().

        One several things can happen:

        1) The input is incorrect; compile_command() raised an
        exception (SyntaxError or OverflowError).  A syntax traceback
        will be printed by calling the showsyntaxerror() method.

        2) The input is incomplete, and more input is required;
        compile_command() returned None.  Nothing happens.

        3) The input is complete; compile_command() returned a code
        object.  The code is executed by calling self.runcode() (which
        also handles run-time exceptions, except for SystemExit).

        The return value is True in case 2, False in the other cases (unless
        an exception is raised).  The return value can be used to
        decide whether to use sys.ps1 or sys.ps2 to prompt the next
        line.

        FNT)r
�
OverflowError�SyntaxError�
ValueError�showsyntaxerror�runcode)r�source�filenameZsymbol�coderrr
�	runsource's

z InteractiveInterpreter.runsourcecCs>yt||j�Wn(tk
r&�Yn|j�YnXdS)a�Execute a code object.

        When an exception occurs, self.showtraceback() is called to
        display a traceback.  All exceptions are caught except
        SystemExit, which is reraised.

        A note about KeyboardInterrupt: this exception may occur
        elsewhere in this code, and may not always be caught.  The
        caller should be prepared to deal with it.

        N)�execr	�
SystemExit�
showtraceback)rrrrr
rNszInteractiveInterpreter.runcodecCs�tj�\}}}|t_|t_|t_|rp|tkrpy|j\}\}}}}	Wntk
rVYnXt|||||	f�}|t_tjtj	kr�t
j||�}
|jdj
|
��ntj|||�dS)apDisplay the syntax error that just occurred.

        This doesn't display a stack trace because there isn't one.

        If a filename is given, it is stuffed in the exception instead
        of what was there before (because Python's parser always uses
        "<string>" when reading from a string).

        The output is written by self.write(), below.

        �N)�sys�exc_info�	last_type�
last_value�last_tracebackr�argsr�
excepthook�__excepthook__�	traceback�format_exception_only�write�join)rr�type�value�tb�msgZdummy_filename�lineno�offset�line�linesrrr
rasz&InteractiveInterpreter.showsyntaxerrorcCs|tj�\t_t_}}|t_zPtj|d|d|j�}tjtj	krT|j
dj|��ntj|d|d|�Wdd}}XdS)z�Display the exception that just occurred.

        We remove the first stack item because it is our own code.

        The output is written by self.write(), below.

        r�rN)rrr r!r"r&�format_exception�tb_nextr$r%r(r))rZlast_tbZeir1rrr
r�sz$InteractiveInterpreter.showtracebackcCstjj|�dS)z�Write a string.

        The base implementation writes to sys.stderr; a subclass may
        replace this with a different implementation.

        N)r�stderrr()r�datarrr
r(�szInteractiveInterpreter.write)N)rr)N)
r�
__module__�__qualname__rrrrrrr(rrrr
rs

'
#c@s>eZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
d�ZdS)rz�Closely emulate the behavior of the interactive Python interpreter.

    This class builds on InteractiveInterpreter and adds prompting
    using the familiar sys.ps1 and sys.ps2, and input buffering.

    N�	<console>cCstj||�||_|j�dS)z�Constructor.

        The optional locals argument will be passed to the
        InteractiveInterpreter base class.

        The optional filename argument should specify the (file)name
        of the input stream; it will show up in tracebacks.

        N)rrr�resetbuffer)rr	rrrr
r�s
zInteractiveConsole.__init__cCs
g|_dS)zReset the input buffer.N)�buffer)rrrr
r:�szInteractiveConsole.resetbufferc!CsPy
tjWntk
r$dt_YnXy
tjWntk
rJdt_YnXd}|dkrx|jdtjtj||jjf�n|r�|jdt	|��d}x�yP|r�tj}ntj}y|j
|�}Wn tk
r�|jd�PYnX|j|�}Wq�t
k
�r|jd	�|j�d}Yq�Xq�W|dk�r4|jd
|jj�n|dk�rL|jd|�dS)a�Closely emulate the interactive Python console.

        The optional banner argument specifies the banner to print
        before the first interaction; by default it prints a banner
        similar to the one printed by the real Python interpreter,
        followed by the current class name in parentheses (so as not
        to confuse this with the real interpreter -- since it's so
        close!).

        The optional exitmsg argument specifies the exit message
        printed when exiting. Pass the empty string to suppress
        printing an exit message. If exitmsg is not given or None,
        a default message is printed.

        z>>> z... zFType "help", "copyright", "credits" or "license" for more information.NzPython %s on %s
%s
(%s)
z%s
r�
z
KeyboardInterrupt
znow exiting %s...
r)rZps1�AttributeErrorZps2r(�version�platform�	__class__r�str�	raw_input�EOFError�push�KeyboardInterruptr:)r�banner�exitmsgZcprt�more�promptr0rrr
r�sF






zInteractiveConsole.interactcCs6|jj|�dj|j�}|j||j�}|s2|j�|S)aPush a line to the interpreter.

        The line should not have a trailing newline; it may have
        internal newlines.  The line is appended to a buffer and the
        interpreter's runsource() method is called with the
        concatenated contents of the buffer as source.  If this
        indicates that the command was executed or invalid, the buffer
        is reset; otherwise, the command is incomplete, and the buffer
        is left as it was after the line was appended.  The return
        value is 1 if more input is required, 0 if the line was dealt
        with in some way (this is the same as runsource()).

        r<)r;�appendr)rrr:)rr0rrHrrr
rD�szInteractiveConsole.pushrcCst|�S)aDWrite a prompt and read a line.

        The returned line does not include the trailing newline.
        When the user enters the EOF key sequence, EOFError is raised.

        The base implementation uses the built-in function
        input(); a subclass may replace this with a different
        implementation.

        )�input)rrIrrr
rBszInteractiveConsole.raw_input)Nr9)NN)r)	rr7r8rrr:rrDrBrrrr
r�s

6cCsJt|�}|dk	r||_n"yddl}Wntk
r8YnX|j||�dS)a&Closely emulate the interactive Python interpreter.

    This is a backwards compatible interface to the InteractiveConsole
    class.  When readfunc is not specified, it attempts to import the
    readline module to enable GNU readline if it is available.

    Arguments (all optional, all default to None):

    banner -- passed to InteractiveConsole.interact()
    readfunc -- if not None, replaces InteractiveConsole.raw_input()
    local -- passed to InteractiveInterpreter.__init__()
    exitmsg -- passed to InteractiveConsole.interact()

    Nr)rrB�readline�ImportErrorr)rFZreadfuncZlocalrGZconsolerLrrr
rs�__main__z-q�
store_truez*don't print version and copyright messages)�action�helpr)NNNN)rrr&�argparseZcodeoprr�__all__rrrr�ArgumentParser�parser�add_argument�
parse_argsr#�q�flags�quietrFrrrr
�<module>s&t
subprocess.cpython-36.opt-1.pyc000064400000105072150335715140012332 0ustar003


 \���@s8dZddlZejdkZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZGdd�de
�ZGdd�de�ZGd	d
�d
e�Zer�ddlZddlZddlZGdd�d�ZnhddlZddlZddlZyddlZWnek
r�ddlZYnXeed
d�Zeed��rejZnejZddddddddddddd
dgZ e�r�ddlm!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(e j)ddddd d!d"d#dg	�Gd$d%�d%e*�Z+gZ,d&d'�Z-d<Z.d=Z/d>Z0d+d,�Z1d-d.�Z2dd/�d0d�Z3d1d�Z4dd/�d2d�Z5Gd3d�de6�Z7ddd4d5�d6d�Z8d7d8�Z9d9d�Z:d:d�Z;e6�Z<Gd;d�de6�Z=dS)?a�Subprocesses with accessible I/O streams

This module allows you to spawn processes, connect to their
input/output/error pipes, and obtain their return codes.

For a complete description of this module see the Python documentation.

Main API
========
run(...): Runs a command, waits for it to complete, then returns a
          CompletedProcess instance.
Popen(...): A class for flexibly executing a command in a new process

Constants
---------
DEVNULL: Special value that indicates that os.devnull should be used
PIPE:    Special value that indicates a pipe should be created
STDOUT:  Special value that indicates that stderr should go to stdout


Older API
=========
call(...): Runs a command, waits for it to complete, then returns
    the return code.
check_call(...): Same as call() but raises CalledProcessError()
    if return code is not 0
check_output(...): Same as check_call() but returns the contents of
    stdout instead of a return code
getoutput(...): Runs a command in the shell, waits for it to complete,
    then returns the output
getstatusoutput(...): Runs a command in the shell, waits for it to complete,
    then returns a (exitcode, output) tuple
�NZwin32)�	monotonicc@seZdZdS)�SubprocessErrorN)�__name__�
__module__�__qualname__�rr�"/usr/lib64/python3.6/subprocess.pyr9src@s<eZdZdZd
dd�Zdd�Zedd��Zejd	d��ZdS)�CalledProcessErrorz�Raised when run() is called with check=True and the process
    returns a non-zero exit status.

    Attributes:
      cmd, returncode, stdout, stderr, output
    NcCs||_||_||_||_dS)N)�
returncode�cmd�output�stderr)�selfr
rrr
rrr�__init__CszCalledProcessError.__init__cCsb|jrN|jdkrNyd|jtj|j�fStk
rJd|j|jfSXnd|j|jfSdS)NrzCommand '%s' died with %r.z)Command '%s' died with unknown signal %d.z.Command '%s' returned non-zero exit status %d.)r
r�signalZSignals�
ValueError)rrrr�__str__IszCalledProcessError.__str__cCs|jS)z+Alias for output attribute, to match stderr)r)rrrr�stdoutUszCalledProcessError.stdoutcCs
||_dS)N)r)r�valuerrrrZs)NN)	rrr�__doc__rr�propertyr�setterrrrrr	<s

r	c@s<eZdZdZd
dd�Zdd�Zedd��Zejd	d��ZdS)�TimeoutExpiredz�This exception is raised when the timeout expires while waiting for a
    child process.

    Attributes:
        cmd, output, stdout, stderr, timeout
    NcCs||_||_||_||_dS)N)r�timeoutrr
)rrrrr
rrrrhszTimeoutExpired.__init__cCsd|j|jfS)Nz'Command '%s' timed out after %s seconds)rr)rrrrrnszTimeoutExpired.__str__cCs|jS)N)r)rrrrrrszTimeoutExpired.stdoutcCs
||_dS)N)r)rrrrrrvs)NN)	rrrrrrrrrrrrrras

rc@s eZdZdZdZdZdZdZdS)�STARTUPINFOrN)rrr�dwFlags�	hStdInput�
hStdOutput�	hStdError�wShowWindowrrrrr�s
rZPIPE_BUFi�PollSelector�Popen�PIPE�STDOUT�call�
check_call�getstatusoutput�	getoutput�check_output�run�DEVNULL�CompletedProcess)�CREATE_NEW_CONSOLE�CREATE_NEW_PROCESS_GROUP�STD_INPUT_HANDLE�STD_OUTPUT_HANDLE�STD_ERROR_HANDLE�SW_HIDE�STARTF_USESTDHANDLES�STARTF_USESHOWWINDOWr,r-r.r/r0r1r2r3c@s6eZdZdZejfdd�Zdd�Zdd�ZeZ	eZ
dS)	�HandleFcCs|jsd|_||�dS)NT)�closed)r�CloseHandlerrr�Close�szHandle.ClosecCs |jsd|_t|�Std��dS)NTzalready closed)r5�intr)rrrr�Detach�sz
Handle.DetachcCsd|jjt|�fS)Nz%s(%d))�	__class__rr8)rrrr�__repr__�szHandle.__repr__N)rrrr5�_winapir6r7r9r;�__del__rrrrrr4�sr4cCsTxNtdd�D]>}|jtjd�}|dk	rytj|�Wqtk
rJYqXqWdS)N)�
_deadstate)�_active�_internal_poll�sys�maxsize�remover)Zinst�resrrr�_cleanup�srE���cCs*g}tjj}|dkr&|jdd|�|S)zgReturn a list of command-line arguments reproducing the current
    optimization settings in sys.flags.r�-�O)rA�flags�optimize�append)�argsrrrr�"_optim_args_from_interpreter_flags�s
rOcCsddddddd�}t�}x:|j�D].\}}ttj|�}|dkr"|jd	||�q"Wtjjrh|jd
�n$tjjrz|jd�tjjr�|jd�xtj	D]}|jd
|�q�Wttdi�}xDdD]<}||kr�||}|dkr�|}nd||f}|j
d|f�q�W|S)z}Return a list of command-line arguments reproducing the current
    settings in sys.flags, sys.warnoptions and sys._xoptions.�d�B�S�v�b�q)�debug�dont_write_bytecode�no_site�verbose�
bytes_warning�quietrrIz-Iz-Ez-sz-W�	_xoptions�faulthandler�tracemalloc�showalloccount�showrefcount�utf8Tz%s=%sz-X)r]r^r_r`ra)rO�items�getattrrArKrM�isolated�ignore_environment�no_user_site�warnoptions�extend)Zflag_opt_maprN�flag�optrSZxoptionsr�argrrr�_args_from_interpreter_flags�s:

rl)rcOsFt||��2}y|j|d�S|j�|j��YnXWdQRXdS)z�Run command with arguments.  Wait for command to complete or
    timeout, then return the returncode attribute.

    The arguments are the same as for the Popen constructor.  Example:

    retcode = call(["ls", "-l"])
    )rN)r!�wait�kill)r�	popenargs�kwargs�prrrr$scOs6t||�}|r2|jd�}|dkr(|d}t||��dS)aORun command with arguments.  Wait for command to complete.  If
    the exit code was zero then return, otherwise raise
    CalledProcessError.  The CalledProcessError object will have the
    return code in the returncode attribute.

    The arguments are the same as for the call function.  Example:

    check_call(["ls", "-l"])
    rNNr)r$�getr	)rorp�retcoderrrrr%(s



cOsTd|krtd��d|kr<|ddkr<|jdd�r4dnd|d<t|t|d	d
�|��jS)a(Run command with arguments and return its output.

    If the exit code was non-zero it raises a CalledProcessError.  The
    CalledProcessError object will have the return code in the returncode
    attribute and output in the output attribute.

    The arguments are the same as for the Popen constructor.  Example:

    >>> check_output(["ls", "-l", "/dev/null"])
    b'crw-rw-rw- 1 root root 1, 3 Oct 18  2007 /dev/null\n'

    The stdout argument is not allowed as it is used internally.
    To capture standard error in the result, use stderr=STDOUT.

    >>> check_output(["/bin/sh", "-c",
    ...               "ls -l non_existent_file ; exit 0"],
    ...              stderr=STDOUT)
    b'ls: non_existent_file: No such file or directory\n'

    There is an additional optional argument, "input", allowing you to
    pass a string to the subprocess's stdin.  If you use this argument
    you may not also use the Popen constructor's "stdin" argument, as
    it too will be used internally.  Example:

    >>> check_output(["sed", "-e", "s/foo/bar/"],
    ...              input=b"when in the course of fooman events\n")
    b'when in the course of barman events\n'

    If universal_newlines=True is passed, the "input" argument must be a
    string and the return value will be a string rather than bytes.
    rz3stdout argument not allowed, it will be overridden.�inputN�universal_newlinesF��T)rr�check)rrrr)r"r)rrorprrrr(;s c@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
r+aEA process that has finished running.

    This is returned by run().

    Attributes:
      args: The list or str args passed to run().
      returncode: The exit code of the process, negative for signals.
      stdout: The standard output (None if not captured).
      stderr: The standard error (None if not captured).
    NcCs||_||_||_||_dS)N)rNr
rr
)rrNr
rr
rrrrrszCompletedProcess.__init__cCshdj|j�dj|j�g}|jdk	r4|jdj|j��|jdk	rP|jdj|j��djt|�jdj|��S)Nz	args={!r}zreturncode={!r}zstdout={!r}zstderr={!r}z{}({})z, )	�formatrNr
rrMr
�typer�join)rrNrrrr;xs


zCompletedProcess.__repr__cCs |jrt|j|j|j|j��dS)z6Raise CalledProcessError if the exit code is non-zero.N)r
r	rNrr
)rrrr�check_returncode�sz!CompletedProcess.check_returncode)NN)rrrrrr;r|rrrrr+gs

	F)rtrrxc	Os�|dk	r d|krtd��t|d<t||���}y|j||d�\}}WnVtk
r||j�|j�\}}t|j|||d��Yn|j�|j��YnX|j�}|r�|r�t	||j||d��WdQRXt
|j|||�S)afRun command with arguments and return a CompletedProcess instance.

    The returned instance will have attributes args, returncode, stdout and
    stderr. By default, stdout and stderr are not captured, and those attributes
    will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them.

    If check is True and the exit code was non-zero, it raises a
    CalledProcessError. The CalledProcessError object will have the return code
    in the returncode attribute, and output & stderr attributes if those streams
    were captured.

    If timeout is given, and the process takes too long, a TimeoutExpired
    exception will be raised.

    There is an optional argument "input", allowing you to
    pass a string to the subprocess's stdin.  If you use this argument
    you may not also use the Popen constructor's "stdin" argument, as
    it will be used internally.

    The other arguments are the same as for the Popen constructor.

    If universal_newlines=True is passed, the "input" argument must be a
    string and stdout/stderr in the returned object will be strings rather than
    bytes.
    N�stdinz/stdin and input arguments may not both be used.)r)rr
)rr"r!�communicaterrnrNrm�pollr	r+)	rtrrxrorpZprocessrr
rsrrrr)�s*
cCs�g}d}x�|D]�}g}|r$|jd�d|kp8d|kp8|}|rH|jd�xj|D]b}|dkrf|j|�qN|dkr�|jdt|�d�g}|jd�qN|r�|j|�g}|j|�qNW|r�|j|�|r|j|�|jd�qWdj|�S)	a�
    Translate a sequence of arguments into a command line
    string, using the same rules as the MS C runtime:

    1) Arguments are delimited by white space, which is either a
       space or a tab.

    2) A string surrounded by double quotation marks is
       interpreted as a single argument, regardless of white space
       contained within.  A quoted string can be embedded in an
       argument.

    3) A double quotation mark preceded by a backslash is
       interpreted as a literal double quotation mark.

    4) Backslashes are interpreted literally, unless they
       immediately precede a double quotation mark.

    5) If backslashes immediately precede a double quotation mark,
       every pair of backslashes is interpreted as a literal
       backslash.  If the number of backslashes is odd, the last
       backslash escapes the next double quotation mark as
       described in rule 3.
    F� �	�"�\rGz\"rv)rM�lenrhr{)�seq�resultZ	needquoterkZbs_buf�crrr�list2cmdline�s4






r�cCslyt|ddtd�}d}Wn.tk
rF}z|j}|j}WYdd}~XnX|dd�dkrd|dd�}||fS)	a�Return (exitcode, output) of executing cmd in a shell.

    Execute the string 'cmd' in a shell with 'check_output' and
    return a 2-tuple (status, output). The locale encoding is used
    to decode the output and process newlines.

    A trailing newline is stripped from the output.
    The exit status for the command can be interpreted
    according to the rules for the function 'wait'. Example:

    >>> import subprocess
    >>> subprocess.getstatusoutput('ls /bin/ls')
    (0, '/bin/ls')
    >>> subprocess.getstatusoutput('cat /bin/junk')
    (1, 'cat: /bin/junk: No such file or directory')
    >>> subprocess.getstatusoutput('/bin/junk')
    (127, 'sh: /bin/junk: not found')
    >>> subprocess.getstatusoutput('/bin/kill $$')
    (-15, '')
    T)�shellrur
rNrF�
���r�)r(r#r	rr
)r�dataZexitcodeZexrrrr&scCst|�dS)a%Return output (stdout or stderr) of executing cmd in a shell.

    Like getstatusoutput(), except the exit status is ignored and the return
    value is a string containing the command's output.  Example:

    >>> import subprocess
    >>> subprocess.getoutput('ls /bin/ls')
    '/bin/ls'
    rF)r&)rrrrr'"s
c@s�eZdZdZdZd?dddddeddddddddffddd�dd	�Zd
d�Zdd
�Zdd�Z	e
jej
fdd�Zdd�Zdd�Zd@dd�Zdd�Zdd�Zdd�Ze�rdd�Zd d!�Zd"d#�Zdejejejfd$d%�ZdAd&d'�Zd(d)�Zd*d+�Z d,d-�Z!d.d/�Z"e"Z#n�d0d�Zd1d#�Ze$j%e$j&e$j'e$j(e$j)e$j*fd2d3�Z+de$j,e$j-e.j/fd4d%�Zd5d6�Z0dBd7d'�Zd8d+�Z d9d:�Z1d;d-�Z!d<d/�Z"d=d>�Z#dS)Cr!a� Execute a child program in a new process.

    For a complete description of the arguments see the Python documentation.

    Arguments:
      args: A string, or a sequence of program arguments.

      bufsize: supplied as the buffering argument to the open() function when
          creating the stdin/stdout/stderr pipe file objects

      executable: A replacement program to execute.

      stdin, stdout and stderr: These specify the executed programs' standard
          input, standard output and standard error file handles, respectively.

      preexec_fn: (POSIX only) An object to be called in the child process
          just before the child is executed.

      close_fds: Controls closing or inheriting of file descriptors.

      shell: If true, the command will be executed through the shell.

      cwd: Sets the current directory before the child is executed.

      env: Defines the environment variables for the new process.

      universal_newlines: If true, use universal line endings for file
          objects stdin, stdout and stderr.

      startupinfo and creationflags (Windows only)

      restore_signals (POSIX only)

      start_new_session (POSIX only)

      pass_fds (POSIX only)

      encoding and errors: Text mode encoding and error handling to use for
          file objects stdin, stdout and stderr.

    Attributes:
        stdin, stdout, stderr, pid, returncode
    FrFNrT)�encoding�errorscCsrt�tj�|_d|_d|_|dkr(d}t|t�s:td��t	r�|dk	rNt
d��|dk	pd|dk	pd|dk	}|tkr~|rxd}q�d}q�|r�|r�t
d��nF|tkr�d}|r�|r�tj
dt�d}|
dk	r�t
d	��|d
kr�t
d��||_d|_d|_d|_d|_d|_||_||_||_|j|||�\}}}}}}t	�rz|dk�rFtj|j�d
�}|dk�r`tj|j�d
�}|dk�rztj|j�d
�}|�p�|�p�|}d|_y�|dk�r�tj|d|�|_|�r�tj|jd|dk||d
�|_|dk�rtj|d|�|_|�rtj|j||d�|_|dk�r6tj|d|�|_|�r6tj|j||d�|_|j ||||||
||
||	||||||||�W�nxDt!d|j|j|jf�D]*}y|j"�Wnt#k
�r�YnX�q�W|j�sfg}|t$k�r�|j%|�|t$k�r�|j%|�|t$k�r�|j%|�t&|d��r|j%|j'�xP|D]H}y*t	�r<t|t(��r<|j)�n
t*j"|�Wnt#k
�r^YnX�qW�YnXdS)zCreate new Popen instance.NFrFzbufsize must be an integerz0preexec_fn is not supported on Windows platformsTzSclose_fds is not supported on Windows platforms if you redirect stdin/stdout/stderrzpass_fds overriding close_fds.z2startupinfo is only supported on Windows platformsrz4creationflags is only supported on Windows platforms�wb)�
write_through�line_bufferingr�r��rb)r�r��_devnullr�r�r�r�r�r�r�)+rE�	threadingZLock�
_waitpid_lock�_input�_communication_started�
isinstancer8�	TypeError�
_mswindowsr�_PLATFORM_DEFAULT_CLOSE_FDS�warnings�warn�RuntimeWarningrNr}rr
�pidr
rur�r��_get_handles�msvcrtZopen_osfhandler9�_closed_child_pipe_fds�io�open�
TextIOWrapper�_execute_child�filter�close�OSErrorr"rM�hasattrr�r4r7�os)rrN�bufsize�
executabler}rr
�
preexec_fn�	close_fdsr��cwd�envru�startupinfo�
creationflags�restore_signals�start_new_session�pass_fdsr�r�Z
any_stdio_set�p2cread�p2cwrite�c2pread�c2pwrite�errread�errwriteZ	text_mode�fZto_close�fdrrrr`s�

















zPopen.__init__cCs |j||�}|jdd�jdd�S)Nz
r��
)�decode�replace)rr�r�r�rrr�_translate_newlines�szPopen._translate_newlinescCs|S)Nr)rrrr�	__enter__�szPopen.__enter__c
CsD|jr|jj�|jr |jj�z|jr2|jj�Wd|j�XdS)N)rr�r
r}rm)rrzr�	tracebackrrr�__exit__�s

zPopen.__exit__cCsT|js
dS|jdkr(|d|jt|d�|j|d�|jdkrPtdk	rPtj|�dS)Nzsubprocess %s is still running)�source)r>)�_child_createdr
r��ResourceWarningr@r?rM)rZ_maxsizeZ_warnrrrr=
s


z
Popen.__del__cCs"t|d�stjtjtj�|_|jS)Nr�)r�r�r��devnull�O_RDWRr�)rrrr�_get_devnulls
zPopen._get_devnullcCs�|rZy|jj|�WnDtk
r(Yn2tk
rX}z|jtjkrFn�WYdd}~XnXy|jj�WnDtk
r|Yn2tk
r�}z|jtjkr�n�WYdd}~XnXdS)N)r}�write�BrokenPipeErrorr��errnoZEINVALr�)rrt�excrrr�_stdin_writes"zPopen._stdin_writecCs�|jr|rtd��|dkr�|jr�|j|j|jgjd�dkr�d}d}|jrV|j|�n6|jrr|jj�}|jj�n|jr�|jj�}|jj�|j	�nJ|dk	r�t
�|}nd}z|j|||�\}}Wdd|_X|j	|j|�d�}||fS)a4Interact with process: Send data to stdin.  Read data from
        stdout and stderr, until end-of-file is reached.  Wait for
        process to terminate.

        The optional "input" argument should be data to be sent to the
        child process (if self.universal_newlines is True, this should
        be a string; if it is False, "input" should be bytes), or
        None, if no data should be sent to the child.

        communicate() returns a tuple (stdout, stderr).  These will be
        bytes or, if self.universal_newlines was True, a string.
        z.Cannot send input after starting communicationNrGT)r)
r�rr}rr
�countr��readr�rm�_time�_communicate�_remaining_time)rrtrrr
�endtime�stsrrrr~7s.




zPopen.communicatecCs|j�S)zSCheck if child process has terminated. Set and return returncode
        attribute.)r@)rrrrrhsz
Popen.pollcCs|dkrdS|t�SdS)z5Convenience for _communicate when computing timeouts.N)r�)rr�rrrr�nszPopen._remaining_timecCs&|dkrdSt�|kr"t|j|��dS)z2Convenience for checking if a timeout has expired.N)r�rrN)rr��orig_timeoutrrr�_check_timeoutvs
zPopen._check_timeoutcCs�|dkr|dkr|dkrd
Sd
\}}d\}}d\}}	|dkrttjtj�}|dkrrtjdd�\}}
t|�}tj|
�nj|tkr�tjdd�\}}t|�t|�}}n>|tkr�tj	|j
��}n&t|t��r�tj	|�}ntj	|j
��}|j|�}|dk�r,tjtj�}|dk�r�tjdd�\}
}t|�}tj|
�nn|tk�rZtjdd�\}}t|�t|�}}n@|tk�rttj	|j
��}n&t|t��r�tj	|�}ntj	|j
��}|j|�}|dk�r�tjtj�}	|	dk�rftjdd�\}
}	t|	�}	tj|
�n~|tk�rtjdd�\}}	t|�t|	�}}	nP|tk�r&|}	n@|tk�r@tj	|j
��}	n&t|t��rXtj	|�}	ntj	|j
��}	|j|	�}	||||||	fS)z|Construct and return tuple with IO objects:
            p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
            NrFrr�r�r�r�r�r�)r�r�r�r�r�r�r�r�)r�r�r�r�)r�r�r�r�)r�r�)r<ZGetStdHandler.Z
CreatePiper4r6r"r*r�Z
get_osfhandler�r�r8�fileno�_make_inheritabler/r0r#)rr}rr
r�r�r�r�r�r��_rrrr��sn











zPopen._get_handlescCs&tjtj�|tj�ddtj�}t|�S)z2Return a duplicate of handle, which is inheritablerrF)r<ZDuplicateHandleZGetCurrentProcessZDUPLICATE_SAME_ACCESSr4)rZhandle�hrrrr��s

zPopen._make_inheritablecCs<t|t�st|�}|dkr t�}d|||fkrP|jtjO_||_||_||_	|
r�|jtj
O_tj|_t
jjdd�}dj||�}z>tj||ddt|�|	||dk	r�t
j|�nd|�	\}}}}Wd|d	kr�|j�|d
kr�|j�|dk�r�|j�t|d��rt
j|j�d|_Xd|_t|�|_||_tj|�dS)z$Execute program (MS Windows version)NrFZCOMSPECzcmd.exez
{} /c "{}"r�Tr�r�r�r�)r��strr�rrr<r2rrrr3r1rr��environrrryZ
CreateProcessr8�fspathr7r�r�r�r�r�r4�_handler�r6)rrNr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Zunused_restore_signalsZunused_start_new_sessionZcomspecZhpZhtr��tidrrrr��sF


zPopen._execute_childcCs,|jdkr&||jd�|kr&||j�|_|jS)z�Check if child process has terminated.  Returns returncode
            attribute.

            This method is called by __del__, so it can only refer to objects
            in its local scope.

            Nr)r
r�)rr>Z_WaitForSingleObjectZ_WAIT_OBJECT_0Z_GetExitCodeProcessrrrr@s
zPopen._internal_pollcCs�|dk	r"tjdtdd�|j|�}|dkr2tj}nt|d�}|jdkrztj|j	|�}|tj
krlt|j|��tj
|j	�|_|jS)zOWait for child process to terminate.  Returns returncode
            attribute.Nz0'endtime' argument is deprecated; use 'timeout'.rG)�
stackleveli�)r�r��DeprecationWarningr�r<ZINFINITEr8r
�WaitForSingleObjectr�ZWAIT_TIMEOUTrrN�GetExitCodeProcess)rrr�Ztimeout_millisr�rrrrm$s 


z
Popen.waitcCs|j|j��|j�dS)N)rMr�r�)rZfh�bufferrrr�
_readerthread:szPopen._readerthreadcCs`|jrDt|d�rDg|_tj|j|j|jfd�|_d|j_|jj�|j	r�t|d�r�g|_
tj|j|j	|j
fd�|_d|j_|jj�|jr�|j
|�|jdk	r�|jj|j|��|jj�r�t|j|��|j	dk	r�|jj|j|��|jj�r�t|j|��d}d}|j�r|j}|jj�|j	�r4|j
}|j	j�|dk	�rF|d}|dk	�rX|d}||fS)N�_stdout_buff)�targetrNT�_stderr_buffr)rr�r�r�ZThreadr�Z
stdout_threadZdaemon�startr
r�Z
stderr_threadr}r�r{r�Zis_aliverrNr�)rrtr�r�rr
rrrr�?sF










zPopen._communicatecCsl|jdk	rdS|tjkr"|j�nF|tjkr>tj|jtj�n*|tjkrZtj|jtj�nt	dj
|���dS)zSend a signal to the process.NzUnsupported signal: {})r
r�SIGTERM�	terminateZCTRL_C_EVENTr�rnr�ZCTRL_BREAK_EVENTrry)r�sigrrr�send_signalss




zPopen.send_signalcCsX|jdk	rdSytj|jd�Wn2tk
rRtj|j�}|tjkrH�||_YnXdS)zTerminates the process.NrF)r
r<ZTerminateProcessr��PermissionErrorr�ZSTILL_ACTIVE)rZrcrrrr��s

zPopen.terminatec
Cs.d\}}d\}}d\}}	|dkr"n@|tkr8tj�\}}n*|tkrJ|j�}nt|t�rZ|}n|j�}|dkrln@|tkr�tj�\}}n*|tkr�|j�}nt|t�r�|}n|j�}|dkr�nh|tkr�tj�\}}	nR|tk�r�|dkr�|}	n
t	j
j�}	n.|tk�r|j�}	nt|t��r|}	n|j�}	||||||	fS)
z|Construct and return tuple with IO objects:
            p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
            rFNr�r�)r�r�r�r�)r�r�r�r�)r�r�r�)r"r��piper*r�r�r8r�r#rA�
__stdout__)
rr}rr
r�r�r�r�r�r�rrrr��sJ






c)"s�t|ttf�r|g}nt|�}|
r:ddg|}�r:�|d<�dkrJ|d��}tj�\}}g}x |dkr~|j|�tj|�}q`Wx|D]}tj|�q�W�z�z�|dk	r�g}xL|j	�D]:\}}tj
|�}d|kr�td��|j|dtj
|��q�Wnd}tj
���tjj
���r�f}nt�fdd	�tj|�D��}t|�}|j|�tj|||tttt|���|||||
||||||||�|_d
|_Wdtj|�Xt|dd�}|dk�r�|dk�r�||k�r�tj|�|dk�r�|
dk�r�||k�r�tj|�|dk�r|dk�r||k�rtj|�|dk	�r.tj|�d
|_t�}x2tj|d
�}||7}|�sft|�d
k�r<P�q<WWdtj|�X|�r�y6tj|jd�\} }!| |jk�r�|j|!�nt j!|_"Wnt#k
�r�YnXy|j$dd�\}"}#}$|$j%�}$Wn,tk
�rd}"d}#dj&t|��}$YnXtt'|"j%d�t(�}%t)|%t*��r�|#�r�t|#d�}&|$dk}'|'�rdd}$|}(n|}(|&dk�r�tj+|&�}$|&t,j-k�r�|$dt.|(�7}$|%|&|$|(��|%|$��dS)zExecute program (POSIX version)z/bin/shz-crNrH�=z!illegal environment variable namec3s"|]}tjjtj|���VqdS)N)r��pathr{�fsencode)�.0�dir)r�rr�	<genexpr>sz'Popen._execute_child.<locals>.<genexpr>Tr�rFiP��:rGsSubprocessError�0z#Bad exception data from child: {!r}�ascii�Znoexecrvz: r�r�r�r�r�r�)/r�r��bytes�listr�r�rM�dupr�rbr�rr��dirname�tuple�
get_exec_path�set�add�_posixsubprocessZ	fork_exec�sorted�mapr8r�r�rcr��	bytearrayr�r��waitpid�_handle_exitstatusrArBr
�ChildProcessError�splitr�ry�builtinsr�
issubclassr��strerrorr��ENOENT�repr))rrNr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Zorig_executableZerrpipe_readZ
errpipe_writeZlow_fds_to_closeZlow_fdZenv_list�krSZexecutable_listZfds_to_keepZ
devnull_fdZerrpipe_data�partr�r�Zexception_nameZ	hex_errnoZerr_msgZchild_exception_typeZ	errno_numZchild_exec_never_calledZerr_filenamer)r�rr��s�	
















cCsL||�r||�|_n2||�r*||�|_n||�r@||�|_ntd��dS)z:All callers to this function MUST hold self._waitpid_lock.zUnknown child exit status!N)r
r)rr�Z_WIFSIGNALEDZ	_WTERMSIGZ
_WIFEXITEDZ_WEXITSTATUSZ_WIFSTOPPEDZ	_WSTOPSIGrrrrXszPopen._handle_exitstatuscCs�|jdkr�|jjd�sdSz�y8|jdk	r.|jS||j|�\}}||jkrR|j|�WnBtk
r�}z&|dk	rv||_n|j|kr�d|_WYdd}~XnXWd|jj�X|jS)z�Check if child process has terminated.  Returns returncode
            attribute.

            This method is called by __del__, so it cannot reference anything
            outside of the local scope (nor can any methods it calls).

            NFr)r
r��acquirer�rr�r��release)rr>Z_waitpidZ_WNOHANGZ_ECHILDr�r��errrr@js 	



cCs>ytj|j|�\}}Wntk
r4|j}d}YnX||fS)z:All callers to this function MUST hold self._waitpid_lock.r)r�r
r�r)rZ
wait_flagsr�r�rrr�	_try_wait�s
zPopen._try_waitcCsV|jdk	r|jS|dk	r(tjdtdd�|dk	s8|dk	r^|dkrLt�|}n|dkr^|j|�}|dk	r�d}x�|jjd�r�z6|jdk	r�P|jt	j
�\}}||jkr�|j|�PWd|jj
�X|j|�}|dkr�t|j|��t|d|d�}tj|�qlWnVxT|jdk�rN|j�8|jdk	�rP|jd�\}}||jk�rB|j|�WdQRXq�W|jS)	zOWait for child process to terminate.  Returns returncode
            attribute.Nz0'endtime' argument is deprecated; use 'timeout'.rG)r�g����Mb@?Frg�������?)r
r�r�r�r�r�r�rrr��WNOHANGr�rrrrN�min�timeZsleep)rrr�Zdelayr�r�Z	remainingrrrrm�sJ





c#Cs|jrZ|jrZy|jj�Wntk
r0YnX|sZy|jj�Wntk
rXYnXd}d}|js�i|_|jr�g|j|j<|jr�g|j|j<|jr�|j|j}|jr�|j|j}|j|�|j	r�t
|j	�}t����}|jr�|r�|j|jt
j�|j�r|j|jt
j�|j�r$|j|jt
j��xJ|j��rp|j|�}|dk	�r\|dk�r\t|j|��|j|�}	|j||�x�|	D]�\}
}|
j|jk�r||j|jt�}y|jtj|
j|�7_Wn,tk
�r�|j|
j�|
jj�Yn*X|jt|j	�k�rf|j|
j�|
jj�nP|
j|j|jfk�rxtj|
jd�}
|
�sT|j|
j�|
jj�|j|
jj|
��qxW�q(WWdQRX|j |j|�d�|dk	�r�dj!|�}|dk	�r�dj!|�}|j"�s�|j#�s�|j$�r|dk	�r�|j%||jj"|jj#�}|dk	�r|j%||jj"|jj#�}||fS)Nri�)rrw)&r}r��flushr�r�Z_fileobj2outputrr
�_save_inputr��
memoryview�_PopenSelector�register�	selectorsZEVENT_WRITEZ
EVENT_READZget_mapr�rrN�selectr�Zfileobj�
_input_offset�	_PIPE_BUFr�r�r�Z
unregisterr�r�rMrmr{r�r�rur�)rrtr�r�rr
Z
input_viewZselectorrZready�keyZevents�chunkr�rrrr��s�






(







cCsR|jrN|jdkrNd|_||_|dk	rN|js6|js6|jrN|jj|jj|jj�|_dS)Nr)r}r�r#r�r�ru�encode)rrtrrrr/szPopen._save_inputcCs|jdkrtj|j|�dS)zSend a signal to the process.N)r
r�rnr�)rr�rrrr�<s
cCs|jtj�dS)z/Terminate the process with SIGTERM
            N)r�rr�)rrrrr�BscCs|jtj�dS)z*Kill the process with SIGKILL
            N)r�r�SIGKILL)rrrrrnGsz
Popen.killr�)NN)NN)NN)2rrrrr�r�rr�r�r�rArBr�r�r=r�r�r~rr�r�r�r�r�r�r<r�Z
WAIT_OBJECT_0r�r@rmr�r�r�r�rnr��WIFSIGNALED�WTERMSIG�	WIFEXITED�WEXITSTATUS�
WIFSTOPPED�WSTOPSIGrr
rr�ZECHILDrrrrrrr!2sd+
1H	@
46
"
4a
r�������)>rrA�platformr�r�r�rrrr�r�rr��	Exceptionrr	rr�r�r<rrr"r!�ImportErrorZdummy_threadingrcr$r�r rZSelectSelector�__all__r,r-r.r/r0r1r2r3rhr8r4r?rEr"r#r*rOrlr$r%r(�objectr+r)r�r&r'r�r!rrrr�<module>*sr
%

(
.,!2I
numbers.cpython-36.opt-1.pyc000064400000027560150335715140011622 0ustar003


 \(�@s�dZddlmZmZdddddgZGdd�ded	�ZGd
d�de�Zeje�Gdd�de�Z	e	je
�Gdd�de	�ZGd
d�de�Zeje
�dS)z~Abstract Base Classes (ABCs) for numbers, according to PEP 3141.

TODO: Fill out more detailed documentation on the operators.�)�ABCMeta�abstractmethod�Number�Complex�Real�Rational�Integralc@seZdZdZfZdZdS)rz�All numbers inherit from this class.

    If you just want to check if an argument x is a number, without
    caring what kind, use isinstance(x, Number).
    N)�__name__�
__module__�__qualname__�__doc__�	__slots__�__hash__�rr�/usr/lib64/python3.6/numbers.pyrs)�	metaclassc@s�eZdZdZfZedd��Zdd�Zeedd���Z	eedd	���Z
ed
d��Zedd
��Zedd��Z
edd��Zdd�Zdd�Zedd��Zedd��Zedd��Zedd��Zedd��Zed d!��Zed"d#��Zed$d%��Zed&d'��Zd(S))raaComplex defines the operations that work on the builtin complex type.

    In short, those are: a conversion to complex, .real, .imag, +, -,
    *, /, abs(), .conjugate, ==, and !=.

    If it is given heterogenous arguments, and doesn't have special
    knowledge about them, it should fall back to the builtin complex
    type as described below.
    cCsdS)z<Return a builtin complex instance. Called for complex(self).Nr)�selfrrr�__complex__-szComplex.__complex__cCs|dkS)z)True if self != 0. Called for bool(self).rr)rrrr�__bool__1szComplex.__bool__cCst�dS)zXRetrieve the real component of this number.

        This should subclass Real.
        N)�NotImplementedError)rrrr�real5szComplex.realcCst�dS)z]Retrieve the imaginary component of this number.

        This should subclass Real.
        N)r)rrrr�imag>szComplex.imagcCst�dS)zself + otherN)r)r�otherrrr�__add__GszComplex.__add__cCst�dS)zother + selfN)r)rrrrr�__radd__LszComplex.__radd__cCst�dS)z-selfN)r)rrrr�__neg__QszComplex.__neg__cCst�dS)z+selfN)r)rrrr�__pos__VszComplex.__pos__cCs
||S)zself - otherr)rrrrr�__sub__[szComplex.__sub__cCs
||S)zother - selfr)rrrrr�__rsub___szComplex.__rsub__cCst�dS)zself * otherN)r)rrrrr�__mul__cszComplex.__mul__cCst�dS)zother * selfN)r)rrrrr�__rmul__hszComplex.__rmul__cCst�dS)z5self / other: Should promote to float when necessary.N)r)rrrrr�__truediv__mszComplex.__truediv__cCst�dS)zother / selfN)r)rrrrr�__rtruediv__rszComplex.__rtruediv__cCst�dS)zBself**exponent; should promote to float or complex when necessary.N)r)r�exponentrrr�__pow__wszComplex.__pow__cCst�dS)zbase ** selfN)r)r�baserrr�__rpow__|szComplex.__rpow__cCst�dS)z7Returns the Real distance from 0. Called for abs(self).N)r)rrrr�__abs__�szComplex.__abs__cCst�dS)z$(x+y*i).conjugate() returns (x-y*i).N)r)rrrr�	conjugate�szComplex.conjugatecCst�dS)z
self == otherN)r)rrrrr�__eq__�szComplex.__eq__N)r	r
rrr
rrr�propertyrrrrrrrrrr r!r"r$r&r'r(r)rrrrr s.	c@s�eZdZdZfZedd��Zedd��Zedd��Zedd	��Z	ed%dd��Z
d
d�Zdd�Zedd��Z
edd��Zedd��Zedd��Zedd��Zedd��Zdd�Zedd ��Zed!d"��Zd#d$�Zd
S)&rz�To Complex, Real adds the operations that work on real numbers.

    In short, those are: a conversion to float, trunc(), divmod,
    %, <, <=, >, and >=.

    Real also provides defaults for the derived operations.
    cCst�dS)zTAny Real can be converted to a native float object.

        Called for float(self).N)r)rrrr�	__float__�szReal.__float__cCst�dS)aGtrunc(self): Truncates self to an Integral.

        Returns an Integral i such that:
          * i>0 iff self>0;
          * abs(i) <= abs(self);
          * for any Integral j satisfying the first two conditions,
            abs(i) >= abs(j) [i.e. i has "maximal" abs among those].
        i.e. "truncate towards 0".
        N)r)rrrr�	__trunc__�szReal.__trunc__cCst�dS)z$Finds the greatest Integral <= self.N)r)rrrr�	__floor__�szReal.__floor__cCst�dS)z!Finds the least Integral >= self.N)r)rrrr�__ceil__�sz
Real.__ceil__NcCst�dS)z�Rounds self to ndigits decimal places, defaulting to 0.

        If ndigits is omitted or None, returns an Integral, otherwise
        returns a Real. Rounds half toward even.
        N)r)rZndigitsrrr�	__round__�szReal.__round__cCs||||fS)z�divmod(self, other): The pair (self // other, self % other).

        Sometimes this can be computed faster than the pair of
        operations.
        r)rrrrr�
__divmod__�szReal.__divmod__cCs||||fS)z�divmod(other, self): The pair (self // other, self % other).

        Sometimes this can be computed faster than the pair of
        operations.
        r)rrrrr�__rdivmod__�szReal.__rdivmod__cCst�dS)z)self // other: The floor() of self/other.N)r)rrrrr�__floordiv__�szReal.__floordiv__cCst�dS)z)other // self: The floor() of other/self.N)r)rrrrr�
__rfloordiv__�szReal.__rfloordiv__cCst�dS)zself % otherN)r)rrrrr�__mod__�szReal.__mod__cCst�dS)zother % selfN)r)rrrrr�__rmod__�sz
Real.__rmod__cCst�dS)zRself < other

        < on Reals defines a total ordering, except perhaps for NaN.N)r)rrrrr�__lt__�szReal.__lt__cCst�dS)z
self <= otherN)r)rrrrr�__le__�szReal.__le__cCstt|��S)z(complex(self) == complex(float(self), 0))�complex�float)rrrrr�szReal.__complex__cCs|
S)z&Real numbers are their real component.r)rrrrr�sz	Real.realcCsdS)z)Real numbers have no imaginary component.rr)rrrrr�sz	Real.imagcCs|
S)zConjugate is a no-op for Reals.r)rrrrr(szReal.conjugate)N)r	r
rrr
rr+r,r-r.r/r0r1r2r3r4r5r6r7rr*rrr(rrrrr�s(
c@s<eZdZdZfZeedd���Zeedd���Zdd�Z	dS)	rz6.numerator and .denominator should be in lowest terms.cCst�dS)N)r)rrrr�	numeratorszRational.numeratorcCst�dS)N)r)rrrr�denominatorszRational.denominatorcCs|j|jS)afloat(self) = self.numerator / self.denominator

        It's important that this conversion use the integer's "true"
        division rather than casting one side to float before dividing
        so that ratios of huge integers convert without overflowing.

        )r:r;)rrrrr+szRational.__float__N)
r	r
rrr
r*rr:r;r+rrrrrsc@s�eZdZdZfZedd��Zdd�Zed%dd��Zed	d
��Z	edd��Z
ed
d��Zedd��Zedd��Z
edd��Zedd��Zedd��Zedd��Zedd��Zedd��Zdd �Zed!d"��Zed#d$��ZdS)&rz@Integral adds a conversion to int and the bit-string operations.cCst�dS)z	int(self)N)r)rrrr�__int__+szIntegral.__int__cCst|�S)z6Called whenever an index is needed, such as in slicing)�int)rrrr�	__index__0szIntegral.__index__NcCst�dS)a4self ** exponent % modulus, but maybe faster.

        Accept the modulus argument if you want to support the
        3-argument version of pow(). Raise a TypeError if exponent < 0
        or any argument isn't Integral. Otherwise, just implement the
        2-argument version described in Complex.
        N)r)rr#�modulusrrrr$4s	zIntegral.__pow__cCst�dS)z
self << otherN)r)rrrrr�
__lshift__?szIntegral.__lshift__cCst�dS)z
other << selfN)r)rrrrr�__rlshift__DszIntegral.__rlshift__cCst�dS)z
self >> otherN)r)rrrrr�
__rshift__IszIntegral.__rshift__cCst�dS)z
other >> selfN)r)rrrrr�__rrshift__NszIntegral.__rrshift__cCst�dS)zself & otherN)r)rrrrr�__and__SszIntegral.__and__cCst�dS)zother & selfN)r)rrrrr�__rand__XszIntegral.__rand__cCst�dS)zself ^ otherN)r)rrrrr�__xor__]szIntegral.__xor__cCst�dS)zother ^ selfN)r)rrrrr�__rxor__bszIntegral.__rxor__cCst�dS)zself | otherN)r)rrrrr�__or__gszIntegral.__or__cCst�dS)zother | selfN)r)rrrrr�__ror__lszIntegral.__ror__cCst�dS)z~selfN)r)rrrr�
__invert__qszIntegral.__invert__cCstt|��S)zfloat(self) == float(int(self)))r9r=)rrrrr+wszIntegral.__float__cCs|
S)z"Integers are their own numerators.r)rrrrr:{szIntegral.numeratorcCsdS)z!Integers have a denominator of 1.�r)rrrrr;�szIntegral.denominator)N)r	r
rrr
rr<r>r$r@rArBrCrDrErFrGrHrIrJr+r*r:r;rrrrr&s(
N)r�abcrr�__all__rr�registerr8rr9rrr=rrrr�<module>sp
u
_bz2.cpython-36.pyc000064400000026024150335715140007677 0ustar003


 \�0�
@s�dZddddddgZdZdd	lmZdd
lZdd
lZdd
lZdd
l	Z	yddl
mZWn ek
rtddl
mZYnXddlmZmZdZd
ZdZGdd�de	j�Zddd�Zddd�Zdd�Zd
S)z�Interface to the libbzip2 compression library.

This module provides a file interface, classes for incremental
(de)compression, and functions for one-shot (de)compression.
�BZ2File�
BZ2Compressor�BZ2Decompressor�open�compress�
decompressz%Nadeem Vawda <nadeem.vawda@gmail.com>�)rN)�RLock)rr��c@s�eZdZdZd)dd�Zdd�Zed	d
��Zdd�Zd
d�Z	dd�Z
dd�Zd*dd�Zd,dd�Z
d.dd�Zdd�Zd0dd�Zd2dd �Zd!d"�Zd#d$�Zejfd%d&�Zd'd(�ZdS)3ra@A file object providing transparent bzip2 (de)compression.

    A BZ2File can act as a wrapper for an existing file object, or refer
    directly to a named file on disk.

    Note that BZ2File provides a *binary* file interface - data read is
    returned as bytes, and data to be written should be given as bytes.
    �rN�	cCsTt�|_d|_d|_t|_|dk	r.tjdt�d|ko@dknsNt	d��|dkr`d	}t
}nb|dkr|d}t}t|�|_
nF|dkr�d
}t}t|�|_
n*|dkr�d}t}t|�|_
nt	d|f��t|tttjf��r�t||�|_d|_||_n.t|d��st|d��r||_||_ntd��|jt
k�rJtj|jttd�}tj|�|_nd|_dS)a>Open a bzip2-compressed file.

        If filename is a str, bytes, or PathLike object, it gives the
        name of the file to be opened. Otherwise, it should be a file
        object, which will be used to read or write the compressed data.

        mode can be 'r' for reading (default), 'w' for (over)writing,
        'x' for creating exclusively, or 'a' for appending. These can
        equivalently be given as 'rb', 'wb', 'xb', and 'ab'.

        buffering is ignored. Its use is deprecated.

        If mode is 'w', 'x' or 'a', compresslevel can be a number between 1
        and 9 specifying the level of compression: 1 produces the least
        compression, and 9 (default) produces the most compression.

        If mode is 'r', the input file may be the concatenation of
        multiple compressed streams.
        NFz)Use of 'buffering' argument is deprecatedr	rz%compresslevel must be between 1 and 9�r�rb�w�wb�x�xb�a�abzInvalid mode: %rT�read�writez6filename must be a str, bytes, file or PathLike object)Ztrailing_errorr)r
rr)rr)rr)rr)r�_lock�_fp�_closefp�_MODE_CLOSED�_mode�warnings�warn�DeprecationWarning�
ValueError�
_MODE_READ�_MODE_WRITEr�_compressor�
isinstance�str�bytes�os�PathLike�
_builtin_open�hasattr�	TypeError�_compressionZDecompressReaderr�OSError�io�BufferedReader�_buffer�_pos)�self�filename�mode�	buffering�
compresslevelZ	mode_code�raw�r7�/usr/lib64/python3.6/bz2.py�__init__+sL
zBZ2File.__init__cCs�|j��|jtkrdSz<|jtkr.|jj�n"|jtkrP|jj|j	j
��d|_	Wdz|jrf|jj�Wdd|_d|_t|_d|_XXWdQRXdS)z�Flush and close the file.

        May be called more than once without error. Once the file is
        closed, any other operation on it will raise a ValueError.
        NF)rrrr r/�closer!rrr"�flushr)r1r7r7r8r:ps 



z
BZ2File.closecCs
|jtkS)zTrue if this file is closed.)rr)r1r7r7r8�closed�szBZ2File.closedcCs|j�|jj�S)z3Return the file descriptor for the underlying file.)�_check_not_closedr�fileno)r1r7r7r8r>�szBZ2File.filenocCs|j�o|jj�S)z)Return whether the file supports seeking.)�readabler/�seekable)r1r7r7r8r@�szBZ2File.seekablecCs|j�|jtkS)z/Return whether the file was opened for reading.)r=rr )r1r7r7r8r?�szBZ2File.readablecCs|j�|jtkS)z/Return whether the file was opened for writing.)r=rr!)r1r7r7r8�writable�szBZ2File.writablerc	Cs&|j�|j�|jj|�SQRXdS)z�Return buffered data without advancing the file position.

        Always returns at least one byte of data, unless at EOF.
        The exact number of bytes returned is unspecified.
        N)r�_check_can_readr/�peek)r1�nr7r7r8rC�szBZ2File.peekr	c	Cs&|j�|j�|jj|�SQRXdS)z�Read up to size uncompressed bytes from the file.

        If size is negative or omitted, read until EOF is reached.
        Returns b'' if the file is already at EOF.
        N)rrBr/r)r1�sizer7r7r8r�szBZ2File.readc	Cs4|j�$|j�|dkrtj}|jj|�SQRXdS)z�Read up to size uncompressed bytes, while trying to avoid
        making multiple reads from the underlying stream. Reads up to a
        buffer's worth of data if size is negative.

        Returns b'' if the file is at EOF.
        rN)rrBr-�DEFAULT_BUFFER_SIZEr/�read1)r1rEr7r7r8rG�s
z
BZ2File.read1c	Cs&|j�|j�|jj|�SQRXdS)zRRead bytes into b.

        Returns the number of bytes read (0 for EOF).
        N)rrBr/�readinto)r1�br7r7r8rH�szBZ2File.readintoc	CsJt|t�s$t|d�std��|j�}|j�|j�|jj|�SQRXdS)a
Read a line of uncompressed bytes from the file.

        The terminating newline (if present) is retained. If size is
        non-negative, no more than size bytes will be read (in which
        case the line may be incomplete). Returns b'' if already at EOF.
        �	__index__zInteger argument expectedN)	r#�intr)r*rJrrBr/�readline)r1rEr7r7r8rL�s

zBZ2File.readlinec	CsJt|t�s$t|d�std��|j�}|j�|j�|jj|�SQRXdS)z�Read a list of lines of uncompressed bytes from the file.

        size can be specified to control the number of lines read: no
        further lines will be read once the total size of the lines read
        so far equals or exceeds size.
        rJzInteger argument expectedN)	r#rKr)r*rJrrBr/�	readlines)r1rEr7r7r8rM�s

zBZ2File.readlinescCsL|j�<|j�|jj|�}|jj|�|jt|�7_t|�SQRXdS)z�Write a byte string to the file.

        Returns the number of uncompressed bytes written, which is
        always len(data). Note that due to buffering, the file on disk
        may not reflect the data written until close() is called.
        N)rZ_check_can_writer"rrrr0�len)r1�dataZ
compressedr7r7r8r�sz
BZ2File.writec
Cs |j�tjj||�SQRXdS)z�Write a sequence of byte strings to the file.

        Returns the number of uncompressed bytes written.
        seq can be any iterable yielding byte strings.

        Line separators are not added between the written byte strings.
        N)rr+�
BaseStream�
writelines)r1�seqr7r7r8rQ�szBZ2File.writelinesc
Cs(|j�|j�|jj||�SQRXdS)a�Change the file position.

        The new position is specified by offset, relative to the
        position indicated by whence. Values for whence are:

            0: start of stream (default); offset must not be negative
            1: current stream position
            2: end of stream; offset must not be positive

        Returns the new file position.

        Note that seeking is emulated, so depending on the parameters,
        this operation may be extremely slow.
        N)rZ_check_can_seekr/�seek)r1�offset�whencer7r7r8rSszBZ2File.seekc	Cs4|j�$|j�|jtkr$|jj�S|jSQRXdS)z!Return the current file position.N)rr=rr r/�tellr0)r1r7r7r8rVs


zBZ2File.tell)rNr)r���)rWrW)rWrW)rWrW)rW)�__name__�
__module__�__qualname__�__doc__r9r:�propertyr<r>r@r?rArCrrGrHrLrMrrQr-�SEEK_SETrSrVr7r7r7r8r s$	
E




	

rrcCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|jdd�}t|||d	�}d|kr�tj||||�S|SdS)
aOpen a bzip2-compressed file in binary or text mode.

    The filename argument can be an actual filename (a str, bytes, or
    PathLike object), or an existing file object to read from or write
    to.

    The mode argument can be "r", "rb", "w", "wb", "x", "xb", "a" or
    "ab" for binary mode, or "rt", "wt", "xt" or "at" for text mode.
    The default mode is "rb", and the default compresslevel is 9.

    For binary mode, this function is equivalent to the BZ2File
    constructor: BZ2File(filename, mode, compresslevel). In this case,
    the encoding, errors and newline arguments must not be provided.

    For text mode, a BZ2File object is created, and wrapped in an
    io.TextIOWrapper instance with the specified encoding, error
    handling behavior, and line ending(s).

    �trIzInvalid mode: %rNz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary moder
)r5)r�replacerr-�
TextIOWrapper)r2r3r5�encoding�errors�newlineZbz_modeZbinary_filer7r7r8r!scCst|�}|j|�|j�S)z�Compress a block of data.

    compresslevel, if given, must be a number between 1 and 9.

    For incremental compression, use a BZ2Compressor object instead.
    )rrr;)rOr5�compr7r7r8rJscCsjg}xZ|r^t�}y|j|�}Wntk
r<|r6Pn�YnX|j|�|jsVtd��|j}qWdj|�S)zjDecompress a block of data.

    For incremental decompression, use a BZ2Decompressor object instead.
    zACompressed data ended before the end-of-stream marker was reached�)rrr,�append�eofrZunused_data�join)rOZresultsZdecomp�resr7r7r8rUs

)rrNNN)r)r[�__all__�
__author__�builtinsrr(r-r&rr+Z	threadingr�ImportErrorZdummy_threadingZ_bz2rrrr r!rPrrrr7r7r7r8�<module>s.

(
sre_constants.cpython-36.pyc000064400000013526150335715140012072 0ustar003


 \��@s8dZdZddlmZmZGdd�de�ZGdd�de�Zeed�Zd	d
�Z	e	d�Z
e
d.d
�=e	d�Ze	d�Ze
eeeeeeeeeiZeeeeiZeeee iZ!ee"ee#iZ$e%e%e&e&e'e'e(e(e)e*e+e,e-e-e.e.iZ/e%e0e&e1e'e2e(e3e)e4e+e5e-e6e.e7iZ8dZ9dZ:dZ;dZ<dZ=dZ>dZ?dZ@dZAdZBdZCdZDeEdk�r4dd�ZFeGdd���ZHeHjId�eHjIde�eFeHe
d�eFeHed �eFeHed �eHjId!e9�eHjId"e:�eHjId#e;�eHjId$e<�eHjId%e=�eHjId&e>�eHjId'e?�eHjId(e@�eHjId)eA�eHjId*eB�eHjId+eC�eHjId,eD�Wd
QRXeJd-�d
S)/zInternal support module for sreiuS3�)�	MAXREPEAT�	MAXGROUPScs"eZdZdZd�fdd�	Z�ZS)�erroraiException raised for invalid regular expressions.

    Attributes:

        msg: The unformatted error message
        pattern: The regular expression pattern
        pos: The index in the pattern where compilation failed (may be None)
        lineno: The line corresponding to pos (may be None)
        colno: The column corresponding to pos (may be None)
    Ncs�||_||_||_|dk	r�|dk	r�d||f}t|t�r>d}nd}|j|d|�d|_||j|d|�|_||kr�d||j|jf}nd|_|_t	�j
|�dS)Nz%s at position %d�
�
r�z%s (line %d, column %d))�msg�pattern�pos�
isinstance�str�count�lineno�rfind�colno�super�__init__)�selfrr	r
�newline)�	__class__��%/usr/lib64/python3.6/sre_constants.pyr#s
zerror.__init__)NN)�__name__�
__module__�__qualname__�__doc__r�
__classcell__rr)rrrs
rcs(eZdZ�fdd�Zdd�ZeZ�ZS)�_NamedIntConstantcstt|�j||�}||_|S)N)rr�__new__�name)�cls�valuerr)rrrr7sz_NamedIntConstant.__new__cCs|jS)N)r)rrrr�__str__<sz_NamedIntConstant.__str__)rrrrr"�__repr__rrr)rrr6srrcCs8|j�j�}dd�t|�D�}t�jdd�|D��|S)NcSsg|]\}}t||��qSr)r)�.0�irrrr�
<listcomp>Esz_makecodes.<locals>.<listcomp>cSsi|]}||j�qSr)r)r$�itemrrr�
<dictcomp>Fsz_makecodes.<locals>.<dictcomp>)�strip�split�	enumerate�globals�update)�names�itemsrrr�
_makecodesCsr0a�
    FAILURE SUCCESS

    ANY ANY_ALL
    ASSERT ASSERT_NOT
    AT
    BRANCH
    CALL
    CATEGORY
    CHARSET BIGCHARSET
    GROUPREF GROUPREF_EXISTS GROUPREF_IGNORE
    IN IN_IGNORE
    INFO
    JUMP
    LITERAL LITERAL_IGNORE
    MARK
    MAX_UNTIL
    MIN_UNTIL
    NOT_LITERAL NOT_LITERAL_IGNORE
    NEGATE
    RANGE
    REPEAT
    REPEAT_ONE
    SUBPATTERN
    MIN_REPEAT_ONE
    RANGE_IGNORE

    MIN_REPEAT MAX_REPEAT
�Nz�
    AT_BEGINNING AT_BEGINNING_LINE AT_BEGINNING_STRING
    AT_BOUNDARY AT_NON_BOUNDARY
    AT_END AT_END_LINE AT_END_STRING
    AT_LOC_BOUNDARY AT_LOC_NON_BOUNDARY
    AT_UNI_BOUNDARY AT_UNI_NON_BOUNDARY
a�
    CATEGORY_DIGIT CATEGORY_NOT_DIGIT
    CATEGORY_SPACE CATEGORY_NOT_SPACE
    CATEGORY_WORD CATEGORY_NOT_WORD
    CATEGORY_LINEBREAK CATEGORY_NOT_LINEBREAK
    CATEGORY_LOC_WORD CATEGORY_LOC_NOT_WORD
    CATEGORY_UNI_DIGIT CATEGORY_UNI_NOT_DIGIT
    CATEGORY_UNI_SPACE CATEGORY_UNI_NOT_SPACE
    CATEGORY_UNI_WORD CATEGORY_UNI_NOT_WORD
    CATEGORY_UNI_LINEBREAK CATEGORY_UNI_NOT_LINEBREAK
r���� �@���__main__cCs.t|�}x |D]}|jd|||f�qWdS)Nz#define %s_%s %d
)�sorted�write)�f�d�prefixr/r'rrr�dump�s
r?zsre_constants.h�wao/*
 * Secret Labs' Regular Expression Engine
 *
 * regular expression matching engine
 *
 * NOTE: This file is generated by sre_constants.py.  If you need
 * to change anything in here, edit sre_constants.py and run it.
 *
 * Copyright (c) 1997-2001 by Secret Labs AB.  All rights reserved.
 *
 * See the _sre.c file for information on usage and redistribution.
 */

z#define SRE_MAGIC %d
ZSRE_OPZSREz#define SRE_FLAG_TEMPLATE %d
z#define SRE_FLAG_IGNORECASE %d
z#define SRE_FLAG_LOCALE %d
z#define SRE_FLAG_MULTILINE %d
z#define SRE_FLAG_DOTALL %d
z#define SRE_FLAG_UNICODE %d
z#define SRE_FLAG_VERBOSE %d
z#define SRE_FLAG_DEBUG %d
z#define SRE_FLAG_ASCII %d
z#define SRE_INFO_PREFIX %d
z#define SRE_INFO_LITERAL %d
z#define SRE_INFO_CHARSET %d
�done���)Kr�MAGIC�_srerr�	Exceptionr�intrr0�OPCODES�ATCODES�CHCODES�GROUPREFZGROUPREF_IGNORE�IN�	IN_IGNORE�LITERALZLITERAL_IGNORE�NOT_LITERALZNOT_LITERAL_IGNORE�RANGE�RANGE_IGNORE�	OP_IGNORE�AT_BEGINNINGZAT_BEGINNING_LINE�AT_ENDZAT_END_LINE�AT_MULTILINEZAT_BOUNDARYZAT_LOC_BOUNDARYZAT_NON_BOUNDARYZAT_LOC_NON_BOUNDARY�	AT_LOCALEZAT_UNI_BOUNDARYZAT_UNI_NON_BOUNDARY�
AT_UNICODEZCATEGORY_DIGITZCATEGORY_NOT_DIGITZCATEGORY_SPACEZCATEGORY_NOT_SPACEZ
CATEGORY_WORDZCATEGORY_LOC_WORDZCATEGORY_NOT_WORDZCATEGORY_LOC_NOT_WORDZCATEGORY_LINEBREAKZCATEGORY_NOT_LINEBREAK�	CH_LOCALEZCATEGORY_UNI_DIGITZCATEGORY_UNI_NOT_DIGITZCATEGORY_UNI_SPACEZCATEGORY_UNI_NOT_SPACEZCATEGORY_UNI_WORDZCATEGORY_UNI_NOT_WORDZCATEGORY_UNI_LINEBREAKZCATEGORY_UNI_NOT_LINEBREAK�
CH_UNICODE�SRE_FLAG_TEMPLATE�SRE_FLAG_IGNORECASE�SRE_FLAG_LOCALE�SRE_FLAG_MULTILINE�SRE_FLAG_DOTALL�SRE_FLAG_UNICODE�SRE_FLAG_VERBOSE�SRE_FLAG_DEBUG�SRE_FLAG_ASCII�SRE_INFO_PREFIX�SRE_INFO_LITERAL�SRE_INFO_CHARSETrr?�openr<r;�printrrrr�<module>s�



pkgutil.cpython-36.pyc000064400000037607150335715140010672 0ustar003


 \CS�@sxdZddlmZddlmZddlZddlZddlZddl	Z	ddl
Z	ddlZddlm
Z
ddlZdddd	d
ddd
ddddgZedd�Zde_dd�Zdd�Zd+dd
�Zd,dd�Zed-dd��Zd.dd�Zejejje�dd�ZGd d
�d
�ZGd!d�d�Zy.ddlZdd"lmZd/d#d$�Zejee�Wne k
�r@YnXd%d�Z!d0d&d�Z"d'd�Z#d(d	�Z$d)d�Z%d*d�Z&dS)1zUtilities to support packages.�)�
namedtuple)�singledispatchN)�
ModuleType�get_importer�iter_importers�
get_loader�find_loader�
walk_packages�iter_modules�get_data�ImpImporter�	ImpLoader�	read_code�extend_path�
ModuleInfozmodule_finder name ispkgz.A namedtuple with minimal info about a module.cCsLy
|j}Wn4tk
r>|j|�}|dkr0dStjj||�SX||�SdS)z'Return the finder-specific module spec.N)�	find_spec�AttributeError�find_module�	importlib�util�spec_from_loader)�finder�namer�loader�r�/usr/lib64/python3.6/pkgutil.py�	_get_specs

rcCs6ddl}|jd�}|tjjkr"dS|jd�|j|�S)Nr��)�marshal�readrr�MAGIC_NUMBER�load)�streamr�magicrrrr(s

�c
#s�ifdd��x�t||�D]�}|V|jryt|j�WnNtk
r\|dk	rX||j�Yqtk
r�|dk	r~||j�n�YqXttj|jdd�p�g}�fdd�|D�}t	||jd|�EdHqWdS)a�Yields ModuleInfo for all modules recursively
    on path, or, if path is None, all accessible modules.

    'path' should be either None or a list of paths to look for
    modules in.

    'prefix' is a string to output on the front of every module name
    on output.

    Note that this function must import all *packages* (NOT all
    modules!) on the given path, in order to access the __path__
    attribute to find submodules.

    'onerror' is a function which gets called with one argument (the
    name of the package which was being imported) if any exception
    occurs while trying to import a package.  If no onerror function is
    supplied, ImportErrors are caught and ignored, while all other
    exceptions are propagated, terminating the search.

    Examples:

    # list all modules python can access
    walk_packages()

    # list all submodules of ctypes
    walk_packages(ctypes.__path__, ctypes.__name__+'.')
    cSs||krdSd||<dS)NTr)�p�mrrr�seenRszwalk_packages.<locals>.seenN�__path__csg|]}�|�s|�qSrr)�.0r&)r(rr�
<listcomp>isz!walk_packages.<locals>.<listcomp>�.)
r
�ispkg�
__import__r�ImportError�	Exception�getattr�sys�modulesr	)�path�prefix�onerror�infor)r(rr	5s ccsf|dkrt�}n
tt|�}i}xB|D]:}x4t||�D]&\}}||kr4d||<t|||�Vq4Wq$WdS)aYields ModuleInfo for all submodules on path,
    or, if path is None, all top-level modules on sys.path.

    'path' should be either None or a list of paths to look for
    modules in.

    'prefix' is a string to output on the front of every module name
    on output.
    N�)r�mapr�iter_importer_modulesr)r4r5Z	importers�yielded�irr-rrrr
ns


cCst|d�sgS|j|�S)Nr
)�hasattrr
)�importerr5rrrr:�s
r:ccs0|jdkstjj|j�rdSi}ddl}ytj|j�}Wntk
rRg}YnX|j�x�|D]�}|j|�}|dksb||kr�qbtjj|j|�}d}|o�tjj|�o�d|k�r|}ytj|�}	Wntk
r�g}	YnXx&|	D]}|j|�}
|
dkr�d}Pq�Wqb|rbd|krbd||<|||fVqbWdS)Nr�__init__Fr,Tr8)	r4�os�isdir�inspect�listdir�OSError�sort�
getmodulename�join)r>r5r;rB�	filenames�fn�modnamer4r-�dircontents�subnamerrr�_iter_file_finder_modules�s<





rMc
Cs.tj��tjdt�tjd�aWdQRXdS)N�ignore�imp)�warnings�catch_warnings�simplefilter�DeprecationWarningr�
import_modulerOrrrr�_import_imp�s
rUc@s.eZdZdZd
dd�Zddd�Zddd	�ZdS)
raPEP 302 Finder that wraps Python's "classic" import algorithm

    ImpImporter(dirname) produces a PEP 302 finder that searches that
    directory.  ImpImporter(None) produces a PEP 302 finder that searches
    the current sys.path, plus any modules that are frozen or built-in.

    Note that ImpImporter does not currently support being used by placement
    on sys.meta_path.
    NcCstjdt�t�||_dS)Nz5This emulation is deprecated, use 'importlib' instead)rP�warnrSrUr4)�selfr4rrrr?�szImpImporter.__init__c
Cs~|jd�d}||kr$|jdkr$dS|jdkr4d}ntjj|j�g}ytj||�\}}}Wntk
rndSXt||||�S)Nr,r8���)�splitr4r@�realpathrOrr/r
)rW�fullnamer4rL�file�filename�etcrrrr�s
zImpImporter.find_moduler%ccs0|jdkstjj|j�rdSi}ddl}ytj|j�}Wntk
rRg}YnX|j�x�|D]�}|j|�}|dksb||kr�qbtjj|j|�}d}|o�tjj|�o�d|k�r|}ytj|�}	Wntk
r�g}	YnXx&|	D]}|j|�}
|
dkr�d}Pq�Wqb|rbd|krbd||<|||fVqbWdS)Nrr?Fr,Tr8)	r4r@rArBrCrDrErFrG)rWr5r;rBrHrIrJr4r-rKrLrrrr
�s<





zImpImporter.iter_modules)N)N)r%)�__name__�
__module__�__qualname__�__doc__r?rr
rrrrr�s	

c@sneZdZdZdZZdd�Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zddd�Zddd�Z
dd�Zddd�ZdS)r
zBPEP 302 Loader that wraps Python's "classic" import algorithm
    NcCs.tjdt�t�||_||_||_||_dS)Nz5This emulation is deprecated, use 'importlib' instead)rPrVrSrUr\r]r[r^)rWr[r\r]r^rrrr?szImpLoader.__init__cCs:|j�ztj||j|j|j�}Wd|jr4|jj�X|S)N)�_reopenrO�load_moduler\r]r^�close)rWr[�modrrrrdszImpLoader.load_modulec	Cst|d��
}|j�SQRXdS)N�rb)�openr )rW�pathnamer\rrrr"szImpLoader.get_datacCsT|jrP|jjrP|jd}|tjkr2t|jd�|_n|tjtjfkrPt|jd�|_dS)N��rrg)	r\�closedr^rO�	PY_SOURCErhr]�PY_COMPILED�C_EXTENSION)rW�mod_typerrrrc&s

zImpLoader._reopencCs0|dkr|j}n||jkr,td|j|f��|S)Nz,Loader for module %s cannot handle module %s)r[r/)rWr[rrr�	_fix_name.s
zImpLoader._fix_namecCs|j|�}|jdtjkS)Nrj)rqr^rO�
PKG_DIRECTORY)rWr[rrr�
is_package6s
zImpLoader.is_packagec
Cs�|j|�}|jdkr�|jd}|tjkrD|j|�}t||jd�|_nJ|tjkrv|j	�zt
|j�|_Wd|jj�Xn|tj
kr�|j�j�|_|jS)Nrj�exec)rq�coder^rOrm�
get_source�compiler]rnrcrr\rerr�
_get_delegate�get_code)rWr[rp�sourcerrrry:s






zImpLoader.get_codec
Cs�|j|�}|jdkr�|jd}|tjkrP|j�z|jj�|_Wd|jj�Xnd|tj	kr�t
jj|j
dd��r�t|j
dd�d��}|j�|_WdQRXn|tjkr�|j�j�|_|jS)Nrjr8rkrXrX)rqrzr^rOrmrcr\r rernr@r4�existsr]rhrrrxrv)rWr[rp�frrrrvKs





zImpLoader.get_sourcecCst|j�}t|d�}|jS)Nr?)rr]rr)rWr�specrrrrx]s

zImpLoader._get_delegatecCsH|j|�}|jd}|tjkr*|j�j�S|tjtjtjfkrD|j	SdS)Nrj)
rqr^rOrrrx�get_filenamermrnror])rWr[rprrrr~bs


zImpLoader.get_filename)N)N)N)r_r`rarbrurzr?rdrrcrqrsryrvrxr~rrrrr
	s	

)�zipimporterc	cs�ttj|j�}|j}t|�}i}ddl}x�|D]�}|j|�s@q0||d�jt	j
�}t|�dkr�|djd�r�|d|kr�d||d<||ddfVt|�dkr�q0|j|d�}|dkr�q0|r0d|kr0||kr0d||<||dfVq0WdS)	Nrrjr8z__init__.pyTr?r,F)�sorted�	zipimport�_zip_directory_cache�archiver5�lenrB�
startswithrYr@�seprF)	r>r5Zdirlist�_prefixZplenr;rBrIrJrrr�iter_zipimport_modulesps*

r�cCsnytj|}WnZtk
rhxDtjD]6}y||�}tjj||�PWq&tk
rZYq&Xq&Wd}YnX|S)z�Retrieve a finder for the given path item

    The returned finder is cached in sys.path_importer_cache
    if it was newly created by a path hook.

    The cache (or part of it) can be cleared manually if a
    rescan of sys.path_hooks is necessary.
    N)r2�path_importer_cache�KeyError�
path_hooks�
setdefaultr/)Z	path_itemr>�	path_hookrrrr�s	

ccs�|jd�rdj|�}t|��d|krV|jd�d}tj|�}t|dd�}|dkrhdSntjEdHtj	}x|D]}t
|�VqnWdS)a�Yield finders for the given module name

    If fullname contains a '.', the finders will be for the package
    containing fullname, otherwise they will be all registered top level
    finders (i.e. those on both sys.meta_path and sys.path_hooks).

    If the named module is in a package, that package is imported as a side
    effect of invoking this function.

    If no module name is specified, all top level finders are produced.
    r,z'Relative module name {!r} not supportedrr)N)r��formatr/�
rpartitionrrTr1r2�	meta_pathr4r)r[�msgZpkg_nameZpkgr4�itemrrrr�s



cCsn|tjkr tj|}|dkr dSt|t�rb|}t|dd�}|dk	rF|St|dd�dkrZdS|j}n|}t|�S)z�Get a "loader" object for module_or_name

    Returns None if the module cannot be found or imported.
    If the named module is not already imported, its containing package
    (if any) is imported, in order to establish the package __path__.
    N�
__loader__�__spec__)r2r3�
isinstancerr1r_r)Zmodule_or_name�modulerr[rrrr�s


cCs�|jd�rdj|�}t|��ytjj|�}WnFttttfk
rr}z"d}t|j|t	|�|��|�WYdd}~XnX|dk	r�|j
SdS)z�Find a "loader" object for fullname

    This is a backwards compatibility wrapper around
    importlib.util.find_spec that converts most failures to ImportError
    and only returns the loader rather than the full spec
    r,z'Relative module name {!r} not supportedz,Error while finding loader for {!r} ({}: {})N)r�r�r/rrrr�	TypeError�
ValueError�typer)r[r�r}Zexrrrr�s

*cCs�t|t�s|S|d}|dd�}|jd�\}}}|rbytj|j}Wqhttfk
r^|SXntj}�x:|D�]0}t|t	�s�qpt
|�}|dk	r�g}	t|d�r�|j|�}
|
dk	r�|
j
p�g}	nt|d�r�|j|�\}}	x|	D]}||kr�|j|�q�Wtjj||�}tjj|�rpyt|�}
Wn8tk
�rT}ztjjd||f�WYdd}~XqpX|
�Bx:|
D]2}|jd�}|�sb|jd��r��qb|j|��qbWWdQRXqpW|S)	a�Extend a package's path.

    Intended use is to place the following code in a package's __init__.py:

        from pkgutil import extend_path
        __path__ = extend_path(__path__, __name__)

    This will add to the package's __path__ all subdirectories of
    directories on sys.path named after the package.  This is useful
    if one wants to distribute different parts of a single logical
    package as multiple directories.

    It also looks for *.pkg files beginning where * matches the name
    argument.  This feature is similar to *.pth files (see site.py),
    except that it doesn't special-case lines starting with 'import'.
    A *.pkg file is trusted at face value: apart from checking for
    duplicates, all entries found in a *.pkg file are added to the
    path, regardless of whether they are exist the filesystem.  (This
    is a feature.)

    If the input path is not a list (as is the case for frozen
    packages) it is returned unchanged.  The input path is not
    modified; an extended copy is returned.  Items are only appended
    to the copy at the end.

    It is assumed that sys.path is a sequence.  Items of sys.path that
    are not (unicode or 8-bit) strings referring to existing
    directories are ignored.  Unicode items of sys.path that cause
    errors when used as filenames may cause this function to raise an
    exception (in line with os.path.isdir() behavior).
    z.pkgNr,rrzCan't open %s: %s
�
�#)r��listr�r2r3r)r�rr4�strrr=r�submodule_search_locationsr�appendr@rG�isfilerhrD�stderr�write�rstripr�)r4rZ	sname_pkgZparent_package�_Z
final_nameZsearch_path�dirr�portionsr}ZportionZpkgfiler|r��linerrrr�sP!







cCs�tjj|�}|dkrdS|j}|dks2t|d�r6dStjj|�pLtjj	|�}|dksbt|d�rfdS|j
d�}|jdtj
j|j��tj
j|�}|j|�S)afGet a resource from a package.

    This is a wrapper round the PEP 302 loader get_data API. The package
    argument should be the name of a package, in standard module format
    (foo.bar). The resource argument should be in the form of a relative
    filename, using '/' as the path separator. The parent directory name '..'
    is not allowed, and nor is a rooted name (starting with a '/').

    The function returns a binary string, which is the contents of the
    specified resource.

    For packages located in the filesystem, which have already been imported,
    this is the rough equivalent of

        d = os.path.dirname(sys.modules[package].__file__)
        data = open(os.path.join(d, resource), 'rb').read()

    If the package cannot be located or loaded, or it uses a PEP 302 loader
    which does not support get_data(), then None is returned.
    Nr�__file__�/r)rrrrr=r2r3�get�
_bootstrap�_loadrY�insertr@r4�dirnamer�rGr)�packageZresourcer}rrf�partsZ
resource_namerrrrRs
)Nr%N)Nr%)r%)r%)r%)r%)'rb�collectionsr�	functoolsrZ
simplegenericr�importlib.util�importlib.machineryr@Zos.pathr2�typesrrP�__all__rrrr	r
r:rM�register�	machinery�
FileFinderrUrr
r�rr�r/rrrrrrrrrr�<module>sR

9

(Jc

^shlex.cpython-36.opt-1.pyc000064400000015474150335715140011273 0ustar003


 \�2�@s�dZddlZddlZddlZddlmZddlmZdddgZGdd�d�Z	ddd�Z
ejdej�j
Zd
d�Zdd�Zedkr�eej�dkr�ee	��n,ejdZee��Zee	ee��WdQRXdS)z8A lexical analyzer class for simple shell-like syntaxes.�N)�deque)�StringIO�shlex�split�quotec@sfeZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dd�Z
ddd�Zdd�Zdd�Z
dS)rz8A lexical analyzer class for simple shell-like syntaxes.NFcCst|t�rt|�}|dk	r(||_||_ntj|_d|_||_|rHd|_nd|_d|_	d|_
|jrn|j
d7_
d|_d|_d|_
d|_d	|_d
|_t�|_d|_d|_d|_t�|_d|_|s�d}n|d
kr�d}||_|�rt�|_|j
d7_
|j
jtj|��}|j
j|�|_
dS)N��#Z?abcdfeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_u|ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞz 	
Fz'"�\�"� �rTz();<>|&z~-./*?=)�
isinstance�strr�instream�infile�sys�stdin�posix�eof�
commenters�	wordchars�
whitespace�whitespace_split�quotes�escape�
escapedquotes�stater�pushback�lineno�debug�token�	filestack�source�punctuation_chars�_pushback_chars�	maketrans�dict�fromkeys�	translate)�selfrrrr#�t�r+�/usr/lib64/python3.6/shlex.py�__init__sJ
zshlex.__init__cCs*|jdkrtdt|��|jj|�dS)z:Push a token onto the stack popped by the get_token methodrzshlex: pushing token N)r�print�reprr�
appendleft)r)�tokr+r+r,�
push_tokenDs
zshlex.push_tokencCspt|t�rt|�}|jj|j|j|jf�||_||_d|_|jrl|dk	r\t	d|jf�nt	d|jf�dS)z9Push an input source onto the lexer's input source stack.rNzshlex: pushing to file %szshlex: pushing to stream %s)
r
rrr!r0rrrrr.)r)�	newstream�newfiler+r+r,�push_sourceJs
zshlex.push_sourcecCsD|jj�|jj�\|_|_|_|jr:td|j|jf�d|_dS)zPop the input source stack.zshlex: popping to %s, line %drN)	r�closer!�popleftrrrr.r)r)r+r+r,�
pop_sourceXs
zshlex.pop_sourcecCs�|jr.|jj�}|jdkr*tdt|��|S|j�}|jdk	r~x<||jkr||j|j��}|rr|\}}|j||�|j	�}qBWx*||j
kr�|js�|j
S|j�|j	�}q�W|jdkr�||j
kr�tdt|��ntd�|S)zBGet a token from the input stream (or from stack if it's nonempty)rzshlex: popping token Nz
shlex: token=zshlex: token=EOF)
rr7rr.r/�
read_tokenr"�
sourcehookr5�	get_tokenrr!r8)r)r1�raw�specr4r3r+r+r,r;as.




zshlex.get_tokencCs�d}d}�x\|jr$|jr$|jj�}n|jjd�}|dkrF|jd7_|jdkrbtd|j|f�|jdkrvd|_	Pq|jdk�r�|s�d|_P�qd||j
kr�|jdkr�td	�|j	s�|jr|rPnqn�||jkr�|jj
�|jd7_n�|jo�||jk�rd
}||_n�||jk�r"||_	d
|_np||jk�r<||_	d|_nV||jk�r^|j�sV||_	||_n4|j�rt||_	d
|_n||_	|j	�s�|jr|rPnqq|j|jk�r<d}|�s�|jdk�r�td
�td��||jk�r�|j�s�|j	|7_	d|_Pnd
|_n>|j�r,||jk�r,|j|jk�r,|j}||_n|j	|7_	q|j|jk�r�|�sl|jdk�rdtd�td��||jk�r�||jk�r�||k�r�|j	|j7_	|j	|7_	||_q|jdkr|�s�d|_Pq||j
k�r|jdk�r�td�d|_|j	�s|jr|rPnqq||jk�rZ|jj
�|jd7_|j�rdd|_|j	�sR|jr|rPnqq|jdk�r�||jk�r�|j	|7_	n ||j
k�r�|jj|�d|_Pq|j�r�||jk�r�||_q|j�r�||jk�r�d
}||_q||jk�s||jk�s|j�r|j	|7_	q|j�r&|jj|�n|jj|�|jdk�rFtd�d|_|j	�s^|jr|rPqqqW|j	}d|_	|j�r�|�r�|dk�r�d}|jdk�r�|�r�tdt|��ntd�|S)NFrr�
�z&shlex: in state %r I see character: %rr�z+shlex: I see whitespace in whitespace state�a�cTz shlex: I see EOF in quotes statezNo closing quotationz shlex: I see EOF in escape statezNo escaped characterz%shlex: I see whitespace in word statez&shlex: I see punctuation in word statezshlex: raw token=zshlex: raw token=EOF)rArB)r#r$�popr�readrrr.rr rrr�readlinerrrr�
ValueErrorr�appendrr0r/)r)ZquotedZescapedstateZnextchar�resultr+r+r,r9�s�









zshlex.read_tokencCsX|ddkr|dd�}t|jt�rJtjj|�rJtjjtjj|j�|�}|t|d�fS)z(Hook called on a filename to be sourced.rr
r�r���)	r
rr�os�path�isabs�join�dirname�open)r)r4r+r+r,r:s
zshlex.sourcehookcCs(|dkr|j}|dkr|j}d||fS)z<Emit a C-compiler-like, Emacs-friendly error-message leader.Nz"%s", line %d: )rr)r)rrr+r+r,�error_leaders
zshlex.error_leadercCs|S)Nr+)r)r+r+r,�__iter__#szshlex.__iter__cCs|j�}||jkrt�|S)N)r;r�
StopIteration)r)r r+r+r,�__next__&s
zshlex.__next__)NNFF)N)NN)�__name__�
__module__�__qualname__�__doc__r-r2r5r8r;r9r:rQrRrTr+r+r+r,rs
.
	 	
FTcCs$t||d�}d|_|sd|_t|�S)N)rTr)rrr�list)�sZcommentsrZlexr+r+r,r,s
z[^\w@%+=:,./-]cCs,|sdSt|�dkr|Sd|jdd�dS)z1Return a shell-escaped version of the string *s*.z''N�'z'"'"')�_find_unsafe�replace)rZr+r+r,r6s
cCs(x"|j�}|sPtdt|��qWdS)NzToken: )r;r.r/)ZlexerZttr+r+r,�
_print_tokensBs
r^�__main__r)FT)rXrK�rer�collectionsr�ior�__all__rr�compile�ASCII�searchr\rr^rU�len�argv�fnrP�fr+r+r+r,�<module>s&	



tokenize.cpython-36.opt-2.pyc000064400000035233150335715140011774 0ustar003


 \8s�-@s�dZdZddlmZddlmZmZddlZddl	m
Z
ddlmZddlZ
ddlZddlZddlTejd	ej�Zejd
ej�ZddlZejddd
ddddgZ[eZdee<edZdee<edZdee<ed7Zeeeeee e!e"e#e$e%e&e'e(e)e*e+e,e-e.e/e0e1e2e3e4e5e6e7e8e9e:e;e<e=e>e?e@eAeBeCeDeEeFd�,ZGGdd�dejHdd��ZIdd�ZJdd�ZKdd�ZLdZMdZNeMeKd eM�eLeN�ZOd!ZPd"ZQd#ZRd$ZSd%ZTeJeQeReSeT�ZUd&ZVeJd'd(�eLeV�ZWd)eVZXeJeWeX�ZYeJd*eYd+�ZZeJeZeYeU�Z[d,d-�Z\d.d/�Z]eJe\��Z^d0Z_d1Z`d2Zad3ZbeJe^d4e^d5�ZceJe^d6e^d7�ZdeJd8d9d:d;d<d=d>d?�Zed@ZfeJdAdBdC�ZgeJeeefeg�ZheJe[ehedeP�ZieOeiZjeJe^dDeJdEd �e^dFeJdGd ��ZkeJdHeNec�ZleMeJele[ehekeP�ZmiZnx@e\�D]6Zoe_eneodE<e`eneodG<eaeneod4<ebeneod5<�q�Wep�Zqep�Zrx\e\�D]RZsx$esdGesdEfD]Zteqjuet��q4Wx$esd5esd4fD]Zterjuet��qZW�qWdIZvGdJdK�dKew�ZxGdLdM�dMew�ZyGdNdO�dO�ZzdPd�Z{dQdR�Z|dSd
�Z}dTdU�ZdVd�Z~dWdX�ZdYdZ�Z�d[d\�Z�e�d]k�r�e��dS)^zKa-Ping Yee <ping@lfw.org>zpGvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip Montanaro, Raymond Hettinger, Trent Nelson, Michael Foord�)�open)�lookup�BOM_UTF8N)�
TextIOWrapper)�chain)�*z&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)�COMMENT�tokenize�detect_encoding�NL�
untokenize�ENCODING�	TokenInfo���),�(�)�[�]�:�,�;�+�-r�/�|�&�<�>�=�.�%�{�}z==z!=z<=z>=�~�^z<<z>>z**z+=z-=z*=z/=z%=z&=z|=z^=z<<=z>>=z**=z//z//=�@z@=c@s eZdZdd�Zedd��ZdS)rcCs$d|jt|jf}d|j|d�S)Nz%d (%s)z8TokenInfo(type=%s, string=%r, start=%r, end=%r, line=%r))�type)r(�tok_name�_replace)�self�annotated_type�r-� /usr/lib64/python3.6/tokenize.py�__repr__dszTokenInfo.__repr__cCs(|jtkr|jtkrt|jS|jSdS)N)r(�OP�string�EXACT_TOKEN_TYPES)r+r-r-r.�
exact_typeis
zTokenInfo.exact_typeN)�__name__�
__module__�__qualname__r/�propertyr3r-r-r-r.rcsztype string start end linecGsddj|�dS)Nrrr)�join)�choicesr-r-r.�grouppsr:cGst|�dS)Nr)r:)r9r-r-r.�anyqsr;cGst|�dS)N�?)r:)r9r-r-r.�maybersr=z[ \f\t]*z	#[^\r\n]*z\\\r?\nz\w+z0[xX](?:_?[0-9a-fA-F])+z0[bB](?:_?[01])+z0[oO](?:_?[0-7])+z(?:0(?:_?0)*|[1-9](?:_?[0-9])*)z[eE][-+]?[0-9](?:_?[0-9])*z)[0-9](?:_?[0-9])*\.(?:[0-9](?:_?[0-9])*)?z\.[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*[jJ]z[jJ]cCsnddddddg}tdg�}xN|D]F}x@tj|�D]2}x,tjdd	�|D��D]}|jdj|��qJWq0Wq W|S)
N�b�r�u�f�br�fr�cSsg|]}||j�f�qSr-)�upper)�.0�cr-r-r.�
<listcomp>�sz(_all_string_prefixes.<locals>.<listcomp>)�set�
_itertools�permutations�product�addr8)�_valid_string_prefixes�result�prefix�tr@r-r-r.�_all_string_prefixes�s

rRcCstj|tj�S)N)�re�compile�UNICODE)�exprr-r-r.�_compile�srWz[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z'''z"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z!=z//=?z->z[+\-*/%&@|^=<>]=?r%z[][(){}]z\r?\nz\.\.\.z[:;.,@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*�'z"[^\n"\\]*(?:\\.[^\n"\\]*)*�"z
\\\r?\n|\Z�c@seZdZdS)�
TokenErrorN)r4r5r6r-r-r-r.r[�sr[c@seZdZdS)�StopTokenizingN)r4r5r6r-r-r-r.r\�sr\c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�UntokenizercCsg|_d|_d|_d|_dS)Nrr)�tokens�prev_row�prev_col�encoding)r+r-r-r.�__init__�szUntokenizer.__init__cCs�|\}}||jks&||jkr>||jkr>tdj|||j|j���||j}|rb|jjd|�d|_||j}|r�|jjd|�dS)Nz+start ({},{}) precedes previous end ({},{})z\
r� )r_r`�
ValueError�formatr^�append)r+�start�row�col�
row_offset�
col_offsetr-r-r.�add_whitespace�s

zUntokenizer.add_whitespacecCs4t|�}g}d}�x|D�]
}t|�dkr8|j||�P|\}}}}	}
|tkrV||_q|tkr`P|tkrv|j|�qnl|tkr�|j	�|	\|_
|_qnL|tt
fkr�d}n:|r�|r�|d}|dt|�kr�|jj|�t|�|_d}|j|�|jj|�|	\|_
|_|tt
fkr|j
d7_
d|_qWdj|j�S)NFrTrrrD���)�iter�len�compatr
ra�	ENDMARKER�INDENTrf�DEDENT�popr_r`�NEWLINErr^rlr8)r+�iterable�it�indents�	startlinerQ�tok_type�tokenrg�end�line�indentr-r-r.r�sF



zUntokenizer.untokenizec
Cs�g}|jj}|dttfk}d}x�t|g|�D]�}|dd�\}}	|tkrR|	|_q.|ttt	t
fkrj|	d7}	|tkr�|r~d|	}	d}nd}|tkr�|j|	�q.n>|t
kr�|j�q.n*|ttfkr�d}n|r�|r�||d�d}||	�q.WdS)NrFrrcTrrm)r^rfrurrr
ra�NAME�NUMBER�ASYNC�AWAIT�STRINGrrrsrt)
r+r{rvrx�toks_appendry�
prevstring�tok�toknum�tokvalr-r-r.rps8
zUntokenizer.compatN)r4r5r6rbrlrrpr-r-r-r.r]�s
%r]cCs*t�}|j|�}|jdk	r&|j|j�}|S)N)r]rra�encode)rv�ut�outr-r-r.r=s


cCsH|dd�j�jdd�}|dks*|jd�r.dS|dks@|jd
�rDdS|S)N��_rzutf-8zutf-8-�latin-1�
iso-8859-1�iso-latin-1�latin-1-�iso-8859-1-�iso-latin-1-)r�r�r�)r�r�r�)�lower�replace�
startswith)�orig_enc�encr-r-r.�_get_normal_nameXs
r�cs�y�jj�Wntk
r$d�YnXd�d}d}�fdd�}��fdd�}|�}|jt�rpd�|dd�}d	}|s||gfS||�}|r�||gfStj|�s�||gfS|�}|s�||gfS||�}|r�|||gfS|||gfS)
NFzutf-8cs y��Stk
rdSXdS)N�)�
StopIterationr-)�readliner-r.�read_or_stop{sz%detect_encoding.<locals>.read_or_stopcs�y|jd�}Wn4tk
rBd}�dk	r6dj|��}t|��YnXtj|�}|sVdSt|jd��}yt|�}Wn:t	k
r��dkr�d|}ndj�|�}t|��YnX�r�|dkr؈dkr�d}n
dj��}t|��|d	7}|S)
Nzutf-8z'invalid or missing encoding declarationz{} for {!r}rzunknown encoding: zunknown encoding for {!r}: {}zencoding problem: utf-8z encoding problem for {!r}: utf-8z-sig)
�decode�UnicodeDecodeErrorre�SyntaxError�	cookie_re�matchr�r:r�LookupError)r}�line_string�msgr�ra�codec)�	bom_found�filenamer-r.�find_cookie�s6


z$detect_encoding.<locals>.find_cookieTrz	utf-8-sig)�__self__�name�AttributeErrorr�r�blank_rer�)r�ra�defaultr�r��first�secondr-)r�r�r�r.r
cs8
&




cCsVt|d�}y0t|j�\}}|jd�t||dd�}d|_|S|j��YnXdS)N�rbrT)�line_bufferingr?)�
_builtin_openr
r��seekr�mode�close)r��bufferra�lines�textr-r-r.r�s

rcCsBddlm}m}t|�\}}t|d�}|d�}t||||�j|�S)Nr)r�repeatr�)�	itertoolsrr�r
rn�	_tokenize�__next__)r�rr�ra�consumed�rl_gen�emptyr-r-r.r	�s

c!csd}}}d}d!\}}d}dg}	d}
d}d}d}
|dk	rX|dkrFd}tt|d"d#d�Vd}d}�x
y|}|�}Wntk
r�d}YnX|dk	r�|j|�}|d7}dt|�}}|�r�|s�td	|��|j|�}|�r|jd�}}tt||d|�|||f||�Vd$\}}d}nf|�rn|d%d�dk�rn|d&d�d
k�rntt	||||t|�f|�Vd}d}qdn||}||}qd�n@|dk�r�|�r�|�s�Pd}xf||k�r||dk�r�|d7}n6||dk�r�|t
dt
}n||dk�r�d}nP|d7}�q�W||k�rP||dk�r�||dk�r�||d�jd�}|t|�}tt|||f||t|�f|�Vtt
||d�||f|t|�f|�Vqdtt
tf||dk||d�||f|t|�f|�Vqd||	d'k�r|	j|�tt|d|�|df||f|�Vxv||	d(k�r�||	k�r8tdd|||f��|	dd)�}	|�rd||	d*k�rdd}d}
d}ttd||f||f|�V�qW|�r�|
�r�||	d+k�r�d}d}
d}n|�s�td|df��d}�x�||k�rhtt�j||�}|�r:|jd�\}}||f||f|}}}||k�r�q�|||�||}}||k�sZ|dk�rp|dk�rp|dk�rptt||||�V�qd|dk�r�|
�r�|
Vd}
|dk�r�tt
||||�Vntt||||�V|�r8d}
�qd|dk�r�|
�r�|
Vd}
tt||||�V�qd|tk�rltt|�}|j||�}|�rN|jd�}|||�}tt||||f|�Vn||f}||d�}|}P�qd|tk�s�|dd
�tk�s�|dd�tk�r|d,dk�r�||f}ttj|��p�tj|d��p�tj|d
��}||d�d}}|}Pntt||||�V�qd|j��r�|d-k�rL|�rLt|dk�r8tnt||||�V�q�tt||||�}|dk�rv|
�rv|}
�q�|dk�r�|
�r�|
jtk�r�|
j dk�r�d}|	d.}tt|
j |
j!|
j|
j"�Vd}
|
�r�|
Vd}
|VnX|dk�r�d}nH|dk�r|d7}n|d k�r|d8}|
�r&|
Vd}
tt#||||�Vn*tt	||||f||df|�V|d7}�q�WqdW|
�r~|
Vd}
|�r�|d/dk�r�ttd|dt|�f|dt|�dfd�Vx0|	dd�D] } ttd|df|dfd�V�q�Wtt$d|df|dfd�VdS)0Nr�
0123456789rDFz	utf-8-sigzutf-8r�rzEOF in multi-line stringrz\
rz\
rc�	�z#
�#z
z3unindent does not match any outer indentation levelz
<tokenize>zEOF in multi-line statementr!z...T�
�async�await�def�\z([{z)]})rDr)rr)rr)rDr������rmrmrmrmrmrm)r�r�rmrm)%rr
r�r�ror[r�r|r��
ERRORTOKEN�tabsize�rstriprrrfrr�IndentationErrorrsrW�PseudoToken�spanr�ru�
triple_quoted�endpats�
single_quoted�get�isidentifierr�r�rr(r1rgr}r0rq)!r�ra�lnum�parenlev�	continued�numchars�contstr�needcont�contlinerx�stashed�	async_def�async_def_indent�async_def_nl�	last_liner}�pos�max�strstart�endprog�endmatchr|�column�
comment_token�nl_pos�pseudomatchrg�spos�eposr{�initialr�r~r-r-r.r��sr




*



"
 
















. r�cCs
t|d�S)N)r�)r�r-r-r.�generate_tokens�sr�c
s(ddl}dd��d�fdd�	}|jdd�}|jdd	d
dd�|jd
ddddd�|j�}y�|jr�|j}t|d��}tt|j��}WdQRXnd}t	t
jjd�}xF|D]>}|j}|j
r�|j}d|j|j}	td|	t||jf�q�WW�n8tk
�r:}
z2|
jddd�\}}||
jd|||f�WYdd}
~
Xn�tk
�r�}
z*|
jd\}}||
jd|||f�WYdd}
~
Xn�tk
�r�}
z||
|�WYdd}
~
Xnxtk
�r�}
z||
�WYdd}
~
XnNtk
�r�td�Yn2tk
�r"}
z�d|
��WYdd}
~
XnXdS)NrcSst|tjd�dS)N)�file)�print�sys�stderr)�messager-r-r.�perror�szmain.<locals>.perrorcsR|r"|f||f}�d|�n"|r8�d||f�n�d|�tjd�dS)Nz%s:%d:%d: error: %sz
%s: error: %sz	error: %sr)r��exit)r�r��location�args)r�r-r.�error�szmain.<locals>.errorzpython -m tokenize)�progr�r<zfilename.pyz'the file to tokenize; defaults to stdin)�dest�nargs�metavar�helpz-ez--exact�exact�
store_truez(display token names using the exact type)r��actionr�r�z<stdin>z%d,%d-%d,%d:z%-20s%-15s%-15rrrzinterrupted
zunexpected error: %s)NN)�argparse�ArgumentParser�add_argument�
parse_argsr�r��listr	r�r�r��stdinr(r�r3rgr|r�r)r1r�r�r[r��OSError�KeyboardInterrupt�	Exception)
rr��parserr�r�rAr^r{�
token_type�token_range�errr}r�r-)r�r.�main�sN
&&r�__main__)��
__author__�__credits__�builtinsrr��codecsrr�collections�iorr�rrJrSr�r{rT�ASCIIr�r��__all__�N_TOKENSrr)rr
�LPAR�RPAR�LSQB�RSQB�COLON�COMMA�SEMI�PLUS�MINUS�STAR�SLASH�VBAR�AMPER�LESS�GREATER�EQUAL�DOT�PERCENT�LBRACE�RBRACE�EQEQUAL�NOTEQUAL�	LESSEQUAL�GREATEREQUAL�TILDE�
CIRCUMFLEX�	LEFTSHIFT�
RIGHTSHIFT�
DOUBLESTAR�	PLUSEQUAL�MINEQUAL�	STAREQUAL�
SLASHEQUAL�PERCENTEQUAL�
AMPEREQUAL�	VBAREQUAL�CIRCUMFLEXEQUAL�LEFTSHIFTEQUAL�RIGHTSHIFTEQUAL�DOUBLESTAREQUAL�DOUBLESLASH�DOUBLESLASHEQUAL�AT�ATEQUALr2�
namedtuplerr:r;r=�
Whitespace�Comment�Ignore�Name�	Hexnumber�	Binnumber�	Octnumber�	Decnumber�	Intnumber�Exponent�
Pointfloat�Expfloat�Floatnumber�
Imagnumber�NumberrRrW�StringPrefix�Single�Double�Single3�Double3�Triple�String�Operator�Bracket�Special�Funny�
PlainToken�Token�ContStr�PseudoExtrasr�r��_prefixrIr�r�rQr@rMr�r
r[r\r]rr�r
r	r�r�rr4r-r-r-r.�<module>s






_]x<
site.cpython-36.opt-1.pyc000064400000037751150335715140011116 0ustar003

�\dhS�@sdZddlZddlZddlZddlZejejgadada	da
dd�Zdd�Zdd�Z
d	d
�Zdd�Zd.d
d�Zdd�Zdd�Zdd�Zdd�Zd/dd�Zd0dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zejj s�e�d+d,�Z!e"d-k�re!�dS)1a�Append module search paths for third-party packages to sys.path.

****************************************************************
* This module is automatically imported during initialization. *
****************************************************************

This will append site-specific paths to the module search path.  On
Unix (including Mac OSX), it starts with sys.prefix and
sys.exec_prefix (if different) and appends
lib/python<version>/site-packages.
On other platforms (such as Windows), it tries each of the
prefixes directly, as well as with lib/site-packages appended.  The
resulting directories, if they exist, are appended to sys.path, and
also inspected for path configuration files.

If a file named "pyvenv.cfg" exists one directory above sys.executable,
sys.prefix and sys.exec_prefix are set to that directory and
it is also checked for site-packages (sys.base_prefix and
sys.base_exec_prefix will always be the "real" prefixes of the Python
installation). If "pyvenv.cfg" (a bootstrap configuration file) contains
the key "include-system-site-packages" set to anything other than "false"
(case-insensitive), the system-level prefixes will still also be
searched for site-packages; otherwise they won't.

All of the resulting site-specific directories, if they exist, are
appended to sys.path, and also inspected for path configuration
files.

A path configuration file is a file whose name has the form
<package>.pth; its contents are additional directories (one per line)
to be added to sys.path.  Non-existing directories (or
non-directories) are never added to sys.path; no directory is added to
sys.path more than once.  Blank lines and lines beginning with
'#' are skipped. Lines starting with 'import' are executed.

For example, suppose sys.prefix and sys.exec_prefix are set to
/usr/local and there is a directory /usr/local/lib/python2.5/site-packages
with three subdirectories, foo, bar and spam, and two path
configuration files, foo.pth and bar.pth.  Assume foo.pth contains the
following:

  # foo package configuration
  foo
  bar
  bletch

and bar.pth contains:

  # bar package configuration
  bar

Then the following directories are added to sys.path, in this order:

  /usr/local/lib/python2.5/site-packages/bar
  /usr/local/lib/python2.5/site-packages/foo

Note that bletch is omitted because it doesn't exist; bar precedes foo
because bar.pth comes alphabetically before foo.pth; and spam is
omitted because it is not mentioned in either path configuration file.

The readline module is also automatically configured to enable
completion for systems that support it.  This can be overridden in
sitecustomize, usercustomize or PYTHONSTARTUP.  Starting Python in
isolated mode (-I) disables automatic readline configuration.

After these operations, an attempt is made to import a module
named sitecustomize, which can perform arbitrary additional
site-specific customizations.  If this import fails with an
ImportError exception, it is silently ignored.
�NcGsBtjj|�}ytjj|�}Wntk
r0YnX|tjj|�fS)N)�os�path�join�abspath�OSError�normcase)�paths�dir�r
�/usr/lib64/python3.6/site.py�makepathZsrcCs�x�ttjj��D]~}tt|dd�dd�dkr.qytjj|j�|_Wnt	t
tfk
r\YnXytjj|j�|_Wqt	t
tfk
r�YqXqWdS)zESet all module __file__ and __cached__ attributes to an absolute path�
__loader__N�
__module__�_frozen_importlib�_frozen_importlib_external)rr)
�set�sys�modules�values�getattrrrr�__file__�AttributeErrorr�	TypeError�
__cached__)�mr
r
r�	abs_pathscsrcCsTg}t�}x6tjD],}t|�\}}||kr|j|�|j|�qW|tjdd�<|S)zK Remove duplicate entries from sys.path along with making them
    absoluteN)rrrr�append�add)�L�known_pathsr	�dircaser
r
r�removeduppathsss
r!cCsXt�}xLtjD]B}y&tjj|�r6t|�\}}|j|�Wqtk
rNwYqXqW|S)zEReturn a set containing all existing file system items from sys.path.)rrrr�existsrrr)�d�item�_�itemcaser
r
r�_init_pathinfo�sr'cCsp|dkrt�}d}nd}tjj||�}yt|d�}Wntk
rHdSX|���xt|�D]�\}}|jd�rrq^yX|jd�r�t|�w^|j	�}t
||�\}}	|	|kr�tjj|�r�tjj
|�|j|	�Wq^tk
�rRtdj|d	|�tjd
�ddl}
x>|
jtj��D],}x$|j�D]}td|tjd
��qW�qWtd
tjd
�PYq^Xq^WWdQRX|�rld}|S)z�Process a .pth file within the site-packages directory:
       For each line in the file, either combine it with sitedir to a path
       and add that to known_paths, or execute it if it starts with 'import '.
    NTF�r�#�import �import	z"Error processing line {:d} of {}:
�)�filerz  z
Remainder of file ignored)r*r+)r'rrr�openr�	enumerate�
startswith�exec�rstriprr"rrr�	Exception�print�format�stderr�	traceback�format_exception�exc_info�
splitlines)�sitedir�namer�reset�fullname�f�n�liner	r r7�recordr
r
r�
addpackage�sD


rCc
Cs�|dkrt�}d}nd}t|�\}}||krBtjj|�|j|�ytj|�}Wntk
rddSXdd�|D�}xt	|�D]}t
|||�q~W|r�d}|S)zTAdd 'sitedir' argument to sys.path if missing and handle .pth files in
    'sitedir'NTFcSsg|]}|jd�r|�qS)z.pth)�endswith)�.0r<r
r
r�
<listcomp>�szaddsitedir.<locals>.<listcomp>)r'rrrrrr�listdirr�sortedrC)r;rr=�sitedircase�namesr<r
r
r�
addsitedir�s$
rKcCs`tjjrdSttd�r4ttd�r4tj�tj�kr4dSttd�r\ttd�r\tj�tj�kr\dSdS)a,Check if user site directory is safe for inclusion

    The function tests for the command line flag (including environment var),
    process uid/gid equal to effective uid/gid.

    None: Disabled for security reasons
    False: Disabled by user (command line option)
    True: Safe and enabled
    F�getuid�geteuidN�getgid�getegidT)	r�flags�no_user_site�hasattrrrMrLrOrNr
r
r
r�check_enableusersite�s
rScCs$tdk	rtSddlm}|d�atS)z�Returns the `user base` directory path.

    The `user base` directory can be used to store data. If the global
    variable ``USER_BASE`` is not initialized yet, this function will also set
    it.
    Nr)�get_config_var�userbase)�	USER_BASE�	sysconfigrT)rTr
r
r�getuserbase�s
rXcCs^t�}tdk	rtSddlm}tjdkrJddlm}|d�rJ|dd�atS|dd	tj�atS)
z�Returns the user-specific site-packages directory path.

    If the global variable ``USER_SITE`` is not initialized yet, this
    function will also set it.
    Nr)�get_path�darwin)rT�PYTHONFRAMEWORK�purelib�osx_framework_userz%s_user)	rX�	USER_SITErWrYr�platformrTrr<)�	user_baserYrTr
r
r�getusersitepackages�s

racCs$t�}tr tjj|�r t||�|S)z�Add a per user site-package to sys.path

    Each user has its own python directory with site-packages in the
    home directory.
    )ra�ENABLE_USER_SITErr�isdirrK)r�	user_siter
r
r�addusersitepackagess
rec	Csg}t�}|dkrt}�x�|D]�}|s||kr2q|j|�tjdkr�|jtjj|ddtj	dd�d��|jtjj|ddtj
dd	�d��n6|j|�|jtjj|dd��|jtjj|dd��tjd
krddlm
}|d
�}|r|jtjjd|dtj
dd	�d��qW|S)aReturns a list containing all global site-packages directories.

    For each directory present in ``prefixes`` (or the global ``PREFIXES``),
    this function will find its `site-packages` subdirectory depending on the
    system environment, and will return a list of full paths.
    N�/�lib64�python�z
site-packages�libzpython%d.%d�rZr)rTr[z/Libraryz%d.%d)r�PREFIXESrr�seprrrr�version�version_infor_rWrT)�prefixes�sitepackages�seen�prefixrT�	frameworkr
r
r�getsitepackages s4





rucCsFtrdtjkrtjdd�x&t|�D]}tjj|�r$t||�q$W|S)z�Add site-packages to sys.path

    '/usr/local' is included in PREFIXES if RPM build is not detected
    to make packages installed into this location visible.

    �RPM_BUILD_ROOTrz
/usr/local)	rbr�environrl�insertrurrcrK)rrpr;r
r
r�addsitepackagesHsrycCs4tjdkrd}nd}tjd|�t_tjd|�t_dS)z�Define new builtins 'quit' and 'exit'.

    These are objects which make the interpreter exit when called.
    The repr of each object contains a hint at how it works.

    �\zCtrl-Z plus ReturnzCtrl-D (i.e. EOF)�quit�exitN)rrm�
_sitebuiltins�Quitter�builtinsr{r|)�eofr
r
r�setquitWs

r�cCs�tjdtj�t_tjdd�dkr2tjdd�t_ntjdd�t_gg}}ttd�r�tj	j
tj�}|jd	d
g�|jtj	j
|tj�|tjg�tjdd||�t_dS)
z)Set 'copyright' and 'credits' in builtins�	copyrightN��java�creditsz?Jython is maintained by the Jython developers (www.jython.org).z�    Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
    for supporting Python development.  See www.python.org for more information.rzLICENSE.txt�LICENSE�licensez'See https://www.python.org/psf/license/)r}�_Printerrr�rr_r�rRrr�dirnamer�extendr�pardir�curdirr�)�files�dirs�herer
r
r�setcopyrightgs 


r�cCstj�t_dS)N)r}�_Helperr�helpr
r
r
r�	sethelpersr�cCsdd�}|t_dS)ajEnable default readline configuration on interactive prompts, by
    registering a sys.__interactivehook__.

    If the readline module can be imported, the hook will set the Tab key
    as completion key and register ~/.python_history as history file.
    This can be overridden in the sitecustomize or usercustomize module,
    or in a PYTHONSTARTUP file.
    cs�ddl}yddl�ddl}Wntk
r0dSXt�dd�}|dk	rZd|krZ�jd�n
�jd�y�j�Wntk
r�YnX�j�dkr�t	j
jt	j
jd�d��y�j
��Wntk
r�YnX��fd	d
�}|j|�dS)Nr�__doc__��libeditzbind ^I rl_completez
tab: complete�~z.python_historycs,y�j��Wnttfk
r&YnXdS)N)�write_history_file�FileNotFoundError�PermissionErrorr
)�history�readliner
r�
write_history�szCenablerlcompleter.<locals>.register_readline.<locals>.write_history)�atexitr��rlcompleter�ImportErrorr�parse_and_bind�read_init_filer�get_current_history_lengthrrr�
expanduser�read_history_file�IOError�register)r�r��readline_docr�r
)r�r�r�register_readline�s.
z,enablerlcompleter.<locals>.register_readlineN)r�__interactivehook__)r�r
r
r�enablerlcompleter�s	0r�cCsFtj}tjdkr$d|kr$tjd}ntj}tjjtjj|��\}}tjj|�}dt_	d}dd�tjj
||�tjj
||�fD�}|�rB|d}d}	t|dd	��`}
xX|
D]P}d
|kr�|jd
�\}}}
|j
�j�}|
j
�}
|dkr�|
j�}	q�|dkr�|
t_	q�WWdQRX|t_t_t|tjg�|	dk�r6tjdtj�ntjgad
a|S)NrZ�__PYVENV_LAUNCHER__z
pyvenv.cfgcSsg|]}tjj|�r|�qSr
)rr�isfile)rE�conffiler
r
rrF�szvenv.<locals>.<listcomp>r�truezutf-8)�encoding�=zinclude-system-site-packages�homeF)rrwrr_�
executabler�splitrr��_homerr.�	partition�strip�lowerrs�exec_prefixryrlrxrb)r�envr��exe_dirr%�site_prefix�
conf_basename�candidate_confs�virtual_conf�system_siter?rA�key�valuer
r
r�venv�s>


r�cCs�yByddl}Wn0tk
r>}z|jdkr,n�WYdd}~XnXWnRtk
r�}z6tjjrltjtj��ntj	j
d|jj|f�WYdd}~XnXdS)z,Run custom site specific code, if available.rN�
sitecustomizez@Error in sitecustomize; set PYTHONVERBOSE for traceback:
%s: %s
)
r�r�r<r3rrP�verbose�
excepthookr9r6�write�	__class__�__name__)r��exc�errr
r
r�execsitecustomize�s
r�cCs�yByddl}Wn0tk
r>}z|jdkr,n�WYdd}~XnXWnRtk
r�}z6tjjrltjtj��ntj	j
d|jj|f�WYdd}~XnXdS)z,Run custom user specific code, if available.rN�
usercustomizez@Error in usercustomize; set PYTHONVERBOSE for traceback:
%s: %s
)
r�r�r<r3rrPr�r�r9r6r�r�r�)r�r�r�r
r
r�execusercustomizes
r�cCsft�t�}t|�}tdkr"t�at|�}t|�}t�t�t	�t
jjsRt
�t�trbt�dS)z�Add standard site-specific directories to the module search path.

    This function is called automatically when this module is imported,
    unless the python interpreter was started with the -S flag.
    N)rr!r�rbrSreryr�r�r�rrP�isolatedr�r�r�)rr
r
r�mainsr�cCs`d}tjdd�}|s�t�}t�}td�xtjD]}td|f�q2Wtd�td|tjj|�rfdndf�td	|tjj|�r�dndf�td
t�tj	d�g}d|kr�|j
t�d
|kr�|j
t�|�r,ttj
j|��tr�tj	d�n6tdk�r
tj	d�n tdk�r tj	d�n
tj	d�n0ddl}t|j|tjdtj
f��tj	d�dS)Na�    %s [--user-base] [--user-site]

    Without arguments print some useful information
    With arguments print the value of USER_BASE and/or USER_SITE separated
    by '%s'.

    Exit codes with --user-base or --user-site:
      0 - user site directory is enabled
      1 - user site directory is disabled by user
      2 - uses site directory is disabled by super user
          or for security reasons
     >2 - unknown error
    r,zsys.path = [z    %r,�]zUSER_BASE: %r (%s)r"z
doesn't existzUSER_SITE: %r (%s)zENABLE_USER_SITE: %rrz--user-basez--user-siteFrkri�
)r�argvrXrar4rrrcrbr|rrVr^�pathsepr�textwrap�dedent)r��argsr`rdr	�bufferr�r
r
r�_script6s@




r��__main__)N)N)N)#r�rrrr}rsr�rlrbr^rVrrr!r'rCrKrSrXrareruryr�r�r�r�r�r�r�r�rP�no_siter�r�r
r
r
r�<module>FsB	
*

(
;43
copyreg.cpython-36.opt-2.pyc000064400000006517150335715140011617 0ustar003


 \_�@s�dddddgZiZddd�Zdd�ZyeWnek
r@YnXdd	�Zeeee�d
d�ZdZdd�Z	dd�Z
dd�Zdd�ZiZ
iZiZdd�Zdd�Zdd�ZdS)�pickle�constructor�
add_extension�remove_extension�clear_extension_cacheNcCs,t|�std��|t|<|dk	r(t|�dS)Nz$reduction functions must be callable)�callable�	TypeError�dispatch_tabler)�ob_type�pickle_function�constructor_ob�r�/usr/lib64/python3.6/copyreg.pyrs
cCst|�std��dS)Nzconstructors must be callable)rr)�objectrrr
rscCst|j|jffS)N)�complex�real�imag)�crrr
�pickle_complex"srcCs<|tkrtj|�}n$|j||�}|jtjkr8|j||�|S)N)r�__new__�__init__)�cls�base�state�objrrr
�_reconstructor)sr��	cCs�x,|jjD]}t|d�r
|jt@r
Pq
Wt}|tkr<d}n ||jkrTtd|j��||�}|j||f}y
|j}WnLt	k
r�t
|dd�r�td��y
|j}Wnt	k
r�d}YnXYnX|�}|r�t||fSt|fSdS)N�	__flags__zcan't pickle %s objects�	__slots__zNa class that defines __slots__ without defining __getstate__ cannot be pickled)
�	__class__�__mro__�hasattrr�	_HEAPTYPErr�__name__�__getstate__�AttributeError�getattr�__dict__r)�self�protorr�args�getstate�dictrrr
�
_reduce_ex6s.



r-cGs|j|f|��S)N)r)rr*rrr
�
__newobj__Wsr.cCs|j|f|�|�S)N)r)rr*�kwargsrrr
�
__newobj_ex__Zsr0c	Cs�|jjd�}|dk	r|Sg}t|d�s(n�x�|jD]�}d|jkr0|jd}t|t�rX|f}xh|D]`}|dkrnq^q^|jd�r�|jd�r�|jj	d�}|r�|j
d||f�q�|j
|�q^|j
|�q^Wq0Wy
||_WnYnX|S)	N�
__slotnames__rr'�__weakref__�__�_z_%s%s)r'r2)r'�getr!r �
isinstance�str�
startswith�endswithr#�lstrip�appendr1)r�namesr�slots�name�strippedrrr
�
_slotnames`s2





r@cCs�t|�}d|kodkns(td��||f}tj|�|krPtj|�|krPdS|tkrltd|t|f��|tkr�td|t|f��|t|<|t|<dS)Nri���zcode out of rangez)key %s is already registered with code %sz$code %s is already in use for key %s)�int�
ValueError�_extension_registryr5�_inverted_registry)�moduler>�code�keyrrr
r�scCsR||f}tj|�|ks$tj|�|kr4td||f��t|=t|=|tkrNt|=dS)Nz%key %s is not registered with code %s)rCr5rDrB�_extension_cache)rEr>rFrGrrr
r�scCstj�dS)N)rH�clearrrrr
r�s)Ni)�__all__rrrr�	NameErrorrrr"r-r.r0r@rCrDrHrrrrrrr
�<module>s,


	!<operator.cpython-36.pyc000064400000033133150335715140011034 0ustar003


 \o*�6@s(dZddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6g6Zd7d8lmZd9d&�Zd:d#�Zd;d	�Zd<d+�Zd=d�Z	d>d
�Z
d?d-�Zd@d5�ZdAd�Z
dBd�ZdCd�ZdDd�ZdEd�ZdFd
�ZdGd�ZdHd�ZeZdId%�ZdJd)�ZdKd*�ZdLd'�ZdMd,�ZdNd.�ZdOd/�ZdPd0�ZdQd1�ZdRd3�ZdSd4�ZdTd6�Z dUd�Z!dVd�Z"dWd�Z#dXd�Z$dYd�Z%dZd�Z&d[d2�Z'dqd\d$�Z(Gd]d�d�Z)Gd^d �d �Z*Gd_d(�d(�Z+d`d�Z,dad�Z-dbd�Z.dcd�Z/ddd�Z0ded�Z1dfd�Z2dgd�Z3dhd�Z4did�Z5djd�Z6dkd�Z7dld!�Z8dmd"�Z9yd7dnl:TWne;k
�rbYnXd7dol:mZeZ<eZ=eZ>eZ?e	Z@e
ZAeZBeZCeZDeZEeZFeZGeZHeZIeZJeZKeZLeZMeZNeZOeZPeZQeZReZSeZTe ZUe!ZVe"ZWe$ZXe%ZYe'ZZe,Z[e-Z\e.Z]e/Z^e0Z_e1Z`e2Zae3Zbe4Zce5Zde6Zee7Zfe8Zge9ZhdpS)ras
Operator Interface

This module exports a set of functions corresponding to the intrinsic
operators of Python.  For example, operator.add(x, y) is equivalent
to the expression x+y.  The function names are those used for special
methods; variants without leading and trailing '__' are also provided
for convenience.

This is the pure Python implementation of the module.
�abs�add�and_�
attrgetter�concat�contains�countOf�delitem�eq�floordiv�ge�getitem�gt�iadd�iand�iconcat�	ifloordiv�ilshift�imatmul�imod�imul�index�indexOf�inv�invert�ior�ipow�irshift�is_�is_not�isub�
itemgetter�itruediv�ixor�le�length_hint�lshift�lt�matmul�methodcaller�mod�mul�ne�neg�not_�or_�pos�pow�rshift�setitem�sub�truediv�truth�xor�)rcCs||kS)zSame as a < b.�)�a�br8r8� /usr/lib64/python3.6/operator.pyr&scCs||kS)zSame as a <= b.r8)r9r:r8r8r;r#scCs||kS)zSame as a == b.r8)r9r:r8r8r;r	#scCs||kS)zSame as a != b.r8)r9r:r8r8r;r+'scCs||kS)zSame as a >= b.r8)r9r:r8r8r;r+scCs||kS)zSame as a > b.r8)r9r:r8r8r;r
/scCs|S)zSame as not a.r8)r9r8r8r;r-5scCs|rdSdS)z*Return True if a is true, False otherwise.TFr8)r9r8r8r;r59scCs||kS)zSame as a is b.r8)r9r:r8r8r;r=scCs||k	S)zSame as a is not b.r8)r9r:r8r8r;rAscCst|�S)zSame as abs(a).)�_abs)r9r8r8r;rGscCs||S)zSame as a + b.r8)r9r:r8r8r;rKscCs||@S)zSame as a & b.r8)r9r:r8r8r;rOscCs||S)zSame as a // b.r8)r9r:r8r8r;r
SscCs|j�S)zSame as a.__index__().)�	__index__)r9r8r8r;rWscCs|S)zSame as ~a.r8)r9r8r8r;r[scCs||>S)zSame as a << b.r8)r9r:r8r8r;r%`scCs||S)zSame as a % b.r8)r9r:r8r8r;r)dscCs||S)zSame as a * b.r8)r9r:r8r8r;r*hscCs||S)zSame as a @ b.r8)r9r:r8r8r;r'lscCs|S)zSame as -a.r8)r9r8r8r;r,pscCs||BS)zSame as a | b.r8)r9r:r8r8r;r.tscCs|
S)zSame as +a.r8)r9r8r8r;r/xscCs||S)zSame as a ** b.r8)r9r:r8r8r;r0|scCs||?S)zSame as a >> b.r8)r9r:r8r8r;r1�scCs||S)zSame as a - b.r8)r9r:r8r8r;r3�scCs||S)zSame as a / b.r8)r9r:r8r8r;r4�scCs||AS)zSame as a ^ b.r8)r9r:r8r8r;r6�scCs(t|d�s dt|�j}t|��||S)z%Same as a + b, for a and b sequences.�__getitem__z!'%s' object can't be concatenated)�hasattr�type�__name__�	TypeError)r9r:�msgr8r8r;r�s
cCs||kS)z(Same as b in a (note reversed operands).r8)r9r:r8r8r;r�scCs&d}x|D]}||kr
|d7}q
W|S)z)Return the number of times b occurs in a.r7�r8)r9r:�count�ir8r8r;r�s

cCs
||=dS)zSame as del a[b].Nr8)r9r:r8r8r;r�scCs||S)z
Same as a[b].r8)r9r:r8r8r;r�scCs.x(t|�D]\}}||kr
|Sq
Wtd��dS)z!Return the first index of b in a.z$sequence.index(x): x not in sequenceN)�	enumerate�
ValueError)r9r:rF�jr8r8r;r�scCs|||<dS)zSame as a[b] = c.Nr8)r9r:�cr8r8r;r2�scCs�t|t�s dt|�j}t|��yt|�Stk
r<YnXyt|�j}Wntk
r`|SXy||�}Wntk
r�|SX|tkr�|St|t�s�dt|�j}t|��|dkr�d}t	|��|S)a2
    Return an estimate of the number of items in obj.
    This is useful for presizing containers when building from an iterable.

    If the object supports len(), the result will be exact. Otherwise, it may
    over- or under-estimate by an arbitrary amount. The result will be an
    integer >= 0.
    z/'%s' object cannot be interpreted as an integerz'__length_hint__ must be integer, not %sr7z$__length_hint__() should return >= 0)
�
isinstance�intr@rArB�len�__length_hint__�AttributeError�NotImplementedrH)�obj�defaultrCZhint�valr8r8r;r$�s4	

c@s4eZdZdZd
Zdd�Zdd�Zdd	�Zd
d�ZdS)raV
    Return a callable object that fetches the given attribute(s) from its operand.
    After f = attrgetter('name'), the call f(r) returns r.name.
    After g = attrgetter('name', 'date'), the call g(r) returns (r.name, r.date).
    After h = attrgetter('name.first', 'name.last'), the call h(r) returns
    (r.name.first, r.name.last).
    �_attrs�_callcsn|s<t|t�std��|f|_|jd���fdd�}||_n.|f||_ttt|j����fdd�}||_dS)Nzattribute name must be a string�.csx�D]}t||�}qW|S)N)�getattr)rQ�name)�namesr8r;�func�s
z!attrgetter.__init__.<locals>.funccst�fdd��D��S)Nc3s|]}|��VqdS)Nr8)�.0�getter)rQr8r;�	<genexpr>�sz4attrgetter.__init__.<locals>.func.<locals>.<genexpr>)�tuple)rQ)�getters)rQr;rZ�s)	rK�strrBrT�splitrUr^�mapr)�self�attrZattrsrZr8)r_rYr;�__init__�s

zattrgetter.__init__cCs
|j|�S)N)rU)rcrQr8r8r;�__call__�szattrgetter.__call__cCs$d|jj|jjdjtt|j��fS)Nz	%s.%s(%s)z, )�	__class__�
__module__�__qualname__�joinrb�reprrT)rcr8r8r;�__repr__szattrgetter.__repr__cCs|j|jfS)N)rgrT)rcr8r8r;�
__reduce__szattrgetter.__reduce__N)rTrU)	rArhri�__doc__�	__slots__rerfrlrmr8r8r8r;r�sc@s4eZdZdZd
Zdd�Zdd�Zdd	�Zd
d�ZdS)r z�
    Return a callable object that fetches the given item(s) from its operand.
    After f = itemgetter(2), the call f(r) returns r[2].
    After g = itemgetter(2, 5, 3), the call g(r) returns (r[2], r[5], r[3])
    �_itemsrUcsF�s �f|_�fdd�}||_n"�f�|_��fdd�}||_dS)Ncs|�S)Nr8)rQ)�itemr8r;rZsz!itemgetter.__init__.<locals>.funccst�fdd��D��S)Nc3s|]}�|VqdS)Nr8)r[rF)rQr8r;r]sz4itemgetter.__init__.<locals>.func.<locals>.<genexpr>)r^)rQ)�items)rQr;rZs)rprU)rcrqrrrZr8)rqrrr;reszitemgetter.__init__cCs
|j|�S)N)rU)rcrQr8r8r;rfszitemgetter.__call__cCs$d|jj|jjdjtt|j��fS)Nz	%s.%s(%s)z, )rgrhrArjrbrkrp)rcr8r8r;rl szitemgetter.__repr__cCs|j|jfS)N)rgrp)rcr8r8r;rm%szitemgetter.__reduce__N)rprU)	rArhrirnrorerfrlrmr8r8r8r;r 	sc@s4eZdZdZdZdd�Zdd�Zd	d
�Zdd�Zd
S)r(z�
    Return a callable object that calls the given method on its operand.
    After f = methodcaller('name'), the call f(r) returns r.name().
    After g = methodcaller('name', 'date', foo=1), the call g(r) returns
    r.name('date', foo=1).
    �_name�_args�_kwargscOsVt|�dkrd}t|��|d}|d|_t|jt�s>td��|dd�|_||_dS)N�z9methodcaller needs at least one argument, the method namer7rDzmethod name must be a string)rMrBrsrKr`rtru)�args�kwargsrCrcr8r8r;re1s
zmethodcaller.__init__cCst||j�|j|j�S)N)rWrsrtru)rcrQr8r8r;rf<szmethodcaller.__call__cCsTt|j�g}|jtt|j��|jdd�|jj�D��d|jj|jj	dj
|�fS)Ncss|]\}}d||fVqdS)z%s=%rNr8)r[�k�vr8r8r;r]Bsz(methodcaller.__repr__.<locals>.<genexpr>z	%s.%s(%s)z, )rkrs�extendrbrtrurrrgrhrArj)rcrwr8r8r;rl?szmethodcaller.__repr__cCsD|js|j|jf|jfSddlm}||j|jf|j�|jfSdS)Nr7)�partial)rurgrsrt�	functoolsr|)rcr|r8r8r;rmGszmethodcaller.__reduce__N)rsrtru)	rArhrirnrorerfrlrmr8r8r8r;r((scCs||7}|S)zSame as a += b.r8)r9r:r8r8r;rQscCs||M}|S)zSame as a &= b.r8)r9r:r8r8r;rVscCs,t|d�s dt|�j}t|��||7}|S)z&Same as a += b, for a and b sequences.r>z!'%s' object can't be concatenated)r?r@rArB)r9r:rCr8r8r;r[s

cCs||}|S)zSame as a //= b.r8)r9r:r8r8r;rcscCs||K}|S)zSame as a <<= b.r8)r9r:r8r8r;rhscCs||;}|S)zSame as a %= b.r8)r9r:r8r8r;rmscCs||9}|S)zSame as a *= b.r8)r9r:r8r8r;rrscCs||}|S)zSame as a @= b.r8)r9r:r8r8r;rwscCs||O}|S)zSame as a |= b.r8)r9r:r8r8r;r|scCs||C}|S)zSame as a **= b.r8)r9r:r8r8r;r�scCs||L}|S)zSame as a >>= b.r8)r9r:r8r8r;r�scCs||8}|S)zSame as a -= b.r8)r9r:r8r8r;r�scCs||}|S)zSame as a /= b.r8)r9r:r8r8r;r!�scCs||N}|S)zSame as a ^= b.r8)r9r:r8r8r;r"�s)�*)rnN)r7)irn�__all__�builtinsrr<r&r#r	r+rr
r-r5rrrrr
rrrr%r)r*r'r,r.r/r0r1r3r4r6rrrrrrr2r$rr r(rrrrrrrrrrrrr!r"�	_operator�ImportError�__lt__�__le__�__eq__�__ne__�__ge__�__gt__�__not__�__abs__�__add__�__and__�__floordiv__r=�__inv__�
__invert__�
__lshift__�__mod__�__mul__�
__matmul__�__neg__�__or__�__pos__�__pow__�
__rshift__�__sub__�__truediv__�__xor__�
__concat__�__contains__�__delitem__r>�__setitem__�__iadd__�__iand__�__iconcat__�
__ifloordiv__�__ilshift__�__imod__�__imul__�__imatmul__�__ior__�__ipow__�__irshift__�__isub__�__itruediv__�__ixor__r8r8r8r;�<module>s�
)')contextlib.cpython-36.pyc000064400000025630150335715140011357 0ustar003


 \j3�@s�dZddlZddlZddlZddlmZddlmZddddd	d
ddgZGd
d�dej	�Z
Gdd�de�ZGdd�dee
�Z
dd�ZGdd�de
�ZGdd�de
�ZGdd
�d
e�ZGdd�de�ZGdd�de
�ZGdd	�d	e
�ZdS)z4Utilities for with-statement contexts.  See PEP 343.�N)�deque)�wraps�contextmanager�closing�AbstractContextManager�ContextDecorator�	ExitStack�redirect_stdout�redirect_stderr�suppressc@s2eZdZdZdd�Zejdd��Zedd��Z	dS)	rz,An abstract base class for context managers.cCs|S)z0Return `self` upon entering the runtime context.�)�selfrr�"/usr/lib64/python3.6/contextlib.py�	__enter__sz AbstractContextManager.__enter__cCsdS)z9Raise any exception triggered within the runtime context.Nr)r
�exc_type�	exc_value�	tracebackrrr�__exit__szAbstractContextManager.__exit__cCs|tkrtj|dd�StS)Nrr)r�_collections_abc�_check_methods�NotImplemented)�cls�Crrr�__subclasshook__sz'AbstractContextManager.__subclasshook__N)
�__name__�
__module__�__qualname__�__doc__r�abc�abstractmethodr�classmethodrrrrrr
sc@s eZdZdZdd�Zdd�ZdS)rzJA base class or mixin that enables context managers to work as decorators.cCs|S)a6Return a recreated instance of self.

        Allows an otherwise one-shot context manager like
        _GeneratorContextManager to support use as
        a decorator via implicit recreation.

        This is a private interface just for _GeneratorContextManager.
        See issue #11647 for details.
        r)r
rrr�_recreate_cm$s
zContextDecorator._recreate_cmcst����fdd��}|S)Nc
s�j���||�SQRXdS)N)r!)�args�kwds)�funcr
rr�inner1s
z(ContextDecorator.__call__.<locals>.inner)r)r
r$r%r)r$r
r�__call__0szContextDecorator.__call__N)rrrrr!r&rrrrr!sc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_GeneratorContextManagerz%Helper for @contextmanager decorator.cCsJ|||�|_||||_|_|_t|dd�}|dkr@t|�j}||_dS)Nr)�genr$r"r#�getattr�typer)r
r$r"r#�docrrr�__init__;s
z!_GeneratorContextManager.__init__cCs|j|j|j|j�S)N)�	__class__r$r"r#)r
rrrr!Isz%_GeneratorContextManager._recreate_cmcCs.y
t|j�Stk
r(td�d�YnXdS)Nzgenerator didn't yield)�nextr(�
StopIteration�RuntimeError)r
rrrrOs
z"_GeneratorContextManager.__enter__cCs�|dkr6yt|j�Wntk
r*dSXtd��n�|dkrD|�}y|jj|||�Wn�tk
r|}z||k	Sd}~Xnftk
r�}z*||kr�dS|tkr�|j|kr�dS�WYdd}~Xn"tj�d|kr�dS�YnXtd��dS)NFzgenerator didn't stop�z#generator didn't stop after throw())r.r(r/r0�throw�	__cause__�sys�exc_info)r
r*�valuer�excrrrrUs.
z!_GeneratorContextManager.__exit__N)rrrrr,r!rrrrrrr'8s
r'cst���fdd��}|S)a�@contextmanager decorator.

    Typical usage:

        @contextmanager
        def some_generator(<arguments>):
            <setup>
            try:
                yield <value>
            finally:
                <cleanup>

    This makes this:

        with some_generator(<arguments>) as <variable>:
            <body>

    equivalent to this:

        <setup>
        try:
            <variable> = <value>
            <body>
        finally:
            <cleanup>

    cst�||�S)N)r')r"r#)r$rr�helper�szcontextmanager.<locals>.helper)r)r$r8r)r$rr�sc@s(eZdZdZdd�Zdd�Zdd�ZdS)	ra2Context to automatically close something at the end of a block.

    Code like this:

        with closing(<module>.open(<arguments>)) as f:
            <block>

    is equivalent to this:

        f = <module>.open(<arguments>)
        try:
            <block>
        finally:
            f.close()

    cCs
||_dS)N)�thing)r
r9rrrr,�szclosing.__init__cCs|jS)N)r9)r
rrrr�szclosing.__enter__cGs|jj�dS)N)r9�close)r
r5rrrr�szclosing.__exit__N)rrrrr,rrrrrrr�sc@s(eZdZdZdd�Zdd�Zdd�ZdS)�_RedirectStreamNcCs||_g|_dS)N)�_new_target�_old_targets)r
�
new_targetrrrr,�sz_RedirectStream.__init__cCs*|jjtt|j��tt|j|j�|jS)N)r=�appendr)r4�_stream�setattrr<)r
rrrr�sz_RedirectStream.__enter__cCstt|j|jj��dS)N)rAr4r@r=�pop)r
�exctype�excinst�exctbrrrr�sz_RedirectStream.__exit__)rrrr@r,rrrrrrr;�sr;c@seZdZdZdZdS)r	aAContext manager for temporarily redirecting stdout to another file.

        # How to send help() to stderr
        with redirect_stdout(sys.stderr):
            help(dir)

        # How to write help() to a file
        with open('help.txt', 'w') as f:
            with redirect_stdout(f):
                help(pow)
    �stdoutN)rrrrr@rrrrr	�sc@seZdZdZdZdS)r
zCContext manager for temporarily redirecting stderr to another file.�stderrN)rrrrr@rrrrr
�sc@s(eZdZdZdd�Zdd�Zdd�ZdS)	ra?Context manager to suppress specified exceptions

    After the exception is suppressed, execution proceeds with the next
    statement following the with statement.

         with suppress(FileNotFoundError):
             os.remove(somefile)
         # Execution still resumes here if the file was already removed
    cGs
||_dS)N)�_exceptions)r
�
exceptionsrrrr,�szsuppress.__init__cCsdS)Nr)r
rrrr�szsuppress.__enter__cCs|dk	ot||j�S)N)�
issubclassrH)r
rCrDrErrrr�s
zsuppress.__exit__N)rrrrr,rrrrrrr�s	c@sPeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)ra�Context manager for dynamic management of a stack of exit callbacks

    For example:

        with ExitStack() as stack:
            files = [stack.enter_context(open(fname)) for fname in filenames]
            # All opened files will automatically be closed at the end of
            # the with statement, even if attempts to open files later
            # in the list raise an exception

    cCst�|_dS)N)r�_exit_callbacks)r
rrrr,szExitStack.__init__cCst|��}|j|_t�|_|S)z?Preserve the context stack by transferring it to a new instance)r*rKr)r
�	new_stackrrr�pop_alls
zExitStack.pop_allcs"��fdd�}�|_|j|�dS)z:Helper to correctly register callbacks to __exit__ methodscs��f|��S)Nr)�exc_details)�cm�cm_exitrr�
_exit_wrappersz.ExitStack._push_cm_exit.<locals>._exit_wrapperN)�__self__�push)r
rOrPrQr)rOrPr�
_push_cm_exitszExitStack._push_cm_exitcCsDt|�}y
|j}Wn tk
r2|jj|�YnX|j||�|S)aRegisters a callback with the standard __exit__ method signature

        Can suppress exceptions the same way __exit__ methods can.

        Also accepts any object with an __exit__ method (registering a call
        to the method instead of the object itself)
        )r*r�AttributeErrorrKr?rT)r
�exit�_cb_type�exit_methodrrrrS s

zExitStack.pushcs$���fdd�}�|_|j|��S)z\Registers an arbitrary callback and arguments.

        Cannot suppress exceptions.
        cs����dS)Nr)rr7�tb)r"�callbackr#rrrQ9sz)ExitStack.callback.<locals>._exit_wrapper)�__wrapped__rS)r
rZr"r#rQr)r"rZr#rrZ4s
zExitStack.callbackcCs(t|�}|j}|j|�}|j||�|S)z�Enters the supplied context manager

        If successful, also pushes its __exit__ method as a callback and
        returns the result of the __enter__ method.
        )r*rrrT)r
rO�_cm_type�_exit�resultrrr�
enter_contextAs

zExitStack.enter_contextcCs|jddd�dS)z$Immediately unwind the context stackN)r)r
rrrr:NszExitStack.closec	s�|ddk	}tj�d��fdd�}d}d}x\|jr�|jj�}y||�rTd}d}d}Wq.tj�}||d|d�d}|}Yq.Xq.W|r�y|dj}|d�Wn tk
r�||d_�YnX|o�|S)Nrr1cs8x,|j}||krdS|dks$|�kr&P|}qW||_dS)N)�__context__)�new_exc�old_exc�exc_context)�	frame_excrr�_fix_exception_contextXsz2ExitStack.__exit__.<locals>._fix_exception_contextFT)NNN)r4r5rKrBr`�
BaseException)	r
rN�received_excre�suppressed_exc�
pending_raise�cb�new_exc_details�	fixed_ctxr)rdrrRs2


zExitStack.__exit__N)rrrrr,rMrTrSrZr_r:rrrrrrs

)rrr4r�collectionsr�	functoolsr�__all__�ABCr�objectrr'rrr;r	r
rrrrrr�<module>s$I"uu.cpython-36.opt-1.pyc000064400000006654150335715140010601 0ustar003


 \k�@sddZddlZddlZddlZdddgZGdd�de�Zd
dd�Zdd	d�Zd
d�Z	e
dkr`e	�dS)z�Implementation of the UUencode and UUdecode functions.

encode(in_file, out_file [,name, mode])
decode(in_file [, out_file, mode])
�N�Error�encode�decodec@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/uu.pyr'scCsBg}�z|dkrtjj}n`t|t�rz|dkr8tjj|�}|dkrfytj|�j	}Wnt
k
rdYnXt|d�}|j|�|dkr�tj
j}nt|t�r�t|d�}|j|�|dkr�d}|dkr�d}|jd|d@|fjd��|jd	�}x,t|�d
k�r|jtj|��|jd	�}q�W|jd�Wdx|D]}|j��q*WXdS)z
Uuencode file�-N�rb�wbi�zbegin %o %s
i��ascii�-rs 
end
)�sys�stdin�buffer�
isinstance�str�os�path�basename�stat�st_mode�AttributeError�open�append�stdout�writer�read�len�binasciiZb2a_uu�close)�in_file�out_file�name�mode�opened_files�data�frrr	r*s>









Fc
Cs:g}|dkrtjj}nt|t�r4t|d�}|j|��z�xr|j�}|sNtd��|j	d�sZq:|j
dd�}t|�dkr:|ddkr:yt|d	d
�PWq:t
k
r�Yq:Xq:W|dkr�|djd�jd
�}tjj|�r�td|��|dkr�t|d	d
�}|dk�r
tjj}nNt|t��rXt|d�}ytjj||�Wntk
�rHYnX|}|j|�|j�}x�|�r|jd�dk�rytj|�}	Wnjtjk
�r�}
zJ|ddd@ddd}tj|d|��}	|�s�tjjd|
�WYdd}
~
XnX|j|	�|j�}�qbW|�std��Wdx|D]}|j��q"WXdS)zDecode uuencoded filer
rz'No valid begin line found in input filesbegin� ��r��Ns 	
r
z"Cannot overwrite existing file: %srsend� �?��zWarning: %s
zTruncated input file)rrrrrrr�readliner�
startswith�splitr�int�
ValueError�rstriprrr�existsr�chmodr�stripr Za2b_uu�stderrrr!)
r"r#r%�quietr&ZhdrZ	hdrfields�fp�sr'�v�nbytesr(rrr	rZsf









"

cCs4ddl}|jdd�}|jddddd	d
d�|jdd
ddd	d
d�|j�\}}t|�dkrl|jd�tjd�tjj	}tj
j	}t|�dkr�|d}t|�dkr�|d}|jr�|jr�t
|t�r�t|d�}nttjdd�tjd�t||�nD|j�r&t
|t��rt|d�}nttjdd�tjd�t||�dS)zuuencode/uudecode main programrNz'usage: %prog [-d] [-t] [input [output]])Zusagez-dz--decoderzDecode (instead of encode)?F�
store_true)�dest�help�default�actionz-tz--text�textz2data is text, encoded format unix-compatible text?r*zincorrect number of argumentsr,rz: cannot do -t to stdoutrz: cannot do -t from stdin)�optparseZOptionParserZ
add_option�
parse_argsr�errorr�exitrrrrrFrrr�print�argvr)rG�parserZoptions�args�input�outputrrr	�test�s6




rQ�__main__)NN)NNF)�__doc__r rr�__all__�	ExceptionrrrrQrrrrr	�<module>s

0
F&locale.cpython-36.opt-2.pyc000064400000071356150335715140011411 0ustar003


 \�-�]@sddlZddlZddlZddlZddlZddlmZddlZddddddd	d
ddd
ddddddddddddgZ	dd�Z
dd�ZyddlTWnLe
k
r�dZd Zd!ZdZd"Zd#Zd$Zd%ZeZd&d	�Z�d�d'd�ZYnXde�kr�eZd
e�kr�e
ZeZiZeje�d(d	��Zd)d*�Z �d�d,d-�Z!d.d/�Z"ej#d0�Z$�d�d1d�Z%�d�d2d3�Z&�d�d4d�Z'�d�d6d�Z(d7d�Zd8d9�Z)e*fd:d
�Z+d;d�Z,d<d=�Z-eZ.d>d?�Z/d@dA�Z0dBd�Z1dCdD�Z2dEdF�Z3�d�dId�Z4efdJd�Z5�d�dKd�ZefdLd�Z6ej7j8dM��r�d�dNd�Z9n8ye:Wn"e;k
�r2�d�dOd�Z9YnX�d�dPd�Z9dQdQdRdSdSdTdUdVdWdXdRdYdZd[dRdRdRd\d]d^d_d[d`dYdadbdZdcdddedfdSdgdhdTdidjdkdldmdndVdWdXdo�,Z<x2e=e<j>��D]"\Z?Z@e?jAdpdq�Z?e<jBe?e@��q�Wdrdrdrdsdtdudvdvdwdxdydydzd{d|d}d}d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d}d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�dQd�dQdQdzd�dQdQd�d�d�d�d�d�d�d�dzd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�dzd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�dzd�d�d�d�d�d�d�dzd�dzdQdzd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d��d�d�d�d�d�d�d�d�d�d�d�d�d�d	�d
d��d�d	�d�d	�d	�d	�d�d	�d
�d�d�d�d�d�d�d�dd�d�d�d��d�d�d�dd̐d�d�d�d�d�d�d�d�d�d�d�d�d�dd�d�d��d�d�d�d�d�d �d!�d"�d#�d$�d%�d%�d&�d'�d%�d%�d$�d$dzd�dzd�dzd�d(�d)�d(�d(�d*�d*�d*�d�d�d+�d,�d,�d,�d-�d-�d,�d,�d,�d,�d,�d.�d.�d.�d/�d.�d0�d1�d2�d2�d3�d4�d4�d5�d5�d5�d6�d5�d5�d7�d7�d8�d9�d:�d:�d;�d;�d<�d=�d>�d?�d@�dA�dB�dC�dC�dD�dD�dC�dA�dA�dE�dE�dF�dG�dH�dH�dI�dJ�dK�dL�dM�dM�dN�dO�dP�dP�dQ�dQ�dR�dS�dT�dT�dU�dU�dV�dV�dW�dXd�d��dY�dZ�d[�d\�d]�d^dƐd_d�dƐd`�d`�da�db�da�da�da�da�dc�dc�dd�dd�db�db�d`�de�de�df�dg�dh�dh�di�dj�dj�dk�dl�dm�dn�do�dp�do�dq�dq�dr�dr�dr�ds�dtdQdQ�du�du�dv�ds�dt�ds�dw�dx�dy�dy�dy�dz�dz�d{�dy�d|�d}�d}�d~�d�d��d��d��d��d��d��d��d��d��d��d�d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d�d�d�d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d�d��d��d��d��d��d��d��d��d��d��d��d��d��d��dddÐdÐdĐdŐdƐdǐdǐdȐdȐdɐdʐd�d��d̐d�d��dΐdΐdϐdАd�d�d��dѐdѐdҐ�LZC�dӐdԐdՐd֐dאdؐdِdڐdېdܐdݐdސdߐd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d��d��d��d��d��d��d��d��d��d��d��d�d�d�d�d�d�d�d�d�d	�d
�d�d�d
�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d �d!�d"�d#�d$�d%�d&�d'�d(�d)�d*�d+�d,�d,�d-�d.�d/�d0�d1�d2�d3�d4�d5�d6�d7�d8�d9�d:�d;�d<�d=�d>�d?�d@�dA�dB�dC�dD�dE�dF�dG�dH�dI�dJ�dK�dL�dM�dN�dO�dP�dQ�dR�dS�dT�dU�dV�dW�dX�dY�dZ�d[�d\�d]�d^�d_�d`�da�db�dc�dd�de�dd�de�df�dg�dh�di�dj�dk�dl�dk�dm�dn�do�dp�dq�dr�ds�dt�du�dv�dw�dx�dy�dz�d{�d|�d}�d~�d�d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d���ZD�d��d��ZEyeWne;k
�
r�YnXe	jF�d��eG�d�k�reH�d��eH�eE�eH�eH�d��eH�e-�dS(��N)�str�	getlocale�getdefaultlocale�getpreferredencoding�Error�	setlocale�resetlocale�
localeconv�strcoll�strxfrmr�atof�atoi�format�
format_string�currency�	normalize�LC_CTYPE�
LC_COLLATE�LC_TIME�LC_MONETARY�
LC_NUMERIC�LC_ALL�CHAR_MAXcCs||k||kS)N�)�a�brr�/usr/lib64/python3.6/locale.py�_strcoll!srcCs|S)Nr)�srrr�_strxfrm'sr)�*�������cCs,dgddddgddddddddddddd�S)Nr!��.)�grouping�currency_symbol�n_sign_posn�
p_cs_precedes�
n_cs_precedes�mon_grouping�n_sep_by_space�
decimal_point�
negative_sign�
positive_sign�p_sep_by_space�int_curr_symbol�p_sign_posn�
thousands_sep�mon_thousands_sep�frac_digits�mon_decimal_point�int_frac_digitsrrrrrr	?s$cCs|dkrtd��dS)Nr(�Cz*_locale emulation only supports "C" locale)Nr(r<)r)�category�valuerrrrWscCst�}tr|jt�|S)N)�_localeconv�_override_localeconv�update)�drrrr	ls
ccsPd}xF|D]>}|tkrdS|dkr>|dkr2td��x
|Vq4W|V|}q
WdS)Nrzinvalid grouping)r�
ValueError)r*Z
last_interval�intervalrrr�_grouping_intervalszs

rEFc
Cs�t�}||rdpd}||r dp"d}|s2|dfS|d
dkr\|j�}|t|�d�}|}nd}d}g}xNt|�D]B}	|s�|dd	kr�|}d}P|j||	d��|d|	�}qrW|r�|j|�|j�||j|�|t|�t|�dfS)Nr8r7r/r*rr&� r(�
0123456789���rH)r	�rstrip�lenrE�append�reverse�join)
r�monetary�convr7r*�strippedZright_spacesZleft_spaces�groupsrDrrr�_group�s0
rRcCsld}x$|r(||dkr(|d7}|d8}qWt|�d}x$|rZ||dkrZ|d8}|d8}q8W|||d�S)NrrFr&)rJ)rZamountZlposZrposrrr�_strip_padding�srSzG%(?:\((?P<key>.*?)\))?(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]cGsHtj|�}|s$t|j��t|�kr4tdt|���t||||f|��S)NzHformat() must be given exactly one %%char format specifier, %s not valid)�_percent_re�matchrJ�grouprC�repr�_format)�percentr>r*rN�
additionalrUrrrr�s

c	Gs�|r||f|}n||}|d	dkr~d}|jd�}|rRt|d|d�\|d<}t�|r^dp`d}|j|�}|r�t||�}n2|d
dkr�d}|r�t||d�\}}|r�t||�}|S)Nr&ZeEfFgGrr))rNr:r1ZdiurHrH)�splitrRr	rMrS)	rYr>r*rNrZZ	formattedZseps�partsr1rrrrX�s(


rXc	Csttj|��}tjd|�}t|tj�rlg}x�|D]6}|j�ddkrP|jd�q0|jt	|j�||��q0Wn�t|t
�s||f}g}d}xz|D]r}|j�d	dkr�|jd�q�|jd�jd�}|jt|j�|||df||d|d|����|d|7}q�Wt
|�}||S)
Nz%sr&�%rZ	modifiersr FrHrH)
�listrT�finditer�sub�
isinstance�collections�MappingrVrKr�tuple�countrX)	�f�valr*ZpercentsZnew_fZnew_valZperc�iZ	starcountrrrr�s0


TcCsft�}||rdpd}|dkr&td��td|t|�|dd�}d|d	}|r�||rXd
pZd}||dkrld
pnd}||dkr�dp�d}	|r�||	r�dp�d|}n||	r�dp�d|}||dkr�dp�d}
||dkr�dp�d}|
dkr�d|d}n`|
dk�r||}nL|
dk�r||}n8|
dk�r2|jd|�}n |
dk�rJ|jd	|�}n||}|jdd�jd	d�S)Nr;r9r!z9Currency formatting is not possible using the 'C' locale.z%%.%ifT)rN�<�>r5r+rr.r-r0r4rFr(r,r6r2r3�(�)r&r'r#r%)r	rCr�abs�replace)rgZsymbolr*Z
internationalrOZdigitsrZsmbZprecedesZ	separatedZsign_posZsignrrrr�s6





cCs
td|�S)Nz%.12g)r)rgrrrr+scCs:t�}|d}|r|j|d�}|d}|r6|j|d�}|S)Nr7r(r1r))r	rn)�stringrO�tsZddrrr�
delocalize/srqcCs|t|��S)N)rq)ro�funcrrrr?scCstt|��S)N)�intrq)rorrrr
CscCsBttd�tddd�}t|dt|��td�}t|dt|��dS)Nr(z%di�[r&�isg��Q�	@)rrr�printr
rr)�s1rrr�_testGs

rwcCs�d|kr|d|jd��}n|}tj|�}tjjj|j�|�}|}|j�}|tkr\t|}n(|jdd�}|jdd�}|tkr�t|}|d|S)Nr)�_r(�-)�index�	encodings�normalize_encoding�aliases�get�lower�locale_encoding_aliasrn)�code�encoding�langname�
norm_encodingrrr�_replace_encodingYs

r�cCsR|dkrFd|kr|dS|jd�\}}}|dkr4|S|dkrFt|d�S|d|S)	N�euror)z.ISO8859-15�
ISO8859-15�UTF-8z	ISO8859-1�@)r�r�)�	partitionr�)r��modifierrxr�rrr�_append_modifierps
r�c	Cs�|j�}d|kr|jdd�}d|kr6|jdd�\}}nd}d|krZ|jd�dd�\}}n|}d}|}|r�|jdd�}|jdd�}|d|7}|}|r�|d|7}tj|d�}|dk	r�|S|�rtj|d�}|dk	�rd|kr�t||�S|jdd�dj�|k�r|S|�r�|}|�r"|d|7}tj|d�}|dk	�rnd|k�rLt||�S|jdd�\}}t||�d|S|�r�tj|d�}|dk	�r�d|k�r�t||�}t||�S|jdd�\}}|j�|k�r�t||�d|S|S)	N�:r)r�r&r(r'ryrx)rrnr[�locale_aliasr~r�r�)	�
localenamer�r�r�r�Zlang_encr�Zlookup_nameZdefmodrrrr{s`








cCsrt|�}d|kr8|jdd�\}}|dkr8d|kr8|dfSd|krVt|jd�dd��S|dkrbd	Std|��dS)
Nr�r&r�r)ziso-8859-15r'r<zunknown locale: %s)NN)rr[rdrC)r�r�r�rrr�_parse_localename�sr�cCsVy0|\}}|dkrd}|dkr"|S|d|SWn ttfk
rPtd��YnXdS)Nr<r)zXLocale must be None, a string, or an iterable of two strings -- language code, encoding.)�	TypeErrorrC)ZlocaletupleZlanguager�rrr�_build_localename�sr��LANG�LANGUAGEcCs�yddl}|j�\}}Wnttfk
r0Yn8Xtjdkr`|r`|dd�dkr`tjt|d��}||fSddl	}|j
j}x6|D]*}||d�}|r~|dkr�|jd�d}Pq~Wd}t|�S)NrZwin32r'Z0xr�r�r<)
�_localeZ_getdefaultlocale�ImportError�AttributeError�sys�platform�windows_localer~rs�os�environr[r�)Zenvvarsr�r�r�r��lookupZvariabler�rrrrs$

cCs(t|�}|tkr d|kr td��t|�S)N�;z category LC_ALL is not supported)�
_setlocalerr�r�)r=r�rrrr5s
cCs&|rt|t�rtt|��}t||�S)N)ra�_builtin_strrr�r�)r=ZlocalerrrrGscCst|tt���dS)N)r�r�r)r=rrrrXs�wincCsddl}|jd�S)NrF)�_bootlocaler)�do_setlocaler�rrrrdscCst�d}|dkrd}|S)Nr&�ascii)r)r��resrrrrns
cCsTddl}|r8tt�}yttd�Wntk
r6YnX|jd�}|rPtt|�|S)Nrr(F)r�rrrr)r�r�Zoldloc�resultrrrrws

r<z	ISO8859-1ZJIS7ZeucJPzKOI8-CZCP1251ZCP1255ZCP1256z	ISO8859-2z	ISO8859-5z
ISO8859-15z
ISO8859-10z
ISO8859-11z
ISO8859-13z
ISO8859-14z
ISO8859-16z	ISO8859-3z	ISO8859-4z	ISO8859-6z	ISO8859-7z	ISO8859-8z	ISO8859-9ZSJISZTACTISZeucKRzUTF-8zKOI8-RzKOI8-TzKOI8-UZRK1048),�437�c�enZjisZjis7ZajecZkoi8cZmicrosoftcp1251Zmicrosoftcp1255Zmicrosoftcp1256Z88591Z88592Z88595Z885915r��latin_1�	iso8859_1�
iso8859_10�
iso8859_11�
iso8859_13�
iso8859_14�
iso8859_15�
iso8859_16�	iso8859_2�	iso8859_3�	iso8859_4�	iso8859_5�	iso8859_6�	iso8859_7�	iso8859_8�	iso8859_9�
iso2022_jp�	shift_jis�tactis�euc_jp�euc_kr�utf_8�koi8_rZkoi8_tZkoi8_u�kz1048�cp1251�cp1255�cp1256rxr(zaz_AZ.KOI8-Czaa_DJ.ISO8859-1zaa_ER.UTF-8zaa_ET.UTF-8zaf_ZA.ISO8859-1zagr_PE.UTF-8zak_GH.UTF-8zam_ET.UTF-8zen_US.ISO8859-1zan_ES.ISO8859-15zanp_IN.UTF-8zar_AA.ISO8859-6zar_AE.ISO8859-6zar_BH.ISO8859-6zar_DZ.ISO8859-6zar_EG.ISO8859-6zar_IN.UTF-8zar_IQ.ISO8859-6zar_JO.ISO8859-6zar_KW.ISO8859-6zar_LB.ISO8859-6zar_LY.ISO8859-6zar_MA.ISO8859-6zar_OM.ISO8859-6zar_QA.ISO8859-6zar_SA.ISO8859-6zar_SD.ISO8859-6zar_SS.UTF-8zar_SY.ISO8859-6zar_TN.ISO8859-6zar_YE.ISO8859-6zas_IN.UTF-8zast_ES.ISO8859-15zayc_PE.UTF-8zaz_AZ.ISO8859-9Ezaz_IR.UTF-8zbe_BY.CP1251zbe_BY.UTF-8@latinzbg_BG.UTF-8zbem_ZM.UTF-8zber_DZ.UTF-8zber_MA.UTF-8zbg_BG.CP1251zbhb_IN.UTF-8zbho_IN.UTF-8zbho_NP.UTF-8zbi_VU.UTF-8zbn_BD.UTF-8zbn_IN.UTF-8zbo_CN.UTF-8zbo_IN.UTF-8znb_NO.ISO8859-1zbr_FR.ISO8859-1zbrx_IN.UTF-8zbs_BA.ISO8859-2zbyn_ER.UTF-8zfr_CA.ISO8859-1zen_US.UTF-8zca_ES.ISO8859-1zca_AD.ISO8859-1zca_ES.UTF-8@valenciazca_FR.ISO8859-1zca_IT.ISO8859-1zce_RU.UTF-8zzh_CN.eucCNzzh_TW.eucTWzchr_US.UTF-8zckb_IQ.UTF-8zcmn_TW.UTF-8zcrh_UA.UTF-8zhr_HR.ISO8859-2zcs_CZ.ISO8859-2zcsb_PL.UTF-8zcv_RU.UTF-8zcy_GB.ISO8859-1zda_DK.ISO8859-1zde_DE.ISO8859-1zde_AT.ISO8859-1zde_BE.ISO8859-1zde_CH.ISO8859-1zde_IT.ISO8859-1zde_LI.UTF-8zde_LU.ISO8859-1zdoi_IN.UTF-8znl_NL.ISO8859-1znl_BE.ISO8859-1zdv_MV.UTF-8zdz_BT.UTF-8zee_EE.ISO8859-4zet_EE.ISO8859-1zel_GR.ISO8859-7zel_CY.ISO8859-7zel_GR.ISO8859-15zen_AG.UTF-8zen_AU.ISO8859-1zen_BE.ISO8859-1zen_BW.ISO8859-1zen_CA.ISO8859-1zen_DK.ISO8859-1zen_DL.UTF-8zen_GB.ISO8859-1zen_HK.ISO8859-1zen_IE.ISO8859-1zen_IL.UTF-8zen_IN.ISO8859-1zen_NG.UTF-8zen_NZ.ISO8859-1zen_PH.ISO8859-1zen_SC.UTF-8zen_SG.ISO8859-1zen_US.ISO8859-15zen_ZA.ISO8859-1zen_ZM.UTF-8zen_ZW.ISO8859-1zen_ZS.UTF-8zen_EN.ISO8859-1zeo_XX.ISO8859-3zeo.UTF-8zeo_EO.ISO8859-3zeo_US.UTF-8zes_ES.ISO8859-1zes_AR.ISO8859-1zes_BO.ISO8859-1zes_CL.ISO8859-1zes_CO.ISO8859-1zes_CR.ISO8859-1zes_CU.UTF-8zes_DO.ISO8859-1zes_EC.ISO8859-1zes_GT.ISO8859-1zes_HN.ISO8859-1zes_MX.ISO8859-1zes_NI.ISO8859-1zes_PA.ISO8859-1zes_PE.ISO8859-1zes_PR.ISO8859-1zes_PY.ISO8859-1zes_SV.ISO8859-1zes_US.ISO8859-1zes_UY.ISO8859-1zes_VE.ISO8859-1zet_EE.ISO8859-15zeu_ES.ISO8859-1zeu_FR.ISO8859-1zfa_IR.UTF-8zfa_IR.ISIRI-3342zff_SN.UTF-8zfi_FI.ISO8859-15zfil_PH.UTF-8zfi_FI.ISO8859-1zfo_FO.ISO8859-1zfr_FR.ISO8859-1zfr_BE.ISO8859-1zfr_CH.ISO8859-1zfr_LU.ISO8859-1zfur_IT.UTF-8zfy_DE.UTF-8zfy_NL.UTF-8zga_IE.ISO8859-1zgl_ES.ISO8859-1zgd_GB.ISO8859-1zgez_ER.UTF-8zgez_ET.UTF-8zgu_IN.UTF-8zgv_GB.ISO8859-1zha_NG.UTF-8zhak_TW.UTF-8zhe_IL.ISO8859-8zhi_IN.ISCII-DEVzhif_FJ.UTF-8zhne_IN.UTF-8zhsb_DE.ISO8859-2zht_HT.UTF-8zhu_HU.ISO8859-2zhy_AM.UTF-8zhy_AM.ARMSCII_8zia.UTF-8zia_FR.UTF-8zis_IS.ISO8859-1zid_ID.ISO8859-1zig_NG.UTF-8zik_CA.UTF-8zit_IT.ISO8859-1zit_CH.ISO8859-1ziu_CA.NUNACOM-8ziw_IL.UTF-8zja_JP.eucJPz
ja_JP.SJISzka_GE.GEORGIAN-ACADEMYzka_GE.GEORGIAN-PSzkab_DZ.UTF-8z
kk_KZ.ptcp154zkl_GL.ISO8859-1zkm_KH.UTF-8zkn_IN.UTF-8zko_KR.eucKRzkok_IN.UTF-8zks_IN.UTF-8zks_IN.UTF-8@devanagarizku_TR.ISO8859-9zkw_GB.ISO8859-1zky_KG.UTF-8zlb_LU.UTF-8zlg_UG.ISO8859-10zli_BE.UTF-8zli_NL.UTF-8zlij_IT.UTF-8zlt_LT.ISO8859-13zln_CD.UTF-8zlo_LA.MULELAO-1zlo_LA.IBM-CP1133zlv_LV.ISO8859-13zlzh_TW.UTF-8zmag_IN.UTF-8zmai_IN.UTF-8zmai_NP.UTF-8zmfe_MU.UTF-8zmg_MG.ISO8859-15zmhr_RU.UTF-8zmi_NZ.ISO8859-1zmiq_NI.UTF-8zmjw_IN.UTF-8zmk_MK.ISO8859-5zml_IN.UTF-8zmn_MN.UTF-8zmni_IN.UTF-8zmr_IN.UTF-8zms_MY.ISO8859-1zmt_MT.ISO8859-3zmy_MM.UTF-8znan_TW.UTF-8znds_DE.UTF-8znds_NL.UTF-8zne_NP.UTF-8znhn_MX.UTF-8zniu_NU.UTF-8zniu_NZ.UTF-8znl_AW.UTF-8znn_NO.ISO8859-1zno_NO.ISO8859-1zny_NO.ISO8859-1znr_ZA.ISO8859-1znso_ZA.ISO8859-15zoc_FR.ISO8859-1zom_ET.UTF-8zom_KE.ISO8859-1zor_IN.UTF-8zos_RU.UTF-8zpa_IN.UTF-8zpa_PK.UTF-8zpap_AN.UTF-8zpap_AW.UTF-8zpap_CW.UTF-8zpd_US.ISO8859-1zpd_DE.ISO8859-1zph_PH.ISO8859-1zpl_PL.ISO8859-2zpt_PT.ISO8859-1zpt_BR.ISO8859-1zpp_AN.ISO8859-1zps_AF.UTF-8zquz_PE.UTF-8zraj_IN.UTF-8zro_RO.ISO8859-2zru_RU.UTF-8zru_UA.KOI8-Uzru_RU.KOI8-Rzrw_RW.ISO8859-1zsa_IN.UTF-8zsat_IN.UTF-8zsc_IT.UTF-8zsd_IN.UTF-8zsd_IN.UTF-8@devanagarizsd_PK.UTF-8zse_NO.UTF-8zsr_RS.UTF-8@latinzsgs_LT.UTF-8zsr_CS.ISO8859-2zsh_HR.ISO8859-2zshn_MM.UTF-8zshs_CA.UTF-8zsi_LK.UTF-8zsid_ET.UTF-8zsk_SK.ISO8859-2zsl_SI.ISO8859-2zsl_CS.ISO8859-2zsm_WS.UTF-8zso_DJ.ISO8859-1zso_ET.UTF-8zso_KE.ISO8859-1zso_SO.ISO8859-1zsr_CS.ISO8859-5zsq_AL.ISO8859-2zsq_MK.UTF-8zsr_RS.UTF-8zsr_CS.UTF-8@latinzsr_CS.UTF-8zsr_ME.UTF-8zsr_CS.CP1251zss_ZA.ISO8859-1zst_ZA.ISO8859-1zsv_SE.ISO8859-1zsv_FI.ISO8859-1zsw_KE.UTF-8zsw_TZ.UTF-8zszl_PL.UTF-8z
ta_IN.TSCII-0zta_LK.UTF-8ztcy_IN.UTF-8zte_IN.UTF-8ztg_TJ.KOI8-Czth_TH.ISO8859-11zth_TH.TIS620zthe_NP.UTF-8zti_ER.UTF-8zti_ET.UTF-8ztig_ER.UTF-8ztk_TM.UTF-8ztl_PH.ISO8859-1ztn_ZA.ISO8859-15zto_TO.UTF-8ztpi_PG.UTF-8ztr_TR.ISO8859-9ztr_CY.ISO8859-9zts_ZA.ISO8859-1ztt_RU.TATAR-CYRztt_RU.UTF-8@iqtelifzug_CN.UTF-8zuk_UA.KOI8-Uz	en_US.utfzunm_US.UTF-8zur_PK.CP1256zur_IN.UTF-8zuz_UZ.UTF-8zve_ZA.UTF-8z
vi_VN.TCVNzvi_VN.VISCIIzwa_BE.ISO8859-1zwae_CH.UTF-8zwal_ET.UTF-8zwo_SN.UTF-8zxh_ZA.ISO8859-1zyi_US.CP1255zyo_NG.UTF-8zyue_HK.UTF-8zyuw_PG.UTF-8zzh_CN.gb2312z
zh_TW.big5zzh_HK.big5hkscszzh_SG.GB2312z	zh_SG.GBKzzu_ZA.ISO8859-1(LZa3Za3_azz
a3_az.koicZaa_djZaa_erZaa_etZafZaf_zaZagr_peZak_ghZamZam_etZamericanZan_esZanp_in�arZar_aaZar_aeZar_bhZar_dzZar_egZar_inZar_iqZar_joZar_kwZar_lbZar_lyZar_maZar_omZar_qaZar_saZar_sdZar_ssZar_syZar_tnZar_ye�arabic�asZas_inZast_esZayc_peZazZaz_azzaz_az.iso88599eZaz_irZbezbe@latinz
be_bg.utf8Zbe_byzbe_by@latinZbem_zmZber_dzZber_maZbgZbg_bgzbhb_in.utf8Zbho_inZbho_npZbi_vuZbn_bdZbn_inZbo_cnZbo_inZbokmalubokmål�brZbr_frZbrx_inZbsZbs_baZ	bulgarianZbyn_err�zc-frenchzc.asciizc.enz
c.iso88591zc.utf8Zc_czc_c.cZcaZca_adZca_eszca_es@valenciaZca_frZca_itZcatalanZce_ruZcextendz	chinese-sz	chinese-tZchr_usZckb_iqZcmn_twZcrh_uaZcroatianZcsZcs_csZcs_czZcsb_plZcv_ruZcyZcy_gbZczZcz_czZczechZdaZda_dkZdanishZdanskZdeZde_atZde_beZde_chZde_deZde_itz
de_li.utf8Zde_luZdeutschZdoi_inZdutchzdutch.iso88591Zdv_mvZdz_btZeeZee_eeZeestiZelZel_cyZel_grz
el_gr@euror�Zen_agZen_auZen_beZen_bwZen_caZen_dkz
en_dl.utf8Zen_gbZen_hkZen_ieZen_ilZen_inZen_ngZen_nzZen_phz
en_sc.utf8Zen_sgZen_ukZen_uszen_us@euro@euroZen_zaZen_zmZen_zwz
en_zw.utf8Zeng_gbZenglishzenglish.iso88591Z
english_ukzenglish_united-stateszenglish_united-states.437Z
english_usZeozeo.utf8Zeo_eoz
eo_us.utf8Zeo_xxZesZes_arZes_boZes_clZes_coZes_crZes_cuZes_doZes_ecZes_esZes_gtZes_hnZes_mxZes_niZes_paZes_peZes_prZes_pyZes_svZes_usZes_uyZes_veZestonianZetZet_eeZeuZeu_esZeu_frZfaZfa_irzfa_ir.isiri3342Zff_snZfiZfi_fiZfil_phZfinnishZfoZfo_fo�frZfr_beZfr_caZfr_chZfr_frZfr_luu	françaisZfre_frZfrenchzfrench.iso88591Z
french_franceZfur_itZfy_deZfy_nlZgaZga_ieZgalegoZgalicianZgdZgd_gbZger_deZgermanzgerman.iso88591Zgerman_germanyZgez_erZgez_etZglZgl_es�greekZgu_inZgvZgv_gbZha_ngZhak_twZheZhe_il�hebrew�hiZhi_inzhi_in.isciidevZhif_fjZhneZhne_inZhrZhr_hrZhrvatskiZhsb_deZht_htZhuZhu_huZ	hungarianZhy_amzhy_am.armscii8ZiaZia_frZ	icelandic�idZid_idZig_ngZik_ca�inZin_idrtZis_isz
iso-8859-1ziso-8859-15z	iso8859-1z
iso8859-15�
iso_8859_1�iso_8859_15�itZit_chZit_itZitalianZiuZiu_caziu_ca.nunacom8ZiwZiw_ilz
iw_il.utf8ZjaZja_jpz	ja_jp.euczja_jp.mscodez	ja_jp.pckZjapanZjapanesezjapanese-euczjapanese.eucZjp_jpZkaZka_gezka_ge.georgianacademyzka_ge.georgianpszka_ge.georgianrsZkab_dzZkk_kzZklZkl_glZkm_khZknZkn_inZkoZko_krz	ko_kr.eucZkok_in�koreanz
korean.eucZksZks_inzks_in@devanagari.utf8Zku_tr�kwZkw_gbZkyZky_kgZlb_luZlg_ugZli_beZli_nlZlij_itZ
lithuanianZln_cd�loZlo_lazlo_la.cp1133zlo_la.ibmcp1133zlo_la.mulelao1�ltZlt_ltZlvZlv_lvZlzh_twZmag_inZmaiZmai_inZmai_npZmfe_muZmg_mgZmhr_ruZmiZmi_nzZmiq_niZmjw_inZmkZmk_mkZmlZml_inZmn_mnZmni_inZmrZmr_inZmsZms_myZmtZmt_mtZmy_mmZnan_twZnbZnb_noZnds_deZnds_nlZne_npZnhn_mxZniu_nuZniu_nz�nlZnl_awZnl_beZnl_nlZnnZnn_no�noz
no@nynorskZno_nozno_no.iso88591@bokmalzno_no.iso88591@nynorskZ	norwegianZnrZnr_zaZnsoZnso_zaZnyZny_noZnynorskZocZoc_frZom_etZom_ke�orZor_inZos_ruZpaZpa_inZpa_pkZpap_anZpap_awZpap_cwZpdZpd_deZpd_usZphZph_phZplZpl_plZpolishZ
portugueseZportuguese_brazil�posixz
posix-utf2ZppZpp_anZps_afZptZpt_brZpt_ptZquz_peZraj_inZroZro_roZromanianZruZru_ruZru_uaZrumanianZrussianZrwZrw_rwZsa_inZsat_inZsc_itZsdZsd_inzsd_in@devanagari.utf8Zsd_pkZse_noZ
serbocroatianZsgs_ltZshzsh_ba.iso88592@bosniaZsh_hrzsh_hr.iso88592Zsh_spZsh_yuZshn_mmZshs_caZsiZsi_lkZsid_etZsinhalaZskZsk_skZslZsl_csZsl_siZslovakZsloveneZ	slovenianZsm_wsZso_djZso_etZso_keZso_soZspZsp_yuZspanishZ
spanish_spainZsqZsq_alZsq_mk�srzsr@cyrilliczsr@latnZsr_cszsr_cs.iso88592@latnz
sr_cs@latnZsr_meZsr_rsz
sr_rs@latnZsr_spZsr_yuzsr_yu.cp1251@cyrilliczsr_yu.iso88592zsr_yu.iso88595zsr_yu.iso88595@cyrilliczsr_yu.microsoftcp1251@cyrillicz
sr_yu.utf8zsr_yu.utf8@cyrilliczsr_yu@cyrillicZssZss_za�stZst_zaZsvZsv_fiZsv_seZsw_keZsw_tzZswedishZszl_plZtaZta_inzta_in.tsciizta_in.tscii0Zta_lkztcy_in.utf8ZteZte_inZtgZtg_tjZthZth_thzth_th.tactiszth_th.tis620�thaiZthe_npZti_erZti_etZtig_erZtk_tmZtlZtl_phZtnZtn_zaZto_toZtpi_pgZtrZtr_cyZtr_trrpZts_zaZttZtt_ruztt_ru.tatarcyrz
tt_ru@iqtelifZturkishZug_cnZukZuk_uaZunivZ	universalzuniversal.utf8@ucs4Zunm_usZurZur_inZur_pkZuzZuz_uzzuz_uz@cyrillicZveZve_zaZviZvi_vnz
vi_vn.tcvnzvi_vn.tcvn5712zvi_vn.visciizvi_vn.viscii111ZwaZwa_beZwae_chZwal_etZwo_snZxhZxh_zaZyiZyi_usZyo_ngZyue_hkZyuw_pgZzhZzh_cnz
zh_cn.big5z	zh_cn.eucZzh_hkzzh_hk.big5hkZzh_sgz	zh_sg.gbkZzh_twz	zh_tw.euczzh_tw.euctwZzuZzu_zaZaf_ZAZsq_ALZgsw_FRZam_ETZar_SAZar_IQZar_EGZar_LYZar_DZZar_MAZar_TNZar_OMZar_YEZar_SYZar_JOZar_LBZar_KWZar_AEZar_BHZar_QAZhy_AMZas_INZaz_AZZba_RUZeu_ESZbe_BYZbn_INZbs_BAZbr_FRZbg_BGZca_ESZzh_CHSZzh_TWZzh_CNZzh_HKZzh_SGZzh_MOZzh_CHTZco_FRZhr_HRZhr_BAZcs_CZZda_DKZgbz_AFZdiv_MVZnl_NLZnl_BEZen_USZen_GBZen_AUZen_CAZen_NZZen_IEZen_ZAZen_JAZen_CBZen_BZZen_TTZen_ZWZen_PHZen_INZen_MYZet_EEZfo_FOZfil_PHZfi_FIZfr_FRZfr_BEZfr_CAZfr_CHZfr_LUZfr_MCZfy_NLZgl_ESZka_GEZde_DEZde_CHZde_ATZde_LUZde_LIZel_GRZkl_GLZgu_INZha_NGZhe_ILZhi_INZhu_HUZis_ISZid_IDZiu_CAZga_IEZit_ITZit_CHZja_JPZkn_INZkk_KZZkh_KHZqut_GTZrw_RWZkok_INZko_KRZky_KGZlo_LAZlv_LVZlt_LTZdsb_DEZlb_LUZmk_MKZms_MYZms_BNZml_INZmt_MTZmi_NZZarn_CLZmr_INZmoh_CAZmn_MNZmn_CNZne_NPZnb_NOZnn_NOZoc_FRZor_INZps_AFZfa_IRZpl_PLZpt_BRZpt_PTZpa_INZquz_BOZquz_ECZquz_PEZro_ROZrm_CHZru_RUZsmn_FIZsmj_NOZsmj_SEZse_NOZse_SEZse_FIZsms_FIZsma_NOZsma_SEZsa_INZsr_SPZsr_BAZsi_LKZns_ZAZtn_ZAZsk_SKZsl_SIZes_ESZes_MXZes_GTZes_CRZes_PAZes_DOZes_VEZes_COZes_PEZes_ARZes_ECZes_CLZes_URZes_PYZes_BOZes_SVZes_HNZes_NIZes_PRZes_USZsw_KEZsv_SEZsv_FIZsyr_SYZtg_TJZtmz_DZZta_INZtt_RUZte_INZth_THZbo_BTZbo_CNZtr_TRZtk_TMZug_CNZuk_UAZwen_DEZur_PKZur_INZuz_UZZvi_VNZcy_GBZwo_SNZxh_ZAZsah_RUZii_CNZyo_NGZzu_ZA)�i6ii�i^iiiiiiii i$i(i,i0i4i8i<i@i+iMi,i,imi-i#iEi ii~iir%iiiiii|i�iiiii�ieiii	i	i	i	i	i	i	i	 i	$i	(i	,i	0i	4i	@i	Di	Hi%i8idiiiiiiiibiVi7iiiiiiioiGihi
i9iii!i]i]i<iiiiKi?iSi�i�iWii@iTi&i'i.ini/i>i>iLi:i�iziNi|iPiPiaiii�iHici)iiiiFikikikiiii;$i;i;i;i;i;i; i;i;iOiiiii[ili2ii$i
i
i
i
i
i
i
i
 i
$i
(i
,i
0i
4i
8i
<i
@i
Di
Hi
Li
Pi
TiAiiiZi(i_iIiDiJiiQiQiiBi�i"i.i i iCiCi*iRi�i4i�ixiji5c
Cs�i}|fdd�}|�|d=td�tdd�t�\}}td|pDd�td	|pRd�t�td
�tdd�xL|j�D]@\}}t|d�t|�\}}td|p�d�td
|p�d�t�qzWt�td�tdd�t�xP|j�D]D\}}t|d�t|�\}}td|�pd�td
|�p"d�t�q�Wyttd�Wn$td�td�td�YnpXt�td�tdd�xR|j�D]F\}}t|d�t|�\}}td|�p�d�td
|�p�d�t��q�WdS)NcSs4x.t�j�D] \}}|dd�dkr|||<qWdS)Nr#ZLC_)�globals�items)�
categories�k�vrrr�_init_categories�sz'_print_locale.<locals>._init_categoriesrz4Locale defaults as determined by getdefaultlocale():ry�Hz
Language: z(undefined)z
Encoding: zLocale settings on startup:z...z
   Language: z
   Encoding: z,Locale settings after calling resetlocale():r(zNOTE:z9setlocale(LC_ALL, "") does not support the default localez&given in the OS environment variables.z4Locale settings after calling setlocale(LC_ALL, ""):)rurr�rrrr)r�r�Zlang�enc�namer=rrr�
_print_locale{sV





r��LC_MESSAGES�__main__zLocale aliasing:zNumber formatting:)N)F)FF)FF)F)TFF�rrr�r�)r�)N)T)T)T)Ir�r{Zencodings.aliases�rerb�builtinsrr��	functools�__all__rrr�r�rrrrr�rrrrCrr	rr�rr
r?r@�wrapsrErRrS�compilerTrrXrrrq�floatrr
rwr�r�r�rr�r�rrrr��
startswithr�CODESET�	NameErrorr��sortedr�r�r�rn�
setdefaultr�r�r�rK�__name__rurrrr�<module>
s2


	



"-S5
	"}:

cgitb.cpython-36.pyc000064400000023542150335715140010274 0ustar003


 \�.�@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
dd�ZgZdd�Z
dd�Zd	d
�Zdd�Zd
d�Zddd�Zddd�ZGdd�d�Ze�jZddd�ZdS)a�More comprehensive traceback formatting for Python scripts.

To enable this module, do:

    import cgitb; cgitb.enable()

at the top of your script.  The optional arguments to enable() are:

    display     - if true, tracebacks are displayed in the web browser
    logdir      - if set, tracebacks are written to files in this directory
    context     - number of lines of source code to show for each stack frame
    format      - 'text' or 'html' controls the output format

By default, tracebacks are displayed but not saved, the context is 5 lines
and the output format is 'html' (for backwards compatibility with the
original use of this module)

Alternatively, if you have caught an exception and want cgitb to display it
for you, call cgitb.handler().  The optional argument to handler() is a
3-item tuple (etype, evalue, etb) just like the value of sys.exc_info().
The default handler displays output as HTML.

�NcCsdS)zAReturn a string that resets the CGI and browser to a known state.a'<!--: spam
Content-Type: text/html

<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> -->
<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> -->
</font> </font> </font> </script> </object> </blockquote> </pre>
</table> </table> </table> </table> </table> </font> </font> </font>�rrr�/usr/lib64/python3.6/cgitb.py�reset#srcCs|rd|dSdSdS)Nz<small>z</small>�r)�textrrr�small.srcCs|rd|dSdSdS)Nz<strong>z	</strong>rr)rrrr�strong4srcCs|rd|dSdSdS)Nz<font color="#909090">z</font>rr)rrrr�grey:sr	cCs�||krd||fS||jkr,d|j|fSd|jkr~|jd}t|�ti�krf||kr~d||fSnt||�r~dt||�fSdtfS)z9Find the value for a given name in the given environment.�local�global�__builtins__�builtinN)�	f_globals�type�hasattr�getattr�	__UNDEF__)�name�frame�locals�builtinsrrr�lookup@s



rcCs�gdddtf\}}}}}x�tj|�D]�\}}	}
}}|tjkr>P|tjkr�|	tjkr�|dkr�|tk	r�t||	t�}|j||	||f�q�t	|	||�\}
}|j|	|
|f�n"|	dkr�||d7}|}nd\}}|	}q$W|S)zEScan one logical line of Python and look up values of variables used.Nr�.)Nr)
r�tokenize�generate_tokens�NEWLINE�NAME�keyword�kwlistr�appendr)�readerrr�varsZ	lasttoken�parent�prefix�valueZttype�token�start�end�line�whererrr�scanvarsPs"
r*�c"	s�|\}}}t|t�r|j}dtjj�ddtj}tjtj��}dt	j
jdtt	j
j
t|���dd|d|�d	}d
tdd�d
}g}	tj||�}
�xJ|
D�]@\}�}}
}}�r�tjj���d�t	j
j
��f}nd�}tj|�\}}}}d}|
dk�r2dtt	j
j
|
��tj||||dd�d�}i�|gf��fdd�	}t|||�}dd||fg}|dk	�r||}x�|D]�}tddtt|��t|��d}|�k�r�d|t	j
j|�f}|jd|�n&d|t	j
j|�f}|jdt|��|d7}�q~Wig}}x�|D]�\}}} ||k�r0�qd||<| tk	�r�|d-k�r^d!|t|�}n*|d"k�rrt|�}n|t|jd#�d.�}|jd$|t	j
j| �f�n|j|d%��qW|jdttd&j|����|	jd'd(j|��q�Wd)tt	j
j
t|���t	j
j
t|��fg}!xNt|�D]B}|dd�d*k�r:�q t	j
jt ||��} |!jd+||| f��q W|dj|	�dj|!�d,t	j
j
djt!j"|||���S)/z9Return a nice HTML document describing a given traceback.zPython rz: z<body bgcolor="#f0f0f8">z<big><big>%s</big></big>z#ffffffz#6622aaz<br>z�
<p>A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.</p>z<tt>z&nbsp;r+z&nbsp;</tt>z<a href="file://%s">%s</a>�?rzin cSsdtjj|�S)N�=)�pydoc�html�repr)r$rrr�<lambda>�szhtml.<locals>.<lambda>)�formatvaluec
s4d�|d<ztj�|d�S|dd7<XdS)N�r)�	linecache�getline)�lnum)�file�	highlightrrr �szhtml.<locals>.readerz+<tr><td bgcolor="#d8bbff">%s%s %s</td></tr>z<big>&nbsp;</big>Nz<tt>=&gt;%s%s</tt>z&<tr><td bgcolor="#ffccee">%s</td></tr>z<tt>&nbsp;&nbsp;%s%s</tt>z<tr><td>%s</td></tr>r3rr
z<em>%s</em> r
rz%s&nbsp;= %sz <em>undefined</em>z, zF
<table width="100%%" cellspacing=0 cellpadding=0 border=0>
%s</table>�
z	<p>%s: %s�_z
<br>%s%s&nbsp;=
%sz�


<!-- The above is a description of an error in a Python program, formatted
     for a Web browser because the 'cgitb' module was enabled.  In case you
     are not reading this in a Web browser, here is the original traceback:

%s
-->
)rr
���)#�
isinstancer�__name__�sys�version�split�
executable�time�ctimer.r/Zheadingr�escape�strr�inspect�getinnerframes�os�path�abspath�getargvalues�formatargvaluesr*�lenZ	preformatrr	rr0�join�dirr�	traceback�format_exception)"�einfo�context�etype�evalue�etb�pyver�date�head�indent�frames�recordsrr6�func�lines�index�link�args�varargs�varkwr�callr r!�rows�ir(�num�done�dumprr)r$�	exceptionr)r7r8rr/es|

0


$






	r/c 	s�|\}}}t|t�r|j}dtjj�ddtj}tjtj��}dt	|�||fd}g}t
j||�}	�x�|	D�]�\}
�}}}
}�r�tj
j��p�d�t
j|
�\}}}}d}|dkr�d|t
j||||d	d
�d�}i�|gf��fdd
�	}t||
|�}d�|fg}|dk	�rL||}x0|
D](}d|}|j||j��|d7}�q Wig}}x�|D]�\}}}||k�rt�q\d||<|tk	�r�|dk�r�d|}n|dk�r�||jd�d}|jd|tjj|�f�n|j|d��q\W|jdj|��|jddj|��qrWdt	|�t	|�fg}x8t|�D],}tjjt||��}|jdd ||f��q.W|dj|�dj|�ddjtj|||��S)!z:Return a plain text document describing a given traceback.zPython rz: z	%s
%s
%s
z�
A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.
r,rzin cSsdtjj|�S)Nr-)r.rr0)r$rrrr1�sztext.<locals>.<lambda>)r2c
s4d�|d<ztj�|d�S|dd7<XdS)Nr3r)r4r5)r6)r7r8rrr �sztext.<locals>.readerz %s %sNz%5d r3rzglobal r
rz%s = %sz
 undefinedr9z
%s
z%s: %sz

%s%s = %s� �zc

The above is a description of an error in a Python program.  Here is
the original traceback:

%s
r;z    )r<rr=r>r?r@rArBrCrErFrGrHrIrJrKrLr*r�rstriprr.rr0rNrOrrPrQ) rRrSrTrUrVrWrXrYr[r\rr6r]r^r_rarbrcrrdr r!rerfr(rgrhrirr)r$rjr)r7r8rr�s^









rc@s,eZdZdZddd�Zdd	�Zd
d
d�ZdS)�Hookz?A hook to replace sys.excepthook that shows tracebacks in HTML.r3Nr+r/cCs(||_||_||_|ptj|_||_dS)N)�display�logdirrSr>�stdoutr7�format)�selfrorprSr7rrrrr�__init__s
z
Hook.__init__cCs|j|||f�dS)N)�handle)rsrTrUrVrrr�__call__sz
Hook.__call__c
Csz|p
tj�}|jdkr$|jjt��|jdkr2tp4t}d}y|||j�}Wn dj	t
j|��}d}YnX|jr�|r�t
jj|�}|jjd|d�q�|jj|d�n|jjd�|jdk	�rZd	d
g|jdk}tj||jd�\}}y.tj|d��}|j|�WdQRXd
|}	Wnd|}	YnX|jdk�rJ|jjd|	�n|jj|	d�y|jj�WnYnXdS)Nr/FrTz<pre>z</pre>
r9z*<p>A problem occurred in a Python script.
z.txtz.html)�suffixrO�wz*%s contains the description of this error.z*Tried to save traceback to %s, but failed.z
<p>%s</p>
)r>�exc_inforrr7�writerr/rrSrNrPrQror.rDrp�tempfileZmkstemprH�fdopen�flush)
rs�infoZ	formatterZplain�docrw�fdrIr7�msgrrrrus@

zHook.handle)r3Nr+Nr/)N)r=�
__module__�__qualname__�__doc__rtrvrurrrrrns

rnr3cCst||||d�t_dS)aInstall an exception handler that formats tracebacks as HTML.

    The optional argument 'display' can be set to 0 to suppress sending the
    traceback to the browser, and 'logdir' can be set to a directory to cause
    tracebacks to be written to files there.)rorprSrrN)rnr>�
excepthook)rorprSrrrrr�enable8sr�)r+)r+)r3Nr+r/)r�rFrr4rHr.r>r{rBrrPrrrrr	rr*r/rrnruZhandlerr�rrrr�<module>s,

Z
A7cmd.cpython-36.pyc000064400000030441150335715140007743 0ustar003


 \:�@s@dZddlZddlZdgZdZejejdZGdd�d�ZdS)a	A generic class to build line-oriented command interpreters.

Interpreters constructed with this class obey the following conventions:

1. End of file on input is processed as the command 'EOF'.
2. A command is parsed out of each line by collecting the prefix composed
   of characters in the identchars member.
3. A command `foo' is dispatched to a method 'do_foo()'; the do_ method
   is passed a single argument consisting of the remainder of the line.
4. Typing an empty line repeats the last command.  (Actually, it calls the
   method `emptyline', which may be overridden in a subclass.)
5. There is a predefined `help' method.  Given an argument `topic', it
   calls the command `help_topic'.  With no arguments, it lists all topics
   with defined help_ functions, broken into up to three topics; documented
   commands, miscellaneous help topics, and undocumented commands.
6. The command '?' is a synonym for `help'.  The command '!' is a synonym
   for `shell', if a do_shell method exists.
7. If completion is enabled, completing commands will be done automatically,
   and completing of commands args is done by calling complete_foo() with
   arguments text, line, begidx, endidx.  text is string we are matching
   against, all returned matches must begin with it.  line is the current
   input line (lstripped), begidx and endidx are the beginning and end
   indexes of the text being matched, which could be used to provide
   different completion depending upon which position the argument is in.

The `default' method may be overridden to intercept commands for which there
is no do_ method.

The `completedefault' method may be overridden to intercept completions for
commands that have no complete_ method.

The data member `self.ruler' sets the character used to draw separator lines
in the help messages.  If empty, no ruler line is drawn.  It defaults to "=".

If the value of `self.intro' is nonempty when the cmdloop method is called,
it is printed out on interpreter startup.  This value may be overridden
via an optional argument to the cmdloop() method.

The data members `self.doc_header', `self.misc_header', and
`self.undoc_header' set the headers used for the help function's
listings of documented functions, miscellaneous topics, and undocumented
functions respectively.
�N�Cmdz(Cmd) �_c@s�eZdZdZeZeZdZdZ	dZ
dZdZdZ
dZdZd	Zd0dd�Zd1d
d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Z d+d,�Z!d2d.d/�Z"dS)3raA simple framework for writing line-oriented command interpreters.

    These are often useful for test harnesses, administrative tools, and
    prototypes that will later be wrapped in a more sophisticated interface.

    A Cmd instance or subclass instance is a line-oriented interpreter
    framework.  There is no good reason to instantiate Cmd itself; rather,
    it's useful as a superclass of an interpreter class you define yourself
    in order to inherit Cmd's methods and encapsulate action methods.

    �=�Nz(Documented commands (type help <topic>):zMiscellaneous help topics:zUndocumented commands:z*** No help on %s��tabcCs@|dk	r||_ntj|_|dk	r(||_ntj|_g|_||_dS)a�Instantiate a line-oriented interpreter framework.

        The optional argument 'completekey' is the readline name of a
        completion key; it defaults to the Tab key. If completekey is
        not None and the readline module is available, command completion
        is done automatically. The optional arguments stdin and stdout
        specify alternate input and output file objects; if not specified,
        sys.stdin and sys.stdout are used.

        N)�stdin�sys�stdout�cmdqueue�completekey)�selfrrr
�r�/usr/lib64/python3.6/cmd.py�__init__LszCmd.__init__cCs�|j�|jr\|jr\y2ddl}|j�|_|j|j�|j|jd�Wnt	k
rZYnXz�|dk	rl||_
|j
r�|jjt
|j
�d�d}x�|�s6|jr�|jjd�}nl|jr�yt|j�}Wntk
r�d}YnXn<|jj|j�|jj�|jj�}t|��s
d}n
|jd�}|j|�}|j|�}|j||�}q�W|j�Wd|j�r�|j�r�yddl}|j|j�Wnt	k
�r�YnXXdS)z�Repeatedly issue a prompt, accept input, parse an initial prefix
        off the received input, and dispatch to action methods, passing them
        the remainder of the line as argument.

        rNz
: complete�
�EOFz
)�preloop�use_rawinputr�readlineZ
get_completerZ
old_completerZ
set_completer�complete�parse_and_bind�ImportError�intror
�write�strr�pop�input�prompt�EOFError�flushr�len�rstrip�precmd�onecmd�postcmd�postloop)r
rr�stop�linerrr�cmdloopbsN






zCmd.cmdloopcCs|S)z�Hook method executed just before the command line is
        interpreted, but after the input prompt is generated and issued.

        r)r
r(rrrr#�sz
Cmd.precmdcCs|S)z?Hook method executed just after a command dispatch is finished.r)r
r'r(rrrr%�szCmd.postcmdcCsdS)z>Hook method executed once when the cmdloop() method is called.Nr)r
rrrr�szCmd.preloopcCsdS)zYHook method executed once when the cmdloop() method is about to
        return.

        Nr)r
rrrr&�szCmd.postloopcCs�|j�}|sdd|fS|ddkr4d|dd�}n2|ddkrft|d�r\d|dd�}n
dd|fSdt|�}}x"||kr�|||jkr�|d}qvW|d|�||d�j�}}|||fS)	z�Parse the line into a command name and a string containing
        the arguments.  Returns a tuple containing (command, args, line).
        'command' and 'args' may be None if the line couldn't be parsed.
        Nr�?zhelp r�!Zdo_shellzshell )�strip�hasattrr!�
identchars)r
r(�i�n�cmd�argrrr�	parseline�s


z
Cmd.parselinecCs�|j|�\}}}|s|j�S|dkr.|j|�S||_|dkrBd|_|dkrT|j|�Syt|d|�}Wntk
r�|j|�SX||�SdS)ahInterpret the argument as though it had been typed in response
        to the prompt.

        This may be overridden, but should not normally need to be;
        see the precmd() and postcmd() methods for useful execution hooks.
        The return value is a flag indicating whether interpretation of
        commands by the interpreter should stop.

        Nrr�do_)r3�	emptyline�default�lastcmd�getattr�AttributeError)r
r(r1r2�funcrrrr$�s


z
Cmd.onecmdcCs|jr|j|j�SdS)z�Called when an empty line is entered in response to the prompt.

        If this method is not overridden, it repeats the last nonempty
        command entered.

        N)r7r$)r
rrrr5�sz
Cmd.emptylinecCs|jjd|�dS)z�Called on an input line when the command prefix is not recognized.

        If this method is not overridden, it prints an error message and
        returns.

        z*** Unknown syntax: %s
N)r
r)r
r(rrrr6�szCmd.defaultcGsgS)z�Method called to complete an input line when no command-specific
        complete_*() method is available.

        By default, it returns an empty list.

        r)r
�ignoredrrr�completedefault�szCmd.completedefaultcsd|��fdd�|j�D�S)Nr4cs"g|]}|j��r|dd��qS)�N)�
startswith)�.0�a)�dotextrr�
<listcomp>�sz%Cmd.completenames.<locals>.<listcomp>)�	get_names)r
�textr;r)rAr�
completenames�szCmd.completenamesc
Cs�|dkr�ddl}|j�}|j�}t|�t|�}|j�|}|j�|}|dkr�|j|�\}	}
}|	dkrp|j}q�yt|d|	�}Wq�t	k
r�|j}Yq�Xn|j
}|||||�|_y
|j|Stk
r�dSXdS)z�Return the next possible completion for 'text'.

        If a command has not been entered, then complete against command list.
        Otherwise try to call complete_<command> to get list of completions.
        rNrZ	complete_)
rZget_line_buffer�lstripr!Z
get_begidxZ
get_endidxr3r<r8r9rEZcompletion_matches�
IndexError)
r
rD�staterZorigliner(�strippedZbegidxZendidxr1�argsZfooZcompfuncrrrr�s*
zCmd.completecCs
t|j�S)N)�dir�	__class__)r
rrrrCsz
Cmd.get_namescs4t|j���}t�fdd�|j�D��}t||B�S)Nc3s,|]$}|jd�d�r|dd�VqdS)�help_r�N)r>)r?r@)rJrr�	<genexpr> sz$Cmd.complete_help.<locals>.<genexpr>)�setrErC�list)r
rJZcommandsZtopicsr)rJr�
complete_helpszCmd.complete_helpcCs�|r�yt|d|�}Wnvtk
r�y0t|d|�j}|rT|jjdt|��dSWntk
rjYnX|jjdt|j|f��dSX|��n|j�}g}g}i}x,|D]$}|dd�dkr�d||dd�<q�W|j�d}	xx|D]p}|dd�dkr�||	k�rq�|}	|dd�}
|
|k�r8|j	|
�||
=q�t||�j�rR|j	|
�q�|j	|
�q�W|jjdt|j
��|j|j|d	d
�|j|j
t|j��d	d
�|j|j|d	d
�dS)zEList available commands with "help" or detailed help with "help cmd".rMr4z%s
NrNrrr=��P)r8r9�__doc__r
rr�nohelprC�sort�append�
doc_leader�print_topics�
doc_header�misc_headerrQ�keys�undoc_header)r
r2r:�doc�namesZcmds_docZ
cmds_undoc�help�nameZprevnamer1rrr�do_help$sN





zCmd.do_helpcCs\|rX|jjdt|��|jr<|jjdt|jt|���|j||d�|jjd�dS)Nz%s
rr)r
rr�rulerr!�	columnize)r
�headerZcmdsZcmdlenZmaxcolrrrrZRszCmd.print_topicsrTcs��s|jjd�dS�fdd�tt���D�}|rJtddjtt|����t��}|dkrv|jjdt�d	��dSx�tdt���D]�}||d|}g}d
}xrt|�D]f}	d	}
x<t|�D]0}|||	}||kr�P�|}
t|
t|
��}
q�W|j	|
�||
d
7}||kr�Pq�W||kr�Pq�Wt��}d}d	g}x�t|�D]�}g}x@t|�D]4}	|||	}||k�rrd}
n�|}
|j	|
��qRWx|�r�|d�r�|d=�q�Wx,tt|��D]}	||	j
||	�||	<�q�W|jjdtdj|����q@WdS)z�Display a list of strings as a compact set of columns.

        Each column is only as wide as necessary.
        Columns are separated by two spaces (one was not legible enough).
        z<empty>
Ncsg|]}t�|t�s|�qSr)�
isinstancer)r?r/)rQrrrBdsz!Cmd.columnize.<locals>.<listcomp>z list[i] not a string for i in %sz, rz%s
r�rz  ������rj)r
r�ranger!�	TypeError�join�mapr�maxrX�ljust)r
rQZdisplaywidthZ
nonstrings�sizeZnrowsZncolsZ	colwidthsZtotwidth�colZcolwidth�rowr/�xZtextsr)rQrreZsZ

z
Cmd.columnize)rNN)N)rT)#�__name__�
__module__�__qualname__rU�PROMPTr�
IDENTCHARSr.rdr7rrYr[r\r^rVrrr)r#r%rr&r3r$r5r6r<rErrCrRrcrZrerrrrr4s<

4
		.)	rU�stringr	�__all__rxZ
ascii_lettersZdigitsryrrrrr�<module>+s
this.cpython-36.opt-1.pyc000064400000002363150335715140011110 0ustar003


 \��@sddZiZx>d	D]6Zx0ed�D]$Zeedde�eeee�<qWqWedjdd�eD���dS)
aXGur Mra bs Clguba, ol Gvz Crgref

Ornhgvshy vf orggre guna htyl.
Rkcyvpvg vf orggre guna vzcyvpvg.
Fvzcyr vf orggre guna pbzcyrk.
Pbzcyrk vf orggre guna pbzcyvpngrq.
Syng vf orggre guna arfgrq.
Fcnefr vf orggre guna qrafr.
Ernqnovyvgl pbhagf.
Fcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf.
Nygubhtu cenpgvpnyvgl orngf chevgl.
Reebef fubhyq arire cnff fvyragyl.
Hayrff rkcyvpvgyl fvyraprq.
Va gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff.
Gurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg.
Nygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh'er Qhgpu.
Abj vf orggre guna arire.
Nygubhtu arire vf bsgra orggre guna *evtug* abj.
Vs gur vzcyrzragngvba vf uneq gb rkcynva, vg'f n onq vqrn.
Vs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn.
Anzrfcnprf ner bar ubaxvat terng vqrn -- yrg'f qb zber bs gubfr!�A�a��
�cCsg|]}tj||��qS�)�d�get)�.0�crr�/usr/lib64/python3.6/this.py�
<listcomp>srN)rr)�srr
�range�i�chr�print�joinrrrr�<module>s

(_compat_pickle.cpython-36.pyc000064400000014650150335715140012155 0ustar003


 \-"�C@s�dddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*�*Zd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d��d�d�d�d�d�d�d�d�di!Z�d	ZyeWnek
�rYnXe�d
7ZxeD]Zdefed�ef<�q*W�dZxeD]ZdQefed�ef<�qPWed�d��ej�D��Z	e
e	�e
e�k�s�t�ed�d��ej�D��Ze
e�e
e�k�s�t�ej
d�d�dddd"d"dEdEdEd(d�d�d��
�e	j
d�d(d/d�d�d���ej
�d�d
�d�d�d�d�d�di�ej
�d�d�d�d�d�d�d�d�d�d�d�d�d �d!�d"�d#�d$�d%�d&�d'�d(�d)�d*�d+�d,�d-i
��d.ZxeD]Z�d/edef<�q�W�d0ZxeD]Z�d1edef<�q�Wd�S(2�builtins�copyregZqueueZsocketserverZconfigparser�reprlib�tkinter.filedialog�tkinter.simpledialogztkinter.colorchooserztkinter.commondialogztkinter.dialogztkinter.dndztkinter.fontztkinter.messageboxztkinter.scrolledtextztkinter.constantsztkinter.tixztkinter.ttkZtkinterZ_markupbase�winreg�_threadZ
_dummy_threadzdbm.bsdzdbm.dumbzdbm.ndbmzdbm.gnuz
xmlrpc.client�
xmlrpc.serverzhttp.clientz
html.entitieszhtml.parserzhttp.cookieszhttp.cookiejar�http.serverztest.support�
subprocess�urllib.parsezurllib.robotparser�urllib.request�dbmzcollections.abc)*�__builtin__Zcopy_regZQueueZSocketServerZConfigParser�reprZtkFileDialogZtkSimpleDialogZtkColorChooserZtkCommonDialogZDialogZTkdndZtkFontZtkMessageBoxZScrolledTextZTkconstantsZTixZttkZTkinterZ
markupbase�_winregZthreadZdummy_threadZdbhashZdumbdbmr
�gdbmZ	xmlrpclibZSimpleXMLRPCServerZhttplibZhtmlentitydefsZ
HTMLParserZCookieZ	cookielibZBaseHTTPServerztest.test_supportZcommandsZurlparseZrobotparser�urllib2ZanydbmZ_abcollr�xrange�range�reduce�	functools�intern�sys�unichr�chr�unicode�str�long�int�	itertools�izip�zip�imap�map�ifilter�filter�ifilterfalse�filterfalse�izip_longest�zip_longest�UserDict�IterableUserDict�collections�UserList�
UserString�whichdb�_socket�fromfd�socket�_multiprocessing�
Connection�multiprocessing.connection�multiprocessing.process�Process�multiprocessing.context�multiprocessing.forking�Popen�multiprocessing.popen_fork�urllib�ContentTooShortError�urllib.error�
getproxies�pathname2url�
quote_plus�quote�unquote_plus�unquote�url2pathname�
urlcleanup�	urlencode�urlopen�urlretriever�	HTTPError�URLError�ArithmeticError�AssertionError�AttributeError�
BaseException�BufferError�BytesWarning�DeprecationWarning�EOFError�EnvironmentError�	Exception�FloatingPointError�
FutureWarning�
GeneratorExit�IOError�ImportError�
ImportWarning�IndentationError�
IndexError�KeyError�KeyboardInterrupt�LookupError�MemoryError�	NameError�NotImplementedError�OSError�
OverflowError�PendingDeprecationWarning�ReferenceError�RuntimeError�RuntimeWarning�
StopIteration�SyntaxError�
SyntaxWarning�SystemError�
SystemExit�TabError�	TypeError�UnboundLocalError�UnicodeDecodeError�UnicodeEncodeError�UnicodeError�UnicodeTranslateError�UnicodeWarning�UserWarning�
ValueError�Warning�ZeroDivisionError�WindowsError�
exceptions�AuthenticationError�BufferTooShort�ProcessError�TimeoutErrorZmultiprocessingccs|]\}}||fVqdS)N�)�.0�k�vr�r��&/usr/lib64/python3.6/_compat_pickle.py�	<genexpr>�sr�ccs|]\}}||fVqdS)Nr�)r�r�r�r�r�r�r��s�picklezxml.etree.ElementTree�io)
ZcPickleZ_elementtree�
FileDialog�SimpleDialog�DocXMLRPCServer�SimpleHTTPServer�
CGIHTTPServerr*r-r.r/�StringIOZ	cStringIO�bz2r)Z_bz2Z_dbm�
_functoolsZ_gdbm�_pickle�
basestring�
StandardError�
_socketobject�
SocketTyper�r��LoadFileDialog�SaveFileDialogr��
ServerHTMLDocr��XMLRPCDocGenerator�DocXMLRPCRequestHandler�DocCGIXMLRPCRequestHandler�SimpleHTTPRequestHandlerr��CGIHTTPRequestHandlerr��BrokenPipeError�ChildProcessError�ConnectionAbortedError�ConnectionError�ConnectionRefusedError�ConnectionResetError�FileExistsError�FileNotFoundError�InterruptedError�IsADirectoryError�NotADirectoryError�PermissionError�ProcessLookupError�ModuleNotFoundErrorN)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr )rr!)rr")rr#)rr$)rr%)rr&)rr')rr()rr))r*r+)r,r*)r-r-)r,r-)r.r.)r,r.)r/r/)r
r/)r0r1)r2r1)r3r4)r5r4)r6r7)r8r7)r9r:)r;r:)r<r=)r>r=)r<r?)rr?)r<r@)rr@)r<rA)rrA)r<rB)rrB)r<rC)rrC)r<rD)rrD)r<rE)rrE)r<rF)rrF)r<rG)rrG)r<rH)rrH)r<rI)rrI)rrJ)r>rJ)rrK)r>rK)/rLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrz)r{)r}r~rr�)rr�)rr)r|r�)rrU)r*r*)r,r*)r2r�)r2r�)r�r)rr)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)r	r�)r�r�)r	r�)r�r�)r0r2)r2r�)r�r�r�r�r�r�r�r�r�r�r�r�r�r�)r|rd)r�)r|rZ)ZIMPORT_MAPPINGZNAME_MAPPINGZPYTHON2_EXCEPTIONSr{rbZexcnameZMULTIPROCESSING_EXCEPTIONS�dict�itemsZREVERSE_IMPORT_MAPPING�lenrMZREVERSE_NAME_MAPPING�updateZPYTHON3_OSERROR_EXCEPTIONSZPYTHON3_IMPORTERROR_EXCEPTIONSr�r�r�r��<module>	s�






plistlib.cpython-36.opt-2.pyc000064400000057533150335715140011775 0ustar003

�\dh#~�@s^dddddddddd	d
ddd
gZddlZddlZddlZddlZddlZddlmZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZejdded�Ze�jej�Gdd�de�ZGdd�de�Zejdd��ZGdd�de�Zdd�Zdd�Zdd�Zdd�ZGd d�d�Z d!Z!e
j"d"�Z#dOd$d%�Z$d&d'�Z%e
j"d(e
j&�Z'd)d*�Z(d+d,�Z)d-d.�Z*Gd/d0�d0�Z+Gd1d2�d2�Z,Gd3d4�d4e,�Z-d5d6�Z.Gd7d�de/�Z0d8d9d:d;d<�Z1e2�Z3Gd=d>�d>�Z4d?d@�Z5e6e7e8eje9fZ:GdAdB�dBe2�Z;dCdD�Z<e=ee.e+e-dE�e>ee<e4e;dE�iZ?ddFedG�dHd
�Z@ddFedG�dId�ZAe=dFdJdK�dLd�ZBe=dJdFdM�dNd
�ZCdS)P�	readPlist�
writePlist�readPlistFromBytes�writePlistToBytes�Plist�Data�Dict�InvalidFileException�FMT_XML�
FMT_BINARY�load�dump�loads�dumps�N)�BytesIO)�warn)�ParserCreate�PlistFormatzFMT_XML FMT_BINARY)�modulec@s(eZdZfZdd�Zdd�Zdd�ZdS)�
_InternalDictcCs:y||}Wntk
r(t|��YnXtdtd�|S)NzLAttribute access from plist dicts is deprecated, use d[key] notation instead�)�KeyError�AttributeErrorr�DeprecationWarning)�self�attr�value�r� /usr/lib64/python3.6/plistlib.py�__getattr__Vsz_InternalDict.__getattr__cCstdtd�|||<dS)NzLAttribute access from plist dicts is deprecated, use d[key] notation insteadr)rr)rrrrrr�__setattr___sz_InternalDict.__setattr__cCs8y
||=Wntk
r&t|��YnXtdtd�dS)NzLAttribute access from plist dicts is deprecated, use d[key] notation insteadr)rrrr)rrrrr�__delattr__ds
z_InternalDict.__delattr__N)�__name__�
__module__�__qualname__�	__slots__rr r!rrrrrOs	rcseZdZ�fdd�Z�ZS)rcstdtd�t�jf|�dS)Nz?The plistlib.Dict class is deprecated, use builtin dict insteadr)rr�super�__init__)r�kwargs)�	__class__rrr'osz
Dict.__init__)r"r#r$r'�
__classcell__rr)r)rrmsc	cs2t|t�r(t||��}|VWdQRXn|VdS)N)�
isinstance�str�open)�
pathOrFile�mode�fprrr�_maybe_openus
r1cs0eZdZ�fdd�Zedd��Zdd�Z�ZS)rcstdtd�t�jf|�dS)NzJThe Plist class is deprecated, use the load() and dump() functions insteadr)rrr&r')rr()r)rrr'�szPlist.__init__c	Cs2t|d��}t|�}WdQRX|�}|j|�|S)N�rb)r1r�update)�clsr.r0rZplistrrr�fromFile�s

zPlist.fromFilec
Cs$t|d��}t||�WdQRXdS)N�wb)r1r)rr.r0rrr�write�szPlist.write)r"r#r$r'�classmethodr5r7r*rr)r)rrs	c
Cs2tdtd�t|d��}t|ddtd�SQRXdS)Nz8The readPlist function is deprecated, use load() insteadrr2F)�fmt�use_builtin_types�	dict_type)rrr1rr)r.r0rrrr�s
cCs8tdtd�t|d��}t||tddd�WdQRXdS)Nz9The writePlist function is deprecated, use dump() insteadrr6TF)r9�	sort_keys�skipkeys)rrr1rr	)rr.r0rrrr�scCs tdtd�tt|�ddtd�S)NzBThe readPlistFromBytes function is deprecated, use loads() insteadrF)r9r:r;)rrrrr)�datarrrr�scCs,tdtd�t�}t||tddd�|j�S)NzAThe writePlistToBytes function is deprecated, use dumps() insteadrTF)r9r<r=)rrrrr	�getvalue)r�frrrr�s
c@s:eZdZdd�Zedd��Zd
dd�Zdd	�Zd
d�ZdS)rcCst|t�std��||_dS)Nzdata must be as bytes)r+�bytes�	TypeErrorr>)rr>rrrr'�s
z
Data.__init__cCs|t|��S)N)�_decode_base64)r4r>rrr�
fromBase64�szData.fromBase64�LcCst|j|�S)N)�_encode_base64r>)r�
maxlinelengthrrr�asBase64�sz
Data.asBase64cCs4t||j�r|j|jkSt|t�r,|j|kStSdS)N)r+r)r>rA�NotImplemented)r�otherrrr�__eq__�s


zData.__eq__cCsd|jjt|j�fS)Nz%s(%s))r)r"�reprr>)rrrr�__repr__�sz
Data.__repr__N)rE)	r"r#r$r'r8rDrHrKrMrrrrr�s

s�<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
zv[\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]rEcCsT|dd}g}x8tdt|�|�D]$}||||�}|jtj|��q"Wdj|�S)N��r�)�range�len�append�binasciiZ
b2a_base64�join)�srGZ
maxbinsize�pieces�i�chunkrrrrFsrFcCs(t|t�rtj|jd��Stj|�SdS)Nzutf-8)r+r,rTZ
a2b_base64�encode)rVrrrrC
s
rCz{(?P<year>\d\d\d\d)(?:-(?P<month>\d\d)(?:-(?P<day>\d\d)(?:T(?P<hour>\d\d)(?::(?P<minute>\d\d)(?::(?P<second>\d\d))?)?)?)?)?ZcCsNd}tj|�j�}g}x,|D]$}||}|dkr2P|jt|��qWtj|�S)N�year�month�day�hour�minute�second)r[r\r]r^r_r`)�_dateParser�match�	groupdictrS�int�datetime)rV�orderZgdZlst�key�valrrr�_date_from_strings
ricCs d|j|j|j|j|j|jfS)Nz%04d-%02d-%02dT%02d:%02d:%02dZ)r[r\r]r^r_r`)�drrr�_date_to_string&srkcCsZtj|�}|dk	rtd��|jdd�}|jdd�}|jdd�}|jdd�}|jd	d
�}|S)Nz<strings can't contains control characters; use bytes insteadz
�
�
�&z&amp;�<z&lt;�>z&gt;)�_controlCharPat�search�
ValueError�replace)�text�mrrr�_escape,s
rwc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'S)(�_PlistParsercCs"g|_d|_d|_||_||_dS)N)�stack�current_key�root�_use_builtin_types�
_dict_type)rr:r;rrrr'9s
z_PlistParser.__init__cCs8t�|_|j|j_|j|j_|j|j_|jj|�|j	S)N)
r�parser�handle_begin_elementZStartElementHandler�handle_end_elementZEndElementHandler�handle_dataZCharacterDataHandlerZ	ParseFiler{)rZfileobjrrr�parse@s


z_PlistParser.parsecCs*g|_t|d|d�}|dk	r&||�dS)NZbegin_)r>�getattr)r�element�attrs�handlerrrrrHsz!_PlistParser.handle_begin_elementcCs"t|d|d�}|dk	r|�dS)NZend_)r�)rr�r�rrrr�Nsz_PlistParser.handle_end_elementcCs|jj|�dS)N)r>rS)rr>rrrr�Ssz_PlistParser.handle_datacCs�|jdk	rFt|jdti��s.td|jj��||jd|j<d|_nB|jsT||_n4t|jdtg��sxtd|jj��|jdj|�dS)N�zunexpected element at line %d���r�r�r�)	rzr+ry�typersr~�CurrentLineNumberr{rS)rrrrr�
add_objectVs
z_PlistParser.add_objectcCsdj|j�}g|_|S)N�)rUr>)rr>rrr�get_datafsz_PlistParser.get_datacCs"|j�}|j|�|jj|�dS)N)r}r�ryrS)rr�rjrrr�
begin_dictms
z_PlistParser.begin_dictcCs*|jrtd|j|jjf��|jj�dS)Nz%missing value for key '%s' at line %d)rzrsr~r�ry�pop)rrrr�end_dictrsz_PlistParser.end_dictcCs:|jst|jdti��r,td|jj��|j�|_dS)Nr�zunexpected key at line %dr�)rzr+ryr�rsr~r�r�)rrrr�end_keyxsz_PlistParser.end_keycCsg}|j|�|jj|�dS)N)r�ryrS)rr��arrr�begin_array~s
z_PlistParser.begin_arraycCs|jj�dS)N)ryr�)rrrr�	end_array�sz_PlistParser.end_arraycCs|jd�dS)NT)r�)rrrr�end_true�sz_PlistParser.end_truecCs|jd�dS)NF)r�)rrrr�	end_false�sz_PlistParser.end_falsecCs|jt|j���dS)N)r�rdr�)rrrr�end_integer�sz_PlistParser.end_integercCs|jt|j���dS)N)r��floatr�)rrrr�end_real�sz_PlistParser.end_realcCs|j|j��dS)N)r�r�)rrrr�
end_string�sz_PlistParser.end_stringcCs2|jr|jt|j���n|jtj|j���dS)N)r|r�rCr�rrD)rrrr�end_data�sz_PlistParser.end_datacCs|jt|j���dS)N)r�rir�)rrrr�end_date�sz_PlistParser.end_dateN)r"r#r$r'r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrx8s&rxc@s8eZdZddd�Zdd�Zdd�Zdd
d�Zdd
�Zd	S)�_DumbXMLWriterr�	cCs||_g|_||_||_dS)N)�filery�
_indent_level�indent)rr��indent_levelr�rrrr'�sz_DumbXMLWriter.__init__cCs,|jj|�|jd|�|jd7_dS)Nz<%s>r�)ryrS�writelnr�)rr�rrr�
begin_element�sz_DumbXMLWriter.begin_elementcCs |jd8_|jd|�dS)Nr�z</%s>)r�r�)rr�rrr�end_element�sz_DumbXMLWriter.end_elementNcCs8|dk	r&t|�}|jd|||f�n|jd|�dS)Nz<%s>%s</%s>z<%s/>)rwr�)rr�rrrr�simple_element�sz_DumbXMLWriter.simple_elementcCsH|r8t|t�r|jd�}|jj|j|j�|jj|�|jjd�dS)Nzutf-8�
)r+r,rZr�r7r�r�)r�linerrrr��s

z_DumbXMLWriter.writeln)rr�)N)r"r#r$r'r�r�r�r�rrrrr��s


r�c@sFeZdZddd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Z	dS)�_PlistWriterr�	r�TFcCs.|r|jt�tj||||�||_||_dS)N)r7�PLISTHEADERr�r'�
_sort_keys�	_skipkeys)rr�r�r�ZwriteHeaderr<r=rrrr'�s

z_PlistWriter.__init__cCs"|jd�|j|�|jd�dS)Nz<plist version="1.0">z</plist>)r��write_value)rrrrrr7�s

z_PlistWriter.writecCs4t|t�r|jd|��n|dkr0|jd��n|dkrD|jd�n�t|t�r�d|ko`dknrx|jd	d
|�nt|��n�t|t�r�|jdt|��n�t|t�r�|j|�n|t|t	�r�|j
|�nft|ttf�r�|j
|�nLt|tj��r|jdt|��n,t|ttf��r |j|�ntd
t|���dS)N�stringT�trueFZfalser��?�@Zintegerz%d�realZdatezunsupported type: %sr�l����l)r+r,r�rd�
OverflowErrorr�rL�dict�
write_dictr�
write_datarA�	bytearray�write_bytesrerk�tuple�list�write_arrayrBr�)rrrrrr��s.





z_PlistWriter.write_valuecCs|j|j�dS)N)r�r>)rr>rrrr��sz_PlistWriter.write_datacCs~|jd�|jd8_tddt|jjdd	�|j��}x&t||�jd�D]}|rL|j|�qLW|jd7_|j	d�dS)
Nr>r��rEr�� �r�s        )
r�r��maxrRr�rtrF�splitr�r�)rr>rGr�rrrr��s
z_PlistWriter.write_bytescCs�|rx|jd�|jr"t|j��}n|j�}x@|D]8\}}t|t�sR|jrJq0td��|jd|�|j	|�q0W|j
d�n
|jd�dS)Nr�zkeys must be stringsrg)r�r��sorted�itemsr+r,r�rBr�r�r�)rrjr�rgrrrrr�s

z_PlistWriter.write_dictcCs@|r2|jd�x|D]}|j|�qW|jd�n
|jd�dS)N�array)r�r�r�r�)rr�rrrrr�s

z_PlistWriter.write_arrayN)rr�r�TF)
r"r#r$r'r7r�r�r�r�r�rrrrr��s
%
r�cCs�d	}x|D]}|j|�r
dSq
WxntjdftjdftjdffD]N\}}|j|�sRq>x8|D]0}||jd�j|�}|dt|��|krXdSqXWq>WdS)
N�<?xml�<plistTzutf-8z	utf-16-bez	utf-16-le�asciiF)r�r�)�
startswith�codecs�BOM_UTF8�BOM_UTF16_BE�BOM_UTF16_LE�decoderZrR)�header�prefixesZpfxZbom�encoding�start�prefixrrr�_is_fmt_xml*s



r�c@seZdZddd�ZdS)r�Invalid filecCstj||�dS)N)rsr')r�messagerrrr'LszInvalidFileException.__init__N)r�)r"r#r$r'rrrrrKs�B�H�L�Q)r�rrNr�c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�_BinaryPlistParsercCs||_||_dS)N)r|r})rr:r;rrrr'[sz_BinaryPlistParser.__init__cCs�y|||_|jjdtj�|jjd�}t|�dkr6t��tjd|�\}|_	}}}|jj|�|j
||�|_tg||_
|j|�Stttjttfk
r�t��YnXdS)N� z>6xBBQQQi��)�_fp�seek�os�SEEK_END�readrRr�struct�unpack�	_ref_size�
_read_ints�_object_offsets�
_undefined�_objects�_read_object�OSError�
IndexError�errorr�rs)rr0�trailer�offset_size�num_objects�
top_object�offset_table_offsetrrrr�_s
z_BinaryPlistParser.parsecCsL|dkrH|jjd�dd@}d|>}dt|}tj||jj|��dS|S)N�r�rrOrp)r�r��_BINARY_FORMATr�r�)r�tokenLrvrVr@rrr�	_get_sizexsz_BinaryPlistParser._get_sizecsv|jj�|���tkr2tjd|�t�����S�sHt���|krNt��t��fdd�td�|��D��SdS)Nrpc3s&|]}tj�||��d�VqdS)�bigN)rd�
from_bytes)�.0rX)r>�sizerr�	<genexpr>�sz0_BinaryPlistParser._read_ints.<locals>.<genexpr>r)	r�r�r�r�r�rRrr�rQ)r�nr�r)r>r�rr��sz_BinaryPlistParser._read_intscCs|j||j�S)N)r�r�)rr�rrr�
_read_refs�sz_BinaryPlistParser._read_refscs��j|}|tk	r|S�j|}�jj|��jjd�d}|d@|d@}}|dkr^d}�n�|dkrnd}�n||dkr~d}�nl|dkr�d	}�n\|d
kr�tj�jjd|>�d|dkd
�}�n0|dkr�tj	d�jjd��d}�n|dk�rtj	d�jjd��d}�n�|dk�rDtj	d�jjd��d}t
j
ddd�t
j|d�}�n�|dk�r��j|�}�jj|�}t
|�|k�rxt���j�s�t|�}�n^|dk�rΈj|�}�jj|�}	t
|	�|k�r�t��|	jd�}�n|dk�r�j|�d}�jj|�}	t
|	�|k�rt��|	jd�}n�|dk�rX�j|�}�j|�}
g}|�j|<|j�fdd�|
D��n�|dk�r�j|�}�j|�}�j|�}
�j�}|�j|<y2x,t||
�D]\}}
�j|
�|�j|�<�q�WWntk
�r�t��YnXnt��|�j|<|S) Nr�r��r�r�F�	TrPr�r�rO)�signed�"z>frN�#z>d�3i�)Zsecondsr��Pr��`rzutf-16be�c3s|]}�j|�VqdS)N)r�)r��x)rrrr��sz2_BinaryPlistParser._read_object.<locals>.<genexpr>��)r�r�r�r�r�r�rdr�r�r�reZ	timedeltar�rRrr|rr�r��extendr}�zipr�rB)r�ref�result�offset�tokenZtokenHr�r@rVr>Zobj_refsZkey_refs�k�or)rrr��s�


















z_BinaryPlistParser._read_objectN)	r"r#r$r'r�r�r�r�r�rrrrr�Ss

r�cCs0|dkrdS|dkrdS|d>d>r(dSdSdS)	Nr�r�r�rr�rN�ir)�countrrr�_count_to_size�src@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�_BinaryPlistWritercCs||_||_||_dS)N)r�r�r�)rr0r<r=rrrr'sz_BinaryPlistWriter.__init__c
Cs�g|_i|_i|_|j|�t|j�}dg||_t|�|_t|j|_	|j
jd�x|jD]}|j|�q\W|j
|�}|j
j�}t|�}dt||}|j
jtj|f|j���d}|||j|||f}	|j
jtjd|	���dS)Nrsbplist00rp�	>5xBBBQQQ)r)�_objlist�	_objtable�_objidtable�_flattenrRr�rr�r��_ref_formatr�r7�
_write_object�
_getrefnum�tellr��pack)
rrr��objr�r�r�Z
offset_formatZsort_versionr�rrrr7
s(





z_BinaryPlistWriter.writec	Cs~t|t�r"t|�|f|jkrZdSn8t|t�rHt|j�|jf|jkrZdSnt|�|jkrZdSt|j	�}|j	j
|�t|t�r�||jt|�|f<n0t|t�r�||jt|j�|jf<n||jt|�<t|t��rPg}g}|j�}|j
r�t|�}xB|D]:\}}t|t��s|j�rq�td��|j
|�|j
|�q�WxLtj||�D]}|j|��q:Wn*t|ttf��rzx|D]}|j|��qfWdS)Nzkeys must be strings)r+�_scalarsr�rrr>�idrrRrrSr�r�r�r�r,r�rB�	itertools�chainrr�r�)	rrZrefnum�keys�valuesr�r
�vrrrrr7sB






z_BinaryPlistWriter._flattencCsNt|t�r|jt|�|fSt|t�r<|jt|j�|jfS|jt|�SdS)N)r+rrr�rr>rr)rrrrrrgs


z_BinaryPlistWriter._getrefnumcCs�|dkr"|jjtjd||B��n�|dkrH|jjtjd|dBd|��nh|dkrn|jjtjd|dBd|��nB|dkr�|jjtjd
|dBd|��n|jjtjd|dBd
|��dS)Nr�z>Br�r�z>BBBr�z>BBH�r�z>BBL�z>BBQ�ril)r�r7r�r)rrr�rrr�_write_sizeosz_BinaryPlistWriter._write_sizecs��j|�}�jj��j|<|dkr2�jjd��n�|dkrJ�jjd��n�|dkrb�jjd��n�t|t��rl|dkr�y�jjtjdd|��Wn tj	k
r�t
|�d�YnXn�|d'krԈjjtjdd|��n�|d(kr�jjtjd
d|��nt|d)k�r�jjtjdd|��nR|d*k�r8�jjtjdd|��n0|d+k�r`�jjd|jdddd��nt
|���nxt|t��r��jjtjdd|���nRt|t
j
��r�|t
j
dd	d	�j�}�jjtjdd|���nt|t��r�jdt|j���jj|j��n�t|ttf��r0�jdt|���jj|��n�t|t��r�y|jd�}�jdt|��Wn4tk
�r�|jd�}�jdt|�d �YnX�jj|��nDt|ttf��r��fd!d"�|D�}t|�}�jd#|��jjtjd$�j|f|���n�t|t��r�gg}}�j�r&t|j��}	n|j�}	xR|	D]J\}
}t|
t��s\�j�rT�q4t d%��|j!�j|
��|j!�j|���q4Wt|�}�jd&|��jjtjd$�j|f|����jjtjd$�j|f|���nt |��dS),N�F�Tr�rz>Bqr'r�r�z>BBr�z>BHr%r�z>BLr&r�z>BQr��r�)r�z>Bdri�rr�rzutf-16berrcsg|]}�j|��qSr)r)r�r)rrr�
<listcomp>�sz4_BinaryPlistWriter._write_object.<locals>.<listcomp>rrpzkeys must be stringsrrilll)"rr�rr�r7r+rdr�rr�r��to_bytesr�reZ
total_secondsrr(rRr>rAr�r,rZ�UnicodeEncodeErrorr�r�rr�r�r�r�r�rBrS)rrr	r@�tZrefsrVZkeyRefsZvalRefsZ	rootItemsr
r$r)rrrs�





$
"$z _BinaryPlistWriter._write_objectN)	r"r#r$r'r7rrr(rrrrrrs-0rcCs|dd�dkS)Nr�sbplist00r)r�rrr�_is_fmt_binary�sr0)�detectr~�writerT)r9r:r;cCsn|dkrL|jd�}|jd�x:tj�D]}|d|�r&|d}Pq&Wt��nt|d}|||d�}|j|�S)Nr�rr1r~)r:r;)r�r��_FORMATSr#rr�)r0r9r:r;r��info�P�prrrr�s

cCst|�}t||||d�S)N)r9r:r;)rr)rr9r:r;r0rrrr
sF)r9r<r=cCs:|tkrtd|f��t|d|||d�}|j|�dS)NzUnsupported format: %rr2)r<r=)r3rsr7)rr0r9r<r=r2rrrrs)r9r=r<cCs t�}t|||||d�|j�S)N)r9r=r<)rrr?)rr9r=r<r0rrrrs)rE)D�__all__rTr��
contextlibre�enum�iorr r��rer��warningsrZxml.parsers.expatr�Enumr"r�globalsr3�__members__r�rr�contextmanagerr1rrrrrrr��compilerqrFrC�ASCIIrarirkrwrxr�r�r�rsrr��objectr�r�rr,rdr�rArrr0r	r
r3rr
rrrrrr�<module>1sx



0
	
h&d!#
S	
	_dummy_thread.cpython-36.opt-2.pyc000064400000005125150335715140012762 0ustar003


 \��@stdddddddgZdZeZifd	d�Zd
d�Zdd�Zdd�Zddd�Zdd�Z	Gdd�de
�Zdada
dd�Zd
S)�error�start_new_thread�exit�	get_ident�
allocate_lock�interrupt_main�LockType��cCs�t|�tt��krtd��t|�tt��kr4td��day|||�Wn.tk
rZYnddl}|j�YnXdatr�dat	�dS)Nz2nd arg must be a tuplez3rd arg must be a dictF�T)
�type�tuple�	TypeError�dict�_main�
SystemExit�	traceback�	print_exc�
_interrupt�KeyboardInterrupt)Zfunction�args�kwargsr�r�%/usr/lib64/python3.6/_dummy_thread.pyrs 
cCst�dS)N)rrrrrr=scCsdS)N����rrrrrrAscCst�S)N)rrrrrrJsNcCs|dk	rtd��dS)Nz'setting thread stack size not supportedr
)r)�sizerrr�
stack_sizeNsrcCst�S)N)rrrrr�
_set_sentinelTsrc@sBeZdZdd�Zddd�ZeZdd�Zd	d
�Zdd�Zd
d�Z	dS)rcCs
d|_dS)NF)�
locked_status)�selfrrr�__init__cszLockType.__init__NrcCsH|dks|rd|_dS|js&d|_dS|dkr@ddl}|j|�dSdS)NTr
F)r�timeZsleep)rZwaitflagZtimeoutr!rrr�acquirefs
zLockType.acquirecCs|j�dS)N)�release)r�typ�val�tbrrr�__exit__�szLockType.__exit__cCs|js
t�d|_dS)NFT)rr)rrrrr#�szLockType.releasecCs|jS)N)r)rrrr�locked�szLockType.lockedcCs*d|jrdnd|jj|jjtt|��fS)Nz<%s %s.%s object at %s>r(Zunlocked)r�	__class__�
__module__�__qualname__�hex�id)rrrr�__repr__�s
zLockType.__repr__r)Nr)
�__name__r*r+r r"�	__enter__r'r#r(r.rrrrrXs
	FTcCstr
t�ndadS)NT)rrrrrrrr�sl)N)�__all__�TIMEOUT_MAX�RuntimeErrorrrrrrrr�objectrrrrrrrr�<module>s
 	
@hmac.cpython-36.opt-1.pyc000064400000013577150335715140011062 0ustar003

�\dh��@s�dZddlZddlmZddlZddlZddl	Z	e
dd�ed�D��Ze
dd�ed�D��Z
dZGdd	�d	�Zd
d�ZGdd
�d
e	j�Zej�r�eZddd�ZdS)zxHMAC (Keyed-Hashing for Message Authentication) Python module.

Implements the HMAC algorithm as described by RFC 2104.
�N)�_compare_digestccs|]}|dAVqdS)�\N�)�.0�xrr�/usr/lib64/python3.6/hmac.py�	<genexpr>sr�ccs|]}|dAVqdS)�6Nr)rrrrrr
sc@sReZdZdZdZddd�Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�ZdS)�HMACz~RFC 2104 HMAC class.  Also complies with RFC 4231.

    This supports the API for Cryptographic Hash Functions (PEP 247).
    �@Ncsftj�rtd��t|ttf�s0tdt|�j���dkrLt	j
dtd�tj
�t��r\�|_n,t�t�rxd�fdd	�	|_nd�fd
d	�	|_|j�|_|j�|_|jj|_t|jd�r�|jj}|dkr�t	j
d
||jftd�|j}nt	j
d|jtd�|j}||_t|�|k�r|j|�j�}|j|d�}|jj|jt��|jj|jt��|dk	�rb|j|�dS)a1Create a new HMAC object.

        key:       key for the keyed hash object.
        msg:       Initial input for the hash, if provided.
        digestmod: A module supporting PEP 247.  *OR*
                   A hashlib constructor returning a new hash object. *OR*
                   A hash name suitable for hashlib.new().
                   Defaults to hashlib.md5.
                   Implicit default to hashlib.md5 is deprecated and will be
                   removed in Python 3.6.

        Note: key and msg must be a bytes or bytearray objects.
        z*This class is not available in FIPS mode. zUse hmac.new().z,key: expected bytes or bytearray, but got %rNz<HMAC() without an explicit digestmod argument is deprecated.��cstj�|�S)N)�_hashlib�new)�d)�	digestmodrr�<lambda>;szHMAC.__init__.<locals>.<lambda>cs
�j|�S)N)r)r)rrrr=s�
block_size�z:block_size of %d seems too small; using our default of %d.z<No block_size attribute on given digest object; Assuming %d.�z9This class is not available in FIPS mode. Use hmac.new().)r)r)�_hashlibopenssl�
get_fips_mode�
ValueError�
isinstance�bytes�	bytearray�	TypeError�type�__name__�	_warnings�warn�PendingDeprecationWarningrZmd5�callable�digest_cons�str�outer�inner�digest_size�hasattrr�	blocksize�RuntimeWarning�len�digest�ljust�update�	translate�trans_5C�trans_36)�self�key�msgrr*r)rr�__init__sJ





z
HMAC.__init__cCsd|jjS)Nzhmac-)r'�name)r3rrrr7]sz	HMAC.namecCs tj�rtd��|jj|�dS)z8Update this hashing object with the string msg.
        z'hmac.HMAC is not available in FIPS modeN)rrrr'r/)r3r5rrrr/aszHMAC.updatecCs:|jj|j�}|j|_|j|_|jj�|_|jj�|_|S)zyReturn a separate copy of this hashing object.

        An update to this copy won't affect the original object.
        )�	__class__�__new__r$r(r'�copyr&)r3�otherrrrr:hsz	HMAC.copycCs|jj�}|j|jj��|S)zwReturn a hash object for the current state.

        To be used only internally with digest() and hexdigest().
        )r&r:r/r'r-)r3�hrrr�_currentus
z
HMAC._currentcCs|j�}|j�S)z�Return the hash value of this hashing object.

        This returns a string containing 8-bit data.  The object is
        not altered in any way by this function; you can continue
        updating the object after calling this function.
        )r=r-)r3r<rrrr-~szHMAC.digestcCs|j�}|j�S)zKLike digest(), but returns a string of hexadecimal digits instead.
        )r=�	hexdigest)r3r<rrrr>�szHMAC.hexdigest)NN)
r�
__module__�__qualname__�__doc__r*r6�propertyr7r/r:r=r-r>rrrrrs
A
	
rcCsX|dkrtd��t|t�r"|j�St|�r2|d�}t|tj�sFtd��|jj�j	dd�S)Nz.'digestmod' argument is mandatory in FIPS moderz6Only OpenSSL hashlib hashes are accepted in FIPS mode.�_�-)
rrr%�lowerr#rZHASHrr7�replace)rrrr�_get_openssl_name�s
rGc@seZdZddd�ZdS)�HMAC_opensslNcCsLt|ttf�s tdt|�j��t|�}tjj	|||d�}|rH|j
|�|S)Nz,key: expected bytes or bytearray, but got %r)r)rrrrrrrG�_hmacopensslrr9r/)�clsr4r5rr7�resultrrrr9�s
zHMAC_openssl.__new__)NN)rr?r@r9rrrrrH�srHcCst|||�S)aVCreate a new hashing object and return it.

    key: The starting key for the hash.
    msg: if available, will immediately be hashed into the object's starting
    state.

    You can now feed arbitrary strings into the object using its update()
    method, and can ask for the hash value at any time by calling its digest()
    method.
    )r)r4r5rrrrr�sr)NN)rA�warningsr �	_operatorrZcompare_digestZhashlibrrrIr�ranger1r2r(rrGrHrrrrrr�<module>szio.cpython-36.opt-2.pyc000064400000003552150335715140010552 0ustar003


 \�
�@sfdZddddddddd	d
ddd
dddddgZddlZddlZddlmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZejZde_dZdZdZGdd�dejejd�ZGdd�deje�ZGdd�deje�ZGdd
�d
eje�Zeje�x e	eeee
fD]Z eje �q�Wxe
efD]Z eje ��qW[ yddlm!Z!Wne"k
�rVYnXeje!�dS)z�Guido van Rossum <guido@python.org>, Mike Verdone <mike.verdone@gmail.com>, Mark Russell <mark.russell@zen.co.uk>, Antoine Pitrou <solipsis@pitrou.net>, Amaury Forgeot d'Arc <amauryfa@gmail.com>, Benjamin Peterson <benjamin@python.org>�BlockingIOError�open�IOBase�	RawIOBase�FileIO�BytesIO�StringIO�BufferedIOBase�BufferedReader�BufferedWriter�BufferedRWPair�BufferedRandom�
TextIOBase�
TextIOWrapper�UnsupportedOperation�SEEK_SET�SEEK_CUR�SEEK_END�N)
�DEFAULT_BUFFER_SIZErrrrrrr	r
rr�IncrementalNewlineDecoderr�io��c@seZdZejjZdS)rN)�__name__�
__module__�__qualname__�_io�_IOBase�__doc__�rr�/usr/lib64/python3.6/io.pyrHs)�	metaclassc@seZdZejjZdS)rN)rrrr�
_RawIOBaserrrrr rKsc@seZdZejjZdS)rN)rrrr�_BufferedIOBaserrrrr rNsc@seZdZejjZdS)r
N)rrrr�_TextIOBaserrrrr r
Qs)�_WindowsConsoleIO)#�
__author__�__all__r�abcrrrrrrrr	r
rrrr�OpenWrapperrrrrr�ABCMetarr"rr#rr$r
�register�klassr%�ImportErrorrrrr �<module>%s:
<


compileall.cpython-36.pyc000064400000020130150335715140011313 0ustar003


 \]/�@s�dZddlZddlZddlZddlZddlZddlmZdddgZ	ddd	�Z
ddd�Zdd
d�Zddd�Z
dd�Zedkr�ee��Zeje�dS)a�Module/script to byte-compile all .py files to .pyc files.

When called as a script with arguments, this compiles the directories
given as arguments recursively; the -l option prevents it from
recursing into directories.

Without arguments, if compiles all modules on sys.path, without
recursing into subdirectories.  (Even though it should do so for
packages -- for now, you'll have to deal with packages separately.)

See module py_compile for details of the actual byte-compilation.
�N)�partial�compile_dir�compile_file�compile_path�
ccs |dkrt|tj�rtj|�}|s0tdj|��ytj|�}Wn.tk
rl|dkrdtdj|��g}YnX|j�x�|D]�}|dkr�q|tj	j
||�}|dk	r�tj	j
||�}nd}tj	j|�s�|Vq||dkr||tjkr||tj
kr|tj	j|�r|tj	j|�r|t|||d|d�EdHq|WdS)N�zListing {!r}...zCan't list {!r}�__pycache__r�)�ddir�	maxlevels�quiet)�
isinstance�os�PathLike�fspath�print�format�listdir�OSError�sort�path�join�isdir�curdir�pardir�islink�	_walk_dir)�dirr
rr�names�name�fullname�dfile�r"�"/usr/lib64/python3.6/compileall.pyrs0


rFr	c	Cs�d}	|dk	rP|dkrtd��n2|dkrPyddlm}	Wntk
rNd}YnXt||||d�}
d}|dk	r�|dkr�|	dk	r�|p�d}|	|d��0}|jtt||||||d	�|
�}
t|
dd
�}WdQRXn&x$|
D]}t|||||||�s�d}q�W|S)a�Byte-compile all modules in the given directory tree.

    Arguments (only dir is required):

    dir:       the directory to byte-compile
    maxlevels: maximum recursion level (default 10)
    ddir:      the directory that will be prepended to the path to the
               file as it is compiled into each byte-code file.
    force:     if True, force compilation, even if timestamps are up-to-date
    quiet:     full output with False or 0, errors only with 1,
               no output with 2
    legacy:    if True, produce legacy pyc paths instead of PEP 3147 paths
    optimize:  optimization level or -1 for level of the interpreter
    workers:   maximum number of parallel workers
    Nrz%workers must be greater or equal to 0r	)�ProcessPoolExecutor)rrr
T)Zmax_workers)r
�force�rxr�legacy�optimize)�defaultF)	�
ValueErrorZconcurrent.futuresr$�ImportErrorr�maprr�min)rrr
r%r&rr'r(�workersr$�files�successZexecutorZresults�filer"r"r#r2s6


cCs�d}|dkr"t|tj�r"tj|�}tjj|�}|dk	rFtjj||�}	nd}	|dk	rd|j|�}
|
rd|Stjj|��r�|r�|d}nB|dkr�|dkr�|nd}t	j
j||d�}nt	j
j|�}tjj|�}
|dd�|dd�}}|d
k�r�|�sXyTt
tj|�j�}tjdt	j
j|�}t|d��}|jd
�}WdQRX||k�r>|SWntk
�rVYnX|�sltdj|��ytj|||	d|d�}Wn�tjk
�r}zdd}|dk�r�|S|�r�tdj|��ntddd�|jjtjjdd�}|j tjj�}t|�WYdd}~Xn~t!t"tfk
�rv}zLd}|dk�r2|S|�rHtdj|��ntddd�t|j#j$d|�WYdd}~XnX|dk�r�d}|S)aByte-compile one file.

    Arguments (only fullname is required):

    fullname:  the file to byte-compile
    ddir:      if given, the directory name compiled in to the
               byte-code file.
    force:     if True, force compilation, even if timestamps are up-to-date
    quiet:     full output with False or 0, errors only with 1,
               no output with 2
    legacy:    if True, produce legacy pyc paths instead of PEP 3147 paths
    optimize:  optimization level or -1 for level of the interpreter
    TrN�crr	�)�optimization�z.pyz<4sl�rb�zCompiling {!r}...)r(Fz*** Error compiling {!r}...z*** )�end�backslashreplace)�errors�:���r<)%r
rrrr�basenamer�search�isfile�	importlib�util�cache_from_source�dirname�int�stat�st_mtime�structZpack�MAGIC_NUMBER�open�readrrr�
py_compile�compile�PyCompileError�msg�encode�sys�stdout�encoding�decode�SyntaxError�UnicodeError�	__class__�__name__)r r
r%r&rr'r(r0rr!Zmo�cfile�optZ	cache_dir�head�tail�mtimeZexpectZchandleZactual�ok�errrN�er"r"r#rbsx






$
c
CsXd}xNtjD]D}|s |tjkr6|r6|dkrPtd�q|oNt||d||||d�}qW|S)awByte-compile all module on sys.path.

    Arguments (all optional):

    skip_curdir: if true, skip current directory (default True)
    maxlevels:   max recursion level (default 0)
    force: as for compile_dir() (default False)
    quiet: as for compile_dir() (default 0)
    legacy: as for compile_dir() (default False)
    optimize: as for compile_dir() (default -1)
    TrzSkipping current directoryN)rr'r()rPrrrrr)Zskip_curdirrr%rr'r(r0rr"r"r#r�s

c
Cszddl}|jdd�}|jdddddd	d
�|jdtdd
d�|jddddd�|jdddddd�|jddddd�|jdddddd �|jd!d"d#dd$d �|jd%d&d'd(d)�|jd*d+d,d-d.�|jd/d0d1td2d3�|j�}|j}|jr�ddl}|j|j�|_|j	dk	�r|j	}n|j
}|j�r�yJ|jd4k�r4tj
nt|j��$}x|D]}|j|j���qFWWdQRXWn2tk
�r�|jd5k�r�td6j|j��d7SX|jdk	�r�|j�p�d|_d8}y�|�r4xj|D]b}	tjj|	��rt|	|j|j|j|j|j��s*d7}n*t|	||j|j|j|j|j|jd9��s�d7}�q�W|St|j|j|jd:�SWn*tk
�rt|jd5k�rptd;�d7SXd8S)<zScript main program.rNz1Utilities to support installing Python libraries.)Zdescriptionz-lZstore_constrrz!don't recurse into subdirectories)�actionZconstr)�dest�helpz-r�	recursionzhcontrol the maximum recursion level. if `-l` and `-r` options are specified, then `-r` takes precedence.)�typerarbz-f�
store_truer%z/force rebuild even if timestamps are up to date)r`rarbz-q�countrzIoutput only error messages; -qq will suppress the error messages as well.)r`rar)rbz-br'z0use legacy (pre-PEP3147) compiled file locationsz-dZDESTDIRr
z�directory to prepend to file paths for use in compile-time tracebacks and in runtime tracebacks in cases where the source file is unavailable)�metavarrar)rbz-xZREGEXPr&zskip files matching the regular expression; the regexp is searched for in the full path of each file considered for compilationz-iZFILE�flistzzadd all the files and directories listed in FILE to the list considered for compilation; if "-", names are read from stdin)rgrarb�compile_destzFILE|DIR�*zrzero or more file and directory names to compile; if no arguments given, defaults to the equivalent of -l sys.path)rg�nargsrbz-jz	--workersr	zRun compileall concurrently)r)rdrb�-rzError reading file list {}FT)r.)r'r%rz
[interrupted]) �argparse�ArgumentParser�add_argumentrD�
parse_argsrir&�rerLrcrrhrP�stdinrI�append�striprrrrr.rrr?rr
r%r'rr�KeyboardInterrupt)
rm�parser�argsZ
compile_destsrqr�f�liner0rar"r"r#�main�s~








"



rz�__main__)Nrr���)rNFNrFr|r	r|)NFNrFr|r|)r	rFrFr|)�__doc__rrP�importlib.utilr@rKrG�	functoolsr�__all__rrrrrzrWrDZexit_status�exitr"r"r"r#�<module>s$


/
R
[_compat_pickle.cpython-36.opt-1.pyc000064400000014556150335715140013121 0ustar003


 \-"�C@s�dddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*�*Zd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d��d�d�d�d�d�d�d�d�di!Z�d	ZyeWnek
�rYnXe�d
7ZxeD]Zdefed�ef<�q*W�dZxeD]ZdQefed�ef<�qPWed�d��ej�D��Z	ed�d��ej�D��Z
ejd�d�dddd"d"dEdEdEd(d�d�d��
�e	jd�d(d/d�d�d���ej�d�d
�d�d�d�d�d�di�e
j�d�d�d�d�d�d�d�d�d�d�d�d�d �d!�d"�d#�d$�d%�d&�d'�d(�d)�d*�d+�d,�d-i
��d.ZxeD]Z�d/e
def<�qzW�d0Z
xe
D]Z�d1e
def<�q�Wd�S(2�builtins�copyregZqueueZsocketserverZconfigparser�reprlib�tkinter.filedialog�tkinter.simpledialogztkinter.colorchooserztkinter.commondialogztkinter.dialogztkinter.dndztkinter.fontztkinter.messageboxztkinter.scrolledtextztkinter.constantsztkinter.tixztkinter.ttkZtkinterZ_markupbase�winreg�_threadZ
_dummy_threadzdbm.bsdzdbm.dumbzdbm.ndbmzdbm.gnuz
xmlrpc.client�
xmlrpc.serverzhttp.clientz
html.entitieszhtml.parserzhttp.cookieszhttp.cookiejar�http.serverztest.support�
subprocess�urllib.parsezurllib.robotparser�urllib.request�dbmzcollections.abc)*�__builtin__Zcopy_regZQueueZSocketServerZConfigParser�reprZtkFileDialogZtkSimpleDialogZtkColorChooserZtkCommonDialogZDialogZTkdndZtkFontZtkMessageBoxZScrolledTextZTkconstantsZTixZttkZTkinterZ
markupbase�_winregZthreadZdummy_threadZdbhashZdumbdbmr
�gdbmZ	xmlrpclibZSimpleXMLRPCServerZhttplibZhtmlentitydefsZ
HTMLParserZCookieZ	cookielibZBaseHTTPServerztest.test_supportZcommandsZurlparseZrobotparser�urllib2ZanydbmZ_abcollr�xrange�range�reduce�	functools�intern�sys�unichr�chr�unicode�str�long�int�	itertools�izip�zip�imap�map�ifilter�filter�ifilterfalse�filterfalse�izip_longest�zip_longest�UserDict�IterableUserDict�collections�UserList�
UserString�whichdb�_socket�fromfd�socket�_multiprocessing�
Connection�multiprocessing.connection�multiprocessing.process�Process�multiprocessing.context�multiprocessing.forking�Popen�multiprocessing.popen_fork�urllib�ContentTooShortError�urllib.error�
getproxies�pathname2url�
quote_plus�quote�unquote_plus�unquote�url2pathname�
urlcleanup�	urlencode�urlopen�urlretriever�	HTTPError�URLError�ArithmeticError�AssertionError�AttributeError�
BaseException�BufferError�BytesWarning�DeprecationWarning�EOFError�EnvironmentError�	Exception�FloatingPointError�
FutureWarning�
GeneratorExit�IOError�ImportError�
ImportWarning�IndentationError�
IndexError�KeyError�KeyboardInterrupt�LookupError�MemoryError�	NameError�NotImplementedError�OSError�
OverflowError�PendingDeprecationWarning�ReferenceError�RuntimeError�RuntimeWarning�
StopIteration�SyntaxError�
SyntaxWarning�SystemError�
SystemExit�TabError�	TypeError�UnboundLocalError�UnicodeDecodeError�UnicodeEncodeError�UnicodeError�UnicodeTranslateError�UnicodeWarning�UserWarning�
ValueError�Warning�ZeroDivisionError�WindowsError�
exceptions�AuthenticationError�BufferTooShort�ProcessError�TimeoutErrorZmultiprocessingccs|]\}}||fVqdS)N�)�.0�k�vr�r��&/usr/lib64/python3.6/_compat_pickle.py�	<genexpr>�sr�ccs|]\}}||fVqdS)Nr�)r�r�r�r�r�r�r��s�picklezxml.etree.ElementTree�io)
ZcPickleZ_elementtree�
FileDialog�SimpleDialog�DocXMLRPCServer�SimpleHTTPServer�
CGIHTTPServerr*r-r.r/�StringIOZ	cStringIO�bz2r)Z_bz2Z_dbm�
_functoolsZ_gdbm�_pickle�
basestring�
StandardError�
_socketobject�
SocketTyper�r��LoadFileDialog�SaveFileDialogr��
ServerHTMLDocr��XMLRPCDocGenerator�DocXMLRPCRequestHandler�DocCGIXMLRPCRequestHandler�SimpleHTTPRequestHandlerr��CGIHTTPRequestHandlerr��BrokenPipeError�ChildProcessError�ConnectionAbortedError�ConnectionError�ConnectionRefusedError�ConnectionResetError�FileExistsError�FileNotFoundError�InterruptedError�IsADirectoryError�NotADirectoryError�PermissionError�ProcessLookupError�ModuleNotFoundErrorN)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr )rr!)rr")rr#)rr$)rr%)rr&)rr')rr()rr))r*r+)r,r*)r-r-)r,r-)r.r.)r,r.)r/r/)r
r/)r0r1)r2r1)r3r4)r5r4)r6r7)r8r7)r9r:)r;r:)r<r=)r>r=)r<r?)rr?)r<r@)rr@)r<rA)rrA)r<rB)rrB)r<rC)rrC)r<rD)rrD)r<rE)rrE)r<rF)rrF)r<rG)rrG)r<rH)rrH)r<rI)rrI)rrJ)r>rJ)rrK)r>rK)/rLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrz)r{)r}r~rr�)rr�)rr)r|r�)rrU)r*r*)r,r*)r2r�)r2r�)r�r)rr)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)r	r�)r�r�)r	r�)r�r�)r0r2)r2r�)r�r�r�r�r�r�r�r�r�r�r�r�r�r�)r|rd)r�)r|rZ)ZIMPORT_MAPPINGZNAME_MAPPINGZPYTHON2_EXCEPTIONSr{rbZexcnameZMULTIPROCESSING_EXCEPTIONS�dict�itemsZREVERSE_IMPORT_MAPPINGZREVERSE_NAME_MAPPING�updateZPYTHON3_OSERROR_EXCEPTIONSZPYTHON3_IMPORTERROR_EXCEPTIONSr�r�r�r��<module>	s�






os.cpython-36.pyc000064400000071676150335715140007640 0ustar003


 \���0@s�dZddlZddlZddlZddlZejZddddddd	d
ddd
ddddddddgZdd�Z	dd�Z
dekr�dZdZddl
Tyddl
mZejd�Wnek
r�YnXddlZyddl
mZWnek
r�YnXddl
Z
eje
e
��[
n�d ek�r�d Zd!ZddlTyddlmZejd�Wnek
�r>YnXddlZddlZeje
e��[yddlmZWnek
�r�YnXned"��eejd#<dd$lmZmZmZmZmZmZmZm Z [e	d%��r�e!�Z"d&d'�Z#e$�Z%e#d(d)�e#d*d+�e#d,d-�e#d.d/�e#d0d1�e#d2d3�e#d4d5�e#d6d7�e#d8d9�e#d:d;�e#d<d=�e#d>d?�e#d@dA�e#dBdC�e#dBdD�e#dEd1�e%Z&e$�Z%e#d(d)�e%Z'e$�Z%e#dFdG�e#dHd+�e#dId-�e#dJdK�e#dLdM�e%j(e�e#dNdO�e#dPd1�e#dQd1�e#dRdS�e	dT��r$e	dU��r$e#dVdT�e%Z)e$�Z%e#d(d)�e#d,d-�e#d.d/�e#dWdX�e#dYd+�e	dZ��rte#d[d-�e#d2d3�e#d\d1�e#d]d/�e#d.d/�e#dEd1�e#d^d/�e%Z*[%[["[#dZ+d_Z,d`Z-d�dcdd�Z.dedf�Z/dgdh�Z0ejdddfdhg�d�djdk�Z1ejdk�e2ehe&k�rFe3ehe)k�rFd�dbddm�dndo�Z4dpdq�Z5ejdo�ye6Wne7k
�rhiZ6YnXdrds�Z8dtdu�Z9dvdw�Z:dxdy�Z;dzd{�Z<d|d}�Z=ejdsdudwdyd{d}g�d�d~d�Z>d�d�d�Z?dd�l@mAZAGd�d��d�eA�ZByeCZDWne7k
�rd�d��ZDYnXd�ek�rejd��yeEZFWne7k
�rBd�d��ZFYnXd�ek�rXejd��d�d��ZGeG�Z6[Gd�d�d��ZHed kZIejd��eI�r�d�d��ZJeBe6jKeJeLeJeLeDeF�ZM[Jd�d�d��ZNejd��d�d��ZOeO�\ZPZQ[Oe	d���rHe	d���rHe	d���rHdZRd_ZSZTejd�d�d�g�d�d��ZUd�d��ZVd�d��ZWd�d��ZXd�d��ZYejd�d�d�d�g�e	d���rpd�d��ZZd�d��Z[ejd�d�g�e	d���r�d�d��Z\d�d��Z]ejd�d�g�d�d�d�Z^Gd�d��d��Z_d�d�Z`d�d��Zae	d���s�eaZbd�eb_cGd�d��d�ejd�ZedS)�aNOS routines for NT or Posix depending on what system we're on.

This exports:
  - all functions from posix or nt, e.g. unlink, stat, etc.
  - os.path is either posixpath or ntpath
  - os.name is either 'posix' or 'nt'
  - os.curdir is a string representing the current directory (always '.')
  - os.pardir is a string representing the parent directory (always '..')
  - os.sep is the (or a most common) pathname separator ('/' or '\\')
  - os.extsep is the extension separator (always '.')
  - os.altsep is the alternate pathname separator (None or '/')
  - os.pathsep is the component separator used in $PATH etc
  - os.linesep is the line separator in text files ('\r' or '\n' or '\r\n')
  - os.defpath is the default search path for executables
  - os.devnull is the file path of the null device ('/dev/null', etc.)

Programs that import and use 'os' stand a better chance of being
portable between different platforms.  Of course, they must then
only use functions that are defined by all platforms (e.g., unlink
and opendir), and leave all pathname manipulation to os.path
(e.g., split and join).
�N�altsep�curdir�pardir�sep�pathsep�linesep�defpath�name�path�devnull�SEEK_SET�SEEK_CUR�SEEK_END�fsencode�fsdecode�
get_exec_path�fdopen�popen�extsepcCs
|t�kS)N)�globals)r	�r�/usr/lib64/python3.6/os.py�_exists%srcCs2y
t|j�Stk
r,dd�t|�D�SXdS)NcSsg|]}|ddkr|�qS)r�_r)�.0�nrrr�
<listcomp>,sz%_get_exports_list.<locals>.<listcomp>)�list�__all__�AttributeError�dir)�modulerrr�_get_exports_list(s
r"�posix�
)�*)�_exitr&)�_have_functions�ntz
zno os specific module foundzos.path)rrrrrrrrr'cCs"|tkr|tkrtjt|�dS)N)�_globalsr'�_set�add)�str�fnrrr�_adddsr.�HAVE_FACCESSAT�access�
HAVE_FCHMODAT�chmod�
HAVE_FCHOWNAT�chown�HAVE_FSTATAT�stat�HAVE_FUTIMESAT�utime�HAVE_LINKAT�link�HAVE_MKDIRAT�mkdir�
HAVE_MKFIFOAT�mkfifo�HAVE_MKNODAT�mknod�HAVE_OPENAT�open�HAVE_READLINKAT�readlink�
HAVE_RENAMEAT�rename�HAVE_SYMLINKAT�symlink�
HAVE_UNLINKAT�unlink�rmdir�HAVE_UTIMENSAT�HAVE_FCHDIR�chdir�HAVE_FCHMOD�HAVE_FCHOWN�HAVE_FDOPENDIR�listdir�HAVE_FEXECVE�execve�HAVE_FTRUNCATE�truncate�
HAVE_FUTIMENS�HAVE_FUTIMES�HAVE_FPATHCONF�pathconf�statvfs�fstatvfs�
HAVE_FSTATVFS�
HAVE_LCHFLAGSZchflags�HAVE_LCHMOD�lchown�HAVE_LCHOWN�HAVE_LUTIMES�
HAVE_LSTATZ
MS_WINDOWS���FcCs�tj|�\}}|s tj|�\}}|r~|r~tj|�r~yt|||�Wntk
rXYnXt}t|t�rrttd�}||kr~dSyt||�Wn(t	k
r�|s�tj
|�r��YnXdS)a�makedirs(name [, mode=0o777][, exist_ok=False])

    Super-mkdir; create a leaf directory and all intermediate ones.  Works like
    mkdir, except that any intermediate path segment (not just the rightmost)
    will be created if it does not exist. If the target directory already
    exists, raise an OSError if exist_ok is False. Otherwise no exception is
    raised.  This is recursive.

    �ASCIIN)r
�split�exists�makedirs�FileExistsErrorr�
isinstance�bytesr<�OSError�isdir)r	�mode�exist_ok�head�tail�cdirrrrrj�s$


rjcCslt|�tj|�\}}|s(tj|�\}}x>|rf|rfyt|�Wntk
rTPYnXtj|�\}}q*WdS)a�removedirs(name)

    Super-rmdir; remove a leaf directory and all empty intermediate
    ones.  Works like rmdir except that, if the leaf directory is
    successfully removed, directories corresponding to rightmost path
    segments will be pruned away until either the whole path is
    consumed or an error occurs.  Errors during this latter phase are
    ignored -- they generally mean that a directory was not empty.

    N)rKr
rhrn)r	rrrsrrr�
removedirs�s
rucCsptj|�\}}|r*|r*tj|�r*t|�t||�tj|�\}}|rl|rlyt|�Wntk
rjYnXdS)a<renames(old, new)

    Super-rename; create directories as necessary and delete any left
    empty.  Works like rename, except creation of any intermediate
    directories needed to make the new pathname good is attempted
    first.  After the rename, directories corresponding to rightmost
    path segments of the old name will be pruned until either the
    whole path is consumed or a nonempty directory is found.

    Note: this function can fail with the new directory structure made
    if you lack permissions needed to unlink the leaf directory or
    file.

    N)r
rhrirjrFrurn)�old�newrrrsrrr�renames�s
rxTc6cs�t|�}g}g}g}yt|�}Wn0tk
rP}z|dk	rB||�dSd}~XnX|���x�y(yt|�}	Wntk
r�PYnXWn0tk
r�}z|dk	r�||�dSd}~XnXy|	j�}
Wntk
r�d}
YnX|
r�|j|	j�n|j|	j�|r^|
r^|�rd}n.y|	j�}Wntk
�r8d}YnX|}|r^|j|	j	�q^WWdQRX|�r�|||fVt	j
t	j}
}xp|D]6}|||�}|�s�|
|��r�t||||�EdH�q�Wn0x"|D]}t||||�EdH�q�W|||fVdS)a�
Directory tree generator.

    For each directory in the directory tree rooted at top (including top
    itself, but excluding '.' and '..'), yields a 3-tuple

        dirpath, dirnames, filenames

    dirpath is a string, the path to the directory.  dirnames is a list of
    the names of the subdirectories in dirpath (excluding '.' and '..').
    filenames is a list of the names of the non-directory files in dirpath.
    Note that the names in the lists are just names, with no path components.
    To get a full path (which begins with top) to a file or directory in
    dirpath, do os.path.join(dirpath, name).

    If optional arg 'topdown' is true or not specified, the triple for a
    directory is generated before the triples for any of its subdirectories
    (directories are generated top down).  If topdown is false, the triple
    for a directory is generated after the triples for all of its
    subdirectories (directories are generated bottom up).

    When topdown is true, the caller can modify the dirnames list in-place
    (e.g., via del or slice assignment), and walk will only recurse into the
    subdirectories whose names remain in dirnames; this can be used to prune the
    search, or to impose a specific order of visiting.  Modifying dirnames when
    topdown is false is ineffective, since the directories in dirnames have
    already been generated by the time dirnames itself is generated. No matter
    the value of topdown, the list of subdirectories is retrieved before the
    tuples for the directory and its subdirectories are generated.

    By default errors from the os.scandir() call are ignored.  If
    optional arg 'onerror' is specified, it should be a function; it
    will be called with one argument, an OSError instance.  It can
    report the error to continue with the walk, or raise the exception
    to abort the walk.  Note that the filename is available as the
    filename attribute of the exception object.

    By default, os.walk does not follow symbolic links to subdirectories on
    systems that support them.  In order to get this functionality, set the
    optional argument 'followlinks' to true.

    Caution:  if you pass a relative pathname for top, don't change the
    current working directory between resumptions of walk.  walk never
    changes the current directory, and assumes that the client doesn't
    either.

    Example:

    import os
    from os.path import join, getsize
    for root, dirs, files in os.walk('python/Lib/email'):
        print(root, "consumes", end="")
        print(sum([getsize(join(root, name)) for name in files]), end="")
        print("bytes in", len(files), "non-directory files")
        if 'CVS' in dirs:
            dirs.remove('CVS')  # don't visit CVS directories

    NFT)
�fspath�scandirrn�next�
StopIteration�is_dir�appendr	�
is_symlinkr
�islink�join�walk)�top�topdown�onerror�followlinks�dirs�nondirs�	walk_dirs�
scandir_it�error�entryr}�	walk_intorr�r��dirname�new_pathrrrr�s`:





r��.)�follow_symlinks�dir_fdccs�t|t�st|d�r t|�}t|d|d�}t|t|d�}z:|s^tj|j	�rtt
j|t|��rtt|||||�EdHWdt
|�XdS)aDirectory tree generator.

        This behaves exactly like walk(), except that it yields a 4-tuple

            dirpath, dirnames, filenames, dirfd

        `dirpath`, `dirnames` and `filenames` are identical to walk() output,
        and `dirfd` is a file descriptor referring to the directory `dirpath`.

        The advantage of fwalk() over walk() is that it's safe against symlink
        races (when follow_symlinks is False).

        If dir_fd is not None, it should be a file descriptor open to a directory,
          and top should be relative; top will then be relative to that directory.
          (dir_fd is always supported for fwalk.)

        Caution:
        Since fwalk() yields file descriptors, those are only valid until the
        next iteration step, so you should dup() them if you want to keep them
        for a longer period.

        Example:

        import os
        for root, dirs, files, rootfd in os.fwalk('python/Lib/email'):
            print(root, "consumes", end="")
            print(sum([os.stat(name, dir_fd=rootfd).st_size for name in files]),
                  end="")
            print("bytes in", len(files), "non-directory files")
            if 'CVS' in dirs:
                dirs.remove('CVS')  # don't visit CVS directories
        �	__index__F)r�r�)r�N)rl�int�hasattrryr6rB�O_RDONLY�st�S_ISDIR�st_moder
�samestat�_fwalk�close)r�r�r�r�r��orig_st�topfdrrr�fwalk�s!r�c
cs|t|�}gg}}x�|D]�}y.tjt||d�j�r>|j|�n
|j|�Wqtk
r�y$tjt||dd�j�r||j|�Wntk
r�wYnXYqXqW|r�||||fVx�|D]�}y t|||d�}	t|t	|d�}
Wn8tk
�r}z|dk	�r||�w�WYdd}~XnXz>|�s0t
j|	t|
���rRt
j||�}t
|
||||�EdHWdt|
�Xq�W|�sx||||fVdS)N)r�F)r�r�)rRr�r�r6r�r~rn�S_ISLNKrBr�r
r�r�r�r�)
r��toppathr�r�r��namesr�r�r	r��dirfd�err�dirpathrrrr��s<



r�cGst||�dS)zpexecl(file, *args)

    Execute the executable file with argument list args, replacing the
    current process. N)�execv)�file�argsrrr�execl
sr�cGs |d}t||dd�|�dS)z�execle(file, *args, env)

    Execute the executable file with argument list args and
    environment env, replacing the current process. rdN���r�)rT)r�r��envrrr�execlesr�cGst||�dS)z�execlp(file, *args)

    Execute the executable file (which is searched for along $PATH)
    with argument list args, replacing the current process. N)�execvp)r�r�rrr�execlpsr�cGs |d}t||dd�|�dS)z�execlpe(file, *args, env)

    Execute the executable file (which is searched for along $PATH)
    with argument list args and environment env, replacing the current
    process. rdNr�r�)�execvpe)r�r�r�rrr�execlpe sr�cCst||�dS)z�execvp(file, args)

    Execute the executable file (which is searched for along $PATH)
    with argument list args, replacing the current process.
    args may be a list or tuple of strings. N)�_execvpe)r�r�rrrr�)sr�cCst|||�dS)z�execvpe(file, args, env)

    Execute the executable file (which is searched for along $PATH)
    with argument list args and environment env , replacing the
    current process.
    args may be a list or tuple of strings. N)r�)r�r�r�rrrr�1sr�cCs|dk	rt}||f}nt}|f}t}tj|�\}}|rH||f|��dSd}}d}	t|�}
tdkrvt|�}tt|
�}
x�|
D]~}tj	||�}y||f|��Wq|t
k
r�}
z>|
}tj�d}|
j
t
jkr�|
j
t
jkr�|dkr�|
}|}	WYdd}
~
Xq|Xq|W|�r|j|	��|j|��dS)Nr(re)rTr��environr
rhrr	r�mapr�rn�sys�exc_info�errno�ENOENT�ENOTDIR�with_traceback)r�r�r��	exec_func�argrestrrrs�last_exc�	saved_exc�saved_tb�	path_listr �fullname�e�tbrrrr�<s<



r�cCs�ddl}|dkrt}|j���|jdt�y|jd�}Wntk
rPd}YnXtr�y|d}Wnttfk
rzYnX|dk	r�t	d��|}|dk	r�t
|t�r�t|�}WdQRX|dkr�t
}|jt�S)z�Returns the sequence of directories that will be searched for the
    named executable (similar to a shell) when launching a process.

    *env* must be an environment variable dict or None.  If *env* is None,
    os.environ will be used.
    rN�ignore�PATHsPATHz*env cannot contain 'PATH' and b'PATH' keys)�warningsr��catch_warnings�simplefilter�BytesWarning�get�	TypeError�supports_bytes_environ�KeyError�
ValueErrorrlrmrrrhr)r�r�r��
path_listbrrrr_s.


)�MutableMappingc@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�_EnvironcCs.||_||_||_||_||_||_||_dS)N)�	encodekey�	decodekey�encodevalue�decodevalue�putenv�unsetenv�_data)�self�datar�r�r�r�r�r�rrr�__init__�sz_Environ.__init__cCs>y|j|j|�}Wntk
r2t|�d�YnX|j|�S)N)r�r�r�r�)r��key�valuerrr�__getitem__�s
z_Environ.__getitem__cCs.|j|�}|j|�}|j||�||j|<dS)N)r�r�r�r�)r�r�r�rrr�__setitem__�s

z_Environ.__setitem__cCsD|j|�}|j|�y|j|=Wntk
r>t|�d�YnXdS)N)r�r�r�r�)r�r��
encodedkeyrrr�__delitem__�s

z_Environ.__delitem__ccs(t|j�}x|D]}|j|�VqWdS)N)rr�r�)r��keysr�rrr�__iter__�s

z_Environ.__iter__cCs
t|j�S)N)�lenr�)r�rrr�__len__�sz_Environ.__len__cs$djdj�fdd��jj�D���S)Nzenviron({{{}}})z, c3s*|]"\}}dj�j|��j|��VqdS)z
{!r}: {!r}N)�formatr�r�)rr�r�)r�rr�	<genexpr>�sz$_Environ.__repr__.<locals>.<genexpr>)r�r�r��items)r�r)r�r�__repr__�s
z_Environ.__repr__cCst|�S)N)�dict)r�rrr�copy�sz
_Environ.copycCs||kr|||<||S)Nr)r�r�r�rrr�
setdefault�sz_Environ.setdefaultN)�__name__�
__module__�__qualname__r�r�r�r�r�r�r�r�r�rrrrr��s		r�cCsdS)Nr)r�r�rrr�<lambda>�sr�r�cCs
t|d�S)N�)�_putenv)r�rrrr��sr�cs�tdkrLdd�}|�t}�fdd�}i}xJtj�D]\}}||||�<q2Wn(tj���fdd���fdd	�}�}t}t|||�|tt�S)
Nr(cSs t|t�stdt|�j��|S)Nzstr expected, not %s)rlr,r��typer�)r�rrr�	check_str�s
z!_createenviron.<locals>.check_strcs�|�j�S)N)�upper)r�)�encoderrr��sz!_createenviron.<locals>.encodekeycs(t|t�stdt|�j��|j�d�S)Nzstr expected, not %s�surrogateescape)rlr,r�r�r�r�)r�)�encodingrrr��s
z_createenviron.<locals>.encodecs|j�d�S)Nr�)�decode)r�)r�rrr��sz_createenviron.<locals>.decode)	r	r,r�r�r��getfilesystemencodingr�r��	_unsetenv)r�r�r�r�r�r�r)r�r�r�_createenviron�s"r�cCstj||�S)z�Get an environment variable, return None if it doesn't exist.
    The optional second argument can specify an alternate default.
    key, default and the result are str.)r�r�)r��defaultrrr�getenv�sr�r�cCs t|t�stdt|�j��|S)Nzbytes expected, not %s)rlrmr�r�r�)r�rrr�_check_bytess
r�cCstj||�S)z�Get an environment variable, return None if it doesn't exist.
        The optional second argument can specify an alternate default.
        key, default and the result are bytes.)�environbr�)r�r�rrr�getenvbsrr�cs4tj��tj����fdd�}��fdd�}||fS)Ncs&t|�}t|t�r|j���S|SdS)aEncode filename (an os.PathLike, bytes, or str) to the filesystem
        encoding with 'surrogateescape' error handler, return bytes unchanged.
        On Windows, use 'strict' error handler if the file system encoding is
        'mbcs' (which is the default encoding).
        N)ryrlr,r�)�filename)r��errorsrrrs
z_fscodec.<locals>.fsencodecs&t|�}t|t�r|j���S|SdS)aDecode filename (an os.PathLike, bytes, or str) from the filesystem
        encoding with 'surrogateescape' error handler, return str unchanged. On
        Windows, use 'strict' error handler if the file system encoding is
        'mbcs' (which is the default encoding).
        N)ryrlrmr�)r)r�rrrr&s
z_fscodec.<locals>.fsdecode)r�r��getfilesystemencodeerrors)rrr)r�rr�_fscodecs
r�fork�spawnvr��P_WAIT�P_NOWAIT�	P_NOWAITOc
Cs�t|ttf�std��|s&|dr.td��t�}|sty$|dkrN|||�n||||�Wq�td�Yq�XnV|tkr�|SxHt|d�\}}t	|�r�q�q�t
|�r�t|�St|�r�t
|�Std��q�WdS)Nzargv must be a tuple or a listrz"argv first element cannot be empty�z"Not stopped, signaled or exited???)rl�tuplerr�r�rr&r�waitpid�
WIFSTOPPED�WIFSIGNALED�WTERMSIG�	WIFEXITED�WEXITSTATUSrn)rpr�r�r��func�pid�wpid�stsrrr�	_spawnvefCs.
rcCst|||dt�S)aspawnv(mode, file, args) -> integer

Execute file with arguments from args in a subprocess.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. N)rr�)rpr�r�rrrrbscCst||||t�S)a:spawnve(mode, file, args, env) -> integer

Execute file with arguments from args in a subprocess with the
specified environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. )rrT)rpr�r�r�rrr�spawnveksrcCst|||dt�S)a8spawnvp(mode, file, args) -> integer

Execute file (which is looked for along $PATH) with arguments from
args in a subprocess.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. N)rr�)rpr�r�rrr�spawnvpwsrcCst||||t�S)a\spawnvpe(mode, file, args, env) -> integer

Execute file (which is looked for along $PATH) with arguments from
args in a subprocess with the supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. )rr�)rpr�r�r�rrr�spawnvpe�srcGst|||�S)aspawnl(mode, file, *args) -> integer

Execute file with arguments from args in a subprocess.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. )r)rpr�r�rrr�spawnl�srcGs|d}t|||dd�|�S)a:spawnle(mode, file, *args, env) -> integer

Execute file with arguments from args in a subprocess with the
supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. rdNr�r�)r)rpr�r�r�rrr�spawnle�srcGst|||�S)aWspawnlp(mode, file, *args) -> integer

Execute file (which is looked for along $PATH) with arguments from
args in a subprocess with the supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. )r)rpr�r�rrr�spawnlp�srcGs|d}t|||dd�|�S)a]spawnlpe(mode, file, *args, env) -> integer

Execute file (which is looked for along $PATH) with arguments from
args in a subprocess with the supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. rdNr�r�)r)rpr�r�r�rrr�spawnlpe�sr�rcCs�t|t�stdt|���|d
kr.td|��|dks>|dkrFtd��ddl}ddl}|dkr�|j|d|j|d�}t	|j
|j�|�S|j|d|j|d	�}t	|j
|j�|�SdS)Nz&invalid cmd type (%s, expected string)r�wzinvalid mode %rrz+popen() does not support unbuffered streamsT)�shell�stdout�bufsize)r �stdinr")rr)
rlr,r�r�r��
subprocess�io�Popen�PIPE�_wrap_close�
TextIOWrapperr!r#)�cmdrp�	bufferingr$r%�procrrrr�s$
c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)r(cCs||_||_dS)N)�_stream�_proc)r��streamr,rrrr��sz_wrap_close.__init__cCs8|jj�|jj�}|dkr dStdkr,|S|d>SdS)Nrr(�)r-r�r.�waitr	)r��
returncoderrrr��s

z_wrap_close.closecCs|S)Nr)r�rrr�	__enter__�sz_wrap_close.__enter__cGs|j�dS)N)r�)r�r�rrr�__exit__�sz_wrap_close.__exit__cCst|j|�S)N)�getattrr-)r�r	rrr�__getattr__�sz_wrap_close.__getattr__cCs
t|j�S)N)�iterr-)r�rrrr��sz_wrap_close.__iter__N)	r�r�r�r�r�r3r4r6r�rrrrr(�s	r(cOs4t|t�stdt|���ddl}|j|f|�|�S)Nz&invalid fd type (%s, expected integer)r)rlr�r�r�r%rB)�fdr��kwargsr%rrrr�s
c
Cs�t|ttf�r|St|�}y|j|�}Wn0tk
rXt|d�rF�ntd|j��YnXt|ttf�rl|Stdj	|jt|�j���dS)aaReturn the path representation of a path-like object.

    If str or bytes is passed in, it is returned unchanged. Otherwise the
    os.PathLike interface is used to get the path representation. If the
    path representation is not str or bytes, TypeError is raised. If the
    provided path is not str, bytes, or os.PathLike, TypeError is raised.
    �
__fspath__z/expected str, bytes or os.PathLike object, not z7expected {}.__fspath__() to return str or bytes, not {}N)
rlr,rmr�r:rr�r�r�r�)r
�	path_type�	path_reprrrr�_fspath�s
r=ryc@s*eZdZdZejdd��Zedd��ZdS)�PathLikezCAbstract base class for implementing the file system path protocol.cCst�dS)z9Return the file system path representation of the object.N)�NotImplementedError)r�rrrr:&szPathLike.__fspath__cCs
t|d�S)Nr:)r�)�cls�subclassrrr�__subclasshook__+szPathLike.__subclasshook__N)	r�r�r��__doc__�abc�abstractmethodr:�classmethodrBrrrrr>"sr>)rfF)TNF)r�TN)N)N)N)r�r�)N)r�rr�)rr�)frCrDr�r�r6r��builtin_module_namesZ_namesrrr"r	rr#r&r~�ImportError�	posixpathr
r'�extendr(Zntpath�modulesZos.pathrrrrrrrrrr)r.�setr*�supports_dir_fd�supports_effective_idsr+�supports_fd�supports_follow_symlinksrr
rrjrurxr�rBrRr�r�r��	NameErrorr�r�r�r�r�r�r�r�_collections_abcr�r�r�r�r�r�r�r�r�r�r�rmr�rrrrrrr	rrrrrrrrrrr(rr=ryr��ABCr>rrrr�<module>s|


(










































 

./

		
#
-7








 	

	


	
py_compile.cpython-36.opt-1.pyc000064400000014622150335715140012302 0ustar003


 \
�@s�dZddlZddlZddlZddlZddlZddlZddlZdddgZ	Gdd�de
�Zd
d	d�Zdd
d�Z
edkr~eje
��dS)zqRoutine to "compile" a .py file to a .pyc file.

This module has intimate knowledge of the format of .pyc files.
�N�compile�main�PyCompileErrorc@s"eZdZdZddd�Zdd�ZdS)	ra�Exception raised when an error occurs while attempting to
    compile the file.

    To raise this exception, use

        raise PyCompileError(exc_type,exc_value,file[,msg])

    where

        exc_type:   exception type to be used in error message
                    type name can be accesses as class variable
                    'exc_type_name'

        exc_value:  exception value to be used in error message
                    can be accesses as class variable 'exc_value'

        file:       name of file being compiled to be used in error message
                    can be accesses as class variable 'file'

        msg:        string message to be written as error message
                    If no value is given, a default exception message will be
                    given, consistent with 'standard' py_compile output.
                    message (or default) can be accesses as class variable
                    'msg'

    �cCst|j}|tkr2djtj||��}|jdd|�}nd||f}tj||pJ||||�||_||_	||_
|pl||_dS)NrzFile "<string>"z	File "%s"z
Sorry: %s: %s)�__name__�SyntaxError�join�	traceback�format_exception_only�replace�	Exception�__init__�
exc_type_name�	exc_value�file�msg)�self�exc_typerrrr�tbtext�errmsg�r�"/usr/lib64/python3.6/py_compile.pyr
-s
zPyCompileError.__init__cCs|jS)N)r)rrrr�__str__=szPyCompileError.__str__N)r)r�
__module__�__qualname__�__doc__r
rrrrrrs
F�cCs�|dkr>|dkr2|dkr|nd}tjj||d�}ntjj|�}tjj|�r^d}t|j|���n,tjj|�r�tjj	|�r�d}t|j|���tj
jd|�}|j|�}y|j
||p�||d	�}	WnVtk
�r}
z8t|
j|
|p�|�}|r�|�ntjj|jd
�dSWYdd}
~
XnXy tjj|�}|�r0tj|�Wntk
�rHYnX|j|�}
tjj|	|
d|
d�}tjj|�}tjj|||�|S)
a)Byte-compile one Python source file to Python bytecode.

    :param file: The source file name.
    :param cfile: The target byte compiled file name.  When not given, this
        defaults to the PEP 3147/PEP 488 location.
    :param dfile: Purported file name, i.e. the file name that shows up in
        error messages.  Defaults to the source file name.
    :param doraise: Flag indicating whether or not an exception should be
        raised when a compile error is found.  If an exception occurs and this
        flag is set to False, a string indicating the nature of the exception
        will be printed, and the function will return to the caller. If an
        exception occurs and this flag is set to True, a PyCompileError
        exception will be raised.
    :param optimize: The optimization level for the compiler.  Valid values
        are -1, 0, 1 and 2.  A value of -1 means to use the optimization
        level of the current interpreter, as given by -O command line options.

    :return: Path to the resulting byte compiled file.

    Note that it isn't necessary to byte-compile Python modules for
    execution efficiency -- Python itself byte-compiles a module when
    it is loaded, and if it can, writes out the bytecode to the
    corresponding .pyc file.

    However, if a Python installation is shared between users, it is a
    good idea to byte-compile all modules upon installation, since
    other users may not be able to write in the source directories,
    and thus they won't be able to write the .pyc file, and then
    they would be byte-compiling every module each time it is loaded.
    This can slow down program start-up considerably.

    See compileall.py for a script/module that uses this module to
    byte-compile all installed files (or all files in selected
    directories).

    Do note that FileExistsError is raised if cfile ends up pointing at a
    non-regular file or symlink. Because the compilation uses a file renaming,
    the resulting file would be regular and thus not the same type of file as
    it was previously.
    Nrrr)�optimizationzc{} is a symlink and will be changed into a regular file if import writes a byte-compiled file to itzk{} is a non-regular file and will be changed into a regular one if import writes a byte-compiled file to itz<py_compile>)�	_optimize�
�mtime�size)�	importlib�util�cache_from_source�os�path�islink�FileExistsError�format�exists�isfile�	machinery�SourceFileLoader�get_data�source_to_coderr�	__class__�sys�stderr�writer�dirname�makedirs�
path_stats�_bootstrap_external�_code_to_bytecode�
_calc_mode�
_write_atomic)r�cfile�dfile�doraise�optimizerr�loader�source_bytes�code�err�py_excr4�source_stats�bytecode�moderrrrAsF)


cCs"|dkrtjdd�}d}|dgkr�x�tjj�}|s6P|jd�}yt|dd�Wq&tk
r�}zd}tjjd|j	�WYdd}~Xq&t
k
r�}zd}tjjd|�WYdd}~Xq&Xq&WnZxX|D]P}yt|dd�Wq�tk
�r}zd}tjjd|j	�WYdd}~Xq�Xq�W|S)	a�Compile several source files.

    The files named in 'args' (or on the command line, if 'args' is
    not specified) are compiled and the resulting bytecode is cached
    in the normal manner.  This function does not search a directory
    structure to locate source files; it only compiles files named
    explicitly.  If '-' is the only parameter in args, the list of
    files is taken from standard input.

    Nrr�-rT)r=z%s
)r1�argv�stdin�readline�rstriprrr2r3r�OSError)�args�rv�filename�errorrrrr�s0


"(
(�__main__���)NNFrR)N)rZimportlib._bootstrap_externalr"�importlib.machinery�importlib.utilr%Zos.pathr1r	�__all__rrrrr�exitrrrr�<module>s
0
R
&pickle.cpython-36.pyc000064400000123305150335715140010451 0ustar003


 \���@sdZddlmZddlmZddlmZmZmZddlm	Z	ddl
mZddlZddlm
Z
dd	lmZmZddlZddlZddlZddlZd
ddd
dddddg	ZeefZdZdddddddgZdZdZGdd
�d
e�ZGdd�de�ZGdd�de�Z Gdd �d e�Z!ydd!l"m#Z#Wne$k
�r2dZ#YnXd"Z%d#Z&d$Z'd%Z(d&Z)d'Z*d(Z+d)Z,d*Z-d+Z.d,Z/d-Z0d.Z1d/Z2d0Z3d1Z4d2Z5d3Z6d4Z7d5Z8d6Z9d7Z:d8Z;d9Z<d:Z=d;Z>d<Z?d=Z@d>ZAd?ZBd@ZCdAZDdBZEdCZFdDZGdEZHdFZIdGZJdHZKdIZLdJZMdKZNdLZOdMZPdNZQdOZRdPZSdQZTdRZUdSZVdTZWdUZXdVZYdWZZdXZ[eKeUeVeWgZ\dYZ]dZZ^d[Z_d\Z`d]Zad^Zbd_Zcd`ZddaZedbZfdcZgddZhejidedf�ej�D��Gdgdh�dh�ZkGdidj�dj�Zldkdl�Zmdmdn�Zndodp�Zodqdr�ZpGdsdt�dt�ZqGdudv�dv�Zrd�dwdx�dydz�Zsd�dwdx�d{d|�Ztdwd}d~d�d�d��Zudwd}d~d�d�d��Zvy0dd�lwmZmZm Z mxZxmyZymzZzm{Z{m|Z|m}Z}Wn4e$k
�rbeqerZxZyeseteuevf\ZzZ{Z|Z}YnXd�d��Z~ed�k�rddl�Z�e�j�d�d��Z�e�j�d�e�j�d��d�d�d��e�j�d�d�d�d�d��e�j�d�d�d�d��e�j��Z�e�j��r�e~�n>e�j��s�e�j��n,ddl�Z�x"e�j�D]Z�e|e��Z�e�j�e���q�WdS)�a�Create portable serialized representations of Python objects.

See module copyreg for a mechanism for registering custom picklers.
See module pickletools source for extensive comments.

Classes:

    Pickler
    Unpickler

Functions:

    dump(object, file)
    dumps(object) -> string
    load(file) -> object
    loads(string) -> object

Misc variables:

    __version__
    format_version
    compatible_formats

�)�FunctionType)�dispatch_table)�_extension_registry�_inverted_registry�_extension_cache)�islice)�partialN)�maxsize)�pack�unpack�PickleError�
PicklingError�UnpicklingError�Pickler�	Unpickler�dump�dumps�load�loadsz4.0z1.0z1.1z1.2z1.3z2.0z3.0��c@seZdZdZdS)rz6A common base class for the other pickling exceptions.N)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.6/pickle.pyr@sc@seZdZdZdS)r
z]This exception is raised when an unpicklable object is passed to the
    dump() method.

    N)rrrrrrrrr
Dsc@seZdZdZdS)raThis exception is raised when there is a problem unpickling an object,
    such as a security violation.

    Note that other exceptions may also be raised during unpickling, including
    (but not necessarily limited to) AttributeError, EOFError, ImportError,
    and IndexError.

    N)rrrrrrrrrKsc@seZdZdd�ZdS)�_StopcCs
||_dS)N)�value)�selfrrrr�__init__Ysz_Stop.__init__N)rrrr rrrrrXsr)�PyStringMap�(�.�0�1�2�F�I�J�K�L�M�N�P�Q�R�S�T�U�V�X�a�b�c�d�}�e�g�h�i�j�l�]�o�p�q�r�s�t�)�u�GsI01
sI00
�������������������������B�C��������������������cCsg|]}tjd|�r|�qS)z[A-Z][A-Z0-9_]+$)�re�match)�.0�xrrr�
<listcomp>�srgc@s:eZdZdZdd�Zdd�Zdd�Zdd
d�Zdd
�ZdS)�_Framer�@icCs||_d|_dS)N)�
file_write�
current_frame)rrjrrrr �sz_Framer.__init__cCstj�|_dS)N)�io�BytesIOrk)rrrr�
start_framing�sz_Framer.start_framingcCs*|jr&|jj�dkr&|jdd�d|_dS)NrT)�force)rk�tell�commit_frame)rrrr�end_framing�sz_Framer.end_framingFcCst|jrp|j}|j�|jks|rp|j��2}t|�}|j}|t�|td|��||�WdQRX|jd�|j	�dS)Nz<Qr)
rkrp�_FRAME_SIZE_TARGET�	getbuffer�lenrj�FRAMEr
�seek�truncate)rro�f�data�n�writerrrrq�s

z_Framer.commit_framecCs |jr|jj|�S|j|�SdS)N)rkr|rj)rrzrrrr|�sz
_Framer.writeNi)F)	rrrrsr rnrrrqr|rrrrrh�s

rhc@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)�	_UnframerNcCs||_||_d|_dS)N)�	file_read�
file_readlinerk)rr~rZ	file_tellrrrr �sz_Unframer.__init__cCsV|jrH|jj|�}|r0|dkr0d|_|j|�St|�|krDtd��|S|j|�SdS)Nrz$pickle exhausted before end of frame)rk�readr~rur)rr{rzrrrr��s
z_Unframer.readcCsF|jr:|jj�}|s"d|_|j�S|ddkr6td��|S|j�SdS)N��
rz$pickle exhausted before end of frame����
)rk�readlinerr)rrzrrrr��s
z_Unframer.readlinecCs2|jr|jj�dkrtd��tj|j|��|_dS)N�z4beginning of a new frame before end of current frame)rkr�rrlrmr~)r�
frame_sizerrr�
load_frame�sz_Unframer.load_frame)N)rrrr r�r�r�rrrrr}�s


r}cCslxb|jd�D]T}|dkr(tdj||���y|}t||�}Wqtk
r^tdj||���YqXqW||fS)N�.z<locals>z&Can't get local attribute {!r} on {!r}z Can't get attribute {!r} on {!r})�split�AttributeError�format�getattr)�obj�nameZsubpath�parentrrr�
_getattributes
r�cCszt|dd�}|dk	r|Sx\ttjj��D]J\}}|dks(|dkrBq(yt||�d|krZ|SWq(tk
rpYq(Xq(WdS)z$Find the module an object belong to.rN�__main__r)r��list�sys�modules�itemsr�r�)r�r��module_name�modulerrr�whichmodules
r�cCsh|dkrdS|j�d?d}|j|ddd�}|dkrd|dkrd|ddkrd|d
d
@dkrd|dd�}|S)a�Encode a long to a two's complement little-endian binary string.
    Note that 0 is a special case, returning an empty string, to save a
    byte in the LONG1 pickling context.

    >>> encode_long(0)
    b''
    >>> encode_long(255)
    b'\xff\x00'
    >>> encode_long(32767)
    b'\xff\x7f'
    >>> encode_long(-256)
    b'\x00\xff'
    >>> encode_long(-32768)
    b'\x00\x80'
    >>> encode_long(-128)
    b'\x80'
    >>> encode_long(127)
    b'\x7f'
    >>>
    rr�rr��littleT)�	byteorder�signed���Nr����r�)�
bit_length�to_bytes)rf�nbytes�resultrrr�encode_long$sr�cCstj|ddd�S)a\Decode a long from a two's complement little-endian binary string.

    >>> decode_long(b'')
    0
    >>> decode_long(b"\xff\x00")
    255
    >>> decode_long(b"\xff\x7f")
    32767
    >>> decode_long(b"\x00\xff")
    -256
    >>> decode_long(b"\x00\x80")
    -32768
    >>> decode_long(b"\x80")
    -128
    >>> decode_long(b"\x7f")
    127
    r�T)r�r�)�int�
from_bytes)rzrrr�decode_longBsr�c@sheZdZd7dd�dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Zd8dd�Z	dd�Z
dd�Zd9dd�ZiZ
dd�Zee
ed�<dd�Zee
e<dd�Zee
e<dd�Zee
e<d d!�Zee
e<d"d#�Zee
e<d$d%�Zee
e<d&d'�Zee
e<d(Zd)d*�Zd+d,�Z e e
e!<e"dk	�re e
e"<d-d.�Z#d/d0�Z$e$e
e%<d1d2�Z&e&e
e'<d:d3d4�Z(d5d6�Z)e(e
e*<e)e
e<dS);�_PicklerNT)�fix_importscCs�|dkrt}|dkrt}n$d|ko,tkns>tdt��y|j|_Wntk
rftd��YnXt|j�|_|jj|_i|_	t
|�|_|dk|_d|_
|o�|dk|_dS)a�This takes a binary file for writing a pickle data stream.

        The optional *protocol* argument tells the pickler to use the
        given protocol; supported protocols are 0, 1, 2, 3 and 4.  The
        default protocol is 3; a backward-incompatible protocol designed
        for Python 3.

        Specifying a negative protocol version selects the highest
        protocol version supported.  The higher the protocol used, the
        more recent the version of Python needed to read the pickle
        produced.

        The *file* argument must have a write() method that accepts a
        single bytes argument. It can thus be a file object opened for
        binary writing, an io.BytesIO instance, or any other custom
        object that meets this interface.

        If *fix_imports* is True and *protocol* is less than 3, pickle
        will try to map the new Python 3 names to the old module names
        used in Python 2, so that the pickle data stream is readable
        with Python 2.
        Nrzpickle protocol must be <= %dz"file must have a 'write' attributer�r)�DEFAULT_PROTOCOL�HIGHEST_PROTOCOL�
ValueErrorr|�_file_writer��	TypeErrorrh�framer�memor��proto�bin�fastr�)r�file�protocolr�rrrr [s"


z_Pickler.__init__cCs|jj�dS)aClears the pickler's "memo".

        The memo is the data structure that remembers which objects the
        pickler has already seen, so that shared or recursive objects
        are pickled by reference and not by value.  This method is
        useful when re-using picklers.
        N)r��clear)rrrr�
clear_memo�sz_Pickler.clear_memocCsrt|d�std|jjf��|jdkr<|jttd|j��|jdkrP|jj	�|j
|�|jt�|jj�dS)z7Write a pickled representation of obj to the open file.r�z2Pickler.__init__() was not called by %s.__init__()r�z<BrN)
�hasattrr
�	__class__rr�r|�PROTOr
r�rn�save�STOPrr)rr�rrrr�s





z
_Pickler.dumpcCsL|jr
dSt|�|jkst�t|j�}|j|j|��||f|jt|�<dS)zStore an object in the memo.N)r��idr��AssertionErrorrur|�put)rr��idxrrr�memoize�s
z_Pickler.memoizecCsT|jdkrtS|jr:|dkr*ttd|�Sttd|�Sntt|�jd�dSdS)Nr�z<Bz<I�asciir�)	r��MEMOIZEr��BINPUTr
�LONG_BINPUT�PUT�repr�encode)rr�rrrr��s
z_Pickler.putcCs@|jr*|dkrttd|�Sttd|�Stt|�jd�dS)Nr�z<Bz<Ir�r�)r��BINGETr
�LONG_BINGET�GETr�r�)r�irrr�get�s
z_Pickler.getcCs�|jj�|j|�}|dk	r.|r.|j|�dS|jjt|��}|dk	r^|j|j|d��dSt|�}|j	j|�}|dk	r�|||�dSt
|dt�j|�}|dk	r�||�}n�yt|t�}	Wnt
k
r�d}	YnX|	r�|j|�dSt
|dd�}|dk	�r||j�}n0t
|dd�}|dk	�r&|�}ntd|j|f��t|t��rT|j||�dSt|t��sltd|��t|�}
d|
k�o�d	kn�s�td
|��|j|d|i�dS)NrrF�
__reduce_ex__�
__reduce__zCan't pickle %r object: %rz%s must return string or tupler��z3Tuple returned by %s must have two to five elementsr�)r�rq�
persistent_id�	save_persr�r�r�r|�type�dispatchr�r�
issubclassr��save_globalr�r
r�
isinstance�str�tupleru�save_reduce)rr��save_persistent_id�pidrf�try�reduce�rvZissc�lrrrr��sT








z
_Pickler.savecCsdS)Nr)rr�rrrr�sz_Pickler.persistent_idcCsb|jr |j|dd�|jt�n>y |jtt|�jd�d�Wntk
r\td��YnXdS)NF)r�r�r�z2persistent IDs in protocol 0 must be ASCII strings)	r�r�r|�	BINPERSID�PERSIDr�r��UnicodeEncodeErrorr
)rr�rrrr�s z_Pickler.save_perscCst|t�std��t|�s"td��|j}|j}t|dd�}	|jdkr�|	dkr�|\}
}}t|
d�sntdj	|	���|dk	r�|
|j
k	r�td	j	|	���|jd
kr�||
�||�||�|t�n,t|
j
|
f|�|�}||�|f�|t�n�|jdko�|	dk�r\|d}
t|
d��std
��|dk	�r6|
|j
k	�r6td��|dd�}||
�||�|t�n||�||�|t�|dk	�r�t|�|jk�r�|t|j|jt|�d��n
|j|�|dk	�r�|j|�|dk	�r�|j|�|dk	�r�||�|t�dS)Nz'args from save_reduce() must be a tuplez(func from save_reduce() must be callabler�r��
__newobj_ex__�__new__z#args[0] from {} args has no __new__z(args[0] from {} args has the wrong classr�
__newobj__rz+args[0] from __newobj__ args has no __new__z0args[0] from __newobj__ args has the wrong classr�)r�r�r
�callabler�r|r�r�r�r�r��	NEWOBJ_EXrr��REDUCE�NEWOBJr�r��POPr�r��_batch_appends�_batch_setitems�BUILD)r�func�args�stateZ	listitemsZ	dictitemsr�r�r|Z	func_name�cls�kwargsrrrr�sd







"





z_Pickler.save_reducecCs|jt�dS)N)r|�NONE)rr�rrr�	save_none�sz_Pickler.save_nonecCs4|jdkr|j|rtnt�n|j|r*tnt�dS)Nr�)r�r|�NEWTRUE�NEWFALSE�TRUE�FALSE)rr�rrr�	save_bool�s
z_Pickler.save_boolcCs�|jr~|dkrN|dkr.|jttd|��dS|dkrN|jttd|��dSd
|ko`dknr~|jttd|��dS|jd	kr�t|�}t|�}|d
kr�|jt	td|�|�n|jt
td|�|�dS|jtt|�j
d�d�dS)Nrr�z<Bi��z<Hli���z<ir�r�r�sL
i�)r�r|�BININT1r
�BININT2�BININTr�r�ru�LONG1�LONG4�LONGr�r�)rr��encodedr{rrr�	save_long�s&
z_Pickler.save_longcCs<|jr|jttd|��n|jtt|�jd�d�dS)Nz>dr�r�)r�r|�BINFLOATr
�FLOATr�r�)rr�rrr�
save_float�sz_Pickler.save_floatcCs�|jdkr@|s |jtf|d�n|jtjt|d�df|d�dSt|�}|dkrj|jtt	d|�|�nD|dkr�|jdkr�|jt
t	d|�|�n|jtt	d	|�|�|j|�dS)
Nr)r��latin1r�z<Bl��rz<Qz<I)
r�r��bytes�codecsr�r�rur|�SHORT_BINBYTESr
�	BINBYTES8�BINBYTESr�)rr�r{rrr�
save_bytes�s
z_Pickler.save_bytescCs�|jr�|jdd�}t|�}|dkrF|jdkrF|jttd|�|�q�|dkrr|jdkrr|jttd|�|�q�|jttd|�|�n0|j	d	d
�}|j	dd�}|jt
|jd
�d�|j|�dS)Nzutf-8�
surrogatepassr�rz<Bl��z<Qz<I�\z\u005c�
z\u000azraw-unicode-escaper�)r�r�rur�r|�SHORT_BINUNICODEr
�BINUNICODE8�
BINUNICODE�replace�UNICODEr�)rr�rr{rrr�save_str�sz_Pickler.save_strcCsB|s(|jr|jt�n|jtt�dSt|�}|j}|j}|dkr�|jdkr�x|D]}||�qTWt	|�|kr�|j
|t	|�d�}|jt||�n|jt|�|j
|�dS|j}|t�x|D]}||�q�Wt	|�|k�r,|j
|t	|�d�}|j�r|t|�n|t|d|�dS|t�|j
|�dS)Nrr�rr�)r�r|�EMPTY_TUPLE�MARK�TUPLErur�r�r�r�r�r��_tuplesize2coder��POP_MARK)rr�r{r�r��elementr�r|rrr�
save_tuple�s:


z_Pickler.save_tuplecCs8|jr|jt�n|jtt�|j|�|j|�dS)N)r�r|�
EMPTY_LISTr�LISTr�r�)rr�rrr�	save_lists

z_Pickler.save_listi�cCs�|j}|j}|js4x|D]}||�|t�qWdSt|�}xrtt||j��}t|�}|dkr�|t	�x|D]}||�qlW|t
�n|r�||d�|t�||jkr>dSq>WdS)Nr�r)r�r|r��APPEND�iterr�r�
_BATCHSIZErur�APPENDS)rr�r�r|rf�it�tmpr{rrrr�s*



z_Pickler._batch_appendscCs<|jr|jt�n|jtt�|j|�|j|j��dS)N)r�r|�
EMPTY_DICTr�DICTr�r�r�)rr�rrr�	save_dict.s

z_Pickler.save_dictc	Cs�|j}|j}|js@x(|D] \}}||�||�|t�qWdSt|�}x�tt||j��}t|�}|dkr�|t	�x |D]\}}||�||�qxW|t
�n(|r�|d\}}||�||�|t�||jkrJdSqJWdS)Nr�r)r�r|r��SETITEMr$r�rr%rur�SETITEMS)	rr�r�r|�k�vr'r(r{rrrr�;s2

z_Pickler._batch_setitemscCs�|j}|j}|jdkr0|jtt|�f|d�dS|t�|j|�t|�}xXtt	||j
��}t|�}|dkr�|t�x|D]}||�qzW|t
�||j
krLdSqLWdS)Nr)r�r)r�r|r�r��setr��	EMPTY_SETr�r$rr%rur�ADDITEMS)rr�r�r|r'Zbatchr{�itemrrr�save_setZs$



z_Pickler.save_setcCs�|j}|j}|jdkr0|jtt|�f|d�dS|t�x|D]}||�q>Wt|�|jkr�|t	|j
|jt|�d��dS|t�|j|�dS)Nr)r�r)
r�r|r�r��	frozensetr�rr�r�rr��	FROZENSETr�)rr�r�r|r3rrr�save_frozensetrs

 z_Pickler.save_frozensetc
Cs`|j}|j}|dkr t|dd�}|dkr.|j}t||�}y(t|dd�tj|}t||�\}}Wn,t	t
tfk
r�td|||f��YnX||k	r�td|||f��|j
dk�r$tj||f�}	|	�r$|	dks�t�|	dkr�|ttd|	��n0|	d	k�r|ttd
|	��n|ttd|	��dS|jd�d}
||k�r@|
}|j
d
k�rj|j|�|j|�|t�n�||k	�r�|jt||
f�n�|j
dk�r�|tt|d�dt|d�d�n�|j�r�tj}tj}||f|k�r�|||f\}}n||k�r�||}y(|tt|d�dt|d�d�Wn*tk
�rPtd|||j
f��YnX|j |�dS)Nrr)�levelz(Can't pickle %r: it's not found as %s.%sz2Can't pickle %r: it's not the same object as %s.%sr�r�z<Bi��z<Hz<ir�rrzutf-8r�r�z?can't pickle global identifier '%s.%s' using pickle protocol %i)!r|r�r�rr��
__import__r�r�r��ImportError�KeyErrorr�r
r�rr�r��EXT1r
�EXT2�EXT4�
rpartitionr��STACK_GLOBALr��GLOBALr
r��_compat_pickleZREVERSE_NAME_MAPPINGZREVERSE_IMPORT_MAPPINGr�r�)
rr�r�r|r�r�r�Zobj2r��codeZlastnameZr_name_mappingZr_import_mappingrrrr��sp







$
&z_Pickler.save_globalcCs`|td�kr|jtd|d�S|tt�kr:|jttf|d�S|td�krV|jtd|d�S|j|�S)N)r�.)N).)r�r��NotImplementedr�)rr�rrr�	save_type�sz_Pickler.save_type)N)T)NNNN)N)+rrrr r�rr�r�r�r�r�r�r�r�r�r�r��boolrr�r�floatrr
rr�rr�r"r�r%r�r+�dictr!r�r4r0r7r5r�rErrrrrr�YsV)
	
B
c1		

B	r�c@sneZdZdddd�dd�Zdd�Zd	d
�Zdd�ZiZd
d�Zeee	d<dd�Z
e
eed<dd�Zeee
d<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�Zeeed<d d!�Zeeed<d"d#�Zeeed<d$d%�Zeeed<d&d'�Z e ee!d<d(d)�Z"e"ee#d<d*d+�Z$e$ee%d<d,d-�Z&e&ee'd<d.d/�Z(d0d1�Z)e)ee*d<d2d3�Z+e+ee,d<d4d5�Z-e-ee.d<d6d7�Z/e/ee0d<d8d9�Z1e1ee2d<d:d;�Z3e3ee4d<d<d=�Z5e5ee6d<d>d?�Z7e7ee8d<d@dA�Z9e9ee:d<dBdC�Z;e;ee<d<dDdE�Z=e=ee>d<dFdG�Z?e?ee@d<dHdI�ZAeAeeBd<dJdK�ZCeCeeDd<dLdM�ZEeEeeFd<dNdO�ZGeGeeHd<dPdQ�ZIeIeeJd<dRdS�ZKeKeeLd<dTdU�ZMeMeeNd<dVdW�ZOeOeePd<dXdY�ZQeQeeRd<dZd[�ZSd\d]�ZTeTeeUd<d^d_�ZVeVeeWd<d`da�ZXeXeeYd<dbdc�ZZeZee[d<ddde�Z\e\ee]d<dfdg�Z^e^ee_d<dhdi�Z`e`eead<djdk�Zbebeecd<dldm�Zdedeeed<dndo�Zfdpdq�Zgdrds�Zheheeid<dtdu�Zjejeekd<dvdw�Zleleemd<dxdy�Zneneeod<dzd{�Zpepeeqd<d|d}�Zrereesd<d~d�Zteteeud<d�d��Zveveewd<d�d��Zxexeeyd<d�d��Zzezee{d<d�d��Z|e|ee}d<d�d��Z~e~eed<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�S)��
_UnpicklerT�ASCII�strict)r��encoding�errorscCs2|j|_|j|_i|_||_||_d|_||_dS)a�This takes a binary file for reading a pickle data stream.

        The protocol version of the pickle is detected automatically, so
        no proto argument is needed.

        The argument *file* must have two methods, a read() method that
        takes an integer argument, and a readline() method that requires
        no arguments.  Both methods should return bytes.  Thus *file*
        can be a binary file object opened for reading, an io.BytesIO
        object, or any other custom object that meets this interface.

        The file-like object must have two methods, a read() method
        that takes an integer argument, and a readline() method that
        requires no arguments.  Both methods should return bytes.
        Thus file-like object can be a binary file object opened for
        reading, a BytesIO object, or any other custom object that
        meets this interface.

        Optional keyword arguments are *fix_imports*, *encoding* and
        *errors*, which are used to control compatibility support for
        pickle stream generated by Python 2.  If *fix_imports* is True,
        pickle will try to map the old Python 2 names to the new names
        used in Python 3.  The *encoding* and *errors* tell pickle how
        to decode 8-bit string instances pickled by Python 2; these
        default to 'ASCII' and 'strict', respectively. *encoding* can be
        'bytes' to read theses 8-bit string instances as bytes objects.
        rN)	r��_file_readliner��
_file_readr�rLrMr�r�)rr�r�rLrMrrrr �sz_Unpickler.__init__cCs�t|d�std|jjf��t|j|j�|_|jj|_|jj	|_	g|_
g|_|jj|_d|_
|j}|j}y8x2|d�}|s|t�t|t�s�t�||d|�qlWWn"tk
r�}z|jSd}~XnXdS)z�Read a pickled object representation from the open file.

        Return the reconstituted object hierarchy specified in the file.
        rOz4Unpickler.__init__() was not called by %s.__init__()rr�N)r�rr�rr}rOrN�	_unframerr�r��	metastack�stack�appendr�r��EOFErrorr��bytes_typesr�rr)rr�r��keyZstopinstrrrrs*



z_Unpickler.loadcCs |j}|jj�|_|jj|_|S)N)rRrQ�poprS)rr�rrr�pop_marks
z_Unpickler.pop_markcCstd��dS)Nz%unsupported persistent id encountered)r)rr�rrr�persistent_load%sz_Unpickler.persistent_loadcCs<|jd�d}d|ko tkns2td|��||_dS)Nr�rzunsupported pickle protocol: %d)r�r�r�r�)rr�rrr�
load_proto*sz_Unpickler.load_protorcCs8td|jd��\}|tjkr(td|��|jj|�dS)Nz<Q�zframe size > sys.maxsize: %d)rr�r�r	r�rPr�)rr�rrrr�1s
z_Unpickler.load_framecCsLy|j�dd�jd�}Wntk
r6td��YnX|j|j|��dS)Nr�r�z2persistent IDs in protocol 0 must be ASCII stringsr�)r��decode�UnicodeDecodeErrorrrSrY)rr�rrr�load_persid8sz_Unpickler.load_persidcCs|jj�}|j|j|��dS)N)rRrWrSrY)rr�rrr�load_binpersidAs
z_Unpickler.load_binpersidcCs|jd�dS)N)rS)rrrr�	load_noneFsz_Unpickler.load_nonecCs|jd�dS)NF)rS)rrrr�
load_falseJsz_Unpickler.load_falsecCs|jd�dS)NT)rS)rrrr�	load_trueNsz_Unpickler.load_truecCsL|j�}|tdd�krd}n |tdd�kr4d}n
t|d�}|j|�dS)Nr�FTr)r�r�r�r�rS)rrz�valrrr�load_intRs
z_Unpickler.load_intcCs|jtd|jd��d�dS)Nz<irr)rSrr�)rrrr�load_binint]sz_Unpickler.load_binintcCs|j|jd�d�dS)Nr�r)rSr�)rrrr�load_binint1asz_Unpickler.load_binint1cCs|jtd|jd��d�dS)Nz<Hr�r)rSrr�)rrrr�load_binint2esz_Unpickler.load_binint2cCs@|j�dd�}|r,|ddkr,|dd�}|jt|d��dS)Nr�r+rr�r��Lr�)r�rSr�)rrcrrr�	load_longisz_Unpickler.load_longcCs*|jd�d}|j|�}|jt|��dS)Nr�r)r�rSr�)rr{rzrrr�
load_long1ps
z_Unpickler.load_long1cCs>td|jd��\}|dkr"td��|j|�}|jt|��dS)Nz<irrz#LONG pickle has negative byte count)rr�rrSr�)rr{rzrrr�
load_long4vs

z_Unpickler.load_long4cCs|jt|j�dd���dS)Nr�r�)rSrGr�)rrrr�
load_floatsz_Unpickler.load_floatcCs|jtd|jd��d�dS)Nz>dr[r)rSrr�)rrrr�
load_binfloat�sz_Unpickler.load_binfloatcCs"|jdkr|S|j|j|j�SdS)Nr
)rLr\rM)rrrrr�_decode_string�s
z_Unpickler._decode_stringcCsl|j�dd�}t|�dkrF|d|dkrF|ddkrF|dd�}ntd��|j|jtj|�d��dS)	Nr�r�rs"'z)the STRING opcode argument must be quotedr�r�r�)r�rurrSrnr�
escape_decode)rrzrrr�load_string�s
(z_Unpickler.load_stringcCs@td|jd��\}|dkr"td��|j|�}|j|j|��dS)Nz<irrz(BINSTRING pickle has negative byte count)rr�rrSrn)rrurzrrr�load_binstring�s

z_Unpickler.load_binstringcCs:td|jd��\}|tkr&tdt��|j|j|��dS)Nz<Irz2BINBYTES exceeds system's maximum size of %d bytes)rr�r	rrS)rrurrr�
load_binbytes�s
z_Unpickler.load_binbytescCs |jt|j�dd�d��dS)Nr�zraw-unicode-escaper�)rSr�r�)rrrr�load_unicode�sz_Unpickler.load_unicodecCsBtd|jd��\}|tkr&tdt��|jt|j|�dd��dS)Nz<Irz4BINUNICODE exceeds system's maximum size of %d byteszutf-8r)rr�r	rrSr�)rrurrr�load_binunicode�s
z_Unpickler.load_binunicodecCsBtd|jd��\}|tkr&tdt��|jt|j|�dd��dS)Nz<Qr[z5BINUNICODE8 exceeds system's maximum size of %d byteszutf-8r)rr�r	rrSr�)rrurrr�load_binunicode8�s
z_Unpickler.load_binunicode8cCs:td|jd��\}|tkr&tdt��|j|j|��dS)Nz<Qr[z3BINBYTES8 exceeds system's maximum size of %d bytes)rr�r	rrS)rrurrr�load_binbytes8�s
z_Unpickler.load_binbytes8cCs,|jd�d}|j|�}|j|j|��dS)Nr�r)r�rSrn)rrurzrrr�load_short_binstring�s
z_Unpickler.load_short_binstringcCs"|jd�d}|j|j|��dS)Nr�r)r�rS)rrurrr�load_short_binbytes�sz_Unpickler.load_short_binbytescCs*|jd�d}|jt|j|�dd��dS)Nr�rzutf-8r)r�rSr�)rrurrr�load_short_binunicode�sz _Unpickler.load_short_binunicodecCs|j�}|jt|��dS)N)rXrSr�)rr�rrr�
load_tuple�sz_Unpickler.load_tuplecCs|jf�dS)N)rS)rrrr�load_empty_tuple�sz_Unpickler.load_empty_tuplecCs|jdf|jd<dS)Nr�r�r�)rR)rrrr�load_tuple1�sz_Unpickler.load_tuple1cCs$|jd|jdfg|jdd�<dS)Nr�r�r�r�r�)rR)rrrr�load_tuple2�sz_Unpickler.load_tuple2cCs,|jd|jd|jdfg|jdd�<dS)Nrr�r����r�r�r~)rR)rrrr�load_tuple3�sz_Unpickler.load_tuple3cCs|jg�dS)N)rS)rrrr�load_empty_list�sz_Unpickler.load_empty_listcCs|ji�dS)N)rS)rrrr�load_empty_dictionary�sz _Unpickler.load_empty_dictionarycCs|jt��dS)N)rSr0)rrrr�load_empty_set�sz_Unpickler.load_empty_setcCs|j�}|jt|��dS)N)rXrSr5)rr�rrr�load_frozenset�sz_Unpickler.load_frozensetcCs|j�}|j|�dS)N)rXrS)rr�rrr�	load_list�sz_Unpickler.load_listcs4|j���fdd�tdt��d�D�}|j|�dS)Ncsi|]}�|d�|�qS)r�r)rer�)r�rr�
<dictcomp>sz(_Unpickler.load_dict.<locals>.<dictcomp>rr�)rX�rangerurS)r�dr)r�r�	load_dicts
z_Unpickler.load_dictcCs�|st|t�st|d�rly||�}Wqvtk
rh}z&td|jt|�ftj�d��WYdd}~XqvXn
|j|�}|j	|�dS)NZ__getinitargs__zin constructor for %s: %sr�)
r�r�r�r�rr�r��exc_infor�rS)r�klassr�r�errrrr�_instantiates
0
z_Unpickler._instantiatecCsL|j�dd�jd�}|j�dd�jd�}|j||�}|j||j��dS)Nr�r�r�r�)r�r\�
find_classr�rX)rr�r�r�rrr�	load_instsz_Unpickler.load_instcCs"|j�}|jd�}|j||�dS)Nr)rXrWr�)rr�r�rrr�load_obj!s
z_Unpickler.load_objcCs2|jj�}|jj�}|j|f|��}|j|�dS)N)rRrWr�rS)rr�r�r�rrr�load_newobj(s

z_Unpickler.load_newobjcCs>|jj�}|jj�}|jj�}|j|f|�|�}|j|�dS)N)rRrWr�rS)rr�r�r�r�rrr�load_newobj_ex/s



z_Unpickler.load_newobj_excCsF|j�dd�jd�}|j�dd�jd�}|j||�}|j|�dS)Nr�zutf-8r�r�)r�r\r�rS)rr�r�r�rrr�load_global7sz_Unpickler.load_globalcCsJ|jj�}|jj�}t|�tk	s,t|�tk	r4td��|j|j||��dS)NzSTACK_GLOBAL requires str)rRrWr�r�rrSr�)rr�r�rrr�load_stack_global>s


z_Unpickler.load_stack_globalcCs|jd�d}|j|�dS)Nr�r)r��
get_extension)rrCrrr�	load_ext1Fsz_Unpickler.load_ext1cCs td|jd��\}|j|�dS)Nz<Hr�)rr�r�)rrCrrr�	load_ext2Ksz_Unpickler.load_ext2cCs td|jd��\}|j|�dS)Nz<ir)rr�r�)rrCrrr�	load_ext4Psz_Unpickler.load_ext4cCspg}tj||�}||k	r&|j|�dStj|�}|sP|dkrDtd��td|��|j|�}|t|<|j|�dS)NrzEXT specifies code <= 0zunregistered extension code %d)rr�rSrrr�r�)rrCZnilr�rVrrrr�Us


z_Unpickler.get_extensioncCs�|jdkrF|jrF||ftjkr2tj||f\}}n|tjkrFtj|}t|dd�|jdkrpttj||�dSt	tj||�SdS)Nrr)r8r)
r�r�rBZNAME_MAPPINGZIMPORT_MAPPINGr9r�r�r�r�)rr�r�rrrr�es


z_Unpickler.find_classcCs&|j}|j�}|d}||�|d<dS)Nr�r�r�)rRrW)rrRr�r�rrr�load_reducersz_Unpickler.load_reducecCs|jr|jd=n|j�dS)Nr�r�)rRrX)rrrr�load_popys
z_Unpickler.load_popcCs|j�dS)N)rX)rrrr�
load_pop_mark�sz_Unpickler.load_pop_markcCs|j|jd�dS)Nr�r�)rSrR)rrrr�load_dup�sz_Unpickler.load_dupcCs(t|j�dd��}|j|j|�dS)Nr�r�)r�r�rSr�)rr�rrr�load_get�sz_Unpickler.load_getcCs"|jd�d}|j|j|�dS)Nr�r)r�rSr�)rr�rrr�load_binget�sz_Unpickler.load_bingetcCs&td|jd��\}|j|j|�dS)Nz<Ir)rr�rSr�)rr�rrr�load_long_binget�sz_Unpickler.load_long_bingetcCs8t|j�dd��}|dkr$td��|jd|j|<dS)Nr�rznegative PUT argumentr�r�)r�r�r�rRr�)rr�rrr�load_put�sz_Unpickler.load_putcCs2|jd�d}|dkrtd��|jd|j|<dS)Nr�rznegative BINPUT argumentr�)r�r�rRr�)rr�rrr�load_binput�sz_Unpickler.load_binputcCs6td|jd��\}|tkr"td��|jd|j|<dS)Nz<Irznegative LONG_BINPUT argumentr�r�)rr�r	r�rRr�)rr�rrr�load_long_binput�sz_Unpickler.load_long_binputcCs|j}|jd|t|�<dS)Nr�r�)r�rRru)rr�rrr�load_memoize�sz_Unpickler.load_memoizecCs$|j}|j�}|d}|j|�dS)Nr�r�)rRrWrS)rrRrr�rrr�load_append�sz_Unpickler.load_appendcCsH|j�}|jd}t|t�r(|j|�n|j}x|D]}||�q4WdS)Nr�r�)rXrRr�r��extendrS)rr�Zlist_objrSr3rrr�load_appends�s


z_Unpickler.load_appendscCs*|j}|j�}|j�}|d}|||<dS)Nr�r�)rRrW)rrRrrVrHrrr�load_setitem�s
z_Unpickler.load_setitemcCsD|j�}|jd}x,tdt|�d�D]}||d|||<q$WdS)Nr�rr�r�)rXrRr�ru)rr�rHr�rrr�
load_setitems�s
z_Unpickler.load_setitemscCsH|j�}|jd}t|t�r(|j|�n|j}x|D]}||�q4WdS)Nr�r�)rXrRr�r0�update�add)rr�Zset_objr�r3rrr�
load_additems�s


z_Unpickler.load_additemsc
Cs�|j}|j�}|d}t|dd�}|dk	r6||�dSd}t|t�rXt|�dkrX|\}}|r�|j}tj}x6|j	�D]*\}}	t
|�tkr�|	|||�<qr|	||<qrW|r�x |j	�D]\}}	t|||	�q�WdS)Nr��__setstate__r�r�)
rRrWr�r�r�ru�__dict__r��internr�r�r��setattr)
rrRr�Zinst�setstateZ	slotstateZ	inst_dictr�r.r/rrr�
load_build�s(z_Unpickler.load_buildcCs"|jj|j�g|_|jj|_dS)N)rQrSrR)rrrr�	load_mark�sz_Unpickler.load_markcCs|jj�}t|��dS)N)rRrWr)rrrrr�	load_stop�s
z_Unpickler.load_stopN)�rrrr rrXrYr�rZr�r�rvr^r�r_r�r`r�rar�rbr�rd�INTrerrfr�rgr�rirrjrrkrrlrrmrrnrp�STRINGrq�	BINSTRINGrrrrsrrtrrurrvr
rw�SHORT_BINSTRINGrxrryrrzrr{rr|�TUPLE1r}�TUPLE2r�TUPLE3r�r r�r)r�r1r�r6r�r!r�r*r�r��INSTr��OBJr�r�r�r�r�rAr�r@r�r<r�r=r�r>r�r�r�r�r�r�r�rr��DUPr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r#r�r&r�r,r�r-r�r2r�r�r�rr�r�rrrrrI�s$		
		rIT)r�cCst|||d�j|�dS)N)r�)r�r)r�r�r�r�rrr�_dumpsr�cCs6tj�}t|||d�j|�|j�}t|t�s2t�|S)N)r�)rlrmr�r�getvaluer�rUr�)r�r�r�ry�resrrr�_dumpss
r�rJrK)r�rLrMcCst||||d�j�S)N)r�rLrM)rIr)r�r�rLrMrrr�_load
sr�cCs0t|t�rtd��tj|�}t||||d�j�S)Nz%Can't load pickle from unicode string)r�rLrM)r�r�r�rlrmrIr)�sr�rLrMr�rrr�_loadss


r�)	rr
rrrrrrrcCsddl}|j�S)Nr)�doctestZtestmod)r�rrr�_test*sr�r�z$display contents of the pickle files)Zdescription�pickle_file�br�*zthe pickle file)r��nargs�helpz-tz--test�
store_truezrun self-test suite)�actionr�z-vz)run verbosely; only affects self-test run)N)N)�r�typesr�copyregrrrr�	itertoolsr�	functoolsrr�r	Zstructr
rrcrlrrB�__all__r
�	bytearrayrUZformat_versionZcompatible_formatsr�r��	Exceptionrr
rrZorg.python.corer!r:rr�r�rr�rr�rr�rr�r�r�r�r�r�r�r�rrr#r�rAr*r)r&r�r�r�r�r!r r�r�r�r�r,rrr-rr�r�r�r�r<r=r>r�r�r�r�r�rrrrrrrr
r1r2r6r�r@r�rvr��dirrhr}r�r�r�r�r�rIr�r�r�r��_picklerrrrrrr�r�argparse�ArgumentParser�parser�add_argumentZFileType�
parse_argsr�Ztestr�Z
print_help�pprintryr�rrrr�<module>s.

$*
-0




ssl.cpython-36.opt-2.pyc000064400000064434150335715140010752 0ustar003

�\dhݭ�@slddlZddlZddlZddlZddlZddlmZddlmZ	m
ZmZ
ddlZddlmZmZmZddlmZmZmZddlmZmZmZmZmZmZddlmZmZddlmZm Z m!Z!m"Z"ydd	lm#Z#Wne$k
r�YnXdd
lm%Z%m&Z&m'Z'm(Z(m)Z)ddlm*Z*ddlm+Z+ej,d
e-dd�ed�e
j,de-dd�ed�ej,de-dd�ed�ej,de-dd�ed�e
j,de-dd�ed�ej,de-dd�ed�e.j/Z0e._0dd�e.j1j2�D�Z3e4e.dd�Z5ej6dk�r�ddlm7Z7m8Z8dd l9m9Z9m:Z:m;Z;m<Z<dd!l9m=Z=m>Z>ddl?Z?ddl@Z@ddlAZAeBZCejD�r:d"gZEngZEe*ZFGd#d$�d$eG�ZHdQd&d'�ZId(d)�ZJd*d+�ZKed,d-�ZLd.d/�ZMGd0d1�d1ed1d2��ZNGd3d4�d4eNe	�ZOGd5d6�d6e�ZPeOjQfdddd7�d8d9�ZRe/feSd:eOjQdddddd;�d<d=�ZTeRZUeTZVGd>d?�d?�ZWGd@dA�dAe9�ZXddd:eSe/ddBdBdf	dCdD�ZYdEdF�ZZdGZ[dHZ\dIdJ�Z]dKdL�Z^e/dfdMdN�Z_dOdP�Z`dS)R�N)�
namedtuple)�Enum�IntEnum�IntFlag)�OPENSSL_VERSION_NUMBER�OPENSSL_VERSION_INFO�OPENSSL_VERSION)�_SSLContext�	MemoryBIO�
SSLSession)�SSLError�SSLZeroReturnError�SSLWantReadError�SSLWantWriteError�SSLSyscallError�SSLEOFError)�txt2obj�nid2obj)�RAND_status�RAND_add�
RAND_bytes�RAND_pseudo_bytes)�RAND_egd)�HAS_SNI�HAS_ECDH�HAS_NPN�HAS_ALPN�HAS_TLSv1_3)�_DEFAULT_CIPHERS)�_OPENSSL_API_VERSION�
_SSLMethodcCs|jd�o|dkS)NZ	PROTOCOL_�PROTOCOL_SSLv23)�
startswith)�name�r$�/usr/lib64/python3.6/ssl.py�<lambda>}sr&)�source�OptionscCs
|jd�S)NZOP_)r")r#r$r$r%r&�sZAlertDescriptioncCs
|jd�S)NZALERT_DESCRIPTION_)r")r#r$r$r%r&�sZSSLErrorNumbercCs
|jd�S)NZ
SSL_ERROR_)r")r#r$r$r%r&�s�VerifyFlagscCs
|jd�S)NZVERIFY_)r")r#r$r$r%r&�s�
VerifyModecCs
|jd�S)NZCERT_)r")r#r$r$r%r&�scCsi|]\}}||�qSr$r$)�.0r#�valuer$r$r%�
<dictcomp>�sr-ZPROTOCOL_SSLv2�win32)�enum_certificates�	enum_crls)�socket�AF_INET�SOCK_STREAM�create_connection)�
SOL_SOCKET�SO_TYPEz
tls-uniquec@seZdZdS)�CertificateErrorN)�__name__�
__module__�__qualname__r$r$r$r%r7�sr7�c	Cs�g}|sdS|jd�^}}|jd�}||kr<tdt|���|sP|j�|j�kS|dkrd|jd�n>|jd�sx|jd�r�|jtj|��n|jtj|�j	dd��x|D]}|jtj|��q�Wtj
d	d
j|�dtj�}|j
|�S)NF�.�*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)�split�countr7�repr�lower�appendr"�re�escape�replace�compile�join�
IGNORECASE�match)	Zdn�hostnameZ
max_wildcardsZpatsZleftmostZ	remainderZ	wildcardsZfragZpatr$r$r%�_dnsname_match�s&

rKcCstj|j��}||kS)N)�	ipaddress�
ip_address�rstrip)Zipname�host_ipZipr$r$r%�_ipaddress_match�srPcCsP|std��ytj|�}Wntk
r2d}YnXg}|jdf�}xb|D]Z\}}|dkr||dkrpt||�rpdS|j|�qJ|dkrJ|dk	r�t||�r�dS|j|�qJW|s�xF|jdf�D]6}x0|D](\}}|dkr�t||�r�dS|j|�q�Wq�Wt|�dk�r td|d	j	t
t|��f��n,t|�dk�rDtd
||df��ntd��dS)
Nztempty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIREDZsubjectAltNameZDNSz
IP AddressZsubjectZ
commonNamer;z&hostname %r doesn't match either of %sz, zhostname %r doesn't match %rrz=no appropriate commonName or subjectAltName fields were found)�
ValueErrorrLrM�getrKrBrP�lenr7rG�mapr@)�certrJrOZdnsnamesZsan�keyr,�subr$r$r%�match_hostname�s>

rX�DefaultVerifyPathszQcafile capath openssl_cafile_env openssl_cafile openssl_capath_env openssl_capathcCsdtj�}tjj|d|d�}tjj|d|d�}ttjj|�rF|ndtjj|�rX|ndf|��S)Nrr;��)	�_ssl�get_default_verify_paths�os�environrRrY�path�isfile�isdir)�parts�cafile�capathr$r$r%r]-sr]cs@eZdZfZ�fdd�Ze�fdd��Ze�fdd��Z�ZS)�_ASN1Objectcst�j|ft|dd���S)NF)r#)�super�__new__�_txt2obj)�cls�oid)�	__class__r$r%rh@sz_ASN1Object.__new__cst�j|ft|���S)N)rgrh�_nid2obj)rjZnid)rlr$r%�fromnidCsz_ASN1Object.fromnidcst�j|ft|dd���S)NT)r#)rgrhri)rjr#)rlr$r%�fromnameIsz_ASN1Object.fromname)	r8r9r:�	__slots__rh�classmethodrnro�
__classcell__r$r$)rlr%rf;srfznid shortname longname oidc@seZdZdZdZdS)�Purposez1.3.6.1.5.5.7.3.1z1.3.6.1.5.5.7.3.2N)r8r9r:�SERVER_AUTHZCLIENT_AUTHr$r$r$r%rsPsrscs�eZdZd!Zd"Zefdd�Zefdd�Zd#dd
�Zd$dd�Z	dd�Z
dd�Zdd�Ze
jfdd�Ze�fdd��Zej�fdd��Ze�fdd��Zej�fdd��Ze�fdd��Zej�fd d��Z�ZS)%�
SSLContext�protocol�__weakref__�CA�ROOTcOstj||�}|S)N)r	rh)rjrv�args�kwargs�selfr$r$r%rh^szSSLContext.__new__cCs
||_dS)N)rv)r|rvr$r$r%�__init__bszSSLContext.__init__FTNc	Cst|||||||d�S)N)�sock�server_side�do_handshake_on_connect�suppress_ragged_eofs�server_hostname�_context�_session)�	SSLSocket)r|r~rr�r�r��sessionr$r$r%�wrap_socketes
zSSLContext.wrap_socketcCs|j||||d�}t||d�S)N)rr�)r�)Z	_wrap_bio�	SSLObject)r|ZincomingZoutgoingrr�r��sslobjr$r$r%�wrap_bioos
zSSLContext.wrap_biocCsdt�}xN|D]F}t|d�}t|�dks2t|�dkr:td��|jt|��|j|�qW|j|�dS)N�asciir�z(NPN protocols must be 1 to 255 in length)�	bytearray�bytesrSrrB�extendZ_set_npn_protocols)r|�
npn_protocols�protosrv�br$r$r%�set_npn_protocolsus

zSSLContext.set_npn_protocolscCsdt�}xN|D]F}t|d�}t|�dks2t|�dkr:td��|jt|��|j|�qW|j|�dS)Nr�rr�z)ALPN protocols must be 1 to 255 in length)r�r�rSrrBr�Z_set_alpn_protocols)r|Zalpn_protocolsr�rvr�r$r$r%�set_alpn_protocols�s

zSSLContext.set_alpn_protocolscCszt�}y@x:t|�D].\}}}|dkr|dks6|j|kr|j|�qWWntk
rdtjd�YnX|rv|j|d�|S)NZx509_asnTz-unable to enumerate Windows certificate store)�cadata)r�r/rkr��PermissionError�warnings�warn�load_verify_locations)r|�	storename�purposeZcertsrU�encodingZtrustr$r$r%�_load_windows_store_certs�sz$SSLContext._load_windows_store_certscCsDt|t�st|��tjdkr8x|jD]}|j||�q$W|j�dS)Nr.)�
isinstancerf�	TypeError�sys�platform�_windows_cert_storesr�Zset_default_verify_paths)r|r�r�r$r$r%�load_default_certs�s

zSSLContext.load_default_certscstt�j�S)N)r(rg�options)r|)rlr$r%r��szSSLContext.optionscsttt�jj||�dS)N)rgrur��__set__)r|r,)rlr$r%r��scstt�j�S)N)r)rg�verify_flags)r|)rlr$r%r��szSSLContext.verify_flagscsttt�jj||�dS)N)rgrur�r�)r|r,)rlr$r%r��scs*t�j}yt|�Stk
r$|SXdS)N)rg�verify_moder*rQ)r|r,)rlr$r%r��s
zSSLContext.verify_modecsttt�jj||�dS)N)rgrur�r�)r|r,)rlr$r%r��s)rvrw)rxry)FTTNN)FNN)r8r9r:rpr��PROTOCOL_TLSrhr}r�r�r�r�r�rsrtr��propertyr��setterr�r�rrr$r$)rlr%ruWs(

ru)rdrer�cCsdt|t�st|��tt�}|tjkr0t|_d|_	|s<|s<|rL|j
|||�n|jtkr`|j|�|S)NT)
r�rfr�rur�rsrt�
CERT_REQUIREDr��check_hostnamer��	CERT_NONEr�)r�rdrer��contextr$r$r%�create_default_context�s



r�F)�	cert_reqsr�r��certfile�keyfilerdrer�c
Cs�t|t�st|��t|�}	|s$d|	_|dk	r2||	_|r<d|	_|rN|rNtd��|sV|rb|	j||�|sn|sn|r~|	j|||�n|	jt	kr�|	j
|�|	S)NFTzcertfile must be specified)r�rfr�rur�r�rQ�load_cert_chainr�r�r�)
rvr�r�r�r�r�rdrer�r�r$r$r%�_create_unverified_context�s$



r�c@s�eZdZd/dd�Zedd��Zejdd��Zedd��Zejd	d��Zed
d��Zedd
��Z	edd��Z
d0dd�Zdd�Zd1dd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd2d)d*�Zd+d,�Zd-d.�ZdS)3r�NcCs&||_|p||j_|dk	r"||j_dS)N)�_sslobj�ownerr�)r|r�r�r�r$r$r%r}szSSLObject.__init__cCs|jjS)N)r�r�)r|r$r$r%r�%szSSLObject.contextcCs||j_dS)N)r�r�)r|�ctxr$r$r%r�*scCs|jjS)N)r�r�)r|r$r$r%r�.szSSLObject.sessioncCs||j_dS)N)r�r�)r|r�r$r$r%r�3scCs|jjS)N)r��session_reused)r|r$r$r%r�7szSSLObject.session_reusedcCs|jjS)N)r�r)r|r$r$r%r<szSSLObject.server_sidecCs|jjS)N)r�r�)r|r$r$r%r�AszSSLObject.server_hostname�cCs(|dk	r|jj||�}n|jj|�}|S)N)r��read)r|rS�buffer�vr$r$r%r�GszSSLObject.readcCs|jj|�S)N)r��write)r|�datar$r$r%r�SszSSLObject.writeFcCs|jj|�S)N)r�Zpeer_certificate)r|�binary_formr$r$r%�getpeercert[szSSLObject.getpeercertcCstjr|jj�SdS)N)r\rr��selected_npn_protocol)r|r$r$r%r�dszSSLObject.selected_npn_protocolcCstjr|jj�SdS)N)r\rr��selected_alpn_protocol)r|r$r$r%r�ksz SSLObject.selected_alpn_protocolcCs
|jj�S)N)r��cipher)r|r$r$r%r�rszSSLObject.ciphercCs
|jj�S)N)r��shared_ciphers)r|r$r$r%r�wszSSLObject.shared_cipherscCs
|jj�S)N)r��compression)r|r$r$r%r�}szSSLObject.compressioncCs
|jj�S)N)r��pending)r|r$r$r%r��szSSLObject.pendingcCs4|jj�|jjr0|js td��t|j�|j�dS)Nz-check_hostname needs server_hostname argument)r��do_handshaker�r�r�rQrXr�)r|r$r$r%r��s

zSSLObject.do_handshakecCs
|jj�S)N)r��shutdown)r|r$r$r%�unwrap�szSSLObject.unwrap�
tls-uniquecCs0|tkrtd��|dkr&tdj|���|jj�S)Nz Unsupported channel binding typez
tls-uniquez({0} channel binding type not implemented)�CHANNEL_BINDING_TYPESrQ�NotImplementedError�formatr�Z
tls_unique_cb)r|�cb_typer$r$r%�get_channel_binding�szSSLObject.get_channel_bindingcCs
|jj�S)N)r��version)r|r$r$r%r��szSSLObject.versioncCs
|jj�S)N)r��verify_client_post_handshake)r|r$r$r%r��sz&SSLObject.verify_client_post_handshake)NN)r�N)F)r�)r8r9r:r}r�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r$r$r$r%r�s,


		
r�cs�eZdZddddeeddeeddddddddfdd�Zedd��Z	e	j
d	d��Z	ed
d��Zej
dd��Zed
d��Zdd�Z
dUdd�Zdd�ZdVdd�Zdd�ZdWdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdXd&d'�ZdYd(d)�Zd*d+�ZdZd,d-�Zd[�fd.d/�	Zd\d0d1�Zd]d2d3�Zd^d4d5�Zd_d6d7�Z d8d9�Z!d:d;�Z"d<d=�Z#d>d?�Z$d@dA�Z%dBdC�Z&dDdE�Z'd`dFdG�Z(dHdI�Z)dJdK�Z*dLdM�Z+dNdO�Z,dadQdR�Z-dSdT�Z.�Z/S)br�NFTrc6Cs:d|_|r||_n�|r$|r$td��|r6|r6td��|rD|rD|}t|�|_||j_|rf|jj|�|rx|jj||�|r�|jj|�|r�|jj|�||_	||_
||_||_||_
||_|jtt�tkr�td��|r�|r�td��|dk	r�td��|jj�r|�rtd��||_||_||_||_|
|_|dk	�rftj||j|j|j|j�d�|j �}|j!�n,|dk	�r�tj||d�ntj||	|
|d	�y|j"�Wn�t#k
�r�}z�|j$t$j%k�r‚d
}|j �dk}|j&d
�y|j'd�}Wn>t#k
�r(}z |j$t$j%t$j(fk�r�d
}WYdd}~XnX|j&|�|�r�d}t)|j$|�}||_*d|_+y|j,�Wnt#k
�rxYnXz|�Wdd}XWYdd}~XnXd}|j-|�d
|_.d|_||_/|�r6yN|jj0|||�}t1|||jd�|_|�r|j �}|dk�rtd��|j2�Wn$t#tfk
�r4|j,��YnXdS)Nz5certfile must be specified for server-side operationszcertfile must be specifiedz!only stream sockets are supportedz4server_hostname can only be specified in client modez,session can only be specified in client modez'check_hostname requires server_hostname)�family�type�proto�fileno)r�)r�r�r�Frr;�z5Closed before TLS handshake with data in recv buffer.T)r�r�gzHdo_handshake_on_connect should not be specified for non-blocking sockets)3r�r�rQrur�r�r�r�Zset_ciphersr�r�r��ssl_version�ca_certs�ciphersZ
getsockoptr5r6r3r�r�r�rr�r�r�r1r}r�r�r�r��
gettimeout�detach�getpeername�OSError�errnoZENOTCONNZsetblocking�recvZEINVALr�reasonZlibrary�close�
settimeoutZ_closed�
_connected�_wrap_socketr�r�)r|r~r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�Zsock_timeout�eZ	connectedZblockingZnotconn_pre_handshake_datar�Z notconn_pre_handshake_data_errorr��timeoutr$r$r%r}�s�











zSSLSocket.__init__cCs|jS)N)r�)r|r$r$r%r�0szSSLSocket.contextcCs||_||j_dS)N)r�r�r�)r|r�r$r$r%r�4scCs|jdk	r|jjSdS)N)r�r�)r|r$r$r%r�9s
zSSLSocket.sessioncCs||_|jdk	r||j_dS)N)r�r�r�)r|r�r$r$r%r�?s
cCs|jdk	r|jjSdS)N)r�r�)r|r$r$r%r�Es
zSSLSocket.session_reusedcCstd|jj��dS)NzCan't dup() %s instances)r�rlr8)r|r$r$r%�dupKsz
SSLSocket.dupcCsdS)Nr$)r|�msgr$r$r%�_checkClosedOszSSLSocket._checkClosedcCs|js|j�dS)N)r�r�)r|r$r$r%�_check_connectedSszSSLSocket._check_connected�cCst|j�|jstd��y|jj||�Stk
rn}z.|jdtkr\|jr\|dk	rVdSdSn�WYdd}~XnXdS)Nz'Read on closed or unwrapped SSL socket.rr�)r�r�rQr�rrzZ
SSL_ERROR_EOFr�)r|rSr��xr$r$r%r�[szSSLSocket.readcCs"|j�|jstd��|jj|�S)Nz(Write on closed or unwrapped SSL socket.)r�r�rQr�)r|r�r$r$r%r�mszSSLSocket.writecCs|j�|j�|jj|�S)N)r�r�r�r�)r|r�r$r$r%r�vszSSLSocket.getpeercertcCs*|j�|jstjrdS|jj�SdS)N)r�r�r\rr�)r|r$r$r%r��szSSLSocket.selected_npn_protocolcCs*|j�|jstjrdS|jj�SdS)N)r�r�r\rr�)r|r$r$r%r��sz SSLSocket.selected_alpn_protocolcCs |j�|jsdS|jj�SdS)N)r�r�r�)r|r$r$r%r��szSSLSocket.ciphercCs|j�|jsdS|jj�S)N)r�r�r�)r|r$r$r%r��szSSLSocket.shared_cipherscCs |j�|jsdS|jj�SdS)N)r�r�r�)r|r$r$r%r��szSSLSocket.compressioncCsB|j�|jr0|dkr$td|j��|jj|�Stj|||�SdS)Nrz3non-zero flags not allowed in calls to send() on %s)r�r�rQrlr�r1�send)r|r��flagsr$r$r%r��s
zSSLSocket.sendcCsH|j�|jrtd|j��n&|dkr4tj|||�Stj||||�SdS)Nz%sendto not allowed on instances of %s)r�r�rQrlr1�sendto)r|r�Z
flags_or_addr�addrr$r$r%r��szSSLSocket.sendtocOstd|j��dS)Nz&sendmsg not allowed on instances of %s)r�rl)r|rzr{r$r$r%�sendmsg�szSSLSocket.sendmsgcCs�|j�|jr�|dkr$td|j��d}t|��L}|jd��6}t|�}x&||krl|j||d��}||7}qHWWdQRXWdQRXntj	|||�SdS)Nrz6non-zero flags not allowed in calls to sendall() on %s�B)
r�r�rQrl�
memoryview�castrSr�r1�sendall)r|r�r�r?ZviewZ	byte_viewZamountr�r$r$r%r��s

"zSSLSocket.sendallcs,|jdkrt�j|||�S|j|||�SdS)N)r�rg�sendfileZ_sendfile_use_send)r|�file�offsetr?)rlr$r%r��s
zSSLSocket.sendfilecCs@|j�|jr.|dkr$td|j��|j|�Stj|||�SdS)Nrz3non-zero flags not allowed in calls to recv() on %s)r�r�rQrlr�r1r�)r|�buflenr�r$r$r%r��s

zSSLSocket.recvcCsf|j�|r|dkrt|�}n|dkr*d}|jrR|dkrFtd|j��|j||�Stj||||�SdS)Nirz8non-zero flags not allowed in calls to recv_into() on %s)r�rSr�rQrlr�r1�	recv_into)r|r��nbytesr�r$r$r%r��s

zSSLSocket.recv_intocCs0|j�|jrtd|j��ntj|||�SdS)Nz'recvfrom not allowed on instances of %s)r�r�rQrlr1�recvfrom)r|r�r�r$r$r%r��s
zSSLSocket.recvfromcCs2|j�|jrtd|j��ntj||||�SdS)Nz,recvfrom_into not allowed on instances of %s)r�r�rQrlr1�
recvfrom_into)r|r�r�r�r$r$r%r��s
zSSLSocket.recvfrom_intocOstd|j��dS)Nz&recvmsg not allowed on instances of %s)r�rl)r|rzr{r$r$r%�recvmsgszSSLSocket.recvmsgcOstd|j��dS)Nz+recvmsg_into not allowed on instances of %s)r�rl)r|rzr{r$r$r%�recvmsg_intoszSSLSocket.recvmsg_intocCs |j�|jr|jj�SdSdS)Nr)r�r�r�)r|r$r$r%r�	s
zSSLSocket.pendingcCs|j�d|_tj||�dS)N)r�r�r1r�)r|Zhowr$r$r%r�szSSLSocket.shutdowncCs.|jr|jj�}d|_|Stdt|���dS)NzNo SSL wrapper around )r�r�rQ�str)r|�sr$r$r%r�s

zSSLSocket.unwrapcCs$|jr|jj�Stdt|���dS)NzNo SSL wrapper around )r�r�rQr)r|r$r$r%r�s
z&SSLSocket.verify_client_post_handshakecCsd|_tj|�dS)N)r�r1�_real_close)r|r$r$r%r#szSSLSocket._real_closecCsF|j�|j�}z$|dkr(|r(|jd�|jj�Wd|j|�XdS)Ng)r�r�r�r�r�)r|�blockr�r$r$r%r�'s
zSSLSocket.do_handshakecCs�|jrtd��|jrtd��|jj|d|j�}t|||jd�|_y>|rTt	j
||�}nd}t	j||�|s|d|_|jr||j
�|Sttfk
r�d|_�YnXdS)Nz!can't connect in server-side modez/attempt to connect already-connected SSLSocket!F)r�r�T)rrQr�r�r�r�r�r�r�r1�
connect_ex�connectr�r�r�)r|r�rr�Zrcr$r$r%�
_real_connect2s(zSSLSocket._real_connectcCs|j|d�dS)NF)r)r|r�r$r$r%rKszSSLSocket.connectcCs|j|d�S)NT)r)r|r�r$r$r%rPszSSLSocket.connect_excCs.tj|�\}}|jj||j|jdd�}||fS)NT)r�r�r)r1�acceptr�r�r�r�)r|Znewsockr�r$r$r%rUszSSLSocket.accept�
tls-uniquecCs|jdkrdS|jj|�S)N)r�r�)r|r�r$r$r%r�as
zSSLSocket.get_channel_bindingcCs|jdkrdS|jj�S)N)r�r�)r|r$r$r%r�js
zSSLSocket.version)N)r�N)F)r)N)r)rN)r�r)Nr)r�r)Nr)F)r)0r8r9r:r�r�r2r3r}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�rrrrr�r�rrr$r$)rlr%r��s^|

	












	r�Tc

Cst||||||||||	d�
S)N)
r~r�r�rr�r�r�r�r�r�)r�)
r~r�r�rr�r�r�r�r�r�r$r$r%r�tsr�c
Cs�ddlm}ddlm}d}d}y|j|dd�j��d}Wn$tk
rbtd||f��Yn0X||dd�|�}||d|f|dd��SdS)Nr)�strptime)�timegm�Jan�Feb�Mar�Apr�May�Jun�Jul�Aug�Sep�Oct�Nov�Decz %d %H:%M:%S %Y GMTr[r;z*time data %r does not match format "%%b%s"rZ�)rrr
rrrrrrrrr)Ztimer	Zcalendarr
�index�titlerQ)Z	cert_timer	r
ZmonthsZtime_formatZmonth_numberZttr$r$r%�cert_time_to_seconds�s
rz-----BEGIN CERTIFICATE-----z-----END CERTIFICATE-----cCs2ttj|�dd�}tdtj|d�dtdS)N�ASCII�strict�
�@)r�base64Zstandard_b64encode�
PEM_HEADER�textwrapZfill�
PEM_FOOTER)Zder_cert_bytes�fr$r$r%�DER_cert_to_PEM_cert�sr$cCs\|jt�stdt��|j�jt�s0tdt��|j�tt�tt��}tj|j	dd��S)Nz(Invalid PEM encoding; must start with %sz&Invalid PEM encoding; must end with %srr)
r"r rQ�strip�endswithr"rSrZdecodebytes�encode)Zpem_cert_string�dr$r$r%�PEM_cert_to_DER_cert�s
r)c
Csd|\}}|dk	rt}nt}t|||d�}t|��&}|j|��}|jd�}	WdQRXWdQRXt|	�S)N)r�rdT)r�r��_create_stdlib_contextr4r�r�r$)
r�r�r��hostZportr�r�r~ZsslsockZdercertr$r$r%�get_server_certificate�s
r,cCstj|d�S)Nz	<unknown>)�_PROTOCOL_NAMESrR)Z
protocol_coder$r$r%�get_protocol_name�sr.)r;)arLr!rCr�r^�collectionsr�enumrZ_EnumrZ_IntEnumrZ_IntFlagr\rrrr	r
rrr
rrrrrrirrmrrrrr�ImportErrorrrrrrrr�_convertr8r r�r!�__members__�itemsr-�getattrZ_SSLv2_IF_EXISTSr�r/r0r1r2r3r4r5r6rr�r�r�Zsocket_errorZHAS_TLS_UNIQUEr�Z_RESTRICTED_SERVER_CIPHERSrQr7rKrPrXrYr]rfrsrurtr�r�r�Z_create_default_https_contextr*r�r�r�rr r"r$r)r,r.r$r$r$r%�<module>]s� 
14g(O
	
shutil.cpython-36.opt-1.pyc000064400000074265150335715140011463 0ustar003

�\dh}��A@s�dZddlZddlZddlZddlZddlZddlZyddlZ[dZWne	k
r^dZYnXyddl
Z
[
dZWne	k
r�dZYnXyddlZ[dZ
Wne	k
r�dZ
YnXyddlmZWne	k
r�dZYnXyddlmZWne	k
�rdZYnXddd	d
ddd
ddddddddddddddddddgZGd d�de�ZGd!d�de�ZGd"d�de�ZGd#d�de�ZGd$d%�d%e�ZGd&d'�d'e�Zd�d*d�Zd+d,�Zdd-�d.d�Zdd-�d/d	�Zeed0��r�dd-�d1d2�Z nd3d2�Z dd-�d4d
�Z!dd-�d5d�Z"dd-�d6d�Z#d7d�Z$dde#dfd8d
�Z%d9d:�Z&d;d<�Z'ej(ejej)ej*hej+k�o~ej,ej-k�o~ejej.kZ/d�d=d�Z0e/e0_1d>d?�Z2e#fd@d�Z3dAdB�Z4dCdD�Z5dEdF�Z6d�dHdI�Z7d�dJdK�Z8dLe7d�gdNfiZ9e�re7d�gdOfe9dP<e8gdQfe9dR<e�re7d�gdTfe9dU<e
�r0e7d�gdWfe9dX<dYd�Z:d�d[d�Z;d\d�Z<d�d]d�Z=d^d�Z>d_d`�Z?d�dad�Z@dbd�ZAdcdd�ZBdedf�ZCddg�dhdi�ZDdjgeDgdNfdkgeCgdQfdl�ZEe�r�dmdngeDgdOfeEdP<e�r�dodpgeDgdTfeEdU<e
�rdqdrgeDgdWfeEdX<dsdt�ZFd�ddg�dud�ZGeedv��r\ejHdw�ejIdxdy�ZJdzeJjK_d{eJjL_d|eJjM_d}dw�ZNn2ejOd~k�r�ddlPZPejHdw�ejIdxdy�ZJddw�ZNd�d�d�ZQd�d�d�ZRejSejTBdfd�d�ZUdS)�z�Utility functions for copying and archiving files and directory trees.

XXX The functions here don't copy the resource fork or other metadata on Mac.

�NTF)�getpwnam)�getgrnam�copyfileobj�copyfile�copymode�copystat�copy�copy2�copytree�move�rmtree�Error�SpecialFileError�	ExecError�make_archive�get_archive_formats�register_archive_format�unregister_archive_format�get_unpack_formats�register_unpack_format�unregister_unpack_format�unpack_archive�ignore_patterns�chown�which�get_terminal_size�
SameFileErrorc@seZdZdS)r
N)�__name__�
__module__�__qualname__�r r �/usr/lib64/python3.6/shutil.pyr
7sc@seZdZdZdS)rz5Raised when source and destination are the same file.N)rrr�__doc__r r r r!r:sc@seZdZdZdS)rz|Raised when trying to do a kind of operation (e.g. copying) which is
    not supported on a special file (e.g. a named pipe)N)rrrr"r r r r!r=sc@seZdZdZdS)rz+Raised when a command could not be executedN)rrrr"r r r r!rAsc@seZdZdZdS)�	ReadErrorz%Raised when an archive cannot be readN)rrrr"r r r r!r#Dsr#c@seZdZdZdS)�
RegistryErrorzVRaised when a registry operation with the archiving
    and unpacking registries failsN)rrrr"r r r r!r$Gsr$�icCs$x|j|�}|sP|j|�qWdS)z=copy data from file-like object fsrc to file-like object fdstN)�read�write)�fsrc�fdstZlengthZbufr r r!rLs

cCsXttjd�r0ytjj||�Stk
r.dSXtjjtjj|��tjjtjj|��kS)N�samefileF)�hasattr�os�pathr*�OSError�normcase�abspath)�src�dstr r r!�	_samefileTsr3)�follow_symlinkscCs�t||�rtdj||���xL||gD]@}ytj|�}Wntk
rJYq$Xtj|j�r$td|��q$W|r�tj	j
|�r�tjtj|�|�n6t
|d��&}t
|d��}t||�WdQRXWdQRX|S)z�Copy data from src to dst.

    If follow_symlinks is not set and src is a symbolic link, a new
    symlink will be created instead of copying the file it points to.

    z{!r} and {!r} are the same filez`%s` is a named pipe�rb�wbN)r3r�formatr,�statr.�S_ISFIFO�st_moderr-�islink�symlink�readlink�openr)r1r2r4�fn�str(r)r r r!r`s
cCsz|r>tjj|�r>tjj|�r>ttd�r8tjtj}}q\dSnttd�rXtjtj}}ndS||�}||tj|j	��dS)z�Copy mode bits from src to dst.

    If follow_symlinks is not set, symlinks aren't followed if and only
    if both `src` and `dst` are symlinks.  If `lchmod` isn't available
    (e.g. Linux) this method does nothing.

    �lchmodN�chmod)
r,r-r;r+�lstatrAr8rB�S_IMODEr:)r1r2r4Z	stat_funcZ
chmod_funcr@r r r!r}s

�	listxattrcCs�ytj||d�}Wn4tk
rF}z|jtjtjfkr8�dSd}~XnXxn|D]f}y&tj|||d�}tj||||d�WqNtk
r�}z|jtjtjtjfkr��WYdd}~XqNXqNWdS)z�Copy extended filesystem attributes from `src` to `dst`.

        Overwrite existing attributes.

        If `follow_symlinks` is false, symlinks won't be followed.

        )r4N)	r,rEr.�errno�ENOTSUPZENODATA�getxattr�setxattrZEPERM)r1r2r4�names�e�name�valuer r r!�
_copyxattr�s	
rNcOsdS)Nr )�args�kwargsr r r!rN�sc	s6ddd�dd��|p,tjj|�o*tjj|�}|r@�fdd�}n�fdd�}|d�||d	�}tj|j�}|d
�||j|jf|d�y|d�|||d	�Wntk
r�YnXt	|d��r$y|d
�||j
|d	�WnPtk
�r"}z2x*dD] }t	t|�r�|jt
t|�kr�Pq�W�WYdd}~XnXt|||d	�dS)a�Copy file metadata

    Copy the permission bits, last access time, last modification time, and
    flags from `src` to `dst`. On Linux, copystat() also copies the "extended
    attributes" where possible. The file contents, owner, and group are
    unaffected. `src` and `dst` are path names given as strings.

    If the optional flag `follow_symlinks` is not set, symlinks aren't
    followed if and only if both `src` and `dst` are symlinks.
    N)�nsr4cWsdS)Nr )rQr4rOr r r!�_nop�szcopystat.<locals>._nopcstt|��S)N)�getattrr,)rL)rRr r!�lookup�szcopystat.<locals>.lookupcstt|��}|tjkr|S�S)N)rSr,�supports_follow_symlinks)rLr?)rRr r!rT�s
r8)r4�utimerB�st_flagsZchflags�
EOPNOTSUPPrG)rXrG)r,r-r;r8rDr:�st_atime_ns�st_mtime_ns�NotImplementedErrorr+rWr.rFrSrN)	r1r2r4ZfollowrTr@�mode�why�errr )rRr!r�s,
cCsBtjj|�r"tjj|tjj|��}t|||d�t|||d�|S)a3Copy data and mode bits ("cp src dst"). Return the file's destination.

    The destination may be a directory.

    If follow_symlinks is false, symlinks won't be followed. This
    resembles GNU's "cp -P src dst".

    If source and destination are the same file, a SameFileError will be
    raised.

    )r4)r,r-�isdir�join�basenamerr)r1r2r4r r r!r�s
cCsBtjj|�r"tjj|tjj|��}t|||d�t|||d�|S)a1Copy data and metadata. Return the file's destination.

    Metadata is copied with copystat(). Please see the copystat function
    for more information.

    The destination may be a directory.

    If follow_symlinks is false, symlinks won't be followed. This
    resembles GNU's "cp -P src dst".

    )r4)r,r-r_r`rarr)r1r2r4r r r!r	�s
cs�fdd�}|S)z�Function that can be used as copytree() ignore parameter.

    Patterns is a sequence of glob-style patterns
    that are used to exclude filescs,g}x�D]}|jtj||��q
Wt|�S)N)�extend�fnmatch�filter�set)r-rJ�
ignored_names�pattern)�patternsr r!�_ignore_patternss
z)ignore_patterns.<locals>._ignore_patternsr )rhrir )rhr!rscCs�tj|�}|dk	r|||�}nt�}tj|�g}�xB|D�]8}	|	|krJq:tjj||	�}
tjj||	�}y�tjj|
�r�tj|
�}|r�tj||�t	|
||d�n<tjj
|�r�|r�w:tjj|
�r�t|
||||�n
||
|�n(tjj|
�r�t|
||||�n
||
|�Wq:t
k
�r<}
z|j|
jd�WYdd}
~
Xq:tk
�rr}z|j|
|t|�f�WYdd}~Xq:Xq:Wyt	||�WnJtk
�r�}z,t|dd�dk�r�|j||t|�f�WYdd}~XnX|�r�t
|��|S)a�Recursively copy a directory tree.

    The destination directory must not already exist.
    If exception(s) occur, an Error is raised with a list of reasons.

    If the optional symlinks flag is true, symbolic links in the
    source tree result in symbolic links in the destination tree; if
    it is false, the contents of the files pointed to by symbolic
    links are copied. If the file pointed by the symlink doesn't
    exist, an exception will be added in the list of errors raised in
    an Error exception at the end of the copy process.

    You can set the optional ignore_dangling_symlinks flag to true if you
    want to silence this exception. Notice that this has no effect on
    platforms that don't support os.symlink.

    The optional ignore argument is a callable. If given, it
    is called with the `src` parameter, which is the directory
    being visited by copytree(), and `names` which is the list of
    `src` contents, as returned by os.listdir():

        callable(src, names) -> ignored_names

    Since copytree() is called recursively, the callable will be
    called once for each directory that is copied. It returns a
    list of names relative to the `src` directory that should
    not be copied.

    The optional copy_function argument is a callable that will be used
    to copy each file. It will be called with the source path and the
    destination path as arguments. By default, copy2() is used, but any
    function that supports the same signature (like copy()) can be used.

    N)r4rZwinerror)r,�listdirre�makedirsr-r`r;r=r<r�existsr_r
r
rbrOr.�append�strrS)r1r2�symlinks�ignore�
copy_functionZignore_dangling_symlinksrJrf�errorsrLZsrcnameZdstname�linktor^r]r r r!r
sL$



 *&c$CsLytjj|�rtd��Wn(tk
r@|tjj|tj��dSXg}ytj|�}Wn&tk
rz|tj|tj��YnXx�|D]�}tjj||�}ytj|�j	}Wntk
r�d}YnXt
j|�r�t||�q�ytj
|�Wq�tk
�r
|tj
|tj��Yq�Xq�Wytj|�Wn(tk
�rF|tj|tj��YnXdS)Nz%Cannot call rmtree on a symbolic linkr)r,r-r;r.�sys�exc_inforjr`rCr:r8�S_ISDIR�_rmtree_unsafe�unlink�rmdir)r-�onerrorrJrL�fullnamer\r r r!rwqs6


rwc
0Cs�g}ytj|�}Wn:tk
rL}z||_|tj|tj��WYdd}~XnX�x�|D�]x}tjj||�}ytj||dd�}|j	}Wntk
r�d}YnXtj
|��r�ytj|tj|d�}	Wn&tk
r�|tj|tj��Yn�Xz�tjj
|tj|	���rJt|	||�ytj||d�Wn(tk
�rF|tj|tj��YnXn8ytd��Wn*tk
�r�|tjj|tj��YnXWdtj|	�XqVytj||d�WqVtk
�r�|tj|tj��YqVXqVWdS)NF)�dir_fdr4r)r|z%Cannot call rmtree on a symbolic link)r,rjr.�filenamertrur-r`r8r:rvr>�O_RDONLY�samestat�fstat�_rmtree_safe_fdryr;�closerx)
�topfdr-rzrJr^rLr{�orig_str\�dirfdr r r!r��sD$

r�c!Cs^|rdd�}n|dkrdd�}t�rPt|t�r8tj|�}ytj|�}Wn&tk
rl|tj|tj��dSXytj	|tj
�}Wn&tk
r�|tj|tj��dSXz�tjj|tj
|���rt|||�ytj|�Wn(tk
�r|tj|tj��YnXn8ytd��Wn*tk
�r<|tjj|tj��YnXWdtj|�Xn
t||�SdS)a�Recursively delete a directory tree.

    If ignore_errors is set, errors are ignored; otherwise, if onerror
    is set, it is called to handle the error with arguments (func,
    path, exc_info) where func is platform and implementation dependent;
    path is the argument to that function that caused it to fail; and
    exc_info is a tuple returned by sys.exc_info().  If ignore_errors
    is false and onerror is None, an exception is raised.

    cWsdS)Nr )rOr r r!rz�szrmtree.<locals>.onerrorNcWs�dS)Nr )rOr r r!rz�sz%Cannot call rmtree on a symbolic link)�_use_fd_functions�
isinstance�bytesr,�fsdecoderC�	Exceptionrtrur>r~r-rr�r�ryr.r;r�rw)r-�
ignore_errorsrzr��fdr r r!r�s<


cCs&tjjtjjpd}tjj|j|��S)N�)r,r-�sep�altsepra�rstrip)r-r�r r r!�	_basename�sr�cCs|}tjj|�rTt||�r*tj||�dStjj|t|��}tjj|�rTtd|��ytj||�Wn�t	k
r�tjj
|�r�tj|�}tj||�tj
|�nTtjj|�r�t||�r�td||f��t|||dd�t|�n|||�tj
|�YnX|S)a+Recursively move a file or directory to another location. This is
    similar to the Unix "mv" command. Return the file or directory's
    destination.

    If the destination is a directory or a symlink to a directory, the source
    is moved inside the directory. The destination path must not already
    exist.

    If the destination already exists but is not a directory, it may be
    overwritten depending on os.rename() semantics.

    If the destination is on our current filesystem, then rename() is used.
    Otherwise, src is copied to the destination and then removed. Symlinks are
    recreated under the new name if os.rename() fails because of cross
    filesystem renames.

    The optional `copy_function` argument is a callable that will be used
    to copy the source or it will be delegated to `copytree`.
    By default, copy2() is used, but any function that supports the same
    signature (like copy()) can be used.

    A lot more could be done here...  A look at a mv.c shows a lot of
    the issues this implementation glosses over.

    Nz$Destination path '%s' already existsz.Cannot move a directory '%s' into itself '%s'.T)rqro)r,r-r_r3�renamer`r�rlr
r.r;r=r<rx�
_destinsrcr
r)r1r2rqZreal_dstrsr r r!rs2




cCsVtjj|�}tjj|�}|jtjj�s2|tjj7}|jtjj�sL|tjj7}|j|�S)N)r,r-r0�endswithr��
startswith)r1r2r r r!r�8sr�cCsNtdks|dkrdSyt|�}Wntk
r8d}YnX|dk	rJ|dSdS)z"Returns a gid, given a group name.N�)r�KeyError)rL�resultr r r!�_get_gidAs
r�cCsNtdks|dkrdSyt|�}Wntk
r8d}YnX|dk	rJ|dSdS)z"Returns an uid, given a user name.Nr�)rr�)rLr�r r r!�_get_uidMs
r��gzipc
s"|dkrd}nDtr |dkr d}n2tr2|dkr2d}n trD|dkrDd}ntdj|���d	dl}	|rfd
|nd}
|d|
}tjj|�}|r�tjj	|�r�|dk	r�|j
d|�|s�tj|�|dk	r�|j
d
�t���t
�������fdd�}
|�s|	j|d|�}z|j||
d�Wd|j�X|S)a�Create a (possibly compressed) tar file from all the files under
    'base_dir'.

    'compress' must be "gzip" (the default), "bzip2", "xz", or None.

    'owner' and 'group' can be used to define an owner and a group for the
    archive that is being built. If not provided, the current owner and group
    will be used.

    The output tar file will be named 'base_name' +  ".tar", possibly plus
    the appropriate compression extension (".gz", ".bz2", or ".xz").

    Returns the output filename.
    Nr�r�Zgz�bzip2�bz2�xzzCbad value for 'compress', or compression format not supported : {0}r�.z.tarzcreating %szCreating tar archivecs,�dk	r�|_�|_�dk	r(�|_�|_|S)N)�gidZgname�uid�uname)Ztarinfo)r��group�ownerr�r r!�_set_uid_gid�sz#_make_tarball.<locals>._set_uid_gidzw|%s)rd)�_ZLIB_SUPPORTED�_BZ2_SUPPORTED�_LZMA_SUPPORTED�
ValueErrorr7�tarfiler,r-�dirnamerl�inforkr�r�r>�addr�)�	base_name�base_dir�compress�verbose�dry_runr�r��loggerZtar_compressionr�Zcompress_extZarchive_name�archive_dirr��tarr )r�r�r�r�r!�
_make_tarballYs<

	
r�c
Cs|ddl}|d}tjj|�}|rPtjj|�rP|dk	rB|jd|�|sPtj|�|dk	rf|jd||�|�sx|j|d|jd���}tjj	|�}	|	tj
kr�|j|	|	�|dk	r�|jd|	�x�tj|�D]�\}
}}xFt
|�D]:}
tjj	tjj|
|
��}	|j|	|	�|dk	r�|jd|	�q�WxT|D]L}
tjj	tjj|
|
��}	tjj|	��r|j|	|	�|dk	�r|jd|	��qWq�WWdQRX|S)	z�Create a zip file from all the files under 'base_dir'.

    The output zip file will be named 'base_name' + ".zip".  Returns the
    name of the output zip file.
    rNz.zipzcreating %sz#creating '%s' and adding '%s' to it�w)Zcompressionzadding '%s')�zipfiler,r-r�rlr�rk�ZipFileZZIP_DEFLATED�normpath�curdirr'�walk�sortedr`�isfile)r�r�r�r�r�r�Zzip_filenamer�Zzfr-�dirpathZdirnames�	filenamesrLr r r!�
_make_zipfile�s@



 r�r�r�zuncompressed tar filezgzip'ed tar-fileZgztarzZIP file�zipr�zbzip2'ed tar-fileZbztarr�zxz'ed tar-fileZxztarcCsdd�tj�D�}|j�|S)z�Returns a list of supported formats for archiving and unarchiving.

    Each element of the returned sequence is a tuple (name, description)
    cSsg|]\}}||df�qS)r�r )�.0rL�registryr r r!�
<listcomp>�sz'get_archive_formats.<locals>.<listcomp>)�_ARCHIVE_FORMATS�items�sort)�formatsr r r!r�sr�cCsz|dkrg}t|�s td|��t|ttf�s6td��x0|D](}t|ttf�s\t|�dkr<td��q<W|||ft|<dS)auRegisters an archive format.

    name is the name of the format. function is the callable that will be
    used to create archives. If provided, extra_args is a sequence of
    (name, value) tuples that will be passed as arguments to the callable.
    description can be provided to describe the format, and will be returned
    by the get_archive_formats() function.
    NzThe %s object is not callablez!extra_args needs to be a sequencer�z+extra_args elements are : (arg_name, value))�callable�	TypeErrorr��tuple�list�lenr�)rL�function�
extra_args�description�elementr r r!r�s	
cCs
t|=dS)N)r�)rLr r r!r�sc	Cstj�}	|dk	r>|dk	r$|jd|�tjj|�}|s>tj|�|dkrLtj}||d�}
yt|}Wn tk
r�t	d|��YnX|d}x|dD]\}
}||
|
<q�W|dkr�||
d<||
d	<z|||f|
�}Wd|dk	r�|dk	r�|jd
|	�tj|	�X|S)aCreate an archive file (eg. zip or tar).

    'base_name' is the name of the file to create, minus any format-specific
    extension; 'format' is the archive format: one of "zip", "tar", "gztar",
    "bztar", or "xztar".  Or any other registered format.

    'root_dir' is a directory that will be the root directory of the
    archive; ie. we typically chdir into 'root_dir' before creating the
    archive.  'base_dir' is the directory where we start archiving from;
    ie. 'base_dir' will be the common prefix of all files and
    directories in the archive.  'root_dir' and 'base_dir' both default
    to the current directory.  Returns the name of the archive file.

    'owner' and 'group' are used when creating a tar archive. By default,
    uses the current owner and group.
    Nzchanging into '%s')r�r�zunknown archive format '%s'r�r�r�r�zchanging back to '%s')
r,�getcwd�debugr-r0�chdirr�r�r�r�)r�r7Zroot_dirr�r�r�r�r�r�Zsave_cwdrP�format_info�func�arg�valr}r r r!r�s6

cCsdd�tj�D�}|j�|S)z�Returns a list of supported formats for unpacking.

    Each element of the returned sequence is a tuple
    (name, extensions, description)
    cSs"g|]\}}||d|df�qS)r�r )r�rLr�r r r!r�6sz&get_unpack_formats.<locals>.<listcomp>)�_UNPACK_FORMATSr�r�)r�r r r!r0sc	Csvi}x.tj�D]"\}}x|dD]}|||<q WqWx,|D]$}||kr:d}t||||f��q:Wt|�srtd��dS)z+Checks what gets registered as an unpacker.rz!%s is already registered for "%s"z*The registered function must be a callableN)r�r�r$r�r�)	�
extensionsr�r�Zexisting_extensionsrLr��ext�	extension�msgr r r!�_check_unpack_options;s
r�cCs,|dkrg}t|||�||||ft|<dS)aMRegisters an unpack format.

    `name` is the name of the format. `extensions` is a list of extensions
    corresponding to the format.

    `function` is the callable that will be
    used to unpack archives. The callable will receive archives to unpack.
    If it's unable to handle an archive, it needs to raise a ReadError
    exception.

    If provided, `extra_args` is a sequence of
    (name, value) tuples that will be passed as arguments to the callable.
    description can be provided to describe the format, and will be returned
    by the get_unpack_formats() function.
    N)r�r�)rLr�r�r�r�r r r!rMscCs
t|=dS)z*Removes the pack format from the registry.N)r�)rLr r r!rcscCs&tjj|�}tjj|�s"tj|�dS)z1Ensure that the parent directory of `path` existsN)r,r-r�r_rk)r-r�r r r!�_ensure_directorygsr�c	Cs�ddl}|j|�std|��|j|�}z�x�|j�D]�}|j}|jd�s4d|krRq4tjj	|f|j
d���}|spq4t|�|jd�s4|j
|j�}t|d�}z|j|�Wd|j�~Xq4WWd|j�XdS)z+Unpack zip `filename` to `extract_dir`
    rNz%s is not a zip file�/z..r6)r�Z
is_zipfiler#r�Zinfolistr}r�r,r-r`�splitr�r�r&r>r'r�)	r}�extract_dirr�r�r�rL�target�data�fr r r!�_unpack_zipfilems*



r�)rdcCs\ddl}y|j|�}Wn"|jk
r8td|��YnXz|j||d�Wd|j�XdS)zAUnpack tar/tar.gz/tar.bz2/tar.xz `filename` to `extract_dir`
    rNz/%s is not a compressed or uncompressed tar file)rd)r�r>ZTarErrorr#Z
extractallr�)r}r�rdr�Ztarobjr r r!�_unpack_tarfile�sr�z.tarz.zip)r�r�z.tar.gzz.tgzz.tar.bz2z.tbz2z.tar.xzz.txzcCs:x4tj�D](\}}x|dD]}|j|�r|SqWq
WdS)Nr)r�r�r�)r}rLr�r�r r r!�_find_unpack_format�s

r�c
Cs�|dkrtj�}|dkri}nd|i}|dk	r�yt|}Wn"tk
r\tdj|���YnX|d}|||ft|d�|��nRt|�}|dkr�tdj|���t|d}tt|d�}|j	|�|||f|�dS)a]Unpack an archive.

    `filename` is the name of the archive.

    `extract_dir` is the name of the target directory, where the archive
    is unpacked. If not provided, the current working directory is used.

    `format` is the archive format: one of "zip", "tar", "gztar", "bztar",
    or "xztar".  Or any other registered format.  If not provided,
    unpack_archive will use the filename extension and see if an unpacker
    was registered for that extension.

    In case none is found, a ValueError is raised.

    If `filter` is given, it is passed to the underlying
    extraction function.
    NrdzUnknown unpack format '{0}'r�r�zUnknown archive format '{0}')
r,r�r�r�r�r7�dictr�r#�update)r}r�r7rdZ
filter_kwargsr�r�rPr r r!r�s&
�statvfs�
disk_usageZusageztotal used freezTotal space in byteszUsed space in byteszFree space in bytescCs@tj|�}|j|j}|j|j}|j|j|j}t|||�S)z�Return disk usage statistics about the given path.

        Returned value is a named tuple with attributes 'total', 'used' and
        'free', which are the amount of total, used and free space, in bytes.
        )r,r��f_bavail�f_frsize�f_blocks�f_bfree�_ntuple_diskusage)r-r@�free�total�usedr r r!r��s

�ntcCs"tj|�\}}||}t|||�S)z�Return disk usage statistics about the given path.

        Returned values is a named tuple with attributes 'total', 'used' and
        'free', which are the amount of total, used and free space, in bytes.
        )r�Z
_getdiskusager�)r-r�r�r�r r r!r��scCs�|dkr|dkrtd��|}|}|dkr.d}n(t|t�rVt|�}|dkrVtdj|���|dkrdd}n(t|t�s�t|�}|dkr�tdj|���tj	|||�dS)z�Change owner user and group of the given path.

    user and group can be the uid/gid or the user/group names, and in that case,
    they are converted to their respective uid/gid.
    Nzuser and/or group must be setr�zno such user: {!r}zno such group: {!r}���r�)
r�r�rnr��LookupErrorr7�intr�r,r)r-�userr�Z_userZ_groupr r r!r	s"

�P�cCs�yttjd�}Wnttfk
r.d}YnXyttjd�}Wnttfk
r^d}YnX|dksp|dkr�ytjtjj��}Wn$t	tt
fk
r�tj|�}YnX|dkr�|j}|dkr�|j
}tj||f�S)aGet the size of the terminal window.

    For each of the two dimensions, the environment variable, COLUMNS
    and LINES respectively, is checked. If the variable is defined and
    the value is a positive integer, it is used.

    When COLUMNS or LINES is not defined, which is the common case,
    the terminal connected to sys.__stdout__ is queried
    by invoking os.get_terminal_size.

    If the terminal size cannot be successfully queried, either because
    the system doesn't support querying, or because we are not
    connected to a terminal, the value given in fallback parameter
    is used. Fallback defaults to (80, 24) which is the default
    size used by many terminal emulators.

    The value returned is a named tuple of type os.terminal_size.
    ZCOLUMNSrZLINES)r�r,�environr�r�rrt�
__stdout__�fileno�AttributeErrorr.�
terminal_size�columns�lines)Zfallbackrr�sizer r r!r(s$

cs"dd�}tjj��r&|�|�r"�SdS|dkr>tjjdtj�}|sFdS|jtj�}tj	dkr�tj
|krt|jdtj
�tjjdd�jtj�}t�fd	d
�|D��r��g}q‡fdd�|D�}n�g}t
�}xT|D]L}tjj|�}||kr�|j|�x(|D] }	tjj||	�}
||
|�r�|
Sq�Wq�WdS)
a3Given a command, mode, and a PATH string, return the path which
    conforms to the given mode on the PATH, or None if there is no such
    file.

    `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
    of os.environ.get("PATH"), or can be overridden with a custom search
    path.

    cSs&tjj|�o$tj||�o$tjj|�S)N)r,r-rl�accessr_)r?r\r r r!�
_access_checkbszwhich.<locals>._access_checkN�PATHZwin32rZPATHEXTr�c3s |]}�j�j|j��VqdS)N)�lowerr�)r�r�)�cmdr r!�	<genexpr>szwhich.<locals>.<genexpr>csg|]}�|�qSr r )r�r�)rr r!r��szwhich.<locals>.<listcomp>)r,r-r�r��get�defpathr��pathseprt�platformr��insert�anyrer/r�r`)rr\r-rZpathext�files�seen�dirZnormdirZthefilerLr )rr!rUs8







�@)r)FN)r�rrNNN)rrN)r�N)r�r�)r�r�)r�r�)Nr�)NNrrNNN)Nr�)NN)NN�r�r�)r)Vr"r,rtr8rc�collectionsrF�zlibr��ImportErrorr�r�Zlzmar��pwdrZgrpr�__all__r.r
rrrr#r�r$rr3rrr+rNrrr	rr
rwr�r>rxry�supports_dir_fdrj�supports_fdrUr�rZavoids_symlink_attacksr�rr�r�r�r�r�r�rrrrrr�rrr�r�r�r�r�rrm�
namedtupler�r�r�r�r�rLr�rr�F_OK�X_OKrr r r r!�<module>s�






:Y!,

58	
@
-





6
"





/




-zipapp.cpython-36.pyc000064400000012640150335715140010504 0ustar003


 \��@s�ddlZddlZddlZddlZddlZddlZddlZdddgZdZej	j
d�rXdZnej�ZGdd�de
�Zejd	d
��Zdd�Zdd
d�Zddd�Zdd�Zddd�Zedkr�e�dS)�N�ZipAppError�create_archive�get_interpreterz8# -*- coding: utf-8 -*-
import {module}
{module}.{fn}()
�winzutf-8c@seZdZdS)rN)�__name__�
__module__�__qualname__�r	r	�/usr/lib64/python3.6/zipapp.pyr!sc	csFt|tj�rt|�}t|t�r<t||��}|VWdQRXn|VdS)N)�
isinstance�pathlib�Path�str�open)�archive�mode�fr	r	r
�_maybe_open%s
rcCs$|r d|jt�d}|j|�dS)zWrite a shebang line.s#!�
N)�encode�shebang_encoding�write)r�interpreterZshebangr	r	r
�_write_file_prefix0srcCs�t|d��Z}|jd�}|dkr*d}|j�t|d��&}t||�|j|�tj||�WdQRXWdQRX|r�t|t�r�t	j
|t	j|�jtj
B�dS)z8Copy an application archive, modifying the shebang line.�rb�s#!��wbN)r�read�readlinerr�shutilZcopyfileobjrr�os�chmod�stat�st_mode�S_IEXEC)rZnew_archiver�srcZfirst_2�dstr	r	r
�
_copy_archive7s


 r(cCs�d}t|d�rt|d�rd}ntj|�}|j�r4d}|rHt|||�dS|j�sXtd��|dj�}|rt|rttd��|pz|s�td	��d}|r�|jd
�\}}}	tdd�|j	d
�D��}
tdd�|	j	d
�D��}|d
ko�|
o�|s�td|��t
j||	d�}|dk�r|jd�}nt|d��s"tj|�}t
|d��~}t||�tj|d��\}
tj|�}x2|jd�D]$}t|j|��}|
jt|�|��q\W|�r�|
jd|jd��WdQRXWdQRX|�r�t|d��r�|j|j�jtjB�dS)abCreate an application archive from SOURCE.

    The SOURCE can be the name of a directory, or a filename or a file-like
    object referring to an existing archive.

    The content of SOURCE is packed into an application archive in TARGET,
    which can be a filename or a file-like object.  If SOURCE is a directory,
    TARGET can be omitted and will default to the name of SOURCE with .pyz
    appended.

    The created application archive will have a shebang line specifying
    that it should run with INTERPRETER (there will be no shebang line if
    INTERPRETER is None), and a __main__.py which runs MAIN (if MAIN is
    not specified, an existing __main__.py will be used).  It is an error
    to specify MAIN for anything other than a directory source with no
    __main__.py, and it is an error to omit MAIN if the directory has no
    __main__.py.
    FrrTNzSource does not existz__main__.pyz8Cannot specify entry point if the source has __main__.pyzArchive has no entry point�:css|]}|j�VqdS)N)�isidentifier)�.0�partr	r	r
�	<genexpr>|sz!create_archive.<locals>.<genexpr>�.css|]}|j�VqdS)N)r*)r+r,r	r	r
r-}szInvalid entry point: )�module�fnz.pyzrr�w�*zutf-8)�hasattrrr
�is_filer(�existsr�	partition�all�split�
MAIN_TEMPLATE�formatZwith_suffixrr�zipfileZZipFileZrglobrZrelative_torZwritestrrr"r#r$r%)�source�targetr�mainZsource_is_fileZhas_mainZmain_py�mod�sepr0Zmod_okZfn_ok�fd�z�rootZchildZarcnamer	r	r
rNsP




&c	Cs:t|d��&}|jd�dkr,|j�j�jt�SWdQRXdS)Nrrs#!)rrr�strip�decoder)rrr	r	r
r�scCs ddl}|j�}|jddddd�|jdddd	d�|jd
dddd�|jd
dddd�|jddd�|j|�}|jr�tjj|j�s�t	d��t
|j�}tdj|p�d��t
jd�tjj|j��r|jdks�tjj|j�r�tjj|j|j�r�t	d��|j�rt	d��t|j|j|j|jd�dS)z�Run the zipapp command line interface.

    The ARGS parameter lets you specify the argument list directly.
    Omitting ARGS (or setting it to None) works as for argparse, using
    sys.argv[1:] as the argument list.
    rNz--outputz-ozAThe name of the output archive. Required if SOURCE is an archive.)�default�helpz--pythonz-pzEThe name of the Python interpreter to use (default: no shebang line).z--mainz-mzLThe main function of the application (default: use an existing __main__.py).z--infoF�
store_truez)Display the interpreter from the archive.)rF�actionrGr<z'Source directory (or existing archive).)rGz%Can only get info for an archive filezInterpreter: {}z<none>z-In-place editing of archives is not supportedz,Cannot change the main function when copying)rr>)�argparse�ArgumentParser�add_argument�
parse_args�infor!�path�isfiler<�
SystemExitr�printr:�sys�exit�outputr5�samefiler>r�python)�argsrJ�parserrr	r	r
r>�s6







r>�__main__)N)NNN)N)�
contextlibr!rr r#rSr;�__all__r9�platform�
startswithr�getfilesystemencoding�
ValueErrorr�contextmanagerrrr(rrr>rr	r	r	r
�<module>s(


G
-string.cpython-36.pyc000064400000017436150335715140010517 0ustar003


 \.�@s�dZddddddddd	d
ddgZd
dlZdZdZdZeeZdZeddZdZ	dZ
eee
eZddd�Zd
dl
Zd
dlmZGdd�de�ZGdd�ded�ZGdd�d�ZdS)anA collection of string constants.

Public module variables:

whitespace -- a string containing all ASCII whitespace
ascii_lowercase -- a string containing all ASCII lowercase letters
ascii_uppercase -- a string containing all ASCII uppercase letters
ascii_letters -- a string containing all ASCII letters
digits -- a string containing all ASCII decimal digits
hexdigits -- a string containing all ASCII hexadecimal digits
octdigits -- a string containing all ASCII octal digits
punctuation -- a string containing all ASCII punctuation characters
printable -- a string containing all ASCII characters considered printable

�
ascii_letters�ascii_lowercase�ascii_uppercase�capwords�digits�	hexdigits�	octdigits�	printable�punctuation�
whitespace�	Formatter�Template�Nz 	

ZabcdefghijklmnopqrstuvwxyzZABCDEFGHIJKLMNOPQRSTUVWXYZ�
0123456789ZabcdefZABCDEFZ01234567z !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~cCs|pdjdd�|j|�D��S)a�capwords(s [,sep]) -> string

    Split the argument into words using split, capitalize each
    word using capitalize, and join the capitalized words using
    join.  If the optional second argument sep is absent or None,
    runs of whitespace characters are replaced by a single space
    and leading and trailing whitespace are removed, otherwise
    sep is used to split and join the words.

    � css|]}|j�VqdS)N)�
capitalize)�.0�x�r�/usr/lib64/python3.6/string.py�	<genexpr>0szcapwords.<locals>.<genexpr>)�join�split)�s�seprrrr%s)�ChainMapcs eZdZdZ�fdd�Z�ZS)�_TemplateMetaclassa/
    %(delim)s(?:
      (?P<escaped>%(delim)s) |   # Escape sequence of two delimiters
      (?P<named>%(id)s)      |   # delimiter and a Python identifier
      {(?P<braced>%(id)s)}   |   # delimiter and a braced identifier
      (?P<invalid>)              # Other ill-formed delimiter exprs
    )
    csXtt|�j|||�d|kr$|j}ntjtj|j�|jd�}tj||j	tj
B�|_dS)N�pattern)Zdelim�id)�superr�__init__r�_re�escape�	delimiter�	idpattern�compile�flags�VERBOSE)�cls�name�basesZdctr)�	__class__rrrAs
z_TemplateMetaclass.__init__)�__name__�
__module__�__qualname__rr�
__classcell__rr)r*rr7src@s>eZdZdZdZdZejZdd�Z	dd�Z
dd	�Zd
d�ZdS)
rz.A string class for supporting $-substitutions.�$z(?-i:[_a-zA-Z][_a-zA-Z0-9]*)cCs
||_dS)N)�template)�selfr0rrrrXszTemplate.__init__cCsd|jd�}|jd|�jdd�}|s.d}d}n"|tdj|dd���}t|�}td||f��dS)N�invalidT)�keepends��z.Invalid placeholder in string: line %d, col %d���)�startr0�
splitlines�lenr�
ValueError)r1�mo�i�lines�colno�linenorrr�_invalid]s
zTemplate._invalidcsl|std��|^�}t|�dkr(td��|s2|�n|rFt||d��n|d���fdd�}�jj|�j�S)Nz>descriptor 'substitute' of 'Template' object needs an argumentr4zToo many positional argumentsr
csd|jd�p|jd�}|dk	r(t�|�S|jd�dk	r<�jS|jd�dk	rT�j|�td�j��dS)N�named�braced�escapedr2z#Unrecognized named group in pattern)�group�strr"r@r:r)r;rA)�mappingr1rr�convertws
z$Template.substitute.<locals>.convert)�	TypeErrorr9�	_ChainMapr�subr0)�args�kwsrGr)rFr1r�
substituteiszTemplate.substitutecsl|std��|^�}t|�dkr(td��|s2|�n|rFt||d��n|d���fdd�}�jj|�j�S)NzCdescriptor 'safe_substitute' of 'Template' object needs an argumentr4zToo many positional argumentsr
cs||jd�p|jd�}|dk	rByt�|�Stk
r@|j�SX|jd�dk	rV�jS|jd�dk	rl|j�Std�j��dS)NrArBrCr2z#Unrecognized named group in pattern)rDrE�KeyErrorr"r:r)r;rA)rFr1rrrG�s
z)Template.safe_substitute.<locals>.convert)rHr9rIrrJr0)rKrLrGr)rFr1r�safe_substitute�s
zTemplate.safe_substituteN)
r+r,r-�__doc__r"r#r �
IGNORECASEr%rr@rMrOrrrrrMs)�	metaclassc@sVeZdZdd�Zdd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)rcOsz|std��|^}}y|^}}WnJtk
rjd|kr\|jd�}ddl}|jdtdd�n
td�d�YnX|j|||�S)Nz;descriptor 'format' of 'Formatter' object needs an argument�
format_stringr
z9Passing 'format_string' as keyword argument is deprecated�)�
stacklevelz@format() missing 1 required positional argument: 'format_string')rHr:�pop�warnings�warn�DeprecationWarning�vformat)rK�kwargsr1rSrWrrr�format�s

zFormatter.formatcCs.t�}|j||||d�\}}|j|||�|S)NrT)�set�_vformat�check_unused_args)r1rSrKr[�	used_args�result�_rrrrZ�szFormatter.vformatr
c	Cs�|dkrtd��g}x�|j|�D]�\}}	}
}|r:|j|�|	dk	r |	dkrl|dkrZtd��t|�}	|d7}n|	j�r�|r�td��d}|j|	||�\}}
|j|
�|j||�}|j|
||||d|d�\}
}|j|j	||
��q Wdj
|�|fS)Nr
zMax string recursion exceededr5FzJcannot switch from manual field specification to automatic field numberingr4)�auto_arg_index)r:�parse�appendrE�isdigit�	get_field�add�
convert_fieldr^�format_fieldr)r1rSrKr[r`Zrecursion_depthrcraZliteral_text�
field_name�format_spec�
conversion�objZarg_usedrrrr^�s4


zFormatter._vformatcCst|t�r||S||SdS)N)�
isinstance�int)r1�keyrKr[rrr�	get_value�s
zFormatter.get_valuecCsdS)Nr)r1r`rKr[rrrr_szFormatter.check_unused_argscCs
t||�S)N)r\)r1�valuerlrrrrjszFormatter.format_fieldcCsN|dkr|S|dkrt|�S|dkr,t|�S|dkr<t|�Stdj|���dS)Nr�r�az"Unknown conversion specifier {0!s})rE�repr�asciir:r\)r1rsrmrrrriszFormatter.convert_fieldcCs
tj|�S)N)�_stringZformatter_parser)r1rSrrrrdszFormatter.parsec	CsNtj|�\}}|j|||�}x(|D] \}}|r:t||�}q"||}q"W||fS)N)rxZformatter_field_name_splitrr�getattr)	r1rkrKr[�first�restrnZis_attrr<rrrrg(szFormatter.get_fieldN)r
)r+r,r-r\rZr^rrr_rjrirdrgrrrrr�s
5	)N)rP�__all__rxr
rrrrrrr	rr�rer �collectionsrrI�typerrrrrrr�<module>s&


`dis.cpython-36.opt-2.pyc000064400000024633150335715140010725 0ustar003


 \�F�@s�ddlZddlZddlZddlZddlTddlmZdddddd	d
ddd
dgeZ[ejejej	e
eefZ
edZdd�ZdJdd�dd�ZdKdd�dd�Zddddddddddd�
Zd d!�Zd"d#�Zd$d�Zd%d&�Zdd�d'd�Zejd(d)�Zd*ej_d+ej_d,ej_d-ej_d.ej_d/ej _d0ej!_d1ej"_Gd2d
�d
e�Z#dd3�d4d�Z$d5d6�Z%d7d8�Z&dLd9d:�Z'dNdd�d<d�Z(dPddd=�d>d?�Z)dd�d@dA�Z*e(Z+dBdC�Z,dDd
�Z-dEd	�Z.GdFd�d�Z/dGdH�Z0e1dIk�r�e0�dS)Q�N)�*)�__all__�	code_info�dis�disassemble�distb�disco�findlinestarts�
findlabels�	show_code�get_instructions�Instruction�Bytecode�FORMAT_VALUEcCs6yt||d�}Wn tk
r0t||d�}YnX|S)N�eval�exec)�compile�SyntaxError)�source�name�c�r�/usr/lib64/python3.6/dis.py�_try_compiles
r)�filecCs>|dkrt|d�dSt|d�r&|j}t|d�r6|j}t|d�rF|j}t|d�r�t|jj��}x�|D]n\}}t|t	�rdt
d||d�yt||d�Wn0tk
r�}zt
d||d�WYdd}~XnXt
|d�qdWnbt|d�r�t
||d�nJt|ttf��rt||d�n,t|t��r(t||d�ntd	t|�j��dS)
N)r�__func__�__code__�gi_code�__dict__zDisassembly of %s:zSorry:�co_codez(don't know how to disassemble %s objects)r�hasattrrrr�sortedr�items�
isinstance�
_have_code�printr�	TypeErrorr�bytes�	bytearray�_disassemble_bytes�str�_disassemble_str�type�__name__)�xrr"rZx1�msgrrrr"s6





 
c
CsZ|dkrBy
tj}Wntk
r.td��YnXx|jr@|j}q2Wt|jj|j|d�dS)Nz no last traceback to disassemble)r)	�sys�last_traceback�AttributeError�RuntimeError�tb_nextr�tb_frame�f_code�tb_lasti)�tbrrrrrEs

Z	OPTIMIZEDZ	NEWLOCALSZVARARGSZVARKEYWORDSZNESTEDZ	GENERATORZNOFREEZ	COROUTINEZITERABLE_COROUTINEZASYNC_GENERATOR)
������ �@��icCsbg}xRtd�D]8}d|>}||@r|jtj|t|���||N}|sPqW|jt|��dj|�S)Nr>r9z, )�range�append�COMPILER_FLAG_NAMES�get�hex�join)�flags�names�i�flagrrr�pretty_flags_srLcCsht|d�r|j}t|d�r |j}t|d�r0|j}t|t�rDt|d�}t|d�rR|Stdt|�j	��dS)Nrrrz
<disassembly>rz(don't know how to disassemble %s objects)
r rrrr#r*rr&r,r-)r.rrr�_get_code_objectms





rMcCstt|��S)N)�_format_code_inforM)r.rrrr|scCs�g}|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jdt|j��|j	r�|jd�x t
|j	�D]}|jd	|�q�W|jr�|jd
�x t
|j�D]}|jd|�q�W|j�r|jd�x t
|j�D]}|jd|�q�W|j
�rF|jd
�x"t
|j
�D]}|jd|��q.W|j�r||jd�x"t
|j�D]}|jd|��qdWdj|�S)NzName:              %szFilename:          %szArgument count:    %szKw-only arguments: %szNumber of locals:  %szStack size:        %szFlags:             %sz
Constants:z%4d: %rzNames:z%4d: %szVariable names:zFree variables:zCell variables:�
)rC�co_name�co_filename�co_argcount�co_kwonlyargcount�
co_nlocals�co_stacksizerL�co_flags�	co_consts�	enumerate�co_names�co_varnames�co_freevars�co_cellvarsrG)�co�linesZi_cZi_nrrrrN�s:




rNcCstt|�|d�dS)N)r)r%r)r]rrrrr�s�_InstructionzBopname opcode arg argval argrepr offset starts_line is_jump_targetz!Human readable name for operationzNumeric code for operationz6Numeric argument to operation (if any), otherwise Nonez4Resolved arg value (if known), otherwise same as argz0Human readable description of operation argumentz1Start index of operation within bytecode sequencez4Line started by this opcode (if any), otherwise Nonez1True if other code jumps to here, otherwise Falsec@seZdZddd�ZdS)r
�FcCs�g}|r:|jdk	r,d|}|j||j�n|jd|�|rJ|jd�n
|jd�|jrf|jd�n
|jd�|jt|j�jd��|j|jjd��|jdk	r�|jt|j�jd	��|j	r�|jd
|j	d�dj
|�j�S)Nz%%%dd� z-->z   z>>z  r;���(�))�starts_linerC�is_jump_target�repr�offset�rjust�opname�ljust�arg�argreprrG�rstrip)�self�lineno_widthZmark_as_currentZfieldsZ
lineno_fmtrrr�_disassemble�s&



zInstruction._disassembleN)r`F)r-�
__module__�__qualname__rrrrrrr
�s)�
first_linecCsTt|�}|j|j}tt|��}|dk	r4||j}nd}t|j|j|j	|j
|||�S)Nr)rMr\r[�dictr	�co_firstlineno�_get_instructions_bytesrrZrYrW)r.rur]�
cell_names�
linestarts�line_offsetrrrr�scCs |}|dk	r||}|t|�fS)N)rh)Zconst_indexZ
const_list�argvalrrr�_get_const_info�sr}cCs*|}|dk	r||}|}nt|�}||fS)N)rh)Z
name_indexZ	name_listr|rnrrr�_get_name_infosr~c
csxt|�}d}�xdt|�D�]V\}	}
}|dk	rH|j|	d�}|dk	rH||7}|	|k}d}
d}|dk	�rT|}
|
tkr~t||�\}
}n�|
tkr�t||�\}
}n�|
tkr�|	d|}
dt|
�}n�|
t	kr�t||�\}
}n�|
t
kr�t|}
|
}nn|
tkr�t||�\}
}nV|
t
k�rTdtttf|d@t|d@�f}
d|d@}|
d	�rT|�rL|d
7}|d7}tt|
|
||
||	||�VqWdS)
N�r:zto r`r;r*rh�asciir9z, zwith format)rr*rhr�)r
�_unpack_opargsrEZhasconstr}Zhasnamer~�hasjrelrhZhaslocalZ
hascompareZcmp_opZhasfreerr*r��boolr
rk)�code�varnamesrI�	constants�cellsrzr{�labelsrfri�oprmrgr|rnrrrrxsH


 

rxr9c
Cs<|j|j}tt|��}t|j||j|j|j|||d�dS)N)r)	r\r[rvr	r)rrZrYrW)r]�lastirryrzrrrrJs)rr{c	Cs||dk	}	|	rdnd}
xbt|||||||d�D]H}|	oF|jdk	oF|jdk}|rVt|d�|j|k}
t|j|
|
�|d�q,WdS)Nr`r)r{)r)rxrfrir%rr)r�r�r�rIr�r�rzrr{Zshow_linenorqZinstrZnew_source_lineZis_current_instrrrrr)Qs




r)cCstt|d�|d�dS)Nz<dis>)r)rr)rrrrrr+csr+ccshd}x^tdt|�d�D]J}||}|tkrP||d|B}|tkrJ|d>nd}nd}|||fVqWdS)Nrr:r9r<)rB�lenZ
HAVE_ARGUMENTZEXTENDED_ARG)r�Zextended_argrJr�rmrrrr�isr�cCs`g}xVt|�D]J\}}}|dk	r|tkr6|d|}n|tkr|}nq||kr|j|�qW|S)Nr:)r�r�ZhasjabsrC)r�r�rir�rmZlabelrrrr
tsccs�|jddd�}|jddd�}d}|j}d}xPt||�D]B\}}|rd||kr\||fV|}||7}|dkrt|d8}||7}q:W||kr�||fVdS)Nrr:r9r@rA)�	co_lnotabrw�zip)r�Zbyte_incrementsZline_incrementsZ
lastlineno�linenoZaddrZ	byte_incrZ	line_incrrrrr	�s 
c@sHeZdZddd�dd�Zdd�Zdd�Zed	d
��Zdd�Zd
d�Z	dS)rN)ru�current_offsetcCsdt|�|_}|dkr&|j|_d|_n||_||j|_|j|j|_tt	|��|_
||_||_dS)Nr)
rM�codeobjrwru�_line_offsetr\r[�_cell_namesrvr	�_linestarts�_original_objectr�)rpr.rur�r]rrr�__init__�szBytecode.__init__c	Cs*|j}t|j|j|j|j|j|j|jd�S)N)r{)	r�rxrrZrYrWr�r�r�)rpr]rrr�__iter__�s
zBytecode.__iter__cCsdj|jj|j�S)Nz{}({!r}))�format�	__class__r-r�)rprrr�__repr__�s
zBytecode.__repr__cCs$x|jr|j}qW||jj|jd�S)N)r�)r4r5r6r7)�clsr8rrr�from_traceback�s
zBytecode.from_tracebackcCs
t|j�S)N)rNr�)rprrr�info�sz
Bytecode.infocCs`|j}|jdk	r|j}nd}tj��2}t|j|j|j|j|j	|j
|j||d�	|j�SQRXdS)Nr9)r�rIr�r�rzr{rr����)
r�r��io�StringIOr)rrZrYrWr�r�r��getvalue)rpr]ri�outputrrrr�s


zBytecode.dis)
r-rsrtr�r�r��classmethodr�r�rrrrrr�s
cCsdddl}|j�}|jd|j�ddd�|j�}|j�}|j�}WdQRXt||jjd�}t	|�dS)Nr�infile�?�-)r,�nargs�defaultr)
�argparse�ArgumentParser�add_argumentZFileType�
parse_argsr��readrrr)r��parser�argsr�rr�rrr�_test�sr��__main__)N)N)NNNNNrr�)r�r�)r�NNNNN)2r0�types�collectionsr�ZopcoderZ_opcodes_all�
MethodType�FunctionType�CodeTyper��staticmethodr,r$ZopmaprrrrrDrLrMrrNr�
namedtupler_rk�__doc__rmr|rnrirfrgr
rr}r~rxrr)r+rr�r
r	rr�r-rrrr�<module>sv


#3
2=
doctest.cpython-36.opt-2.pyc000064400000116123150335715140011607 0ustar003


 \Ǘ�!@spdZddddddddd	d
ddd
ddddddddddddddddddd d!g!Zd"d#lZd"d#lZd"d#lZd"d#lZd"d#lZd"d#lZd"d#lZd"d#l	Z	d"d#l
Z
d"d#lZd"d#lZd"d$l
mZd"d%lmZed&d'�ZiZd(d�Zed�Zed�Zed�Zed�Zed�Zed�ZeeBeBeBeBeBZed	�Zed
�Zed�Zed�Zed�ZeeBeBeBeBZ d)Z!d*Z"d+d,�Z#dpd.d/�Z$d0d1�Z%dqd3d4�Z&d5d6�Z'Gd7d8�d8e�Z(d9d:�Z)d;d<�Z*d=d>�Z+Gd?d@�d@ej,�Z-dAdB�Z.GdCd�d�Z/GdDd�d�Z0GdEd�d�Z1GdFd�d�Z2GdGd�d�Z3GdHd�d�Z4GdId�de5�Z6GdJd�de5�Z7GdKd�de3�Z8d#a9drdNd�Z:dLd#d#d#d#dLd"d#dMe1�d#fdOd�Z;dsdQd�Z<d"a=dRd�Z>GdSdT�dTej?�Z@GdUdV�dVe@�ZAGdWdX�dXejB�ZCdtdYd�ZDGdZd[�d[e@�ZEdLd#d#e1�d#fd\d]�ZFd^d�ZGd_d�ZHd`d�ZIdudad �ZJdvdbdc�ZKdwddd!�ZLGdedf�df�ZMeMdgdhdidjdkdl�ZNdmdn�ZOePdok�rle
jQeO��d#S)xzreStructuredText en�register_optionflag�DONT_ACCEPT_TRUE_FOR_1�DONT_ACCEPT_BLANKLINE�NORMALIZE_WHITESPACE�ELLIPSIS�SKIP�IGNORE_EXCEPTION_DETAIL�COMPARISON_FLAGS�REPORT_UDIFF�REPORT_CDIFF�REPORT_NDIFF�REPORT_ONLY_FIRST_FAILURE�REPORTING_FLAGS�	FAIL_FAST�Example�DocTest�
DocTestParser�
DocTestFinder�
DocTestRunner�
OutputChecker�DocTestFailure�UnexpectedException�DebugRunner�testmod�testfile�run_docstring_examples�DocTestSuite�DocFileSuite�set_unittest_reportflags�script_from_examples�
testsource�	debug_src�debug�N)�StringIO)�
namedtuple�TestResultszfailed attemptedcCstj|dtt�>�S)N�)�OPTIONFLAGS_BY_NAME�
setdefault�len)�name�r+�/usr/lib64/python3.6/doctest.pyr�sz<BLANKLINE>z...cCs<d}x2tjD](}|j|d�}|tt|�kr||jO}qW|S)Nr")�
__future__Zall_feature_names�get�getattrZ
compiler_flag)�globs�flagsZfnameZfeaturer+r+r,�_extract_future_flags�sr2�cCsVtj|�r|St|t�r,t|t�t�dg�S|dkrJtjtj	|�j
dStd��dS)N�*�__name__z"Expected a module, string, or None)�inspect�ismodule�
isinstance�str�
__import__�globals�locals�sys�modules�	_getframe�	f_globals�	TypeError)�moduleZdepthr+r+r,�_normalize_module�s


rCc	Cs�|r\t|d�}t||�}t|dd�dk	r\t|jd�r\|jj|�}|j|�}|jtj	d�|fSt
||d��}|j�|fSQRXdS)N��
__loader__�get_data�
)�encoding)rC�_module_relative_pathr/�hasattrrErF�decode�replace�os�linesep�open�read)�filename�package�module_relativerHZ
file_contents�fr+r+r,�_load_testfile�s


rU�cCstjd|d|�S)Nz
(?m)^(?!$)� )�re�sub)�s�indentr+r+r,�_indent�sr\cCs*t�}|\}}}tj||||d�|j�S)N)�file)r#�	traceback�print_exception�getvalue)�exc_infoZexcout�exc_typeZexc_valZexc_tbr+r+r,�_exception_traceback�s
rcc@seZdZdd�Zddd�ZdS)�	_SpoofOutcCs&tj|�}|r"|jd�r"|d7}|S)NrG)r#r`�endswith)�self�resultr+r+r,r`�s
z_SpoofOut.getvalueNcCs|j|�tj|�dS)N)�seekr#�truncate)rf�sizer+r+r,ris
z_SpoofOut.truncate)N)r5�
__module__�__qualname__r`rir+r+r+r,rd�s	rdcCs�t|kr||kS|jt�}dt|�}}|d}|rR|j|�rNt|�}|d=ndS|d}|r�|j|�r||t|�8}|d=ndS||kr�dSx2|D]*}|j|||�}|dkr�dS|t|�7}q�WdS)Nr"Fr&T���rm)�ELLIPSIS_MARKER�splitr)�
startswithre�find)�want�gotZws�startpos�endpos�wr+r+r,�_ellipsis_matchs0



rwcCs|j�}|rd|SdSdS)Nz# �#)�rstrip)�liner+r+r,�
_comment_line9sr{cCshdt|�}}|jd�}|dkr$|}|jdd|�}|dkr>|}|jdd|�}|dkr\|d}|||�S)Nr"rG�:�.r&)r)rq�rfind)�msg�start�end�ir+r+r,�_strip_exception_detailsAs
r�c@s.eZdZdd�Zd
dd�Zdd�Zdd	�ZdS)�_OutputRedirectingPdbcCs(||_d|_tjj||dd�d|_dS)NFT)�stdout�nosigintr&)�_OutputRedirectingPdb__out�$_OutputRedirectingPdb__debugger_used�pdb�Pdb�__init__Zuse_rawinput)rf�outr+r+r,r�asz_OutputRedirectingPdb.__init__NcCs*d|_|dkrtj�j}tjj||�dS)NT)r�r=r?�f_backr�r��	set_trace)rf�framer+r+r,r�is
z_OutputRedirectingPdb.set_tracecCs|jrtjj|�dS)N)r�r�r��set_continue)rfr+r+r,r�osz"_OutputRedirectingPdb.set_continuecGs.tj}|jt_ztjj|f|��S|t_XdS)N)r=r�r�r�r��trace_dispatch)rf�args�save_stdoutr+r+r,r�us
z$_OutputRedirectingPdb.trace_dispatch)N)r5rkrlr�r�r�r�r+r+r+r,r�[s
r�cCs�tj|�std|��|jd�r(td��tjj|jd��}t	|d�rXtjj|j
�d}n�|jdkr�tt
j�dkr�t
jddkr�tjjt
jd�d}q�tj}nFt	|d�r�x,|jD]"}tjj||�}tjj|�r�|Sq�Wtd	|j��tjj||�S)
NzExpected a module: %r�/z1Module-relative files may not have absolute paths�__file__r"�__main__��__path__zBCan't resolve paths relative to the module %r (it has no __file__))r6r7rArp�
ValueErrorrM�path�joinrorJr�r5r)r=�argv�curdirr��exists)rBZ	test_pathZbasedirZ	directoryZfullpathr+r+r,rI�s&





rIc@s&eZdZd	dd�Zdd�Zdd�ZdS)
rNr"cCsz|jd�s|d7}|r*|jd�r*|d7}|dk	rF|jd�rF|d7}||_||_||_||_|dkrji}||_||_dS)NrG)re�sourcerr�linenor[�options�exc_msg)rfr�rrr�r�r[r�r+r+r,r��s
zExample.__init__cCs\t|�t|�k	rtS|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkS)N)�type�NotImplementedr�rrr�r[r�r�)rf�otherr+r+r,�__eq__�szExample.__eq__cCst|j|j|j|j|jf�S)N)�hashr�rrr�r[r�)rfr+r+r,�__hash__�szExample.__hash__)Nr"r"N)r5rkrlr�r�r�r+r+r+r,r�s#
c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)rcCs,||_||_|j�|_||_||_||_dS)N)�examples�	docstring�copyr0r*rQr�)rfr�r0r*rQr�r�r+r+r,r�
s
zDocTest.__init__cCsRt|j�dkrd}n"t|j�dkr(d}ndt|j�}d|jj|j|j|j|fS)Nr"zno examplesr&z	1 examplez%d examplesz<%s %s from %s:%s (%s)>)r)r��	__class__r5r*rQr�)rfr�r+r+r,�__repr__szDocTest.__repr__cCs\t|�t|�k	rtS|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkS)N)r�r�r�r�r0r*rQr�)rfr�r+r+r,r�#szDocTest.__eq__cCst|j|j|j|jf�S)N)r�r�r*rQr�)rfr+r+r,r�.szDocTest.__hash__cCs:t|t�stS|j|j|jt|�f|j|j|jt|�fkS)N)r8rr�r*rQr��id)rfr�r+r+r,�__lt__2s
zDocTest.__lt__N)r5rkrlr�r�r�r�r�r+r+r+r,r�s
c@s�eZdZejdejejB�ZejdejejBejB�Z	ejd�j
Zddd�Zdd�Z
dd	d
�Zdd�Zejd
ej�Zdd�Zejdej�Zdd�Zdd�Zdd�ZdS)ra�
        # Source consists of a PS1 line followed by zero or more PS2 lines.
        (?P<source>
            (?:^(?P<indent> [ ]*) >>>    .*)    # PS1 line
            (?:\n           [ ]*  \.\.\. .*)*)  # PS2 lines
        \n?
        # Want consists of any non-blank lines that do not start with PS1.
        (?P<want> (?:(?![ ]*$)    # Not a blank line
                     (?![ ]*>>>)  # Not a line starting with PS1
                     .+$\n?       # But any other line
                  )*)
        a�
        # Grab the traceback header.  Different versions of Python have
        # said different things on the first traceback line.
        ^(?P<hdr> Traceback\ \(
            (?: most\ recent\ call\ last
            |   innermost\ last
            ) \) :
        )
        \s* $                # toss trailing whitespace on the header.
        (?P<stack> .*?)      # don't blink: absorb stuff until...
        ^ (?P<msg> \w+ .*)   #     a line *starts* with alphanum.
        z^[ ]*(#.*)?$�<string>cs|j�}|j|���dkr8dj�fdd�|jd�D��}g}d\}}x�|jj|�D]�}|j|||j���||jd||j��7}|j	|||�\}}}	}
|j
|�s�|jt||	|
|�t|j
d��|d��||jd|j�|j��7}|j�}qRW|j||d��|S)Nr"rGcsg|]}|�d��qS)Nr+)�.0�l)�
min_indentr+r,�
<listcomp>ysz'DocTestParser.parse.<locals>.<listcomp>r[)r�r[r�)r"r")�
expandtabs�_min_indentr�ro�_EXAMPLE_RE�finditer�appendr��count�_parse_example�_IS_BLANK_OR_COMMENTrr)�groupr�)rf�stringr*�outputZcharnor��mr�r�rrr�r+)r�r,�parsems&


zDocTestParser.parsecCst|j||�|||||�S)N)r�get_examples)rfr�r0r*rQr�r+r+r,�get_doctest�s	zDocTestParser.get_doctestcCsdd�|j||�D�S)NcSsg|]}t|t�r|�qSr+)r8r)r��xr+r+r,r��sz.DocTestParser.get_examples.<locals>.<listcomp>)r�)rfr�r*r+r+r,r��szDocTestParser.get_examplesc
s
t|jd���|jd�jd�}|j|�||�|j|dd�d�d||�dj�fdd�|D��}|jd	�}|jd�}t|�dkr�tjd
|d
�r�|d=|j|d�||t|��dj�fdd�|D��}|jj|�}|r�|jd�}nd}|j	|||�}	||	||fS)Nr[r�rGr&rWr}csg|]}|�dd��qS)rVNr+)r�Zsl)r[r+r,r��sz0DocTestParser._parse_example.<locals>.<listcomp>rrz *$csg|]}|�d��qS)Nr+)r�Zwl)r[r+r,r��srrmrm)
r)r�ro�_check_prompt_blank�
_check_prefixr�rX�match�
_EXCEPTION_RE�
_find_options)
rfr�r*r��source_linesr�rr�
want_linesr�r�r+)r[r,r��s$ 

zDocTestParser._parse_examplez#\s*doctest:\s*([^\n\'"]*)$c	Cs�i}x�|jj|�D]z}|jd�jdd�j�}x^|D]V}|ddksR|dd�tkrhtd|d||f��t|dd�}|ddk||<q2WqW|r�|j|�r�td|||f��|S)	Nr&�,rWr"z+-z7line %r of the doctest for %s has an invalid option: %r�+zSline %r of the doctest for %s has an option directive on a line with no example: %r)�_OPTION_DIRECTIVE_REr�r�rLror'r�r�)	rfr�r*r�r�r�Zoption_strings�option�flagr+r+r,r��s
zDocTestParser._find_optionsz
^([ ]*)(?=\S)cCs2dd�|jj|�D�}t|�dkr*t|�SdSdS)NcSsg|]}t|��qSr+)r))r�r[r+r+r,r�sz-DocTestParser._min_indent.<locals>.<listcomp>r")�
_INDENT_RE�findallr)�min)rfrZ�indentsr+r+r,r�szDocTestParser._min_indentc	Csbx\t|�D]P\}}t|�|dkr
||ddkr
td||d||||d�|f��q
WdS)NrVrDrWz8line %r of the docstring for %s lacks blank after %s: %rr&)�	enumerater)r�)rf�linesr[r*r�r�rzr+r+r,r�
s
 z!DocTestParser._check_prompt_blankcCsDx>t|�D]2\}}|r
|j|�r
td||d||f��q
WdS)NzGline %r of the docstring for %s has inconsistent leading whitespace: %rr&)r�rpr�)rfr��prefixr*r�r�rzr+r+r,r�szDocTestParser._check_prefixN)r�)r�)r5rkrlrX�compile�	MULTILINE�VERBOSEr��DOTALLr�r�r�r�r�r�r�r�r�r�r�r�r�r+r+r+r,r=s 	
'
3c@sJeZdZde�ddfdd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)rFTcCs||_||_||_||_dS)N)�_parser�_verbose�_recurse�_exclude_empty)rf�verbose�parser�recurse�
exclude_emptyr+r+r,r�1szDocTestFinder.__init__Nc	CsP|dkr.t|dd�}|dkr.tdt|�f��|dkr<d}n|dkrNtj|�}ytj|�}Wntk
rtd}YndX|s�tj|�}|d|dd�dks�d}|dkr�d}n*|dk	r�tj	||j
�}n
tj	|�}|s�d}|dk�r�|dkr�i}n
|j
j�}n|j�}|dk	�r|j|�d|k�r*d|d<g}|j
||||||i�|j�|S)	Nr5zJDocTestFinder.find: name must be given when obj.__name__ doesn't exist: %rFr"r3z<]>r����)r/r�r�r6�	getmoduleZ
getsourcefilerAZgetfile�	linecache�getlines�__dict__r��update�_find�sort)	rf�objr*rBr0�
extraglobsr]r��testsr+r+r,rqGsJ$







zDocTestFinder.findcCs�|dkrdStj|�dk	r(|tj|�kStj|�r>|j|jkStj|�r|t|d�r\|jj}nt|d�rn|j}ndS|j	|kStj
|�r�|j	|jkSt|d�r�|j	|jkSt|t�r�dSt
d��dS)NT�__objclass__rkz"object must be a class or function)r6r��
isfunctionr��__globals__ZismethoddescriptorrJr�rkr5�isclassr8�propertyr�)rfrB�objectZobj_modr+r+r,�_from_module�s(








zDocTestFinder._from_modulec	Cs(|jrtd|�t|�|kr"dSd|t|�<|j|||||�}|dk	rR|j|�tj|�r�|jr�x^|jj	�D]P\}	}
d||	f}	tj
tj|
��s�tj|
�rn|j
||
�rn|j||
|	||||�qnWtj|�o�|j�rtx�t|di�j	�D]�\}	}
t|	t��stdt|	�f��tj
|
��p8tj|
��p8tj|
��p8t|
t��sNtdt|
�f��d||	f}	|j||
|	||||�q�Wtj|��r$|j�r$x�|jj	�D]�\}	}
t|
t��r�t||	�}
t|
t��r�t||	�j}
tj
|
��s�tj|
��s�t|
t��r�|j
||
��r�d||	f}	|j||
|	||||��q�WdS)NzFinding tests in %sr&z%s.%s�__test__z5DocTestFinder.find: __test__ keys must be strings: %rz`DocTestFinder.find: __test__ values must be strings, functions, methods, classes, or modules: %rz%s.__test__.%s)r��printr��	_get_testr�r6r7r�r��itemsZ	isroutineZunwrapr�r�r�r/r8r9r�r��staticmethod�classmethod�__func__r�)rfr�r�r*rBr�r0�seen�testZvalname�valr+r+r,r��sP


zDocTestFinder._findc	Cs�t|t�r|}nJy,|jdkr"d}n|j}t|t�s:t|�}Wnttfk
rXd}YnX|j||�}|jrv|rvdS|dkr�d}n*t|d|j�}|dd�dkr�|dd�}|j	j
|||||�S)Nr�r�rVz.pycr&���rm)r8r9�__doc__rA�AttributeError�_find_linenor�r/r5r�r�)	rfr�r*rBr0r�r�r�rQr+r+r,r�s(



zDocTestFinder._get_testcCsd}tj|�rd}tj|�rd|dkr(dStjdt|dd��}x$t|�D]\}}|j|�rH|}PqHWtj|�rt|j	}tj
|�r�|j}tj|�r�|j
}tj|�r�|j}tj|�r�t|dd�d}|dk	�r|dkr�|dStjd�}x(t|t|��D]}|j||�r�|Sq�WdS)Nr"z^\s*class\s*%s\br5�-�co_firstlinenor&z(^|.*:)\s*\w*("|\'))r6r7r�rXr�r/r�r�Zismethodr�r��__code__Zistraceback�tb_frameZisframe�f_codeZiscode�ranger))rfr�r�r�Zpatr�rzr+r+r,r-s<









zDocTestFinder._find_lineno)NNNN)
r5rkrlrr�rqr�r�r�rr+r+r+r,r(s	
f?%c@s�eZdZddZddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zej
d�Zd dd�Zd!dd�Zd"dd�Zdd�ZdS)#rr4�FNr"cCsN|pt�|_|dkrdtjk}||_||_||_d|_d|_i|_	t
�|_dS)Nz-vr")r�_checkerr=r�r��optionflags�original_optionflags�tries�failures�_name2ftrd�_fakeout)rf�checkerr�rr+r+r,r��s
zDocTestRunner.__init__cCsH|jrD|jr.|dt|j�dt|j��n|dt|j�d�dS)NzTrying:
zExpecting:
zExpecting nothing
)r�rrr\r�)rfr�r��exampler+r+r,�report_start�s zDocTestRunner.report_startcCs|jr|d�dS)Nzok
)r�)rfr�r�rrsr+r+r,�report_success�szDocTestRunner.report_successcCs&||j||�|jj|||j��dS)N)�_failure_headerr�output_differencer)rfr�r�rrsr+r+r,�report_failure�szDocTestRunner.report_failurecCs$||j||�dtt|���dS)NzException raised:
)rr\rc)rfr�r�rrar+r+r,�report_unexpected_exception�sz)DocTestRunner.report_unexpected_exceptioncCs�|jg}|jrR|jdk	r4|jdk	r4|j|jd}nd}|jd|j||jf�n|jd|jd|jf�|jd�|j}|jt|��dj|�S)Nr&�?zFile "%s", line %s, in %szLine %s, in %szFailed example:rG)�DIVIDERrQr�r�r*r�r\r�)rfr�rr�r�r�r+r+r,r�s
zDocTestRunner._failure_headercCs�d}}|j}td�\}}}	|jj}
�xFt|j�D�]6\}}|jt@oL|dk}
||_|jr�x:|jj�D],\}}|r�|j|O_qf|j|M_qfW|jt	@r�q2|d7}|
s�|j
|||�d|j|f}y,tt
|j|d|d�|j�|jj�d}Wn4tk
�r�Yntj�}|jj�YnX|jj�}|jjd�|}|dk�rh|
|j||j��r�|}n|tj|dd��d}|
�s�|t|�7}|jdk�r�|	}nB|
|j||j��r�|}n*|jt@�r�|
t|j�t|�|j��r�|}||k�r|
�sZ|j||||�nT||k�r0|
�s&|j ||||�|d7}n*||	k�rZ|
�sP|j!||||�|d7}n|r2|jt"@r2Pq2W||_|j#|||�t$||�S)Nr"rDr&z<doctest %s[%d]>Zsingler3rm)%rr	r�check_outputr�r�rr�r�rrr*�execr�r�r0�debuggerr��KeyboardInterruptr=rarr`rirrr^�format_exception_onlyrcr�rr�rrrr�_DocTestRunner__record_outcomer%)rfr��compileflagsr�rrr
�SUCCESS�FAILUREZBOOMZcheck�
examplenumr�quietZ
optionflagr�rQZ	exceptionrsZoutcomer�r+r+r,Z__run�s�












zDocTestRunner.__runcCsL|jj|jd�\}}||||f|j|j<|j|7_|j|7_dS)Nr")r"r")rr.r*rr)rfr�rT�t�f2�t2r+r+r,Z__record_outcomeuszDocTestRunner.__record_outcomez.<doctest (?P<name>.+)\[(?P<examplenum>\d+)\]>$cCsV|jj|�}|rF|jd�|jjkrF|jjt|jd��}|jjdd�S|j	||�SdS)Nr*r%T)�keepends)
�%_DocTestRunner__LINECACHE_FILENAME_REr�r�r�r*r��intr��
splitlines�save_linecache_getlines)rfrQ�module_globalsr�rr+r+r,Z__patched_linecache_getlines�s
z*DocTestRunner.__patched_linecache_getlinesTc	s�||_|dkrt|j�}tj�|dkrV�j��dks@�j�dkrH�j}n��fdd�}|jt_tj	�}t
j}t��|_
|j
j�|j
jt
_tj|_|jt_tj}tjt_z|j|||�S�t_|t
_tj|�|jt_|t_|r�|jj�ddl}d|_XdS)Nzutf-8cs t|j�d���}�j|�dS)N�backslashreplace)r9�encode�write)rZ)rHr�r+r,r��szDocTestRunner.run.<locals>.outr")r�r2r0r=r�rH�lowerr2r�gettracer�r�r�r�resetr�r�r.�*_DocTestRunner__patched_linecache_getlines�displayhook�__displayhook__�_DocTestRunner__run�settrace�clear�builtins�_)	rfr�r"r��clear_globsZ
save_traceZsave_set_traceZsave_displayhookr<r+)rHr�r,�run�s<





zDocTestRunner.runc
Cs�|dkr|j}g}g}g}d}}xd|jj�D]V}|\}\}	}
||
7}||	7}|
dkrb|j|�q.|	dkrz|j||
f�q.|j|�q.W|r�|r�tt|�d�|j�x|D]}td|�q�W|r�tt|�d�|j�x |D]\}}td||f�q�W|�rJt|j�tt|�d�|j�x(|D] \}\}	}
td|	|
|f��q&W|�rvt|dt|j�d	�t||d
|d�|�r�td|d
�n|�r�td�t||�S)Nr"zitems had no tests:z   zitems passed all tests:z %3d tests in %szitems had failures:z %3d of %3d in %sztests inzitems.z
passed andzfailed.z***Test Failed***z	failures.zTest passed.)	r�rr�r�r�r)r�rr%)
rfr�ZnotestsZpassedZfailedZtotaltZtotalfr�r*rTr'�thingr�r+r+r,�	summarize�sP

zDocTestRunner.summarizecCsV|j}xJ|jj�D]<\}\}}||krB||\}}||}||}||f||<qWdS)N)rr�)rfr��dr*rTr'r(r)r+r+r,�mergeszDocTestRunner.merge)NNr")N)NNT)N)r5rkrlrr�rrrrrr9r!rXr�r+r6r?rArCr+r+r+r,ras:
$
}



I
9c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rcCst|jdd�d�S)N�ASCIIr0)r9r1)rfrZr+r+r,�_toAscii!szOutputChecker._toAsciicCs�|j|�}|j|�}||kr dS|t@sH||fdkr8dS||fdkrHdS|t@s�tjdtjt�d|�}tjdd|�}||kr�dS|t@r�d	j|j	��}d	j|j	��}||kr�dS|t
@r�t||�r�dSd
S)
NT�True
�1
�False
�0
z(?m)^%s\s*?$r�z
(?m)^\s*?$rWF)rFrG)rHrI)rErrrXrY�escape�BLANKLINE_MARKERrr�rorrw)rfrrrsrr+r+r,r's0


zOutputChecker.check_outputcCs<|ttBtB@sdS|t@r dS|jd�dko:|jd�dkS)NFTrGr3)r	r
rr�)rfrrrsrr+r+r,�_do_a_fancy_difffszOutputChecker._do_a_fancy_diffc
Cs8|j}|t@stjdt|�}|j|||�r�|jdd�}|jdd�}|t@rptj	||dd�}t
|�dd�}d}nZ|t@r�tj||dd�}t
|�dd�}d}n,|t
@r�tjtjd�}	t
|	j||��}d	}nd
d�|D�}d|td
j|��S|o�|�rdt|�t|�fS|�rdt|�S|�r0dt|�SdSdS)Nz(?m)^[ ]*(?=
)T)r*r3)�nz#unified diff with -expected +actualz-context diff with expected followed by actual)Zcharjunkzndiff with -expected +actualcSsg|]}|j�d�qS)rG)ry)r�rzr+r+r,r��sz3OutputChecker.output_difference.<locals>.<listcomp>zDifferences (%s):
r�zExpected:
%sGot:
%szExpected:
%sGot nothing
zExpected nothing
Got:
%szExpected nothing
Got nothing
)rrrrXrYrKrLr-r	�difflibZunified_diff�listr
Zcontext_diffrZDifferZIS_CHARACTER_JUNKZcomparer\r�)
rfrrsrrrr�Z	got_linesZdiffZkindZenginer+r+r,r}s6
zOutputChecker.output_differenceN)r5rkrlrErrLrr+r+r+r,rs?c@seZdZdd�Zdd�ZdS)rcCs||_||_||_dS)N)r�rrs)rfr�rrsr+r+r,r��szDocTestFailure.__init__cCs
t|j�S)N)r9r�)rfr+r+r,�__str__�szDocTestFailure.__str__N)r5rkrlr�rPr+r+r+r,r�sc@seZdZdd�Zdd�ZdS)rcCs||_||_||_dS)N)r�rra)rfr�rrar+r+r,r��szUnexpectedException.__init__cCs
t|j�S)N)r9r�)rfr+r+r,rP�szUnexpectedException.__str__N)r5rkrlr�rPr+r+r+r,r�sc@s&eZdZd	dd�Zdd�Zdd�ZdS)
rNTcCs$tj||||d�}|r |jj�|S)NF)rr?r0r;)rfr�r"r�r>�rr+r+r,r?.s
zDebugRunner.runcCst|||��dS)N)r)rfr�r�rrar+r+r,r4sz'DebugRunner.report_unexpected_exceptioncCst|||��dS)N)r)rfr�r�rrsr+r+r,r7szDebugRunner.report_failure)NNT)r5rkrlr?rrr+r+r+r,r�s[
TFc	Cs�|dkrtjjd�}tj|�s,td|f��|dkr:|j}t|d�}	|rVt||d�}
nt	||d�}
x$|	j
||||d�D]}|
j|�qvW|r�|
j�t
dkr�|
a
n
t
j|
�t|
j|
j�S)Nr�ztestmod: module required; %r)r�)r�r)r0r�)r=r>r.r6r7rAr5rrrrqr?rA�masterrCr%rr)r�r*r0r��reportrr��raise_on_errorr��finder�runnerr�r+r+r,rCs$E


cCs�|r|rtd��t||||p d�\}}|dkr<tjj|�}|dkrJi}n|j�}|dk	rd|j|�d|krtd|d<|	r�t||d�}
nt||d�}
|
j	||||d�}|
j
|�|r�|
j�tdkr�|
an
tj
|
�t|
j|
j�S)Nz8Package may only be specified for module-relative paths.zutf-8r5r�)r�rr")r�rUrMr��basenamer�r�rrr�r?rArRrCr%rr)rQrSr*rRr0r�rSrr�rTr�rH�textrVr�r+r+r,r�s0R



�NoNamec	CsDt|dd�}t||d�}x&|j|||d�D]}|j||d�q*WdS)NF)r�r�)r�r)r0)r")rrrqr?)	rTr0r�r*r"rrUrVr�r+r+r,r&scCs"|t@|krtd|��t}|a|S)NzOnly reporting flags allowed)r
r��_unittest_reportflags)r1�oldr+r+r,rCs

c@sjeZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�ZeZ
dd�ZdS)�DocTestCaser"NcCs.tjj|�||_||_||_||_||_dS)N)�unittest�TestCaser��_dt_optionflags�_dt_checker�_dt_test�	_dt_setUp�_dt_tearDown)rfr�r�setUp�tearDownrr+r+r,r�iszDocTestCase.__init__cCs|j}|jdk	r|j|�dS)N)rarb)rfr�r+r+r,rdss
zDocTestCase.setUpcCs(|j}|jdk	r|j|�|jj�dS)N)rarcr0r;)rfr�r+r+r,reys

zDocTestCase.tearDowncCs�|j}tj}t�}|j}|t@s(|tO}t||jdd�}z$dd|_	|j
||jdd�\}}Wd|t_X|r~|j|j
|j����dS)NF)rrr�rr
)r�r>)rar=r�r#r_r
rZrr`rr?r2ZfailureException�format_failurer`)rfr�r[�newrrVrrr+r+r,�runTest�s
zDocTestCase.runTestcCsP|j}|jdkrd}n
d|j}dj|jjd�dd��}d|j|j|||fS)Nzunknown line numberz%sr}r&z:Failed doctest test for %s
  File "%s", line %s, in %s

%srm)rar�r�r*rorQ)rf�errr�r�Zlnamer+r+r,rf�s

zDocTestCase.format_failurecCs6|j�t|j|jdd�}|j|jdd�|j�dS)NF)rrr�)r>)rdrr_r`r?rare)rfrVr+r+r,r!�s
BzDocTestCase.debugcCs|jjS)N)rar*)rfr+r+r,r��szDocTestCase.idcCsPt|�t|�k	rtS|j|jkoN|j|jkoN|j|jkoN|j|jkoN|j|jkS)N)r�r�rar_rbrcr`)rfr�r+r+r,r��szDocTestCase.__eq__cCst|j|j|j|jf�S)N)r�r_rbrcr`)rfr+r+r,r��szDocTestCase.__hash__cCs,|jjjd�}d|ddj|dd��fS)Nr}z%s (%s)r&rmrm)rar*ror�)rfr*r+r+r,r��szDocTestCase.__repr__cCsd|jjS)Nz	Doctest: )rar*)rfr+r+r,�shortDescription	szDocTestCase.shortDescription)r"NNN)r5rkrlr�rdrerhrfr!r�r�r�r�rPrjr+r+r+r,r\gs
	H
r\c@s0eZdZdd�Zdd�Zdd�Zdd�ZeZd	S)
�SkipDocTestCasecCs||_tj|d�dS)N)rBr\r�)rfrBr+r+r,r�	szSkipDocTestCase.__init__cCs|jd�dS)Nz-DocTestSuite will not work with -O2 and above)ZskipTest)rfr+r+r,rd	szSkipDocTestCase.setUpcCsdS)Nr+)rfr+r+r,�	test_skip	szSkipDocTestCase.test_skipcCsd|jjS)NzSkipping tests from %s)rBr5)rfr+r+r,rj	sz SkipDocTestCase.shortDescriptionN)r5rkrlr�rdrlrjrPr+r+r+r,rk	s
rkc@seZdZdd�ZdS)�
_DocTestSuitecCsdS)Nr+)rf�indexr+r+r,�_removeTestAtIndex	sz _DocTestSuite._removeTestAtIndexN)r5rkrlror+r+r+r,rm	srmc	Ks�|dkrt�}t|�}|j|||d�}|rPtjjdkrPt�}|jt|��|S|j	�t�}x\|D]T}t
|j�dkrxqd|js�|j
}|dd�dkr�|dd�}||_|jt|f|��qdW|S)	N)r0r�r3r"rVz.pycr&rrm)rrCrqr=r1�optimizerm�addTestrkr�r)r�rQr�r\)	rBr0r�Ztest_finderr�r��suiter�rQr+r+r,r	s(%
c@s(eZdZdd�Zdd�ZeZdd�ZdS)�DocFileCasecCsdj|jjjd��S)Nr=r})r�rar*ro)rfr+r+r,r�`	szDocFileCase.idcCs|jjS)N)rarQ)rfr+r+r,r�c	szDocFileCase.__repr__cCsd|jj|jj|fS)Nz2Failed doctest test for %s
  File "%s", line 0

%s)rar*rQ)rfrir+r+r,rfg	szDocFileCase.format_failureN)r5rkrlr�r�rPrfr+r+r+r,rs^	srsc
Ksx|dkri}n|j�}|r(|r(td��t||||p6d�\}}d|krN||d<tjj|�}|j||||d�}	t|	f|�S)Nz8Package may only be specified for module-relative paths.zutf-8r�r")r�r�rUrMr�rWr�rs)
r�rSrRr0r�rHr��docr*r�r+r+r,�DocFileTestl	s
rucOsHt�}|jdd�r$t|jd��|d<x|D]}|jt|f|��q*W|S)NrSTrR)rmr.rCrqru)�paths�kwrrr�r+r+r,r�	s8
cCs�g}x�t�j|�D]x}t|t�rj|j|jdd	��|j}|r�|jd�|dd�|jd�dd
�D�7}q|dd�|jd�dd�D�7}qWx|r�|ddkr�|j�q�Wx|r�|ddkr�|jd�q�Wdj	|�dS)
Nr&z# Expected:cSsg|]}d|�qS)z## r+)r�r�r+r+r,r�
sz(script_from_examples.<locals>.<listcomp>rGcSsg|]}t|��qSr+)r{)r�r�r+r+r,r�
srxr"rmrmrmrm)
rr�r8rr�r�rrro�popr�)rZr�Zpiecerrr+r+r,r�	s:

"csJt|�}t�j|�}�fdd�|D�}|s4t�d��|d}t|j�}|S)Ncsg|]}|j�kr|�qSr+)r*)r�r')r*r+r,r�*
sztestsource.<locals>.<listcomp>znot found in testsr")rCrrqr�rr�)rBr*r�r��testsrcr+)r*r,r!
s

cCst|�}t|||�dS)N)r�debug_script)�src�pmr0ryr+r+r,r 1
sc
Cs�ddl}|r|j�}ni}|rvyt|||�Wq�ttj�d�|jdd�}|j�|jdtj�d�Yq�Xn|jdd�j	d|||�dS)Nr"r&T)r�r3zexec(%r))
r�r�rr�r=rar�r5Zinteractionr?)r{r|r0r��pr+r+r,rz6
s
rzcCs$t|�}t||�}t|||j�dS)N)rCrrzr�)rBr*r|ryr+r+r,r!J
s
c@s$eZdZdd�Zdd�Zdd�ZdS)�
_TestClasscCs
||_dS)N)r�)rfr�r+r+r,r�f
sz_TestClass.__init__cCs|jd|_|S)Nr3)r�)rfr+r+r,�squarep
sz_TestClass.squarecCs|jS)N)r�)rfr+r+r,r.z
sz_TestClass.getN)r5rkrlr�rr.r+r+r+r,r~X
s

r~z�
                      Example of a string object, searched as-is.
                      >>> x = 1; y = 2
                      >>> x + y, x * y
                      (3, 2)
                      a�
                                    In 2.2, boolean expressions displayed
                                    0 or 1.  By default, we still accept
                                    them.  This can be disabled by passing
                                    DONT_ACCEPT_TRUE_FOR_1 to the new
                                    optionflags argument.
                                    >>> 4 == 4
                                    1
                                    >>> 4 == 4
                                    True
                                    >>> 4 > 4
                                    0
                                    >>> 4 > 4
                                    False
                                    z�
                Blank lines can be marked with <BLANKLINE>:
                    >>> print('foo\n\nbar\n')
                    foo
                    <BLANKLINE>
                    bar
                    <BLANKLINE>
            z�
                If the ellipsis flag is used, then '...' can be used to
                elide substrings in the desired output:
                    >>> print(list(range(1000))) #doctest: +ELLIPSIS
                    [0, 1, 2, ..., 999]
            a�
                If the whitespace normalization flag is used, then
                differences in whitespace are ignored.
                    >>> print(list(range(30))) #doctest: +NORMALIZE_WHITESPACE
                    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
                     15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
                     27, 28, 29]
            )r~r�zbool-int equivalencezblank linesZellipsiszwhitespace normalizationcCs tjdd�}|jdddddd�|jd	d
dtj�gdd
�|jddddd�|jdddd�|j�}|j}|j}d}x|jD]}|t|O}q|W|j	r�|t
O}x||D]t}|jd�r�tj
j|�\}}tj
jd|�t|dd��}tj
d=t|||d�\}	}
nt|d||d�\}	}
|	r�dSq�WdS)Nzdoctest runner)Zdescriptionz-vz	--verbose�
store_trueFz'print very verbose output for all tests)�action�default�helpz-oz--optionr�zqspecify a doctest option flag to apply to the test run; may be specified more than once to apply multiple options)r��choicesr�r�z-fz--fail-fastzystop running tests after first failure (this is a shorthand for -o FAIL_FAST, and is in addition to any other -o options))r�r�r]r�z file containing the tests to run)�nargsr�r"z.pyrD)r�r)rSr�rr&���)�argparse�ArgumentParser�add_argumentr'�keys�
parse_argsr]r�r�Z	fail_fastrrerMr�ror=�insertr:rr)r�r�Z	testfilesr�r�r�rQ�dirnamer�rr=r+r+r,�_test�
s<



r�r�)r3)rV)	NNNNTr"NFF)FrYNr")NNNN)FN)FN)F)RZ
__docformat__�__all__r-r�rNr6r�rMr�rXr=r^r]�ior#�collectionsr$r%r'rrrrrrrrr	r
rrrr
rKrnr2rCrUr\rcrdrwr{r�r�r�rIrrrrrr�	ExceptionrrrrRrrrrZrr^r\rkZ	TestSuitermrrsrurrrr rzr!r~r�r�r5�exitr+r+r+r,�<module>0s


1%.DKl;;n
fx
$!
@IR


,		+
configparser.cpython-36.opt-1.pyc000064400000130276150335715140012630 0ustar003


 \X��@s�dZddlmZddlmZmZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddddd	d
ddd
ddddddddddddgZdZdZGdd�de�ZGdd�de�ZGdd�de�ZGd d�de�ZGd!d�de�ZGd"d	�d	e�ZGd#d�de�ZGd$d�de�ZGd%d
�d
e�ZGd&d
�d
e�ZGd'd�de�Ze�ZGd(d�d�Z Gd)d�de �Z!Gd*d�de �Z"Gd+d�de �Z#Gd,d�de�Z$Gd-d�de$�Z%Gd.d�de%�Z&Gd/d�de�Z'Gd0d�de�Z(dS)1a�Configuration file parser.

A configuration file consists of sections, lead by a "[section]" header,
and followed by "name: value" entries, with continuations and such in
the style of RFC 822.

Intrinsic defaults can be specified by passing them into the
ConfigParser constructor as a dictionary.

class:

ConfigParser -- responsible for parsing a list of
                    configuration files, and managing the parsed database.

    methods:

    __init__(defaults=None, dict_type=_default_dict, allow_no_value=False,
             delimiters=('=', ':'), comment_prefixes=('#', ';'),
             inline_comment_prefixes=None, strict=True,
             empty_lines_in_values=True, default_section='DEFAULT',
             interpolation=<unset>, converters=<unset>):
        Create the parser. When `defaults' is given, it is initialized into the
        dictionary or intrinsic defaults. The keys must be strings, the values
        must be appropriate for %()s string interpolation.

        When `dict_type' is given, it will be used to create the dictionary
        objects for the list of sections, for the options within a section, and
        for the default values.

        When `delimiters' is given, it will be used as the set of substrings
        that divide keys from values.

        When `comment_prefixes' is given, it will be used as the set of
        substrings that prefix comments in empty lines. Comments can be
        indented.

        When `inline_comment_prefixes' is given, it will be used as the set of
        substrings that prefix comments in non-empty lines.

        When `strict` is True, the parser won't allow for any section or option
        duplicates while reading from a single source (file, string or
        dictionary). Default is True.

        When `empty_lines_in_values' is False (default: True), each empty line
        marks the end of an option. Otherwise, internal empty lines of
        a multiline option are kept as part of the value.

        When `allow_no_value' is True (default: False), options without
        values are accepted; the value presented for these is None.

        When `default_section' is given, the name of the special section is
        named accordingly. By default it is called ``"DEFAULT"`` but this can
        be customized to point to any other valid section name. Its current
        value can be retrieved using the ``parser_instance.default_section``
        attribute and may be modified at runtime.

        When `interpolation` is given, it should be an Interpolation subclass
        instance. It will be used as the handler for option value
        pre-processing when using getters. RawConfigParser object s don't do
        any sort of interpolation, whereas ConfigParser uses an instance of
        BasicInterpolation. The library also provides a ``zc.buildbot``
        inspired ExtendedInterpolation implementation.

        When `converters` is given, it should be a dictionary where each key
        represents the name of a type converter and each value is a callable
        implementing the conversion from string to the desired datatype. Every
        converter gets its corresponding get*() method on the parser object and
        section proxies.

    sections()
        Return all the configuration section names, sans DEFAULT.

    has_section(section)
        Return whether the given section exists.

    has_option(section, option)
        Return whether the given option exists in the given section.

    options(section)
        Return list of configuration options for the named section.

    read(filenames, encoding=None)
        Read and parse the iterable of named configuration files, given by
        name.  A single filename is also allowed.  Non-existing files
        are ignored.  Return list of successfully read files.

    read_file(f, filename=None)
        Read and parse one configuration file, given as a file object.
        The filename defaults to f.name; it is only used in error
        messages (if f has no `name' attribute, the string `<???>' is used).

    read_string(string)
        Read configuration from a given string.

    read_dict(dictionary)
        Read configuration from a dictionary. Keys are section names,
        values are dictionaries with keys and values that should be present
        in the section. If the used dictionary type preserves order, sections
        and their keys will be added in order. Values are automatically
        converted to strings.

    get(section, option, raw=False, vars=None, fallback=_UNSET)
        Return a string value for the named option.  All % interpolations are
        expanded in the return values, based on the defaults passed into the
        constructor and the DEFAULT section.  Additional substitutions may be
        provided using the `vars' argument, which must be a dictionary whose
        contents override any pre-existing defaults. If `option' is a key in
        `vars', the value from `vars' is used.

    getint(section, options, raw=False, vars=None, fallback=_UNSET)
        Like get(), but convert value to an integer.

    getfloat(section, options, raw=False, vars=None, fallback=_UNSET)
        Like get(), but convert value to a float.

    getboolean(section, options, raw=False, vars=None, fallback=_UNSET)
        Like get(), but convert value to a boolean (currently case
        insensitively defined as 0, false, no, off for False, and 1, true,
        yes, on for True).  Returns False or True.

    items(section=_UNSET, raw=False, vars=None)
        If section is given, return a list of tuples with (name, value) for
        each option in the section. Otherwise, return a list of tuples with
        (section_name, section_proxy) for each section, including DEFAULTSECT.

    remove_section(section)
        Remove the given file section and all its options.

    remove_option(section, option)
        Remove the given option from the given section.

    set(section, option, value)
        Set the given option.

    write(fp, space_around_delimiters=True)
        Write the configuration state in .ini format. If
        `space_around_delimiters' is True (the default), delimiters
        between keys and values are surrounded by spaces.
�)�MutableMapping)�OrderedDict�ChainMapN�NoSectionError�DuplicateOptionError�DuplicateSectionError�
NoOptionError�InterpolationError�InterpolationDepthError�InterpolationMissingOptionError�InterpolationSyntaxError�ParsingError�MissingSectionHeaderError�ConfigParser�SafeConfigParser�RawConfigParser�
Interpolation�BasicInterpolation�ExtendedInterpolation�LegacyInterpolation�SectionProxy�ConverterMapping�DEFAULTSECT�MAX_INTERPOLATION_DEPTHZDEFAULT�
c@s&eZdZdZddd�Zdd�ZeZdS)	�Errorz'Base class for ConfigParser exceptions.�cCs||_tj||�dS)N)�message�	Exception�__init__)�self�msg�r"�$/usr/lib64/python3.6/configparser.pyr�szError.__init__cCs|jS)N)r)r r"r"r#�__repr__�szError.__repr__N)r)�__name__�
__module__�__qualname__�__doc__rr$�__str__r"r"r"r#r�s
rc@seZdZdZdd�ZdS)rz2Raised when no section matches a requested option.cCs$tj|d|f�||_|f|_dS)NzNo section: %r)rr�section�args)r r*r"r"r#r�szNoSectionError.__init__N)r%r&r'r(rr"r"r"r#r�sc@seZdZdZddd�ZdS)raRaised when a section is repeated in an input source.

    Possible repetitions that raise this exception are: multiple creation
    using the API or in strict parsers when a section is found more than once
    in a single input file, string or dictionary.
    NcCs�t|�dg}|dk	rRdt|�g}|dk	r8|jdj|��|jd�|j|�|}n|jdd�tj|dj|��||_||_	||_
|||f|_dS)Nz already existszWhile reading from z [line {0:2d}]z
: section rzSection r)�repr�append�format�extend�insertrr�joinr*�source�linenor+)r r*r2r3r!rr"r"r#r�s

zDuplicateSectionError.__init__)NN)r%r&r'r(rr"r"r"r#r�sc@seZdZdZddd�ZdS)rz�Raised by strict parsers when an option is repeated in an input source.

    Current implementation raises this exception only when an option is found
    more than once in a single file, string or dictionary.
    NcCs�t|�dt|�dg}|dk	rZdt|�g}|dk	r@|jdj|��|jd�|j|�|}n|jdd�tj|dj|��||_||_	||_
||_||||f|_dS)	Nz in section z already existszWhile reading from z [line {0:2d}]z	: option rzOption r)
r,r-r.r/r0rrr1r*�optionr2r3r+)r r*r4r2r3r!rr"r"r#r�s 

zDuplicateOptionError.__init__)NN)r%r&r'r(rr"r"r"r#r�sc@seZdZdZdd�ZdS)rz!A requested option was not found.cCs.tj|d||f�||_||_||f|_dS)NzNo option %r in section: %r)rrr4r*r+)r r4r*r"r"r#r�s
zNoOptionError.__init__N)r%r&r'r(rr"r"r"r#r�sc@seZdZdZdd�ZdS)r	z0Base class for interpolation-related exceptions.cCs(tj||�||_||_|||f|_dS)N)rrr4r*r+)r r4r*r!r"r"r#rszInterpolationError.__init__N)r%r&r'r(rr"r"r"r#r	�sc@seZdZdZdd�ZdS)rzAA string substitution required a setting which was not available.cCs8dj||||�}tj||||�||_||||f|_dS)Nz�Bad value substitution: option {!r} in section {!r} contains an interpolation key {!r} which is not a valid option name. Raw value: {!r})r.r	r�	referencer+)r r4r*�rawvalr5r!r"r"r#r
s
z(InterpolationMissingOptionError.__init__N)r%r&r'r(rr"r"r"r#rsc@seZdZdZdS)rz�Raised when the source text contains invalid syntax.

    Current implementation raises this exception when the source text into
    which substitutions are made does not conform to the required syntax.
    N)r%r&r'r(r"r"r"r#rsc@seZdZdZdd�ZdS)r
z0Raised when substitutions are nested too deeply.cCs0dj||t|�}tj||||�|||f|_dS)Nz�Recursion limit exceeded in value substitution: option {!r} in section {!r} contains an interpolation key which cannot be substituted in {} steps. Raw value: {!r})r.rr	rr+)r r4r*r6r!r"r"r#rs
z InterpolationDepthError.__init__N)r%r&r'r(rr"r"r"r#r
sc@s<eZdZdZd
dd�Zedd��Zejdd��Zdd	�ZdS)r
z>Raised when a configuration file does not follow legal syntax.NcCsX|r|rtd��n|r(|r(td��n|r0|}tj|d|�||_g|_|f|_dS)Nz:Cannot specify both `filename' and `source'. Use `source'.z%Required argument `source' not given.z"Source contains parsing errors: %r)�
ValueErrorrrr2�errorsr+)r r2�filenamer"r"r#r+s

zParsingError.__init__cCstjdtdd�|jS)zDeprecated, use `source'.zSThe 'filename' attribute will be removed in future versions.  Use 'source' instead.�)�
stacklevel)�warnings�warn�DeprecationWarningr2)r r"r"r#r9:s
zParsingError.filenamecCstjdtdd�||_dS)zDeprecated, user `source'.zSThe 'filename' attribute will be removed in future versions.  Use 'source' instead.r:)r;N)r<r=r>r2)r �valuer"r"r#r9Ds
cCs*|jj||f�|jd||f7_dS)Nz
	[line %2d]: %s)r8r-r)r r3�liner"r"r#r-NszParsingError.append)NN)	r%r&r'r(r�propertyr9�setterr-r"r"r"r#r
(s



c@seZdZdZdd�ZdS)rz@Raised when a key-value pair is found before any section header.cCs8tj|d|||f�||_||_||_|||f|_dS)Nz7File contains no section headers.
file: %r, line: %d
%r)rrr2r3r@r+)r r9r3r@r"r"r#rVsz"MissingSectionHeaderError.__init__N)r%r&r'r(rr"r"r"r#rSsc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)rzBDummy interpolation that passes the value through with no changes.cCs|S)Nr")r �parserr*r4r?�defaultsr"r"r#�
before_getjszInterpolation.before_getcCs|S)Nr")r rCr*r4r?r"r"r#�
before_setmszInterpolation.before_setcCs|S)Nr")r rCr*r4r?r"r"r#�before_readpszInterpolation.before_readcCs|S)Nr")r rCr*r4r?r"r"r#�before_writesszInterpolation.before_writeN)r%r&r'r(rErFrGrHr"r"r"r#rgs
c@s2eZdZdZejd�Zdd�Zdd�Zdd�Z	d	S)
ra!Interpolation as implemented in the classic ConfigParser.

    The option values can contain format strings which refer to other values in
    the same section, or values in the special default section.

    For example:

        something: %(dir)s/whatever

    would resolve the "%(dir)s" to the value of dir.  All reference
    expansions are done late, on demand. If a user needs to use a bare % in
    a configuration file, she can escape it by writing %%. Other % usage
    is considered a user error and raises `InterpolationSyntaxError'.z
%\(([^)]+)\)scCs$g}|j||||||d�dj|�S)N�r)�_interpolate_somer1)r rCr*r4r?rD�Lr"r"r#rE�szBasicInterpolation.before_getcCs<|jdd�}|jjd|�}d|kr8td||jd�f��|S)Nz%%r�%z1invalid interpolation syntax in %r at position %d)�replace�_KEYCRE�subr7�find)r rCr*r4r?�	tmp_valuer"r"r#rF�szBasicInterpolation.before_setcCsp|j||d|d�}|tkr&t|||���xB|�rj|jd�}	|	dkrP|j|�dS|	dkrv|j|d|	��||	d�}|dd�}
|
dkr�|jd�|dd�}q*|
dk�rV|jj|�}|dkr�t||d|��|j|j	d��}||j
�d�}y||}
Wn&tk
�r"t||||�d�YnXd|
k�rJ|j
||||
|||d�n
|j|
�q*t||d	|f��q*WdS)
NT)�raw�fallbackrLrrIr:�(z'bad interpolation variable reference %rz/'%%' must be followed by '%%' or '(', found: %r)�getrr
rPr-rN�matchr�optionxform�group�end�KeyErrorrrJ)r rCr4�accum�restr*�map�depthr6�p�c�m�var�vr"r"r#rJ�sF






z$BasicInterpolation._interpolate_someN)
r%r&r'r(�re�compilerNrErFrJr"r"r"r#rws


c@s2eZdZdZejd�Zdd�Zdd�Zdd�Z	d	S)
rzyAdvanced variant of interpolation, supports the syntax used by
    `zc.buildout'. Enables interpolation between sections.z
\$\{([^}]+)\}cCs$g}|j||||||d�dj|�S)NrIr)rJr1)r rCr*r4r?rDrKr"r"r#rE�sz ExtendedInterpolation.before_getcCs<|jdd�}|jjd|�}d|kr8td||jd�f��|S)Nz$$r�$z1invalid interpolation syntax in %r at position %d)rMrNrOr7rP)r rCr*r4r?rQr"r"r#rF�sz ExtendedInterpolation.before_setcCs�|j||d|d�}|tkr&t|||���x�|�r�|jd�}	|	dkrP|j|�dS|	dkrv|j|d|	��||	d�}|dd�}
|
dkr�|jd�|dd�}q*|
dk�r�|jj|�}|dkr�t||d|��|jd�j	d	�}||j
�d�}|}
|}yrt|�dk�r |j|d�}||}nHt|�dk�rV|d}
|j|d�}|j|
|dd
�}nt||d|f��Wn2t
ttfk
�r�t|||d	j|��d�YnXd|k�r�|j|||||
t|j|
dd
��|d�n
|j|�q*t||d|f��q*WdS)
NT)rRrSrfrrIr:�{z'bad interpolation variable reference %r�:)rRzMore than one ':' found: %rz-'$' must be followed by '$' or '{', found: %r)rUrr
rPr-rNrVrrX�splitrY�lenrWrZrrrr1rJ�dict�items)r rCr4r[r\r*r]r^r6r_r`ra�pathZsect�optrcr"r"r#rJ�s^







z'ExtendedInterpolation._interpolate_someN)
r%r&r'r(rdrerNrErFrJr"r"r"r#r�s

c@s6eZdZdZejd�Zdd�Zdd�Ze	dd��Z
d	S)
rz{Deprecated interpolation used in old versions of ConfigParser.
    Use BasicInterpolation or ExtendedInterpolation instead.z%\(([^)]*)\)s|.c
Cs�|}t}x�|r�|d8}|r�d|kr�tj|j|d�}|jj||�}y||}Wq�tk
r�}	zt||||	jd�d�WYdd}	~	Xq�Xq
Pq
W|r�d|kr�t	|||��|S)NrIz%()rCr)
r�	functools�partial�_interpolation_replacerNrOrZrr+r
)
r rCr*r4r?�varsr6r^rM�er"r"r#rEs"(zLegacyInterpolation.before_getcCs|S)Nr")r rCr*r4r?r"r"r#rF#szLegacyInterpolation.before_setcCs,|jd�}|dkr|j�Sd|j|�SdS)NrIz%%(%s)s)rXrW)rVrC�sr"r"r#rq&s
z*LegacyInterpolation._interpolation_replaceN)r%r&r'r(rdrerNrErF�staticmethodrqr"r"r"r#r	s

c
s.eZdZdZdZdZdZe�Ze	j
ee	j�Ze	j
ej
dd�e	j�Ze	j
ej
dd�e	j�Ze	j
d�Zddddd	d	d	d	d
�Zded	fdddedddeeed�dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdfdd�Zdgdd �Zdhd"d#�Zdid%d&�Zdjd'd(�Zd	ded)�d*d+�Z d,d-�Z!d	ded)�d.d/�Z"d	ded)�d0d1�Z#d	ded)�d2d3�Z$d	ded)�d4d5�Z%ed	df�fd6d7�	Z&d8d9�Z'd:d;�Z(d<d=�Z)dkd>d?�Z*dld@dA�Z+dBdC�Z,dDdE�Z-dFdG�Z.dHdI�Z/dJdK�Z0dLdM�Z1dNdO�Z2dPdQ�Z3dRdS�Z4dTdU�Z5dVdW�Z6dXdY�Z7dZd[�Z8d\d]�Z9d^d^d^d_�d`da�Z:e;dbdc��Z<�Z=S)mrz,ConfigParser that does not do interpolation.z�
        \[                                 # [
        (?P<header>[^]]+)                  # very permissive!
        \]                                 # ]
        a�
        (?P<option>.*?)                    # very permissive!
        \s*(?P<vi>{delim})\s*              # any number of space/tab,
                                           # followed by any of the
                                           # allowed delimiters,
                                           # followed by any space/tab
        (?P<value>.*)$                     # everything up to eol
        a�
        (?P<option>.*?)                    # very permissive!
        \s*(?:                             # any number of space/tab,
        (?P<vi>{delim})\s*                 # optionally followed by
                                           # any of the allowed
                                           # delimiters, followed by any
                                           # space/tab
        (?P<value>.*))?$                   # everything up to eol
        z=|:)�delimz\STF)�1�yes�trueZon�0�noZfalseZoffN�=rh�#�;)�
delimiters�comment_prefixes�inline_comment_prefixes�strict�empty_lines_in_values�default_section�
interpolation�
converterscCsX||_|j�|_|j�|_t|�|_|j�|_t||	�|j|	<|rhx$|j�D]\}}
|
|j|j|�<qLWt	|�|_
|dkr�|r�|jn|j|_
nNdjdd�|D��}|r�tj|jj|d�tj�|_
ntj|jj|d�tj�|_
t	|p�f�|_t	|p�f�|_||_||_||_|	|_|
|_|jtk�r*|j|_|jdk�r>t�|_|tk	�rT|jj|�dS)Nr|rh�|css|]}tj|�VqdS)N)rd�escape)�.0�dr"r"r#�	<genexpr>lsz+RawConfigParser.__init__.<locals>.<genexpr>)rv)r|rh) �_dict�	_sections�	_defaultsr�_converters�_proxiesrrlrW�tuple�_delimiters�	OPTCRE_NV�OPTCRE�_optcrer1rdre�_OPT_NV_TMPLr.�VERBOSE�	_OPT_TMPL�_comment_prefixes�_inline_comment_prefixes�_strict�_allow_no_value�_empty_lines_in_valuesr��_interpolation�_UNSET�_DEFAULT_INTERPOLATIONr�update)r rDZ	dict_typeZallow_no_valuerr�r�r�r�r�r�r��keyr?r�r"r"r#rXs>






zRawConfigParser.__init__cCs|jS)N)r�)r r"r"r#rD�szRawConfigParser.defaultscCst|jj��S)z3Return a list of section names, excluding [DEFAULT])�listr��keys)r r"r"r#�sections�szRawConfigParser.sectionscCsJ||jkrtd|��||jkr(t|��|j�|j|<t||�|j|<dS)z�Create a new section in the configuration.

        Raise DuplicateSectionError if a section by the specified name
        already exists. Raise ValueError if name is DEFAULT.
        zInvalid section name: %rN)r�r7r�rr�rr�)r r*r"r"r#�add_section�s

zRawConfigParser.add_sectioncCs
||jkS)z~Indicate whether the named section is present in the configuration.

        The DEFAULT section is not acknowledged.
        )r�)r r*r"r"r#�has_section�szRawConfigParser.has_sectioncCsJy|j|j�}Wntk
r0t|�d�YnX|j|j�t|j��S)z9Return a list of option names for the given section name.N)r��copyrZrr�r�r�r�)r r*Zoptsr"r"r#�options�szRawConfigParser.optionscCs�t|ttjf�r|g}g}xl|D]d}y(t||d��}|j||�WdQRXWntk
rbw YnXt|tj�rztj|�}|j|�q W|S)a�Read and parse a filename or an iterable of filenames.

        Files that cannot be opened are silently ignored; this is
        designed so that you can specify an iterable of potential
        configuration file locations (e.g. current directory, user's
        home directory, systemwide directory), and all existing
        configuration files in the iterable will be read.  A single
        filename may also be given.

        Return list of successfully read files.
        )�encodingN)	�
isinstance�str�os�PathLike�open�_read�OSError�fspathr-)r �	filenamesr�Zread_okr9�fpr"r"r#�read�s

zRawConfigParser.readcCs<|dkr,y
|j}Wntk
r*d}YnX|j||�dS)aPLike read() but the argument must be a file-like object.

        The `f' argument must be iterable, returning one line at a time.
        Optional second argument is the `source' specifying the name of the
        file being read. If not given, it is taken from f.name. If `f' has no
        `name' attribute, `<???>' is used.
        Nz<???>)�name�AttributeErrorr�)r �fr2r"r"r#�	read_file�s

zRawConfigParser.read_file�<string>cCstj|�}|j||�dS)z'Read configuration from a given string.N)�io�StringIOr�)r �stringr2Zsfiler"r"r#�read_string�s
zRawConfigParser.read_string�<dict>cCs�t�}x�|j�D]�\}}t|�}y|j|�Wn(ttfk
rV|jrR||krR�YnX|j|�xl|j�D]`\}}|jt|��}|dk	r�t|�}|jr�||f|kr�t	|||��|j||f�|j|||�qlWqWdS)aRead configuration from a dictionary.

        Keys are section names, values are dictionaries with keys and values
        that should be present in the section. If the used dictionary type
        preserves order, sections and their keys will be added in order.

        All types held in the dictionary are converted to strings during
        reading, including section names, option names and keys.

        Optional second argument is the `source' specifying the name of the
        dictionary being read.
        N)
�setrlr�r�rr7r��addrWr)r Z
dictionaryr2�elements_addedr*r�r�r?r"r"r#�	read_dict�s"

zRawConfigParser.read_dictcCs"tjdtdd�|j||d�dS)z"Deprecated, use read_file instead.zRThis method will be removed in future versions.  Use 'parser.read_file()' instead.r:)r;)r2N)r<r=r>r�)r r�r9r"r"r#�readfp�s
zRawConfigParser.readfp)rRrrrScCs�y|j||�}Wn$tk
r4|tkr,�n|SYnX|j|�}y||}Wn,tk
rx|tkrpt||��n|SYnX|s�|dkr�|S|jj|||||�SdS)a]Get an option value for a given section.

        If `vars' is provided, it must be a dictionary. The option is looked up
        in `vars' (if provided), `section', and in `DEFAULTSECT' in that order.
        If the key is not found and `fallback' is provided, it is used as
        a fallback value. `None' can be provided as a `fallback' value.

        If interpolation is enabled and the optional argument `raw' is False,
        all interpolations are expanded in the return values.

        Arguments `raw', `vars', and `fallback' are keyword only.

        The section DEFAULT is special.
        N)�
_unify_valuesrr�rWrZrr�rE)r r*r4rRrrrSr�r?r"r"r#rU�s"


zRawConfigParser.getcKs||j||f|��S)N)rU)r r*�convr4�kwargsr"r"r#�_get"szRawConfigParser._getcKsDy|j|||f||d�|��Sttfk
r>|tkr:�|SXdS)N)rRrr)r�rrr�)r r*r4r�rRrrrSr�r"r"r#�	_get_conv%szRawConfigParser._get_convcKs|j||tf|||d�|��S)N)rRrrrS)r��int)r r*r4rRrrrSr�r"r"r#�getint0szRawConfigParser.getintcKs|j||tf|||d�|��S)N)rRrrrS)r��float)r r*r4rRrrrSr�r"r"r#�getfloat5szRawConfigParser.getfloatcKs |j|||jf|||d�|��S)N)rRrrrS)r��_convert_to_boolean)r r*r4rRrrrSr�r"r"r#�
getboolean:szRawConfigParser.getbooleanc
s��tkrt�j�S�jj��y�j�j��Wn&tk
rV��jkrRt	���YnX|r�x"|j�D]\}}|��j
|�<qfW���fdd��|r��fdd���fdd��j�D�S)a�Return a list of (name, value) tuples for each option in a section.

        All % interpolations are expanded in the return values, based on the
        defaults passed into the constructor, unless the optional argument
        `raw' is true.  Additional substitutions may be provided using the
        `vars' argument, which must be a dictionary whose contents overrides
        any pre-existing defaults.

        The section DEFAULT is special.
        cs�jj��|�|��S)N)r�rE)r4)r�r*r r"r#�<lambda>Vsz'RawConfigParser.items.<locals>.<lambda>cs�|S)Nr")r4)r�r"r#r�Yscsg|]}|�|�f�qSr"r")r�r4)�value_getterr"r#�
<listcomp>Zsz)RawConfigParser.items.<locals>.<listcomp>)r��superrlr�r�r�r�rZr�rrWr�)r r*rRrrr�r?)�	__class__)r�r*r r�r#rl?s


zRawConfigParser.itemscCs.x$|j�D]}||}||=||fSWt�dS)z�Remove a section from the parser and return it as
        a (section_name, section_proxy) tuple. If no section is present, raise
        KeyError.

        The section DEFAULT is never returned because it cannot be removed.
        N)r�rZ)r r�r?r"r"r#�popitem\s

zRawConfigParser.popitemcCs|j�S)N)�lower)r Z	optionstrr"r"r#rWiszRawConfigParser.optionxformcCsX|s||jkr$|j|�}||jkS||jkr2dS|j|�}||j|kpR||jkSdS)z�Check for the existence of a given option in a given section.
        If the specified `section' is None or an empty string, DEFAULT is
        assumed. If the specified `section' does not exist, returns False.FN)r�rWr�r�)r r*r4r"r"r#�
has_optionls



zRawConfigParser.has_optioncCsn|r|jj||||�}|s&||jkr.|j}n.y|j|}Wntk
rZt|�d�YnX|||j|�<dS)zSet an option.N)r�rFr�r�r�rZrrW)r r*r4r?�sectdictr"r"r#r�zszRawConfigParser.setcCsl|rdj|jd�}n
|jd}|jr>|j||j|jj�|�x(|jD]}|j|||j|j�|�qFWdS)z�Write an .ini-format representation of the configuration state.

        If `space_around_delimiters' is True (the default), delimiters
        between keys and values are surrounded by spaces.
        z {} rN)r.r�r��_write_sectionr�rlr�)r r�Zspace_around_delimitersr�r*r"r"r#�write�s

zRawConfigParser.writecCs~|jdj|��x^|D]V\}}|jj||||�}|dk	s@|jrV|t|�jdd�}nd}|jdj||��qW|jd�dS)z-Write a single section to the specified `fp'.z[{}]
N�
z
	rz{}{}
)r�r.r�rHr�r�rM)r r�Zsection_nameZ
section_itemsZ	delimiterr�r?r"r"r#r��szRawConfigParser._write_sectioncCsf|s||jkr|j}n.y|j|}Wntk
rDt|�d�YnX|j|�}||k}|rb||=|S)zRemove an option.N)r�r�r�rZrrW)r r*r4r��existedr"r"r#�
remove_option�s
zRawConfigParser.remove_optioncCs"||jk}|r|j|=|j|=|S)zRemove a file section.)r�r�)r r*r�r"r"r#�remove_section�s

zRawConfigParser.remove_sectioncCs(||jkr|j|�rt|��|j|S)N)r�r�rZr�)r r�r"r"r#�__getitem__�szRawConfigParser.__getitem__cCs@||jkr|jj�n||jkr.|j|j�|j||i�dS)N)r�r��clearr�r�)r r�r?r"r"r#�__setitem__�s


zRawConfigParser.__setitem__cCs2||jkrtd��|j|�s$t|��|j|�dS)Nz"Cannot remove the default section.)r�r7r�rZr�)r r�r"r"r#�__delitem__�s


zRawConfigParser.__delitem__cCs||jkp|j|�S)N)r�r�)r r�r"r"r#�__contains__�szRawConfigParser.__contains__cCst|j�dS)NrI)rjr�)r r"r"r#�__len__�szRawConfigParser.__len__cCstj|jf|jj��S)N)�	itertools�chainr�r�r�)r r"r"r#�__iter__�szRawConfigParser.__iter__cCs2t�}d}d}d}d}d}d}	�x�t|dd�D�]�\}}
tj}dd�|jD�}x||tjkr�|r�i}
x`|j�D]T\}}|
j||d�}|dkr�ql||
|<|dks�|dkrl|
|dj�rlt||�}qlW|
}qPWx"|j	D]}|
j
�j|�r�d}Pq�W|tjk�rd}|
d|�j
�}|�s^|j�rV|dk�r\|dk	�r\|�r\||dk	�r\||j
d�q.tj}q.|jj|
�}|�rx|j�nd}|dk	�r�|�r�||k�r�||j
|�q.|}|jj|�}|�rL|jd�}||jk�r|j�r�||k�r�t|||��|j|}|j|�n@||jk�r|j}n,|j�}||j|<t||�|j|<|j|�d}q.|dk�rdt|||
��q.|jj|�}|�r|jd	d
d�\}}}|�s�|j|	|||
�}	|j |j!��}|j�r�||f|k�r�t"||||��|j||f�|dk	�r�|j
�}|g||<nd||<q.|j|	|||
�}	q.W|j#�|	�r.|	�dS)
aParse a sectioned configuration file.

        Each section in a configuration file contains a header, indicated by
        a name in square brackets (`[]'), plus key/value options, indicated by
        `name' and `value' delimited with a specific substring (`=' or `:' by
        default).

        Values can span multiple lines, as long as they are indented deeper
        than the first line of the value. Depending on the parser's mode, blank
        lines may be treated as parts of multiline values or ignored.

        Configuration files may include comments, prefixed by specific
        characters (`#' and `;' by default). Comments may appear on their own
        in an otherwise empty line or may be entered in lines holding values or
        section names.
        NrrI)�startcSsi|]
}d|�qS)rI���r")r�r_r"r"r#�
<dictcomp>�sz)RawConfigParser._read.<locals>.<dictcomp>r�headerr4�vir?r�)$r��	enumerate�sys�maxsizer�rlrP�isspace�minr��strip�
startswithr�r-�NONSPACECRE�searchr��SECTCRErVrXr�r�rr�r�r�r�rr�rr��
_handle_errorrW�rstripr�_join_multiline_values)r r��fpnamer�ZcursectZsectnameZoptnamer3Zindent_levelrsr@Z
comment_startZinline_prefixesZ
next_prefixes�prefix�indexr?Zfirst_nonspaceZcur_indent_levelZmor�Zoptvalr"r"r#r��s� 









zRawConfigParser._readcCsz|j|jf}tj|f|jj��}xT|D]L\}}xB|j�D]6\}}t|t�rXdj|�j	�}|j
j||||�||<q8Wq&WdS)Nr�)r�r�r�r�r�rlr�r�r1r�r�rG)r rDZall_sectionsr*r�r��valr"r"r#r�Ys
z&RawConfigParser._join_multiline_valuescCs |st|�}|j|t|��|S)N)r
r-r,)r �excr�r3r@r"r"r#r�eszRawConfigParser._handle_errorc
Cs�i}y|j|}Wn&tk
r8||jkr4t|��YnXi}|rvx2|j�D]&\}}|dk	rdt|�}|||j|�<qLWt|||j�S)z�Create a sequence of lookups with 'vars' taking priority over
        the 'section' which takes priority over the DEFAULTSECT.

        N)	r�rZr�rrlr�rW�	_ChainMapr�)r r*rrZsectiondictZvardictr�r?r"r"r#r�ks
zRawConfigParser._unify_valuescCs(|j�|jkrtd|��|j|j�S)zJReturn a boolean value translating from other types if necessary.
        zNot a boolean: %s)r��BOOLEAN_STATESr7)r r?r"r"r#r�sz#RawConfigParser._convert_to_booleanr)r*r4r?cCsFt|t�std��t|t�s$td��|js0|rBt|t�sBtd��dS)a�Raises a TypeError for non-string values.

        The only legal non-string value if we allow valueless
        options is None, so we need to check if the value is a
        string if:
        - we do not allow valueless options, or
        - we allow valueless options but the value is not None

        For compatibility reasons this method is not used in classic set()
        for RawConfigParsers. It is invoked in every case for mapping protocol
        access and in ConfigParser.set().
        zsection names must be stringszoption keys must be stringszoption values must be stringsN)r�r��	TypeErrorr�)r r*r4r?r"r"r#�_validate_value_types�s


z%RawConfigParser._validate_value_typescCs|jS)N)r�)r r"r"r#r��szRawConfigParser.converters)r|rh)r}r~)N)N)r�)r�)N)N)T)>r%r&r'r(Z
_SECT_TMPLr�r�rr�rdrer�r�r.r�r�r�r�
_default_dictrr�rrDr�r�r�r�r�r�r�r�r�rUr�r�r�r�r�rlr�rWr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrAr��
__classcell__r"r")r�r#r/sv	
$	




	%




zcs4eZdZdZe�Zd�fdd�	Z�fdd�Z�ZS)rz(ConfigParser implementing interpolation.Ncs"|j||d�t�j|||�dS)zmSet an option.  Extends RawConfigParser.set by validating type and
        interpolation syntax on the value.)r4r?N)rr�r�)r r*r4r?)r�r"r#r��szConfigParser.setcs|j|d�t�j|�dS)z�Create a new section in the configuration.  Extends
        RawConfigParser.add_section by validating if the section name is
        a string.)r*N)rr�r�)r r*)r�r"r#r��szConfigParser.add_section)N)	r%r&r'r(rr�r�r�rr"r")r�r#r�scs eZdZdZ�fdd�Z�ZS)rz8ConfigParser alias for backwards compatibility purposes.cs"t�j||�tjdtdd�dS)Nz�The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.r:)r;)r�rr<r=r>)r r+r�)r�r"r#r�szSafeConfigParser.__init__)r%r&r'r(rrr"r")r�r#r�sc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Ze
dd��Ze
dd��Zddddd�dd�ZdS)rz+A proxy for a single section from a parser.cCsJ||_||_x8|jD].}d|}tj|jt||�d�}t|||�qWdS)z@Creates a view on a section of the specified `name` in `parser`.rU)�_implN)�_parser�_namer�rorprU�getattr�setattr)r rCr�r�r��getterr"r"r#r�szSectionProxy.__init__cCsdj|j�S)Nz
<Section: {}>)r.r)r r"r"r#r$�szSectionProxy.__repr__cCs(|jj|j|�st|��|jj|j|�S)N)rr�rrZrU)r r�r"r"r#r��szSectionProxy.__getitem__cCs"|jj||d�|jj|j||�S)N)r4r?)rrr�r)r r�r?r"r"r#r��szSectionProxy.__setitem__cCs,|jj|j|�o|jj|j|�s(t|��dS)N)rr�rr�rZ)r r�r"r"r#r��szSectionProxy.__delitem__cCs|jj|j|�S)N)rr�r)r r�r"r"r#r��szSectionProxy.__contains__cCst|j��S)N)rj�_options)r r"r"r#r��szSectionProxy.__len__cCs|j�j�S)N)rr�)r r"r"r#r��szSectionProxy.__iter__cCs*|j|jjkr|jj|j�S|jj�SdS)N)rrr�r�rD)r r"r"r#r�szSectionProxy._optionscCs|jS)N)r)r r"r"r#rC�szSectionProxy.parsercCs|jS)N)r)r r"r"r#r��szSectionProxy.nameNF)rRrrrcKs(|s|jj}||j|f|||d�|��S)z�Get an option value.

        Unless `fallback` is provided, `None` will be returned if the option
        is not found.

        )rRrrrS)rrUr)r r4rSrRrrrr�r"r"r#rU�s
zSectionProxy.get)N)r%r&r'r(rr$r�r�r�r�r�r�rrArCr�rUr"r"r"r#r�s	c@sJeZdZdZejd�Zdd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�ZdS)ra/Enables reuse of get*() methods between the parser and section proxies.

    If a parser class implements a getter directly, the value for the given
    key will be ``None``. The presence of the converter name here enables
    section proxies to find and use the implementation on the parser class.
    z^get(?P<name>.+)$cCsZ||_i|_xHt|j�D]:}|jj|�}|stt|j|��rBqd|j|jd�<qWdS)Nr�)r�_data�dir�	GETTERCRErV�callablerrX)r rCr
rar"r"r#rszConverterMapping.__init__cCs
|j|S)N)r)r r�r"r"r#r�szConverterMapping.__getitem__c
Cs�yd|}Wn(tk
r4tdj|t|����YnX|dkrFtd��||j|<tj|jj|d�}||_	t
|j||�x.|jj�D] }tj|j|d�}t
|||�q�WdS)NrUzIncompatible key: {} (type: {})z)Incompatible key: cannot use "" as a name)r�)r)
rr7r.�typerrorprr�Z	converterr	�valuesrU)r r�r?�k�func�proxyr
r"r"r#r�s
zConverterMapping.__setitem__cCs�yd|p
d}Wntk
r,t|��YnX|j|=xDtj|jf|jj��D]*}yt||�WqNtk
rvwNYqNXqNWdS)NrU)	rrZrr�r�rr�delattrr�)r r�rZinstr"r"r#r�,szConverterMapping.__delitem__cCs
t|j�S)N)�iterr)r r"r"r#r�:szConverterMapping.__iter__cCs
t|j�S)N)rjr)r r"r"r#r�=szConverterMapping.__len__N)
r%r&r'r(rdrerrr�r�r�r�r�r"r"r"r#rs
	))r(�collections.abcr�collectionsrrrr�ror�r�r�rdr�r<�__all__rrrrrrrrr	rrr
r
r�objectr�rrrrrrrrrr"r"r"r#�<module>�sX
	

+HJ&u
Ffilecmp.cpython-36.pyc000064400000020163150335715140010617 0ustar003


 \f&�@s�dZddlZddlZddlmZdddddgZiZd#Zddd
dddddgZdd�Z	d$dd�Z
dd�Zdd�ZGdd�d�Z
d%dd�Zee
fdd�Zdd�Zd d!�Zed"kr�e�dS)&z�Utilities for comparing files and directories.

Classes:
    dircmp

Functions:
    cmp(f1, f2, shallow=True) -> int
    cmpfiles(a, b, common) -> ([], [], [])
    clear_cache()

�N)�filterfalse�clear_cache�cmp�dircmp�cmpfiles�DEFAULT_IGNORES�iZRCSZCVSZtagsz.gitz.hgz.bzrZ_darcs�__pycache__cCstj�dS)zClear the filecmp cache.N)�_cache�clear�rr�/usr/lib64/python3.6/filecmp.pyrsTcCs�ttj|��}ttj|��}|dtjks8|dtjkr<dS|rL||krLdS|d|dkr`dStj||||f�}|dkr�t||�}tt�dkr�t�|t||||f<|S)a�Compare two files.

    Arguments:

    f1 -- First file name

    f2 -- Second file name

    shallow -- Just check stat signature (do not read the files).
               defaults to True.

    Return value:

    True if the files are the same, False otherwise.

    This function uses a cache for past comparisons and the results,
    with cache entries invalidated if their stat information
    changes.  The cache may be cleared by calling clear_cache().

    rFT�N�d)	�_sig�os�stat�S_IFREGr
�get�_do_cmp�lenr)�f1�f2�shallow�s1�s2Zoutcomerrr
rs
cCstj|j�|j|jfS)N)r�S_IFMT�st_mode�st_size�st_mtime)�strrr
rDs
rcCsbt}t|d��J}t|d��4}x,|j|�}|j|�}||kr>dS|sdSqWWdQRXWdQRXdS)N�rbFT)�BUFSIZE�open�read)rr�bufsize�fp1�fp2Zb1Zb2rrr
rIs

rc@s�eZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
ee	eeeeeeeeeeed�Zdd�ZdS)raMA class that manages the comparison of 2 directories.

    dircmp(a, b, ignore=None, hide=None)
      A and B are directories.
      IGNORE is a list of names to ignore,
        defaults to DEFAULT_IGNORES.
      HIDE is a list of names to hide,
        defaults to [os.curdir, os.pardir].

    High level usage:
      x = dircmp(dir1, dir2)
      x.report() -> prints a report on the differences between dir1 and dir2
       or
      x.report_partial_closure() -> prints report on differences between dir1
            and dir2, and reports on common immediate subdirectories.
      x.report_full_closure() -> like report_partial_closure,
            but fully recursive.

    Attributes:
     left_list, right_list: The files in dir1 and dir2,
        filtered by hide and ignore.
     common: a list of names in both dir1 and dir2.
     left_only, right_only: names only in dir1, dir2.
     common_dirs: subdirectories in both dir1 and dir2.
     common_files: files in both dir1 and dir2.
     common_funny: names in both dir1 and dir2 where the type differs between
        dir1 and dir2, or the name is not stat-able.
     same_files: list of identical files.
     diff_files: list of filenames which differ.
     funny_files: list of files which could not be compared.
     subdirs: a dictionary of dircmp objects, keyed by names in common_dirs.
     NcCsD||_||_|dkr$tjtjg|_n||_|dkr:t|_n||_dS)N)�left�rightr�curdir�pardir�hider�ignore)�self�a�br-r,rrr
�__init__xszdircmp.__init__cCsPttj|j�|j|j�|_ttj|j�|j|j�|_|jj	�|jj	�dS)N)
�_filterr�listdirr(r,r-�	left_listr)�
right_list�sort)r.rrr
�phase0�s
z
dircmp.phase0cCs�ttttjj|j�|j��}ttttjj|j�|j��}tt|j	t
|j|���|_tt|j	t
|j|���|_tt|j	t
|j|���|_dS)N)�dict�zip�mapr�path�normcaser4r5�list�__getitem__�filter�__contains__�commonr�	left_only�
right_only)r.r/r0rrr
�phase1�s
z
dircmp.phase1c
Cs:g|_g|_g|_�x |jD�]}tjj|j|�}tjj|j|�}d}ytj	|�}Wn&t
k
rz}z
d}WYdd}~XnXytj	|�}Wn&t
k
r�}z
d}WYdd}~XnX|�r&t	j|j�}t	j|j�}	||	kr�|jj
|�n>t	j|�r�|jj
|�n&t	j|��r|jj
|�n|jj
|�q|jj
|�qWdS)Nrr)�common_dirs�common_files�common_funnyrArr;�joinr(r)r�OSErrorrr�append�S_ISDIR�S_ISREG)
r.�xZa_pathZb_path�okZa_statZwhyZb_statZa_typeZb_typerrr
�phase2�s4
z
dircmp.phase2cCs&t|j|j|j�}|\|_|_|_dS)N)rr(r)rF�
same_files�
diff_files�funny_files)r.Zxxrrr
�phase3�sz
dircmp.phase3cCsRi|_xF|jD]<}tjj|j|�}tjj|j|�}t|||j|j	�|j|<qWdS)N)
�subdirsrErr;rHr(r)rr-r,)r.rMZa_xZb_xrrr
�phase4�s
z
dircmp.phase4cCs(|j�x|jj�D]}|j�qWdS)N)rUrT�values�phase4_closure)r.�sdrrr
rW�szdircmp.phase4_closurecCs�td|j|j�|jr2|jj�td|jd|j�|jrT|jj�td|jd|j�|jrp|jj�td|j�|jr�|jj�td|j�|jr�|jj�td|j�|j	r�|j	j�td|j	�|j
r�|j
j�td|j
�dS)	NZdiffzOnly in�:zIdentical files :zDiffering files :zTrouble with common files :zCommon subdirectories :zCommon funny cases :)�printr(r)rBr6rCrPrQrRrErG)r.rrr
�report�s,






z
dircmp.reportcCs.|j�x |jj�D]}t�|j�qWdS)N)r[rTrVrZ)r.rXrrr
�report_partial_closure�szdircmp.report_partial_closurecCs.|j�x |jj�D]}t�|j�qWdS)N)r[rTrVrZ�report_full_closure)r.rXrrr
r]�szdircmp.report_full_closure)rTrPrQrRrErFrGrArBrCr4r5cCs*||jkrt|��|j||�t||�S)N)�	methodmap�AttributeError�getattr)r.�attrrrr
�__getattr__�s
zdircmp.__getattr__)NN)�__name__�
__module__�__qualname__�__doc__r1r7rDrOrSrUrWr[r\r]r8r^rbrrrr
rVs" 
#

cCsNgggf}x>|D]6}tjj||�}tjj||�}|t|||�j|�qW|S)a]Compare common files in two directories.

    a, b -- directory names
    common -- list of file names found in both directories
    shallow -- if true, do comparison based solely on stat() information

    Returns a tuple of three lists:
      files that compare equal
      files that are different
      filenames that aren't regular files.

    )rr;rH�_cmprJ)r/r0rAr�resrMZaxZbxrrr
r�s

cCs,y|||||��Stk
r&dSXdS)N�)rI)r/r0Zsh�absrrrr
rgsrgcCstt|j|��S)N)r=rr@)Zflist�skiprrr
r2sr2cCsrddl}ddl}|j|jdd�d�\}}t|�dkrB|jdd��t|d|d�}d|krf|j�n|j�dS)	Nrr�rrizneed exactly two args�-r�)rmrn)�sys�getopt�argvrZGetoptErrorrr]r[)rorpZoptions�argsZddrrr
�demo$s
rs�__main__i )T)T)rfrr�	itertoolsr�__all__r
r"rrrrrrrrjrgr2rsrcrrrr
�<module>s&
'
%
	gettext.cpython-36.opt-1.pyc000064400000033567150335715140011637 0ustar003


 \T�@s�dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	dddddd	d
ddd
dddddddgZ
ejjej
dd�ZejdejejB�Zdd�Zdd�ZdPZd)d*�eed+�D�Zd,d-d.d/�ZdRd0d1�Zd2d3�Zd4d5�Zd6d7�ZGd8d�d�ZGd9d�de�ZdSd;d�ZiZdTd<d�Z dUd=d	�Z!ia"ia#d>a$dVd?d
�Z%dWd@d�Z&dXdAd�Z'dBd
�Z(dCd�Z)dDd�Z*dEd�Z+dFd�Z,dGd�Z-dHd�Z.dId�Z/e Z0dS)Ya�Internationalization and localization support.

This module provides internationalization (I18N) and localization (L10N)
support for your Python programs by providing an interface to the GNU gettext
message catalog library.

I18N refers to the operation by which a program is made aware of multiple
languages.  L10N refers to the adaptation of your program, once
internationalized, to the local language and cultural habits.

�N)�ENOENT�NullTranslations�GNUTranslations�Catalog�find�translation�install�
textdomain�bindtextdomain�bind_textdomain_codeset�dgettext�	dngettext�gettext�lgettext�	ldgettext�
ldngettext�	lngettext�ngettextZshare�localea�
        (?P<WHITESPACES>[ \t]+)                    | # spaces and horizontal tabs
        (?P<NUMBER>[0-9]+\b)                       | # decimal integer
        (?P<NAME>n\b)                              | # only n is allowed
        (?P<PARENTHESIS>[()])                      |
        (?P<OPERATOR>[-*/%+?:]|[><!]=?|==|&&|\|\|) | # !, *, /, %, +, -, <, >,
                                                     # <=, >=, ==, !=, &&, ||,
                                                     # ? :
                                                     # unary and bitwise ops
                                                     # not allowed
        (?P<INVALID>\w+|.)                           # invalid token
    ccsTxHtjt|�D]8}|j}|dkr"q|j|�}|dkr@td|��|VqWdVdS)NZWHITESPACESZINVALIDz invalid token in plural form: %s�)�re�finditer�_token_pattern�	lastgroup�group�
ValueError)�pluralZmoZkind�value�r�/usr/lib64/python3.6/gettext.py�	_tokenizeTs

r cCs|rtd|�Std�SdS)Nz#unexpected token in plural form: %szunexpected end of plural form)r)rrrr�_error_sr!�||�&&�==�!=�<�>�<=�>=�+�-�*�/�%cCs i|]\}}|D]
}||�qqSrr)�.0�iZops�oprrr�
<dictcomp>msr2��or�andz//)z||z&&r-cCs�d}t|�}x|dkr(|d7}t|�}qW|dkr\t|�\}}d||f}|dkr�td��nP|dkrrd	||f}n:yt|d
�}Wntk
r�t|�d�YnXd||f}t|�}d}xh|tk�r t|}||kr�P|dkr�|dkr�d|}tj||�}t||d�\}	}d|||	f}|}q�W||k�o6dkn�rFd|}|dk�r�|dk�r�t|d�\}
}|dk�rzt|��t|�\}}d|
||f}|dk�r�d|}||fS)Nr�!znot �(z%s(%s)�)z%unbalanced parenthesis in plural form�nz%s%s�
z%s%d�d��z(%s)r3z%s %s %s�?r�:z%s if %s else %s)r<r=)r<r=)�next�_parser�intr!�_binary_ops�	_c2py_ops�get)�tokensZpriority�result�nexttok�subr�jr0r1�rightZif_trueZif_falserrrrApsP



rAcCs:yt|�}Wn(tk
r4td|jjf�d�YnX|S)Nz'Plural value must be an integer, got %s)�round�	TypeError�	__class__�__name__)r9r0rrr�_as_int�srPcCs�t|�dkrtd��y~tt|��\}}|r2t|��d}x>|D]6}|dkrb|d7}|dkrrtd��q<|dkr<|d8}q<Wd	ti}td
||�|dStk
r�td��YnXdS)
z�Gets a C expression as used in PO files for plural forms and returns a
    Python function that implements an equivalent expression.
    i�z"plural form expression is too longrr7r3�z%plural form expression is too complexr8rPz�if True:
            def func(n):
                if not isinstance(n, int):
                    n = _as_int(n)
                return int(%s)
            �funcN)�lenrrAr r!rP�exec�RecursionError)rrGrHZdepth�c�nsrrr�c2py�s(

rXc
Cs:tj|�}d}d	}d
}d}|jd�}|dkrN||d�}|d|�}||O}nd}|jd�}|dkr�||d�}|d|�}||O}nd}|jd�}|dkr�||d�}|d|�}||O}nd}|}	g}
xbt|d�D]R}||@s�|	}||@�r�||7}||@�r||7}||@�r ||7}|
j|�q�W|
j�|
S)Nr3r��@r�.�_r3rYr=)rZ	normalizer�range�append�reverse)
�locZCOMPONENT_CODESETZCOMPONENT_TERRITORYZCOMPONENT_MODIFIER�mask�posZmodifier�codesetZ	territoryZlanguageZretr0�valrrr�_expand_lang�sJ










rec@speZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
ddd�ZdS)rNcCs.i|_d|_d|_d|_|dk	r*|j|�dS)N)�_info�_charset�_output_charset�	_fallbackrA)�self�fprrr�__init__�szNullTranslations.__init__cCsdS)Nr)rjrkrrrrAszNullTranslations._parsecCs|jr|jj|�n||_dS)N)ri�add_fallback)rj�fallbackrrrrmszNullTranslations.add_fallbackcCs|jr|jj|�S|S)N)rir)rj�messagerrrr	szNullTranslations.gettextcCs2|jr|jj|�S|jr$|j|j�S|jtj��S)N)rirrh�encoder�getpreferredencoding)rjrorrrrs
zNullTranslations.lgettextcCs*|jr|jj|||�S|dkr"|S|SdS)Nr3)rir)rj�msgid1�msgid2r9rrrrs
zNullTranslations.ngettextcCsH|jr|jj|||�S|dkr$|}n|}|jr:|j|j�S|jtj��S)Nr3)rirrhrprrq)rjrrrsr9�tmsgrrrrszNullTranslations.lngettextcCs|jS)N)rf)rjrrr�info(szNullTranslations.infocCs|jS)N)rg)rjrrr�charset+szNullTranslations.charsetcCs|jS)N)rh)rjrrr�output_charset.szNullTranslations.output_charsetcCs
||_dS)N)rh)rjrvrrr�set_output_charset1sz#NullTranslations.set_output_charsetcCsvddl}|j|jd<t|d�rrd|kr6|jd|jd<d|krJ|j|jd<d|kr^|j|jd<d|krr|j|jd<dS)Nrr\�__contains__rrrr)�builtinsr�__dict__�hasattrrrr)rj�namesrzrrrr4s
zNullTranslations.install)N)N)rO�
__module__�__qualname__rlrArmrrrrrurvrwrxrrrrrr�s
c@sHeZdZdZdZdZdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)rl�*l�$<rr3cCs|d?|d@fS)z/Returns a tuple of major version, minor version�i��r)rj�versionrrr�
_get_versionsJszGNUTranslations._get_versionsc"Cs�tj}t|dd�}i|_}dd�|_|j�}t|�}|d|dd��d}||jkrv|d	|dd
��\}}	}
}d}n6||jkr�|d|dd
��\}}	}
}d
}nt	dd|��|j
|�\}
}|
|jkr�t	ddt|
�|���xt
d|	�D�]�}||||
|
d��\}}||}|||||d��\}}||}||k�r^||k�r^|||�}|||�}nt	dd|��|dk�rRd}x�|jd�D]�}|j�j�}|�s��q�d}}d|k�r�|jdd�\}}|j�j�}|j�}||j|<|}n|�r|j|d|7<|dk�r|jd�d|_n0|dk�r�|jd�}|djd�d}t|�|_�q�W|j�p\d}d|k�r�|jd�\}} |jd�}t||�}x>t|�D]\}}!t|!|�|||f<�q�Wnt||�|t||�<|
d7}
|d7}q�WdS)z8Override this method to support alternative .mo formats.�namercSst|dk�S)Nr3)rB)r9rrr�<lambda>Usz(GNUTranslations._parse.<locals>.<lambda>z<INr=rz<4IrQz<IIz>4Iz>IIzBad magic numberzBad version number �zFile is corrupt�
r?r3�
zcontent-typezcharset=zplural-forms�;zplural=�ascii�)�struct�unpack�getattr�_catalogr�readrS�LE_MAGIC�BE_MAGIC�OSErrorr��VERSIONS�strr]�split�decode�strip�lowerrfrgrX�	enumerate)"rjrkr��filenameZcatalogZbufZbuflen�magicr�ZmsgcountZ	masteridxZtransidxZiiZ
major_versionZ
minor_versionr0ZmlenZmoffZmendZtlenZtoffZtend�msgrtZlastkZb_item�item�k�vrrvrrrs�xrrrrANsr














zGNUTranslations._parsecCsRt�}|jj||�}||kr2|jr.|jj|�S|}|jrD|j|j�S|jtj��S)N)	�objectr�rErirrhrprrq)rjro�missingrtrrrr�szGNUTranslations.lgettextcCsvy|j||j|�f}Wn<tk
rT|jr>|jj|||�S|dkrL|}n|}YnX|jrh|j|j�S|jtj��S)Nr3)	r�r�KeyErrorrirrhrprrq)rjrrrsr9rtrrrr�s
zGNUTranslations.lngettextcCs6t�}|jj||�}||kr2|jr.|jj|�S|S|S)N)r�r�rErir)rjror�rtrrrr�szGNUTranslations.gettextcCsZy|j||j|�f}Wn<tk
rT|jr>|jj|||�S|dkrL|}n|}YnX|S)Nr3)r�rr�rir)rjrrrsr9rtrrrr�s
zGNUTranslations.ngettextN)rr3)rOr~rr�r�r�r�rArrrrrrrrrBsT	FcCs�|dkrt}|dkrTg}x(dD] }tjj|�}|r|jd�}PqWd|krT|jd�g}x0|D](}x"t|�D]}||krl|j|�qlWq^W|r�g}	nd}	xL|D]D}|dkr�Ptjj||dd|�}
tjj	|
�r�|r�|	j|
�q�|
Sq�W|	S)	N�LANGUAGE�LC_ALL�LC_MESSAGES�LANGr?�Cz%s.mo)r�r�r�r�)
�_default_localedir�os�environrEr�r^re�path�join�exists)�domain�	localedir�	languages�allZenvarrdZnelangsZlangZnelangrG�mofilerrrr�s8




cCs�|dkrt}t|||dd�}|s6|r*t�Sttd|��d}x�|D]|}|tjj|�f}	tj	|	�}
|
dkr�t
|d��}tj|	||��}
WdQRXtj|
�}
|r�|
j
|�|dkr�|
}q@|j|
�q@W|S)NT)r�z$No translation file found for domain�rb)rrrr�rr�r��abspath�
_translationsrE�open�
setdefault�copyrxrm)r�r�r�Zclass_rnrcZmofilesrGr��key�trkrrrr�s*



cCst||d|d�}|j|�dS)NT)rnrc)rr)r�r�rcr}r�rrrrsZmessagescCs|dk	r|atS)N)�_current_domain)r�rrrr	'scCs|dk	r|t|<tj|t�S)N)�_localedirsrEr�)r�r�rrrr
.scCs|dk	r|t|<tj|�S)N)�_localecodesetsrE)r�rcrrrr5scCs@y t|tj|d�tj|�d�}Wntk
r4|SX|j|�S)N)rc)rr�rEr�r�r)r�ror�rrrr<scCsRtj|�}yt|tj|d�|d�}Wn"tk
rF|j|pBtj��SX|j|�S)N)rc)	r�rErr�r�rprrqr)r�rorcr�rrrrDs
cCsTy t|tj|d�tj|�d�}Wn$tk
rD|dkr<|S|SYnX|j|||�S)N)rcr3)rr�rEr�r�r)r�rrrsr9r�rrrr
Ls
cCshtj|�}yt|tj|d�|d�}Wn4tk
rX|dkrB|}n|}|j|pTtj��SX|j|||�S)N)rcr3)	r�rErr�r�rprrqr)r�rrrsr9rcr�rtrrrrWs
cCs
tt|�S)N)rr�)rorrrrcscCs
tt|�S)N)rr�)rorrrrfscCstt|||�S)N)r
r�)rrrsr9rrrriscCstt|||�S)N)rr�)rrrsr9rrrrls�r"�r#�r$r%�r&r'r(r)�r*r+�r,r-r.)r�r�r�r�r�r����)r�)NNF)NNNFN)NNN)N)N)N)1�__doc__rr��ior�rr��sys�errnor�__all__r�r��base_prefixr��compile�VERBOSE�DOTALLrr r!rCr�rDrArPrXrerrrr�rrr�r�r�r	r
rrrr
rrrrrrrrrr�<module>s^&8



1$*K
&




_osx_support.cpython-36.opt-2.pyc000064400000016133150335715140012706 0ustar003


 \�J�
@s�ddlZddlZddlZddddgZd0Zd1ZdZd2dd�Zdd�Zdd�Z	da
dd�Zdd�Zdd�Z
d d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d�Zd-d�Zd.d�Zd/d�ZdS)3�N�compiler_fixup�customize_config_vars�customize_compiler�get_platform_osx�CFLAGS�LDFLAGS�CPPFLAGS�
BASECFLAGS�	BLDSHARED�LDSHARED�CC�CXX�	PY_CFLAGS�
PY_LDFLAGS�PY_CPPFLAGS�PY_CORE_CFLAGS�PY_CORE_LDFLAGSZ_OSX_SUPPORT_INITIAL_cCs�|dkrtjd}|jtj�}tjj|�\}}tjdkrH|dkrH|d}tjj|�s�x*|D]"}tjj	||�}tjj|�rZ|SqZWdS|SdS)N�PATHZwin32z.exe)
�os�environ�split�pathsep�path�splitext�sys�platform�isfile�join)�
executabler�paths�baseZext�p�f�r#�$/usr/lib64/python3.6/_osx_support.py�_find_executables

r%cCs�ddl}yddl}|j�}Wn(tk
rDtdtj�fd�}YnX|j|��0}d||jf}tj	|�s||j
�jd�j�SdSQRXdS)Nrz/tmp/_osx_support.%szw+bz%s 2>/dev/null >'%s'zutf-8)
�
contextlib�tempfileZNamedTemporaryFile�ImportError�openr�getpid�closing�name�system�read�decode�strip)Z
commandstringr&r'�fp�cmdr#r#r$�_read_output7sr3cCst|�ptd|f�pdS)Nz/usr/bin/xcrun -find %s�)r%r3)Ztoolnamer#r#r$�_find_build_toolJsr5cCsxtdkrtdaytd�}Wntk
r,YnHXztjd|j��}Wd|j�X|dk	rtdj|jd�j	d�dd��atS)Nr4z0/System/Library/CoreServices/SystemVersion.plistz=<key>ProductUserVisibleVersion</key>\s*<string>(.*?)</string>�.��)
�_SYSTEM_VERSIONr)�OSError�re�searchr.�closer�groupr)r"�mr#r#r$�_get_system_versionSs

r@cCs&x t|�D]}|jt�r
||=q
WdS)N)�list�
startswith�_INITPRE)�_config_vars�kr#r#r$�_remove_original_valuesqs
rFcCs8|j|d�}||kr,t||kr,||t|<|||<dS)Nr4)�getrC)rD�cvZnewvalueZoldvaluer#r#r$�_save_modified_valuexsrIcCsTt�}|r@ytdd�|jd�D��}Wntk
r>d}YnX|rPt|dk�SdS)	Ncss|]}t|�VqdS)N)�int)�.0�ir#r#r$�	<genexpr>�sz-_supports_universal_builds.<locals>.<genexpr>r6r4�
�F)rNrO)r@�tupler�
ValueError�bool)Zosx_versionr#r#r$�_supports_universal_builds�s
rScCs�dtjkr|S|dj�d}}t|�s4td�}n<tjj|�jd�rptd|j	dd�f�}|rpd|krptd�}|s|t
d	��||kr�xTtD]L}||kr�|tjkr�||j�}|d
kr�|n|d|d<t||dj
|��q�W|S)
NrrZclang�gccz'%s' --version�'z'"'"'zllvm-gcczCannot locate working compilerr
z++� )rrrr%r5r�basenamerBr3�replace�SystemError�_COMPILER_CONFIG_VARSrIr)rDZccZoldcc�datarHZcv_splitr#r#r$�_find_appropriate_compiler�s(


r\cCsZxTtD]L}||kr|tjkr||}tjdd|tjd�}tjdd|�}t|||�qW|S)Nz
-arch\s+\w+\srV)�flagsz-isysroot [^ 	]*)�_UNIVERSAL_CONFIG_VARSrrr;�sub�ASCIIrI)rDrHr]r#r#r$�_remove_universal_flags�s
racCs�dtjkr|Stjd|d�dk	r�tjd|djdd�f�}|r�x@tD]8}||krH|tjkrH||}tjdd|�}t|||�qHW|S)	Nrz-arch\s+ppcrzNecho 'int main{};' | '%s' -c -arch ppc -x c -o /dev/null /dev/null 2>/dev/nullrUz'"'"'z-arch\s+ppc\w*\srV)	rrr;r<r-rXr^r_rI)rDZstatusrHr]r#r#r$�_remove_unsupported_archs�s
	
rbcCshdtjkrdtjd}xNtD]F}||krd||kr||}tjdd|�}|d|}t|||�qW|S)N�	ARCHFLAGSz-archz
-arch\s+\w+\srV)rrr^r;r_rI)rDZarchrHr]r#r#r$�_override_all_archss


rdcCs||jdd�}tjd|�}|dk	rx|jd�}tjj|�sxx@tD]8}||kr<|tjkr<||}tj	dd|�}t
|||�q<W|S)Nrr4z-isysroot\s+(\S+)r7z-isysroot\s+\S+(?:\s|$)rV)rGr;r<r>rr�existsr^rr_rI)rD�cflagsr?ZsdkrHr]r#r#r$�_check_for_unavailable_sdks

rgcCsXd}}t|�}t�s d}}nd|k}d|k}|s>dtjkrxx8y|jd�}|||d�=Wq@tk
rrPYq@Xq@Wdtjkr�|r�|tjdj�}|r�x8y|jd�}|||d�=Wq�tk
r�PYq�Xq�Wd}d|kr�|jd�}||d}n d|k�r|jd�}||d}|�rTtjj|��rTdd	l	m
}|jd
|�|jd�|S)NFTz-archz	-isysrootrcr8r7r)�logz4Compiling with an SDK that doesn't seem to exist: %sz$Please check your Xcode installation)rArSrr�indexrQrr�isdirZ	distutilsrh�warn)Zcompiler_soZcc_argsZ	stripArchZstripSysrootriZsysroot�idxrhr#r#r$r0sF	






cCs"t�st|�t|�t|�|S)N)rSrardrg)rDr#r#r$rps
cCst|�t|�t|�|S)N)r\rbrd)rDr#r#r$r�s	c
Cs||jdd�}t�p|}|p|}|�rr|}d}|jtd|jdd��}|r�y$tdd�|jd�dd	�D��}Wq�tk
r�d}Yq�Xnd}|dko�d|j�k�r6d
}tjd|�}tt	t
|���}t|�dkr�|d}n\|dkr�d
}nN|d k�r�d}n>|d!k�rd}n.|d"k�rd}n|d#k�r&d}ntd|f��n<|dk�rRtj
d$k�rrd}n |d%k�rrtj
d&k�rnd}nd}|||fS)'N�MACOSX_DEPLOYMENT_TARGETr4Zmacosxrcss|]}t|�VqdS)N)rJ)rKrLr#r#r$rM�sz#get_platform_osx.<locals>.<genexpr>r6rr8rNrOz-archZfatz
-arch\s+(\S+)r7�i386�ppc�x86_64ZintelZfat3�ppc64Zfat64Z	universalz%Don't know machine value for archs=%r� �PowerPC�Power_Macintosh)rNr)rNr)rNrO)rnro)rnrp)rnrorp)rqrp)rnrorqrpl)rsrtl)rGr@rCrPrrQr0r;�findall�sorted�set�lenr�maxsize)rD�osname�release�machineZmacverZ
macreleaserfZarchsr#r#r$r�sP


$






)
rrrr	r
rrr
rrrrr)r
rrr
)N)rr;r�__all__r^rZrCr%r3r5r9r@rFrIrSr\rarbrdrgrrrrr#r#r#r$�<module>s:
>(@)imaplib.cpython-36.opt-1.pyc000064400000115761150335715140011565 0ustar003


 \/��2@s�dZdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZmZm
Z
ddlmZyddlZdZWnek
r�dZYnXdd	d
ddd
gZdZdZdZdZdgZdZdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�)Zejd�Zejd�Zejd�Zejdej�Z ejd�Z!ejd�Z"ejd�Z#ejdej�Z$dZ%dZ&Gd d�d�Z'e�r�Gd!d"�d"e'�Z(ej)d"�Gd#d	�d	e'�Z*Gd$d%�d%�Z+d&j,d'�Z-d(d)�e.e-d*d��D�Z/d+d
�Z0d,d�Z1d-d�Z2d.d
�Z3e4d/k�r�ddl5Z5ddl6Z6ye5j5ej7d*d�d0�\Z8Z9Wn0e5j:k
�rrZ;zffZ8Z9WYddZ;[;XnXdZ<x@e8D]8\Z=Z;e=d1k�r�e>e;�Zne=d2k�r~e;Z<e9�s~e<fZ9�q~We9�s�d�Z9e9dZ?e6j@�ZAe6j6d4eAe?�p�d5f�ZBd6eAd7d8�ZCd9eAeBffd�d�d�d@d?ddeCffd�d�d�d�d�dNffdOffdPffdQfffZDdDffd�d�d�d@dddeCffdPffdXfffZEdYdZ�ZF�y&e<�r�e*e<�ZGne'e?�ZGeGjHdk�r�eDd*d�ZDeGjId[eGjJ�eGjId\eGjKf�xeDD]\ZLZ9eFeLe9��q�WxJeFdAd��D]<ZMejNd_eM�ZOeO�reOjPd*�ZQneMj,�d�ZQeFd`eQf��q�Wx\eED]T\ZLZ9eFeLe9�ZReLe9fd�k�rZ�q6eRd�j,�ZSeS�sp�q6eFdTdadbeSd�dcf��q6WeTdd�Wn.eTde�e�s�eTdfej7d��YnXdS)�z�IMAP4 client.

Based on RFC 2060.

Public class:           IMAP4
Public variable:        Debug
Public functions:       Internaldate2tuple
                        Int2AP
                        ParseFlags
                        Time2Internaldate
z2.58�N)�datetime�timezone�	timedelta)�DEFAULT_BUFFER_SIZETF�IMAP4�IMAP4_stream�Internaldate2tuple�Int2AP�
ParseFlags�Time2Internaldates
�i��	IMAP4REV1i@B�AUTH�SELECTED�NONAUTH�LOGOUT))�APPEND�AUTHENTICATE�
CAPABILITY�CHECK�CLOSE�COPY�CREATE�DELETE�	DELETEACL�ENABLE�EXAMINE�EXPUNGE�FETCH�GETACL�
GETANNOTATION�GETQUOTA�GETQUOTAROOT�MYRIGHTS�LIST�LOGINr�LSUBZMOVE�	NAMESPACE�NOOP�PARTIAL�	PROXYAUTH�RENAME�SEARCH�SELECT�SETACL�
SETANNOTATION�SETQUOTA�SORT�STARTTLS�STATUS�STORE�	SUBSCRIBE�THREAD�UID�UNSUBSCRIBEs\+( (?P<data>.*))?s.*FLAGS \((?P<flags>[^\)]*)\)s�.*INTERNALDATE "(?P<day>[ 0123][0-9])-(?P<mon>[A-Z][a-z][a-z])-(?P<year>[0-9][0-9][0-9][0-9]) (?P<hour>[0-9][0-9]):(?P<min>[0-9][0-9]):(?P<sec>[0-9][0-9]) (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])"s.*{(?P<size>\d+)}$s
\r\n|\r|\ns%\[(?P<type>[A-Z-]+)( (?P<data>.*))?\]s$\* (?P<type>[A-Z-]+)( (?P<data>.*))?s3\* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?c@s�eZdZdZGdd�de�ZGdd�de�ZGdd�de�Zdefd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdefdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Z d9d:�Z!d;d<�Z"d=d>�Z#d?d@�Z$dAdB�Z%dCdD�Z&dEdF�Z'dGdH�Z(d�dKdL�Z)dMdN�Z*dOdP�Z+dQdR�Z,dSdT�Z-d�dUdV�Z.dWdX�Z/dYdZ�Z0d[d\�Z1d]d^�Z2d_d`�Z3dadb�Z4dcdd�Z5d�dgdh�Z6didj�Z7dkdl�Z8dmdn�Z9dodp�Z:d�drds�Z;dtdu�Z<dvdw�Z=dxdy�Z>dzd{�Z?d|d}�Z@d~d�ZAd�d��ZBd�d��ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGd�d��ZHd�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOdqS)�ra�IMAP4 client class.

    Instantiate with: IMAP4([host[, port]])

            host - host's name (default: localhost);
            port - port number (default: standard IMAP4 port).

    All IMAP4rev1 commands are supported by methods of the same
    name (in lower-case).

    All arguments to commands are converted to strings, except for
    AUTHENTICATE, and the last argument to APPEND which is passed as
    an IMAP4 literal.  If necessary (the string contains any
    non-printing characters or white-space and isn't enclosed with
    either parentheses or double quotes) each string is quoted.
    However, the 'password' argument to the LOGIN command is always
    quoted.  If you want to avoid having an argument string quoted
    (eg: the 'flags' argument to STORE) then enclose the string in
    parentheses (eg: "(\Deleted)").

    Each command returns a tuple: (type, [data, ...]) where 'type'
    is usually 'OK' or 'NO', and 'data' is either the text from the
    tagged response, or untagged results from command. Each 'data'
    is either a string, or a tuple. If a tuple, then the first part
    is the header of the response, and the second part contains
    the data (ie: 'literal' value).

    Errors raise the exception class <instance>.error("<reason>").
    IMAP4 server errors raise <instance>.abort("<reason>"),
    which is a sub-class of 'error'. Mailbox status changes
    from READ-WRITE to READ-ONLY raise the exception class
    <instance>.readonly("<reason>"), which is a sub-class of 'abort'.

    "error" exceptions imply a program error.
    "abort" exceptions imply the connection should be reset, and
            the command re-tried.
    "readonly" exceptions imply the command should be re-tried.

    Note: to use this module, you must read the RFCs pertaining to the
    IMAP4 protocol, as the semantics of the arguments to each IMAP4
    command are left to the invoker, not to mention the results. Also,
    most IMAP servers implement a sub-set of the commands available here.
    c@seZdZdS)zIMAP4.errorN)�__name__�
__module__�__qualname__�r<r<�/usr/lib64/python3.6/imaplib.py�error�sr>c@seZdZdS)zIMAP4.abortN)r9r:r;r<r<r<r=�abort�sr?c@seZdZdS)zIMAP4.readonlyN)r9r:r;r<r<r<r=�readonly�sr@�cCs�t|_d|_d|_i|_i|_d|_d|_d|_d|_	|j
�|j||�y|j�Wn8t
k
r�y|j�Wntk
r�YnX�YnXdS)NrrAFr)�Debug�debug�state�literal�tagged_commands�untagged_responses�continuation_response�is_readonly�tagnum�_tls_established�_mode_ascii�open�_connect�	Exception�shutdown�OSError)�self�host�portr<r<r=�__init__�s&zIMAP4.__init__cCs0d|_d|_tjttj�|_tjttj�|_dS)NF�ascii)	�utf8_enabled�	_encoding�re�compile�_Literal�ASCII�Literal�_Untagged_status�Untagged_status)rRr<r<r=rL�szIMAP4._mode_asciicCs(d|_d|_tjt�|_tjt�|_dS)NTzutf-8)rWrXrYrZr[r]r^r_)rRr<r<r=�
_mode_utf8�szIMAP4._mode_utf8cCs�ttjdd��|_tjd|jdtj�|_|j�|_	d|j
krHd|_nd|j
krZd|_n|j|j	��|j
�x tD]}||jkr�qt||_dSW|jd	��dS)
Nii��s(?P<tag>s"\d+) (?P<type>[A-Z]+) (?P<data>.*)ZPREAUTHr�OKrzserver not IMAP4 compliant)r	�randomZrandint�tagprerYrZr\�tagre�
_get_responseZwelcomerGrDr>�_get_capabilities�AllowedVersions�capabilities�PROTOCOL_VERSION)rR�versionr<r<r=rN�s 




zIMAP4._connectcCs&|tkrt||j��Std|��dS)NzUnknown IMAP4 command: '%s')�Commands�getattr�lower�AttributeError)rR�attrr<r<r=�__getattr__	szIMAP4.__getattr__cCs|S)Nr<)rRr<r<r=�	__enter__szIMAP4.__enter__cGs&y|j�Wntk
r YnXdS)N)�logoutrQ)rR�argsr<r<r=�__exit__szIMAP4.__exit__cCs |js
dn|j}tj||jf�S)N)rS�socketZcreate_connectionrT)rRrSr<r<r=�_create_socketszIMAP4._create_socketcCs(||_||_|j�|_|jjd�|_dS)z�Setup connection to remote server on "host:port"
            (default: localhost:standard IMAP4 port).
        This connection will be used by the routines:
            read, readline, send, shutdown.
        �rbN)rSrTrv�sock�makefile�file)rRrSrTr<r<r=rM#s
z
IMAP4.opencCs|jj|�S)zRead 'size' bytes from remote.)rz�read)rR�sizer<r<r=r{/sz
IMAP4.readcCs.|jjtd�}t|�tkr*|jdt��|S)zRead line from remote.�zgot more than %d bytes)rz�readline�_MAXLINE�lenr>)rR�liner<r<r=r~4szIMAP4.readlinecCs|jj|�dS)zSend data to remote.N)rxZsendall)rR�datar<r<r=�send<sz
IMAP4.sendcCst|jj�zXy|jjtj�Wn@tk
r^}z$|jtjkrNt	|dd�dkrN�WYdd}~XnXWd|jj�XdS)z Close I/O established in "open".Zwinerrorri&'N)
rz�closerxrPruZ	SHUT_RDWRrQ�errnoZENOTCONNrl)rR�excr<r<r=rPAs
zIMAP4.shutdowncCs|jS)zfReturn socket instance used to connect to IMAP4 server.

        socket = <instance>.socket()
        )rx)rRr<r<r=ruQszIMAP4.socketcCsBd}|jddg|�\}}|dr(||fS|j�\}}|j|||�S)aReturn most recent 'RECENT' responses if any exist,
        else prompt server for an update using the 'NOOP' command.

        (typ, [data]) = <instance>.recent()

        'data' is None if no new messages,
        else list of RECENT responses, most recent last.
        ZRECENTraNr}���)�_untagged_response�noop)rR�name�typ�datr<r<r=�recent]s	zIMAP4.recentcCs|j|dg|j��S)z�Return data for response 'code' if received, or None.

        Old value for response 'code' is cleared.

        (code, [data]) = <instance>.response(code)
        N)r��upper)rR�coder<r<r=�responsenszIMAP4.responsecCsxd}|sd}|r.|d|dfdkr2d|}nd}|r@t|�}nd}tjt|�}|jrbd	|d
}||_|j||||�S)
z�Append message to named mailbox.

        (typ, [data]) = <instance>.append(mailbox, flags, date_time, message)

                All args except `message' can be None.
        r�INBOXrr}�(�)z(%s)NsUTF8 (�)r�)r�r�)r�MapCRLF�sub�CRLFrWrE�_simple_command)rR�mailbox�flags�	date_time�messager�rEr<r<r=�append|s

zIMAP4.appendcCsP|j�}t|�j|_|jd|�\}}|dkrB|j|djdd���d|_||fS)asAuthenticate command - requires response processing.

        'mechanism' specifies which authentication mechanism is to
        be used - it must appear in <instance>.capabilities in the
        form AUTH=<mechanism>.

        'authobject' must be a callable object:

                data = authobject(response)

        It will be called to process server continuation responses; the
        response argument it is passed will be a bytes.  It should return bytes
        data that will be base64 encoded and sent to the server.  It should
        return None if the client abort response '*' should be sent instead.
        rrar}zutf-8�replacerr�)r��_Authenticator�processrEr�r>�decoderD)rRZ	mechanismZ
authobject�mechr�r�r<r<r=�authenticate�szIMAP4.authenticatecCs d}|j|�\}}|j|||�S)zT(typ, [data]) = <instance>.capability()
        Fetch capabilities list from server.r)r�r�)rRr�r�r�r<r<r=�
capability�szIMAP4.capabilitycCs
|jd�S)zRCheckpoint mailbox on server.

        (typ, [data]) = <instance>.check()
        r)r�)rRr<r<r=�check�szIMAP4.checkcCs$z|jd�\}}Wdd|_X||fS)z�Close currently selected mailbox.

        Deleted messages are removed from writable mailbox.
        This is the recommended command before 'LOGOUT'.

        (typ, [data]) = <instance>.close()
        rNr)r�rD)rRr�r�r<r<r=r��szIMAP4.closecCs|jd||�S)z�Copy 'message_set' messages onto end of 'new_mailbox'.

        (typ, [data]) = <instance>.copy(message_set, new_mailbox)
        r)r�)rR�message_setZnew_mailboxr<r<r=�copy�sz
IMAP4.copycCs|jd|�S)zPCreate new mailbox.

        (typ, [data]) = <instance>.create(mailbox)
        r)r�)rRr�r<r<r=�create�szIMAP4.createcCs|jd|�S)zPDelete old mailbox.

        (typ, [data]) = <instance>.delete(mailbox)
        r)r�)rRr�r<r<r=�delete�szIMAP4.deletecCs|jd||�S)z�Delete the ACLs (remove any rights) set for who on mailbox.

        (typ, [data]) = <instance>.deleteacl(mailbox, who)
        r)r�)rRr��whor<r<r=�	deleteacl�szIMAP4.deleteaclcCsHd|jkrtjd��|jd|�\}}|dkr@d|j�kr@|j�||fS)zkSend an RFC5161 enable string to the server.

        (typ, [data]) = <intance>.enable(capability)
        rzServer does not support ENABLErazUTF8=ACCEPT)rhrr>r�r�r`)rRr�r�r�r<r<r=�enable�s

zIMAP4.enablecCs d}|j|�\}}|j|||�S)z�Permanently remove deleted items from selected mailbox.

        Generates 'EXPUNGE' response for each deleted message.

        (typ, [data]) = <instance>.expunge()

        'data' is list of 'EXPUNGE'd message numbers in order received.
        r)r�r�)rRr�r�r�r<r<r=�expunge�s	z
IMAP4.expungecCs$d}|j|||�\}}|j|||�S)a#Fetch (parts of) messages.

        (typ, [data, ...]) = <instance>.fetch(message_set, message_parts)

        'message_parts' should be a string of selected parts
        enclosed in parentheses, eg: "(UID BODY[TEXT])".

        'data' are tuples of message part envelope and data.
        r)r�r�)rRr�Z
message_partsr�r�r�r<r<r=�fetchs
zIMAP4.fetchcCs|jd|�\}}|j||d�S)zXGet the ACLs for a mailbox.

        (typ, [data]) = <instance>.getacl(mailbox)
        rZACL)r�r�)rRr�r�r�r<r<r=�getaclszIMAP4.getaclcCs"|jd|||�\}}|j||d�S)za(typ, [data]) = <instance>.getannotation(mailbox, entry, attribute)
        Retrieve ANNOTATIONs.r �
ANNOTATION)r�r�)rRr��entryZ	attributer�r�r<r<r=�
getannotation#szIMAP4.getannotationcCs|jd|�\}}|j||d�S)z�Get the quota root's resource usage and limits.

        Part of the IMAP4 QUOTA extension defined in rfc2087.

        (typ, [data]) = <instance>.getquota(root)
        r!�QUOTA)r�r�)rR�rootr�r�r<r<r=�getquota+szIMAP4.getquotacCs@|jd|�\}}|j||d�\}}|j||d�\}}|||gfS)z�Get the list of quota roots for the named mailbox.

        (typ, [[QUOTAROOT responses...], [QUOTA responses]]) = <instance>.getquotaroot(mailbox)
        r"r�Z	QUOTAROOT)r�r�)rRr�r�r�ZquotaZ	quotarootr<r<r=�getquotaroot6szIMAP4.getquotaroot�""�*cCs$d}|j|||�\}}|j|||�S)z�List mailbox names in directory matching pattern.

        (typ, [data]) = <instance>.list(directory='""', pattern='*')

        'data' is list of LIST responses.
        r$)r�r�)rR�	directory�patternr�r�r�r<r<r=�listAsz
IMAP4.listcCs<|jd||j|��\}}|dkr.|j|d��d|_||fS)z�Identify client using plaintext password.

        (typ, [data]) = <instance>.login(user, password)

        NB: 'password' will be quoted.
        r%rar}rr�)r��_quoter>rD)rR�user�passwordr�r�r<r<r=�loginMs
zIMAP4.logincCs|||_|_|jd|j�S)zr Force use of CRAM-MD5 authentication.

        (typ, [data]) = <instance>.login_cram_md5(user, password)
        zCRAM-MD5)r�r�r��_CRAM_MD5_AUTH)rRr�r�r<r<r=�login_cram_md5[szIMAP4.login_cram_md5cCsBddl}t|jt�r |jjd�n|j}|jd|j||d�j�S)z1 Authobject to use with CRAM-MD5 authentication. rNzutf-8� Zmd5)�hmac�
isinstancer��str�encoder�ZHMACZ	hexdigest)rRZ	challenger��pwdr<r<r=r�dszIMAP4._CRAM_MD5_AUTHcCsjd|_y|jd�\}}Wn(ddtj�dd�g}}YnX|j�d|jkrbd|jdfS||fS)z|Shutdown connection to server.

        (typ, [data]) = <instance>.logout()

        Returns server 'BYE' response.
        r�NOz%s: %sN��BYE)rDr��sys�exc_inforPrG)rRr�r�r<r<r=rrls"
zIMAP4.logoutcCs$d}|j|||�\}}|j|||�S)z�List 'subscribed' mailbox names in directory matching pattern.

        (typ, [data, ...]) = <instance>.lsub(directory='""', pattern='*')

        'data' are tuples of message part envelope and data.
        r&)r�r�)rRr�r�r�r�r�r<r<r=�lsub|sz
IMAP4.lsubcCs|jd|�\}}|j||d�S)z�Show my ACLs for a mailbox (i.e. the rights that I have on mailbox).

        (typ, [data]) = <instance>.myrights(mailbox)
        r#)r�r�)rRr�r�r�r<r<r=�myrights�szIMAP4.myrightscCs d}|j|�\}}|j|||�S)zb Returns IMAP namespaces ala rfc2342

        (typ, [data, ...]) = <instance>.namespace()
        r')r�r�)rRr�r�r�r<r<r=�	namespace�szIMAP4.namespacecCs
|jd�S)zFSend NOOP command.

        (typ, [data]) = <instance>.noop()
        r()r�)rRr<r<r=r��sz
IMAP4.noopcCs(d}|j|||||�\}}|j||d�S)z�Fetch truncated part of a message.

        (typ, [data, ...]) = <instance>.partial(message_num, message_part, start, length)

        'data' is tuple of message part envelope and data.
        r)r)r�r�)rRZmessage_numZmessage_part�startZlengthr�r�r�r<r<r=�partial�sz
IMAP4.partialcCsd}|jd|�S)z�Assume authentication as "user".

        Allows an authorised administrator to proxy into any user's
        mailbox.

        (typ, [data]) = <instance>.proxyauth(user)
        r*)r�)rRr�r�r<r<r=�	proxyauth�s	zIMAP4.proxyauthcCs|jd||�S)zkRename old mailbox name to new.

        (typ, [data]) = <instance>.rename(oldmailbox, newmailbox)
        r+)r�)rRZ
oldmailboxZ
newmailboxr<r<r=�rename�szIMAP4.renamecGsTd}|r2|jrtjd��|j|d|f|��\}}n|j|f|��\}}|j|||�S)z�Search mailbox for matching messages.

        (typ, [data]) = <instance>.search(charset, criterion, ...)

        'data' is space separated list of matching message numbers.
        If UTF8 is enabled, charset MUST be None.
        r,z'Non-None charset not valid in UTF8 mode�CHARSET)rWrr>r�r�)rR�charsetZcriteriar�r�r�r<r<r=�search�s
zIMAP4.searchr�FcCsxi|_||_|rd}nd}|j||�\}}|dkr@d|_||fSd|_d|jkrd|rd|jd|��||jjdd	g�fS)
atSelect a mailbox.

        Flush all untagged responses.

        (typ, [data]) = <instance>.select(mailbox='INBOX', readonly=False)

        'data' is count of messages in mailbox ('EXISTS' response).

        Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY'), so
        other responses should be obtained via <instance>.response('FLAGS') etc.
        rr-rarrz	READ-ONLYz%s is not writable�EXISTSN)rGrIr�rDr@�get)rRr�r@r�r�r�r<r<r=�select�s
zIMAP4.selectcCs|jd|||�S)zZSet a mailbox acl.

        (typ, [data]) = <instance>.setacl(mailbox, who, what)
        r.)r�)rRr�r�Zwhatr<r<r=�setacl�szIMAP4.setaclcGs |jd|��\}}|j||d�S)z_(typ, [data]) = <instance>.setannotation(mailbox[, entry, attribute]+)
        Set ANNOTATIONs.r/r�)r/)r�r�)rRrsr�r�r<r<r=�
setannotation�szIMAP4.setannotationcCs |jd||�\}}|j||d�S)ziSet the quota root's resource limits.

        (typ, [data]) = <instance>.setquota(root, limits)
        r0r�)r�r�)rRr�Zlimitsr�r�r<r<r=�setquotaszIMAP4.setquotacGsFd}|d|dfdkr d|}|j|||f|��\}}|j|||�S)	z�IMAP4rev1 extension SORT command.

        (typ, [data]) = <instance>.sort(sort_criteria, charset, search_criteria, ...)
        r1rr}r�r�z(%s)r�)r�r�)r�r�)rRZ
sort_criteriar��search_criteriar�r�r�r<r<r=�sorts
z
IMAP4.sortNcCs�d}ts|jd��|jr"|jd��||jkr6|jd��|dkrFtj�}|j|�\}}|dkr�|j|j	|j
d�|_	|j	jd�|_d|_|j
�n
|jd	��|j|||�S)
Nr2zSSL support missingzTLS session already establishedzTLS not supported by serverra)�server_hostnamerwTzCouldn't establish TLS session)�HAVE_SSLr>rKr?rh�ssl�_create_stdlib_contextr��wrap_socketrxrSryrzrfr�)rR�ssl_contextr�r�r�r<r<r=�starttlss$





zIMAP4.starttlscCs$d}|j|||�\}}|j|||�S)zpRequest named status conditions for mailbox.

        (typ, [data]) = <instance>.status(mailbox, names)
        r3)r�r�)rRr��namesr�r�r�r<r<r=�status5szIMAP4.statuscCs>|d|dfd	krd|}|jd|||�\}}|j||d�S)
z�Alters flag dispositions for messages in mailbox.

        (typ, [data]) = <instance>.store(message_set, command, flags)
        rr}r�r�z(%s)r4rr�)r�r�)r�r�)rRr��commandr�r�r�r<r<r=�storeAszIMAP4.storecCs|jd|�S)zYSubscribe to new mailbox.

        (typ, [data]) = <instance>.subscribe(mailbox)
        r5)r�)rRr�r<r<r=�	subscribeLszIMAP4.subscribecGs*d}|j|||f|��\}}|j|||�S)z�IMAPrev1 extension THREAD command.

        (type, [data]) = <instance>.thread(threading_algorithm, charset, search_criteria, ...)
        r6)r�r�)rRZthreading_algorithmr�r�r�r�r�r<r<r=�threadTszIMAP4.threadcGs�|j�}|tkr|jd|��|jt|krL|jd||jdjt|�f��d}|j||f|��\}}|d	krt|}nd}|j|||�S)
z�Execute "command arg ..." with messages identified by UID,
                rather than message number.

        (typ, [data]) = <instance>.uid(command, arg1, arg2, ...)

        Returns response appropriate to 'command'.
        zUnknown IMAP4 UID command: %sz9command %s illegal in state %s, only allowed in states %sz, r7r,r1r6r)r,r1r6)r�rkr>rD�joinr�r�)rRr�rsr�r�r�r<r<r=�uid^sz	IMAP4.uidcCs|jd|�S)z_Unsubscribe from old mailbox.

        (typ, [data]) = <instance>.unsubscribe(mailbox)
        r8)r�)rRr�r<r<r=�unsubscribewszIMAP4.unsubscribecGs,|j�}|tkr|jft|<|j|f|��S)aAllow simple extension commands
                notified by server in CAPABILITY response.

        Assumes command is legal in current state.

        (typ, [data]) = <instance>.xatom(name, arg, ...)

        Returns response appropriate to extension command `name'.
        )r�rkrDr�)rRr�rsr<r<r=�xatoms
zIMAP4.xatomcCs8|dkrd}|j}||kr*||j|�n
|g||<dS)N�)rGr�)rRr�r�Zurr<r<r=�_append_untagged�szIMAP4._append_untaggedcCs,|jjd�}|r(|j|dj|jd���dS)Nr�r}r�r�)rGr�r?r�rX)rRZbyer<r<r=�
_check_bye�szIMAP4._check_byec
Gs�|jt|kr4d|_|jd||jdjt|�f��xdD]}||jkr:|j|=q:Wd|jkrp|jrp|jd��|j�}t	||j
�}|d|}x8|D]0}|dkr�q�t|t�r�t	||j
�}|d|}q�W|j}|dk	�rd|_t
|�t
|j�kr�|}nd}|t	d	t|�|j
�}y|j|t�Wn2tk
�rX}	z|jd
|	��WYdd}	~	XnX|dk�rh|Sx�x |j��r�|j|�rl|S�qlW|�r�||j�}y|j|�|jt�Wn2tk
�r�}	z|jd
|	��WYdd}	~	XnX|�sjP�qjW|S)Nz9command %s illegal in state %s, only allowed in states %sz, rar��BADz	READ-ONLYz#mailbox status changed to READ-ONLY� z {%s}zsocket error: %s)rar�r�)rDrkrEr>r�rGrIr@�_new_tag�bytesrXr�r��type�_commandr�r�r�rQr?rerFrH)
rRr�rsr��tagr��argrEZ	literator�valr<r<r=r��s^






 



 zIMAP4._commandcCs�|dkr|j�y|j|�\}}Wnj|jk
rX}z|jd||f��WYdd}~Xn6|jk
r�}z|jd||f��WYdd}~XnX|dkr�|j�|dkr�|jd|||f��||fS)Nrzcommand: %s => %sr�z%s command error: %s %s)r��_get_tagged_responser?r>)rRr�r�r�r�r�r<r<r=�_command_complete�s"$zIMAP4._command_completecCsJ|j�\}}|dgkr |jd��t|d|j�}|j�}t|j��|_dS)Nz"no CAPABILITY response from serverr}r�)r�r>r�rXr��tuple�splitrh)rRr�r�r<r<r=rfs

zIMAP4._get_capabilitiescCs�|j�}|j|j|�rp|jjd�}||jkr:|jd|��|jjd�}t||j�}|jjd�}||gf|j|<n�d}|jt	|�s�|j|j
|�r�|jjd�}|jdkr�|jt|�r�|jjd�|_dS|jd|��|jjd�}t||j�}|jjd�}|dk�rd}|�r|d|}xH|j|j
|��r\t|jjd	��}|j|�}|j|||f�|j�}�qW|j||�|d
k�r�|jt|��r�|jjd�}t||j�}|j||jjd��|S)Nr�zunexpected tagged response: %rr�r�Zdata2zunexpected response: %rr�r�r|rar�r�)rar�r�)�	_get_line�_matchrd�mo�grouprFr?r�rX�Untagged_responser_�ContinuationrHr]�intr{r��
Response_code)rR�respr�r�r�Zdat2r|r�r<r<r=resH



zIMAP4._get_responsecCsdx^|j|}|dk	r |j|=|S|j�y|j�Wq|jk
rZ}z�WYdd}~XqXqWdS)N)rFr�rer?)rRr��resultr�r<r<r=r�`s
zIMAP4._get_tagged_responsecCs>|j�}|s|jd��|jd�s.|jd|��|dd�}|S)Nzsocket error: EOFs
z#socket error: unterminated line: %rr����)r~r?�endswith)rRr�r<r<r=r{s

zIMAP4._get_linecCs|j|�|_|jdk	S)N)�matchr)rRZcre�sr<r<r=r�szIMAP4._matchcCs2|jtt|j�|j�}|jd|_d|j|<|S)Nr})rcr�r�rJrXrF)rRr�r<r<r=r��s
zIMAP4._new_tagcCs$|jdd�}|jdd�}d|dS)N�\z\\�"z\")r�)rRr�r<r<r=r��szIMAP4._quotecGs|j||j|f|���S)N)r�r�)rRr�rsr<r<r=r��szIMAP4._simple_commandcCs8|dkr||fS||jkr$|dgfS|jj|�}||fS)Nr�)rG�pop)rRr�r�r�r�r<r<r=r��s

zIMAP4._untagged_response)r�r�)r�r�)r�F)N)Pr9r:r;�__doc__rOr>r?r@�
IMAP4_PORTrUrLr`rNrprqrtrvrMr{r~r�rPrur�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rfrer�rrr�r�r�r�r<r<r<r=r�s�,*
		
	



 	

M	Pc@s:eZdZdZdedddfdd�Zdd�Zdefdd	�ZdS)
�	IMAP4_SSLa3IMAP4 client class over SSL connection

        Instantiate with: IMAP4_SSL([host[, port[, keyfile[, certfile[, ssl_context]]]]])

                host - host's name (default: localhost);
                port - port number (default: standard IMAP4 SSL port);
                keyfile - PEM formatted file that contains your private key (default: None);
                certfile - PEM formatted certificate chain file (default: None);
                ssl_context - a SSLContext object that contains your certificate chain
                              and private key (default: None)
                Note: if ssl_context is provided, then parameters keyfile or
                certfile should not be set otherwise ValueError is raised.

        for more documentation see the docstring of the parent class IMAP4.
        rANcCs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}|jdtd�||_||_|dkrxtj||d�}||_t	j
|||�dS)Nz8ssl_context and keyfile arguments are mutually exclusivez9ssl_context and certfile arguments are mutually exclusiverzEkeyfile and certfile are deprecated, use a custom ssl_context insteadr�)�certfile�keyfile)�
ValueError�warnings�warn�DeprecationWarningrrr�r�r�rrU)rRrSrTrrr�rr<r<r=rU�szIMAP4_SSL.__init__cCstj|�}|jj||jd�S)N)r�)rrvr�r�rS)rRrxr<r<r=rv
s
zIMAP4_SSL._create_socketcCstj|||�dS)z�Setup connection to remote server on "host:port".
                (default: localhost:standard IMAP4 SSL port).
            This connection will be used by the routines:
                read, readline, send, shutdown.
            N)rrM)rRrSrTr<r<r=rMszIMAP4_SSL.open)r9r:r;r�IMAP4_SSL_PORTrUrvrMr<r<r<r=r�s
rc@sBeZdZdZdd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)rz�IMAP4 client class over a stream

    Instantiate with: IMAP4_stream(command)

            "command" - a string that can be passed to subprocess.Popen()

    for more documentation see the docstring of the parent class IMAP4.
    cCs||_tj|�dS)N)r�rrU)rRr�r<r<r=rU&szIMAP4_stream.__init__NcCsNd|_d|_d|_d|_tj|jttjtjddd�|_	|j	j
|_|j	j|_
dS)z�Setup a stream connection.
        This connection will be used by the routines:
            read, readline, send, shutdown.
        NT)�bufsize�stdin�stdout�shellZ	close_fds)rSrTrxrz�
subprocess�Popenr�r�PIPEr�r�	writefiler�readfile)rRrSrTr<r<r=rM+s
zIMAP4_stream.opencCs|jj|�S)zRead 'size' bytes from remote.)r#r{)rRr|r<r<r=r{;szIMAP4_stream.readcCs
|jj�S)zRead line from remote.)r#r~)rRr<r<r=r~@szIMAP4_stream.readlinecCs|jj|�|jj�dS)zSend data to remote.N)r"�write�flush)rRr�r<r<r=r�EszIMAP4_stream.sendcCs"|jj�|jj�|jj�dS)z Close I/O established in "open".N)r#r�r"r��wait)rRr<r<r=rPKs

zIMAP4_stream.shutdown)NN)
r9r:r;rrUrMr{r~r�rPr<r<r<r=rs	
c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r�zcPrivate class to provide en/decoding
            for base64-based authentication conversation.
    cCs
||_dS)N)r�)rRZmechinstr<r<r=rUYsz_Authenticator.__init__cCs&|j|j|��}|dkrdS|j|�S)N�*)r�r�r�)rRr�Zretr<r<r=r�\sz_Authenticator.processcCsrd}t|t�r|jd�}xT|rlt|�dkrD|dd�}|dd�}n|}d}tj|�}|r||dd�}qW|S)Nr�zutf-8�0r}r�)r�r�r�r��binasciiZ
b2a_base64)rR�inpZoup�t�er<r<r=r�bs	


z_Authenticator.encodecCs|sdStj|�S)Nr�)r)Z
a2b_base64)rRr*r<r<r=r�zsz_Authenticator.decodeN)r9r:r;rrUr�r�r�r<r<r<r=r�Ss
r�z0 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Decr�cCsi|]\}}|d|j��qS)r})r�)�.0�nr
r<r<r=�
<dictcomp>�sr/r}c	Cs�tj|�}|sdSt|jd�}|jd�}t|jd��}t|jd��}t|jd��}t|jd��}t|jd��}t|jd	��}	t|jd
��}
|	d|
d}|dkr�|}||||||dddf	}tj|�|}
tj|
�S)z�Parse an IMAP4 INTERNALDATE string.

    Return corresponding local time.  The return value is a
    time.struct_time tuple or None if the string has wrong format.
    N�mon�zonen�day�year�hour�min�sec�zoneh�zonem�<�-r}r�r�r�)	�InternalDater�Mon2numrr�calendarZtimegm�time�	localtime)rrr0r1r2r3r4r5r6r7r8ZzoneZtt�utcr<r<r=r�s$

cCsDd}d}tt|��}x*|r>t|d�\}}|||d�|}qW|S)z-Convert integer to A-P string representation.r�sABCDEFGHIJKLMNOP�r})r�abs�divmod)Znumr�ZAP�modr<r<r=r	�scCs$tj|�}|sfSt|jd�j��S)z-Convert IMAP4 flags response to python tuple.r�)�Flagsrr�rr�)rrr<r<r=r
�s
c
Cs t|ttf�r"tj|tj�j�}n�t|t�r�y
|j	}WnZt
k
r�tjr�|d}|dkrptj
tj|��d}tjtjf|}ntj}YnXt|d�}t|dd�dt|�i�}nNt|t�r�|jdkr�td��|}n,t|t�o�|d|d
fdk�r�|Std
��djt|j�}|j|�S)a�Convert date_time to IMAP4 INTERNALDATE representation.

    Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'.  The
    date_time argument can be a number (int or float) representing
    seconds since epoch (as returned by time.time()), a 9-tuple
    representing local time, an instance of time.struct_time (as
    returned by time.localtime()), an aware datetime instance or a
    double-quoted string.  In the last case, it is assumed to already
    be in the correct format.
    �r})ZsecondsN��tzinfozdate_time must be awarerrzdate_time not of a known typez"%d-{}-%Y %H:%M:%S %z"r�r�)rr)r�r�floatrZ
fromtimestamprr@Z
astimezoner�Z	tm_gmtoffrnr>Zdaylightr?ZmktimeZaltzonerrHrr��format�MonthsZmonthZstrftime)r�ZdtZgmtoff�dstZdeltaZfmtr<r<r=r�s0




 �__main__zd:s:z-dz-srAzIMAP password for %s on %s: Z	localhostzJFrom: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)s�
)r�Zlfr�r��
/tmp/xxx 1r��/tmp/yyyr�
/tmp/yyz 2r�r��/tmp�yy*r�r��SUBJECT�testr��1�(FLAGS INTERNALDATE RFC822)r��FLAGS�
(\Deleted)r�r�r�r�r��UIDVALIDITYr�r,�ALLr�rrcCsLtjd||f�tt|�|�\}}tjd|||f�|dkrH|d�|S)Nz%s %sz%s => %s %sr�r)�M�_mesgrl)�cmdrsr�r�r<r<r=�runsr_zPROTOCOL_VERSION = %szCAPABILITIES = %r�/tmp/�yy%z.*"([^"]+)"$r�rz%sz:(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)z
All tests OK.z
Tests failed.z8
If you would like to see debugging output,
try: %s -d5
)r
r)rr)r)rrrr)r)r)r)rr)rr)rr)r)rr)r)r)rr)rr)rr)rr)rr)rr)r)rrrr)rr)r)rr)rrrr)r)r)rr)r)rr)rr)rr)rr)r)r)rr)r)rr)r)r)rr)rA�rO)r�rb�rOrP)r�rc�rQ)rrd�rRrS)r�re�rQ)r�rf�NrTrU)r�rg�rVrW)r�rh�rVrXrY)r�ri�rZ)r�rj�r,r[)r�rk�r�)r�rl)r`rar��r,r[)r�rmr�r�)Ur�__version__r)r�rbrYrurr�r>r=rrr�iorr�r��ImportError�__all__r�rBrrrgrrkrZrrEr;r\r]r�rrr_r[r^rrr�rr�r�rK�	enumerater<rr	r
rr9ZgetoptZgetpass�argvZoptlistrsr>r�Zstream_command�optrrSZgetuserZUSERZPASSWDZ	test_mesgZ	test_seq1Z	test_seq2r_r\rDr]rirhr^Zmlrrr�pathr�r��printr<r<r<r=�<module>sFH

	



	


c4
9,
#
)








warnings.cpython-36.opt-2.pyc000064400000024060150335715140011770 0ustar003


 \8H�
@sddlZdddddddd	gZd:d
d�Zd;dd�Zdd
�Zdd�ZeZdd�ZeZdd�Z	de
dddfdd�Ze
ddfdd�Zdd�Z
dd�ZGdd�de�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd<d*d�Zd=d+d�ZGd,d-�d-e�ZGd.d	�d	e�ZdZy0dd/lmZmZm Z mZmZm!Z!eZ"e Z#d0ZWn.e$k
�rbgZd1Z"iZ#d)a%d2d3�Z!YnXeej&�e�s�e'e(gZ)e)j*e+�xe)D]Z,ed4e,d5��q�Wej-j.Z.e.d)k�r�d6Z/ne.�r�d1Z/nd4Z/ee/e0d)d7�e1ed8��r�d9Z2nd4Z2ee2e3d)d7�[dS)>�N�warn�
warn_explicit�showwarning�
formatwarning�filterwarnings�simplefilter�
resetwarnings�catch_warningscCst||||||�}t|�dS)N)�WarningMessage�_showwarnmsg_impl)�message�category�filename�lineno�file�line�msg�r� /usr/lib64/python3.6/warnings.pyr
scCst||||d|�}t|�S)N)r
�_formatwarnmsg_impl)rr
rrrrrrrrscCsP|j}|dkr tj}|dkr dSt|�}y|j|�Wntk
rJYnXdS)N)r�sys�stderr�_formatwarnmsg�write�OSError)rr�textrrrrsrcCsLd|j|j|jj|jf}|jdkr`yddl}|j|j|j�}Wqftk
r\d}d}YqfXn|j}|r~|j	�}|d|7}|j
dk	�rHyddl}|j|j
�}Wntk
r�d}YnX|dk	�rH|d7}xx|D]p}|d|j|jf7}y$|dk	�r
|j|j|j�}nd}Wntk
�r*d}YnX|r�|j	�}|d|7}q�W|S)Nz%s:%s: %s: %s
rz  %s
z.Object allocated at (most recent call first):
z  File "%s", lineno %s
z    %s
)
rrr
�__name__rr�	linecache�getline�	Exception�strip�source�tracemalloc�get_object_traceback)r�srrr"�tb�framerrrr#sF






rcCsdyt}Wntk
rYn<X|tk	rXt|�s6td��||j|j|j|j|j	|j
�dSt|�dS)Nz:warnings.showwarning() must be set to a function or method)r�	NameError�_showwarning_orig�callable�	TypeErrorrr
rrrrr)r�swrrr�_showwarnmsgUsr,cCsJyt}Wntk
rYn&X|tk	rB||j|j|j|j|jd�St|�S)N)r)	rr'�_formatwarning_origrr
rrrr)r�fwrrrrjs
r�FcCs0ddl}t||j||j�||j|�||d�dS)Nr)�append)�re�_add_filter�compile�I)�actionrr
�modulerr0r1rrrrws	cCst|d|d||d�dS)N)r0)r2)r5r
rr0rrrr�scGsR|s6ytj|�Wntk
r&YnXtjd|�n|tkrHtj|�t�dS)Nr)�filters�remove�
ValueError�insertr0�_filters_mutated)r0�itemrrrr2�s
r2cCsgtdd�<t�dS)N)r7r;rrrrr�sc@seZdZdS)�_OptionErrorN)r�
__module__�__qualname__rrrrr=�sr=cCsRxL|D]D}yt|�Wqtk
rH}ztd|tjd�WYdd}~XqXqWdS)NzInvalid -W option ignored:)r)�
_setoptionr=�printrr)�args�argrrrr�_processoptions�s

rDcCs�ddl}|jd�}t|�dkr,td|f��xt|�dkrF|jd�q.Wdd�|D�\}}}}}t|�}|j|�}t|�}|j|�}|r�|d}|r�yt|�}|dkr�t	�Wq�t	t
fk
r�td	|f��Yq�Xnd}t|||||�dS)
Nr�:�ztoo many fields (max 5): %rr/cSsg|]}|j��qSr)r )�.0r$rrr�
<listcomp>�sz_setoption.<locals>.<listcomp>�$zinvalid lineno %r)r1�split�lenr=r0�
_getaction�escape�_getcategory�intr9�
OverflowErrorr)rCr1�partsr5rr
r6rrrrr@�s.


r@cCsB|sdS|dkrdSxd	D]}|j|�r|SqWtd|f��dS)
N�default�all�always�ignorer6�once�errorzinvalid action: %r)rRrTrUr6rVrW)�
startswithr=)r5�arrrrL�s

rLcCs�ddl}|stS|jd|�rNyt|�}Wq�tk
rJtd|f��Yq�Xn�|jd�}|d|�}||dd�}yt|dd|g�}Wn"tk
r�td|f��YnXyt	||�}Wn"t
k
r�td|f��YnXt|t�s�td|f��|S)Nrz^[a-zA-Z0-9_]+$zunknown warning category: %r�.�zinvalid module name: %rzinvalid warning category: %r)r1�Warning�match�evalr'r=�rfind�
__import__�ImportError�getattr�AttributeError�
issubclass)r
r1�cat�ir6�klass�mrrrrN�s,

rNcCs|jj}d|kod|kS)N�	importlib�
_bootstrap)�f_code�co_filename)r&rrrr�_is_internal_frame�srmcCs&|j}x|dk	r t|�r |j}qW|S)N)�f_backrm)r&rrr�_next_external_frames
ror[cCsvt|t�r|j}|dkrt}t|t�o.t|t�sDtdjt|�j���yZ|dks\t	t
jd��rht
j|�}n4t
jd�}x(t|d�D]}t
|�}|dkr�t�q�WWntk
r�t
j}d}YnX|j}|j}d|kr�|d}nd}|jd�}	|	�r|	j�}
|
jd��rP|	dd
�}	n>|dk�rFyt
jd}	Wntk
�rDd}	YnX|	�sP|}	|jd	i�}t|||	|||||�dS)Nz/category must be a Warning subclass, not '{:s}'r[rz<string>�__file__z.pyc�__main__rZ__warningregistry__���)�
isinstancer\�	__class__�UserWarning�typerdr*�formatrrmr�	_getframe�rangeror9�__dict__�	f_globals�f_lineno�get�lower�endswith�argvrc�
setdefaultr)rr
�
stacklevelr!r&�x�globalsrr6rZfnl�registryrrrr
sL






cCs�t|�}|dkr8|pd}|dd�j�dkr8|dd�}|dkrDi}|jdd�tkrd|j�t|d<t|t�r~t|�}|j}n|}||�}|||f}	|j|	�r�dSx^t	D]R}
|
\}}}
}}|dks�|j
|�r�t||
�r�|dks�|j
|�r�|dks�||kr�Pq�Wt}|dk�rd||	<dSddl
}|j||�|dk�r:|�|d	k�rnd||	<||f}tj|��rddSdt|<nf|d
k�rznZ|dk�r�d||	<||df}|j|��r�dSd||<n$|dk�r�d||	<ntd
||
f��t|||||�}t|�dS)Nz	<unknown>�z.py�versionrrUr[rWrVrTr6rRz1Unrecognized action (%r) in warnings.filters:
 %s���r�)rOr~r}�_filters_version�clearrsr\�strrtr7r]rd�
defaultactionr�getlines�onceregistry�RuntimeErrorr
r,)rr
rrr6r��module_globalsr!r�keyr<r5rre�mod�lnrZoncekeyZaltkeyrrrrAsl














c@s"eZdZd
Zdd	d
�Zdd�ZdS)r
rr
rrrrr!Nc
Cs:t�}x|jD]}	t||	||	�qW|r0|jnd|_dS)N)�locals�_WARNING_DETAILS�setattrr�_category_name)
�selfrr
rrrrr!�local_values�attrrrr�__init__�szWarningMessage.__init__cCsd|j|j|j|j|jfS)NzD{message : %r, category : %r, filename : %r, lineno : %s, line : %r})rr�rrr)r�rrr�__str__�szWarningMessage.__str__)rr
rrrrr!)NNN)rr>r?r�r�r�rrrrr
�s

r
c@s4eZdZddd�dd�Zdd�Zdd	�Zd
d�ZdS)r	FN)�recordr6cCs(||_|dkrtjdn||_d|_dS)N�warningsF)�_recordr�modules�_module�_entered)r�r�r6rrrr��szcatch_warnings.__init__cCsPg}|jr|jd�|jtjdk	r4|jd|j�t|�j}d|dj|�fS)Nzrecord=Truer�z	module=%rz%s(%s)z, )r�r0r�rr�rvr�join)r�rB�namerrr�__repr__�s

zcatch_warnings.__repr__cCs~|jrtd|��d|_|jj|_|jdd�|j_|jj�|jj|_|jj|_|j	rvg}|j
|j_|jj|j_|SdSdS)NzCannot enter %r twiceT)r�r�r�r7�_filtersr;r�_showwarningrr�r0r()r��logrrr�	__enter__�s




zcatch_warnings.__enter__cGs>|jstd|��|j|j_|jj�|j|j_|j|j_dS)Nz%Cannot exit %r without entering first)	r�r�r�r�r7r;r�rr)r��exc_inforrr�__exit__�s


zcatch_warnings.__exit__)rr>r?r�r�r�r�rrrrr	�s	)r7�_defaultaction�
_onceregistryrrr;TrRcCstd7adS)Nr[)r�rrrrr;�sr;rU)r
rW)r
r0�gettotalrefcountrT)NN)N)Nr[N)NNNN)4r�__all__rrrrr(r,r-rr\rrr2rrr=rDr@rLrNrmrorr�objectr
r	Z_warnings_defaults�	_warningsr7r�r�r;r�r�rar��warnoptions�
ImportWarning�PendingDeprecationWarningZsilencer0�DeprecationWarning�cls�flags�
bytes_warningZbytes_action�BytesWarning�hasattrZresource_action�ResourceWarningrrrr�<module>st

0

	
5
FJ 



shelve.cpython-36.opt-1.pyc000064400000022364150335715140011432 0ustar003


 \C!�@s�dZddlmZmZddlmZddlZddddgZGd	d
�d
ej�Z	Gdd�dej�Z
Gdd�de
�ZGd
d�de
�Zddd�Z
dS)a�
Manage shelves of pickled objects.

A "shelf" is a persistent, dictionary-like object.  The difference
with dbm databases is that the values (not the keys!) in a shelf can
be essentially arbitrary Python objects -- anything that the "pickle"
module can handle.  This includes most class instances, recursive data
types, and objects containing lots of shared sub-objects.  The keys
are ordinary strings.

To summarize the interface (key is a string, data is an arbitrary
object):

        import shelve
        d = shelve.open(filename) # open, with (g)dbm filename -- no suffix

        d[key] = data   # store data at key (overwrites old data if
                        # using an existing key)
        data = d[key]   # retrieve a COPY of the data at key (raise
                        # KeyError if no such key) -- NOTE that this
                        # access returns a *copy* of the entry!
        del d[key]      # delete data stored at key (raises KeyError
                        # if no such key)
        flag = key in d # true if the key exists
        list = d.keys() # a list of all existing keys (slow!)

        d.close()       # close it

Dependent on the implementation, closing a persistent dictionary may
or may not be necessary to flush changes to disk.

Normally, d[key] returns a COPY of the entry.  This needs care when
mutable entries are mutated: for example, if d[key] is a list,
        d[key].append(anitem)
does NOT modify the entry d[key] itself, as stored in the persistent
mapping -- it only modifies the copy, which is then immediately
discarded, so that the append has NO effect whatsoever.  To append an
item to d[key] in a way that will affect the persistent mapping, use:
        data = d[key]
        data.append(anitem)
        d[key] = data

To avoid the problem with mutable entries, you may pass the keyword
argument writeback=True in the call to shelve.open.  When you use:
        d = shelve.open(filename, writeback=True)
then d keeps a cache of all entries you access, and writes them all back
to the persistent mapping when you call d.close().  This ensures that
such usage as d[key].append(anitem) works as intended.

However, using keyword argument writeback=True may consume vast amount
of memory for the cache, and it may make d.close() very slow, if you
access many of d's entries after opening it in this way: d has no way to
check which of the entries you access are mutable and/or which ones you
actually mutate, so it must cache, and write back at close, all of the
entries that you access.  You can call d.sync() to write back all the
entries in the cache, and empty the cache (d.sync() also synchronizes
the persistent dictionary on disk, if feasible).
�)�Pickler�	Unpickler)�BytesION�Shelf�
BsdDbShelf�DbfilenameShelf�openc@s8eZdZdZdd�ZeZZZZZ	Z
dd�ZdS)�_ClosedDictz>Marker for a closed dict.  Access attempts raise a ValueError.cGstd��dS)Nz!invalid operation on closed shelf)�
ValueError)�self�args�r
�/usr/lib64/python3.6/shelve.py�closedEsz_ClosedDict.closedcCsdS)Nz<Closed Dictionary>r
)rr
r
r�__repr__Isz_ClosedDict.__repr__N)�__name__�
__module__�__qualname__�__doc__r�__iter__�__len__�__getitem__�__setitem__�__delitem__�keysrr
r
r
rr	Bsr	c@s|eZdZdZddd�Zdd�Zd	d
�Zdd�Zd d
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)!rz�Base class for shelf implementations.

    This is initialized with a dictionary-like object.
    See the module's __doc__ string for an overview of the interface.
    NF�utf-8cCs.||_|dkrd}||_||_i|_||_dS)N�)�dict�	_protocol�	writeback�cache�keyencoding)rr�protocolrr!r
r
r�__init__TszShelf.__init__ccs&x |jj�D]}|j|j�VqWdS)N)rr�decoder!)r�kr
r
rr^szShelf.__iter__cCs
t|j�S)N)�lenr)rr
r
rrbsz
Shelf.__len__cCs|j|j�|jkS)N)�encoder!r)r�keyr
r
r�__contains__eszShelf.__contains__cCs|j|j�|jkr||S|S)N)r'r!r)rr(�defaultr
r
r�gethsz	Shelf.getcCsZy|j|}WnFtk
rTt|j|j|j��}t|�j�}|jrP||j|<YnX|S)N)	r �KeyErrorrrr'r!r�loadr)rr(�value�fr
r
rrmszShelf.__getitem__cCsF|jr||j|<t�}t||j�}|j|�|j�|j|j|j	�<dS)N)
rr rrr�dump�getvaluerr'r!)rr(r.r/�pr
r
rrws

zShelf.__setitem__cCs6|j|j|j�=y|j|=Wntk
r0YnXdS)N)rr'r!r r,)rr(r
r
rrs
zShelf.__delitem__cCs|S)Nr
)rr
r
r�	__enter__�szShelf.__enter__cCs|j�dS)N)�close)r�typer.�	tracebackr
r
r�__exit__�szShelf.__exit__cCsf|jdkrdSz0|j�y|jj�Wntk
r:YnXWdyt�|_Wnd|_YnXXdS)N)r�syncr4�AttributeErrorr	)rr
r
rr4�s

zShelf.closecCst|d�sdS|j�dS)Nr)�hasattrr4)rr
r
r�__del__�s
z
Shelf.__del__cCsX|jr>|jr>d|_x|jj�D]\}}|||<qWd|_i|_t|jd�rT|jj�dS)NFTr8)rr �itemsr:rr8)rr(�entryr
r
rr8�sz
Shelf.sync)NFr)N)rrrrr#rrr)r+rrrr3r7r4r;r8r
r
r
rrMs
	

c@sBeZdZdZddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dS)ra�Shelf implementation using the "BSD" db interface.

    This adds methods first(), next(), previous(), last() and
    set_location() that have no counterpart in [g]dbm databases.

    The actual database must be opened using one of the "bsddb"
    modules "open" routines (i.e. bsddb.hashopen, bsddb.btopen or
    bsddb.rnopen) and passed to the constructor.

    See the module's __doc__ string for an overview of the interface.
    NF�utf-8cCstj|||||�dS)N)rr#)rrr"rr!r
r
rr#�szBsdDbShelf.__init__cCs0|jj|�\}}t|�}|j|j�t|�j�fS)N)r�set_locationrr$r!rr-)rr(r.r/r
r
rr?�szBsdDbShelf.set_locationcCs.t|j�\}}t|�}|j|j�t|�j�fS)N)�nextrrr$r!rr-)rr(r.r/r
r
rr@�szBsdDbShelf.nextcCs.|jj�\}}t|�}|j|j�t|�j�fS)N)r�previousrr$r!rr-)rr(r.r/r
r
rrA�szBsdDbShelf.previouscCs.|jj�\}}t|�}|j|j�t|�j�fS)N)r�firstrr$r!rr-)rr(r.r/r
r
rrB�szBsdDbShelf.firstcCs.|jj�\}}t|�}|j|j�t|�j�fS)N)r�lastrr$r!rr-)rr(r.r/r
r
rrC�szBsdDbShelf.last)NFr>)
rrrrr#r?r@rArBrCr
r
r
rr�s
c@seZdZdZddd�ZdS)rz�Shelf implementation using the "dbm" generic dbm interface.

    This is initialized with the filename for the dbm database.
    See the module's __doc__ string for an overview of the interface.
    �cNFcCs$ddl}tj||j||�||�dS)Nr)�dbmrr#r)r�filename�flagr"rrEr
r
rr#�szDbfilenameShelf.__init__)rDNF)rrrrr#r
r
r
rr�srDFcCst||||�S)a�Open a persistent dictionary for reading and writing.

    The filename parameter is the base filename for the underlying
    database.  As a side-effect, an extension may be added to the
    filename and more than one file may be created.  The optional flag
    parameter has the same interpretation as the flag parameter of
    dbm.open(). The optional protocol parameter specifies the
    version of the pickle protocol.

    See the module's __doc__ string for an overview of the interface.
    )r)rFrGr"rr
r
rr�s
)rDNF)r�picklerr�ior�collections�__all__�MutableMappingr	rrrrr
r
r
r�<module>9sb+weakref.cpython-36.pyc000064400000045311150335715140010626 0ustar003


 \�O�
@s�dZddlmZmZmZmZmZmZmZm	Z	ddl
mZmZddl
Z
ddlZddlZeefZddddd	d
ddd
ddddg
ZGdd�de�ZGdd�de
j�ZGdd�de�ZGdd	�d	e
j�ZGdd�d�ZdS)z{Weak reference support for Python.

This module is an implementation of PEP 205:

http://www.python.org/dev/peps/pep-0205/
�)�getweakrefcount�getweakrefs�ref�proxy�CallableProxyType�	ProxyType�
ReferenceType�_remove_dead_weakref)�WeakSet�_IterationGuardNrrrr�WeakKeyDictionaryrrr�
ProxyTypes�WeakValueDictionaryr
�
WeakMethod�finalizecsDeZdZdZdZddd�Z�fd	d
�Zdd�Zd
d�Ze	j
Z
�ZS)rz�
    A custom `weakref.ref` subclass which simulates a weak reference to
    a bound method, working around the lifetime problem of bound methods.
    �	_func_ref�
_meth_type�_alive�__weakref__Ncs~y|j}|j}Wn(tk
r8tdjt|���d�YnX��fdd�}tj|||�}t||�|_t|�|_	d|_
t|��|S)Nz)argument should be a bound method, not {}cs&��}|jr"d|_�dk	r"�|�dS)NF)r)�arg�self)�callback�self_wr��/usr/lib64/python3.6/weakref.py�_cb3s
zWeakMethod.__new__.<locals>._cbT)�__self__�__func__�AttributeError�	TypeError�format�typer�__new__rrr)�cls�methr�obj�funcrrr)rrrr",s

zWeakMethod.__new__cs2t�j�}|j�}|dks"|dkr&dS|j||�S)N)�super�__call__rr)rr%r&)�	__class__rrr(Bs

zWeakMethod.__call__cCs>t|t�r:|js|jr"||kStj||�o8|j|jkSdS)NF)�
isinstancerrr�__eq__r)r�otherrrrr+Is

zWeakMethod.__eq__cCs>t|t�r:|js|jr"||k	Stj||�p8|j|jkSdS)NT)r*rrr�__ne__r)rr,rrrr-Ps

zWeakMethod.__ne__)rrrr)N)�__name__�
__module__�__qualname__�__doc__�	__slots__r"r(r+r-r�__hash__�
__classcell__rr)r)rr$s
c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZeZ
dd�Zd+dd�Zdd�Zdd�ZeZdd�Zdd �Zd!d"�Zd#d$�Zd,d%d&�Zd'd(�Zd)d*�ZdS)-rz�Mapping class that references values weakly.

    Entries in the dictionary will be discarded when no strong
    reference to the value exists anymore
    cst|std��|^}}t|�dkr0tdt|���t|�tf�fdd�	}||_g|_t�|_i|_�|j	||�dS)NzGdescriptor '__init__' of 'WeakValueDictionary' object needs an argument�z$expected at most 1 arguments, got %dcs4|�}|dk	r0|jr$|jj|j�n|�|j�dS)N)�
_iterating�_pending_removals�append�key)�wr�selfref�_atomic_removalr)�drr�removems
z,WeakValueDictionary.__init__.<locals>.remove)
r�lenrr	�_remover7�setr6�data�update)�args�kwrr>r)r=r�__init__fs	
zWeakValueDictionary.__init__cCs,|j}|j}x|r&|j�}t||�qWdS)N)r7rB�popr	)r�lr=r9rrr�_commit_removals}s
z$WeakValueDictionary._commit_removalscCs4|jr|j�|j|�}|dkr,t|��n|SdS)N)r7rIrB�KeyError)rr9�orrr�__getitem__�s
zWeakValueDictionary.__getitem__cCs|jr|j�|j|=dS)N)r7rIrB)rr9rrr�__delitem__�szWeakValueDictionary.__delitem__cCs|jr|j�t|j�S)N)r7rIr?rB)rrrr�__len__�szWeakValueDictionary.__len__cCs<|jr|j�y|j|�}Wntk
r2dSX|dk	S)NF)r7rIrBrJ)rr9rKrrr�__contains__�sz WeakValueDictionary.__contains__cCsd|jjt|�fS)Nz<%s at %#x>)r)r.�id)rrrr�__repr__�szWeakValueDictionary.__repr__cCs&|jr|j�t||j|�|j|<dS)N)r7rI�KeyedRefr@rB)rr9�valuerrr�__setitem__�szWeakValueDictionary.__setitem__cCsF|jr|j�t�}x,|jj�D]\}}|�}|dk	r |||<q W|S)N)r7rIrrB�items)r�newr9r:rKrrr�copy�szWeakValueDictionary.copycCsZddlm}|jr|j�|j�}x2|jj�D]$\}}|�}|dk	r.|||||�<q.W|S)Nr)�deepcopy)rWrXr7rIr)rBrU)r�memorXrVr9r:rKrrr�__deepcopy__�sz WeakValueDictionary.__deepcopy__NcCsL|jr|j�y|j|}Wntk
r0|SX|�}|dkrD|S|SdS)N)r7rIrBrJ)rr9�defaultr:rKrrr�get�szWeakValueDictionary.getc
csV|jr|j�t|��6x.|jj�D] \}}|�}|dk	r$||fVq$WWdQRXdS)N)r7rIrrBrU)r�kr:�vrrrrU�s
zWeakValueDictionary.itemsc
csN|jr|j�t|��.x&|jj�D]\}}|�dk	r$|Vq$WWdQRXdS)N)r7rIrrBrU)rr]r:rrr�keys�s

zWeakValueDictionary.keysc	cs6|jr|j�t|��|jj�EdHWdQRXdS)a�Return an iterator that yields the weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        N)r7rIrrB�values)rrrr�
itervaluerefs�s

z!WeakValueDictionary.itervaluerefsc
csN|jr|j�t|��.x&|jj�D]}|�}|dk	r$|Vq$WWdQRXdS)N)r7rIrrBr`)rr:r%rrrr`�s
zWeakValueDictionary.valuescCs<|jr|j�x(|jj�\}}|�}|dk	r||fSqWdS)N)r7rIrB�popitem)rr9r:rKrrrrb�szWeakValueDictionary.popitemcGs`|jr|j�y|jj|��}Wntk
r8d}YnX|dkrX|rN|dSt|��n|SdS)Nr)r7rIrBrGrJ)rr9rDrKrrrrGs

zWeakValueDictionary.popcCs`y|j|�}Wntk
r(d}YnX|dkrX|jr@|j�t||j|�|j|<|S|SdS)N)rBrJr7rIrRr@)rr9r[rKrrr�
setdefaults
zWeakValueDictionary.setdefaultcOs�|std��|^}}t|�dkr0tdt|���|r<|dnd}|jrN|j�|j}|dk	r�t|d�srti�|�}x&|j�D]\}}t||j	|�||<q|Wt|�r�|j
|�dS)NzEdescriptor 'update' of 'WeakValueDictionary' object needs an argumentr5z$expected at most 1 arguments, got %drrU)rr?r7rIrB�hasattrr!rUrRr@rC)rD�kwargsr�dictr=r9rKrrrrC s 
zWeakValueDictionary.updatecCs|jr|j�t|jj��S)a~Return a list of weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        )r7rI�listrBr`)rrrr�	valuerefs3s
zWeakValueDictionary.valuerefs)N)N)r.r/r0r1rFrIrLrMrNrOrQrTrW�__copy__rZr\rUr_�__iter__rar`rbrGrcrCrhrrrrrZs.			

			

cs,eZdZdZdZdd�Z�fdd�Z�ZS)rRa[Specialized reference that includes a key corresponding to the value.

    This is used in the WeakValueDictionary to avoid having to create
    a function object for each key stored in the mapping.  A shared
    callback object can use the 'key' attribute of a KeyedRef instead
    of getting a reference to the key from an enclosing scope.

    r9cCstj|||�}||_|S)N)rr"r9)r!�obrr9rrrrr"NszKeyedRef.__new__cst�j||�dS)N)r'rF)rrkrr9)r)rrrFSszKeyedRef.__init__)r9)r.r/r0r1r2r"rFr4rr)r)rrRBsrRc@s�eZdZdZd+dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZeZ
dd�Zd,dd�Zdd�Zdd�Zdd�ZeZdd �Zd!d"�Zd#d$�Zd%d&�Zd-d'd(�Zd.d)d*�ZdS)/ra� Mapping class that references keys weakly.

    Entries in the dictionary will be discarded when there is no
    longer a strong reference to the key. This can be used to
    associate additional data with an object owned by other parts of
    an application without adding attributes to those objects. This
    can be especially useful with objects that override attribute
    accesses.
    NcCsFi|_t|�fdd�}||_g|_t�|_d|_|dk	rB|j|�dS)NcSs.|�}|dk	r*|jr"|jj|�n|j|=dS)N)r6r7r8rB)r]r;rrrrr>ds
z*WeakKeyDictionary.__init__.<locals>.removeF)rBrr@r7rAr6�
_dirty_lenrC)rrfr>rrrrFbszWeakKeyDictionary.__init__cCs>|j}|j}x,|r8y||j�=Wqtk
r4YqXqWdS)N)r7rBrGrJ)rrHr=rrrrIssz"WeakKeyDictionary._commit_removalscs&|j��fdd�|jD�|_d|_dS)Ncsg|]}|�kr|�qSrr)�.0r])r=rr�
<listcomp>�sz5WeakKeyDictionary._scrub_removals.<locals>.<listcomp>F)rBr7rl)rr)r=r�_scrub_removals�sz!WeakKeyDictionary._scrub_removalscCsd|_|jt|�=dS)NT)rlrBr)rr9rrrrM�szWeakKeyDictionary.__delitem__cCs|jt|�S)N)rBr)rr9rrrrL�szWeakKeyDictionary.__getitem__cCs(|jr|jr|j�t|j�t|j�S)N)rlr7ror?rB)rrrrrN�szWeakKeyDictionary.__len__cCsd|jjt|�fS)Nz<%s at %#x>)r)r.rP)rrrrrQ�szWeakKeyDictionary.__repr__cCs||jt||j�<dS)N)rBrr@)rr9rSrrrrT�szWeakKeyDictionary.__setitem__cCs8t�}x,|jj�D]\}}|�}|dk	r|||<qW|S)N)rrBrU)rrVr9rSrKrrrrW�szWeakKeyDictionary.copycCsLddlm}|j�}x2|jj�D]$\}}|�}|dk	r |||�||<q W|S)Nr)rX)rWrXr)rBrU)rrYrXrVr9rSrKrrrrZ�szWeakKeyDictionary.__deepcopy__cCs|jjt|�|�S)N)rBr\r)rr9r[rrrr\�szWeakKeyDictionary.getcCs,yt|�}Wntk
r dSX||jkS)NF)rrrB)rr9r:rrrrO�s
zWeakKeyDictionary.__contains__c
csHt|��6x.|jj�D] \}}|�}|dk	r||fVqWWdQRXdS)N)rrBrU)rr:rSr9rrrrU�s

zWeakKeyDictionary.itemsc
cs<t|��*x"|jD]}|�}|dk	r|VqWWdQRXdS)N)rrB)rr:r%rrrr_�s

zWeakKeyDictionary.keysc
cs@t|��.x&|jj�D]\}}|�dk	r|VqWWdQRXdS)N)rrBrU)rr:rSrrrr`�s

zWeakKeyDictionary.valuescCs
t|j�S)azReturn a list of weak references to the keys.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the keys around longer than needed.

        )rgrB)rrrr�keyrefs�s
zWeakKeyDictionary.keyrefscCs4d|_x(|jj�\}}|�}|dk	r||fSqWdS)NT)rlrBrb)rr9rSrKrrrrb�szWeakKeyDictionary.popitemcGsd|_|jjt|�f|��S)NT)rlrBrGr)rr9rDrrrrG�szWeakKeyDictionary.popcCs|jjt||j�|�S)N)rBrcrr@)rr9r[rrrrc�szWeakKeyDictionary.setdefaultcKs`|j}|dk	rJt|d�s$ti�|�}x$|j�D]\}}||t||j�<q.Wt|�r\|j|�dS)NrU)rBrdr!rUrr@r?rC)rrfrer=r9rSrrrrC�s
zWeakKeyDictionary.update)N)N)N)N)r.r/r0r1rFrIrorMrLrNrQrTrWrirZr\rOrUr_rjr`rprbrGrcrCrrrrrWs.	

	

c@s�eZdZdZfZiZdZej�Z	dZ
dZGdd�d�Zdd�Z
ddd	�Zd
d�Zdd
�Zedd��Zedd��Zejdd��Zdd�Zedd��Zedd��ZdS)raClass for finalization of weakrefable objects

    finalize(obj, func, *args, **kwargs) returns a callable finalizer
    object which will be called when obj is garbage collected. The
    first time the finalizer is called it evaluates func(*arg, **kwargs)
    and returns the result. After this the finalizer is dead, and
    calling it just returns None.

    When the program exits any remaining finalizers for which the
    atexit attribute is true will be run in reverse order of creation.
    By default atexit is true.
    Fc@seZdZdZdS)	zfinalize._Info�weakrefr&rDre�atexit�indexN)rqr&rDrerrrs)r.r/r0r2rrrr�_InfosrtcOsp|js ddl}|j|j�dt_|j�}t||�|_||_||_	|pFd|_
d|_t|j�|_
||j|<dt_dS)NrT)�_registered_with_atexitrr�register�	_exitfuncrrtrrqr&rDre�next�_index_iterrs�	_registry�_dirty)rr%r&rDrerr�inforrrrFs

zfinalize.__init__NcCs2|jj|d�}|r.|jr.|j|j|jp*i�SdS)zZIf alive then mark as dead and return func(*args, **kwargs);
        otherwise return NoneN)rzrG�	_shutdownr&rDre)r�_r|rrrr(szfinalize.__call__cCsH|jj|�}|o|j�}|dk	rD|jj|d�rD||j|j|jp@ifSdS)z^If alive then mark as dead and return (obj, func, args, kwargs);
        otherwise return NoneN)rzr\rqrGr&rDre)rr|r%rrr�detach&szfinalize.detachcCs:|jj|�}|o|j�}|dk	r6||j|j|jp2ifSdS)zMIf alive then return (obj, func, args, kwargs);
        otherwise return NoneN)rzr\rqr&rDre)rr|r%rrr�peek.sz
finalize.peekcCs
||jkS)zWhether finalizer is alive)rz)rrrr�alive6szfinalize.alivecCs|jj|�}t|�o|jS)z*Whether finalizer should be called at exit)rzr\�boolrr)rr|rrrrr;szfinalize.atexitcCs|jj|�}|rt|�|_dS)N)rzr\r�rr)rrSr|rrrrrAscCs^|jj|�}|o|j�}|dkr6dt|�jt|�fSdt|�jt|�t|�jt|�fSdS)Nz<%s object at %#x; dead>z!<%s object at %#x; for %r at %#x>)rzr\rqr!r.rP)rr|r%rrrrQGszfinalize.__repr__cCs2dd�|jj�D�}|jdd�d�dd�|D�S)NcSsg|]\}}|jr||f�qSr)rr)rm�f�irrrrnSsz-finalize._select_for_exit.<locals>.<listcomp>cSs
|djS)Nr5)rs)�itemrrr�<lambda>Tsz+finalize._select_for_exit.<locals>.<lambda>)r9cSsg|]\}}|�qSrr)rmr�r�rrrrnUs)rzrU�sort)r#�Lrrr�_select_for_exitPszfinalize._select_for_exitcCs�d}z�|jr�ddl}|j�r(d}|j�d}xj|dks<tjrJ|j�}dt_|sPP|j�}y
|�Wn"tk
r�t	j
t	j��YnX||jks.t�q.WWddt_
|r�|j�XdS)NFrT)rz�gc�	isenabled�disablerr{r�rG�	Exception�sys�
excepthook�exc_info�AssertionErrorr}�enable)r#�reenable_gcr��pendingr�rrrrwWs.
zfinalize._exitfunc)N)r.r/r0r1r2rzr}�	itertools�countryr{rurtrFr(rr��propertyr�rr�setterrQ�classmethodr�rwrrrrr�s$
	)r1�_weakrefrrrrrrrr	�_weakrefsetr
r�collectionsr�r�r
�__all__r�MutableMappingrrRrrrrrr�<module>s"(

6issl.cpython-36.opt-1.pyc000064400000107120150335715140010737 0ustar003

�\dhݭ�@spdZddlZddlZddlZddlZddlZddlmZddlm	Z
mZm
ZddlZddlmZmZmZddlmZmZmZddlmZmZmZmZmZmZddlmZmZdd	lm Z m!Z!m"Z"m#Z#ydd
lm$Z$Wne%k
r�YnXddlm&Z&m'Z'm(Z(m)Z)m*Z*ddlm+Z+dd
lm,Z,ej-de.dd�ed�ej-de.dd�ed�ej-de.dd�ed�ej-de.dd�ed�ej-de.dd�ed�ej-de.dd�ed�e/j0Z1e/_1dd�e/j2j3�D�Z4e5e/dd�Z6ej7dk�r�dd lm8Z8m9Z9dd!l:m:Z:m;Z;m<Z<m=Z=dd"l:m>Z>m?Z?ddl@Z@ddlAZAddlBZBeCZDejE�r>d#gZFngZFe+ZGGd$d%�d%eH�ZIdRd'd(�ZJd)d*�ZKd+d,�ZLed-d.�ZMd/d0�ZNGd1d2�d2ed2d3��ZOGd4d5�d5eOe
�ZPGd6d7�d7e�ZQePjRfdddd8�d9d:�ZSe0feTd;ePjRdddddd<�d=d>�ZUeSZVeUZWGd?d@�d@�ZXGdAdB�dBe:�ZYddd;eTe0ddCdCdf	dDdE�ZZdFdG�Z[dHZ\dIZ]dJdK�Z^dLdM�Z_e0dfdNdO�Z`dPdQ�ZadS)Sa�
This module provides some more Pythonic support for SSL.

Object types:

  SSLSocket -- subtype of socket.socket which does SSL over the socket

Exceptions:

  SSLError -- exception raised for I/O errors

Functions:

  cert_time_to_seconds -- convert time string used for certificate
                          notBefore and notAfter functions to integer
                          seconds past the Epoch (the time values
                          returned from time.time())

  fetch_server_certificate (HOST, PORT) -- fetch the certificate provided
                          by the server running on HOST at port PORT.  No
                          validation of the certificate is performed.

Integer constants:

SSL_ERROR_ZERO_RETURN
SSL_ERROR_WANT_READ
SSL_ERROR_WANT_WRITE
SSL_ERROR_WANT_X509_LOOKUP
SSL_ERROR_SYSCALL
SSL_ERROR_SSL
SSL_ERROR_WANT_CONNECT

SSL_ERROR_EOF
SSL_ERROR_INVALID_ERROR_CODE

The following group define certificate requirements that one side is
allowing/requiring from the other side:

CERT_NONE - no certificates from the other side are required (or will
            be looked at if provided)
CERT_OPTIONAL - certificates are not required, but if provided will be
                validated, and if validation fails, the connection will
                also fail
CERT_REQUIRED - certificates are required, and will be validated, and
                if validation fails, the connection will also fail

The following constants identify various SSL protocol variants:

PROTOCOL_SSLv2
PROTOCOL_SSLv3
PROTOCOL_SSLv23
PROTOCOL_TLS
PROTOCOL_TLS_CLIENT
PROTOCOL_TLS_SERVER
PROTOCOL_TLSv1
PROTOCOL_TLSv1_1
PROTOCOL_TLSv1_2

The following constants identify various SSL alert message descriptions as per
http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-6

ALERT_DESCRIPTION_CLOSE_NOTIFY
ALERT_DESCRIPTION_UNEXPECTED_MESSAGE
ALERT_DESCRIPTION_BAD_RECORD_MAC
ALERT_DESCRIPTION_RECORD_OVERFLOW
ALERT_DESCRIPTION_DECOMPRESSION_FAILURE
ALERT_DESCRIPTION_HANDSHAKE_FAILURE
ALERT_DESCRIPTION_BAD_CERTIFICATE
ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE
ALERT_DESCRIPTION_CERTIFICATE_REVOKED
ALERT_DESCRIPTION_CERTIFICATE_EXPIRED
ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN
ALERT_DESCRIPTION_ILLEGAL_PARAMETER
ALERT_DESCRIPTION_UNKNOWN_CA
ALERT_DESCRIPTION_ACCESS_DENIED
ALERT_DESCRIPTION_DECODE_ERROR
ALERT_DESCRIPTION_DECRYPT_ERROR
ALERT_DESCRIPTION_PROTOCOL_VERSION
ALERT_DESCRIPTION_INSUFFICIENT_SECURITY
ALERT_DESCRIPTION_INTERNAL_ERROR
ALERT_DESCRIPTION_USER_CANCELLED
ALERT_DESCRIPTION_NO_RENEGOTIATION
ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION
ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
ALERT_DESCRIPTION_UNRECOGNIZED_NAME
ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE
ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE
ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY
�N)�
namedtuple)�Enum�IntEnum�IntFlag)�OPENSSL_VERSION_NUMBER�OPENSSL_VERSION_INFO�OPENSSL_VERSION)�_SSLContext�	MemoryBIO�
SSLSession)�SSLError�SSLZeroReturnError�SSLWantReadError�SSLWantWriteError�SSLSyscallError�SSLEOFError)�txt2obj�nid2obj)�RAND_status�RAND_add�
RAND_bytes�RAND_pseudo_bytes)�RAND_egd)�HAS_SNI�HAS_ECDH�HAS_NPN�HAS_ALPN�HAS_TLSv1_3)�_DEFAULT_CIPHERS)�_OPENSSL_API_VERSION�
_SSLMethodcCs|jd�o|dkS)NZ	PROTOCOL_�PROTOCOL_SSLv23)�
startswith)�name�r$�/usr/lib64/python3.6/ssl.py�<lambda>}sr&)�source�OptionscCs
|jd�S)NZOP_)r")r#r$r$r%r&�sZAlertDescriptioncCs
|jd�S)NZALERT_DESCRIPTION_)r")r#r$r$r%r&�sZSSLErrorNumbercCs
|jd�S)NZ
SSL_ERROR_)r")r#r$r$r%r&�s�VerifyFlagscCs
|jd�S)NZVERIFY_)r")r#r$r$r%r&�s�
VerifyModecCs
|jd�S)NZCERT_)r")r#r$r$r%r&�scCsi|]\}}||�qSr$r$)�.0r#�valuer$r$r%�
<dictcomp>�sr-ZPROTOCOL_SSLv2�win32)�enum_certificates�	enum_crls)�socket�AF_INET�SOCK_STREAM�create_connection)�
SOL_SOCKET�SO_TYPEz
tls-uniquec@seZdZdS)�CertificateErrorN)�__name__�
__module__�__qualname__r$r$r$r%r7�sr7�c	Cs�g}|sdS|jd�^}}|jd�}||kr<tdt|���|sP|j�|j�kS|dkrd|jd�n>|jd�sx|jd�r�|jtj|��n|jtj|�j	dd��x|D]}|jtj|��q�Wtj
d	d
j|�dtj�}|j
|�S)zhMatching according to RFC 6125, section 6.4.3

    http://tools.ietf.org/html/rfc6125#section-6.4.3
    F�.�*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)�split�countr7�repr�lower�appendr"�re�escape�replace�compile�join�
IGNORECASE�match)	Zdn�hostnameZ
max_wildcardsZpatsZleftmostZ	remainderZ	wildcardsZfragZpatr$r$r%�_dnsname_match�s&

rKcCstj|j��}||kS)z�Exact matching of IP addresses.

    RFC 6125 explicitly doesn't define an algorithm for this
    (section 1.7.2 - "Out of Scope").
    )�	ipaddress�
ip_address�rstrip)Zipname�host_ipZipr$r$r%�_ipaddress_match�srPcCsP|std��ytj|�}Wntk
r2d}YnXg}|jdf�}xb|D]Z\}}|dkr||dkrpt||�rpdS|j|�qJ|dkrJ|dk	r�t||�r�dS|j|�qJW|s�xF|jdf�D]6}x0|D](\}}|dkr�t||�r�dS|j|�q�Wq�Wt|�dk�r td	|d
j	t
t|��f��n,t|�dk�rDtd||df��ntd
��dS)a)Verify that *cert* (in decoded format as returned by
    SSLSocket.getpeercert()) matches the *hostname*.  RFC 2818 and RFC 6125
    rules are followed, but IP addresses are not accepted for *hostname*.

    CertificateError is raised on failure. On success, the function
    returns nothing.
    ztempty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIREDNZsubjectAltNameZDNSz
IP AddressZsubjectZ
commonNamer;z&hostname %r doesn't match either of %sz, zhostname %r doesn't match %rrz=no appropriate commonName or subjectAltName fields were found)�
ValueErrorrLrM�getrKrBrP�lenr7rG�mapr@)�certrJrOZdnsnamesZsan�keyr,�subr$r$r%�match_hostname�s>

rX�DefaultVerifyPathszQcafile capath openssl_cafile_env openssl_cafile openssl_capath_env openssl_capathcCsdtj�}tjj|d|d�}tjj|d|d�}ttjj|�rF|ndtjj|�rX|ndf|��S)z/Return paths to default cafile and capath.
    rr;��N)	�_ssl�get_default_verify_paths�os�environrRrY�path�isfile�isdir)�parts�cafile�capathr$r$r%r]-sr]csDeZdZdZfZ�fdd�Ze�fdd��Ze�fdd��Z�Z	S)�_ASN1Objectz#ASN.1 object identifier lookup
    cst�j|ft|dd���S)NF)r#)�super�__new__�_txt2obj)�cls�oid)�	__class__r$r%rh@sz_ASN1Object.__new__cst�j|ft|���S)z3Create _ASN1Object from OpenSSL numeric ID
        )rgrh�_nid2obj)rjZnid)rlr$r%�fromnidCsz_ASN1Object.fromnidcst�j|ft|dd���S)z=Create _ASN1Object from short name, long name or OID
        T)r#)rgrhri)rjr#)rlr$r%�fromnameIsz_ASN1Object.fromname)
r8r9r:�__doc__�	__slots__rh�classmethodrnro�
__classcell__r$r$)rlr%rf;s
rfznid shortname longname oidc@seZdZdZdZdZdS)�PurposezDSSLContext purpose flags with X509v3 Extended Key Usage objects
    z1.3.6.1.5.5.7.3.1z1.3.6.1.5.5.7.3.2N)r8r9r:rp�SERVER_AUTHZCLIENT_AUTHr$r$r$r%rtPsrtcs�eZdZdZd"Zd#Zefdd�Zefdd	�Zd$d
d�Z	d%dd�Z
dd�Zdd�Zdd�Z
ejfdd�Ze�fdd��Zej�fdd��Ze�fdd��Zej�fdd��Ze�fdd ��Zej�fd!d ��Z�ZS)&�
SSLContextz|An SSLContext holds various SSL-related configuration options and
    data, such as certificates and possibly a private key.�protocol�__weakref__�CA�ROOTcOstj||�}|S)N)r	rh)rjrw�args�kwargs�selfr$r$r%rh^szSSLContext.__new__cCs
||_dS)N)rw)r}rwr$r$r%�__init__bszSSLContext.__init__FTNc	Cst|||||||d�S)N)�sock�server_side�do_handshake_on_connect�suppress_ragged_eofs�server_hostname�_context�_session)�	SSLSocket)r}rr�r�r�r��sessionr$r$r%�wrap_socketes
zSSLContext.wrap_socketcCs|j||||d�}t||d�S)N)r�r�)r�)Z	_wrap_bio�	SSLObject)r}ZincomingZoutgoingr�r�r��sslobjr$r$r%�wrap_bioos
zSSLContext.wrap_biocCsdt�}xN|D]F}t|d�}t|�dks2t|�dkr:td��|jt|��|j|�qW|j|�dS)N�asciir�z(NPN protocols must be 1 to 255 in length)�	bytearray�bytesrSrrB�extendZ_set_npn_protocols)r}�
npn_protocols�protosrw�br$r$r%�set_npn_protocolsus

zSSLContext.set_npn_protocolscCsdt�}xN|D]F}t|d�}t|�dks2t|�dkr:td��|jt|��|j|�qW|j|�dS)Nr�rr�z)ALPN protocols must be 1 to 255 in length)r�r�rSrrBr�Z_set_alpn_protocols)r}Zalpn_protocolsr�rwr�r$r$r%�set_alpn_protocols�s

zSSLContext.set_alpn_protocolscCszt�}y@x:t|�D].\}}}|dkr|dks6|j|kr|j|�qWWntk
rdtjd�YnX|rv|j|d�|S)NZx509_asnTz-unable to enumerate Windows certificate store)�cadata)r�r/rkr��PermissionError�warnings�warn�load_verify_locations)r}�	storename�purposeZcertsrU�encodingZtrustr$r$r%�_load_windows_store_certs�sz$SSLContext._load_windows_store_certscCsDt|t�st|��tjdkr8x|jD]}|j||�q$W|j�dS)Nr.)�
isinstancerf�	TypeError�sys�platform�_windows_cert_storesr�Zset_default_verify_paths)r}r�r�r$r$r%�load_default_certs�s

zSSLContext.load_default_certscstt�j�S)N)r(rg�options)r})rlr$r%r��szSSLContext.optionscsttt�jj||�dS)N)rgrvr��__set__)r}r,)rlr$r%r��scstt�j�S)N)r)rg�verify_flags)r})rlr$r%r��szSSLContext.verify_flagscsttt�jj||�dS)N)rgrvr�r�)r}r,)rlr$r%r��scs*t�j}yt|�Stk
r$|SXdS)N)rg�verify_moder*rQ)r}r,)rlr$r%r��s
zSSLContext.verify_modecsttt�jj||�dS)N)rgrvr�r�)r}r,)rlr$r%r��s)rwrx)ryrz)FTTNN)FNN)r8r9r:rprqr��PROTOCOL_TLSrhr~r�r�r�r�r�rtrur��propertyr��setterr�r�rsr$r$)rlr%rvWs*

rv)rdrer�cCsdt|t�st|��tt�}|tjkr0t|_d|_	|s<|s<|rL|j
|||�n|jtkr`|j|�|S)z�Create a SSLContext object with default settings.

    NOTE: The protocol and settings may change anytime without prior
          deprecation. The values represent a fair balance between maximum
          compatibility and security.
    T)
r�rfr�rvr�rtru�
CERT_REQUIREDr��check_hostnamer��	CERT_NONEr�)r�rdrer��contextr$r$r%�create_default_context�s



r�F)�	cert_reqsr�r��certfile�keyfilerdrer�c
Cs�t|t�st|��t|�}	|s$d|	_|dk	r2||	_|r<d|	_|rN|rNtd��|sV|rb|	j||�|sn|sn|r~|	j|||�n|	jt	kr�|	j
|�|	S)a/Create a SSLContext object for Python stdlib modules

    All Python stdlib modules shall use this function to create SSLContext
    objects in order to keep common settings in one place. The configuration
    is less restrict than create_default_context()'s to increase backward
    compatibility.
    FNTzcertfile must be specified)r�rfr�rvr�r�rQ�load_cert_chainr�r�r�)
rwr�r�r�r�r�rdrer�r�r$r$r%�_create_unverified_context�s$



r�c@s�eZdZdZd0dd�Zedd��Zejdd��Zedd	��Zejd
d	��Zedd��Z	ed
d��Z
edd��Zd1dd�Zdd�Z
d2dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd3d*d+�Zd,d-�Zd.d/�ZdS)4r�aThis class implements an interface on top of a low-level SSL object as
    implemented by OpenSSL. This object captures the state of an SSL connection
    but does not provide any network IO itself. IO needs to be performed
    through separate "BIO" objects which are OpenSSL's IO abstraction layer.

    This class does not have a public constructor. Instances are returned by
    ``SSLContext.wrap_bio``. This class is typically used by framework authors
    that want to implement asynchronous IO for SSL through memory buffers.

    When compared to ``SSLSocket``, this object lacks the following features:

     * Any form of network IO, including methods such as ``recv`` and ``send``.
     * The ``do_handshake_on_connect`` and ``suppress_ragged_eofs`` machinery.
    NcCs&||_|p||j_|dk	r"||j_dS)N)�_sslobj�ownerr�)r}r�r�r�r$r$r%r~szSSLObject.__init__cCs|jjS)z(The SSLContext that is currently in use.)r�r�)r}r$r$r%r�%szSSLObject.contextcCs||j_dS)N)r�r�)r}�ctxr$r$r%r�*scCs|jjS)z!The SSLSession for client socket.)r�r�)r}r$r$r%r�.szSSLObject.sessioncCs||j_dS)N)r�r�)r}r�r$r$r%r�3scCs|jjS)z.Was the client session reused during handshake)r��session_reused)r}r$r$r%r�7szSSLObject.session_reusedcCs|jjS)z%Whether this is a server-side socket.)r�r�)r}r$r$r%r�<szSSLObject.server_sidecCs|jjS)z]The currently set server hostname (for SNI), or ``None`` if no
        server hostame is set.)r�r�)r}r$r$r%r�AszSSLObject.server_hostname�cCs(|dk	r|jj||�}n|jj|�}|S)z�Read up to 'len' bytes from the SSL object and return them.

        If 'buffer' is provided, read into this buffer and return the number of
        bytes read.
        N)r��read)r}rS�buffer�vr$r$r%r�GszSSLObject.readcCs|jj|�S)z�Write 'data' to the SSL object and return the number of bytes
        written.

        The 'data' argument must support the buffer interface.
        )r��write)r}�datar$r$r%r�SszSSLObject.writeFcCs|jj|�S)z�Returns a formatted version of the data in the certificate provided
        by the other end of the SSL channel.

        Return None if no certificate was provided, {} if a certificate was
        provided, but not validated.
        )r�Zpeer_certificate)r}�binary_formr$r$r%�getpeercert[szSSLObject.getpeercertcCstjr|jj�SdS)z�Return the currently selected NPN protocol as a string, or ``None``
        if a next protocol was not negotiated or if NPN is not supported by one
        of the peers.N)r\rr��selected_npn_protocol)r}r$r$r%r�dszSSLObject.selected_npn_protocolcCstjr|jj�SdS)z�Return the currently selected ALPN protocol as a string, or ``None``
        if a next protocol was not negotiated or if ALPN is not supported by one
        of the peers.N)r\rr��selected_alpn_protocol)r}r$r$r%r�ksz SSLObject.selected_alpn_protocolcCs
|jj�S)z_Return the currently selected cipher as a 3-tuple ``(name,
        ssl_version, secret_bits)``.)r��cipher)r}r$r$r%r�rszSSLObject.ciphercCs
|jj�S)z�Return a list of ciphers shared by the client during the handshake or
        None if this is not a valid server connection.
        )r��shared_ciphers)r}r$r$r%r�wszSSLObject.shared_cipherscCs
|jj�S)z�Return the current compression algorithm in use, or ``None`` if
        compression was not negotiated or not supported by one of the peers.)r��compression)r}r$r$r%r�}szSSLObject.compressioncCs
|jj�S)z8Return the number of bytes that can be read immediately.)r��pending)r}r$r$r%r��szSSLObject.pendingcCs4|jj�|jjr0|js td��t|j�|j�dS)zStart the SSL/TLS handshake.z-check_hostname needs server_hostname argumentN)r��do_handshaker�r�r�rQrXr�)r}r$r$r%r��s

zSSLObject.do_handshakecCs
|jj�S)z!Start the SSL shutdown handshake.)r��shutdown)r}r$r$r%�unwrap�szSSLObject.unwrap�
tls-uniquecCs0|tkrtd��|dkr&tdj|���|jj�S)z�Get channel binding data for current connection.  Raise ValueError
        if the requested `cb_type` is not supported.  Return bytes of the data
        or None if the data is not available (e.g. before the handshake).z Unsupported channel binding typez
tls-uniquez({0} channel binding type not implemented)�CHANNEL_BINDING_TYPESrQ�NotImplementedError�formatr�Z
tls_unique_cb)r}�cb_typer$r$r%�get_channel_binding�szSSLObject.get_channel_bindingcCs
|jj�S)zZReturn a string identifying the protocol version used by the
        current SSL channel. )r��version)r}r$r$r%r��szSSLObject.versioncCs
|jj�S)N)r��verify_client_post_handshake)r}r$r$r%r��sz&SSLObject.verify_client_post_handshake)NN)r�N)F)r�)r8r9r:rpr~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r$r$r$r%r�s.


		
r�cs�eZdZdZddddeeddeeddddddddfdd�Ze	dd	��Z
e
jd
d	��Z
e	dd��Zejd
d��Ze	dd��Z
dd�ZdVdd�Zdd�ZdWdd�Zdd�ZdXdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZdYd'd(�ZdZd)d*�Zd+d,�Zd[d-d.�Zd\�fd/d0�	Zd]d1d2�Zd^d3d4�Zd_d5d6�Z d`d7d8�Z!d9d:�Z"d;d<�Z#d=d>�Z$d?d@�Z%dAdB�Z&dCdD�Z'dEdF�Z(dadGdH�Z)dIdJ�Z*dKdL�Z+dMdN�Z,dOdP�Z-dbdRdS�Z.dTdU�Z/�Z0S)cr�z�This class implements a subtype of socket.socket that wraps
    the underlying OS socket in an SSL context when necessary, and
    provides read and write methods over that channel.NFTrc6Cs:d|_|r||_n�|r$|r$td��|r6|r6td��|rD|rD|}t|�|_||j_|rf|jj|�|rx|jj||�|r�|jj|�|r�|jj|�||_	||_
||_||_||_
||_|jtt�tkr�td��|r�|r�td��|dk	r�td��|jj�r|�rtd��||_||_||_||_|
|_|dk	�rftj||j|j|j|j�d�|j �}|j!�n,|dk	�r�tj||d�ntj||	|
|d	�y|j"�Wn�t#k
�r�}z�|j$t$j%k�r‚d
}|j �dk}|j&d
�y|j'd�}Wn>t#k
�r(}z |j$t$j%t$j(fk�r�d
}WYdd}~XnX|j&|�|�r�d}t)|j$|�}||_*d|_+y|j,�Wnt#k
�rxYnXz|�Wdd}XWYdd}~XnXd}|j-|�d
|_.d|_||_/|�r6yN|jj0|||�}t1|||jd�|_|�r|j �}|dk�rtd��|j2�Wn$t#tfk
�r4|j,��YnXdS)Nz5certfile must be specified for server-side operationszcertfile must be specifiedz!only stream sockets are supportedz4server_hostname can only be specified in client modez,session can only be specified in client modez'check_hostname requires server_hostname)�family�type�proto�fileno)r�)r�r�r�Frr;�z5Closed before TLS handshake with data in recv buffer.T)r�r�gzHdo_handshake_on_connect should not be specified for non-blocking sockets)3r�r�rQrvr�r�r�r�Zset_ciphersr�r�r��ssl_version�ca_certs�ciphersZ
getsockoptr5r6r3r�r�r�r�r�r�r�r1r~r�r�r�r��
gettimeout�detach�getpeername�OSError�errnoZENOTCONNZsetblocking�recvZEINVALr�reasonZlibrary�close�
settimeoutZ_closed�
_connected�_wrap_socketr�r�)r}rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Zsock_timeout�eZ	connectedZblockingZnotconn_pre_handshake_datar�Z notconn_pre_handshake_data_errorr��timeoutr$r$r%r~�s�











zSSLSocket.__init__cCs|jS)N)r�)r}r$r$r%r�0szSSLSocket.contextcCs||_||j_dS)N)r�r�r�)r}r�r$r$r%r�4scCs|jdk	r|jjSdS)z!The SSLSession for client socket.N)r�r�)r}r$r$r%r�9s
zSSLSocket.sessioncCs||_|jdk	r||j_dS)N)r�r�r�)r}r�r$r$r%r�?s
cCs|jdk	r|jjSdS)z.Was the client session reused during handshakeN)r�r�)r}r$r$r%r�Es
zSSLSocket.session_reusedcCstd|jj��dS)NzCan't dup() %s instances)r�rlr8)r}r$r$r%�dupKsz
SSLSocket.dupcCsdS)Nr$)r}�msgr$r$r%�_checkClosedOszSSLSocket._checkClosedcCs|js|j�dS)N)r�r�)r}r$r$r%�_check_connectedSszSSLSocket._check_connected�cCst|j�|jstd��y|jj||�Stk
rn}z.|jdtkr\|jr\|dk	rVdSdSn�WYdd}~XnXdS)zORead up to LEN bytes and return them.
        Return zero-length string on EOF.z'Read on closed or unwrapped SSL socket.rNr�)r�r�rQr�rr{Z
SSL_ERROR_EOFr�)r}rSr��xr$r$r%r�[szSSLSocket.readcCs"|j�|jstd��|jj|�S)zhWrite DATA to the underlying SSL channel.  Returns
        number of bytes of DATA actually transmitted.z(Write on closed or unwrapped SSL socket.)r�r�rQr�)r}r�r$r$r%r�mszSSLSocket.writecCs|j�|j�|jj|�S)z�Returns a formatted version of the data in the
        certificate provided by the other end of the SSL channel.
        Return None if no certificate was provided, {} if a
        certificate was provided, but not validated.)r�r�r�r�)r}r�r$r$r%r�vszSSLSocket.getpeercertcCs*|j�|jstjrdS|jj�SdS)N)r�r�r\rr�)r}r$r$r%r��szSSLSocket.selected_npn_protocolcCs*|j�|jstjrdS|jj�SdS)N)r�r�r\rr�)r}r$r$r%r��sz SSLSocket.selected_alpn_protocolcCs |j�|jsdS|jj�SdS)N)r�r�r�)r}r$r$r%r��szSSLSocket.ciphercCs|j�|jsdS|jj�S)N)r�r�r�)r}r$r$r%r��szSSLSocket.shared_cipherscCs |j�|jsdS|jj�SdS)N)r�r�r�)r}r$r$r%r��szSSLSocket.compressioncCsB|j�|jr0|dkr$td|j��|jj|�Stj|||�SdS)Nrz3non-zero flags not allowed in calls to send() on %s)r�r�rQrlr�r1�send)r}r��flagsr$r$r%r��s
zSSLSocket.sendcCsH|j�|jrtd|j��n&|dkr4tj|||�Stj||||�SdS)Nz%sendto not allowed on instances of %s)r�r�rQrlr1�sendto)r}r�Z
flags_or_addr�addrr$r$r%r��szSSLSocket.sendtocOstd|j��dS)Nz&sendmsg not allowed on instances of %s)r�rl)r}r{r|r$r$r%�sendmsg�szSSLSocket.sendmsgcCs�|j�|jr�|dkr$td|j��d}t|��L}|jd��6}t|�}x&||krl|j||d��}||7}qHWWdQRXWdQRXntj	|||�SdS)Nrz6non-zero flags not allowed in calls to sendall() on %s�B)
r�r�rQrl�
memoryview�castrSr�r1�sendall)r}r�r�r?ZviewZ	byte_viewZamountr�r$r$r%r��s

"zSSLSocket.sendallcs,|jdkrt�j|||�S|j|||�SdS)z�Send a file, possibly by using os.sendfile() if this is a
        clear-text socket.  Return the total number of bytes sent.
        N)r�rg�sendfileZ_sendfile_use_send)r}�file�offsetr?)rlr$r%r��s
zSSLSocket.sendfilecCs@|j�|jr.|dkr$td|j��|j|�Stj|||�SdS)Nrz3non-zero flags not allowed in calls to recv() on %s)r�r�rQrlr�r1r�)r}�buflenr�r$r$r%r��s

zSSLSocket.recvcCsf|j�|r|dkrt|�}n|dkr*d}|jrR|dkrFtd|j��|j||�Stj||||�SdS)Nirz8non-zero flags not allowed in calls to recv_into() on %s)r�rSr�rQrlr�r1�	recv_into)r}r��nbytesr�r$r$r%r��s

zSSLSocket.recv_intocCs0|j�|jrtd|j��ntj|||�SdS)Nz'recvfrom not allowed on instances of %s)r�r�rQrlr1�recvfrom)r}r�r�r$r$r%r��s
zSSLSocket.recvfromcCs2|j�|jrtd|j��ntj||||�SdS)Nz,recvfrom_into not allowed on instances of %s)r�r�rQrlr1�
recvfrom_into)r}r�r�r�r$r$r%r��s
zSSLSocket.recvfrom_intocOstd|j��dS)Nz&recvmsg not allowed on instances of %s)r�rl)r}r{r|r$r$r%�recvmsgszSSLSocket.recvmsgcOstd|j��dS)Nz+recvmsg_into not allowed on instances of %s)r�rl)r}r{r|r$r$r%�recvmsg_intoszSSLSocket.recvmsg_intocCs |j�|jr|jj�SdSdS)Nr)r�r�r�)r}r$r$r%r�	s
zSSLSocket.pendingcCs|j�d|_tj||�dS)N)r�r�r1r�)r}Zhowr$r$r%r�szSSLSocket.shutdowncCs.|jr|jj�}d|_|Stdt|���dS)NzNo SSL wrapper around )r�r�rQ�str)r}�sr$r$r%r�s

zSSLSocket.unwrapcCs$|jr|jj�Stdt|���dS)NzNo SSL wrapper around )r�r�rQr)r}r$r$r%r�s
z&SSLSocket.verify_client_post_handshakecCsd|_tj|�dS)N)r�r1�_real_close)r}r$r$r%r#szSSLSocket._real_closecCsF|j�|j�}z$|dkr(|r(|jd�|jj�Wd|j|�XdS)zPerform a TLS/SSL handshake.gN)r�r�r�r�r�)r}�blockr�r$r$r%r�'s
zSSLSocket.do_handshakecCs�|jrtd��|jrtd��|jj|d|j�}t|||jd�|_y>|rTt	j
||�}nd}t	j||�|s|d|_|jr||j
�|Sttfk
r�d|_�YnXdS)Nz!can't connect in server-side modez/attempt to connect already-connected SSLSocket!F)r�r�T)r�rQr�r�r�r�r�r�r�r1�
connect_ex�connectr�r�r�)r}r�rr�Zrcr$r$r%�
_real_connect2s(zSSLSocket._real_connectcCs|j|d�dS)zQConnects to remote ADDR, and then wraps the connection in
        an SSL channel.FN)r)r}r�r$r$r%rKszSSLSocket.connectcCs|j|d�S)zQConnects to remote ADDR, and then wraps the connection in
        an SSL channel.T)r)r}r�r$r$r%rPszSSLSocket.connect_excCs.tj|�\}}|jj||j|jdd�}||fS)z�Accepts a new connection from a remote client, and returns
        a tuple containing that new connection wrapped with a server-side
        SSL channel, and the address of the remote client.T)r�r�r�)r1�acceptr�r�r�r�)r}Znewsockr�r$r$r%rUszSSLSocket.accept�
tls-uniquecCs|jdkrdS|jj|�S)z�Get channel binding data for current connection.  Raise ValueError
        if the requested `cb_type` is not supported.  Return bytes of the data
        or None if the data is not available (e.g. before the handshake).
        N)r�r�)r}r�r$r$r%r�as
zSSLSocket.get_channel_bindingcCs|jdkrdS|jj�S)z�
        Return a string identifying the protocol version used by the
        current SSL channel, or None if there is no established channel.
        N)r�r�)r}r$r$r%r�js
zSSLSocket.version)N)r�N)F)r)N)r)rN)r�r)Nr)r�r)Nr)F)r	)1r8r9r:rpr�r�r2r3r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�r�r�r�rr�rrrrr�r�rsr$r$)rlr%r��s`|

	












	r�Tc

Cst||||||||||	d�
S)N)
rr�r�r�r�r�r�r�r�r�)r�)
rr�r�r�r�r�r�r�r�r�r$r$r%r�tsr�c
Cs�ddlm}ddlm}d}d}y|j|dd�j��d}Wn$tk
rbtd||f��Yn0X||dd�|�}||d|f|dd��SdS)a�Return the time in seconds since the Epoch, given the timestring
    representing the "notBefore" or "notAfter" date from a certificate
    in ``"%b %d %H:%M:%S %Y %Z"`` strptime format (C locale).

    "notBefore" or "notAfter" dates must use UTC (RFC 5280).

    Month is one of: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
    UTC should be specified as GMT (see ASN1_TIME_print())
    r)�strptime)�timegm�Jan�Feb�Mar�Apr�May�Jun�Jul�Aug�Sep�Oct�Nov�Decz %d %H:%M:%S %Y GMTNr[r;z*time data %r does not match format "%%b%s"rZ�)rr
rrrrrrrrrr)Ztimer
Zcalendarr�index�titlerQ)Z	cert_timer
rZmonthsZtime_formatZmonth_numberZttr$r$r%�cert_time_to_seconds�s
rz-----BEGIN CERTIFICATE-----z-----END CERTIFICATE-----cCs2ttj|�dd�}tdtj|d�dtdS)z[Takes a certificate in binary DER format and returns the
    PEM version of it as a string.�ASCII�strict�
�@)r�base64Zstandard_b64encode�
PEM_HEADER�textwrapZfill�
PEM_FOOTER)Zder_cert_bytes�fr$r$r%�DER_cert_to_PEM_cert�sr%cCs\|jt�stdt��|j�jt�s0tdt��|j�tt�tt��}tj|j	dd��S)zhTakes a certificate in ASCII PEM format and returns the
    DER-encoded version of it as a byte sequencez(Invalid PEM encoding; must start with %sz&Invalid PEM encoding; must end with %srr)
r"r!rQ�strip�endswithr#rSr Zdecodebytes�encode)Zpem_cert_string�dr$r$r%�PEM_cert_to_DER_cert�s
r*c
Csd|\}}|dk	rt}nt}t|||d�}t|��&}|j|��}|jd�}	WdQRXWdQRXt|	�S)z�Retrieve the certificate from the server at the specified address,
    and return it as a PEM-encoded string.
    If 'ca_certs' is specified, validate the server cert against it.
    If 'ssl_version' is specified, use it in the connection attempt.N)r�rdT)r�r��_create_stdlib_contextr4r�r�r%)
r�r�r��hostZportr�r�rZsslsockZdercertr$r$r%�get_server_certificate�s
r-cCstj|d�S)Nz	<unknown>)�_PROTOCOL_NAMESrR)Z
protocol_coder$r$r%�get_protocol_name�sr/)r;)brprLr"rCr�r^�collectionsr�enumrZ_EnumrZ_IntEnumrZ_IntFlagr\rrrr	r
rrr
rrrrrrirrmrrrrr�ImportErrorrrrrrrr�_convertr8r r�r!�__members__�itemsr.�getattrZ_SSLv2_IF_EXISTSr�r/r0r1r2r3r4r5r6r r�r�r�Zsocket_errorZHAS_TLS_UNIQUEr�Z_RESTRICTED_SERVER_CIPHERSrQr7rKrPrXrYr]rfrtrvrur�r�r�Z_create_default_https_contextr+r�r�r�rr!r#r%r*r-r/r$r$r$r%�<module>[s� 
14g(O
	
shutil.cpython-36.opt-2.pyc000064400000047115150335715140011456 0ustar003

�\dh}��A@s�ddlZddlZddlZddlZddlZddlZyddlZ[dZWnek
rZdZYnXyddl	Z	[	dZ
Wnek
r�dZ
YnXyddlZ[dZWnek
r�dZYnXyddl
mZWnek
r�dZYnXyddlmZWnek
�rdZYnXdddd	d
ddd
dddddddddddddddddgZGdd�de�ZGd d�de�ZGd!d�de�ZGd"d�de�ZGd#d$�d$e�ZGd%d&�d&e�Zd�d)d�Zd*d+�Zdd,�d-d�Zdd,�d.d�Zeed/��r�dd,�d0d1�Znd2d1�Zdd,�d3d	�Z dd,�d4d
�Z!dd,�d5d�Z"d6d�Z#dde"dfd7d�Z$d8d9�Z%d:d;�Z&ej'ejej(ej)hej*k�ozej+ej,k�ozejej-kZ.d�d<d�Z/e.e/_0d=d>�Z1e"fd?d
�Z2d@dA�Z3dBdC�Z4dDdE�Z5d�dGdH�Z6d�dIdJ�Z7dKe6d�gdMfiZ8e�re6d�gdNfe8dO<e7gdPfe8dQ<e
�re6d�gdSfe8dT<e�r,e6d�gdVfe8dW<dXd�Z9d�dZd�Z:d[d�Z;d�d\d�Z<d]d�Z=d^d_�Z>d�d`d�Z?dad�Z@dbdc�ZAddde�ZBddf�dgdh�ZCdigeCgdMfdjgeBgdPfdk�ZDe�r�dldmgeCgdNfeDdO<e
�r�dndogeCgdSfeDdT<e�r�dpdqgeCgdVfeDdW<drds�ZEd�ddf�dtd�ZFeedu��rXejGdv�ejHdwdx�ZIdyeIjJ_KdzeIjL_Kd{eIjM_Kd|dv�ZNn2ejOd}k�r�ddlPZPejGdv�ejHdwdx�ZId~dv�ZNd�dd�ZQd�d�d�ZRejSejTBdfd�d�ZUdS)��NTF)�getpwnam)�getgrnam�copyfileobj�copyfile�copymode�copystat�copy�copy2�copytree�move�rmtree�Error�SpecialFileError�	ExecError�make_archive�get_archive_formats�register_archive_format�unregister_archive_format�get_unpack_formats�register_unpack_format�unregister_unpack_format�unpack_archive�ignore_patterns�chown�which�get_terminal_size�
SameFileErrorc@seZdZdS)r
N)�__name__�
__module__�__qualname__�r r �/usr/lib64/python3.6/shutil.pyr
7sc@seZdZdS)rN)rrrr r r r!r:sc@seZdZdS)rN)rrrr r r r!r=sc@seZdZdS)rN)rrrr r r r!rAsc@seZdZdS)�	ReadErrorN)rrrr r r r!r"Dsr"c@seZdZdS)�
RegistryErrorN)rrrr r r r!r#Gsr#�icCs$x|j|�}|sP|j|�qWdS)N)�read�write)�fsrc�fdstZlengthZbufr r r!rLs

cCsXttjd�r0ytjj||�Stk
r.dSXtjjtjj|��tjjtjj|��kS)N�samefileF)�hasattr�os�pathr)�OSError�normcase�abspath)�src�dstr r r!�	_samefileTsr2)�follow_symlinkscCs�t||�rtdj||���xL||gD]@}ytj|�}Wntk
rJYq$Xtj|j�r$td|��q$W|r�tj	j
|�r�tjtj|�|�n6t
|d��&}t
|d��}t||�WdQRXWdQRX|S)Nz{!r} and {!r} are the same filez`%s` is a named pipe�rb�wb)r2r�formatr+�statr-�S_ISFIFO�st_moderr,�islink�symlink�readlink�openr)r0r1r3�fn�str'r(r r r!r`s
cCsz|r>tjj|�r>tjj|�r>ttd�r8tjtj}}q\dSnttd�rXtjtj}}ndS||�}||tj|j	��dS)N�lchmod�chmod)
r+r,r:r*�lstatr@r7rA�S_IMODEr9)r0r1r3Z	stat_funcZ
chmod_funcr?r r r!r}s

�	listxattrcCs�ytj||d�}Wn4tk
rF}z|jtjtjfkr8�dSd}~XnXxn|D]f}y&tj|||d�}tj||||d�WqNtk
r�}z|jtjtjtjfkr��WYdd}~XqNXqNWdS)N)r3)	r+rDr-�errno�ENOTSUPZENODATA�getxattr�setxattrZEPERM)r0r1r3�names�e�name�valuer r r!�
_copyxattr�s	
rMcOsdS)Nr )�args�kwargsr r r!rM�sc	s6ddd�dd��|p,tjj|�o*tjj|�}|r@�fdd�}n�fdd�}|d�||d�}tj|j�}|d	�||j|jf|d�y|d
�|||d�Wntk
r�YnXt	|d��r$y|d�||j
|d�WnPtk
�r"}z2x*dD] }t	t|�r�|jt
t|�kr�Pq�W�WYdd}~XnXt|||d�dS)N)�nsr3cWsdS)Nr )rPr3rNr r r!�_nop�szcopystat.<locals>._nopcstt|��S)N)�getattrr+)rK)rQr r!�lookup�szcopystat.<locals>.lookupcstt|��}|tjkr|S�S)N)rRr+�supports_follow_symlinks)rKr>)rQr r!rS�s
r7)r3�utimerA�st_flagsZchflags�
EOPNOTSUPPrF)rWrF)r+r,r:r7rCr9�st_atime_ns�st_mtime_ns�NotImplementedErrorr*rVr-rErRrM)	r0r1r3ZfollowrSr?�mode�why�errr )rQr!r�s,
cCsBtjj|�r"tjj|tjj|��}t|||d�t|||d�|S)N)r3)r+r,�isdir�join�basenamerr)r0r1r3r r r!r�s
cCsBtjj|�r"tjj|tjj|��}t|||d�t|||d�|S)N)r3)r+r,r^r_r`rr)r0r1r3r r r!r	�s
cs�fdd�}|S)Ncs,g}x�D]}|jtj||��q
Wt|�S)N)�extend�fnmatch�filter�set)r,rI�
ignored_names�pattern)�patternsr r!�_ignore_patternss
z)ignore_patterns.<locals>._ignore_patternsr )rgrhr )rgr!rscCs�tj|�}|dk	r|||�}nt�}tj|�g}�xB|D�]8}	|	|krJq:tjj||	�}
tjj||	�}y�tjj|
�r�tj|
�}|r�tj||�t	|
||d�n<tjj
|�r�|r�w:tjj|
�r�t|
||||�n
||
|�n(tjj|
�r�t|
||||�n
||
|�Wq:t
k
�r<}
z|j|
jd�WYdd}
~
Xq:tk
�rr}z|j|
|t|�f�WYdd}~Xq:Xq:Wyt	||�WnJtk
�r�}z,t|dd�dk�r�|j||t|�f�WYdd}~XnX|�r�t
|��|S)N)r3rZwinerror)r+�listdirrd�makedirsr,r_r:r<r;r�existsr^r
r
rarNr-�append�strrR)r0r1�symlinks�ignore�
copy_functionZignore_dangling_symlinksrIre�errorsrKZsrcnameZdstname�linktor]r\r r r!r
sL$



 *&c$CsLytjj|�rtd��Wn(tk
r@|tjj|tj��dSXg}ytj|�}Wn&tk
rz|tj|tj��YnXx�|D]�}tjj||�}ytj|�j	}Wntk
r�d}YnXt
j|�r�t||�q�ytj
|�Wq�tk
�r
|tj
|tj��Yq�Xq�Wytj|�Wn(tk
�rF|tj|tj��YnXdS)Nz%Cannot call rmtree on a symbolic linkr)r+r,r:r-�sys�exc_inforir_rBr9r7�S_ISDIR�_rmtree_unsafe�unlink�rmdir)r,�onerrorrIrK�fullnamer[r r r!rvqs6


rvc
0Cs�g}ytj|�}Wn:tk
rL}z||_|tj|tj��WYdd}~XnX�x�|D�]x}tjj||�}ytj||dd�}|j	}Wntk
r�d}YnXtj
|��r�ytj|tj|d�}	Wn&tk
r�|tj|tj��Yn�Xz�tjj
|tj|	���rJt|	||�ytj||d�Wn(tk
�rF|tj|tj��YnXn8ytd��Wn*tk
�r�|tjj|tj��YnXWdtj|	�XqVytj||d�WqVtk
�r�|tj|tj��YqVXqVWdS)NF)�dir_fdr3r)r{z%Cannot call rmtree on a symbolic link)r+rir-�filenamersrtr,r_r7r9rur=�O_RDONLY�samestat�fstat�_rmtree_safe_fdrxr:�closerw)
�topfdr,ryrIr]rKrz�orig_str[�dirfdr r r!r��sD$

r�c!Cs^|rdd�}n|dkrdd�}t�rPt|t�r8tj|�}ytj|�}Wn&tk
rl|tj|tj��dSXytj	|tj
�}Wn&tk
r�|tj|tj��dSXz�tjj|tj
|���rt|||�ytj|�Wn(tk
�r|tj|tj��YnXn8ytd��Wn*tk
�r<|tjj|tj��YnXWdtj|�Xn
t||�SdS)NcWsdS)Nr )rNr r r!ry�szrmtree.<locals>.onerrorcWs�dS)Nr )rNr r r!ry�sz%Cannot call rmtree on a symbolic link)�_use_fd_functions�
isinstance�bytesr+�fsdecoderB�	Exceptionrsrtr=r}r,r~rr�rxr-r:r�rv)r,�
ignore_errorsryr��fdr r r!r�s<


cCs&tjjtjjpd}tjj|j|��S)N�)r+r,�sep�altsepr`�rstrip)r,r�r r r!�	_basename�sr�cCs|}tjj|�rTt||�r*tj||�dStjj|t|��}tjj|�rTtd|��ytj||�Wn�t	k
r�tjj
|�r�tj|�}tj||�tj
|�nTtjj|�r�t||�r�td||f��t|||dd�t|�n|||�tj
|�YnX|S)Nz$Destination path '%s' already existsz.Cannot move a directory '%s' into itself '%s'.T)rprn)r+r,r^r2�renamer_r�rkr
r-r:r<r;rw�
_destinsrcr
r)r0r1rpZreal_dstrrr r r!rs2




cCsVtjj|�}tjj|�}|jtjj�s2|tjj7}|jtjj�sL|tjj7}|j|�S)N)r+r,r/�endswithr��
startswith)r0r1r r r!r�8sr�cCsNtdks|dkrdSyt|�}Wntk
r8d}YnX|dk	rJ|dSdS)N�)r�KeyError)rK�resultr r r!�_get_gidAs
r�cCsNtdks|dkrdSyt|�}Wntk
r8d}YnX|dk	rJ|dSdS)Nr�)rr�)rKr�r r r!�_get_uidMs
r��gzipc
s"|dkrd}nDtr |dkr d}n2tr2|dkr2d}n trD|dkrDd}ntdj|���ddl}	|rfd	|nd}
|d
|
}tjj|�}|r�tjj	|�r�|dk	r�|j
d|�|s�tj|�|dk	r�|j
d�t���t
�������fd
d�}
|�s|	j|d|�}z|j||
d�Wd|j�X|S)Nr�r�Zgz�bzip2�bz2�xzzCbad value for 'compress', or compression format not supported : {0}r�.z.tarzcreating %szCreating tar archivecs,�dk	r�|_�|_�dk	r(�|_�|_|S)N)�gidZgname�uid�uname)Ztarinfo)r��group�ownerr�r r!�_set_uid_gid�sz#_make_tarball.<locals>._set_uid_gidzw|%s)rc)�_ZLIB_SUPPORTED�_BZ2_SUPPORTED�_LZMA_SUPPORTED�
ValueErrorr6�tarfiler+r,�dirnamerk�inforjr�r�r=�addr�)�	base_name�base_dir�compress�verbose�dry_runr�r��loggerZtar_compressionr�Zcompress_extZarchive_name�archive_dirr��tarr )r�r�r�r�r!�
_make_tarballYs<

	
r�c
Cs|ddl}|d}tjj|�}|rPtjj|�rP|dk	rB|jd|�|sPtj|�|dk	rf|jd||�|�sx|j|d|jd���}tjj	|�}	|	tj
kr�|j|	|	�|dk	r�|jd|	�x�tj|�D]�\}
}}xFt
|�D]:}
tjj	tjj|
|
��}	|j|	|	�|dk	r�|jd|	�q�WxT|D]L}
tjj	tjj|
|
��}	tjj|	��r|j|	|	�|dk	�r|jd|	��qWq�WWdQRX|S)Nrz.zipzcreating %sz#creating '%s' and adding '%s' to it�w)Zcompressionzadding '%s')�zipfiler+r,r�rkr�rj�ZipFileZZIP_DEFLATED�normpath�curdirr&�walk�sortedr_�isfile)r�r�r�r�r�r�Zzip_filenamer�Zzfr,�dirpathZdirnames�	filenamesrKr r r!�
_make_zipfile�s@



 r�r�r�zuncompressed tar filezgzip'ed tar-fileZgztarzZIP file�zipr�zbzip2'ed tar-fileZbztarr�zxz'ed tar-fileZxztarcCsdd�tj�D�}|j�|S)NcSsg|]\}}||df�qS)r�r )�.0rK�registryr r r!�
<listcomp>�sz'get_archive_formats.<locals>.<listcomp>)�_ARCHIVE_FORMATS�items�sort)�formatsr r r!r�sr�cCsz|dkrg}t|�s td|��t|ttf�s6td��x0|D](}t|ttf�s\t|�dkr<td��q<W|||ft|<dS)NzThe %s object is not callablez!extra_args needs to be a sequencer�z+extra_args elements are : (arg_name, value))�callable�	TypeErrorr��tuple�list�lenr�)rK�function�
extra_args�description�elementr r r!r�s	
cCs
t|=dS)N)r�)rKr r r!r�sc	Cstj�}	|dk	r>|dk	r$|jd|�tjj|�}|s>tj|�|dkrLtj}||d�}
yt|}Wn tk
r�t	d|��YnX|d}x|dD]\}
}||
|
<q�W|dkr�||
d<||
d<z|||f|
�}Wd|dk	r�|dk	r�|jd	|	�tj|	�X|S)
Nzchanging into '%s')r�r�zunknown archive format '%s'r�r�r�r�zchanging back to '%s')
r+�getcwd�debugr,r/�chdirr�r�r�r�)r�r6Zroot_dirr�r�r�r�r�r�Zsave_cwdrO�format_info�func�arg�valr|r r r!r�s6

cCsdd�tj�D�}|j�|S)NcSs"g|]\}}||d|df�qS)r�r )r�rKr�r r r!r�6sz&get_unpack_formats.<locals>.<listcomp>)�_UNPACK_FORMATSr�r�)r�r r r!r0sc	Csvi}x.tj�D]"\}}x|dD]}|||<q WqWx,|D]$}||kr:d}t||||f��q:Wt|�srtd��dS)Nrz!%s is already registered for "%s"z*The registered function must be a callable)r�r�r#r�r�)	�
extensionsr�r�Zexisting_extensionsrKr��ext�	extension�msgr r r!�_check_unpack_options;s
r�cCs,|dkrg}t|||�||||ft|<dS)N)r�r�)rKr�r�r�r�r r r!rMscCs
t|=dS)N)r�)rKr r r!rcscCs&tjj|�}tjj|�s"tj|�dS)N)r+r,r�r^rj)r,r�r r r!�_ensure_directorygsr�c	Cs�ddl}|j|�std|��|j|�}z�x�|j�D]�}|j}|jd�s4d|krRq4tjj	|f|j
d���}|spq4t|�|jd�s4|j
|j�}t|d�}z|j|�Wd|j�~Xq4WWd|j�XdS)Nrz%s is not a zip file�/z..r5)r�Z
is_zipfiler"r�Zinfolistr|r�r+r,r_�splitr�r�r%r=r&r�)	r|�extract_dirr�r�r�rK�target�data�fr r r!�_unpack_zipfilems*



r�)rccCs\ddl}y|j|�}Wn"|jk
r8td|��YnXz|j||d�Wd|j�XdS)Nrz/%s is not a compressed or uncompressed tar file)rc)r�r=ZTarErrorr"Z
extractallr�)r|r�rcr�Ztarobjr r r!�_unpack_tarfile�sr�z.tarz.zip)r�r�z.tar.gzz.tgzz.tar.bz2z.tbz2z.tar.xzz.txzcCs:x4tj�D](\}}x|dD]}|j|�r|SqWq
WdS)Nr)r�r�r�)r|rKr�r�r r r!�_find_unpack_format�s

r�c
Cs�|dkrtj�}|dkri}nd|i}|dk	r�yt|}Wn"tk
r\tdj|���YnX|d}|||ft|d�|��nRt|�}|dkr�tdj|���t|d}tt|d�}|j	|�|||f|�dS)NrczUnknown unpack format '{0}'r�r�zUnknown archive format '{0}')
r+r�r�r�r�r6�dictr�r"�update)r|r�r6rcZ
filter_kwargsr�r�rOr r r!r�s&
�statvfs�
disk_usageZusageztotal used freezTotal space in byteszUsed space in byteszFree space in bytescCs@tj|�}|j|j}|j|j}|j|j|j}t|||�S)N)r+r��f_bavail�f_frsize�f_blocks�f_bfree�_ntuple_diskusage)r,r?�free�total�usedr r r!r��s

�ntcCs"tj|�\}}||}t|||�S)N)r�Z
_getdiskusager�)r,r�r�r�r r r!r��scCs�|dkr|dkrtd��|}|}|dkr.d}n(t|t�rVt|�}|dkrVtdj|���|dkrdd}n(t|t�s�t|�}|dkr�tdj|���tj	|||�dS)Nzuser and/or group must be setr�zno such user: {!r}zno such group: {!r}���r�)
r�r�rmr��LookupErrorr6�intr�r+r)r,�userr�Z_userZ_groupr r r!r	s"

�P�cCs�yttjd�}Wnttfk
r.d}YnXyttjd�}Wnttfk
r^d}YnX|dksp|dkr�ytjtjj��}Wn$t	tt
fk
r�tj|�}YnX|dkr�|j}|dkr�|j
}tj||f�S)NZCOLUMNSrZLINES)r�r+�environr�r�rrs�
__stdout__�fileno�AttributeErrorr-�
terminal_size�columns�lines)Zfallbackrr�sizer r r!r(s$

cs"dd�}tjj��r&|�|�r"�SdS|dkr>tjjdtj�}|sFdS|jtj�}tj	dkr�tj
|krt|jdtj
�tjjdd�jtj�}t�fdd	�|D��r��g}q‡fd
d�|D�}n�g}t
�}xT|D]L}tjj|�}||kr�|j|�x(|D] }	tjj||	�}
||
|�r�|
Sq�Wq�WdS)NcSs&tjj|�o$tj||�o$tjj|�S)N)r+r,rk�accessr^)r>r[r r r!�
_access_checkbszwhich.<locals>._access_check�PATHZwin32rZPATHEXTr�c3s |]}�j�j|j��VqdS)N)�lowerr�)r�r�)�cmdr r!�	<genexpr>szwhich.<locals>.<genexpr>csg|]}�|�qSr r )r�r�)r
r r!r��szwhich.<locals>.<listcomp>)r+r,r�r��get�defpathr��pathseprs�platformr��insert�anyrdr.r�r_)r
r[r,rZpathext�files�seen�dirZnormdirZthefilerKr )r
r!rUs8







�@)r)FN)r�rrNNN)rrN)r�N)r�r�)r�r�)r�r�)Nr�)NNrrNNN)Nr�)NN)NN�r�r�)r)Vr+rsr7rb�collectionsrE�zlibr��ImportErrorr�r�Zlzmar��pwdrZgrpr�__all__r-r
rrrr"r�r#rr2rrr*rMrrr	rr
rvr�r=rwrx�supports_dir_fdri�supports_fdrTr�rZavoids_symlink_attacksr�rr�r�r�r�r�r�rrrrrr�rrr�r�r�r�r�rrl�
namedtupler�r��__doc__r�r�r�rKr�rr�F_OK�X_OKrr r r r!�<module>s�






:Y!,

58	
@
-





6
"





/




-datetime.cpython-36.opt-1.pyc000064400000147504150335715140011744 0ustar003


 \r@�
@s$dZddlZddlZddlZdd�ZdZdZdZ	d^dd	dd
dd
ddd
dd
dg
Z
d_gZdZx&e
dd�D]Z
eje�ee
7ZqfW[[
dd�Zd
d�Zdd�Zdd�Zdd�Zed�Zed�Zed�Zdd�Zdddddddd d!d"d#d$d%g
Zdd&d'd(d)d*d+d,gZd-d.�Zd`d0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Z d<d=�Z!d>d?�Z"d@dA�Z#dBdC�Z$GdDdE�dE�Z%e%da�e%_&e%dFdGdHdHdIdJ�e%_'e%ddK�e%_(GdLdM�dM�Z)e)Z*e)ddd�e)_&e)ddNd�e)_'e%ddO�e)_(GdPdQ�dQ�Z+e+Z,GdRdS�dS�ZeZ-eddd�e_&edGdHdHdI�e_'e%ddK�e_(GdTdU�dUe)�Z.e.ddd�e._&e.ddNddGdHdHdI�e._'e%ddK�e._(dVdW�Z/GdXdY�dYe+�Z0e0j1e%d��e0_2e0j1e0j3�e0_&e0j1e0j4�e0_'e.dZdde0j2d[�Z5ydd\l6TWne7k
�r�YnPX[[[
[[[[5[	[[[ [[!["[[[[#[*[[[[[[/[[[[-[,[[[$dd]l6mZdS)bz�Concrete date/time and related types.

See http://www.iana.org/time-zones/repository/tz-link.html for
time zone and DST data sources.
�NcCs||krdS||krdSdS)Nr�����)�x�yrr� /usr/lib64/python3.6/datetime.py�_cmpsrri'i۹7���cCs$|ddko"|ddkp"|ddkS)zyear -> 1 if leap year, else 0.�r�di�r)�yearrrr�_is_leap%srcCs(|d}|d|d|d|dS)z2year -> number of days before January 1st of year.rimrr
i�r)rrrrr�_days_before_year)srcCs|dkrt|�rdSt|S)z9year, month -> number of days in that month in that year.��)r�_DAYS_IN_MONTH)r�monthrrr�_days_in_month.srcCst||dkot|�S)zCyear, month -> number of days in year preceding first day of month.r)�_DAYS_BEFORE_MONTHr)rrrrr�_days_before_month5srcCs t||�}t|�t||�|S)z>year, month, day -> ordinal, considering 01-Jan-0001 as day 1.)rrr)rr�day�dimrrr�_ymd2ord:s
ri��e�c	Cs�|d8}t|t�\}}|dd}t|t�\}}t|t�\}}t|d�\}}||d|d|7}|dkst|dkr�|dddfS|dko�|d	kp�|dk}|d
d?}t||dko�|}||kr�|d8}|t||dko�|8}||8}|||dfS)
z@ordinal -> (year, month, day), considering 01-Jan-0001 as day 1.ri�imr
r�r	���2rr)�divmod�_DI400Y�_DI100Y�_DI4Yrr)	�nZn400rZn100Zn4Zn1ZleapyearrZ	precedingrrr�_ord2ymdSs"r&ZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecZMonZTueZWedZThuZFriZSatZSunc	
Cs>t|||�dd}t||�|}tj|||||||||f	�S)N��)rr�_timeZstruct_time)	r�m�d�hh�mm�ssZdstflagZwdayZdnumrrr�_build_struct_time�sr/�autoc
Cstdddddd�}|dkr&|r dnd	}n|d
kr6|d}y||}Wntk
r^td��YnX|j||||�SdS)
Nz{:02d}z
{:02d}:{:02d}z{:02d}:{:02d}:{:02d}z{:02d}:{:02d}:{:02d}.{:03d}z{:02d}:{:02d}:{:02d}.{:06d})�hours�minutes�seconds�milliseconds�microsecondsr0r5r3r4i�zUnknown timespec value)�KeyError�
ValueError�format)r,r-r.�us�timespecZspecs�fmtrrr�_format_time�sr<cCs�d}d}d}g}|j}dt|�}}	�xj||	k�r�||}
|d7}|
dk�r�||	k�r|||}
|d7}|
dkr�|dkr�dt|dd�}|j|�n�|
dk�r|dk�rd}t|d	��r|j�}|dk	�rd
}|jdkr�|}d}t|tdd��\}
}|tdd
�}d||
|f}|j|�n^|
dk�rj|dk�r^d}t|d��r^|j�}|dk	�r^|j	dd�}|j|�n|d�||
�n|d�q(||
�q(Wdj
|�}tj||�S)Nrr�%�fz%06d�microsecond�z��	utcoffset�+�-)r1)r2z
%c%02d%02d�Z�tznamez%%)
�append�len�getattr�hasattrrB�daysr!�	timedeltarF�replace�joinr)�strftime)�objectr8�	timetupleZfreplaceZzreplaceZZreplaceZ	newformat�push�ir%Zch�offset�sign�hr*�srrr�_wrap_strftime�s\












rXcCs(|dk	r$t|t�r$tdt|���dS)Nz4tzinfo.tzname() must return None or string, not '%s')�
isinstance�str�	TypeError�type)�namerrr�
_check_tzname�sr^cCsv|dkrdSt|t�s*td|t|�f��|jr@td||f��td�|ko\td�knsrtd||f��dS)Nz3tzinfo.%s() must return None or timedelta, not '%s'z9tzinfo.%s() must return a whole number of seconds, got %srzN%s()=%s, must be strictly between -timedelta(hours=24) and timedelta(hours=24))rYrLr[r\r5r7)r]rTrrr�_check_utc_offset�s
"r_cCsxt|t�r|St|t�sly|j�}Wntk
r8Yn"Xt|t�rH|Stdt|�j��tdt|�j��td��dS)Nz"__int__ returned non-int (type %s)z$an integer is required (got type %s)z$integer argument expected, got float)rY�int�float�__int__�AttributeErrorr[r\�__name__)�valuerrr�_check_int_fields


rfcCs�t|�}t|�}t|�}t|ko*tknsBtdttf|��d|koTdknsdtd|��t||�}d|ko�|kns�td||��|||fS)Nzyear must be in %d..%drrzmonth must be in 1..12zday must be in 1..%d)rf�MINYEAR�MAXYEARr7r)rrrrrrr�_check_date_fieldss

ricCs�t|�}t|�}t|�}t|�}d|ko2dknsBtd|��d|koTdknsdtd|��d|kovdkns�td|��d|ko�dkns�td|��|dkr�td
|��|||||fS)Nr�zhour must be in 0..23�;zminute must be in 0..59zsecond must be in 0..59i?Bz microsecond must be in 0..999999rzfold must be either 0 or 1)rr)rfr7)�hour�minute�secondr?�foldrrr�_check_time_fields$s




rpcCs |dk	rt|t�rtd��dS)Nz4tzinfo argument must be None or of a tzinfo subclass)rY�tzinfor[)�tzrrr�_check_tzinfo_arg5srscCs tdt|�jt|�jf��dS)Nzcan't compare '%s' to '%s')r[r\rd)rrrrr�	_cmperror9srtcCsRt||�\}}|d9}|dkr&||kn||k}|sF||krN|ddkrN|d7}|S)z�divide a by b and round result to the nearest integer

    When the ratio is exactly half-way between two integers,
    the even integer is returned.
    rrr)r!)�a�b�q�rZgreater_than_halfrrr�_divide_and_round=sryc@seZdZdZdBZdCdd�Zd	d
�Zdd�Zd
d�Ze	dd��Z
e	dd��Ze	dd��Zdd�Z
e
Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�ZeZd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Z d9d:�Z!d;d<�Z"d=d>�Z#d?d@�Z$dAS)DrLa�Represent the difference between two datetime objects.

    Supported operators:

    - add, subtract timedelta
    - unary plus, minus, abs
    - compare to timedelta
    - multiply, divide by int

    In addition, datetime supports subtraction of two datetime objects
    returning a timedelta, and addition or subtraction of a datetime
    and a timedelta giving a datetime.

    Representation: (days, seconds, microseconds).  Why?  Because I
    felt like it.
    �_days�_seconds�
_microseconds�	_hashcodercCs�d}}	}
||d7}||d|d7}||d7}t|t�rttj|�\}}tj|d�\}}
t|
�}	t|�}nd}|}t|t�r�tj|�\}}t|�}||7}n|}t|d�\}}||7}|	t|�7}	|d
}t|t��rt||�}t|d�\}}t|d�\}}||7}|	|7}	n@t|�}t|d�\}}t|d�\}}||7}|	|7}	t||�}t|d�\}}
|	|7}	t|	d�\}}	||7}t|�dk�r�td
|��t	j
|�}||_|	|_|
|_
d|_|S)Nrr(�<ii�g8@g �@grg��.Ai@Bi�ɚ;z$timedelta # of days is too large: %drg�@i�Qi�Qi�Qi�Qr)rYra�_math�modfr`r!�round�abs�
OverflowErrorrP�__new__rzr{r|r})�clsrKr3r5r4r2r1Zweeksr+rWr9ZdayfracZdaysecondsfracZdaysecondswholeZsecondsfracZusdouble�selfrrrr�dsZ




ztimedelta.__new__cCs`|jr&d|jj|jj|j|j|jfS|jrHd|jj|jj|j|jfSd|jj|jj|jfS)Nz%s.%s(%d, %d, %d)z
%s.%s(%d, %d)z	%s.%s(%d))r|�	__class__�
__module__�__qualname__rzr{)r�rrr�__repr__�s

ztimedelta.__repr__cCsdt|jd�\}}t|d�\}}d|||f}|jrLdd�}d||j�|}|jr`|d|j}|S)Nr~z%d:%02d:%02dcSs|t|�dkrdpdfS)NrrWrA)r�)r%rrr�plural�sz!timedelta.__str__.<locals>.pluralz
%d day%s, z.%06d)r!r{rzr|)r�r-r.r,rWr�rrr�__str__�sztimedelta.__str__cCs|jd|jd|jdS)zTotal seconds in the duration.i�Q�
r'i@Bi@B)rKr3r5)r�rrr�
total_seconds�sztimedelta.total_secondscCs|jS)rK)rz)r�rrrrK�sztimedelta.dayscCs|jS)r3)r{)r�rrrr3�sztimedelta.secondscCs|jS)r5)r|)r�rrrr5�sztimedelta.microsecondscCs2t|t�r.t|j|j|j|j|j|j�StS)N)rYrLrzr{r|�NotImplemented)r��otherrrr�__add__�s


ztimedelta.__add__cCs2t|t�r.t|j|j|j|j|j|j�StS)N)rYrLrzr{r|r�)r�r�rrr�__sub__s


ztimedelta.__sub__cCst|t�r||StS)N)rYrLr�)r�r�rrr�__rsub__s

ztimedelta.__rsub__cCst|j|j|j�S)N)rLrzr{r|)r�rrr�__neg__sztimedelta.__neg__cCs|S)Nr)r�rrr�__pos__sztimedelta.__pos__cCs|jdkr|S|SdS)Nr)rz)r�rrr�__abs__s
ztimedelta.__abs__cCs`t|t�r(t|j||j||j|�St|t�r\|j�}|j�\}}tddt	|||��St
S)Nr)rYr`rLrzr{r|ra�_to_microseconds�as_integer_ratioryr�)r�r��usecrurvrrr�__mul__#s


ztimedelta.__mul__cCs|jd|jd|jS)Nrii@Bi�Q)rzr{r|)r�rrrr�2sztimedelta._to_microsecondscCsNt|ttf�stS|j�}t|t�r0||j�St|t�rJtdd||�SdS)Nr)rYr`rLr�r�)r�r�r�rrr�__floordiv__6s

ztimedelta.__floordiv__cCs~t|tttf�stS|j�}t|t�r2||j�St|t�rNtddt||��St|t�rz|j�\}}tddt|||��SdS)Nr)rYr`rarLr�r�ryr�)r�r�r�rurvrrr�__truediv__?s


ztimedelta.__truediv__cCs*t|t�r&|j�|j�}tdd|�StS)Nr)rYrLr�r�)r�r�rxrrr�__mod__Ks
ztimedelta.__mod__cCs4t|t�r0t|j�|j��\}}|tdd|�fStS)Nr)rYrLr!r�r�)r�r�rwrxrrr�
__divmod__Qs

ztimedelta.__divmod__cCs t|t�r|j|�dkSdSdS)NrF)rYrLr)r�r�rrr�__eq__Zs
ztimedelta.__eq__cCs&t|t�r|j|�dkSt||�dS)Nr)rYrLrrt)r�r�rrr�__le__`s
ztimedelta.__le__cCs&t|t�r|j|�dkSt||�dS)Nr)rYrLrrt)r�r�rrr�__lt__fs
ztimedelta.__lt__cCs&t|t�r|j|�dkSt||�dS)Nr)rYrLrrt)r�r�rrr�__ge__ls
ztimedelta.__ge__cCs&t|t�r|j|�dkSt||�dS)Nr)rYrLrrt)r�r�rrr�__gt__rs
ztimedelta.__gt__cCst|j�|j��S)N)r�	_getstate)r�r�rrrrxsztimedelta._cmpcCs|jdkrt|j��|_|jS)Nrr)r}�hashr�)r�rrr�__hash__|s
ztimedelta.__hash__cCs|jdkp|jdkp|jdkS)Nr)rzr{r|)r�rrr�__bool__�s

ztimedelta.__bool__cCs|j|j|jfS)N)rzr{r|)r�rrrr��sztimedelta._getstatecCs|j|j�fS)N)r�r�)r�rrr�
__reduce__�sztimedelta.__reduce__N)rzr{r|r})rrrrrrr)%rdr�r��__doc__�	__slots__r�r�r�r��propertyrKr3r5r��__radd__r�r�r�r�r�r��__rmul__r�r�r�r�r�r�r�r�r�r�rr�r�r�r�rrrrrLQsD
d		
		rLi�ɚ;rjrki?B)rKr1r2r3r5)r5c@s(eZdZdZdCZdDdd�Zed	d
��Zedd��Zed
d��Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZeZedd��Zedd��Zedd��Zdd �Zd!d"�ZdEd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�ZeZd5d6�Z d7d8�Z!d9d:�Z"d;d<�Z#d=d>�Z$d?d@�Z%dAdB�Z&dS)F�datea�Concrete date type.

    Constructors:

    __new__()
    fromtimestamp()
    today()
    fromordinal()

    Operators:

    __repr__, __str__
    __eq__, __le__, __lt__, __ge__, __gt__, __hash__
    __add__, __radd__, __sub__ (add/radd only with timedelta arg)

    Methods:

    timetuple()
    toordinal()
    weekday()
    isoweekday(), isocalendar(), isoformat()
    ctime()
    strftime()

    Properties (readonly):
    year, month, day
    �_year�_month�_dayr}NcCs�|dkr�t|ttf�r�t|�dkr�dt|dd��ko@dknr�t|t�r|y|jd�}Wntk
rztd��YnXtj	|�}|j
|�d	|_|St|||�\}}}tj	|�}||_
||_||_d
|_|S)zVConstructor.

        Arguments:

        year, month, day (required, base 1)
        Nrrrrr�latin1znFailed to encode latin1 string when unpickling a date object. pickle.load(data, encoding='latin1') is assumed.rr)rY�bytesrZrH�ord�encode�UnicodeEncodeErrorr7rPr��_date__setstater}rir�r�r�)r�rrrr�rrrr��s($



zdate.__new__c	Cs(tj|�\	}}}}}}}}	}
||||�S)z;Construct a date from a POSIX timestamp (like time.time()).)r)�	localtime)r��trr*r+r,r-r.�weekday�jday�dstrrr�
fromtimestamp�szdate.fromtimestampcCstj�}|j|�S)z"Construct a date from time.time().)r)�timer�)r�r�rrr�today�sz
date.todaycCst|�\}}}||||�S)z�Construct a date from a proleptic Gregorian ordinal.

        January 1 of year 1 is day 1.  Only the year, month and day are
        non-zero in the result.
        )r&)r�r%rr*r+rrr�fromordinal�szdate.fromordinalcCs d|jj|jj|j|j|jfS)a5Convert to formal string, for repr().

        >>> dt = datetime(2010, 1, 1)
        >>> repr(dt)
        'datetime.datetime(2010, 1, 1, 0, 0)'

        >>> dt = datetime(2010, 1, 1, tzinfo=timezone.utc)
        >>> repr(dt)
        'datetime.datetime(2010, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)'
        z%s.%s(%d, %d, %d))r�r�r�r�r�r�)r�rrrr��s
z
date.__repr__cCs.|j�dpd}dt|t|j|j|jfS)zReturn ctime() style string.r(z%s %s %2d 00:00:00 %04d)�	toordinal�	_DAYNAMES�_MONTHNAMESr�r�r�)r�r�rrr�ctimes
z
date.ctimecCst|||j��S)zFormat using strftime().)rXrQ)r�r;rrrrO	sz
date.strftimecCs:t|t�stdt|�j��t|�dkr2|j|�St|�S)Nzmust be str, not %sr)rYrZr[r\rdrHrO)r�r;rrr�
__format__
s


zdate.__format__cCsd|j|j|jfS)z�Return the date formatted according to ISO.

        This is 'YYYY-MM-DD'.

        References:
        - http://www.w3.org/TR/NOTE-datetime
        - http://www.cl.cam.ac.uk/~mgk25/iso-time.html
        z%04d-%02d-%02d)r�r�r�)r�rrr�	isoformats	zdate.isoformatcCs|jS)z
year (1-9999))r�)r�rrrr"sz	date.yearcCs|jS)zmonth (1-12))r�)r�rrrr'sz
date.monthcCs|jS)z
day (1-31))r�)r�rrrr,szdate.daycCst|j|j|jdddd�S)z9Return local time tuple compatible with time.localtime().rrr)r/r�r�r�)r�rrrrQ4szdate.timetuplecCst|j|j|j�S)z�Return proleptic Gregorian ordinal for the year, month and day.

        January 1 of year 1 is day 1.  Only the year, month and day values
        contribute to the result.
        )rr�r�r�)r�rrrr�9szdate.toordinalcCs:|dkr|j}|dkr|j}|dkr*|j}t|�|||�S)z;Return a new date with new values for the specified fields.N)r�r�r�r\)r�rrrrrrrMAszdate.replacecCst|t�r|j|�dkStS)Nr)rYr�rr�)r�r�rrrr�Ms
zdate.__eq__cCst|t�r|j|�dkStS)Nr)rYr�rr�)r�r�rrrr�Rs
zdate.__le__cCst|t�r|j|�dkStS)Nr)rYr�rr�)r�r�rrrr�Ws
zdate.__lt__cCst|t�r|j|�dkStS)Nr)rYr�rr�)r�r�rrrr�\s
zdate.__ge__cCst|t�r|j|�dkStS)Nr)rYr�rr�)r�r�rrrr�as
zdate.__gt__cCsB|j|j|j}}}|j|j|j}}}t|||f|||f�S)N)r�r�r�r)r�r�rr*r+Zy2�m2Zd2rrrrfsz	date._cmpcCs|jdkrt|j��|_|jS)zHash.rr)r}r�r�)r�rrrr�ls
z
date.__hash__cCsFt|t�rB|j�|j}d|ko*tknr:tj|�Std��tS)zAdd a date to a timedelta.rzresult out of range)	rYrLr�rK�_MAXORDINALr�r�r�r�)r�r��orrrr�ts

zdate.__add__cCsDt|t�r|t|j�St|t�r@|j�}|j�}t||�StS)z.Subtract two dates, or a date and a timedelta.)rYrLrKr�r�r�)r�r��days1�days2rrrr�s

zdate.__sub__cCs|j�ddS)z:Return day of the week, where Monday == 0 ... Sunday == 6.r'r()r�)r�rrrr��szdate.weekdaycCs|j�dpdS)z:Return day of the week, where Monday == 1 ... Sunday == 7.r()r�)r�rrr�
isoweekday�szdate.isoweekdaycCs�|j}t|�}t|j|j|j�}t||d�\}}|dkr^|d8}t|�}t||d�\}}n$|dkr�|t|d�kr�|d7}d}||d|dfS)a�Return a 3-tuple containing ISO year, week number, and weekday.

        The first ISO week of the year is the (Mon-Sun) week
        containing the year's first Thursday; everything else derives
        from that.

        The first week is 1; Monday is 1 ... Sunday is 7.

        ISO calendar algorithm taken from
        http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm
        (used with permission)
        r(rr�4)r��_isoweek1mondayrr�r�r!)r�r�week1mondayr�Zweekrrrr�isocalendar�s
zdate.isocalendarcCs&t|jd�\}}t|||j|jg�fS)N�)r!r�r�r�r�)r��yhi�ylorrrr��szdate._getstatecCs"|\}}|_|_|d||_dS)Nr�)r�r�r�)r��stringr�r�rrr�
__setstate�szdate.__setstatecCs|j|j�fS)N)r�r�)r�rrrr��szdate.__reduce__)r�r�r�r})NN)NNN)'rdr�r�r�r�r��classmethodr�r�r�r�r�rOr�r�r�r�rrrrQr�rMr�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�rrrrr��sD
"
	
r�r)rKc@s<eZdZdZfZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dS)
rqz}Abstract base class for time zone info classes.

    Subclasses must override the name(), utcoffset() and dst() methods.
    cCstd��dS)z%datetime -> string name of time zone.z&tzinfo subclass must override tzname()N)�NotImplementedError)r��dtrrrrF�sz
tzinfo.tznamecCstd��dS)z:datetime -> minutes east of UTC (negative for west of UTC)z)tzinfo subclass must override utcoffset()N)r�)r�r�rrrrB�sztzinfo.utcoffsetcCstd��dS)z�datetime -> DST offset in minutes east of UTC.

        Return 0 if DST not in effect.  utcoffset() must include the DST
        offset.
        z#tzinfo subclass must override dst()N)r�)r�r�rrrr��sz
tzinfo.dstcCs�t|t�std��|j|k	r$td��|j�}|dkr<td��|j�}|dkrTtd��||}|r�||7}|j�}|dkr�td��||S)z*datetime in UTC -> datetime in local time.z&fromutc() requires a datetime argumentzdt.tzinfo is not selfNz0fromutc() requires a non-None utcoffset() resultz*fromutc() requires a non-None dst() resultz;fromutc(): dt.dst gave inconsistent results; cannot convert)rY�datetimer[rqr7rBr�)r�r�ZdtoffZdtdst�deltarrr�fromutc�s"

ztzinfo.fromutccCsft|dd�}|r|�}nf}t|dd�}|r4|�}nt|dd�pBd}|dkrV|j|fS|j||fSdS)N�__getinitargs__�__getstate__�__dict__)rIr�)r�Zgetinitargs�args�getstate�staterrrr��s
ztzinfo.__reduce__N)
rdr�r�r�r�rFrBr�r�r�rrrrrq�srqc@s eZdZdZdGZdHd	d�dd
�Zedd��Zedd��Zedd��Z	edd��Z
edd��Zedd��Zdd�Z
dd�Zdd�Zd d!�Zd"d#�ZdId%d&�Zd'd(�ZdJd*d+�Zd,d-�ZdKd/d0�ZeZd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�ZdLd
d�d<d=�ZdMd?d@�ZdAdB�ZdCdD�Z dEdF�Z!d
S)Nr�a<Time with time zone.

    Constructors:

    __new__()

    Operators:

    __repr__, __str__
    __eq__, __le__, __lt__, __ge__, __gt__, __hash__

    Methods:

    strftime()
    isoformat()
    utcoffset()
    tzname()
    dst()

    Properties (readonly):
    hour, minute, second, microsecond, tzinfo, fold
    �_hour�_minute�_second�_microsecond�_tzinfor}�_foldrN)rocCs�t|ttf�r�t|�dkr�t|dd��d@dkr�t|t�rhy|jd�}Wntk
rftd��YnXtj	|�}|j
||p~d�d	|_|St|||||�\}}}}}t
|�tj	|�}||_||_||_||_||_d
|_||_|S)z�Constructor.

        Arguments:

        hour, minute (required)
        second, microsecond (default to zero)
        tzinfo (default to None)
        fold (keyword only, default to zero)
        r'rr�rr�znFailed to encode latin1 string when unpickling a time object. pickle.load(data, encoding='latin1') is assumed.Nrr)rYr�rZrHr�r�r�r7rPr��_time__setstater}rprsr�r�r�r�r�r�)r�rlrmrnr?rqror�rrrr�#s0



ztime.__new__cCs|jS)zhour (0-23))r�)r�rrrrlKsz	time.hourcCs|jS)z
minute (0-59))r�)r�rrrrmPsztime.minutecCs|jS)z
second (0-59))r�)r�rrrrnUsztime.secondcCs|jS)zmicrosecond (0-999999))r�)r�rrrr?Zsztime.microsecondcCs|jS)ztimezone info object)r�)r�rrrrq_sztime.tzinfocCs|jS)N)r�)r�rrrrodsz	time.foldcCs$t|t�r|j|dd�dkSdSdS)NT)�allow_mixedrF)rYr�r)r�r�rrrr�ls
ztime.__eq__cCs&t|t�r|j|�dkSt||�dS)Nr)rYr�rrt)r�r�rrrr�rs
ztime.__le__cCs&t|t�r|j|�dkSt||�dS)Nr)rYr�rrt)r�r�rrrr�xs
ztime.__lt__cCs&t|t�r|j|�dkSt||�dS)Nr)rYr�rrt)r�r�rrrr�~s
ztime.__ge__cCs&t|t�r|j|�dkSt||�dS)Nr)rYr�rrt)r�r�rrrr��s
ztime.__gt__Fc
Cs�|j}|j}d}}||kr"d}n|j�}|j�}||k}|rht|j|j|j|jf|j|j|j|jf�S|dksx|dkr�|r�dStd��|jd|j|tdd�}|jd|j|tdd�}	t||j|jf|	|j|jf�S)NTrz$cannot compare naive and aware timesr~r)r2)	r�rBrr�r�r�r�r[rL)
r�r�r��mytz�ottz�myoff�otoff�base_compareZmyhhmmZothhmmrrrr�s*
z	time._cmpcCs�|jdkr�|jr|jdd�}n|}|j�}|sBt|j�d�|_nztt|j|j	d�|tdd��\}}|tdd�}d|ko�dknr�tt
|||j|j��|_nt|||j|jf�|_|jS)	zHash.rr)ro)r1r2)r1)r2rr)
r}rorMrBr�r�r!rLrlrmr�rnr?)r�r��tzoffrVr*rrrr��s
z
time.__hash__�:cCsx|j�}|dk	rt|jdkr&d}|}nd}t|tdd��\}}t|tdd��\}}d||||f}|rt|d	|j7}|S)
z2Return formatted timezone offset (+xx:xx) or None.NrrDrCr)r1)r2z%s%02d%s%02dz:%02d)rBrKr!rLr3)r��sep�offrUr,r-r.rrr�_tzstr�s
ztime._tzstrcCs�|jdkrd|j|jf}n|jdkr2d|j}nd}d|jj|jj|j|j|f}|jdk	rx|dd�d|jd	}|jr�|dd�d
}|S)
z%Convert to formal string, for repr().rz, %d, %dz, %drAz%s.%s(%d, %d%s)Nrz, tzinfo=%r�)z	, fold=1)rr)	r�r�r�r�r�r�r�r�r�)r�rWrrrr��s


z
time.__repr__r0cCs0t|j|j|j|j|�}|j�}|r,||7}|S)a'Return the time formatted according to ISO.

        The full format is 'HH:MM:SS.mmmmmm+zz:zz'. By default, the fractional
        part is omitted if self.microsecond == 0.

        The optional argument timespec specifies the number of additional
        terms of the time to include.
        )r<r�r�r�r�r�)r�r:rWrrrrrr��s	
ztime.isoformatc	Cs(ddd|j|j|jdddf	}t|||�S)z{Format using strftime().  The date part of the timestamp passed
        to underlying strftime should not be used.
        ilrrr)r�r�r�rX)r�r;rQrrrrO�s
z
time.strftimecCs:t|t�stdt|�j��t|�dkr2|j|�St|�S)Nzmust be str, not %sr)rYrZr[r\rdrHrO)r�r;rrrr��s


ztime.__format__cCs(|jdkrdS|jjd�}td|�|S)zQReturn the timezone offset in minutes east of UTC (negative west of
        UTC).NrB)r�rBr_)r�rTrrrrBs


ztime.utcoffsetcCs&|jdkrdS|jjd�}t|�|S)aReturn the timezone name.

        Note that the name is 100% informational -- there's no requirement that
        it mean anything in particular. For example, "GMT", "UTC", "-500",
        "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies.
        N)r�rFr^)r�r]rrrrFs

ztime.tznamecCs(|jdkrdS|jjd�}td|�|S)afReturn 0 if DST is not in effect, or the DST offset (in minutes
        eastward) if DST is in effect.

        This is purely informational; the DST offset has already been added to
        the UTC offset returned by utcoffset() if applicable, so there's no
        need to consult dst() unless you're interested in displaying the DST
        info.
        Nr�)r�r�r_)r�rTrrrr�s
	

ztime.dstTcCsl|dkr|j}|dkr|j}|dkr*|j}|dkr8|j}|dkrF|j}|dkrT|j}t|�||||||d�S)z;Return a new time with new values for the specified fields.NT)ro)rlrmrnr?rqr�r\)r�rlrmrnr?rqrorrrrM,sztime.replacercCspt|jd�\}}t|d�\}}|j}|jr:|dkr:|d7}t||j|j|||g�}|jdkrb|fS||jfSdS)Nr�r�)r!r�r�r�r�r�r�r�)r��protocol�us2�us3�us1rV�	basestaterrrr�?s
ztime._getstatecCsv|dk	rt|t�rtd��|\}|_|_}}}|dkrJd|_|d|_nd|_||_|d>|Bd>|B|_||_dS)Nzbad tzinfo state argr�rr�r�)	rY�
_tzinfo_classr[r�r�r�r�r�r�)r�r�rqrVr�r�r�rrrr�Lsztime.__setstatecCst|j|�fS)N)r�r�)r�r�rrr�
__reduce_ex__Ysztime.__reduce_ex__cCs
|jd�S)Nr)r�)r�rrrr�\sztime.__reduce__)r�r�r�r�r�r}r�)rrrrN)F)r�)r0)NNNNT)r)"rdr�r�r�r�r�r�rlrmrnr?rqror�r�r�r�r�rr�r�r�r�r�rOr�rBrFr�rMr�r�r�r�rrrrr�
s>(


		



r�c@s�eZdZdZejejZdbdd�dd�Zedd��Z	ed	d
��Z
edd��Zed
d��Zedd��Z
edd��Zedd��Zedcdd��Zedd��Zedddd��Zedd��Zededd��Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zdfdd�d.d/�Zd0d1�Zdgd2d3�Zd4d5�Zdhd8d9�Zd:d;�Z d<d=�Z!ed>d?��Z"d@dA�Z#dBdC�Z$dDdE�Z%dFdG�Z&dHdI�Z'dJdK�Z(dLdM�Z)dNdO�Z*didQdR�Z+dSdT�Z,e,Z-dUdV�Z.dWdX�Z/djdZd[�Z0d\d]�Z1d^d_�Z2d`da�Z3dS)kr�z�datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])

    The year, month and day arguments are required. tzinfo may be None, or an
    instance of a tzinfo subclass. The remaining arguments may be ints.
    Nr)roc	Cst|ttf�r�t|�dkr�dt|dd��d@ko<dknr�t|t�rxyt|d�}Wntk
rvtd��YnXtj|�}
|
j	||�d	|
_
|
St|||�\}}}t|||||	�\}}}}}	t
|�tj|�}
||
_||
_||
_||
_||
_||
_||
_||
_d
|
_
|	|
_|
S)Nr�rrrr�rr�zrFailed to encode latin1 string when unpickling a datetime object. pickle.load(data, encoding='latin1') is assumed.rr)rYr�rZrHr�r�r7rPr��_datetime__setstater}rirprsr�r�r�r�r�r�r�r�r�)r�rrrrlrmrnr?rqror�rrrr�ms8(


zdatetime.__new__cCs|jS)zhour (0-23))r�)r�rrrrl�sz
datetime.hourcCs|jS)z
minute (0-59))r�)r�rrrrm�szdatetime.minutecCs|jS)z
second (0-59))r�)r�rrrrn�szdatetime.secondcCs|jS)zmicrosecond (0-999999))r�)r�rrrr?�szdatetime.microsecondcCs|jS)ztimezone info object)r�)r�rrrrq�szdatetime.tzinfocCs|jS)N)r�)r�rrrro�sz
datetime.foldc	Csptj|�\}}t|d�}|dkr4|d7}|d8}n|dkrL|d8}|d7}|rVtjntj}||�\	}}}	}
}}}
}}t|d�}||||	|
||||�}|dk�rbd}||kr�tjj	d	�r�|S|||�dd
�\}}}	}
}}||||	|
||||�}||t
d|�}|jdk�rl|||t
dd��dd
�\}}}	}
}}||||	|
||||�}||k�rld|_n
|j
|�}|S)z�Construct a datetime from a POSIX timestamp (like time.time()).

        A timezone info object may be passed in as well.
        g��.Ai@BrrrkNri�winr'i�Q)rr�r�r)�gmtimer��min�sys�platform�
startswithrLrKr�r�)r�r��utcrrZfracr9Z	converterrr*r+r,r-r.r�r�r��result�max_fold_secondsZprobe1ZtransZprobe2rrr�_fromtimestamp�s4


 *

zdatetime._fromtimestampcCst|�|j||dk	|�S)z�Construct a datetime from a POSIX timestamp (like time.time()).

        A timezone info object may be passed in as well.
        N)rsr	)r�r�rrrrrr��szdatetime.fromtimestampcCs|j|dd�S)z6Construct a naive UTC datetime from a POSIX timestamp.TN)r	)r�r�rrr�utcfromtimestamp�szdatetime.utcfromtimestampcCstj�}|j||�S)zBConstruct a datetime from time.time() and optional time zone info.)r)r�r�)r�rrr�rrr�now�szdatetime.nowcCstj�}|j|�S)z*Construct a UTC datetime from time.time().)r)r�r
)r�r�rrr�utcnow�szdatetime.utcnowTcCs\t|t�std��t|t�s$td��|dkr2|j}||j|j|j|j|j	|j
|j||jd�	S)z8Construct a datetime from a given date and a given time.z%date argument must be a date instancez%time argument must be a time instanceT)ro)
rY�_date_classr[�_time_classrqrrrrlrmrnr?ro)r�r�r�rqrrr�combine�s

zdatetime.combinecCsD|j�}|dkrd}n|r d}nd}t|j|j|j|j|j|j|�S)z9Return local time tuple compatible with time.localtime().Nrrr)r�r/rrrrlrmrn)r�r�rrrrQszdatetime.timetuplec
s�tddd��d}|�tdd�}�fdd�}||�|}||}||�}||kr�|||f|j}||�|}||kr�|Sn||}||}||�}	|	|kr�|S||kr�|Sttf|j||�S)	zReturn integer POSIX timestamp.i�rrircs>tj|�dd�\}}}}}}t||||||��tdd�S)Nr'rr)r)r�r�rL)�urr*r+r,r-r.)�epochrr�localszdatetime._mktime.<locals>.locali�Q)r�rLro�maxr)
r�rr�rruZu1Zt1Zu2rvZt2r)rr�_mktimes(zdatetime._mktimecCs0|jdkr |j�}||jdS|tj�SdS)zReturn POSIX timestamp as floatNg��.A)r�rr?�_EPOCHr�)r�rWrrr�	timestamp2s
zdatetime.timestampcCsT|j�}|r||8}|j|j|j}}}|j|j|j}}}t||||||d�S)z4Return UTC time tuple compatible with time.gmtime().r)rBrrrrlrmrnr/)r�rTrr*r+r,r-r.rrr�utctimetuple:szdatetime.utctimetuplecCst|j|j|j�S)zReturn the date part.)r�r�r�r�)r�rrrr�Csz
datetime.datecCst|j|j|j|j|jd�S)z'Return the time part, with tzinfo None.)ro)r�rlrmrnr?ro)r�rrrr�Gsz
datetime.timecCs t|j|j|j|j|j|jd�S)z'Return the time part, with same tzinfo.)ro)r�rlrmrnr?r�ro)r�rrr�timetzKszdatetime.timetzc	
Cs�|dkr|j}|dkr|j}|dkr*|j}|dkr8|j}|dkrF|j}|dkrT|j}|dkrb|j}|dkrp|j}|	dkr~|j}	t	|�|||||||||	d�	S)z?Return a new datetime with new values for the specified fields.NT)ro)
rrrrlrmrnr?rqror\)
r�rrrrlrmrnr?rqrorrrrMPs(zdatetime.replacecCs�|jdkr|j�}n|ttdd�}tj|�}t|dd��}y|j}|j}WnDt	k
r�|ttj
|�dd��}tjd|�}t||�}YnXtt|d�|�}|S)Nr)r3r'z%Z)
rqrrrLr)r�r�Z	tm_gmtoffZtm_zonercrrO�timezone)r�ZtsZlocaltmrZgmtoffZzoner�rrrrr�_local_timezoneis



zdatetime._local_timezonecCs�|dkr|j�}nt|t�s$td��|j}|dkrF|j�}|j|�}n,|j|�}|dkrr|jdd�j�}|j|�}||kr~|S||j|d�}|j|�S)Nz)tz argument must be an instance of tzinfo)rq)rrYrqr[rBrMr�)r�rrr�Zmyoffsetrrrr�
astimezone|s 



zdatetime.astimezonecCs:|j�dpd}dt|t|j|j|j|j|j|jfS)zReturn ctime() style string.r(z%s %s %2d %02d:%02d:%02d %04d)	r�r�r�r�r�r�r�r�r�)r�r�rrrr��szdatetime.ctime�Tr0c	Cs�d|j|j|j|ft|j|j|j|j|�}|j�}|dk	r�|j	dkrTd}|}nd}t
|tdd��\}}t
|tdd��\}}|d	|||f7}|r�|d
|j7}|S)a(Return the time formatted according to ISO.

        The full format looks like 'YYYY-MM-DD HH:MM:SS.mmmmmm'.
        By default, the fractional part is omitted if self.microsecond == 0.

        If self.tzinfo is not None, the UTC offset is also attached, giving
        giving a full format of 'YYYY-MM-DD HH:MM:SS.mmmmmm+HH:MM'.

        Optional argument sep specifies the separator between date and
        time, default 'T'.

        The optional argument timespec specifies the number of additional
        terms of the time to include.
        z%04d-%02d-%02d%cNrrDrCr)r1)r2z%s%02d:%02dz:%02d)
r�r�r�r<r�r�r�r�rBrKr!rLr3)	r�r�r:rWr�rUr,r-r.rrrr��s
zdatetime.isoformatcCs�|j|j|j|j|j|j|jg}|d	dkr2|d
=|ddkrD|d=d|jj|jj	dj
tt|��f}|j
dk	r�|dd
�d|j
d}|jr�|dd�d}|S)z%Convert to formal string, for repr().rrz	%s.%s(%s)z, Nz, tzinfo=%rr�z	, fold=1)rrrrrr)r�r�r�r�r�r�r�r�r�r�rN�maprZr�r�)r��LrWrrrr��s
zdatetime.__repr__cCs|jdd�S)zConvert to string, for str().� )r�)r�)r�rrrr��szdatetime.__str__cCsddl}|j|||�S)zKstring, format -> new datetime parsed from a string (like time.strptime()).rN)�	_strptimeZ_strptime_datetime)r�Zdate_stringr8r rrr�strptime�szdatetime.strptimecCs(|jdkrdS|jj|�}td|�|S)zQReturn the timezone offset in minutes east of UTC (negative west of
        UTC).NrB)r�rBr_)r�rTrrrrB�s


zdatetime.utcoffsetcCs&|jdkrdS|jj|�}t|�|S)aReturn the timezone name.

        Note that the name is 100% informational -- there's no requirement that
        it mean anything in particular. For example, "GMT", "UTC", "-500",
        "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies.
        N)r�rFr^)r�r]rrrrF�s

zdatetime.tznamecCs(|jdkrdS|jj|�}td|�|S)afReturn 0 if DST is not in effect, or the DST offset (in minutes
        eastward) if DST is in effect.

        This is purely informational; the DST offset has already been added to
        the UTC offset returned by utcoffset() if applicable, so there's no
        need to consult dst() unless you're interested in displaying the DST
        info.
        Nr�)r�r�r_)r�rTrrrr��s
	

zdatetime.dstcCs2t|t�r|j|dd�dkSt|t�s*tSdSdS)NT)r�rF)rYr�rr�r�)r�r�rrrr�s


zdatetime.__eq__cCs4t|t�r|j|�dkSt|t�s&tSt||�dS)Nr)rYr�rr�r�rt)r�r�rrrr�s


zdatetime.__le__cCs4t|t�r|j|�dkSt|t�s&tSt||�dS)Nr)rYr�rr�r�rt)r�r�rrrr�s


zdatetime.__lt__cCs4t|t�r|j|�dkSt|t�s&tSt||�dS)Nr)rYr�rr�r�rt)r�r�rrrr�s


zdatetime.__ge__cCs4t|t�r|j|�dkSt|t�s&tSt||�dS)Nr)rYr�rr�r�rt)r�r�rrrr�'s


zdatetime.__gt__Fc		Cs|j}|j}d}}||kr"d}nT|j�}|j�}|rn||j|jd�j�krRdS||j|jd�j�krndS||k}|r�t|j|j|j|j|j	|j
|jf|j|j|j|j|j	|j
|jf�S|dks�|dkr�|r�dStd��||}|j
dkr�dS|o�d�p�dS)NT)rorz(cannot compare naive and aware datetimesrrr)r�rBrMrorr�r�r�r�r�r�r�r[rK)	r�r�r�r�r�r�r�r�Zdiffrrrr/s8

z
datetime._cmpc	Cs�t|t�stSt|j�|j|j|j|jd�}||7}t|j	d�\}}t|d�\}}d|j
koftknr�tj
tj|j
�t||||j|jd��Std��dS)zAdd a datetime and a timedelta.)r1r2r3r5ir~r)rqzresult out of rangeN)rYrLr�r�r�r�r�r�r!r3rKr�r�rr�r�r�r5r�r�)r�r�r�rlZremrmrnrrrr�Ts 

zdatetime.__add__c	Cs�t|t�s"t|t�r||StS|j�}|j�}|j|jd|jd}|j|jd|jd}t|||||j|j�}|j	|j	kr�|S|j
�}|j
�}||kr�|S|dks�|dkr�td��|||S)z6Subtract two datetimes, or a datetime and a timedelta.r~iNz(cannot mix naive and timezone-aware time)rYr�rLr�r�r�r�r�r�r�rBr[)	r�r�r�r�Zsecs1Zsecs2�baser�r�rrrr�is(


zdatetime.__sub__cCs�|jdkr�|jr|jdd�}n|}|j�}|dkrFt|j�d�|_nDt|j|j|j	�}|j
d|jd|j}tt
|||j�|�|_|jS)Nrr)roir~r)r}rorMrBr�r�rrrrrlrmrnrLr?)r�r�r�rKr3rrrr��s
zdatetime.__hash__rc	Cs�t|jd�\}}t|jd�\}}t|d�\}}|j}|jrJ|dkrJ|d7}t||||j|j|j|j	|||g
�}|j
dkr~|fS||j
fSdS)Nr�rr�)r!r�r�r�r�r�r�r�r�r�r�)	r�r�r�r�r�r�r�r*r�rrrr��s
zdatetime._getstatec	
Cs�|dk	rt|t�rtd��|\
}}}|_|_|_|_}}}|dkrVd|_|d|_nd|_||_|d||_	|d>|Bd>|B|_
||_dS)Nzbad tzinfo state argr�rr�rr�r�)rYr�r[r�r�r�r�r�r�r�r�r�)	r�r�rqr�r�r*r�r�r�rrrr��s zdatetime.__setstatecCs|j|j|�fS)N)r�r�)r�r�rrrr��szdatetime.__reduce_ex__cCs
|jd�S)Nr)r�)r�rrrr��szdatetime.__reduce__)NNrrrrN)N)N)T)NNNNNNNT)N)rr0)F)r)4rdr�r�r�r�r�r�r�r�rlrmrnr?rqror�r	r�r
rrrrQrrrrrMrrr�r�r�r�r!rBrFr�r�r�r�r�r�rr�r�r�r�r�r�r�r�rrrrr�esj#,	
#	


"	

%
r�cCs8d}t|dd�}|dd}||}||kr4|d7}|S)Nrrr'r()r)rZTHURSDAYZfirstdayZfirstweekdayr�rrrr��sr�c@s�eZdZdZe�Zefdd�Zed dd��Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zeddd�ZeZedd��ZdS)!r�_offset�_namecCs�t|t�std��||jkr,|s&|jSd}nt|t�s>td��|j|koT|jknsbtd��|j	dksz|j
ddkr�td��|j||�S)Nzoffset must be a timedeltazname must be a stringzYoffset must be a timedelta strictly between -timedelta(hours=24) and timedelta(hours=24).rr~zAoffset must be a timedelta representing a whole number of minutes)rYrLr[�_OmittedrrZ�
_minoffset�
_maxoffsetr7r5r3�_create)r�rTr]rrrr��s


ztimezone.__new__NcCstj|�}||_||_|S)N)rqr�r#r$)r�rTr]r�rrrr(�s
ztimezone._createcCs|jdkr|jfS|j|jfS)zpickle supportN)r$r#)r�rrrr��s
ztimezone.__getinitargs__cCst|�tkrdS|j|jkS)NF)r\rr#)r�r�rrrr��sztimezone.__eq__cCs
t|j�S)N)r�r#)r�rrrr��sztimezone.__hash__cCsL||jkrdS|jdkr0d|jj|jj|jfSd|jj|jj|j|jfS)aConvert to formal string, for repr().

        >>> tz = timezone.utc
        >>> repr(tz)
        'datetime.timezone.utc'
        >>> tz = timezone(timedelta(hours=-5), 'EST')
        >>> repr(tz)
        "datetime.timezone(datetime.timedelta(-1, 68400), 'EST')"
        zdatetime.timezone.utcNz	%s.%s(%r)z
%s.%s(%r, %r))rr$r�r�r�r#)r�rrrr��s



ztimezone.__repr__cCs
|jd�S)N)rF)r�rrrr�sztimezone.__str__cCs$t|t�s|dkr|jStd��dS)Nz8utcoffset() argument must be a datetime instance or None)rYr�r#r[)r�r�rrrrB
sztimezone.utcoffsetcCs:t|t�s|dkr.|jdkr(|j|j�S|jStd��dS)Nz5tzname() argument must be a datetime instance or None)rYr�r$�_name_from_offsetr#r[)r�r�rrrrFs

ztimezone.tznamecCs"t|t�s|dkrdStd��dS)Nz2dst() argument must be a datetime instance or None)rYr�r[)r�r�rrrr�sztimezone.dstcCs2t|t�r&|j|k	rtd��||jStd��dS)Nzfromutc: dt.tzinfo is not selfz6fromutc() argument must be a datetime instance or None)rYr�rqr7r#r[)r�r�rrrr�s



ztimezone.fromutcrjrk)r1r2cCsT|sdS|td�kr d}|}nd}t|tdd��\}}|tdd�}dj|||�S)	NZUTCrrDrCr)r1)r2zUTC{}{:02d}:{:02d})rLr!r8)r�rUr1�restr2rrrr)*sztimezone._name_from_offset)r#r$)N)rdr�r�r�rPr%r�r�r(r�r�r�r�r�rBrFr�r�rLr'r&�staticmethodr)rrrrr�s"	ri�)rq)�*)r�rr)r0i6e�)8r�r�r)Zmathrrrrgrhr�rrZdbmrrGrrrrrr"r#r$r&r�r�r/r<rXr^r_rfrirprsrtryrLrrZ
resolutionr�r
rqr�rr�r�rr(rr&r'rZ	_datetime�ImportErrorrrrr�<module>s�
	?
:
?


,DWVpG




heapq.cpython-36.opt-2.pyc000064400000026050150335715140011237 0ustar003


 \�Y�#@sVdZddddddddgZd	d�Zd
d�Zdd�Zdd�Zd
d�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
ddd�dd�Zd(d d�Zd)d!d�Zyd"d#lTWnek
r�YnXyd"d$lmZWnek
r�YnXyd"d%lm	Z	Wnek
�r
YnXyd"d&lmZWnek
�r2YnXed'k�rRd"dlZeej��dS)*uoHeap queues

[explanation by François Pinard]

Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0.  For the sake of comparison,
non-existing elements are considered to be infinite.  The interesting
property of a heap is that a[0] is always its smallest element.

The strange invariant above is meant to be an efficient memory
representation for a tournament.  The numbers below are `k', not a[k]:

                                   0

                  1                                 2

          3               4                5               6

      7       8       9       10      11      12      13      14

    15 16   17 18   19 20   21 22   23 24   25 26   27 28   29 30


In the tree above, each cell `k' is topping `2*k+1' and `2*k+2'.  In
a usual binary tournament we see in sports, each cell is the winner
over the two cells it tops, and we can trace the winner down the tree
to see all opponents s/he had.  However, in many computer applications
of such tournaments, we do not need to trace the history of a winner.
To be more memory efficient, when a winner is promoted, we try to
replace it by something else at a lower level, and the rule becomes
that a cell and the two cells it tops contain three different items,
but the top cell "wins" over the two topped cells.

If this heap invariant is protected at all time, index 0 is clearly
the overall winner.  The simplest algorithmic way to remove it and
find the "next" winner is to move some loser (let's say cell 30 in the
diagram above) into the 0 position, and then percolate this new 0 down
the tree, exchanging values, until the invariant is re-established.
This is clearly logarithmic on the total number of items in the tree.
By iterating over all items, you get an O(n ln n) sort.

A nice feature of this sort is that you can efficiently insert new
items while the sort is going on, provided that the inserted items are
not "better" than the last 0'th element you extracted.  This is
especially useful in simulation contexts, where the tree holds all
incoming events, and the "win" condition means the smallest scheduled
time.  When an event schedule other events for execution, they are
scheduled into the future, so they can easily go into the heap.  So, a
heap is a good structure for implementing schedulers (this is what I
used for my MIDI sequencer :-).

Various structures for implementing schedulers have been extensively
studied, and heaps are good for this, as they are reasonably speedy,
the speed is almost constant, and the worst case is not much different
than the average case.  However, there are other representations which
are more efficient overall, yet the worst cases might be terrible.

Heaps are also very useful in big disk sorts.  You most probably all
know that a big sort implies producing "runs" (which are pre-sorted
sequences, which size is usually related to the amount of CPU memory),
followed by a merging passes for these runs, which merging is often
very cleverly organised[1].  It is very important that the initial
sort produces the longest runs possible.  Tournaments are a good way
to that.  If, using all the memory available to hold a tournament, you
replace and percolate items that happen to fit the current run, you'll
produce runs which are twice the size of the memory for random input,
and much better for input fuzzily ordered.

Moreover, if you output the 0'th item on disk and get an input which
may not fit in the current tournament (because the value "wins" over
the last output value), it cannot fit in the heap, so the size of the
heap decreases.  The freed memory could be cleverly reused immediately
for progressively building a second heap, which grows at exactly the
same rate the first heap is melting.  When the first heap completely
vanishes, you switch heaps and start a new run.  Clever and quite
effective!

In a word, heaps are useful memory structures to know.  I use them in
a few applications, and I think it is good to keep a `heap' module
around. :-)

--------------------
[1] The disk balancing algorithms which are current, nowadays, are
more annoying than clever, and this is a consequence of the seeking
capabilities of the disks.  On devices which cannot seek, like big
tape drives, the story was quite different, and one had to be very
clever to ensure (far in advance) that each tape movement will be the
most effective possible (that is, will best participate at
"progressing" the merge).  Some tapes were even able to read
backwards, and this was also used to avoid the rewinding time.
Believe me, real good tape sorts were quite spectacular to watch!
From all times, sorting has always been a Great Art! :-)
�heappush�heappop�heapify�heapreplace�merge�nlargest�	nsmallest�heappushpopcCs"|j|�t|dt|�d�dS)N��)�append�	_siftdown�len)�heap�item�r�/usr/lib64/python3.6/heapq.pyr�s
cCs.|j�}|r*|d}||d<t|d�|S|S)Nr	)�pop�_siftup)r�lastelt�
returnitemrrrr�s
cCs|d}||d<t|d�|S)Nr	)r)rrrrrrr�s
cCs0|r,|d|kr,|d|}|d<t|d�|S)Nr	)r)rrrrrr�s
cCs0t|�}x"tt|d��D]}t||�qWdS)N�)r
�reversed�ranger)�x�n�irrrr�scCs.|j�}|r*|d}||d<t|d�|S|S)Nr	)r�_siftup_max)rrrrrr�_heappop_max�s
rcCs|d}||d<t|d�|S)Nr	)r)rrrrrr�_heapreplace_max�s
rcCs0t|�}x"tt|d��D]}t||�qWdS)Nr)r
rrr)rrrrrr�_heapify_max�srcCsN||}x8||kr@|dd?}||}||kr<|||<|}q
Pq
W|||<dS)Nr
r)r�startpos�pos�newitem�	parentpos�parentrrrr�s
rcCs�t|�}|}||}d|d}xN||krn|d}||krP||||krP|}||||<|}d|d}q"W|||<t|||�dS)Nrr
)r
r)rr!�endposr r"�childpos�rightposrrrrs
rcCsN||}x8||kr@|dd?}||}||kr<|||<|}q
Pq
W|||<dS)Nr
r)rr r!r"r#r$rrr�
_siftdown_maxs
r(cCs�t|�}|}||}d|d}xN||krn|d}||krP||||krP|}||||<|}d|d}q"W|||<t|||�dS)Nrr
)r
r()rr!r%r r"r&r'rrrr%s
rNF)�key�reversecgs4g}|j}|r t}t}t}d}nt}t}t}d}|dk�r"xNttt	|��D]<\}	}
y|
j
}||�|	||g�WqJtk
r�YqJXqJW||�xdt|�dkr�y6x0|d\}}	}}
|V|�|
d<|||
�q�WWq�tk
r�||�Yq�Xq�W|�r|d\}}	}|V|j
EdHdSx\ttt	|��D]J\}	}
y(|
j
}|�}|||�|	|||g�Wntk
�rxYnX�q2W||�x~t|�dk�ryJxD|d\}}	}}}
|V|�}||�|
d<||
d<|||
��q�WWntk
�r||�YnX�q�W|�r0|d\}}	}}|V|j
EdHdS)Nr
r	r���)rrrrrrr�	enumerate�map�iter�__next__�
StopIterationr
�__self__)r)r*�	iterables�h�h_append�_heapify�_heappop�_heapreplace�	direction�order�it�next�value�s�	key_valuerrrr:sp


cs�|dkrLt|�}t�}�dkr,t||d�}nt||�d�}||krFgS|gSyt|�}Wnttfk
rpYnX||kr�t|�d�d|�S�dk�r*t|�}dd�tt|�|�D�}|s�|St	|�|dd}|}t
}	x6|D].}
|
|kr�|	||
|f�|dd}|d7}q�W|j�dd�|D�St|�}�fd	d�tt|�|�D�}|�sX|St	|�|dd}|}t
}	xD|D]<}
�|
�}||k�rz|	||||
f�|dd}|d7}�qzW|j�d
d�|D�S)Nr
)�default)r?r))r)cSsg|]\}}||f�qSrr)�.0r�elemrrr�
<listcomp>�sznsmallest.<locals>.<listcomp>r	cSsg|]}|d�qS)r	r)r@�rrrrrB�scsg|]\}}�|�||f�qSrr)r@rrA)r)rrrB�scSsg|]}|d�qS)rr)r@rCrrrrB
s)r.�object�minr
�	TypeError�AttributeError�sorted�ziprrr�sort)r�iterabler)r:�sentinel�result�size�topr9r7rA�kr)r)rr�sZ



cs�|dkrLt|�}t�}�dkr,t||d�}nt||�d�}||krFgS|gSyt|�}Wnttfk
rpYn X||kr�t|�dd�d|�S�dk�r8t|�}dd�ttd|d
�|�D�}|s�|St	|�|dd}|}t
}	x6|D].}
||
kr�|	||
|f�|dd}|d8}q�W|jdd	�d
d�|D�St|�}�fdd�ttd|d�|�D�}|�sl|St	|�|dd}|}t
}	xD|D]<}
�|
�}||k�r�|	||||
f�|dd}|d8}�q�W|jdd	�dd�|D�S)Nr
)r?)r?r)T)r)r*cSsg|]\}}||f�qSrr)r@rrArrrrB(sznlargest.<locals>.<listcomp>r	)r*cSsg|]}|d�qS)r	r)r@rCrrrrB5scsg|]\}}�|�||f�qSrr)r@rrA)r)rrrB9scSsg|]}|d�qS)rr)r@rCrrrrBGsr+r+)r.rD�maxr
rFrGrHrIrrrrJ)rrKr)r:rLrMrNrOr9r7rArPr)r)rrsZ

"

r	)�*)r)r)r�__main__)N)N)�	__about__�__all__rrrrrrrrrrr(rrrr�_heapq�ImportError�__name__Zdoctest�printZtestmodrrrr�<module>}sJ



	5
?
>
pickletools.cpython-36.opt-2.pyc000064400000156156150335715140012504 0ustar003


 \f�I@s�
ddlZddlZddlZddlZddlZdddgZejZ�d�Z�d�Z�d�Z	�d�Z
�d�ZGd
d�de�Z
ddlmZd
d�Ze
ddedd�Zdd�Ze
ddedd�Zdd�Ze
ddedd�Zdd�Ze
ddedd�Zdd�Ze
d d!ed"d�Z�d�d$d%�Ze
d&eed'd�Zd(d)�Ze
d*eed+d�Zd,d-�Ze
d.eed/d�Z d0d1�Z!e
d2ee!d3d�Z"d4d5�Z#e
d6e	e#d7d�Z$d8d9�Z%e
d:ee%d;d�Z&d<d9�Z%e
d:ee%d=d�Z&d>d?�Z'e
d@e
e'dAd�Z(dBdC�Z)e
dDee)dEd�Z*dFdG�Z+e
dHee+dId�Z,dJdK�Z-e
dLee-dMd�Z.dNdO�Z/e
dPe
e/dQd�Z0dRdS�Z1e
dTee1dUd�Z2dVdW�Z3dXdY�Z4e
dZee3d[d�Z5e
d\ee4d]d�Z6d^d_�Z7e
d`ee7dad�Z8dbdc�Z9e
ddd!e9ded�Z:ddflm;Z;dgdh�Z<e
diee<djd�Z=dkdl�Z>e
dme	e>dnd�Z?Gdodp�dpe�Z@e@dqeAdrds�ZBZCe@dteAeDfduds�ZEe@dveDdwds�ZFe@dxeGdyds�ZHe@dzeIeJfd{ds�ZKZLe@d|eId}ds�ZMe@d~eJdds�ZNe@d�eOd�d�ds�ZPe@d�eQd�ds�ZRe@d�eSd�ds�ZTe@d�eUd�ds�ZVe@d�eWd�ds�ZXe@d�eWd�ds�ZYe@d�ed�ds�ZZe@d�e@d�ds�Z[e@d�e@d�ds�Z\Gd�d��d�e�Z]e]Z^e^d�d�e5geEgdd�d��e^d�d�egeBgdd�d��e^d�d�egeBgdd�d��e^d�d�egeBgdd�d��e^d�d�e6geBgdd�d��e^d�d�e=geBgdd�d��e^d�d�e?geBgdd�d��e^d�d�egeKgdd�d��e^d�d�e$geKgdd�d��e^d�d�e"geKgdd�d��e^d�d�e(geMgdd�d��e^d�d�e&geMgdd�d��e^d�d�e*geMgdd�d��e^d�d�dgePgdd�d��e^d�d�dgeFgdd�d��e^d�d�dgeFgdd�d��e^d�d�e,geNgdd�d��e^d�d�e.geNgdd�d��e^d�d�e0geNgdd�d��e^d�d�e2geNgdd�d��e^d�d�e8geHgdd�d��e^d�d�e:geHgdd�d��e^d�d�dgeTgdd�d��e^d�d�deTeZgeTgdd�d��e^d�d�deTe[e\geTgdd�d��e^d�d�de[e\geTgdd�d��e^d�d�dgeRgdd�d��e^d�d�de[e\geRgdd�d��e^d�d�deZgeRgdd�d��e^d�d�deZeZgeRgdd�d��e^d�d�deZeZeZgeRgdd�d��e^d�d�dgeVgdd�d��e^d�d�de[e\geVgdd�d��e^d�d�deVeZeZgeVgdd�d��e^d�d�deVe[e\geVgdd�d��e^d�d�dgeXgd�dd��e^�d�ddeXe[e\geXgd�dd��e^�d�dde[e\geYgd�dd��e^�d�ddeZggd�d	d��e^�d
�ddeZgeZeZgd�dd��e^�d
�ddge[gd�dd��e^�d�dde[e\ggd�dd��e^�d�de5geZgd�dd��e^�d�degeZgd�dd��e^�d�degeZgd�dd��e^�d�de5ggd�dd��e^�d�d eggd�d!d��e^�d"�d#eggd�d$d��e^�d%�d&deZgeZgd�d'd��e^�d(�d)egeZgd�d*d��e^�d+�d,egeZgd�d-d��e^�d.�d/egeZgd�d0d��e^�d1�d2e geZgd�d3d��e^�d4�d5deNeNgeZgd�d6d��e^�d7�d8deZeZgeZgd�d9d��e^�d:�d;deZeZgeZgd�d<d��e^�d=�d>e e[e\geZgd�d?d��e^�d@�dAde[eZe\geZgd�dBd��e^�dC�dDdeZeZgeZgd�dEd��e^�dF�dGdeZeZeZgeZgd�dHd��e^�dI�dJeggd�dKd��e^�dL�dMdeZggd�dNd��e^�dO�dPeggd�dQd��e^�dR�dSegeZgd�dTd��e^�dU�dVdeZgeZgd�dWd��gAZ_[^iZ`iZaxzebe_�D]n\ZcZdedjee`k�
r�ef�dXedjee`edjeecf��edjgeak�
r�ef�dYedjgeaedjgecf��ece`edje<eceaedjg<�
q�W[`[a[c[diZhxe_D]Zdedehedjg<�qW[d�d��d[�d\�Ziei�[i�d��d]�d^�Zj�d_d�Zk�d`d�Zl�d��dad�ZmG�db�dc��dc�Zn�ddZo�deZpeoep�df�Zq�dg�dh�Zres�dik�
r~ddltZtetju�dj�dk�Zvevjw�dletjx�dm��dn�do�dp�evjw�dq�drejyetjx�ds��dt�du�evjw�dv�dw�dx�dy�dz�evjw�d{�d|deA�d}�du�evjw�d~�d�dx�d��dz�evjw�d��d��d��d��d��evjw�d��d��dx�d��dz�evjw�d��dx�d��dz�evjz�Z{e{j|�r�er�n�e{j}�r�d�ndZ}e{j~�s�evj�n�e�e{j~�dk�
r$eme{j~de{j�de{j�e}�nZe{j��
r0indZ�xHe{j~D]>Z�e{j�j�e�je�d��Z�e{j�j�e��d��eme�e{j�e�e{j�e}��
q<WdS(��N�dis�genops�optimize�����c@seZdZdZdd�ZdS)	�ArgumentDescriptor�name�n�reader�doccCs||_||_||_||_dS)N)rrr
r)�selfrrr
r�r�#/usr/lib64/python3.6/pickletools.py�__init__�szArgumentDescriptor.__init__N)rrr
r)�__name__�
__module__�__qualname__�	__slots__rrrrrr
�s
r
)�unpackcCs"|jd�}|r|dStd��dS)Nrrz'not enough data in stream to read uint1)�read�
ValueError)�f�datarrr�
read_uint1�s
r�uint1zOne-byte unsigned integer.)rrr
rcCs0|jd�}t|�dkr$td|�dStd��dS)Nrz<Hrz'not enough data in stream to read uint2)r�len�_unpackr)rrrrr�
read_uint2�s	
r �uint2z)Two-byte unsigned integer, little-endian.cCs0|jd�}t|�dkr$td|�dStd��dS)Nrz<irz&not enough data in stream to read int4)rrrr)rrrrr�	read_int4�s	
r"�int4z8Four-byte signed integer, little-endian, 2's complement.cCs0|jd�}t|�dkr$td|�dStd��dS)Nrz<Irz'not enough data in stream to read uint4)rrrr)rrrrr�
read_uint4s	
r$�uint4z*Four-byte unsigned integer, little-endian.cCs0|jd�}t|�dkr$td|�dStd��dS)N�z<Qrz'not enough data in stream to read uint8)rrrr)rrrrr�
read_uint8&s	
r'�uint8r&z+Eight-byte unsigned integer, little-endian.TcCs�|j�}|jd�std��|dd
�}|rvxJdD]6}|j|�r0|j|�sXtd||f��|dd�}Pq0Wtd|��|r�tj|�djd	�}|S)
N�
z-no newline found when trying to read stringnlr�"�'z,strinq quote %r not found at both ends of %rzno string quotes around %rr�ascii���)r*r+r-)�readline�endswithr�
startswith�codecs�
escape_decode�decode)rr3�stripquotesr�qrrr�
read_stringnl;s 



r6�stringnlz�A newline-terminated string.

                   This is a repr-style string, with embedded escapes, and
                   bracketing quotes.
                   cCst|dd�S)NF)r4)r6)rrrr�read_stringnl_noescapetsr8�stringnl_noescapeaA newline-terminated string.

                        This is a str-style string, without embedded escapes,
                        or bracketing quotes.  It should consist solely of
                        printable ASCII characters.
                        cCsdt|�t|�fS)Nz%s %s)r8)rrrr�read_stringnl_noescape_pair�sr:�stringnl_noescape_paira�A pair of newline-terminated strings.

                             These are str-style strings, without embedded
                             escapes, or bracketing quotes.  They should
                             consist solely of printable ASCII characters.
                             The pair is returned as a single string, with
                             a single blank separating the two strings.
                             cCs@t|�}|j|�}t|�|kr(|jd�Std|t|�f��dS)Nzlatin-1z2expected %d bytes in a string1, but only %d remain)rrrr3r)rrrrrr�read_string1�s	

r<�string1z�A counted string.

              The first argument is a 1-byte unsigned int giving the number
              of bytes in the string, and the second argument is that many
              bytes.
              cCsTt|�}|dkrtd|��|j|�}t|�|kr<|jd�Std|t|�f��dS)Nrzstring4 byte count < 0: %dzlatin-1z2expected %d bytes in a string4, but only %d remain)r"rrrr3)rrrrrr�read_string4�s


r>�string4z�A counted string.

              The first argument is a 4-byte little-endian signed int giving
              the number of bytes in the string, and the second argument is
              that many bytes.
              cCs:t|�}|j|�}t|�|kr"|Std|t|�f��dS)Nz1expected %d bytes in a bytes1, but only %d remain)rrrr)rrrrrr�read_bytes1�s	
r@�bytes1z�A counted bytes string.

              The first argument is a 1-byte unsigned int giving the number
              of bytes in the string, and the second argument is that many
              bytes.
              cCs:t|�}|j|�}t|�|kr"|Std|t|�f��dS)Nz1expected %d bytes in a bytes1, but only %d remain)rrrr)rrrrrrr@�s	
z�A counted bytes string.

              The first argument is a 1-byte unsigned int giving the number
              of bytes, and the second argument is that many bytes.
              cCsPt|�}|tjkrtd|��|j|�}t|�|kr8|Std|t|�f��dS)Nz#bytes4 byte count > sys.maxsize: %dz1expected %d bytes in a bytes4, but only %d remain)r$�sys�maxsizerrr)rrrrrr�read_bytes4s


rD�bytes4z�A counted bytes string.

              The first argument is a 4-byte little-endian unsigned int giving
              the number of bytes, and the second argument is that many bytes.
              cCsPt|�}|tjkrtd|��|j|�}t|�|kr8|Std|t|�f��dS)Nz#bytes8 byte count > sys.maxsize: %dz1expected %d bytes in a bytes8, but only %d remain)r'rBrCrrr)rrrrrr�read_bytes83s

rF�bytes8z�A counted bytes string.

              The first argument is an 8-byte little-endian unsigned int giving
              the number of bytes, and the second argument is that many bytes.
              cCs0|j�}|jd�std��|dd�}t|d�S)Nr)z4no newline found when trying to read unicodestringnlrzraw-unicode-escaper-)r.r/r�str)rrrrr�read_unicodestringnlUs

rI�unicodestringnlz�A newline-terminated Unicode string.

                      This is raw-unicode-escape encoded, so consists of
                      printable ASCII characters, and may contain embedded
                      escape sequences.
                      cCsBt|�}|j|�}t|�|kr*t|dd�Std|t|�f��dS)Nzutf-8�
surrogatepassz9expected %d bytes in a unicodestring1, but only %d remain)rrrrHr)rrrrrr�read_unicodestring1os
rL�unicodestring1aAA counted Unicode string.

                    The first argument is a 1-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    cCsXt|�}|tjkrtd|��|j|�}t|�|kr@t|dd�Std|t|�f��dS)Nz+unicodestring4 byte count > sys.maxsize: %dzutf-8rKz9expected %d bytes in a unicodestring4, but only %d remain)r$rBrCrrrrH)rrrrrr�read_unicodestring4�s

rN�unicodestring4aAA counted Unicode string.

                    The first argument is a 4-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    cCsXt|�}|tjkrtd|��|j|�}t|�|kr@t|dd�Std|t|�f��dS)Nz+unicodestring8 byte count > sys.maxsize: %dzutf-8rKz9expected %d bytes in a unicodestring8, but only %d remain)r'rBrCrrrrH)rrrrrr�read_unicodestring8�s

rP�unicodestring8aBA counted Unicode string.

                    The first argument is an 8-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    cCs.t|ddd�}|dkrdS|dkr&dSt|�S)NF)r3r4s00s01T)r6�int)r�srrr�read_decimalnl_short�srTcCs2t|ddd�}|dd�dkr*|dd�}t|�S)NF)r3r4r�Lr-r-)r6rR)rrSrrr�read_decimalnl_long�srV�decimalnl_shorta�A newline-terminated decimal integer literal.

                          This never has a trailing 'L', and the integer fit
                          in a short Python int on the box where the pickle
                          was written -- but there's no guarantee it will fit
                          in a short Python int on the box where the pickle
                          is read.
                          �decimalnl_longz�A newline-terminated decimal integer literal.

                         This has a trailing 'L', and can represent integers
                         of any size.
                         cCst|ddd�}t|�S)NF)r3r4)r6�float)rrSrrr�read_floatnl'srZ�floatnla�A newline-terminated decimal floating literal.

              In general this requires 17 significant digits for roundtrip
              identity, and pickling then unpickling infinities, NaNs, and
              minus zero doesn't work across boxes, or on some boxes even
              on itself (e.g., Windows can't read the strings it produces
              for infinities or NaNs).
              cCs0|jd�}t|�dkr$td|�dStd��dS)Nr&z>drz(not enough data in stream to read float8)rrrr)rrrrr�read_float8=s

r\�float8aAn 8-byte binary representation of a float, big-endian.

             The format is unique to Python, and shared with the struct
             module (format string '>d') "in theory" (the struct and pickle
             implementations don't share the code -- they should).  It's
             strongly related to the IEEE-754 double format, and, in normal
             cases, is in fact identical to the big-endian 754 double format.
             On other boxes the dynamic range is limited to that of a 754
             double, and "add a half and chop" rounding is used to reduce
             the precision to 53 bits.  However, even on a 754 box,
             infinities, NaNs, and minus zero may not be handled correctly
             (may not survive roundtrip pickling intact).
             )�decode_longcCs.t|�}|j|�}t|�|kr&td��t|�S)Nz'not enough data in stream to read long1)rrrrr^)rrrrrr�
read_long1cs

r_�long1aA binary long, little-endian, using 1-byte size.

    This first reads one byte as an unsigned size, then reads that
    many bytes and interprets them as a little-endian 2's-complement long.
    If the size is 0, that's taken as a shortcut for the long 0L.
    cCsBt|�}|dkrtd|��|j|�}t|�|kr:td��t|�S)Nrzlong4 byte count < 0: %dz'not enough data in stream to read long4)r"rrrr^)rrrrrr�
read_long4�s
ra�long4a�A binary representation of a long, little-endian.

    This first reads four bytes as a signed size (but requires the
    size to be >= 0), then reads that many bytes and interprets them
    as a little-endian 2's-complement long.  If the size is 0, that's taken
    as a shortcut for the int 0, although LONG1 should really be used
    then instead (and in any case where # of bytes < 256).
    c@s eZdZd	Zdd�Zdd�ZdS)
�StackObjectr�obtypercCs.||_t|t�rx|D]}qW||_||_dS)N)r�
isinstance�tuplerdr)rrrdrZ	containedrrrr�s

zStackObject.__init__cCs|jS)N)r)rrrr�__repr__�szStackObject.__repr__N)rrdr)rrrrrrgrrrrrc�s

rcrRzA Python integer object.)rrdrZint_or_boolz#A Python integer or boolean object.�boolzA Python boolean object.rYzA Python float object.Zbytes_or_strz*A Python bytes or (Unicode) string object.�byteszA Python bytes object.rHz!A Python (Unicode) string object.�NonezThe Python None object.rfzA Python tuple object.�listzA Python list object.�dictzA Python dict object.�setzA Python set object.�	frozensetzA Python frozenset object.�anyzAny kind of object whatsoever.Zmarkaz'The mark' is a unique object.

Opcodes that operate on a variable number of objects
generally don't embed the count of objects in the opcode,
or pull it off the stack.  Instead the MARK opcode is used
to push a special marker object on the stack, and then
some other opcodes grab all the objects from the top of
the stack down to (but not including) the topmost marker
object.
�
stackslicea�An object representing a contiguous slice of the stack.

This is used in conjunction with markobject, to represent all
of the stack following the topmost markobject.  For example,
the POP_MARK opcode changes the stack from

    [..., markobject, stackslice]
to
    [...]

No matter how many object are on the stack after the topmost
markobject, POP_MARK gets rid of all of them (including the
topmost markobject too).
c@seZdZdZdd	�Zd
S)�
OpcodeInfor�code�arg�stack_before�stack_after�protorc	CsJ||_||_||_x|D]}qW||_x|D]}q,W||_||_||_dS)N)rrrrsrtrurvr)	rrrrrsrtrurvr�xrrrrTs

zOpcodeInfo.__init__N)rrrrsrtrurvr)rrrrrrrrrrq5srqZINT�Ia�Push an integer or bool.

      The argument is a newline-terminated decimal literal string.

      The intent may have been that this always fit in a short Python int,
      but INT can be generated in pickles written on a 64-bit box that
      require a Python long on a 32-bit box.  The difference between this
      and LONG then is that INT skips a trailing 'L', and produces a short
      int whenever possible.

      Another difference is due to that, when bool was introduced as a
      distinct type in 2.3, builtin names True and False were also added to
      2.2.2, mapping to ints 1 and 0.  For compatibility in both directions,
      True gets pickled as INT + "I01\n", and False as INT + "I00\n".
      Leading zeroes are never produced for a genuine integer.  The 2.3
      (and later) unpicklers special-case these and return bool instead;
      earlier unpicklers ignore the leading "0" and return the int.
      )rrrrsrtrurvrZBININT�Ja1Push a four-byte signed integer.

      This handles the full range of Python (short) integers on a 32-bit
      box, directly as binary bytes (1 for the opcode and 4 for the integer).
      If the integer is non-negative and fits in 1 or 2 bytes, pickling via
      BININT1 or BININT2 saves space.
      ZBININT1�Kz�Push a one-byte unsigned integer.

      This is a space optimization for pickling very small non-negative ints,
      in range(256).
      ZBININT2�Mz�Push a two-byte unsigned integer.

      This is a space optimization for pickling small positive ints, in
      range(256, 2**16).  Integers in range(256) can also be pickled via
      BININT2, but BININT1 instead saves a byte.
      ZLONG�La�Push a long integer.

      The same as INT, except that the literal ends with 'L', and always
      unpickles to a Python long.  There doesn't seem a real purpose to the
      trailing 'L'.

      Note that LONG takes time quadratic in the number of digits when
      unpickling (this is simply due to the nature of decimal->binary
      conversion).  Proto 2 added linear-time (in C; still quadratic-time
      in Python) LONG1 and LONG4 opcodes.
      ZLONG1�Šz|Long integer using one-byte length.

      A more efficient encoding of a Python long; the long1 encoding
      says it all.ZLONG4�‹z~Long integer using found-byte length.

      A more efficient encoding of a Python long; the long4 encoding
      says it all.�STRING�Sa�Push a Python string object.

      The argument is a repr-style string, with bracketing quote characters,
      and perhaps embedded escapes.  The argument extends until the next
      newline character.  These are usually decoded into a str instance
      using the encoding given to the Unpickler constructor. or the default,
      'ASCII'.  If the encoding given was 'bytes' however, they will be
      decoded as bytes object instead.
      Z	BINSTRING�Ta�Push a Python string object.

      There are two arguments: the first is a 4-byte little-endian
      signed int giving the number of bytes in the string, and the
      second is that many bytes, which are taken literally as the string
      content.  These are usually decoded into a str instance using the
      encoding given to the Unpickler constructor. or the default,
      'ASCII'.  If the encoding given was 'bytes' however, they will be
      decoded as bytes object instead.
      ZSHORT_BINSTRING�Ua�Push a Python string object.

      There are two arguments: the first is a 1-byte unsigned int giving
      the number of bytes in the string, and the second is that many
      bytes, which are taken literally as the string content.  These are
      usually decoded into a str instance using the encoding given to
      the Unpickler constructor. or the default, 'ASCII'.  If the
      encoding given was 'bytes' however, they will be decoded as bytes
      object instead.
      ZBINBYTES�Bz�Push a Python bytes object.

      There are two arguments:  the first is a 4-byte little-endian unsigned int
      giving the number of bytes, and the second is that many bytes, which are
      taken literally as the bytes content.
      ZSHORT_BINBYTES�Cz�Push a Python bytes object.

      There are two arguments:  the first is a 1-byte unsigned int giving
      the number of bytes, and the second is that many bytes, which are taken
      literally as the string content.
      Z	BINBYTES8�Žz�Push a Python bytes object.

      There are two arguments:  the first is an 8-byte unsigned int giving
      the number of bytes in the string, and the second is that many bytes,
      which are taken literally as the string content.
      ZNONE�NzPush None on the stack.ZNEWTRUE�ˆzPush True onto the stack.ZNEWFALSE�‰zPush False onto the stack.�UNICODE�Vz�Push a Python Unicode string object.

      The argument is a raw-unicode-escape encoding of a Unicode string,
      and so may contain embedded escape sequences.  The argument extends
      until the next newline character.
      ZSHORT_BINUNICODE�ŒaPush a Python Unicode string object.

      There are two arguments:  the first is a 1-byte little-endian signed int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      Z
BINUNICODE�XaPush a Python Unicode string object.

      There are two arguments:  the first is a 4-byte little-endian unsigned int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      ZBINUNICODE8�aPush a Python Unicode string object.

      There are two arguments:  the first is an 8-byte little-endian signed int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      ZFLOAT�Fa�Newline-terminated decimal float literal.

      The argument is repr(a_float), and in general requires 17 significant
      digits for roundtrip conversion to be an identity (this is so for
      IEEE-754 double precision values, which is what Python float maps to
      on most boxes).

      In general, FLOAT cannot be used to transport infinities, NaNs, or
      minus zero across boxes (or even on a single box, if the platform C
      library can't read the strings it produces for such things -- Windows
      is like that), but may do less damage than BINFLOAT on boxes with
      greater precision or dynamic range than IEEE-754 double.
      ZBINFLOAT�Ga�Float stored in binary form, with 8 bytes of data.

      This generally requires less than half the space of FLOAT encoding.
      In general, BINFLOAT cannot be used to transport infinities, NaNs, or
      minus zero, raises an exception if the exponent exceeds the range of
      an IEEE-754 double, and retains no more than 53 bits of precision (if
      there are more than that, "add a half and chop" rounding is used to
      cut it back to 53 significant bits).
      Z
EMPTY_LIST�]zPush an empty list.ZAPPEND�az�Append an object to a list.

      Stack before:  ... pylist anyobject
      Stack after:   ... pylist+[anyobject]

      although pylist is really extended in-place.
      ZAPPENDS�ez�Extend a list by a slice of stack objects.

      Stack before:  ... pylist markobject stackslice
      Stack after:   ... pylist+stackslice

      although pylist is really extended in-place.
      ZLIST�lasBuild a list out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python list, which single list object replaces all of the
      stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... [1, 2, 3, 'abc']
      ZEMPTY_TUPLE�)zPush an empty tuple.ZTUPLE�tavBuild a tuple out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python tuple, which single tuple object replaces all of the
      stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... (1, 2, 3, 'abc')
      ZTUPLE1�…z�Build a one-tuple out of the topmost item on the stack.

      This code pops one value off the stack and pushes a tuple of
      length 1 whose one item is that value back onto it.  In other
      words:

          stack[-1] = tuple(stack[-1:])
      ZTUPLE2�†aBuild a two-tuple out of the top two items on the stack.

      This code pops two values off the stack and pushes a tuple of
      length 2 whose items are those values back onto it.  In other
      words:

          stack[-2:] = [tuple(stack[-2:])]
      ZTUPLE3�‡aBuild a three-tuple out of the top three items on the stack.

      This code pops three values off the stack and pushes a tuple of
      length 3 whose items are those values back onto it.  In other
      words:

          stack[-3:] = [tuple(stack[-3:])]
      Z
EMPTY_DICT�}zPush an empty dict.ZDICT�da�Build a dict out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python dict, which single dict object replaces all of the
      stack from the topmost markobject onward.  The stack slice alternates
      key, value, key, value, ....  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... {1: 2, 3: 'abc'}
      ZSETITEMrSz�Add a key+value pair to an existing dict.

      Stack before:  ... pydict key value
      Stack after:   ... pydict

      where pydict has been modified via pydict[key] = value.
      ZSETITEMS�ua\Add an arbitrary number of key+value pairs to an existing dict.

      The slice of the stack following the topmost markobject is taken as
      an alternating sequence of keys and values, added to the dict
      immediately under the topmost markobject.  Everything at and after the
      topmost markobject is popped, leaving the mutated dict at the top
      of the stack.

      Stack before:  ... pydict markobject key_1 value_1 ... key_n value_n
      Stack after:   ... pydict

      where pydict has been modified via pydict[key_i] = value_i for i in
      1, 2, ..., n, and in that order.
      Z	EMPTY_SET�zPush an empty set.ZADDITEMS�a$Add an arbitrary number of items to an existing set.

      The slice of the stack following the topmost markobject is taken as
      a sequence of items, added to the set immediately under the topmost
      markobject.  Everything at and after the topmost markobject is popped,
      leaving the mutated set at the top of the stack.

      Stack before:  ... pyset markobject item_1 ... item_n
      Stack after:   ... pyset

      where pyset has been modified via pyset.add(item_i) = item_i for i in
      1, 2, ..., n, and in that order.
      Z	FROZENSET�‘azBuild a frozenset out of the topmost slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python frozenset, which single frozenset object replaces all
      of the stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3
      Stack after:  ... frozenset({1, 2, 3})
      �POP�0z<Discard the top stack item, shrinking the stack by one item.ZDUP�2z=Push the top stack item onto the stack again, duplicating it.�MARK�(z�Push markobject onto the stack.

      markobject is a unique object, used by other opcodes to identify a
      region of the stack containing a variable number of objects for them
      to work on.  See markobject.doc for more detail.
      ZPOP_MARK�1aPop all the stack objects at and above the topmost markobject.

      When an opcode using a variable number of stack objects is done,
      POP_MARK is used to remove those objects, and to remove the markobject
      that delimited their starting position on the stack.
      �GET�gz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the newline-terminated
      decimal string following.  BINGET and LONG_BINGET are space-optimized
      versions.
      �BINGET�hz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the 1-byte unsigned
      integer following.
      �LONG_BINGET�jz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the 4-byte unsigned
      little-endian integer following.
      �PUT�pz�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the newline-
      terminated decimal string following.  BINPUT and LONG_BINPUT are
      space-optimized versions.
      �BINPUTr5z�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the 1-byte
      unsigned integer following.
      �LONG_BINPUT�rz�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the 4-byte
      unsigned little-endian integer following.
      �MEMOIZE�”z�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write is the number of
      elements currently present in the memo.
      ZEXT1�‚a�Extension code.

      This code and the similar EXT2 and EXT4 allow using a registry
      of popular objects that are pickled by name, typically classes.
      It is envisioned that through a global negotiation and
      registration process, third parties can set up a mapping between
      ints and object names.

      In order to guarantee pickle interchangeability, the extension
      code registry ought to be global, although a range of codes may
      be reserved for private use.

      EXT1 has a 1-byte integer argument.  This is used to index into the
      extension registry, and the object at that index is pushed on the stack.
      ZEXT2�ƒzNExtension code.

      See EXT1.  EXT2 has a two-byte integer argument.
      ZEXT4�„zOExtension code.

      See EXT1.  EXT4 has a four-byte integer argument.
      ZGLOBAL�ca�Push a global object (module.attr) on the stack.

      Two newline-terminated strings follow the GLOBAL opcode.  The first is
      taken as a module name, and the second as a class name.  The class
      object module.class is pushed on the stack.  More accurately, the
      object returned by self.find_class(module, class) is pushed on the
      stack, so unpickling subclasses can override this form of lookup.
      ZSTACK_GLOBAL�“z7Push a global object (module.attr) on the stack.
      ZREDUCE�RaLPush an object built from a callable and an argument tuple.

      The opcode is named to remind of the __reduce__() method.

      Stack before: ... callable pytuple
      Stack after:  ... callable(*pytuple)

      The callable and the argument tuple are the first two items returned
      by a __reduce__ method.  Applying the callable to the argtuple is
      supposed to reproduce the original object, or at least get it started.
      If the __reduce__ method returns a 3-tuple, the last component is an
      argument to be passed to the object's __setstate__, and then the REDUCE
      opcode is followed by code to create setstate's argument, and then a
      BUILD opcode to apply  __setstate__ to that argument.

      If not isinstance(callable, type), REDUCE complains unless the
      callable has been registered with the copyreg module's
      safe_constructors dict, or the callable has a magic
      '__safe_for_unpickling__' attribute with a true value.  I'm not sure
      why it does this, but I've sure seen this complaint often enough when
      I didn't want to <wink>.
      ZBUILD�ba�Finish building an object, via __setstate__ or dict update.

      Stack before: ... anyobject argument
      Stack after:  ... anyobject

      where anyobject may have been mutated, as follows:

      If the object has a __setstate__ method,

          anyobject.__setstate__(argument)

      is called.

      Else the argument must be a dict, the object must have a __dict__, and
      the object is updated via

          anyobject.__dict__.update(argument)
      ZINST�iaqBuild a class instance.

      This is the protocol 0 version of protocol 1's OBJ opcode.
      INST is followed by two newline-terminated strings, giving a
      module and class name, just as for the GLOBAL opcode (and see
      GLOBAL for more details about that).  self.find_class(module, name)
      is used to get a class object.

      In addition, all the objects on the stack following the topmost
      markobject are gathered into a tuple and popped (along with the
      topmost markobject), just as for the TUPLE opcode.

      Now it gets complicated.  If all of these are true:

        + The argtuple is empty (markobject was at the top of the stack
          at the start).

        + The class object does not have a __getinitargs__ attribute.

      then we want to create an old-style class instance without invoking
      its __init__() method (pickle has waffled on this over the years; not
      calling __init__() is current wisdom).  In this case, an instance of
      an old-style dummy class is created, and then we try to rebind its
      __class__ attribute to the desired class object.  If this succeeds,
      the new instance object is pushed on the stack, and we're done.

      Else (the argtuple is not empty, it's not an old-style class object,
      or the class object does have a __getinitargs__ attribute), the code
      first insists that the class object have a __safe_for_unpickling__
      attribute.  Unlike as for the __safe_for_unpickling__ check in REDUCE,
      it doesn't matter whether this attribute has a true or false value, it
      only matters whether it exists (XXX this is a bug).  If
      __safe_for_unpickling__ doesn't exist, UnpicklingError is raised.

      Else (the class object does have a __safe_for_unpickling__ attr),
      the class object obtained from INST's arguments is applied to the
      argtuple obtained from the stack, and the resulting instance object
      is pushed on the stack.

      NOTE:  checks for __safe_for_unpickling__ went away in Python 2.3.
      NOTE:  the distinction between old-style and new-style classes does
             not make sense in Python 3.
      ZOBJ�oa�Build a class instance.

      This is the protocol 1 version of protocol 0's INST opcode, and is
      very much like it.  The major difference is that the class object
      is taken off the stack, allowing it to be retrieved from the memo
      repeatedly if several instances of the same class are created.  This
      can be much more efficient (in both time and space) than repeatedly
      embedding the module and class names in INST opcodes.

      Unlike INST, OBJ takes no arguments from the opcode stream.  Instead
      the class object is taken off the stack, immediately above the
      topmost markobject:

      Stack before: ... markobject classobject stackslice
      Stack after:  ... new_instance_object

      As for INST, the remainder of the stack above the markobject is
      gathered into an argument tuple, and then the logic seems identical,
      except that no __safe_for_unpickling__ check is done (XXX this is
      a bug).  See INST for the gory details.

      NOTE:  In Python 2.3, INST and OBJ are identical except for how they
      get the class object.  That was always the intent; the implementations
      had diverged for accidental reasons.
      ZNEWOBJ�aLBuild an object instance.

      The stack before should be thought of as containing a class
      object followed by an argument tuple (the tuple being the stack
      top).  Call these cls and args.  They are popped off the stack,
      and the value returned by cls.__new__(cls, *args) is pushed back
      onto the stack.
      Z	NEWOBJ_EX�’auBuild an object instance.

      The stack before should be thought of as containing a class
      object followed by an argument tuple and by a keyword argument dict
      (the dict being the stack top).  Call these cls and args.  They are
      popped off the stack, and the value returned by
      cls.__new__(cls, *args, *kwargs) is  pushed back  onto the stack.
      �PROTO�€z�Protocol version indicator.

      For protocol 2 and above, a pickle must start with this opcode.
      The argument is the protocol version, an int in range(2, 256).
      ZSTOP�.z�Stop the unpickling machine.

      Every pickle ends with this opcode.  The object at the top of the stack
      is popped, and that's the result of unpickling.  The stack should be
      empty then.
      �FRAME�•z�Indicate the beginning of a new frame.

      The unpickler may use this opcode to safely prefetch data from its
      underlying stream.
      ZPERSID�PaPush an object identified by a persistent ID.

      The pickle module doesn't define what a persistent ID means.  PERSID's
      argument is a newline-terminated str-style (no embedded escapes, no
      bracketing quote characters) string, which *is* "the persistent ID".
      The unpickler passes this string to self.persistent_load().  Whatever
      object that returns is pushed on the stack.  There is no implementation
      of persistent_load() in Python's unpickler:  it must be supplied by an
      unpickler subclass.
      Z	BINPERSID�QaXPush an object identified by a persistent ID.

      Like PERSID, except the persistent ID is popped off the stack (instead
      of being a string embedded in the opcode bytestream).  The persistent
      ID is passed to self.persistent_load(), and whatever object that
      returns is pushed on the stack.  See PERSID for more detail.
      z%repeated name %r at indices %d and %dz%repeated code %r at indices %d and %dFcCstj�}x�tjD]�}tjd|�s2|rtd|�qtt|�}t|t	�sTt
|�dkrj|rtd||f�q|jd�}||kr�|r�td||f�||}|j|kr�t
d|||jf��||=qt
d||f��qW|�rd	g}x(|j�D]\}}|jd
|j|f�q�Wt
dj|���dS)Nz[A-Z][A-Z0-9_]+$z0skipping %r: it doesn't look like an opcode namerz5skipping %r: value %r doesn't look like a pickle codezlatin-1z+checking name %r w/ code %r for consistencyzBfor pickle code %r, pickle.py uses name %r but we're using name %rzPpickle.py appears to have a pickle opcode with name %r and code %r, but we don'tz=we appear to have pickle opcodes that pickle.py doesn't have:z    name %r with code %r�
)�code2op�copy�pickle�__all__�re�match�print�getattrrerirr3rr�items�append�join)�verboser�rZ
picklecoder��msgrrrrr�assure_pickle_consistencys>


r�ccs�t|t�rtj|�}t|d�r&|j}ndd�}x�|�}|jd�}tj|j	d��}|dkr�|dkrjt
d��nt
d|dkrzd	n||f��|jdkr�d}n|jj|�}|r�||||�fVn|||fV|d
kr0Pq0WdS)N�tellcSsdS)Nrrrrr�<lambda>�sz_genops.<locals>.<lambda>rzlatin-1�z#pickle exhausted before seeing STOPz!at position %s, opcode %r unknownz	<unknown>�.)
re�bytes_types�io�BytesIO�hasattrr�rr��getr3rrsr
)r�
yield_end_posZgetpos�posrr�opcodersrrr�_genops�s.






r�cCst|�S)N)r�)r�rrrr�scCs�d}d}t�}i}g}d}d}x�t|dd�D]�\}}	}
}d|jkr\|j|	�|j||	f�q,|jdkr�t|�}|j|�|j||f�q,d|jkr�q,d|jkr�|j|kr�|j}d||	<|j||	f�q,|jd	k�r|	|kr�|	}|
dkr�||
|�}n|j|
|f�q,|j|
|f�q,W~tj�}
|
j	|�t
j|
|�}|d
k�rJ|jj
�d}x�|D]x\}}	||k�r�|	|k�rt�qT|j|�}|||	<|d7}n&||k�r�|j||	�}n|||	�}|jj�|j	|��qTW|jj�|
j�S)Nr�r�rr�T)r�r�r�r�rr)rmr�r�addr�rrvr�r��writer�Z_PicklerZframerZ
start_framing�putr�Zcommit_frameZend_framing�getvalue)r�r�r�ZoldidsZnewids�opcodesrvZprotoheaderr�rsr�Zend_pos�idx�outZpickler�oprrrrr�sd
















cCsg}|dkri}d}g}d|}d}	|}
�x�t|�D�]�\}}}
|
dk	rZtd|
d|d�dt|j�dd�|t|�|jf}t||j�}|j}|j	}t|�}d}t
|ks�|jdko�|o�|d t
k�rD|�r<|j�}|dkr�d}nd|}x|d!t
k	�r|j�q�W|j�y|jt
�}Wnt
k
�r8d	}YnXnd
}	}|jd"k�r�|jdk�rnt|�}d|}n|}||k�r�d|}	n,|�s�d}	n |d#t
k�r�d}	n|d$||<n*|jd%k�r�||k�r�||g}nd|}	|dk	�s�|�r0|ddt|j�7}|dk	�r|dt|�7}|�r0|d|7}|�rz|d|
t|�7}t|�}
|
dk�r`|}
|d|jjdd�d	7}t||d�|	�r�t
|	��t|�|k�r�t
d|t|�f��|�r�||d�=t
|k�r�|j|
�|j|�q4Wtd||d�|�r
t
d|��dS)&Nr� z%5d:)�end�filez	%-4s %s%sr�z(MARK at unknown opcode offset)z(MARK at %d)rzno MARK exists on stackr�r�r�r�z(as %d)zmemo key %r already definedz'stack is empty -- can't store into memoz"can't store markobject in the memor�r�r�z&memo key %r has never been stored into�
�2r�)r�z3tries to pop %d items from stack with only %d itemsz highest protocol among opcodes =zstack not empty after STOP: %rr-r-r-r-)r�r�r�r�r-r-)r�r�r�)rr��reprrrrr�maxrvrtru�
markobject�pop�indexrr�splitr��extend)r�r��memo�indentlevel�annotate�stackZmaxprotoZ	markstackZindentchunkZerrormsgZannocolr�rsr��lineZbefore�afterZnumtopopZmarkmsgZmarkposZmemo_idxrrrr%	s�-









c@seZdZdd�ZdS)�_ExamplecCs
||_dS)N)�value)rr�rrrr�	sz_Example.__init__N)rrrrrrrrr��	sr�a�
>>> import pickle
>>> x = [1, 2, (3, 4), {b'abc': "def"}]
>>> pkl0 = pickle.dumps(x, 0)
>>> dis(pkl0)
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: L    LONG       1
    9: a    APPEND
   10: L    LONG       2
   14: a    APPEND
   15: (    MARK
   16: L        LONG       3
   20: L        LONG       4
   24: t        TUPLE      (MARK at 15)
   25: p    PUT        1
   28: a    APPEND
   29: (    MARK
   30: d        DICT       (MARK at 29)
   31: p    PUT        2
   34: c    GLOBAL     '_codecs encode'
   50: p    PUT        3
   53: (    MARK
   54: V        UNICODE    'abc'
   59: p        PUT        4
   62: V        UNICODE    'latin1'
   70: p        PUT        5
   73: t        TUPLE      (MARK at 53)
   74: p    PUT        6
   77: R    REDUCE
   78: p    PUT        7
   81: V    UNICODE    'def'
   86: p    PUT        8
   89: s    SETITEM
   90: a    APPEND
   91: .    STOP
highest protocol among opcodes = 0

Try again with a "binary" pickle.

>>> pkl1 = pickle.dumps(x, 1)
>>> dis(pkl1)
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: K        BININT1    1
    6: K        BININT1    2
    8: (        MARK
    9: K            BININT1    3
   11: K            BININT1    4
   13: t            TUPLE      (MARK at 8)
   14: q        BINPUT     1
   16: }        EMPTY_DICT
   17: q        BINPUT     2
   19: c        GLOBAL     '_codecs encode'
   35: q        BINPUT     3
   37: (        MARK
   38: X            BINUNICODE 'abc'
   46: q            BINPUT     4
   48: X            BINUNICODE 'latin1'
   59: q            BINPUT     5
   61: t            TUPLE      (MARK at 37)
   62: q        BINPUT     6
   64: R        REDUCE
   65: q        BINPUT     7
   67: X        BINUNICODE 'def'
   75: q        BINPUT     8
   77: s        SETITEM
   78: e        APPENDS    (MARK at 3)
   79: .    STOP
highest protocol among opcodes = 1

Exercise the INST/OBJ/BUILD family.

>>> import pickletools
>>> dis(pickle.dumps(pickletools.dis, 0))
    0: c    GLOBAL     'pickletools dis'
   17: p    PUT        0
   20: .    STOP
highest protocol among opcodes = 0

>>> from pickletools import _Example
>>> x = [_Example(42)] * 2
>>> dis(pickle.dumps(x, 0))
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: c    GLOBAL     'copy_reg _reconstructor'
   30: p    PUT        1
   33: (    MARK
   34: c        GLOBAL     'pickletools _Example'
   56: p        PUT        2
   59: c        GLOBAL     '__builtin__ object'
   79: p        PUT        3
   82: N        NONE
   83: t        TUPLE      (MARK at 33)
   84: p    PUT        4
   87: R    REDUCE
   88: p    PUT        5
   91: (    MARK
   92: d        DICT       (MARK at 91)
   93: p    PUT        6
   96: V    UNICODE    'value'
  103: p    PUT        7
  106: L    LONG       42
  111: s    SETITEM
  112: b    BUILD
  113: a    APPEND
  114: g    GET        5
  117: a    APPEND
  118: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(x, 1))
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: c        GLOBAL     'copy_reg _reconstructor'
   29: q        BINPUT     1
   31: (        MARK
   32: c            GLOBAL     'pickletools _Example'
   54: q            BINPUT     2
   56: c            GLOBAL     '__builtin__ object'
   76: q            BINPUT     3
   78: N            NONE
   79: t            TUPLE      (MARK at 31)
   80: q        BINPUT     4
   82: R        REDUCE
   83: q        BINPUT     5
   85: }        EMPTY_DICT
   86: q        BINPUT     6
   88: X        BINUNICODE 'value'
   98: q        BINPUT     7
  100: K        BININT1    42
  102: s        SETITEM
  103: b        BUILD
  104: h        BINGET     5
  106: e        APPENDS    (MARK at 3)
  107: .    STOP
highest protocol among opcodes = 1

Try "the canonical" recursive-object test.

>>> L = []
>>> T = L,
>>> L.append(T)
>>> L[0] is T
True
>>> T[0] is L
True
>>> L[0][0] is L
True
>>> T[0][0] is T
True
>>> dis(pickle.dumps(L, 0))
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: (    MARK
    6: g        GET        0
    9: t        TUPLE      (MARK at 5)
   10: p    PUT        1
   13: a    APPEND
   14: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(L, 1))
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: h        BINGET     0
    6: t        TUPLE      (MARK at 3)
    7: q    BINPUT     1
    9: a    APPEND
   10: .    STOP
highest protocol among opcodes = 1

Note that, in the protocol 0 pickle of the recursive tuple, the disassembler
has to emulate the stack in order to realize that the POP opcode at 16 gets
rid of the MARK at 0.

>>> dis(pickle.dumps(T, 0))
    0: (    MARK
    1: (        MARK
    2: l            LIST       (MARK at 1)
    3: p        PUT        0
    6: (        MARK
    7: g            GET        0
   10: t            TUPLE      (MARK at 6)
   11: p        PUT        1
   14: a        APPEND
   15: 0        POP
   16: 0        POP        (MARK at 0)
   17: g    GET        1
   20: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(T, 1))
    0: (    MARK
    1: ]        EMPTY_LIST
    2: q        BINPUT     0
    4: (        MARK
    5: h            BINGET     0
    7: t            TUPLE      (MARK at 4)
    8: q        BINPUT     1
   10: a        APPEND
   11: 1        POP_MARK   (MARK at 0)
   12: h    BINGET     1
   14: .    STOP
highest protocol among opcodes = 1

Try protocol 2.

>>> dis(pickle.dumps(L, 2))
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: h    BINGET     0
    7: \x85 TUPLE1
    8: q    BINPUT     1
   10: a    APPEND
   11: .    STOP
highest protocol among opcodes = 2

>>> dis(pickle.dumps(T, 2))
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: h    BINGET     0
    7: \x85 TUPLE1
    8: q    BINPUT     1
   10: a    APPEND
   11: 0    POP
   12: h    BINGET     1
   14: .    STOP
highest protocol among opcodes = 2

Try protocol 3 with annotations:

>>> dis(pickle.dumps(T, 3), annotate=1)
    0: \x80 PROTO      3 Protocol version indicator.
    2: ]    EMPTY_LIST   Push an empty list.
    3: q    BINPUT     0 Store the stack top into the memo.  The stack is not popped.
    5: h    BINGET     0 Read an object from the memo and push it on the stack.
    7: \x85 TUPLE1       Build a one-tuple out of the topmost item on the stack.
    8: q    BINPUT     1 Store the stack top into the memo.  The stack is not popped.
   10: a    APPEND       Append an object to a list.
   11: 0    POP          Discard the top stack item, shrinking the stack by one item.
   12: h    BINGET     1 Read an object from the memo and push it on the stack.
   14: .    STOP         Stop the unpickling machine.
highest protocol among opcodes = 2

a=
>>> import pickle
>>> import io
>>> f = io.BytesIO()
>>> p = pickle.Pickler(f, 2)
>>> x = [1, 2, 3]
>>> p.dump(x)
>>> p.dump(x)
>>> f.seek(0)
0
>>> memo = {}
>>> dis(f, memo=memo)
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: (    MARK
    6: K        BININT1    1
    8: K        BININT1    2
   10: K        BININT1    3
   12: e        APPENDS    (MARK at 5)
   13: .    STOP
highest protocol among opcodes = 2
>>> dis(f, memo=memo)
   14: \x80 PROTO      2
   16: h    BINGET     0
   18: .    STOP
highest protocol among opcodes = 2
)Zdisassembler_testZdisassembler_memo_testcCsddl}|j�S)Nr)�doctestZtestmod)r�rrr�_test�
sr��__main__z$disassemble one or more pickle files)Zdescription�pickle_file�br�*zthe pickle file)�type�nargs�helpz-oz--output�wz+the file where the output should be written)�defaultrrz-mz--memo�
store_truez#preserve memo between disassemblies)�actionrz-lz
--indentlevelz8the number of blanks by which to indent a new MARK levelz-az
--annotatez2annotate each line with a short opcode descriptionz-pz
--preamblez==> {name} <==zMif more than one pickle file is specified, print this before each disassembly)rrz-tz--testzrun self-test suitez-vz)run verbosely; only affects self-test run�)rr�r-������������)TT)F)F)NNrr)�r1r�r�r�rBr�r�Z
UP_TO_NEWLINEZTAKEN_FROM_ARGUMENT1ZTAKEN_FROM_ARGUMENT4ZTAKEN_FROM_ARGUMENT4UZTAKEN_FROM_ARGUMENT8U�objectr
Zstructrrrrr r!r"r#r$r%r'r(r6r7r8r9r:r;r<r=r>r?r@rArDrErFrGrIrJrLrMrNrOrPrQrTrVrWrXrZr[r\r]r^r_r`rarbrcrRZpyintZpylongrhZpyinteger_or_boolZpyboolrYZpyfloatrirHZpybytes_or_strZpystringZpybytesZ	pyunicoderZpynonerfZpytuplerkZpylistrlZpydictrmZpysetZpyfrozensetZ	anyobjectr�rprqrxr�Zname2iZcode2i�	enumerater�r�rrrrr�r�r�rrrr�Z	_dis_testZ
_memo_testZ__test__r�r�argparse�ArgumentParser�parser�add_argumentZFileType�stdout�
parse_args�argsZtestr�r�Z
print_helpr�outputr�r�rZpreamble�formatr�rrrr�<module>
s�
$/		
	
;	


			

	+


& 

>

symbol.cpython-36.pyc000064400000004727150335715140010515 0ustar003


 \G�@s�dZdZdZdZdZdZdZdZdZd	Z	d
Z
dZdZd
Z
dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;d<Z<d=Z=d>Z>d?Z?d@Z@dAZAdBZBdCZCdDZDdEZEdFZFdGZGdHZHdIZIdJZJdKZKdLZLdMZMdNZNdOZOdPZPdQZQdRZRdSZSdTZTdUZUdVZViZWx6eXeY�jZ��D]$\Z[Z\e]e\�e]dW�k�rpe[eWe\<�qpWdXdY�Z^e_dZk�r�e^�d[S)\z;Non-terminal symbols of Python grammar (from "graminit.h").�iiiiiiiii	i
iii
iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiU�cCs:ddl}ddl}t|j�dkr.|jddg|_|j�dS)Nr�zInclude/graminit.hz
Lib/symbol.py)�sys�token�len�argv�_main)rr�r	�/usr/lib64/python3.6/symbol.pyrks
r�__main__N)`�__doc__Zsingle_inputZ
file_inputZ
eval_inputZ	decoratorZ
decoratorsZ	decoratedZ
async_funcdefZfuncdefZ
parametersZ
typedargslistZtfpdefZvarargslistZvfpdefZstmtZsimple_stmtZ
small_stmtZ	expr_stmtZ	annassignZtestlist_star_exprZ	augassignZdel_stmtZ	pass_stmtZ	flow_stmtZ
break_stmtZ
continue_stmtZreturn_stmtZ
yield_stmtZ
raise_stmtZimport_stmtZimport_nameZimport_fromZimport_as_nameZdotted_as_nameZimport_as_namesZdotted_as_namesZdotted_nameZglobal_stmtZ
nonlocal_stmtZassert_stmtZ
compound_stmtZ
async_stmtZif_stmtZ
while_stmtZfor_stmtZtry_stmtZ	with_stmtZ	with_itemZ
except_clauseZsuiteZtestZtest_nocondZlambdefZlambdef_nocondZor_testZand_testZnot_testZ
comparisonZcomp_opZ	star_expr�exprZxor_exprZand_exprZ
shift_exprZ
arith_exprZtermZfactorZpowerZ	atom_exprZatomZ
testlist_compZtrailerZ
subscriptlistZ	subscriptZsliceopZexprlistZtestlistZdictorsetmakerZclassdefZarglistZargumentZ	comp_iterZcomp_forZcomp_ifZ
encoding_declZ
yield_exprZ	yield_argZsym_name�list�globals�items�_nameZ_value�typer�__name__r	r	r	r
�<module>s�

nturl2path.cpython-36.pyc000064400000002735150335715140011310 0ustar003


 \�	�@sdZdd�Zdd�ZdS)z3Convert a NT pathname to a file URL and vice versa.cCsddl}ddl}|jdd�}d|kr\|dd�dkr@|dd�}|jd�}|jjd	j|��S|jd�}t|�dks�|dd|jkr�d|}t	|��|dd
j
�}|d
jd�}|d}x$|D]}|r�|d	|jj|�}q�W|jd�o�|jd��r�|d	7}|S)z{OS-specific conversion from a relative URL of the 'file' scheme
    to a file system path; not recommended for general use.�N�:�|�z////��/�\�z	Bad URL: ���r	)�string�urllib.parse�replace�split�parseZunquote�join�lenZ
ascii_letters�OSError�upper�endswith)Zurlr
�urllib�
components�comp�error�drive�path�r�"/usr/lib64/python3.6/nturl2path.py�url2pathnames(	


rcCs�ddl}d|krD|dd�dkr(d|}|jd�}|jjdj|��S|jd�}t|�dksjt|d�dkrzd	|}t|��|jj|dj��}|djd�}d
|d}x$|D]}|r�|d|jj|�}q�W|S)z{OS-specific conversion from a file system path to a relative URL
    of the 'file' scheme; not recommended for general use.rNrrz\\rrrz
Bad path: z///)rr
rZquoterrrr)�prrrrrrrrr�pathname2url(s"


rN)�__doc__rrrrrr�<module>s%calendar.cpython-36.pyc000064400000062434150335715140010760 0ustar003


 \�Z�@sdZddlZddlZddlZddlmZdddddd	d
ddd
ddddddddddddddgZeZ	Gdd�de�Z
Gdd�de�ZdZdZ
dd d!d d"d d"d d d"d d"d g
ZGd#d$�d$�ZGd%d&�d&�Zed'�Zed(�Zed)�Zed*�Zed+�\ZZZZZZZd,d�Zd-d	�Zd.d
�Zd/d�Z Gd0d�de!�Z"Gd1d�de"�Z#Gd2d�de"�Z$Gd3d4�d4�Z%Gd5d�de#�Z&Gd6d�de$�Z'e#�Z(e(j)Z*d7d�Z+e(j,Z-e(j.Z.e(j/Z0e(j1Z2e(j3Z3e(j4Z5e(j6Z7e(j8Z9dDZ:d9Z;e:e;fd:d;�Z<e:e;fd<d=�Z=d>Z>ej?e>dd�j@�ZAd?d�ZBd@dA�ZCeDdBk�reCejE�dS)Ea$Calendar printing functions

Note when comparing these calendars to the ones printed by cal(1): By
default, these calendars have Monday as the first day of the week, and
Sunday as the last (the European convention). Use setfirstweekday() to
set the first day of the week (0=Monday, 6=Sunday).�N)�repeat�IllegalMonthError�IllegalWeekdayError�setfirstweekday�firstweekday�isleap�leapdays�weekday�
monthrange�
monthcalendar�prmonth�month�prcal�calendar�timegm�
month_name�
month_abbr�day_name�day_abbr�Calendar�TextCalendar�HTMLCalendar�LocaleTextCalendar�LocaleHTMLCalendar�
weekheaderc@seZdZdd�Zdd�ZdS)rcCs
||_dS)N)r
)�selfr
�r� /usr/lib64/python3.6/calendar.py�__init__szIllegalMonthError.__init__cCs
d|jS)Nz!bad month number %r; must be 1-12)r
)rrrr�__str__szIllegalMonthError.__str__N)�__name__�
__module__�__qualname__rrrrrrrsc@seZdZdd�Zdd�ZdS)rcCs
||_dS)N)r	)rr	rrrr szIllegalWeekdayError.__init__cCs
d|jS)Nz7bad weekday number %r; must be 0 (Monday) to 6 (Sunday))r	)rrrrr"szIllegalWeekdayError.__str__N)r r!r"rrrrrrrs�����c@sFeZdZdd�ed�D�Zejddd��dd�Zd	d
�Zdd�Zd
S)�_localized_monthcCs g|]}tjd|dd�j�qS)i�r#)�datetime�date�strftime)�.0�irrr�
<listcomp>4sz_localized_month.<listcomp>�rcCsdS)N�r)�xrrr�<lambda>5sz_localized_month.<lambda>cCs
||_dS)N)�format)rr3rrrr7sz_localized_month.__init__cs4�j|}t|t�r&�fdd�|D�S|�j�SdS)Ncsg|]}|�j��qSr)r3)r,�f)rrrr.=sz0_localized_month.__getitem__.<locals>.<listcomp>)�_months�
isinstance�slicer3)rr-�funcsr)rr�__getitem__:s

z_localized_month.__getitem__cCsdS)N�
r)rrrr�__len__Asz_localized_month.__len__N)	r r!r"�ranger5�insertrr9r;rrrrr(2s
r(c@s6eZdZdd�ed�D�Zdd�Zdd�Zdd	�Zd
S)�_localized_daycCs g|]}tjdd|d�j�qS)i�r#)r)r*r+)r,r-rrrr.Hsz_localized_day.<listcomp>�cCs
||_dS)N)r3)rr3rrrrJsz_localized_day.__init__cs4�j|}t|t�r&�fdd�|D�S|�j�SdS)Ncsg|]}|�j��qSr)r3)r,r4)rrrr.Psz._localized_day.__getitem__.<locals>.<listcomp>)�_daysr6r7r3)rr-r8r)rrr9Ms

z_localized_day.__getitem__cCsdS)Nr?r)rrrrr;Tsz_localized_day.__len__N)r r!r"r<r@rr9r;rrrrr>Esr>z%Az%az%Bz%br?cCs$|ddko"|ddkp"|ddkS)z5Return True for leap years, False for non-leap years.�r�di�r)�yearrrrrdscCs@|d8}|d8}|d|d|d|d|d|dS)zFReturn number of leap years in range [y1, y2).
       Assume y1 <= y2.r#rArBi�r)Zy1Zy2rrrriscCstj|||�j�S)zTReturn weekday (0-6 ~ Mon-Sun) for year (1970-...), month (1-12),
       day (1-31).)r)r*r	)rCr
�dayrrrr	qscCsLd|kodkns t|��t||d�}t||tko@t|�}||fS)zQReturn weekday (0-6 ~ Mon-Sun) and number of days (28-31) for
       year, month.r#r/)rr	�mdays�Februaryr)rCr
�day1�ndaysrrrr
ws
c@s�eZdZdZddd�Zdd�Zdd�Zeee�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zd dd�Zd!dd�Zd"dd�ZdS)#rzo
    Base calendar class. This class doesn't do any formatting. It simply
    provides data to subclasses.
    rcCs
||_dS)N)r)rrrrrr�szCalendar.__init__cCs
|jdS)Nr?)�
_firstweekday)rrrr�getfirstweekday�szCalendar.getfirstweekdaycCs
||_dS)N)rI)rrrrrr�szCalendar.setfirstweekdayccs*x$t|j|jd�D]}|dVqWdS)zt
        Return an iterator for one week of weekday numbers starting with the
        configured first one.
        r?N)r<r)rr-rrr�iterweekdays�szCalendar.iterweekdaysccs�tj||d�}|j�|jd}|tj|d�8}tjdd�}xH|Vy||7}Wntk
rfPYnX|j|kr>|j�|jkr>Pq>WdS)z�
        Return an iterator for one month. The iterator will yield datetime.date
        values and will always iterate through complete weeks, so it will yield
        dates outside the specified month.
        r#r?)�daysN)r)r*r	rZ	timedelta�
OverflowErrorr
)rrCr
r*rLZonedayrrr�itermonthdates�szCalendar.itermonthdatesccs4x.t|j||�|j�D]\}}||dfVqWdS)z�
        Like itermonthdates(), but will yield (day number, weekday number)
        tuples. For days outside the specified month the day number is 0.
        r?N)�	enumerate�
itermonthdaysr)rrCr
r-�drrr�itermonthdays2�szCalendar.itermonthdays2ccsft||�\}}||jd}td|�EdHtd|d�EdH|j||d}td|�EdHdS)z�
        Like itermonthdates(), but will yield day numbers. For days outside
        the specified month the day number is 0.
        r?rNr#)r
rrr<)rrCr
rGrHZdays_beforeZ
days_afterrrrrP�szCalendar.itermonthdayscs.t|j||����fdd�tdt��d�D�S)z�
        Return a matrix (list of lists) representing a month's calendar.
        Each row represents a week; week entries are datetime.date values.
        csg|]}�||d��qS)r?r)r,r-)�datesrrr.�sz/Calendar.monthdatescalendar.<locals>.<listcomp>rr?)�listrNr<�len)rrCr
r)rSr�monthdatescalendar�szCalendar.monthdatescalendarcs.t|j||����fdd�tdt��d�D�S)z�
        Return a matrix representing a month's calendar.
        Each row represents a week; week entries are
        (day number, weekday number) tuples. Day numbers outside this month
        are zero.
        csg|]}�||d��qS)r?r)r,r-)rLrrr.�sz/Calendar.monthdays2calendar.<locals>.<listcomp>rr?)rTrRr<rU)rrCr
r)rLr�monthdays2calendar�szCalendar.monthdays2calendarcs.t|j||����fdd�tdt��d�D�S)z�
        Return a matrix representing a month's calendar.
        Each row represents a week; days outside this month are zero.
        csg|]}�||d��qS)r?r)r,r-)rLrrr.�sz.Calendar.monthdayscalendar.<locals>.<listcomp>rr?)rTrPr<rU)rrCr
r)rLr�monthdayscalendar�szCalendar.monthdayscalendar�cs>��fdd�tttd�D����fdd�tdt����D�S)a'
        Return the data for the specified year ready for formatting. The return
        value is a list of month rows. Each month row contains up to width months.
        Each month contains between 4 and 6 weeks and each week contains 1-7
        days. Days are datetime.date objects.
        csg|]}�j�|��qSr)rV)r,r-)rrCrrr.�sz.Calendar.yeardatescalendar.<locals>.<listcomp>r/csg|]}�||���qSrr)r,r-)�months�widthrrr.�sr)r<�JanuaryrU)rrCr[r)rZrr[rCr�yeardatescalendar�szCalendar.yeardatescalendarcs>��fdd�tttd�D����fdd�tdt����D�S)z�
        Return the data for the specified year ready for formatting (similar to
        yeardatescalendar()). Entries in the week lists are
        (day number, weekday number) tuples. Day numbers outside this month are
        zero.
        csg|]}�j�|��qSr)rW)r,r-)rrCrrr.�sz.Calendar.yeardays2calendar.<locals>.<listcomp>r/csg|]}�||���qSrr)r,r-)rZr[rrr.�sr)r<r\rU)rrCr[r)rZrr[rCr�yeardays2calendar�szCalendar.yeardays2calendarcs>��fdd�tttd�D����fdd�tdt����D�S)z�
        Return the data for the specified year ready for formatting (similar to
        yeardatescalendar()). Entries in the week lists are day numbers.
        Day numbers outside this month are zero.
        csg|]}�j�|��qSr)rX)r,r-)rrCrrr.�sz-Calendar.yeardayscalendar.<locals>.<listcomp>r/csg|]}�||���qSrr)r,r-)rZr[rrr.sr)r<r\rU)rrCr[r)rZrr[rCr�yeardayscalendar�szCalendar.yeardayscalendarN)r)rY)rY)rY)r r!r"�__doc__rrJr�propertyrrKrNrRrPrVrWrXr]r^r_rrrrr�s





c@sjeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
d�Z	ddd�Z
ddd�Zd dd�Zd!dd�Z
dS)"rzr
    Subclass of Calendar that outputs a calendar as a simple plain text
    similar to the UNIX program cal.
    cCst|j||�dd�dS)z3
        Print a single week (no newline).
        � )�endN)�print�
formatweek)r�theweekr[rrr�prweek
szTextCalendar.prweekcCs |dkrd}nd|}|j|�S)z*
        Returns a formatted day.
        rr0z%2i)�center)rrDr	r[�srrr�	formatdayszTextCalendar.formatdaycsdj��fdd�|D��S)zA
        Returns a single week in a string (no newline).
        rbc3s |]\}}�j||��VqdS)N)rj)r,rQ�wd)rr[rr�	<genexpr>sz*TextCalendar.formatweek.<locals>.<genexpr>)�join)rrfr[r)rr[rreszTextCalendar.formatweekcCs(|dkrt}nt}||d|�j|�S)z4
        Returns a formatted week day name.
        �	N)rrrh)rrDr[�namesrrr�
formatweekday szTextCalendar.formatweekdaycsdj��fdd��j�D��S)z-
        Return a header for a week.
        rbc3s|]}�j|��VqdS)N)rp)r,r-)rr[rrrl.sz0TextCalendar.formatweekheader.<locals>.<genexpr>)rmrK)rr[r)rr[r�formatweekheader*szTextCalendar.formatweekheaderTcCs"t|}|rd||f}|j|�S)z0
        Return a formatted month name.
        z%s %r)rrh)r�theyear�themonthr[�withyearrirrr�formatmonthname0szTextCalendar.formatmonthnamercCst|j||||�dd�dS)z+
        Print a month's calendar.
        r0)rcN)rd�formatmonth)rrrrs�w�lrrrr9szTextCalendar.prmonthcCs�td|�}td|�}|j||d|dd�}|j�}|d|7}||j|�j�7}|d|7}x4|j||�D]$}||j||�j�7}|d|7}qnW|S)z@
        Return a month's calendar string (multi-line).
        r$r#r?�
)�maxru�rstriprqrWre)rrrrsrwrxri�weekrrrrv?s

zTextCalendar.formatmonthr$r#�rYcs�td|�}td|�}td|�}|ddd�g}|j}|t��j�|||d�j��|d|��j|���x@t�j�|��D�]*\}}	t||dt	||ddd��}
|d|����fdd�|
D�}|t
|�|�j��|d|��fdd�|
D�}|t
|�|�j��|d|�td	d�|	D��}
xvt|
�D]j}g}x>|	D]6}|t|�k�rr|jd
�n|j�j|||���qTW|t
|�|�j��|d|��qFWq�Wd
j
|�S)zC
        Returns a year's calendar as a multi-line string.
        r$r#r?ryr:c3s|]}�j�|�d�VqdS)FN)ru)r,�k)�colwidthrrrrrrl`sz*TextCalendar.formatyear.<locals>.<genexpr>c3s|]
}�VqdS)Nr)r,r~)�headerrrrldscss|]}t|�VqdS)N)rU)r,�calrrrrlhsr0)rz�append�reprrhr{rqrOr^r<�min�formatstringrUrerm)rrrrwrx�c�m�v�ar-�rowrZroZheadersZheight�jZweeksr�r)rr�rrrr�
formatyearOs:


&
$
zTextCalendar.formatyearcCst|j|||||��dS)zPrint a year's calendar.N)rdr�)rrrrwrxr�r�rrr�pryeartszTextCalendar.pryearN)T)rr)rr)r$r#r}rY)rrr}rY)r r!r"r`rgrjrerprqrurrvr�r�rrrrrs


	


%c@sjeZdZdZdddddddgZd	d
�Zdd�Zd
d�Zdd�Zddd�Z	ddd�Z
ddd�Zd dd�ZdS)!rz4
    This calendar returns complete HTML pages.
    ZmonZtueZwedZthuZfriZsatZsuncCs"|dkrdSd|j||fSdS)z/
        Return a day as a table cell.
        rz<td class="noday">&nbsp;</td>z<td class="%s">%d</td>N)�
cssclasses)rrDr	rrrrj�szHTMLCalendar.formatdaycs dj�fdd�|D��}d|S)z8
        Return a complete week as a table row.
        r0c3s|]\}}�j||�VqdS)N)rj)r,rQrk)rrrrl�sz*HTMLCalendar.formatweek.<locals>.<genexpr>z<tr>%s</tr>)rm)rrfrir)rrre�szHTMLCalendar.formatweekcCsd|j|t|fS)z:
        Return a weekday name as a table header.
        z<th class="%s">%s</th>)r�r)rrDrrrrp�szHTMLCalendar.formatweekdaycs$dj�fdd��j�D��}d|S)z<
        Return a header for a week as a table row.
        r0c3s|]}�j|�VqdS)N)rp)r,r-)rrrrl�sz0HTMLCalendar.formatweekheader.<locals>.<genexpr>z<tr>%s</tr>)rmrK)rrir)rrrq�szHTMLCalendar.formatweekheaderTcCs*|rdt||f}ndt|}d|S)z5
        Return a month name as a table row.
        z%s %sz%sz.<tr><th colspan="7" class="month">%s</th></tr>)r)rrrrsrtrirrrru�szHTMLCalendar.formatmonthnamecCs�g}|j}|d�|d�||j|||d��|d�||j��|d�x*|j||�D]}||j|��|d�qXW|d�|d�dj|�S)z6
        Return a formatted month as a table.
        z@<table border="0" cellpadding="0" cellspacing="0" class="month">ry)rtz</table>r0)r�rurqrWrerm)rrrrsrtr�r�r|rrrrv�szHTMLCalendar.formatmonthrYcCs�g}|j}t|d�}|d�|d�|d||f�xntttd|�D]Z}t|t||d��}|d�x0|D](}|d�||j||d	d
��|d�qlW|d�qFW|d
�dj|�S)z?
        Return a formatted year as a table of tables.
        r#z?<table border="0" cellpadding="0" cellspacing="0" class="year">ryz.<tr><th colspan="%d" class="year">%s</th></tr>r/r:z<tr>z<td>F)rtz</td>z</tr>z</table>r0)r�rzr<r\r�rvrm)rrrr[r�r�r-rZr�rrrr��s 

zHTMLCalendar.formatyear�calendar.cssNcCs�|dkrtj�}g}|j}|d|�|d�|d�|d�|d|�|dk	r^|d|�|d|�|d	�|d
�||j||��|d�|d�d
j|�j|d�S)zB
        Return a formatted year as a complete HTML page.
        Nz$<?xml version="1.0" encoding="%s"?>
zn<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
z<html>
z<head>
zC<meta http-equiv="Content-Type" content="text/html; charset=%s" />
z4<link rel="stylesheet" type="text/css" href="%s" />
z<title>Calendar for %d</title>
z</head>
z<body>
z</body>
z</html>
r0�xmlcharrefreplace)�sys�getdefaultencodingr�r�rm�encode)rrrr[�css�encodingr�r�rrr�formatyearpage�s$zHTMLCalendar.formatyearpage)T)T)rY)rYr�N)
r r!r"r`r�rjrerprqrurvr�r�rrrrrys	



c@s$eZdZdd�Zdd�Zdd�ZdS)�different_localecCs
||_dS)N)�locale)rr�rrrr�szdifferent_locale.__init__cCs"tjtj�|_tjtj|j�dS)N)�_localeZ	getlocale�LC_TIME�	oldlocale�	setlocaler�)rrrr�	__enter__�szdifferent_locale.__enter__cGstjtj|j�dS)N)r�r�r�r�)r�argsrrr�__exit__�szdifferent_locale.__exit__N)r r!r"rr�r�rrrrr��sr�c@s,eZdZdZddd�Zdd�Zdd	d
�ZdS)
ra
    This class can be passed a locale name in the constructor and will return
    month and weekday names in the specified locale. If this locale includes
    an encoding all strings containing month and weekday names will be returned
    as unicode.
    rNcCs&tj||�|dkrtj�}||_dS)N)rrr��getdefaultlocaler�)rrr�rrrr�szLocaleTextCalendar.__init__c
CsBt|j��.|dkrt}nt}||}|d|�j|�SQRXdS)Nrn)r�r�rrrh)rrDr[ro�namerrrrpsz LocaleTextCalendar.formatweekdayTc
Cs8t|j��$t|}|r$d||f}|j|�SQRXdS)Nz%s %r)r�r�rrh)rrrrsr[rtrirrrrus
z"LocaleTextCalendar.formatmonthname)rN)T)r r!r"r`rrprurrrrr�s
	c@s,eZdZdZddd�Zdd�Zdd	d
�ZdS)
ra
    This class can be passed a locale name in the constructor and will return
    month and weekday names in the specified locale. If this locale includes
    an encoding all strings containing month and weekday names will be returned
    as unicode.
    rNcCs&tj||�|dkrtj�}||_dS)N)rrr�r�r�)rrr�rrrrszLocaleHTMLCalendar.__init__c
Cs0t|j��t|}d|j||fSQRXdS)Nz<th class="%s">%s</th>)r�r�rr�)rrDrirrrrp!sz LocaleHTMLCalendar.formatweekdayTc
Cs6t|j��"t|}|r$d||f}d|SQRXdS)Nz%s %sz.<tr><th colspan="7" class="month">%s</th></tr>)r�r�r)rrrrsrtrirrrru&s
z"LocaleHTMLCalendar.formatmonthname)rN)T)r r!r"r`rrprurrrrrs
cCs*t|kotkns t|��|t_dS)N)�MONDAY�SUNDAYrr�r)rrrrr3srYr}cCstt|||��dS)z1Prints multi-column formatting for year calendarsN)rdr�)�colsr�spacingrrrr3Gsr3cs |d9}|j�fdd�|D��S)zEReturns a string formatted from n strings, centered within n columns.rbc3s|]}|j��VqdS)N)rh)r,r�)rrrrlOszformatstring.<locals>.<genexpr>)rm)r�rr�r)rrr�Lsr�i�cCs^|dd�\}}}}}}tj||d�j�t|d}|d|}|d|}	|	d|}
|
S)zBUnrelated but handy function to calculate Unix timestamp from GMT.Nr}r#��<)r)r*�	toordinal�
_EPOCH_ORD)�tuplerCr
rDZhourZminute�secondrLZhoursZminutesZsecondsrrrrVscCs�ddl}|j�}|jd�}|jd�}|jddtddd�|jd	d
tddd�|jd
dtddd�|jddtddd�|jddddd�|jddddd�|jddddd�|jd d!d"d3d$d%�|jd&d'td(d)�|jd*d'td+d)�|j|dd��}|j�r|j�r|jd,�t	j
d�|j|jf}|jd#k�r�|j�rFt|d-�}nt
�}|j}|dk�rdt	j�}t||jd.�}	t	jjj}
|jdk�r�|
|jtjj�jf|	��n6|jdk�r�|
|j|jf|	��n|jd/�t	j
d�n�|j�r�t|d-�}nt�}t|j|jd0�}	|jdk�r&|j|	d1<|j|	d2<|jdk�rJ|j tjj�jf|	�}n2|jdk�rh|j |jf|	�}n|j!|j|jf|	�}t	jj}
|j�r�|j"|j�}t	jjj}
|
|�dS)4Nrztext only argumentszhtml only argumentsz-wz--widthr$z width of date column (default 2))�type�default�helpz-lz--linesr#z)number of lines for each week (default 1)z-sz	--spacingr}z"spacing between months (default 6)z-mz--monthsrYzmonths per row (default 3)z-cz--csszcalendar.csszCSS to use for page)r�r�z-Lz--localez.locale to be used from month and weekday namesz-ez
--encodingzencoding to use for outputz-tz--type�text�htmlzoutput type (text or html))r��choicesr�rC�?zyear number (1-9999))�nargsr�r�r
zmonth number (1-12, text only)z/if --locale is specified --encoding is required)r�)r�r�zincorrect number of arguments)rwrxr�r�)r�r�)#�argparse�ArgumentParserZadd_argument_group�add_argument�int�
parse_argsr�r��errorr��exitr�rrr��dictr��stdout�buffer�writerCr�r)r*Ztodayr
rrr[�linesr�rZr�rvr�)r�r��parserZ	textgroupZ	htmlgroupZoptionsr�r�r�Zoptdictr��resultrrr�main`s�









r��__main__��)Fr`r�r)r�r��	itertoolsr�__all__�
ValueErrorr�rrr\rFrEr(r>rrrrr<r�ZTUESDAYZ	WEDNESDAYZTHURSDAYZFRIDAYZSATURDAYr�rrr	r
�objectrrrr�rrr�rJrrrXrrgrer|rqrrrvr
r�rr�rZ	_colwidthZ_spacingr3r�ZEPOCHr*r�r�rr�r �argvrrrr�<module>sn



up
h
fractions.cpython-36.opt-1.pyc000064400000043774150335715140012144 0ustar003


 \W\�@s�dZddlmZddlZddlZddlZddlZddlZddgZdd�Z	dd�Z
ejjZ
ejjZejd	ejejB�ZGd
d�dej�ZdS)z+Fraction, infinite-precision, real numbers.�)�DecimalN�Fraction�gcdcCsfddl}|jdtd�t|�tko0t|�knr\|p<|dkrPtj||�Stj||�St||�S)z�Calculate the Greatest Common Divisor of a and b.

    Unless b==0, the result will have the same sign as b (so that when
    b is divided by it, the result comes out positive).
    rNz6fractions.gcd() is deprecated. Use math.gcd() instead.�)�warnings�warn�DeprecationWarning�type�int�mathr�_gcd)�a�br�r�!/usr/lib64/python3.6/fractions.pyrs cCsx|r|||}}qW|S)Nr)r
rrrrr sraC
    \A\s*                      # optional whitespace at the start, then
    (?P<sign>[-+]?)            # an optional sign, then
    (?=\d|\.\d)                # lookahead for digit or .digit
    (?P<num>\d*)               # numerator (possibly empty)
    (?:                        # followed by
       (?:/(?P<denom>\d+))?    # an optional denominator
    |                          # or
       (?:\.(?P<decimal>\d*))? # an optional fractional part
       (?:E(?P<exp>[-+]?\d+))? # and optional exponent
    )
    \s*\Z                      # and optional whitespace to finish
cs�eZdZdZdSZdTdd��fdd	�Zed
d��Zedd
��ZdUdd�Z	e
dd��Ze
dd��Zdd�Z
dd�Zdd�Zdd�Zeeej�\ZZdd�Zeeej�\ZZdd �Zeeej�\ZZd!d"�Zeeej�\ZZ d#d$�Z!d%d&�Z"d'd(�Z#d)d*�Z$d+d,�Z%d-d.�Z&d/d0�Z'd1d2�Z(d3d4�Z)d5d6�Z*d7d8�Z+d9d:�Z,dVd;d<�Z-d=d>�Z.d?d@�Z/dAdB�Z0dCdD�Z1dEdF�Z2dGdH�Z3dIdJ�Z4dKdL�Z5dMdN�Z6dOdP�Z7dQdR�Z8�Z9S)Wra]This class implements rational numbers.

    In the two-argument form of the constructor, Fraction(8, 6) will
    produce a rational number equivalent to 4/3. Both arguments must
    be Rational. The numerator defaults to 0 and the denominator
    defaults to 1 so that Fraction(3) == 3 and Fraction() == 0.

    Fractions can also be constructed from:

      - numeric strings similar to those accepted by the
        float constructor (for example, '-2.3' or '1e10')

      - strings of the form '123/456'

      - float and Decimal instances

      - other Rational instances (including integers)

    �
_numerator�_denominatorrNT)�
_normalizecsRtt|�j|�}|dk�rdt|�tkr6||_d|_|St|tj	�rV|j
|_|j|_|St|tt
f�rx|j�\|_|_|St|t��rZtj|�}|dkr�td|��t|jd�p�d�}|jd�}|r�t|�}nvd}|jd�}|�rdt|�}||t|�}||9}|jd	�}	|	�rBt|	�}	|	d
k�r4|d|	9}n|d|	9}|jd�dk�rb|}ntd
��nft|�tk�o�t|�kn�r�n@t|tj	��r�t|tj	��r�|j
|j|j
|j}}ntd��|d
k�r�td|��|�rBt|�tk�ot|�kn�r(tj||�}
|d
k�r2|
}
n
t||�}
||
}||
}||_||_|S)a�Constructs a Rational.

        Takes a string like '3/2' or '1.5', another Rational instance, a
        numerator/denominator pair, or a float.

        Examples
        --------

        >>> Fraction(10, -8)
        Fraction(-5, 4)
        >>> Fraction(Fraction(1, 7), 5)
        Fraction(1, 35)
        >>> Fraction(Fraction(1, 7), Fraction(2, 3))
        Fraction(3, 14)
        >>> Fraction('314')
        Fraction(314, 1)
        >>> Fraction('-35/4')
        Fraction(-35, 4)
        >>> Fraction('3.1415') # conversion from numeric string
        Fraction(6283, 2000)
        >>> Fraction('-47e-2') # string may include a decimal exponent
        Fraction(-47, 100)
        >>> Fraction(1.47)  # direct construction from float (exact conversion)
        Fraction(6620291452234629, 4503599627370496)
        >>> Fraction(2.25)
        Fraction(9, 4)
        >>> Fraction(Decimal('1.47'))
        Fraction(147, 100)

        N�z Invalid literal for Fraction: %rZnum�0�denom�decimal�
�exprZsign�-z2argument should be a string or a Rational instancez+both arguments should be Rational instanceszFraction(%s, 0))�superr�__new__r	r
rr�
isinstance�numbers�Rational�	numerator�denominator�floatr�as_integer_ratio�str�_RATIONAL_FORMAT�match�
ValueError�group�len�	TypeError�ZeroDivisionErrorrrr)�clsr r!r�self�mrrZscaler�g)�	__class__rrrTsr







$

$

zFraction.__new__cCsDt|tj�r||�St|t�s8td|j|t|�jf��||j��S)z�Converts a finite float to a rational number, exactly.

        Beware that Fraction.from_float(0.3) != Fraction(3, 10).

        z.%s.from_float() only takes floats, not %r (%s))rr�Integralr"r*�__name__r	r#)r,�frrr�
from_float�s
zFraction.from_floatcCsVddlm}t|tj�r&|t|��}n$t||�sJtd|j|t|�jf��||j	��S)zAConverts a finite Decimal instance to a rational number, exactly.r)rz2%s.from_decimal() only takes Decimals, not %r (%s))
rrrrr1r
r*r2r	r#)r,Zdecrrrr�from_decimal�s
zFraction.from_decimal�@Bc
Cs�|dkrtd��|j|kr"t|�Sd\}}}}|j|j}}xP||}|||}	|	|kr\P||||||	f\}}}}||||}}q>W|||}
t||
|||
|�}t||�}t||�t||�kr�|S|SdS)aWClosest Fraction to self with denominator at most max_denominator.

        >>> Fraction('3.141592653589793').limit_denominator(10)
        Fraction(22, 7)
        >>> Fraction('3.141592653589793').limit_denominator(100)
        Fraction(311, 99)
        >>> Fraction(4321, 8765).limit_denominator(10000)
        Fraction(4321, 8765)

        rz$max_denominator should be at least 1rN)rrrr)r'rrr�abs)
r-Zmax_denominatorZp0Zq0Zp1Zq1�n�dr
Zq2�kZbound1Zbound2rrr�limit_denominator�s& 

zFraction.limit_denominatorcCs|jS)N)r)r
rrrr szFraction.numeratorcCs|jS)N)r)r
rrrr!szFraction.denominatorcCsd|jj|j|jfS)z
repr(self)z
%s(%s, %s))r0r2rr)r-rrr�__repr__szFraction.__repr__cCs(|jdkrt|j�Sd|j|jfSdS)z	str(self)rz%s/%sN)rr$r)r-rrr�__str__s

zFraction.__str__csT��fdd�}d�jd|_�j|_��fdd�}d�jd|_�j|_||fS)a�Generates forward and reverse operators given a purely-rational
        operator and a function from the operator module.

        Use this like:
        __op__, __rop__ = _operator_fallbacks(just_rational_op, operator.op)

        In general, we want to implement the arithmetic operations so
        that mixed-mode operations either call an implementation whose
        author knew about the types of both arguments, or convert both
        to the nearest built in type and do the operation there. In
        Fraction, that means that we define __add__ and __radd__ as:

            def __add__(self, other):
                # Both types have numerators/denominator attributes,
                # so do the operation directly
                if isinstance(other, (int, Fraction)):
                    return Fraction(self.numerator * other.denominator +
                                    other.numerator * self.denominator,
                                    self.denominator * other.denominator)
                # float and complex don't have those operations, but we
                # know about those types, so special case them.
                elif isinstance(other, float):
                    return float(self) + other
                elif isinstance(other, complex):
                    return complex(self) + other
                # Let the other type take over.
                return NotImplemented

            def __radd__(self, other):
                # radd handles more types than add because there's
                # nothing left to fall back to.
                if isinstance(other, numbers.Rational):
                    return Fraction(self.numerator * other.denominator +
                                    other.numerator * self.denominator,
                                    self.denominator * other.denominator)
                elif isinstance(other, Real):
                    return float(other) + float(self)
                elif isinstance(other, Complex):
                    return complex(other) + complex(self)
                return NotImplemented


        There are 5 different cases for a mixed-type addition on
        Fraction. I'll refer to all of the above code that doesn't
        refer to Fraction, float, or complex as "boilerplate". 'r'
        will be an instance of Fraction, which is a subtype of
        Rational (r : Fraction <: Rational), and b : B <:
        Complex. The first three involve 'r + b':

            1. If B <: Fraction, int, float, or complex, we handle
               that specially, and all is well.
            2. If Fraction falls back to the boilerplate code, and it
               were to return a value from __add__, we'd miss the
               possibility that B defines a more intelligent __radd__,
               so the boilerplate should return NotImplemented from
               __add__. In particular, we don't handle Rational
               here, even though we could get an exact answer, in case
               the other type wants to do something special.
            3. If B <: Fraction, Python tries B.__radd__ before
               Fraction.__add__. This is ok, because it was
               implemented with knowledge of Fraction, so it can
               handle those instances before delegating to Real or
               Complex.

        The next two situations describe 'b + r'. We assume that b
        didn't know about Fraction in its implementation, and that it
        uses similar boilerplate code:

            4. If B <: Rational, then __radd_ converts both to the
               builtin rational type (hey look, that's us) and
               proceeds.
            5. Otherwise, __radd__ tries to find the nearest common
               base ABC, and fall back to its builtin type. Since this
               class doesn't subclass a concrete type, there's no
               implementation to fall back to, so we need to try as
               hard as possible to return an actual value, or the user
               will get a TypeError.

        csPt|ttf�r�||�St|t�r0�t|�|�St|t�rH�t|�|�StSdS)N)rr
rr"�complex�NotImplemented)r
r)�fallback_operator�monomorphic_operatorrr�forwardvs


z-Fraction._operator_fallbacks.<locals>.forward�__csZt|tj�r�||�St|tj�r4�t|�t|��St|tj�rR�t|�t|��StSdS)N)rrrZRealr"�Complexr>r?)rr
)r@rArr�reverse�s
z-Fraction._operator_fallbacks.<locals>.reverseZ__r)r2�__doc__)rAr@rBrEr)r@rAr�_operator_fallbacks&sP	
zFraction._operator_fallbackscCs,|j|j}}t|j||j|||�S)za + b)r!rr )r
r�da�dbrrr�_add�sz
Fraction._addcCs,|j|j}}t|j||j|||�S)za - b)r!rr )r
rrHrIrrr�_sub�sz
Fraction._subcCst|j|j|j|j�S)za * b)rr r!)r
rrrr�_mul�sz
Fraction._mulcCst|j|j|j|j�S)za / b)rr r!)r
rrrr�_div�sz
Fraction._divcCstj||�S)za // b)r�floor)r
rrrr�__floordiv__�szFraction.__floordiv__cCstj||�S)za // b)rrN)rr
rrr�
__rfloordiv__�szFraction.__rfloordiv__cCs||}|||S)za % br)r
r�divrrr�__mod__�szFraction.__mod__cCs||}|||S)za % br)rr
rQrrr�__rmod__�szFraction.__rmod__cCs�t|tj�r�|jdkr�|j}|dkr>t|j||j|dd�S|jdkrft|j||j|dd�St|j||j|dd�Sq�t|�t|�Snt|�|SdS)z�a ** b

        If b is not an integer, the result will be a float or complex
        since roots are generally irrational. If b is an integer, the
        result will be rational.

        rrF)rN)	rrrr!r rrrr")r
rZpowerrrr�__pow__�s 




zFraction.__pow__cCs\|jdkr|jdkr||jSt|tj�r<t|j|j�|S|jdkrP||jS|t|�S)za ** brr)	rrrrrrr r!r")rr
rrr�__rpow__�s


zFraction.__rpow__cCst|j|jdd�S)z++a: Coerces a subclass instance to FractionF)r)rrr)r
rrr�__pos__�szFraction.__pos__cCst|j|jdd�S)z-aF)r)rrr)r
rrr�__neg__�szFraction.__neg__cCstt|j�|jdd�S)zabs(a)F)r)rr7rr)r
rrr�__abs__�szFraction.__abs__cCs*|jdkr|j|jS|j|jSdS)ztrunc(a)rN)rr)r
rrr�	__trunc__�s
zFraction.__trunc__cCs|j|jS)zWill be math.floor(a) in 3.0.)r r!)r
rrr�	__floor__�szFraction.__floor__cCs|j|jS)zWill be math.ceil(a) in 3.0.)r r!)r
rrr�__ceil__szFraction.__ceil__cCs�|dkrZt|j|j�\}}|d|jkr,|S|d|jkrB|dS|ddkrR|S|dSdt|�}|dkr�tt||�|�Stt||�|�SdS)zOWill be round(self, ndigits) in 3.0.

        Rounds half toward even.
        Nrrrr)�divmodr r!r7r�round)r-ZndigitsrNZ	remainderZshiftrrr�	__round__szFraction.__round__cCsPt|jtdt�}|st}nt|j�|t}|dkr:|n|}|dkrLdS|S)z
hash(self)rrr������)�powr�_PyHASH_MODULUS�_PyHASH_INFr7r)r-ZdinvZhash_�resultrrr�__hash__!szFraction.__hash__cCs�t|�tkr |j|ko|jdkSt|tj�rD|j|jkoB|j|jkSt|tj	�r`|j
dkr`|j}t|t�r�t
j|�s~t
j|�r�d|kS||j|�kSntSdS)za == brrgN)r	r
rrrrrr r!rD�imag�realr"r�isnan�isinfr4r?)r
rrrr�__eq__7s
zFraction.__eq__cCsht|tj�r&||j|j|j|j�St|t�r`tj	|�sDtj
|�rN|d|�S|||j|��SntSdS)acHelper for comparison operators, for internal use only.

        Implement comparison between a Rational instance `self`, and
        either another Rational instance or a float `other`.  If
        `other` is not a Rational instance or a float, return
        NotImplemented. `op` should be one of the six standard
        comparison operators.

        gN)
rrrrr!rr r"rrhrir4r?)r-�other�oprrr�_richcmpLs

zFraction._richcmpcCs|j|tj�S)za < b)rm�operator�lt)r
rrrr�__lt__bszFraction.__lt__cCs|j|tj�S)za > b)rmrn�gt)r
rrrr�__gt__fszFraction.__gt__cCs|j|tj�S)za <= b)rmrn�le)r
rrrr�__le__jszFraction.__le__cCs|j|tj�S)za >= b)rmrn�ge)r
rrrr�__ge__nszFraction.__ge__cCs
|jdkS)za != 0r)r)r
rrr�__bool__rszFraction.__bool__cCs|jt|�ffS)N)r0r$)r-rrr�
__reduce__xszFraction.__reduce__cCs t|�tkr|S|j|j|j�S)N)r	rr0rr)r-rrr�__copy__{szFraction.__copy__cCs t|�tkr|S|j|j|j�S)N)r	rr0rr)r-�memorrr�__deepcopy__�szFraction.__deepcopy__)rr)rN)r6)N):r2�
__module__�__qualname__rF�	__slots__r�classmethodr4r5r;�propertyr r!r<r=rGrJrn�add�__add__�__radd__rK�sub�__sub__�__rsub__rL�mul�__mul__�__rmul__rM�truediv�__truediv__�__rtruediv__rOrPrRrSrTrUrVrWrXrYrZr[r^rerjrmrprrrtrvrwrxryr{�
__classcell__rr)r0rr<sVm
7k
)rFrrrrrn�re�sys�__all__rr�	hash_info�modulusrb�infrc�compile�VERBOSE�
IGNORECASEr%rrrrrr�<module>styping.cpython-36.pyc000064400000217134150335715140010520 0ustar003


 \�9�D@s�ddlZddlmZmZddlZddlZddlZddlZddlZddl	Z	yddl
jZWnek
rrddlZYnXej
dd�d�kr�ddlZyddl	mZmZmZWn4ek
r�eej�Zee�j�Zeej�ZYnXddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:g4Zd;d<�Zd=d>�ZGd?d@�d@e�ZGdAdB�dBedCdD�ZGdEdF�dFedCdG�ZGdHdI�dIedCdG�ZGdJdK�dKedCdG�ZdLdM�Z dNdO�Z!dPdQ�Z"dRdS�Z#dTdU�Z$GdVdW�dWedCdG�Z%e%dCdG�Z&GdXdY�dYedCdG�Z'e'dCdG�Z(GdZd�dedCdG�Z)e)d[�Z*e)d\�Z+e)d]�Z,e)d^dCd_�Z-e)d`dCd_�Z.e)dadCd_�Z/e)dbdCdc�Z0e)d2e1e�Z2ddde�Z3d�dfdg�Z4dhdi�Z5djdk�Z6gZ7dldm�Z8Gdndo�doedCdG�Z9e9dCdG�Z:Gdpdq�dqedCdG�Z;e;dCdG�Z<drds�Z=dtdu�Z>dvdw�Z?Gdxd�deej@�ZAdZBdydz�ZCGd{d
�d
eAd|�ZBGd}d~�d~�ZDGdd��d��ZEGd�d��d�eA�ZFGd�d�deGeGeFd��ZHGd�d��d�eA�ZIGd�d�dejJeId��ZJGd�d��d�edCdG�ZKeKdCdG�ZLd�d3�ZMd�d��ZNe	jOe	jPe	jQe	jReeefZSd�d�d4�ZTd�d6�ZUd�d7�ZVd�d��ZWd�d8�ZXGd�d��d�eA�ZYGd�d��d�eYd|�ZZej[Z[e\ed���rjGd�d��d�eBe-ej]d��Z]ej^d��e\ed���r�Gd�d��d�e]e.eBe-e0e.fej_d��Z_ej^d��e\ed���r�Gd�d��d�eBe-ej`d��Z`Gd�d��d�e`e-ejad��Zaej^d��ej^d��Gd�d�deBe-ejbd��ZbGd�d�debe-ejcd��ZcGd�d'�d'eZ�ZdGd�d&�d&eZ�ZeGd�d%�d%eZ�ZfGd�d$�d$eZ�ZgGd�d#�d#eZe-�ZhGd�d(�d(eZe-�Zie\ed"��r�Gd�d"�d"ebe-ejjd��ZjnGd�d"�d"eZe-�ZjejkZkGd�d�deBe-ejld��Zle\ed���r*Gd�d��d�ekebe-ele-ejmd��Zmej^d��e\ed���rRGd�d�deme-ejnd��Zon"Gd�d�dekebe-ele-ejnd��ZoGd�d�deoe*ejpd��Zpe\ed���r�Gd�d�deme+eBe+e/fejqd��Zqn,Gd�d�dekebe+ele+eBe+e/fejqd��ZqGd�d�deqe+e,fejrd��Zre\ed"��rhe\ed���rDGd�d�deje-eme-ejsd��Zsn"Gd�d�dekeje-ele-ejsd��Zsn"Gd�d�dekebe-ele-ejsd��ZsGd�d�dese*ejtd��ZtGd�d�deseuejvd��ZvGd�d-�d-ewete*ewd��ZxGd�d*�d*ejyete*ejyd��ZzGd�d.�d.e{epe*e{d��ZnGd�d/�d/e|eoe-e|d��Z}Gd�d�dekebe-ej~d��Z~Gd�d�de~e+eoe+ejd��ZGd�d�de~eHe+e/feoeHe+e/feBe+e/fej�d��Z�Gd�d!�d!e~e/ej�d��Z�e\ed���r�Gd�d�deBe-ej�d��Z�nGd�d�deBe-�Z�e\edÃ�	r(Gd�dńd�eBe-ej�d��Z�ej^dŃnej
dd�d�k�	rDe�dǃGd�d+�d+e�ere+e,fe�d��Z�Gd�d,�d,ej�ere+e,fej�d��Z�Gd�d)�d)ej�e�e*eufej�d��Z�e\ed˃�	r�ej^d˃Gd�d˄d�ej�ere+e,fej�d��Z�e\ed1��	r�ej�Z�ne	j�Z�Gd�d1�d1ece-eBe-e0e.fe�d��Z�e\ed΃�
rVGd�d΄d�eae-eBe-e0fej�d��Z�ej^d΃e)d�dCedэZ�Gd�d
�d
eBe�ed��Z�d�dԄZ�ej
dd�d�kZ��dZ��dZ�Gd�d�d�e�Z�Gd�d0�d0e�d|�Z�d�d5�Z�eZ�d�Z�Gd�d�d�eBe2�Z�Gd�d�d�e�e1�Z�Gd�d�d�e�e�Z�Gd�d�d�Z�e�d�e�_�e�ej�e�j�<ed�e2eej�d��d�d���Z�ed�e2eej�d�d��d�d���Z�Gd�d��d��Ze�d�e_�eej�ej�<dS(�N)�abstractmethod�abstractproperty���)�WrapperDescriptorType�MethodWrapperType�MethodDescriptorType�Any�Callable�ClassVar�Generic�Optional�Tuple�Type�TypeVar�Union�AbstractSet�GenericMeta�
ByteString�	Container�ContextManager�Hashable�	ItemsView�Iterable�Iterator�KeysView�Mapping�MappingView�MutableMapping�MutableSequence�
MutableSet�Sequence�Sized�
ValuesView�
Reversible�SupportsAbs�
SupportsBytes�SupportsComplex�
SupportsFloat�SupportsInt�
SupportsRound�Counter�Deque�Dict�DefaultDict�List�Set�	FrozenSet�
NamedTuple�	Generator�AnyStr�cast�get_type_hints�NewType�
no_type_check�no_type_check_decorator�overload�Text�
TYPE_CHECKINGcCs"tjdd�dkr|jS|jSdS)Nrr)rr)�sys�version_info�__qualname__�__name__)�x�rC�/usr/lib64/python3.6/typing.py�	_qualnamegsrEcCs&d}|jd�r"||kr"|dd�}|S)N�
_TypeAlias�_ForwardRef�_TypingBase�_FinalTypingBase�_�)rFrGrHrI)�
startswith)ZnmZ	whitelistrCrCrD�
_trim_nameosrMcsJeZdZdZdZdd��fdd�
Zdd�Zdd	�Zd
d�Zdd
�Z	�Z
S)�
TypingMetaa�Metaclass for most types defined in typing module
    (not a part of public API).

    This overrides __new__() to require an extra keyword parameter
    '_root', which serves as a guard against naive subclassing of the
    typing classes.  Any legitimate class defined using a metaclass
    derived from TypingMeta must pass _root=True.

    This also defines a dummy constructor (all the work for most typing
    constructs is done in __new__) and a nicer repr().
    F)�_rootcs2|s tddjtt|��pd��t�j||||�S)NzCannot subclass %sz, z())�	TypeError�join�map�
_type_repr�super�__new__)�cls�name�bases�	namespacerO)�	__class__rCrDrU�szTypingMeta.__new__cOsdS)NrC)�self�args�kwdsrCrCrD�__init__�szTypingMeta.__init__cCs|S)a'Override this in subclasses to interpret forward references.

        For example, List['C'] is internally stored as
        List[_ForwardRef('C')], which should evaluate to List[C],
        where C is an object found in globalns or localns (searching
        localns first, of course).
        rC)r[�globalns�localnsrCrCrD�
_eval_type�szTypingMeta._eval_typecCsdS)NrC)r[�tvarsrCrCrD�_get_type_vars�szTypingMeta._get_type_varscCstt|��}d|j|fS)Nz%s.%s)rMrE�
__module__)r[�qnamerCrCrD�__repr__�szTypingMeta.__repr__)rArdr@�__doc__�_is_protocolrUr^rarcrf�
__classcell__rCrC)rZrDrNvs
rNcsLeZdZdZdZdd�Z�fdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
�ZS)rHz0Internal indicator of special typing constructs.�__weakref__cOsdS)NrC)r[r\r]rCrCrDr^�sz_TypingBase.__init__cs@t|�dkr4t|dt�r4t|dt�r4td|��t�j|�S)z�Constructor.

        This only exists to give a better error message in case
        someone tries to subclass a special typing object (not a good idea).
        rrrKzCannot subclass %r)�len�
isinstance�str�tuplerPrTrU)rVr\r])rZrCrDrU�s
z_TypingBase.__new__cCs|S)NrC)r[r_r`rCrCrDra�sz_TypingBase._eval_typecCsdS)NrC)r[rbrCrCrDrc�sz_TypingBase._get_type_varscCs"t|�}tt|��}d|j|fS)Nz%s.%s)�typerMrErd)r[rVrerCrCrDrf�sz_TypingBase.__repr__cOstdt|���dS)NzCannot instantiate %r)rPro)r[r\r]rCrCrD�__call__�sz_TypingBase.__call__)rj)rArdr@rg�	__slots__r^rUrarcrfrprirCrC)rZrDrH�srHT)�	metaclassrOcs2eZdZdZfZdd��fdd�
Zdd�Z�ZS)rIz�Internal mix-in class to prevent instantiation.

    Prevents instantiation unless _root=True is given in class call.
    It is used to create pseudo-singleton instances Any, Union, Optional, etc.
    F)rOcs0t�j|f|�|�}|dkr |Std|��dS)NTzCannot instantiate %r)rTrUrP)rVrOr\r]r[)rZrCrDrU�sz_FinalTypingBase.__new__cCstt|�j�S)N)rMrorA)r[rCrCrD�
__reduce__�sz_FinalTypingBase.__reduce__)rArdr@rgrqrUrsrirCrC)rZrDrI�srI)rOcsTeZdZdZdZ�fdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Z�ZS)rGz-Internal wrapper to hold a forward reference.�__forward_arg__�__forward_code__�__forward_evaluated__�__forward_value__cstt�j|�t|t�s$td|f��yt|dd�}Wn"tk
rVtd|f��YnX||_||_d|_	d|_
dS)Nz,Forward reference must be a string -- got %rz<string>�evalz1Forward reference must be an expression -- got %rF)rTr^rlrmrP�compile�SyntaxErrorrtrurvrw)r[�arg�code)rZrCrDr^�s
z_ForwardRef.__init__cCsf|js||k	r`|dkr*|dkr*i}}n|dkr8|}n|dkrD|}tt|j||�d�|_d|_|jS)Nz*Forward references must evaluate to types.T)rv�_type_checkrxrurw)r[r_r`rCrCrDra�s
z_ForwardRef._eval_typecCs&t|t�stS|j|jko$|j|jkS)N)rlrG�NotImplementedrtrw)r[�otherrCrCrD�__eq__�s
z_ForwardRef.__eq__cCst|j|jf�S)N)�hashrtrw)r[rCrCrD�__hash__sz_ForwardRef.__hash__cCstd��dS)Nz4Forward references cannot be used with isinstance().)rP)r[�objrCrCrD�__instancecheck__sz_ForwardRef.__instancecheck__cCstd��dS)Nz4Forward references cannot be used with issubclass().)rP)r[rVrCrCrD�__subclasscheck__sz_ForwardRef.__subclasscheck__cCsd|jfS)Nz_ForwardRef(%r))rt)r[rCrCrDrf	sz_ForwardRef.__repr__)rtrurvrw)
rArdr@rgrqr^rar�r�r�r�rfrirCrC)rZrDrG�srGc@sLeZdZdZdZdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)rFa:Internal helper class for defining generic variants of concrete types.

    Note that this is not a type; let's call it a pseudo-type.  It cannot
    be used in instance and subclass checks in parameterized form, i.e.
    ``isinstance(42, Match[str])`` raises ``TypeError`` instead of returning
    ``False``.
    rW�type_var�	impl_type�type_checkercCszt|t�stt|���t|t�s,tt|���t|t�sDtt|���t|ttf�s^tt|���||_||_||_	||_
dS)atInitializer.

        Args:
            name: The name, e.g. 'Pattern'.
            type_var: The type parameter, e.g. AnyStr, or the
                specific type, e.g. str.
            impl_type: The implementation type.
            type_checker: Function that takes an impl_type instance.
                and returns a value that should be a type_var instance.
        N)rlrm�AssertionError�reprrorNrHrWr�r�r�)r[rWr�r�r�rCrCrDr^sz_TypeAlias.__init__cCsd|jt|j�fS)Nz%s[%s])rWrSr�)r[rCrCrDrf,sz_TypeAlias.__repr__cCs�t|jt�std|��|jjrJt|t�rJt||jj�sJtd||jf��t|t�rj||jk	rjtd|��|j|j||j	|j
�S)Nz#%s cannot be further parameterized.z&%s is not a valid substitution for %s.z%s cannot be re-parameterized.)rlr�rrP�__constraints__ro�
issubclassrZrWr�r�)r[Z	parameterrCrCrD�__getitem__/s
z_TypeAlias.__getitem__cCs&t|t�stS|j|jko$|j|jkS)N)rlrFr~rWr�)r[rrCrCrDr�;s
z_TypeAlias.__eq__cCst|j|jf�S)N)r�rWr�)r[rCrCrDr�@sz_TypeAlias.__hash__cCs t|jt�std��t||j�S)Nz<Parameterized type aliases cannot be used with isinstance().)rlr�rrPr�)r[r�rCrCrDr�Csz_TypeAlias.__instancecheck__cCs t|jt�std��t||j�S)Nz<Parameterized type aliases cannot be used with issubclass().)rlr�rrPr�r�)r[rVrCrCrDr�Isz_TypeAlias.__subclasscheck__N)rWr�r�r�)rArdr@rgrqr^rfr�r�r�r�r�rCrCrCrDrF
srFcCs0x*|D]"}t|t�st|t�r|j|�qWdS)N)rlrNrHrc)�typesrb�trCrCrDrcPs
rccCsg}t||�t|�S)N)rcrn)r�rbrCrCrD�
_type_varsVs
r�cCs$t|t�st|t�r |j||�S|S)N)rlrNrHra)r�r_r`rCrCrDra\sracCs�|dkrtd�St|t�r"t|�}t|t�r:t|�jdksTt|ttf�rft|�rft|d|f��t|�jdkr�t|dd�s�t|t	�r�|j
ttfkr�td|��|S)	a�Check that the argument is a type, and return it (internal helper).

    As a special case, accept None and return type(None) instead.
    Also, _TypeAlias instances (e.g. Match, Pattern) are acceptable.

    The msg argument is a human-readable error message, e.g.

        "Union[arg, ...]: arg should be a type."

    We append the repr() of the actual value (truncated to 100 chars).
    N�	_ClassVarz Got %.100r.�_Union�	_Optional�
__origin__z&Plain %s is not valid as type argument)r�r�)
rorlrmrGrHrA�callablerP�getattrrN�_gorgr
�	_Protocol)r{�msgrCrCrDr}bs
r}cCs`t|t�r:t|t�r:|jdkr(t|�Sd|jt|�fS|dkrFdSt|tj�rX|jSt|�S)a;Return the repr() of an object, special-casing types (internal helper).

    If obj is a type, we return a shorter version than the default
    type.__repr__, based on the module and qualified name, which is
    typically enough to uniquely identify a type.  For everything
    else, we fall back on repr(obj).
    �builtinsz%s.%s.z...)	rlrorNrdrEr��FunctionTyperAr�)r�rCrCrDrS�s
rSc@s$eZdZdZfZdd�Zdd�ZdS)�_Anya`Special type indicating an unconstrained type.

    - Any is compatible with every type.
    - Any assumed to have all methods.
    - All values assumed to be instances of Any.

    Note that all the above statements are true from the point of view of
    static type checkers. At runtime, Any should not be used with instance
    or class checks.
    cCstd��dS)Nz%Any cannot be used with isinstance().)rP)r[r�rCrCrDr��sz_Any.__instancecheck__cCstd��dS)Nz%Any cannot be used with issubclass().)rP)r[rVrCrCrDr��sz_Any.__subclasscheck__N)rArdr@rgrqr�r�rCrCrCrDr��s
r�c@s$eZdZdZfZdd�Zdd�ZdS)�	_NoReturnaSpecial type indicating functions that never return.
    Example::

      from typing import NoReturn

      def stop() -> NoReturn:
          raise Exception('no way')

    This type is invalid in other positions, e.g., ``List[NoReturn]``
    will fail in static type checkers.
    cCstd��dS)Nz*NoReturn cannot be used with isinstance().)rP)r[r�rCrCrDr��sz_NoReturn.__instancecheck__cCstd��dS)Nz*NoReturn cannot be used with issubclass().)rP)r[rVrCrCrDr��sz_NoReturn.__subclasscheck__N)rArdr@rgrqr�r�rCrCrCrDr��sr�csNeZdZdZdZdddd	��fd
d�
Zdd
�Zdd�Zdd�Zdd�Z	�Z
S)ra�Type variable.

    Usage::

      T = TypeVar('T')  # Can be anything
      A = TypeVar('A', str, bytes)  # Must be str or bytes

    Type variables exist primarily for the benefit of static type
    checkers.  They serve as the parameters for generic types as well
    as for generic function definitions.  See class Generic for more
    information on generic types.  Generic functions work as follows:

      def repeat(x: T, n: int) -> List[T]:
          '''Return a list containing n references to x.'''
          return [x]*n

      def longest(x: A, y: A) -> A:
          '''Return the longest of two strings.'''
          return x if len(x) >= len(y) else y

    The latter example's signature is essentially the overloading
    of (str, str) -> str and (bytes, bytes) -> bytes.  Also note
    that if the arguments are instances of some subclass of str,
    the return type is still plain str.

    At runtime, isinstance(x, T) and issubclass(C, T) will raise TypeError.

    Type variables defined with covariant=True or contravariant=True
    can be used do declare covariant or contravariant generic types.
    See PEP 484 for more details. By default generic types are invariant
    in all type variables.

    Type variables can be introspected. e.g.:

      T.__name__ == 'T'
      T.__constraints__ == ()
      T.__covariant__ == False
      T.__contravariant__ = False
      A.__constraints__ == (str, bytes)
    rA�	__bound__r��
__covariant__�__contravariant__NF)�bound�	covariant�
contravariantcs�t�j|f|�|||d��||_|r2|r2td��t|�|_t|�|_|rZ|dk	rZtd��|rrt|�dkrrtd��d�t	�fdd�|D��|_
|r�t|d	�|_nd|_dS)
N)r�r�r�z"Bivariant types are not supported.z-Constraints cannot be combined with bound=...rKz"A single constraint is not allowedz:TypeVar(name, constraint, ...): constraints must be types.c3s|]}t|��VqdS)N)r})�.0r�)r�rCrD�	<genexpr>sz#TypeVar.__init__.<locals>.<genexpr>zBound must be a type.)
rTr^rA�
ValueError�boolr�r�rPrkrnr�r}r�)r[rWr�r�r�Zconstraints)rZ)r�rDr^�s 

zTypeVar.__init__cCs||kr|j|�dS)N)�append)r[rbrCrCrDrcszTypeVar._get_type_varscCs&|jrd}n|jrd}nd}||jS)N�+�-�~)r�r�rA)r[�prefixrCrCrDrf
szTypeVar.__repr__cCstd��dS)Nz0Type variables cannot be used with isinstance().)rP)r[�instancerCrCrDr�szTypeVar.__instancecheck__cCstd��dS)Nz0Type variables cannot be used with issubclass().)rP)r[rVrCrCrDr�szTypeVar.__subclasscheck__)rAr�r�r�r�)rArdr@rgrqr^rcrfr�r�rirCrC)rZrDr�s(	�T�KT�VT�T_co)r��V_co�VT_co�T_contra)r�cCsd|dkrg}t|d�r0t|ttf�r0|j||�St|t�r`x$t|�D]\}}||krD||SqDW|S)z�An internal helper function: replace arg if it is a type variable
    found in tvars with corresponding substitution from args or
    with corresponding substitution sub-tree if arg is a generic type.
    N�
_subs_tree)�hasattrrlrrHr�r�	enumerate)r{rbr\�iZtvarrCrCrD�_replace_arg)s
r�c	Cs�|jdkr|S|j}g}x|jdk	r6|j|�|j}qWg}x |jD]}|jt|||��qDWx8|D]0}g}x"|jD]}|jt||j|��qtW|}qdW|S)a�An internal helper function: calculate substitution tree
    for generic cls after replacing its type parameters with
    substitutions in tvars -> args (if any).
    Repeat the same following __origin__'s.

    Return a list of arguments with all possible substitutions
    performed. Arguments that are generic classes themselves are represented
    as tuples (so that no new classes are created by this function).
    For example: _subs_tree(List[Tuple[int, T]][str]) == [(Tuple, int, str)]
    N)r�r��__args__r��__parameters__)	rVrbr\ZcurrentZ
orig_chain�	tree_argsr{ZoclsZ
new_tree_argsrCrCrDr�Ds 



r�cs*g}xn|D]f}t|t�r0|jtkr0|j|j�q
t|t�rft|�dkrf|dtkrf|j|dd��q
|j|�q
Wt	|��t��t|�kr�g}x(|D] }|�kr�|j|��j
|�q�W|}�s�t���t	|��x>|D]6�t�t�s�q�t
�fdd���hD��rڈj
��q�Wt�fdd�|D��S)z�An internal helper for Union creation and substitution: flatten Union's
    among parameters, then remove duplicates and strict subclasses.
    rrKNc3s6|].}t|t�o|jdk	st|t�o,t�|�VqdS)N)rlrr�ror�)r�Zt2)�t1rCrDr��s
z'_remove_dups_flatten.<locals>.<genexpr>c3s|]}|�kr|VqdS)NrC)r�r�)�
all_paramsrCrDr��s)rlr�r�r�extendr�rnrkr��set�remover�ro�any)�
parameters�params�pZ
new_paramsr�rC)r�r�rD�_remove_dups_flattenes0
"



r�cCsX|jstdt|���t|�}t|j�}||krTtd||kr@dndt|�||f��dS)Nz%s is not a generic classz0Too %s parameters for %s; actual %s, expected %sZmanyZfew)r�rPr�rk)rVr�ZalenZelenrCrCrD�_check_generic�s
r�cs4tj����tj�j�tj����fdd��}|S)zInternal wrapper caching __getitem__ of generic types with a fallback to
    original function for non-hashable arguments.
    cs*y
�||�Stk
rYnX�||�S)N)rP)r\r])�cached�funcrCrD�inner�s

z_tp_cache.<locals>.inner)�	functools�	lru_cache�	_cleanupsr��cache_clear�wraps)r�r�rC)r�r�rD�	_tp_cache�sr�cs�eZdZdZdZd dd��fd	d
�Zdd�Zd
d�Z�fdd�Z�fdd�Z	e
dd��Zd!dd�Zdd�Z
dd�Zdd�Zdd�Z�ZS)"r�a�Union type; Union[X, Y] means either X or Y.

    To define a union, use e.g. Union[int, str].  Details:

    - The arguments must be types and there must be at least one.

    - None as an argument is a special case and is replaced by
      type(None).

    - Unions of unions are flattened, e.g.::

        Union[Union[int, str], float] == Union[int, str, float]

    - Unions of a single argument vanish, e.g.::

        Union[int] == int  # The constructor actually returns int

    - Redundant arguments are skipped, e.g.::

        Union[int, str, int] == Union[int, str]

    - When comparing unions, the argument order is ignored, e.g.::

        Union[int, str] == Union[str, int]

    - When two arguments have a subclass relationship, the least
      derived argument is kept, e.g.::

        class Employee: pass
        class Manager(Employee): pass
        Union[int, Employee, Manager] == Union[int, Employee]
        Union[Manager, int, Employee] == Union[int, Employee]
        Union[Employee, Manager] == Employee

    - Similar for object::

        Union[int, object] == object

    - You cannot subclass or instantiate a union.

    - You can use Optional[X] as a shorthand for Union[X, None].
    r�r�r��
__tree_hash__NF)rOcs�t�j|||f|�d|i�}|dkrHd|_d|_d|_ttd��|_|St|t	�sZt
d��|tkr~t|�}t
|�dkr~|dSt|�|_||_||_|j�}t|t	�r�tt|��|_n
t|�|_|S)NrOrzExpected parameters=<tuple>rKr)r)rTrUr�r�r�r��	frozensetr�rlrnrPrr�rkr�r�)rVr��originrOr\r[Z	subs_tree)rZrCrDrU�s*



z_Union.__new__cs^|jdkr|St��fdd�|jD��}t|j���}||jkrN||jkrN|S|j||dd�S)Nc3s|]}t|���VqdS)N)ra)r�r�)r_r`rCrDr��sz$_Union._eval_type.<locals>.<genexpr>T)rO)r�rnrar�rZ)r[r_r`�ev_args�	ev_originrC)r_r`rDra�s
z_Union._eval_typecCs|jr|jrt|j|�dS)N)r�r�rc)r[rbrCrCrDrcsz_Union._get_type_varscs<|jdkrt�j�S|j�}t|t�s.t|�S|dj|�S)Nr)r�rTrfr�rlrnr��
_tree_repr)r[�tree)rZrCrDrfs


z_Union.__repr__cs`g}xB|dd�D]2}t|t�s0|jt|��q|j|dj|��qWt�j�ddj|�S)NrKrz[%s]z, )rlrnr�rSr�rTrfrQ)r[r��arg_listr{)rZrCrDr�
s
z_Union._tree_reprcsl|fkrtd��t|t�s |f}|jdkr0d�nd�t�fdd�|D��}|tk	r\t||�|j||dd�S)Nz Cannot take a Union of no types.z)Union[arg, ...]: each arg must be a type.z*Parameters to generic types must be types.c3s|]}t|��VqdS)N)r})r�r�)r�rCrDr� sz%_Union.__getitem__.<locals>.<genexpr>T)r�rO)rPrlrnr�rr�rZ)r[r�rC)r�rDr�s


z_Union.__getitem__cCs>|tkrtSt|||�}t|�}t|�dkr4|dStf|S)NrKr)rr�r�rk)r[rbr\r�rCrCrDr�%sz_Union._subs_treecCs6t|t�r|j|jkS|tk	r*|j�|kS||kSdS)N)rlr�r�rr�)r[rrCrCrDr�.s

z
_Union.__eq__cCs|jS)N)r�)r[rCrCrDr�6sz_Union.__hash__cCstd��dS)Nz(Unions cannot be used with isinstance().)rP)r[r�rCrCrDr�9sz_Union.__instancecheck__cCstd��dS)Nz(Unions cannot be used with issubclass().)rP)r[rVrCrCrDr�<sz_Union.__subclasscheck__)r�r�r�r�)NN)NN)rArdr@rgrqrUrarcrfr�r�r�r�r�r�r�r�rirCrC)rZrDr��s*
	
	r�c@s eZdZdZfZedd��ZdS)r�zEOptional type.

    Optional[X] is equivalent to Union[X, None].
    cCst|d�}t|td�fS)Nz#Optional[t] requires a single type.)r}rro)r[r{rCrCrDr�Ks
z_Optional.__getitem__N)rArdr@rgrqr�r�rCrCrCrDr�Csr�cCsJt}x@t|jdd��D]*\}}t|t�r|jtkr|j|d}qW|S)z�Helper for Generic.__new__.

    Returns the class after the last occurrence of Generic or
    Generic[...] in cls.__mro__.
    NrK���)�objectr��__mro__rlrr�r
)rVZnext_in_mror��crCrCrD�_next_in_mroTs
r�cs,t�jtj�r�fdd�}n�fdd�}|S)z�Construct a __subclasshook__ callable that incorporates
    the associated __extra__ class in subclass checks performed
    against cls.
    csZ�jj|�}|tk	r|S�j|jkr(dSx,�jj�D]}t|t�rDq4t||�r4dSq4WtS)NT)�	__extra__�__subclasshook__r~r��__subclasses__rlrr�)�subclass�res�scls)rVrCrD�
__extrahook__ks

z)_make_subclasshook.<locals>.__extrahook__cs�jrt|�j�rdStS)NT)r�r�r~)r�)rVrCrDr�ys)rlr��abc�ABCMeta)rVr�rC)rVrD�_make_subclasshookbsr�cCs2t|�}d|kr.x|dD]}|j|d�qW|S)z�Internal helper: copy class __dict__ and clean slots class variables.
    (They will be re-created if necessary by normal class machinery.)
    rqN)�dict�pop)ZdctZ	dict_copyZslotrCrCrD�_no_slots_copy�s
r�cs�eZdZdZd!�fdd�	Zedd��Zejdd��Zedd	��Zejd
d	��Zdd�Z	d
d�Z
�fdd�Z�fdd�Zd"dd�Z
dd�Zdd�Zedd��Z�fdd�Zdd�Z�fdd �Z�ZS)#racMetaclass for generic types.

    This is a metaclass for typing.Generic and generic ABCs defined in
    typing module. User defined subclasses of GenericMeta can override
    __new__ and invoke super().__new__. Note that GenericMeta.__new__
    has strict rules on what is allowed in its bases argument:
    * plain Generic is disallowed in bases;
    * Generic[...] should appear in bases at most once;
    * if Generic[...] is present, then it should list all type variables
      that appear in other bases.
    In addition, type of all generic bases is erased, e.g., C[int] is
    stripped to plain C.
    Nc	s�|dk	r0|dk	st�tdd�|D��s.t|��n�|dks@t|��|dksPt|��|dks`t|��t|�}d}	xF|D]>}
|
tkr�td��t|
t�rr|
jtkrr|	dk	r�td��|
j}	qrW|	dkr�|}	nRt	|�}t	|	��|�k�stddj
�fdd�|D��dj
d	d�|	D��f��|	}|}|dk	�rFt|�tj
k�rF||k�rF|f|}td
d�|D��}tdd�|D���r~tdd�|D��}|j|||�s�dn|jd
��t�j||||dd�}
tt|
�jd|�s�|
n|j�||
_|�r�tdd�|D��nd|
_t|
�|
_|dk�r||
_d|k�r|�s2t|
jdd�dk�r<t|
�|
_t|tj
��r\|j|
_|j|
_n|dk	�rv|j|
_|j|
_|�r�t|d��r�|j|
_|�r�t |
j!��ntt|
�j"�|
_#|
S)z�Create a new generic class. GenericMeta.__new__ accepts
        keyword arguments that are used for internal bookkeeping, therefore
        an override should pass unused keyword arguments to super().
        Ncss|]}t|t�VqdS)N)rlr)r�r�rCrCrDr��sz&GenericMeta.__new__.<locals>.<genexpr>z!Cannot inherit from plain Genericz0Cannot inherit from Generic[...] multiple types.z6Some type variables (%s) are not listed in Generic[%s]z, c3s|]}|�krt|�VqdS)N)rm)r�r�)�gvarsetrCrDr��scss|]}t|�VqdS)N)rm)r��grCrCrDr��scss"|]}t|t�r|jn|VqdS)N)rlrr�)r��brCrCrDr��scss |]}t|t�o|tk	VqdS)N)rlrr
)r�r�rCrCrDr��scss|]}|tk	r|VqdS)N)r
)r�r�rCrCrDr��s)r�r�r�T)rOr�css*|]"}|tkrdn|tkrfn|VqdS).N)�_TypingEllipsis�_TypingEmpty)r��arCrCrDr��sr�rA�r�r@)$r��allr�r
rPrlrr�r�r�rQror�r�rnr��updater�rTrU�__setattr__r�r��__next_in_mro__�__orig_bases__r�r�r��
_abc_registry�
_abc_cacher�r@r�r�r�r�)rVrWrXrYrbr\r��extra�
orig_basesZgvars�baseZtvarsetZ
initial_basesr[)rZ)r�rDrU�sr




$





zGenericMeta.__new__cCst|jtj�r|jjS|jjS)N)rlr�r�r��_abc_negative_cacher��_abc_generic_negative_cache)r[rCrCrDr��szGenericMeta._abc_negative_cachecCs,|jdkr(t|jtj�r"||j_n||_dS)N)r�rlr�r�r�r�r�)r[�valuerCrCrDr�s

cCst|jtj�r|jjS|jjS)N)rlr�r�r��_abc_negative_cache_versionr��#_abc_generic_negative_cache_version)r[rCrCrDr�	sz'GenericMeta._abc_negative_cache_versioncCs,|jdkr(t|jtj�r"||j_n||_dS)N)r�rlr�r�r�r�r)r[r�rCrCrDr�s

cCs|jr|jrt|j|�dS)N)r�r�rc)r[rbrCrCrDrcszGenericMeta._get_type_varsc
s�|jr|jj���nd}|jr8t��fdd�|jD��nd}||jkrT||jkrT|S|j|j|jt|j�|rtt	|�nd|||j
|jd�S)Nc3s|]}t|���VqdS)N)ra)r�r�)r_r`rCrDr�sz)GenericMeta._eval_type.<locals>.<genexpr>)rbr\r�r�r�)r�rar�rnrZrA�	__bases__r��__dict__r�r�r�)r[r_r`r�r�rC)r_r`rDras$zGenericMeta._eval_typecs"|jdkrt�j�S|j|j��S)N)r�rTrfr�r�)r[)rZrCrDrf+s

zGenericMeta.__repr__cstg}xV|dd�D]F}|fkr*|jd�qt|t�sD|jt|��q|j|dj|��qWt�j�ddj|�S)NrKz()rz[%s]z, )r�rlrnrSr�rTrfrQ)r[r�r�r{)rZrCrDr�0s
zGenericMeta._tree_reprcCs*|jdkr|St|||�}|jft|�S)N)r�r�r�rn)r[rbr\r�rCrCrDr�;s
zGenericMeta._subs_treecCs6t|t�stS|jdks"|jdkr*||kS|j|jkS)N)rlrr~r�r�)r[rrCrCrDr�As

zGenericMeta.__eq__cCs|jS)N)r�)r[rCrCrDr�HszGenericMeta.__hash__c
s6t|t�s|f}|r0|jtk	r0tdt|���d�t�fdd�|D��}|tkr�tdd�|D��sltd��tt	|��t|�kr�td��|}|}nb|tt
fkr�t|�}|}nH|tkr�|}|}n6|j
ttfkr�tdt|���nt||�t|�}|}|j
dk�r|fnf}|j|j||jt|j�||||j|jd	�S)
Nz)Parameter list to %s[...] cannot be emptyz*Parameters to generic types must be types.c3s|]}t|��VqdS)N)r})r�r�)r�rCrDr�Ssz*GenericMeta.__getitem__.<locals>.<genexpr>css|]}t|t�VqdS)N)rlr)r�r�rCrCrDr�Vsz5Parameters to Generic[...] must all be type variablesz-Parameters to Generic[...] must all be uniquez'Cannot subscript already-subscripted %s)rbr\r�r�r�)rlrnr�rrPrEr
r�rkr�rr�r�r�r�r�rZrArr�rr�r�)r[r�rbr\ZprependrC)r�rDr�KsJ

zGenericMeta.__getitem__csJ|jdk	r*tjd�jddkr&td��dS|tkr>td|��t�j|�S)	NrKrAr�r�zCParameterized generics cannot be used with class or instance checksFz5Class %r cannot be used with class or instance checks)r�r�)r�r>�	_getframe�	f_globalsrPr
rTr�)r[rV)rZrCrDr�ys
zGenericMeta.__subclasscheck__cCst|j|�S)N)r�rZ)r[r�rCrCrDr��szGenericMeta.__instancecheck__csT|jd�r|jd�s(|jd�s(|jdkr<tt|�j||�ntt|j�j||�dS)N�__�_abc_)rL�endswithr�rTrr�)r[�attrr�)rZrCrDr��s


zGenericMeta.__setattr__)NNNNN)NN)rArdr@rgrU�propertyr��setterr�rcrarfr�r�r�r�r�r�r�r�r�rirCrC)rZrDr�s"
`
.cOs�|jdkr@|jtjkr,|jtjk	r,|j|�S|j|f|�|�Snl|j}|jtjkrj|jtjk	rj|j|�}n|j|f|�|�}y
||_Wntk
r�YnX|j||�|SdS)N)r�rUr�r^r�Z__orig_class__�AttributeError)Zbase_clsrVr\r]r�r�rCrCrD�_generic_new�s 


rc@seZdZdZfZdd�ZdS)r
aCAbstract base class for generic types.

    A generic type is typically declared by inheriting from
    this class parameterized with one or more type variables.
    For example, a generic mapping type might be defined as::

      class Mapping(Generic[KT, VT]):
          def __getitem__(self, key: KT) -> VT:
              ...
          # Etc.

    This class can then be used as follows::

      def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
          try:
              return mapping[key]
          except KeyError:
              return default
    cOs&|jtkrtd��t|j|f|�|�S)NzHType Generic cannot be instantiated; it can be used only as a base class)r�r
rPrr�)rVr\r]rCrCrDrU�s
zGeneric.__new__N)rArdr@rgrqrUrCrCrCrDr
�s)rrc@seZdZdZdS)r�z�Internal placeholder for () or []. Used by TupleMeta and CallableMeta
    to allow empty list/tuple in specific places, without allowing them
    to sneak in where prohibited.
    N)rArdr@rgrCrCrCrDr��sr�c@seZdZdZdS)r�z(Internal placeholder for ... (ellipsis).N)rArdr@rgrCrCrCrDr��sr�cs4eZdZdZe�fdd��Zdd�Zdd�Z�ZS)�	TupleMetazMetaclass for Tuple (internal).cs�|jdk	s|jtk	r t�j|�S|fkr6t�jtf�St|t�sF|f}t|�dkr�|ddkr�d�t	|d��}t�j|t
f�Sd�t�fdd�|D��}t�j|�S)	NrrK.z Tuple[t, ...]: t must be a type.rz*Tuple[t0, t1, ...]: each t must be a type.c3s|]}t|��VqdS)N)r})r�r�)r�rCrDr��sz(TupleMeta.__getitem__.<locals>.<genexpr>)r�r�rrTr�r�rlrnrkr}r�)r[r�r�)rZ)r�rDr��s
zTupleMeta.__getitem__cCs |jdkrt|t�Std��dS)Nz5Parameterized Tuple cannot be used with isinstance().)r�rlrnrP)r[r�rCrCrDr��s

zTupleMeta.__instancecheck__cCs |jdkrt|t�Std��dS)Nz5Parameterized Tuple cannot be used with issubclass().)r�r�rnrP)r[rVrCrCrDr��s

zTupleMeta.__subclasscheck__)	rArdr@rgr�r�r�r�rirCrC)rZrDr
�sr
c@seZdZdZfZdd�ZdS)ra@Tuple type; Tuple[X, Y] is the cross-product type of X and Y.

    Example: Tuple[T1, T2] is a tuple of two elements corresponding
    to type variables T1 and T2.  Tuple[int, float, str] is a tuple
    of an int, a float and a string.

    To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
    cOs$|jtkrtd��tt|f|�|�S)Nz6Type Tuple cannot be instantiated; use tuple() instead)r�rrPrrn)rVr\r]rCrCrDrUs
z
Tuple.__new__N)rArdr@rgrqrUrCrCrCrDr�s)r�rrcsHeZdZdZ�fdd�Z�fdd�Z�fdd�Ze�fdd	��Z�Z	S)
�CallableMetaz"Metaclass for Callable (internal).cs"|jdkrt�j�S|j|j��S)N)r�rTrfr�r�)r[)rZrCrDrfs

zCallableMeta.__repr__cs�|jtk	rt�j|�Sg}xB|dd�D]2}t|t�sF|jt|��q(|j|dj|��q(W|ddkr�t|d�d|dSt|d�ddj	|dd��|dfS)	NrKrz...z	[..., %s]z
[[%s], %s]z, r�r�)
r�rrTr�rlrnr�rSr�rQ)r[r�r�r{)rZrCrDr�s


zCallableMeta._tree_reprcs�|jdk	s|jtk	r t�j|�St|t�s8t|�dkr@td��|\}}|t	krZt	|f}n$t|t
�srtd|f��t|�|f}|j|�S)zxA thin wrapper around __getitem_inner__ to provide the latter
        with hashable arguments to improve speed.
        Nrz6Callable must be used as Callable[[arg, ...], result].z8Callable[args, result]: args must be a list. Got %.100r.)r�r�rrTr�rlrnrkrP�Ellipsis�list�__getitem_inner__)r[r�r\�result)rZrCrDr�*s


zCallableMeta.__getitem__cs^|\}}d�t|��}|tkr.t�jt|f�Sd�t�fdd�|D��}||f}t�j|�S)Nz.Callable[args, result]: result must be a type.z6Callable[[arg, ...], result]: each arg must be a type.c3s|]}t|��VqdS)N)r})r�r{)r�rCrDr�Fsz1CallableMeta.__getitem_inner__.<locals>.<genexpr>)r}rrTr�r�rn)r[r�r\r)rZ)r�rDr>s

zCallableMeta.__getitem_inner__)
rArdr@rgrfr�r�r�rrirCrC)rZrDrs
rc@seZdZdZfZdd�ZdS)ra�Callable type; Callable[[int], str] is a function of (int) -> str.

    The subscription syntax must always be used with exactly two
    values: the argument list and the return type.  The argument list
    must be a list of types or ellipsis; the return type must be a single type.

    There is no syntax to indicate optional or keyword arguments,
    such function types are rarely used as callback types.
    cOs&|jtkrtd��t|j|f|�|�S)NzIType Callable cannot be instantiated; use a non-abstract subclass instead)r�rrPrr�)rVr\r]rCrCrDrUXs
zCallable.__new__N)rArdr@rgrqrUrCrCrCrDrKs	csNeZdZdZdZddd�Zdd�Zdd	�Z�fd
d�Zdd
�Z	dd�Z
�ZS)r�a3Special type construct to mark class variables.

    An annotation wrapped in ClassVar indicates that a given
    attribute is intended to be used as a class variable and
    should not be set on instances of that class. Usage::

      class Starship:
          stats: ClassVar[Dict[str, int]] = {} # class variable
          damage: int = 10                     # instance variable

    ClassVar accepts only types and cannot be further subscribed.

    Note that ClassVar is not a class itself, and should not
    be used with isinstance() or issubclass().
    �__type__NcKs
||_dS)N)r)r[�tpr]rCrCrDr^rsz_ClassVar.__init__cCsPt|�}|jdkr4|t|dj|jdd���dd�Stdj|jdd����dS)Nz{} accepts only single type.rKT)rOz {} cannot be further subscripted)rorr}�formatrArP)r[�itemrVrCrCrDr�us
z_ClassVar.__getitem__cCs,t|j||�}||jkr|St|�|dd�S)NT)rO)rarro)r[r_r`Znew_tprCrCrDra~s
z_ClassVar._eval_typecs,t�j�}|jdk	r(|djt|j��7}|S)Nz[{}])rTrfrrrS)r[�r)rZrCrDrf�s

z_ClassVar.__repr__cCstt|�j|jf�S)N)r�rorAr)r[rCrCrDr��sz_ClassVar.__hash__cCs,t|t�stS|jdk	r$|j|jkS||kS)N)rlr�r~r)r[rrCrCrDr��s


z_ClassVar.__eq__)r)N)rArdr@rgrqr^r�rarfr�r�rirCrC)rZrDr�_s
	r�cCs|S)z�Cast a value to a type.

    This returns the value unchanged.  To the type checker this
    signals that the return value has the designated type, but at
    runtime we intentionally don't check anything (we want this
    to be as fast as possible).
    rC)�typ�valrCrCrDr6�sc
Cs�y
|j}Wntk
riSX|j}|j}|d|�}|jp@f}|j}|rTt|�ni}|t|�}x2t||d�|�D]\}}	||ks�t	�|	||<qxW|S)z:Internal helper to extract the default arguments, by name.N)
�__code__r�co_argcount�co_varnames�__defaults__�__kwdefaults__r�rk�zipr�)
r�r|Z	pos_countZ	arg_names�defaultsZ
kwdefaultsr�Z
pos_offsetrWr�rCrCrD�
_get_defaults�s

r!c
Cs�t|dd�riSt|t�r�i}x�t|j�D]z}|dkrFtj|jj}n|}|jj	di�}xJ|j
�D]>\}}|dkrztd�}t|t�r�t|�}t
|||�}|||<qbWq*W|S|dkr�t|tj�r�|j}nt|di�}|dkr�|}n|dkr�|}t|dd�}|dk�r"t|t��riStdj|���t|�}	t|�}xp|j
�D]d\}}|dk�rVtd�}t|t��rjt|�}t
|||�}||	k�r�|	|dk�r�t|}|||<�q<W|S)a�Return type hints for an object.

    This is often the same as obj.__annotations__, but it handles
    forward references encoded as string literals, and if necessary
    adds Optional[t] if a default value equal to None is set.

    The argument may be a module, class, method, or function. The annotations
    are returned as a dictionary. For classes, annotations include also
    inherited members.

    TypeError is raised if the argument is not of a type that can contain
    annotations, and an empty dictionary is returned if no annotations are
    present.

    BEWARE -- the behavior of globalns and localns is counterintuitive
    (unless you are familiar with how eval() and exec() work).  The
    search order is locals first, then globals.

    - If no dict arguments are passed, an attempt is made to use the
      globals from obj (or the respective module's globals for classes),
      and these are also used as the locals.  If the object does not appear
      to have globals, an empty dictionary is used.

    - If one dict argument is passed, it is used for both globals and
      locals.

    - If two dict arguments are passed, they specify globals and
      locals, respectively.
    �__no_type_check__N�__annotations__�__globals__z1{!r} is not a module, class, method, or function.)r�rlro�reversedr�r>�modulesrdr�get�itemsrmrGrar��
ModuleType�_allowed_typesrPrr!r�r)
r�r_r`Zhintsr�Zbase_globalsZannrWr�r rCrCrDr7�sV



cCs�t|t�r||jj�}x0|jj�D]"\}}||j|fkr |j|�q Wx4|j�D](}t|tj	�rfd|_
t|t�rPt|�qPWy
d|_
Wntk
r�YnX|S)aIDecorator to indicate that annotations are not type hints.

    The argument must be a class or function; if it is a class, it
    applies recursively to all methods and classes defined in that class
    (but not to methods defined in its superclasses or subclasses).

    This mutates the function(s) or class(es) in place.
    T)
rlror�copyr(rr��valuesr�r�r"r9rP)r{Z	arg_attrsrrr�rCrCrDr9s	



cstj���fdd��}|S)z�Decorator to give another decorator the @no_type_check effect.

    This wraps the decorator with something that wraps the decorated
    function in @no_type_check.
    cs�||�}t|�}|S)N)r9)r\r]r�)�	decoratorrCrD�wrapped_decorator/s
z2no_type_check_decorator.<locals>.wrapped_decorator)r�r�)r-r.rC)r-rDr:(scOstd��dS)z*Helper for @overload to raise when called.z�You should not call an overloaded function. A series of @overload-decorated functions outside a stub module should always be followed by an implementation that is not @overload-ed.N)�NotImplementedError)r\r]rCrCrD�_overload_dummy8sr0cCstS)a
Decorator for overloaded functions/methods.

    In a stub file, place two or more stub definitions for the same
    function in a row, each decorated with @overload.  For example:

      @overload
      def utf8(value: None) -> None: ...
      @overload
      def utf8(value: bytes) -> bytes: ...
      @overload
      def utf8(value: str) -> bytes: ...

    In a non-stub file (i.e. a regular .py file), do the same but
    follow it with an implementation.  The implementation should *not*
    be decorated with @overload.  For example:

      @overload
      def utf8(value: None) -> None: ...
      @overload
      def utf8(value: bytes) -> bytes: ...
      @overload
      def utf8(value: str) -> bytes: ...
      def utf8(value):
          # implementation goes here
    )r0)r�rCrCrDr;Ascs0eZdZdZ�fdd�Zdd�Zdd�Z�ZS)�
_ProtocolMetaz~Internal metaclass for _Protocol.

    This exists so _Protocol classes can be generic without deriving
    from Generic.
    cs"t|jkrt�j|�Std��dS)Nz+Protocols cannot be used with isinstance().)r�rrTr�rP)r[r�)rZrCrDr�es
z_ProtocolMeta.__instancecheck__csL|js
tS|tkrdS|j�}x(|D] �t�fdd�|jD��s$dSq$WdS)NTc3s|]}�|jkVqdS)N)r)r��d)rrCrDr�wsz2_ProtocolMeta.__subclasscheck__.<locals>.<genexpr>F)rhr~r��_get_protocol_attrsr�r�)r[rV�attrsrC)rrDr�js
z_ProtocolMeta.__subclasscheck__cCs,g}x.|jD]$}t|dd�r|jdkr|j|�qWt�}�x�|D�]�}x�|jj�D]�}x�|jD]&}||k	r`||jkr`t|dd�r`Pq`W|jd�rT|dkrT|dkrT|dkrT|dkrT|dkrT|d	krT|d
krT|dkrT|dkrT|d
krT|dkrT|dkrT|dkrT|dkrT|dkrT|dkrT|j|�qTWqBW|S)NrhFr�r�__abstractmethods__r#rjr�rr�rqr3r�r�r�r�r�r�rd)	r�r�rAr�r�r�keysrL�add)r[Zprotocol_basesr�r4r�rrCrCrDr3{s<z!_ProtocolMeta._get_protocol_attrs)rArdr@rgr�r�r3rirCrC)rZrDr1^sr1c@seZdZdZfZdZdS)r�z�Internal base class for protocol classes.

    This implements a simple-minded structural issubclass check
    (similar but more general than the one-offs in collections.abc
    such as Hashable).
    TN)rArdr@rgrqrhrCrCrCrDr��sr��	Awaitablec@seZdZfZdS)r8N)rArdr@rqrCrCrCrDr8�s)r��	Coroutinec@seZdZfZdS)r9N)rArdr@rqrCrCrCrDr9�s�
AsyncIterablec@seZdZfZdS)r:N)rArdr@rqrCrCrCrDr:�sc@seZdZfZdS)�
AsyncIteratorN)rArdr@rqrCrCrCrDr;�sr;c@seZdZfZdS)rN)rArdr@rqrCrCrCrDr�sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr�sc@s"eZdZfZeed�dd��ZdS)r*)�returncCsdS)NrC)r[rCrCrD�__int__�szSupportsInt.__int__N)rArdr@rqr�intr=rCrCrCrDr*�sc@s"eZdZfZeed�dd��ZdS)r))r<cCsdS)NrC)r[rCrCrD�	__float__�szSupportsFloat.__float__N)rArdr@rqr�floatr?rCrCrCrDr)�sc@s"eZdZfZeed�dd��ZdS)r()r<cCsdS)NrC)r[rCrCrD�__complex__�szSupportsComplex.__complex__N)rArdr@rqr�complexrArCrCrCrDr(�sc@s"eZdZfZeed�dd��ZdS)r')r<cCsdS)NrC)r[rCrCrD�	__bytes__�szSupportsBytes.__bytes__N)rArdr@rqr�bytesrCrCrCrCrDr'�sc@s"eZdZfZeed�dd��ZdS)r&)r<cCsdS)NrC)r[rCrCrD�__abs__�szSupportsAbs.__abs__N)rArdr@rqrr�rErCrCrCrDr&�sc@s&eZdZfZedeed�dd��ZdS)r+r)�ndigitsr<cCsdS)NrC)r[rFrCrCrD�	__round__szSupportsRound.__round__N)r)rArdr@rqrr>r�rGrCrCrCrDr+sc@seZdZfZdS)r%N)rArdr@rqrCrCrCrDr%
sc@s"eZdZfZedd�dd��ZdS)r%zIterator[T_co])r<cCsdS)NrC)r[rCrCrD�__reversed__szReversible.__reversed__N)rArdr@rqrrHrCrCrCrDr%
sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDrs�
Collectionc@seZdZfZdS)rIN)rArdr@rqrCrCrCrDrIsc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr'sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr+sc@seZdZfZdS)r!N)rArdr@rqrCrCrCrDr!0sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr6sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr:sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr?sc@seZdZfZdS)r"N)rArdr@rqrCrCrCrDr"Esc@seZdZfZdS)r"N)rArdr@rqrCrCrCrDr"Isc@seZdZfZdS)r"N)rArdr@rqrCrCrCrDr"Msc@seZdZfZdS)r N)rArdr@rqrCrCrCrDr Rsc@seZdZfZdS)rN)rArdr@rqrCrCrCrDrVsc@seZdZfZdd�ZdS)r0cOs$|jtkrtd��tt|f|�|�S)Nz4Type List cannot be instantiated; use list() instead)r�r0rPrr)rVr\r]rCrCrDrU^s
zList.__new__N)rArdr@rqrUrCrCrCrDr0Zsc@seZdZfZdd�ZdS)r-cOs*|jtkrtj||�Sttj|f|�|�S)N)r�r-�collections�dequer)rVr\r]rCrCrDrUis
z
Deque.__new__N)rArdr@rqrUrCrCrCrDr-esc@seZdZfZdd�ZdS)r1cOs$|jtkrtd��tt|f|�|�S)Nz2Type Set cannot be instantiated; use set() instead)r�r1rPrr�)rVr\r]rCrCrDrUss
zSet.__new__N)rArdr@rqrUrCrCrCrDr1osc@seZdZfZdd�ZdS)r2cOs$|jtkrtd��tt|f|�|�S)Nz>Type FrozenSet cannot be instantiated; use frozenset() instead)r�r2rPrr�)rVr\r]rCrCrDrU}s
zFrozenSet.__new__N)rArdr@rqrUrCrCrCrDr2zsc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr�sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr�sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr�sc@seZdZfZdS)r$N)rArdr@rqrCrCrCrDr$�s�AbstractContextManagerc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr�sc@s2eZdZfZdd�Zejdd��Zedd��Z	dS)rcCs|S)NrC)r[rCrCrD�	__enter__�szContextManager.__enter__cCsdS)NrC)r[�exc_type�	exc_value�	tracebackrCrCrD�__exit__�szContextManager.__exit__cCs8|tkr4tdd�|jD��r4tdd�|jD��r4dStS)Ncss|]}d|jkVqdS)rMN)r)r��BrCrCrDr��sz2ContextManager.__subclasshook__.<locals>.<genexpr>css|]}d|jkVqdS)rQN)r)r�rRrCrCrDr��sT)rr�r�r~)rV�CrCrCrDr��s
zContextManager.__subclasshook__N)
rArdr@rqrMr�rrQ�classmethodr�rCrCrCrDr�s�AbstractAsyncContextManagerc@seZdZfZdS)�AsyncContextManagerN)rArdr@rqrCrCrCrDrV�srV�a�
class AsyncContextManager(Generic[T_co]):
    __slots__ = ()

    async def __aenter__(self):
        return self

    @abc.abstractmethod
    async def __aexit__(self, exc_type, exc_value, traceback):
        return None

    @classmethod
    def __subclasshook__(cls, C):
        if cls is AsyncContextManager:
            if sys.version_info[:2] >= (3, 6):
                return _collections_abc._check_methods(C, "__aenter__", "__aexit__")
            if (any("__aenter__" in B.__dict__ for B in C.__mro__) and
                    any("__aexit__" in B.__dict__ for B in C.__mro__)):
                return True
        return NotImplemented

__all__.append('AsyncContextManager')
c@seZdZfZdd�ZdS)r.cOs$|jtkrtd��tt|f|�|�S)Nz4Type Dict cannot be instantiated; use dict() instead)r�r.rPrr�)rVr\r]rCrCrDrU�s
zDict.__new__N)rArdr@rqrUrCrCrCrDr.�sc@seZdZfZdd�ZdS)r/cOs*|jtkrtj||�Sttj|f|�|�S)N)r�r/rJ�defaultdictr)rVr\r]rCrCrDrU�s
zDefaultDict.__new__N)rArdr@rqrUrCrCrCrDr/�sc@seZdZfZdd�ZdS)r,cOs*|jtkrtj||�Sttj|f|�|�S)N)r�r,rJr)rVr\r]rCrCrDrU�s
zCounter.__new__N)rArdr@rqrUrCrCrCrDr,�s�ChainMapc@seZdZfZdd�ZdS)rYcOs*|jtkrtj||�Sttj|f|�|�S)N)r�rYrJr)rVr\r]rCrCrDrU�s
zChainMap.__new__N)rArdr@rqrUrCrCrCrDrY�sc@seZdZfZdd�ZdS)r4cOs$|jtkrtd��tt|f|�|�S)Nz@Type Generator cannot be instantiated; create a subclass instead)r�r4rPr�_G_base)rVr\r]rCrCrDrUs
zGenerator.__new__N)rArdr@rqrUrCrCrCrDr4s�AsyncGeneratorc@seZdZfZdS)r[N)rArdr@rqrCrCrCrDr[s�CT_co)r�r�c@seZdZdZfZdS)ra�A special construct usable to annotate class objects.

    For example, suppose we have the following classes::

      class User: ...  # Abstract base for User classes
      class BasicUser(User): ...
      class ProUser(User): ...
      class TeamUser(User): ...

    And a function that takes a class argument that's a subclass of
    User and returns an instance of the corresponding class::

      U = TypeVar('U', bound=User)
      def new_user(user_class: Type[U]) -> U:
          user = user_class()
          # (Here we could write the user object to a database)
          return user

      joe = new_user(BasicUser)

    At this point the type checker knows that joe has type BasicUser.
    N)rArdr@rgrqrCrCrCrDr$scsvd��fdd�|D�}tj|dd�|D��}tj|�|_|_ytjd�jjdd�|_	Wnt
tfk
rpYnX|S)NzDNamedTuple('Name', [(f0, t0), (f1, t1), ...]); each t must be a typecsg|]\}}|t|��f�qSrC)r})r��nr�)r�rCrD�
<listcomp>Asz!_make_nmtuple.<locals>.<listcomp>cSsg|]\}}|�qSrCrC)r�r]r�rCrCrDr^BsrrA�__main__)rJ�
namedtuple�OrderedDictr#�_field_typesr>rrr'rdrr�)rWr��nm_tplrC)r�rD�
_make_nmtuple?srdrUr^rq�__getnewargs__�_fields�_field_defaultsrb�_make�_replace�_asdict�_sourcerdrAr@r#cseZdZ�fdd�Z�ZS)�NamedTupleMetacs|jdd�rt�j||||�Sts*td��|jdi�}t||j��}g}i}xP|D]H}||krz||}	|j|	�|	||<qR|rRtdj|dj	|j
��d���qRWtj|�|j_
t|�|j_||_xD|D]<}
|
tkr�td|
��q�|
tko�|
|jkr�t||
||
�q�W|S)	NrOFz<Class syntax for NamedTuple is only supported in Python 3.6+r#zXNon-default namedtuple field {field_name} cannot follow default field(s) {default_names}z, )�
field_nameZ
default_namesz&Cannot overwrite NamedTuple attribute )r'rTrU�_PY36rPrdr(r�rrQr6rJrar#rnrrg�_prohibitedr�_specialrf�setattr)rV�typenamerX�nsr�rcr Z
defaults_dictrmZ
default_value�key)rZrCrDrUYs4



zNamedTupleMeta.__new__)rArdr@rUrirCrC)rZrDrlWsrlc@seZdZdZdZddd�ZdS)r3a4Typed version of namedtuple.

    Usage in Python versions >= 3.6::

        class Employee(NamedTuple):
            name: str
            id: int

    This is equivalent to::

        Employee = collections.namedtuple('Employee', ['name', 'id'])

    The resulting class has extra __annotations__ and _field_types
    attributes, giving an ordered dict mapping field names to types.
    __annotations__ should be preferred, while _field_types
    is kept to maintain pre PEP 526 compatibility. (The field names
    are in the _fields attribute, which is part of the namedtuple
    API.) Alternative equivalent keyword syntax is also accepted::

        Employee = NamedTuple('Employee', name=str, id=int)

    In Python versions <= 3.5 use::

        Employee = NamedTuple('Employee', [('name', str), ('id', int)])
    TNcKs:|rtrtd��|dkr$|j�}n|r0td��t||�S)Nz>Keyword syntax for NamedTuple is only supported in Python 3.6+zIEither list of fields or keywords can be provided to NamedTuple, not both)rnrPr(rd)r[rrZfields�kwargsrCrCrDrU�s

zNamedTuple.__new__)N)rArdr@rgrOrUrCrCrCrDr3yscCsdd�}||_||_|S)a%NewType creates simple unique types with almost zero
    runtime overhead. NewType(name, tp) is considered a subtype of tp
    by static type checkers. At runtime, NewType(name, tp) returns
    a dummy function that simply returns its argument. Usage::

        UserId = NewType('UserId', int)

        def name_by_id(user_id: UserId) -> str:
            ...

        UserId('user')          # Fails type check

        name_by_id(42)          # Fails type check
        name_by_id(UserId(42))  # OK

        num = UserId(5) + 1     # type: int
    cSs|S)NrC)rBrCrCrD�new_type�szNewType.<locals>.new_type)rAZ
__supertype__)rWrrvrCrCrDr8�sFc@s�eZdZdZfZeed�dd��Zeed�dd��Ze	dd�dd	��Z
e	ed�d
d��Ze	e
d�dd
��Ze	dd�dd��Ze	ed�dd��Ze	d7e
ed�dd��Ze	ed�dd��Ze	d9e
ed�dd��Ze	d;e
eed�dd��Ze	d<e
e
e
d�d d!��Ze	ed�d"d#��Ze	e
d�d$d%��Ze	d=e
e
d&�d'd(��Ze	ed�d)d*��Ze	ee
d+�d,d-��Ze	eedd.�d/d0��Ze	d1d�d2d3��Ze	dd�d4d5��ZdS)>�IOa�Generic base class for TextIO and BinaryIO.

    This is an abstract, generic version of the return of open().

    NOTE: This does not distinguish between the different possible
    classes (text vs. binary, read vs. write vs. read/write,
    append-only, unbuffered).  The TextIO and BinaryIO subclasses
    below capture the distinctions between text vs. binary, which is
    pervasive in the interface; however we currently do not offer a
    way to track the other distinctions in the type system.
    )r<cCsdS)NrC)r[rCrCrD�mode�szIO.modecCsdS)NrC)r[rCrCrDrW�szIO.nameNcCsdS)NrC)r[rCrCrD�close�szIO.closecCsdS)NrC)r[rCrCrD�closed�sz	IO.closedcCsdS)NrC)r[rCrCrD�fileno�sz	IO.filenocCsdS)NrC)r[rCrCrD�flush�szIO.flushcCsdS)NrC)r[rCrCrD�isatty�sz	IO.isattyrK)r]r<cCsdS)NrC)r[r]rCrCrD�read�szIO.readcCsdS)NrC)r[rCrCrD�readable�szIO.readable)�limitr<cCsdS)NrC)r[r�rCrCrD�readline�szIO.readline)�hintr<cCsdS)NrC)r[r�rCrCrD�	readlines�szIO.readlinesr)�offset�whencer<cCsdS)NrC)r[r�r�rCrCrD�seek�szIO.seekcCsdS)NrC)r[rCrCrD�seekable	szIO.seekablecCsdS)NrC)r[rCrCrD�tell	szIO.tell)�sizer<cCsdS)NrC)r[r�rCrCrD�truncate	szIO.truncatecCsdS)NrC)r[rCrCrD�writable	szIO.writable)�sr<cCsdS)NrC)r[r�rCrCrD�write	szIO.write)�linesr<cCsdS)NrC)r[r�rCrCrD�
writelines	sz
IO.writelinesz
IO[AnyStr]cCsdS)NrC)r[rCrCrDrM	szIO.__enter__cCsdS)NrC)r[ror�rPrCrCrDrQ	szIO.__exit__r�)r�r�)r�r�)r�)r)N) rArdr@rgrqrrmrxrWrryr�rzr>r{r|r}r5r~rr�r0r�r�r�r�r�r�r�r�rMrQrCrCrCrDrw�sTrwc@sBeZdZdZfZeeeefe	d�dd��Z
edd�dd��ZdS)	�BinaryIOz5Typed version of the return of open() in binary mode.)r�r<cCsdS)NrC)r[r�rCrCrDr�)	szBinaryIO.write)r<cCsdS)NrC)r[rCrCrDrM-	szBinaryIO.__enter__N)rArdr@rgrqrrrD�	bytearrayr>r�rMrCrCrCrDr�$	sr�c@s�eZdZdZfZeed�dd��Zeed�dd��Z	ee
ed�dd��Zeed�d	d
��Z
eed�dd��Zedd�d
d��ZdS)�TextIOz3Typed version of the return of open() in text mode.)r<cCsdS)NrC)r[rCrCrD�buffer7	sz
TextIO.buffercCsdS)NrC)r[rCrCrD�encoding;	szTextIO.encodingcCsdS)NrC)r[rCrCrD�errors?	sz
TextIO.errorscCsdS)NrC)r[rCrCrD�line_bufferingC	szTextIO.line_bufferingcCsdS)NrC)r[rCrCrD�newlinesG	szTextIO.newlinescCsdS)NrC)r[rCrCrDrMK	szTextIO.__enter__N)rArdr@rgrqrr�r�rmr�rr�r�r�r
r�rrMrCrCrCrDr�2	sr�c@s&eZdZdZdddgZeZeZeZdS)�ioz)Wrapper namespace for IO generic classes.rwr�r�N)rArdr@rg�__all__rwr�r�rCrCrCrDr�P	s

r�z.io�Patternr�cCs|jS)N)�pattern)r�rCrCrD�<lambda>^	sr��MatchcCs|jjS)N)�rer�)�mrCrCrDr�`	sc@s eZdZdZddgZeZeZdS)r�z&Wrapper namespace for re type aliases.r�r�N)rArdr@rgr�r�r�rCrCrCrDr�c	sr�z.re)rr)NN)NN)rrW)rr)rUr^rqrerfrgrbrhrirjrk)rdrAr@r#)�r�rrrJ�
contextlibr�r�Z	stdlib_rer>r��collections.abcZcollections_abc�ImportErrorr?�_collections_abcrrr	ror�r^�__str__rmrQr�rErMrNrHrIrGrFrcr�rar}rSr�r
r�ZNoReturnrr�r�r�r�r�r�r�rDr5r�r�r�r�r�r�r�rr�rr�r�r�r�rr
rr�r�r
rnrrrr�rr6r!r��BuiltinFunctionType�
MethodTyper)r*r7r9r:r0r;r1r�rr�r8r�r9r:r;rrr*r)r(r'r&r+r%r#rrIr1rr!rrr"r r>rrr0rKr-r�r�r2rrrr$rLrrUrV�execr�r.rXr/r,rYr4rZ�
GeneratorTyper[r\rrdrnrorprlr3r8r<r=rwr�r�r�rAr&ryr��matchr�rCrCrCrD�<module>s�
*%5C

W
!)

"96


R	D








"









"





"(`	



_weakrefset.cpython-36.pyc000064400000017226150335715140011505 0ustar003


 \I�@s2ddlmZdgZGdd�d�ZGdd�d�ZdS)�)�ref�WeakSetc@s$eZdZdd�Zdd�Zdd�ZdS)�_IterationGuardcCst|�|_dS)N)r�
weakcontainer)�selfr�r�#/usr/lib64/python3.6/_weakrefset.py�__init__sz_IterationGuard.__init__cCs |j�}|dk	r|jj|�|S)N)r�
_iterating�add)r�wrrr�	__enter__sz_IterationGuard.__enter__cCs0|j�}|dk	r,|j}|j|�|s,|j�dS)N)rr
�remove�_commit_removals)r�e�t�br�srrr�__exit__s
z_IterationGuard.__exit__N)�__name__�
__module__�__qualname__r	r
rrrrrr
src@seZdZd>dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZeZd d!�Zd"d#�Zd$d%�ZeZd&d'�Zd(d)�Zd*d+�ZeZd,d-�Zd.d/�ZeZd0d1�Zd2d3�Zd4d5�Z e Z!d6d7�Z"d8d9�Z#d:d;�Z$e$Z%d<d=�Z&dS)?rNcCsBt�|_t|�fdd�}||_g|_t�|_|dk	r>|j|�dS)NcSs2|�}|dk	r.|jr"|jj|�n|jj|�dS)N)r
�_pending_removals�append�data�discard)�item�selfrefrrrr�_remove&s
z!WeakSet.__init__.<locals>._remove)�setrrrrr
�update)rrrrrrr	$szWeakSet.__init__cCs(|j}|jj}x|r"||j��qWdS)N)rrr�pop)r�lrrrrr4szWeakSet._commit_removalsc
cs<t|��*x"|jD]}|�}|dk	r|VqWWdQRXdS)N)rr)r�itemrefrrrr�__iter__:s

zWeakSet.__iter__cCst|j�t|j�S)N)�lenrr)rrrr�__len__CszWeakSet.__len__cCs,yt|�}Wntk
r dSX||jkS)NF)r�	TypeErrorr)rr�wrrrr�__contains__Fs
zWeakSet.__contains__cCs|jt|�ft|dd�fS)N�__dict__)�	__class__�list�getattr)rrrr�
__reduce__MszWeakSet.__reduce__cCs&|jr|j�|jjt||j��dS)N)rrrrrr)rrrrrrQszWeakSet.addcCs|jr|j�|jj�dS)N)rrr�clear)rrrrr/Vsz
WeakSet.clearcCs
|j|�S)N)r+)rrrr�copy[szWeakSet.copycCsV|jr|j�xBy|jj�}Wntk
r:td��YnX|�}|dk	r|SqWdS)Nzpop from empty WeakSet)rrrr!�KeyError)rr#rrrrr!^szWeakSet.popcCs"|jr|j�|jjt|��dS)N)rrrrr)rrrrrrjszWeakSet.removecCs"|jr|j�|jjt|��dS)N)rrrrr)rrrrrroszWeakSet.discardcCs*|jr|j�x|D]}|j|�qWdS)N)rrr)r�other�elementrrrr ts
zWeakSet.updatecCs|j|�|S)N)r )rr2rrr�__ior__zs
zWeakSet.__ior__cCs|j�}|j|�|S)N)r0�difference_update)rr2�newsetrrr�
difference~s
zWeakSet.differencecCs|j|�dS)N)�__isub__)rr2rrrr5�szWeakSet.difference_updatecCs<|jr|j�||kr"|jj�n|jjdd�|D��|S)Ncss|]}t|�VqdS)N)r)�.0rrrr�	<genexpr>�sz#WeakSet.__isub__.<locals>.<genexpr>)rrrr/r5)rr2rrrr8�szWeakSet.__isub__cs�j�fdd�|D��S)Nc3s|]}|�kr|VqdS)Nr)r9r)rrrr:�sz'WeakSet.intersection.<locals>.<genexpr>)r+)rr2r)rr�intersection�szWeakSet.intersectioncCs|j|�dS)N)�__iand__)rr2rrr�intersection_update�szWeakSet.intersection_updatecCs(|jr|j�|jjdd�|D��|S)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz#WeakSet.__iand__.<locals>.<genexpr>)rrrr=)rr2rrrr<�szWeakSet.__iand__cCs|jjdd�|D��S)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz#WeakSet.issubset.<locals>.<genexpr>)r�issubset)rr2rrrr>�szWeakSet.issubsetcCs|jtdd�|D��kS)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz!WeakSet.__lt__.<locals>.<genexpr>)rr)rr2rrr�__lt__�szWeakSet.__lt__cCs|jjdd�|D��S)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz%WeakSet.issuperset.<locals>.<genexpr>)r�
issuperset)rr2rrrr@�szWeakSet.issupersetcCs|jtdd�|D��kS)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz!WeakSet.__gt__.<locals>.<genexpr>)rr)rr2rrr�__gt__�szWeakSet.__gt__cCs(t||j�stS|jtdd�|D��kS)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz!WeakSet.__eq__.<locals>.<genexpr>)�
isinstancer+�NotImplementedrr)rr2rrr�__eq__�szWeakSet.__eq__cCs|j�}|j|�|S)N)r0�symmetric_difference_update)rr2r6rrr�symmetric_difference�s
zWeakSet.symmetric_differencecCs|j|�dS)N)�__ixor__)rr2rrrrE�sz#WeakSet.symmetric_difference_updatecs@�jr�j��|kr"�jj�n�jj�fdd�|D���S)Nc3s|]}t|�j�VqdS)N)rr)r9r)rrrr:�sz#WeakSet.__ixor__.<locals>.<genexpr>)rrrr/rE)rr2r)rrrG�szWeakSet.__ixor__cCs|jdd�||fD��S)Ncss|]}|D]
}|Vq
qdS)Nr)r9rrrrrr:�sz WeakSet.union.<locals>.<genexpr>)r+)rr2rrr�union�sz
WeakSet.unioncCst|j|��dkS)Nr)r%r;)rr2rrr�
isdisjoint�szWeakSet.isdisjoint)N)'rrrr	rr$r&r)r.rr/r0r!rrr r4r7�__sub__r5r8r;�__and__r=r<r>�__le__r?r@�__ge__rArDrF�__xor__rErGrH�__or__rIrrrrr#sH
			N)�_weakrefr�__all__rrrrrr�<module>spathlib.cpython-36.opt-2.pyc000064400000100624150335715140011564 0ustar003

�\dh���@s$ddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
mZmZmZddlmZddlmZmZmZmZmZmZmZddlmZdZd	d
ddd
dgZdZ dZ!dZ"dd�Z#Gdd�de$�Z%Gdd�de%�Z&Gdd�de%�Z'e&�Z(e'�Z)Gdd�d�Z*Gdd�de*�Z+e+�Z,dd�Z-e.ed ��rTej/�e-�Z-Gd!d"�d"�Z0Gd#d$�d$�Z1Gd%d&�d&e0�Z2Gd'd(�d(e0�Z3Gd)d*�d*e0�Z4Gd+d,�d,e	�Z5Gd-d	�d	e$�Z6ej7j8e6�Gd.d
�d
e6�Z9Gd/d�de6�Z:Gd0d�de6�Z;Gd1d
�d
e;e9�Z<Gd2d�de;e:�Z=dS)3�N)�Sequence)�contextmanager)�EINVAL�ENOENT�ENOTDIR�ELOOP)�
attrgetter)�S_ISDIR�S_ISLNK�S_ISREG�S_ISSOCK�S_ISBLK�S_ISCHR�S_ISFIFO)�quote_from_bytesT�PurePath�
PurePosixPath�PureWindowsPath�Path�	PosixPath�WindowsPath��{i�cCsd|kpd|kpd|kS)N�*�?�[�)�patrr�/usr/lib64/python3.6/pathlib.py�_is_wildcard_pattern"src@s$eZdZdd�Zdd�Zdd�ZdS)�_FlavourcCs|jj|_dS)N)�sep�join)�selfrrr�__init__,sz_Flavour.__init__cCs g}|j}|j}d}}t|�}x�|D]�}|s0q&|r@|j||�}|j|�\}}}	||	kr�xPt|	j|��D] }
|
rh|
dkrh|jtj|
��qhWn|	r�|	dkr�|jtj|	��|s�|r&|s�x6|D].}|s�q�|r�|j||�}|j|�d}|r�Pq�WPq&W|�s|�r|j||�|j	�|||fS)N��.r)
r!�altsep�reversed�replace�	splitroot�split�append�sys�intern�reverse)r#�partsZparsedr!r'�drv�root�it�partZrel�xrrr�parse_parts/s@

z_Flavour.parse_partscCs||r,|rr|rr||||g|dd�fSnF|rd||ksL|j|�|j|�krr||||dd�fSn||||fS|||fS)N�)�casefold)r#r1r2r0Zdrv2Zroot2Zparts2rrr�join_parsed_partsUs
z_Flavour.join_parsed_partsN)�__name__�
__module__�__qualname__r$r6r9rrrrr (s&r c@s�eZdZdZdZdZeZej	dkZ
edd�ee
d�e
d�d	�D��ed
d�ee
d�e
d�d	�D��BZd
Zddddhdd�ed	d�D�Bdd�ed	d�D�BZefdd�Zdd�Zdd�Zefdd�Zdd�Zd d!�Zd"d#�Zd$S)%�_WindowsFlavour�\�/T�ntccs|]}t|�VqdS)N)�chr)�.0r5rrr�	<genexpr>ssz_WindowsFlavour.<genexpr>�a�zr7ccs|]}t|�VqdS)N)rA)rBr5rrrrCts�A�Zz\\?\ZCONZPRNZAUXZNULcCsh|]}d|�qS)zCOM%dr)rB�irrr�	<setcomp>zsz_WindowsFlavour.<setcomp>�
cCsh|]}d|�qS)zLPT%dr)rBrHrrrrI{scCsb|dd�}|dd�}||krP||krP|j|�\}}|dd�}|dd�}nd}|dd�}||kov||kov||k�r|j|d�}|dk�r|j||d�}||dk�r|dkr�t|�}|r�||d|�|||dd�fS|d|�|||dd�fSd}	}
|dk�r<||jk�r<|dd�}	|dd�}|}||k�rT|}
|j|�}||	|
|fS)	Nrr7�r%��:���rN)�_split_extended_path�find�len�
drive_letters�lstrip)r#r4r!�first�second�prefixZthird�indexZindex2r1r2rrrr*�s6
"

z_WindowsFlavour.splitrootcCs|j�S)N)�lower)r#�srrrr8�sz_WindowsFlavour.casefoldcCsdd�|D�S)NcSsg|]}|j��qSr)rX)rB�prrr�
<listcomp>�sz2_WindowsFlavour.casefold_parts.<locals>.<listcomp>r)r#r0rrr�casefold_parts�sz_WindowsFlavour.casefold_partscCsXd}|j|�rP|dd�}|dd�}|jd�rP||dd�7}d|dd�}||fS)Nr%�zUNC\rLr>)�
startswith)r#rYZ
ext_prefixrVrrrrO�s

z$_WindowsFlavour._split_extended_pathcCs6|sdS|djd�rdS|djd�dj�|jkS)NFrz\\r7r&rN)r^�	partition�upper�reserved_names)r#r0rrr�is_reserved�s
z_WindowsFlavour.is_reservedcCsd|j}t|�dkrJ|ddkrJ|j�dd�jd�}d|t|jd��fSdt|j�jd��SdS)NrKr7rMr?z
file:///%s/%szutf-8zfile:)�driverQ�as_posixrS�urlquote_from_bytes�encode)r#�pathrc�restrrr�make_uri�sz_WindowsFlavour.make_uric
Cs�dtjkrtjd}n`dtjkr,tjd}nJdtjkrnytjd}Wntk
r\d}YnX|tjd}ntd��|r�tjd|kr�|j|f�\}}}|d
tjdkr�td	|��||d<|s�|r�|||j|dd��}n
|j|�}|S)N�HOMEZUSERPROFILEZHOMEPATHZ	HOMEDRIVEr%zCan't determine home directoryZUSERNAMEr7z%Can't determine home directory for %rrNrN)�os�environ�KeyError�RuntimeErrorr6r")r#�username�userhomer1r2r0rrr�
gethomedir�s,




z_WindowsFlavour.gethomedirN)r:r;r<r!r'�has_drv�ntpath�pathmodrk�name�is_supported�set�range�ordrRZext_namespace_prefixrar*r8r\rOrbrirqrrrrr=gs"
"&	'
r=c@sZeZdZdZdZdZeZej	dkZ
efdd�Zdd�Zd	d
�Z
dd�Zd
d�Zdd�ZdS)�
_PosixFlavourr?r%Fr@cCsV|rH|d|krH|j|�}t|�t|�dkr<d|d|fSd||fSn
dd|fSdS)NrrKr%)rSrQ)r#r4r!Z
stripped_partrrrr*�s
z_PosixFlavour.splitrootcCs|S)Nr)r#rYrrrr8	sz_PosixFlavour.casefoldcCs|S)Nr)r#r0rrrr\sz_PosixFlavour.casefold_partscCsdS)NFr)r#r0rrrrbsz_PosixFlavour.is_reservedcCst|�}dt|�S)Nzfile://)�bytesre)r#rgZbpathrrrrisz_PosixFlavour.make_uricCst|s:y
tjdStk
r6ddl}|jtj��jSXn6ddl}y|j|�jStk
rntd|��YnXdS)Nrjrz%Can't determine home directory for %r)	rkrlrm�pwd�getpwuid�getuid�pw_dir�getpwnamrn)r#ror|rrrrqs
z_PosixFlavour.gethomedirN)r:r;r<r!r'rr�	posixpathrtrkrurvr*r8r\rbrirqrrrrrz�s
rzc@seZdZdS)�	_AccessorN)r:r;r<rrrrr�,sr�c@s�eZdZdd�Zdd�Zeej�Zeej�Zeej�Zeej	�Z	eej
�Z
eej�Zeed�rjeej
�Z
ndd�Z
eej�Zeej�Zeej�Zeej�Zeej�Zeed�r�ejZn
dd
d�Zeej�Zdd
�ZejZeejj�Zeejj�ZdS)�_NormalAccessorcstj���fdd��}t|�S)Ncs�t|�f|��S)N)�str)�pathobj�args)�strfuncrr�wrapped4sz._NormalAccessor._wrap_strfunc.<locals>.wrapped)�	functools�wraps�staticmethod)r�r�r)r�r�
_wrap_strfunc3sz_NormalAccessor._wrap_strfunccstj���fdd��}t|�S)Ncs�t|�t|�f|��S)N)r�)ZpathobjAZpathobjBr�)r�rrr�:sz5_NormalAccessor._wrap_binary_strfunc.<locals>.wrapped)r�r�r�)r�r�r)r�r�_wrap_binary_strfunc9sz$_NormalAccessor._wrap_binary_strfunc�lchmodcCstd��dS)Nz%lchmod() not available on this system)�NotImplementedError)r#r��moderrrr�Nsz_NormalAccessor.lchmod�symlinkFcCstd��dS)Nz)os.symlink() not available on this system)r�)r#�src�dst�target_is_directoryrrrr�^sz_NormalAccessor.symlinkcCs
tj|�S)N)rk�readlink)r#rgrrrr�esz_NormalAccessor.readlinkN)F)r:r;r<r�r�rk�stat�lstat�open�listdir�scandir�chmod�hasattrr��mkdir�unlink�rmdir�renamer)r��utimer��getcwdr�rg�
expanduser�realpathrrrrr�1s0














r�cCsP|d}|dd�}|dkr"t}n$d|kr4td��nt|�rBt}nt}|||�S)Nrr7z**z:Invalid pattern: '**' can only be an entire path component)�_RecursiveWildcardSelector�
ValueErrorr�_WildcardSelector�_PreciseSelector)�
pattern_partsr�child_parts�clsrrr�_make_selectorvs
r��	lru_cachec@seZdZdd�Zdd�ZdS)�	_SelectorcCs.||_|rt|�|_d|_nt�|_d|_dS)NTF)r�r��	successor�dironly�_TerminatingSelector)r#r�rrrr$�s
z_Selector.__init__cCs<t|�}|j}|j}|jj}||�s,tg�S|j||||�S)N)�type�is_dir�exists�	_accessorr��iter�_select_from)r#�parent_pathZpath_clsr�r�r�rrr�select_from�sz_Selector.select_fromN)r:r;r<r$r�rrrrr��s	r�c@seZdZdd�ZdS)r�ccs
|VdS)Nr)r#r�r�r�r�rrrr��sz!_TerminatingSelector._select_fromN)r:r;r<r�rrrrr��sr�c@seZdZdd�Zdd�ZdS)r�cCs||_tj||�dS)N)rur�r$)r#rur�rrrr$�sz_PreciseSelector.__init__ccs^yD|j|j�}|jr|n||�rBx |jj||||�D]
}|Vq4WWntk
rXdSXdS)N)�_make_child_relpathrur�r�r��PermissionError)r#r�r�r�r�rgrZrrrr��sz_PreciseSelector._select_fromN)r:r;r<r$r�rrrrr��sr�c@seZdZdd�Zdd�ZdS)r�cCs"tjtj|��|_tj||�dS)N)�re�compile�fnmatch�	translaterr�r$)r#rr�rrrr$�sz_WildcardSelector.__init__ccs�y||jj}t||��}xb|D]Z}|js0|j�r|j}||�}	|jj|	�r|j|�}
x |j	j
|
|||�D]
}|VqhWqWWntk
r�dSXdS)N)�_flavourr8�listr�r�rur�matchr�r�r�r�)r#r�r�r�r��cf�entries�entryruZ
casefoldedrgrZrrrr��s

z_WildcardSelector._select_fromN)r:r;r<r$r�rrrrr��sr�c@s$eZdZdd�Zdd�Zdd�ZdS)r�cCstj||�dS)N)r�r$)r#rr�rrrr$�sz#_RecursiveWildcardSelector.__init__ccsz|VyZt||��}xH|D]@}|j�r|j�r|j|j�}x|j|||�D]
}|VqLWqWWntk
rtdSXdS)N)r�r��
is_symlinkr�ru�_iterate_directoriesr�)r#r�r�r�r�r�rgrZrrrr��s
z/_RecursiveWildcardSelector._iterate_directoriesc	cs�yjt�}zT|jj}xF|j|||�D]4}x.|||||�D]}||kr6|V|j|�q6Wq"WWd|j�XWntk
r~dSXdS)N)rwr�r�r��add�clearr�)	r#r�r�r�r�ZyieldedZsuccessor_selectZstarting_pointrZrrrr��sz'_RecursiveWildcardSelector._select_fromN)r:r;r<r$r�r�rrrrr��sr�c@s0eZdZdZdd�Zdd�Zd	d
�Zdd�Zd
S)�_PathParents�_pathcls�_drv�_root�_partscCs&t|�|_|j|_|j|_|j|_dS)N)r�r�r�r�r�)r#rgrrrr$�s
z_PathParents.__init__cCs(|js|jrt|j�dSt|j�SdS)Nr7)r�r�rQr�)r#rrr�__len__�sz_PathParents.__len__cCs@|dks|t|�krt|��|jj|j|j|jd|d��S)Nrr7)rQ�
IndexErrorr��_from_parsed_partsr�r�r�)r#�idxrrr�__getitem__sz_PathParents.__getitem__cCsdj|jj�S)Nz<{}.parents>)�formatr�r:)r#rrr�__repr__
sz_PathParents.__repr__N)r�r�r�r�)r:r;r<�	__slots__r$r�r�r�rrrrr��s
r�c@s�eZdZdYZdd	�Zd
d�Zedd
��ZedZdd��Zed[dd��Z	edd��Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd �Zd!d"�Zd#d$�Zed%d&��Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zeed�d3d4�Zeed�d5d4�Zed6d7��Zed8d9��Zed:d;��Z ed<d=��Z!ed>d?��Z"d@dA�Z#dBdC�Z$dDdE�Z%edFdG��Z&dHdI�Z'dJdK�Z(dLdM�Z)edNdO��Z*edPdQ��Z+dRdS�Z,dTdU�Z-dVdW�Z.dXS)\rr�r�r��_str�_hash�_pparts�_cached_cpartscGs$|tkrtjdkrtnt}|j|�S)Nr@)rrkrurr�_from_parts)r�r�rrr�__new__szPurePath.__new__cCs|jt|j�fS)N)�	__class__�tupler�)r#rrr�
__reduce__&szPurePath.__reduce__cCshg}xV|D]N}t|t�r$||j7}q
tj|�}t|t�rH|jt|��q
tdt|���q
W|j	j
|�S)NzNargument should be a str object or an os.PathLike object returning str, not %r)�
isinstancerr�rk�fspathr�r,�	TypeErrorr�r�r6)r�r�r0rDrrr�_parse_args+s



zPurePath._parse_argsTcCs<tj|�}|j|�\}}}||_||_||_|r8|j�|S)N)�objectr�r�r�r�r��_init)r�r��initr#r1r2r0rrrr�?s
zPurePath._from_partscCs,tj|�}||_||_||_|r(|j�|S)N)r�r�r�r�r�r�)r�r1r2r0r�r#rrrr�Ls
zPurePath._from_parsed_partscCs4|s|r$|||jj|dd��S|jj|�SdS)Nr7)r�r")r�r1r2r0rrr�_format_parsed_partsVszPurePath._format_parsed_partscCsdS)Nr)r#rrrr�]szPurePath._initcCs@|j|�\}}}|jj|j|j|j|||�\}}}|j|||�S)N)r�r�r9r�r�r�r�)r#r�r1r2r0rrr�_make_childaszPurePath._make_childcCs<y|jStk
r6|j|j|j|j�p,d|_|jSXdS)Nr&)r��AttributeErrorr�r�r�r�)r#rrr�__str__gszPurePath.__str__cCst|�S)N)r�)r#rrr�
__fspath__qszPurePath.__fspath__cCs|j}t|�j|jd�S)Nr?)r�r�r)r!)r#�frrrrdtszPurePath.as_posixcCstjt|��S)N)rk�fsencoder�)r#rrr�	__bytes__zszPurePath.__bytes__cCsdj|jj|j��S)Nz{}({!r}))r�r�r:rd)r#rrrr�szPurePath.__repr__cCs|j�std��|jj|�S)Nz.relative path can't be expressed as a file URI)�is_absoluter�r�ri)r#rrr�as_uri�szPurePath.as_uricCs2y|jStk
r,|jj|j�|_|jSXdS)N)r�r�r�r\r�)r#rrr�_cparts�s
zPurePath._cpartscCs&t|t�stS|j|jko$|j|jkS)N)r�r�NotImplementedr�r�)r#�otherrrr�__eq__�s
zPurePath.__eq__cCs2y|jStk
r,tt|j��|_|jSXdS)N)r�r��hashr�r�)r#rrr�__hash__�s
zPurePath.__hash__cCs(t|t�s|j|jk	rtS|j|jkS)N)r�rr�r�r�)r#r�rrr�__lt__�szPurePath.__lt__cCs(t|t�s|j|jk	rtS|j|jkS)N)r�rr�r�r�)r#r�rrr�__le__�szPurePath.__le__cCs(t|t�s|j|jk	rtS|j|jkS)N)r�rr�r�r�)r#r�rrr�__gt__�szPurePath.__gt__cCs(t|t�s|j|jk	rtS|j|jkS)N)r�rr�r�r�)r#r�rrr�__ge__�szPurePath.__ge__z.The drive prefix (letter or UNC path), if any.)�doczThe root of the path, if any.cCs|j|j}|S)N)r�r�)r#�anchorrrrr��szPurePath.anchorcCs.|j}t|�|js|jrdndkr&dS|dS)Nr7rr%rN)r�rQr�r�)r#r0rrrru�sz
PurePath.namecCsD|j}|jd�}d|ko*t|�dknr<||d�SdSdS)Nr&rr7r%)ru�rfindrQ)r#rurHrrr�suffix�s

 zPurePath.suffixcCs:|j}|jd�rgS|jd�}dd�|jd�dd�D�S)Nr&cSsg|]}d|�qS)r&r)rBr�rrrr[�sz%PurePath.suffixes.<locals>.<listcomp>r7)ru�endswithrSr+)r#rurrr�suffixes�s


zPurePath.suffixescCsD|j}|jd�}d|ko*t|�dknr<|d|�S|SdS)Nr&rr7)rur�rQ)r#rurHrrr�stem�s

 z
PurePath.stemcCs�|jstd|f��|jj|f�\}}}|sZ|d|jj|jjgksZ|sZ|sZt|�dkrftd|��|j|j|j	|j
dd�|g�S)Nz%r has an empty namer7zInvalid name %rrNrN)rur�r�r6r!r'rQr�r�r�r�)r#rur1r2r0rrr�	with_name�szPurePath.with_namecCs�|j}|j|ks |jr,|j|kr,td|��|r<|jd�sD|dkrPtd|��|j}|shtd|f��|j}|s|||}n|dt|��|}|j|j	|j
|jdd�|g�S)NzInvalid suffix %rr&z%r has an empty namer7rN)r�r!r'r�r^rur�rQr�r�r�r�)r#r�r�ruZ
old_suffixrrr�with_suffix�s
zPurePath.with_suffixc
Gs�|std��|j}|j}|j}|r8||g|dd�}n|}|j|�\}}}|rf||g|dd�}	n|}	t|	�}
|jj}|
dkr�|p�|n||d|
��||	�kr�|j|||�}t	dj
t|�t|����|jd|
dkr�|nd||
d��S)Nzneed at least one argumentr7rz{!r} does not start with {!r}r%)
r�r�r�r�r�rQr�r\r�r�r�r�r�)
r#r�r0r1r2Z	abs_partsZto_drvZto_rootZto_partsZto_abs_parts�nr�Z	formattedrrr�relative_tos(	(zPurePath.relative_tocCs.y|jStk
r(t|j�|_|jSXdS)N)r�r�r�r�)r#rrrr0"s
zPurePath.partscGs
|j|�S)N)r�)r#r�rrr�joinpath.szPurePath.joinpathcCs|j|f�S)N)r�)r#�keyrrr�__truediv__6szPurePath.__truediv__cCs|j|g|j�S)N)r�r�)r#rrrr�__rtruediv__9szPurePath.__rtruediv__cCs@|j}|j}|j}t|�dkr*|s&|r*|S|j|||dd��S)Nr7rN)r�r�r�rQr�)r#r1r2r0rrr�parent<szPurePath.parentcCst|�S)N)r�)r#rrr�parentsFszPurePath.parentscCs|js
dS|jjpt|j�S)NF)r�r�rr�boolr�)r#rrrr�KszPurePath.is_absolutecCs|jj|j�S)N)r�rbr�)r#rrrrbRszPurePath.is_reservedc	Cs�|jj}||�}|jj|f�\}}}|s0td��|rF|||j�krFdS|r\|||j�kr\dS|j}|sj|r�t|�t|�kr~dS|dd�}nt|�t|�kr�dSx.tt	|�t	|��D]\}}t
j||�s�dSq�WdS)Nz
empty patternFr7T)r�r8r6r�r�r�r�rQ�zipr(r�Zfnmatchcase)	r#Zpath_patternr�r1r2Z	pat_partsr0r4rrrrr�Ws(zPurePath.matchN)r�r�r�r�r�r�r�)T)T)/r:r;r<r�r�r��classmethodr�r�r�r�r�r�r�r�rdr�r�r��propertyr�r�r�r�r�r�r�rrcr2r�rur�rrrrrr0rrr	r
rr�rbr�rrrrrs\

	
	
	
 
c@seZdZeZfZdS)rN)r:r;r<�_posix_flavourr�r�rrrrrusc@seZdZeZfZdS)rN)r:r;r<�_windows_flavourr�r�rrrrrsc@s�eZdZd`Zdd�Zdadd�Zdd	�Zd
d�Zdd
�Zdd�Z	dbdd�Z
dcdd�Zedd��Z
edd��Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zddd%d&�Zd'd(�Zd)d*�Zd+d,�Zdfd/d0�Zd1d2�Zdgd3d4�Zd5d6�Zdhd7d8�Zdid:d;�Zdjd<d=�Zd>d?�Zd@dA�Z dBdC�Z!dDdE�Z"dFdG�Z#dHdI�Z$dJdK�Z%dkdLdM�Z&dNdO�Z'dPdQ�Z(dRdS�Z)dTdU�Z*dVdW�Z+dXdY�Z,dZd[�Z-d\d]�Z.d^d_�Z/dS)lrr��_closedcOsL|tkrtjdkrtnt}|j|dd�}|jjs@td|j	f��|j
�|S)Nr@F)r�z$cannot instantiate %r on your system)rrkrurrr�r�rvr�r:r�)r�r��kwargsr#rrrr��szPath.__new__NcCs"d|_|dk	r|j|_nt|_dS)NF)rr��_normal_accessor)r#�templaterrrr��s
z
Path._initcCs|j|g}|j|j|j|�S)N)r�r�r�r�)r#r4r0rrrr��szPath._make_child_relpathcCs|jr|j�|S)N)r�
_raise_closed)r#rrr�	__enter__�szPath.__enter__cCs
d|_dS)NT)r)r#�t�v�tbrrr�__exit__�sz
Path.__exit__cCstd��dS)NzI/O operation on closed path)r�)r#rrrr�szPath._raise_closed�cCs|jj|||�S)N)r�r�)r#ru�flagsr�rrr�_opener�szPath._opener�cCs|jr|j�|jj|||�S)N)rrr�r�)r#rr�rrr�	_raw_open�szPath._raw_opencCs|tj��S)N)rkr�)r�rrr�cwd�szPath.cwdcCs||�jjd��S)N)r�rq)r�rrr�home�sz	Path.homecCsB|j�}y|j�}Wntk
r2tj|�}YnXtjj||�S)N)r�r�rkrg�samestat)r#Z
other_path�stZother_strrr�samefile�sz
Path.samefileccsL|jr|j�x8|jj|�D](}|dkr*q|j|�V|jr|j�qWdS)Nr&�..>r&r&)rrr�r�r�)r#rurrr�iterdir�szPath.iterdirccsl|stdj|���|jj|�}|jj|f�\}}}|s:|rBtd��tt|��}x|j|�D]
}|VqZWdS)NzUnacceptable pattern: {!r}z%Non-relative patterns are unsupported)	r�r�r�r8r6r�r�r�r�)r#�patternr1r2r��selectorrZrrr�glob�sz	Path.globccs^|jj|�}|jj|f�\}}}|s(|r0td��tdt|��}x|j|�D]
}|VqLWdS)Nz%Non-relative patterns are unsupported�**)r+)r�r8r6r�r�r�r�)r#r(r1r2r�r)rZrrr�rglobsz
Path.rglobcCsD|jr|j�|j�r|S|jtj�g|jdd�}|j|d�|S)NF)r�)r)rrr�r�rkr�r�r�)r#�objrrr�absolutesz
Path.absoluteFcCs�|jr|j�dd�}y|jj||d�}Wn,tk
rV}z||��WYdd}~XnX|j|f�}|s�y|j�Wn*tk
r�}z||�WYdd}~XnX|S)NcSs0t|dd�}|jtks|tkr,td|j��dS)N�winerrorrzSymlink loop from %r)�getattr�errnor�_WINERROR_CANT_RESOLVE_FILENAMErn�filename)�er/rrr�check_eloop*sz!Path.resolve.<locals>.check_eloop)�strict)rrr�r��OSErrorr�r�)r#r6r5rYr4rZrrr�resolve!szPath.resolvecCs|jj|�S)N)r�r�)r#rrrr�?sz	Path.statcCsddl}|j|j�j�jS)Nr)r|r}r��st_uidZpw_name)r#r|rrr�ownerFsz
Path.ownercCsddl}|j|j�j�jS)Nr)�grpZgetgrgidr��st_gidZgr_name)r#r;rrr�groupMsz
Path.group�rr7c	Cs,|jr|j�tjt|�||||||jd�S)N)�opener)rr�ior�r�r)r#r��	buffering�encoding�errors�newlinerrrr�Tsz	Path.openc	Cs |jdd��
}|j�SQRXdS)N�rb)r�)r��read)r#r�rrr�
read_bytes_szPath.read_bytesc	Cs$|jd||d��
}|j�SQRXdS)Nr>)r�rBrC)r�rF)r#rBrCr�rrr�	read_textfszPath.read_textc	Cs*t|�}|jdd��}|j|�SQRXdS)N�wb)r�)�
memoryviewr��write)r#�dataZviewr�rrr�write_bytesmszPath.write_bytesc	Cs@t|t�std|jj��|jd||d��}|j|�SQRXdS)Nzdata must be str, not %s�w)r�rBrC)r�r�r�r�r:r�rK)r#rLrBrCr�rrr�
write_textvs

zPath.write_textTcCsr|jr|j�|r>y|jj|d�Wntk
r8YnXdStjtjB}|sX|tjO}|j	||�}tj
|�dS)N)rrr�r�r7rk�O_CREAT�O_WRONLY�O_EXCLr �close)r#r��exist_okr�fdrrr�touch�s
z
Path.touchcCs�|jr|j�y|jj||�Wnjtk
rf|s@|j|krB�|jjddd�|j|d|d�Yn&tk
r�|s�|j�r��YnXdS)NT)rrTF)rrr�r��FileNotFoundErrorr
r7r�)r#r�rrTrrrr��sz
Path.mkdircCs |jr|j�|jj||�dS)N)rrr�r�)r#r�rrrr��sz
Path.chmodcCs |jr|j�|jj||�dS)N)rrr�r�)r#r�rrrr��szPath.lchmodcCs|jr|j�|jj|�dS)N)rrr�r�)r#rrrr��szPath.unlinkcCs|jr|j�|jj|�dS)N)rrr�r�)r#rrrr��sz
Path.rmdircCs|jr|j�|jj|�S)N)rrr�r�)r#rrrr��sz
Path.lstatcCs |jr|j�|jj||�dS)N)rrr�r�)r#�targetrrrr��szPath.renamecCs |jr|j�|jj||�dS)N)rrr�r))r#rXrrrr)�szPath.replacecCs"|jr|j�|jj|||�dS)N)rrr�r�)r#rXr�rrr�
symlink_to�szPath.symlink_tocCsBy|j�Wn0tk
r<}z|jttfkr.�dSd}~XnXdS)NFT)r�r7r1rr)r#r4rrrr��szPath.existscCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)NF)r	r��st_moder7r1rr)r#r4rrrr��szPath.is_dircCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)NF)rr�rZr7r1rr)r#r4rrr�is_file
szPath.is_filecCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)NF)r
r�rZr7r1rr)r#r4rrrr�szPath.is_symlinkcCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)NF)r
r�rZr7r1rr)r#r4rrr�is_block_device$szPath.is_block_devicecCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)NF)rr�rZr7r1rr)r#r4rrr�is_char_device1szPath.is_char_devicecCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)NF)rr�rZr7r1rr)r#r4rrr�is_fifo>szPath.is_fifocCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)NF)rr�rZr7r1rr)r#r4rrr�	is_socketKszPath.is_socketcCsb|jp
|jr^|jr^|jddd�dkr^|jj|jddd��}|j|g|jdd��S|S)Nrr7�~)r�r�r�r�rqr�)r#Zhomedirrrrr�Xs
zPath.expanduser)r�r)N)r)r)FrN)r>rNNNN)NN)NN)rT)rFF)F)0r:r;r<r�r�r�r�rrrrr rr!r"r%r'r*r,r.r8r�r:r=r�rGrHrMrOrVr�r�r�r�r�r�r�r)rYr�r�r[r�r\r]r^r_r�rrrrr�s\







	



				





c@seZdZfZdS)rN)r:r;r<r�rrrrrdsc@s eZdZfZdd�Zdd�ZdS)rcCstd��dS)Nz*Path.owner() is unsupported on this system)r�)r#rrrr:rszWindowsPath.ownercCstd��dS)Nz*Path.group() is unsupported on this system)r�)r#rrrr=uszWindowsPath.groupN)r:r;r<r�r:r=rrrrrks)>r�r�r@rsrkr�r�r-�collectionsr�
contextlibrr1rrrr�operatorrr�r	r
rrr
rrZurllib.parserreZsupports_symlinks�__all__Z_WINERROR_NOT_READYZ_WINERROR_INVALID_NAMEr2rr�r r=rzrrr�r�rr�r�r�r�r�r�r�r�r�r�PathLike�registerrrrrrrrrr�<module>sd$
?6>
%f

[abc.cpython-36.opt-1.pyc000064400000016462150335715140010673 0ustar003


 \"�@svdZddlmZdd�ZGdd�de�ZGdd�de�ZGd	d
�d
e�Z	Gdd�de
�ZGd
d�ded�Zdd�Z
dS)z3Abstract Base Classes (ABCs) according to PEP 3119.�)�WeakSetcCs
d|_|S)a�A decorator indicating abstract methods.

    Requires that the metaclass is ABCMeta or derived from it.  A
    class that has a metaclass derived from ABCMeta cannot be
    instantiated unless all of its abstract methods are overridden.
    The abstract methods can be called using any of the normal
    'super' call mechanisms.

    Usage:

        class C(metaclass=ABCMeta):
            @abstractmethod
            def my_abstract_method(self, ...):
                ...
    T)�__isabstractmethod__)�funcobj�r�/usr/lib64/python3.6/abc.py�abstractmethod	srcs$eZdZdZdZ�fdd�Z�ZS)�abstractclassmethodaO
    A decorator indicating abstract classmethods.

    Similar to abstractmethod.

    Usage:

        class C(metaclass=ABCMeta):
            @abstractclassmethod
            def my_abstract_classmethod(cls, ...):
                ...

    'abstractclassmethod' is deprecated. Use 'classmethod' with
    'abstractmethod' instead.
    Tcsd|_t�j|�dS)NT)r�super�__init__)�self�callable)�	__class__rrr
0szabstractclassmethod.__init__)�__name__�
__module__�__qualname__�__doc__rr
�
__classcell__rr)r
rrsrcs$eZdZdZdZ�fdd�Z�ZS)�abstractstaticmethodaO
    A decorator indicating abstract staticmethods.

    Similar to abstractmethod.

    Usage:

        class C(metaclass=ABCMeta):
            @abstractstaticmethod
            def my_abstract_staticmethod(...):
                ...

    'abstractstaticmethod' is deprecated. Use 'staticmethod' with
    'abstractmethod' instead.
    Tcsd|_t�j|�dS)NT)rr	r
)rr)r
rrr
Hszabstractstaticmethod.__init__)rrrrrr
rrr)r
rr5src@seZdZdZdZdS)�abstractpropertyak
    A decorator indicating abstract properties.

    Requires that the metaclass is ABCMeta or derived from it.  A
    class that has a metaclass derived from ABCMeta cannot be
    instantiated unless all of its abstract properties are overridden.
    The abstract properties can be called using any of the normal
    'super' call mechanisms.

    Usage:

        class C(metaclass=ABCMeta):
            @abstractproperty
            def my_abstract_property(self):
                ...

    This defines a read-only property; you can also define a read-write
    abstract property using the 'long' form of property declaration:

        class C(metaclass=ABCMeta):
            def getx(self): ...
            def setx(self, value): ...
            x = abstractproperty(getx, setx)

    'abstractproperty' is deprecated. Use 'property' with 'abstractmethod'
    instead.
    TN)rrrrrrrrrrMsrcsFeZdZdZdZ�fdd�Zdd�Zddd	�Zd
d�Zdd
�Z	�Z
S)�ABCMetaaiMetaclass for defining Abstract Base Classes (ABCs).

    Use this metaclass to create an ABC.  An ABC can be subclassed
    directly, and then acts as a mix-in class.  You can also register
    unrelated concrete classes (even built-in classes) and unrelated
    ABCs as 'virtual subclasses' -- these and their descendants will
    be considered subclasses of the registering ABC by the built-in
    issubclass() function, but the registering ABC won't show up in
    their MRO (Method Resolution Order) nor will method
    implementations defined by the registering ABC be callable (not
    even via super()).

    rc	s�t�j||||f|�}dd�|j�D�}xF|D]>}x8t|dt��D]&}t||d�}t|dd�rB|j|�qBWq.Wt|�|_t�|_	t�|_
t�|_tj
|_|S)NcSs h|]\}}t|dd�r|�qS)rF)�getattr)�.0�name�valuerrr�	<setcomp>�sz"ABCMeta.__new__.<locals>.<setcomp>�__abstractmethods__rF)r	�__new__�itemsr�set�add�	frozensetrr�
_abc_registry�
_abc_cache�_abc_negative_cacher�_abc_invalidation_counter�_abc_negative_cache_version)	�mclsr�bases�	namespace�kwargs�cls�	abstracts�baser)r
rrr�s

zABCMeta.__new__cCsPt|t�std��t||�r |St||�r2td��|jj|�tjd7_|S)zsRegister a virtual subclass of an ABC.

        Returns the subclass, to allow usage as a class decorator.
        zCan only register classesz'Refusing to create an inheritance cycle�)	�
isinstance�type�	TypeError�
issubclass�RuntimeErrorr!rrr$)r*�subclassrrr�register�s


zABCMeta.registerNcCs|td|j|jf|d�tdtj|d�xLt|j�D]>}|jd�r6t||�}t	|t
�r`t|�}td||f|d�q6WdS)z'Debug helper to print the ABC registry.zClass: %s.%s)�filezInv.counter: %s�_abc_z%s: %rN)�printrrrr$�sorted�__dict__�
startswithrr.rr)r*r5rrrrr�_dump_registry�s


zABCMeta._dump_registrycsb|j}|�jkrdSt|�}||krH�jtjkr>|�jkr>dS�j|�St�fdd�||hD��S)z'Override for isinstance(instance, cls).TFc3s|]}�j|�VqdS)N)�__subclasscheck__)r�c)r*rr�	<genexpr>�sz,ABCMeta.__instancecheck__.<locals>.<genexpr>)	r
r"r/r%rr$r#r<�any)r*�instancer3�subtyper)r*r�__instancecheck__�s


zABCMeta.__instancecheck__cCs�||jkrdS|jtjkr,t�|_tj|_n||jkr:dS|j|�}|tk	rn|r^|jj|�n|jj|�|S|t	|df�kr�|jj|�dSx(|j
D]}t||�r�|jj|�dSq�Wx*|j�D]}t||�r�|jj|�dSq�W|jj|�dS)z'Override for issubclass(subclass, cls).TF�__mro__)
r"r%rr$rr#�__subclasshook__�NotImplementedrrr!r1�__subclasses__)r*r3�ok�rcls�sclsrrrr<�s4





zABCMeta.__subclasscheck__)N)rrrrr$rr4r;rBr<rrr)r
rrms
rc@seZdZdZdS)�ABCzVHelper class that provides a standard way to create an ABC using
    inheritance.
    N)rrrrrrrrrJ�srJ)�	metaclasscCstjS)z�Returns the current ABC cache token.

    The token is an opaque object (supporting equality testing) identifying the
    current version of the ABC cache for virtual subclasses. The token changes
    with every call to ``register()`` on any ABC.
    )rr$rrrr�get_cache_token�srLN)r�_weakrefsetrr�classmethodr�staticmethodr�propertyrr/rrJrLrrrr�<module>s py_compile.cpython-36.opt-2.pyc000064400000005576150335715140012313 0ustar003


 \
�@s~ddlZddlZddlZddlZddlZddlZddlZdddgZGdd�de	�Z
ddd�Zd
d	d�Ze
d
krzeje��dS)�N�compile�main�PyCompileErrorc@seZdZddd�Zdd�ZdS)r�cCst|j}|tkr2djtj||��}|jdd|�}nd||f}tj||pJ||||�||_||_	||_
|pl||_dS)NrzFile "<string>"z	File "%s"z
Sorry: %s: %s)�__name__�SyntaxError�join�	traceback�format_exception_only�replace�	Exception�__init__�
exc_type_name�	exc_value�file�msg)�self�exc_typerrrr�tbtext�errmsg�r�"/usr/lib64/python3.6/py_compile.pyr
-s
zPyCompileError.__init__cCs|jS)N)r)rrrr�__str__=szPyCompileError.__str__N)r)r�
__module__�__qualname__r
rrrrrrs
F�cCs�|dkr>|dkr2|dkr|nd}tjj||d�}ntjj|�}tjj|�r^d}t|j|���n,tjj|�r�tjj	|�r�d}t|j|���tj
jd|�}|j|�}y|j
||p�||d�}	WnVtk
�r}
z8t|
j|
|p�|�}|r�|�ntjj|jd	�dSWYdd}
~
XnXy tjj|�}|�r0tj|�Wntk
�rHYnX|j|�}
tjj|	|
d
|
d�}tjj|�}tjj|||�|S)Nrrr)�optimizationzc{} is a symlink and will be changed into a regular file if import writes a byte-compiled file to itzk{} is a non-regular file and will be changed into a regular one if import writes a byte-compiled file to itz<py_compile>)�	_optimize�
�mtime�size)�	importlib�util�cache_from_source�os�path�islink�FileExistsError�format�exists�isfile�	machinery�SourceFileLoader�get_data�source_to_coderr�	__class__�sys�stderr�writer�dirname�makedirs�
path_stats�_bootstrap_external�_code_to_bytecode�
_calc_mode�
_write_atomic)r�cfile�dfile�doraise�optimizerr�loader�source_bytes�code�err�py_excr3�source_stats�bytecode�moderrrrAsF)


cCs"|dkrtjdd�}d}|dgkr�x�tjj�}|s6P|jd�}yt|dd�Wq&tk
r�}zd}tjjd|j	�WYdd}~Xq&t
k
r�}zd}tjjd|�WYdd}~Xq&Xq&WnZxX|D]P}yt|dd�Wq�tk
�r}zd}tjjd|j	�WYdd}~Xq�Xq�W|S)Nrr�-rT)r<z%s
)r0�argv�stdin�readline�rstriprrr1r2r�OSError)�args�rv�filename�errorrrrr�s0


"(
(�__main__���)NNFrQ)N)Zimportlib._bootstrap_externalr!�importlib.machinery�importlib.utilr$Zos.pathr0r	�__all__rrrrr�exitrrrr�<module>s
0
R
&sre_constants.cpython-36.opt-2.pyc000064400000012655150335715140013034 0ustar003


 \��@s4dZddlmZmZGdd�de�ZGdd�de�Zeed�Zdd	�Zed
�Z	e	d-d�=ed
�Z
ed�Zee
eeeeeeeeiZeeeeiZeeeeiZ ee!ee"iZ#e$e$e%e%e&e&e'e'e(e)e*e+e,e,e-e-iZ.e$e/e%e0e&e1e'e2e(e3e*e4e,e5e-e6iZ7dZ8dZ9dZ:dZ;dZ<dZ=dZ>dZ?dZ@dZAdZBdZCeDdk�r0dd�ZEeFdd���ZGeGjHd�eGjHde�eEeGe	d�eEeGe
d�eEeGed�eGjHd e8�eGjHd!e9�eGjHd"e:�eGjHd#e;�eGjHd$e<�eGjHd%e=�eGjHd&e>�eGjHd'e?�eGjHd(e@�eGjHd)eA�eGjHd*eB�eGjHd+eC�WdQRXeId,�dS).iuS3�)�	MAXREPEAT�	MAXGROUPScseZdZd�fdd�	Z�ZS)�errorNcs�||_||_||_|dk	r�|dk	r�d||f}t|t�r>d}nd}|j|d|�d|_||j|d|�|_||kr�d||j|jf}nd|_|_t	�j
|�dS)Nz%s at position %d�
�
r�z%s (line %d, column %d))�msg�pattern�pos�
isinstance�str�count�lineno�rfind�colno�super�__init__)�selfrr	r
�newline)�	__class__��%/usr/lib64/python3.6/sre_constants.pyr#s
zerror.__init__)NN)�__name__�
__module__�__qualname__r�
__classcell__rr)rrrsrcs(eZdZ�fdd�Zdd�ZeZ�ZS)�_NamedIntConstantcstt|�j||�}||_|S)N)rr�__new__�name)�cls�valuerr)rrrr7sz_NamedIntConstant.__new__cCs|jS)N)r)rrrr�__str__<sz_NamedIntConstant.__str__)rrrrr!�__repr__rrr)rrr6srrcCs8|j�j�}dd�t|�D�}t�jdd�|D��|S)NcSsg|]\}}t||��qSr)r)�.0�irrrr�
<listcomp>Esz_makecodes.<locals>.<listcomp>cSsi|]}||j�qSr)r)r#�itemrrr�
<dictcomp>Fsz_makecodes.<locals>.<dictcomp>)�strip�split�	enumerate�globals�update)�names�itemsrrr�
_makecodesCsr/a�
    FAILURE SUCCESS

    ANY ANY_ALL
    ASSERT ASSERT_NOT
    AT
    BRANCH
    CALL
    CATEGORY
    CHARSET BIGCHARSET
    GROUPREF GROUPREF_EXISTS GROUPREF_IGNORE
    IN IN_IGNORE
    INFO
    JUMP
    LITERAL LITERAL_IGNORE
    MARK
    MAX_UNTIL
    MIN_UNTIL
    NOT_LITERAL NOT_LITERAL_IGNORE
    NEGATE
    RANGE
    REPEAT
    REPEAT_ONE
    SUBPATTERN
    MIN_REPEAT_ONE
    RANGE_IGNORE

    MIN_REPEAT MAX_REPEAT
�Nz�
    AT_BEGINNING AT_BEGINNING_LINE AT_BEGINNING_STRING
    AT_BOUNDARY AT_NON_BOUNDARY
    AT_END AT_END_LINE AT_END_STRING
    AT_LOC_BOUNDARY AT_LOC_NON_BOUNDARY
    AT_UNI_BOUNDARY AT_UNI_NON_BOUNDARY
a�
    CATEGORY_DIGIT CATEGORY_NOT_DIGIT
    CATEGORY_SPACE CATEGORY_NOT_SPACE
    CATEGORY_WORD CATEGORY_NOT_WORD
    CATEGORY_LINEBREAK CATEGORY_NOT_LINEBREAK
    CATEGORY_LOC_WORD CATEGORY_LOC_NOT_WORD
    CATEGORY_UNI_DIGIT CATEGORY_UNI_NOT_DIGIT
    CATEGORY_UNI_SPACE CATEGORY_UNI_NOT_SPACE
    CATEGORY_UNI_WORD CATEGORY_UNI_NOT_WORD
    CATEGORY_UNI_LINEBREAK CATEGORY_UNI_NOT_LINEBREAK
r���� �@���__main__cCs.t|�}x |D]}|jd|||f�qWdS)Nz#define %s_%s %d
)�sorted�write)�f�d�prefixr.r&rrr�dump�s
r>zsre_constants.h�wao/*
 * Secret Labs' Regular Expression Engine
 *
 * regular expression matching engine
 *
 * NOTE: This file is generated by sre_constants.py.  If you need
 * to change anything in here, edit sre_constants.py and run it.
 *
 * Copyright (c) 1997-2001 by Secret Labs AB.  All rights reserved.
 *
 * See the _sre.c file for information on usage and redistribution.
 */

z#define SRE_MAGIC %d
ZSRE_OPZSREz#define SRE_FLAG_TEMPLATE %d
z#define SRE_FLAG_IGNORECASE %d
z#define SRE_FLAG_LOCALE %d
z#define SRE_FLAG_MULTILINE %d
z#define SRE_FLAG_DOTALL %d
z#define SRE_FLAG_UNICODE %d
z#define SRE_FLAG_VERBOSE %d
z#define SRE_FLAG_DEBUG %d
z#define SRE_FLAG_ASCII %d
z#define SRE_INFO_PREFIX %d
z#define SRE_INFO_LITERAL %d
z#define SRE_INFO_CHARSET %d
�done���)J�MAGIC�_srerr�	Exceptionr�intrr/�OPCODES�ATCODES�CHCODES�GROUPREFZGROUPREF_IGNORE�IN�	IN_IGNORE�LITERALZLITERAL_IGNORE�NOT_LITERALZNOT_LITERAL_IGNORE�RANGE�RANGE_IGNORE�	OP_IGNORE�AT_BEGINNINGZAT_BEGINNING_LINE�AT_ENDZAT_END_LINE�AT_MULTILINEZAT_BOUNDARYZAT_LOC_BOUNDARYZAT_NON_BOUNDARYZAT_LOC_NON_BOUNDARY�	AT_LOCALEZAT_UNI_BOUNDARYZAT_UNI_NON_BOUNDARY�
AT_UNICODEZCATEGORY_DIGITZCATEGORY_NOT_DIGITZCATEGORY_SPACEZCATEGORY_NOT_SPACEZ
CATEGORY_WORDZCATEGORY_LOC_WORDZCATEGORY_NOT_WORDZCATEGORY_LOC_NOT_WORDZCATEGORY_LINEBREAKZCATEGORY_NOT_LINEBREAK�	CH_LOCALEZCATEGORY_UNI_DIGITZCATEGORY_UNI_NOT_DIGITZCATEGORY_UNI_SPACEZCATEGORY_UNI_NOT_SPACEZCATEGORY_UNI_WORDZCATEGORY_UNI_NOT_WORDZCATEGORY_UNI_LINEBREAKZCATEGORY_UNI_NOT_LINEBREAK�
CH_UNICODE�SRE_FLAG_TEMPLATE�SRE_FLAG_IGNORECASE�SRE_FLAG_LOCALE�SRE_FLAG_MULTILINE�SRE_FLAG_DOTALL�SRE_FLAG_UNICODE�SRE_FLAG_VERBOSE�SRE_FLAG_DEBUG�SRE_FLAG_ASCII�SRE_INFO_PREFIX�SRE_INFO_LITERAL�SRE_INFO_CHARSETrr>�openr;r:�printrrrr�<module>s�



posixpath.cpython-36.pyc000064400000024722150335715140011224 0ustar003

�\dh�?�'@sfdZdZdZdZdZdZdZdZdZddl	Z	ddl
Z
ddlZddlZdd	lTd
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0g'Z
d1d2�Zd3d
�Zd4d�Zd5d�Zd6d�Zd7d�Zejje_d8d
�Zd9d�Zd:d�Zd;d�Zd<d�Zd=d�Zd>d�Zdadad?d�Zd@d�ZdAd �Z dBdC�dDd,�Z!dEdF�Z"e
j#dGkZ$dJdHd.�Z%dId/�Z&dS)Ka�Common operations on Posix pathnames.

Instead of importing this module directly, import os and refer to
this module as os.path.  The "os.path" name is an alias for this
module on Posix systems; on other systems (e.g. Mac, Windows),
os.path provides the same operations in a manner specific to that
platform, and is an alias to another module (e.g. macpath, ntpath).

Some of this can actually be useful on non-Posix systems too, e.g.
for manipulation of the pathname component of URLs.
�.z..�/�:z:/bin:/usr/binNz	/dev/null�)�*�normcase�isabs�join�
splitdrive�split�splitext�basename�dirname�commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�ismount�
expanduser�
expandvars�normpath�abspath�samefile�sameopenfile�samestat�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenames�relpath�
commonpath�
ALLOW_MISSINGcCst|t�rdSdSdS)N�/r)�
isinstance�bytes)�path�r1�!/usr/lib64/python3.6/posixpath.py�_get_sep)s
r3cCs.tj|�}t|ttf�s*tdj|jj���|S)z6Normalize case of pathname.  Has no effect under Posixz2normcase() argument must be str or bytes, not '{}')	�os�fspathr.r/�str�	TypeError�format�	__class__�__name__)�sr1r1r2r4s

cCstj|�}t|�}|j|�S)zTest whether a path is absolute)r4r5r3�
startswith)r;r"r1r1r2r@s
c
Gs�tj|�}t|�}|}yd|s,|dd�|xJttj|�D]:}|j|�rN|}q:|s^|j|�rh||7}q:|||7}q:WWn.tttfk
r�t	j
d|f|���YnX|S)z�Join two or more pathname components, inserting '/' as needed.
    If any component is an absolute path, all previous path components
    will be discarded.  An empty last part will result in a path that
    ends with a separator.Nrr)r4r5r3�mapr<�endswithr7�AttributeError�BytesWarning�genericpath�_check_arg_types)�a�pr"r0�br1r1r2rKs 


cCs`tj|�}t|�}|j|�d}|d|�||d�}}|rX||t|�krX|j|�}||fS)z�Split a pathname.  Returns tuple "(head, tail)" where "tail" is
    everything after the final slash.  Either part may be empty.�N)r4r5r3�rfind�len�rstrip)rDr"�i�head�tailr1r1r2r
hs

cCs6tj|�}t|t�rd}d}nd}d}tj||d|�S)Nr-�.rr)r4r5r.r/rA�	_splitext)rDr"r&r1r1r2rys

cCstj|�}|dd�|fS)zJSplit a pathname into drive and path. On Posix, drive is always
    empty.Nr)r4r5)rDr1r1r2r	�s
cCs,tj|�}t|�}|j|�d}||d�S)z)Returns the final component of a pathnamerFN)r4r5r3rG)rDr"rJr1r1r2r�s
cCsNtj|�}t|�}|j|�d}|d|�}|rJ||t|�krJ|j|�}|S)z-Returns the directory component of a pathnamerFN)r4r5r3rGrHrI)rDr"rJrKr1r1r2r
�s

cCs4ytj|�}Wnttfk
r&dSXtj|j�S)z&Test whether a path is a symbolic linkF)r4�lstat�OSErrorr?�stat�S_ISLNK�st_mode)r0�str1r1r2r�s
cCs(ytj|�Wntk
r"dSXdS)zCTest whether a path exists.  Returns True for broken symbolic linksFT)r4rOrP)r0r1r1r2r�s
cCs�ytj|�}Wntk
r"dSXtj|j�r4dSt|t�rJt|d�}n
t|d�}t	|�}ytj|�}Wntk
r~dSX|j
}|j
}||kr�dS|j}|j}||kr�dSdS)z$Test whether a path is a mount pointFs..z..T)r4rOrPrQrRrSr.r/rr(�st_dev�st_ino)r0�s1�parent�s2�dev1�dev2�ino1�ino2r1r1r2r�s.

c	Cs4tj|�}t|t�rd}nd}|j|�s,|St|�}|j|d�}|dkrPt|�}|dkr�dtjkr�ddl	}y|j
tj��j}Wq�t
k
r�|SXq�tjd}nRddl	}|d|�}t|t�r�t|d�}y|j|�}Wnt
k
r�|SX|j}t|t��rtj|�}d}nd	}|j|�}|||d��p2|S)
zOExpand ~ and ~user constructions.  If user or $HOME is unknown,
    do nothing.�~�~rFr�HOMEN�ASCIIr-r)r4r5r.r/r<r3�findrH�environ�pwd�getpwuid�getuid�pw_dir�KeyErrorr6�getpwnam�fsencoderI)	r0�tilder"rJrd�userhome�name�pwent�rootr1r1r2r�sB







cCs\tj|�}t|t�rVd|kr |Sts:ddl}|jd|j�atj}d}d}t	tdd�}n:d|krb|St
s|ddl}|jd	|j�a
t
j}d
}d}tj}d}x�|||�}|s�P|jd�\}}|j
d�}	|	j|�r�|	j|�r�|	dd
�}	y.|dk�rtjtjtj|	��}
n||	}
Wntk
�r&|}Yq�X||d�}|d|�|
}t|�}||7}q�W|S)zZExpand shell variables of form $var and ${var}.  Unknown variables
    are left unchanged.�$rNs\$(\w+|\{[^}]*\})�{�}�environb�$z\$(\w+|\{[^}]*\})�{�}rF���)r4r5r.r/�	_varprogb�re�compilera�search�getattr�_varprogrc�span�groupr<r>rj�fsdecoderhrH)r0ryr{�start�endrcrJ�m�jrm�valuerLr1r1r2rsP





c	Cs�tj|�}t|t�r&d}d}d}d}nd}d}d}d}||krB|S|j|�}|rr|j|d	�rr|j|d
�rrd	}|j|�}g}xV|D]N}|||fkr�q�||ks�|r�|s�|r�|d|kr�|j|�q�|r�|j�q�W|}|j|�}|r�|||}|p�|S)
z0Normalize path, eliminating double slashes, etc.r-�rMs..r�rz..��rFrw)	r4r5r.r/r<r
�append�popr)	r0r"�empty�dot�dotdot�initial_slashes�comps�	new_comps�compr1r1r2rRs>





cCs@tj|�}t|�s8t|t�r&tj�}ntj�}t||�}t|�S)zReturn an absolute path.)	r4r5rr.r/�getcwdb�getcwdrr)r0�cwdr1r1r2rxs



F)�strictcCs,tj|�}t|dd�||i�\}}t|�S)zlReturn the canonical path of the specified filename, eliminating any
symbolic links encountered in the path.Nr)r4r5�
_joinrealpathr)�filenamer�r0�okr1r1r2r(�s
c
Cs�t|t�rd}d}d}nd}d}d}tj}|tkr8t}n|rBf}nt}d}	t|�rb|dd�}|}�x"|�r�|j|�\}
}}|
sf|
|kr�qf|
|kr�|r�t	|�\}}
|
|kr�t
|||�}qf|}qft
||
�}ytj|�}
Wn|k
r�d}YnXtj
|
j�}|�s
|}qf||k�rH||}|dk	�r(qf|�r:tj|�nt
||�dfSd||<t|tj|�||�\}}|�s|t
||�dfS|||<qfW|d	fS)
Nr-rMs..rrz..rFFT)r.r/r4r�r,�FileNotFoundErrorrPr�	partitionr
rrOrQrRrSr��readlink)r0�restr��seenr"r r!r��
ignored_error�maxlinksrm�_�newpathrT�is_linkr�r1r1r2r��sd





r��darwinc	Cs�|std��tj|�}t|t�r.d}d}d}nd}d}d}|dkrH|}n
tj|�}ynd	d
�t|�j|�D�}dd
�t|�j|�D�}tt||g��}|gt|�|||d�}|s�|St	|�St
ttt
fk
r�tjd||��YnXdS)
z#Return a relative version of a pathzno path specifiedrMr-s..rrz..NcSsg|]}|r|�qSr1r1)�.0�xr1r1r2�
<listcomp>�szrelpath.<locals>.<listcomp>cSsg|]}|r|�qSr1r1)r�r�r1r1r2r��sr*)�
ValueErrorr4r5r.r/rr
rHrrr7r?r@�DeprecationWarningrArB)	r0r�r r"r!�
start_list�	path_listrJ�rel_listr1r1r2r*�s0


c	s2|std��tttj|��}t|dt�r4d�d�nd�d�yƇfdd�|D�}yt�fd	d
�|D��\}Wntk
r�td�d�YnX�fd
d�|D�}t|�}t	|�}|}x.t
|�D]"\}}|||kr�|d|�}Pq�W|r�n
�dd�}|�j|�Stt
fk
�r,tjd|���YnXdS)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr-rMrrcsg|]}|j���qSr1)r
)r�r0)r"r1r2r�szcommonpath.<locals>.<listcomp>c3s|]}|dd��kVqdS)NrFr1)r�rD)r"r1r2�	<genexpr>szcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathsNcsg|]}�fdd�|D��qS)csg|]}|r|�kr|�qSr1r1)r��c)r r1r2r�sz)commonpath.<locals>.<listcomp>.<listcomp>r1)r�r;)r r1r2r�sr+)r+)r��tupler=r4r5r.r/�set�min�max�	enumeraterr7r?rArB)	�paths�split_pathsrrWrY�commonrJr��prefixr1)r r"r2r+s6)N)'�__doc__r r!r&r"r#r$r%r'r4�sysrQrA�__all__r3rrrr
rrNr	rr
rrrrr}rxrrrr(r��platformr)r*r+r1r1r1r2�<module>sZ

	
	

*25&	F

)getopt.cpython-36.opt-1.pyc000064400000014051150335715140011440 0ustar003


 \A�@s�dZddddgZddlZyddlmZWnek
rDdd	�ZYnXGd
d�de�ZeZgfdd�Z	gfdd�Z
d
d�Zdd�Zdd�Z
dd�Zedkr�ddlZee	ejdd�dddg��dS)a�Parser for command line options.

This module helps scripts to parse the command line arguments in
sys.argv.  It supports the same conventions as the Unix getopt()
function (including the special meanings of arguments of the form `-'
and `--').  Long options similar to those supported by GNU software
may be used as well via an optional third argument.  This module
provides two functions and an exception:

getopt() -- Parse command line options
gnu_getopt() -- Like getopt(), but allow option and non-option arguments
to be intermixed.
GetoptError -- exception (class) raised with 'opt' attribute, which is the
option involved with the exception.
�GetoptError�error�getopt�
gnu_getopt�N)�gettextcCs|S)N�)�srr�/usr/lib64/python3.6/getopt.py�_)sr
c@s&eZdZdZdZddd�Zdd�ZdS)r�cCs||_||_tj|||�dS)N)�msg�opt�	Exception�__init__)�selfrr
rrr	r.szGetoptError.__init__cCs|jS)N)r)rrrr	�__str__3szGetoptError.__str__N)r)�__name__�
__module__�__qualname__r
rrrrrrr	r+s
cCs�g}t|�td�kr|g}nt|�}x�|r�|djd�r�|ddkr�|ddkr^|dd�}P|djd�r�t||ddd�||dd��\}}q&t||ddd�||dd��\}}q&W||fS)a@getopt(args, options[, long_options]) -> opts, args

    Parses command line options and parameter list.  args is the
    argument list to be parsed, without the leading reference to the
    running program.  Typically, this means "sys.argv[1:]".  shortopts
    is the string of option letters that the script wants to
    recognize, with options that require an argument followed by a
    colon (i.e., the same format that Unix getopt() uses).  If
    specified, longopts is a list of strings with the names of the
    long options which should be supported.  The leading '--'
    characters should not be included in the option name.  Options
    which require an argument should be followed by an equal sign
    ('=').

    The return value consists of two elements: the first is a list of
    (option, value) pairs; the second is the list of program arguments
    left after the option list was stripped (this is a trailing slice
    of the first argument).  Each option-and-value pair returned has
    the option as its first element, prefixed with a hyphen (e.g.,
    '-x'), and the option argument as its second element, or an empty
    string if the option has no argument.  The options occur in the
    list in the same order in which they were found, thus allowing
    multiple occurrences.  Long and short options may be mixed.

    rr�-z--�N�)�type�list�
startswith�do_longs�	do_shorts)�args�	shortopts�longopts�optsrrr	r8s (*cCs6g}g}t|t�r|g}nt|�}|jd�r>|dd�}d}ntjjd�rPd}nd}x�|�r,|ddkrz||dd�7}P|ddd	�dkr�t||dd	d�||dd��\}}qV|ddd�d
kr�|dd
kr�t||ddd�||dd��\}}qV|�r||7}PqV|j	|d�|dd�}qVW||fS)agetopt(args, options[, long_options]) -> opts, args

    This function works like getopt(), except that GNU style scanning
    mode is used by default. This means that option and non-option
    arguments may be intermixed. The getopt() function stops
    processing options as soon as a non-option argument is
    encountered.

    If the first character of the option string is `+', or if the
    environment variable POSIXLY_CORRECT is set, then option
    processing stops as soon as a non-option argument is encountered.

    �+rNTZPOSIXLY_CORRECTFrz--rr)
�
isinstance�strrr�os�environ�getrr�append)rrrr Z	prog_argsZall_options_firstrrr	rcs2

( (cCs�y|jd�}Wntk
r&d}Yn X|d|�||dd�}}t||�\}}|r�|dkr�|svttd�||��|d|dd�}}n|dk	r�ttd�||��|jd||p�df�||fS)N�=rzoption --%s requires argumentrz%option --%s must not have an argumentz--r)�index�
ValueError�
long_has_argsrr
r')r r
rr�i�optarg�has_argrrr	r�s
rcs��fdd�|D�}|s(ttd������|kr8d�fS�d|krLd�fSt|�dkrjttd�����|d	}|jd�}|r�|dd
�}||fS)Ncsg|]}|j��r|�qSr)r)�.0�o)r
rr	�
<listcomp>�sz!long_has_args.<locals>.<listcomp>zoption --%s not recognizedFr(Trzoption --%s not a unique prefixr���)rr
�len�endswith)r
rZ
possibilitiesZunique_matchr.r)r
r	r+�s
r+cCs�x�|dkr�|d|dd�}}t||�rj|dkr^|sHttd�||��|d|dd�}}|d}}nd}|jd||f�qW||fS)Nrrrzoption -%s requires argumentr)�
short_has_argrr
r')r Z	optstringrrr
r-rrr	r�s

rcCsXx@tt|��D]0}|||ko(dknr|jd|d�SqWttd�||��dS)N�:rzoption -%s not recognized)�ranger3rrr
)r
rr,rrr	r5�sr5�__main__rza:bzalpha=Zbeta)�__doc__�__all__r$rr
�ImportErrorrrrrrrr+rr5r�sys�print�argvrrrr	�<module>s"+2hashlib.cpython-36.pyc000064400000013043150335715140010611 0ustar003

�\dh_"�$@sfdZd$Zee�Zee�Zed%ZyddlmZWne	k
rLdd�ZYnXe�s`iZ
dd�Zdd�Ze�sxd&dd�Z
d'dd�Zy dd lZeZeZejej�ZWn$e	k
r�e�r��e
ZeZYnXdd!lmZydd"lmZWne	k
�r�YnXxLeD]DZyee�e�e<Wn*ek
�rBdd lZejd#e�YnX�qW[[[[[ej��s`[
[d S)(a3hashlib module - A common interface to many hash functions.

new(name, data=b'', **kwargs) - returns a new hash object implementing the
                                given hash function; initializing the hash
                                using the given binary data.

Named constructor functions are also available, these are faster
than using new(name):

md5(), sha1(), sha224(), sha256(), sha384(), sha512(), blake2b(), blake2s(),
sha3_224, sha3_256, sha3_384, sha3_512, shake_128, and shake_256.

More algorithms may be available on your platform but the above are guaranteed
to exist.  See the algorithms_guaranteed and algorithms_available attributes
to find out what algorithm names can be passed to new().

NOTE: If you want the adler32 or crc32 hash functions they are available in
the zlib module.

Choose your hash function wisely.  Some have known collision weaknesses.
sha384 and sha512 will be slow on 32 bit platforms.

Hash objects have these methods:
 - update(data): Update the hash object with the bytes in data. Repeated calls
                 are equivalent to a single call with the concatenation of all
                 the arguments.
 - digest():     Return the digest of the bytes passed to the update() method
                 so far as a bytes object.
 - hexdigest():  Like digest() except the digest is returned as a string
                 of double length, containing only hexadecimal digits.
 - copy():       Return a copy (clone) of the hash object. This can be used to
                 efficiently compute the digests of datas that share a common
                 initial substring.

For example, to obtain the digest of the byte string 'Nobody inspects the
spammish repetition':

    >>> import hashlib
    >>> m = hashlib.md5()
    >>> m.update(b"Nobody inspects")
    >>> m.update(b" the spammish repetition")
    >>> m.digest()
    b'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9'

More condensed:

    >>> hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest()
    'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2'

�md5�sha1�sha224�sha256�sha384�sha512�blake2b�blake2s�sha3_224�sha3_256�sha3_384�sha3_512�	shake_128�	shake_256�new�algorithms_guaranteed�algorithms_available�pbkdf2_hmac�)�
get_fips_modecCsdS)Nr�rrr�/usr/lib64/python3.6/hashlib.py�_hashlib_get_fips_modeIsrc	
Cs�t}|j|�}|dk	r|S�y2|dkrDddl}|j|d<|d<�n|dkrjddl}|j|d<|d<�n�|dkr�ddl}|j|d<|d	<|j|d<|d<n�|dkr�ddl	}|j
|d<|d
<|j|d
<|d<nv|dk�r�ddl}|j
|d<|j|d<nN|dk�rLddl}|j|d<|j|d<|j|d<|j|d<|j|d<|j|d<Wntk
�rdYnX|j|�}|dk	�r~|Std|��dS)N�SHA1rr�MD5r�SHA256r�SHA224r�SHA512r�SHA384rrrr	r
rrr
rzunsupported hash type )rr)rr)rrrr)rrrr)rr>rr	rr
r
r)�__builtin_constructor_cache�get�_sha1r�_md5r�_sha256rr�_sha512rr�_blake2rr�_sha3r	r
rrr
r�ImportError�
ValueError)	�name�cache�constructorr r!r"r#r$r%rrr�__get_builtin_constructorPsL









r+cCsZtj�s|dkrt|�Sy ttd|�}tj�s6|�|Sttfk
rTt|�SXdS)Nrrrr
Zopenssl_>r
rrr)�_hashlibrr+�getattr�AttributeErrorr')r(�frrr�__get_openssl_constructor{sr0�cKst|�|f|�S)z�new(name, data=b'', **kwargs) - Return a new hashing object using the
        named algorithm; optionally initialized with data (which must be
        a bytes-like object).
        )r+)r(�data�kwargsrrr�__py_new�sr4cKs�tj�r(|}ddddddd�j||�}n|dkr@t|�|f|�Sy:|jd
d�}tj|||d�}tj�rx||krx|j|�|Stk
r�tj�r��t|�|�SXd
S)z�new(name, data=b'') - Return a new hashing object using the named algorithm;
    optionally initialized with data (which must be a bytes-like object).
    zsha3-224zsha3-256zsha3-384zsha3-512Zshake128Zshake256)r	r
rrr
rrr�usedforsecurityT)r5N>rr)r,rrr+�poprZ	_set_namer')r(r2r3Z	orig_namer5Zretvalrrr�
__hash_new�s,

r7N)r)�scryptzcode for hash %s was not found.)rrrrrrrrr	r
rrr
r)rrrr)r1)r1)�__doc__Z__always_supported�setrr�__all__r,rrr&rr+r0r4r7rZ
__get_hash�unionZopenssl_md_meth_namesrr8Z__func_name�globalsr'ZloggingZ	exceptionrrrr�<module>6s\+

'


shlex.cpython-36.pyc000064400000015474150335715140010334 0ustar003


 \�2�@s�dZddlZddlZddlZddlmZddlmZdddgZGdd�d�Z	ddd�Z
ejdej�j
Zd
d�Zdd�Zedkr�eej�dkr�ee	��n,ejdZee��Zee	ee��WdQRXdS)z8A lexical analyzer class for simple shell-like syntaxes.�N)�deque)�StringIO�shlex�split�quotec@sfeZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dd�Z
ddd�Zdd�Zdd�Z
dS)rz8A lexical analyzer class for simple shell-like syntaxes.NFcCst|t�rt|�}|dk	r(||_||_ntj|_d|_||_|rHd|_nd|_d|_	d|_
|jrn|j
d7_
d|_d|_d|_
d|_d	|_d
|_t�|_d|_d|_d|_t�|_d|_|s�d}n|d
kr�d}||_|�rt�|_|j
d7_
|j
jtj|��}|j
j|�|_
dS)N��#Z?abcdfeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_u|ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞz 	
Fz'"�\�"� �rTz();<>|&z~-./*?=)�
isinstance�strr�instream�infile�sys�stdin�posix�eof�
commenters�	wordchars�
whitespace�whitespace_split�quotes�escape�
escapedquotes�stater�pushback�lineno�debug�token�	filestack�source�punctuation_chars�_pushback_chars�	maketrans�dict�fromkeys�	translate)�selfrrrr#�t�r+�/usr/lib64/python3.6/shlex.py�__init__sJ
zshlex.__init__cCs*|jdkrtdt|��|jj|�dS)z:Push a token onto the stack popped by the get_token methodrzshlex: pushing token N)r�print�reprr�
appendleft)r)�tokr+r+r,�
push_tokenDs
zshlex.push_tokencCspt|t�rt|�}|jj|j|j|jf�||_||_d|_|jrl|dk	r\t	d|jf�nt	d|jf�dS)z9Push an input source onto the lexer's input source stack.rNzshlex: pushing to file %szshlex: pushing to stream %s)
r
rrr!r0rrrrr.)r)�	newstream�newfiler+r+r,�push_sourceJs
zshlex.push_sourcecCsD|jj�|jj�\|_|_|_|jr:td|j|jf�d|_dS)zPop the input source stack.zshlex: popping to %s, line %drN)	r�closer!�popleftrrrr.r)r)r+r+r,�
pop_sourceXs
zshlex.pop_sourcecCs�|jr.|jj�}|jdkr*tdt|��|S|j�}|jdk	r~x<||jkr||j|j��}|rr|\}}|j||�|j	�}qBWx*||j
kr�|js�|j
S|j�|j	�}q�W|jdkr�||j
kr�tdt|��ntd�|S)zBGet a token from the input stream (or from stack if it's nonempty)rzshlex: popping token Nz
shlex: token=zshlex: token=EOF)
rr7rr.r/�
read_tokenr"�
sourcehookr5�	get_tokenrr!r8)r)r1�raw�specr4r3r+r+r,r;as.




zshlex.get_tokencCs�d}d}�x\|jr$|jr$|jj�}n|jjd�}|dkrF|jd7_|jdkrbtd|j|f�|jdkrvd|_	Pq|jdk�r�|s�d|_P�qd||j
kr�|jdkr�td	�|j	s�|jr|rPnqn�||jkr�|jj
�|jd7_n�|jo�||jk�rd
}||_n�||jk�r"||_	d
|_np||jk�r<||_	d|_nV||jk�r^|j�sV||_	||_n4|j�rt||_	d
|_n||_	|j	�s�|jr|rPnqq|j|jk�r<d}|�s�|jdk�r�td
�td��||jk�r�|j�s�|j	|7_	d|_Pnd
|_n>|j�r,||jk�r,|j|jk�r,|j}||_n|j	|7_	q|j|jk�r�|�sl|jdk�rdtd�td��||jk�r�||jk�r�||k�r�|j	|j7_	|j	|7_	||_q|jdkr|�s�d|_Pq||j
k�r|jdk�r�td�d|_|j	�s|jr|rPnqq||jk�rZ|jj
�|jd7_|j�rdd|_|j	�sR|jr|rPnqq|jdk�r�||jk�r�|j	|7_	n ||j
k�r�|jj|�d|_Pq|j�r�||jk�r�||_q|j�r�||jk�r�d
}||_q||jk�s||jk�s|j�r|j	|7_	q|j�r&|jj|�n|jj|�|jdk�rFtd�d|_|j	�s^|jr|rPqqqW|j	}d|_	|j�r�|�r�|dk�r�d}|jdk�r�|�r�tdt|��ntd�|S)NFrr�
�z&shlex: in state %r I see character: %rr�z+shlex: I see whitespace in whitespace state�a�cTz shlex: I see EOF in quotes statezNo closing quotationz shlex: I see EOF in escape statezNo escaped characterz%shlex: I see whitespace in word statez&shlex: I see punctuation in word statezshlex: raw token=zshlex: raw token=EOF)rArB)r#r$�popr�readrrr.rr rrr�readlinerrrr�
ValueErrorr�appendrr0r/)r)ZquotedZescapedstateZnextchar�resultr+r+r,r9�s�









zshlex.read_tokencCsX|ddkr|dd�}t|jt�rJtjj|�rJtjjtjj|j�|�}|t|d�fS)z(Hook called on a filename to be sourced.rr
r�r���)	r
rr�os�path�isabs�join�dirname�open)r)r4r+r+r,r:s
zshlex.sourcehookcCs(|dkr|j}|dkr|j}d||fS)z<Emit a C-compiler-like, Emacs-friendly error-message leader.Nz"%s", line %d: )rr)r)rrr+r+r,�error_leaders
zshlex.error_leadercCs|S)Nr+)r)r+r+r,�__iter__#szshlex.__iter__cCs|j�}||jkrt�|S)N)r;r�
StopIteration)r)r r+r+r,�__next__&s
zshlex.__next__)NNFF)N)NN)�__name__�
__module__�__qualname__�__doc__r-r2r5r8r;r9r:rQrRrTr+r+r+r,rs
.
	 	
FTcCs$t||d�}d|_|sd|_t|�S)N)rTr)rrr�list)�sZcommentsrZlexr+r+r,r,s
z[^\w@%+=:,./-]cCs,|sdSt|�dkr|Sd|jdd�dS)z1Return a shell-escaped version of the string *s*.z''N�'z'"'"')�_find_unsafe�replace)rZr+r+r,r6s
cCs(x"|j�}|sPtdt|��qWdS)NzToken: )r;r.r/)ZlexerZttr+r+r,�
_print_tokensBs
r^�__main__r)FT)rXrK�rer�collectionsr�ior�__all__rr�compile�ASCII�searchr\rr^rU�len�argv�fnrP�fr+r+r+r,�<module>s&	



filecmp.cpython-36.opt-2.pyc000064400000013402150335715140011555 0ustar003


 \f&�@s�ddlZddlZddlmZdddddgZiZd"Zd
ddd
ddddgZdd�Zd#dd�Z	dd�Z
dd�ZGdd�d�Zd$dd�Z
ee	fdd�Zdd�Zdd �Zed!kr�e�dS)%�N)�filterfalse�clear_cache�cmp�dircmp�cmpfiles�DEFAULT_IGNORES�iZRCSZCVSZtagsz.gitz.hgz.bzrZ_darcs�__pycache__cCstj�dS)N)�_cache�clear�rr�/usr/lib64/python3.6/filecmp.pyrsTcCs�ttj|��}ttj|��}|dtjks8|dtjkr<dS|rL||krLdS|d|dkr`dStj||||f�}|dkr�t||�}tt�dkr�t�|t||||f<|S)NrFT��d)	�_sig�os�stat�S_IFREGr
�get�_do_cmp�lenr)�f1�f2�shallow�s1�s2Zoutcomerrr
rs
cCstj|j�|j|jfS)N)r�S_IFMT�st_mode�st_size�st_mtime)�strrr
rDs
rcCsbt}t|d��J}t|d��4}x,|j|�}|j|�}||kr>dS|sdSqWWdQRXWdQRXdS)N�rbFT)�BUFSIZE�open�read)rr�bufsize�fp1�fp2Zb1Zb2rrr
rIs

rc@s�eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Ze
eeeeeeeeeeeed�Zdd�ZdS)rNcCsD||_||_|dkr$tjtjg|_n||_|dkr:t|_n||_dS)N)�left�rightr�curdir�pardir�hider�ignore)�self�a�br-r,rrr
�__init__xszdircmp.__init__cCsPttj|j�|j|j�|_ttj|j�|j|j�|_|jj	�|jj	�dS)N)
�_filterr�listdirr(r,r-�	left_listr)�
right_list�sort)r.rrr
�phase0�s
z
dircmp.phase0cCs�ttttjj|j�|j��}ttttjj|j�|j��}tt|j	t
|j|���|_tt|j	t
|j|���|_tt|j	t
|j|���|_dS)N)�dict�zip�mapr�path�normcaser4r5�list�__getitem__�filter�__contains__�commonr�	left_only�
right_only)r.r/r0rrr
�phase1�s
z
dircmp.phase1c
Cs:g|_g|_g|_�x |jD�]}tjj|j|�}tjj|j|�}d}ytj	|�}Wn&t
k
rz}z
d}WYdd}~XnXytj	|�}Wn&t
k
r�}z
d}WYdd}~XnX|�r&t	j|j�}t	j|j�}	||	kr�|jj
|�n>t	j|�r�|jj
|�n&t	j|��r|jj
|�n|jj
|�q|jj
|�qWdS)Nrr)�common_dirs�common_files�common_funnyrArr;�joinr(r)r�OSErrorrr�append�S_ISDIR�S_ISREG)
r.�xZa_pathZb_path�okZa_statZwhyZb_statZa_typeZb_typerrr
�phase2�s4
z
dircmp.phase2cCs&t|j|j|j�}|\|_|_|_dS)N)rr(r)rF�
same_files�
diff_files�funny_files)r.Zxxrrr
�phase3�sz
dircmp.phase3cCsRi|_xF|jD]<}tjj|j|�}tjj|j|�}t|||j|j	�|j|<qWdS)N)
�subdirsrErr;rHr(r)rr-r,)r.rMZa_xZb_xrrr
�phase4�s
z
dircmp.phase4cCs(|j�x|jj�D]}|j�qWdS)N)rUrT�values�phase4_closure)r.�sdrrr
rW�szdircmp.phase4_closurecCs�td|j|j�|jr2|jj�td|jd|j�|jrT|jj�td|jd|j�|jrp|jj�td|j�|jr�|jj�td|j�|jr�|jj�td|j�|j	r�|j	j�td|j	�|j
r�|j
j�td|j
�dS)	NZdiffzOnly in�:zIdentical files :zDiffering files :zTrouble with common files :zCommon subdirectories :zCommon funny cases :)�printr(r)rBr6rCrPrQrRrErG)r.rrr
�report�s,






z
dircmp.reportcCs.|j�x |jj�D]}t�|j�qWdS)N)r[rTrVrZ)r.rXrrr
�report_partial_closure�szdircmp.report_partial_closurecCs.|j�x |jj�D]}t�|j�qWdS)N)r[rTrVrZ�report_full_closure)r.rXrrr
r]�szdircmp.report_full_closure)rTrPrQrRrErFrGrArBrCr4r5cCs*||jkrt|��|j||�t||�S)N)�	methodmap�AttributeError�getattr)r.�attrrrr
�__getattr__�s
zdircmp.__getattr__)NN)�__name__�
__module__�__qualname__r1r7rDrOrSrUrWr[r\r]r8r^rbrrrr
rVs "
#

cCsNgggf}x>|D]6}tjj||�}tjj||�}|t|||�j|�qW|S)N)rr;rH�_cmprJ)r/r0rAr�resrMZaxZbxrrr
r�s

cCs,y|||||��Stk
r&dSXdS)N�)rI)r/r0Zsh�absrrrr
rfsrfcCstt|j|��S)N)r=rr@)Zflist�skiprrr
r2sr2cCsrddl}ddl}|j|jdd�d�\}}t|�dkrB|jdd��t|d|d�}d|krf|j�n|j�dS)	Nrr�rrhzneed exactly two args�-r�)rlrm)�sys�getopt�argvrZGetoptErrorrr]r[)rnroZoptions�argsZddrrr
�demo$s
rr�__main__i )T)T)rr�	itertoolsr�__all__r
r"rrrrrrrrirfr2rrrcrrrr
�<module>
s$
'
%
	_compat_pickle.cpython-36.opt-2.pyc000064400000014556150335715140013122 0ustar003


 \-"�C@s�dddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*�*Zd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d��d�d�d�d�d�d�d�d�di!Z�d	ZyeWnek
�rYnXe�d
7ZxeD]Zdefed�ef<�q*W�dZxeD]ZdQefed�ef<�qPWed�d��ej�D��Z	ed�d��ej�D��Z
ejd�d�dddd"d"dEdEdEd(d�d�d��
�e	jd�d(d/d�d�d���ej�d�d
�d�d�d�d�d�di�e
j�d�d�d�d�d�d�d�d�d�d�d�d�d �d!�d"�d#�d$�d%�d&�d'�d(�d)�d*�d+�d,�d-i
��d.ZxeD]Z�d/e
def<�qzW�d0Z
xe
D]Z�d1e
def<�q�Wd�S(2�builtins�copyregZqueueZsocketserverZconfigparser�reprlib�tkinter.filedialog�tkinter.simpledialogztkinter.colorchooserztkinter.commondialogztkinter.dialogztkinter.dndztkinter.fontztkinter.messageboxztkinter.scrolledtextztkinter.constantsztkinter.tixztkinter.ttkZtkinterZ_markupbase�winreg�_threadZ
_dummy_threadzdbm.bsdzdbm.dumbzdbm.ndbmzdbm.gnuz
xmlrpc.client�
xmlrpc.serverzhttp.clientz
html.entitieszhtml.parserzhttp.cookieszhttp.cookiejar�http.serverztest.support�
subprocess�urllib.parsezurllib.robotparser�urllib.request�dbmzcollections.abc)*�__builtin__Zcopy_regZQueueZSocketServerZConfigParser�reprZtkFileDialogZtkSimpleDialogZtkColorChooserZtkCommonDialogZDialogZTkdndZtkFontZtkMessageBoxZScrolledTextZTkconstantsZTixZttkZTkinterZ
markupbase�_winregZthreadZdummy_threadZdbhashZdumbdbmr
�gdbmZ	xmlrpclibZSimpleXMLRPCServerZhttplibZhtmlentitydefsZ
HTMLParserZCookieZ	cookielibZBaseHTTPServerztest.test_supportZcommandsZurlparseZrobotparser�urllib2ZanydbmZ_abcollr�xrange�range�reduce�	functools�intern�sys�unichr�chr�unicode�str�long�int�	itertools�izip�zip�imap�map�ifilter�filter�ifilterfalse�filterfalse�izip_longest�zip_longest�UserDict�IterableUserDict�collections�UserList�
UserString�whichdb�_socket�fromfd�socket�_multiprocessing�
Connection�multiprocessing.connection�multiprocessing.process�Process�multiprocessing.context�multiprocessing.forking�Popen�multiprocessing.popen_fork�urllib�ContentTooShortError�urllib.error�
getproxies�pathname2url�
quote_plus�quote�unquote_plus�unquote�url2pathname�
urlcleanup�	urlencode�urlopen�urlretriever�	HTTPError�URLError�ArithmeticError�AssertionError�AttributeError�
BaseException�BufferError�BytesWarning�DeprecationWarning�EOFError�EnvironmentError�	Exception�FloatingPointError�
FutureWarning�
GeneratorExit�IOError�ImportError�
ImportWarning�IndentationError�
IndexError�KeyError�KeyboardInterrupt�LookupError�MemoryError�	NameError�NotImplementedError�OSError�
OverflowError�PendingDeprecationWarning�ReferenceError�RuntimeError�RuntimeWarning�
StopIteration�SyntaxError�
SyntaxWarning�SystemError�
SystemExit�TabError�	TypeError�UnboundLocalError�UnicodeDecodeError�UnicodeEncodeError�UnicodeError�UnicodeTranslateError�UnicodeWarning�UserWarning�
ValueError�Warning�ZeroDivisionError�WindowsError�
exceptions�AuthenticationError�BufferTooShort�ProcessError�TimeoutErrorZmultiprocessingccs|]\}}||fVqdS)N�)�.0�k�vr�r��&/usr/lib64/python3.6/_compat_pickle.py�	<genexpr>�sr�ccs|]\}}||fVqdS)Nr�)r�r�r�r�r�r�r��s�picklezxml.etree.ElementTree�io)
ZcPickleZ_elementtree�
FileDialog�SimpleDialog�DocXMLRPCServer�SimpleHTTPServer�
CGIHTTPServerr*r-r.r/�StringIOZ	cStringIO�bz2r)Z_bz2Z_dbm�
_functoolsZ_gdbm�_pickle�
basestring�
StandardError�
_socketobject�
SocketTyper�r��LoadFileDialog�SaveFileDialogr��
ServerHTMLDocr��XMLRPCDocGenerator�DocXMLRPCRequestHandler�DocCGIXMLRPCRequestHandler�SimpleHTTPRequestHandlerr��CGIHTTPRequestHandlerr��BrokenPipeError�ChildProcessError�ConnectionAbortedError�ConnectionError�ConnectionRefusedError�ConnectionResetError�FileExistsError�FileNotFoundError�InterruptedError�IsADirectoryError�NotADirectoryError�PermissionError�ProcessLookupError�ModuleNotFoundErrorN)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr )rr!)rr")rr#)rr$)rr%)rr&)rr')rr()rr))r*r+)r,r*)r-r-)r,r-)r.r.)r,r.)r/r/)r
r/)r0r1)r2r1)r3r4)r5r4)r6r7)r8r7)r9r:)r;r:)r<r=)r>r=)r<r?)rr?)r<r@)rr@)r<rA)rrA)r<rB)rrB)r<rC)rrC)r<rD)rrD)r<rE)rrE)r<rF)rrF)r<rG)rrG)r<rH)rrH)r<rI)rrI)rrJ)r>rJ)rrK)r>rK)/rLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrz)r{)r}r~rr�)rr�)rr)r|r�)rrU)r*r*)r,r*)r2r�)r2r�)r�r)rr)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)rr�)r�r�)r	r�)r�r�)r	r�)r�r�)r0r2)r2r�)r�r�r�r�r�r�r�r�r�r�r�r�r�r�)r|rd)r�)r|rZ)ZIMPORT_MAPPINGZNAME_MAPPINGZPYTHON2_EXCEPTIONSr{rbZexcnameZMULTIPROCESSING_EXCEPTIONS�dict�itemsZREVERSE_IMPORT_MAPPINGZREVERSE_NAME_MAPPING�updateZPYTHON3_OSERROR_EXCEPTIONSZPYTHON3_IMPORTERROR_EXCEPTIONSr�r�r�r��<module>	s�






uu.cpython-36.opt-2.pyc000064400000006322150335715140010572 0ustar003


 \k�@s`ddlZddlZddlZdddgZGdd�de�Zddd�Zd
dd�Zd	d
�Ze	dkr\e�dS)�N�Error�encode�decodec@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/uu.pyr'scCsBg}�z|dkrtjj}n`t|t�rz|dkr8tjj|�}|dkrfytj|�j	}Wnt
k
rdYnXt|d�}|j|�|dkr�tj
j}nt|t�r�t|d�}|j|�|dkr�d}|dkr�d}|jd|d@|fjd��|jd�}x,t|�d	k�r|jtj|��|jd�}q�W|jd
�Wdx|D]}|j��q*WXdS)N�-�rb�wbi�zbegin %o %s
i��ascii�-rs 
end
)�sys�stdin�buffer�
isinstance�str�os�path�basename�stat�st_mode�AttributeError�open�append�stdout�writer�read�len�binasciiZb2a_uu�close)�in_file�out_file�name�mode�opened_files�data�frrr	r*s>









Fc
Cs:g}|dkrtjj}nt|t�r4t|d�}|j|��z�xr|j�}|sNtd��|j	d�sZq:|j
dd�}t|�dkr:|ddkr:yt|d	d
�PWq:t
k
r�Yq:Xq:W|dkr�|djd�jd�}tjj|�r�td
|��|dkr�t|d	d
�}|dk�r
tjj}nNt|t��rXt|d�}ytjj||�Wntk
�rHYnX|}|j|�|j�}x�|�r|jd�dk�rytj|�}	Wnjtjk
�r�}
zJ|ddd@ddd}tj|d|��}	|�s�tjjd|
�WYdd}
~
XnX|j|	�|j�}�qbW|�std��Wdx|D]}|j��q"WXdS)Nr
rz'No valid begin line found in input filesbegin� ��r��s 	
r
z"Cannot overwrite existing file: %srsend� �?��zWarning: %s
zTruncated input file)rrrrrrr�readliner�
startswith�splitr�int�
ValueError�rstriprrr�existsr�chmodr�stripr Za2b_uu�stderrrr!)
r"r#r%�quietr&ZhdrZ	hdrfields�fp�sr'�v�nbytesr(rrr	rZsf









"

cCs4ddl}|jdd�}|jdddddd	d
�|jddd
ddd	d
�|j�\}}t|�dkrl|jd�tjd�tjj	}tj
j	}t|�dkr�|d}t|�dkr�|d}|jr�|jr�t
|t�r�t|d�}nttjdd�tjd�t||�nD|j�r&t
|t��rt|d�}nttjdd�tjd�t||�dS)Nrz'usage: %prog [-d] [-t] [input [output]])Zusagez-dz--decoderzDecode (instead of encode)?F�
store_true)�dest�help�default�actionz-tz--text�textz2data is text, encoded format unix-compatible text?r*zincorrect number of argumentsr,rz: cannot do -t to stdoutrz: cannot do -t from stdin)�optparseZOptionParserZ
add_option�
parse_argsr�errorr�exitrrrrrFrrr�print�argvr)rG�parserZoptions�args�input�outputrrr	�test�s6




rQ�__main__)NN)NNF)
r rr�__all__�	ExceptionrrrrQrrrrr	�<module>!s

0
F&weakref.cpython-36.opt-1.pyc000064400000045253150335715140011572 0ustar003


 \�O�
@s�dZddlmZmZmZmZmZmZmZm	Z	ddl
mZmZddl
Z
ddlZddlZeefZddddd	d
ddd
ddddg
ZGdd�de�ZGdd�de
j�ZGdd�de�ZGdd	�d	e
j�ZGdd�d�ZdS)z{Weak reference support for Python.

This module is an implementation of PEP 205:

http://www.python.org/dev/peps/pep-0205/
�)�getweakrefcount�getweakrefs�ref�proxy�CallableProxyType�	ProxyType�
ReferenceType�_remove_dead_weakref)�WeakSet�_IterationGuardNrrrr�WeakKeyDictionaryrrr�
ProxyTypes�WeakValueDictionaryr
�
WeakMethod�finalizecsDeZdZdZdZddd�Z�fd	d
�Zdd�Zd
d�Ze	j
Z
�ZS)rz�
    A custom `weakref.ref` subclass which simulates a weak reference to
    a bound method, working around the lifetime problem of bound methods.
    �	_func_ref�
_meth_type�_alive�__weakref__Ncs~y|j}|j}Wn(tk
r8tdjt|���d�YnX��fdd�}tj|||�}t||�|_t|�|_	d|_
t|��|S)Nz)argument should be a bound method, not {}cs&��}|jr"d|_�dk	r"�|�dS)NF)r)�arg�self)�callback�self_wr��/usr/lib64/python3.6/weakref.py�_cb3s
zWeakMethod.__new__.<locals>._cbT)�__self__�__func__�AttributeError�	TypeError�format�typer�__new__rrr)�cls�methr�obj�funcrrr)rrrr",s

zWeakMethod.__new__cs2t�j�}|j�}|dks"|dkr&dS|j||�S)N)�super�__call__rr)rr%r&)�	__class__rrr(Bs

zWeakMethod.__call__cCs>t|t�r:|js|jr"||kStj||�o8|j|jkSdS)NF)�
isinstancerrr�__eq__r)r�otherrrrr+Is

zWeakMethod.__eq__cCs>t|t�r:|js|jr"||k	Stj||�p8|j|jkSdS)NT)r*rrr�__ne__r)rr,rrrr-Ps

zWeakMethod.__ne__)rrrr)N)�__name__�
__module__�__qualname__�__doc__�	__slots__r"r(r+r-r�__hash__�
__classcell__rr)r)rr$s
c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZeZ
dd�Zd+dd�Zdd�Zdd�ZeZdd�Zdd �Zd!d"�Zd#d$�Zd,d%d&�Zd'd(�Zd)d*�ZdS)-rz�Mapping class that references values weakly.

    Entries in the dictionary will be discarded when no strong
    reference to the value exists anymore
    cst|std��|^}}t|�dkr0tdt|���t|�tf�fdd�	}||_g|_t�|_i|_�|j	||�dS)NzGdescriptor '__init__' of 'WeakValueDictionary' object needs an argument�z$expected at most 1 arguments, got %dcs4|�}|dk	r0|jr$|jj|j�n|�|j�dS)N)�
_iterating�_pending_removals�append�key)�wr�selfref�_atomic_removalr)�drr�removems
z,WeakValueDictionary.__init__.<locals>.remove)
r�lenrr	�_remover7�setr6�data�update)�args�kwrr>r)r=r�__init__fs	
zWeakValueDictionary.__init__cCs,|j}|j}x|r&|j�}t||�qWdS)N)r7rB�popr	)r�lr=r9rrr�_commit_removals}s
z$WeakValueDictionary._commit_removalscCs4|jr|j�|j|�}|dkr,t|��n|SdS)N)r7rIrB�KeyError)rr9�orrr�__getitem__�s
zWeakValueDictionary.__getitem__cCs|jr|j�|j|=dS)N)r7rIrB)rr9rrr�__delitem__�szWeakValueDictionary.__delitem__cCs|jr|j�t|j�S)N)r7rIr?rB)rrrr�__len__�szWeakValueDictionary.__len__cCs<|jr|j�y|j|�}Wntk
r2dSX|dk	S)NF)r7rIrBrJ)rr9rKrrr�__contains__�sz WeakValueDictionary.__contains__cCsd|jjt|�fS)Nz<%s at %#x>)r)r.�id)rrrr�__repr__�szWeakValueDictionary.__repr__cCs&|jr|j�t||j|�|j|<dS)N)r7rI�KeyedRefr@rB)rr9�valuerrr�__setitem__�szWeakValueDictionary.__setitem__cCsF|jr|j�t�}x,|jj�D]\}}|�}|dk	r |||<q W|S)N)r7rIrrB�items)r�newr9r:rKrrr�copy�szWeakValueDictionary.copycCsZddlm}|jr|j�|j�}x2|jj�D]$\}}|�}|dk	r.|||||�<q.W|S)Nr)�deepcopy)rWrXr7rIr)rBrU)r�memorXrVr9r:rKrrr�__deepcopy__�sz WeakValueDictionary.__deepcopy__NcCsL|jr|j�y|j|}Wntk
r0|SX|�}|dkrD|S|SdS)N)r7rIrBrJ)rr9�defaultr:rKrrr�get�szWeakValueDictionary.getc
csV|jr|j�t|��6x.|jj�D] \}}|�}|dk	r$||fVq$WWdQRXdS)N)r7rIrrBrU)r�kr:�vrrrrU�s
zWeakValueDictionary.itemsc
csN|jr|j�t|��.x&|jj�D]\}}|�dk	r$|Vq$WWdQRXdS)N)r7rIrrBrU)rr]r:rrr�keys�s

zWeakValueDictionary.keysc	cs6|jr|j�t|��|jj�EdHWdQRXdS)a�Return an iterator that yields the weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        N)r7rIrrB�values)rrrr�
itervaluerefs�s

z!WeakValueDictionary.itervaluerefsc
csN|jr|j�t|��.x&|jj�D]}|�}|dk	r$|Vq$WWdQRXdS)N)r7rIrrBr`)rr:r%rrrr`�s
zWeakValueDictionary.valuescCs<|jr|j�x(|jj�\}}|�}|dk	r||fSqWdS)N)r7rIrB�popitem)rr9r:rKrrrrb�szWeakValueDictionary.popitemcGs`|jr|j�y|jj|��}Wntk
r8d}YnX|dkrX|rN|dSt|��n|SdS)Nr)r7rIrBrGrJ)rr9rDrKrrrrGs

zWeakValueDictionary.popcCs`y|j|�}Wntk
r(d}YnX|dkrX|jr@|j�t||j|�|j|<|S|SdS)N)rBrJr7rIrRr@)rr9r[rKrrr�
setdefaults
zWeakValueDictionary.setdefaultcOs�|std��|^}}t|�dkr0tdt|���|r<|dnd}|jrN|j�|j}|dk	r�t|d�srti�|�}x&|j�D]\}}t||j	|�||<q|Wt|�r�|j
|�dS)NzEdescriptor 'update' of 'WeakValueDictionary' object needs an argumentr5z$expected at most 1 arguments, got %drrU)rr?r7rIrB�hasattrr!rUrRr@rC)rD�kwargsr�dictr=r9rKrrrrC s 
zWeakValueDictionary.updatecCs|jr|j�t|jj��S)a~Return a list of weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        )r7rI�listrBr`)rrrr�	valuerefs3s
zWeakValueDictionary.valuerefs)N)N)r.r/r0r1rFrIrLrMrNrOrQrTrW�__copy__rZr\rUr_�__iter__rar`rbrGrcrCrhrrrrrZs.			

			

cs,eZdZdZdZdd�Z�fdd�Z�ZS)rRa[Specialized reference that includes a key corresponding to the value.

    This is used in the WeakValueDictionary to avoid having to create
    a function object for each key stored in the mapping.  A shared
    callback object can use the 'key' attribute of a KeyedRef instead
    of getting a reference to the key from an enclosing scope.

    r9cCstj|||�}||_|S)N)rr"r9)r!�obrr9rrrrr"NszKeyedRef.__new__cst�j||�dS)N)r'rF)rrkrr9)r)rrrFSszKeyedRef.__init__)r9)r.r/r0r1r2r"rFr4rr)r)rrRBsrRc@s�eZdZdZd+dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZeZ
dd�Zd,dd�Zdd�Zdd�Zdd�ZeZdd �Zd!d"�Zd#d$�Zd%d&�Zd-d'd(�Zd.d)d*�ZdS)/ra� Mapping class that references keys weakly.

    Entries in the dictionary will be discarded when there is no
    longer a strong reference to the key. This can be used to
    associate additional data with an object owned by other parts of
    an application without adding attributes to those objects. This
    can be especially useful with objects that override attribute
    accesses.
    NcCsFi|_t|�fdd�}||_g|_t�|_d|_|dk	rB|j|�dS)NcSs.|�}|dk	r*|jr"|jj|�n|j|=dS)N)r6r7r8rB)r]r;rrrrr>ds
z*WeakKeyDictionary.__init__.<locals>.removeF)rBrr@r7rAr6�
_dirty_lenrC)rrfr>rrrrFbszWeakKeyDictionary.__init__cCs>|j}|j}x,|r8y||j�=Wqtk
r4YqXqWdS)N)r7rBrGrJ)rrHr=rrrrIssz"WeakKeyDictionary._commit_removalscs&|j��fdd�|jD�|_d|_dS)Ncsg|]}|�kr|�qSrr)�.0r])r=rr�
<listcomp>�sz5WeakKeyDictionary._scrub_removals.<locals>.<listcomp>F)rBr7rl)rr)r=r�_scrub_removals�sz!WeakKeyDictionary._scrub_removalscCsd|_|jt|�=dS)NT)rlrBr)rr9rrrrM�szWeakKeyDictionary.__delitem__cCs|jt|�S)N)rBr)rr9rrrrL�szWeakKeyDictionary.__getitem__cCs(|jr|jr|j�t|j�t|j�S)N)rlr7ror?rB)rrrrrN�szWeakKeyDictionary.__len__cCsd|jjt|�fS)Nz<%s at %#x>)r)r.rP)rrrrrQ�szWeakKeyDictionary.__repr__cCs||jt||j�<dS)N)rBrr@)rr9rSrrrrT�szWeakKeyDictionary.__setitem__cCs8t�}x,|jj�D]\}}|�}|dk	r|||<qW|S)N)rrBrU)rrVr9rSrKrrrrW�szWeakKeyDictionary.copycCsLddlm}|j�}x2|jj�D]$\}}|�}|dk	r |||�||<q W|S)Nr)rX)rWrXr)rBrU)rrYrXrVr9rSrKrrrrZ�szWeakKeyDictionary.__deepcopy__cCs|jjt|�|�S)N)rBr\r)rr9r[rrrr\�szWeakKeyDictionary.getcCs,yt|�}Wntk
r dSX||jkS)NF)rrrB)rr9r:rrrrO�s
zWeakKeyDictionary.__contains__c
csHt|��6x.|jj�D] \}}|�}|dk	r||fVqWWdQRXdS)N)rrBrU)rr:rSr9rrrrU�s

zWeakKeyDictionary.itemsc
cs<t|��*x"|jD]}|�}|dk	r|VqWWdQRXdS)N)rrB)rr:r%rrrr_�s

zWeakKeyDictionary.keysc
cs@t|��.x&|jj�D]\}}|�dk	r|VqWWdQRXdS)N)rrBrU)rr:rSrrrr`�s

zWeakKeyDictionary.valuescCs
t|j�S)azReturn a list of weak references to the keys.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the keys around longer than needed.

        )rgrB)rrrr�keyrefs�s
zWeakKeyDictionary.keyrefscCs4d|_x(|jj�\}}|�}|dk	r||fSqWdS)NT)rlrBrb)rr9rSrKrrrrb�szWeakKeyDictionary.popitemcGsd|_|jjt|�f|��S)NT)rlrBrGr)rr9rDrrrrG�szWeakKeyDictionary.popcCs|jjt||j�|�S)N)rBrcrr@)rr9r[rrrrc�szWeakKeyDictionary.setdefaultcKs`|j}|dk	rJt|d�s$ti�|�}x$|j�D]\}}||t||j�<q.Wt|�r\|j|�dS)NrU)rBrdr!rUrr@r?rC)rrfrer=r9rSrrrrC�s
zWeakKeyDictionary.update)N)N)N)N)r.r/r0r1rFrIrorMrLrNrQrTrWrirZr\rOrUr_rjr`rprbrGrcrCrrrrrWs.	

	

c@s�eZdZdZfZiZdZej�Z	dZ
dZGdd�d�Zdd�Z
ddd	�Zd
d�Zdd
�Zedd��Zedd��Zejdd��Zdd�Zedd��Zedd��ZdS)raClass for finalization of weakrefable objects

    finalize(obj, func, *args, **kwargs) returns a callable finalizer
    object which will be called when obj is garbage collected. The
    first time the finalizer is called it evaluates func(*arg, **kwargs)
    and returns the result. After this the finalizer is dead, and
    calling it just returns None.

    When the program exits any remaining finalizers for which the
    atexit attribute is true will be run in reverse order of creation.
    By default atexit is true.
    Fc@seZdZdZdS)	zfinalize._Info�weakrefr&rDre�atexit�indexN)rqr&rDrerrrs)r.r/r0r2rrrr�_InfosrtcOsp|js ddl}|j|j�dt_|j�}t||�|_||_||_	|pFd|_
d|_t|j�|_
||j|<dt_dS)NrT)�_registered_with_atexitrr�register�	_exitfuncrrtrrqr&rDre�next�_index_iterrs�	_registry�_dirty)rr%r&rDrerr�inforrrrFs

zfinalize.__init__NcCs2|jj|d�}|r.|jr.|j|j|jp*i�SdS)zZIf alive then mark as dead and return func(*args, **kwargs);
        otherwise return NoneN)rzrG�	_shutdownr&rDre)r�_r|rrrr(szfinalize.__call__cCsH|jj|�}|o|j�}|dk	rD|jj|d�rD||j|j|jp@ifSdS)z^If alive then mark as dead and return (obj, func, args, kwargs);
        otherwise return NoneN)rzr\rqrGr&rDre)rr|r%rrr�detach&szfinalize.detachcCs:|jj|�}|o|j�}|dk	r6||j|j|jp2ifSdS)zMIf alive then return (obj, func, args, kwargs);
        otherwise return NoneN)rzr\rqr&rDre)rr|r%rrr�peek.sz
finalize.peekcCs
||jkS)zWhether finalizer is alive)rz)rrrr�alive6szfinalize.alivecCs|jj|�}t|�o|jS)z*Whether finalizer should be called at exit)rzr\�boolrr)rr|rrrrr;szfinalize.atexitcCs|jj|�}|rt|�|_dS)N)rzr\r�rr)rrSr|rrrrrAscCs^|jj|�}|o|j�}|dkr6dt|�jt|�fSdt|�jt|�t|�jt|�fSdS)Nz<%s object at %#x; dead>z!<%s object at %#x; for %r at %#x>)rzr\rqr!r.rP)rr|r%rrrrQGszfinalize.__repr__cCs2dd�|jj�D�}|jdd�d�dd�|D�S)NcSsg|]\}}|jr||f�qSr)rr)rm�f�irrrrnSsz-finalize._select_for_exit.<locals>.<listcomp>cSs
|djS)Nr5)rs)�itemrrr�<lambda>Tsz+finalize._select_for_exit.<locals>.<lambda>)r9cSsg|]\}}|�qSrr)rmr�r�rrrrnUs)rzrU�sort)r#�Lrrr�_select_for_exitPszfinalize._select_for_exitcCs�d}z�|jr�ddl}|j�r(d}|j�d}x\|dks<tjrJ|j�}dt_|sPP|j�}y
|�Wq.tk
r�t	j
t	j��Yq.Xq.WWddt_|r�|j
�XdS)NFrT)rz�gc�	isenabled�disablerr{r�rG�	Exception�sys�
excepthook�exc_infor}�enable)r#�reenable_gcr��pendingr�rrrrwWs.
zfinalize._exitfunc)N)r.r/r0r1r2rzr}�	itertools�countryr{rurtrFr(rr��propertyr�rr�setterrQ�classmethodr�rwrrrrr�s$
	)r1�_weakrefrrrrrrrr	�_weakrefsetr
r�collectionsr�r�r
�__all__r�MutableMappingrrRrrrrrr�<module>s"(

6itty.cpython-36.pyc000064400000002062150335715140010016 0ustar003


 \o�@sLdZddlTddgZdZdZdZdZdZd	Zd
Z	e
fdd�Ze
fdd�Zd
S)zTerminal utilities.�)�*�setraw�	setcbreak������cCs�t|�}|tttBtBtBtB@|t<|tt@|t<|t	t
tB@|t	<|t	tB|t	<|t
ttBtBtB@|t
<d|tt<d|tt<t|||�dS)zPut terminal into a raw mode.rrN)�	tcgetattr�IFLAGZBRKINTZICRNLZINPCKZISTRIPZIXON�OFLAGZOPOST�CFLAGZCSIZEZPARENBZCS8�LFLAG�ECHO�ICANONZIEXTENZISIG�CC�VMIN�VTIME�	tcsetattr)�fd�when�mode�r�/usr/lib64/python3.6/tty.pyrs"cCsFt|�}|tttB@|t<d|tt<d|tt<t|||�dS)z Put terminal into a cbreak mode.rrN)rrrrrrrr)rrrrrrrs
N)
�__doc__Ztermios�__all__rr
rrZISPEEDZOSPEEDrZ	TCSAFLUSHrrrrrr�<module>scopyreg.cpython-36.pyc000064400000010226150335715140010647 0ustar003


 \_�@s�dZdddddgZiZddd�Zdd�ZyeWnek
rDYnXd	d
�Zeeee�dd�ZdZ	dd�Z
dd�Zdd�Zdd�Z
iZiZiZdd�Zdd�Zdd�ZdS)z�Helper to provide extensibility for pickle.

This is only useful to add pickle support for extension types defined in
C, not for instances of user-defined classes.
�pickle�constructor�
add_extension�remove_extension�clear_extension_cacheNcCs,t|�std��|t|<|dk	r(t|�dS)Nz$reduction functions must be callable)�callable�	TypeError�dispatch_tabler)�ob_type�pickle_function�constructor_ob�r�/usr/lib64/python3.6/copyreg.pyrs
cCst|�std��dS)Nzconstructors must be callable)rr)�objectrrr
rscCst|j|jffS)N)�complex�real�imag)�crrr
�pickle_complex"srcCs<|tkrtj|�}n$|j||�}|jtjkr8|j||�|S)N)r�__new__�__init__)�cls�base�state�objrrr
�_reconstructor)sr��	cCs�|dkst�x,|jjD]}t|d�r|jt@rPqWt}|tkrHd}n ||jkr`td|j��||�}|j||f}y
|j	}WnLt
k
r�t|dd�r�td��y
|j}Wnt
k
r�d}YnXYnX|�}|r�t
||fSt
|fSdS)N��	__flags__zcan't pickle %s objects�	__slots__zNa class that defines __slots__ without defining __getstate__ cannot be pickled)�AssertionError�	__class__�__mro__�hasattrr�	_HEAPTYPErr�__name__�__getstate__�AttributeError�getattr�__dict__r)�self�protorr�args�getstate�dictrrr
�
_reduce_ex6s0



r/cGs|j|f|��S)N)r)rr,rrr
�
__newobj__Wsr0cCs|j|f|�|�S)zUsed by pickle protocol 4, instead of __newobj__ to allow classes with
    keyword-only arguments to be pickled correctly.
    )r)rr,�kwargsrrr
�
__newobj_ex__Zsr2c	Cs�|jjd�}|dk	r|Sg}t|d�s(n�x�|jD]�}d|jkr0|jd}t|t�rX|f}xh|D]`}|d	krnq^q^|jd�r�|jd�r�|jj	d�}|r�|j
d||f�q�|j
|�q^|j
|�q^Wq0Wy
||_WnYnX|S)
a�Return a list of slot names for a given class.

    This needs to find slots defined by the class and its bases, so we
    can't simply return the __slots__ attribute.  We must walk down
    the Method Resolution Order and concatenate the __slots__ of each
    class found there.  (This assumes classes don't modify their
    __slots__ attribute to misrepresent their slots after the class is
    defined.)
    �
__slotnames__Nrr)�__weakref__�__�_z_%s%s)r)r4)r)�getr#r"�
isinstance�str�
startswith�endswithr%�lstrip�appendr3)r�namesr�slots�name�strippedrrr
�
_slotnames`s2





rBcCs�t|�}d|kodkns(td��||f}tj|�|krPtj|�|krPdS|tkrltd|t|f��|tkr�td|t|f��|t|<|t|<dS)zRegister an extension code.ri���zcode out of rangeNz)key %s is already registered with code %sz$code %s is already in use for key %s)�int�
ValueError�_extension_registryr7�_inverted_registry)�moduler@�code�keyrrr
r�scCsR||f}tj|�|ks$tj|�|kr4td||f��t|=t|=|tkrNt|=dS)z0Unregister an extension code.  For testing only.z%key %s is not registered with code %sN)rEr7rFrD�_extension_cache)rGr@rHrIrrr
r�scCstj�dS)N)rJ�clearrrrr
r�s)Ni)�__doc__�__all__rrrr�	NameErrorrrr$r/r0r2rBrErFrJrrrrrrr
�<module>s.


	!<bisect.cpython-36.opt-1.pyc000064400000005166150335715140011416 0ustar003


 \#
�@sZdZddd�ZeZd
dd�ZeZddd�Zdd	d
�ZyddlTWnek
rTYnXdS)zBisection algorithms.�NcCsd|dkrtd��|dkr t|�}x2||krR||d}|||krH|}q"|d}q"W|j||�dS)z�Insert item x in list a, and keep it sorted assuming a is sorted.

    If x is already in a, insert it to the right of the rightmost x.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    rzlo must be non-negativeN��)�
ValueError�len�insert)�a�x�lo�hi�mid�r�/usr/lib64/python3.6/bisect.py�insort_rights	
rcCsX|dkrtd��|dkr t|�}x2||krR||d}|||krH|}q"|d}q"W|S)a�Return the index where to insert item x in list a, assuming a is sorted.

    The return value i is such that all e in a[:i] have e <= x, and all e in
    a[i:] have e > x.  So if x already appears in the list, a.insert(x) will
    insert just after the rightmost x already there.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    rzlo must be non-negativeNrr)rr)rrr	r
rrrr
�bisect_rights
rcCsd|dkrtd��|dkr t|�}x2||krR||d}|||krL|d}q"|}q"W|j||�dS)z�Insert item x in list a, and keep it sorted assuming a is sorted.

    If x is already in a, insert it to the left of the leftmost x.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    rzlo must be non-negativeNrr)rrr)rrr	r
rrrr
�insort_left/s	

rcCsX|dkrtd��|dkr t|�}x2||krR||d}|||krL|d}q"|}q"W|S)a�Return the index where to insert item x in list a, assuming a is sorted.

    The return value i is such that all e in a[:i] have e < x, and all e in
    a[i:] have e >= x.  So if x already appears in the list, a.insert(x) will
    insert just before the leftmost x already there.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    rzlo must be non-negativeNrr)rr)rrr	r
rrrr
�bisect_leftCs

r)�*)rN)rN)rN)rN)	�__doc__rZinsortrZbisectrrZ_bisect�ImportErrorrrrr
�<module>s



cgi.cpython-36.opt-2.pyc000064400000046070150335715140010707 0ustar003

�\dhc��@s�dZddlmZmZmZddlmZddlZddlZddl	Z
ddlmZddl
mZddlmZddlZddlZddlZdd	d
ddd
dddddddddgZdadadd�Zdd�Zdd�Zdd�Zeadadejdddfd d
�Zd4d!d�Zd5d"d�Z d#d
�Z!d$d%�Z"d&d�Z#Gd'd�d�Z$Gd(d	�d	�Z%ejfd)d�Z&d6d*d�Z'ejfd+d�Z(d,d�Z)d-d�Z*d.d�Z+d/d�Z,d7d0d�Z-d1d2�Z.e/d3k�r�e&�dS)8z2.6�)�StringIO�BytesIO�
TextIOWrapper)�MappingN)�
FeedParser)�Message)�warn�MiniFieldStorage�FieldStorage�parse�parse_qs�	parse_qsl�parse_multipart�parse_header�test�print_exception�
print_environ�
print_form�print_directory�print_arguments�print_environ_usage�escape�cGsHtr.tr.yttd�aWntk
r,YnXts8tantat|�dS)N�a)�logfile�logfp�open�OSError�nolog�log�dolog)�allargs�r"�/usr/lib64/python3.6/cgi.py�initlog:s
r$cGstj||d�dS)N�
)r�write)Zfmt�argsr"r"r#r ]sr cGsdS)Nr")r!r"r"r#rasrcCsdatrtj�datadS)Nr)rr�closer$rr"r"r"r#�closeloges
r)c
Cs\|dkrtj}t|d�r |j}nd}t|t�r4|j}d|krDd|d<|ddk�rt|d�\}}|dkrxt|||d�S|d	kr�t	|d
�}t
r�|t
kr�td��|j|�j
|�}	nd}	d
|kr�|	r�|	d}	|	|d
}	n*tjdd��r|	r�|	d}	|	tjd}	|	|d
<n<d
|k�r |d
}	n(tjdd��r<tjd}	nd}	|	|d
<tjj|	|||d�S)N�encodingzlatin-1�REQUEST_METHOD�GET�POST�CONTENT_TYPEzmultipart/form-data)�	separatorz!application/x-www-form-urlencoded�CONTENT_LENGTHzMaximum content length exceededr�QUERY_STRING�&�)r*)�sys�stdin�hasattrr*�
isinstancer�bufferrr�int�maxlen�
ValueError�read�decode�argv�urllibrr)
�fp�environ�keep_blank_values�strict_parsingr/r*�ctype�pdict�clength�qsr"r"r#rxsH




cCs tdtd�tjj||||d�S)Nz=cgi.parse_qs is deprecated, use urllib.parse.parse_qs instead�)r/)r�DeprecationWarningr?rr)rGrBrCr/r"r"r#r�scCs tdtd�tjj||||d�S)Nz?cgi.parse_qsl is deprecated, use urllib.parse.parse_qsl insteadrH)r/)rrIr?rr
)rGrBrCr/r"r"r#r
�scCs�ddl}d}d|kr|d}t|�s2td|f��d|}d|d}i}d}�x�||k�r�d}d}	|r�|jj|�}
|
jd�}|r�yt|�}Wntk
r�YnX|dkr�tr�|tkr�td��|j|�}	nd}	g}xD|j	�}
|
s�|}P|
j
d��r|
j�}|||fk�rP|j|
�q�W|	dk�r&qR|dk�r�|�r�|d}
|
dd�d
k�r^|
dd�}
n|
dd�dk�r||
dd�}
|
|d<dj
|�}	|
d}
|
�s�qRt|
�\}}|d
k�r�qRd|krR|d}nqR||k�r�||j|	�qR|	g||<qRW|S)Nr��boundaryz&Invalid boundary in multipart form: %rs--r3zcontent-lengthzMaximum content length exceededrHs
�
zcontent-dispositionz	form-data�name���rN���rOrNrNrN)Zhttp.client�valid_boundaryr;ZclientZ
parse_headers�getr9r:r<�readline�
startswith�rstrip�append�joinr)r@rEZhttprKZnextpartZlastpartZpartdict�
terminator�bytes�data�headersrF�lines�line�keyZparamsrMr"r"r#r�s|







ccs�x�|dd�dkr�|dd�}|jd�}x<|dkrd|jdd|�|jdd|�drd|jd|d�}q*W|dkrvt|�}|d|�}|j�V||d�}qWdS)Nr3�;r�"z\"rH)�find�count�len�strip)�s�end�fr"r"r#�_parseparam/s
*
rgcCs�td|�}|j�}i}x�|D]�}|jd�}|dkr|d|�j�j�}||dd�j�}t|�dkr�|d|d
ko�dknr�|dd�}|jdd�jd	d�}|||<qW||fS)Nr^�=rr3rHr_z\\�\z\"rNrN)rg�__next__r`rc�lowerrb�replace)r\�partsr]rE�p�irM�valuer"r"r#r;s

,c@s<eZdZdZdZdZdZiZdZiZ	iZ
dd�Zdd�ZdS)r	NcCs||_||_dS)N)rMrp)�selfrMrpr"r"r#�__init__aszMiniFieldStorage.__init__cCsd|j|jfS)NzMiniFieldStorage(%r, %r))rMrp)rqr"r"r#�__repr__gszMiniFieldStorage.__repr__)
�__name__�
__module__�__qualname__�filename�list�type�file�type_options�disposition�disposition_optionsrZrrrsr"r"r"r#r	Ssc@s�eZdZdddejdddddddfdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zd:dd�Z
d;dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdZd&d'�Zd(d)�Zd<Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�ZdS)=r
NrJrzutf-8rlcCsRd}||_||_|
|_||_d|kr0|dj�}d|_|dksF|dkr�d|krX|d}
ntjdd�rrtjd}
nd}
|
jt	j
�d�}
t|
�}|dkr�dd	i}|dkr�i}|d
kr�d	|d<d|kr�|d|d<d|kr�|d|_d|kr�|d|d
<nt|t
tf��std��||_|dk�r*tjj|_n<t|t��r@|j|_n&t|d��oTt|d��s`td��||_||_|	|_t|t��s�tdt|�j��||_d|_||_di}}d|jk�r�t|jd�\}}||_||_ d|_!d|k�r�|d|_!d|_"d|k�r
|d|_"|j"dk	|_#d|jk�r6t|jd�\}}n(|j�sH|d
k�rTdi}}n
d	i}}||_||_$d|k�r�|dj|j�|_%nd|_%d}d
|jk�r�yt&|jd
�}Wnt'k
�r�YnXt(�r�|t(k�r�t'd��||_)|jdk�r�|�r�||_d|_*|_+d|_,|d	k�r$|j-�n*|dd�dk�rF|j.|||�n|j/�dS)Nr,r+ZHEADr1r3r�surrogateescapezcontent-typez!application/x-www-form-urlencodedr-r.r0zcontent-lengthz?headers must be mapping or an instance of email.message.Messager<rRzfp must be file pointerz#outerboundary must be bytes, not %srzcontent-dispositionrMrwz
text/plainrKrJzMaximum content length exceeded�
z
multipart/rN)0rBrC�max_num_fieldsr/�upper�
qs_on_postr4r>�encode�locale�getpreferredencodingrr7rr�	TypeErrorrZr5r8r@rr6r*�errorsrXryrt�
outerboundary�
bytes_read�limitrr|r}rMrw�_binary_filer{�
innerboundaryr9r;r:�lengthrxrz�done�read_urlencoded�
read_multi�read_single)rqr@rZr�rArBrCr�r*r�r�r/�methodrGZcdisprErDZclenr"r"r#rr�s�/












zFieldStorage.__init__cCs(y|jj�Wntk
r"YnXdS)N)rzr(�AttributeError)rqr"r"r#�__del__;szFieldStorage.__del__cCs|S)Nr")rqr"r"r#�	__enter__AszFieldStorage.__enter__cGs|jj�dS)N)rzr()rqr'r"r"r#�__exit__DszFieldStorage.__exit__cCsd|j|j|jfS)NzFieldStorage(%r, %r, %r))rMrwrp)rqr"r"r#rsGszFieldStorage.__repr__cCst|j��S)N)�iter�keys)rqr"r"r#�__iter__LszFieldStorage.__iter__cCsT|dkrt|��|jr:|jjd�|jj�}|jjd�n|jdk	rL|j}nd}|S)Nrpr)r�rz�seekr<rx)rqrMrpr"r"r#�__getattr__Os

zFieldStorage.__getattr__cCsb|jdkrtd��g}x"|jD]}|j|kr|j|�qW|sFt|��t|�dkrZ|dS|SdS)Nz
not indexabler3r)rxr�rMrU�KeyErrorrb)rqr]�found�itemr"r"r#�__getitem__\s

zFieldStorage.__getitem__cCs8||kr0||}t|t�r(dd�|D�S|jSn|SdS)NcSsg|]
}|j�qSr")rp)�.0�xr"r"r#�
<listcomp>osz)FieldStorage.getvalue.<locals>.<listcomp>)r7rxrp)rqr]�defaultrpr"r"r#�getvaluejs
zFieldStorage.getvaluecCs4||kr,||}t|t�r$|djS|jSn|SdS)Nr)r7rxrp)rqr]r�rpr"r"r#�getfirstus

zFieldStorage.getfirstcCs:||kr2||}t|t�r(dd�|D�S|jgSngSdS)NcSsg|]
}|j�qSr")rp)r�r�r"r"r#r��sz(FieldStorage.getlist.<locals>.<listcomp>)r7rxrp)rqr]rpr"r"r#�getlist�s

zFieldStorage.getlistcCs*|jdkrtd��ttdd�|jD���S)Nz
not indexablecss|]}|jVqdS)N)rM)r�r�r"r"r#�	<genexpr>�sz$FieldStorage.keys.<locals>.<genexpr>)rxr��set)rqr"r"r#r��s
zFieldStorage.keyscs*|jdkrtd��t�fdd�|jD��S)Nz
not indexablec3s|]}|j�kVqdS)N)rM)r�r�)r]r"r#r��sz,FieldStorage.__contains__.<locals>.<genexpr>)rxr��any)rqr]r")r]r#�__contains__�s
zFieldStorage.__contains__cCst|j��S)N)rbr�)rqr"r"r#�__len__�szFieldStorage.__len__cCs|jdkrtd��t|j�S)NzCannot be converted to bool.)rxr��bool)rqr"r"r#�__bool__�s
zFieldStorage.__bool__c	Cs�|jj|j�}t|t�s0td|jt|�jf��|j|j	|j
�}|jrT|d|j7}tj
j||j|j|j	|j
|j|jd�}dd�|D�|_|j�dS)Nz%s should return bytes, got %sr2)r*r�r�r/cSsg|]\}}t||��qSr")r	)r�r]rpr"r"r#r��sz0FieldStorage.read_urlencoded.<locals>.<listcomp>)r@r<r�r7rXr;ryrtr=r*r�r�r?rr
rBrCr�r/rx�
skip_lines)rqrG�queryr"r"r#r��s

zFieldStorage.read_urlencodedc
CsB|j}t|�std|f��g|_|jrftjj|j|j|j	|j
|j|j|j
d�}|jjdd�|D��|jpp|j}|jj�}t|t�s�td|jt|�jf��|jt|�7_x6|j�d|jkr�|r�|jj�}|jt|�7_q�W|j}|dk	�r|t|j�8}�x,t�}	d}
x$|jj�}|
|7}
|j��sP�qW|
�sBP|jt|
�7_|	j|
j|j
|j��|	j�}d|k�r�|d=||j||||||j|j|j
|j||j
d	�}
|dk	�r�|d
8}|
j�r�|t|
j�8}|dk�r�td��|j|
j7_|jj|
�|
j �s.|j|j!k�o&dkn�r
P�q
W|j"�dS)
Nz&Invalid boundary in multipart form: %r)r*r�r�r/css|]\}}t||�VqdS)N)r	)r�r]rpr"r"r#r��sz*FieldStorage.read_multi.<locals>.<genexpr>z%s should return bytes, got %ss--rJzcontent-length)r/r3rzMax number of fields exceeded)#r�rPr;rxr�r?rr
rBrCr*r�r�r/�extend�FieldStorageClass�	__class__r@rRr7rXryrtr�rbrcrZfeedr=r(r�rUr�r�r�)rqrArBrCZibr��klassZ
first_liner��parserZhdr_textrYrZ�partr"r"r#r��sj










(zFieldStorage.read_multicCs4|jdkr|j�|j�n|j�|jjd�dS)Nr)r��read_binaryr��
read_linesrzr�)rqr"r"r#r��s


zFieldStorage.read_single�icCs�|j�|_|j}|dkr�xx|dkr�|jjt||j��}t|t�sXt	d|jt
|�jf��|jt
|�7_|svd|_P|jj|�|t
|�}qWdS)Nrz%s should return bytes, got %sr3rN)�	make_filerzr�r@r<�min�bufsizer7rXr;ryrtr�rbr�r&)rqZtodorYr"r"r#r�s


zFieldStorage.read_binarycCs@|jrt�|_|_nt�|_|_|jr4|j�n|j�dS)N)r�rrz�_FieldStorage__filerr��read_lines_to_outerboundary�read_lines_to_eof)rqr"r"r#r�s
zFieldStorage.read_linescCsv|jdk	rF|jj�t|�dkrF|j�|_|jj�}|jj|�d|_|jrZ|jj|�n|jj|j|j	|j
��dS)Ni�)r��tellrbr�rzr�r&r�r=r*r�)rqr\rYr"r"r#Z__writes


zFieldStorage.__writecCs>x8|jjd�}|jt|�7_|s,d|_P|j|�qWdS)Nr3�irN)r@rRr�rbr��_FieldStorage__write)rqr\r"r"r#r�,szFieldStorage.read_lines_to_eofc	Cs,d|j}|d}d}d}d}�x||jkr.P|jjd�}|jt|�7_|t|�7}|sdd
|_P|dkrx||}d}|jd�r�|r�|j�}||kr�P||kr�d|_P|}|j	d�r�d}|dd�}d}nJ|j	d
�r�d
}|dd�}d}n*|j	d��rd}|dd�}d}nd}d}|j
||�q"WdS)Ns--rJTrr3r��
s
rHrLFirNrOrNrN)r�r�r@rRr�rbr�rSrT�endswithr�)	rq�
next_boundary�
last_boundaryZdelim�last_line_lfendZ_readr\�strippedlineZodelimr"r"r#r�6sP



z(FieldStorage.read_lines_to_outerboundarycCs�|js|jrdSd|j}|d}d}xh|jjd�}|jt|�7_|sTd|_P|jd�r�|r�|j�}||krtP||kr�d|_P|jd�}q*WdS)Ns--Tr3r�rLirN)r�r�r@rRr�rbr�rc)rqr�r�r�r\r�r"r"r#r�gs&
zFieldStorage.skip_linescCs&|jrtjd�Stjd|jdd�SdS)Nzwb+zw+r%)r*�newline)r��tempfileZ
TemporaryFiler*)rqr"r"r#r�}s
zFieldStorage.make_file)N)Ni ) rtrurv�osrArrr�r�r�rsr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r"r"r"r#r
ls>+"


D	
1cCs�td�t�tjt_yNt�}t�t�t|�t|�t	�dd�}|fdd�}td�|�Wnt
�YnXtd�day&t�}t�t�t|�t|�Wnt
�YnXdS)	NzContent-type: text/htmlcSstd�dS)Nz,testing print_exception() -- <I>italics?</I>)�execr"r"r"r#rf�sztest.<locals>.fcSs
|�dS)Nr")rfr"r"r#�g�sztest.<locals>.gz9<H3>What follows is a test, not an actual exception:</H3>z*<H1>Second try with a small maxlen...</H1>�2)�printr4�stdout�stderrr
rrrrrrr:)rA�formrfr�r"r"r#r�s4
cCsx|dkrtj�\}}}ddl}t�td�|j||�|j||�}tdtjdj|dd���tj|d�f�~dS)Nrz+<H3>Traceback (most recent call last):</H3>z<PRE>%s<B>%s</B></PRE>rr3rNrN)	r4�exc_info�	tracebackr��	format_tb�format_exception_only�htmlrrV)ryrp�tbr�r�rxr"r"r#r�s
cCs`t|j��}t�td�td�x*|D]"}tdtj|�dtj||��q(Wtd�t�dS)Nz<H3>Shell Environment:</H3>z<DL>z<DT>z<DD>z</DL>)�sortedr�r�r�r)rAr�r]r"r"r#r�s
"cCs�t|j��}t�td�|s&td�td�xb|D]Z}tdtj|�ddd�||}tdtjtt|���d	�td
tjt|���q4Wtd�t�dS)Nz<H3>Form Contents:</H3>z<P>No form fields.z<DL>z<DT>�:� )rez<i>z</i>z<DD>z</DL>)r�r�r�r�r�reprry)r�r�r]rpr"r"r#r�s
cCsjt�td�ytj�}Wn6tk
rP}ztdtjt|���WYdd}~XnXttj|��t�dS)Nz#<H3>Current Working Directory:</H3>zOSError:)r�r��getcwdrr�r�str)�pwd�msgr"r"r#r�s&cCs(t�td�t�ttj�t�dS)Nz <H3>Command Line Arguments:</H3>)r�r4r>r"r"r"r#r�s

cCstd�dS)Na�
<H3>These environment variables could have been set:</H3>
<UL>
<LI>AUTH_TYPE
<LI>CONTENT_LENGTH
<LI>CONTENT_TYPE
<LI>DATE_GMT
<LI>DATE_LOCAL
<LI>DOCUMENT_NAME
<LI>DOCUMENT_ROOT
<LI>DOCUMENT_URI
<LI>GATEWAY_INTERFACE
<LI>LAST_MODIFIED
<LI>PATH
<LI>PATH_INFO
<LI>PATH_TRANSLATED
<LI>QUERY_STRING
<LI>REMOTE_ADDR
<LI>REMOTE_HOST
<LI>REMOTE_IDENT
<LI>REMOTE_USER
<LI>REQUEST_METHOD
<LI>SCRIPT_NAME
<LI>SERVER_NAME
<LI>SERVER_PORT
<LI>SERVER_PROTOCOL
<LI>SERVER_ROOT
<LI>SERVER_SOFTWARE
</UL>
In addition, HTTP headers sent by the server may be passed in the
environment as well.  Here are some common variable names:
<UL>
<LI>HTTP_ACCEPT
<LI>HTTP_CONNECTION
<LI>HTTP_HOST
<LI>HTTP_PRAGMA
<LI>HTTP_REFERER
<LI>HTTP_USER_AGENT
</UL>
)r�r"r"r"r#rs'cCsFtdtdd�|jdd�}|jdd�}|jdd	�}|rB|jd
d�}|S)Nz1cgi.escape is deprecated, use html.escape insteadrH)�
stacklevelr2z&amp;�<z&lt;�>z&gt;r_z&quot;)rrIrl)rdZquoter"r"r#r1s
cCs(ddl}t|t�rd}nd}|j||�S)Nrs^[ -~]{0,200}[!-~]$z^[ -~]{0,200}[!-~]$)�rer7rX�match)rdr�Z_vb_patternr"r"r#rP=s

rP�__main__)rrN)rrN)NNNN)N)0�__version__�iorrr�collectionsrr4r�Zurllib.parser?Zemail.parserrZ
email.messager�warningsrr�r�r��__all__rrr$r rr)rr:rArrr
rrgrr	r
rrrrrrrrrPrtr"r"r"r#�<module>s`#	E

c7'
/

timeit.cpython-36.opt-1.pyc000064400000026525150335715140011442 0ustar003


 \4�@s�dZddlZddlZddlZddlZddddgZdZdZd	Zej	Z
eZd
Z
dd�ZGd
d�d�Zdde
edfdd�Zdde
eedfdd�Zddd�dd�Zedkr�eje��dS)amTool for measuring execution time of small code snippets.

This module avoids a number of common traps for measuring execution
times.  See also Tim Peters' introduction to the Algorithms chapter in
the Python Cookbook, published by O'Reilly.

Library usage: see the Timer class.

Command line usage:
    python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-p] [-h] [--] [statement]

Options:
  -n/--number N: how many times to execute 'statement' (default: see below)
  -r/--repeat N: how many times to repeat the timer (default 3)
  -s/--setup S: statement to be executed once initially (default 'pass').
                Execution time of this setup statement is NOT timed.
  -p/--process: use time.process_time() (default is time.perf_counter())
  -t/--time: use time.time() (deprecated)
  -c/--clock: use time.clock() (deprecated)
  -v/--verbose: print raw timing results; repeat for more digits precision
  -u/--unit: set the output time unit (usec, msec, or sec)
  -h/--help: print this usage message and exit
  --: separate options from statement, use when statement starts with -
  statement: statement to be timed (default 'pass')

A multi-line statement may be given by specifying each line as a
separate argument; indented lines are possible by enclosing an
argument in quotes and using leading spaces.  Multiple -s options are
treated similarly.

If -n is not given, a suitable number of loops is calculated by trying
successive powers of 10 until the total time is at least 0.2 seconds.

Note: there is a certain baseline overhead associated with executing a
pass statement.  It differs between versions.  The code here doesn't try
to hide it, but you should be aware of it.  The baseline overhead can be
measured by invoking the program without arguments.

Classes:

    Timer

Functions:

    timeit(string, string) -> float
    repeat(string, string) -> list
    default_timer() -> float

�N�Timer�timeit�repeat�
default_timerz<timeit-src>i@B�z�
def inner(_it, _timer{init}):
    {setup}
    _t0 = _timer()
    for _i in _it:
        {stmt}
    _t1 = _timer()
    return _t1 - _t0
cCs|jddd|�S)z*Helper to reindent a multi-line statement.�
� )�replace)�src�indent�r�/usr/lib64/python3.6/timeit.py�reindentPsrc@sPeZdZdZddedfdd�Zddd�Zefdd	�Ze	efd
d�Z
ddd
�ZdS)ra�Class for timing execution speed of small code snippets.

    The constructor takes a statement to be timed, an additional
    statement used for setup, and a timer function.  Both statements
    default to 'pass'; the timer function is platform-dependent (see
    module doc string).  If 'globals' is specified, the code will be
    executed within that namespace (as opposed to inside timeit's
    namespace).

    To measure the execution time of the first statement, use the
    timeit() method.  The repeat() method is a convenience to call
    timeit() multiple times and return a list of results.

    The statements may contain newlines, as long as they don't contain
    multi-line string literals.
    �passNcCs�||_i}|dkrt�n|}d}t|t�rJt|td�|d}t|d�}n*t|�rl||d<|d7}d}d}ntd	��t|t�r�t||td�t|d
�}n&t|�r�||d<|d7}d
}ntd��t	j
|||d�}	|	|_t|	td�}
t|
||�|d|_
dS)z#Constructor.  See class doc string.N��execr��_setupz, _setup=_setupz_setup()z&setup is neither a string nor callable�Z_stmtz
, _stmt=_stmtz_stmt()z%stmt is neither a string nor callable)�stmt�setup�init�inner)�timer�_globals�
isinstance�str�compile�dummy_src_namer�callable�
ValueError�template�formatr
rr)�selfrrr�globalsZlocal_nsZ	global_nsrZ
stmtprefixr
�coderrr
�__init__fs6

zTimer.__init__cCsJddl}ddl}|jdk	r:t|j�d|jjd�tf|jt<|j|d�dS)a�Helper to print a traceback from the timed code.

        Typical use:

            t = Timer(...)       # outside the try/except
            try:
                t.timeit(...)    # or t.repeat(...)
            except:
                t.print_exc()

        The advantage over the standard traceback is that source lines
        in the compiled template will be displayed.

        The optional file argument directs where the traceback is
        sent; it defaults to sys.stderr.
        rNr)�file)�	linecache�	tracebackr
�len�splitr�cache�	print_exc)r#r'r(r)rrr
r-�s

zTimer.print_excc
CsBtjd|�}tj�}tj�z|j||j�}Wd|r<tj�X|S)a�Time 'number' executions of the main statement.

        To be precise, this executes the setup statement once, and
        then returns the time it takes to execute the main statement
        a number of times, as a float measured in seconds.  The
        argument is the number of times through the loop, defaulting
        to one million.  The main statement, the setup statement and
        the timer function to be used are passed to the constructor.
        N)�	itertoolsr�gc�	isenabled�disablerr�enable)r#�number�itZgcoldZtimingrrr
r�s

zTimer.timeitcCs.g}x$t|�D]}|j|�}|j|�qW|S)a�Call timeit() a few times.

        This is a convenience function that calls the timeit()
        repeatedly, returning a list of results.  The first argument
        specifies how many times to call timeit(), defaulting to 3;
        the second argument specifies the timer argument, defaulting
        to one million.

        Note: it's tempting to calculate mean and standard deviation
        from the result vector and report these.  However, this is not
        very useful.  In a typical case, the lowest value gives a
        lower bound for how fast your machine can run the given code
        snippet; higher values in the result vector are typically not
        caused by variability in Python's speed, but by other
        processes interfering with your timing accuracy.  So the min()
        of the result is probably the only number you should be
        interested in.  After that, you should look at the entire
        vector and apply common sense rather than statistics.
        )�ranger�append)r#rr3�r�i�trrr
r�s

zTimer.repeatcCsFx<tdd�D].}d|}|j|�}|r0|||�|dkrPqW||fS)a�Return the number of loops and time taken so that total time >= 0.2.

        Calls the timeit method with *number* set to successive powers of
        ten (10, 100, 1000, ...) up to a maximum of one billion, until
        the time taken is at least 0.2 second, or the maximum is reached.
        Returns ``(number, time_taken)``.

        If *callback* is given and is not None, it will be called after
        each trial with two arguments: ``callback(number, time_taken)``.
        ��
g�������?)r5r)r#�callbackr8r3�
time_takenrrr
�	autorange�s

zTimer.autorange)N)N)�__name__�
__module__�__qualname__�__doc__rr&r-�default_numberr�default_repeatrr>rrrr
rTs"
rcCst||||�j|�S)zCConvenience function to create Timer object and call timeit method.)rr)rrrr3r$rrr
r�scCst||||�j||�S)zCConvenience function to create Timer object and call repeat method.)rr)rrrrr3r$rrr
r�s)�_wrap_timerc s^|dkrtjdd�}ddl}y(|j|dddddd	d
ddd
g	�\}}Wn2|jk
rx}zt|�td�dSd}~XnXt}dj|�p�d}d}g}t}	d}
d}dddd�}d��x�|D�]�\}
}|
d9kr�t|�}|
d:kr�|j	|�|
d;k�r||k�r�|}ntdtj
d�dS|
d<k�r0t|�}	|	dk�r0d}	|
d=k�r@tj}|
d>k�rPtj}|
d?k�r`tj
}|
d@k�r�|
�rx�d7�|
d7}
|
dAkr�ttd*d+�dSq�Wdj|��p�d}ddl}tjjd|j�|dk	�r�||�}t|||�}|dk�r(d}|
�r�fd,d-�}y|j|�\}}Wn|j�dSy|j|	|�}Wn|j�dSt|�}|
�rxtd.d*j�fd/d0�|D���td1|d*d+�|d|}|dk	�r�||}n>d2d0�|j�D�}|jd3d4�x|D]\}}||k�r�P�q�Wtd5|	�|||f�t|�}|d|}t|�}||d6k�rZ|d|}ddl}|jd7�|||ftd8d�dS)Ba�Main program, used when run as a script.

    The optional 'args' argument specifies the command line to be parsed,
    defaulting to sys.argv[1:].

    The return value is an exit code to be passed to sys.exit(); it
    may be None to indicate success.

    When an exception happens during timing, a traceback is printed to
    stderr and the return value is 1.  Exceptions at other times
    (including the template compilation) are not caught.

    '_wrap_timer' is an internal interface used for unit testing.  If it
    is not None, it must be a callable that accepts a timer function
    and returns another timer function (used for unit testing).
    Nr:rz
n:u:s:r:tcpvhznumber=zsetup=zrepeat=�time�clockZprocess�verbosezunit=�helpz#use -h/--help for command line help�rrg@�@g��.A)�usecZmsecZsecr�-n�--number�-s�--setup�-u�--unitz4Unrecognized unit. Please select usec, msec, or sec.)r'�-r�--repeat�-t�--time�-c�--clock�-p�	--process�-v�	--verbose�-h�--helpr)�endcsd}t|j||�d��dS)Nz#{num} loops -> {secs:.{prec}g} secs)ZnumZsecsZprec)�printr")r3r=�msg)�	precisionrr
r<@szmain.<locals>.callbackz
raw times:csg|]}d�|f�qS)z%.*gr)�.0�x)rarr
�
<listcomp>Oszmain.<locals>.<listcomp>z	%d loops,cSsg|]\}}||f�qSrr)rbZunit�scalerrr
rdUsT)�reversezbest of %d: %.*g %s per looprztThe test results are likely unreliable. The worst
time (%.*g %s) was more than four times slower than the best time.r)rLrM)rNrO)rPrQ)rRrS)rTrU)rVrW)rXrY)rZr[)r\r])�sys�argv�getopt�errorr_r�joinrD�intr6�stderrrFrGZprocess_timerB�os�path�insert�curdirrr>r-r�min�items�sort�max�warnings�
warn_explicit�UserWarning)�argsrEriZopts�errrrr3rrrHZ	time_unitZunits�o�arnr9r<�_r7ZbestrKreZscalesZworstrvr)rar
�main�s�















r~�__main__)N)rBr/rgrFr.�__all__rrCrDZperf_counterrr$rr!rrrrr~r?�exitrrrr
�<module>3s*
ymodulefinder.cpython-36.opt-1.pyc000064400000035712150335715140012622 0ustar003


 \�Y�@sdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
e
j��e
jde
�ddlZWdQRXejdZejdZejdZejdZeefZejZiZdd	�ZiZd
d�ZGdd
�d
�ZGdd�d�Zdd�Zedk�ry
e�ZWnek
�re d�YnXdS)z3Find modules used by a script, using introspection.�N�ignore�
LOAD_CONST�IMPORT_NAME�
STORE_NAME�STORE_GLOBALcCstj|g�j|�dS)N)�packagePathMap�
setdefault�append)Zpackagename�path�r�$/usr/lib64/python3.6/modulefinder.py�AddPackagePath sr
cCs|t|<dS)N)�replacePackageMap)Zoldname�newnamerrr�ReplacePackage+src@seZdZddd�Zdd�ZdS)�ModuleNcCs(||_||_||_d|_i|_i|_dS)N)�__name__�__file__�__path__�__code__�globalnames�starimports)�self�name�filer
rrr�__init__1szModule.__init__cCsLd|jf}|jdk	r&|d|jf}|jdk	r@|d|jf}|d}|S)Nz	Module(%rz, %r�))rrr)r�srrr�__repr__>s

zModule.__repr__)NN)r�
__module__�__qualname__rrrrrrr/s

rc@s�eZdZddggfdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zd7dd�Z	d9dd�Z
dd�Zdd�Zd:dd�Z
dd�Zdd�Zdd�Zd d!�Zd<d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd=d,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)>�ModuleFinderNrcCsB|dkrtj}||_i|_i|_||_d|_||_||_g|_dS)Nr)	�sysr
�modules�
badmodules�debug�indent�excludes�
replace_paths�processed_paths)rr
r%r'r(rrrrIszModuleFinder.__init__cGs^||jkrZxt|j�D]}tddd�qWt|dd�x|D]}tt|�dd�q<Wt�dS)Nz   � )�end)r%�ranger&�print�repr)r�level�str�args�i�argrrr�msgUs

zModuleFinder.msgcGs,|d}||jkr(|jd|_|j|�dS)Nr�)r%r&r4)rr1r/rrr�msgin^s
zModuleFinder.msgincGs,|d}||jkr(|jd|_|j|�dS)Nrr5)r%r&r4)rr1r/rrr�msgoutds
zModuleFinder.msgoutcCsB|jdd|�t|��"}ddtjf}|jd|||�WdQRXdS)N��
run_script��r�__main__)r4�open�imp�	PY_SOURCE�load_module)r�pathname�fp�stuffrrrr9js
zModuleFinder.run_scriptcCsTtjj|�\}}tjj|�\}}t|��"}|dtjf}|j||||�WdQRXdS)Nr;)�osr
�split�splitextr=r>r?r@)rrA�dirrZextrBrCrrr�	load_fileps

zModuleFinder.load_filer5c	Cs\|jdd||||�|j||d�}|j||�\}}|j||�}|sF|S|jrX|j||�dS)N��import_hook)r/)r4�determine_parent�find_head_package�	load_tailr�ensure_fromlist)	rr�caller�fromlistr/�parent�q�tail�mrrrrJwszModuleFinder.import_hookcCs(|jdd||�|s|dkr.|jdd�dS|j}|dkr�|jrJ|d8}|dkrn|j|}|jdd|�|S|jd�|kr�td��dj|jd�d|��}|j|}|jdd|�|S|jr�|j|}|jdd|�|Sd|k�r|j	d�}|d|�}|j|}|jdd|�|S|jdd�dS)	N�rKrzdetermine_parent -> Noner5zdetermine_parent ->�.zrelative importpath too deep)
r6r7rrr#�count�ImportError�joinrE�rfind)rrOr/ZpnamerQr2rrrrK�s<





zModuleFinder.determine_parentcCs�|jdd||�d|kr@|jd�}|d|�}||dd�}n|}d}|r\d|j|f}n|}|j|||�}|r�|jdd||f�||fS|r�|}d}|j|||�}|r�|jdd||f�||fS|jdd|�td	|��dS)
NrUrLrVr5r:z%s.%szfind_head_package ->z"raise ImportError: No module namedzNo module named )r6�findr�
import_moduler7rX)rrQrr2�headrSZqnamerRrrrrL�s.
zModuleFinder.find_head_packagecCs�|jdd||�|}xz|r�|jd�}|dkr4t|�}|d|�||dd�}}d|j|f}|j|||�}|s|jdd|�td|��qW|jdd	|�|S)
NrUrMrVrr5z%s.%sz"raise ImportError: No module namedzNo module named zload_tail ->)r6r[�lenrr\r7rX)rrRrSrTr2r]ZmnamerrrrM�s
zModuleFinder.load_tailcCs�|jdd|||�xl|D]d}|dkrF|s||j|�}|r||j||d�qt||�sd|j|f}|j|||�}|std|��qWdS)NrUrN�*r5z%s.%szNo module named )r4�find_all_submodulesrN�hasattrrr\rX)rrTrP�	recursive�sub�all�subnameZsubmodrrrrN�s


zModuleFinder.ensure_fromlistc
Cs�|js
dSi}g}|tjjdd�7}|tjjdd�7}|tjjdd�7}x�|jD]�}ytj|�}Wn$tk
r�|j	dd|�wVYnXx\|D]T}d}x6|D].}t
|�}	||	d�|kr�|d|	�}Pq�W|r�|dkr�|||<q�WqVW|j�S)Nr8zcan't list directoryr)r�	importlib�	machinery�EXTENSION_SUFFIXES�SOURCE_SUFFIXES�BYTECODE_SUFFIXESrD�listdir�OSErrorr4r^�keys)
rrTr#�suffixesrG�namesr�modZsuff�nrrrr`�s.

z ModuleFinder.find_all_submodulescCs|jdd|||�y|j|}Wntk
r4YnX|jdd|�|S||jkrb|jdd�dS|r�|jdkr�|jdd�dSy|j||o�|j|�\}}}Wn"tk
r�|jddd�dSXz|j||||�}Wd|r�|j	�X|r�t
|||�|jdd|�|S)NrIr\zimport_module ->zimport_module -> None)r6r#�KeyErrorr7r$r�find_modulerXr@�close�setattr)rZpartname�fqnamerQrTrBrArCrrrr\�s6

zModuleFinder.import_modulecCs|\}}}|jdd||od|�|tjkrH|j||�}|jdd|�|S|tjkrht|j�d|d�}	nj|tjkr�yt	j
j|j��}
Wn:tk
r�}z|jddt
|�|��WYdd}~XnXtj|
�}	nd}	|j|�}||_|	�r
|jr�|j|	�}	|	|_|j|	|�|jdd|�|S)Nr8r@rBzload_module ->�
�execzraise ImportError: )r6r>Z
PKG_DIRECTORY�load_packager7r?�compile�readZPY_COMPILEDrf�_bootstrap_external�_validate_bytecode_headerrXr0�marshal�loads�
add_modulerr(�replace_paths_in_coder�	scan_code)rrvrBrA�	file_info�suffix�mode�typerT�coZmarshal_data�excrrrr@s2





zModuleFinder.load_modulecCs<||jkri|j|<|r*d|j||j<nd|j|d<dS)Nr5�-)r$r)rrrOrrr�_add_badmodule4s


zModuleFinder._add_badmodulecCs||jkr|j||�dSy|j|||d�Wn@tk
rn}z$|jddt|��|j||�WYdd}~Xn�X|�rx�|D]�}||jkr�|j||�q|y|j|||g|d�Wq|tk
r�}z0|jddt|��|d|}|j||�WYdd}~Xq|Xq|WdS)N)r/r8zImportError:rV)r$r�rJrXr4r0)rrrOrPr/r4rc�fullnamerrr�_safe_import_hook<s&


zModuleFinder._safe_import_hookccs�|j}|j}|j}dd�tj|�D�}x�t|�D]�\}\}}|tkrVd||ffVq0|tkr0|dkr0||dd||ddko�tknr0|||dd}	|||dd}
|	dkr�d|
||ffVq0d|	|
||ffVq0q0WdS)	NcSs"g|]\}}}|tkr||f�qSr)�EXTENDED_ARG)�.0�_�opr3rrr�
<listcomp>Xsz-ModuleFinder.scan_opcodes.<locals>.<listcomp>�storer8r5r�absolute_import�relative_import)	�co_code�co_names�	co_consts�disZ_unpack_opargs�	enumerate�	STORE_OPSrr)rr��codero�constsZopargsr2r�Zopargr/rPrrr�scan_opcodesSs 0zModuleFinder.scan_opcodescCs�|j}|j}�xT||�D�]F\}}|dkr<|\}d|j|<q|dk�r|\}}d}	|dk	rtd|krfd}	dd�|D�}|j|||dd�|	�r`d}
|jr�|jj|jd	|�}
|
dkr�|jj|�}
|
dk	r�|jj|
j�|j	j|
j	�|
j
dkr�d|j	|<n
d|j	|<q|d
k�rX|\}}}|�r4|j||||d�n"|j||d�}|j|jd|dd�qt|��qWx,|j
D]"}
t|
t|���rl|j|
|��qlWdS)Nr�r5r�rr_cSsg|]}|dkr|�qS)r_r)r��frrrr�usz*ModuleFinder.scan_code.<locals>.<listcomp>)r/rVr�)r�r�rr�rr#�getr�updaterrrK�RuntimeErrorr��
isinstancer�r�)rr�rTr��scannerZwhatr1rrPZ	have_starZmmr/rQ�crrrr�hsH



zModuleFinder.scan_codecCs�|jdd||�tj|�}|r"|}|j|�}||_|g|_|jtj|g�|_|jd|j�\}}}z"|j||||�|j	dd|�|S|r�|j
�XdS)Nr8ryrzload_package ->)r6rr�r�rrrrsr@r7rt)rrvrArrTrBZbufrCrrrry�s

zModuleFinder.load_packagecCs*||jkr|j|St|�|j|<}|S)N)r#r)rrvrTrrrr��s

zModuleFinder.add_modulecCsr|dk	r|jd|}n|}||jkr<|jdd|�t|��|dkrf|tjkr`ddddtjffS|j}tj	||�S)NrVrIzfind_module -> Excludedr:)
rr'r7rXr"�builtin_module_namesr>Z	C_BUILTINr
rs)rrr
rQr�rrrrs�s

zModuleFinder.find_modulecCs"t�tdd�tdd�t|jj��}xJ|D]B}|j|}|jrTtddd�ntddd�td	||jppd
�q2W|j�\}}|r�t�td�x2|D]*}t|j|j��}td|d
dj|��q�W|�rt�tddd�td�x2|D]*}t|j|j��}td|d
dj|��q�WdS)z�Print a report to stdout, listing the found modules with their
        paths, as well as modules that are missing, or seem to be missing.
        z
  %-25s %s�Name�File�----�Pr*)r+rTz%-25sr:zMissing modules:�?z
imported fromz, z7Submodules that appear to be missing, but could also bez#global names in the parent package:N)r�r�)r�r�)	r-�sortedr#rmrr�any_missing_mayber$rY)rrm�keyrT�missing�mayberZmodsrrr�report�s0



zModuleFinder.reportcCs|j�\}}||S)z�Return a list of modules that appear to be missing. Use
        any_missing_maybe() if you want to know which modules are
        certain to be missing, and which *may* be missing.
        )r�)rr�r�rrr�any_missing�szModuleFinder.any_missingcCs�g}g}x�|jD]�}||jkr q|jd�}|dkr>|j|�q||dd�}|d|�}|jj|�}|dk	r�||j|kr�|j|�q�||jkr�q�|jr�|j|�q�|j|�q|j|�qW|j�|j�||fS)a�Return two lists, one with modules that are certainly missing
        and one with modules that *may* be missing. The latter names could
        either be submodules *or* just global names in the package.

        The reason it can't always be determined is that it's impossible to
        tell which names are imported when "from module import *" is done
        with an extension module, short of actually importing it.
        rVrr5N)	r$r'rZr	r#r�rr�sort)rr�r�rr2reZpkgnameZpkgrrrr��s0	



zModuleFinder.any_missing_maybecCstjj|j�}}x2|jD](\}}|j|�r||t|�d�}PqW|jr�||jkr�||krt|j	dd||f�n|j	dd|f�|jj
|�t|j�}x8t
t|��D](}t||t|��r�|j||�||<q�Wtj|j|j|j|j|j|jt|�|j|j||j|j|j|j|j �S)Nr8zco_filename %r changed to %rz co_filename %r remains unchanged)!rDr
�normpath�co_filenamer(�
startswithr^r%r)r7r	�listr�r,r�r�r��types�CodeType�co_argcount�co_kwonlyargcount�
co_nlocals�co_stacksize�co_flagsr��tupler��co_varnames�co_name�co_firstlineno�	co_lnotab�co_freevars�co_cellvars)rr�Znew_filenameZoriginal_filenamer�r;r�r2rrrr�s,



z"ModuleFinder.replace_paths_in_code���)NNr�r�)r�)rr�)r�)N)rrr rr4r6r7r9rHrJrKrLrMrNr`r\r@r�r�r�r�ryr�rsr�r�r�r�rrrrr!Gs2	

#

1
".r!cCs�ddl}y|jtjdd�d�\}}Wn*|jk
rP}zt|�dSd}~XnXd}d}g}g}xb|D]Z\}}	|dkr�|d}|dkr�d}|dkr�||	jtj�}|dkr�d}|dkrh|j|	�qhW|s�d	}
n|d}
tj	dd�}tj	j
|
�|d<||}|dk�r.td
�x|D]}tdt|���qWt|||�}
xp|dd�D]`}|dk�r^d}�qH|�r�|dd�d
k�r�|
j
|dd�ddg�n
|
j
|�n
|
j|��qHW|
j|
�|
j�|
S)Nrr5zdmp:qx:z-dz-mz-pz-qz-xzhello.pyzpath:z   r8z.*r_���r�)�getoptr"�argv�errorr-rErD�pathsepr	r
�dirnamer.r!rJrHr9r�)r�Zoptsr1r4r%ZdomodsZaddpathZexclude�o�aZscriptr
�item�mfr3rrr�test:sX



r�r<z
[interrupted])!�__doc__r�Zimportlib._bootstrap_externalrf�importlib.machineryr~rDr"r�Zstruct�warnings�catch_warnings�simplefilter�DeprecationWarningr>Zopmaprrrrr�r�rr
rrrr!r�rr��KeyboardInterruptr-rrrr�<module>sB




v;

struct.cpython-36.opt-1.pyc000064400000000472150335715140011464 0ustar003


 \�@s8ddddddddgZdd	lTdd
lmZddlmZdS)
ZcalcsizeZpackZ	pack_intoZunpackZunpack_fromZiter_unpackZStruct�error�)�*)�_clearcache)�__doc__N)�__all__Z_structrr�rr�/usr/lib64/python3.6/struct.py�<module>s
functools.cpython-36.opt-1.pyc000064400000057000150335715140012153 0ustar003


 \rz�+@s�dZddddddddd	d
dgZydd
lmZWnek
rBYnXddlmZddlmZddl	m
Z
ddlmZddl
mZyddlmZWn"ek
r�Gdd�d�ZYnXdZZd[Zeefdd�Zeefdd�Zefdd�Zefd d!�Zefd"d#�Zefd$d%�Zefd&d'�Zefd(d)�Zefd*d+�Zefd,d-�Zefd.d/�Zefd0d1�Zefd2d3�Z efd4d5�Z!d6efd7efd8efgd8efd9efd6efgd9efd8efd7efgd7efd6e fd9e!fgd:�Z"d;d�Z#d<d�Z$ydd=lm$Z$Wnek
�r�YnXGd>d	�d	�Z%ydd?lm%Z%Wnek
�r*YnXGd@d
�d
e&�Z'edAdBdCdDdEg�Z(GdFdG�dGe)�Z*e&�fe+e,e-e.dH�he/e.e0fdIdJ�Z1d\dMd�Z2dNdO�Z3yddPlm3Z3Wnek
�r�YnXdQdR�Z4d]dSdT�Z5dUdV�Z6dWdX�Z7dYd�Z8dHS)^zEfunctools.py - Tools for working with functions and callable objects
�update_wrapper�wraps�WRAPPER_ASSIGNMENTS�WRAPPER_UPDATES�total_ordering�
cmp_to_key�	lru_cache�reduce�partial�
partialmethod�singledispatch�)r)�get_cache_token)�
namedtuple)�MappingProxyType)�WeakKeyDictionary)�recursive_repr)�RLockc@s eZdZdZdd�Zdd�ZdS)rz/Dummy reentrant lock for builds without threadscCsdS)N�)�selfrr�!/usr/lib64/python3.6/functools.py�	__enter__szRLock.__enter__cCsdS)Nr)r�exctype�excinst�exctbrrr�__exit__szRLock.__exit__N)�__name__�
__module__�__qualname__�__doc__rrrrrrrsrrrrr�__annotations__�__dict__c
Csnx<|D]4}yt||�}Wntk
r,YqXt|||�qWx$|D]}t||�jt||i��qDW||_|S)aUpdate a wrapper function to look like the wrapped function

       wrapper is the function to be updated
       wrapped is the original function
       assigned is a tuple naming the attributes assigned directly
       from the wrapped function to the wrapper function (defaults to
       functools.WRAPPER_ASSIGNMENTS)
       updated is a tuple naming the attributes of the wrapper that
       are updated with the corresponding attribute from the wrapped
       function (defaults to functools.WRAPPER_UPDATES)
    )�getattr�AttributeError�setattr�update�__wrapped__)�wrapper�wrapped�assigned�updated�attr�valuerrrr,s

cCstt|||d�S)a�Decorator factory to apply update_wrapper() to a wrapper function

       Returns a decorator that invokes update_wrapper() with the decorated
       function as the wrapper argument and the arguments to wraps() as the
       remaining arguments. Default arguments are as for update_wrapper().
       This is a convenience function to simplify applying partial() to
       update_wrapper().
    )r'r(r))r	r)r'r(r)rrrrJscCs$|j|�}||kr|S|o"||kS)zIReturn a > b.  Computed by @total_ordering from (not a < b) and (a != b).)�__lt__)r�other�NotImplemented�	op_resultrrr�_gt_from_ltbs
r0cCs|j|�}|p||kS)zEReturn a <= b.  Computed by @total_ordering from (a < b) or (a == b).)r,)rr-r.r/rrr�_le_from_ltis
r1cCs|j|�}||kr|S|S)z=Return a >= b.  Computed by @total_ordering from (not a < b).)r,)rr-r.r/rrr�_ge_from_ltns
r2cCs$|j|�}||kr|S|p"||kS)zJReturn a >= b.  Computed by @total_ordering from (not a <= b) or (a == b).)�__le__)rr-r.r/rrr�_ge_from_leus
r4cCs"|j|�}||kr|S|o ||kS)zFReturn a < b.  Computed by @total_ordering from (a <= b) and (a != b).)r3)rr-r.r/rrr�_lt_from_le|s
r5cCs|j|�}||kr|S|S)z=Return a > b.  Computed by @total_ordering from (not a <= b).)r3)rr-r.r/rrr�_gt_from_le�s
r6cCs$|j|�}||kr|S|o"||kS)zIReturn a < b.  Computed by @total_ordering from (not a > b) and (a != b).)�__gt__)rr-r.r/rrr�_lt_from_gt�s
r8cCs|j|�}|p||kS)zEReturn a >= b.  Computed by @total_ordering from (a > b) or (a == b).)r7)rr-r.r/rrr�_ge_from_gt�s
r9cCs|j|�}||kr|S|S)z=Return a <= b.  Computed by @total_ordering from (not a > b).)r7)rr-r.r/rrr�_le_from_gt�s
r:cCs$|j|�}||kr|S|p"||kS)zJReturn a <= b.  Computed by @total_ordering from (not a >= b) or (a == b).)�__ge__)rr-r.r/rrr�_le_from_ge�s
r<cCs"|j|�}||kr|S|o ||kS)zFReturn a > b.  Computed by @total_ordering from (a >= b) and (a != b).)r;)rr-r.r/rrr�_gt_from_ge�s
r=cCs|j|�}||kr|S|S)z=Return a < b.  Computed by @total_ordering from (not a >= b).)r;)rr-r.r/rrr�_lt_from_ge�s
r>r7r3r;r,)r,r3r7r;csZ�fdd�tD�}|std��t|�}x.t|D]"\}}||kr0||_t�||�q0W�S)z6Class decorator that fills in missing ordering methodscs(g|] }t�|d�tt|d�k	r|�qS)N)r!�object)�.0�op)�clsrr�
<listcomp>�sz"total_ordering.<locals>.<listcomp>z6must define at least one ordering operation: < > <= >=)�_convert�
ValueError�maxrr#)rB�roots�root�opname�opfuncr)rBrr�scsG�fdd�dt�}|S)z,Convert a cmp= function into a key= functioncsZeZdZdgZdd�Z�fdd�Z�fdd�Z�fdd	�Z�fd
d�Z�fdd
�Z	dZ
dS)zcmp_to_key.<locals>.K�objcSs
||_dS)N)rK)rrKrrr�__init__�szcmp_to_key.<locals>.K.__init__cs�|j|j�dkS)Nr)rK)rr-)�mycmprrr,�szcmp_to_key.<locals>.K.__lt__cs�|j|j�dkS)Nr)rK)rr-)rMrrr7�szcmp_to_key.<locals>.K.__gt__cs�|j|j�dkS)Nr)rK)rr-)rMrr�__eq__�szcmp_to_key.<locals>.K.__eq__cs�|j|j�dkS)Nr)rK)rr-)rMrrr3�szcmp_to_key.<locals>.K.__le__cs�|j|j�dkS)Nr)rK)rr-)rMrrr;�szcmp_to_key.<locals>.K.__ge__N)rrr�	__slots__rLr,r7rNr3r;�__hash__r)rMrr�K�srQ)r?)rMrQr)rMrr�s)rcsJeZdZdZdZ�fdd�Zd	d
�Ze�dd��Zd
d�Z	dd�Z
�ZS)r	zSNew function with partial application of the given arguments
    and keywords.
    �func�args�keywordsr �__weakref__cs�|std��t|�dkr td��|^}}}t|�s:td��t|�}t|d�rv|j|}|jj�}|j|�|}~|j	}t
t|�j|�}||_	||_||_|S)Nz1descriptor '__new__' of partial needs an argument�z*type 'partial' takes at least one argumentz#the first argument must be callablerR)
�	TypeError�len�callable�tuple�hasattrrSrT�copyr$rR�superr	�__new__)rSrTrBrRZtmpkwr)�	__class__rrr^�s(




zpartial.__new__cOs:|std��|^}}|jj�}|j|�|j|j|�|�S)Nz2descriptor '__call__' of partial needs an argument)rWrTr\r$rRrS)rSrTrZnewkeywordsrrr�__call__s

zpartial.__call__cCs�t|�j}t|j�g}|jdd�|jD��|jdd�|jj�D��t|�jdkrld|�ddj	|��d�S|�ddj	|��d�S)	Ncss|]}t|�VqdS)N)�repr)r@�xrrr�	<genexpr>sz#partial.__repr__.<locals>.<genexpr>css |]\}}|�d|��VqdS)�=Nr)r@�k�vrrrrcs�	functoolsz
functools.�(z, �))
�typerrarR�extendrSrT�itemsr�join)r�qualnamerSrrr�__repr__s
zpartial.__repr__cCs*t|�|jf|j|j|jpd|jp$dffS)N)rjrRrSrTr )rrrr�
__reduce__#szpartial.__reduce__cCs�t|t�std��t|�dkr0tdt|�����|\}}}}t|�szt|t�sz|dk	rft|t�sz|dk	r�t|t�r�td��t|�}|dkr�i}nt|�tk	r�t|�}|dkr�i}||_||_||_	||_
dS)Nz(argument to __setstate__ must be a tuple�zexpected 4 items in state, got zinvalid partial state)�
isinstancerZrWrXrY�dictrjr rRrSrT)r�staterRrS�kwds�	namespacerrr�__setstate__'s(
zpartial.__setstate__)rRrSrTr rU)rrrrrOr^r`rrorprw�
__classcell__rr)r_rr	�s
)r	c@s<eZdZdZdd�Zdd�Zdd�Zdd	�Zed
d��Z	dS)
r
z�Method descriptor with partial application of the given arguments
    and keywords.

    Supports wrapping existing descriptors and handles non-descriptor
    callables as instance methods.
    cOsrt|�r$t|d�r$tdj|���t|t�r\|j|_|j||_|jj	�|_|jj
|�n||_||_||_dS)N�__get__z${!r} is not callable or a descriptor)rYr[rW�formatrrr
rRrSrTr\r$)rrRrSrTrrrrLMs
zpartialmethod.__init__cCsNdjtt|j��}djdd�|jj�D��}d}|j|jj|jj	|j
||d�S)Nz, css|]\}}dj||�VqdS)z{}={!r}N)rz)r@rerfrrrrccsz)partialmethod.__repr__.<locals>.<genexpr>z*{module}.{cls}({func}, {args}, {keywords}))�modulerBrRrSrT)rm�maprarSrTrlrzr_rrrR)rrSrT�
format_stringrrrroas

zpartialmethod.__repr__cs�fdd�}�j|_�|_|S)Ncs<�jj�}|j|�|^}}|f�jt|�}�j||�S)N)rTr\r$rSrZrR)rSrT�
call_keywords�cls_or_self�rest�	call_args)rrr�_methodms


z3partialmethod._make_unbound_method.<locals>._method)�__isabstractmethod__�_partialmethod)rr�r)rr�_make_unbound_methodlsz"partialmethod._make_unbound_methodcCs�t|jdd�}d}|dk	rd|||�}||jk	rdt|f|j�|j�}y|j|_Wntk
rbYnX|dkr||j�j||�}|S)Nry)	r!rRr	rSrT�__self__r"r�ry)rrKrB�get�result�new_funcrrrryws

zpartialmethod.__get__cCst|jdd�S)Nr�F)r!rR)rrrrr��sz"partialmethod.__isabstractmethod__N)
rrrrrLror�ry�propertyr�rrrrr
Es�	CacheInfo�hits�misses�maxsize�currsizec@s(eZdZdZdZefdd�Zdd�ZdS)�
_HashedSeqz� This class guarantees that hash() will be called no more than once
        per element.  This is important because the lru_cache() will hash
        the key multiple times on a cache miss.

    �	hashvaluecCs||dd�<||�|_dS)N)r�)r�tup�hashrrrrL�sz_HashedSeq.__init__cCs|jS)N)r�)rrrrrP�sz_HashedSeq.__hash__N)rrrrrOr�rLrPrrrrr��sr�Nc
s�|}|r*||7}x|j�D]}	||	7}qW|rl||�fdd�|D��7}|r�||�fdd�|j�D��7}n$||�dkr��|d�|kr�|dSt|�S)a�Make a cache key from optionally typed positional and keyword arguments

    The key is constructed in a way that is flat as possible rather than
    as a nested structure that would take more memory.

    If there is only a single argument and its data type is known to cache
    its hash value, then that argument is returned without a wrapper.  This
    saves space and improves lookup speed.

    c3s|]}�|�VqdS)Nr)r@rf)rjrrrc�sz_make_key.<locals>.<genexpr>c3s|]}�|�VqdS)Nr)r@rf)rjrrrc�s�r)rl�valuesr�)
rSru�typed�kwd_mark�	fasttypesrZrjrX�key�itemr)rjr�	_make_key�s r��Fcs.�dk	rt�t�rtd����fdd�}|S)a�Least-recently-used cache decorator.

    If *maxsize* is set to None, the LRU features are disabled and the cache
    can grow without bound.

    If *typed* is True, arguments of different types will be cached separately.
    For example, f(3.0) and f(3) will be treated as distinct calls with
    distinct results.

    Arguments to the cached function must be hashable.

    View the cache statistics named tuple (hits, misses, maxsize, currsize)
    with f.cache_info().  Clear the cache and statistics with f.cache_clear().
    Access the underlying function with f.__wrapped__.

    See:  http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used

    Nz)Expected maxsize to be an integer or Nonecst|��t�}t||�S)N)�_lru_cache_wrapper�
_CacheInfor)�
user_functionr&)r�r�rr�decorating_function�sz&lru_cache.<locals>.decorating_function)rr�intrW)r�r�r�r)r�r�rr�scs�t��t�d\����i�d�	�
d��j��j�t��
g���ddg�dd�<�dkrh�
�fdd�}nN�dkr����	��
���fdd�}n*���������	�
���
���fd	d�}���	�
��
fd
d�}���	�
�
�fdd
�}||_||_|S)Nrr�rV�Fcs�||�}�d7�|S)Nr�r)rSrur�)r�r�rrr&�s
z#_lru_cache_wrapper.<locals>.wrappercsH�||��}�|��}|�k	r*�d7�|S�||�}|�|<�d7�|S)Nr�r)rSrur�r�)�cache�	cache_getr��make_keyr��sentinelr�r�rrr&�s

cs2�
||��}�	�f�|�}|dk	rr|\}}}}||�<||�<�
�}||�<�
�<||�<�
|�<�d7�|SWdQRX�||�}�	��|�kr�n��r�
}	||	�<||	�<|	��
�
�}
�
�}d�
�<�
�<�|
=|	�|<n6�
�}|�
||g}||�<�
�<�|<���k��d7�WdQRX|S)Nr�r)rSrur��linkZ	link_prevZ	link_nextZ_keyr�ZlastZoldrootZoldkeyZ	oldresult)�KEY�NEXT�PREV�RESULTr�r��	cache_len�fullr��lockr�r�r�rHr�r�rrr&sB


cs ���������SQRXdS)zReport cache statisticsNrr)r�r�r�r�r�r�rr�
cache_infoGsz&_lru_cache_wrapper.<locals>.cache_infocs<��.�j���ddg�dd�<d��d�WdQRXdS)z$Clear the cache and cache statisticsNrF)�clearr)r�r�r�r�r�rHrr�cache_clearLs
z'_lru_cache_wrapper.<locals>.cache_clear)rr�rVr�)r?r�r��__len__rr�r�)r�r�r�r�r&r�r�r)r�r�r�r�r�r�r�r�r�r�r�r�r�r�rHr�r�r�rr��s**9	r�)r�cCs�g}x�dd�|D�}|s|Sx:|D]2}|d}x$|D]}||dd�kr4d}Pq4WPq"W|dkrhtd��|j|�x|D]}|d|krx|d=qxWqWdS)z�Merges MROs in *sequences* to a single MRO using the C3 algorithm.

    Adapted from http://www.python.org/download/releases/2.3/mro/.

    cSsg|]}|r|�qSrr)r@�srrrrCksz_c3_merge.<locals>.<listcomp>rr�NzInconsistent hierarchy)�RuntimeError�append)�	sequencesr��s1�	candidate�s2�seqrrr�	_c3_mergecs$



r�c
s&x8tt|j��D]"\}�t�d�rt|j�|}PqWd}�rFt��ng�t|jd|��}g}t|j|d��}x:�D]2�t|��rxt�fdd�|jD��rx|j��qxWx|D]��j	��q�W�fdd�|D�}�fdd�|D�}�fd	d�|D�}	t
|gg|||	|g|g|g�S)
a�Computes the method resolution order using extended C3 linearization.

    If no *abcs* are given, the algorithm works exactly like the built-in C3
    linearization used for method resolution.

    If given, *abcs* is a list of abstract base classes that should be inserted
    into the resulting MRO. Unrelated ABCs are ignored and don't end up in the
    result. The algorithm inserts ABCs where their functionality is introduced,
    i.e. issubclass(cls, abc) returns True for the class itself but returns
    False for all its direct base classes. Implicit ABCs for a given class
    (either registered or inferred from the presence of a special method like
    __len__) are inserted directly after the last ABC explicitly listed in the
    MRO of said class. If two implicit ABCs end up next to each other in the
    resulting MRO, their ordering depends on the order of types in *abcs*.

    �__abstractmethods__rNc3s|]}t|��VqdS)N)�
issubclass)r@�b)�baserrrc�sz_c3_mro.<locals>.<genexpr>csg|]}t|�d��qS))�abcs)�_c3_mro)r@r�)r�rrrC�sz_c3_mro.<locals>.<listcomp>csg|]}t|�d��qS))r�)r�)r@r�)r�rrrC�scsg|]}t|�d��qS))r�)r�)r@r�)r�rrrC�s)�	enumerate�reversed�	__bases__r[rX�listr��anyr��remover�)
rBr��i�boundary�explicit_bases�abstract_bases�other_bases�explicit_c3_mros�abstract_c3_mros�
other_c3_mrosr)r�r�rr�~s(


r�cs�t�j����fdd���fdd��D���fdd���fdd��D��t���g}x��D]�}g}x<|j�D]0}|�krlt�|�rl|j�fdd�|jD��qlW|s�|j|�qZ|jtd	d
�x,|D]$}x|D]}||kr�|j|�q�Wq�WqZWt�|d�S)z�Calculates the method resolution order for a given class *cls*.

    Includes relevant abstract base classes (with their respective bases) from
    the *types* iterable. Uses a modified C3 linearization algorithm.

    cs|�kot|d�ot�|�S)N�__mro__)r[r�)�typ)�basesrBrr�
is_related�sz _compose_mro.<locals>.is_relatedcsg|]}�|�r|�qSrr)r@�n)r�rrrC�sz _compose_mro.<locals>.<listcomp>cs(x"�D]}||kr||jkrdSqWdS)NTF)r�)r�r-)�typesrr�is_strict_base�s
z$_compose_mro.<locals>.is_strict_basecsg|]}�|�s|�qSrr)r@r�)r�rrrC�scsg|]}|�kr|�qSrr)r@r�)�type_setrrrC�sT)r��reverse)r�)�setr��__subclasses__r�r��sortrXr�)rBr��mror��found�sub�subclsr)r�rBr�r�r�r�r�_compose_mro�s*




r�cCsxt||j��}d}xZ|D]R}|dk	r^||kr\||jkr\||jkr\t||�r\tdj||���P||kr|}qW|j|�S)a^Returns the best matching implementation from *registry* for type *cls*.

    Where there is no registered implementation for a specific type, its method
    resolution order is used to find a more generic implementation.

    Note: if *registry* does not contain an implementation for the base
    *object* type, this function may return None.

    NzAmbiguous dispatch: {} or {})r��keysr�r�r�rzr�)rB�registryr��match�trrr�
_find_impl�s



r�cs�i�t��d����fdd��d
����fdd�	���fdd�}t|dd	��|�t<�|_�|_t��|_�j|_t	||�|S)alSingle-dispatch generic function decorator.

    Transforms a function into a generic function, which can have different
    behaviours depending upon the type of its first argument. The decorated
    function acts as the default implementation, and additional
    implementations can be registered using the register() attribute of the
    generic function.

    Ncs|�dk	r"t�}�|kr"�j�|�y�|}WnHtk
rvy�|}Wntk
rht|��}YnX|�|<YnX|S)z�generic_func.dispatch(cls) -> <function implementation>

        Runs the dispatch algorithm to return the best available implementation
        for the given *cls* registered on *generic_func*.

        N)r
r��KeyErrorr�)rB�
current_token�impl)�cache_token�dispatch_cacher�rr�dispatch�sz singledispatch.<locals>.dispatchcsB|dkr��fdd�S|��<�dkr6t�d�r6t���j�|S)z�generic_func.register(cls, func) -> func

        Registers a new implementation for the given *cls* on a *generic_func*.

        Ncs
��|�S)Nr)�f)rB�registerrr�<lambda>sz2singledispatch.<locals>.register.<locals>.<lambda>r�)r[r
r�)rBrR)r�r�r�r�)rBrr�sz singledispatch.<locals>.registercs&|st��d����|dj�||�S)Nz( requires at least 1 positional argumentr)rWr_)rS�kw)r��funcnamerrr&"szsingledispatch.<locals>.wrapperrzsingledispatch function)N)
rr!r?r�r�rr�r��_clear_cacher)rRr&r)r�r�r�r�r�r�rr�s


)rrrrr)r )r�F)N)9r�__all__�
_functoolsr�ImportError�abcr
�collectionsrr�r�weakrefr�reprlibr�_threadrrrrrr.r0r1r2r4r5r6r8r9r:r<r=r>rDrrr	r?r
r�r�r�r��str�	frozensetrjrZrXr�rr�r�r�r�r�rrrrr�<module>s�


NN
%t
-)optparse.cpython-36.opt-1.pyc000064400000135564150335715140012010 0ustar003


 \���@s�dZdZdddddddd	d
ddd
dddddgZdZddlZddlZddlZdd�ZyddlmZm	Z	Wn$e
k
r�dd�Zdd�Z	YnXeZGdd
�d
e�Z
Gdd�de
�ZGdd�de�ZGd d�de
�ZGd!d�de
�ZGd"d#�d#e�ZGd$d
�d
�ZGd%d�de�ZGd&d�de�Zd'd(�Zd)d*�Zeed+�feed+�feed,�feed-�fd.�Zd/d0�Zd1d�Zd>ZGd4d�d�Zd?Zd@Z Gd8d�d�Z!Gd9d�d�Z"Gd:d�de"�Z#Gd;d	�d	e"�Z$d<d=�Z%eZ&dS)Aa�A powerful, extensible, and easy-to-use option parser.

By Greg Ward <gward@python.net>

Originally distributed as Optik.

For support, use the optik-users@lists.sourceforge.net mailing list
(http://lists.sourceforge.net/lists/listinfo/optik-users).

Simple usage example:

   from optparse import OptionParser

   parser = OptionParser()
   parser.add_option("-f", "--file", dest="filename",
                     help="write report to FILE", metavar="FILE")
   parser.add_option("-q", "--quiet",
                     action="store_false", dest="verbose", default=True,
                     help="don't print status messages to stdout")

   (options, args) = parser.parse_args()
z1.5.3�Option�make_option�
SUPPRESS_HELP�SUPPRESS_USAGE�Values�OptionContainer�OptionGroup�OptionParser�
HelpFormatter�IndentedHelpFormatter�TitledHelpFormatter�
OptParseError�OptionError�OptionConflictError�OptionValueError�BadOptionError�check_choicea"
Copyright (c) 2001-2006 Gregory P. Ward.  All rights reserved.
Copyright (c) 2002-2006 Python Software Foundation.  All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

  * Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.

  * Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.

  * Neither the name of the author nor the names of its
    contributors may be used to endorse or promote products derived from
    this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
�NcCsd|jjt|�|fS)Nz<%s at 0x%x: %s>)�	__class__�__name__�id)�self�r� /usr/lib64/python3.6/optparse.py�_reprOsr)�gettext�ngettextcCs|S)Nr)�messagerrrr\srcCs|dkr|S|S)N�r)ZsingularZplural�nrrrr_src@seZdZdd�Zdd�ZdS)rcCs
||_dS)N)�msg)rrrrr�__init__hszOptParseError.__init__cCs|jS)N)r)rrrr�__str__kszOptParseError.__str__N)r�
__module__�__qualname__r r!rrrrrgsc@s eZdZdZdd�Zdd�ZdS)r
z]
    Raised if an Option instance is created with invalid or
    inconsistent arguments.
    cCs||_t|�|_dS)N)r�str�	option_id)rr�optionrrrr uszOptionError.__init__cCs |jrd|j|jfS|jSdS)Nz
option %s: %s)r%r)rrrrr!yszOptionError.__str__N)rr"r#�__doc__r r!rrrrr
osc@seZdZdZdS)rzE
    Raised if conflicting options are added to an OptionParser.
    N)rr"r#r'rrrrrsc@seZdZdZdS)rzS
    Raised if an invalid option value is encountered on the command
    line.
    N)rr"r#r'rrrrr�sc@s eZdZdZdd�Zdd�ZdS)rzB
    Raised if an invalid option is seen on the command line.
    cCs
||_dS)N)�opt_str)rr(rrrr �szBadOptionError.__init__cCstd�|jS)Nzno such option: %s)�_r()rrrrr!�szBadOptionError.__str__N)rr"r#r'r r!rrrrr�sc@s eZdZdZdd�Zdd�ZdS)�AmbiguousOptionErrorzD
    Raised if an ambiguous option is seen on the command line.
    cCstj||�||_dS)N)rr �
possibilities)rr(r+rrrr �szAmbiguousOptionError.__init__cCstd�|jdj|j�fS)Nzambiguous option: %s (%s?)z, )r)r(�joinr+)rrrrr!�szAmbiguousOptionError.__str__N)rr"r#r'r r!rrrrr*�sr*c@s�eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!S)"r	a�
    Abstract base class for formatting option help.  OptionParser
    instances should use one of the HelpFormatter subclasses for
    formatting help; by default IndentedHelpFormatter is used.

    Instance attributes:
      parser : OptionParser
        the controlling OptionParser instance
      indent_increment : int
        the number of columns to indent per nesting level
      max_help_position : int
        the maximum starting column for option help text
      help_position : int
        the calculated starting column for option help text;
        initially the same as the maximum
      width : int
        total number of columns for output (pass None to constructor for
        this value to be taken from the $COLUMNS environment variable)
      level : int
        current indentation level
      current_indent : int
        current indentation level (in columns)
      help_width : int
        number of columns available for option help text (calculated)
      default_tag : str
        text to replace with each option's default value, "%default"
        by default.  Set to false value to disable default value expansion.
      option_strings : { Option : str }
        maps Option instances to the snippet of help text explaining
        the syntax of that option, e.g. "-h, --help" or
        "-fFILE, --file=FILE"
      _short_opt_fmt : str
        format string controlling how short options with values are
        printed in help text.  Must be either "%s%s" ("-fFILE") or
        "%s %s" ("-f FILE"), because those are the two syntaxes that
        Optik supports.
      _long_opt_fmt : str
        similar but for long options; must be either "%s %s" ("--file FILE")
        or "%s=%s" ("--file=FILE").
    ZnonecCs�d|_||_|dkrLyttjd�}Wnttfk
rBd}YnX|d8}||_t|t	|d|d��|_
|_d|_d|_
d|_||_d|_i|_d|_d|_dS)	NZCOLUMNS�P��rz%defaultz%s %sz%s=%s)�parser�indent_increment�int�os�environ�KeyError�
ValueError�width�min�max�
help_position�max_help_position�current_indent�level�
help_width�short_first�default_tag�option_strings�_short_opt_fmt�
_long_opt_fmt)rr1r;r7r?rrrr �s$
 zHelpFormatter.__init__cCs
||_dS)N)r0)rr0rrr�
set_parser�szHelpFormatter.set_parsercCs&|dkrtd|��d|d|_dS)N�� z/invalid metavar delimiter for short options: %rz%s)rErF)r6rB)r�delimrrr�set_short_opt_delimiter�s
z%HelpFormatter.set_short_opt_delimitercCs&|dkrtd|��d|d|_dS)N�=rFz.invalid metavar delimiter for long options: %rz%s)rIrF)r6rC)rrGrrr�set_long_opt_delimiter�s
z$HelpFormatter.set_long_opt_delimitercCs"|j|j7_|jd7_dS)Nr)r<r1r=)rrrr�indent�szHelpFormatter.indentcCs"|j|j8_|jd8_dS)Nr)r<r1r=)rrrr�dedent�szHelpFormatter.dedentcCstd��dS)Nzsubclasses must implement)�NotImplementedError)r�usagerrr�format_usage�szHelpFormatter.format_usagecCstd��dS)Nzsubclasses must implement)rM)r�headingrrr�format_headingszHelpFormatter.format_headingcCs.t|j|jd�}d|j}tj||||d�S)z�
        Format a paragraph of free-form text for inclusion in the
        help output at the current indentation level.
        �rF)Zinitial_indentZsubsequent_indent)r9r7r<�textwrapZfill)r�textZ
text_widthrKrrr�_format_texts
zHelpFormatter._format_textcCs|r|j|�dSdSdS)N�
rE)rU)r�descriptionrrr�format_descriptionsz HelpFormatter.format_descriptioncCs|rd|j|�dSdSdS)NrVrE)rU)r�epilogrrr�
format_epilogszHelpFormatter.format_epilogcCsR|jdks|jr|jS|jjj|j�}|tks8|dkr>|j}|jj|jt	|��S)N)
r0r@�help�defaults�get�dest�
NO_DEFAULT�NO_DEFAULT_VALUE�replacer$)rr&Z
default_valuerrr�expand_defaultszHelpFormatter.expand_defaultcs�g}�j|}�j�jd}t|�|krBd�jd|f}�j}nd�jd||f}d}|j|�|jr��j|�}tj|�j	�}|jd|d|df�|j
�fdd�|dd�D��n|d
d	kr�|jd	�dj|�S)Nr.z%*s%s
rEz	%*s%-*s  rcsg|]}d�jd|f�qS)z%*s%s
rE)r:)�.0�line)rrr�
<listcomp>Esz/HelpFormatter.format_option.<locals>.<listcomp>rrV���)rAr:r<�len�appendr[rbrSZwrapr>�extendr,)rr&�result�optsZ	opt_widthZindent_firstZ	help_textZ
help_linesr)rr�
format_option(s$



zHelpFormatter.format_optioncCs�|j�d}x6|jD],}|j|�}||j|<t|t|�|j�}qW|j�xF|jD]<}x6|jD],}|j|�}||j|<t|t|�|j�}q`WqTW|j�|j�t	|d|j
�|_t|j|jd�|_
dS)Nrr.rR)rK�option_list�format_option_stringsrAr9rgr<�
option_groupsrLr8r;r:r7r>)rr0Zmax_len�optZstrings�grouprrr�store_option_stringsKs 



z"HelpFormatter.store_option_stringscst|j�rF|jp|jj����fdd�|jD�}��fdd�|jD�}n|j}|j}�jrb||}n||}dj|�S)z@Return a comma-separated list of option strings & metavariables.csg|]}�j|�f�qSr)rB)rcZsopt)�metavarrrrreasz7HelpFormatter.format_option_strings.<locals>.<listcomp>csg|]}�j|�f�qSr)rC)rcZlopt)rsrrrrecsz, )�takes_valuersr^�upper�_short_opts�
_long_optsr?r,)rr&Z
short_optsZ	long_optsrkr)rsrrrn]s

z#HelpFormatter.format_option_stringsN)rr"r#r'r`r rDrHrJrKrLrOrQrUrXrZrbrlrrrnrrrrr	�s")
#c@s*eZdZdZddd�Zdd	�Zd
d�ZdS)
r
z.Format help with indented section bodies.
    r.�NrcCstj|||||�dS)N)r	r )rr1r;r7r?rrrr tszIndentedHelpFormatter.__init__cCstd�|S)Nz
Usage: %s
)r))rrNrrrrO|sz"IndentedHelpFormatter.format_usagecCsd|jd|fS)Nz%*s%s:
rE)r<)rrPrrrrQsz$IndentedHelpFormatter.format_heading)r.rxNr)rr"r#r'r rOrQrrrrr
ps
c@s*eZdZdZddd�Zdd�Zd	d
�ZdS)rz1Format help with underlined section headers.
    rrxNcCstj|||||�dS)N)r	r )rr1r;r7r?rrrr �szTitledHelpFormatter.__init__cCsd|jtd��|fS)Nz%s  %s
ZUsage)rQr))rrNrrrrO�sz TitledHelpFormatter.format_usagecCsd|d|jt|�fS)Nz%s
%s
z=-)r=rg)rrPrrrrQ�sz"TitledHelpFormatter.format_heading)rrxNr)rr"r#r'r rOrQrrrrr�s
cCsh|dd�j�dkrd}nD|dd�j�dkrDd}|dd�p@d}n|dd�dkrZd}nd}|||�S)	Nr.Z0x�Z0b�0r��
)�lower)�val�type�radixrrr�
_parse_num�sr�cCs
t|t�S)N)r�r2)r~rrr�
_parse_int�sr�Zintegerzfloating-point�complex)r2�long�floatr�cCsFt|j\}}y||�Stk
r@ttd�|||f��YnXdS)Nzoption %s: invalid %s value: %r)�_builtin_cvtrr6rr))r&rp�valueZcvtZwhatrrr�
check_builtin�sr�cCs:||jkr|Sdjtt|j��}ttd�|||f��dS)Nz, z.option %s: invalid choice: %r (choose from %s))�choicesr,�map�reprrr))r&rpr�r�rrrr�s
�NO�DEFAULTc@s�eZdZdZdddddddd	d
ddd
gZdBZdCZdDZdEZdFZ	dGZ
eeeeed�Z
dZdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�ZeeeeeeegZd4d5�ZeZd6d7�Zd8d9�Zd:d;�Zd<d=�Z d>d?�Z!d@dA�Z"dS)Hrar
    Instance attributes:
      _short_opts : [string]
      _long_opts : [string]

      action : string
      type : string
      dest : string
      default : any
      nargs : int
      const : any
      choices : [string]
      callback : function
      callback_args : (any*)
      callback_kwargs : { string : any }
      help : string
      metavar : string
    �actionrr^�default�nargs�constr��callback�
callback_args�callback_kwargsr[rs�store�store_const�
store_true�store_falserh�append_const�count�version�stringr2r�r�r��choice)r2r�r�r�r�NcOsFg|_g|_|j|�}|j|�|j|�x|jD]}||�q2WdS)N)rvrw�_check_opt_strings�_set_opt_strings�
_set_attrs�
CHECK_METHODS)rrk�attrs�checkerrrrr 4s


zOption.__init__cCsdd�|D�}|std��|S)NcSsg|]}|r|�qSrr)rcrprrrreKsz-Option._check_opt_strings.<locals>.<listcomp>z+at least one option string must be supplied)�	TypeError)rrkrrrr�GszOption._check_opt_stringscCs�x�|D]�}t|�dkr&td||��qt|�dkrf|ddkoH|ddksXtd||��|jj|�q|dd�dko�|ddks�td||��|jj|�qWdS)	Nr.z>invalid option string %r: must be at least two characters longr�-rzMinvalid short option string %r: must be of the form -x, (x any non-dash char)z--zGinvalid long option string %r: must start with --, followed by non-dash)rgr
rvrhrw)rrkrprrrr�Ps$
zOption._set_opt_stringscCszxP|jD]F}||kr,t||||�||=q|dkrBt||t�qt||d�qW|rvt|j��}tddj|�|��dS)Nr�zinvalid keyword arguments: %sz, )�ATTRS�setattrr_�sorted�keysr
r,)rr��attrrrrr�eszOption._set_attrscCs2|jdkrd|_n|j|jkr.td|j|��dS)Nr�zinvalid action: %r)r��ACTIONSr
)rrrr�
_check_actionxs
zOption._check_actioncCs�|jdkr0|j|jkr�|jdk	r(d|_q�d|_n^t|jt�rF|jj|_|jdkrVd|_|j|jkrrtd|j|��|j|jkr�td|j|��dS)Nr�r�r$zinvalid option type: %rz$must not supply a type for action %r)	rr��ALWAYS_TYPED_ACTIONSr��
isinstancer�TYPESr
�
TYPED_ACTIONS)rrrr�_check_type~s



zOption._check_typecCsr|jdkrT|jdkr td|��qnt|jttf�sntdtt|j��jd�d|��n|jdk	rntd|j|��dS)Nr�z/must supply a list of choices for type 'choice'z1choices must be a list of strings ('%s' supplied)�'rz#must not supply choices for type %r)rr�r
r��tuple�listr$�split)rrrr�
_check_choice�s


 
zOption._check_choicecCs\|j|jkp|jdk	}|jdkrX|rX|jrH|jddd�jdd�|_n|jdd|_dS)Nrr.r�r)r)r��
STORE_ACTIONSrr^rwrarv)rrtrrr�_check_dest�s
zOption._check_destcCs*|j|jkr&|jdk	r&td|j|��dS)Nz*'const' must not be supplied for action %r)r��
CONST_ACTIONSr�r
)rrrr�_check_const�szOption._check_constcCs<|j|jkr|jdkr8d|_n|jdk	r8td|j|��dS)Nrz*'nargs' must not be supplied for action %r)r�r�r�r
)rrrr�_check_nargs�s

zOption._check_nargscCs�|jdkrvt|j�s$td|j|��|jdk	rLt|jt�rLtd|j|��|jdk	r�t|jt�r�td|j|��nB|jdk	r�td|j|��|jdk	r�td|��|jdk	r�td|��dS)Nr�zcallback not callable: %rz3callback_args, if supplied, must be a tuple: not %rz4callback_kwargs, if supplied, must be a dict: not %rz.callback supplied (%r) for non-callback optionz.callback_args supplied for non-callback optionz0callback_kwargs supplied for non-callback option)	r��callabler�r
r�r�r�r��dict)rrrr�_check_callback�s0






zOption._check_callbackcCsdj|j|j�S)N�/)r,rvrw)rrrrr!�szOption.__str__cCs
|jdk	S)N)r)rrrrrt�szOption.takes_valuecCs|jr|jdS|jdSdS)Nr)rwrv)rrrr�get_opt_string�s
zOption.get_opt_stringcCs*|jj|j�}|dkr|S||||�SdS)N)�TYPE_CHECKERr]r)rrpr�r�rrr�check_value�szOption.check_valuecs:|dk	r6�jdkr�j�|�St��fdd�|D��SdS)Nrcsg|]}�j�|��qSr)r�)rc�v)rprrrresz(Option.convert_value.<locals>.<listcomp>)r�r�r�)rrpr�r)rprr�
convert_values
zOption.convert_valuecCs$|j||�}|j|j|j||||�S)N)r��take_actionr�r^)rrpr��valuesr0rrr�processszOption.processc	Cs:|dkrt|||��n|dkr2t|||j��n|dkrHt||d�n�|dkr^t||d�n�|dkrz|j|g�j|�n�|dkr�|j|g�j|j�n�|d	kr�t|||j|d
�d�n||dkr�|jp�f}|jp�i}|j||||f|�|�nF|d
k�r|j�|j�n*|dk�r(|j	�|j�nt
d|j��dS)Nr�r�r�Tr�Frhr�r�rrr�r[r�zunknown action %r)r�r��ensure_valuerhr�r�r��
print_help�exit�
print_versionr6r�)	rr�r^rpr�r�r0�args�kwargsrrrr�s4





zOption.take_action)
r�r�r�r�rhr�r�r�r[r�)r�r�r�r�rhr�r�)r�rhr�)r�rh)r�r�)r�r2r�r�r�r�)#rr"r#r'r�r�r�r�r�r�r�r�rr�r�r r�r�r�r�r�r�r�r�r�r�r!r�__repr__rtr�r�r�r�r�rrrrr�s�	
		ZSUPPRESSZHELPZUSAGEc@s^eZdZddd�Zdd�ZeZdd�Zdd	�Zd
d�Z	dd
�Z
ddd�Zddd�Zdd�Z
dS)rNcCs*|r&x |j�D]\}}t|||�qWdS)N)�itemsr�)rr\r�r~rrrr 9szValues.__init__cCs
t|j�S)N)r$�__dict__)rrrrr!>szValues.__str__cCs2t|t�r|j|jkSt|t�r*|j|kStSdS)N)r�rr�r��NotImplemented)r�otherrrr�__eq__Cs



z
Values.__eq__cCs:x4t|�D](}||kr
||}|dk	r
t|||�q
WdS)z�
        Update the option values from an arbitrary dictionary, but only
        use keys from dict that already have a corresponding attribute
        in self.  Any keys in dict without a corresponding attribute
        are silently ignored.
        N)�dirr�)rr�r�Zdvalrrr�_update_carefulKs
zValues._update_carefulcCs|jj|�dS)z�
        Update the option values from an arbitrary dictionary,
        using all keys from the dictionary regardless of whether
        they have a corresponding attribute in self or not.
        N)r��update)rr�rrr�
_update_looseXszValues._update_loosecCs8|dkr|j|�n |dkr(|j|�ntd|��dS)N�carefulZloosezinvalid update mode: %r)r�r�r6)rr��moderrr�_update`s
zValues._updater�cCs&t|�tj|}|jt|�|�dS)N)�
__import__�sys�modulesr��vars)r�modnamer��modrrr�read_modulehs
zValues.read_modulecCs&i}tt|�j�|�|j||�dS)N)�exec�open�readr�)r�filenamer�r�rrr�	read_filemszValues.read_filecCs0t||�st||�dkr&t|||�t||�S)N)�hasattr�getattrr�)rr�r�rrrr�rszValues.ensure_value)N)r�)r�)rr"r#r r!rr�r�r�r�r�r�r�r�rrrrr7s



c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"S)#ra�
    Abstract base class.

    Class attributes:
      standard_option_list : [Option]
        list of standard options that will be accepted by all instances
        of this parser class (intended to be overridden by subclasses).

    Instance attributes:
      option_list : [Option]
        the list of Option objects contained by this OptionContainer
      _short_opt : { string : Option }
        dictionary mapping short option strings, eg. "-f" or "-X",
        to the Option instances that implement them.  If an Option
        has multiple short option strings, it will appear in this
        dictionary multiple times. [1]
      _long_opt : { string : Option }
        dictionary mapping long option strings, eg. "--file" or
        "--exclude", to the Option instances that implement them.
        Again, a given Option can occur multiple times in this
        dictionary. [1]
      defaults : { string : any }
        dictionary mapping option destination names to default
        values for each destination [1]

    [1] These mappings are common to (shared by) all components of the
        controlling OptionParser, where they are initially created.

    cCs&|j�||_|j|�|j|�dS)N)�_create_option_list�option_class�set_conflict_handler�set_description)rr��conflict_handlerrWrrrr �s
zOptionContainer.__init__cCsi|_i|_i|_dS)N)�
_short_opt�	_long_optr\)rrrr�_create_option_mappings�sz'OptionContainer._create_option_mappingscCs|j|_|j|_|j|_dS)N)r�r�r\)rr0rrr�_share_option_mappings�sz&OptionContainer._share_option_mappingscCs|dkrtd|��||_dS)N�error�resolvez$invalid conflict_resolution value %r)r�r�)r6r�)r�handlerrrrr��sz$OptionContainer.set_conflict_handlercCs
||_dS)N)rW)rrWrrrr��szOptionContainer.set_descriptioncCs|jS)N)rW)rrrr�get_description�szOptionContainer.get_descriptioncCs|`|`|`dS)zsee OptionParser.destroy().N)r�r�r\)rrrr�destroy�szOptionContainer.destroycCs�g}x,|jD]"}||jkr|j||j|f�qWx,|jD]"}||jkr:|j||j|f�q:W|r�|j}|dkr�tddjdd�|D��|��nh|dkr�x^|D]V\}}|jd�r�|jj	|�|j|=n|jj	|�|j|=|jp�|js�|j
jj	|�q�WdS)Nr�z conflicting option string(s): %sz, cSsg|]}|d�qS)rr)rc�corrrre�sz3OptionContainer._check_conflict.<locals>.<listcomp>r�z--)rvr�rhrwr�r�rr,�
startswith�remove�	containerrm)rr&Z
conflict_optsrpr�Zc_optionrrr�_check_conflict�s.



zOptionContainer._check_conflictcOs�t|dt�r|j||�}n:t|�dkrN|rN|d}t|t�sVtd|��ntd��|j|�|jj|�||_	x|j
D]}||j|<qzWx|jD]}||j
|<q�W|jdk	r�|jtk	r�|j|j|j<n|j|jkr�d|j|j<|S)zOadd_option(Option)
           add_option(opt_str, ..., kwarg=val, ...)
        rrznot an Option instance: %rzinvalid argumentsN)r�r$r�rgrr�r�rmrhr�rvr�rwr�r^r�r_r\)rr�r�r&rprrr�
add_option�s(



zOptionContainer.add_optioncCsx|D]}|j|�qWdS)N)r�)rrmr&rrr�add_optionss
zOptionContainer.add_optionscCs|jj|�p|jj|�S)N)r�r]r�)rr(rrr�
get_optionszOptionContainer.get_optioncCs||jkp||jkS)N)r�r�)rr(rrr�
has_options
zOptionContainer.has_optioncCsv|jj|�}|dkr |jj|�}|dkr4td|��x|jD]}|j|=q<Wx|jD]}|j|=qTW|jjj|�dS)Nzno such option %r)	r�r]r�r6rvrwr�rmr�)rr(r&rprrr�
remove_optionszOptionContainer.remove_optioncCsB|js
dSg}x(|jD]}|jtk	r|j|j|��qWdj|�S)NrE)rmr[rrhrlr,)r�	formatterrjr&rrr�format_option_helps
z"OptionContainer.format_option_helpcCs|j|j��S)N)rXr�)rrrrrrX(sz"OptionContainer.format_descriptioncCs:g}|jr|j|j|��|jr0|j|j|��dj|�S)NrV)rWrhrXrmrr,)rrrjrrr�format_help+szOptionContainer.format_helpN)rr"r#r'r r�r�r�r�r�r�r�r�r�r�r�rrrXrrrrrrxs"			c@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rNcCs$||_tj||j|j|�||_dS)N)r0rr r�r��title)rr0rrWrrrr 6szOptionGroup.__init__cCsg|_|j|j�dS)N)rmr�r0)rrrrr�<szOptionGroup._create_option_listcCs
||_dS)N)r)rrrrr�	set_title@szOptionGroup.set_titlecCstj|�|`dS)zsee OptionParser.destroy().N)rr�rm)rrrrr�Cs
zOptionGroup.destroycCs0|j|j�}|j�|tj||�7}|j�|S)N)rQrrKrrrL)rrrjrrrrJs
zOptionGroup.format_help)N)rr"r#r r�rr�rrrrrr4s

c
@sbeZdZdZgZddedddddddf
dd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dPdd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�ZdQd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Z dRd<d=�Z!d>d?�Z"d@dA�Z#dSdBdC�Z$dDdE�Z%dTdFdG�Z&dUdHdI�Z'dJdK�Z(dVdLdM�Z)dWdNdO�Z*dS)Xra$
    Class attributes:
      standard_option_list : [Option]
        list of standard options that will be accepted by all instances
        of this parser class (intended to be overridden by subclasses).

    Instance attributes:
      usage : string
        a usage string for your program.  Before it is displayed
        to the user, "%prog" will be expanded to the name of
        your program (self.prog or os.path.basename(sys.argv[0])).
      prog : string
        the name of the current program (to override
        os.path.basename(sys.argv[0])).
      description : string
        A paragraph of text giving a brief overview of your program.
        optparse reformats this paragraph to fit the current terminal
        width and prints it when the user requests help (after usage,
        but before the list of options).
      epilog : string
        paragraph of help text to print after option help

      option_groups : [OptionGroup]
        list of option groups in this parser (option groups are
        irrelevant for parsing the command-line, but very useful
        for generating help)

      allow_interspersed_args : bool = true
        if true, positional arguments may be interspersed with options.
        Assuming -a and -b each take a single argument, the command-line
          -ablah foo bar -bboo baz
        will be interpreted the same as
          -ablah -bboo -- foo bar baz
        If this flag were false, that command line would be interpreted as
          -ablah -- foo bar -bboo baz
        -- ie. we stop processing options as soon as we see the first
        non-option argument.  (This is the tradition followed by
        Python's getopt module, Perl's Getopt::Std, and other argument-
        parsing libraries, but it is generally annoying to users.)

      process_default_values : bool = true
        if true, option default values are processed similarly to option
        values from the command line: that is, they are passed to the
        type-checking function for the option's type (as long as the
        default value is a string).  (This really only matters if you
        have defined custom types; see SF bug #955889.)  Set it to false
        to restore the behaviour of Optik 1.4.1 and earlier.

      rargs : [string]
        the argument list currently being parsed.  Only set when
        parse_args() is active, and continually trimmed down as
        we consume arguments.  Mainly there for the benefit of
        callback options.
      largs : [string]
        the list of leftover arguments that we have skipped while
        parsing options.  If allow_interspersed_args is false, this
        list is always empty.
      values : Values
        the set of option values currently being accumulated.  Only
        set when parse_args() is active.  Also mainly for callbacks.

    Because of the 'rargs', 'largs', and 'values' attributes,
    OptionParser is not thread-safe.  If, for some perverse reason, you
    need to parse command-line arguments simultaneously in different
    threads, use different OptionParser instances.

    Nr�TcCsrtj||||�|j|�|	|_||_d|_d|_|dkr@t�}||_|jj	|�|
|_
|j||d�|j�dS)NT)�add_help)
rr �	set_usage�progr��allow_interspersed_args�process_default_valuesr
rrDrY�_populate_option_list�_init_parsing_state)rrNrmr�r�r�rWrZadd_help_optionrrYrrrr �s
zOptionParser.__init__cCs2tj|�x|jD]}|j�qW|`|`|`dS)a
        Declare that you are done with this OptionParser.  This cleans up
        reference cycles so the OptionParser (and all objects referenced by
        it) can be garbage-collected promptly.  After calling destroy(), the
        OptionParser is unusable.
        N)rr�rormr)rrqrrrr��s
zOptionParser.destroycCsg|_g|_|j�dS)N)rmror�)rrrrr��sz OptionParser._create_option_listcCs|jdddtd�d�dS)Nz-hz--helpr[zshow this help message and exit)r�r[)r�r))rrrr�_add_help_option�szOptionParser._add_help_optioncCs|jddtd�d�dS)Nz	--versionr�z&show program's version number and exit)r�r[)r�r))rrrr�_add_version_option�sz OptionParser._add_version_optioncCs>|jr|j|j�|r |j|�|jr.|j�|r:|j�dS)N)�standard_option_listr�r�rr
)rrmrrrrr�s
z"OptionParser._populate_option_listcCsd|_d|_d|_dS)N)�rargs�largsr�)rrrrr�sz OptionParser._init_parsing_statecCsL|dkrtd�|_n4|tkr$d|_n$|j�jd�rB|dd�|_n||_dS)Nz%prog [options]zusage: �)r)rNrr}r�)rrNrrrr�szOptionParser.set_usagecCs
d|_dS)aSet parsing to not stop on the first non-option, allowing
        interspersing switches with command arguments. This is the
        default behavior. See also disable_interspersed_args() and the
        class documentation description of the attribute
        allow_interspersed_args.TN)r	)rrrr�enable_interspersed_args�sz%OptionParser.enable_interspersed_argscCs
d|_dS)z�Set parsing to stop on the first non-option. Use this if
        you have a command processor which runs another command that
        has options of its own and you want to make sure these options
        don't get confused.
        FN)r	)rrrr�disable_interspersed_argssz&OptionParser.disable_interspersed_argscCs
||_dS)N)r
)rr�rrr�set_process_default_valuessz'OptionParser.set_process_default_valuescCs||j|<dS)N)r\)rr^r�rrr�set_defaultszOptionParser.set_defaultcKs|jj|�dS)N)r\r�)rr�rrr�set_defaultsszOptionParser.set_defaultscCs.|jdd�}x|jD]}|j|j�qW|S)N)rmrori)rZoptionsrqrrr�_get_all_optionsszOptionParser._get_all_optionscCsd|jst|j�S|jj�}x@|j�D]4}|j|j�}t|t�r$|j	�}|j
||�||j<q$Wt|�S)N)r
rr\�copyrr]r^r�r$r�r�)rr\r&r�r(rrr�get_default_valuess


zOptionParser.get_default_valuescOs|t|dt�r t|f|�|�}nLt|�dkrd|rd|d}t|t�sPtd|��|j|k	rltd��ntd��|jj|�|S)Nrrznot an OptionGroup instance: %rz"invalid OptionGroup (wrong parser)zinvalid arguments)	r�r$rrgr�r0r6rorh)rr�r�rqrrr�add_option_group+s


zOptionParser.add_option_groupcCs0|jj|�p|jj|�}|r,|j|k	r,|jSdS)N)r�r]r�r�)rr(r&rrr�get_option_group;s
zOptionParser.get_option_groupcCs&|dkrtjdd�S|dd�SdS)Nr)r��argv)rr�rrr�	_get_argsEszOptionParser._get_argscCs�|j|�}|dkr|j�}||_g|_}||_y|j|||�}Wn4ttfk
rv}z|jt	|��WYdd}~XnX||}|j
||�S)aR
        parse_args(args : [string] = sys.argv[1:],
                   values : Values = None)
        -> (values : Values, args : [string])

        Parse the command-line options found in 'args' (default:
        sys.argv[1:]).  Any errors result in a call to 'error()', which
        by default prints the usage message to stderr and calls
        sys.exit() with an error message.  On success returns a pair
        (values, args) where 'values' is a Values instance (with all
        your option values) and 'args' is the list of arguments left
        over after parsing options.
        N)rrrrr��
_process_argsrrr�r$�check_values)rr�r�rr�stop�errrrr�
parse_argsKs

 zOptionParser.parse_argscCs||fS)a�
        check_values(values : Values, args : [string])
        -> (values : Values, args : [string])

        Check that the supplied option values and leftover arguments are
        valid.  Returns the option values and leftover arguments
        (possibly adjusted, possibly completely new -- whatever you
        like).  Default implementation just returns the passed-in
        values; subclasses may override as desired.
        r)rr�r�rrrr rszOptionParser.check_valuescCs�x�|r�|d}|dkr |d=dS|dd�dkr>|j||�q|dd�dkrht|�dkrh|j||�q|jr�|j|�|d=qdSqWdS)a�_process_args(largs : [string],
                         rargs : [string],
                         values : Values)

        Process command-line arguments and populate 'values', consuming
        options and arguments from 'rargs'.  If 'allow_interspersed_args' is
        false, stop at the first non-option argument.  If true, accumulate any
        interspersed non-option arguments in 'largs'.
        rz--Nr.rr�)�_process_long_optrg�_process_short_optsr	rh)rrrr��argrrrrs

zOptionParser._process_argscCst||j�S)a_match_long_opt(opt : string) -> string

        Determine which long option string 'opt' matches, ie. which one
        it is an unambiguous abbreviation for.  Raises BadOptionError if
        'opt' doesn't unambiguously match any long option string.
        )�
_match_abbrevr�)rrprrr�_match_long_opt�szOptionParser._match_long_optc
Cs�|jd�}d|kr4|jdd�\}}|jd|�d}n|}d}|j|�}|j|}|j�r�|j}t|�|kr�|jt	dd|�||d��q�|dkr�|jd�}	q�t
|d|��}	|d|�=n|r�|jtd	�|�nd}	|j||	||�dS)
NrrIrTFz.%(option)s option requires %(number)d argumentz/%(option)s option requires %(number)d arguments)r&�numberz%s option does not take a value)
�popr��insertr(r�rtr�rgr�rr�r)r�)
rrr�r&rpZnext_argZhad_explicit_valuer&r�r�rrrr$�s0


zOptionParser._process_long_optcCs�|jd�}d}d}x�|dd�D]�}d|}|jj|�}|d7}|sLt|��|j�r�|t|�krx|jd||d��d}|j}	t|�|	kr�|jt	dd|	�||	d��q�|	dkr�|jd�}
q�t
|d|	��}
|d|	�=nd}
|j||
||�|r Pq WdS)	NrFrr�Tz.%(option)s option requires %(number)d argumentz/%(option)s option requires %(number)d arguments)r&r))r*r�r]rrtrgr+r�r�rr�r�)rrr�r&r!�iZchrpr&r�r�rrrr%�s6
z OptionParser._process_short_optscCs&|jdkrtjjtjd�S|jSdS)Nr)rr3�path�basenamer�r)rrrr�
get_prog_names
zOptionParser.get_prog_namecCs|jd|j��S)Nz%prog)rar/)r�srrr�expand_prog_nameszOptionParser.expand_prog_namecCs|j|j�S)N)r1rW)rrrrr�szOptionParser.get_descriptionrcCs|rtjj|�tj|�dS)N)r��stderr�writer�)rZstatusrrrrr�szOptionParser.exitcCs(|jtj�|jdd|j�|f�dS)z�error(msg : string)

        Print a usage message incorporating 'msg' to stderr and exit.
        If you override this in a subclass, it should not return -- it
        should either exit or raise an exception.
        r.z%s: error: %s
N)�print_usager�r2r�r/)rrrrrr�szOptionParser.errorcCs"|jr|jj|j|j��SdSdS)NrE)rNrrOr1)rrrr�	get_usage#szOptionParser.get_usagecCs|jrt|j�|d�dS)aaprint_usage(file : file = stdout)

        Print the usage message for the current program (self.usage) to
        'file' (default stdout).  Any occurrence of the string "%prog" in
        self.usage is replaced with the name of the current program
        (basename of sys.argv[0]).  Does nothing if self.usage is empty
        or not defined.
        )�fileN)rN�printr5)rr6rrrr4*s	zOptionParser.print_usagecCs|jr|j|j�SdSdS)NrE)r�r1)rrrr�get_version6szOptionParser.get_versioncCs|jrt|j�|d�dS)aEprint_version(file : file = stdout)

        Print the version message for this program (self.version) to
        'file' (default stdout).  As with print_usage(), any occurrence
        of "%prog" in self.version is replaced by the current program's
        name.  Does nothing if self.version is empty or undefined.
        )r6N)r�r7r8)rr6rrrr�<szOptionParser.print_versioncCs�|dkr|j}|j|�g}|j|jtd���|j�|jrZ|jtj||��|jd�x(|j	D]}|j|j
|��|jd�qbW|j�dj|dd��S)NZOptionsrVrErrf)
rrrrhrQr)rKrmrrrorrLr,)rrrjrqrrrrGs

zOptionParser.format_option_helpcCs|j|j�S)N)rZrY)rrrrrrZXszOptionParser.format_epilogcCsn|dkr|j}g}|jr*|j|j�d�|jrD|j|j|�d�|j|j|��|j|j|��dj|�S)NrVrE)	rrNrhr5rWrXrrZr,)rrrjrrrr[szOptionParser.format_helpcCs |dkrtj}|j|j��dS)z�print_help(file : file = stdout)

        Print an extended help message, listing all options and any
        help text provided with them, to 'file' (default stdout).
        N)r��stdoutr3r)rr6rrrr�gszOptionParser.print_help)T)NN)rN)N)N)N)N)N)+rr"r#r'rrr r�r�r
rrrrrrrrrrrrrrr#r rr(r$r%r/r1r�r�r�r5r4r8r�rrZrr�rrrrrRs`D

	

'
3	$)





csZ�|kr�S�fdd�|j�D�}t|�dkr6|dS|sDt���n|j�t�|��dS)z�_match_abbrev(s : string, wordmap : {string : Option}) -> string

    Return the string key in 'wordmap' for which 's' is an unambiguous
    abbreviation.  If 's' is found to be ambiguous or doesn't match any of
    'words', raise BadOptionError.
    csg|]}|j��r|�qSr)r�)rcZword)r0rrre�sz!_match_abbrev.<locals>.<listcomp>rrN)r�rgr�sortr*)r0Zwordmapr+r)r0rr'ts
r')r�r�ZSUPPRESSHELPZ
SUPPRESSUSAGE)'r'�__version__�__all__Z
__copyright__r�r3rSrrr�ImportErrorr)�	Exceptionrr
rrrr*r	r
rr�r�r�r�r�r�rr_rrrrrrrr'rrrrr�<module>s~ 


P



uA=&stringprep.cpython-36.opt-2.pyc000064400000023032150335715140012333 0ustar003


 \u2��@s�ddlmZdd�Zedddddd	d
ddd
dgeedd���Zdd�Zdddddddddddddd d!d"d#d$d%d&dd'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBd;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdCdDdEdFdGdHdIdJdKdLdMdNdOdLddPdQdRdSdTdQdUddVdWdXddYdZd[d\d]d^d_d`d]dadbdcdddedfdfdfdgdgdhdidjdkdldmdmdmdndodpdqdqdrdbdsdtdudvd$dwdxdydzd{d|d}d~dd�d�d�d�d�d�d�d�d�d�d�d{d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�dbdwd�d�d�did�dkdldd�d�d�d�d�d�dqd�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�drdwdsdtd�d�d�dhdudid�dkdldd�d�d�d�d�d�d�drdwdsdtd�dgd�d�dhdud�dd�d�d�d�d�d�d�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�ddvd�d'd�d�ddd%d�dd�d�d�d$d&ddd�d d#d�d�d�dd�ddvd�d'd�d�ddd%d�dd�d�d�d$d&ddd�d d#d�d�d�dd�ddvd�d'd�d�ddd%d�dd�d�d�d$d&ddd�d d#d�d�d�dd�ddvd�d'd�d�ddd%d�dd�d�d�d$d&ddd�d d#d�d�d�dd�ddvd�d'd�d�ddd%d�dd�d�d�d$d&ddd�d d#d�d�d�ddɐ��Zd�d˄Z	d�d̈́Z
d�dτZd�dфZd�dӄZ
d�dՄZed�d�d�ddd�d�dgeed
dۃ�eed�d݃�eed�d߃�eed�d���Zd�d�Zd�d�Zd�d�Zd�d�Zd�d�Zeed�d��Zd�d�Zeed�d��Zd�d�Zed�d�d�d�geed�d���eed�d݃��Zd�d��Zed�geed�d����Zd�d��Z�d�d�Z�d�d�Z�dS(�)�	ucd_3_2_0cCsBtj|�dkrdSt|�}d|ko,dknr6dS|d@dkS)NZCnFi�i���)rr)�unicodedata�category�ord)�code�c�r
�"/usr/lib64/python3.6/stringprep.py�in_table_a1sr�iOiiii
i i i
 i` i��i�i�cCst|�tkS)N)r�b1_set)rr
r
r�in_table_b1sruμZssui̇uʼn�suǰuιu ιuΐuΰuσuβuθuυuύuϋuφuπuκuρuεuեւuẖuẗuẘuẙuaʾuṡuὐuὒuὔuὖuἀιuἁιuἂιuἃιuἄιuἅιuἆιuἇιuἠιuἡιuἢιuἣιuἤιuἥιuἦιuἧιuὠιuὡιuὢιuὣιuὤιuὥιuὦιuὧιuὰιuαιuάιuᾶuᾶιuὴιuηιuήιuῆuῆιuῒuῖuῗuῢuῤuῦuῧuὼιuωιuώιuῶuῶιZrsr	u°cuɛu°f�h�i�l�n�no�p�q�rZsmZtelZtm�z�b�e�f�muγ�dZhpaZauZovZpaZnauμaZmaZkaZkbZmbZgbZpfZnfuμf�hzZkhzZmhzZghzZthzZkpaZmpaZgpaZpvZnvuμvZmvZkvZpwZnwuμwZmw�kwukωumωZbquc∕kgzco.ZdbZgyZhpZkkZkmZphZppmZprZsv�wbZffZfiZflZffiZffl�stuմնuմեuմիuվնuմխ�a�g�j�k�o�t�u�v�w�x�yuαuδuζuηuλuνuξuοuτuχuψuω(����i0iIii�iEizi�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�iPiRiTiVi�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i� i!i!i!i	!i!i!i
!i!i!i!i!i!i!i!i!i!i!i !i!!i"!i$!i(!i,!i-!i0!i1!i3!i>!i?!iE!iq3is3iu3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i	�i
�i�i�i
�i�i�i�i�i�i�i�i�i�i�i�i�i4�i5�i6�i7�i8�i9�i:�i;�i<�i=�i>�i?�i@�iA�iB�iC�iD�iE�iF�iG�iH�iI�iJ�iK�iL�iM�ih�ii�ij�ik�il�im�in�io�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i�i�i�i�i	�i
�i
�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i8�i9�i;�i<�i=�i>�i@�iA�iB�iC�iD�iF�iJ�iK�iL�iM�iN�iO�iP�il�im�in�io�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i�i	�i
�i�i�i
�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i �i!�i<�i=�i>�i?�i@�iA�iB�iC�iD�iE�iF�iG�iH�iI�iJ�iK�iL�iM�iN�iO�iP�iQ�iR�iS�iT�iU�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i
�i�i�i�i�i �i!�i"�i#�i$�i%�i&�i'�i(�i)�i*�i+�i,�i-�i.�i/�i0�i1�i2�i3�i4�iG�iV�iW�iX�iY�iZ�i[�i\�i]�i^�i_�i`�ia�ib�ic�id�ie�if�ig�ih�ii�ij�ik�il�im�in�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��cCs"tjt|��}|dk	r|S|j�S)N)�
b3_exceptions�getr�lower)rrr
r
r�map_table_b3�sr3cCsHt|�}tjd|�}djdd�|D��}tjd|�}||kr@|S|SdS)NZNFKC�cSsg|]}t|��qSr
)r3)�.0Zchr
r
r�
<listcomp>�sz map_table_b2.<locals>.<listcomp>)r3rZ	normalize�join)r#ZalrZblr	r
r
r�map_table_b2�sr8cCs|dkS)N� r
)rr
r
r�in_table_c11�sr:cCstj|�dko|dkS)N�Zsr9)rr)rr
r
r�in_table_c12�sr<cCstj|�dkS)Nr;)rr)rr
r
r�in_table_c11_c12�sr=cCst|�dkotj|�dkS)N��Cc)rrr)rr
r
r�in_table_c21�sr@i�iii( i) id ij ip i��i��is�i{�cCs.t|�}|dkrdStj|�dkr&dS|tkS)Nr>Fr?T)rrr�c22_specials)rr	r
r
r�in_table_c22�srBcCstj|�dkpt|�tkS)Nr?)rrrrA)rr
r
r�in_table_c21_c22�srCcCstj|�dkS)NZCo)rr)rr
r
r�in_table_c3�srDcCs0t|�}|dkrdS|dkr dSt|�d@dkS)Ni�Fi�T��)rFrE)r)rr	r
r
r�in_table_c4�srGcCstj|�dkS)NZCs)rr)rr
r
r�in_table_c5�srHi��cCst|�tkS)N)r�c6_set)rr
r
r�in_table_c6�srJi�/i�/cCst|�tkS)N)r�c7_set)rr
r
r�in_table_c7�srLi@iAi i i* i/ cCst|�tkS)N)r�c8_set)rr
r
r�in_table_c8srNii i�cCst|�tkS)N)r�c9_set)rr
r
r�in_table_c9srPcCstj|�dkS)N�R�AL)rQrR)r�
bidirectional)rr
r
r�in_table_d1srTcCstj|�dkS)N�L)rrS)rr
r
r�in_table_d2srVN)rrr�set�list�rangerrr0r3r8r:r<r=r@rArBrCrDrGrHrIrJrKrLrMrNrOrPrTrVr
r
r
r�<module>sx,P,datetime.cpython-36.pyc000064400000152361150335715140011002 0ustar003


 \r@�
@sZdZddlZddlZddlZdd�ZdZdZdZ	dadd	dd
dd
ddd
dd
dg
Z
dbgZdZx&e
dd�D]Z
eje�ee
7ZqfW[[
dd�Zd
d�Zdd�Zdd�Zdd�Zed�Zed�Zed�Zeddks�t�ededks�t�ededk�s�t�dd�Zddddd d!d"d#d$d%d&d'd(g
Zdd)d*d+d,d-d.d/gZd0d1�Zded3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%GdGdH�dH�Z&e&df�e&_'e&dIdJdKdKdLdM�e&_(e&ddN�e&_)GdOdP�dP�Z*e*Z+e*ddd�e*_'e*ddQd�e*_(e&ddR�e*_)GdSdT�dT�Z,e,Z-GdUdV�dV�ZeZ.eddd�e_'edJdKdKdL�e_(e&ddN�e_)GdWdX�dXe*�Z/e/ddd�e/_'e/ddQddJdKdKdL�e/_(e&ddN�e/_)dYdZ�Z0Gd[d\�d\e,�Z1e1j2e&d��e1_3e1j2e1j4�e1_'e1j2e1j5�e1_(e/d]dde1j3d^�Z6ydd_l7TWne8k
�rYnPX[[[
[[[[6[	[[[![ ["[#[[[[$[+[[[[[[0[[[[.[-[[[%dd`l7mZdS)gz�Concrete date/time and related types.

See http://www.iana.org/time-zones/repository/tz-link.html for
time zone and DST data sources.
�NcCs||krdS||krdSdS)Nr�����)�x�yrr� /usr/lib64/python3.6/datetime.py�_cmpsrri'i۹7���cCs$|ddko"|ddkp"|ddkS)zyear -> 1 if leap year, else 0.�r�di�r)�yearrrr�_is_leap%srcCs(|d}|d|d|d|dS)z2year -> number of days before January 1st of year.rimrr
i�r)rrrrr�_days_before_year)srcCs<d|kodkns t|��|dkr4t|�r4dSt|S)z9year, month -> number of days in that month in that year.r���)�AssertionErrorr�_DAYS_IN_MONTH)r�monthrrr�_days_in_month.s rcCs8d|kodkns td��t||dko4t|�S)zCyear, month -> number of days in year preceding first day of month.rrzmonth must be in 1..12r)r�_DAYS_BEFORE_MONTHr)rrrrr�_days_before_month5s rcCsdd|kodkns td��t||�}d|ko<|knsNtd|��t|�t||�|S)z>year, month, day -> ordinal, considering 01-Jan-0001 as day 1.rrzmonth must be in 1..12zday must be in 1..%d)rrrr)rr�day�dimrrr�_ymd2ord:s
 
$ri��e�rim�c	Cs:|d8}t|t�\}}|dd}t|t�\}}t|t�\}}t|d�\}}||d|d|7}|dkst|dkr�|dks�t�|dddfS|d	ko�|d
kp�|d	k}|t|�ks�t�|dd?}t||d
ko�|}||kr�|d8}|t||d
ko�|8}||8}d|k�o t||�kn�s,t�|||dfS)z@ordinal -> (year, month, day), considering 01-Jan-0001 as day 1.ri�imr
rrrr	���2rr)	�divmod�_DI400Y�_DI100Y�_DI4Yrrrrr)	�nZn400rZn100Zn4Zn1ZleapyearrZ	precedingrrr�_ord2ymdSs(&r(ZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecZMonZTueZWedZThuZFriZSatZSunc	
Cs>t|||�dd}t||�|}tj|||||||||f	�S)N��)rr�_timeZstruct_time)	r�m�d�hh�mm�ssZdstflagZwdayZdnumrrr�_build_struct_time�sr1�autoc
Cstdddddd�}|dkr&|r dnd	}n|d
kr6|d}y||}Wntk
r^td��YnX|j||||�SdS)
Nz{:02d}z
{:02d}:{:02d}z{:02d}:{:02d}:{:02d}z{:02d}:{:02d}:{:02d}.{:03d}z{:02d}:{:02d}:{:02d}.{:06d})�hours�minutes�seconds�milliseconds�microsecondsr2r7r5r6i�zUnknown timespec value)�KeyError�
ValueError�format)r.r/r0�us�timespecZspecs�fmtrrr�_format_time�sr>cCs�d}d}d}g}|j}dt|�}}	�x�||	k�r�||}
|d7}|
dk�r�||	k�r�||}
|d7}|
dkr�|dkr�dt|dd�}|j|��q�|
dk�rF|dk�r,d}t|d	��r,|j�}|dk	�r,d
}|jdkr�|}d}t|tdd��\}
}|tdd
��std��|tdd
�}d||
|f}d|k�s:t�|j|�n^|
dk�r�|dk�r�d}t|d��r�|j	�}|dk	�r�|j
dd�}|j|�n|d�||
�n|d�q(||
�q(Wdj|�}tj
||�S)Nrr�%�fz%06d�microsecond�z��	utcoffset�+�-)r3)r4zwhole minutez
%c%02d%02d�Z�tznamez%%)�append�len�getattr�hasattrrD�daysr#�	timedeltarrH�replace�joinr+�strftime)�objectr:�	timetupleZfreplaceZzreplaceZZreplaceZ	newformat�push�ir'Zch�offset�sign�hr,�srrr�_wrap_strftime�s`












rZcCs(|dk	r$t|t�r$tdt|���dS)Nz4tzinfo.tzname() must return None or string, not '%s')�
isinstance�str�	TypeError�type)�namerrr�
_check_tzname�sr`cCs�|dkst�|dkrdSt|t�s6td|t|�f��|jrLtd||f��td�|kohtd�kns~td||f��dS)NrD�dstz3tzinfo.%s() must return None or timedelta, not '%s'z9tzinfo.%s() must return a whole number of seconds, got %srzN%s()=%s, must be strictly between -timedelta(hours=24) and timedelta(hours=24))rDra)rr[rNr]r^r7r9)r_rVrrr�_check_utc_offset�s
"rbcCsxt|t�r|St|t�sly|j�}Wntk
r8Yn"Xt|t�rH|Stdt|�j��tdt|�j��td��dS)Nz"__int__ returned non-int (type %s)z$an integer is required (got type %s)z$integer argument expected, got float)r[�int�float�__int__�AttributeErrorr]r^�__name__)�valuerrr�_check_int_fields


ricCs�t|�}t|�}t|�}t|ko*tknsBtdttf|��d|koTdknsdtd|��t||�}d|ko�|kns�td||��|||fS)Nzyear must be in %d..%drrzmonth must be in 1..12zday must be in 1..%d)ri�MINYEAR�MAXYEARr9r)rrrrrrr�_check_date_fieldss

rlcCs�t|�}t|�}t|�}t|�}d|ko2dknsBtd|��d|koTdknsdtd|��d|kovdkns�td|��d|ko�dkns�td|��|dkr�td
|��|||||fS)Nr�zhour must be in 0..23�;zminute must be in 0..59zsecond must be in 0..59i?Bz microsecond must be in 0..999999rzfold must be either 0 or 1)rr)rir9)�hour�minute�secondrA�foldrrr�_check_time_fields$s




rscCs |dk	rt|t�rtd��dS)Nz4tzinfo argument must be None or of a tzinfo subclass)r[�tzinfor])�tzrrr�_check_tzinfo_arg5srvcCs tdt|�jt|�jf��dS)Nzcan't compare '%s' to '%s')r]r^rg)rrrrr�	_cmperror9srwcCsRt||�\}}|d9}|dkr&||kn||k}|sF||krN|ddkrN|d7}|S)z�divide a by b and round result to the nearest integer

    When the ratio is exactly half-way between two integers,
    the even integer is returned.
    rrr)r#)�a�b�q�rZgreater_than_halfrrr�_divide_and_round=sr|c@seZdZdZdBZdCdd�Zd	d
�Zdd�Zd
d�Ze	dd��Z
e	dd��Ze	dd��Zdd�Z
e
Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�ZeZd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Z d9d:�Z!d;d<�Z"d=d>�Z#d?d@�Z$dAS)DrNa�Represent the difference between two datetime objects.

    Supported operators:

    - add, subtract timedelta
    - unary plus, minus, abs
    - compare to timedelta
    - multiply, divide by int

    In addition, datetime supports subtraction of two datetime objects
    returning a timedelta, and addition or subtraction of a datetime
    and a timedelta giving a datetime.

    Representation: (days, seconds, microseconds).  Why?  Because I
    felt like it.
    �_days�_seconds�
_microseconds�	_hashcodercCsZd}}	}
||d7}||d|d7}||d7}t|t�r�tj|�\}}tj|d�\}}
|
t|
�ksrt�t|
�}	|t|�ks�t�t|�}nd}|}t|t�s�t�t|�d	ks�t�t|t�s�t�t|	�dks�t�t|t��r(tj|�\}}|t|�k�st�t|�}||7}t|�dk�s,t�n|}t|t��s<t�t|�dk�sNt�t|t��s^t�t|d�\}}||7}|	t|�7}	t|	t��s�t�t|	�dk�s�t�|d
}t|�dk�s�t�t|t��rt||�}t|d�\}}t|d�\}}||7}|	|7}	n@t|�}t|d�\}}t|d�\}}||7}|	|7}	t||�}t|	t��sRt�t|t��sbt�t|	�dk�stt�t|�dk�s�t�t|d�\}}
|	|7}	t|	d�\}}	||7}t|t��s�t�t|	t��r�d|	k�o�dkn�s�t�t|
t��rd|
k�odkn�st�t|�dk�r4t	d|��t
j|�}||_|	|_
|
|_d |_|S)!Nrr*�<ii�g8@g �@gg�?r!g@rg��.Ag�@Ai@Br g��GAi�ɚ;z$timedelta # of days is too large: %drg�@i�Qi�Q�0i�i�Qi�Q�Hi��i�Qi�Qr)r[rd�_math�modfrcr�absr#�round�
OverflowErrorrR�__new__r}r~rr�)�clsrMr5r7r6r4r3Zweeksr-rYr;ZdayfracZdaysecondsfracZdaysecondswholeZsecondsfracZusdouble�selfrrrr�ds�


,,
ztimedelta.__new__cCs`|jr&d|jj|jj|j|j|jfS|jrHd|jj|jj|j|jfSd|jj|jj|jfS)Nz%s.%s(%d, %d, %d)z
%s.%s(%d, %d)z	%s.%s(%d))r�	__class__�
__module__�__qualname__r}r~)r�rrr�__repr__�s

ztimedelta.__repr__cCsdt|jd�\}}t|d�\}}d|||f}|jrLdd�}d||j�|}|jr`|d|j}|S)Nr�z%d:%02d:%02dcSs|t|�dkrdpdfS)NrrYrC)r�)r'rrr�plural�sz!timedelta.__str__.<locals>.pluralz
%d day%s, z.%06d)r#r~r}r)r�r/r0r.rYr�rrr�__str__�sztimedelta.__str__cCs|jd|jd|jdS)zTotal seconds in the duration.i�Q�
r)i@Bi@B)rMr5r7)r�rrr�
total_seconds�sztimedelta.total_secondscCs|jS)rM)r})r�rrrrM�sztimedelta.dayscCs|jS)r5)r~)r�rrrr5�sztimedelta.secondscCs|jS)r7)r)r�rrrr7�sztimedelta.microsecondscCs2t|t�r.t|j|j|j|j|j|j�StS)N)r[rNr}r~r�NotImplemented)r��otherrrr�__add__�s


ztimedelta.__add__cCs2t|t�r.t|j|j|j|j|j|j�StS)N)r[rNr}r~rr�)r�r�rrr�__sub__s


ztimedelta.__sub__cCst|t�r||StS)N)r[rNr�)r�r�rrr�__rsub__s

ztimedelta.__rsub__cCst|j|j|j�S)N)rNr}r~r)r�rrr�__neg__sztimedelta.__neg__cCs|S)Nr)r�rrr�__pos__sztimedelta.__pos__cCs|jdkr|S|SdS)Nr)r})r�rrr�__abs__s
ztimedelta.__abs__cCs`t|t�r(t|j||j||j|�St|t�r\|j�}|j�\}}tddt	|||��St
S)Nr)r[rcrNr}r~rrd�_to_microseconds�as_integer_ratior|r�)r�r��usecrxryrrr�__mul__#s


ztimedelta.__mul__cCs|jd|jd|jS)Nr!ii@Bi�Q)r}r~r)r�rrrr�2sztimedelta._to_microsecondscCsNt|ttf�stS|j�}t|t�r0||j�St|t�rJtdd||�SdS)Nr)r[rcrNr�r�)r�r�r�rrr�__floordiv__6s

ztimedelta.__floordiv__cCs~t|tttf�stS|j�}t|t�r2||j�St|t�rNtddt||��St|t�rz|j�\}}tddt|||��SdS)Nr)r[rcrdrNr�r�r|r�)r�r�r�rxryrrr�__truediv__?s


ztimedelta.__truediv__cCs*t|t�r&|j�|j�}tdd|�StS)Nr)r[rNr�r�)r�r�r{rrr�__mod__Ks
ztimedelta.__mod__cCs4t|t�r0t|j�|j��\}}|tdd|�fStS)Nr)r[rNr#r�r�)r�r�rzr{rrr�
__divmod__Qs

ztimedelta.__divmod__cCs t|t�r|j|�dkSdSdS)NrF)r[rNr)r�r�rrr�__eq__Zs
ztimedelta.__eq__cCs&t|t�r|j|�dkSt||�dS)Nr)r[rNrrw)r�r�rrr�__le__`s
ztimedelta.__le__cCs&t|t�r|j|�dkSt||�dS)Nr)r[rNrrw)r�r�rrr�__lt__fs
ztimedelta.__lt__cCs&t|t�r|j|�dkSt||�dS)Nr)r[rNrrw)r�r�rrr�__ge__ls
ztimedelta.__ge__cCs&t|t�r|j|�dkSt||�dS)Nr)r[rNrrw)r�r�rrr�__gt__rs
ztimedelta.__gt__cCs t|t�st�t|j�|j��S)N)r[rNrr�	_getstate)r�r�rrrrxsztimedelta._cmpcCs|jdkrt|j��|_|jS)Nrr)r��hashr�)r�rrr�__hash__|s
ztimedelta.__hash__cCs|jdkp|jdkp|jdkS)Nr)r}r~r)r�rrr�__bool__�s

ztimedelta.__bool__cCs|j|j|jfS)N)r}r~r)r�rrrr��sztimedelta._getstatecCs|j|j�fS)N)r�r�)r�rrr�
__reduce__�sztimedelta.__reduce__N)r}r~rr�)rrrrrrr)%rgr�r��__doc__�	__slots__r�r�r�r��propertyrMr5r7r��__radd__r�r�r�r�r�r��__rmul__r�r�r�r�r�r�r�r�r�r�rr�r�r�r�rrrrrNQsD
d		
		rNi�ɚ;rmrni?B)rMr3r4r5r7)r7c@s(eZdZdZdCZdDdd�Zed	d
��Zedd��Zed
d��Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZeZedd��Zedd��Zedd��Zdd �Zd!d"�ZdEd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�ZeZd5d6�Z d7d8�Z!d9d:�Z"d;d<�Z#d=d>�Z$d?d@�Z%dAdB�Z&dS)F�datea�Concrete date type.

    Constructors:

    __new__()
    fromtimestamp()
    today()
    fromordinal()

    Operators:

    __repr__, __str__
    __eq__, __le__, __lt__, __ge__, __gt__, __hash__
    __add__, __radd__, __sub__ (add/radd only with timedelta arg)

    Methods:

    timetuple()
    toordinal()
    weekday()
    isoweekday(), isocalendar(), isoformat()
    ctime()
    strftime()

    Properties (readonly):
    year, month, day
    �_year�_month�_dayr�NcCs�|dkr�t|ttf�r�t|�dkr�dt|dd��ko@dknr�t|t�r|y|jd�}Wntk
rztd��YnXtj	|�}|j
|�d	|_|St|||�\}}}tj	|�}||_
||_||_d
|_|S)zVConstructor.

        Arguments:

        year, month, day (required, base 1)
        Nrrrr r�latin1znFailed to encode latin1 string when unpickling a date object. pickle.load(data, encoding='latin1') is assumed.rr)r[�bytesr\rJ�ord�encode�UnicodeEncodeErrorr9rRr��_date__setstater�rlr�r�r�)r�rrrr�rrrr��s($



zdate.__new__c	Cs(tj|�\	}}}}}}}}	}
||||�S)z;Construct a date from a POSIX timestamp (like time.time()).)r+�	localtime)r��trr,r-r.r/r0�weekday�jdayrarrr�
fromtimestamp�szdate.fromtimestampcCstj�}|j|�S)z"Construct a date from time.time().)r+�timer�)r�r�rrr�today�sz
date.todaycCst|�\}}}||||�S)z�Construct a date from a proleptic Gregorian ordinal.

        January 1 of year 1 is day 1.  Only the year, month and day are
        non-zero in the result.
        )r()r�r'rr,r-rrr�fromordinal�szdate.fromordinalcCs d|jj|jj|j|j|jfS)a5Convert to formal string, for repr().

        >>> dt = datetime(2010, 1, 1)
        >>> repr(dt)
        'datetime.datetime(2010, 1, 1, 0, 0)'

        >>> dt = datetime(2010, 1, 1, tzinfo=timezone.utc)
        >>> repr(dt)
        'datetime.datetime(2010, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)'
        z%s.%s(%d, %d, %d))r�r�r�r�r�r�)r�rrrr��s
z
date.__repr__cCs.|j�dpd}dt|t|j|j|jfS)zReturn ctime() style string.r*z%s %s %2d 00:00:00 %04d)�	toordinal�	_DAYNAMES�_MONTHNAMESr�r�r�)r�r�rrr�ctimes
z
date.ctimecCst|||j��S)zFormat using strftime().)rZrS)r�r=rrrrQ	sz
date.strftimecCs:t|t�stdt|�j��t|�dkr2|j|�St|�S)Nzmust be str, not %sr)r[r\r]r^rgrJrQ)r�r=rrr�
__format__
s


zdate.__format__cCsd|j|j|jfS)z�Return the date formatted according to ISO.

        This is 'YYYY-MM-DD'.

        References:
        - http://www.w3.org/TR/NOTE-datetime
        - http://www.cl.cam.ac.uk/~mgk25/iso-time.html
        z%04d-%02d-%02d)r�r�r�)r�rrr�	isoformats	zdate.isoformatcCs|jS)z
year (1-9999))r�)r�rrrr"sz	date.yearcCs|jS)zmonth (1-12))r�)r�rrrr'sz
date.monthcCs|jS)z
day (1-31))r�)r�rrrr,szdate.daycCst|j|j|jdddd�S)z9Return local time tuple compatible with time.localtime().rrr)r1r�r�r�)r�rrrrS4szdate.timetuplecCst|j|j|j�S)z�Return proleptic Gregorian ordinal for the year, month and day.

        January 1 of year 1 is day 1.  Only the year, month and day values
        contribute to the result.
        )rr�r�r�)r�rrrr�9szdate.toordinalcCs:|dkr|j}|dkr|j}|dkr*|j}t|�|||�S)z;Return a new date with new values for the specified fields.N)r�r�r�r^)r�rrrrrrrOAszdate.replacecCst|t�r|j|�dkStS)Nr)r[r�rr�)r�r�rrrr�Ms
zdate.__eq__cCst|t�r|j|�dkStS)Nr)r[r�rr�)r�r�rrrr�Rs
zdate.__le__cCst|t�r|j|�dkStS)Nr)r[r�rr�)r�r�rrrr�Ws
zdate.__lt__cCst|t�r|j|�dkStS)Nr)r[r�rr�)r�r�rrrr�\s
zdate.__ge__cCst|t�r|j|�dkStS)Nr)r[r�rr�)r�r�rrrr�as
zdate.__gt__cCsPt|t�st�|j|j|j}}}|j|j|j}}}t|||f|||f�S)N)r[r�rr�r�r�r)r�r�rr,r-Zy2�m2Zd2rrrrfsz	date._cmpcCs|jdkrt|j��|_|jS)zHash.rr)r�r�r�)r�rrrr�ls
z
date.__hash__cCsFt|t�rB|j�|j}d|ko*tknr:tj|�Std��tS)zAdd a date to a timedelta.rzresult out of range)	r[rNr�rM�_MAXORDINALr�r�r�r�)r�r��orrrr�ts

zdate.__add__cCsDt|t�r|t|j�St|t�r@|j�}|j�}t||�StS)z.Subtract two dates, or a date and a timedelta.)r[rNrMr�r�r�)r�r��days1�days2rrrr�s

zdate.__sub__cCs|j�ddS)z:Return day of the week, where Monday == 0 ... Sunday == 6.r)r*)r�)r�rrrr��szdate.weekdaycCs|j�dpdS)z:Return day of the week, where Monday == 1 ... Sunday == 7.r*)r�)r�rrr�
isoweekday�szdate.isoweekdaycCs�|j}t|�}t|j|j|j�}t||d�\}}|dkr^|d8}t|�}t||d�\}}n$|dkr�|t|d�kr�|d7}d}||d|dfS)a�Return a 3-tuple containing ISO year, week number, and weekday.

        The first ISO week of the year is the (Mon-Sun) week
        containing the year's first Thursday; everything else derives
        from that.

        The first week is 1; Monday is 1 ... Sunday is 7.

        ISO calendar algorithm taken from
        http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm
        (used with permission)
        r*rr�4)r��_isoweek1mondayrr�r�r#)r�r�week1mondayr�Zweekrrrr�isocalendar�s
zdate.isocalendarcCs&t|jd�\}}t|||j|jg�fS)N�)r#r�r�r�r�)r��yhi�ylorrrr��szdate._getstatecCs"|\}}|_|_|d||_dS)Nr�)r�r�r�)r��stringr�r�rrr�
__setstate�szdate.__setstatecCs|j|j�fS)N)r�r�)r�rrrr��szdate.__reduce__)r�r�r�r�)NN)NNN)'rgr�r�r�r�r��classmethodr�r�r�r�r�rQr�r�r�r�rrrrSr�rOr�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�rrrrr��sD
"
	
r�r)rMc@s<eZdZdZfZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dS)
rtz}Abstract base class for time zone info classes.

    Subclasses must override the name(), utcoffset() and dst() methods.
    cCstd��dS)z%datetime -> string name of time zone.z&tzinfo subclass must override tzname()N)�NotImplementedError)r��dtrrrrH�sz
tzinfo.tznamecCstd��dS)z:datetime -> minutes east of UTC (negative for west of UTC)z)tzinfo subclass must override utcoffset()N)r�)r�r�rrrrD�sztzinfo.utcoffsetcCstd��dS)z�datetime -> DST offset in minutes east of UTC.

        Return 0 if DST not in effect.  utcoffset() must include the DST
        offset.
        z#tzinfo subclass must override dst()N)r�)r�r�rrrra�sz
tzinfo.dstcCs�t|t�std��|j|k	r$td��|j�}|dkr<td��|j�}|dkrTtd��||}|r�||7}|j�}|dkr�td��||S)z*datetime in UTC -> datetime in local time.z&fromutc() requires a datetime argumentzdt.tzinfo is not selfNz0fromutc() requires a non-None utcoffset() resultz*fromutc() requires a non-None dst() resultz;fromutc(): dt.dst gave inconsistent results; cannot convert)r[�datetimer]rtr9rDra)r�r�ZdtoffZdtdst�deltarrr�fromutc�s"

ztzinfo.fromutccCsft|dd�}|r|�}nf}t|dd�}|r4|�}nt|dd�pBd}|dkrV|j|fS|j||fSdS)N�__getinitargs__�__getstate__�__dict__)rKr�)r�Zgetinitargs�args�getstate�staterrrr��s
ztzinfo.__reduce__N)
rgr�r�r�r�rHrDrar�r�rrrrrt�srtc@s eZdZdZdGZdHd	d�dd
�Zedd��Zedd��Zedd��Z	edd��Z
edd��Zedd��Zdd�Z
dd�Zdd�Zd d!�Zd"d#�ZdId%d&�Zd'd(�ZdJd*d+�Zd,d-�ZdKd/d0�ZeZd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�ZdLd
d�d<d=�ZdMd?d@�ZdAdB�ZdCdD�Z dEdF�Z!d
S)Nr�a<Time with time zone.

    Constructors:

    __new__()

    Operators:

    __repr__, __str__
    __eq__, __le__, __lt__, __ge__, __gt__, __hash__

    Methods:

    strftime()
    isoformat()
    utcoffset()
    tzname()
    dst()

    Properties (readonly):
    hour, minute, second, microsecond, tzinfo, fold
    �_hour�_minute�_second�_microsecond�_tzinfor��_foldrN)rrcCs�t|ttf�r�t|�dkr�t|dd��d@dkr�t|t�rhy|jd�}Wntk
rftd��YnXtj	|�}|j
||p~d�d	|_|St|||||�\}}}}}t
|�tj	|�}||_||_||_||_||_d
|_||_|S)z�Constructor.

        Arguments:

        hour, minute (required)
        second, microsecond (default to zero)
        tzinfo (default to None)
        fold (keyword only, default to zero)
        r)rr�r!r�znFailed to encode latin1 string when unpickling a time object. pickle.load(data, encoding='latin1') is assumed.Nrr)r[r�r\rJr�r�r�r9rRr��_time__setstater�rsrvr�r�r�r�r�r�)r�rorprqrArtrrr�rrrr�#s0



ztime.__new__cCs|jS)zhour (0-23))r�)r�rrrroKsz	time.hourcCs|jS)z
minute (0-59))r�)r�rrrrpPsztime.minutecCs|jS)z
second (0-59))r�)r�rrrrqUsztime.secondcCs|jS)zmicrosecond (0-999999))r�)r�rrrrAZsztime.microsecondcCs|jS)ztimezone info object)r�)r�rrrrt_sztime.tzinfocCs|jS)N)r�)r�rrrrrdsz	time.foldcCs$t|t�r|j|dd�dkSdSdS)NT)�allow_mixedrF)r[r�r)r�r�rrrr�ls
ztime.__eq__cCs&t|t�r|j|�dkSt||�dS)Nr)r[r�rrw)r�r�rrrr�rs
ztime.__le__cCs&t|t�r|j|�dkSt||�dS)Nr)r[r�rrw)r�r�rrrr�xs
ztime.__lt__cCs&t|t�r|j|�dkSt||�dS)Nr)r[r�rrw)r�r�rrrr�~s
ztime.__ge__cCs&t|t�r|j|�dkSt||�dS)Nr)r[r�rrw)r�r�rrrr��s
ztime.__gt__Fc
Cs�t|t�st�|j}|j}d}}||kr0d}n|j�}|j�}||k}|rvt|j|j|j|j	f|j|j|j|j	f�S|dks�|dkr�|r�dSt
d��|jd|j|tdd�}|jd|j|tdd�}	t||j|j	f|	|j|j	f�S)NTrz$cannot compare naive and aware timesr�r)r4)r[r�rr�rDrr�r�r�r�r]rN)
r�r�r��mytz�ottz�myoff�otoff�base_compareZmyhhmmZothhmmrrrr�s,
z	time._cmpcCs�|jd	kr�|jr|jdd�}n|}|j�}|sBt|j�d�|_n�tt|j|j	d�|tdd��\}}|tdd�s~t
d��|tdd�}d|ko�dknr�tt|||j|j
��|_nt|||j|j
f�|_|jS)
zHash.rr)rr)r3r4)r3)r4zwhole minuter!r)r�rrrOrDr�r�r#rNrorprr�rqrA)r�r��tzoffrXr,rrrr��s
z
time.__hash__�:cCs�|j�}|dk	r�|jdkr&d}|}nd}t|tdd��\}}t|tdd��\}}d|koddknsnt�d	||||f}|r�|d
|j7}|S)z2Return formatted timezone offset (+xx:xx) or None.NrrFrEr)r3)r4r!z%s%02d%s%02dz:%02d)rDrMr#rNrr5)r��sep�offrWr.r/r0rrr�_tzstr�s
ztime._tzstrcCs�|jdkrd|j|jf}n|jdkr2d|j}nd}d|jj|jj|j|j|f}|jdk	r�|dd�dksrt�|dd�d	|jd}|j	r�|d
d�dks�t�|dd�d
}|S)z%Convert to formal string, for repr().rz, %d, %dz, %drCz%s.%s(%d, %d%s)Nr�)z, tzinfo=%rz	, fold=1)rrrr)
r�r�r�r�r�r�r�r�rr�)r�rYrrrr��s


z
time.__repr__r2cCs0t|j|j|j|j|�}|j�}|r,||7}|S)a'Return the time formatted according to ISO.

        The full format is 'HH:MM:SS.mmmmmm+zz:zz'. By default, the fractional
        part is omitted if self.microsecond == 0.

        The optional argument timespec specifies the number of additional
        terms of the time to include.
        )r>r�r�r�r�r�)r�r<rYrurrrr��s	
ztime.isoformatc	Cs(ddd|j|j|jdddf	}t|||�S)z{Format using strftime().  The date part of the timestamp passed
        to underlying strftime should not be used.
        ilrrr)r�r�r�rZ)r�r=rSrrrrQ�s
z
time.strftimecCs:t|t�stdt|�j��t|�dkr2|j|�St|�S)Nzmust be str, not %sr)r[r\r]r^rgrJrQ)r�r=rrrr��s


ztime.__format__cCs(|jdkrdS|jjd�}td|�|S)zQReturn the timezone offset in minutes east of UTC (negative west of
        UTC).NrD)r�rDrb)r�rVrrrrDs


ztime.utcoffsetcCs&|jdkrdS|jjd�}t|�|S)aReturn the timezone name.

        Note that the name is 100% informational -- there's no requirement that
        it mean anything in particular. For example, "GMT", "UTC", "-500",
        "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies.
        N)r�rHr`)r�r_rrrrHs

ztime.tznamecCs(|jdkrdS|jjd�}td|�|S)afReturn 0 if DST is not in effect, or the DST offset (in minutes
        eastward) if DST is in effect.

        This is purely informational; the DST offset has already been added to
        the UTC offset returned by utcoffset() if applicable, so there's no
        need to consult dst() unless you're interested in displaying the DST
        info.
        Nra)r�rarb)r�rVrrrras
	

ztime.dstTcCsl|dkr|j}|dkr|j}|dkr*|j}|dkr8|j}|dkrF|j}|dkrT|j}t|�||||||d�S)z;Return a new time with new values for the specified fields.NT)rr)rorprqrArtr�r^)r�rorprqrArtrrrrrrO,sztime.replacer cCspt|jd�\}}t|d�\}}|j}|jr:|dkr:|d7}t||j|j|||g�}|jdkrb|fS||jfSdS)Nr�r �)r#r�r�r�r�r�r�r�)r��protocol�us2�us3�us1rX�	basestaterrrr�?s
ztime._getstatecCsv|dk	rt|t�rtd��|\}|_|_}}}|dkrJd|_|d|_nd|_||_|d>|Bd>|B|_||_dS)Nzbad tzinfo state argr�rr�r�)	r[�
_tzinfo_classr]r�r�r�r�r�r�)r�r�rtrXr�r�r�rrrr�Lsztime.__setstatecCst|j|�fS)N)r�r�)r�r�rrr�
__reduce_ex__Ysztime.__reduce_ex__cCs
|jd�S)Nr)r)r�rrrr�\sztime.__reduce__)r�r�r�r�r�r�r�)rrrrN)F)r�)r2)NNNNT)r )"rgr�r�r�r�r�r�rorprqrArtrrr�r�r�r�r�rr�r�r�r�r�rQr�rDrHrarOr�r�rr�rrrrr�
s>(


		



r�c@s�eZdZdZejejZdbdd�dd�Zedd��Z	ed	d
��Z
edd��Zed
d��Zedd��Z
edd��Zedd��Zedcdd��Zedd��Zedddd��Zedd��Zededd��Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zdfdd�d.d/�Zd0d1�Zdgd2d3�Zd4d5�Zdhd8d9�Zd:d;�Z d<d=�Z!ed>d?��Z"d@dA�Z#dBdC�Z$dDdE�Z%dFdG�Z&dHdI�Z'dJdK�Z(dLdM�Z)dNdO�Z*didQdR�Z+dSdT�Z,e,Z-dUdV�Z.dWdX�Z/djdZd[�Z0d\d]�Z1d^d_�Z2d`da�Z3dS)kr�z�datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])

    The year, month and day arguments are required. tzinfo may be None, or an
    instance of a tzinfo subclass. The remaining arguments may be ints.
    Nr)rrc	Cst|ttf�r�t|�dkr�dt|dd��d@ko<dknr�t|t�rxyt|d�}Wntk
rvtd��YnXtj|�}
|
j	||�d	|
_
|
St|||�\}}}t|||||	�\}}}}}	t
|�tj|�}
||
_||
_||
_||
_||
_||
_||
_||
_d
|
_
|	|
_|
S)Nr�rrr r�rr�zrFailed to encode latin1 string when unpickling a datetime object. pickle.load(data, encoding='latin1') is assumed.rr)r[r�r\rJr�r�r9rRr��_datetime__setstater�rlrsrvr�r�r�r�r�r�r�r�r�)r�rrrrorprqrArtrrr�rrrr�ms8(


zdatetime.__new__cCs|jS)zhour (0-23))r�)r�rrrro�sz
datetime.hourcCs|jS)z
minute (0-59))r�)r�rrrrp�szdatetime.minutecCs|jS)z
second (0-59))r�)r�rrrrq�szdatetime.secondcCs|jS)zmicrosecond (0-999999))r�)r�rrrrA�szdatetime.microsecondcCs|jS)ztimezone info object)r�)r�rrrrt�szdatetime.tzinfocCs|jS)N)r�)r�rrrrr�sz
datetime.foldc	Csptj|�\}}t|d�}|dkr4|d7}|d8}n|dkrL|d8}|d7}|rVtjntj}||�\	}}}	}
}}}
}}t|d�}||||	|
||||�}|dk�rbd}||kr�tjj	d	�r�|S|||�dd
�\}}}	}
}}||||	|
||||�}||t
d|�}|jdk�rl|||t
dd��dd
�\}}}	}
}}||||	|
||||�}||k�rld|_n
|j
|�}|S)z�Construct a datetime from a POSIX timestamp (like time.time()).

        A timezone info object may be passed in as well.
        g��.Ai@BrrrnNr!i�winr)i�Q)r�r�r�r+�gmtimer��min�sys�platform�
startswithrNrMr�r�)r�r��utcruZfracr;Z	converterrr,r-r.r/r0r�r�ra�result�max_fold_secondsZprobe1ZtransZprobe2rrr�_fromtimestamp�s4


 *

zdatetime._fromtimestampcCst|�|j||dk	|�S)z�Construct a datetime from a POSIX timestamp (like time.time()).

        A timezone info object may be passed in as well.
        N)rvr
)r�r�rurrrr��szdatetime.fromtimestampcCs|j|dd�S)z6Construct a naive UTC datetime from a POSIX timestamp.TN)r
)r�r�rrr�utcfromtimestamp�szdatetime.utcfromtimestampcCstj�}|j||�S)zBConstruct a datetime from time.time() and optional time zone info.)r+r�r�)r�rur�rrr�now�szdatetime.nowcCstj�}|j|�S)z*Construct a UTC datetime from time.time().)r+r�r)r�r�rrr�utcnow�szdatetime.utcnowTcCs\t|t�std��t|t�s$td��|dkr2|j}||j|j|j|j|j	|j
|j||jd�	S)z8Construct a datetime from a given date and a given time.z%date argument must be a date instancez%time argument must be a time instanceT)rr)
r[�_date_classr]�_time_classrtrrrrorprqrArr)r�r�r�rtrrr�combine�s

zdatetime.combinecCsD|j�}|dkrd}n|r d}nd}t|j|j|j|j|j|j|�S)z9Return local time tuple compatible with time.localtime().Nrrr)rar1rrrrorprq)r�rarrrrSszdatetime.timetuplec
s�tddd��d}|�tdd�}�fdd�}||�|}||}||�}||kr�|||f|j}||�|}||kr�|Sn||}||ks�t�||}||�}	|	|kr�|S||kr�|Sttf|j||�S)	zReturn integer POSIX timestamp.i�rr!ircs>tj|�dd�\}}}}}}t||||||��tdd�S)Nr)rr)r+r�r�rN)�urr,r-r.r/r0)�epochrr�localszdatetime._mktime.<locals>.locali�Q)r�rNrrr�maxr)
r�rr�rrxZu1Zt1Zu2ryZt2r)rr�_mktimes*zdatetime._mktimecCs0|jdkr |j�}||jdS|tj�SdS)zReturn POSIX timestamp as floatNg��.A)r�rrA�_EPOCHr�)r�rYrrr�	timestamp2s
zdatetime.timestampcCsT|j�}|r||8}|j|j|j}}}|j|j|j}}}t||||||d�S)z4Return UTC time tuple compatible with time.gmtime().r)rDrrrrorprqr1)r�rVrr,r-r.r/r0rrr�utctimetuple:szdatetime.utctimetuplecCst|j|j|j�S)zReturn the date part.)r�r�r�r�)r�rrrr�Csz
datetime.datecCst|j|j|j|j|jd�S)z'Return the time part, with tzinfo None.)rr)r�rorprqrArr)r�rrrr�Gsz
datetime.timecCs t|j|j|j|j|j|jd�S)z'Return the time part, with same tzinfo.)rr)r�rorprqrAr�rr)r�rrr�timetzKszdatetime.timetzc	
Cs�|dkr|j}|dkr|j}|dkr*|j}|dkr8|j}|dkrF|j}|dkrT|j}|dkrb|j}|dkrp|j}|	dkr~|j}	t	|�|||||||||	d�	S)z?Return a new datetime with new values for the specified fields.NT)rr)
rrrrorprqrArtrrr^)
r�rrrrorprqrArtrrrrrrOPs(zdatetime.replacecCs�|jdkr|j�}n|ttdd�}tj|�}t|dd��}y|j}|j}WnDt	k
r�|ttj
|�dd��}tjd|�}t||�}YnXtt|d�|�}|S)Nr)r5r)z%Z)
rtrrrNr+r�r�Z	tm_gmtoffZtm_zonerfrrQ�timezone)r�ZtsZlocaltmrZgmtoffZzoner�rurrr�_local_timezoneis



zdatetime._local_timezonecCs�|dkr|j�}nt|t�s$td��|j}|dkrF|j�}|j|�}n,|j|�}|dkrr|jdd�j�}|j|�}||kr~|S||j|d�}|j|�S)Nz)tz argument must be an instance of tzinfo)rt)rr[rtr]rDrOr�)r�rur�Zmyoffsetr
rrr�
astimezone|s 



zdatetime.astimezonecCs:|j�dpd}dt|t|j|j|j|j|j|jfS)zReturn ctime() style string.r*z%s %s %2d %02d:%02d:%02d %04d)	r�r�r�r�r�r�r�r�r�)r�r�rrrr��szdatetime.ctime�Tr2c	Cs�d|j|j|j|ft|j|j|j|j|�}|j�}|dk	r�|j	dkrTd}|}nd}t
|tdd��\}}t
|tdd��\}}|d	|||f7}|r�|js�t
�|d
|j7}|S)a(Return the time formatted according to ISO.

        The full format looks like 'YYYY-MM-DD HH:MM:SS.mmmmmm'.
        By default, the fractional part is omitted if self.microsecond == 0.

        If self.tzinfo is not None, the UTC offset is also attached, giving
        giving a full format of 'YYYY-MM-DD HH:MM:SS.mmmmmm+HH:MM'.

        Optional argument sep specifies the separator between date and
        time, default 'T'.

        The optional argument timespec specifies the number of additional
        terms of the time to include.
        z%04d-%02d-%02d%cNrrFrEr)r3)r4z%s%02d:%02dz:%02d)r�r�r�r>r�r�r�r�rDrMr#rNr7rr5)	r�r�r<rYr�rWr.r/r0rrrr��s 
zdatetime.isoformatcCs�|j|j|j|j|j|j|jg}|d	dkr2|d
=|ddkrD|d=d|jj|jj	dj
tt|��f}|j
dk	r�|d
d�dks�t�|dd�d|j
d}|jr�|dd�dks�t�|dd�d}|S)z%Convert to formal string, for repr().rrz	%s.%s(%s)z, Nr�z, tzinfo=%rz	, fold=1)rrrrrrrr)r�r�r�r�r�r�r�r�r�r�rP�mapr\r�rr�)r��LrYrrrr��s 
zdatetime.__repr__cCs|jdd�S)zConvert to string, for str().� )r�)r�)r�rrrr��szdatetime.__str__cCsddl}|j|||�S)zKstring, format -> new datetime parsed from a string (like time.strptime()).rN)�	_strptimeZ_strptime_datetime)r�Zdate_stringr:r$rrr�strptime�szdatetime.strptimecCs(|jdkrdS|jj|�}td|�|S)zQReturn the timezone offset in minutes east of UTC (negative west of
        UTC).NrD)r�rDrb)r�rVrrrrD�s


zdatetime.utcoffsetcCs&|jdkrdS|jj|�}t|�|S)aReturn the timezone name.

        Note that the name is 100% informational -- there's no requirement that
        it mean anything in particular. For example, "GMT", "UTC", "-500",
        "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies.
        N)r�rHr`)r�r_rrrrH�s

zdatetime.tznamecCs(|jdkrdS|jj|�}td|�|S)afReturn 0 if DST is not in effect, or the DST offset (in minutes
        eastward) if DST is in effect.

        This is purely informational; the DST offset has already been added to
        the UTC offset returned by utcoffset() if applicable, so there's no
        need to consult dst() unless you're interested in displaying the DST
        info.
        Nra)r�rarb)r�rVrrrra�s
	

zdatetime.dstcCs2t|t�r|j|dd�dkSt|t�s*tSdSdS)NT)r�rF)r[r�rr�r�)r�r�rrrr�s


zdatetime.__eq__cCs4t|t�r|j|�dkSt|t�s&tSt||�dS)Nr)r[r�rr�r�rw)r�r�rrrr�s


zdatetime.__le__cCs4t|t�r|j|�dkSt|t�s&tSt||�dS)Nr)r[r�rr�r�rw)r�r�rrrr�s


zdatetime.__lt__cCs4t|t�r|j|�dkSt|t�s&tSt||�dS)Nr)r[r�rr�r�rw)r�r�rrrr�s


zdatetime.__ge__cCs4t|t�r|j|�dkSt|t�s&tSt||�dS)Nr)r[r�rr�r�rw)r�r�rrrr�'s


zdatetime.__gt__Fc		Cst|t�st�|j}|j}d}}||kr0d}nT|j�}|j�}|r|||j|jd�j�kr`dS||j|jd�j�kr|dS||k}|r�t|j|j	|j
|j|j|j
|jf|j|j	|j
|j|j|j
|jf�S|dks�|dkr�|r�dStd��||}|jdk�rdS|�rd�pdS)NT)rrrz(cannot compare naive and aware datetimesrrr)r[r�rr�rDrOrrrr�r�r�r�r�r�r�r]rM)	r�r�r�r�r�r�r�r�Zdiffrrrr/s:
z
datetime._cmpc	Cs�t|t�stSt|j�|j|j|j|jd�}||7}t|j	d�\}}t|d�\}}d|j
koftknr�tj
tj|j
�t||||j|jd��Std��dS)zAdd a datetime and a timedelta.)r3r4r5r7ir�r)rtzresult out of rangeN)r[rNr�r�r�r�r�r�r#r5rMr�r�rr�r�r�r7r�r�)r�r�r�roZremrprqrrrr�Ts 

zdatetime.__add__c	Cs�t|t�s"t|t�r||StS|j�}|j�}|j|jd|jd}|j|jd|jd}t|||||j|j�}|j	|j	kr�|S|j
�}|j
�}||kr�|S|dks�|dkr�td��|||S)z6Subtract two datetimes, or a datetime and a timedelta.r�iNz(cannot mix naive and timezone-aware time)r[r�rNr�r�r�r�r�r�r�rDr])	r�r�r�r�Zsecs1Zsecs2�baser�r�rrrr�is(


zdatetime.__sub__cCs�|jdkr�|jr|jdd�}n|}|j�}|dkrFt|j�d�|_nDt|j|j|j	�}|j
d|jd|j}tt
|||j�|�|_|jS)Nrr)rrir�r)r�rrrOrDr�r�rrrrrorprqrNrA)r�r�r�rMr5rrrr��s
zdatetime.__hash__r c	Cs�t|jd�\}}t|jd�\}}t|d�\}}|j}|jrJ|dkrJ|d7}t||||j|j|j|j	|||g
�}|j
dkr~|fS||j
fSdS)Nr�r r�)r#r�r�r�r�r�r�r�r�r�r�)	r�r�r�r�r�r�r�r,r�rrrr��s
zdatetime._getstatec	
Cs�|dk	rt|t�rtd��|\
}}}|_|_|_|_}}}|dkrVd|_|d|_nd|_||_|d||_	|d>|Bd>|B|_
||_dS)Nzbad tzinfo state argr�rr�rr�r)r[rr]r�r�r�r�r�r�r�r�r�)	r�r�rtr�r�r,r�r�r�rrrr��s zdatetime.__setstatecCs|j|j|�fS)N)r�r�)r�r�rrrr�szdatetime.__reduce_ex__cCs
|jd�S)Nr)r)r�rrrr��szdatetime.__reduce__)NNrrrrN)N)N)T)NNNNNNNT)N)r r2)F)r )4rgr�r�r�r�r�r�r�r�rorprqrArtrrr�r
r�rrrrrSrrrrrOrrr�r�r�r�r%rDrHrar�r�r�r�r�rr�r�r�r�r�rrr�rrrrr�esj#,	
#	


"	

%
r�cCs8d}t|dd�}|dd}||}||kr4|d7}|S)Nr rr)r*)r)rZTHURSDAYZfirstdayZfirstweekdayr�rrrr��sr�c@s�eZdZdZe�Zefdd�Zed dd��Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zeddd�ZeZedd��ZdS)!r�_offset�_namecCs�t|t�std��||jkr,|s&|jSd}nt|t�s>td��|j|koT|jknsbtd��|j	dksz|j
ddkr�td��|j||�S)Nzoffset must be a timedeltazname must be a stringzYoffset must be a timedelta strictly between -timedelta(hours=24) and timedelta(hours=24).rr�zAoffset must be a timedelta representing a whole number of minutes)r[rNr]�_Omittedr
r\�
_minoffset�
_maxoffsetr9r7r5�_create)r�rVr_rrrr��s


ztimezone.__new__NcCstj|�}||_||_|S)N)rtr�r'r()r�rVr_r�rrrr,�s
ztimezone._createcCs|jdkr|jfS|j|jfS)zpickle supportN)r(r')r�rrrr��s
ztimezone.__getinitargs__cCst|�tkrdS|j|jkS)NF)r^rr')r�r�rrrr��sztimezone.__eq__cCs
t|j�S)N)r�r')r�rrrr��sztimezone.__hash__cCsL||jkrdS|jdkr0d|jj|jj|jfSd|jj|jj|j|jfS)aConvert to formal string, for repr().

        >>> tz = timezone.utc
        >>> repr(tz)
        'datetime.timezone.utc'
        >>> tz = timezone(timedelta(hours=-5), 'EST')
        >>> repr(tz)
        "datetime.timezone(datetime.timedelta(-1, 68400), 'EST')"
        zdatetime.timezone.utcNz	%s.%s(%r)z
%s.%s(%r, %r))r
r(r�r�r�r')r�rrrr��s



ztimezone.__repr__cCs
|jd�S)N)rH)r�rrrr�sztimezone.__str__cCs$t|t�s|dkr|jStd��dS)Nz8utcoffset() argument must be a datetime instance or None)r[r�r'r])r�r�rrrrD
sztimezone.utcoffsetcCs:t|t�s|dkr.|jdkr(|j|j�S|jStd��dS)Nz5tzname() argument must be a datetime instance or None)r[r�r(�_name_from_offsetr'r])r�r�rrrrHs

ztimezone.tznamecCs"t|t�s|dkrdStd��dS)Nz2dst() argument must be a datetime instance or None)r[r�r])r�r�rrrrasztimezone.dstcCs2t|t�r&|j|k	rtd��||jStd��dS)Nzfromutc: dt.tzinfo is not selfz6fromutc() argument must be a datetime instance or None)r[r�rtr9r'r])r�r�rrrr�s



ztimezone.fromutcrmrn)r3r4cCsT|sdS|td�kr d}|}nd}t|tdd��\}}|tdd�}dj|||�S)	NZUTCrrFrEr)r3)r4zUTC{}{:02d}:{:02d})rNr#r:)r�rWr3�restr4rrrr-*sztimezone._name_from_offset)r'r()N)rgr�r�r�rRr)r�r�r,r�r�r�r�r�rDrHrar�rNr+r*�staticmethodr-rrrrr�s"	ri�)rt)�*)r�rri�i�)r2i6e�)9r�r�r+Zmathr�rrrjrkr�rrZdbmrrIrrrrrr$r%r&rr(r�r�r1r>rZr`rbrirlrsrvrwr|rNrrZ
resolutionr�rrtrrr�r�rr,r
r*r+rZ	_datetime�ImportErrorrrrr�<module>s�
	?
:
?


,DWVpG




codecs.cpython-36.opt-1.pyc000064400000102156150335715140011402 0ustar003


 \���:@s�dZddlZddlZyddlTWn.ek
rNZzede��WYddZ[XnXddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0g,Zd1Zd2Z	Z
d3ZZd4Z
d5Zejd6kr�e
ZZe
ZneZZeZe
ZeZe
ZeZGd7d�de�ZGd8d�d�ZGd9d�de�ZGd:d;�d;e�ZGd<d�de�ZGd=d>�d>e�ZGd?d�de�ZGd@d�de�Z GdAd�d�Z!GdBd�d�Z"d\dFd�Z#d]dGd�Z$dHd�Z%dId �Z&dJd!�Z'dKd"�Z(dLd#�Z)dMd$�Z*d^dNd'�Z+d_dOd(�Z,dPdQ�Z-dRdS�Z.y4e/dD�Z0e/dT�Z1e/dU�Z2e/dV�Z3e/dW�Z4e/dX�Z5Wn.e6k
�r`dZ0dZ1dZ2dZ3dZ4dZ5YnXdZ7e7�rtddl8Z8e9dYk�r�e$ej:dZd[�e_:e$ej;d[dZ�e_;dS)`z� codecs -- Python Codec Registry, API and helpers.


Written by Marc-Andre Lemburg (mal@lemburg.com).

(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.

�N)�*z%Failed to load the builtin codecs: %s�register�lookup�open�EncodedFile�BOM�BOM_BE�BOM_LE�BOM32_BE�BOM32_LE�BOM64_BE�BOM64_LE�BOM_UTF8�	BOM_UTF16�BOM_UTF16_LE�BOM_UTF16_BE�	BOM_UTF32�BOM_UTF32_LE�BOM_UTF32_BE�	CodecInfo�Codec�IncrementalEncoder�IncrementalDecoder�StreamReader�StreamWriter�StreamReaderWriter�
StreamRecoder�
getencoder�
getdecoder�getincrementalencoder�getincrementaldecoder�	getreader�	getwriter�encode�decode�
iterencode�
iterdecode�
strict_errors�
ignore_errors�replace_errors�xmlcharrefreplace_errors�backslashreplace_errors�namereplace_errors�register_error�lookup_errorss��s��s��s���littlec@s,eZdZdZdZd	dd�dd�Zdd�ZdS)
rz0Codec details when looking up the codec registryTN)�_is_text_encodingc
CsPtj|||||f�}	||	_||	_||	_||	_||	_||	_||	_|dk	rL||	_	|	S)N)
�tuple�__new__�namer#r$�incrementalencoder�incrementaldecoder�streamwriter�streamreaderr0)
�clsr#r$r7r6r4r5r3r0�self�r:�/usr/lib64/python3.6/codecs.pyr2]szCodecInfo.__new__cCsd|jj|jj|jt|�fS)Nz%<%s.%s object for encoding %s at %#x>)�	__class__�
__module__�__qualname__r3�id)r9r:r:r;�__repr__lszCodecInfo.__repr__)NNNNN)�__name__r=r>�__doc__r0r2r@r:r:r:r;rRs
c@s$eZdZdZddd�Zd	dd�ZdS)
ra9 Defines the interface for stateless encoders/decoders.

        The .encode()/.decode() methods may use different error
        handling schemes by providing the errors argument. These
        string values are predefined:

         'strict' - raise a ValueError error (or a subclass)
         'ignore' - ignore the character and continue with the next
         'replace' - replace with a suitable replacement character;
                    Python will use the official U+FFFD REPLACEMENT
                    CHARACTER for the builtin Unicode codecs on
                    decoding and '?' on encoding.
         'surrogateescape' - replace with private code points U+DCnn.
         'xmlcharrefreplace' - Replace with the appropriate XML
                               character reference (only for encoding).
         'backslashreplace'  - Replace with backslashed escape sequences.
         'namereplace'       - Replace with \N{...} escape sequences
                               (only for encoding).

        The set of allowed values can be extended via register_error.

    �strictcCst�dS)a# Encodes the object input and returns a tuple (output
            object, length consumed).

            errors defines the error handling to apply. It defaults to
            'strict' handling.

            The method may not store state in the Codec instance. Use
            StreamWriter for codecs which have to keep state in order to
            make encoding efficient.

            The encoder must be able to handle zero length input and
            return an empty object of the output object type in this
            situation.

        N)�NotImplementedError)r9�input�errorsr:r:r;r#�szCodec.encodecCst�dS)a� Decodes the object input and returns a tuple (output
            object, length consumed).

            input must be an object which provides the bf_getreadbuf
            buffer slot. Python strings, buffer objects and memory
            mapped files are examples of objects providing this slot.

            errors defines the error handling to apply. It defaults to
            'strict' handling.

            The method may not store state in the Codec instance. Use
            StreamReader for codecs which have to keep state in order to
            make decoding efficient.

            The decoder must be able to handle zero length input and
            return an empty object of the output object type in this
            situation.

        N)rD)r9rErFr:r:r;r$�szCodec.decodeN)rC)rC)rAr=r>rBr#r$r:r:r:r;rqs
c@s<eZdZdZddd�Zddd�Zdd	�Zd
d�Zdd
�ZdS)rz�
    An IncrementalEncoder encodes an input in multiple steps. The input can
    be passed piece by piece to the encode() method. The IncrementalEncoder
    remembers the state of the encoding process between calls to encode().
    rCcCs||_d|_dS)z�
        Creates an IncrementalEncoder instance.

        The IncrementalEncoder may use different error handling schemes by
        providing the errors keyword argument. See the module docstring
        for a list of possible values.
        �N)rF�buffer)r9rFr:r:r;�__init__�szIncrementalEncoder.__init__FcCst�dS)zA
        Encodes input and returns the resulting object.
        N)rD)r9rE�finalr:r:r;r#�szIncrementalEncoder.encodecCsdS)z:
        Resets the encoder to the initial state.
        Nr:)r9r:r:r;�reset�szIncrementalEncoder.resetcCsdS)z:
        Return the current state of the encoder.
        rr:)r9r:r:r;�getstate�szIncrementalEncoder.getstatecCsdS)zl
        Set the current state of the encoder. state must have been
        returned by getstate().
        Nr:)r9�stater:r:r;�setstate�szIncrementalEncoder.setstateN)rC)F)	rAr=r>rBrIr#rKrLrNr:r:r:r;r�s

c@sDeZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dS)�BufferedIncrementalEncoderz�
    This subclass of IncrementalEncoder can be used as the baseclass for an
    incremental encoder if the encoder must keep some of the output in a
    buffer between calls to encode().
    rCcCstj||�d|_dS)NrG)rrIrH)r9rFr:r:r;rI�sz#BufferedIncrementalEncoder.__init__cCst�dS)N)rD)r9rErFrJr:r:r;�_buffer_encode�sz)BufferedIncrementalEncoder._buffer_encodeFcCs0|j|}|j||j|�\}}||d�|_|S)N)rHrPrF)r9rErJ�data�result�consumedr:r:r;r#�s
z!BufferedIncrementalEncoder.encodecCstj|�d|_dS)NrG)rrKrH)r9r:r:r;rK�s
z BufferedIncrementalEncoder.resetcCs
|jpdS)Nr)rH)r9r:r:r;rL�sz#BufferedIncrementalEncoder.getstatecCs|pd|_dS)NrG)rH)r9rMr:r:r;rN�sz#BufferedIncrementalEncoder.setstateN)rC)F)
rAr=r>rBrIrPr#rKrLrNr:r:r:r;rO�s

rOc@s<eZdZdZddd�Zddd�Zdd	�Zd
d�Zdd
�ZdS)rz�
    An IncrementalDecoder decodes an input in multiple steps. The input can
    be passed piece by piece to the decode() method. The IncrementalDecoder
    remembers the state of the decoding process between calls to decode().
    rCcCs
||_dS)z�
        Create an IncrementalDecoder instance.

        The IncrementalDecoder may use different error handling schemes by
        providing the errors keyword argument. See the module docstring
        for a list of possible values.
        N)rF)r9rFr:r:r;rIszIncrementalDecoder.__init__FcCst�dS)z@
        Decode input and returns the resulting object.
        N)rD)r9rErJr:r:r;r$
szIncrementalDecoder.decodecCsdS)z9
        Reset the decoder to the initial state.
        Nr:)r9r:r:r;rKszIncrementalDecoder.resetcCsdS)a	
        Return the current state of the decoder.

        This must be a (buffered_input, additional_state_info) tuple.
        buffered_input must be a bytes object containing bytes that
        were passed to decode() that have not yet been converted.
        additional_state_info must be a non-negative integer
        representing the state of the decoder WITHOUT yet having
        processed the contents of buffered_input.  In the initial state
        and after reset(), getstate() must return (b"", 0).
        �r)rTrr:)r9r:r:r;rLszIncrementalDecoder.getstatecCsdS)z�
        Set the current state of the decoder.

        state must have been returned by getstate().  The effect of
        setstate((b"", 0)) must be equivalent to reset().
        Nr:)r9rMr:r:r;rN&szIncrementalDecoder.setstateN)rC)F)	rAr=r>rBrIr$rKrLrNr:r:r:r;r�s


c@sDeZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dS)�BufferedIncrementalDecoderz�
    This subclass of IncrementalDecoder can be used as the baseclass for an
    incremental decoder if the decoder must be able to handle incomplete
    byte sequences.
    rCcCstj||�d|_dS)NrT)rrIrH)r9rFr:r:r;rI4sz#BufferedIncrementalDecoder.__init__cCst�dS)N)rD)r9rErFrJr:r:r;�_buffer_decode9sz)BufferedIncrementalDecoder._buffer_decodeFcCs0|j|}|j||j|�\}}||d�|_|S)N)rHrVrF)r9rErJrQrRrSr:r:r;r$>s
z!BufferedIncrementalDecoder.decodecCstj|�d|_dS)NrT)rrKrH)r9r:r:r;rKFs
z BufferedIncrementalDecoder.resetcCs
|jdfS)Nr)rH)r9r:r:r;rLJsz#BufferedIncrementalDecoder.getstatecCs|d|_dS)Nr)rH)r9rMr:r:r;rNNsz#BufferedIncrementalDecoder.setstateN)rC)F)
rAr=r>rBrIrVr$rKrLrNr:r:r:r;rU.s

rUc@sTeZdZddd�Zdd�Zdd�Zdd	�Zddd�Zefd
d�Z	dd�Z
dd�ZdS)rrCcCs||_||_dS)aw Creates a StreamWriter instance.

            stream must be a file-like object open for writing.

            The StreamWriter may use different error handling
            schemes by providing the errors keyword argument. These
            parameters are predefined:

             'strict' - raise a ValueError (or a subclass)
             'ignore' - ignore the character and continue with the next
             'replace'- replace with a suitable replacement character
             'xmlcharrefreplace' - Replace with the appropriate XML
                                   character reference.
             'backslashreplace'  - Replace with backslashed escape
                                   sequences.
             'namereplace'       - Replace with \N{...} escape sequences.

            The set of allowed parameter values can be extended via
            register_error.
        N)�streamrF)r9rWrFr:r:r;rI[szStreamWriter.__init__cCs"|j||j�\}}|jj|�dS)z> Writes the object's contents encoded to self.stream.
        N)r#rFrW�write)r9�objectrQrSr:r:r;rXtszStreamWriter.writecCs|jdj|��dS)z[ Writes the concatenated list of strings to the stream
            using .write().
        rGN)rX�join)r9�listr:r:r;�
writelines{szStreamWriter.writelinescCsdS)a5 Flushes and resets the codec buffers used for keeping state.

            Calling this method should ensure that the data on the
            output is put into a clean state, that allows appending
            of new fresh data without having to rescan the whole
            stream to recover state.

        Nr:)r9r:r:r;rK�s
zStreamWriter.resetrcCs*|jj||�|dkr&|dkr&|j�dS)Nr)rW�seekrK)r9�offset�whencer:r:r;r]�szStreamWriter.seekcCs||j|�S)z? Inherit all other methods from the underlying stream.
        )rW)r9r3�getattrr:r:r;�__getattr__�szStreamWriter.__getattr__cCs|S)Nr:)r9r:r:r;�	__enter__�szStreamWriter.__enter__cCs|jj�dS)N)rW�close)r9�type�value�tbr:r:r;�__exit__�szStreamWriter.__exit__N)rC)r)rAr=r>rIrXr\rKr]r`rarbrgr:r:r:r;rYs

c@s�eZdZeZddd�Zd dd�Zd#dd	�Zd$dd
�Zd%dd�Z	dd�Z
d&dd�Zdd�Zdd�Z
efdd�Zdd�Zdd�Zd
S)'rrCcCs.||_||_d|_|j�|_|j|_d|_dS)a� Creates a StreamReader instance.

            stream must be a file-like object open for reading.

            The StreamReader may use different error handling
            schemes by providing the errors keyword argument. These
            parameters are predefined:

             'strict' - raise a ValueError (or a subclass)
             'ignore' - ignore the character and continue with the next
             'replace'- replace with a suitable replacement character
             'backslashreplace' - Replace with backslashed escape sequences;

            The set of allowed parameter values can be extended via
            register_error.
        rTN)rWrF�
bytebuffer�charbuffertype�_empty_charbuffer�
charbuffer�
linebuffer)r9rWrFr:r:r;rI�s
zStreamReader.__init__cCst�dS)N)rD)r9rErFr:r:r;r$�szStreamReader.decode�FcCsL|jr|jj|j�|_d|_|dkr(|}x�|dkrBt|j�|krBP|dkrV|jj�}n|jj|�}|j|}|srPy|j||j	�\}}Wn`t
k
r�}zD|r�|j|d|j�|j	�\}}|jdd�}	t|	�dkr؂n�WYdd}~XnX||d�|_|j|7_|s*Pq*W|dk�r*|j}
|j|_n|jd|�}
|j|d�|_|
S)a� Decodes data from the stream self.stream and returns the
            resulting object.

            chars indicates the number of decoded code points or bytes to
            return. read() will never return more data than requested,
            but it might return less, if there is not enough available.

            size indicates the approximate maximum number of decoded
            bytes or code points to read for decoding. The decoder
            can modify this setting as appropriate. The default value
            -1 indicates to read and decode as much as possible.  size
            is intended to prevent having to decode huge files in one
            step.

            If firstline is true, and a UnicodeDecodeError happens
            after the first line terminator in the input only the first line
            will be returned, the rest of the input will be kept until the
            next call to read().

            The method should use a greedy read strategy, meaning that
            it should read as much data as is allowed within the
            definition of the encoding and the given size, e.g.  if
            optional encoding endings or state markers are available
            on the stream, these should be read too.
        NrT)�keependsrm)
rlrjrZrk�lenrW�readrhr$rF�UnicodeDecodeError�start�
splitlines)r9�size�chars�	firstline�newdatarQ�newchars�decodedbytes�exc�linesrRr:r:r;rp�sD


zStreamReader.readNTc	Cs�|jrP|jd}|jd=t|j�dkr8|jd|_d|_|sL|jdd�d}|S|pVd}|j}�xr|j|dd�}|r�t|t�r�|jd	�s�t|t	�r�|jd
�r�||jddd�7}||7}|jdd�}|�r�t|�dk�r:|d}|d=t|�dk�r|d|j7<||_d|_n|d|j|_|�s8|jdd�d}P|d}|djdd�d}||k�r�|jj
|dd��|j|_|�r�|}n|}P|�s�|dk	�r�|�r�|�r�|jdd�d}P|dkrb|d
9}qbW|S)z� Read one line from the input stream and return the
            decoded data.

            size, if given, is passed as size argument to the
            read() method.

        rrmNF)rn�HT)rv�
�
)rtrui@����)rlrorkrsrjrp�
isinstance�str�endswith�bytesrZ)	r9rtrn�line�readsizerQr{�line0withend�line0withoutendr:r:r;�readlines^


zStreamReader.readlinecCs|j�}|j|�S)aS Read all lines available on the input stream
            and return them as a list.

            Line breaks are implemented using the codec's decoder
            method and are included in the list entries.

            sizehint, if given, is ignored since there is no efficient
            way to finding the true end-of-line.

        )rprs)r9�sizehintrnrQr:r:r;�	readlines]szStreamReader.readlinescCsd|_|j|_d|_dS)z� Resets the codec buffers used for keeping state.

            Note that no stream repositioning should take place.
            This method is primarily intended to be able to recover
            from decoding errors.

        rTN)rhrjrkrl)r9r:r:r;rKls	zStreamReader.resetrcCs|jj||�|j�dS)zp Set the input stream's current position.

            Resets the codec buffers used for keeping state.
        N)rWr]rK)r9r^r_r:r:r;r]yszStreamReader.seekcCs|j�}|r|St�dS)z4 Return the next decoded line from the input stream.N)r��
StopIteration)r9r�r:r:r;�__next__�szStreamReader.__next__cCs|S)Nr:)r9r:r:r;�__iter__�szStreamReader.__iter__cCs||j|�S)z? Inherit all other methods from the underlying stream.
        )rW)r9r3r`r:r:r;ra�szStreamReader.__getattr__cCs|S)Nr:)r9r:r:r;rb�szStreamReader.__enter__cCs|jj�dS)N)rWrc)r9rdrerfr:r:r;rg�szStreamReader.__exit__)rC)rCr�r�)r�r�F)NT)NT)r)rAr=r>r�rirIr$rpr�r�rKr]r�r�r`rarbrgr:r:r:r;r�s


P
K

c@s�eZdZdZdZd!dd�Zd#dd�Zd$d
d�Zd%dd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
d&dd�Zefdd�Zdd�Zdd �Zd	S)'ra StreamReaderWriter instances allow wrapping streams which
        work in both read and write modes.

        The design is such that one can use the factory functions
        returned by the codec.lookup() function to construct the
        instance.

    �unknownrCcCs(||_|||�|_|||�|_||_dS)aR Creates a StreamReaderWriter instance.

            stream must be a Stream-like object.

            Reader, Writer must be factory functions or classes
            providing the StreamReader, StreamWriter interface resp.

            Error handling is done in the same way as defined for the
            StreamWriter/Readers.

        N)rW�reader�writerrF)r9rW�Reader�WriterrFr:r:r;rI�s
zStreamReaderWriter.__init__rmcCs|jj|�S)N)r�rp)r9rtr:r:r;rp�szStreamReaderWriter.readNcCs|jj|�S)N)r�r�)r9rtr:r:r;r��szStreamReaderWriter.readlinecCs|jj|�S)N)r�r�)r9r�r:r:r;r��szStreamReaderWriter.readlinescCs
t|j�S)z4 Return the next decoded line from the input stream.)�nextr�)r9r:r:r;r��szStreamReaderWriter.__next__cCs|S)Nr:)r9r:r:r;r��szStreamReaderWriter.__iter__cCs|jj|�S)N)r�rX)r9rQr:r:r;rX�szStreamReaderWriter.writecCs|jj|�S)N)r�r\)r9r[r:r:r;r\�szStreamReaderWriter.writelinescCs|jj�|jj�dS)N)r�rKr�)r9r:r:r;rK�s
zStreamReaderWriter.resetrcCs6|jj||�|jj�|dkr2|dkr2|jj�dS)Nr)rWr]r�rKr�)r9r^r_r:r:r;r]�s
zStreamReaderWriter.seekcCs||j|�S)z? Inherit all other methods from the underlying stream.
        )rW)r9r3r`r:r:r;ra�szStreamReaderWriter.__getattr__cCs|S)Nr:)r9r:r:r;rb�szStreamReaderWriter.__enter__cCs|jj�dS)N)rWrc)r9rdrerfr:r:r;rg�szStreamReaderWriter.__exit__)rCr�)r�)N)N)r)rAr=r>rB�encodingrIrpr�r�r�r�rXr\rKr]r`rarbrgr:r:r:r;r�s	




c@s�eZdZdZdZdZddd�Zd dd�Zd!d
d�Zd"dd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zefdd�Zdd�Zdd�Zd	S)#raB StreamRecoder instances translate data from one encoding to another.

        They use the complete set of APIs returned by the
        codecs.lookup() function to implement their task.

        Data written to the StreamRecoder is first decoded into an
        intermediate format (depending on the "decode" codec) and then
        written to the underlying stream using an instance of the provided
        Writer class.

        In the other direction, data is read from the underlying stream using
        a Reader instance and then encoded and returned to the caller.

    r�rCcCs4||_||_||_|||�|_|||�|_||_dS)a� Creates a StreamRecoder instance which implements a two-way
            conversion: encode and decode work on the frontend (the
            data visible to .read() and .write()) while Reader and Writer
            work on the backend (the data in stream).

            You can use these objects to do transparent
            transcodings from e.g. latin-1 to utf-8 and back.

            stream must be a file-like object.

            encode and decode must adhere to the Codec interface; Reader and
            Writer must be factory functions or classes providing the
            StreamReader and StreamWriter interfaces resp.

            Error handling is done in the same way as defined for the
            StreamWriter/Readers.

        N)rWr#r$r�r�rF)r9rWr#r$r�r�rFr:r:r;rIszStreamRecoder.__init__rmcCs"|jj|�}|j||j�\}}|S)N)r�rpr#rF)r9rtrQ�bytesencodedr:r:r;rp"szStreamRecoder.readNcCs6|dkr|jj�}n|jj|�}|j||j�\}}|S)N)r�r�r#rF)r9rtrQr�r:r:r;r�(s
zStreamRecoder.readlinecCs(|jj�}|j||j�\}}|jdd�S)NT)rn)r�rpr#rFrs)r9r�rQr�r:r:r;r�1s
zStreamRecoder.readlinescCs t|j�}|j||j�\}}|S)z4 Return the next decoded line from the input stream.)r�r�r#rF)r9rQr�r:r:r;r�7s
zStreamRecoder.__next__cCs|S)Nr:)r9r:r:r;r�>szStreamRecoder.__iter__cCs|j||j�\}}|jj|�S)N)r$rFr�rX)r9rQ�bytesdecodedr:r:r;rXAszStreamRecoder.writecCs(dj|�}|j||j�\}}|jj|�S)NrG)rZr$rFr�rX)r9r[rQr�r:r:r;r\Fs
zStreamRecoder.writelinescCs|jj�|jj�dS)N)r�rKr�)r9r:r:r;rKLs
zStreamRecoder.resetcCs||j|�S)z? Inherit all other methods from the underlying stream.
        )rW)r9r3r`r:r:r;raQszStreamRecoder.__getattr__cCs|S)Nr:)r9r:r:r;rbXszStreamRecoder.__enter__cCs|jj�dS)N)rWrc)r9rdrerfr:r:r;rg[szStreamRecoder.__exit__)rCr�)r�)N)N)rAr=r>rB�
data_encoding�
file_encodingrIrpr�r�r�r�rXr\rKr`rarbrgr:r:r:r;r�s


	
�rrCrmcCsV|dk	rd|kr|d}tj|||�}|dkr2|St|�}t||j|j|�}||_|S)a> Open an encoded file using the given mode and return
        a wrapped version providing transparent encoding/decoding.

        Note: The wrapped version will only accept the object format
        defined by the codecs, i.e. Unicode objects for most builtin
        codecs. Output is also codec dependent and will usually be
        Unicode as well.

        Underlying encoded files are always opened in binary mode.
        The default file mode is 'r', meaning to open the file in read mode.

        encoding specifies the encoding which is to be used for the
        file.

        errors may be given to define the error handling. It defaults
        to 'strict' which causes ValueErrors to be raised in case an
        encoding error occurs.

        buffering has the same meaning as for the builtin open() API.
        It defaults to line buffered.

        The returned wrapped file object provides an extra attribute
        .encoding which allows querying the used encoding. This
        attribute is only available if an encoding was specified as
        parameter.

    N�b)�builtinsrrrr7r6r�)�filename�moder�rF�	buffering�file�info�srwr:r:r;r`scCsF|dkr|}t|�}t|�}t||j|j|j|j|�}||_||_|S)a� Return a wrapped version of file which provides transparent
        encoding translation.

        Data written to the wrapped file is decoded according
        to the given data_encoding and then encoded to the underlying
        file using file_encoding. The intermediate data type
        will usually be Unicode but depends on the specified codecs.

        Bytes read from the file are decoded using file_encoding and then
        passed back to the caller encoded using data_encoding.

        If file_encoding is not given, it defaults to data_encoding.

        errors may be given to define the error handling. It defaults
        to 'strict' which causes ValueErrors to be raised in case an
        encoding error occurs.

        The returned wrapped file object provides two extra attributes
        .data_encoding and .file_encoding which reflect the given
        parameters of the same name. The attributes can be used for
        introspection by Python programs.

    N)rrr#r$r7r6r�r�)r�r�r�rF�	data_info�	file_info�srr:r:r;r�scCs
t|�jS)z� Lookup up the codec for the given encoding and return
        its encoder function.

        Raises a LookupError in case the encoding cannot be found.

    )rr#)r�r:r:r;r�scCs
t|�jS)z� Lookup up the codec for the given encoding and return
        its decoder function.

        Raises a LookupError in case the encoding cannot be found.

    )rr$)r�r:r:r;r�scCst|�j}|dkrt|��|S)z� Lookup up the codec for the given encoding and return
        its IncrementalEncoder class or factory function.

        Raises a LookupError in case the encoding cannot be found
        or the codecs doesn't provide an incremental encoder.

    N)rr4�LookupError)r��encoderr:r:r;r�s	
cCst|�j}|dkrt|��|S)z� Lookup up the codec for the given encoding and return
        its IncrementalDecoder class or factory function.

        Raises a LookupError in case the encoding cannot be found
        or the codecs doesn't provide an incremental decoder.

    N)rr5r�)r��decoderr:r:r;r �s	
cCs
t|�jS)z� Lookup up the codec for the given encoding and return
        its StreamReader class or factory function.

        Raises a LookupError in case the encoding cannot be found.

    )rr7)r�r:r:r;r!�scCs
t|�jS)z� Lookup up the codec for the given encoding and return
        its StreamWriter class or factory function.

        Raises a LookupError in case the encoding cannot be found.

    )rr6)r�r:r:r;r"�scksLt|�|f|�}x |D]}|j|�}|r|VqW|jdd�}|rH|VdS)z�
    Encoding iterator.

    Encodes the input strings from the iterator using an IncrementalEncoder.

    errors and kwargs are passed through to the IncrementalEncoder
    constructor.
    rGTN)rr#)�iteratorr�rF�kwargsr�rE�outputr:r:r;r%�s	


cksLt|�|f|�}x |D]}|j|�}|r|VqW|jdd�}|rH|VdS)z�
    Decoding iterator.

    Decodes the input strings from the iterator using an IncrementalDecoder.

    errors and kwargs are passed through to the IncrementalDecoder
    constructor.
    rTTN)r r$)r�r�rFr�r�rEr�r:r:r;r&s	


cCsdd�|D�S)z� make_identity_dict(rng) -> dict

        Return a dictionary where elements of the rng sequence are
        mapped to themselves.

    cSsi|]
}||�qSr:r:)�.0�ir:r:r;�
<dictcomp>"sz&make_identity_dict.<locals>.<dictcomp>r:)�rngr:r:r;�make_identity_dictsr�cCs8i}x.|j�D]"\}}||kr(|||<qd||<qW|S)a� Creates an encoding map from a decoding map.

        If a target mapping in the decoding map occurs multiple
        times, then that target is mapped to None (undefined mapping),
        causing an exception when encountered by the charmap codec
        during translation.

        One example where this happens is cp875.py which decodes
        multiple character to \u001a.

    N)�items)�decoding_map�m�k�vr:r:r;�make_encoding_map$s

r��ignore�replace�xmlcharrefreplace�backslashreplace�namereplace�__main__zlatin-1zutf-8)r�NrCrm)NrC)rC)rC)<rBr��sys�_codecs�ImportErrorZwhy�SystemError�__all__rr	rrrrr�	byteorderrrrrr
r
rr1rrrYrrOrrUrrrrrrrrrr r!r"r%r&r�r�r.r'r(r)r*r+r,r��_falseZ	encodingsrA�stdout�stdinr:r:r:r;�<module>s�

B("1+IzWn
*
&








ftplib.cpython-36.opt-1.pyc000064400000067307150335715140011432 0ustar003

�\dh!��@sVdZddlZddlZddlmZdddddd	gZd
ZdZdZGd
d�de�Z	Gdd�de	�Z
Gdd�de	�ZGdd�de	�ZGdd�de	�Z
e	eefZdZdZGdd�d�ZyddlZWnek
r�dZYn0XejZGdd�de�Zejd�e	eeejfZdadd�Zdadd�Zdd�Zdd�Z d d!�Z!d)d$d%�Z"d&d'�Z#e$d(k�rRe#�dS)*aSAn FTP client class and some helper functions.

Based on RFC 959: File Transfer Protocol (FTP), by J. Postel and J. Reynolds

Example:

>>> from ftplib import FTP
>>> ftp = FTP('ftp.python.org') # connect to host, default port
>>> ftp.login() # default, i.e.: user anonymous, passwd anonymous@
'230 Guest login ok, access restrictions apply.'
>>> ftp.retrlines('LIST') # list directory contents
total 9
drwxr-xr-x   8 root     wheel        1024 Jan  3  1994 .
drwxr-xr-x   8 root     wheel        1024 Jan  3  1994 ..
drwxr-xr-x   2 root     wheel        1024 Jan  3  1994 bin
drwxr-xr-x   2 root     wheel        1024 Jan  3  1994 etc
d-wxrwxr-x   2 ftp      wheel        1024 Sep  5 13:43 incoming
drwxr-xr-x   2 root     wheel        1024 Nov 17  1993 lib
drwxr-xr-x   6 1094     wheel        1024 Sep 13 19:07 pub
drwxr-xr-x   3 root     wheel        1024 Jan  3  1994 usr
-rw-r--r--   1 root     root          312 Aug  1  1994 welcome.msg
'226 Transfer complete.'
>>> ftp.quit()
'221 Goodbye.'
>>>

A nice test that reveals some of the network dialogue would be:
python ftplib.py -d localhost -l -p -l
�N)�_GLOBAL_DEFAULT_TIMEOUT�FTP�error_reply�
error_temp�
error_perm�error_proto�
all_errors��i c@seZdZdS)�ErrorN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/ftplib.pyr9src@seZdZdS)rN)rr
rrrrrr:sc@seZdZdS)rN)rr
rrrrrr;sc@seZdZdS)rN)rr
rrrrrr<sc@seZdZdS)rN)rr
rrrrrr=sz
s
c@s�eZdZdZdZdZeZeZ	dZ
dZdZdZ
dZdZddddedfdd	�Zd
d�Zdd
�Zd]dd�Zdd�Zdd�ZeZdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Z d'd(�Z!d)d*�Z"d+d,�Z#d-d.�Z$d/d0�Z%d1d2�Z&d^d3d4�Z'd_d5d6�Z(d`d7d8�Z)dad:d;�Z*dbd<d=�Z+dcd>d?�Z,ddd@dA�Z-dBdC�Z.dDdE�Z/dFdG�Z0dgfdHdI�Z1dJdK�Z2dLdM�Z3dNdO�Z4dPdQ�Z5dRdS�Z6dTdU�Z7dVdW�Z8dXdY�Z9dZd[�Z:dS)erayAn FTP client class.

    To create a connection, call the class using these arguments:
            host, user, passwd, acct, timeout

    The first four arguments are all strings, and have default value ''.
    timeout must be numeric and defaults to None if not passed,
    meaning that no timeout will be set on any ftp socket(s)
    If a timeout is passed, then this is now the default timeout for all ftp
    socket operations for this instance.

    Then use self.connect() with optional host and port argument.

    To download a file, use ftp.retrlines('RETR ' + filename),
    or ftp.retrbinary() with slightly different arguments.
    To upload a file, use ftp.storlines() or ftp.storbinary(),
    which have an open file as argument (see their definitions
    below for details).
    The download/upload functions first issue appropriate TYPE
    and PORT or PASV commands.
    r�Nr	zlatin-1FcCs0||_||_|r,|j|�|r,|j|||�dS)N)�source_address�timeout�connect�login)�self�host�user�passwd�acctrrrrr�__init__rs
zFTP.__init__cCs|S)Nr)rrrr�	__enter__{sz
FTP.__enter__cGsN|jdk	rJz*y|j�Wnttfk
r0YnXWd|jdk	rH|j�XdS)N)�sock�quit�OSError�EOFError�close)r�argsrrr�__exit__s


zFTP.__exit__i�cCs�|dkr||_|dkr||_|dkr*||_|dk	r8||_tj|j|jf|j|jd�|_|jj|_|jj	d|j
d�|_|j�|_
|j
S)	awConnect to host.  Arguments are:
         - host: hostname to connect to (string, default previous host)
         - port: port to connect to (integer, default previous port)
         - timeout: the timeout to set against the ftp socket(s)
         - source_address: a 2-tuple (host, port) for the socket to bind
           to as its source address before connecting.
        rri�N)r�r)�encodingi���)r�portrr�socket�create_connectionrZfamily�af�makefiler%�file�getresp�welcome)rrr&rrrrrr�s

zFTP.connectcCs|jrtd|j|j��|jS)z`Get the welcome message from the server.
        (this is read and squirreled away by connect())z	*welcome*)�	debugging�print�sanitizer-)rrrr�
getwelcome�szFTP.getwelcomecCs
||_dS)z�Set the debugging level.
        The required argument level means:
        0: no debugging output (default)
        1: print commands and responses but not body text etc.
        2: also print raw lines read and sent before stripping CR/LFN)r.)r�levelrrr�set_debuglevel�szFTP.set_debuglevelcCs
||_dS)z�Use passive or active mode for data transfers.
        With a false argument, use the normal PORT mode,
        With a true argument, use the PASV command.N)�
passiveserver)r�valrrr�set_pasv�szFTP.set_pasvcCsJ|dd�dkrBt|jd��}|dd�d|d||d�}t|�S)N��pass �PASS z
�*>r8r9)�len�rstrip�repr)r�s�irrrr0�s$zFTP.sanitizecCsRd|ksd|krtd��|t}|jdkr:td|j|��|jj|j|j��dS)N�
�
z4an illegal newline character should not be containedr	z*put*)	�
ValueError�CRLFr.r/r0r�sendall�encoder%)r�linerrr�putline�s
zFTP.putlinecCs$|jrtd|j|��|j|�dS)Nz*cmd*)r.r/r0rG)rrFrrr�putcmd�sz
FTP.putcmdcCs�|jj|jd�}t|�|jkr.td|j��|jdkrHtd|j|��|sPt�|dd�t	krn|dd�}n|dd�t	kr�|dd�}|S)	Nr	zgot more than %d bytesz*get*����rJ���rK)
r+�readline�maxliner;rr.r/r0r rC)rrFrrr�getline�s
zFTP.getlinecCsd|j�}|dd�dkr`|dd�}x:|j�}|d|}|dd�|kr&|dd�dkr&Pq&W|S)N���-rA)rN)rrF�codeZnextlinerrr�getmultiline�szFTP.getmultilinecCsp|j�}|jrtd|j|��|dd�|_|dd�}|d	krD|S|dkrTt|��|dkrdt|��t|��dS)
Nz*resp*rOr	�1�2�3�4�5>rTrVrU)rSr.r/r0Zlastresprrr)r�resp�crrrr,�szFTP.getrespcCs$|j�}|dd�dkr t|��|S)z%Expect a response beginning with '2'.Nr	rU)r,r)rrYrrr�voidresp�szFTP.voidrespcCsTdt}|jdkr"td|j|��|jj|t�|j�}|dd�d	krPt|��|S)
z�Abort a file transfer.  Uses out-of-band data.
        This does not follow the procedure from the RFC to send Telnet
        IP and Synch; that doesn't seem to work with the servers I've
        tried.  Instead, just send the ABOR command as OOB data.sABORr	z*put urgent*NrO�426�225�226>r^r\r])	�B_CRLFr.r/r0rrD�MSG_OOBrSr)rrFrYrrr�aborts
z	FTP.abortcCs|j|�|j�S)z'Send a command and return the response.)rHr,)r�cmdrrr�sendcmds
zFTP.sendcmdcCs|j|�|j�S)z8Send a command and expect a response beginning with '2'.)rHr[)rrbrrr�voidcmds
zFTP.voidcmdcCsB|jd�}t|d�t|d�g}||}ddj|�}|j|�S)zUSend a PORT command with the current host and the given
        port number.
        �.�zPORT �,)�splitr=�joinrd)rrr&ZhbytesZpbytes�bytesrbrrr�sendports

zFTP.sendportcCsbd}|jtjkrd}|jtjkr$d}|dkr4td��dt|�|t|�dg}ddj|�}|j|�S)zESend an EPRT command with the current host and the given port number.rr	rIzunsupported address familyrzEPRT �|)r)r'�AF_INETZAF_INET6rr=rird)rrr&r)Zfieldsrbrrr�sendeprt$szFTP.sendeprtc
Csd}d}x�tjdd|jtjdtj�D]j}|\}}}}}ytj|||�}|j|�Wn8tk
r�}	z|	}|rt|j�d}w$WYdd}	~	XnXPq$W|dkr�|dk	r�|�ntd��|jd�|j	�d}
|j
j	�d}|jtjkr�|j||
�}n|j
||
�}|jtk	�r|j|j�|S)z3Create a new socket and send a PORT command for it.Nrz!getaddrinfo returns an empty listr	)r'Zgetaddrinfor)ZSOCK_STREAMZ
AI_PASSIVEZbindrr!ZlistenZgetsocknamerrmrkrnrr�
settimeout)
r�errr�resr)Zsocktype�protoZ	canonnameZsa�_r&rrYrrr�makeport1s6 
zFTP.makeportcCs\|jtjkr:t|jd��\}}|jr*|}qT|jj�d}nt|jd�|jj��\}}||fS)z<Internal: Does the PASV or EPSV handshake -> (address, port)�PASVrZEPSV)	r)r'rm�parse227rc�trust_server_pasv_ipv4_addressrZgetpeername�parse229)rZuntrusted_hostr&rrrr�makepasvQszFTP.makepasvc

Cs6d}|jr�|j�\}}tj||f|j|jd�}yL|dk	rF|jd|�|j|�}|ddkrd|j�}|ddkrxt|��Wn|j	��YnXn�|j
��r}|dk	r�|jd|�|j|�}|ddkr�|j�}|ddkr�t|��|j�\}}	|jtk	�r
|j
|j�WdQRX|dd�dk�r.t|�}||fS)	a�Initiate a transfer over the data connection.

        If the transfer is active, send a port command and the
        transfer command, and accept the connection.  If the server is
        passive, send a pasv command, connect to it, and start the
        transfer command.  Either way, return the socket for the
        connection and the expected size of the transfer.  The
        expected size may be None if it could not be determined.

        Optional `rest' argument can be a string that is sent as the
        argument to a REST command.  This is essentially a server
        marker used to tell the server to skip over any data up to the
        given marker.
        N)rzREST %srrUrTrO�150)r4ryr'r(rrrcr,rr!rtZacceptrro�parse150)
rrb�rest�sizerr&�connrYrZsockaddrrrr�ntransfercmd]s<




zFTP.ntransfercmdcCs|j||�dS)z0Like ntransfercmd() but returns only the socket.r)r)rrbr|rrr�transfercmd�szFTP.transfercmdcCs�|sd}|sd}|sd}|dkr0|dkr0|d}|jd|�}|ddkrX|jd|�}|ddkrr|jd	|�}|dd
kr�t|��|S)zLogin, default anonymous.Z	anonymousrrQz
anonymous@zUSER rrVzPASS zACCT rU>rrQ)rcr)rrrrrYrrrr�s z	FTP.login� c
Csb|jd�|j||��>}x|j|�}|s*P||�qWtdk	rPt|t�rP|j�WdQRX|j�S)a�Retrieve data in binary mode.  A new port is created for you.

        Args:
          cmd: A RETR command.
          callback: A single parameter callable to be called on each
                    block of data read.
          blocksize: The maximum number of bytes to read from the
                     socket at one time.  [default: 8192]
          rest: Passed to transfercmd().  [default: None]

        Returns:
          The response code.
        zTYPE IN)rdr�Zrecv�
_SSLSocket�
isinstance�unwrapr[)rrb�callback�	blocksizer|r~�datarrr�
retrbinary�s

zFTP.retrbinarycCs�|dkrt}|jd�}|j|���}|jd|jd���}x�|j|jd�}t|�|jkrbtd|j��|j	dkrzt
dt|��|s�P|d
d�tkr�|dd�}n|dd�d	kr�|dd
�}||�q6Wt
dk	r�t|t
�r�|j�WdQRXWdQRX|j�S)ahRetrieve data in line mode.  A new port is created for you.

        Args:
          cmd: A RETR, LIST, or NLST command.
          callback: An optional single parameter callable that is called
                    for each line with the trailing CRLF stripped.
                    [default: print_line()]

        Returns:
          The response code.
        NzTYPE Ar$)r%r	zgot more than %d bytesrIz*retr*rArJrJrKrK)�
print_linercr�r*r%rLrMr;rr.r/r=rCr�r�r�r[)rrbr�rYr~�fprFrrr�	retrlines�s*

z
FTP.retrlinesc
Csp|jd�|j||��L}x*|j|�}|s*P|j|�|r||�qWtdk	r^t|t�r^|j�WdQRX|j�S)a9Store a file in binary mode.  A new port is created for you.

        Args:
          cmd: A STOR command.
          fp: A file-like object with a read(num_bytes) method.
          blocksize: The maximum data size to read from fp and send over
                     the connection at once.  [default: 8192]
          callback: An optional single parameter callable that is called on
                    each block of data after it is sent.  [default: None]
          rest: Passed to transfercmd().  [default: None]

        Returns:
          The response code.
        zTYPE IN)rdr��readrDr�r�r�r[)rrbr�r�r�r|r~�bufrrr�
storbinary�s


zFTP.storbinaryc
Cs�|jd�|j|���}x||j|jd�}t|�|jkrDtd|j��|sJP|dd�tkrz|dtkrr|dd�}|t}|j|�|r||�qWtdk	r�t	|t�r�|j
�WdQRX|j�S)	ahStore a file in line mode.  A new port is created for you.

        Args:
          cmd: A STOR command.
          fp: A file-like object with a readline() method.
          callback: An optional single parameter callable that is called on
                    each line after it is sent.  [default: None]

        Returns:
          The response code.
        zTYPE Ar	zgot more than %d bytesrINrJrKrK)rdr�rLrMr;rr_rDr�r�r�r[)rrbr�r�r~r�rrr�	storliness$

z
FTP.storlinescCsd|}|j|�S)zSend new account name.zACCT )rd)rZpasswordrbrrrr+szFTP.acctcGs4d}x|D]}|d|}q
Wg}|j||j�|S)zBReturn a list of files in a given directory (default the current).ZNLST� )r��append)rr"rb�arg�filesrrr�nlst0s
zFTP.nlstcGsld}d}|dd�r>t|d�td�kr>|dd�|d	}}x|D]}|rD|d|}qDW|j||�dS)
aList a directory in long form.
        By default list current directory to stdout.
        Optional last argument is callback function; all
        non-empty arguments before it are concatenated to the
        LIST command.  (This *should* only be used for a pathname.)ZLISTNr	rr�rKrKrKrK)�typer�)rr"rb�funcr�rrr�dir9s 
zFTP.dirc
cs�|r|jddj|�d�|r*d|}nd}g}|j||j�xh|D]`}|jt�jd�\}}}i}	x6|dd	�jd�D] }
|
jd�\}}}||	|j�<qxW||	fVqFWdS)
a<List a directory in a standardized format by using MLSD
        command (RFC-3659). If path is omitted the current directory
        is assumed. "facts" is a list of strings representing the type
        of information desired (e.g. ["type", "size", "perm"]).

        Return a generator object yielding a tuple of two elements
        for every file found in path.
        First element is the file name, the second one is a dictionary
        including a variable number of "facts" depending on the server
        and whether "facts" argument has been provided.
        z
OPTS MLST �;zMLSD %sZMLSDr�Nr	�=rK)	rcrir�r�r<rC�	partitionrh�lower)
r�pathZfactsrb�linesrFZfacts_foundrs�name�entryZfact�key�valuerrr�mlsdHs

zFTP.mlsdcCs0|jd|�}|ddkr"t|��|jd|�S)zRename a file.zRNFR rrVzRNTO )rcrrd)rZfromnameZtonamerYrrr�renamedsz
FTP.renamecCs.|jd|�}|dd�dkr"|St|��dS)zDelete a file.zDELE NrO�250�200>r�r�)rcr)r�filenamerYrrr�deleteksz
FTP.deletecCsn|dkrPy
|jd�Stk
rL}z|jddd�dkr<�WYdd}~Xq\Xn|dkr\d}d	|}|j|�S)
zChange to a directory.z..ZCDUPrNrO�500rrezCWD )rdrr")r�dirname�msgrbrrr�cwdss
zFTP.cwdcCs:|jd|�}|dd�dkr6|dd�j�}t|�SdS)zRetrieve the size of a file.zSIZE NrOZ213)rc�strip�int)rr�rYr>rrrr}�szFTP.sizecCs$|jd|�}|jd�sdSt|�S)z+Make a directory, return its full pathname.zMKD �257r)rd�
startswith�parse257)rr�rYrrr�mkd�s
zFTP.mkdcCs|jd|�S)zRemove a directory.zRMD )rd)rr�rrr�rmd�szFTP.rmdcCs |jd�}|jd�sdSt|�S)z!Return current working directory.ZPWDr�r)rdr�r�)rrYrrr�pwd�s

zFTP.pwdcCs|jd�}|j�|S)zQuit, and close the connection.ZQUIT)rdr!)rrYrrrr�s
zFTP.quitcCsDz |j}d|_|dk	r|j�Wd|j}d|_|dk	r>|j�XdS)z8Close the connection without assuming anything about it.N)r+r!r)rr+rrrrr!�sz	FTP.close����)rrr�N)N)N)rrr)r�N)N)r�NN)N);rr
r�__doc__r.r�FTP_PORTr&�MAXLINErMrr+r-r4r%rwrrrr#rr1r3�debugr6r0rGrHrNrSr,r[rarcrdrkrnrtryrr�rr�r�r�r�rr�r�r�r�r�r�r}r�r�r�rr!rrrrrJsl

	

 
7



#

	
		c	@sneZdZdZejZdddddddedf	dd�Zddd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
ddd�Zdd�ZdS)�FTP_TLSa�A FTP subclass which adds TLS support to FTP as described
        in RFC-4217.

        Connect as usual to port 21 implicitly securing the FTP control
        connection before authenticating.

        Securing the data connection requires user to explicitly ask
        for it by calling prot_p() method.

        Usage example:
        >>> from ftplib import FTP_TLS
        >>> ftps = FTP_TLS('ftp.python.org')
        >>> ftps.login()  # login anonymously previously securing control channel
        '230 Guest login ok, access restrictions apply.'
        >>> ftps.prot_p()  # switch to secure data connection
        '200 Protection level set to P'
        >>> ftps.retrlines('LIST')  # list directory content securely
        total 9
        drwxr-xr-x   8 root     wheel        1024 Jan  3  1994 .
        drwxr-xr-x   8 root     wheel        1024 Jan  3  1994 ..
        drwxr-xr-x   2 root     wheel        1024 Jan  3  1994 bin
        drwxr-xr-x   2 root     wheel        1024 Jan  3  1994 etc
        d-wxrwxr-x   2 ftp      wheel        1024 Sep  5 13:43 incoming
        drwxr-xr-x   2 root     wheel        1024 Nov 17  1993 lib
        drwxr-xr-x   6 1094     wheel        1024 Sep 13 19:07 pub
        drwxr-xr-x   3 root     wheel        1024 Jan  3  1994 usr
        -rw-r--r--   1 root     root          312 Aug  1  1994 welcome.msg
        '226 Transfer complete.'
        >>> ftps.quit()
        '221 Goodbye.'
        >>>
        rNc
Cs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}
|
jdtd�||_||_|dkr|tj|j||d�}||_	d|_
tj|||||||	�dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadrI)�certfile�keyfileF)
rB�warnings�warn�DeprecationWarningr�r��sslZ_create_stdlib_context�ssl_version�context�_prot_prr)rrrrrr�r�r�rrr�rrrr�s"zFTP_TLS.__init__TcCs,|rt|jtj�r|j�tj||||�S)N)r�rr��	SSLSocket�authrr)rrrrZsecurerrrr�sz
FTP_TLS.logincCsft|jtj�rtd��|jtjkr.|jd�}n
|jd�}|jj	|j|j
d�|_|jjd|jd�|_
|S)z2Set up secure control connection by using TLS/SSL.zAlready using TLSzAUTH TLSzAUTH SSL)�server_hostnamer$)�moder%)r�rr�r�rBr��PROTOCOL_SSLv23rdr��wrap_socketrr*r%r+)rrYrrrr��s

zFTP_TLS.authcCs0t|jtj�std��|jd�}|jj�|_|S)z/Switch back to a clear-text control connection.z
not using TLSZCCC)r�rr�r�rBrdr�)rrYrrr�cccs

zFTP_TLS.ccccCs|jd�|jd�}d|_|S)zSet up secure data connection.zPBSZ 0zPROT PT)rdr�)rrYrrr�prot_ps

zFTP_TLS.prot_pcCs|jd�}d|_|S)z"Set up clear text data connection.zPROT CF)rdr�)rrYrrr�prot_cs
zFTP_TLS.prot_ccCs2tj|||�\}}|jr*|jj||jd�}||fS)N)r�)rrr�r�r�r)rrbr|r~r}rrrr$s

zFTP_TLS.ntransfercmdcCs8dt}|jj|�|j�}|dd�dkr4t|��|S)NsABORrOr\r]r^>r\r^r])r_rrDrSr)rrFrYrrrra+sz
FTP_TLS.abort)rrrT)N)rr
rr�r�r�r�rrrr�r�r�r�rrarrrrr��s 



r�cCs\|dd�dkrt|��tdkr<ddl}|jd|j|jB�atj|�}|sNdSt|jd��S)z�Parse the '150' response for a RETR request.
    Returns the expected transfer size or None; size is not guaranteed to
    be present in the 150 message.
    NrOrzrz150 .* \((\d+) bytes\)r	)	r�_150_re�re�compile�
IGNORECASE�ASCII�matchr��group)rYr��mrrrr{:s
r{cCs�|dd�dkrt|��tdkr6ddl}|jd|j�atj|�}|sLt|��|j�}dj|dd��}t	|d�d>t	|d	�}||fS)
z�Parse the '227' response for a PASV request.
    Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)'
    Return ('host.addr.as.numbers', port#) tuple.NrOZ227rz#(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)rerP�r7)
r�_227_rer�r�r��searchr�groupsrir�)rYr�r�Znumbersrr&rrrrvNs
rvcCs�|dd�dkrt|��|jd�}|dkr2t|��|jd|d�}|dkrRt|��||d||dkrrt|��||d|�j||d�}t|�dkr�t|��|d}t|d�}||fS)	z�Parse the '229' response for an EPSV request.
    Raises error_proto if it does not contain '(|||port|)'
    Return ('host.addr.as.numbers', port#) tuple.NrOZ229�(r�)r	r7)r�findrrhr;r�)rYZpeer�left�right�partsrr&rrrrxbs 
rxcCs�|dd�dkrt|��|dd�dkr,dSd}d}t|�}xJ||kr�||}|d}|dkr|||ksr||dkrtP|d}||}q>W|S)	z�Parse the '257' response for a MKD or PWD request.
    This is a response to a MKD or PWD request: a directory name.
    Returns the directoryname in the 257 reply.NrOr�r7z "rr	�")rr;)rYr�r?�nrZrrrr�xs 
r�cCst|�dS)z+Default retrlines callback to print a line.N)r/)rFrrrr��sr�r�Ic	Cs�|s|}d|}|j|�|j|�t|jd��\}}|j||�|jd|�}|dd�d	krdt�|jd|�}|dd�d
kr�t�|j�|j�dS)z+Copy file from one FTP-instance to another.zTYPE ruzSTOR NrO�125rzzRETR >r�rz>r�rz)rdrvrcrkrr[)	�sourceZ
sourcename�targetZ
targetnamer�Z
sourcehostZ
sourceportZtreplyZsreplyrrr�ftpcp�s

r�cCs�ttj�dkr"ttj�tjd�ddl}d}d}x"tjddkrT|d}tjd=q4Wtjddd�dkr�tjddd�}tjd=tjd}t|�}|j	|�d}}}y|j|�}Wn(t
k
r�|dk	r�tjjd�Yn:Xy|j
|�\}}}Wn"tk
�rtjjd	�YnX|j|||�x�tjdd�D]�}	|	dd�d
k�rf|j|	dd��nt|	dd�dk�r�d}
|	dd��r�|
d|	dd�}
|j|
�}n0|	d
k�r�|j|j�n|jd|	tjjd��q<W|j�dS)z�Test program.
    Usage: ftp [-d] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ...

    -d dir
    -l list
    -p password
    rIrNr	z-dz-rrz5Could not open account file -- using anonymous login.z$No account -- using anonymous login.z-lZCWDr�z-pzRETR i)r;�sys�argvr/�testr��exit�netrcrr3r�stderr�writeZauthenticators�KeyErrorrr�rcr6r4r��stdoutr)r�r.ZrcfilerZftpZuseridrrZnetrcobjr+rbrYrrrr��sP	





r��__main__)rr�)%r�r�r'r�__all__r`r�r��	Exceptionrrrrrrr rrCr_rr��ImportErrorr�r�r�r�ZSSLErrorr�r{r�rvrxr�r�r�r�rrrrr�<module>sP


k
|

9
nntplib.cpython-36.opt-2.pyc000064400000051371150335715140011613 0ustar003


 \F��@s�ddlZddlZddlZddlZddlZyddlZWnek
rLdZYnXdZddlm	Z
ddlmZdddd	d
ddd
gZdZ
Gdd�de�ZGdd�de�ZGdd	�d	e�ZGdd
�d
e�ZGdd�de�ZGdd�de�ZdZdZdddddddddd d!d"hZd#d$d%d&d'd(d)gZd(d)d*�Zd+Zejd,d-d.d/d0g�Zejd1d2d3d4g�Zd5d
�Z	d6d7�Zdkd8d9�Zdld:d;�Z dmd<d=�Z!e�r�d>d?�Z"Gd@dA�dA�Z#GdBd�de#�Z$e�r�GdCdD�dDe#�Z%ej&dD�e'dEk�r|ddl(Z(e(j)dFdG�Z*e*j+dHdIdJdKdL�e*j+dMdNdOdPdL�e*j+dQdRdne,dTeefdU�e*j+dVdWdXe,dYdU�e*j+dZd[d\dd]d^�e*j-�Z.e.j/Z/e.j�s�e/dok�rpeZ/e$e.j0e/d_�Z1ne/dpk�r�eZ/e%e.j0e/d_�Z1e1j2�Z3d`e3k�r�e1j4�e1j5e.j5�\Z6Z7Z8Z9Z:e;dae:dbe7dce8dde9�dedf�Z<e=e,e9�e.j>dS�Z8e1j?e8e9�\Z6Z@xbe@D]Z\ZAZBe	eBd$�jCdgdS�dZDe	eBd#�ZEe,eBd)�ZFe;dhjGeAe<eDdi�e<eEdj�eF���qWe1jH�dS)q�NFT)�
decode_header)�_GLOBAL_DEFAULT_TIMEOUT�NNTP�	NNTPError�NNTPReplyError�NNTPTemporaryError�NNTPPermanentError�NNTPProtocolError�
NNTPDataErrorric@seZdZdd�ZdS)rcGs>tj|f|��y|d|_Wntk
r8d|_YnXdS)NrzNo response given)�	Exception�__init__�response�
IndexError)�self�args�r�/usr/lib64/python3.6/nntplib.pyrbs
zNNTPError.__init__N)�__name__�
__module__�__qualname__rrrrrr`sc@seZdZdS)rN)rrrrrrrrisc@seZdZdS)rN)rrrrrrrrmsc@seZdZdS)rN)rrrrrrrrqsc@seZdZdS)r	N)rrrrrrrr	usc@seZdZdS)r
N)rrrrrrrr
ys�wi3Z100Z101�211�215Z220Z221Z222Z224Z225Z230Z231Z282�subject�from�datez
message-idZ
referencesz:bytesz:lines)�bytes�liness
�	GroupInfo�group�last�first�flag�ArticleInfoZnumber�
message_idrcCsNg}x>t|�D]2\}}t|t�r6|j|j|p.d��q|j|�qWdj|�S)N�ascii�)�_email_decode_header�
isinstancer�append�decode�join)Z
header_str�parts�v�encrrrr�s
cCs�g}xh|D]`}|ddkr<|dd�jd�\}}}d|}n|jd�\}}}|j�}tj||�}|j|�q
Wt}t|�t|�kr�td��|dt|��|kr�td��|S)Nr�:�z$LIST OVERVIEW.FMT response too shortz*LIST OVERVIEW.FMT redefines default fields)�	partition�lower�_OVERVIEW_FMT_ALTERNATIVES�getr)�_DEFAULT_OVERVIEW_FMT�lenr
)r�fmt�line�name�_�suffixZdefaultsrrr�_parse_overview_fmt�s

r<cCs�tt�}g}x�|D]�}i}|jd�^}}t|�}x�t|�D]�\}	}
|	t|�krPq:||	}|jd�}|	|kr�|r�|d}
|
r�|
dt|
��j�|
kr�td��|
r�|
t|
�d�nd}
|
|||	<q:W|j||f�qW|S)N�	r/z: z?OVER/XOVER response doesn't include names of additional headers)	r6r5�split�int�	enumerate�
startswithr2r
r))rr7Zdata_process_funcZ
n_defaultsZoverviewr8ZfieldsZarticle_number�tokens�i�tokenZ
field_nameZis_metadata�hrrr�_parse_overview�s&

rFcCs�|dkr |dd�}|dd	�}t|dd��}t|dd��}t|dd��}t|dd
��}t|dd��}t|d
d��}|dkr�|d7}n|dkr�|d7}tj||||||�S)N����Fi��dili����i�������rL���rM)r?�datetime)�date_str�time_strZhoursZminutesZseconds�yearZmonthZdayrrr�_parse_datetime�s
rRcCsPt|tj�sd}n
dj|�}|j}|r<|d}dj||�}ndj||�}||fS)NZ000000z({0.hour:02d}{0.minute:02d}{0.second:02d}rKz{0:02d}{1.month:02d}{1.day:02d}z{0:04d}{1.month:02d}{1.day:02d})r(rN�formatrQ)ZdtZlegacyrP�yrOrrr�_unparse_datetime�s

rUcCs|dkrtj�}|j||d�S)N)Zserver_hostname)�sslZ_create_stdlib_contextZwrap_socket)�sock�contextZhostnamerrr�_encrypt_onsrYc@seZdZdZdZdefdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZeZdd�Z
dd�Zdhdd�Zdd�Zdidd�Zdd�Zdjdd�Zdkdd �Zd!d"�Zd#d$�Zd%d&�Zdd'�d(d)�Zdd'�d*d+�Zdldd'�d,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zdd'�d6d7�Zd8d9�Z d:d;�Z!dmd<d=�Z"d>d?�Z#d@dA�Z$dndBdC�Z%dodd'�dDdE�Z&dpdd'�dFdG�Z'dqdd'�dHdI�Z(dJdK�Z)dd'�dLdM�Z*dd'�dNdO�Z+dd'�dPdQ�Z,dd'�dRdS�Z-dTdU�Z.dVdW�Z/dXdY�Z0dZd[�Z1d\d]�Z2d^d_�Z3d`da�Z4drdbdc�Z5ddde�Z6e7�rdsdfdg�Z8dS)t�	_NNTPBasezutf-8�surrogateescapeNcCsj||_||_d|_|j�|_d|_|j�d|_|rZd|jkrZ|j�|jsZd|_|j�d|_	d|_
dS)NrF�READER)�host�file�	debugging�_getresp�welcome�_caps�getcapabilities�readermode_afterauth�_setreadermode�tls_on�
authenticated)rr^r]�
readermode�timeoutrrrr8s
	z_NNTPBase.__init__cCs|S)Nr)rrrr�	__enter__gsz_NNTPBase.__enter__csR�fdd�}|�rNz*y�j�Wnttfk
r8YnXWd|�rL�j�XdS)Ncs
t�d�S)Nr^)�hasattrr)rrr�<lambda>ksz$_NNTPBase.__exit__.<locals>.<lambda>)�quit�OSError�EOFError�_close)rrZis_connectedr)rr�__exit__js
z_NNTPBase.__exit__cCs|jrtdt|j��|jS)Nz	*welcome*)r_�print�reprra)rrrr�
getwelcomeusz_NNTPBase.getwelcomec
Cs�|jdkr�d|_d|_y|j�\}}Wnttfk
rDi|_Yn<X||_d|krhttt|d��|_d|kr�dj	|d�|_|jS)Nr0�VERSIONZIMPLEMENTATION� )
rb�nntp_versionZnntp_implementation�capabilitiesrr�max�mapr?r+)r�resp�capsrrrrc~s
z_NNTPBase.getcapabilitiescCs
||_dS)N)r_)r�levelrrr�set_debuglevel�sz_NNTPBase.set_debuglevelcCs:|t}|jdkr tdt|��|jj|�|jj�dS)Nr0z*put*)�_CRLFr_rrrsr^�write�flush)rr8rrr�_putline�s

z_NNTPBase._putlinecCs2|jrtdt|��|j|j|j�}|j|�dS)Nz*cmd*)r_rrrs�encode�encoding�errorsr�)rr8rrr�_putcmd�sz_NNTPBase._putcmdTcCs�|jjtd�}t|�tkr$td��|jdkr<tdt|��|sDt�|r�|dd�t	krf|dd�}n|dd�t	kr�|dd�}|S)	Nr0z
line too longz*get*rHrMrM���r�)
r^�readline�_MAXLINEr6r
r_rrrsror)rZ
strip_crlfr8rrr�_getline�s
z_NNTPBase._getlinecCsl|j�}|jrtdt|��|j|j|j�}|dd�}|dkrHt|��|dkrXt|��|dkrht	|��|S)Nz*resp*r0�4�5Z123)
r�r_rrrsr*r�r�rrr	)rr{�crrrr`�sz_NNTPBase._getrespc
Cs�d}z�t|ttf�r"t|d�}}|j�}|dd�tkrBt|��g}|dk	r�dtdf}xv|jd�}||krpP|j	d�r�|dd�}|j
|�q\Wn<d}x6|j�}||kr�P|j	d�r�|dd�}|j|�q�WWd|r�|j�X||fS)N�wb��.s.
Fs..r0)
r(�strr�openr`�	_LONGRESPrrr�rAr�r)�close)rr^Z
openedFiler{rZterminatorsr8�
terminatorrrr�_getlongresp�s8	



z_NNTPBase._getlongrespcCs|j|�|j�S)N)r�r`)rr8rrr�	_shortcmd�s
z_NNTPBase._shortcmdcCs|j|�|j|�S)N)r�r�)rr8r^rrr�_longcmds
z_NNTPBase._longcmdcs.�j|��j|�\}}|�fdd�|D�fS)Ncsg|]}|j�j�j��qSr)r*r�r�)�.0r8)rrr�
<listcomp>sz,_NNTPBase._longcmdstring.<locals>.<listcomp>)r�r�)rr8r^r{�listr)rr�_longcmdstrings
z_NNTPBase._longcmdstringcCsby|jStk
rYnXy|jd�\}}Wn tk
rNtdd�}Yn
Xt|�}||_|S)NzLIST OVERVIEW.FMT)Z_cachedoverviewfmt�AttributeErrorr�rr5r<)rr{rr7rrr�_getoverviewfmtsz_NNTPBase._getoverviewfmtcCsdd�|D�S)NcSsg|]}t|j���qSr)rr>)r�r8rrrr�$sz(_NNTPBase._grouplist.<locals>.<listcomp>r)rrrrr�
_grouplist"sz_NNTPBase._grouplistcCs<i}|jd�\}}x |D]}|j�^}}|||<qW||fS)NZCAPABILITIES)r�r>)rr|r{rr8r9rBrrrrx&s
z_NNTPBase.capabilities)r^cCsbt|tjtjf�s$tdj|jj���t||jdk�\}}dj||�}|j	||�\}}||j
|�fS)NzAthe date parameter must be a date or datetime object, not '{:40}'rHzNEWGROUPS {0} {1})r(rNr�	TypeErrorrS�	__class__rrUrwr�r�)rrr^rOrP�cmdr{rrrr�	newgroups4sz_NNTPBase.newgroupscCsRt|tjtjf�s$tdj|jj���t||jdk�\}}dj|||�}|j	||�S)NzAthe date parameter must be a date or datetime object, not '{:40}'rHzNEWNEWS {0} {1} {2})
r(rNrr�rSr�rrUrwr�)rrrr^rOrPr�rrr�newnewsDsz_NNTPBase.newnewscCs4|dk	rd|}nd}|j||�\}}||j|�fS)NzLIST ACTIVE ZLIST)r�r�)r�
group_patternr^�commandr{rrrrr�Ts

z_NNTPBase.listcCs�tjd�}|jd|�\}}|jd�s8|jd|�\}}i}x>|D]6}|j|j��}|rB|jdd�\}	}
|sp|
S|
||	<qBW|r�||fSdSdS)Nz^(?P<group>[^ 	]+)[ 	]+(.*)$zLIST NEWSGROUPS rzXGTITLE r0rHr&)�re�compiler�rA�search�stripr)rr�Z
return_all�line_patr{r�groups�raw_line�matchr9Zdescrrr�_getdescriptionscs


z_NNTPBase._getdescriptionscCs|j|d�S)NF)r�)rrrrr�descriptionzsz_NNTPBase.descriptioncCs|j|d�S)NT)r�)rr�rrr�descriptions�sz_NNTPBase.descriptionscCs�|jd|�}|jd�s t|��|j�}d}}}t|�}|dkr�|d}|dkr�|d}|dkr�|d}|dkr�|dj�}|t|�t|�t|�|fS)NzGROUP rrr0rHr�rI)r�rArr>r6r2r?)rr9r{�words�countr!r �nrrrr�s

z_NNTPBase.groupcCs|jd|�S)NZHELP)r�)rr^rrr�help�sz_NNTPBase.helpcCs8|jd�st|��|j�}t|d�}|d}|||fS)NZ22r0rH)rArr>r?)rr{r��art_numr$rrr�
_statparse�s
z_NNTPBase._statparsecCs|j|�}|j|�S)N)r�r�)rr8r{rrr�_statcmd�s
z_NNTPBase._statcmdcCs"|r|jdj|��S|jd�SdS)NzSTAT {0}ZSTAT)r�rS)r�message_specrrr�stat�s	z_NNTPBase.statcCs
|jd�S)NZNEXT)r�)rrrr�next�sz_NNTPBase.nextcCs
|jd�S)NZLAST)r�)rrrrr �sz_NNTPBase.lastcCs0|j||�\}}|j|�\}}}|t|||�fS)N)r�r�r#)rr8r^r{rr�r$rrr�_artcmd�sz_NNTPBase._artcmdcCs$|dk	rdj|�}nd}|j||�S)NzHEAD {0}ZHEAD)rSr�)rr�r^r�rrr�head�sz_NNTPBase.headcCs$|dk	rdj|�}nd}|j||�S)NzBODY {0}ZBODY)rSr�)rr�r^r�rrr�body�sz_NNTPBase.bodycCs$|dk	rdj|�}nd}|j||�S)NzARTICLE {0}ZARTICLE)rSr�)rr�r^r�rrr�article�sz_NNTPBase.articlecCs
|jd�S)NZSLAVE)r�)rrrr�slavesz_NNTPBase.slavecsDtjd��|jdj||�|�\}}�fdd��|�fdd�|D�fS)Nz^([0-9]+) ?(.*)
?zXHDR {0} {1}cs�j|�}|r|jdd�S|S)Nr0rH)r�r)r8�m)�patrr�
remove_numbers
z%_NNTPBase.xhdr.<locals>.remove_numbercsg|]}�|��qSrr)r�r8)r�rrr�sz"_NNTPBase.xhdr.<locals>.<listcomp>)r�r�r�rS)rZhdrr�r^r{rr)r�r�r�xhdr
s	
z_NNTPBase.xhdrcCs.|jdj||�|�\}}|j�}|t||�fS)Nz
XOVER {0}-{1})r�rSr�rF)r�start�endr^r{rr7rrr�xovers	
z_NNTPBase.xoverc	Csxd|jkrdnd}t|ttf�r>|\}}|dj||p6d�7}n|dk	rR|d|}|j||�\}}|j�}|t||�fS)NZOVERZXOVERz {0}-{1}r&rv)rbr(�tupler�rSr�r�rF)	rr�r^r�r�r�r{rr7rrr�over(sz_NNTPBase.overc	Csjtjdtd�tjd�}|jd||�\}}g}x0|D](}|j|j��}|r6|j|j	dd��q6W||fS)NzFThe XGTITLE extension is not actively used, use descriptions() insteadrHz^([^ 	]+)[ 	]+(.*)$zXGTITLE r0)
�warnings�warn�DeprecationWarningr�r�r�r�r�r)r)	rrr^r�r{Z	raw_linesrr�r�rrr�xgtitleCs

z_NNTPBase.xgtitlecCsjtjdtd�|jdj|��}|jd�s0t|��y|j�\}}Wntk
r\t|��Yn
X||fSdS)Nz(The XPATH extension is not actively usedrHz	XPATH {0}Z223)	r�r�r�r�rSrArr>�
ValueError)r�idr{Zresp_num�pathrrr�xpathUs
z_NNTPBase.xpathcCsb|jd�}|jd�st|��|j�}t|�dkr8t|��|d}t|�dkrTt|��|t|d�fS)NZDATEZ111rHr0�)r�rArr>r6r
rR)rr{�elemrrrrris

z_NNTPBase.datecCs�|j|�}|jd�st|��t|ttf�r2|j�}xB|D]:}|jt�sT|j	d�t}|jd�rfd|}|j
j|�q8W|j
jd�|j
j�|j
�S)N�3s
r�s.
)r�rArr(r�	bytearray�
splitlines�endswithr�rstripr^r�r�r`)rr��fr{r8rrr�_postzs





z_NNTPBase._postcCs|jd|�S)NZPOST)r�)r�datarrr�post�sz_NNTPBase.postcCs|jdj|�|�S)Nz	IHAVE {0})r�rS)rr$r�rrr�ihave�sz_NNTPBase.ihavecCs|jj�|`dS)N)r^r�)rrrrrp�s
z_NNTPBase._closec
Csz|jd�}Wd|j�X|S)NZQUIT)r�rp)rr{rrrrm�s
z_NNTPBase.quitcCs�|jrtd��|r"|r"td��y>|r^|r^ddl}|j�}|j|j�}|r^|d}|d}Wntk
rtYnX|s~dS|jd|�}|jd�r�|s�t|��n |jd|�}|jd�s�t	|��d|_
|j�|jr�d	|j
kr�|j
�d|_
|j�dS)
NzAlready logged in.z7At least one of `user` and `usenetrc` must be specifiedrrHzauthinfo user Z381zauthinfo pass Z281r\)rgr��netrcZauthenticatorsr]rnr�rArrrbrcrdre)r�user�password�usenetrcr�ZcredentialsZauthr{rrr�login�s<



z_NNTPBase.logincCs`y|jd�|_WnJtk
r$Yn8tk
rZ}z|jjd�rHd|_n�WYdd}~XnXdS)Nzmode readerZ480T)r�rarrr
rArd)r�errrre�sz_NNTPBase._setreadermodecCs||jrtd��|jrtd��|jd�}|jd�rp|jj�t|j||j	�|_|jj
d�|_d|_d|_|j�nt
d��dS)NzTLS is already enabled.z+TLS cannot be started after authentication.�STARTTLSZ382�rwbTzTLS failed to start.)rfr�rgr�rAr^r�rYrWr]�makefilerbrcr)rrXr{rrr�starttls�s



z_NNTPBase.starttls)T)N)N)N)N)N)N)N)N)N)NNT)N)9rrrr�r�rrrjrqrtrcr~�debugr�r�r�r`r�r�r�r�r�r�rxr�r�r�r�r�r�rr�r�r�r�r�r r�r�r�r�r�r�r�r�r�r�rr�r�r�rprmr�re�	_have_sslr�rrrrrZ(sj
.	

.







		
)
rZc@s*eZdZeddddefdd�Zdd�ZdS)rNFc	Cs�||_||_tj||f|�|_d}y8|jjd�}tj|||||�|sJ|rX|j|||�Wn$|rn|j	�|jj	��YnXdS)Nr�)
r]�port�socket�create_connectionrWr�rZrr�r�)	rr]r�r�r�rhr�rir^rrrr�s

z
NNTP.__init__c
Cs ztj|�Wd|jj�XdS)N)rZrprWr�)rrrrrp!szNNTP._close)rrr�	NNTP_PORTrrrprrrrr�s"c@s,eZdZedddddefdd�Zdd�ZdS)�NNTP_SSLNFc	

Cs�tj||f|�|_d}	yJt|j||�|_|jjd�}	tj||	|||d�|sP|r^|j|||�Wn$|	rt|	j�|jj��YnXdS)Nr�)rhri)	r�r�rWrYr�rZrr�r�)
rr]r�r�r�Zssl_contextrhr�rir^rrrr+s


zNNTP_SSL.__init__c
Cs ztj|�Wd|jj�XdS)N)rZrprWr�)rrrrrpAszNNTP_SSL._close)rrr�
NNTP_SSL_PORTrrrprrrrr�)s
r��__main__zJ        nntplib built-in demo - display the latest articles in a newsgroup)r�z-gz--groupzgmane.comp.python.generalz3group to fetch messages from (default: %(default)s))�defaultr�z-sz--serverznews.gmane.orgz+NNTP server hostname (default: %(default)s)z-pz--portr0z#NNTP port number (default: %s / %s))r��typer�z-nz
--nb-articles�
z2number of articles to fetch (default: %(default)s)z-Sz--ssl�
store_truezuse NNTP over SSL)�actionr�r�)r]r�r�ZGroupZhaszarticles, rangeZtocCs$t|�|kr |d|d�d}|S)NrIz...)r6)�sZlimrrr�cutlsr��<z{:7} {:20} {:42} ({})��*)N)N)Fr�r�r�)Ir�r��collectionsrNr�rV�ImportErrorr�Zemail.headerrr'r�__all__r�rrrrrr	r
r�r�r�r5r3r�
namedtuplerr#r<rFrRrUrYrZrr�r)r�argparse�ArgumentParser�parser�add_argumentr?�
parse_argsrr�Zserverr�rcr|r�rr{r�r!r r9rrr�r�Znb_articlesr�Z	overviewsZartnumr�r>ZauthorrrrSrmrrrr�<module>Bs�
	


X-






 shutil.cpython-36.pyc000064400000074265150335715140010524 0ustar003

�\dh}��A@s�dZddlZddlZddlZddlZddlZddlZyddlZ[dZWne	k
r^dZYnXyddl
Z
[
dZWne	k
r�dZYnXyddlZ[dZ
Wne	k
r�dZ
YnXyddlmZWne	k
r�dZYnXyddlmZWne	k
�rdZYnXddd	d
ddd
ddddddddddddddddddgZGd d�de�ZGd!d�de�ZGd"d�de�ZGd#d�de�ZGd$d%�d%e�ZGd&d'�d'e�Zd�d*d�Zd+d,�Zdd-�d.d�Zdd-�d/d	�Zeed0��r�dd-�d1d2�Z nd3d2�Z dd-�d4d
�Z!dd-�d5d�Z"dd-�d6d�Z#d7d�Z$dde#dfd8d
�Z%d9d:�Z&d;d<�Z'ej(ejej)ej*hej+k�o~ej,ej-k�o~ejej.kZ/d�d=d�Z0e/e0_1d>d?�Z2e#fd@d�Z3dAdB�Z4dCdD�Z5dEdF�Z6d�dHdI�Z7d�dJdK�Z8dLe7d�gdNfiZ9e�re7d�gdOfe9dP<e8gdQfe9dR<e�re7d�gdTfe9dU<e
�r0e7d�gdWfe9dX<dYd�Z:d�d[d�Z;d\d�Z<d�d]d�Z=d^d�Z>d_d`�Z?d�dad�Z@dbd�ZAdcdd�ZBdedf�ZCddg�dhdi�ZDdjgeDgdNfdkgeCgdQfdl�ZEe�r�dmdngeDgdOfeEdP<e�r�dodpgeDgdTfeEdU<e
�rdqdrgeDgdWfeEdX<dsdt�ZFd�ddg�dud�ZGeedv��r\ejHdw�ejIdxdy�ZJdzeJjK_d{eJjL_d|eJjM_d}dw�ZNn2ejOd~k�r�ddlPZPejHdw�ejIdxdy�ZJddw�ZNd�d�d�ZQd�d�d�ZRejSejTBdfd�d�ZUdS)�z�Utility functions for copying and archiving files and directory trees.

XXX The functions here don't copy the resource fork or other metadata on Mac.

�NTF)�getpwnam)�getgrnam�copyfileobj�copyfile�copymode�copystat�copy�copy2�copytree�move�rmtree�Error�SpecialFileError�	ExecError�make_archive�get_archive_formats�register_archive_format�unregister_archive_format�get_unpack_formats�register_unpack_format�unregister_unpack_format�unpack_archive�ignore_patterns�chown�which�get_terminal_size�
SameFileErrorc@seZdZdS)r
N)�__name__�
__module__�__qualname__�r r �/usr/lib64/python3.6/shutil.pyr
7sc@seZdZdZdS)rz5Raised when source and destination are the same file.N)rrr�__doc__r r r r!r:sc@seZdZdZdS)rz|Raised when trying to do a kind of operation (e.g. copying) which is
    not supported on a special file (e.g. a named pipe)N)rrrr"r r r r!r=sc@seZdZdZdS)rz+Raised when a command could not be executedN)rrrr"r r r r!rAsc@seZdZdZdS)�	ReadErrorz%Raised when an archive cannot be readN)rrrr"r r r r!r#Dsr#c@seZdZdZdS)�
RegistryErrorzVRaised when a registry operation with the archiving
    and unpacking registries failsN)rrrr"r r r r!r$Gsr$�icCs$x|j|�}|sP|j|�qWdS)z=copy data from file-like object fsrc to file-like object fdstN)�read�write)�fsrc�fdstZlengthZbufr r r!rLs

cCsXttjd�r0ytjj||�Stk
r.dSXtjjtjj|��tjjtjj|��kS)N�samefileF)�hasattr�os�pathr*�OSError�normcase�abspath)�src�dstr r r!�	_samefileTsr3)�follow_symlinkscCs�t||�rtdj||���xL||gD]@}ytj|�}Wntk
rJYq$Xtj|j�r$td|��q$W|r�tj	j
|�r�tjtj|�|�n6t
|d��&}t
|d��}t||�WdQRXWdQRX|S)z�Copy data from src to dst.

    If follow_symlinks is not set and src is a symbolic link, a new
    symlink will be created instead of copying the file it points to.

    z{!r} and {!r} are the same filez`%s` is a named pipe�rb�wbN)r3r�formatr,�statr.�S_ISFIFO�st_moderr-�islink�symlink�readlink�openr)r1r2r4�fn�str(r)r r r!r`s
cCsz|r>tjj|�r>tjj|�r>ttd�r8tjtj}}q\dSnttd�rXtjtj}}ndS||�}||tj|j	��dS)z�Copy mode bits from src to dst.

    If follow_symlinks is not set, symlinks aren't followed if and only
    if both `src` and `dst` are symlinks.  If `lchmod` isn't available
    (e.g. Linux) this method does nothing.

    �lchmodN�chmod)
r,r-r;r+�lstatrAr8rB�S_IMODEr:)r1r2r4Z	stat_funcZ
chmod_funcr@r r r!r}s

�	listxattrcCs�ytj||d�}Wn4tk
rF}z|jtjtjfkr8�dSd}~XnXxn|D]f}y&tj|||d�}tj||||d�WqNtk
r�}z|jtjtjtjfkr��WYdd}~XqNXqNWdS)z�Copy extended filesystem attributes from `src` to `dst`.

        Overwrite existing attributes.

        If `follow_symlinks` is false, symlinks won't be followed.

        )r4N)	r,rEr.�errno�ENOTSUPZENODATA�getxattr�setxattrZEPERM)r1r2r4�names�e�name�valuer r r!�
_copyxattr�s	
rNcOsdS)Nr )�args�kwargsr r r!rN�sc	s6ddd�dd��|p,tjj|�o*tjj|�}|r@�fdd�}n�fdd�}|d�||d	�}tj|j�}|d
�||j|jf|d�y|d�|||d	�Wntk
r�YnXt	|d��r$y|d
�||j
|d	�WnPtk
�r"}z2x*dD] }t	t|�r�|jt
t|�kr�Pq�W�WYdd}~XnXt|||d	�dS)a�Copy file metadata

    Copy the permission bits, last access time, last modification time, and
    flags from `src` to `dst`. On Linux, copystat() also copies the "extended
    attributes" where possible. The file contents, owner, and group are
    unaffected. `src` and `dst` are path names given as strings.

    If the optional flag `follow_symlinks` is not set, symlinks aren't
    followed if and only if both `src` and `dst` are symlinks.
    N)�nsr4cWsdS)Nr )rQr4rOr r r!�_nop�szcopystat.<locals>._nopcstt|��S)N)�getattrr,)rL)rRr r!�lookup�szcopystat.<locals>.lookupcstt|��}|tjkr|S�S)N)rSr,�supports_follow_symlinks)rLr?)rRr r!rT�s
r8)r4�utimerB�st_flagsZchflags�
EOPNOTSUPPrG)rXrG)r,r-r;r8rDr:�st_atime_ns�st_mtime_ns�NotImplementedErrorr+rWr.rFrSrN)	r1r2r4ZfollowrTr@�mode�why�errr )rRr!r�s,
cCsBtjj|�r"tjj|tjj|��}t|||d�t|||d�|S)a3Copy data and mode bits ("cp src dst"). Return the file's destination.

    The destination may be a directory.

    If follow_symlinks is false, symlinks won't be followed. This
    resembles GNU's "cp -P src dst".

    If source and destination are the same file, a SameFileError will be
    raised.

    )r4)r,r-�isdir�join�basenamerr)r1r2r4r r r!r�s
cCsBtjj|�r"tjj|tjj|��}t|||d�t|||d�|S)a1Copy data and metadata. Return the file's destination.

    Metadata is copied with copystat(). Please see the copystat function
    for more information.

    The destination may be a directory.

    If follow_symlinks is false, symlinks won't be followed. This
    resembles GNU's "cp -P src dst".

    )r4)r,r-r_r`rarr)r1r2r4r r r!r	�s
cs�fdd�}|S)z�Function that can be used as copytree() ignore parameter.

    Patterns is a sequence of glob-style patterns
    that are used to exclude filescs,g}x�D]}|jtj||��q
Wt|�S)N)�extend�fnmatch�filter�set)r-rJ�
ignored_names�pattern)�patternsr r!�_ignore_patternss
z)ignore_patterns.<locals>._ignore_patternsr )rhrir )rhr!rscCs�tj|�}|dk	r|||�}nt�}tj|�g}�xB|D�]8}	|	|krJq:tjj||	�}
tjj||	�}y�tjj|
�r�tj|
�}|r�tj||�t	|
||d�n<tjj
|�r�|r�w:tjj|
�r�t|
||||�n
||
|�n(tjj|
�r�t|
||||�n
||
|�Wq:t
k
�r<}
z|j|
jd�WYdd}
~
Xq:tk
�rr}z|j|
|t|�f�WYdd}~Xq:Xq:Wyt	||�WnJtk
�r�}z,t|dd�dk�r�|j||t|�f�WYdd}~XnX|�r�t
|��|S)a�Recursively copy a directory tree.

    The destination directory must not already exist.
    If exception(s) occur, an Error is raised with a list of reasons.

    If the optional symlinks flag is true, symbolic links in the
    source tree result in symbolic links in the destination tree; if
    it is false, the contents of the files pointed to by symbolic
    links are copied. If the file pointed by the symlink doesn't
    exist, an exception will be added in the list of errors raised in
    an Error exception at the end of the copy process.

    You can set the optional ignore_dangling_symlinks flag to true if you
    want to silence this exception. Notice that this has no effect on
    platforms that don't support os.symlink.

    The optional ignore argument is a callable. If given, it
    is called with the `src` parameter, which is the directory
    being visited by copytree(), and `names` which is the list of
    `src` contents, as returned by os.listdir():

        callable(src, names) -> ignored_names

    Since copytree() is called recursively, the callable will be
    called once for each directory that is copied. It returns a
    list of names relative to the `src` directory that should
    not be copied.

    The optional copy_function argument is a callable that will be used
    to copy each file. It will be called with the source path and the
    destination path as arguments. By default, copy2() is used, but any
    function that supports the same signature (like copy()) can be used.

    N)r4rZwinerror)r,�listdirre�makedirsr-r`r;r=r<r�existsr_r
r
rbrOr.�append�strrS)r1r2�symlinks�ignore�
copy_functionZignore_dangling_symlinksrJrf�errorsrLZsrcnameZdstname�linktor^r]r r r!r
sL$



 *&c$CsLytjj|�rtd��Wn(tk
r@|tjj|tj��dSXg}ytj|�}Wn&tk
rz|tj|tj��YnXx�|D]�}tjj||�}ytj|�j	}Wntk
r�d}YnXt
j|�r�t||�q�ytj
|�Wq�tk
�r
|tj
|tj��Yq�Xq�Wytj|�Wn(tk
�rF|tj|tj��YnXdS)Nz%Cannot call rmtree on a symbolic linkr)r,r-r;r.�sys�exc_inforjr`rCr:r8�S_ISDIR�_rmtree_unsafe�unlink�rmdir)r-�onerrorrJrL�fullnamer\r r r!rwqs6


rwc
0Cs�g}ytj|�}Wn:tk
rL}z||_|tj|tj��WYdd}~XnX�x�|D�]x}tjj||�}ytj||dd�}|j	}Wntk
r�d}YnXtj
|��r�ytj|tj|d�}	Wn&tk
r�|tj|tj��Yn�Xz�tjj
|tj|	���rJt|	||�ytj||d�Wn(tk
�rF|tj|tj��YnXn8ytd��Wn*tk
�r�|tjj|tj��YnXWdtj|	�XqVytj||d�WqVtk
�r�|tj|tj��YqVXqVWdS)NF)�dir_fdr4r)r|z%Cannot call rmtree on a symbolic link)r,rjr.�filenamertrur-r`r8r:rvr>�O_RDONLY�samestat�fstat�_rmtree_safe_fdryr;�closerx)
�topfdr-rzrJr^rLr{�orig_str\�dirfdr r r!r��sD$

r�c!Cs^|rdd�}n|dkrdd�}t�rPt|t�r8tj|�}ytj|�}Wn&tk
rl|tj|tj��dSXytj	|tj
�}Wn&tk
r�|tj|tj��dSXz�tjj|tj
|���rt|||�ytj|�Wn(tk
�r|tj|tj��YnXn8ytd��Wn*tk
�r<|tjj|tj��YnXWdtj|�Xn
t||�SdS)a�Recursively delete a directory tree.

    If ignore_errors is set, errors are ignored; otherwise, if onerror
    is set, it is called to handle the error with arguments (func,
    path, exc_info) where func is platform and implementation dependent;
    path is the argument to that function that caused it to fail; and
    exc_info is a tuple returned by sys.exc_info().  If ignore_errors
    is false and onerror is None, an exception is raised.

    cWsdS)Nr )rOr r r!rz�szrmtree.<locals>.onerrorNcWs�dS)Nr )rOr r r!rz�sz%Cannot call rmtree on a symbolic link)�_use_fd_functions�
isinstance�bytesr,�fsdecoderC�	Exceptionrtrur>r~r-rr�r�ryr.r;r�rw)r-�
ignore_errorsrzr��fdr r r!r�s<


cCs&tjjtjjpd}tjj|j|��S)N�)r,r-�sep�altsepra�rstrip)r-r�r r r!�	_basename�sr�cCs|}tjj|�rTt||�r*tj||�dStjj|t|��}tjj|�rTtd|��ytj||�Wn�t	k
r�tjj
|�r�tj|�}tj||�tj
|�nTtjj|�r�t||�r�td||f��t|||dd�t|�n|||�tj
|�YnX|S)a+Recursively move a file or directory to another location. This is
    similar to the Unix "mv" command. Return the file or directory's
    destination.

    If the destination is a directory or a symlink to a directory, the source
    is moved inside the directory. The destination path must not already
    exist.

    If the destination already exists but is not a directory, it may be
    overwritten depending on os.rename() semantics.

    If the destination is on our current filesystem, then rename() is used.
    Otherwise, src is copied to the destination and then removed. Symlinks are
    recreated under the new name if os.rename() fails because of cross
    filesystem renames.

    The optional `copy_function` argument is a callable that will be used
    to copy the source or it will be delegated to `copytree`.
    By default, copy2() is used, but any function that supports the same
    signature (like copy()) can be used.

    A lot more could be done here...  A look at a mv.c shows a lot of
    the issues this implementation glosses over.

    Nz$Destination path '%s' already existsz.Cannot move a directory '%s' into itself '%s'.T)rqro)r,r-r_r3�renamer`r�rlr
r.r;r=r<rx�
_destinsrcr
r)r1r2rqZreal_dstrsr r r!rs2




cCsVtjj|�}tjj|�}|jtjj�s2|tjj7}|jtjj�sL|tjj7}|j|�S)N)r,r-r0�endswithr��
startswith)r1r2r r r!r�8sr�cCsNtdks|dkrdSyt|�}Wntk
r8d}YnX|dk	rJ|dSdS)z"Returns a gid, given a group name.N�)r�KeyError)rL�resultr r r!�_get_gidAs
r�cCsNtdks|dkrdSyt|�}Wntk
r8d}YnX|dk	rJ|dSdS)z"Returns an uid, given a user name.Nr�)rr�)rLr�r r r!�_get_uidMs
r��gzipc
s"|dkrd}nDtr |dkr d}n2tr2|dkr2d}n trD|dkrDd}ntdj|���d	dl}	|rfd
|nd}
|d|
}tjj|�}|r�tjj	|�r�|dk	r�|j
d|�|s�tj|�|dk	r�|j
d
�t���t
�������fdd�}
|�s|	j|d|�}z|j||
d�Wd|j�X|S)a�Create a (possibly compressed) tar file from all the files under
    'base_dir'.

    'compress' must be "gzip" (the default), "bzip2", "xz", or None.

    'owner' and 'group' can be used to define an owner and a group for the
    archive that is being built. If not provided, the current owner and group
    will be used.

    The output tar file will be named 'base_name' +  ".tar", possibly plus
    the appropriate compression extension (".gz", ".bz2", or ".xz").

    Returns the output filename.
    Nr�r�Zgz�bzip2�bz2�xzzCbad value for 'compress', or compression format not supported : {0}r�.z.tarzcreating %szCreating tar archivecs,�dk	r�|_�|_�dk	r(�|_�|_|S)N)�gidZgname�uid�uname)Ztarinfo)r��group�ownerr�r r!�_set_uid_gid�sz#_make_tarball.<locals>._set_uid_gidzw|%s)rd)�_ZLIB_SUPPORTED�_BZ2_SUPPORTED�_LZMA_SUPPORTED�
ValueErrorr7�tarfiler,r-�dirnamerl�inforkr�r�r>�addr�)�	base_name�base_dir�compress�verbose�dry_runr�r��loggerZtar_compressionr�Zcompress_extZarchive_name�archive_dirr��tarr )r�r�r�r�r!�
_make_tarballYs<

	
r�c
Cs|ddl}|d}tjj|�}|rPtjj|�rP|dk	rB|jd|�|sPtj|�|dk	rf|jd||�|�sx|j|d|jd���}tjj	|�}	|	tj
kr�|j|	|	�|dk	r�|jd|	�x�tj|�D]�\}
}}xFt
|�D]:}
tjj	tjj|
|
��}	|j|	|	�|dk	r�|jd|	�q�WxT|D]L}
tjj	tjj|
|
��}	tjj|	��r|j|	|	�|dk	�r|jd|	��qWq�WWdQRX|S)	z�Create a zip file from all the files under 'base_dir'.

    The output zip file will be named 'base_name' + ".zip".  Returns the
    name of the output zip file.
    rNz.zipzcreating %sz#creating '%s' and adding '%s' to it�w)Zcompressionzadding '%s')�zipfiler,r-r�rlr�rk�ZipFileZZIP_DEFLATED�normpath�curdirr'�walk�sortedr`�isfile)r�r�r�r�r�r�Zzip_filenamer�Zzfr-�dirpathZdirnames�	filenamesrLr r r!�
_make_zipfile�s@



 r�r�r�zuncompressed tar filezgzip'ed tar-fileZgztarzZIP file�zipr�zbzip2'ed tar-fileZbztarr�zxz'ed tar-fileZxztarcCsdd�tj�D�}|j�|S)z�Returns a list of supported formats for archiving and unarchiving.

    Each element of the returned sequence is a tuple (name, description)
    cSsg|]\}}||df�qS)r�r )�.0rL�registryr r r!�
<listcomp>�sz'get_archive_formats.<locals>.<listcomp>)�_ARCHIVE_FORMATS�items�sort)�formatsr r r!r�sr�cCsz|dkrg}t|�s td|��t|ttf�s6td��x0|D](}t|ttf�s\t|�dkr<td��q<W|||ft|<dS)auRegisters an archive format.

    name is the name of the format. function is the callable that will be
    used to create archives. If provided, extra_args is a sequence of
    (name, value) tuples that will be passed as arguments to the callable.
    description can be provided to describe the format, and will be returned
    by the get_archive_formats() function.
    NzThe %s object is not callablez!extra_args needs to be a sequencer�z+extra_args elements are : (arg_name, value))�callable�	TypeErrorr��tuple�list�lenr�)rL�function�
extra_args�description�elementr r r!r�s	
cCs
t|=dS)N)r�)rLr r r!r�sc	Cstj�}	|dk	r>|dk	r$|jd|�tjj|�}|s>tj|�|dkrLtj}||d�}
yt|}Wn tk
r�t	d|��YnX|d}x|dD]\}
}||
|
<q�W|dkr�||
d<||
d	<z|||f|
�}Wd|dk	r�|dk	r�|jd
|	�tj|	�X|S)aCreate an archive file (eg. zip or tar).

    'base_name' is the name of the file to create, minus any format-specific
    extension; 'format' is the archive format: one of "zip", "tar", "gztar",
    "bztar", or "xztar".  Or any other registered format.

    'root_dir' is a directory that will be the root directory of the
    archive; ie. we typically chdir into 'root_dir' before creating the
    archive.  'base_dir' is the directory where we start archiving from;
    ie. 'base_dir' will be the common prefix of all files and
    directories in the archive.  'root_dir' and 'base_dir' both default
    to the current directory.  Returns the name of the archive file.

    'owner' and 'group' are used when creating a tar archive. By default,
    uses the current owner and group.
    Nzchanging into '%s')r�r�zunknown archive format '%s'r�r�r�r�zchanging back to '%s')
r,�getcwd�debugr-r0�chdirr�r�r�r�)r�r7Zroot_dirr�r�r�r�r�r�Zsave_cwdrP�format_info�func�arg�valr}r r r!r�s6

cCsdd�tj�D�}|j�|S)z�Returns a list of supported formats for unpacking.

    Each element of the returned sequence is a tuple
    (name, extensions, description)
    cSs"g|]\}}||d|df�qS)r�r )r�rLr�r r r!r�6sz&get_unpack_formats.<locals>.<listcomp>)�_UNPACK_FORMATSr�r�)r�r r r!r0sc	Csvi}x.tj�D]"\}}x|dD]}|||<q WqWx,|D]$}||kr:d}t||||f��q:Wt|�srtd��dS)z+Checks what gets registered as an unpacker.rz!%s is already registered for "%s"z*The registered function must be a callableN)r�r�r$r�r�)	�
extensionsr�r�Zexisting_extensionsrLr��ext�	extension�msgr r r!�_check_unpack_options;s
r�cCs,|dkrg}t|||�||||ft|<dS)aMRegisters an unpack format.

    `name` is the name of the format. `extensions` is a list of extensions
    corresponding to the format.

    `function` is the callable that will be
    used to unpack archives. The callable will receive archives to unpack.
    If it's unable to handle an archive, it needs to raise a ReadError
    exception.

    If provided, `extra_args` is a sequence of
    (name, value) tuples that will be passed as arguments to the callable.
    description can be provided to describe the format, and will be returned
    by the get_unpack_formats() function.
    N)r�r�)rLr�r�r�r�r r r!rMscCs
t|=dS)z*Removes the pack format from the registry.N)r�)rLr r r!rcscCs&tjj|�}tjj|�s"tj|�dS)z1Ensure that the parent directory of `path` existsN)r,r-r�r_rk)r-r�r r r!�_ensure_directorygsr�c	Cs�ddl}|j|�std|��|j|�}z�x�|j�D]�}|j}|jd�s4d|krRq4tjj	|f|j
d���}|spq4t|�|jd�s4|j
|j�}t|d�}z|j|�Wd|j�~Xq4WWd|j�XdS)z+Unpack zip `filename` to `extract_dir`
    rNz%s is not a zip file�/z..r6)r�Z
is_zipfiler#r�Zinfolistr}r�r,r-r`�splitr�r�r&r>r'r�)	r}�extract_dirr�r�r�rL�target�data�fr r r!�_unpack_zipfilems*



r�)rdcCs\ddl}y|j|�}Wn"|jk
r8td|��YnXz|j||d�Wd|j�XdS)zAUnpack tar/tar.gz/tar.bz2/tar.xz `filename` to `extract_dir`
    rNz/%s is not a compressed or uncompressed tar file)rd)r�r>ZTarErrorr#Z
extractallr�)r}r�rdr�Ztarobjr r r!�_unpack_tarfile�sr�z.tarz.zip)r�r�z.tar.gzz.tgzz.tar.bz2z.tbz2z.tar.xzz.txzcCs:x4tj�D](\}}x|dD]}|j|�r|SqWq
WdS)Nr)r�r�r�)r}rLr�r�r r r!�_find_unpack_format�s

r�c
Cs�|dkrtj�}|dkri}nd|i}|dk	r�yt|}Wn"tk
r\tdj|���YnX|d}|||ft|d�|��nRt|�}|dkr�tdj|���t|d}tt|d�}|j	|�|||f|�dS)a]Unpack an archive.

    `filename` is the name of the archive.

    `extract_dir` is the name of the target directory, where the archive
    is unpacked. If not provided, the current working directory is used.

    `format` is the archive format: one of "zip", "tar", "gztar", "bztar",
    or "xztar".  Or any other registered format.  If not provided,
    unpack_archive will use the filename extension and see if an unpacker
    was registered for that extension.

    In case none is found, a ValueError is raised.

    If `filter` is given, it is passed to the underlying
    extraction function.
    NrdzUnknown unpack format '{0}'r�r�zUnknown archive format '{0}')
r,r�r�r�r�r7�dictr�r#�update)r}r�r7rdZ
filter_kwargsr�r�rPr r r!r�s&
�statvfs�
disk_usageZusageztotal used freezTotal space in byteszUsed space in byteszFree space in bytescCs@tj|�}|j|j}|j|j}|j|j|j}t|||�S)z�Return disk usage statistics about the given path.

        Returned value is a named tuple with attributes 'total', 'used' and
        'free', which are the amount of total, used and free space, in bytes.
        )r,r��f_bavail�f_frsize�f_blocks�f_bfree�_ntuple_diskusage)r-r@�free�total�usedr r r!r��s

�ntcCs"tj|�\}}||}t|||�S)z�Return disk usage statistics about the given path.

        Returned values is a named tuple with attributes 'total', 'used' and
        'free', which are the amount of total, used and free space, in bytes.
        )r�Z
_getdiskusager�)r-r�r�r�r r r!r��scCs�|dkr|dkrtd��|}|}|dkr.d}n(t|t�rVt|�}|dkrVtdj|���|dkrdd}n(t|t�s�t|�}|dkr�tdj|���tj	|||�dS)z�Change owner user and group of the given path.

    user and group can be the uid/gid or the user/group names, and in that case,
    they are converted to their respective uid/gid.
    Nzuser and/or group must be setr�zno such user: {!r}zno such group: {!r}���r�)
r�r�rnr��LookupErrorr7�intr�r,r)r-�userr�Z_userZ_groupr r r!r	s"

�P�cCs�yttjd�}Wnttfk
r.d}YnXyttjd�}Wnttfk
r^d}YnX|dksp|dkr�ytjtjj��}Wn$t	tt
fk
r�tj|�}YnX|dkr�|j}|dkr�|j
}tj||f�S)aGet the size of the terminal window.

    For each of the two dimensions, the environment variable, COLUMNS
    and LINES respectively, is checked. If the variable is defined and
    the value is a positive integer, it is used.

    When COLUMNS or LINES is not defined, which is the common case,
    the terminal connected to sys.__stdout__ is queried
    by invoking os.get_terminal_size.

    If the terminal size cannot be successfully queried, either because
    the system doesn't support querying, or because we are not
    connected to a terminal, the value given in fallback parameter
    is used. Fallback defaults to (80, 24) which is the default
    size used by many terminal emulators.

    The value returned is a named tuple of type os.terminal_size.
    ZCOLUMNSrZLINES)r�r,�environr�r�rrt�
__stdout__�fileno�AttributeErrorr.�
terminal_size�columns�lines)Zfallbackrr�sizer r r!r(s$

cs"dd�}tjj��r&|�|�r"�SdS|dkr>tjjdtj�}|sFdS|jtj�}tj	dkr�tj
|krt|jdtj
�tjjdd�jtj�}t�fd	d
�|D��r��g}q‡fdd�|D�}n�g}t
�}xT|D]L}tjj|�}||kr�|j|�x(|D] }	tjj||	�}
||
|�r�|
Sq�Wq�WdS)
a3Given a command, mode, and a PATH string, return the path which
    conforms to the given mode on the PATH, or None if there is no such
    file.

    `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
    of os.environ.get("PATH"), or can be overridden with a custom search
    path.

    cSs&tjj|�o$tj||�o$tjj|�S)N)r,r-rl�accessr_)r?r\r r r!�
_access_checkbszwhich.<locals>._access_checkN�PATHZwin32rZPATHEXTr�c3s |]}�j�j|j��VqdS)N)�lowerr�)r�r�)�cmdr r!�	<genexpr>szwhich.<locals>.<genexpr>csg|]}�|�qSr r )r�r�)rr r!r��szwhich.<locals>.<listcomp>)r,r-r�r��get�defpathr��pathseprt�platformr��insert�anyrer/r�r`)rr\r-rZpathext�files�seen�dirZnormdirZthefilerLr )rr!rUs8







�@)r)FN)r�rrNNN)rrN)r�N)r�r�)r�r�)r�r�)Nr�)NNrrNNN)Nr�)NN)NN�r�r�)r)Vr"r,rtr8rc�collectionsrF�zlibr��ImportErrorr�r�Zlzmar��pwdrZgrpr�__all__r.r
rrrr#r�r$rr3rrr+rNrrr	rr
rwr�r>rxry�supports_dir_fdrj�supports_fdrUr�rZavoids_symlink_attacksr�rr�r�r�r�r�r�rrrrrr�rrr�r�r�r�r�rrm�
namedtupler�r�r�r�r�rLr�rr�F_OK�X_OKrr r r r!�<module>s�






:Y!,

58	
@
-





6
"





/




-getpass.cpython-36.opt-2.pyc000064400000005662150335715140011615 0ustar003


 \j�@s�ddlZddlZddlZddlZddlZdddgZGdd�de�Zddd�Zdd	d
�Z	ddd�Z
ddd�Zdd�Zyddl
Z
e
je
jfWnBeefk
r�yddlZWnek
r�e
ZYnXe	ZYnXeZdS)�N�getpass�getuser�GetPassWarningc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/getpass.pyrs�
Password: c.Cs�d}tj����}yJtjdtjtjB�}tj|d�}|j|�tj	|�}|j|�|sX|}Wnpt
k
r�}zT|j�ytj
j�}Wn&ttfk
r�d}t||�}YnXtj
}|s�tj}WYdd}~XnX|dk	�r�y�tj|�}|dd�}	|	dtjM<tj}
ttd��r|
tjO}
z tj||
|	�t|||d�}Wdtj||
|�|j�XWn@tjk
�r�|dk	�rz�||k	�r�|j�t||�}YnX|jd�|SQRXdS)Nz/dev/ttyzw+��TCSASOFT)�input�
)�
contextlib�	ExitStack�os�open�O_RDWR�O_NOCTTY�io�FileIO�
enter_context�
TextIOWrapper�OSError�close�sys�stdin�fileno�AttributeError�
ValueError�fallback_getpass�stderr�termios�	tcgetattrZECHOZ	TCSAFLUSH�hasattrr�	tcsetattr�
_raw_input�flush�error�write)�prompt�streamZpasswd�stack�fdZttyr
�e�old�newZtcsetattr_flagsrrr	�unix_getpasssR








r1cCs�tjtjk	rt||�Sx|D]}tj|�qWd}xHtj�}|dksL|dkrNP|dkrZt�|dkrp|dd�}q4||}q4Wtjd�tjd�|S)N��
r������)rr�	__stdin__r �msvcrtZputwchZgetwch�KeyboardInterrupt)r*r+�cZpwrrr	�win_getpassas"



r<cCs0tjdtdd�|stj}td|d�t||�S)Nz%Can not control echo on the terminal.�)�
stacklevelz&Warning: Password input may be echoed.)�file)�warnings�warnrrr!�printr&)r*r+rrr	r xsr r2cCs�|s
tj}|stj}t|�}|rpy|j|�Wn8tk
rf|j|jd�}|j|j�}|j|�YnX|j	�|j
�}|s�t�|ddkr�|dd�}|S)N�replacer6rr7r7)rr!r�strr)�UnicodeEncodeError�encode�encoding�decoder'�readline�EOFError)r*r+r
�linerrr	r&�s&r&cCs<x dD]}tjj|�}|r|SqWddl}|jtj��dS)N�LOGNAME�USER�LNAME�USERNAMEr)rLrMrNrO)r�environ�get�pwd�getpwuid�getuid)�name�userrRrrr	r�s
)r
N)r
N)r
N)r2NN)rrrrr@�__all__�UserWarningrr1r<r r&rr"r#r%�ImportErrorrr9rrrrr	�<module>s*

D

	


sysconfig.cpython-36.pyc000064400000037035150335715140011212 0ustar003

�]dh,a�
@sdZddlZddlZddlmZmZdddddd	d
ddd
dgZddddddddd�ddddddddd�ddddddddd�d d d!d!d"d#d$d%�d&d&d'd(d)d*d$d%�d+d+d,d,d-d*d$d%�d.�ZdoZej	j
�dZd6ejdd7�Z
d8ejdd7�Zejjej�Zejjej�Zejjej�Zejjej�ZdadZd9d:�Zej�rPejjeej��Zneej��Zej d;k�r�ej!�j"dp��r�eejj#eee��Zd>ej$k�r�eej$d>�Zd?d@�Z%e&edAd�Z'e'�r�ej d;k�r�e'j!�j"dq��r�ejjejje'��Z'drdCdD�Z(e(dE�Z)e)�r0x&dsD]Z*dHee*d3<dIee*dJ<�qWdKdL�Z+dMdN�Z,dOdP�Z-dQdR�Z.dSdT�Z/dtdUdV�Z0dWd�Z1dXdY�Z2dZd[�Z3d\d]�Z4d^d_�Z5dud`d�Z6dad�Z7dbd
�Z8dcd	�Z9e.�ddEfddd
�Z:e.�ddEfded�Z;dfd�Z<dgd�Z=dhd�Z>did�Z?djdk�Z@dldm�ZAeBdnk�reA�dS)vz-Access to Python's configuration information.�N)�pardir�realpath�get_config_h_filename�get_config_var�get_config_vars�get_makefile_filename�get_path�get_path_names�	get_paths�get_platform�get_python_version�get_scheme_names�parse_config_hz/{installed_base}/lib64/python{py_version_short}z){platbase}/lib64/python{py_version_short}z1{base}/lib/python{py_version_short}/site-packagesz7{platbase}/lib64/python{py_version_short}/site-packagesz;{installed_base}/include/python{py_version_short}{abiflags}z?{installed_platbase}/include/python{py_version_short}{abiflags}z
{base}/binz{base})�stdlib�
platstdlib�purelib�platlib�include�platinclude�scripts�dataz{installed_base}/lib/pythonz{base}/lib/pythonz{installed_base}/include/pythonz{installed_base}/Libz
{base}/Libz{base}/Lib/site-packagesz{installed_base}/Includez{base}/Scriptsz#{userbase}/Python{py_version_nodot}z1{userbase}/Python{py_version_nodot}/site-packagesz+{userbase}/Python{py_version_nodot}/Includez+{userbase}/Python{py_version_nodot}/Scriptsz
{userbase})rrrrrrrz){userbase}/lib64/python{py_version_short}z5{userbase}/lib/python{py_version_short}/site-packagesz7{userbase}/lib64/python{py_version_short}/site-packagesz+{userbase}/include/python{py_version_short}z{userbase}/binz{userbase}/lib/pythonz#{userbase}/lib/python/site-packagesz{userbase}/include)�posix_prefix�
posix_home�nt�nt_user�
posix_user�osx_framework_userrrrrrrrz%d.%d�z%d%dcCs"yt|�Stk
r|SXdS)N)r�OSError)�path�r �!/usr/lib64/python3.6/sysconfig.py�_safe_realpathcsr"r�\pcbuild\win32�\pcbuild\amd64Z_PYTHON_PROJECT_BASEcCs.x(dD] }tjjtjj|d|��rdSqWdS)N�
Setup.dist�Setup.local�ModulesTF)r%r&)�osr�isfile�join)�d�fnr r r!�_is_python_source_dirxs
r-�_homeFcCs|rtrtt�Stt�S)N)�	_sys_homer-�
_PROJECT_BASE)�
check_homer r r!�is_python_build�sr2Trrz{srcdir}/Includez{projectbase}/.rcCsdy|jf|�Stk
r^y|jftj�Stk
rX}ztd|��WYdd}~XnXYnXdS)Nz{%s})�format�KeyErrorr(�environ�AttributeError)�s�
local_vars�varr r r!�_subst_vars�sr:cCs4|j�}x&|j�D]\}}||kr$q|||<qWdS)N)�keys�items)�target_dict�
other_dict�target_keys�key�valuer r r!�_extend_dict�s
rBcCsfi}|dkri}t|t��xDt|j�D]4\}}tjdkrHtjj|�}tjjt	||��||<q*W|S)N�posixr)rCr)
rBr�_INSTALL_SCHEMESr<r(�namer�
expanduser�normpathr:)�scheme�vars�resr@rAr r r!�_expand_vars�s
rKcCstjdkrdStjS)NrCr)r(rEr r r r!�_get_default_scheme�s
rLcCs�tjjdd�}dd�}tjdkrBtjjd�p.d}|r8|S||d�Stjdkr|td	�}|r||r`|S|dd
|dtjdd��S|r�|S|dd
�SdS)N�PYTHONUSERBASEcWstjjtjj|��S)N)r(rrFr*)�argsr r r!�joinuser�sz_getuserbase.<locals>.joinuserr�APPDATA�~�Python�darwin�PYTHONFRAMEWORK�Libraryz%d.%drz.local)r(r5�getrE�sys�platformr�version_info)�env_baserO�base�	frameworkr r r!�_getuserbase�s"



r]cCsZddl}|jd�}|jd�}|jd�}|dkr2i}i}i}t|dd��}|j�}	WdQRXx�|	D]�}
|
jd�s`|
j�d	kr|q`|j|
�}|r`|jd
d�\}}
|
j�}
|
jdd	�}d
|kr�|
||<q`yt	|
�}
Wn$t
k
r�|
jdd
�||<Yq`X|
||<q`Wt|j��}d}�x
t
|�dk�r�x�t|�D�]�}||}|j|�}|j|�}|�rv|�rv|j�|j�k�rp|n|}n|�r�|n|}|dk	�r�|jd
�}d}||k�r�t||�}n�||k�r�d}nx|tjk�r�tj|}n`||k�r0|jd��r
|dd�|k�r
d	}n$d||k�rd}nt|d|�}nd	||<}|�r||j�d�}|d|j��||}d
|k�r~|||<n~yt	|�}Wn"t
k
�r�|j�||<Yn
X|||<|j|�|jd��r|dd�|k�r|dd�}||k�r|||<n|||<|j|��q,W�qWx.|j�D]"\}}
t|
t��r&|
j�||<�q&W|j|�|S)z�Parse a Makefile-style file.

    A dictionary containing name/value pairs is returned.  If an
    optional dictionary is passed in as the second argument, it is
    used instead of a new dictionary.
    rNz"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)z\$\(([A-Za-z][A-Za-z0-9_]*)\)z\${([A-Za-z][A-Za-z0-9_]*)}�surrogateescape)�errors�#��rz$$�$�CFLAGS�LDFLAGS�CPPFLAGSTF�PY_�)rdrerf)�re�compile�open�	readlines�
startswith�strip�match�group�replace�int�
ValueError�listr;�len�tuple�search�start�strr(r5�end�remover<�
isinstance�update)�filenamerIri�_variable_rx�_findvar1_rx�_findvar2_rx�done�notdone�f�lines�line�m�n�v�tmpv�	variables�renamed_variablesrErA�m1�m2�found�item�after�kr r r!�_parse_makefile�s�	


















r�cCsdtrtjjtptd�Sttd�r0dttj	f}nd}ttj
d�rP|dtj
j7}tjjtd�|d�S)z Return the path of the Makefile.�Makefile�abiflagszconfig-%s%s�config�
_multiarchz-%sr)
�
_PYTHON_BUILDr(rr*r/r0�hasattrrW�_PY_VERSION_SHORTr��implementationr�r)�config_dir_namer r r!rLs
c	Cs(tjjddjtjtjttjdd�d��S)N�_PYTHON_SYSCONFIGDATA_NAMEz+_sysconfigdata_{abi}_{platform}_{multiarch}r�ra)�abirX�	multiarch)	r(r5rVr3rWr�rX�getattrr�r r r r!�_get_sysconfigdata_nameYs
r�c,Cs�ddl}i}t�}yt||�WnJtk
rj}z.d|}t|d�rR|d|j}t|��WYdd}~XnXt�}y"t|��}t||�WdQRXWnJtk
r�}z.d|}t|d�r�|d|j}t|��WYdd}~XnXt	r�|d|d<t
�}dtjk�r$ddl
}|j|�}	||	_|	tj|<d	t�tf}
ttd
��rF|
d7}
tj|
dd
�tjj|
|d�}t|ddd��(}|jd�|jd�|j||d�WdQRXtdddd��}|j|
�WdQRXdS)z;Generate the Python module containing build-time variables.rNz.invalid Python installation: unable to open %s�strerrorz (%s)�LDSHARED�	BLDSHAREDrSzbuild/lib.%s-%s�gettotalrefcountz-pydebugT)�exist_okz.py�w�utf8)�encodingzB# system configuration generated and used by the sysconfig module
zbuild_time_vars = )�streamzpybuilddir.txt�ascii)�pprintrr�rr�r�rrkrr�r�rWrX�types�
ModuleType�build_time_vars�modulesrr�r(�makedirsrr*�write)r�rI�makefile�e�msg�config_hr�rEr��module�
pybuilddir�destfiler r r!�_generate_posix_varsbsL







r�cCs0t�}t|t�t�dgd�}|j}|j|�dS)z7Initialize the module as appropriate for POSIX systems.r�rN)r��
__import__�globals�localsr�r})rIrE�_tempr�r r r!�_init_posix�sr�cCsVtd�|d<td�|d<td�|d<d|d<d	|d
<t|d<tjjttj��|d<d
S)z+Initialize the module as appropriate for NTr�LIBDESTr�
BINLIBDESTr�	INCLUDEPYz.pyd�
EXT_SUFFIXz.exe�EXE�VERSION�BINDIRN)r�_PY_VERSION_SHORT_NO_DOTr(r�dirnamer"rW�
executable)rIr r r!�_init_non_posix�sr�c	Cs�|dkri}ddl}|jd�}|jd�}xx|j�}|s8P|j|�}|r�|jdd�\}}yt|�}Wntk
rvYnX|||<q*|j|�}|r*d||jd�<q*W|S)z�Parse a config.h-style file.

    A dictionary containing name/value pairs is returned.  If an
    optional dictionary is passed in as the second argument, it is
    used instead of a new dictionary.
    Nrz"#define ([A-Z][A-Za-z0-9_]+) (.*)
z&/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/
rbr)rirj�readlinerorprrrs)	�fprIri�	define_rx�undef_rxr�r�r�r�r r r!r�s*




cCsBtr,tjdkr"tjjtptd�}q4tp(t}ntd�}tjj|d�S)zReturn the path of pyconfig.h.r�PCrz
pyconfig-64.h)r�r(rErr*r/r0r)�inc_dirr r r!r�s

cCsttt��S)z,Return a tuple containing the schemes names.)rv�sortedrDr r r r!r
�scCstS)z*Return a tuple containing the paths names.)�_SCHEME_KEYSr r r r!r	�scCs|rt||�St|SdS)z�Return a mapping containing an install scheme.

    ``scheme`` is the install scheme name. If not provided, it will
    return the default scheme for the current platform.
    N)rKrD)rHrI�expandr r r!r
�s
cCst|||�|S)z[Return a path corresponding to the scheme.

    ``scheme`` is the install scheme name.
    )r
)rErHrIr�r r r!r�scGs|tdk�rFiattd<ttd<ttd<ttd<ttd<ttd<ttd<ttd	<ttd
<ttd<yt	j
td<Wntk
r�d
td<YnXtj
dkr�tt�tj
dkr�tt�tjd�}|dk	r�|td<t�td<tjdt�}tj
dk�rt�rtjjt��}tjj||�}ntjjt��}t|�td<t	jdk�rFddl}|jt�|�rtg}x|D]}|jtj|���qVW|StSdS)anWith no arguments, return a dictionary of all configuration
    variables relevant for the current platform.

    On Unix, this means every variable defined in Python's installed Makefile;
    On Windows it's a much smaller set.

    With arguments, return a list of values that result from looking up
    each argument in the configuration variable dictionary.
    N�prefix�exec_prefix�
py_version�py_version_short�py_version_nodot�installed_baser[�installed_platbase�platbase�projectbaser�rarrCr��SO�userbase�srcdirrSr)�_CONFIG_VARS�_PREFIX�_EXEC_PREFIX�_PY_VERSIONr�r��_BASE_PREFIX�_BASE_EXEC_PREFIXr0rWr�r6r(rEr�r�rVr]r�rr�rr*r"rX�_osx_support�customize_config_vars�append)rNr�r�r[r��valsrEr r r!rsP






cCs*|dkrddl}|jdtd�t�j|�S)z�Return the value of a single variable using the dictionary returned by
    'get_config_vars()'.

    Equivalent to get_config_vars().get(name)
    r�rNz SO is deprecated, use EXT_SUFFIXr)�warnings�warn�DeprecationWarningrrV)rEr�r r r!rPscCstjdkrnd}tjj|�}|d)kr(tjStjjd|�}tj|t|�|�j�}|dkr\dS|dkrhdStjStjd	ks�ttd
�r�tjSdtj	kr�tj	dStj
�\}}}}}|j�jdd
�}|jdd�}|jdd�}|dd�dkr�d||fS|dd�dk�rV|ddk�rd}dt|d�d|dd�f}ddd�}	|d|	tj
7}n�|dd �d!k�rtd||fS|dd�d"k�r�d#|||fS|dd$�d%k�r�d%}ddl}
|
jd&�}|j|�}|�r|j�}n2|dd$�d'k�rddl}
|
jt�|||�\}}}d(|||fS)*a�Return a string that identifies the current platform.

    This is used mainly to distinguish platform-specific build directories and
    platform-specific built distributions.  Typically includes the OS name
    and version and the architecture (as supplied by 'os.uname()'),
    although the exact information included depends on the OS; eg. for IRIX
    the architecture isn't particularly important (IRIX only runs on SGI
    hardware), but for Linux the kernel version isn't particularly
    important.

    Examples of returned values:
       linux-i586
       linux-alpha (?)
       solaris-2.6-sun4u
       irix-5.3
       irix64-6.2

    Windows will return one of:
       win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)
       win-ia64 (64bit Windows on Itanium)
       win32 (all others - specifically, sys.platform is returned)

    For other non-POSIX platforms, currently just returns 'sys.platform'.
    rz bit (rb�)�amd64z	win-amd64�itaniumzwin-ia64rC�uname�_PYTHON_HOST_PLATFORM�/ra� �_�-N��linuxz%s-%s�sunosr�5�solarisz%d.%srhr�32bit�64bit)i���l����z.%s��irix�aixz%s-%s.%s��cygwinz[\d.]+rSz%s-%s-%s���)r(rErW�version�findrXru�lowerr�r5r�rqrr�maxsizerirjrorpr��get_platform_osxr)r��i�j�look�osname�host�releaser�machine�bitnessri�rel_rer�r�r r r!r\sZ


 



cCstS)N)r�r r r r!r�scCsJxDtt|j���D]0\}\}}|dkr2td|�td||f�qWdS)Nrz%s: z
	%s = "%s")�	enumerater�r<�print)�titler�indexr@rAr r r!�_print_dict�srcCsfdtjkrt�dStdt��tdt��tdt��t�tdt��t�tdt	��dS)z*Display all information sysconfig detains.z--generate-posix-varsNzPlatform: "%s"zPython version: "%s"z!Current installation scheme: "%s"�Paths�	Variables)
rW�argvr�rrrrLrr
rr r r r!�_main�s
r�__main__)rrrrrrr)r#r$)r#r$)F)rr)N)N)C�__doc__r(rWZos.pathrr�__all__rDr�r�splitr�rYr�r�rrGr�r��base_prefixr�r�r��base_exec_prefixr�r��
_USER_BASEr"r�r�r0�getcwdrEr�endswithr*r5r-r�r/r2r�rHr:rBrKrLr]r�rr�r�r�r�rrr
r	r
rrrrrrr�__name__r r r r!�<module>s�

	

|
	?
 M[
mimetypes.cpython-36.opt-2.pyc000064400000022525150335715140012160 0ustar003


 \2R�@sddlZddlZddlZddlZyddlZWnek
rDdZYnXdddddddd	d
ddd
dg
Zdddddddddg	Z	da
daGdd�d�Zd5dd�Z
d6dd�Zd7dd�Zd8dd�Zd9dd	�Zdd
�Zd d!�Ze�ed"k�rddlZd#Zd:d%d&�Zy&ejejd'd�d(d)d*d+g�\ZZWn0ejk
�rNZzed'e�WYddZ[XnXd'ZdZxDeD]<\ZZ ed;k�rzed�ned<k�r�dZned=k�r^d'Z�q^WxheD]`Z!e�r�ee!e�Z"e"�s�e#d2e!�ne#e"�n.e
e!e�\Z"Z$e"�s�e#d2e!�ne#d3e"d4e$��q�WdS)>�N�
knownfiles�inited�	MimeTypes�
guess_type�guess_all_extensions�guess_extension�add_type�init�read_mime_types�
suffix_map�
encodings_map�	types_map�common_typesz/etc/mime.typesz/etc/httpd/mime.typesz/etc/httpd/conf/mime.typesz/etc/apache/mime.typesz/etc/apache2/mime.typesz$/usr/local/etc/httpd/conf/mime.typesz"/usr/local/lib/netscape/mime.typesz/usr/local/etc/mime.typesFc@s`eZdZfdfdd�Zddd�Zddd�Zddd	�Zdd
d�Zddd
�Zddd�Z	ddd�Z
dS)rTcCs�ts
t�tj�|_tj�|_iif|_iif|_x"tj�D]\}}|j||d�q<Wx"t	j�D]\}}|j||d�q`Wx|D]}|j
||�q�WdS)NTF)rr	r�copyrr
�
types_map_inv�itemsrr�read)�self�	filenames�strict�ext�type�name�r�!/usr/lib64/python3.6/mimetypes.py�__init__Bs




zMimeTypes.__init__cCs6||j||<|j|j|g�}||kr2|j|�dS)N)r
r�
setdefault�append)rrrrZextsrrrrPszMimeTypes.add_typecCsltjj|�\}}|dkrz|jd�}|dkr.d
S|jdd|�}|dkrR|d|�}n|d|�}d|ksnd|krrd}|dfStj|�\}}x&||jkr�tj||j|�\}}q�W||jkr�|j|}	tj|�\}}nd}	|jd}
||
kr�|
||	fS|j	�|
k�r|
|j	�|	fS|�r"d|	fS|jd	}
||
k�rB|
||	fS|j	�|
k�r`|
|j	�|	fSd|	fSdS)N�data�,r�;�=�/z
text/plainTF)NN)
�urllib�parseZ	splittype�find�	posixpath�splitextrrr
�lower)r�urlr�schemeZcommaZsemir�baser�encodingr
rrrras@





zMimeTypes.guess_typecCsP|j�}|jdj|g�}|sLx,|jdj|g�D]}||kr2|j|�q2W|S)NTF)r(r�getr)rrr�
extensionsrrrrr�szMimeTypes.guess_all_extensionscCs|j||�}|sdS|dS)Nr)r)rrrr.rrrr�s
zMimeTypes.guess_extensionc
Cs(t|dd��}|j||�WdQRXdS)Nzutf-8)r,)�open�readfp)r�filenamer�fprrrr�szMimeTypes.readc	Cs�x�|j�}|sP|j�}x0tt|��D] }||ddkr&||d�=Pq&W|sPq|d|dd�}}x|D]}|j|d||�qlWqWdS)Nr�#��.)�readline�split�range�lenr)	rr2r�lineZwords�ir�suffixesZsuffrrrr0�s

zMimeTypes.readfpcCs�tsdSdd�}tjtjd���}xz||�D]n}yRtj||��<}|jd�sJw*tj|d�\}}|tjkrfw*|j|||�WdQRXWq*tk
r�w*Yq*Xq*WWdQRXdS)NcssLd}xBytj||�}Wntk
r,PYnXd|kr<|V|d7}qWdS)Nr�r4)�_winregZEnumKey�EnvironmentError)Zmimedbr;Zctyperrr�
enum_types�sz3MimeTypes.read_windows_registry.<locals>.enum_types�r5zContent Type)r>�OpenKeyZHKEY_CLASSES_ROOT�
startswithZQueryValueExZREG_SZrr?)rrr@ZhkcrZ
subkeynameZsubkeyZmimetypeZdatatyperrr�read_windows_registry�s 


zMimeTypes.read_windows_registryN)T)T)T)T)T)T)T)�__name__�
__module__�__qualname__rrrrrrr0rDrrrrr:s

>



TcCstdkrt�tj||�S)N)�_dbr	r)r)rrrrrscCstdkrt�tj||�S)N)rHr	r)rrrrrr&s
cCstdkrt�tj||�S)N)rHr	r)rrrrrr7scCstdkrt�tj|||�S)N)rHr	r)rrrrrrrGscCsndat�}|dkr"tr|j�t}x"|D]}tjj|�r(|j|�q(W|j	a	|j
a
|jda|jda|a
dS)NTF)rrr>rDr�os�path�isfilerrrr
rrH)�files�db�filerrrr	Xs


cCsNyt|�}Wntk
r dSX|�t�}|j|d�|jdSQRXdS)NT)r/�OSErrorrr0r
)rN�frMrrrr
lsc�CsDddddddd�adddd	d
�addd
d
d
dddddddddddddddddddddddddd d d!d"d#d#d#d$d%dd&d'd(d(d)d*ddd+d$d,d-d.d.d/d'd'd'd'd0ddddd1d2d3d4d5d2d6dd7d8d9d9d:d9d9dd9d;d<d<d,d=d>d?d@dAdBdCdDdDdEdFdddGdHdIdJdKdBdLdMdNdOdOdPdPdBdQddRdSdTdUdd@dVdWdXdWdYd@dZd@d[d\d]��ad^d_d_d`d`d`dadbdc�adS)dNz.svg.gzz.tar.gzz.tar.bz2z.tar.xz)z.svgzz.tgzz.tazz.tzz.tbz2z.txzZgzip�compressZbzip2Zxz)z.gzz.Zz.bz2z.xzzapplication/octet-streamzapplication/postscriptzaudio/x-aiffzaudio/basiczvideo/x-msvideoz
text/plainzapplication/x-bcpiozimage/x-ms-bmpzapplication/x-cdfzapplication/x-netcdfzapplication/x-cpiozapplication/x-cshztext/cssztext/csvzapplication/mswordzapplication/x-dvizmessage/rfc822z
text/x-setextz	image/gifzapplication/x-gtarzapplication/x-hdfz	text/htmlzimage/vnd.microsoft.iconz	image/iefz
image/jpegzapplication/javascriptzapplication/jsonzapplication/x-latexz
video/mpegzapplication/vnd.apple.mpegurlzapplication/x-troff-manzapplication/x-troff-mezapplication/x-mifzvideo/quicktimezvideo/x-sgi-moviez
audio/mpegz	video/mp4zapplication/x-troff-mszapplication/odazapplication/x-pkcs12zapplication/pkcs7-mimezimage/x-portable-bitmapzapplication/pdfzimage/x-portable-graymapz	image/pngzimage/x-portable-anymapzapplication/vnd.ms-powerpointzimage/x-portable-pixmapz
text/x-pythonzapplication/x-python-codezaudio/x-pn-realaudiozapplication/x-pn-realaudiozimage/x-cmu-rasterzapplication/xmlzimage/x-rgbzapplication/x-troffz
text/richtextztext/x-sgmlzapplication/x-shzapplication/x-sharzapplication/x-wais-sourcezapplication/x-sv4cpiozapplication/x-sv4crcz
image/svg+xmlzapplication/x-shockwave-flashzapplication/x-tarzapplication/x-tclzapplication/x-texzapplication/x-texinfoz
image/tiffztext/tab-separated-valueszapplication/x-ustarztext/x-vcardzaudio/x-wavz
video/webmzimage/x-xbitmapzapplication/vnd.ms-excelzapplication/excelztext/xmlzimage/x-xpixmapzimage/x-xwindowdumpzapplication/zip)�z.az.aiz.aifz.aifcz.aiffz.auz.aviz.batz.bcpioz.binz.bmpz.cz.cdfz.cdfz.cpioz.cshz.cssz.csvz.dllz.docz.dotz.dviz.emlz.epsz.etxz.exez.gifz.gtarz.hz.hdfz.htmz.htmlz.icoz.iefz.jpez.jpegz.jpgz.jsz.jsonz.kshz.latexz.m1vz.m3uz.m3u8z.manz.mez.mhtz.mhtmlz.mifz.mjsz.movz.moviez.mp2z.mp3z.mp4z.mpaz.mpez.mpegz.mpgz.msz.ncz.nwsz.oz.objz.odaz.p12z.p7cz.pbmz.pdfz.pfxz.pgmz.plz.pngz.pnmz.potz.ppaz.ppmz.ppsz.pptz.psz.pwzz.pyz.pycz.pyoz.qtz.raz.ramz.rasz.rdfz.rgbz.roffz.rtxz.sgmz.sgmlz.shz.sharz.sndz.soz.srcz.sv4cpioz.sv4crcz.svgz.swfz.tz.tarz.tclz.texz.texiz.texinfoz.tifz.tiffz.trz.tsvz.txtz.ustarz.vcfz.wavz.webmz.wizz.wsdlz.xbmz.xlbz.xlsz.xlsz.xmlz.xpdlz.xpmz.xslz.xwdz.zipz	image/jpgz
audio/midiz
image/pictzapplication/rtfztext/xul)z.jpgz.midz.midiz.pctz.picz.pictz.rtfz.xul)rrr
rrrrr�_default_mime_typesws(	rR�__main__a4Usage: mimetypes.py [options] type

Options:
    --help / -h       -- print this message and exit
    --lenient / -l    -- additionally search of some common, but non-standard
                         types.
    --extension / -e  -- guess extension instead of type

More than one type argument may be given.
rAcCs"tt�|rt|�tj|�dS)N)�print�USAGE�sys�exit)�code�msgrrr�usage;srZr4Zhle�helpZlenient�	extension�-h�--help�-l�	--lenient�-e�--extensionz I don't know anything about typeztype:z	encoding:)T)T)T)T)N)rA)r]r^)r_r`)rarb)%rIrVr&Zurllib.parser#�winregr>�ImportError�__all__rrrHrrrrrr	r
rRrEZgetoptrUrZ�argvZopts�args�errorrYrr\�opt�argZgtypeZguessrTr,rrrr�<module>sz
V




3









pipes.cpython-36.pyc000064400000017202150335715140010320 0ustar003


 \�"�@spdZddlZddlZddlZddlmZdgZdZdZdZ	dZ
d	Zd
Zeee	e
eegZ
Gdd�d�Zdd
�ZdS)a�Conversion pipeline templates.

The problem:
------------

Suppose you have some data that you want to convert to another format,
such as from GIF image format to PPM image format.  Maybe the
conversion involves several steps (e.g. piping it through compress or
uuencode).  Some of the conversion steps may require that their input
is a disk file, others may be able to read standard input; similar for
their output.  The input to the entire conversion may also be read
from a disk file or from an open file, and similar for its output.

The module lets you construct a pipeline template by sticking one or
more conversion steps together.  It will take care of creating and
removing temporary files if they are necessary to hold intermediate
data.  You can then use the template to do conversions from many
different sources to many different destinations.  The temporary
file names used are different each time the template is used.

The templates are objects so you can create templates for many
different conversion steps and store them in a dictionary, for
instance.


Directions:
-----------

To create a template:
    t = Template()

To add a conversion step to a template:
   t.append(command, kind)
where kind is a string of two characters: the first is '-' if the
command reads its standard input or 'f' if it requires a file; the
second likewise for the output. The command must be valid /bin/sh
syntax.  If input or output files are required, they are passed as
$IN and $OUT; otherwise, it must be  possible to use the command in
a pipeline.

To add a conversion step at the beginning:
   t.prepend(command, kind)

To convert a file to another file using a template:
  sts = t.copy(infile, outfile)
If infile or outfile are the empty string, standard input is read or
standard output is written, respectively.  The return value is the
exit status of the conversion pipeline.

To open a file for reading or writing through a conversion pipeline:
   fp = t.open(file, mode)
where mode is 'r' to read the file, or 'w' to write it -- just like
for the built-in function open() or for os.popen().

To create a new template object initialized to a given one:
   t2 = t.clone()
�N)�quote�TemplateZffz-fzf-z--z.-z-.c@speZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)rz'Class representing a pipeline template.cCsd|_|j�dS)z-Template() returns a fresh pipeline template.rN)�	debugging�reset)�self�r�/usr/lib64/python3.6/pipes.py�__init__UszTemplate.__init__cCsd|jfS)z t.__repr__() implements repr(t).z<Template instance, steps=%r>)�steps)rrrr�__repr__ZszTemplate.__repr__cCs
g|_dS)z<t.reset() restores a pipeline template to its initial state.N)r
)rrrrr^szTemplate.resetcCs"t�}|jdd�|_|j|_|S)zbt.clone() returns a new pipeline template with identical
        initial state as the current one.N)rr
r)r�trrr�clonebszTemplate.clonecCs
||_dS)z(t.debug(flag) turns debugging on or off.N)r)r�flagrrr�debugjszTemplate.debugcCs�t|�td�k	rtd��|tkr.td|f��|tkr>td��|jr^|jddtkr^td��|ddkr�tjd	|�r�td
��|ddkr�tjd|�r�td��|jj	||f�d
S)z/t.append(cmd, kind) adds a new step at the end.�z%Template.append: cmd must be a stringzTemplate.append: bad kind %rz-Template.append: SOURCE can only be prepended�z'Template.append: already ends with SINKr�fz\$IN\bz#Template.append: missing $IN in cmdz\$OUT\bz$Template.append: missing $OUT in cmdN���)
�type�	TypeError�	stepkinds�
ValueError�SOURCEr
�SINK�re�search�append)r�cmd�kindrrrrnszTemplate.appendcCs�t|�td�k	rtd��|tkr.td|f��|tkr>td��|jr^|jddtkr^td��|ddkr�tjd	|�r�td
��|ddkr�tjd|�r�td��|jj	d||f�d
S)z2t.prepend(cmd, kind) adds a new step at the front.rz&Template.prepend: cmd must be a stringzTemplate.prepend: bad kind %rz+Template.prepend: SINK can only be appendedrrz,Template.prepend: already begins with SOURCErz\$IN\bz$Template.prepend: missing $IN in cmdz\$OUT\bz%Template.prepend: missing $OUT in cmdN)
rrrrrr
rrr�insert)rrrrrr�prepend~szTemplate.prependcCs6|dkr|j|�S|dkr$|j|�Std|f��dS)z~t.open(file, rw) returns a pipe or file object open for
        reading or writing; the file is the other end of the pipeline.�r�wz,Template.open: rw must be 'r' or 'w', not %rN)�open_r�open_wr)r�fileZrwrrr�open�s

z
Template.opencCsB|jst|d�S|jddtkr*td��|j|d�}tj|d�S)zit.open_r(file) and t.open_w(file) implement
        t.open(file, 'r') and t.open(file, 'w') respectively.r!rz)Template.open_r: pipeline ends width SINKrr)r
r&rr�makepipeline�os�popen)rr%rrrrr#�s
zTemplate.open_rcCsB|jst|d�S|jddtkr*td��|jd|�}tj|d�S)Nr"rrz,Template.open_w: pipeline begins with SOURCEr)r
r&rrr'r(r))rr%rrrrr$�s
zTemplate.open_wcCstj|j||��S)N)r(�systemr')r�infile�outfilerrr�copy�sz
Template.copycCs(t||j|�}|jr$t|�d|}|S)Nzset -x; )r'r
r�print)rr+r,rrrrr'�s
zTemplate.makepipelineN)�__name__�
__module__�__qualname__�__doc__r	rrr
rrr r&r#r$r-r'rrrrrRs

cCs�g}x"|D]\}}|jd||dg�q
W|s>|jddddg�|ddd�\}}|ddkrx|rx|jdddddg�||dd<|ddd�\}}|ddkr�|r�|jddddg�||dd<g}x�tdt|��D]v}||dd}||d}	|ddk�s|	ddkr�tj�\}
}tj|
�|j|�|||dd<||d<q�Wx�|D]�}|\}
}}}|ddk�r�d	t|�d
|}|ddk�r�dt|
�d
|}|ddk�r�|
�r�|d
t|
�}|ddk�r�|�r�|dt|�}||d<�q\W|dd}xd|dd�D]T}|dd�\}}|ddk�rfd|k�rXd|d}|d|}n|d|}�q W|�r�d}x|D]}|dt|�}�q�Wdt|d�d}|d|d|}|S)Nr�catz--rr�r�zOUT=z; zIN=�-z <z >z{ z; }z |
�
zrm -f� ztrap z; exitz 1 2 3 13 14 15rrrr)	rr�range�len�tempfileZmkstempr(�closer)r+r
r,�listrrZgarbage�iZlkindZrkind�fdZtemp�item�infZoutfZcmdlistZrmcmdr%Ztrapcmdrrrr'�s`

 


r')r2rr(r;Zshlexr�__all__ZFILEIN_FILEOUTZ
STDIN_FILEOUTZ
FILEIN_STDOUTZSTDIN_STDOUTrrrrr'rrrr�<module>9scpickle.cpython-36.opt-1.pyc000064400000123120150335715140011403 0ustar003


 \���@sdZddlmZddlmZddlmZmZmZddlm	Z	ddl
mZddlZddlm
Z
dd	lmZmZddlZddlZddlZddlZd
ddd
dddddg	ZeefZdZdddddddgZdZdZGdd
�d
e�ZGdd�de�ZGdd�de�Z Gdd �d e�Z!ydd!l"m#Z#Wne$k
�r2dZ#YnXd"Z%d#Z&d$Z'd%Z(d&Z)d'Z*d(Z+d)Z,d*Z-d+Z.d,Z/d-Z0d.Z1d/Z2d0Z3d1Z4d2Z5d3Z6d4Z7d5Z8d6Z9d7Z:d8Z;d9Z<d:Z=d;Z>d<Z?d=Z@d>ZAd?ZBd@ZCdAZDdBZEdCZFdDZGdEZHdFZIdGZJdHZKdIZLdJZMdKZNdLZOdMZPdNZQdOZRdPZSdQZTdRZUdSZVdTZWdUZXdVZYdWZZdXZ[eKeUeVeWgZ\dYZ]dZZ^d[Z_d\Z`d]Zad^Zbd_Zcd`ZddaZedbZfdcZgddZhejidedf�ej�D��Gdgdh�dh�ZkGdidj�dj�Zldkdl�Zmdmdn�Zndodp�Zodqdr�ZpGdsdt�dt�ZqGdudv�dv�Zrd�dwdx�dydz�Zsd�dwdx�d{d|�Ztdwd}d~d�d�d��Zudwd}d~d�d�d��Zvy0dd�lwmZmZm Z mxZxmyZymzZzm{Z{m|Z|m}Z}Wn4e$k
�rbeqerZxZyeseteuevf\ZzZ{Z|Z}YnXd�d��Z~ed�k�rddl�Z�e�j�d�d��Z�e�j�d�e�j�d��d�d�d��e�j�d�d�d�d�d��e�j�d�d�d�d��e�j��Z�e�j��r�e~�n>e�j��s�e�j��n,ddl�Z�x"e�j�D]Z�e|e��Z�e�j�e���q�WdS)�a�Create portable serialized representations of Python objects.

See module copyreg for a mechanism for registering custom picklers.
See module pickletools source for extensive comments.

Classes:

    Pickler
    Unpickler

Functions:

    dump(object, file)
    dumps(object) -> string
    load(file) -> object
    loads(string) -> object

Misc variables:

    __version__
    format_version
    compatible_formats

�)�FunctionType)�dispatch_table)�_extension_registry�_inverted_registry�_extension_cache)�islice)�partialN)�maxsize)�pack�unpack�PickleError�
PicklingError�UnpicklingError�Pickler�	Unpickler�dump�dumps�load�loadsz4.0z1.0z1.1z1.2z1.3z2.0z3.0��c@seZdZdZdS)rz6A common base class for the other pickling exceptions.N)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.6/pickle.pyr@sc@seZdZdZdS)r
z]This exception is raised when an unpicklable object is passed to the
    dump() method.

    N)rrrrrrrrr
Dsc@seZdZdZdS)raThis exception is raised when there is a problem unpickling an object,
    such as a security violation.

    Note that other exceptions may also be raised during unpickling, including
    (but not necessarily limited to) AttributeError, EOFError, ImportError,
    and IndexError.

    N)rrrrrrrrrKsc@seZdZdd�ZdS)�_StopcCs
||_dS)N)�value)�selfrrrr�__init__Ysz_Stop.__init__N)rrrr rrrrrXsr)�PyStringMap�(�.�0�1�2�F�I�J�K�L�M�N�P�Q�R�S�T�U�V�X�a�b�c�d�}�e�g�h�i�j�l�]�o�p�q�r�s�t�)�u�GsI01
sI00
�������������������������B�C��������������������cCsg|]}tjd|�r|�qS)z[A-Z][A-Z0-9_]+$)�re�match)�.0�xrrr�
<listcomp>�srgc@s:eZdZdZdd�Zdd�Zdd�Zdd
d�Zdd
�ZdS)�_Framer�@icCs||_d|_dS)N)�
file_write�
current_frame)rrjrrrr �sz_Framer.__init__cCstj�|_dS)N)�io�BytesIOrk)rrrr�
start_framing�sz_Framer.start_framingcCs*|jr&|jj�dkr&|jdd�d|_dS)NrT)�force)rk�tell�commit_frame)rrrr�end_framing�sz_Framer.end_framingFcCst|jrp|j}|j�|jks|rp|j��2}t|�}|j}|t�|td|��||�WdQRX|jd�|j	�dS)Nz<Qr)
rkrp�_FRAME_SIZE_TARGET�	getbuffer�lenrj�FRAMEr
�seek�truncate)rro�f�data�n�writerrrrq�s

z_Framer.commit_framecCs |jr|jj|�S|j|�SdS)N)rkr|rj)rrzrrrr|�sz
_Framer.writeNi)F)	rrrrsr rnrrrqr|rrrrrh�s

rhc@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)�	_UnframerNcCs||_||_d|_dS)N)�	file_read�
file_readlinerk)rr~rZ	file_tellrrrr �sz_Unframer.__init__cCsV|jrH|jj|�}|r0|dkr0d|_|j|�St|�|krDtd��|S|j|�SdS)Nrz$pickle exhausted before end of frame)rk�readr~rur)rr{rzrrrr��s
z_Unframer.readcCsF|jr:|jj�}|s"d|_|j�S|ddkr6td��|S|j�SdS)N��
rz$pickle exhausted before end of frame����
)rk�readlinerr)rrzrrrr��s
z_Unframer.readlinecCs2|jr|jj�dkrtd��tj|j|��|_dS)N�z4beginning of a new frame before end of current frame)rkr�rrlrmr~)r�
frame_sizerrr�
load_frame�sz_Unframer.load_frame)N)rrrr r�r�r�rrrrr}�s


r}cCslxb|jd�D]T}|dkr(tdj||���y|}t||�}Wqtk
r^tdj||���YqXqW||fS)N�.z<locals>z&Can't get local attribute {!r} on {!r}z Can't get attribute {!r} on {!r})�split�AttributeError�format�getattr)�obj�nameZsubpath�parentrrr�
_getattributes
r�cCszt|dd�}|dk	r|Sx\ttjj��D]J\}}|dks(|dkrBq(yt||�d|krZ|SWq(tk
rpYq(Xq(WdS)z$Find the module an object belong to.rN�__main__r)r��list�sys�modules�itemsr�r�)r�r��module_name�modulerrr�whichmodules
r�cCsh|dkrdS|j�d?d}|j|ddd�}|dkrd|dkrd|ddkrd|d
d
@dkrd|dd�}|S)a�Encode a long to a two's complement little-endian binary string.
    Note that 0 is a special case, returning an empty string, to save a
    byte in the LONG1 pickling context.

    >>> encode_long(0)
    b''
    >>> encode_long(255)
    b'\xff\x00'
    >>> encode_long(32767)
    b'\xff\x7f'
    >>> encode_long(-256)
    b'\x00\xff'
    >>> encode_long(-32768)
    b'\x00\x80'
    >>> encode_long(-128)
    b'\x80'
    >>> encode_long(127)
    b'\x7f'
    >>>
    rr�rr��littleT)�	byteorder�signed���Nr����r�)�
bit_length�to_bytes)rf�nbytes�resultrrr�encode_long$sr�cCstj|ddd�S)a\Decode a long from a two's complement little-endian binary string.

    >>> decode_long(b'')
    0
    >>> decode_long(b"\xff\x00")
    255
    >>> decode_long(b"\xff\x7f")
    32767
    >>> decode_long(b"\x00\xff")
    -256
    >>> decode_long(b"\x00\x80")
    -32768
    >>> decode_long(b"\x80")
    -128
    >>> decode_long(b"\x7f")
    127
    r�T)r�r�)�int�
from_bytes)rzrrr�decode_longBsr�c@sheZdZd7dd�dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Zd8dd�Z	dd�Z
dd�Zd9dd�ZiZ
dd�Zee
ed�<dd�Zee
e<dd�Zee
e<dd�Zee
e<d d!�Zee
e<d"d#�Zee
e<d$d%�Zee
e<d&d'�Zee
e<d(Zd)d*�Zd+d,�Z e e
e!<e"dk	�re e
e"<d-d.�Z#d/d0�Z$e$e
e%<d1d2�Z&e&e
e'<d:d3d4�Z(d5d6�Z)e(e
e*<e)e
e<dS);�_PicklerNT)�fix_importscCs�|dkrt}|dkrt}n$d|ko,tkns>tdt��y|j|_Wntk
rftd��YnXt|j�|_|jj|_i|_	t
|�|_|dk|_d|_
|o�|dk|_dS)a�This takes a binary file for writing a pickle data stream.

        The optional *protocol* argument tells the pickler to use the
        given protocol; supported protocols are 0, 1, 2, 3 and 4.  The
        default protocol is 3; a backward-incompatible protocol designed
        for Python 3.

        Specifying a negative protocol version selects the highest
        protocol version supported.  The higher the protocol used, the
        more recent the version of Python needed to read the pickle
        produced.

        The *file* argument must have a write() method that accepts a
        single bytes argument. It can thus be a file object opened for
        binary writing, an io.BytesIO instance, or any other custom
        object that meets this interface.

        If *fix_imports* is True and *protocol* is less than 3, pickle
        will try to map the new Python 3 names to the old module names
        used in Python 2, so that the pickle data stream is readable
        with Python 2.
        Nrzpickle protocol must be <= %dz"file must have a 'write' attributer�r)�DEFAULT_PROTOCOL�HIGHEST_PROTOCOL�
ValueErrorr|�_file_writer��	TypeErrorrh�framer�memor��proto�bin�fastr�)r�file�protocolr�rrrr [s"


z_Pickler.__init__cCs|jj�dS)aClears the pickler's "memo".

        The memo is the data structure that remembers which objects the
        pickler has already seen, so that shared or recursive objects
        are pickled by reference and not by value.  This method is
        useful when re-using picklers.
        N)r��clear)rrrr�
clear_memo�sz_Pickler.clear_memocCsrt|d�std|jjf��|jdkr<|jttd|j��|jdkrP|jj	�|j
|�|jt�|jj�dS)z7Write a pickled representation of obj to the open file.r�z2Pickler.__init__() was not called by %s.__init__()r�z<BrN)
�hasattrr
�	__class__rr�r|�PROTOr
r�rn�save�STOPrr)rr�rrrr�s





z
_Pickler.dumpcCs:|jr
dSt|j�}|j|j|��||f|jt|�<dS)zStore an object in the memo.N)r�rur�r|�put�id)rr��idxrrr�memoize�s

z_Pickler.memoizecCsT|jdkrtS|jr:|dkr*ttd|�Sttd|�Sntt|�jd�dSdS)Nr�z<Bz<I�asciir�)	r��MEMOIZEr��BINPUTr
�LONG_BINPUT�PUT�repr�encode)rr�rrrr��s
z_Pickler.putcCs@|jr*|dkrttd|�Sttd|�Stt|�jd�dS)Nr�z<Bz<Ir�r�)r��BINGETr
�LONG_BINGET�GETr�r�)r�irrr�get�s
z_Pickler.getcCs�|jj�|j|�}|dk	r.|r.|j|�dS|jjt|��}|dk	r^|j|j|d��dSt|�}|j	j|�}|dk	r�|||�dSt
|dt�j|�}|dk	r�||�}n�yt|t�}	Wnt
k
r�d}	YnX|	r�|j|�dSt
|dd�}|dk	�r||j�}n0t
|dd�}|dk	�r&|�}ntd|j|f��t|t��rT|j||�dSt|t��sltd|��t|�}
d|
k�o�d	kn�s�td
|��|j|d|i�dS)NrrF�
__reduce_ex__�
__reduce__zCan't pickle %r object: %rz%s must return string or tupler��z3Tuple returned by %s must have two to five elementsr�)r�rq�
persistent_id�	save_persr�r�r�r|�type�dispatchr�r�
issubclassr��save_globalr�r
r�
isinstance�str�tupleru�save_reduce)rr��save_persistent_id�pidrf�try�reduce�rvZissc�lrrrr��sT








z
_Pickler.savecCsdS)Nr)rr�rrrr�sz_Pickler.persistent_idcCsb|jr |j|dd�|jt�n>y |jtt|�jd�d�Wntk
r\td��YnXdS)NF)r�r�r�z2persistent IDs in protocol 0 must be ASCII strings)	r�r�r|�	BINPERSID�PERSIDr�r��UnicodeEncodeErrorr
)rr�rrrr�s z_Pickler.save_perscCst|t�std��t|�s"td��|j}|j}t|dd�}	|jdkr�|	dkr�|\}
}}t|
d�sntdj	|	���|dk	r�|
|j
k	r�td	j	|	���|jd
kr�||
�||�||�|t�n,t|
j
|
f|�|�}||�|f�|t�n�|jdko�|	dk�r\|d}
t|
d��std
��|dk	�r6|
|j
k	�r6td��|dd�}||
�||�|t�n||�||�|t�|dk	�r�t|�|jk�r�|t|j|jt|�d��n
|j|�|dk	�r�|j|�|dk	�r�|j|�|dk	�r�||�|t�dS)Nz'args from save_reduce() must be a tuplez(func from save_reduce() must be callabler�r��
__newobj_ex__�__new__z#args[0] from {} args has no __new__z(args[0] from {} args has the wrong classr�
__newobj__rz+args[0] from __newobj__ args has no __new__z0args[0] from __newobj__ args has the wrong classr�)r�r�r
�callabler�r|r�r�r�r�r��	NEWOBJ_EXrr��REDUCE�NEWOBJr�r��POPr�r��_batch_appends�_batch_setitems�BUILD)r�func�args�stateZ	listitemsZ	dictitemsr�r�r|Z	func_name�cls�kwargsrrrr�sd







"





z_Pickler.save_reducecCs|jt�dS)N)r|�NONE)rr�rrr�	save_none�sz_Pickler.save_nonecCs4|jdkr|j|rtnt�n|j|r*tnt�dS)Nr�)r�r|�NEWTRUE�NEWFALSE�TRUE�FALSE)rr�rrr�	save_bool�s
z_Pickler.save_boolcCs�|jr~|dkrN|dkr.|jttd|��dS|dkrN|jttd|��dSd
|ko`dknr~|jttd|��dS|jd	kr�t|�}t|�}|d
kr�|jt	td|�|�n|jt
td|�|�dS|jtt|�j
d�d�dS)Nrr�z<Bi��z<Hli���z<ir�r�r�sL
i�)r�r|�BININT1r
�BININT2�BININTr�r�ru�LONG1�LONG4�LONGr�r�)rr��encodedr{rrr�	save_long�s&
z_Pickler.save_longcCs<|jr|jttd|��n|jtt|�jd�d�dS)Nz>dr�r�)r�r|�BINFLOATr
�FLOATr�r�)rr�rrr�
save_float�sz_Pickler.save_floatcCs�|jdkr@|s |jtf|d�n|jtjt|d�df|d�dSt|�}|dkrj|jtt	d|�|�nD|dkr�|jdkr�|jt
t	d|�|�n|jtt	d	|�|�|j|�dS)
Nr)r��latin1r�z<Bl��rz<Qz<I)
r�r��bytes�codecsr�r�rur|�SHORT_BINBYTESr
�	BINBYTES8�BINBYTESr�)rr�r{rrr�
save_bytes�s
z_Pickler.save_bytescCs�|jr�|jdd�}t|�}|dkrF|jdkrF|jttd|�|�q�|dkrr|jdkrr|jttd|�|�q�|jttd|�|�n0|j	d	d
�}|j	dd�}|jt
|jd
�d�|j|�dS)Nzutf-8�
surrogatepassr�rz<Bl��z<Qz<I�\z\u005c�
z\u000azraw-unicode-escaper�)r�r�rur�r|�SHORT_BINUNICODEr
�BINUNICODE8�
BINUNICODE�replace�UNICODEr�)rr�rr{rrr�save_str�sz_Pickler.save_strcCsB|s(|jr|jt�n|jtt�dSt|�}|j}|j}|dkr�|jdkr�x|D]}||�qTWt	|�|kr�|j
|t	|�d�}|jt||�n|jt|�|j
|�dS|j}|t�x|D]}||�q�Wt	|�|k�r,|j
|t	|�d�}|j�r|t|�n|t|d|�dS|t�|j
|�dS)Nrr�rr�)r�r|�EMPTY_TUPLE�MARK�TUPLErur�r�r�r�r�r��_tuplesize2coder��POP_MARK)rr�r{r�r��elementr�r|rrr�
save_tuple�s:


z_Pickler.save_tuplecCs8|jr|jt�n|jtt�|j|�|j|�dS)N)r�r|�
EMPTY_LISTr�LISTr�r�)rr�rrr�	save_lists

z_Pickler.save_listi�cCs�|j}|j}|js4x|D]}||�|t�qWdSt|�}xrtt||j��}t|�}|dkr�|t	�x|D]}||�qlW|t
�n|r�||d�|t�||jkr>dSq>WdS)Nr�r)r�r|r��APPEND�iterr�r�
_BATCHSIZErur�APPENDS)rr�r�r|rf�it�tmpr{rrrr�s*



z_Pickler._batch_appendscCs<|jr|jt�n|jtt�|j|�|j|j��dS)N)r�r|�
EMPTY_DICTr�DICTr�r�r�)rr�rrr�	save_dict.s

z_Pickler.save_dictc	Cs�|j}|j}|js@x(|D] \}}||�||�|t�qWdSt|�}x�tt||j��}t|�}|dkr�|t	�x |D]\}}||�||�qxW|t
�n(|r�|d\}}||�||�|t�||jkrJdSqJWdS)Nr�r)r�r|r��SETITEMr#r�rr$rur�SETITEMS)	rr�r�r|�k�vr&r'r{rrrr�;s2

z_Pickler._batch_setitemscCs�|j}|j}|jdkr0|jtt|�f|d�dS|t�|j|�t|�}xXtt	||j
��}t|�}|dkr�|t�x|D]}||�qzW|t
�||j
krLdSqLWdS)Nr)r�r)r�r|r�r��setr��	EMPTY_SETr�r#rr$rur�ADDITEMS)rr�r�r|r&Zbatchr{�itemrrr�save_setZs$



z_Pickler.save_setcCs�|j}|j}|jdkr0|jtt|�f|d�dS|t�x|D]}||�q>Wt|�|jkr�|t	|j
|jt|�d��dS|t�|j|�dS)Nr)r�r)
r�r|r�r��	frozensetr�rr�r�rr��	FROZENSETr�)rr�r�r|r2rrr�save_frozensetrs

 z_Pickler.save_frozensetc
CsT|j}|j}|dkr t|dd�}|dkr.|j}t||�}y(t|dd�tj|}t||�\}}Wn,t	t
tfk
r�td|||f��YnX||k	r�td|||f��|j
dk�rtj||f�}	|	�r|	dkr�|ttd|	��n0|	d	k�r|ttd
|	��n|ttd|	��dS|jd�d}
||k�r4|
}|j
d
k�r^|j|�|j|�|t�n�||k	�rz|jt||
f�n�|j
dk�r�|tt|d�dt|d�d�n�|j�r�tj}tj}||f|k�r�|||f\}}n||k�r�||}y(|tt|d�dt|d�d�Wn*tk
�rDtd|||j
f��YnX|j|�dS)Nrr)�levelz(Can't pickle %r: it's not found as %s.%sz2Can't pickle %r: it's not the same object as %s.%sr�r�z<Bi��z<Hz<ir�rrzutf-8r�r�z?can't pickle global identifier '%s.%s' using pickle protocol %i) r|r�r�rr��
__import__r�r�r��ImportError�KeyErrorr�r
r�rr��EXT1r
�EXT2�EXT4�
rpartitionr��STACK_GLOBALr��GLOBALr	r��_compat_pickleZREVERSE_NAME_MAPPINGZREVERSE_IMPORT_MAPPINGr�r�)
rr�r�r|r�r�r�Zobj2r��codeZlastnameZr_name_mappingZr_import_mappingrrrr��sn







$
&z_Pickler.save_globalcCs`|td�kr|jtd|d�S|tt�kr:|jttf|d�S|td�krV|jtd|d�S|j|�S)N)r�.)N).)r�r��NotImplementedr�)rr�rrr�	save_type�sz_Pickler.save_type)N)T)NNNN)N)+rrrr r�rr�r�r�r�r�r�r�r�r�r�r��boolrr�r�floatrr	rr�rr�r!r�r$r�r*�dictr!r�r3r/r6r4r�rDrrrrrr�YsV)
	
B
c1		

B	r�c@sneZdZdddd�dd�Zdd�Zd	d
�Zdd�ZiZd
d�Zeee	d<dd�Z
e
eed<dd�Zeee
d<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�Zeeed<d d!�Zeeed<d"d#�Zeeed<d$d%�Zeeed<d&d'�Z e ee!d<d(d)�Z"e"ee#d<d*d+�Z$e$ee%d<d,d-�Z&e&ee'd<d.d/�Z(d0d1�Z)e)ee*d<d2d3�Z+e+ee,d<d4d5�Z-e-ee.d<d6d7�Z/e/ee0d<d8d9�Z1e1ee2d<d:d;�Z3e3ee4d<d<d=�Z5e5ee6d<d>d?�Z7e7ee8d<d@dA�Z9e9ee:d<dBdC�Z;e;ee<d<dDdE�Z=e=ee>d<dFdG�Z?e?ee@d<dHdI�ZAeAeeBd<dJdK�ZCeCeeDd<dLdM�ZEeEeeFd<dNdO�ZGeGeeHd<dPdQ�ZIeIeeJd<dRdS�ZKeKeeLd<dTdU�ZMeMeeNd<dVdW�ZOeOeePd<dXdY�ZQeQeeRd<dZd[�ZSd\d]�ZTeTeeUd<d^d_�ZVeVeeWd<d`da�ZXeXeeYd<dbdc�ZZeZee[d<ddde�Z\e\ee]d<dfdg�Z^e^ee_d<dhdi�Z`e`eead<djdk�Zbebeecd<dldm�Zdedeeed<dndo�Zfdpdq�Zgdrds�Zheheeid<dtdu�Zjejeekd<dvdw�Zleleemd<dxdy�Zneneeod<dzd{�Zpepeeqd<d|d}�Zrereesd<d~d�Zteteeud<d�d��Zveveewd<d�d��Zxexeeyd<d�d��Zzezee{d<d�d��Z|e|ee}d<d�d��Z~e~eed<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�S)��
_UnpicklerT�ASCII�strict)r��encoding�errorscCs2|j|_|j|_i|_||_||_d|_||_dS)a�This takes a binary file for reading a pickle data stream.

        The protocol version of the pickle is detected automatically, so
        no proto argument is needed.

        The argument *file* must have two methods, a read() method that
        takes an integer argument, and a readline() method that requires
        no arguments.  Both methods should return bytes.  Thus *file*
        can be a binary file object opened for reading, an io.BytesIO
        object, or any other custom object that meets this interface.

        The file-like object must have two methods, a read() method
        that takes an integer argument, and a readline() method that
        requires no arguments.  Both methods should return bytes.
        Thus file-like object can be a binary file object opened for
        reading, a BytesIO object, or any other custom object that
        meets this interface.

        Optional keyword arguments are *fix_imports*, *encoding* and
        *errors*, which are used to control compatibility support for
        pickle stream generated by Python 2.  If *fix_imports* is True,
        pickle will try to map the old Python 2 names to the new names
        used in Python 3.  The *encoding* and *errors* tell pickle how
        to decode 8-bit string instances pickled by Python 2; these
        default to 'ASCII' and 'strict', respectively. *encoding* can be
        'bytes' to read theses 8-bit string instances as bytes objects.
        rN)	r��_file_readliner��
_file_readr�rKrLr�r�)rr�r�rKrLrrrr �sz_Unpickler.__init__cCs�t|d�std|jjf��t|j|j�|_|jj|_|jj	|_	g|_
g|_|jj|_d|_
|j}|j}y*x$|d�}|s|t�||d|�qlWWn"tk
r�}z|jSd}~XnXdS)z�Read a pickled object representation from the open file.

        Return the reconstituted object hierarchy specified in the file.
        rNz4Unpickler.__init__() was not called by %s.__init__()rr�N)r�rr�rr}rNrM�	_unframerr�r��	metastack�stack�appendr�r��EOFErrorrr)rr�r��keyZstopinstrrrrs(



z_Unpickler.loadcCs |j}|jj�|_|jj|_|S)N)rQrP�poprR)rr�rrr�pop_marks
z_Unpickler.pop_markcCstd��dS)Nz%unsupported persistent id encountered)r)rr�rrr�persistent_load%sz_Unpickler.persistent_loadcCs<|jd�d}d|ko tkns2td|��||_dS)Nr�rzunsupported pickle protocol: %d)r�r�r�r�)rr�rrr�
load_proto*sz_Unpickler.load_protorcCs8td|jd��\}|tjkr(td|��|jj|�dS)Nz<Q�zframe size > sys.maxsize: %d)rr�r�r	r�rOr�)rr�rrrr�1s
z_Unpickler.load_framecCsLy|j�dd�jd�}Wntk
r6td��YnX|j|j|��dS)Nr�r�z2persistent IDs in protocol 0 must be ASCII stringsr�)r��decode�UnicodeDecodeErrorrrRrW)rr�rrr�load_persid8sz_Unpickler.load_persidcCs|jj�}|j|j|��dS)N)rQrUrRrW)rr�rrr�load_binpersidAs
z_Unpickler.load_binpersidcCs|jd�dS)N)rR)rrrr�	load_noneFsz_Unpickler.load_nonecCs|jd�dS)NF)rR)rrrr�
load_falseJsz_Unpickler.load_falsecCs|jd�dS)NT)rR)rrrr�	load_trueNsz_Unpickler.load_truecCsL|j�}|tdd�krd}n |tdd�kr4d}n
t|d�}|j|�dS)Nr�FTr)r�r�r�r�rR)rrz�valrrr�load_intRs
z_Unpickler.load_intcCs|jtd|jd��d�dS)Nz<irr)rRrr�)rrrr�load_binint]sz_Unpickler.load_binintcCs|j|jd�d�dS)Nr�r)rRr�)rrrr�load_binint1asz_Unpickler.load_binint1cCs|jtd|jd��d�dS)Nz<Hr�r)rRrr�)rrrr�load_binint2esz_Unpickler.load_binint2cCs@|j�dd�}|r,|ddkr,|dd�}|jt|d��dS)Nr�r+rr�r��Lr�)r�rRr�)rrarrr�	load_longisz_Unpickler.load_longcCs*|jd�d}|j|�}|jt|��dS)Nr�r)r�rRr�)rr{rzrrr�
load_long1ps
z_Unpickler.load_long1cCs>td|jd��\}|dkr"td��|j|�}|jt|��dS)Nz<irrz#LONG pickle has negative byte count)rr�rrRr�)rr{rzrrr�
load_long4vs

z_Unpickler.load_long4cCs|jt|j�dd���dS)Nr�r�)rRrFr�)rrrr�
load_floatsz_Unpickler.load_floatcCs|jtd|jd��d�dS)Nz>drYr)rRrr�)rrrr�
load_binfloat�sz_Unpickler.load_binfloatcCs"|jdkr|S|j|j|j�SdS)Nr	)rKrZrL)rrrrr�_decode_string�s
z_Unpickler._decode_stringcCsl|j�dd�}t|�dkrF|d|dkrF|ddkrF|dd�}ntd��|j|jtj|�d��dS)	Nr�r�rs"'z)the STRING opcode argument must be quotedr�r�r�)r�rurrRrlr
�
escape_decode)rrzrrr�load_string�s
(z_Unpickler.load_stringcCs@td|jd��\}|dkr"td��|j|�}|j|j|��dS)Nz<irrz(BINSTRING pickle has negative byte count)rr�rrRrl)rrurzrrr�load_binstring�s

z_Unpickler.load_binstringcCs:td|jd��\}|tkr&tdt��|j|j|��dS)Nz<Irz2BINBYTES exceeds system's maximum size of %d bytes)rr�r	rrR)rrurrr�
load_binbytes�s
z_Unpickler.load_binbytescCs |jt|j�dd�d��dS)Nr�zraw-unicode-escaper�)rRr�r�)rrrr�load_unicode�sz_Unpickler.load_unicodecCsBtd|jd��\}|tkr&tdt��|jt|j|�dd��dS)Nz<Irz4BINUNICODE exceeds system's maximum size of %d byteszutf-8r)rr�r	rrRr�)rrurrr�load_binunicode�s
z_Unpickler.load_binunicodecCsBtd|jd��\}|tkr&tdt��|jt|j|�dd��dS)Nz<QrYz5BINUNICODE8 exceeds system's maximum size of %d byteszutf-8r)rr�r	rrRr�)rrurrr�load_binunicode8�s
z_Unpickler.load_binunicode8cCs:td|jd��\}|tkr&tdt��|j|j|��dS)Nz<QrYz3BINBYTES8 exceeds system's maximum size of %d bytes)rr�r	rrR)rrurrr�load_binbytes8�s
z_Unpickler.load_binbytes8cCs,|jd�d}|j|�}|j|j|��dS)Nr�r)r�rRrl)rrurzrrr�load_short_binstring�s
z_Unpickler.load_short_binstringcCs"|jd�d}|j|j|��dS)Nr�r)r�rR)rrurrr�load_short_binbytes�sz_Unpickler.load_short_binbytescCs*|jd�d}|jt|j|�dd��dS)Nr�rzutf-8r)r�rRr�)rrurrr�load_short_binunicode�sz _Unpickler.load_short_binunicodecCs|j�}|jt|��dS)N)rVrRr�)rr�rrr�
load_tuple�sz_Unpickler.load_tuplecCs|jf�dS)N)rR)rrrr�load_empty_tuple�sz_Unpickler.load_empty_tuplecCs|jdf|jd<dS)Nr�r�r�)rQ)rrrr�load_tuple1�sz_Unpickler.load_tuple1cCs$|jd|jdfg|jdd�<dS)Nr�r�r�r�r�)rQ)rrrr�load_tuple2�sz_Unpickler.load_tuple2cCs,|jd|jd|jdfg|jdd�<dS)Nrr�r����r�r�r|)rQ)rrrr�load_tuple3�sz_Unpickler.load_tuple3cCs|jg�dS)N)rR)rrrr�load_empty_list�sz_Unpickler.load_empty_listcCs|ji�dS)N)rR)rrrr�load_empty_dictionary�sz _Unpickler.load_empty_dictionarycCs|jt��dS)N)rRr/)rrrr�load_empty_set�sz_Unpickler.load_empty_setcCs|j�}|jt|��dS)N)rVrRr4)rr�rrr�load_frozenset�sz_Unpickler.load_frozensetcCs|j�}|j|�dS)N)rVrR)rr�rrr�	load_list�sz_Unpickler.load_listcs4|j���fdd�tdt��d�D�}|j|�dS)Ncsi|]}�|d�|�qS)r�r)rer�)r�rr�
<dictcomp>sz(_Unpickler.load_dict.<locals>.<dictcomp>rr�)rV�rangerurR)r�dr)r�r�	load_dicts
z_Unpickler.load_dictcCs�|st|t�st|d�rly||�}Wqvtk
rh}z&td|jt|�ftj�d��WYdd}~XqvXn
|j|�}|j	|�dS)NZ__getinitargs__zin constructor for %s: %sr�)
r�r�r�r�rr�r��exc_infor�rR)r�klassr�r�errrrr�_instantiates
0
z_Unpickler._instantiatecCsL|j�dd�jd�}|j�dd�jd�}|j||�}|j||j��dS)Nr�r�r�r�)r�rZ�
find_classr�rV)rr�r�r�rrr�	load_instsz_Unpickler.load_instcCs"|j�}|jd�}|j||�dS)Nr)rVrUr�)rr�r�rrr�load_obj!s
z_Unpickler.load_objcCs2|jj�}|jj�}|j|f|��}|j|�dS)N)rQrUr�rR)rr�r�r�rrr�load_newobj(s

z_Unpickler.load_newobjcCs>|jj�}|jj�}|jj�}|j|f|�|�}|j|�dS)N)rQrUr�rR)rr�r�r�r�rrr�load_newobj_ex/s



z_Unpickler.load_newobj_excCsF|j�dd�jd�}|j�dd�jd�}|j||�}|j|�dS)Nr�zutf-8r�r�)r�rZr�rR)rr�r�r�rrr�load_global7sz_Unpickler.load_globalcCsJ|jj�}|jj�}t|�tk	s,t|�tk	r4td��|j|j||��dS)NzSTACK_GLOBAL requires str)rQrUr�r�rrRr�)rr�r�rrr�load_stack_global>s


z_Unpickler.load_stack_globalcCs|jd�d}|j|�dS)Nr�r)r��
get_extension)rrBrrr�	load_ext1Fsz_Unpickler.load_ext1cCs td|jd��\}|j|�dS)Nz<Hr�)rr�r�)rrBrrr�	load_ext2Ksz_Unpickler.load_ext2cCs td|jd��\}|j|�dS)Nz<ir)rr�r�)rrBrrr�	load_ext4Psz_Unpickler.load_ext4cCspg}tj||�}||k	r&|j|�dStj|�}|sP|dkrDtd��td|��|j|�}|t|<|j|�dS)NrzEXT specifies code <= 0zunregistered extension code %d)rr�rRrrr�r�)rrBZnilr�rTrrrr�Us


z_Unpickler.get_extensioncCs�|jdkrF|jrF||ftjkr2tj||f\}}n|tjkrFtj|}t|dd�|jdkrpttj||�dSt	tj||�SdS)Nrr)r7r)
r�r�rAZNAME_MAPPINGZIMPORT_MAPPINGr8r�r�r�r�)rr�r�rrrr�es


z_Unpickler.find_classcCs&|j}|j�}|d}||�|d<dS)Nr�r�r�)rQrU)rrQr�r�rrr�load_reducersz_Unpickler.load_reducecCs|jr|jd=n|j�dS)Nr�r�)rQrV)rrrr�load_popys
z_Unpickler.load_popcCs|j�dS)N)rV)rrrr�
load_pop_mark�sz_Unpickler.load_pop_markcCs|j|jd�dS)Nr�r�)rRrQ)rrrr�load_dup�sz_Unpickler.load_dupcCs(t|j�dd��}|j|j|�dS)Nr�r�)r�r�rRr�)rr�rrr�load_get�sz_Unpickler.load_getcCs"|jd�d}|j|j|�dS)Nr�r)r�rRr�)rr�rrr�load_binget�sz_Unpickler.load_bingetcCs&td|jd��\}|j|j|�dS)Nz<Ir)rr�rRr�)rr�rrr�load_long_binget�sz_Unpickler.load_long_bingetcCs8t|j�dd��}|dkr$td��|jd|j|<dS)Nr�rznegative PUT argumentr�r�)r�r�r�rQr�)rr�rrr�load_put�sz_Unpickler.load_putcCs2|jd�d}|dkrtd��|jd|j|<dS)Nr�rznegative BINPUT argumentr�)r�r�rQr�)rr�rrr�load_binput�sz_Unpickler.load_binputcCs6td|jd��\}|tkr"td��|jd|j|<dS)Nz<Irznegative LONG_BINPUT argumentr�r�)rr�r	r�rQr�)rr�rrr�load_long_binput�sz_Unpickler.load_long_binputcCs|j}|jd|t|�<dS)Nr�r�)r�rQru)rr�rrr�load_memoize�sz_Unpickler.load_memoizecCs$|j}|j�}|d}|j|�dS)Nr�r�)rQrUrR)rrQrr�rrr�load_append�sz_Unpickler.load_appendcCsH|j�}|jd}t|t�r(|j|�n|j}x|D]}||�q4WdS)Nr�r�)rVrQr�r��extendrR)rr�Zlist_objrRr2rrr�load_appends�s


z_Unpickler.load_appendscCs*|j}|j�}|j�}|d}|||<dS)Nr�r�)rQrU)rrQrrTrGrrr�load_setitem�s
z_Unpickler.load_setitemcCsD|j�}|jd}x,tdt|�d�D]}||d|||<q$WdS)Nr�rr�r�)rVrQr�ru)rr�rGr�rrr�
load_setitems�s
z_Unpickler.load_setitemscCsH|j�}|jd}t|t�r(|j|�n|j}x|D]}||�q4WdS)Nr�r�)rVrQr�r/�update�add)rr�Zset_objr�r2rrr�
load_additems�s


z_Unpickler.load_additemsc
Cs�|j}|j�}|d}t|dd�}|dk	r6||�dSd}t|t�rXt|�dkrX|\}}|r�|j}tj}x6|j	�D]*\}}	t
|�tkr�|	|||�<qr|	||<qrW|r�x |j	�D]\}}	t|||	�q�WdS)Nr��__setstate__r�r�)
rQrUr�r�r�ru�__dict__r��internr�r�r��setattr)
rrQr�Zinst�setstateZ	slotstateZ	inst_dictr�r-r.rrr�
load_build�s(z_Unpickler.load_buildcCs"|jj|j�g|_|jj|_dS)N)rPrRrQ)rrrr�	load_mark�sz_Unpickler.load_markcCs|jj�}t|��dS)N)rQrUr)rrrrr�	load_stop�s
z_Unpickler.load_stopN)�rrrr rrVrWr�rXr�r�rvr\r�r]r�r^r�r_r�r`r�rb�INTrcr�rdr�rer�rgrrhrrirrjrrkrrlrn�STRINGro�	BINSTRINGrpr
rqrrrrrsrrtrru�SHORT_BINSTRINGrvrrwrrxrryrrz�TUPLE1r{�TUPLE2r}�TUPLE3r~rrr(r�r0r�r5r�r r�r)r�r��INSTr��OBJr�r�r�r�r�r@r�r?r�r;r�r<r�r=r�r�r�r�r�r�r�rr��DUPr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r"r�r%r�r+r�r,r�r1r�r�r�rr�r�rrrrrH�s$		
		rHT)r�cCst|||d�j|�dS)N)r�)r�r)r�r�r�r�rrr�_dumpsr�cCs(tj�}t|||d�j|�|j�}|S)N)r�)rlrmr�r�getvalue)r�r�r�ry�resrrr�_dumpssr�rIrJ)r�rKrLcCst||||d�j�S)N)r�rKrL)rHr)r�r�rKrLrrr�_load
sr�cCs0t|t�rtd��tj|�}t||||d�j�S)Nz%Can't load pickle from unicode string)r�rKrL)r�r�r�rlrmrHr)�sr�rKrLr�rrr�_loadss


r�)	rr
rrrrrrrcCsddl}|j�S)Nr)�doctestZtestmod)r�rrr�_test*sr�r�z$display contents of the pickle files)Zdescription�pickle_file�br�*zthe pickle file)r��nargs�helpz-tz--test�
store_truezrun self-test suite)�actionr�z-vz)run verbosely; only affects self-test run)N)N)�r�typesr�copyregrrrr�	itertoolsr�	functoolsrr�r	Zstructr
rrcrlr
rA�__all__r	�	bytearrayZbytes_typesZformat_versionZcompatible_formatsr�r��	Exceptionrr
rrZorg.python.corer!r9rr�r�rr�rr�r�r�rr�r�r�r�r�r�r�r�rrr"r�r@r)r(r%r�r�r�r�r rr�r�r�r�r+rrr,rr�r�r�r�r;r<r=r�r�r�r�r�rrrr
rrrrr0r1r5r�r?r�rvr��dirrhr}r�r�r�r�r�rHr�r�r�r��_picklerrrrrrr�r�argparse�ArgumentParser�parser�add_argumentZFileType�
parse_argsr�Ztestr�Z
print_help�pprintryr�rrrr�<module>s.

$*
-0




typing.cpython-36.opt-2.pyc000064400000155361150335715140011463 0ustar003


 \�9�D@s�ddlZddlmZmZddlZddlZddlZddlZddlZddl	Z	yddl
jZWnek
rrddlZYnXej
dd�d�kr�ddlZyddl	mZmZmZWn4ek
r�eej�Zee�j�Zeej�ZYnXddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:g4Zd;d<�Zd=d>�ZGd?d@�d@e�ZGdAdB�dBedCdD�ZGdEdF�dFedCdG�ZGdHdI�dIedCdG�ZGdJdK�dKedCdG�ZdLdM�Z dNdO�Z!dPdQ�Z"dRdS�Z#dTdU�Z$GdVdW�dWedCdG�Z%e%dCdG�Z&GdXdY�dYedCdG�Z'e'dCdG�Z(GdZd�dedCdG�Z)e)d[�Z*e)d\�Z+e)d]�Z,e)d^dCd_�Z-e)d`dCd_�Z.e)dadCd_�Z/e)dbdCdc�Z0e)d2e1e�Z2ddde�Z3d�dfdg�Z4dhdi�Z5djdk�Z6gZ7dldm�Z8Gdndo�doedCdG�Z9e9dCdG�Z:Gdpdq�dqedCdG�Z;e;dCdG�Z<drds�Z=dtdu�Z>dvdw�Z?Gdxd�deej@�ZAdZBdydz�ZCGd{d
�d
eAd|�ZBGd}d~�d~�ZDGdd��d��ZEGd�d��d�eA�ZFGd�d�deGeGeFd��ZHGd�d��d�eA�ZIGd�d�dejJeId��ZJGd�d��d�edCdG�ZKeKdCdG�ZLd�d3�ZMd�d��ZNe	jOe	jPe	jQe	jReeefZSd�d�d4�ZTd�d6�ZUd�d7�ZVd�d��ZWd�d8�ZXGd�d��d�eA�ZYGd�d��d�eYd|�ZZej[Z[e\ed���rjGd�d��d�eBe-ej]d��Z]ej^d��e\ed���r�Gd�d��d�e]e.eBe-e0e.fej_d��Z_ej^d��e\ed���r�Gd�d��d�eBe-ej`d��Z`Gd�d��d�e`e-ejad��Zaej^d��ej^d��Gd�d�deBe-ejbd��ZbGd�d�debe-ejcd��ZcGd�d'�d'eZ�ZdGd�d&�d&eZ�ZeGd�d%�d%eZ�ZfGd�d$�d$eZ�ZgGd�d#�d#eZe-�ZhGd�d(�d(eZe-�Zie\ed"��r�Gd�d"�d"ebe-ejjd��ZjnGd�d"�d"eZe-�ZjejkZkGd�d�deBe-ejld��Zle\ed���r*Gd�d��d�ekebe-ele-ejmd��Zmej^d��e\ed���rRGd�d�deme-ejnd��Zon"Gd�d�dekebe-ele-ejnd��ZoGd�d�deoe*ejpd��Zpe\ed���r�Gd�d�deme+eBe+e/fejqd��Zqn,Gd�d�dekebe+ele+eBe+e/fejqd��ZqGd�d�deqe+e,fejrd��Zre\ed"��rhe\ed���rDGd�d�deje-eme-ejsd��Zsn"Gd�d�dekeje-ele-ejsd��Zsn"Gd�d�dekebe-ele-ejsd��ZsGd�d�dese*ejtd��ZtGd�d�deseuejvd��ZvGd�d-�d-ewete*ewd��ZxGd�d*�d*ejyete*ejyd��ZzGd�d.�d.e{epe*e{d��ZnGd�d/�d/e|eoe-e|d��Z}Gd�d�dekebe-ej~d��Z~Gd�d�de~e+eoe+ejd��ZGd�d�de~eHe+e/feoeHe+e/feBe+e/fej�d��Z�Gd�d!�d!e~e/ej�d��Z�e\ed���r�Gd�d�deBe-ej�d��Z�nGd�d�deBe-�Z�e\edÃ�	r(Gd�dńd�eBe-ej�d��Z�ej^dŃnej
dd�d�k�	rDe�dǃGd�d+�d+e�ere+e,fe�d��Z�Gd�d,�d,ej�ere+e,fej�d��Z�Gd�d)�d)ej�e�e*eufej�d��Z�e\ed˃�	r�ej^d˃Gd�d˄d�ej�ere+e,fej�d��Z�e\ed1��	r�ej�Z�ne	j�Z�Gd�d1�d1ece-eBe-e0e.fe�d��Z�e\ed΃�
rVGd�d΄d�eae-eBe-e0fej�d��Z�ej^d΃e)d�dCedэZ�Gd�d
�d
eBe�ed��Z�d�dԄZ�ej
dd�d�kZ��dZ��dZ�Gd�d�d�e�Z�Gd�d0�d0e�d|�Z�d�d5�Z�eZ�d�Z�Gd�d�d�eBe2�Z�Gd�d�d�e�e1�Z�Gd�d�d�e�e�Z�Gd�d�d�Z�e�d�e�_�e�ej�e�j�<ed�e2eej�d��d�d���Z�ed�e2eej�d�d��d�d���Z�Gd�d��d��Ze�d�e_�eej�ej�<dS(�N)�abstractmethod�abstractproperty���)�WrapperDescriptorType�MethodWrapperType�MethodDescriptorType�Any�Callable�ClassVar�Generic�Optional�Tuple�Type�TypeVar�Union�AbstractSet�GenericMeta�
ByteString�	Container�ContextManager�Hashable�	ItemsView�Iterable�Iterator�KeysView�Mapping�MappingView�MutableMapping�MutableSequence�
MutableSet�Sequence�Sized�
ValuesView�
Reversible�SupportsAbs�
SupportsBytes�SupportsComplex�
SupportsFloat�SupportsInt�
SupportsRound�Counter�Deque�Dict�DefaultDict�List�Set�	FrozenSet�
NamedTuple�	Generator�AnyStr�cast�get_type_hints�NewType�
no_type_check�no_type_check_decorator�overload�Text�
TYPE_CHECKINGcCs"tjdd�dkr|jS|jSdS)Nrr)rr)�sys�version_info�__qualname__�__name__)�x�rC�/usr/lib64/python3.6/typing.py�	_qualnamegsrEcCs&d}|jd�r"||kr"|dd�}|S)N�
_TypeAlias�_ForwardRef�_TypingBase�_FinalTypingBase�_�)rFrGrHrI)�
startswith)ZnmZ	whitelistrCrCrD�
_trim_nameosrMcsFeZdZdZdd��fdd�
Zdd�Zdd�Zd	d
�Zdd�Z�Z	S)
�
TypingMetaF)�_rootcs2|s tddjtt|��pd��t�j||||�S)NzCannot subclass %sz, z())�	TypeError�join�map�
_type_repr�super�__new__)�cls�name�bases�	namespacerO)�	__class__rCrDrU�szTypingMeta.__new__cOsdS)NrC)�self�args�kwdsrCrCrD�__init__�szTypingMeta.__init__cCs|S)NrC)r[�globalns�localnsrCrCrD�
_eval_type�szTypingMeta._eval_typecCsdS)NrC)r[�tvarsrCrCrD�_get_type_vars�szTypingMeta._get_type_varscCstt|��}d|j|fS)Nz%s.%s)rMrE�
__module__)r[�qnamerCrCrD�__repr__�szTypingMeta.__repr__)
rArdr@�_is_protocolrUr^rarcrf�
__classcell__rCrC)rZrDrNvs

rNcsHeZdZdZdd�Z�fdd�Zdd�Zdd	�Zd
d�Zdd
�Z	�Z
S)rH�__weakref__cOsdS)NrC)r[r\r]rCrCrDr^�sz_TypingBase.__init__cs@t|�dkr4t|dt�r4t|dt�r4td|��t�j|�S)NrrrKzCannot subclass %r)�len�
isinstance�str�tuplerPrTrU)rVr\r])rZrCrDrU�s
z_TypingBase.__new__cCs|S)NrC)r[r_r`rCrCrDra�sz_TypingBase._eval_typecCsdS)NrC)r[rbrCrCrDrc�sz_TypingBase._get_type_varscCs"t|�}tt|��}d|j|fS)Nz%s.%s)�typerMrErd)r[rVrerCrCrDrf�sz_TypingBase.__repr__cOstdt|���dS)NzCannot instantiate %r)rPrn)r[r\r]rCrCrD�__call__�sz_TypingBase.__call__)ri)rArdr@�	__slots__r^rUrarcrfrorhrCrC)rZrDrH�srHT)�	metaclassrOcs.eZdZfZdd��fdd�
Zdd�Z�ZS)rIF)rOcs0t�j|f|�|�}|dkr |Std|��dS)NTzCannot instantiate %r)rTrUrP)rVrOr\r]r[)rZrCrDrU�sz_FinalTypingBase.__new__cCstt|�j�S)N)rMrnrA)r[rCrCrD�
__reduce__�sz_FinalTypingBase.__reduce__)rArdr@rprUrrrhrCrC)rZrDrI�srI)rOcsPeZdZdZ�fdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
�ZS)rG�__forward_arg__�__forward_code__�__forward_evaluated__�__forward_value__cstt�j|�t|t�s$td|f��yt|dd�}Wn"tk
rVtd|f��YnX||_||_d|_	d|_
dS)Nz,Forward reference must be a string -- got %rz<string>�evalz1Forward reference must be an expression -- got %rF)rTr^rkrlrP�compile�SyntaxErrorrsrtrurv)r[�arg�code)rZrCrDr^�s
z_ForwardRef.__init__cCsf|js||k	r`|dkr*|dkr*i}}n|dkr8|}n|dkrD|}tt|j||�d�|_d|_|jS)Nz*Forward references must evaluate to types.T)ru�_type_checkrwrtrv)r[r_r`rCrCrDra�s
z_ForwardRef._eval_typecCs&t|t�stS|j|jko$|j|jkS)N)rkrG�NotImplementedrsrv)r[�otherrCrCrD�__eq__�s
z_ForwardRef.__eq__cCst|j|jf�S)N)�hashrsrv)r[rCrCrD�__hash__sz_ForwardRef.__hash__cCstd��dS)Nz4Forward references cannot be used with isinstance().)rP)r[�objrCrCrD�__instancecheck__sz_ForwardRef.__instancecheck__cCstd��dS)Nz4Forward references cannot be used with issubclass().)rP)r[rVrCrCrD�__subclasscheck__sz_ForwardRef.__subclasscheck__cCsd|jfS)Nz_ForwardRef(%r))rs)r[rCrCrDrf	sz_ForwardRef.__repr__)rsrtrurv)rArdr@rpr^rarr�r�r�rfrhrCrC)rZrDrG�srGc@sHeZdZdZdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dS)rFrW�type_var�	impl_type�type_checkercCs||_||_||_||_dS)N)rWr�r�r�)r[rWr�r�r�rCrCrDr^sz_TypeAlias.__init__cCsd|jt|j�fS)Nz%s[%s])rWrSr�)r[rCrCrDrf,sz_TypeAlias.__repr__cCs�t|jt�std|��|jjrJt|t�rJt||jj�sJtd||jf��t|t�rj||jk	rjtd|��|j|j||j	|j
�S)Nz#%s cannot be further parameterized.z&%s is not a valid substitution for %s.z%s cannot be re-parameterized.)rkr�rrP�__constraints__rn�
issubclassrZrWr�r�)r[Z	parameterrCrCrD�__getitem__/s
z_TypeAlias.__getitem__cCs&t|t�stS|j|jko$|j|jkS)N)rkrFr}rWr�)r[r~rCrCrDr;s
z_TypeAlias.__eq__cCst|j|jf�S)N)r�rWr�)r[rCrCrDr�@sz_TypeAlias.__hash__cCs t|jt�std��t||j�S)Nz<Parameterized type aliases cannot be used with isinstance().)rkr�rrPr�)r[r�rCrCrDr�Csz_TypeAlias.__instancecheck__cCs t|jt�std��t||j�S)Nz<Parameterized type aliases cannot be used with issubclass().)rkr�rrPr�r�)r[rVrCrCrDr�Isz_TypeAlias.__subclasscheck__N)rWr�r�r�)rArdr@rpr^rfr�rr�r�r�rCrCrCrDrF
s	rFcCs0x*|D]"}t|t�st|t�r|j|�qWdS)N)rkrNrHrc)�typesrb�trCrCrDrcPs
rccCsg}t||�t|�S)N)rcrm)r�rbrCrCrD�
_type_varsVs
r�cCs$t|t�st|t�r |j||�S|S)N)rkrNrHra)r�r_r`rCrCrDra\sracCs�|dkrtd�St|t�r"t|�}t|t�r:t|�jdksTt|ttf�rft|�rft|d|f��t|�jdkr�t|dd�s�t|t	�r�|j
ttfkr�td|��|S)N�	_ClassVarz Got %.100r.�_Union�	_Optional�
__origin__z&Plain %s is not valid as type argument)r�r�)
rnrkrlrGrHrA�callablerP�getattrrN�_gorgr
�	_Protocol)rz�msgrCrCrDr|bs
r|cCs`t|t�r:t|t�r:|jdkr(t|�Sd|jt|�fS|dkrFdSt|tj�rX|jSt|�S)N�builtinsz%s.%s.z...)	rkrnrNrdrEr��FunctionTyperA�repr)r�rCrCrDrS�s
rSc@s eZdZfZdd�Zdd�ZdS)�_AnycCstd��dS)Nz%Any cannot be used with isinstance().)rP)r[r�rCrCrDr��sz_Any.__instancecheck__cCstd��dS)Nz%Any cannot be used with issubclass().)rP)r[rVrCrCrDr��sz_Any.__subclasscheck__N)rArdr@rpr�r�rCrCrCrDr��sr�c@s eZdZfZdd�Zdd�ZdS)�	_NoReturncCstd��dS)Nz*NoReturn cannot be used with isinstance().)rP)r[r�rCrCrDr��sz_NoReturn.__instancecheck__cCstd��dS)Nz*NoReturn cannot be used with issubclass().)rP)r[rVrCrCrDr��sz_NoReturn.__subclasscheck__N)rArdr@rpr�r�rCrCrCrDr��s
r�csJeZdZdZdddd��fd	d
�
Zdd�Zd
d�Zdd�Zdd�Z�Z	S)rrA�	__bound__r��
__covariant__�__contravariant__NF)�bound�	covariant�
contravariantcs�t�j|f|�|||d��||_|r2|r2td��t|�|_t|�|_|rZ|dk	rZtd��|rrt|�dkrrtd��d�t	�fdd�|D��|_
|r�t|d	�|_nd|_dS)
N)r�r�r�z"Bivariant types are not supported.z-Constraints cannot be combined with bound=...rKz"A single constraint is not allowedz:TypeVar(name, constraint, ...): constraints must be types.c3s|]}t|��VqdS)N)r|)�.0r�)r�rCrD�	<genexpr>sz#TypeVar.__init__.<locals>.<genexpr>zBound must be a type.)
rTr^rA�
ValueError�boolr�r�rPrjrmr�r|r�)r[rWr�r�r�Zconstraints)rZ)r�rDr^�s 

zTypeVar.__init__cCs||kr|j|�dS)N)�append)r[rbrCrCrDrcszTypeVar._get_type_varscCs&|jrd}n|jrd}nd}||jS)N�+�-�~)r�r�rA)r[�prefixrCrCrDrf
szTypeVar.__repr__cCstd��dS)Nz0Type variables cannot be used with isinstance().)rP)r[�instancerCrCrDr�szTypeVar.__instancecheck__cCstd��dS)Nz0Type variables cannot be used with issubclass().)rP)r[rVrCrCrDr�szTypeVar.__subclasscheck__)rAr�r�r�r�)
rArdr@rpr^rcrfr�r�rhrCrC)rZrDr�s*	�T�KT�VT�T_co)r��V_co�VT_co�T_contra)r�cCsd|dkrg}t|d�r0t|ttf�r0|j||�St|t�r`x$t|�D]\}}||krD||SqDW|S)N�
_subs_tree)�hasattrrkrrHr�r�	enumerate)rzrbr\�iZtvarrCrCrD�_replace_arg)s
r�c	Cs�|jdkr|S|j}g}x|jdk	r6|j|�|j}qWg}x |jD]}|jt|||��qDWx8|D]0}g}x"|jD]}|jt||j|��qtW|}qdW|S)N)r�r��__args__r��__parameters__)	rVrbr\ZcurrentZ
orig_chain�	tree_argsrzZoclsZ
new_tree_argsrCrCrDr�Ds 



r�csg}xn|D]f}t|t�r0|jtkr0|j|j�q
t|t�rft|�dkrf|dtkrf|j|dd��q
|j|�q
Wt	|��t��t|�kr�g}x(|D] }|�kr�|j|��j
|�q�W|}t	|��x>|D]6�t�t�s�q�t�fdd���hD��r̈j
��q�Wt�fdd�|D��S)NrrKc3s6|].}t|t�o|jdk	st|t�o,t�|�VqdS)N)rkrr�rnr�)r�Zt2)�t1rCrDr��s
z'_remove_dups_flatten.<locals>.<genexpr>c3s|]}|�kr|VqdS)NrC)r�r�)�
all_paramsrCrDr��s)
rkr�r�r�extendr�rmrjr��set�removern�any)�
parameters�params�pZ
new_paramsr�rC)r�r�rD�_remove_dups_flattenes.
"



r�cCsX|jstdt|���t|�}t|j�}||krTtd||kr@dndt|�||f��dS)Nz%s is not a generic classz0Too %s parameters for %s; actual %s, expected %sZmanyZfew)r�rPr�rj)rVr�ZalenZelenrCrCrD�_check_generic�s
r�cs4tj����tj�j�tj����fdd��}|S)Ncs*y
�||�Stk
rYnX�||�S)N)rP)r\r])�cached�funcrCrD�inner�s

z_tp_cache.<locals>.inner)�	functools�	lru_cache�	_cleanupsr��cache_clear�wraps)r�r�rC)r�r�rD�	_tp_cache�sr�cs�eZdZdZddd��fdd	�Zd
d�Zdd
�Z�fdd�Z�fdd�Ze	dd��Z
d dd�Zdd�Zdd�Z
dd�Zdd�Z�ZS)!r�r�r�r��
__tree_hash__NF)rOcs�t�j|||f|�d|i�}|dkrHd|_d|_d|_ttd��|_|St|t	�sZt
d��|tkr~t|�}t
|�dkr~|dSt|�|_||_||_|j�}t|t	�r�tt|��|_n
t|�|_|S)NrOrzExpected parameters=<tuple>rKr)r)rTrUr�r�r�r��	frozensetr�rkrmrPrr�rjr�r�)rVr��originrOr\r[Z	subs_tree)rZrCrDrU�s*



z_Union.__new__cs^|jdkr|St��fdd�|jD��}t|j���}||jkrN||jkrN|S|j||dd�S)Nc3s|]}t|���VqdS)N)ra)r�r�)r_r`rCrDr��sz$_Union._eval_type.<locals>.<genexpr>T)rO)r�rmrar�rZ)r[r_r`�ev_args�	ev_originrC)r_r`rDra�s
z_Union._eval_typecCs|jr|jrt|j|�dS)N)r�r�rc)r[rbrCrCrDrcsz_Union._get_type_varscs<|jdkrt�j�S|j�}t|t�s.t|�S|dj|�S)Nr)r�rTrfr�rkrmr��
_tree_repr)r[�tree)rZrCrDrfs


z_Union.__repr__cs`g}xB|dd�D]2}t|t�s0|jt|��q|j|dj|��qWt�j�ddj|�S)NrKrz[%s]z, )rkrmr�rSr�rTrfrQ)r[r��arg_listrz)rZrCrDr�
s
z_Union._tree_reprcsl|fkrtd��t|t�s |f}|jdkr0d�nd�t�fdd�|D��}|tk	r\t||�|j||dd�S)Nz Cannot take a Union of no types.z)Union[arg, ...]: each arg must be a type.z*Parameters to generic types must be types.c3s|]}t|��VqdS)N)r|)r�r�)r�rCrDr� sz%_Union.__getitem__.<locals>.<genexpr>T)r�rO)rPrkrmr�rr�rZ)r[r�rC)r�rDr�s


z_Union.__getitem__cCs>|tkrtSt|||�}t|�}t|�dkr4|dStf|S)NrKr)rr�r�rj)r[rbr\r�rCrCrDr�%sz_Union._subs_treecCs6t|t�r|j|jkS|tk	r*|j�|kS||kSdS)N)rkr�r�rr�)r[r~rCrCrDr.s

z
_Union.__eq__cCs|jS)N)r�)r[rCrCrDr�6sz_Union.__hash__cCstd��dS)Nz(Unions cannot be used with isinstance().)rP)r[r�rCrCrDr�9sz_Union.__instancecheck__cCstd��dS)Nz(Unions cannot be used with issubclass().)rP)r[rVrCrCrDr�<sz_Union.__subclasscheck__)r�r�r�r�)NN)NN)rArdr@rprUrarcrfr�r�r�r�rr�r�r�rhrCrC)rZrDr��s,
	
	r�c@seZdZfZedd��ZdS)r�cCst|d�}t|td�fS)Nz#Optional[t] requires a single type.)r|rrn)r[rzrCrCrDr�Ks
z_Optional.__getitem__N)rArdr@rpr�r�rCrCrCrDr�Csr�cCsJt}x@t|jdd��D]*\}}t|t�r|jtkr|j|d}qW|S)NrK���)�objectr��__mro__rkrr�r
)rVZnext_in_mror��crCrCrD�_next_in_mroTs
r�cs,t�jtj�r�fdd�}n�fdd�}|S)NcsZ�jj|�}|tk	r|S�j|jkr(dSx,�jj�D]}t|t�rDq4t||�r4dSq4WtS)NT)�	__extra__�__subclasshook__r}r��__subclasses__rkrr�)�subclass�res�scls)rVrCrD�
__extrahook__ks

z)_make_subclasshook.<locals>.__extrahook__cs�jrt|�j�rdStS)NT)r�r�r})r�)rVrCrDr�ys)rkr��abc�ABCMeta)rVr�rC)rVrD�_make_subclasshookbsr�cCs2t|�}d|kr.x|dD]}|j|d�qW|S)Nrp)�dict�pop)ZdctZ	dict_copyZslotrCrCrD�_no_slots_copy�s
r�cs�eZdZd �fdd�	Zedd��Zejdd��Zedd��Zejd	d��Zd
d�Zdd
�Z	�fdd�Z
�fdd�Zd!dd�Zdd�Z
dd�Zedd��Z�fdd�Zdd�Z�fdd�Z�ZS)"rNc	sX|dk	r
n�t|�}d}	xF|D]>}
|
tkr0td��t|
t�r|
jtkr|	dk	rTtd��|
j}	qW|	dkrl|}	nPt|�}t|	��|�ks�tddj�fdd�|D��djdd�|	D��f��|	}|}|dk	r�t	|�t
jkr�||kr�|f|}tdd�|D��}t
d	d�|D���r td
d�|D��}|j|||�s2dn|jd��t�j||||dd
�}
tt|
�jd|�sj|
n|j�||
_|�r�tdd�|D��nd|
_t|
�|
_|dk�r�||
_d|k�r�|�s�t|
jdd�dk�r�t|
�|
_t|t
j��r�|j|
_|j|
_n|dk	�r|j|
_|j|
_|�r2t|d��r2|j|
_|�rDt|
j��ntt|
�j �|
_!|
S)Nz!Cannot inherit from plain Genericz0Cannot inherit from Generic[...] multiple types.z6Some type variables (%s) are not listed in Generic[%s]z, c3s|]}|�krt|�VqdS)N)rl)r�r�)�gvarsetrCrDr��sz&GenericMeta.__new__.<locals>.<genexpr>css|]}t|�VqdS)N)rl)r��grCrCrDr��scss"|]}t|t�r|jn|VqdS)N)rkrr�)r��brCrCrDr��scss |]}t|t�o|tk	VqdS)N)rkrr
)r�r�rCrCrDr��scss|]}|tk	r|VqdS)N)r
)r�r�rCrCrDr��s)r�r�r�T)rOr�css*|]"}|tkrdn|tkrfn|VqdS).N)�_TypingEllipsis�_TypingEmpty)r��arCrCrDr��sr�rA�r�r@)"r�r
rPrkrr�r�r�rQrnr�r�rmr��updater�rTrU�__setattr__r�r��__next_in_mro__�__orig_bases__r�r�r��
_abc_registry�
_abc_cacher�r@r�r�r�r�)rVrWrXrYrbr\r��extra�
orig_basesZgvars�baseZtvarsetZ
initial_basesr[)rZ)r�rDrU�sj









zGenericMeta.__new__cCst|jtj�r|jjS|jjS)N)rkr�r�r��_abc_negative_cacher��_abc_generic_negative_cache)r[rCrCrDr��szGenericMeta._abc_negative_cachecCs,|jdkr(t|jtj�r"||j_n||_dS)N)r�rkr�r�r�r�r�)r[�valuerCrCrDr�s

cCst|jtj�r|jjS|jjS)N)rkr�r�r��_abc_negative_cache_versionr��#_abc_generic_negative_cache_version)r[rCrCrDr�	sz'GenericMeta._abc_negative_cache_versioncCs,|jdkr(t|jtj�r"||j_n||_dS)N)r�rkr�r�r�r�r�)r[r�rCrCrDr�s

cCs|jr|jrt|j|�dS)N)r�r�rc)r[rbrCrCrDrcszGenericMeta._get_type_varsc
s�|jr|jj���nd}|jr8t��fdd�|jD��nd}||jkrT||jkrT|S|j|j|jt|j�|rtt	|�nd|||j
|jd�S)Nc3s|]}t|���VqdS)N)ra)r�r�)r_r`rCrDr�sz)GenericMeta._eval_type.<locals>.<genexpr>)rbr\r�r�r�)r�rar�rmrZrA�	__bases__r��__dict__r�r�r�)r[r_r`r�r�rC)r_r`rDras$zGenericMeta._eval_typecs"|jdkrt�j�S|j|j��S)N)r�rTrfr�r�)r[)rZrCrDrf+s

zGenericMeta.__repr__cstg}xV|dd�D]F}|fkr*|jd�qt|t�sD|jt|��q|j|dj|��qWt�j�ddj|�S)NrKz()rz[%s]z, )r�rkrmrSr�rTrfrQ)r[r�r�rz)rZrCrDr�0s
zGenericMeta._tree_reprcCs*|jdkr|St|||�}|jft|�S)N)r�r�r�rm)r[rbr\r�rCrCrDr�;s
zGenericMeta._subs_treecCs6t|t�stS|jdks"|jdkr*||kS|j|jkS)N)rkrr}r�r�)r[r~rCrCrDrAs

zGenericMeta.__eq__cCs|jS)N)r�)r[rCrCrDr�HszGenericMeta.__hash__c
s6t|t�s|f}|r0|jtk	r0tdt|���d�t�fdd�|D��}|tkr�tdd�|D��sltd��tt	|��t|�kr�td��|}|}nb|tt
fkr�t|�}|}nH|tkr�|}|}n6|j
ttfkr�tdt|���nt||�t|�}|}|j
dk�r|fnf}|j|j||jt|j�||||j|jd	�S)
Nz)Parameter list to %s[...] cannot be emptyz*Parameters to generic types must be types.c3s|]}t|��VqdS)N)r|)r�r�)r�rCrDr�Ssz*GenericMeta.__getitem__.<locals>.<genexpr>css|]}t|t�VqdS)N)rkr)r�r�rCrCrDr�Vsz5Parameters to Generic[...] must all be type variablesz-Parameters to Generic[...] must all be uniquez'Cannot subscript already-subscripted %s)rbr\r�r�r�)rkrmr�rrPrEr
�allrjr�rr�r�r�r�r�rZrAr�r�r�r�r�)r[r�rbr\ZprependrC)r�rDr�KsJ

zGenericMeta.__getitem__csJ|jdk	r*tjd�jddkr&td��dS|tkr>td|��t�j|�S)	NrKrAr�r�zCParameterized generics cannot be used with class or instance checksFz5Class %r cannot be used with class or instance checks)r�r�)r�r>�	_getframe�	f_globalsrPr
rTr�)r[rV)rZrCrDr�ys
zGenericMeta.__subclasscheck__cCst|j|�S)N)r�rZ)r[r�rCrCrDr��szGenericMeta.__instancecheck__csT|jd�r|jd�s(|jd�s(|jdkr<tt|�j||�ntt|j�j||�dS)N�__�_abc_)rL�endswithr�rTrr�)r[�attrr�)rZrCrDr��s


zGenericMeta.__setattr__)NNNNN)NN)rArdr@rU�propertyr��setterr�rcrarfr�r�rr�r�r�r�r�r�rhrCrC)rZrDr�s `
.cOs�|jdkr@|jtjkr,|jtjk	r,|j|�S|j|f|�|�Snl|j}|jtjkrj|jtjk	rj|j|�}n|j|f|�|�}y
||_Wntk
r�YnX|j||�|SdS)N)r�rUr�r^r�Z__orig_class__�AttributeError)Zbase_clsrVr\r]r�r�rCrCrD�_generic_new�s 


r
c@seZdZfZdd�ZdS)r
cOs&|jtkrtd��t|j|f|�|�S)NzHType Generic cannot be instantiated; it can be used only as a base class)r�r
rPr
r�)rVr\r]rCrCrDrU�s
zGeneric.__new__N)rArdr@rprUrCrCrCrDr
�s)rqc@seZdZdS)r�N)rArdr@rCrCrCrDr��sr�c@seZdZdS)r�N)rArdr@rCrCrCrDr��sr�cs0eZdZe�fdd��Zdd�Zdd�Z�ZS)�	TupleMetacs�|jdk	s|jtk	r t�j|�S|fkr6t�jtf�St|t�sF|f}t|�dkr�|ddkr�d�t	|d��}t�j|t
f�Sd�t�fdd�|D��}t�j|�S)	NrrK.z Tuple[t, ...]: t must be a type.rz*Tuple[t0, t1, ...]: each t must be a type.c3s|]}t|��VqdS)N)r|)r�r�)r�rCrDr��sz(TupleMeta.__getitem__.<locals>.<genexpr>)r�r�rrTr�r�rkrmrjr|r�)r[r�r�)rZ)r�rDr��s
zTupleMeta.__getitem__cCs |jdkrt|t�Std��dS)Nz5Parameterized Tuple cannot be used with isinstance().)r�rkrmrP)r[r�rCrCrDr��s

zTupleMeta.__instancecheck__cCs |jdkrt|t�Std��dS)Nz5Parameterized Tuple cannot be used with issubclass().)r�r�rmrP)r[rVrCrCrDr��s

zTupleMeta.__subclasscheck__)rArdr@r�r�r�r�rhrCrC)rZrDr�src@seZdZfZdd�ZdS)rcOs$|jtkrtd��tt|f|�|�S)Nz6Type Tuple cannot be instantiated; use tuple() instead)r�rrPr
rm)rVr\r]rCrCrDrUs
z
Tuple.__new__N)rArdr@rprUrCrCrCrDr�s
)r�rqcsDeZdZ�fdd�Z�fdd�Z�fdd�Ze�fdd��Z�ZS)	�CallableMetacs"|jdkrt�j�S|j|j��S)N)r�rTrfr�r�)r[)rZrCrDrfs

zCallableMeta.__repr__cs�|jtk	rt�j|�Sg}xB|dd�D]2}t|t�sF|jt|��q(|j|dj|��q(W|ddkr�t|d�d|dSt|d�ddj	|dd��|dfS)	NrKrz...z	[..., %s]z
[[%s], %s]z, r�r�)
r�rrTr�rkrmr�rSr�rQ)r[r�r�rz)rZrCrDr�s


zCallableMeta._tree_reprcs�|jdk	s|jtk	r t�j|�St|t�s8t|�dkr@td��|\}}|t	krZt	|f}n$t|t
�srtd|f��t|�|f}|j|�S)Nrz6Callable must be used as Callable[[arg, ...], result].z8Callable[args, result]: args must be a list. Got %.100r.)r�r�rrTr�rkrmrjrP�Ellipsis�list�__getitem_inner__)r[r�r\�result)rZrCrDr�*s


zCallableMeta.__getitem__cs^|\}}d�t|��}|tkr.t�jt|f�Sd�t�fdd�|D��}||f}t�j|�S)Nz.Callable[args, result]: result must be a type.z6Callable[[arg, ...], result]: each arg must be a type.c3s|]}t|��VqdS)N)r|)r�rz)r�rCrDr�Fsz1CallableMeta.__getitem_inner__.<locals>.<genexpr>)r|r
rTr�r�rm)r[r�r\r)rZ)r�rDr>s

zCallableMeta.__getitem_inner__)	rArdr@rfr�r�r�rrhrCrC)rZrDrsrc@seZdZfZdd�ZdS)rcOs&|jtkrtd��t|j|f|�|�S)NzIType Callable cannot be instantiated; use a non-abstract subclass instead)r�rrPr
r�)rVr\r]rCrCrDrUXs
zCallable.__new__N)rArdr@rprUrCrCrCrDrKscsJeZdZdZddd�Zdd�Zdd�Z�fd	d
�Zdd�Zd
d�Z	�Z
S)r��__type__NcKs
||_dS)N)r)r[�tpr]rCrCrDr^rsz_ClassVar.__init__cCsPt|�}|jdkr4|t|dj|jdd���dd�Stdj|jdd����dS)Nz{} accepts only single type.rKT)rOz {} cannot be further subscripted)rnrr|�formatrArP)r[�itemrVrCrCrDr�us
z_ClassVar.__getitem__cCs,t|j||�}||jkr|St|�|dd�S)NT)rO)rarrn)r[r_r`Znew_tprCrCrDra~s
z_ClassVar._eval_typecs,t�j�}|jdk	r(|djt|j��7}|S)Nz[{}])rTrfrrrS)r[�r)rZrCrDrf�s

z_ClassVar.__repr__cCstt|�j|jf�S)N)r�rnrAr)r[rCrCrDr��sz_ClassVar.__hash__cCs,t|t�stS|jdk	r$|j|jkS||kS)N)rkr�r}r)r[r~rCrCrDr�s


z_ClassVar.__eq__)r)N)rArdr@rpr^r�rarfr�rrhrCrC)rZrDr�_s
	r�cCs|S)NrC)�typ�valrCrCrDr6�sc
Cs�y
|j}Wntk
riSX|j}|j}|d|�}|jp@f}|j}|rTt|�ni}|t|�}x&t||d�|�D]\}}	|	||<qxW|S)N)	�__code__r	�co_argcount�co_varnames�__defaults__�__kwdefaults__r�rj�zip)
r�r{Z	pos_countZ	arg_names�defaultsZ
kwdefaultsr�Z
pos_offsetrWr�rCrCrD�
_get_defaults�s

rc
Cs�t|dd�riSt|t�r�i}x�t|j�D]z}|dkrFtj|jj}n|}|jj	di�}xJ|j
�D]>\}}|dkrztd�}t|t�r�t|�}t
|||�}|||<qbWq*W|S|dkr�t|tj�r�|j}nt|di�}|dkr�|}n|dkr�|}t|dd�}|dk�r"t|t��riStdj|���t|�}	t|�}xp|j
�D]d\}}|dk�rVtd�}t|t��rjt|�}t
|||�}||	k�r�|	|dk�r�t|}|||<�q<W|S)N�__no_type_check__�__annotations__�__globals__z1{!r} is not a module, class, method, or function.)r�rkrn�reversedr�r>�modulesrdr��get�itemsrlrGrar��
ModuleType�_allowed_typesrPrrr�r)
r�r_r`Zhintsr�Zbase_globalsZannrWr�rrCrCrDr7�sV



cCs�t|t�r||jj�}x0|jj�D]"\}}||j|fkr |j|�q Wx4|j�D](}t|tj	�rfd|_
t|t�rPt|�qPWy
d|_
Wntk
r�YnX|S)NT)
rkrnr��copyr&r�r��valuesr�r�r r9rP)rzZ	arg_attrsrrr�rCrCrDr9s	



cstj���fdd��}|S)Ncs�||�}t|�}|S)N)r9)r\r]r�)�	decoratorrCrD�wrapped_decorator/s
z2no_type_check_decorator.<locals>.wrapped_decorator)r�r�)r+r,rC)r+rDr:(scOstd��dS)Nz�You should not call an overloaded function. A series of @overload-decorated functions outside a stub module should always be followed by an implementation that is not @overload-ed.)�NotImplementedError)r\r]rCrCrD�_overload_dummy8sr.cCstS)N)r.)r�rCrCrDr;Ascs,eZdZ�fdd�Zdd�Zdd�Z�ZS)�
_ProtocolMetacs"t|jkrt�j|�Std��dS)Nz+Protocols cannot be used with isinstance().)r�r�rTr�rP)r[r�)rZrCrDr�es
z_ProtocolMeta.__instancecheck__csL|js
tS|tkrdS|j�}x(|D] �t�fdd�|jD��s$dSq$WdS)NTc3s|]}�|jkVqdS)N)r�)r��d)rrCrDr�wsz2_ProtocolMeta.__subclasscheck__.<locals>.<genexpr>F)rgr}r��_get_protocol_attrsr�r�)r[rV�attrsrC)rrDr�js
z_ProtocolMeta.__subclasscheck__cCs,g}x.|jD]$}t|dd�r|jdkr|j|�qWt�}�x�|D�]�}x�|jj�D]�}x�|jD]&}||k	r`||jkr`t|dd�r`Pq`W|jd�rT|dkrT|dkrT|dkrT|dkrT|dkrT|d	krT|d
krT|dkrT|dkrT|d
krT|dkrT|dkrT|dkrT|dkrT|dkrT|dkrT|j|�qTWqBW|S)NrgFr�r�__abstractmethods__r!rir�r�r�rpr1r�r�r�r�r�r�rd)	r�r�rAr�r�r��keysrL�add)r[Zprotocol_basesr�r2r�rrCrCrDr1{s<z!_ProtocolMeta._get_protocol_attrs)rArdr@r�r�r1rhrCrC)rZrDr/^sr/c@seZdZfZdZdS)r�TN)rArdr@rprgrCrCrCrDr��sr��	Awaitablec@seZdZfZdS)r6N)rArdr@rprCrCrCrDr6�s)r��	Coroutinec@seZdZfZdS)r7N)rArdr@rprCrCrCrDr7�s�
AsyncIterablec@seZdZfZdS)r8N)rArdr@rprCrCrCrDr8�sc@seZdZfZdS)�
AsyncIteratorN)rArdr@rprCrCrCrDr9�sr9c@seZdZfZdS)rN)rArdr@rprCrCrCrDr�sc@seZdZfZdS)rN)rArdr@rprCrCrCrDr�sc@s"eZdZfZeed�dd��ZdS)r*)�returncCsdS)NrC)r[rCrCrD�__int__�szSupportsInt.__int__N)rArdr@rpr�intr;rCrCrCrDr*�sc@s"eZdZfZeed�dd��ZdS)r))r:cCsdS)NrC)r[rCrCrD�	__float__�szSupportsFloat.__float__N)rArdr@rpr�floatr=rCrCrCrDr)�sc@s"eZdZfZeed�dd��ZdS)r()r:cCsdS)NrC)r[rCrCrD�__complex__�szSupportsComplex.__complex__N)rArdr@rpr�complexr?rCrCrCrDr(�sc@s"eZdZfZeed�dd��ZdS)r')r:cCsdS)NrC)r[rCrCrD�	__bytes__�szSupportsBytes.__bytes__N)rArdr@rpr�bytesrArCrCrCrDr'�sc@s"eZdZfZeed�dd��ZdS)r&)r:cCsdS)NrC)r[rCrCrD�__abs__�szSupportsAbs.__abs__N)rArdr@rprr�rCrCrCrCrDr&�sc@s&eZdZfZedeed�dd��ZdS)r+r)�ndigitsr:cCsdS)NrC)r[rDrCrCrD�	__round__szSupportsRound.__round__N)r)rArdr@rprr<r�rErCrCrCrDr+sc@seZdZfZdS)r%N)rArdr@rprCrCrCrDr%
sc@s"eZdZfZedd�dd��ZdS)r%zIterator[T_co])r:cCsdS)NrC)r[rCrCrD�__reversed__szReversible.__reversed__N)rArdr@rprrFrCrCrCrDr%
sc@seZdZfZdS)rN)rArdr@rprCrCrCrDrs�
Collectionc@seZdZfZdS)rGN)rArdr@rprCrCrCrDrGsc@seZdZfZdS)rN)rArdr@rprCrCrCrDr'sc@seZdZfZdS)rN)rArdr@rprCrCrCrDr+sc@seZdZfZdS)r!N)rArdr@rprCrCrCrDr!0sc@seZdZfZdS)rN)rArdr@rprCrCrCrDr6sc@seZdZfZdS)rN)rArdr@rprCrCrCrDr:sc@seZdZfZdS)rN)rArdr@rprCrCrCrDr?sc@seZdZfZdS)r"N)rArdr@rprCrCrCrDr"Esc@seZdZfZdS)r"N)rArdr@rprCrCrCrDr"Isc@seZdZfZdS)r"N)rArdr@rprCrCrCrDr"Msc@seZdZfZdS)r N)rArdr@rprCrCrCrDr Rsc@seZdZfZdS)rN)rArdr@rprCrCrCrDrVsc@seZdZfZdd�ZdS)r0cOs$|jtkrtd��tt|f|�|�S)Nz4Type List cannot be instantiated; use list() instead)r�r0rPr
r)rVr\r]rCrCrDrU^s
zList.__new__N)rArdr@rprUrCrCrCrDr0Zsc@seZdZfZdd�ZdS)r-cOs*|jtkrtj||�Sttj|f|�|�S)N)r�r-�collections�dequer
)rVr\r]rCrCrDrUis
z
Deque.__new__N)rArdr@rprUrCrCrCrDr-esc@seZdZfZdd�ZdS)r1cOs$|jtkrtd��tt|f|�|�S)Nz2Type Set cannot be instantiated; use set() instead)r�r1rPr
r�)rVr\r]rCrCrDrUss
zSet.__new__N)rArdr@rprUrCrCrCrDr1osc@seZdZfZdd�ZdS)r2cOs$|jtkrtd��tt|f|�|�S)Nz>Type FrozenSet cannot be instantiated; use frozenset() instead)r�r2rPr
r�)rVr\r]rCrCrDrU}s
zFrozenSet.__new__N)rArdr@rprUrCrCrCrDr2zsc@seZdZfZdS)rN)rArdr@rprCrCrCrDr�sc@seZdZfZdS)rN)rArdr@rprCrCrCrDr�sc@seZdZfZdS)rN)rArdr@rprCrCrCrDr�sc@seZdZfZdS)r$N)rArdr@rprCrCrCrDr$�s�AbstractContextManagerc@seZdZfZdS)rN)rArdr@rprCrCrCrDr�sc@s2eZdZfZdd�Zejdd��Zedd��Z	dS)rcCs|S)NrC)r[rCrCrD�	__enter__�szContextManager.__enter__cCsdS)NrC)r[�exc_type�	exc_value�	tracebackrCrCrD�__exit__�szContextManager.__exit__cCs8|tkr4tdd�|jD��r4tdd�|jD��r4dStS)Ncss|]}d|jkVqdS)rKN)r�)r��BrCrCrDr��sz2ContextManager.__subclasshook__.<locals>.<genexpr>css|]}d|jkVqdS)rON)r�)r�rPrCrCrDr��sT)rr�r�r})rV�CrCrCrDr��s
zContextManager.__subclasshook__N)
rArdr@rprKr�rrO�classmethodr�rCrCrCrDr�s�AbstractAsyncContextManagerc@seZdZfZdS)�AsyncContextManagerN)rArdr@rprCrCrCrDrT�srT�a�
class AsyncContextManager(Generic[T_co]):
    __slots__ = ()

    async def __aenter__(self):
        return self

    @abc.abstractmethod
    async def __aexit__(self, exc_type, exc_value, traceback):
        return None

    @classmethod
    def __subclasshook__(cls, C):
        if cls is AsyncContextManager:
            if sys.version_info[:2] >= (3, 6):
                return _collections_abc._check_methods(C, "__aenter__", "__aexit__")
            if (any("__aenter__" in B.__dict__ for B in C.__mro__) and
                    any("__aexit__" in B.__dict__ for B in C.__mro__)):
                return True
        return NotImplemented

__all__.append('AsyncContextManager')
c@seZdZfZdd�ZdS)r.cOs$|jtkrtd��tt|f|�|�S)Nz4Type Dict cannot be instantiated; use dict() instead)r�r.rPr
r�)rVr\r]rCrCrDrU�s
zDict.__new__N)rArdr@rprUrCrCrCrDr.�sc@seZdZfZdd�ZdS)r/cOs*|jtkrtj||�Sttj|f|�|�S)N)r�r/rH�defaultdictr
)rVr\r]rCrCrDrU�s
zDefaultDict.__new__N)rArdr@rprUrCrCrCrDr/�sc@seZdZfZdd�ZdS)r,cOs*|jtkrtj||�Sttj|f|�|�S)N)r�r,rHr
)rVr\r]rCrCrDrU�s
zCounter.__new__N)rArdr@rprUrCrCrCrDr,�s�ChainMapc@seZdZfZdd�ZdS)rWcOs*|jtkrtj||�Sttj|f|�|�S)N)r�rWrHr
)rVr\r]rCrCrDrU�s
zChainMap.__new__N)rArdr@rprUrCrCrCrDrW�sc@seZdZfZdd�ZdS)r4cOs$|jtkrtd��tt|f|�|�S)Nz@Type Generator cannot be instantiated; create a subclass instead)r�r4rPr
�_G_base)rVr\r]rCrCrDrUs
zGenerator.__new__N)rArdr@rprUrCrCrCrDr4s�AsyncGeneratorc@seZdZfZdS)rYN)rArdr@rprCrCrCrDrYs�CT_co)r�r�c@seZdZfZdS)rN)rArdr@rprCrCrCrDr$scsvd��fdd�|D�}tj|dd�|D��}tj|�|_|_ytjd�jjdd�|_	Wnt
tfk
rpYnX|S)NzDNamedTuple('Name', [(f0, t0), (f1, t1), ...]); each t must be a typecsg|]\}}|t|��f�qSrC)r|)r��nr�)r�rCrD�
<listcomp>Asz!_make_nmtuple.<locals>.<listcomp>cSsg|]\}}|�qSrCrC)r�r[r�rCrCrDr\BsrrA�__main__)rH�
namedtuple�OrderedDictr!�_field_typesr>rrr%rdr	r�)rWr��nm_tplrC)r�rD�
_make_nmtuple?srbrUr^rp�__getnewargs__�_fields�_field_defaultsr`�_make�_replace�_asdict�_sourcerdrAr@r!cseZdZ�fdd�Z�ZS)�NamedTupleMetacs|jdd�rt�j||||�Sts*td��|jdi�}t||j��}g}i}xP|D]H}||krz||}	|j|	�|	||<qR|rRtdj|dj	|j
��d���qRWtj|�|j_
t|�|j_||_xD|D]<}
|
tkr�td|
��q�|
tko�|
|jkr�t||
||
�q�W|S)	NrOFz<Class syntax for NamedTuple is only supported in Python 3.6+r!zXNon-default namedtuple field {field_name} cannot follow default field(s) {default_names}z, )�
field_nameZ
default_namesz&Cannot overwrite NamedTuple attribute )r%rTrU�_PY36rPrbr&r�rrQr4rHr_r!rmrre�_prohibitedr	�_specialrd�setattr)rV�typenamerX�nsr�rarZ
defaults_dictrkZ
default_value�key)rZrCrDrUYs4



zNamedTupleMeta.__new__)rArdr@rUrhrCrC)rZrDrjWsrjc@seZdZdZddd�ZdS)r3TNcKs:|rtrtd��|dkr$|j�}n|r0td��t||�S)Nz>Keyword syntax for NamedTuple is only supported in Python 3.6+zIEither list of fields or keywords can be provided to NamedTuple, not both)rlrPr&rb)r[rpZfields�kwargsrCrCrDrU�s

zNamedTuple.__new__)N)rArdr@rOrUrCrCrCrDr3yscCsdd�}||_||_|S)NcSs|S)NrC)rBrCrCrD�new_type�szNewType.<locals>.new_type)rAZ
__supertype__)rWrrtrCrCrDr8�sFc@s�eZdZfZeed�dd��Zeed�dd��Zedd�dd��Z	ee
d�d	d
��Zeed�dd��Z
edd�d
d��Zee
d�dd��Zed6eed�dd��Zee
d�dd��Zed8eed�dd��Zed:eeed�dd��Zed;eeed�dd ��Zee
d�d!d"��Zeed�d#d$��Zed<eed%�d&d'��Zee
d�d(d)��Zeeed*�d+d,��Zeeedd-�d.d/��Zed0d�d1d2��Zedd�d3d4��ZdS)=�IO)r:cCsdS)NrC)r[rCrCrD�mode�szIO.modecCsdS)NrC)r[rCrCrDrW�szIO.nameNcCsdS)NrC)r[rCrCrD�close�szIO.closecCsdS)NrC)r[rCrCrD�closed�sz	IO.closedcCsdS)NrC)r[rCrCrD�fileno�sz	IO.filenocCsdS)NrC)r[rCrCrD�flush�szIO.flushcCsdS)NrC)r[rCrCrD�isatty�sz	IO.isattyrK)r[r:cCsdS)NrC)r[r[rCrCrD�read�szIO.readcCsdS)NrC)r[rCrCrD�readable�szIO.readable)�limitr:cCsdS)NrC)r[r~rCrCrD�readline�szIO.readline)�hintr:cCsdS)NrC)r[r�rCrCrD�	readlines�szIO.readlinesr)�offset�whencer:cCsdS)NrC)r[r�r�rCrCrD�seek�szIO.seekcCsdS)NrC)r[rCrCrD�seekable	szIO.seekablecCsdS)NrC)r[rCrCrD�tell	szIO.tell)�sizer:cCsdS)NrC)r[r�rCrCrD�truncate	szIO.truncatecCsdS)NrC)r[rCrCrD�writable	szIO.writable)�sr:cCsdS)NrC)r[r�rCrCrD�write	szIO.write)�linesr:cCsdS)NrC)r[r�rCrCrD�
writelines	sz
IO.writelinesz
IO[AnyStr]cCsdS)NrC)r[rCrCrDrK	szIO.__enter__cCsdS)NrC)r[rnr�rNrCrCrDrO	szIO.__exit__r�)r�r�)r�r�)r�)r)N)rArdr@rprrlrvrWrrwr�rxr<ryrzr{r5r|r}rr0r�r�r�r�r�r�r�r�rKrOrCrCrCrDru�sR
ruc@s>eZdZfZeeeefed�dd��Z	edd�dd��Z
dS)�BinaryIO)r�r:cCsdS)NrC)r[r�rCrCrDr�)	szBinaryIO.write)r:cCsdS)NrC)r[rCrCrDrK-	szBinaryIO.__enter__N)rArdr@rprrrB�	bytearrayr<r�rKrCrCrCrDr�$	s
r�c@s�eZdZfZeed�dd��Zeed�dd��Zee	ed�dd��Z
eed�dd	��Zee
d�d
d��Zedd�dd
��ZdS)�TextIO)r:cCsdS)NrC)r[rCrCrD�buffer7	sz
TextIO.buffercCsdS)NrC)r[rCrCrD�encoding;	szTextIO.encodingcCsdS)NrC)r[rCrCrD�errors?	sz
TextIO.errorscCsdS)NrC)r[rCrCrD�line_bufferingC	szTextIO.line_bufferingcCsdS)NrC)r[rCrCrD�newlinesG	szTextIO.newlinescCsdS)NrC)r[rCrCrDrKK	szTextIO.__enter__N)rArdr@rprr�r�rlr�rr�r�r�r
r�rrKrCrCrCrDr�2	sr�c@s"eZdZdddgZeZeZeZdS)�iorur�r�N)rArdr@�__all__rur�r�rCrCrCrDr�P	s
r�z.io�Patternr�cCs|jS)N)�pattern)r�rCrCrD�<lambda>^	sr��MatchcCs|jjS)N)�rer�)�mrCrCrDr�`	sc@seZdZddgZeZeZdS)r�r�r�N)rArdr@r�r�r�rCrCrCrDr�c	sr�z.re)rr)NN)NN)rrU)rr)rUr^rprcrdrer`rfrgrhri)rdrAr@r!)�r�rrrH�
contextlibr�r�Z	stdlib_rer>r��collections.abcZcollections_abc�ImportErrorr?�_collections_abcrrr	rnr�r^�__str__rlrQr�rErMrNrHrIrGrFrcr�rar|rSr�r
r�ZNoReturnrr�r�r�r�r�r�r�rBr5r�r�r�r�r�r�r�rr�rr�r�r�r�rr
r
r�r�rrmrrrr�rr6rr��BuiltinFunctionType�
MethodTyper'r(r7r9r:r.r;r/r�rr�r6r�r7r8r9rrr*r)r(r'r&r+r%r#rrGr1rr!rrr"r r<rrr0rIr-r�r�r2rrrr$rJrrSrT�execr�r.rVr/r,rWr4rX�
GeneratorTyperYrZrrbrlrmrnrjr3r8r<r=rur�r�r�rAr$rxr��matchr�rCrCrCrD�<module>s�
*%5C

W
!)

"96


R	D








"









"





"(`	



copy.cpython-36.pyc000064400000015651150335715140010160 0ustar003


 \o"�@sjdZddlZddlZddlmZGdd�de�ZeZyddlm	Z	Wne
k
r\dZ	YnXdddgZd	d�ZiZ
Zd
d�ZxHed�eeeeeeeeeeeejee�ee�ejejfD]Z eee <q�We!edd�Z e dk	r�eee <e"jee"<e#jee#<e$jee$<e%jee%<e	dk	�r"e	jee	<[[ dgfd
d�Z&iZ'Zdd�Z(e(eed�<e(eee�<e(eee�<e(ee<e(ee<e(ee<e(ee<e(ee<e(ee<ye(eej)<Wne*k
�r�YnXe(ee<e(eej<e(eej<e(eej<e&fdd�Z+e+ee"<e&fdd�Z,e,ee<e&fdd�Z-e-ee#<e	dk	�r2e-ee	<dd�Z.e.eej/<[dd�Z0ddde&fdd�Z1[[[	dS)a�Generic (shallow and deep) copying operations.

Interface summary:

        import copy

        x = copy.copy(y)        # make a shallow copy of y
        x = copy.deepcopy(y)    # make a deep copy of y

For module specific errors, copy.Error is raised.

The difference between shallow and deep copying is only relevant for
compound objects (objects that contain other objects, like lists or
class instances).

- A shallow copy constructs a new compound object and then (to the
  extent possible) inserts *the same objects* into it that the
  original contains.

- A deep copy constructs a new compound object and then, recursively,
  inserts *copies* into it of the objects found in the original.

Two problems often exist with deep copy operations that don't exist
with shallow copy operations:

 a) recursive objects (compound objects that, directly or indirectly,
    contain a reference to themselves) may cause a recursive loop

 b) because deep copy copies *everything* it may copy too much, e.g.
    administrative data structures that should be shared even between
    copies

Python's deep copy operation avoids these problems by:

 a) keeping a table of objects already copied during the current
    copying pass

 b) letting user-defined classes override the copying operation or the
    set of components copied

This version does not copy types like module, class, function, method,
nor stack trace, stack frame, nor file, socket, window, nor array, nor
any similar types.

Classes can use the same interfaces to control copying that they use
to control pickling: they can define methods called __getinitargs__(),
__getstate__() and __setstate__().  See the documentation for module
"pickle" for information on these methods.
�N)�dispatch_tablec@seZdZdS)�ErrorN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/copy.pyr7sr)�PyStringMap�copy�deepcopycCs�t|�}tj|�}|r||�Syt|t�}Wntk
rDd}YnX|rRt|�St|dd�}|rj||�Stj|�}|r�||�}n>t|dd�}|r�|d�}n$t|dd�}|r�|�}ntd|��t	|t
�r�|St|df|��S)zlShallow copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    F�__copy__N�
__reduce_ex__��
__reduce__z%un(shallow)copyable object of type %s)�type�_copy_dispatch�get�
issubclass�	TypeError�_copy_immutable�getattrrr�
isinstance�str�_reconstruct)�x�cls�copier�issc�reductor�rvrrrr
Bs4





cCs|S)Nr)rrrrrosr�CodeTypec
Cs8|dkri}t|�}|j||�}||k	r,|St|�}tj|�}|rN|||�}n�yt|t�}Wntk
rtd}YnX|r�t||�}n�t|dd�}|r�||�}nxtj|�}|r�||�}	n>t|dd�}|r�|d�}	n$t|dd�}|r�|�}	nt	d|��t
|	t��r|}nt||f|	��}||k	�r4|||<t
||�|S)ziDeep copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    Nr�__deepcopy__r
rrz"un(deep)copyable object of type %s)�idrr�_deepcopy_dispatchrr�_deepcopy_atomicrrrrrr�_keep_alive)
r�memoZ_nil�d�yrrrrrrrrr�sJ








cCs|S)Nr)rr&rrrr$�sr$cCs6g}||t|�<|j}x|D]}||||��qW|S)N)r"�append)rr&rr(r)�arrr�_deepcopy_list�s
r+csh��fdd�|D�}y�t|�Stk
r4YnXx,t||�D]\}}||k	rBt|�}PqBW|}|S)Ncsg|]}�|���qSrr)�.0r*)rr&rr�
<listcomp>�sz#_deepcopy_tuple.<locals>.<listcomp>)r"�KeyError�zip�tuple)rr&rr(�k�jr)rr&r�_deepcopy_tuple�sr3cCs>i}||t|�<x(|j�D]\}}|||�||||�<qW|S)N)r"�items)rr&rr(�key�valuerrr�_deepcopy_dict�s
r7cCst|�|jt|j|��S)N)r�__func__r�__self__)rr&rrr�_deepcopy_method�sr:cCs>y|t|�j|�Wn"tk
r8|g|t|�<YnXdS)aMKeeps a reference to the object x in the memo.

    Because we remember objects by their id, we have
    to assure that possibly temporary objects are kept
    alive by referencing them.
    We store a reference at the id of the memo, which should
    normally not be used unless someone tries to deepcopy
    the memo itself...
    N)r"r)r.)rr&rrrr%�s
r%csx�dk	}|r$|r$��fdd�|D�}||�}	|r<|	�t|�<|dk	r�|rR�|��}t|	d�rh|	j|�nbt|t�r�t|�dkr�|\}}
nd}
|dk	r�|	jj|�|
dk	r�x |
j�D]\}}t	|	||�q�W|dk	�r|r�x<|D]}
�|
��}
|	j
|
�q�Wnx|D]}
|	j
|
��qW|dk	�rt|�rXxL|D]&\}}�|��}�|��}||	|<�q,Wnx|D]\}}||	|<�q^W|	S)Nc3s|]}�|��VqdS)Nr)r,�arg)rr&rr�	<genexpr>sz_reconstruct.<locals>.<genexpr>�__setstate__�)r"�hasattrr=rr0�len�__dict__�updater4�setattrr))rr&�func�args�stateZlistiterZdictiterrZdeepr(Z	slotstater5r6�itemr)rr&rrsF









r)2�__doc__�types�weakref�copyregr�	Exceptionr�errorZorg.python.corer	�ImportError�__all__r
rr'rr�int�float�bool�complexrr0�bytes�	frozenset�range�slice�BuiltinFunctionType�Ellipsis�NotImplemented�FunctionType�ref�tr�list�dict�set�	bytearrayrr#r$r �AttributeErrorr+r3r7r:�
MethodTyper%rrrrr�<module>1s~

+






8




+bdb.cpython-36.opt-1.pyc000064400000041213150335715140010665 0ustar003


 \\�@s�dZddlZddlZddlZddlmZmZmZdddgZeeBeBZ	Gdd�de
�ZGdd�d�Zd	d
�Z
Gdd�d�Zdd
�Zdd�ZGdd�de�Zdd�Zdd�Zdd�ZdS)zDebugger basics�N)�CO_GENERATOR�CO_COROUTINE�CO_ASYNC_GENERATOR�BdbQuit�Bdb�
Breakpointc@seZdZdZdS)rz Exception to give up completely.N)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.6/bdb.pyr
sc@speZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd[d&d'�Zd\d(d)�Zd*d+�Zd,d-�Zd.d/�Zd]d0d1�Zd2d3�Zd4d5�Zd^d7d8�Zd9d:�Zd;d<�Zd=d>�Z d?d@�Z!dAdB�Z"dCdD�Z#dEdF�Z$dGdH�Z%dIdJ�Z&dKdL�Z'dMdN�Z(d_dPdQ�Z)d`dRdS�Z*dadTdU�Z+dVdW�Z,dXdY�Z-dS)brz�Generic Python debugger base class.

    This class takes care of details of the trace facility;
    a derived class should implement user interaction.
    The standard debugger class (pdb.Pdb) is an example.
    NcCs(|rt|�nd|_i|_i|_d|_dS)N)�set�skip�breaks�fncache�frame_returning)�selfrrrr
�__init__szBdb.__init__cCsR|d|dd�dkr|S|jj|�}|sNtjj|�}tjj|�}||j|<|S)N�<��>���)r�get�os�path�abspath�normcase)r�filename�canonicrrr
rs
zBdb.canoniccCs&ddl}|j�d|_|jdd�dS)Nr)�	linecache�
checkcache�botframe�
_set_stopinfo)rr rrr
�reset)sz	Bdb.resetcCs�|jr
dS|dkr|j|�S|dkr0|j||�S|dkrD|j||�S|dkrX|j||�S|dkrf|jS|dkrt|jS|dkr�|jStdt|��|jS)	N�lineZcall�returnZ	exceptionZc_callZc_exceptionZc_returnz*bdb.Bdb.dispatch: unknown debugging event:)�quitting�
dispatch_line�
dispatch_call�dispatch_return�dispatch_exception�trace_dispatch�print�repr)r�frameZevent�argrrr
r,/s$
zBdb.trace_dispatchcCs.|j|�s|j|�r(|j|�|jr(t�|jS)N)�	stop_here�
break_here�	user_liner'rr,)rr/rrr
r(Cs

zBdb.dispatch_linecCsd|jdkr|j|_|jS|j|�p*|j|�s0dS|jrH|jjt@rH|jS|j	||�|j
r^t�|jS)N)r"�f_backr,r1�break_anywhere�	stopframe�f_code�co_flags�GENERATOR_AND_COROUTINE_FLAGS�	user_callr'r)rr/r0rrr
r)Is
zBdb.dispatch_callcCs||j|�s||jkrv|jr,|jjt@r,|jSz||_|j||�Wdd|_X|j	rVt
�|j|krv|jdkrv|jdd�|jS)Nrr)
r1�returnframer6r7r8r9r,r�user_returnr'r�
stoplinenor#)rr/r0rrr
r*YszBdb.dispatch_returncCs�|j|�rF|jjt@o,|dtko,|ddks�|j||�|jr�t�nD|jr�||jk	r�|jjjt@r�|dtt	fkr�|j||�|jr�t�|j
S)Nr�)r1r7r8r9�
StopIteration�user_exceptionr'rr6�
GeneratorExitr,)rr/r0rrr
r+is
zBdb.dispatch_exceptioncCs$x|jD]}tj||�rdSqWdS)NTF)r�fnmatch)rZmodule_name�patternrrr
�is_skipped_module�szBdb.is_skipped_modulecCsN|jr|j|jjd��rdS||jkr@|jdkr4dS|j|jkS|jsJdSdS)NrFrTr)rrD�	f_globalsrr6r=�f_lineno)rr/rrr
r1�s

z
Bdb.stop_herecCs�|j|jj�}||jkrdS|j}||j|krJ|jj}||j|krJdSt|||�\}}|r�|j|_|r�|j	r�|j
t|j��dSdSdS)NFT)rr7�co_filenamerrF�co_firstlineno�	effective�numberZ	currentbp�	temporary�do_clear�str)rr/r�lineno�bp�flagrrr
r2�s

zBdb.break_herecCstd��dS)Nz)subclass of bdb must implement do_clear())�NotImplementedError)rr0rrr
rL�szBdb.do_clearcCs|j|jj�|jkS)N)rr7rGr)rr/rrr
r5�szBdb.break_anywherecCsdS)znThis method is called when there is the remote possibility
        that we ever need to stop in this function.Nr)rr/Z
argument_listrrr
r:�sz
Bdb.user_callcCsdS)z9This method is called when we stop or break at this line.Nr)rr/rrr
r3�sz
Bdb.user_linecCsdS)z5This method is called when a return trap is set here.Nr)rr/Zreturn_valuerrr
r<�szBdb.user_returncCsdS)zmThis method is called if an exception occurs,
        but only if we are to stop at or just below this level.Nr)rr/�exc_inforrr
r@�szBdb.user_exceptionrcCs||_||_d|_||_dS)NF)r6r;r'r=)rr6r;r=rrr
r#�szBdb._set_stopinfocCs$|dkr|jd}|j|||�dS)zxStop when the line with the line no greater than the current one is
        reached or when returning from current frameNr)rFr#)rr/rNrrr
�	set_until�s
z
Bdb.set_untilcCs2|jr"|jj}|r"|jr"|j|_|jdd�dS)zStop after one line of code.N)rr4�f_tracer,r#)rZcaller_framerrr
�set_step�s
zBdb.set_stepcCs|j|d�dS)z2Stop on the next line in or below the given frame.N)r#)rr/rrr
�set_next�szBdb.set_nextcCs.|jjt@r|j|dd�n|j|j|�dS)z)Stop when returning from the given frame.Nrr)r7r8r9r#r4)rr/rrr
�
set_return�szBdb.set_returncCsP|dkrtj�j}|j�x|r6|j|_||_|j}qW|j�tj|j�dS)zpStart debugging from `frame`.

        If frame is not specified, debugging starts from caller's frame.
        N)	�sys�	_getframer4r$r,rTr"rU�settrace)rr/rrr
�	set_trace�s

z
Bdb.set_tracecCsL|j|jdd�|jsHtjd�tj�j}x|rF||jk	rF|`|j}q,WdS)Nrr)r#r"rrXrZrYr4rT)rr/rrr
�set_continues

zBdb.set_continuecCs"|j|_d|_d|_tjd�dS)NT)r"r6r;r'rXrZ)rrrr
�set_quitszBdb.set_quitFc
Csb|j|�}ddl}|j||�}|s.d||fS|jj|g�}||krN|j|�t|||||�}	dS)NrzLine %s:%d does not exist)rr �getliner�
setdefault�appendr)
rrrNrK�cond�funcnamer r%�listrOrrr
�	set_breaks

z
Bdb.set_breakcCs4||ftjkr|j|j|�|j|s0|j|=dS)N)r�bplistr�remove)rrrNrrr
�
_prune_breaks$s
zBdb._prune_breakscCsn|j|�}||jkrd|S||j|kr6d||fSx&tj||fdd�D]}|j�qNW|j||�dS)NzThere are no breakpoints in %szThere is no breakpoint at %s:%d)rrrre�deleteMerg)rrrNrOrrr
�clear_break*s

zBdb.clear_breakcCsPy|j|�}Wn$tk
r2}zt|�Sd}~XnX|j�|j|j|j�dS)N)�get_bpbynumber�
ValueErrorrMrhrg�filer%)rr0rO�errrrr
�clear_bpbynumber6szBdb.clear_bpbynumbercCs`|j|�}||jkrd|Sx6|j|D](}tj||f}x|D]}|j�q@Wq(W|j|=dS)NzThere are no breakpoints in %s)rrrrerh)rrr%ZblistrOrrr
�clear_all_file_breaks>s


zBdb.clear_all_file_breakscCs0|js
dSxtjD]}|r|j�qWi|_dS)NzThere are no breakpoints)rr�
bpbynumberrh)rrOrrr
�clear_all_breaksHszBdb.clear_all_breakscCs�|std��yt|�}Wn tk
r8td|��YnXytj|}Wn tk
rhtd|��YnX|dkr~td|��|S)NzBreakpoint number expectedz Non-numeric breakpoint number %sz!Breakpoint number %d out of rangezBreakpoint %d already deleted)rk�intrrp�
IndexError)rr0rJrOrrr
rjPszBdb.get_bpbynumbercCs"|j|�}||jko ||j|kS)N)rr)rrrNrrr
�	get_break_s

z
Bdb.get_breakcCs4|j|�}||jkr0||j|kr0tj||fp2gS)N)rrrre)rrrNrrr
�
get_breaksds

zBdb.get_breakscCs&|j|�}||jkr|j|SgSdS)N)rr)rrrrr
�get_file_breaksjs


zBdb.get_file_breakscCs|jS)N)r)rrrr
�get_all_breaksqszBdb.get_all_breakscCs�g}|r|j|kr|j}x.|dk	rF|j||jf�||jkr>P|j}qW|j�tdt|�d�}x$|dk	r�|j|j|j	f�|j}qdW|dkr�tdt|�d�}||fS)Nrr)
�tb_frame�tb_nextr`rFr"r4�reverse�max�len�	tb_lineno)r�f�t�stack�irrr
�	get_stackws 




z
Bdb.get_stack�: cCs�ddl}ddl}|\}}|j|jj�}d||f}|jjrH||jj7}n|d7}d|jkrf|jd}	nd}	|	r~||j|	�7}n|d7}d|jkr�|jd}
|d7}||j|
�7}|j|||j	�}|r�|||j
�7}|S)Nrz%s(%r)z<lambda>Z__args__z()Z
__return__z->)r �reprlibrr7rG�co_name�f_localsr.r^rE�strip)rZframe_linenoZlprefixr r�r/rNr�s�args�rvr%rrr
�format_stack_entry�s*


zBdb.format_stack_entrycCs�|dkrddl}|j}|dkr"|}|j�t|t�r@t|dd�}tj|j�z*yt	|||�Wnt
k
rrYnXWdd|_tjd�XdS)Nrz<string>�execT)�__main__�__dict__r$�
isinstancerM�compilerXrZr,r�rr')r�cmd�globals�localsr�rrr
�run�s

zBdb.runcCst|dkrddl}|j}|dkr"|}|j�tj|j�z&yt|||�Stk
rXYnXWdd|_tjd�XdS)NrT)	r�r�r$rXrZr,�evalrr')r�exprr�r�r�rrr
�runeval�s
zBdb.runevalcCs|j|||�dS)N)r�)rr�r�r�rrr
�runctx�sz
Bdb.runctxcOsX|j�tj|j�d}z(y|||�}Wntk
r<YnXWdd|_tjd�X|S)NT)r$rXrZr,rr')r�funcr��kwds�resrrr
�runcall�s
zBdb.runcall)N)r)N)N)FNN)r�)NN)NN).rr	r
rrrr$r,r(r)r*r+rDr1r2rLr5r:r3r<r@r#rSrUrVrWr[r\r]rdrgrirnrorqrjrtrurvrwr�r�r�r�r�r�rrrr
rsX










cCst�j�dS)N)rr[rrrr
r[�sr[c@sZeZdZdZdZiZdgZddd�Zdd�Zd	d
�Z	dd�Z
dd
d�Zdd�Zdd�Z
dS)ra�Breakpoint class.

    Implements temporary breakpoints, ignore counts, disabling and
    (re)-enabling, and conditionals.

    Breakpoints are indexed by number through bpbynumber and by
    the file,line tuple using bplist.  The former points to a
    single instance of class Breakpoint.  The latter points to a
    list of such instances since there may be more than one
    breakpoint per line.

    rNFcCs�||_d|_||_||_||_||_d|_d|_d|_t	j
|_t	j
d7_
|jj
|�||f|jkr||j||fj
|�n|g|j||f<dS)NTrr)rb�func_first_executable_linerlr%rKra�enabled�ignore�hitsr�nextrJrpr`re)rrlr%rKrarbrrr
r�szBreakpoint.__init__cCs>|j|jf}d|j|j<|j|j|�|j|s:|j|=dS)N)rlr%rprJrerf)r�indexrrr
rhs

zBreakpoint.deleteMecCs
d|_dS)NT)r�)rrrr
�enableszBreakpoint.enablecCs
d|_dS)NF)r�)rrrr
�disableszBreakpoint.disablecCs"|dkrtj}t|j�|d�dS)N)rl)rX�stdoutr-�bpformat)r�outrrr
�bpprintszBreakpoint.bpprintcCs�|jrd}nd}|jr |d}n|d}d|j||j|jf}|jrT|d|jf7}|jrj|d|jf7}|jr�|jdkr�d	}nd
}|d|j|f7}|S)Nzdel  zkeep zyes  zno   z%-4dbreakpoint   %s at %s:%dz
	stop only if %sz
	ignore next %d hitsrr��z"
	breakpoint already hit %d time%s)rKr�rJrlr%rar�r�)rZdispZretZssrrr
r�s$

zBreakpoint.bpformatcCsd|j|j|jfS)Nzbreakpoint %s at %s:%s)rJrlr%)rrrr
�__str__6szBreakpoint.__str__)FNN)N)rr	r
rr�rerprrhr�r�r�r�r�rrrr
r�s

cCsN|js|j|jkrdSdS|jj|jkr,dS|js:|j|_|j|jkrJdSdS)z;Check whether we should break here because of `b.funcname`.FT)rbr%rFr7r�r�)�br/rrr
�
checkfuncname;sr�cCs�tj||f}x�|D]�}|js qt||�s,q|jd7_|jsf|jdkr\|jd8_qq�|dfSqy<t|j|j|j	�}|r�|jdkr�|jd8_n|dfSWq|dfSqWdS)z�Determine which breakpoint for this file:line is to be acted upon.

    Called only if we know there is a bpt at this
    location.  Returns breakpoint that was triggered and a flag
    that indicates if it is ok to delete a temporary bp.

    rrTFN)NN)
rrer�r�r�rar�r�rEr�)rlr%r/Z	possiblesr��valrrr
rIWs*




rIc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TdbcCs |jj}|sd}td||�dS)Nz???z+++ call)r7r�r-)rr/r��namerrr
r:�sz
Tdb.user_callcCsTddl}|jj}|sd}|j|jj�}|j||j|j�}td||j|d|j	��dS)Nrz???z+++�:)
r r7r�rrGr^rFrEr-r�)rr/r r��fnr%rrr
r3�sz
Tdb.user_linecCstd|�dS)Nz
+++ return)r-)rr/Zretvalrrr
r<�szTdb.user_returncCstd|�|j�dS)Nz
+++ exception)r-r\)rr/Z	exc_stuffrrr
r@�s
zTdb.user_exceptionN)rr	r
r:r3r<r@rrrr
r��sr�cCs&td|d�t|d�}td|�dS)Nzfoo(�)�
zbar returned)r-�bar)�n�xrrr
�foo�sr�cCstd|d�|dS)Nzbar(r�r>)r-)�arrr
r��sr�cCst�}|jd�dS)Nzimport bdb; bdb.foo(10))r�r�)rrrr
�test�sr�)rrBrXr�inspectrrr�__all__r9�	Exceptionrrr[rr�rIr�r�r�r�rrrr
�<module>s&
OZ0threading.cpython-36.opt-1.pyc000064400000107632150335715140012113 0ustar003

�\dh���@s�dZddlZddlZddlmZmZddl	m
Zddlm
Z
ddlmZmZyddlmZWn ek
r|ddlmZYnXdd	d
ddd
dddddddddddddddgZejZejZejZejZejZ y
ej!Z"Wne#k
r�dZ"YnXej$Z$[da%da&dd�Z'dd�Z(eZ)dd�Z!Gd d!�d!�Z*e*Z+Gd"d
�d
�Z,Gd#d�d�Z-Gd$d�de-�Z.Gd%d�d�Z/Gd&d�d�Z0Gd'd�de1�Z2e�j3Z4e4�d@d)d*�Z5e!�a6iZ7iZ8e
�Z9Gd+d�d�Z:Gd,d�de:�Z;Gd-d.�d.e:�Z<Gd/d0�d0e:�Z=d1d�Z>e>Z?d2d	�Z@e@ZAd3d4�ZBd5d�ZCdd6lmDZDe<�aEd7d8�ZFd9d:�ZGd;d
�ZHydd<lmIZJWn"ek
�rrdd=lKmJZJYnXd>d?�ZLdS)Az;Thread module emulating a subset of Java's threading model.�N)�	monotonic�sleep)�
format_exc)�WeakSet)�islice�count)�deque�	get_ident�active_count�	Condition�current_thread�	enumerate�main_thread�TIMEOUT_MAX�Event�Lock�RLock�	Semaphore�BoundedSemaphore�Thread�Barrier�BrokenBarrierError�Timer�ThreadError�
setprofile�settrace�local�
stack_sizecCs|adS)z�Set a profile function for all threads started from the threading module.

    The func will be passed to sys.setprofile() for each thread, before its
    run() method is called.

    N)�
_profile_hook)�func�r �!/usr/lib64/python3.6/threading.pyr2scCs|adS)z�Set a trace function for all threads started from the threading module.

    The func will be passed to sys.settrace() for each thread, before its run()
    method is called.

    N)�_trace_hook)rr r r!r<scOstdkrt||�St||�S)a2Factory function that returns a new reentrant lock.

    A reentrant lock must be released by the thread that acquired it. Once a
    thread has acquired a reentrant lock, the same thread may acquire it again
    without blocking; the thread must release it once for each time it has
    acquired it.

    N)�_CRLock�_PyRLock)�args�kwargsr r r!rJs	
c@sVeZdZdZdd�Zdd�Zddd	�ZeZd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)�_RLocka,This class implements reentrant lock objects.

    A reentrant lock must be released by the thread that acquired it. Once a
    thread has acquired a reentrant lock, the same thread may acquire it
    again without blocking; the thread must release it once for each time it
    has acquired it.

    cCst�|_d|_d|_dS)Nr)�_allocate_lock�_block�_owner�_count)�selfr r r!�__init__asz_RLock.__init__cCs^|j}yt|j}Wntk
r(YnXd|jj�r:dnd|jj|jj||j	t
t|��fS)Nz)<%s %s.%s object owner=%r count=%d at %s>�lockedZunlocked)r*�_active�name�KeyErrorr)r.�	__class__�
__module__�__qualname__r+�hex�id)r,�ownerr r r!�__repr__fsz_RLock.__repr__T�cCsDt�}|j|kr"|jd7_dS|jj||�}|r@||_d|_|S)aAcquire a lock, blocking or non-blocking.

        When invoked without arguments: if this thread already owns the lock,
        increment the recursion level by one, and return immediately. Otherwise,
        if another thread owns the lock, block until the lock is unlocked. Once
        the lock is unlocked (not owned by any thread), then grab ownership, set
        the recursion level to one, and return. If more than one thread is
        blocked waiting until the lock is unlocked, only one at a time will be
        able to grab ownership of the lock. There is no return value in this
        case.

        When invoked with the blocking argument set to true, do the same thing
        as when called without arguments, and return true.

        When invoked with the blocking argument set to false, do not block. If a
        call without an argument would block, return false immediately;
        otherwise, do the same thing as when called without arguments, and
        return true.

        When invoked with the floating-point timeout argument set to a positive
        value, block for at most the number of seconds specified by timeout
        and as long as the lock cannot be acquired.  Return true if the lock has
        been acquired, false if the timeout has elapsed.

        r9)r	r*r+r)�acquire)r,�blocking�timeout�me�rcr r r!r:us
z_RLock.acquirecCs<|jt�krtd��|jd|_}|s8d|_|jj�dS)amRelease a lock, decrementing the recursion level.

        If after the decrement it is zero, reset the lock to unlocked (not owned
        by any thread), and if any other threads are blocked waiting for the
        lock to become unlocked, allow exactly one of them to proceed. If after
        the decrement the recursion level is still nonzero, the lock remains
        locked and owned by the calling thread.

        Only call this method when the calling thread owns the lock. A
        RuntimeError is raised if this method is called when the lock is
        unlocked.

        There is no return value.

        zcannot release un-acquired lockr9N)r*r	�RuntimeErrorr+r)�release)r,rr r r!r@�sz_RLock.releasecCs|j�dS)N)r@)r,�t�v�tbr r r!�__exit__�sz_RLock.__exit__cCs|jj�|\|_|_dS)N)r)r:r+r*)r,�stater r r!�_acquire_restore�s
z_RLock._acquire_restorecCs<|jdkrtd��|j}d|_|j}d|_|jj�||fS)Nrzcannot release un-acquired lock)r+r?r*r)r@)r,rr7r r r!�
_release_save�s

z_RLock._release_savecCs|jt�kS)N)r*r	)r,r r r!�	_is_owned�sz_RLock._is_ownedN���)TrI)
�__name__r3r4�__doc__r-r8r:�	__enter__r@rDrFrGrHr r r r!r'Ws
$
r'c@steZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
ddd�Zddd�Zddd�Z
dd�ZeZdS)rajClass that implements a condition variable.

    A condition variable allows one or more threads to wait until they are
    notified by another thread.

    If the lock argument is given and not None, it must be a Lock or RLock
    object, and it is used as the underlying lock. Otherwise, a new RLock object
    is created and used as the underlying lock.

    NcCs�|dkrt�}||_|j|_|j|_y|j|_Wntk
rDYnXy|j|_Wntk
rfYnXy|j|_Wntk
r�YnXt�|_	dS)N)
r�_lockr:r@rG�AttributeErrorrFrH�_deque�_waiters)r,�lockr r r!r-�s$zCondition.__init__cCs
|jj�S)N)rMrL)r,r r r!rL�szCondition.__enter__cGs|jj|�S)N)rMrD)r,r%r r r!rD�szCondition.__exit__cCsd|jt|j�fS)Nz<Condition(%s, %d)>)rM�lenrP)r,r r r!r8�szCondition.__repr__cCs|jj�dS)N)rMr@)r,r r r!rG�szCondition._release_savecCs|jj�dS)N)rMr:)r,�xr r r!rF�szCondition._acquire_restorecCs"|jjd�r|jj�dSdSdS)NrFT)rMr:r@)r,r r r!rH�s
zCondition._is_ownedcCs�|j�std��t�}|j�|jj|�|j�}d}z�|dkrN|j�d}nj|dkr�t�|}d}xR|jd�}|rvPt|t�|�}|dkr�Pt|d|d�}t	|�qfWn
|jd�}|S|j
|�|s�y|jj|�Wntk
r�YnXXdS)	akWait until notified or until a timeout occurs.

        If the calling thread has not acquired the lock when this method is
        called, a RuntimeError is raised.

        This method releases the underlying lock, and then blocks until it is
        awakened by a notify() or notify_all() call for the same condition
        variable in another thread, or until the optional timeout occurs. Once
        awakened or timed out, it re-acquires the lock and returns.

        When the timeout argument is present and not None, it should be a
        floating point number specifying a timeout for the operation in seconds
        (or fractions thereof).

        When the underlying lock is an RLock, it is not released using its
        release() method, since this may not actually unlock the lock when it
        was acquired multiple times recursively. Instead, an internal interface
        of the RLock class is used, which really unlocks it even when it has
        been recursively acquired several times. Another internal interface is
        then used to restore the recursion level when the lock is reacquired.

        zcannot wait on un-acquired lockFNTrg����Mb@?�g�������?)
rHr?r(r:rP�appendrG�_time�min�_sleeprF�remove�
ValueError)r,r<�waiterZsaved_stateZgotit�endtimeZdelayZ	remainingr r r!�waits>	



zCondition.waitcCs\d}|}|�}xH|sV|dk	rD|dkr0t�|}n|t�}|dkrDP|j|�|�}qW|S)z�Wait until a condition evaluates to True.

        predicate should be a callable which result will be interpreted as a
        boolean value.  A timeout may be provided giving the maximum time to
        wait.

        Nr)rVr])r,Z	predicater<r\Zwaittime�resultr r r!�wait_forIs


zCondition.wait_forr9cCsj|j�std��|j}tt||��}|s,dSx8|D]0}|j�y|j|�Wq2tk
r`Yq2Xq2WdS)aKWake up one or more threads waiting on this condition, if any.

        If the calling thread has not acquired the lock when this method is
        called, a RuntimeError is raised.

        This method wakes up at most n of the threads waiting for the condition
        variable; it is a no-op if no threads are waiting.

        z!cannot notify on un-acquired lockN)rHr?rPrO�_islicer@rYrZ)r,�nZall_waitersZwaiters_to_notifyr[r r r!�notify`s

zCondition.notifycCs|jt|j��dS)z�Wake up all threads waiting on this condition.

        If the calling thread has not acquired the lock when this method
        is called, a RuntimeError is raised.

        N)rbrRrP)r,r r r!�
notify_allwszCondition.notify_all)N)N)N)r9)rJr3r4rKr-rLrDr8rGrFrHr]r_rbrcZ	notifyAllr r r r!r�s

	
B

	c@s8eZdZdZd
dd�Zddd�ZeZd	d
�Zdd�ZdS)raGThis class implements semaphore objects.

    Semaphores manage a counter representing the number of release() calls minus
    the number of acquire() calls, plus an initial value. The acquire() method
    blocks if necessary until it can return without making the counter
    negative. If not given, value defaults to 1.

    r9cCs&|dkrtd��tt��|_||_dS)Nrz$semaphore initial value must be >= 0)rZrr�_cond�_value)r,�valuer r r!r-�szSemaphore.__init__TNc
Cs�|r|dk	rtd��d}d}|j�jxb|jdkrv|s8P|dk	rh|dkrTt�|}n|t�}|dkrhP|jj|�q(W|jd8_d}WdQRX|S)a�Acquire a semaphore, decrementing the internal counter by one.

        When invoked without arguments: if the internal counter is larger than
        zero on entry, decrement it by one and return immediately. If it is zero
        on entry, block, waiting until some other thread has called release() to
        make it larger than zero. This is done with proper interlocking so that
        if multiple acquire() calls are blocked, release() will wake exactly one
        of them up. The implementation may pick one at random, so the order in
        which blocked threads are awakened should not be relied on. There is no
        return value in this case.

        When invoked with blocking set to true, do the same thing as when called
        without arguments, and return true.

        When invoked with blocking set to false, do not block. If a call without
        an argument would block, return false immediately; otherwise, do the
        same thing as when called without arguments, and return true.

        When invoked with a timeout other than None, it will block for at
        most timeout seconds.  If acquire does not complete successfully in
        that interval, return false.  Return true otherwise.

        Nz.can't specify timeout for non-blocking acquireFrr9T)rZrdrerVr])r,r;r<r>r\r r r!r:�s$
zSemaphore.acquirec
Cs.|j�|jd7_|jj�WdQRXdS)z�Release a semaphore, incrementing the internal counter by one.

        When the counter is zero on entry and another thread is waiting for it
        to become larger than zero again, wake up that thread.

        r9N)rdrerb)r,r r r!r@�szSemaphore.releasecCs|j�dS)N)r@)r,rArBrCr r r!rD�szSemaphore.__exit__)r9)TN)	rJr3r4rKr-r:rLr@rDr r r r!r�s

-c@s"eZdZdZddd�Zdd�ZdS)	ra�Implements a bounded semaphore.

    A bounded semaphore checks to make sure its current value doesn't exceed its
    initial value. If it does, ValueError is raised. In most situations
    semaphores are used to guard resources with limited capacity.

    If the semaphore is released too many times it's a sign of a bug. If not
    given, value defaults to 1.

    Like regular semaphores, bounded semaphores manage a counter representing
    the number of release() calls minus the number of acquire() calls, plus an
    initial value. The acquire() method blocks if necessary until it can return
    without making the counter negative. If not given, value defaults to 1.

    r9cCstj||�||_dS)N)rr-�_initial_value)r,rfr r r!r-�szBoundedSemaphore.__init__c
CsB|j�2|j|jkrtd��|jd7_|jj�WdQRXdS)a6Release a semaphore, incrementing the internal counter by one.

        When the counter is zero on entry and another thread is waiting for it
        to become larger than zero again, wake up that thread.

        If the number of releases exceeds the number of acquires,
        raise a ValueError.

        z!Semaphore released too many timesr9N)rdrergrZrb)r,r r r!r@�s

zBoundedSemaphore.releaseN)r9)rJr3r4rKr-r@r r r r!r�s
c@sFeZdZdZdd�Zdd�Zdd�ZeZdd	�Zd
d�Z	dd
d�Z
dS)rz�Class implementing event objects.

    Events manage a flag that can be set to true with the set() method and reset
    to false with the clear() method. The wait() method blocks until the flag is
    true.  The flag is initially false.

    cCstt��|_d|_dS)NF)rrrd�_flag)r,r r r!r-szEvent.__init__cCs|jjt��dS)N)rdr-r)r,r r r!�_reset_internal_locksszEvent._reset_internal_lockscCs|jS)z5Return true if and only if the internal flag is true.)rh)r,r r r!�is_setszEvent.is_setc	Cs&|j�d|_|jj�WdQRXdS)z�Set the internal flag to true.

        All threads waiting for it to become true are awakened. Threads
        that call wait() once the flag is true will not block at all.

        TN)rdrhrc)r,r r r!�setsz	Event.setc	Cs|j�d|_WdQRXdS)z�Reset the internal flag to false.

        Subsequently, threads calling wait() will block until set() is called to
        set the internal flag to true again.

        FN)rdrh)r,r r r!�clearszEvent.clearNc	Cs,|j�|j}|s|jj|�}|SQRXdS)aHBlock until the internal flag is true.

        If the internal flag is true on entry, return immediately. Otherwise,
        block until another thread calls set() to set the flag to true, or until
        the optional timeout occurs.

        When the timeout argument is present and not None, it should be a
        floating point number specifying a timeout for the operation in seconds
        (or fractions thereof).

        This method returns the internal flag on exit, so it will always return
        True except if a timeout is given and the operation times out.

        N)rdrhr])r,r<Zsignaledr r r!r]'s
z
Event.wait)N)rJr3r4rKr-rirjZisSetrkrlr]r r r r!r�s
c@s�eZdZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Ze
dd��Ze
dd��Ze
dd��ZdS)rz�Implements a Barrier.

    Useful for synchronizing a fixed number of threads at known synchronization
    points.  Threads block on 'wait()' and are simultaneously once they have all
    made that call.

    NcCs.tt��|_||_||_||_d|_d|_dS)aWCreate a barrier, initialised to 'parties' threads.

        'action' is a callable which, when supplied, will be called by one of
        the threads after they have all entered the barrier and just prior to
        releasing them all. If a 'timeout' is provided, it is uses as the
        default for all subsequent 'wait()' calls.

        rN)rrrd�_action�_timeout�_parties�_stater+)r,�parties�actionr<r r r!r-Qs	zBarrier.__init__cCs�|dkr|j}|j�b|j�|j}|jd7_z&|d|jkrL|j�n
|j|�|S|jd8_|j�XWdQRXdS)aNWait for the barrier.

        When the specified number of threads have started waiting, they are all
        simultaneously awoken. If an 'action' was provided for the barrier, one
        of the threads will have executed that callback prior to returning.
        Returns an individual index number from 0 to 'parties-1'.

        Nr9)rnrd�_enterr+ro�_release�_wait�_exit)r,r<�indexr r r!r]as	

zBarrier.waitcCs,x|jdkr|jj�qW|jdkr(t�dS)Nr9rrI)rIr9)rprdr]r)r,r r r!rss

zBarrier._enterc	Cs>y"|jr|j�d|_|jj�Wn|j��YnXdS)Nr9)rmrprdrc�_break)r,r r r!rt�szBarrier._releasecs4�jj�fdd�|�s"�j�t��jdkr0t�dS)Ncs
�jdkS)Nr)rpr )r,r r!�<lambda>�szBarrier._wait.<locals>.<lambda>r)rdr_rxrrp)r,r<r )r,r!ru�s
z
Barrier._waitcCs(|jdkr$|jdkr$d|_|jj�dS)Nrr9rI)rIr9)r+rprdrc)r,r r r!rv�s

z
Barrier._exitc	CsT|j�D|jdkr6|jdkr$d|_q<|jdkr<d|_nd|_|jj�WdQRXdS)z�Reset the barrier to the initial state.

        Any threads currently waiting will get the BrokenBarrier exception
        raised.

        rr9rTNrI���rI)rdr+rprc)r,r r r!�reset�s


z
Barrier.resetc	Cs|j�|j�WdQRXdS)z�Place the barrier into a 'broken' state.

        Useful in case of error.  Any currently waiting threads and threads
        attempting to 'wait()' will have BrokenBarrierError raised.

        N)rdrx)r,r r r!�abort�sz
Barrier.abortcCsd|_|jj�dS)NrTrz)rprdrc)r,r r r!rx�szBarrier._breakcCs|jS)z:Return the number of threads required to trip the barrier.)ro)r,r r r!rq�szBarrier.partiescCs|jdkr|jSdS)z>Return the number of threads currently waiting at the barrier.r)rpr+)r,r r r!�	n_waiting�s
zBarrier.n_waitingcCs
|jdkS)z0Return True if the barrier is in a broken state.rTrz)rp)r,r r r!�broken�szBarrier.broken)NN)N)rJr3r4rKr-r]rsrtrurvr{r|rx�propertyrqr}r~r r r r!rHs


	c@seZdZdS)rN)rJr3r4r r r r!r�s�	Thread-%dcCs
|t�S)N)�_counter)�templater r r!�_newname�sr�c@seZdZdZdZejZdddfdfdd�dd�Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd3dd�Zd5dd �Zed!d"��Zejd#d"��Zed$d%��Zd&d'�ZeZed(d)��Zejd*d)��Zd+d,�Zd-d.�Zd/d0�Zd1d2�ZdS)6raA class that represents a thread of control.

    This class can be safely subclassed in a limited fashion. There are two ways
    to specify the activity: by passing a callable object to the constructor, or
    by overriding the run() method in a subclass.

    FN)�daemoncCs~|dkri}||_t|pt��|_||_||_|dk	r>||_n
t�j|_d|_	d|_
t�|_d|_
d|_tj|_tj|�dS)aKThis constructor should always be called with keyword arguments. Arguments are:

        *group* should be None; reserved for future extension when a ThreadGroup
        class is implemented.

        *target* is the callable object to be invoked by the run()
        method. Defaults to None, meaning nothing is called.

        *name* is the thread name. By default, a unique name is constructed of
        the form "Thread-N" where N is a small decimal number.

        *args* is the argument tuple for the target invocation. Defaults to ().

        *kwargs* is a dictionary of keyword arguments for the target
        invocation. Defaults to {}.

        If a subclass overrides the constructor, it must make sure to invoke
        the base class constructor (Thread.__init__()) before doing anything
        else to the thread.

        NFT)�_target�strr��_name�_args�_kwargs�	_daemonicrr��_ident�_tstate_lockr�_started�_is_stopped�_initialized�_sys�stderr�_stderr�	_dangling�add)r,�group�targetr0r%r&r�r r r!r-
s 
zThread.__init__cCs(|jj�|r|j�nd|_d|_dS)NT)r�ri�_set_tstate_lockr�r�)r,�is_aliver r r!ri7s


zThread._reset_internal_lockscCs^d}|jj�rd}|j�|jr$d}|jr2|d7}|jdk	rJ|d|j7}d|jj|j|fS)N�initialZstartedZstoppedz daemonz %sz<%s(%s, %s)>)	r�rjr�r�r�r�r2rJr�)r,Zstatusr r r!r8Cs

zThread.__repr__cCs�|jstd��|jj�r td��t�|t|<WdQRXyt|jf�Wn,tk
rtt�t|=WdQRX�YnX|jj	�dS)a-Start the thread's activity.

        It must be called at most once per thread object. It arranges for the
        object's run() method to be invoked in a separate thread of control.

        This method will raise a RuntimeError if called more than once on the
        same thread object.

        zthread.__init__() not calledz threads can only be started onceN)
r�r?r�rj�_active_limbo_lock�_limbo�_start_new_thread�
_bootstrap�	Exceptionr])r,r r r!�startQs

zThread.startc
Cs.z|jr|j|j|j�Wd|`|`|`XdS)aXMethod representing the thread's activity.

        You may override this method in a subclass. The standard run() method
        invokes the callable object passed to the object's constructor as the
        target argument, if any, with sequential and keyword arguments taken
        from the args and kwargs arguments, respectively.

        N)r�r�r�)r,r r r!�runjs	z
Thread.runc	Cs2y|j�Wn |jr&tdkr&dS�YnXdS)N)�_bootstrap_innerr�r�)r,r r r!r�{s
zThread._bootstrapcCst�|_dS)N)r	r�)r,r r r!�
_set_ident�szThread._set_identcCst�|_|jj�dS)z�
        Set a lock object which will be released by the interpreter when
        the underlying thread state (see pystate.h) gets deleted.
        N)�
_set_sentinelr�r:)r,r r r!r��szThread._set_tstate_lockc2Cs��zT|j�|j�|jj�t�|t|j<t|=WdQRXtrLt	j
t�trZt	jt�z�y|j
�Wn�tk
r|Yn�t	r�t	jdk	r�td|jt�ft	jd�n�|jdk	�rH|j�\}}}zxtd|jd|jd�td|jd�x6|�r$td|jjj|j|jjjf|jd�|j}q�Wtd||f|jd�Wd~~~XYnXWdXWdt� ytt�=WnYnXWdQRXXdS)NzException in thread %s:
%s)�filezException in thread z2 (most likely raised during interpreter shutdown):z"Traceback (most recent call last):z  File "%s", line %s, in %sz%s: %s)r�r�r�rkr�r/r�r�r"r�rrrr��
SystemExitr��printr0�_format_excr��	_exc_info�tb_frame�f_code�co_filename�	tb_lineno�co_name�tb_nextr	)r,�exc_type�	exc_valueZexc_tbr r r!r��sT




zThread._bootstrap_innercCs|j}|dk	rd|_d|_dS)NT)r�r�)r,rQr r r!�_stop�szThread._stopcCsByt�tt�=WdQRXWn tk
r<dtjkr8�YnXdS)zARemove current thread from the dict of currently running threads.NZdummy_threading)r�r/r	r1r��modules)r,r r r!�_delete�s
zThread._deletecCsZ|jstd��|jj�s td��|t�kr2td��|dkrD|j�n|jt|d�d�dS)aWait until the thread terminates.

        This blocks the calling thread until the thread whose join() method is
        called terminates -- either normally or through an unhandled exception
        or until the optional timeout occurs.

        When the timeout argument is present and not None, it should be a
        floating point number specifying a timeout for the operation in seconds
        (or fractions thereof). As join() always returns None, you must call
        isAlive() after join() to decide whether a timeout happened -- if the
        thread is still alive, the join() call timed out.

        When the timeout argument is not present or None, the operation will
        block until the thread terminates.

        A thread can be join()ed many times.

        join() raises a RuntimeError if an attempt is made to join the current
        thread as that would cause a deadlock. It is also an error to join() a
        thread before it has been started and attempts to do so raises the same
        exception.

        zThread.__init__() not calledz'cannot join thread before it is startedzcannot join current threadNr)r<)r�r?r�rjr�_wait_for_tstate_lock�max)r,r<r r r!�joins


zThread.joinTr9cCs0|j}|dkrn|j||�r,|j�|j�dS)N)r�r:r@r�)r,�blockr<rQr r r!r�;szThread._wait_for_tstate_lockcCs|jS)z�A string used for identification purposes only.

        It has no semantics. Multiple threads may be given the same name. The
        initial name is set by the constructor.

        )r�)r,r r r!r0Is	zThread.namecCst|�|_dS)N)r�r�)r,r0r r r!r0TscCs|jS)a4Thread identifier of this thread or None if it has not been started.

        This is a nonzero integer. See the get_ident() function. Thread
        identifiers may be recycled when a thread exits and another thread is
        created. The identifier is available even after the thread has exited.

        )r�)r,r r r!�identYs
zThread.identcCs(|js|jj�rdS|jd�|jS)z�Return whether the thread is alive.

        This method returns True just before the run() method starts until just
        after the run() method terminates. The module function enumerate()
        returns a list of all alive threads.

        F)r�r�rjr�)r,r r r!r�es	
zThread.is_alivecCs|jS)a�A boolean value indicating whether this thread is a daemon thread.

        This must be set before start() is called, otherwise RuntimeError is
        raised. Its initial value is inherited from the creating thread; the
        main thread is not a daemon thread and therefore all threads created in
        the main thread default to daemon = False.

        The entire Python program exits when no alive non-daemon threads are
        left.

        )r�)r,r r r!r�usz
Thread.daemoncCs*|jstd��|jj�r td��||_dS)NzThread.__init__() not calledz)cannot set daemon status of active thread)r�r?r�rjr�)r,�daemonicr r r!r��s

cCs|jS)N)r�)r,r r r!�isDaemon�szThread.isDaemoncCs
||_dS)N)r�)r,r�r r r!�	setDaemon�szThread.setDaemoncCs|jS)N)r0)r,r r r!�getName�szThread.getNamecCs
||_dS)N)r0)r,r0r r r!�setName�szThread.setName)NrI)TrI) rJr3r4rKr�r��exc_infor�r-rir8r�r�r�r�r�r�r�r�r�r�rr0�setterr�r�ZisAliver�r�r�r�r�r r r r!r�s8,A#
&
c@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
rz�Call a function after a specified number of seconds:

            t = Timer(30.0, f, args=None, kwargs=None)
            t.start()
            t.cancel()     # stop the timer's action if it's still waiting

    NcCsFtj|�||_||_|dk	r"|ng|_|dk	r4|ni|_t�|_dS)N)rr-�interval�functionr%r&r�finished)r,r�r�r%r&r r r!r-�s
zTimer.__init__cCs|jj�dS)z)Stop the timer if it hasn't finished yet.N)r�rk)r,r r r!�cancel�szTimer.cancelcCs6|jj|j�|jj�s(|j|j|j�|jj�dS)N)r�r]r�rjr�r%r&rk)r,r r r!r��s
z	Timer.run)NN)rJr3r4rKr-r�r�r r r r!r�s
c@seZdZdd�ZdS)�_MainThreadc
CsHtj|ddd�|j�|jj�|j�t�|t|j<WdQRXdS)NZ
MainThreadF)r0r�)	rr-r�r�rkr�r�r/r�)r,r r r!r-�s
z_MainThread.__init__N)rJr3r4r-r r r r!r��sr�c@s.eZdZdd�Zdd�Zdd�Zd
dd	�ZdS)�_DummyThreadc
CsDtj|td�dd�|jj�|j�t�|t|j<WdQRXdS)NzDummy-%dT)r0r�)	rr-r�r�rkr�r�r/r�)r,r r r!r-�s

z_DummyThread.__init__cCsdS)Nr )r,r r r!r��sz_DummyThread._stopcCsdS)NTr )r,r r r!r��sz_DummyThread.is_aliveNcCsdS)Nr )r,r<r r r!r��sz_DummyThread.join)N)rJr3r4r-r�r�r�r r r r!r��sr�cCs&y
tt�Stk
r t�SXdS)z�Return the current Thread object, corresponding to the caller's thread of control.

    If the caller's thread of control was not created through the threading
    module, a dummy thread object with limited functionality is returned.

    N)r/r	r1r�r r r r!r�s
c
Cs t�tt�tt�SQRXdS)z�Return the number of Thread objects currently alive.

    The returned count is equal to the length of the list returned by
    enumerate().

    N)r�rRr/r�r r r r!r
�scCsttj��ttj��S)N)�listr/�valuesr�r r r r!�
_enumerate�sr�c
Cs(t�ttj��ttj��SQRXdS)z�Return a list of all Thread objects currently alive.

    The list includes daemonic threads, dummy thread objects created by
    current_thread(), and the main thread. It excludes terminated threads and
    threads that have not yet been started.

    N)r�r�r/r�r�r r r r!r
s)rcCs8tj}|j�tj�t�}x|r2|j�t�}qWdS)N)�_main_threadr�r@r��_pickSomeNonDaemonThreadr�)ZtlockrAr r r!�	_shutdownsr�cCs(x"t�D]}|jr|j�r|SqWdS)N)r
r�r�)rAr r r!r�&sr�cCstS)z�Return the main thread object.

    In normal conditions, the main thread is the thread from which the
    Python interpreter was started.
    )r�r r r r!r,s)�_local)rcCs�t�ai}t�}|at�|tt��}|jt�xF|D]>}||kr`|jd�t	�}||_
|||<q4|jd�|j�q4Wtj
�tj
�tj|�WdQRXdS)NTF)rr�rr�rkr��updater�rir	r�r�r�rlr/)Z
new_activeZcurrentZthreadsZthreadr�r r r!�_after_fork=s&






r�)r�)MrK�sysr��_threadZtimerrVrrX�	tracebackrr��_weakrefsetr�	itertoolsrr`rr+�_collectionsrrO�ImportError�collections�__all__�start_new_threadr��
allocate_lockr(r�r	�errorrrr#rNrrr"rrrr'r$rrrrrr?r�__next__r�r�r�r/r�r�rrr�r�rZ
currentThreadr
ZactiveCountr�r
rr�r�r�rr�rZ_threading_localr�r r r r!�<module>s�



q9P&O
'
netrc.cpython-36.opt-2.pyc000064400000007020150335715140011250 0ustar003


 \4�@sTddlZddlZddlZddgZGdd�de�ZGdd�d�ZedkrPee��dS)�N�netrc�NetrcParseErrorc@seZdZddd�Zdd�ZdS)rNcCs"||_||_||_tj||�dS)N)�filename�lineno�msg�	Exception�__init__)�selfrrr�r
�/usr/lib64/python3.6/netrc.pyrszNetrcParseError.__init__cCsd|j|j|jfS)Nz%s (%s, line %s))rrr)r	r
r
r�__str__szNetrcParseError.__str__)NN)�__name__�
__module__�__qualname__rrr
r
r
rr
s
c@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)rNcCsx|dk}|dkrFytjjtjdd�}Wntk
rDtd��YnXi|_i|_t|��}|j	|||�WdQRXdS)N�HOMEz.netrcz'Could not find .netrc: $HOME is not set)
�os�path�join�environ�KeyError�OSError�hosts�macros�open�_parse)r	�file�
default_netrc�fpr
r
rrs
znetrc.__init__cCs�tj|�}|jd7_|jjdd�|_�x�|j}|j�}}|sFPn�|ddkrv|j|kr,t|�dkr,|jj�q,n�|dkr�|j�}nz|dkr�d}nl|dkr�|j�}g|j	|<d	|_
x4|jj�}	|	s�|	d
kr�d|_
P|j	|j|	�q�Wq,ntd|||j��d}
d}}i|j
|<�x�|j�}|jd��s:|dk�r~|�r^|
||f|j
|<|j|�Pntd
||t|�f||j���q|dk�s�|dk�r�|j�}
�q|dk�r�|j�}�q|dk�r�tjdk�r�|�r�tj|j��}
|
jtj�k�r|ddl}y|j|
j�d}Wn tk
�r*d|
j}YnXy|jtj��d}Wn"tk
�rddtj�}YnXtd||f||j��|
jtjtjB@�r�td||j��|j�}ntd|||j���qWq,WdS)Nz !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~�#�r��machine�default�macdefz 	�
z 	
zbad toplevel token %rz&malformed %s entry %s terminated by %s�login�user�account�password�posixzuid %sz9~/.netrc file owner (%s) does not match current user (%s)zY~/.netrc access too permissive: access permissions must restrict access to only the ownerzbad follower token %r>rr"r!r#)�shlexZ	wordcharsZ
commenters�replacerZ	get_token�lenZinstream�readlinerZ
whitespace�appendrr�
startswithZ
push_token�reprr�name�fstat�fileno�st_uid�getuid�pwd�getpwuidr�st_mode�stat�S_IRWXG�S_IRWXO)r	rrrZlexerZsaved_linenoZtoplevelZttZ	entryname�liner%r'r(Zpropr6Zfownerr&r
r
rr#s�












znetrc._parsecCs0||jkr|j|Sd|jkr(|jdSdSdS)Nr")r)r	�hostr
r
r�authenticatorsts




znetrc.authenticatorscCs�d}xf|jj�D]X}|j|}|d|�d|d�d�7}|drT|d|d�d�7}|d|d	�d�7}qWxF|jj�D]8}|d
|�d�7}x|j|D]}||7}q�W|d7}qxW|S)Nrzmachine z
	login rr$r z		account z
	password �zmacdef )r�keysr)r	Zrepr=ZattrsZmacror<r
r
r�__repr__}s
znetrc.__repr__)N)r
rrrrr>rAr
r
r
rrs
Q	�__main__)	rr*r9�__all__rrrr
�printr
r
r
r�<module>s
wsite.cpython-36.pyc000064400000037751150335715140010157 0ustar003

�\dhS�@sdZddlZddlZddlZddlZejejgadada	da
dd�Zdd�Zdd�Z
d	d
�Zdd�Zd.d
d�Zdd�Zdd�Zdd�Zdd�Zd/dd�Zd0dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zejj s�e�d+d,�Z!e"d-k�re!�dS)1a�Append module search paths for third-party packages to sys.path.

****************************************************************
* This module is automatically imported during initialization. *
****************************************************************

This will append site-specific paths to the module search path.  On
Unix (including Mac OSX), it starts with sys.prefix and
sys.exec_prefix (if different) and appends
lib/python<version>/site-packages.
On other platforms (such as Windows), it tries each of the
prefixes directly, as well as with lib/site-packages appended.  The
resulting directories, if they exist, are appended to sys.path, and
also inspected for path configuration files.

If a file named "pyvenv.cfg" exists one directory above sys.executable,
sys.prefix and sys.exec_prefix are set to that directory and
it is also checked for site-packages (sys.base_prefix and
sys.base_exec_prefix will always be the "real" prefixes of the Python
installation). If "pyvenv.cfg" (a bootstrap configuration file) contains
the key "include-system-site-packages" set to anything other than "false"
(case-insensitive), the system-level prefixes will still also be
searched for site-packages; otherwise they won't.

All of the resulting site-specific directories, if they exist, are
appended to sys.path, and also inspected for path configuration
files.

A path configuration file is a file whose name has the form
<package>.pth; its contents are additional directories (one per line)
to be added to sys.path.  Non-existing directories (or
non-directories) are never added to sys.path; no directory is added to
sys.path more than once.  Blank lines and lines beginning with
'#' are skipped. Lines starting with 'import' are executed.

For example, suppose sys.prefix and sys.exec_prefix are set to
/usr/local and there is a directory /usr/local/lib/python2.5/site-packages
with three subdirectories, foo, bar and spam, and two path
configuration files, foo.pth and bar.pth.  Assume foo.pth contains the
following:

  # foo package configuration
  foo
  bar
  bletch

and bar.pth contains:

  # bar package configuration
  bar

Then the following directories are added to sys.path, in this order:

  /usr/local/lib/python2.5/site-packages/bar
  /usr/local/lib/python2.5/site-packages/foo

Note that bletch is omitted because it doesn't exist; bar precedes foo
because bar.pth comes alphabetically before foo.pth; and spam is
omitted because it is not mentioned in either path configuration file.

The readline module is also automatically configured to enable
completion for systems that support it.  This can be overridden in
sitecustomize, usercustomize or PYTHONSTARTUP.  Starting Python in
isolated mode (-I) disables automatic readline configuration.

After these operations, an attempt is made to import a module
named sitecustomize, which can perform arbitrary additional
site-specific customizations.  If this import fails with an
ImportError exception, it is silently ignored.
�NcGsBtjj|�}ytjj|�}Wntk
r0YnX|tjj|�fS)N)�os�path�join�abspath�OSError�normcase)�paths�dir�r
�/usr/lib64/python3.6/site.py�makepathZsrcCs�x�ttjj��D]~}tt|dd�dd�dkr.qytjj|j�|_Wnt	t
tfk
r\YnXytjj|j�|_Wqt	t
tfk
r�YqXqWdS)zESet all module __file__ and __cached__ attributes to an absolute path�
__loader__N�
__module__�_frozen_importlib�_frozen_importlib_external)rr)
�set�sys�modules�values�getattrrrr�__file__�AttributeErrorr�	TypeError�
__cached__)�mr
r
r�	abs_pathscsrcCsTg}t�}x6tjD],}t|�\}}||kr|j|�|j|�qW|tjdd�<|S)zK Remove duplicate entries from sys.path along with making them
    absoluteN)rrrr�append�add)�L�known_pathsr	�dircaser
r
r�removeduppathsss
r!cCsXt�}xLtjD]B}y&tjj|�r6t|�\}}|j|�Wqtk
rNwYqXqW|S)zEReturn a set containing all existing file system items from sys.path.)rrrr�existsrrr)�d�item�_�itemcaser
r
r�_init_pathinfo�sr'cCsp|dkrt�}d}nd}tjj||�}yt|d�}Wntk
rHdSX|���xt|�D]�\}}|jd�rrq^yX|jd�r�t|�w^|j	�}t
||�\}}	|	|kr�tjj|�r�tjj
|�|j|	�Wq^tk
�rRtdj|d	|�tjd
�ddl}
x>|
jtj��D],}x$|j�D]}td|tjd
��qW�qWtd
tjd
�PYq^Xq^WWdQRX|�rld}|S)z�Process a .pth file within the site-packages directory:
       For each line in the file, either combine it with sitedir to a path
       and add that to known_paths, or execute it if it starts with 'import '.
    NTF�r�#�import �import	z"Error processing line {:d} of {}:
�)�filerz  z
Remainder of file ignored)r*r+)r'rrr�openr�	enumerate�
startswith�exec�rstriprr"rrr�	Exception�print�format�stderr�	traceback�format_exception�exc_info�
splitlines)�sitedir�namer�reset�fullname�f�n�liner	r r7�recordr
r
r�
addpackage�sD


rCc
Cs�|dkrt�}d}nd}t|�\}}||krBtjj|�|j|�ytj|�}Wntk
rddSXdd�|D�}xt	|�D]}t
|||�q~W|r�d}|S)zTAdd 'sitedir' argument to sys.path if missing and handle .pth files in
    'sitedir'NTFcSsg|]}|jd�r|�qS)z.pth)�endswith)�.0r<r
r
r�
<listcomp>�szaddsitedir.<locals>.<listcomp>)r'rrrrrr�listdirr�sortedrC)r;rr=�sitedircase�namesr<r
r
r�
addsitedir�s$
rKcCs`tjjrdSttd�r4ttd�r4tj�tj�kr4dSttd�r\ttd�r\tj�tj�kr\dSdS)a,Check if user site directory is safe for inclusion

    The function tests for the command line flag (including environment var),
    process uid/gid equal to effective uid/gid.

    None: Disabled for security reasons
    False: Disabled by user (command line option)
    True: Safe and enabled
    F�getuid�geteuidN�getgid�getegidT)	r�flags�no_user_site�hasattrrrMrLrOrNr
r
r
r�check_enableusersite�s
rScCs$tdk	rtSddlm}|d�atS)z�Returns the `user base` directory path.

    The `user base` directory can be used to store data. If the global
    variable ``USER_BASE`` is not initialized yet, this function will also set
    it.
    Nr)�get_config_var�userbase)�	USER_BASE�	sysconfigrT)rTr
r
r�getuserbase�s
rXcCs^t�}tdk	rtSddlm}tjdkrJddlm}|d�rJ|dd�atS|dd	tj�atS)
z�Returns the user-specific site-packages directory path.

    If the global variable ``USER_SITE`` is not initialized yet, this
    function will also set it.
    Nr)�get_path�darwin)rT�PYTHONFRAMEWORK�purelib�osx_framework_userz%s_user)	rX�	USER_SITErWrYr�platformrTrr<)�	user_baserYrTr
r
r�getusersitepackages�s

racCs$t�}tr tjj|�r t||�|S)z�Add a per user site-package to sys.path

    Each user has its own python directory with site-packages in the
    home directory.
    )ra�ENABLE_USER_SITErr�isdirrK)r�	user_siter
r
r�addusersitepackagess
rec	Csg}t�}|dkrt}�x�|D]�}|s||kr2q|j|�tjdkr�|jtjj|ddtj	dd�d��|jtjj|ddtj
dd	�d��n6|j|�|jtjj|dd��|jtjj|dd��tjd
krddlm
}|d
�}|r|jtjjd|dtj
dd	�d��qW|S)aReturns a list containing all global site-packages directories.

    For each directory present in ``prefixes`` (or the global ``PREFIXES``),
    this function will find its `site-packages` subdirectory depending on the
    system environment, and will return a list of full paths.
    N�/�lib64�python�z
site-packages�libzpython%d.%d�rZr)rTr[z/Libraryz%d.%d)r�PREFIXESrr�seprrrr�version�version_infor_rWrT)�prefixes�sitepackages�seen�prefixrT�	frameworkr
r
r�getsitepackages s4





rucCsFtrdtjkrtjdd�x&t|�D]}tjj|�r$t||�q$W|S)z�Add site-packages to sys.path

    '/usr/local' is included in PREFIXES if RPM build is not detected
    to make packages installed into this location visible.

    �RPM_BUILD_ROOTrz
/usr/local)	rbr�environrl�insertrurrcrK)rrpr;r
r
r�addsitepackagesHsrycCs4tjdkrd}nd}tjd|�t_tjd|�t_dS)z�Define new builtins 'quit' and 'exit'.

    These are objects which make the interpreter exit when called.
    The repr of each object contains a hint at how it works.

    �\zCtrl-Z plus ReturnzCtrl-D (i.e. EOF)�quit�exitN)rrm�
_sitebuiltins�Quitter�builtinsr{r|)�eofr
r
r�setquitWs

r�cCs�tjdtj�t_tjdd�dkr2tjdd�t_ntjdd�t_gg}}ttd�r�tj	j
tj�}|jd	d
g�|jtj	j
|tj�|tjg�tjdd||�t_dS)
z)Set 'copyright' and 'credits' in builtins�	copyrightN��java�creditsz?Jython is maintained by the Jython developers (www.jython.org).z�    Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
    for supporting Python development.  See www.python.org for more information.rzLICENSE.txt�LICENSE�licensez'See https://www.python.org/psf/license/)r}�_Printerrr�rr_r�rRrr�dirnamer�extendr�pardir�curdirr�)�files�dirs�herer
r
r�setcopyrightgs 


r�cCstj�t_dS)N)r}�_Helperr�helpr
r
r
r�	sethelpersr�cCsdd�}|t_dS)ajEnable default readline configuration on interactive prompts, by
    registering a sys.__interactivehook__.

    If the readline module can be imported, the hook will set the Tab key
    as completion key and register ~/.python_history as history file.
    This can be overridden in the sitecustomize or usercustomize module,
    or in a PYTHONSTARTUP file.
    cs�ddl}yddl�ddl}Wntk
r0dSXt�dd�}|dk	rZd|krZ�jd�n
�jd�y�j�Wntk
r�YnX�j�dkr�t	j
jt	j
jd�d��y�j
��Wntk
r�YnX��fd	d
�}|j|�dS)Nr�__doc__��libeditzbind ^I rl_completez
tab: complete�~z.python_historycs,y�j��Wnttfk
r&YnXdS)N)�write_history_file�FileNotFoundError�PermissionErrorr
)�history�readliner
r�
write_history�szCenablerlcompleter.<locals>.register_readline.<locals>.write_history)�atexitr��rlcompleter�ImportErrorr�parse_and_bind�read_init_filer�get_current_history_lengthrrr�
expanduser�read_history_file�IOError�register)r�r��readline_docr�r
)r�r�r�register_readline�s.
z,enablerlcompleter.<locals>.register_readlineN)r�__interactivehook__)r�r
r
r�enablerlcompleter�s	0r�cCsFtj}tjdkr$d|kr$tjd}ntj}tjjtjj|��\}}tjj|�}dt_	d}dd�tjj
||�tjj
||�fD�}|�rB|d}d}	t|dd	��`}
xX|
D]P}d
|kr�|jd
�\}}}
|j
�j�}|
j
�}
|dkr�|
j�}	q�|dkr�|
t_	q�WWdQRX|t_t_t|tjg�|	dk�r6tjdtj�ntjgad
a|S)NrZ�__PYVENV_LAUNCHER__z
pyvenv.cfgcSsg|]}tjj|�r|�qSr
)rr�isfile)rE�conffiler
r
rrF�szvenv.<locals>.<listcomp>r�truezutf-8)�encoding�=zinclude-system-site-packages�homeF)rrwrr_�
executabler�splitrr��_homerr.�	partition�strip�lowerrs�exec_prefixryrlrxrb)r�envr��exe_dirr%�site_prefix�
conf_basename�candidate_confs�virtual_conf�system_siter?rA�key�valuer
r
r�venv�s>


r�cCs�yByddl}Wn0tk
r>}z|jdkr,n�WYdd}~XnXWnRtk
r�}z6tjjrltjtj��ntj	j
d|jj|f�WYdd}~XnXdS)z,Run custom site specific code, if available.rN�
sitecustomizez@Error in sitecustomize; set PYTHONVERBOSE for traceback:
%s: %s
)
r�r�r<r3rrP�verbose�
excepthookr9r6�write�	__class__�__name__)r��exc�errr
r
r�execsitecustomize�s
r�cCs�yByddl}Wn0tk
r>}z|jdkr,n�WYdd}~XnXWnRtk
r�}z6tjjrltjtj��ntj	j
d|jj|f�WYdd}~XnXdS)z,Run custom user specific code, if available.rN�
usercustomizez@Error in usercustomize; set PYTHONVERBOSE for traceback:
%s: %s
)
r�r�r<r3rrPr�r�r9r6r�r�r�)r�r�r�r
r
r�execusercustomizes
r�cCsft�t�}t|�}tdkr"t�at|�}t|�}t�t�t	�t
jjsRt
�t�trbt�dS)z�Add standard site-specific directories to the module search path.

    This function is called automatically when this module is imported,
    unless the python interpreter was started with the -S flag.
    N)rr!r�rbrSreryr�r�r�rrP�isolatedr�r�r�)rr
r
r�mainsr�cCs`d}tjdd�}|s�t�}t�}td�xtjD]}td|f�q2Wtd�td|tjj|�rfdndf�td	|tjj|�r�dndf�td
t�tj	d�g}d|kr�|j
t�d
|kr�|j
t�|�r,ttj
j|��tr�tj	d�n6tdk�r
tj	d�n tdk�r tj	d�n
tj	d�n0ddl}t|j|tjdtj
f��tj	d�dS)Na�    %s [--user-base] [--user-site]

    Without arguments print some useful information
    With arguments print the value of USER_BASE and/or USER_SITE separated
    by '%s'.

    Exit codes with --user-base or --user-site:
      0 - user site directory is enabled
      1 - user site directory is disabled by user
      2 - uses site directory is disabled by super user
          or for security reasons
     >2 - unknown error
    r,zsys.path = [z    %r,�]zUSER_BASE: %r (%s)r"z
doesn't existzUSER_SITE: %r (%s)zENABLE_USER_SITE: %rrz--user-basez--user-siteFrkri�
)r�argvrXrar4rrrcrbr|rrVr^�pathsepr�textwrap�dedent)r��argsr`rdr	�bufferr�r
r
r�_script6s@




r��__main__)N)N)N)#r�rrrr}rsr�rlrbr^rVrrr!r'rCrKrSrXrareruryr�r�r�r�r�r�r�r�rP�no_siter�r�r
r
r
r�<module>FsB	
*

(
;43
mailcap.cpython-36.opt-1.pyc000064400000016053150335715140011550 0ustar003

�\dhk#�@s�dZddlZddlZddlZddgZdd�Zejd�jZGdd	�d	e	�Z
d
d�Zdd�Zd
d�Z
dd�Zdd�Zdd�Zddgfdd�Zd#dd�Zgfdd�Zdd�Zdd�Zd d!�Zed"kr�e�dS)$z%Mailcap file handling.  See RFC 1524.�N�getcaps�	findmatchcCsd|krd|dfSdSdS)N�linenor�)rr�)�entryrr�/usr/lib64/python3.6/mailcap.py�lineno_sort_key
sr	z[^\xa1-\U0010FFFF\w@+=:,./-]c@seZdZdZdS)�UnsafeMailcapInputz)Warning raised when refusing unsafe inputN)�__name__�
__module__�__qualname__�__doc__rrrrr
sr
cCs�i}d}x�t�D]�}yt|d�}Wntk
r8wYnX|�t||�\}}WdQRXx6|j�D]*\}}||kr||||<qb|||||<qbWqW|S)a�Return a dictionary containing the mailcap database.

    The dictionary maps a MIME type (in all lowercase, e.g. 'text/plain')
    to a list of dictionaries corresponding to mailcap entries.  The list
    collects all the entries for that MIME type from all available mailcap
    files.  Each dictionary contains key-value pairs for that MIME type,
    where the viewing command is stored with the key "view".

    r�rN)�listmailcapfiles�open�OSError�_readmailcapfile�items)�capsrZmailcap�fpZmorecaps�key�valuerrrrs

cCsPdtjkr"tjd}|jtj�}n*dtjkr8tjd}nd}|ddddg}|S)z7Return a list of all mailcap files found on the system.ZMAILCAPS�HOME�.z	/.mailcapz/etc/mailcapz/usr/etc/mailcapz/usr/local/etc/mailcap)�os�environ�split�pathsep)ZpathstrZmailcaps�homerrrr3s


rcCs tjdtd�t|d�\}}|S)z?Read a mailcap file and return a dictionary keyed by MIME type.z2readmailcapfile is deprecated, use getcaps instead�N)�warnings�warn�DeprecationWarningr)rr�_rrr�readmailcapfileEsr%c	Csi}x�|j�}|sP|ddks|j�dkr.q|}x4|dd�dkrf|j�}|sTd}|dd�|}q4Wt|�\}}|oz|s~q|dk	r�||d<|d	7}|jd
�}x$tt|��D]}||j�||<q�Wd
j|�j�}||kr�||j|�q|g||<qW||fS)
a�Read a mailcap file and return a dictionary keyed by MIME type.

    Each MIME type is mapped to an entry consisting of a list of
    dictionaries; the list will contain more than one such dictionary
    if a given MIME type appears more than once in the mailcap file.
    Each dictionary contains key-value pairs for that MIME type, where
    the viewing command is stored with the key "view".
    r�#�r Nz\
�
rr�/���r*)	�readline�strip�	parseliner�range�len�join�lower�append)	rrr�lineZnextliner�fields�types�jrrrrMs6	
rc
Cs�g}dt|�}}x.||kr@t|||�\}}|j|�|d}qWt|�dkrRdS|d|d|dd�}}}d|i}x^|D]V}|jd�}|dkr�|}d}	n$|d|�j�}||dd�j�}	||kr�q�|	||<q�W||fS)	z�Parse one entry in a mailcap file and return a dictionary.

    The viewing command is stored as the value with the key "view",
    and the rest of the fields produce key-value pairs in the dict.
    rrr N�view�=r')NN)r/�
parsefieldr2�findr,)
r3r4�i�n�fieldrr7�restZfkeyZfvaluerrrr-vs*

 

r-cCsT|}x:||kr>||}|dkr"Pq|dkr4|d}q|d}qW|||�j�|fS)z/Separate one key-value pair in a mailcap entry.�;�\r r)r,)r3r;r<�start�crrrr9�s

r9r7z	/dev/nullc
Cs�t|�r"d|f}tj|t�dSt|||�}xd|D]\}d|krnt|d||�}|dkrZq4|rntj|�dkrnq4t|||||�}	|	dk	r4|	|fSq4WdS)aFind a match for a mailcap entry.

    Return a tuple containing the command line, and the mailcap entry
    used; (None, None) if no match is found.  This may invoke the
    'test' command of several matching entries before deciding which
    entry to use.

    zHRefusing to use mailcap with filename %r. Use a safe temporary filename.N�testr)NN)NN)�_find_unsafer!r"r
�lookup�substr�system)
r�MIMEtyper�filename�plist�msg�entries�erC�commandrrrr�s 	

cslg}||kr|||}|jd�}|dd}||krB|||}�dk	r\�fdd�|D�}t|td�}|S)Nr)rz/*csg|]}�|kr|�qSrr)�.0rM)rrr�
<listcomp>�szlookup.<locals>.<listcomp>)r)r�sortedr	)rrHrrLZ	MIMEtypesr)rrrE�s
rEcCs\d}dt|�}}�xB||k�rV||}|d}|dkrb|dkrX|||d�}|d}||}q||}|d}|dkr�||}q|dkr�||}q|dkr�t|�r�d|f}tj|t�dS||}q|d	k�rH|}	x ||kr�||d
kr�|d}q�W||	|�}
|d}t|
|�}t|��r>d||
f}tj|t�dS||}q|d|}qW|S)Nr'rr�%r@�s�tz9Refusing to substitute MIME type %r into a shell command.�{�}z=Refusing to substitute parameter %r (%s) into a shell command)r/rDr!r"r
�	findparam)r=rHrIrJ�resr;r<rBrKrA�nameZparamrrrrF�sH








rFcCsF|j�d}t|�}x,|D]$}|d|�j�|kr||d�SqWdS)Nr8r')r1r/)rYrJr<�prrrrW�s
rWc	Cs�ddl}t�}|jdd�s(t|�dSx�tdt|j�d�D]�}|j||d�}t|�dkrjtd�dS|d}|d}t||d|�\}}|s�tdt�q<td|�t	j
|�}|r<td|�q<WdS)	Nrrr z"usage: mailcap [MIMEtype file] ...r7zNo viewer found forz
Executing:zExit status:)�sysr�argv�showr.r/�printr�typerrG)	r[rr;�argsrH�filerNrM�stsrrrrCs&

rCcCs�td�xt�D]}td|�qWt�|s4t�}td�t�t|�}xX|D]P}t|�||}x:|D]2}t|�}x|D]}td|||�q|Wt�qjWqPWdS)NzMailcap files:�	zMailcap entries:z  %-15s)r^rrrQ)r�fnZckeysr_rLrM�keys�krrrr]s"


r]�__main__)N)rrr!�re�__all__r	�compile�searchrD�Warningr
rrr%rr-r9rrErFrWrCr]rrrrr�<module>s*)

)aifc.cpython-36.pyc000064400000062531150335715140010107 0ustar003


 \�~�@s>dZddlZddlZddlZdddgZGdd�de�ZdZdd	�Zd
d�Z	dd
�Z
dd�Zdd�ZdZ
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zdd!lmZdd"lmZed#d$�Zd%ej_d&ej_d'ej_d(ej_d)ej_d*ej_Gd+d,�d,�Z Gd-d.�d.�Z!d@d/d�Z"e"Z#e$d0k�r:ddl%Z%e%j&d1d��sHe%j&j'd2�e%j&d1Z(e"e(d3���Z)e*d4e(�e*d5e)j+��e*d6e)j,��e*d7e)j-��e*d8e)j.��e*d9e)j/��e*d:e)j0��e%j&d;d��r0e%j&d;Z1e*d<e1�e"e1d=��8Z2e2j3e)j4��x"e)j5d>�Z6e6�sPe2j7e6��q�WWdQRXe*d?�WdQRXdS)AaJStuff to parse AIFF-C and AIFF files.

Unless explicitly stated otherwise, the description below is true
both for AIFF-C files and AIFF files.

An AIFF-C file has the following structure.

  +-----------------+
  | FORM            |
  +-----------------+
  | <size>          |
  +----+------------+
  |    | AIFC       |
  |    +------------+
  |    | <chunks>   |
  |    |    .       |
  |    |    .       |
  |    |    .       |
  +----+------------+

An AIFF file has the string "AIFF" instead of "AIFC".

A chunk consists of an identifier (4 bytes) followed by a size (4 bytes,
big endian order), followed by the data.  The size field does not include
the size of the 8 byte header.

The following chunk types are recognized.

  FVER
      <version number of AIFF-C defining document> (AIFF-C only).
  MARK
      <# of markers> (2 bytes)
      list of markers:
          <marker ID> (2 bytes, must be > 0)
          <position> (4 bytes)
          <marker name> ("pstring")
  COMM
      <# of channels> (2 bytes)
      <# of sound frames> (4 bytes)
      <size of the samples> (2 bytes)
      <sampling frequency> (10 bytes, IEEE 80-bit extended
          floating point)
      in AIFF-C files only:
      <compression type> (4 bytes)
      <human-readable version of compression type> ("pstring")
  SSND
      <offset> (4 bytes, not used by this program)
      <blocksize> (4 bytes, not used by this program)
      <sound data>

A pstring consists of 1 byte length, a string of characters, and 0 or 1
byte pad to make the total length even.

Usage.

Reading AIFF files:
  f = aifc.open(file, 'r')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods read(), seek(), and close().
In some types of audio files, if the setpos() method is not used,
the seek() method is not necessary.

This returns an instance of a class with the following public methods:
  getnchannels()  -- returns number of audio channels (1 for
             mono, 2 for stereo)
  getsampwidth()  -- returns sample width in bytes
  getframerate()  -- returns sampling frequency
  getnframes()    -- returns number of audio frames
  getcomptype()   -- returns compression type ('NONE' for AIFF files)
  getcompname()   -- returns human-readable version of
             compression type ('not compressed' for AIFF files)
  getparams() -- returns a namedtuple consisting of all of the
             above in the above order
  getmarkers()    -- get the list of marks in the audio file or None
             if there are no marks
  getmark(id) -- get mark with the specified id (raises an error
             if the mark does not exist)
  readframes(n)   -- returns at most n frames of audio
  rewind()    -- rewind to the beginning of the audio stream
  setpos(pos) -- seek to the specified position
  tell()      -- return the current position
  close()     -- close the instance (make it unusable)
The position returned by tell(), the position given to setpos() and
the position of marks are all compatible and have nothing to do with
the actual position in the file.
The close() method is called automatically when the class instance
is destroyed.

Writing AIFF files:
  f = aifc.open(file, 'w')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods write(), tell(), seek(), and
close().

This returns an instance of a class with the following public methods:
  aiff()      -- create an AIFF file (AIFF-C default)
  aifc()      -- create an AIFF-C file
  setnchannels(n) -- set the number of channels
  setsampwidth(n) -- set the sample width
  setframerate(n) -- set the frame rate
  setnframes(n)   -- set the number of frames
  setcomptype(type, name)
          -- set the compression type and the
             human-readable compression type
  setparams(tuple)
          -- set all parameters at once
  setmark(id, pos, name)
          -- add specified mark to the list of marks
  tell()      -- return current position in output file (useful
             in combination with setmark())
  writeframesraw(data)
          -- write audio frames without pathing up the
             file header
  writeframes(data)
          -- write audio frames and patch up the file header
  close()     -- patch up the file header and close the
             output file
You should set the parameters before the first writeframesraw or
writeframes.  The total number of frames does not need to be set,
but when it is set to the correct value, the header does not have to
be patched up.
It is best to first set all parameters, perhaps possibly the
compression type, and then write audio frames using writeframesraw.
When all frames have been written, either call writeframes(b'') or
close() to patch up the sizes in the header.
Marks can be added anytime.  If there are any marks, you must call
close() after all frames have been written.
The close() method is called automatically when the class instance
is destroyed.

When a file is opened with the extension '.aiff', an AIFF file is
written, otherwise an AIFF-C file is written.  This default can be
changed by calling aiff() or aifc() before the first writeframes or
writeframesraw.
�N�Error�open�openfpc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/aifc.pyr�sl@QEcCs6ytjd|jd��dStjk
r0t�YnXdS)Nz>l�r)�struct�unpack�read�error�EOFError)�filerrr	�
_read_long�srcCs6ytjd|jd��dStjk
r0t�YnXdS)Nz>Lr
r)rrr
rr)rrrr	�_read_ulong�srcCs6ytjd|jd��dStjk
r0t�YnXdS)Nz>h�r)rrr
rr)rrrr	�_read_short�srcCs6ytjd|jd��dStjk
r0t�YnXdS)Nz>Hrr)rrr
rr)rrrr	�_read_ushort�srcCs@t|jd��}|dkrd}n
|j|�}|d@dkr<|jd�}|S)N�r�)�ordr
)r�length�data�dummyrrr	�_read_string�s

rg�����cCs�t|�}d}|dkr d
}|d}t|�}t|�}||koL|koLdknrXd}n0|dkrft}n"|d}|d|td|d	�}||S)Nrri�gi�i�?lg@�?���)rr�	_HUGE_VAL�pow)�f�expon�sign�himant�lomantrrr	�_read_float�s"r&cCs|jtjd|��dS)Nz>h)�writer�pack)r!�xrrr	�_write_short�sr*cCs|jtjd|��dS)Nz>H)r'rr()r!r)rrr	�
_write_ushort�sr+cCs|jtjd|��dS)Nz>l)r'rr()r!r)rrr	�_write_long�sr,cCs|jtjd|��dS)Nz>L)r'rr()r!r)rrr	�_write_ulong�sr-cCsRt|�dkrtd��|jtjdt|���|j|�t|�d@dkrN|jd�dS)N�z%string exceeds maximum pstring length�Brr�)�len�
ValueErrorr'rr()r!�srrr	�
_write_string�s
r4c	Cs�ddl}|dkrd}|d}nd}|dkr8d}d}d}n�|j|�\}}|dks^|dks^||krp|dB}d}d}nh|d}|dkr�|j||�}d}||B}|j|d�}|j|�}t|�}|j||d�}|j|�}t|�}t||�t||�t||�dS)	Nri�ri@i�i�?� r)�mathZfrexpZldexpZfloor�intr+r-)	r!r)r6r#r"r$r%ZfmantZfsmantrrr	�_write_float�s8




r8)�Chunk)�
namedtuple�_aifc_paramsz7nchannels sampwidth framerate nframes comptype compnamez3Number of audio channels (1 for mono, 2 for stereo)zSample width in byteszSampling frequencyzNumber of audio framesz(Compression type ("NONE" for AIFF files)zRA human-readable version of the compression type
('not compressed' for AIFF files)c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�ZdS)2�	Aifc_readNcCs<d|_d|_g|_d|_||_t|�}|j�dkr:td��|jd�}|dkrTd|_	n|dkrdd|_	ntd��d|_
d|_x�d|_yt|j�}Wnt
k
r�PYnX|j�}|d	kr�|j|�d|_
nH|d
kr�||_|jd�}d|_n(|dkr�t|�|_n|d
k�r|j|�|j�qzW|j
�s0|j�r8td��dS)NrsFORMz file does not start with FORM idr
sAIFFsAIFCrznot an AIFF or AIFF-C filesCOMMsSSND�sFVERsMARKz$COMM chunk and/or SSND chunk missing)�_version�_convert�_markers�	_soundpos�_filer9Zgetnamerr
�_aifcZ_comm_chunk_read�_ssnd_chunk�_ssnd_seek_neededr�_read_comm_chunkr�	_readmark�skip)�selfr�chunkZformdataZ	chunknamerrrr	�initfp4sJ




zAifc_read.initfpc	CsLt|t�r>tj|d�}y|j|�WqH|j��YqHXn
|j|�dS)N�rb)�
isinstance�str�builtinsrrK�close)rIr!�file_objectrrr	�__init__\s

zAifc_read.__init__cCs|S)Nr)rIrrr	�	__enter__hszAifc_read.__enter__cGs|j�dS)N)rP)rI�argsrrr	�__exit__kszAifc_read.__exit__cCs|jS)N)rB)rIrrr	�getfpqszAifc_read.getfpcCsd|_d|_dS)Nrr)rErA)rIrrr	�rewindtszAifc_read.rewindcCs |j}|dk	rd|_|j�dS)N)rBrP)rIrrrr	rPxszAifc_read.closecCs|jS)N)rA)rIrrr	�tell~szAifc_read.tellcCs|jS)N)�
_nchannels)rIrrr	�getnchannels�szAifc_read.getnchannelscCs|jS)N)�_nframes)rIrrr	�
getnframes�szAifc_read.getnframescCs|jS)N)�
_sampwidth)rIrrr	�getsampwidth�szAifc_read.getsampwidthcCs|jS)N)�
_framerate)rIrrr	�getframerate�szAifc_read.getframeratecCs|jS)N)�	_comptype)rIrrr	�getcomptype�szAifc_read.getcomptypecCs|jS)N)�	_compname)rIrrr	�getcompname�szAifc_read.getcompnamecCs*t|j�|j�|j�|j�|j�|j��S)N)r;rZr^r`r\rbrd)rIrrr	�	getparams�szAifc_read.getparamscCst|j�dkrdS|jS)Nr)r1r@)rIrrr	�
getmarkers�szAifc_read.getmarkerscCs2x|jD]}||dkr|SqWtdj|���dS)Nrzmarker {0!r} does not exist)r@r�format)rI�id�markerrrr	�getmark�szAifc_read.getmarkcCs*|dks||jkrtd��||_d|_dS)Nrzposition not in ranger)r[rrArE)rI�posrrr	�setpos�szAifc_read.setposcCs�|jrD|jjd�|jjd�}|j|j}|r>|jj|d�d|_|dkrPdS|jj||j�}|jrv|rv|j|�}|jt|�|j|j	|_|S)Nrr=r)
rErD�seekr
rA�
_framesizer?r1rYr])rI�nframesrrkrrrr	�
readframes�s

zAifc_read.readframescCsddl}|j|d�S)Nrr)�audioopZalaw2lin)rIrrqrrr	�	_alaw2lin�szAifc_read._alaw2lincCsddl}|j|d�S)Nrr)rqZulaw2lin)rIrrqrrr	�	_ulaw2lin�szAifc_read._ulaw2lincCs2ddl}t|d�sd|_|j|d|j�\}|_|S)Nr�_adpcmstater)rq�hasattrrtZ	adpcm2lin)rIrrqrrr	�
_adpcm2lin�s

zAifc_read._adpcm2lincCs.t|�|_t|�|_t|�dd|_tt|��|_|j|j|_|j	�rd}|j
dkrld}tjd�d|_
|j
d�|_|r�t|jj
d��}|d@dkr�|d}|j
||_
|jjdd�t|�|_|jd	k�r*|jd
kr�|j|_n2|jdkr�|j|_n|jdk�r|j|_ntd��d|_nd	|_d|_dS)N�r=r�rzWarning: bad COMM chunk size�r
sNONEsG722�ulaw�ULAW�alaw�ALAWzunsupported compression typersnot compressedr)rzr{)r|r})rrYrr[r]r7r&r_rnrCZ	chunksize�warnings�warnr
rarrrmrrcrvr?rsrrr)rIrJZkludgerrrr	rF�s<









zAifc_read._read_comm_chunkcCs�t|�}yHxBt|�D]6}t|�}t|�}t|�}|s8|r|jj|||f�qWWnDtk
r�dt|j�t|j�dkr|dnd|f}tj	|�YnXdS)Nz;Warning: MARK chunk contains only %s marker%s instead of %sr�r3)
r�rangerrr@�appendrr1r~r)rIrJZnmarkers�irhrk�name�wrrr	rG�szAifc_read._readmark)rrrrBrKrRrSrUrVrWrPrXrZr\r^r`rbrdrerfrjrlrprrrsrvrFrGrrrr	r<s2$(&r<c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Z d<d=�Z!d>d?�Z"d@dA�Z#dBdC�Z$dDdE�Z%dFdG�Z&dHdI�Z'dS)J�
Aifc_writeNc	Cs\t|t�rNtj|d�}y|j|�Wn|j��YnX|jd�rXd|_n
|j|�dS)N�wbz.aiffr)rMrNrOrrKrP�endswithrC)rIr!rQrrr	rR+s

zAifc_write.__init__cCs^||_t|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_g|_
d|_d|_dS)NsNONEsnot compressedrr)rB�
_AIFC_versionr>rarcr?rYr]r_r[�_nframeswritten�_datawritten�_datalengthr@�_marklengthrC)rIrrrr	rK;szAifc_write.initfpcCs|j�dS)N)rP)rIrrr	�__del__LszAifc_write.__del__cCs|S)Nr)rIrrr	rSOszAifc_write.__enter__cGs|j�dS)N)rP)rIrTrrr	rURszAifc_write.__exit__cCs|jrtd��d|_dS)Nz0cannot change parameters after starting to writer)r�rrC)rIrrr	�aiffXszAifc_write.aiffcCs|jrtd��d|_dS)Nz0cannot change parameters after starting to writer)r�rrC)rIrrr	�aifc]szAifc_write.aifccCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerzbad # of channels)r�rrY)rI�	nchannelsrrr	�setnchannelsbs
zAifc_write.setnchannelscCs|jstd��|jS)Nznumber of channels not set)rYr)rIrrr	rZiszAifc_write.getnchannelscCs0|jrtd��|dks|dkr&td��||_dS)Nz0cannot change parameters after starting to writerr
zbad sample width)r�rr])rI�	sampwidthrrr	�setsampwidthns
zAifc_write.setsampwidthcCs|jstd��|jS)Nzsample width not set)r]r)rIrrr	r^uszAifc_write.getsampwidthcCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerzbad frame rate)r�rr_)rI�	frameraterrr	�setframeratezs
zAifc_write.setframeratecCs|jstd��|jS)Nzframe rate not set)r_r)rIrrr	r`�szAifc_write.getframeratecCs|jrtd��||_dS)Nz0cannot change parameters after starting to write)r�rr[)rIrorrr	�
setnframes�szAifc_write.setnframescCs|jS)N)r�)rIrrr	r\�szAifc_write.getnframescCs.|jrtd��|d	krtd��||_||_dS)
Nz0cannot change parameters after starting to write�NONE�ulaw�ULAW�alaw�ALAW�G722zunsupported compression type)r�r�r�r�r�r�)r�rrarc)rI�comptype�compnamerrr	�setcomptype�szAifc_write.setcomptypecCs|jS)N)ra)rIrrr	rb�szAifc_write.getcomptypecCs|jS)N)rc)rIrrr	rd�szAifc_write.getcompnamecCsf|\}}}}}}|jrtd��|d	kr.td��|j|�|j|�|j|�|j|�|j||�dS)
Nz0cannot change parameters after starting to write�NONE�ulaw�ULAW�alaw�ALAW�G722zunsupported compression type)r�r�r�r�r�r�)r�rr�r�r�r�r�)rIZparamsr�r�r�ror�r�rrr	�	setparams�s



zAifc_write.setparamscCs>|js|js|jr td��t|j|j|j|j|j|j�S)Nznot all parameters set)rYr]r_rr;r[rarc)rIrrr	re�szAifc_write.getparamscCs�|dkrtd��|dkr td��t|t�s2td��x<tt|j��D]*}||j|dkrB|||f|j|<dSqBW|jj|||f�dS)Nrzmarker ID must be > 0zmarker position must be >= 0zmarker name must be bytes)rrM�bytesr�r1r@r�)rIrhrkr�r�rrr	�setmark�s
zAifc_write.setmarkcCs2x|jD]}||dkr|SqWtdj|���dS)Nrzmarker {0!r} does not exist)r@rrg)rIrhrirrr	rj�szAifc_write.getmarkcCst|j�dkrdS|jS)Nr)r1r@)rIrrr	rf�szAifc_write.getmarkerscCs|jS)N)r�)rIrrr	rX�szAifc_write.tellcCszt|ttf�st|�jd�}|jt|��t|�|j|j}|j	rN|j	|�}|j
j|�|j||_|j
t|�|_
dS)Nr/)rMr��	bytearray�
memoryview�cast�_ensure_header_writtenr1r]rYr?rBr'r�r�)rIrrorrr	�writeframesraw�s
zAifc_write.writeframesrawcCs.|j|�|j|jks"|j|jkr*|j�dS)N)r�r�r[r�r��_patchheader)rIrrrr	�writeframes�s
zAifc_write.writeframescCs�|jdkrdSz^|jd�|jd@r<|jjd�|jd|_|j�|j|jksb|j|jksb|jrj|j	�Wdd|_
|j}d|_|j�XdS)Nrrr0)rBr�r�r'�
_writemarkersr�r[r�r�r�r?rP)rIr!rrr	rP�s 


zAifc_write.closecCsddl}|j|d�S)Nrr)rqZlin2alaw)rIrrqrrr	�	_lin2alaw�szAifc_write._lin2alawcCsddl}|j|d�S)Nrr)rqZlin2ulaw)rIrrqrrr	�	_lin2ulaw�szAifc_write._lin2ulawcCs2ddl}t|d�sd|_|j|d|j�\}|_|S)Nrrtr)rqrurtZ	lin2adpcm)rIrrqrrr	�
_lin2adpcms

zAifc_write._lin2adpcmcCsf|jsb|jdkr.|jsd|_|jdkr.td��|js<td��|jsJtd	��|jsXtd
��|j|�dS)N�ULAW�ulaw�ALAW�alaw�G722rzRsample width must be 2 when compressing with ulaw/ULAW, alaw/ALAW or G7.22 (ADPCM)z# channels not specifiedzsample width not specifiedzsampling rate not specified)r�r�r�r�r�)r�rar]rrYr_�
_write_header)rIZdatasizerrr	r�	s

z!Aifc_write._ensure_header_writtencCs>|jdkr|j|_n&|jdkr(|j|_n|jdkr:|j|_dS)NsG722�ulaw�ULAW�alaw�ALAW)r�r�)r�r�)rar�r?r�r�)rIrrr	�_init_compressions




zAifc_write._init_compressioncCsL|jr|jdkr|j�|jjd�|js<||j|j|_|j|j|j|_|jd@rf|jd|_|jr�|jdkr�|jd|_|jd@r�|jd|_n0|jd	kr�|jd
d|_|jd@r�|jd|_y|jj	�|_
Wn ttfk
�r�d|_
YnX|j
|j�}|j�rD|jjd�|jjd
�t|jd�t|j|j�n|jjd�|jjd�t|j|�t|j|j�|j
dk	�r�|jj	�|_t|j|j�|jdk�r�t|jd�nt|j|jd�t|j|j�|j�r�|jj|j�t|j|j�|jjd�|j
dk	�r|jj	�|_t|j|jd�t|jd�t|jd�dS)NsNONEsFORMr�ulaw�ULAW�alaw�ALAWr�G722�r
sAIFCsFVERsAIFFsCOMMr=sSSNDr)r�r�r�r�)r�r�r�r�r�)rCrar�rBr'r[rYr]r�rX�_form_length_pos�AttributeError�OSError�_write_form_lengthr-r>r*�_nframes_posr8r_r4rc�_ssnd_length_pos)rIZ
initlength�
commlengthrrr	r�!s^




zAifc_write._write_headercCs\|jr*d	t|j�}|d@r$|d}d}nd}d}t|jd||jd|d|�|S)
Nrx�r�rr
r=�ry)rCr1rcr-rBr�)rI�
datalengthr�Z
verslengthrrr	r�Ts zAifc_write._write_form_lengthcCs�|jj�}|jd@r,|jd}|jjd�n|j}||jkrd|j|jkrd|jdkrd|jj|d�dS|jj|j	d�|j
|�}|jj|jd�t|j|j�|jj|j
d�t|j|d�|jj|d�|j|_||_dS)Nrr0rr=)rBrXr�r'r�r[r�r�rmr�r�r�r-r�)rIZcurposr�rrrr	r�as&





zAifc_write._patchheadercCs�t|j�dkrdS|jjd�d}xD|jD]:}|\}}}|t|�dd}t|�d@dkr*|d}q*Wt|j|�|d|_t|jt|j��x<|jD]2}|\}}}t|j|�t|j|�t|j|�q�WdS)NrsMARKrr�r=)r1r@rBr'r-r�r*r4)rIrrirhrkr�rrr	r�ws"


zAifc_write._writemarkers)(rrrrBrRrKr�rSrUr�r�r�rZr�r^r�r`r�r\r�rbrdr�rer�rjrfrXr�r�rPr�r�r�r�r�r�r�r�r�rrrr	r�sJ	

3
r�cCsJ|dkrt|d�r|j}nd}|dkr.t|�S|dkr>t|�Std��dS)	N�moderL�rr�r�z$mode must be 'r', 'rb', 'w', or 'wb')r�rL)r�r�)rur�r<r�r)r!r�rrr	r�s
�__main__rz/usr/demos/data/audio/bach.aiffr�ZReadingznchannels =znframes   =zsampwidth =zframerate =zcomptype  =zcompname  =rZWritingr�izDone.)N)8�__doc__rrOr~�__all__�	Exceptionrr�rrrrrrr&r*r+r,r-r4r8rJr9�collectionsr:r;r�r�r�ror�r�r<r�rrr�sys�argvr��fnr!�printrZr\r^r`rbrdZgn�gr�rerprr�rrrr	�<module>�sz

!~







pprint.cpython-36.pyc000064400000036722150335715140010524 0ustar003


 \|Q�
@s�dZddlZddlZddlZddlZddlm	Z
dddddd	gZd!dd
�dd�Zd"dd
�dd�Z
dd�Zdd�Zdd�ZGdd�d�Zdd�ZGdd	�d	�Zdd�Zeeeeeeeeed�h�Zdd�Zd#dd�Z dd�Z!e"d kr�e �dS)$a/Support to pretty-print lists, tuples, & dictionaries recursively.

Very simple, but useful, especially in debugging data structures.

Classes
-------

PrettyPrinter()
    Handle pretty-printing operations onto a stream using a configured
    set of formatting parameters.

Functions
---------

pformat()
    Format a Python object into a pretty-printed representation.

pprint()
    Pretty-print a Python object to a stream [default is sys.stdout].

saferepr()
    Generate a 'standard' repr()-like value, but protect against recursive
    data structures.

�N)�StringIO�pprint�pformat�
isreadable�isrecursive�saferepr�
PrettyPrinter��PF)�compactcCs t|||||d�}|j|�dS)zAPretty-print a Python object to a stream [default is sys.stdout].)�stream�indent�width�depthrN)rr)�objectrr
rrrZprinter�r�/usr/lib64/python3.6/pprint.pyr/scCst||||d�j|�S)z<Format a Python object into a pretty-printed representation.)r
rrr)rr)rr
rrrrrrr7scCst|idd�dS)z=Version of repr() which can handle recursive data structures.Nr)�
_safe_repr)rrrrr<scCst|idd�dS)z4Determine if saferepr(object) is readable by eval().Nrr	)r)rrrrr@scCst|idd�dS)z8Determine if object requires a recursive representation.Nr�)r)rrrrrDsc@s&eZdZdZdgZdd�Zdd�ZdS)�	_safe_keyaUHelper function for key functions when sorting unorderable objects.

    The wrapped-object will fallback to a Py2.x style comparison for
    unorderable types (sorting first comparing the type name and then by
    the obj ids).  Does not work recursively, so dict.items() must have
    _safe_key applied to both the key and the value.

    �objcCs
||_dS)N)r)�selfrrrr�__init__Tsz_safe_key.__init__cCsRy|j|jkStk
rLtt|j��t|j�ftt|j��t|j�fkSXdS)N)r�	TypeError�str�type�id)r�otherrrr�__lt__Ws
z_safe_key.__lt__N)�__name__�
__module__�__qualname__�__doc__�	__slots__rrrrrrrHsrcCst|d�t|d�fS)z&Helper function for comparing 2-tuplesrr	)r)�trrr�_safe_tuple^sr%c@s�eZdZd:dd�dd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�ZiZ	dd�Z
e
e	ej<dd�Z
e
e	ejj<dd�Zee	ej<dd�Zee	ej<dd�Zee	ej<ee	ej<dd�Zee	ej<dd�Zee	ej<d d!�Zee	ej<d"d#�Zee	ejj<d$d%�Z d&d'�Z!d(d)�Z"d*d+�Z#d,d-�Z$e$e	ej%j<d.d/�Z&e&e	ej'j<d0d1�Z(e(e	ej)j<d2d3�Z*e*e	ej+j<d4d5�Z,e,e	ej-j<d6d7�Z.e.e	ej/j<d8d9�Z0e0e	ej1j<dS);rr	r
NF)rcCs|t|�}t|�}|dkr td��|dk	r8|dkr8td��|sDtd��||_||_||_|dk	rf||_ntj|_t|�|_	dS)aDHandle pretty printing operations onto a stream using a set of
        configured parameters.

        indent
            Number of spaces to indent for each level of nesting.

        width
            Attempted maximum number of columns in the output.

        depth
            The maximum depth to print out nested structures.

        stream
            The desired output stream.  If omitted (or false), the standard
            output stream available at construction will be used.

        compact
            If true, several items will be combined in one line.

        rzindent must be >= 0Nzdepth must be > 0zwidth must be != 0)
�int�
ValueError�_depth�_indent_per_level�_width�_stream�_sys�stdout�bool�_compact)rr
rrrrrrrrcszPrettyPrinter.__init__cCs&|j||jddid�|jjd�dS)Nr�
)�_formatr+�write)rrrrrr�szPrettyPrinter.pprintcCs"t�}|j||ddid�|j�S)Nr)�	_StringIOr1�getvalue)rrZsiorrrr�szPrettyPrinter.pformatcCs|j|idd�dS)Nrr)�format)rrrrrr�szPrettyPrinter.isrecursivecCs |j|idd�\}}}|o|S)Nr)r5)rr�s�readable�	recursiverrrr�szPrettyPrinter.isreadablec	Cs�t|�}||kr.|jt|��d|_d|_dS|j|||�}|j||}	t|�|	kr�|jj	t
|�jd�}
|
dk	r�d||<|
|||||||d�||=dSt|t
�r�d||<|j||||||d�||=dS|j|�dS)NTFr	)rr2�
_recursion�
_recursive�	_readable�_reprr*�len�	_dispatch�getr�__repr__�
isinstance�dict�_pprint_dict)rrrr
�	allowance�context�level�objid�rep�	max_width�prrrr1�s,
zPrettyPrinter._formatc
Csj|j}|d�|jdkr*||jdd�t|�}|r^t|j�td�}	|j|	|||d||�|d�dS)N�{r	� )�key�})r2r)r=�sorted�itemsr%�_format_dict_items)
rrrr
rDrErFr2ZlengthrPrrrrC�s
zPrettyPrinter._pprint_dictcCslt|�s|jt|��dS|j}|j|jd�|jt|j��||t|j�d|d||�|jd�dS)N�(r	�))r=r2�repr�	__class__rr1�listrP)rrrr
rDrErF�clsrrr�_pprint_ordered_dict�sz"PrettyPrinter._pprint_ordered_dictcCs0|jd�|j||||d||�|jd�dS)N�[r	�])r2�
_format_items)rrrr
rDrErFrrr�_pprint_list�s
zPrettyPrinter._pprint_listcCsH|jd�t|�dkrdnd}|j||||t|�||�|j|�dS)NrRr	z,)rS)r2r=r[)rrrr
rDrErF�endcharrrr�
_pprint_tuple�s

zPrettyPrinter._pprint_tuplec	Cs�t|�s|jt|��dS|j}|tkr8|jd�d}n&|j|jd�d}|t|j�d7}t|td�}|j||||t|�||�|j|�dS)NrKrNz({z})r	)rM)	r=r2rTrU�setrrOrr[)	rrrr
rDrErF�typr]rrr�_pprint_set�s
zPrettyPrinter._pprint_setcCs�|j}t|�s|t|��dSg}|jd�}	|dkrD|d7}|d7}|j|}
}�xt|	�D�]�\}}
t|
�}|t|	�dkr�|
|8}
t|�|
kr�|j|�q^tjd|
�}|s�t	�|d
s�t	�|j
�|}d}xxt|�D]l\}}||}|t|�dk�r|t|	�dk�r||8}tt|��|k�rD|�r>|jt|��|}q�|}q�W|r^|jt|��q^Wt|�dk�r|||�dS|dk�r�|d�x8t|�D],\}}|dk�r�|dd|�||��q�W|dk�r�|d	�dS)NTr	z\S*\s*�rRrr0rLrS���)r2r=rT�
splitlinesr*�	enumerate�append�re�findall�AssertionError�pop)rrrr
rDrErFr2Zchunks�linesZ
max_width1rI�i�linerH�partsZ
max_width2�current�j�part�	candidaterrr�_pprint_str�sX
$


zPrettyPrinter._pprint_strcCs�|j}t|�dkr"|t|��dS|dk}|rF|d7}|d7}|d�d}	x:t||j||�D]$}
||	�||
�|	s^dd|}	q^W|r�|d�dS)N�r	rRrbr0rLrS)r2r=rT�_wrap_bytes_reprr*)rrrr
rDrErFr2Zparens�delimrHrrr�
_pprint_bytes's"zPrettyPrinter._pprint_bytescCs>|j}|d�|jt|�||d|d||d�|d�dS)Nz
bytearray(�
r	rS)r2rw�bytes)rrrr
rDrErFr2rrr�_pprint_bytearray<s
zPrettyPrinter._pprint_bytearraycCs8|jd�|j|j�||d|d||�|jd�dS)Nz
mappingproxy(�
r	rS)r2r1�copy)rrrr
rDrErFrrr�_pprint_mappingproxyEs
z"PrettyPrinter._pprint_mappingproxycCs�|j}||j7}dd|}t|�d}	xrt|�D]f\}
\}}|
|	k}
|j|||�}||�|d�|j|||t|�d|
r�|nd||�|
s2||�q2WdS)Nz,
rLr	z: r)r2r)r=rer<r1)rrPrr
rDrErFr2�delimnlZ
last_indexrlrM�ent�lastrHrrrrQMs

z PrettyPrinter._format_dict_itemscCsN|j}||j7}|jdkr,||jdd�dd|}d}	|j|d}
}t|�}yt|�}
Wntk
rvdSXd}x�|�sH|
}yt|�}
Wn(tk
r�d}||8}|
|8}
YnX|j�r|j|||�}t|�d}|
|kr�|}
|	r�|}	|
|k�r|
|8}
||	�d}	||�q~||	�|}	|j	||||�r<|nd||�q~WdS)	Nr	rLz,
rbFTrz, )
r2r)r*�iter�next�
StopIterationr/r<r=r1)rrPrr
rDrErFr2r~rvrrI�itZnext_entr�rrH�wrrrr[^sN



zPrettyPrinter._format_itemscCs4|j||j�|j|�\}}}|s&d|_|r0d|_|S)NFT)r5r|r(r;r:)rrrErFrTr7r8rrrr<�szPrettyPrinter._reprcCst||||�S)z�Format object for a specific context, returning a string
        and flags indicating whether the representation is 'readable'
        and whether the object represents a recursive construct.
        )r)rrrE�	maxlevelsrFrrrr5�szPrettyPrinter.formatc	Cs�t|�s|jt|��dS|j|j||�}|j}|t|j�d7}|jd|j|d|f�|j||||d||�|jd�dS)Nr	z	%s(%s,
%srLrS)r=r2rTr<�default_factoryrUrrC)	rrrr
rDrErFZrdfrWrrr�_pprint_default_dict�sz"PrettyPrinter._pprint_default_dictc	Cs�t|�s|jt|��dS|j}|j|jd�|jdkrN|j|jdd�|j�}|j|||t|j�d|d||�|jd�dS)Nz({r	rLrz}))r=r2rTrUrr)�most_commonrQ)	rrrr
rDrErFrWrPrrr�_pprint_counter�s
zPrettyPrinter._pprint_counterc
Cs�t|j�s|jt|��dS|j}|j|jd�|t|j�d7}xrt|j�D]d\}}	|t|j�dkr�|j|	|||d||�|jd�qP|j|	||d||�|jdd|�qPWdS)NrRr	rSz,
rL)r=�mapsr2rTrUrrer1)
rrrr
rDrErFrWrl�mrrr�_pprint_chain_map�s
zPrettyPrinter._pprint_chain_mapc	Cs�t|�s|jt|��dS|j}|j|jd�|t|j�d7}|jd�|jdkrz|j||||d||�|jd�n:|j|||d||�|j|j||�}|jdd||f�dS)NrRr	rYrz])z],
%smaxlen=%s)rL)r=r2rTrUr�maxlenr[r<)	rrrr
rDrErFrWZrmlrrr�
_pprint_deque�s

zPrettyPrinter._pprint_dequecCs|j|j|||||d�dS)Nr	)r1�data)rrrr
rDrErFrrr�_pprint_user_dict�szPrettyPrinter._pprint_user_dictcCs|j|j|||||d�dS)Nr	)r1r�)rrrr
rDrErFrrr�_pprint_user_list�szPrettyPrinter._pprint_user_listcCs|j|j|||||d�dS)Nr	)r1r�)rrrr
rDrErFrrr�_pprint_user_string�sz!PrettyPrinter._pprint_user_string)r	r
NN)2rr r!rrrrrr1r>rCrBr@rX�_collections�OrderedDictr\rVr^�tuplerar_�	frozensetrsrrwryrz�	bytearrayr}�_types�MappingProxyTyperQr[r<r5r��defaultdictr��Counterr��ChainMapr��dequer��UserDictr��UserListr��
UserStringrrrrrbsZ&




1


)	cCs�t|�}|tkrt|�ddfSt|dd�}t|t�o<|tjk�r8|sHdSt|�}|rj||krjdd||kfS||kr�t|�ddfSd||<d}d}g}	|	j	}
|d7}t
}t|j�t
d�}xf|D]^\}
}||
|||�\}}}|||||�\}}}|
d||f�|�o
|�o
|}|�s|r�d}q�W||=d	d
j|	�||fSt|t��rP|tjk�sht|t��rd|tjk�rdt|t��r�|�s~dSd}n"t|�dk�r�d
}n|�s�dSd}t|�}|�r�||k�r�|dd||kfS||k�r�t|�ddfSd||<d}d}g}	|	j	}
|d7}x>|D]6}t
||||�\}}}|
|�|�s:d}|�rd}�qW||=|d
j|	�||fSt|�}||�o~|jd�dfS)NTFr@�{}z{...}r	)rMz%s: %sz{%s}z, �[]z[%s]z(%s,)�()z(%s)z...�<)r�TF)r�TF)r�TF)r�_builtin_scalarsrT�getattr�
issubclassrBr@rr9rfrrOrPr%�joinrVr�r=�
startswith)rrEr�rFr`�rrGr7r8Z
componentsrfrrP�k�vZkreprZ	kreadableZkrecurZvreprZ	vreadableZvrecurr5�oZoreprZ	oreadableZorecurrHrrrr�s|



rcCsdt|�jt|�fS)Nz<Recursion on %s with id=%s>)rrr)rrrrr91sr9cCs�ddl}|dkr,dd
ddgddd	�fgd
}t�}|j�}t|idd�|j�}|j|�|j�}td||�td||�dS)Nr�stringr	r�rt��)��i��z_safe_repr:zpformat:)r	r)�timerrr�print)rr�rJZt1Zt2Zt3rrr�
_perfcheck6s
r�ccs�d}t|�dd}xhtdt|�d�D]T}|||d�}||}||krR||8}tt|��|krv|rpt|�V|}q&|}q&W|r�t|�VdS)N�rtr)r=�rangerT)rrrDror�rlrqrrrrrruCs
ru�__main__)Nr	r
N)r	r
N)N)#r"�collectionsr�rg�sysr,�typesr��iorr3�__all__rrrrrrr%rrr�rryr�r&�float�complexr.rr�r9r�rurrrrr�<module>#s6
D

statistics.cpython-36.opt-1.pyc000064400000043017150335715140012334 0ustar003


 \�P�@sDdZddddddddd	d
ddgZd
dlZd
dlZd
dlZd
dlZd
dlmZd
dlmZd
dl	m
Z
mZd
dlm
Z
mZGdd�de�Zd5dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd6d%d&�Zd'd
�Zd(d�Zd)d�Zd*d�Zd+d�Zd7d-d	�Zd.d�Z d8d/d0�Z!d9d1d�Z"d:d2d�Z#d;d3d�Z$d<d4d�Z%dS)=aq	
Basic statistics module.

This module provides functions for calculating statistics of data, including
averages, variance, and standard deviation.

Calculating averages
--------------------

==================  =============================================
Function            Description
==================  =============================================
mean                Arithmetic mean (average) of data.
harmonic_mean       Harmonic mean of data.
median              Median (middle value) of data.
median_low          Low median of data.
median_high         High median of data.
median_grouped      Median, or 50th percentile, of grouped data.
mode                Mode (most common value) of data.
==================  =============================================

Calculate the arithmetic mean ("the average") of data:

>>> mean([-1.0, 2.5, 3.25, 5.75])
2.625


Calculate the standard median of discrete data:

>>> median([2, 3, 4, 5])
3.5


Calculate the median, or 50th percentile, of data grouped into class intervals
centred on the data values provided. E.g. if your data points are rounded to
the nearest whole number:

>>> median_grouped([2, 2, 3, 3, 3, 4])  #doctest: +ELLIPSIS
2.8333333333...

This should be interpreted in this way: you have two data points in the class
interval 1.5-2.5, three data points in the class interval 2.5-3.5, and one in
the class interval 3.5-4.5. The median of these data points is 2.8333...


Calculating variability or spread
---------------------------------

==================  =============================================
Function            Description
==================  =============================================
pvariance           Population variance of data.
variance            Sample variance of data.
pstdev              Population standard deviation of data.
stdev               Sample standard deviation of data.
==================  =============================================

Calculate the standard deviation of sample data:

>>> stdev([2.5, 3.25, 5.5, 11.25, 11.75])  #doctest: +ELLIPSIS
4.38961843444...

If you have previously calculated the mean, you can pass it as the optional
second argument to the four "spread" functions to avoid recalculating it:

>>> data = [1, 2, 2, 4, 4, 4, 5, 6]
>>> mu = mean(data)
>>> pvariance(data, mu)
2.5


Exceptions
----------

A single exception is defined: StatisticsError is a subclass of ValueError.

�StatisticsError�pstdev�	pvariance�stdev�variance�median�
median_low�median_high�median_grouped�mean�mode�
harmonic_mean�N)�Fraction)�Decimal)�groupby�chain)�bisect_left�bisect_rightc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�"/usr/lib64/python3.6/statistics.pyrcscCs�d}t|�\}}||i}|j}ttt|��}xRt|t�D]D\}}	t||�}x0tt|	�D]"\}}|d7}||d�|||<qVWq8Wd|kr�|d}
ntdd�t|j	��D��}
||
|fS)aC_sum(data [, start]) -> (type, sum, count)

    Return a high-precision sum of the given numeric data as a fraction,
    together with the type to be converted to and the count of items.

    If optional argument ``start`` is given, it is added to the total.
    If ``data`` is empty, ``start`` (defaulting to 0) is returned.


    Examples
    --------

    >>> _sum([3, 2.25, 4.5, -0.5, 1.0], 0.75)
    (<class 'float'>, Fraction(11, 1), 5)

    Some sources of round-off error will be avoided:

    # Built-in sum returns zero.
    >>> _sum([1e50, 1, -1e50] * 1000)
    (<class 'float'>, Fraction(1000, 1), 3000)

    Fractions and Decimals are also supported:

    >>> from fractions import Fraction as F
    >>> _sum([F(2, 3), F(7, 5), F(1, 4), F(5, 6)])
    (<class 'fractions.Fraction'>, Fraction(63, 20), 4)

    >>> from decimal import Decimal as D
    >>> data = [D("0.1375"), D("0.2108"), D("0.3061"), D("0.0419")]
    >>> _sum(data)
    (<class 'decimal.Decimal'>, Fraction(6963, 10000), 4)

    Mixed types are currently treated as an error, except that int is
    allowed.
    r
�Ncss|]\}}t||�VqdS)N)r)�.0�d�nrrr�	<genexpr>�sz_sum.<locals>.<genexpr>)
�_exact_ratio�get�_coerce�int�typer�map�sum�sorted�items)�data�start�countrrZpartialsZpartials_get�T�typ�values�totalrrr�_sumis$
r.cCs(y|j�Stk
r"tj|�SXdS)N)Z	is_finite�AttributeError�mathZisfinite)�xrrr�	_isfinite�sr2cCs�||kr|S|tks|tkr |S|tkr,|St||�r:|St||�rH|St|t�rV|St|t�rd|St|t�r|t|t�r||St|t�r�t|t�r�|Sd}t||j|jf��dS)z�Coerce types T and S to a common type, or raise TypeError.

    Coercion rules are currently an implementation detail. See the CoerceTest
    test class in test_statistics for details.
    z"don't know how to coerce %s and %sN)r!�bool�
issubclassr�float�	TypeErrorr)r*�S�msgrrrr �s(



r cCs�ydt|�tkst|�tkr"|j�Sy|j|jfStk
r`y|j�Stk
rZYnXYnXWnttfk
r�|dfSXd}t	|j
t|�j���dS)z�Return Real number x to exact (numerator, denominator) pair.

    >>> _exact_ratio(0.25)
    (1, 4)

    x is expected to be an int, Fraction, Decimal or float.
    Nz0can't convert type '{}' to numerator/denominator)r"r5r�as_integer_ratio�	numerator�denominatorr/�
OverflowError�
ValueErrorr6�formatr)r1r8rrrr�s
rcCsjt|�|kr|St|t�r(|jdkr(t}y||�Stk
rdt|t�r^||j�||j�S�YnXdS)z&Convert value to given numeric type T.rN)r"r4r!r;r5r6rr:)�valuer*rrr�_convert�s
r@cCs`tjt|��j�}|s|S|dd}x4tdt|��D]"}||d|kr6|d|�}Pq6W|S)Nr
r)�collections�Counter�iter�most_common�range�len)r'�tableZmaxfreq�irrr�_counts�srIcCs.t||�}|t|�kr&|||kr&|St�dS)z,Locate the leftmost value exactly equal to xN)rrFr=)�ar1rHrrr�
_find_lteq	s
rKcCs>t|||d�}|t|�dkr6||d|kr6|dSt�dS)z-Locate the rightmost value exactly equal to x)�lorN)rrFr=)rJ�lr1rHrrr�
_find_rteqs rN�negative valueccs(x"|D]}|dkrt|��|VqWdS)z7Iterate over values, failing if any are less than zero.r
N)r)r,�errmsgr1rrr�	_fail_negs
rQcCsHt|�|krt|�}t|�}|dkr,td��t|�\}}}t|||�S)a�Return the sample arithmetic mean of data.

    >>> mean([1, 2, 3, 4, 4])
    2.8

    >>> from fractions import Fraction as F
    >>> mean([F(3, 7), F(1, 21), F(5, 3), F(1, 3)])
    Fraction(13, 21)

    >>> from decimal import Decimal as D
    >>> mean([D("0.5"), D("0.75"), D("0.625"), D("0.375")])
    Decimal('0.5625')

    If ``data`` is empty, StatisticsError will be raised.
    rz%mean requires at least one data point)rC�listrFrr.r@)r'rr*r-r)rrrr
#scCs�t|�|krt|�}d}t|�}|dkr2td��n<|dkrn|d}t|tjtf�rf|dkrbt|��|Std��y"t	dd�t
||�D��\}}}Wntk
r�dSXt|||�S)aReturn the harmonic mean of data.

    The harmonic mean, sometimes called the subcontrary mean, is the
    reciprocal of the arithmetic mean of the reciprocals of the data,
    and is often appropriate when averaging quantities which are rates
    or ratios, for example speeds. Example:

    Suppose an investor purchases an equal value of shares in each of
    three companies, with P/E (price/earning) ratios of 2.5, 3 and 10.
    What is the average P/E ratio for the investor's portfolio?

    >>> harmonic_mean([2.5, 3, 10])  # For an equal investment portfolio.
    3.6

    Using the arithmetic mean would give an average of about 5.167, which
    is too high.

    If ``data`` is empty, or any element is less than zero,
    ``harmonic_mean`` will raise ``StatisticsError``.
    z.harmonic mean does not support negative valuesrz.harmonic_mean requires at least one data pointr
zunsupported typecss|]}d|VqdS)rNr)rr1rrrrdsz harmonic_mean.<locals>.<genexpr>)
rCrRrFr�
isinstance�numbersZRealrr6r.rQ�ZeroDivisionErrorr@)r'rPrr1r*r-r)rrrr=s$
"cCs\t|�}t|�}|dkr td��|ddkr8||dS|d}||d||dSdS)aBReturn the median (middle value) of numeric data.

    When the number of data points is odd, return the middle data point.
    When the number of data points is even, the median is interpolated by
    taking the average of the two middle values:

    >>> median([1, 3, 5])
    3
    >>> median([1, 3, 5, 7])
    4.0

    r
zno median for empty data�rN)r%rFr)r'rrHrrrrls
cCsLt|�}t|�}|dkr td��|ddkr8||dS||ddSdS)a	Return the low median of numeric data.

    When the number of data points is odd, the middle value is returned.
    When it is even, the smaller of the two middle values is returned.

    >>> median_low([1, 3, 5])
    3
    >>> median_low([1, 3, 5, 7])
    3

    r
zno median for empty datarVrN)r%rFr)r'rrrrr�scCs,t|�}t|�}|dkr td��||dS)aReturn the high median of data.

    When the number of data points is odd, the middle value is returned.
    When it is even, the larger of the two middle values is returned.

    >>> median_high([1, 3, 5])
    3
    >>> median_high([1, 3, 5, 7])
    5

    r
zno median for empty datarV)r%rFr)r'rrrrr�s
rc
Cs�t|�}t|�}|dkr"td��n|dkr2|dS||d}x*||fD]}t|ttf�rHtd|��qHWy||d}Wn(tk
r�t|�t|�d}YnXt||�}t	|||�}|}||d}	|||d||	S)a�Return the 50th percentile (median) of grouped continuous data.

    >>> median_grouped([1, 2, 2, 3, 4, 4, 4, 4, 4, 5])
    3.7
    >>> median_grouped([52, 52, 53, 54])
    52.5

    This calculates the median as the 50th percentile, and should be
    used when your data is continuous and grouped. In the above example,
    the values 1, 2, 3, etc. actually represent the midpoint of classes
    0.5-1.5, 1.5-2.5, 2.5-3.5, etc. The middle value falls somewhere in
    class 3.5-4.5, and interpolation is used to estimate it.

    Optional argument ``interval`` represents the class interval, and
    defaults to 1. Changing the class interval naturally will change the
    interpolated 50th percentile value:

    >>> median_grouped([1, 3, 3, 5, 7], interval=1)
    3.25
    >>> median_grouped([1, 3, 3, 5, 7], interval=2)
    3.5

    This function does not check whether the data points are at least
    ``interval`` apart.
    r
zno median for empty datarrVzexpected number but got %r)
r%rFrrS�str�bytesr6r5rKrN)
r'Zintervalrr1�obj�L�l1�l2Zcf�frrrr	�s&

cCsBt|�}t|�dkr |ddS|r6tdt|���ntd��dS)a�Return the most common data point from discrete or nominal data.

    ``mode`` assumes discrete data, and returns a single value. This is the
    standard treatment of the mode as commonly taught in schools:

    >>> mode([1, 1, 2, 3, 3, 3, 3, 4])
    3

    This also works with nominal (non-numeric) data:

    >>> mode(["red", "blue", "blue", "red", "green", "red", "red"])
    'red'

    If there is not exactly one most common value, ``mode`` will raise
    StatisticsError.
    rr
z.no unique mode; found %d equally common valueszno mode for empty dataN)rIrFr)r'rGrrrr�scsd�dkrt|��t�fdd�|D��\}}}t�fdd�|D��\}}}||dt|�8}||fS)a;Return sum of square deviations of sequence data.

    If ``c`` is None, the mean is calculated in one pass, and the deviations
    from the mean are calculated in a second pass. Otherwise, deviations are
    calculated from ``c`` as given. Use the second case with care, as it can
    lead to garbage results.
    Nc3s|]}|�dVqdS)rVNr)rr1)�crrrsz_ss.<locals>.<genexpr>c3s|]}|�VqdS)Nr)rr1)r^rrrsrV)r
r.rF)r'r^r*r-r)�UZtotal2Zcount2r)r^r�_sssr`cCsLt|�|krt|�}t|�}|dkr,td��t||�\}}t||d|�S)a�Return the sample variance of data.

    data should be an iterable of Real-valued numbers, with at least two
    values. The optional argument xbar, if given, should be the mean of
    the data. If it is missing or None, the mean is automatically calculated.

    Use this function when your data is a sample from a population. To
    calculate the variance from the entire population, see ``pvariance``.

    Examples:

    >>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]
    >>> variance(data)
    1.3720238095238095

    If you have already calculated the mean of your data, you can pass it as
    the optional second argument ``xbar`` to avoid recalculating it:

    >>> m = mean(data)
    >>> variance(data, m)
    1.3720238095238095

    This function does not check that ``xbar`` is actually the mean of
    ``data``. Giving arbitrary values for ``xbar`` may lead to invalid or
    impossible results.

    Decimals and Fractions are supported:

    >>> from decimal import Decimal as D
    >>> variance([D("27.5"), D("30.25"), D("30.25"), D("34.5"), D("41.75")])
    Decimal('31.01875')

    >>> from fractions import Fraction as F
    >>> variance([F(1, 6), F(1, 2), F(5, 3)])
    Fraction(67, 108)

    rVz*variance requires at least two data pointsr)rCrRrFrr`r@)r'�xbarrr*�ssrrrr"s&cCsHt|�|krt|�}t|�}|dkr,td��t||�\}}t|||�S)a�Return the population variance of ``data``.

    data should be an iterable of Real-valued numbers, with at least one
    value. The optional argument mu, if given, should be the mean of
    the data. If it is missing or None, the mean is automatically calculated.

    Use this function to calculate the variance from the entire population.
    To estimate the variance from a sample, the ``variance`` function is
    usually a better choice.

    Examples:

    >>> data = [0.0, 0.25, 0.25, 1.25, 1.5, 1.75, 2.75, 3.25]
    >>> pvariance(data)
    1.25

    If you have already calculated the mean of the data, you can pass it as
    the optional second argument to avoid recalculating it:

    >>> mu = mean(data)
    >>> pvariance(data, mu)
    1.25

    This function does not check that ``mu`` is actually the mean of ``data``.
    Giving arbitrary values for ``mu`` may lead to invalid or impossible
    results.

    Decimals and Fractions are supported:

    >>> from decimal import Decimal as D
    >>> pvariance([D("27.5"), D("30.25"), D("30.25"), D("34.5"), D("41.75")])
    Decimal('24.815')

    >>> from fractions import Fraction as F
    >>> pvariance([F(1, 4), F(5, 4), F(1, 2)])
    Fraction(13, 72)

    rz*pvariance requires at least one data point)rCrRrFrr`r@)r'�murr*rbrrrrQs'cCs2t||�}y|j�Stk
r,tj|�SXdS)z�Return the square root of the sample variance.

    See ``variance`` for arguments and other details.

    >>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])
    1.0810874155219827

    N)r�sqrtr/r0)r'ra�varrrrr�s
	
cCs2t||�}y|j�Stk
r,tj|�SXdS)z�Return the square root of the population variance.

    See ``pvariance`` for arguments and other details.

    >>> pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])
    0.986893273527251

    N)rrdr/r0)r'rcrerrrr�s
	
)r
)rO)r)N)N)N)N)N)&�__doc__�__all__rAZdecimalr0rTZ	fractionsrr�	itertoolsrrZbisectrrr=rr.r2r rr@rIrKrNrQr
rrrrr	rr`rrrrrrrr�<module>MsD

: 

/
7*

/
0
tty.cpython-36.opt-1.pyc000064400000002062150335715140010755 0ustar003


 \o�@sLdZddlTddgZdZdZdZdZdZd	Zd
Z	e
fdd�Ze
fdd�Zd
S)zTerminal utilities.�)�*�setraw�	setcbreak������cCs�t|�}|tttBtBtBtB@|t<|tt@|t<|t	t
tB@|t	<|t	tB|t	<|t
ttBtBtB@|t
<d|tt<d|tt<t|||�dS)zPut terminal into a raw mode.rrN)�	tcgetattr�IFLAGZBRKINTZICRNLZINPCKZISTRIPZIXON�OFLAGZOPOST�CFLAGZCSIZEZPARENBZCS8�LFLAG�ECHO�ICANONZIEXTENZISIG�CC�VMIN�VTIME�	tcsetattr)�fd�when�mode�r�/usr/lib64/python3.6/tty.pyrs"cCsFt|�}|tttB@|t<d|tt<d|tt<t|||�dS)z Put terminal into a cbreak mode.rrN)rrrrrrrr)rrrrrrrs
N)
�__doc__Ztermios�__all__rr
rrZISPEEDZOSPEEDrZ	TCSAFLUSHrrrrrr�<module>sast.cpython-36.opt-2.pyc000064400000013751150335715140010734 0ustar003


 \�/�@s�ddlTd dd�ZeeefZdd�Zd!d
d�Zdd
�Zdd�Z	d"dd�Z
dd�Zdd�Zd#dd�Z
dd�ZGdd�de�ZGdd�de�ZdS)$�)�*�	<unknown>�execcCst|||t�S)N)�compileZ
PyCF_ONLY_AST)�source�filename�mode�r	�/usr/lib64/python3.6/ast.py�parsesrcs:t|t�rt|dd�}t|t�r&|j}�fdd���|�S)N�eval)rcs�t|t�r|jSt|ttf�r$|jSt|t�r4|jSt|t�rNt	t
�|j��St|t�rht
t
�|j��St|t�r�tt
�|j��St|t�r�t�fdd�t|j|j�D��St|t�r�|jSt|t�o�t|jttf��r
�|j�}t|t��rrt|jt��r|
S|Snht|t��rrt|jttf��rr�|j�}�|j �}t|t��rrt|t��rrt|jt��rj||S||St!dt"|���dS)Nc3s"|]\}}�|��|�fVqdS)Nr	)�.0�k�v)�_convertr	r
�	<genexpr>Asz1literal_eval.<locals>._convert.<locals>.<genexpr>zmalformed node or string: )#�
isinstance�Constant�value�StrZBytes�sZNum�nZTuple�tuple�mapZeltsZList�list�Set�setZDict�dict�zip�keys�valuesZNameConstantZUnaryOp�opZUAddZUSub�operand�
_NUM_TYPESZBinOpZAddZSub�left�right�
ValueError�repr)�noder"r$r%)rr	r
r3s>









zliteral_eval.<locals>._convert)r�strrZ
Expression�body)Znode_or_stringr	)rr
�literal_eval(s

"r+TFcs2���fdd��t|t�s*td|jj���|�S)Ncs�t�t�r��fdd�t��D�}d�jjdj�r>dd�|D�ndd�|D��f}�r��jr�||rfdphd7}|dj��fd	d��jD��7}|d
St�t�r�ddj�fdd��D��St��S)
Ncsg|]\}}|�|�f�qSr	r	)r
�a�b)�_formatr	r
�
<listcomp>csz)dump.<locals>._format.<locals>.<listcomp>z%s(%sz, css|]}d|VqdS)z%s=%sNr	)r
�fieldr	r	r
resz(dump.<locals>._format.<locals>.<genexpr>css|]\}}|VqdS)Nr	)r
r,r-r	r	r
rgs� c3s$|]}d|�t�|��fVqdS)z%s=%sN)�getattr)r
r,)r.r(r	r
rks�)z[%s]c3s|]}�|�VqdS)Nr	)r
�x)r.r	r
ros)	r�AST�iter_fields�	__class__�__name__�join�_attributesrr')r(Zfields�rv)r.�annotate_fields�include_attributes)r(r
r.as


zdump.<locals>._formatzexpected AST, got %r)rr5�	TypeErrorr7r8)r(r<r=r	)r.r<r=r
�dumpXs	
r?cCsBx<dD]4}||jkr||jkrt||�rt||t||��qW|S)N�lineno�
col_offset)r@rA)r:�hasattr�setattrr2)�new_nodeZold_node�attrr	r	r
�
copy_locationvs


rFcs�fdd���|dd�|S)Ncsfd|jkr"t|d�s||_n|j}d|jkrDt|d�s>||_n|j}xt|�D]}�|||�qNWdS)Nr@rA)r:rBr@rA�iter_child_nodes)r(r@rA�child)�_fixr	r
rI�s



z#fix_missing_locations.<locals>._fix�rr	)r(r	)rIr
�fix_missing_locations�s
rKrJcCs2x,t|�D] }d|jkr
t|dd�||_q
W|S)Nr@r)�walkr:r2r@)r(rrHr	r	r
�increment_lineno�s
rMccs>x8|jD].}y|t||�fVWqtk
r4YqXqWdS)N)�_fieldsr2�AttributeError)r(r0r	r	r
r6�s
r6ccsTxNt|�D]B\}}t|t�r$|Vq
t|t�r
x|D]}t|t�r4|Vq4Wq
WdS)N)r6rr5r)r(�namer0�itemr	r	r
rG�s



rGcCs�t|ttttf�s"td|jj��|jo6t|jdt	�s<dS|jdj
}t|t�rZ|j}n"t|t
�rxt|j
t�rx|j
}ndS|r�ddl}|j|�}|S)Nz%r can't have docstringsr)rZAsyncFunctionDefZFunctionDefZClassDefZModuler>r7r8r*ZExprrrrrr)�inspectZcleandoc)r(Zclean�textrRr	r	r
�
get_docstring�s

rTccs@ddlm}||g�}x$|r:|j�}|jt|��|VqWdS)Nr)�deque)�collectionsrU�popleft�extendrG)r(rUZtodor	r	r
rL�s
rLc@seZdZdd�Zdd�ZdS)�NodeVisitorcCs"d|jj}t|||j�}||�S)NZvisit_)r7r8r2�
generic_visit)�selfr(�methodZvisitorr	r	r
�visit�szNodeVisitor.visitcCs\xVt|�D]J\}}t|t�r@x6|D]}t|t�r"|j|�q"Wq
t|t�r
|j|�q
WdS)N)r6rrr5r])r[r(r0rrQr	r	r
rZ�s



zNodeVisitor.generic_visitN)r8�
__module__�__qualname__r]rZr	r	r	r
rY�srYc@seZdZdd�ZdS)�NodeTransformercCs�x�t|�D]�\}}t|t�r|g}xL|D]D}t|t�r`|j|�}|dkrJq&nt|t�s`|j|�q&|j|�q&W||dd�<q
t|t�r
|j|�}|dkr�t||�q
t|||�q
W|S)N)	r6rrr5r]rX�append�delattrrC)r[r(r0Z	old_valueZ
new_valuesrrDr	r	r
rZ.s&







zNodeTransformer.generic_visitN)r8r^r_rZr	r	r	r
r`
s$r`N)rr)TF)rJ)T)Z_astr�int�float�complexr#r+r?rFrKrMr6rGrTrL�objectrYr`r	r	r	r
�<module>s

0


%sre_parse.cpython-36.opt-1.pyc000064400000047531150335715140012132 0ustar003


 \���@s�dZddlTdZdZed�Zed�Zed�Zed�Zed	�Z	ee
eh�Zee
eeeeeh�Zeed
�feed�feed�feed
�feed�feed�feed�feed�fd�Zeefeefeefeeefgfeeefgfeeefgfeeefgfeeefgfeeefgfee fd�
Z!e"e#e$e%e&e'e(e)d�Z*e'e#Be)Be+Be(BZ,Gdd�de-�Z.Gdd�d�Z/Gdd�d�Z0Gdd�d�Z1dd�Z2dd �Z3d!d"�Z4d#d$�Z5d3d&d'�Z6d(d)�Z7d*d+�Z8d4d-d.�Z9d/d0�Z:d1d2�Z;d,S)5zInternal support module for sre�)�*z.\[{()*+?^$|z*+?{�
0123456789Z01234567Z0123456789abcdefABCDEFZ4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZz 	

����
�
�	��\)z\az\bz\fz\nz\rz\tz\vz\\)
z\Az\bz\Bz\dz\Dz\sz\Sz\wz\Wz\Z)�i�L�m�s�x�a�t�uc@seZdZdS)�VerboseN)�__name__�
__module__�__qualname__�rr�!/usr/lib64/python3.6/sre_parse.pyrGsrc@sBeZdZdd�Zedd��Zddd�Zdd	�Zd
d�Zdd
�Z	dS)�PatterncCsd|_i|_dg|_d|_dS)Nr)�flags�	groupdict�groupwidths�lookbehindgroups)�selfrrr�__init__LszPattern.__init__cCs
t|j�S)N)�lenr)rrrr�groupsQszPattern.groupsNcCsb|j}|jjd�|jtkr$td��|dk	r^|jj|d�}|dk	rTtd|||f��||j|<|S)Nztoo many groupsz7redefinition of group name %r as group %d; was group %d)r"r�append�	MAXGROUPS�errorr�get)r�name�gid�ogidrrr�	opengroupTs

zPattern.opengroupcCs|j�|j|<dS)N)�getwidthr)rr(�prrr�
closegroup`szPattern.closegroupcCs||jko|j|dk	S)N)r"r)rr(rrr�
checkgroupbszPattern.checkgroupcCs6|jdk	r2|j|�s|jd��||jkr2|jd��dS)Nzcannot refer to an open groupz?cannot refer to group defined in the same lookbehind subpattern)rr.r%)rr(�sourcerrr�checklookbehindgroupes




zPattern.checklookbehindgroup)N)
rrrr �propertyr"r*r-r.r0rrrrrJs
rc@s`eZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�ZdS)�
SubPatternNcCs"||_|dkrg}||_d|_dS)N)�pattern�data�width)rr3r4rrrr os
zSubPattern.__init__rcCs�d}ttf}�x�|jD�]�\}}t|dt|�dd�|tkrtt�x*|D]"\}}t|ddt|�|�qLWq|tkr�t�x:t|d�D]*\}}|r�t|dd�|j|d�q�Wq|t	k�r|\}}	}
td|�|	j|d�|
�r�t|dd�|
j|d�qt
||��r�d}x\|D]T}t
|t��rX|�sDt�|j|d�d}n"|�sjtd	dd�t|dd�d}�q(W|�s�t�qtd|�qWdS)
NTz  �)�end��OR�ELSEF� )�tuple�listr4�print�str�IN�BRANCH�	enumerate�dump�GROUPREF_EXISTS�
isinstancer2)r�level�nl�seqtypes�op�avrr�	condgroup�item_yes�item_norrrrCusH 




zSubPattern.dumpcCs
t|j�S)N)�reprr4)rrrr�__repr__�szSubPattern.__repr__cCs
t|j�S)N)r!r4)rrrr�__len__�szSubPattern.__len__cCs|j|=dS)N)r4)r�indexrrr�__delitem__�szSubPattern.__delitem__cCs&t|t�rt|j|j|�S|j|S)N)rE�slicer2r3r4)rrQrrr�__getitem__�s
zSubPattern.__getitem__cCs||j|<dS)N)r4)rrQ�coderrr�__setitem__�szSubPattern.__setitem__cCs|jj||�dS)N)r4�insert)rrQrUrrrrW�szSubPattern.insertcCs|jj|�dS)N)r4r#)rrUrrrr#�szSubPattern.appendc	Cs�|jdk	r|jSd}}�x�|jD�]�\}}|tkr�td}d}x0|dD]$}|j�\}}t||�}t||�}qJW||}||}q"|tkr�|j�\}}||}||}q"|tkr�|dj�\}}||}||}q"|t	k�r|dj�\}}|||d}|||d}q"|t
k�r,|d}|d}q"|tk�rX|jj
|\}}||}||}q"|tk�r�|dj�\}}|ddk	�r�|dj�\}}t||�}t||�}nd}||}||}q"|tkr"Pq"Wt|td�t|t�f|_|jS)Nrr8����)r5r4rA�	MAXREPEATr+�min�max�CALL�
SUBPATTERN�_REPEATCODES�
_UNITCODES�GROUPREFr3rrD�SUCCESS)	r�lo�hirIrJr�j�l�hrrrr+�sZ












zSubPattern.getwidth)N)r)
rrrr rCrOrPrRrTrVrWr#r+rrrrr2ms

(r2c@sbeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Ze	d
d��Z
dd�Zdd�Zddd�Z
dS)�	TokenizercCs@t|t�|_||_|js"t|d�}||_d|_d|_|j�dS)N�latin1r)rEr?�istext�string�decoded_stringrQ�next�_Tokenizer__next)rrkrrrr �s
zTokenizer.__init__cCs�|j}y|j|}Wntk
r.d|_dSX|dkr�|d7}y||j|7}Wn.tk
r�td|jt|j�d�d�YnX|d|_||_dS)Nrr8zbad escape (end of pattern))rQrl�
IndexErrorrmr%rkr!)rrQ�charrrr�__next�s
zTokenizer.__nextcCs||jkr|j�dSdS)NTF)rmrn)rrprrr�match�s
zTokenizer.matchcCs|j}|j�|S)N)rmrn)r�thisrrrr&�sz
Tokenizer.getcCs:d}x0t|�D]$}|j}||kr"P||7}|j�qW|S)Nr6)�rangermrn)r�n�charset�result�_�crrr�getwhileszTokenizer.getwhilecCshd}x^|j}|j�|dkr>|s*|jd��|jd|t|���||krX|sV|jdd��P||7}qW|S)Nr6zmissing group namezmissing %s, unterminated namer8)rmrnr%r!)r�
terminatorrwryrrr�getuntil
s


zTokenizer.getuntilcCs|jt|jpd�S)Nr6)rQr!rm)rrrr�possz
Tokenizer.poscCs|jt|jpd�S)Nr6)rQr!rm)rrrr�tellszTokenizer.tellcCs||_|j�dS)N)rQrn)rrQrrr�seekszTokenizer.seekrcCst||j|j�|�S)N)r%rkr~)r�msg�offsetrrrr%#szTokenizer.errorN)r)rrrr rnrrr&rzr|r1r}r~rr%rrrrrh�s		rhcCstj|�}|r|Stj|�}|r0|dtkr0|S�y�|dd�}|dkr�||jdt�7}t|�dkrx|jd|t|���tt	|dd�d�fS|dkr�|j
r�||jdt�7}t|�d	kr�|jd|t|���tt	|dd�d�fS|d
ko�|j
�rF||jdt�7}t|�dk�r$|jd|t|���t	|dd�d�}t|�t|fS|tk�r�||jdt�7}t	|dd�d�}|d
k�r�|jd|t|���t|fS|t
k�r�t�t|�dk�r�|tk�r�|jd|t|���tt|d�fSWntk
�r�YnX|jd|t|���dS)Nrr8rXr�zincomplete escape %s�r��U��
�z.octal escape value %s outside of range 0-0o377z
bad escape %s)�ESCAPESr&�
CATEGORIESr@rz�	HEXDIGITSr!r%�LITERAL�intrj�chr�	OCTDIGITS�DIGITS�
ValueError�ASCIILETTERS�ord)r/�escaperUryrrr�
_class_escape&sR





r�cCs�tj|�}|r|Stj|�}|r$|S�yt|dd�}|dkr�||jdt�7}t|�dkrl|jd|t|���tt|dd�d�fS|dkr�|j	r�||jdt�7}t|�dkr�|jd|t|���tt|dd�d�fS|d	ko�|j	�r:||jd
t�7}t|�dk�r|jd|t|���t|dd�d�}t
|�t|fS|dk�rj||jdt�7}tt|dd�d
�fS|tk�r\|j
tk�r�||j�7}|dtk�r�|dtk�r�|j
tk�r�||j�7}t|dd�d
�}|d
k�r�|jd|t|���t|fSt|dd��}||jk�rD|j|��s0|jdt|���|j||�t|fS|jd|t|�d��t|�dk�r�|tk�r�|jd|t|���tt|d�fSWntk
�r�YnX|jd|t|���dS)Nr8rXrr�zincomplete escape %sr�rr�r�r�r��0r�z.octal escape value %s outside of range 0-0o377zcannot refer to an open groupzinvalid group reference %dz
bad escape %s)r�r&r�rzr�r!r%r�r�rjr�r�r�rmr"r.r0rar�r�r�)r/r��staterUry�grouprrr�_escapeVsn







r�cCs$g}|j}|j}|j�}x.|t||||d|o4|��|d�sPqWt|�dkr\|dSt|�}|j}	x\d}
xP|D]*}|s�P|
dkr�|d}
qv|d|
krvPqvWx|D]
}|d=q�W|	|
�qlPqlWxD|D]"}t|�dks�|ddtk	r�Pq�W|	tdd�|D�f�|S|jtd|ff�|S)Nr8�|rcSsg|]}|d�qS)rr)�.0�itemrrr�
<listcomp>�sz_parse_sub.<locals>.<listcomp>)	r#rrr~�_parser!r2r�r@rA)r/r��verbose�nested�items�itemsappend�sourcematch�start�
subpattern�subpatternappend�prefixr�rrr�
_parse_sub�sD




r�cCsht||||d�}|jd�rDt||||d�}|jdkrH|jd��nd}t|�}|jt|||ff�|S)Nr8r�z/conditional backref with more than two branches)r�rrrmr%r2r#rD)r/r�rKr�r�rLrMr�rrr�_parse_sub_cond�s

r�Fc)Cst|�}|j}|j}|j}t}	t}
�
x�|j}|dkr6P|dkr@P|�|r||tkrTq&|dkr|x|�}|dkst|dkr^Pq^Wq&|ddkr�t|||�}||�q&|t	kr�|t
|
|�f�q&|dk�r4|j�d}
g}|j}|d�r�|tdf�|dd�}�x�|�}|dk�r |j
d	|j�|
��|d
k�r8||k�r8Pn&|ddk�rRt||�}nt
|
|�f}|d��r�|�}|dk�r�|j
d	|j�|
��|d
k�r�|dtk�r�|dd}||�|t
|
d�f�P|ddk�r�t||�}nt
|
|�f}|dt
k�s|dt
k�r4d||f}|j
|t|�dt|���|d}|d}||k�rvd||f}|j
|t|�dt|���|t||ff�n"|dtk�r�|dd}||��q�W|	|�dk�r�|ddt
k�r�||d�nT|	|�d
k�r&|ddtk�r&|ddt
k�r&|t|ddf�n|t|f�q&|tk�rb|j�}
|dk�r\d7\}}�nJ|dk�rtdt}}�n2|dk�r�dt}}�n|dk�r�|jdk�r�|t
|
|�f�q&dt}}d}}x|jtk�r�||�7}�q�W|d��rx"|jtk�r
||�7}�q�Wn|}|d��s8|t
|
|�f�|j|
�q&|�rXt|�}|tk�rXtd��|�r�t|�}|tk�rxtd��||k�r�|j
d|j�|
��ntd|f��|�r�|d8d�}nd}|�s�|	|�dk�r|ddtk�r|j
d|j�|
t|���|ddtk�r0|j
d|j�|
t|���|d��rNt|||ff|d9<nt|||ff|d:<q&|dk�rz|tdf�q&|dk�
r�|j�d}d}d}d}d}d}|d��	r�|�}|dk�r�|j
d��|dk�r�|d��r|jd �}|j��s�d!|}|j
|t|�d��n�|d"��r�|jd#�}|j��sHd!|}|j
|t|�d��|j j|�} | dk�rzd$|}|j
|t|�d��|j!| ��s�|j
d%t|�d��|j"| |�|t#| f�q&n2|�}|dk�r�|j
d��|j
d&|t|�d
���n�|d'k�r�d}�n�|dk�rDx4|jdk�r*|j
d(|j�|��|�d#k�r
P�q
Wq&�n�|d)k�r0d}!|dk�r�|�}|dk�rv|j
d��|d*k�r�|j
d+|t|�d
��d;}!|j$}"|"dk�r�|j%|_$t&||||d�}#|!dk�r�|"dk�r�d|_$|d#��s�|j
d,|j�|��|d"k�r|t'|!|#ff�q&|t(|!|#ff�q&�n�|dk�	r$|jd#�}$d}|$j��r�|j j|$�}|dk�	rd$|$}|j
|t|$�d��n�yt|$�}|dk�r�t)�Wn4t)k
�r�d!|$}|j
|t|$�d�d�YnX|�s�|j
d-t|$�d��|t*k�	rd.|}|j
|t|$�d��|j"||�n�|t+k�	s8|dk�	r�t,|||�}%|%dk�	r�|�	s\|�	r�ddl-}&|&j.d/|j/dd0�t|j/�d0k�	r�d1ndft0|d2d3�|j1t2@r&|r&t3�q&|%\}}d}n|j
d4|t|�d��|dk	�
r0y|j4|�}Wn<t
k
�
r.}'z|j
|'j5t|�d�d�WYdd}'~'XnX|�
rLt6|||||d�}#n,|�
s\|t2@�
od|t2@}(t&|||(|d�}#|jd#��
s�|j
d,|j�|��|dk	�
r�|j7||#�|t8||||#ff�q&|dk�
r�|tt9f�q&|d5k�
r�|jtt:f�q&td6|f��q&W|S)<Nz|)�#rrr�[r8�^zunterminated character set�]�-zbad character range %s-%srX�?r�+�{�}r6�,z"the repetition number is too largez"min repeat greater than max repeatzunsupported quantifier %rznothing to repeatzmultiple repeat�.�(Tzunexpected end of pattern�P�<�>zbad character in group name %r�=�)zunknown group name %rzcannot refer to an open groupzunknown extension ?P�:zmissing ), unterminated commentz=!<z=!zunknown extension ?<z"missing ), unterminated subpatternzbad group numberzinvalid group reference %dz-Flags not at the start of the expression %r%s�z (truncated)r�)�
stacklevelzunknown extension ?�$z unsupported special character %r)rr8rYrYrYrY);r2r#r&rrr!r�rm�
WHITESPACEr��
SPECIAL_CHARSr�r~�NEGATEr%r�r@�RANGE�NOT_LITERAL�REPEAT_CHARSrZr�rr��
OverflowError�AssertionError�ATr_�
MIN_REPEAT�
MAX_REPEAT�ANYr|�isidentifierrr.r0rarr"r��ASSERT�
ASSERT_NOTr�r$�FLAGS�_parse_flags�warnings�warnrk�DeprecationWarningr�SRE_FLAG_VERBOSErr*r�r�r-r^�AT_BEGINNING�AT_END))r/r�r�r��firstr�r��	sourcegetr��_len�_ordrsrU�here�set�	setappendr��code1�that�code2r�rcrdr[r\rpr�r�r'rK�	add_flags�	del_flagsr(�dirrr,�condnamerr��err�sub_verboserrrr��s






 2











(






































*



r�cCs�|j}d}d}|dkrrxZ|t|O}|�}|dkr<|jd��|dkrFP|tkr|j�rZdnd}|j|t|���qW|dkr�|j|O_dS|t@r�|jdd��|dk�rL|�}|dkr�|jd	��|tkr�|j�r�dnd	}|j|t|���x`|t|O}|�}|dk�r|jd
��|dk�rP|tkr�|j��r4dnd
}|j|t|���q�W|t@�rb|jdd��||@�rx|jd
d��||fS)Nrr�zmissing -, : or )z)-:zunknown flagr�z,bad inline flags: cannot turn on global flagr8zmissing flagz	missing :r�z-bad inline flags: cannot turn off global flagz(bad inline flags: flag turned on and off)r&r�r%�isalphar!r�GLOBAL_FLAGS)r/r�rpr�r�r�r�rrrr�sR







r�cCsjt|t�r>|t@rtd��|t@s,|tO}qf|t@rftd��n(|t@rNtd��|t@rf|t@rftd��|S)Nz)cannot use LOCALE flag with a str patternz(ASCII and UNICODE flags are incompatiblez,cannot use UNICODE flag with a bytes patternz'ASCII and LOCALE flags are incompatible)rEr?�SRE_FLAG_LOCALEr��SRE_FLAG_ASCII�SRE_FLAG_UNICODE)�srcrrrr�	fix_flags<s


r�NcCs�t|�}|dkrt�}||_||_yt|||t@d�}WnBtk
rzt�}|tB|_||_|jd�t||dd�}YnXt||j	j�|j	_|j
dk	r�|jd��|t@r�|j
�|S)NrTzunbalanced parenthesis)rhrrr?r�r�rrr�r3rmr%�SRE_FLAG_DEBUGrC)r?rr3r/r,rrr�parseLs&



r�cs�t|���j}g�g�g��j}�����fdd�}�j}�x�|�}|dkrNP|ddk�r�|d}|dk�rJd}�jd�s��jd	���jd
�}|j�r�y||}	Wn tk
r�t	d|��YnXnlyt
|�}	|	dkr�t�Wn0tk
�r�jd|t|�d�d�YnX|	t
k�r4�jd
|	t|�d��||	t|�d��q�|dk�r��jtk�r�||�7}�jtk�r�||�7}|tt
|dd�d�d@���q�|tk�rZd}
�jtk�r4||�7}|tk�r4|dtk�r4�jtk�r4||�7}d}
t
|dd�d�}|dk�r(�jd|t|���|t|��|
�s�|t
|dd��t|�d�nZytt|d�}Wn<tk
�r�|tk�r�ddl}|jd|tdd�YnX||�q>||�q>W��r؈jdj���t|t��s�dd��D����fS)NcsX|�jkr�jd||���r8�jdj����dd�=�jt��|f��jd�dS)Nzinvalid group reference %dr6)r"r%r#�joinr!)rQr})r"�literal�literalsr3rrr�addgroupus

z parse_template.<locals>.addgrouprrr8�gr6r�z	missing <r�zunknown group name %rzbad character in group name %rzinvalid group reference %dr�r�r�FrXTz.octal escape value %s outside of range 0-0o377z
bad escape %sr�)r�cSs"g|]}|dkrdn|jd��qS)Nzlatin-1)�encode)r�rrrrr��sz"parse_template.<locals>.<listcomp>)rhr&r#�
groupindexrrr%r|r��KeyErrorror�r�r!r$rmr�r�r�r�r�r�r�r�r�rEr?)r/r3�sget�lappendr�r�rsryr'rQ�isoctalr�r)r"r�r�r3rr�parse_templatels�









"



 


r�cCsz|j}|jdd�}|\}}|dd�}y&x |D]\}}||�pB|||<q0WWn tk
rntd|��YnX|j|�S)Nrzinvalid group reference %d)r�rkror%r�)�templaterrr��emptyr"r�rQr�rrr�expand_template�sr�)F)rN)<�__doc__�
sre_constantsr�r��	frozensetr�r�r�r�r�r�r�r_r�r�r@r�r��CATEGORYr`r�r�r�ZAT_BEGINNING_STRINGZAT_BOUNDARYZAT_NON_BOUNDARYZCATEGORY_DIGITZCATEGORY_NOT_DIGITZCATEGORY_SPACEZCATEGORY_NOT_SPACEZ
CATEGORY_WORDZCATEGORY_NOT_WORDZ
AT_END_STRINGr��SRE_FLAG_IGNORECASEr��SRE_FLAG_MULTILINE�SRE_FLAG_DOTALLr�r��SRE_FLAG_TEMPLATEr�r�r�r��	Exceptionrrr2rhr�r�r�r�r�r�r�r�r�r�rrrr�<module>sj






#qH0A3
<,
 Wantigravity.cpython-36.pyc000064400000001415150335715140011540 0ustar003


 \��@s&ddlZddlZejd�dd�ZdS)�Nzhttps://xkcd.com/353/cCs\tj|�j�}dd�|dd�|dd�fD�\}}td||dd�||dd�f�dS)z�Compute geohash() using the Munroe algorithm.

    >>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
    37.857713 -122.544543

    cSsg|]}dtjd|��qS)z%fz0.)�float�fromhex)�.0�x�r�#/usr/lib64/python3.6/antigravity.py�
<listcomp>szgeohash.<locals>.<listcomp>N�� z	%d%s %d%s�)�hashlibZmd5Z	hexdigest�print)ZlatitudeZ	longitudeZdatedow�h�p�qrrr�geohashs&r)Z
webbrowserr�openrrrrr�<module>s
code.cpython-36.opt-1.pyc000064400000023156150335715140011056 0ustar003


 \v)�@s�dZddlZddlZddlZddlmZmZddddgZGdd�d�ZGd	d�de�Z	dd
d�Z
edkr�ej�Z
e
jdd
dd�e
j�Zejs�ejjr�dZndZe
e�dS)z?Utilities needed to emulate Python's interactive interpreter.

�N)�CommandCompiler�compile_command�InteractiveInterpreter�InteractiveConsole�interactrc@sFeZdZdZddd�Zddd�Zd	d
�Zddd�Zd
d�Zdd�Z	dS)rz�Base class for InteractiveConsole.

    This class deals with parsing and interpreter state (the user's
    namespace); it doesn't deal with input buffering or prompting or
    input file naming (the filename is always passed in explicitly).

    NcCs$|dkrddd�}||_t�|_dS)aConstructor.

        The optional 'locals' argument specifies the dictionary in
        which code will be executed; it defaults to a newly created
        dictionary with key "__name__" set to "__console__" and key
        "__doc__" set to None.

        NZ__console__)�__name__�__doc__)�localsr�compile)�selfr	�r�/usr/lib64/python3.6/code.py�__init__s	
zInteractiveInterpreter.__init__�<input>�singlec
CsRy|j|||�}Wn$tttfk
r6|j|�dSX|dkrDdS|j|�dS)a�Compile and run some source in the interpreter.

        Arguments are as for compile_command().

        One several things can happen:

        1) The input is incorrect; compile_command() raised an
        exception (SyntaxError or OverflowError).  A syntax traceback
        will be printed by calling the showsyntaxerror() method.

        2) The input is incomplete, and more input is required;
        compile_command() returned None.  Nothing happens.

        3) The input is complete; compile_command() returned a code
        object.  The code is executed by calling self.runcode() (which
        also handles run-time exceptions, except for SystemExit).

        The return value is True in case 2, False in the other cases (unless
        an exception is raised).  The return value can be used to
        decide whether to use sys.ps1 or sys.ps2 to prompt the next
        line.

        FNT)r
�
OverflowError�SyntaxError�
ValueError�showsyntaxerror�runcode)r�source�filenameZsymbol�coderrr
�	runsource's

z InteractiveInterpreter.runsourcecCs>yt||j�Wn(tk
r&�Yn|j�YnXdS)a�Execute a code object.

        When an exception occurs, self.showtraceback() is called to
        display a traceback.  All exceptions are caught except
        SystemExit, which is reraised.

        A note about KeyboardInterrupt: this exception may occur
        elsewhere in this code, and may not always be caught.  The
        caller should be prepared to deal with it.

        N)�execr	�
SystemExit�
showtraceback)rrrrr
rNszInteractiveInterpreter.runcodecCs�tj�\}}}|t_|t_|t_|rp|tkrpy|j\}\}}}}	Wntk
rVYnXt|||||	f�}|t_tjtj	kr�t
j||�}
|jdj
|
��ntj|||�dS)apDisplay the syntax error that just occurred.

        This doesn't display a stack trace because there isn't one.

        If a filename is given, it is stuffed in the exception instead
        of what was there before (because Python's parser always uses
        "<string>" when reading from a string).

        The output is written by self.write(), below.

        �N)�sys�exc_info�	last_type�
last_value�last_tracebackr�argsr�
excepthook�__excepthook__�	traceback�format_exception_only�write�join)rr�type�value�tb�msgZdummy_filename�lineno�offset�line�linesrrr
rasz&InteractiveInterpreter.showsyntaxerrorcCs|tj�\t_t_}}|t_zPtj|d|d|j�}tjtj	krT|j
dj|��ntj|d|d|�Wdd}}XdS)z�Display the exception that just occurred.

        We remove the first stack item because it is our own code.

        The output is written by self.write(), below.

        r�rN)rrr r!r"r&�format_exception�tb_nextr$r%r(r))rZlast_tbZeir1rrr
r�sz$InteractiveInterpreter.showtracebackcCstjj|�dS)z�Write a string.

        The base implementation writes to sys.stderr; a subclass may
        replace this with a different implementation.

        N)r�stderrr()r�datarrr
r(�szInteractiveInterpreter.write)N)rr)N)
r�
__module__�__qualname__rrrrrrr(rrrr
rs

'
#c@s>eZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
d�ZdS)rz�Closely emulate the behavior of the interactive Python interpreter.

    This class builds on InteractiveInterpreter and adds prompting
    using the familiar sys.ps1 and sys.ps2, and input buffering.

    N�	<console>cCstj||�||_|j�dS)z�Constructor.

        The optional locals argument will be passed to the
        InteractiveInterpreter base class.

        The optional filename argument should specify the (file)name
        of the input stream; it will show up in tracebacks.

        N)rrr�resetbuffer)rr	rrrr
r�s
zInteractiveConsole.__init__cCs
g|_dS)zReset the input buffer.N)�buffer)rrrr
r:�szInteractiveConsole.resetbufferc!CsPy
tjWntk
r$dt_YnXy
tjWntk
rJdt_YnXd}|dkrx|jdtjtj||jjf�n|r�|jdt	|��d}x�yP|r�tj}ntj}y|j
|�}Wn tk
r�|jd�PYnX|j|�}Wq�t
k
�r|jd	�|j�d}Yq�Xq�W|dk�r4|jd
|jj�n|dk�rL|jd|�dS)a�Closely emulate the interactive Python console.

        The optional banner argument specifies the banner to print
        before the first interaction; by default it prints a banner
        similar to the one printed by the real Python interpreter,
        followed by the current class name in parentheses (so as not
        to confuse this with the real interpreter -- since it's so
        close!).

        The optional exitmsg argument specifies the exit message
        printed when exiting. Pass the empty string to suppress
        printing an exit message. If exitmsg is not given or None,
        a default message is printed.

        z>>> z... zFType "help", "copyright", "credits" or "license" for more information.NzPython %s on %s
%s
(%s)
z%s
r�
z
KeyboardInterrupt
znow exiting %s...
r)rZps1�AttributeErrorZps2r(�version�platform�	__class__r�str�	raw_input�EOFError�push�KeyboardInterruptr:)r�banner�exitmsgZcprt�more�promptr0rrr
r�sF






zInteractiveConsole.interactcCs6|jj|�dj|j�}|j||j�}|s2|j�|S)aPush a line to the interpreter.

        The line should not have a trailing newline; it may have
        internal newlines.  The line is appended to a buffer and the
        interpreter's runsource() method is called with the
        concatenated contents of the buffer as source.  If this
        indicates that the command was executed or invalid, the buffer
        is reset; otherwise, the command is incomplete, and the buffer
        is left as it was after the line was appended.  The return
        value is 1 if more input is required, 0 if the line was dealt
        with in some way (this is the same as runsource()).

        r<)r;�appendr)rrr:)rr0rrHrrr
rD�szInteractiveConsole.pushrcCst|�S)aDWrite a prompt and read a line.

        The returned line does not include the trailing newline.
        When the user enters the EOF key sequence, EOFError is raised.

        The base implementation uses the built-in function
        input(); a subclass may replace this with a different
        implementation.

        )�input)rrIrrr
rBszInteractiveConsole.raw_input)Nr9)NN)r)	rr7r8rrr:rrDrBrrrr
r�s

6cCsJt|�}|dk	r||_n"yddl}Wntk
r8YnX|j||�dS)a&Closely emulate the interactive Python interpreter.

    This is a backwards compatible interface to the InteractiveConsole
    class.  When readfunc is not specified, it attempts to import the
    readline module to enable GNU readline if it is available.

    Arguments (all optional, all default to None):

    banner -- passed to InteractiveConsole.interact()
    readfunc -- if not None, replaces InteractiveConsole.raw_input()
    local -- passed to InteractiveInterpreter.__init__()
    exitmsg -- passed to InteractiveConsole.interact()

    Nr)rrB�readline�ImportErrorr)rFZreadfuncZlocalrGZconsolerLrrr
rs�__main__z-q�
store_truez*don't print version and copyright messages)�action�helpr)NNNN)rrr&�argparseZcodeoprr�__all__rrrr�ArgumentParser�parser�add_argument�
parse_argsr#�q�flags�quietrFrrrr
�<module>s&t
typing.cpython-36.opt-1.pyc000064400000216304150335715140011455 0ustar003


 \�9�D@s�ddlZddlmZmZddlZddlZddlZddlZddlZddl	Z	yddl
jZWnek
rrddlZYnXej
dd�d�kr�ddlZyddl	mZmZmZWn4ek
r�eej�Zee�j�Zeej�ZYnXddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:g4Zd;d<�Zd=d>�ZGd?d@�d@e�ZGdAdB�dBedCdD�ZGdEdF�dFedCdG�ZGdHdI�dIedCdG�ZGdJdK�dKedCdG�ZdLdM�Z dNdO�Z!dPdQ�Z"dRdS�Z#dTdU�Z$GdVdW�dWedCdG�Z%e%dCdG�Z&GdXdY�dYedCdG�Z'e'dCdG�Z(GdZd�dedCdG�Z)e)d[�Z*e)d\�Z+e)d]�Z,e)d^dCd_�Z-e)d`dCd_�Z.e)dadCd_�Z/e)dbdCdc�Z0e)d2e1e�Z2ddde�Z3d�dfdg�Z4dhdi�Z5djdk�Z6gZ7dldm�Z8Gdndo�doedCdG�Z9e9dCdG�Z:Gdpdq�dqedCdG�Z;e;dCdG�Z<drds�Z=dtdu�Z>dvdw�Z?Gdxd�deej@�ZAdZBdydz�ZCGd{d
�d
eAd|�ZBGd}d~�d~�ZDGdd��d��ZEGd�d��d�eA�ZFGd�d�deGeGeFd��ZHGd�d��d�eA�ZIGd�d�dejJeId��ZJGd�d��d�edCdG�ZKeKdCdG�ZLd�d3�ZMd�d��ZNe	jOe	jPe	jQe	jReeefZSd�d�d4�ZTd�d6�ZUd�d7�ZVd�d��ZWd�d8�ZXGd�d��d�eA�ZYGd�d��d�eYd|�ZZej[Z[e\ed���rjGd�d��d�eBe-ej]d��Z]ej^d��e\ed���r�Gd�d��d�e]e.eBe-e0e.fej_d��Z_ej^d��e\ed���r�Gd�d��d�eBe-ej`d��Z`Gd�d��d�e`e-ejad��Zaej^d��ej^d��Gd�d�deBe-ejbd��ZbGd�d�debe-ejcd��ZcGd�d'�d'eZ�ZdGd�d&�d&eZ�ZeGd�d%�d%eZ�ZfGd�d$�d$eZ�ZgGd�d#�d#eZe-�ZhGd�d(�d(eZe-�Zie\ed"��r�Gd�d"�d"ebe-ejjd��ZjnGd�d"�d"eZe-�ZjejkZkGd�d�deBe-ejld��Zle\ed���r*Gd�d��d�ekebe-ele-ejmd��Zmej^d��e\ed���rRGd�d�deme-ejnd��Zon"Gd�d�dekebe-ele-ejnd��ZoGd�d�deoe*ejpd��Zpe\ed���r�Gd�d�deme+eBe+e/fejqd��Zqn,Gd�d�dekebe+ele+eBe+e/fejqd��ZqGd�d�deqe+e,fejrd��Zre\ed"��rhe\ed���rDGd�d�deje-eme-ejsd��Zsn"Gd�d�dekeje-ele-ejsd��Zsn"Gd�d�dekebe-ele-ejsd��ZsGd�d�dese*ejtd��ZtGd�d�deseuejvd��ZvGd�d-�d-ewete*ewd��ZxGd�d*�d*ejyete*ejyd��ZzGd�d.�d.e{epe*e{d��ZnGd�d/�d/e|eoe-e|d��Z}Gd�d�dekebe-ej~d��Z~Gd�d�de~e+eoe+ejd��ZGd�d�de~eHe+e/feoeHe+e/feBe+e/fej�d��Z�Gd�d!�d!e~e/ej�d��Z�e\ed���r�Gd�d�deBe-ej�d��Z�nGd�d�deBe-�Z�e\edÃ�	r(Gd�dńd�eBe-ej�d��Z�ej^dŃnej
dd�d�k�	rDe�dǃGd�d+�d+e�ere+e,fe�d��Z�Gd�d,�d,ej�ere+e,fej�d��Z�Gd�d)�d)ej�e�e*eufej�d��Z�e\ed˃�	r�ej^d˃Gd�d˄d�ej�ere+e,fej�d��Z�e\ed1��	r�ej�Z�ne	j�Z�Gd�d1�d1ece-eBe-e0e.fe�d��Z�e\ed΃�
rVGd�d΄d�eae-eBe-e0fej�d��Z�ej^d΃e)d�dCedэZ�Gd�d
�d
eBe�ed��Z�d�dԄZ�ej
dd�d�kZ��dZ��dZ�Gd�d�d�e�Z�Gd�d0�d0e�d|�Z�d�d5�Z�eZ�d�Z�Gd�d�d�eBe2�Z�Gd�d�d�e�e1�Z�Gd�d�d�e�e�Z�Gd�d�d�Z�e�d�e�_�e�ej�e�j�<ed�e2eej�d��d�d���Z�ed�e2eej�d�d��d�d���Z�Gd�d��d��Ze�d�e_�eej�ej�<dS(�N)�abstractmethod�abstractproperty���)�WrapperDescriptorType�MethodWrapperType�MethodDescriptorType�Any�Callable�ClassVar�Generic�Optional�Tuple�Type�TypeVar�Union�AbstractSet�GenericMeta�
ByteString�	Container�ContextManager�Hashable�	ItemsView�Iterable�Iterator�KeysView�Mapping�MappingView�MutableMapping�MutableSequence�
MutableSet�Sequence�Sized�
ValuesView�
Reversible�SupportsAbs�
SupportsBytes�SupportsComplex�
SupportsFloat�SupportsInt�
SupportsRound�Counter�Deque�Dict�DefaultDict�List�Set�	FrozenSet�
NamedTuple�	Generator�AnyStr�cast�get_type_hints�NewType�
no_type_check�no_type_check_decorator�overload�Text�
TYPE_CHECKINGcCs"tjdd�dkr|jS|jSdS)Nrr)rr)�sys�version_info�__qualname__�__name__)�x�rC�/usr/lib64/python3.6/typing.py�	_qualnamegsrEcCs&d}|jd�r"||kr"|dd�}|S)N�
_TypeAlias�_ForwardRef�_TypingBase�_FinalTypingBase�_�)rFrGrHrI)�
startswith)ZnmZ	whitelistrCrCrD�
_trim_nameosrMcsJeZdZdZdZdd��fdd�
Zdd�Zdd	�Zd
d�Zdd
�Z	�Z
S)�
TypingMetaa�Metaclass for most types defined in typing module
    (not a part of public API).

    This overrides __new__() to require an extra keyword parameter
    '_root', which serves as a guard against naive subclassing of the
    typing classes.  Any legitimate class defined using a metaclass
    derived from TypingMeta must pass _root=True.

    This also defines a dummy constructor (all the work for most typing
    constructs is done in __new__) and a nicer repr().
    F)�_rootcs2|s tddjtt|��pd��t�j||||�S)NzCannot subclass %sz, z())�	TypeError�join�map�
_type_repr�super�__new__)�cls�name�bases�	namespacerO)�	__class__rCrDrU�szTypingMeta.__new__cOsdS)NrC)�self�args�kwdsrCrCrD�__init__�szTypingMeta.__init__cCs|S)a'Override this in subclasses to interpret forward references.

        For example, List['C'] is internally stored as
        List[_ForwardRef('C')], which should evaluate to List[C],
        where C is an object found in globalns or localns (searching
        localns first, of course).
        rC)r[�globalns�localnsrCrCrD�
_eval_type�szTypingMeta._eval_typecCsdS)NrC)r[�tvarsrCrCrD�_get_type_vars�szTypingMeta._get_type_varscCstt|��}d|j|fS)Nz%s.%s)rMrE�
__module__)r[�qnamerCrCrD�__repr__�szTypingMeta.__repr__)rArdr@�__doc__�_is_protocolrUr^rarcrf�
__classcell__rCrC)rZrDrNvs
rNcsLeZdZdZdZdd�Z�fdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
�ZS)rHz0Internal indicator of special typing constructs.�__weakref__cOsdS)NrC)r[r\r]rCrCrDr^�sz_TypingBase.__init__cs@t|�dkr4t|dt�r4t|dt�r4td|��t�j|�S)z�Constructor.

        This only exists to give a better error message in case
        someone tries to subclass a special typing object (not a good idea).
        rrrKzCannot subclass %r)�len�
isinstance�str�tuplerPrTrU)rVr\r])rZrCrDrU�s
z_TypingBase.__new__cCs|S)NrC)r[r_r`rCrCrDra�sz_TypingBase._eval_typecCsdS)NrC)r[rbrCrCrDrc�sz_TypingBase._get_type_varscCs"t|�}tt|��}d|j|fS)Nz%s.%s)�typerMrErd)r[rVrerCrCrDrf�sz_TypingBase.__repr__cOstdt|���dS)NzCannot instantiate %r)rPro)r[r\r]rCrCrD�__call__�sz_TypingBase.__call__)rj)rArdr@rg�	__slots__r^rUrarcrfrprirCrC)rZrDrH�srHT)�	metaclassrOcs2eZdZdZfZdd��fdd�
Zdd�Z�ZS)rIz�Internal mix-in class to prevent instantiation.

    Prevents instantiation unless _root=True is given in class call.
    It is used to create pseudo-singleton instances Any, Union, Optional, etc.
    F)rOcs0t�j|f|�|�}|dkr |Std|��dS)NTzCannot instantiate %r)rTrUrP)rVrOr\r]r[)rZrCrDrU�sz_FinalTypingBase.__new__cCstt|�j�S)N)rMrorA)r[rCrCrD�
__reduce__�sz_FinalTypingBase.__reduce__)rArdr@rgrqrUrsrirCrC)rZrDrI�srI)rOcsTeZdZdZdZ�fdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Z�ZS)rGz-Internal wrapper to hold a forward reference.�__forward_arg__�__forward_code__�__forward_evaluated__�__forward_value__cstt�j|�t|t�s$td|f��yt|dd�}Wn"tk
rVtd|f��YnX||_||_d|_	d|_
dS)Nz,Forward reference must be a string -- got %rz<string>�evalz1Forward reference must be an expression -- got %rF)rTr^rlrmrP�compile�SyntaxErrorrtrurvrw)r[�arg�code)rZrCrDr^�s
z_ForwardRef.__init__cCsf|js||k	r`|dkr*|dkr*i}}n|dkr8|}n|dkrD|}tt|j||�d�|_d|_|jS)Nz*Forward references must evaluate to types.T)rv�_type_checkrxrurw)r[r_r`rCrCrDra�s
z_ForwardRef._eval_typecCs&t|t�stS|j|jko$|j|jkS)N)rlrG�NotImplementedrtrw)r[�otherrCrCrD�__eq__�s
z_ForwardRef.__eq__cCst|j|jf�S)N)�hashrtrw)r[rCrCrD�__hash__sz_ForwardRef.__hash__cCstd��dS)Nz4Forward references cannot be used with isinstance().)rP)r[�objrCrCrD�__instancecheck__sz_ForwardRef.__instancecheck__cCstd��dS)Nz4Forward references cannot be used with issubclass().)rP)r[rVrCrCrD�__subclasscheck__sz_ForwardRef.__subclasscheck__cCsd|jfS)Nz_ForwardRef(%r))rt)r[rCrCrDrf	sz_ForwardRef.__repr__)rtrurvrw)
rArdr@rgrqr^rar�r�r�r�rfrirCrC)rZrDrG�srGc@sLeZdZdZdZdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)rFa:Internal helper class for defining generic variants of concrete types.

    Note that this is not a type; let's call it a pseudo-type.  It cannot
    be used in instance and subclass checks in parameterized form, i.e.
    ``isinstance(42, Match[str])`` raises ``TypeError`` instead of returning
    ``False``.
    rW�type_var�	impl_type�type_checkercCs||_||_||_||_dS)atInitializer.

        Args:
            name: The name, e.g. 'Pattern'.
            type_var: The type parameter, e.g. AnyStr, or the
                specific type, e.g. str.
            impl_type: The implementation type.
            type_checker: Function that takes an impl_type instance.
                and returns a value that should be a type_var instance.
        N)rWr�r�r�)r[rWr�r�r�rCrCrDr^sz_TypeAlias.__init__cCsd|jt|j�fS)Nz%s[%s])rWrSr�)r[rCrCrDrf,sz_TypeAlias.__repr__cCs�t|jt�std|��|jjrJt|t�rJt||jj�sJtd||jf��t|t�rj||jk	rjtd|��|j|j||j	|j
�S)Nz#%s cannot be further parameterized.z&%s is not a valid substitution for %s.z%s cannot be re-parameterized.)rlr�rrP�__constraints__ro�
issubclassrZrWr�r�)r[Z	parameterrCrCrD�__getitem__/s
z_TypeAlias.__getitem__cCs&t|t�stS|j|jko$|j|jkS)N)rlrFr~rWr�)r[rrCrCrDr�;s
z_TypeAlias.__eq__cCst|j|jf�S)N)r�rWr�)r[rCrCrDr�@sz_TypeAlias.__hash__cCs t|jt�std��t||j�S)Nz<Parameterized type aliases cannot be used with isinstance().)rlr�rrPr�)r[r�rCrCrDr�Csz_TypeAlias.__instancecheck__cCs t|jt�std��t||j�S)Nz<Parameterized type aliases cannot be used with issubclass().)rlr�rrPr�r�)r[rVrCrCrDr�Isz_TypeAlias.__subclasscheck__N)rWr�r�r�)rArdr@rgrqr^rfr�r�r�r�r�rCrCrCrDrF
srFcCs0x*|D]"}t|t�st|t�r|j|�qWdS)N)rlrNrHrc)�typesrb�trCrCrDrcPs
rccCsg}t||�t|�S)N)rcrn)r�rbrCrCrD�
_type_varsVs
r�cCs$t|t�st|t�r |j||�S|S)N)rlrNrHra)r�r_r`rCrCrDra\sracCs�|dkrtd�St|t�r"t|�}t|t�r:t|�jdksTt|ttf�rft|�rft|d|f��t|�jdkr�t|dd�s�t|t	�r�|j
ttfkr�td|��|S)	a�Check that the argument is a type, and return it (internal helper).

    As a special case, accept None and return type(None) instead.
    Also, _TypeAlias instances (e.g. Match, Pattern) are acceptable.

    The msg argument is a human-readable error message, e.g.

        "Union[arg, ...]: arg should be a type."

    We append the repr() of the actual value (truncated to 100 chars).
    N�	_ClassVarz Got %.100r.�_Union�	_Optional�
__origin__z&Plain %s is not valid as type argument)r�r�)
rorlrmrGrHrA�callablerP�getattrrN�_gorgr
�	_Protocol)r{�msgrCrCrDr}bs
r}cCs`t|t�r:t|t�r:|jdkr(t|�Sd|jt|�fS|dkrFdSt|tj�rX|jSt|�S)a;Return the repr() of an object, special-casing types (internal helper).

    If obj is a type, we return a shorter version than the default
    type.__repr__, based on the module and qualified name, which is
    typically enough to uniquely identify a type.  For everything
    else, we fall back on repr(obj).
    �builtinsz%s.%s.z...)	rlrorNrdrEr��FunctionTyperA�repr)r�rCrCrDrS�s
rSc@s$eZdZdZfZdd�Zdd�ZdS)�_Anya`Special type indicating an unconstrained type.

    - Any is compatible with every type.
    - Any assumed to have all methods.
    - All values assumed to be instances of Any.

    Note that all the above statements are true from the point of view of
    static type checkers. At runtime, Any should not be used with instance
    or class checks.
    cCstd��dS)Nz%Any cannot be used with isinstance().)rP)r[r�rCrCrDr��sz_Any.__instancecheck__cCstd��dS)Nz%Any cannot be used with issubclass().)rP)r[rVrCrCrDr��sz_Any.__subclasscheck__N)rArdr@rgrqr�r�rCrCrCrDr��s
r�c@s$eZdZdZfZdd�Zdd�ZdS)�	_NoReturnaSpecial type indicating functions that never return.
    Example::

      from typing import NoReturn

      def stop() -> NoReturn:
          raise Exception('no way')

    This type is invalid in other positions, e.g., ``List[NoReturn]``
    will fail in static type checkers.
    cCstd��dS)Nz*NoReturn cannot be used with isinstance().)rP)r[r�rCrCrDr��sz_NoReturn.__instancecheck__cCstd��dS)Nz*NoReturn cannot be used with issubclass().)rP)r[rVrCrCrDr��sz_NoReturn.__subclasscheck__N)rArdr@rgrqr�r�rCrCrCrDr��sr�csNeZdZdZdZdddd	��fd
d�
Zdd
�Zdd�Zdd�Zdd�Z	�Z
S)ra�Type variable.

    Usage::

      T = TypeVar('T')  # Can be anything
      A = TypeVar('A', str, bytes)  # Must be str or bytes

    Type variables exist primarily for the benefit of static type
    checkers.  They serve as the parameters for generic types as well
    as for generic function definitions.  See class Generic for more
    information on generic types.  Generic functions work as follows:

      def repeat(x: T, n: int) -> List[T]:
          '''Return a list containing n references to x.'''
          return [x]*n

      def longest(x: A, y: A) -> A:
          '''Return the longest of two strings.'''
          return x if len(x) >= len(y) else y

    The latter example's signature is essentially the overloading
    of (str, str) -> str and (bytes, bytes) -> bytes.  Also note
    that if the arguments are instances of some subclass of str,
    the return type is still plain str.

    At runtime, isinstance(x, T) and issubclass(C, T) will raise TypeError.

    Type variables defined with covariant=True or contravariant=True
    can be used do declare covariant or contravariant generic types.
    See PEP 484 for more details. By default generic types are invariant
    in all type variables.

    Type variables can be introspected. e.g.:

      T.__name__ == 'T'
      T.__constraints__ == ()
      T.__covariant__ == False
      T.__contravariant__ = False
      A.__constraints__ == (str, bytes)
    rA�	__bound__r��
__covariant__�__contravariant__NF)�bound�	covariant�
contravariantcs�t�j|f|�|||d��||_|r2|r2td��t|�|_t|�|_|rZ|dk	rZtd��|rrt|�dkrrtd��d�t	�fdd�|D��|_
|r�t|d	�|_nd|_dS)
N)r�r�r�z"Bivariant types are not supported.z-Constraints cannot be combined with bound=...rKz"A single constraint is not allowedz:TypeVar(name, constraint, ...): constraints must be types.c3s|]}t|��VqdS)N)r})�.0r�)r�rCrD�	<genexpr>sz#TypeVar.__init__.<locals>.<genexpr>zBound must be a type.)
rTr^rA�
ValueError�boolr�r�rPrkrnr�r}r�)r[rWr�r�r�Zconstraints)rZ)r�rDr^�s 

zTypeVar.__init__cCs||kr|j|�dS)N)�append)r[rbrCrCrDrcszTypeVar._get_type_varscCs&|jrd}n|jrd}nd}||jS)N�+�-�~)r�r�rA)r[�prefixrCrCrDrf
szTypeVar.__repr__cCstd��dS)Nz0Type variables cannot be used with isinstance().)rP)r[�instancerCrCrDr�szTypeVar.__instancecheck__cCstd��dS)Nz0Type variables cannot be used with issubclass().)rP)r[rVrCrCrDr�szTypeVar.__subclasscheck__)rAr�r�r�r�)rArdr@rgrqr^rcrfr�r�rirCrC)rZrDr�s(	�T�KT�VT�T_co)r��V_co�VT_co�T_contra)r�cCsd|dkrg}t|d�r0t|ttf�r0|j||�St|t�r`x$t|�D]\}}||krD||SqDW|S)z�An internal helper function: replace arg if it is a type variable
    found in tvars with corresponding substitution from args or
    with corresponding substitution sub-tree if arg is a generic type.
    N�
_subs_tree)�hasattrrlrrHr�r�	enumerate)r{rbr\�iZtvarrCrCrD�_replace_arg)s
r�c	Cs�|jdkr|S|j}g}x|jdk	r6|j|�|j}qWg}x |jD]}|jt|||��qDWx8|D]0}g}x"|jD]}|jt||j|��qtW|}qdW|S)a�An internal helper function: calculate substitution tree
    for generic cls after replacing its type parameters with
    substitutions in tvars -> args (if any).
    Repeat the same following __origin__'s.

    Return a list of arguments with all possible substitutions
    performed. Arguments that are generic classes themselves are represented
    as tuples (so that no new classes are created by this function).
    For example: _subs_tree(List[Tuple[int, T]][str]) == [(Tuple, int, str)]
    N)r�r��__args__r��__parameters__)	rVrbr\ZcurrentZ
orig_chain�	tree_argsr{ZoclsZ
new_tree_argsrCrCrDr�Ds 



r�csg}xn|D]f}t|t�r0|jtkr0|j|j�q
t|t�rft|�dkrf|dtkrf|j|dd��q
|j|�q
Wt	|��t��t|�kr�g}x(|D] }|�kr�|j|��j
|�q�W|}t	|��x>|D]6�t�t�s�q�t�fdd���hD��r̈j
��q�Wt�fdd�|D��S)z�An internal helper for Union creation and substitution: flatten Union's
    among parameters, then remove duplicates and strict subclasses.
    rrKNc3s6|].}t|t�o|jdk	st|t�o,t�|�VqdS)N)rlrr�ror�)r�Zt2)�t1rCrDr��s
z'_remove_dups_flatten.<locals>.<genexpr>c3s|]}|�kr|VqdS)NrC)r�r�)�
all_paramsrCrDr��s)
rlr�r�r�extendr�rnrkr��set�removero�any)�
parameters�params�pZ
new_paramsr�rC)r�r�rD�_remove_dups_flattenes.
"



r�cCsX|jstdt|���t|�}t|j�}||krTtd||kr@dndt|�||f��dS)Nz%s is not a generic classz0Too %s parameters for %s; actual %s, expected %sZmanyZfew)r�rPr�rk)rVr�ZalenZelenrCrCrD�_check_generic�s
r�cs4tj����tj�j�tj����fdd��}|S)zInternal wrapper caching __getitem__ of generic types with a fallback to
    original function for non-hashable arguments.
    cs*y
�||�Stk
rYnX�||�S)N)rP)r\r])�cached�funcrCrD�inner�s

z_tp_cache.<locals>.inner)�	functools�	lru_cache�	_cleanupsr��cache_clear�wraps)r�r�rC)r�r�rD�	_tp_cache�sr�cs�eZdZdZdZd dd��fd	d
�Zdd�Zd
d�Z�fdd�Z�fdd�Z	e
dd��Zd!dd�Zdd�Z
dd�Zdd�Zdd�Z�ZS)"r�a�Union type; Union[X, Y] means either X or Y.

    To define a union, use e.g. Union[int, str].  Details:

    - The arguments must be types and there must be at least one.

    - None as an argument is a special case and is replaced by
      type(None).

    - Unions of unions are flattened, e.g.::

        Union[Union[int, str], float] == Union[int, str, float]

    - Unions of a single argument vanish, e.g.::

        Union[int] == int  # The constructor actually returns int

    - Redundant arguments are skipped, e.g.::

        Union[int, str, int] == Union[int, str]

    - When comparing unions, the argument order is ignored, e.g.::

        Union[int, str] == Union[str, int]

    - When two arguments have a subclass relationship, the least
      derived argument is kept, e.g.::

        class Employee: pass
        class Manager(Employee): pass
        Union[int, Employee, Manager] == Union[int, Employee]
        Union[Manager, int, Employee] == Union[int, Employee]
        Union[Employee, Manager] == Employee

    - Similar for object::

        Union[int, object] == object

    - You cannot subclass or instantiate a union.

    - You can use Optional[X] as a shorthand for Union[X, None].
    r�r�r��
__tree_hash__NF)rOcs�t�j|||f|�d|i�}|dkrHd|_d|_d|_ttd��|_|St|t	�sZt
d��|tkr~t|�}t
|�dkr~|dSt|�|_||_||_|j�}t|t	�r�tt|��|_n
t|�|_|S)NrOrzExpected parameters=<tuple>rKr)r)rTrUr�r�r�r��	frozensetr�rlrnrPrr�rkr�r�)rVr��originrOr\r[Z	subs_tree)rZrCrDrU�s*



z_Union.__new__cs^|jdkr|St��fdd�|jD��}t|j���}||jkrN||jkrN|S|j||dd�S)Nc3s|]}t|���VqdS)N)ra)r�r�)r_r`rCrDr��sz$_Union._eval_type.<locals>.<genexpr>T)rO)r�rnrar�rZ)r[r_r`�ev_args�	ev_originrC)r_r`rDra�s
z_Union._eval_typecCs|jr|jrt|j|�dS)N)r�r�rc)r[rbrCrCrDrcsz_Union._get_type_varscs<|jdkrt�j�S|j�}t|t�s.t|�S|dj|�S)Nr)r�rTrfr�rlrnr��
_tree_repr)r[�tree)rZrCrDrfs


z_Union.__repr__cs`g}xB|dd�D]2}t|t�s0|jt|��q|j|dj|��qWt�j�ddj|�S)NrKrz[%s]z, )rlrnr�rSr�rTrfrQ)r[r��arg_listr{)rZrCrDr�
s
z_Union._tree_reprcsl|fkrtd��t|t�s |f}|jdkr0d�nd�t�fdd�|D��}|tk	r\t||�|j||dd�S)Nz Cannot take a Union of no types.z)Union[arg, ...]: each arg must be a type.z*Parameters to generic types must be types.c3s|]}t|��VqdS)N)r})r�r�)r�rCrDr� sz%_Union.__getitem__.<locals>.<genexpr>T)r�rO)rPrlrnr�rr�rZ)r[r�rC)r�rDr�s


z_Union.__getitem__cCs>|tkrtSt|||�}t|�}t|�dkr4|dStf|S)NrKr)rr�r�rk)r[rbr\r�rCrCrDr�%sz_Union._subs_treecCs6t|t�r|j|jkS|tk	r*|j�|kS||kSdS)N)rlr�r�rr�)r[rrCrCrDr�.s

z
_Union.__eq__cCs|jS)N)r�)r[rCrCrDr�6sz_Union.__hash__cCstd��dS)Nz(Unions cannot be used with isinstance().)rP)r[r�rCrCrDr�9sz_Union.__instancecheck__cCstd��dS)Nz(Unions cannot be used with issubclass().)rP)r[rVrCrCrDr�<sz_Union.__subclasscheck__)r�r�r�r�)NN)NN)rArdr@rgrqrUrarcrfr�r�r�r�r�r�r�r�rirCrC)rZrDr��s*
	
	r�c@s eZdZdZfZedd��ZdS)r�zEOptional type.

    Optional[X] is equivalent to Union[X, None].
    cCst|d�}t|td�fS)Nz#Optional[t] requires a single type.)r}rro)r[r{rCrCrDr�Ks
z_Optional.__getitem__N)rArdr@rgrqr�r�rCrCrCrDr�Csr�cCsJt}x@t|jdd��D]*\}}t|t�r|jtkr|j|d}qW|S)z�Helper for Generic.__new__.

    Returns the class after the last occurrence of Generic or
    Generic[...] in cls.__mro__.
    NrK���)�objectr��__mro__rlrr�r
)rVZnext_in_mror��crCrCrD�_next_in_mroTs
r�cs,t�jtj�r�fdd�}n�fdd�}|S)z�Construct a __subclasshook__ callable that incorporates
    the associated __extra__ class in subclass checks performed
    against cls.
    csZ�jj|�}|tk	r|S�j|jkr(dSx,�jj�D]}t|t�rDq4t||�r4dSq4WtS)NT)�	__extra__�__subclasshook__r~r��__subclasses__rlrr�)�subclass�res�scls)rVrCrD�
__extrahook__ks

z)_make_subclasshook.<locals>.__extrahook__cs�jrt|�j�rdStS)NT)r�r�r~)r�)rVrCrDr�ys)rlr��abc�ABCMeta)rVr�rC)rVrD�_make_subclasshookbsr�cCs2t|�}d|kr.x|dD]}|j|d�qW|S)z�Internal helper: copy class __dict__ and clean slots class variables.
    (They will be re-created if necessary by normal class machinery.)
    rqN)�dict�pop)ZdctZ	dict_copyZslotrCrCrD�_no_slots_copy�s
r�cs�eZdZdZd!�fdd�	Zedd��Zejdd��Zedd	��Zejd
d	��Zdd�Z	d
d�Z
�fdd�Z�fdd�Zd"dd�Z
dd�Zdd�Zedd��Z�fdd�Zdd�Z�fdd �Z�ZS)#racMetaclass for generic types.

    This is a metaclass for typing.Generic and generic ABCs defined in
    typing module. User defined subclasses of GenericMeta can override
    __new__ and invoke super().__new__. Note that GenericMeta.__new__
    has strict rules on what is allowed in its bases argument:
    * plain Generic is disallowed in bases;
    * Generic[...] should appear in bases at most once;
    * if Generic[...] is present, then it should list all type variables
      that appear in other bases.
    In addition, type of all generic bases is erased, e.g., C[int] is
    stripped to plain C.
    Nc	sX|dk	r
n�t|�}d}	xF|D]>}
|
tkr0td��t|
t�r|
jtkr|	dk	rTtd��|
j}	qW|	dkrl|}	nPt|�}t|	��|�ks�tddj�fdd�|D��djdd�|	D��f��|	}|}|dk	r�t	|�t
jkr�||kr�|f|}td	d�|D��}t
d
d�|D���r tdd�|D��}|j|||�s2dn|jd��t�j||||d
d�}
tt|
�jd|�sj|
n|j�||
_|�r�tdd�|D��nd|
_t|
�|
_|dk�r�||
_d|k�r�|�s�t|
jdd�dk�r�t|
�|
_t|t
j��r�|j|
_|j|
_n|dk	�r|j|
_|j|
_|�r2t|d��r2|j|
_|�rDt|
j��ntt|
�j �|
_!|
S)z�Create a new generic class. GenericMeta.__new__ accepts
        keyword arguments that are used for internal bookkeeping, therefore
        an override should pass unused keyword arguments to super().
        Nz!Cannot inherit from plain Genericz0Cannot inherit from Generic[...] multiple types.z6Some type variables (%s) are not listed in Generic[%s]z, c3s|]}|�krt|�VqdS)N)rm)r�r�)�gvarsetrCrDr��sz&GenericMeta.__new__.<locals>.<genexpr>css|]}t|�VqdS)N)rm)r��grCrCrDr��scss"|]}t|t�r|jn|VqdS)N)rlrr�)r��brCrCrDr��scss |]}t|t�o|tk	VqdS)N)rlrr
)r�r�rCrCrDr��scss|]}|tk	r|VqdS)N)r
)r�r�rCrCrDr��s)r�r�r�T)rOr�css*|]"}|tkrdn|tkrfn|VqdS).N)�_TypingEllipsis�_TypingEmpty)r��arCrCrDr��sr�rA�r�r@)"r�r
rPrlrr�r�r�rQror�r�rnr��updater�rTrU�__setattr__r�r��__next_in_mro__�__orig_bases__r�r�r��
_abc_registry�
_abc_cacher�r@r�r�r�r�)rVrWrXrYrbr\r��extra�
orig_basesZgvars�baseZtvarsetZ
initial_basesr[)rZ)r�rDrU�sj









zGenericMeta.__new__cCst|jtj�r|jjS|jjS)N)rlr�r�r��_abc_negative_cacher��_abc_generic_negative_cache)r[rCrCrDr��szGenericMeta._abc_negative_cachecCs,|jdkr(t|jtj�r"||j_n||_dS)N)r�rlr�r�r�r�r�)r[�valuerCrCrDr�s

cCst|jtj�r|jjS|jjS)N)rlr�r�r��_abc_negative_cache_versionr��#_abc_generic_negative_cache_version)r[rCrCrDr�	sz'GenericMeta._abc_negative_cache_versioncCs,|jdkr(t|jtj�r"||j_n||_dS)N)r�rlr�r�r�r�r�)r[r�rCrCrDr�s

cCs|jr|jrt|j|�dS)N)r�r�rc)r[rbrCrCrDrcszGenericMeta._get_type_varsc
s�|jr|jj���nd}|jr8t��fdd�|jD��nd}||jkrT||jkrT|S|j|j|jt|j�|rtt	|�nd|||j
|jd�S)Nc3s|]}t|���VqdS)N)ra)r�r�)r_r`rCrDr�sz)GenericMeta._eval_type.<locals>.<genexpr>)rbr\r�r�r�)r�rar�rnrZrA�	__bases__r��__dict__r�r�r�)r[r_r`r�r�rC)r_r`rDras$zGenericMeta._eval_typecs"|jdkrt�j�S|j|j��S)N)r�rTrfr�r�)r[)rZrCrDrf+s

zGenericMeta.__repr__cstg}xV|dd�D]F}|fkr*|jd�qt|t�sD|jt|��q|j|dj|��qWt�j�ddj|�S)NrKz()rz[%s]z, )r�rlrnrSr�rTrfrQ)r[r�r�r{)rZrCrDr�0s
zGenericMeta._tree_reprcCs*|jdkr|St|||�}|jft|�S)N)r�r�r�rn)r[rbr\r�rCrCrDr�;s
zGenericMeta._subs_treecCs6t|t�stS|jdks"|jdkr*||kS|j|jkS)N)rlrr~r�r�)r[rrCrCrDr�As

zGenericMeta.__eq__cCs|jS)N)r�)r[rCrCrDr�HszGenericMeta.__hash__c
s6t|t�s|f}|r0|jtk	r0tdt|���d�t�fdd�|D��}|tkr�tdd�|D��sltd��tt	|��t|�kr�td��|}|}nb|tt
fkr�t|�}|}nH|tkr�|}|}n6|j
ttfkr�tdt|���nt||�t|�}|}|j
dk�r|fnf}|j|j||jt|j�||||j|jd	�S)
Nz)Parameter list to %s[...] cannot be emptyz*Parameters to generic types must be types.c3s|]}t|��VqdS)N)r})r�r�)r�rCrDr�Ssz*GenericMeta.__getitem__.<locals>.<genexpr>css|]}t|t�VqdS)N)rlr)r�r�rCrCrDr�Vsz5Parameters to Generic[...] must all be type variablesz-Parameters to Generic[...] must all be uniquez'Cannot subscript already-subscripted %s)rbr\r�r�r�)rlrnr�rrPrEr
�allrkr�rr�r�r�r�r�rZrAr�r�rr�r�)r[r�rbr\ZprependrC)r�rDr�KsJ

zGenericMeta.__getitem__csJ|jdk	r*tjd�jddkr&td��dS|tkr>td|��t�j|�S)	NrKrAr�r�zCParameterized generics cannot be used with class or instance checksFz5Class %r cannot be used with class or instance checks)r�r�)r�r>�	_getframe�	f_globalsrPr
rTr�)r[rV)rZrCrDr�ys
zGenericMeta.__subclasscheck__cCst|j|�S)N)r�rZ)r[r�rCrCrDr��szGenericMeta.__instancecheck__csT|jd�r|jd�s(|jd�s(|jdkr<tt|�j||�ntt|j�j||�dS)N�__�_abc_)rL�endswithr�rTrr�)r[�attrr�)rZrCrDr��s


zGenericMeta.__setattr__)NNNNN)NN)rArdr@rgrU�propertyr��setterr�rcrarfr�r�r�r�r�r�r�r�r�rirCrC)rZrDr�s"
`
.cOs�|jdkr@|jtjkr,|jtjk	r,|j|�S|j|f|�|�Snl|j}|jtjkrj|jtjk	rj|j|�}n|j|f|�|�}y
||_Wntk
r�YnX|j||�|SdS)N)r�rUr�r^r�Z__orig_class__�AttributeError)Zbase_clsrVr\r]r�r�rCrCrD�_generic_new�s 


rc@seZdZdZfZdd�ZdS)r
aCAbstract base class for generic types.

    A generic type is typically declared by inheriting from
    this class parameterized with one or more type variables.
    For example, a generic mapping type might be defined as::

      class Mapping(Generic[KT, VT]):
          def __getitem__(self, key: KT) -> VT:
              ...
          # Etc.

    This class can then be used as follows::

      def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
          try:
              return mapping[key]
          except KeyError:
              return default
    cOs&|jtkrtd��t|j|f|�|�S)NzHType Generic cannot be instantiated; it can be used only as a base class)r�r
rPrr�)rVr\r]rCrCrDrU�s
zGeneric.__new__N)rArdr@rgrqrUrCrCrCrDr
�s)rrc@seZdZdZdS)r�z�Internal placeholder for () or []. Used by TupleMeta and CallableMeta
    to allow empty list/tuple in specific places, without allowing them
    to sneak in where prohibited.
    N)rArdr@rgrCrCrCrDr��sr�c@seZdZdZdS)r�z(Internal placeholder for ... (ellipsis).N)rArdr@rgrCrCrCrDr��sr�cs4eZdZdZe�fdd��Zdd�Zdd�Z�ZS)�	TupleMetazMetaclass for Tuple (internal).cs�|jdk	s|jtk	r t�j|�S|fkr6t�jtf�St|t�sF|f}t|�dkr�|ddkr�d�t	|d��}t�j|t
f�Sd�t�fdd�|D��}t�j|�S)	NrrK.z Tuple[t, ...]: t must be a type.rz*Tuple[t0, t1, ...]: each t must be a type.c3s|]}t|��VqdS)N)r})r�r�)r�rCrDr��sz(TupleMeta.__getitem__.<locals>.<genexpr>)r�r�rrTr�r�rlrnrkr}r�)r[r�r�)rZ)r�rDr��s
zTupleMeta.__getitem__cCs |jdkrt|t�Std��dS)Nz5Parameterized Tuple cannot be used with isinstance().)r�rlrnrP)r[r�rCrCrDr��s

zTupleMeta.__instancecheck__cCs |jdkrt|t�Std��dS)Nz5Parameterized Tuple cannot be used with issubclass().)r�r�rnrP)r[rVrCrCrDr��s

zTupleMeta.__subclasscheck__)	rArdr@rgr�r�r�r�rirCrC)rZrDr�src@seZdZdZfZdd�ZdS)ra@Tuple type; Tuple[X, Y] is the cross-product type of X and Y.

    Example: Tuple[T1, T2] is a tuple of two elements corresponding
    to type variables T1 and T2.  Tuple[int, float, str] is a tuple
    of an int, a float and a string.

    To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
    cOs$|jtkrtd��tt|f|�|�S)Nz6Type Tuple cannot be instantiated; use tuple() instead)r�rrPrrn)rVr\r]rCrCrDrUs
z
Tuple.__new__N)rArdr@rgrqrUrCrCrCrDr�s)r�rrcsHeZdZdZ�fdd�Z�fdd�Z�fdd�Ze�fdd	��Z�Z	S)
�CallableMetaz"Metaclass for Callable (internal).cs"|jdkrt�j�S|j|j��S)N)r�rTrfr�r�)r[)rZrCrDrfs

zCallableMeta.__repr__cs�|jtk	rt�j|�Sg}xB|dd�D]2}t|t�sF|jt|��q(|j|dj|��q(W|ddkr�t|d�d|dSt|d�ddj	|dd��|dfS)	NrKrz...z	[..., %s]z
[[%s], %s]z, r�r�)
r�rrTr�rlrnr�rSr�rQ)r[r�r�r{)rZrCrDr�s


zCallableMeta._tree_reprcs�|jdk	s|jtk	r t�j|�St|t�s8t|�dkr@td��|\}}|t	krZt	|f}n$t|t
�srtd|f��t|�|f}|j|�S)zxA thin wrapper around __getitem_inner__ to provide the latter
        with hashable arguments to improve speed.
        Nrz6Callable must be used as Callable[[arg, ...], result].z8Callable[args, result]: args must be a list. Got %.100r.)r�r�rrTr�rlrnrkrP�Ellipsis�list�__getitem_inner__)r[r�r\�result)rZrCrDr�*s


zCallableMeta.__getitem__cs^|\}}d�t|��}|tkr.t�jt|f�Sd�t�fdd�|D��}||f}t�j|�S)Nz.Callable[args, result]: result must be a type.z6Callable[[arg, ...], result]: each arg must be a type.c3s|]}t|��VqdS)N)r})r�r{)r�rCrDr�Fsz1CallableMeta.__getitem_inner__.<locals>.<genexpr>)r}rrTr�r�rn)r[r�r\r)rZ)r�rDr>s

zCallableMeta.__getitem_inner__)
rArdr@rgrfr�r�r�rrirCrC)rZrDr
s
r
c@seZdZdZfZdd�ZdS)ra�Callable type; Callable[[int], str] is a function of (int) -> str.

    The subscription syntax must always be used with exactly two
    values: the argument list and the return type.  The argument list
    must be a list of types or ellipsis; the return type must be a single type.

    There is no syntax to indicate optional or keyword arguments,
    such function types are rarely used as callback types.
    cOs&|jtkrtd��t|j|f|�|�S)NzIType Callable cannot be instantiated; use a non-abstract subclass instead)r�rrPrr�)rVr\r]rCrCrDrUXs
zCallable.__new__N)rArdr@rgrqrUrCrCrCrDrKs	csNeZdZdZdZddd�Zdd�Zdd	�Z�fd
d�Zdd
�Z	dd�Z
�ZS)r�a3Special type construct to mark class variables.

    An annotation wrapped in ClassVar indicates that a given
    attribute is intended to be used as a class variable and
    should not be set on instances of that class. Usage::

      class Starship:
          stats: ClassVar[Dict[str, int]] = {} # class variable
          damage: int = 10                     # instance variable

    ClassVar accepts only types and cannot be further subscribed.

    Note that ClassVar is not a class itself, and should not
    be used with isinstance() or issubclass().
    �__type__NcKs
||_dS)N)r)r[�tpr]rCrCrDr^rsz_ClassVar.__init__cCsPt|�}|jdkr4|t|dj|jdd���dd�Stdj|jdd����dS)Nz{} accepts only single type.rKT)rOz {} cannot be further subscripted)rorr}�formatrArP)r[�itemrVrCrCrDr�us
z_ClassVar.__getitem__cCs,t|j||�}||jkr|St|�|dd�S)NT)rO)rarro)r[r_r`Znew_tprCrCrDra~s
z_ClassVar._eval_typecs,t�j�}|jdk	r(|djt|j��7}|S)Nz[{}])rTrfrrrS)r[�r)rZrCrDrf�s

z_ClassVar.__repr__cCstt|�j|jf�S)N)r�rorAr)r[rCrCrDr��sz_ClassVar.__hash__cCs,t|t�stS|jdk	r$|j|jkS||kS)N)rlr�r~r)r[rrCrCrDr��s


z_ClassVar.__eq__)r)N)rArdr@rgrqr^r�rarfr�r�rirCrC)rZrDr�_s
	r�cCs|S)z�Cast a value to a type.

    This returns the value unchanged.  To the type checker this
    signals that the return value has the designated type, but at
    runtime we intentionally don't check anything (we want this
    to be as fast as possible).
    rC)�typ�valrCrCrDr6�sc
Cs�y
|j}Wntk
riSX|j}|j}|d|�}|jp@f}|j}|rTt|�ni}|t|�}x&t||d�|�D]\}}	|	||<qxW|S)z:Internal helper to extract the default arguments, by name.N)	�__code__r
�co_argcount�co_varnames�__defaults__�__kwdefaults__r�rk�zip)
r�r|Z	pos_countZ	arg_names�defaultsZ
kwdefaultsr�Z
pos_offsetrWr�rCrCrD�
_get_defaults�s

r c
Cs�t|dd�riSt|t�r�i}x�t|j�D]z}|dkrFtj|jj}n|}|jj	di�}xJ|j
�D]>\}}|dkrztd�}t|t�r�t|�}t
|||�}|||<qbWq*W|S|dkr�t|tj�r�|j}nt|di�}|dkr�|}n|dkr�|}t|dd�}|dk�r"t|t��riStdj|���t|�}	t|�}xp|j
�D]d\}}|dk�rVtd�}t|t��rjt|�}t
|||�}||	k�r�|	|dk�r�t|}|||<�q<W|S)a�Return type hints for an object.

    This is often the same as obj.__annotations__, but it handles
    forward references encoded as string literals, and if necessary
    adds Optional[t] if a default value equal to None is set.

    The argument may be a module, class, method, or function. The annotations
    are returned as a dictionary. For classes, annotations include also
    inherited members.

    TypeError is raised if the argument is not of a type that can contain
    annotations, and an empty dictionary is returned if no annotations are
    present.

    BEWARE -- the behavior of globalns and localns is counterintuitive
    (unless you are familiar with how eval() and exec() work).  The
    search order is locals first, then globals.

    - If no dict arguments are passed, an attempt is made to use the
      globals from obj (or the respective module's globals for classes),
      and these are also used as the locals.  If the object does not appear
      to have globals, an empty dictionary is used.

    - If one dict argument is passed, it is used for both globals and
      locals.

    - If two dict arguments are passed, they specify globals and
      locals, respectively.
    �__no_type_check__N�__annotations__�__globals__z1{!r} is not a module, class, method, or function.)r�rlro�reversedr�r>�modulesrdr�get�itemsrmrGrar��
ModuleType�_allowed_typesrPrr r�r)
r�r_r`Zhintsr�Zbase_globalsZannrWr�rrCrCrDr7�sV



cCs�t|t�r||jj�}x0|jj�D]"\}}||j|fkr |j|�q Wx4|j�D](}t|tj	�rfd|_
t|t�rPt|�qPWy
d|_
Wntk
r�YnX|S)aIDecorator to indicate that annotations are not type hints.

    The argument must be a class or function; if it is a class, it
    applies recursively to all methods and classes defined in that class
    (but not to methods defined in its superclasses or subclasses).

    This mutates the function(s) or class(es) in place.
    T)
rlror�copyr'r�r��valuesr�r�r!r9rP)r{Z	arg_attrsrrr�rCrCrDr9s	



cstj���fdd��}|S)z�Decorator to give another decorator the @no_type_check effect.

    This wraps the decorator with something that wraps the decorated
    function in @no_type_check.
    cs�||�}t|�}|S)N)r9)r\r]r�)�	decoratorrCrD�wrapped_decorator/s
z2no_type_check_decorator.<locals>.wrapped_decorator)r�r�)r,r-rC)r,rDr:(scOstd��dS)z*Helper for @overload to raise when called.z�You should not call an overloaded function. A series of @overload-decorated functions outside a stub module should always be followed by an implementation that is not @overload-ed.N)�NotImplementedError)r\r]rCrCrD�_overload_dummy8sr/cCstS)a
Decorator for overloaded functions/methods.

    In a stub file, place two or more stub definitions for the same
    function in a row, each decorated with @overload.  For example:

      @overload
      def utf8(value: None) -> None: ...
      @overload
      def utf8(value: bytes) -> bytes: ...
      @overload
      def utf8(value: str) -> bytes: ...

    In a non-stub file (i.e. a regular .py file), do the same but
    follow it with an implementation.  The implementation should *not*
    be decorated with @overload.  For example:

      @overload
      def utf8(value: None) -> None: ...
      @overload
      def utf8(value: bytes) -> bytes: ...
      @overload
      def utf8(value: str) -> bytes: ...
      def utf8(value):
          # implementation goes here
    )r/)r�rCrCrDr;Ascs0eZdZdZ�fdd�Zdd�Zdd�Z�ZS)�
_ProtocolMetaz~Internal metaclass for _Protocol.

    This exists so _Protocol classes can be generic without deriving
    from Generic.
    cs"t|jkrt�j|�Std��dS)Nz+Protocols cannot be used with isinstance().)r�r�rTr�rP)r[r�)rZrCrDr�es
z_ProtocolMeta.__instancecheck__csL|js
tS|tkrdS|j�}x(|D] �t�fdd�|jD��s$dSq$WdS)NTc3s|]}�|jkVqdS)N)r)r��d)rrCrDr�wsz2_ProtocolMeta.__subclasscheck__.<locals>.<genexpr>F)rhr~r��_get_protocol_attrsr�r�)r[rV�attrsrC)rrDr�js
z_ProtocolMeta.__subclasscheck__cCs,g}x.|jD]$}t|dd�r|jdkr|j|�qWt�}�x�|D�]�}x�|jj�D]�}x�|jD]&}||k	r`||jkr`t|dd�r`Pq`W|jd�rT|dkrT|dkrT|dkrT|dkrT|dkrT|d	krT|d
krT|dkrT|dkrT|d
krT|dkrT|dkrT|dkrT|dkrT|dkrT|dkrT|j|�qTWqBW|S)NrhFr�r�__abstractmethods__r"rjr�rr�rqr2r�r�r�r�r�r�rd)	r�r�rAr�r�r�keysrL�add)r[Zprotocol_basesr�r3r�rrCrCrDr2{s<z!_ProtocolMeta._get_protocol_attrs)rArdr@rgr�r�r2rirCrC)rZrDr0^sr0c@seZdZdZfZdZdS)r�z�Internal base class for protocol classes.

    This implements a simple-minded structural issubclass check
    (similar but more general than the one-offs in collections.abc
    such as Hashable).
    TN)rArdr@rgrqrhrCrCrCrDr��sr��	Awaitablec@seZdZfZdS)r7N)rArdr@rqrCrCrCrDr7�s)r��	Coroutinec@seZdZfZdS)r8N)rArdr@rqrCrCrCrDr8�s�
AsyncIterablec@seZdZfZdS)r9N)rArdr@rqrCrCrCrDr9�sc@seZdZfZdS)�
AsyncIteratorN)rArdr@rqrCrCrCrDr:�sr:c@seZdZfZdS)rN)rArdr@rqrCrCrCrDr�sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr�sc@s"eZdZfZeed�dd��ZdS)r*)�returncCsdS)NrC)r[rCrCrD�__int__�szSupportsInt.__int__N)rArdr@rqr�intr<rCrCrCrDr*�sc@s"eZdZfZeed�dd��ZdS)r))r;cCsdS)NrC)r[rCrCrD�	__float__�szSupportsFloat.__float__N)rArdr@rqr�floatr>rCrCrCrDr)�sc@s"eZdZfZeed�dd��ZdS)r()r;cCsdS)NrC)r[rCrCrD�__complex__�szSupportsComplex.__complex__N)rArdr@rqr�complexr@rCrCrCrDr(�sc@s"eZdZfZeed�dd��ZdS)r')r;cCsdS)NrC)r[rCrCrD�	__bytes__�szSupportsBytes.__bytes__N)rArdr@rqr�bytesrBrCrCrCrDr'�sc@s"eZdZfZeed�dd��ZdS)r&)r;cCsdS)NrC)r[rCrCrD�__abs__�szSupportsAbs.__abs__N)rArdr@rqrr�rDrCrCrCrDr&�sc@s&eZdZfZedeed�dd��ZdS)r+r)�ndigitsr;cCsdS)NrC)r[rErCrCrD�	__round__szSupportsRound.__round__N)r)rArdr@rqrr=r�rFrCrCrCrDr+sc@seZdZfZdS)r%N)rArdr@rqrCrCrCrDr%
sc@s"eZdZfZedd�dd��ZdS)r%zIterator[T_co])r;cCsdS)NrC)r[rCrCrD�__reversed__szReversible.__reversed__N)rArdr@rqrrGrCrCrCrDr%
sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDrs�
Collectionc@seZdZfZdS)rHN)rArdr@rqrCrCrCrDrHsc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr'sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr+sc@seZdZfZdS)r!N)rArdr@rqrCrCrCrDr!0sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr6sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr:sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr?sc@seZdZfZdS)r"N)rArdr@rqrCrCrCrDr"Esc@seZdZfZdS)r"N)rArdr@rqrCrCrCrDr"Isc@seZdZfZdS)r"N)rArdr@rqrCrCrCrDr"Msc@seZdZfZdS)r N)rArdr@rqrCrCrCrDr Rsc@seZdZfZdS)rN)rArdr@rqrCrCrCrDrVsc@seZdZfZdd�ZdS)r0cOs$|jtkrtd��tt|f|�|�S)Nz4Type List cannot be instantiated; use list() instead)r�r0rPrr)rVr\r]rCrCrDrU^s
zList.__new__N)rArdr@rqrUrCrCrCrDr0Zsc@seZdZfZdd�ZdS)r-cOs*|jtkrtj||�Sttj|f|�|�S)N)r�r-�collections�dequer)rVr\r]rCrCrDrUis
z
Deque.__new__N)rArdr@rqrUrCrCrCrDr-esc@seZdZfZdd�ZdS)r1cOs$|jtkrtd��tt|f|�|�S)Nz2Type Set cannot be instantiated; use set() instead)r�r1rPrr�)rVr\r]rCrCrDrUss
zSet.__new__N)rArdr@rqrUrCrCrCrDr1osc@seZdZfZdd�ZdS)r2cOs$|jtkrtd��tt|f|�|�S)Nz>Type FrozenSet cannot be instantiated; use frozenset() instead)r�r2rPrr�)rVr\r]rCrCrDrU}s
zFrozenSet.__new__N)rArdr@rqrUrCrCrCrDr2zsc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr�sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr�sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr�sc@seZdZfZdS)r$N)rArdr@rqrCrCrCrDr$�s�AbstractContextManagerc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr�sc@s2eZdZfZdd�Zejdd��Zedd��Z	dS)rcCs|S)NrC)r[rCrCrD�	__enter__�szContextManager.__enter__cCsdS)NrC)r[�exc_type�	exc_value�	tracebackrCrCrD�__exit__�szContextManager.__exit__cCs8|tkr4tdd�|jD��r4tdd�|jD��r4dStS)Ncss|]}d|jkVqdS)rLN)r)r��BrCrCrDr��sz2ContextManager.__subclasshook__.<locals>.<genexpr>css|]}d|jkVqdS)rPN)r)r�rQrCrCrDr��sT)rr�r�r~)rV�CrCrCrDr��s
zContextManager.__subclasshook__N)
rArdr@rqrLr�rrP�classmethodr�rCrCrCrDr�s�AbstractAsyncContextManagerc@seZdZfZdS)�AsyncContextManagerN)rArdr@rqrCrCrCrDrU�srU�a�
class AsyncContextManager(Generic[T_co]):
    __slots__ = ()

    async def __aenter__(self):
        return self

    @abc.abstractmethod
    async def __aexit__(self, exc_type, exc_value, traceback):
        return None

    @classmethod
    def __subclasshook__(cls, C):
        if cls is AsyncContextManager:
            if sys.version_info[:2] >= (3, 6):
                return _collections_abc._check_methods(C, "__aenter__", "__aexit__")
            if (any("__aenter__" in B.__dict__ for B in C.__mro__) and
                    any("__aexit__" in B.__dict__ for B in C.__mro__)):
                return True
        return NotImplemented

__all__.append('AsyncContextManager')
c@seZdZfZdd�ZdS)r.cOs$|jtkrtd��tt|f|�|�S)Nz4Type Dict cannot be instantiated; use dict() instead)r�r.rPrr�)rVr\r]rCrCrDrU�s
zDict.__new__N)rArdr@rqrUrCrCrCrDr.�sc@seZdZfZdd�ZdS)r/cOs*|jtkrtj||�Sttj|f|�|�S)N)r�r/rI�defaultdictr)rVr\r]rCrCrDrU�s
zDefaultDict.__new__N)rArdr@rqrUrCrCrCrDr/�sc@seZdZfZdd�ZdS)r,cOs*|jtkrtj||�Sttj|f|�|�S)N)r�r,rIr)rVr\r]rCrCrDrU�s
zCounter.__new__N)rArdr@rqrUrCrCrCrDr,�s�ChainMapc@seZdZfZdd�ZdS)rXcOs*|jtkrtj||�Sttj|f|�|�S)N)r�rXrIr)rVr\r]rCrCrDrU�s
zChainMap.__new__N)rArdr@rqrUrCrCrCrDrX�sc@seZdZfZdd�ZdS)r4cOs$|jtkrtd��tt|f|�|�S)Nz@Type Generator cannot be instantiated; create a subclass instead)r�r4rPr�_G_base)rVr\r]rCrCrDrUs
zGenerator.__new__N)rArdr@rqrUrCrCrCrDr4s�AsyncGeneratorc@seZdZfZdS)rZN)rArdr@rqrCrCrCrDrZs�CT_co)r�r�c@seZdZdZfZdS)ra�A special construct usable to annotate class objects.

    For example, suppose we have the following classes::

      class User: ...  # Abstract base for User classes
      class BasicUser(User): ...
      class ProUser(User): ...
      class TeamUser(User): ...

    And a function that takes a class argument that's a subclass of
    User and returns an instance of the corresponding class::

      U = TypeVar('U', bound=User)
      def new_user(user_class: Type[U]) -> U:
          user = user_class()
          # (Here we could write the user object to a database)
          return user

      joe = new_user(BasicUser)

    At this point the type checker knows that joe has type BasicUser.
    N)rArdr@rgrqrCrCrCrDr$scsvd��fdd�|D�}tj|dd�|D��}tj|�|_|_ytjd�jjdd�|_	Wnt
tfk
rpYnX|S)NzDNamedTuple('Name', [(f0, t0), (f1, t1), ...]); each t must be a typecsg|]\}}|t|��f�qSrC)r})r��nr�)r�rCrD�
<listcomp>Asz!_make_nmtuple.<locals>.<listcomp>cSsg|]\}}|�qSrCrC)r�r\r�rCrCrDr]BsrrA�__main__)rI�
namedtuple�OrderedDictr"�_field_typesr>rrr&rdr
r�)rWr��nm_tplrC)r�rD�
_make_nmtuple?srcrUr^rq�__getnewargs__�_fields�_field_defaultsra�_make�_replace�_asdict�_sourcerdrAr@r"cseZdZ�fdd�Z�ZS)�NamedTupleMetacs|jdd�rt�j||||�Sts*td��|jdi�}t||j��}g}i}xP|D]H}||krz||}	|j|	�|	||<qR|rRtdj|dj	|j
��d���qRWtj|�|j_
t|�|j_||_xD|D]<}
|
tkr�td|
��q�|
tko�|
|jkr�t||
||
�q�W|S)	NrOFz<Class syntax for NamedTuple is only supported in Python 3.6+r"zXNon-default namedtuple field {field_name} cannot follow default field(s) {default_names}z, )�
field_nameZ
default_namesz&Cannot overwrite NamedTuple attribute )r&rTrU�_PY36rPrcr'r�rrQr5rIr`r"rnrrf�_prohibitedr
�_specialre�setattr)rV�typenamerX�nsr�rbrZ
defaults_dictrlZ
default_value�key)rZrCrDrUYs4



zNamedTupleMeta.__new__)rArdr@rUrirCrC)rZrDrkWsrkc@seZdZdZdZddd�ZdS)r3a4Typed version of namedtuple.

    Usage in Python versions >= 3.6::

        class Employee(NamedTuple):
            name: str
            id: int

    This is equivalent to::

        Employee = collections.namedtuple('Employee', ['name', 'id'])

    The resulting class has extra __annotations__ and _field_types
    attributes, giving an ordered dict mapping field names to types.
    __annotations__ should be preferred, while _field_types
    is kept to maintain pre PEP 526 compatibility. (The field names
    are in the _fields attribute, which is part of the namedtuple
    API.) Alternative equivalent keyword syntax is also accepted::

        Employee = NamedTuple('Employee', name=str, id=int)

    In Python versions <= 3.5 use::

        Employee = NamedTuple('Employee', [('name', str), ('id', int)])
    TNcKs:|rtrtd��|dkr$|j�}n|r0td��t||�S)Nz>Keyword syntax for NamedTuple is only supported in Python 3.6+zIEither list of fields or keywords can be provided to NamedTuple, not both)rmrPr'rc)r[rqZfields�kwargsrCrCrDrU�s

zNamedTuple.__new__)N)rArdr@rgrOrUrCrCrCrDr3yscCsdd�}||_||_|S)a%NewType creates simple unique types with almost zero
    runtime overhead. NewType(name, tp) is considered a subtype of tp
    by static type checkers. At runtime, NewType(name, tp) returns
    a dummy function that simply returns its argument. Usage::

        UserId = NewType('UserId', int)

        def name_by_id(user_id: UserId) -> str:
            ...

        UserId('user')          # Fails type check

        name_by_id(42)          # Fails type check
        name_by_id(UserId(42))  # OK

        num = UserId(5) + 1     # type: int
    cSs|S)NrC)rBrCrCrD�new_type�szNewType.<locals>.new_type)rAZ
__supertype__)rWrrurCrCrDr8�sFc@s�eZdZdZfZeed�dd��Zeed�dd��Ze	dd�dd	��Z
e	ed�d
d��Ze	e
d�dd
��Ze	dd�dd��Ze	ed�dd��Ze	d7e
ed�dd��Ze	ed�dd��Ze	d9e
ed�dd��Ze	d;e
eed�dd��Ze	d<e
e
e
d�d d!��Ze	ed�d"d#��Ze	e
d�d$d%��Ze	d=e
e
d&�d'd(��Ze	ed�d)d*��Ze	ee
d+�d,d-��Ze	eedd.�d/d0��Ze	d1d�d2d3��Ze	dd�d4d5��ZdS)>�IOa�Generic base class for TextIO and BinaryIO.

    This is an abstract, generic version of the return of open().

    NOTE: This does not distinguish between the different possible
    classes (text vs. binary, read vs. write vs. read/write,
    append-only, unbuffered).  The TextIO and BinaryIO subclasses
    below capture the distinctions between text vs. binary, which is
    pervasive in the interface; however we currently do not offer a
    way to track the other distinctions in the type system.
    )r;cCsdS)NrC)r[rCrCrD�mode�szIO.modecCsdS)NrC)r[rCrCrDrW�szIO.nameNcCsdS)NrC)r[rCrCrD�close�szIO.closecCsdS)NrC)r[rCrCrD�closed�sz	IO.closedcCsdS)NrC)r[rCrCrD�fileno�sz	IO.filenocCsdS)NrC)r[rCrCrD�flush�szIO.flushcCsdS)NrC)r[rCrCrD�isatty�sz	IO.isattyrK)r\r;cCsdS)NrC)r[r\rCrCrD�read�szIO.readcCsdS)NrC)r[rCrCrD�readable�szIO.readable)�limitr;cCsdS)NrC)r[rrCrCrD�readline�szIO.readline)�hintr;cCsdS)NrC)r[r�rCrCrD�	readlines�szIO.readlinesr)�offset�whencer;cCsdS)NrC)r[r�r�rCrCrD�seek�szIO.seekcCsdS)NrC)r[rCrCrD�seekable	szIO.seekablecCsdS)NrC)r[rCrCrD�tell	szIO.tell)�sizer;cCsdS)NrC)r[r�rCrCrD�truncate	szIO.truncatecCsdS)NrC)r[rCrCrD�writable	szIO.writable)�sr;cCsdS)NrC)r[r�rCrCrD�write	szIO.write)�linesr;cCsdS)NrC)r[r�rCrCrD�
writelines	sz
IO.writelinesz
IO[AnyStr]cCsdS)NrC)r[rCrCrDrL	szIO.__enter__cCsdS)NrC)r[ror�rOrCrCrDrP	szIO.__exit__r�)r�r�)r�r�)r�)r)N) rArdr@rgrqrrmrwrWrrxr�ryr=rzr{r|r5r}r~r�r0r�r�r�r�r�r�r�r�rLrPrCrCrCrDrv�sTrvc@sBeZdZdZfZeeeefe	d�dd��Z
edd�dd��ZdS)	�BinaryIOz5Typed version of the return of open() in binary mode.)r�r;cCsdS)NrC)r[r�rCrCrDr�)	szBinaryIO.write)r;cCsdS)NrC)r[rCrCrDrL-	szBinaryIO.__enter__N)rArdr@rgrqrrrC�	bytearrayr=r�rLrCrCrCrDr�$	sr�c@s�eZdZdZfZeed�dd��Zeed�dd��Z	ee
ed�dd��Zeed�d	d
��Z
eed�dd��Zedd�d
d��ZdS)�TextIOz3Typed version of the return of open() in text mode.)r;cCsdS)NrC)r[rCrCrD�buffer7	sz
TextIO.buffercCsdS)NrC)r[rCrCrD�encoding;	szTextIO.encodingcCsdS)NrC)r[rCrCrD�errors?	sz
TextIO.errorscCsdS)NrC)r[rCrCrD�line_bufferingC	szTextIO.line_bufferingcCsdS)NrC)r[rCrCrD�newlinesG	szTextIO.newlinescCsdS)NrC)r[rCrCrDrLK	szTextIO.__enter__N)rArdr@rgrqrr�r�rmr�rr�r�r�r
r�rrLrCrCrCrDr�2	sr�c@s&eZdZdZdddgZeZeZeZdS)�ioz)Wrapper namespace for IO generic classes.rvr�r�N)rArdr@rg�__all__rvr�r�rCrCrCrDr�P	s

r�z.io�Patternr�cCs|jS)N)�pattern)r�rCrCrD�<lambda>^	sr��MatchcCs|jjS)N)�rer�)�mrCrCrDr�`	sc@s eZdZdZddgZeZeZdS)r�z&Wrapper namespace for re type aliases.r�r�N)rArdr@rgr�r�r�rCrCrCrDr�c	sr�z.re)rr)NN)NN)rrV)rr)rUr^rqrdrerfrargrhrirj)rdrAr@r")�r�rrrI�
contextlibr�r�Z	stdlib_rer>r��collections.abcZcollections_abc�ImportErrorr?�_collections_abcrrr	ror�r^�__str__rmrQr�rErMrNrHrIrGrFrcr�rar}rSr�r
r�ZNoReturnrr�r�r�r�r�r�r�rCr5r�r�r�r�r�r�r�rr�rr�r�r�r�rr
rr�r�rrnrr
rr�rr6r r��BuiltinFunctionType�
MethodTyper(r)r7r9r:r/r;r0r�rr�r7r�r8r9r:rrr*r)r(r'r&r+r%r#rrHr1rr!rrr"r r=rrr0rJr-r�r�r2rrrr$rKrrTrU�execr�r.rWr/r,rXr4rY�
GeneratorTyperZr[rrcrmrnrorkr3r8r<r=rvr�r�r�rAr%ryr��matchr�rCrCrCrD�<module>s�
*%5C

W
!)

"96


R	D








"









"





"(`	



webbrowser.cpython-36.opt-2.pyc000064400000033111150335715140012316 0ustar003


 \U�@s�ddlZddlZddlZddlZddlZddddddgZGdd�de�ZiZgZ	dNd
d�Z
dOdd�ZdPd
d�Zdd�Z
dd�ZdQdd�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGd d!�d!e�ZeZGd"d#�d#e�ZGd$d%�d%e�ZGd&d'�d'e�ZGd(d)�d)e�Zd*d+�Zejjd,��rhe�ejjd-��rej d.��r�e
d.ded.��ej d/��r�e
d/ded/��ej d0��r�e
d0ded0��ej d1��r�e
d1ded1��ej d2��re
d2ded2��ej!dd3�d4k�r�Gd5d6�d6e�Z"gZ	iZe
d7e"�ej#j$ejjd8d9�d:�Z%x8d;d<d=d>d?d@e%fD]"Z&ej e&��rde
e&dee&���qdWej!dAk�r�GdBdC�dCe�Z'GdDdE�dEe�Z(e
dFde(dF�dR�e
d;de(d;�dS�e
dGde(dG�dT�e
dCde(dH�dU�dIejk�rpejdIj)ej*�Z+e+j,�xBe+D]:Z-e-dJk�r*ee-dV�Z.e.d	dk�r*e
e-dee-�dW��q*WdZ-[-[+dKdL�Z/e0dMk�r�e/�dS)X�N�Error�open�open_new�open_new_tab�get�registerc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�"/usr/lib64/python3.6/webbrowser.pyr
s�cCs<||gt|j�<|dkr$tj|�n|dkr8tjd|�dS)Nr)�	_browsers�lower�	_tryorder�append�insert)�name�klass�instance�update_tryorderrrrrs
cCs�|dk	r|g}nt}x�|D]�}d|krVtj|�}|ddkrLt|dd��St|�Sqyt|j�}Wntk
r�t|�}YnX|ddk	r�|dS|ddk	r|d�SqWt	d��dS)Nz%sr
�&rz!could not locate runnable browser���r)
r�shlex�split�BackgroundBrowser�GenericBrowserrr�KeyError�_synthesizer)ZusingZalternatives�browser�commandrrrrs$


TcCs,x&tD]}t|�}|j|||�rdSqWdS)NTF)rrr)�url�new�	autoraiserrrrrr9s

cCs
t|d�S)Nr
)r)r!rrrr@scCs
t|d�S)N�)r)r!rrrrCsc
Cs�|j�d}tj|�sddgStjj|�}yt|j�}Wntk
rRddgSX|d}|r�|j�|jkr�ddl	}|j	|�}||_
tjj|�|_t|d||�d|gSddgS)Nrr
)r�shutil�which�os�path�basenamerrr�copyrr)rr�cmdrr Z
controllerr*rrrrGs"


rc@s6eZdZdgZddd�Zddd�Zd	d
�Zdd�Zd
S)�BaseBrowserz%s�cCs||_||_dS)N)rr))�selfrrrr�__init__nszBaseBrowser.__init__rTcCst�dS)N)�NotImplementedError)r.r!r"r#rrrrrszBaseBrowser.opencCs|j|d�S)Nr
)r)r.r!rrrruszBaseBrowser.open_newcCs|j|d�S)Nr$)r)r.r!rrrrxszBaseBrowser.open_new_tabN)r-)rT)rr	r
�argsr/rrrrrrrr,is


r,c@seZdZdd�Zddd�ZdS)	rcCsFt|t�r||_dg|_n|d|_|dd�|_tjj|j�|_dS)Nz%srr
)�
isinstance�strrr1r'r(r))r.rrrrr/�s


zGenericBrowser.__init__rTcsl|jg�fdd�|jD�}y6tjdd�dkr<tj|�}ntj|dd�}|j�Stk
rfdSXdS)Ncsg|]}|jd���qS)z%s)�replace)�.0�arg)r!rr�
<listcomp>�sz'GenericBrowser.open.<locals>.<listcomp>��winT)�	close_fdsF)rr1�sys�platform�
subprocess�Popen�wait�OSError)r.r!r"r#�cmdline�pr)r!rr�s
zGenericBrowser.openN)rT)rr	r
r/rrrrrr|s
rc@seZdZddd�ZdS)rrTcsp|jg�fdd�|jD�}y:tjdd�dkr<tj|�}ntj|ddd�}|j�dkStk
rjdSXdS)Ncsg|]}|jd���qS)z%s)r4)r5r6)r!rrr7�sz*BackgroundBrowser.open.<locals>.<listcomp>r8r9T)r:�start_new_sessionF)rr1r;r<r=r>�pollr@)r.r!r"r#rArBr)r!rr�szBackgroundBrowser.openN)rT)rr	r
rrrrrr�src@s>eZdZdZdZdZddgZdZdZdZ	dd�Z
dd	d
�ZdS)�UnixBrowserNFTz%actionz%sc
Cs�g}|r*|jr*t|�}|j|}|r*|g}|jg||}|sD|jrLtj}nd}tj|d||jrd|pfd|dd�}|r�y|jd�}	|	Stj	k
r�dSXn&|jr�|j
�dkr�dSdSn
|j�SdS)NT)r:�stdin�stdout�stderrrC�F)�
raise_opts�intr�
backgroundr=�DEVNULLr>�redirect_stdoutr?ZTimeoutExpiredrD)
r.r1Zremoter#Z	raise_opt�optrAZinoutrB�rcrrr�_invoke�s0





zUnixBrowser._invokercs�|dkr|j�nB|dkr |j�n2|dkrB|jdkr:|j�qR|j�ntdd|����fdd�|jD�}dd�|D�}|j|d	|�}|s��fd
d�|jD�}|j|dd�Sd	SdS)Nrr
r$zBad 'new' parameter to open(); zexpected 0, 1, or 2, got %scs g|]}|jd��jd���qS)z%sz%action)r4)r5r6)�actionr!rrr7�sz$UnixBrowser.open.<locals>.<listcomp>cSsg|]}|r|�qSrr)r5r6rrrr7�sTcsg|]}|jd���qS)z%s)r4)r5r6)r!rrr7�sF)�
remote_action�remote_action_newwin�remote_action_newtabr�remote_argsrQr1)r.r!r"r#r1Zsuccessr)rRr!rr�s$

zUnixBrowser.open)rT)rr	r
rJrLrNrVrSrTrUrQrrrrrrE�s#rEc@s$eZdZddgZdZdZdZdZdS)�Mozillaz%actionz%sr-z-new-windowz-new-tabTN)rr	r
rVrSrTrUrLrrrrrW�s
rWc@s,eZdZddgZddgZdZdZdZdZd	S)
�Netscapez-noraisez-raisez-remotezopenURL(%s%action)r-z,new-windowz,new-tabTN)	rr	r
rJrVrSrTrUrLrrrrrXsrXc@s(eZdZddgZddgZdZdZdZdS)	�Galeonz-noraiser-z%actionz%sz-nz-wTN)rr	r
rJrVrSrTrLrrrrrYs
rYc@s$eZdZddgZdZdZdZdZdS)�Chromez%actionz%sr-z--new-windowTN)rr	r
rVrSrTrUrLrrrrrZs
rZc@s$eZdZddgZdZdZdZdZdS)�Operaz%actionz%sr-z--new-windowTN)rr	r
rVrSrTrUrLrrrrr["s
r[c@s(eZdZddgZdZdZdZdZdZdS)�Elinksz-remotezopenURL(%s%action)r-z,new-windowz,new-tabFN)	rr	r
rVrSrTrUrLrNrrrrr\,sr\c@seZdZddd�ZdS)�	KonquerorrTcCs�|dkrd}nd}tj}ytjd||gd|||d�}Wntk
rJYnX|j�dSy tjdd|gd|||dd	�}Wntk
r�YnX|j�dkr�dSy tjd
d|gd|||dd	�}Wntk
r�dSX|j�dkSdS)
Nr$ZnewTabZopenURL�	kfmclientT)r:rFrGrH�	konquerorz--silent)r:rFrGrHrC�kfmz-dF)r=rMr>r@r?rD)r.r!r"r#rR�devnullrBrrrrAs:zKonqueror.openN)rT)rr	r
rrrrrr]:sr]c@s&eZdZdd�Zdd�Zd
dd�Zd	S)�GrailcCs�ddl}ddl}ddl}ddl}tjj|j�d�}|jtj	��d}tjj||d�}|j|�}|shdS|j|j
|j�}	xX|D]P}
y|	j|
�Wn8t
k
r�ytj|
�Wnt
k
r�YnXYq~X|	Sq~WdS)Nrz.grail-unixz-*)�glob�pwd�socket�tempfiler'r(�joinZ
gettempdir�getpwuid�getuidZAF_UNIXZSOCK_STREAMZconnectr@�unlink)r.rcrdrerfZtempdir�user�filenameZmaybes�s�fnrrr�_find_grail_rcrs*

zGrail._find_grail_rccCs&|j�}|sdS|j|�|j�dS)Nrr
)ro�send�close)r.rRrmrrr�_remote�s
z
Grail._remoterTcCs&|r|jd|�}n|jd|�}|S)NzLOADNEW zLOAD )rr)r.r!r"r#�okrrrr�sz
Grail.openN)rT)rr	r
rorrrrrrrrbnsrbcCs�tjd�rtddtd��dtjkr>tjd�r>tddtd��dtjkrbtjd�rbtddtd��dtjkr�tjd�r�tdttd��tjd�r�tddtd��x&dD]}tj|�r�t|dt|��q�Wx&dD]}tj|�r�t|dt|��q�Wtjd��rtdttd��ntjd��r*tdttd��x*dD]"}tj|��r0t|dt	|���q0Wtjd��rrtddtd��x*d D]"}tj|��rxt|dt
|���qxWtjd��r�tddtd��tjd��r�tddtd��tjd��r�tdtd�dS)!Nzxdg-openZGNOME_DESKTOP_SESSION_IDz	gvfs-openz
gnome-openZKDE_FULL_SESSIONr^z
x-www-browser�firefox�	iceweasel�iceape�	seamonkey�mozilla-firefox�mozilla-firebird�firebird�mozilla�netscaper`r_�galeon�epiphanyZ	skipstone�
google-chrome�chrome�chromium�chromium-browser�operaZmosaicZgrail)rtrurvrw)rxryrzr{r|)r}r~)rr�r�r�)
r%r&rrr'�environr]rWrXrYrZr[rb)rrrr�register_X_browsers�sH






r�ZDISPLAYZTERMzwww-browserZlinksZelinksZlynxZw3mr8r9c@seZdZddd�ZdS)�WindowsDefaultrTcCs,ytj|�Wntk
r"dSXdSdS)NFT)r'Z	startfiler@)r.r!r"r#rrrr�s
zWindowsDefault.openN)rT)rr	r
rrrrrr��sr�zwindows-defaultZPROGRAMFILESzC:\Program FileszInternet Explorer\IEXPLORE.EXErtrzrwr{r|r��darwinc@seZdZdd�Zddd�ZdS)	�MacOSXcCs
||_dS)N)r)r.rrrrr/&szMacOSX.__init__rTc	Cs�d|krd|}tt|��}|jdkr8d|jdd�}n<|jdkrHd}nd	|d
}d|jdd�}d|j||f}tjd
d�}|dkr�dS|j|�|j�}|S)N�:zfile:�defaultzopen location "%s"�"z%22ZOmniWebr-ztoWindow %dr
zOpenURL "%s"z�tell application "%s"
                                activate
                                %s %s
                            end tell�	osascript�wF)rK�boolrr4r'�popen�writerq)	r.r!r"r#�scriptZtoWindowr+�osapiperPrrrr)s 


zMacOSX.openN)rT)rr	r
r/rrrrrr�s
r�c@seZdZdd�Zddd�ZdS)	�MacOSXOSAScriptcCs
||_dS)N)�_name)r.rrrrr/KszMacOSXOSAScript.__init__rTcCsb|jdkrd|jdd�}nd|j|jdd�f}tjdd�}|dkrJdS|j|�|j�}|S)	Nr�zopen location "%s"r�z%22z�
                   tell application "%s"
                       activate
                       open location "%s"
                   end
                   r�r�F)r�r4r'r�r�rq)r.r!r"r#r�r�rPrrrrNs

zMacOSXOSAScript.openN)rT)rr	r
r/rrrrrr�Jsr�Zsafarir�r�ZBROWSERr-c	Cs�ddl}dtjd}y|jtjdd�d�\}}WnJ|jk
r~}z,t|tjd�t|tjd�tjd�WYdd}~XnXd}x*|D]"\}}|dkr�d}q�|dkr�d}q�Wt|�dkr�t|tjd�tjd�|d}t||�td	�dS)
NrzDUsage: %s [-n | -t] url
    -n: open new window
    -t: open new tabr
Zntd)�filez-nz-tr$�)	�getoptr;�argv�error�printrH�exit�lenr)	r�ZusageZoptsr1�msgZnew_win�o�ar!rrr�main~s(

r��__main__)Nr
)N)rT)r
rrrrrr)1r'rr%r;r=�__all__�	Exceptionrrrrrrrrr�objectr,rrrErWrXrYrZZChromiumr[r\r]rbr�r�r&r<r�r(rgZiexplorerr�r�r�pathsepZ_userchoices�reverserAr+r�rrrrr�<module>s�



"N

	
45B

.



_collections_abc.cpython-36.opt-1.pyc000064400000070177150335715140013433 0ustar003


 \g�@srdZddlmZmZddlZdddddd	d
ddd
dddddddddddddddgZdZeed��Z	eee
���Zeeij���Z
eeij���Zeeij���Zeeg��Zeeeg���Zeeed���Zeeedd >���Zeee���Zeed!��Zeef��Zeee���Zeij��Zeij��Zeij��Z eej!�Z"ed"d#���Z#d$d%�Z$e$�Z$ee$�Z%e$j&�[$d&d'�Z'e'�Z'ee'�Z(['d(d)�Z)Gd*d	�d	ed+�Z*Gd,d�ded+�Z+Gd-d�de+�Z,e,j-e%�Gd.d�ded+�Z.Gd/d�de.�Z/Gd0d�de/�Z0e0j-e(�Gd1d
�d
ed+�Z1Gd2d�de1�Z2e2j-e	�e2j-e�e2j-e
�e2j-e�e2j-e�e2j-e�e2j-e�e2j-e�e2j-e�e2j-e�e2j-e�e2j-e�e2j-e�Gd3d
�d
e1�Z3Gd4d�de2�Z4e4j-e#�Gd5d�ded+�Z5Gd6d�ded+�Z6Gd7d�de5e1e6�Z7Gd8d�ded+�Z8Gd9d�de7�Z9e9j-e:�Gd:d�de9�Z;e;j-e�Gd;d�de7�Z<e<j-e"�Gd<d�de5�Z=Gd=d�de=e9�Z>e>j-e�Gd>d�de=e9�Z?e?j-e �Gd?d�de=�Z@e@j-e�Gd@d�de<�ZAeAj-eB�GdAd�de3e7�ZCeCj-eD�eCj-eE�eCj-e�eCj-eF�GdBd�deC�ZGeGj-eH�eGj-e
�GdCd�deC�ZIeIj-eJ�eIj-e
�dS)DzjAbstract Base Classes (ABCs) for collections, according to PEP 3119.

Unit tests are in test_collections.
�)�ABCMeta�abstractmethodN�	Awaitable�	Coroutine�
AsyncIterable�
AsyncIterator�AsyncGenerator�Hashable�Iterable�Iterator�	Generator�
Reversible�Sized�	Container�Callable�
Collection�Set�
MutableSet�Mapping�MutableMapping�MappingView�KeysView�	ItemsView�
ValuesView�Sequence�MutableSequence�
ByteStringzcollections.abc��i��ccsdVS)N�r r r �(/usr/lib64/python3.6/_collections_abc.py�<lambda>8sr"c�sdS)Nr r r r r!�_coro:sr#cCs
dVdS)Nr r r r r!�_ag@sr$cGsH|j}x<|D]4}x.|D]"}||jkr|j|dkr6tSPqWtSqWdS)NT)�__mro__�__dict__�NotImplemented)�C�methods�mro�method�Br r r!�_check_methodsHs


r-c@s(eZdZfZedd��Zedd��ZdS)r	cCsdS)Nrr )�selfr r r!�__hash__XszHashable.__hash__cCs|tkrt|d�StS)Nr/)r	r-r')�clsr(r r r!�__subclasshook__\s
zHashable.__subclasshook__N)�__name__�
__module__�__qualname__�	__slots__rr/�classmethodr1r r r r!r	Ts)�	metaclassc@s(eZdZfZedd��Zedd��ZdS)rccs
dVdS)Nr )r.r r r!�	__await__gszAwaitable.__await__cCs|tkrt|d�StS)Nr8)rr-r')r0r(r r r!r1ks
zAwaitable.__subclasshook__N)r2r3r4r5rr8r6r1r r r r!rcsc@s>eZdZfZedd��Zed
dd��Zdd�Zedd	��Z	dS)rcCst�dS)zcSend a value into the coroutine.
        Return next yielded value or raise StopIteration.
        N)�
StopIteration)r.�valuer r r!�sendvszCoroutine.sendNcCs4|dkr|dkr|�|�}|dk	r,|j|�}|�dS)zgRaise an exception in the coroutine.
        Return next yielded value or raise StopIteration.
        N)�with_traceback)r.�typ�val�tbr r r!�throw}s
zCoroutine.throwcCs4y|jt�Wnttfk
r&Yn
Xtd��dS)z.Raise GeneratorExit inside coroutine.
        zcoroutine ignored GeneratorExitN)r@�
GeneratorExitr9�RuntimeError)r.r r r!�close�s
zCoroutine.closecCs|tkrt|dddd�StS)Nr8r;r@rC)rr-r')r0r(r r r!r1�szCoroutine.__subclasshook__)NN)
r2r3r4r5rr;r@rCr6r1r r r r!rrs
c@s(eZdZfZedd��Zedd��ZdS)rcCst�S)N)r)r.r r r!�	__aiter__�szAsyncIterable.__aiter__cCs|tkrt|d�StS)NrD)rr-r')r0r(r r r!r1�s
zAsyncIterable.__subclasshook__N)r2r3r4r5rrDr6r1r r r r!r�sc@s0eZdZfZedd��Zdd�Zedd��ZdS)rc�st�dS)z@Return the next item or raise StopAsyncIteration when exhausted.N)�StopAsyncIteration)r.r r r!�	__anext__�szAsyncIterator.__anext__cCs|S)Nr )r.r r r!rD�szAsyncIterator.__aiter__cCs|tkrt|dd�StS)NrFrD)rr-r')r0r(r r r!r1�szAsyncIterator.__subclasshook__N)	r2r3r4r5rrFrDr6r1r r r r!r�sc@sFeZdZfZdd�Zedd��Zeddd��Zdd	�Ze	d
d��Z
dS)
rc�s|jd�IdHS)zpReturn the next item from the asynchronous generator.
        When exhausted, raise StopAsyncIteration.
        N)�asend)r.r r r!rF�szAsyncGenerator.__anext__c�st�dS)zuSend a value into the asynchronous generator.
        Return next yielded value or raise StopAsyncIteration.
        N)rE)r.r:r r r!rG�szAsyncGenerator.asendNc�s4|dkr|dkr|�|�}|dk	r,|j|�}|�dS)zyRaise an exception in the asynchronous generator.
        Return next yielded value or raise StopAsyncIteration.
        N)r<)r.r=r>r?r r r!�athrow�s
zAsyncGenerator.athrowc�s:y|jt�IdHWnttfk
r,Yn
Xtd��dS)z.Raise GeneratorExit inside coroutine.
        Nz,asynchronous generator ignored GeneratorExit)rHrArErB)r.r r r!�aclose�s
zAsyncGenerator.aclosecCs|tkrt|ddddd�StS)NrDrFrGrHrI)rr-r')r0r(r r r!r1�s
zAsyncGenerator.__subclasshook__)NN)r2r3r4r5rFrrGrHrIr6r1r r r r!r�s
c@s(eZdZfZedd��Zedd��ZdS)r
ccsdS)Nr )r.r r r!�__iter__�szIterable.__iter__cCs|tkrt|d�StS)NrJ)r
r-r')r0r(r r r!r1�s
zIterable.__subclasshook__N)r2r3r4r5rrJr6r1r r r r!r
�sc@s0eZdZfZedd��Zdd�Zedd��ZdS)rcCst�dS)zKReturn the next item from the iterator. When exhausted, raise StopIterationN)r9)r.r r r!�__next__szIterator.__next__cCs|S)Nr )r.r r r!rJszIterator.__iter__cCs|tkrt|dd�StS)NrJrK)rr-r')r0r(r r r!r1szIterator.__subclasshook__N)	r2r3r4r5rrKrJr6r1r r r r!rsc@s(eZdZfZedd��Zedd��ZdS)r
ccsdS)Nr )r.r r r!�__reversed__)szReversible.__reversed__cCs|tkrt|dd�StS)NrLrJ)r
r-r')r0r(r r r!r1.szReversible.__subclasshook__N)r2r3r4r5rrLr6r1r r r r!r
%sc@sFeZdZfZdd�Zedd��Zeddd��Zdd	�Ze	d
d��Z
dS)
rcCs
|jd�S)z^Return the next item from the generator.
        When exhausted, raise StopIteration.
        N)r;)r.r r r!rK9szGenerator.__next__cCst�dS)zcSend a value into the generator.
        Return next yielded value or raise StopIteration.
        N)r9)r.r:r r r!r;?szGenerator.sendNcCs4|dkr|dkr|�|�}|dk	r,|j|�}|�dS)zgRaise an exception in the generator.
        Return next yielded value or raise StopIteration.
        N)r<)r.r=r>r?r r r!r@Fs
zGenerator.throwcCs4y|jt�Wnttfk
r&Yn
Xtd��dS)z.Raise GeneratorExit inside generator.
        zgenerator ignored GeneratorExitN)r@rAr9rB)r.r r r!rCSs
zGenerator.closecCs|tkrt|ddddd�StS)NrJrKr;r@rC)rr-r')r0r(r r r!r1]s
zGenerator.__subclasshook__)NN)r2r3r4r5rKrr;r@rCr6r1r r r r!r5s
c@s(eZdZfZedd��Zedd��ZdS)rcCsdS)Nrr )r.r r r!�__len__ksz
Sized.__len__cCs|tkrt|d�StS)NrM)rr-r')r0r(r r r!r1os
zSized.__subclasshook__N)r2r3r4r5rrMr6r1r r r r!rgsc@s(eZdZfZedd��Zedd��ZdS)rcCsdS)NFr )r.�xr r r!�__contains__zszContainer.__contains__cCs|tkrt|d�StS)NrO)rr-r')r0r(r r r!r1~s
zContainer.__subclasshook__N)r2r3r4r5rrOr6r1r r r r!rvsc@seZdZfZedd��ZdS)rcCs|tkrt|ddd�StS)NrMrJrO)rr-r')r0r(r r r!r1�szCollection.__subclasshook__N)r2r3r4r5r6r1r r r r!r�sc@s(eZdZfZedd��Zedd��ZdS)rcOsdS)NFr )r.�args�kwdsr r r!�__call__�szCallable.__call__cCs|tkrt|d�StS)NrR)rr-r')r0r(r r r!r1�s
zCallable.__subclasshook__N)r2r3r4r5rrRr6r1r r r r!r�sc@s�eZdZdZfZdd�Zdd�Zdd�Zdd	�Zd
d�Z	e
dd
��Zdd�ZeZ
dd�Zdd�ZeZdd�Zdd�Zdd�ZeZdd�ZdS)raZA set is a finite, iterable container.

    This class provides concrete generic implementations of all
    methods except for __contains__, __iter__ and __len__.

    To override the comparisons (presumably for speed, as the
    semantics are fixed), redefine __le__ and __ge__,
    then the other operations will automatically follow suit.
    cCs@t|t�stSt|�t|�kr"dSx|D]}||kr(dSq(WdS)NFT)�
isinstancerr'�len)r.�other�elemr r r!�__le__�s

z
Set.__le__cCs(t|t�stSt|�t|�ko&|j|�S)N)rSrr'rTrW)r.rUr r r!�__lt__�s
z
Set.__lt__cCs(t|t�stSt|�t|�ko&|j|�S)N)rSrr'rT�__ge__)r.rUr r r!�__gt__�s
z
Set.__gt__cCs@t|t�stSt|�t|�kr"dSx|D]}||kr(dSq(WdS)NFT)rSrr'rT)r.rUrVr r r!rY�s

z
Set.__ge__cCs(t|t�stSt|�t|�ko&|j|�S)N)rSrr'rTrW)r.rUr r r!�__eq__�s
z
Set.__eq__cCs||�S)z�Construct an instance of the class from any iterable input.

        Must override this method if the class constructor signature
        does not accept an iterable for an input.
        r )r0�itr r r!�_from_iterable�szSet._from_iterablecs&t|t�stS�j�fdd�|D��S)Nc3s|]}|�kr|VqdS)Nr )�.0r:)r.r r!�	<genexpr>�szSet.__and__.<locals>.<genexpr>)rSr
r'r])r.rUr )r.r!�__and__�s
zSet.__and__cCsx|D]}||krdSqWdS)z1Return True if two sets have a null intersection.FTr )r.rUr:r r r!�
isdisjoint�s
zSet.isdisjointcCs*t|t�stSdd�||fD�}|j|�S)Ncss|]}|D]
}|Vq
qdS)Nr )r^�s�er r r!r_�szSet.__or__.<locals>.<genexpr>)rSr
r'r])r.rU�chainr r r!�__or__�s
z
Set.__or__cs:t�t�s"t�t�stS|j���|j�fdd�|D��S)Nc3s|]}|�kr|VqdS)Nr )r^r:)rUr r!r_�szSet.__sub__.<locals>.<genexpr>)rSrr
r'r])r.rUr )rUr!�__sub__�s



zSet.__sub__cs:t|t�s"t|t�stS�j|�}�j�fdd�|D��S)Nc3s|]}|�kr|VqdS)Nr )r^r:)r.r r!r_�szSet.__rsub__.<locals>.<genexpr>)rSrr
r'r])r.rUr )r.r!�__rsub__�s



zSet.__rsub__cCs2t|t�s"t|t�stS|j|�}||||BS)N)rSrr
r'r])r.rUr r r!�__xor__s



zSet.__xor__cCs�tj}d|d}t|�}d|d}||M}x4|D],}t|�}|||d>AdAdN}||M}q4W|dd}||M}||kr�||d8}|d
kr�d	}|S)a+Compute the hash value of a set.

        Note that we don't define __hash__: not all sets are hashable.
        But if you define a hashable set type, its __hash__ should
        call this function.

        This must be compatible __eq__.

        All sets ought to compare equal if they contain the same
        elements, regardless of how they are implemented, and
        regardless of the order of the elements; so there's not much
        freedom for __eq__ or __hash__.  We match the algorithm used
        by the built-in frozenset type.
        �riM��r�i�M[l�4~2i�
i��6i��8#���)�sys�maxsizerT�hash)r.�MAX�MASK�n�hrN�hxr r r!�_hash	s 
z	Set._hashN)r2r3r4�__doc__r5rWrXrZrYr[r6r]r`�__rand__rare�__ror__rfrgrh�__rxor__rtr r r r!r�s$


	c@sdeZdZdZfZedd��Zedd��Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�ZdS)ra�A mutable set is a finite, iterable container.

    This class provides concrete generic implementations of all
    methods except for __contains__, __iter__, __len__,
    add(), and discard().

    To override the comparisons (presumably for speed, as the
    semantics are fixed), all you have to do is redefine __le__ and
    then the other operations will automatically follow suit.
    cCst�dS)zAdd an element.N)�NotImplementedError)r.r:r r r!�add:szMutableSet.addcCst�dS)z8Remove an element.  Do not raise an exception if absent.N)ry)r.r:r r r!�discard?szMutableSet.discardcCs||krt|��|j|�dS)z5Remove an element. If not a member, raise a KeyError.N)�KeyErrorr{)r.r:r r r!�removeDszMutableSet.removecCs<t|�}yt|�}Wntk
r,t�YnX|j|�|S)z2Return the popped value.  Raise KeyError if empty.)�iter�nextr9r|r{)r.r\r:r r r!�popJs

zMutableSet.popcCs,yx|j�qWWntk
r&YnXdS)z6This is slow (creates N new iterators!) but effective.N)r�r|)r.r r r!�clearTs
zMutableSet.clearcCsx|D]}|j|�qW|S)N)rz)r.r\r:r r r!�__ior__\s
zMutableSet.__ior__cCs x||D]}|j|�q
W|S)N)r{)r.r\r:r r r!�__iand__aszMutableSet.__iand__cCsV||kr|j�n@t|t�s&|j|�}x*|D]"}||krD|j|�q,|j|�q,W|S)N)r�rSrr]r{rz)r.r\r:r r r!�__ixor__fs



zMutableSet.__ixor__cCs.||kr|j�nx|D]}|j|�qW|S)N)r�r{)r.r\r:r r r!�__isub__ss


zMutableSet.__isub__N)r2r3r4rur5rrzr{r}r�r�r�r�r�r�r r r r!r,s


c@sReZdZfZedd��Zddd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZdZdS)rcCst�dS)N)r|)r.�keyr r r!�__getitem__�szMapping.__getitem__NcCs"y||Stk
r|SXdS)z<D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.N)r|)r.r��defaultr r r!�get�szMapping.getcCs*y||Wntk
r dSXdSdS)NFT)r|)r.r�r r r!rO�s
zMapping.__contains__cCst|�S)z:D.keys() -> a set-like object providing a view on D's keys)r)r.r r r!�keys�szMapping.keyscCst|�S)z<D.items() -> a set-like object providing a view on D's items)r)r.r r r!�items�sz
Mapping.itemscCst|�S)z6D.values() -> an object providing a view on D's values)r)r.r r r!�values�szMapping.valuescCs&t|t�stSt|j��t|j��kS)N)rSrr'�dictr�)r.rUr r r!r[�s
zMapping.__eq__)N)
r2r3r4r5rr�r�rOr�r�r�r[rLr r r r!r�s

c@s(eZdZd	Zdd�Zdd�Zdd�ZdS)
r�_mappingcCs
||_dS)N)r�)r.�mappingr r r!�__init__�szMappingView.__init__cCs
t|j�S)N)rTr�)r.r r r!rM�szMappingView.__len__cCs
dj|�S)Nz&{0.__class__.__name__}({0._mapping!r}))�format)r.r r r!�__repr__�szMappingView.__repr__N)r�)r2r3r4r5r�rMr�r r r r!r�sc@s,eZdZfZedd��Zdd�Zdd�ZdS)rcCst|�S)N)�set)r.r\r r r!r]�szKeysView._from_iterablecCs
||jkS)N)r�)r.r�r r r!rO�szKeysView.__contains__ccs|jEdHdS)N)r�)r.r r r!rJ�szKeysView.__iter__N)r2r3r4r5r6r]rOrJr r r r!r�sc@s,eZdZfZedd��Zdd�Zdd�ZdS)rcCst|�S)N)r�)r.r\r r r!r]�szItemsView._from_iterablecCs@|\}}y|j|}Wntk
r*dSX||kp:||kSdS)NF)r�r|)r.�itemr�r:�vr r r!rO�szItemsView.__contains__ccs$x|jD]}||j|fVqWdS)N)r�)r.r�r r r!rJ�szItemsView.__iter__N)r2r3r4r5r6r]rOrJr r r r!r�s	c@s eZdZfZdd�Zdd�ZdS)rcCs2x,|jD]"}|j|}||ks&||krdSqWdS)NTF)r�)r.r:r�r�r r r!rO�s

zValuesView.__contains__ccs x|jD]}|j|VqWdS)N)r�)r.r�r r r!rJ�szValuesView.__iter__N)r2r3r4r5rOrJr r r r!r�sc@s\eZdZfZedd��Zedd��Ze�Zefdd�Z	dd�Z
d	d
�Zdd�Zddd�Z
d
S)rcCst�dS)N)r|)r.r�r:r r r!�__setitem__szMutableMapping.__setitem__cCst�dS)N)r|)r.r�r r r!�__delitem__szMutableMapping.__delitem__cCs<y||}Wn tk
r,||jkr(�|SX||=|SdS)z�D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
          If key is not found, d is returned if given, otherwise KeyError is raised.
        N)r|�_MutableMapping__marker)r.r�r�r:r r r!r�s
zMutableMapping.popcCs@ytt|��}Wntk
r(t�YnX||}||=||fS)z�D.popitem() -> (k, v), remove and return some (key, value) pair
           as a 2-tuple; but raise KeyError if D is empty.
        )rr~r9r|)r.r�r:r r r!�popitem$s
zMutableMapping.popitemcCs,yx|j�qWWntk
r&YnXdS)z,D.clear() -> None.  Remove all items from D.N)r�r|)r.r r r!r�0s
zMutableMapping.clearcOs�|std��|^}}t|�dkr0tdt|���|r�|d}t|t�rbx^|D]}||||<qLWnDt|d�r�x8|j�D]}||||<qvWnx|D]\}}|||<q�Wx|j�D]\}}|||<q�WdS)aK D.update([E, ]**F) -> None.  Update D from mapping/iterable E and F.
            If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
            If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
            In either case, this is followed by: for k, v in F.items(): D[k] = v
        z@descriptor 'update' of 'MutableMapping' object needs an argumentrz+update expected at most 1 arguments, got %drr�N)�	TypeErrorrTrSr�hasattrr�r�)rPrQr.rUr�r:r r r!�update8s$


zMutableMapping.updateNcCs*y||Stk
r$|||<YnX|S)z@D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D)r|)r.r�r�r r r!�
setdefaultSs
zMutableMapping.setdefault)N)r2r3r4r5rr�r��objectr�r�r�r�r�r�r r r r!r�sc@sJeZdZdZfZedd��Zdd�Zdd�Zdd	�Z	ddd
�Z
dd�ZdS)rz�All the operations on a read-only sequence.

    Concrete subclasses must override __new__ or __init__,
    __getitem__, and __len__.
    cCst�dS)N)�
IndexError)r.�indexr r r!r�kszSequence.__getitem__ccs>d}y x||}|V|d7}qWWntk
r8dSXdS)Nrr)r�)r.�ir�r r r!rJoszSequence.__iter__cCs&x |D]}||ks||krdSqWdS)NTFr )r.r:r�r r r!rOys
zSequence.__contains__ccs(x"ttt|���D]}||VqWdS)N)�reversed�rangerT)r.r�r r r!rLszSequence.__reversed__rNcCs�|dk	r"|dkr"tt|�|d�}|dk	r>|dkr>|t|�7}|}xT|dksT||kr�y ||}||ksn||krr|SWntk
r�PYnX|d7}qDWt�dS)z�S.index(value, [start, [stop]]) -> integer -- return first index of value.
           Raises ValueError if the value is not present.

           Supporting start and stop arguments is optional, but
           recommended.
        Nrr)�maxrTr��
ValueError)r.r:�start�stopr�r�r r r!r��szSequence.indexcst�fdd�|D��S)zBS.count(value) -> integer -- return number of occurrences of valuec3s"|]}|�ks|�krdVqdS)rNr )r^r�)r:r r!r_�sz!Sequence.count.<locals>.<genexpr>)�sum)r.r:r )r:r!�count�szSequence.count)rN)r2r3r4rur5rr�rJrOrLr�r�r r r r!ras

c@seZdZdZfZdS)rzMThis unifies bytes and bytearray.

    XXX Should add all their methods.
    N)r2r3r4rur5r r r r!r�sc@sneZdZfZedd��Zedd��Zedd��Zdd�Zd	d
�Z	dd�Z
d
d�Zddd�Zdd�Z
dd�ZdS)rcCst�dS)N)r�)r.r�r:r r r!r��szMutableSequence.__setitem__cCst�dS)N)r�)r.r�r r r!r��szMutableSequence.__delitem__cCst�dS)z3S.insert(index, value) -- insert value before indexN)r�)r.r�r:r r r!�insert�szMutableSequence.insertcCs|jt|�|�dS)z:S.append(value) -- append value to the end of the sequenceN)r�rT)r.r:r r r!�append�szMutableSequence.appendcCs,yx|j�qWWntk
r&YnXdS)z,S.clear() -> None -- remove all items from SN)r�r�)r.r r r!r��s
zMutableSequence.clearcCsLt|�}x>t|d�D].}|||d||||<|||d<qWdS)z!S.reverse() -- reverse *IN PLACE*rirN)rTr�)r.rqr�r r r!�reverse�szMutableSequence.reversecCsx|D]}|j|�qWdS)zMS.extend(iterable) -- extend sequence by appending elements from the iterableN)r�)r.r�r�r r r!�extend�s
zMutableSequence.extendrcCs||}||=|S)z�S.pop([index]) -> item -- remove and return item at index (default last).
           Raise IndexError if list is empty or index is out of range.
        r )r.r�r�r r r!r��szMutableSequence.popcCs||j|�=dS)zvS.remove(value) -- remove first occurrence of value.
           Raise ValueError if the value is not present.
        N)r�)r.r:r r r!r}�szMutableSequence.removecCs|j|�|S)N)r�)r.r�r r r!�__iadd__�s
zMutableSequence.__iadd__Nrk)rk)r2r3r4r5rr�r�r�r�r�r�r�r�r}r�r r r r!r�s	
)Kru�abcrrrl�__all__r2�typer~�bytes_iterator�	bytearray�bytearray_iteratorr��dict_keyiteratorr��dict_valueiteratorr��dict_itemiterator�
list_iteratorr��list_reverseiteratorr��range_iterator�longrange_iteratorr��set_iterator�str_iterator�tuple_iterator�zip�zip_iterator�	dict_keys�dict_values�
dict_itemsr&�mappingproxy�	generatorr#�	coroutinerCr$�async_generatorr-r	rr�registerrrrr
rr
rrrrrr�	frozensetrrrrrrrr�r�tuple�str�
memoryviewr�bytesr�listr r r r!�<module>s�
	
)
0













/



O
2



\
=



	

A
mimetypes.cpython-36.opt-1.pyc000064400000036303150335715140012156 0ustar003


 \2R�@sdZddlZddlZddlZddlZyddlZWnek
rHdZYnXddddddd	d
ddd
ddg
Z	dddddddddg	Z
dadaGdd�d�Z
d6dd�Zd7dd�Zd8dd�Zd9dd	�Zd:dd
�Zd d�Zd!d"�Ze�ed#k�rddlZd$Zd;d&d'�Zy&ejejd(d�d)d*d+d,g�\ZZWn0ejk
�rRZzed(e�WYddZ[XnXd(ZdZxDeD]<\Z Z!e d<k�r~ed�ne d=k�r�dZne d>k�rbd(Z�qbWxheD]`Z"e�r�ee"e�Z#e#�s�e$d3e"�ne$e#�n.ee"e�\Z#Z%e#�s�e$d3e"�ne$d4e#d5e%��q�WdS)?a�Guess the MIME type of a file.

This module defines two useful functions:

guess_type(url, strict=True) -- guess the MIME type and encoding of a URL.

guess_extension(type, strict=True) -- guess the extension for a given MIME type.

It also contains the following, for tuning the behavior:

Data:

knownfiles -- list of files to parse
inited -- flag set when init() has been called
suffix_map -- dictionary mapping suffixes to suffixes
encodings_map -- dictionary mapping suffixes to encodings
types_map -- dictionary mapping suffixes to types

Functions:

init([files]) -- parse a list of files, default knownfiles (on Windows, the
  default values are taken from the registry)
read_mime_types(file) -- parse one file, return a dictionary or None
�N�
knownfiles�inited�	MimeTypes�
guess_type�guess_all_extensions�guess_extension�add_type�init�read_mime_types�
suffix_map�
encodings_map�	types_map�common_typesz/etc/mime.typesz/etc/httpd/mime.typesz/etc/httpd/conf/mime.typesz/etc/apache/mime.typesz/etc/apache2/mime.typesz$/usr/local/etc/httpd/conf/mime.typesz"/usr/local/lib/netscape/mime.typesz/usr/local/etc/mime.typesFc@sdeZdZdZfdfdd�Zddd�Zddd�Zdd	d
�Zddd�Zdd
d�Z	ddd�Z
ddd�ZdS)rz�MIME-types datastore.

    This datastore can handle information from mime.types-style files
    and supports basic determination of MIME type from a filename or
    URL, and can guess a reasonable extension given a MIME type.
    TcCs�ts
t�tj�|_tj�|_iif|_iif|_x"tj�D]\}}|j||d�q<Wx"t	j�D]\}}|j||d�q`Wx|D]}|j
||�q�WdS)NTF)rr	r�copyrr
�
types_map_inv�itemsrr�read)�self�	filenames�strict�ext�type�name�r�!/usr/lib64/python3.6/mimetypes.py�__init__Bs




zMimeTypes.__init__cCs6||j||<|j|j|g�}||kr2|j|�dS)a�Add a mapping between a type and an extension.

        When the extension is already known, the new
        type will replace the old one. When the type
        is already known the extension will be added
        to the list of known extensions.

        If strict is true, information will be added to
        list of standard types, else to the list of non-standard
        types.
        N)r
r�
setdefault�append)rrrrZextsrrrrPszMimeTypes.add_typecCsltjj|�\}}|dkrz|jd�}|dkr.dS|jdd|�}|dkrR|d|�}n|d|�}d|ksnd|krrd}|dfStj|�\}}x&||jkr�tj||j|�\}}q�W||jkr�|j|}	tj|�\}}nd}	|jd	}
||
kr�|
||	fS|j	�|
k�r|
|j	�|	fS|�r"d|	fS|jd
}
||
k�rB|
||	fS|j	�|
k�r`|
|j	�|	fSd|	fSdS)a:Guess the type of a file based on its URL.

        Return value is a tuple (type, encoding) where type is None if
        the type can't be guessed (no or unknown suffix) or a string
        of the form type/subtype, usable for a MIME Content-type
        header; and encoding is None for no encoding or the name of
        the program used to encode (e.g. compress or gzip).  The
        mappings are table driven.  Encoding suffixes are case
        sensitive; type suffixes are first tried case sensitive, then
        case insensitive.

        The suffixes .tgz, .taz and .tz (case sensitive!) are all
        mapped to '.tar.gz'.  (This is table-driven too, using the
        dictionary suffix_map.)

        Optional `strict' argument when False adds a bunch of commonly found,
        but non-standard types.
        �data�,rN�;�=�/z
text/plainTF)NN)
�urllib�parseZ	splittype�find�	posixpath�splitextrrr
�lower)r�urlr�schemeZcommaZsemir�baser�encodingr
rrrras@





zMimeTypes.guess_typecCsP|j�}|jdj|g�}|sLx,|jdj|g�D]}||kr2|j|�q2W|S)a�Guess the extensions for a file based on its MIME type.

        Return value is a list of strings giving the possible filename
        extensions, including the leading dot ('.').  The extension is not
        guaranteed to have been associated with any particular data stream,
        but would be mapped to the MIME type `type' by guess_type().

        Optional `strict' argument when false adds a bunch of commonly found,
        but non-standard types.
        TF)r(r�getr)rrr�
extensionsrrrrr�szMimeTypes.guess_all_extensionscCs|j||�}|sdS|dS)aGuess the extension for a file based on its MIME type.

        Return value is a string giving a filename extension,
        including the leading dot ('.').  The extension is not
        guaranteed to have been associated with any particular data
        stream, but would be mapped to the MIME type `type' by
        guess_type().  If no extension can be guessed for `type', None
        is returned.

        Optional `strict' argument when false adds a bunch of commonly found,
        but non-standard types.
        Nr)r)rrrr.rrrr�s
zMimeTypes.guess_extensionc
Cs(t|dd��}|j||�WdQRXdS)z�
        Read a single mime.types-format file, specified by pathname.

        If strict is true, information will be added to
        list of standard types, else to the list of non-standard
        types.
        zutf-8)r,N)�open�readfp)r�filenamer�fprrrr�szMimeTypes.readc	Cs�x�|j�}|sP|j�}x0tt|��D] }||ddkr&||d�=Pq&W|sPq|d|dd�}}x|D]}|j|d||�qlWqWdS)z�
        Read a single mime.types-format file.

        If strict is true, information will be added to
        list of standard types, else to the list of non-standard
        types.
        r�#N��.)�readline�split�range�lenr)	rr2r�lineZwords�ir�suffixesZsuffrrrr0�s

zMimeTypes.readfpcCs�tsdSdd�}tjtjd���}xz||�D]n}yRtj||��<}|jd�sJw*tj|d�\}}|tjkrfw*|j|||�WdQRXWq*tk
r�w*Yq*Xq*WWdQRXdS)z�
        Load the MIME types database from Windows registry.

        If strict is true, information will be added to
        list of standard types, else to the list of non-standard
        types.
        NcssLd}xBytj||�}Wntk
r,PYnXd|kr<|V|d7}qWdS)Nr�r4)�_winregZEnumKey�EnvironmentError)Zmimedbr;Zctyperrr�
enum_types�sz3MimeTypes.read_windows_registry.<locals>.enum_types�r5zContent Type)r>�OpenKeyZHKEY_CLASSES_ROOT�
startswithZQueryValueExZREG_SZrr?)rrr@ZhkcrZ
subkeynameZsubkeyZmimetypeZdatatyperrr�read_windows_registry�s 


zMimeTypes.read_windows_registryN)T)T)T)T)T)T)T)�__name__�
__module__�__qualname__�__doc__rrrrrrr0rDrrrrr:s

>



TcCstdkrt�tj||�S)a�Guess the type of a file based on its URL.

    Return value is a tuple (type, encoding) where type is None if the
    type can't be guessed (no or unknown suffix) or a string of the
    form type/subtype, usable for a MIME Content-type header; and
    encoding is None for no encoding or the name of the program used
    to encode (e.g. compress or gzip).  The mappings are table
    driven.  Encoding suffixes are case sensitive; type suffixes are
    first tried case sensitive, then case insensitive.

    The suffixes .tgz, .taz and .tz (case sensitive!) are all mapped
    to ".tar.gz".  (This is table-driven too, using the dictionary
    suffix_map).

    Optional `strict' argument when false adds a bunch of commonly found, but
    non-standard types.
    N)�_dbr	r)r)rrrrrscCstdkrt�tj||�S)a�Guess the extensions for a file based on its MIME type.

    Return value is a list of strings giving the possible filename
    extensions, including the leading dot ('.').  The extension is not
    guaranteed to have been associated with any particular data
    stream, but would be mapped to the MIME type `type' by
    guess_type().  If no extension can be guessed for `type', None
    is returned.

    Optional `strict' argument when false adds a bunch of commonly found,
    but non-standard types.
    N)rIr	r)rrrrrr&s
cCstdkrt�tj||�S)a�Guess the extension for a file based on its MIME type.

    Return value is a string giving a filename extension, including the
    leading dot ('.').  The extension is not guaranteed to have been
    associated with any particular data stream, but would be mapped to the
    MIME type `type' by guess_type().  If no extension can be guessed for
    `type', None is returned.

    Optional `strict' argument when false adds a bunch of commonly found,
    but non-standard types.
    N)rIr	r)rrrrrr7scCstdkrt�tj|||�S)aiAdd a mapping between a type and an extension.

    When the extension is already known, the new
    type will replace the old one. When the type
    is already known the extension will be added
    to the list of known extensions.

    If strict is true, information will be added to
    list of standard types, else to the list of non-standard
    types.
    N)rIr	r)rrrrrrrGscCsndat�}|dkr"tr|j�t}x"|D]}tjj|�r(|j|�q(W|j	a	|j
a
|jda|jda|a
dS)NTF)rrr>rDr�os�path�isfilerrrr
rrI)�files�db�filerrrr	Xs


cCsNyt|�}Wntk
r dSX|�t�}|j|d�|jdSQRXdS)NT)r/�OSErrorrr0r
)rO�frNrrrr
lsc�CsDddddddd�adddd	d
�addd
d
d
dddddddddddddddddddddddddd d d!d"d#d#d#d$d%dd&d'd(d(d)d*ddd+d$d,d-d.d.d/d'd'd'd'd0ddddd1d2d3d4d5d2d6dd7d8d9d9d:d9d9dd9d;d<d<d,d=d>d?d@dAdBdCdDdDdEdFdddGdHdIdJdKdBdLdMdNdOdOdPdPdBdQddRdSdTdUdd@dVdWdXdWdYd@dZd@d[d\d]��ad^d_d_d`d`d`dadbdc�adS)dNz.svg.gzz.tar.gzz.tar.bz2z.tar.xz)z.svgzz.tgzz.tazz.tzz.tbz2z.txzZgzip�compressZbzip2Zxz)z.gzz.Zz.bz2z.xzzapplication/octet-streamzapplication/postscriptzaudio/x-aiffzaudio/basiczvideo/x-msvideoz
text/plainzapplication/x-bcpiozimage/x-ms-bmpzapplication/x-cdfzapplication/x-netcdfzapplication/x-cpiozapplication/x-cshztext/cssztext/csvzapplication/mswordzapplication/x-dvizmessage/rfc822z
text/x-setextz	image/gifzapplication/x-gtarzapplication/x-hdfz	text/htmlzimage/vnd.microsoft.iconz	image/iefz
image/jpegzapplication/javascriptzapplication/jsonzapplication/x-latexz
video/mpegzapplication/vnd.apple.mpegurlzapplication/x-troff-manzapplication/x-troff-mezapplication/x-mifzvideo/quicktimezvideo/x-sgi-moviez
audio/mpegz	video/mp4zapplication/x-troff-mszapplication/odazapplication/x-pkcs12zapplication/pkcs7-mimezimage/x-portable-bitmapzapplication/pdfzimage/x-portable-graymapz	image/pngzimage/x-portable-anymapzapplication/vnd.ms-powerpointzimage/x-portable-pixmapz
text/x-pythonzapplication/x-python-codezaudio/x-pn-realaudiozapplication/x-pn-realaudiozimage/x-cmu-rasterzapplication/xmlzimage/x-rgbzapplication/x-troffz
text/richtextztext/x-sgmlzapplication/x-shzapplication/x-sharzapplication/x-wais-sourcezapplication/x-sv4cpiozapplication/x-sv4crcz
image/svg+xmlzapplication/x-shockwave-flashzapplication/x-tarzapplication/x-tclzapplication/x-texzapplication/x-texinfoz
image/tiffztext/tab-separated-valueszapplication/x-ustarztext/x-vcardzaudio/x-wavz
video/webmzimage/x-xbitmapzapplication/vnd.ms-excelzapplication/excelztext/xmlzimage/x-xpixmapzimage/x-xwindowdumpzapplication/zip)�z.az.aiz.aifz.aifcz.aiffz.auz.aviz.batz.bcpioz.binz.bmpz.cz.cdfz.cdfz.cpioz.cshz.cssz.csvz.dllz.docz.dotz.dviz.emlz.epsz.etxz.exez.gifz.gtarz.hz.hdfz.htmz.htmlz.icoz.iefz.jpez.jpegz.jpgz.jsz.jsonz.kshz.latexz.m1vz.m3uz.m3u8z.manz.mez.mhtz.mhtmlz.mifz.mjsz.movz.moviez.mp2z.mp3z.mp4z.mpaz.mpez.mpegz.mpgz.msz.ncz.nwsz.oz.objz.odaz.p12z.p7cz.pbmz.pdfz.pfxz.pgmz.plz.pngz.pnmz.potz.ppaz.ppmz.ppsz.pptz.psz.pwzz.pyz.pycz.pyoz.qtz.raz.ramz.rasz.rdfz.rgbz.roffz.rtxz.sgmz.sgmlz.shz.sharz.sndz.soz.srcz.sv4cpioz.sv4crcz.svgz.swfz.tz.tarz.tclz.texz.texiz.texinfoz.tifz.tiffz.trz.tsvz.txtz.ustarz.vcfz.wavz.webmz.wizz.wsdlz.xbmz.xlbz.xlsz.xlsz.xmlz.xpdlz.xpmz.xslz.xwdz.zipz	image/jpgz
audio/midiz
image/pictzapplication/rtfztext/xul)z.jpgz.midz.midiz.pctz.picz.pictz.rtfz.xul)rrr
rrrrr�_default_mime_typesws(	rS�__main__a4Usage: mimetypes.py [options] type

Options:
    --help / -h       -- print this message and exit
    --lenient / -l    -- additionally search of some common, but non-standard
                         types.
    --extension / -e  -- guess extension instead of type

More than one type argument may be given.
rAcCs"tt�|rt|�tj|�dS)N)�print�USAGE�sys�exit)�code�msgrrr�usage;sr[r4Zhle�helpZlenient�	extension�-h�--help�-l�	--lenient�-e�--extensionz I don't know anything about typeztype:z	encoding:)T)T)T)T)N)rA)r^r_)r`ra)rbrc)&rHrJrWr&Zurllib.parser#�winregr>�ImportError�__all__rrrIrrrrrr	r
rSrEZgetoptrVr[�argvZopts�args�errorrZrr]�opt�argZgtypeZguessrUr,rrrr�<module>s|
V




3









__phello__.foo.cpython-36.opt-2.pyc000064400000000171150335715140012776 0ustar003


 \@�@sdS)N�rrr�&/usr/lib64/python3.6/__phello__.foo.py�<module>sntpath.cpython-36.pyc000064400000032670150335715140010504 0ustar003


 \6Z�'@s>dZdZdZdZdZdZdZdZdZdd	l	Z	dd	l
Z
dd	lZdd	lZdd
lTddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1g'Z
d2d3�Zd4d�Zd5d�Zd6d
�Zd7d�Zd8d"�Zd9d�Zd:d�Zejje_d;d�Zd<d�Zd=d�Zd>d�Zydd?lmZWnek
�r2d	ZYnXd@d�ZdAd�ZdBd�Z dCd �Z!dDdE�Z"yddFlm#Z#Wnek
�r�e"Z$Yn
XdGd!�Z$e$Z%e&e
dH��o�e
j'�dIdJkZ(dRdKd-�Z)dLd1�Z*y,e
j'�d	dJ�dSk�r�ddNlm+Z+ne�Wn"e,efk
�rdOdP�Z+YnXyddQlm-Z.Wnek
�r8YnXd	S)Tz�Common pathname manipulations, WindowsNT/95 version.

Instead of importing this module directly, import os and refer to this
module as os.path.
�.z..�\�;�/z.;C:\binZnul�N)�*�normcase�isabs�join�
splitdrive�split�splitext�basename�dirname�commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�ismount�
expanduser�
expandvars�normpath�abspath�splitunc�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenames�relpath�samefile�sameopenfile�samestat�
commonpathcCst|t�rdSdSdS)Ns\/z\/)�
isinstance�bytes)�path�r1�/usr/lib64/python3.6/ntpath.py�
_get_bothseps"s
r3cCsxtj|�}y.t|t�r&|jdd�j�S|jdd�j�SWn:ttfk
rrt|ttf�sltd|j	j
�d��YnXdS)zaNormalize case of pathname.

    Makes all characters lowercase and all slashes into backslashes.�/�\rrz0normcase() argument must be str or bytes, not %rN)�os�fspathr.r/�replace�lower�	TypeError�AttributeError�str�	__class__�__name__)�sr1r1r2r,s

cCs2tj|�}t|�d}t|�dko0|dt|�kS)zTest whether a path is absolute�r)r6r7r
�lenr3)r?r1r1r2rCs
c

GsVtj|�}t|t�r"d}d}d}nd}d}d}y�|sD|dd�|t|�\}}x�ttj|�D]�}t|�\}}	|	r�|	d|kr�|s�|r�|}|	}q^n*|r�||kr�|j�|j�kr�|}|	}q^|}|r�|d
|kr�||}||	}q^W|�r|d|k�r|�r|dd�|k�r|||S||Sttt	fk
�rPt
jd	|f|���YnXdS)Nr5s\/�:rz\/�:rr@r	���rD)r6r7r.r/r
�mapr9r:r;�BytesWarning�genericpath�_check_arg_types)
r0�pathsr!�seps�colonZresult_driveZresult_path�pZp_driveZp_pathr1r1r2r	KsF


cCstj|�}t|�dk�rt|t�r0d}d}d}nd}d}d}|j||�}|dd�|dkr�|dd	�|kr�|j|d�}|dkr�|dd�|fS|j||d
�}||d
kr�|dd�|fS|d
kr�t|�}|d|�||d�fS|d
d�|k�r|dd�|dd�fS|dd�|fS)a�Split a pathname into drive/UNC sharepoint and relative path specifiers.
    Returns a 2-tuple (drive_or_unc, path); either part may be empty.

    If you assign
        result = splitdrive(p)
    It is always true that:
        result[0] + result[1] == p

    If the path contained a drive letter, drive_or_unc will contain everything
    up to and including the colon.  e.g. splitdrive("c:/dir") returns ("c:", "/dir")

    If the path contained a UNC path, the drive_or_unc will contain the host name
    and share up to but not including the fourth directory separator character.
    e.g. splitdrive("//host/computer/dir") returns ("//host/computer", "/dir")

    Paths cannot contain both a drive letter and a UNC path.

    �r5r4rBrrrCr�r@NrDrD)r6r7rAr.r/r8�find)rLr!r$rKZnormp�indexZindex2r1r1r2r
zs.

$cCsFddl}|jdtd�t|�\}}t|�dkr>|dd�|fS||fS)a�Deprecated since Python 3.1.  Please use splitdrive() instead;
    it now handles UNC paths.

    Split a pathname into UNC mount point and relative path specifiers.

    Return a 2-tuple (unc, rest); either part may be empty.
    If unc is not empty, it has the form '//host/mount' (or similar
    using backslashes).  unc+rest is always the input path.
    Paths containing drive letters never have a UNC part.
    rNz<ntpath.splitunc is deprecated, use ntpath.splitdrive insteadrM)�warnings�warn�DeprecationWarningr
rA)rLrQ�driver0r1r1r2r�scCs|tj|�}t|�}t|�\}}t|�}x |rF||d|krF|d8}q(W|d|�||d�}}|j|�pn|}|||fS)z~Split a pathname.

    Return tuple (head, tail) where tail is everything after the final slash.
    Either part may be empty.r@N)r6r7r3r
rA�rstrip)rLrJ�d�i�head�tailr1r1r2r�s
cCs8tj|�}t|t�r$tj|ddd�Stj|ddd�SdS)Nr5r4�.rrr)r6r7r.r/rG�	_splitext)rLr1r1r2r�s

cCst|�dS)z)Returns the final component of a pathnamer@)r)rLr1r1r2r
�scCst|�dS)z-Returns the directory component of a pathnamer)r)rLr1r1r2r�scCs4ytj|�}Wnttfk
r&dSXtj|j�S)zhTest whether a path is a symbolic link.
    This will always return false for Windows prior to 6.0.
    F)r6�lstat�OSErrorr;�stat�S_ISLNK�st_mode)r0�str1r1r2r�s
cCs(ytj|�}Wntk
r"dSXdS)zCTest whether a path exists.  Returns True for broken symbolic linksFT)r6r\r])r0rar1r1r2rs
)�_getvolumepathnamecCsttj|�}t|�}t|�}t|�\}}|rD|d|krD|pB||kS||krPdStrl|j|�t|�j|�kSdSdS)zaTest whether a path is a mount point (a drive root, the root of a
    share, or a mounted volume)rTFN)r6r7r3rr
rbrU)r0rJ�root�restr1r1r2rs
c
Cstj|�}t|t�rd}nd}|j|�s,|Sdt|�}}x$||kr^||t|�kr^|d7}q<Wdtjkrvtjd}n\dtjkr�tjd}nFdtjkr�|Sytjd}Wntk
r�d}YnXt	|tjd�}t|t�r�tj
|�}|dk�rt	t|�|d|��}|||d	�S)
zLExpand ~ and ~user constructs.

    If user or $HOME is unknown, do nothing.�~�~r@�HOMEZUSERPROFILEZHOMEPATHZ	HOMEDRIVE�N)r6r7r.r/�
startswithrAr3�environ�KeyErrorr	�fsencoder)r0�tilderW�n�userhomerTr1r1r2r5s2









cCs<tj|�}t|t�rhd|kr(d|kr(|Sddl}t|j|jdd�}d}d}d}d	}d}ttd
d�}nFd|kr|d|kr||Sddl}|j|jd}d
}d}d}d}d}tj}|dd�}	d}
t	|�}�xn|
|k�r6||
|
d�}||k�r\||
dd�}t	|�}y&|j
|�}
|	||d|
d�7}	Wn*tk
�rV|	||7}	|d}
YnX�n�||k�rN||
d|
d�|k�r�|	|7}	|
d7}
n�||
dd�}t	|�}y|j
|�}
Wn*tk
�r�|	||7}	|d}
YnhX|d|
�}
y.|dk�rtjtjtj
|
��}n||
}Wn"tk
�r@||
|}YnX|	|7}	�n�||k�r$||
d|
d�|k�r�|	|7}	|
d7}
�q,||
d|
d�|k�rb||
dd�}t	|�}y|j
|�}
Wn.tk
�r�|	|||7}	|d}
YnlX|d|
�}
y.|dk�r&tjtjtj
|
��}n||
}Wn&tk
�rV|||
|}YnX|	|7}	n�|dd�}
|
d7}
||
|
d�}x6|�r�||k�r�|
|7}
|
d7}
||
|
d�}�q�Wy.|dk�r�tjtjtj
|
��}n||
}Wntk
�r
||
}YnX|	|7}	|�r,|
d8}
n|	|7}	|
d7}
q�W|	S)zfExpand shell variables of the forms $var, ${var} and %var%.

    Unknown variables are left unchanged.�$�%rNz_-�ascii�'�{�}�environb�$�%�'�{�}r@rM)r6r7r.r/�stringZ
ascii_lettersZdigits�getattrrjrArP�
ValueErrorrl�fsdecoderk)r0r|ZvarcharsZquoteZpercentZbraceZrbraceZdollarrj�resrPZpathlen�c�var�valuer1r1r2rgs�











c	Cs\tj|�}t|t�r*d}d}d}d}d}nd}d}d	}d
}d}|j|�rL|S|j||�}t|�\}}|j|�r�||7}|j|�}|j|�}d
}x�|t	|�k�r2||s�|||kr�||=q�|||k�r(|d
ko�||d|k�r||d|d�=|d8}n&|d
k�r|j
|��r||=n|d7}q�|d7}q�W|�rN|�rN|j|�||j|�S)z0Normalize path, eliminating double slashes, etc.r5r4rZs..�\\.\�\\?\rrrz..�\\.\�\\?\rr@)r�r�)r�r�)
r6r7r.r/rir8r
�lstriprrA�endswith�appendr	)	r0r!r$rr Zspecial_prefixes�prefix�compsrWr1r1r2r�sF








cCs@tj|�}t|�s8t|t�r&tj�}ntj�}t||�}t|�S)z�Return the absolute version of a path as a fallback function in case
    `nt._getfullpathname` is not available or raises OSError. See bpo-31047 for
    more.

    )	r6r7rr.r/�getcwdb�getcwdr	r)r0�cwdr1r1r2�_abspath_fallback	s



r�)�_getfullpathnamecCs.ytt|��Sttfk
r(t|�SXdS)z&Return the absolute version of a path.N)rr�r]r~r�)r0r1r1r2r!s�getwindowsversionrNrMcCsdtj|�}t|t�r"d}d}d}nd}d}d}|dkr:|}|sFtd��tj|�}y�tt|��}tt|��}t|�\}}t|�\}	}
t|�t|	�kr�td	|	|f��d
d�|j	|�D�}dd�|
j	|�D�}d
}
x0t
||�D]"\}}t|�t|�kr�P|
d7}
q�W|gt|�|
||
d�}|�s(|St|�St
ttttfk
�r^tjd||��YnXdS)z#Return a relative version of a pathr5rZs..rrz..Nzno path specifiedz&path is on mount %r, start on mount %rcSsg|]}|r|�qSr1r1)�.0�xr1r1r2�
<listcomp>Jszrelpath.<locals>.<listcomp>cSsg|]}|r|�qSr1r1)r�r�r1r1r2r�Ksrr@r))r6r7r.r/r~rrr
rr�ziprAr	r:r;rFrSrGrH)r0�startr!rr Z	start_absZpath_absZstart_driveZ
start_restZ
path_driveZ	path_rest�
start_list�	path_listrWZe1Ze2�rel_listr1r1r2r).sF


cs�|std��tttj|��}t|dt�r8d�d�d�nd�d�d��y>��fd	d
�|D�}�fdd
�|D�}yt�fdd
�|D��\}Wntk
r�td�d�YnXttdd
�|D���dkr�td��t	|dj
����\}}|j��}�fdd
�|D�}�fdd
�|D�}t|�}t
|�}xBt|�D]&\}	}
|
||	k�r,|d|	�}P�q,W|dt|��}|�rt|�n|}|�j|�Sttfk
�r�tjd|���YnXdS)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr5r4rZrrrcs g|]}t|j���j���qSr1)r
r8r9)r�rL)r$r!r1r2r�wszcommonpath.<locals>.<listcomp>csg|]\}}|j���qSr1)r)r�rVrL)r!r1r2r�xsc3s"|]\}}|dd��kVqdS)Nr@r1)r�rVrL)r!r1r2�	<genexpr>{szcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathsNcss|]\}}|VqdS)Nr1)r�rVrLr1r1r2r��sr@zPaths don't have the same drivecsg|]}|r|�kr|�qSr1r1)r�r�)rr1r2r��scsg|]}�fdd�|D��qS)csg|]}|r|�kr|�qSr1r1)r�r�)rr1r2r��sz)commonpath.<locals>.<listcomp>.<listcomp>r1)r�r?)rr1r2r��sr-)r-)r~�tuplerEr6r7r.r/�setrAr
r8r�min�max�	enumerater	r:r;rGrH)rIZdrivesplits�split_pathsrrTr0�common�s1�s2rWr�r�r1)r$rr!r2r-fsF
�)�_getfinalpathnamecCstt|��S)N)rr)�fr1r1r2r��sr�)�_isdir)N)r�r)/�__doc__rr r%r!r"r$r#r&r6�sysr^rG�__all__r3rrr	r
rrrr[r
rrr�ntrb�ImportErrorrrrrr�r�rr'�hasattrr�r(r)r-r�r;r�rr1r1r1r2�<module>s|



/4

2q1

85argparse.cpython-36.opt-1.pyc000064400000165232150335715140011752 0ustar003


 \a�@s0dZdZdddddddd	d
ddd
dddddgZddlZddlZddlZddl	Z
ddlZddl
ZddlmZmZdZdZdZdZdZdZdZGdd�de�Zdd �ZGd!d�de�ZGd"d�de�ZGd#d	�d	e�ZGd$d�de�ZGd%d
�d
e�Z d&d'�Z!Gd(d�de"�Z#Gd)d�de"�Z$Gd*d�de�Z%Gd+d,�d,e%�Z&Gd-d.�d.e%�Z'Gd/d0�d0e'�Z(Gd1d2�d2e'�Z)Gd3d4�d4e%�Z*Gd5d6�d6e%�Z+Gd7d8�d8e%�Z,Gd9d:�d:e%�Z-Gd;d<�d<e%�Z.Gd=d>�d>e%�Z/Gd?d�de�Z0Gd@d�de�Z1GdAdB�dBe�Z2GdCdD�dDe2�Z3GdEdF�dFe3�Z4GdGd�dee2�Z5dS)Ha�
Command-line parsing library

This module is an optparse-inspired command-line parsing library that:

    - handles both optional and positional arguments
    - produces highly informative usage messages
    - supports parsers that dispatch to sub-parsers

The following is a simple usage example that sums integers from the
command-line and writes the result to a file::

    parser = argparse.ArgumentParser(
        description='sum the integers at the command line')
    parser.add_argument(
        'integers', metavar='int', nargs='+', type=int,
        help='an integer to be summed')
    parser.add_argument(
        '--log', default=sys.stdout, type=argparse.FileType('w'),
        help='the file where the sum should be written')
    args = parser.parse_args()
    args.log.write('%s' % sum(args.integers))
    args.log.close()

The module contains the following public classes:

    - ArgumentParser -- The main entry point for command-line parsing. As the
        example above shows, the add_argument() method is used to populate
        the parser with actions for optional and positional arguments. Then
        the parse_args() method is invoked to convert the args at the
        command-line into an object with attributes.

    - ArgumentError -- The exception raised by ArgumentParser objects when
        there are errors with the parser's actions. Errors raised while
        parsing the command-line are caught by ArgumentParser and emitted
        as command-line messages.

    - FileType -- A factory for defining types of files to be created. As the
        example above shows, instances of FileType are typically passed as
        the type= argument of add_argument() calls.

    - Action -- The base class for parser actions. Typically actions are
        selected by passing strings like 'store_true' or 'append_const' to
        the action= argument of add_argument(). However, for greater
        customization of ArgumentParser actions, subclasses of Action may
        be defined and passed as the action= argument.

    - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter,
        ArgumentDefaultsHelpFormatter -- Formatter classes which
        may be passed as the formatter_class= argument to the
        ArgumentParser constructor. HelpFormatter is the default,
        RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser
        not to change the formatting for help text, and
        ArgumentDefaultsHelpFormatter adds information about argument defaults
        to the help.

All other classes in this module are considered implementation details.
(Also note that HelpFormatter and RawDescriptionHelpFormatter are only
considered public as object names -- the API of the formatter objects is
still considered an implementation detail.)
z1.1�ArgumentParser�
ArgumentError�ArgumentTypeError�FileType�
HelpFormatter�ArgumentDefaultsHelpFormatter�RawDescriptionHelpFormatter�RawTextHelpFormatter�MetavarTypeHelpFormatter�	Namespace�Action�ONE_OR_MORE�OPTIONAL�PARSER�	REMAINDER�SUPPRESS�ZERO_OR_MORE�N)�gettext�ngettextz==SUPPRESS==�?�*�+zA...z...Z_unrecognized_argsc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_AttributeHolderaAbstract base class that provides __repr__.

    The __repr__ method returns a string in the format::
        ClassName(attr=name, attr=name, ...)
    The attributes are determined either by a class-level attribute,
    '_kwarg_names', or by inspecting the instance __dict__.
    cCs�t|�j}g}i}x|j�D]}|jt|��qWx8|j�D],\}}|j�r`|jd||f�q<|||<q<W|r�|jdt|��d|dj|�fS)Nz%s=%rz**%sz%s(%s)z, )�type�__name__�	_get_args�append�repr�_get_kwargs�isidentifier�join)�selfZ	type_name�arg_stringsZ	star_args�arg�name�value�r&� /usr/lib64/python3.6/argparse.py�__repr__vs
z_AttributeHolder.__repr__cCst|jj��S)N)�sorted�__dict__�items)r!r&r&r'r�sz_AttributeHolder._get_kwargscCsgS)Nr&)r!r&r&r'r�sz_AttributeHolder._get_argsN)r�
__module__�__qualname__�__doc__r(rrr&r&r&r'rmsrcCs&t||d�dkrt|||�t||�S)N)�getattr�setattr)�	namespacer$r%r&r&r'�
_ensure_value�sr2c@s�eZdZdZd;dd�Zdd�Zd	d
�ZGdd�de�Zd
d�Z	dd�Z
dd�Zdd�Zd<dd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�ZdS)=rz�Formatter for generating usage messages and argument help strings.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    ��NcCs�|dkr@yttjd�}Wnttfk
r6d}YnX|d8}||_||_||_t|t	|d|d��|_||_
d|_d|_d|_
|j|d�|_|j|_tjdtj�|_tjd�|_dS)NZCOLUMNS�Pr3�rz\s+z\n\n\n+)�int�_os�environ�KeyError�
ValueError�_prog�_indent_increment�_max_help_position�min�max�_width�_current_indent�_level�_action_max_length�_Section�
_root_section�_current_section�_re�compile�ASCII�_whitespace_matcher�_long_break_matcher)r!�progZindent_incrementZmax_help_position�widthr&r&r'�__init__�s&
zHelpFormatter.__init__cCs"|j|j7_|jd7_dS)N�)rBr=rC)r!r&r&r'�_indent�szHelpFormatter._indentcCs"|j|j8_|jd8_dS)NrP)rBr=rC)r!r&r&r'�_dedent�szHelpFormatter._dedentc@seZdZddd�Zdd�ZdS)zHelpFormatter._SectionNcCs||_||_||_g|_dS)N)�	formatter�parent�headingr+)r!rSrTrUr&r&r'rO�szHelpFormatter._Section.__init__cCs�|jdk	r|jj�|jj}|dd�|jD��}|jdk	rD|jj�|sLdS|jtk	rz|jdk	rz|jj}d|d|jf}nd}|d||dg�S)NcSsg|]\}}||��qSr&r&)�.0�func�argsr&r&r'�
<listcomp>�sz6HelpFormatter._Section.format_help.<locals>.<listcomp>�z%*s%s:
�
)	rTrSrQ�_join_partsr+rRrUrrB)r!r Z	item_helpZcurrent_indentrUr&r&r'�format_help�s



z"HelpFormatter._Section.format_help)N)rr,r-rOr]r&r&r&r'rE�s
rEcCs|jjj||f�dS)N)rGr+r)r!rWrXr&r&r'�	_add_item�szHelpFormatter._add_itemcCs0|j�|j||j|�}|j|jg�||_dS)N)rQrErGr^r])r!rUZsectionr&r&r'�
start_section�szHelpFormatter.start_sectioncCs|jj|_|j�dS)N)rGrTrR)r!r&r&r'�end_section�s
zHelpFormatter.end_sectioncCs$|tk	r |dk	r |j|j|g�dS)N)rr^�_format_text)r!�textr&r&r'�add_text�szHelpFormatter.add_textcCs&|tk	r"||||f}|j|j|�dS)N)rr^�
_format_usage)r!�usage�actions�groups�prefixrXr&r&r'�	add_usage�szHelpFormatter.add_usagecCsz|jtk	rv|j}||�g}x |j|�D]}|j||��q&Wtdd�|D��}||j}t|j|�|_|j|j	|g�dS)NcSsg|]}t|��qSr&)�len)rV�sr&r&r'rY
sz.HelpFormatter.add_argument.<locals>.<listcomp>)
�helpr�_format_action_invocation�_iter_indented_subactionsrr@rBrDr^�_format_action)r!�actionZget_invocationZinvocations�	subactionZinvocation_lengthZ
action_lengthr&r&r'�add_arguments


zHelpFormatter.add_argumentcCsx|D]}|j|�qWdS)N)rr)r!rfrpr&r&r'�
add_argumentss
zHelpFormatter.add_argumentscCs.|jj�}|r*|jjd|�}|jd�d}|S)Nz

r[)rFr]rL�sub�strip)r!rlr&r&r'r]s

zHelpFormatter.format_helpcCsdjdd�|D��S)NrZcSsg|]}|r|tk	r|�qSr&)r)rV�partr&r&r'rY!sz-HelpFormatter._join_parts.<locals>.<listcomp>)r )r!Zpart_stringsr&r&r'r\ s
zHelpFormatter._join_partscs|dkrtd�}|dk	r,|t|jd�}�n�|dkrN|rNdt|jd�}�n�|dk�rdt|jd�}g}g}x(|D] }|jr�|j|�qv|j|�qvW|j}	|	|||�}
djdd�||
gD��}|j|j�t	|�t	|��k�rd}|	||�}|	||�}
t
j||�}t
j||
�}d�fdd	�	}t	|�t	|�d
�k�r�dt	|�t	|�d}|�r�||g|||�}|j|||��n |�r�||g|||�}n|g}nZdt	|�}||}|||�}t	|�dk�r�g}|j|||��|j|||��|g|}dj|�}d
||fS)Nzusage: )rMz%(prog)s� cSsg|]}|r|�qSr&r&)rVrkr&r&r'rYAsz/HelpFormatter._format_usage.<locals>.<listcomp>z%\(.*?\)+(?=\s|$)|\[.*?\]+(?=\s|$)|\S+cs�g}g}|dk	rt|�d}nt|�d}xb|D]Z}|dt|��krp|rp|j|dj|��g}t|�d}|j|�|t|�d7}q0W|r�|j|dj|��|dk	r�|dt|�d�|d<|S)NrPrwr)rjrr )�parts�indentrh�lines�lineZline_lenrv)�
text_widthr&r'�	get_linesUs"

z.HelpFormatter._format_usage.<locals>.get_linesg�?rPr[z%s%s

)N)
�_�dictr<�option_stringsr�_format_actions_usager rArBrjrH�findall�extend)r!rerfrgrhrMZ	optionals�positionalsrp�formatZaction_usageZpart_regexpZ	opt_usageZ	pos_usageZ	opt_partsZ	pos_partsr}ryrzrxr&)r|r'rd%sV






zHelpFormatter._format_usagec
Cs�t�}i}x�|D]�}y|j|jd�}Wntk
r>wYqX|t|j�}|||�|jkrx|jD]}|j|�qhW|js�||kr�||d7<nd||<d||<n*||kr�||d7<nd||<d||<xt|d|�D]}	d	||	<q�WqWg}
�x2t|�D�]$\}	}|j	t
k�rj|
jd�|j|	�d	k�rF|j
|	�n"|j|	d�d	k�r.|j
|	d�n�|j�s�|j|�}|j||�}||k�r�|ddk�r�|ddk�r�|dd�}|
j|�nh|jd}
|jdk�r�d
|
}n"|j|�}|j||�}d|
|f}|j�r$||k�r$d|}|
j|��q
Wx(t|d
d�D]}	||	g|
|	|	�<�qBWdjdd�|
D��}d}d}tjd|d|�}tjd|d|�}tjd||fd|�}tjdd|�}|j�}|S)Nrz [�[�]z (�(�)rP�|z%sz%s %sz[%s]T)�reverserwcSsg|]}|dk	r|�qS)Nr&)rV�itemr&r&r'rY�sz7HelpFormatter._format_actions_usage.<locals>.<listcomp>z[\[(]z[\])]z(%s) z\1z (%s)z%s *%srZz\(([^|]*)\)���r�)�set�index�_group_actionsr;rj�add�required�range�	enumeraterlrr�get�popr��#_get_default_metavar_for_positional�_format_args�nargs�!_get_default_metavar_for_optionalr)r rHrtru)r!rfrg�
group_actionsZinserts�group�start�endrp�irx�defaultrv�
option_string�args_stringrb�open�closer&r&r'r��sr







z#HelpFormatter._format_actions_usagecCsFd|kr|t|jd�}t|j|jd�}d|j}|j|||�dS)Nz%(prog))rM�rwz

)rr<r@rArB�
_fill_text)r!rbr|ryr&r&r'ra�s

zHelpFormatter._format_textc
CsBt|jd|j�}t|j|d�}||jd}|j|�}|jsV|jd|f}d|}n@t|�|kr~|jd||f}d|}d}n|jd|f}d|}|}|g}|jr�|j	|�}	|j
|	|�}
|jd|d|
df�x@|
dd�D]}|jd|d|f�q�Wn|jd��s|jd�x$|j
|�D]}|j|j|���qW|j|�S)	Nr3r�rZz%*s%s
z	%*s%-*s  rrPr[)r?rDr>r@rArBrmrlrj�_expand_help�_split_linesr�endswithrnror\)
r!rpZ
help_positionZ
help_widthZaction_widthZ
action_header�tupZindent_firstrxZ	help_textZ
help_linesr{rqr&r&r'ro�s6




zHelpFormatter._format_actioncCs�|js&|j|�}|j||�d�\}|Sg}|jdkrB|j|j�n8|j|�}|j||�}x |jD]}|jd||f�q`Wdj|�SdS)NrPrz%s %sz, )	r�r��_metavar_formatterr�r�r�r�rr )r!rpr��metavarrxr�r�r&r&r'rms


z'HelpFormatter._format_action_invocationcsP|jdk	r|j�n.|jdk	r<dd�|jD�}ddj|��n|��fdd�}|S)NcSsg|]}t|��qSr&)�str)rVZchoicer&r&r'rY8sz4HelpFormatter._metavar_formatter.<locals>.<listcomp>z{%s}�,cst�t�r�S�f|SdS)N)�
isinstance�tuple)Z
tuple_size)�resultr&r'r�=s
z0HelpFormatter._metavar_formatter.<locals>.format)r��choicesr )r!rp�default_metavarZchoice_strsr�r&)r�r'r�4s

z HelpFormatter._metavar_formattercCs�|j||�}|jdkr$d|d�}n�|jtkr<d|d�}n�|jtkrTd|d�}nh|jtkrld|d�}nP|jtkr|d}n@|jtkr�d|d�}n(d	d
�t|j�D�}dj|�||j�}|S)Nz%srPz[%s]z
[%s [%s ...]]r3z%s [%s ...]z...z%s ...cSsg|]}d�qS)z%sr&)rVr~r&r&r'rYSsz.HelpFormatter._format_args.<locals>.<listcomp>rw)	r�r�r
rrrrr�r )r!rpr�Zget_metavarr�Zformatsr&r&r'r�Ds 





zHelpFormatter._format_argscCs�tt|�|jd�}x"t|�D]}||tkr||=qWx,t|�D] }t||d�r@||j||<q@W|jd�dk	r�djdd�|dD��}||d<|j	|�|S)N)rMrr�z, cSsg|]}t|��qSr&)r�)rV�cr&r&r'rY`sz.HelpFormatter._expand_help.<locals>.<listcomp>)
r�varsr<�listr�hasattrrr�r �_get_help_string)r!rpZparamsr$Zchoices_strr&r&r'r�Ws
zHelpFormatter._expand_helpccs@y
|j}Wntk
rYnX|j�|�EdH|j�dS)N)�_get_subactions�AttributeErrorrQrR)r!rpZget_subactionsr&r&r'rnds
z'HelpFormatter._iter_indented_subactionscCs|jjd|�j�}tj||�S)Nrw)rKrtru�	_textwrapZwrap)r!rbrNr&r&r'r�nszHelpFormatter._split_linescCs$|jjd|�j�}tj||||d�S)Nrw)Zinitial_indentZsubsequent_indent)rKrtrur�Zfill)r!rbrNryr&r&r'r�rs
zHelpFormatter._fill_textcCs|jS)N)rl)r!rpr&r&r'r�wszHelpFormatter._get_help_stringcCs
|jj�S)N)�dest�upper)r!rpr&r&r'r�zsz/HelpFormatter._get_default_metavar_for_optionalcCs|jS)N)r�)r!rpr&r&r'r�}sz1HelpFormatter._get_default_metavar_for_positional)r3r4N)N) rr,r-r.rOrQrR�objectrEr^r_r`rcrirrrsr]r\rdr�rarormr�r�r�rnr�r�r�r�r�r&r&r&r'r�s<

`a/

c@seZdZdZdd�ZdS)rz�Help message formatter which retains any formatting in descriptions.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cs dj�fdd�|jdd�D��S)NrZc3s|]}�|VqdS)Nr&)rVr{)ryr&r'�	<genexpr>�sz9RawDescriptionHelpFormatter._fill_text.<locals>.<genexpr>T)�keepends)r �
splitlines)r!rbrNryr&)ryr'r��sz&RawDescriptionHelpFormatter._fill_textN)rr,r-r.r�r&r&r&r'r�sc@seZdZdZdd�ZdS)rz�Help message formatter which retains formatting of all help text.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCs|j�S)N)r�)r!rbrNr&r&r'r��sz!RawTextHelpFormatter._split_linesN)rr,r-r.r�r&r&r&r'r�sc@seZdZdZdd�ZdS)rz�Help message formatter which adds default values to argument help.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCs>|j}d|jkr:|jtk	r:ttg}|js2|j|kr:|d7}|S)Nz
%(default)z (default: %(default)s))rlr�rr
rr�r�)r!rprlZdefaulting_nargsr&r&r'r��s

z.ArgumentDefaultsHelpFormatter._get_help_stringN)rr,r-r.r�r&r&r&r'r�sc@s eZdZdZdd�Zdd�ZdS)r	aHelp message formatter which uses the argument 'type' as the default
    metavar value (instead of the argument 'dest')

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCs|jjS)N)rr)r!rpr&r&r'r��sz:MetavarTypeHelpFormatter._get_default_metavar_for_optionalcCs|jjS)N)rr)r!rpr&r&r'r��sz<MetavarTypeHelpFormatter._get_default_metavar_for_positionalN)rr,r-r.r�r�r&r&r&r'r	�scCsN|dkrdS|jrdj|j�S|jdtfkr2|jS|jdtfkrF|jSdSdS)N�/)r�r r�rr�)�argumentr&r&r'�_get_action_name�sr�c@s eZdZdZdd�Zdd�ZdS)rz�An error from creating or using an argument (optional or positional).

    The string value of this exception is the message, augmented with
    information about the argument that caused it.
    cCst|�|_||_dS)N)r��
argument_name�message)r!r�r�r&r&r'rO�s
zArgumentError.__init__cCs(|jdkrd}nd}|t|j|jd�S)Nz%(message)sz'argument %(argument_name)s: %(message)s)r�r�)r�rr�)r!r�r&r&r'�__str__�s

zArgumentError.__str__N)rr,r-r.rOr�r&r&r&r'r�sc@seZdZdZdS)rz@An error from trying to convert a command line string to a type.N)rr,r-r.r&r&r&r'r�sc@s,eZdZdZd
dd�Zdd�Zddd	�ZdS)ra\	Information about how to convert command line strings to Python objects.

    Action objects are used by an ArgumentParser to represent the information
    needed to parse a single argument from one or more strings from the
    command line. The keyword arguments to the Action constructor are also
    all attributes of Action instances.

    Keyword Arguments:

        - option_strings -- A list of command-line option strings which
            should be associated with this action.

        - dest -- The name of the attribute to hold the created object(s)

        - nargs -- The number of command-line arguments that should be
            consumed. By default, one argument will be consumed and a single
            value will be produced.  Other values include:
                - N (an integer) consumes N arguments (and produces a list)
                - '?' consumes zero or one arguments
                - '*' consumes zero or more arguments (and produces a list)
                - '+' consumes one or more arguments (and produces a list)
            Note that the difference between the default and nargs=1 is that
            with the default, a single value will be produced, while with
            nargs=1, a list containing a single value will be produced.

        - const -- The value to be produced if the option is specified and the
            option uses an action that takes no values.

        - default -- The value to be produced if the option is not specified.

        - type -- A callable that accepts a single string argument, and
            returns the converted value.  The standard Python types str, int,
            float, and complex are useful examples of such callables.  If None,
            str is used.

        - choices -- A container of values that should be allowed. If not None,
            after a command-line argument has been converted to the appropriate
            type, an exception will be raised if it is not a member of this
            collection.

        - required -- True if the action must always be specified at the
            command line. This is only meaningful for optional command-line
            arguments.

        - help -- The help string describing the argument.

        - metavar -- The name to be used for the option's argument with the
            help string. If None, the 'dest' value will be used as the name.
    NFcCs@||_||_||_||_||_||_||_||_|	|_|
|_	dS)N)
r�r�r��constr�rr�r�rlr�)r!r�r�r�r�r�rr�r�rlr�r&r&r'rOszAction.__init__c	s(ddddddddd	g	}�fd
d�|D�S)Nr�r�r�r�r�rr�rlr�csg|]}|t�|�f�qSr&)r/)rVr$)r!r&r'rY;sz&Action._get_kwargs.<locals>.<listcomp>r&)r!�namesr&)r!r'r/szAction._get_kwargscCsttd���dS)Nz.__call__() not defined)�NotImplementedErrorr~)r!�parserr1�valuesr�r&r&r'�__call__=szAction.__call__)NNNNNFNN)N)rr,r-r.rOrr�r&r&r&r'r�s1
cs(eZdZd�fdd�	Zddd�Z�ZS)	�_StoreActionNFcsT|dkrtd��|dk	r,|tkr,tdt��tt|�j|||||||||	|
d�
dS)Nrz�nargs for store actions must be > 0; if you have nothing to store, actions such as store true or store const may be more appropriatez nargs must be %r to supply const)
r�r�r�r�r�rr�r�rlr�)r;r
�superr�rO)r!r�r�r�r�r�rr�r�rlr�)�	__class__r&r'rOCs
z_StoreAction.__init__cCst||j|�dS)N)r0r�)r!r�r1r�r�r&r&r'r�`sz_StoreAction.__call__)NNNNNFNN)N)rr,r-rOr��
__classcell__r&r&)r�r'r�Asr�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_StoreConstActionNFc	s"tt|�j||d||||d�dS)Nr)r�r�r�r�r�r�rl)r�r�rO)r!r�r�r�r�r�rlr�)r�r&r'rOfs
z_StoreConstAction.__init__cCst||j|j�dS)N)r0r�r�)r!r�r1r�r�r&r&r'r�wsz_StoreConstAction.__call__)NFNN)N)rr,r-rOr�r�r&r&)r�r'r�ds

r�cseZdZd�fdd�	Z�ZS)�_StoreTrueActionFNcs tt|�j||d|||d�dS)NT)r�r�r�r�r�rl)r�r�rO)r!r�r�r�r�rl)r�r&r'rO}s
z_StoreTrueAction.__init__)FFN)rr,r-rOr�r&r&)r�r'r�{sr�cseZdZd�fdd�	Z�ZS)�_StoreFalseActionTFNcs tt|�j||d|||d�dS)NF)r�r�r�r�r�rl)r�r�rO)r!r�r�r�r�rl)r�r&r'rO�s
z_StoreFalseAction.__init__)TFN)rr,r-rOr�r&r&)r�r'r��sr�cs(eZdZd�fdd�	Zddd�Z�ZS)	�
_AppendActionNFcsT|dkrtd��|dk	r,|tkr,tdt��tt|�j|||||||||	|
d�
dS)Nrz�nargs for append actions must be > 0; if arg strings are not supplying the value to append, the append const action may be more appropriatez nargs must be %r to supply const)
r�r�r�r�r�rr�r�rlr�)r;r
r�r�rO)r!r�r�r�r�r�rr�r�rlr�)r�r&r'rO�s
z_AppendAction.__init__cCs0tjt||jg��}|j|�t||j|�dS)N)�_copy�copyr2r�rr0)r!r�r1r�r�r+r&r&r'r��s
z_AppendAction.__call__)NNNNNFNN)N)rr,r-rOr�r�r&r&)r�r'r��sr�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_AppendConstActionNFc
s$tt|�j||d|||||d�dS)Nr)r�r�r�r�r�r�rlr�)r�r�rO)r!r�r�r�r�r�rlr�)r�r&r'rO�s
z_AppendConstAction.__init__cCs2tjt||jg��}|j|j�t||j|�dS)N)r�r�r2r�rr�r0)r!r�r1r�r�r+r&r&r'r��sz_AppendConstAction.__call__)NFNN)N)rr,r-rOr�r�r&r&)r�r'r��s
r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_CountActionNFcs tt|�j||d|||d�dS)Nr)r�r�r�r�r�rl)r�r�rO)r!r�r�r�r�rl)r�r&r'rO�s
z_CountAction.__init__cCs$t||jd�d}t||j|�dS)NrrP)r2r�r0)r!r�r1r�r�Z	new_countr&r&r'r��sz_CountAction.__call__)NFN)N)rr,r-rOr�r�r&r&)r�r'r��s	r�cs.eZdZeedf�fdd�	Zddd�Z�ZS)�_HelpActionNcstt|�j|||d|d�dS)Nr)r�r�r�r�rl)r�r�rO)r!r�r�r�rl)r�r&r'rO�s
z_HelpAction.__init__cCs|j�|j�dS)N)�
print_help�exit)r!r�r1r�r�r&r&r'r��sz_HelpAction.__call__)N)rr,r-rrOr�r�r&r&)r�r'r��sr�cs0eZdZdeedf�fdd�	Zddd�Z�ZS)�_VersionActionNz&show program's version number and exitcs$tt|�j|||d|d�||_dS)Nr)r�r�r�r�rl)r�r�rO�version)r!r�r�r�r�rl)r�r&r'rOs
z_VersionAction.__init__cCsD|j}|dkr|j}|j�}|j|�|j|j�tj�|j�dS)N)r��_get_formatterrc�_print_messager]�_sys�stdoutr�)r!r�r1r�r�r�rSr&r&r'r�s
z_VersionAction.__call__)N)rr,r-rrOr�r�r&r&)r�r'r�s
	r�csNeZdZGdd�de�Zeddf�fdd�	Zdd�Zdd	�Zdd
d�Z	�Z
S)
�_SubParsersActioncseZdZ�fdd�Z�ZS)z&_SubParsersAction._ChoicesPseudoActioncs@|}}|r|ddj|�7}ttj|�}|jg|||d�dS)Nz (%s)z, )r�r�rlr�)r r�r��_ChoicesPseudoActionrO)r!r$�aliasesrlr�r�Zsup)r�r&r'rO"s
z/_SubParsersAction._ChoicesPseudoAction.__init__)rr,r-rOr�r&r&)r�r'r� sr�Ncs>||_||_tj�|_g|_tt|�j||t	|j||d�dS)N)r�r�r�r�rlr�)
�_prog_prefix�
_parser_class�_collections�OrderedDict�_name_parser_map�_choices_actionsr�r�rOr)r!r�rM�parser_classr�rlr�)r�r&r'rO*s

z_SubParsersAction.__init__cKs�|jd�dkr d|j|f|d<|jdf�}d|krX|jd�}|j|||�}|jj|�|jf|�}||j|<x|D]}||j|<qtW|S)NrMz%s %sr�rl)r�r�r�r�r�rr�r�)r!r$�kwargsr�rlZ
choice_actionr��aliasr&r&r'�
add_parser?s


z_SubParsersAction.add_parsercCs|jS)N)r�)r!r&r&r'r�Vsz!_SubParsersAction._get_subactionsc
Cs�|d}|dd�}|jtk	r,t||j|�y|j|}Wn<tk
rv|dj|j�d�}td�|}t||��YnX|j|d�\}	}x$t	|	�j
�D]\}
}t||
|�q�W|r�t	|�jtg�t
|t�j|�dS)NrrPz, )�parser_namer�z5unknown parser %(parser_name)r (choices: %(choices)s))r�rr0r�r:r r~r�parse_known_argsr�r+�
setdefault�_UNRECOGNIZED_ARGS_ATTRr/r�)r!r�r1r�r�r�r"rX�msgZsubnamespace�keyr%r&r&r'r�Ys"
	z_SubParsersAction.__call__)N)rr,r-rr�rrOr�r�r�r�r&r&)r�r'r�sr�c@s*eZdZdZddd�Zdd�Zd	d
�ZdS)
ra�Factory for creating file object types

    Instances of FileType are typically passed as type= arguments to the
    ArgumentParser add_argument() method.

    Keyword Arguments:
        - mode -- A string indicating how the file is to be opened. Accepts the
            same values as the builtin open() function.
        - bufsize -- The file's desired buffer size. Accepts the same values as
            the builtin open() function.
        - encoding -- The file's encoding. Accepts the same values as the
            builtin open() function.
        - errors -- A string indicating how encoding and decoding errors are to
            be handled. Accepts the same value as the builtin open() function.
    �rrPNcCs||_||_||_||_dS)N)�_mode�_bufsize�	_encoding�_errors)r!�mode�bufsize�encoding�errorsr&r&r'rO�szFileType.__init__cCs�|dkr>d|jkrtjSd|jkr(tjStd�|j}t|��yt||j|j|j|j	�St
k
r�}ztd�}t|||f��WYdd}~XnXdS)N�-r��wzargument "-" with mode %rzcan't open '%s': %s)r�r��stdinr�r~r;r�r�r�r��OSErrorr)r!�stringr��er�r&r&r'r��s

zFileType.__call__cCsT|j|jf}d|jfd|jfg}djdd�|D�dd�|D��}dt|�j|fS)Nr�r�z, cSsg|]}|dkrt|��qS)rPr�)r)rVr#r&r&r'rY�sz%FileType.__repr__.<locals>.<listcomp>cSs$g|]\}}|dk	rd||f�qS)Nz%s=%rr&)rV�kwr#r&r&r'rY�sz%s(%s))r�r�r�r�r rr)r!rXr�Zargs_strr&r&r'r(�s
zFileType.__repr__r�)r�r�NN)rr,r-r.rOr�r(r&r&r&r'r~s
c@s(eZdZdZdd�Zdd�Zdd�ZdS)	r
z�Simple object for storing attributes.

    Implements equality by attribute names and values, and provides a simple
    string representation.
    cKs"x|D]}t||||�qWdS)N)r0)r!r�r$r&r&r'rO�s
zNamespace.__init__cCst|t�stSt|�t|�kS)N)r�r
�NotImplementedr�)r!�otherr&r&r'�__eq__�s
zNamespace.__eq__cCs
||jkS)N)r*)r!r�r&r&r'�__contains__�szNamespace.__contains__N)rr,r-r.rOrr	r&r&r&r'r
�scs�eZdZ�fdd�Zdd�Zd&dd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd'dd�Zdd�Zd d!�Zd"d#�Zd$d%�Z�ZS)(�_ActionsContainercstt|�j�||_||_||_||_i|_|jddt	�|jddt	�|jddt
�|jddt�|jddt�|jddt
�|jddt�|jddt�|jdd	t�|jdd
t�|jddt�|j�g|_i|_g|_g|_i|_tjd�|_g|_dS)
NrpZstoreZstore_const�
store_trueZstore_falserZappend_const�countrlr��parsersz^-\d+$|^-\d*\.\d+$)r�r
rO�description�argument_default�prefix_chars�conflict_handler�_registries�registerr�r�r�r�r�r�r�r�r�r��_get_handler�_actions�_option_string_actions�_action_groups�_mutually_exclusive_groups�	_defaultsrHrI�_negative_number_matcher�_has_negative_number_optionals)r!rrrr)r�r&r'rO�s2z_ActionsContainer.__init__cCs|jj|i�}|||<dS)N)rr�)r!�
registry_namer%r��registryr&r&r'r�sz_ActionsContainer.registerNcCs|j|j||�S)N)rr�)r!rr%r�r&r&r'�
_registry_getsz_ActionsContainer._registry_getcKs6|jj|�x$|jD]}|j|kr||j|_qWdS)N)r�updaterr�r�)r!r�rpr&r&r'�set_defaultss
z_ActionsContainer.set_defaultscCs8x(|jD]}|j|kr|jdk	r|jSqW|jj|d�S)N)rr�r�rr�)r!r�rpr&r&r'�get_defaults
z_ActionsContainer.get_defaultcOs0|j}|s(t|�dkrJ|dd|krJ|r<d|kr<td��|j||�}n|j||�}d|kr�|d}||jkr�|j||d<n|jdk	r�|j|d<|j|�}t|�s�td|f��|f|�}|j	d|j
|j
�}t|�s�td	|f��t|d
��r&y|j�j
|d�Wntk
�r$td��YnX|j|�S)z�
        add_argument(dest, ..., name=value, ...)
        add_argument(option_string, option_string, ..., name=value, ...)
        rPrr�z+dest supplied twice for positional argumentr�Nzunknown action "%s"rz%r is not callabler�z,length of metavar tuple does not match nargs)rrjr;�_get_positional_kwargs�_get_optional_kwargsrr�_pop_action_class�callablerrr�r�r��	TypeError�_add_action)r!rXr��charsr�Zaction_classrp�	type_funcr&r&r'rrs2	"




z_ActionsContainer.add_argumentcOs t|f|�|�}|jj|�|S)N)�_ArgumentGrouprr)r!rXr�r�r&r&r'�add_argument_groupJsz$_ActionsContainer.add_argument_groupcKst|f|�}|jj|�|S)N)�_MutuallyExclusiveGrouprr)r!r�r�r&r&r'�add_mutually_exclusive_groupOsz._ActionsContainer.add_mutually_exclusive_groupcCsh|j|�|jj|�||_x|jD]}||j|<q$Wx,|jD]"}|jj|�r>|js>|jjd�q>W|S)NT)	�_check_conflictrr�	containerr�rr�matchr)r!rpr�r&r&r'r'Ts
z_ActionsContainer._add_actioncCs|jj|�dS)N)r�remove)r!rpr&r&r'�_remove_actionisz _ActionsContainer._remove_actioncCs�i}x8|jD].}|j|kr0td�}t||j��|||j<qWi}xR|jD]H}|j|krt|j|j|j|jd�||j<x|jD]}||j||<q|WqJWx4|jD]*}|j	|j
d�}x|jD]}|||<q�Wq�Wx |jD]}|j||�j
|�q�WdS)Nz.cannot merge actions - two groups are named %r)�titlerr)r�)rr3r~r;r+rrr�rr-r�rr�r')r!r/Ztitle_group_mapr�r�Z	group_maprp�mutex_groupr&r&r'�_add_container_actionsls,


z(_ActionsContainer._add_container_actionscKs^d|krtd�}t|��|jd�ttgkr2d|d<|jd�tkrPd|krPd|d<t||gd�S)Nr�z1'required' is an invalid argument for positionalsr�Tr�)r�r�)r~r&r�r
rr)r!r�r�r�r&r&r'r"�sz(_ActionsContainer._get_positional_kwargsc	Os�g}g}xv|D]n}|d|jkr@||jd�}td�}t||��|j|�|d|jkrt|�dkr|d|jkr|j|�qW|jdd�}|dkr�|r�|d}n|d}|j|j�}|s�td�}t||��|jdd�}t|||d	�S)
Nr)�optionrzNinvalid option string %(option)r: must start with a character %(prefix_chars)rrPr�z%dest= is required for options like %rr�r~)r�r�)	rr~r;rrjr��lstrip�replacer)	r!rXr�r�Zlong_option_stringsr�r�r�Zdest_option_stringr&r&r'r#�s0



z&_ActionsContainer._get_optional_kwargscCs|jd|�}|jd||�S)Nrp)r�r)r!r�r�rpr&r&r'r$�sz#_ActionsContainer._pop_action_classcCsDd|j}y
t||�Stk
r>td�}t||j��YnXdS)Nz_handle_conflict_%sz%invalid conflict_resolution value: %r)rr/r�r~r;)r!Zhandler_func_namer�r&r&r'r�s

z_ActionsContainer._get_handlercCsPg}x0|jD]&}||jkr|j|}|j||f�qW|rL|j�}|||�dS)N)r�rrr)r!rpZconfl_optionalsr�Zconfl_optionalrr&r&r'r.�s

z!_ActionsContainer._check_conflictcCs6tddt|��}djdd�|D��}t|||��dS)Nzconflicting option string: %szconflicting option strings: %sz, cSsg|]\}}|�qSr&r&)rVr�rpr&r&r'rY�sz<_ActionsContainer._handle_conflict_error.<locals>.<listcomp>)rrjr r)r!rp�conflicting_actionsr�Zconflict_stringr&r&r'�_handle_conflict_error�s


z(_ActionsContainer._handle_conflict_errorcCsBx<|D]4\}}|jj|�|jj|d�|js|jj|�qWdS)N)r�r1rr�r/r2)r!rpr9r�r&r&r'�_handle_conflict_resolve�s
z*_ActionsContainer._handle_conflict_resolve)N)N)rr,r-rOrrr r!rrr+r-r'r2r5r"r#r$rr.r:r;r�r&r&)r�r'r
�s$4
	
/($
		r
cs6eZdZd�fdd�	Z�fdd�Z�fdd�Z�ZS)	r*Ncs�|j}|d|j�|d|j�|d|j�tt|�j}|fd|i|��||_g|_|j	|_	|j
|_
|j|_|j|_|j
|_
|j|_dS)Nrrrr)r�rrrr�r*rOr3r�rrrrrr)r!r/r3rr�rZ
super_init)r�r&r'rO�sz_ArgumentGroup.__init__cs tt|�j|�}|jj|�|S)N)r�r*r'r�r)r!rp)r�r&r'r'sz_ArgumentGroup._add_actioncs tt|�j|�|jj|�dS)N)r�r*r2r�r1)r!rp)r�r&r'r2sz_ArgumentGroup._remove_action)NN)rr,r-rOr'r2r�r&r&)r�r'r*�sr*cs.eZdZd�fdd�	Zdd�Zdd�Z�ZS)	r,Fcs tt|�j|�||_||_dS)N)r�r,rOr��
_container)r!r/r�)r�r&r'rOsz _MutuallyExclusiveGroup.__init__cCs2|jrtd�}t|��|jj|�}|jj|�|S)Nz-mutually exclusive arguments must be optional)r�r~r;r<r'r�r)r!rpr�r&r&r'r'$sz#_MutuallyExclusiveGroup._add_actioncCs|jj|�|jj|�dS)N)r<r2r�r1)r!rpr&r&r'r2,sz&_MutuallyExclusiveGroup._remove_action)F)rr,r-rOr'r2r�r&r&)r�r'r,sr,cseZdZdZddddgeddddddf�fdd�	Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
d=dd�Zd>dd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd?d2d3�Zd@d4d5�ZdAd6d7�ZdBd9d:�Zd;d<�Z�Z S)Cra�Object for parsing command line strings into Python objects.

    Keyword Arguments:
        - prog -- The name of the program (default: sys.argv[0])
        - usage -- A usage message (default: auto-generated from arguments)
        - description -- A description of what the program does
        - epilog -- Text following the argument descriptions
        - parents -- Parsers whose arguments should be copied into this one
        - formatter_class -- HelpFormatter class for printing help messages
        - prefix_chars -- Characters that prefix optional arguments
        - fromfile_prefix_chars -- Characters that prefix files containing
            additional arguments
        - argument_default -- The default value for all arguments
        - conflict_handler -- String indicating how to handle conflicts
        - add_help -- Add a -h/-help option
        - allow_abbrev -- Allow long options to be abbreviated unambiguously
    Nr��errorTc
s&tt|�j}
|
|||	|
d�|dkr6tjjtjd�}||_||_	||_
||_||_||_
||_|j}|td��|_|td��|_d|_dd�}|jdd|�d|kr�dn|d}|j
r�|j|d	|d
ddttd�d
�xD|D]<}|j|�y
|j}Wntk
�rYq�X|jj|�q�WdS)N)rrrrrzpositional argumentszoptional argumentscSs|S)Nr&)rr&r&r'�identityjsz)ArgumentParser.__init__.<locals>.identityrr��hr3rlzshow this help message and exit)rpr�rl)r�rrOr8�path�basenamer��argvrMre�epilog�formatter_class�fromfile_prefix_chars�add_help�allow_abbrevr+r~�_positionals�
_optionals�_subparsersrrrrr5rr�r)r!rMrerrC�parentsrDrrErrrFrGZ	superinitZ	add_groupr>Zdefault_prefixrTZdefaults)r�r&r'rODsB


zArgumentParser.__init__cs"ddddddg}�fdd�|D�S)	NrMrerrDrrFcsg|]}|t�|�f�qSr&)r/)rVr$)r!r&r'rY�sz.ArgumentParser._get_kwargs.<locals>.<listcomp>r&)r!r�r&)r!r'r�szArgumentParser._get_kwargsc	Ks�|jdk	r|jtd��|jdt|��d|ks8d|krht|jdd��}t|jdd��}|j||�|_n|j|_|jd�dkr�|j	�}|j
�}|j}|j|j
||d�|j�j�|d<|j|d�}|fd	gi|��}|jj|�|S)
Nz(cannot have multiple subparser argumentsr�r3rZsubcommandsrMrZr
r�)rJr=r~r�rr�r+rHr�r��_get_positional_actionsrrirer]rur$r')	r!r�r3rrSr�rgZ
parsers_classrpr&r&r'�add_subparsers�s$
zArgumentParser.add_subparserscCs$|jr|jj|�n|jj|�|S)N)r�rIr'rH)r!rpr&r&r'r'�szArgumentParser._add_actioncCsdd�|jD�S)NcSsg|]}|jr|�qSr&)r�)rVrpr&r&r'rY�sz8ArgumentParser._get_optional_actions.<locals>.<listcomp>)r)r!r&r&r'�_get_optional_actions�sz$ArgumentParser._get_optional_actionscCsdd�|jD�S)NcSsg|]}|js|�qSr&)r�)rVrpr&r&r'rY�sz:ArgumentParser._get_positional_actions.<locals>.<listcomp>)r)r!r&r&r'rL�sz&ArgumentParser._get_positional_actionscCs4|j||�\}}|r0td�}|j|dj|��|S)Nzunrecognized arguments: %srw)r�r~r=r )r!rXr1rBr�r&r&r'�
parse_args�s
zArgumentParser.parse_argscCs|dkrtjdd�}nt|�}|dkr.t�}x>|jD]4}|jtk	r6t||j�s6|jtk	r6t	||j|j�q6Wx*|j
D] }t||�svt	|||j
|�qvWy<|j||�\}}t|t�r�|j
t|t��t|t�||fStk
�rtj�d}|jt|��YnXdS)NrP)r�rBr�r
rr�rr�r�r0r�_parse_known_argsr�r�r/�delattrr�exc_infor=r�)r!rXr1rpr��errr&r&r'r��s,




zArgumentParser.parse_known_argscs"�	jdk	r�	j���i�x`�	jD]V}|j}xJt|j�D]<\}}�j|g�}|j|d|��|j||dd��q6Wq Wi�g}t��}	xnt|	�D]b\}}
|
dkr�|jd�xF|	D]}
|jd�q�Wq��	j	|
�}|dkr�d}n|�|<d}|j|�q�Wdj
|��t��t��d�����	fdd�	������	�fd	d
�}
�	j������	�fdd�}g�d
�
��rpt
��}nd}x|�
|k�r�t�
fdd��D��}�
|k�r�|�
�}|�
k�r�|�
�qvn|�
�
�k�r��
|�}�j|�|�
|
�
��
�qvW|�
�}�j�|d��g}x��	jD]|}|�k�r|j�r>|jt|��nT|jdk	�rt|jt��rt�|j��r|jt�|j�k�rt�|j�	j||j���qW|�r��	jtd�dj
|��xb�	jD]X}|j�r�xH|jD]}|�k�r�P�q�Wdd�|jD�}td�}�	j|dj
|���q�W��fS)NrPz--r��A�OrZcs��j|��j||�}||jk	rf�j|�x:�j|g�D]*}|�kr8td�}t|�}t|||��q8W|tk	r||��||�dS)Nznot allowed with argument %s)r��_get_valuesr�r�r~r�rr)rpZargument_stringsr�Zargument_valuesZconflict_actionr�Zaction_name)�action_conflictsr1�seen_actions�seen_non_default_actionsr!r&r'�take_actions


z5ArgumentParser._parse_known_args.<locals>.take_actioncs��|}|\}}}�j}g}�x>|dkr>�j�|�|dS|dk	�r||d�}�j}|dkr�|d|kr�|j|g|f�|d}	|	|d}|dd�p�d}
�j}||kr�||}|
}ntd�}t|||��n@|dkr�|d}
|g}|j|||f�Pntd�}t|||��q |d}�|d�}|||�}||}
�||
�}|j|||f�Pq Wx |D]\}}}�|||��qdW|
S)NrPrTrzignored explicit argument %r)�_match_argumentrrrr~r)�start_index�option_tuplerpr��explicit_argZmatch_argumentZ
action_tuples�	arg_countr(�charZnew_explicit_argZ
optionals_mapr��stoprXr�Zselected_patterns)r"�arg_strings_pattern�extras�option_string_indicesr!rZr&r'�consume_optional3sN



z:ArgumentParser._parse_known_args.<locals>.consume_optionalcsr�j}�|d�}|�|�}x8t�|�D]*\}}�|||�}||7}�||�q(W�t|�d��dd�<|S)N)�_match_arguments_partial�ziprj)r\Z
match_partialZselected_patternZ
arg_countsrpr_rX)r"rbr�r!rZr&r'�consume_positionals�s
z=ArgumentParser._parse_known_args.<locals>.consume_positionalsrcsg|]}|�kr|�qSr&r&)rVr�)r\r&r'rY�sz4ArgumentParser._parse_known_args.<locals>.<listcomp>z(the following arguments are required: %sz, cSsg|]}|jtk	rt|��qSr&)rlrr�)rVrpr&r&r'rY�sz#one of the arguments %s is requiredrw)Nr�)rE�_read_args_from_filesrr�r�r�r��iterr�_parse_optionalr r�rLr@r?rr�r�r�r�r�r�r�r/r0�
_get_valuer=r~)r!r"r1r4r�r�Zmutex_actionZ	conflictsZarg_string_pattern_partsZarg_strings_iter�
arg_stringr]�patternrerhZmax_option_string_indexZnext_option_string_indexZpositionals_end_indexZstringsZ
stop_indexZrequired_actionsrpr�r�r�r&)rWr"rbrcr1rdr�rXrYr!r\rZr'rP�s�





J










z ArgumentParser._parse_known_argscCs�g}x�|D]�}|s"|d|jkr.|j|�q
ylt|dd���R}g}x2|j�j�D]"}x|j|�D]}|j|�qdWqTW|j|�}|j|�WdQRXWq
tk
r�t	j
�d}|jt|��Yq
Xq
W|S)NrrP)
rErr��readr��convert_arg_line_to_argsrir�rr�rRr=r�)r!r"Znew_arg_stringsrmZ	args_file�arg_liner#rSr&r&r'ri�s 

z$ArgumentParser._read_args_from_filescCs|gS)Nr&)r!rqr&r&r'rp�sz'ArgumentParser.convert_arg_line_to_argscCst|j|�}tj||�}|dkrfdtd�ttd�ttd�i}tdd|j�|j}|j|j|�}t	||��t
|jd��S)Nzexpected one argumentzexpected at most one argumentzexpected at least one argumentzexpected %s argumentzexpected %s argumentsrP)�_get_nargs_patternrHr0r~r
rrr�r�rrjr�)r!rprb�
nargs_patternr0Znargs_errorsr�r�r&r&r'r[s

zArgumentParser._match_argumentcstg}xjtt|�dd�D]V}|d|�}dj�fdd�|D��}tj||�}|dk	r|jdd�|j�D��PqW|S)NrrPrZcsg|]}�j|��qSr&)rr)rVrp)r!r&r'rYsz;ArgumentParser._match_arguments_partial.<locals>.<listcomp>cSsg|]}t|��qSr&)rj)rVrr&r&r'rY!sr�)r�rjr rHr0r�rg)r!rfrbr�r�Z
actions_slicernr0r&)r!r'rfs
z'ArgumentParser._match_arguments_partialc
Cs|sdS|d|jkrdS||jkr8|j|}||dfSt|�dkrHdSd|kr~|jdd�\}}||jkr~|j|}|||fS|jr�|j|�}t|�dkr�djdd�|D��}||d�}td�}|j||�nt|�dkr�|\}	|	S|j	j
|��r|j�sdSd	|k�rdSd|dfS)
NrrP�=z, cSsg|]\}}}|�qSr&r&)rVrpr�r^r&r&r'rYGsz2ArgumentParser._parse_optional.<locals>.<listcomp>)r6Zmatchesz4ambiguous option: %(option)s could match %(matches)srw)rrrj�splitrG�_get_option_tuplesr r~r=rr0r)
r!rmrpr�r^Z
option_tuplesZoptionsrXr�r]r&r&r'rk's>










zArgumentParser._parse_optionalc
Cs0g}|j}|d|kr~|d|kr~d|kr<|jdd�\}}n|}d}x�|jD],}|j|�rL|j|}|||f}|j|�qLWn�|d|ko�|d|k�r|}d}|dd�}|dd�}	xr|jD]T}||kr�|j|}|||	f}|j|�q�|j|�r�|j|}|||f}|j|�q�Wn|jtd�|�|S)NrrPrtr3zunexpected option string: %s)rrur�
startswithrr=r~)
r!r�r�r(Z
option_prefixr^rpr�Zshort_option_prefixZshort_explicit_argr&r&r'rvbs8







z!ArgumentParser._get_option_tuplescCs�|j}|dkrd}nX|tkr"d}nJ|tkr0d}n<|tkr>d}n.|tkrLd}n |tkrZd}nddjd	|�}|jr�|jdd
�}|jdd
�}|S)Nz(-*A-*)z(-*A?-*)z	(-*[A-]*)z
(-*A[A-]*)z([-AO]*)z(-*A[-AO]*)z(-*%s-*)z-*rTrZr�)	r�r
rrrrr r�r8)r!rpr�rsr&r&r'rr�s$z!ArgumentParser._get_nargs_patterncsx�jttgkr2y|jd�Wntk
r0YnX|rz�jtkrz�jrP�j}n�j}t	|t
�rx�j�|�}�j�|�n�|r��jt
kr��jr��jdk	r��j}n|}�j�|�n�t|�dkr�jdtgkr�|\}�j�|�}�j�|�n��jtk�r��fdd�|D�}nb�jtk�rD��fdd�|D�}�j�|d�n0��fdd�|D�}x|D]}�j�|��q^W|S)Nz--rPcsg|]}�j�|��qSr&)rl)rV�v)rpr!r&r'rY�sz.ArgumentParser._get_values.<locals>.<listcomp>csg|]}�j�|��qSr&)rl)rVrx)rpr!r&r'rY�srcsg|]}�j�|��qSr&)rl)rVrx)rpr!r&r'rY�s)r�rrr1r;r
r�r�r�r�r�rl�_check_valuerrj)r!rpr"r%rmrxr&)rpr!r'rV�s>


zArgumentParser._get_valuescCs�|jd|j|j�}t|�s0td�}t|||��y||�}Wn�tk
r~t|jdt|j��}tt	j
�d�}t||��YnLttfk
r�t|jdt|j��}||d�}td�}t|||��YnX|S)Nrz%r is not callablerrP)rr%z!invalid %(type)s value: %(value)r)
rrr%r~rrr/rr�r�rRr&r;)r!rprmr)r�r�r$rXr&r&r'rl�s 
zArgumentParser._get_valuecCsF|jdk	rB||jkrB|djtt|j��d�}td�}t|||��dS)Nz, )r%r�z3invalid choice: %(value)r (choose from %(choices)s))r�r �maprr~r)r!rpr%rXr�r&r&r'ry	s
zArgumentParser._check_valuecCs$|j�}|j|j|j|j�|j�S)N)r�rirerrr])r!rSr&r&r'�format_usage	szArgumentParser.format_usagecCsx|j�}|j|j|j|j�|j|j�x:|jD]0}|j|j	�|j|j�|j
|j�|j�q0W|j|j
�|j�S)N)r�rirerrrcrrr_r3rsr�r`rCr])r!rSZaction_groupr&r&r'r]	szArgumentParser.format_helpcCs|j|jd�S)N)rM)rDrM)r!r&r&r'r�0	szArgumentParser._get_formattercCs"|dkrtj}|j|j�|�dS)N)r�r�r�r{)r!�filer&r&r'�print_usage6	szArgumentParser.print_usagecCs"|dkrtj}|j|j�|�dS)N)r�r�r�r])r!r|r&r&r'r�;	szArgumentParser.print_helpcCs |r|dkrtj}|j|�dS)N)r��stderr�write)r!r�r|r&r&r'r�@	szArgumentParser._print_messagercCs |r|j|tj�tj|�dS)N)r�r�r~r�)r!Zstatusr�r&r&r'r�I	szArgumentParser.exitcCs0|jtj�|j|d�}|jdtd�|�dS)z�error(message: string)

        Prints a usage message incorporating the message to stderr and
        exits.

        If you override this in a subclass, it should not return -- it
        should either exit or raise an exception.
        )rMr�r3z%(prog)s: error: %(message)s
N)r}r�r~rMr�r~)r!r�rXr&r&r'r=N	s	zArgumentParser.error)NN)NN)N)N)N)rN)!rr,r-r.rrOrrMr'rNrLrOr�rPrirpr[rfrkrvrrrVrlryr{r]r�r}r�r�r�r=r�r&r&)r�r'r1sP4

#w;,,4


	
)6r.�__version__�__all__�collectionsr�r�r��osr8�rerH�sysr��textwrapr�rr~rrr
rrrrr�r�rr2rrrrr	r��	Exceptionrrrr�r�r�r�r�r�r�r�r�r�rr
r
r*r,rr&r&r&r'�<module>>s�
n
	[#%`65"token.cpython-36.pyc000064400000006372150335715140010326 0ustar003


 \�@sRdZddddgZdZdZdZdZd	Zd
ZdZdZ	d
Z
dZdZdZ
dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Zd"Zd#Z d$Z!d%Z"d&Z#d'Z$d(Z%d)Z&d*Z'd+Z(d,Z)d-Z*d.Z+d/Z,d0Z-d1Z.d2Z/d3Z0d4Z1d5Z2d6Z3d7Z4d8Z5d9Z6d:Z7d;Z8d<Z9d=Z:d>Z;d?Z<d@dA�e=�j>�D�Z?ej@e?jA��dBd�ZBdCd�ZCdDd�ZDdEdF�ZEeFdGk�rNeE�dHS)Iz!Token constants (from "token.h").�tok_name�
ISTERMINAL�
ISNONTERMINAL�ISEOF����������	�
���
������������������� �!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�0�1�2�3�4�5�6�7�8�9�cCs,i|]$\}}t|t�r|jd�r||�qS)�_)�
isinstance�int�
startswith)�.0�name�value�rG�/usr/lib64/python3.6/token.py�
<dictcomp>JsrIcCs|tkS)N)�	NT_OFFSET)�xrGrGrHrOscCs|tkS)N)rJ)rKrGrGrHrRscCs|tkS)N)�	ENDMARKER)rKrGrGrHrUscJCspddl}ddl}|jdd�}|r*|dp,d}d}t|�dkrF|d}yt|�}Wn@tk
r�}z$|jjdt|��|j	d�WYdd}~XnX|�|j
�jd�}WdQRX|jd|j
�}i}	x:|D]2}
|j|
�}|r�|jdd�\}}
t|
�}
||	|
<q�Wt|	j��}yt|�}WnBtk
�rZ}z$|jjdt|��|j	d�WYdd}~XnX|�|j
�jd�}WdQRXy|jd	�d}|jd
�}Wn,tk
�r�|jjd�|j	d�YnXg}x$|D]}
|jd
|	|
|
f��q�W||||�<yt|d�}WnBtk
�rJ}z$|jjdt|��|j	d�WYdd}~XnX|�|jdj|��WdQRXdS)NrrzInclude/token.hzLib/token.pyzI/O error: %s
�
z:#define[ 	][ 	]*([A-Z0-9][A-Z0-9_]*)[ 	][ 	]*([0-9][0-9]*)rz#--start constants--z#--end constants--z&target does not contain format markersrz%s = %d�wr	)�re�sys�argv�len�open�OSError�stdout�write�str�exit�read�split�compile�
IGNORECASE�match�grouprB�sorted�keys�stderr�index�
ValueError�append�join)rOrP�args�
inFileName�outFileName�fp�err�lines�prog�tokens�liner]rE�valr`�format�start�endrGrGrH�_mainYsb


rs�__main__N)G�__doc__�__all__rL�NAME�NUMBER�STRING�NEWLINE�INDENT�DEDENT�LPAR�RPAR�LSQB�RSQB�COLON�COMMA�SEMI�PLUS�MINUS�STAR�SLASH�VBAR�AMPER�LESS�GREATER�EQUAL�DOT�PERCENT�LBRACE�RBRACE�EQEQUAL�NOTEQUAL�	LESSEQUAL�GREATEREQUAL�TILDE�
CIRCUMFLEX�	LEFTSHIFT�
RIGHTSHIFT�
DOUBLESTAR�	PLUSEQUAL�MINEQUAL�	STAREQUAL�
SLASHEQUAL�PERCENTEQUAL�
AMPEREQUAL�	VBAREQUAL�CIRCUMFLEXEQUAL�LEFTSHIFTEQUAL�RIGHTSHIFTEQUAL�DOUBLESTAREQUAL�DOUBLESLASH�DOUBLESLASHEQUAL�AT�ATEQUAL�RARROW�ELLIPSIS�OP�AWAIT�ASYNC�
ERRORTOKEN�N_TOKENSrJ�globals�itemsr�extend�valuesrrrrs�__name__rGrGrGrH�<module>s�
5
calendar.cpython-36.opt-2.pyc000064400000051555150335715140011722 0ustar003


 \�Z�@sddlZddlZddlZddlmZddddddd	d
ddd
dddddddddddddgZeZGdd�de�Z	Gdd�de�Z
dZdZddd dd!dd!ddd!dd!dg
Z
Gd"d#�d#�ZGd$d%�d%�Zed&�Zed'�Zed(�Zed)�Zed*�\ZZZZZZZd+d�Zd,d�Zd-d	�Zd.d
�ZGd/d�de �Z!Gd0d�de!�Z"Gd1d�de!�Z#Gd2d3�d3�Z$Gd4d�de"�Z%Gd5d�de#�Z&e"�Z'e'j(Z)d6d�Z*e'j+Z,e'j-Z-e'j.Z/e'j0Z1e'j2Z2e'j3Z4e'j5Z6e'j7Z8dCZ9d8Z:e9e:fd9d:�Z;e9e:fd;d<�Z<d=Z=ej>e=dd�j?�Z@d>d�ZAd?d@�ZBeCdAk�reBejD�dS)D�N)�repeat�IllegalMonthError�IllegalWeekdayError�setfirstweekday�firstweekday�isleap�leapdays�weekday�
monthrange�
monthcalendar�prmonth�month�prcal�calendar�timegm�
month_name�
month_abbr�day_name�day_abbr�Calendar�TextCalendar�HTMLCalendar�LocaleTextCalendar�LocaleHTMLCalendar�
weekheaderc@seZdZdd�Zdd�ZdS)rcCs
||_dS)N)r
)�selfr
�r� /usr/lib64/python3.6/calendar.py�__init__szIllegalMonthError.__init__cCs
d|jS)Nz!bad month number %r; must be 1-12)r
)rrrr�__str__szIllegalMonthError.__str__N)�__name__�
__module__�__qualname__rrrrrrrsc@seZdZdd�Zdd�ZdS)rcCs
||_dS)N)r	)rr	rrrr szIllegalWeekdayError.__init__cCs
d|jS)Nz7bad weekday number %r; must be 0 (Monday) to 6 (Sunday))r	)rrrrr"szIllegalWeekdayError.__str__N)r r!r"rrrrrrrs�����c@sFeZdZdd�ed�D�Zejddd��dd�Zd	d
�Zdd�Zd
S)�_localized_monthcCs g|]}tjd|dd�j�qS)i�r#)�datetime�date�strftime)�.0�irrr�
<listcomp>4sz_localized_month.<listcomp>�rcCsdS)N�r)�xrrr�<lambda>5sz_localized_month.<lambda>cCs
||_dS)N)�format)rr3rrrr7sz_localized_month.__init__cs4�j|}t|t�r&�fdd�|D�S|�j�SdS)Ncsg|]}|�j��qSr)r3)r,�f)rrrr.=sz0_localized_month.__getitem__.<locals>.<listcomp>)�_months�
isinstance�slicer3)rr-�funcsr)rr�__getitem__:s

z_localized_month.__getitem__cCsdS)N�
r)rrrr�__len__Asz_localized_month.__len__N)	r r!r"�ranger5�insertrr9r;rrrrr(2s
r(c@s6eZdZdd�ed�D�Zdd�Zdd�Zdd	�Zd
S)�_localized_daycCs g|]}tjdd|d�j�qS)i�r#)r)r*r+)r,r-rrrr.Hsz_localized_day.<listcomp>�cCs
||_dS)N)r3)rr3rrrrJsz_localized_day.__init__cs4�j|}t|t�r&�fdd�|D�S|�j�SdS)Ncsg|]}|�j��qSr)r3)r,r4)rrrr.Psz._localized_day.__getitem__.<locals>.<listcomp>)�_daysr6r7r3)rr-r8r)rrr9Ms

z_localized_day.__getitem__cCsdS)Nr?r)rrrrr;Tsz_localized_day.__len__N)r r!r"r<r@rr9r;rrrrr>Esr>z%Az%az%Bz%br?cCs$|ddko"|ddkp"|ddkS)N�r�di�r)�yearrrrrdscCs@|d8}|d8}|d|d|d|d|d|dS)Nr#rArBi�r)Zy1Zy2rrrriscCstj|||�j�S)N)r)r*r	)rCr
�dayrrrr	qscCsLd|kodkns t|��t||d�}t||tko@t|�}||fS)Nr#r/)rr	�mdays�Februaryr)rCr
�day1�ndaysrrrr
ws
c@s�eZdZddd�Zdd�Zdd�Zeee�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zddd�Zd dd�Zd!dd�ZdS)"rrcCs
||_dS)N)r)rrrrrr�szCalendar.__init__cCs
|jdS)Nr?)�
_firstweekday)rrrr�getfirstweekday�szCalendar.getfirstweekdaycCs
||_dS)N)rI)rrrrrr�szCalendar.setfirstweekdayccs*x$t|j|jd�D]}|dVqWdS)Nr?)r<r)rr-rrr�iterweekdays�szCalendar.iterweekdaysccs�tj||d�}|j�|jd}|tj|d�8}tjdd�}xH|Vy||7}Wntk
rfPYnX|j|kr>|j�|jkr>Pq>WdS)Nr#r?)�days)r)r*r	rZ	timedelta�
OverflowErrorr
)rrCr
r*rLZonedayrrr�itermonthdates�szCalendar.itermonthdatesccs4x.t|j||�|j�D]\}}||dfVqWdS)Nr?)�	enumerate�
itermonthdaysr)rrCr
r-�drrr�itermonthdays2�szCalendar.itermonthdays2ccsft||�\}}||jd}td|�EdHtd|d�EdH|j||d}td|�EdHdS)Nr?rr#)r
rrr<)rrCr
rGrHZdays_beforeZ
days_afterrrrrP�szCalendar.itermonthdayscs.t|j||����fdd�tdt��d�D�S)Ncsg|]}�||d��qS)r?r)r,r-)�datesrrr.�sz/Calendar.monthdatescalendar.<locals>.<listcomp>rr?)�listrNr<�len)rrCr
r)rSr�monthdatescalendar�szCalendar.monthdatescalendarcs.t|j||����fdd�tdt��d�D�S)Ncsg|]}�||d��qS)r?r)r,r-)rLrrr.�sz/Calendar.monthdays2calendar.<locals>.<listcomp>rr?)rTrRr<rU)rrCr
r)rLr�monthdays2calendar�szCalendar.monthdays2calendarcs.t|j||����fdd�tdt��d�D�S)Ncsg|]}�||d��qS)r?r)r,r-)rLrrr.�sz.Calendar.monthdayscalendar.<locals>.<listcomp>rr?)rTrPr<rU)rrCr
r)rLr�monthdayscalendar�szCalendar.monthdayscalendar�cs>��fdd�tttd�D����fdd�tdt����D�S)Ncsg|]}�j�|��qSr)rV)r,r-)rrCrrr.�sz.Calendar.yeardatescalendar.<locals>.<listcomp>r/csg|]}�||���qSrr)r,r-)�months�widthrrr.�sr)r<�JanuaryrU)rrCr[r)rZrr[rCr�yeardatescalendar�szCalendar.yeardatescalendarcs>��fdd�tttd�D����fdd�tdt����D�S)Ncsg|]}�j�|��qSr)rW)r,r-)rrCrrr.�sz.Calendar.yeardays2calendar.<locals>.<listcomp>r/csg|]}�||���qSrr)r,r-)rZr[rrr.�sr)r<r\rU)rrCr[r)rZrr[rCr�yeardays2calendar�szCalendar.yeardays2calendarcs>��fdd�tttd�D����fdd�tdt����D�S)Ncsg|]}�j�|��qSr)rX)r,r-)rrCrrr.�sz-Calendar.yeardayscalendar.<locals>.<listcomp>r/csg|]}�||���qSrr)r,r-)rZr[rrr.sr)r<r\rU)rrCr[r)rZrr[rCr�yeardayscalendar�szCalendar.yeardayscalendarN)r)rY)rY)rY)r r!r"rrJr�propertyrrKrNrRrPrVrWrXr]r^r_rrrrr�s





c@sfeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zddd
�Zddd�Z	ddd�Z
ddd�Zd dd�ZdS)!rcCst|j||�dd�dS)N� )�end)�print�
formatweek)r�theweekr[rrr�prweek
szTextCalendar.prweekcCs |dkrd}nd|}|j|�S)Nrr0z%2i)�center)rrDr	r[�srrr�	formatdayszTextCalendar.formatdaycsdj��fdd�|D��S)Nrac3s |]\}}�j||��VqdS)N)ri)r,rQ�wd)rr[rr�	<genexpr>sz*TextCalendar.formatweek.<locals>.<genexpr>)�join)rrer[r)rr[rrdszTextCalendar.formatweekcCs(|dkrt}nt}||d|�j|�S)N�	)rrrg)rrDr[�namesrrr�
formatweekday szTextCalendar.formatweekdaycsdj��fdd��j�D��S)Nrac3s|]}�j|��VqdS)N)ro)r,r-)rr[rrrk.sz0TextCalendar.formatweekheader.<locals>.<genexpr>)rlrK)rr[r)rr[r�formatweekheader*szTextCalendar.formatweekheaderTcCs"t|}|rd||f}|j|�S)Nz%s %r)rrg)r�theyear�themonthr[�withyearrhrrr�formatmonthname0szTextCalendar.formatmonthnamercCst|j||||�dd�dS)Nr0)rb)rc�formatmonth)rrqrr�w�lrrrr9szTextCalendar.prmonthcCs�td|�}td|�}|j||d|dd�}|j�}|d|7}||j|�j�7}|d|7}x4|j||�D]$}||j||�j�7}|d|7}qnW|S)Nr$r#r?�
)�maxrt�rstriprprWrd)rrqrrrvrwrh�weekrrrru?s

zTextCalendar.formatmonthr$r#�rYcs�td|�}td|�}td|�}|ddd�g}|j}|t��j�|||d�j��|d|��j|���x@t�j�|��D�]*\}}	t||dt	||ddd��}
|d|����fdd�|
D�}|t
|�|�j��|d|��fdd�|
D�}|t
|�|�j��|d|�td	d�|	D��}
xvt|
�D]j}g}x>|	D]6}|t|�k�rr|jd
�n|j�j|||���qTW|t
|�|�j��|d|��qFWq�Wd
j
|�S)Nr$r#r?rxr:c3s|]}�j�|�d�VqdS)FN)rt)r,�k)�colwidthrrqrrrk`sz*TextCalendar.formatyear.<locals>.<genexpr>c3s|]
}�VqdS)Nr)r,r})�headerrrrkdscss|]}t|�VqdS)N)rU)r,�calrrrrkhsr0)ry�append�reprrgrzrprOr^r<�min�formatstringrUrdrl)rrqrvrw�c�m�v�ar-�rowrZrnZheadersZheight�jZweeksr�r)r~rrrqr�
formatyearOs:


&
$
zTextCalendar.formatyearcCst|j|||||��dS)N)rcr�)rrqrvrwr�r�rrr�pryeartszTextCalendar.pryearN)T)rr)rr)r$r#r|rY)rrr|rY)
r r!r"rfrirdrorprtrrur�r�rrrrrs


	


%c@sfeZdZdddddddgZdd	�Zd
d�Zdd
�Zdd�Zddd�Zddd�Z	ddd�Z
ddd�ZdS) rZmonZtueZwedZthuZfriZsatZsuncCs"|dkrdSd|j||fSdS)Nrz<td class="noday">&nbsp;</td>z<td class="%s">%d</td>)�
cssclasses)rrDr	rrrri�szHTMLCalendar.formatdaycs dj�fdd�|D��}d|S)Nr0c3s|]\}}�j||�VqdS)N)ri)r,rQrj)rrrrk�sz*HTMLCalendar.formatweek.<locals>.<genexpr>z<tr>%s</tr>)rl)rrerhr)rrrd�szHTMLCalendar.formatweekcCsd|j|t|fS)Nz<th class="%s">%s</th>)r�r)rrDrrrro�szHTMLCalendar.formatweekdaycs$dj�fdd��j�D��}d|S)Nr0c3s|]}�j|�VqdS)N)ro)r,r-)rrrrk�sz0HTMLCalendar.formatweekheader.<locals>.<genexpr>z<tr>%s</tr>)rlrK)rrhr)rrrp�szHTMLCalendar.formatweekheaderTcCs*|rdt||f}ndt|}d|S)Nz%s %sz%sz.<tr><th colspan="7" class="month">%s</th></tr>)r)rrqrrrsrhrrrrt�szHTMLCalendar.formatmonthnamecCs�g}|j}|d�|d�||j|||d��|d�||j��|d�x*|j||�D]}||j|��|d�qXW|d�|d�dj|�S)Nz@<table border="0" cellpadding="0" cellspacing="0" class="month">rx)rsz</table>r0)r�rtrprWrdrl)rrqrrrsr�r�r{rrrru�szHTMLCalendar.formatmonthrYcCs�g}|j}t|d�}|d�|d�|d||f�xntttd|�D]Z}t|t||d��}|d�x0|D](}|d�||j||d	d
��|d�qlW|d�qFW|d
�dj|�S)Nr#z?<table border="0" cellpadding="0" cellspacing="0" class="year">rxz.<tr><th colspan="%d" class="year">%s</th></tr>r/r:z<tr>z<td>F)rsz</td>z</tr>z</table>r0)r�ryr<r\r�rurl)rrqr[r�r�r-rZr�rrrr��s 

zHTMLCalendar.formatyear�calendar.cssNcCs�|dkrtj�}g}|j}|d|�|d�|d�|d�|d|�|dk	r^|d|�|d|�|d�|d	�||j||��|d
�|d�dj|�j|d
�S)Nz$<?xml version="1.0" encoding="%s"?>
zn<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
z<html>
z<head>
zC<meta http-equiv="Content-Type" content="text/html; charset=%s" />
z4<link rel="stylesheet" type="text/css" href="%s" />
z<title>Calendar for %d</title>
z</head>
z<body>
z</body>
z</html>
r0�xmlcharrefreplace)�sys�getdefaultencodingr�r�rl�encode)rrqr[�css�encodingr�r�rrr�formatyearpage�s$zHTMLCalendar.formatyearpage)T)T)rY)rYr�N)r r!r"r�rirdrorprtrur�r�rrrrrys	



c@s$eZdZdd�Zdd�Zdd�ZdS)�different_localecCs
||_dS)N)�locale)rr�rrrr�szdifferent_locale.__init__cCs"tjtj�|_tjtj|j�dS)N)�_localeZ	getlocale�LC_TIME�	oldlocale�	setlocaler�)rrrr�	__enter__�szdifferent_locale.__enter__cGstjtj|j�dS)N)r�r�r�r�)r�argsrrr�__exit__�szdifferent_locale.__exit__N)r r!r"rr�r�rrrrr��sr�c@s(eZdZd
dd�Zdd�Zddd	�ZdS)rrNcCs&tj||�|dkrtj�}||_dS)N)rrr��getdefaultlocaler�)rrr�rrrr�szLocaleTextCalendar.__init__c
CsBt|j��.|dkrt}nt}||}|d|�j|�SQRXdS)Nrm)r�r�rrrg)rrDr[rn�namerrrrosz LocaleTextCalendar.formatweekdayTc
Cs8t|j��$t|}|r$d||f}|j|�SQRXdS)Nz%s %r)r�r�rrg)rrqrrr[rsrhrrrrts
z"LocaleTextCalendar.formatmonthname)rN)T)r r!r"rrortrrrrr�s
	c@s(eZdZd
dd�Zdd�Zddd	�ZdS)rrNcCs&tj||�|dkrtj�}||_dS)N)rrr�r�r�)rrr�rrrrszLocaleHTMLCalendar.__init__c
Cs0t|j��t|}d|j||fSQRXdS)Nz<th class="%s">%s</th>)r�r�rr�)rrDrhrrrro!sz LocaleHTMLCalendar.formatweekdayTc
Cs6t|j��"t|}|r$d||f}d|SQRXdS)Nz%s %sz.<tr><th colspan="7" class="month">%s</th></tr>)r�r�r)rrqrrrsrhrrrrt&s
z"LocaleHTMLCalendar.formatmonthname)rN)T)r r!r"rrortrrrrrs
cCs*t|kotkns t|��|t_dS)N)�MONDAY�SUNDAYrr�r)rrrrr3srYr|cCstt|||��dS)N)rcr�)�colsr~�spacingrrrr3Gsr3cs |d9}|j�fdd�|D��S)Nrac3s|]}|j��VqdS)N)rg)r,r�)r~rrrkOszformatstring.<locals>.<genexpr>)rl)r�r~r�r)r~rr�Lsr�i�cCs^|dd�\}}}}}}tj||d�j�t|d}|d|}|d|}	|	d|}
|
S)Nr|r#��<)r)r*�	toordinal�
_EPOCH_ORD)�tuplerCr
rDZhourZminute�secondrLZhoursZminutesZsecondsrrrrVscCs�ddl}|j�}|jd�}|jd�}|jddtddd�|jd	d
tddd�|jd
dtddd�|jddtddd�|jddddd�|jddddd�|jddddd�|jd d!d"d3d$d%�|jd&d'td(d)�|jd*d'td+d)�|j|dd��}|j�r|j�r|jd,�t	j
d�|j|jf}|jd#k�r�|j�rFt|d-�}nt
�}|j}|dk�rdt	j�}t||jd.�}	t	jjj}
|jdk�r�|
|jtjj�jf|	��n6|jdk�r�|
|j|jf|	��n|jd/�t	j
d�n�|j�r�t|d-�}nt�}t|j|jd0�}	|jdk�r&|j|	d1<|j|	d2<|jdk�rJ|j tjj�jf|	�}n2|jdk�rh|j |jf|	�}n|j!|j|jf|	�}t	jj}
|j�r�|j"|j�}t	jjj}
|
|�dS)4Nrztext only argumentszhtml only argumentsz-wz--widthr$z width of date column (default 2))�type�default�helpz-lz--linesr#z)number of lines for each week (default 1)z-sz	--spacingr|z"spacing between months (default 6)z-mz--monthsrYzmonths per row (default 3)z-cz--csszcalendar.csszCSS to use for page)r�r�z-Lz--localez.locale to be used from month and weekday namesz-ez
--encodingzencoding to use for outputz-tz--type�text�htmlzoutput type (text or html))r��choicesr�rC�?zyear number (1-9999))�nargsr�r�r
zmonth number (1-12, text only)z/if --locale is specified --encoding is required)r�)r�r�zincorrect number of arguments)rvrwr�r�)r�r�)#�argparse�ArgumentParserZadd_argument_group�add_argument�int�
parse_argsr�r��errorr��exitr�rrr��dictr��stdout�buffer�writerCr�r)r*Ztodayr
rrr[�linesr�rZr�rur�)r�r��parserZ	textgroupZ	htmlgroupZoptionsr�r�r�Zoptdictr��resultrrr�main`s�









r��__main__��)Er�r)r�r��	itertoolsr�__all__�
ValueErrorr�rrr\rFrEr(r>rrrrr<r�ZTUESDAYZ	WEDNESDAYZTHURSDAYZFRIDAYZSATURDAYr�rrr	r
�objectrrrr�rrr�rJrrrXrrfrdr{rprrrur
r�rr�rZ	_colwidthZ_spacingr3r�ZEPOCHr*r�r�rr�r �argvrrrr�<module>sl



up
h
mailbox.cpython-36.pyc000064400000174412150335715140010642 0ustar003


 \ 3�@sRdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
ZddlZddlZyddl
Z
Wnek
r�dZ
YnXddddddd	d
ddd
ddddddgZejjd�ZGdd�d�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd	�d	ejj�ZGd d
�d
e�ZGd!d"�d"e�ZGd#d�de�ZGd$d�de�ZGd%d
�d
e�Z Gd&d�de�Z!Gd'd(�d(�Z"Gd)d*�d*e"�Z#d=d,d-�Z$d.d/�Z%d0d1�Z&d2d3�Z'd4d5�Z(d6d7�Z)Gd8d�de*�Z+Gd9d�de+�Z,Gd:d�de+�Z-Gd;d�de+�Z.Gd<d�de+�Z/dS)>zDRead/write support for Maildir, mbox, MH, Babyl, and MMDF mailboxes.�N�Mailbox�Maildir�mbox�MH�Babyl�MMDF�Message�MaildirMessage�mboxMessage�	MHMessage�BabylMessage�MMDFMessage�Error�NoSuchMailboxError�
NotEmptyError�ExternalClashError�FormatError�asciic@seZdZdZdCdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dDdd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�ZdEd0d1�Zd2d3�ZdFd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Z d>d?�Z!d@Z"dGdAdB�Z#dS)Hrz*A group of messages in a particular place.NTcCs tjjtjj|��|_||_dS)zInitialize a Mailbox instance.N)�os�path�abspath�
expanduser�_path�_factory)�selfr�factory�create�r�/usr/lib64/python3.6/mailbox.py�__init__$szMailbox.__init__cCstd��dS)z$Add message and return assigned key.z&Method must be implemented by subclassN)�NotImplementedError)r�messagerrr�add)szMailbox.addcCstd��dS)z=Remove the keyed message; raise KeyError if it doesn't exist.z&Method must be implemented by subclassN)r )r�keyrrr�remove-szMailbox.removecCs|j|�dS)N)r$)rr#rrr�__delitem__1szMailbox.__delitem__cCs(y|j|�Wntk
r"YnXdS)z'If the keyed message exists, remove it.N)r$�KeyError)rr#rrr�discard4szMailbox.discardcCstd��dS)z>Replace the keyed message; raise KeyError if it doesn't exist.z&Method must be implemented by subclassN)r )rr#r!rrr�__setitem__;szMailbox.__setitem__cCs$y
|j|�Stk
r|SXdS)z9Return the keyed message, or default if it doesn't exist.N)�__getitem__r&)rr#�defaultrrr�get?s
zMailbox.getc	Cs6|js|j|�Stj|j|���}|j|�SQRXdS)z=Return the keyed message; raise KeyError if it doesn't exist.N)r�get_message�
contextlib�closing�get_file)rr#�filerrrr)Fs
zMailbox.__getitem__cCstd��dS)z4Return a Message representation or raise a KeyError.z&Method must be implemented by subclassN)r )rr#rrrr,NszMailbox.get_messagecCstj|j|��j�S)z�Return a string representation or raise a KeyError.

        Uses email.message.Message to create a 7bit clean string
        representation of the message.)�email�message_from_bytes�	get_bytes�	as_string)rr#rrr�
get_stringRszMailbox.get_stringcCstd��dS)z8Return a byte string representation or raise a KeyError.z&Method must be implemented by subclassN)r )rr#rrrr3YszMailbox.get_bytescCstd��dS)z6Return a file-like representation or raise a KeyError.z&Method must be implemented by subclassN)r )rr#rrrr/]szMailbox.get_filecCstd��dS)zReturn an iterator over keys.z&Method must be implemented by subclassN)r )rrrr�iterkeysaszMailbox.iterkeyscCst|j��S)zReturn a list of keys.)�listr6)rrrr�keyseszMailbox.keysccs@x:|j�D].}y||}Wntk
r0w
YnX|Vq
WdS)z%Return an iterator over all messages.N)r6r&)rr#�valuerrr�
itervaluesiszMailbox.itervaluescCs|j�S)N)r:)rrrr�__iter__rszMailbox.__iter__cCst|j��S)z,Return a list of messages. Memory intensive.)r7r:)rrrr�valuesuszMailbox.valuesccsDx>|j�D]2}y||}Wntk
r0w
YnX||fVq
WdS)z.Return an iterator over (key, message) tuples.N)r6r&)rr#r9rrr�	iteritemsyszMailbox.iteritemscCst|j��S)z9Return a list of (key, message) tuples. Memory intensive.)r7r=)rrrr�items�sz
Mailbox.itemscCstd��dS)z9Return True if the keyed message exists, False otherwise.z&Method must be implemented by subclassN)r )rr#rrr�__contains__�szMailbox.__contains__cCstd��dS)z*Return a count of messages in the mailbox.z&Method must be implemented by subclassN)r )rrrr�__len__�szMailbox.__len__cCs x|j�D]}|j|�q
WdS)zDelete all messages.N)r8r')rr#rrr�clear�sz
Mailbox.clearcCs0y||}Wntk
r |SX|j|�|S)z3Delete the keyed message and return it, or default.)r&r')rr#r*�resultrrr�pop�s
zMailbox.popcCs*x$|j�D]}||j|�fSWtd��dS)z6Delete an arbitrary (key, message) pair and return it.zNo messages in mailboxN)r6rCr&)rr#rrr�popitem�szMailbox.popitemcCsxt|d�r|j�}nt|d�r(|j�}n|}d}x6|D].\}}y|||<Wq6tk
rbd}Yq6Xq6W|rttd��dS)z4Change the messages that correspond to certain keys.r=r>FTzNo message with key(s)N)�hasattrr=r>r&)r�arg�sourceZbad_keyr#r!rrr�update�s



zMailbox.updatecCstd��dS)z&Write any pending changes to the disk.z&Method must be implemented by subclassN)r )rrrr�flush�sz
Mailbox.flushcCstd��dS)zLock the mailbox.z&Method must be implemented by subclassN)r )rrrr�lock�szMailbox.lockcCstd��dS)z#Unlock the mailbox if it is locked.z&Method must be implemented by subclassN)r )rrrr�unlock�szMailbox.unlockcCstd��dS)zFlush and close the mailbox.z&Method must be implemented by subclassN)r )rrrr�close�sz
Mailbox.closecCs,y
|jd�Stk
r&td��YnXdS)Nrz?String input must be ASCII-only; use bytes or a Message instead)�encode�UnicodeError�
ValueError)rr!rrr�_string_to_bytes�s
zMailbox._string_to_bytesFc	Cst|tjj�rxtj�}tjj||d�}|j|�|j	d�|j
�}|jdt�}|j
|�|jrt|jt�rt|j
t��n�t|tttjf��rt|tj�r�tjdtd�|j�}t|t�r�|j|�}|r�|jdd�}|jdt�}|j
|�|jo�|jt��r�|j
t�n�t|d��r�t|d��r4tjd	td�|j}d
}x�|j�}|jd��r`|d
d�d}n|jd
��r||d
d�d}|�s�P|�r�|jd��r�d|dd
�}|jdt�}|j
|�|}�q:W|j�r�|�r�|jt��r�|j
t�ntdt|���d
S)z%Dump message contents to target file.r�
z8Use of StringIO input is deprecated, use BytesIO instead�s
From s
>From �read�bufferzDUse of text mode files is deprecated, use a binary mode file insteadNs
��
�sFrom s>From �zInvalid message type: %s������)�
isinstancer1r!r�io�BytesIO�	generator�BytesGenerator�flatten�seekrS�replace�linesep�write�_append_newline�endswith�str�bytes�StringIO�warnings�warn�DeprecationWarning�getvaluerPrErT�readline�
startswith�	TypeError�type)	rr!�targetZmangle_from_rT�gen�dataZlastline�linerrr�
_dump_message�sZ







zMailbox._dump_message)NT)N)N)N)F)$�__name__�
__module__�__qualname__�__doc__rr"r$r%r'r(r+r)r,r5r3r/r6r8r:r;r<r=r>r?r@rArCrDrHrIrJrKrLrPrervrrrrr!sB

		
	
c@s�eZdZdZdZd6dd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)7rzA qmail-style Maildir mailbox.�:NTcCs�tj||||�tjj|jd�tjj|jd�tjj|jd�d�|_tjj|j�s�|r�tj|jd�x*|jj	�D]}tj|d�qnWn
t
|j��i|_ddd�|_d|_
d|_d	S)
zInitialize a Maildir instance.�tmp�new�cur)r|r}r~i�r)r~r}g�������?N)rrrr�joinr�_paths�exists�mkdirr<r�_toc�_toc_mtimes�
_last_read�_skewfactor)r�dirnamerrrrrrr
s
zMaildir.__init__cCs~|j�}y|j||�Wn*tk
rB|j�tj|j��YnXt|�t|t	�r||j
�}|j|j�}||jkr�d}nd}d}tj
j|j�j|j�d}tj
j|j|||�}t|t	�r�tj|jtj
j|j�|j�f�yLytj|j|�Wn(ttfk
�rtj|j|�YnXtj|j�WnNtk
�rx}z0tj|j�|jtjk�rftd|��n�WYdd}~XnX|S)z$Add message and return assigned key.�r}rz$Name clash with existing message: %sN)�_create_tmprv�
BaseExceptionrLrr$�name�_sync_closer[r	�
get_subdir�colon�get_infor�basename�splitrr�utime�getatime�get_date�link�AttributeError�PermissionError�rename�OSError�errnoZEEXISTr)rr!Ztmp_file�subdir�suffix�uniq�dest�errrr"!sB



zMaildir.addcCs tjtjj|j|j|���dS)z=Remove the keyed message; raise KeyError if it doesn't exist.N)rr$rrr�_lookup)rr#rrrr$KszMaildir.removecCs,y|j|�Wnttfk
r&YnXdS)z'If the keyed message exists, remove it.N)r$r&�FileNotFoundError)rr#rrrr'OszMaildir.discardcCs�|j|�}|j|�}|j|�}t|t�r.|}n|}tjj|�}|j|kr`|j|j|j�d}nd}|j	|�tjj
|j|�}	tjj
|j|||�}
t|t�r�tj|	tjj
|	�|j�f�tj|	|
�dS)z>Replace the keyed message; raise KeyError if it doesn't exist.rWr�NrZ)r�r"r[r	rrr�r�r�r'rrr�r�r�r�)rr#r!Zold_subpathZtemp_keyZtemp_subpathZdominant_subpathr�r�Ztmp_path�new_pathrrrr(Ws"






zMaildir.__setitem__cCs�|j|�}ttjj|j|�d�� }|jr4|j|�}nt|�}WdQRXtjj|�\}}|j	|�|j
|kr�|j|j|j
�d�|jtjj
tjj|j|���|S)z4Return a Message representation or raise a KeyError.�rbNrWrZ)r��openrrrrrr	r��
set_subdirr��set_info�set_date�getmtime)rr#Zsubpath�f�msgr�r�rrrr,rs


zMaildir.get_messagec
Cs8ttjj|j|j|��d��}|j�jtd�SQRXdS)z2Return a bytes representation or raise a KeyError.r�rQN)	r�rrrrr�rSrbrc)rr#r�rrrr3�szMaildir.get_bytescCs$ttjj|j|j|��d�}t|�S)z6Return a file-like representation or raise a KeyError.r�)r�rrrrr��
_ProxyFile)rr#r�rrrr/�szMaildir.get_fileccsH|j�x:|jD]0}y|j|�Wntk
r8wYnX|VqWdS)zReturn an iterator over keys.N)�_refreshr�r�r&)rr#rrrr6�szMaildir.iterkeyscCs|j�||jkS)z9Return True if the keyed message exists, False otherwise.)r�r�)rr#rrrr?�szMaildir.__contains__cCs|j�t|j�S)z*Return a count of messages in the mailbox.)r��lenr�)rrrrr@�szMaildir.__len__cCsdS)z"Write any pending changes to disk.Nr)rrrrrI�sz
Maildir.flushcCsdS)zLock the mailbox.Nr)rrrrrJ�szMaildir.lockcCsdS)z#Unlock the mailbox if it is locked.Nr)rrrrrK�szMaildir.unlockcCsdS)zFlush and close the mailbox.Nr)rrrrrL�sz
Maildir.closecCs`g}xVtj|j�D]F}t|�dkr|ddkrtjjtjj|j|��r|j|dd��qW|S)zReturn a list of folder names.rWr�.N)r�listdirrr�r�isdirr�append)rrB�entryrrr�list_folders�szMaildir.list_folderscCs ttjj|jd|�|jdd�S)z/Return a Maildir instance for the named folder.r�F)rr)rrrrrr)r�folderrrr�
get_folder�szMaildir.get_foldercCs\tjj|jd|�}t||jd�}tjj|d�}tjj|�sXtjtj|tj	tj
Bd��|S)z>Create a folder and return a Maildir instance representing it.r�)rZ
maildirfolderi�)rrrrrrr�rLr��O_CREAT�O_WRONLY)rr�rrBZmaildirfolder_pathrrr�
add_folder�szMaildir.add_foldercCs,tjj|jd|�}xTtjtjj|d��tjtjj|d��D](}t|�dksZ|ddkr>td|��q>WxPtj|�D]B}|dkrv|dkrv|dkrvtjjtjj||��rvtd||f��qvWx`tj|d	d
�D]N\}}}x |D]}tj	tjj||��q�Wx |D]}tj
tjj||��q�Wq�Wtj
|�dS)z-Delete the named folder, which must be empty.r�r}r~rWrzFolder contains message(s): %sr|z%Folder contains subdirectory '%s': %sF)�topdownN)rrrrr�r�rr��walkr$�rmdir)rr�rr��root�dirs�filesrrr�
remove_folder�s 

zMaildir.remove_foldercCs\tj�}xNtjtjj|jd��D]4}tjj|jd|�}|tjj|�dkr tj|�q WdS)zDelete old files in "tmp".r|i@�N)�timerr�rrrr�r$)r�nowr�rrrr�clean�s
z
Maildir.cleanrWcCs�tj�}tj�}d|kr$|jdd�}d|kr8|jdd�}dt|�t|dd�tj�tj|f}tj	j
|jd|�}ytj|�Wn@t
k
r�tjd7_yt|�Stk
r�YnXYnXtd	|��d
S)z=Create a file in the tmp subdirectory and open and return it.�/z\057r{z\072z%s.M%sP%sQ%s.%srWg��.Ar|z&Name clash prevented file creation: %sN)r��socket�gethostnamerb�intr�getpidr�_countrrr�statr��_create_carefully�FileExistsErrorr)rr�Zhostnamer�rrrrr��s&zMaildir._create_tmpcCs�tj�|jd|jkrbd}x<|jD]2}tjj|j|�}||j|krLd}||j|<q$W|sbdSi|_xl|jD]b}|j|}xRtj	|�D]D}tjj
||�}tjj|�r�q�|j|j
�d}tjj
||�|j|<q�WqpWtj�|_dS)z!Update table of contents mapping.rUFTNr)r�r�r�r�rrr�r�r�r�rr�r�r�)rZrefreshr��mtimerr��pr�rrrr��s&
zMaildir._refreshcCszy,tjjtjj|j|j|��r*|j|SWntk
r@YnX|j�y
|j|Stk
rttd|��YnXdS)z=Use TOC to return subpath for given key, or raise a KeyError.zNo message with key: %sN)rrr�rrr�r&r�)rr#rrrr�#s
zMaildir._lookupcCsVt|d�s|j�|_x<y|t|j�Stk
r8dStk
rLwYqXqWdS)z0Return the next message in a one-time iteration.�
_onetime_keysN)rEr6r��next�
StopIterationr&)rrrrr�1s

zMaildir.next)NT)rwrxryrzr�rr"r$r'r(r,r3r/r6r?r@rIrJrKrLr�r�r�r�r�r�r�r�r�r�rrrrrs6
*
	
$c@s�eZdZdZd$dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd%d d!�Zd"d#�ZdS)&�_singlefileMailboxzA single-file mailbox.NTcCs�tj||||�yt|jd�}Wnntk
r�}zR|jtjkr\|rPt|jd�}q~t|j��n"|jtjtj	fkr|t|jd�}n�WYdd}~XnX||_
d|_d|_d|_
d|_d|_d|_dS)z!Initialize a single-file mailbox.zrb+zwb+r�NrF)rrr�rr�r��ENOENTr�EACCES�EROFS�_filer��	_next_key�_pending�
_pending_sync�_locked�_file_length)rrrrr�r�rrrrAs$z_singlefileMailbox.__init__cCs8|j�|j|�|j|j<|jd7_d|_|jdS)z$Add message and return assigned key.rWT)r��_append_messager�r�r�)rr!rrrr"Xs
z_singlefileMailbox.addcCs|j|�|j|=d|_dS)z=Remove the keyed message; raise KeyError if it doesn't exist.TN)r�r�r�)rr#rrrr$bs
z_singlefileMailbox.removecCs$|j|�|j|�|j|<d|_dS)z>Replace the keyed message; raise KeyError if it doesn't exist.TN)r�r�r�r�)rr#r!rrrr(hs
z_singlefileMailbox.__setitem__ccs|j�|jj�EdHdS)zReturn an iterator over keys.N)r�r�r8)rrrrr6nsz_singlefileMailbox.iterkeyscCs|j�||jkS)z9Return True if the keyed message exists, False otherwise.)r�r�)rr#rrrr?ssz_singlefileMailbox.__contains__cCs|j�t|j�S)z*Return a count of messages in the mailbox.)r�r�r�)rrrrr@xsz_singlefileMailbox.__len__cCs|jst|j�d|_dS)zLock the mailbox.TN)r��
_lock_filer�)rrrrrJ}s
z_singlefileMailbox.lockcCs|jrt|j�d|_dS)z#Unlock the mailbox if it is locked.FN)r��_unlock_filer�)rrrrrK�s
z_singlefileMailbox.unlockc
Cs�|js |jrt|j�d|_dS|jdk	s.t�|jjdd�|jj�}||jkrbt	d|j|f��t
|j�}y�i}|j|�x�t
|jj��D]|}|j|\}}|jj|�|j|�|j�}x0|jjtd||jj���}|s�P|j|�q�W||j�f||<|j|�q�W|j�|_Wn"|j�tj|j��YnXt|�|jj�tj|j�j}	tj|j|	�ytj|j|j�Wn2tk
�r�tj|j�tj|j|j�YnXt|jd�|_||_d|_d|_|j�r�t |jdd�dS)	z"Write any pending changes to disk.FNrrUz4Size of mailbox file changed (expected %i, found %i)izrb+)�dotlock)!r�r��_sync_flushr�r��AssertionErrorra�tellr�r�_create_temporaryr�_pre_mailbox_hook�sortedr8�_pre_message_hookrS�minrd�_post_message_hookrLrr$r�r�r��st_mode�chmodr�r�r�r�r�)
rZcur_lenZnew_fileZnew_tocr#�start�stopZ	new_startrT�moderrrrI�s`







z_singlefileMailbox.flushcCsdS)z,Called before writing the mailbox to file f.Nr)rr�rrrr��sz$_singlefileMailbox._pre_mailbox_hookcCsdS)z-Called before writing each message to file f.Nr)rr�rrrr��sz$_singlefileMailbox._pre_message_hookcCsdS)z,Called after writing each message to file f.Nr)rr�rrrr��sz%_singlefileMailbox._post_message_hookcCs4z|j�Wdz|jr|j�Wd|jj�XXdS)zFlush and close the mailbox.N)rIr�rKr�rL)rrrrrL�sz_singlefileMailbox.closecCsJ|jdkr|j�|dk	rFy
|j|Stk
rDtd|��YnXdS)z'Return (start, stop) or raise KeyError.NzNo message with key: %s)r��
_generate_tocr&)rr#rrrr��s

z_singlefileMailbox._lookupcCs�|jjdd�|jj�}t|j�dkr:|jr:|j|j�y&|j|j�|j|�}|j	|j�Wn"t
k
r�|jj|��YnX|jj�|jj�|_
|S)z;Append message to mailbox and return (start, stop) offsets.rrU)r�rar�r�r�r�r�r��_install_messager�r��truncaterIr�)rr!ZbeforeZoffsetsrrrr��s


z"_singlefileMailbox._append_message)NT)N)rwrxryrzrr"r$r(r6r?r@rJrKrIr�r�r�rLr�r�rrrrr�>s"

@

r�c@sBeZdZdZdZdd�Zddd�Zddd	�Zdd
d�Zdd
�Z	dS)�	_mboxMMDFzAn mbox or MMDF mailbox.TcCsp|j|�\}}|jj|�|jj�jtd�}|jj||jj��}|j|jtd��}|j	|dd�j
d��|S)z4Return a Message representation or raise a KeyError.�rQrXNr)r�r�rarnrbrcrSr��_message_factory�set_from�decode)rr#r�r��	from_line�stringr�rrrr,sz_mboxMMDF.get_messageFcCstj|j|��j|d�S)z3Return a string representation or raise a KeyError.)�unixfrom)r1r2r3r4)rr#�from_rrrr5sz_mboxMMDF.get_stringcCsJ|j|�\}}|jj|�|s(|jj�|jj||jj��}|jtd�S)z3Return a string representation or raise a KeyError.rQ)r�r�rarnrSr�rbrc)rr#r�r�r�r�rrrr3s
z_mboxMMDF.get_bytescCs<|j|�\}}|jj|�|s(|jj�t|j|jj�|�S)z6Return a file-like representation or raise a KeyError.)r�r�rarn�_PartialFiler�)rr#r�r�r�rrrr/s

z_mboxMMDF.get_filecCsd}t|t�r|j|�}t|t�rf|jd�rf|jd�}|dkr\|d|�}||dd�}q�|}d}nJt|t�r�|j�jd�}d|}n(t|t	j
j�r�|j�}|dk	r�|jd�}|dkr�dt
jt
j��j�}|jj�}|jj|t�|j||j|j�|jj�}||fS)	z1Format a message and blindly write to self._file.NsFrom rQrWr�rsFrom MAILER-DAEMON rZ)r[rgrPrhro�find�_mboxMMDFMessage�get_fromrMr1r!r�get_unixfromr��asctime�gmtimer�r�rdrcrv�
_mangle_from_)rr!r��newlineZauthorr�r�rrrr�&s0







z_mboxMMDF._install_messageN)F)F)F)
rwrxryrzrr,r5r3r/r�rrrrr�s


	
r�c@s2eZdZdZdZdZd
dd�Zdd�Zdd	�ZdS)rzA classic mbox mailbox.TNcCst|_tj||||�dS)zInitialize an mbox mailbox.N)r
r�r�r)rrrrrrrrLsz
mbox.__init__cCs|jt�dS)z,Called after writing each message to file f.N)rdrc)rr�rrrr�Qszmbox._post_message_hookcCs�gg}}d}|jjd�x�|jj�}|jj�}|jd�r|t|�t|�krl|rb|j|tt��n
|j|�|j|�d}q|s�|r�|j|tt��n
|j|�Pq|tkr�d}qd}qWtt	t
||���|_t|j�|_|jj�|_
dS)z0Generate key-to-(start, stop) table of contents.FrsFrom TN)r�rar�rnror�r�rc�dict�	enumerate�zipr�r�r�)r�starts�stopsZlast_was_empty�line_posrurrrr�Us0






zmbox._generate_toc)NT)	rwrxryrzrrerr�r�rrrrrCs
c@s2eZdZdZddd�Zdd�Zdd	�Zd
d�ZdS)
rzAn MMDF mailbox.NTcCst|_tj||||�dS)zInitialize an MMDF mailbox.N)r
r�r�r)rrrrrrrrzsz
MMDF.__init__cCs|jdt�dS)z-Called before writing each message to file f.sN)rdrc)rr�rrrr�szMMDF._pre_message_hookcCs|jtdt�dS)z,Called after writing each message to file f.sN)rdrc)rr�rrrr��szMMDF._post_message_hookcCs�gg}}|jjd�d}x�|}|jj�}|jj�}|jdt�r�|j|�xV|}|jj�}|jj�}|dtkr�|j|tt��PqN|sN|j|�PqNWq|sPqWtt	t
||���|_t|j�|_|jjdd�|jj�|_
dS)z0Generate key-to-(start, stop) table of contents.rsrUN)r�rarnr�rorcr�r�rrrr�r�r�)rrr�next_posrrurrrr��s2






zMMDF._generate_toc)NT)rwrxryrzrr�r�r�rrrrrws

c@s�eZdZdZd0dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�ZdS)1rzAn MH mailbox.NTcCsttj||||�tjj|j�sj|r`tj|jd�tjtjtjj	|jd�tj
tjBtjBd��n
t
|j��d|_dS)zInitialize an MH instance.i�z
.mh_sequencesi�FN)rrrrr�rr�rLr�rr��O_EXCLr�rr�)rrrrrrrr�s
zMH.__init__cCs�|j�}t|�dkrd}nt|�d}tjj|jt|��}t|�}d}z�|j	rVt
|�zfy|j||�Wn:tk
r�|j	r�t
|�t|�d}tj|��YnXt|t�r�|j||�Wd|j	r�t
|�XWd|s�t|�X|S)z$Add message and return assigned key.rrWFTN)r8r��maxrrrrrgr�r�r�rvr�r�r�r$r[r�_dump_sequences)rr!r8Znew_keyr�r��closedrrrr"�s6


zMH.addcCsxtjj|jt|��}yt|d�}Wn>tk
r`}z"|jtjkrNt	d|��n�WYdd}~XnX|j
�tj|�dS)z=Remove the keyed message; raise KeyError if it doesn't exist.zrb+zNo message with key: %sN)rrrrrgr�r�r�r�r&rLr$)rr#rr�r�rrrr$�sz	MH.removecCs�tjj|jt|��}yt|d�}Wn>tk
r`}z"|jtjkrNt	d|��n�WYdd}~XnXzd|j
rrt|�z@tjtj|tj
tjB��|j||�t|t�r�|j||�Wd|j
r�t|�XWdt|�XdS)z>Replace the keyed message; raise KeyError if it doesn't exist.zrb+zNo message with key: %sN)rrrrrgr�r�r�r�r&r�r�rLr��O_TRUNCrvr[rrr�r�)rr#r!rr�r�rrrr(�s$
zMH.__setitem__c Cs�y@|jr$ttjj|jt|��d�}nttjj|jt|��d�}Wn>tk
r~}z"|jtj	krlt
d|��n�WYdd}~XnX|�2|jr�t|�zt|�}Wd|jr�t
|�XWdQRXx*|j�j�D]\}}||kr�|j|�q�W|S)z4Return a Message representation or raise a KeyError.zrb+r�zNo message with key: %sN)r�r�rrrrrgr�r�r�r&r�rr��
get_sequencesr>�add_sequence)rr#r�r�r�r��key_listrrrr,�s&zMH.get_messagec Cs�y@|jr$ttjj|jt|��d�}nttjj|jt|��d�}Wn>tk
r~}z"|jtj	krlt
d|��n�WYdd}~XnX|�6|jr�t|�z|j�j
td�S|jr�t|�XWdQRXdS)z2Return a bytes representation or raise a KeyError.zrb+r�zNo message with key: %sNrQ)r�r�rrrrrgr�r�r�r&r�rSrbrcr�)rr#r�r�rrrr3szMH.get_bytescCsfyttjj|jt|��d�}Wn>tk
r\}z"|jtjkrJt	d|��n�WYdd}~XnXt
|�S)z6Return a file-like representation or raise a KeyError.r�zNo message with key: %sN)r�rrrrrgr�r�r�r&r�)rr#r�r�rrrr/)szMH.get_filecCsttdd�tj|j�D���S)zReturn an iterator over keys.css|]}|j�rt|�VqdS)N)�isdigitr�)�.0r�rrr�	<genexpr>6szMH.iterkeys.<locals>.<genexpr>)�iterr�rr�r)rrrrr64szMH.iterkeyscCstjjtjj|jt|���S)z9Return True if the keyed message exists, False otherwise.)rrr�rrrg)rr#rrrr?9szMH.__contains__cCstt|j���S)z*Return a count of messages in the mailbox.)r�r7r6)rrrrr@=sz
MH.__len__cCs2|js.ttjj|jd�d�|_t|j�d|_dS)zLock the mailbox.z
.mh_sequenceszrb+TN)r�r�rrrrr�r�)rrrrrJAs
zMH.lockcCs(|jr$t|j�t|j�|`d|_dS)z#Unlock the mailbox if it is locked.FN)r�r�r�r�)rrrrrKHs


z	MH.unlockcCsdS)z&Write any pending changes to the disk.Nr)rrrrrIPszMH.flushcCs|jr|j�dS)zFlush and close the mailbox.N)r�rK)rrrrrLTszMH.closecCs@g}x6tj|j�D]&}tjjtjj|j|��r|j|�qW|S)zReturn a list of folder names.)rr�rrr�rr�)rrBr�rrrr�Ys
zMH.list_folderscCsttjj|j|�|jdd�S)z+Return an MH instance for the named folder.F)rr)rrrrrr)rr�rrrr�asz
MH.get_foldercCsttjj|j|�|jd�S)z:Create a folder and return an MH instance representing it.)r)rrrrrr)rr�rrrr�fsz
MH.add_foldercCs`tjj|j|�}tj|�}|dgkr:tjtjj|d��n|gkrDntd|j��tj|�dS)z-Delete the named folder, which must be empty.z
.mh_sequenceszFolder not empty: %sN)rrrrr�r$rr�)rr�rZentriesrrrr�ks

zMH.remove_folderc
si}ttjj|jd�ddd���}t|j���x�|D]�}y�|jd�\}}t�}xT|j�D]H}|j�rr|j	t
|��qVdd�|jd�D�\}}	|jt||	d	��qVW�fd
d�t
|�D�||<t||�dkr�||=Wq2tk
r�td
|j���Yq2Xq2WWdQRX|S)z=Return a name-to-key-list dictionary to define each sequence.z
.mh_sequences�r�ASCII)�encodingr{css|]}t|�VqdS)N)r�)r�xrrrr�sz#MH.get_sequences.<locals>.<genexpr>�-rWcsg|]}|�kr|�qSrr)rr#)�all_keysrr�
<listcomp>�sz$MH.get_sequences.<locals>.<listcomp>rz"Invalid sequence specification: %sN)r�rrrr�setr8r�rr"r�rH�ranger�r�rOr�rstrip)
rZresultsr�rur��contentsr8�specr�r�r)rrrws&

 zMH.get_sequencescCs
ttjj|jd�ddd�}z�tjtj|jtjtjB��x�|j	�D]�\}}t
|�dkrXqB|j|d�d}d}xbtt
|��D]R}|d	|kr�|s�d
}|jd�n*|r�d}|jd||f�n|jd
|�|}q|W|r�|jt|�d�qB|jd�qBWWdt|�XdS)z:Set sequences using the given name-to-key-list dictionary.z
.mh_sequenceszr+r)rrr{NFrWTrz%s %sz %s�
)r�rrrrrLr�r�r
r>r�rdr�rrgr�)r�	sequencesr�r�r8�prevZ
completingr#rrr�
set_sequences�s.zMH.set_sequencesc	CsL|j�}d}g}x�|j�D]�}|d|kr�|j||df�y4tjtjj|jt|��tjj|jt|d���WnHt	t
fk
r�tjtjj|jt|��tjj|jt|d���YnXtjtjj|jt|���|d7}qW|d|_
t|�dkr�dSxB|j�D]6\}}x*|D]"\}}||k�r|||j|�<�qW�qW|j|�dS)z?Re-name messages to eliminate numbering gaps. Invalidates keys.rrWN)rr6r�rr�rrrrgr�r�r��unlinkr�r�r>�indexr$)	rr"r#Zchangesr#r�r�oldr}rrr�pack�s, 

zMH.packcCs||j�}|j�}x<|j�D]0\}}||kr6|j|�q||kr||j|�=qWx|D]}||krT|g||<qTW|j|�dS)z;Inspect a new MHMessage and update sequences appropriately.N)rr>r�r&r$)rr!r#Zpending_sequencesZ
all_sequencesr�r�sequencerrrr�s
zMH._dump_sequences)NT)rwrxryrzrr"r$r(r,r3r/r6r?r@rJrKrIrLr�r�r�r�rr$r(rrrrrr�s.
"c@s�eZdZdZedddddddh�Zd%dd�Zd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd �Zd!d"�Zd#d$�Zd	S)&rzAn Rmail-style Babyl mailbox.�unseen�deletedZfiled�answered�	forwardedZedited�resentNTcCstj||||�i|_dS)zInitialize a Babyl mailbox.N)r�r�_labels)rrrrrrrr�szBabyl.__init__cCs(tj||�}t|t�r$|j�|j|<|S)z$Add message and return assigned key.)r�r"r[r�
get_labelsr/)rr!r#rrrr"�s
z	Babyl.addcCs"tj||�||jkr|j|=dS)z=Remove the keyed message; raise KeyError if it doesn't exist.N)r�r$r/)rr#rrrr$�s
zBabyl.removecCs*tj|||�t|t�r&|j�|j|<dS)z>Replace the keyed message; raise KeyError if it doesn't exist.N)r�r(r[rr0r/)rr#r!rrrr(�s
zBabyl.__setitem__c
Cs|j|�\}}|jj|�|jj�tj�}x4|jj�}|dtksJ|rLP|j|jtd��q.Wtj�}x0|jj�}|tks�|r�P|j|jtd��qlW||jj	�}|dks�t
�|jj|�}|jtd�}t|j
�|�}	|	j|j
��||jk�r|	j|j|�|	S)z4Return a Message representation or raise a KeyError.s*** EOOH ***rQr)r�r�rarnr\r]rcrdrbr�r�rSrrm�set_visibler/�
set_labels)
rr#r�r��original_headersruZvisible_headers�nZbodyr�rrrr,�s0


zBabyl.get_messagec	Cs�|j|�\}}|jj|�|jj�tj�}x4|jj�}|dtksJ|rLP|j|jtd��q.Wx|jj�}|tks||rdPqdW|j	�}||jj
�}|dks�t�|jj|�}|jtd�}||S)z3Return a string representation or raise a KeyError.s*** EOOH ***rQr)
r�r�rarnr\r]rcrdrbrmr�r�rS)	rr#r�r�r3ruZheadersr4rtrrrr3s&


zBabyl.get_bytescCstj|j|�jdt��S)z6Return a file-like representation or raise a KeyError.rQ)r\r]r3rbrc)rr#rrrr/%szBabyl.get_filecCs@|j�t�}x|jj�D]}|j|�qW|j|j�t|�S)z4Return a list of user-defined labels in the mailbox.)r�rr/r<rH�difference_update�_special_labelsr7)r�labelsZ
label_listrrrr0)szBabyl.get_labelscCs>gg}}|jjd�d}g}x�|}|jj�}|jj�}|dtkr�t|�t|�krf|j|tt��|j|�dd�|jj�dd�jd�D�}|j|�q |dks�|dtkr�t|�t|�kr�|j|tt��q |s |j|tt��Pq Wtt	t
||���|_tt	|��|_t|j�|_
|jjdd	�|jj�|_dS)
z0Generate key-to-(start, stop) table of contents.rscSsg|]}|j�r|j��qSr)�strip)r�labelrrrr@sz'Babyl._generate_toc.<locals>.<listcomp>rWN�,�rU)r�rarnr�rcr�r�r�rrrr�r/r�r�)rrrrZlabel_listsrrur7rrrr�2s4



zBabyl._generate_toccCsVdt}|dt7}|j�}dd�|D�}|ddj|�t7}|d7}|j|�dS)	z,Called before writing the mailbox to file f.sBABYL OPTIONS:s
Version: 5css|]}|j�VqdS)N)rM)rr9rrrrUsz*Babyl._pre_mailbox_hook.<locals>.<genexpr>sLabels:r:r;N)rcr0rrd)rr�Zbabylr7rrrr�PszBabyl._pre_mailbox_hookcCs|jdt�dS)z-Called before writing each message to file f.�N)rdrc)rr�rrrr�ZszBabyl._pre_message_hookcCs|jtd�dS)z,Called after writing each message to file f.r;N)rdrc)rr�rrrr�^szBabyl._post_message_hookcCs�|jj�}t|t�r�g}g}x0|j�D]$}||jkr@|j|�q&|j|�q&W|jjd�x |D]}|jjd|j��q`W|jjd�x$|D]}|jjd|j�d�q�W|jjt	�n|jjdt	�t|t
jj��r0t
j�}t
jj|dd�}|j|�|jd�x6|j�}|jj|jd	t	��|d	k�s8|�r
P�q
W|jjd
t	�t|t��r�t
j�}	t
jj|	dd�}
|
j|j��xz|	j�}|jj|jd	t	��|d	k�s�|�r�P�q�WnB|jd�x6|j�}|jj|jd	t	��|d	k�s�|�r�P�q�Wx,|jd�}|�sP|jj|jd	t	���qW�nZt|ttt
jf��r,t|t
j��rhtjdtd
�|j�}t|t��r~|j|�}|jd�d}|ddk�r|jj|d|�jd	t	��|jjd
t	�|jj|d|�jd	t	��|jj||d�jd	t	��n(|jjd
t	t	�|jj|jd	t	���n^t |d��rzt |d��rXtjdtd
�|j!}|j�}
d}x�|j�}|j"d��r�|dd�d	}n|j"d��r�|dd�d	}|jj|jd	t	��|d	k�s�|�rf|�r�d}|jjd
t	�|j|
�nP�qfWx�|j�}|�sP|j"d��r,|dd�t	}n:|j"d��rJ|dd�t	}n|j"d	��rf|dd�t	}|jj|��q�Wnt#dt$|���|jj�}||fS)z0Write message contents and return (start, stop).�1s, s,,� r:s1,,FrrQs*** EOOH ***iz8Use of StringIO input is deprecated, use BytesIO insteadrRs

rUrWNrnrTzDUse of text mode files is deprecated, use a binary mode file insteadTs
rVzInvalid message type: %srZrYrZrYrZrZ)%r�r�r[rr0r6r�rdrMrcr1r!rr\r]r^r_r`rarnrb�get_visiblerSrhrgrirjrkrlrmrPr�rErTrfrprq)rr!r�Zspecial_labelsr7r9Zorig_bufferZorig_generatorruZ
vis_bufferZ
vis_generatorrTZ
body_startZoriginal_posZ
first_passr�rrrr�bs�











zBabyl._install_message)NT)rwrxryrz�	frozensetr6rr"r$r(r,r3r/r0r�r�r�r�r�rrrrr�s 

	
c@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
rz0Message with mailbox-format-specific properties.NcCs�t|tjj�r4|jtj|��t|t�r�|j|�n�t|t�rP|jtj	|��n~t|t
�rl|jtj|��nbt|tj
�r�|jtj|��nDt|d�r�|jtj|��n(|dkr�tjjj|�ntdt|���dS)zInitialize a Message instance.rSNzInvalid message type: %s)r[r1r!r�_become_message�copy�deepcopy�_explain_torhr2rgZmessage_from_stringr\�
TextIOWrapperZmessage_from_filerEZmessage_from_binary_filerrprq)rr!rrrr�s



zMessage.__init__cCs8t|dg�}x&|jD]}||kr|j||j|<qWdS)z0Assume the non-format-specific state of message.�_type_specific_attributesN)�getattr�__dict__)rr!Z
type_specificr�rrrrA�szMessage._become_messagecCst|t�rdStd��dS)z:Copy format-specific state to message insofar as possible.Nz Cannot convert to specified type)r[rrp)rr!rrrrD�s
zMessage._explain_to)N)rwrxryrzrrArDrrrrr�s
c@s|eZdZdZdddgZddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)r	z)Message with Maildir-specific properties.�_subdir�_info�_dateNcCs&d|_d|_tj�|_tj||�dS)z%Initialize a MaildirMessage instance.r}r�N)rIrJr�rKrr)rr!rrrr�s
zMaildirMessage.__init__cCs|jS)zReturn 'new' or 'cur'.)rI)rrrrr��szMaildirMessage.get_subdircCs(|dks|dkr||_ntd|��dS)zSet subdir to 'new' or 'cur'.r}r~z!subdir must be 'new' or 'cur': %sN)rIrO)rr�rrrr�szMaildirMessage.set_subdircCs"|jjd�r|jdd�SdSdS)z*Return as a string the flags that are set.z2,rUNr�)rJro)rrrr�	get_flags
szMaildirMessage.get_flagscCsddjt|��|_dS)z)Set the given flags and unset all others.z2,r�N)rr�rJ)r�flagsrrr�	set_flagsszMaildirMessage.set_flagscCs$|jdjt|j��t|�B��dS)z.Set the given flag(s) without changing others.r�N)rNrrrL)r�flagrrr�add_flagszMaildirMessage.add_flagcCs,|j�r(|jdjt|j��t|���dS)z7Unset the given string flag(s) without changing others.r�N)rLrNrr)rrOrrr�remove_flagszMaildirMessage.remove_flagcCs|jS)z<Return delivery date of message, in seconds since the epoch.)rK)rrrrr�szMaildirMessage.get_datecCs4yt|�|_Wn tk
r.td|��YnXdS)z9Set delivery date of message, in seconds since the epoch.zcan't convert to float: %sN)�floatrKrOrp)rZdaterrrr�"szMaildirMessage.set_datecCs|jS)z%Get the message's "info" as a string.)rJ)rrrrr�)szMaildirMessage.get_infocCs&t|t�r||_ntdt|���dS)z Set the message's "info" string.zinfo must be a string: %sN)r[rgrJrprq)r�inforrrr�-s
zMaildirMessage.set_infocCs�t|t�r8|j|j��|j|j��|j|j���nht|t�r�t	|j��}d|kr`|j
d�|j�dkrv|j
d�d|kr�|j
d�d|kr�|j
d�d|kr�|j
d�|jd	tj
|j���n�t|t��rt	|j��}d|kr�|jd
�d|k�r|jd�d|k�r�|jd�n�t|t��r�t	|j��}d|k�rD|jd
�d|k�rX|jd
�d|k�rl|jd�d|k�r�|jd�nt|t��r�ntdt|���dS)z;Copy Maildir-specific state to message insofar as possible.�S�Rr~�O�T�D�F�Az
MAILER-DAEMONr*�replied�flaggedr+r,�Pr-z$Cannot convert to specified type: %sN)r[r	rNrLr�r�r�r�r�rrPr�r�r�rrr�	add_labelrrprq)rr!rMrrrrD4sN

















zMaildirMessage._explain_to)N)rwrxryrzrFrr�r�rLrNrPrQr�r�r�r�rDrrrrr	�s

c@sZeZdZdZdgZddd�Zdd�Zddd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)r�z/Message with mbox- or MMDF-specific properties.�_fromNcCsV|jdd�t|tjj�rF|j�}|dk	rF|jd�rF|j|dd��tj||�dS)z'Initialize an mboxMMDFMessage instance.z
MAILER-DAEMONTNzFrom rX)r�r[r1r!rr�ror)rr!r�rrrresz_mboxMMDFMessage.__init__cCs|jS)z Return contents of "From " line.)r_)rrrrr�nsz_mboxMMDFMessage.get_fromcCs4|dk	r*|dkrtj�}|dtj|�7}||_dS)z>Set "From " line, formatting and appending time_ if specified.NT� )r�r�r�r_)rr�Ztime_rrrr�rs
z_mboxMMDFMessage.set_fromcCs|jdd�|jdd�S)z*Return as a string the flags that are set.�Statusr�zX-Status)r+)rrrrrLzsz_mboxMMDFMessage.get_flagscCs�t|�}d
\}}x&dD]}||kr||7}|j|�qWx&dD]}||kr>||7}|j|�q>W|djt|��7}y|jd|�Wn tk
r�|jd|�YnXy|jd|�Wn tk
r�|jd|�YnXd	S)
z)Set the given flags and unset all others.r�rUrVrXrYrZrazX-StatusN)r�r�)rUrV)rXrYrZ)rr$rr��replace_headerr&Z
add_header)rrMZstatus_flagsZ
xstatus_flagsrOrrrrN~s&

z_mboxMMDFMessage.set_flagscCs$|jdjt|j��t|�B��dS)z.Set the given flag(s) without changing others.r�N)rNrrrL)rrOrrrrP�sz_mboxMMDFMessage.add_flagcCs4d|ksd|kr0|jdjt|j��t|���dS)z7Unset the given string flag(s) without changing others.razX-Statusr�N)rNrrrL)rrOrrrrQ�sz_mboxMMDFMessage.remove_flagcCs�t|t�r�t|j��}d|kr(|jd�d|kr:|jd�d|krL|jd�d|kr^|jd�d|krp|jd�|d	=|d
=dj|j�j�dd
��}y|j	t
jtj
|d���Wnttfk
r�YnX�n
t|t�r�|j|j��|j|j��n�t|t��rZt|j��}d|k�r$|jd�d|k�r8|jd�d|k�rL|jd�|d	=|d
=n�t|t��r�t|j��}d|k�r�|jd�d|k�r�|jd�d|k�r�|jd�|d	=|d
=nt|t��r�ntdt|���d
S)zACopy mbox- or MMDF-specific state to message insofar as possible.rVr~rYrZrUrTrXrWZstatuszx-statusr`rXNz%a %b %d %H:%M:%S %Yr*r[r\r+r,z$Cannot convert to specified type: %s���)r[r	rrLr�rPrr�r�r��calendarZtimegmr�ZstrptimerO�
OverflowErrorr�rNr�rrrr^rrprq)rr!rMZ
maybe_daterrrrD�s^



















z_mboxMMDFMessage._explain_to)N)N)
rwrxryrzrFrr�r�rLrNrPrQrDrrrrr�`s
	
r�c@seZdZdZdS)r
z&Message with mbox-specific properties.N)rwrxryrzrrrrr
�sc@sHeZdZdZdgZddd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)rz$Message with MH-specific properties.�
_sequencesNcCsg|_tj||�dS)z!Initialize an MHMessage instance.N)rfrr)rr!rrrr�szMHMessage.__init__cCs|jdd�S)z4Return a list of sequences that include the message.N)rf)rrrrr�szMHMessage.get_sequencescCst|�|_dS)z3Set the list of sequences that include the message.N)r7rf)rr"rrrr$�szMHMessage.set_sequencescCs6t|t�r"||jkr2|jj|�ntdt|���dS)z8Add sequence to list of sequences including the message.zsequence type must be str: %sN)r[rgrfr�rprq)rr)rrrr�s

zMHMessage.add_sequencecCs*y|jj|�Wntk
r$YnXdS)zARemove sequence from the list of sequences including the message.N)rfr$rO)rr)rrr�remove_sequence�szMHMessage.remove_sequencecCsJt|t�rdt|j��}d|kr*|jd�n|jd�|jd�d|krP|jd�d|krb|jd�n�t|t�r�t|j��}d|kr�|jd�n
|jd	�d|kr�|jd�d|kr�|jd
�n�t|t�r�x||j�D]}|j|�q�Wn`t|t	��r(t|j��}d|k�r|j
d�d|k�rF|j
d�nt|t��r6ntdt
|���d
S)z6Copy MH-specific state to message insofar as possible.r*r~rTr\rYr[rU�ROrVrZr,z$Cannot convert to specified type: %sN)r[r	rrr�rPr�rrrr^rrprq)rr!r"r)rrrrD�s@










zMHMessage._explain_to)N)rwrxryrzrFrrr$rrgrDrrrrr�s
c@sbeZdZdZddgZddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)rz'Message with Babyl-specific properties.r/�_visibleNcCsg|_t�|_tj||�dS)z#Initialize a BabylMessage instance.N)r/rrir)rr!rrrr"szBabylMessage.__init__cCs|jdd�S)z'Return a list of labels on the message.N)r/)rrrrr0(szBabylMessage.get_labelscCst|�|_dS)z&Set the list of labels on the message.N)r7r/)rr7rrrr2,szBabylMessage.set_labelscCs6t|t�r"||jkr2|jj|�ntdt|���dS)z+Add label to list of labels on the message.zlabel must be a string: %sN)r[rgr/r�rprq)rr9rrrr^0s

zBabylMessage.add_labelcCs*y|jj|�Wntk
r$YnXdS)z4Remove label from the list of labels on the message.N)r/r$rO)rr9rrr�remove_label8szBabylMessage.remove_labelcCs
t|j�S)z3Return a Message representation of visible headers.)rri)rrrrr??szBabylMessage.get_visiblecCst|�|_dS)z2Set the Message representation of visible headers.N)rri)rZvisiblerrrr1CszBabylMessage.set_visiblecCsjx6|jj�D](}||kr,|jj|||�q|j|=qWx,dD]$}||kr>||jkr>|||j|<q>WdS)	z9Update and/or sensibly generate a set of visible headers.�Date�From�Reply-To�To�CC�SubjectN)rkrlrmrnrorp)rir8rb)r�headerrrr�update_visibleGs
zBabylMessage.update_visiblecCsvt|t�r~t|j��}d|kr*|jd�n|jd�|jd�d|ksNd|krX|jd�d|krj|jd�d	|kr||jd
�n�t|t�r�t|j��}d|kr�|jd�n
|jd�d	|kr�|jd
�d|kr�|jd�n�t|t��rt|j��}d|k�r|jd�d|k�rr|jd�nXt|t	��rT|j
|j��x<|j�D]}|j|��q>Wnt|t
��rbntdt|���dS)z9Copy Babyl-specific state to message insofar as possible.r*r~rTr-r.r]r,rUr+rWrhrVrXrZr[z$Cannot convert to specified type: %sN)r[r	rr0r�rPr�rrrr1r?r^rrprq)rr!r7r9rrrrDRsF










zBabylMessage._explain_to)N)rwrxryrzrFrr0r2r^rjr?r1rrrDrrrrrs
c@seZdZdZdS)r
z&Message with MMDF-specific properties.N)rwrxryrzrrrrr
|sc@s�eZdZdZd&dd�Zd'dd�Zd(dd�Zd)d	d
�Zd*dd�Zd
d�Z	dd�Z
d+dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zed$d%��ZdS),r�zA read-only wrapper of a file.NcCs$||_|dkr|j�|_n||_dS)zInitialize a _ProxyFile.N)r�r��_pos)rr��posrrrr�sz_ProxyFile.__init__cCs|j||jj�S)zRead bytes.)�_readr�rS)r�sizerrrrS�sz_ProxyFile.readcCs|j||jj�S)zRead bytes.)rur��read1)rrvrrrrw�sz_ProxyFile.read1cCs|j||jj�S)zRead a line.)rur�rn)rrvrrrrn�sz_ProxyFile.readlinecCs>g}x4|D],}|j|�|dk	r
|t|�8}|dkr
Pq
W|S)zRead multiple lines.Nr)r�r�)r�sizehintrBrurrr�	readlines�s

z_ProxyFile.readlinesccs x|j�}|sdS|VqWdS)zIterate over lines.N)rn)rrurrrr;�s
z_ProxyFile.__iter__cCs|jS)zReturn the position.)rs)rrrrr��sz_ProxyFile.tellrcCs4|dkr|jj|j�|jj||�|jj�|_dS)zChange position.rWN)r�rarsr�)r�offset�whencerrrra�sz_ProxyFile.seekc
Cs0t|d�r,zt|jd�r"|jj�Wd|`XdS)zClose the file.r�rLN)rEr�rL)rrrrrL�s

z_ProxyFile.closecCs2|dkrd}|jj|j�||�}|jj�|_|S)z"Read size bytes using read_method.NrWrZ)r�rarsr�)rrv�read_methodrBrrrru�sz_ProxyFile._readcCs|S)z$Context management protocol support.r)rrrr�	__enter__�sz_ProxyFile.__enter__cGs|j�dS)N)rL)r�excrrr�__exit__�sz_ProxyFile.__exit__cCs
|jj�S)N)r��readable)rrrrr��sz_ProxyFile.readablecCs
|jj�S)N)r��writable)rrrrr��sz_ProxyFile.writablecCs
|jj�S)N)r��seekable)rrrrr��sz_ProxyFile.seekablecCs
|jj�S)N)r�rI)rrrrrI�sz_ProxyFile.flushcCs&t|d�sdSt|jd�sdS|jjS)Nr�TrF)rEr�r)rrrrr�s

z_ProxyFile.closed)N)N)N)N)N)r)rwrxryrzrrSrwrnryr;r�rarLrur}rr�r�r�rI�propertyrrrrrr��s$





		r�c@s<eZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
�ZdS)r�z&A read-only wrapper of part of a file.NcCstj|||�||_||_dS)zInitialize a _PartialFile.N)r�r�_start�_stop)rr�r�r�rrrr�sz_PartialFile.__init__cCstj|�|jS)z*Return the position with respect to start.)r�r�r�)rrrrr��sz_PartialFile.tellrcCs<|dkr|j|_d}n|dkr*|j|_d}tj|||�dS)z8Change position, possibly with respect to start or stop.rrWrUN)r�rsr�r�ra)rrzr{rrrra�sz_PartialFile.seekcCsB|j|j}|dkrdS|dks0|dks0||kr4|}tj|||�S)z;Read size bytes using read_method, honoring start and stop.rr�N)r�rsr�ru)rrvr|Z	remainingrrrru�sz_PartialFile._readcCst|d�r|`dS)Nr�)rEr�)rrrrrLs
z_PartialFile.close)NN)r)	rwrxryrzrr�rarurLrrrrr��s


	r�Tc4Cs�d}�yZtrpytj|tjtjB�WnJtk
rn}z.|jtjtjtjfkr\t	d|j
��n�WYdd}~XnX|�r^yt|j
d�}|j�Wn:tk
r�}z|jtjtjfkr�dS�WYdd}~XnXy`yt
j|j
|j
d�d}Wn2ttfk
�rt
j|j
|j
d�d}YnXt
j|j
�Wn0tk
�r\t
j|j
�t	d|j
��YnXWn8t�r|tj|tj�|�r�t
j|j
d��YnXdS)z(Lock file f using lockf and dot locking.Fzlockf: lock unavailable: %sNz.lockTzdot lock unavailable: %s)�fcntl�lockfZLOCK_EXZLOCK_NBr�r�ZEAGAINr�r�rr�r�rLrr�r�r�r�r%r�r$�LOCK_UN)r�r�Zdotlock_doner�Zpre_lockrrrr�
sH
r�cCs8trtj|tj�tjj|jd�r4tj|jd�dS)z*Unlock file f using lockf and dot locking.z.lockN)r�r�r�rrr�r�r$)r�rrrr�4sr�cCs8tj|tjtjBtjBd�}z
t|d�Stj|�XdS)zCCreate a file if it doesn't exist and open for reading and writing.i�zrb+N)rr�r�r	�O_RDWRrL)r�fdrrrr�;s
r�cCs$td|ttj��tj�tj�f�S)zBCreate a temp file based on path and open for reading and writing.z%s.%s.%s.%s)r�r�r�r�r�rr�)rrrrr�Csr�cCs$|j�ttd�r tj|j��dS)z0Ensure changes to file f are physically on disk.�fsyncN)rIrErr��fileno)r�rrrr�Is
r�cCst|�|j�dS)z:Close file f, ensuring all changes are physically on disk.N)r�rL)r�rrrr�Osr�c@seZdZdZdS)rz"Raised for module-specific errors.N)rwrxryrzrrrrrUsc@seZdZdZdS)rz:The specified mailbox does not exist and won't be created.N)rwrxryrzrrrrrXsc@seZdZdZdS)rz>The specified mailbox is not empty and deletion was requested.N)rwrxryrzrrrrr[sc@seZdZdZdS)rz)Another process caused an action to fail.N)rwrxryrzrrrrr^sc@seZdZdZdS)rz)A file appears to have an invalid format.N)rwrxryrzrrrrras)T)0rzrr�rdr�r�rBrjr1Z
email.messageZemail.generatorr\r-r��ImportError�__all__rcrMrrr�r�rrrrr!rr	r�r
rrr
r�r�r�r�r�r�r�r��	Exceptionrrrrrrrrr�<module>sp

h8DB4-3z%mqH_c'
*decimal.cpython-36.opt-2.pyc000064400000000541150335715140011534 0ustar003


 \@�@svy0ddlTddlmZddlmZddlmZWn@ek
rpddlTddlmZddlmZddlmZYnXdS)�)�*)�__doc__)�__version__)�__libmpdec_version__N)Z_decimalrrr�ImportErrorZ
_pydecimal�rr�/usr/lib64/python3.6/decimal.py�<module>s_strptime.cpython-36.opt-2.pyc000064400000027713150335715140012156 0ustar003


 \�`�@s�ddlZddlZddlZddlmZddlmZddlmZddl	m
ZmZ
mZyddlmZWn ek
r�ddlmZYnXgZdd�ZGd	d
�d
e�ZGdd�de�Ze�Ze�ad
Ziadd�Zdd�Z ddd�Z!ddd�Z"ddd�Z#dS)�N)�compile)�
IGNORECASE)�escape)�date�	timedelta�timezone)�
allocate_lockcCstjtj�S)N)�localeZ	getlocale�LC_TIME�rr�!/usr/lib64/python3.6/_strptime.py�_getlangsr
c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�
LocaleTimecCsht�|_|j�|j�|j�|j�|j�t�|jkrDtd��tj	|j	ks\tj
|j
krdtd��dS)Nz$locale changed during initializationz&timezone changed during initialization)r
�lang�_LocaleTime__calc_weekday�_LocaleTime__calc_month�_LocaleTime__calc_am_pm�_LocaleTime__calc_timezone�_LocaleTime__calc_date_time�
ValueError�time�tzname�daylight)�selfrrr�__init__4szLocaleTime.__init__cCs(t|�}|r|jdd�n
|jd�|S)Nr�)�list�insert�append)r�seq�frontrrrZ__padSs

zLocaleTime.__padcCs4dd�td�D�}dd�td�D�}||_||_dS)NcSsg|]}tj|j��qSr)�calendarZday_abbr�lower)�.0�irrr�
<listcomp>_sz-LocaleTime.__calc_weekday.<locals>.<listcomp>�cSsg|]}tj|j��qSr)r!Zday_namer")r#r$rrrr%`s)�range�	a_weekday�	f_weekday)rr(r)rrrZ__calc_weekday\szLocaleTime.__calc_weekdaycCs4dd�td�D�}dd�td�D�}||_||_dS)NcSsg|]}tj|j��qSr)r!Z
month_abbrr")r#r$rrrr%fsz+LocaleTime.__calc_month.<locals>.<listcomp>�
cSsg|]}tj|j��qSr)r!Z
month_namer")r#r$rrrr%gs)r'�a_month�f_month)rr+r,rrrZ__calc_monthdszLocaleTime.__calc_monthcCsNg}x>dD]6}tjddd|dddd	d
f	�}|jtjd|�j��q
W||_dS)
N��i����,�7��Lrz%p)r-r.)r�struct_timer�strftimer"�am_pm)rr7�hour�
time_tuplerrrZ__calc_am_pmks

zLocaleTime.__calc_am_pmc
CsXtjd1�}dddg}tjd
|�j�|d	<tjd|�j�|d<tjd
|�j�|d<d2|jddf|jddf|jddf|jddf|jddfd3d4d5d6d7d8d9d:d;d<d=g}|j	d*d+�|j
D��xvdAD]n\}}||}x$|D]\}}|�r�|j||�}�q�WtjdB�}d-tj||�k�rd.}	nd/}	|jd0|	�||<�q�W|d	|_|d|_
|d|_dS)CN��r/r0r.r1r2r3r4r�%c�%xr-�%X�%�%%z%Az%Bz%az%bz%p�1999�%Y�99�%y�22�%H�44�%M�55�%S�76�%j�17�%d�03�%m�3�2�%w�10�%IcSsg|]}|D]}|df�qqS)z%Zr)r#�	tz_values�tzrrrr%�sz/LocaleTime.__calc_date_time.<locals>.<listcomp>�Z00z%Wz%UZ11)	r:r/r0r.r1r2r3r4r)r>r?)r@rA)rBrC)rDrE)rFrG)rHrI)rJrK)rLrM)rNrO)rPrO)rQrR)rSrT�rr;�r-r<�r3r=)rXrYrZ)	r:r-r/r-r-r-rWr/r)rr5r6r"r)r,r(r+r7�extendr�replace�LC_date_time�LC_date�LC_time)
rr9Z	date_timeZreplacement_pairs�offset�	directiveZcurrent_format�old�newZU_WrrrZ__calc_date_timews4




zLocaleTime.__calc_date_timec
Cszytj�Wntk
r YnXtj|_tj|_tdd|jdj�h�}|jrft|jdj�h�}nt�}||f|_dS)N�utc�gmtrr-)rZtzset�AttributeErrorrr�	frozensetr"r)rZ	no_savingZ
has_savingrrrZ__calc_timezone�szLocaleTime.__calc_timezoneN)
�__name__�
__module__�__qualname__rZ_LocaleTime__padrrrrrrrrrr!s	-rcs6eZdZd
�fdd�	Zdd�Zdd�Zdd	�Z�ZS)�TimeRENcs|r||_nt�|_t�}|jddddddddd	d
ddd
ddd|j|jjd�|j|jjd�|j|jjdd�d�|j|jjdd�d�|j|jj	d�|jdd�|jj
D�d�dd��|jd|jd�j
dd��|jd|j|jj��|jd|j|jj��|jd |j|jj��dS)!Nz)(?P<d>3[0-1]|[1-2]\d|0[1-9]|[1-9]| [1-9])z(?P<f>[0-9]{1,6})z(?P<H>2[0-3]|[0-1]\d|\d)z(?P<I>1[0-2]|0[1-9]|[1-9])z(?P<G>\d\d\d\d)zG(?P<j>36[0-6]|3[0-5]\d|[1-2]\d\d|0[1-9]\d|00[1-9]|[1-9]\d|0[1-9]|[1-9])z(?P<m>1[0-2]|0[1-9]|[1-9])z(?P<M>[0-5]\d|\d)z(?P<S>6[0-1]|[0-5]\d|\d)z(?P<U>5[0-3]|[0-4]\d|\d)z(?P<w>[0-6])z(?P<u>[1-7])z(?P<V>5[0-3]|0[1-9]|[1-4]\d|\d)z(?P<y>\d\d)z(?P<Y>\d\d\d\d)z(?P<z>[+-]\d\d[0-5]\d)�A�ar-�B�b�pcss|]}|D]
}|Vq
qdS)Nr)r#Ztz_namesrVrrr�	<genexpr>�sz"TimeRE.__init__.<locals>.<genexpr>�Zr>)�d�f�H�I�G�j�m�M�S�U�w�u�V�y�Y�zrlrmrnrorprrr>�Wr|�c�x�X)�locale_timer�superr�_TimeRE__seqToREr)r(r,r+r7r�__setitem__�__getitem__r\�patternr]r^r_)rr��base)�	__class__rrr�sB
zTimeRE.__init__cCsRt|tdd�}x|D]}|dkrPqWdSdjdd�|D��}d||f}d|S)	NT)�key�reverser�|css|]}t|�VqdS)N)�	re_escape)r#Zstuffrrrrq�sz#TimeRE.__seqToRE.<locals>.<genexpr>z	(?P<%s>%sz%s))�sorted�len�join)rZ
to_convertra�valueZregexrrrZ	__seqToRE�s	
zTimeRE.__seqToREcCs�d}td�}|jd|�}td�}|jd|�}xLd|krx|jd�d}d||d|d�|||f}||dd�}q.Wd	||fS)
Nrz([\\.^$*+?\(\){}\[\]|])z\\\1z\s+z\\s+r>r-z%s%s%sz%s%s)�
re_compile�sub�index)r�formatZprocessed_formatZregex_charsZwhitespace_replacementZdirective_indexrrrr��s
zTimeRE.patterncCst|j|�t�S)N)r�r�r)rr�rrrrszTimeRE.compile)N)rhrirjrr�r�r�
__classcell__rr)r�rrk�s.rk�cCslt|dd�j�}|s,|dd}|dd}d|d}|dkrLd||S|d|d}d||SdS)Nr-r&r)�
datetime_date�weekday)�year�week_of_yearZday_of_week�week_starts_MonZ
first_weekdayZ
week_0_lengthZdays_to_weekrrr�_calc_julian_from_U_or_Wsr�cCsdt|dd�j�d}|d||}|dkr\|t|dd�j�7}|d8}|t|dd�j�8}||fS)Nr-�r/r&)r�Z
isoweekday�	toordinal)�iso_year�iso_weekZiso_weekdayZ
correctionZordinalrrr�_calc_julian_from_V1sr��%a %b %d %H:%M:%S %Yc' Cslx:t||g�D]*\}}t|t�sd}t|j|t|����qWt��tj}t	�|j
ksltj|jksltj
|j
kr�t�atj�tj}tt�tkr�tj�tj|�}|�s,ytj|�}Wnptk
�r}z0|jd}|dkr�d}~td||f�d�WYdd}~Xn$tk
�r"td|�d�YnX|t|<WdQRX|j|�}	|	�sVtd||f��t|�|	j�k�r�td||	j�d���d}
}d	}}
d}}}}d9}d}d}}d}d}}|	j�}�x�|j�D�]�}|d
k�rt|d
�}|dk�r|d7}n|d
7}�q�|dk�r&t|d�}�q�|dk�r@t|d�}
�q�|dk�rZt|d�}�q�|dk�r||jj|dj ��}�q�|dk�r�|j!j|dj ��}�q�|dk�r�t|d�}
�q�|dk�r�t|d�}�q�|dk�rBt|d�}|jdd�j �}|d|j"dfk�r|dk�r>d}n"||j"d	k�rT|dk�rT|d7}�q�|dk�r\t|d�}�q�|dk�rvt|d�}�q�|dk�r�|d}|ddt|�7}t|�}�q�|dk�r�|j#j|dj ��}�q�|dk�r�|j$j|dj ��}�q�|d k�rt|d �}|dk�rd}n|d	8}�q�|d!k�r@t|d!�}|d	8}�q�|d"k�rZt|d"�}�q�|d:k�r�t||�}|d#k�r�d}nd}n�|d%k�r�t|d%�}n�|d&k�r�|d&}t|d	d'��d(t|d'd)��}|j%d*��rT|}nl|d+k�r�|d+j �}xTt|j&�D]F\}} || k�r
tjdtjd	k�rHtj
�rH|d;k�rHPn|}P�q
W�q�W|dk�r�|
dk	�r�|dk�s�|dk�r�td.��|dk	�r�td/��n0|dk�r�|dk	�r�|dk�r�td0��ntd1��d2}!|dk�r�|d3k�r�|
d4k�r�d5}d6}!n|dk�rd
}|dk�r�|dk	�r�|dk	�rH|dk�r4d6nd2}"t'||||"�}n(|
dk	�rp|dk	�rpt(|
||d	�\}}|dk	�r�|dk�r�|d	8}t)j*|��r�d7nd8}#||#7}|dk�r�t+|||
�j,�t+|d	d	�j,�d	}n0t+j-|d	t+|d	d	�j,��}$|$j.}|$j/}|$j0}
|dk�r"t+|||
�j1�}|jd+�}%|dk	�r@|d(}&nd}&|!�rNd
}|||
|||||||%|&f|fS)<Nz*strptime() argument {} must be str, not {}r�\r>z&'%s' is a bad directive in format '%s'zstray %% in format '%s'z%time data %r does not match format %rzunconverted data remains: %sr-r��Di�ilr�rwryrnrorsrurvrpr�rzr{rt�0rWrlrmr}r~rxr|r�rr�r/�<r��-rrrdrezzISO year directive '%G' must be used with the ISO week directive '%V' and a weekday directive ('%A', '%a', '%w', or '%u').z`Day of the year directive '%j' is not compatible with ISO year directive '%G'. Use '%Y' instead.zzISO week directive '%V' must be used with the ISO year directive '%G' and a weekday directive ('%A', '%a', '%w', or '%u').zdISO week directive '%V' is incompatible with the year directive '%Y'. Use the ISO year '%G' instead.Fr3�ipTinim���)r|r�)rdre)2�	enumerate�
isinstance�str�	TypeErrorr��type�_cache_lock�
_TimeRE_cacher�r
rrrrrk�_regex_cache�clearr��_CACHE_MAX_SIZE�getr�KeyError�argsr�
IndexError�match�end�	groupdict�keys�intr,r�r"r+r7r)r(�
startswithrr�r�r!Zisleapr�r�Zfromordinalr��month�dayr�)'�data_stringr�r��arg�msgr�Zformat_regex�errZ
bad_directive�foundr�r�r�r�r8Zminute�second�fractionrVZtzoffsetr�r�Zweek_of_year_startr�ZjulianZ
found_dictZ	group_keyZampm�sr�Z
found_zoner�rUZ
leap_year_fixr�ZydayZdatetime_resultr�gmtoffrrr�	_strptimeAsB





























$








&



r�cCs"t||�d}tj|dtj��S)Nr)r�rr5Z_STRUCT_TM_ITEMS)r�r��ttrrr�_strptime_time,sr�c
Cslt||�\}}|dd�\}}|dd�|f}|dk	rdt|d�}|rRt||�}	nt|�}	||	f7}||�S)Nr3rW)Zseconds���)r��datetime_timedelta�datetime_timezone)
�clsr�r�r�r�rr�r�ZtzdeltarVrrr�_strptime_datetime2s

r�)r�)r�)r�)$rr	r!�rerr�rrr�Zdatetimerr�rr�rr��_threadrZ_thread_allocate_lock�ImportErrorZ
_dummy_thread�__all__r
�objectr�dictrkr�r�r�r�r�r�r�r�r�rrrr�<module>
s2_
l
tracemalloc.cpython-36.opt-2.pyc000064400000036707150335715140012441 0ustar003


 \A�@sddlmZmZddlmZddlZddlZddlZddl	Z	ddl
Tddl
mZmZdd�Z
Gdd	�d	�ZGd
d�d�Zdd
�ZeGdd�d��ZeGdd�de��Zdd�ZGdd�d�ZGdd�de�Zdd�ZGdd�d�ZGdd�de�ZGdd�de�ZGd d!�d!�Zd"d#�ZdS)$�)�Sequence�Iterable)�total_orderingN)�*)�_get_object_traceback�_get_tracescCszxtd
D]l}t|�dkr:|dkr:|r.d||fSd||fSt|�dksN|dkrj|r^d||fSd||fS|d
}qWdS)N�B�KiB�MiB�GiB�TiB�dz%+.1f %sz%.1f %s�
iz%+.0f %sz%.0f %s)rr	r
rri()�abs)�sizeZsignZunit�r�#/usr/lib64/python3.6/tracemalloc.py�_format_size
s
rc@s@eZdZdZdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�	Statistic�	tracebackr�countcCs||_||_||_dS)N)rrr)�selfrrrrrr�__init__%szStatistic.__init__cCst|j|j|jf�S)N)�hashrrr)rrrr�__hash__*szStatistic.__hash__cCs$|j|jko"|j|jko"|j|jkS)N)rrr)r�otherrrr�__eq__-szStatistic.__eq__cCsBd|jt|jd�|jf}|jr>|j|j}|dt|d�7}|S)Nz%s: size=%s, count=%iFz, average=%s)rrrr)r�text�averagerrr�__str__2s

zStatistic.__str__cCsd|j|j|jfS)Nz)<Statistic traceback=%r size=%i count=%i>)rrr)rrrr�__repr__<szStatistic.__repr__cCs|j|j|jfS)N)rrr)rrrr�	_sort_key@szStatistic._sort_keyN)rrr)
�__name__�
__module__�__qualname__�	__slots__rrrrr r!rrrrrs
rc@s@eZdZdZdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Z	dS)�
StatisticDiffrr�	size_diffr�
count_diffcCs"||_||_||_||_||_dS)N)rrr'rr()rrrr'rr(rrrrKs
zStatisticDiff.__init__cCst|j|j|j|j|jf�S)N)rrrr'rr()rrrrrRszStatisticDiff.__hash__cCs<|j|jko:|j|jko:|j|jko:|j|jko:|j|jkS)N)rrr'rr()rrrrrrVs
zStatisticDiff.__eq__cCsPd|jt|jd�t|jd�|j|jf}|jrL|j|j}|dt|d�7}|S)Nz %s: size=%s (%s), count=%i (%+i)FTz, average=%s)rrrr'rr()rrrrrrr]s


zStatisticDiff.__str__cCsd|j|j|j|j|jfS)Nz9<StatisticDiff traceback=%r size=%i (%+i) count=%i (%+i)>)rrr'rr()rrrrr iszStatisticDiff.__repr__cCs t|j�|jt|j�|j|jfS)N)rr'rr(rr)rrrrr!nszStatisticDiff._sort_keyN)rrr'rr()
r"r#r$r%rrrrr r!rrrrr&Dsr&cCs�g}xp|j�D]d\}}|j|d�}|dk	rPt||j|j|j|j|j|j�}nt||j|j|j|j�}|j|�qWx6|j�D]*\}}t|d|jd|j�}|j|�q�W|S)Nr)�items�popr&rr�append)�	old_group�	new_group�
statisticsr�statZpreviousrrr�_compare_grouped_statstsr0c@sXeZdZdZdd�Zedd��Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�ZdS)�Frame�_framecCs
||_dS)N)r2)r�framerrrr�szFrame.__init__cCs
|jdS)Nr)r2)rrrr�filename�szFrame.filenamecCs
|jdS)N�)r2)rrrr�lineno�szFrame.linenocCs|j|jkS)N)r2)rrrrrr�szFrame.__eq__cCs|j|jkS)N)r2)rrrrr�__lt__�szFrame.__lt__cCs
t|j�S)N)rr2)rrrrr�szFrame.__hash__cCsd|j|jfS)Nz%s:%s)r4r6)rrrrr�sz
Frame.__str__cCsd|j|jfS)Nz<Frame filename=%r lineno=%r>)r4r6)rrrrr �szFrame.__repr__N)r2)
r"r#r$r%r�propertyr4r6rr7rrr rrrrr1�sr1c@sbeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zddd�Z
dS)�	Traceback�_framescCstj|�||_dS)N)rrr:)r�framesrrrr�s
zTraceback.__init__cCs
t|j�S)N)�lenr:)rrrr�__len__�szTraceback.__len__cCs4t|t�r"tdd�|j|D��St|j|�SdS)Ncss|]}t|�VqdS)N)r1)�.0�tracerrr�	<genexpr>�sz(Traceback.__getitem__.<locals>.<genexpr>)�
isinstance�slice�tupler:r1)r�indexrrr�__getitem__�s
zTraceback.__getitem__cCs|j|jkS)N)r2r:)rr3rrr�__contains__�szTraceback.__contains__cCs
t|j�S)N)rr:)rrrrr�szTraceback.__hash__cCs|j|jkS)N)r:)rrrrrr�szTraceback.__eq__cCs|j|jkS)N)r:)rrrrrr7�szTraceback.__lt__cCst|d�S)Nr)�str)rrrrr�szTraceback.__str__cCsdt|�fS)Nz<Traceback %r>)rC)rrrrr �szTraceback.__repr__NcCsng}|dk	r|dkr|SxP|d|�D]@}|jd|j|jf�tj|j|j�j�}|r&|jd|�q&W|S)Nrz  File "%s", line %sz    %s)r+r4r6�	linecache�getline�strip)r�limit�linesr3�linerrr�format�szTraceback.format)r:)N)r"r#r$r%rr=rErFrrr7rr rNrrrrr9�sr9cCs t|�}|dk	rt|�SdSdS)N)rr9)�objr;rrr�get_object_traceback�srPc@s\eZdZdZdd�Zedd��Zedd��Zedd	��Zd
d�Z	dd
�Z
dd�Zdd�ZdS)�Trace�_tracecCs
||_dS)N)rR)rr?rrrr�szTrace.__init__cCs
|jdS)Nr)rR)rrrr�domain�szTrace.domaincCs
|jdS)Nr5)rR)rrrrr�sz
Trace.sizecCst|jd�S)N�)r9rR)rrrrrszTrace.tracebackcCs|j|jkS)N)rR)rrrrrrszTrace.__eq__cCs
t|j�S)N)rrR)rrrrr
szTrace.__hash__cCsd|jt|jd�fS)Nz%s: %sF)rrr)rrrrr
sz
Trace.__str__cCsd|jt|jd�|jfS)Nz'<Trace domain=%s size=%s, traceback=%r>F)rSrrr)rrrrr szTrace.__repr__N)rR)
r"r#r$r%rr8rSrrrrrr rrrrrQ�srQc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�_TracescCstj|�||_dS)N)rr�_traces)r�tracesrrrrs
z_Traces.__init__cCs
t|j�S)N)r<rV)rrrrr=sz_Traces.__len__cCs4t|t�r"tdd�|j|D��St|j|�SdS)Ncss|]}t|�VqdS)N)rQ)r>r?rrrr@ sz&_Traces.__getitem__.<locals>.<genexpr>)rArBrCrVrQ)rrDrrrrEs
z_Traces.__getitem__cCs|j|jkS)N)rRrV)rr?rrrrF$sz_Traces.__contains__cCs|j|jkS)N)rV)rrrrrr'sz_Traces.__eq__cCsdt|�S)Nz<Traces len=%s>)r<)rrrrr *sz_Traces.__repr__N)	r"r#r$rr=rErFrr rrrrrUsrUcCs&tjj|�}|jd�r"|dd�}|S)Nz.pycr5���)�os�path�normcase�endswith)r4rrr�_normalize_filename.s
r]c@seZdZdd�Zdd�ZdS)�
BaseFiltercCs
||_dS)N)�	inclusive)rr_rrrr6szBaseFilter.__init__cCst�dS)N)�NotImplementedError)rr?rrr�_match9szBaseFilter._matchN)r"r#r$rrarrrrr^5sr^csJeZdZd�fdd�	Zedd��Zdd�Zd	d
�Zdd�Zd
d�Z	�Z
S)�FilterNFcs2t�j|�||_t|�|_||_||_||_dS)N)�superrr_r]�_filename_patternr6�
all_framesrS)rr_�filename_patternr6rerS)�	__class__rrr>s
zFilter.__init__cCs|jS)N)rd)rrrrrfGszFilter.filename_patterncCs6t|�}tj||j�sdS|jdkr(dS||jkSdS)NFT)r]�fnmatchrdr6)rr4r6rrr�_match_frame_implKs
zFilter._match_frame_implcCs|j||�|jAS)N)rir_)rr4r6rrr�_match_frameTszFilter._match_framecsH�jr,t�fdd�|D��r"�jS�jSn|d\}}�j||�SdS)Nc3s|]\}}�j||�VqdS)N)ri)r>r4r6)rrrr@Ysz*Filter._match_traceback.<locals>.<genexpr>r)re�anyr_rj)rrr4r6r)rr�_match_tracebackWs

zFilter._match_tracebackcCsD|\}}}|j|�}|jdk	r@|jr2|o0||jkS|p>||jkS|S)N)rlrSr_)rr?rSrr�resrrrrabs


z
Filter._match)NFN)r"r#r$rr8rfrirjrlra�
__classcell__rr)rgrrb=s	rbcs0eZdZ�fdd�Zedd��Zdd�Z�ZS)�DomainFiltercst�j|�||_dS)N)rcr�_domain)rr_rS)rgrrrnszDomainFilter.__init__cCs|jS)N)rp)rrrrrSrszDomainFilter.domaincCs|\}}}||jk|jAS)N)rSr_)rr?rSrrrrrravs
zDomainFilter._match)r"r#r$rr8rSrarnrr)rgrromsroc@sTeZdZdd�Zdd�Zedd��Zdd�Zd	d
�Zdd�Z	ddd�Z
ddd�ZdS)�SnapshotcCst|�|_||_dS)N)rUrW�traceback_limit)rrWrrrrrr�s
zSnapshot.__init__cCs*t|d��}tj||tj�WdQRXdS)N�wb)�open�pickle�dumpZHIGHEST_PROTOCOL)rr4�fprrrrv�sz
Snapshot.dumpc	Cs t|d��}tj|�SQRXdS)N�rb)rtru�load)r4rwrrrry�sz
Snapshot.loadcs@|rt�fdd�|D��sdS|r<t�fdd�|D��r<dSdS)Nc3s|]}|j��VqdS)N)ra)r>�trace_filter)r?rrr@�sz)Snapshot._filter_trace.<locals>.<genexpr>Fc3s|]}|j��VqdS)N)ra)r>rz)r?rrr@�sT)rk)r�include_filters�exclude_filtersr?r)r?r�
_filter_trace�s

zSnapshot._filter_tracecs�t|t�stdt|�j��|rng�g�x(|D] }|jrD�j|�q.�j|�q.W���fdd��jjD�}n�jjj	�}t
|�j�S)Nz)filters must be a list of filters, not %scsg|]}�j��|�r|�qSr)r})r>r?)r|r{rrr�
<listcomp>�sz*Snapshot.filter_traces.<locals>.<listcomp>)rAr�	TypeError�typer"r_r+rWrV�copyrqrr)r�filtersrzZ
new_tracesr)r|r{rr�
filter_traces�s

zSnapshot.filter_tracesc
Cs�|dkrtd|f��|r.|d	kr.td|��i}i}|�sx�|jjD]�}|\}}}y||}	WnZtk
r�|dkr~|}
n(|dkr�|dd�}
n|dddff}
t|
�}	|	||<YnXy(||	}|j|7_|jd7_WqFtk
�r
t|	|d�||	<YqFXqFWn�x�|jjD]�}|\}}}x�|D]�}y||}	WnFtk
�r�|dk�rd|f}
n|ddff}
t|
�}	|	||<YnXy(||	}|j|7_|jd7_Wn&tk
�r�t|	|d�||	<YnX�q0W�qW|S)
Nrr4r6zunknown key_type: %rz/cumulative mode cannot by used with key type %rr5r)rr4r6)r6r4)�
ValueErrorrWrV�KeyErrorr9rrr)
r�key_type�
cumulativeZstatsZ
tracebacksr?rSrZtrace_tracebackrr;r/r3rrr�	_group_by�sX



"zSnapshot._group_byFcCs,|j||�}t|j��}|jdtjd�|S)NT)�reverse�key)r��list�values�sortrr!)rr�r�Zgroupedr.rrrr.�szSnapshot.statisticscCs6|j||�}|j||�}t||�}|jdtjd�|S)NT)r�r�)r�r0r�r&r!)rZold_snapshotr�r�r-r,r.rrr�
compare_to�s

zSnapshot.compare_toN)F)F)r"r#r$rrv�staticmethodryr}r�r�r.r�rrrrrq{s3

rqcCs$t�std��t�}t�}t||�S)NzLthe tracemalloc module must be tracing memory allocations to take a snapshot)Z
is_tracing�RuntimeErrorrZget_traceback_limitrq)rWrrrrr�
take_snapshots
r�)�collectionsrr�	functoolsrrhrHZos.pathrYruZ_tracemallocrrrrr&r0r1r9rPrQrUr]r^rbrorqr�rrrr�<module>s0&0#5%0	lzma.cpython-36.opt-1.pyc000064400000027332150335715140011107 0ustar003


 \�2�$@s�dZddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$g$Zd%d&lZd%d&lZd%d&lZd%d'lTd%d(lmZmZd%d&lZd%Z	d)Z
d*ZGd+d�dej�Z
d1d&d2d&d&d&d&d&d-�d.d!�Zed3d&d&fd/d"�Zed&d&fd0d#�Zd&S)4aSInterface to the liblzma compression library.

This module provides a class for reading and writing compressed files,
classes for incremental (de)compression, and convenience functions for
one-shot (de)compression.

These classes and functions support both the XZ and legacy LZMA
container formats, as well as raw compressed data streams.
Z
CHECK_NONEZCHECK_CRC32ZCHECK_CRC64ZCHECK_SHA256ZCHECK_ID_MAXZ
CHECK_UNKNOWNZFILTER_LZMA1ZFILTER_LZMA2ZFILTER_DELTAZ
FILTER_X86ZFILTER_IA64Z
FILTER_ARMZFILTER_ARMTHUMBZFILTER_POWERPCZFILTER_SPARC�FORMAT_AUTO�	FORMAT_XZZFORMAT_ALONEZ
FORMAT_RAWZMF_HC3ZMF_HC4ZMF_BT2ZMF_BT3ZMF_BT4Z	MODE_FASTZMODE_NORMALZPRESET_DEFAULTZPRESET_EXTREME�LZMACompressor�LZMADecompressor�LZMAFile�	LZMAError�open�compress�
decompressZis_check_supported�N)�*)�_encode_filter_properties�_decode_filter_properties��c@s�eZdZdZd"dd#ddd�dd�Zdd	�Zed
d��Zdd
�Zdd�Z	dd�Z
dd�Zd%dd�Zd'dd�Z
d)dd�Zd+dd�Zdd�Zejfdd�Zd d!�ZdS),ra@A file object providing transparent LZMA (de)compression.

    An LZMAFile can act as a wrapper for an existing file object, or
    refer directly to a named file on disk.

    Note that LZMAFile provides a *binary* file interface - data read
    is returned as bytes, and data to be written must be given as bytes.
    N�rr)�format�check�preset�filtersc	Cs&d|_d|_t|_|dkrL|dkr*td��|dk	r:td��|dkrFt}t}n@|dkr~|dkr`t}t}t	||||d�|_
d|_ntdj|���t
|tttjf�r�d|kr�|d7}tj||�|_d|_||_n*t|d�s�t|d�r�||_||_ntd��|jtk�r"tj|jtt||d�}tj|�|_dS)a�Open an LZMA-compressed file in binary mode.

        filename can be either an actual file name (given as a str,
        bytes, or PathLike object), in which case the named file is
        opened, or it can be an existing file object to read from or
        write to.

        mode can be "r" for reading (default), "w" for (over)writing,
        "x" for creating exclusively, or "a" for appending. These can
        equivalently be given as "rb", "wb", "xb" and "ab" respectively.

        format specifies the container format to use for the file.
        If mode is "r", this defaults to FORMAT_AUTO. Otherwise, the
        default is FORMAT_XZ.

        check specifies the integrity check to use. This argument can
        only be used when opening a file for writing. For FORMAT_XZ,
        the default is CHECK_CRC64. FORMAT_ALONE and FORMAT_RAW do not
        support integrity checks - for these formats, check must be
        omitted, or be CHECK_NONE.

        When opening a file for reading, the *preset* argument is not
        meaningful, and should be omitted. The *filters* argument should
        also be omitted, except when format is FORMAT_RAW (in which case
        it is required).

        When opening a file for writing, the settings used by the
        compressor can be specified either as a preset compression
        level (with the *preset* argument), or in detail as a custom
        filter chain (with the *filters* argument). For FORMAT_XZ and
        FORMAT_ALONE, the default is to use the PRESET_DEFAULT preset
        level. For FORMAT_RAW, the caller must always specify a filter
        chain; the raw compressor does not support preset compression
        levels.

        preset (if provided) should be an integer in the range 0-9,
        optionally OR-ed with the constant PRESET_EXTREME.

        filters (if provided) should be a sequence of dicts. Each dict
        should have an entry for "id" indicating ID of the filter, plus
        additional entries for options to the filter.
        NFr�rbrzACannot specify an integrity check when opening a file for readingzICannot specify a preset compression level when opening a file for reading�w�wb�a�ab�x�xb)rrrrr
zInvalid mode: {!r}�bT�read�writez6filename must be a str, bytes, file or PathLike object)Ztrailing_errorrr)rr���)rrrrrr)�_fp�_closefp�_MODE_CLOSED�_mode�
ValueErrorr�
_MODE_READr�_MODE_WRITEr�_compressor�_posr�
isinstance�str�bytes�os�PathLike�builtinsr�hasattr�	TypeError�_compressionZDecompressReaderrr�io�BufferedReader�_buffer)	�self�filename�moderrrrZ	mode_code�raw�r9�/usr/lib64/python3.6/lzma.py�__init__1sB,
zLZMAFile.__init__cCs�|jtkrdSzB|jtkr,|jj�d|_n"|jtkrN|jj|jj	��d|_Wdz|j
rd|jj�Wdd|_d|_
t|_XXdS)z�Flush and close the file.

        May be called more than once without error. Once the file is
        closed, any other operation on it will raise a ValueError.
        NF)r#r"r%r4�closer&r rr'�flushr!)r5r9r9r:r<�s




zLZMAFile.closecCs
|jtkS)zTrue if this file is closed.)r#r")r5r9r9r:�closed�szLZMAFile.closedcCs|j�|jj�S)z3Return the file descriptor for the underlying file.)�_check_not_closedr �fileno)r5r9r9r:r@�szLZMAFile.filenocCs|j�o|jj�S)z)Return whether the file supports seeking.)�readabler4�seekable)r5r9r9r:rB�szLZMAFile.seekablecCs|j�|jtkS)z/Return whether the file was opened for reading.)r?r#r%)r5r9r9r:rA�szLZMAFile.readablecCs|j�|jtkS)z/Return whether the file was opened for writing.)r?r#r&)r5r9r9r:�writable�szLZMAFile.writablecCs|j�|jj|�S)z�Return buffered data without advancing the file position.

        Always returns at least one byte of data, unless at EOF.
        The exact number of bytes returned is unspecified.
        )�_check_can_readr4�peek)r5�sizer9r9r:rE�sz
LZMAFile.peekcCs|j�|jj|�S)z�Read up to size uncompressed bytes from the file.

        If size is negative or omitted, read until EOF is reached.
        Returns b"" if the file is already at EOF.
        )rDr4r)r5rFr9r9r:r�sz
LZMAFile.readcCs"|j�|dkrtj}|jj|�S)z�Read up to size uncompressed bytes, while trying to avoid
        making multiple reads from the underlying stream. Reads up to a
        buffer's worth of data if size is negative.

        Returns b"" if the file is at EOF.
        r
)rDr2�DEFAULT_BUFFER_SIZEr4�read1)r5rFr9r9r:rH�szLZMAFile.read1cCs|j�|jj|�S)a
Read a line of uncompressed bytes from the file.

        The terminating newline (if present) is retained. If size is
        non-negative, no more than size bytes will be read (in which
        case the line may be incomplete). Returns b'' if already at EOF.
        )rDr4�readline)r5rFr9r9r:rI�szLZMAFile.readlinecCs:|j�|jj|�}|jj|�|jt|�7_t|�S)z�Write a bytes object to the file.

        Returns the number of uncompressed bytes written, which is
        always len(data). Note that due to buffering, the file on disk
        may not reflect the data written until close() is called.
        )Z_check_can_writer'rr rr(�len)r5�dataZ
compressedr9r9r:r�s
zLZMAFile.writecCs|j�|jj||�S)a�Change the file position.

        The new position is specified by offset, relative to the
        position indicated by whence. Possible values for whence are:

            0: start of stream (default): offset must not be negative
            1: current stream position
            2: end of stream; offset must not be positive

        Returns the new file position.

        Note that seeking is emulated, so depending on the parameters,
        this operation may be extremely slow.
        )Z_check_can_seekr4�seek)r5�offset�whencer9r9r:rL�sz
LZMAFile.seekcCs"|j�|jtkr|jj�S|jS)z!Return the current file position.)r?r#r%r4�tellr()r5r9r9r:rO�s

z
LZMAFile.tell)Nrrr)rr)rr)rr)r)�__name__�
__module__�__qualname__�__doc__r;r<�propertyr>r@rBrArCrErrHrIrr2�SEEK_SETrLrOr9r9r9r:r&s 	T

	



r)rrrr�encoding�errors�newlinecCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|jdd�}	t||	||||d	�}
d|kr�tj|
|||�S|
SdS)
a�Open an LZMA-compressed file in binary or text mode.

    filename can be either an actual file name (given as a str, bytes,
    or PathLike object), in which case the named file is opened, or it
    can be an existing file object to read from or write to.

    The mode argument can be "r", "rb" (default), "w", "wb", "x", "xb",
    "a", or "ab" for binary mode, or "rt", "wt", "xt", or "at" for text
    mode.

    The format, check, preset and filters arguments specify the
    compression settings, as for LZMACompressor, LZMADecompressor and
    LZMAFile.

    For binary mode, this function is equivalent to the LZMAFile
    constructor: LZMAFile(filename, mode, ...). In this case, the
    encoding, errors and newline arguments must not be provided.

    For text mode, an LZMAFile object is created, and wrapped in an
    io.TextIOWrapper instance with the specified encoding, error
    handling behavior, and line ending(s).

    �trzInvalid mode: %rNz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary mode�)rrrr)r$�replacerr2�
TextIOWrapper)r6r7rrrrrVrWrXZlz_modeZbinary_filer9r9r:rs

cCs t||||�}|j|�|j�S)z�Compress a block of data.

    Refer to LZMACompressor's docstring for a description of the
    optional arguments *format*, *check*, *preset* and *filters*.

    For incremental compression, use an LZMACompressor instead.
    )rrr=)rKrrrr�compr9r9r:r6scCsrg}xbt|||�}y|j|�}Wntk
r>|r8Pn�YnX|j|�|jsXtd��|j}|sPqWdj|�S)z�Decompress a block of data.

    Refer to LZMADecompressor's docstring for a description of the
    optional arguments *format*, *check* and *filters*.

    For incremental decompression, use an LZMADecompressor instead.
    zACompressed data ended before the end-of-stream marker was reached�)rr	r�append�eofZunused_data�join)rKrZmemlimitrZresultsZdecomp�resr9r9r:r	Bs 
)rrr)rS�__all__r.r2r,Z_lzmarr
r1r"r%r&Z
BaseStreamrrrrrr	r9r9r9r:�<module>	s2

b-ast.cpython-36.pyc000064400000026672150335715140010002 0ustar003


 \�/�@s�dZddlTd!dd�ZeeefZdd�Zd"dd�Zd
d�Z	dd�Z
d#dd�Zdd�Zdd�Z
d$dd�Zdd�ZGdd�de�ZGdd�de�Zd S)%aH
    ast
    ~~~

    The `ast` module helps Python applications to process trees of the Python
    abstract syntax grammar.  The abstract syntax itself might change with
    each Python release; this module helps to find out programmatically what
    the current grammar looks like and allows modifications of it.

    An abstract syntax tree can be generated by passing `ast.PyCF_ONLY_AST` as
    a flag to the `compile()` builtin function or by using the `parse()`
    function from this module.  The result will be a tree of objects whose
    classes all inherit from `ast.AST`.

    A modified abstract syntax tree can be compiled into a Python code object
    using the built-in `compile()` function.

    Additionally various helper functions are provided that make working with
    the trees simpler.  The main intention of the helper functions and this
    module in general is to provide an easy to use interface for libraries
    that work tightly with the python syntax (template engines for example).


    :copyright: Copyright 2008 by Armin Ronacher.
    :license: Python License.
�)�*�	<unknown>�execcCst|||t�S)zn
    Parse the source into an AST node.
    Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
    )�compileZ
PyCF_ONLY_AST)�source�filename�mode�r	�/usr/lib64/python3.6/ast.py�parsesrcs:t|t�rt|dd�}t|t�r&|j}�fdd���|�S)a
    Safely evaluate an expression node or a string containing a Python
    expression.  The string or node provided may only consist of the following
    Python literal structures: strings, bytes, numbers, tuples, lists, dicts,
    sets, booleans, and None.
    �eval)rcs�t|t�r|jSt|ttf�r$|jSt|t�r4|jSt|t�rNt	t
�|j��St|t�rht
t
�|j��St|t�r�tt
�|j��St|t�r�t�fdd�t|j|j�D��St|t�r�|jSt|t�o�t|jttf��r
�|j�}t|t��rrt|jt��r|
S|Snht|t��rrt|jttf��rr�|j�}�|j �}t|t��rrt|t��rrt|jt��rj||S||St!dt"|���dS)Nc3s"|]\}}�|��|�fVqdS)Nr	)�.0�k�v)�_convertr	r
�	<genexpr>Asz1literal_eval.<locals>._convert.<locals>.<genexpr>zmalformed node or string: )#�
isinstance�Constant�value�StrZBytes�sZNum�nZTuple�tuple�mapZeltsZList�list�Set�setZDict�dict�zip�keys�valuesZNameConstantZUnaryOp�opZUAddZUSub�operand�
_NUM_TYPESZBinOpZAddZSub�left�right�
ValueError�repr)�noder"r$r%)rr	r
r3s>









zliteral_eval.<locals>._convert)r�strrZ
Expression�body)Znode_or_stringr	)rr
�literal_eval(s

"r+TFcs2���fdd��t|t�s*td|jj���|�S)a�
    Return a formatted dump of the tree in *node*.  This is mainly useful for
    debugging purposes.  The returned string will show the names and the values
    for fields.  This makes the code impossible to evaluate, so if evaluation is
    wanted *annotate_fields* must be set to False.  Attributes such as line
    numbers and column offsets are not dumped by default.  If this is wanted,
    *include_attributes* can be set to True.
    cs�t�t�r��fdd�t��D�}d�jjdj�r>dd�|D�ndd�|D��f}�r��jr�||rfdphd7}|dj��fd	d��jD��7}|d
St�t�r�ddj�fdd��D��St��S)
Ncsg|]\}}|�|�f�qSr	r	)r
�a�b)�_formatr	r
�
<listcomp>csz)dump.<locals>._format.<locals>.<listcomp>z%s(%sz, css|]}d|VqdS)z%s=%sNr	)r
�fieldr	r	r
resz(dump.<locals>._format.<locals>.<genexpr>css|]\}}|VqdS)Nr	)r
r,r-r	r	r
rgs� c3s$|]}d|�t�|��fVqdS)z%s=%sN)�getattr)r
r,)r.r(r	r
rks�)z[%s]c3s|]}�|�VqdS)Nr	)r
�x)r.r	r
ros)	r�AST�iter_fields�	__class__�__name__�join�_attributesrr')r(Zfields�rv)r.�annotate_fields�include_attributes)r(r
r.as


zdump.<locals>._formatzexpected AST, got %r)rr5�	TypeErrorr7r8)r(r<r=r	)r.r<r=r
�dumpXs	
r?cCsBx<dD]4}||jkr||jkrt||�rt||t||��qW|S)z�
    Copy source location (`lineno` and `col_offset` attributes) from
    *old_node* to *new_node* if possible, and return *new_node*.
    �lineno�
col_offset)r@rA)r:�hasattr�setattrr2)�new_nodeZold_node�attrr	r	r
�
copy_locationvs


rFcs�fdd���|dd�|S)a{
    When you compile a node tree with compile(), the compiler expects lineno and
    col_offset attributes for every node that supports them.  This is rather
    tedious to fill in for generated nodes, so this helper adds these attributes
    recursively where not already set, by setting them to the values of the
    parent node.  It works recursively starting at *node*.
    csfd|jkr"t|d�s||_n|j}d|jkrDt|d�s>||_n|j}xt|�D]}�|||�qNWdS)Nr@rA)r:rBr@rA�iter_child_nodes)r(r@rA�child)�_fixr	r
rI�s



z#fix_missing_locations.<locals>._fix�rr	)r(r	)rIr
�fix_missing_locations�s
rKrJcCs2x,t|�D] }d|jkr
t|dd�||_q
W|S)z�
    Increment the line number of each node in the tree starting at *node* by *n*.
    This is useful to "move code" to a different location in a file.
    r@r)�walkr:r2r@)r(rrHr	r	r
�increment_lineno�s
rMccs>x8|jD].}y|t||�fVWqtk
r4YqXqWdS)zs
    Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
    that is present on *node*.
    N)�_fieldsr2�AttributeError)r(r0r	r	r
r6�s
r6ccsTxNt|�D]B\}}t|t�r$|Vq
t|t�r
x|D]}t|t�r4|Vq4Wq
WdS)z�
    Yield all direct child nodes of *node*, that is, all fields that are nodes
    and all items of fields that are lists of nodes.
    N)r6rr5r)r(�namer0�itemr	r	r
rG�s



rGcCs�t|ttttf�s"td|jj��|jo6t|jdt	�s<dS|jdj
}t|t�rZ|j}n"t|t
�rxt|j
t�rx|j
}ndS|r�ddl}|j|�}|S)z�
    Return the docstring for the given node or None if no docstring can
    be found.  If the node provided does not have docstrings a TypeError
    will be raised.
    z%r can't have docstringsrN)rZAsyncFunctionDefZFunctionDefZClassDefZModuler>r7r8r*ZExprrrrrr)�inspectZcleandoc)r(Zclean�textrRr	r	r
�
get_docstring�s

rTccs@ddlm}||g�}x$|r:|j�}|jt|��|VqWdS)z�
    Recursively yield all descendant nodes in the tree starting at *node*
    (including *node* itself), in no specified order.  This is useful if you
    only want to modify nodes in place and don't care about the context.
    r)�dequeN)�collectionsrU�popleft�extendrG)r(rUZtodor	r	r
rL�s
rLc@s eZdZdZdd�Zdd�ZdS)�NodeVisitora<
    A node visitor base class that walks the abstract syntax tree and calls a
    visitor function for every node found.  This function may return a value
    which is forwarded by the `visit` method.

    This class is meant to be subclassed, with the subclass adding visitor
    methods.

    Per default the visitor functions for the nodes are ``'visit_'`` +
    class name of the node.  So a `TryFinally` node visit function would
    be `visit_TryFinally`.  This behavior can be changed by overriding
    the `visit` method.  If no visitor function exists for a node
    (return value `None`) the `generic_visit` visitor is used instead.

    Don't use the `NodeVisitor` if you want to apply changes to nodes during
    traversing.  For this a special visitor exists (`NodeTransformer`) that
    allows modifications.
    cCs"d|jj}t|||j�}||�S)z
Visit a node.Zvisit_)r7r8r2�
generic_visit)�selfr(�methodZvisitorr	r	r
�visit�szNodeVisitor.visitcCs\xVt|�D]J\}}t|t�r@x6|D]}t|t�r"|j|�q"Wq
t|t�r
|j|�q
WdS)z9Called if no explicit visitor function exists for a node.N)r6rrr5r])r[r(r0rrQr	r	r
rZ�s



zNodeVisitor.generic_visitN)r8�
__module__�__qualname__�__doc__r]rZr	r	r	r
rY�srYc@seZdZdZdd�ZdS)�NodeTransformera\
    A :class:`NodeVisitor` subclass that walks the abstract syntax tree and
    allows modification of nodes.

    The `NodeTransformer` will walk the AST and use the return value of the
    visitor methods to replace or remove the old node.  If the return value of
    the visitor method is ``None``, the node will be removed from its location,
    otherwise it is replaced with the return value.  The return value may be the
    original node in which case no replacement takes place.

    Here is an example transformer that rewrites all occurrences of name lookups
    (``foo``) to ``data['foo']``::

       class RewriteName(NodeTransformer):

           def visit_Name(self, node):
               return copy_location(Subscript(
                   value=Name(id='data', ctx=Load()),
                   slice=Index(value=Str(s=node.id)),
                   ctx=node.ctx
               ), node)

    Keep in mind that if the node you're operating on has child nodes you must
    either transform the child nodes yourself or call the :meth:`generic_visit`
    method for the node first.

    For nodes that were part of a collection of statements (that applies to all
    statement nodes), the visitor may also return a list of nodes rather than
    just a single node.

    Usually you use the transformer like this::

       node = YourTransformer().visit(node)
    cCs�x�t|�D]�\}}t|t�r|g}xL|D]D}t|t�r`|j|�}|dkrJq&nt|t�s`|j|�q&|j|�q&W||dd�<q
t|t�r
|j|�}|dkr�t||�q
t|||�q
W|S)N)	r6rrr5r]rX�append�delattrrC)r[r(r0Z	old_valueZ
new_valuesrrDr	r	r
rZ.s&







zNodeTransformer.generic_visitN)r8r^r_r`rZr	r	r	r
ra
s"raN)rr)TF)rJ)T)r`Z_astr�int�float�complexr#r+r?rFrKrMr6rGrTrL�objectrYrar	r	r	r
�<module>s

0


%xdrlib.cpython-36.opt-2.pyc000064400000017213150335715140011426 0ustar003


 \�@stddlZddlmZddlmZddddgZGdd�de�ZGd	d�de�Zd
d�Z	Gdd�d�Z
Gd
d�d�ZdS)�N)�BytesIO)�wraps�Error�Packer�Unpacker�ConversionErrorc@s$eZdZdd�Zdd�Zdd�ZdS)rcCs
||_dS)N)�msg)�selfr�r
�/usr/lib64/python3.6/xdrlib.py�__init__szError.__init__cCs
t|j�S)N)�reprr)r	r
r
r�__repr__szError.__repr__cCs
t|j�S)N)�strr)r	r
r
r�__str__sz
Error.__str__N)�__name__�
__module__�__qualname__rrrr
r
r
rrs
c@seZdZdS)rN)rrrr
r
r
rr scst���fdd��}|S)NcsDy
�||�Stjk
r>}zt|jd�d�WYdd}~XnXdS)Nr)�struct�errorr�args)r	�value�e)�functionr
r�result&s
z&raise_conversion_error.<locals>.result)r)rrr
)rr�raise_conversion_error#src@s�eZdZdd�Zdd�Zdd�ZeZedd��Zed	d
��Z	e	Z
dd�Zd
d�ZeZ
edd��Zedd��Zdd�ZeZdd�ZeZeZdd�Zdd�Zdd�ZdS)rcCs|j�dS)N)�reset)r	r
r
rr2szPacker.__init__cCst�|_dS)N)r�_Packer__buf)r	r
r
rr5szPacker.resetcCs
|jj�S)N)r�getvalue)r	r
r
r�
get_buffer8szPacker.get_buffercCs|jjtjd|��dS)Nz>L)r�writer�pack)r	�xr
r
r�	pack_uint=szPacker.pack_uintcCs|jjtjd|��dS)Nz>l)rr rr!)r	r"r
r
r�pack_intAszPacker.pack_intcCs"|r|jjd�n|jjd�dS)Nss)rr )r	r"r
r
r�	pack_boolGszPacker.pack_boolcCs�y|j|d?d@�Wn8ttjfk
rN}zt|jd�d�WYdd}~XnXy|j|d@�Wn8ttjfk
r�}zt|jd�d�WYdd}~XnXdS)N� l��r)r#�	TypeErrorrrrr)r	r"rr
r
r�pack_uhyperKs"zPacker.pack_uhypercCs|jjtjd|��dS)Nz>f)rr rr!)r	r"r
r
r�
pack_floatWszPacker.pack_floatcCs|jjtjd|��dS)Nz>d)rr rr!)r	r"r
r
r�pack_double[szPacker.pack_doublecCsP|dkrtd��|d|�}|ddd}||t|�d}|jj|�dS)Nrz fstring size must be nonnegative���)�
ValueError�lenrr )r	�n�s�datar
r
r�pack_fstring_szPacker.pack_fstringcCs"t|�}|j|�|j||�dS)N)r/r#r3)r	r1r0r
r
r�pack_stringis
zPacker.pack_stringcCs.x|D]}|jd�||�qW|jd�dS)N�r)r#)r	�list�	pack_item�itemr
r
r�	pack_listqs

zPacker.pack_listcCs.t|�|krtd��x|D]}||�qWdS)Nzwrong array size)r/r.)r	r0r6r7r8r
r
r�pack_farrayws
zPacker.pack_farraycCs$t|�}|j|�|j|||�dS)N)r/r#r:)r	r6r7r0r
r
r�
pack_array}s
zPacker.pack_arrayN)rrrrrrZget_bufrr#r$Z	pack_enumr%r(Z
pack_hyperr)r*r3Zpack_fopaquer4Zpack_opaqueZ
pack_bytesr9r:r;r
r
r
rr/s(
c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
e
Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZeZdd�ZeZeZdd �Zd!d"�Zd#d$�Zd%S)&rcCs|j|�dS)N)r)r	r2r
r
rr�szUnpacker.__init__cCs||_d|_dS)Nr)�_Unpacker__buf�_Unpacker__pos)r	r2r
r
rr�szUnpacker.resetcCs|jS)N)r=)r	r
r
r�get_position�szUnpacker.get_positioncCs
||_dS)N)r=)r	Zpositionr
r
r�set_position�szUnpacker.set_positioncCs|jS)N)r<)r	r
r
rr�szUnpacker.get_buffercCs|jt|j�krtd��dS)Nzunextracted data remains)r=r/r<r)r	r
r
r�done�sz
Unpacker.donecCsB|j}|d|_}|j||�}t|�dkr2t�tjd|�dS)Nr,z>Lr)r=r<r/�EOFErrorr�unpack)r	�i�jr2r
r
r�unpack_uint�szUnpacker.unpack_uintcCsB|j}|d|_}|j||�}t|�dkr2t�tjd|�dS)Nr,z>lr)r=r<r/rArrB)r	rCrDr2r
r
r�
unpack_int�szUnpacker.unpack_intcCst|j��S)N)�boolrF)r	r
r
r�unpack_bool�szUnpacker.unpack_boolcCs |j�}|j�}t|�d>|BS)Nr&)rE�int)r	�hi�lor
r
r�
unpack_uhyper�szUnpacker.unpack_uhypercCs|j�}|dkr|d}|S)Nll)rL)r	r"r
r
r�unpack_hyper�szUnpacker.unpack_hypercCsB|j}|d|_}|j||�}t|�dkr2t�tjd|�dS)Nr,z>fr)r=r<r/rArrB)r	rCrDr2r
r
r�unpack_float�szUnpacker.unpack_floatcCsB|j}|d|_}|j||�}t|�dkr2t�tjd|�dS)N�z>dr)r=r<r/rArrB)r	rCrDr2r
r
r�
unpack_double�szUnpacker.unpack_doublecCsT|dkrtd��|j}||ddd}|t|j�kr<t�||_|j|||�S)Nrz fstring size must be nonnegativer+r,)r.r=r/r<rA)r	r0rCrDr
r
r�unpack_fstring�szUnpacker.unpack_fstringcCs|j�}|j|�S)N)rErQ)r	r0r
r
r�
unpack_string�szUnpacker.unpack_stringcCsFg}x<|j�}|dkrP|dkr.td|f��|�}|j|�qW|S)Nrr5z0 or 1 expected, got %r)rEr�append)r	�unpack_itemr6r"r8r
r
r�unpack_list�szUnpacker.unpack_listcCs&g}xt|�D]}|j|��qW|S)N)�rangerS)r	r0rTr6rCr
r
r�
unpack_farray�szUnpacker.unpack_farraycCs|j�}|j||�S)N)rErW)r	rTr0r
r
r�unpack_array�szUnpacker.unpack_arrayN)rrrrrr>r?rr@rErFZunpack_enumrHrLrMrNrPrQZunpack_fopaquerRZ
unpack_opaqueZunpack_bytesrUrWrXr
r
r
rr�s,
)r�ior�	functoolsr�__all__�	Exceptionrrrrrr
r
r
r�<module>sUcmd.cpython-36.opt-1.pyc000064400000030441150335715140010702 0ustar003


 \:�@s@dZddlZddlZdgZdZejejdZGdd�d�ZdS)a	A generic class to build line-oriented command interpreters.

Interpreters constructed with this class obey the following conventions:

1. End of file on input is processed as the command 'EOF'.
2. A command is parsed out of each line by collecting the prefix composed
   of characters in the identchars member.
3. A command `foo' is dispatched to a method 'do_foo()'; the do_ method
   is passed a single argument consisting of the remainder of the line.
4. Typing an empty line repeats the last command.  (Actually, it calls the
   method `emptyline', which may be overridden in a subclass.)
5. There is a predefined `help' method.  Given an argument `topic', it
   calls the command `help_topic'.  With no arguments, it lists all topics
   with defined help_ functions, broken into up to three topics; documented
   commands, miscellaneous help topics, and undocumented commands.
6. The command '?' is a synonym for `help'.  The command '!' is a synonym
   for `shell', if a do_shell method exists.
7. If completion is enabled, completing commands will be done automatically,
   and completing of commands args is done by calling complete_foo() with
   arguments text, line, begidx, endidx.  text is string we are matching
   against, all returned matches must begin with it.  line is the current
   input line (lstripped), begidx and endidx are the beginning and end
   indexes of the text being matched, which could be used to provide
   different completion depending upon which position the argument is in.

The `default' method may be overridden to intercept commands for which there
is no do_ method.

The `completedefault' method may be overridden to intercept completions for
commands that have no complete_ method.

The data member `self.ruler' sets the character used to draw separator lines
in the help messages.  If empty, no ruler line is drawn.  It defaults to "=".

If the value of `self.intro' is nonempty when the cmdloop method is called,
it is printed out on interpreter startup.  This value may be overridden
via an optional argument to the cmdloop() method.

The data members `self.doc_header', `self.misc_header', and
`self.undoc_header' set the headers used for the help function's
listings of documented functions, miscellaneous topics, and undocumented
functions respectively.
�N�Cmdz(Cmd) �_c@s�eZdZdZeZeZdZdZ	dZ
dZdZdZ
dZdZd	Zd0dd�Zd1d
d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Z d+d,�Z!d2d.d/�Z"dS)3raA simple framework for writing line-oriented command interpreters.

    These are often useful for test harnesses, administrative tools, and
    prototypes that will later be wrapped in a more sophisticated interface.

    A Cmd instance or subclass instance is a line-oriented interpreter
    framework.  There is no good reason to instantiate Cmd itself; rather,
    it's useful as a superclass of an interpreter class you define yourself
    in order to inherit Cmd's methods and encapsulate action methods.

    �=�Nz(Documented commands (type help <topic>):zMiscellaneous help topics:zUndocumented commands:z*** No help on %s��tabcCs@|dk	r||_ntj|_|dk	r(||_ntj|_g|_||_dS)a�Instantiate a line-oriented interpreter framework.

        The optional argument 'completekey' is the readline name of a
        completion key; it defaults to the Tab key. If completekey is
        not None and the readline module is available, command completion
        is done automatically. The optional arguments stdin and stdout
        specify alternate input and output file objects; if not specified,
        sys.stdin and sys.stdout are used.

        N)�stdin�sys�stdout�cmdqueue�completekey)�selfrrr
�r�/usr/lib64/python3.6/cmd.py�__init__LszCmd.__init__cCs�|j�|jr\|jr\y2ddl}|j�|_|j|j�|j|jd�Wnt	k
rZYnXz�|dk	rl||_
|j
r�|jjt
|j
�d�d}x�|�s6|jr�|jjd�}nl|jr�yt|j�}Wntk
r�d}YnXn<|jj|j�|jj�|jj�}t|��s
d}n
|jd�}|j|�}|j|�}|j||�}q�W|j�Wd|j�r�|j�r�yddl}|j|j�Wnt	k
�r�YnXXdS)z�Repeatedly issue a prompt, accept input, parse an initial prefix
        off the received input, and dispatch to action methods, passing them
        the remainder of the line as argument.

        rNz
: complete�
�EOFz
)�preloop�use_rawinputr�readlineZ
get_completerZ
old_completerZ
set_completer�complete�parse_and_bind�ImportError�intror
�write�strr�pop�input�prompt�EOFError�flushr�len�rstrip�precmd�onecmd�postcmd�postloop)r
rr�stop�linerrr�cmdloopbsN






zCmd.cmdloopcCs|S)z�Hook method executed just before the command line is
        interpreted, but after the input prompt is generated and issued.

        r)r
r(rrrr#�sz
Cmd.precmdcCs|S)z?Hook method executed just after a command dispatch is finished.r)r
r'r(rrrr%�szCmd.postcmdcCsdS)z>Hook method executed once when the cmdloop() method is called.Nr)r
rrrr�szCmd.preloopcCsdS)zYHook method executed once when the cmdloop() method is about to
        return.

        Nr)r
rrrr&�szCmd.postloopcCs�|j�}|sdd|fS|ddkr4d|dd�}n2|ddkrft|d�r\d|dd�}n
dd|fSdt|�}}x"||kr�|||jkr�|d}qvW|d|�||d�j�}}|||fS)	z�Parse the line into a command name and a string containing
        the arguments.  Returns a tuple containing (command, args, line).
        'command' and 'args' may be None if the line couldn't be parsed.
        Nr�?zhelp r�!Zdo_shellzshell )�strip�hasattrr!�
identchars)r
r(�i�n�cmd�argrrr�	parseline�s


z
Cmd.parselinecCs�|j|�\}}}|s|j�S|dkr.|j|�S||_|dkrBd|_|dkrT|j|�Syt|d|�}Wntk
r�|j|�SX||�SdS)ahInterpret the argument as though it had been typed in response
        to the prompt.

        This may be overridden, but should not normally need to be;
        see the precmd() and postcmd() methods for useful execution hooks.
        The return value is a flag indicating whether interpretation of
        commands by the interpreter should stop.

        Nrr�do_)r3�	emptyline�default�lastcmd�getattr�AttributeError)r
r(r1r2�funcrrrr$�s


z
Cmd.onecmdcCs|jr|j|j�SdS)z�Called when an empty line is entered in response to the prompt.

        If this method is not overridden, it repeats the last nonempty
        command entered.

        N)r7r$)r
rrrr5�sz
Cmd.emptylinecCs|jjd|�dS)z�Called on an input line when the command prefix is not recognized.

        If this method is not overridden, it prints an error message and
        returns.

        z*** Unknown syntax: %s
N)r
r)r
r(rrrr6�szCmd.defaultcGsgS)z�Method called to complete an input line when no command-specific
        complete_*() method is available.

        By default, it returns an empty list.

        r)r
�ignoredrrr�completedefault�szCmd.completedefaultcsd|��fdd�|j�D�S)Nr4cs"g|]}|j��r|dd��qS)�N)�
startswith)�.0�a)�dotextrr�
<listcomp>�sz%Cmd.completenames.<locals>.<listcomp>)�	get_names)r
�textr;r)rAr�
completenames�szCmd.completenamesc
Cs�|dkr�ddl}|j�}|j�}t|�t|�}|j�|}|j�|}|dkr�|j|�\}	}
}|	dkrp|j}q�yt|d|	�}Wq�t	k
r�|j}Yq�Xn|j
}|||||�|_y
|j|Stk
r�dSXdS)z�Return the next possible completion for 'text'.

        If a command has not been entered, then complete against command list.
        Otherwise try to call complete_<command> to get list of completions.
        rNrZ	complete_)
rZget_line_buffer�lstripr!Z
get_begidxZ
get_endidxr3r<r8r9rEZcompletion_matches�
IndexError)
r
rD�staterZorigliner(�strippedZbegidxZendidxr1�argsZfooZcompfuncrrrr�s*
zCmd.completecCs
t|j�S)N)�dir�	__class__)r
rrrrCsz
Cmd.get_namescs4t|j���}t�fdd�|j�D��}t||B�S)Nc3s,|]$}|jd�d�r|dd�VqdS)�help_r�N)r>)r?r@)rJrr�	<genexpr> sz$Cmd.complete_help.<locals>.<genexpr>)�setrErC�list)r
rJZcommandsZtopicsr)rJr�
complete_helpszCmd.complete_helpcCs�|r�yt|d|�}Wnvtk
r�y0t|d|�j}|rT|jjdt|��dSWntk
rjYnX|jjdt|j|f��dSX|��n|j�}g}g}i}x,|D]$}|dd�dkr�d||dd�<q�W|j�d}	xx|D]p}|dd�dkr�||	k�rq�|}	|dd�}
|
|k�r8|j	|
�||
=q�t||�j�rR|j	|
�q�|j	|
�q�W|jjdt|j
��|j|j|d	d
�|j|j
t|j��d	d
�|j|j|d	d
�dS)zEList available commands with "help" or detailed help with "help cmd".rMr4z%s
NrNrrr=��P)r8r9�__doc__r
rr�nohelprC�sort�append�
doc_leader�print_topics�
doc_header�misc_headerrQ�keys�undoc_header)r
r2r:�doc�namesZcmds_docZ
cmds_undoc�help�nameZprevnamer1rrr�do_help$sN





zCmd.do_helpcCs\|rX|jjdt|��|jr<|jjdt|jt|���|j||d�|jjd�dS)Nz%s
rr)r
rr�rulerr!�	columnize)r
�headerZcmdsZcmdlenZmaxcolrrrrZRszCmd.print_topicsrTcs��s|jjd�dS�fdd�tt���D�}|rJtddjtt|����t��}|dkrv|jjdt�d	��dSx�tdt���D]�}||d|}g}d
}xrt|�D]f}	d	}
x<t|�D]0}|||	}||kr�P�|}
t|
t|
��}
q�W|j	|
�||
d
7}||kr�Pq�W||kr�Pq�Wt��}d}d	g}x�t|�D]�}g}x@t|�D]4}	|||	}||k�rrd}
n�|}
|j	|
��qRWx|�r�|d�r�|d=�q�Wx,tt|��D]}	||	j
||	�||	<�q�W|jjdtdj|����q@WdS)z�Display a list of strings as a compact set of columns.

        Each column is only as wide as necessary.
        Columns are separated by two spaces (one was not legible enough).
        z<empty>
Ncsg|]}t�|t�s|�qSr)�
isinstancer)r?r/)rQrrrBdsz!Cmd.columnize.<locals>.<listcomp>z list[i] not a string for i in %sz, rz%s
r�rz  ������rj)r
r�ranger!�	TypeError�join�mapr�maxrX�ljust)r
rQZdisplaywidthZ
nonstrings�sizeZnrowsZncolsZ	colwidthsZtotwidth�colZcolwidth�rowr/�xZtextsr)rQrreZsZ

z
Cmd.columnize)rNN)N)rT)#�__name__�
__module__�__qualname__rU�PROMPTr�
IDENTCHARSr.rdr7rrYr[r\r^rVrrr)r#r%rr&r3r$r5r6r<rErrCrRrcrZrerrrrr4s<

4
		.)	rU�stringr	�__all__rxZ
ascii_lettersZdigitsryrrrrr�<module>+s
io.cpython-36.opt-1.pyc000064400000006475150335715140010560 0ustar003


 \�
�@sldZdZdddddddd	d
ddd
ddddddgZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZejZde_dZdZdZGdd�dejejd�ZGdd�deje�ZGdd	�d	eje�ZGdd�deje�Zej e	�x"e
ee
eefD]Z!ej e!��qWxeefD]Z!ej e!��q W[!yddlm"Z"Wne#k
�r\YnXej e"�dS) a�The io module provides the Python interfaces to stream handling. The
builtin open function is defined in this module.

At the top of the I/O hierarchy is the abstract base class IOBase. It
defines the basic interface to a stream. Note, however, that there is no
separation between reading and writing to streams; implementations are
allowed to raise an OSError if they do not support a given operation.

Extending IOBase is RawIOBase which deals simply with the reading and
writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide
an interface to OS files.

BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its
subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer
streams that are readable, writable, and both respectively.
BufferedRandom provides a buffered interface to random access
streams. BytesIO is a simple stream of in-memory bytes.

Another IOBase subclass, TextIOBase, deals with the encoding and decoding
of streams into text. TextIOWrapper, which extends it, is a buffered text
interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO
is an in-memory stream for text.

Argument names are not part of the specification, and only the arguments
of open() are intended to be used as keyword arguments.

data:

DEFAULT_BUFFER_SIZE

   An int containing the default buffer size used by the module's buffered
   I/O classes. open() uses the file's blksize (as obtained by os.stat) if
   possible.
z�Guido van Rossum <guido@python.org>, Mike Verdone <mike.verdone@gmail.com>, Mark Russell <mark.russell@zen.co.uk>, Antoine Pitrou <solipsis@pitrou.net>, Amaury Forgeot d'Arc <amauryfa@gmail.com>, Benjamin Peterson <benjamin@python.org>�BlockingIOError�open�IOBase�	RawIOBase�FileIO�BytesIO�StringIO�BufferedIOBase�BufferedReader�BufferedWriter�BufferedRWPair�BufferedRandom�
TextIOBase�
TextIOWrapper�UnsupportedOperation�SEEK_SET�SEEK_CUR�SEEK_END�N)
�DEFAULT_BUFFER_SIZErrrrrrr	r
rr�IncrementalNewlineDecoderr�io��c@seZdZejjZdS)rN)�__name__�
__module__�__qualname__�_io�_IOBase�__doc__�rr�/usr/lib64/python3.6/io.pyrHs)�	metaclassc@seZdZejjZdS)rN)rrrr�
_RawIOBaserrrrr rKsc@seZdZejjZdS)rN)rrrr�_BufferedIOBaserrrrr rNsc@seZdZejjZdS)r
N)rrrr�_TextIOBaserrrrr r
Qs)�_WindowsConsoleIO)$r�
__author__�__all__r�abcrrrrrrrr	r
rrrr�OpenWrapperrrrrr�ABCMetarr"rr#rr$r
�register�klassr%�ImportErrorrrrr �<module>"s<
<


numbers.cpython-36.pyc000064400000027560150335715140010663 0ustar003


 \(�@s�dZddlmZmZdddddgZGdd�ded	�ZGd
d�de�Zeje�Gdd�de�Z	e	je
�Gdd�de	�ZGd
d�de�Zeje
�dS)z~Abstract Base Classes (ABCs) for numbers, according to PEP 3141.

TODO: Fill out more detailed documentation on the operators.�)�ABCMeta�abstractmethod�Number�Complex�Real�Rational�Integralc@seZdZdZfZdZdS)rz�All numbers inherit from this class.

    If you just want to check if an argument x is a number, without
    caring what kind, use isinstance(x, Number).
    N)�__name__�
__module__�__qualname__�__doc__�	__slots__�__hash__�rr�/usr/lib64/python3.6/numbers.pyrs)�	metaclassc@s�eZdZdZfZedd��Zdd�Zeedd���Z	eedd	���Z
ed
d��Zedd
��Zedd��Z
edd��Zdd�Zdd�Zedd��Zedd��Zedd��Zedd��Zedd��Zed d!��Zed"d#��Zed$d%��Zed&d'��Zd(S))raaComplex defines the operations that work on the builtin complex type.

    In short, those are: a conversion to complex, .real, .imag, +, -,
    *, /, abs(), .conjugate, ==, and !=.

    If it is given heterogenous arguments, and doesn't have special
    knowledge about them, it should fall back to the builtin complex
    type as described below.
    cCsdS)z<Return a builtin complex instance. Called for complex(self).Nr)�selfrrr�__complex__-szComplex.__complex__cCs|dkS)z)True if self != 0. Called for bool(self).rr)rrrr�__bool__1szComplex.__bool__cCst�dS)zXRetrieve the real component of this number.

        This should subclass Real.
        N)�NotImplementedError)rrrr�real5szComplex.realcCst�dS)z]Retrieve the imaginary component of this number.

        This should subclass Real.
        N)r)rrrr�imag>szComplex.imagcCst�dS)zself + otherN)r)r�otherrrr�__add__GszComplex.__add__cCst�dS)zother + selfN)r)rrrrr�__radd__LszComplex.__radd__cCst�dS)z-selfN)r)rrrr�__neg__QszComplex.__neg__cCst�dS)z+selfN)r)rrrr�__pos__VszComplex.__pos__cCs
||S)zself - otherr)rrrrr�__sub__[szComplex.__sub__cCs
||S)zother - selfr)rrrrr�__rsub___szComplex.__rsub__cCst�dS)zself * otherN)r)rrrrr�__mul__cszComplex.__mul__cCst�dS)zother * selfN)r)rrrrr�__rmul__hszComplex.__rmul__cCst�dS)z5self / other: Should promote to float when necessary.N)r)rrrrr�__truediv__mszComplex.__truediv__cCst�dS)zother / selfN)r)rrrrr�__rtruediv__rszComplex.__rtruediv__cCst�dS)zBself**exponent; should promote to float or complex when necessary.N)r)r�exponentrrr�__pow__wszComplex.__pow__cCst�dS)zbase ** selfN)r)r�baserrr�__rpow__|szComplex.__rpow__cCst�dS)z7Returns the Real distance from 0. Called for abs(self).N)r)rrrr�__abs__�szComplex.__abs__cCst�dS)z$(x+y*i).conjugate() returns (x-y*i).N)r)rrrr�	conjugate�szComplex.conjugatecCst�dS)z
self == otherN)r)rrrrr�__eq__�szComplex.__eq__N)r	r
rrr
rrr�propertyrrrrrrrrrr r!r"r$r&r'r(r)rrrrr s.	c@s�eZdZdZfZedd��Zedd��Zedd��Zedd	��Z	ed%dd��Z
d
d�Zdd�Zedd��Z
edd��Zedd��Zedd��Zedd��Zedd��Zdd�Zedd ��Zed!d"��Zd#d$�Zd
S)&rz�To Complex, Real adds the operations that work on real numbers.

    In short, those are: a conversion to float, trunc(), divmod,
    %, <, <=, >, and >=.

    Real also provides defaults for the derived operations.
    cCst�dS)zTAny Real can be converted to a native float object.

        Called for float(self).N)r)rrrr�	__float__�szReal.__float__cCst�dS)aGtrunc(self): Truncates self to an Integral.

        Returns an Integral i such that:
          * i>0 iff self>0;
          * abs(i) <= abs(self);
          * for any Integral j satisfying the first two conditions,
            abs(i) >= abs(j) [i.e. i has "maximal" abs among those].
        i.e. "truncate towards 0".
        N)r)rrrr�	__trunc__�szReal.__trunc__cCst�dS)z$Finds the greatest Integral <= self.N)r)rrrr�	__floor__�szReal.__floor__cCst�dS)z!Finds the least Integral >= self.N)r)rrrr�__ceil__�sz
Real.__ceil__NcCst�dS)z�Rounds self to ndigits decimal places, defaulting to 0.

        If ndigits is omitted or None, returns an Integral, otherwise
        returns a Real. Rounds half toward even.
        N)r)rZndigitsrrr�	__round__�szReal.__round__cCs||||fS)z�divmod(self, other): The pair (self // other, self % other).

        Sometimes this can be computed faster than the pair of
        operations.
        r)rrrrr�
__divmod__�szReal.__divmod__cCs||||fS)z�divmod(other, self): The pair (self // other, self % other).

        Sometimes this can be computed faster than the pair of
        operations.
        r)rrrrr�__rdivmod__�szReal.__rdivmod__cCst�dS)z)self // other: The floor() of self/other.N)r)rrrrr�__floordiv__�szReal.__floordiv__cCst�dS)z)other // self: The floor() of other/self.N)r)rrrrr�
__rfloordiv__�szReal.__rfloordiv__cCst�dS)zself % otherN)r)rrrrr�__mod__�szReal.__mod__cCst�dS)zother % selfN)r)rrrrr�__rmod__�sz
Real.__rmod__cCst�dS)zRself < other

        < on Reals defines a total ordering, except perhaps for NaN.N)r)rrrrr�__lt__�szReal.__lt__cCst�dS)z
self <= otherN)r)rrrrr�__le__�szReal.__le__cCstt|��S)z(complex(self) == complex(float(self), 0))�complex�float)rrrrr�szReal.__complex__cCs|
S)z&Real numbers are their real component.r)rrrrr�sz	Real.realcCsdS)z)Real numbers have no imaginary component.rr)rrrrr�sz	Real.imagcCs|
S)zConjugate is a no-op for Reals.r)rrrrr(szReal.conjugate)N)r	r
rrr
rr+r,r-r.r/r0r1r2r3r4r5r6r7rr*rrr(rrrrr�s(
c@s<eZdZdZfZeedd���Zeedd���Zdd�Z	dS)	rz6.numerator and .denominator should be in lowest terms.cCst�dS)N)r)rrrr�	numeratorszRational.numeratorcCst�dS)N)r)rrrr�denominatorszRational.denominatorcCs|j|jS)afloat(self) = self.numerator / self.denominator

        It's important that this conversion use the integer's "true"
        division rather than casting one side to float before dividing
        so that ratios of huge integers convert without overflowing.

        )r:r;)rrrrr+szRational.__float__N)
r	r
rrr
r*rr:r;r+rrrrrsc@s�eZdZdZfZedd��Zdd�Zed%dd��Zed	d
��Z	edd��Z
ed
d��Zedd��Zedd��Z
edd��Zedd��Zedd��Zedd��Zedd��Zedd��Zdd �Zed!d"��Zed#d$��ZdS)&rz@Integral adds a conversion to int and the bit-string operations.cCst�dS)z	int(self)N)r)rrrr�__int__+szIntegral.__int__cCst|�S)z6Called whenever an index is needed, such as in slicing)�int)rrrr�	__index__0szIntegral.__index__NcCst�dS)a4self ** exponent % modulus, but maybe faster.

        Accept the modulus argument if you want to support the
        3-argument version of pow(). Raise a TypeError if exponent < 0
        or any argument isn't Integral. Otherwise, just implement the
        2-argument version described in Complex.
        N)r)rr#�modulusrrrr$4s	zIntegral.__pow__cCst�dS)z
self << otherN)r)rrrrr�
__lshift__?szIntegral.__lshift__cCst�dS)z
other << selfN)r)rrrrr�__rlshift__DszIntegral.__rlshift__cCst�dS)z
self >> otherN)r)rrrrr�
__rshift__IszIntegral.__rshift__cCst�dS)z
other >> selfN)r)rrrrr�__rrshift__NszIntegral.__rrshift__cCst�dS)zself & otherN)r)rrrrr�__and__SszIntegral.__and__cCst�dS)zother & selfN)r)rrrrr�__rand__XszIntegral.__rand__cCst�dS)zself ^ otherN)r)rrrrr�__xor__]szIntegral.__xor__cCst�dS)zother ^ selfN)r)rrrrr�__rxor__bszIntegral.__rxor__cCst�dS)zself | otherN)r)rrrrr�__or__gszIntegral.__or__cCst�dS)zother | selfN)r)rrrrr�__ror__lszIntegral.__ror__cCst�dS)z~selfN)r)rrrr�
__invert__qszIntegral.__invert__cCstt|��S)zfloat(self) == float(int(self)))r9r=)rrrrr+wszIntegral.__float__cCs|
S)z"Integers are their own numerators.r)rrrrr:{szIntegral.numeratorcCsdS)z!Integers have a denominator of 1.�r)rrrrr;�szIntegral.denominator)N)r	r
rrr
rr<r>r$r@rArBrCrDrErFrGrHrIrJr+r*r:r;rrrrr&s(
N)r�abcrr�__all__rr�registerr8rr9rrr=rrrr�<module>sp
u
_random.cpython-36.opt-2.pyc000064400000030767150335715140011433 0ustar003


 \2k�@s�ddlmZddlmZmZddlm	Z
mZm
ZmZmZddlmZmZmZmZddlmZddlmZ m!Z"ddl#m$Z%ddl&Z'ddl(Z)d	d
ddd
ddddddddddddddddddd gZ*d!ed1�ed#�Z+d#eZ,e
d$�Z-d%e
d&�Z.d'Z/d(e/Z0ddl1Z1Gd)d	�d	e1j2�Z2Gd*d �d e2�Z3d+d,�Z4d2d.d/�Z5e2�Z6e6j7Z7e6j8Z8e6j9Z9e6j:Z:e6j;Z;e6j<Z<e6j=Z=e6j>Z>e6j?Z?e6j@Z@e6jAZAe6jBZBe6jCZCe6jDZDe6jEZEe6jFZFe6jGZGe6jHZHe6jIZIe6jJZJe6jKZKe6jLZLeMd0k�r�e5�dS)3�)�warn)�
MethodType�BuiltinMethodType)�log�exp�pi�e�ceil)�sqrt�acos�cos�sin)�urandom)�Set�Sequence)�sha512N�Random�seed�random�uniform�randint�choice�sample�	randrange�shuffle�
normalvariate�lognormvariate�expovariate�vonmisesvariate�gammavariate�
triangular�gauss�betavariate�
paretovariate�weibullvariate�getstate�setstate�getrandbits�choices�SystemRandom�g�?g@g@g�?g@�5�cseZdZdZd:dd�Zd;�fdd�	Z�fdd	�Z�fd
d�Zdd
�Zdd�Z	dd�Z
ddefdd�Zdd�Z
ede>eeefdd�Zdd�Zd<dd�Zdd�Zd=ddd�d d!�Zd"d#�Zd>d&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Z d8d9�Z!�Z"S)?r�NcCs|j|�d|_dS)N)r�
gauss_next)�self�x�r1�/usr/lib64/python3.6/random.py�__init__Ws
zRandom.__init__r,cs�|dkr�t|ttf�r�t|t�r*|jd�n|}|rBt|d�d>nd}x"tt|�D]}d||Ad@}qRW|t|�N}|d	kr�d
n|}|dkr�t|tttf�r�t|t�r�|j�}|t	|�j
�7}tj|d�}t
�j|�d|_dS)N�zlatin-1r�iCBl����r,�big������)�
isinstance�str�bytes�decode�ord�map�len�	bytearray�encode�_sha512Zdigest�int�
from_bytes�superrr.)r/�a�versionr0�c)�	__class__r1r2r`s
zRandom.seedcs|jt�j�|jfS)N)�VERSIONrEr%r.)r/)rIr1r2r%�szRandom.getstatecs�|d}|dkr*|\}}|_t�j|�nt|dkr�|\}}|_ytdd�|D��}Wn(tk
r|}zt|�WYdd}~XnXt�j|�ntd||jf��dS)Nrr-r,css|]}|dVqdS)r,� Nlr1)�.0r0r1r1r2�	<genexpr>�sz"Random.setstate.<locals>.<genexpr>z?state with version %s passed to Random.setstate() of version %s)r.rEr&�tuple�
ValueError�	TypeErrorrJ)r/�staterGZ
internalstater)rIr1r2r&�szRandom.setstatecCs|j�S)N)r%)r/r1r1r2�__getstate__�szRandom.__getstate__cCs|j|�dS)N)r&)r/rQr1r1r2�__setstate__�szRandom.__setstate__cCs|jf|j�fS)N)rIr%)r/r1r1r2�
__reduce__�szRandom.__reduce__r4c
Cs||�}||krtd��|dkr:|dkr2|j|�Std��||�}||krRtd��||}|dkrx|dkrx||j|�S|dkr�td|||f��||�}||kr�td��|dkr�||d|}	n"|dkr�||d|}	ntd��|	dkr�td��|||j|	�S)	Nz!non-integer arg 1 for randrange()rzempty range for randrange()z non-integer stop for randrange()r4z'empty range for randrange() (%d,%d, %d)z non-integer step for randrange()zzero step for randrange())rO�
_randbelow)
r/�start�stop�step�_intZistartZistop�widthZistep�nr1r1r2r�s4

zRandom.randrangecCs|j||d�S)Nr4)r)r/rF�br1r1r2r�szRandom.randintc
Cs�|j}|j}||�|ks$||�|krN|j�}	||	�}
x|
|krH||	�}
q6W|
S||krltd�||�|�S|dkr|td��||}|||}|�}
x|
|kr�|�}
q�W||
|�|S)Nz�Underlying random() generator does not supply 
enough bits to choose from a population range this large.
To remove the range limitation, add a getrandbits() method.rzBoundary cannot be zero)rr'�
bit_length�_warnrO)
r/r[rC�maxsize�typeZMethodZ
BuiltinMethodrr'�k�rZrem�limitr1r1r2rU�s&


zRandom._randbelowcCs:y|jt|��}Wntk
r0td�d�YnX||S)Nz$Cannot choose from an empty sequence)rUr?rO�
IndexError)r/�seq�ir1r1r2r�s
z
Random.choicecCs�|dkrR|j}x�ttdt|���D]*}||d�}||||||<||<q"WnLt}xFttdt|���D]0}||�|d�}||||||<||<qjWdS)Nr4)rU�reversed�ranger?rC)r/r0r�	randbelowrf�jrYr1r1r2rs	 zRandom.shufflecCs(t|t�rt|�}t|t�s$td��|j}t|�}d|koD|knsRtd��dg|}d}|dkr�|dtt	|dd��7}||kr�t
|�}x�t|�D]0}|||�}	||	||<|||d||	<q�WnRt�}
|
j
}xDt|�D]8}||�}	x|	|
k�r
||�}	q�W||	�||	||<q�W|S)	Nz>Population must be a sequence or set.  For dicts, use list(d).rz,Sample larger than population or is negative��r*r-r4)r9�_SetrN�	_SequencerPrUr?rO�_ceil�_log�listrh�set�add)r/�
populationrarir[�resultZsetsizeZpoolrfrjZselectedZselected_addr1r1r2rs6


z
Random.sample)�cum_weightsracs�|j��dkrN|dkr>t�t�������fdd�t|�D�Sttj|���n|dk	r^td��t��t��krvtd��t	j
��d�t��d�������fdd�t|�D�S)Ncsg|]}�������qSr1r1)rLrf)rYrtr�totalr1r2�
<listcomp>csz"Random.choices.<locals>.<listcomp>z2Cannot specify both weights and cumulative weightsz3The number of weights does not match the populationr4cs$g|]}������d���qS)rr1)rLrf)�bisectrv�hirtrrwr1r2rxlsr7)rrCr?rhrq�
_itertools�
accumulaterPrO�_bisectry)r/rtZweightsrvrar1)rYryrvrzrtrrwr2r(Ws zRandom.choicescCs||||j�S)N)r)r/rFr\r1r1r2rsszRandom.uniform���?cCsx|j�}y |dkrdn||||}Wntk
r<|SX||kr`d|}d|}||}}|||||dS)Ng�?g�?)r�ZeroDivisionError)r/ZlowZhigh�mode�urHr1r1r2r ys	 
zRandom.triangularcCsT|j}x@|�}d|�}t|d|}||d}|t|�krPqW|||S)Ng�?g�?g@)r�
NV_MAGICCONSTrp)r/�mu�sigmar�u1�u2�zZzzr1r1r2r�s

zRandom.normalvariatecCst|j||��S)N)�_expr)r/r�r�r1r1r2r�szRandom.lognormvariatecCstd|j��|S)Ng�?)rpr)r/Zlambdr1r1r2r�szRandom.expovariatecCs�|j}|dkrt|�Sd|}|td||�}xN|�}tt|�}|||}|�}	|	d||ks~|	d|t|�kr6Pq6Wd|}
|
|d|
|}|�}|dkr�|t|�t}
n|t|�t}
|
S)Ng���ư>g�?g�?)r�TWOPI�_sqrt�_cos�_pir��_acos)r/r�Zkappar�srbr�r��dr��q�fZu3Zthetar1r1r2r�s&
$zRandom.vonmisesvariatecCs�|dks|dkrtd��|j}|dkr�td|d�}|t}||}x�|�}d|ko`dknshqHd|�}t|d|�|}	|t|	�}
|||}|||	|
}|td|dks�|t|�krH|
|SqHWn�|dk�r|�}
x|
dk�r|�}
q�Wt|
�|Sx�|�}
t|t}||
}|dk�rD|d|}
nt|||�}
|�}|dk�r|||
|dk�r�Pn|t|
�k�rP�qW|
|SdS)Ngz*gammavariate: alpha and beta must be > 0.0g�?g@gH�����z>g�P���?g@)rOrr��LOG4rpr��
SG_MAGICCONST�_e)r/�alpha�betarZainvZbbbZcccr�r��vr0r�rbr�r\�pr1r1r2r�sJ
 



zRandom.gammavariatecCs`|j}|j}d|_|dkrT|�t}tdtd|���}t|�|}t|�||_|||S)Ng@g�?g�)rr.r�r�rpr��_sin)r/r�r�rr�Zx2piZg2radr1r1r2r!?s
zRandom.gausscCs0|j|d�}|dkrdS|||j|d�SdS)Ng�?rg)r)r/r�r��yr1r1r2r"ts
zRandom.betavariatecCsd|j�}d|d|S)Ng�?)r)r/r�r�r1r1r2r#�szRandom.paretovariatecCs"d|j�}|t|�d|S)Ng�?)rrp)r/r�r�r�r1r1r2r$�szRandom.weibullvariate)N)Nr,)N)N)r~rN)#�__name__�
__module__�__qualname__rJr3rr%r&rRrSrTrCrr�BPFr`�_MethodType�_BuiltinMethodTyperUrrrr(rr rrrrrr!r"r#r$�
__classcell__r1r1)rIr2rGs6
	 ,

:
0H5	c@s4eZdZdd�Zdd�Zdd�Zdd�ZeZZd	S)
r)cCstjtd�d�d?tS)Nr5r6r-)rCrD�_urandom�	RECIP_BPF)r/r1r1r2r�szSystemRandom.randomcCsP|dkrtd��|t|�kr$td��|dd}tjt|�d�}||d|?S)Nrz(number of bits must be greater than zeroz#number of bits should be an integerr5�r6)rOrCrPrDr�)r/raZnumbytesr0r1r1r2r'�szSystemRandom.getrandbitscOsdS)Nr1)r/�args�kwdsr1r1r2r�szSystemRandom.seedcOstd��dS)Nz*System entropy source does not have state.)�NotImplementedError)r/r�r�r1r1r2�_notimplemented�szSystemRandom._notimplementedN)	r�r�r�rr'rr�r%r&r1r1r1r2r)�s

cCs�ddl}t|d|j�d}d}d}d
}|j�}x@t|�D]4}	||�}
||
7}||
|
}t|
|�}t|
|�}q8W|j�}tt||d�ddd�||}t||||�}
td	||
||f�dS)Nr�timesgg _�Br-zsec,� )�endz"avg %g, stddev %g, min %g, max %g
g _��)�time�printr�rh�min�max�roundr�)r[�funcr�r�rwZsqsumZsmallestZlargestZt0rfr0Zt1ZavgZstddevr1r1r2�_test_generator�s&
r���cCs�t|tf�t|td�t|td�t|td
�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�dS)N���?�{�G�z�?皙�����?�@��?��������?�4@�i@�@)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r��UUUUUU�?)r�r�r�)	r�rrrrrr!r"r )�Nr1r1r2�_test�s r��__main__g�)r�)N�warningsrr^�typesrr�rr�Zmathrrprr�rr�rr�r	ror
r�rr�rr�r
r��osrr��_collections_abcrrmrrnZhashlibrrB�	itertoolsr{ryr}�__all__r�r�r�r�r�r�Z_randomrr)r�r�Z_instrrrr rrrrrr(rrrrrr!r"r#r$r%r&r'r�r1r1r1r2�<module>(sl
Y!

socket.cpython-36.opt-1.pyc000064400000052727150335715140011442 0ustar003


 \3k�
@spdZddlZddlTddlZddlZddlZddlZddlmZmZyddl	Z	Wne
k
rhdZ	YnXee	dd�Zee	dd�Z
ee	d	d�Zd
ddd
dgZejeje��ejd
edd��ejdedd��ejdedd��ejdedd��dZdZdd�ZeZejj�jd��r�iZded<ded<ded <d!ed"<d#ed$<d%ed&<d'ed(<d)ed*<d+ed,<d-ed.<d/ed0<d1ed2<d3ed4<d5ed6<d7ed8<ejd9�Gd:d;�d;e�ZGd<d=�d=ej�ZdMd>d
�Z e!ejd?��r�d@dA�Z"ejdA�e!edB��r
de#dfdCdB�Z$ne%e#dfdDdB�Z$ejdB�dEe$_e
ehZ&GdFdG�dGej'�Z(dNdId�Z)e*�Z+e+dfdJd�Z,dOdKdL�Z-dS)Pa0This module provides socket operations and some related functions.
On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
On other systems, it only supports IP. Functions specific for a
socket are available as methods of the socket object.

Functions:

socket() -- create a new socket object
socketpair() -- create a pair of new socket objects [*]
fromfd() -- create a socket object from an open file descriptor [*]
fromshare() -- create a socket object from data received from socket.share() [*]
gethostname() -- return the current hostname
gethostbyname() -- map a hostname to its IP number
gethostbyaddr() -- map an IP number or hostname to DNS info
getservbyname() -- map a service name and a protocol name to a port number
getprotobyname() -- map a protocol name (e.g. 'tcp') to a number
ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order
htons(), htonl() -- convert 16, 32 bit int from host to network byte order
inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format
inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89)
socket.getdefaulttimeout() -- get the default timeout value
socket.setdefaulttimeout() -- set the default timeout value
create_connection() -- connects to an address, with an optional timeout and
                       optional source address.

 [*] not available on all platforms!

Special objects:

SocketType -- type object for socket objects
error -- exception raised for I/O errors
has_ipv6 -- boolean value indicating if IPv6 is supported

IntEnum constants:

AF_INET, AF_UNIX -- socket domains (first argument to socket() call)
SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument)

Integer constants:

Many other constants may be defined; these may be used in calls to
the setsockopt() and getsockopt() methods.
�N)�*)�IntEnum�IntFlag�EBADF�	�EAGAIN��EWOULDBLOCK�fromfd�getfqdn�create_connection�
AddressFamily�
SocketKindcCs|j�o|jd�S)NZAF_)�isupper�
startswith)�C�r�/usr/lib64/python3.6/socket.py�<lambda>LsrcCs|j�o|jd�S)NZSOCK_)rr)rrrrrQsZMsgFlagcCs|j�o|jd�S)NZMSG_)rr)rrrrrVsZAddressInfocCs|j�o|jd�S)NZAI_)rr)rrrrr[sz	127.0.0.1z::1cCs"y||�Stk
r|SXdS)z{Convert a numeric family value to an IntEnum member.

    If it's not a known member, return the numeric value itself.
    N)�
ValueError)�valueZ
enum_klassrrr�_intenum_converterasr�winzThe operation was interrupted.i'zA bad file handle was passed.i'zPermission denied.i'z!A fault occurred on the network??i'z#An invalid operation was attempted.i&'z The socket operation would blocki3'z,A blocking operation is already in progress.i4'zThe network address is in use.i@'zThe connection has been reset.iF'zThe network has been shut down.iJ'zThe operation timed out.iL'zConnection refused.iM'zThe name is too long.iO'zThe host is down.iP'zThe host is unreachable.iQ'�errorTabc@seZdZdS)�_GiveupOnSendfileN)�__name__�
__module__�__qualname__rrrrr�srcs4eZdZdZdddgZeeddfdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
d8dddd�dd�Zeed�r�d9dd�Zn
d:dd�Zd;dd�Zdd �Zd<d!d"�Zd#d$�Zejfd%d&�Zd'd(�Z�fd)d*�Ze�fd+d,��Ze�fd-d.��Zejd/k�rd0d1�Zd2d3�Z nd4d1�Zd5d3�Z d6e_d7e _�Z!S)=�socketz:A subclass of _socket.socket adding the makefile() method.�__weakref__�_io_refs�_closedrNcCs$tjj|||||�d|_d|_dS)NrF)�_socketr�__init__r r!)�self�family�type�proto�filenorrrr#�szsocket.__init__cCs|S)Nr)r$rrr�	__enter__�szsocket.__enter__cGs|js|j�dS)N)r!�close)r$�argsrrr�__exit__�szsocket.__exit__cCs�t|dd�}d|jj|jj|r"dnd|j�|j|j|jf}|s�y |j�}|r^|dt	|�7}Wnt
k
rtYnXy |j�}|r�|dt	|�7}Wnt
k
r�YnX|d7}|S)	zVWrap __repr__() to reveal the real class name and socket
        address(es).
        r!Fz,<%s.%s%s fd=%i, family=%s, type=%s, proto=%iz	 [closed]�z
, laddr=%sz
, raddr=%s�>)�getattr�	__class__rrr(r%r&r'�getsockname�str�errorZgetpeername)r$�closed�sZladdrZraddrrrr�__repr__�s0

zsocket.__repr__cCstd��dS)NzCannot serialize socket object)�	TypeError)r$rrr�__getstate__�szsocket.__getstate__cCs6t|j��}|j|j|j|j|d�}|j|j��|S)z�dup() -> socket object

        Duplicate the socket. Return a new socket object connected to the same
        system resource. The new socket is non-inheritable.
        )r()�dupr(r0r%r&r'�
settimeout�
gettimeout)r$�fd�sockrrrr9�sz
socket.dupcCsZ|j�\}}|jt�jdd�@}t|j||j|d�}t�dkrR|j�rR|j	d�||fS)z�accept() -> (socket object, address info)

        Wait for an incoming connection.  Return a new socket
        representing the connection, and the address of the client.
        For IP sockets, the address info is a pair (hostaddr, port).
        Z
SOCK_NONBLOCKr)r(NT)
Z_acceptr&�globals�getrr%r'Zgetdefaulttimeoutr;�setblocking)r$r<�addrr&r=rrr�accept�s
z
socket.accept�r)�encoding�errors�newlinec
Cs�t|�dddhks td|f��d|k}d|kp4|}d|k}d}	|rN|	d7}	|rZ|	d7}	t||	�}
|jd7_|dkr~d
}|dkr�tj}|dkr�|s�td	��|
S|r�|r�tj|
|
|�}n|r�tj|
|�}ntj|
|�}|r�|Stj	||||�}||_
|S)z�makefile(...) -> an I/O stream connected to the socket

        The arguments are as for io.open() after the filename, except the only
        supported mode values are 'r' (default), 'w' and 'b'.
        rC�w�bz&invalid mode %r (only r, w, b allowed)r-�Nrz!unbuffered streams must be binary���)�setr�SocketIOr �io�DEFAULT_BUFFER_SIZE�BufferedRWPair�BufferedReader�BufferedWriter�
TextIOWrapper�mode)
r$rS�	bufferingrDrErFZwritingZreadingZbinaryZrawmode�raw�buffer�textrrr�makefile�s<
zsocket.makefile�sendfilec2Cs�|j|||�|j�}y|j�}Wn0ttjfk
rR}zt|��WYdd}~XnXytj|�j}Wn*t	k
r�}zt|��WYdd}~XnX|s�dS|s�|n|}|j
�}	|	dkr�td��tt
d�r�t
j�}
nt
j�}
|
j|t
j�d}|
j}tj}
z�x�|	�r||	��rtjd��|�r0||}|dk�r0Py|
||||�}Wn^tk
�rf|	�s`|�w�Yq�t	k
�r�}z|dk�r�t|��|d�WYdd}~Xq�X|dk�r�P||7}||7}q�W|S|dk�r�t|d��r�|j|�XdS)Nrz&non-blocking sockets are not supported�PollSelectorz	timed out�seek)�_check_sendfile_paramsr(�AttributeErrorrM�UnsupportedOperationr�os�fstat�st_size�OSErrorr;r�hasattr�	selectorsrZZSelectSelector�registerZEVENT_WRITEZselectrYr"�timeout�BlockingIOErrorr[)r$�file�offset�countZsocknor(�errZfsize�	blocksizerfZselector�
total_sentZselector_selectZos_sendfile�sentrrr�_sendfile_use_sendfiles`





zsocket._sendfile_use_sendfilecCstd��dS)Nz,os.sendfile() not available on this platform)r)r$rhrirjrrrroGsc
Cs|j|||�|j�dkr"td��|r0|j|�|r>t|d�nd}d}|j}|j}z�x�|rrt|||�}|dkrrPt||��}|s�PxLy||�}	Wntk
r�w�Yq�X||	7}|	t	|�kr�||	d�}q�Pq�WqVW|S|dko�t
|d��r�|j||�XdS)Nrz&non-blocking sockets are not supportedi r[)r\r;rr[�min�read�send�
memoryviewrg�lenrc)
r$rhrirjrlrmZ	file_readZ	sock_send�datarnrrr�_sendfile_use_sendKs<

zsocket._sendfile_use_sendcCsddt|dd�krtd��|jt@s*td��|dk	r`t|t�sJtdj|���|dkr`tdj|���dS)NrHrSz$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})r)r/rr&�SOCK_STREAM�
isinstance�intr7�format)r$rhrirjrrrr\os

zsocket._check_sendfile_paramscCs2y|j|||�Stk
r,|j|||�SXdS)a_sendfile(file[, offset[, count]]) -> sent

        Send a file until EOF is reached by using high-performance
        os.sendfile() and return the total number of bytes which
        were sent.
        *file* must be a regular file object opened in binary mode.
        If os.sendfile() is not available (e.g. Windows) or file is
        not a regular file socket.send() will be used instead.
        *offset* tells from where to start reading the file.
        If specified, *count* is the total number of bytes to transmit
        as opposed to sending the file until EOF is reached.
        File position is updated on return or also in case of error in
        which case file.tell() can be used to figure out the number of
        bytes which were sent.
        The socket must be of SOCK_STREAM type.
        Non-blocking sockets are not supported.
        N)rorrv)r$rhrirjrrrrY|szsocket.sendfilecCs*|jdkr|jd8_|jr&|j�dS)NrrI)r r!r*)r$rrr�_decref_socketios�s
zsocket._decref_socketioscCs|j|�dS)N)r*)r$Z_ssrrr�_real_close�szsocket._real_closecCsd|_|jdkr|j�dS)NTr)r!r r|)r$rrrr*�s
zsocket.closecsd|_t�j�S)adetach() -> file descriptor

        Close the socket object without closing the underlying file descriptor.
        The object cannot be used after this call, but the file descriptor
        can be reused for other purposes.  The file descriptor is returned.
        T)r!�super�detach)r$)r0rrr~�sz
socket.detachcstt�jt�S)z@Read-only access to the address family for this socket.
        )rr}r%r
)r$)r0rrr%�sz
socket.familycstt�jt�S)z-Read-only access to the socket type.
        )rr}r&r)r$)r0rrr&�szsocket.type�ntcCstj|j��S)N)r_Zget_handle_inheritabler()r$rrr�get_inheritable�szsocket.get_inheritablecCstj|j�|�dS)N)r_Zset_handle_inheritabler()r$�inheritablerrr�set_inheritable�szsocket.set_inheritablecCstj|j��S)N)r_r�r()r$rrrr��scCstj|j�|�dS)N)r_r�r()r$r�rrrr��sz&Get the inheritable flag of the socketz&Set the inheritable flag of the socket)rCN)rN)rN)rN)rN)"rrr�__doc__�	__slots__�AF_INETrwr#r)r,r6r8r9rBrXrcr_rorvr\rYr{r"rr|r*r~�propertyr%r&�namer�r��
__classcell__rr)r0rr�s<
	)
A

$


rcCst|�}t||||�S)z� fromfd(fd, family, type[, proto]) -> socket object

    Create a socket object from a duplicate of the given file
    descriptor.  The remaining arguments are the same as for socket().
    )r9r)r<r%r&r'Znfdrrrr
�sZsharecCstddd|�S)z� fromshare(info) -> socket object

        Create a socket object from the bytes object returned by
        socket.share(pid).
        r)r)�inforrr�	fromshare�sr��
socketpairc
Csh|dkr*yt}Wntk
r(t}YnXtj|||�\}}t||||j��}t||||j��}||fS)aasocketpair([family[, type[, proto]]]) -> (socket object, socket object)

        Create a pair of socket objects from the sockets returned by the platform
        socketpair() function.
        The arguments are the same as for socket() except the default family is
        AF_UNIX if defined on the platform; otherwise, the default is AF_INET.
        N)ZAF_UNIX�	NameErrorr�r"r�rr~)r%r&r'�arHrrrr��s
c
Cs|tkrt}n|tkrt}ntd��|tkr4td��|dkrDtd��t|||�}z�|j|df�|j�|j	�dd�\}}t|||�}yP|j
d�y|j||f�Wntt
fk
r�YnX|j
d�|j�\}}	Wn|j��YnXWd|j�X||fS)Nz?Only AF_INET and AF_INET6 socket address families are supportedz)Only SOCK_STREAM socket type is supportedrzOnly protocol zero is supported�FT)r��
_LOCALHOSTZAF_INET6�
_LOCALHOST_V6rrwr�bindZlistenr1r@�connectrg�InterruptedErrorrBr*)
r%r&r'�hostZlsockrA�portZcsockZssock�_rrrr��s8


a8socketpair([family[, type[, proto]]]) -> (socket object, socket object)
Create a pair of socket objects from the sockets returned by the platform
socketpair() function.
The arguments are the same as for socket() except the default family is AF_UNIX
if defined on the platform; otherwise, the default is AF_INET.
cspeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Z�fdd
�Z	dd�Z
edd��Zedd��Z
dd�Z�ZS)rLz�Raw I/O implementation for stream sockets.

    This class supports the makefile() method on sockets.  It provides
    the raw I/O interface on top of a socket object.
    cCsZ|d
krtd|��tjj|�||_d|kr6|d7}||_d|k|_d|k|_d	|_dS)NrCrG�rw�rb�wb�rwbzinvalid mode: %rrHF)rCrGr�r�r�r�)	rrM�	RawIOBaser#�_sock�_mode�_reading�_writing�_timeout_occurred)r$r=rSrrrr#0s

zSocketIO.__init__cCs�|j�|j�|jrtd��xby|jj|�Stk
rHd|_�Yq tk
r|}z|jdt	krjdS�WYdd}~Xq Xq WdS)a3Read up to len(b) bytes into the writable buffer *b* and return
        the number of bytes read.  If the socket is non-blocking and no bytes
        are available, None is returned.

        If *b* is non-empty, a 0 return value indicates that the connection
        was shutdown at the other end.
        z!cannot read from timed out objectTrN)
�_checkClosed�_checkReadabler�rbr�Z	recv_intorfr3r+�_blocking_errnos)r$rH�errr�readinto<szSocketIO.readintocCsX|j�|j�y|jj|�Stk
rR}z|jdtkr@dS�WYdd}~XnXdS)aWrite the given bytes or bytearray object *b* to the socket
        and return the number of bytes written.  This can be less than
        len(b) if not all data could be written.  If the socket is
        non-blocking and no bytes could be written None is returned.
        rN)r��_checkWritabler�rrr3r+r�)r$rHr�rrr�writeSszSocketIO.writecCs|jrtd��|jS)z2True if the SocketIO is open for reading.
        zI/O operation on closed socket.)r4rr�)r$rrr�readablecszSocketIO.readablecCs|jrtd��|jS)z2True if the SocketIO is open for writing.
        zI/O operation on closed socket.)r4rr�)r$rrr�writablejszSocketIO.writablecs|jrtd��t�j�S)z2True if the SocketIO is open for seeking.
        zI/O operation on closed socket.)r4rr}�seekable)r$)r0rrr�qszSocketIO.seekablecCs|j�|jj�S)z=Return the file descriptor of the underlying socket.
        )r�r�r()r$rrrr(xszSocketIO.filenocCs|js|j�SdSdS)NrIrJ)r4r()r$rrrr�~sz
SocketIO.namecCs|jS)N)r�)r$rrrrS�sz
SocketIO.modecCs*|jr
dStjj|�|jj�d|_dS)z�Close the SocketIO object.  This doesn't close the underlying
        socket, except if all references to it have disappeared.
        N)r4rMr�r*r�r{)r$rrrr*�s

zSocketIO.close)rrrr�r#r�r�r�r�r�r(r�r�rSr*r�rr)r0rrLsrLr-cCsp|j�}|s|dkrt�}yt|�\}}}Wntk
rBYn*X|jd|�x|D]}d|krVPqVW|}|S)aGet fully qualified domain name from name.

    An empty argument is interpreted as meaning the local host.

    First the hostname returned by gethostbyaddr() is checked, then
    possibly existing aliases. In case no FQDN is available, hostname
    from gethostname() is returned.
    z0.0.0.0r�.)�stripZgethostnameZ
gethostbyaddrr3�insert)r�Zhostname�aliasesZipaddrsrrrr�s	
cCs�|\}}d}x�t||dt�D]�}|\}}}	}
}d}y>t|||	�}|tk	rR|j|�|r`|j|�|j|�d}|Stk
r�}
z|
}|dk	r�|j�WYdd}
~
XqXqW|dk	r�|�ntd��dS)acConnect to *address* and return the socket object.

    Convenience function.  Connect to *address* (a 2-tuple ``(host,
    port)``) and return the socket object.  Passing the optional
    *timeout* parameter will set the timeout on the socket instance
    before attempting to connect.  If no *timeout* is supplied, the
    global default timeout setting returned by :func:`getdefaulttimeout`
    is used.  If *source_address* is set it must be a tuple of (host, port)
    for the socket to bind as a source address before making the connection.
    A host of '' or port 0 tells the OS to use the default.
    Nrz!getaddrinfo returns an empty list)	�getaddrinforwr�_GLOBAL_DEFAULT_TIMEOUTr:r�r�r3r*)ZaddressrfZsource_addressr�r�rk�res�af�socktyper'�	canonname�sar=r�rrrr�s*


cCsTg}xJtj||||||�D]2}|\}}	}}
}|jt|t�t|	t�||
|f�qW|S)a�Resolve host and port into list of address info entries.

    Translate the host/port argument into a sequence of 5-tuples that contain
    all the necessary arguments for creating a socket connected to that service.
    host is a domain name, a string representation of an IPv4/v6 address or
    None. port is a string service name such as 'http', a numeric port number or
    None. By passing None as the value of host and port, you can pass NULL to
    the underlying C API.

    The family, type and proto arguments can be optionally specified in order to
    narrow the list of addresses returned. Passing zero as a value for each of
    these arguments selects the full range of results.
    )r"r��appendrr
r)r�r�r%r&r'�flagsZaddrlistr�r�r�r�r�rrrr��sr�)r)r-)rrrr).r�r"r_�sysrMrd�enumrr�errno�ImportErrorr/rrr	�__all__�extend�_get_exports_list�_convertrr�r�rrZ_realsocket�platform�lowerrrr��	Exceptionrr
rcr�rwr�r�r�r�rLr�objectr�rr�rrrr�<module>/s� 






C
	
$
u
'pdb.cpython-36.opt-2.pyc000064400000076344150335715140010721 0ustar003


 \���"@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZGdd�de
�Zdddddd	d
ddg	Zd
d�Zdd�Zdd�ZGdd�de�ZdZGdd�dejej�Zedk	�r^ddddddddddd d!d"d#d$d%d&d'dd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6g"Zx*eD]"Zeeed7e�jj�d87Z�q(Weejj7Z[[dHd9d�ZdId:d�Z d;d�Z!d<d	�Z"d=d
�Z#dJd>d�Z$d?d�Z%d@Z&dAdB�Z'dCd�Z(dDZ)dEdF�Z*e+dGk�r�ddl,Z,e,j*�dS)K�Nc@seZdZdS)�RestartN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/pdb.pyrUsr�run�pm�Pdb�runeval�runctx�runcall�	set_trace�post_mortem�helpcCsxtjdtj|��}yt|�}Wntk
r4dSX|�4x,t|dd�D]\}}|j|�rJ|||fSqJWWdQRXdS)Nzdef\s+%s\s*[(]�)�start)�re�compile�escape�open�OSError�	enumerate�match)�funcname�filenameZcre�fp�lineno�linerrr�
find_function\s
rcCsXtj|�\}}tj|�r,|j|jkr,|dfStj|�r>|dfStj||d��|dfS)Nr)�inspectZ
findsourceZisframe�	f_globals�f_localsZismoduleZgetblock)�obj�linesrrrr�getsourcelinesis
r%cCs8ttj|��}|j�x|D]\}}||kr|SqWdS)Nr)�list�disZfindlinestarts�reverse)�codeZlastiZ
linestarts�irrrr�lasti2linenorsr+c@seZdZdd�ZdS)�_rstrcCs|S)Nr)�selfrrr�__repr__}sz_rstr.__repr__N)rrrr.rrrrr,{sr,z
-> c@seZdZdZd�dd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�ZeZd�d8d9�Zd:d;�ZeZ eZ!eZ"d<d=�Z#eZ$d>d?�Z%d@dA�Z&dBdC�Z'eZ(dDdE�Z)eZ*dFdG�Z+eZ,dHdI�Z-eZ.dJdK�Z/e/Z0eZ1eZ2dLdM�Z3e3Z4e3Z5dNdO�Z6dPdQ�Z7e7Z8dRdS�Z9e9Z:dTdU�Z;e;Z<dVdW�Z=e=Z>dXdY�Z?e?Z@dZd[�ZAeAZBd\d]�ZCeCZDd^d_�ZEeEZFZGd`da�ZHeHZIdbdc�ZJeZKddde�ZLeLZMeLZNdfdg�ZOdhdi�ZPePZQdjdk�ZReRZSdldm�ZTd�dndo�ZUdpdq�ZVdrds�ZWeZXeZYeZZdtdu�Z[e[Z\dvdw�Z]e]Z^dxdy�Z_eZ`fdfdzd{�Zad|d}�ZbeZcd~d�ZdeZed�d��Zfd�d��Zgd�d��Zhd�d��Zid�d��Zjd�d��Zkd�d�d�d�d�d�gZld�d��Zmenfd�d��Zod�d��ZpepZqd�d��Zrd�d��Zsd�d��Ztd�d��ZudS)�r
N�tabFTc
$CsJtjj||d�tjj||||�|r,d|_d|_i|_i|_d|_	d|_
i|_yddl}|j
d�Wntk
rzYnXd|_||_g|_|�r(dtjkr�tjd}y.ttjj|d���}	|jj|	�WdQRXWntk
r�YnXy$td��}	|jj|	�WdQRXWntk
�r&YnXi|_i|_i|_d|_d|_dS)	N)�skiprz(Pdb) �Fz 	
`@#$%^&*()=+[{]}\|;:'",<>?�HOMEz.pdbrc)�bdb�Bdb�__init__�cmd�CmdZuse_rawinput�prompt�aliases�
displaying�
mainpyfile�_wait_for_mainpyfile�	tb_lineno�readlineZset_completer_delims�ImportError�allow_kbdint�nosigint�rcLines�os�environr�path�join�extendr�commands�commands_doprompt�commands_silent�commands_defining�
commands_bnum)
r-�completekey�stdin�stdoutr0rAZreadrcr>ZenvHomeZrcFilerrrr5�sH


zPdb.__init__cCs*|jr
t�|jd�|j�|j|�dS)Nz-
Program interrupted. (Use 'cont' to resume).)r@�KeyboardInterrupt�message�set_stepr)r-Zsignum�framerrr�sigint_handler�s

zPdb.sigint_handlercCstjj|�|j�dS)N)r3r4�reset�forget)r-rrrrU�sz	Pdb.resetcCs&d|_g|_d|_d|_|jj�dS)Nr)r�stack�curindex�curframer=�clear)r-rrrrV�s
z
Pdb.forgetcCsl|j�|j||�\|_|_x*|rFt|jj|j�}||j|j<|j	}qW|j|jd|_
|j
j|_|j
�S)Nr)rVZ	get_stackrWrXr+�tb_frame�f_code�tb_lastir=�tb_nextrYr"�curframe_locals�execRcLines)r-�f�tbrrrr�setup�s

z	Pdb.setupcCsh|js
dS|j}|j�g|_xD|rb|j�j�}|r |ddkr |j|�r |jt|�7_dSq WdS)Nr�#T)rBr(�pop�strip�onecmd�reversed)r-rBrrrrr`�s
zPdb.execRcLinescCs.|jr
dS|j|�r*|jd�|j|d�dS)Nz--Call--)r<Z	stop_hererQ�interaction)r-rSZ
argument_listrrr�	user_call�s


z
Pdb.user_callcCsH|jr.|j|j|jj�ks$|jdkr(dSd|_|j|�rD|j|d�dS)NrF)r<r;�canonicr\�co_filename�f_lineno�bp_commandsri)r-rSrrr�	user_line�s

z
Pdb.user_linecCs�t|dd�r�|j|jkr�|j}d|_|j}|j|d�x|j|D]}|j|�qBW||_|j|sv|j|j|j	�|j
|r�|j�|j�dSdS)N�	currentbpFrr)
�getattrrprH�lastcmdrcrgrJ�print_stack_entryrWrXrI�_cmdlooprV)r-rSrpZlastcmd_backrrrrrns 

zPdb.bp_commandscCs.|jr
dS||jd<|jd�|j|d�dS)N�
__return__z
--Return--)r<r"rQri)r-rSZreturn_valuerrr�user_returns


zPdb.user_returncCsj|jr
dS|\}}}||f|jd<|r4|tkr4dnd}|jd|tj||�dj�f�|j||�dS)NZ
__exception__z	Internal r1z%s%sr���)r<r"�
StopIterationrQ�	traceback�format_exception_onlyrfri)r-rS�exc_info�exc_type�	exc_value�
exc_traceback�prefixrrr�user_exception's
zPdb.user_exceptioncCsDx>yd|_|j�d|_PWqtk
r:|jd�YqXqWdS)NTFz--KeyboardInterrupt--)r@�cmdlooprPrQ)r-rrrrt;szPdb._cmdloopcCsb|jj|j�}|r^xJ|j�D]>\}}|j|�}||k	r||kr|||<|jd|||f�qWdS)Nzdisplay %s: %r  [old: %r])r:�getrY�items�_getval_exceptrQ)r-r:�exprZoldvalueZnewvaluerrr�preloopHs
zPdb.preloopcCsZtjrtjtjtj�dt_|j||�r4|j�dS|j|j|j�|j	�|j�dS)N)
r
�_previous_sigint_handler�signal�SIGINTrcrVrsrWrXrt)r-rSryrrrriUszPdb.interactioncCs|dk	r|jt|��dS)N)rQ�repr)r-r#rrr�displayhookcszPdb.displayhookc	Cs�|dd�dkr|dd�}|j}|jj}ydt|ddd�}tj}tj}tj}z(|jt_|jt_|jt_t|||�Wd|t_|t_|t_XWn4tj	�dd�}|j
tj|�dj
��YnXdS)Nr�!�
z<stdin>Zsingle�rw)r_rYr!r�sysrOrNr��execr{�errorryrzrf)	r-r�locals�globalsr)Zsave_stdoutZ
save_stdinZsave_displayhookr{rrr�defaultks(zPdb.defaultcCs�|j�s|S|j�}xx|d|jkr�|j|d}d}x0|dd�D] }|jdt|�|�}|d7}qDW|jddj|dd���}|j�}qW|ddkr�|jd�}|dkr�||dd�j�}|jj	|�|d|�j
�}|S)	Nrr�%z%*� �aliasz;;r�)rf�splitr9�replace�strrF�find�lstrip�cmdqueue�append�rstrip)r-r�argsZiiZtmpArgZmarker�nextrrr�precmd�s&
z
Pdb.precmdcCs"|jstjj||�S|j|�SdS)N)rKr6r7rg�handle_command_def)r-rrrrrg�sz
Pdb.onecmdcCs�|j|�\}}}|sdS|dkr0d|j|j<dS|dkrBg|_dS|j|j}|rf|j|d|�n
|j|�yt|d|�}Wntk
r�|j}YnX|j	|j
kr�d|j|j<g|_dSdS)NZsilentT�endrr��do_F)Z	parselinerJrLr�rHr�rq�AttributeErrorr�r�commands_resumingrI)r-rr6�argZcmdlist�funcrrrr��s,
zPdb.handle_command_defcCst||jd�dS)N)�file)�printrO)r-�msgrrrrQ�szPdb.messagecCstd||jd�dS)Nz***)r�)r�rO)r-r�rrrr��sz	Pdb.errorcCs�|j�jd�rgSy|j||||�}Wntk
r>g}YnXtj|d�}xP|D]H}tjj|�rt|j|d�qTtjj	|�rT|j
�jd�rT|j|d�qTW|S)	N�:�,�*�/�.py�.pyw)r�r�)r�r�)rf�endswith�_complete_expression�	Exception�globrCrE�isdirr��isfile�lower)r-�textr�begidx�endidxZret�globs�fnrrr�_complete_location�s

zPdb._complete_locationcs�fdd�ttjj�D�S)Ncs.g|]&\}}|dk	rt|�j��rt|��qS)N)r��
startswith)�.0r*�bp)r�rr�
<listcomp>�sz*Pdb._complete_bpnumber.<locals>.<listcomp>)rr3�
Breakpoint�
bpbynumber)r-r�rr�r�r)r�r�_complete_bpnumber�szPdb._complete_bpnumbercs�|js
gS|jjj�}|j|j�d�kr��jd��y0|�d}x�dd�D]}t||�}qPWWnttfk
r|gSXdj	�dd��d���fdd�t
|�D�S�fdd�|j�D�SdS)	N�.rrcs"g|]}|j�d�r�|�qS)rrw)r�)r��n)�dottedrrrr��sz,Pdb._complete_expression.<locals>.<listcomp>csg|]}|j��r|�qSr)r�)r�r�)r�rrr��srwrw)rYr!�copy�updater_r�rq�KeyErrorr�rF�dir�keys)r-r�rr�r��nsr#�partr)r�rr�rr��s
zPdb._complete_expressioncCs(|sttjj�d}n"yt|�}Wn|jd�dS||_||jkrf|j||j||j	|f}nd}g|j|<d|j|<d|j	|<|j
}d|_
d|_zzy|j�Wnht
k
�r|r�|d|j|<|d|j|<|d|j	|<n|j|=|j|=|j	|=|jd�YnXWdd|_||_
XdS)	Nrz.Usage: commands [bnum]
        ...
        endTFz(com) rr�z1command definition aborted, old commands restored)�lenr3r�r��intr�rLrHrIrJr8rKr�rP)r-r�ZbnumZold_command_defsZprompt_backrrr�do_commandss@%




zPdb.do_commandsrcCs@|s<|jr8|jd�x"tjjD]}|r|j|j��qWdSd}d}d}|jd�}|dkr~||dd�j�}|d|�j�}|j	d�}d}	|dk�r|d|�j�}|j
|�}
|
s�|jd|�dS|
}||dd�j�}yt|�}Wn$t
k
�r|jd|�dSXn�yt|�}Wn�t
k
�r�yt||jj|j�}Wn|}YnXy.t|d��rl|j}|j}|j}	|j}|j}Wn@|j|�\}
}}|
�s�|jd	|�dS|
}	t|�}YnXYnX|�s�|j�}|j||�}|�r<|j|||||	�}|�r|j|�n*|j||�d}|jd
|j|j|jf�dS)Nz!Num Type         Disp Enb   Wherer�rrr�z%r not found from sys.pathzBad lineno: %s�__func__zJThe specified object %r is not a function or was not found along sys.path.zBreakpoint %d at %s:%drw) �breaksrQr3r�r�Zbpformatr�r�r��rfind�lookupmoduler�r��
ValueError�evalrYr!r_�hasattrr��__code__�co_name�co_firstlinenorl�lineinfo�defaultFile�	checklineZ	set_break�
get_breaks�numberr�r)r-r�Z	temporaryr�rr�condZcommaZcolonrrar�r)�ok�lnr�errrrr�do_breakTs~






zPdb.do_breakcCs"|jjj}|dkr|jr|j}|S)Nz<string>)rYr\rlr;)r-rrrrr��s
zPdb.defaultFilecCs|j|d�dS)Nr)r�)r-r�rrr�	do_tbreak�sz
Pdb.do_tbreakc
Cs�d}|jd�}t|�dkr(|dj�}nt|�dkrB|dj�}n|S|dkrR|S|jd�}|ddkr~|d=t|�dkr~|S|j�}t|�dkr�|d}n|j|d�}|r�|}|d}t||�}	|	p�|S)	N�'rr�r1r�r-)NNN)r�r�rfr�r�r)
r-Z
identifierZfailedZidstring�id�partsZfname�itemraZanswerrrrr��s.



zPdb.lineinfocCs�t|d�r|jjnd}tj|||�}|s6|jd�dS|j�}|sp|ddksp|dd�dksp|dd�dkr~|jd�dS|S)	NrYzEnd of filerrdr�z"""z'''zBlank or comment)r�rYr!�	linecache�getlinerQrfr�)r-rrr�rrrrr��s
 
z
Pdb.checklinecCsl|j�}x^|D]V}y|j|�}Wn,tk
rL}z|j|�WYdd}~XqX|j�|jd|�qWdS)Nz
Enabled %s)r��get_bpbynumberr�r��enablerQ)r-r�r�r*r�r�rrr�	do_enable�s
z
Pdb.do_enablecCsl|j�}x^|D]V}y|j|�}Wn,tk
rL}z|j|�WYdd}~XqX|j�|jd|�qWdS)NzDisabled %s)r�r�r�r��disablerQ)r-r�r�r*r�r�rrr�
do_disable
s
zPdb.do_disablecCs�|jdd�}y|d}Wntk
r0d}YnXy|j|dj��}WnHtk
rf|jd�YnXtk
r�}z|j|�WYdd}~Xn.X||_|s�|jd|j�n|jd|j�dS)Nr�rrzBreakpoint number expectedz#Breakpoint %d is now unconditional.z$New condition set for breakpoint %d.)	r��
IndexErrorr�rfr�r�r�rQr�)r-r�r�r�r�r�rrr�do_condition!s
zPdb.do_conditioncCs�|j�}yt|dj��}Wnd}YnXy|j|dj��}WnHtk
rb|jd�Ynvtk
r�}z|j|�WYdd}~XnLX||_|dkr�|dkr�d|}nd}|jd||j	f�n|jd|j	�dS)NrrzBreakpoint number expectedz%d crossingsz
1 crossingz%Will ignore next %s of breakpoint %d.z-Will stop next time breakpoint %d is reached.)
r�r�rfr�r�r�r��ignorerQr�)r-r�r��countr�r�Zcountstrrrr�	do_ignore<s(	

z
Pdb.do_ignorec
!Cs�|sxytd�}Wntk
r(d}YnX|j�j�}|dkrtdd�tjjD�}|j�x|D]}|jd|�q^WdSd|k�r|j	d�}|d|�}||d	d�}yt
|�}Wntk
r�d
|}YnX|j||�}|j
||�}|�r�|j|�nx|D]}|jd|��qWdS|j�}	xd|	D]\}y|j|�}Wn.tk
�rl}z|j|�WYdd}~XnX|j|�|jd|��q,WdS)NzClear all breaks? �no�y�yescSsg|]}|r|�qSrr)r�r�rrrr�msz Pdb.do_clear.<locals>.<listcomp>z
Deleted %sr�rzInvalid line number (%s))r�r�)�input�EOFErrorrfr�r3r�r�Zclear_all_breaksrQr�r�r�r�Zclear_breakr�r�r�Zclear_bpbynumber)
r-r�ZreplyZbplistr�r*rrr�Z
numberlistrrr�do_clear_sF






zPdb.do_clearcCs|j�dS)N)�print_stack_trace)r-r�rrr�do_where�szPdb.do_wherecCs>||_|j|jd|_|jj|_|j|j|j�d|_dS)Nr)rXrWrYr"r_rsr)r-r�rrr�
_select_frame�s

zPdb._select_framecCsx|jdkr|jd�dSyt|p"d�}Wn"tk
rJ|jd|�dSX|dkrZd}ntd|j|�}|j|�dS)NrzOldest framerzInvalid frame count (%s))rXr�r�r��maxr)r-r�r��newframerrr�do_up�s

z	Pdb.do_upcCs�|jdt|j�kr"|jd�dSyt|p,d�}Wn"tk
rT|jd|�dSX|dkrnt|j�d}ntt|j�d|j|�}|j|�dS)NrzNewest framezInvalid frame count (%s)r)rXr�rWr�r�r��minr)r-r�r�rrrr�do_down�s
zPdb.do_downcCsf|rPyt|�}Wn"tk
r2|jd|�dSX||jjkrT|jd�dSnd}|j|j|�dS)NzError in argument: %rz7"until" line number is smaller than current line numberr)r�r�r�rYrmZ	set_until)r-r�rrrr�do_until�s
zPdb.do_untilcCs|j�dS)Nr)rR)r-r�rrr�do_step�szPdb.do_stepcCs|j|j�dS)Nr)Zset_nextrY)r-r�rrr�do_next�szPdb.do_nextcCs<|r4ddl}tjdd�}|j|�t_|tjdd�<t�dS)Nrr)�shlexr��argvr�r)r-r�rZargv0rrr�do_run�sz
Pdb.do_runcCs|j|j�dS)Nr)Z
set_returnrY)r-r�rrr�	do_returnsz
Pdb.do_returncCs>|js2ytjtj|j�t_Wntk
r0YnX|j�dS)Nr)rAr�r�rTr
r�r�Zset_continue)r-r�rrr�do_continueszPdb.do_continuecCs�|jdt|j�kr"|jd�dSyt|�}Wntk
rL|jd�YnnXy:||j_|j|jd|f|j|j<|j|j|j�Wn0tk
r�}z|jd|�WYdd}~XnXdS)Nrz)You can only jump within the bottom framez)The 'jump' command requires a line numberrzJump failed: %s)	rXr�rWr�r�r�rYrmrs)r-r��errr�do_jump"s
zPdb.do_jumpcCsztjd�|jj}|j}t|j|j|j�}d|j	j
�|_	|jd�tj|j
|||f�|jd�tj|j�|j|_dS)Nz(%s) zENTERING RECURSIVE DEBUGGERzLEAVING RECURSIVE DEBUGGER)r��settracerYr!r_r
rMrNrOr8rfrQ�call_tracingrZtrace_dispatchrr)r-r�r�r��prrr�do_debug?s


zPdb.do_debugcCsd|_|j�dS)NTr)�_user_requested_quit�set_quit)r-r�rrr�do_quitRszPdb.do_quitcCs|jd�d|_|j�dS)Nr1Tr)rQrr)r-r�rrr�do_EOF]s
z
Pdb.do_EOFcCs�|jj}|j}|j}|jd@r&|d}|jd@r8|d}xJt|�D]>}|j|}||krp|jd|||f�qB|jd|f�qBWdS)N�r�z%s = %rz%s = *** undefined ***)rYr\r_�co_argcount�co_flags�range�co_varnamesrQ)r-r��co�dictr�r*�namerrr�do_argsfs


zPdb.do_argscCs.d|jkr |jt|jd��n
|jd�dS)NruzNot yet returned!)r_rQr�r�)r-r�rrr�	do_retvalws
z
Pdb.do_retvalc
CsNyt||jj|j�Stj�dd�}|jtj|�dj	���YnXdS)Nr�rrw)
r�rYr!r_r�r{r�ryrzrf)r-r�r{rrr�_getval�szPdb._getvalc
Cshy.|dkrt||jj|j�St||j|j�SWn4tj�dd�}tj|�dj	�}t
d|�SdS)Nr�rz** raised %s **rw)r�rYr!r_r"r�r{ryrzrfr,)r-r�rSr{r�rrrr��szPdb._getval_exceptc
Cs*y|jt|j|���WnYnXdS)N)rQr�r%)r-r�rrr�do_p�szPdb.do_pc
Cs,y|jtj|j|���WnYnXdS)N)rQ�pprintZpformatr%)r-r�rrr�do_pp�sz	Pdb.do_ppcCsdd|_d}|r�|dkr�y^d|krX|jd�\}}t|j��}t|j��}||krr||}nt|j��}td|d�}Wq�tk
r�|jd|�dSXn0|jdks�|dkr�td|jj	d�}n
|jd}|dkr�|d}|jj
j}|j|�}yZt
j||jj�}|j||d|�|||j�t|t|��|_t|�|k�rF|jd�Wntk
�r^YnXdS)	Nr&r�r�r�zError in argument: %r�
z[EOF])rrr�r�rfrr�r�rrYrmr\rl�get_file_breaksr��getlinesr!�_print_linesrr�rQrP)r-r�Zlast�firstr�	breaklistr$rrr�do_list�s>



zPdb.do_listcCsh|jjj}|j|�}yt|j�\}}Wn*tk
rP}z|j|�dSd}~XnX|j||||j�dS)N)rYr\rlr+r%rr�r-)r-r�rr/r$rr�rrr�do_longlist�s


zPdb.do_longlistcCsjy|j|�}Wn
dSyt|�\}}Wn.ttfk
rX}z|j|�dSd}~XnX|j||�dS)N)r%r%r�	TypeErrorr�r-)r-r�r#r$rr�rrr�	do_source�s
z
Pdb.do_sourcec
Cs�|r|j}|jj|d	�}nd
}}x�t||�D]|\}}t|�jd�}	t|	�dkrX|	d7}	||krj|	d7}	n|	d7}	||kr�|	d7}	n||kr�|	d7}	|j|	d|j��q.WdS)Nrr�rr��Bz->z>>�	rwrw)	rmr=r�rr��rjustr�rQr�)
r-r$rr�rSZcurrent_linenoZ
exc_linenorr�srrrr-�s 

zPdb._print_linescCs�y|j|�}Wn
dSd}y
|j}Wntk
r<YnX|rV|jd|j�dSy|jj}Wntk
rvYnX|r�|jd|j�dS|jtkr�|jd|j|j	f�dS|jt|��dS)NzFunction %sz	Method %szClass %s.%s)
r%r�r�rQr�r��	__class__�typerr)r-r��valuer)rrr�	do_whatiss.

z
Pdb.do_whatiscCsp|s<|jd�x\|jj|ji�j�D]}|jd|�q$Wn0|j|�}||jj|ji�|<|jd||f�dS)NzCurrently displaying:z%s: %rzdisplay %s: %r)rQr:r�rYr�r��
setdefault)r-r�r��valrrr�
do_display4s

zPdb.do_displaycCsT|r@y|jj|ji�|=WqPtk
r<|jd|�YqPXn|jj|jd�dS)Nznot displaying %s)r:r�rYr�r�re)r-r�rrr�do_undisplayGszPdb.do_undisplaycs�fdd�|jj|ji�D�S)Ncsg|]}|j��r|�qSr)r�)r�r)r�rrr�Wsz*Pdb.complete_undisplay.<locals>.<listcomp>)r:r�rY)r-r�rr�r�r)r�r�complete_undisplayVszPdb.complete_undisplaycCs*|jjj�}|j|j�tjd|d�dS)Nz
*interactive*)Zlocal)rYr!r�r�r_r)�interact)r-r�r�rrr�do_interactZszPdb.do_interactcCs�|j�}t|�dkrLt|jj��}x$|D]}|jd||j|f�q(WdS|d|jkr�t|�dkr�|jd|d|j|df�ndj|dd��|j|d<dS)Nrz%s = %srr�)r�r��sortedr9r�rQrF)r-r�r�r�r�rrr�do_aliasds
"zPdb.do_aliascCs6|j�}t|�dkrdS|d|jkr2|j|d=dS)Nr)r�r�r9)r-r�r�rrr�
do_unalias�s
zPdb.do_unaliascs�fdd�|jD�S)Ncsg|]}|j��r|�qSr)r�)r��a)r�rrr��sz(Pdb.complete_unalias.<locals>.<listcomp>)r9)r-r�rr�r�r)r�r�complete_unalias�szPdb.complete_unaliasrr	r
rrrcCs8yx|jD]}|j|�q
WWntk
r2YnXdS)N)rWrsrP)r-�frame_linenorrrr�s
zPdb.print_stack_tracecCs6|\}}||jkrd}nd}|j||j||��dS)Nz> z  )rYrQZformat_stack_entry)r-rHZ
prompt_prefixrSrrrrrrs�s
zPdb.print_stack_entrycCs�|stjj||�Sy<yt|d|�}|�Stk
rJt|d|�}YnXWn"tk
rp|jd|�Yn0Xtjjdkr�|jd|�dS|j	|j
j��dS)NZhelp_r�zNo help for %rr�zJNo help for %r; please do not run Python with -OO if you need command help)r6r7�do_helprqr�r�r��flags�optimizerQ�__doc__r�)r-r�ZtopicZcommandrrrrI�szPdb.do_helpcCs|j|jjpdj��dS)Nr1)rQ�	help_execrLrf)r-rrrrM�s
z
Pdb.help_execcCs
t�dS)N)r)r-rrr�help_pdb�szPdb.help_pdbcCs�tjj|�rtjj|�r|Stjjtjd|�}tjj|�rP|j|�|jkrP|Stjj|�\}}|dkrp|d}tjj|�r�|SxHtjD]>}xtjj	|�r�tj
|�}q�Wtjj||�}tjj|�r�|Sq�WdS)Nrr1z.py)rCrE�isabs�existsrFr�rkr;�splitext�islink�readlink)r-rra�rootZext�dirname�fullnamerrrr��s"zPdb.lookupmodulec
Cstddl}|jj�|jjd|td��d|_|j|�|_d|_t	|d��}d|j
�|jf}WdQRX|j|�dS)Nr�__main__)r�__file__�__builtins__TF�rbzexec(compile(%r, %r, 'exec')))rW�__dict__rZr�rYr<rkr;rr�readr)r-rrWr�	statementrrr�
_runscript�s

zPdb._runscript)r/NNNFT)r)N)vrrrr�r5rTrUrVrcr`rjrornrvr�rtr�rir�r�r�rgr�rQr�r�r�r�r�Zcomplete_commandsr�r�Zdo_bZcomplete_breakZ
complete_br�Zcomplete_tbreakr�r�r�Zcomplete_enabler�Zcomplete_disabler�Zcomplete_conditionr�Zcomplete_ignorer�Zdo_clZcomplete_clearZcomplete_clrZdo_wZdo_btrrZdo_urZdo_drZdo_untr	Zdo_sr
Zdo_nr
Z
do_restartrZdo_rrZdo_cZdo_contrZdo_jrZcomplete_debugrZdo_qZdo_exitrr#Zdo_ar$Zdo_rvr%r�r&r(Zcomplete_printZ
complete_pZcomplete_ppr0Zdo_lr1Zdo_llr3Zcomplete_sourcer-r;Zcomplete_whatisr>Zcomplete_displayr?r@rBrDrErGr�r�line_prefixrsrIZdo_hrMrNr�r^rrrrr
�s�
/	


M
]!!.	
		1!
#	
�whereZdownZup�breakZtbreakrZr�r�r�Z	conditionrH�stepr�ZuntilZjump�returnZretval�continuer&Zlonglistr�rZppZwhatis�sourceZdisplayZ	undisplayrAr�Zunalias�debug�quitr�z

cCst�j|||�dS)N)r
r)r]r�r�rrrr#scCst�j|||�S)N)r
r)Z
expressionr�r�rrrr&scCst|||�dS)N)r)r]r�r�rrrr)scOst�j||�S)N)r
r
)r��kwdsrrrr
-scCst�jtj�j�dS)N)r
rr��	_getframe�f_backrrrrr0scCsB|dkrtj�d}|dkr$td��t�}|j�|jd|�dS)Nr�zAA valid traceback must be passed if no exception is being handled)r�r{r�r
rUri)�trrrrr5scCsttj�dS)N)rr��last_tracebackrrrrr	Cszimport x; x.main()cCstt�dS)N)r�TESTCMDrrrr�testKsrncCsddl}|jt�dS)Nr)�pydocZpagerrL)rorrrrOsa�usage: pdb.py [-c command] ... pyfile [arg] ...

Debug the Python program given by pyfile.

Initial commands are read from .pdbrc files in your home directory
and in the current directory, if they exist.  Commands supplied with
-c are executed after commands from .pdbrc files.

To let the script run until an exception occurs, use "-c continue".
To let the script run up to a given line X in the debugged file, use
"-c 'until X'".c	Cs�ddl}|jtjdd�dddg�\}}|s>tt�tjd�g}x<|D]4\}}|dkrjtt�tj�qH|dkrH|j|�qHW|d}tjj	|�s�td
|d�tjd�|tjdd�<tjj
|�tjd<t�}|jj
|�x�y|j|�|jr�Ptd�Wq�tk
�r0td
|d�tddj|��Yq�tk
�r`tddd�ttj�d�Yq�tk
�r�tj�tjd�Yq�tj�td�td�tj�d}|jd|�td|d�Yq�Xq�WdS)Nrrzhc:�--helpz
--command=r��-h�-c�	--commandzError:zdoes not existz*The program finished and will be restartedZ
Restartingzwith arguments:r5r�z/The program exited via sys.exit(). Exit status:)r�z2Uncaught exception. Entering post mortem debuggingz1Running 'cont' or 'step' will restart the programz#Post mortem debugger finished. The z will be restarted)rqrp)rrrs)�getoptr�rr��_usage�exitr�rCrErPrUr
rBrGr^rrrF�
SystemExitr{�SyntaxErrorry�	print_excri)	rtZoptsr�rH�optZoptargr;�pdbrkrrr�main`sV 



r|rW)NN)NN)N)-rCrr�r6r3r'r)r�r'r�r ryr�r�r�__all__rr%r+r�r,r_r4r7r
rLZ_help_orderZ_commandrqrfrMrrrr
rrr	rmrnrrur|rr{rrrr�<module>Fsr
		

"


<
tarfile.cpython-36.pyc000064400000222047150335715140010633 0ustar003

�\dh���'@sBdZdZdZdZdZdZddlmZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZyddlZWnek
r�dZYnXyddlZWnek
r�dZYnXeefZyeef7ZWnek
r�YnXd	d
ddd
ddddddddddgZdZdZdZdZedZ dZ!dZ"dZ#dZ$d Z%d!Z&dZ'd"Z(d#Z)d$Z*d%Z+d&Z,d'Z-d(Z.d)Z/d*Z0d+Z1d,Z2d-Z3d.Z4dZ5d/Z6d0Z7e6Z8e&e'e(e)e,e-e.e*e+e/e0e1fZ9e&e'e.e1fZ:e/e0e1fZ;d�Z<d1d2d7d8hZ=e>e>e>e?e?e?d9�Z@e
jAd:k�r�d;ZBne	jC�ZBd<d=�ZDd>d?�ZEd@dA�ZFdBe8fdCdD�ZGdEdF�ZHdedfdGdH�ZIdIdJ�ZJdKdL�ZKGdMd�deL�ZMGdNd�deM�ZNGdOd
�d
eM�ZOGdPd�deM�ZPGdQd�deM�ZQGdRd�deM�ZRGdSdT�dTeR�ZSGdUdV�dVeR�ZTGdWdX�dXeR�ZUGdYdZ�dZeR�ZVGd[d\�d\eR�ZWGd]d^�d^�ZXGd_d`�d`�ZYGdadb�dbeZ�Z[Gdcdd�ddeZ�Z\Gdedf�dfej]�Z^Gdgdh�dheM�Z_Gdidj�dje_�Z`Gdkdl�dle_�ZaGdmdn�dne_�ZbGdodp�dpe_�ZcGdqdr�dre_�ZdGdsdt�dte_�Zee_eeNfZfd�dudv�Zgdwdx�Zhdydz�Zid{d|�Zjeheiejd}�ZkeZ�Zlejmd~�ZnGdd
�d
eZ�ZoGd�d	�d	eZ�Zpd�d�ZqepjZd�d��Zresd�k�r>er�dS)�z,Read from and write to tar format archives.
z0.9.0u"Lars Gustäbel (lars@gustaebel.de)z5$Date: 2011-02-25 17:42:01 +0200 (Fri, 25 Feb 2011) $z?$Id: tarfile.py 88586 2011-02-25 15:42:01Z marc-andre.lemburg $u4Gustavo Niemeyer, Niels Gustäbel, Richard Townsend.�)�openN�TarFile�TarInfo�
is_tarfile�TarError�	ReadError�CompressionError�StreamError�ExtractError�HeaderError�ENCODING�USTAR_FORMAT�
GNU_FORMAT�
PAX_FORMAT�DEFAULT_FORMATrTz/etc/python/tarfile.cfg�i�sustar  sustar00�d��0�1�2�3�4�5�6�7�L�K�S�x�g�X���path�linkpath�size�mtime�uid�gid�uname�gname)ZatimeZctimer(r)r*r'�ntzutf-8cCs8|dkrtd��|j||�}|d|�|t|�tS)z8Convert a string to a null-terminated bytes object.
    Nzmetadata cannot contain None)�
ValueError�encode�len�NUL)�s�length�encoding�errors�r6�/usr/lib64/python3.6/tarfile.py�stn�sr8cCs*|jd�}|dkr|d|�}|j||�S)z8Convert a null-terminated bytes object to a string.
    rr#N���)�find�decode)r2r4r5�pr6r6r7�nts�s
r=cCs�|ddkrfd}x0tt|�d�D]}|dK}|||d7}q"W|ddkr�dt|�d|}n@y"t|dd�}t|j�p�d	d�}Wntk
r�td
��YnX|S)z/Convert a number field to a python number.
    r��r#���ascii�strict�0zinvalid header)r>r?)�ranger0r=�int�stripr.�InvalidHeaderError)r2�n�ir6r6r7�nti�srKr@cCs�t|�}d|ko"d|dknrDtd|d|fd�t}n�|tkr�d|d|kopd|dknr�|dkr�tdg�}ntdg�}d||}x6t|d�D]}|jd|d@�|dL}q�Wntd	��|S)
z/Convert a python number to a number field.
    rr@r#z%0*orBrAr>r?zoverflow in number field)rF�bytesr1r�	bytearrayrE�insertr.)rI�digits�formatr2rJr6r6r7�itn�s 2
rQcCs0dttjd|��}dttjd|��}||fS)a�Calculate the checksum for a member's header by summing up all
       characters except for the chksum field which is treated as if
       it was filled with spaces. According to the GNU tar sources,
       some tars (Sun and NeXT) calculate chksum with signed char,
       which will be different if there are chars in the buffer with
       the high bit set. So we calculate two checksums, unsigned and
       signed.
    rAZ
148B8x356BZ
148b8x356b)�sum�structZunpack_from)�bufZunsigned_chksumZ
signed_chksumr6r6r7�calc_chksums�s	rUc	Cs�|pd}|dkrdS|dkr.tj|||�dSt||�\}}x8t|�D],}|j|�}t|�|krh|d��|j|�qFW|dkr�|j|�}t|�|kr�|d��|j|�dS)zjCopy length bytes from fileobj src to fileobj dst.
       If length is None, copy the entire content.
    �irNzunexpected end of datai@)�shutil�copyfileobj�divmodrE�readr0�write)	�src�dstr3�	exception�bufsize�blocks�	remainder�brTr6r6r7rX�s$


rXcCs ddl}|jdtd�tj|�S)z/Deprecated in this location; use stat.filemode.rNz$deprecated in favor of stat.filemoder$)�warnings�warn�DeprecationWarning�stat�filemode)�modercr6r6r7rgsrgcCs8ttjdd�}|dk	r(|j|d�j|�}t|dd�dS)Nr4�backslashreplace� )�end)�getattr�sys�stdoutr/r;�print)r2r4r6r6r7�_safe_printsrpc@seZdZdZdS)rzBase exception.N)�__name__�
__module__�__qualname__�__doc__r6r6r6r7rsc@seZdZdZdS)r
z%General exception for extract errors.N)rqrrrsrtr6r6r6r7r
!sc@seZdZdZdS)rz&Exception for unreadable tar archives.N)rqrrrsrtr6r6r6r7r$sc@seZdZdZdS)rz.Exception for unavailable compression methods.N)rqrrrsrtr6r6r6r7r'sc@seZdZdZdS)r	z=Exception for unsupported operations on stream-like TarFiles.N)rqrrrsrtr6r6r6r7r	*sc@seZdZdZdS)rz!Base exception for header errors.N)rqrrrsrtr6r6r6r7r-sc@seZdZdZdS)�EmptyHeaderErrorzException for empty headers.N)rqrrrsrtr6r6r6r7ru0sruc@seZdZdZdS)�TruncatedHeaderErrorz Exception for truncated headers.N)rqrrrsrtr6r6r6r7rv3srvc@seZdZdZdS)�EOFHeaderErrorz"Exception for end of file headers.N)rqrrrsrtr6r6r6r7rw6srwc@seZdZdZdS)rHzException for invalid headers.N)rqrrrsrtr6r6r6r7rH9srHc@seZdZdZdS)�SubsequentHeaderErrorz3Exception for missing and invalid extended headers.N)rqrrrsrtr6r6r6r7rx<srxc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
_LowLevelFilez�Low-level file object. Supports reading and writing.
       It is used instead of a regular file object for streaming
       access.
    cCsFtjtjtjBtjBd�|}ttd�r2|tjO}tj||d�|_dS)N)�r�w�O_BINARYi�)	�os�O_RDONLY�O_WRONLY�O_CREAT�O_TRUNC�hasattrr|r�fd)�self�namerhr6r6r7�__init__Is

z_LowLevelFile.__init__cCstj|j�dS)N)r}�closer�)r�r6r6r7r�Rsz_LowLevelFile.closecCstj|j|�S)N)r}rZr�)r�r'r6r6r7rZUsz_LowLevelFile.readcCstj|j|�dS)N)r}r[r�)r�r2r6r6r7r[Xsz_LowLevelFile.writeN)rqrrrsrtr�r�rZr[r6r6r6r7ryCs
	ryc@steZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zddd�Zddd�Z
dd�Zdd�ZdS)�_Streama�Class that serves as an adapter between TarFile and
       a stream-like object.  The stream-like object only
       needs to have a read() or write() method and is accessed
       blockwise.  Use of gzip or bzip2 compression is possible.
       A stream-like object could be for example: sys.stdin,
       sys.stdout, a socket, a tape device etc.

       _Stream is intended to be used only internally.
    c	Cs�d|_|dkrt||�}d|_|dkr6t|�}|j�}|p<d|_||_||_||_||_d|_	d|_
d|_�yL|dkr�yddl}Wnt
k
r�td	��YnX||_|jd�|_|d
kr�|j�|j|_n|j�n�|dk�r:yddl}Wnt
k
�r
td��YnX|d
k�r.d|_|j�|_t|_n
|j�|_n||d
k�r�yddl}Wnt
k
�rntd��YnX|d
k�r�d|_|j�|_|j|_n
|j�|_n|dk�r�td|��Wn&|j�s�|jj�d|_�YnXdS)z$Construct a _Stream object.
        TNF�*��r�gzzzlib module is not availablerz�bz2zbz2 module is not available�xzzlzma module is not available�tarzunknown compression type %r) �_extfileobjry�_StreamProxy�getcomptyper�rh�comptype�fileobjr_rT�pos�closed�zlib�ImportErrorr�crc32�crc�
_init_read_gz�errorr^�_init_write_gzr��dbufZBZ2Decompressor�cmp�OSErrorZ
BZ2Compressor�lzmaZLZMADecompressor�	LZMAErrorZLZMACompressorr�)	r�r�rhr�r�r_r�r�r�r6r6r7r�fsl












z_Stream.__init__cCst|d�r|jr|j�dS)Nr�)r�r�r�)r�r6r6r7�__del__�sz_Stream.__del__cCs�|jjd|jj|jj|jjd�|_tjdtt	j	���}|j
d|d�|jjd�rf|jdd�|_|j
|jj
d	d
�t�dS)z6Initialize for writing with gzip compression.
        �	rz<Ls�s�z.gzN�z
iso-8859-1�replace���)r�ZcompressobjZDEFLATED�	MAX_WBITSZ
DEF_MEM_LEVELr�rS�packrF�time�_Stream__writer��endswithr/r1)r�Z	timestampr6r6r7r��sz_Stream._init_write_gzcCsR|jdkr|jj||j�|_|jt|�7_|jdkrD|jj|�}|j|�dS)z&Write string s to the stream.
        r�r�N)	r�r�r�r�r�r0r��compressr�)r�r2r6r6r7r[�s

z
_Stream.writecCsR|j|7_x>t|j�|jkrL|jj|jd|j��|j|jd�|_qWdS)z]Write string s to the stream if a whole new block
           is ready to be written.
        N)rTr0r_r�r[)r�r2r6r6r7Z__write�sz_Stream.__writecCs�|jr
dSd|_z�|jdkr:|jdkr:|j|jj�7_|jdkr�|jr�|jj|j�d|_|jdkr�|jjtj	d|j
��|jjtj	d|jd@��Wd|js�|jj
�XdS)	z[Close the _Stream object. No operation should be
           done on it afterwards.
        NTr{r�r�r�z<Ll��)r�rhr�rTr��flushr�r[rSr�r�r�r�r�)r�r6r6r7r��s
z
_Stream.closecCs�|jj|jj�|_d|_|jd�dkr0td��|jd�dkrFtd��t|jd��}|jd�|d	@r�t|jd��d
t|jd��}|j	|�|d@r�x|jd�}|s�|t
kr�Pq�W|d@r�x|jd�}|s�|t
kr�Pq�W|d@r�|jd�d
S)z:Initialize for reading a gzip compressed fileobj.
        r�r$s�znot a gzip filer#�zunsupported compression method��rAr@rVN)r�Z
decompressobjr�r�r��
_Stream__readrr�ordrZr1)r��flagZxlenr2r6r6r7r��s.
 


z_Stream._init_read_gzcCs|jS)z3Return the stream's file pointer position.
        )r�)r�r6r6r7�tellsz_Stream.tellrcCs\||jdkrNt||j|j�\}}xt|�D]}|j|j�q.W|j|�ntd��|jS)zXSet the stream's file pointer to pos. Negative seeking
           is forbidden.
        rz seeking backwards is not allowed)r�rYr_rErZr	)r�r�r`rarJr6r6r7�seeksz_Stream.seekNcCsZ|dkr:g}x |j|j�}|s P|j|�qWdj|�}n
|j|�}|jt|�7_|S)z�Return the next size number of bytes from the stream.
           If size is not defined, return all bytes of the stream
           up to EOF.
        Nr�)�_readr_�append�joinr�r0)r�r'�trTr6r6r7rZs
z_Stream.readcCs�|jdkr|j|�St|j�}|jg}xd||kr�|j|j�}|sBPy|jj|�}Wn|jk
rptd��YnX|j	|�|t|�7}q(Wdj
|�}||d�|_|d|�S)z+Return size bytes from the stream.
        r�zinvalid compressed datar�N)r�r�r0r�r_r�Z
decompressr^rr�r�)r�r'�cr�rTr6r6r7r�*s"





z
_Stream._readcCsnt|j�}|jg}x6||krH|jj|j�}|s0P|j|�|t|�7}qWdj|�}||d�|_|d|�S)zsReturn size bytes from stream. If internal buffer is empty,
           read another block from the stream.
        r�N)r0rTr�rZr_r�r�)r�r'r�r�rTr6r6r7Z__read@s



z_Stream.__read)r)N)rqrrrsrtr�r�r�r[r�r�r�r�r�rZr�r�r6r6r6r7r�[s	F
	

r�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r�zsSmall proxy class that enables transparent compression
       detection for the Stream interface (mode 'r|*').
    cCs||_|jjt�|_dS)N)r�rZ�	BLOCKSIZErT)r�r�r6r6r7r�Vsz_StreamProxy.__init__cCs|jj|_|jS)N)r�rZrT)r�r'r6r6r7rZZs
z_StreamProxy.readcCsP|jjd�rdS|jdd�dkr8|jdd�dkr8d	S|jjd�rHdSd
SdS)Ns�r�rr�sBZhr��
s1AY&SYr��]���7zXZr�r�)r�r�)rT�
startswith)r�r6r6r7r�^s$z_StreamProxy.getcomptypecCs|jj�dS)N)r�r�)r�r6r6r7r�hsz_StreamProxy.closeN)rqrrrsrtr�rZr�r�r6r6r6r7r�Qs

r�c@sjeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	e
jfdd�Zddd�Z
dd�Zdd�ZdS)�_FileInFilezA thin wrapper around an existing file object that
       provides a part of its data as an individual file
       object.
    NcCs�||_||_||_d|_t|dd�|_d|_|dkr>d|fg}d|_g|_d}|j}xT|D]L\}}||kr~|jj	d||df�|jj	d||||f�||7}||}qZW||jkr�|jj	d||jdf�dS)Nrr�FT)
r��offsetr'�positionrlr�r��	map_index�mapr�)r�r�r�r'Z	blockinfoZlastposZrealposr6r6r7r�us(

z_FileInFile.__init__cCsdS)Nr6)r�r6r6r7r��sz_FileInFile.flushcCsdS)NTr6)r�r6r6r7�readable�sz_FileInFile.readablecCsdS)NFr6)r�r6r6r7�writable�sz_FileInFile.writablecCs
|jj�S)N)r��seekable)r�r6r6r7r��sz_FileInFile.seekablecCs|jS)z*Return the current file position.
        )r�)r�r6r6r7r��sz_FileInFile.tellcCs�|tjkr tt|d�|j�|_nj|tjkr\|dkrFt|j|d�|_q�t|j||j�|_n.|tjkr�tt|j||j�d�|_ntd��|jS)z(Seek to a position in the file.
        rzInvalid argument)	�io�SEEK_SET�min�maxr'r��SEEK_CUR�SEEK_ENDr.)r�r��whencer6r6r7r��s


z_FileInFile.seekc	Cs|dkr|j|j}nt||j|j�}d}x�|dk�rxZ|j|j\}}}}||jkob|knrlPq:|jd7_|jt|j�kr:d|_q:Wt|||j�}|r�|jj||j|�|jj|�}t|�|kr�t	d��||7}n|t
|7}||8}|j|7_q.W|S)z!Read data from the file.
        Nr�rr#zunexpected end of data)r'r�r�r�r�r0r�r�rZrr1)	r�r'rT�data�start�stopr�r3rbr6r6r7rZ�s.

z_FileInFile.readcCs&|jt|��}||dt|��<t|�S)N)rZr0)r�rbrTr6r6r7�readinto�sz_FileInFile.readintocCs
d|_dS)NT)r�)r�r6r6r7r��sz_FileInFile.close)N)N)rqrrrsrtr�r�r�r�r�r�r�r�r�rZr�r�r6r6r6r7r�os

r�cseZdZ�fdd�Z�ZS)�ExFileObjectcs&t|j|j|j|j�}t�j|�dS)N)r�r��offset_datar'�sparse�superr�)r��tarfile�tarinfor�)�	__class__r6r7r��s
zExFileObject.__init__)rqrrrsr��
__classcell__r6r6)r�r7r��sr�c@seZdZdS)�FilterErrorN)rqrrrsr6r6r6r7r��sr�cseZdZ�fdd�Z�ZS)�AbsolutePathErrorcs ||_t�jd|j�d��dS)Nzmember z has an absolute path)r�r�r�r�)r�r�)r�r6r7r��szAbsolutePathError.__init__)rqrrrsr�r�r6r6)r�r7r��sr�cseZdZ�fdd�Z�ZS)�OutsideDestinationErrorcs.||_||_t�j|j�d|�d�d�dS)Nz would be extracted to z, z which is outside the destination)r��_pathr�r�r�)r�r�r%)r�r6r7r��sz OutsideDestinationError.__init__)rqrrrsr�r�r6r6)r�r7r��sr�cseZdZ�fdd�Z�ZS)�SpecialFileErrorcs||_t�j|j�d��dS)Nz is a special file)r�r�r�r�)r�r�)r�r6r7r��szSpecialFileError.__init__)rqrrrsr�r�r6r6)r�r7r��sr�cseZdZ�fdd�Z�ZS)�AbsoluteLinkErrorcs||_t�j|j�d��dS)Nz! is a symlink to an absolute path)r�r�r�r�)r�r�)r�r6r7r��szAbsoluteLinkError.__init__)rqrrrsr�r�r6r6)r�r7r��sr�cseZdZ�fdd�Z�ZS)�LinkOutsideDestinationErrorcs.||_||_t�j|j�d|�d�d�dS)Nz would link to z, z which is outside the destination)r�r�r�r�r�)r�r�r%)r�r6r7r��sz$LinkOutsideDestinationError.__init__)rqrrrsr�r�r6r6)r�r7r��sr�cseZdZ�fdd�Z�ZS)�LinkFallbackErrorcs2||_||_t�jd|j�d�d|�d��dS)Nzlink z would be extracted as a zcopy of z, which was rejected)r�r�r�r�r�)r�r�r%)r�r6r7r�szLinkFallbackError.__init__)rqrrrsr�r�r6r6)r�r7r�sr�cCs$i}|j}tjj|tjjd�}|jdtjf�rH|jjdtj�}|d<tjj|�r\t	|��tjjtjj
||�tjjd�}tjj||g�|kr�t||��|j
}|dk	�r|d@}|�r�|j�s�|j�r�|d@s�|dM}|dO}n|j�s�|j�r�d}nt|��||j
k�r||d<|�r |jdk	�r,d|d	<|jdk	�r@d|d
<|jdk	�rTd|d<|jdk	�rhd|d<|j��s||j��r tjj|j��r�t|��tjj|j�}||jk�r�||d
<|j��r�tjj
|tjj|�|j�}ntjj
||j�}tjj|tjjd�}tjj||g�|k�r t||��|S)N)rC�/r�i��@�Ii�rhr)r*r+r,�linknamei����)r�r}r%�realpath�
ALLOW_MISSINGr��sep�lstrip�isabsr�r��
commonpathr�rh�isreg�islnk�isdir�issymr�r)r*r+r,r�r��normpath�dirnamer�)�member�	dest_pathZfor_data�	new_attrsr�Ztarget_pathrhZ
normalizedr6r6r7�_get_filtered_attrssd






r�cCs|S)Nr6)r�r�r6r6r7�fully_trusted_filterTsr�cCs(t||d�}|r$|jf|ddi��S|S)NF�deep)r�r�)r�r�r�r6r6r7�
tar_filterWsr�cCs(t||d�}|r$|jf|ddi��S|S)NTr�F)r�r�)r�r�r�r6r6r7�data_filter]sr�)Z
fully_trustedr�r�s([0-9]{1,20}) c@s�eZdZdZdmZdndd�Zdd�Zdd�Zeee�Z	dd�Z
dd �Zee
e�Zd!d"�Z
eeeeeeeed#ed$�
d%d&�Zd'd(�Zeed)fd*d+�Zd,d-�Zd.d/�Zd0d1�Zed2d3��Zd4d5�Zed6d7��Zed8d9��Zed:d;��Zed<d=��Zed>d?��Zed@dA��Z dBdC�Z!dDdE�Z"dFdG�Z#dHdI�Z$dJdK�Z%dLdM�Z&dNdO�Z'dPdQ�Z(dRdS�Z)dTdU�Z*dVdW�Z+dXdY�Z,dZd[�Z-d\d]�Z.d^d_�Z/d`da�Z0dbdc�Z1ddde�Z2dfdg�Z3dhdi�Z4djdk�Z5dlS)oraInformational class which holds the details about an
       archive member given by a tar header block.
       TarInfo objects are returned by TarFile.getmember(),
       TarFile.getmembers() and TarFile.gettarinfo() and are
       usually created internally.
    r�rhr)r*r'r(�chksum�typer�r+r,�devmajor�devminorr�r��pax_headersr�r��_sparse_structs�_link_targetr�cCsj||_d|_d|_d|_d|_d|_d|_t|_d|_	d|_
d|_d|_d|_
d|_d|_d|_i|_dS)zXConstruct a TarInfo object. name is the optional name
           of the member.
        i�rr�N)r�rhr)r*r'r(r��REGTYPEr�r�r+r,r�r�r�r�r�r)r�r�r6r6r7r��s"zTarInfo.__init__cCs|jS)N)r�)r�r6r6r7�_getpath�szTarInfo._getpathcCs
||_dS)N)r�)r�r�r6r6r7�_setpath�szTarInfo._setpathcCs|jS)N)r�)r�r6r6r7�_getlinkpath�szTarInfo._getlinkpathcCs
||_dS)N)r�)r�r�r6r6r7�_setlinkpath�szTarInfo._setlinkpathcCsd|jj|jt|�fS)Nz<%s %r at %#x>)r�rqr��id)r�r6r6r7�__repr__�szTarInfo.__repr__T)
r�r(rhr�r)r*r+r,r��_KEEPc
Cs�|	rtj|�}n
tj|�}||
k	r(||_||
k	r6||_||
k	rD||_||
k	rR||_||
k	r`||_||
k	rn||_||
k	r|||_||
k	r�||_	|S)zGReturn a deep copy of self with the given attributes replaced.
        )
�copy�deepcopyr�r(rhr�r)r*r+r,)r�r�r(rhr�r)r*r+r,r�r
�resultr6r6r7r��s(
zTarInfo.replacecCs�|jdkrd}n
|jd@}|j||j|j|j|j|j|j|j|j	|j
|j|jd�
}|dt
kr~|djd�r~|dd7<|S)z9Return the TarInfo's attributes as a dictionary.
        Ni�)
r�rhr)r*r'r(r�r�r�r+r,r�r�r�r�r�)rhr�r)r*r'r(r�r�r�r+r,r�r��DIRTYPEr�)r�rh�infor6r6r7�get_info�s&


zTarInfo.get_info�surrogateescapecCs~|j�}x(|j�D]\}}|dkrtd|��qW|tkrH|j|||�S|tkr^|j|||�S|tkrr|j||�Std��dS)z<Return a tar header as a string of 512 byte blocks.
        Nz%s may not be Nonezinvalid format)	r�itemsr.r
�create_ustar_headerr�create_gnu_headerr�create_pax_header)r�rPr4r5rr��valuer6r6r7�tobuf�sz
TarInfo.tobufcCsnt|d<t|dj||��tkr(td��t|dj||��tkr^|j|d||�\|d<|d<|j|t||�S)z3Return the object as a ustar header block.
        �magicr�zlinkname is too longr��prefix)	�POSIX_MAGICr0r/�LENGTH_LINKr.�LENGTH_NAME�_posix_split_name�_create_headerr
)r�rr4r5r6r6r7r�szTarInfo.create_ustar_headercCs�t|d<d}t|dj||��tkr<||j|dt||�7}t|dj||��tkrl||j|dt||�7}||j|t	||�S)z:Return the object as a GNU header block sequence.
        rr�r�r�)
�	GNU_MAGICr0r/r�_create_gnu_long_header�GNUTYPE_LONGLINKr�GNUTYPE_LONGNAMErr)r�rr4r5rTr6r6r7rszTarInfo.create_gnu_headerc
Cs4t|d<|jj�}x�ddtfddtfddfD]h\}}}||kr@q,y||jd	d
�Wn"tk
rv||||<w,YnXt||�|kr,||||<q,WxldD]d\}}||kr�d||<q�||}d|ko�d|dkn�s�t|t	�r�t
|�||<d||<q�W|�r|j|t|�}	nd}	|	|j
|td	d�S)z�Return the object as a ustar header block. If it cannot be
           represented this way, prepend a pax extended header sequence
           with supplement information.
        rr�r%r�r&r+� r,rBrCr)r@r*r'�r(rr#r�r�)r+r+r#)r,r,r#�r)r@�r*r@�r'r$�r(r$)r%r&r'r()rrrrrr/�UnicodeEncodeErrorr0�
isinstance�float�str�_create_pax_generic_header�XHDTYPErr
)
r�rr4rr�Zhnamer3rO�valrTr6r6r7rs4
.zTarInfo.create_pax_headercCs|j|td�S)zAReturn the object as a pax global header block sequence.
        zutf-8)r-�XGLTYPE)�clsrr6r6r7�create_pax_global_header?sz TarInfo.create_pax_global_headercCs�|jd�}xltdt|��D]R}dj|d|��}dj||d��}t|j||��tkrt|j||��tkrPqWtd��||fS)zUSplit a name longer than 100 chars into a prefix
           and a name part.
        r�r#Nzname is too long)�splitrEr0r�r/�
LENGTH_PREFIXrr.)r�r�r4r5Z
componentsrJrr6r6r7rEs
zTarInfo._posix_split_namecCs�|jd�ttfk}|r@t|jdd�d|�}t|jdd�d|�}ntdd||�}tdd||�}|jdt�}|dkrxtd��t|jd	d�d
||�t|jdd�d@d|�t|jd
d�d|�t|jdd�d|�t|jdd�d|�t|jdd�d|�d|t|jdd�d
||�|jdt�t|jdd�d||�t|jdd�d||�t|jdd�d|�t|jdd�d|�t|jdd�d||�g}tj	dt
dj|��}	t|	t
d��d}
|	dd �t
d|
d�|	d!d�}	|	S)"z�Return a header block. info is a dictionary with file
           information, format must be one of the *_FORMAT constants.
        r�r�rr@r�r�NzTarInfo.type must not be Noner�rrhi�r)r*r'r$r(s        r�rr+r#r,rrz%dsr�ilz%06orBiei����i����)�get�CHRTYPE�BLKTYPErQr8rr.rrSr�r�r�rUrL)rrPr4r5Zhas_device_fieldsr�r�Zfiletype�partsrTr�r6r6r7rUs8
&zTarInfo._create_headercCs.tt|�t�\}}|dkr*|t|t7}|S)zdReturn the string payload filled with zero bytes
           up to the next 512 byte border.
        r)rYr0r�r1)Zpayloadr`rar6r6r7�_create_payloadszTarInfo._create_payloadcCsR|j||�t}i}d|d<||d<t|�|d<t|d<|j|t||�|j|�S)zTReturn a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence
           for name.
        z
././@LongLinkr�r�r'r)r/r1r0rrr
r9)r1r�r�r4r5rr6r6r7r �szTarInfo._create_gnu_long_headercCs:d}x@|j�D]4\}}y|jdd�Wqtk
r@d}PYqXqWd}|rV|d7}x�|j�D]�\}}|jd�}|r�|j|d�}n
|jd�}t|�t|�d}d	}	}
x"|tt|
��}	|	|
kr�P|	}
q�W|tt|
�d
�d|d|d
7}q`Wi}d|d<||d<t|�|d<t|d<|j|td
d�|j	|�S)z�Return a POSIX.1-2008 extended or global header sequence
           that contains a list of keyword, value pairs. The values
           must be strings.
        Fzutf-8rCTr�s21 hdrcharset=BINARY
rr�rrB� �=�
z././@PaxHeaderr�r�r'rr�)
rr/r)r0r,rLrrr
r9)r1rr�r4Zbinary�keywordrZrecords�lrIr<rr6r6r7r-�s<

*z"TarInfo._create_pax_generic_headercCstt|�dkrtd��t|�tkr(td��|jt�tkr>td��t|dd��}|t|�krbt	d��|�}t
|dd�||�|_t|dd	��|_t|d	d
��|_
t|d
d��|_t|dd��|_t|dd��|_||_|dd
�|_t
|d
d�||�|_t
|dd�||�|_t
|dd�||�|_t|dd��|_t|dd��|_t
|dd�||�}|jtk�r�|jjd��r�t|_|jtk�r6d}g}xrtd�D]f}	y0t|||d��}
t||d|d��}Wntk
�r�PYnX|j|
|f�|d7}�q�Wt|d�}t|dd��}
|||
f|_ |j!��rN|jj"d�|_|�rp|jt#k�rp|d|j|_|S)zAConstruct a TarInfo object from a 512 byte bytes object.
        rzempty headerztruncated headerzend of file header��zbad checksumr�l�t�|��ii	i)iIiQiYi�r�i�r�r$�i�i�i�)$r0rur�rv�countr1rwrKrUrHr=r�rhr)r*r'r(r�r�r�r+r,r�r��AREGTYPEr�r�GNUTYPE_SPARSErEr.r��boolrr��rstrip�	GNU_TYPES)r1rTr4r5r��objrr��structsrJr��numbytes�
isextended�origsizer6r6r7�frombuf�sZ
zTarInfo.frombufcCs8|jjt�}|j||j|j�}|jj�t|_|j|�S)zOReturn the next TarInfo object from TarFile object
           tarfile.
        )	r�rZr�rRr4r5r�r��_proc_member)r1r�rTrMr6r6r7�fromtarfileszTarInfo.fromtarfilecCsT|jttfkr|j|�S|jtkr,|j|�S|jtttfkrF|j	|�S|j
|�SdS)zYChoose the right processing method depending on
           the type and call it.
        N)r�r"r!�
_proc_gnulongrI�_proc_sparser.r0�SOLARIS_XHDTYPE�	_proc_pax�
_proc_builtin)r�r�r6r6r7rS!s



zTarInfo._proc_membercCsR|jj�|_|j}|j�s$|jtkr4||j|j�7}||_|j	|j
|j|j�|S)zfProcess a builtin type or an unknown type which
           will be treated as a regular file.
        )
r�r�r�r�r��SUPPORTED_TYPES�_blockr'r��_apply_pax_inforr4r5)r�r�r�r6r6r7rY.szTarInfo._proc_builtincCs�|jj|j|j��}y|j|�}Wntk
r>td��YnX|j|_|jt	krft
||j|j�|_
n|jtkr�t
||j|j�|_|S)zSProcess the blocks that hold a GNU longname
           or longlink member.
        z missing or bad subsequent header)r�rZr[r'rTrrxr�r�r"r=r4r5r�r!r�)r�r�rT�nextr6r6r7rU?s

zTarInfo._proc_gnulongc
Cs�|j\}}}|`x�|r�|jjt�}d}xvtd�D]j}y0t|||d��}t||d|d��}	Wntk
rzPYnX|r�|	r�|j||	f�|d7}q0Wt|d�}qW||_	|jj
�|_|j|j|j
�|_||_
|S)z8Process a GNU sparse header plus extra headers.
        r�r$rFi�)rr�rZr�rErKr.r�rJr�r�r�r[r'r�)
r�r�rNrPrQrTr�rJr�rOr6r6r7rVUs(zTarInfo._proc_sparsecCs�|jj|j|j��}|jtkr&|j}n
|jj�}d}d}g}�x0t|�|koV||dk�rnt	j
||�}|srtd��yt|j
d��}Wntk
r�td��YnX|dkr�td��||t|�kr�td��|jd�|d}	||jd�d|	�}
|
jd�\}}}
|�s"|dk�s"||	dk�r*td��|j|||
f�|dk�rd|dk�rd|
d	k�r`|j}nd
}||7}q@W|dk�r~d
}x`|D]X\}}}
|j|d
d
|j�}|tk�r�|j|
||j|j�}n|j|
d
d
|j�}|||<�q�Wy|j|�}Wntk
�rtd��YnXd|k�r&|j||�nFd
|k�r>|j||�n.|jd�dk�rl|jd�dk�rl|j|||�|jttfk�r�|j ||j|j�|j!|_!d|k�r�|j"}|j#��s�|jt$k�r�||j|j�7}||_!|S)zVProcess an extended or global header as described in
           POSIX.1-2008.
        rNzinvalid headerr#�r;r�s
hdrcharsetsBINARYzutf-8z missing or bad subsequent headerzGNU.sparse.mapzGNU.sparse.sizezGNU.sparse.major�1zGNU.sparse.minorrDr')%r�rZr[r'r�r0rrr0�_header_length_prefix_re�matchrHrF�groupr.r�rk�	partitionr�r4�_decode_pax_fieldr5�PAX_NAME_FIELDSrTrrx�_proc_gnusparse_01�_proc_gnusparse_00r5�_proc_gnusparse_10r.rWr\r�r�r�rZ)r�r�rTrr�r4�raw_headersrbr3Zheader_value_end_offsetZkeyword_and_valueZraw_keywordZequalsZ	raw_valuer=rr]r�r6r6r7rXqsx

 







 
zTarInfo._proc_paxcCs�g}g}x�|D]�\}}}|dkrVy|jt|j���Wq�tk
rRtd��Yq�Xq|dkry|jt|j���Wqtk
r�td��YqXqWtt||��|_dS)z?Process a GNU tar extended sparse header, version 0.0.
        sGNU.sparse.offsetzinvalid headersGNU.sparse.numbytesN)r�rFr;r.rH�list�zipr�)r�r]rjZoffsetsrO�_r=rr6r6r7rh�szTarInfo._proc_gnusparse_00cCs@dd�|djd�D�}tt|ddd�|ddd���|_dS)z?Process a GNU tar extended sparse header, version 0.1.
        cSsg|]}t|��qSr6)rF)�.0�xr6r6r7�
<listcomp>sz.TarInfo._proc_gnusparse_01.<locals>.<listcomp>zGNU.sparse.map�,Nr$r#)r3rkrlr�)r�r]rr�r6r6r7rg�szTarInfo._proc_gnusparse_01cCs�d}g}|jjt�}|jdd�\}}t|�}xJt|�|dkrvd|krV||jjt�7}|jdd�\}}|jt|��q.W|jj�|_t	t
|ddd�|ddd���|_dS)z?Process a GNU tar extended sparse header, version 1.0.
        Nr<r#r$)r�rZr�r3rFr0r�r�r�rkrlr�)r�r]rr�Zfieldsr�rTZnumberr6r6r7riszTarInfo._proc_gnusparse_10c
Cs�x�|j�D]�\}}|dkr(t|d|�q
|dkrBt|dt|��q
|dkr\t|dt|��q
|tkr
|tkr�yt||�}Wntk
r�d}YnX|dkr�|jd�}t|||�q
W|j�|_dS)	zoReplace fields with supplemental information from a previous
           pax extended or global header.
        zGNU.sparse.namer%zGNU.sparse.sizer'zGNU.sparse.realsizerr�N)	r�setattrrF�
PAX_FIELDS�PAX_NUMBER_FIELDSr.rKrr)r�rr4r5r=rr6r6r7r\s"

zTarInfo._apply_pax_infocCs.y|j|d�Stk
r(|j||�SXdS)z1Decode a single field from a pax record.
        rCN)r;�UnicodeDecodeError)r�rr4Zfallback_encodingZfallback_errorsr6r6r7re,szTarInfo._decode_pax_fieldcCs"t|t�\}}|r|d7}|tS)z_Round up a byte count by BLOCKSIZE and return it,
           e.g. _block(834) => 1024.
        r#)rYr�)r�rGr`rar6r6r7r[4szTarInfo._blockcCs
|jtkS)N)r��
REGULAR_TYPES)r�r6r6r7r�=sz
TarInfo.isregcCs|j�S)N)r�)r�r6r6r7�isfile?szTarInfo.isfilecCs
|jtkS)N)r�r)r�r6r6r7r�Asz
TarInfo.isdircCs
|jtkS)N)r��SYMTYPE)r�r6r6r7r�Csz
TarInfo.issymcCs
|jtkS)N)r��LNKTYPE)r�r6r6r7r�Esz
TarInfo.islnkcCs
|jtkS)N)r�r6)r�r6r6r7�ischrGsz
TarInfo.ischrcCs
|jtkS)N)r�r7)r�r6r6r7�isblkIsz
TarInfo.isblkcCs
|jtkS)N)r��FIFOTYPE)r�r6r6r7�isfifoKszTarInfo.isfifocCs
|jdk	S)N)r�)r�r6r6r7�issparseMszTarInfo.issparsecCs|jtttfkS)N)r�r6r7r|)r�r6r6r7�isdevOsz
TarInfo.isdevN)r�rhr)r*r'r(r�r�r�r+r,r�r�r�r�rr�r�rr)r�)6rqrrrsrt�	__slots__r�rr�propertyr%rrr&r	r
r�rrrrrrr�classmethodr2r�staticmethodrr9r r-rRrTrSrYrUrVrXrhrgrir\rer[r�rwr�r�r�rzr{r}r~rr6r6r6r7rssf



1*
3?
z	c
@s�eZdZdZdZdZdZdZeZ	e
ZdZe
ZeZdZdkdd	�Zedddefd
d��Zedldd
��Zedmdd��Zedndd��Zedodd��Zddddd�Zdd�Zdd�Zdd�Zd d!�Zdpd"d#�Zdqdd%�d&d'�Z drdd(�d)d*�Z!dsd+d,�Z"d-d.�Z#dtddd0�d1d2�Z$d3d4�Z%duddd0�d6d7�Z&d8d9�Z'dvd:d;�Z(d<d=�Z)d>d?�Z*d@dA�Z+dwdddB�dCdD�Z,dEdF�Z-dGdH�Z.dIdJ�Z/dKdL�Z0dMdN�Z1dOdP�Z2dQdR�Z3dSdT�Z4dUdV�Z5dWdX�Z6dYdZ�Z7dxd[d\�Z8d]d^�Z9dyd_d`�Z:dadb�Z;dcdd�Z<dedf�Z=dgdh�Z>didj�Z?dS)zrz=The TarFile Class provides an interface to tar archives.
    rFr#NrzrcCs�ddddd�}||krtd��||_|||_|sj|jdkrVtjj|�rVd|_d|_t||j�}d	|_n@|d
kr�t|d�r�t	|j
ttf�r�|j
}t|d�r�|j|_d
|_|r�tjj
|�nd
|_
||_|d
k	r�||_|d
k	r�||_|d
k	r�||_|d
k	�r||_|d
k	�r||_|	|_|
d
k	�r4|jtk�r4|
|_ni|_|d
k	�rJ||_|d
k	�rZ||_|
|_d	|_g|_d	|_|jj�|_i|_�y�|jdk�r�d
|_ |j!�|_ |jdk�r8x�|jj"|j�y|jj#|�}|jj$|�WnTt%k
�r|jj"|j�PYn0t&k
�r0}zt't|���WYd
d
}~XnX�q�W|jdk�r�d
|_|j�r�|jj(|jj)��}|jj*|�|jt+|�7_Wn&|j�s�|jj,�d
|_�YnXd
S)a�Open an (uncompressed) tar archive `name'. `mode' is either 'r' to
           read from an existing archive, 'a' to append data to an existing
           file or 'w' to create a new file overwriting an existing one. `mode'
           defaults to 'r'.
           If `fileobj' is given, it is used for reading or writing data. If it
           can be determined, `mode' is overridden by `fileobj's mode.
           `fileobj' is not closed, when TarFile is closed.
        �rbzr+b�wbZxb)rz�ar{roz!mode must be 'r', 'a', 'w' or 'x'r�r{FNr�rhTrzro)r�r{ro)-r.rh�_moder}r%�exists�	bltn_openr�r�r*r�r,rL�abspathr�rPr��dereference�ignore_zerosr4r5rr�debug�
errorlevel�copybufsizer��members�_loadedr�r��inodes�firstmemberr]r�rTr�rwrrr2rr[r0r�)r�r�rhr�rPr�r�r�r4r5rr�r�r�Zmodes�erTr6r6r7r�os�






$
zTarFile.__init__c

s�|r|rtd��|dkr��fdd�}xtt�j|d�D]b}t��j|�}|dk	r\|j�}	y||d|f|�Sttfk
r�|dk	r�|j|	�w8Yq8Xq8Wtd���nd	|k�r|jd	d
�\}
}|
p�d}
|p�d}|�jkr�t��j|�}ntd|��|||
|f|�Sd
|k�r�|jd
d
�\}
}|
�p.d}
|�p8d}|
dk�rLtd��t	||
|||�}y�||
|f|�}Wn|j
��YnXd|_|S|dk�r��j|||f|�Std��dS)a�Open a tar archive for reading, writing or appending. Return
           an appropriate TarFile class.

           mode:
           'r' or 'r:*' open for reading with transparent compression
           'r:'         open for reading exclusively uncompressed
           'r:gz'       open for reading with gzip compression
           'r:bz2'      open for reading with bzip2 compression
           'r:xz'       open for reading with lzma compression
           'a' or 'a:'  open for appending, creating the file if necessary
           'w' or 'w:'  open for writing without compression
           'w:gz'       open for writing with gzip compression
           'w:bz2'      open for writing with bzip2 compression
           'w:xz'       open for writing with lzma compression

           'x' or 'x:'  create a tarfile exclusively without compression, raise
                        an exception if the file is already created
           'x:gz'       create a gzip compressed tarfile, raise an exception
                        if the file is already created
           'x:bz2'      create a bzip2 compressed tarfile, raise an exception
                        if the file is already created
           'x:xz'       create an lzma compressed tarfile, raise an exception
                        if the file is already created

           'r|*'        open a stream of tar blocks with transparent compression
           'r|'         open an uncompressed stream of tar blocks for reading
           'r|gz'       open a gzip compressed stream of tar blocks
           'r|bz2'      open a bzip2 compressed stream of tar blocks
           'r|xz'       open an lzma compressed stream of tar blocks
           'w|'         open an uncompressed stream for writing
           'w|gz'       open a gzip compressed stream for writing
           'w|bz2'      open a bzip2 compressed stream for writing
           'w|xz'       open an lzma compressed stream for writing
        znothing to openrz�r:*cs�j|dkS)N�taropen)�	OPEN_METH)r�)r1r6r7�not_compressedsz$TarFile.open.<locals>.not_compressed)�keyNz%file could not be opened successfully�:r#r�zunknown compression type %r�|r{zmode must be 'r' or 'w'Fr�rozundiscernible mode)rzr�)rzr{)r�r{ro)
r.�sortedr�rlr�rrr�r3r�r�r�r�)
r1r�rhr�r_�kwargsr�r��funcZ	saved_posrg�streamr�r6)r1r7r�sP%







zTarFile.opencKs |dkrtd��||||f|�S)zCOpen uncompressed tar archive name for reading or writing.
        rzr�r{roz!mode must be 'r', 'a', 'w' or 'x')rzr�r{ro)r.)r1r�rhr�r�r6r6r7r�9szTarFile.taropenr�cKs�|dkrtd��yddl}|jWn ttfk
rBtd��YnXy|j||d||�}Wn.tk
r�|dk	r�|dkr�td	���YnXy|j|||f|�}WnBtk
r�|j	�|dkr�td	���Yn|j	��YnXd
|_
|S)zkOpen gzip compressed tar archive name for reading or writing.
           Appending is not allowed.
        rzr{rozmode must be 'r', 'w' or 'x'rNzgzip module is not availablerbznot a gzip fileF)rzr{ro)r.�gzipZGzipFiler��AttributeErrorrr�rr�r�r�)r1r�rhr��
compresslevelr�r�r�r6r6r7�gzopenAs2
zTarFile.gzopencKs�|dkrtd��yddl}Wntk
r8td��YnX|j|pD|||d�}y|j|||f|�}WnFttfk
r�|j�|dkr�t	d	���Yn|j��YnXd
|_
|S)zlOpen bzip2 compressed tar archive name for reading or writing.
           Appending is not allowed.
        rzr{rozmode must be 'r', 'w' or 'x'rNzbz2 module is not available)r�znot a bzip2 fileF)rzr{ro)r.r�r�rZBZ2Filer�r��EOFErrorr�rr�)r1r�rhr�r�r�r�r�r6r6r7�bz2opencs(zTarFile.bz2opencKs�|dkrtd��yddl}Wntk
r8td��YnX|j|pD|||d�}y|j|||f|�}WnH|jtfk
r�|j�|dkr�t	d	���Yn|j��YnXd
|_
|S)zkOpen lzma compressed tar archive name for reading or writing.
           Appending is not allowed.
        rzr{rozmode must be 'r', 'w' or 'x'rNzlzma module is not available)�presetznot an lzma fileF)rzr{ro)r.r�r�rZLZMAFiler�r�r�r�rr�)r1r�rhr�r�r�r�r�r6r6r7�xzopen�s&zTarFile.xzopenr�r�r�r�)r�r�r�r�c
Cs�|jr
dSd|_z`|jdkrn|jjttd�|jtd7_t|jt�\}}|dkrn|jjtt|�Wd|j	s�|jj
�XdS)	zlClose the TarFile. In write-mode, two finishing zero blocks are
           appended to the archive.
        NTr�r{ror$r)r�r{ro)r�rhr�r[r1r�r�rY�
RECORDSIZEr�r�)r�r`rar6r6r7r��s
z
TarFile.closecCs"|j|�}|dkrtd|��|S)aReturn a TarInfo object for member `name'. If `name' can not be
           found in the archive, KeyError is raised. If a member occurs more
           than once in the archive, its last occurrence is assumed to be the
           most up-to-date version.
        Nzfilename %r not found)�
_getmember�KeyError)r�r�r�r6r6r7�	getmember�s
zTarFile.getmembercCs|j�|js|j�|jS)z�Return the members of the archive as a list of TarInfo objects. The
           list has the same order as the members in the archive.
        )�_checkr��_loadr�)r�r6r6r7�
getmembers�szTarFile.getmemberscCsdd�|j�D�S)z�Return the members of the archive as a list of their names. It has
           the same order as the list returned by getmembers().
        cSsg|]
}|j�qSr6)r�)rnr�r6r6r7rp�sz$TarFile.getnames.<locals>.<listcomp>)r�)r�r6r6r7�getnames�szTarFile.getnamescCsp|jd�|dk	r|j}|dkr$|}tjj|�\}}|jtjd�}|jd�}|j�}||_	|dkr�t
td�r�|jr�tj|�}q�tj
|�}ntj|j��}d}|j}t
j|��r|j|jf}	|jr�|jdkr�|	|jkr�||j|	kr�t}
|j|	}nt}
|	d�rx||j|	<nht
j|��r"t}
nVt
j|��r4t}
nDt
j|��rPt}
tj|�}n(t
j|��rbt }
nt
j!|��rtt"}
ndS||_||_#|j$|_%|j&|_'|
tk�r�|j(|_)nd|_)|j*|_+|
|_,||_-t.�r�yt.j/|j%�d|_0Wnt1k
�r�YnXt2�r*yt2j3|j'�d|_4Wnt1k
�r(YnX|
t t"fk�rlt
td��rlt
td	��rltj5|j6�|_7tj8|j6�|_9|S)
a�Create a TarInfo object from the result of os.stat or equivalent
           on an existing file. The file is either named by `name', or
           specified as a file object `fileobj' with a file descriptor. If
           given, `arcname' specifies an alternative name for the file in the
           archive, otherwise, the name is taken from the 'name' attribute of
           'fileobj', or the 'name' argument. The name should be a text
           string.
        �awxNr��lstatr�r#r�major�minor):r�r�r}r%�
splitdriver�r�r�r�r�r�r�r�rf�fstat�fileno�st_mode�S_ISREG�st_ino�st_dev�st_nlinkr�ryr�S_ISDIRr�S_ISFIFOr|�S_ISLNKrx�readlink�S_ISCHRr6�S_ISBLKr7rh�st_uidr)�st_gidr*�st_sizer'�st_mtimer(r�r��pwd�getpwuidr+r��grpZgetgrgidr,r��st_rdevr�r�r�)r�r��arcnamer�Zdrvr�Zstatresr�Zstmd�inoder�r6r6r7�
gettarinfo�s~	




zTarFile.gettarinfoT)r�cCs0|j�|dkr|}�x|D�]
}|r�|jdkr:td�nttj|j��td|jpX|j|jpb|jf�|j	�sz|j
�r�tdd|j|jf�ntd|j
�|jdkr�td�ntdtj|j�dd	��t|j|j�r�d
nd�|�r"|j��r
td|j�|j��r"td
|j�t�qWdS)aPrint a table of contents to sys.stdout. If `verbose' is False, only
           the names of the members are printed. If it is True, an `ls -l'-like
           output is produced. `members' is optional and must be a subset of the
           list returned by getmembers().
        Nz
??????????z%s/%sz%10sz%d,%dz%10dz????-??-?? ??:??:??z%d-%02d-%02d %02d:%02d:%02dr�r�r�z-> zlink to )r�rhrprfrgr+r)r,r*rzr{r�r�r'r(r�Z	localtimer�r�r�r�r�ro)r��verboser�r�r6r6r7rk;s2





zTarFile.list)�filterc	
Csv|jd�|dkr|}|dk	rPddl}|jdtd�||�rP|jdd|�dS|jdk	r�tjj|�|jkr�|jdd|�dS|jd|�|j	||�}|dkr�|jdd	|�dS|dk	r�||�}|dkr�|jdd|�dS|j
��rt|d
��}|j||�WdQRXnd|j
��rh|j|�|�rrxHtj|�D].}|jtjj||�tjj||�|||d��q4Wn
|j|�dS)a~Add the file `name' to the archive. `name' may be any type of file
           (directory, fifo, symbolic link, etc.). If given, `arcname'
           specifies an alternative name for the file in the archive.
           Directories are added recursively by default. This can be avoided by
           setting `recursive' to False. `exclude' is a function that should
           return True for each filename to be excluded. `filter' is a function
           that expects a TarInfo object argument and returns the changed
           TarInfo object, if it returns None the TarInfo object will be
           excluded from the archive.
        r�Nrzuse the filter argument insteadr$ztarfile: Excluded %rztarfile: Skipped %rr#ztarfile: Unsupported type %rr�)r�)r�rcrdre�_dbgr�r}r%r�r�r�r��addfiler��listdir�addr�)	r�r�r��	recursiveZexcluder�rcr��fr6r6r7r�asB



zTarFile.addcCs�|jd�tj|�}|j|j|j|j�}|jj|�|jt	|�7_|j
}|dk	r�t||j|j|d�t
|jt�\}}|dkr�|jjtt|�|d7}|j|t7_|jj|�dS)aAdd the TarInfo object `tarinfo' to the archive. If `fileobj' is
           given, it should be a binary file, and tarinfo.size bytes are read
           from it and added to the archive. You can create TarInfo objects
           directly, or by using gettarinfo().
        r�N)r_rr#)r�rrrPr4r5r�r[r�r0r�rXr'rYr�r1r�r�)r�r�r�rTr_r`rar6r6r7r��s

zTarFile.addfilec"CsH|dk�r|j}|dk�r�tjjd�}|dkr�ytt�}Wntk
rNYnBXddl}|jddd�}|�|j	|�WdQRX|jdddd�}|r�yt
|}Wn&tk
r�td|�d	��d�YnX||_|St
�r�tjdt�tStSt|t��rtd��|St|��r|Syt
|Stk
�rBtd|�d	��d�YnXdS)NZ PYTHON_TARFILE_EXTRACTION_FILTERr�#)Z
interpolationZcomment_prefixesr�r�)Zfallbackzfilter z
 not foundz4The default behavior of tarfile extraction has been z$changed to disallow common exploits z(including CVE-2007-4559). z1By default, absolute/parent paths are disallowed z and some mode bits are cleared. z/See https://access.redhat.com/articles/7004769 zfor more details.z#String names are not supported for z2TarFile.extraction_filter. Use a function such as ztarfile.data_filter directly.)r�zXThe default behavior of tarfile extraction has been changed to disallow common exploits zsThe default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). z�The default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed z�The default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. z�The default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. See https://access.redhat.com/articles/7004769 aThe default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. See https://access.redhat.com/articles/7004769 for more details.zUString names are not supported for TarFile.extraction_filter. Use a function such as zrString names are not supported for TarFile.extraction_filter. Use a function such as tarfile.data_filter directly.)�extraction_filterr}�environr5r��_CONFIG_FILENAME�FileNotFoundError�configparserZConfigParserZ	read_file�_NAMED_FILTERSr�r.�_RH_SAFER_DEFAULTrcrd�RuntimeWarningr�r�r*r,�	TypeError�callable)r�r�r��filer�Zconfr6r6r7�_get_filter_function�sR


zTarFile._get_filter_function�.)�
numeric_ownerr�c"Cs�g}|j|�}|dkr|}xT|D]L}|j|||�\}}	|dkr@q |j�rR|j|	�|j|||j�||d�q W|jdd�dd��x$|D�]}	y�y||	|�}Wn4tk
r�}
z|j|	t|
��w�WYdd}
~
XnX|dkr�|j|	d�w�t	j
j||j�}yt	j
|�}Wn$tk
�r.|j|d�w�YnXtj|j��sL|j|d	�w�|j|||d
�|j||�|j||�Wq�tk
�r�}
z|j|
�WYdd}
~
Xq�Xq�WdS)a�Extract all members from the archive to the current working
           directory and set owner, modification time and permissions on
           directories afterwards. `path' specifies a different directory
           to extract to. `members' is optional and must be a subset of the
           list returned by getmembers(). If `numeric_owner` is True, only
           the numbers for user/group names are used and not the names.

           The `filter` function will be called on each member just
           before extraction.
           It can return a changed TarInfo or None to skip the member.
           String names of common filters are accepted.
        N)�	set_attrsr��filter_functioncSs|jS)N)r�)r�r6r6r7�<lambda>	sz$TarFile.extractall.<locals>.<lambda>T)r��reversezexcluded by filterZmissingznot a directory)r�)r��_get_extract_tarinfor�r��_extract_one�sort�_FILTER_ERRORS�_log_no_directory_fixup�reprr}r%r�r�r�r�rfr�r��chown�utime�chmodr
�_handle_nonfatal_error)r�r%r�r�r�Zdirectoriesr�r�r��
unfiltered�exc�dirpathr�r�r6r6r7�
extractall�sP


zTarFile.extractallcCs|jdd|j|f�dS)Nr$z(tarfile: Not fixing up directory %r (%s))r�r�)r�r��reasonr6r6r7r�1	szTarFile._log_no_directory_fixupr�c	Cs8|j|�}|j|||�\}}|dk	r4|j||||�dS)a�Extract a member from the archive to the current working directory,
           using its full name. Its file information is extracted as accurately
           as possible. `member' may be a filename or a TarInfo object. You can
           specify a different directory using `path'. File attributes (owner,
           mtime, mode) are set unless `set_attrs' is False. If `numeric_owner`
           is True, only the numbers for user/group names are used and not
           the names.

           The `filter` function will be called before extraction.
           It can return a changed TarInfo or None to skip the member.
           String names of common filters are accepted.
        N)r�r�r�)	r�r�r%r�r�r�r�r�r�r6r6r7�extract5	s

zTarFile.extractcCs�t|t�r|j|�}n|}d}y|||�}WnZttfk
r\}z|j|�WYdd}~Xn,tk
r�}z|j|�WYdd}~XnX|dkr�|jdd|j	�dS|j
�r�tj|�}tj
j||j�|_||fS)z�Get (filtered, unfiltered) TarInfos from *member*

        *member* might be a string.

        Return (None, None) if not found.
        Nr$ztarfile: Excluded %r)NN)r*r,r�r�r��_handle_fatal_errorr
r�r�r�r�rr}r%r�r�r)r�r�r�r%r��filteredr�r6r6r7r�I	s"

zTarFile._get_extract_tarinfocCs�|jd�y&|j|tjj||j�||||d�WnVtk
r\}z|j|�WYdd}~Xn,tk
r�}z|j	|�WYdd}~XnXdS)z�Extract from filtered tarinfo to disk.

           filter_function is only used when extracting a *different*
           member (e.g. as fallback to creating a symlink)
        rz)r�r�r��extraction_rootN)
r��_extract_memberr}r%r�r�r�r�r
r�)r�r�r%r�r�r�r�r6r6r7r�g	s
zTarFile._extract_onecCs"|jdkr�n|jdd|�dS)z=Handle non-fatal error (ExtractError) according to errorlevelr#ztarfile: %sN)r�r�)r�r�r6r6r7r�{	s
zTarFile._handle_nonfatal_errorcCsn|jdkr�n\t|t�rP|jdkr6|jdd|j�qj|jdd|j|jf�n|jddt|�j|f�dS)z1Handle "fatal" error according to self.errorlevelrNr#ztarfile: %sztarfile: %s %rztarfile: %s %s)r�r*r��filenamer��strerrorr�rq)r�r�r6r6r7r��	s


zTarFile._handle_fatal_errorcCs�|jd�t|t�r |j|�}n|}|j�s6|jtkrB|j||�S|j�sR|j	�rzt|j
t�rhtd��q~|j
|j|��SndSdS)z�Extract a member from the archive as a file object. `member' may be
           a filename or a TarInfo object. If `member' is a regular file or a
           link, an io.BufferedReader object is returned. Otherwise, None is
           returned.
        rzz'cannot extract (sym)link as file objectN)r�r*r,r�r�r�rZ�
fileobjectr�r�r�r�r	�extractfile�_find_link_target)r�r�r�r6r6r7r��	s


zTarFile.extractfile)r�r�cCs\|jd�}|jdtj�}tjj|�}|r@tjj|�r@tj|�|j�sP|j	�rj|j
dd|j|jf�n|j
d|j�|j
�r�|j||�n�|j�r�|j||�n~|j�r�|j||�nh|j�s�|j�r�|j||�nJ|j�s�|j	�r�|j||||d�n&|jtk�r|j||�n|j||�|�rX|j|||�|j	��sX|j||�|j||�dS)z�Extract the filtered TarInfo object tarinfo to a physical
           file called targetpath.

           filter_function is only used when extracting a *different*
           member (e.g. as fallback to creating a symlink)
        r�r#z%s -> %s)r�r�N)rKr�r}r�r%r�r��makedirsr�r�r�r�r�r��makefiler��makedirr}�makefiforzr{�makedev�makelink_with_filterr�rZ�makeunknownr�r�r�)r�r��
targetpathr�r�r�r�Z	upperdirsr6r6r7r��	s:



zTarFile._extract_membercCs@y&|jdkrtj|�ntj|d�Wntk
r:YnXdS)z,Make a directory called targetpath.
        Ni�)rhr}�mkdir�FileExistsError)r�r�rr6r6r7r�	s
zTarFile.makedircCs�|j}|j|j�|j}t|d��f}|jdk	rrx,|jD]"\}}|j|�t|||t|�q6W|j|j�|j	�nt|||jt|�WdQRXdS)z'Make a file called targetpath.
        r�N)
r�r�r�r�r�r�rXrr'�truncate)r�r�r�sourcer_�targetr�r'r6r6r7r�	s


zTarFile.makefilecCs"|j||�|jdd|j�dS)zYMake a file from a TarInfo object with an unknown type
           at targetpath.
        r#z9tarfile: Unknown file type %r, extracted as regular file.N)rr�r�)r�r�rr6r6r7r
szTarFile.makeunknowncCs"ttd�rtj|�ntd��dS)z'Make a fifo called targetpath.
        �mkfifozfifo not supported by systemN)r�r}rr
)r�r�rr6r6r7r
s
zTarFile.makefifocCsnttd�sttd�r td��|j}|dkr2d}|j�rF|tjO}n
|tjO}tj||tj	|j
|j��dS)z<Make a character or block device called targetpath.
        �mknodrz'special devices not supported by systemNi�)r�r}r
rhr{rf�S_IFBLK�S_IFCHRrrr�r�)r�r�rrhr6r6r7r
s
zTarFile.makedevcCs|j||dd�S)N)r)r�r�rr6r6r7�makelink%
szTarFile.makelinkc	$Cs&d}yT|j�r6tjj|�r$tj|�tj|j|�dStjj|j�rVtj	|j|�dSWnt
k
rpd}YnXy|j|�}Wn$tk
r�|r�t
d��n�YnX|dkr�|}nR|dkr�t
d��y|||�}Wn2tk
�r}zt||j�|�WYdd}~XnX|dk	�r"|j||||d�dS)	a3Make a (symbolic) link called targetpath. If it cannot be created
          (platform limitation), we try to make a copy of the referenced file
          instead of a link.

          filter_function is only used when extracting a *different*
          member (e.g. as fallback to creating a link).
        FNTz%unable to resolve link inside archivez6makelink_with_filter: if filter_function is not None, z%extraction_root must also not be None)r�r�z[makelink_with_filter: if filter_function is not None, extraction_root must also not be None)r�r}r%�lexists�unlink�symlinkr�r�r�link�symlink_exceptionrr�r
r�r�r�r�)	r�r�rr�r�Zkeyerror_to_extracterrorr�r��causer6r6r7r(
sB	

 
zTarFile.makelink_with_filtercCs�ttd�r�tj�dkr�|j}|j}|s�ytrB|jrBtj|j�d}Wntk
rXYnXyt	rv|j
rvt	j|j
�d}Wntk
r�YnX|dkr�d}|dkr�d	}y4|j�r�ttd�r�tj
|||�ntj|||�Wntk
r�td��YnXdS)
z�Set owner of targetpath according to tarinfo. If numeric_owner
           is True, use .gid/.uid instead of .gname/.uname. If numeric_owner
           is False, fall back to .gid/.uid when the search based on name
           fails.
        �geteuidrr$Nr#�lchownzcould not change ownerr9r9)r�r}rr*r)r�r,Zgetgrnamr�r�r+�getpwnamr�rr�r�r
)r�r�rr��g�ur6r6r7r�Z
s0

z
TarFile.chowncCsL|jdkrdSttd�rHytj||j�Wntk
rFtd��YnXdS)zASet file permissions of targetpath according to tarinfo.
        Nr�zcould not change mode)rhr�r}r�r�r
)r�r�rr6r6r7r�{
s

z
TarFile.chmodcCsV|j}|dkrdSttd�s dSytj|||f�Wntk
rPtd��YnXdS)zBSet modification time of targetpath according to tarinfo.
        Nr�z"could not change modification time)r(r�r}r�r�r
)r�r�rr(r6r6r7r��
s
z
TarFile.utimecCs�|jd�|jdk	r$|j}d|_|S|j|jj�krZ|jj|jd�|jjd�sZtd��d}�xby|jj	|�}W�nHt
k
r�}z2|jr�|jdd|j|f�|jt
7_wbWYdd}~Xn�tk
�r,}zN|j�r|jdd|j|f�|jt
7_wbn|jdk�rtt|���WYdd}~Xn�tk
�rT|jdk�rPtd��Ynjtk
�r�}z|jdk�r~tt|���WYdd}~Xn0tk
�r�}ztt|���WYdd}~XnXPqbW|dk	�r�|jj|�nd	|_|S)
z�Return the next member of the archive as a TarInfo object, when
           TarFile is opened for reading. Return None if there is no more
           available.
        ZraNr#zunexpected end of datar$z0x%X: %srz
empty fileT)r�r�r�r�r�r�rZrr�rTrwr�r�r�rHr,rurvrxr�r�r�)r��mr�r�r6r6r7r]�
sL


zTarFile.nextc	Cs�|j�}d}|dk	rHy|j|�}Wntk
r:d}YnX|d|�}|rXtjj|�}xLt|�D]@}|r||j|jkrbd}qb|r�tjj|j�}n|j}||krb|SqbW|r�t|��dS)z}Find an archive member by name from bottom to top.
           If tarinfo is given, it is used as the starting point.
        FNT)	r��indexr.r}r%r��reversedr�r�)	r�r�r��	normalizer�Zskippingrr��member_namer6r6r7r��
s,
zTarFile._getmembercCs"x|j�}|dkrPqWd|_dS)zWRead through the entire archive file and look for readable
           members.
        NT)r]r�)r�r�r6r6r7r��
s
z
TarFile._loadcCs:|jrtd|jj��|dk	r6|j|kr6td|j��dS)znCheck if TarFile is still open, and if the operation's mode
           corresponds to TarFile's mode.
        z%s is closedNzbad operation for mode %r)r�r�r�rqrh)r�rhr6r6r7r��
szTarFile._checkcCs`|j�r.djtdtjj|j�|jf��}d}n
|j}|}|j||dd�}|dkr\t	d|��|S)zZFind the target member of a symlink or hardlink member in the
           archive.
        r�NT)r�r!zlinkname %r not found)
r�r�r�r}r%r�r�r�r�r�)r�r�r��limitr�r6r6r7rs zTarFile._find_link_targetccs�|jr|jEdHdSd}|jdk	r:|j�}|d7}|VxN|t|j�krV|j|}n"|jst|j�}|sxd|_dSndS|d7}|Vq<WdS)z$Provide an iterator object.
        Nrr#T)r�r�r�r]r0)r�rr�r6r6r7�__iter__s&
zTarFile.__iter__cCs||jkrt|tjd�dS)z.Write debugging output to sys.stderr.
        )r�N)r�rorm�stderr)r��level�msgr6r6r7r�7s
zTarFile._dbgcCs|j�|S)N)r�)r�r6r6r7�	__enter__=szTarFile.__enter__cCs,|dkr|j�n|js"|jj�d|_dS)NT)r�r�r�r�)r�r�r�	tracebackr6r6r7�__exit__As


zTarFile.__exit__)
NrzNNNNNNrNNNN)rzN)rzNr�)rzNr�)rzNN)NNN)T)NTN)N)r�N)r�T)N)TF)NF)N)@rqrrrsrtr�r�r�r�rrPrr4r5rr�r�r�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�rkr�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrr�r�r�r]r�r�r�rr$r�r(r*r6r6r6r7rSs�
lZ!

d&=
5D
62!6
(

	cCs.yt|�}|j�dStk
r(dSXdS)zfReturn True if name points to a tar archive that we
       are able to handle, else return False.
    TFN)rr�r)r�r�r6r6r7rOscCsddl}d}|j|d�}|jdddddd	�|jd
dtdd
�|j�}|jddddd�|jdddd5dd�|jdddd6dd�|jdddd d�|j�}|jr�|jr�|jd!d"�|j	�r*|j	}t
|��rt|d#�� }|j�t
|j�tjd$�WdQRX|j�r&t
d%j|��n|jd!d&j|���n�|j�r�|j}t
|��rjtj|d'��}|j|jd(�WdQRXn|jd!d&j|���n�|j�rPt|j�d!k�r�|jd}tj}n,t|j�d)k�r�|j\}}n|jd!|j��t
|��r<tj|d'��}|j||jd*�WdQRX|j�rN|d+k�r&d,j|�}	nd-j||�}	t
|	�n|jd!d&j|��n�|j�r�|jjd�}
tjj|
�\}}d.d.d/d/d0d0d0d0d1�}
||
k�r�d2|
|nd3}|j}tj|
|�� }x|D]}|j|��q�WWdQRX|j�rt
d4j|
��n|jd!|j��dS)7Nrz3A simple command line interface for tarfile module.)�descriptionz-vz	--verbose�
store_trueFzVerbose output)�action�default�helpz--filterz<filtername>zFilter for extraction)�metavar�choicesr/z-lz--list�	<tarfile>zShow listing of a tarfile)r0r/z-ez	--extract�+�<output_dir>zExtract tarfile into target dir)�nargsr0r/z-cz--create�<name>�<file>zCreate tarfile from sourcesz-tz--testzTest if a tarfile is validr#z&--filter is only valid for extraction
rz)r�z{!r} is a tar archive.z{!r} is not a tar archive.
zr:*)r�r$)r%r�r�z{!r} file is extracted.z+{!r} file is extracted into {!r} directory.r�r�r�)z.gzz.tgzz.xzz.txzz.bz2z.tbzz.tbz2z.tb2zw:r{z{!r} file created.)r2r4)r6r7)�argparse�ArgumentParser�add_argumentr�Zadd_mutually_exclusive_group�
parse_argsr�r��exitZtestrrr�rormr%r�rPrkrr0r}�curdirZformat_helpr�Zcreate�popr%�splitextr�)r8r+�parserrc�argsr\r�Ztfr=r'Ztar_namermZextZcompressionsZtar_modeZ	tar_files�	file_namer6r6r7�main]s�










rC�__main__)r%r&r'r(r)r*r+r,)T)trt�version�
__author__Z__date__Z	__cvsid__�__credits__�builtinsrr�rmr}r�rWrfr�rSr�rercr�r�r�r��NotImplementedErrorrr��	NameError�__all__r�r�r1r�r�rrrrr4rrHryrxr6r7rr|ZCONTTYPEr"r!rIr.r0rWr
rrrrZrvrLrsrfr+rFrtr�r�getfilesystemencodingr8r=rKrQrUrXrgrp�	Exceptionrr
rrr	rrurvrwrHrxryr��objectr�r��BufferedReaderr�r�r�r�r�r�r�r�r�r�r�r�r�r�r
�compilerarrrrCrqr6r6r6r7�<module>s&



wh



D
eb
random.cpython-36.pyc000064400000045604150335715140010467 0ustar003


 \2k�@s�dZddlmZddlmZmZddl	m
ZmZ
mZmZmZddl	mZmZmZmZddlmZddlm Z!m"Z#ddl$m%Z&dd	l'Z(dd	l)Z*d
ddd
ddddddddddddddddddd d!gZ+d"e
d2�ed$�Z,d$eZ-ed%�Z.d&ed'�Z/d(Z0d)e0Z1dd	l2Z2Gd*d
�d
e2j3�Z3Gd+d!�d!e3�Z4d,d-�Z5d3d/d0�Z6e3�Z7e7j8Z8e7j9Z9e7j:Z:e7j;Z;e7j<Z<e7j=Z=e7j>Z>e7j?Z?e7j@Z@e7jAZAe7jBZBe7jCZCe7jDZDe7jEZEe7jFZFe7jGZGe7jHZHe7jIZIe7jJZJe7jKZKe7jLZLe7jMZMeNd1k�r�e6�d	S)4a�Random variable generators.

    integers
    --------
           uniform within range

    sequences
    ---------
           pick random element
           pick random sample
           pick weighted random sample
           generate random permutation

    distributions on the real line:
    ------------------------------
           uniform
           triangular
           normal (Gaussian)
           lognormal
           negative exponential
           gamma
           beta
           pareto
           Weibull

    distributions on the circle (angles 0 to 2pi)
    ---------------------------------------------
           circular uniform
           von Mises

General notes on the underlying Mersenne Twister core generator:

* The period is 2**19937-1.
* It is one of the most extensively tested generators in existence.
* The random() method is implemented in C, executes in a single Python step,
  and is, therefore, threadsafe.

�)�warn)�
MethodType�BuiltinMethodType)�log�exp�pi�e�ceil)�sqrt�acos�cos�sin)�urandom)�Set�Sequence)�sha512N�Random�seed�random�uniform�randint�choice�sample�	randrange�shuffle�
normalvariate�lognormvariate�expovariate�vonmisesvariate�gammavariate�
triangular�gauss�betavariate�
paretovariate�weibullvariate�getstate�setstate�getrandbits�choices�SystemRandom�g�?g@g@g�?g@�5�cseZdZdZdZd;dd�Zd<�fdd�	Z�fd	d
�Z�fdd�Zd
d�Z	dd�Z
dd�Zddefdd�Z
dd�Zede>eeefdd�Zdd�Zd=dd�Zdd�Zd>ddd �d!d"�Zd#d$�Zd?d'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Z d7d8�Z!d9d:�Z"�Z#S)@ra�Random number generator base class used by bound module functions.

    Used to instantiate instances of Random to get generators that don't
    share state.

    Class Random can also be subclassed if you want to use a different basic
    generator of your own devising: in that case, override the following
    methods:  random(), seed(), getstate(), and setstate().
    Optionally, implement a getrandbits() method so that randrange()
    can cover arbitrarily large ranges.

    �NcCs|j|�d|_dS)zeInitialize an instance.

        Optional argument x controls seeding, as for Random.seed().
        N)r�
gauss_next)�self�x�r1�/usr/lib64/python3.6/random.py�__init__Ws
zRandom.__init__r,cs�|dkr�t|ttf�r�t|t�r*|jd�n|}|rBt|d�d>nd}x"tt|�D]}d||Ad@}qRW|t|�N}|d
kr�dn|}|dkr�t|tttf�r�t|t�r�|j�}|t	|�j
�7}tj|d�}t
�j|�d	|_d	S)aInitialize internal state from hashable object.

        None or no argument seeds from current time or from an operating
        system specific randomness source if available.

        If *a* is an int, all bits are used.

        For version 2 (the default), all of the bits are used if *a* is a str,
        bytes, or bytearray.  For version 1 (provided for reproducing random
        sequences from older versions of Python), the algorithm for str and
        bytes generates a narrower range of seeds.

        �zlatin-1r�iCBl����r,�bigN������)�
isinstance�str�bytes�decode�ord�map�len�	bytearray�encode�_sha512Zdigest�int�
from_bytes�superrr.)r/�a�versionr0�c)�	__class__r1r2r`s
zRandom.seedcs|jt�j�|jfS)z9Return internal state; can be passed to setstate() later.)�VERSIONrEr%r.)r/)rIr1r2r%�szRandom.getstatecs�|d}|dkr*|\}}|_t�j|�nt|dkr�|\}}|_ytdd�|D��}Wn(tk
r|}zt|�WYdd}~XnXt�j|�ntd||jf��dS)z:Restore internal state from object returned by getstate().rr-r,css|]}|dVqdS)r,� Nlr1)�.0r0r1r1r2�	<genexpr>�sz"Random.setstate.<locals>.<genexpr>Nz?state with version %s passed to Random.setstate() of version %s)r.rEr&�tuple�
ValueError�	TypeErrorrJ)r/�staterGZ
internalstater)rIr1r2r&�szRandom.setstatecCs|j�S)N)r%)r/r1r1r2�__getstate__�szRandom.__getstate__cCs|j|�dS)N)r&)r/rQr1r1r2�__setstate__�szRandom.__setstate__cCs|jf|j�fS)N)rIr%)r/r1r1r2�
__reduce__�szRandom.__reduce__r4c
Cs||�}||krtd��|dkr:|dkr2|j|�Std��||�}||krRtd��||}|dkrx|dkrx||j|�S|dkr�td|||f��||�}||kr�td��|dkr�||d|}	n"|dkr�||d|}	ntd	��|	dkr�td��|||j|	�S)
z�Choose a random item from range(start, stop[, step]).

        This fixes the problem with randint() which includes the
        endpoint; in Python this is usually not what you want.

        z!non-integer arg 1 for randrange()Nrzempty range for randrange()z non-integer stop for randrange()r4z'empty range for randrange() (%d,%d, %d)z non-integer step for randrange()zzero step for randrange())rO�
_randbelow)
r/�start�stop�step�_intZistartZistop�widthZistep�nr1r1r2r�s4

zRandom.randrangecCs|j||d�S)zJReturn random integer in range [a, b], including both end points.
        r4)r)r/rF�br1r1r2r�szRandom.randintc
Cs�|j}|j}||�|ks$||�|krN|j�}	||	�}
x|
|krH||	�}
q6W|
S||krltd�||�|�S|dkr|td��||}|||}|�}
x|
|kr�|�}
q�W||
|�|S)zCReturn a random int in the range [0,n).  Raises ValueError if n==0.z�Underlying random() generator does not supply 
enough bits to choose from a population range this large.
To remove the range limitation, add a getrandbits() method.rzBoundary cannot be zero)rr'�
bit_length�_warnrO)
r/r[rC�maxsize�typeZMethodZ
BuiltinMethodrr'�k�rZrem�limitr1r1r2rU�s&


zRandom._randbelowcCs:y|jt|��}Wntk
r0td�d�YnX||S)z2Choose a random element from a non-empty sequence.z$Cannot choose from an empty sequenceN)rUr?rO�
IndexError)r/�seq�ir1r1r2r�s
z
Random.choicecCs�|dkrR|j}x�ttdt|���D]*}||d�}||||||<||<q"WnLt}xFttdt|���D]0}||�|d�}||||||<||<qjWdS)z�Shuffle list x in place, and return None.

        Optional argument random is a 0-argument function returning a
        random float in [0.0, 1.0); if it is the default None, the
        standard random.random will be used.

        Nr4)rU�reversed�ranger?rC)r/r0r�	randbelowrf�jrYr1r1r2rs	 zRandom.shufflecCs(t|t�rt|�}t|t�s$td��|j}t|�}d|koD|knsRtd��dg|}d}|dkr�|dtt	|dd��7}||kr�t
|�}x�t|�D]0}|||�}	||	||<|||d	||	<q�WnRt�}
|
j
}xDt|�D]8}||�}	x|	|
k�r
||�}	q�W||	�||	||<q�W|S)
a=Chooses k unique random elements from a population sequence or set.

        Returns a new list containing elements from the population while
        leaving the original population unchanged.  The resulting list is
        in selection order so that all sub-slices will also be valid random
        samples.  This allows raffle winners (the sample) to be partitioned
        into grand prize and second place winners (the subslices).

        Members of the population need not be hashable or unique.  If the
        population contains repeats, then each occurrence is a possible
        selection in the sample.

        To choose a sample in a range of integers, use range as an argument.
        This is especially fast and space efficient for sampling from a
        large population:   sample(range(10000000), 60)
        z>Population must be a sequence or set.  For dicts, use list(d).rz,Sample larger than population or is negativeN��r*r-r4)r9�_SetrN�	_SequencerPrUr?rO�_ceil�_log�listrh�set�add)r/�
populationrarir[�resultZsetsizeZpoolrfrjZselectedZselected_addr1r1r2rs6


z
Random.sample)�cum_weightsracs�|j��dkrN|dkr>t�t�������fdd�t|�D�Sttj|���n|dk	r^td��t��t��krvtd��t	j
��d�t��d�������fdd�t|�D�S)	z�Return a k sized list of population elements chosen with replacement.

        If the relative weights or cumulative weights are not specified,
        the selections are made with equal probability.

        Ncsg|]}�������qSr1r1)rLrf)rYrtr�totalr1r2�
<listcomp>csz"Random.choices.<locals>.<listcomp>z2Cannot specify both weights and cumulative weightsz3The number of weights does not match the populationr4cs$g|]}������d���qS)rr1)rLrf)�bisectrv�hirtrrwr1r2rxlsr7)rrCr?rhrq�
_itertools�
accumulaterPrO�_bisectry)r/rtZweightsrvrar1)rYryrvrzrtrrwr2r(Ws zRandom.choicescCs||||j�S)zHGet a random number in the range [a, b) or [a, b] depending on rounding.)r)r/rFr\r1r1r2rsszRandom.uniform���?cCsx|j�}y |dkrdn||||}Wntk
r<|SX||kr`d|}d|}||}}|||||dS)z�Triangular distribution.

        Continuous distribution bounded by given lower and upper limits,
        and having a given mode value in-between.

        http://en.wikipedia.org/wiki/Triangular_distribution

        Ng�?g�?)r�ZeroDivisionError)r/ZlowZhigh�mode�urHr1r1r2r ys	 
zRandom.triangularcCsT|j}x@|�}d|�}t|d|}||d}|t|�krPqW|||S)z\Normal distribution.

        mu is the mean, and sigma is the standard deviation.

        g�?g�?g@)r�
NV_MAGICCONSTrp)r/�mu�sigmar�u1�u2�zZzzr1r1r2r�s

zRandom.normalvariatecCst|j||��S)z�Log normal distribution.

        If you take the natural logarithm of this distribution, you'll get a
        normal distribution with mean mu and standard deviation sigma.
        mu can have any value, and sigma must be greater than zero.

        )�_expr)r/r�r�r1r1r2r�szRandom.lognormvariatecCstd|j��|S)a^Exponential distribution.

        lambd is 1.0 divided by the desired mean.  It should be
        nonzero.  (The parameter would be called "lambda", but that is
        a reserved word in Python.)  Returned values range from 0 to
        positive infinity if lambd is positive, and from negative
        infinity to 0 if lambd is negative.

        g�?)rpr)r/Zlambdr1r1r2r�szRandom.expovariatecCs�|j}|dkrt|�Sd|}|td||�}xN|�}tt|�}|||}|�}	|	d||ks~|	d|t|�kr6Pq6Wd|}
|
|d|
|}|�}|dkr�|t|�t}
n|t|�t}
|
S)aFCircular data distribution.

        mu is the mean angle, expressed in radians between 0 and 2*pi, and
        kappa is the concentration parameter, which must be greater than or
        equal to zero.  If kappa is equal to zero, this distribution reduces
        to a uniform random angle over the range 0 to 2*pi.

        g���ư>g�?g�?)r�TWOPI�_sqrt�_cos�_pir��_acos)r/r�Zkappar�srbr�r��dr��q�fZu3Zthetar1r1r2r�s&
$zRandom.vonmisesvariatecCs�|dks|dkrtd��|j}|dkr�td|d�}|t}||}x�|�}d|ko`dknshqHd|�}t|d|�|}	|t|	�}
|||}|||	|
}|td|dks�|t|�krH|
|SqHWn�|dk�r|�}
x|
dk�r|�}
q�Wt|
�|Sx�|�}
t|t}||
}|dk�rD|d|}
nt|||�}
|�}|dk�r|||
|dk�r�Pn|t|
�k�rP�qW|
|SdS)	aZGamma distribution.  Not the gamma function!

        Conditions on the parameters are alpha > 0 and beta > 0.

        The probability distribution function is:

                    x ** (alpha - 1) * math.exp(-x / beta)
          pdf(x) =  --------------------------------------
                      math.gamma(alpha) * beta ** alpha

        gz*gammavariate: alpha and beta must be > 0.0g�?g@gH�����z>g�P���?g@N)rOrr��LOG4rpr��
SG_MAGICCONST�_e)r/�alpha�betarZainvZbbbZcccr�r��vr0r�rbr�r\�pr1r1r2r�sJ
 



zRandom.gammavariatecCs`|j}|j}d|_|dkrT|�t}tdtd|���}t|�|}t|�||_|||S)z�Gaussian distribution.

        mu is the mean, and sigma is the standard deviation.  This is
        slightly faster than the normalvariate() function.

        Not thread-safe without a lock around calls.

        Ng@g�?g�)rr.r�r�rpr��_sin)r/r�r�rr�Zx2piZg2radr1r1r2r!?s
zRandom.gausscCs0|j|d�}|dkrdS|||j|d�SdS)z�Beta distribution.

        Conditions on the parameters are alpha > 0 and beta > 0.
        Returned values range between 0 and 1.

        g�?rgN)r)r/r�r��yr1r1r2r"ts
zRandom.betavariatecCsd|j�}d|d|S)z3Pareto distribution.  alpha is the shape parameter.g�?)r)r/r�r�r1r1r2r#�szRandom.paretovariatecCs"d|j�}|t|�d|S)zfWeibull distribution.

        alpha is the scale parameter and beta is the shape parameter.

        g�?)rrp)r/r�r�r�r1r1r2r$�szRandom.weibullvariate)N)Nr,)N)N)r~rN)$�__name__�
__module__�__qualname__�__doc__rJr3rr%r&rRrSrTrCrr�BPFr`�_MethodType�_BuiltinMethodTyperUrrrr(rr rrrrrr!r"r#r$�
__classcell__r1r1)rIr2rGs8
	 ,

:
0H5	c@s8eZdZdZdd�Zdd�Zdd�Zdd	�ZeZZ	d
S)r)z�Alternate random number generator using sources provided
    by the operating system (such as /dev/urandom on Unix or
    CryptGenRandom on Windows).

     Not available on all systems (see os.urandom() for details).
    cCstjtd�d�d?tS)z3Get the next random number in the range [0.0, 1.0).r5r6r-)rCrD�_urandom�	RECIP_BPF)r/r1r1r2r�szSystemRandom.randomcCsP|dkrtd��|t|�kr$td��|dd}tjt|�d�}||d|?S)z:getrandbits(k) -> x.  Generates an int with k random bits.rz(number of bits must be greater than zeroz#number of bits should be an integerr5�r6)rOrCrPrDr�)r/raZnumbytesr0r1r1r2r'�szSystemRandom.getrandbitscOsdS)z<Stub method.  Not used for a system random number generator.Nr1)r/�args�kwdsr1r1r2r�szSystemRandom.seedcOstd��dS)zAMethod should not be called for a system random number generator.z*System entropy source does not have state.N)�NotImplementedError)r/r�r�r1r1r2�_notimplemented�szSystemRandom._notimplementedN)
r�r�r�r�rr'rr�r%r&r1r1r1r2r)�s
cCs�ddl}t|d|j�d}d}d}d
}|j�}x@t|�D]4}	||�}
||
7}||
|
}t|
|�}t|
|�}q8W|j�}tt||d�ddd�||}t||||�}
td	||
||f�dS)Nr�timesgg _�Br-zsec,� )�endz"avg %g, stddev %g, min %g, max %g
g _��)�time�printr�rh�min�max�roundr�)r[�funcr�r�rwZsqsumZsmallestZlargestZt0rfr0Zt1ZavgZstddevr1r1r2�_test_generator�s&
r���cCs�t|tf�t|td�t|td�t|td
�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�dS)N���?�{�G�z�?皙�����?�@��?��������?�4@�i@�@)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r��UUUUUU�?)r�r�r�)	r�rrrrrr!r"r )�Nr1r1r2�_test�s r��__main__g�)r�)Or��warningsrr^�typesrr�rr�Zmathrrprr�rr�rr�r	ror
r�rr�rr�r
r��osrr��_collections_abcrrmrrnZhashlibrrB�	itertoolsr{ryr}�__all__r�r�r�r�r�r�Z_randomrr)r�r�Z_instrrrr rrrrrr(rrrrrr!r"r#r$r%r&r'r�r1r1r1r2�<module>&sn
Y!

_sysconfigdata_m_linux_x86_64-linux-gnu.cpython-36.opt-1.pyc000064400000056616150335715140017645 0ustar003

�]dh�v��@sdddddddddddd	d
dddd
dddddddddddddddddddddddd dd!d"d#d$d%dddd&d'd
d(d)d*d&d+dd!dddd,d-ddddddd.d&d&d&d&dd&dd&d&d&d&d&dddddddddd&dd&d&d&d&d&d&d&d&dd&d&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&ddd&d&dd&dddd&d&d&ddd&d&dddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&d&d&d&d&d&ddd&d&dd&d&ddd&d&d&d&d&d&d&dddddd&dd&d&ddddddd&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd/ddd0d1d0d0d2d3d4d
d5d6dd7dd
d8ddd9dd:d;dd<d=d>d
d
d?d@dAdBdd+ddCdDdddEddddddd&dFdGdHddIdJd
dKdLd&dMd
dNdddddddd
dOdPdQd
dRdSdd
ddTd&dUddddVddddWdXd
d
ddYd&dZd[dd\d6d]d^dd&dd&dd_d`dadbdcd9ddddd?dedddfdgdhdgdfdhdfdfdgdfd^dfdfdfdfdgd&didjdkd&dldmddnd:d&d&dddddoddpdqdrdd&dd
ddsd&d&dtdudd&d&d&dddd&d&d&ddvdwdudxdydydudz���Zd{S)|�m��ar�rcsz!-Wno-unused-result -Wsign-comparez-IObjects -IInclude -IPython�z/usr/binz/usr/lib64/python3.6z-L. -lpython3.6mzOgcc -pthread -shared -Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g�pythonzx86_64-redhat-linux-gnu�\zgcc -pthreadz-fPICa-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz?configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.ina-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapva=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-typez-Wl,-z,relro  -Wl,-z,now  -gz�-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -ga�'--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-ipv6' '--enable-shared' '--with-computed-gotos=yes' '--with-dbmliborder=gdbm:ndbm:bdb' '--with-system-expat' '--with-system-ffi' '--enable-loadable-sqlite-extensions' '--with-dtrace' '--with-lto' '--with-ssl-default-suites=openssl' '--with-valgrind' '--without-ensurepip' '--enable-optimizations' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS= -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv ' 'LDFLAGS= -Wl,-z,relro  -Wl,-z,now  -g ' 'CPPFLAGS=' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'z/usr/includez/usr/include/python3.6m�:z@/builddir/build/BUILD/Python-3.6.8/build/optimized/coverage.infoz>/builddir/build/BUILD/Python-3.6.8/build/optimized/lcov-reportz2--no-branch-coverage --title "CPython lcov report"zM-IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.6.8/Includezg++ -pthreadzE/usr /usr/lib64 /usr/lib64/python3.6 /usr/lib64/python3.6/lib-dynloadz /usr/lib64/python3.6/lib-dynloadi�zkREADME ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Ext-dummyzInclude Lib Misc Ext-dummyzPREADME ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in�.�z/usr/bin/dtracezInclude/pydtrace_probes.hzPython/pydtrace.ozdynload_shlib.o�noz .cpython-36m-x86_64-linux-gnu.soi��yeszI/usr/include /usr/include /usr/include/python3.6m /usr/include/python3.6mz/usr/bin/install -cz/usr/bin/install -c -m 644z/usr/bin/install -c -m 555zlibpython3.6m.so.1.0zModules/_io/_iomodule.hzg++ -pthread -sharedz:-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -gzlibpython3.6m.soz3.6mz
/usr/lib64z-lmzPython/z/usr/lib64/pkgconfigz1/usr/lib64/python3.6/config-3.6m-x86_64-linux-gnuzlibpython3.6m.az-lpthread -ldl  -lutilz0tkinter tkinter/test tkinter/test/test_tkinter \�gccz-Xlinker -export-dynamic�true�ln�linuxz4/builddir/build/BUILD/Python-3.6.8/Modules/makesetupz/usr/share/manz/usr/bin/mkdir -pz�_thread posix errno pwd _sre _codecs _weakref _functools _operator _collections itertools atexit _signal _stat time _locale _io zipimport faulthandler _tracemalloc _symtable xxsubtypea{Modules/_threadmodule.o  Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/zipimport.o  Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  Modules/symtablemodule.o  Modules/xxsubtype.ozx86_64-linux-gnuz -DMULTIARCH=\"x86_64-linux-gnu\"z-Wl,--no-as-neededa:-DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz:\ Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.ozParser/pgenz\ \z-fprofile-generatez"-fprofile-use -fprofile-correctionz
-m test --pgoz
libpython3.sozno-frameworkz./python -Ez	python3.6a�-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -O3 -fprofile-use -fprofile-correctiona�-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -O3 -fprofile-use -fprofile-correction -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.6.8/Include -fPIC -DPy_BUILD_COREaT-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g -lcryptoz"z"a-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g�z)-x test_subprocess test_io test_lib2to3 \�readelfzMac/Resources/framework�voidzBLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/optimizedz/bin/shz.so���zcpython-36m-x86_64-linux-gnuz&Parser Objects Python Modules Programsz9/builddir/build/BUILD/Python-3.6.8/Tools/gdb/libpython.pyz"/* Don't use ncurses extensions */z-szInclude Lib MisczKLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/optimized ./pythonz�LD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/optimized ./python /builddir/build/BUILD/Python-3.6.8/Tools/scripts/run_tests.pyi�zPython/thread.ozIpython3.6 /builddir/build/BUILD/Python-3.6.8/Tools/scripts/update_file.pyz3.6z"/builddir/build/BUILD/Python-3.6.8z)xml xml/dom xml/etree xml/parsers xml/saxz2/builddir/build/BUILD/Python-3.6.8/build/optimizedz
/usr/sharez/usr(��ABIFLAGS�AC_APPLE_UNIVERSAL_BUILD�AIX_GENUINE_CPLUSPLUS�ANDROID_API_LEVEL�AR�ARFLAGS�
BASECFLAGS�BASECPPFLAGS�BASEMODLIBS�BINDIR�
BINLIBDEST�
BLDLIBRARY�	BLDSHARED�BUILDEXE�BUILDPYTHON�BUILD_GNU_TYPE�BYTESTR_DEPS�CC�CCSHARED�CFLAGS�CFLAGSFORSHARED�CFLAGS_ALIASING�CONFIGFILES�CONFIGURE_CFLAGS�CONFIGURE_CFLAGS_NODIST�CONFIGURE_CPPFLAGS�CONFIGURE_LDFLAGS�CONFIGURE_LDFLAGS_NODIST�CONFIG_ARGS�CONFINCLUDEDIR�
CONFINCLUDEPY�COREPYTHONPATH�
COVERAGE_INFO�COVERAGE_REPORT�COVERAGE_REPORT_OPTIONS�CPPFLAGS�CXX�DESTDIRS�DESTLIB�DESTPATH�
DESTSHARED�DFLAGS�DIRMODE�DIST�DISTDIRS�	DISTFILES�	DLINCLDIR�
DLLLIBRARY�"DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754�DOUBLE_IS_BIG_ENDIAN_IEEE754�DOUBLE_IS_LITTLE_ENDIAN_IEEE754�DTRACE�DTRACE_DEPS�DTRACE_HEADERS�DTRACE_OBJS�DYNLOADFILE�ENABLE_IPV6�	ENSUREPIP�EXE�EXEMODE�EXTRAMACHDEPPATH�
EXTRATESTOPTS�EXTRA_CFLAGS�
EXT_SUFFIX�FILEMODE�FLOCK_NEEDS_LIBBSD�GETPGRP_HAVE_ARG�GETTIMEOFDAY_NO_TZ�	GITBRANCH�GITTAG�
GITVERSION�GNULD�HAVE_ACCEPT4�
HAVE_ACOSH�
HAVE_ADDRINFO�
HAVE_ALARM�HAVE_ALIGNED_REQUIRED�
HAVE_ALLOCA_H�HAVE_ALTZONE�
HAVE_ASINH�HAVE_ASM_TYPES_H�
HAVE_ATANH�HAVE_BIND_TEXTDOMAIN_CODESET�HAVE_BLUETOOTH_BLUETOOTH_H�HAVE_BLUETOOTH_H�HAVE_BROKEN_MBSTOWCS�HAVE_BROKEN_NICE�HAVE_BROKEN_PIPE_BUF�HAVE_BROKEN_POLL�HAVE_BROKEN_POSIX_SEMAPHORES�HAVE_BROKEN_PTHREAD_SIGMASK�HAVE_BROKEN_SEM_GETVALUE�HAVE_BROKEN_UNSETENV�HAVE_BUILTIN_ATOMIC�HAVE_CHFLAGS�
HAVE_CHOWN�HAVE_CHROOT�
HAVE_CLOCK�HAVE_CLOCK_GETRES�HAVE_CLOCK_GETTIME�HAVE_CLOCK_SETTIME�HAVE_COMPUTED_GOTOS�HAVE_CONFSTR�HAVE_CONIO_H�
HAVE_COPYSIGN�HAVE_CRYPT_H�HAVE_CTERMID�HAVE_CTERMID_R�HAVE_CURSES_FILTER�
HAVE_CURSES_H�HAVE_CURSES_HAS_KEY�HAVE_CURSES_IMMEDOK�HAVE_CURSES_IS_PAD�HAVE_CURSES_IS_TERM_RESIZED�HAVE_CURSES_RESIZETERM�HAVE_CURSES_RESIZE_TERM�HAVE_CURSES_SYNCOK�HAVE_CURSES_TYPEAHEAD�HAVE_CURSES_USE_ENV�HAVE_CURSES_WCHGAT�HAVE_DECL_ISFINITE�HAVE_DECL_ISINF�HAVE_DECL_ISNAN�HAVE_DECL_RTLD_DEEPBIND�HAVE_DECL_RTLD_GLOBAL�HAVE_DECL_RTLD_LAZY�HAVE_DECL_RTLD_LOCAL�HAVE_DECL_RTLD_NODELETE�HAVE_DECL_RTLD_NOLOAD�HAVE_DECL_RTLD_NOW�HAVE_DECL_TZNAME�HAVE_DEVICE_MACROS�HAVE_DEV_PTC�
HAVE_DEV_PTMX�
HAVE_DIRECT_H�HAVE_DIRENT_D_TYPE�
HAVE_DIRENT_H�
HAVE_DIRFD�HAVE_DLFCN_H�HAVE_DLOPEN�	HAVE_DUP2�	HAVE_DUP3�HAVE_DYNAMIC_LOADING�
HAVE_ENDIAN_H�
HAVE_EPOLL�HAVE_EPOLL_CREATE1�HAVE_ERF�	HAVE_ERFC�HAVE_ERRNO_H�
HAVE_EXECV�
HAVE_EXPM1�HAVE_FACCESSAT�HAVE_FCHDIR�HAVE_FCHMOD�
HAVE_FCHMODAT�HAVE_FCHOWN�
HAVE_FCHOWNAT�HAVE_FCNTL_H�HAVE_FDATASYNC�HAVE_FDOPENDIR�HAVE_FEXECVE�HAVE_FINITE�
HAVE_FLOCK�	HAVE_FORK�HAVE_FORKPTY�HAVE_FPATHCONF�HAVE_FSEEK64�HAVE_FSEEKO�HAVE_FSTATAT�
HAVE_FSTATVFS�
HAVE_FSYNC�HAVE_FTELL64�HAVE_FTELLO�
HAVE_FTIME�HAVE_FTRUNCATE�
HAVE_FUTIMENS�HAVE_FUTIMES�HAVE_FUTIMESAT�HAVE_GAI_STRERROR�
HAVE_GAMMA�HAVE_GCC_ASM_FOR_MC68881�HAVE_GCC_ASM_FOR_X64�HAVE_GCC_ASM_FOR_X87�HAVE_GCC_UINT128_T�HAVE_GETADDRINFO�HAVE_GETC_UNLOCKED�HAVE_GETENTROPY�HAVE_GETGROUPLIST�HAVE_GETGROUPS�HAVE_GETHOSTBYNAME�HAVE_GETHOSTBYNAME_R�HAVE_GETHOSTBYNAME_R_3_ARG�HAVE_GETHOSTBYNAME_R_5_ARG�HAVE_GETHOSTBYNAME_R_6_ARG�HAVE_GETITIMER�HAVE_GETLOADAVG�
HAVE_GETLOGIN�HAVE_GETNAMEINFO�HAVE_GETPAGESIZE�HAVE_GETPEERNAME�HAVE_GETPGID�HAVE_GETPGRP�HAVE_GETPID�HAVE_GETPRIORITY�
HAVE_GETPWENT�HAVE_GETRANDOM�HAVE_GETRANDOM_SYSCALL�HAVE_GETRESGID�HAVE_GETRESUID�HAVE_GETSID�
HAVE_GETSPENT�
HAVE_GETSPNAM�HAVE_GETTIMEOFDAY�
HAVE_GETWD�HAVE_GLIBC_MEMMOVE_BUG�
HAVE_GRP_H�HAVE_HSTRERROR�HAVE_HTOLE64�
HAVE_HYPOT�
HAVE_IEEEFP_H�HAVE_IF_NAMEINDEX�HAVE_INET_ATON�HAVE_INET_PTON�HAVE_INITGROUPS�HAVE_INTTYPES_H�	HAVE_IO_H�HAVE_IPA_PURE_CONST_BUG�	HAVE_KILL�HAVE_KILLPG�HAVE_KQUEUE�HAVE_LANGINFO_H�HAVE_LARGEFILE_SUPPORT�
HAVE_LCHFLAGS�HAVE_LCHMOD�HAVE_LCHOWN�HAVE_LGAMMA�
HAVE_LIBDL�HAVE_LIBDLD�HAVE_LIBIEEE�HAVE_LIBINTL_H�HAVE_LIBREADLINE�HAVE_LIBRESOLV�HAVE_LIBSENDFILE�HAVE_LIBUTIL_H�	HAVE_LINK�HAVE_LINKAT�HAVE_LINUX_CAN_BCM_H�HAVE_LINUX_CAN_H�HAVE_LINUX_CAN_RAW_FD_FRAMES�HAVE_LINUX_CAN_RAW_H�HAVE_LINUX_NETLINK_H�HAVE_LINUX_RANDOM_H�HAVE_LINUX_TIPC_H�
HAVE_LOCKF�
HAVE_LOG1P�	HAVE_LOG2�HAVE_LONG_DOUBLE�
HAVE_LSTAT�HAVE_LUTIMES�HAVE_MAKEDEV�HAVE_MBRTOWC�HAVE_MEMMOVE�
HAVE_MEMORY_H�HAVE_MEMRCHR�HAVE_MKDIRAT�HAVE_MKFIFO�
HAVE_MKFIFOAT�
HAVE_MKNOD�HAVE_MKNODAT�HAVE_MKTIME�	HAVE_MMAP�HAVE_MREMAP�HAVE_NCURSES_H�HAVE_NDIR_H�HAVE_NETPACKET_PACKET_H�
HAVE_NET_IF_H�	HAVE_NICE�HAVE_OPENAT�HAVE_OPENPTY�
HAVE_PATHCONF�
HAVE_PAUSE�
HAVE_PIPE2�
HAVE_PLOCK�	HAVE_POLL�HAVE_POLL_H�HAVE_POSIX_FADVISE�HAVE_POSIX_FALLOCATE�
HAVE_PREAD�HAVE_PRLIMIT�HAVE_PROCESS_H�HAVE_PROTOTYPES�HAVE_PTHREAD_ATFORK�HAVE_PTHREAD_CONDATTR_SETCLOCK�HAVE_PTHREAD_DESTRUCTOR�HAVE_PTHREAD_H�HAVE_PTHREAD_INIT�HAVE_PTHREAD_KILL�HAVE_PTHREAD_SIGMASK�
HAVE_PTY_H�HAVE_PUTENV�HAVE_PWRITE�
HAVE_READLINK�HAVE_READLINKAT�
HAVE_READV�
HAVE_REALPATH�
HAVE_RENAMEAT�HAVE_RL_APPEND_HISTORY�HAVE_RL_CALLBACK�HAVE_RL_CATCH_SIGNAL�#HAVE_RL_COMPLETION_APPEND_CHARACTER�'HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK�HAVE_RL_COMPLETION_MATCHES�"HAVE_RL_COMPLETION_SUPPRESS_APPEND�HAVE_RL_PRE_INPUT_HOOK�HAVE_RL_RESIZE_TERMINAL�
HAVE_ROUND�HAVE_SCHED_GET_PRIORITY_MAX�HAVE_SCHED_H�HAVE_SCHED_RR_GET_INTERVAL�HAVE_SCHED_SETAFFINITY�HAVE_SCHED_SETPARAM�HAVE_SCHED_SETSCHEDULER�HAVE_SELECT�HAVE_SEM_GETVALUE�
HAVE_SEM_OPEN�HAVE_SEM_TIMEDWAIT�HAVE_SEM_UNLINK�
HAVE_SENDFILE�HAVE_SETEGID�HAVE_SETEUID�HAVE_SETGID�HAVE_SETGROUPS�HAVE_SETHOSTNAME�HAVE_SETITIMER�HAVE_SETLOCALE�HAVE_SETPGID�HAVE_SETPGRP�HAVE_SETPRIORITY�
HAVE_SETREGID�HAVE_SETRESGID�HAVE_SETRESUID�
HAVE_SETREUID�HAVE_SETSID�HAVE_SETUID�HAVE_SETVBUF�
HAVE_SHADOW_H�HAVE_SIGACTION�HAVE_SIGALTSTACK�HAVE_SIGINTERRUPT�
HAVE_SIGNAL_H�HAVE_SIGPENDING�
HAVE_SIGRELSE�HAVE_SIGTIMEDWAIT�HAVE_SIGWAIT�HAVE_SIGWAITINFO�
HAVE_SNPRINTF�HAVE_SOCKADDR_ALG�HAVE_SOCKADDR_SA_LEN�HAVE_SOCKADDR_STORAGE�HAVE_SOCKETPAIR�HAVE_SPAWN_H�HAVE_SSIZE_T�HAVE_STATVFS�HAVE_STAT_TV_NSEC�HAVE_STAT_TV_NSEC2�HAVE_STDARG_PROTOTYPES�
HAVE_STDINT_H�
HAVE_STDLIB_H�HAVE_STD_ATOMIC�HAVE_STRDUP�
HAVE_STRFTIME�HAVE_STRINGS_H�
HAVE_STRING_H�HAVE_STRLCPY�HAVE_STROPTS_H�HAVE_STRUCT_PASSWD_PW_GECOS�HAVE_STRUCT_PASSWD_PW_PASSWD�HAVE_STRUCT_STAT_ST_BIRTHTIME�HAVE_STRUCT_STAT_ST_BLKSIZE�HAVE_STRUCT_STAT_ST_BLOCKS�HAVE_STRUCT_STAT_ST_FLAGS�HAVE_STRUCT_STAT_ST_GEN�HAVE_STRUCT_STAT_ST_RDEV�HAVE_STRUCT_TM_TM_ZONE�HAVE_SYMLINK�HAVE_SYMLINKAT�	HAVE_SYNC�HAVE_SYSCONF�HAVE_SYSEXITS_H�HAVE_SYS_AUDIOIO_H�HAVE_SYS_BSDTTY_H�HAVE_SYS_DEVPOLL_H�HAVE_SYS_DIR_H�HAVE_SYS_ENDIAN_H�HAVE_SYS_EPOLL_H�HAVE_SYS_EVENT_H�HAVE_SYS_FILE_H�HAVE_SYS_IOCTL_H�HAVE_SYS_KERN_CONTROL_H�HAVE_SYS_LOADAVG_H�HAVE_SYS_LOCK_H�HAVE_SYS_MKDEV_H�HAVE_SYS_MODEM_H�HAVE_SYS_NDIR_H�HAVE_SYS_PARAM_H�HAVE_SYS_POLL_H�HAVE_SYS_RANDOM_H�HAVE_SYS_RESOURCE_H�HAVE_SYS_SELECT_H�HAVE_SYS_SENDFILE_H�HAVE_SYS_SOCKET_H�HAVE_SYS_STATVFS_H�HAVE_SYS_STAT_H�HAVE_SYS_SYSCALL_H�HAVE_SYS_SYSMACROS_H�HAVE_SYS_SYS_DOMAIN_H�HAVE_SYS_TERMIO_H�HAVE_SYS_TIMES_H�HAVE_SYS_TIME_H�HAVE_SYS_TYPES_H�HAVE_SYS_UIO_H�
HAVE_SYS_UN_H�HAVE_SYS_UTSNAME_H�HAVE_SYS_WAIT_H�HAVE_SYS_XATTR_H�HAVE_TCGETPGRP�HAVE_TCSETPGRP�HAVE_TEMPNAM�HAVE_TERMIOS_H�HAVE_TERM_H�HAVE_TGAMMA�HAVE_TIMEGM�
HAVE_TIMES�HAVE_TMPFILE�HAVE_TMPNAM�
HAVE_TMPNAM_R�HAVE_TM_ZONE�
HAVE_TRUNCATE�HAVE_TZNAME�
HAVE_UCS4_TCL�
HAVE_UNAME�
HAVE_UNISTD_H�
HAVE_UNLINKAT�
HAVE_UNSETENV�HAVE_USABLE_WCHAR_T�HAVE_UTIL_H�HAVE_UTIMENSAT�HAVE_UTIMES�HAVE_UTIME_H�
HAVE_WAIT3�
HAVE_WAIT4�HAVE_WAITID�HAVE_WAITPID�HAVE_WCHAR_H�HAVE_WCSCOLL�
HAVE_WCSFTIME�HAVE_WCSXFRM�HAVE_WMEMCMP�HAVE_WORKING_TZSET�HAVE_WRITEV�HAVE_ZLIB_COPY�HAVE__GETPTY�
HOST_GNU_TYPE�INCLDIRSTOMAKE�
INCLUDEDIR�	INCLUDEPY�INSTALL�INSTALL_DATA�INSTALL_PROGRAM�INSTALL_SCRIPT�INSTALL_SHARED�
INSTSONAME�IO_H�IO_OBJS�LDCXXSHARED�LDFLAGS�LDLAST�	LDLIBRARY�LDLIBRARYDIR�LDSHARED�	LDVERSION�LIBC�LIBDEST�LIBDIR�LIBFFI_INCLUDEDIR�LIBM�	LIBOBJDIR�LIBOBJS�LIBPC�LIBPL�LIBRARY�LIBRARY_OBJS�LIBRARY_OBJS_OMIT_FROZEN�LIBS�
LIBSUBDIRS�LINKCC�
LINKFORSHARED�LIPO_32BIT_FLAGS�
LLVM_PROF_ERR�LLVM_PROF_FILE�LLVM_PROF_MERGER�LN�LOCALMODLIBS�LOG1P_DROPS_ZERO_SIGN�MACHDEP�MACHDEPPATH�MACHDEP_OBJS�MACHDESTLIB�MACOSX_DEPLOYMENT_TARGET�MAINCC�MAJOR_IN_MKDEV�MAJOR_IN_SYSMACROS�	MAKESETUP�MANDIR�MKDIR_P�MODLIBS�MODNAMES�MODOBJS�MODULE_OBJS�	MULTIARCH�MULTIARCH_CPPFLAGS�MVWDELCH_IS_EXPRESSION�NO_AS_NEEDED�OBJECT_OBJS�OPT�OTHER_LIBTOOL_OPT�PACKAGE_BUGREPORT�PACKAGE_NAME�PACKAGE_STRING�PACKAGE_TARNAME�PACKAGE_URL�PACKAGE_VERSION�PARSER_HEADERS�PARSER_OBJS�PGEN�PGENOBJS�PGOBJS�PGO_PROF_GEN_FLAG�PGO_PROF_USE_FLAG�PLATDIR�POBJS�POSIX_SEMAPHORES_NOT_ENABLED�PROFILE_TASK�PTHREAD_SYSTEM_SCHED_SUPPORTED�
PY3LIBRARY�PYLONG_BITS_IN_DIGIT�PYTHON�PYTHONFRAMEWORK�PYTHONFRAMEWORKDIR�PYTHONFRAMEWORKINSTALLDIR�PYTHONFRAMEWORKPREFIX�
PYTHONPATH�PYTHON_FOR_BUILD�PYTHON_FOR_REGEN�PYTHON_HEADERS�PYTHON_OBJS�	PY_CFLAGS�PY_CFLAGS_NODIST�PY_COERCE_C_LOCALE�PY_CORE_CFLAGS�PY_CORE_LDFLAGS�PY_CPPFLAGS�PY_FORMAT_SIZE_T�
PY_LDFLAGS�PY_LDFLAGS_NODIST�PY_SSL_DEFAULT_CIPHERS�PY_SSL_DEFAULT_CIPHER_STRING�PY_WARN_ON_C_LOCALE�Py_DEBUG�Py_ENABLE_SHARED�Py_HASH_ALGORITHM�
QUICKTESTOPTS�READELF�	RESSRCDIR�
RETSIGTYPE�	RUNSHARED�	SCRIPTDIR�SETPGRP_HAVE_ARG�SGI_ABI�SHELL�SHLIBS�SHLIB_SUFFIX�SIGNED_RIGHT_SHIFT_ZERO_FILLS�SITEPATH�
SIZEOF_DOUBLE�SIZEOF_FLOAT�
SIZEOF_FPOS_T�
SIZEOF_INT�SIZEOF_LONG�SIZEOF_LONG_DOUBLE�SIZEOF_LONG_LONG�SIZEOF_OFF_T�SIZEOF_PID_T�SIZEOF_PTHREAD_T�SIZEOF_SHORT�
SIZEOF_SIZE_T�
SIZEOF_TIME_T�SIZEOF_UINTPTR_T�
SIZEOF_VOID_P�SIZEOF_WCHAR_T�SIZEOF__BOOL�SOABI�SRCDIRS�
SRC_GDB_HOOKS�STDC_HEADERS�STRICT_SYSV_CURSES�	STRIPFLAG�SUBDIRS�
SUBDIRSTOO�SYSLIBS�SYS_SELECT_WITH_SYS_TIME�TANH_PRESERVES_ZERO_SIGN�TCLTK_INCLUDES�
TCLTK_LIBS�TESTOPTS�TESTPATH�
TESTPYTHON�TESTPYTHONOPTS�
TESTRUNNER�TESTTIMEOUT�	THREADOBJ�TIMEMODULE_LIB�TIME_WITH_SYS_TIME�TM_IN_SYS_TIME�UNICODE_DEPS�UNIVERSALSDK�UPDATE_FILE�USE_COMPUTED_GOTOS�
USE_INLINE�VERSION�VPATH�WANT_SIGFPE_HANDLER�WINDOW_HAS_FLAGS�WITH_DOC_STRINGS�WITH_DTRACE�	WITH_DYLD�WITH_LIBINTL�WITH_NEXT_FRAMEWORK�
WITH_PYMALLOC�WITH_THREAD�
WITH_VALGRIND�X87_DOUBLE_ROUNDING�
XMLLIBSUBDIRS�abs_builddir�
abs_srcdir�datarootdir�exec_prefix�prefix�srcdirN)�build_time_vars�r�r��?/usr/lib64/python3.6/_sysconfigdata_m_linux_x86_64-linux-gnu.py�<module>s*sre_parse.cpython-36.opt-2.pyc000064400000047451150335715140012134 0ustar003


 \���@s�ddlTdZdZed�Zed�Zed�Zed�Zed�Zee	e
h�Zeee
eeeeh�Zeed	�feed
�feed�feed�feed
�feed�feed�feed�fd�Zeefeefeefeeefgfeeefgfeeefgfeeefgfeeefgfeeefgfeefd�
Z e!e"e#e$e%e&e'e(d�Z)e&e"Be(Be*Be'BZ+Gdd�de,�Z-Gdd�d�Z.Gdd�d�Z/Gdd�d�Z0dd�Z1dd�Z2d d!�Z3d"d#�Z4d2d%d&�Z5d'd(�Z6d)d*�Z7d3d,d-�Z8d.d/�Z9d0d1�Z:d+S)4�)�*z.\[{()*+?^$|z*+?{�
0123456789Z01234567Z0123456789abcdefABCDEFZ4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZz 	

����
�
�	��\)z\az\bz\fz\nz\rz\tz\vz\\)
z\Az\bz\Bz\dz\Dz\sz\Sz\wz\Wz\Z)�i�L�m�s�x�a�t�uc@seZdZdS)�VerboseN)�__name__�
__module__�__qualname__�rr�!/usr/lib64/python3.6/sre_parse.pyrGsrc@sBeZdZdd�Zedd��Zddd�Zdd	�Zd
d�Zdd
�Z	dS)�PatterncCsd|_i|_dg|_d|_dS)Nr)�flags�	groupdict�groupwidths�lookbehindgroups)�selfrrr�__init__LszPattern.__init__cCs
t|j�S)N)�lenr)rrrr�groupsQszPattern.groupsNcCsb|j}|jjd�|jtkr$td��|dk	r^|jj|d�}|dk	rTtd|||f��||j|<|S)Nztoo many groupsz7redefinition of group name %r as group %d; was group %d)r"r�append�	MAXGROUPS�errorr�get)r�name�gid�ogidrrr�	opengroupTs

zPattern.opengroupcCs|j�|j|<dS)N)�getwidthr)rr(�prrr�
closegroup`szPattern.closegroupcCs||jko|j|dk	S)N)r"r)rr(rrr�
checkgroupbszPattern.checkgroupcCs6|jdk	r2|j|�s|jd��||jkr2|jd��dS)Nzcannot refer to an open groupz?cannot refer to group defined in the same lookbehind subpattern)rr.r%)rr(�sourcerrr�checklookbehindgroupes




zPattern.checklookbehindgroup)N)
rrrr �propertyr"r*r-r.r0rrrrrJs
rc@s`eZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�ZdS)�
SubPatternNcCs"||_|dkrg}||_d|_dS)N)�pattern�data�width)rr3r4rrrr os
zSubPattern.__init__rcCs�d}ttf}�x�|jD�]�\}}t|dt|�dd�|tkrtt�x*|D]"\}}t|ddt|�|�qLWq|tkr�t�x:t|d�D]*\}}|r�t|dd�|j|d�q�Wq|t	k�r|\}}	}
td|�|	j|d�|
�r�t|dd�|
j|d�qt
||��r�d}x\|D]T}t
|t��rX|�sDt�|j|d�d}n"|�sjtd	dd�t|dd�d}�q(W|�s�t�qtd|�qWdS)
NTz  �)�end��OR�ELSEF� )�tuple�listr4�print�str�IN�BRANCH�	enumerate�dump�GROUPREF_EXISTS�
isinstancer2)r�level�nl�seqtypes�op�avrr�	condgroup�item_yes�item_norrrrCusH 




zSubPattern.dumpcCs
t|j�S)N)�reprr4)rrrr�__repr__�szSubPattern.__repr__cCs
t|j�S)N)r!r4)rrrr�__len__�szSubPattern.__len__cCs|j|=dS)N)r4)r�indexrrr�__delitem__�szSubPattern.__delitem__cCs&t|t�rt|j|j|�S|j|S)N)rE�slicer2r3r4)rrQrrr�__getitem__�s
zSubPattern.__getitem__cCs||j|<dS)N)r4)rrQ�coderrr�__setitem__�szSubPattern.__setitem__cCs|jj||�dS)N)r4�insert)rrQrUrrrrW�szSubPattern.insertcCs|jj|�dS)N)r4r#)rrUrrrr#�szSubPattern.appendc	Cs�|jdk	r|jSd}}�x�|jD�]�\}}|tkr�td}d}x0|dD]$}|j�\}}t||�}t||�}qJW||}||}q"|tkr�|j�\}}||}||}q"|tkr�|dj�\}}||}||}q"|t	k�r|dj�\}}|||d}|||d}q"|t
k�r,|d}|d}q"|tk�rX|jj
|\}}||}||}q"|tk�r�|dj�\}}|ddk	�r�|dj�\}}t||�}t||�}nd}||}||}q"|tkr"Pq"Wt|td�t|t�f|_|jS)Nrr8����)r5r4rA�	MAXREPEATr+�min�max�CALL�
SUBPATTERN�_REPEATCODES�
_UNITCODES�GROUPREFr3rrD�SUCCESS)	r�lo�hirIrJr�j�l�hrrrr+�sZ












zSubPattern.getwidth)N)r)
rrrr rCrOrPrRrTrVrWr#r+rrrrr2ms

(r2c@sbeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Ze	d
d��Z
dd�Zdd�Zddd�Z
dS)�	TokenizercCs@t|t�|_||_|js"t|d�}||_d|_d|_|j�dS)N�latin1r)rEr?�istext�string�decoded_stringrQ�next�_Tokenizer__next)rrkrrrr �s
zTokenizer.__init__cCs�|j}y|j|}Wntk
r.d|_dSX|dkr�|d7}y||j|7}Wn.tk
r�td|jt|j�d�d�YnX|d|_||_dS)Nrr8zbad escape (end of pattern))rQrl�
IndexErrorrmr%rkr!)rrQ�charrrr�__next�s
zTokenizer.__nextcCs||jkr|j�dSdS)NTF)rmrn)rrprrr�match�s
zTokenizer.matchcCs|j}|j�|S)N)rmrn)r�thisrrrr&�sz
Tokenizer.getcCs:d}x0t|�D]$}|j}||kr"P||7}|j�qW|S)Nr6)�rangermrn)r�n�charset�result�_�crrr�getwhileszTokenizer.getwhilecCshd}x^|j}|j�|dkr>|s*|jd��|jd|t|���||krX|sV|jdd��P||7}qW|S)Nr6zmissing group namezmissing %s, unterminated namer8)rmrnr%r!)r�
terminatorrwryrrr�getuntil
s


zTokenizer.getuntilcCs|jt|jpd�S)Nr6)rQr!rm)rrrr�possz
Tokenizer.poscCs|jt|jpd�S)Nr6)rQr!rm)rrrr�tellszTokenizer.tellcCs||_|j�dS)N)rQrn)rrQrrr�seekszTokenizer.seekrcCst||j|j�|�S)N)r%rkr~)r�msg�offsetrrrr%#szTokenizer.errorN)r)rrrr rnrrr&rzr|r1r}r~rr%rrrrrh�s		rhcCstj|�}|r|Stj|�}|r0|dtkr0|S�y�|dd�}|dkr�||jdt�7}t|�dkrx|jd|t|���tt	|dd�d�fS|dkr�|j
r�||jdt�7}t|�d	kr�|jd|t|���tt	|dd�d�fS|d
ko�|j
�rF||jdt�7}t|�dk�r$|jd|t|���t	|dd�d�}t|�t|fS|tk�r�||jdt�7}t	|dd�d�}|d
k�r�|jd|t|���t|fS|t
k�r�t�t|�dk�r�|tk�r�|jd|t|���tt|d�fSWntk
�r�YnX|jd|t|���dS)Nrr8rXr�zincomplete escape %s�r��U��
�z.octal escape value %s outside of range 0-0o377z
bad escape %s)�ESCAPESr&�
CATEGORIESr@rz�	HEXDIGITSr!r%�LITERAL�intrj�chr�	OCTDIGITS�DIGITS�
ValueError�ASCIILETTERS�ord)r/�escaperUryrrr�
_class_escape&sR





r�cCs�tj|�}|r|Stj|�}|r$|S�yt|dd�}|dkr�||jdt�7}t|�dkrl|jd|t|���tt|dd�d�fS|dkr�|j	r�||jdt�7}t|�dkr�|jd|t|���tt|dd�d�fS|d	ko�|j	�r:||jd
t�7}t|�dk�r|jd|t|���t|dd�d�}t
|�t|fS|dk�rj||jdt�7}tt|dd�d
�fS|tk�r\|j
tk�r�||j�7}|dtk�r�|dtk�r�|j
tk�r�||j�7}t|dd�d
�}|d
k�r�|jd|t|���t|fSt|dd��}||jk�rD|j|��s0|jdt|���|j||�t|fS|jd|t|�d��t|�dk�r�|tk�r�|jd|t|���tt|d�fSWntk
�r�YnX|jd|t|���dS)Nr8rXrr�zincomplete escape %sr�rr�r�r�r��0r�z.octal escape value %s outside of range 0-0o377zcannot refer to an open groupzinvalid group reference %dz
bad escape %s)r�r&r�rzr�r!r%r�r�rjr�r�r�rmr"r.r0rar�r�r�)r/r��staterUry�grouprrr�_escapeVsn







r�cCs$g}|j}|j}|j�}x.|t||||d|o4|��|d�sPqWt|�dkr\|dSt|�}|j}	x\d}
xP|D]*}|s�P|
dkr�|d}
qv|d|
krvPqvWx|D]
}|d=q�W|	|
�qlPqlWxD|D]"}t|�dks�|ddtk	r�Pq�W|	tdd�|D�f�|S|jtd|ff�|S)Nr8�|rcSsg|]}|d�qS)rr)�.0�itemrrr�
<listcomp>�sz_parse_sub.<locals>.<listcomp>)	r#rrr~�_parser!r2r�r@rA)r/r��verbose�nested�items�itemsappend�sourcematch�start�
subpattern�subpatternappend�prefixr�rrr�
_parse_sub�sD




r�cCsht||||d�}|jd�rDt||||d�}|jdkrH|jd��nd}t|�}|jt|||ff�|S)Nr8r�z/conditional backref with more than two branches)r�rrrmr%r2r#rD)r/r�rKr�r�rLrMr�rrr�_parse_sub_cond�s

r�Fc)Cst|�}|j}|j}|j}t}	t}
�
x�|j}|dkr6P|dkr@P|�|r||tkrTq&|dkr|x|�}|dkst|dkr^Pq^Wq&|ddkr�t|||�}||�q&|t	kr�|t
|
|�f�q&|dk�r4|j�d}
g}|j}|d�r�|tdf�|dd�}�x�|�}|dk�r |j
d	|j�|
��|d
k�r8||k�r8Pn&|ddk�rRt||�}nt
|
|�f}|d��r�|�}|dk�r�|j
d	|j�|
��|d
k�r�|dtk�r�|dd}||�|t
|
d�f�P|ddk�r�t||�}nt
|
|�f}|dt
k�s|dt
k�r4d||f}|j
|t|�dt|���|d}|d}||k�rvd||f}|j
|t|�dt|���|t||ff�n"|dtk�r�|dd}||��q�W|	|�dk�r�|ddt
k�r�||d�nT|	|�d
k�r&|ddtk�r&|ddt
k�r&|t|ddf�n|t|f�q&|tk�rb|j�}
|dk�r\d7\}}�nJ|dk�rtdt}}�n2|dk�r�dt}}�n|dk�r�|jdk�r�|t
|
|�f�q&dt}}d}}x|jtk�r�||�7}�q�W|d��rx"|jtk�r
||�7}�q�Wn|}|d��s8|t
|
|�f�|j|
�q&|�rXt|�}|tk�rXtd��|�r�t|�}|tk�rxtd��||k�r�|j
d|j�|
��ntd|f��|�r�|d8d�}nd}|�s�|	|�dk�r|ddtk�r|j
d|j�|
t|���|ddtk�r0|j
d|j�|
t|���|d��rNt|||ff|d9<nt|||ff|d:<q&|dk�rz|tdf�q&|dk�
r�|j�d}d}d}d}d}d}|d��	r�|�}|dk�r�|j
d��|dk�r�|d��r|jd �}|j��s�d!|}|j
|t|�d��n�|d"��r�|jd#�}|j��sHd!|}|j
|t|�d��|j j|�} | dk�rzd$|}|j
|t|�d��|j!| ��s�|j
d%t|�d��|j"| |�|t#| f�q&n2|�}|dk�r�|j
d��|j
d&|t|�d
���n�|d'k�r�d}�n�|dk�rDx4|jdk�r*|j
d(|j�|��|�d#k�r
P�q
Wq&�n�|d)k�r0d}!|dk�r�|�}|dk�rv|j
d��|d*k�r�|j
d+|t|�d
��d;}!|j$}"|"dk�r�|j%|_$t&||||d�}#|!dk�r�|"dk�r�d|_$|d#��s�|j
d,|j�|��|d"k�r|t'|!|#ff�q&|t(|!|#ff�q&�n�|dk�	r$|jd#�}$d}|$j��r�|j j|$�}|dk�	rd$|$}|j
|t|$�d��n�yt|$�}|dk�r�t)�Wn4t)k
�r�d!|$}|j
|t|$�d�d�YnX|�s�|j
d-t|$�d��|t*k�	rd.|}|j
|t|$�d��|j"||�n�|t+k�	s8|dk�	r�t,|||�}%|%dk�	r�|�	s\|�	r�ddl-}&|&j.d/|j/dd0�t|j/�d0k�	r�d1ndft0|d2d3�|j1t2@r&|r&t3�q&|%\}}d}n|j
d4|t|�d��|dk	�
r0y|j4|�}Wn<t
k
�
r.}'z|j
|'j5t|�d�d�WYdd}'~'XnX|�
rLt6|||||d�}#n,|�
s\|t2@�
od|t2@}(t&|||(|d�}#|jd#��
s�|j
d,|j�|��|dk	�
r�|j7||#�|t8||||#ff�q&|dk�
r�|tt9f�q&|d5k�
r�|jtt:f�q&td6|f��q&W|S)<Nz|)�#rrr�[r8�^zunterminated character set�]�-zbad character range %s-%srX�?r�+�{�}r6�,z"the repetition number is too largez"min repeat greater than max repeatzunsupported quantifier %rznothing to repeatzmultiple repeat�.�(Tzunexpected end of pattern�P�<�>zbad character in group name %r�=�)zunknown group name %rzcannot refer to an open groupzunknown extension ?P�:zmissing ), unterminated commentz=!<z=!zunknown extension ?<z"missing ), unterminated subpatternzbad group numberzinvalid group reference %dz-Flags not at the start of the expression %r%s�z (truncated)r�)�
stacklevelzunknown extension ?�$z unsupported special character %r)rr8rYrYrYrY);r2r#r&rrr!r�rm�
WHITESPACEr��
SPECIAL_CHARSr�r~�NEGATEr%r�r@�RANGE�NOT_LITERAL�REPEAT_CHARSrZr�rr��
OverflowError�AssertionError�ATr_�
MIN_REPEAT�
MAX_REPEAT�ANYr|�isidentifierrr.r0rarr"r��ASSERT�
ASSERT_NOTr�r$�FLAGS�_parse_flags�warnings�warnrk�DeprecationWarningr�SRE_FLAG_VERBOSErr*r�r�r-r^�AT_BEGINNING�AT_END))r/r�r�r��firstr�r��	sourcegetr��_len�_ordrsrU�here�set�	setappendr��code1�that�code2r�rcrdr[r\rpr�r�r'rK�	add_flags�	del_flagsr(�dirrr,�condnamerr��err�sub_verboserrrr��s






 2











(






































*



r�cCs�|j}d}d}|dkrrxZ|t|O}|�}|dkr<|jd��|dkrFP|tkr|j�rZdnd}|j|t|���qW|dkr�|j|O_dS|t@r�|jdd��|dk�rL|�}|dkr�|jd	��|tkr�|j�r�dnd	}|j|t|���x`|t|O}|�}|dk�r|jd
��|dk�rP|tkr�|j��r4dnd
}|j|t|���q�W|t@�rb|jdd��||@�rx|jd
d��||fS)Nrr�zmissing -, : or )z)-:zunknown flagr�z,bad inline flags: cannot turn on global flagr8zmissing flagz	missing :r�z-bad inline flags: cannot turn off global flagz(bad inline flags: flag turned on and off)r&r�r%�isalphar!r�GLOBAL_FLAGS)r/r�rpr�r�r�r�rrrr�sR







r�cCsjt|t�r>|t@rtd��|t@s,|tO}qf|t@rftd��n(|t@rNtd��|t@rf|t@rftd��|S)Nz)cannot use LOCALE flag with a str patternz(ASCII and UNICODE flags are incompatiblez,cannot use UNICODE flag with a bytes patternz'ASCII and LOCALE flags are incompatible)rEr?�SRE_FLAG_LOCALEr��SRE_FLAG_ASCII�SRE_FLAG_UNICODE)�srcrrrr�	fix_flags<s


r�NcCs�t|�}|dkrt�}||_||_yt|||t@d�}WnBtk
rzt�}|tB|_||_|jd�t||dd�}YnXt||j	j�|j	_|j
dk	r�|jd��|t@r�|j
�|S)NrTzunbalanced parenthesis)rhrrr?r�r�rrr�r3rmr%�SRE_FLAG_DEBUGrC)r?rr3r/r,rrr�parseLs&



r�cs�t|���j}g�g�g��j}�����fdd�}�j}�x�|�}|dkrNP|ddk�r�|d}|dk�rJd}�jd�s��jd	���jd
�}|j�r�y||}	Wn tk
r�t	d|��YnXnlyt
|�}	|	dkr�t�Wn0tk
�r�jd|t|�d�d�YnX|	t
k�r4�jd
|	t|�d��||	t|�d��q�|dk�r��jtk�r�||�7}�jtk�r�||�7}|tt
|dd�d�d@���q�|tk�rZd}
�jtk�r4||�7}|tk�r4|dtk�r4�jtk�r4||�7}d}
t
|dd�d�}|dk�r(�jd|t|���|t|��|
�s�|t
|dd��t|�d�nZytt|d�}Wn<tk
�r�|tk�r�ddl}|jd|tdd�YnX||�q>||�q>W��r؈jdj���t|t��s�dd��D����fS)NcsX|�jkr�jd||���r8�jdj����dd�=�jt��|f��jd�dS)Nzinvalid group reference %dr6)r"r%r#�joinr!)rQr})r"�literal�literalsr3rrr�addgroupus

z parse_template.<locals>.addgrouprrr8�gr6r�z	missing <r�zunknown group name %rzbad character in group name %rzinvalid group reference %dr�r�r�FrXTz.octal escape value %s outside of range 0-0o377z
bad escape %sr�)r�cSs"g|]}|dkrdn|jd��qS)Nzlatin-1)�encode)r�rrrrr��sz"parse_template.<locals>.<listcomp>)rhr&r#�
groupindexrrr%r|r��KeyErrorror�r�r!r$rmr�r�r�r�r�r�r�r�r�rEr?)r/r3�sget�lappendr�r�rsryr'rQ�isoctalr�r)r"r�r�r3rr�parse_templatels�









"



 


r�cCsz|j}|jdd�}|\}}|dd�}y&x |D]\}}||�pB|||<q0WWn tk
rntd|��YnX|j|�S)Nrzinvalid group reference %d)r�rkror%r�)�templaterrr��emptyr"r�rQr�rrr�expand_template�sr�)F)rN);�
sre_constantsr�r��	frozensetr�r�r�r�r�r�r�r_r�r�r@r�r��CATEGORYr`r�r�r�ZAT_BEGINNING_STRINGZAT_BOUNDARYZAT_NON_BOUNDARYZCATEGORY_DIGITZCATEGORY_NOT_DIGITZCATEGORY_SPACEZCATEGORY_NOT_SPACEZ
CATEGORY_WORDZCATEGORY_NOT_WORDZ
AT_END_STRINGr��SRE_FLAG_IGNORECASEr��SRE_FLAG_MULTILINE�SRE_FLAG_DOTALLr�r��SRE_FLAG_TEMPLATEr�r�r�r��	Exceptionrrr2rhr�r�r�r�r�r�r�r�r�r�rrrr�<module>sh






#qH0A3
<,
 Wsocketserver.cpython-36.pyc000064400000057274150335715140011734 0ustar003


 \�i�@sdZdZddlZddlZddlZddlZddlZyddlZWnek
rXddl	ZYnXddl
mZddlm
Zdddd	d
ddd
dg	Zeed�r�ejdddg�eed�r�ejddddg�eed�r�ejZnejZGdd�d�ZGdd�de�ZGdd�de�Zeed��rGdd�d�ZGdd�d�Zeed��r\Gdd�dee�ZGdd�dee�ZGd d	�d	ee�ZGd!d
�d
ee�Zeed��r�Gd"d�de�ZGd#d�de�ZGd$d�dee�ZGd%d�dee�Z Gd&d�d�Z!Gd'd�de!�Z"Gd(d)�d)e�Z#Gd*d
�d
e!�Z$dS)+apGeneric socket server classes.

This module tries to capture the various aspects of defining a server:

For socket-based servers:

- address family:
        - AF_INET{,6}: IP (Internet Protocol) sockets (default)
        - AF_UNIX: Unix domain sockets
        - others, e.g. AF_DECNET are conceivable (see <socket.h>
- socket type:
        - SOCK_STREAM (reliable stream, e.g. TCP)
        - SOCK_DGRAM (datagrams, e.g. UDP)

For request-based servers (including socket-based):

- client address verification before further looking at the request
        (This is actually a hook for any processing that needs to look
         at the request before anything else, e.g. logging)
- how to handle multiple requests:
        - synchronous (one request is handled at a time)
        - forking (each request is handled by a new process)
        - threading (each request is handled by a new thread)

The classes in this module favor the server type that is simplest to
write: a synchronous TCP/IP server.  This is bad class design, but
save some typing.  (There's also the issue that a deep class hierarchy
slows down method lookups.)

There are five classes in an inheritance diagram, four of which represent
synchronous servers of four types:

        +------------+
        | BaseServer |
        +------------+
              |
              v
        +-----------+        +------------------+
        | TCPServer |------->| UnixStreamServer |
        +-----------+        +------------------+
              |
              v
        +-----------+        +--------------------+
        | UDPServer |------->| UnixDatagramServer |
        +-----------+        +--------------------+

Note that UnixDatagramServer derives from UDPServer, not from
UnixStreamServer -- the only difference between an IP and a Unix
stream server is the address family, which is simply repeated in both
unix server classes.

Forking and threading versions of each type of server can be created
using the ForkingMixIn and ThreadingMixIn mix-in classes.  For
instance, a threading UDP server class is created as follows:

        class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass

The Mix-in class must come first, since it overrides a method defined
in UDPServer! Setting the various member variables also changes
the behavior of the underlying server mechanism.

To implement a service, you must derive a class from
BaseRequestHandler and redefine its handle() method.  You can then run
various versions of the service by combining one of the server classes
with your request handler class.

The request handler class must be different for datagram or stream
services.  This can be hidden by using the request handler
subclasses StreamRequestHandler or DatagramRequestHandler.

Of course, you still have to use your head!

For instance, it makes no sense to use a forking server if the service
contains state in memory that can be modified by requests (since the
modifications in the child process would never reach the initial state
kept in the parent process and passed to each child).  In this case,
you can use a threading server, but you will probably have to use
locks to avoid two requests that come in nearly simultaneous to apply
conflicting changes to the server state.

On the other hand, if you are building e.g. an HTTP server, where all
data is stored externally (e.g. in the file system), a synchronous
class will essentially render the service "deaf" while one request is
being handled -- which may be for a very long time if a client is slow
to read all the data it has requested.  Here a threading or forking
server is appropriate.

In some cases, it may be appropriate to process part of a request
synchronously, but to finish processing in a forked child depending on
the request data.  This can be implemented by using a synchronous
server and doing an explicit fork in the request handler class
handle() method.

Another approach to handling multiple simultaneous requests in an
environment that supports neither threads nor fork (or where these are
too expensive or inappropriate for the service) is to maintain an
explicit table of partially finished requests and to use a selector to
decide which request to work on next (or whether to handle a new
incoming request).  This is particularly important for stream services
where each client can potentially be connected for a long time (if
threads or subprocesses cannot be used).

Future work:
- Standard classes for Sun RPC (which uses either UDP or TCP)
- Standard mix-in classes to implement various authentication
  and encryption schemes

XXX Open problems:
- What to do with out-of-band data?

BaseServer:
- split generic "request" functionality out into BaseServer class.
  Copyright (C) 2000  Luke Kenneth Casson Leighton <lkcl@samba.org>

  example: read entries from a SQL database (requires overriding
  get_request() to return a table entry from the database).
  entry is processed by a RequestHandlerClass.

z0.4�N)�BufferedIOBase)�	monotonic�
BaseServer�	TCPServer�	UDPServer�ThreadingUDPServer�ThreadingTCPServer�BaseRequestHandler�StreamRequestHandler�DatagramRequestHandler�ThreadingMixIn�fork�ForkingUDPServer�ForkingTCPServer�ForkingMixIn�AF_UNIX�UnixStreamServer�UnixDatagramServer�ThreadingUnixStreamServer�ThreadingUnixDatagramServer�PollSelectorc@s�eZdZdZdZdd�Zdd�Zd&dd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdS)'ra�Base class for server classes.

    Methods for the caller:

    - __init__(server_address, RequestHandlerClass)
    - serve_forever(poll_interval=0.5)
    - shutdown()
    - handle_request()  # if you do not use serve_forever()
    - fileno() -> int   # for selector

    Methods that may be overridden:

    - server_bind()
    - server_activate()
    - get_request() -> request, client_address
    - handle_timeout()
    - verify_request(request, client_address)
    - server_close()
    - process_request(request, client_address)
    - shutdown_request(request)
    - close_request(request)
    - service_actions()
    - handle_error()

    Methods for derived classes:

    - finish_request(request, client_address)

    Class variables that may be overridden by derived classes or
    instances:

    - timeout
    - address_family
    - socket_type
    - allow_reuse_address

    Instance variables:

    - RequestHandlerClass
    - socket

    NcCs ||_||_tj�|_d|_dS)z/Constructor.  May be extended, do not override.FN)�server_address�RequestHandlerClass�	threadingZEvent�_BaseServer__is_shut_down�_BaseServer__shutdown_request)�selfrr�r�$/usr/lib64/python3.6/socketserver.py�__init__�s
zBaseServer.__init__cCsdS)zSCalled by constructor to activate the server.

        May be overridden.

        Nr)rrrr�server_activate�szBaseServer.server_activate��?cCsx|jj�zVt��F}|j|tj�x0|jsR|j|�}|jr<P|rH|j�|j	�q$WWdQRXWdd|_|jj
�XdS)z�Handle one request at a time until shutdown.

        Polls for shutdown every poll_interval seconds. Ignores
        self.timeout. If you need to do periodic tasks, do them in
        another thread.
        NF)r�clear�_ServerSelector�register�	selectors�
EVENT_READr�select�_handle_request_noblock�service_actions�set)rZ
poll_interval�selector�readyrrr�
serve_forever�s

zBaseServer.serve_forevercCsd|_|jj�dS)z�Stops the serve_forever loop.

        Blocks until the loop has finished. This must be called while
        serve_forever() is running in another thread, or it will
        deadlock.
        TN)rr�wait)rrrr�shutdown�szBaseServer.shutdowncCsdS)z�Called by the serve_forever() loop.

        May be overridden by a subclass / Mixin to implement any code that
        needs to be run during the loop.
        Nr)rrrrr)szBaseServer.service_actionsc
Cs�|jj�}|dkr|j}n|jdk	r0t||j�}|dk	rBt�|}t��R}|j|tj�x<|j	|�}|rp|j
�S|dk	rZ|t�}|dkrZ|j�SqZWWdQRXdS)zOHandle one request, possibly blocking.

        Respects self.timeout.
        Nr)�socketZ
gettimeout�timeout�min�timer#r$r%r&r'r(�handle_timeout)rr1Zdeadliner+r,rrr�handle_requests"




zBaseServer.handle_requestcCs�y|j�\}}Wntk
r$dSX|j||�r�y|j||�Wq�tk
rl|j||�|j|�Yq�|j|��Yq�Xn
|j|�dS)z�Handle one request, without blocking.

        I assume that selector.select() has returned that the socket is
        readable before this function was called, so there should be no risk of
        blocking in get_request().
        N)�get_request�OSError�verify_request�process_request�	Exception�handle_error�shutdown_request)r�request�client_addressrrrr(3s

z"BaseServer._handle_request_noblockcCsdS)zcCalled if no new request arrives within self.timeout.

        Overridden by ForkingMixIn.
        Nr)rrrrr4JszBaseServer.handle_timeoutcCsdS)znVerify the request.  May be overridden.

        Return True if we should proceed with this request.

        Tr)rr=r>rrrr8QszBaseServer.verify_requestcCs|j||�|j|�dS)zVCall finish_request.

        Overridden by ForkingMixIn and ThreadingMixIn.

        N)�finish_requestr<)rr=r>rrrr9YszBaseServer.process_requestcCsdS)zDCalled to clean-up the server.

        May be overridden.

        Nr)rrrr�server_closebszBaseServer.server_closecCs|j|||�dS)z8Finish one request by instantiating RequestHandlerClass.N)r)rr=r>rrrr?jszBaseServer.finish_requestcCs|j|�dS)z3Called to shutdown and close an individual request.N)�
close_request)rr=rrrr<nszBaseServer.shutdown_requestcCsdS)z)Called to clean up an individual request.Nr)rr=rrrrArszBaseServer.close_requestcCsHtddtjd�td|tjd�ddl}|j�tddtjd�dS)ztHandle an error gracefully.  May be overridden.

        The default is to print a traceback and continue.

        �-�()�filez4Exception happened during processing of request fromrN)�print�sys�stderr�	traceback�	print_exc)rr=r>rHrrrr;vszBaseServer.handle_errorcCs|S)Nr)rrrr�	__enter__�szBaseServer.__enter__cGs|j�dS)N)r@)r�argsrrr�__exit__�szBaseServer.__exit__)r!)�__name__�
__module__�__qualname__�__doc__r1rr r-r/r)r5r(r4r8r9r@r?r<rAr;rJrLrrrrr�s&+

	
c@sfeZdZdZejZejZdZ	dZ
ddd�Zdd�Zd	d
�Z
dd�Zd
d�Zdd�Zdd�Zdd�ZdS)ra3Base class for various socket-based server classes.

    Defaults to synchronous IP stream (i.e., TCP).

    Methods for the caller:

    - __init__(server_address, RequestHandlerClass, bind_and_activate=True)
    - serve_forever(poll_interval=0.5)
    - shutdown()
    - handle_request()  # if you don't use serve_forever()
    - fileno() -> int   # for selector

    Methods that may be overridden:

    - server_bind()
    - server_activate()
    - get_request() -> request, client_address
    - handle_timeout()
    - verify_request(request, client_address)
    - process_request(request, client_address)
    - shutdown_request(request)
    - close_request(request)
    - handle_error()

    Methods for derived classes:

    - finish_request(request, client_address)

    Class variables that may be overridden by derived classes or
    instances:

    - timeout
    - address_family
    - socket_type
    - request_queue_size (only for stream sockets)
    - allow_reuse_address

    Instance variables:

    - server_address
    - RequestHandlerClass
    - socket

    �FTc	CsTtj|||�tj|j|j�|_|rPy|j�|j�Wn|j��YnXdS)z/Constructor.  May be extended, do not override.N)rrr0�address_family�socket_type�server_bindr r@)rrrZbind_and_activaterrrr�s
zTCPServer.__init__cCs8|jr|jjtjtjd�|jj|j�|jj�|_dS)zOCalled by constructor to bind the socket.

        May be overridden.

        �N)�allow_reuse_addressr0�
setsockoptZ
SOL_SOCKETZSO_REUSEADDRZbindrZgetsockname)rrrrrT�szTCPServer.server_bindcCs|jj|j�dS)zSCalled by constructor to activate the server.

        May be overridden.

        N)r0Zlisten�request_queue_size)rrrrr �szTCPServer.server_activatecCs|jj�dS)zDCalled to clean-up the server.

        May be overridden.

        N)r0�close)rrrrr@�szTCPServer.server_closecCs
|jj�S)zMReturn socket file number.

        Interface required by selector.

        )r0�fileno)rrrrrZ�szTCPServer.filenocCs
|jj�S)zYGet the request and client address from the socket.

        May be overridden.

        )r0Zaccept)rrrrr6�szTCPServer.get_requestcCs4y|jtj�Wntk
r$YnX|j|�dS)z3Called to shutdown and close an individual request.N)r/r0ZSHUT_WRr7rA)rr=rrrr<�s
zTCPServer.shutdown_requestcCs|j�dS)z)Called to clean up an individual request.N)rY)rr=rrrrAszTCPServer.close_requestN)T)rMrNrOrPr0ZAF_INETrRZSOCK_STREAMrSrXrVrrTr r@rZr6r<rArrrrr�s-


c@s>eZdZdZdZejZdZdd�Z	dd�Z
dd	�Zd
d�ZdS)
rzUDP server class.Fi cCs |jj|j�\}}||jf|fS)N)r0Zrecvfrom�max_packet_size)r�dataZclient_addrrrrr6szUDPServer.get_requestcCsdS)Nr)rrrrr szUDPServer.server_activatecCs|j|�dS)N)rA)rr=rrrr<szUDPServer.shutdown_requestcCsdS)Nr)rr=rrrrAszUDPServer.close_requestN)
rMrNrOrPrVr0Z
SOCK_DGRAMrSr[r6r r<rArrrrrscsVeZdZdZdZdZdZdZdd�dd�Zd	d
�Z	dd�Z
d
d�Z�fdd�Z�Z
S)rz5Mix-in class to handle each request in a new process.i,NrCF)�blockingcCs�|jdkrdSxht|j�|jkrvy tjdd�\}}|jj|�Wqtk
r^|jj�Yqtk
rrPYqXqWxt|jj	�D]f}y.|r�dntj
}tj||�\}}|jj|�Wq�tk
r�|jj|�Yq�tk
r�Yq�Xq�WdS)z7Internal routine to wait for children that have exited.NrUr���)�active_children�len�max_children�os�waitpid�discard�ChildProcessErrorr"r7�copy�WNOHANG)rr]�pid�_�flagsrrr�collect_children,s&
zForkingMixIn.collect_childrencCs|j�dS)zvWait for zombies after self.timeout seconds of inactivity.

            May be extended, do not override.
            N)rk)rrrrr4OszForkingMixIn.handle_timeoutcCs|j�dS)z�Collect the zombie child processes regularly in the ForkingMixIn.

            service_actions is called in the BaseServer's serve_forver loop.
            N)rk)rrrrr)VszForkingMixIn.service_actionscCs�tj�}|r8|jdkrt�|_|jj|�|j|�dSd}z:y|j||�d}Wn tk
rr|j||�YnXWdz|j	|�Wdtj
|�XXdS)z-Fork a new subprocess to process the request.NrUr)rbr
r_r*�addrAr?r:r;r<�_exit)rr=r>rhZstatusrrrr9]s 

zForkingMixIn.process_requestcst�j�|j|jd�dS)N)r])�superr@rk�_block_on_close)r)�	__class__rrr@vs
zForkingMixIn.server_close)rMrNrOrPr1r_rarorkr4r)r9r@�
__classcell__rr)rprr#s#cs<eZdZdZdZdZdZdd�Zdd�Z�fdd	�Z	�Z
S)
rz4Mix-in class to handle each request in a new thread.FNcCsHz6y|j||�Wn tk
r2|j||�YnXWd|j|�XdS)zgSame as in BaseServer but as a thread.

        In addition, exception handling is done here.

        N)r?r:r;r<)rr=r>rrr�process_request_thread�s
z%ThreadingMixIn.process_request_threadcCsRtj|j||fd�}|j|_|jrF|jrF|jdkr:g|_|jj|�|j�dS)z*Start a new thread to process the request.)�targetrKN)	rZThreadrr�daemon_threadsZdaemonro�_threads�append�start)rr=r>�trrrr9�s
zThreadingMixIn.process_requestcs:t�j�|jr6|j}d|_|r6x|D]}|j�q&WdS)N)rnr@roru�join)rZthreadsZthread)rprrr@�s

zThreadingMixIn.server_close)rMrNrOrPrtrorurrr9r@rqrr)rprr{s
c@seZdZdS)rN)rMrNrOrrrrr�sc@seZdZdS)rN)rMrNrOrrrrr�sc@seZdZdS)rN)rMrNrOrrrrr�sc@seZdZdS)rN)rMrNrOrrrrr�sc@seZdZejZdS)rN)rMrNrOr0rrRrrrrr�sc@seZdZejZdS)rN)rMrNrOr0rrRrrrrr�sc@seZdZdS)rN)rMrNrOrrrrr�sc@seZdZdS)rN)rMrNrOrrrrr�sc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r	a�Base class for request handler classes.

    This class is instantiated for each request to be handled.  The
    constructor sets the instance variables request, client_address
    and server, and then calls the handle() method.  To implement a
    specific service, all you need to do is to derive a class which
    defines a handle() method.

    The handle() method can find the request as self.request, the
    client address as self.client_address, and the server (in case it
    needs access to per-server information) as self.server.  Since a
    separate instance is created for each request, the handle() method
    can define other arbitrary instance variables.

    c
Cs6||_||_||_|j�z|j�Wd|j�XdS)N)r=r>�server�setup�handle�finish)rr=r>rzrrrr�szBaseRequestHandler.__init__cCsdS)Nr)rrrrr{�szBaseRequestHandler.setupcCsdS)Nr)rrrrr|�szBaseRequestHandler.handlecCsdS)Nr)rrrrr}�szBaseRequestHandler.finishN)rMrNrOrPrr{r|r}rrrrr	�s

c@s0eZdZdZd
ZdZdZdZdd�Zdd	�Z	dS)r
z4Define self.rfile and self.wfile for stream sockets.rUrNFcCsz|j|_|jdk	r |jj|j�|jr:|jjtjtjd�|jj	d|j
�|_|jdkrdt
|j�|_n|jj	d|j�|_dS)NT�rbr�wb)r=Z
connectionr1Z
settimeout�disable_nagle_algorithmrWr0ZIPPROTO_TCPZTCP_NODELAY�makefile�rbufsize�rfile�wbufsize�
_SocketWriter�wfile)rrrrr{�s



zStreamRequestHandler.setupcCsF|jjs.y|jj�Wntjk
r,YnX|jj�|jj�dS)N)r��closed�flushr0�errorrYr�)rrrrr}s
zStreamRequestHandler.finishr^)
rMrNrOrPr�r�r1r�r{r}rrrrr
�s	
c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r�z�Simple writable BufferedIOBase implementation for a socket

    Does not hold data in a buffer, avoiding any need to call flush().cCs
||_dS)N)�_sock)rZsockrrrrsz_SocketWriter.__init__cCsdS)NTr)rrrr�writablesz_SocketWriter.writablec	Cs&|jj|�t|��}|jSQRXdS)N)r�Zsendall�
memoryview�nbytes)r�bZviewrrr�write"s
z_SocketWriter.writecCs
|jj�S)N)r�rZ)rrrrrZ'sz_SocketWriter.filenoN)rMrNrOrPrr�r�rZrrrrr�s
r�c@s eZdZdZdd�Zdd�ZdS)rz6Define self.rfile and self.wfile for datagram sockets.cCs2ddlm}|j\|_|_||j�|_|�|_dS)Nr)�BytesIO)�ior�r=Zpacketr0r�r�)rr�rrrr{.szDatagramRequestHandler.setupcCs|jj|jj�|j�dS)N)r0Zsendtor��getvaluer>)rrrrr}4szDatagramRequestHandler.finishN)rMrNrOrPr{r}rrrrr*s)%rP�__version__r0r%rb�errnorFr�ImportErrorZdummy_threadingr�rr3r�__all__�hasattr�extendrr#ZSelectSelectorrrrrrrrrrrrrrr	r
r�rrrrr�<module>ws\


n~X..-runpy.cpython-36.pyc000064400000017460150335715140010363 0ustar003


 \�.�@sdZddlZddlZddlZddlZddlmZmZddgZ	Gdd�de
�ZGdd	�d	e
�Zd d
d�Z
d!dd
�Zefdd�ZGdd�de�Zd"dd�Zd#dd�Zefdd�Zdd�Zd$dd�Zedk�r�eej�dk�r�edejd�nejd=eejd�dS)%aZrunpy.py - locating and running Python code using the module namespace

Provides support for locating and running Python scripts using the Python
module namespace instead of the native filesystem.

This allows Python code to play nicely with non-filesystem based PEP 302
importers when locating support scripts as well as when importing modules.
�N)�	read_code�get_importer�
run_module�run_pathc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_TempModulezCTemporarily replace a module in sys.modules with an empty namespacecCs||_tj|�|_g|_dS)N)�mod_name�types�
ModuleType�module�
_saved_module)�selfr�r
�/usr/lib64/python3.6/runpy.py�__init__sz_TempModule.__init__cCsB|j}y|jjtj|�Wntk
r0YnX|jtj|<|S)N)rr�append�sys�modules�KeyErrorr
)rrr
r
r�	__enter__sz_TempModule.__enter__cGs.|jr|jdtj|j<n
tj|j=g|_dS)Nr)rrrr)r�argsr
r
r�__exit__'s
z_TempModule.__exit__N)�__name__�
__module__�__qualname__�__doc__rrrr
r
r
rrs	rc@s$eZdZdd�Zdd�Zdd�ZdS)�_ModifiedArgv0cCs||_t�|_|_dS)N)�value�object�_saved_value�	_sentinel)rrr
r
rr/sz_ModifiedArgv0.__init__cCs0|j|jk	rtd��tjd|_|jtjd<dS)NzAlready preserving saved valuer)rr�RuntimeErrorr�argvr)rr
r
rr3sz_ModifiedArgv0.__enter__cGs|j|_|jtjd<dS)Nr)rrrrr!)rrr
r
rr9sz_ModifiedArgv0.__exit__N)rrrrrrr
r
r
rr.src
	Csn|dk	r|j|�|dkr(d}|}d}	n |j}|j}|j}	|dkrH|j}|j|||	d|||d�t||�|S)z)Helper to run code in nominated namespaceN)r�__file__�
__cached__r�
__loader__�__package__�__spec__)�update�loader�origin�cached�parent�exec)
�codeZrun_globals�init_globalsr�mod_spec�pkg_name�script_namer(�fnamer*r
r
r�	_run_code>s(

r3c	Cs^|dkr|n|j}t|��6}t|��"|jj}t|||||||�WdQRXWdQRX|j�S)z5Helper to run code in new namespace with sys modifiedN)r)rrr
�__dict__r3�copy)	r-r.rr/r0r1r2�temp_module�mod_globalsr
r
r�_run_module_codeXs r8c
;Cs4|jd�r|d��|jd�\}}}|r�yt|�WnJtk
r|}z.|jdksj|j|krl|j|jd�rl�WYdd}~XnXtjj|�}|dk	r�t|d�r�ddl	m
}dj||d�}|t|��yt
jj|�}WnJttttfk
�r}	z$d}||j|t|	�j|	��|	�WYdd}	~	XnX|dk�r6|d	|��|jdk	�r�|d
k�sX|jd��r`|d��y|d}
t|
|�S|k
�r�}z$|tjk�r��|d||f��WYdd}~XnX|j}|dk�r�|d|��y|j|�}Wn2tk
�r}z|t|��|�WYdd}~XnX|dk�r*|d|��|||fS)N�.z#Relative module names not supported�__path__r)�warnz�{mod_name!r} found in sys.modules after import of package {pkg_name!r}, but prior to execution of {mod_name!r}; this may result in unpredictable behaviour)rr0z:Error while finding module specification for {!r} ({}: {})zNo module named %s�__main__z	.__main__z%Cannot use package as __main__ modulez%s; %r is a package and cannot zbe directly executedz0%r is a namespace package and cannot be executedzNo code object available for %sz3%s; %r is a package and cannot be directly executed)�
startswith�
rpartition�
__import__�ImportError�namerr�get�hasattr�warningsr;�format�RuntimeWarning�	importlib�util�	find_spec�AttributeError�	TypeError�
ValueError�typer�submodule_search_locations�endswith�_get_module_detailsr(�get_code)
r�errorr0�_�eZexistingr;�msg�specZexZ
pkg_main_namer(r-r
r
rrPfsZ

,

 
 
rPc@seZdZdZdS)�_ErrorzBError that _run_module_as_main() should report without a tracebackN)rrrrr
r
r
rrW�srWTcCs�y0|s|dkr t|t�\}}}ntt�\}}}Wn:tk
rj}zdtj|f}tj|�WYdd}~XnXtjdj}|r�|jtj	d<t
||dd|�S)a�Runs the designated module in the __main__ namespace

       Note that the executed module will have full access to the
       __main__ namespace. If this is not desirable, the run_module()
       function should be used to run the module code in a fresh namespace.

       At the very least, these variables in __main__ will be overwritten:
           __name__
           __file__
           __cached__
           __loader__
           __package__
    r<z%s: %sNr)rPrW�_get_main_module_detailsr�
executable�exitrr4r)r!r3)rZ
alter_argvr/r-�excrUZmain_globalsr
r
r�_run_module_as_main�sr\FcCs@t|�\}}}|dkr|}|r,t||||�St|i|||�SdS)znExecute a module's code without importing it

       Returns the resulting top level namespace dictionary
    N)rPr8r3)rr.�run_nameZ	alter_sysr/r-r
r
rr�scCs~d}tj|}tj|=zVyt|�Stk
rh}z,|t|�krV|d|tjdf�|��WYdd}~XnXWd|tj|<XdS)Nr<zcan't find %r module in %rr)rrrPr@�str�path)rRZ	main_nameZ
saved_mainr[r
r
rrX�s
rXcCsTt|d��}t|�}WdQRX|dkrLt|d��}t|j�|d�}WdQRX||fS)N�rbr,)�openr�compile�read)r]r2�fr-r
r
r�_get_code_from_file�srec Cs|dkrd}|jd�d}t|�}d}t|�jdkrFt|�jdkrFd}t|td��sX|rxt||�\}}t|||||d	�Stj	j
d|�zRt�\}}	}t|��4}
t
|�� |
jj}t|||||	|�j�SQRXWdQRXWdytj	j|�Wntk
�rYnXXdS)
a_Execute code located at the specified filesystem location

       Returns the resulting top level namespace dictionary

       The file path may refer directly to a Python script (i.e.
       one that could be directly executed with execfile) or else
       it may refer to a zipfile or directory containing a top
       level __main__.py script.
    Nz
<run_path>r9rFZimpZNullImporterT)r0r1)r>rrMrr�
isinstancerer8rr_�insertrXrrr
r4r3r5�removerL)Z	path_namer.r]r0ZimporterZis_NullImporterr-r2rr/r6r7r
r
rr�s0



"r<�z!No module specified for execution)�file)NNNNN)NNNNN)T)NNF)NN)rr�importlib.machineryrG�importlib.utilrZpkgutilrr�__all__rrrr3r8r@rP�	ExceptionrWr\rrXrerr�lenr!�print�stderrr
r
r
r�<module>s6

:



1
pprint.cpython-36.opt-2.pyc000064400000032613150335715140011457 0ustar003


 \|Q�
@s�ddlZddlZddlZddlZddlmZ	ddddddgZ
d dd�d
d�Zd!dd�dd�Zdd�Z
dd�Zdd�ZGdd�d�Zdd�ZGdd�d�Zdd�Zeeeeeeeeed�h�Zdd�Zd"dd�Zdd�Z e!dkr�e�dS)#�N)�StringIO�pprint�pformat�
isreadable�isrecursive�saferepr�
PrettyPrinter��PF)�compactcCs t|||||d�}|j|�dS)N)�stream�indent�width�depthr)rr)�objectrr
rrrZprinter�r�/usr/lib64/python3.6/pprint.pyr/scCst||||d�j|�S)N)r
rrr)rr)rr
rrrrrrr7scCst|idd�dS)Nr)�
_safe_repr)rrrrr<scCst|idd�dS)Nrr	)r)rrrrr@scCst|idd�dS)Nr�)r)rrrrrDsc@s"eZdZdgZdd�Zdd�ZdS)�	_safe_key�objcCs
||_dS)N)r)�selfrrrr�__init__Tsz_safe_key.__init__cCsRy|j|jkStk
rLtt|j��t|j�ftt|j��t|j�fkSXdS)N)r�	TypeError�str�type�id)r�otherrrr�__lt__Ws
z_safe_key.__lt__N)�__name__�
__module__�__qualname__�	__slots__rrrrrrrHs
rcCst|d�t|d�fS)Nrr	)r)�trrr�_safe_tuple^sr$c@s�eZdZd:dd�dd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�ZiZ	dd�Z
e
e	ej<dd�Z
e
e	ejj<dd�Zee	ej<dd�Zee	ej<dd�Zee	ej<ee	ej<dd�Zee	ej<dd�Zee	ej<d d!�Zee	ej<d"d#�Zee	ejj<d$d%�Z d&d'�Z!d(d)�Z"d*d+�Z#d,d-�Z$e$e	ej%j<d.d/�Z&e&e	ej'j<d0d1�Z(e(e	ej)j<d2d3�Z*e*e	ej+j<d4d5�Z,e,e	ej-j<d6d7�Z.e.e	ej/j<d8d9�Z0e0e	ej1j<dS);rr	r
NF)rcCs|t|�}t|�}|dkr td��|dk	r8|dkr8td��|sDtd��||_||_||_|dk	rf||_ntj|_t|�|_	dS)Nrzindent must be >= 0zdepth must be > 0zwidth must be != 0)
�int�
ValueError�_depth�_indent_per_level�_width�_stream�_sys�stdout�bool�_compact)rr
rrrrrrrrcszPrettyPrinter.__init__cCs&|j||jddid�|jjd�dS)Nr�
)�_formatr*�write)rrrrrr�szPrettyPrinter.pprintcCs"t�}|j||ddid�|j�S)Nr)�	_StringIOr0�getvalue)rrZsiorrrr�szPrettyPrinter.pformatcCs|j|idd�dS)Nrr)�format)rrrrrr�szPrettyPrinter.isrecursivecCs |j|idd�\}}}|o|S)Nr)r4)rr�s�readable�	recursiverrrr�szPrettyPrinter.isreadablec	Cs�t|�}||kr.|jt|��d|_d|_dS|j|||�}|j||}	t|�|	kr�|jj	t
|�jd�}
|
dk	r�d||<|
|||||||d�||=dSt|t
�r�d||<|j||||||d�||=dS|j|�dS)NTFr	)rr1�
_recursion�
_recursive�	_readable�_reprr)�len�	_dispatch�getr�__repr__�
isinstance�dict�_pprint_dict)rrrr
�	allowance�context�level�objid�rep�	max_width�prrrr0�s,
zPrettyPrinter._formatc
Csj|j}|d�|jdkr*||jdd�t|�}|r^t|j�td�}	|j|	|||d||�|d�dS)N�{r	� )�key�})r1r(r<�sorted�itemsr$�_format_dict_items)
rrrr
rCrDrEr1ZlengthrOrrrrB�s
zPrettyPrinter._pprint_dictcCslt|�s|jt|��dS|j}|j|jd�|jt|j��||t|j�d|d||�|jd�dS)N�(r	�))r<r1�repr�	__class__rr0�listrO)rrrr
rCrDrE�clsrrr�_pprint_ordered_dict�sz"PrettyPrinter._pprint_ordered_dictcCs0|jd�|j||||d||�|jd�dS)N�[r	�])r1�
_format_items)rrrr
rCrDrErrr�_pprint_list�s
zPrettyPrinter._pprint_listcCsH|jd�t|�dkrdnd}|j||||t|�||�|j|�dS)NrQr	z,)rR)r1r<rZ)rrrr
rCrDrE�endcharrrr�
_pprint_tuple�s

zPrettyPrinter._pprint_tuplec	Cs�t|�s|jt|��dS|j}|tkr8|jd�d}n&|j|jd�d}|t|j�d7}t|td�}|j||||t|�||�|j|�dS)NrJrMz({z})r	)rL)	r<r1rSrT�setrrNrrZ)	rrrr
rCrDrE�typr\rrr�_pprint_set�s
zPrettyPrinter._pprint_setcCs�|j}t|�s|t|��dSg}|jd�}	|dkrD|d7}|d7}|j|}
}x�t|	�D]�\}}
t|
�}|t|	�dkr�|
|8}
t|�|
kr�|j|�q\tjd|
�}|j	�|}d}xtt|�D]h\}}||}|t|�dkr�|t|	�dkr�||8}tt|��|k�r&|�r |jt|��|}q�|}q�W|r\|jt|��q\Wt|�dk�r^||�dS|dk�rp|d�x8t|�D],\}}|dk�r�|dd|�||��qzW|dk�r�|d	�dS)
NTr	z\S*\s*�rQrr/rKrR)
r1r<rS�
splitlinesr)�	enumerate�append�re�findall�pop)rrrr
rCrDrEr1Zchunks�linesZ
max_width1rH�i�linerG�partsZ
max_width2�current�j�part�	candidaterrr�_pprint_str�sT
 


zPrettyPrinter._pprint_strcCs�|j}t|�dkr"|t|��dS|dk}|rF|d7}|d7}|d�d}	x:t||j||�D]$}
||	�||
�|	s^dd|}	q^W|r�|d�dS)N�r	rQrar/rKrR)r1r<rS�_wrap_bytes_reprr))rrrr
rCrDrEr1Zparens�delimrGrrr�
_pprint_bytes's"zPrettyPrinter._pprint_bytescCs>|j}|d�|jt|�||d|d||d�|d�dS)Nz
bytearray(�
r	rR)r1rt�bytes)rrrr
rCrDrEr1rrr�_pprint_bytearray<s
zPrettyPrinter._pprint_bytearraycCs8|jd�|j|j�||d|d||�|jd�dS)Nz
mappingproxy(�
r	rR)r1r0�copy)rrrr
rCrDrErrr�_pprint_mappingproxyEs
z"PrettyPrinter._pprint_mappingproxycCs�|j}||j7}dd|}t|�d}	xrt|�D]f\}
\}}|
|	k}
|j|||�}||�|d�|j|||t|�d|
r�|nd||�|
s2||�q2WdS)Nz,
rKr	z: r)r1r(r<rcr;r0)rrOrr
rCrDrEr1�delimnlZ
last_indexrirL�ent�lastrGrrrrPMs

z PrettyPrinter._format_dict_itemscCsN|j}||j7}|jdkr,||jdd�dd|}d}	|j|d}
}t|�}yt|�}
Wntk
rvdSXd}x�|�sH|
}yt|�}
Wn(tk
r�d}||8}|
|8}
YnX|j�r|j|||�}t|�d}|
|kr�|}
|	r�|}	|
|k�r|
|8}
||	�d}	||�q~||	�|}	|j	||||�r<|nd||�q~WdS)	Nr	rKz,
raFTrz, )
r1r(r)�iter�next�
StopIterationr.r;r<r0)rrOrr
rCrDrEr1r{rsrrH�itZnext_entr}r|rG�wrrrrZ^sN



zPrettyPrinter._format_itemscCs4|j||j�|j|�\}}}|s&d|_|r0d|_|S)NFT)r4ryr'r:r9)rrrDrErSr6r7rrrr;�szPrettyPrinter._reprcCst||||�S)N)r)rrrD�	maxlevelsrErrrr4�szPrettyPrinter.formatc	Cs�t|�s|jt|��dS|j|j||�}|j}|t|j�d7}|jd|j|d|f�|j||||d||�|jd�dS)Nr	z	%s(%s,
%srKrR)r<r1rSr;�default_factoryrTrrB)	rrrr
rCrDrEZrdfrVrrr�_pprint_default_dict�sz"PrettyPrinter._pprint_default_dictc	Cs�t|�s|jt|��dS|j}|j|jd�|jdkrN|j|jdd�|j�}|j|||t|j�d|d||�|jd�dS)Nz({r	rKrz}))r<r1rSrTrr(�most_commonrP)	rrrr
rCrDrErVrOrrr�_pprint_counter�s
zPrettyPrinter._pprint_counterc
Cs�t|j�s|jt|��dS|j}|j|jd�|t|j�d7}xrt|j�D]d\}}	|t|j�dkr�|j|	|||d||�|jd�qP|j|	||d||�|jdd|�qPWdS)NrQr	rRz,
rK)r<�mapsr1rSrTrrcr0)
rrrr
rCrDrErVri�mrrr�_pprint_chain_map�s
zPrettyPrinter._pprint_chain_mapc	Cs�t|�s|jt|��dS|j}|j|jd�|t|j�d7}|jd�|jdkrz|j||||d||�|jd�n:|j|||d||�|j|j||�}|jdd||f�dS)NrQr	rXrz])z],
%smaxlen=%s)rK)r<r1rSrTr�maxlenrZr;)	rrrr
rCrDrErVZrmlrrr�
_pprint_deque�s

zPrettyPrinter._pprint_dequecCs|j|j|||||d�dS)Nr	)r0�data)rrrr
rCrDrErrr�_pprint_user_dict�szPrettyPrinter._pprint_user_dictcCs|j|j|||||d�dS)Nr	)r0r�)rrrr
rCrDrErrr�_pprint_user_list�szPrettyPrinter._pprint_user_listcCs|j|j|||||d�dS)Nr	)r0r�)rrrr
rCrDrErrr�_pprint_user_string�sz!PrettyPrinter._pprint_user_string)r	r
NN)2rr r!rrrrrr0r=rBrAr?rW�_collections�OrderedDictr[rUr]�tupler`r^�	frozensetrprrtrvrw�	bytearrayrz�_types�MappingProxyTyperPrZr;r4r��defaultdictr��Counterr��ChainMapr��dequer��UserDictr��UserListr��
UserStringrrrrrbsZ&




1


)	cCs�t|�}|tkrt|�ddfSt|dd�}t|t�o<|tjk�r8|sHdSt|�}|rj||krjdd||kfS||kr�t|�ddfSd||<d}d}g}	|	j	}
|d7}t
}t|j�t
d�}xf|D]^\}
}||
|||�\}}}|||||�\}}}|
d||f�|�o
|�o
|}|�s|r�d}q�W||=d	d
j|	�||fSt|t��rP|tjk�sht|t��rd|tjk�rdt|t��r�|�s~dSd}n"t|�dk�r�d
}n|�s�dSd}t|�}|�r�||k�r�|dd||kfS||k�r�t|�ddfSd||<d}d}g}	|	j	}
|d7}x>|D]6}t
||||�\}}}|
|�|�s:d}|�rd}�qW||=|d
j|	�||fSt|�}||�o~|jd�dfS)NTFr?�{}z{...}r	)rLz%s: %sz{%s}z, �[]z[%s]z(%s,)�()z(%s)z...�<)r�TF)r�TF)r�TF)r�_builtin_scalarsrS�getattr�
issubclassrAr?rr8rdrrNrOr$�joinrUr�r<�
startswith)rrDr�rEr_�rrFr6r7Z
componentsrdrrO�k�vZkreprZ	kreadableZkrecurZvreprZ	vreadableZvrecurr4�oZoreprZ	oreadableZorecurrGrrrr�s|



rcCsdt|�jt|�fS)Nz<Recursion on %s with id=%s>)rrr)rrrrr81sr8cCs�ddl}|dkr,dd
ddgddd	�fgd
}t�}|j�}t|idd�|j�}|j|�|j�}td||�td||�dS)Nr�stringr	r�rq��)��i��z_safe_repr:zpformat:)r	r)�timerrr�print)rr�rIZt1Zt2Zt3rrr�
_perfcheck6s
r�ccs�d}t|�dd}xhtdt|�d�D]T}|||d�}||}||krR||8}tt|��|krv|rpt|�V|}q&|}q&W|r�t|�VdS)N�rqr)r<�rangerS)rrrCrlr}rirnrorrrrrCs
rr�__main__)Nr	r
N)r	r
N)N)"�collectionsr�re�sysr+�typesr��iorr2�__all__rrrrrrr$rrr�rrvr�r%�float�complexr-rr�r8r�rrrrrrr�<module>%s4
D

_sysconfigdata_m_linux_x86_64-linux-gnu.cpython-36.opt-2.pyc000064400000056616150335715140017646 0ustar003

�]dh�v��@sdddddddddddd	d
dddd
dddddddddddddddddddddddd dd!d"d#d$d%dddd&d'd
d(d)d*d&d+dd!dddd,d-ddddddd.d&d&d&d&dd&dd&d&d&d&d&dddddddddd&dd&d&d&d&d&d&d&d&dd&d&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&ddd&d&dd&dddd&d&d&ddd&d&dddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&d&d&d&d&d&ddd&d&dd&d&ddd&d&d&d&d&d&d&dddddd&dd&d&ddddddd&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd/ddd0d1d0d0d2d3d4d
d5d6dd7dd
d8ddd9dd:d;dd<d=d>d
d
d?d@dAdBdd+ddCdDdddEddddddd&dFdGdHddIdJd
dKdLd&dMd
dNdddddddd
dOdPdQd
dRdSdd
ddTd&dUddddVddddWdXd
d
ddYd&dZd[dd\d6d]d^dd&dd&dd_d`dadbdcd9ddddd?dedddfdgdhdgdfdhdfdfdgdfd^dfdfdfdfdgd&didjdkd&dldmddnd:d&d&dddddoddpdqdrdd&dd
ddsd&d&dtdudd&d&d&dddd&d&d&ddvdwdudxdydydudz���Zd{S)|�m��ar�rcsz!-Wno-unused-result -Wsign-comparez-IObjects -IInclude -IPython�z/usr/binz/usr/lib64/python3.6z-L. -lpython3.6mzOgcc -pthread -shared -Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g�pythonzx86_64-redhat-linux-gnu�\zgcc -pthreadz-fPICa-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz?configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.ina-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapva=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-typez-Wl,-z,relro  -Wl,-z,now  -gz�-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -ga�'--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-ipv6' '--enable-shared' '--with-computed-gotos=yes' '--with-dbmliborder=gdbm:ndbm:bdb' '--with-system-expat' '--with-system-ffi' '--enable-loadable-sqlite-extensions' '--with-dtrace' '--with-lto' '--with-ssl-default-suites=openssl' '--with-valgrind' '--without-ensurepip' '--enable-optimizations' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS= -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv ' 'LDFLAGS= -Wl,-z,relro  -Wl,-z,now  -g ' 'CPPFLAGS=' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'z/usr/includez/usr/include/python3.6m�:z@/builddir/build/BUILD/Python-3.6.8/build/optimized/coverage.infoz>/builddir/build/BUILD/Python-3.6.8/build/optimized/lcov-reportz2--no-branch-coverage --title "CPython lcov report"zM-IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.6.8/Includezg++ -pthreadzE/usr /usr/lib64 /usr/lib64/python3.6 /usr/lib64/python3.6/lib-dynloadz /usr/lib64/python3.6/lib-dynloadi�zkREADME ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Ext-dummyzInclude Lib Misc Ext-dummyzPREADME ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in�.�z/usr/bin/dtracezInclude/pydtrace_probes.hzPython/pydtrace.ozdynload_shlib.o�noz .cpython-36m-x86_64-linux-gnu.soi��yeszI/usr/include /usr/include /usr/include/python3.6m /usr/include/python3.6mz/usr/bin/install -cz/usr/bin/install -c -m 644z/usr/bin/install -c -m 555zlibpython3.6m.so.1.0zModules/_io/_iomodule.hzg++ -pthread -sharedz:-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -gzlibpython3.6m.soz3.6mz
/usr/lib64z-lmzPython/z/usr/lib64/pkgconfigz1/usr/lib64/python3.6/config-3.6m-x86_64-linux-gnuzlibpython3.6m.az-lpthread -ldl  -lutilz0tkinter tkinter/test tkinter/test/test_tkinter \�gccz-Xlinker -export-dynamic�true�ln�linuxz4/builddir/build/BUILD/Python-3.6.8/Modules/makesetupz/usr/share/manz/usr/bin/mkdir -pz�_thread posix errno pwd _sre _codecs _weakref _functools _operator _collections itertools atexit _signal _stat time _locale _io zipimport faulthandler _tracemalloc _symtable xxsubtypea{Modules/_threadmodule.o  Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/zipimport.o  Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  Modules/symtablemodule.o  Modules/xxsubtype.ozx86_64-linux-gnuz -DMULTIARCH=\"x86_64-linux-gnu\"z-Wl,--no-as-neededa:-DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz:\ Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.ozParser/pgenz\ \z-fprofile-generatez"-fprofile-use -fprofile-correctionz
-m test --pgoz
libpython3.sozno-frameworkz./python -Ez	python3.6a�-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -O3 -fprofile-use -fprofile-correctiona�-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -O3 -fprofile-use -fprofile-correction -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.6.8/Include -fPIC -DPy_BUILD_COREaT-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g -lcryptoz"z"a-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g�z)-x test_subprocess test_io test_lib2to3 \�readelfzMac/Resources/framework�voidzBLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/optimizedz/bin/shz.so���zcpython-36m-x86_64-linux-gnuz&Parser Objects Python Modules Programsz9/builddir/build/BUILD/Python-3.6.8/Tools/gdb/libpython.pyz"/* Don't use ncurses extensions */z-szInclude Lib MisczKLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/optimized ./pythonz�LD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/optimized ./python /builddir/build/BUILD/Python-3.6.8/Tools/scripts/run_tests.pyi�zPython/thread.ozIpython3.6 /builddir/build/BUILD/Python-3.6.8/Tools/scripts/update_file.pyz3.6z"/builddir/build/BUILD/Python-3.6.8z)xml xml/dom xml/etree xml/parsers xml/saxz2/builddir/build/BUILD/Python-3.6.8/build/optimizedz
/usr/sharez/usr(��ABIFLAGS�AC_APPLE_UNIVERSAL_BUILD�AIX_GENUINE_CPLUSPLUS�ANDROID_API_LEVEL�AR�ARFLAGS�
BASECFLAGS�BASECPPFLAGS�BASEMODLIBS�BINDIR�
BINLIBDEST�
BLDLIBRARY�	BLDSHARED�BUILDEXE�BUILDPYTHON�BUILD_GNU_TYPE�BYTESTR_DEPS�CC�CCSHARED�CFLAGS�CFLAGSFORSHARED�CFLAGS_ALIASING�CONFIGFILES�CONFIGURE_CFLAGS�CONFIGURE_CFLAGS_NODIST�CONFIGURE_CPPFLAGS�CONFIGURE_LDFLAGS�CONFIGURE_LDFLAGS_NODIST�CONFIG_ARGS�CONFINCLUDEDIR�
CONFINCLUDEPY�COREPYTHONPATH�
COVERAGE_INFO�COVERAGE_REPORT�COVERAGE_REPORT_OPTIONS�CPPFLAGS�CXX�DESTDIRS�DESTLIB�DESTPATH�
DESTSHARED�DFLAGS�DIRMODE�DIST�DISTDIRS�	DISTFILES�	DLINCLDIR�
DLLLIBRARY�"DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754�DOUBLE_IS_BIG_ENDIAN_IEEE754�DOUBLE_IS_LITTLE_ENDIAN_IEEE754�DTRACE�DTRACE_DEPS�DTRACE_HEADERS�DTRACE_OBJS�DYNLOADFILE�ENABLE_IPV6�	ENSUREPIP�EXE�EXEMODE�EXTRAMACHDEPPATH�
EXTRATESTOPTS�EXTRA_CFLAGS�
EXT_SUFFIX�FILEMODE�FLOCK_NEEDS_LIBBSD�GETPGRP_HAVE_ARG�GETTIMEOFDAY_NO_TZ�	GITBRANCH�GITTAG�
GITVERSION�GNULD�HAVE_ACCEPT4�
HAVE_ACOSH�
HAVE_ADDRINFO�
HAVE_ALARM�HAVE_ALIGNED_REQUIRED�
HAVE_ALLOCA_H�HAVE_ALTZONE�
HAVE_ASINH�HAVE_ASM_TYPES_H�
HAVE_ATANH�HAVE_BIND_TEXTDOMAIN_CODESET�HAVE_BLUETOOTH_BLUETOOTH_H�HAVE_BLUETOOTH_H�HAVE_BROKEN_MBSTOWCS�HAVE_BROKEN_NICE�HAVE_BROKEN_PIPE_BUF�HAVE_BROKEN_POLL�HAVE_BROKEN_POSIX_SEMAPHORES�HAVE_BROKEN_PTHREAD_SIGMASK�HAVE_BROKEN_SEM_GETVALUE�HAVE_BROKEN_UNSETENV�HAVE_BUILTIN_ATOMIC�HAVE_CHFLAGS�
HAVE_CHOWN�HAVE_CHROOT�
HAVE_CLOCK�HAVE_CLOCK_GETRES�HAVE_CLOCK_GETTIME�HAVE_CLOCK_SETTIME�HAVE_COMPUTED_GOTOS�HAVE_CONFSTR�HAVE_CONIO_H�
HAVE_COPYSIGN�HAVE_CRYPT_H�HAVE_CTERMID�HAVE_CTERMID_R�HAVE_CURSES_FILTER�
HAVE_CURSES_H�HAVE_CURSES_HAS_KEY�HAVE_CURSES_IMMEDOK�HAVE_CURSES_IS_PAD�HAVE_CURSES_IS_TERM_RESIZED�HAVE_CURSES_RESIZETERM�HAVE_CURSES_RESIZE_TERM�HAVE_CURSES_SYNCOK�HAVE_CURSES_TYPEAHEAD�HAVE_CURSES_USE_ENV�HAVE_CURSES_WCHGAT�HAVE_DECL_ISFINITE�HAVE_DECL_ISINF�HAVE_DECL_ISNAN�HAVE_DECL_RTLD_DEEPBIND�HAVE_DECL_RTLD_GLOBAL�HAVE_DECL_RTLD_LAZY�HAVE_DECL_RTLD_LOCAL�HAVE_DECL_RTLD_NODELETE�HAVE_DECL_RTLD_NOLOAD�HAVE_DECL_RTLD_NOW�HAVE_DECL_TZNAME�HAVE_DEVICE_MACROS�HAVE_DEV_PTC�
HAVE_DEV_PTMX�
HAVE_DIRECT_H�HAVE_DIRENT_D_TYPE�
HAVE_DIRENT_H�
HAVE_DIRFD�HAVE_DLFCN_H�HAVE_DLOPEN�	HAVE_DUP2�	HAVE_DUP3�HAVE_DYNAMIC_LOADING�
HAVE_ENDIAN_H�
HAVE_EPOLL�HAVE_EPOLL_CREATE1�HAVE_ERF�	HAVE_ERFC�HAVE_ERRNO_H�
HAVE_EXECV�
HAVE_EXPM1�HAVE_FACCESSAT�HAVE_FCHDIR�HAVE_FCHMOD�
HAVE_FCHMODAT�HAVE_FCHOWN�
HAVE_FCHOWNAT�HAVE_FCNTL_H�HAVE_FDATASYNC�HAVE_FDOPENDIR�HAVE_FEXECVE�HAVE_FINITE�
HAVE_FLOCK�	HAVE_FORK�HAVE_FORKPTY�HAVE_FPATHCONF�HAVE_FSEEK64�HAVE_FSEEKO�HAVE_FSTATAT�
HAVE_FSTATVFS�
HAVE_FSYNC�HAVE_FTELL64�HAVE_FTELLO�
HAVE_FTIME�HAVE_FTRUNCATE�
HAVE_FUTIMENS�HAVE_FUTIMES�HAVE_FUTIMESAT�HAVE_GAI_STRERROR�
HAVE_GAMMA�HAVE_GCC_ASM_FOR_MC68881�HAVE_GCC_ASM_FOR_X64�HAVE_GCC_ASM_FOR_X87�HAVE_GCC_UINT128_T�HAVE_GETADDRINFO�HAVE_GETC_UNLOCKED�HAVE_GETENTROPY�HAVE_GETGROUPLIST�HAVE_GETGROUPS�HAVE_GETHOSTBYNAME�HAVE_GETHOSTBYNAME_R�HAVE_GETHOSTBYNAME_R_3_ARG�HAVE_GETHOSTBYNAME_R_5_ARG�HAVE_GETHOSTBYNAME_R_6_ARG�HAVE_GETITIMER�HAVE_GETLOADAVG�
HAVE_GETLOGIN�HAVE_GETNAMEINFO�HAVE_GETPAGESIZE�HAVE_GETPEERNAME�HAVE_GETPGID�HAVE_GETPGRP�HAVE_GETPID�HAVE_GETPRIORITY�
HAVE_GETPWENT�HAVE_GETRANDOM�HAVE_GETRANDOM_SYSCALL�HAVE_GETRESGID�HAVE_GETRESUID�HAVE_GETSID�
HAVE_GETSPENT�
HAVE_GETSPNAM�HAVE_GETTIMEOFDAY�
HAVE_GETWD�HAVE_GLIBC_MEMMOVE_BUG�
HAVE_GRP_H�HAVE_HSTRERROR�HAVE_HTOLE64�
HAVE_HYPOT�
HAVE_IEEEFP_H�HAVE_IF_NAMEINDEX�HAVE_INET_ATON�HAVE_INET_PTON�HAVE_INITGROUPS�HAVE_INTTYPES_H�	HAVE_IO_H�HAVE_IPA_PURE_CONST_BUG�	HAVE_KILL�HAVE_KILLPG�HAVE_KQUEUE�HAVE_LANGINFO_H�HAVE_LARGEFILE_SUPPORT�
HAVE_LCHFLAGS�HAVE_LCHMOD�HAVE_LCHOWN�HAVE_LGAMMA�
HAVE_LIBDL�HAVE_LIBDLD�HAVE_LIBIEEE�HAVE_LIBINTL_H�HAVE_LIBREADLINE�HAVE_LIBRESOLV�HAVE_LIBSENDFILE�HAVE_LIBUTIL_H�	HAVE_LINK�HAVE_LINKAT�HAVE_LINUX_CAN_BCM_H�HAVE_LINUX_CAN_H�HAVE_LINUX_CAN_RAW_FD_FRAMES�HAVE_LINUX_CAN_RAW_H�HAVE_LINUX_NETLINK_H�HAVE_LINUX_RANDOM_H�HAVE_LINUX_TIPC_H�
HAVE_LOCKF�
HAVE_LOG1P�	HAVE_LOG2�HAVE_LONG_DOUBLE�
HAVE_LSTAT�HAVE_LUTIMES�HAVE_MAKEDEV�HAVE_MBRTOWC�HAVE_MEMMOVE�
HAVE_MEMORY_H�HAVE_MEMRCHR�HAVE_MKDIRAT�HAVE_MKFIFO�
HAVE_MKFIFOAT�
HAVE_MKNOD�HAVE_MKNODAT�HAVE_MKTIME�	HAVE_MMAP�HAVE_MREMAP�HAVE_NCURSES_H�HAVE_NDIR_H�HAVE_NETPACKET_PACKET_H�
HAVE_NET_IF_H�	HAVE_NICE�HAVE_OPENAT�HAVE_OPENPTY�
HAVE_PATHCONF�
HAVE_PAUSE�
HAVE_PIPE2�
HAVE_PLOCK�	HAVE_POLL�HAVE_POLL_H�HAVE_POSIX_FADVISE�HAVE_POSIX_FALLOCATE�
HAVE_PREAD�HAVE_PRLIMIT�HAVE_PROCESS_H�HAVE_PROTOTYPES�HAVE_PTHREAD_ATFORK�HAVE_PTHREAD_CONDATTR_SETCLOCK�HAVE_PTHREAD_DESTRUCTOR�HAVE_PTHREAD_H�HAVE_PTHREAD_INIT�HAVE_PTHREAD_KILL�HAVE_PTHREAD_SIGMASK�
HAVE_PTY_H�HAVE_PUTENV�HAVE_PWRITE�
HAVE_READLINK�HAVE_READLINKAT�
HAVE_READV�
HAVE_REALPATH�
HAVE_RENAMEAT�HAVE_RL_APPEND_HISTORY�HAVE_RL_CALLBACK�HAVE_RL_CATCH_SIGNAL�#HAVE_RL_COMPLETION_APPEND_CHARACTER�'HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK�HAVE_RL_COMPLETION_MATCHES�"HAVE_RL_COMPLETION_SUPPRESS_APPEND�HAVE_RL_PRE_INPUT_HOOK�HAVE_RL_RESIZE_TERMINAL�
HAVE_ROUND�HAVE_SCHED_GET_PRIORITY_MAX�HAVE_SCHED_H�HAVE_SCHED_RR_GET_INTERVAL�HAVE_SCHED_SETAFFINITY�HAVE_SCHED_SETPARAM�HAVE_SCHED_SETSCHEDULER�HAVE_SELECT�HAVE_SEM_GETVALUE�
HAVE_SEM_OPEN�HAVE_SEM_TIMEDWAIT�HAVE_SEM_UNLINK�
HAVE_SENDFILE�HAVE_SETEGID�HAVE_SETEUID�HAVE_SETGID�HAVE_SETGROUPS�HAVE_SETHOSTNAME�HAVE_SETITIMER�HAVE_SETLOCALE�HAVE_SETPGID�HAVE_SETPGRP�HAVE_SETPRIORITY�
HAVE_SETREGID�HAVE_SETRESGID�HAVE_SETRESUID�
HAVE_SETREUID�HAVE_SETSID�HAVE_SETUID�HAVE_SETVBUF�
HAVE_SHADOW_H�HAVE_SIGACTION�HAVE_SIGALTSTACK�HAVE_SIGINTERRUPT�
HAVE_SIGNAL_H�HAVE_SIGPENDING�
HAVE_SIGRELSE�HAVE_SIGTIMEDWAIT�HAVE_SIGWAIT�HAVE_SIGWAITINFO�
HAVE_SNPRINTF�HAVE_SOCKADDR_ALG�HAVE_SOCKADDR_SA_LEN�HAVE_SOCKADDR_STORAGE�HAVE_SOCKETPAIR�HAVE_SPAWN_H�HAVE_SSIZE_T�HAVE_STATVFS�HAVE_STAT_TV_NSEC�HAVE_STAT_TV_NSEC2�HAVE_STDARG_PROTOTYPES�
HAVE_STDINT_H�
HAVE_STDLIB_H�HAVE_STD_ATOMIC�HAVE_STRDUP�
HAVE_STRFTIME�HAVE_STRINGS_H�
HAVE_STRING_H�HAVE_STRLCPY�HAVE_STROPTS_H�HAVE_STRUCT_PASSWD_PW_GECOS�HAVE_STRUCT_PASSWD_PW_PASSWD�HAVE_STRUCT_STAT_ST_BIRTHTIME�HAVE_STRUCT_STAT_ST_BLKSIZE�HAVE_STRUCT_STAT_ST_BLOCKS�HAVE_STRUCT_STAT_ST_FLAGS�HAVE_STRUCT_STAT_ST_GEN�HAVE_STRUCT_STAT_ST_RDEV�HAVE_STRUCT_TM_TM_ZONE�HAVE_SYMLINK�HAVE_SYMLINKAT�	HAVE_SYNC�HAVE_SYSCONF�HAVE_SYSEXITS_H�HAVE_SYS_AUDIOIO_H�HAVE_SYS_BSDTTY_H�HAVE_SYS_DEVPOLL_H�HAVE_SYS_DIR_H�HAVE_SYS_ENDIAN_H�HAVE_SYS_EPOLL_H�HAVE_SYS_EVENT_H�HAVE_SYS_FILE_H�HAVE_SYS_IOCTL_H�HAVE_SYS_KERN_CONTROL_H�HAVE_SYS_LOADAVG_H�HAVE_SYS_LOCK_H�HAVE_SYS_MKDEV_H�HAVE_SYS_MODEM_H�HAVE_SYS_NDIR_H�HAVE_SYS_PARAM_H�HAVE_SYS_POLL_H�HAVE_SYS_RANDOM_H�HAVE_SYS_RESOURCE_H�HAVE_SYS_SELECT_H�HAVE_SYS_SENDFILE_H�HAVE_SYS_SOCKET_H�HAVE_SYS_STATVFS_H�HAVE_SYS_STAT_H�HAVE_SYS_SYSCALL_H�HAVE_SYS_SYSMACROS_H�HAVE_SYS_SYS_DOMAIN_H�HAVE_SYS_TERMIO_H�HAVE_SYS_TIMES_H�HAVE_SYS_TIME_H�HAVE_SYS_TYPES_H�HAVE_SYS_UIO_H�
HAVE_SYS_UN_H�HAVE_SYS_UTSNAME_H�HAVE_SYS_WAIT_H�HAVE_SYS_XATTR_H�HAVE_TCGETPGRP�HAVE_TCSETPGRP�HAVE_TEMPNAM�HAVE_TERMIOS_H�HAVE_TERM_H�HAVE_TGAMMA�HAVE_TIMEGM�
HAVE_TIMES�HAVE_TMPFILE�HAVE_TMPNAM�
HAVE_TMPNAM_R�HAVE_TM_ZONE�
HAVE_TRUNCATE�HAVE_TZNAME�
HAVE_UCS4_TCL�
HAVE_UNAME�
HAVE_UNISTD_H�
HAVE_UNLINKAT�
HAVE_UNSETENV�HAVE_USABLE_WCHAR_T�HAVE_UTIL_H�HAVE_UTIMENSAT�HAVE_UTIMES�HAVE_UTIME_H�
HAVE_WAIT3�
HAVE_WAIT4�HAVE_WAITID�HAVE_WAITPID�HAVE_WCHAR_H�HAVE_WCSCOLL�
HAVE_WCSFTIME�HAVE_WCSXFRM�HAVE_WMEMCMP�HAVE_WORKING_TZSET�HAVE_WRITEV�HAVE_ZLIB_COPY�HAVE__GETPTY�
HOST_GNU_TYPE�INCLDIRSTOMAKE�
INCLUDEDIR�	INCLUDEPY�INSTALL�INSTALL_DATA�INSTALL_PROGRAM�INSTALL_SCRIPT�INSTALL_SHARED�
INSTSONAME�IO_H�IO_OBJS�LDCXXSHARED�LDFLAGS�LDLAST�	LDLIBRARY�LDLIBRARYDIR�LDSHARED�	LDVERSION�LIBC�LIBDEST�LIBDIR�LIBFFI_INCLUDEDIR�LIBM�	LIBOBJDIR�LIBOBJS�LIBPC�LIBPL�LIBRARY�LIBRARY_OBJS�LIBRARY_OBJS_OMIT_FROZEN�LIBS�
LIBSUBDIRS�LINKCC�
LINKFORSHARED�LIPO_32BIT_FLAGS�
LLVM_PROF_ERR�LLVM_PROF_FILE�LLVM_PROF_MERGER�LN�LOCALMODLIBS�LOG1P_DROPS_ZERO_SIGN�MACHDEP�MACHDEPPATH�MACHDEP_OBJS�MACHDESTLIB�MACOSX_DEPLOYMENT_TARGET�MAINCC�MAJOR_IN_MKDEV�MAJOR_IN_SYSMACROS�	MAKESETUP�MANDIR�MKDIR_P�MODLIBS�MODNAMES�MODOBJS�MODULE_OBJS�	MULTIARCH�MULTIARCH_CPPFLAGS�MVWDELCH_IS_EXPRESSION�NO_AS_NEEDED�OBJECT_OBJS�OPT�OTHER_LIBTOOL_OPT�PACKAGE_BUGREPORT�PACKAGE_NAME�PACKAGE_STRING�PACKAGE_TARNAME�PACKAGE_URL�PACKAGE_VERSION�PARSER_HEADERS�PARSER_OBJS�PGEN�PGENOBJS�PGOBJS�PGO_PROF_GEN_FLAG�PGO_PROF_USE_FLAG�PLATDIR�POBJS�POSIX_SEMAPHORES_NOT_ENABLED�PROFILE_TASK�PTHREAD_SYSTEM_SCHED_SUPPORTED�
PY3LIBRARY�PYLONG_BITS_IN_DIGIT�PYTHON�PYTHONFRAMEWORK�PYTHONFRAMEWORKDIR�PYTHONFRAMEWORKINSTALLDIR�PYTHONFRAMEWORKPREFIX�
PYTHONPATH�PYTHON_FOR_BUILD�PYTHON_FOR_REGEN�PYTHON_HEADERS�PYTHON_OBJS�	PY_CFLAGS�PY_CFLAGS_NODIST�PY_COERCE_C_LOCALE�PY_CORE_CFLAGS�PY_CORE_LDFLAGS�PY_CPPFLAGS�PY_FORMAT_SIZE_T�
PY_LDFLAGS�PY_LDFLAGS_NODIST�PY_SSL_DEFAULT_CIPHERS�PY_SSL_DEFAULT_CIPHER_STRING�PY_WARN_ON_C_LOCALE�Py_DEBUG�Py_ENABLE_SHARED�Py_HASH_ALGORITHM�
QUICKTESTOPTS�READELF�	RESSRCDIR�
RETSIGTYPE�	RUNSHARED�	SCRIPTDIR�SETPGRP_HAVE_ARG�SGI_ABI�SHELL�SHLIBS�SHLIB_SUFFIX�SIGNED_RIGHT_SHIFT_ZERO_FILLS�SITEPATH�
SIZEOF_DOUBLE�SIZEOF_FLOAT�
SIZEOF_FPOS_T�
SIZEOF_INT�SIZEOF_LONG�SIZEOF_LONG_DOUBLE�SIZEOF_LONG_LONG�SIZEOF_OFF_T�SIZEOF_PID_T�SIZEOF_PTHREAD_T�SIZEOF_SHORT�
SIZEOF_SIZE_T�
SIZEOF_TIME_T�SIZEOF_UINTPTR_T�
SIZEOF_VOID_P�SIZEOF_WCHAR_T�SIZEOF__BOOL�SOABI�SRCDIRS�
SRC_GDB_HOOKS�STDC_HEADERS�STRICT_SYSV_CURSES�	STRIPFLAG�SUBDIRS�
SUBDIRSTOO�SYSLIBS�SYS_SELECT_WITH_SYS_TIME�TANH_PRESERVES_ZERO_SIGN�TCLTK_INCLUDES�
TCLTK_LIBS�TESTOPTS�TESTPATH�
TESTPYTHON�TESTPYTHONOPTS�
TESTRUNNER�TESTTIMEOUT�	THREADOBJ�TIMEMODULE_LIB�TIME_WITH_SYS_TIME�TM_IN_SYS_TIME�UNICODE_DEPS�UNIVERSALSDK�UPDATE_FILE�USE_COMPUTED_GOTOS�
USE_INLINE�VERSION�VPATH�WANT_SIGFPE_HANDLER�WINDOW_HAS_FLAGS�WITH_DOC_STRINGS�WITH_DTRACE�	WITH_DYLD�WITH_LIBINTL�WITH_NEXT_FRAMEWORK�
WITH_PYMALLOC�WITH_THREAD�
WITH_VALGRIND�X87_DOUBLE_ROUNDING�
XMLLIBSUBDIRS�abs_builddir�
abs_srcdir�datarootdir�exec_prefix�prefix�srcdirN)�build_time_vars�r�r��?/usr/lib64/python3.6/_sysconfigdata_m_linux_x86_64-linux-gnu.py�<module>s*colorsys.cpython-36.pyc000064400000006361150335715140011061 0ustar003


 \��@s\dZddddddgZdZdZdZdd�Zdd�Zd
d�Zdd�Zdd�Z	dd�Z
dd�ZdS)aJConversion functions between RGB and other color systems.

This modules provides two functions for each color system ABC:

  rgb_to_abc(r, g, b) --> a, b, c
  abc_to_rgb(a, b, c) --> r, g, b

All inputs and outputs are triples of floats in the range [0.0...1.0]
(with the exception of I and Q, which covers a slightly larger range).
Inputs outside the valid range may cause exceptions or invalid outputs.

Supported color systems:
RGB: Red, Green, Blue components
YIQ: Luminance, Chrominance (used by composite video signals)
HLS: Hue, Luminance, Saturation
HSV: Hue, Saturation, Value
�
rgb_to_yiq�
yiq_to_rgb�
rgb_to_hls�
hls_to_rgb�
rgb_to_hsv�
hsv_to_rgbg�?g@g@g@cCsRd|d|d|}d||d||}d||d||}|||fS)Ng333333�?g�z�G��?g)\��(�?g�G�z��?gH�z�G�?g���Q��?g=
ףp=�?�)�r�g�b�y�i�qrr� /usr/lib64/python3.6/colorsys.pyr(scCs�|d|d|}|d|d|}|d|d|}|dkrHd}|dkrTd}|dkr`d}|dkrld}|dkrxd}|dkr�d}|||fS)	Ng2r��L�?g����,��?g:�����?g�nєW�?g6�޷���?gJ"�X�?gg�?r)rrr
rr	r
rrrr.s cCs�t|||�}t|||�}||d}||kr6d|dfS|dkrP||||}n||d||}||||}||||}||||}	||kr�|	|}
n"||kr�d||	}
nd||}
|
dd}
|
||fS)Ng@gg�?g@g@g�?)�max�min)rr	r
�maxc�minc�l�s�rc�gc�bc�hrrrrKs$

cCsn|dkr|||fS|dkr(|d|}n||||}d||}t|||t�t|||�t|||t�fS)Ngg�?g�?g@)�_v�	ONE_THIRD)rrr�m2�m1rrrrbs
cCsT|d}|tkr$||||dS|dkr0|S|tkrP|||t|dS|S)Ng�?g@g�?)�	ONE_SIXTH�	TWO_THIRD)rrZhuerrrrlsrcCs�t|||�}t|||�}|}||kr.dd|fS|||}||||}||||}||||}	||kr||	|}
n"||kr�d||	}
nd||}
|
dd}
|
||fS)Ngg@g@g@g�?)rr)rr	r
rr�vrrrrrrrrr|s 

cCs�|dkr|||fSt|d�}|d|}|d|}|d||}|d|d|}|d}|dkrt|||fS|dkr�|||fS|dkr�|||fS|dkr�|||fS|d	kr�|||fS|d
kr�|||fSdS)Ngg@g�?�������)�int)rrrr�f�pr
�trrrr�s(





NgUUUUUU�?gUUUUUU�?gUUUUUU�?)�__doc__�__all__rrrrrrrrrrrrrr�<module>s	
textwrap.cpython-36.opt-2.pyc000064400000014253150335715140012021 0ustar003


 \fL�@s�ddlZddddddgZdZGd	d�d�Zddd�Zddd�Zd
d�Zejdej�Z	ejdej�Z
dd�Zddd�Ze
dkr�eed��dS)�N�TextWrapper�wrap�fill�dedent�indent�shortenz	

 c
@s�eZdZiZed�ZxeD]Zeeee�<qWdZdZ	de
je�Zdedd�Z
e
jdee	ee
d	�e
j�Z[[	[
e
jd
e�Z[e
jd�Zd%ddd�dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�ZdS)&r� z[\w!"\'&.,?]z[^\d\W]z[%s]z[^�Na�
        ( # any whitespace
          %(ws)s+
        | # em-dash between words
          (?<=%(wp)s) -{2,} (?=\w)
        | # word, possibly hyphenated
          %(nws)s+? (?:
            # hyphenated word
              -(?: (?<=%(lt)s{2}-) | (?<=%(lt)s-%(lt)s-))
              (?= %(lt)s -? %(lt)s)
            | # end of word
              (?=%(ws)s|\Z)
            | # em-dash
              (?<=%(wp)s) (?=-{2,}\w)
            )
        ))Zwp�ltZwsZnwsz(%s+)z[a-z][\.\!\?][\"\']?\Z�F�TF�z [...])�	max_lines�placeholderc
CsL||_||_||_||_||_||_||_||_|	|_|
|_	||_
||_dS)N)�width�initial_indent�subsequent_indent�expand_tabs�replace_whitespace�fix_sentence_endings�break_long_words�drop_whitespace�break_on_hyphens�tabsizerr)
�selfrrrrrrrrrrrr�r� /usr/lib64/python3.6/textwrap.py�__init__sszTextWrapper.__init__cCs(|jr|j|j�}|jr$|j|j�}|S)N)r�
expandtabsrr�	translate�unicode_whitespace_trans)r�textrrr�_munge_whitespace�s
zTextWrapper._munge_whitespacecCs6|jdkr|jj|�}n|jj|�}dd�|D�}|S)NTcSsg|]}|r|�qSrr)�.0�crrr�
<listcomp>�sz&TextWrapper._split.<locals>.<listcomp>)r�
wordsep_re�split�wordsep_simple_re)rr!�chunksrrr�_split�s

zTextWrapper._splitcCs`d}|jj}xN|t|�dkrZ||ddkrP|||�rPd||d<|d7}q|d7}qWdS)Nrr	rz  �)�sentence_end_re�search�len)rr)�iZ	patsearchrrr�_fix_sentence_endings�s	
z!TextWrapper._fix_sentence_endingscCs^|dkrd}n||}|jrH|j|dd|��|d|d�|d<n|sZ|j|j��dS)Nr	���r1r1)r�append�pop)rZreversed_chunks�cur_line�cur_lenrZ
space_leftrrr�_handle_long_word�s
zTextWrapper._handle_long_wordc	Cs�g}|jdkrtd|j��|jdk	rb|jdkr8|j}n|j}t|�t|jj��|jkrbtd��|j��x&|�r�g}d}|r�|j}n|j}|jt|�}|j	r�|dj
�dkr�|r�|d=x:|r�t|d�}|||kr�|j|j��||7}q�Pq�W|�r.t|d	�|k�r.|j
||||�ttt|��}|j	�rd|�rd|d
j
�dk�rd|t|d�8}|d=|rn|jdk�s�t|�d|jk�s�|�s�|j	�r�t|�dk�r�|dj
��r�||k�r�|j|dj|��qnx�|�r<|d
j
��r"|t|j�|k�r"|j|j�|j|dj|��P|t|d�8}|d=�q�W|�rz|dj�}t|�t|j�|jk�rz||j|d<P|j||jj��PqnW|S)Nrzinvalid width %r (must be > 0)r	z#placeholder too large for max widthrr1r1r1r1r1r1r1r1r1r1r1r1)r�
ValueErrorrrrr.r�lstrip�reverser�stripr2r3r6�sum�map�join�rstrip)	rr)�linesrr4r5r�lZ	prev_linerrr�_wrap_chunks�sp





 
zTextWrapper._wrap_chunkscCs|j|�}|j|�S)N)r"r*)rr!rrr�
_split_chunksPs
zTextWrapper._split_chunkscCs$|j|�}|jr|j|�|j|�S)N)rBrr0rA)rr!r)rrrrVs	

zTextWrapper.wrapcCsdj|j|��S)N�
)r=r)rr!rrrrdszTextWrapper.fill)
rrrTTFTTTr
)�__name__�
__module__�__qualname__r �ordZuspace�_whitespace�xZ
word_punctZletter�re�escapeZ
whitespaceZnowhitespace�compile�VERBOSEr&r(r,rr"r*r0r6rArBrrrrrrrsH1


!grcKstfd|i|��}|j|�S)Nr)rr)r!r�kwargs�wrrrrps
cKstfd|i|��}|j|�S)Nr)rr)r!rrNrOrrrr}s	cKs,tf|dd�|��}|jdj|j�j���S)Nr	)rrr)rrr=r:r')r!rrNrOrrrr�sz^[ 	]+$z(^[ 	]*)(?:[^ 	
])cCs�d}tjd|�}tj|�}x||D]t}|dkr2|}q |j|�r>q |j|�rN|}q xDtt||��D]"\}\}}||kr^|d|�}Pq^W|dt|��}q Wdr�|r�x|jd�D]}q�W|r�t	jd|d|�}|S)NrrrCz(?m)^)
�_whitespace_only_re�sub�_leading_whitespace_re�findall�
startswith�	enumerate�zipr.r'rJ)r!Zmargin�indentsrr/rI�y�linerrrr�s*



cs,�dkrdd�����fdd�}dj|��S)NcSs|j�S)N)r:)rYrrr�	predicate�szindent.<locals>.predicatec3s.x(�jd�D]}�|�r �|n|VqWdS)NT)�
splitlines)rY)rZ�prefixr!rr�prefixed_lines�szindent.<locals>.prefixed_linesr)r=)r!r\rZr]r)rZr\r!rr�s�__main__z Hello there.
  This is indented.)r)r)N)rJ�__all__rHrrrrrL�	MULTILINErPrRrrrD�printrrrr�<module>sa

5
shelve.cpython-36.opt-2.pyc000064400000012273150335715140011431 0ustar003


 \C!�@s�ddlmZmZddlmZddlZddddgZGdd	�d	ej�ZGd
d�dej�Z	Gdd�de	�Z
Gdd�de	�Zddd�ZdS)�)�Pickler�	Unpickler)�BytesION�Shelf�
BsdDbShelf�DbfilenameShelf�openc@s4eZdZdd�ZeZZZZZZ	dd�Z
dS)�_ClosedDictcGstd��dS)Nz!invalid operation on closed shelf)�
ValueError)�self�args�r
�/usr/lib64/python3.6/shelve.py�closedEsz_ClosedDict.closedcCsdS)Nz<Closed Dictionary>r
)rr
r
r�__repr__Isz_ClosedDict.__repr__N)�__name__�
__module__�__qualname__r�__iter__�__len__�__getitem__�__setitem__�__delitem__�keysrr
r
r
rr	Bsr	c@sxeZdZddd�Zdd�Zdd	�Zd
d�Zddd
�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS) rNF�utf-8cCs.||_|dkrd}||_||_i|_||_dS)N�)�dict�	_protocol�	writeback�cache�keyencoding)rr�protocolrr r
r
r�__init__TszShelf.__init__ccs&x |jj�D]}|j|j�VqWdS)N)rr�decoder )r�kr
r
rr^szShelf.__iter__cCs
t|j�S)N)�lenr)rr
r
rrbsz
Shelf.__len__cCs|j|j�|jkS)N)�encoder r)r�keyr
r
r�__contains__eszShelf.__contains__cCs|j|j�|jkr||S|S)N)r&r r)rr'�defaultr
r
r�gethsz	Shelf.getcCsZy|j|}WnFtk
rTt|j|j|j��}t|�j�}|jrP||j|<YnX|S)N)	r�KeyErrorrrr&r r�loadr)rr'�value�fr
r
rrmszShelf.__getitem__cCsF|jr||j|<t�}t||j�}|j|�|j�|j|j|j	�<dS)N)
rrrrr�dump�getvaluerr&r )rr'r-r.�pr
r
rrws

zShelf.__setitem__cCs6|j|j|j�=y|j|=Wntk
r0YnXdS)N)rr&r rr+)rr'r
r
rrs
zShelf.__delitem__cCs|S)Nr
)rr
r
r�	__enter__�szShelf.__enter__cCs|j�dS)N)�close)r�typer-�	tracebackr
r
r�__exit__�szShelf.__exit__cCsf|jdkrdSz0|j�y|jj�Wntk
r:YnXWdyt�|_Wnd|_YnXXdS)N)r�syncr3�AttributeErrorr	)rr
r
rr3�s

zShelf.closecCst|d�sdS|j�dS)Nr)�hasattrr3)rr
r
r�__del__�s
z
Shelf.__del__cCsX|jr>|jr>d|_x|jj�D]\}}|||<qWd|_i|_t|jd�rT|jj�dS)NFTr7)rr�itemsr9rr7)rr'�entryr
r
rr7�sz
Shelf.sync)NFr)N)rrrr"rrr(r*rrrr2r6r3r:r7r
r
r
rrMs
	

c@s>eZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�ZdS)rNF�utf-8cCstj|||||�dS)N)rr")rrr!rr r
r
rr"�szBsdDbShelf.__init__cCs0|jj|�\}}t|�}|j|j�t|�j�fS)N)r�set_locationrr#r rr,)rr'r-r.r
r
rr>�szBsdDbShelf.set_locationcCs.t|j�\}}t|�}|j|j�t|�j�fS)N)�nextrrr#r rr,)rr'r-r.r
r
rr?�szBsdDbShelf.nextcCs.|jj�\}}t|�}|j|j�t|�j�fS)N)r�previousrr#r rr,)rr'r-r.r
r
rr@�szBsdDbShelf.previouscCs.|jj�\}}t|�}|j|j�t|�j�fS)N)r�firstrr#r rr,)rr'r-r.r
r
rrA�szBsdDbShelf.firstcCs.|jj�\}}t|�}|j|j�t|�j�fS)N)r�lastrr#r rr,)rr'r-r.r
r
rrB�szBsdDbShelf.last)NFr=)	rrrr"r>r?r@rArBr
r
r
rr�s

c@seZdZddd�ZdS)r�cNFcCs$ddl}tj||j||�||�dS)Nr)�dbmrr"r)r�filename�flagr!rrDr
r
rr"�szDbfilenameShelf.__init__)rCNF)rrrr"r
r
r
rr�srCFcCst||||�S)N)r)rErFr!rr
r
rr�s
)rCNF)
�picklerr�ior�collections�__all__�MutableMappingr	rrrrr
r
r
r�<module>;sb+fnmatch.cpython-36.pyc000064400000005474150335715140010630 0ustar003


 \^�@sjdZddlZddlZddlZddlZddddgZdd�Zejdd	d
�dd��Zd
d�Z	dd�Z
dd�ZdS)a�Filename matching with shell patterns.

fnmatch(FILENAME, PATTERN) matches according to the local convention.
fnmatchcase(FILENAME, PATTERN) always takes case in account.

The functions operate by translating the pattern into a regular
expression.  They cache the compiled regular expressions for speed.

The function translate(PATTERN) returns a regular expression
corresponding to PATTERN.  (It does not compile it.)
�N�filter�fnmatch�fnmatchcase�	translatecCs"tjj|�}tjj|�}t||�S)a�Test whether FILENAME matches PATTERN.

    Patterns are Unix shell style:

    *       matches everything
    ?       matches any single character
    [seq]   matches any character in seq
    [!seq]  matches any char not in seq

    An initial period in FILENAME is not special.
    Both FILENAME and PATTERN are first case-normalized
    if the operating system requires it.
    If you don't want this, use fnmatchcase(FILENAME, PATTERN).
    )�os�path�normcaser)�name�pat�r�/usr/lib64/python3.6/fnmatch.pyrs�T)�maxsize�typedcCs<t|t�r(t|d�}t|�}t|d�}nt|�}tj|�jS)Nz
ISO-8859-1)�
isinstance�bytes�strr�re�compile�match)r
Zpat_strZres_str�resrrr�_compile_pattern&s

rcCspg}tjj|�}t|�}tjtkrDxH|D]}||�r(|j|�q(Wn(x&|D]}|tjj|��rJ|j|�qJW|S)z3Return the subset of the list NAMES that match PAT.)rrrr�	posixpath�append)�namesr
�resultrr	rrrr0s


cCst|�}||�dk	S)z�Test whether FILENAME matches PATTERN, including case.

    This is a version of fnmatch() which doesn't case-normalize
    its arguments.
    N)r)r	r
rrrrr@scCsHdt|�}}d}�x*||k�r>||}|d}|dkrB|d}q|dkrT|d}q|dk�r.|}||kr~||d	kr~|d}||kr�||d
kr�|d}x ||kr�||d
kr�|d}q�W||kr�|d}n^|||�jdd
�}|d}|dd	k�r
d|dd�}n|ddk�r d|}d||f}q|tj|�}qWd|S)zfTranslate a shell PATTERN to a regular expression.

    There is no way to quote meta-characters.
    r���*z.*�?�.�[�!�]z\[�\z\\�^Nz%s[%s]z	(?s:%s)\Z)�len�replacer�escape)r
�i�nr�c�jZstuffrrrrJs8



)�__doc__rrr�	functools�__all__r�	lru_cacherrrrrrrr�<module>s

runpy.cpython-36.opt-1.pyc000064400000017460150335715140011322 0ustar003


 \�.�@sdZddlZddlZddlZddlZddlmZmZddgZ	Gdd�de
�ZGdd	�d	e
�Zd d
d�Z
d!dd
�Zefdd�ZGdd�de�Zd"dd�Zd#dd�Zefdd�Zdd�Zd$dd�Zedk�r�eej�dk�r�edejd�nejd=eejd�dS)%aZrunpy.py - locating and running Python code using the module namespace

Provides support for locating and running Python scripts using the Python
module namespace instead of the native filesystem.

This allows Python code to play nicely with non-filesystem based PEP 302
importers when locating support scripts as well as when importing modules.
�N)�	read_code�get_importer�
run_module�run_pathc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_TempModulezCTemporarily replace a module in sys.modules with an empty namespacecCs||_tj|�|_g|_dS)N)�mod_name�types�
ModuleType�module�
_saved_module)�selfr�r
�/usr/lib64/python3.6/runpy.py�__init__sz_TempModule.__init__cCsB|j}y|jjtj|�Wntk
r0YnX|jtj|<|S)N)rr�append�sys�modules�KeyErrorr
)rrr
r
r�	__enter__sz_TempModule.__enter__cGs.|jr|jdtj|j<n
tj|j=g|_dS)Nr)rrrr)r�argsr
r
r�__exit__'s
z_TempModule.__exit__N)�__name__�
__module__�__qualname__�__doc__rrrr
r
r
rrs	rc@s$eZdZdd�Zdd�Zdd�ZdS)�_ModifiedArgv0cCs||_t�|_|_dS)N)�value�object�_saved_value�	_sentinel)rrr
r
rr/sz_ModifiedArgv0.__init__cCs0|j|jk	rtd��tjd|_|jtjd<dS)NzAlready preserving saved valuer)rr�RuntimeErrorr�argvr)rr
r
rr3sz_ModifiedArgv0.__enter__cGs|j|_|jtjd<dS)Nr)rrrrr!)rrr
r
rr9sz_ModifiedArgv0.__exit__N)rrrrrrr
r
r
rr.src
	Csn|dk	r|j|�|dkr(d}|}d}	n |j}|j}|j}	|dkrH|j}|j|||	d|||d�t||�|S)z)Helper to run code in nominated namespaceN)r�__file__�
__cached__r�
__loader__�__package__�__spec__)�update�loader�origin�cached�parent�exec)
�codeZrun_globals�init_globalsr�mod_spec�pkg_name�script_namer(�fnamer*r
r
r�	_run_code>s(

r3c	Cs^|dkr|n|j}t|��6}t|��"|jj}t|||||||�WdQRXWdQRX|j�S)z5Helper to run code in new namespace with sys modifiedN)r)rrr
�__dict__r3�copy)	r-r.rr/r0r1r2�temp_module�mod_globalsr
r
r�_run_module_codeXs r8c
;Cs4|jd�r|d��|jd�\}}}|r�yt|�WnJtk
r|}z.|jdksj|j|krl|j|jd�rl�WYdd}~XnXtjj|�}|dk	r�t|d�r�ddl	m
}dj||d�}|t|��yt
jj|�}WnJttttfk
�r}	z$d}||j|t|	�j|	��|	�WYdd}	~	XnX|dk�r6|d	|��|jdk	�r�|d
k�sX|jd��r`|d��y|d}
t|
|�S|k
�r�}z$|tjk�r��|d||f��WYdd}~XnX|j}|dk�r�|d|��y|j|�}Wn2tk
�r}z|t|��|�WYdd}~XnX|dk�r*|d|��|||fS)N�.z#Relative module names not supported�__path__r)�warnz�{mod_name!r} found in sys.modules after import of package {pkg_name!r}, but prior to execution of {mod_name!r}; this may result in unpredictable behaviour)rr0z:Error while finding module specification for {!r} ({}: {})zNo module named %s�__main__z	.__main__z%Cannot use package as __main__ modulez%s; %r is a package and cannot zbe directly executedz0%r is a namespace package and cannot be executedzNo code object available for %sz3%s; %r is a package and cannot be directly executed)�
startswith�
rpartition�
__import__�ImportError�namerr�get�hasattr�warningsr;�format�RuntimeWarning�	importlib�util�	find_spec�AttributeError�	TypeError�
ValueError�typer�submodule_search_locations�endswith�_get_module_detailsr(�get_code)
r�errorr0�_�eZexistingr;�msg�specZexZ
pkg_main_namer(r-r
r
rrPfsZ

,

 
 
rPc@seZdZdZdS)�_ErrorzBError that _run_module_as_main() should report without a tracebackN)rrrrr
r
r
rrW�srWTcCs�y0|s|dkr t|t�\}}}ntt�\}}}Wn:tk
rj}zdtj|f}tj|�WYdd}~XnXtjdj}|r�|jtj	d<t
||dd|�S)a�Runs the designated module in the __main__ namespace

       Note that the executed module will have full access to the
       __main__ namespace. If this is not desirable, the run_module()
       function should be used to run the module code in a fresh namespace.

       At the very least, these variables in __main__ will be overwritten:
           __name__
           __file__
           __cached__
           __loader__
           __package__
    r<z%s: %sNr)rPrW�_get_main_module_detailsr�
executable�exitrr4r)r!r3)rZ
alter_argvr/r-�excrUZmain_globalsr
r
r�_run_module_as_main�sr\FcCs@t|�\}}}|dkr|}|r,t||||�St|i|||�SdS)znExecute a module's code without importing it

       Returns the resulting top level namespace dictionary
    N)rPr8r3)rr.�run_nameZ	alter_sysr/r-r
r
rr�scCs~d}tj|}tj|=zVyt|�Stk
rh}z,|t|�krV|d|tjdf�|��WYdd}~XnXWd|tj|<XdS)Nr<zcan't find %r module in %rr)rrrPr@�str�path)rRZ	main_nameZ
saved_mainr[r
r
rrX�s
rXcCsTt|d��}t|�}WdQRX|dkrLt|d��}t|j�|d�}WdQRX||fS)N�rbr,)�openr�compile�read)r]r2�fr-r
r
r�_get_code_from_file�srec Cs|dkrd}|jd�d}t|�}d}t|�jdkrFt|�jdkrFd}t|td��sX|rxt||�\}}t|||||d	�Stj	j
d|�zRt�\}}	}t|��4}
t
|�� |
jj}t|||||	|�j�SQRXWdQRXWdytj	j|�Wntk
�rYnXXdS)
a_Execute code located at the specified filesystem location

       Returns the resulting top level namespace dictionary

       The file path may refer directly to a Python script (i.e.
       one that could be directly executed with execfile) or else
       it may refer to a zipfile or directory containing a top
       level __main__.py script.
    Nz
<run_path>r9rFZimpZNullImporterT)r0r1)r>rrMrr�
isinstancerer8rr_�insertrXrrr
r4r3r5�removerL)Z	path_namer.r]r0ZimporterZis_NullImporterr-r2rr/r6r7r
r
rr�s0



"r<�z!No module specified for execution)�file)NNNNN)NNNNN)T)NNF)NN)rr�importlib.machineryrG�importlib.utilrZpkgutilrr�__all__rrrr3r8r@rP�	ExceptionrWr\rrXrerr�lenr!�print�stderrr
r
r
r�<module>s6

:



1
functools.cpython-36.pyc000064400000057000150335715140011214 0ustar003


 \rz�+@s�dZddddddddd	d
dgZydd
lmZWnek
rBYnXddlmZddlmZddl	m
Z
ddlmZddl
mZyddlmZWn"ek
r�Gdd�d�ZYnXdZZd[Zeefdd�Zeefdd�Zefdd�Zefd d!�Zefd"d#�Zefd$d%�Zefd&d'�Zefd(d)�Zefd*d+�Zefd,d-�Zefd.d/�Zefd0d1�Zefd2d3�Z efd4d5�Z!d6efd7efd8efgd8efd9efd6efgd9efd8efd7efgd7efd6e fd9e!fgd:�Z"d;d�Z#d<d�Z$ydd=lm$Z$Wnek
�r�YnXGd>d	�d	�Z%ydd?lm%Z%Wnek
�r*YnXGd@d
�d
e&�Z'edAdBdCdDdEg�Z(GdFdG�dGe)�Z*e&�fe+e,e-e.dH�he/e.e0fdIdJ�Z1d\dMd�Z2dNdO�Z3yddPlm3Z3Wnek
�r�YnXdQdR�Z4d]dSdT�Z5dUdV�Z6dWdX�Z7dYd�Z8dHS)^zEfunctools.py - Tools for working with functions and callable objects
�update_wrapper�wraps�WRAPPER_ASSIGNMENTS�WRAPPER_UPDATES�total_ordering�
cmp_to_key�	lru_cache�reduce�partial�
partialmethod�singledispatch�)r)�get_cache_token)�
namedtuple)�MappingProxyType)�WeakKeyDictionary)�recursive_repr)�RLockc@s eZdZdZdd�Zdd�ZdS)rz/Dummy reentrant lock for builds without threadscCsdS)N�)�selfrr�!/usr/lib64/python3.6/functools.py�	__enter__szRLock.__enter__cCsdS)Nr)r�exctype�excinst�exctbrrr�__exit__szRLock.__exit__N)�__name__�
__module__�__qualname__�__doc__rrrrrrrsrrrrr�__annotations__�__dict__c
Csnx<|D]4}yt||�}Wntk
r,YqXt|||�qWx$|D]}t||�jt||i��qDW||_|S)aUpdate a wrapper function to look like the wrapped function

       wrapper is the function to be updated
       wrapped is the original function
       assigned is a tuple naming the attributes assigned directly
       from the wrapped function to the wrapper function (defaults to
       functools.WRAPPER_ASSIGNMENTS)
       updated is a tuple naming the attributes of the wrapper that
       are updated with the corresponding attribute from the wrapped
       function (defaults to functools.WRAPPER_UPDATES)
    )�getattr�AttributeError�setattr�update�__wrapped__)�wrapper�wrapped�assigned�updated�attr�valuerrrr,s

cCstt|||d�S)a�Decorator factory to apply update_wrapper() to a wrapper function

       Returns a decorator that invokes update_wrapper() with the decorated
       function as the wrapper argument and the arguments to wraps() as the
       remaining arguments. Default arguments are as for update_wrapper().
       This is a convenience function to simplify applying partial() to
       update_wrapper().
    )r'r(r))r	r)r'r(r)rrrrJscCs$|j|�}||kr|S|o"||kS)zIReturn a > b.  Computed by @total_ordering from (not a < b) and (a != b).)�__lt__)r�other�NotImplemented�	op_resultrrr�_gt_from_ltbs
r0cCs|j|�}|p||kS)zEReturn a <= b.  Computed by @total_ordering from (a < b) or (a == b).)r,)rr-r.r/rrr�_le_from_ltis
r1cCs|j|�}||kr|S|S)z=Return a >= b.  Computed by @total_ordering from (not a < b).)r,)rr-r.r/rrr�_ge_from_ltns
r2cCs$|j|�}||kr|S|p"||kS)zJReturn a >= b.  Computed by @total_ordering from (not a <= b) or (a == b).)�__le__)rr-r.r/rrr�_ge_from_leus
r4cCs"|j|�}||kr|S|o ||kS)zFReturn a < b.  Computed by @total_ordering from (a <= b) and (a != b).)r3)rr-r.r/rrr�_lt_from_le|s
r5cCs|j|�}||kr|S|S)z=Return a > b.  Computed by @total_ordering from (not a <= b).)r3)rr-r.r/rrr�_gt_from_le�s
r6cCs$|j|�}||kr|S|o"||kS)zIReturn a < b.  Computed by @total_ordering from (not a > b) and (a != b).)�__gt__)rr-r.r/rrr�_lt_from_gt�s
r8cCs|j|�}|p||kS)zEReturn a >= b.  Computed by @total_ordering from (a > b) or (a == b).)r7)rr-r.r/rrr�_ge_from_gt�s
r9cCs|j|�}||kr|S|S)z=Return a <= b.  Computed by @total_ordering from (not a > b).)r7)rr-r.r/rrr�_le_from_gt�s
r:cCs$|j|�}||kr|S|p"||kS)zJReturn a <= b.  Computed by @total_ordering from (not a >= b) or (a == b).)�__ge__)rr-r.r/rrr�_le_from_ge�s
r<cCs"|j|�}||kr|S|o ||kS)zFReturn a > b.  Computed by @total_ordering from (a >= b) and (a != b).)r;)rr-r.r/rrr�_gt_from_ge�s
r=cCs|j|�}||kr|S|S)z=Return a < b.  Computed by @total_ordering from (not a >= b).)r;)rr-r.r/rrr�_lt_from_ge�s
r>r7r3r;r,)r,r3r7r;csZ�fdd�tD�}|std��t|�}x.t|D]"\}}||kr0||_t�||�q0W�S)z6Class decorator that fills in missing ordering methodscs(g|] }t�|d�tt|d�k	r|�qS)N)r!�object)�.0�op)�clsrr�
<listcomp>�sz"total_ordering.<locals>.<listcomp>z6must define at least one ordering operation: < > <= >=)�_convert�
ValueError�maxrr#)rB�roots�root�opname�opfuncr)rBrr�scsG�fdd�dt�}|S)z,Convert a cmp= function into a key= functioncsZeZdZdgZdd�Z�fdd�Z�fdd�Z�fdd	�Z�fd
d�Z�fdd
�Z	dZ
dS)zcmp_to_key.<locals>.K�objcSs
||_dS)N)rK)rrKrrr�__init__�szcmp_to_key.<locals>.K.__init__cs�|j|j�dkS)Nr)rK)rr-)�mycmprrr,�szcmp_to_key.<locals>.K.__lt__cs�|j|j�dkS)Nr)rK)rr-)rMrrr7�szcmp_to_key.<locals>.K.__gt__cs�|j|j�dkS)Nr)rK)rr-)rMrr�__eq__�szcmp_to_key.<locals>.K.__eq__cs�|j|j�dkS)Nr)rK)rr-)rMrrr3�szcmp_to_key.<locals>.K.__le__cs�|j|j�dkS)Nr)rK)rr-)rMrrr;�szcmp_to_key.<locals>.K.__ge__N)rrr�	__slots__rLr,r7rNr3r;�__hash__r)rMrr�K�srQ)r?)rMrQr)rMrr�s)rcsJeZdZdZdZ�fdd�Zd	d
�Ze�dd��Zd
d�Z	dd�Z
�ZS)r	zSNew function with partial application of the given arguments
    and keywords.
    �func�args�keywordsr �__weakref__cs�|std��t|�dkr td��|^}}}t|�s:td��t|�}t|d�rv|j|}|jj�}|j|�|}~|j	}t
t|�j|�}||_	||_||_|S)Nz1descriptor '__new__' of partial needs an argument�z*type 'partial' takes at least one argumentz#the first argument must be callablerR)
�	TypeError�len�callable�tuple�hasattrrSrT�copyr$rR�superr	�__new__)rSrTrBrRZtmpkwr)�	__class__rrr^�s(




zpartial.__new__cOs:|std��|^}}|jj�}|j|�|j|j|�|�S)Nz2descriptor '__call__' of partial needs an argument)rWrTr\r$rRrS)rSrTrZnewkeywordsrrr�__call__s

zpartial.__call__cCs�t|�j}t|j�g}|jdd�|jD��|jdd�|jj�D��t|�jdkrld|�ddj	|��d�S|�ddj	|��d�S)	Ncss|]}t|�VqdS)N)�repr)r@�xrrr�	<genexpr>sz#partial.__repr__.<locals>.<genexpr>css |]\}}|�d|��VqdS)�=Nr)r@�k�vrrrrcs�	functoolsz
functools.�(z, �))
�typerrarR�extendrSrT�itemsr�join)r�qualnamerSrrr�__repr__s
zpartial.__repr__cCs*t|�|jf|j|j|jpd|jp$dffS)N)rjrRrSrTr )rrrr�
__reduce__#szpartial.__reduce__cCs�t|t�std��t|�dkr0tdt|�����|\}}}}t|�szt|t�sz|dk	rft|t�sz|dk	r�t|t�r�td��t|�}|dkr�i}nt|�tk	r�t|�}|dkr�i}||_||_||_	||_
dS)Nz(argument to __setstate__ must be a tuple�zexpected 4 items in state, got zinvalid partial state)�
isinstancerZrWrXrY�dictrjr rRrSrT)r�staterRrS�kwds�	namespacerrr�__setstate__'s(
zpartial.__setstate__)rRrSrTr rU)rrrrrOr^r`rrorprw�
__classcell__rr)r_rr	�s
)r	c@s<eZdZdZdd�Zdd�Zdd�Zdd	�Zed
d��Z	dS)
r
z�Method descriptor with partial application of the given arguments
    and keywords.

    Supports wrapping existing descriptors and handles non-descriptor
    callables as instance methods.
    cOsrt|�r$t|d�r$tdj|���t|t�r\|j|_|j||_|jj	�|_|jj
|�n||_||_||_dS)N�__get__z${!r} is not callable or a descriptor)rYr[rW�formatrrr
rRrSrTr\r$)rrRrSrTrrrrLMs
zpartialmethod.__init__cCsNdjtt|j��}djdd�|jj�D��}d}|j|jj|jj	|j
||d�S)Nz, css|]\}}dj||�VqdS)z{}={!r}N)rz)r@rerfrrrrccsz)partialmethod.__repr__.<locals>.<genexpr>z*{module}.{cls}({func}, {args}, {keywords}))�modulerBrRrSrT)rm�maprarSrTrlrzr_rrrR)rrSrT�
format_stringrrrroas

zpartialmethod.__repr__cs�fdd�}�j|_�|_|S)Ncs<�jj�}|j|�|^}}|f�jt|�}�j||�S)N)rTr\r$rSrZrR)rSrT�
call_keywords�cls_or_self�rest�	call_args)rrr�_methodms


z3partialmethod._make_unbound_method.<locals>._method)�__isabstractmethod__�_partialmethod)rr�r)rr�_make_unbound_methodlsz"partialmethod._make_unbound_methodcCs�t|jdd�}d}|dk	rd|||�}||jk	rdt|f|j�|j�}y|j|_Wntk
rbYnX|dkr||j�j||�}|S)Nry)	r!rRr	rSrT�__self__r"r�ry)rrKrB�get�result�new_funcrrrryws

zpartialmethod.__get__cCst|jdd�S)Nr�F)r!rR)rrrrr��sz"partialmethod.__isabstractmethod__N)
rrrrrLror�ry�propertyr�rrrrr
Es�	CacheInfo�hits�misses�maxsize�currsizec@s(eZdZdZdZefdd�Zdd�ZdS)�
_HashedSeqz� This class guarantees that hash() will be called no more than once
        per element.  This is important because the lru_cache() will hash
        the key multiple times on a cache miss.

    �	hashvaluecCs||dd�<||�|_dS)N)r�)r�tup�hashrrrrL�sz_HashedSeq.__init__cCs|jS)N)r�)rrrrrP�sz_HashedSeq.__hash__N)rrrrrOr�rLrPrrrrr��sr�Nc
s�|}|r*||7}x|j�D]}	||	7}qW|rl||�fdd�|D��7}|r�||�fdd�|j�D��7}n$||�dkr��|d�|kr�|dSt|�S)a�Make a cache key from optionally typed positional and keyword arguments

    The key is constructed in a way that is flat as possible rather than
    as a nested structure that would take more memory.

    If there is only a single argument and its data type is known to cache
    its hash value, then that argument is returned without a wrapper.  This
    saves space and improves lookup speed.

    c3s|]}�|�VqdS)Nr)r@rf)rjrrrc�sz_make_key.<locals>.<genexpr>c3s|]}�|�VqdS)Nr)r@rf)rjrrrc�s�r)rl�valuesr�)
rSru�typed�kwd_mark�	fasttypesrZrjrX�key�itemr)rjr�	_make_key�s r��Fcs.�dk	rt�t�rtd����fdd�}|S)a�Least-recently-used cache decorator.

    If *maxsize* is set to None, the LRU features are disabled and the cache
    can grow without bound.

    If *typed* is True, arguments of different types will be cached separately.
    For example, f(3.0) and f(3) will be treated as distinct calls with
    distinct results.

    Arguments to the cached function must be hashable.

    View the cache statistics named tuple (hits, misses, maxsize, currsize)
    with f.cache_info().  Clear the cache and statistics with f.cache_clear().
    Access the underlying function with f.__wrapped__.

    See:  http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used

    Nz)Expected maxsize to be an integer or Nonecst|��t�}t||�S)N)�_lru_cache_wrapper�
_CacheInfor)�
user_functionr&)r�r�rr�decorating_function�sz&lru_cache.<locals>.decorating_function)rr�intrW)r�r�r�r)r�r�rr�scs�t��t�d\����i�d�	�
d��j��j�t��
g���ddg�dd�<�dkrh�
�fdd�}nN�dkr����	��
���fdd�}n*���������	�
���
���fd	d�}���	�
��
fd
d�}���	�
�
�fdd
�}||_||_|S)Nrr�rV�Fcs�||�}�d7�|S)Nr�r)rSrur�)r�r�rrr&�s
z#_lru_cache_wrapper.<locals>.wrappercsH�||��}�|��}|�k	r*�d7�|S�||�}|�|<�d7�|S)Nr�r)rSrur�r�)�cache�	cache_getr��make_keyr��sentinelr�r�rrr&�s

cs2�
||��}�	�f�|�}|dk	rr|\}}}}||�<||�<�
�}||�<�
�<||�<�
|�<�d7�|SWdQRX�||�}�	��|�kr�n��r�
}	||	�<||	�<|	��
�
�}
�
�}d�
�<�
�<�|
=|	�|<n6�
�}|�
||g}||�<�
�<�|<���k��d7�WdQRX|S)Nr�r)rSrur��linkZ	link_prevZ	link_nextZ_keyr�ZlastZoldrootZoldkeyZ	oldresult)�KEY�NEXT�PREV�RESULTr�r��	cache_len�fullr��lockr�r�r�rHr�r�rrr&sB


cs ���������SQRXdS)zReport cache statisticsNrr)r�r�r�r�r�r�rr�
cache_infoGsz&_lru_cache_wrapper.<locals>.cache_infocs<��.�j���ddg�dd�<d��d�WdQRXdS)z$Clear the cache and cache statisticsNrF)�clearr)r�r�r�r�r�rHrr�cache_clearLs
z'_lru_cache_wrapper.<locals>.cache_clear)rr�rVr�)r?r�r��__len__rr�r�)r�r�r�r�r&r�r�r)r�r�r�r�r�r�r�r�r�r�r�r�r�r�rHr�r�r�rr��s**9	r�)r�cCs�g}x�dd�|D�}|s|Sx:|D]2}|d}x$|D]}||dd�kr4d}Pq4WPq"W|dkrhtd��|j|�x|D]}|d|krx|d=qxWqWdS)z�Merges MROs in *sequences* to a single MRO using the C3 algorithm.

    Adapted from http://www.python.org/download/releases/2.3/mro/.

    cSsg|]}|r|�qSrr)r@�srrrrCksz_c3_merge.<locals>.<listcomp>rr�NzInconsistent hierarchy)�RuntimeError�append)�	sequencesr��s1�	candidate�s2�seqrrr�	_c3_mergecs$



r�c
s&x8tt|j��D]"\}�t�d�rt|j�|}PqWd}�rFt��ng�t|jd|��}g}t|j|d��}x:�D]2�t|��rxt�fdd�|jD��rx|j��qxWx|D]��j	��q�W�fdd�|D�}�fdd�|D�}�fd	d�|D�}	t
|gg|||	|g|g|g�S)
a�Computes the method resolution order using extended C3 linearization.

    If no *abcs* are given, the algorithm works exactly like the built-in C3
    linearization used for method resolution.

    If given, *abcs* is a list of abstract base classes that should be inserted
    into the resulting MRO. Unrelated ABCs are ignored and don't end up in the
    result. The algorithm inserts ABCs where their functionality is introduced,
    i.e. issubclass(cls, abc) returns True for the class itself but returns
    False for all its direct base classes. Implicit ABCs for a given class
    (either registered or inferred from the presence of a special method like
    __len__) are inserted directly after the last ABC explicitly listed in the
    MRO of said class. If two implicit ABCs end up next to each other in the
    resulting MRO, their ordering depends on the order of types in *abcs*.

    �__abstractmethods__rNc3s|]}t|��VqdS)N)�
issubclass)r@�b)�baserrrc�sz_c3_mro.<locals>.<genexpr>csg|]}t|�d��qS))�abcs)�_c3_mro)r@r�)r�rrrC�sz_c3_mro.<locals>.<listcomp>csg|]}t|�d��qS))r�)r�)r@r�)r�rrrC�scsg|]}t|�d��qS))r�)r�)r@r�)r�rrrC�s)�	enumerate�reversed�	__bases__r[rX�listr��anyr��remover�)
rBr��i�boundary�explicit_bases�abstract_bases�other_bases�explicit_c3_mros�abstract_c3_mros�
other_c3_mrosr)r�r�rr�~s(


r�cs�t�j����fdd���fdd��D���fdd���fdd��D��t���g}x��D]�}g}x<|j�D]0}|�krlt�|�rl|j�fdd�|jD��qlW|s�|j|�qZ|jtd	d
�x,|D]$}x|D]}||kr�|j|�q�Wq�WqZWt�|d�S)z�Calculates the method resolution order for a given class *cls*.

    Includes relevant abstract base classes (with their respective bases) from
    the *types* iterable. Uses a modified C3 linearization algorithm.

    cs|�kot|d�ot�|�S)N�__mro__)r[r�)�typ)�basesrBrr�
is_related�sz _compose_mro.<locals>.is_relatedcsg|]}�|�r|�qSrr)r@�n)r�rrrC�sz _compose_mro.<locals>.<listcomp>cs(x"�D]}||kr||jkrdSqWdS)NTF)r�)r�r-)�typesrr�is_strict_base�s
z$_compose_mro.<locals>.is_strict_basecsg|]}�|�s|�qSrr)r@r�)r�rrrC�scsg|]}|�kr|�qSrr)r@r�)�type_setrrrC�sT)r��reverse)r�)�setr��__subclasses__r�r��sortrXr�)rBr��mror��found�sub�subclsr)r�rBr�r�r�r�r�_compose_mro�s*




r�cCsxt||j��}d}xZ|D]R}|dk	r^||kr\||jkr\||jkr\t||�r\tdj||���P||kr|}qW|j|�S)a^Returns the best matching implementation from *registry* for type *cls*.

    Where there is no registered implementation for a specific type, its method
    resolution order is used to find a more generic implementation.

    Note: if *registry* does not contain an implementation for the base
    *object* type, this function may return None.

    NzAmbiguous dispatch: {} or {})r��keysr�r�r�rzr�)rB�registryr��match�trrr�
_find_impl�s



r�cs�i�t��d����fdd��d
����fdd�	���fdd�}t|dd	��|�t<�|_�|_t��|_�j|_t	||�|S)alSingle-dispatch generic function decorator.

    Transforms a function into a generic function, which can have different
    behaviours depending upon the type of its first argument. The decorated
    function acts as the default implementation, and additional
    implementations can be registered using the register() attribute of the
    generic function.

    Ncs|�dk	r"t�}�|kr"�j�|�y�|}WnHtk
rvy�|}Wntk
rht|��}YnX|�|<YnX|S)z�generic_func.dispatch(cls) -> <function implementation>

        Runs the dispatch algorithm to return the best available implementation
        for the given *cls* registered on *generic_func*.

        N)r
r��KeyErrorr�)rB�
current_token�impl)�cache_token�dispatch_cacher�rr�dispatch�sz singledispatch.<locals>.dispatchcsB|dkr��fdd�S|��<�dkr6t�d�r6t���j�|S)z�generic_func.register(cls, func) -> func

        Registers a new implementation for the given *cls* on a *generic_func*.

        Ncs
��|�S)Nr)�f)rB�registerrr�<lambda>sz2singledispatch.<locals>.register.<locals>.<lambda>r�)r[r
r�)rBrR)r�r�r�r�)rBrr�sz singledispatch.<locals>.registercs&|st��d����|dj�||�S)Nz( requires at least 1 positional argumentr)rWr_)rS�kw)r��funcnamerrr&"szsingledispatch.<locals>.wrapperrzsingledispatch function)N)
rr!r?r�r�rr�r��_clear_cacher)rRr&r)r�r�r�r�r�r�rr�s


)rrrrr)r )r�F)N)9r�__all__�
_functoolsr�ImportError�abcr
�collectionsrr�r�weakrefr�reprlibr�_threadrrrrrr.r0r1r2r4r5r6r8r9r:r<r=r>rDrrr	r?r
r�r�r�r��str�	frozensetrjrZrXr�rr�r�r�r�r�rrrrr�<module>s�


NN
%t
-)py_compile.cpython-36.pyc000064400000014622150335715140011343 0ustar003


 \
�@s�dZddlZddlZddlZddlZddlZddlZddlZdddgZ	Gdd�de
�Zd
d	d�Zdd
d�Z
edkr~eje
��dS)zqRoutine to "compile" a .py file to a .pyc file.

This module has intimate knowledge of the format of .pyc files.
�N�compile�main�PyCompileErrorc@s"eZdZdZddd�Zdd�ZdS)	ra�Exception raised when an error occurs while attempting to
    compile the file.

    To raise this exception, use

        raise PyCompileError(exc_type,exc_value,file[,msg])

    where

        exc_type:   exception type to be used in error message
                    type name can be accesses as class variable
                    'exc_type_name'

        exc_value:  exception value to be used in error message
                    can be accesses as class variable 'exc_value'

        file:       name of file being compiled to be used in error message
                    can be accesses as class variable 'file'

        msg:        string message to be written as error message
                    If no value is given, a default exception message will be
                    given, consistent with 'standard' py_compile output.
                    message (or default) can be accesses as class variable
                    'msg'

    �cCst|j}|tkr2djtj||��}|jdd|�}nd||f}tj||pJ||||�||_||_	||_
|pl||_dS)NrzFile "<string>"z	File "%s"z
Sorry: %s: %s)�__name__�SyntaxError�join�	traceback�format_exception_only�replace�	Exception�__init__�
exc_type_name�	exc_value�file�msg)�self�exc_typerrrr�tbtext�errmsg�r�"/usr/lib64/python3.6/py_compile.pyr
-s
zPyCompileError.__init__cCs|jS)N)r)rrrr�__str__=szPyCompileError.__str__N)r)r�
__module__�__qualname__�__doc__r
rrrrrrs
F�cCs�|dkr>|dkr2|dkr|nd}tjj||d�}ntjj|�}tjj|�r^d}t|j|���n,tjj|�r�tjj	|�r�d}t|j|���tj
jd|�}|j|�}y|j
||p�||d	�}	WnVtk
�r}
z8t|
j|
|p�|�}|r�|�ntjj|jd
�dSWYdd}
~
XnXy tjj|�}|�r0tj|�Wntk
�rHYnX|j|�}
tjj|	|
d|
d�}tjj|�}tjj|||�|S)
a)Byte-compile one Python source file to Python bytecode.

    :param file: The source file name.
    :param cfile: The target byte compiled file name.  When not given, this
        defaults to the PEP 3147/PEP 488 location.
    :param dfile: Purported file name, i.e. the file name that shows up in
        error messages.  Defaults to the source file name.
    :param doraise: Flag indicating whether or not an exception should be
        raised when a compile error is found.  If an exception occurs and this
        flag is set to False, a string indicating the nature of the exception
        will be printed, and the function will return to the caller. If an
        exception occurs and this flag is set to True, a PyCompileError
        exception will be raised.
    :param optimize: The optimization level for the compiler.  Valid values
        are -1, 0, 1 and 2.  A value of -1 means to use the optimization
        level of the current interpreter, as given by -O command line options.

    :return: Path to the resulting byte compiled file.

    Note that it isn't necessary to byte-compile Python modules for
    execution efficiency -- Python itself byte-compiles a module when
    it is loaded, and if it can, writes out the bytecode to the
    corresponding .pyc file.

    However, if a Python installation is shared between users, it is a
    good idea to byte-compile all modules upon installation, since
    other users may not be able to write in the source directories,
    and thus they won't be able to write the .pyc file, and then
    they would be byte-compiling every module each time it is loaded.
    This can slow down program start-up considerably.

    See compileall.py for a script/module that uses this module to
    byte-compile all installed files (or all files in selected
    directories).

    Do note that FileExistsError is raised if cfile ends up pointing at a
    non-regular file or symlink. Because the compilation uses a file renaming,
    the resulting file would be regular and thus not the same type of file as
    it was previously.
    Nrrr)�optimizationzc{} is a symlink and will be changed into a regular file if import writes a byte-compiled file to itzk{} is a non-regular file and will be changed into a regular one if import writes a byte-compiled file to itz<py_compile>)�	_optimize�
�mtime�size)�	importlib�util�cache_from_source�os�path�islink�FileExistsError�format�exists�isfile�	machinery�SourceFileLoader�get_data�source_to_coderr�	__class__�sys�stderr�writer�dirname�makedirs�
path_stats�_bootstrap_external�_code_to_bytecode�
_calc_mode�
_write_atomic)r�cfile�dfile�doraise�optimizerr�loader�source_bytes�code�err�py_excr4�source_stats�bytecode�moderrrrAsF)


cCs"|dkrtjdd�}d}|dgkr�x�tjj�}|s6P|jd�}yt|dd�Wq&tk
r�}zd}tjjd|j	�WYdd}~Xq&t
k
r�}zd}tjjd|�WYdd}~Xq&Xq&WnZxX|D]P}yt|dd�Wq�tk
�r}zd}tjjd|j	�WYdd}~Xq�Xq�W|S)	a�Compile several source files.

    The files named in 'args' (or on the command line, if 'args' is
    not specified) are compiled and the resulting bytecode is cached
    in the normal manner.  This function does not search a directory
    structure to locate source files; it only compiles files named
    explicitly.  If '-' is the only parameter in args, the list of
    files is taken from standard input.

    Nrr�-rT)r=z%s
)r1�argv�stdin�readline�rstriprrr2r3r�OSError)�args�rv�filename�errorrrrr�s0


"(
(�__main__���)NNFrR)N)rZimportlib._bootstrap_externalr"�importlib.machinery�importlib.utilr%Zos.pathr1r	�__all__rrrrr�exitrrrr�<module>s
0
R
&imp.cpython-36.pyc000064400000022742150335715140007772 0ustar003


 \�)�
@s�dZddlmZmZmZmZmZmZmZm	Z	m
Z
yddlmZWnek
rXdZYnXddl
mZmZmZmZddlmZddlmZddlmZddlZddlZddlZddlZddlZddlZejd	ed
d�dZdZd
Z d
Z!dZ"dZ#dZ$dZ%dZ&dZ'dd�Z(dd�Z)dd�Z*d8dd�Z+dd�Z,dd�Z-Gd d!�d!�Z.Gd"d#�d#�Z/Gd$d%�d%e/ej0�Z1d9d&d'�Z2Gd(d)�d)e/e�Z3d:d*d+�Z4d,d-�Z5d.d/�Z6d;d0d1�Z7d2d3�Z8d4d5�Z9e�r�d<d6d7�Z:ndZ:dS)=z�This module provides the components needed to build your own __import__
function.  Undocumented functions are obsolete.

In most cases it is preferred you consider using the importlib module's
functionality over this module.

�)	�	lock_held�acquire_lock�release_lock�get_frozen_object�is_frozen_package�init_frozen�
is_builtin�	is_frozen�_fix_co_filename)�create_dynamicN)�_ERR_MSG�_exec�_load�_builtin_from_name)�SourcelessFileLoader)�	machinery)�utilzhthe imp module is deprecated in favour of importlib; see the module's documentation for alternative uses�)�
stacklevel��������	cCs
tj|�S)z_**DEPRECATED**

    Create a new module.

    The module is not entered into sys.modules.

    )�types�
ModuleType)�name�r �/usr/lib64/python3.6/imp.py�
new_module0sr"cCstjS)z@**DEPRECATED**

    Return the magic number for .pyc files.
    )r�MAGIC_NUMBERr r r r!�	get_magic;sr$cCstjjS)z$Return the magic tag for .pyc files.)�sys�implementation�	cache_tagr r r r!�get_tagCsr(c
Cs*tj��tjd�tj||�SQRXdS)a�**DEPRECATED**

    Given the path to a .py file, return the path to its .pyc file.

    The .py file does not need to exist; this simply returns the path to the
    .pyc file calculated as if the .py file were imported.

    If debug_override is not None, then it must be a boolean and is used in
    place of sys.flags.optimize.

    If sys.implementation.cache_tag is None then NotImplementedError is raised.

    �ignoreN)�warnings�catch_warnings�simplefilterr�cache_from_source)�path�debug_overrider r r!r-Hs

r-cCs
tj|�S)a~**DEPRECATED**

    Given the path to a .pyc. file, return the path to its .py file.

    The .pyc file does not need to exist; this simply returns the path to
    the .py file calculated to correspond to the .pyc file.  If path does
    not conform to PEP 3147 format, ValueError will be raised. If
    sys.implementation.cache_tag is None then NotImplementedError is raised.

    )r�source_from_cache)r.r r r!r0[sr0cCs<dd�tjD�}dd�tjD�}dd�tjD�}|||S)z**DEPRECATED**cSsg|]}|dtf�qS)�rb)�C_EXTENSION)�.0�sr r r!�
<listcomp>ksz get_suffixes.<locals>.<listcomp>cSsg|]}|dtf�qS)�r)�	PY_SOURCE)r3r4r r r!r5lscSsg|]}|dtf�qS)r1)�PY_COMPILED)r3r4r r r!r5ms)r�EXTENSION_SUFFIXES�SOURCE_SUFFIXES�BYTECODE_SUFFIXES)�
extensions�source�bytecoder r r!�get_suffixesisr?c@s eZdZdZdd�Zdd�ZdS)�NullImporterz-**DEPRECATED**

    Null import object.

    cCs2|dkrtddd��ntjj|�r.td|d��dS)N�zempty pathname)r.zexisting directory)�ImportError�osr.�isdir)�selfr.r r r!�__init__zszNullImporter.__init__cCsdS)zAlways returns None.Nr )rE�fullnamer r r!�find_module�szNullImporter.find_moduleN)�__name__�
__module__�__qualname__�__doc__rFrHr r r r!r@rsr@cs.eZdZdZd�fdd�	Z�fdd�Z�ZS)�_HackedGetDatazMCompatibility support for 'file' arguments of various load_*()
    functions.Ncst�j||�||_dS)N)�superrF�file)rErGr.rO)�	__class__r r!rF�sz_HackedGetData.__init__c	sX|jrH||jkrH|jjs |j}nt|jd�|_}|�
|j�SQRXnt�j|�SdS)z;Gross hack to contort loader to deal w/ load_*()'s bad API.r6N)rOr.�closed�open�readrN�get_data)rEr.rO)rPr r!rT�sz_HackedGetData.get_data)N)rIrJrKrLrFrT�
__classcell__r r )rPr!rM�srMc@seZdZdZdS)�_LoadSourceCompatibilityz5Compatibility support for implementing load_source().N)rIrJrKrLr r r r!rV�srVcCs\t|||�}tj|||d�}|tjkr8t|tj|�}nt|�}tj||�|_	|j	|j
_|S)N)�loader)rVr�spec_from_file_locationr%�modulesr
rr�SourceFileLoader�
__loader__�__spec__rW)r�pathnamerOrW�spec�moduler r r!�load_source�s

r`c@seZdZdZdS)�_LoadCompiledCompatibilityz7Compatibility support for implementing load_compiled().N)rIrJrKrLr r r r!ra�sracCsZt|||�}tj|||d�}|tjkr8t|tj|�}nt|�}t||�|_|j|j	_
|S)z**DEPRECATED**)rW)rarrXr%rYr
rrr[r\rW)rr]rOrWr^r_r r r!�
load_compiled�s

rbcCs�tjj|�rhtjdd�tjdd�}x>|D](}tjj|d|�}tjj|�r.|}Pq.Wtdj	|���t
j||gd�}|tj
kr�t|tj
|�St|�SdS)z**DEPRECATED**NrFz{!r} is not a package)�submodule_search_locations)rCr.rDrr:r;�join�exists�
ValueError�formatrrXr%rYr
r)rr.r<�	extensionZ	init_pathr^r r r!�load_package�s

ric	Cs|\}}}|r2|jd
�s"d|kr2tdj|���n�|dkrZ|tthkrZdj|�}t|��n�|tkrnt|||�S|tkr�t|||�S|tkr�tdk	r�|dkr�t	|d��}t|||�SQRXnt|||�SnL|t
kr�t||�S|tkr�t
|�S|tk�r�t|�Sdj||�}t||d	��dS)z�**DEPRECATED**

    Load a module, given information returned by find_module().

    The module name must include the full package name, if any.

    r6�U�+zinvalid file open mode {!r}Nz.file object required for import (type code {})r1z*Don't know how to import {} (type code {}))r)r6rj)�
startswithrfrgr7r8r`rbr2�load_dynamicrR�
PKG_DIRECTORYri�	C_BUILTIN�init_builtin�	PY_FROZENrrB)	rrO�filenameZdetails�suffix�mode�type_�msgZopened_filer r r!�load_module�s.




rwcCs�t|t�stdjt|����n$t|td�tf�sBtdjt|����|dkr�t|�rbddddtffSt	|�rzddddt
ffStj}x�|D]�}t
jj||�}xHdtjdgD]6}d|}t
jj||�}t
jj|�r�d|ddtffSq�Wx:t�D].\}}}||}	t
jj||	�}t
jj|�r�Pq�Wq�Pq�Wttj|�|d��d}
d	|k�rjt|d
��}tj|j�d}
WdQRXt|||
d�}|||||ffS)a,**DEPRECATED**

    Search for a module.

    If path is omitted or None, search for a built-in, frozen or special
    module and continue search in sys.path. The module name cannot
    contain '.'; to search for a submodule of a package, pass the
    submodule name and the package's __path__.

    z'name' must be a str, not {}Nz%'path' must be None or a list, not {}rAz.pyrrF)r�br1)�encoding)�
isinstance�str�	TypeErrorrg�type�list�RuntimeErrorrror	rqr%r.rCrdrr;�isfilernr?rBrrR�tokenize�detect_encoding�readline)rr.�entryZpackage_directoryrsZpackage_file_nameZ	file_pathrtru�	file_nameryrOr r r!rH�s@


rHcCs
tj|�S)zw**DEPRECATED**

    Reload the module and return it.

    The module must have been successfully imported before.

    )�	importlib�reload)r_r r r!r�3sr�cCs"yt|�Stk
rdSXdS)zl**DEPRECATED**

    Load and return a built-in module by name, or None is such module doesn't
    exist
    N)rrB)rr r r!rp>srpcCs0ddl}|jj||�}|jj|||d�}t|�S)z:**DEPRECATED**

        Load an extension module.
        rN)rrW�origin)�importlib.machineryr�ExtensionFileLoader�
ModuleSpecr)rr.rOr�rWr^r r r!rmKs
rm)N)N)N)N)N);rL�_imprrrrrrrr	r
rrBZimportlib._bootstraprr
rrZimportlib._bootstrap_externalrr�rrrCr%r�rr*�warn�DeprecationWarningZSEARCH_ERRORr7r8r2ZPY_RESOURCErnrorqZPY_CODERESOURCEZIMP_HOOKr"r$r(r-r0r?r@rMrZrVr`rarbrirwrHr�rprmr r r r!�<module>s^,


	

#
4ftplib.cpython-36.pyc000064400000067307150335715140010473 0ustar003

�\dh!��@sVdZddlZddlZddlmZdddddd	gZd
ZdZdZGd
d�de�Z	Gdd�de	�Z
Gdd�de	�ZGdd�de	�ZGdd�de	�Z
e	eefZdZdZGdd�d�ZyddlZWnek
r�dZYn0XejZGdd�de�Zejd�e	eeejfZdadd�Zdadd�Zdd�Zdd�Z d d!�Z!d)d$d%�Z"d&d'�Z#e$d(k�rRe#�dS)*aSAn FTP client class and some helper functions.

Based on RFC 959: File Transfer Protocol (FTP), by J. Postel and J. Reynolds

Example:

>>> from ftplib import FTP
>>> ftp = FTP('ftp.python.org') # connect to host, default port
>>> ftp.login() # default, i.e.: user anonymous, passwd anonymous@
'230 Guest login ok, access restrictions apply.'
>>> ftp.retrlines('LIST') # list directory contents
total 9
drwxr-xr-x   8 root     wheel        1024 Jan  3  1994 .
drwxr-xr-x   8 root     wheel        1024 Jan  3  1994 ..
drwxr-xr-x   2 root     wheel        1024 Jan  3  1994 bin
drwxr-xr-x   2 root     wheel        1024 Jan  3  1994 etc
d-wxrwxr-x   2 ftp      wheel        1024 Sep  5 13:43 incoming
drwxr-xr-x   2 root     wheel        1024 Nov 17  1993 lib
drwxr-xr-x   6 1094     wheel        1024 Sep 13 19:07 pub
drwxr-xr-x   3 root     wheel        1024 Jan  3  1994 usr
-rw-r--r--   1 root     root          312 Aug  1  1994 welcome.msg
'226 Transfer complete.'
>>> ftp.quit()
'221 Goodbye.'
>>>

A nice test that reveals some of the network dialogue would be:
python ftplib.py -d localhost -l -p -l
�N)�_GLOBAL_DEFAULT_TIMEOUT�FTP�error_reply�
error_temp�
error_perm�error_proto�
all_errors��i c@seZdZdS)�ErrorN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/ftplib.pyr9src@seZdZdS)rN)rr
rrrrrr:sc@seZdZdS)rN)rr
rrrrrr;sc@seZdZdS)rN)rr
rrrrrr<sc@seZdZdS)rN)rr
rrrrrr=sz
s
c@s�eZdZdZdZdZeZeZ	dZ
dZdZdZ
dZdZddddedfdd	�Zd
d�Zdd
�Zd]dd�Zdd�Zdd�ZeZdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Z d'd(�Z!d)d*�Z"d+d,�Z#d-d.�Z$d/d0�Z%d1d2�Z&d^d3d4�Z'd_d5d6�Z(d`d7d8�Z)dad:d;�Z*dbd<d=�Z+dcd>d?�Z,ddd@dA�Z-dBdC�Z.dDdE�Z/dFdG�Z0dgfdHdI�Z1dJdK�Z2dLdM�Z3dNdO�Z4dPdQ�Z5dRdS�Z6dTdU�Z7dVdW�Z8dXdY�Z9dZd[�Z:dS)erayAn FTP client class.

    To create a connection, call the class using these arguments:
            host, user, passwd, acct, timeout

    The first four arguments are all strings, and have default value ''.
    timeout must be numeric and defaults to None if not passed,
    meaning that no timeout will be set on any ftp socket(s)
    If a timeout is passed, then this is now the default timeout for all ftp
    socket operations for this instance.

    Then use self.connect() with optional host and port argument.

    To download a file, use ftp.retrlines('RETR ' + filename),
    or ftp.retrbinary() with slightly different arguments.
    To upload a file, use ftp.storlines() or ftp.storbinary(),
    which have an open file as argument (see their definitions
    below for details).
    The download/upload functions first issue appropriate TYPE
    and PORT or PASV commands.
    r�Nr	zlatin-1FcCs0||_||_|r,|j|�|r,|j|||�dS)N)�source_address�timeout�connect�login)�self�host�user�passwd�acctrrrrr�__init__rs
zFTP.__init__cCs|S)Nr)rrrr�	__enter__{sz
FTP.__enter__cGsN|jdk	rJz*y|j�Wnttfk
r0YnXWd|jdk	rH|j�XdS)N)�sock�quit�OSError�EOFError�close)r�argsrrr�__exit__s


zFTP.__exit__i�cCs�|dkr||_|dkr||_|dkr*||_|dk	r8||_tj|j|jf|j|jd�|_|jj|_|jj	d|j
d�|_|j�|_
|j
S)	awConnect to host.  Arguments are:
         - host: hostname to connect to (string, default previous host)
         - port: port to connect to (integer, default previous port)
         - timeout: the timeout to set against the ftp socket(s)
         - source_address: a 2-tuple (host, port) for the socket to bind
           to as its source address before connecting.
        rri�N)r�r)�encodingi���)r�portrr�socket�create_connectionrZfamily�af�makefiler%�file�getresp�welcome)rrr&rrrrrr�s

zFTP.connectcCs|jrtd|j|j��|jS)z`Get the welcome message from the server.
        (this is read and squirreled away by connect())z	*welcome*)�	debugging�print�sanitizer-)rrrr�
getwelcome�szFTP.getwelcomecCs
||_dS)z�Set the debugging level.
        The required argument level means:
        0: no debugging output (default)
        1: print commands and responses but not body text etc.
        2: also print raw lines read and sent before stripping CR/LFN)r.)r�levelrrr�set_debuglevel�szFTP.set_debuglevelcCs
||_dS)z�Use passive or active mode for data transfers.
        With a false argument, use the normal PORT mode,
        With a true argument, use the PASV command.N)�
passiveserver)r�valrrr�set_pasv�szFTP.set_pasvcCsJ|dd�dkrBt|jd��}|dd�d|d||d�}t|�S)N��pass �PASS z
�*>r8r9)�len�rstrip�repr)r�s�irrrr0�s$zFTP.sanitizecCsRd|ksd|krtd��|t}|jdkr:td|j|��|jj|j|j��dS)N�
�
z4an illegal newline character should not be containedr	z*put*)	�
ValueError�CRLFr.r/r0r�sendall�encoder%)r�linerrr�putline�s
zFTP.putlinecCs$|jrtd|j|��|j|�dS)Nz*cmd*)r.r/r0rG)rrFrrr�putcmd�sz
FTP.putcmdcCs�|jj|jd�}t|�|jkr.td|j��|jdkrHtd|j|��|sPt�|dd�t	krn|dd�}n|dd�t	kr�|dd�}|S)	Nr	zgot more than %d bytesz*get*����rJ���rK)
r+�readline�maxliner;rr.r/r0r rC)rrFrrr�getline�s
zFTP.getlinecCsd|j�}|dd�dkr`|dd�}x:|j�}|d|}|dd�|kr&|dd�dkr&Pq&W|S)N���-rA)rN)rrF�codeZnextlinerrr�getmultiline�szFTP.getmultilinecCsp|j�}|jrtd|j|��|dd�|_|dd�}|d	krD|S|dkrTt|��|dkrdt|��t|��dS)
Nz*resp*rOr	�1�2�3�4�5>rTrVrU)rSr.r/r0Zlastresprrr)r�resp�crrrr,�szFTP.getrespcCs$|j�}|dd�dkr t|��|S)z%Expect a response beginning with '2'.Nr	rU)r,r)rrYrrr�voidresp�szFTP.voidrespcCsTdt}|jdkr"td|j|��|jj|t�|j�}|dd�d	krPt|��|S)
z�Abort a file transfer.  Uses out-of-band data.
        This does not follow the procedure from the RFC to send Telnet
        IP and Synch; that doesn't seem to work with the servers I've
        tried.  Instead, just send the ABOR command as OOB data.sABORr	z*put urgent*NrO�426�225�226>r^r\r])	�B_CRLFr.r/r0rrD�MSG_OOBrSr)rrFrYrrr�aborts
z	FTP.abortcCs|j|�|j�S)z'Send a command and return the response.)rHr,)r�cmdrrr�sendcmds
zFTP.sendcmdcCs|j|�|j�S)z8Send a command and expect a response beginning with '2'.)rHr[)rrbrrr�voidcmds
zFTP.voidcmdcCsB|jd�}t|d�t|d�g}||}ddj|�}|j|�S)zUSend a PORT command with the current host and the given
        port number.
        �.�zPORT �,)�splitr=�joinrd)rrr&ZhbytesZpbytes�bytesrbrrr�sendports

zFTP.sendportcCsbd}|jtjkrd}|jtjkr$d}|dkr4td��dt|�|t|�dg}ddj|�}|j|�S)zESend an EPRT command with the current host and the given port number.rr	rIzunsupported address familyrzEPRT �|)r)r'�AF_INETZAF_INET6rr=rird)rrr&r)Zfieldsrbrrr�sendeprt$szFTP.sendeprtc
Csd}d}x�tjdd|jtjdtj�D]j}|\}}}}}ytj|||�}|j|�Wn8tk
r�}	z|	}|rt|j�d}w$WYdd}	~	XnXPq$W|dkr�|dk	r�|�ntd��|jd�|j	�d}
|j
j	�d}|jtjkr�|j||
�}n|j
||
�}|jtk	�r|j|j�|S)z3Create a new socket and send a PORT command for it.Nrz!getaddrinfo returns an empty listr	)r'Zgetaddrinfor)ZSOCK_STREAMZ
AI_PASSIVEZbindrr!ZlistenZgetsocknamerrmrkrnrr�
settimeout)
r�errr�resr)Zsocktype�protoZ	canonnameZsa�_r&rrYrrr�makeport1s6 
zFTP.makeportcCs\|jtjkr:t|jd��\}}|jr*|}qT|jj�d}nt|jd�|jj��\}}||fS)z<Internal: Does the PASV or EPSV handshake -> (address, port)�PASVrZEPSV)	r)r'rm�parse227rc�trust_server_pasv_ipv4_addressrZgetpeername�parse229)rZuntrusted_hostr&rrrr�makepasvQszFTP.makepasvc

Cs6d}|jr�|j�\}}tj||f|j|jd�}yL|dk	rF|jd|�|j|�}|ddkrd|j�}|ddkrxt|��Wn|j	��YnXn�|j
��r}|dk	r�|jd|�|j|�}|ddkr�|j�}|ddkr�t|��|j�\}}	|jtk	�r
|j
|j�WdQRX|dd�dk�r.t|�}||fS)	a�Initiate a transfer over the data connection.

        If the transfer is active, send a port command and the
        transfer command, and accept the connection.  If the server is
        passive, send a pasv command, connect to it, and start the
        transfer command.  Either way, return the socket for the
        connection and the expected size of the transfer.  The
        expected size may be None if it could not be determined.

        Optional `rest' argument can be a string that is sent as the
        argument to a REST command.  This is essentially a server
        marker used to tell the server to skip over any data up to the
        given marker.
        N)rzREST %srrUrTrO�150)r4ryr'r(rrrcr,rr!rtZacceptrro�parse150)
rrb�rest�sizerr&�connrYrZsockaddrrrr�ntransfercmd]s<




zFTP.ntransfercmdcCs|j||�dS)z0Like ntransfercmd() but returns only the socket.r)r)rrbr|rrr�transfercmd�szFTP.transfercmdcCs�|sd}|sd}|sd}|dkr0|dkr0|d}|jd|�}|ddkrX|jd|�}|ddkrr|jd	|�}|dd
kr�t|��|S)zLogin, default anonymous.Z	anonymousrrQz
anonymous@zUSER rrVzPASS zACCT rU>rrQ)rcr)rrrrrYrrrr�s z	FTP.login� c
Csb|jd�|j||��>}x|j|�}|s*P||�qWtdk	rPt|t�rP|j�WdQRX|j�S)a�Retrieve data in binary mode.  A new port is created for you.

        Args:
          cmd: A RETR command.
          callback: A single parameter callable to be called on each
                    block of data read.
          blocksize: The maximum number of bytes to read from the
                     socket at one time.  [default: 8192]
          rest: Passed to transfercmd().  [default: None]

        Returns:
          The response code.
        zTYPE IN)rdr�Zrecv�
_SSLSocket�
isinstance�unwrapr[)rrb�callback�	blocksizer|r~�datarrr�
retrbinary�s

zFTP.retrbinarycCs�|dkrt}|jd�}|j|���}|jd|jd���}x�|j|jd�}t|�|jkrbtd|j��|j	dkrzt
dt|��|s�P|d
d�tkr�|dd�}n|dd�d	kr�|dd
�}||�q6Wt
dk	r�t|t
�r�|j�WdQRXWdQRX|j�S)ahRetrieve data in line mode.  A new port is created for you.

        Args:
          cmd: A RETR, LIST, or NLST command.
          callback: An optional single parameter callable that is called
                    for each line with the trailing CRLF stripped.
                    [default: print_line()]

        Returns:
          The response code.
        NzTYPE Ar$)r%r	zgot more than %d bytesrIz*retr*rArJrJrKrK)�
print_linercr�r*r%rLrMr;rr.r/r=rCr�r�r�r[)rrbr�rYr~�fprFrrr�	retrlines�s*

z
FTP.retrlinesc
Csp|jd�|j||��L}x*|j|�}|s*P|j|�|r||�qWtdk	r^t|t�r^|j�WdQRX|j�S)a9Store a file in binary mode.  A new port is created for you.

        Args:
          cmd: A STOR command.
          fp: A file-like object with a read(num_bytes) method.
          blocksize: The maximum data size to read from fp and send over
                     the connection at once.  [default: 8192]
          callback: An optional single parameter callable that is called on
                    each block of data after it is sent.  [default: None]
          rest: Passed to transfercmd().  [default: None]

        Returns:
          The response code.
        zTYPE IN)rdr��readrDr�r�r�r[)rrbr�r�r�r|r~�bufrrr�
storbinary�s


zFTP.storbinaryc
Cs�|jd�|j|���}x||j|jd�}t|�|jkrDtd|j��|sJP|dd�tkrz|dtkrr|dd�}|t}|j|�|r||�qWtdk	r�t	|t�r�|j
�WdQRX|j�S)	ahStore a file in line mode.  A new port is created for you.

        Args:
          cmd: A STOR command.
          fp: A file-like object with a readline() method.
          callback: An optional single parameter callable that is called on
                    each line after it is sent.  [default: None]

        Returns:
          The response code.
        zTYPE Ar	zgot more than %d bytesrINrJrKrK)rdr�rLrMr;rr_rDr�r�r�r[)rrbr�r�r~r�rrr�	storliness$

z
FTP.storlinescCsd|}|j|�S)zSend new account name.zACCT )rd)rZpasswordrbrrrr+szFTP.acctcGs4d}x|D]}|d|}q
Wg}|j||j�|S)zBReturn a list of files in a given directory (default the current).ZNLST� )r��append)rr"rb�arg�filesrrr�nlst0s
zFTP.nlstcGsld}d}|dd�r>t|d�td�kr>|dd�|d	}}x|D]}|rD|d|}qDW|j||�dS)
aList a directory in long form.
        By default list current directory to stdout.
        Optional last argument is callback function; all
        non-empty arguments before it are concatenated to the
        LIST command.  (This *should* only be used for a pathname.)ZLISTNr	rr�rKrKrKrK)�typer�)rr"rb�funcr�rrr�dir9s 
zFTP.dirc
cs�|r|jddj|�d�|r*d|}nd}g}|j||j�xh|D]`}|jt�jd�\}}}i}	x6|dd	�jd�D] }
|
jd�\}}}||	|j�<qxW||	fVqFWdS)
a<List a directory in a standardized format by using MLSD
        command (RFC-3659). If path is omitted the current directory
        is assumed. "facts" is a list of strings representing the type
        of information desired (e.g. ["type", "size", "perm"]).

        Return a generator object yielding a tuple of two elements
        for every file found in path.
        First element is the file name, the second one is a dictionary
        including a variable number of "facts" depending on the server
        and whether "facts" argument has been provided.
        z
OPTS MLST �;zMLSD %sZMLSDr�Nr	�=rK)	rcrir�r�r<rC�	partitionrh�lower)
r�pathZfactsrb�linesrFZfacts_foundrs�name�entryZfact�key�valuerrr�mlsdHs

zFTP.mlsdcCs0|jd|�}|ddkr"t|��|jd|�S)zRename a file.zRNFR rrVzRNTO )rcrrd)rZfromnameZtonamerYrrr�renamedsz
FTP.renamecCs.|jd|�}|dd�dkr"|St|��dS)zDelete a file.zDELE NrO�250�200>r�r�)rcr)r�filenamerYrrr�deleteksz
FTP.deletecCsn|dkrPy
|jd�Stk
rL}z|jddd�dkr<�WYdd}~Xq\Xn|dkr\d}d	|}|j|�S)
zChange to a directory.z..ZCDUPrNrO�500rrezCWD )rdrr")r�dirname�msgrbrrr�cwdss
zFTP.cwdcCs:|jd|�}|dd�dkr6|dd�j�}t|�SdS)zRetrieve the size of a file.zSIZE NrOZ213)rc�strip�int)rr�rYr>rrrr}�szFTP.sizecCs$|jd|�}|jd�sdSt|�S)z+Make a directory, return its full pathname.zMKD �257r)rd�
startswith�parse257)rr�rYrrr�mkd�s
zFTP.mkdcCs|jd|�S)zRemove a directory.zRMD )rd)rr�rrr�rmd�szFTP.rmdcCs |jd�}|jd�sdSt|�S)z!Return current working directory.ZPWDr�r)rdr�r�)rrYrrr�pwd�s

zFTP.pwdcCs|jd�}|j�|S)zQuit, and close the connection.ZQUIT)rdr!)rrYrrrr�s
zFTP.quitcCsDz |j}d|_|dk	r|j�Wd|j}d|_|dk	r>|j�XdS)z8Close the connection without assuming anything about it.N)r+r!r)rr+rrrrr!�sz	FTP.close����)rrr�N)N)N)rrr)r�N)N)r�NN)N);rr
r�__doc__r.r�FTP_PORTr&�MAXLINErMrr+r-r4r%rwrrrr#rr1r3�debugr6r0rGrHrNrSr,r[rarcrdrkrnrtryrr�rr�r�r�r�rr�r�r�r�r�r�r}r�r�r�rr!rrrrrJsl

	

 
7



#

	
		c	@sneZdZdZejZdddddddedf	dd�Zddd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
ddd�Zdd�ZdS)�FTP_TLSa�A FTP subclass which adds TLS support to FTP as described
        in RFC-4217.

        Connect as usual to port 21 implicitly securing the FTP control
        connection before authenticating.

        Securing the data connection requires user to explicitly ask
        for it by calling prot_p() method.

        Usage example:
        >>> from ftplib import FTP_TLS
        >>> ftps = FTP_TLS('ftp.python.org')
        >>> ftps.login()  # login anonymously previously securing control channel
        '230 Guest login ok, access restrictions apply.'
        >>> ftps.prot_p()  # switch to secure data connection
        '200 Protection level set to P'
        >>> ftps.retrlines('LIST')  # list directory content securely
        total 9
        drwxr-xr-x   8 root     wheel        1024 Jan  3  1994 .
        drwxr-xr-x   8 root     wheel        1024 Jan  3  1994 ..
        drwxr-xr-x   2 root     wheel        1024 Jan  3  1994 bin
        drwxr-xr-x   2 root     wheel        1024 Jan  3  1994 etc
        d-wxrwxr-x   2 ftp      wheel        1024 Sep  5 13:43 incoming
        drwxr-xr-x   2 root     wheel        1024 Nov 17  1993 lib
        drwxr-xr-x   6 1094     wheel        1024 Sep 13 19:07 pub
        drwxr-xr-x   3 root     wheel        1024 Jan  3  1994 usr
        -rw-r--r--   1 root     root          312 Aug  1  1994 welcome.msg
        '226 Transfer complete.'
        >>> ftps.quit()
        '221 Goodbye.'
        >>>
        rNc
Cs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}
|
jdtd�||_||_|dkr|tj|j||d�}||_	d|_
tj|||||||	�dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadrI)�certfile�keyfileF)
rB�warnings�warn�DeprecationWarningr�r��sslZ_create_stdlib_context�ssl_version�context�_prot_prr)rrrrrr�r�r�rrr�rrrr�s"zFTP_TLS.__init__TcCs,|rt|jtj�r|j�tj||||�S)N)r�rr��	SSLSocket�authrr)rrrrZsecurerrrr�sz
FTP_TLS.logincCsft|jtj�rtd��|jtjkr.|jd�}n
|jd�}|jj	|j|j
d�|_|jjd|jd�|_
|S)z2Set up secure control connection by using TLS/SSL.zAlready using TLSzAUTH TLSzAUTH SSL)�server_hostnamer$)�moder%)r�rr�r�rBr��PROTOCOL_SSLv23rdr��wrap_socketrr*r%r+)rrYrrrr��s

zFTP_TLS.authcCs0t|jtj�std��|jd�}|jj�|_|S)z/Switch back to a clear-text control connection.z
not using TLSZCCC)r�rr�r�rBrdr�)rrYrrr�cccs

zFTP_TLS.ccccCs|jd�|jd�}d|_|S)zSet up secure data connection.zPBSZ 0zPROT PT)rdr�)rrYrrr�prot_ps

zFTP_TLS.prot_pcCs|jd�}d|_|S)z"Set up clear text data connection.zPROT CF)rdr�)rrYrrr�prot_cs
zFTP_TLS.prot_ccCs2tj|||�\}}|jr*|jj||jd�}||fS)N)r�)rrr�r�r�r)rrbr|r~r}rrrr$s

zFTP_TLS.ntransfercmdcCs8dt}|jj|�|j�}|dd�dkr4t|��|S)NsABORrOr\r]r^>r\r^r])r_rrDrSr)rrFrYrrrra+sz
FTP_TLS.abort)rrrT)N)rr
rr�r�r�r�rrrr�r�r�r�rrarrrrr��s 



r�cCs\|dd�dkrt|��tdkr<ddl}|jd|j|jB�atj|�}|sNdSt|jd��S)z�Parse the '150' response for a RETR request.
    Returns the expected transfer size or None; size is not guaranteed to
    be present in the 150 message.
    NrOrzrz150 .* \((\d+) bytes\)r	)	r�_150_re�re�compile�
IGNORECASE�ASCII�matchr��group)rYr��mrrrr{:s
r{cCs�|dd�dkrt|��tdkr6ddl}|jd|j�atj|�}|sLt|��|j�}dj|dd��}t	|d�d>t	|d	�}||fS)
z�Parse the '227' response for a PASV request.
    Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)'
    Return ('host.addr.as.numbers', port#) tuple.NrOZ227rz#(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)rerP�r7)
r�_227_rer�r�r��searchr�groupsrir�)rYr�r�Znumbersrr&rrrrvNs
rvcCs�|dd�dkrt|��|jd�}|dkr2t|��|jd|d�}|dkrRt|��||d||dkrrt|��||d|�j||d�}t|�dkr�t|��|d}t|d�}||fS)	z�Parse the '229' response for an EPSV request.
    Raises error_proto if it does not contain '(|||port|)'
    Return ('host.addr.as.numbers', port#) tuple.NrOZ229�(r�)r	r7)r�findrrhr;r�)rYZpeer�left�right�partsrr&rrrrxbs 
rxcCs�|dd�dkrt|��|dd�dkr,dSd}d}t|�}xJ||kr�||}|d}|dkr|||ksr||dkrtP|d}||}q>W|S)	z�Parse the '257' response for a MKD or PWD request.
    This is a response to a MKD or PWD request: a directory name.
    Returns the directoryname in the 257 reply.NrOr�r7z "rr	�")rr;)rYr�r?�nrZrrrr�xs 
r�cCst|�dS)z+Default retrlines callback to print a line.N)r/)rFrrrr��sr�r�Ic	Cs�|s|}d|}|j|�|j|�t|jd��\}}|j||�|jd|�}|dd�d	krdt�|jd|�}|dd�d
kr�t�|j�|j�dS)z+Copy file from one FTP-instance to another.zTYPE ruzSTOR NrO�125rzzRETR >r�rz>r�rz)rdrvrcrkrr[)	�sourceZ
sourcename�targetZ
targetnamer�Z
sourcehostZ
sourceportZtreplyZsreplyrrr�ftpcp�s

r�cCs�ttj�dkr"ttj�tjd�ddl}d}d}x"tjddkrT|d}tjd=q4Wtjddd�dkr�tjddd�}tjd=tjd}t|�}|j	|�d}}}y|j|�}Wn(t
k
r�|dk	r�tjjd�Yn:Xy|j
|�\}}}Wn"tk
�rtjjd	�YnX|j|||�x�tjdd�D]�}	|	dd�d
k�rf|j|	dd��nt|	dd�dk�r�d}
|	dd��r�|
d|	dd�}
|j|
�}n0|	d
k�r�|j|j�n|jd|	tjjd��q<W|j�dS)z�Test program.
    Usage: ftp [-d] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ...

    -d dir
    -l list
    -p password
    rIrNr	z-dz-rrz5Could not open account file -- using anonymous login.z$No account -- using anonymous login.z-lZCWDr�z-pzRETR i)r;�sys�argvr/�testr��exit�netrcrr3r�stderr�writeZauthenticators�KeyErrorrr�rcr6r4r��stdoutr)r�r.ZrcfilerZftpZuseridrrZnetrcobjr+rbrYrrrr��sP	





r��__main__)rr�)%r�r�r'r�__all__r`r�r��	Exceptionrrrrrrr rrCr_rr��ImportErrorr�r�r�r�ZSSLErrorr�r{r�rvrxr�r�r�r�rrrrr�<module>sP


k
|

9
abc.cpython-36.opt-2.pyc000064400000010016150335715140010661 0ustar003


 \"�@srddlmZdd�ZGdd�de�ZGdd�de�ZGdd	�d	e�ZGd
d�de	�Z
Gdd
�d
e
d�Zdd�ZdS)�)�WeakSetcCs
d|_|S)NT)�__isabstractmethod__)�funcobj�r�/usr/lib64/python3.6/abc.py�abstractmethod	srcs eZdZdZ�fdd�Z�ZS)�abstractclassmethodTcsd|_t�j|�dS)NT)r�super�__init__)�self�callable)�	__class__rrr
0szabstractclassmethod.__init__)�__name__�
__module__�__qualname__rr
�
__classcell__rr)r
rrsrcs eZdZdZ�fdd�Z�ZS)�abstractstaticmethodTcsd|_t�j|�dS)NT)rr	r
)rr)r
rrr
Hszabstractstaticmethod.__init__)rrrrr
rrr)r
rr5src@seZdZdZdS)�abstractpropertyTN)rrrrrrrrrMsrcsBeZdZdZ�fdd�Zdd�Zd
dd�Zd	d
�Zdd�Z�Z	S)�ABCMetarc	s�t�j||||f|�}dd�|j�D�}xF|D]>}x8t|dt��D]&}t||d�}t|dd�rB|j|�qBWq.Wt|�|_t�|_	t�|_
t�|_tj
|_|S)NcSs h|]\}}t|dd�r|�qS)rF)�getattr)�.0�name�valuerrr�	<setcomp>�sz"ABCMeta.__new__.<locals>.<setcomp>�__abstractmethods__rF)r	�__new__�itemsr�set�add�	frozensetrr�
_abc_registry�
_abc_cache�_abc_negative_cacher�_abc_invalidation_counter�_abc_negative_cache_version)	�mclsr�bases�	namespace�kwargs�cls�	abstracts�baser)r
rrr�s

zABCMeta.__new__cCsPt|t�std��t||�r |St||�r2td��|jj|�tjd7_|S)NzCan only register classesz'Refusing to create an inheritance cycle�)	�
isinstance�type�	TypeError�
issubclass�RuntimeErrorr rrr#)r)�subclassrrr�register�s


zABCMeta.registerNcCs|td|j|jf|d�tdtj|d�xLt|j�D]>}|jd�r6t||�}t	|t
�r`t|�}td||f|d�q6WdS)NzClass: %s.%s)�filezInv.counter: %s�_abc_z%s: %r)�printrrrr#�sorted�__dict__�
startswithrr-rr)r)r4rrrrr�_dump_registry�s


zABCMeta._dump_registrycsb|j}|�jkrdSt|�}||krH�jtjkr>|�jkr>dS�j|�St�fdd�||hD��S)NTFc3s|]}�j|�VqdS)N)�__subclasscheck__)r�c)r)rr�	<genexpr>�sz,ABCMeta.__instancecheck__.<locals>.<genexpr>)	r
r!r.r$rr#r"r;�any)r)�instancer2�subtyper)r)r�__instancecheck__�s


zABCMeta.__instancecheck__cCs�||jkrdS|jtjkr,t�|_tj|_n||jkr:dS|j|�}|tk	rn|r^|jj|�n|jj|�|S|t	|df�kr�|jj|�dSx(|j
D]}t||�r�|jj|�dSq�Wx*|j�D]}t||�r�|jj|�dSq�W|jj|�dS)NTF�__mro__)
r!r$rr#rr"�__subclasshook__�NotImplementedrrr r0�__subclasses__)r)r2�ok�rcls�sclsrrrr;�s4





zABCMeta.__subclasscheck__)N)
rrrr#rr3r:rAr;rrr)r
rrms
rc@seZdZdS)�ABCN)rrrrrrrrI�srI)�	metaclasscCstjS)N)rr#rrrr�get_cache_token�srKN)
�_weakrefsetrr�classmethodr�staticmethodr�propertyrr.rrIrKrrrr�<module>s compileall.cpython-36.opt-1.pyc000064400000020130150335715140012252 0ustar003


 \]/�@s�dZddlZddlZddlZddlZddlZddlmZdddgZ	ddd	�Z
ddd�Zdd
d�Zddd�Z
dd�Zedkr�ee��Zeje�dS)a�Module/script to byte-compile all .py files to .pyc files.

When called as a script with arguments, this compiles the directories
given as arguments recursively; the -l option prevents it from
recursing into directories.

Without arguments, if compiles all modules on sys.path, without
recursing into subdirectories.  (Even though it should do so for
packages -- for now, you'll have to deal with packages separately.)

See module py_compile for details of the actual byte-compilation.
�N)�partial�compile_dir�compile_file�compile_path�
ccs |dkrt|tj�rtj|�}|s0tdj|��ytj|�}Wn.tk
rl|dkrdtdj|��g}YnX|j�x�|D]�}|dkr�q|tj	j
||�}|dk	r�tj	j
||�}nd}tj	j|�s�|Vq||dkr||tjkr||tj
kr|tj	j|�r|tj	j|�r|t|||d|d�EdHq|WdS)N�zListing {!r}...zCan't list {!r}�__pycache__r�)�ddir�	maxlevels�quiet)�
isinstance�os�PathLike�fspath�print�format�listdir�OSError�sort�path�join�isdir�curdir�pardir�islink�	_walk_dir)�dirr
rr�names�name�fullname�dfile�r"�"/usr/lib64/python3.6/compileall.pyrs0


rFr	c	Cs�d}	|dk	rP|dkrtd��n2|dkrPyddlm}	Wntk
rNd}YnXt||||d�}
d}|dk	r�|dkr�|	dk	r�|p�d}|	|d��0}|jtt||||||d	�|
�}
t|
dd
�}WdQRXn&x$|
D]}t|||||||�s�d}q�W|S)a�Byte-compile all modules in the given directory tree.

    Arguments (only dir is required):

    dir:       the directory to byte-compile
    maxlevels: maximum recursion level (default 10)
    ddir:      the directory that will be prepended to the path to the
               file as it is compiled into each byte-code file.
    force:     if True, force compilation, even if timestamps are up-to-date
    quiet:     full output with False or 0, errors only with 1,
               no output with 2
    legacy:    if True, produce legacy pyc paths instead of PEP 3147 paths
    optimize:  optimization level or -1 for level of the interpreter
    workers:   maximum number of parallel workers
    Nrz%workers must be greater or equal to 0r	)�ProcessPoolExecutor)rrr
T)Zmax_workers)r
�force�rxr�legacy�optimize)�defaultF)	�
ValueErrorZconcurrent.futuresr$�ImportErrorr�maprr�min)rrr
r%r&rr'r(�workersr$�files�successZexecutorZresults�filer"r"r#r2s6


cCs�d}|dkr"t|tj�r"tj|�}tjj|�}|dk	rFtjj||�}	nd}	|dk	rd|j|�}
|
rd|Stjj|��r�|r�|d}nB|dkr�|dkr�|nd}t	j
j||d�}nt	j
j|�}tjj|�}
|dd�|dd�}}|d
k�r�|�sXyTt
tj|�j�}tjdt	j
j|�}t|d��}|jd
�}WdQRX||k�r>|SWntk
�rVYnX|�sltdj|��ytj|||	d|d�}Wn�tjk
�r}zdd}|dk�r�|S|�r�tdj|��ntddd�|jjtjjdd�}|j tjj�}t|�WYdd}~Xn~t!t"tfk
�rv}zLd}|dk�r2|S|�rHtdj|��ntddd�t|j#j$d|�WYdd}~XnX|dk�r�d}|S)aByte-compile one file.

    Arguments (only fullname is required):

    fullname:  the file to byte-compile
    ddir:      if given, the directory name compiled in to the
               byte-code file.
    force:     if True, force compilation, even if timestamps are up-to-date
    quiet:     full output with False or 0, errors only with 1,
               no output with 2
    legacy:    if True, produce legacy pyc paths instead of PEP 3147 paths
    optimize:  optimization level or -1 for level of the interpreter
    TrN�crr	�)�optimization�z.pyz<4sl�rb�zCompiling {!r}...)r(Fz*** Error compiling {!r}...z*** )�end�backslashreplace)�errors�:���r<)%r
rrrr�basenamer�search�isfile�	importlib�util�cache_from_source�dirname�int�stat�st_mtime�structZpack�MAGIC_NUMBER�open�readrrr�
py_compile�compile�PyCompileError�msg�encode�sys�stdout�encoding�decode�SyntaxError�UnicodeError�	__class__�__name__)r r
r%r&rr'r(r0rr!Zmo�cfile�optZ	cache_dir�head�tail�mtimeZexpectZchandleZactual�ok�errrN�er"r"r#rbsx






$
c
CsXd}xNtjD]D}|s |tjkr6|r6|dkrPtd�q|oNt||d||||d�}qW|S)awByte-compile all module on sys.path.

    Arguments (all optional):

    skip_curdir: if true, skip current directory (default True)
    maxlevels:   max recursion level (default 0)
    force: as for compile_dir() (default False)
    quiet: as for compile_dir() (default 0)
    legacy: as for compile_dir() (default False)
    optimize: as for compile_dir() (default -1)
    TrzSkipping current directoryN)rr'r()rPrrrrr)Zskip_curdirrr%rr'r(r0rr"r"r#r�s

c
Cszddl}|jdd�}|jdddddd	d
�|jdtdd
d�|jddddd�|jdddddd�|jddddd�|jdddddd �|jd!d"d#dd$d �|jd%d&d'd(d)�|jd*d+d,d-d.�|jd/d0d1td2d3�|j�}|j}|jr�ddl}|j|j�|_|j	dk	�r|j	}n|j
}|j�r�yJ|jd4k�r4tj
nt|j��$}x|D]}|j|j���qFWWdQRXWn2tk
�r�|jd5k�r�td6j|j��d7SX|jdk	�r�|j�p�d|_d8}y�|�r4xj|D]b}	tjj|	��rt|	|j|j|j|j|j��s*d7}n*t|	||j|j|j|j|j|jd9��s�d7}�q�W|St|j|j|jd:�SWn*tk
�rt|jd5k�rptd;�d7SXd8S)<zScript main program.rNz1Utilities to support installing Python libraries.)Zdescriptionz-lZstore_constrrz!don't recurse into subdirectories)�actionZconstr)�dest�helpz-r�	recursionzhcontrol the maximum recursion level. if `-l` and `-r` options are specified, then `-r` takes precedence.)�typerarbz-f�
store_truer%z/force rebuild even if timestamps are up to date)r`rarbz-q�countrzIoutput only error messages; -qq will suppress the error messages as well.)r`rar)rbz-br'z0use legacy (pre-PEP3147) compiled file locationsz-dZDESTDIRr
z�directory to prepend to file paths for use in compile-time tracebacks and in runtime tracebacks in cases where the source file is unavailable)�metavarrar)rbz-xZREGEXPr&zskip files matching the regular expression; the regexp is searched for in the full path of each file considered for compilationz-iZFILE�flistzzadd all the files and directories listed in FILE to the list considered for compilation; if "-", names are read from stdin)rgrarb�compile_destzFILE|DIR�*zrzero or more file and directory names to compile; if no arguments given, defaults to the equivalent of -l sys.path)rg�nargsrbz-jz	--workersr	zRun compileall concurrently)r)rdrb�-rzError reading file list {}FT)r.)r'r%rz
[interrupted]) �argparse�ArgumentParser�add_argumentrD�
parse_argsrir&�rerLrcrrhrP�stdinrI�append�striprrrrr.rrr?rr
r%r'rr�KeyboardInterrupt)
rm�parser�argsZ
compile_destsrqr�f�liner0rar"r"r#�main�s~








"



rz�__main__)Nrr���)rNFNrFr|r	r|)NFNrFr|r|)r	rFrFr|)�__doc__rrP�importlib.utilr@rKrG�	functoolsr�__all__rrrrrzrWrDZexit_status�exitr"r"r"r#�<module>s$


/
R
[types.cpython-36.opt-1.pyc000064400000020013150335715140011275 0ustar003


 \�"�@s�dZddlZdd�Zee�Zedd��Zeej�Zeej�Z	eej
�Zdd�Zee��Z
d	d
�Ze�Zee�Zej�dd�Ze�Zee�ZGd
d�d�Zee�j�Zee�Zegj�Zee�Zye�Wn:ek
�rej�dZee�Zeej�Z dZ[YnXeej�Z!eej"�Z#[[[[[fddfdd�Z$fdfdd�Z%dd�Z&Gdd�d�Z'ddl(Z)ddl*j+Z,Gdd�d�Z-dd�Z.dd�e/�D�Z0dS)zO
Define names for built-in types that aren't directly accessible as a builtin.
�NcCsdS)N�rrr�/usr/lib64/python3.6/types.py�_fsrcCsdS)Nrrrrr�<lambda>
srccs
dVdS)N�rrrrr�_gsrc�sdS)Nrrrrr�_csrcCs
dVdS)Nrrrrr�_agsr	c@seZdZdd�ZdS)�_CcCsdS)Nr)�selfrrr�_m!sz_C._mN)�__name__�
__module__�__qualname__rrrrrr
 sr
�cCs2t|||�\}}}|dk	r"||�||||f|�S)zBCreate a class object dynamically using the appropriate metaclass.N)�
prepare_class)�name�bases�kwds�	exec_body�meta�nsrrr�	new_class9srcCs~|dkri}nt|�}d|kr*|jd�}n|r<t|d�}nt}t|t�rTt||�}t|d�rp|j||f|�}ni}|||fS)azCall the __prepare__ method of the appropriate metaclass.

    Returns (metaclass, namespace, kwds) as a 3-tuple

    *metaclass* is the appropriate metaclass
    *namespace* is the prepared class namespace
    *kwds* is an updated copy of the passed in kwds argument with any
    'metaclass' entry removed. If no kwds argument is passed in, this will
    be an empty dict.
    N�	metaclassr�__prepare__)�dict�pop�type�
isinstance�_calculate_meta�hasattrr)rrrrrrrrr@s


rcCsB|}x8|D]0}t|�}t||�r"q
t||�r2|}q
td��q
W|S)z%Calculate the most derived metaclass.zxmetaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases)r�
issubclass�	TypeError)rr�winner�base�	base_metarrrr`s


rc@sLeZdZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�DynamicClassAttributeaRoute attribute access on a class to __getattr__.

    This is a descriptor, used to define attributes that act differently when
    accessed through an instance and through a class.  Instance access remains
    normal, but access to an attribute through a class will be routed to the
    class's __getattr__ method; this is done by raising AttributeError.

    This allows one to have properties active on an instance, and have virtual
    attributes on the class with the same name (see Enum for an example).

    NcCs>||_||_||_|p|j|_|dk|_tt|dd��|_dS)N�__isabstractmethod__F)�fget�fset�fdel�__doc__�
overwrite_doc�bool�getattrr')rr(r)r*�docrrr�__init__}s
zDynamicClassAttribute.__init__cCs6|dkr|jr|St��n|jdkr,td��|j|�S)Nzunreadable attribute)r'�AttributeErrorr()r�instance�
ownerclassrrr�__get__�s
zDynamicClassAttribute.__get__cCs"|jdkrtd��|j||�dS)Nzcan't set attribute)r)r1)rr2�valuerrr�__set__�s
zDynamicClassAttribute.__set__cCs |jdkrtd��|j|�dS)Nzcan't delete attribute)r*r1)rr2rrr�
__delete__�s
z DynamicClassAttribute.__delete__cCs8|jr|jnd}t|�||j|j|p(|j�}|j|_|S)N)r,r+rr)r*)rr(�fdoc�resultrrr�getter�szDynamicClassAttribute.gettercCs$t|�|j||j|j�}|j|_|S)N)rr(r*r+r,)rr)r9rrr�setter�szDynamicClassAttribute.settercCs$t|�|j|j||j�}|j|_|S)N)rr(r)r+r,)rr*r9rrr�deleter�szDynamicClassAttribute.deleter)NNNN)N)r
rrr+r0r4r6r7r:r;r<rrrrr&qs


	r&c@s�eZdZdd�Zdd�Zdd�Zdd�Zed	d
��Zedd��Z	ed
d��Z
edd��ZeZe	Z
e
ZeZdd�Zdd�ZeZdS)�_GeneratorWrappercCs2||_|jtk|_t|dd�|_t|dd�|_dS)Nr
r)�_GeneratorWrapper__wrapped�	__class__�
GeneratorType�_GeneratorWrapper__isgenr.r
r)r�genrrrr0�sz_GeneratorWrapper.__init__cCs|jj|�S)N)r>�send)r�valrrrrC�sz_GeneratorWrapper.sendcGs|jj|f|��S)N)r>�throw)r�tp�restrrrrE�sz_GeneratorWrapper.throwcCs
|jj�S)N)r>�close)rrrrrH�sz_GeneratorWrapper.closecCs|jjS)N)r>�gi_code)rrrrrI�sz_GeneratorWrapper.gi_codecCs|jjS)N)r>�gi_frame)rrrrrJ�sz_GeneratorWrapper.gi_framecCs|jjS)N)r>�
gi_running)rrrrrK�sz_GeneratorWrapper.gi_runningcCs|jjS)N)r>�gi_yieldfrom)rrrrrL�sz_GeneratorWrapper.gi_yieldfromcCs
t|j�S)N)�nextr>)rrrr�__next__�sz_GeneratorWrapper.__next__cCs|jr|jS|S)N)rAr>)rrrr�__iter__�sz_GeneratorWrapper.__iter__N)r
rrr0rCrErH�propertyrIrJrKrL�cr_code�cr_frame�
cr_running�cr_awaitrNrO�	__await__rrrrr=�sr=cs�t��std���jtkr�t�dd�jtkr��jj}|d@r@�S|d@r��j}t|j|j	|j
|j|jdB|j|j
|j|j|j|j|j|j|j|j��_�Stj���fdd��}|S)	z2Convert regular generator function to a coroutine.z$types.coroutine() expects a callable�__code__Ni�� �csT�||�}|jtks*|jtkr.|jjd@r.|St|tj�rPt|tj�rPt	|�S|S)NrX)
r?�
CoroutineTyper@rI�co_flagsr�_collections_abc�	Generator�	Coroutiner=)�args�kwargs�coro)�funcrr�wrapped�s

zcoroutine.<locals>.wrapped)�callabler"r?�FunctionTyper.�CodeTyperVrZ�co_argcount�co_kwonlyargcount�
co_nlocals�co_stacksize�co_code�	co_consts�co_names�co_varnames�co_filename�co_name�co_firstlineno�	co_lnotab�co_freevars�co_cellvars�
_functools�wraps)rarZ�corbr)rar�	coroutine�s(

rwcCs g|]}|dd�dkr|�qS)Nr�_r)�.0�nrrr�
<listcomp>
sr{)1r+�sysrrrd�
LambdaTyperVre�__dict__�MappingProxyType�implementation�SimpleNamespacerr@rrYrHr	�AsyncGeneratorTyper
r�
MethodType�len�BuiltinFunctionType�append�BuiltinMethodType�
ModuleTyper"�exc_info�tb�
TracebackType�tb_frame�	FrameType�GetSetDescriptorType�__globals__�MemberDescriptorTyperrrr&�	functoolsrt�collections.abc�abcr[r=rw�globals�__all__rrrr�<module>sR








 :
%7quopri.cpython-36.pyc000064400000013217150335715140010521 0ustar003


 \^�@s�dZddddgZdZdZdZdZyd	d
lmZmZWne	k
rPdZdZYnXdd
�Z
dd�Zddd�Zddd�Z
ddd�Zddd�Zdd�Zdd�Zdd�Zedkr�e�dS) zHConversions to/from quoted-printable transport encoding as per RFC 1521.�encode�decode�encodestring�decodestring�=�Ls0123456789ABCDEF��)�a2b_qp�b2a_qpNcCsHt|t�st�|dkr|S|dkr&|S|tkpFd|ko@dknS)z�Decide whether a particular byte ordinal needs to be quoted.

    The 'quotetabs' flag indicates whether embedded tabs and spaces should be
    quoted.  Note that line-ending tabs and spaces are always encoded, as per
    RFC 1521.
    s 	�_� �~)�
isinstance�bytes�AssertionError�ESCAPE)�c�	quotetabs�header�r�/usr/lib64/python3.6/quopri.py�needsquotingsrcCsBt|t�rt|�dkst�t|�}ttt|dt|df�S)zQuote a single character.��)rr�lenr�ordr�HEX)rrrr�quote$srFc
Cs<tdk	r,|j�}t|||d�}|j|�dS|dfdd�}d}x�|j�}|sNPg}	d}
|dd�dkrv|dd
�}d}
xL|D]D}t|f�}t|||�r�t|�}|r�|dkr�|	jd	�q||	j|�q|W|dk	r�||�tj	|	�}x:t
|�tk�r||dtd�d
d�|tdd�}q�W|}q@W|dk	�r8|||
d�dS)avRead 'input', apply quoted-printable encoding, and write to 'output'.

    'input' and 'output' are binary file objects. The 'quotetabs' flag
    indicates whether embedded tabs and spaces should be quoted. Note that
    line-ending tabs and spaces are always encoded, as per RFC 1521.
    The 'header' flag indicates whether we are encoding spaces as _ as per RFC
    1522.N)rr�
cSsj|r<|dd�dkr<|j|dd�t|dd��|�n*|dkrX|jt|�|�n|j||�dS)Nrs 	�.���r r )�writer)�s�output�lineEndrrrr!;s
(zencode.<locals>.writerrrrs=
)r$r r )r
�readr!�readlinerrr�append�EMPTYSTRING�joinr�MAXLINESIZE)
�inputr#rr�data�odatar!Zprevline�lineZoutline�strippedrZthislinerrrr,s@	





cCsFtdk	rt|||d�Sddlm}||�}|�}t||||�|j�S)N)rrr)�BytesIO)r
�ior0r�getvalue)r"rrr0�infp�outfprrrrjscCstdk	r*|j�}t||d�}|j|�dSd}�x�|j�}|s@Pdt|�}}|dkr�||d|�dkr�d}	|d}x.|dkr�||d|�dkr�|d}qxWnd}	�x.||k�r�|||d�}
|
dkr�|r�|d	}|d}q�|
tk�r�||
}|d}q�|d|k�r|	�rd}	Pq�|d|k�rV||d|d
�tk�rV|t}|d
}q�|d
|k�r�t||d|d
���r�t||d
|d���r�|tt||d|d��f�}|d}q�||
}|d}q�W|	s2|j|d�d}q2W|�r|j|�dS)z�Read 'input', apply quoted-printable decoding, and write to 'output'.
    'input' and 'output' are binary file objects.
    If 'header' is true, decode underscore as space (per RFC 1522).N)rrrrrs 	
rr��)	r	r%r!r&rr�ishexr�unhex)r+r#rr,r-�newr.�i�n�partialrrrrrusR



(
B"
cCsDtdk	rt||d�Sddlm}||�}|�}t|||d�|j�S)N)rr)r0)r	r1r0rr2)r"rr0r3r4rrrr�scCsVt|t�st�d|ko dknpTd|ko8dknpTd|koPdkSS)zDReturn true if the byte ordinal 'c' is a hexadecimal digit in ASCII.�0�9�a�f�A�F)rrr)rrrrr7�sr7cCs�d}x�|D]�}t|f�}d|ko*dknr:td�}n`d|koLdknr`td�d}n:d	|kord
knr�td	�d}nds�tdt|���|d
t|�|}q
W|S)z.Get the integer value of a hexadecimal number.rr=r>�0r?r@�a�
rArBFznon-hex digit r)rrr�repr)r"�bitsrr:rrrr8�s


r8c(Cs�ddl}ddl}y|j|jdd�d�\}}WnV|jk
r�}z8|j|_t|�td�td�td�|jd�WYdd}~XnXd}d}x(|D] \}}|dkr�d}|d	kr�d}q�W|r�|r�|j|_td
�|jd�|s�dg}d}	x�|D]�}
|
dk�r|jj	}nNyt
|
d�}Wn>tk
�rR}z |jjd
|
|f�d}	w�WYdd}~XnXz*|�rlt
||jj	�nt||jj	|�Wd|
dk�r�|j�Xq�W|	�r�|j|	�dS)NrrZtdz"usage: quopri [-t | -d] [file] ...z-t: quote tabsz-d: decode; default encoder5z-tz-dz -t and -d are mutually exclusive�-�rbz%s: can't open (%s)
)�sys�getopt�argv�error�stderr�stdout�print�exit�stdin�buffer�open�OSErrorr!rr�close)rJrKZopts�args�msgZdecoZtabs�orD�sts�file�fprrr�main�sT




r]�__main__)F)FF)F)F)�__doc__�__all__rr*rr(Zbinasciir	r
�ImportErrorrrrrrrr7r8r]�__name__rrrr�<module>s*

>

+
._bootlocale.cpython-36.opt-2.pyc000064400000001331150335715140012416 0ustar003


 \�@s`ddlZddlZejjd�r(ddd�Zn4y
ejWnek
rPd	dd�ZYnXd
dd�ZdS)�N�winTcCstj�dS)N�)�_localeZ_getdefaultlocale)�do_setlocale�r�#/usr/lib64/python3.6/_bootlocale.py�getpreferredencodingsrcCsddl}|j|�S)Nr)�localer)rr	rrrrscCs$tjtj�}|r tjdkr d}|S)N�darwinzUTF-8)r�nl_langinfo�CODESET�sys�platform)r�resultrrrrs)T)T)T)r
rr�
startswithrr�AttributeErrorrrrr�<module>s
telnetlib.cpython-36.pyc000064400000043263150335715140011170 0ustar003


 \`Z�@sJdZddlZddlZddlZddlmZdgZdZdZ	e
dg�Ze
dg�Ze
dg�Z
e
d	g�Ze
d
g�Ze
dg�Ze
dg�Ze
dg�Ze
d
g�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Z e
dg�Z!e
dg�Z"e
dg�Z#e
dg�Z$e
dg�Z%e
dg�Z&e
d g�Z'e
d!g�Z(e
d"g�Z)e
d#g�Z*e
d$g�Z+e
d%g�Z,e
d&g�Z-e
d'g�Z.e
d(g�Z/e
d)g�Z0e
d*g�Z1e
d+g�Z2e
dg�Z3e
d,g�Z4e
d-g�Z5e
d.g�Z6e
d/g�Z7e
d0g�Z8e
d1g�Z9e
d2g�Z:e
d3g�Z;e
d4g�Z<e
d5g�Z=e
d6g�Z>e
d7g�Z?e
d8g�Z@e
d9g�ZAe
d:g�ZBe
d;g�ZCe
d<g�ZDe
d=g�ZEe
d>g�ZFe
d?g�ZGe
d@g�ZHe
dAg�ZIe
dBg�ZJe
dCg�ZKe
dDg�ZLe
dEg�ZMe
dFg�ZNe
dGg�ZOe
dHg�ZPe
dg�ZQe
dg�ZReSedI��rejTZUnejVZUGdJd�d�ZWdKdL�ZXeYdMk�rFeX�dS)NaQTELNET client class.

Based on RFC 854: TELNET Protocol Specification, by J. Postel and
J. Reynolds

Example:

>>> from telnetlib import Telnet
>>> tn = Telnet('www.python.org', 79)   # connect to finger port
>>> tn.write(b'guido\r\n')
>>> print(tn.read_all())
Login       Name               TTY         Idle    When    Where
guido    Guido van Rossum      pts/2        <Dec  2 11:10> snag.cnri.reston..

>>>

Note that read_all() won't read until eof -- it just reads some data
-- but it guarantees to read at least one byte unless EOF is hit.

It is possible to pass a Telnet object to a selector in order to wait until
more data is available.  Note that in this case, read_eager() may return b''
even if there was data on the socket, because the protocol negotiation may have
eaten the data.  This is why EOFError is needed in some cases to distinguish
between "no data" and "connection closed" (since the socket also appears ready
for reading when it is closed).

To do:
- option negotiation
- timeout should be intrinsic to the connection object instead of an
  option on one of the read calls only

�N)�	monotonic�Telnet�������������������������������	�
���
������������������ �!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�0�1����PollSelectorc@seZdZdZddejfdd�Zdejfdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zd<dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd=d6d7�Zd8d9�Z d:d;�Z!dS)>ra�Telnet interface class.

    An instance of this class represents a connection to a telnet
    server.  The instance is initially not connected; the open()
    method must be used to establish a connection.  Alternatively, the
    host name and optional port number can be passed to the
    constructor, too.

    Don't try to reopen an already connected instance.

    This class has many read_*() methods.  Note that some of them
    raise EOFError when the end of the connection is read, because
    they can return an empty string for other reasons.  See the
    individual doc strings.

    read_until(expected, [timeout])
        Read until the expected string has been seen, or a timeout is
        hit (default is no timeout); may block.

    read_all()
        Read all data until EOF; may block.

    read_some()
        Read at least one byte or EOF; may block.

    read_very_eager()
        Read all data available already queued or on the socket,
        without blocking.

    read_eager()
        Read either data already queued or some data available on the
        socket, without blocking.

    read_lazy()
        Read all data in the raw queue (processing it first), without
        doing any socket I/O.

    read_very_lazy()
        Reads all data in the cooked queue, without doing any socket
        I/O.

    read_sb_data()
        Reads available data between SB ... SE sequence. Don't block.

    set_option_negotiation_callback(callback)
        Each time a telnet option is read on the input flow, this callback
        (if set) is called with the following parameters :
        callback(telnet socket, command, option)
            option will be chr(0) when there is no option.
        No other action is done afterwards by telnetlib.

    NrcCsht|_||_||_||_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
|dk	rd|j|||�dS)z�Constructor.

        When called without arguments, create an unconnected instance.
        With a hostname argument, it connects the instance; port number
        and timeout are optional.
        N�r)�
DEBUGLEVEL�
debuglevel�host�port�timeout�sock�rawq�irawq�cookedq�eof�iacseq�sb�sbdataq�option_callback�open)�selfrLrMrN�rZ�!/usr/lib64/python3.6/telnetlib.py�__init__�szTelnet.__init__cCs6d|_|st}||_||_||_tj||f|�|_dS)z�Connect to a host.

        The optional second argument is the port number, which
        defaults to the standard telnet port (23).

        Don't try to reopen an already connected instance.
        rN)rS�TELNET_PORTrLrMrN�socketZcreate_connectionrO)rYrLrMrNrZrZr[rX�szTelnet.opencCs|j�dS)z#Destructor -- close the connection.N)�close)rYrZrZr[�__del__�szTelnet.__del__cGs@|jdkr<td|j|jfdd�|r4t||�nt|�dS)z�Print a debug message, when the debug level is > 0.

        If extra arguments are present, they are substituted in the
        message using the standard string formatting operator.

        rzTelnet(%s,%s):� )�endN)rK�printrLrM)rY�msg�argsrZrZr[rd�s

z
Telnet.msgcCs
||_dS)zhSet the debug level.

        The higher it is, the more debug output you get (on sys.stdout).

        N)rK)rYrKrZrZr[�set_debuglevel�szTelnet.set_debuglevelcCs.|j}d|_d|_d|_d|_|r*|j�dS)zClose the connection.NTrIr)rOrSrTrUr_)rYrOrZrZr[r_szTelnet.closecCs|jS)z)Return the socket object used internally.)rO)rYrZrZr[�
get_socketszTelnet.get_socketcCs
|jj�S)z9Return the fileno() of the socket object used internally.)rO�fileno)rYrZrZr[rhsz
Telnet.filenocCs4t|kr|jttt�}|jd|�|jj|�dS)z�Write a string to the socket, doubling any IAC characters.

        Can block if the connection is blocked.  May raise
        OSError if the connection is closed.

        zsend %rN)�IAC�replacerdrO�sendall)rY�bufferrZrZr[�writeszTelnet.writecCs t|�}|j�|jj|�}|dkrN||}|jd|�}|j|d�|_|S|dk	r`t�|}t���}|j|tj�x�|j	�s|j
|�r�tdt|j�|�}|j�|j�|jj||�}|dkr�||}|jd|�}|j|d�|_|S|dk	rx|t�}|dkrxPqxWWdQRX|j
�S)aRead until a given string is encountered or until timeout.

        When no match is found, return whatever is available instead,
        possibly the empty string.  Raise EOFError if the connection
        is closed and no cooked data is available.

        rN)�len�process_rawqrR�find�_time�_TelnetSelector�register�	selectors�
EVENT_READrS�select�max�	fill_rawq�read_very_lazy)rY�matchrN�n�i�buf�deadline�selectorrZrZr[�
read_until$s8



zTelnet.read_untilcCs4|j�x|js"|j�|j�q
W|j}d|_|S)z7Read all data until EOF; block until connection closed.rI)rorSrxrR)rYr}rZrZr[�read_allIszTelnet.read_allcCs>|j�x$|jr,|jr,|j�|j�q
W|j}d|_|S)z�Read at least one byte of cooked data unless EOF is hit.

        Return b'' if EOF is hit.  Block if no data is immediately
        available.

        rI)rorRrSrx)rYr}rZrZr[�	read_someSszTelnet.read_somecCs6|j�x$|jr,|j�r,|j�|j�q
W|j�S)aRead everything that's possible without blocking in I/O (eager).

        Raise EOFError if connection closed and no cooked data
        available.  Return b'' if no cooked data available otherwise.
        Don't block unless in the midst of an IAC sequence.

        )rorS�
sock_availrxry)rYrZrZr[�read_very_eagerbs
zTelnet.read_very_eagercCs>|j�x,|jr4|jr4|j�r4|j�|j�q
W|j�S)z�Read readily available data.

        Raise EOFError if connection closed and no cooked data
        available.  Return b'' if no cooked data available otherwise.
        Don't block unless in the midst of an IAC sequence.

        )rorRrSr�rxry)rYrZrZr[�
read_eagerps
zTelnet.read_eagercCs|j�|j�S)aProcess and return data that's already in the queues (lazy).

        Raise EOFError if connection closed and no data available.
        Return b'' if no cooked data available otherwise.  Don't block
        unless in the midst of an IAC sequence.

        )rory)rYrZrZr[�	read_lazy~szTelnet.read_lazycCs,|j}d|_|r(|jr(|jr(td��|S)z�Return any data available in the cooked queue (very lazy).

        Raise EOFError if connection closed and no data available.
        Return b'' if no cooked data available otherwise.  Don't block.

        rIztelnet connection closed)rRrSrP�EOFError)rYr}rZrZr[ry�s
zTelnet.read_very_lazycCs|j}d|_|S)aReturn any data available in the SB ... SE queue.

        Return b'' if no SB ... SE available. Should only be called
        after seeing a SB or SE command. When a new SB command is
        found, old unread SB data will be discarded. Don't block.

        rI)rV)rYr}rZrZr[�read_sb_data�szTelnet.read_sb_datacCs
||_dS)zIProvide a callback function called after each receipt of a telnet option.N)rW)rY�callbackrZrZr[�set_option_negotiation_callback�sz&Telnet.set_option_negotiation_callbackcCsXddg}�y�x�|j�r|j�}|jsj|tkr0q|dkr:q|tkrZ||j|||j<qn|j|7_qt|j�dk�r(|ttt	t
fkr�|j|7_qd|_|tkr�||j|||j<nh|tkr�d|_d|_n&|t
kr�d|_|j|d|_d|d<|j�r|j|j|t�n|jdt|��qt|j�dkr|jdd�}d|_|}|ttfk�r�|jd|tk�rrd�ptd	t|��|j�r�|j|j||�n|jjtt
|�q|t	t
fkr|jd|t	k�r�d
�p�dt|��|j�r�|j|j||�q|jjtt|�qWWn"tk
�r2d|_d|_YnX|j|d|_|j|d|_dS)
z�Transfer from raw queue to cooked queue.

        Set self.eof when connection is closed.  Don't block unless in
        the midst of an IAC sequence.

        rI�rrzIAC %d not recognizedrz	IAC %s %d�DO�DONT�WILL�WONTN)rP�rawq_getcharrT�theNULLrirUrnr�r�r�r��SBrV�SErWrO�NOOPTrd�ordrkr�rR)rYr}�c�cmd�optrZrZr[ro�shzTelnet.process_rawqcCsZ|js|j�|jrt�|j|j|jd�}|jd|_|jt|j�krVd|_d|_|S)z�Get next char from raw queue.

        Block if no data is immediately available.  Raise EOFError
        when connection is closed.

        rrIr)rPrxrSr�rQrn)rYr�rZrZr[r��szTelnet.rawq_getcharcCsL|jt|j�krd|_d|_|jjd�}|jd|�||_|j||_dS)z�Fill raw queue from exactly one recv() system call.

        Block if no data is immediately available.  Set self.eof when
        connection is closed.

        rIr�2zrecv %rN)rQrnrPrOZrecvrdrS)rYr}rZrZr[rxszTelnet.fill_rawqc
Cs.t��}|j|tj�t|jd��SQRXdS)z-Test whether data is available on the socket.rN)rrrsrtru�boolrv)rYrrZrZr[r�szTelnet.sock_availcCs�tjdkr|j�dSt���}|j|tj�|jtjtj�x�x�|j�D]�\}}|j	|kr�y|j
�}Wntk
r�td�dSX|r�tj
j|jd��tj
j�qH|j	tjkrHtjj�jd�}|s�dS|j|�qHWq>WWdQRXdS)z9Interaction function, emulates a very dumb telnet client.Zwin32Nz(*** Connection closed by remote host ***�ascii)�sys�platform�mt_interactrrrsrtru�stdinrvZfileobjr�r�rc�stdoutrm�decode�flush�readline�encode)rYr�keyZevents�text�linerZrZr[�interacts,

zTelnet.interactcCs@ddl}|j|jf�x$tjj�}|s(P|j|jd��qWdS)z$Multithreaded version of interact().rNr�)�_thread�start_new_thread�listenerr�r�r�rmr�)rYr�r�rZrZr[r�1s
zTelnet.mt_interactcCsVxPy|j�}Wntk
r*td�dSX|rDtjj|jd��qtjj�qWdS)z>Helper for mt_interact() -- this executes in the other thread.z(*** Connection closed by remote host ***Nr�)r�r�rcr�r�rmr�r�)rY�datarZrZr[r�;szTelnet.listenercCsPd}|dd�}tt|��}x8|D]0}t||d�s"|s@ddl}|j||�||<q"W|dk	rht�|}t���}|j|tj	�x�|j
�s|j�xP|D]H}||j|j
�}|r�|j�}	|j
d|	�}
|j
|	d�|_
|||
fSq�W|dk	�r|j|�}|t�}|�s|dkr�Pnq�|j�q�WWdQRX|j�}
|
�rF|j
�rFt�dd|
fS)a�Read until one from a list of a regular expressions matches.

        The first argument is a list of regular expressions, either
        compiled (re.RegexObject instances) or uncompiled (strings).
        The optional second argument is a timeout, in seconds; default
        is no timeout.

        Return a tuple of three items: the index in the list of the
        first regular expression that matches; the match object
        returned; and the text read up till and including the match.

        If EOF is read and no text was read, raise EOFError.
        Otherwise, when nothing matches, return (-1, None, text) where
        text is the text received so far (may be the empty string if a
        timeout happened).

        If a regular expression ends with a greedy match (e.g. '.*')
        or if more than one expression can match the same input, the
        results are undeterministic, and may depend on the I/O timing.

        N�searchrr���)�rangern�hasattr�re�compilerqrrrsrtrurSror�rRrbrvrxryr�)rY�listrNr��indicesr|r~r�m�er�ZreadyrZrZr[�expectHsB






z
Telnet.expectcCs|S)NrZ)rYrZrZr[�	__enter__�szTelnet.__enter__cCs|j�dS)N)r_)rY�type�value�	tracebackrZrZr[�__exit__�szTelnet.__exit__)N)N)"�__name__�
__module__�__qualname__�__doc__r^Z_GLOBAL_DEFAULT_TIMEOUTr\rXr`rdrfr_rgrhrmr�r�r�r�r�r�ryr�r�ror�rxr�r�r�r�r�r�r�rZrZrZr[r�s<5

%

H

8cCs�d}x0tjdd�r4tjddkr4|d}tjd=qWd}tjdd�rRtjd}d}tjdd�r�tjd}yt|�}Wn tk
r�tj|d�}YnXt��(}|j|�|j||dd	�|j	�WdQRXdS)
z�Test program for telnetlib.

    Usage: python telnetlib.py [-d] ... [host [port]]

    Default host is localhost; default port is 23.

    rrNz-dZ	localhostrZtcpg�?)rN)
r��argv�int�
ValueErrorr^Z
getservbynamerrfrXr�)rKrLrMZportstrZtnrZrZr[�test�s$


r��__main__)Zr�r�r^rtZtimerrq�__all__rJr]�bytesrir�r�r�r�r�r�ZNOPZDMZBRKZIPZAOZAYTZECZELZGAr�ZBINARYZECHOZRCPZSGAZNAMSZSTATUSZTMZRCTEZNAOLZNAOPZNAOCRDZNAOHTSZNAOHTDZNAOFFDZNAOVTSZNAOVTDZNAOLFDZXASCIIZLOGOUTZBMZDETZSUPDUPZSUPDUPOUTPUTZSNDLOCZTTYPEZEORZTUIDZOUTMRKZTTYLOCZVT3270REGIMEZX3PADZNAWSZTSPEEDZLFLOWZLINEMODEZXDISPLOCZOLD_ENVIRONZAUTHENTICATIONZENCRYPTZNEW_ENVIRONZTN3270EZXAUTH�CHARSETZRSPZCOM_PORT_OPTIONZSUPPRESS_LOCAL_ECHOZTLSZKERMITZSEND_URLZ	FORWARD_XZPRAGMA_LOGONZ
SSPI_LOGONZPRAGMA_HEARTBEATZEXOPLr�r�rHrrZSelectSelectorrr�r�rZrZrZr[�<module> s�







































































}
__phello__.foo.cpython-36.pyc000064400000000171150335715140012036 0ustar003


 \@�@sdS)N�rrr�&/usr/lib64/python3.6/__phello__.foo.py�<module>simaplib.cpython-36.opt-2.pyc000064400000066271150335715140011567 0ustar003


 \/��2@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
m
Z
mZmZddl
mZyddlZdZWnek
r�dZYnXddd	d
ddgZd
ZdZdZdZdfZdZdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�)Zejd�Zejd�Zejd�Zejdej�Zejd�Z ejd�Z!ejd�Z"ejdej�Z#dZ$dZ%Gdd�d�Z&e�r�Gd d!�d!e&�Z'ej(d!�Gd"d�de&�Z)Gd#d$�d$�Z*d%j+d&�Z,d'd(�e-e,d)d��D�Z.d*d	�Z/d+d
�Z0d,d�Z1d-d�Z2e3d.k�r�ddl4Z4ddl5Z5ye4j4ej6d)d�d/�\Z7Z8Wn0e4j9k
�rnZ:zffZ7Z8WYddZ:[:XnXdZ;x@e7D]8\Z<Z:e<d0k�r�e=e:�Zne<d1k�rze:Z;e8�sze;fZ8�qzWe8�s�d�Z8e8dZ>e5j?�Z@e5j5d3e@e>�p�d4f�ZAd5e@d6d7�ZBd8e@eAffd�d�d�d?d>ddeBffd�d�d�d�d�dMffdNffdOffdPfffZCdCffd�d�d�d?dddeBffdOffdWfffZDdXdY�ZE�y&e;�r�e)e;�ZFne&e>�ZFeFjGdk�r�eCd)d�ZCeFjHdZeFjI�eFjHd[eFjJf�xeCD]\ZKZ8eEeKe8��q�WxJeEd@d��D]<ZLejMd^eL�ZNeN�reNjOd)�ZPneLj+�d�ZPeEd_ePf��q�Wx\eDD]T\ZKZ8eEeKe8�ZQeKe8fd�k�rV�q2eQd�j+�ZReR�sl�q2eEdSd`daeRd�dbf��q2WeSdc�Wn.eSdd�e�s�eSdeej6d��YnXdS)�z2.58�N)�datetime�timezone�	timedelta)�DEFAULT_BUFFER_SIZETF�IMAP4�IMAP4_stream�Internaldate2tuple�Int2AP�
ParseFlags�Time2Internaldates
�i��	IMAP4REV1i@B�AUTH�SELECTED�NONAUTH�LOGOUT))�APPEND�AUTHENTICATE�
CAPABILITY�CHECK�CLOSE�COPY�CREATE�DELETE�	DELETEACL�ENABLE�EXAMINE�EXPUNGE�FETCH�GETACL�
GETANNOTATION�GETQUOTA�GETQUOTAROOT�MYRIGHTS�LIST�LOGINr�LSUBZMOVE�	NAMESPACE�NOOP�PARTIAL�	PROXYAUTH�RENAME�SEARCH�SELECT�SETACL�
SETANNOTATION�SETQUOTA�SORT�STARTTLS�STATUS�STORE�	SUBSCRIBE�THREAD�UID�UNSUBSCRIBEs\+( (?P<data>.*))?s.*FLAGS \((?P<flags>[^\)]*)\)s�.*INTERNALDATE "(?P<day>[ 0123][0-9])-(?P<mon>[A-Z][a-z][a-z])-(?P<year>[0-9][0-9][0-9][0-9]) (?P<hour>[0-9][0-9]):(?P<min>[0-9][0-9]):(?P<sec>[0-9][0-9]) (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])"s.*{(?P<size>\d+)}$s
\r\n|\r|\ns%\[(?P<type>[A-Z-]+)( (?P<data>.*))?\]s$\* (?P<type>[A-Z-]+)( (?P<data>.*))?s3\* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?c@s�eZdZGdd�de�ZGdd�de�ZGdd�de�Zdefdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdefdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Z d:d;�Z!d<d=�Z"d>d?�Z#d@dA�Z$dBdC�Z%dDdE�Z&dFdG�Z'd�dJdK�Z(dLdM�Z)dNdO�Z*dPdQ�Z+dRdS�Z,d�dTdU�Z-dVdW�Z.dXdY�Z/dZd[�Z0d\d]�Z1d^d_�Z2d`da�Z3dbdc�Z4d�dfdg�Z5dhdi�Z6djdk�Z7dldm�Z8dndo�Z9d�dqdr�Z:dsdt�Z;dudv�Z<dwdx�Z=dydz�Z>d{d|�Z?d}d~�Z@dd��ZAd�d��ZBd�d��ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGd�d��ZHd�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNdpS)�rc@seZdZdS)zIMAP4.errorN)�__name__�
__module__�__qualname__�r<r<�/usr/lib64/python3.6/imaplib.py�error�sr>c@seZdZdS)zIMAP4.abortN)r9r:r;r<r<r<r=�abort�sr?c@seZdZdS)zIMAP4.readonlyN)r9r:r;r<r<r<r=�readonly�sr@�cCs�t|_d|_d|_i|_i|_d|_d|_d|_d|_	|j
�|j||�y|j�Wn8t
k
r�y|j�Wntk
r�YnX�YnXdS)NrrAFr)�Debug�debug�state�literal�tagged_commands�untagged_responses�continuation_response�is_readonly�tagnum�_tls_established�_mode_ascii�open�_connect�	Exception�shutdown�OSError)�self�host�portr<r<r=�__init__�s&zIMAP4.__init__cCs0d|_d|_tjttj�|_tjttj�|_dS)NF�ascii)	�utf8_enabled�	_encoding�re�compile�_Literal�ASCII�Literal�_Untagged_status�Untagged_status)rRr<r<r=rL�szIMAP4._mode_asciicCs(d|_d|_tjt�|_tjt�|_dS)NTzutf-8)rWrXrYrZr[r]r^r_)rRr<r<r=�
_mode_utf8�szIMAP4._mode_utf8cCs�ttjdd��|_tjd|jdtj�|_|j�|_	d|j
krHd|_nd|j
krZd|_n|j|j	��|j
�x tD]}||jkr�qt||_dSW|jd	��dS)
Nii��s(?P<tag>s"\d+) (?P<type>[A-Z]+) (?P<data>.*)ZPREAUTHr�OKrzserver not IMAP4 compliant)r	�randomZrandint�tagprerYrZr\�tagre�
_get_responseZwelcomerGrDr>�_get_capabilities�AllowedVersions�capabilities�PROTOCOL_VERSION)rR�versionr<r<r=rN�s 




zIMAP4._connectcCs&|tkrt||j��Std|��dS)NzUnknown IMAP4 command: '%s')�Commands�getattr�lower�AttributeError)rR�attrr<r<r=�__getattr__	szIMAP4.__getattr__cCs|S)Nr<)rRr<r<r=�	__enter__szIMAP4.__enter__cGs&y|j�Wntk
r YnXdS)N)�logoutrQ)rR�argsr<r<r=�__exit__szIMAP4.__exit__cCs |js
dn|j}tj||jf�S)N)rS�socketZcreate_connectionrT)rRrSr<r<r=�_create_socketszIMAP4._create_socketcCs(||_||_|j�|_|jjd�|_dS)N�rb)rSrTrv�sock�makefile�file)rRrSrTr<r<r=rM#s
z
IMAP4.opencCs|jj|�S)N)rz�read)rR�sizer<r<r=r{/sz
IMAP4.readcCs.|jjtd�}t|�tkr*|jdt��|S)N�zgot more than %d bytes)rz�readline�_MAXLINE�lenr>)rR�liner<r<r=r~4szIMAP4.readlinecCs|jj|�dS)N)rxZsendall)rR�datar<r<r=�send<sz
IMAP4.sendcCst|jj�zXy|jjtj�Wn@tk
r^}z$|jtjkrNt	|dd�dkrN�WYdd}~XnXWd|jj�XdS)NZwinerrorri&')
rz�closerxrPruZ	SHUT_RDWRrQ�errnoZENOTCONNrl)rR�excr<r<r=rPAs
zIMAP4.shutdowncCs|jS)N)rx)rRr<r<r=ruQszIMAP4.socketcCsBd}|jddg|�\}}|dr(||fS|j�\}}|j|||�S)NZRECENTrar}���)�_untagged_response�noop)rR�name�typ�datr<r<r=�recent]s	zIMAP4.recentcCs|j|dg|j��S)N)r��upper)rR�coder<r<r=�responsenszIMAP4.responsecCsxd}|sd}|r.|d|d
fdkr2d|}nd}|r@t|�}nd}tjt|�}|jrbd|d	}||_|j||||�S)Nr�INBOXrr}�(�)z(%s)sUTF8 (�)r�)r�r�)r�MapCRLF�sub�CRLFrWrE�_simple_command)rR�mailbox�flags�	date_time�messager�rEr<r<r=�append|s

zIMAP4.appendcCsP|j�}t|�j|_|jd|�\}}|dkrB|j|djdd���d|_||fS)Nrrar}zutf-8�replacerr�)r��_Authenticator�processrEr�r>�decoderD)rRZ	mechanismZ
authobject�mechr�r�r<r<r=�authenticate�szIMAP4.authenticatecCs d}|j|�\}}|j|||�S)Nr)r�r�)rRr�r�r�r<r<r=�
capability�szIMAP4.capabilitycCs
|jd�S)Nr)r�)rRr<r<r=�check�szIMAP4.checkcCs$z|jd�\}}Wdd|_X||fS)Nrr)r�rD)rRr�r�r<r<r=r��szIMAP4.closecCs|jd||�S)Nr)r�)rR�message_setZnew_mailboxr<r<r=�copy�sz
IMAP4.copycCs|jd|�S)Nr)r�)rRr�r<r<r=�create�szIMAP4.createcCs|jd|�S)Nr)r�)rRr�r<r<r=�delete�szIMAP4.deletecCs|jd||�S)Nr)r�)rRr��whor<r<r=�	deleteacl�szIMAP4.deleteaclcCsHd|jkrtjd��|jd|�\}}|dkr@d|j�kr@|j�||fS)NrzServer does not support ENABLErazUTF8=ACCEPT)rhrr>r�r�r`)rRr�r�r�r<r<r=�enable�s

zIMAP4.enablecCs d}|j|�\}}|j|||�S)Nr)r�r�)rRr�r�r�r<r<r=�expunge�s	z
IMAP4.expungecCs$d}|j|||�\}}|j|||�S)Nr)r�r�)rRr�Z
message_partsr�r�r�r<r<r=�fetchs
zIMAP4.fetchcCs|jd|�\}}|j||d�S)NrZACL)r�r�)rRr�r�r�r<r<r=�getaclszIMAP4.getaclcCs"|jd|||�\}}|j||d�S)Nr �
ANNOTATION)r�r�)rRr��entryZ	attributer�r�r<r<r=�
getannotation#szIMAP4.getannotationcCs|jd|�\}}|j||d�S)Nr!�QUOTA)r�r�)rR�rootr�r�r<r<r=�getquota+szIMAP4.getquotacCs@|jd|�\}}|j||d�\}}|j||d�\}}|||gfS)Nr"r�Z	QUOTAROOT)r�r�)rRr�r�r�ZquotaZ	quotarootr<r<r=�getquotaroot6szIMAP4.getquotaroot�""�*cCs$d}|j|||�\}}|j|||�S)Nr$)r�r�)rR�	directory�patternr�r�r�r<r<r=�listAsz
IMAP4.listcCs<|jd||j|��\}}|dkr.|j|d��d|_||fS)Nr%rar}rr�)r��_quoter>rD)rR�user�passwordr�r�r<r<r=�loginMs
zIMAP4.logincCs|||_|_|jd|j�S)NzCRAM-MD5)r�r�r��_CRAM_MD5_AUTH)rRr�r�r<r<r=�login_cram_md5[szIMAP4.login_cram_md5cCsBddl}t|jt�r |jjd�n|j}|jd|j||d�j�S)Nrzutf-8� Zmd5)�hmac�
isinstancer��str�encoder�ZHMACZ	hexdigest)rRZ	challenger��pwdr<r<r=r�dszIMAP4._CRAM_MD5_AUTHcCsjd|_y|jd�\}}Wn(ddtj�dd�g}}YnX|j�d|jkrbd|jdfS||fS)Nr�NOz%s: %s��BYE)rDr��sys�exc_inforPrG)rRr�r�r<r<r=rrls"
zIMAP4.logoutcCs$d}|j|||�\}}|j|||�S)Nr&)r�r�)rRr�r�r�r�r�r<r<r=�lsub|sz
IMAP4.lsubcCs|jd|�\}}|j||d�S)Nr#)r�r�)rRr�r�r�r<r<r=�myrights�szIMAP4.myrightscCs d}|j|�\}}|j|||�S)Nr')r�r�)rRr�r�r�r<r<r=�	namespace�szIMAP4.namespacecCs
|jd�S)Nr()r�)rRr<r<r=r��sz
IMAP4.noopcCs(d}|j|||||�\}}|j||d�S)Nr)r)r�r�)rRZmessage_numZmessage_part�startZlengthr�r�r�r<r<r=�partial�sz
IMAP4.partialcCsd}|jd|�S)Nr*)r�)rRr�r�r<r<r=�	proxyauth�s	zIMAP4.proxyauthcCs|jd||�S)Nr+)r�)rRZ
oldmailboxZ
newmailboxr<r<r=�rename�szIMAP4.renamecGsTd}|r2|jrtjd��|j|d|f|��\}}n|j|f|��\}}|j|||�S)Nr,z'Non-None charset not valid in UTF8 mode�CHARSET)rWrr>r�r�)rR�charsetZcriteriar�r�r�r<r<r=�search�s
zIMAP4.searchr�FcCsxi|_||_|rd}nd}|j||�\}}|dkr@d|_||fSd|_d|jkrd|rd|jd|��||jjddg�fS)	Nrr-rarrz	READ-ONLYz%s is not writable�EXISTS)rGrIr�rDr@�get)rRr�r@r�r�r�r<r<r=�select�s
zIMAP4.selectcCs|jd|||�S)Nr.)r�)rRr�r�Zwhatr<r<r=�setacl�szIMAP4.setaclcGs |jd|��\}}|j||d�S)Nr/r�)r/)r�r�)rRrsr�r�r<r<r=�
setannotation�szIMAP4.setannotationcCs |jd||�\}}|j||d�S)Nr0r�)r�r�)rRr�Zlimitsr�r�r<r<r=�setquotaszIMAP4.setquotacGsFd}|d|dfdkr d|}|j|||f|��\}}|j|||�S)	Nr1rr}r�r�z(%s)r�)r�r�)r�r�)rRZ
sort_criteriar��search_criteriar�r�r�r<r<r=�sorts
z
IMAP4.sortNcCs�d}ts|jd��|jr"|jd��||jkr6|jd��|dkrFtj�}|j|�\}}|dkr�|j|j	|j
d�|_	|j	jd�|_d|_|j
�n
|jd	��|j|||�S)
Nr2zSSL support missingzTLS session already establishedzTLS not supported by serverra)�server_hostnamerwTzCouldn't establish TLS session)�HAVE_SSLr>rKr?rh�ssl�_create_stdlib_contextr��wrap_socketrxrSryrzrfr�)rR�ssl_contextr�r�r�r<r<r=�starttlss$





zIMAP4.starttlscCs$d}|j|||�\}}|j|||�S)Nr3)r�r�)rRr��namesr�r�r�r<r<r=�status5szIMAP4.statuscCs>|d|dfd	krd|}|jd|||�\}}|j||d�S)
Nrr}r�r�z(%s)r4rr�)r�r�)r�r�)rRr��commandr�r�r�r<r<r=�storeAszIMAP4.storecCs|jd|�S)Nr5)r�)rRr�r<r<r=�	subscribeLszIMAP4.subscribecGs*d}|j|||f|��\}}|j|||�S)Nr6)r�r�)rRZthreading_algorithmr�r�r�r�r�r<r<r=�threadTszIMAP4.threadcGs�|j�}|tkr|jd|��|jt|krL|jd||jdjt|�f��d}|j||f|��\}}|d	krt|}nd}|j|||�S)
NzUnknown IMAP4 UID command: %sz9command %s illegal in state %s, only allowed in states %sz, r7r,r1r6r)r,r1r6)r�rkr>rD�joinr�r�)rRr�rsr�r�r�r<r<r=�uid^sz	IMAP4.uidcCs|jd|�S)Nr8)r�)rRr�r<r<r=�unsubscribewszIMAP4.unsubscribecGs,|j�}|tkr|jft|<|j|f|��S)N)r�rkrDr�)rRr�rsr<r<r=�xatoms
zIMAP4.xatomcCs8|dkrd}|j}||kr*||j|�n
|g||<dS)N�)rGr�)rRr�r�Zurr<r<r=�_append_untagged�szIMAP4._append_untaggedcCs,|jjd�}|r(|j|dj|jd���dS)Nr�r}r�r�)rGr�r?r�rX)rRZbyer<r<r=�
_check_bye�szIMAP4._check_byec
Gs�|jt|kr4d|_|jd||jdjt|�f��xdD]}||jkr:|j|=q:Wd|jkrp|jrp|jd��|j�}t	||j
�}|d|}x8|D]0}|dkr�q�t|t�r�t	||j
�}|d|}q�W|j}|dk	�rd|_t
|�t
|j�kr�|}nd}|t	d	t|�|j
�}y|j|t�Wn2tk
�rX}	z|jd
|	��WYdd}	~	XnX|dk�rh|Sx�x |j��r�|j|�rl|S�qlW|�r�||j�}y|j|�|jt�Wn2tk
�r�}	z|jd
|	��WYdd}	~	XnX|�sjP�qjW|S)Nz9command %s illegal in state %s, only allowed in states %sz, rar��BADz	READ-ONLYz#mailbox status changed to READ-ONLY� z {%s}zsocket error: %s)rar�r�)rDrkrEr>r�rGrIr@�_new_tag�bytesrXr�r��type�_commandr�r�r�rQr?rerFrH)
rRr�rsr��tagr��argrEZ	literator�valr<r<r=r��s^






 



 zIMAP4._commandcCs�|dkr|j�y|j|�\}}Wnj|jk
rX}z|jd||f��WYdd}~Xn6|jk
r�}z|jd||f��WYdd}~XnX|dkr�|j�|dkr�|jd|||f��||fS)Nrzcommand: %s => %sr�z%s command error: %s %s)r��_get_tagged_responser?r>)rRr�r�r�r�r�r<r<r=�_command_complete�s"$zIMAP4._command_completecCsJ|j�\}}|dgkr |jd��t|d|j�}|j�}t|j��|_dS)Nz"no CAPABILITY response from serverr}r�)r�r>r�rXr��tuple�splitrh)rRr�r�r<r<r=rfs

zIMAP4._get_capabilitiescCs�|j�}|j|j|�rp|jjd�}||jkr:|jd|��|jjd�}t||j�}|jjd�}||gf|j|<n�d}|jt	|�s�|j|j
|�r�|jjd�}|jdkr�|jt|�r�|jjd�|_dS|jd|��|jjd�}t||j�}|jjd�}|dk�rd}|�r|d|}xH|j|j
|��r\t|jjd	��}|j|�}|j|||f�|j�}�qW|j||�|d
k�r�|jt|��r�|jjd�}t||j�}|j||jjd��|S)Nr�zunexpected tagged response: %rr�r�Zdata2zunexpected response: %rr�r�r|rar�r�)rar�r�)�	_get_line�_matchrd�mo�grouprFr?r�rX�Untagged_responser_�ContinuationrHr]�intr{r��
Response_code)rR�respr�r�r�Zdat2r|r�r<r<r=resH



zIMAP4._get_responsecCsdx^|j|}|dk	r |j|=|S|j�y|j�Wq|jk
rZ}z�WYdd}~XqXqWdS)N)rFr�rer?)rRr��resultr�r<r<r=r�`s
zIMAP4._get_tagged_responsecCs>|j�}|s|jd��|jd�s.|jd|��|dd�}|S)Nzsocket error: EOFs
z#socket error: unterminated line: %rr����)r~r?�endswith)rRr�r<r<r=r{s

zIMAP4._get_linecCs|j|�|_|jdk	S)N)�matchr)rRZcre�sr<r<r=r�szIMAP4._matchcCs2|jtt|j�|j�}|jd|_d|j|<|S)Nr})rcr�r�rJrXrF)rRr�r<r<r=r��s
zIMAP4._new_tagcCs$|jdd�}|jdd�}d|dS)N�\z\\�"z\")r�)rRr�r<r<r=r��szIMAP4._quotecGs|j||j|f|���S)N)r�r�)rRr�rsr<r<r=r��szIMAP4._simple_commandcCs8|dkr||fS||jkr$|dgfS|jj|�}||fS)Nr�)rG�pop)rRr�r�r�r�r<r<r=r��s

zIMAP4._untagged_response)r�r�)r�r�)r�F)N)Or9r:r;rOr>r?r@�
IMAP4_PORTrUrLr`rNrprqrtrvrMr{r~r�rPrur�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rfrer�rrr�r�r�r�r<r<r<r=r�s�.*
		
	



 	

M	Pc@s6eZdZdedddfdd�Zdd�Zdefdd�ZdS)	�	IMAP4_SSLrANcCs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}|jdtd�||_||_|dkrxtj||d�}||_t	j
|||�dS)Nz8ssl_context and keyfile arguments are mutually exclusivez9ssl_context and certfile arguments are mutually exclusiverzEkeyfile and certfile are deprecated, use a custom ssl_context insteadr�)�certfile�keyfile)�
ValueError�warnings�warn�DeprecationWarningrrr�r�r�rrU)rRrSrTrrr�rr<r<r=rU�szIMAP4_SSL.__init__cCstj|�}|jj||jd�S)N)r�)rrvr�r�rS)rRrxr<r<r=rv
s
zIMAP4_SSL._create_socketcCstj|||�dS)N)rrM)rRrSrTr<r<r=rMszIMAP4_SSL.open)r9r:r;�IMAP4_SSL_PORTrUrvrMr<r<r<r=r�src@s>eZdZdd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)rcCs||_tj|�dS)N)r�rrU)rRr�r<r<r=rU&szIMAP4_stream.__init__NcCsNd|_d|_d|_d|_tj|jttjtjddd�|_	|j	j
|_|j	j|_
dS)NT)�bufsize�stdin�stdout�shellZ	close_fds)rSrTrxrz�
subprocess�Popenr�r�PIPEr�r�	writefiler�readfile)rRrSrTr<r<r=rM+s
zIMAP4_stream.opencCs|jj|�S)N)r"r{)rRr|r<r<r=r{;szIMAP4_stream.readcCs
|jj�S)N)r"r~)rRr<r<r=r~@szIMAP4_stream.readlinecCs|jj|�|jj�dS)N)r!�write�flush)rRr�r<r<r=r�EszIMAP4_stream.sendcCs"|jj�|jj�|jj�dS)N)r"r�r!r��wait)rRr<r<r=rPKs

zIMAP4_stream.shutdown)NN)	r9r:r;rUrMr{r~r�rPr<r<r<r=rs
c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
r�cCs
||_dS)N)r�)rRZmechinstr<r<r=rUYsz_Authenticator.__init__cCs&|j|j|��}|dkrdS|j|�S)N�*)r�r�r�)rRr�Zretr<r<r=r�\sz_Authenticator.processcCsrd}t|t�r|jd�}xT|rlt|�dkrD|dd�}|dd�}n|}d}tj|�}|r||dd�}qW|S)Nr�zutf-8�0r}r�)r�r�r�r��binasciiZ
b2a_base64)rR�inpZoup�t�er<r<r=r�bs	


z_Authenticator.encodecCs|sdStj|�S)Nr�)r(Z
a2b_base64)rRr)r<r<r=r�zsz_Authenticator.decodeN)r9r:r;rUr�r�r�r<r<r<r=r�Ssr�z0 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Decr�cCsi|]\}}|d|j��qS)r})r�)�.0�nr
r<r<r=�
<dictcomp>�sr.r}c	Cs�tj|�}|sdSt|jd�}|jd�}t|jd��}t|jd��}t|jd��}t|jd��}t|jd��}t|jd��}	t|jd	��}
|	d
|
d
}|dkr�|}||||||d
ddf	}tj|�|}
tj|
�S)N�mon�zonen�day�year�hour�min�sec�zoneh�zonem�<�-r}r�r�r�)	�InternalDater�Mon2numrr�calendarZtimegm�time�	localtime)rrr/r0r1r2r3r4r5r6r7ZzoneZtt�utcr<r<r=r�s$

cCsDd}d}tt|��}x*|r>t|d�\}}|||d�|}qW|S)Nr�sABCDEFGHIJKLMNOP�r})r�abs�divmod)Znumr�ZAP�modr<r<r=r	�scCs$tj|�}|sfSt|jd�j��S)Nr�)�Flagsrr�rr�)rrr<r<r=r
�s
c
Cs t|ttf�r"tj|tj�j�}n�t|t�r�y
|j	}WnZt
k
r�tjr�|d}|dkrptj
tj|��d}tjtjf|}ntj}YnXt|d�}t|dd�dt|�i�}nNt|t�r�|jdkr�td��|}n,t|t�o�|d|dfd
k�r�|Std	��d
jt|j�}|j|�S)N�r})Zseconds��tzinfozdate_time must be awarerrzdate_time not of a known typez"%d-{}-%Y %H:%M:%S %z"r�r�)rr)r�r�floatrZ
fromtimestamprr?Z
astimezoner�Z	tm_gmtoffrnr=Zdaylightr>ZmktimeZaltzonerrGrr��format�MonthsZmonthZstrftime)r�ZdtZgmtoff�dstZdeltaZfmtr<r<r=r�s0




 �__main__zd:s:z-dz-srAzIMAP password for %s on %s: Z	localhostzJFrom: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)s�
)r�Zlfr�r��
/tmp/xxx 1r��/tmp/yyyr�
/tmp/yyz 2r�r��/tmp�yy*r�r��SUBJECT�testr��1�(FLAGS INTERNALDATE RFC822)r��FLAGS�
(\Deleted)r�r�r�r�r��UIDVALIDITYr�r,�ALLr�rrcCsLtjd||f�tt|�|�\}}tjd|||f�|dkrH|d�|S)Nz%s %sz%s => %s %sr�r)�M�_mesgrl)�cmdrsr�r�r<r<r=�runsr^zPROTOCOL_VERSION = %szCAPABILITIES = %r�/tmp/�yy%z.*"([^"]+)"$r�rz%sz:(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)z
All tests OK.z
Tests failed.z8
If you would like to see debugging output,
try: %s -d5
)r
r)rr)r)rrrr)r)r)r)rr)rr)rr)r)rr)r)r)rr)rr)rr)rr)rr)rr)r)rrrr)rr)r)rr)rrrr)r)r)rr)r)rr)rr)rr)rr)r)r)rr)r)rr)r)r)rr)rA�rN)r�ra�rNrO)r�rb�rP)rrc�rQrR)r�rd�rP)r�re�NrSrT)r�rf�rUrV)r�rg�rUrWrX)r�rh�rY)r�ri�r,rZ)r�rj�r�)r�rk)r_r`r��r,rZ)r�rlr�r�)T�__version__r(r�rbrYrurr�r=r<rrr�iorr�r��ImportError�__all__r�rBrrrgrrkrZrrDr:r\r]r�rrr_r[r^rrr�rr�r�rJ�	enumerater;rr	r
rr9ZgetoptZgetpass�argvZoptlistrsr>r�Zstream_command�optrrSZgetuserZUSERZPASSWDZ	test_mesgZ	test_seq1Z	test_seq2r^r[rDr\rirhr]Zmlrrr�pathr�r��printr<r<r<r=�<module>sDH

	



	


c4
9,
#
)








signal.cpython-36.opt-2.pyc000064400000004361150335715140011417 0ustar003


 \K�@s
ddlZddlTddlmZddlmZe�Zej	de
dd��ej	de
d	d��d
ekrlej	de
dd��d
d�Zdd�Zeej
�dd��Z
eej�dd��Zd
ekr�eej�dd
��Zejje_dekr�eej�dd��Zdek�reej�dd��Zeje_[[dS)�N)�*)�wraps)�IntEnum�SignalscCs(|j�r|jd�r|jd�p&|jd�S)NZSIGZSIG_ZCTRL_)�isupper�
startswith)�name�r	�/usr/lib64/python3.6/signal.py�<lambda>
sr�HandlerscCs|dkS)N�SIG_DFL�SIG_IGN)r
rr	)rr	r	r
rs�pthread_sigmaskZSigmaskscCs|dkS)N�	SIG_BLOCK�SIG_UNBLOCK�SIG_SETMASK)rrrr	)rr	r	r
rscCs"y||�Stk
r|SXdS)N)�
ValueError)�valueZ
enum_klassr	r	r
�_int_to_enumsrcCs&yt|�Sttfk
r |SXdS)N)�intr�	TypeError)rr	r	r
�_enum_to_int#srcCstjt|�t|��}t|t�S)N)�_signal�signalrrr)�	signalnum�handlerr	r	r
r-srcCstj|�}t|t�S)N)r�	getsignalrr)rrr	r	r
r3s
rcCstj||�}tdd�|D��S)Ncss|]}t|t�VqdS)N)rr)�.0�xr	r	r
�	<genexpr>=sz"pthread_sigmask.<locals>.<genexpr>)rr�set)Zhow�maskZsigs_setr	r	r
r:s�
sigpendingcCstj�}tdd�|D��S)Ncss|]}t|t�VqdS)N)rr)rrr	r	r
r Eszsigpending.<locals>.<genexpr>)rr#r!)Zsigsr	r	r
r#Bs�sigwaitcCstj|�}t|t�S)N)rr$rr)ZsigsetZretsigr	r	r
r$Is
)r�	functoolsrZ_wraps�enumrZ_IntEnum�globalsZ_globals�_convert�__name__rrrrr�__doc__r#r$r	r	r	r
�<module>s6






glob.cpython-36.pyc000064400000010245150335715140010123 0ustar003


 \�@s�dZddlZddlZddlZdddgZdd�dd�Zdd�d	d�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zejd�Zejd�Zdd�Zdd�Zd d!�Zd"d�ZdS)#zFilename globbing utility.�N�glob�iglob�escapeF)�	recursivecCstt||d��S)ayReturn a list of paths matching a pathname pattern.

    The pattern may contain simple shell-style wildcards a la
    fnmatch. However, unlike fnmatch, filenames starting with a
    dot are special cases that are not matched by '*' and '?'
    patterns.

    If recursive is true, the pattern '**' will match any files and
    zero or more directories and subdirectories.
    )r)�listr)�pathnamer�r�/usr/lib64/python3.6/glob.pyr	scCs.t||d�}|r*t|�r*t|�}|s*t�|S)a�Return an iterator which yields the paths matching a pathname pattern.

    The pattern may contain simple shell-style wildcards a la
    fnmatch. However, unlike fnmatch, filenames starting with a
    dot are special cases that are not matched by '*' and '?'
    patterns.

    If recursive is true, the pattern '**' will match any files and
    zero or more directories and subdirectories.
    F)�_iglob�_isrecursive�next�AssertionError)rr�it�srrr	rs

ccs
tjj|�\}}t|�sP|s"t�|r:tjj|�rL|Vntjj|�rL|VdS|s�|rtt|�rtt|||�EdHnt	|||�EdHdS||kr�t|�r�t
||d�}n|g}t|�r�|r�t|�r�t}q�t	}nt}x2|D]*}x$||||�D]}tjj||�Vq�Wq�WdS)NT)
�os�path�split�	has_magicr
�lexists�isdirr�_glob2�_glob1r
�_glob0�join)rr�dironly�dirname�basename�dirsZglob_in_dir�namerrr	r
's2

r
cCs0tt||��}t|�s$dd�|D�}tj||�S)Ncss|]}t|�s|VqdS)N)�	_ishidden)�.0�xrrr	�	<genexpr>Rsz_glob1.<locals>.<genexpr>)r�_iterdirr�fnmatch�filter)r�patternr�namesrrr	rOsrcCs8|stjj|�r4|gSntjjtjj||��r4|gSgS)N)rrrrr)rrrrrr	rUsrcCst||d�S)NF)r)rr&rrr	�glob0bsr(cCst||d�S)NF)r)rr&rrr	�glob1esr)ccs.t|�st�|dd�Vt||�EdHdS)Nr)rr
�	_rlistdir)rr&rrrr	rksrccs�|s"t|t�rttjd�}ntj}yXtj|��D}x<|D]4}y|sJ|j�rR|jVWq6tk
rhYq6Xq6WWdQRXWntk
r�dSXdS)N�ASCII)�
isinstance�bytesr�curdir�scandir�is_dirr�OSError)rrr�entryrrr	r#rs

r#ccshtt||��}xT|D]L}t|�s|V|r8tjj||�n|}x"t||�D]}tjj||�VqHWqWdS)N)rr#rrrrr*)rrr'r!r�yrrr	r*�s
r*z([*?[])s([*?[])cCs(t|t�rtj|�}n
tj|�}|dk	S)N)r,r-�magic_check_bytes�search�magic_check)r�matchrrr	r�s

rcCs|ddkS)Nr�.�.�.)r8r:r)rrrr	r�srcCst|t�r|dkS|dkSdS)Ns**z**)r,r-)r&rrr	r�s
rcCs<tjj|�\}}t|t�r(tjd|�}ntjd|�}||S)z#Escape all special characters.
    s[\1]z[\1])rr�
splitdriver,r-r4�subr6)rZdriverrr	r�s

)�__doc__r�rer$�__all__rrr
rrr(r)rr#r*�compiler6r4rrrrrrrr	�<module>s(

(



smtpd.cpython-36.opt-1.pyc000064400000064075150335715140011300 0ustar003


 \���@s^dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
mZddddd	gZejdZd
ZGdd�d�Ze�ad
ZdZdZd%dd�ZGdd�dej�ZGdd�dej�ZGdd�de�ZGdd�de�ZGdd	�d	e�ZGdd�d�Z dd�Z!e"dk�rZe!�Z#e#j$Z$de$k�rpe$j%d�Z&e'e$de&�e(�e)�dg�Z*e$e&dd�Z$nddl+Z*e,e*e$�Z-e-e#j.e#j/fe#j0e#j1fe#j2e#j3d�Z4e#j5�r6yddl6Z6Wn.e7k
�r�e8d ej9d!�ej:d�YnXe6j;d"�d#Z<yej5e<�Wn.e=k
�r4e8d$ej9d!�ej:d�YnXyej>�Wne?k
�rXYnXdS)&a�An RFC 5321 smtp proxy with optional RFC 1870 and RFC 6531 extensions.

Usage: %(program)s [options] [localhost:localport [remotehost:remoteport]]

Options:

    --nosetuid
    -n
        This program generally tries to setuid `nobody', unless this flag is
        set.  The setuid call will fail if this program is not run as root (in
        which case, use this flag).

    --version
    -V
        Print the version number and exit.

    --class classname
    -c classname
        Use `classname' as the concrete SMTP proxy class.  Uses `PureProxy' by
        default.

    --size limit
    -s limit
        Restrict the total size of the incoming message to "limit" number of
        bytes via the RFC 1870 SIZE extension.  Defaults to 33554432 bytes.

    --smtputf8
    -u
        Enable the SMTPUTF8 extension and behave as an RFC 6531 smtp proxy.

    --debug
    -d
        Turn on debugging prints.

    --help
    -h
        Print this message and exit.

Version: %(__version__)s

If localhost is not given then `localhost' is used, and if localport is not
given then 8025 is used.  If remotehost is not given then `localhost' is used,
and if remoteport is not given, then 25 is used.
�N)�warn)�
get_addr_spec�get_angle_addr�SMTPChannel�
SMTPServer�DebuggingServer�	PureProxy�MailmanProxyzPython SMTP proxy version 0.3c@seZdZdd�Zdd�ZdS)�DevnullcCsdS)N�)�self�msgrr�/usr/lib64/python3.6/smtpd.py�writefsz
Devnull.writecCsdS)Nr)rrrr�flushgsz
Devnull.flushN)�__name__�
__module__�__qualname__rrrrrrr
esr
�
z, i�cCs4ttt�tjd�|r&t|tjd�tj|�dS)N)�file)�print�__doc__�globals�sys�stderr�exit)�coder
rrr�usagepsrc@s�eZdZdZdZdZejefdd��Ze	dd��Z
edd	d	fd
d�Zdd
�Z
dd�Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd ��Zejd!d ��Ze	d"d#��Zejd$d#��Ze	d%d&��Zejd'd&��Ze	d(d)��Zejd*d)��Ze	d+d,��Zejd-d,��Ze	d.d/��Zejd0d/��Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dS)Srr�icCs|S)Nr)�xrrr�<lambda>|szSMTPChannel.<lambda>cCs*yt|jj��Stk
r$|jSXdS)N)�max�command_size_limits�values�
ValueError�command_size_limit)rrrr�max_command_size_limit~sz"SMTPChannel.max_command_size_limitNFc	Cstjj|||d�||_||_||_||_||_||_|rF|rFt	d��|rdd|_
d|_d|_t
|_nd|_
d|_td�|_d	|_|j�d|_d
|_|jj�tj�|_y|j�|_Wn:tk
r�}z|j�|jdtjkr�dSd}~XnXtdt |j�t!d
�|j"d|jt#f�dS)N)�mapzFdecode_data and enable_SMTPUTF8 cannot be set to True at the same timerz
�.�s
�.�
FrzPeer:)rz	220 %s %s)$�asynchat�
async_chat�__init__�smtp_server�conn�addr�data_size_limit�enable_SMTPUTF8�_decode_datar%�_emptystring�_linesep�_dotsep�NEWLINE�_newline�ord�_set_rset_state�
seen_greeting�
extended_smtpr#�clear�socketZgetfqdn�fqdnZgetpeername�peer�OSError�close�args�errnoZENOTCONNr�repr�DEBUGSTREAM�push�__version__)	rZserverr1r2r3r(r4�decode_data�errrrrr/�s@


zSMTPChannel.__init__cCs.|j|_d|_g|_d|_d|_|jd�dS)z/Reset state variables to their post-DATA state.NFrs
)�COMMAND�
smtp_state�mailfrom�rcpttos�require_SMTPUTF8�	num_bytes�set_terminator)rrrr�_set_post_data_state�sz SMTPChannel._set_post_data_statecCs|j�d|_g|_dS)z.Reset all state variables except the greeting.rN)rT�
received_data�received_lines)rrrrr<�szSMTPChannel._set_rset_statecCstdtd�|jS)NzTAccess to __server attribute on SMTPChannel is deprecated, use 'smtp_server' instead�)r�DeprecationWarningr0)rrrr�__server�szSMTPChannel.__servercCstdtd�||_dS)NzRSetting __server attribute on SMTPChannel is deprecated, set 'smtp_server' insteadrW)rrXr0)r�valuerrrrY�scCstdtd�|jS)NzUAccess to __line attribute on SMTPChannel is deprecated, use 'received_lines' insteadrW)rrXrV)rrrr�__line�szSMTPChannel.__linecCstdtd�||_dS)NzSSetting __line attribute on SMTPChannel is deprecated, set 'received_lines' insteadrW)rrXrV)rrZrrrr[�scCstdtd�|jS)NzRAccess to __state attribute on SMTPChannel is deprecated, use 'smtp_state' insteadrW)rrXrN)rrrr�__state�szSMTPChannel.__statecCstdtd�||_dS)NzPSetting __state attribute on SMTPChannel is deprecated, set 'smtp_state' insteadrW)rrXrN)rrZrrrr\�scCstdtd�|jS)NzXAccess to __greeting attribute on SMTPChannel is deprecated, use 'seen_greeting' insteadrW)rrXr=)rrrr�
__greeting�szSMTPChannel.__greetingcCstdtd�||_dS)NzVSetting __greeting attribute on SMTPChannel is deprecated, set 'seen_greeting' insteadrW)rrXr=)rrZrrrr]�scCstdtd�|jS)NzSAccess to __mailfrom attribute on SMTPChannel is deprecated, use 'mailfrom' insteadrW)rrXrO)rrrr�
__mailfrom�szSMTPChannel.__mailfromcCstdtd�||_dS)NzQSetting __mailfrom attribute on SMTPChannel is deprecated, set 'mailfrom' insteadrW)rrXrO)rrZrrrr^�scCstdtd�|jS)NzQAccess to __rcpttos attribute on SMTPChannel is deprecated, use 'rcpttos' insteadrW)rrXrP)rrrr�	__rcpttos�szSMTPChannel.__rcpttoscCstdtd�||_dS)NzOSetting __rcpttos attribute on SMTPChannel is deprecated, set 'rcpttos' insteadrW)rrXrP)rrZrrrr_�scCstdtd�|jS)NzTAccess to __data attribute on SMTPChannel is deprecated, use 'received_data' insteadrW)rrXrU)rrrr�__data�szSMTPChannel.__datacCstdtd�||_dS)NzRSetting __data attribute on SMTPChannel is deprecated, set 'received_data' insteadrW)rrXrU)rrZrrrr`scCstdtd�|jS)NzKAccess to __fqdn attribute on SMTPChannel is deprecated, use 'fqdn' insteadrW)rrXrA)rrrr�__fqdn
szSMTPChannel.__fqdncCstdtd�||_dS)NzISetting __fqdn attribute on SMTPChannel is deprecated, set 'fqdn' insteadrW)rrXrA)rrZrrrrascCstdtd�|jS)NzKAccess to __peer attribute on SMTPChannel is deprecated, use 'peer' insteadrW)rrXrB)rrrr�__peerszSMTPChannel.__peercCstdtd�||_dS)NzISetting __peer attribute on SMTPChannel is deprecated, set 'peer' insteadrW)rrXrB)rrZrrrrbscCstdtd�|jS)NzKAccess to __conn attribute on SMTPChannel is deprecated, use 'conn' insteadrW)rrXr1)rrrr�__conn szSMTPChannel.__conncCstdtd�||_dS)NzISetting __conn attribute on SMTPChannel is deprecated, set 'conn' insteadrW)rrXr1)rrZrrrrc%scCstdtd�|jS)NzKAccess to __addr attribute on SMTPChannel is deprecated, use 'addr' insteadrW)rrXr2)rrrr�__addr+szSMTPChannel.__addrcCstdtd�||_dS)NzISetting __addr attribute on SMTPChannel is deprecated, set 'addr' insteadrW)rrXr2)rrZrrrrd0scCs&tjj|t|d|jrdnd��dS)Nz
zutf-8�ascii)r-r.rI�bytesrQ)rr
rrrrI7s
zSMTPChannel.pushcCs|d}|j|jkr|j}n|j|jkr*|j}|r<|j|kr<dS|rR|jt|�7_|jrl|jj	t
|d��n|jj	|�dS)Nzutf-8)rNrMr'�DATAr3rR�lenr5rV�append�str)r�data�limitrrr�collect_incoming_data<sz!SMTPChannel.collect_incoming_datac
Cs|jj|j�}tdt|�td�g|_|j|jk�r|jd}|_|sT|j	d�dS|j
sdt|d�}|jd�}|dkr�|j
�}d}n$|d|�j
�}||dd�j�}|jr�|j|n|j}||kr�|j	d�dSt|d	|d�}|�s�|j	d
|�dS||�dS|j|jk�r*|j	d�d|_dS|j�rT|j|jk�rT|j	d�d|_dSg}xJ|j|j�D]:}	|	�r�|	d|jk�r�|j|	dd��n
|j|	��qfW|jj|�|_|j|j|j|jf}
i}|j
�s�|j|jd
�}|j j!|
|�}|j"�|�s|j	d�n
|j	|�dS)NzData:)rrz500 Error: bad syntaxzutf-8� rz500 Error: line too longZsmtp_z&500 Error: command "%s" not recognizedz451 Internal confusionz552 Error: Too much mail data)�mail_options�rcpt_optionsz250 OK)#r6�joinrVrrGrHrNrMrRrIr5rj�find�upper�stripr>r#r&�getattrrgr3�splitr7r8rir:rUrBrOrProrpr0�process_messagerT)
r�lineZsz�i�command�argZmax_sz�methodrk�textrE�kwargsZstatusrrr�found_terminatorLsd






zSMTPChannel.found_terminatorcCsH|s|jd�dS|jr&|jd�dS|j�||_|jd|j�dS)Nz501 Syntax: HELO hostnamez503 Duplicate HELO/EHLOz250 %s)rIr=r<rA)rr{rrr�	smtp_HELO�s

zSMTPChannel.smtp_HELOcCs�|s|jd�dS|jr&|jd�dS|j�||_d|_|jd|j�|jrr|jd|j�|jdd7<|js�|jd�|jr�|jd	�|jdd
7<|jd�dS)Nz501 Syntax: EHLO hostnamez503 Duplicate HELO/EHLOTz250-%sz250-SIZE %s�MAIL�z250-8BITMIMEz250-SMTPUTF8�
z250 HELP)	rIr=r<r>rAr3r#r5r4)rr{rrr�	smtp_EHLO�s&



zSMTPChannel.smtp_EHLOcCs|r|jd�n
|jd�dS)Nz501 Syntax: NOOPz250 OK)rI)rr{rrr�	smtp_NOOP�szSMTPChannel.smtp_NOOPcCs|jd�|j�dS)Nz221 Bye)rIZclose_when_done)rr{rrr�	smtp_QUIT�s
zSMTPChannel.smtp_QUITcCs0t|�}|d|�j�|kr,||d�j�SdS)Nr)rhrsrt)r�keywordr{Zkeylenrrr�_strip_command_keyword�sz"SMTPChannel._strip_command_keywordcCsF|sdS|j�jd�r$t|�\}}nt|�\}}|s<||fS|j|fS)Nr�<)rr)�lstrip�
startswithrrZ	addr_spec)rr{�address�restrrr�_getaddr�szSMTPChannel._getaddrcCsNi}xD|D]<}|jd�\}}}|j�s2|r6|r6dS|r>|nd||<q
W|S)N�=T)�	partition�isalnum)r�params�resultZparam�eqrZrrr�
_getparams�s
zSMTPChannel._getparamscCs|r�d}|j�}|dkr$|jd�q�|dkr8|jd�q�|dkr^d}|jrR||7}|j|�q�|dkr�d	}|jrx||7}|j|�q�|d
kr�|jd�q�|dkr�|jd
�q�|dkr�|jd�q�|dkr�|jd�q�|dkr�|jd�q�|jd�n
|jd�dS)Nz [SP <mail-parameters>]ZEHLOz250 Syntax: EHLO hostnameZHELOz250 Syntax: HELO hostnamer�z 250 Syntax: MAIL FROM: <address>ZRCPTz250 Syntax: RCPT TO: <address>rgz250 Syntax: DATAZRSETz250 Syntax: RSETZNOOPz250 Syntax: NOOPZQUITz250 Syntax: QUITZVRFYz250 Syntax: VRFY <address>zD501 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFYzD250 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFY)rsrIr>)rr{ZextendedZlc_argr
rrr�	smtp_HELP�s:zSMTPChannel.smtp_HELPcCs@|r2|j|�\}}|r"|jd�q<|jd|�n
|jd�dS)NzB252 Cannot VRFY user, but will accept message and attempt deliveryz502 Could not VRFY %sz501 Syntax: VRFY <address>)r�rI)rr{r�r�rrr�	smtp_VRFY�szSMTPChannel.smtp_VRFYcCs�|js|jd�dStd|td�d}|jr4|d7}|dkrJ|j|�dS|jd|�}|j|�\}}|sv|j|�dS|jr�|r�|j|�dS|jr�|jd�dS|j�j	�|_
|j|j
�}|dkr�|j|�dS|j�s|j
dd	�}|dk�r|jd�dS|j�r>|j
dd
�}|dk�r&d|_n|d
k	�r>|jd�dS|j
dd�}|�r�|j��sh|j|�dS|j�r�t|�|jk�r�|jd�dSt|j��dk�r�|jd�dS||_td|jtd�|jd�dS)Nz503 Error: send HELO firstz	===> MAIL)rz 501 Syntax: MAIL FROM: <address>z [SP <mail-parameters>]zFROM:z503 Error: nested MAIL commandZBODY�7BIT�8BITMIMEz1501 Error: BODY can only be one of 7BIT, 8BITMIMEZSMTPUTF8FTz&501 Error: SMTPUTF8 takes no argumentsZSIZEz:552 Error: message size exceeds fixed maximum message sizerz:555 MAIL FROM parameters not recognized or not implementedzsender:z250 OK)r�r�)r=rIrrHr>r�r�rOrsrvror�r5�popr4rQ�isdigitr3�intrh�keys)rr{�	syntaxerrr�r�Zbody�smtputf8�sizerrr�	smtp_MAILsh














zSMTPChannel.smtp_MAILcCs|js|jd�dStd|td�|js6|jd�dSd}|jrH|d7}|dkr^|j|�dS|jd|�}|j|�\}}|s�|j|�dS|jr�|r�|j|�dS|j�j	�|_
|j|j
�}|dkr�|j|�dSt|j
��dkr�|jd	�dS|jj|�td
|jtd�|jd�dS)Nz503 Error: send HELO firstz	===> RCPT)rz503 Error: need MAIL commandz501 Syntax: RCPT TO: <address>z [SP <mail-parameters>]zTO:rz8555 RCPT TO parameters not recognized or not implementedzrecips:z250 OK)r=rIrrHrOr>r�r�rsrvrpr�rhr�rPri)rr{r�r�r�rrr�	smtp_RCPT7s@






zSMTPChannel.smtp_RCPTcCs(|r|jd�dS|j�|jd�dS)Nz501 Syntax: RSETz250 OK)rIr<)rr{rrr�	smtp_RSETZs

zSMTPChannel.smtp_RSETcCsZ|js|jd�dS|js(|jd�dS|r:|jd�dS|j|_|jd�|jd�dS)Nz503 Error: send HELO firstz503 Error: need RCPT commandz501 Syntax: DATAs
.
z#354 End data with <CR><LF>.<CR><LF>)r=rIrPrgrNrS)rr{rrr�	smtp_DATAas



zSMTPChannel.smtp_DATAcCs|jd�dS)Nz502 EXPN not implemented)rI)rr{rrr�	smtp_EXPNpszSMTPChannel.smtp_EXPN),rrrrMrgr&�collections�defaultdictr#�propertyr'�DATA_SIZE_DEFAULTr/rTr<Z_SMTPChannel__server�setterZ_SMTPChannel__lineZ_SMTPChannel__stateZ_SMTPChannel__greetingZ_SMTPChannel__mailfromZ_SMTPChannel__rcpttosZ_SMTPChannel__dataZ_SMTPChannel__fqdnZ_SMTPChannel__peerZ_SMTPChannel__connZ_SMTPChannel__addrrIrmrr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrws`&	>#6#c@s2eZdZeZedddfdd�Zdd�Zdd�ZdS)	rNFcCs�||_||_||_||_||_|r.|r.td��tjj||d�yNt	j
|dt	ji�}|j|dd|dd�|j
�|j|�|jd�Wn|j��Yn(Xtd|jjtjtj��||ftd�dS)	NzFdecode_data and enable_SMTPUTF8 cannot be set to True at the same time)r(�typerr�z0%s started at %s
	Local addr: %s
	Remote addr:%s)r)Z
_localaddr�_remoteaddrr3r4r5r%�asyncore�
dispatcherr/r@ZgetaddrinfoZSOCK_STREAMZ
create_socketZset_reuse_addrZbindZlistenrDr�	__class__r�time�ctimerH)rZ	localaddrZ
remoteaddrr3r(r4rKZgai_resultsrrrr/xs*

zSMTPServer.__init__cCs6tdt|�td�|j||||j|j|j|j�}dS)NzIncoming connection from %s)r)rrGrH�
channel_classr3Z_mapr4r5)rr1r2Zchannelrrr�handle_accepted�szSMTPServer.handle_acceptedcKst�dS)aOverride this abstract method to handle messages from the client.

        peer is a tuple containing (ipaddr, port) of the client that made the
        socket connection to our smtp port.

        mailfrom is the raw address the client claims the message is coming
        from.

        rcpttos is a list of raw addresses the client wishes to deliver the
        message to.

        data is a string containing the entire full text of the message,
        headers (if supplied) and all.  It has been `de-transparencied'
        according to RFC 821, Section 4.5.2.  In other words, a line
        containing a `.' followed by other text has had the leading dot
        removed.

        kwargs is a dictionary containing additional information.  It is
        empty if decode_data=True was given as init parameter, otherwise
        it will contain the following keys:
            'mail_options': list of parameters to the mail command.  All
                            elements are uppercase strings.  Example:
                            ['BODY=8BITMIME', 'SMTPUTF8'].
            'rcpt_options': same, for the rcpt command.

        This function should return None for a normal `250 Ok' response;
        otherwise, it should return the desired response string in RFC 821
        format.

        N)�NotImplementedError)rrBrOrPrkr~rrrrw�szSMTPServer.process_message)	rrrrr�r�r/r�rwrrrrrts
c@seZdZdd�Zdd�ZdS)rcCsrd}|j�}x`|D]X}|rP|rPd|d}t|t�sDt|jd��}t|�d}t|t�sbt|�}t|�qWdS)NrzX-Peer: rzutf-8)�
splitlines�
isinstancerjrG�encoder)rrBrkZ	inheaders�linesrxZ
peerheaderrrr�_print_message_content�s



z&DebuggingServer._print_message_contentcKsXtd�|r@|jd�r&td|d�|jd�r@td|d�|j||�td�dS)Nz%---------- MESSAGE FOLLOWS ----------rozmail options: %srpzrcpt options: %s
z%------------ END MESSAGE ------------)r�getr�)rrBrOrPrkr~rrrrw�s

zDebuggingServer.process_messageN)rrrr�rwrrrrr�scs,eZdZ�fdd�Zdd�Zdd�Z�ZS)rcs.d|kr|drtd��tt|�j||�dS)Nr4z$PureProxy does not support SMTPUTF8.)r%�superrr/)rrEr~)r�rrr/�szPureProxy.__init__c	Csh|jd�}d}x|D]}|sP|d7}qW|j|d|d�tj|�}|j|||�}td|td�dS)Nrrrz
X-Peer: %szwe got some refusals:)r)rv�insertr9rq�_deliverrrH)	rrBrOrPrkr�ryrx�refusedrrrrw�s


zPureProxy.process_messagecCs�ddl}i}yB|j�}|j|jd|jd�z|j|||�}Wd|j�XWn�|jk
r�}ztdtd�|j	}WYdd}~Xnjt
|jfk
r�}zHtd|jtd�t
|dd	�}t
|dd�}	x|D]}
||	f||
<q�WWYdd}~XnX|S)
Nrrzgot SMTPRecipientsRefused)rZgotZ	smtp_codeZ
smtp_error�ignore���)�smtplibZSMTPZconnectr�Zsendmail�quitZSMTPRecipientsRefusedrrHZ
recipientsrCZ
SMTPExceptionr�ru)rrOrPrkr�r��s�eZerrcode�errmsg�rrrrr��s$
"zPureProxy._deliver)rrrr/rwr��
__classcell__rr)r�rr�scs$eZdZ�fdd�Zdd�Z�ZS)r	cs.d|kr|drtd��tt|�j||�dS)Nr4z'MailmanProxy does not support SMTPUTF8.)r%r�rr/)rrEr~)r�rrr/
szMailmanProxy.__init__cCs:ddlm}ddlm}ddlm}ddlm}g}	x~|D]v}
|
j�jd�d}|jd�}t|�dkrhq:|d}
t|�dkr�|d	}nd
}|j	|
�s:|d!kr�q:|	j
|
|
|f�q:Wx|	D]\}
}
}|j|
�q�Wtddj
|�td�|�r|j|||�}td|td�i}||�}|j|�}|jd��s2||d<|jd��sPtjtj��|d<x�|	D]�\}
}
}td|
td�|j|
�}|�s�|j|
dd�}|||
<|d
k�r�|j|d	d�n�|dk�r�|j|d	d�nh|dk�r�|j|d	d�nN|d
k�r�|j|d	d�n4|d"k�rV|dk�rd|d<nd |d<|j|d	d��qVWdS)#Nr)�StringIO)�Utils)�Message)�MailList�@�-rWrr�admin�owner�requestrq�leavezforwarding recips:rn)rzwe got refusals:�fromZFromZdateZDatezsending message to)�lock)�tolist)Ztoadmin)Ztoowner)Z	torequestZ	subscribeZSubjectZunsubscribe)rr�r�r�rqr�)rqr�)�ior�ZMailmanr�r�r��lowerrvrhZlist_existsri�removerrqrHr�r�r�r�ZEnqueue)rrBrOrPrkr�r�r�r�Z	listnamesZrcptZlocal�partsZlistnamerzr�Zmlistsr�r
Zmlistrrrrwsd











zMailmanProxy.process_message)rrrr/rwr�rr)r�rr	sc@seZdZdZdZdZdZdS)�OptionsTrNF)rrr�setuid�	classname�
size_limitr4rrrrr�_sr�c
!Csty.tjtjdd�dddddddd	g�\}}Wn.tjk
r\}ztd|�WYdd}~XnXt�}x�|D]�\}}|d'kr�td�qj|d(kr�tt�tjd�qj|d)kr�d|_	qj|d*kr�||_
qj|d+kr�tjaqj|d,kr�d|_
qj|d-krjyt|�}||_Wqjtd|tjd�tjd�YqjXqjWt|�dk�r@d}d}nPt|�dk�r\|d}d}n4t|�d k�r||d}|d}ntdd!tj|��|jd"�}	|	dk�r�tdd#|�|d|	�|_yt||	dd��|_Wn$tk
�r�tdd$|�YnX|jd"�}	|	dk�r"tdd%|�|d|	�|_yt||	dd��|_Wn$tk
�rntdd&|�YnX|S).Nrz	nVhc:s:duzclass=Znosetuid�version�helpzsize=�debugr��-h�--helpr�-V�	--version�-n�
--nosetuidF�-c�--class�-d�--debug�-u�
--smtputf8T�-s�--sizezInvalid size: )rzlocalhost:8025zlocalhost:25rW�zInvalid arguments: %s�:zBad local spec: %szBad local port: %szBad remote spec: %szBad remote port: %s)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)�getoptr�argv�errorrr�rrJrr�r�rrHr4r�r�rh�
COMMASPACErqrr�	localhost�	localportr%�
remotehost�
remoteport)
ZoptsrEr��options�optr{Zint_sizeZ	localspecZ
remotespecryrrr�	parseargsfsp






r��__main__r)r)r4z7Cannot import module "pwd"; try running with -n option.)r�nobodyrWz3Cannot setuid "nobody"; try running with -n option.)r)@rr�osrFr�r�r@r�r-r��warningsrZemail._header_value_parserrr�__all__r�ZprogramrJr
rHr9r�r�rr.rr�rrrr	r�r�rr�r��rfindZlastdot�
__import__r�locals�modr�ruZclass_r�r�r�r�r�r4�proxyr��pwd�ImportErrorrrr�getpwnamr��PermissionErrorZloop�KeyboardInterruptrrrr�<module>-sx#

M-SB




codeop.cpython-36.opt-2.pyc000064400000004261150335715140011412 0ustar003


 \j�@s`ddlZdd�ejD�ZdddgZdZdd	�Zd
d�Zddd�ZGdd�d�ZGdd�d�Z	dS)�NcCsg|]}tt|��qS�)�getattr�
__future__)�.0Zfnamerr�/usr/lib64/python3.6/codeop.py�
<listcomp>=sr�compile_command�Compile�CommandCompileric-Cs*x8|jd�D]}|j�}|r|ddkrPqW|dkr:d}d}}}d}}	}
y||||�}Wn"tk
r�}zWYdd}~XnXy||d||�}	Wn&tk
r�}z
|}WYdd}~XnXy||d||�}
Wn&tk
r�}z
|}WYdd}~XnX|�r|S|	�r&t|�t|�k�r&|�dS)N�
r�#�eval�passz

)�split�strip�SyntaxError�repr)�compiler�source�filename�symbol�line�errZerr1Zerr2�code�code1�code2�errr�_maybe_compileDs0rcCst|||t�S)N)�compile�PyCF_DONT_IMPLY_DEDENT)rrrrrr�_compileesr �<input>�singlecCstt|||�S)N)rr )rrrrrrrhsc@seZdZdd�Zdd�ZdS)r	cCs
t|_dS)N)r�flags)�selfrrr�__init__�szCompile.__init__cCs@t||||jd�}x(tD] }|j|j@r|j|jO_qW|S)N�)rr#�	_features�co_flagsZ
compiler_flag)r$rrrZcodeobZfeaturerrr�__call__�s

zCompile.__call__N)�__name__�
__module__�__qualname__r%r)rrrrr	|sc@seZdZdd�Zddd�ZdS)	r
cCst�|_dS)N)r	r)r$rrrr%�szCommandCompiler.__init__�<input>r"cCst|j|||�S)N)rr)r$rrrrrrr)�szCommandCompiler.__call__N)r-r")r*r+r,r%r)rrrrr
�s)r!r")
rZall_feature_namesr'�__all__rrr rr	r
rrrr�<module>;s

!
threading.cpython-36.opt-2.pyc000064400000050361150335715140012110 0ustar003

�\dh���@s|ddlZddlZddlmZmZddlm	Z
ddlmZddl
mZmZyddlmZWn ek
rxddlmZYnXddd	d
ddd
ddddddddddddddgZejZejZejZejZejZy
ej Z!Wne"k
r�dZ!YnXej#Z#[da$da%dd�Z&dd�Z'eZ(dd�Z Gdd �d �Z)e)Z*Gd!d	�d	�Z+Gd"d�d�Z,Gd#d�de,�Z-Gd$d�d�Z.Gd%d�d�Z/Gd&d�de0�Z1e�j2Z3e3�d?d(d)�Z4e �a5iZ6iZ7e�Z8Gd*d�d�Z9Gd+d�de9�Z:Gd,d-�d-e9�Z;Gd.d/�d/e9�Z<d0d
�Z=e=Z>d1d�Z?e?Z@d2d3�ZAd4d�ZBdd5lmCZCe;�aDd6d7�ZEd8d9�ZFd:d�ZGydd;lmHZIWn"ek
�rndd<lJmIZIYnXd=d>�ZKdS)@�N)�	monotonic�sleep)�
format_exc)�WeakSet)�islice�count)�deque�	get_ident�active_count�	Condition�current_thread�	enumerate�main_thread�TIMEOUT_MAX�Event�Lock�RLock�	Semaphore�BoundedSemaphore�Thread�Barrier�BrokenBarrierError�Timer�ThreadError�
setprofile�settrace�local�
stack_sizecCs|adS)N)�
_profile_hook)�func�r �!/usr/lib64/python3.6/threading.pyr2scCs|adS)N)�_trace_hook)rr r r!r<scOstdkrt||�St||�S)N)�_CRLock�_PyRLock)�args�kwargsr r r!rJs	
c@sReZdZdd�Zdd�Zddd�ZeZd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�_RLockcCst�|_d|_d|_dS)Nr)�_allocate_lock�_block�_owner�_count)�selfr r r!�__init__asz_RLock.__init__cCs^|j}yt|j}Wntk
r(YnXd|jj�r:dnd|jj|jj||j	t
t|��fS)Nz)<%s %s.%s object owner=%r count=%d at %s>�lockedZunlocked)r*�_active�name�KeyErrorr)r.�	__class__�
__module__�__qualname__r+�hex�id)r,�ownerr r r!�__repr__fsz_RLock.__repr__T�cCsDt�}|j|kr"|jd7_dS|jj||�}|r@||_d|_|S)Nr9)r	r*r+r)�acquire)r,�blocking�timeout�me�rcr r r!r:us
z_RLock.acquirecCs<|jt�krtd��|jd|_}|s8d|_|jj�dS)Nzcannot release un-acquired lockr9)r*r	�RuntimeErrorr+r)�release)r,rr r r!r@�sz_RLock.releasecCs|j�dS)N)r@)r,�t�v�tbr r r!�__exit__�sz_RLock.__exit__cCs|jj�|\|_|_dS)N)r)r:r+r*)r,�stater r r!�_acquire_restore�s
z_RLock._acquire_restorecCs<|jdkrtd��|j}d|_|j}d|_|jj�||fS)Nrzcannot release un-acquired lock)r+r?r*r)r@)r,rr7r r r!�
_release_save�s

z_RLock._release_savecCs|jt�kS)N)r*r	)r,r r r!�	_is_owned�sz_RLock._is_ownedN���)TrI)�__name__r3r4r-r8r:�	__enter__r@rDrFrGrHr r r r!r'Ws

$
r'c@speZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	ddd�Z
ddd�Zddd�Zdd�Z
e
ZdS)rNcCs�|dkrt�}||_|j|_|j|_y|j|_Wntk
rDYnXy|j|_Wntk
rfYnXy|j|_Wntk
r�YnXt�|_	dS)N)
r�_lockr:r@rG�AttributeErrorrFrH�_deque�_waiters)r,�lockr r r!r-�s$zCondition.__init__cCs
|jj�S)N)rLrK)r,r r r!rK�szCondition.__enter__cGs|jj|�S)N)rLrD)r,r%r r r!rD�szCondition.__exit__cCsd|jt|j�fS)Nz<Condition(%s, %d)>)rL�lenrO)r,r r r!r8�szCondition.__repr__cCs|jj�dS)N)rLr@)r,r r r!rG�szCondition._release_savecCs|jj�dS)N)rLr:)r,�xr r r!rF�szCondition._acquire_restorecCs"|jjd�r|jj�dSdSdS)NrFT)rLr:r@)r,r r r!rH�s
zCondition._is_ownedcCs�|j�std��t�}|j�|jj|�|j�}d}z�|dkrN|j�d}nj|dkr�t�|}d}xR|jd�}|rvPt|t�|�}|dkr�Pt|d|d�}t	|�qfWn
|jd�}|S|j
|�|s�y|jj|�Wntk
r�YnXXdS)Nzcannot wait on un-acquired lockFTrg����Mb@?�g�������?)
rHr?r(r:rO�appendrG�_time�min�_sleeprF�remove�
ValueError)r,r<�waiterZsaved_stateZgotit�endtimeZdelayZ	remainingr r r!�waits>	



zCondition.waitcCs\d}|}|�}xH|sV|dk	rD|dkr0t�|}n|t�}|dkrDP|j|�|�}qW|S)Nr)rUr\)r,Z	predicater<r[Zwaittime�resultr r r!�wait_forIs


zCondition.wait_forr9cCsj|j�std��|j}tt||��}|s,dSx8|D]0}|j�y|j|�Wq2tk
r`Yq2Xq2WdS)Nz!cannot notify on un-acquired lock)rHr?rOrN�_islicer@rXrY)r,�nZall_waitersZwaiters_to_notifyrZr r r!�notify`s

zCondition.notifycCs|jt|j��dS)N)rarQrO)r,r r r!�
notify_allwszCondition.notify_all)N)N)N)r9)rJr3r4r-rKrDr8rGrFrHr\r^rarbZ	notifyAllr r r r!r�s
	
B

	c@s4eZdZddd�Zd
dd�ZeZdd	�Zd
d�ZdS)rr9cCs&|dkrtd��tt��|_||_dS)Nrz$semaphore initial value must be >= 0)rYrr�_cond�_value)r,�valuer r r!r-�szSemaphore.__init__TNc
Cs�|r|dk	rtd��d}d}|j�jxb|jdkrv|s8P|dk	rh|dkrTt�|}n|t�}|dkrhP|jj|�q(W|jd8_d}WdQRX|S)Nz.can't specify timeout for non-blocking acquireFrr9T)rYrcrdrUr\)r,r;r<r>r[r r r!r:�s$
zSemaphore.acquirec
Cs.|j�|jd7_|jj�WdQRXdS)Nr9)rcrdra)r,r r r!r@�szSemaphore.releasecCs|j�dS)N)r@)r,rArBrCr r r!rD�szSemaphore.__exit__)r9)TN)rJr3r4r-r:rKr@rDr r r r!r�s


-c@seZdZddd�Zdd�ZdS)rr9cCstj||�||_dS)N)rr-�_initial_value)r,rer r r!r-�szBoundedSemaphore.__init__c
CsB|j�2|j|jkrtd��|jd7_|jj�WdQRXdS)Nz!Semaphore released too many timesr9)rcrdrfrYra)r,r r r!r@�s

zBoundedSemaphore.releaseN)r9)rJr3r4r-r@r r r r!r�s
c@sBeZdZdd�Zdd�Zdd�ZeZdd�Zd	d
�Zddd
�Z	dS)rcCstt��|_d|_dS)NF)rrrc�_flag)r,r r r!r-szEvent.__init__cCs|jjt��dS)N)rcr-r)r,r r r!�_reset_internal_locksszEvent._reset_internal_lockscCs|jS)N)rg)r,r r r!�is_setszEvent.is_setc	Cs&|j�d|_|jj�WdQRXdS)NT)rcrgrb)r,r r r!�setsz	Event.setc	Cs|j�d|_WdQRXdS)NF)rcrg)r,r r r!�clearszEvent.clearNc	Cs,|j�|j}|s|jj|�}|SQRXdS)N)rcrgr\)r,r<Zsignaledr r r!r\'s
z
Event.wait)N)
rJr3r4r-rhriZisSetrjrkr\r r r r!r�s
c@s|eZdZddd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zedd��Z
edd��Zedd��ZdS)rNcCs.tt��|_||_||_||_d|_d|_dS)Nr)rrrc�_action�_timeout�_parties�_stater+)r,�parties�actionr<r r r!r-Qs	zBarrier.__init__cCs�|dkr|j}|j�b|j�|j}|jd7_z&|d|jkrL|j�n
|j|�|S|jd8_|j�XWdQRXdS)Nr9)rmrc�_enterr+rn�_release�_wait�_exit)r,r<�indexr r r!r\as	

zBarrier.waitcCs,x|jdkr|jj�qW|jdkr(t�dS)Nr9rrI)rIr9)rorcr\r)r,r r r!rrs

zBarrier._enterc	Cs>y"|jr|j�d|_|jj�Wn|j��YnXdS)Nr9)rlrorcrb�_break)r,r r r!rs�szBarrier._releasecs4�jj�fdd�|�s"�j�t��jdkr0t�dS)Ncs
�jdkS)Nr)ror )r,r r!�<lambda>�szBarrier._wait.<locals>.<lambda>r)rcr^rwrro)r,r<r )r,r!rt�s
z
Barrier._waitcCs(|jdkr$|jdkr$d|_|jj�dS)Nrr9rI)rIr9)r+rorcrb)r,r r r!ru�s

z
Barrier._exitc	CsT|j�D|jdkr6|jdkr$d|_q<|jdkr<d|_nd|_|jj�WdQRXdS)Nrr9rSrI���rI)rcr+rorb)r,r r r!�reset�s


z
Barrier.resetc	Cs|j�|j�WdQRXdS)N)rcrw)r,r r r!�abort�sz
Barrier.abortcCsd|_|jj�dS)NrSry)rorcrb)r,r r r!rw�szBarrier._breakcCs|jS)N)rn)r,r r r!rp�szBarrier.partiescCs|jdkr|jSdS)Nr)ror+)r,r r r!�	n_waiting�s
zBarrier.n_waitingcCs
|jdkS)NrSry)ro)r,r r r!�broken�szBarrier.broken)NN)N)rJr3r4r-r\rrrsrtrurzr{rw�propertyrpr|r}r r r r!rHs	


	c@seZdZdS)rN)rJr3r4r r r r!r�s�	Thread-%dcCs
|t�S)N)�_counter)�templater r r!�_newname�sr�c@seZdZdZejZdddfdfdd�dd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd2dd�Zd4dd�Zed d!��Zejd"d!��Zed#d$��Zd%d&�ZeZed'd(��Zejd)d(��Zd*d+�Zd,d-�Zd.d/�Zd0d1�ZdS)5rFN)�daemoncCs~|dkri}||_t|pt��|_||_||_|dk	r>||_n
t�j|_d|_	d|_
t�|_d|_
d|_tj|_tj|�dS)NFT)�_target�strr��_name�_args�_kwargs�	_daemonicrr��_ident�_tstate_lockr�_started�_is_stopped�_initialized�_sys�stderr�_stderr�	_dangling�add)r,�group�targetr0r%r&r�r r r!r-
s 
zThread.__init__cCs(|jj�|r|j�nd|_d|_dS)NT)r�rh�_set_tstate_lockr�r�)r,�is_aliver r r!rh7s


zThread._reset_internal_lockscCs^d}|jj�rd}|j�|jr$d}|jr2|d7}|jdk	rJ|d|j7}d|jj|j|fS)N�initialZstartedZstoppedz daemonz %sz<%s(%s, %s)>)	r�rir�r�r�r�r2rJr�)r,Zstatusr r r!r8Cs

zThread.__repr__cCs�|jstd��|jj�r td��t�|t|<WdQRXyt|jf�Wn,tk
rtt�t|=WdQRX�YnX|jj	�dS)Nzthread.__init__() not calledz threads can only be started once)
r�r?r�ri�_active_limbo_lock�_limbo�_start_new_thread�
_bootstrap�	Exceptionr\)r,r r r!�startQs

zThread.startc
Cs.z|jr|j|j|j�Wd|`|`|`XdS)N)r�r�r�)r,r r r!�runjs	z
Thread.runc	Cs2y|j�Wn |jr&tdkr&dS�YnXdS)N)�_bootstrap_innerr�r�)r,r r r!r�{s
zThread._bootstrapcCst�|_dS)N)r	r�)r,r r r!�
_set_ident�szThread._set_identcCst�|_|jj�dS)N)�
_set_sentinelr�r:)r,r r r!r��szThread._set_tstate_lockc2Cs��zT|j�|j�|jj�t�|t|j<t|=WdQRXtrLt	j
t�trZt	jt�z�y|j
�Wn�tk
r|Yn�t	r�t	jdk	r�td|jt�ft	jd�n�|jdk	�rH|j�\}}}zxtd|jd|jd�td|jd�x6|�r$td|jjj|j|jjjf|jd�|j}q�Wtd||f|jd�Wd~~~XYnXWdXWdt� ytt�=WnYnXWdQRXXdS)NzException in thread %s:
%s)�filezException in thread z2 (most likely raised during interpreter shutdown):z"Traceback (most recent call last):z  File "%s", line %s, in %sz%s: %s)r�r�r�rjr�r/r�r�r"r�rrrr��
SystemExitr��printr0�_format_excr��	_exc_info�tb_frame�f_code�co_filename�	tb_lineno�co_name�tb_nextr	)r,�exc_type�	exc_valueZexc_tbr r r!r��sT




zThread._bootstrap_innercCs|j}|dk	rd|_d|_dS)NT)r�r�)r,rPr r r!�_stop�szThread._stopcCsByt�tt�=WdQRXWn tk
r<dtjkr8�YnXdS)NZdummy_threading)r�r/r	r1r��modules)r,r r r!�_delete�s
zThread._deletecCsZ|jstd��|jj�s td��|t�kr2td��|dkrD|j�n|jt|d�d�dS)NzThread.__init__() not calledz'cannot join thread before it is startedzcannot join current threadr)r<)r�r?r�rir�_wait_for_tstate_lock�max)r,r<r r r!�joins


zThread.joinTr9cCs0|j}|dkrn|j||�r,|j�|j�dS)N)r�r:r@r�)r,�blockr<rPr r r!r�;szThread._wait_for_tstate_lockcCs|jS)N)r�)r,r r r!r0Is	zThread.namecCst|�|_dS)N)r�r�)r,r0r r r!r0TscCs|jS)N)r�)r,r r r!�identYs
zThread.identcCs(|js|jj�rdS|jd�|jS)NF)r�r�rir�)r,r r r!r�es	
zThread.is_alivecCs|jS)N)r�)r,r r r!r�usz
Thread.daemoncCs*|jstd��|jj�r td��||_dS)NzThread.__init__() not calledz)cannot set daemon status of active thread)r�r?r�rir�)r,�daemonicr r r!r��s

cCs|jS)N)r�)r,r r r!�isDaemon�szThread.isDaemoncCs
||_dS)N)r�)r,r�r r r!�	setDaemon�szThread.setDaemoncCs|jS)N)r0)r,r r r!�getName�szThread.getNamecCs
||_dS)N)r0)r,r0r r r!�setName�szThread.setName)NrI)TrI)rJr3r4r�r��exc_infor�r-rhr8r�r�r�r�r�r�r�r�r�r�r~r0�setterr�r�ZisAliver�r�r�r�r�r r r r!r�s6	,A#
&
c@s&eZdZddd�Zdd�Zdd�ZdS)	rNcCsFtj|�||_||_|dk	r"|ng|_|dk	r4|ni|_t�|_dS)N)rr-�interval�functionr%r&r�finished)r,r�r�r%r&r r r!r-�s
zTimer.__init__cCs|jj�dS)N)r�rj)r,r r r!�cancel�szTimer.cancelcCs6|jj|j�|jj�s(|j|j|j�|jj�dS)N)r�r\r�rir�r%r&rj)r,r r r!r��s
z	Timer.run)NN)rJr3r4r-r�r�r r r r!r�s	
c@seZdZdd�ZdS)�_MainThreadc
CsHtj|ddd�|j�|jj�|j�t�|t|j<WdQRXdS)NZ
MainThreadF)r0r�)	rr-r�r�rjr�r�r/r�)r,r r r!r-�s
z_MainThread.__init__N)rJr3r4r-r r r r!r��sr�c@s.eZdZdd�Zdd�Zdd�Zd
dd	�ZdS)�_DummyThreadc
CsDtj|td�dd�|jj�|j�t�|t|j<WdQRXdS)NzDummy-%dT)r0r�)	rr-r�r�rjr�r�r/r�)r,r r r!r-�s

z_DummyThread.__init__cCsdS)Nr )r,r r r!r��sz_DummyThread._stopcCsdS)NTr )r,r r r!r��sz_DummyThread.is_aliveNcCsdS)Nr )r,r<r r r!r��sz_DummyThread.join)N)rJr3r4r-r�r�r�r r r r!r��sr�cCs&y
tt�Stk
r t�SXdS)N)r/r	r1r�r r r r!r�s
c
Cs t�tt�tt�SQRXdS)N)r�rQr/r�r r r r!r
�scCsttj��ttj��S)N)�listr/�valuesr�r r r r!�
_enumerate�sr�c
Cs(t�ttj��ttj��SQRXdS)N)r�r�r/r�r�r r r r!r
s)rcCs8tj}|j�tj�t�}x|r2|j�t�}qWdS)N)�_main_threadr�r@r��_pickSomeNonDaemonThreadr�)ZtlockrAr r r!�	_shutdownsr�cCs(x"t�D]}|jr|j�r|SqWdS)N)r
r�r�)rAr r r!r�&sr�cCstS)N)r�r r r r!r,s)�_local)rcCs�t�ai}t�}|at�|tt��}|jt�xF|D]>}||kr`|jd�t	�}||_
|||<q4|jd�|j�q4Wtj
�tj
�tj|�WdQRXdS)NTF)rr�rr�rjr��updater�rhr	r�r�r�rkr/)Z
new_activeZcurrentZthreadsZthreadr�r r r!�_after_fork=s&






r�)r)L�sysr��_threadZtimerrUrrW�	tracebackrr��_weakrefsetr�	itertoolsrr_rr+�_collectionsrrN�ImportError�collections�__all__�start_new_threadr��
allocate_lockr(r�r	�errorrrr#rMrrr"rrrr'r$rrrrrr?r�__next__r�r�r�r/r�r�rrr�r�rZ
currentThreadr
ZactiveCountr�r
rr�r�r�rr�rZ_threading_localr�r r r r!�<module>s�



q9P&O
'
_bootlocale.cpython-36.pyc000064400000001726150335715140011466 0ustar003


 \�@sddZddlZddlZejjd�r,d	dd�Zn4y
ejWnek
rTd
dd�ZYnXddd�ZdS)z�A minimal subset of the locale module used at interpreter startup
(imported by the _io module), in order to reduce startup time.

Don't import directly from third-party code; use the `locale` module instead!
�N�winTcCstj�dS)N�)�_localeZ_getdefaultlocale)�do_setlocale�r�#/usr/lib64/python3.6/_bootlocale.py�getpreferredencodingsrcCsddl}|j|�S)Nr)�localer)rr	rrrrscCs.|s
t�tjtj�}|r*tjdkr*d}|S)N�darwinzUTF-8)�AssertionErrorr�nl_langinfo�CODESET�sys�platform)r�resultrrrrs

)T)T)T)�__doc__rrr�
startswithrr
�AttributeErrorrrrr�<module>s
dummy_threading.cpython-36.opt-2.pyc000064400000001333150335715140013316 0ustar003


 \�
�@s�ddlmZddlZdZdZdZz�dekr6edZdZeded<dekr\edZdZed=dekrvedZ	dZed=ddl
Z
eded	<ed=eded
<ed=ddlTddlmZWder�eed<[[er�e	ed<[	[er�eed<[ned=[[[XdS)
�)�modulesNF�_threadT�
_dummy_thread�	threadingZ_threading_local�_dummy_threadingZ_dummy__threading_local)�*)�__all__)
�sysrZsys_modulesrZholding_threadZholding_threadingZholding__threading_localZheld_threadZheld_threadingZheld__threading_localrrr�r
r
�'/usr/lib64/python3.6/dummy_threading.py�<module>	sNopcode.cpython-36.pyc000064400000012447150335715140010457 0ustar003


 \��@s�dZddddddddd	d
ddd
g
ZyddlmZejd�Wnek
rPYnX�dZgZgZgZ	gZ
gZgZgZ
gZiZdd�ed�D�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zed(d)�ed*d+�ed,d-�ed.d/�ed0d1�ed2d3�ed4d5�ed6d7�ed8d9�ed:d;�ed<d=�ed>d?�ed@dA�edBdC�edDdE�edFdG�edHdI�edJdK�edLdM�edNdO�edPdQ�edRdS�edTdU�edVdW�edXdY�edZd[�ed\d]�ed^d_�ed`da�edbdc�eddde�edfdg�edhdi�edjdk�edldm�edndo�edpdq�edrds�edtdu�edvdw�edxdy�edzd{�ed|d}�ed~d�ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��d�Zed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ejd��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ejd��ed�d��ed�d��ed�dÃed�dŃed�dǃed�dɃed�d˃ed�d̓ed�dσed�dуed�dӃed�dՃed�d׃ed�dكejdكed�dۃejdۃed�d݃ejd݃ed�d߃ed�d�ed�d�ed�d�ed�d�ed�d�e
jd�ed�d�e
jd�ed�d�e
jd�ed�d�e
jd�ed�d�ed�d�ed�d��ed�d��ed�d��ed�d��ed�d��e
jd��edd��d�Zed��d�e�d�d�e�d�d�e�d�d�e�d�d�e�d	�d
�e�d�d�e�d
�d�e�d�d�e�d�d�[[[[�dS(zy
opcode module - potentially shared between dis and other modules which
operate on bytecodes (e.g. peephole optimizers).
�cmp_op�hasconst�hasname�hasjrel�hasjabs�haslocal�
hascompare�hasfree�opname�opmap�
HAVE_ARGUMENT�EXTENDED_ARG�hasnargs�)�stack_effectr�<�<=�==�!=�>�>=�in�not in�is�is not�exception match�BADcCsg|]}d|f�qS)z<%r>�)�.0�oprr�/usr/lib64/python3.6/opcode.py�
<listcomp>%sr �cCs|t|<|t|<dS)N)r	r
)�namerrrr�def_op'sr#cCst||�tj|�dS)N)r#r�append)r"rrrr�name_op+s
r%cCst||�tj|�dS)N)r#rr$)r"rrrr�jrel_op/s
r&cCst||�tj|�dS)N)r#rr$)r"rrrr�jabs_op3s
r'ZPOP_TOP�ZROT_TWO�Z	ROT_THREE�ZDUP_TOP�ZDUP_TOP_TWO�ZNOP�	ZUNARY_POSITIVE�
ZUNARY_NEGATIVE�Z	UNARY_NOT�ZUNARY_INVERT�ZBINARY_MATRIX_MULTIPLY�ZINPLACE_MATRIX_MULTIPLY�ZBINARY_POWER�ZBINARY_MULTIPLY�Z
BINARY_MODULO�Z
BINARY_ADD�ZBINARY_SUBTRACT�Z
BINARY_SUBSCR�ZBINARY_FLOOR_DIVIDE�ZBINARY_TRUE_DIVIDE�ZINPLACE_FLOOR_DIVIDE�ZINPLACE_TRUE_DIVIDE�Z	GET_AITER�2Z	GET_ANEXT�3ZBEFORE_ASYNC_WITH�4ZINPLACE_ADD�7ZINPLACE_SUBTRACT�8ZINPLACE_MULTIPLY�9ZINPLACE_MODULO�;ZSTORE_SUBSCR�<Z
DELETE_SUBSCR�=Z
BINARY_LSHIFT�>Z
BINARY_RSHIFT�?Z
BINARY_AND�@Z
BINARY_XOR�AZ	BINARY_OR�BZ
INPLACE_POWER�CZGET_ITER�DZGET_YIELD_FROM_ITER�EZ
PRINT_EXPR�FZLOAD_BUILD_CLASS�GZ
YIELD_FROM�HZ
GET_AWAITABLE�IZINPLACE_LSHIFT�KZINPLACE_RSHIFT�LZINPLACE_AND�MZINPLACE_XOR�NZ
INPLACE_OR�OZ
BREAK_LOOP�PZWITH_CLEANUP_START�QZWITH_CLEANUP_FINISH�RZRETURN_VALUE�SZIMPORT_STAR�TZSETUP_ANNOTATIONS�UZYIELD_VALUE�VZ	POP_BLOCK�WZEND_FINALLY�XZ
POP_EXCEPT�Y�ZZ
STORE_NAMEZDELETE_NAME�[ZUNPACK_SEQUENCE�\ZFOR_ITER�]Z	UNPACK_EX�^Z
STORE_ATTR�_ZDELETE_ATTR�`ZSTORE_GLOBAL�aZ
DELETE_GLOBAL�bZ
LOAD_CONST�dZ	LOAD_NAME�eZBUILD_TUPLE�fZ
BUILD_LIST�gZ	BUILD_SET�hZ	BUILD_MAP�iZ	LOAD_ATTR�jZ
COMPARE_OP�kZIMPORT_NAME�lZIMPORT_FROM�mZJUMP_FORWARD�nZJUMP_IF_FALSE_OR_POP�oZJUMP_IF_TRUE_OR_POP�pZ
JUMP_ABSOLUTE�qZPOP_JUMP_IF_FALSE�rZPOP_JUMP_IF_TRUE�sZLOAD_GLOBAL�tZ
CONTINUE_LOOP�wZ
SETUP_LOOP�xZSETUP_EXCEPT�yZ
SETUP_FINALLY�zZ	LOAD_FAST�|Z
STORE_FAST�}ZDELETE_FAST�~ZSTORE_ANNOTATION�Z
RAISE_VARARGS�Z
CALL_FUNCTION�Z
MAKE_FUNCTION�ZBUILD_SLICE�ZLOAD_CLOSURE�Z
LOAD_DEREF�ZSTORE_DEREF�ZDELETE_DEREF�ZCALL_FUNCTION_KW�ZCALL_FUNCTION_EX�Z
SETUP_WITH�ZLIST_APPEND�ZSET_ADD�ZMAP_ADD�ZLOAD_CLASSDEREF��ZBUILD_LIST_UNPACK�ZBUILD_MAP_UNPACK�ZBUILD_MAP_UNPACK_WITH_CALL�ZBUILD_TUPLE_UNPACK�ZBUILD_SET_UNPACK�ZSETUP_ASYNC_WITH�ZFORMAT_VALUE�ZBUILD_CONST_KEY_MAP�ZBUILD_STRING�ZBUILD_TUPLE_UNPACK_WITH_CALL�N)rrrrrrrrrrrr)�__doc__�__all__Z_opcoderr$�ImportErrorrrrrrrrrr
r
�ranger	r#r%r&r'rrrrrr�<module>s6


	





















































































































pyclbr.cpython-36.pyc000064400000020257150335715140010477 0ustar003


 \�4�@s�dZddlZddlZddlZddlZddlmZmZm	Z	ddddgZ
iZGdd�d�ZGd	d�d�Z
dd
d�Zddd�Zddd
�Zdd�Zdd�Zdd�Zedkr�e�dS)a�Parse a Python module and describe its classes and methods.

Parse enough of a Python file to recognize imports and class and
method definitions, and to find out the superclasses of a class.

The interface consists of a single function:
        readmodule_ex(module [, path])
where module is the name of a Python module, and path is an optional
list of directories where the module is to be searched.  If present,
path is prepended to the system search path sys.path.  The return
value is a dictionary.  The keys of the dictionary are the names of
the classes defined in the module (including classes that are defined
via the from XXX import YYY construct).  The values are class
instances of the class Class defined here.  One special key/value pair
is present for packages: the key '__path__' has a list as its value
which contains the package search path.

A class is described by the class Class in this module.  Instances
of this class have the following instance variables:
        module -- the module name
        name -- the name of the class
        super -- a list of super classes (Class instances)
        methods -- a dictionary of methods
        file -- the file in which the class was defined
        lineno -- the line in the file on which the class statement occurred
The dictionary of methods uses the method names as keys and the line
numbers on which the method was defined as values.
If the name of a super class is not recognized, the corresponding
entry in the list of super classes is not a class instance but a
string giving the name of the super class.  Since import statements
are recognized and imported modules are scanned as well, this
shouldn't happen often.

A function is described by the class Function in this module.
Instances of this class have the following instance variables:
        module -- the module name
        name -- the name of the class
        file -- the file in which the class was defined
        lineno -- the line in the file on which the class statement occurred
�N)�NAME�DEDENT�OP�
readmodule�
readmodule_ex�Class�Functioncs(eZdZdZ�fdd�Zdd�Z�ZS)rz"Class to represent a Python class.cs4||_||_|dkrg}||_i|_||_||_dS)N)�module�name�super�methods�file�lineno)�selfr	r
rr
r)�	__class__��/usr/lib64/python3.6/pyclbr.py�__init__7szClass.__init__cCs||j|<dS)N)r)rr
rrrr�
_addmethodAszClass._addmethod)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__rr)rrr5s
c@seZdZdZdd�ZdS)rz.Class to represent a top-level Python functioncCs||_||_||_||_dS)N)r	r
r
r)rr	r
r
rrrrrFszFunction.__init__N)rrrrrrrrrrDscCs:i}x0t||pg�j�D]\}}t|t�r|||<qW|S)z}Backwards compatible interface.

    Call readmodule_ex() and then only keep Class objects from the
    resulting dictionary.)�_readmodule�items�
isinstancer)r	�path�res�key�valuerrrrLs

cCst||p
g�S)z�Read a module file and return a dictionary of classes.

    Search for MODULE in PATH and sys.path, read and parse the
    module and return a dictionary with one entry for each class
    found in the module.
    )r)r	rrrrrXsc&!Cs�|dk	rd||f}n|}|tkr*t|Si}|tjkrL|dkrL|t|<|S|jd�}|dkr�|d|�}||dd�}t|||�}|dk	r�d||f}d|kr�tdj|���t||d|�Sd}	|dk	r�|}
n
|tj}
tj	j
||
�}|t|<|jdk	�r|j|d<y|jj
|�}|dk�r$|SWnttfk
�r@|SX|jj|�}
tj|�}	g}tj|	j�}�y<�x4|D�]*\}}}}}|tk�r�|\}}x$|�r�|dd|k�r�|d=�q�W�qt|dk�rl|\}}x$|�r�|dd|k�r�|d=�q�Wt|�dd	�\}}}|tk�r�qt|�rH|dd}t|t��rZ|j||�nt|||
|�||<|jd|f��qt|d
k�rD|\}}x$|�r�|dd|k�r�|d=�q�Wt|�dd	�\}}}|tk�rȐqtt|�dd	�\}}}d}|dk�rg}d}g}�xt|�dd	�\}}}|dk�r�|dk�r�dj|�}||k�rD||}nL|jd�}t|�dk�r�|d} |d}| tk�r�t| }!||!k�r�|!|}|j|�g}|dk�r�|d7}nX|dk�r�|d8}|dk�r
Pn8|d
k�r�|dk�r�n"|tt fk�r�|dk�r�|j|��q�W|}t||||
|�}|�s2|||<|j||f��qt|dk�r�|ddk�r�t!|�}"xl|"D]d\}#}$yL|dk�r�t|#|�n2yt|#||�Wn tk
�r�t|#g�YnXWnYnX�qjWn�|dk�rt|ddk�rtt"|�\}#}|#�st|dk�r�qtt!|�}yt|#||�}!Wn�wtYnXxd|D]\\}}%||!k�rd|!|||%�p`|<n4|dk�r>x(|!D] }|ddk�rt|!|||<�qtW�q>W�qtWWnt#k
�r�YnX|	j$�|S)a.Do the hard work for readmodule[_ex].

    If INPACKAGE is given, it must be the dotted name of the package in
    which we are searching for a submodule, and then PATH must be the
    package search path; otherwise, we are searching for a top-level
    module, and PATH is combined with sys.path.
    Nz%s.%s�.r��__path__zNo package named {}�def��class�(�)�,���import�from�*�_���r0r0r0r0r0r0)r(r)���r0)%�_modules�sys�builtin_module_names�rfindr�ImportError�formatr�	importlib�util�_find_spec_from_path�submodule_search_locations�loader�
get_source�AttributeError�get_filename�io�StringIO�tokenize�generate_tokens�readliner�nextrrrrr�append�join�split�lenr�_getnamelist�_getname�
StopIteration�close)&r	rZ	inpackageZ
fullmodule�dict�i�packageZ	submodule�parent�fZsearch_path�spec�sourceZfname�stack�g�	tokentype�token�startZ_end�_linerZ
thisindentZ	meth_nameZ	cur_class�
class_nameZinherit�names�levelr�n�c�m�d�modules�modZ_mod2Zn2rrrras	


























"rcCstg}xjt|�\}}|sP|dkr.t|�\}}nd}|j||f�x |dkr`d|kr`t|�d}qBW|dkrPqW|S)N�asr)�
r")rKrFrE)rVr\r
rXZname2rrrrJsrJcCs�g}t|�dd�\}}|tkr0|dkr0d|fS|j|�xJt|�dd�\}}|dkrZPt|�dd�\}}|tkrxP|j|�q<Wdj|�|fS)Nrr+r.r!)rErrFrG)rV�partsrWrXrrrrK3s
rKc
Csddl}ddlm}tjd}|jj|�r`|jj|�g}|jj|�}|j	�j
d�rd|dd
�}ng}t||�}t|j
��}|jdd�d�x�|D]z}t|t�r�td	|j|j|j�t|jj�|d�d�}x@|D]\}}	|d
kr�td||	�q�Wq�t|t�r�td|j|j�q�WdS)Nr)�
itemgetterr"z.pyr%cSst|dd�S)Nrr)�getattr)�arrr�<lambda>Tsz_main.<locals>.<lambda>)rr&r#z  defr$���)�os�operatorrgr3�argvr�exists�dirname�basename�lower�endswithr�list�values�sortrr�printr
rr�sortedrrr)
rlrgrcrrNZobjs�objrr
rrrr�_mainFs*




rz�__main__)N)N)N)rr@r3�importlib.utilr8rBrXrrr�__all__r2rrrrrrJrKrzrrrrr�<module>(s$

	
?gzip.cpython-36.opt-1.pyc000064400000037544150335715140011123 0ustar003


 \nO�@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddddgZ	d\Z
ZZZ
Zd\ZZddd�Zdd�ZGdd�d�ZGdd�dej�ZGdd�dej�Zddd�Zdd�Zdd�Zedkr�e�dS)z�Functions that read and write gzipped files.

The user of the file doesn't have to worry about the compression,
but random access is not allowed.�N�GzipFile�open�compress�
decompress������rb�	cCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|jdd�}t|tttjf�r|t|||�}n,t|d	�s�t|d
�r�td|||�}nt	d��d|kr�t
j||||�S|SdS)aOpen a gzip-compressed file in binary or text mode.

    The filename argument can be an actual filename (a str or bytes object), or
    an existing file object to read from or write to.

    The mode argument can be "r", "rb", "w", "wb", "x", "xb", "a" or "ab" for
    binary mode, or "rt", "wt", "xt" or "at" for text mode. The default mode is
    "rb", and the default compresslevel is 9.

    For binary mode, this function is equivalent to the GzipFile constructor:
    GzipFile(filename, mode, compresslevel). In this case, the encoding, errors
    and newline arguments must not be provided.

    For text mode, a GzipFile object is created, and wrapped in an
    io.TextIOWrapper instance with the specified encoding, error handling
    behavior, and line ending(s).

    �t�bzInvalid mode: %rNz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary mode��read�writez1filename must be a str or bytes object, or a file)�
ValueError�replace�
isinstance�str�bytes�os�PathLiker�hasattr�	TypeError�io�
TextIOWrapper)�filename�mode�
compresslevel�encoding�errors�newlineZgz_modeZbinary_file�r#�/usr/lib64/python3.6/gzip.pyrs$cCs|jtjd|��dS)Nz<L)r�structZpack)�output�valuer#r#r$�write32u@sr(c@s<eZdZdZddd�Zdd�Zddd�Zd	d
�Zdd�Zd
S)�_PaddedFilez�Minimal read-only file object that prepends a string to the contents
    of an actual file. Shouldn't be used outside of gzip.py, as it lacks
    essential functionality.�cCs ||_t|�|_||_d|_dS)Nr)�_buffer�len�_length�file�_read)�self�f�prependr#r#r$�__init__Js
z_PaddedFile.__init__cCs~|jdkr|jj|�S|j||jkrJ|j}|j|7_|j||j�S|j}d|_|j|d�|jj||j|�SdS)N)r/r.rr-r+)r0�sizerr#r#r$rPs
z_PaddedFile.readcCs>|jdkr||_n|jt|�8_dSt|j�|_d|_dS)Nr)r/r+r,r-)r0r2r#r#r$r2]s
z_PaddedFile.prependcCsd|_d|_|jj|�S)N)r/r+r.�seek)r0Zoffr#r#r$r5fsz_PaddedFile.seekcCsdS)NTr#)r0r#r#r$�seekableksz_PaddedFile.seekableN)r*)r*)	�__name__�
__module__�__qualname__�__doc__r3rr2r5r6r#r#r#r$r)Es

	r)c@s�eZdZdZdZd-dd�Zedd��Zedd	��Zd
d�Z	dd
�Z
dd�Zdd�Zd/dd�Z
d1dd�Zdd�Zedd��Zdd�Zejfdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zejfd)d*�Zd3d+d,�ZdS)4ra
The GzipFile class simulates most of the methods of a file object with
    the exception of the truncate() method.

    This class only supports opening files in binary mode. If you need to open a
    compressed file in text mode, use the gzip.open() function.

    NrcCs2|r"d|ksd|kr"tdj|���|r6d|kr6|d7}|dkrTtj||pJd�}|_|dkr|t|dd�}t|ttf�s�d}n
t	j
|�}|dkr�t|d	d�}|jd
�r�t|_
t|�}tj|�|_||_nN|jd��rt|_
|j|�tj|tjtjtjd�|_||_ntdj|���||_|j
tk�r.|j�dS)aGConstructor for the GzipFile class.

        At least one of fileobj and filename must be given a
        non-trivial value.

        The new class instance is based on fileobj, which can be a regular
        file, an io.BytesIO object, or any other object which simulates a file.
        It defaults to None, in which case filename is opened to provide
        a file object.

        When fileobj is not None, the filename argument is only used to be
        included in the gzip file header, which may include the original
        filename of the uncompressed file.  It defaults to the filename of
        fileobj, if discernible; otherwise, it defaults to the empty string,
        and in this case the original filename is not included in the header.

        The mode argument can be any of 'r', 'rb', 'a', 'ab', 'w', 'wb', 'x', or
        'xb' depending on whether the file will be read or written.  The default
        is the mode of fileobj if discernible; otherwise, the default is 'rb'.
        A mode of 'r' is equivalent to one of 'rb', and similarly for 'w' and
        'wb', 'a' and 'ab', and 'x' and 'xb'.

        The compresslevel argument is an integer from 0 to 9 controlling the
        level of compression; 1 is fastest and produces the least compression,
        and 9 is slowest and produces the most compression. 0 is no compression
        at all. The default is 9.

        The mtime argument is an optional numeric timestamp to be written
        to the last modification time field in the stream when compressing.
        If omitted or None, the current time is used.

        r
�UzInvalid mode: {!r}rNr�namerr�r�w�a�xr)r>r?r@)r�format�builtinsr�	myfileobj�getattrrrrr�fspath�
startswith�READr�_GzipReaderr�BufferedReaderr+r<�WRITE�_init_write�zlibZcompressobjZDEFLATED�	MAX_WBITSZ
DEF_MEM_LEVELr�_write_mtime�fileobj�_write_gzip_header)r0rrrrO�mtime�rawr#r#r$r3{s>#


zGzipFile.__init__cCsBddl}|jdtd�|jtkr<|jdd�dkr<|jdS|jS)Nrzuse the name attributer�z.gz���)�warnings�warn�DeprecationWarningrrJr<)r0rUr#r#r$r�s

zGzipFile.filenamecCs
|jjjS)z0Last modification time read from stream, or None)r+rR�_last_mtime)r0r#r#r$rQ�szGzipFile.mtimecCs.t|j�}d|dd�dtt|��dS)Nz<gzip r� �>���)�reprrO�hex�id)r0�sr#r#r$�__repr__�s
zGzipFile.__repr__cCs.||_tjd�|_d|_g|_d|_d|_dS)Nr*r)r<rL�crc32�crcr4Zwritebuf�bufsize�offset)r0rr#r#r$rK�szGzipFile._init_writecCs�|jjd�|jjd�y<tjj|j�}t|t�s<|jd�}|j	d�rR|dd�}Wnt
k
rld}YnXd}|rzt}|jjt|�jd��|j
}|dkr�tj�}t|jt|��|jjd�|jjd	�|r�|jj|d
�dS)Ns��zlatin-1s.gzrSr*r����rT)rOrr�path�basenamer<rr�encode�endswith�UnicodeEncodeError�FNAME�chrrN�timer(�int)r0Zfname�flagsrQr#r#r$rP�s,



zGzipFile._write_gzip_headercCs�|j�|jtkr&ddl}t|jd��|jdkr8td��t|t	�rLt
|�}nt|�}|j}|dkr�|jj
|jj|��|j|7_tj||j�|_|j|7_|S)Nrz$write() on read-only GzipFile objectz!write() on closed GzipFile object)�_check_not_closedrrJ�errno�OSError�EBADFrOrrrr,�
memoryview�nbytesrrr4rLrarbrd)r0�datartZlengthr#r#r$r�s 



zGzipFile.writercCs2|j�|jtkr&ddl}t|jd��|jj|�S)Nrz$read() on write-only GzipFile object)rsrrGrtrurvr+r)r0r4rtr#r#r$rs

z
GzipFile.readcCs@|j�|jtkr&ddl}t|jd��|dkr4tj}|jj	|�S)zdImplements BufferedIOBase.read1()

        Reads up to a buffer's worth of data is size is negative.rNz%read1() on write-only GzipFile object)
rsrrGrtrurvr�DEFAULT_BUFFER_SIZEr+�read1)r0r4rtr#r#r$r{s
zGzipFile.read1cCs2|j�|jtkr&ddl}t|jd��|jj|�S)Nrz$peek() on write-only GzipFile object)rsrrGrtrurvr+�peek)r0�nrtr#r#r$r|#s

z
GzipFile.peekcCs
|jdkS)N)rO)r0r#r#r$�closed*szGzipFile.closedcCs�|j}|dkrdSd|_zP|jtkrR|j|jj��t||j�t||jd@�n|jt	krf|j
j�Wd|j}|r�d|_|j�XdS)Nl��)
rOrrJrr�flushr(rbr4rGr+�closerC)r0rOrCr#r#r$r�.s

zGzipFile.closecCs4|j�|jtkr0|jj|jj|��|jj�dS)N)rsrrJrOrrr)r0Z	zlib_moder#r#r$rAs
zGzipFile.flushcCs
|jj�S)z�Invoke the underlying file object's fileno() method.

        This will raise AttributeError if the underlying file object
        doesn't support fileno().
        )rO�fileno)r0r#r#r$r�HszGzipFile.filenocCs"|jtkrtd��|jjd�dS)z[Return the uncompressed stream file position indicator to the
        beginning of the filezCan't rewind in write moderN)rrGrur+r5)r0r#r#r$�rewindPs
zGzipFile.rewindcCs
|jtkS)N)rrG)r0r#r#r$�readableWszGzipFile.readablecCs
|jtkS)N)rrJ)r0r#r#r$�writableZszGzipFile.writablecCsdS)NTr#)r0r#r#r$r6]szGzipFile.seekablecCs�|jtkr�|tjkr2|tjkr*|j|}ntd��||jkrDtd��||j}dd}xt|d�D]}|j	|�qdW|j	d|d�n |jt
kr�|j�|jj
||�S|jS)NzSeek from end not supportedzNegative seek in write moderhi)rrJr�SEEK_SET�SEEK_CURrdrru�rangerrGrsr+r5)r0rd�whence�count�chunk�ir#r#r$r5`s 





z
GzipFile.seekcCs|j�|jj|�S)N)rsr+�readline)r0r4r#r#r$r�tszGzipFile.readline)NNrNNr[)r[r[)r[r[)r[)r7r8r9r:rCr3�propertyrrQr`rKrPrrr{r|r~r�rLZZ_SYNC_FLUSHrr�r�r�r�r6rr�r5r�r#r#r#r$rns.
H


csZeZdZ�fdd�Zdd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Z	�fdd�Z
�ZS)rHcs,t�jt|�tjtjd�d|_d|_dS)N)ZwbitsT)�superr3r)rLZ
decompressobjrM�_new_memberrX)r0�fp)�	__class__r#r$r3zsz_GzipReader.__init__cCstjd�|_d|_dS)Nr*r)rLra�_crc�_stream_size)r0r#r#r$�
_init_read�sz_GzipReader._init_readcCsJ|jj|�}x8t|�|krD|jj|t|��}|s:td��||7}qW|S)z�Read exactly *n* bytes from `self._fp`

        This method is required because self._fp may be unbuffered,
        i.e. return short reads.
        zACompressed file ended before the end-of-stream marker was reached)�_fprr,�EOFError)r0r}ryrr#r#r$�_read_exact�sz_GzipReader._read_exactcCs�|jjd�}|dkrdS|dkr,td|��tjd|jd��\}}|_|dkrVtd��|t@r|tjd	|jd��\}|j|�|t@r�x |jjd
�}|s�|dkr�Pq�W|t	@r�x |jjd
�}|s�|dkr�Pq�W|t
@r�|jd�dS)
Nrr*Fs�zNot a gzipped file (%r)z<BBIxxr	zUnknown compression methodz<HrrhT)r�rrur%�unpackr�rX�FEXTRArn�FCOMMENT�FHCRC)r0�magic�method�flagZ	extra_lenr_r#r#r$�_read_gzip_header�s0

z_GzipReader._read_gzip_headerrcCs�|dkr|j�S|sdSx�|jjr@|j�d|_|jf|j�|_|jrh|j�|j�sb|j	|_
dSd|_|jjt
j�}|jj||�}|jjdkr�|jj|jj�n|jjdkr�|jj|jj�|dkr�P|dkrtd��qW|j|�|j	t|�7_	|S)Nrr*TFzACompressed file ended before the end-of-stream marker was reached)�readallZ
_decompressor�eof�	_read_eofr�Z_decomp_factoryZ_decomp_argsr�r�Z_posZ_sizer�rrrzrZunconsumed_tailr2Zunused_datar��_add_read_datar,)r0r4�bufZ
uncompressr#r#r$r�s:

z_GzipReader.readcCs$tj||j�|_|jt|�|_dS)N)rLrar�r�r,)r0ryr#r#r$r��sz_GzipReader._add_read_datacCs�tjd|jd��\}}||jkr<tdt|�t|j�f��n||jd@krRtd��d}x|dkrn|jjd�}qXW|r�|jj	|�dS)Nz<IIr	zCRC check failed %s != %sl��z!Incorrect length of data producedrhr)
r%r�r�r�rur]r�r�rr2)r0raZisize�cr#r#r$r��s


z_GzipReader._read_eofcst�j�d|_dS)NT)r��_rewindr�)r0)r�r#r$r�s
z_GzipReader._rewindr[)r[)r7r8r9r3r�r�r�rr�r�r��
__classcell__r#r#)r�r$rHys!
3rHc	Cs4tj�}t|d|d��}|j|�WdQRX|j�S)z�Compress data in one shot and return the compressed string.
    Optional argument is the compression level, in range of 0-9.
    �wb)rOrrN)r�BytesIOrr�getvalue)ryrr�r1r#r#r$rsc	Cs$ttj|�d��
}|j�SQRXdS)zYDecompress a gzip compressed string in one shot.
    Return the decompressed string.
    )rON)rrr�r)ryr1r#r#r$rscCs>tjdd�}|o|ddk}|r.|dd�}|s8dg}�x�|D]�}|r�|dkrltddtjjd�}tjj}q�|d
d�d	kr�td
t|��q@t|d�}t	j|dd�d�}n>|dkr�tjj}tddtjjd�}nt	j|d�}t|d	d�}x |j
d�}|�s�P|j|�q�W|tjjk	�r"|j�|tjjk	r@|j�q@WdS)Nrrz-d�-rr)rrrOrSz.gzzfilename doesn't end in .gz:r�irTrT)
�sys�argvr�stdin�buffer�stdout�printr\rrBrrr�)�argsr�argr1�gr�r#r#r$�_tests<


r��__main__)rrrr	r
)rr)rrNNN)r)r:r%r�rprrLrBrZ_compression�__all__ZFTEXTr�r�rnr�rGrJrr(r)Z
BaseStreamrZDecompressReaderrHrrr�r7r#r#r#r$�<module>s, 
+)

	&_pydecimal.cpython-36.opt-2.pyc000064400000240115150335715140012247 0ustar003


 \T��$@sFdddddddddd	d
ddd
ddddddddddddddddddd d!d"d#g$ZeZd$Zd%Zd&Zd'd(lZd'd(lZd'd(l	Z	yd'd)l
mZedd*�Z
Wnek
r�d+d,�Z
YnXdZdZdZdZdZdZdZdZd-Ze	jd�kr�d1Zd1Zd�Znd2Zd2Zd�Zeed0ZGd3d�de�ZGd4d�de�ZGd5d�de�Z Gd6d�de �Z!Gd7d	�d	ee"�Z#Gd8d�de �Z$Gd9d�de e"�Z%Gd:d
�d
e�Z&Gd;d�de �Z'Gd<d�de�Z(Gd=d�de�Z)Gd>d
�d
e&e(�Z*Gd?d�de&e(e)�Z+Gd@d�dee,�Z-ee#e&e*e(e+e e)e-g	Z.e!e e$e e%e e'e iZ/eeeeeeeefZ0yd'd(l1Z1Wn.ek
�rdGdAdB�dBe2�Z3e3�Z1[3YnXy
e1j4Wn>e5k
�r�e6e1j7�dC��r�e1j7�`8dDd�Z9dEd�Z:Yn6Xe1j4�Z4e6e4dC��r�e4`8e4fdFd�Z:e4fdGd�Z9[1[4d�dHd�Z;GdId�de2�Z<d�dKdL�Z=ej>j?e<�GdMdN�dNe2�Z@GdOd�de2�ZAGdPdQ�dQe2�ZBd�dRdS�ZCeDjEZFdTdU�ZGdVdW�ZHdXdY�ZIdZd[�ZJd�d]d^�ZKd_d`�ZLdadb�ZMGdcdd�dde2�ZNeN�jOZPd�dedf�ZQdgdh�ZRdidj�ZSdkdldmdndodpdqdrdsdt�	fdudv�ZTd�dwdx�ZUd�dydz�ZVeAd{ee#e*e ggd|d�d0d'd}�ZWeAd~ee#e*e ee+ggd�ZXeAd~eggd�ZYd'd(lZZZeZj[d�eZj\eZj]B�j^Z_eZj[d��j^Z`eZj[d��j^ZaeZj[d�eZj\eZjbB�Zc[Zyd'd(ldZeWnek
�r�YnXd�d�d��Zfd�d��Zgd�d��Zhd�d�d��Zid�d��Zjd�d��Zke<d��Zle<d��Zme<d��Zne<d'�Zoe<d0�Zpe<d��ZqelemfZre	jsjtZue	jsjvZwe	jsjxZyezdreud.eu�Z{[	d(S)��Decimal�Context�DecimalTuple�DefaultContext�BasicContext�ExtendedContext�DecimalException�Clamped�InvalidOperation�DivisionByZero�Inexact�Rounded�	Subnormal�Overflow�	Underflow�FloatOperation�DivisionImpossible�InvalidContext�ConversionSyntax�DivisionUndefined�
ROUND_DOWN�
ROUND_HALF_UP�ROUND_HALF_EVEN�
ROUND_CEILING�ROUND_FLOOR�ROUND_UP�ROUND_HALF_DOWN�
ROUND_05UP�
setcontext�
getcontext�localcontext�MAX_PREC�MAX_EMAX�MIN_EMIN�	MIN_ETINY�HAVE_THREADSZdecimalz1.70z2.4.2�N)�
namedtuplezsign digits exponentcGs|S)N�)�argsr'r'�"/usr/lib64/python3.6/_pydecimal.py�<lambda>�sr*T��?�l��N�Zoi@�Tc@seZdZdd�ZdS)rcGsdS)Nr')�self�contextr(r'r'r)�handle�szDecimalException.handleN)�__name__�
__module__�__qualname__r0r'r'r'r)r�sc@seZdZdS)rN)r1r2r3r'r'r'r)r�s
c@seZdZdd�ZdS)r	cGs,|r(t|dj|djdd�}|j|�StS)Nr%�nT)�_dec_from_triple�_sign�_int�_fix_nan�_NaN)r.r/r(�ansr'r'r)r0�s
zInvalidOperation.handleN)r1r2r3r0r'r'r'r)r	�sc@seZdZdd�ZdS)rcGstS)N)r9)r.r/r(r'r'r)r0szConversionSyntax.handleN)r1r2r3r0r'r'r'r)r�sc@seZdZdd�ZdS)r
cGst|S)N)�_SignedInfinity)r.r/�signr(r'r'r)r0szDivisionByZero.handleN)r1r2r3r0r'r'r'r)r
s
c@seZdZdd�ZdS)rcGstS)N)r9)r.r/r(r'r'r)r0szDivisionImpossible.handleN)r1r2r3r0r'r'r'r)rsc@seZdZdd�ZdS)rcGstS)N)r9)r.r/r(r'r'r)r0)szDivisionUndefined.handleN)r1r2r3r0r'r'r'r)r!sc@seZdZdS)rN)r1r2r3r'r'r'r)r,s
c@seZdZdd�ZdS)rcGstS)N)r9)r.r/r(r'r'r)r0CszInvalidContext.handleN)r1r2r3r0r'r'r'r)r8sc@seZdZdS)rN)r1r2r3r'r'r'r)rFs
c@seZdZdS)r
N)r1r2r3r'r'r'r)r
Rs	c@seZdZdd�ZdS)rcGs�|jttttfkrt|S|dkrR|jtkr4t|St|d|j|j	|jd�S|dkr�|jt
krlt|St|d|j|j	|jd�SdS)Nr%�9r-)�roundingrrrrr;rr5�prec�Emaxr)r.r/r<r(r'r'r)r0ss


zOverflow.handleN)r1r2r3r0r'r'r'r)r]sc@seZdZdS)rN)r1r2r3r'r'r'r)r�s
c@seZdZdS)rN)r1r2r3r'r'r'r)r�s
c@seZdZefdd�ZdS)�
MockThreadingcCs
|jtS)N)�modules�	__xname__)r.�sysr'r'r)�local�szMockThreading.localN)r1r2r3rDrEr'r'r'r)rA�srA�__decimal_context__cCs,|tttfkr|j�}|j�|tj�_dS)N)rrr�copy�clear_flags�	threading�current_threadrF)r/r'r'r)r�scCs4y
tj�jStk
r.t�}|tj�_|SXdS)N)rIrJrF�AttributeErrorr)r/r'r'r)r�s

cCs,y|jStk
r&t�}||_|SXdS)N)rFrKr)�_localr/r'r'r)r�scCs(|tttfkr|j�}|j�||_dS)N)rrrrGrHrF)r/rLr'r'r)r�scCs|dkrt�}t|�S)N)r�_ContextManager)Zctxr'r'r)r�s$c
@s�eZdZd�Zd�dd�Zed	d
��Zdd�Zd
d�Zd�dd�Z	dd�Z
dd�Zdd�Zd�dd�Z
d�dd�Zd�dd�Zd�dd�Zd�dd �Zd�d!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd�d,d-�Zd�d.d/�Zd�d0d1�Z�dd2d3�Z�dd5d6�Z�dd7d8�ZeZ�dd9d:�Z�dd;d<�Z�dd=d>�Z e Z!�dd?d@�Z"dAdB�Z#�ddCdD�Z$�ddEdF�Z%�d	dGdH�Z&�d
dIdJ�Z'�ddKdL�Z(�ddMdN�Z)�d
dOdP�Z*�ddQdR�Z+dSdT�Z,dUdV�Z-e-Z.dWdX�Z/e0e/�Z/dYdZ�Z1e0e1�Z1d[d\�Z2d]d^�Z3d_d`�Z4dadb�Z5dcdd�Z6dedf�Z7dgdh�Z8didj�Z9dkdl�Z:dmdn�Z;dodp�Z<dqdr�Z=e>e6e7e8e9e:e;e<e=ds�Z?�ddtdu�Z@dvdw�ZAdxdy�ZB�ddzd{�ZC�dd|d}�ZDd~d�ZE�dd�d��ZF�dd�d��ZG�dd�d��ZH�dd�d��ZI�dd�d��ZJd�d��ZKd�d��ZL�dd�d��ZM�dd�d��ZNeNZO�dd�d��ZP�dd�d��ZQ�dd�d��ZRd�d��ZSd�d��ZTd�d��ZUd�d��ZV�dd�d��ZW�dd�d��ZX�dd�d��ZYd�d��ZZd�d��Z[�dd�d��Z\�d d�d��Z]d�d��Z^d�d��Z_d�d��Z`d�d��Za�d!d�d��Zbd�d��Zcd�d��Zdd�d��Ze�d"d�d��Zfd�d��Zgd�dÄZh�d#d�dńZid�dDŽZj�d$d�dɄZk�d%d�d˄Zld�d̈́Zmd�dτZn�d&d�dфZo�d'd�dӄZp�d(d�dՄZq�d)d�dׄZr�d*d�dلZs�d+d�dۄZt�d,d�d݄Zu�d-d�d߄Zv�d.d�d�Zw�d/d�d�Zxd�d�Zy�d0d�d�Zz�d1d�d�Z{�d2d�d�Z|d�d�Z}d�d�Z~d�d�Z�d3d�d�Z�dS(4r�_expr7r6�_is_special�0NcCs�tj|�}t|t��r$t|j�jdd��}|dkrP|dkr@t�}|jt	d|�S|j
d�dkrfd|_nd|_|j
d�}|dk	r�|j
d	�p�d}t|j
d
�p�d�}tt||��|_
|t|�|_d|_nZ|j
d
�}|dk	�rtt|p�d��jd�|_
|j
d��rd|_nd|_nd|_
d|_d|_|St|t��rf|dk�rBd|_nd|_d|_tt|��|_
d|_|St|t��r�|j|_|j|_|j
|_
|j|_|St|t��r�|j|_t|j�|_
t|j�|_d|_|St|ttf��r&t|�dk�r�td��t|dt��o|ddk�std��|d|_|ddk�rHd|_
|d|_d|_n�g}	x^|dD]R}
t|
t��r�d|
k�ozdkn�r�|	�s�|
dk�r�|	j|
�ntd���qVW|ddk�r�djtt|	��|_
|d|_d|_nDt|dt��rdjtt|	�pdg��|_
|d|_d|_ntd��|St|t��r||dk�rBt�}|jtd�tj|�}|j|_|j|_|j
|_
|j|_|St d|��dS)N�_�zInvalid literal for Decimal: %rr<�-r-r%�intZfrac�exprPF�diag�signal�Nr4�FT�ztInvalid tuple size in creation of Decimal from list or tuple.  The list or tuple should have exactly three elements.z|Invalid sign.  The first value in the tuple should be an integer; either 0 for a positive number or 1 for a negative number.r+�	zTThe second value in the tuple must be composed of integers in the range 0 through 9.zUThe third value in the tuple must be an integer, or one of the strings 'F', 'n', 'N'.z;strict semantics for mixing floats and Decimals are enabledzCannot convert %r to Decimal)r%r-)r4rX)!�object�__new__�
isinstance�str�_parser�strip�replacer�_raise_errorr�groupr6rTr7�lenrNrO�lstrip�absr�_WorkRepr<rU�list�tuple�
ValueError�append�join�map�floatr�
from_float�	TypeError)�cls�valuer/r.�m�intpart�fracpartrUrV�digitsZdigitr'r'r)r]4s�







(



zDecimal.__new__cCs�t|t�r||�St|t�s$td��tj|�s8tj|�rD|t|��Stjd|�dkrZd}nd}t	|�j
�\}}|j�d}t|t
|d|�|�}|tkr�|S||�SdS)Nzargument must be int or float.g�?r%r-�)r^rTrorq�_mathZisinfZisnan�reprZcopysignrg�as_integer_ratio�
bit_lengthr5r_r)rr�fr<r4�d�k�resultr'r'r)rp�s

zDecimal.from_floatcCs(|jr$|j}|dkrdS|dkr$dSdS)Nr4r-rXr+r%)rOrN)r.rUr'r'r)�_isnan�szDecimal._isnancCs|jdkr|jrdSdSdS)NrYr-r%���)rNr6)r.r'r'r)�_isinfinitys

zDecimal._isinfinitycCs||j�}|dkrd}n|j�}|s&|rx|dkr4t�}|dkrJ|jtd|�S|dkr`|jtd|�S|rn|j|�S|j|�SdS)NFr+�sNaNr%)r�rrcr	r8)r.�otherr/�self_is_nan�other_is_nanr'r'r)�_check_nanss"


zDecimal._check_nanscCsv|dkrt�}|js|jrr|j�r0|jtd|�S|j�rF|jtd|�S|j�r\|jtd|�S|j�rr|jtd|�SdS)Nzcomparison involving sNaNzcomparison involving NaNr%)rrO�is_snanrcr	�is_qnan)r.r�r/r'r'r)�_compare_check_nans.s(zDecimal._compare_check_nanscCs|jp|jdkS)NrP)rOr7)r.r'r'r)�__bool__OszDecimal.__bool__cCs|js|jr8|j�}|j�}||kr(dS||kr4dSdS|sP|sDdSd|jS|s^d|jS|j|jkrndS|j|jkr~dS|j�}|j�}||k�r�|jd|j|j}|jd|j|j}||kr�dS||kr�d|jSd	|jSn ||k�rd
|jSd|jSdS)Nr%r-rPr�r�r�r�r�r�r�r�)rOr�r6�adjustedr7rN)r.r�Zself_infZ	other_inf�
self_adjustedZother_adjusted�self_paddedZother_paddedr'r'r)�_cmpVs>



zDecimal._cmpcCs<t||dd�\}}|tkr|S|j||�r.dS|j|�dkS)NT)�equality_opFr%)�_convert_for_comparison�NotImplementedr�r�)r.r�r/r'r'r)�__eq__�szDecimal.__eq__cCs<t||�\}}|tkr|S|j||�}|r.dS|j|�dkS)NFr%)r�r�r�r�)r.r�r/r:r'r'r)�__lt__�szDecimal.__lt__cCs<t||�\}}|tkr|S|j||�}|r.dS|j|�dkS)NFr%)r�r�r�r�)r.r�r/r:r'r'r)�__le__�szDecimal.__le__cCs<t||�\}}|tkr|S|j||�}|r.dS|j|�dkS)NFr%)r�r�r�r�)r.r�r/r:r'r'r)�__gt__�szDecimal.__gt__cCs<t||�\}}|tkr|S|j||�}|r.dS|j|�dkS)NFr%)r�r�r�r�)r.r�r/r:r'r'r)�__ge__�szDecimal.__ge__cCs>t|dd�}|js|r0|jr0|j||�}|r0|St|j|��S)NT)�raiseit)�_convert_otherrOr�rr�)r.r�r/r:r'r'r)�compare�szDecimal.comparecCs�|jr4|j�rtd��n|j�r$tS|jr0tStS|jdkrNtd|jt	�}ntt
|jt	�}t|j�|t	}|dkr||n|}|dkr�dS|S)Nz"Cannot hash a signaling NaN value.r%�
r-r+r����)
rOr�rq�is_nan�_PyHASH_NANr6�_PyHASH_INFrN�pow�_PyHASH_MODULUS�
_PyHASH_10INVrTr7)r.Zexp_hashZhash_r:r'r'r)�__hash__�s

zDecimal.__hash__cCst|jttt|j��|j�S)N)rr6rjrnrTr7rN)r.r'r'r)�as_tuple�szDecimal.as_tuplecCs�|jr |j�rtd��ntd��|s(dSt|j�}|jdkrR|d|jd}}nr|j}x(|dkr�|ddkr�|d}|d8}q\W|j}t||@j�d|�}|r�||L}||8}d||>}|j	r�|}||fS)Nz#cannot convert NaN to integer ratioz(cannot convert Infinity to integer ratior%r-r�rx)r%r-)
rOr�rk�
OverflowErrorrTr7rN�minr|r6)r.r4r~Zd5Zd2Zshift2r'r'r)r{�s,


zDecimal.as_integer_ratiocCsdt|�S)Nz
Decimal('%s'))r_)r.r'r'r)�__repr__'szDecimal.__repr__Fc	Csdddg|j}|jrL|jdkr&|dS|jdkr>|d|jS|d|jS|jt|j�}|jdkrt|dkrt|}n6|s~d
}n,|jdkr�|d
dd
}n|d
dd
}|dkr�d}d
d||j}nN|t|j�k�r�|jd|t|j�}d}n |jd|�}d
|j|d�}||k�r*d}n*|dk�r:t�}ddg|jd||}||||S)NrRrSrYZInfinityr4�NaNr�r%�r-rPrZ�.�e�Ez%+di����)r6rOrNr7rer�capitals)	r.�engr/r<�
leftdigits�dotplacerurvrUr'r'r)�__str__,s:




zDecimal.__str__cCs|jd|d�S)NT)r�r/)r�)r.r/r'r'r)�
to_eng_string`szDecimal.to_eng_stringcCsT|jr|j|d�}|r|S|dkr(t�}|rB|jtkrB|j�}n|j�}|j|�S)N)r/)rOr�rr>r�copy_abs�copy_negate�_fix)r.r/r:r'r'r)�__neg__is
zDecimal.__neg__cCsT|jr|j|d�}|r|S|dkr(t�}|rB|jtkrB|j�}nt|�}|j|�S)N)r/)rOr�rr>rr�rr�)r.r/r:r'r'r)�__pos__s
zDecimal.__pos__TcCsJ|s|j�S|jr&|j|d�}|r&|S|jr:|j|d�}n|j|d�}|S)N)r/)r�rOr�r6r�r�)r.�roundr/r:r'r'r)�__abs__�szDecimal.__abs__c
Cslt|�}|tkr|S|dkr"t�}|js.|jr�|j||�}|rB|S|j�rr|j|jkrj|j�rj|jtd�St	|�S|j�r�t	|�St
|j|j�}d}|jt
kr�|j|jkr�d}|r�|r�t
|j|j�}|r�d}t|d|�}|j|�}|S|�s"t||j|jd�}|j||j�}|j|�}|S|�sZt||j|jd�}|j||j�}|j|�}|St|�}t|�}t|||j�\}}t�}	|j|jk�r�|j|jk�r�t|d|�}|j|�}|S|j|jk�r�||}}|jdk�r�d|	_|j|j|_|_nd|	_n&|jdk�rd|	_d\|_|_nd|	_|jdk�r@|j|j|	_n|j|j|	_|j|	_t	|	�}|j|�}|S)Nz
-INF + INFr%r-rP)r%r%)r�r�rrOr�r�r6rcr	rr�rNr>rr5r��maxr?�_rescalerh�
_normalizer<rTrU)
r.r�r/r:rUZnegativezeror<�op1�op2r�r'r'r)�__add__�s|





zDecimal.__add__cCsHt|�}|tkr|S|js |jr6|j||d�}|r6|S|j|j�|d�S)N)r/)r�r�rOr�r�r�)r.r�r/r:r'r'r)�__sub__szDecimal.__sub__cCs"t|�}|tkr|S|j||d�S)N)r/)r�r�r�)r.r�r/r'r'r)�__rsub__szDecimal.__rsub__cCsDt|�}|tkr|S|dkr"t�}|j|jA}|js:|jr�|j||�}|rN|S|j�rn|sf|jtd�St	|S|j�r�|s�|jtd�St	|S|j
|j
}|s�|r�t|d|�}|j|�}|S|j
dkr�t||j
|�}|j|�}|S|j
dk�rt||j
|�}|j|�}|St|�}t|�}t|t|j|j�|�}|j|�}|S)Nz(+-)INF * 0z0 * (+-)INFrP�1)r�r�rr6rOr�r�rcr	r;rNr5r�r7rhr_rT)r.r�r/Z
resultsignr:Z	resultexpr�r�r'r'r)�__mul__sH




zDecimal.__mul__cCs�t|�}|tkrtS|dkr"t�}|j|jA}|js:|jr�|j||�}|rN|S|j�rj|j�rj|jtd�S|j�rzt	|S|j�r�|jt
d�t|d|j��S|s�|s�|jt
d�S|jtd|�S|s�|j|j}d}n�t|j�t|j�|jd}|j|j|}t|�}t|�}	|dk�r:t|jd||	j�\}}
nt|j|	jd|�\}}
|
�rt|d	dk�r�|d7}n<|j|j}x.||k�r�|ddk�r�|d}|d7}�q�Wt|t|�|�}|j|�S)
Nz(+-)INF/(+-)INFzDivision by infinityrPz0 / 0zx / 0r%r-r�rx)r�r�rr6rOr�r�rcr	r;rr5�Etinyrr
rNrer7r?rh�divmodrTr_r�)r.r�r/r<r:rU�coeff�shiftr�r��	remainder�	ideal_expr'r'r)�__truediv__QsP

zDecimal.__truediv__cCs |j|jA}|j�r|j}nt|j|j�}|j�|j�}|sP|j�sP|dkrjt|dd�|j||j�fS||jk�rt	|�}t	|�}|j
|j
kr�|jd|j
|j
9_n|jd|j
|j
9_t|j|j�\}}	|d|jk�rt|t
|�d�t|jt
|	�|�fS|jtd�}
|
|
fS)Nr+rPr%r�z%quotient too large in //, % or divmodr�)r6r�rNr�r�r5r�r>r?rhrUrTr�r_rcr)r.r�r/r<r��expdiffr�r��q�rr:r'r'r)�_divide�s*
zDecimal._dividecCs"t|�}|tkr|S|j||d�S)N)r/)r�r�r�)r.r�r/r'r'r)�__rtruediv__�szDecimal.__rtruediv__cCs�t|�}|tkr|S|dkr"t�}|j||�}|r:||fS|j|jA}|j�r~|j�rj|jtd�}||fSt||jtd�fS|s�|s�|jt	d�}||fS|jt
d|�|jtd�fS|j||�\}}|j|�}||fS)Nzdivmod(INF, INF)zINF % xzdivmod(0, 0)zx // 0zx % 0)
r�r�rr�r6r�rcr	r;rr
r�r�)r.r�r/r:r<Zquotientr�r'r'r)�
__divmod__�s0
zDecimal.__divmod__cCs"t|�}|tkr|S|j||d�S)N)r/)r�r�r�)r.r�r/r'r'r)�__rdivmod__�szDecimal.__rdivmod__cCs�t|�}|tkr|S|dkr"t�}|j||�}|r6|S|j�rJ|jtd�S|sj|r^|jtd�S|jtd�S|j||�d}|j	|�}|S)NzINF % xzx % 0z0 % 0r-)
r�r�rr�r�rcr	rr�r�)r.r�r/r:r�r'r'r)�__mod__�s"
zDecimal.__mod__cCs"t|�}|tkr|S|j||d�S)N)r/)r�r�r�)r.r�r/r'r'r)�__rmod__�szDecimal.__rmod__cCs�|dkrt�}t|dd�}|j||�}|r.|S|j�rB|jtd�S|sb|rV|jtd�S|jtd�S|j�r|t|�}|j|�St	|j
|j
�}|s�t|jd|�}|j|�S|j
�|j
�}||jdkr�|jt�S|dkr�|j||j�}|j|�St|�}t|�}|j|jk�r(|jd	|j|j9_n|jd	|j|j9_t|j|j�\}}	d|	|d@|jk�r~|	|j8}	|d7}|d	|jk�r�|jt�S|j}
|	d
k�r�d|
}
|	}	t|
t|	�|�}|j|�S)NT)r�zremainder_near(infinity, x)zremainder_near(x, 0)zremainder_near(0, 0)rPr-r+r�r%r�)rr�r�r�rcr	rrr�r�rNr5r6r�r?rr�r>rhrUrTr�r_)r.r�r/r:�ideal_exponentr�r�r�r�r�r<r'r'r)�remainder_nearsZ






zDecimal.remainder_nearcCs�t|�}|tkr|S|dkr"t�}|j||�}|r6|S|j�rb|j�rR|jtd�St|j|jAS|s�|r�|jt	d|j|jA�S|jt
d�S|j||�dS)Nz
INF // INFzx // 0z0 // 0r%)r�r�rr�r�rcr	r;r6r
rr�)r.r�r/r:r'r'r)�__floordiv__Ls$zDecimal.__floordiv__cCs"t|�}|tkr|S|j||d�S)N)r/)r�r�r�)r.r�r/r'r'r)�
__rfloordiv__hszDecimal.__rfloordiv__cCs8|j�r(|j�rtd��|jr"dnd}nt|�}t|�S)Nz%Cannot convert signaling NaN to floatz-nan�nan)r�r�rkr6r_ro)r.�sr'r'r)�	__float__oszDecimal.__float__cCst|jr(|j�rtd��n|j�r(td��d|j}|jdkrT|t|j�d|jS|t|jd|j�pjd�SdS)NzCannot convert NaN to integerz"Cannot convert infinity to integerr-r%r�rPr�)	rOr�rkr�r�r6rNrTr7)r.r�r'r'r)�__int__ys


zDecimal.__int__cCs|S)Nr')r.r'r'r)�real�szDecimal.realcCstd�S)Nr%)r)r.r'r'r)�imag�szDecimal.imagcCs|S)Nr')r.r'r'r)�	conjugate�szDecimal.conjugatecCstt|��S)N)�complexro)r.r'r'r)�__complex__�szDecimal.__complex__cCsR|j}|j|j}t|�|krJ|t|�|d�jd�}t|j||jd�St|�S)NrPT)	r7r?�clamprerfr5r6rNr)r.r/ZpayloadZmax_payload_lenr'r'r)r8�szDecimal._fix_nancCsX|jr |j�r|j|�St|�S|j�}|j�}|s�|j|g|j}tt	|j
|�|�}||j
krx|jt�t
|jd|�St|�St|j�|j
|j}||kr�|jtd|j�}|jt�|jt�|S||k}|r�|}|j
|k�r�t|j�|j
|}	|	dk�rt
|jd|d�}d}	|j|j}
|
||	�}|jd|	��p>d}|dk�r~tt|�d�}t|�|jk�r~|dd�}|d7}||k�r�|jtd|j�}nt
|j||�}|�r�|�r�|jt�|�r�|jt�|�r�|jt�|jt�|�s�|jt�|S|�r|jt�|jdk�rP|j
|k�rP|jt�|jd|j
|}
t
|j|
|�St|�S)NrPz
above Emaxr%r�r-r�)rOr�r8rr��Etopr@r�r�r�rNrcrr5r6rer7r?rrr�_pick_rounding_functionr>r_rTrr
)r.r/r�r��exp_maxZnew_expZexp_minr:Zself_is_subnormalrwZrounding_method�changedr�r�r'r'r)r��sn
















zDecimal._fixcCst|j|�rdSdSdS)Nr%r-r�)�
_all_zerosr7)r.r?r'r'r)�_round_downszDecimal._round_downcCs|j|�S)N)r�)r.r?r'r'r)�	_round_upszDecimal._round_upcCs*|j|dkrdSt|j|�r"dSdSdS)NZ56789r-r%r�)r7r�)r.r?r'r'r)�_round_half_ups
zDecimal._round_half_upcCst|j|�rdS|j|�SdS)Nr-r�)�_exact_halfr7r�)r.r?r'r'r)�_round_half_downszDecimal._round_half_downcCs8t|j|�r*|dks&|j|ddkr*dS|j|�SdS)Nr%r-�02468r�)r�r7r�)r.r?r'r'r)�_round_half_even#szDecimal._round_half_evencCs |jr|j|�S|j|�SdS)N)r6r�)r.r?r'r'r)�_round_ceiling+s
zDecimal._round_ceilingcCs |js|j|�S|j|�SdS)N)r6r�)r.r?r'r'r)�_round_floor2s
zDecimal._round_floorcCs0|r |j|ddkr |j|�S|j|�SdS)Nr-Z05)r7r�)r.r?r'r'r)�_round_05up9s
zDecimal._round_05up)rrrrrrrrcCsb|dk	r2t|t�std��tdd|�}|j|�S|jrR|j�rJtd��ntd��t|j	dt
��S)Nz+Second argument to round should be integralr%r�zcannot round a NaNzcannot round an infinity)r^rTrqr5�quantizerOr�rkr�r�r)r.r4rUr'r'r)�	__round__Ks/


zDecimal.__round__cCs0|jr |j�rtd��ntd��t|jdt��S)Nzcannot round a NaNzcannot round an infinityr%)rOr�rkr�rTr�r)r.r'r'r)�	__floor__�s

zDecimal.__floor__cCs0|jr |j�rtd��ntd��t|jdt��S)Nzcannot round a NaNzcannot round an infinityr%)rOr�rkr�rTr�r)r.r'r'r)�__ceil__�s

zDecimal.__ceil__cCst|dd�}t|dd�}|js$|jr�|dkr2t�}|jdkrJ|jtd|�S|jdkrb|jtd|�S|jdkrr|}nf|jdkr�|}nV|jdkr�|s�|jtd�St|j|jA}n*|jdkr�|s�|jtd�St|j|jA}n0t|j|jAt	t
|j�t
|j��|j|j�}|j||�S)	NT)r�rXr�r4rYzINF * 0 in fmaz0 * INF in fma)
r�rOrrNrcr	r;r6r5r_rTr7r�)r.r�Zthirdr/�productr'r'r)�fma�s6





zDecimal.fmacCs�t|�}|tkr|St|�}|tkr(|S|dkr6t�}|j�}|j�}|j�}|sZ|sZ|r�|dkrp|jtd|�S|dkr�|jtd|�S|dkr�|jtd|�S|r�|j|�S|r�|j|�S|j|�S|j�o�|j�o�|j�s�|jtd�S|dkr�|jtd�S|�s|jtd�S|j�|j	k�r(|jtd�S|�rD|�rD|jtd�S|j
��rTd}n|j}tt
|��}t|j��}t|j��}	|j
|td	|j|�|}x t|	j�D]}
t|d	|�}�q�Wt||	j
|�}t|t|�d�S)
Nr+r�z@pow() 3rd argument not allowed unless all arguments are integersr%zApow() 2nd argument cannot be negative when 3rd argument specifiedzpow() 3rd argument cannot be 0zSinsufficient precision: pow() 3rd argument must not have more than precision digitszXat least one of pow() 1st argument and 2nd argument must be nonzero; 0**0 is not definedr�)r�r�rr�rcr	r8�
_isintegerr�r?�_isevenr6rgrTrh�to_integral_valuer�rU�ranger5r_)r.r��modulor/r�r�Z
modulo_is_nanr<�base�exponent�ir'r'r)�
_power_modulo�sl



zDecimal._power_modulocCst|�}|j|j}}x |ddkr6|d}|d7}qWt|�}|j|j}}x |ddkrn|d}|d7}qPW|dk�r||9}x |ddkr�|d}|d7}q�W|dkr�dS|d|}	|jdkr�|	}	|j�o�|jdk�r|jt|�}
t|	|
|d�}nd}tddd||	|�S|jdk�r�|d}|dk�r�||@|k�rPdSt	|�d}
|d
d}|t
t|��k�r~dSt|
||�}
t|||�}|
dk�s�|dk�r�dS|
|k�r�dSd|
}n�|dk�r�t	|�d
d}
t
d|
|�\}}|�rdSx$|ddk�r$|d}|
d8}
�qW|dd}|t
t|��k�rHdSt|
||�}
t|||�}|
dk�sx|dk�r|dS|
|k�r�dSd|
}ndS|d|k�r�dS|
|}tdt|�|�S|dk�r�|d|d}}n�|dk�rt
tt||���|k�rdSt	|�}|dk�r>t
tt|�|��|k�r>dS|d|}}x:|d|dk�oldkn�r�|d}|d}�qPWx:|d|dk�o�dkn�r�|d}|d}�q�W|dk�rt|dk�r�||k�r�dSt
||�\}}|dk�rdSdt	|�|>}x>t
|||d�\}}||k�r>Pn||d||}�qW||k�oh|dk�spdS|}|dk�r�||dt|�k�r�dS||}||9}|d|k�r�dSt|�}|j��r�|jdk�r�|jt|�}
t||
|t
|��}nd}td|d|||�S)Nr�r%r-r�rPr+�r���]�Arx�rZ�d)r+rr�r)rhrTrUr<r�r6rNr�r5�_nbitsrer_�_decimal_lshift_exactr�rg�	_log10_lb)r.r��p�x�xc�xe�y�yc�yer�r�ZzerosZ
last_digitr�Zemaxr�rtr4Zxc_bits�rem�ar�r�Zstr_xcr'r'r)�_power_exact(s�:









&&&&


 zDecimal._power_exactcCs@|dk	r|j|||�St|�}|tkr*|S|dkr8t�}|j||�}|rL|S|sd|s`|jtd�StSd}|jdkr�|j	�r�|j
�s�d}n|r�|jtd�S|j�}|s�|jdkr�t|dd�St
|S|j�r�|jdkr�t
|St|dd�S|tk�r�|j	��rZ|jdk�rd}n||jk�r"|j}nt|�}|j|}|d|jk�rxd|j}|jt�n|jt�|jt�d|j}t|dd||�S|j�}|j��r�|jdk|dkk�r�t|dd�St
|Sd}d}	|j�|j�}
|dk|jdkk�r|
tt|j��k�rHt|d|jd�}n,|j�}|
tt|��k�rHt|d|d�}|dk�r�|j||jd�}|dk	�r�|dk�r�td|j|j�}d}	|dk�r:|j}t|�}
|
j|
j}}t|�}|j|j}}|jdk�r�|}d	}xJt||||||�\}}|d
dtt|��|d�rP|d	7}�q�Wt|t|�|�}|	�r2|j	��r2t|j�|jk�r�|jdt|j�}t|j|jd||j|�}|j �}|j!�xt"D]}d|j#|<�q�W|j$|�}|jt�|j%t&�r�|jt'�|j%t(�r|jt(d|j�x:t't&ttt)fD]}|j%|�r|j|��qWn
|j$|�}|S)
Nz0 ** 0r%r-z+x ** y with x negative and y not an integerrPr�FTrZrxr�z
above Emax)*rr�r�rr�rcr	�_Oner6r�r�r�r5r;r�r?rTrNrrr��_log10_exp_boundrer_r@r�rr7rhrUr<�_dpowerrGrH�_signals�trapsr��flagsr
rrr)r.r�r�r/r:Zresult_signZ
multiplierrUZself_adj�exactZboundr�r
rrr
rrr�extrar�r�Z
newcontextZ	exceptionr'r'r)�__pow__	s�














"




zDecimal.__pow__cCs"t|�}|tkr|S|j||d�S)N)r/)r�r�r)r.r�r/r'r'r)�__rpow__�	szDecimal.__rpow__cCs�|dkrt�}|jr(|j|d�}|r(|S|j|�}|j�r>|S|sPt|jdd�S|j|j�g|j	}t
|j�}|j}x.|j|ddkr�||kr�|d7}|d8}qvWt|j|jd|�|�S)N)r/rPr%r-)
rrOr�r�r�r5r6r@r�r�rer7rN)r.r/r:�dupr��endrUr'r'r)�	normalize�	s$

zDecimal.normalizecCs�t|dd�}|dkrt�}|dkr(|j}|js4|jr||j||�}|rH|S|j�sX|j�r||j�rp|j�rpt|�S|jtd�S|j	�|j
ko�|jkns�|jtd�S|s�t|j
d|j
�}|j|�S|j�}||jkr�|jtd�S||j
d|jk�r|jtd�S|j|j
|�}|j�|jk�r0|jtd�St|j�|jk�rN|jtd�S|�rn|j�|jk�rn|jt�|j
|j
k�r�||k�r�|jt�|jt�|j|�}|S)	NT)r�zquantize with one INFz)target exponent out of bounds in quantizerPz9exponent of quantize result too large for current contextr-z7quantize result has too many digits for current context)r�rr>rOr�r�rrcr	r�rNr@r5r6r�r�r?r�rer7�Eminr
rr)r.rUr>r/r:r�r'r'r)r�
sT 






zDecimal.quantizecCsDt|dd�}|js|jr8|j�r(|j�p6|j�o6|j�S|j|jkS)NT)r�)r�rOr��is_infiniterN)r.r�r/r'r'r)�same_quantumJ
s
	zDecimal.same_quantumcCs�|jrt|�S|s t|jd|�S|j|krHt|j|jd|j||�St|j�|j|}|dkrzt|jd|d�}d}|j|}|||�}|jd|�p�d}|dkr�tt	|�d�}t|j||�S)NrPr%r�r-)
rOrr5r6rNr7rer�r_rT)r.rUr>rwZ
this_functionr�r�r'r'r)r�Y
s"


zDecimal._rescalecCsh|dkrtd��|js|r$t|�S|j|j�d||�}|j�|j�krd|j|j�d||�}|S)Nr%z'argument should be at least 1 in _roundr-)rkrOrr�r�)r.�placesr>r:r'r'r)�_round{
s
zDecimal._roundcCs�|jr"|j|d�}|r|St|�S|jdkr4t|�S|sFt|jdd�S|dkrTt�}|dkrb|j}|jd|�}||kr�|j	t
�|j	t�|S)N)r/r%rP)rOr�rrNr5r6rr>r�rcrr)r.r>r/r:r'r'r)�to_integral_exact�
s$



zDecimal.to_integral_exactcCs`|dkrt�}|dkr|j}|jr>|j|d�}|r6|St|�S|jdkrPt|�S|jd|�SdS)N)r/r%)rr>rOr�rrNr�)r.r>r/r:r'r'r)r��
s
zDecimal.to_integral_valuecCs�|dkrt�}|jrB|j|d�}|r(|S|j�rB|jdkrBt|�S|sdt|jd|jd�}|j|�S|jdkrz|j	t
d�S|jd}t|�}|j
d?}|j
d@r�|jd}t|j�d?d}n|j}t|j�dd?}||}|dkr�|d|9}d	}	nt|d|�\}}
|
}	||8}d|}x(||}||k�r:Pn||d?}�q$W|	�o\|||k}	|	�r�|dk�r||d|}n|d|9}||7}n|d
dk�r�|d7}tdt|�|�}|j�}|jt�}
|j|�}|
|_|S)N)r/r%rPr+r-zsqrt(-x), x > 0r�rTrx)rrOr�r�r6rr5rNr�rcr	r?rhrUrTrer7r�r_�
_shallow_copy�
_set_roundingrr>)r.r/r:r?�opr��c�lr�rr�r4r�r>r'r'r)�sqrt�
s`










zDecimal.sqrtcCs�t|dd�}|dkrt�}|js&|jr~|j�}|j�}|s>|r~|dkrX|dkrX|j|�S|dkrr|dkrr|j|�S|j||�S|j|�}|dkr�|j|�}|dkr�|}n|}|j|�S)NT)r�r-r%r�)r�rrOr�r�r�r��
compare_total)r.r�r/�sn�onr*r:r'r'r)r�%s&


	
zDecimal.maxcCs�t|dd�}|dkrt�}|js&|jr~|j�}|j�}|s>|r~|dkrX|dkrX|j|�S|dkrr|dkrr|j|�S|j||�S|j|�}|dkr�|j|�}|dkr�|}n|}|j|�S)NT)r�r-r%r�)r�rrOr�r�r�r�r-)r.r�r/r.r/r*r:r'r'r)r�Os&



zDecimal.mincCs8|jr
dS|jdkrdS|j|jd�}|dt|�kS)NFr%TrP)rOrNr7re)r.�restr'r'r)r�qs
zDecimal._isintegercCs(|s|jdkrdS|jd|jdkS)Nr%Tr-r�r�)rNr7)r.r'r'r)r�zszDecimal._isevencCs.y|jt|j�dStk
r(dSXdS)Nr-r%)rNrer7rq)r.r'r'r)r��szDecimal.adjustedcCs|S)Nr')r.r'r'r)�	canonical�szDecimal.canonicalcCs.t|dd�}|j||�}|r |S|j||d�S)NT)r�)r/)r�r�r�)r.r�r/r:r'r'r)�compare_signal�s
zDecimal.compare_signalcCsft|dd�}|jr|jrtS|jr0|jr0tS|j}|j�}|j�}|sP|�r||kr�t|j�|jf}t|j�|jf}||kr�|r�tStS||kr�|r�tStStS|r�|dkr�tS|dkr�tS|dkr�tS|dkr�tSn4|dkr�tS|dkr�tS|dk�rtS|dk�rtS||k�rtS||k�r*tS|j|jk�rF|�rBtStS|j|jk�rb|�r^tStStS)NT)r�r-r+)	r�r6�_NegativeOnerr�rer7�_ZerorN)r.r�r/r<Zself_nanZ	other_nanZself_keyZ	other_keyr'r'r)r-�sf




zDecimal.compare_totalcCs&t|dd�}|j�}|j�}|j|�S)NT)r�)r�r�r-)r.r�r/r��or'r'r)�compare_total_mag�szDecimal.compare_total_magcCstd|j|j|j�S)Nr%)r5r7rNrO)r.r'r'r)r��szDecimal.copy_abscCs2|jrtd|j|j|j�Std|j|j|j�SdS)Nr%r-)r6r5r7rNrO)r.r'r'r)r��szDecimal.copy_negatecCs"t|dd�}t|j|j|j|j�S)NT)r�)r�r5r6r7rNrO)r.r�r/r'r'r)�	copy_sign�s
zDecimal.copy_signcCs�|dkrt�}|j|d�}|r"|S|j�d
kr2tS|s:tS|j�dkrNt|�S|j}|j�}|jdkr�|t	t
|jdd��kr�tdd|jd�}�n0|jdkr�|t	t
|j
�dd��kr�tdd|j
�d�}n�|jdko�||k�r
tddd|dd|�}n�|jdk�rB||dk�rBtdd|d|d�}n�t|�}|j|j}}|jdk�rj|}d}xFt||||�\}	}
|	dd	t	t
|	��|d�r�P|d7}�qpWtdt
|	�|
�}|j�}|jt�}|j|�}||_|S)N)r/r-r%rZr�rPr=rxr�r�)rr�r�r4rrr?r�r6rer_r@r5r�rhrTrUr<�_dexpr'r(rr�r>)r.r/r:r
�adjr)r*r�rr�rUr>r'r'r)rUsJ$( "

zDecimal.expcCsdS)NTr')r.r'r'r)�is_canonicalLszDecimal.is_canonicalcCs|jS)N)rO)r.r'r'r)�	is_finiteTszDecimal.is_finitecCs
|jdkS)NrY)rN)r.r'r'r)r"\szDecimal.is_infinitecCs
|jdkS)Nr4rX)r4rX)rN)r.r'r'r)r�`szDecimal.is_nancCs,|js|rdS|dkrt�}|j|j�kS)NF)rOrr!r�)r.r/r'r'r)�	is_normalds
zDecimal.is_normalcCs
|jdkS)Nr4)rN)r.r'r'r)r�lszDecimal.is_qnancCs
|jdkS)Nr-)r6)r.r'r'r)�	is_signedpszDecimal.is_signedcCs
|jdkS)NrX)rN)r.r'r'r)r�tszDecimal.is_snancCs,|js|rdS|dkrt�}|j�|jkS)NF)rOrr�r!)r.r/r'r'r)�is_subnormalxs
zDecimal.is_subnormalcCs|jo|jdkS)NrP)rOr7)r.r'r'r)�is_zero�szDecimal.is_zerocCs�|jt|j�d}|dkr4tt|dd��dS|dkrXttd|dd��dSt|�}|j|j}}|dkr�t|d|�}t|�}t|�t|�||kS|ttd||��dS)Nr-�r�r+r%r�r�)rNrer7r_rhrTrU)r.r9r)r*r��num�denr'r'r)�
_ln_exp_bound�szDecimal._ln_exp_boundc
Cs|dkrt�}|j|d�}|r"|S|s*tS|j�dkr:tS|tkrFtS|jdkr\|jt	d�St
|�}|j|j}}|j
}||j�d}x>t|||�}|ddttt|���|dr�P|d7}q�Wtt|dk�tt|��|�}|j�}|jt�}	|j|�}|	|_|S)	N)r/r-zln of a negative valuer+rxr�rZr%)rr��_NegativeInfinityr��	_Infinityrr4r6rcr	rhrTrUr?rC�_dlogrer_rgr5r'r(rr�r>)
r.r/r:r)r*r�r
r$r�r>r'r'r)�ln�s:
$

z
Decimal.lncCs�|jt|j�d}|dkr,tt|��dS|dkrHttd|��dSt|�}|j|j}}|dkr�t|d|�}td|�}t|�t|�||kdStd||�}t|�||dkdS)	Nr-r+r%r���Z231r�r�)rNrer7r_rhrTrU)r.r9r)r*r�rArBr'r'r)r�szDecimal._log10_exp_boundc
CsH|dkrt�}|j|d�}|r"|S|s*tS|j�dkr:tS|jdkrP|jtd�S|jddkr�|jdd�dt	|j�dkr�t
|jt	|j�d�}n�t|�}|j
|j}}|j}||j�d}x>t|||�}|dd	t	tt|���|dr�P|d
7}q�Wtt
|dk�tt|��|�}|j�}|jt�}	|j|�}|	|_|S)N)r/r-zlog10 of a negative valuer%r�rPr+rxr�rZ)rr�rDr�rEr6rcr	r7rerrNrhrTrUr?r�_dlog10r_rgr5r'r(rr�r>)
r.r/r:r)r*r�r
r$r�r>r'r'r)�log10�s:
.$

z
Decimal.log10cCsV|j|d�}|r|S|dkr"t�}|j�r.tS|s@|jtdd�St|j��}|j|�S)N)r/zlogb(0)r-)	r�rr�rErcr
rr�r�)r.r/r:r'r'r)�logb 
s	zDecimal.logbcCs8|jdks|jdkrdSx|jD]}|dkr dSq WdS)Nr%FZ01T)r6rNr7)r.�digr'r'r)�
_islogical>
szDecimal._islogicalcCs�|jt|�}|dkr$d||}n|dkr<||jd�}|jt|�}|dkr`d||}n|dkrx||jd�}||fS)Nr%rP)r?re)r.r/�opa�opbZdifr'r'r)�
_fill_logicalL
szDecimal._fill_logicalcCs~|dkrt�}t|dd�}|j�s.|j�r8|jt�S|j||j|j�\}}djdd�t||�D��}t	d|j
d�pxdd�S)NT)r�rRcSs$g|]\}}tt|�t|�@��qSr')r_rT)�.0r�br'r'r)�
<listcomp>g
sz'Decimal.logical_and.<locals>.<listcomp>r%rP)rr�rMrcr	rPr7rm�zipr5rf)r.r�r/rNrOr�r'r'r)�logical_andY
s
zDecimal.logical_andcCs(|dkrt�}|jtdd|jd�|�S)Nr%r�)r�logical_xorr5r?)r.r/r'r'r)�logical_invertj
szDecimal.logical_invertcCs~|dkrt�}t|dd�}|j�s.|j�r8|jt�S|j||j|j�\}}djdd�t||�D��}t	d|j
d�pxdd�S)NT)r�rRcSs$g|]\}}tt|�t|�B��qSr')r_rT)rQrrRr'r'r)rS
sz&Decimal.logical_or.<locals>.<listcomp>r%rP)rr�rMrcr	rPr7rmrTr5rf)r.r�r/rNrOr�r'r'r)�
logical_orq
s
zDecimal.logical_orcCs~|dkrt�}t|dd�}|j�s.|j�r8|jt�S|j||j|j�\}}djdd�t||�D��}t	d|j
d�pxdd�S)NT)r�rRcSs$g|]\}}tt|�t|�A��qSr')r_rT)rQrrRr'r'r)rS�
sz'Decimal.logical_xor.<locals>.<listcomp>r%rP)rr�rMrcr	rPr7rmrTr5rf)r.r�r/rNrOr�r'r'r)rV�
s
zDecimal.logical_xorcCs�t|dd�}|dkrt�}|js&|jr~|j�}|j�}|s>|r~|dkrX|dkrX|j|�S|dkrr|dkrr|j|�S|j||�S|j�j|j��}|dkr�|j|�}|dkr�|}n|}|j|�S)NT)r�r-r%r�)	r�rrOr�r�r�r�r�r-)r.r�r/r.r/r*r:r'r'r)�max_mag�
s&


zDecimal.max_magcCs�t|dd�}|dkrt�}|js&|jr~|j�}|j�}|s>|r~|dkrX|dkrX|j|�S|dkrr|dkrr|j|�S|j||�S|j�j|j��}|dkr�|j|�}|dkr�|}n|}|j|�S)NT)r�r-r%r�)	r�rrOr�r�r�r�r�r-)r.r�r/r.r/r*r:r'r'r)�min_mag�
s&


zDecimal.min_magcCs�|dkrt�}|j|d�}|r"|S|j�dkr2tS|j�dkrTtdd|j|j��S|j�}|jt	�|j
�|j|�}||kr�|S|jtdd|j
�d�|�S)N)r/r-r%r=r�r�)rr�r�rDr5r?r�rGr(r�_ignore_all_flagsr�r�r�)r.r/r:�new_selfr'r'r)�
next_minus�
s"

zDecimal.next_minuscCs�|dkrt�}|j|d�}|r"|S|j�dkr2tS|j�dkrTtdd|j|j��S|j�}|jt	�|j
�|j|�}||kr�|S|jtdd|j
�d�|�S)N)r/r-r=r%r�r�)rr�r�rEr5r?r�rGr(rr[r�r�r�)r.r/r:r\r'r'r)�	next_plus�
s"

zDecimal.next_pluscCs�t|dd�}|dkrt�}|j||�}|r.|S|j|�}|dkrJ|j|�S|dkr^|j|�}n
|j|�}|j�r�|jt	d|j
�|jt�|jt�nD|j
�|jkr�|jt�|jt�|jt�|jt�|s�|jt�|S)NT)r�r%r-z Infinite result from next_towardr�)r�rr�r�r7r^r]r�rcrr6rrr�r!rr
r)r.r�r/r:Z
comparisonr'r'r)�next_toward�
s4	








zDecimal.next_towardcCs�|j�rdS|j�rdS|j�}|dkr,dS|d
kr8dS|j�rN|jrJdSdS|dkr\t�}|j|d�rv|jrrd	Sd
S|jr�dSdSdS)Nr�r�r-z	+Infinityz	-Infinityz-Zeroz+Zero)r/z
-Subnormalz
+Subnormalz-Normalz+Normalr�)r�r�r�r?r6rr>)r.r/�infr'r'r)�number_class+s,zDecimal.number_classcCstd�S)Nr�)r)r.r'r'r)�radixUsz
Decimal.radixcCs�|dkrt�}t|dd�}|j||�}|r.|S|jdkrB|jt�S|jt|�ko^|jknsn|jt�S|j�r~t	|�St|�}|j
}|jt|�}|dkr�d||}n|dkr�||d�}||d�|d|�}t|j
|jd�p�d|j�S)NT)r�r%rP)rr�r�rNrcr	r?rTr�rr7rer5r6rf)r.r�r/r:�torot�rotdig�topadZrotatedr'r'r)�rotateYs,

"
zDecimal.rotatecCs�|dkrt�}t|dd�}|j||�}|r.|S|jdkrB|jt�Sd|j|j}d|j|j}|t|�kox|kns�|jt�S|j	�r�t
|�St|j|j
|jt|��}|j|�}|S)NT)r�r%r+r�)rr�r�rNrcr	r@r?rTr�rr5r6r7r�)r.r�r/r:ZliminfZlimsupr~r'r'r)�scalebzs"



zDecimal.scalebcCs|dkrt�}t|dd�}|j||�}|r.|S|jdkrB|jt�S|jt|�ko^|jknsn|jt�S|j�r~t	|�St|�}|j
}|jt|�}|dkr�d||}n|dkr�||d�}|dkr�|d|�}n|d|}||jd�}t|j
|jd��pd|j�S)NT)r�r%rP)rr�r�rNrcr	r?rTr�rr7rer5r6rf)r.r�r/r:rcrdreZshiftedr'r'r)r��s2

"
z
Decimal.shiftcCs|jt|�ffS)N)�	__class__r_)r.r'r'r)�
__reduce__�szDecimal.__reduce__cCst|�tkr|S|jt|��S)N)�typerrhr_)r.r'r'r)�__copy__�szDecimal.__copy__cCst|�tkr|S|jt|��S)N)rjrrhr_)r.�memor'r'r)�__deepcopy__�szDecimal.__deepcopy__cCsN|dkrt�}t||d�}|jrXt|j|�}t|j��}|ddkrL|d7}t|||�S|ddkrvddg|j|d<|ddkr�t	|j|j
|jd�}|j}|d}|dk	�r|ddkr�|j
|d	|�}nF|dd
kr�|j||�}n*|ddk�rt|j
�|k�r|j
||�}|�rB|jdk�rB|dd
k�rB|jd|�}|jt|j
�}	|ddk�r�|�r||dk	�r|d	|}
nd	}
nB|dd
k�r�|	}
n.|ddk�r�|jdk�r�|	dk�r�|	}
nd	}
|
dk�r�d}d|
|j
}nP|
t|j
�k�r|j
d|
t|j
�}d}n"|j
d|
��p$d}|j
|
d�}|	|
}
t|j|||
|�S)N)�_localeconvrj�%�g�Gr+�	precision�eEr-zfF%ZgGr%r�rPrRi����)r�_parse_format_specifierrO�_format_signr6r_r��
_format_alignr�r5r7rNr>r%r�re�_format_number)r.Z	specifierr/rn�specr<�bodyr>rrr�r�rurvrUr'r'r)�
__format__�sZ
"

zDecimal.__format__)rNr7r6rO)rPN)NN)N)N)N)N)N)N)FN)N)N)N)TN)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)NN)N)N)NN)N)NN)NN)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)NN)�r1r2r3�	__slots__r]�classmethodrpr�r�r�r�r�r�r�r�r�r�r�r�r�r�r{r�r�r�r�r�r�r��__radd__r�r�r��__rmul__r�r�r�r�r�r�r�r�r�r�r�r��	__trunc__r��propertyr�r�r�r8r�r�r�r�r�r�r�r�r��dictr�r�r�r�r�rrrrr r�r#r�r%r&r��to_integralr,r�r�r�r�r�r1r2r-r6r�r�r7rUr:r;r"r�r<r�r=r�r>r?rCrGrrJrKrMrPrUrWrXrVrYrZr]r^r_rarbrfrgr�rirkrmrzr'r'r'r)r+s
(
 !@

	
	
	
	
2
4
	
V7;!$K

f	>,UnY="c*"	IK23
.*!'FcCs&tjt�}||_||_||_||_|S)N)r\r]rr6r7rNrO)r<Zcoefficientr�Zspecialr.r'r'r)r5s
r5c@s$eZdZdd�Zdd�Zdd�ZdS)rMcCs|j�|_dS)N)rG�new_context)r.r�r'r'r)�__init__9sz_ContextManager.__init__cCst�|_t|j�|jS)N)r�
saved_contextrr�)r.r'r'r)�	__enter__;s
z_ContextManager.__enter__cCst|j�dS)N)rr�)r.�t�v�tbr'r'r)�__exit__?sz_ContextManager.__exit__N)r1r2r3r�r�r�r'r'r'r)rM3srMc	@s�eZdZd�dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
e
Zd�dd�Zdd�Zdd�Zdd�ZdZd d!�Zd"d#�Zd$d%�Zd�d'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Z d;d<�Z!d=d>�Z"d?d@�Z#dAdB�Z$dCdD�Z%dEdF�Z&dGdH�Z'dIdJ�Z(dKdL�Z)dMdN�Z*dOdP�Z+dQdR�Z,dSdT�Z-dUdV�Z.dWdX�Z/dYdZ�Z0d[d\�Z1d]d^�Z2d_d`�Z3dadb�Z4dcdd�Z5dedf�Z6dgdh�Z7didj�Z8dkdl�Z9dmdn�Z:dodp�Z;dqdr�Z<dsdt�Z=dudv�Z>dwdx�Z?dydz�Z@d{d|�ZAd}d~�ZBdd��ZCd�d��ZDd�d��ZEd�d��ZFd�d�d��ZGd�d��ZHd�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOd�d��ZPd�d��ZQd�d��ZRd�d��ZSd�d��ZTd�d��ZUeUZVdS)�rNc
s>yt}
Wntk
rYnX|dk	r*|n|
j|_|dk	r>|n|
j|_|dk	rR|n|
j|_|dk	rf|n|
j|_|dk	rz|n|
j|_|dk	r�|n|
j|_|	dkr�g|_n|	|_�dkr�|
j	j
�|_	n.t�t�s�t�fdd�t
�D��|_	n�|_	�dk�r
tjt
d�|_n0t�t��s4t�fdd�t
�D��|_n�|_dS)Nc3s|]}|t|�k�fVqdS)N)rT)rQr�)rr'r)�	<genexpr>nsz#Context.__init__.<locals>.<genexpr>r%c3s|]}|t|�k�fVqdS)N)rT)rQr�)rr'r)r�us)r�	NameErrorr?r>r!r@r�r��_ignored_flagsrrGr^r�r�fromkeysr)r.r?r>r!r@r�r�rrr�Zdcr')rrr)r�Us.

zContext.__init__cCs�t|t�std|��|dkr<||kr�td||||f��nJ|dkrb||kr�td||||f��n$||ksr||kr�td||||f��tj|||�S)Nz%s must be an integerz-infz%s must be in [%s, %d]. got: %sr`z%s must be in [%d, %s]. got: %sz%s must be in [%d, %d]. got %s)r^rTrqrkr\�__setattr__)r.�namersZvminZvmaxr'r'r)�_set_integer_checkys
zContext._set_integer_checkcCsht|t�std|��x |D]}|tkrtd|��qWx tD]}||kr>td|��q>Wtj|||�S)Nz%s must be a signal dictz%s is not a valid signal dict)r^r�rqr�KeyErrorr\r�)r.r�r~�keyr'r'r)�_set_signal_dict�s


zContext._set_signal_dictcCs�|dkr|j||dd�S|dkr0|j||dd�S|dkrH|j||dd�S|dkr`|j||dd�S|d	krx|j||dd�S|d
kr�|tkr�td|��tj|||�S|dks�|d
kr�|j||�S|dkr�tj|||�Std|��dS)Nr?r-r`r!z-infr%r@r�r�r>z%s: invalid rounding moderrr�z.'decimal.Context' object has no attribute '%s')r��_rounding_modesrqr\r�r�rK)r.r�rsr'r'r)r��s(zContext.__setattr__cCstd|��dS)Nz%s cannot be deleted)rK)r.r�r'r'r)�__delattr__�szContext.__delattr__c	CsNdd�|jj�D�}dd�|jj�D�}|j|j|j|j|j|j|j	||ffS)NcSsg|]\}}|r|�qSr'r')rQ�sigr�r'r'r)rS�sz&Context.__reduce__.<locals>.<listcomp>cSsg|]\}}|r|�qSr'r')rQr�r�r'r'r)rS�s)
r�itemsrrhr?r>r!r@r�r�)r.rrr'r'r)ri�s
zContext.__reduce__cCs|g}|jdt|��dd�|jj�D�}|jddj|�d�dd�|jj�D�}|jddj|�d�dj|�d	S)
NzrContext(prec=%(prec)d, rounding=%(rounding)s, Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d, clamp=%(clamp)dcSsg|]\}}|r|j�qSr')r1)rQr}r�r'r'r)rS�sz$Context.__repr__.<locals>.<listcomp>zflags=[z, �]cSsg|]\}}|r|j�qSr')r1)rQr�r�r'r'r)rS�sztraps=[�))rl�varsrr�rmr)r.r��namesr'r'r)r��szContext.__repr__cCsx|jD]}d|j|<qWdS)Nr%)r)r.�flagr'r'r)rH�szContext.clear_flagscCsx|jD]}d|j|<qWdS)Nr%)r)r.r�r'r'r)�clear_traps�szContext.clear_trapsc
Cs.t|j|j|j|j|j|j|j|j|j	�	}|S)N)
rr?r>r!r@r�r�rrr�)r.�ncr'r'r)r'�szContext._shallow_copyc
Cs6t|j|j|j|j|j|j|jj�|j	j�|j
�	}|S)N)rr?r>r!r@r�r�rrGrr�)r.r�r'r'r)rG�s
zContext.copycGsZtj||�}||jkr(|�j|f|��Sd|j|<|j|sN|�j|f|��S||��dS)Nr-)�_condition_map�getr�r0rr)r.Z	conditionZexplanationr(�errorr'r'r)rc�s


zContext._raise_errorcCs
|jt�S)N)�
_ignore_flagsr)r.r'r'r)r[�szContext._ignore_all_flagscGs|jt|�|_t|�S)N)r�ri)r.rr'r'r)r��szContext._ignore_flagscGs<|rt|dttf�r|d}x|D]}|jj|�q$WdS)Nr%)r^rjrir��remove)r.rr�r'r'r)�
_regard_flags�s
zContext._regard_flagscCst|j|jd�S)Nr-)rTr!r?)r.r'r'r)r�sz
Context.EtinycCst|j|jd�S)Nr-)rTr@r?)r.r'r'r)r�szContext.EtopcCs|j}||_|S)N)r>)r.rjr>r'r'r)r(szContext._set_roundingrPcCsjt|t�r*||j�ksd|kr*|jtd�St||d�}|j�r`t|j�|j	|j
kr`|jtd�S|j|�S)NrQzAtrailing or leading whitespace and underscores are not permitted.)r/zdiagnostic info too long in NaN)r^r_rarcrrr�rer7r?r�r�)r.rAr~r'r'r)�create_decimal#szContext.create_decimalcCstj|�}|j|�S)N)rrpr�)r.r}r~r'r'r)�create_decimal_from_float4s
z!Context.create_decimal_from_floatcCst|dd�}|j|d�S)NT)r�)r/)r�r�)r.rr'r'r)rgFszContext.abscCs8t|dd�}|j||d�}|tkr0td|��n|SdS)NT)r�)r/zUnable to convert %s to Decimal)r�r�r�rq)r.rrRr�r'r'r)�add[s
zContext.addcCst|j|��S)N)r_r�)r.rr'r'r)�_applypszContext._applycCst|t�std��|j�S)Nz,canonical requires a Decimal as an argument.)r^rrqr1)r.rr'r'r)r1ss	
zContext.canonicalcCst|dd�}|j||d�S)NT)r�)r/)r�r�)r.rrRr'r'r)r��s!zContext.comparecCst|dd�}|j||d�S)NT)r�)r/)r�r2)r.rrRr'r'r)r2�s zContext.compare_signalcCst|dd�}|j|�S)NT)r�)r�r-)r.rrRr'r'r)r-�szContext.compare_totalcCst|dd�}|j|�S)NT)r�)r�r6)r.rrRr'r'r)r6�szContext.compare_total_magcCst|dd�}|j�S)NT)r�)r�r�)r.rr'r'r)r��s
zContext.copy_abscCst|dd�}t|�S)NT)r�)r�r)r.rr'r'r)�copy_decimal�s
zContext.copy_decimalcCst|dd�}|j�S)NT)r�)r�r�)r.rr'r'r)r�s
zContext.copy_negatecCst|dd�}|j|�S)NT)r�)r�r7)r.rrRr'r'r)r7szContext.copy_signcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)NT)r�)r/zUnable to convert %s to Decimal)r�r�r�rq)r.rrRr�r'r'r)�divide+s
zContext.dividecCs8t|dd�}|j||d�}|tkr0td|��n|SdS)NT)r�)r/zUnable to convert %s to Decimal)r�r�r�rq)r.rrRr�r'r'r)�
divide_intPs
zContext.divide_intcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)NT)r�)r/zUnable to convert %s to Decimal)r�r�r�rq)r.rrRr�r'r'r)r�gs
zContext.divmodcCst|dd�}|j|d�S)NT)r�)r/)r�rU)r.rr'r'r)rU|szContext.expcCst|dd�}|j|||d�S)NT)r�)r/)r�r�)r.rrRr*r'r'r)r��szContext.fmacCst|t�std��|j�S)Nz/is_canonical requires a Decimal as an argument.)r^rrqr:)r.rr'r'r)r:�s	
zContext.is_canonicalcCst|dd�}|j�S)NT)r�)r�r;)r.rr'r'r)r;�szContext.is_finitecCst|dd�}|j�S)NT)r�)r�r")r.rr'r'r)r"�szContext.is_infinitecCst|dd�}|j�S)NT)r�)r�r�)r.rr'r'r)r��s
zContext.is_nancCst|dd�}|j|d�S)NT)r�)r/)r�r<)r.rr'r'r)r<�szContext.is_normalcCst|dd�}|j�S)NT)r�)r�r�)r.rr'r'r)r�szContext.is_qnancCst|dd�}|j�S)NT)r�)r�r=)r.rr'r'r)r=szContext.is_signedcCst|dd�}|j�S)NT)r�)r�r�)r.rr'r'r)r�$s
zContext.is_snancCst|dd�}|j|d�S)NT)r�)r/)r�r>)r.rr'r'r)r>4szContext.is_subnormalcCst|dd�}|j�S)NT)r�)r�r?)r.rr'r'r)r?JszContext.is_zerocCst|dd�}|j|d�S)NT)r�)r/)r�rG)r.rr'r'r)rG[sz
Context.lncCst|dd�}|j|d�S)NT)r�)r/)r�rJ)r.rr'r'r)rJqsz
Context.log10cCst|dd�}|j|d�S)NT)r�)r/)r�rK)r.rr'r'r)rK�szContext.logbcCst|dd�}|j||d�S)NT)r�)r/)r�rU)r.rrRr'r'r)rU�szContext.logical_andcCst|dd�}|j|d�S)NT)r�)r/)r�rW)r.rr'r'r)rW�szContext.logical_invertcCst|dd�}|j||d�S)NT)r�)r/)r�rX)r.rrRr'r'r)rX�szContext.logical_orcCst|dd�}|j||d�S)NT)r�)r/)r�rV)r.rrRr'r'r)rV�szContext.logical_xorcCst|dd�}|j||d�S)NT)r�)r/)r�r�)r.rrRr'r'r)r�szContext.maxcCst|dd�}|j||d�S)NT)r�)r/)r�rY)r.rrRr'r'r)rY&szContext.max_magcCst|dd�}|j||d�S)NT)r�)r/)r�r�)r.rrRr'r'r)r�7szContext.mincCst|dd�}|j||d�S)NT)r�)r/)r�rZ)r.rrRr'r'r)rZRszContext.min_magcCst|dd�}|j|d�S)NT)r�)r/)r�r�)r.rr'r'r)�minuscsz
Context.minuscCs8t|dd�}|j||d�}|tkr0td|��n|SdS)NT)r�)r/zUnable to convert %s to Decimal)r�r�r�rq)r.rrRr�r'r'r)�multiplyts
zContext.multiplycCst|dd�}|j|d�S)NT)r�)r/)r�r])r.rr'r'r)r]�szContext.next_minuscCst|dd�}|j|d�S)NT)r�)r/)r�r^)r.rr'r'r)r^�szContext.next_pluscCst|dd�}|j||d�S)NT)r�)r/)r�r_)r.rrRr'r'r)r_�s zContext.next_towardcCst|dd�}|j|d�S)NT)r�)r/)r�r )r.rr'r'r)r �szContext.normalizecCst|dd�}|j|d�S)NT)r�)r/)r�ra)r.rr'r'r)ra�s/zContext.number_classcCst|dd�}|j|d�S)NT)r�)r/)r�r�)r.rr'r'r)�plus)szContext.pluscCs:t|dd�}|j|||d�}|tkr2td|��n|SdS)NT)r�)r/zUnable to convert %s to Decimal)r�rr�rq)r.rrRr�r�r'r'r)�power:s
Iz
Context.powercCst|dd�}|j||d�S)NT)r�)r/)r�r�)r.rrRr'r'r)r��s7zContext.quantizecCstd�S)Nr�)r)r.r'r'r)rb�sz
Context.radixcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)NT)r�)r/zUnable to convert %s to Decimal)r�r�r�rq)r.rrRr�r'r'r)r��s
zContext.remaindercCst|dd�}|j||d�S)NT)r�)r/)r�r�)r.rrRr'r'r)r��szContext.remainder_nearcCst|dd�}|j||d�S)NT)r�)r/)r�rf)r.rrRr'r'r)rfszContext.rotatecCst|dd�}|j|�S)NT)r�)r�r#)r.rrRr'r'r)r#1szContext.same_quantumcCst|dd�}|j||d�S)NT)r�)r/)r�rg)r.rrRr'r'r)rgIszContext.scalebcCst|dd�}|j||d�S)NT)r�)r/)r�r�)r.rrRr'r'r)r�\sz
Context.shiftcCst|dd�}|j|d�S)NT)r�)r/)r�r,)r.rr'r'r)r,zszContext.sqrtcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)NT)r�)r/zUnable to convert %s to Decimal)r�r�r�rq)r.rrRr�r'r'r)�subtract�s
zContext.subtractcCst|dd�}|j|d�S)NT)r�)r/)r�r�)r.rr'r'r)r��szContext.to_eng_stringcCst|dd�}|j|d�S)NT)r�)r/)r�r�)r.rr'r'r)�
to_sci_string�szContext.to_sci_stringcCst|dd�}|j|d�S)NT)r�)r/)r�r&)r.rr'r'r)r&�szContext.to_integral_exactcCst|dd�}|j|d�S)NT)r�)r/)r�r�)r.rr'r'r)r��szContext.to_integral_value)	NNNNNNNNN)N)rP)N)Wr1r2r3r�r�r�r�r�rir�rHr�r'rGrkrcr[r�r�r�r�r�r(r�r�rgr�r�r1r�r2r-r6r�r�r�r7r�r�r�rUr�r:r;r"r�r<r�r=r�r>r?rGrJrKrUrWrXrVr�rYr�rZr�r�r]r^r_r rar�r�r�rbr�r�rfr#rgr�r,r�r�r�r&r�r�r'r'r'r)rBs�
"



$#


%
 #2
P:&" c@s&eZdZd	Zd
dd�Zdd�ZeZdS)rhr<rTrUNcCsf|dkrd|_d|_d|_nFt|t�rD|j|_t|j�|_|j|_n|d|_|d|_|d|_dS)Nr%r-r+)r<rTrUr^rr6r7rN)r.rsr'r'r)r�s



z_WorkRep.__init__cCsd|j|j|jfS)Nz(%r, %r, %r))r<rTrU)r.r'r'r)r�(sz_WorkRep.__repr__)r<rTrU)N)r1r2r3r{r�r�r�r'r'r'r)rhs
rhcCs�|j|jkr|}|}n|}|}tt|j��}tt|j��}|jtd||d�}||jd|krpd|_||_|jd|j|j9_|j|_||fS)Nr-r+r�r�)rUrer_rTr�)r�r�r?Ztmpr�Ztmp_lenZ	other_lenrUr'r'r)r�/sr�cCsb|dkrdS|dkr |d|Stt|��}t|�t|jd��}||krPdS|d|SdS)Nr%r�rP)r_rgre�rstrip)r4r�Zstr_nZval_nr'r'r)rOsrcCsF|dks|dkrtd��d}x$||kr@||||d?}}qW|S)Nr%z3Both arguments to _sqrt_nearest should be positive.r-)rk)r4rrRr'r'r)�
_sqrt_nearestds
r�cCs2d|>||?}}|d||d@|d@|kS)Nr-r+r')rr�rRr�r'r'r)�_rshift_nearestssr�cCs&t||�\}}|d||d@|kS)Nr+r-)r�)rrRr�r�r'r'r)�_div_nearest{sr�rc		Cs�||}d}xn||kr*t|�||>|ksF||krzt|�||?|krzt||d>|t||t||�|��}|d7}qWtdtt|��d|�}t||�}t||�}x0t|ddd�D]}t||�t|||�}q�Wt|||�S)Nr%r-r�rZi����r�)rgr�r�r�rTrer_r�)	r�M�Lr�R�TZyshift�wrr'r'r)�_ilog�s

r�c
Cs�|d7}tt|��}||||dk}|dkr�d|}|||}|dkrZ|d|9}nt|d|�}t||�}t|�}t|||�}||}	nd}t|d|�}	t|	|d�S)Nr+r-r%r�r)rer_r�r��
_log10_digits)
r*r�r
r+r}r�r�log_dZlog_10Zlog_tenpowerr'r'r)rI�s 

rIc	Cs�|d7}tt|��}||||dk}|dkrr|||}|dkrR|d|9}nt|d|�}t|d|�}nd}|r�ttt|���d}||dkr�t|t||�d|�}q�d}nd}t||d�S)Nr+r-r%r�r)rer_r�r�rgr�)	r*r�r
r+r}rr�rZ	f_log_tenr'r'r)rF�s"rFc@seZdZdd�Zdd�ZdS)�
_Log10MemoizecCs
d|_dS)NZ/23025850929940456840179914546843642076011014886)rw)r.r'r'r)r�sz_Log10Memoize.__init__cCs�|dkrtd��|t|j�kr�d}xLd||d}tttd||�d��}||d�d|krdP|d7}q$W|jd�dd	�|_t|jd|d��S)
Nr%zp should be nonnegativerZr�r+rrPr-r�)rkrerwr_r�r�r�rT)r.r
rr�rwr'r'r)�	getdigitss	z_Log10Memoize.getdigitsN)r1r2r3r�r�r'r'r'r)r�sr�c	Cs�t||>|�}tdtt|��d|�}t||�}||>}x.t|ddd�D]}t|||||�}qRWx6t|ddd	�D]"}||d>}t||||�}q�W||S)
Nr�rZr-r%r+i����r�r�r�)rrTrer_r�r�)	rr�r�r�r�rZMshiftr�rr'r'r)�_iexp&s
r�c	Cs�|d7}td|tt|��d�}||}||}|dkrH|d|}n|d|}t|t|��\}}t|d|�}tt|d|�d�||dfS)Nr+r%r-r�i�rZ)r�rer_r�r�r�r�)	r*r�r
rr�r�ZcshiftZquotrr'r'r)r8Ksr8cCs�ttt|���|}t||||d�}||}|dkrJ||d|}nt||d|�}|dkr�tt|��|dk|dkkr�d|ddd|}	}
q�d|d|}	}
n,t||d|d�\}	}
t|	d�}	|
d7}
|	|
fS)Nr-r%r�)rer_rgrFr�r8)rr
rrr
rRZlxcr�Zpcr�rUr'r'r)ros
rr�F�5�(�r@�r�rx)	r��2�3�4�5�6�7�8r=cCs0|dkrtd��t|�}dt|�||dS)Nr%z0The argument to _log10_lb should be nonnegative.r)rkr_re)r*Z
correctionZstr_cr'r'r)r	�sr	cCsLt|t�r|St|t�r t|�S|r8t|t�r8tj|�S|rHtd|��tS)NzUnable to convert %s to Decimal)r^rrTrorprqr�)r�r�Zallow_floatr'r'r)r��s


r�cCs�t|t�r||fSt|tj�rR|jsDt|jtt|j	�|j
�|j�}|t|j�fS|rrt|tj
�rr|jdkrr|j}t|t�r�t�}|r�d|jt<n|jtd�|tj|�fSttfS)Nr%r-z;strict semantics for mixing floats and Decimals are enabled)r^r�_numbersZRationalrOr5r6r_rTr7�denominatorrN�	numeratorZComplexr�r�rorrrrcrpr�)r.r�r�r/r'r'r)r��s$

r�ri?B)r?r>rrr@r!r�r�r[)r?r>rra�        # A numeric string consists of:
#    \s*
    (?P<sign>[-+])?              # an optional sign, followed by either...
    (
        (?=\d|\.\d)              # ...a number (with at least one digit)
        (?P<int>\d*)             # having a (possibly empty) integer part
        (\.(?P<frac>\d*))?       # followed by an optional fractional part
        (E(?P<exp>[-+]?\d+))?    # followed by an optional exponent, or...
    |
        Inf(inity)?              # ...an infinity, or...
    |
        (?P<signal>s)?           # ...an (optionally signaling)
        NaN                      # NaN
        (?P<diag>\d*)            # with (possibly empty) diagnostic info.
    )
#    \s*
    \Z
z0*$z50*$z�\A
(?:
   (?P<fill>.)?
   (?P<align>[<>=^])
)?
(?P<sign>[-+ ])?
(?P<alt>\#)?
(?P<zeropad>0)?
(?P<minimumwidth>(?!0)\d+)?
(?P<thousands_sep>,)?
(?:\.(?P<precision>0|(?!0)\d+))?
(?P<type>[eEfFgGn%])?
\Z
cCs�tj|�}|dkrtd|��|j�}|d}|d}|ddk	|d<|drv|dk	rbtd|��|dk	rvtd|��|p|d|d<|p�d|d<|d	dkr�d
|d	<t|dp�d�|d<|d
dk	r�t|d
�|d
<|d
dkr�|ddks�|ddkr�d|d
<|ddk�rfd|d<|dk�r&tj�}|ddk	�r@td|��|d|d<|d|d<|d|d<n*|ddk�r|d|d<ddg|d<d|d<|S)NzInvalid format specifier: �fill�align�zeropadz7Fill character conflicts with '0' in format specifier: z2Alignment conflicts with '0' in format specifier: � �>r<rS�minimumwidthrPrrr%rjZgGnr-r4rp�
thousands_sepzJExplicit thousands separator conflicts with 'n' type in format specifier: �grouping�
decimal_pointrRrZr�)�_parse_format_specifier_regex�matchrk�	groupdictrT�_locale�
localeconv)�format_specrnrtZformat_dictr�r�r'r'r)rtDsN

rtc	Cs�|d}|d}||t|�t|�}|d}|dkrF|||}nj|dkr\|||}nT|dkrr|||}n>|dkr�t|�d}|d|�||||d�}ntd	��|S)
Nr�r�r��<r��=�^r+zUnrecognised alignment field)rerk)	r<ryrxr�r�Zpaddingr�r�Zhalfr'r'r)rv�s"rvcCspddlm}m}|sgS|ddkrJt|�dkrJ||dd�||d��S|d	tjkrd|dd
�Std��dS)Nr%)�chain�repeatr-r+z unrecognised format for groupingr�r�r�r�r�)�	itertoolsr�r�rer��CHAR_MAXrk)r�r�r�r'r'r)�_group_lengths�s
r�cCs�|d}|d}g}x�t|�D]�}|dkr2td��ttt|�|d�|�}|jd|t|�||d��|d|�}||8}|r�|dkr�P|t|�8}qWtt|�|d�}|jd|t|�||d��|jt|��S)Nr�r�r%zgroup length should be positiver-rP)r�rkr�r�rerlrm�reversed)rwrx�	min_width�sepr��groupsr+r'r'r)�_insert_thousands_sep�s $$r�cCs$|rdS|ddkr|dSdSdS)NrSr<z +rRr')�is_negativerxr'r'r)ru�s
rucCs�t||�}|s|dr"|d|}|dks6|ddkr\ddddd�|d}|d	j||�7}|dd
krp|d
7}|dr�|dt|�t|�}nd}t|||�}t||||�S)
NZaltr�r%rjrsr�r�)r�r�rqrpz{0}{1:+}ror�r�)ru�formatrer�rv)r�rurvrUrxr<Zecharr�r'r'r)rw�s
rwZInfz-Infr�ll����l������N�Zoi���)N)F)r%)r)r)FF)Fi���)N)r-r�)|�__all__r1rC�__version__Z__libmpdec_version__ZmathryZnumbersr�rD�collectionsr&Z_namedtupler�ImportErrorrrrrrrrrr$�maxsizer r!r"r#�ArithmeticErrorrrr	r�ZeroDivisionErrorr
rrrrrr
rrrqrrr�r�rIr\rArErK�hasattrrJrFrrrrr5�Number�registerrMrrhr�rTr|rrr�r�r�r�rIrFr�r�r�r�r8rr	r�r�rrr�re�compile�VERBOSE�
IGNORECASEr�r`r�r��DOTALLr�Zlocaler�rtrvr�r�rurwrErDr9r4rr3r;�	hash_info�modulusr�r`r�r�r�r�r�r'r'r'r)�<module>us~


&



.

^

0",#
%$+
	

*

P
%
)_threading_local.cpython-36.opt-1.pyc000064400000014433150335715140013420 0ustar003


 \.�@s^dZddlmZddlmZdgZGdd�d�Zedd��ZGd	d�d�Zdd
l	m
Z
mZdS)a%Thread-local objects.

(Note that this module provides a Python version of the threading.local
 class.  Depending on the version of Python you're using, there may be a
 faster one available.  You should always import the `local` class from
 `threading`.)

Thread-local objects support the management of thread-local data.
If you have data that you want to be local to a thread, simply create
a thread-local object and use its attributes:

  >>> mydata = local()
  >>> mydata.number = 42
  >>> mydata.number
  42

You can also access the local-object's dictionary:

  >>> mydata.__dict__
  {'number': 42}
  >>> mydata.__dict__.setdefault('widgets', [])
  []
  >>> mydata.widgets
  []

What's important about thread-local objects is that their data are
local to a thread. If we access the data in a different thread:

  >>> log = []
  >>> def f():
  ...     items = sorted(mydata.__dict__.items())
  ...     log.append(items)
  ...     mydata.number = 11
  ...     log.append(mydata.number)

  >>> import threading
  >>> thread = threading.Thread(target=f)
  >>> thread.start()
  >>> thread.join()
  >>> log
  [[], 11]

we get different data.  Furthermore, changes made in the other thread
don't affect data seen in this thread:

  >>> mydata.number
  42

Of course, values you get from a local object, including a __dict__
attribute, are for whatever thread was current at the time the
attribute was read.  For that reason, you generally don't want to save
these values across threads, as they apply only to the thread they
came from.

You can create custom local objects by subclassing the local class:

  >>> class MyLocal(local):
  ...     number = 2
  ...     def __init__(self, **kw):
  ...         self.__dict__.update(kw)
  ...     def squared(self):
  ...         return self.number ** 2

This can be useful to support default values, methods and
initialization.  Note that if you define an __init__ method, it will be
called each time the local object is used in a separate thread.  This
is necessary to initialize each thread's dictionary.

Now if we create a local object:

  >>> mydata = MyLocal(color='red')

Now we have a default number:

  >>> mydata.number
  2

an initial color:

  >>> mydata.color
  'red'
  >>> del mydata.color

And a method that operates on the data:

  >>> mydata.squared()
  4

As before, we can access the data in a separate thread:

  >>> log = []
  >>> thread = threading.Thread(target=f)
  >>> thread.start()
  >>> thread.join()
  >>> log
  [[('color', 'red')], 11]

without affecting this thread's data:

  >>> mydata.number
  2
  >>> mydata.color
  Traceback (most recent call last):
  ...
  AttributeError: 'MyLocal' object has no attribute 'color'

Note that subclasses can define slots, but they are not thread
local. They are shared across threads:

  >>> class MyLocal(local):
  ...     __slots__ = 'number'

  >>> mydata = MyLocal()
  >>> mydata.number = 42
  >>> mydata.color = 'red'

So, the separate thread:

  >>> thread = threading.Thread(target=f)
  >>> thread.start()
  >>> thread.join()

affects what we see:

  >>> mydata.number
  11

>>> del mydata
�)�ref)�contextmanager�localc@s,eZdZdZdZdd�Zd	d
�Zdd�Zd
S)�
_localimplz#A class managing thread-local dicts�key�dicts�	localargs�	locallock�__weakref__cCsdtt|��|_i|_dS)Nz_threading_local._localimpl.)�str�idrr)�self�r�(/usr/lib64/python3.6/_threading_local.py�__init__�sz_localimpl.__init__cCst�}|jt|�dS)zPReturn the dict for the current thread. Raises KeyError if none
        defined.�)�current_threadrr)r
�threadrrr�get_dict�sz_localimpl.get_dictcshi}|j}t�}t|�}|f�fdd�	}|f�fdd�	}t||��t||���|j|<�|f|j|<|S)z8Create a new dict for the current thread, and return it.cs��}|dk	r|j|=dS)N)�__dict__)�_rr)�wrthreadrr�
local_deleted�sz-_localimpl.create_dict.<locals>.local_deletedcs��}|dk	r|jj|�}dS)N)r�pop)r�idtr�dct)�wrlocalrr�thread_deleted�sz._localimpl.create_dict.<locals>.thread_deleted)rrrrrr)r
Z	localdictrrrrrr)rrr�create_dict�s


z_localimpl.create_dictN)rrrr	r
)�__name__�
__module__�__qualname__�__doc__�	__slots__rrrrrrrr�s
rccsvtj|d�}y|j�}Wn2tk
rJ|j�}|j\}}|j||�YnX|j�tj|d|�dVWdQRXdS)N�_local__implr)	�object�__getattribute__r�KeyErrorrrrr	�__setattr__)r
�implr�args�kwrrr�_patch�s
r,c@s0eZdZdZdd�Zdd�Zdd�Zd	d
�ZdS)
rr$rcOsX|s|r|jtjkrtd��tj|�}t�}||f|_t�|_tj|d|�|j	�|S)Nz*Initialization arguments are not supportedr$)
rr%�	TypeError�__new__rr�RLockr	r(r)�clsr*r+r
r)rrrr.�s

z
local.__new__c
Cs t|��tj||�SQRXdS)N)r,r%r&)r
�namerrrr&�s
zlocal.__getattribute__cCs:|dkrtd|jj��t|��tj|||�SQRXdS)Nrz+%r object attribute '__dict__' is read-only)�AttributeError�	__class__rr,r%r()r
r1�valuerrrr(�s
zlocal.__setattr__c
Cs8|dkrtd|jj��t|��tj||�SQRXdS)Nrz+%r object attribute '__dict__' is read-only)r2r3rr,r%�__delattr__)r
r1rrrr5�s
zlocal.__delattr__N)r$r)rr r!r#r.r&r(r5rrrrr�s
)rr/N)r"�weakrefr�
contextlibr�__all__rr,rZ	threadingrr/rrrr�<module>�s,&_weakrefset.cpython-36.opt-1.pyc000064400000017226150335715140012444 0ustar003


 \I�@s2ddlmZdgZGdd�d�ZGdd�d�ZdS)�)�ref�WeakSetc@s$eZdZdd�Zdd�Zdd�ZdS)�_IterationGuardcCst|�|_dS)N)r�
weakcontainer)�selfr�r�#/usr/lib64/python3.6/_weakrefset.py�__init__sz_IterationGuard.__init__cCs |j�}|dk	r|jj|�|S)N)r�
_iterating�add)r�wrrr�	__enter__sz_IterationGuard.__enter__cCs0|j�}|dk	r,|j}|j|�|s,|j�dS)N)rr
�remove�_commit_removals)r�e�t�br�srrr�__exit__s
z_IterationGuard.__exit__N)�__name__�
__module__�__qualname__r	r
rrrrrr
src@seZdZd>dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZeZd d!�Zd"d#�Zd$d%�ZeZd&d'�Zd(d)�Zd*d+�ZeZd,d-�Zd.d/�ZeZd0d1�Zd2d3�Zd4d5�Z e Z!d6d7�Z"d8d9�Z#d:d;�Z$e$Z%d<d=�Z&dS)?rNcCsBt�|_t|�fdd�}||_g|_t�|_|dk	r>|j|�dS)NcSs2|�}|dk	r.|jr"|jj|�n|jj|�dS)N)r
�_pending_removals�append�data�discard)�item�selfrefrrrr�_remove&s
z!WeakSet.__init__.<locals>._remove)�setrrrrr
�update)rrrrrrr	$szWeakSet.__init__cCs(|j}|jj}x|r"||j��qWdS)N)rrr�pop)r�lrrrrr4szWeakSet._commit_removalsc
cs<t|��*x"|jD]}|�}|dk	r|VqWWdQRXdS)N)rr)r�itemrefrrrr�__iter__:s

zWeakSet.__iter__cCst|j�t|j�S)N)�lenrr)rrrr�__len__CszWeakSet.__len__cCs,yt|�}Wntk
r dSX||jkS)NF)r�	TypeErrorr)rr�wrrrr�__contains__Fs
zWeakSet.__contains__cCs|jt|�ft|dd�fS)N�__dict__)�	__class__�list�getattr)rrrr�
__reduce__MszWeakSet.__reduce__cCs&|jr|j�|jjt||j��dS)N)rrrrrr)rrrrrrQszWeakSet.addcCs|jr|j�|jj�dS)N)rrr�clear)rrrrr/Vsz
WeakSet.clearcCs
|j|�S)N)r+)rrrr�copy[szWeakSet.copycCsV|jr|j�xBy|jj�}Wntk
r:td��YnX|�}|dk	r|SqWdS)Nzpop from empty WeakSet)rrrr!�KeyError)rr#rrrrr!^szWeakSet.popcCs"|jr|j�|jjt|��dS)N)rrrrr)rrrrrrjszWeakSet.removecCs"|jr|j�|jjt|��dS)N)rrrrr)rrrrrroszWeakSet.discardcCs*|jr|j�x|D]}|j|�qWdS)N)rrr)r�other�elementrrrr ts
zWeakSet.updatecCs|j|�|S)N)r )rr2rrr�__ior__zs
zWeakSet.__ior__cCs|j�}|j|�|S)N)r0�difference_update)rr2�newsetrrr�
difference~s
zWeakSet.differencecCs|j|�dS)N)�__isub__)rr2rrrr5�szWeakSet.difference_updatecCs<|jr|j�||kr"|jj�n|jjdd�|D��|S)Ncss|]}t|�VqdS)N)r)�.0rrrr�	<genexpr>�sz#WeakSet.__isub__.<locals>.<genexpr>)rrrr/r5)rr2rrrr8�szWeakSet.__isub__cs�j�fdd�|D��S)Nc3s|]}|�kr|VqdS)Nr)r9r)rrrr:�sz'WeakSet.intersection.<locals>.<genexpr>)r+)rr2r)rr�intersection�szWeakSet.intersectioncCs|j|�dS)N)�__iand__)rr2rrr�intersection_update�szWeakSet.intersection_updatecCs(|jr|j�|jjdd�|D��|S)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz#WeakSet.__iand__.<locals>.<genexpr>)rrrr=)rr2rrrr<�szWeakSet.__iand__cCs|jjdd�|D��S)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz#WeakSet.issubset.<locals>.<genexpr>)r�issubset)rr2rrrr>�szWeakSet.issubsetcCs|jtdd�|D��kS)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz!WeakSet.__lt__.<locals>.<genexpr>)rr)rr2rrr�__lt__�szWeakSet.__lt__cCs|jjdd�|D��S)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz%WeakSet.issuperset.<locals>.<genexpr>)r�
issuperset)rr2rrrr@�szWeakSet.issupersetcCs|jtdd�|D��kS)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz!WeakSet.__gt__.<locals>.<genexpr>)rr)rr2rrr�__gt__�szWeakSet.__gt__cCs(t||j�stS|jtdd�|D��kS)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz!WeakSet.__eq__.<locals>.<genexpr>)�
isinstancer+�NotImplementedrr)rr2rrr�__eq__�szWeakSet.__eq__cCs|j�}|j|�|S)N)r0�symmetric_difference_update)rr2r6rrr�symmetric_difference�s
zWeakSet.symmetric_differencecCs|j|�dS)N)�__ixor__)rr2rrrrE�sz#WeakSet.symmetric_difference_updatecs@�jr�j��|kr"�jj�n�jj�fdd�|D���S)Nc3s|]}t|�j�VqdS)N)rr)r9r)rrrr:�sz#WeakSet.__ixor__.<locals>.<genexpr>)rrrr/rE)rr2r)rrrG�szWeakSet.__ixor__cCs|jdd�||fD��S)Ncss|]}|D]
}|Vq
qdS)Nr)r9rrrrrr:�sz WeakSet.union.<locals>.<genexpr>)r+)rr2rrr�union�sz
WeakSet.unioncCst|j|��dkS)Nr)r%r;)rr2rrr�
isdisjoint�szWeakSet.isdisjoint)N)'rrrr	rr$r&r)r.rr/r0r!rrr r4r7�__sub__r5r8r;�__and__r=r<r>�__le__r?r@�__ge__rArDrF�__xor__rErGrH�__or__rIrrrrr#sH
			N)�_weakrefr�__all__rrrrrr�<module>ssubprocess.cpython-36.opt-2.pyc000064400000060140150335715140012327 0ustar003


 \���@s4ddlZejdkZddlZddlZddlZddlZddlZddlZddl	Z	ddlm
ZGdd�de�Z
Gdd�de
�ZGdd	�d	e
�Zer�ddlZddlZddlZGd
d�d�ZnhddlZddlZddlZyddlZWnek
r�ddlZYnXeedd
�Zeed��rejZnejZddddddddddddd	dgZe�r�ddlm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'ej(dddddd d!d"dg	�Gd#d$�d$e)�Z*gZ+d%d&�Z,d;Z-d<Z.d=Z/d*d+�Z0d,d-�Z1dd.�d/d�Z2d0d�Z3dd.�d1d�Z4Gd2d�de5�Z6ddd3d4�d5d�Z7d6d7�Z8d8d�Z9d9d�Z:e5�Z;Gd:d�de5�Z<dS)>�NZwin32)�	monotonicc@seZdZdS)�SubprocessErrorN)�__name__�
__module__�__qualname__�rr�"/usr/lib64/python3.6/subprocess.pyr9src@s8eZdZd	dd�Zdd�Zedd��Zejdd��ZdS)
�CalledProcessErrorNcCs||_||_||_||_dS)N)�
returncode�cmd�output�stderr)�selfr
rrr
rrr�__init__CszCalledProcessError.__init__cCsb|jrN|jdkrNyd|jtj|j�fStk
rJd|j|jfSXnd|j|jfSdS)NrzCommand '%s' died with %r.z)Command '%s' died with unknown signal %d.z.Command '%s' returned non-zero exit status %d.)r
r�signalZSignals�
ValueError)rrrr�__str__IszCalledProcessError.__str__cCs|jS)N)r)rrrr�stdoutUszCalledProcessError.stdoutcCs
||_dS)N)r)r�valuerrrrZs)NN)rrrrr�propertyr�setterrrrrr	<s
r	c@s8eZdZd	dd�Zdd�Zedd��Zejdd��ZdS)
�TimeoutExpiredNcCs||_||_||_||_dS)N)r�timeoutrr
)rrrrr
rrrrhszTimeoutExpired.__init__cCsd|j|jfS)Nz'Command '%s' timed out after %s seconds)rr)rrrrrnszTimeoutExpired.__str__cCs|jS)N)r)rrrrrrszTimeoutExpired.stdoutcCs
||_dS)N)r)rrrrrrvs)NN)rrrrrrrrrrrrras
rc@s eZdZdZdZdZdZdZdS)�STARTUPINFOrN)rrr�dwFlags�	hStdInput�
hStdOutput�	hStdError�wShowWindowrrrrr�s
rZPIPE_BUFi�PollSelector�Popen�PIPE�STDOUT�call�
check_call�getstatusoutput�	getoutput�check_output�run�DEVNULL�CompletedProcess)�CREATE_NEW_CONSOLE�CREATE_NEW_PROCESS_GROUP�STD_INPUT_HANDLE�STD_OUTPUT_HANDLE�STD_ERROR_HANDLE�SW_HIDE�STARTF_USESTDHANDLES�STARTF_USESHOWWINDOWr+r,r-r.r/r0r1r2c@s6eZdZdZejfdd�Zdd�Zdd�ZeZ	eZ
dS)	�HandleFcCs|jsd|_||�dS)NT)�closed)r�CloseHandlerrr�Close�szHandle.ClosecCs |jsd|_t|�Std��dS)NTzalready closed)r4�intr)rrrr�Detach�sz
Handle.DetachcCsd|jjt|�fS)Nz%s(%d))�	__class__rr7)rrrr�__repr__�szHandle.__repr__N)rrrr4�_winapir5r6r8r:�__del__rrrrrr3�sr3cCsTxNtdd�D]>}|jtjd�}|dk	rytj|�Wqtk
rJYqXqWdS)N)�
_deadstate)�_active�_internal_poll�sys�maxsize�remover)Zinst�resrrr�_cleanup�srD���cCs*g}tjj}|dkr&|jdd|�|S)Nr�-�O)r@�flags�optimize�append)�argsrrrr�"_optim_args_from_interpreter_flags�s
rNcCsddddddd�}t�}x:|j�D].\}}ttj|�}|dkr"|jd	||�q"Wtjjrh|jd
�n$tjjrz|jd�tjjr�|jd�xtj	D]}|jd
|�q�Wttdi�}xDdD]<}||kr�||}|dkr�|}nd||f}|j
d|f�q�W|S)N�d�B�S�v�b�q)�debug�dont_write_bytecode�no_site�verbose�
bytes_warning�quietrrHz-Iz-Ez-sz-W�	_xoptions�faulthandler�tracemalloc�showalloccount�showrefcount�utf8Tz%s=%sz-X)r\r]r^r_r`)rN�items�getattrr@rJrL�isolated�ignore_environment�no_user_site�warnoptions�extend)Zflag_opt_maprM�flag�optrRZxoptionsr�argrrr�_args_from_interpreter_flags�s:

rk)rcOsFt||��2}y|j|d�S|j�|j��YnXWdQRXdS)N)r)r �wait�kill)r�	popenargs�kwargs�prrrr#scOs6t||�}|r2|jd�}|dkr(|d}t||��dS)NrMr)r#�getr	)rnro�retcoderrrrr$(s



cOsTd|krtd��d|kr<|ddkr<|jdd�r4dnd|d<t|t|dd	�|��jS)
Nrz3stdout argument not allowed, it will be overridden.�input�universal_newlinesF��T)rr�check)rrqr(r!r)rrnrorrrr';s c@s&eZdZddd�Zdd�Zdd�ZdS)	r*NcCs||_||_||_||_dS)N)rMr
rr
)rrMr
rr
rrrrrszCompletedProcess.__init__cCshdj|j�dj|j�g}|jdk	r4|jdj|j��|jdk	rP|jdj|j��djt|�jdj|��S)Nz	args={!r}zreturncode={!r}zstdout={!r}zstderr={!r}z{}({})z, )	�formatrMr
rrLr
�typer�join)rrMrrrr:xs


zCompletedProcess.__repr__cCs |jrt|j|j|j|j��dS)N)r
r	rMrr
)rrrr�check_returncode�sz!CompletedProcess.check_returncode)NN)rrrrr:r{rrrrr*gs
	F)rsrrwc	Os�|dk	r d|krtd��t|d<t||���}y|j||d�\}}WnVtk
r||j�|j�\}}t|j|||d��Yn|j�|j��YnX|j�}|r�|r�t	||j||d��WdQRXt
|j|||�S)N�stdinz/stdin and input arguments may not both be used.)r)rr
)rr!r �communicaterrmrMrl�pollr	r*)	rsrrwrnroZprocessrr
rrrrrr(�s*
cCs�g}d}x�|D]�}g}|r$|jd�d|kp8d|kp8|}|rH|jd�xj|D]b}|dkrf|j|�qN|dkr�|jdt|�d�g}|jd�qN|r�|j|�g}|j|�qNW|r�|j|�|r|j|�|jd�qWdj|�S)	NF� �	�"�\rFz\"ru)rL�lenrgrz)�seq�resultZ	needquoterjZbs_buf�crrr�list2cmdline�s4






r�cCslyt|ddtd�}d}Wn.tk
rF}z|j}|j}WYdd}~XnX|dd�dkrd|dd�}||fS)NT)�shellrtr
rrE�
���r�)r'r"r	rr
)r�dataZexitcodeZexrrrr%scCst|�dS)NrE)r%)rrrrr&"s
c@s�eZdZdZd>dddddeddddddddffddd�dd�Zd	d
�Zdd�Zd
d�Ze	j
ejfdd�Z
dd�Zdd�Zd?dd�Zdd�Zdd�Zdd�Ze�rdd�Zdd �Zd!d"�Zdejejejfd#d$�Zd@d%d&�Zd'd(�Zd)d*�Zd+d,�Z d-d.�Z!e!Z"n�d/d�Zd0d"�Ze#j$e#j%e#j&e#j'e#j(e#j)fd1d2�Z*de#j+e#j,e-j.fd3d$�Zd4d5�Z/dAd6d&�Zd7d*�Zd8d9�Z0d:d,�Z d;d.�Z!d<d=�Z"dS)Br FrENrT)�encoding�errorscCsrt�tj�|_d|_d|_|dkr(d}t|t�s:td��t	r�|dk	rNt
d��|dk	pd|dk	pd|dk	}|tkr~|rxd}q�d}q�|r�|r�t
d��nF|tkr�d}|r�|r�tj
dt�d}|
dk	r�t
d��|d	kr�t
d
��||_d|_d|_d|_d|_d|_||_||_||_|j|||�\}}}}}}t	�rz|dk�rFtj|j�d	�}|dk�r`tj|j�d	�}|dk�rztj|j�d	�}|�p�|�p�|}d|_y�|dk�r�tj|d|�|_|�r�tj|jd|dk||d�|_|dk�rtj|d
|�|_|�rtj|j||d�|_|dk�r6tj|d
|�|_|�r6tj|j||d�|_|j ||||||
||
||	||||||||�W�nxDt!d|j|j|jf�D]*}y|j"�Wnt#k
�r�YnX�q�W|j�sfg}|t$k�r�|j%|�|t$k�r�|j%|�|t$k�r�|j%|�t&|d��r|j%|j'�xP|D]H}y*t	�r<t|t(��r<|j)�n
t*j"|�Wnt#k
�r^YnX�qW�YnXdS)NFrEzbufsize must be an integerz0preexec_fn is not supported on Windows platformsTzSclose_fds is not supported on Windows platforms if you redirect stdin/stdout/stderrzpass_fds overriding close_fds.z2startupinfo is only supported on Windows platformsrz4creationflags is only supported on Windows platforms�wb)�
write_through�line_bufferingr�r��rb)r�r��_devnullr�r�r�r�r�r�r�)+rD�	threadingZLock�
_waitpid_lock�_input�_communication_started�
isinstancer7�	TypeError�
_mswindowsr�_PLATFORM_DEFAULT_CLOSE_FDS�warnings�warn�RuntimeWarningrMr|rr
�pidr
rtr�r��_get_handles�msvcrtZopen_osfhandler8�_closed_child_pipe_fds�io�open�
TextIOWrapper�_execute_child�filter�close�OSErrorr!rL�hasattrr�r3r6�os)rrM�bufsize�
executabler|rr
�
preexec_fn�	close_fdsr��cwd�envrt�startupinfo�
creationflags�restore_signals�start_new_session�pass_fdsr�r�Z
any_stdio_set�p2cread�p2cwrite�c2pread�c2pwrite�errread�errwriteZ	text_mode�fZto_close�fdrrrr`s�

















zPopen.__init__cCs |j||�}|jdd�jdd�S)Nz
r��
)�decode�replace)rr�r�r�rrr�_translate_newlines�szPopen._translate_newlinescCs|S)Nr)rrrr�	__enter__�szPopen.__enter__c
CsD|jr|jj�|jr |jj�z|jr2|jj�Wd|j�XdS)N)rr�r
r|rl)rryr�	tracebackrrr�__exit__�s

zPopen.__exit__cCsT|js
dS|jdkr(|d|jt|d�|j|d�|jdkrPtdk	rPtj|�dS)Nzsubprocess %s is still running)�source)r=)�_child_createdr
r��ResourceWarningr?r>rL)rZ_maxsizeZ_warnrrrr<
s


z
Popen.__del__cCs"t|d�stjtjtj�|_|jS)Nr�)r�r�r��devnull�O_RDWRr�)rrrr�_get_devnulls
zPopen._get_devnullcCs�|rZy|jj|�WnDtk
r(Yn2tk
rX}z|jtjkrFn�WYdd}~XnXy|jj�WnDtk
r|Yn2tk
r�}z|jtjkr�n�WYdd}~XnXdS)N)r|�write�BrokenPipeErrorr��errnoZEINVALr�)rrs�excrrr�_stdin_writes"zPopen._stdin_writecCs�|jr|rtd��|dkr�|jr�|j|j|jgjd�dkr�d}d}|jrV|j|�n6|jrr|jj�}|jj�n|jr�|jj�}|jj�|j	�nJ|dk	r�t
�|}nd}z|j|||�\}}Wdd|_X|j	|j|�d�}||fS)Nz.Cannot send input after starting communicationrFT)r)
r�rr|rr
�countr��readr�rl�_time�_communicate�_remaining_time)rrsrrr
�endtime�stsrrrr}7s.




zPopen.communicatecCs|j�S)N)r?)rrrrr~hsz
Popen.pollcCs|dkrdS|t�SdS)N)r�)rr�rrrr�nszPopen._remaining_timecCs&|dkrdSt�|kr"t|j|��dS)N)r�rrM)rr��orig_timeoutrrr�_check_timeoutvs
zPopen._check_timeoutcCs�|dkr|dkr|dkrd	Sd\}}d\}}d\}}	|dkrttjtj�}|dkrrtjdd�\}}
t|�}tj|
�nj|tkr�tjdd�\}}t|�t|�}}n>|tkr�tj	|j
��}n&t|t��r�tj	|�}ntj	|j
��}|j|�}|dk�r,tjtj�}|dk�r�tjdd�\}
}t|�}tj|
�nn|tk�rZtjdd�\}}t|�t|�}}n@|tk�rttj	|j
��}n&t|t��r�tj	|�}ntj	|j
��}|j|�}|dk�r�tjtj�}	|	dk�rftjdd�\}
}	t|	�}	tj|
�n~|tk�rtjdd�\}}	t|�t|	�}}	nP|tk�r&|}	n@|tk�r@tj	|j
��}	n&t|t��rXtj	|�}	ntj	|j
��}	|j|	�}	||||||	fS)NrErr�r�r�r�r�r�)r�r�r�r�r�r�r�r�)r�r�r�r�)r�r�r�r�)r�r�)r;ZGetStdHandler-Z
CreatePiper3r5r!r)r�Z
get_osfhandler�r�r7�fileno�_make_inheritabler.r/r")rr|rr
r�r�r�r�r�r��_rrrr��sn











zPopen._get_handlescCs&tjtj�|tj�ddtj�}t|�S)NrrE)r;ZDuplicateHandleZGetCurrentProcessZDUPLICATE_SAME_ACCESSr3)rZhandle�hrrrr��s

zPopen._make_inheritablecCs<t|t�st|�}|dkr t�}d|||fkrP|jtjO_||_||_||_	|
r�|jtj
O_tj|_t
jjdd�}dj||�}z>tj||ddt|�|	||dk	r�t
j|�nd|�	\}}}}Wd|dkr�|j�|d	kr�|j�|d
k�r�|j�t|d��rt
j|j�d|_Xd|_t|�|_||_tj|�dS)NrEZCOMSPECzcmd.exez
{} /c "{}"r�Tr�r�r�r�)r��strr�rrr;r1rrrr2r0rr��environrqrxZ
CreateProcessr7�fspathr6r�r�r�r�r�r3�_handler�r5)rrMr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Zunused_restore_signalsZunused_start_new_sessionZcomspecZhpZhtr��tidrrrr��sF


zPopen._execute_childcCs,|jdkr&||jd�|kr&||j�|_|jS)Nr)r
r�)rr=Z_WaitForSingleObjectZ_WAIT_OBJECT_0Z_GetExitCodeProcessrrrr?s
zPopen._internal_pollcCs�|dk	r"tjdtdd�|j|�}|dkr2tj}nt|d�}|jdkrztj|j	|�}|tj
krlt|j|��tj
|j	�|_|jS)Nz0'endtime' argument is deprecated; use 'timeout'.rF)�
stackleveli�)r�r��DeprecationWarningr�r;ZINFINITEr7r
�WaitForSingleObjectr�ZWAIT_TIMEOUTrrM�GetExitCodeProcess)rrr�Ztimeout_millisr�rrrrl$s 


z
Popen.waitcCs|j|j��|j�dS)N)rLr�r�)rZfh�bufferrrr�
_readerthread:szPopen._readerthreadcCs`|jrDt|d�rDg|_tj|j|j|jfd�|_d|j_|jj�|j	r�t|d�r�g|_
tj|j|j	|j
fd�|_d|j_|jj�|jr�|j
|�|jdk	r�|jj|j|��|jj�r�t|j|��|j	dk	r�|jj|j|��|jj�r�t|j|��d}d}|j�r|j}|jj�|j	�r4|j
}|j	j�|dk	�rF|d}|dk	�rX|d}||fS)N�_stdout_buff)�targetrMT�_stderr_buffr)rr�r�r�ZThreadr�Z
stdout_threadZdaemon�startr
r�Z
stderr_threadr|r�rzr�Zis_aliverrMr�)rrsr�r�rr
rrrr�?sF










zPopen._communicatecCsl|jdk	rdS|tjkr"|j�nF|tjkr>tj|jtj�n*|tjkrZtj|jtj�nt	dj
|���dS)NzUnsupported signal: {})r
r�SIGTERM�	terminateZCTRL_C_EVENTr�rmr�ZCTRL_BREAK_EVENTrrx)r�sigrrr�send_signalss




zPopen.send_signalcCsX|jdk	rdSytj|jd�Wn2tk
rRtj|j�}|tjkrH�||_YnXdS)NrE)r
r;ZTerminateProcessr��PermissionErrorr�ZSTILL_ACTIVE)rZrcrrrr��s

zPopen.terminatec
Cs.d\}}d\}}d
\}}	|dkr"n@|tkr8tj�\}}n*|tkrJ|j�}nt|t�rZ|}n|j�}|dkrln@|tkr�tj�\}}n*|tkr�|j�}nt|t�r�|}n|j�}|dkr�nh|tkr�tj�\}}	nR|tk�r�|dkr�|}	n
t	j
j�}	n.|tk�r|j�}	nt|t��r|}	n|j�}	||||||	fS)NrEr�r�)r�r�r�r�)r�r�r�r�)r�r�r�)r!r��piper)r�r�r7r�r"r@�
__stdout__)
rr|rr
r�r�r�r�r�r�rrrr��sJ






c)"s�t|ttf�r|g}nt|�}|
r:ddg|}�r:�|d<�dkrJ|d��}tj�\}}g}x |dkr~|j|�tj|�}q`Wx|D]}tj|�q�W�z�z�|dk	r�g}xL|j	�D]:\}}tj
|�}d|kr�td��|j|dtj
|��q�Wnd}tj
���tjj
���r�f}nt�fdd�tj|�D��}t|�}|j|�tj|||tttt|���|||||
||||||||�|_d	|_Wdtj|�Xt|d
d�}|dk�r�|dk�r�||k�r�tj|�|dk�r�|
dk�r�||k�r�tj|�|dk�r|dk�r||k�rtj|�|dk	�r.tj|�d	|_t�}x2tj|d�}||7}|�sft|�dk�r<P�q<WWdtj|�X|�r�y6tj|jd�\} }!| |jk�r�|j|!�nt j!|_"Wnt#k
�r�YnXy|j$d
d�\}"}#}$|$j%�}$Wn,tk
�rd}"d}#dj&t|��}$YnXtt'|"j%d�t(�}%t)|%t*��r�|#�r�t|#d�}&|$dk}'|'�rdd}$|}(n|}(|&dk�r�tj+|&�}$|&t,j-k�r�|$dt.|(�7}$|%|&|$|(��|%|$��dS)Nz/bin/shz-crrG�=z!illegal environment variable namec3s"|]}tjjtj|���VqdS)N)r��pathrz�fsencode)�.0�dir)r�rr�	<genexpr>sz'Popen._execute_child.<locals>.<genexpr>Tr�rEiP��:rFsSubprocessError�0z#Bad exception data from child: {!r}�ascii�Znoexecruz: r�r�r�r�r�r�)/r�r��bytes�listr�r�rL�dupr�rar�rr��dirname�tuple�
get_exec_path�set�add�_posixsubprocessZ	fork_exec�sorted�mapr7r�r�rbr��	bytearrayr�r��waitpid�_handle_exitstatusr@rAr
�ChildProcessError�splitr�rx�builtinsr�
issubclassr��strerrorr��ENOENT�repr))rrMr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Zorig_executableZerrpipe_readZ
errpipe_writeZlow_fds_to_closeZlow_fdZenv_list�krRZexecutable_listZfds_to_keepZ
devnull_fdZerrpipe_data�partr�r�Zexception_nameZ	hex_errnoZerr_msgZchild_exception_typeZ	errno_numZchild_exec_never_calledZerr_filenamer)r�rr��s�	
















cCsL||�r||�|_n2||�r*||�|_n||�r@||�|_ntd��dS)NzUnknown child exit status!)r
r)rr�Z_WIFSIGNALEDZ	_WTERMSIGZ
_WIFEXITEDZ_WEXITSTATUSZ_WIFSTOPPEDZ	_WSTOPSIGrrrr
XszPopen._handle_exitstatuscCs�|jdkr�|jjd�sdSz�y8|jdk	r.|jS||j|�\}}||jkrR|j|�WnBtk
r�}z&|dk	rv||_n|j|kr�d|_WYdd}~XnXWd|jj�X|jS)NFr)r
r��acquirer�r
r�r��release)rr=Z_waitpidZ_WNOHANGZ_ECHILDr�r��errrr?js 	



cCs>ytj|j|�\}}Wntk
r4|j}d}YnX||fS)Nr)r�r	r�r)rZ
wait_flagsr�r�rrr�	_try_wait�s
zPopen._try_waitcCsV|jdk	r|jS|dk	r(tjdtdd�|dk	s8|dk	r^|dkrLt�|}n|dkr^|j|�}|dk	r�d}x�|jjd�r�z6|jdk	r�P|jt	j
�\}}||jkr�|j|�PWd|jj
�X|j|�}|dkr�t|j|��t|d|d�}tj|�qlWnVxT|jdk�rN|j�8|jdk	�rP|jd�\}}||jk�rB|j|�WdQRXq�W|jS)Nz0'endtime' argument is deprecated; use 'timeout'.rF)r�g����Mb@?Frg�������?)r
r�r�r�r�r�r�rrr��WNOHANGr�r
rrrM�min�timeZsleep)rrr�Zdelayr�r�Z	remainingrrrrl�sJ





c#Cs|jrZ|jrZy|jj�Wntk
r0YnX|sZy|jj�Wntk
rXYnXd}d}|js�i|_|jr�g|j|j<|jr�g|j|j<|jr�|j|j}|jr�|j|j}|j|�|j	r�t
|j	�}t����}|jr�|r�|j|jt
j�|j�r|j|jt
j�|j�r$|j|jt
j��xJ|j��rp|j|�}|dk	�r\|dk�r\t|j|��|j|�}	|j||�x�|	D]�\}
}|
j|jk�r||j|jt�}y|jtj|
j|�7_Wn,tk
�r�|j|
j�|
jj�Yn*X|jt|j	�k�rf|j|
j�|
jj�nP|
j|j|jfk�rxtj|
jd�}
|
�sT|j|
j�|
jj�|j|
jj|
��qxW�q(WWdQRX|j |j|�d�|dk	�r�dj!|�}|dk	�r�dj!|�}|j"�s�|j#�s�|j$�r|dk	�r�|j%||jj"|jj#�}|dk	�r|j%||jj"|jj#�}||fS)Nri�)rrv)&r|r��flushr�r�Z_fileobj2outputrr
�_save_inputr��
memoryview�_PopenSelector�register�	selectorsZEVENT_WRITEZ
EVENT_READZget_mapr�rrM�selectr�Zfileobj�
_input_offset�	_PIPE_BUFr�r�r�Z
unregisterr�r�rLrlrzr�r�rtr�)rrsr�r�rr
Z
input_viewZselectorrZready�keyZevents�chunkr�rrrr��s�






(







cCsR|jrN|jdkrNd|_||_|dk	rN|js6|js6|jrN|jj|jj|jj�|_dS)Nr)r|r�r"r�r�rt�encode)rrsrrrr/szPopen._save_inputcCs|jdkrtj|j|�dS)N)r
r�rmr�)rr�rrrr�<s
cCs|jtj�dS)N)r�rr�)rrrrr�BscCs|jtj�dS)N)r�r�SIGKILL)rrrrrmGsz
Popen.killr�)NN)NN)NN)1rrrr�r�rr�r�r�r@rAr�r�r<r�r�r}r~r�r�r�r�r�r�r;r�Z
WAIT_OBJECT_0r�r?rlr�r�r�r�rmr��WIFSIGNALED�WTERMSIG�	WIFEXITED�WEXITSTATUS�
WIFSTOPPED�WSTOPSIGr
r	rr�ZECHILDrrrrrrr 2sb,
1H	@
46
"
4a
r�������)=r@�platformr�r�r�rrr
r�r�rr��	Exceptionrr	rr�r�r;rrr!r �ImportErrorZdummy_threadingrbr#r�rrZSelectSelector�__all__r+r,r-r.r/r0r1r2rgr7r3r>rDr!r"r)rNrkr#r$r'�objectr*r(r�r%r&r�r rrrr�<module>,sp
%

(
.,!2I
site.cpython-36.opt-2.pyc000064400000024663150335715140011115 0ustar003

�\dhS�@sddlZddlZddlZddlZejejgadadada	dd�Z
dd�Zdd�Zdd	�Z
d
d�Zd-dd
�Zdd�Zdd�Zdd�Zdd�Zd.dd�Zd/dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zejjs�e�d*d+�Z e!d,k�re �dS)0�NcGsBtjj|�}ytjj|�}Wntk
r0YnX|tjj|�fS)N)�os�path�join�abspath�OSError�normcase)�paths�dir�r
�/usr/lib64/python3.6/site.py�makepathZsrcCs�x�ttjj��D]~}tt|dd�dd�dkr.qytjj|j�|_Wnt	t
tfk
r\YnXytjj|j�|_Wqt	t
tfk
r�YqXqWdS)N�
__loader__�
__module__�_frozen_importlib�_frozen_importlib_external)rr)
�set�sys�modules�values�getattrrrr�__file__�AttributeErrorr�	TypeError�
__cached__)�mr
r
r�	abs_pathscsrcCsTg}t�}x6tjD],}t|�\}}||kr|j|�|j|�qW|tjdd�<|S)N)rrrr�append�add)�L�known_pathsr	�dircaser
r
r�removeduppathsss
r!cCsXt�}xLtjD]B}y&tjj|�r6t|�\}}|j|�Wqtk
rNwYqXqW|S)N)rrrr�existsrrr)�d�item�_�itemcaser
r
r�_init_pathinfo�sr'cCsp|dkrt�}d}nd}tjj||�}yt|d�}Wntk
rHdSX|���xt|�D]�\}}|jd�rrq^yX|jd
�r�t|�w^|j	�}t
||�\}}	|	|kr�tjj|�r�tjj
|�|j|	�Wq^tk
�rRtdj|d|�tjd	�d
dl}
x>|
jtj��D],}x$|j�D]}td|tjd	��qW�qWtdtjd	�PYq^Xq^WWdQRX|�rld}|S)NTF�r�#�import �import	z"Error processing line {:d} of {}:
�)�filerz  z
Remainder of file ignored)r*r+)r'rrr�openr�	enumerate�
startswith�exec�rstriprr"rrr�	Exception�print�format�stderr�	traceback�format_exception�exc_info�
splitlines)�sitedir�namer�reset�fullname�f�n�liner	r r7�recordr
r
r�
addpackage�sD


rCc
Cs�|dkrt�}d}nd}t|�\}}||krBtjj|�|j|�ytj|�}Wntk
rddSXdd�|D�}xt	|�D]}t
|||�q~W|r�d}|S)NTFcSsg|]}|jd�r|�qS)z.pth)�endswith)�.0r<r
r
r�
<listcomp>�szaddsitedir.<locals>.<listcomp>)r'rrrrrr�listdirr�sortedrC)r;rr=�sitedircase�namesr<r
r
r�
addsitedir�s$
rKcCs`tjjrdSttd�r4ttd�r4tj�tj�kr4dSttd�r\ttd�r\tj�tj�kr\dSdS)NF�getuid�geteuid�getgid�getegidT)	r�flags�no_user_site�hasattrrrMrLrOrNr
r
r
r�check_enableusersite�s
rScCs$tdk	rtSddlm}|d�atS)Nr)�get_config_var�userbase)�	USER_BASE�	sysconfigrT)rTr
r
r�getuserbase�s
rXcCs^t�}tdk	rtSddlm}tjdkrJddlm}|d�rJ|dd�atS|ddtj�atS)	Nr)�get_path�darwin)rT�PYTHONFRAMEWORK�purelib�osx_framework_userz%s_user)	rX�	USER_SITErWrYr�platformrTrr<)�	user_baserYrTr
r
r�getusersitepackages�s

racCs$t�}tr tjj|�r t||�|S)N)ra�ENABLE_USER_SITErr�isdirrK)r�	user_siter
r
r�addusersitepackagess
rec	Csg}t�}|dkrt}�x�|D]�}|s||kr2q|j|�tjdkr�|jtjj|ddtj	dd�d��|jtjj|ddtj
dd�d��n6|j|�|jtjj|dd��|jtjj|dd��tjd	krd
dlm
}|d�}|r|jtjjd
|dtj
dd�d��qW|S)N�/�lib64�python�z
site-packages�libzpython%d.%d�rZr)rTr[z/Libraryz%d.%d)r�PREFIXESrr�seprrrr�version�version_infor_rWrT)�prefixes�sitepackages�seen�prefixrT�	frameworkr
r
r�getsitepackages s4





rucCsFtrdtjkrtjdd�x&t|�D]}tjj|�r$t||�q$W|S)N�RPM_BUILD_ROOTrz
/usr/local)	rbr�environrl�insertrurrcrK)rrpr;r
r
r�addsitepackagesHsrycCs4tjdkrd}nd}tjd|�t_tjd|�t_dS)N�\zCtrl-Z plus ReturnzCtrl-D (i.e. EOF)�quit�exit)rrm�
_sitebuiltins�Quitter�builtinsr{r|)�eofr
r
r�setquitWs

r�cCs�tjdtj�t_tjdd�dkr2tjdd�t_ntjdd�t_gg}}ttd�r�tj	j
tj�}|jdd	g�|jtj	j
|tj�|tjg�tjd
d||�t_dS)N�	copyright��java�creditsz?Jython is maintained by the Jython developers (www.jython.org).z�    Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
    for supporting Python development.  See www.python.org for more information.rzLICENSE.txt�LICENSE�licensez'See https://www.python.org/psf/license/)r}�_Printerrr�rr_r�rRrr�dirnamer�extendr�pardir�curdirr�)�files�dirs�herer
r
r�setcopyrightgs 


r�cCstj�t_dS)N)r}�_Helperr�helpr
r
r
r�	sethelpersr�cCsdd�}|t_dS)Ncs�ddl}yddl�ddl}Wntk
r0dSXt�dd�}|dk	rZd|krZ�jd�n
�jd�y�j�Wntk
r�YnX�j�dkr�t	j
jt	j
jd�d��y�j
��Wntk
r�YnX��fd	d
�}|j|�dS)Nr�__doc__��libeditzbind ^I rl_completez
tab: complete�~z.python_historycs,y�j��Wnttfk
r&YnXdS)N)�write_history_file�FileNotFoundError�PermissionErrorr
)�history�readliner
r�
write_history�szCenablerlcompleter.<locals>.register_readline.<locals>.write_history)�atexitr��rlcompleter�ImportErrorr�parse_and_bind�read_init_filer�get_current_history_lengthrrr�
expanduser�read_history_file�IOError�register)r�r��readline_docr�r
)r�r�r�register_readline�s.
z,enablerlcompleter.<locals>.register_readline)r�__interactivehook__)r�r
r
r�enablerlcompleter�s	0r�cCsFtj}tjdkr$d|kr$tjd}ntj}tjjtjj|��\}}tjj|�}dt_	d}dd�tjj
||�tjj
||�fD�}|�rB|d}d}	t|dd	��`}
xX|
D]P}d
|kr�|jd
�\}}}
|j
�j�}|
j
�}
|dkr�|
j�}	q�|dkr�|
t_	q�WWdQRX|t_t_t|tjg�|	dk�r6tjdtj�ntjgad
a|S)NrZ�__PYVENV_LAUNCHER__z
pyvenv.cfgcSsg|]}tjj|�r|�qSr
)rr�isfile)rE�conffiler
r
rrF�szvenv.<locals>.<listcomp>r�truezutf-8)�encoding�=zinclude-system-site-packages�homeF)rrwrr_�
executabler�splitrr��_homerr.�	partition�strip�lowerrs�exec_prefixryrlrxrb)r�envr��exe_dirr%�site_prefix�
conf_basename�candidate_confs�virtual_conf�system_siter?rA�key�valuer
r
r�venv�s>


r�cCs�yByddl}Wn0tk
r>}z|jdkr,n�WYdd}~XnXWnRtk
r�}z6tjjrltjtj��ntj	j
d|jj|f�WYdd}~XnXdS)Nr�
sitecustomizez@Error in sitecustomize; set PYTHONVERBOSE for traceback:
%s: %s
)
r�r�r<r3rrP�verbose�
excepthookr9r6�write�	__class__�__name__)r��exc�errr
r
r�execsitecustomize�s
r�cCs�yByddl}Wn0tk
r>}z|jdkr,n�WYdd}~XnXWnRtk
r�}z6tjjrltjtj��ntj	j
d|jj|f�WYdd}~XnXdS)Nr�
usercustomizez@Error in usercustomize; set PYTHONVERBOSE for traceback:
%s: %s
)
r�r�r<r3rrPr�r�r9r6r�r�r�)r�r�r�r
r
r�execusercustomizes
r�cCsft�t�}t|�}tdkr"t�at|�}t|�}t�t�t	�t
jjsRt
�t�trbt�dS)N)rr!r�rbrSreryr�r�r�rrP�isolatedr�r�r�)rr
r
r�mainsr�cCs`d}tjdd�}|s�t�}t�}td�xtjD]}td|f�q2Wtd�td|tjj|�rfdndf�td	|tjj|�r�dndf�td
t�tj	d�g}d|kr�|j
t�d
|kr�|j
t�|�r,ttj
j|��tr�tj	d�n6tdk�r
tj	d�n tdk�r tj	d�n
tj	d�n0ddl}t|j|tjdtj
f��tj	d�dS)Na�    %s [--user-base] [--user-site]

    Without arguments print some useful information
    With arguments print the value of USER_BASE and/or USER_SITE separated
    by '%s'.

    Exit codes with --user-base or --user-site:
      0 - user site directory is enabled
      1 - user site directory is disabled by user
      2 - uses site directory is disabled by super user
          or for security reasons
     >2 - unknown error
    r,zsys.path = [z    %r,�]zUSER_BASE: %r (%s)r"z
doesn't existzUSER_SITE: %r (%s)zENABLE_USER_SITE: %rrz--user-basez--user-siteFrkri�
)r�argvrXrar4rrrcrbr|rrVr^�pathsepr�textwrap�dedent)r��argsr`rdr	�bufferr�r
r
r�_script6s@




r��__main__)N)N)N)"rrrr}rsr�rlrbr^rVrrr!r'rCrKrSrXrareruryr�r�r�r�r�r�r�r�rP�no_siter�r�r
r
r
r�<module>Hs@	
*

(
;43
heapq.cpython-36.opt-1.pyc000064400000033726150335715140011246 0ustar003


 \�Y�#@sZdZdZdddddddd	gZd
d�Zdd�Zdd�Zd
d	�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zddd�d d�Zd)d!d�Zd*d"d�Zyd#d$lTWnek
r�YnXyd#d%lm	Z	Wnek
r�YnXyd#d&lm
Z
Wnek
�rYnXyd#d'lmZWnek
�r6YnXed(k�rVd#dlZeej��dS)+a�Heap queue algorithm (a.k.a. priority queue).

Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0.  For the sake of comparison,
non-existing elements are considered to be infinite.  The interesting
property of a heap is that a[0] is always its smallest element.

Usage:

heap = []            # creates an empty heap
heappush(heap, item) # pushes a new item on the heap
item = heappop(heap) # pops the smallest item from the heap
item = heap[0]       # smallest item on the heap without popping it
heapify(x)           # transforms list into a heap, in-place, in linear time
item = heapreplace(heap, item) # pops and returns smallest item, and adds
                               # new item; the heap size is unchanged

Our API differs from textbook heap algorithms as follows:

- We use 0-based indexing.  This makes the relationship between the
  index for a node and the indexes for its children slightly less
  obvious, but is more suitable since Python uses 0-based indexing.

- Our heappop() method returns the smallest item, not the largest.

These two make it possible to view the heap as a regular Python list
without surprises: heap[0] is the smallest item, and heap.sort()
maintains the heap invariant!
uoHeap queues

[explanation by François Pinard]

Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0.  For the sake of comparison,
non-existing elements are considered to be infinite.  The interesting
property of a heap is that a[0] is always its smallest element.

The strange invariant above is meant to be an efficient memory
representation for a tournament.  The numbers below are `k', not a[k]:

                                   0

                  1                                 2

          3               4                5               6

      7       8       9       10      11      12      13      14

    15 16   17 18   19 20   21 22   23 24   25 26   27 28   29 30


In the tree above, each cell `k' is topping `2*k+1' and `2*k+2'.  In
a usual binary tournament we see in sports, each cell is the winner
over the two cells it tops, and we can trace the winner down the tree
to see all opponents s/he had.  However, in many computer applications
of such tournaments, we do not need to trace the history of a winner.
To be more memory efficient, when a winner is promoted, we try to
replace it by something else at a lower level, and the rule becomes
that a cell and the two cells it tops contain three different items,
but the top cell "wins" over the two topped cells.

If this heap invariant is protected at all time, index 0 is clearly
the overall winner.  The simplest algorithmic way to remove it and
find the "next" winner is to move some loser (let's say cell 30 in the
diagram above) into the 0 position, and then percolate this new 0 down
the tree, exchanging values, until the invariant is re-established.
This is clearly logarithmic on the total number of items in the tree.
By iterating over all items, you get an O(n ln n) sort.

A nice feature of this sort is that you can efficiently insert new
items while the sort is going on, provided that the inserted items are
not "better" than the last 0'th element you extracted.  This is
especially useful in simulation contexts, where the tree holds all
incoming events, and the "win" condition means the smallest scheduled
time.  When an event schedule other events for execution, they are
scheduled into the future, so they can easily go into the heap.  So, a
heap is a good structure for implementing schedulers (this is what I
used for my MIDI sequencer :-).

Various structures for implementing schedulers have been extensively
studied, and heaps are good for this, as they are reasonably speedy,
the speed is almost constant, and the worst case is not much different
than the average case.  However, there are other representations which
are more efficient overall, yet the worst cases might be terrible.

Heaps are also very useful in big disk sorts.  You most probably all
know that a big sort implies producing "runs" (which are pre-sorted
sequences, which size is usually related to the amount of CPU memory),
followed by a merging passes for these runs, which merging is often
very cleverly organised[1].  It is very important that the initial
sort produces the longest runs possible.  Tournaments are a good way
to that.  If, using all the memory available to hold a tournament, you
replace and percolate items that happen to fit the current run, you'll
produce runs which are twice the size of the memory for random input,
and much better for input fuzzily ordered.

Moreover, if you output the 0'th item on disk and get an input which
may not fit in the current tournament (because the value "wins" over
the last output value), it cannot fit in the heap, so the size of the
heap decreases.  The freed memory could be cleverly reused immediately
for progressively building a second heap, which grows at exactly the
same rate the first heap is melting.  When the first heap completely
vanishes, you switch heaps and start a new run.  Clever and quite
effective!

In a word, heaps are useful memory structures to know.  I use them in
a few applications, and I think it is good to keep a `heap' module
around. :-)

--------------------
[1] The disk balancing algorithms which are current, nowadays, are
more annoying than clever, and this is a consequence of the seeking
capabilities of the disks.  On devices which cannot seek, like big
tape drives, the story was quite different, and one had to be very
clever to ensure (far in advance) that each tape movement will be the
most effective possible (that is, will best participate at
"progressing" the merge).  Some tapes were even able to read
backwards, and this was also used to avoid the rewinding time.
Believe me, real good tape sorts were quite spectacular to watch!
From all times, sorting has always been a Great Art! :-)
�heappush�heappop�heapify�heapreplace�merge�nlargest�	nsmallest�heappushpopcCs"|j|�t|dt|�d�dS)z4Push item onto heap, maintaining the heap invariant.��N)�append�	_siftdown�len)�heap�item�r�/usr/lib64/python3.6/heapq.pyr�s
cCs.|j�}|r*|d}||d<t|d�|S|S)zCPop the smallest item off the heap, maintaining the heap invariant.r	)�pop�_siftup)r�lastelt�
returnitemrrrr�s
cCs|d}||d<t|d�|S)a�Pop and return the current smallest value, and add the new item.

    This is more efficient than heappop() followed by heappush(), and can be
    more appropriate when using a fixed-size heap.  Note that the value
    returned may be larger than item!  That constrains reasonable uses of
    this routine unless written as part of a conditional replacement:

        if item > heap[0]:
            item = heapreplace(heap, item)
    r	)r)rrrrrrr�s
cCs0|r,|d|kr,|d|}|d<t|d�|S)z1Fast version of a heappush followed by a heappop.r	)r)rrrrrr�s
cCs0t|�}x"tt|d��D]}t||�qWdS)z8Transform list into a heap, in-place, in O(len(x)) time.�N)r
�reversed�ranger)�x�n�irrrr�scCs.|j�}|r*|d}||d<t|d�|S|S)zMaxheap version of a heappop.r	)r�_siftup_max)rrrrrr�_heappop_max�s
rcCs|d}||d<t|d�|S)z4Maxheap version of a heappop followed by a heappush.r	)r)rrrrrr�_heapreplace_max�s
rcCs0t|�}x"tt|d��D]}t||�qWdS)z;Transform list into a maxheap, in-place, in O(len(x)) time.rN)r
rrr)rrrrrr�_heapify_max�srcCsN||}x8||kr@|dd?}||}||kr<|||<|}q
Pq
W|||<dS)Nr
r)r�startpos�pos�newitem�	parentpos�parentrrrr�s
rcCs�t|�}|}||}d|d}xN||krn|d}||krP||||krP|}||||<|}d|d}q"W|||<t|||�dS)Nrr
)r
r)rr!�endposr r"�childpos�rightposrrrrs
rcCsN||}x8||kr@|dd?}||}||kr<|||<|}q
Pq
W|||<dS)zMaxheap variant of _siftdownr
Nr)rr r!r"r#r$rrr�
_siftdown_maxs
r(cCs�t|�}|}||}d|d}xN||krn|d}||krP||||krP|}||||<|}d|d}q"W|||<t|||�dS)zMaxheap variant of _siftuprr
N)r
r()rr!r%r r"r&r'rrrr%s
rNF)�key�reversecgs4g}|j}|r t}t}t}d}nt}t}t}d}|dk�r"xNttt	|��D]<\}	}
y|
j
}||�|	||g�WqJtk
r�YqJXqJW||�xdt|�dkr�y6x0|d\}}	}}
|V|�|
d<|||
�q�WWq�tk
r�||�Yq�Xq�W|�r|d\}}	}|V|j
EdHdSx\ttt	|��D]J\}	}
y(|
j
}|�}|||�|	|||g�Wntk
�rxYnX�q2W||�x~t|�dk�ryJxD|d\}}	}}}
|V|�}||�|
d<||
d<|||
��q�WWntk
�r||�YnX�q�W|�r0|d\}}	}}|V|j
EdHdS)akMerge multiple sorted inputs into a single sorted output.

    Similar to sorted(itertools.chain(*iterables)) but returns a generator,
    does not pull the data into memory all at once, and assumes that each of
    the input streams is already sorted (smallest to largest).

    >>> list(merge([1,3,5,7], [0,2,4,8], [5,10,15,20], [], [25]))
    [0, 1, 2, 3, 4, 5, 5, 7, 8, 10, 15, 20, 25]

    If *key* is not None, applies a key function to each element to determine
    its sort order.

    >>> list(merge(['dog', 'horse'], ['cat', 'fish', 'kangaroo'], key=len))
    ['dog', 'cat', 'fish', 'horse', 'kangaroo']

    r
Nr	r���)rrrrrrr�	enumerate�map�iter�__next__�
StopIterationr
�__self__)r)r*�	iterables�h�h_append�_heapify�_heappop�_heapreplace�	direction�order�it�next�value�s�	key_valuerrrr:sp


cs�|dkrLt|�}t�}�dkr,t||d�}nt||�d�}||krFgS|gSyt|�}Wnttfk
rpYnX||kr�t|�d�d|�S�dk�r*t|�}dd�tt|�|�D�}|s�|St	|�|dd}|}t
}	x6|D].}
|
|kr�|	||
|f�|dd}|d7}q�W|j�d	d�|D�St|�}�fd
d�tt|�|�D�}|�sX|St	|�|dd}|}t
}	xD|D]<}
�|
�}||k�rz|	||||
f�|dd}|d7}�qzW|j�dd�|D�S)zbFind the n smallest elements in a dataset.

    Equivalent to:  sorted(iterable, key=key)[:n]
    r
N)�default)r?r))r)cSsg|]\}}||f�qSrr)�.0r�elemrrr�
<listcomp>�sznsmallest.<locals>.<listcomp>r	cSsg|]}|d�qS)r	r)r@�rrrrrB�scsg|]\}}�|�||f�qSrr)r@rrA)r)rrrB�scSsg|]}|d�qS)rr)r@rCrrrrB
s)r.�object�minr
�	TypeError�AttributeError�sorted�ziprrr�sort)r�iterabler)r:�sentinel�result�size�topr9r7rA�kr)r)rr�sZ



cs�|dkrLt|�}t�}�dkr,t||d�}nt||�d�}||krFgS|gSyt|�}Wnttfk
rpYn X||kr�t|�dd�d|�S�dk�r8t|�}dd�ttd	|d�|�D�}|s�|St	|�|d	d	}|}t
}	x6|D].}
||
kr�|	||
|f�|d	d	}|d8}q�W|jdd
�dd�|D�St|�}�fdd�ttd	|d�|�D�}|�sl|St	|�|d	d	}|}t
}	xD|D]<}
�|
�}||k�r�|	||||
f�|d	d	}|d8}�q�W|jdd
�d
d�|D�S)zoFind the n largest elements in a dataset.

    Equivalent to:  sorted(iterable, key=key, reverse=True)[:n]
    r
N)r?)r?r)T)r)r*cSsg|]\}}||f�qSrr)r@rrArrrrB(sznlargest.<locals>.<listcomp>r	)r*cSsg|]}|d�qS)r	r)r@rCrrrrB5scsg|]\}}�|�||f�qSrr)r@rrA)r)rrrB9scSsg|]}|d�qS)rr)r@rCrrrrBGsr+r+)r.rD�maxr
rFrGrHrIrrrrJ)rrKr)r:rLrMrNrOr9r7rArPr)r)rrsZ

"

r	)�*)r)r)r�__main__)N)N)�__doc__�	__about__�__all__rrrrrrrrrrr(rrrr�_heapq�ImportError�__name__Zdoctest�printZtestmodrrrr�<module>sL`



	5
?
>
ntpath.cpython-36.opt-1.pyc000064400000032670150335715140011443 0ustar003


 \6Z�'@s>dZdZdZdZdZdZdZdZdZdd	l	Z	dd	l
Z
dd	lZdd	lZdd
lTddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1g'Z
d2d3�Zd4d�Zd5d�Zd6d
�Zd7d�Zd8d"�Zd9d�Zd:d�Zejje_d;d�Zd<d�Zd=d�Zd>d�Zydd?lmZWnek
�r2d	ZYnXd@d�ZdAd�ZdBd�Z dCd �Z!dDdE�Z"yddFlm#Z#Wnek
�r�e"Z$Yn
XdGd!�Z$e$Z%e&e
dH��o�e
j'�dIdJkZ(dRdKd-�Z)dLd1�Z*y,e
j'�d	dJ�dSk�r�ddNlm+Z+ne�Wn"e,efk
�rdOdP�Z+YnXyddQlm-Z.Wnek
�r8YnXd	S)Tz�Common pathname manipulations, WindowsNT/95 version.

Instead of importing this module directly, import os and refer to this
module as os.path.
�.z..�\�;�/z.;C:\binZnul�N)�*�normcase�isabs�join�
splitdrive�split�splitext�basename�dirname�commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�ismount�
expanduser�
expandvars�normpath�abspath�splitunc�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenames�relpath�samefile�sameopenfile�samestat�
commonpathcCst|t�rdSdSdS)Ns\/z\/)�
isinstance�bytes)�path�r1�/usr/lib64/python3.6/ntpath.py�
_get_bothseps"s
r3cCsxtj|�}y.t|t�r&|jdd�j�S|jdd�j�SWn:ttfk
rrt|ttf�sltd|j	j
�d��YnXdS)zaNormalize case of pathname.

    Makes all characters lowercase and all slashes into backslashes.�/�\rrz0normcase() argument must be str or bytes, not %rN)�os�fspathr.r/�replace�lower�	TypeError�AttributeError�str�	__class__�__name__)�sr1r1r2r,s

cCs2tj|�}t|�d}t|�dko0|dt|�kS)zTest whether a path is absolute�r)r6r7r
�lenr3)r?r1r1r2rCs
c

GsVtj|�}t|t�r"d}d}d}nd}d}d}y�|sD|dd�|t|�\}}x�ttj|�D]�}t|�\}}	|	r�|	d|kr�|s�|r�|}|	}q^n*|r�||kr�|j�|j�kr�|}|	}q^|}|r�|d
|kr�||}||	}q^W|�r|d|k�r|�r|dd�|k�r|||S||Sttt	fk
�rPt
jd	|f|���YnXdS)Nr5s\/�:rz\/�:rr@r	���rD)r6r7r.r/r
�mapr9r:r;�BytesWarning�genericpath�_check_arg_types)
r0�pathsr!�seps�colonZresult_driveZresult_path�pZp_driveZp_pathr1r1r2r	KsF


cCstj|�}t|�dk�rt|t�r0d}d}d}nd}d}d}|j||�}|dd�|dkr�|dd	�|kr�|j|d�}|dkr�|dd�|fS|j||d
�}||d
kr�|dd�|fS|d
kr�t|�}|d|�||d�fS|d
d�|k�r|dd�|dd�fS|dd�|fS)a�Split a pathname into drive/UNC sharepoint and relative path specifiers.
    Returns a 2-tuple (drive_or_unc, path); either part may be empty.

    If you assign
        result = splitdrive(p)
    It is always true that:
        result[0] + result[1] == p

    If the path contained a drive letter, drive_or_unc will contain everything
    up to and including the colon.  e.g. splitdrive("c:/dir") returns ("c:", "/dir")

    If the path contained a UNC path, the drive_or_unc will contain the host name
    and share up to but not including the fourth directory separator character.
    e.g. splitdrive("//host/computer/dir") returns ("//host/computer", "/dir")

    Paths cannot contain both a drive letter and a UNC path.

    �r5r4rBrrrCr�r@NrDrD)r6r7rAr.r/r8�find)rLr!r$rKZnormp�indexZindex2r1r1r2r
zs.

$cCsFddl}|jdtd�t|�\}}t|�dkr>|dd�|fS||fS)a�Deprecated since Python 3.1.  Please use splitdrive() instead;
    it now handles UNC paths.

    Split a pathname into UNC mount point and relative path specifiers.

    Return a 2-tuple (unc, rest); either part may be empty.
    If unc is not empty, it has the form '//host/mount' (or similar
    using backslashes).  unc+rest is always the input path.
    Paths containing drive letters never have a UNC part.
    rNz<ntpath.splitunc is deprecated, use ntpath.splitdrive insteadrM)�warnings�warn�DeprecationWarningr
rA)rLrQ�driver0r1r1r2r�scCs|tj|�}t|�}t|�\}}t|�}x |rF||d|krF|d8}q(W|d|�||d�}}|j|�pn|}|||fS)z~Split a pathname.

    Return tuple (head, tail) where tail is everything after the final slash.
    Either part may be empty.r@N)r6r7r3r
rA�rstrip)rLrJ�d�i�head�tailr1r1r2r�s
cCs8tj|�}t|t�r$tj|ddd�Stj|ddd�SdS)Nr5r4�.rrr)r6r7r.r/rG�	_splitext)rLr1r1r2r�s

cCst|�dS)z)Returns the final component of a pathnamer@)r)rLr1r1r2r
�scCst|�dS)z-Returns the directory component of a pathnamer)r)rLr1r1r2r�scCs4ytj|�}Wnttfk
r&dSXtj|j�S)zhTest whether a path is a symbolic link.
    This will always return false for Windows prior to 6.0.
    F)r6�lstat�OSErrorr;�stat�S_ISLNK�st_mode)r0�str1r1r2r�s
cCs(ytj|�}Wntk
r"dSXdS)zCTest whether a path exists.  Returns True for broken symbolic linksFT)r6r\r])r0rar1r1r2rs
)�_getvolumepathnamecCsttj|�}t|�}t|�}t|�\}}|rD|d|krD|pB||kS||krPdStrl|j|�t|�j|�kSdSdS)zaTest whether a path is a mount point (a drive root, the root of a
    share, or a mounted volume)rTFN)r6r7r3rr
rbrU)r0rJ�root�restr1r1r2rs
c
Cstj|�}t|t�rd}nd}|j|�s,|Sdt|�}}x$||kr^||t|�kr^|d7}q<Wdtjkrvtjd}n\dtjkr�tjd}nFdtjkr�|Sytjd}Wntk
r�d}YnXt	|tjd�}t|t�r�tj
|�}|dk�rt	t|�|d|��}|||d	�S)
zLExpand ~ and ~user constructs.

    If user or $HOME is unknown, do nothing.�~�~r@�HOMEZUSERPROFILEZHOMEPATHZ	HOMEDRIVE�N)r6r7r.r/�
startswithrAr3�environ�KeyErrorr	�fsencoder)r0�tilderW�n�userhomerTr1r1r2r5s2









cCs<tj|�}t|t�rhd|kr(d|kr(|Sddl}t|j|jdd�}d}d}d}d	}d}ttd
d�}nFd|kr|d|kr||Sddl}|j|jd}d
}d}d}d}d}tj}|dd�}	d}
t	|�}�xn|
|k�r6||
|
d�}||k�r\||
dd�}t	|�}y&|j
|�}
|	||d|
d�7}	Wn*tk
�rV|	||7}	|d}
YnX�n�||k�rN||
d|
d�|k�r�|	|7}	|
d7}
n�||
dd�}t	|�}y|j
|�}
Wn*tk
�r�|	||7}	|d}
YnhX|d|
�}
y.|dk�rtjtjtj
|
��}n||
}Wn"tk
�r@||
|}YnX|	|7}	�n�||k�r$||
d|
d�|k�r�|	|7}	|
d7}
�q,||
d|
d�|k�rb||
dd�}t	|�}y|j
|�}
Wn.tk
�r�|	|||7}	|d}
YnlX|d|
�}
y.|dk�r&tjtjtj
|
��}n||
}Wn&tk
�rV|||
|}YnX|	|7}	n�|dd�}
|
d7}
||
|
d�}x6|�r�||k�r�|
|7}
|
d7}
||
|
d�}�q�Wy.|dk�r�tjtjtj
|
��}n||
}Wntk
�r
||
}YnX|	|7}	|�r,|
d8}
n|	|7}	|
d7}
q�W|	S)zfExpand shell variables of the forms $var, ${var} and %var%.

    Unknown variables are left unchanged.�$�%rNz_-�ascii�'�{�}�environb�$�%�'�{�}r@rM)r6r7r.r/�stringZ
ascii_lettersZdigits�getattrrjrArP�
ValueErrorrl�fsdecoderk)r0r|ZvarcharsZquoteZpercentZbraceZrbraceZdollarrj�resrPZpathlen�c�var�valuer1r1r2rgs�











c	Cs\tj|�}t|t�r*d}d}d}d}d}nd}d}d	}d
}d}|j|�rL|S|j||�}t|�\}}|j|�r�||7}|j|�}|j|�}d
}x�|t	|�k�r2||s�|||kr�||=q�|||k�r(|d
ko�||d|k�r||d|d�=|d8}n&|d
k�r|j
|��r||=n|d7}q�|d7}q�W|�rN|�rN|j|�||j|�S)z0Normalize path, eliminating double slashes, etc.r5r4rZs..�\\.\�\\?\rrrz..�\\.\�\\?\rr@)r�r�)r�r�)
r6r7r.r/rir8r
�lstriprrA�endswith�appendr	)	r0r!r$rr Zspecial_prefixes�prefix�compsrWr1r1r2r�sF








cCs@tj|�}t|�s8t|t�r&tj�}ntj�}t||�}t|�S)z�Return the absolute version of a path as a fallback function in case
    `nt._getfullpathname` is not available or raises OSError. See bpo-31047 for
    more.

    )	r6r7rr.r/�getcwdb�getcwdr	r)r0�cwdr1r1r2�_abspath_fallback	s



r�)�_getfullpathnamecCs.ytt|��Sttfk
r(t|�SXdS)z&Return the absolute version of a path.N)rr�r]r~r�)r0r1r1r2r!s�getwindowsversionrNrMcCsdtj|�}t|t�r"d}d}d}nd}d}d}|dkr:|}|sFtd��tj|�}y�tt|��}tt|��}t|�\}}t|�\}	}
t|�t|	�kr�td	|	|f��d
d�|j	|�D�}dd�|
j	|�D�}d
}
x0t
||�D]"\}}t|�t|�kr�P|
d7}
q�W|gt|�|
||
d�}|�s(|St|�St
ttttfk
�r^tjd||��YnXdS)z#Return a relative version of a pathr5rZs..rrz..Nzno path specifiedz&path is on mount %r, start on mount %rcSsg|]}|r|�qSr1r1)�.0�xr1r1r2�
<listcomp>Jszrelpath.<locals>.<listcomp>cSsg|]}|r|�qSr1r1)r�r�r1r1r2r�Ksrr@r))r6r7r.r/r~rrr
rr�ziprAr	r:r;rFrSrGrH)r0�startr!rr Z	start_absZpath_absZstart_driveZ
start_restZ
path_driveZ	path_rest�
start_list�	path_listrWZe1Ze2�rel_listr1r1r2r).sF


cs�|std��tttj|��}t|dt�r8d�d�d�nd�d�d��y>��fd	d
�|D�}�fdd
�|D�}yt�fdd
�|D��\}Wntk
r�td�d�YnXttdd
�|D���dkr�td��t	|dj
����\}}|j��}�fdd
�|D�}�fdd
�|D�}t|�}t
|�}xBt|�D]&\}	}
|
||	k�r,|d|	�}P�q,W|dt|��}|�rt|�n|}|�j|�Sttfk
�r�tjd|���YnXdS)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr5r4rZrrrcs g|]}t|j���j���qSr1)r
r8r9)r�rL)r$r!r1r2r�wszcommonpath.<locals>.<listcomp>csg|]\}}|j���qSr1)r)r�rVrL)r!r1r2r�xsc3s"|]\}}|dd��kVqdS)Nr@r1)r�rVrL)r!r1r2�	<genexpr>{szcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathsNcss|]\}}|VqdS)Nr1)r�rVrLr1r1r2r��sr@zPaths don't have the same drivecsg|]}|r|�kr|�qSr1r1)r�r�)rr1r2r��scsg|]}�fdd�|D��qS)csg|]}|r|�kr|�qSr1r1)r�r�)rr1r2r��sz)commonpath.<locals>.<listcomp>.<listcomp>r1)r�r?)rr1r2r��sr-)r-)r~�tuplerEr6r7r.r/�setrAr
r8r�min�max�	enumerater	r:r;rGrH)rIZdrivesplits�split_pathsrrTr0�common�s1�s2rWr�r�r1)r$rr!r2r-fsF
�)�_getfinalpathnamecCstt|��S)N)rr)�fr1r1r2r��sr�)�_isdir)N)r�r)/�__doc__rr r%r!r"r$r#r&r6�sysr^rG�__all__r3rrr	r
rrrr[r
rrr�ntrb�ImportErrorrrrrr�r�rr'�hasattrr�r(r)r-r�r;r�rr1r1r1r2�<module>s|



/4

2q1

85netrc.cpython-36.pyc000064400000007376150335715140010326 0ustar003


 \4�@sXdZddlZddlZddlZddgZGdd�de�ZGdd�d�ZedkrTe	e��dS)z-An object-oriented interface to .netrc files.�N�netrc�NetrcParseErrorc@s"eZdZdZddd�Zdd�ZdS)rz5Exception raised on syntax errors in the .netrc file.NcCs"||_||_||_tj||�dS)N)�filename�lineno�msg�	Exception�__init__)�selfrrr�r
�/usr/lib64/python3.6/netrc.pyrszNetrcParseError.__init__cCsd|j|j|jfS)Nz%s (%s, line %s))rrr)r	r
r
r�__str__szNetrcParseError.__str__)NN)�__name__�
__module__�__qualname__�__doc__rrr
r
r
rr
s
c@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)rNcCsx|dk}|dkrFytjjtjdd�}Wntk
rDtd��YnXi|_i|_t|��}|j	|||�WdQRXdS)N�HOMEz.netrcz'Could not find .netrc: $HOME is not set)
�os�path�join�environ�KeyError�OSError�hosts�macros�open�_parse)r	�file�
default_netrc�fpr
r
rrs
znetrc.__init__cCs�tj|�}|jd7_|jjdd�|_�x�|j}|j�}}|sFPn�|ddkrv|j|kr,t|�dkr,|jj�q,n�|dkr�|j�}nz|dkr�d}nl|dkr�|j�}g|j	|<d	|_
x4|jj�}	|	s�|	d
kr�d|_
P|j	|j|	�q�Wq,ntd|||j��d}
d}}i|j
|<�x�|j�}|jd��s:|dk�r~|�r^|
||f|j
|<|j|�Pntd
||t|�f||j���q|dk�s�|dk�r�|j�}
�q|dk�r�|j�}�q|dk�r�tjdk�r�|�r�tj|j��}
|
jtj�k�r|ddl}y|j|
j�d}Wn tk
�r*d|
j}YnXy|jtj��d}Wn"tk
�rddtj�}YnXtd||f||j��|
jtjtjB@�r�td||j��|j�}ntd|||j���qWq,WdS)Nz !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~�#�r��machine�default�macdefz 	�
z 	
zbad toplevel token %rz&malformed %s entry %s terminated by %s�login�user�account�password�posixzuid %sz9~/.netrc file owner (%s) does not match current user (%s)zY~/.netrc access too permissive: access permissions must restrict access to only the ownerzbad follower token %r>r r#r"r$)�shlexZ	wordcharsZ
commenters�replacerZ	get_token�lenZinstream�readlinerZ
whitespace�appendrr�
startswithZ
push_token�reprr�name�fstat�fileno�st_uid�getuid�pwd�getpwuidr�st_mode�stat�S_IRWXG�S_IRWXO)r	rrrZlexerZsaved_linenoZtoplevelZttZ	entryname�liner&r(r)Zpropr7Zfownerr'r
r
rr#s�












znetrc._parsecCs0||jkr|j|Sd|jkr(|jdSdSdS)z8Return a (user, account, password) tuple for given host.r#N)r)r	�hostr
r
r�authenticatorsts




znetrc.authenticatorscCs�d}xf|jj�D]X}|j|}|d|�d|d�d�7}|drT|d|d�d�7}|d|d	�d�7}qWxF|jj�D]8}|d
|�d�7}x|j|D]}||7}q�W|d7}qxW|S)z3Dump the class data in the format of a .netrc file.r zmachine z
	login rr%r!z		account z
	password �zmacdef )r�keysr)r	Zrepr>ZattrsZmacror=r
r
r�__repr__}s
znetrc.__repr__)N)r
rrrrr?rBr
r
r
rrs
Q	�__main__)
rrr+r:�__all__rrrr
�printr
r
r
r�<module>swdis.cpython-36.opt-1.pyc000064400000033547150335715140010730 0ustar003


 \�F�@s�dZddlZddlZddlZddlZddlTddlmZddddd	d
ddd
ddgeZ[ejej	ej
eee
fZedZdd�ZdKdd�dd�ZdLdd�dd�Zddddddddddd �
Zd!d"�Zd#d$�Zd%d�Zd&d'�Zdd�d(d�Zejd)d*�Zd+ej_d,ej_d-ej_d.ej_d/ej_d0ej _d1ej!_d2ej"_Gd3d�de�Z#dd4�d5d
�Z$d6d7�Z%d8d9�Z&dMd:d;�Z'dOdd�d=d�Z(dQddd>�d?d@�Z)dd�dAdB�Z*e(Z+dCdD�Z,dEd�Z-dFd
�Z.GdGd�d�Z/dHdI�Z0e1dJk�r�e0�dS)Rz0Disassembler of Python byte code into mnemonics.�N)�*)�__all__�	code_info�dis�disassemble�distb�disco�findlinestarts�
findlabels�	show_code�get_instructions�Instruction�Bytecode�FORMAT_VALUEcCs6yt||d�}Wn tk
r0t||d�}YnX|S)z�Attempts to compile the given source, first as an expression and
       then as a statement if the first approach fails.

       Utility function to accept strings in functions that otherwise
       expect code objects
    �eval�exec)�compile�SyntaxError)�source�name�c�r�/usr/lib64/python3.6/dis.py�_try_compiles
r)�filecCs>|dkrt|d�dSt|d�r&|j}t|d�r6|j}t|d�rF|j}t|d�r�t|jj��}x�|D]n\}}t|t	�rdt
d||d�yt||d�Wn0tk
r�}zt
d||d�WYdd}~XnXt
|d�qdWnbt|d	�r�t
||d�nJt|ttf��rt||d�n,t|t��r(t||d�ntd
t|�j��dS)zzDisassemble classes, methods, functions, generators, or code.

    With no argument, disassemble the last traceback.

    N)r�__func__�__code__�gi_code�__dict__zDisassembly of %s:zSorry:�co_codez(don't know how to disassemble %s objects)r�hasattrrrr�sortedr�items�
isinstance�
_have_code�printr�	TypeErrorr�bytes�	bytearray�_disassemble_bytes�str�_disassemble_str�type�__name__)�xrr"rZx1�msgrrrr"s6





 
c
CsZ|dkrBy
tj}Wntk
r.td��YnXx|jr@|j}q2Wt|jj|j|d�dS)z2Disassemble a traceback (default: last traceback).Nz no last traceback to disassemble)r)	�sys�last_traceback�AttributeError�RuntimeError�tb_nextr�tb_frame�f_code�tb_lasti)�tbrrrrrEs

Z	OPTIMIZEDZ	NEWLOCALSZVARARGSZVARKEYWORDSZNESTEDZ	GENERATORZNOFREEZ	COROUTINEZITERABLE_COROUTINEZASYNC_GENERATOR)
������ �@��icCsbg}xRtd�D]8}d|>}||@r|jtj|t|���||N}|sPqW|jt|��dj|�S)z+Return pretty representation of code flags.r>r9z, )�range�append�COMPILER_FLAG_NAMES�get�hex�join)�flags�names�i�flagrrr�pretty_flags_srLcCsht|d�r|j}t|d�r |j}t|d�r0|j}t|t�rDt|d�}t|d�rR|Stdt|�j	��dS)zMHelper to handle methods, functions, generators, strings and raw code objectsrrrz
<disassembly>rz(don't know how to disassemble %s objectsN)
r rrrr#r*rr&r,r-)r.rrr�_get_code_objectms





rMcCstt|��S)z1Formatted details of methods, functions, or code.)�_format_code_inforM)r.rrrr|scCs�g}|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jdt|j��|j	r�|jd�x t
|j	�D]}|jd	|�q�W|jr�|jd
�x t
|j�D]}|jd|�q�W|j�r|jd�x t
|j�D]}|jd|�q�W|j
�rF|jd
�x"t
|j
�D]}|jd|��q.W|j�r||jd�x"t
|j�D]}|jd|��qdWdj|�S)NzName:              %szFilename:          %szArgument count:    %szKw-only arguments: %szNumber of locals:  %szStack size:        %szFlags:             %sz
Constants:z%4d: %rzNames:z%4d: %szVariable names:zFree variables:zCell variables:�
)rC�co_name�co_filename�co_argcount�co_kwonlyargcount�
co_nlocals�co_stacksizerL�co_flags�	co_consts�	enumerate�co_names�co_varnames�co_freevars�co_cellvarsrG)�co�linesZi_cZi_nrrrrN�s:




rNcCstt|�|d�dS)z}Print details of methods, functions, or code to *file*.

    If *file* is not provided, the output is printed on stdout.
    )rN)r%r)r]rrrrr�s�_InstructionzBopname opcode arg argval argrepr offset starts_line is_jump_targetz!Human readable name for operationzNumeric code for operationz6Numeric argument to operation (if any), otherwise Nonez4Resolved arg value (if known), otherwise same as argz0Human readable description of operation argumentz1Start index of operation within bytecode sequencez4Line started by this opcode (if any), otherwise Nonez1True if other code jumps to here, otherwise Falsec@seZdZdZddd�ZdS)r
aKDetails for a bytecode operation

       Defined fields:
         opname - human readable name for operation
         opcode - numeric code for operation
         arg - numeric argument to operation (if any), otherwise None
         argval - resolved arg value (if known), otherwise same as arg
         argrepr - human readable description of operation argument
         offset - start index of operation within bytecode sequence
         starts_line - line started by this opcode (if any), otherwise None
         is_jump_target - True if other code jumps to here, otherwise False
    �FcCs�g}|r:|jdk	r,d|}|j||j�n|jd|�|rJ|jd�n
|jd�|jrf|jd�n
|jd�|jt|j�jd��|j|jjd	��|jdk	r�|jt|j�jd
��|j	r�|jd|j	d�dj
|�j�S)
z�Format instruction details for inclusion in disassembly output

        *lineno_width* sets the width of the line number field (0 omits it)
        *mark_as_current* inserts a '-->' marker arrow as part of the line
        Nz%%%dd� z-->z   z>>z  r;���(�))�starts_linerC�is_jump_target�repr�offset�rjust�opname�ljust�arg�argreprrG�rstrip)�self�lineno_widthZmark_as_currentZfieldsZ
lineno_fmtrrr�_disassemble�s&



zInstruction._disassembleN)r`F)r-�
__module__�__qualname__�__doc__rrrrrrr
�s)�
first_linecCsTt|�}|j|j}tt|��}|dk	r4||j}nd}t|j|j|j	|j
|||�S)a�Iterator for the opcodes in methods, functions or code

    Generates a series of Instruction named tuples giving the details of
    each operations in the supplied code.

    If *first_line* is not None, it indicates the line number that should
    be reported for the first source line in the disassembled code.
    Otherwise, the source line information (if any) is taken directly from
    the disassembled code object.
    Nr)rMr\r[�dictr	�co_firstlineno�_get_instructions_bytesrrZrYrW)r.rvr]�
cell_names�
linestarts�line_offsetrrrr�scCs |}|dk	r||}|t|�fS)z�Helper to get optional details about const references

       Returns the dereferenced constant and its repr if the constant
       list is defined.
       Otherwise returns the constant index and its repr().
    N)rh)Zconst_indexZ
const_list�argvalrrr�_get_const_info�sr~cCs*|}|dk	r||}|}nt|�}||fS)z�Helper to get optional details about named references

       Returns the dereferenced name as both value and repr if the name
       list is defined.
       Otherwise returns the name index and its repr().
    N)rh)Z
name_indexZ	name_listr}rnrrr�_get_name_infosrc
csxt|�}d}�xdt|�D�]V\}	}
}|dk	rH|j|	d�}|dk	rH||7}|	|k}d}
d}|dk	�rT|}
|
tkr~t||�\}
}n�|
tkr�t||�\}
}n�|
tkr�|	d|}
dt|
�}n�|
t	kr�t||�\}
}n�|
t
kr�t|}
|
}nn|
tkr�t||�\}
}nV|
t
k�rTdtttf|d@t|d@�f}
d
|d@}|
d
�rT|�rL|d7}|d7}tt|
|
||
||	||�VqWdS)a&Iterate over the instructions in a bytecode string.

    Generates a sequence of Instruction namedtuples giving the details of each
    opcode.  Additional information about the code's runtime environment
    (e.g. variable names, constants) can be specified using optional
    arguments.

    N�r:zto r`r;r*rh�asciir9z, zwith format)r�r*rhr�)r
�_unpack_opargsrEZhasconstr~Zhasnamer�hasjrelrhZhaslocalZ
hascompareZcmp_opZhasfreerr*r��boolr
rk)�code�varnamesrI�	constants�cellsr{r|�labelsrfri�oprmrgr}rnrrrrysH


 

ryr9c
Cs<|j|j}tt|��}t|j||j|j|j|||d�dS)zDisassemble a code object.)rN)	r\r[rwr	r)rrZrYrW)r]�lastirrzr{rrrrJs)rr|c	Cs||dk	}	|	rdnd}
xbt|||||||d�D]H}|	oF|jdk	oF|jdk}|rVt|d�|j|k}
t|j|
|
�|d�q,WdS)Nr`r)r|)r)ryrfrir%rr)r�r�r�rIr�r�r{rr|Zshow_linenorqZinstrZnew_source_lineZis_current_instrrrrr)Qs




r)cCstt|d�|d�dS)z<Compile the source string, then disassemble the code object.z<dis>)rN)rr)rrrrrr+csr+ccshd}x^tdt|�d�D]J}||}|tkrP||d|B}|tkrJ|d>nd}nd}|||fVqWdS)Nrr:r9r<)rB�lenZ
HAVE_ARGUMENTZEXTENDED_ARG)r�Zextended_argrJr�rmrrrr�isr�cCs`g}xVt|�D]J\}}}|dk	r|tkr6|d|}n|tkr|}nq||kr|j|�qW|S)z`Detect all offsets in a byte code which are jump targets.

    Return the list of offsets.

    Nr:)r�r�ZhasjabsrC)r�r�rir�rmZlabelrrrr
tsccs�|jddd�}|jddd�}d}|j}d}xPt||�D]B\}}|rd||kr\||fV|}||7}|dkrt|d8}||7}q:W||kr�||fVdS)z�Find the offsets in a byte code which are start of lines in the source.

    Generate pairs (offset, lineno) as described in Python/compile.c.

    rNr:r9r@rA)�	co_lnotabrx�zip)r�Zbyte_incrementsZline_incrementsZ
lastlineno�linenoZaddrZ	byte_incrZ	line_incrrrrr	�s 
c@sLeZdZdZddd�dd�Zdd�Zdd	�Zed
d��Zdd
�Z	dd�Z
dS)rz�The bytecode operations of a piece of code

    Instantiate this with a function, method, string of code, or a code object
    (as returned by compile()).

    Iterating over this yields the bytecode operations as Instruction instances.
    N)rv�current_offsetcCsdt|�|_}|dkr&|j|_d|_n||_||j|_|j|j|_tt	|��|_
||_||_dS)Nr)
rM�codeobjrxrv�_line_offsetr\r[�_cell_namesrwr	�_linestarts�_original_objectr�)rpr.rvr�r]rrr�__init__�szBytecode.__init__c	Cs*|j}t|j|j|j|j|j|j|jd�S)N)r|)	r�ryrrZrYrWr�r�r�)rpr]rrr�__iter__�s
zBytecode.__iter__cCsdj|jj|j�S)Nz{}({!r}))�format�	__class__r-r�)rprrr�__repr__�s
zBytecode.__repr__cCs$x|jr|j}qW||jj|jd�S)z/ Construct a Bytecode from the given traceback )r�)r4r5r6r7)�clsr8rrr�from_traceback�s
zBytecode.from_tracebackcCs
t|j�S)z3Return formatted information about the code object.)rNr�)rprrr�info�sz
Bytecode.infocCs`|j}|jdk	r|j}nd}tj��2}t|j|j|j|j|j	|j
|j||d�	|j�SQRXdS)z3Return a formatted view of the bytecode operations.Nr9)r�rIr�r�r{r|rr����)
r�r��io�StringIOr)rrZrYrWr�r�r��getvalue)rpr]ri�outputrrrr�s


zBytecode.dis)r-rsrtrur�r�r��classmethodr�r�rrrrrr�s
cCsdddl}|j�}|jd|j�ddd�|j�}|j�}|j�}WdQRXt||jjd�}t	|�dS)z*Simple test program to disassemble a file.rN�infile�?�-)r,�nargs�defaultr)
�argparse�ArgumentParser�add_argumentZFileType�
parse_argsr��readrrr)r��parser�argsr�rr�rrr�_test�sr��__main__)N)N)NNNNNrr�)r�r�)r�NNNNN)2rur0�types�collectionsr�ZopcoderZ_opcodes_all�
MethodType�FunctionType�CodeTyper��staticmethodr,r$ZopmaprrrrrDrLrMrrNr�
namedtupler_rkrmr}rnrirfrgr
rr~rryrr)r+rr�r
r	rr�r-rrrr�<module>sx


#3
2=
pipes.cpython-36.opt-2.pyc000064400000011511150335715140011255 0ustar003


 \�"�@slddlZddlZddlZddlmZdgZdZdZdZdZ	dZ
d	Zeeee	e
egZGd
d�d�Z
dd�ZdS)
�N)�quote�TemplateZffz-fzf-z--z.-z-.c@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rcCsd|_|j�dS)Nr)�	debugging�reset)�self�r�/usr/lib64/python3.6/pipes.py�__init__UszTemplate.__init__cCsd|jfS)Nz<Template instance, steps=%r>)�steps)rrrr�__repr__ZszTemplate.__repr__cCs
g|_dS)N)r
)rrrrr^szTemplate.resetcCs"t�}|jdd�|_|j|_|S)N)rr
r)r�trrr�clonebszTemplate.clonecCs
||_dS)N)r)r�flagrrr�debugjszTemplate.debugcCs�t|�td�k	rtd��|tkr.td|f��|tkr>td��|jr^|jd
dtkr^td��|ddkr�tjd	|�r�td
��|ddkr�tjd|�r�td��|jj	||f�dS)N�z%Template.append: cmd must be a stringzTemplate.append: bad kind %rz-Template.append: SOURCE can only be prepended�z'Template.append: already ends with SINKr�fz\$IN\bz#Template.append: missing $IN in cmdz\$OUT\bz$Template.append: missing $OUT in cmd���)
�type�	TypeError�	stepkinds�
ValueError�SOURCEr
�SINK�re�search�append)r�cmd�kindrrrrnszTemplate.appendcCs�t|�td�k	rtd��|tkr.td|f��|tkr>td��|jr^|jddtkr^td��|ddkr�tjd	|�r�td
��|ddkr�tjd|�r�td��|jj	d||f�dS)
Nrz&Template.prepend: cmd must be a stringzTemplate.prepend: bad kind %rz+Template.prepend: SINK can only be appendedrrz,Template.prepend: already begins with SOURCErz\$IN\bz$Template.prepend: missing $IN in cmdz\$OUT\bz%Template.prepend: missing $OUT in cmd)
rrrrrr
rrr�insert)rrrrrr�prepend~szTemplate.prependcCs6|dkr|j|�S|dkr$|j|�Std|f��dS)N�r�wz,Template.open: rw must be 'r' or 'w', not %r)�open_r�open_wr)r�fileZrwrrr�open�s

z
Template.opencCsB|jst|d�S|jddtkr*td��|j|d�}tj|d�S)Nr!rz)Template.open_r: pipeline ends width SINKrr)r
r&rr�makepipeline�os�popen)rr%rrrrr#�s
zTemplate.open_rcCsB|jst|d�S|jddtkr*td��|jd|�}tj|d�S)Nr"rrz,Template.open_w: pipeline begins with SOURCEr)r
r&rrr'r(r))rr%rrrrr$�s
zTemplate.open_wcCstj|j||��S)N)r(�systemr')r�infile�outfilerrr�copy�sz
Template.copycCs(t||j|�}|jr$t|�d|}|S)Nzset -x; )r'r
r�print)rr+r,rrrrr'�s
zTemplate.makepipelineN)�__name__�
__module__�__qualname__r	rrr
rrr r&r#r$r-r'rrrrrRs

cCs�g}x"|D]\}}|jd||dg�q
W|s>|jddddg�|ddd�\}}|ddkrx|rx|jdddddg�||dd<|ddd�\}}|ddkr�|r�|jddddg�||dd<g}x�tdt|��D]v}||dd}||d}	|ddk�s|	ddkr�tj�\}
}tj|
�|j|�|||dd<||d<q�Wx�|D]�}|\}
}}}|ddk�r�d	t|�d
|}|ddk�r�dt|
�d
|}|ddk�r�|
�r�|d
t|
�}|ddk�r�|�r�|dt|�}||d<�q\W|dd}xd|dd�D]T}|dd�\}}|ddk�rfd|k�rXd|d}|d|}n|d|}�q W|�r�d}x|D]}|dt|�}�q�Wdt|d�d}|d|d|}|S)Nr�catz--rr�r�zOUT=z; zIN=�-z <z >z{ z; }z |
�
zrm -f� ztrap z; exitz 1 2 3 13 14 15rrrr)	rr�range�len�tempfileZmkstempr(�closer)r+r
r,�listrrZgarbage�iZlkindZrkind�fdZtemp�item�infZoutfZcmdlistZrmcmdr%Ztrapcmdrrrr'�s`

 


r')rr(r:Zshlexr�__all__ZFILEIN_FILEOUTZ
STDIN_FILEOUTZ
FILEIN_STDOUTZSTDIN_STDOUTrrrrr'rrrr�<module><scpty.cpython-36.opt-1.pyc000064400000007427150335715140010763 0ustar003


 \��@s�dZddlmZddlZddlZdddgZdZdZdZdZd	d�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zeefdd�Zeefdd�ZdS)zPseudo terminal utilities.�)�selectN�openpty�fork�spawn��cCs<ytj�Sttfk
r YnXt�\}}t|�}||fS)zdopenpty() -> (master_fd, slave_fd)
    Open a pty master/slave pair, using os.openpty() if possible.)�osr�AttributeError�OSError�_open_terminal�
slave_open)�	master_fd�
slave_name�slave_fd�r�/usr/lib64/python3.6/pty.pyrs
cCsLytj�\}}Wnttfk
r(YnXtj|�}tj|�||fSt�S)z�master_open() -> (master_fd, slave_name)
    Open a pty master and return the fd, and the filename of the slave end.
    Deprecated, use openpty() instead.)rrr	r
�ttyname�closer)r
rrrrr�master_open!s

rc
Cslx^dD]V}xPdD]H}d||}ytj|tj�}Wntk
rHwYnX|d||fSWqWtd��dS)z1Open pty master and return (master_fd, tty_name).ZpqrstuvwxyzPQRSTZ0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devicesN)r�open�O_RDWRr
)�x�yZpty_name�fdrrrr1s

rcCsntj|tj�}yddlm}m}Wntk
r6|SXy|||d�|||d�Wntk
rhYnX|S)z�slave_open(tty_name) -> slave_fd
    Open the pty slave and acquire the controlling terminal, returning
    opened filedescriptor.
    Deprecated, use openpty() instead.r)�ioctl�I_PUSHZptemZldterm)rrrZfcntlrr�ImportErrorr
)Ztty_name�resultrrrrrr=srcCs�ytj�\}}Wnttfk
r(Yn4X|tkrTytj�Wntk
rRYnX||fSt�\}}tj�}|tkr�tj�tj|�tj	|t
�tj	|t�tj	|t�|tkr�tj|�tj
tjt�tj�}tj|�n
tj|�||fS)zdfork() -> (pid, master_fd)
    Fork and make the child a session leader with a controlling terminal.)r�forkptyr	r
�CHILD�setsidrrr�dup2�STDIN_FILENO�
STDOUT_FILENO�
STDERR_FILENOrrr)�pidrr
rZtmp_fdrrrrOs0



cCs&x |r tj||�}||d�}qWdS)z#Write all the data to a descriptor.N)r�write)r�data�nrrr�_writenwsr)cCstj|d�S)zDefault read function.i)r�read)rrrr�_read}sr+cCsz|tg}xlt|gg�\}}}||krH||�}|s<|j|�ntjt|�t|kr
|t�}|sh|jt�q
t||�q
WdS)z�Parent copy loop.
    Copies
            pty master -> standard output   (master_read)
            standard input -> pty master    (stdin_read)N)r"r�removerr&r#r))r
�master_read�
stdin_readZfdsZrfdsZwfdsZxfdsr'rrr�_copy�sr/cCs�t|�td�kr|f}t�\}}|tkr<tj|df|��ytjt�}tjt�d}Wntj	k
rrd}YnXyt
|||�Wn(tk
r�|r�tjttj
|�YnXtj|�tj|d�dS)zCreate a spawned process.�rr)�typerrr�execlp�ttyZ	tcgetattrr"Zsetraw�errorr/r
Z	tcsetattrZ	TCSAFLUSHr�waitpid)�argvr-r.r%r
�modeZrestorerrrr�s$




)�__doc__rrr3�__all__r"r#r$rrrrrrr)r+r/rrrrr�<module>s"
(__future__.cpython-36.opt-1.pyc000064400000010111150335715140012235 0ustar003


 \��	@s�dZddddddddd	g	Zd
geZdZdZd
ZdZdZdZdZ	dZ
dZGdd�d�Zed!d"e�Z
ed#d$e�Zed%d&e�Zed'd(e�Zed)d*e�Zed+d,e�Zed-d.e	�Zed/d0e
�Zed1d2e�Zd S)3afRecord of phased-in incompatible language changes.

Each line is of the form:

    FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease ","
                              CompilerFlag ")"

where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples
of the same form as sys.version_info:

    (PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int
     PY_MINOR_VERSION, # the 1; an int
     PY_MICRO_VERSION, # the 0; an int
     PY_RELEASE_LEVEL, # "alpha", "beta", "candidate" or "final"; string
     PY_RELEASE_SERIAL # the 3; an int
    )

OptionalRelease records the first release in which

    from __future__ import FeatureName

was accepted.

In the case of MandatoryReleases that have not yet occurred,
MandatoryRelease predicts the release in which the feature will become part
of the language.

Else MandatoryRelease records when the feature became part of the language;
in releases at or after that, modules no longer need

    from __future__ import FeatureName

to use the feature in question, but may continue to use such imports.

MandatoryRelease may also be None, meaning that a planned feature got
dropped.

Instances of class _Feature have two corresponding methods,
.getOptionalRelease() and .getMandatoryRelease().

CompilerFlag is the (bitfield) flag that should be passed in the fourth
argument to the builtin function compile() to enable the feature in
dynamically compiled code.  This flag is stored in the .compiler_flag
attribute on _Future instances.  These values must match the appropriate
#defines of CO_xxx flags in Include/compile.h.

No feature line is ever to be deleted from this file.
�
nested_scopes�
generators�division�absolute_import�with_statement�print_function�unicode_literals�barry_as_FLUFL�generator_stop�all_feature_names��i i@i�iiiic@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_FeaturecCs||_||_||_dS)N)�optional�	mandatory�
compiler_flag)�selfZoptionalReleaseZmandatoryReleaser�r�"/usr/lib64/python3.6/__future__.py�__init__Osz_Feature.__init__cCs|jS)z�Return first release in which this feature was recognized.

        This is a 5-tuple, of the same form as sys.version_info.
        )r)rrrr�getOptionalReleaseTsz_Feature.getOptionalReleasecCs|jS)z�Return release in which this feature will become mandatory.

        This is a 5-tuple, of the same form as sys.version_info, or, if
        the feature was dropped, is None.
        )r)rrrr�getMandatoryRelease\sz_Feature.getMandatoryReleasecCsdt|j|j|jf�S)Nr
)�reprrrr)rrrr�__repr__esz_Feature.__repr__N)�__name__�
__module__�__qualname__rrrrrrrrr
Ns	r
���beta�alpha��final���	�N)rrrrr)rrrrr)rrrrr)rr rr!r)rrrrr)r rrrr)rr"rrr)r rrrr)rr"rrr)rr#rrr)rr#rrr)r rrrr)rr#rrr)r rrrr)r rrrr)r r$rrr)r r"rrr)r r%rrr)�__doc__r
�__all__Z	CO_NESTEDZCO_GENERATOR_ALLOWEDZCO_FUTURE_DIVISIONZCO_FUTURE_ABSOLUTE_IMPORTZCO_FUTURE_WITH_STATEMENTZCO_FUTURE_PRINT_FUNCTIONZCO_FUTURE_UNICODE_LITERALSZCO_FUTURE_BARRY_AS_BDFLZCO_FUTURE_GENERATOR_STOPr
rrrrrrrrr	rrrr�<module>0s^
_pydecimal.cpython-36.pyc000064400000477114150335715140011322 0ustar003


 \T��$@sJdZddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$g$ZeZd%Zd&Zd'Zd(d)lZd(d)lZ	d(d)l
Z
yd(d*lmZ
e
dd+�ZWnek
r�d,d-�ZYnXdZdZdZdZdZdZdZdZd.Ze
jd�kr�d2Zd2Zd�Znd3Zd3Zd�Zeed1ZGd4d�de�ZGd5d�de�Z Gd6d	�d	e�Z!Gd7d�de!�Z"Gd8d
�d
ee#�Z$Gd9d�de!�Z%Gd:d�de!e#�Z&Gd;d�de�Z'Gd<d�de!�Z(Gd=d�de�Z)Gd>d
�d
e�Z*Gd?d�de'e)�Z+Gd@d�de'e)e*�Z,GdAd�dee-�Z.e e$e'e+e)e,e!e*e.g	Z/e"e!e%e!e&e!e(e!iZ0eeeeeeeefZ1yd(d)l2Z2Wn.ek
�rhGdBdC�dCe3�Z4e4�Z2[4YnXy
e2j5Wn>e6k
�r�e7e2j8�dD��r�e2j8�`9dEd�Z:dFd�Z;Yn6Xe2j5�Z5e7e5dD��r�e5`9e5fdGd�Z;e5fdHd�Z:[2[5d�dId�Z<GdJd�de3�Z=d�dLdM�Z>e	j?j@e=�GdNdO�dOe3�ZAGdPd�de3�ZBGdQdR�dRe3�ZCd�dSdT�ZDeEjFZGdUdV�ZHdWdX�ZIdYdZ�ZJd[d\�ZKd�d^d_�ZLd`da�ZMdbdc�ZNGddde�dee3�ZOeO�jPZQd�dfdg�ZRdhdi�ZSdjdk�ZTdldmdndodpdqdrdsdtdu�	fdvdw�ZUd�dxdy�ZVd�dzd{�ZWeBd|ee$e+e!ggd}d�d1d(d~�ZXeBdee$e+e!e e,ggd��ZYeBdeggd��ZZd(d)l[Z[e[j\d�e[j]e[j^B�j_Z`e[j\d��j_Zae[j\d��j_Zbe[j\d�e[j]e[jcB�Zd[[yd(d)leZfWnek
�r�YnXd�d�d��Zgd�d��Zhd�d��Zid�d�d��Zjd�d��Zkd�d��Zle=d��Zme=d��Zne=d��Zoe=d(�Zpe=d1�Zqe=d��ZremenfZse
jtjuZve
jtjwZxe
jtjyZze{dsevd/ev�Z|[
d)S)�a�	
This is an implementation of decimal floating point arithmetic based on
the General Decimal Arithmetic Specification:

    http://speleotrove.com/decimal/decarith.html

and IEEE standard 854-1987:

    http://en.wikipedia.org/wiki/IEEE_854-1987

Decimal floating point has finite precision with arbitrarily large bounds.

The purpose of this module is to support arithmetic using familiar
"schoolhouse" rules and to avoid some of the tricky representation
issues associated with binary floating point.  The package is especially
useful for financial applications or for contexts where users have
expectations that are at odds with binary floating point (for instance,
in binary floating point, 1.00 % 0.1 gives 0.09999999999999995 instead
of 0.0; Decimal('1.00') % Decimal('0.1') returns the expected
Decimal('0.00')).

Here are some examples of using the decimal module:

>>> from decimal import *
>>> setcontext(ExtendedContext)
>>> Decimal(0)
Decimal('0')
>>> Decimal('1')
Decimal('1')
>>> Decimal('-.0123')
Decimal('-0.0123')
>>> Decimal(123456)
Decimal('123456')
>>> Decimal('123.45e12345678')
Decimal('1.2345E+12345680')
>>> Decimal('1.33') + Decimal('1.27')
Decimal('2.60')
>>> Decimal('12.34') + Decimal('3.87') - Decimal('18.41')
Decimal('-2.20')
>>> dig = Decimal(1)
>>> print(dig / Decimal(3))
0.333333333
>>> getcontext().prec = 18
>>> print(dig / Decimal(3))
0.333333333333333333
>>> print(dig.sqrt())
1
>>> print(Decimal(3).sqrt())
1.73205080756887729
>>> print(Decimal(3) ** 123)
4.85192780976896427E+58
>>> inf = Decimal(1) / Decimal(0)
>>> print(inf)
Infinity
>>> neginf = Decimal(-1) / Decimal(0)
>>> print(neginf)
-Infinity
>>> print(neginf + inf)
NaN
>>> print(neginf * inf)
-Infinity
>>> print(dig / 0)
Infinity
>>> getcontext().traps[DivisionByZero] = 1
>>> print(dig / 0)
Traceback (most recent call last):
  ...
  ...
  ...
decimal.DivisionByZero: x / 0
>>> c = Context()
>>> c.traps[InvalidOperation] = 0
>>> print(c.flags[InvalidOperation])
0
>>> c.divide(Decimal(0), Decimal(0))
Decimal('NaN')
>>> c.traps[InvalidOperation] = 1
>>> print(c.flags[InvalidOperation])
1
>>> c.flags[InvalidOperation] = 0
>>> print(c.flags[InvalidOperation])
0
>>> print(c.divide(Decimal(0), Decimal(0)))
Traceback (most recent call last):
  ...
  ...
  ...
decimal.InvalidOperation: 0 / 0
>>> print(c.flags[InvalidOperation])
1
>>> c.flags[InvalidOperation] = 0
>>> c.traps[InvalidOperation] = 0
>>> print(c.divide(Decimal(0), Decimal(0)))
NaN
>>> print(c.flags[InvalidOperation])
1
>>>
�Decimal�Context�DecimalTuple�DefaultContext�BasicContext�ExtendedContext�DecimalException�Clamped�InvalidOperation�DivisionByZero�Inexact�Rounded�	Subnormal�Overflow�	Underflow�FloatOperation�DivisionImpossible�InvalidContext�ConversionSyntax�DivisionUndefined�
ROUND_DOWN�
ROUND_HALF_UP�ROUND_HALF_EVEN�
ROUND_CEILING�ROUND_FLOOR�ROUND_UP�ROUND_HALF_DOWN�
ROUND_05UP�
setcontext�
getcontext�localcontext�MAX_PREC�MAX_EMAX�MIN_EMIN�	MIN_ETINY�HAVE_THREADSZdecimalz1.70z2.4.2�N)�
namedtuplezsign digits exponentcGs|S)N�)�argsr'r'�"/usr/lib64/python3.6/_pydecimal.py�<lambda>�sr*T��?�l��N�Zoi@�Tc@seZdZdZdd�ZdS)ra1Base exception class.

    Used exceptions derive from this.
    If an exception derives from another exception besides this (such as
    Underflow (Inexact, Rounded, Subnormal) that indicates that it is only
    called if the others are present.  This isn't actually used for
    anything, though.

    handle  -- Called when context._raise_error is called and the
               trap_enabler is not set.  First argument is self, second is the
               context.  More arguments can be given, those being after
               the explanation in _raise_error (For example,
               context._raise_error(NewError, '(-x)!', self._sign) would
               call NewError().handle(context, self._sign).)

    To define a new exception, it should be sufficient to have it derive
    from DecimalException.
    cGsdS)Nr')�self�contextr(r'r'r)�handle�szDecimalException.handleN)�__name__�
__module__�__qualname__�__doc__r0r'r'r'r)r�sc@seZdZdZdS)ra)Exponent of a 0 changed to fit bounds.

    This occurs and signals clamped if the exponent of a result has been
    altered in order to fit the constraints of a specific concrete
    representation.  This may occur when the exponent of a zero result would
    be outside the bounds of a representation, or when a large normal
    number would have an encoded exponent that cannot be represented.  In
    this latter case, the exponent is reduced to fit and the corresponding
    number of zero digits are appended to the coefficient ("fold-down").
    N)r1r2r3r4r'r'r'r)r�s
c@seZdZdZdd�ZdS)r	a0An invalid operation was performed.

    Various bad things cause this:

    Something creates a signaling NaN
    -INF + INF
    0 * (+-)INF
    (+-)INF / (+-)INF
    x % 0
    (+-)INF % x
    x._rescale( non-integer )
    sqrt(-x) , x > 0
    0 ** 0
    x ** (non-integer)
    x ** (+-)INF
    An operand is invalid

    The result of the operation after these is a quiet positive NaN,
    except when the cause is a signaling NaN, in which case the result is
    also a quiet NaN, but with the original sign, and an optional
    diagnostic information.
    cGs,|r(t|dj|djdd�}|j|�StS)Nr%�nT)�_dec_from_triple�_sign�_int�_fix_nan�_NaN)r.r/r(�ansr'r'r)r0�s
zInvalidOperation.handleN)r1r2r3r4r0r'r'r'r)r	�sc@seZdZdZdd�ZdS)rz�Trying to convert badly formed string.

    This occurs and signals invalid-operation if a string is being
    converted to a number and it does not conform to the numeric string
    syntax.  The result is [0,qNaN].
    cGstS)N)r:)r.r/r(r'r'r)r0szConversionSyntax.handleN)r1r2r3r4r0r'r'r'r)r�sc@seZdZdZdd�ZdS)r
a�Division by 0.

    This occurs and signals division-by-zero if division of a finite number
    by zero was attempted (during a divide-integer or divide operation, or a
    power operation with negative right-hand operand), and the dividend was
    not zero.

    The result of the operation is [sign,inf], where sign is the exclusive
    or of the signs of the operands for divide, or is 1 for an odd power of
    -0, for power.
    cGst|S)N)�_SignedInfinity)r.r/�signr(r'r'r)r0szDivisionByZero.handleN)r1r2r3r4r0r'r'r'r)r
sc@seZdZdZdd�ZdS)rz�Cannot perform the division adequately.

    This occurs and signals invalid-operation if the integer result of a
    divide-integer or remainder operation had too many digits (would be
    longer than precision).  The result is [0,qNaN].
    cGstS)N)r:)r.r/r(r'r'r)r0szDivisionImpossible.handleN)r1r2r3r4r0r'r'r'r)rsc@seZdZdZdd�ZdS)rz�Undefined result of division.

    This occurs and signals invalid-operation if division by zero was
    attempted (during a divide-integer, divide, or remainder operation), and
    the dividend is also zero.  The result is [0,qNaN].
    cGstS)N)r:)r.r/r(r'r'r)r0)szDivisionUndefined.handleN)r1r2r3r4r0r'r'r'r)r!sc@seZdZdZdS)ra�Had to round, losing information.

    This occurs and signals inexact whenever the result of an operation is
    not exact (that is, it needed to be rounded and any discarded digits
    were non-zero), or if an overflow or underflow condition occurs.  The
    result in all cases is unchanged.

    The inexact signal may be tested (or trapped) to determine if a given
    operation (or sequence of operations) was inexact.
    N)r1r2r3r4r'r'r'r)r,s
c@seZdZdZdd�ZdS)ra�Invalid context.  Unknown rounding, for example.

    This occurs and signals invalid-operation if an invalid context was
    detected during an operation.  This can occur if contexts are not checked
    on creation and either the precision exceeds the capability of the
    underlying concrete representation or an unknown or unsupported rounding
    was specified.  These aspects of the context need only be checked when
    the values are required to be used.  The result is [0,qNaN].
    cGstS)N)r:)r.r/r(r'r'r)r0CszInvalidContext.handleN)r1r2r3r4r0r'r'r'r)r8s	c@seZdZdZdS)ra�Number got rounded (not  necessarily changed during rounding).

    This occurs and signals rounded whenever the result of an operation is
    rounded (that is, some zero or non-zero digits were discarded from the
    coefficient), or if an overflow or underflow condition occurs.  The
    result in all cases is unchanged.

    The rounded signal may be tested (or trapped) to determine if a given
    operation (or sequence of operations) caused a loss of precision.
    N)r1r2r3r4r'r'r'r)rFs
c@seZdZdZdS)r
a�Exponent < Emin before rounding.

    This occurs and signals subnormal whenever the result of a conversion or
    operation is subnormal (that is, its adjusted exponent is less than
    Emin, before any rounding).  The result in all cases is unchanged.

    The subnormal signal may be tested (or trapped) to determine if a given
    or operation (or sequence of operations) yielded a subnormal result.
    N)r1r2r3r4r'r'r'r)r
Rs	c@seZdZdZdd�ZdS)raNumerical overflow.

    This occurs and signals overflow if the adjusted exponent of a result
    (from a conversion or from an operation that is not an attempt to divide
    by zero), after rounding, would be greater than the largest value that
    can be handled by the implementation (the value Emax).

    The result depends on the rounding mode:

    For round-half-up and round-half-even (and for round-half-down and
    round-up, if implemented), the result of the operation is [sign,inf],
    where sign is the sign of the intermediate result.  For round-down, the
    result is the largest finite number that can be represented in the
    current precision, with the sign of the intermediate result.  For
    round-ceiling, the result is the same as for round-down if the sign of
    the intermediate result is 1, or is [0,inf] otherwise.  For round-floor,
    the result is the same as for round-down if the sign of the intermediate
    result is 0, or is [1,inf] otherwise.  In all cases, Inexact and Rounded
    will also be raised.
    cGs�|jttttfkrt|S|dkrR|jtkr4t|St|d|j|j	|jd�S|dkr�|jt
krlt|St|d|j|j	|jd�SdS)Nr%�9r-)�roundingrrrrr<rr6�prec�Emaxr)r.r/r=r(r'r'r)r0ss


zOverflow.handleN)r1r2r3r4r0r'r'r'r)r]sc@seZdZdZdS)raxNumerical underflow with result rounded to 0.

    This occurs and signals underflow if a result is inexact and the
    adjusted exponent of the result would be smaller (more negative) than
    the smallest value that can be handled by the implementation (the value
    Emin).  That is, the result is both inexact and subnormal.

    The result after an underflow will be a subnormal number rounded, if
    necessary, so that its exponent is not less than Etiny.  This may result
    in 0 with the sign of the intermediate result and an exponent of Etiny.

    In all cases, Inexact, Rounded, and Subnormal will also be raised.
    N)r1r2r3r4r'r'r'r)r�s
c@seZdZdZdS)ra�Enable stricter semantics for mixing floats and Decimals.

    If the signal is not trapped (default), mixing floats and Decimals is
    permitted in the Decimal() constructor, context.create_decimal() and
    all comparison operators. Both conversion and comparisons are exact.
    Any occurrence of a mixed operation is silently recorded by setting
    FloatOperation in the context flags.  Explicit conversions with
    Decimal.from_float() or context.create_decimal_from_float() do not
    set the flag.

    Otherwise (the signal is trapped), only equality comparisons and explicit
    conversions are silent. All other mixed operations raise FloatOperation.
    N)r1r2r3r4r'r'r'r)r�s
c@seZdZefdd�ZdS)�
MockThreadingcCs
|jtS)N)�modules�	__xname__)r.�sysr'r'r)�local�szMockThreading.localN)r1r2r3rErFr'r'r'r)rB�srB�__decimal_context__cCs,|tttfkr|j�}|j�|tj�_dS)z%Set this thread's context to context.N)rrr�copy�clear_flags�	threading�current_threadrG)r/r'r'r)r�scCs4y
tj�jStk
r.t�}|tj�_|SXdS)z�Returns this thread's context.

        If this thread does not yet have a context, returns
        a new context and sets this thread's context.
        New contexts are copies of DefaultContext.
        N)rJrKrG�AttributeErrorr)r/r'r'r)r�s

cCs,y|jStk
r&t�}||_|SXdS)z�Returns this thread's context.

        If this thread does not yet have a context, returns
        a new context and sets this thread's context.
        New contexts are copies of DefaultContext.
        N)rGrLr)�_localr/r'r'r)r�scCs(|tttfkr|j�}|j�||_dS)z%Set this thread's context to context.N)rrrrHrIrG)r/rMr'r'r)r�scCs|dkrt�}t|�S)abReturn a context manager for a copy of the supplied context

    Uses a copy of the current context if no context is specified
    The returned context manager creates a local decimal context
    in a with statement:
        def sin(x):
             with localcontext() as ctx:
                 ctx.prec += 2
                 # Rest of sin calculation algorithm
                 # uses a precision 2 greater than normal
             return +s  # Convert result to normal precision

         def sin(x):
             with localcontext(ExtendedContext):
                 # Rest of sin calculation algorithm
                 # uses the Extended Context from the
                 # General Decimal Arithmetic Specification
             return +s  # Convert result to normal context

    >>> setcontext(DefaultContext)
    >>> print(getcontext().prec)
    28
    >>> with localcontext():
    ...     ctx = getcontext()
    ...     ctx.prec += 2
    ...     print(ctx.prec)
    ...
    30
    >>> with localcontext(ExtendedContext):
    ...     print(getcontext().prec)
    ...
    9
    >>> print(getcontext().prec)
    28
    N)r�_ContextManager)Zctxr'r'r)r�s$c
@s�eZdZdZd�Zd�dd	�Zed
d��Zdd
�Zdd�Z	d�dd�Z
dd�Zdd�Zdd�Z
d�dd�Zd�dd�Zd�dd�Zd�dd�Zd�d d!�Zd�d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd�d-d.�Zd�d/d0�Z�dd1d2�Z�dd3d4�Z�dd6d7�Z�dd8d9�ZeZ�dd:d;�Z�dd<d=�Z �dd>d?�Z!e!Z"�dd@dA�Z#dBdC�Z$�ddDdE�Z%�d	dFdG�Z&�d
dHdI�Z'�ddJdK�Z(�ddLdM�Z)�d
dNdO�Z*�ddPdQ�Z+�ddRdS�Z,dTdU�Z-dVdW�Z.e.Z/dXdY�Z0e1e0�Z0dZd[�Z2e1e2�Z2d\d]�Z3d^d_�Z4d`da�Z5dbdc�Z6ddde�Z7dfdg�Z8dhdi�Z9djdk�Z:dldm�Z;dndo�Z<dpdq�Z=drds�Z>e?e7e8e9e:e;e<e=e>dt�Z@�ddudv�ZAdwdx�ZBdydz�ZC�dd{d|�ZD�dd}d~�ZEdd��ZF�dd�d��ZG�dd�d��ZH�dd�d��ZI�dd�d��ZJ�dd�d��ZKd�d��ZLd�d��ZM�dd�d��ZN�dd�d��ZOeOZP�dd�d��ZQ�dd�d��ZR�dd�d��ZSd�d��ZTd�d��ZUd�d��ZVd�d��ZW�dd�d��ZX�dd�d��ZY�dd�d��ZZd�d��Z[d�d��Z\�d d�d��Z]�d!d�d��Z^d�d��Z_d�d��Z`d�d��Zad�d��Zb�d"d�d��Zcd�d��Zdd�d��Zed�d��Zf�d#d�d��Zgd�d„Zhd�dĄZi�d$d�dƄZjd�dȄZk�d%d�dʄZl�d&d�d̄Zmd�d΄Znd�dЄZo�d'd�d҄Zp�d(d�dԄZq�d)d�dքZr�d*d�d؄Zs�d+d�dڄZt�d,d�d܄Zu�d-d�dބZv�d.d�d�Zw�d/d�d�Zx�d0d�d�Zyd�d�Zz�d1d�d�Z{�d2d�d�Z|�d3d�d�Z}d�d�Z~d�d�Zd�d�Z��d4d�d�Z�dS(5rz,Floating point class for decimal arithmetic.�_expr8r7�_is_special�0NcCs�tj|�}t|t��r$t|j�jdd��}|dkrP|dkr@t�}|jt	d|�S|j
d�dkrfd|_nd|_|j
d	�}|dk	r�|j
d
�p�d}t|j
d�p�d�}tt||��|_
|t|�|_d
|_nZ|j
d�}|dk	�rtt|p�d��jd�|_
|j
d��rd|_nd|_nd|_
d|_d|_|St|t��rf|dk�rBd|_nd|_d|_tt|��|_
d
|_|St|t��r�|j|_|j|_|j
|_
|j|_|St|t��r�|j|_t|j�|_
t|j�|_d
|_|St|ttf��r&t|�dk�r�td��t|dt��o|ddk�std��|d|_|ddk�rHd|_
|d|_d|_n�g}	x^|dD]R}
t|
t��r�d|
k�ozdkn�r�|	�s�|
dk�r�|	j|
�ntd���qVW|ddk�r�djtt|	��|_
|d|_d|_nDt|dt��rdjtt|	�pdg��|_
|d|_d
|_ntd��|St|t��r||dk�rBt�}|jtd�tj|�}|j|_|j|_|j
|_
|j|_|St d|��dS)a�Create a decimal point instance.

        >>> Decimal('3.14')              # string input
        Decimal('3.14')
        >>> Decimal((0, (3, 1, 4), -2))  # tuple (sign, digit_tuple, exponent)
        Decimal('3.14')
        >>> Decimal(314)                 # int
        Decimal('314')
        >>> Decimal(Decimal(314))        # another decimal instance
        Decimal('314')
        >>> Decimal('  3.14  \n')        # leading and trailing whitespace okay
        Decimal('3.14')
        �_�NzInvalid literal for Decimal: %rr=�-r-r%�intZfrac�exprQF�diag�signal�Nr5�FT�ztInvalid tuple size in creation of Decimal from list or tuple.  The list or tuple should have exactly three elements.z|Invalid sign.  The first value in the tuple should be an integer; either 0 for a positive number or 1 for a negative number.r+�	zTThe second value in the tuple must be composed of integers in the range 0 through 9.zUThe third value in the tuple must be an integer, or one of the strings 'F', 'n', 'N'.z;strict semantics for mixing floats and Decimals are enabledzCannot convert %r to Decimal)r%r-)r5rY)!�object�__new__�
isinstance�str�_parser�strip�replacer�_raise_errorr�groupr7rUr8�lenrOrP�lstrip�absr�_WorkRepr=rV�list�tuple�
ValueError�append�join�map�floatr�
from_float�	TypeError)�cls�valuer/r.�m�intpart�fracpartrVrW�digitsZdigitr'r'r)r^4s�







(



zDecimal.__new__cCs�t|t�r||�St|t�s$td��tj|�s8tj|�rD|t|��Stjd|�dkrZd}nd}t	|�j
�\}}|j�d}t|t
|d|�|�}|tkr�|S||�SdS)a.Converts a float to a decimal number, exactly.

        Note that Decimal.from_float(0.1) is not the same as Decimal('0.1').
        Since 0.1 is not exactly representable in binary floating point, the
        value is stored as the nearest representable value which is
        0x1.999999999999ap-4.  The exact equivalent of the value in decimal
        is 0.1000000000000000055511151231257827021181583404541015625.

        >>> Decimal.from_float(0.1)
        Decimal('0.1000000000000000055511151231257827021181583404541015625')
        >>> Decimal.from_float(float('nan'))
        Decimal('NaN')
        >>> Decimal.from_float(float('inf'))
        Decimal('Infinity')
        >>> Decimal.from_float(-float('inf'))
        Decimal('-Infinity')
        >>> Decimal.from_float(-0.0)
        Decimal('-0')

        zargument must be int or float.g�?r%r-�N)r_rUrprr�_mathZisinfZisnan�reprZcopysignrh�as_integer_ratio�
bit_lengthr6r`r)rs�fr=r5�d�k�resultr'r'r)rq�s

zDecimal.from_floatcCs(|jr$|j}|dkrdS|dkr$dSdS)zrReturns whether the number is not actually one.

        0 if a number
        1 if NaN
        2 if sNaN
        r5r-rYr+r%)rPrO)r.rVr'r'r)�_isnan�szDecimal._isnancCs|jdkr|jrdSdSdS)zyReturns whether the number is infinite

        0 if finite or not a number
        1 if +INF
        -1 if -INF
        rZr-r%���)rOr7)r.r'r'r)�_isinfinitys

zDecimal._isinfinitycCs||j�}|dkrd}n|j�}|s&|rx|dkr4t�}|dkrJ|jtd|�S|dkr`|jtd|�S|rn|j|�S|j|�SdS)z�Returns whether the number is not actually one.

        if self, other are sNaN, signal
        if self, other are NaN return nan
        return 0

        Done before operations.
        NFr+�sNaNr%)r�rrdr	r9)r.�otherr/�self_is_nan�other_is_nanr'r'r)�_check_nanss"


zDecimal._check_nanscCsv|dkrt�}|js|jrr|j�r0|jtd|�S|j�rF|jtd|�S|j�r\|jtd|�S|j�rr|jtd|�SdS)aCVersion of _check_nans used for the signaling comparisons
        compare_signal, __le__, __lt__, __ge__, __gt__.

        Signal InvalidOperation if either self or other is a (quiet
        or signaling) NaN.  Signaling NaNs take precedence over quiet
        NaNs.

        Return 0 if neither operand is a NaN.

        Nzcomparison involving sNaNzcomparison involving NaNr%)rrP�is_snanrdr	�is_qnan)r.r�r/r'r'r)�_compare_check_nans.s(zDecimal._compare_check_nanscCs|jp|jdkS)zuReturn True if self is nonzero; otherwise return False.

        NaNs and infinities are considered nonzero.
        rQ)rPr8)r.r'r'r)�__bool__OszDecimal.__bool__cCs|js|jr8|j�}|j�}||kr(dS||kr4dSdS|sP|sDdSd|jS|s^d|jS|j|jkrndS|j|jkr~dS|j�}|j�}||k�r�|jd|j|j}|jd|j|j}||kr�dS||kr�d	|jSd
|jSn ||k�rd|jSd|jSdS)
z�Compare the two non-NaN decimal instances self and other.

        Returns -1 if self < other, 0 if self == other and 1
        if self > other.  This routine is for internal use only.r%r-rQNr�r�r�r�r�r�r�r�)rPr�r7�adjustedr8rO)r.r�Zself_infZ	other_inf�
self_adjustedZother_adjusted�self_paddedZother_paddedr'r'r)�_cmpVs>



zDecimal._cmpcCs<t||dd�\}}|tkr|S|j||�r.dS|j|�dkS)NT)�equality_opFr%)�_convert_for_comparison�NotImplementedr�r�)r.r�r/r'r'r)�__eq__�szDecimal.__eq__cCs<t||�\}}|tkr|S|j||�}|r.dS|j|�dkS)NFr%)r�r�r�r�)r.r�r/r;r'r'r)�__lt__�szDecimal.__lt__cCs<t||�\}}|tkr|S|j||�}|r.dS|j|�dkS)NFr%)r�r�r�r�)r.r�r/r;r'r'r)�__le__�szDecimal.__le__cCs<t||�\}}|tkr|S|j||�}|r.dS|j|�dkS)NFr%)r�r�r�r�)r.r�r/r;r'r'r)�__gt__�szDecimal.__gt__cCs<t||�\}}|tkr|S|j||�}|r.dS|j|�dkS)NFr%)r�r�r�r�)r.r�r/r;r'r'r)�__ge__�szDecimal.__ge__cCs>t|dd�}|js|r0|jr0|j||�}|r0|St|j|��S)z�Compare self to other.  Return a decimal value:

        a or b is a NaN ==> Decimal('NaN')
        a < b           ==> Decimal('-1')
        a == b          ==> Decimal('0')
        a > b           ==> Decimal('1')
        T)�raiseit)�_convert_otherrPr�rr�)r.r�r/r;r'r'r)�compare�szDecimal.comparecCs�|jr4|j�rtd��n|j�r$tS|jr0tStS|jdkrNtd|jt	�}ntt
|jt	�}t|j�|t	}|dkr||n|}|dkr�dS|S)zx.__hash__() <==> hash(x)z"Cannot hash a signaling NaN value.r%�
r-r+r����)
rPr�rr�is_nan�_PyHASH_NANr7�_PyHASH_INFrO�pow�_PyHASH_MODULUS�
_PyHASH_10INVrUr8)r.Zexp_hashZhash_r;r'r'r)�__hash__�s

zDecimal.__hash__cCst|jttt|j��|j�S)zeRepresents the number as a triple tuple.

        To show the internals exactly as they are.
        )rr7rkrorUr8rO)r.r'r'r)�as_tuple�szDecimal.as_tuplecCs�|jr |j�rtd��ntd��|s(dSt|j�}|jdkrR|d|jd}}nr|j}x(|dkr�|ddkr�|d}|d8}q\W|j}t||@j�d|�}|r�||L}||8}d||>}|j	r�|}||fS)a�Express a finite Decimal instance in the form n / d.

        Returns a pair (n, d) of integers.  When called on an infinity
        or NaN, raises OverflowError or ValueError respectively.

        >>> Decimal('3.14').as_integer_ratio()
        (157, 50)
        >>> Decimal('-123e5').as_integer_ratio()
        (-12300000, 1)
        >>> Decimal('0.00').as_integer_ratio()
        (0, 1)

        z#cannot convert NaN to integer ratioz(cannot convert Infinity to integer ratior%r-r�ry)r%r-)
rPr�rl�
OverflowErrorrUr8rO�minr}r7)r.r5rZd5Zd2Zshift2r'r'r)r|�s,


zDecimal.as_integer_ratiocCsdt|�S)z0Represents the number as an instance of Decimal.z
Decimal('%s'))r`)r.r'r'r)�__repr__'szDecimal.__repr__Fc	Csdddg|j}|jrL|jdkr&|dS|jdkr>|d|jS|d|jS|jt|j�}|jdkrt|dkrt|}n6|s~d
}n,|jdkr�|d
dd
}n|d
dd
}|dkr�d}d
d||j}nN|t|j�k�r�|jd|t|j�}d}n |jd|�}d
|j|d�}||k�r*d}n*|dk�r:t�}ddg|jd||}||||S)z�Return string representation of the number in scientific notation.

        Captures all of the information in the underlying representation.
        rSrTrZZInfinityr5�NaNr�r%�r-rQr[�.N�e�Ez%+di����)r7rPrOr8rfr�capitals)	r.�engr/r=�
leftdigits�dotplacervrwrVr'r'r)�__str__,s:




zDecimal.__str__cCs|jd|d�S)a,Convert to a string, using engineering notation if an exponent is needed.

        Engineering notation has an exponent which is a multiple of 3.  This
        can leave up to 3 digits to the left of the decimal place and may
        require the addition of either one or two trailing zeros.
        T)r�r/)r�)r.r/r'r'r)�
to_eng_string`szDecimal.to_eng_stringcCsT|jr|j|d�}|r|S|dkr(t�}|rB|jtkrB|j�}n|j�}|j|�S)zRReturns a copy with the sign switched.

        Rounds, if it has reason.
        )r/N)rPr�rr?r�copy_abs�copy_negate�_fix)r.r/r;r'r'r)�__neg__is
zDecimal.__neg__cCsT|jr|j|d�}|r|S|dkr(t�}|rB|jtkrB|j�}nt|�}|j|�S)zhReturns a copy, unless it is a sNaN.

        Rounds the number (if more than precision digits)
        )r/N)rPr�rr?rr�rr�)r.r/r;r'r'r)�__pos__s
zDecimal.__pos__TcCsJ|s|j�S|jr&|j|d�}|r&|S|jr:|j|d�}n|j|d�}|S)z�Returns the absolute value of self.

        If the keyword argument 'round' is false, do not round.  The
        expression self.__abs__(round=False) is equivalent to
        self.copy_abs().
        )r/)r�rPr�r7r�r�)r.�roundr/r;r'r'r)�__abs__�szDecimal.__abs__c
Cslt|�}|tkr|S|dkr"t�}|js.|jr�|j||�}|rB|S|j�rr|j|jkrj|j�rj|jtd�St	|�S|j�r�t	|�St
|j|j�}d}|jt
kr�|j|jkr�d}|r�|r�t
|j|j�}|r�d}t|d|�}|j|�}|S|�s"t||j|jd�}|j||j�}|j|�}|S|�sZt||j|jd�}|j||j�}|j|�}|St|�}t|�}t|||j�\}}t�}	|j|jk�r�|j|jk�r�t|d|�}|j|�}|S|j|jk�r�||}}|jdk�r�d|	_|j|j|_|_nd|	_n&|jdk�rd|	_d\|_|_nd|	_|jdk�r@|j|j|	_n|j|j|	_|j|	_t	|	�}|j|�}|S)zbReturns self + other.

        -INF + INF (or the reverse) cause InvalidOperation errors.
        Nz
-INF + INFr%r-rQ)r%r%)r�r�rrPr�r�r7rdr	rr�rOr?rr6r��maxr@�_rescaleri�
_normalizer=rUrV)
r.r�r/r;rVZnegativezeror=�op1�op2r�r'r'r)�__add__�s|





zDecimal.__add__cCsHt|�}|tkr|S|js |jr6|j||d�}|r6|S|j|j�|d�S)zReturn self - other)r/)r�r�rPr�r�r�)r.r�r/r;r'r'r)�__sub__szDecimal.__sub__cCs"t|�}|tkr|S|j||d�S)zReturn other - self)r/)r�r�r�)r.r�r/r'r'r)�__rsub__szDecimal.__rsub__cCsDt|�}|tkr|S|dkr"t�}|j|jA}|js:|jr�|j||�}|rN|S|j�rn|sf|jtd�St	|S|j�r�|s�|jtd�St	|S|j
|j
}|s�|r�t|d|�}|j|�}|S|j
dkr�t||j
|�}|j|�}|S|j
dk�rt||j
|�}|j|�}|St|�}t|�}t|t|j|j�|�}|j|�}|S)z\Return self * other.

        (+-) INF * 0 (or its reverse) raise InvalidOperation.
        Nz(+-)INF * 0z0 * (+-)INFrQ�1)r�r�rr7rPr�r�rdr	r<rOr6r�r8rir`rU)r.r�r/Z
resultsignr;Z	resultexpr�r�r'r'r)�__mul__sH




zDecimal.__mul__cCs�t|�}|tkrtS|dkr"t�}|j|jA}|js:|jr�|j||�}|rN|S|j�rj|j�rj|jtd�S|j�rzt	|S|j�r�|jt
d�t|d|j��S|s�|s�|jt
d�S|jtd|�S|s�|j|j}d}n�t|j�t|j�|jd}|j|j|}t|�}t|�}	|dk�r:t|jd	||	j�\}}
nt|j|	jd	|�\}}
|
�rt|d
dk�r�|d7}n<|j|j}x.||k�r�|d	dk�r�|d	}|d7}�q�Wt|t|�|�}|j|�S)zReturn self / other.Nz(+-)INF/(+-)INFzDivision by infinityrQz0 / 0zx / 0r%r-r�ry)r�r�rr7rPr�r�rdr	r<rr6�Etinyrr
rOrfr8r@ri�divmodrUr`r�)r.r�r/r=r;rV�coeff�shiftr�r��	remainder�	ideal_expr'r'r)�__truediv__QsP

zDecimal.__truediv__cCs |j|jA}|j�r|j}nt|j|j�}|j�|j�}|sP|j�sP|dkrjt|dd�|j||j�fS||jk�rt	|�}t	|�}|j
|j
kr�|jd|j
|j
9_n|jd|j
|j
9_t|j|j�\}}	|d|jk�rt|t
|�d�t|jt
|	�|�fS|jtd�}
|
|
fS)z�Return (self // other, self % other), to context.prec precision.

        Assumes that neither self nor other is a NaN, that self is not
        infinite and that other is nonzero.
        r+rQr%r�z%quotient too large in //, % or divmodr�)r7r�rOr�r�r6r�r?r@rirVrUr�r`rdr)r.r�r/r=r��expdiffr�r��q�rr;r'r'r)�_divide�s*
zDecimal._dividecCs"t|�}|tkr|S|j||d�S)z)Swaps self/other and returns __truediv__.)r/)r�r�r�)r.r�r/r'r'r)�__rtruediv__�szDecimal.__rtruediv__cCs�t|�}|tkr|S|dkr"t�}|j||�}|r:||fS|j|jA}|j�r~|j�rj|jtd�}||fSt||jtd�fS|s�|s�|jt	d�}||fS|jt
d|�|jtd�fS|j||�\}}|j|�}||fS)z6
        Return (self // other, self % other)
        Nzdivmod(INF, INF)zINF % xzdivmod(0, 0)zx // 0zx % 0)
r�r�rr�r7r�rdr	r<rr
r�r�)r.r�r/r;r=Zquotientr�r'r'r)�
__divmod__�s0
zDecimal.__divmod__cCs"t|�}|tkr|S|j||d�S)z(Swaps self/other and returns __divmod__.)r/)r�r�r�)r.r�r/r'r'r)�__rdivmod__�szDecimal.__rdivmod__cCs�t|�}|tkr|S|dkr"t�}|j||�}|r6|S|j�rJ|jtd�S|sj|r^|jtd�S|jtd�S|j||�d}|j	|�}|S)z
        self % other
        NzINF % xzx % 0z0 % 0r-)
r�r�rr�r�rdr	rr�r�)r.r�r/r;r�r'r'r)�__mod__�s"
zDecimal.__mod__cCs"t|�}|tkr|S|j||d�S)z%Swaps self/other and returns __mod__.)r/)r�r�r�)r.r�r/r'r'r)�__rmod__�szDecimal.__rmod__cCs�|dkrt�}t|dd�}|j||�}|r.|S|j�rB|jtd�S|sb|rV|jtd�S|jtd�S|j�r|t|�}|j|�St	|j
|j
�}|s�t|jd|�}|j|�S|j
�|j
�}||jdkr�|jt�S|dkr�|j||j�}|j|�St|�}t|�}|j|jk�r(|jd
|j|j9_n|jd
|j|j9_t|j|j�\}}	d	|	|d@|jk�r~|	|j8}	|d7}|d
|jk�r�|jt�S|j}
|	dk�r�d|
}
|	}	t|
t|	�|�}|j|�S)
zI
        Remainder nearest to 0-  abs(remainder-near) <= other/2
        NT)r�zremainder_near(infinity, x)zremainder_near(x, 0)zremainder_near(0, 0)rQr-r+r�r%r�)rr�r�r�rdr	rrr�r�rOr6r7r�r@rr�r?rirVrUr�r`)r.r�r/r;�ideal_exponentr�r�r�r�r�r=r'r'r)�remainder_nearsZ






zDecimal.remainder_nearcCs�t|�}|tkr|S|dkr"t�}|j||�}|r6|S|j�rb|j�rR|jtd�St|j|jAS|s�|r�|jt	d|j|jA�S|jt
d�S|j||�dS)z
self // otherNz
INF // INFzx // 0z0 // 0r%)r�r�rr�r�rdr	r<r7r
rr�)r.r�r/r;r'r'r)�__floordiv__Ls$zDecimal.__floordiv__cCs"t|�}|tkr|S|j||d�S)z*Swaps self/other and returns __floordiv__.)r/)r�r�r�)r.r�r/r'r'r)�
__rfloordiv__hszDecimal.__rfloordiv__cCs8|j�r(|j�rtd��|jr"dnd}nt|�}t|�S)zFloat representation.z%Cannot convert signaling NaN to floatz-nan�nan)r�r�rlr7r`rp)r.�sr'r'r)�	__float__oszDecimal.__float__cCst|jr(|j�rtd��n|j�r(td��d|j}|jdkrT|t|j�d|jS|t|jd|j�pjd�SdS)	z1Converts self to an int, truncating if necessary.zCannot convert NaN to integerz"Cannot convert infinity to integerr-r%r�NrQr�)	rPr�rlr�r�r7rOrUr8)r.r�r'r'r)�__int__ys


zDecimal.__int__cCs|S)Nr')r.r'r'r)�real�szDecimal.realcCstd�S)Nr%)r)r.r'r'r)�imag�szDecimal.imagcCs|S)Nr')r.r'r'r)�	conjugate�szDecimal.conjugatecCstt|��S)N)�complexrp)r.r'r'r)�__complex__�szDecimal.__complex__cCsR|j}|j|j}t|�|krJ|t|�|d�jd�}t|j||jd�St|�S)z2Decapitate the payload of a NaN to fit the contextNrQT)	r8r@�clamprfrgr6r7rOr)r.r/ZpayloadZmax_payload_lenr'r'r)r9�szDecimal._fix_nancCsX|jr |j�r|j|�St|�S|j�}|j�}|s�|j|g|j}tt	|j
|�|�}||j
krx|jt�t
|jd|�St|�St|j�|j
|j}||kr�|jtd|j�}|jt�|jt�|S||k}|r�|}|j
|k�r�t|j�|j
|}	|	dk�rt
|jd|d�}d}	|j|j}
|
||	�}|jd|	��p>d}|dk�r~tt|�d�}t|�|jk�r~|dd�}|d7}||k�r�|jtd|j�}nt
|j||�}|�r�|�r�|jt�|�r�|jt�|�r�|jt�|jt�|�s�|jt�|S|�r|jt�|jdk�rP|j
|k�rP|jt�|jd|j
|}
t
|j|
|�St|�S)z�Round if it is necessary to keep self within prec precision.

        Rounds and fixes the exponent.  Does not raise on a sNaN.

        Arguments:
        self - Decimal instance
        context - context used.
        rQz
above Emaxr%r�r-Nr�)rPr�r9rr��EtoprAr�r�r�rOrdrr6r7rfr8r@rrr�_pick_rounding_functionr?r`rUrr
)r.r/r�r��exp_maxZnew_expZexp_minr;Zself_is_subnormalrxZrounding_method�changedr�r�r'r'r)r��sn
















zDecimal._fixcCst|j|�rdSdSdS)z(Also known as round-towards-0, truncate.r%r-Nr�)�
_all_zerosr8)r.r@r'r'r)�_round_downszDecimal._round_downcCs|j|�S)zRounds away from 0.)r�)r.r@r'r'r)�	_round_upszDecimal._round_upcCs*|j|dkrdSt|j|�r"dSdSdS)zRounds 5 up (away from 0)Z56789r-r%Nr�)r8r�)r.r@r'r'r)�_round_half_ups
zDecimal._round_half_upcCst|j|�rdS|j|�SdS)zRound 5 downr-Nr�)�_exact_halfr8r�)r.r@r'r'r)�_round_half_downszDecimal._round_half_downcCs8t|j|�r*|dks&|j|ddkr*dS|j|�SdS)z!Round 5 to even, rest to nearest.r%r-�02468Nr�)r�r8r�)r.r@r'r'r)�_round_half_even#szDecimal._round_half_evencCs |jr|j|�S|j|�SdS)z(Rounds up (not away from 0 if negative.)N)r7r�)r.r@r'r'r)�_round_ceiling+s
zDecimal._round_ceilingcCs |js|j|�S|j|�SdS)z'Rounds down (not towards 0 if negative)N)r7r�)r.r@r'r'r)�_round_floor2s
zDecimal._round_floorcCs0|r |j|ddkr |j|�S|j|�SdS)z)Round down unless digit prec-1 is 0 or 5.r-Z05N)r8r�)r.r@r'r'r)�_round_05up9s
zDecimal._round_05up)rrrrrrrrcCsb|dk	r2t|t�std��tdd|�}|j|�S|jrR|j�rJtd��ntd��t|j	dt
��S)a�Round self to the nearest integer, or to a given precision.

        If only one argument is supplied, round a finite Decimal
        instance self to the nearest integer.  If self is infinite or
        a NaN then a Python exception is raised.  If self is finite
        and lies exactly halfway between two integers then it is
        rounded to the integer with even last digit.

        >>> round(Decimal('123.456'))
        123
        >>> round(Decimal('-456.789'))
        -457
        >>> round(Decimal('-3.0'))
        -3
        >>> round(Decimal('2.5'))
        2
        >>> round(Decimal('3.5'))
        4
        >>> round(Decimal('Inf'))
        Traceback (most recent call last):
          ...
        OverflowError: cannot round an infinity
        >>> round(Decimal('NaN'))
        Traceback (most recent call last):
          ...
        ValueError: cannot round a NaN

        If a second argument n is supplied, self is rounded to n
        decimal places using the rounding mode for the current
        context.

        For an integer n, round(self, -n) is exactly equivalent to
        self.quantize(Decimal('1En')).

        >>> round(Decimal('123.456'), 0)
        Decimal('123')
        >>> round(Decimal('123.456'), 2)
        Decimal('123.46')
        >>> round(Decimal('123.456'), -2)
        Decimal('1E+2')
        >>> round(Decimal('-Infinity'), 37)
        Decimal('NaN')
        >>> round(Decimal('sNaN123'), 0)
        Decimal('NaN123')

        Nz+Second argument to round should be integralr%r�zcannot round a NaNzcannot round an infinity)r_rUrrr6�quantizerPr�rlr�r�r)r.r5rVr'r'r)�	__round__Ks/


zDecimal.__round__cCs0|jr |j�rtd��ntd��t|jdt��S)z�Return the floor of self, as an integer.

        For a finite Decimal instance self, return the greatest
        integer n such that n <= self.  If self is infinite or a NaN
        then a Python exception is raised.

        zcannot round a NaNzcannot round an infinityr%)rPr�rlr�rUr�r)r.r'r'r)�	__floor__�s

zDecimal.__floor__cCs0|jr |j�rtd��ntd��t|jdt��S)z�Return the ceiling of self, as an integer.

        For a finite Decimal instance self, return the least integer n
        such that n >= self.  If self is infinite or a NaN then a
        Python exception is raised.

        zcannot round a NaNzcannot round an infinityr%)rPr�rlr�rUr�r)r.r'r'r)�__ceil__�s

zDecimal.__ceil__cCst|dd�}t|dd�}|js$|jr�|dkr2t�}|jdkrJ|jtd|�S|jdkrb|jtd|�S|jdkrr|}nf|jdkr�|}nV|jdkr�|s�|jtd�St|j|jA}n*|jdkr�|s�|jtd	�St|j|jA}n0t|j|jAt	t
|j�t
|j��|j|j�}|j||�S)
a:Fused multiply-add.

        Returns self*other+third with no rounding of the intermediate
        product self*other.

        self and other are multiplied together, with no rounding of
        the result.  The third operand is then added to the result,
        and a single final rounding is performed.
        T)r�NrYr�r5rZzINF * 0 in fmaz0 * INF in fma)
r�rPrrOrdr	r<r7r6r`rUr8r�)r.r�Zthirdr/�productr'r'r)�fma�s6





zDecimal.fmacCs�t|�}|tkr|St|�}|tkr(|S|dkr6t�}|j�}|j�}|j�}|sZ|sZ|r�|dkrp|jtd|�S|dkr�|jtd|�S|dkr�|jtd|�S|r�|j|�S|r�|j|�S|j|�S|j�o�|j�o�|j�s�|jtd�S|dkr�|jtd�S|�s|jtd�S|j�|j	k�r(|jtd�S|�rD|�rD|jtd	�S|j
��rTd}n|j}tt
|��}t|j��}t|j��}	|j
|td
|j|�|}x t|	j�D]}
t|d
|�}�q�Wt||	j
|�}t|t|�d�S)z!Three argument version of __pow__Nr+r�z@pow() 3rd argument not allowed unless all arguments are integersr%zApow() 2nd argument cannot be negative when 3rd argument specifiedzpow() 3rd argument cannot be 0zSinsufficient precision: pow() 3rd argument must not have more than precision digitszXat least one of pow() 1st argument and 2nd argument must be nonzero; 0**0 is not definedr�)r�r�rr�rdr	r9�
_isintegerr�r@�_isevenr7rhrUri�to_integral_valuer�rV�ranger6r`)r.r��modulor/r�r�Z
modulo_is_nanr=�base�exponent�ir'r'r)�
_power_modulo�sl



zDecimal._power_modulocCst|�}|j|j}}x |ddkr6|d}|d7}qWt|�}|j|j}}x |ddkrn|d}|d7}qPW|dk�r||9}x |ddkr�|d}|d7}q�W|dkr�dS|d|}	|jdkr�|	}	|j�o�|jdk�r|jt|�}
t|	|
|d�}nd}tddd||	|�S|jdk�r�|d}|dk�r�||@|k�rPdSt	|�d}
|dd}|t
t|��k�r~dSt|
||�}
t|||�}|
dk�s�|dk�r�dS|
|k�r�dSd
|
}n�|d
k�r�t	|�dd}
t
d
|
|�\}}|�rdSx$|d
dk�r$|d
}|
d8}
�qW|dd}|t
t|��k�rHdSt|
||�}
t|||�}|
dk�sx|dk�r|dS|
|k�r�dSd|
}ndS|d|k�r�dS|
|}tdt|�|�S|dk�r�|d|d}}n�|dk�rt
tt||���|k�rdSt	|�}|dk�r>t
tt|�|��|k�r>dS|d|}}x:|d|dk�oldkn�r�|d}|d}�qPWx:|d
|d
k�o�dkn�r�|d
}|d
}�q�W|dk�rt|dk�r�||k�r�dSt
||�\}}|dk�rdSdt	|�|>}x>t
|||d�\}}||k�r>Pn||d||}�qW||k�oh|dk�spdS|}|dk�r�||dt|�k�r�dS||}||9}|d|k�r�dSt|�}|j��r�|jdk�r�|jt|�}
t||
|t
|��}nd}td|d|||�S)ahAttempt to compute self**other exactly.

        Given Decimals self and other and an integer p, attempt to
        compute an exact result for the power self**other, with p
        digits of precision.  Return None if self**other is not
        exactly representable in p digits.

        Assumes that elimination of special cases has already been
        performed: self and other must both be nonspecial; self must
        be positive and not numerically equal to 1; other must be
        nonzero.  For efficiency, other._exp should not be too large,
        so that 10**abs(other._exp) is a feasible calculation.r�r%r-Nr�rQr+�r���]�Ary�r[�d)r+rr�r)rirUrVr=r�r7rOr�r6�_nbitsrfr`�_decimal_lshift_exactr�rh�	_log10_lb)r.r��p�x�xc�xe�y�yc�yer�r�ZzerosZ
last_digitr�Zemaxr�rur5Zxc_bits�rem�ar�r�Zstr_xcr'r'r)�_power_exact(s�:









&&&&


 zDecimal._power_exactcCs@|dk	r|j|||�St|�}|tkr*|S|dkr8t�}|j||�}|rL|S|sd|s`|jtd�StSd}|jdkr�|j	�r�|j
�s�d}n|r�|jtd�S|j�}|s�|jdkr�t|dd�St
|S|j�r�|jdkr�t
|St|dd�S|tk�r�|j	��rZ|jdk�rd}n||jk�r"|j}nt|�}|j|}|d|jk�rxd|j}|jt�n|jt�|jt�d|j}t|dd||�S|j�}|j��r�|jdk|dkk�r�t|dd�St
|Sd}d}	|j�|j�}
|dk|jdkk�r|
tt|j��k�rHt|d|jd�}n,|j�}|
tt|��k�rHt|d|d�}|dk�r�|j||jd�}|dk	�r�|dk�r�td|j|j�}d	}	|dk�r:|j}t|�}
|
j|
j}}t|�}|j|j}}|jdk�r�|}d
}xJt||||||�\}}|ddtt|��|d�rP|d
7}�q�Wt|t|�|�}|	�r2|j	��r2t|j�|jk�r�|jdt|j�}t|j|jd||j|�}|j �}|j!�xt"D]}d|j#|<�q�W|j$|�}|jt�|j%t&�r�|jt'�|j%t(�r|jt(d
|j�x:t't&ttt)fD]}|j%|�r|j|��qWn
|j$|�}|S)aHReturn self ** other [ % modulo].

        With two arguments, compute self**other.

        With three arguments, compute (self**other) % modulo.  For the
        three argument form, the following restrictions on the
        arguments hold:

         - all three arguments must be integral
         - other must be nonnegative
         - either self or other (or both) must be nonzero
         - modulo must be nonzero and must have at most p digits,
           where p is the context precision.

        If any of these restrictions is violated the InvalidOperation
        flag is raised.

        The result of pow(self, other, modulo) is identical to the
        result that would be obtained by computing (self**other) %
        modulo with unbounded precision, but is computed more
        efficiently.  It is always exact.
        Nz0 ** 0r%r-z+x ** y with x negative and y not an integerrQr�FTr[ryr�z
above Emax)*rr�r�rr�rdr	�_Oner7r�r�r�r6r<r�r@rUrOrrr��_log10_exp_boundrfr`rAr�rr8rirVr=�_dpowerrHrI�_signals�trapsr��flagsr
rrr)r.r�r�r/r;Zresult_signZ
multiplierrVZself_adj�exactZboundr�rrr
rrrr�extrar�r�Z
newcontextZ	exceptionr'r'r)�__pow__	s�














"




zDecimal.__pow__cCs"t|�}|tkr|S|j||d�S)z%Swaps self/other and returns __pow__.)r/)r�r�r)r.r�r/r'r'r)�__rpow__�	szDecimal.__rpow__cCs�|dkrt�}|jr(|j|d�}|r(|S|j|�}|j�r>|S|sPt|jdd�S|j|j�g|j	}t
|j�}|j}x.|j|ddkr�||kr�|d7}|d8}qvWt|j|jd|�|�S)z?Normalize- strip trailing 0s, change anything equal to 0 to 0e0N)r/rQr%r-)
rrPr�r�r�r6r7rAr�r�rfr8rO)r.r/r;�dupr��endrVr'r'r)�	normalize�	s$

zDecimal.normalizecCs�t|dd�}|dkrt�}|dkr(|j}|js4|jr||j||�}|rH|S|j�sX|j�r||j�rp|j�rpt|�S|jtd�S|j	�|j
ko�|jkns�|jtd�S|s�t|j
d|j
�}|j|�S|j�}||jkr�|jtd�S||j
d|jk�r|jtd	�S|j|j
|�}|j�|jk�r0|jtd�St|j�|jk�rN|jtd	�S|�rn|j�|jk�rn|jt�|j
|j
k�r�||k�r�|jt�|jt�|j|�}|S)
z�Quantize self so its exponent is the same as that of exp.

        Similar to self._rescale(exp._exp) but with error checking.
        T)r�Nzquantize with one INFz)target exponent out of bounds in quantizerQz9exponent of quantize result too large for current contextr-z7quantize result has too many digits for current context)r�rr?rPr�r�rrdr	r�rOrAr6r7r�r�r@r�rfr8�Eminr
rr)r.rVr?r/r;r�r'r'r)r�
sT 






zDecimal.quantizecCsDt|dd�}|js|jr8|j�r(|j�p6|j�o6|j�S|j|jkS)a=Return True if self and other have the same exponent; otherwise
        return False.

        If either operand is a special value, the following rules are used:
           * return True if both operands are infinities
           * return True if both operands are NaNs
           * otherwise, return False.
        T)r�)r�rPr��is_infiniterO)r.r�r/r'r'r)�same_quantumJ
s
	zDecimal.same_quantumcCs�|jrt|�S|s t|jd|�S|j|krHt|j|jd|j||�St|j�|j|}|dkrzt|jd|d�}d}|j|}|||�}|jd|�p�d}|dkr�tt	|�d�}t|j||�S)asRescale self so that the exponent is exp, either by padding with zeros
        or by truncating digits, using the given rounding mode.

        Specials are returned without change.  This operation is
        quiet: it raises no flags, and uses no information from the
        context.

        exp = exp to scale to (an integer)
        rounding = rounding mode
        rQr%r�r-N)
rPrr6r7rOr8rfr�r`rU)r.rVr?rxZ
this_functionr�r�r'r'r)r�Y
s"


zDecimal._rescalecCsh|dkrtd��|js|r$t|�S|j|j�d||�}|j�|j�krd|j|j�d||�}|S)a"Round a nonzero, nonspecial Decimal to a fixed number of
        significant figures, using the given rounding mode.

        Infinities, NaNs and zeros are returned unaltered.

        This operation is quiet: it raises no flags, and uses no
        information from the context.

        r%z'argument should be at least 1 in _roundr-)rlrPrr�r�)r.�placesr?r;r'r'r)�_round{
s
zDecimal._roundcCs�|jr"|j|d�}|r|St|�S|jdkr4t|�S|sFt|jdd�S|dkrTt�}|dkrb|j}|jd|�}||kr�|j	t
�|j	t�|S)aVRounds to a nearby integer.

        If no rounding mode is specified, take the rounding mode from
        the context.  This method raises the Rounded and Inexact flags
        when appropriate.

        See also: to_integral_value, which does exactly the same as
        this method except that it doesn't raise Inexact or Rounded.
        )r/r%rQN)rPr�rrOr6r7rr?r�rdrr)r.r?r/r;r'r'r)�to_integral_exact�
s$



zDecimal.to_integral_exactcCs`|dkrt�}|dkr|j}|jr>|j|d�}|r6|St|�S|jdkrPt|�S|jd|�SdS)z@Rounds to the nearest integer, without raising inexact, rounded.N)r/r%)rr?rPr�rrOr�)r.r?r/r;r'r'r)r��
s
zDecimal.to_integral_valuecCs�|dkrt�}|jrB|j|d�}|r(|S|j�rB|jdkrBt|�S|sdt|jd|jd�}|j|�S|jdkrz|j	t
d�S|jd}t|�}|j
d?}|j
d@r�|jd}t|j�d?d}n|j}t|j�dd?}||}|dkr�|d	|9}d
}	nt|d	|�\}}
|
}	||8}d|}x(||}||k�r:Pn||d?}�q$W|	�o\|||k}	|	�r�|dk�r||d|}n|d|9}||7}n|ddk�r�|d7}tdt|�|�}|j�}|jt�}
|j|�}|
|_|S)zReturn the square root of self.N)r/r%rQr+r-zsqrt(-x), x > 0r�rTry)rrPr�r�r7rr6rOr�rdr	r@rirVrUrfr8r�r`�
_shallow_copy�
_set_roundingrr?)r.r/r;r@�opr��c�lr�rr�r5r�r?r'r'r)�sqrt�
s`










zDecimal.sqrtcCs�t|dd�}|dkrt�}|js&|jr~|j�}|j�}|s>|r~|dkrX|dkrX|j|�S|dkrr|dkrr|j|�S|j||�S|j|�}|dkr�|j|�}|dkr�|}n|}|j|�S)z�Returns the larger value.

        Like max(self, other) except if one is not a number, returns
        NaN (and signals if one is sNaN).  Also rounds.
        T)r�Nr-r%r�)r�rrPr�r�r�r��
compare_total)r.r�r/�sn�onr+r;r'r'r)r�%s&


	
zDecimal.maxcCs�t|dd�}|dkrt�}|js&|jr~|j�}|j�}|s>|r~|dkrX|dkrX|j|�S|dkrr|dkrr|j|�S|j||�S|j|�}|dkr�|j|�}|dkr�|}n|}|j|�S)z�Returns the smaller value.

        Like min(self, other) except if one is not a number, returns
        NaN (and signals if one is sNaN).  Also rounds.
        T)r�Nr-r%r�)r�rrPr�r�r�r�r.)r.r�r/r/r0r+r;r'r'r)r�Os&



zDecimal.mincCs8|jr
dS|jdkrdS|j|jd�}|dt|�kS)z"Returns whether self is an integerFr%TNrQ)rPrOr8rf)r.�restr'r'r)r�qs
zDecimal._isintegercCs(|s|jdkrdS|jd|jdkS)z:Returns True if self is even.  Assumes self is an integer.r%Tr-r�r�)rOr8)r.r'r'r)r�zszDecimal._isevencCs.y|jt|j�dStk
r(dSXdS)z$Return the adjusted exponent of selfr-r%N)rOrfr8rr)r.r'r'r)r��szDecimal.adjustedcCs|S)z�Returns the same Decimal object.

        As we do not have different encodings for the same number, the
        received object already is in its canonical form.
        r')r.r'r'r)�	canonical�szDecimal.canonicalcCs.t|dd�}|j||�}|r |S|j||d�S)z�Compares self to the other operand numerically.

        It's pretty much like compare(), but all NaNs signal, with signaling
        NaNs taking precedence over quiet NaNs.
        T)r�)r/)r�r�r�)r.r�r/r;r'r'r)�compare_signal�s
zDecimal.compare_signalcCsft|dd�}|jr|jrtS|jr0|jr0tS|j}|j�}|j�}|sP|�r||kr�t|j�|jf}t|j�|jf}||kr�|r�tStS||kr�|r�tStStS|r�|dkr�tS|dkr�tS|dkr�tS|dkr�tSn4|dkr�tS|dkr�tS|dk�rtS|dk�rtS||k�rtS||k�r*tS|j|jk�rF|�rBtStS|j|jk�rb|�r^tStStS)z�Compares self to other using the abstract representations.

        This is not like the standard compare, which use their numerical
        value. Note that a total ordering is defined for all possible abstract
        representations.
        T)r�r-r+)	r�r7�_NegativeOnerr�rfr8�_ZerorO)r.r�r/r=Zself_nanZ	other_nanZself_keyZ	other_keyr'r'r)r.�sf




zDecimal.compare_totalcCs&t|dd�}|j�}|j�}|j|�S)z�Compares self to other using abstract repr., ignoring sign.

        Like compare_total, but with operand's sign ignored and assumed to be 0.
        T)r�)r�r�r.)r.r�r/r��or'r'r)�compare_total_mag�szDecimal.compare_total_magcCstd|j|j|j�S)z'Returns a copy with the sign set to 0. r%)r6r8rOrP)r.r'r'r)r��szDecimal.copy_abscCs2|jrtd|j|j|j�Std|j|j|j�SdS)z&Returns a copy with the sign inverted.r%r-N)r7r6r8rOrP)r.r'r'r)r��szDecimal.copy_negatecCs"t|dd�}t|j|j|j|j�S)z$Returns self with the sign of other.T)r�)r�r6r7r8rOrP)r.r�r/r'r'r)�	copy_sign�s
zDecimal.copy_signcCs�|dkrt�}|j|d�}|r"|S|j�dkr2tS|s:tS|j�dkrNt|�S|j}|j�}|jdkr�|t	t
|jdd��kr�tdd|jd�}�n0|jdkr�|t	t
|j
�dd��kr�tdd|j
�d�}n�|jdko�||k�r
tddd|dd|�}n�|jdk�rB||dk�rBtdd|d|d�}n�t|�}|j|j}}|jdk�rj|}d}xFt||||�\}	}
|	d	d
t	t
|	��|d�r�P|d7}�qpWtdt
|	�|
�}|j�}|jt�}|j|�}||_|S)zReturns e ** self.N)r/r-r%r[r�rQr>ryr�r�)rr�r�r5rrr@r�r7rfr`rAr6r�rirUrVr=�_dexpr(r)rr�r?)r.r/r;r�adjr*r+r�rr�rVr?r'r'r)rVsJ$( "

zDecimal.expcCsdS)z�Return True if self is canonical; otherwise return False.

        Currently, the encoding of a Decimal instance is always
        canonical, so this method returns True for any Decimal.
        Tr')r.r'r'r)�is_canonicalLszDecimal.is_canonicalcCs|jS)z�Return True if self is finite; otherwise return False.

        A Decimal instance is considered finite if it is neither
        infinite nor a NaN.
        )rP)r.r'r'r)�	is_finiteTszDecimal.is_finitecCs
|jdkS)z8Return True if self is infinite; otherwise return False.rZ)rO)r.r'r'r)r#\szDecimal.is_infinitecCs
|jdkS)z>Return True if self is a qNaN or sNaN; otherwise return False.r5rY)r5rY)rO)r.r'r'r)r�`szDecimal.is_nancCs,|js|rdS|dkrt�}|j|j�kS)z?Return True if self is a normal number; otherwise return False.FN)rPrr"r�)r.r/r'r'r)�	is_normalds
zDecimal.is_normalcCs
|jdkS)z;Return True if self is a quiet NaN; otherwise return False.r5)rO)r.r'r'r)r�lszDecimal.is_qnancCs
|jdkS)z8Return True if self is negative; otherwise return False.r-)r7)r.r'r'r)�	is_signedpszDecimal.is_signedcCs
|jdkS)z?Return True if self is a signaling NaN; otherwise return False.rY)rO)r.r'r'r)r�tszDecimal.is_snancCs,|js|rdS|dkrt�}|j�|jkS)z9Return True if self is subnormal; otherwise return False.FN)rPrr�r")r.r/r'r'r)�is_subnormalxs
zDecimal.is_subnormalcCs|jo|jdkS)z6Return True if self is a zero; otherwise return False.rQ)rPr8)r.r'r'r)�is_zero�szDecimal.is_zerocCs�|jt|j�d}|dkr4tt|dd��dS|dkrXttd|dd��dSt|�}|j|j}}|dkr�t|d|�}t|�}t|�t|�||kS|ttd||��dS)z�Compute a lower bound for the adjusted exponent of self.ln().
        In other words, compute r such that self.ln() >= 10**r.  Assumes
        that self is finite and positive and that self != 1.
        r-�r�r+r%r�r�)rOrfr8r`rirUrV)r.r:r*r+r��num�denr'r'r)�
_ln_exp_bound�szDecimal._ln_exp_boundc
Cs|dkrt�}|j|d�}|r"|S|s*tS|j�dkr:tS|tkrFtS|jdkr\|jt	d�St
|�}|j|j}}|j
}||j�d}x>t|||�}|ddttt|���|dr�P|d7}q�Wtt|d	k�tt|��|�}|j�}|jt�}	|j|�}|	|_|S)
z/Returns the natural (base e) logarithm of self.N)r/r-zln of a negative valuer+ryr�r[r%)rr��_NegativeInfinityr��	_Infinityrr5r7rdr	rirUrVr@rD�_dlogrfr`rhr6r(r)rr�r?)
r.r/r;r*r+r�rr%r�r?r'r'r)�ln�s:
$

z
Decimal.lncCs�|jt|j�d}|dkr,tt|��dS|dkrHttd|��dSt|�}|j|j}}|dkr�t|d|�}td|�}t|�t|�||kdStd||�}t|�||dkdS)	z�Compute a lower bound for the adjusted exponent of self.log10().
        In other words, find r such that self.log10() >= 10**r.
        Assumes that self is finite and positive and that self != 1.
        r-r+r%r���Z231r�r�)rOrfr8r`rirUrV)r.r:r*r+r�rBrCr'r'r)r�szDecimal._log10_exp_boundc
CsH|dkrt�}|j|d�}|r"|S|s*tS|j�dkr:tS|jdkrP|jtd�S|jddkr�|jdd�dt	|j�dkr�t
|jt	|j�d�}n�t|�}|j
|j}}|j}||j�d}x>t|||�}|d	d
t	tt|���|dr�P|d7}q�Wtt
|dk�tt|��|�}|j�}|jt�}	|j|�}|	|_|S)z&Returns the base 10 logarithm of self.N)r/r-zlog10 of a negative valuer%r�rQr+ryr�r[)rr�rEr�rFr7rdr	r8rfrrOrirUrVr@r�_dlog10r`rhr6r(r)rr�r?)
r.r/r;r*r+r�rr%r�r?r'r'r)�log10�s:
.$

z
Decimal.log10cCsV|j|d�}|r|S|dkr"t�}|j�r.tS|s@|jtdd�St|j��}|j|�S)aM Returns the exponent of the magnitude of self's MSD.

        The result is the integer which is the exponent of the magnitude
        of the most significant digit of self (as though it were truncated
        to a single digit while maintaining the value of that digit and
        without limiting the resulting exponent).
        )r/Nzlogb(0)r-)	r�rr�rFrdr
rr�r�)r.r/r;r'r'r)�logb 
s	zDecimal.logbcCs8|jdks|jdkrdSx|jD]}|dkr dSq WdS)z�Return True if self is a logical operand.

        For being logical, it must be a finite number with a sign of 0,
        an exponent of 0, and a coefficient whose digits must all be
        either 0 or 1.
        r%FZ01T)r7rOr8)r.�digr'r'r)�
_islogical>
szDecimal._islogicalcCs�|jt|�}|dkr$d||}n|dkr<||jd�}|jt|�}|dkr`d||}n|dkrx||jd�}||fS)Nr%rQ)r@rf)r.r/�opa�opbZdifr'r'r)�
_fill_logicalL
szDecimal._fill_logicalcCs~|dkrt�}t|dd�}|j�s.|j�r8|jt�S|j||j|j�\}}djdd�t||�D��}t	d|j
d�pxdd�S)	z;Applies an 'and' operation between self and other's digits.NT)r�rScSs$g|]\}}tt|�t|�@��qSr')r`rU)�.0r�br'r'r)�
<listcomp>g
sz'Decimal.logical_and.<locals>.<listcomp>r%rQ)rr�rNrdr	rQr8rn�zipr6rg)r.r�r/rOrPr�r'r'r)�logical_andY
s
zDecimal.logical_andcCs(|dkrt�}|jtdd|jd�|�S)zInvert all its digits.Nr%r�)r�logical_xorr6r@)r.r/r'r'r)�logical_invertj
szDecimal.logical_invertcCs~|dkrt�}t|dd�}|j�s.|j�r8|jt�S|j||j|j�\}}djdd�t||�D��}t	d|j
d�pxdd�S)	z:Applies an 'or' operation between self and other's digits.NT)r�rScSs$g|]\}}tt|�t|�B��qSr')r`rU)rRrrSr'r'r)rT
sz&Decimal.logical_or.<locals>.<listcomp>r%rQ)rr�rNrdr	rQr8rnrUr6rg)r.r�r/rOrPr�r'r'r)�
logical_orq
s
zDecimal.logical_orcCs~|dkrt�}t|dd�}|j�s.|j�r8|jt�S|j||j|j�\}}djdd�t||�D��}t	d|j
d�pxdd�S)	z;Applies an 'xor' operation between self and other's digits.NT)r�rScSs$g|]\}}tt|�t|�A��qSr')r`rU)rRrrSr'r'r)rT�
sz'Decimal.logical_xor.<locals>.<listcomp>r%rQ)rr�rNrdr	rQr8rnrUr6rg)r.r�r/rOrPr�r'r'r)rW�
s
zDecimal.logical_xorcCs�t|dd�}|dkrt�}|js&|jr~|j�}|j�}|s>|r~|dkrX|dkrX|j|�S|dkrr|dkrr|j|�S|j||�S|j�j|j��}|dkr�|j|�}|dkr�|}n|}|j|�S)z8Compares the values numerically with their sign ignored.T)r�Nr-r%r�)	r�rrPr�r�r�r�r�r.)r.r�r/r/r0r+r;r'r'r)�max_mag�
s&


zDecimal.max_magcCs�t|dd�}|dkrt�}|js&|jr~|j�}|j�}|s>|r~|dkrX|dkrX|j|�S|dkrr|dkrr|j|�S|j||�S|j�j|j��}|dkr�|j|�}|dkr�|}n|}|j|�S)z8Compares the values numerically with their sign ignored.T)r�Nr-r%r�)	r�rrPr�r�r�r�r�r.)r.r�r/r/r0r+r;r'r'r)�min_mag�
s&


zDecimal.min_magcCs�|dkrt�}|j|d�}|r"|S|j�dkr2tS|j�dkrTtdd|j|j��S|j�}|jt	�|j
�|j|�}||kr�|S|jtdd|j
�d�|�S)z=Returns the largest representable number smaller than itself.N)r/r-r%r>r�r�)rr�r�rEr6r@r�rHr)r�_ignore_all_flagsr�r�r�)r.r/r;�new_selfr'r'r)�
next_minus�
s"

zDecimal.next_minuscCs�|dkrt�}|j|d�}|r"|S|j�dkr2tS|j�dkrTtdd|j|j��S|j�}|jt	�|j
�|j|�}||kr�|S|jtdd|j
�d�|�S)z=Returns the smallest representable number larger than itself.N)r/r-r>r%r�r�)rr�r�rFr6r@r�rHr)rr\r�r�r�)r.r/r;r]r'r'r)�	next_plus�
s"

zDecimal.next_pluscCs�t|dd�}|dkrt�}|j||�}|r.|S|j|�}|dkrJ|j|�S|dkr^|j|�}n
|j|�}|j�r�|jt	d|j
�|jt�|jt�nD|j
�|jkr�|jt�|jt�|jt�|jt�|s�|jt�|S)a�Returns the number closest to self, in the direction towards other.

        The result is the closest representable number to self
        (excluding self) that is in the direction towards other,
        unless both have the same value.  If the two operands are
        numerically equal, then the result is a copy of self with the
        sign set to be the same as the sign of other.
        T)r�Nr%r-z Infinite result from next_towardr�)r�rr�r�r8r_r^r�rdrr7rrr�r"rr
r)r.r�r/r;Z
comparisonr'r'r)�next_toward�
s4	








zDecimal.next_towardcCs�|j�rdS|j�rdS|j�}|dkr,dS|dkr8dS|j�rN|jrJdSdS|dkr\t�}|j|d	�rv|jrrd
SdS|jr�dSd
SdS)aReturns an indication of the class of self.

        The class is one of the following strings:
          sNaN
          NaN
          -Infinity
          -Normal
          -Subnormal
          -Zero
          +Zero
          +Subnormal
          +Normal
          +Infinity
        r�r�r-z	+Infinityz	-Infinityz-Zeroz+ZeroN)r/z
-Subnormalz
+Subnormalz-Normalz+Normalr�)r�r�r�r@r7rr?)r.r/�infr'r'r)�number_class+s,zDecimal.number_classcCstd�S)z'Just returns 10, as this is Decimal, :)r�)r)r.r'r'r)�radixUsz
Decimal.radixcCs�|dkrt�}t|dd�}|j||�}|r.|S|jdkrB|jt�S|jt|�ko^|jknsn|jt�S|j�r~t	|�St|�}|j
}|jt|�}|dkr�d||}n|dkr�||d�}||d�|d|�}t|j
|jd�p�d|j�S)z5Returns a rotated copy of self, value-of-other times.NT)r�r%rQ)rr�r�rOrdr	r@rUr�rr8rfr6r7rg)r.r�r/r;�torot�rotdig�topadZrotatedr'r'r)�rotateYs,

"
zDecimal.rotatecCs�|dkrt�}t|dd�}|j||�}|r.|S|jdkrB|jt�Sd|j|j}d|j|j}|t|�kox|kns�|jt�S|j	�r�t
|�St|j|j
|jt|��}|j|�}|S)z>Returns self operand after adding the second value to its exp.NT)r�r%r+r�)rr�r�rOrdr	rAr@rUr�rr6r7r8r�)r.r�r/r;ZliminfZlimsuprr'r'r)�scalebzs"



zDecimal.scalebcCs|dkrt�}t|dd�}|j||�}|r.|S|jdkrB|jt�S|jt|�ko^|jknsn|jt�S|j�r~t	|�St|�}|j
}|jt|�}|dkr�d||}n|dkr�||d�}|dkr�|d|�}n|d|}||jd�}t|j
|jd��pd|j�S)z5Returns a shifted copy of self, value-of-other times.NT)r�r%rQ)rr�r�rOrdr	r@rUr�rr8rfr6r7rg)r.r�r/r;rdrerfZshiftedr'r'r)r��s2

"
z
Decimal.shiftcCs|jt|�ffS)N)�	__class__r`)r.r'r'r)�
__reduce__�szDecimal.__reduce__cCst|�tkr|S|jt|��S)N)�typerrir`)r.r'r'r)�__copy__�szDecimal.__copy__cCst|�tkr|S|jt|��S)N)rkrrir`)r.�memor'r'r)�__deepcopy__�szDecimal.__deepcopy__cCsN|dkrt�}t||d�}|jrXt|j|�}t|j��}|ddkrL|d7}t|||�S|ddkrvddg|j|d<|ddkr�t	|j|j
|jd�}|j}|d}|dk	�r|dd	kr�|j
|d
|�}nF|ddkr�|j||�}n*|ddk�rt|j
�|k�r|j
||�}|�rB|jd
k�rB|ddk�rB|jd
|�}|jt|j
�}	|dd	k�r�|�r||dk	�r|d
|}
nd
}
nB|ddk�r�|	}
n.|ddk�r�|jd
k�r�|	dk�r�|	}
nd
}
|
d
k�r�d}d|
|j
}nP|
t|j
�k�r|j
d|
t|j
�}d}n"|j
d|
��p$d}|j
|
d�}|	|
}
t|j|||
|�S)a|Format a Decimal instance according to the given specifier.

        The specifier should be a standard format specifier, with the
        form described in PEP 3101.  Formatting types 'e', 'E', 'f',
        'F', 'g', 'G', 'n' and '%' are supported.  If the formatting
        type is omitted it defaults to 'g' or 'G', depending on the
        value of context.capitals.
        N)�_localeconvrk�%�g�Gr+�	precision�eEr-zfF%ZgGr%r�rQrSi����)r�_parse_format_specifierrP�_format_signr7r`r��
_format_alignr�r6r8rOr?r&r�rf�_format_number)r.Z	specifierr/ro�specr=�bodyr?rsr�r�rvrwrVr'r'r)�
__format__�sZ
"

zDecimal.__format__)rOr8r7rP)rQN)NN)N)N)N)N)N)N)FN)N)N)N)TN)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)NN)N)N)NN)N)NN)NN)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)NN)�r1r2r3r4�	__slots__r^�classmethodrqr�r�r�r�r�r�r�r�r�r�r�r�r�r�r|r�r�r�r�r�r�r��__radd__r�r�r��__rmul__r�r�r�r�r�r�r�r�r�r�r�r��	__trunc__r��propertyr�r�r�r9r�r�r�r�r�r�r�r�r��dictr�r�r�r�r�rrrrr!r�r$r�r&r'r��to_integralr-r�r�r�r�r�r2r3r.r7r�r�r8rVr;r<r#r�r=r�r>r�r?r@rDrHrrKrLrNrQrVrXrYrWrZr[r^r_r`rbrcrgrhr�rjrlrnr{r'r'r'r)r+s
(
 !@

	
	
	
	
2
4
	V7;!$K

f	>,UnY="c*"	IK23
.*!'FcCs&tjt�}||_||_||_||_|S)z�Create a decimal instance directly, without any validation,
    normalization (e.g. removal of leading zeros) or argument
    conversion.

    This function is for *internal use only*.
    )r]r^rr7r8rOrP)r=Zcoefficientr�Zspecialr.r'r'r)r6s
r6c@s(eZdZdZdd�Zdd�Zdd�ZdS)	rNz�Context manager class to support localcontext().

      Sets a copy of the supplied context in __enter__() and restores
      the previous decimal context in __exit__()
    cCs|j�|_dS)N)rH�new_context)r.r�r'r'r)�__init__9sz_ContextManager.__init__cCst�|_t|j�|jS)N)r�
saved_contextrr�)r.r'r'r)�	__enter__;s
z_ContextManager.__enter__cCst|j�dS)N)rr�)r.�t�v�tbr'r'r)�__exit__?sz_ContextManager.__exit__N)r1r2r3r4r�r�r�r'r'r'r)rN3srNc	@s�eZdZdZd�dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZeZd�dd�Zdd�Zdd�Zdd �ZdZd!d"�Zd#d$�Zd%d&�Zd�d(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Z d:d;�Z!d<d=�Z"d>d?�Z#d@dA�Z$dBdC�Z%dDdE�Z&dFdG�Z'dHdI�Z(dJdK�Z)dLdM�Z*dNdO�Z+dPdQ�Z,dRdS�Z-dTdU�Z.dVdW�Z/dXdY�Z0dZd[�Z1d\d]�Z2d^d_�Z3d`da�Z4dbdc�Z5ddde�Z6dfdg�Z7dhdi�Z8djdk�Z9dldm�Z:dndo�Z;dpdq�Z<drds�Z=dtdu�Z>dvdw�Z?dxdy�Z@dzd{�ZAd|d}�ZBd~d�ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGd�d�d��ZHd�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOd�d��ZPd�d��ZQd�d��ZRd�d��ZSd�d��ZTd�d��ZUd�d��ZVeVZWdS)�ra�Contains the context for a Decimal instance.

    Contains:
    prec - precision (for use in rounding, division, square roots..)
    rounding - rounding type (how you round)
    traps - If traps[exception] = 1, then the exception is
                    raised when it is caused.  Otherwise, a value is
                    substituted in.
    flags  - When an exception is caused, flags[exception] is set.
             (Whether or not the trap_enabler is set)
             Should be reset by user of Decimal instance.
    Emin -   Minimum exponent
    Emax -   Maximum exponent
    capitals -      If 1, 1*10^1 is printed as 1E+1.
                    If 0, printed as 1e1
    clamp -  If 1, change exponents if too high (Default 0)
    Nc
s>yt}
Wntk
rYnX|dk	r*|n|
j|_|dk	r>|n|
j|_|dk	rR|n|
j|_|dk	rf|n|
j|_|dk	rz|n|
j|_|dk	r�|n|
j|_|	dkr�g|_n|	|_�dkr�|
j	j
�|_	n.t�t�s�t�fdd�t
�D��|_	n�|_	�dk�r
tjt
d�|_n0t�t��s4t�fdd�t
�D��|_n�|_dS)Nc3s|]}|t|�k�fVqdS)N)rU)rRr�)rr'r)�	<genexpr>nsz#Context.__init__.<locals>.<genexpr>r%c3s|]}|t|�k�fVqdS)N)rU)rRr�)rr'r)r�us)r�	NameErrorr@r?r"rAr�r��_ignored_flagsrrHr_r�r�fromkeysr)r.r@r?r"rAr�r�rrr�Zdcr')rrr)r�Us.

zContext.__init__cCs�t|t�std|��|dkr<||kr�td||||f��nJ|dkrb||kr�td||||f��n$||ksr||kr�td||||f��tj|||�S)Nz%s must be an integerz-infz%s must be in [%s, %d]. got: %sraz%s must be in [%d, %s]. got: %sz%s must be in [%d, %d]. got %s)r_rUrrrlr]�__setattr__)r.�namertZvminZvmaxr'r'r)�_set_integer_checkys
zContext._set_integer_checkcCsht|t�std|��x |D]}|tkrtd|��qWx tD]}||kr>td|��q>Wtj|||�S)Nz%s must be a signal dictz%s is not a valid signal dict)r_r�rrr�KeyErrorr]r�)r.r�r�keyr'r'r)�_set_signal_dict�s


zContext._set_signal_dictcCs�|dkr|j||dd�S|dkr0|j||dd�S|dkrH|j||dd�S|dkr`|j||dd�S|d	krx|j||dd�S|d
kr�|tkr�td|��tj|||�S|dks�|d
kr�|j||�S|dkr�tj|||�Std|��dS)Nr@r-rar"z-infr%rAr�r�r?z%s: invalid rounding moderrr�z.'decimal.Context' object has no attribute '%s')r��_rounding_modesrrr]r�r�rL)r.r�rtr'r'r)r��s(zContext.__setattr__cCstd|��dS)Nz%s cannot be deleted)rL)r.r�r'r'r)�__delattr__�szContext.__delattr__c	CsNdd�|jj�D�}dd�|jj�D�}|j|j|j|j|j|j|j	||ffS)NcSsg|]\}}|r|�qSr'r')rR�sigr�r'r'r)rT�sz&Context.__reduce__.<locals>.<listcomp>cSsg|]\}}|r|�qSr'r')rRr�r�r'r'r)rT�s)
r�itemsrrir@r?r"rAr�r�)r.rrr'r'r)rj�s
zContext.__reduce__cCs|g}|jdt|��dd�|jj�D�}|jddj|�d�dd�|jj�D�}|jddj|�d�dj|�d	S)
zShow the current context.zrContext(prec=%(prec)d, rounding=%(rounding)s, Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d, clamp=%(clamp)dcSsg|]\}}|r|j�qSr')r1)rRr~r�r'r'r)rT�sz$Context.__repr__.<locals>.<listcomp>zflags=[z, �]cSsg|]\}}|r|j�qSr')r1)rRr�r�r'r'r)rT�sztraps=[�))rm�varsrr�rnr)r.r��namesr'r'r)r��szContext.__repr__cCsx|jD]}d|j|<qWdS)zReset all flags to zeror%N)r)r.�flagr'r'r)rI�szContext.clear_flagscCsx|jD]}d|j|<qWdS)zReset all traps to zeror%N)r)r.r�r'r'r)�clear_traps�szContext.clear_trapsc
Cs.t|j|j|j|j|j|j|j|j|j	�	}|S)z!Returns a shallow copy from self.)
rr@r?r"rAr�r�rrr�)r.�ncr'r'r)r(�szContext._shallow_copyc
Cs6t|j|j|j|j|j|j|jj�|j	j�|j
�	}|S)zReturns a deep copy from self.)rr@r?r"rAr�r�rrHrr�)r.r�r'r'r)rH�s
zContext.copycGsZtj||�}||jkr(|�j|f|��Sd|j|<|j|sN|�j|f|��S||��dS)a#Handles an error

        If the flag is in _ignored_flags, returns the default response.
        Otherwise, it sets the flag, then, if the corresponding
        trap_enabler is set, it reraises the exception.  Otherwise, it returns
        the default value after setting the flag.
        r-N)�_condition_map�getr�r0rr)r.Z	conditionZexplanationr(�errorr'r'r)rd�s


zContext._raise_errorcCs
|jt�S)z$Ignore all flags, if they are raised)�
_ignore_flagsr)r.r'r'r)r\�szContext._ignore_all_flagscGs|jt|�|_t|�S)z$Ignore the flags, if they are raised)r�rj)r.rr'r'r)r��szContext._ignore_flagscGs<|rt|dttf�r|d}x|D]}|jj|�q$WdS)z+Stop ignoring the flags, if they are raisedr%N)r_rkrjr��remove)r.rr�r'r'r)�
_regard_flags�s
zContext._regard_flagscCst|j|jd�S)z!Returns Etiny (= Emin - prec + 1)r-)rUr"r@)r.r'r'r)r�sz
Context.EtinycCst|j|jd�S)z,Returns maximum exponent (= Emax - prec + 1)r-)rUrAr@)r.r'r'r)r�szContext.EtopcCs|j}||_|S)a�Sets the rounding type.

        Sets the rounding type, and returns the current (previous)
        rounding type.  Often used like:

        context = context.copy()
        # so you don't change the calling context
        # if an error occurs in the middle.
        rounding = context._set_rounding(ROUND_UP)
        val = self.__sub__(other, context=context)
        context._set_rounding(rounding)

        This will make it round up for that operation.
        )r?)r.rkr?r'r'r)r)szContext._set_roundingrQcCsjt|t�r*||j�ksd|kr*|jtd�St||d�}|j�r`t|j�|j	|j
kr`|jtd�S|j|�S)z�Creates a new Decimal instance but using self as context.

        This method implements the to-number operation of the
        IBM Decimal specification.rRzAtrailing or leading whitespace and underscores are not permitted.)r/zdiagnostic info too long in NaN)r_r`rbrdrrr�rfr8r@r�r�)r.rBrr'r'r)�create_decimal#szContext.create_decimalcCstj|�}|j|�S)a�Creates a new Decimal instance from a float but rounding using self
        as the context.

        >>> context = Context(prec=5, rounding=ROUND_DOWN)
        >>> context.create_decimal_from_float(3.1415926535897932)
        Decimal('3.1415')
        >>> context = Context(prec=5, traps=[Inexact])
        >>> context.create_decimal_from_float(3.1415926535897932)
        Traceback (most recent call last):
            ...
        decimal.Inexact: None

        )rrqr�)r.r~rr'r'r)�create_decimal_from_float4s
z!Context.create_decimal_from_floatcCst|dd�}|j|d�S)a[Returns the absolute value of the operand.

        If the operand is negative, the result is the same as using the minus
        operation on the operand.  Otherwise, the result is the same as using
        the plus operation on the operand.

        >>> ExtendedContext.abs(Decimal('2.1'))
        Decimal('2.1')
        >>> ExtendedContext.abs(Decimal('-100'))
        Decimal('100')
        >>> ExtendedContext.abs(Decimal('101.5'))
        Decimal('101.5')
        >>> ExtendedContext.abs(Decimal('-101.5'))
        Decimal('101.5')
        >>> ExtendedContext.abs(-1)
        Decimal('1')
        T)r�)r/)r�r�)r.rr'r'r)rhFszContext.abscCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a�Return the sum of the two operands.

        >>> ExtendedContext.add(Decimal('12'), Decimal('7.00'))
        Decimal('19.00')
        >>> ExtendedContext.add(Decimal('1E+2'), Decimal('1.01E+4'))
        Decimal('1.02E+4')
        >>> ExtendedContext.add(1, Decimal(2))
        Decimal('3')
        >>> ExtendedContext.add(Decimal(8), 5)
        Decimal('13')
        >>> ExtendedContext.add(5, 5)
        Decimal('10')
        T)r�)r/zUnable to convert %s to DecimalN)r�r�r�rr)r.rrSr�r'r'r)�add[s
zContext.addcCst|j|��S)N)r`r�)r.rr'r'r)�_applypszContext._applycCst|t�std��|j�S)z�Returns the same Decimal object.

        As we do not have different encodings for the same number, the
        received object already is in its canonical form.

        >>> ExtendedContext.canonical(Decimal('2.50'))
        Decimal('2.50')
        z,canonical requires a Decimal as an argument.)r_rrrr2)r.rr'r'r)r2ss	
zContext.canonicalcCst|dd�}|j||d�S)a�Compares values numerically.

        If the signs of the operands differ, a value representing each operand
        ('-1' if the operand is less than zero, '0' if the operand is zero or
        negative zero, or '1' if the operand is greater than zero) is used in
        place of that operand for the comparison instead of the actual
        operand.

        The comparison is then effected by subtracting the second operand from
        the first and then returning a value according to the result of the
        subtraction: '-1' if the result is less than zero, '0' if the result is
        zero or negative zero, or '1' if the result is greater than zero.

        >>> ExtendedContext.compare(Decimal('2.1'), Decimal('3'))
        Decimal('-1')
        >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.1'))
        Decimal('0')
        >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.10'))
        Decimal('0')
        >>> ExtendedContext.compare(Decimal('3'), Decimal('2.1'))
        Decimal('1')
        >>> ExtendedContext.compare(Decimal('2.1'), Decimal('-3'))
        Decimal('1')
        >>> ExtendedContext.compare(Decimal('-3'), Decimal('2.1'))
        Decimal('-1')
        >>> ExtendedContext.compare(1, 2)
        Decimal('-1')
        >>> ExtendedContext.compare(Decimal(1), 2)
        Decimal('-1')
        >>> ExtendedContext.compare(1, Decimal(2))
        Decimal('-1')
        T)r�)r/)r�r�)r.rrSr'r'r)r��s!zContext.comparecCst|dd�}|j||d�S)aCompares the values of the two operands numerically.

        It's pretty much like compare(), but all NaNs signal, with signaling
        NaNs taking precedence over quiet NaNs.

        >>> c = ExtendedContext
        >>> c.compare_signal(Decimal('2.1'), Decimal('3'))
        Decimal('-1')
        >>> c.compare_signal(Decimal('2.1'), Decimal('2.1'))
        Decimal('0')
        >>> c.flags[InvalidOperation] = 0
        >>> print(c.flags[InvalidOperation])
        0
        >>> c.compare_signal(Decimal('NaN'), Decimal('2.1'))
        Decimal('NaN')
        >>> print(c.flags[InvalidOperation])
        1
        >>> c.flags[InvalidOperation] = 0
        >>> print(c.flags[InvalidOperation])
        0
        >>> c.compare_signal(Decimal('sNaN'), Decimal('2.1'))
        Decimal('NaN')
        >>> print(c.flags[InvalidOperation])
        1
        >>> c.compare_signal(-1, 2)
        Decimal('-1')
        >>> c.compare_signal(Decimal(-1), 2)
        Decimal('-1')
        >>> c.compare_signal(-1, Decimal(2))
        Decimal('-1')
        T)r�)r/)r�r3)r.rrSr'r'r)r3�s zContext.compare_signalcCst|dd�}|j|�S)a+Compares two operands using their abstract representation.

        This is not like the standard compare, which use their numerical
        value. Note that a total ordering is defined for all possible abstract
        representations.

        >>> ExtendedContext.compare_total(Decimal('12.73'), Decimal('127.9'))
        Decimal('-1')
        >>> ExtendedContext.compare_total(Decimal('-127'),  Decimal('12'))
        Decimal('-1')
        >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.3'))
        Decimal('-1')
        >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.30'))
        Decimal('0')
        >>> ExtendedContext.compare_total(Decimal('12.3'),  Decimal('12.300'))
        Decimal('1')
        >>> ExtendedContext.compare_total(Decimal('12.3'),  Decimal('NaN'))
        Decimal('-1')
        >>> ExtendedContext.compare_total(1, 2)
        Decimal('-1')
        >>> ExtendedContext.compare_total(Decimal(1), 2)
        Decimal('-1')
        >>> ExtendedContext.compare_total(1, Decimal(2))
        Decimal('-1')
        T)r�)r�r.)r.rrSr'r'r)r.�szContext.compare_totalcCst|dd�}|j|�S)z�Compares two operands using their abstract representation ignoring sign.

        Like compare_total, but with operand's sign ignored and assumed to be 0.
        T)r�)r�r7)r.rrSr'r'r)r7�szContext.compare_total_magcCst|dd�}|j�S)aReturns a copy of the operand with the sign set to 0.

        >>> ExtendedContext.copy_abs(Decimal('2.1'))
        Decimal('2.1')
        >>> ExtendedContext.copy_abs(Decimal('-100'))
        Decimal('100')
        >>> ExtendedContext.copy_abs(-1)
        Decimal('1')
        T)r�)r�r�)r.rr'r'r)r��s
zContext.copy_abscCst|dd�}t|�S)aReturns a copy of the decimal object.

        >>> ExtendedContext.copy_decimal(Decimal('2.1'))
        Decimal('2.1')
        >>> ExtendedContext.copy_decimal(Decimal('-1.00'))
        Decimal('-1.00')
        >>> ExtendedContext.copy_decimal(1)
        Decimal('1')
        T)r�)r�r)r.rr'r'r)�copy_decimal�s
zContext.copy_decimalcCst|dd�}|j�S)a(Returns a copy of the operand with the sign inverted.

        >>> ExtendedContext.copy_negate(Decimal('101.5'))
        Decimal('-101.5')
        >>> ExtendedContext.copy_negate(Decimal('-101.5'))
        Decimal('101.5')
        >>> ExtendedContext.copy_negate(1)
        Decimal('-1')
        T)r�)r�r�)r.rr'r'r)r�s
zContext.copy_negatecCst|dd�}|j|�S)aCopies the second operand's sign to the first one.

        In detail, it returns a copy of the first operand with the sign
        equal to the sign of the second operand.

        >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('7.33'))
        Decimal('1.50')
        >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('7.33'))
        Decimal('1.50')
        >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('-7.33'))
        Decimal('-1.50')
        >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('-7.33'))
        Decimal('-1.50')
        >>> ExtendedContext.copy_sign(1, -2)
        Decimal('-1')
        >>> ExtendedContext.copy_sign(Decimal(1), -2)
        Decimal('-1')
        >>> ExtendedContext.copy_sign(1, Decimal(-2))
        Decimal('-1')
        T)r�)r�r8)r.rrSr'r'r)r8szContext.copy_signcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a�Decimal division in a specified context.

        >>> ExtendedContext.divide(Decimal('1'), Decimal('3'))
        Decimal('0.333333333')
        >>> ExtendedContext.divide(Decimal('2'), Decimal('3'))
        Decimal('0.666666667')
        >>> ExtendedContext.divide(Decimal('5'), Decimal('2'))
        Decimal('2.5')
        >>> ExtendedContext.divide(Decimal('1'), Decimal('10'))
        Decimal('0.1')
        >>> ExtendedContext.divide(Decimal('12'), Decimal('12'))
        Decimal('1')
        >>> ExtendedContext.divide(Decimal('8.00'), Decimal('2'))
        Decimal('4.00')
        >>> ExtendedContext.divide(Decimal('2.400'), Decimal('2.0'))
        Decimal('1.20')
        >>> ExtendedContext.divide(Decimal('1000'), Decimal('100'))
        Decimal('10')
        >>> ExtendedContext.divide(Decimal('1000'), Decimal('1'))
        Decimal('1000')
        >>> ExtendedContext.divide(Decimal('2.40E+6'), Decimal('2'))
        Decimal('1.20E+6')
        >>> ExtendedContext.divide(5, 5)
        Decimal('1')
        >>> ExtendedContext.divide(Decimal(5), 5)
        Decimal('1')
        >>> ExtendedContext.divide(5, Decimal(5))
        Decimal('1')
        T)r�)r/zUnable to convert %s to DecimalN)r�r�r�rr)r.rrSr�r'r'r)�divide+s
zContext.dividecCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a/Divides two numbers and returns the integer part of the result.

        >>> ExtendedContext.divide_int(Decimal('2'), Decimal('3'))
        Decimal('0')
        >>> ExtendedContext.divide_int(Decimal('10'), Decimal('3'))
        Decimal('3')
        >>> ExtendedContext.divide_int(Decimal('1'), Decimal('0.3'))
        Decimal('3')
        >>> ExtendedContext.divide_int(10, 3)
        Decimal('3')
        >>> ExtendedContext.divide_int(Decimal(10), 3)
        Decimal('3')
        >>> ExtendedContext.divide_int(10, Decimal(3))
        Decimal('3')
        T)r�)r/zUnable to convert %s to DecimalN)r�r�r�rr)r.rrSr�r'r'r)�
divide_intPs
zContext.divide_intcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a�Return (a // b, a % b).

        >>> ExtendedContext.divmod(Decimal(8), Decimal(3))
        (Decimal('2'), Decimal('2'))
        >>> ExtendedContext.divmod(Decimal(8), Decimal(4))
        (Decimal('2'), Decimal('0'))
        >>> ExtendedContext.divmod(8, 4)
        (Decimal('2'), Decimal('0'))
        >>> ExtendedContext.divmod(Decimal(8), 4)
        (Decimal('2'), Decimal('0'))
        >>> ExtendedContext.divmod(8, Decimal(4))
        (Decimal('2'), Decimal('0'))
        T)r�)r/zUnable to convert %s to DecimalN)r�r�r�rr)r.rrSr�r'r'r)r�gs
zContext.divmodcCst|dd�}|j|d�S)a#Returns e ** a.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.exp(Decimal('-Infinity'))
        Decimal('0')
        >>> c.exp(Decimal('-1'))
        Decimal('0.367879441')
        >>> c.exp(Decimal('0'))
        Decimal('1')
        >>> c.exp(Decimal('1'))
        Decimal('2.71828183')
        >>> c.exp(Decimal('0.693147181'))
        Decimal('2.00000000')
        >>> c.exp(Decimal('+Infinity'))
        Decimal('Infinity')
        >>> c.exp(10)
        Decimal('22026.4658')
        T)r�)r/)r�rV)r.rr'r'r)rV|szContext.expcCst|dd�}|j|||d�S)aReturns a multiplied by b, plus c.

        The first two operands are multiplied together, using multiply,
        the third operand is then added to the result of that
        multiplication, using add, all with only one final rounding.

        >>> ExtendedContext.fma(Decimal('3'), Decimal('5'), Decimal('7'))
        Decimal('22')
        >>> ExtendedContext.fma(Decimal('3'), Decimal('-5'), Decimal('7'))
        Decimal('-8')
        >>> ExtendedContext.fma(Decimal('888565290'), Decimal('1557.96930'), Decimal('-86087.7578'))
        Decimal('1.38435736E+12')
        >>> ExtendedContext.fma(1, 3, 4)
        Decimal('7')
        >>> ExtendedContext.fma(1, Decimal(3), 4)
        Decimal('7')
        >>> ExtendedContext.fma(1, 3, Decimal(4))
        Decimal('7')
        T)r�)r/)r�r�)r.rrSr+r'r'r)r��szContext.fmacCst|t�std��|j�S)aReturn True if the operand is canonical; otherwise return False.

        Currently, the encoding of a Decimal instance is always
        canonical, so this method returns True for any Decimal.

        >>> ExtendedContext.is_canonical(Decimal('2.50'))
        True
        z/is_canonical requires a Decimal as an argument.)r_rrrr;)r.rr'r'r)r;�s	
zContext.is_canonicalcCst|dd�}|j�S)a,Return True if the operand is finite; otherwise return False.

        A Decimal instance is considered finite if it is neither
        infinite nor a NaN.

        >>> ExtendedContext.is_finite(Decimal('2.50'))
        True
        >>> ExtendedContext.is_finite(Decimal('-0.3'))
        True
        >>> ExtendedContext.is_finite(Decimal('0'))
        True
        >>> ExtendedContext.is_finite(Decimal('Inf'))
        False
        >>> ExtendedContext.is_finite(Decimal('NaN'))
        False
        >>> ExtendedContext.is_finite(1)
        True
        T)r�)r�r<)r.rr'r'r)r<�szContext.is_finitecCst|dd�}|j�S)aUReturn True if the operand is infinite; otherwise return False.

        >>> ExtendedContext.is_infinite(Decimal('2.50'))
        False
        >>> ExtendedContext.is_infinite(Decimal('-Inf'))
        True
        >>> ExtendedContext.is_infinite(Decimal('NaN'))
        False
        >>> ExtendedContext.is_infinite(1)
        False
        T)r�)r�r#)r.rr'r'r)r#�szContext.is_infinitecCst|dd�}|j�S)aOReturn True if the operand is a qNaN or sNaN;
        otherwise return False.

        >>> ExtendedContext.is_nan(Decimal('2.50'))
        False
        >>> ExtendedContext.is_nan(Decimal('NaN'))
        True
        >>> ExtendedContext.is_nan(Decimal('-sNaN'))
        True
        >>> ExtendedContext.is_nan(1)
        False
        T)r�)r�r�)r.rr'r'r)r��s
zContext.is_nancCst|dd�}|j|d�S)a�Return True if the operand is a normal number;
        otherwise return False.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.is_normal(Decimal('2.50'))
        True
        >>> c.is_normal(Decimal('0.1E-999'))
        False
        >>> c.is_normal(Decimal('0.00'))
        False
        >>> c.is_normal(Decimal('-Inf'))
        False
        >>> c.is_normal(Decimal('NaN'))
        False
        >>> c.is_normal(1)
        True
        T)r�)r/)r�r=)r.rr'r'r)r=�szContext.is_normalcCst|dd�}|j�S)aHReturn True if the operand is a quiet NaN; otherwise return False.

        >>> ExtendedContext.is_qnan(Decimal('2.50'))
        False
        >>> ExtendedContext.is_qnan(Decimal('NaN'))
        True
        >>> ExtendedContext.is_qnan(Decimal('sNaN'))
        False
        >>> ExtendedContext.is_qnan(1)
        False
        T)r�)r�r�)r.rr'r'r)r�szContext.is_qnancCst|dd�}|j�S)a�Return True if the operand is negative; otherwise return False.

        >>> ExtendedContext.is_signed(Decimal('2.50'))
        False
        >>> ExtendedContext.is_signed(Decimal('-12'))
        True
        >>> ExtendedContext.is_signed(Decimal('-0'))
        True
        >>> ExtendedContext.is_signed(8)
        False
        >>> ExtendedContext.is_signed(-8)
        True
        T)r�)r�r>)r.rr'r'r)r>szContext.is_signedcCst|dd�}|j�S)aTReturn True if the operand is a signaling NaN;
        otherwise return False.

        >>> ExtendedContext.is_snan(Decimal('2.50'))
        False
        >>> ExtendedContext.is_snan(Decimal('NaN'))
        False
        >>> ExtendedContext.is_snan(Decimal('sNaN'))
        True
        >>> ExtendedContext.is_snan(1)
        False
        T)r�)r�r�)r.rr'r'r)r�$s
zContext.is_snancCst|dd�}|j|d�S)a�Return True if the operand is subnormal; otherwise return False.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.is_subnormal(Decimal('2.50'))
        False
        >>> c.is_subnormal(Decimal('0.1E-999'))
        True
        >>> c.is_subnormal(Decimal('0.00'))
        False
        >>> c.is_subnormal(Decimal('-Inf'))
        False
        >>> c.is_subnormal(Decimal('NaN'))
        False
        >>> c.is_subnormal(1)
        False
        T)r�)r/)r�r?)r.rr'r'r)r?4szContext.is_subnormalcCst|dd�}|j�S)auReturn True if the operand is a zero; otherwise return False.

        >>> ExtendedContext.is_zero(Decimal('0'))
        True
        >>> ExtendedContext.is_zero(Decimal('2.50'))
        False
        >>> ExtendedContext.is_zero(Decimal('-0E+2'))
        True
        >>> ExtendedContext.is_zero(1)
        False
        >>> ExtendedContext.is_zero(0)
        True
        T)r�)r�r@)r.rr'r'r)r@JszContext.is_zerocCst|dd�}|j|d�S)a�Returns the natural (base e) logarithm of the operand.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.ln(Decimal('0'))
        Decimal('-Infinity')
        >>> c.ln(Decimal('1.000'))
        Decimal('0')
        >>> c.ln(Decimal('2.71828183'))
        Decimal('1.00000000')
        >>> c.ln(Decimal('10'))
        Decimal('2.30258509')
        >>> c.ln(Decimal('+Infinity'))
        Decimal('Infinity')
        >>> c.ln(1)
        Decimal('0')
        T)r�)r/)r�rH)r.rr'r'r)rH[sz
Context.lncCst|dd�}|j|d�S)a�Returns the base 10 logarithm of the operand.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.log10(Decimal('0'))
        Decimal('-Infinity')
        >>> c.log10(Decimal('0.001'))
        Decimal('-3')
        >>> c.log10(Decimal('1.000'))
        Decimal('0')
        >>> c.log10(Decimal('2'))
        Decimal('0.301029996')
        >>> c.log10(Decimal('10'))
        Decimal('1')
        >>> c.log10(Decimal('70'))
        Decimal('1.84509804')
        >>> c.log10(Decimal('+Infinity'))
        Decimal('Infinity')
        >>> c.log10(0)
        Decimal('-Infinity')
        >>> c.log10(1)
        Decimal('0')
        T)r�)r/)r�rK)r.rr'r'r)rKqsz
Context.log10cCst|dd�}|j|d�S)a4 Returns the exponent of the magnitude of the operand's MSD.

        The result is the integer which is the exponent of the magnitude
        of the most significant digit of the operand (as though the
        operand were truncated to a single digit while maintaining the
        value of that digit and without limiting the resulting exponent).

        >>> ExtendedContext.logb(Decimal('250'))
        Decimal('2')
        >>> ExtendedContext.logb(Decimal('2.50'))
        Decimal('0')
        >>> ExtendedContext.logb(Decimal('0.03'))
        Decimal('-2')
        >>> ExtendedContext.logb(Decimal('0'))
        Decimal('-Infinity')
        >>> ExtendedContext.logb(1)
        Decimal('0')
        >>> ExtendedContext.logb(10)
        Decimal('1')
        >>> ExtendedContext.logb(100)
        Decimal('2')
        T)r�)r/)r�rL)r.rr'r'r)rL�szContext.logbcCst|dd�}|j||d�S)a�Applies the logical operation 'and' between each operand's digits.

        The operands must be both logical numbers.

        >>> ExtendedContext.logical_and(Decimal('0'), Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.logical_and(Decimal('0'), Decimal('1'))
        Decimal('0')
        >>> ExtendedContext.logical_and(Decimal('1'), Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.logical_and(Decimal('1'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.logical_and(Decimal('1100'), Decimal('1010'))
        Decimal('1000')
        >>> ExtendedContext.logical_and(Decimal('1111'), Decimal('10'))
        Decimal('10')
        >>> ExtendedContext.logical_and(110, 1101)
        Decimal('100')
        >>> ExtendedContext.logical_and(Decimal(110), 1101)
        Decimal('100')
        >>> ExtendedContext.logical_and(110, Decimal(1101))
        Decimal('100')
        T)r�)r/)r�rV)r.rrSr'r'r)rV�szContext.logical_andcCst|dd�}|j|d�S)aInvert all the digits in the operand.

        The operand must be a logical number.

        >>> ExtendedContext.logical_invert(Decimal('0'))
        Decimal('111111111')
        >>> ExtendedContext.logical_invert(Decimal('1'))
        Decimal('111111110')
        >>> ExtendedContext.logical_invert(Decimal('111111111'))
        Decimal('0')
        >>> ExtendedContext.logical_invert(Decimal('101010101'))
        Decimal('10101010')
        >>> ExtendedContext.logical_invert(1101)
        Decimal('111110010')
        T)r�)r/)r�rX)r.rr'r'r)rX�szContext.logical_invertcCst|dd�}|j||d�S)a�Applies the logical operation 'or' between each operand's digits.

        The operands must be both logical numbers.

        >>> ExtendedContext.logical_or(Decimal('0'), Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.logical_or(Decimal('0'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.logical_or(Decimal('1'), Decimal('0'))
        Decimal('1')
        >>> ExtendedContext.logical_or(Decimal('1'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.logical_or(Decimal('1100'), Decimal('1010'))
        Decimal('1110')
        >>> ExtendedContext.logical_or(Decimal('1110'), Decimal('10'))
        Decimal('1110')
        >>> ExtendedContext.logical_or(110, 1101)
        Decimal('1111')
        >>> ExtendedContext.logical_or(Decimal(110), 1101)
        Decimal('1111')
        >>> ExtendedContext.logical_or(110, Decimal(1101))
        Decimal('1111')
        T)r�)r/)r�rY)r.rrSr'r'r)rY�szContext.logical_orcCst|dd�}|j||d�S)a�Applies the logical operation 'xor' between each operand's digits.

        The operands must be both logical numbers.

        >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('0'))
        Decimal('1')
        >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('1'))
        Decimal('0')
        >>> ExtendedContext.logical_xor(Decimal('1100'), Decimal('1010'))
        Decimal('110')
        >>> ExtendedContext.logical_xor(Decimal('1111'), Decimal('10'))
        Decimal('1101')
        >>> ExtendedContext.logical_xor(110, 1101)
        Decimal('1011')
        >>> ExtendedContext.logical_xor(Decimal(110), 1101)
        Decimal('1011')
        >>> ExtendedContext.logical_xor(110, Decimal(1101))
        Decimal('1011')
        T)r�)r/)r�rW)r.rrSr'r'r)rW�szContext.logical_xorcCst|dd�}|j||d�S)a�max compares two values numerically and returns the maximum.

        If either operand is a NaN then the general rules apply.
        Otherwise, the operands are compared as though by the compare
        operation.  If they are numerically equal then the left-hand operand
        is chosen as the result.  Otherwise the maximum (closer to positive
        infinity) of the two operands is chosen as the result.

        >>> ExtendedContext.max(Decimal('3'), Decimal('2'))
        Decimal('3')
        >>> ExtendedContext.max(Decimal('-10'), Decimal('3'))
        Decimal('3')
        >>> ExtendedContext.max(Decimal('1.0'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.max(Decimal('7'), Decimal('NaN'))
        Decimal('7')
        >>> ExtendedContext.max(1, 2)
        Decimal('2')
        >>> ExtendedContext.max(Decimal(1), 2)
        Decimal('2')
        >>> ExtendedContext.max(1, Decimal(2))
        Decimal('2')
        T)r�)r/)r�r�)r.rrSr'r'r)r�szContext.maxcCst|dd�}|j||d�S)a�Compares the values numerically with their sign ignored.

        >>> ExtendedContext.max_mag(Decimal('7'), Decimal('NaN'))
        Decimal('7')
        >>> ExtendedContext.max_mag(Decimal('7'), Decimal('-10'))
        Decimal('-10')
        >>> ExtendedContext.max_mag(1, -2)
        Decimal('-2')
        >>> ExtendedContext.max_mag(Decimal(1), -2)
        Decimal('-2')
        >>> ExtendedContext.max_mag(1, Decimal(-2))
        Decimal('-2')
        T)r�)r/)r�rZ)r.rrSr'r'r)rZ&szContext.max_magcCst|dd�}|j||d�S)a�min compares two values numerically and returns the minimum.

        If either operand is a NaN then the general rules apply.
        Otherwise, the operands are compared as though by the compare
        operation.  If they are numerically equal then the left-hand operand
        is chosen as the result.  Otherwise the minimum (closer to negative
        infinity) of the two operands is chosen as the result.

        >>> ExtendedContext.min(Decimal('3'), Decimal('2'))
        Decimal('2')
        >>> ExtendedContext.min(Decimal('-10'), Decimal('3'))
        Decimal('-10')
        >>> ExtendedContext.min(Decimal('1.0'), Decimal('1'))
        Decimal('1.0')
        >>> ExtendedContext.min(Decimal('7'), Decimal('NaN'))
        Decimal('7')
        >>> ExtendedContext.min(1, 2)
        Decimal('1')
        >>> ExtendedContext.min(Decimal(1), 2)
        Decimal('1')
        >>> ExtendedContext.min(1, Decimal(29))
        Decimal('1')
        T)r�)r/)r�r�)r.rrSr'r'r)r�7szContext.mincCst|dd�}|j||d�S)a�Compares the values numerically with their sign ignored.

        >>> ExtendedContext.min_mag(Decimal('3'), Decimal('-2'))
        Decimal('-2')
        >>> ExtendedContext.min_mag(Decimal('-3'), Decimal('NaN'))
        Decimal('-3')
        >>> ExtendedContext.min_mag(1, -2)
        Decimal('1')
        >>> ExtendedContext.min_mag(Decimal(1), -2)
        Decimal('1')
        >>> ExtendedContext.min_mag(1, Decimal(-2))
        Decimal('1')
        T)r�)r/)r�r[)r.rrSr'r'r)r[RszContext.min_magcCst|dd�}|j|d�S)a�Minus corresponds to unary prefix minus in Python.

        The operation is evaluated using the same rules as subtract; the
        operation minus(a) is calculated as subtract('0', a) where the '0'
        has the same exponent as the operand.

        >>> ExtendedContext.minus(Decimal('1.3'))
        Decimal('-1.3')
        >>> ExtendedContext.minus(Decimal('-1.3'))
        Decimal('1.3')
        >>> ExtendedContext.minus(1)
        Decimal('-1')
        T)r�)r/)r�r�)r.rr'r'r)�minuscsz
Context.minuscCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a�multiply multiplies two operands.

        If either operand is a special value then the general rules apply.
        Otherwise, the operands are multiplied together
        ('long multiplication'), resulting in a number which may be as long as
        the sum of the lengths of the two operands.

        >>> ExtendedContext.multiply(Decimal('1.20'), Decimal('3'))
        Decimal('3.60')
        >>> ExtendedContext.multiply(Decimal('7'), Decimal('3'))
        Decimal('21')
        >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('0.8'))
        Decimal('0.72')
        >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('-0'))
        Decimal('-0.0')
        >>> ExtendedContext.multiply(Decimal('654321'), Decimal('654321'))
        Decimal('4.28135971E+11')
        >>> ExtendedContext.multiply(7, 7)
        Decimal('49')
        >>> ExtendedContext.multiply(Decimal(7), 7)
        Decimal('49')
        >>> ExtendedContext.multiply(7, Decimal(7))
        Decimal('49')
        T)r�)r/zUnable to convert %s to DecimalN)r�r�r�rr)r.rrSr�r'r'r)�multiplyts
zContext.multiplycCst|dd�}|j|d�S)a"Returns the largest representable number smaller than a.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> ExtendedContext.next_minus(Decimal('1'))
        Decimal('0.999999999')
        >>> c.next_minus(Decimal('1E-1007'))
        Decimal('0E-1007')
        >>> ExtendedContext.next_minus(Decimal('-1.00000003'))
        Decimal('-1.00000004')
        >>> c.next_minus(Decimal('Infinity'))
        Decimal('9.99999999E+999')
        >>> c.next_minus(1)
        Decimal('0.999999999')
        T)r�)r/)r�r^)r.rr'r'r)r^�szContext.next_minuscCst|dd�}|j|d�S)aReturns the smallest representable number larger than a.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> ExtendedContext.next_plus(Decimal('1'))
        Decimal('1.00000001')
        >>> c.next_plus(Decimal('-1E-1007'))
        Decimal('-0E-1007')
        >>> ExtendedContext.next_plus(Decimal('-1.00000003'))
        Decimal('-1.00000002')
        >>> c.next_plus(Decimal('-Infinity'))
        Decimal('-9.99999999E+999')
        >>> c.next_plus(1)
        Decimal('1.00000001')
        T)r�)r/)r�r_)r.rr'r'r)r_�szContext.next_pluscCst|dd�}|j||d�S)a�Returns the number closest to a, in direction towards b.

        The result is the closest representable number from the first
        operand (but not the first operand) that is in the direction
        towards the second operand, unless the operands have the same
        value.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.next_toward(Decimal('1'), Decimal('2'))
        Decimal('1.00000001')
        >>> c.next_toward(Decimal('-1E-1007'), Decimal('1'))
        Decimal('-0E-1007')
        >>> c.next_toward(Decimal('-1.00000003'), Decimal('0'))
        Decimal('-1.00000002')
        >>> c.next_toward(Decimal('1'), Decimal('0'))
        Decimal('0.999999999')
        >>> c.next_toward(Decimal('1E-1007'), Decimal('-100'))
        Decimal('0E-1007')
        >>> c.next_toward(Decimal('-1.00000003'), Decimal('-10'))
        Decimal('-1.00000004')
        >>> c.next_toward(Decimal('0.00'), Decimal('-0.0000'))
        Decimal('-0.00')
        >>> c.next_toward(0, 1)
        Decimal('1E-1007')
        >>> c.next_toward(Decimal(0), 1)
        Decimal('1E-1007')
        >>> c.next_toward(0, Decimal(1))
        Decimal('1E-1007')
        T)r�)r/)r�r`)r.rrSr'r'r)r`�s zContext.next_towardcCst|dd�}|j|d�S)a�normalize reduces an operand to its simplest form.

        Essentially a plus operation with all trailing zeros removed from the
        result.

        >>> ExtendedContext.normalize(Decimal('2.1'))
        Decimal('2.1')
        >>> ExtendedContext.normalize(Decimal('-2.0'))
        Decimal('-2')
        >>> ExtendedContext.normalize(Decimal('1.200'))
        Decimal('1.2')
        >>> ExtendedContext.normalize(Decimal('-120'))
        Decimal('-1.2E+2')
        >>> ExtendedContext.normalize(Decimal('120.00'))
        Decimal('1.2E+2')
        >>> ExtendedContext.normalize(Decimal('0.00'))
        Decimal('0')
        >>> ExtendedContext.normalize(6)
        Decimal('6')
        T)r�)r/)r�r!)r.rr'r'r)r!�szContext.normalizecCst|dd�}|j|d�S)a�Returns an indication of the class of the operand.

        The class is one of the following strings:
          -sNaN
          -NaN
          -Infinity
          -Normal
          -Subnormal
          -Zero
          +Zero
          +Subnormal
          +Normal
          +Infinity

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.number_class(Decimal('Infinity'))
        '+Infinity'
        >>> c.number_class(Decimal('1E-10'))
        '+Normal'
        >>> c.number_class(Decimal('2.50'))
        '+Normal'
        >>> c.number_class(Decimal('0.1E-999'))
        '+Subnormal'
        >>> c.number_class(Decimal('0'))
        '+Zero'
        >>> c.number_class(Decimal('-0'))
        '-Zero'
        >>> c.number_class(Decimal('-0.1E-999'))
        '-Subnormal'
        >>> c.number_class(Decimal('-1E-10'))
        '-Normal'
        >>> c.number_class(Decimal('-2.50'))
        '-Normal'
        >>> c.number_class(Decimal('-Infinity'))
        '-Infinity'
        >>> c.number_class(Decimal('NaN'))
        'NaN'
        >>> c.number_class(Decimal('-NaN'))
        'NaN'
        >>> c.number_class(Decimal('sNaN'))
        'sNaN'
        >>> c.number_class(123)
        '+Normal'
        T)r�)r/)r�rb)r.rr'r'r)rb�s/zContext.number_classcCst|dd�}|j|d�S)a�Plus corresponds to unary prefix plus in Python.

        The operation is evaluated using the same rules as add; the
        operation plus(a) is calculated as add('0', a) where the '0'
        has the same exponent as the operand.

        >>> ExtendedContext.plus(Decimal('1.3'))
        Decimal('1.3')
        >>> ExtendedContext.plus(Decimal('-1.3'))
        Decimal('-1.3')
        >>> ExtendedContext.plus(-1)
        Decimal('-1')
        T)r�)r/)r�r�)r.rr'r'r)�plus)szContext.pluscCs:t|dd�}|j|||d�}|tkr2td|��n|SdS)aRaises a to the power of b, to modulo if given.

        With two arguments, compute a**b.  If a is negative then b
        must be integral.  The result will be inexact unless b is
        integral and the result is finite and can be expressed exactly
        in 'precision' digits.

        With three arguments, compute (a**b) % modulo.  For the
        three argument form, the following restrictions on the
        arguments hold:

         - all three arguments must be integral
         - b must be nonnegative
         - at least one of a or b must be nonzero
         - modulo must be nonzero and have at most 'precision' digits

        The result of pow(a, b, modulo) is identical to the result
        that would be obtained by computing (a**b) % modulo with
        unbounded precision, but is computed more efficiently.  It is
        always exact.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.power(Decimal('2'), Decimal('3'))
        Decimal('8')
        >>> c.power(Decimal('-2'), Decimal('3'))
        Decimal('-8')
        >>> c.power(Decimal('2'), Decimal('-3'))
        Decimal('0.125')
        >>> c.power(Decimal('1.7'), Decimal('8'))
        Decimal('69.7575744')
        >>> c.power(Decimal('10'), Decimal('0.301029996'))
        Decimal('2.00000000')
        >>> c.power(Decimal('Infinity'), Decimal('-1'))
        Decimal('0')
        >>> c.power(Decimal('Infinity'), Decimal('0'))
        Decimal('1')
        >>> c.power(Decimal('Infinity'), Decimal('1'))
        Decimal('Infinity')
        >>> c.power(Decimal('-Infinity'), Decimal('-1'))
        Decimal('-0')
        >>> c.power(Decimal('-Infinity'), Decimal('0'))
        Decimal('1')
        >>> c.power(Decimal('-Infinity'), Decimal('1'))
        Decimal('-Infinity')
        >>> c.power(Decimal('-Infinity'), Decimal('2'))
        Decimal('Infinity')
        >>> c.power(Decimal('0'), Decimal('0'))
        Decimal('NaN')

        >>> c.power(Decimal('3'), Decimal('7'), Decimal('16'))
        Decimal('11')
        >>> c.power(Decimal('-3'), Decimal('7'), Decimal('16'))
        Decimal('-11')
        >>> c.power(Decimal('-3'), Decimal('8'), Decimal('16'))
        Decimal('1')
        >>> c.power(Decimal('3'), Decimal('7'), Decimal('-16'))
        Decimal('11')
        >>> c.power(Decimal('23E12345'), Decimal('67E189'), Decimal('123456789'))
        Decimal('11729830')
        >>> c.power(Decimal('-0'), Decimal('17'), Decimal('1729'))
        Decimal('-0')
        >>> c.power(Decimal('-23'), Decimal('0'), Decimal('65537'))
        Decimal('1')
        >>> ExtendedContext.power(7, 7)
        Decimal('823543')
        >>> ExtendedContext.power(Decimal(7), 7)
        Decimal('823543')
        >>> ExtendedContext.power(7, Decimal(7), 2)
        Decimal('1')
        T)r�)r/zUnable to convert %s to DecimalN)r�rr�rr)r.rrSr�r�r'r'r)�power:s
Iz
Context.powercCst|dd�}|j||d�S)a
Returns a value equal to 'a' (rounded), having the exponent of 'b'.

        The coefficient of the result is derived from that of the left-hand
        operand.  It may be rounded using the current rounding setting (if the
        exponent is being increased), multiplied by a positive power of ten (if
        the exponent is being decreased), or is unchanged (if the exponent is
        already equal to that of the right-hand operand).

        Unlike other operations, if the length of the coefficient after the
        quantize operation would be greater than precision then an Invalid
        operation condition is raised.  This guarantees that, unless there is
        an error condition, the exponent of the result of a quantize is always
        equal to that of the right-hand operand.

        Also unlike other operations, quantize will never raise Underflow, even
        if the result is subnormal and inexact.

        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.001'))
        Decimal('2.170')
        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.01'))
        Decimal('2.17')
        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.1'))
        Decimal('2.2')
        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('1e+0'))
        Decimal('2')
        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('1e+1'))
        Decimal('0E+1')
        >>> ExtendedContext.quantize(Decimal('-Inf'), Decimal('Infinity'))
        Decimal('-Infinity')
        >>> ExtendedContext.quantize(Decimal('2'), Decimal('Infinity'))
        Decimal('NaN')
        >>> ExtendedContext.quantize(Decimal('-0.1'), Decimal('1'))
        Decimal('-0')
        >>> ExtendedContext.quantize(Decimal('-0'), Decimal('1e+5'))
        Decimal('-0E+5')
        >>> ExtendedContext.quantize(Decimal('+35236450.6'), Decimal('1e-2'))
        Decimal('NaN')
        >>> ExtendedContext.quantize(Decimal('-35236450.6'), Decimal('1e-2'))
        Decimal('NaN')
        >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e-1'))
        Decimal('217.0')
        >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e-0'))
        Decimal('217')
        >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e+1'))
        Decimal('2.2E+2')
        >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e+2'))
        Decimal('2E+2')
        >>> ExtendedContext.quantize(1, 2)
        Decimal('1')
        >>> ExtendedContext.quantize(Decimal(1), 2)
        Decimal('1')
        >>> ExtendedContext.quantize(1, Decimal(2))
        Decimal('1')
        T)r�)r/)r�r�)r.rrSr'r'r)r��s7zContext.quantizecCstd�S)zkJust returns 10, as this is Decimal, :)

        >>> ExtendedContext.radix()
        Decimal('10')
        r�)r)r.r'r'r)rc�sz
Context.radixcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)aReturns the remainder from integer division.

        The result is the residue of the dividend after the operation of
        calculating integer division as described for divide-integer, rounded
        to precision digits if necessary.  The sign of the result, if
        non-zero, is the same as that of the original dividend.

        This operation will fail under the same conditions as integer division
        (that is, if integer division on the same two operands would fail, the
        remainder cannot be calculated).

        >>> ExtendedContext.remainder(Decimal('2.1'), Decimal('3'))
        Decimal('2.1')
        >>> ExtendedContext.remainder(Decimal('10'), Decimal('3'))
        Decimal('1')
        >>> ExtendedContext.remainder(Decimal('-10'), Decimal('3'))
        Decimal('-1')
        >>> ExtendedContext.remainder(Decimal('10.2'), Decimal('1'))
        Decimal('0.2')
        >>> ExtendedContext.remainder(Decimal('10'), Decimal('0.3'))
        Decimal('0.1')
        >>> ExtendedContext.remainder(Decimal('3.6'), Decimal('1.3'))
        Decimal('1.0')
        >>> ExtendedContext.remainder(22, 6)
        Decimal('4')
        >>> ExtendedContext.remainder(Decimal(22), 6)
        Decimal('4')
        >>> ExtendedContext.remainder(22, Decimal(6))
        Decimal('4')
        T)r�)r/zUnable to convert %s to DecimalN)r�r�r�rr)r.rrSr�r'r'r)r��s
zContext.remaindercCst|dd�}|j||d�S)aGReturns to be "a - b * n", where n is the integer nearest the exact
        value of "x / b" (if two integers are equally near then the even one
        is chosen).  If the result is equal to 0 then its sign will be the
        sign of a.

        This operation will fail under the same conditions as integer division
        (that is, if integer division on the same two operands would fail, the
        remainder cannot be calculated).

        >>> ExtendedContext.remainder_near(Decimal('2.1'), Decimal('3'))
        Decimal('-0.9')
        >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('6'))
        Decimal('-2')
        >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('3'))
        Decimal('1')
        >>> ExtendedContext.remainder_near(Decimal('-10'), Decimal('3'))
        Decimal('-1')
        >>> ExtendedContext.remainder_near(Decimal('10.2'), Decimal('1'))
        Decimal('0.2')
        >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('0.3'))
        Decimal('0.1')
        >>> ExtendedContext.remainder_near(Decimal('3.6'), Decimal('1.3'))
        Decimal('-0.3')
        >>> ExtendedContext.remainder_near(3, 11)
        Decimal('3')
        >>> ExtendedContext.remainder_near(Decimal(3), 11)
        Decimal('3')
        >>> ExtendedContext.remainder_near(3, Decimal(11))
        Decimal('3')
        T)r�)r/)r�r�)r.rrSr'r'r)r��szContext.remainder_nearcCst|dd�}|j||d�S)aNReturns a rotated copy of a, b times.

        The coefficient of the result is a rotated copy of the digits in
        the coefficient of the first operand.  The number of places of
        rotation is taken from the absolute value of the second operand,
        with the rotation being to the left if the second operand is
        positive or to the right otherwise.

        >>> ExtendedContext.rotate(Decimal('34'), Decimal('8'))
        Decimal('400000003')
        >>> ExtendedContext.rotate(Decimal('12'), Decimal('9'))
        Decimal('12')
        >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('-2'))
        Decimal('891234567')
        >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('0'))
        Decimal('123456789')
        >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('+2'))
        Decimal('345678912')
        >>> ExtendedContext.rotate(1333333, 1)
        Decimal('13333330')
        >>> ExtendedContext.rotate(Decimal(1333333), 1)
        Decimal('13333330')
        >>> ExtendedContext.rotate(1333333, Decimal(1))
        Decimal('13333330')
        T)r�)r/)r�rg)r.rrSr'r'r)rgszContext.rotatecCst|dd�}|j|�S)a�Returns True if the two operands have the same exponent.

        The result is never affected by either the sign or the coefficient of
        either operand.

        >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('0.001'))
        False
        >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('0.01'))
        True
        >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('1'))
        False
        >>> ExtendedContext.same_quantum(Decimal('Inf'), Decimal('-Inf'))
        True
        >>> ExtendedContext.same_quantum(10000, -1)
        True
        >>> ExtendedContext.same_quantum(Decimal(10000), -1)
        True
        >>> ExtendedContext.same_quantum(10000, Decimal(-1))
        True
        T)r�)r�r$)r.rrSr'r'r)r$1szContext.same_quantumcCst|dd�}|j||d�S)a3Returns the first operand after adding the second value its exp.

        >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('-2'))
        Decimal('0.0750')
        >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('0'))
        Decimal('7.50')
        >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('3'))
        Decimal('7.50E+3')
        >>> ExtendedContext.scaleb(1, 4)
        Decimal('1E+4')
        >>> ExtendedContext.scaleb(Decimal(1), 4)
        Decimal('1E+4')
        >>> ExtendedContext.scaleb(1, Decimal(4))
        Decimal('1E+4')
        T)r�)r/)r�rh)r.rrSr'r'r)rhIszContext.scalebcCst|dd�}|j||d�S)a{Returns a shifted copy of a, b times.

        The coefficient of the result is a shifted copy of the digits
        in the coefficient of the first operand.  The number of places
        to shift is taken from the absolute value of the second operand,
        with the shift being to the left if the second operand is
        positive or to the right otherwise.  Digits shifted into the
        coefficient are zeros.

        >>> ExtendedContext.shift(Decimal('34'), Decimal('8'))
        Decimal('400000000')
        >>> ExtendedContext.shift(Decimal('12'), Decimal('9'))
        Decimal('0')
        >>> ExtendedContext.shift(Decimal('123456789'), Decimal('-2'))
        Decimal('1234567')
        >>> ExtendedContext.shift(Decimal('123456789'), Decimal('0'))
        Decimal('123456789')
        >>> ExtendedContext.shift(Decimal('123456789'), Decimal('+2'))
        Decimal('345678900')
        >>> ExtendedContext.shift(88888888, 2)
        Decimal('888888800')
        >>> ExtendedContext.shift(Decimal(88888888), 2)
        Decimal('888888800')
        >>> ExtendedContext.shift(88888888, Decimal(2))
        Decimal('888888800')
        T)r�)r/)r�r�)r.rrSr'r'r)r�\sz
Context.shiftcCst|dd�}|j|d�S)a�Square root of a non-negative number to context precision.

        If the result must be inexact, it is rounded using the round-half-even
        algorithm.

        >>> ExtendedContext.sqrt(Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.sqrt(Decimal('-0'))
        Decimal('-0')
        >>> ExtendedContext.sqrt(Decimal('0.39'))
        Decimal('0.624499800')
        >>> ExtendedContext.sqrt(Decimal('100'))
        Decimal('10')
        >>> ExtendedContext.sqrt(Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.sqrt(Decimal('1.0'))
        Decimal('1.0')
        >>> ExtendedContext.sqrt(Decimal('1.00'))
        Decimal('1.0')
        >>> ExtendedContext.sqrt(Decimal('7'))
        Decimal('2.64575131')
        >>> ExtendedContext.sqrt(Decimal('10'))
        Decimal('3.16227766')
        >>> ExtendedContext.sqrt(2)
        Decimal('1.41421356')
        >>> ExtendedContext.prec
        9
        T)r�)r/)r�r-)r.rr'r'r)r-zszContext.sqrtcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a&Return the difference between the two operands.

        >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('1.07'))
        Decimal('0.23')
        >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('1.30'))
        Decimal('0.00')
        >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('2.07'))
        Decimal('-0.77')
        >>> ExtendedContext.subtract(8, 5)
        Decimal('3')
        >>> ExtendedContext.subtract(Decimal(8), 5)
        Decimal('3')
        >>> ExtendedContext.subtract(8, Decimal(5))
        Decimal('3')
        T)r�)r/zUnable to convert %s to DecimalN)r�r�r�rr)r.rrSr�r'r'r)�subtract�s
zContext.subtractcCst|dd�}|j|d�S)a�Convert to a string, using engineering notation if an exponent is needed.

        Engineering notation has an exponent which is a multiple of 3.  This
        can leave up to 3 digits to the left of the decimal place and may
        require the addition of either one or two trailing zeros.

        The operation is not affected by the context.

        >>> ExtendedContext.to_eng_string(Decimal('123E+1'))
        '1.23E+3'
        >>> ExtendedContext.to_eng_string(Decimal('123E+3'))
        '123E+3'
        >>> ExtendedContext.to_eng_string(Decimal('123E-10'))
        '12.3E-9'
        >>> ExtendedContext.to_eng_string(Decimal('-123E-12'))
        '-123E-12'
        >>> ExtendedContext.to_eng_string(Decimal('7E-7'))
        '700E-9'
        >>> ExtendedContext.to_eng_string(Decimal('7E+1'))
        '70'
        >>> ExtendedContext.to_eng_string(Decimal('0E+1'))
        '0.00E+3'

        T)r�)r/)r�r�)r.rr'r'r)r��szContext.to_eng_stringcCst|dd�}|j|d�S)zyConverts a number to a string, using scientific notation.

        The operation is not affected by the context.
        T)r�)r/)r�r�)r.rr'r'r)�
to_sci_string�szContext.to_sci_stringcCst|dd�}|j|d�S)akRounds to an integer.

        When the operand has a negative exponent, the result is the same
        as using the quantize() operation using the given operand as the
        left-hand-operand, 1E+0 as the right-hand-operand, and the precision
        of the operand as the precision setting; Inexact and Rounded flags
        are allowed in this operation.  The rounding mode is taken from the
        context.

        >>> ExtendedContext.to_integral_exact(Decimal('2.1'))
        Decimal('2')
        >>> ExtendedContext.to_integral_exact(Decimal('100'))
        Decimal('100')
        >>> ExtendedContext.to_integral_exact(Decimal('100.0'))
        Decimal('100')
        >>> ExtendedContext.to_integral_exact(Decimal('101.5'))
        Decimal('102')
        >>> ExtendedContext.to_integral_exact(Decimal('-101.5'))
        Decimal('-102')
        >>> ExtendedContext.to_integral_exact(Decimal('10E+5'))
        Decimal('1.0E+6')
        >>> ExtendedContext.to_integral_exact(Decimal('7.89E+77'))
        Decimal('7.89E+77')
        >>> ExtendedContext.to_integral_exact(Decimal('-Inf'))
        Decimal('-Infinity')
        T)r�)r/)r�r')r.rr'r'r)r'�szContext.to_integral_exactcCst|dd�}|j|d�S)aLRounds to an integer.

        When the operand has a negative exponent, the result is the same
        as using the quantize() operation using the given operand as the
        left-hand-operand, 1E+0 as the right-hand-operand, and the precision
        of the operand as the precision setting, except that no flags will
        be set.  The rounding mode is taken from the context.

        >>> ExtendedContext.to_integral_value(Decimal('2.1'))
        Decimal('2')
        >>> ExtendedContext.to_integral_value(Decimal('100'))
        Decimal('100')
        >>> ExtendedContext.to_integral_value(Decimal('100.0'))
        Decimal('100')
        >>> ExtendedContext.to_integral_value(Decimal('101.5'))
        Decimal('102')
        >>> ExtendedContext.to_integral_value(Decimal('-101.5'))
        Decimal('-102')
        >>> ExtendedContext.to_integral_value(Decimal('10E+5'))
        Decimal('1.0E+6')
        >>> ExtendedContext.to_integral_value(Decimal('7.89E+77'))
        Decimal('7.89E+77')
        >>> ExtendedContext.to_integral_value(Decimal('-Inf'))
        Decimal('-Infinity')
        T)r�)r/)r�r�)r.rr'r'r)r��szContext.to_integral_value)	NNNNNNNNN)N)rQ)N)Xr1r2r3r4r�r�r�r�r�rjr�rIr�r(rHrlrdr\r�r�r�r�r�r)r�r�rhr�r�r2r�r3r.r7r�r�r�r8r�r�r�rVr�r;r<r#r�r=r�r>r�r?r@rHrKrLrVrXrYrWr�rZr�r[r�r�r^r_r`r!rbr�r�r�rcr�r�rgr$rhr�r-r�r�r�r'r�r�r'r'r'r)rBs�
"



$#


%
 #2
P:&" c@s&eZdZd	Zd
dd�Zdd�ZeZdS)rir=rUrVNcCsf|dkrd|_d|_d|_nFt|t�rD|j|_t|j�|_|j|_n|d|_|d|_|d|_dS)Nr%r-r+)r=rUrVr_rr7r8rO)r.rtr'r'r)r�s



z_WorkRep.__init__cCsd|j|j|jfS)Nz(%r, %r, %r))r=rUrV)r.r'r'r)r�(sz_WorkRep.__repr__)r=rUrV)N)r1r2r3r|r�r�r�r'r'r'r)ris
ricCs�|j|jkr|}|}n|}|}tt|j��}tt|j��}|jtd||d�}||jd|krpd|_||_|jd|j|j9_|j|_||fS)zcNormalizes op1, op2 to have the same exp and length of coefficient.

    Done during addition.
    r-r+r�r�)rVrfr`rUr�)r�r�r@Ztmpr�Ztmp_lenZ	other_lenrVr'r'r)r�/sr�cCsb|dkrdS|dkr |d|Stt|��}t|�t|jd��}||krPdS|d|SdS)a Given integers n and e, return n * 10**e if it's an integer, else None.

    The computation is designed to avoid computing large powers of 10
    unnecessarily.

    >>> _decimal_lshift_exact(3, 4)
    30000
    >>> _decimal_lshift_exact(300, -999999999)  # returns None

    r%r�rQN)r`rhrf�rstrip)r5r�Zstr_nZval_nr'r'r)r	Osr	cCsF|dks|dkrtd��d}x$||kr@||||d?}}qW|S)z�Closest integer to the square root of the positive integer n.  a is
    an initial approximation to the square root.  Any positive integer
    will do for a, but the closer a is to the square root of n the
    faster convergence will be.

    r%z3Both arguments to _sqrt_nearest should be positive.r-)rl)r5rrSr'r'r)�
_sqrt_nearestds
r�cCs2d|>||?}}|d||d@|d@|kS)z�Given an integer x and a nonnegative integer shift, return closest
    integer to x / 2**shift; use round-to-even in case of a tie.

    r-r+r')rr�rSr�r'r'r)�_rshift_nearestssr�cCs&t||�\}}|d||d@|kS)zaClosest integer to a/b, a and b positive integers; rounds to even
    in the case of a tie.

    r+r-)r�)rrSr�r�r'r'r)�_div_nearest{sr�rc		Cs�||}d}xn||kr*t|�||>|ksF||krzt|�||?|krzt||d>|t||t||�|��}|d7}qWtdtt|��d|�}t||�}t||�}x0t|ddd�D]}t||�t|||�}q�Wt|||�S)a�Integer approximation to M*log(x/M), with absolute error boundable
    in terms only of x/M.

    Given positive integers x and M, return an integer approximation to
    M * log(x/M).  For L = 8 and 0.1 <= x/M <= 10 the difference
    between the approximation and the exact result is at most 22.  For
    L = 8 and 1.0 <= x/M <= 10.0 the difference is at most 15.  In
    both cases these are upper bounds on the error; it will usually be
    much smaller.r%r-r�r[i����r�)rhr�r�r�rUrfr`r�)	r�M�Lr�R�TZyshift�wr�r'r'r)�_ilog�s

r�c
Cs�|d7}tt|��}||||dk}|dkr�d|}|||}|dkrZ|d|9}nt|d|�}t||�}t|�}t|||�}||}	nd}t|d|�}	t|	|d�S)z�Given integers c, e and p with c > 0, p >= 0, compute an integer
    approximation to 10**p * log10(c*10**e), with an absolute error of
    at most 1.  Assumes that c*10**e is not exactly 1.r+r-r%r�r)rfr`r�r��
_log10_digits)
r+r�rr,r~r�r��log_dZlog_10Zlog_tenpowerr'r'r)rJ�s 

rJc	Cs�|d7}tt|��}||||dk}|dkrr|||}|dkrR|d|9}nt|d|�}t|d|�}nd}|r�ttt|���d}||dkr�t|t||�d|�}q�d}nd}t||d�S)z�Given integers c, e and p with c > 0, compute an integer
    approximation to 10**p * log(c*10**e), with an absolute error of
    at most 1.  Assumes that c*10**e is not exactly 1.r+r-r%r�r)rfr`r�r�rhr�)	r+r�rr,r~r�r�rZ	f_log_tenr'r'r)rG�s"rGc@s eZdZdZdd�Zdd�ZdS)�
_Log10Memoizez�Class to compute, store, and allow retrieval of, digits of the
    constant log(10) = 2.302585....  This constant is needed by
    Decimal.ln, Decimal.log10, Decimal.exp and Decimal.__pow__.cCs
d|_dS)NZ/23025850929940456840179914546843642076011014886)rx)r.r'r'r)r�sz_Log10Memoize.__init__cCs�|dkrtd��|t|j�kr�d}xLd||d}tttd||�d��}||d�d|krdP|d7}q$W|jd�dd
�|_t|jd|d	��S)ztGiven an integer p >= 0, return floor(10**p)*log(10).

        For example, self.getdigits(3) returns 2302.
        r%zp should be nonnegativer[r�r+rNrQr-r�)rlrfrxr`r�r�r�rU)r.rrr�rxr'r'r)�	getdigitss	z_Log10Memoize.getdigitsN)r1r2r3r4r�r�r'r'r'r)r�sr�c	Cs�t||>|�}tdtt|��d|�}t||�}||>}x.t|ddd�D]}t|||||�}qRWx6t|ddd	�D]"}||d>}t||||�}q�W||S)
z�Given integers x and M, M > 0, such that x/M is small in absolute
    value, compute an integer approximation to M*exp(x/M).  For 0 <=
    x/M <= 2.4, the absolute error in the result is bounded by 60 (and
    is usually much smaller).r�r[r-r%r+i����r�r�r�)rrUrfr`r�r�)	rr�r�r�r�rZMshiftrr�r'r'r)�_iexp&s
r�c	Cs�|d7}td|tt|��d�}||}||}|dkrH|d|}n|d|}t|t|��\}}t|d|�}tt|d|�d�||dfS)a�Compute an approximation to exp(c*10**e), with p decimal places of
    precision.

    Returns integers d, f such that:

      10**(p-1) <= d <= 10**p, and
      (d-1)*10**f < exp(c*10**e) < (d+1)*10**f

    In other words, d*10**f is an approximation to exp(c*10**e) with p
    digits of precision, and with an error in d of at most 1.  This is
    almost, but not quite, the same as the error being < 1ulp: when d
    = 10**(p-1) the error could be up to 10 ulp.r+r%r-r�i�r[)r�rfr`r�r�r�r�)	r+r�rrr�r�ZcshiftZquotrr'r'r)r9Ksr9cCs�ttt|���|}t||||d�}||}|dkrJ||d|}nt||d|�}|dkr�tt|��|dk|dkkr�d|ddd|}	}
q�d|d|}	}
n,t||d|d�\}	}
t|	d�}	|
d7}
|	|
fS)a5Given integers xc, xe, yc and ye representing Decimals x = xc*10**xe and
    y = yc*10**ye, compute x**y.  Returns a pair of integers (c, e) such that:

      10**(p-1) <= c <= 10**p, and
      (c-1)*10**e < x**y < (c+1)*10**e

    in other words, c*10**e is an approximation to x**y with p digits
    of precision, and with an error in c of at most 1.  (This is
    almost, but not quite, the same as the error being < 1ulp: when c
    == 10**(p-1) we can only guarantee error < 10ulp.)

    We assume that: x is positive and not equal to 1, and y is nonzero.
    r-r%r�)rfr`rhrGr�r9)r
rrrrrSZlxcr�Zpcr�rVr'r'r)ros
rr�F�5�(�rA�r�ry)	r��2�3�4�5�6�7�8r>cCs0|dkrtd��t|�}dt|�||dS)z@Compute a lower bound for 100*log10(c) for a positive integer c.r%z0The argument to _log10_lb should be nonnegative.r)rlr`rf)r+Z
correctionZstr_cr'r'r)r
�sr
cCsLt|t�r|St|t�r t|�S|r8t|t�r8tj|�S|rHtd|��tS)z�Convert other to Decimal.

    Verifies that it's ok to use in an implicit construction.
    If allow_float is true, allow conversion from float;  this
    is used in the comparison methods (__eq__ and friends).

    zUnable to convert %s to Decimal)r_rrUrprqrrr�)r�r�Zallow_floatr'r'r)r��s


r�cCs�t|t�r||fSt|tj�rR|jsDt|jtt|j	�|j
�|j�}|t|j�fS|rrt|tj
�rr|jdkrr|j}t|t�r�t�}|r�d|jt<n|jtd�|tj|�fSttfS)z�Given a Decimal instance self and a Python object other, return
    a pair (s, o) of Decimal instances such that "s op o" is
    equivalent to "self op other" for any of the 6 comparison
    operators "op".

    r%r-z;strict semantics for mixing floats and Decimals are enabled)r_r�_numbersZRationalrPr6r7r`rUr8�denominatorrO�	numeratorZComplexr�r�rprrrrdrqr�)r.r�r�r/r'r'r)r��s$

r�ri?B)r@r?rrrAr"r�r�r\)r@r?rra�        # A numeric string consists of:
#    \s*
    (?P<sign>[-+])?              # an optional sign, followed by either...
    (
        (?=\d|\.\d)              # ...a number (with at least one digit)
        (?P<int>\d*)             # having a (possibly empty) integer part
        (\.(?P<frac>\d*))?       # followed by an optional fractional part
        (E(?P<exp>[-+]?\d+))?    # followed by an optional exponent, or...
    |
        Inf(inity)?              # ...an infinity, or...
    |
        (?P<signal>s)?           # ...an (optionally signaling)
        NaN                      # NaN
        (?P<diag>\d*)            # with (possibly empty) diagnostic info.
    )
#    \s*
    \Z
z0*$z50*$z�\A
(?:
   (?P<fill>.)?
   (?P<align>[<>=^])
)?
(?P<sign>[-+ ])?
(?P<alt>\#)?
(?P<zeropad>0)?
(?P<minimumwidth>(?!0)\d+)?
(?P<thousands_sep>,)?
(?:\.(?P<precision>0|(?!0)\d+))?
(?P<type>[eEfFgGn%])?
\Z
cCs�tj|�}|dkrtd|��|j�}|d}|d}|ddk	|d<|drv|dk	rbtd|��|dk	rvtd|��|p|d|d<|p�d	|d<|d
dkr�d|d
<t|dp�d
�|d<|ddk	r�t|d�|d<|ddkr�|ddks�|ddkr�d|d<|ddk�rfd|d<|dk�r&tj�}|ddk	�r@td|��|d|d<|d|d<|d|d<n*|ddk�r|d|d<ddg|d<d|d<|S)a�Parse and validate a format specifier.

    Turns a standard numeric format specifier into a dict, with the
    following entries:

      fill: fill character to pad field to minimum width
      align: alignment type, either '<', '>', '=' or '^'
      sign: either '+', '-' or ' '
      minimumwidth: nonnegative integer giving minimum width
      zeropad: boolean, indicating whether to pad with zeros
      thousands_sep: string to use as thousands separator, or ''
      grouping: grouping for thousands separators, in format
        used by localeconv
      decimal_point: string to use for decimal point
      precision: nonnegative integer giving precision, or None
      type: one of the characters 'eEfFgG%', or None

    NzInvalid format specifier: �fill�align�zeropadz7Fill character conflicts with '0' in format specifier: z2Alignment conflicts with '0' in format specifier: � �>r=rT�minimumwidthrQrsr%rkZgGnr-r5rq�
thousands_sepzJExplicit thousands separator conflicts with 'n' type in format specifier: �grouping�
decimal_pointrSr[r�)�_parse_format_specifier_regex�matchrl�	groupdictrU�_locale�
localeconv)�format_specroruZformat_dictr�r�r'r'r)ruDsN

ruc	Cs�|d}|d}||t|�t|�}|d}|dkrF|||}nj|dkr\|||}nT|dkrr|||}n>|dkr�t|�d}|d	|�||||d	�}ntd
��|S)z�Given an unpadded, non-aligned numeric string 'body' and sign
    string 'sign', add padding and alignment conforming to the given
    format specifier dictionary 'spec' (as produced by
    parse_format_specifier).

    r�r�r��<r��=�^r+NzUnrecognised alignment field)rfrl)	r=rzryr�r�Zpaddingr�r�Zhalfr'r'r)rw�s"rwcCspddlm}m}|sgS|ddkrJt|�dkrJ||dd�||d	��S|d
tjkrd|dd�Std��dS)zyConvert a localeconv-style grouping into a (possibly infinite)
    iterable of integers representing group lengths.

    r%)�chain�repeatr-r+Nz unrecognised format for groupingr�r�r�r�r�)�	itertoolsr�r�rfr��CHAR_MAXrl)r�r�r�r'r'r)�_group_lengths�s
r�cCs�|d}|d}g}x�t|�D]�}|dkr2td��ttt|�|d�|�}|jd|t|�||d��|d|�}||8}|r�|dkr�P|t|�8}qWtt|�|d�}|jd|t|�||d��|jt|��S)anInsert thousands separators into a digit string.

    spec is a dictionary whose keys should include 'thousands_sep' and
    'grouping'; typically it's the result of parsing the format
    specifier using _parse_format_specifier.

    The min_width keyword argument gives the minimum length of the
    result, which will be padded on the left with zeros if necessary.

    If necessary, the zero padding adds an extra '0' on the left to
    avoid a leading thousands separator.  For example, inserting
    commas every three digits in '123456', with min_width=8, gives
    '0,123,456', even though that has length 9.

    r�r�r%zgroup length should be positiver-rQN)r�rlr�r�rfrmrn�reversed)rxry�	min_width�sepr��groupsr,r'r'r)�_insert_thousands_sep�s $$r�cCs$|rdS|ddkr|dSdSdS)zDetermine sign character.rTr=z +rSNr')�is_negativeryr'r'r)rv�s
rvcCs�t||�}|s|dr"|d|}|dks6|ddkr\ddddd�|d}|d	j||�7}|dd
krp|d
7}|dr�|dt|�t|�}nd}t|||�}t||||�S)
acFormat a number, given the following data:

    is_negative: true if the number is negative, else false
    intpart: string of digits that must appear before the decimal point
    fracpart: string of digits that must come after the point
    exp: exponent, as an integer
    spec: dictionary resulting from parsing the format specifier

    This function uses the information in spec to:
      insert separators (decimal separator and thousands separators)
      format the sign
      format the exponent
      add trailing '%' for the '%' type
      zero-pad if necessary
      fill and align if necessary
    Zaltr�r%rkrtr�r�)r�r�rrrqz{0}{1:+}rpr�r�)rv�formatrfr�rw)r�rvrwrVryr=Zecharr�r'r'r)rx�s
rxZInfz-Infr�ll����l������N�Zoi���)N)F)r%)r)r)FF)Fi���)N)r-r�)}r4�__all__r1rD�__version__Z__libmpdec_version__ZmathrzZnumbersr�rE�collectionsr&Z_namedtupler�ImportErrorrrrrrrrrr$�maxsizer r!r"r#�ArithmeticErrorrrr	r�ZeroDivisionErrorr
rrrrrr
rrrrrrr�r�rJr]rBrFrL�hasattrrKrGrrrrr6�Number�registerrNrrir�rUr}rr	r�r�r�r�rJrGr�r�r�r�r9rr
r�r�rrr�re�compile�VERBOSE�
IGNORECASEr�rar�r��DOTALLr�Zlocaler�rurwr�r�rvrxrFrEr:r5rr4r<�	hash_info�modulusr�rar�r�r�r�r�r'r'r'r)�<module>qs�


&



.

^

0",#
%$+
	

*

P
%
)os.cpython-36.opt-2.pyc000064400000042565150335715140010573 0ustar003


 \���0@s�ddlZddlZddlZddlZejZdddddddd	d
ddd
dddddddgZdd�Zdd�Z	dekr�dZ
dZddlTyddlm
Z
ejd�Wnek
r�YnXddlZyddlmZWnek
r�YnXddlZeje	e��[n�dek�r�dZ
d ZddlTyddlm
Z
ejd�Wnek
�r:YnXddlZddlZeje	e��[yddlmZWnek
�r�YnXned!��eejd"<dd#lmZmZmZmZmZmZmZmZ[ed$��r�e �Z!d%d&�Z"e#�Z$e"d'd(�e"d)d*�e"d+d,�e"d-d.�e"d/d0�e"d1d2�e"d3d4�e"d5d6�e"d7d8�e"d9d:�e"d;d<�e"d=d>�e"d?d@�e"dAdB�e"dAdC�e"dDd0�e$Z%e#�Z$e"d'd(�e$Z&e#�Z$e"dEdF�e"dGd*�e"dHd,�e"dIdJ�e"dKdL�e$j'e�e"dMdN�e"dOd0�e"dPd0�e"dQdR�edS��r edT��r e"dUdS�e$Z(e#�Z$e"d'd(�e"d+d,�e"d-d.�e"dVdW�e"dXd*�edY��rpe"dZd,�e"d1d2�e"d[d0�e"d\d.�e"d-d.�e"dDd0�e"d]d.�e$Z)[$[[!["dZ*d^Z+d_Z,d�dbdc�Z-ddde�Z.dfdg�Z/ejdcdedgg�d�didj�Z0ejdj�e1ehe%k�rBe2ehe(k�rBd�daddl�dmdn�Z3dodp�Z4ejdn�ye5Wne6k
�rdiZ5YnXdqdr�Z7dsdt�Z8dudv�Z9dwdx�Z:dydz�Z;d{d|�Z<ejdrdtdvdxdzd|g�d�d}d~�Z=d�dd�Z>dd�l?m@Z@Gd�d��d�e@�ZAyeBZCWne6k
�rd�d��ZCYnXd�ek�rejd��yeDZEWne6k
�r>d�d��ZEYnXd�ek�rTejd��d�d��ZFeF�Z5[Fd�d�d��ZGe
dkZHejd��eH�r�d�d��ZIeAe5jJeIeKeIeKeCeE�ZL[Id�d�d��ZMejd��d�d��ZNeN�\ZOZP[Ned���rDed���rDed���rDdZQd^ZRZSejd�d�d�g�d�d��ZTd�d��ZUd�d��ZVd�d��ZWd�d��ZXejd�d�d�d�g�ed���rld�d��ZYd�d��ZZejd�d�g�ed���r�d�d��Z[d�d��Z\ejd�d�g�d�d�d�Z]Gd�d��d��Z^d�d�Z_d�d��Z`ed���s�e`Zad�ea_bGd�d��d�ejc�ZddS)��N�altsep�curdir�pardir�sep�pathsep�linesep�defpath�name�path�devnull�SEEK_SET�SEEK_CUR�SEEK_END�fsencode�fsdecode�
get_exec_path�fdopen�popen�extsepcCs
|t�kS)N)�globals)r	�r�/usr/lib64/python3.6/os.py�_exists%srcCs2y
t|j�Stk
r,dd�t|�D�SXdS)NcSsg|]}|ddkr|�qS)r�_r)�.0�nrrr�
<listcomp>,sz%_get_exports_list.<locals>.<listcomp>)�list�__all__�AttributeError�dir)�modulerrr�_get_exports_list(s
r"�posix�
)�*)�_exitr&)�_have_functions�ntz
zno os specific module foundzos.path)rrrrrrrrr'cCs"|tkr|tkrtjt|�dS)N)�_globalsr'�_set�add)�str�fnrrr�_adddsr.�HAVE_FACCESSAT�access�
HAVE_FCHMODAT�chmod�
HAVE_FCHOWNAT�chown�HAVE_FSTATAT�stat�HAVE_FUTIMESAT�utime�HAVE_LINKAT�link�HAVE_MKDIRAT�mkdir�
HAVE_MKFIFOAT�mkfifo�HAVE_MKNODAT�mknod�HAVE_OPENAT�open�HAVE_READLINKAT�readlink�
HAVE_RENAMEAT�rename�HAVE_SYMLINKAT�symlink�
HAVE_UNLINKAT�unlink�rmdir�HAVE_UTIMENSAT�HAVE_FCHDIR�chdir�HAVE_FCHMOD�HAVE_FCHOWN�HAVE_FDOPENDIR�listdir�HAVE_FEXECVE�execve�HAVE_FTRUNCATE�truncate�
HAVE_FUTIMENS�HAVE_FUTIMES�HAVE_FPATHCONF�pathconf�statvfs�fstatvfs�
HAVE_FSTATVFS�
HAVE_LCHFLAGSZchflags�HAVE_LCHMOD�lchown�HAVE_LCHOWN�HAVE_LUTIMES�
HAVE_LSTATZ
MS_WINDOWS���FcCs�tj|�\}}|s tj|�\}}|r~|r~tj|�r~yt|||�Wntk
rXYnXt}t|t�rrttd�}||kr~dSyt||�Wn(t	k
r�|s�tj
|�r��YnXdS)N�ASCII)r
�split�exists�makedirs�FileExistsErrorr�
isinstance�bytesr<�OSError�isdir)r	�mode�exist_ok�head�tail�cdirrrrrj�s$


rjcCslt|�tj|�\}}|s(tj|�\}}x>|rf|rfyt|�Wntk
rTPYnXtj|�\}}q*WdS)N)rKr
rhrn)r	rrrsrrr�
removedirs�s
rucCsptj|�\}}|r*|r*tj|�r*t|�t||�tj|�\}}|rl|rlyt|�Wntk
rjYnXdS)N)r
rhrirjrFrurn)�old�newrrrsrrr�renames�s
rxTc6cs�t|�}g}g}g}yt|�}Wn0tk
rP}z|dk	rB||�dSd}~XnX|���x�y(yt|�}	Wntk
r�PYnXWn0tk
r�}z|dk	r�||�dSd}~XnXy|	j�}
Wntk
r�d}
YnX|
r�|j|	j�n|j|	j�|r^|
r^|�rd}n.y|	j�}Wntk
�r8d}YnX|}|r^|j|	j	�q^WWdQRX|�r�|||fVt	j
t	j}
}xp|D]6}|||�}|�s�|
|��r�t||||�EdH�q�Wn0x"|D]}t||||�EdH�q�W|||fVdS)NFT)
�fspath�scandirrn�next�
StopIteration�is_dir�appendr	�
is_symlinkr
�islink�join�walk)�top�topdown�onerror�followlinks�dirs�nondirs�	walk_dirs�
scandir_it�error�entryr}�	walk_intorr�r��dirname�new_pathrrrr�s`:





r��.)�follow_symlinks�dir_fdccs�t|t�st|d�r t|�}t|d|d�}t|t|d�}z:|s^tj|j	�rtt
j|t|��rtt|||||�EdHWdt
|�XdS)N�	__index__F)r�r�)r�)rl�int�hasattrryr6rB�O_RDONLY�st�S_ISDIR�st_moder
�samestat�_fwalk�close)r�r�r�r�r��orig_st�topfdrrr�fwalk�s!r�c
cs|t|�}gg}}x�|D]�}y.tjt||d�j�r>|j|�n
|j|�Wqtk
r�y$tjt||dd�j�r||j|�Wntk
r�wYnXYqXqW|r�||||fVx�|D]�}y t|||d�}	t|t	|d�}
Wn8tk
�r}z|dk	�r||�w�WYdd}~XnXz>|�s0t
j|	t|
���rRt
j||�}t
|
||||�EdHWdt|
�Xq�W|�sx||||fVdS)N)r�F)r�r�)rRr�r�r6r�r~rn�S_ISLNKrBr�r
r�r�r�r�)
r��toppathr�r�r��namesr�r�r	r��dirfd�err�dirpathrrrr��s<



r�cGst||�dS)N)�execv)�file�argsrrr�execl
sr�cGs |d}t||dd�|�dS)Nrd���r�)rT)r�r��envrrr�execlesr�cGst||�dS)N)�execvp)r�r�rrr�execlpsr�cGs |d}t||dd�|�dS)Nrdr�r�)�execvpe)r�r�r�rrr�execlpe sr�cCst||�dS)N)�_execvpe)r�r�rrrr�)sr�cCst|||�dS)N)r�)r�r�r�rrrr�1sr�cCs|dk	rt}||f}nt}|f}t}tj|�\}}|rH||f|��dSd}}d}	t|�}
tdkrvt|�}tt|
�}
x�|
D]~}tj	||�}y||f|��Wq|t
k
r�}
z>|
}tj�d}|
j
t
jkr�|
j
t
jkr�|dkr�|
}|}	WYdd}
~
Xq|Xq|W|�r|j|	��|j|��dS)Nr(re)rTr��environr
rhrr	r�mapr�rn�sys�exc_info�errno�ENOENT�ENOTDIR�with_traceback)r�r�r��	exec_func�argrestrrrs�last_exc�	saved_exc�saved_tb�	path_listr �fullname�e�tbrrrr�<s<



r�cCs�ddl}|dkrt}|j���|jdt�y|jd�}Wntk
rPd}YnXtr�y|d}Wnttfk
rzYnX|dk	r�t	d��|}|dk	r�t
|t�r�t|�}WdQRX|dkr�t
}|jt�S)Nr�ignore�PATHsPATHz*env cannot contain 'PATH' and b'PATH' keys)�warningsr��catch_warnings�simplefilter�BytesWarning�get�	TypeError�supports_bytes_environ�KeyError�
ValueErrorrlrmrrrhr)r�r�r��
path_listbrrrr_s.


)�MutableMappingc@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�_EnvironcCs.||_||_||_||_||_||_||_dS)N)�	encodekey�	decodekey�encodevalue�decodevalue�putenv�unsetenv�_data)�self�datar�r�r�r�r�r�rrr�__init__�sz_Environ.__init__cCs>y|j|j|�}Wntk
r2t|�d�YnX|j|�S)N)r�r�r�r�)r��key�valuerrr�__getitem__�s
z_Environ.__getitem__cCs.|j|�}|j|�}|j||�||j|<dS)N)r�r�r�r�)r�r�r�rrr�__setitem__�s

z_Environ.__setitem__cCsD|j|�}|j|�y|j|=Wntk
r>t|�d�YnXdS)N)r�r�r�r�)r�r��
encodedkeyrrr�__delitem__�s

z_Environ.__delitem__ccs(t|j�}x|D]}|j|�VqWdS)N)rr�r�)r��keysr�rrr�__iter__�s

z_Environ.__iter__cCs
t|j�S)N)�lenr�)r�rrr�__len__�sz_Environ.__len__cs$djdj�fdd��jj�D���S)Nzenviron({{{}}})z, c3s*|]"\}}dj�j|��j|��VqdS)z
{!r}: {!r}N)�formatr�r�)rr�r�)r�rr�	<genexpr>�sz$_Environ.__repr__.<locals>.<genexpr>)r�r�r��items)r�r)r�r�__repr__�s
z_Environ.__repr__cCst|�S)N)�dict)r�rrr�copy�sz
_Environ.copycCs||kr|||<||S)Nr)r�r�r�rrr�
setdefault�sz_Environ.setdefaultN)�__name__�
__module__�__qualname__r�r�r�r�r�r�r�r�r�rrrrr��s		r�cCsdS)Nr)r�r�rrr�<lambda>�sr�r�cCs
t|d�S)N�)�_putenv)r�rrrr��sr�cs�tdkrLdd�}|�t}�fdd�}i}xJtj�D]\}}||||�<q2Wn(tj���fdd���fdd	�}�}t}t|||�|tt�S)
Nr(cSs t|t�stdt|�j��|S)Nzstr expected, not %s)rlr,r��typer�)r�rrr�	check_str�s
z!_createenviron.<locals>.check_strcs�|�j�S)N)�upper)r�)�encoderrr��sz!_createenviron.<locals>.encodekeycs(t|t�stdt|�j��|j�d�S)Nzstr expected, not %s�surrogateescape)rlr,r�r�r�r�)r�)�encodingrrr��s
z_createenviron.<locals>.encodecs|j�d�S)Nr�)�decode)r�)r�rrr��sz_createenviron.<locals>.decode)	r	r,r�r�r��getfilesystemencodingr�r��	_unsetenv)r�r�r�r�r�r�r)r�r�r�_createenviron�s"r�cCstj||�S)N)r�r�)r��defaultrrr�getenv�sr�r�cCs t|t�stdt|�j��|S)Nzbytes expected, not %s)rlrmr�r�r�)r�rrr�_check_bytess
r�cCstj||�S)N)�environbr�)r�r�rrr�getenvbsrr�cs4tj��tj����fdd�}��fdd�}||fS)Ncs&t|�}t|t�r|j���S|SdS)N)ryrlr,r�)�filename)r��errorsrrrs
z_fscodec.<locals>.fsencodecs&t|�}t|t�r|j���S|SdS)N)ryrlrmr�)r)r�rrrr&s
z_fscodec.<locals>.fsdecode)r�r��getfilesystemencodeerrors)rrr)r�rr�_fscodecs
r�fork�spawnvr��P_WAIT�P_NOWAIT�	P_NOWAITOc
Cs�t|ttf�std��|s&|dr.td��t�}|sty$|dkrN|||�n||||�Wq�td�Yq�XnV|tkr�|SxHt|d�\}}t	|�r�q�q�t
|�r�t|�St|�r�t
|�Std��q�WdS)Nzargv must be a tuple or a listrz"argv first element cannot be empty�z"Not stopped, signaled or exited???)rl�tuplerr�r�rr&r�waitpid�
WIFSTOPPED�WIFSIGNALED�WTERMSIG�	WIFEXITED�WEXITSTATUSrn)rpr�r�r��func�pid�wpid�stsrrr�	_spawnvefCs.
rcCst|||dt�S)N)rr�)rpr�r�rrrrbscCst||||t�S)N)rrT)rpr�r�r�rrr�spawnveksrcCst|||dt�S)N)rr�)rpr�r�rrr�spawnvpwsrcCst||||t�S)N)rr�)rpr�r�r�rrr�spawnvpe�srcGst|||�S)N)r)rpr�r�rrr�spawnl�srcGs|d}t|||dd�|�S)Nrdr�r�)r)rpr�r�r�rrr�spawnle�srcGst|||�S)N)r)rpr�r�rrr�spawnlp�srcGs|d}t|||dd�|�S)Nrdr�r�)r)rpr�r�r�rrr�spawnlpe�sr�rcCs�t|t�stdt|���|d
kr.td|��|dks>|dkrFtd��ddl}ddl}|dkr�|j|d|j|d�}t	|j
|j�|�S|j|d|j|d	�}t	|j
|j�|�SdS)Nz&invalid cmd type (%s, expected string)r�wzinvalid mode %rrz+popen() does not support unbuffered streamsT)�shell�stdout�bufsize)r �stdinr")rr)
rlr,r�r�r��
subprocess�io�Popen�PIPE�_wrap_close�
TextIOWrapperr!r#)�cmdrp�	bufferingr$r%�procrrrr�s$
c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)r(cCs||_||_dS)N)�_stream�_proc)r��streamr,rrrr��sz_wrap_close.__init__cCs8|jj�|jj�}|dkr dStdkr,|S|d>SdS)Nrr(�)r-r�r.�waitr	)r��
returncoderrrr��s

z_wrap_close.closecCs|S)Nr)r�rrr�	__enter__�sz_wrap_close.__enter__cGs|j�dS)N)r�)r�r�rrr�__exit__�sz_wrap_close.__exit__cCst|j|�S)N)�getattrr-)r�r	rrr�__getattr__�sz_wrap_close.__getattr__cCs
t|j�S)N)�iterr-)r�rrrr��sz_wrap_close.__iter__N)	r�r�r�r�r�r3r4r6r�rrrrr(�s	r(cOs4t|t�stdt|���ddl}|j|f|�|�S)Nz&invalid fd type (%s, expected integer)r)rlr�r�r�r%rB)�fdr��kwargsr%rrrr�s
c
Cs�t|ttf�r|St|�}y|j|�}Wn0tk
rXt|d�rF�ntd|j��YnXt|ttf�rl|Stdj	|jt|�j���dS)N�
__fspath__z/expected str, bytes or os.PathLike object, not z7expected {}.__fspath__() to return str or bytes, not {})
rlr,rmr�r:rr�r�r�r�)r
�	path_type�	path_reprrrr�_fspath�s
r=ryc@s&eZdZejdd��Zedd��ZdS)�PathLikecCst�dS)N)�NotImplementedError)r�rrrr:&szPathLike.__fspath__cCs
t|d�S)Nr:)r�)�cls�subclassrrr�__subclasshook__+szPathLike.__subclasshook__N)r�r�r��abc�abstractmethodr:�classmethodrBrrrrr>"sr>)rfF)TNF)r�TN)N)N)N)r�r�)N)r�rr�)rr�)erCr�r�r6r��builtin_module_namesZ_namesrrr"r	rr#r&r~�ImportError�	posixpathr
r'�extendr(Zntpath�modulesZos.pathrrrrrrrrrr)r.�setr*�supports_dir_fd�supports_effective_idsr+�supports_fd�supports_follow_symlinksrr
rrjrurxr�rBrRr�r�r��	NameErrorr�r�r�r�r�r�r�r�_collections_abcr�r�r�r�r�r�r�r�r�r�r�rmr�rrrrrrr	rrrrrrrrrrr(rr=ryr��ABCr>rrrr�<module>sz


(










































 

./

		
#
-7








 	

	


	
token.cpython-36.opt-2.pyc000064400000006310150335715140011256 0ustar003


 \�@sNddddgZdZdZdZdZdZd	Zd
ZdZdZ	d
Z
dZdZdZ
dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Zd"Zd#Z d$Z!d%Z"d&Z#d'Z$d(Z%d)Z&d*Z'd+Z(d,Z)d-Z*d.Z+d/Z,d0Z-d1Z.d2Z/d3Z0d4Z1d5Z2d6Z3d7Z4d8Z5d9Z6d:Z7d;Z8d<Z9d=Z:d>Z;d?d@�e<�j=�D�Z>ej?e>j@��dAd�ZAdBd�ZBdCd�ZCdDdE�ZDeEdFk�rJeD�dGS)H�tok_name�
ISTERMINAL�
ISNONTERMINAL�ISEOF����������	�
���
������������������� �!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�0�1�2�3�4�5�6�7�8�9�cCs,i|]$\}}t|t�r|jd�r||�qS)�_)�
isinstance�int�
startswith)�.0�name�value�rG�/usr/lib64/python3.6/token.py�
<dictcomp>JsrIcCs|tkS)N)�	NT_OFFSET)�xrGrGrHrOscCs|tkS)N)rJ)rKrGrGrHrRscCs|tkS)N)�	ENDMARKER)rKrGrGrHrUscJCspddl}ddl}|jdd�}|r*|dp,d}d}t|�dkrF|d}yt|�}Wn@tk
r�}z$|jjdt|��|j	d�WYdd}~XnX|�|j
�jd�}WdQRX|jd|j
�}i}	x:|D]2}
|j|
�}|r�|jdd�\}}
t|
�}
||	|
<q�Wt|	j��}yt|�}WnBtk
�rZ}z$|jjdt|��|j	d�WYdd}~XnX|�|j
�jd�}WdQRXy|jd	�d}|jd
�}Wn,tk
�r�|jjd�|j	d�YnXg}x$|D]}
|jd
|	|
|
f��q�W||||�<yt|d�}WnBtk
�rJ}z$|jjdt|��|j	d�WYdd}~XnX|�|jdj|��WdQRXdS)NrrzInclude/token.hzLib/token.pyzI/O error: %s
�
z:#define[ 	][ 	]*([A-Z0-9][A-Z0-9_]*)[ 	][ 	]*([0-9][0-9]*)rz#--start constants--z#--end constants--z&target does not contain format markersrz%s = %d�wr	)�re�sys�argv�len�open�OSError�stdout�write�str�exit�read�split�compile�
IGNORECASE�match�grouprB�sorted�keys�stderr�index�
ValueError�append�join)rOrP�args�
inFileName�outFileName�fp�err�lines�prog�tokens�liner]rE�valr`�format�start�endrGrGrH�_mainYsb


rs�__main__N)F�__all__rL�NAME�NUMBER�STRING�NEWLINE�INDENT�DEDENT�LPAR�RPAR�LSQB�RSQB�COLON�COMMA�SEMI�PLUS�MINUS�STAR�SLASH�VBAR�AMPER�LESS�GREATER�EQUAL�DOT�PERCENT�LBRACE�RBRACE�EQEQUAL�NOTEQUAL�	LESSEQUAL�GREATEREQUAL�TILDE�
CIRCUMFLEX�	LEFTSHIFT�
RIGHTSHIFT�
DOUBLESTAR�	PLUSEQUAL�MINEQUAL�	STAREQUAL�
SLASHEQUAL�PERCENTEQUAL�
AMPEREQUAL�	VBAREQUAL�CIRCUMFLEXEQUAL�LEFTSHIFTEQUAL�RIGHTSHIFTEQUAL�DOUBLESTAREQUAL�DOUBLESLASH�DOUBLESLASHEQUAL�AT�ATEQUAL�RARROW�ELLIPSIS�OP�AWAIT�ASYNC�
ERRORTOKEN�N_TOKENSrJ�globals�itemsr�extend�valuesrrrrs�__name__rGrGrGrH�<module>s�
5
wave.cpython-36.pyc000064400000042737150335715140010155 0ustar003


 \-E�@s�dZddlZdddddgZGdd�de�Zd	ZdZddlZddlZddl	Z	dd
l
mZddlm
Z
e
dd�ZGdd�d�ZGdd�d�Zddd�ZeZdS)a$
Stuff to parse WAVE files.

Usage.

Reading WAVE files:
      f = wave.open(file, 'r')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods read(), seek(), and close().
When the setpos() and rewind() methods are not used, the seek()
method is not  necessary.

This returns an instance of a class with the following public methods:
      getnchannels()  -- returns number of audio channels (1 for
                         mono, 2 for stereo)
      getsampwidth()  -- returns sample width in bytes
      getframerate()  -- returns sampling frequency
      getnframes()    -- returns number of audio frames
      getcomptype()   -- returns compression type ('NONE' for linear samples)
      getcompname()   -- returns human-readable version of
                         compression type ('not compressed' linear samples)
      getparams()     -- returns a namedtuple consisting of all of the
                         above in the above order
      getmarkers()    -- returns None (for compatibility with the
                         aifc module)
      getmark(id)     -- raises an error since the mark does not
                         exist (for compatibility with the aifc module)
      readframes(n)   -- returns at most n frames of audio
      rewind()        -- rewind to the beginning of the audio stream
      setpos(pos)     -- seek to the specified position
      tell()          -- return the current position
      close()         -- close the instance (make it unusable)
The position returned by tell() and the position given to setpos()
are compatible and have nothing to do with the actual position in the
file.
The close() method is called automatically when the class instance
is destroyed.

Writing WAVE files:
      f = wave.open(file, 'w')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods write(), tell(), seek(), and
close().

This returns an instance of a class with the following public methods:
      setnchannels(n) -- set the number of channels
      setsampwidth(n) -- set the sample width
      setframerate(n) -- set the frame rate
      setnframes(n)   -- set the number of frames
      setcomptype(type, name)
                      -- set the compression type and the
                         human-readable compression type
      setparams(tuple)
                      -- set all parameters at once
      tell()          -- return current position in output file
      writeframesraw(data)
                      -- write audio frames without pathing up the
                         file header
      writeframes(data)
                      -- write audio frames and patch up the file header
      close()         -- patch up the file header and close the
                         output file
You should set the parameters before the first writeframesraw or
writeframes.  The total number of frames does not need to be set,
but when it is set to the correct value, the header does not have to
be patched up.
It is best to first set all parameters, perhaps possibly the
compression type, and then write audio frames using writeframesraw.
When all frames have been written, either call writeframes(b'') or
close() to patch up the sizes in the header.
The close() method is called automatically when the class instance
is destroyed.
�N�open�openfp�Error�	Wave_read�
Wave_writec@seZdZdS)rN)�__name__�
__module__�__qualname__�r
r
�/usr/lib64/python3.6/wave.pyrNs��b�h�i)�Chunk)�
namedtuple�_wave_paramsz7nchannels sampwidth framerate nframes comptype compnamec@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,S)-raPVariables used in this class:

    These variables are available to the user though appropriate
    methods of this class:
    _file -- the open file with methods read(), close(), and seek()
              set through the __init__() method
    _nchannels -- the number of audio channels
              available through the getnchannels() method
    _nframes -- the number of audio frames
              available through the getnframes() method
    _sampwidth -- the number of bytes per audio sample
              available through the getsampwidth() method
    _framerate -- the sampling frequency
              available through the getframerate() method
    _comptype -- the AIFF-C compression type ('NONE' if AIFF)
              available through the getcomptype() method
    _compname -- the human-readable AIFF-C compression type
              available through the getcomptype() method
    _soundpos -- the position in the audio stream
              available through the tell() method, set through the
              setpos() method

    These variables are used internally only:
    _fmt_chunk_read -- 1 iff the FMT chunk has been read
    _data_seek_needed -- 1 iff positioned correctly in audio
              file for readframes()
    _data_chunk -- instantiation of a chunk class for the DATA chunk
    _framesize -- size of one frame in the file
    cCsd|_d|_t|dd�|_|jj�dkr0td��|jjd�dkrHtd��d|_d|_x�d|_	yt|jdd�}Wnt
k
r�PYnX|j�}|d	kr�|j|�d|_n2|d
kr�|js�td��||_|j|j
|_d|_	P|j�qVW|js�|j�rtd��dS)
Nr)Z	bigendiansRIFFz file does not start with RIFF id�sWAVEznot a WAVE filersfmt sdatazdata chunk before fmt chunkz#fmt chunk and/or data chunk missing)�_convert�	_soundposr�_fileZgetnamer�readZ_fmt_chunk_read�_data_chunk�_data_seek_needed�EOFError�_read_fmt_chunkZ	chunksize�
_framesize�_nframes�skip)�self�file�chunkZ	chunknamer
r
r�initfp}s:
zWave_read.initfpc	CsRd|_t|t�r"tj|d�}||_y|j|�Wn|jrF|j��YnXdS)N�rb)�_i_opened_the_file�
isinstance�str�builtinsrr"�close)r�fr
r
r�__init__�s
zWave_read.__init__cCs|j�dS)N)r()rr
r
r�__del__�szWave_read.__del__cCs|S)Nr
)rr
r
r�	__enter__�szWave_read.__enter__cGs|j�dS)N)r()r�argsr
r
r�__exit__�szWave_read.__exit__cCs|jS)N)r)rr
r
r�getfp�szWave_read.getfpcCsd|_d|_dS)Nrr)rr)rr
r
r�rewind�szWave_read.rewindcCs"d|_|j}|rd|_|j�dS)N)rr$r()rr r
r
rr(�s
zWave_read.closecCs|jS)N)r)rr
r
r�tell�szWave_read.tellcCs|jS)N)�
_nchannels)rr
r
r�getnchannels�szWave_read.getnchannelscCs|jS)N)r)rr
r
r�
getnframes�szWave_read.getnframescCs|jS)N)�
_sampwidth)rr
r
r�getsampwidth�szWave_read.getsampwidthcCs|jS)N)�
_framerate)rr
r
r�getframerate�szWave_read.getframeratecCs|jS)N)�	_comptype)rr
r
r�getcomptype�szWave_read.getcomptypecCs|jS)N)�	_compname)rr
r
r�getcompname�szWave_read.getcompnamecCs*t|j�|j�|j�|j�|j�|j��S)N)rr3r6r8r4r:r<)rr
r
r�	getparams�szWave_read.getparamscCsdS)Nr
)rr
r
r�
getmarkers�szWave_read.getmarkerscCstd��dS)Nzno marks)r)r�idr
r
r�getmark�szWave_read.getmarkcCs*|dks||jkrtd��||_d|_dS)Nrzposition not in ranger)rrrr)r�posr
r
r�setpos�szWave_read.setposcCs�|jr8|jjdd�|j|j}|r2|jj|d�d|_|dkrDdS|jj||j�}|jdkrxtjdkrxt	j
||j�}|jr�|r�|j|�}|jt|�|j
|j|_|S)Nr�r�big)rr�seekrrrr5�sys�	byteorder�audioop�byteswapr�lenr2)r�nframesrA�datar
r
r�
readframes�s

zWave_read.readframescCsztjd|jd��\}|_|_}}|tkrNtjd|jd��d}|dd|_ntd|f��|j|j|_d	|_	d
|_
dS)Nz<HHLLH�z<H�r��zunknown format: %r�NONEznot compressed)�structZunpack_fromrr2r7�WAVE_FORMAT_PCMr5rrr9r;)rr!Z
wFormatTagZdwAvgBytesPerSecZwBlockAlign�	sampwidthr
r
rr�s zWave_read._read_fmt_chunkN)rrr	�__doc__r"r*r+r,r.r/r0r(r1r3r4r6r8r:r<r=r>r@rBrMrr
r
r
rr^s,
c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:S);ra�Variables used in this class:

    These variables are user settable through appropriate methods
    of this class:
    _file -- the open file with methods write(), close(), tell(), seek()
              set through the __init__() method
    _comptype -- the AIFF-C compression type ('NONE' in AIFF)
              set through the setcomptype() or setparams() method
    _compname -- the human-readable AIFF-C compression type
              set through the setcomptype() or setparams() method
    _nchannels -- the number of audio channels
              set through the setnchannels() or setparams() method
    _sampwidth -- the number of bytes per audio sample
              set through the setsampwidth() or setparams() method
    _framerate -- the sampling frequency
              set through the setframerate() or setparams() method
    _nframes -- the number of audio frames written to the header
              set through the setnframes() or setparams() method

    These variables are used internally only:
    _datalength -- the size of the audio samples written to the header
    _nframeswritten -- the number of frames actually written
    _datawritten -- the size of the audio samples actually written
    c	CsRd|_t|t�r"tj|d�}||_y|j|�Wn|jrF|j��YnXdS)N�wb)r$r%r&r'rr"r()rr)r
r
rr*#s
zWave_write.__init__cCs@||_d|_d|_d|_d|_d|_d|_d|_d|_d|_	dS)NrF)
rrr2r5r7r�_nframeswritten�_datawritten�_datalength�_headerwritten)rr r
r
rr"/szWave_write.initfpcCs|j�dS)N)r()rr
r
rr+;szWave_write.__del__cCs|S)Nr
)rr
r
rr,>szWave_write.__enter__cGs|j�dS)N)r()rr-r
r
rr.AszWave_write.__exit__cCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerzbad # of channels)rYrr2)r�	nchannelsr
r
r�setnchannelsGs
zWave_write.setnchannelscCs|jstd��|jS)Nznumber of channels not set)r2r)rr
r
rr3NszWave_write.getnchannelscCs0|jrtd��|dks|dkr&td��||_dS)Nz0cannot change parameters after starting to writerrzbad sample width)rYrr5)rrUr
r
r�setsampwidthSs
zWave_write.setsampwidthcCs|jstd��|jS)Nzsample width not set)r5r)rr
r
rr6ZszWave_write.getsampwidthcCs0|jrtd��|dkrtd��tt|��|_dS)Nz0cannot change parameters after starting to writerzbad frame rate)rYr�int�roundr7)r�	framerater
r
r�setframerate_s
zWave_write.setframeratecCs|jstd��|jS)Nzframe rate not set)r7r)rr
r
rr8fszWave_write.getframeratecCs|jrtd��||_dS)Nz0cannot change parameters after starting to write)rYrr)rrKr
r
r�
setnframeskszWave_write.setnframescCs|jS)N)rX)rr
r
rr4pszWave_write.getnframescCs.|jrtd��|dkrtd��||_||_dS)Nz0cannot change parameters after starting to writerRzunsupported compression type)rR)rYrr9r;)r�comptype�compnamer
r
r�setcomptypesszWave_write.setcomptypecCs|jS)N)r9)rr
r
rr:{szWave_write.getcomptypecCs|jS)N)r;)rr
r
rr<~szWave_write.getcompnamecCsV|\}}}}}}|jrtd��|j|�|j|�|j|�|j|�|j||�dS)Nz0cannot change parameters after starting to write)rYrr]r^rbrcrf)rZparamsr\rUrarKrdrer
r
r�	setparams�s



zWave_write.setparamscCs>|js|js|jr td��t|j|j|j|j|j|j�S)Nznot all parameters set)r2r5r7rrrr9r;)rr
r
rr=�szWave_write.getparamscCstd��dS)Nzsetmark() not supported)r)rr?rA�namer
r
r�setmark�szWave_write.setmarkcCstd��dS)Nzno marks)r)rr?r
r
rr@�szWave_write.getmarkcCsdS)Nr
)rr
r
rr>�szWave_write.getmarkerscCs|jS)N)rX)rr
r
rr1�szWave_write.tellcCs�t|ttf�st|�jd�}|jt|��t|�|j|j}|j	rN|j	|�}|jdkrpt
jdkrptj
||j�}|jj|�|jt|�7_|j||_dS)N�BrrD)r%�bytes�	bytearray�
memoryview�cast�_ensure_header_writtenrJr5r2rrFrGrHrIr�writerYrX)rrLrKr
r
r�writeframesraw�s
zWave_write.writeframesrawcCs"|j|�|j|jkr|j�dS)N)rqrZrY�_patchheader)rrLr
r
r�writeframes�s
zWave_write.writeframescCsXz2|jr0|jd�|j|jkr&|j�|jj�Wdd|_|j}|rRd|_|j�XdS)Nr)rrorZrYrr�flushr$r()rr r
r
rr(�s
zWave_write.closecCs>|js:|jstd��|js"td��|js0td��|j|�dS)Nz# channels not specifiedzsample width not specifiedzsampling rate not specified)r[r2rr5r7�
_write_header)rZdatasizer
r
rro�sz!Wave_write._ensure_header_writtencCs�|jst�|jjd�|js0||j|j|_|j|j|j|_y|jj�|_	Wnt
tfk
rrd|_	YnX|jjtj
dd|jdddt|j|j|j|j|j|j|j|jdd��|j	dk	r�|jj�|_|jjtj
d	|j��d
|_dS)NsRIFFz<L4s4sLHHLLHH4s�$sWAVEsfmt �rQsdataz<LT)r[�AssertionErrorrrprr2r5rZr1�_form_length_pos�AttributeError�OSErrorrS�packrTr7�_data_length_pos)rZ
initlengthr
r
rru�s&


zWave_write._write_headercCs�|js
t�|j|jkrdS|jj�}|jj|jd�|jjt	j
dd|j��|jj|jd�|jjt	j
d|j��|jj|d�|j|_dS)Nrz<Lrv)r[rxrYrZrr1rEryrprSr|r})rZcurposr
r
rrr�s

zWave_write._patchheaderN) rrr	rVr*r"r+r,r.r]r3r^r6rbr8rcr4rfr:r<rgr=rir@r>r1rqrsr(rorurrr
r
r
rr	s:


cCsJ|dkrt|d�r|j}nd}|dkr.t|�S|dkr>t|�Std��dS)	N�moder#�r�wrWz$mode must be 'r', 'rb', 'w', or 'wb')rr#)r�rW)�hasattrr~rrr)r)r~r
r
rr�s
)Nr
rNr)N)rVr'�__all__�	ExceptionrrTZ_array_fmtsrHrSrFr!r�collectionsrrrrrrr
r
r
r�<module>Hs$,d

fnmatch.cpython-36.opt-2.pyc000064400000003227150335715140011562 0ustar003


 \^�@sfddlZddlZddlZddlZddddgZdd�Zejddd	�d
d��Zdd�Zd
d�Z	dd�Z
dS)�N�filter�fnmatch�fnmatchcase�	translatecCs"tjj|�}tjj|�}t||�S)N)�os�path�normcaser)�name�pat�r�/usr/lib64/python3.6/fnmatch.pyrs�T)�maxsize�typedcCs<t|t�r(t|d�}t|�}t|d�}nt|�}tj|�jS)Nz
ISO-8859-1)�
isinstance�bytes�strr�re�compile�match)r
Zpat_strZres_str�resrrr�_compile_pattern&s

rcCspg}tjj|�}t|�}tjtkrDxH|D]}||�r(|j|�q(Wn(x&|D]}|tjj|��rJ|j|�qJW|S)N)rrrr�	posixpath�append)�namesr
�resultrr	rrrr0s


cCst|�}||�dk	S)N)r)r	r
rrrrr@scCsHdt|�}}d}�x*||k�r>||}|d}|dkrB|d}q|dkrT|d}q|dk�r.|}||kr~||d	kr~|d}||kr�||d
kr�|d}x ||kr�||d
kr�|d}q�W||kr�|d}n^|||�jdd
�}|d}|dd	k�r
d|dd�}n|ddk�r d|}d||f}q|tj|�}qWd|S)Nr���*z.*�?�.�[�!�]z\[�\z\\�^z%s[%s]z	(?s:%s)\Z)�len�replacer�escape)r
�i�nr�c�jZstuffrrrrJs8



)rrr�	functools�__all__r�	lru_cacherrrrrrrr�<module>s

ftplib.cpython-36.opt-2.pyc000064400000044173150335715140011427 0ustar003

�\dh!��@sRddlZddlZddlmZddddddgZd	Zd
ZdZGdd
�d
e�ZGdd�de�Z	Gdd�de�Z
Gdd�de�ZGdd�de�Zee
efZdZdZGdd�d�ZyddlZWnek
r�dZYn0XejZGdd�de�Zejd�ee
eejfZdadd�Zdadd�Zdd�Zdd�Zdd �Z d(d#d$�Z!d%d&�Z"e#d'k�rNe"�dS))�N)�_GLOBAL_DEFAULT_TIMEOUT�FTP�error_reply�
error_temp�
error_perm�error_proto�
all_errors��i c@seZdZdS)�ErrorN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/ftplib.pyr9src@seZdZdS)rN)rr
rrrrrr:sc@seZdZdS)rN)rr
rrrrrr;sc@seZdZdS)rN)rr
rrrrrr<sc@seZdZdS)rN)rr
rrrrrr=sz
s
c@s�eZdZdZdZeZeZdZ	dZ
dZdZdZ
dZddddedfdd�Zd	d
�Zdd�Zd\dd�Zdd�Zdd�ZeZdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Z d(d)�Z!d*d+�Z"d,d-�Z#d.d/�Z$d0d1�Z%d]d2d3�Z&d^d4d5�Z'd_d6d7�Z(d`d9d:�Z)dad;d<�Z*dbd=d>�Z+dcd?d@�Z,dAdB�Z-dCdD�Z.dEdF�Z/dgfdGdH�Z0dIdJ�Z1dKdL�Z2dMdN�Z3dOdP�Z4dQdR�Z5dSdT�Z6dUdV�Z7dWdX�Z8dYdZ�Z9dS)drr�Nr	zlatin-1FcCs0||_||_|r,|j|�|r,|j|||�dS)N)�source_address�timeout�connect�login)�self�host�user�passwd�acctrrrrr�__init__rs
zFTP.__init__cCs|S)Nr)rrrr�	__enter__{sz
FTP.__enter__cGsN|jdk	rJz*y|j�Wnttfk
r0YnXWd|jdk	rH|j�XdS)N)�sock�quit�OSError�EOFError�close)r�argsrrr�__exit__s


zFTP.__exit__i�cCs�|dkr||_|dkr||_|dkr*||_|dk	r8||_tj|j|jf|j|jd�|_|jj|_|jj	d|j
d�|_|j�|_
|j
S)Nrri�)r�r)�encodingi���)r�portrr�socket�create_connectionrZfamily�af�makefiler%�file�getresp�welcome)rrr&rrrrrr�s

zFTP.connectcCs|jrtd|j|j��|jS)Nz	*welcome*)�	debugging�print�sanitizer-)rrrr�
getwelcome�szFTP.getwelcomecCs
||_dS)N)r.)r�levelrrr�set_debuglevel�szFTP.set_debuglevelcCs
||_dS)N)�
passiveserver)r�valrrr�set_pasv�szFTP.set_pasvcCsJ|dd�dkrBt|jd��}|dd�d|d||d�}t|�S)N��pass �PASS z
�*>r8r9)�len�rstrip�repr)r�s�irrrr0�s$zFTP.sanitizecCsRd|ksd|krtd��|t}|jdkr:td|j|��|jj|j|j��dS)N�
�
z4an illegal newline character should not be containedr	z*put*)	�
ValueError�CRLFr.r/r0r�sendall�encoder%)r�linerrr�putline�s
zFTP.putlinecCs$|jrtd|j|��|j|�dS)Nz*cmd*)r.r/r0rG)rrFrrr�putcmd�sz
FTP.putcmdcCs�|jj|jd�}t|�|jkr.td|j��|jdkrHtd|j|��|sPt�|dd�t	krn|dd�}n|dd�t	kr�|dd�}|S)	Nr	zgot more than %d bytesz*get*����rJ���rK)
r+�readline�maxliner;rr.r/r0r rC)rrFrrr�getline�s
zFTP.getlinecCsd|j�}|dd�dkr`|dd�}x:|j�}|d|}|dd�|kr&|dd�dkr&Pq&W|S)N���-rA)rN)rrF�codeZnextlinerrr�getmultiline�szFTP.getmultilinecCsp|j�}|jrtd|j|��|dd�|_|dd�}|d	krD|S|dkrTt|��|dkrdt|��t|��dS)
Nz*resp*rOr	�1�2�3�4�5>rTrVrU)rSr.r/r0Zlastresprrr)r�resp�crrrr,�szFTP.getrespcCs$|j�}|dd�dkr t|��|S)Nr	rU)r,r)rrYrrr�voidresp�szFTP.voidrespcCsTdt}|jdkr"td|j|��|jj|t�|j�}|dd�dkrPt|��|S)	NsABORr	z*put urgent*rO�426�225�226>r^r\r])	�B_CRLFr.r/r0rrD�MSG_OOBrSr)rrFrYrrr�aborts
z	FTP.abortcCs|j|�|j�S)N)rHr,)r�cmdrrr�sendcmds
zFTP.sendcmdcCs|j|�|j�S)N)rHr[)rrbrrr�voidcmds
zFTP.voidcmdcCsB|jd�}t|d�t|d�g}||}ddj|�}|j|�S)N�.�zPORT �,)�splitr=�joinrd)rrr&ZhbytesZpbytes�bytesrbrrr�sendports

zFTP.sendportcCsbd}|jtjkrd}|jtjkr$d}|dkr4td��dt|�|t|�dg}ddj|�}|j|�S)Nrr	rIzunsupported address familyrzEPRT �|)r)r'�AF_INETZAF_INET6rr=rird)rrr&r)Zfieldsrbrrr�sendeprt$szFTP.sendeprtc
Csd}d}x�tjdd|jtjdtj�D]j}|\}}}}}ytj|||�}|j|�Wn8tk
r�}	z|	}|rt|j�d}w$WYdd}	~	XnXPq$W|dkr�|dk	r�|�ntd��|jd�|j	�d}
|j
j	�d}|jtjkr�|j||
�}n|j
||
�}|jtk	�r|j|j�|S)Nrz!getaddrinfo returns an empty listr	)r'Zgetaddrinfor)ZSOCK_STREAMZ
AI_PASSIVEZbindrr!ZlistenZgetsocknamerrmrkrnrr�
settimeout)
r�errr�resr)Zsocktype�protoZ	canonnameZsa�_r&rrYrrr�makeport1s6 
zFTP.makeportcCs\|jtjkr:t|jd��\}}|jr*|}qT|jj�d}nt|jd�|jj��\}}||fS)N�PASVrZEPSV)	r)r'rm�parse227rc�trust_server_pasv_ipv4_addressrZgetpeername�parse229)rZuntrusted_hostr&rrrr�makepasvQszFTP.makepasvc

Cs6d}|jr�|j�\}}tj||f|j|jd�}yL|dk	rF|jd|�|j|�}|ddkrd|j�}|ddkrxt|��Wn|j	��YnXn�|j
��r}|dk	r�|jd|�|j|�}|ddkr�|j�}|ddkr�t|��|j�\}}	|jtk	�r
|j
|j�WdQRX|dd�dk�r.t|�}||fS)N)rzREST %srrUrTrO�150)r4ryr'r(rrrcr,rr!rtZacceptrro�parse150)
rrb�rest�sizerr&�connrYrZsockaddrrrr�ntransfercmd]s<




zFTP.ntransfercmdcCs|j||�dS)Nr)r)rrbr|rrr�transfercmd�szFTP.transfercmdcCs�|sd}|sd}|sd}|dkr0|dkr0|d}|jd|�}|ddkrX|jd|�}|ddkrr|jd	|�}|dd
kr�t|��|S)NZ	anonymousrrQz
anonymous@zUSER rrVzPASS zACCT rU>rrQ)rcr)rrrrrYrrrr�s z	FTP.login� c
Csb|jd�|j||��>}x|j|�}|s*P||�qWtdk	rPt|t�rP|j�WdQRX|j�S)NzTYPE I)rdr�Zrecv�
_SSLSocket�
isinstance�unwrapr[)rrb�callback�	blocksizer|r~�datarrr�
retrbinary�s

zFTP.retrbinarycCs�|dkrt}|jd�}|j|���}|jd|jd���}x�|j|jd�}t|�|jkrbtd|j��|j	dkrzt
dt|��|s�P|d	d�tkr�|dd
�}n|dd�dkr�|dd�}||�q6Wt
dk	r�t|t
�r�|j�WdQRXWdQRX|j�S)
NzTYPE Ar$)r%r	zgot more than %d bytesrIz*retr*rArJrJrKrK)�
print_linercr�r*r%rLrMr;rr.r/r=rCr�r�r�r[)rrbr�rYr~�fprFrrr�	retrlines�s*

z
FTP.retrlinesc
Csp|jd�|j||��L}x*|j|�}|s*P|j|�|r||�qWtdk	r^t|t�r^|j�WdQRX|j�S)NzTYPE I)rdr��readrDr�r�r�r[)rrbr�r�r�r|r~�bufrrr�
storbinary�s


zFTP.storbinaryc
Cs�|jd�|j|���}x||j|jd�}t|�|jkrDtd|j��|sJP|dd�tkrz|dtkrr|dd�}|t}|j|�|r||�qWtdk	r�t	|t�r�|j
�WdQRX|j�S)NzTYPE Ar	zgot more than %d bytesrIrJrKrK)rdr�rLrMr;rr_rDr�r�r�r[)rrbr�r�r~r�rrr�	storliness$

z
FTP.storlinescCsd|}|j|�S)NzACCT )rd)rZpasswordrbrrrr+szFTP.acctcGs4d}x|D]}|d|}q
Wg}|j||j�|S)NZNLST� )r��append)rr"rb�arg�filesrrr�nlst0s
zFTP.nlstcGsld}d}|dd�r>t|d�td�kr>|dd�|d}}x|D]}|rD|d|}qDW|j||�dS)	NZLISTr	rr�rKrKrKrK)�typer�)rr"rb�funcr�rrr�dir9s 
zFTP.dirc
cs�|r|jddj|�d�|r*d|}nd}g}|j||j�xh|D]`}|jt�jd�\}}}i}	x6|dd�jd�D] }
|
jd�\}}}||	|j�<qxW||	fVqFWdS)	Nz
OPTS MLST �;zMLSD %sZMLSDr�r	�=rK)	rcrir�r�r<rC�	partitionrh�lower)
r�pathZfactsrb�linesrFZfacts_foundrs�name�entryZfact�key�valuerrr�mlsdHs

zFTP.mlsdcCs0|jd|�}|ddkr"t|��|jd|�S)NzRNFR rrVzRNTO )rcrrd)rZfromnameZtonamerYrrr�renamedsz
FTP.renamecCs.|jd|�}|dd�dkr"|St|��dS)NzDELE rO�250�200>r�r�)rcr)r�filenamerYrrr�deleteksz
FTP.deletecCsn|dkrPy
|jd�Stk
rL}z|jddd�dkr<�WYdd}~Xq\Xn|dkr\d}d|}|j|�S)	Nz..ZCDUPrrO�500rrezCWD )rdrr")r�dirname�msgrbrrr�cwdss
zFTP.cwdcCs:|jd|�}|dd�dkr6|dd�j�}t|�SdS)NzSIZE rOZ213)rc�strip�int)rr�rYr>rrrr}�szFTP.sizecCs$|jd|�}|jd�sdSt|�S)NzMKD �257r)rd�
startswith�parse257)rr�rYrrr�mkd�s
zFTP.mkdcCs|jd|�S)NzRMD )rd)rr�rrr�rmd�szFTP.rmdcCs |jd�}|jd�sdSt|�S)NZPWDr�r)rdr�r�)rrYrrr�pwd�s

zFTP.pwdcCs|jd�}|j�|S)NZQUIT)rdr!)rrYrrrr�s
zFTP.quitcCsDz |j}d|_|dk	r|j�Wd|j}d|_|dk	r>|j�XdS)N)r+r!r)rr+rrrrr!�sz	FTP.close����)rrr�N)N)N)rrr)r�N)N)r�NN)N):rr
rr.r�FTP_PORTr&�MAXLINErMrr+r-r4r%rwrrrr#rr1r3�debugr6r0rGrHrNrSr,r[rarcrdrkrnrtryrr�rr�r�r�r�rr�r�r�r�r�r�r}r�r�r�rr!rrrrrJsj

	

 
7



#

	
		c	@sjeZdZejZdddddddedf	dd�Zddd�Zdd	�Z	d
d�Z
dd
�Zdd�Zddd�Z
dd�ZdS)�FTP_TLSrNc
Cs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}
|
jdtd�||_||_|dkr|tj|j||d�}||_	d|_
tj|||||||	�dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadrI)�certfile�keyfileF)
rB�warnings�warn�DeprecationWarningr�r��sslZ_create_stdlib_context�ssl_version�context�_prot_prr)rrrrrr�r�r�rrr�rrrr�s"zFTP_TLS.__init__TcCs,|rt|jtj�r|j�tj||||�S)N)r�rr��	SSLSocket�authrr)rrrrZsecurerrrr�sz
FTP_TLS.logincCsft|jtj�rtd��|jtjkr.|jd�}n
|jd�}|jj	|j|j
d�|_|jjd|jd�|_
|S)NzAlready using TLSzAUTH TLSzAUTH SSL)�server_hostnamer$)�moder%)r�rr�r�rBr��PROTOCOL_SSLv23rdr��wrap_socketrr*r%r+)rrYrrrr��s

zFTP_TLS.authcCs0t|jtj�std��|jd�}|jj�|_|S)Nz
not using TLSZCCC)r�rr�r�rBrdr�)rrYrrr�cccs

zFTP_TLS.ccccCs|jd�|jd�}d|_|S)NzPBSZ 0zPROT PT)rdr�)rrYrrr�prot_ps

zFTP_TLS.prot_pcCs|jd�}d|_|S)NzPROT CF)rdr�)rrYrrr�prot_cs
zFTP_TLS.prot_ccCs2tj|||�\}}|jr*|jj||jd�}||fS)N)r�)rrr�r�r�r)rrbr|r~r}rrrr$s

zFTP_TLS.ntransfercmdcCs8dt}|jj|�|j�}|dd�dkr4t|��|S)NsABORrOr\r]r^>r\r^r])r_rrDrSr)rrFrYrrrra+sz
FTP_TLS.abort)rrrT)N)rr
rr�r�r�rrrr�r�r�r�rrarrrrr��s!



r�cCs\|dd�dkrt|��tdkr<ddl}|jd|j|jB�atj|�}|sNdSt|jd��S)NrOrzrz150 .* \((\d+) bytes\)r	)	r�_150_re�re�compile�
IGNORECASE�ASCII�matchr��group)rYr��mrrrr{:s
r{cCs�|dd�dkrt|��tdkr6ddl}|jd|j�atj|�}|sLt|��|j�}dj|dd��}t	|d�d>t	|d�}||fS)	NrOZ227rz#(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)rerP�r7)
r�_227_rer�r�r��searchr�groupsrir�)rYr�r�Znumbersrr&rrrrvNs
rvcCs�|dd�dkrt|��|jd�}|dkr2t|��|jd|d�}|dkrRt|��||d||dkrrt|��||d|�j||d�}t|�dkr�t|��|d}t|d�}||fS)NrOZ229�(r�)r	r7)r�findrrhr;r�)rYZpeer�left�right�partsrr&rrrrxbs 
rxcCs�|dd�dkrt|��|dd�dkr,dSd}d}t|�}xJ||kr�||}|d}|dkr|||ksr||dkrtP|d}||}q>W|S)NrOr�r7z "rr	�")rr;)rYr�r?�nrZrrrr�xs 
r�cCst|�dS)N)r/)rFrrrr��sr�r�Ic	Cs�|s|}d|}|j|�|j|�t|jd��\}}|j||�|jd|�}|dd�dkrdt�|jd|�}|dd�d	kr�t�|j�|j�dS)
NzTYPE ruzSTOR rO�125rzzRETR >r�rz>r�rz)rdrvrcrkrr[)	�sourceZ
sourcename�targetZ
targetnamer�Z
sourcehostZ
sourceportZtreplyZsreplyrrr�ftpcp�s

r�cCs�ttj�dkr"ttj�tjd�ddl}d}d}x"tjddkrT|d}tjd=q4Wtjddd�dkr�tjddd�}tjd=tjd}t|�}|j	|�d}}}y|j|�}Wn(t
k
r�|dk	r�tjjd�Yn:Xy|j
|�\}}}Wn"tk
�rtjjd�YnX|j|||�x�tjdd�D]�}	|	dd�d	k�rf|j|	dd��nt|	dd�dk�r�d
}
|	dd��r�|
d|	dd�}
|j|
�}n0|	dk�r�|j|j�n|jd
|	tjjd��q<W|j�dS)NrIrr	z-dz-rrz5Could not open account file -- using anonymous login.z$No account -- using anonymous login.z-lZCWDr�z-pzRETR i)r;�sys�argvr/�test�__doc__�exit�netrcrr3r�stderr�writeZauthenticators�KeyErrorrr�rcr6r4r��stdoutr)r�r.ZrcfilerZftpZuseridrrZnetrcobjr+rbrYrrrr��sP	





r��__main__)rr�)$r�r'r�__all__r`r�r��	Exceptionrrrrrrr rrCr_rr��ImportErrorr�r�r�r�ZSSLErrorr�r{r�rvrxr�r�r�r�rrrrr�<module>'sN

k
|

9
compileall.cpython-36.opt-2.pyc000064400000013776150335715140012275 0ustar003


 \]/�@s�ddlZddlZddlZddlZddlZddlmZdddgZddd�Z	ddd�Z
ddd�Zdd
d�Zdd�Z
edkr�ee
��Zeje�dS)�N)�partial�compile_dir�compile_file�compile_path�
ccs |dkrt|tj�rtj|�}|s0tdj|��ytj|�}Wn.tk
rl|dkrdtdj|��g}YnX|j�x�|D]�}|dkr�q|tj	j
||�}|dk	r�tj	j
||�}nd}tj	j|�s�|Vq||dkr||tjkr||tj
kr|tj	j|�r|tj	j|�r|t|||d|d�EdHq|WdS)N�zListing {!r}...zCan't list {!r}�__pycache__r�)�ddir�	maxlevels�quiet)�
isinstance�os�PathLike�fspath�print�format�listdir�OSError�sort�path�join�isdir�curdir�pardir�islink�	_walk_dir)�dirr
rr�names�name�fullname�dfile�r"�"/usr/lib64/python3.6/compileall.pyrs0


rFr	c	Cs�d}	|dk	rP|dkrtd��n2|dkrPyddlm}	Wntk
rNd}YnXt||||d�}
d}|dk	r�|dkr�|	dk	r�|p�d}|	|d��0}|jtt||||||d�|
�}
t|
dd	�}WdQRXn&x$|
D]}t|||||||�s�d
}q�W|S)Nrz%workers must be greater or equal to 0r	)�ProcessPoolExecutor)rrr
T)Zmax_workers)r
�force�rxr�legacy�optimize)�defaultF)	�
ValueErrorZconcurrent.futuresr$�ImportErrorr�maprr�min)rrr
r%r&rr'r(�workersr$�files�successZexecutorZresults�filer"r"r#r2s6


cCs�d}|dkr"t|tj�r"tj|�}tjj|�}|dk	rFtjj||�}	nd}	|dk	rd|j|�}
|
rd|Stjj|��r�|r�|d}nB|dkr�|dkr�|nd}t	j
j||d�}nt	j
j|�}tjj|�}
|dd�|dd�}}|d	k�r�|�sXyTt
tj|�j�}tjd
t	j
j|�}t|d��}|jd�}WdQRX||k�r>|SWntk
�rVYnX|�sltd
j|��ytj|||	d|d�}Wn�tjk
�r}zdd}|dk�r�|S|�r�tdj|��ntddd�|jjtjjdd�}|j tjj�}t|�WYdd}~Xn~t!t"tfk
�rv}zLd}|dk�r2|S|�rHtdj|��ntddd�t|j#j$d|�WYdd}~XnX|dk�r�d}|S)NTr�crr	�)�optimization�z.pyz<4sl�rb�zCompiling {!r}...)r(Fz*** Error compiling {!r}...z*** )�end�backslashreplace)�errors�:���r<)%r
rrrr�basenamer�search�isfile�	importlib�util�cache_from_source�dirname�int�stat�st_mtime�structZpack�MAGIC_NUMBER�open�readrrr�
py_compile�compile�PyCompileError�msg�encode�sys�stdout�encoding�decode�SyntaxError�UnicodeError�	__class__�__name__)r r
r%r&rr'r(r0rr!Zmo�cfile�optZ	cache_dir�head�tail�mtimeZexpectZchandleZactual�ok�errrN�er"r"r#rbsx






$
c
CsXd}xNtjD]D}|s |tjkr6|r6|dkrPtd�q|oNt||d||||d�}qW|S)NTrzSkipping current directory)rr'r()rPrrrrr)Zskip_curdirrr%rr'r(r0rr"r"r#r�s

c
Cszddl}|jdd�}|jddddddd	�|jd
tddd
�|jddddd�|jdddddd�|jddddd�|jdddddd�|jd d!d"dd#d�|jd$d%d&d'd(�|jd)d*d+d,d-�|jd.d/d0td1d2�|j�}|j}|jr�ddl}|j|j�|_|j	dk	�r|j	}n|j
}|j�r�yJ|jd3k�r4tj
nt|j��$}x|D]}|j|j���qFWWdQRXWn2tk
�r�|jd4k�r�td5j|j��d6SX|jdk	�r�|j�p�d|_d7}y�|�r4xj|D]b}	tjj|	��rt|	|j|j|j|j|j��s*d6}n*t|	||j|j|j|j|j|jd8��s�d6}�q�W|St|j|j|jd9�SWn*tk
�rt|jd4k�rptd:�d6SXd7S);Nrz1Utilities to support installing Python libraries.)Zdescriptionz-lZstore_constrrz!don't recurse into subdirectories)�actionZconstr)�dest�helpz-r�	recursionzhcontrol the maximum recursion level. if `-l` and `-r` options are specified, then `-r` takes precedence.)�typerarbz-f�
store_truer%z/force rebuild even if timestamps are up to date)r`rarbz-q�countrzIoutput only error messages; -qq will suppress the error messages as well.)r`rar)rbz-br'z0use legacy (pre-PEP3147) compiled file locationsz-dZDESTDIRr
z�directory to prepend to file paths for use in compile-time tracebacks and in runtime tracebacks in cases where the source file is unavailable)�metavarrar)rbz-xZREGEXPr&zskip files matching the regular expression; the regexp is searched for in the full path of each file considered for compilationz-iZFILE�flistzzadd all the files and directories listed in FILE to the list considered for compilation; if "-", names are read from stdin)rgrarb�compile_destzFILE|DIR�*zrzero or more file and directory names to compile; if no arguments given, defaults to the equivalent of -l sys.path)rg�nargsrbz-jz	--workersr	zRun compileall concurrently)r)rdrb�-rzError reading file list {}FT)r.)r'r%rz
[interrupted]) �argparse�ArgumentParser�add_argumentrD�
parse_argsrir&�rerLrcrrhrP�stdinrI�append�striprrrrr.rrr?rr
r%r'rr�KeyboardInterrupt)
rm�parser�argsZ
compile_destsrqr�f�liner0rar"r"r#�main�s~








"



rz�__main__)Nrr���)rNFNrFr|r	r|)NFNrFr|r|)r	rFrFr|)rrP�importlib.utilr@rKrG�	functoolsr�__all__rrrrrzrWrDZexit_status�exitr"r"r"r#�<module>
s"


/
R
[_sysconfigdata_dm_linux_x86_64-linux-gnu.cpython-36.opt-1.pyc000064400000056413150335715140020004 0ustar003

�\dh�u��@sdddddddddddd	d
dddd
dddddddddddddddddddddddd dd!d"d#d$d%dddd&d'd
d(d)d*d&d+dd!dddd,d-ddddddd.d&d&d&d&dd&dd&d&d&d&d&dddddddddd&dd&d&d&d&d&d&d&d&dd&d&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&ddd&d&dd&dddd&d&d&ddd&d&dddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&d&d&d&d&d&ddd&d&dd&d&ddd&d&d&d&d&d&d&dddddd&dd&d&ddddddd&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd/ddd0d1d0d0d2d3d4d
d5d6dd7dd
d8ddd9dd:d;dd<d=d>d
d
d?d@dAdBdd+ddCdDdddEddddddd&dFdGdHddIdJd
dKdLd&dMd
dNdddddddd
dOdPdQd
dRdSdd
ddTd&dddddUddddVdWd
d
ddXd&dYdZdd[d6d\d]dd&d&d&dd^d_d`dadbd9dddcd?dddddedfdgdfdedgdededfded]dededededfd&dhdidjd&dkdlddmd:d&d&dddddnddodpdqdd&dd
ddrd&d&dsdtdd&d&d&dddd&d&d&ddudvdtdwdxdxdtdy���ZdzS){Zdm��ar�rcsz!-Wno-unused-result -Wsign-comparez-IObjects -IInclude -IPython�z/usr/binz/usr/lib64/python3.6z-L. -lpython3.6dmzOgcc -pthread -shared -Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g�pythonzx86_64-redhat-linux-gnu�\zgcc -pthreadz-fPICav-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz?configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.ina-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapva=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-typez-Wl,-z,relro  -Wl,-z,now  -gz�-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -ga�'--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-ipv6' '--enable-shared' '--with-computed-gotos=yes' '--with-dbmliborder=gdbm:ndbm:bdb' '--with-system-expat' '--with-system-ffi' '--enable-loadable-sqlite-extensions' '--with-dtrace' '--with-lto' '--with-ssl-default-suites=openssl' '--with-valgrind' '--without-ensurepip' '--with-pydebug' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS= -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv ' 'LDFLAGS= -Wl,-z,relro  -Wl,-z,now  -g ' 'CPPFLAGS=' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'z/usr/includez/usr/include/python3.6dm�:z</builddir/build/BUILD/Python-3.6.8/build/debug/coverage.infoz:/builddir/build/BUILD/Python-3.6.8/build/debug/lcov-reportz2--no-branch-coverage --title "CPython lcov report"zM-IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.6.8/Includezg++ -pthreadzE/usr /usr/lib64 /usr/lib64/python3.6 /usr/lib64/python3.6/lib-dynloadz /usr/lib64/python3.6/lib-dynloadi�zkREADME ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Ext-dummyzInclude Lib Misc Ext-dummyzPREADME ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in�.�z/usr/bin/dtracezInclude/pydtrace_probes.hzPython/pydtrace.ozdynload_shlib.o�noz!.cpython-36dm-x86_64-linux-gnu.soi��yeszK/usr/include /usr/include /usr/include/python3.6dm /usr/include/python3.6dmz/usr/bin/install -cz/usr/bin/install -c -m 644z/usr/bin/install -c -m 555zlibpython3.6dm.so.1.0zModules/_io/_iomodule.hzg++ -pthread -sharedz:-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -gzlibpython3.6dm.soz3.6dmz
/usr/lib64z-lmzPython/z/usr/lib64/pkgconfigz2/usr/lib64/python3.6/config-3.6dm-x86_64-linux-gnuzlibpython3.6dm.az-lpthread -ldl  -lutilz0tkinter tkinter/test tkinter/test/test_tkinter \�gccz-Xlinker -export-dynamic�true�ln�linuxz4/builddir/build/BUILD/Python-3.6.8/Modules/makesetupz/usr/share/manz/usr/bin/mkdir -pz�_thread posix errno pwd _sre _codecs _weakref _functools _operator _collections itertools atexit _signal _stat time _locale _io zipimport faulthandler _tracemalloc _symtable xxsubtypea{Modules/_threadmodule.o  Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/zipimport.o  Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  Modules/symtablemodule.o  Modules/xxsubtype.ozx86_64-linux-gnuz -DMULTIARCH=\"x86_64-linux-gnu\"z-Wl,--no-as-neededa1-DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz:\ Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.ozParser/pgenz\ \z-fprofile-generatez"-fprofile-use -fprofile-correctionz
-m test --pgozno-frameworkz./python -Ez	python3.6a�-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Oga�-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Og -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.6.8/Include -fPIC -DPy_BUILD_COREaT-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g -lcryptoz"z"a-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g�z)-x test_subprocess test_io test_lib2to3 \�readelfzMac/Resources/framework�voidz>LD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/debugz/bin/shz.so���zcpython-36dm-x86_64-linux-gnuz&Parser Objects Python Modules Programsz9/builddir/build/BUILD/Python-3.6.8/Tools/gdb/libpython.pyz"/* Don't use ncurses extensions */z-szInclude Lib MisczGLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/debug ./pythonz�LD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/debug ./python /builddir/build/BUILD/Python-3.6.8/Tools/scripts/run_tests.pyi�zPython/thread.ozIpython3.6 /builddir/build/BUILD/Python-3.6.8/Tools/scripts/update_file.pyz3.6z"/builddir/build/BUILD/Python-3.6.8z)xml xml/dom xml/etree xml/parsers xml/saxz./builddir/build/BUILD/Python-3.6.8/build/debugz
/usr/sharez/usr(��ABIFLAGS�AC_APPLE_UNIVERSAL_BUILD�AIX_GENUINE_CPLUSPLUS�ANDROID_API_LEVEL�AR�ARFLAGS�
BASECFLAGS�BASECPPFLAGS�BASEMODLIBS�BINDIR�
BINLIBDEST�
BLDLIBRARY�	BLDSHARED�BUILDEXE�BUILDPYTHON�BUILD_GNU_TYPE�BYTESTR_DEPS�CC�CCSHARED�CFLAGS�CFLAGSFORSHARED�CFLAGS_ALIASING�CONFIGFILES�CONFIGURE_CFLAGS�CONFIGURE_CFLAGS_NODIST�CONFIGURE_CPPFLAGS�CONFIGURE_LDFLAGS�CONFIGURE_LDFLAGS_NODIST�CONFIG_ARGS�CONFINCLUDEDIR�
CONFINCLUDEPY�COREPYTHONPATH�
COVERAGE_INFO�COVERAGE_REPORT�COVERAGE_REPORT_OPTIONS�CPPFLAGS�CXX�DESTDIRS�DESTLIB�DESTPATH�
DESTSHARED�DFLAGS�DIRMODE�DIST�DISTDIRS�	DISTFILES�	DLINCLDIR�
DLLLIBRARY�"DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754�DOUBLE_IS_BIG_ENDIAN_IEEE754�DOUBLE_IS_LITTLE_ENDIAN_IEEE754�DTRACE�DTRACE_DEPS�DTRACE_HEADERS�DTRACE_OBJS�DYNLOADFILE�ENABLE_IPV6�	ENSUREPIP�EXE�EXEMODE�EXTRAMACHDEPPATH�
EXTRATESTOPTS�EXTRA_CFLAGS�
EXT_SUFFIX�FILEMODE�FLOCK_NEEDS_LIBBSD�GETPGRP_HAVE_ARG�GETTIMEOFDAY_NO_TZ�	GITBRANCH�GITTAG�
GITVERSION�GNULD�HAVE_ACCEPT4�
HAVE_ACOSH�
HAVE_ADDRINFO�
HAVE_ALARM�HAVE_ALIGNED_REQUIRED�
HAVE_ALLOCA_H�HAVE_ALTZONE�
HAVE_ASINH�HAVE_ASM_TYPES_H�
HAVE_ATANH�HAVE_BIND_TEXTDOMAIN_CODESET�HAVE_BLUETOOTH_BLUETOOTH_H�HAVE_BLUETOOTH_H�HAVE_BROKEN_MBSTOWCS�HAVE_BROKEN_NICE�HAVE_BROKEN_PIPE_BUF�HAVE_BROKEN_POLL�HAVE_BROKEN_POSIX_SEMAPHORES�HAVE_BROKEN_PTHREAD_SIGMASK�HAVE_BROKEN_SEM_GETVALUE�HAVE_BROKEN_UNSETENV�HAVE_BUILTIN_ATOMIC�HAVE_CHFLAGS�
HAVE_CHOWN�HAVE_CHROOT�
HAVE_CLOCK�HAVE_CLOCK_GETRES�HAVE_CLOCK_GETTIME�HAVE_CLOCK_SETTIME�HAVE_COMPUTED_GOTOS�HAVE_CONFSTR�HAVE_CONIO_H�
HAVE_COPYSIGN�HAVE_CRYPT_H�HAVE_CTERMID�HAVE_CTERMID_R�HAVE_CURSES_FILTER�
HAVE_CURSES_H�HAVE_CURSES_HAS_KEY�HAVE_CURSES_IMMEDOK�HAVE_CURSES_IS_PAD�HAVE_CURSES_IS_TERM_RESIZED�HAVE_CURSES_RESIZETERM�HAVE_CURSES_RESIZE_TERM�HAVE_CURSES_SYNCOK�HAVE_CURSES_TYPEAHEAD�HAVE_CURSES_USE_ENV�HAVE_CURSES_WCHGAT�HAVE_DECL_ISFINITE�HAVE_DECL_ISINF�HAVE_DECL_ISNAN�HAVE_DECL_RTLD_DEEPBIND�HAVE_DECL_RTLD_GLOBAL�HAVE_DECL_RTLD_LAZY�HAVE_DECL_RTLD_LOCAL�HAVE_DECL_RTLD_NODELETE�HAVE_DECL_RTLD_NOLOAD�HAVE_DECL_RTLD_NOW�HAVE_DECL_TZNAME�HAVE_DEVICE_MACROS�HAVE_DEV_PTC�
HAVE_DEV_PTMX�
HAVE_DIRECT_H�HAVE_DIRENT_D_TYPE�
HAVE_DIRENT_H�
HAVE_DIRFD�HAVE_DLFCN_H�HAVE_DLOPEN�	HAVE_DUP2�	HAVE_DUP3�HAVE_DYNAMIC_LOADING�
HAVE_ENDIAN_H�
HAVE_EPOLL�HAVE_EPOLL_CREATE1�HAVE_ERF�	HAVE_ERFC�HAVE_ERRNO_H�
HAVE_EXECV�
HAVE_EXPM1�HAVE_FACCESSAT�HAVE_FCHDIR�HAVE_FCHMOD�
HAVE_FCHMODAT�HAVE_FCHOWN�
HAVE_FCHOWNAT�HAVE_FCNTL_H�HAVE_FDATASYNC�HAVE_FDOPENDIR�HAVE_FEXECVE�HAVE_FINITE�
HAVE_FLOCK�	HAVE_FORK�HAVE_FORKPTY�HAVE_FPATHCONF�HAVE_FSEEK64�HAVE_FSEEKO�HAVE_FSTATAT�
HAVE_FSTATVFS�
HAVE_FSYNC�HAVE_FTELL64�HAVE_FTELLO�
HAVE_FTIME�HAVE_FTRUNCATE�
HAVE_FUTIMENS�HAVE_FUTIMES�HAVE_FUTIMESAT�HAVE_GAI_STRERROR�
HAVE_GAMMA�HAVE_GCC_ASM_FOR_MC68881�HAVE_GCC_ASM_FOR_X64�HAVE_GCC_ASM_FOR_X87�HAVE_GCC_UINT128_T�HAVE_GETADDRINFO�HAVE_GETC_UNLOCKED�HAVE_GETENTROPY�HAVE_GETGROUPLIST�HAVE_GETGROUPS�HAVE_GETHOSTBYNAME�HAVE_GETHOSTBYNAME_R�HAVE_GETHOSTBYNAME_R_3_ARG�HAVE_GETHOSTBYNAME_R_5_ARG�HAVE_GETHOSTBYNAME_R_6_ARG�HAVE_GETITIMER�HAVE_GETLOADAVG�
HAVE_GETLOGIN�HAVE_GETNAMEINFO�HAVE_GETPAGESIZE�HAVE_GETPEERNAME�HAVE_GETPGID�HAVE_GETPGRP�HAVE_GETPID�HAVE_GETPRIORITY�
HAVE_GETPWENT�HAVE_GETRANDOM�HAVE_GETRANDOM_SYSCALL�HAVE_GETRESGID�HAVE_GETRESUID�HAVE_GETSID�
HAVE_GETSPENT�
HAVE_GETSPNAM�HAVE_GETTIMEOFDAY�
HAVE_GETWD�HAVE_GLIBC_MEMMOVE_BUG�
HAVE_GRP_H�HAVE_HSTRERROR�HAVE_HTOLE64�
HAVE_HYPOT�
HAVE_IEEEFP_H�HAVE_IF_NAMEINDEX�HAVE_INET_ATON�HAVE_INET_PTON�HAVE_INITGROUPS�HAVE_INTTYPES_H�	HAVE_IO_H�HAVE_IPA_PURE_CONST_BUG�	HAVE_KILL�HAVE_KILLPG�HAVE_KQUEUE�HAVE_LANGINFO_H�HAVE_LARGEFILE_SUPPORT�
HAVE_LCHFLAGS�HAVE_LCHMOD�HAVE_LCHOWN�HAVE_LGAMMA�
HAVE_LIBDL�HAVE_LIBDLD�HAVE_LIBIEEE�HAVE_LIBINTL_H�HAVE_LIBREADLINE�HAVE_LIBRESOLV�HAVE_LIBSENDFILE�HAVE_LIBUTIL_H�	HAVE_LINK�HAVE_LINKAT�HAVE_LINUX_CAN_BCM_H�HAVE_LINUX_CAN_H�HAVE_LINUX_CAN_RAW_FD_FRAMES�HAVE_LINUX_CAN_RAW_H�HAVE_LINUX_NETLINK_H�HAVE_LINUX_RANDOM_H�HAVE_LINUX_TIPC_H�
HAVE_LOCKF�
HAVE_LOG1P�	HAVE_LOG2�HAVE_LONG_DOUBLE�
HAVE_LSTAT�HAVE_LUTIMES�HAVE_MAKEDEV�HAVE_MBRTOWC�HAVE_MEMMOVE�
HAVE_MEMORY_H�HAVE_MEMRCHR�HAVE_MKDIRAT�HAVE_MKFIFO�
HAVE_MKFIFOAT�
HAVE_MKNOD�HAVE_MKNODAT�HAVE_MKTIME�	HAVE_MMAP�HAVE_MREMAP�HAVE_NCURSES_H�HAVE_NDIR_H�HAVE_NETPACKET_PACKET_H�
HAVE_NET_IF_H�	HAVE_NICE�HAVE_OPENAT�HAVE_OPENPTY�
HAVE_PATHCONF�
HAVE_PAUSE�
HAVE_PIPE2�
HAVE_PLOCK�	HAVE_POLL�HAVE_POLL_H�HAVE_POSIX_FADVISE�HAVE_POSIX_FALLOCATE�
HAVE_PREAD�HAVE_PRLIMIT�HAVE_PROCESS_H�HAVE_PROTOTYPES�HAVE_PTHREAD_ATFORK�HAVE_PTHREAD_CONDATTR_SETCLOCK�HAVE_PTHREAD_DESTRUCTOR�HAVE_PTHREAD_H�HAVE_PTHREAD_INIT�HAVE_PTHREAD_KILL�HAVE_PTHREAD_SIGMASK�
HAVE_PTY_H�HAVE_PUTENV�HAVE_PWRITE�
HAVE_READLINK�HAVE_READLINKAT�
HAVE_READV�
HAVE_REALPATH�
HAVE_RENAMEAT�HAVE_RL_APPEND_HISTORY�HAVE_RL_CALLBACK�HAVE_RL_CATCH_SIGNAL�#HAVE_RL_COMPLETION_APPEND_CHARACTER�'HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK�HAVE_RL_COMPLETION_MATCHES�"HAVE_RL_COMPLETION_SUPPRESS_APPEND�HAVE_RL_PRE_INPUT_HOOK�HAVE_RL_RESIZE_TERMINAL�
HAVE_ROUND�HAVE_SCHED_GET_PRIORITY_MAX�HAVE_SCHED_H�HAVE_SCHED_RR_GET_INTERVAL�HAVE_SCHED_SETAFFINITY�HAVE_SCHED_SETPARAM�HAVE_SCHED_SETSCHEDULER�HAVE_SELECT�HAVE_SEM_GETVALUE�
HAVE_SEM_OPEN�HAVE_SEM_TIMEDWAIT�HAVE_SEM_UNLINK�
HAVE_SENDFILE�HAVE_SETEGID�HAVE_SETEUID�HAVE_SETGID�HAVE_SETGROUPS�HAVE_SETHOSTNAME�HAVE_SETITIMER�HAVE_SETLOCALE�HAVE_SETPGID�HAVE_SETPGRP�HAVE_SETPRIORITY�
HAVE_SETREGID�HAVE_SETRESGID�HAVE_SETRESUID�
HAVE_SETREUID�HAVE_SETSID�HAVE_SETUID�HAVE_SETVBUF�
HAVE_SHADOW_H�HAVE_SIGACTION�HAVE_SIGALTSTACK�HAVE_SIGINTERRUPT�
HAVE_SIGNAL_H�HAVE_SIGPENDING�
HAVE_SIGRELSE�HAVE_SIGTIMEDWAIT�HAVE_SIGWAIT�HAVE_SIGWAITINFO�
HAVE_SNPRINTF�HAVE_SOCKADDR_ALG�HAVE_SOCKADDR_SA_LEN�HAVE_SOCKADDR_STORAGE�HAVE_SOCKETPAIR�HAVE_SPAWN_H�HAVE_SSIZE_T�HAVE_STATVFS�HAVE_STAT_TV_NSEC�HAVE_STAT_TV_NSEC2�HAVE_STDARG_PROTOTYPES�
HAVE_STDINT_H�
HAVE_STDLIB_H�HAVE_STD_ATOMIC�HAVE_STRDUP�
HAVE_STRFTIME�HAVE_STRINGS_H�
HAVE_STRING_H�HAVE_STRLCPY�HAVE_STROPTS_H�HAVE_STRUCT_PASSWD_PW_GECOS�HAVE_STRUCT_PASSWD_PW_PASSWD�HAVE_STRUCT_STAT_ST_BIRTHTIME�HAVE_STRUCT_STAT_ST_BLKSIZE�HAVE_STRUCT_STAT_ST_BLOCKS�HAVE_STRUCT_STAT_ST_FLAGS�HAVE_STRUCT_STAT_ST_GEN�HAVE_STRUCT_STAT_ST_RDEV�HAVE_STRUCT_TM_TM_ZONE�HAVE_SYMLINK�HAVE_SYMLINKAT�	HAVE_SYNC�HAVE_SYSCONF�HAVE_SYSEXITS_H�HAVE_SYS_AUDIOIO_H�HAVE_SYS_BSDTTY_H�HAVE_SYS_DEVPOLL_H�HAVE_SYS_DIR_H�HAVE_SYS_ENDIAN_H�HAVE_SYS_EPOLL_H�HAVE_SYS_EVENT_H�HAVE_SYS_FILE_H�HAVE_SYS_IOCTL_H�HAVE_SYS_KERN_CONTROL_H�HAVE_SYS_LOADAVG_H�HAVE_SYS_LOCK_H�HAVE_SYS_MKDEV_H�HAVE_SYS_MODEM_H�HAVE_SYS_NDIR_H�HAVE_SYS_PARAM_H�HAVE_SYS_POLL_H�HAVE_SYS_RANDOM_H�HAVE_SYS_RESOURCE_H�HAVE_SYS_SELECT_H�HAVE_SYS_SENDFILE_H�HAVE_SYS_SOCKET_H�HAVE_SYS_STATVFS_H�HAVE_SYS_STAT_H�HAVE_SYS_SYSCALL_H�HAVE_SYS_SYSMACROS_H�HAVE_SYS_SYS_DOMAIN_H�HAVE_SYS_TERMIO_H�HAVE_SYS_TIMES_H�HAVE_SYS_TIME_H�HAVE_SYS_TYPES_H�HAVE_SYS_UIO_H�
HAVE_SYS_UN_H�HAVE_SYS_UTSNAME_H�HAVE_SYS_WAIT_H�HAVE_SYS_XATTR_H�HAVE_TCGETPGRP�HAVE_TCSETPGRP�HAVE_TEMPNAM�HAVE_TERMIOS_H�HAVE_TERM_H�HAVE_TGAMMA�HAVE_TIMEGM�
HAVE_TIMES�HAVE_TMPFILE�HAVE_TMPNAM�
HAVE_TMPNAM_R�HAVE_TM_ZONE�
HAVE_TRUNCATE�HAVE_TZNAME�
HAVE_UCS4_TCL�
HAVE_UNAME�
HAVE_UNISTD_H�
HAVE_UNLINKAT�
HAVE_UNSETENV�HAVE_USABLE_WCHAR_T�HAVE_UTIL_H�HAVE_UTIMENSAT�HAVE_UTIMES�HAVE_UTIME_H�
HAVE_WAIT3�
HAVE_WAIT4�HAVE_WAITID�HAVE_WAITPID�HAVE_WCHAR_H�HAVE_WCSCOLL�
HAVE_WCSFTIME�HAVE_WCSXFRM�HAVE_WMEMCMP�HAVE_WORKING_TZSET�HAVE_WRITEV�HAVE_ZLIB_COPY�HAVE__GETPTY�
HOST_GNU_TYPE�INCLDIRSTOMAKE�
INCLUDEDIR�	INCLUDEPY�INSTALL�INSTALL_DATA�INSTALL_PROGRAM�INSTALL_SCRIPT�INSTALL_SHARED�
INSTSONAME�IO_H�IO_OBJS�LDCXXSHARED�LDFLAGS�LDLAST�	LDLIBRARY�LDLIBRARYDIR�LDSHARED�	LDVERSION�LIBC�LIBDEST�LIBDIR�LIBFFI_INCLUDEDIR�LIBM�	LIBOBJDIR�LIBOBJS�LIBPC�LIBPL�LIBRARY�LIBRARY_OBJS�LIBRARY_OBJS_OMIT_FROZEN�LIBS�
LIBSUBDIRS�LINKCC�
LINKFORSHARED�LIPO_32BIT_FLAGS�
LLVM_PROF_ERR�LLVM_PROF_FILE�LLVM_PROF_MERGER�LN�LOCALMODLIBS�LOG1P_DROPS_ZERO_SIGN�MACHDEP�MACHDEPPATH�MACHDEP_OBJS�MACHDESTLIB�MACOSX_DEPLOYMENT_TARGET�MAINCC�MAJOR_IN_MKDEV�MAJOR_IN_SYSMACROS�	MAKESETUP�MANDIR�MKDIR_P�MODLIBS�MODNAMES�MODOBJS�MODULE_OBJS�	MULTIARCH�MULTIARCH_CPPFLAGS�MVWDELCH_IS_EXPRESSION�NO_AS_NEEDED�OBJECT_OBJS�OPT�OTHER_LIBTOOL_OPT�PACKAGE_BUGREPORT�PACKAGE_NAME�PACKAGE_STRING�PACKAGE_TARNAME�PACKAGE_URL�PACKAGE_VERSION�PARSER_HEADERS�PARSER_OBJS�PGEN�PGENOBJS�PGOBJS�PGO_PROF_GEN_FLAG�PGO_PROF_USE_FLAG�PLATDIR�POBJS�POSIX_SEMAPHORES_NOT_ENABLED�PROFILE_TASK�PTHREAD_SYSTEM_SCHED_SUPPORTED�
PY3LIBRARY�PYLONG_BITS_IN_DIGIT�PYTHON�PYTHONFRAMEWORK�PYTHONFRAMEWORKDIR�PYTHONFRAMEWORKINSTALLDIR�PYTHONFRAMEWORKPREFIX�
PYTHONPATH�PYTHON_FOR_BUILD�PYTHON_FOR_REGEN�PYTHON_HEADERS�PYTHON_OBJS�	PY_CFLAGS�PY_CFLAGS_NODIST�PY_COERCE_C_LOCALE�PY_CORE_CFLAGS�PY_CORE_LDFLAGS�PY_CPPFLAGS�PY_FORMAT_SIZE_T�
PY_LDFLAGS�PY_LDFLAGS_NODIST�PY_SSL_DEFAULT_CIPHERS�PY_SSL_DEFAULT_CIPHER_STRING�PY_WARN_ON_C_LOCALE�Py_DEBUG�Py_ENABLE_SHARED�Py_HASH_ALGORITHM�
QUICKTESTOPTS�READELF�	RESSRCDIR�
RETSIGTYPE�	RUNSHARED�	SCRIPTDIR�SETPGRP_HAVE_ARG�SGI_ABI�SHELL�SHLIBS�SHLIB_SUFFIX�SIGNED_RIGHT_SHIFT_ZERO_FILLS�SITEPATH�
SIZEOF_DOUBLE�SIZEOF_FLOAT�
SIZEOF_FPOS_T�
SIZEOF_INT�SIZEOF_LONG�SIZEOF_LONG_DOUBLE�SIZEOF_LONG_LONG�SIZEOF_OFF_T�SIZEOF_PID_T�SIZEOF_PTHREAD_T�SIZEOF_SHORT�
SIZEOF_SIZE_T�
SIZEOF_TIME_T�SIZEOF_UINTPTR_T�
SIZEOF_VOID_P�SIZEOF_WCHAR_T�SIZEOF__BOOL�SOABI�SRCDIRS�
SRC_GDB_HOOKS�STDC_HEADERS�STRICT_SYSV_CURSES�	STRIPFLAG�SUBDIRS�
SUBDIRSTOO�SYSLIBS�SYS_SELECT_WITH_SYS_TIME�TANH_PRESERVES_ZERO_SIGN�TCLTK_INCLUDES�
TCLTK_LIBS�TESTOPTS�TESTPATH�
TESTPYTHON�TESTPYTHONOPTS�
TESTRUNNER�TESTTIMEOUT�	THREADOBJ�TIMEMODULE_LIB�TIME_WITH_SYS_TIME�TM_IN_SYS_TIME�UNICODE_DEPS�UNIVERSALSDK�UPDATE_FILE�USE_COMPUTED_GOTOS�
USE_INLINE�VERSION�VPATH�WANT_SIGFPE_HANDLER�WINDOW_HAS_FLAGS�WITH_DOC_STRINGS�WITH_DTRACE�	WITH_DYLD�WITH_LIBINTL�WITH_NEXT_FRAMEWORK�
WITH_PYMALLOC�WITH_THREAD�
WITH_VALGRIND�X87_DOUBLE_ROUNDING�
XMLLIBSUBDIRS�abs_builddir�
abs_srcdir�datarootdir�exec_prefix�prefix�srcdirN)�build_time_vars�r�r��@/usr/lib64/python3.6/_sysconfigdata_dm_linux_x86_64-linux-gnu.py�<module>s*nturl2path.cpython-36.opt-2.pyc000064400000002237150335715140012245 0ustar003


 \�	�@sdd�Zdd�ZdS)cCsddl}ddl}|jdd�}d|kr\|dd�dkr@|dd�}|jd�}|jjdj|��S|jd�}t|�dks�|dd|jkr�d
|}t	|��|ddj
�}|d	jd�}|d}x$|D]}|r�|d|jj|�}q�W|jd�o�|jd��r�|d7}|S)
N��:�|�z////��/�\�z	Bad URL: ���r	)�string�urllib.parse�replace�split�parseZunquote�join�lenZ
ascii_letters�OSError�upper�endswith)Zurlr
�urllib�
components�comp�error�drive�path�r�"/usr/lib64/python3.6/nturl2path.py�url2pathnames(	


rcCs�ddl}d|krD|dd�dkr(d|}|jd�}|jjdj|��S|jd�}t|�dksjt|d�dkrzd|}t|��|jj|dj��}|djd�}d	|d}x$|D]}|r�|d|jj|�}q�W|S)
Nrrrz\\rrrz
Bad path: z///)rr
rZquoterrrr)�prrrrrrrrr�pathname2url(s"


rN)rrrrrr�<module>s%inspect.cpython-36.pyc000064400000233575150335715140010662 0ustar003


 \���@s�dZd�ZddlZddlZddlZddlZddlZddlZ	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlmZddlmZmZe�Zx"ejj�D]\ZZeede<q�Wd�Zd
d�Z dd
�Z!dd�Z"dd�Z#dd�Z$e%ed��rdd�Z&ndd�Z&e%ed��r6dd�Z'ndd�Z'dd�Z(dd�Z)d d!�Z*d"d#�Z+d$d%�Z,d&d'�Z-d(d)�Z.d*d+�Z/d,d-�Z0d.d/�Z1d0d1�Z2d2d3�Z3d4d5�Z4d6d7�Z5d�d8d9�Z6ed:d;�Z7d<d=�Z8d>d?�Z9dd@�dAdB�Z:dCdD�Z;dEdF�Z<dGdH�Z=dIdJ�Z>dKdL�Z?dMdN�Z@dOdP�ZAdQdR�ZBd�dSdT�ZCiZDiZEd�dUdV�ZFdWdX�ZGdYdZ�ZHGd[d\�d\eI�ZJGd]d^�d^�ZKd_d`�ZLdadb�ZMdcdd�ZNdedf�ZOd�dhdi�ZPedjdk�ZQdldm�ZRdndo�ZSedpdq�ZTdrds�ZUedtdu�ZVdvdw�ZWedxdy�ZXdzd{�ZYd�d|d}�ZZd~d�Z[dddfiie\d�d��d�d��d�d��d�d��eZfd�d��Z]e\d�d��d�d��d�d��fd�d��Z^d�d��Z_d�d��Z`d�d��Zaed�d��Zbd�d��Zced�d��Zdd�d�d��Zed�d��Zfed�d�edjg�Zhd�d�d��Zid�d�d��Zjd�d��Zkd�d�d��Zl�dd�d��Zmen�Zod�d��Zpd�d��Zqd�d��Zrd�d��Zsd�d��Zteofd�d��Zud�Zvd�Zwd�Zxd�Zyd�d��Zzd�d��Z{d�Z|d�Z}d�Z~d�Zd�d��Z�d�dÄZ�e�e�j��Z�e�e�j��Z�e�e�j�d��Z�e�e�e�ej�fZ�d�dƄZ�ffd�dȄZ�d�dʄZ�d�d̄Z�d�d΄Z�d�dЄZ�d�d҄Z��dd�dՄZ��dd�dׄZ�d�dلZ�d�d�dڜd�d܄Z�Gd�dބdރZ�Gd�d�d�Z�Gd�d�d�ej��Z�e�j�Z�e�j�Z�e�j�Z�e�j�Z�e�j�Z�e�d�e�d�e�d�e�d�e�d�iZ�e�j�Z�Gd�d�d�Z�Gd�d�d�Z�Gd�d�d�Z�d�d�d�d�Z�d�d�Z�e�d�k�r�e��dS(aGet useful information from live Python objects.

This module encapsulates the interface provided by the internal special
attributes (co_*, im_*, tb_*, etc.) in a friendlier fashion.
It also provides some help for examining source code and class layout.

Here are some of the useful functions provided by this module:

    ismodule(), isclass(), ismethod(), isfunction(), isgeneratorfunction(),
        isgenerator(), istraceback(), isframe(), iscode(), isbuiltin(),
        isroutine() - check object types
    getmembers() - get members of an object that satisfy a given condition

    getfile(), getsourcefile(), getsource() - find an object's source code
    getdoc(), getcomments() - get documentation on an object
    getmodule() - determine the module that an object came from
    getclasstree() - arrange classes so as to represent their hierarchy

    getargvalues(), getcallargs() - get info about function arguments
    getfullargspec() - same, with support for Python 3 features
    formatargspec(), formatargvalues() - format an argument spec
    getouterframes(), getinnerframes() - get info about frames
    currentframe() - get the current stack frame
    stack(), trace() - get info about frames on the stack or in a traceback

    signature() - get a Signature object for the callable
�Ka-Ping Yee <ping@lfw.org>�'Yury Selivanov <yselivanov@sprymix.com>�N)�
attrgetter)�
namedtuple�OrderedDictZCO_��cCst|tj�S)z�Return true if the object is a module.

    Module objects provide these attributes:
        __cached__      pathname to byte compiled file
        __doc__         documentation string
        __file__        filename (missing for built-in modules))�
isinstance�types�
ModuleType)�object�r
�/usr/lib64/python3.6/inspect.py�ismodule@srcCs
t|t�S)z�Return true if the object is a class.

    Class objects provide these attributes:
        __doc__         documentation string
        __module__      name of module in which this class was defined)r	�type)rr
r
r�isclassIsrcCst|tj�S)a_Return true if the object is an instance method.

    Instance method objects provide these attributes:
        __doc__         documentation string
        __name__        name with which this method was defined
        __func__        function object containing implementation of method
        __self__        instance to which this method is bound)r	r
�
MethodType)rr
r
r�ismethodQsrcCs:t|�st|�st|�rdSt|�}t|d�o8t|d�S)a�Return true if the object is a method descriptor.

    But not if ismethod() or isclass() or isfunction() are true.

    This is new in Python 2.2, and, for example, is true of int.__add__.
    An object passing this test has a __get__ attribute but not a __set__
    attribute, but beyond that the set of attributes varies.  __name__ is
    usually sensible, and __doc__ often is.

    Methods implemented via descriptors that also pass one of the other
    tests return false from the ismethoddescriptor() test, simply because
    the other tests promise more -- you can, e.g., count on having the
    __func__ attribute (etc) when an object passes ismethod().F�__get__�__set__)rr�
isfunctionr�hasattr)r�tpr
r
r�ismethoddescriptor[srcCs8t|�st|�st|�rdSt|�}t|d�o6t|d�S)a�Return true if the object is a data descriptor.

    Data descriptors have both a __get__ and a __set__ attribute.  Examples are
    properties (defined in Python) and getsets and members (defined in C).
    Typically, data descriptors will also have __name__ and __doc__ attributes
    (properties, getsets, and members have both of these attributes), but this
    is not guaranteed.Frr)rrrrr)rrr
r
r�isdatadescriptorosr�MemberDescriptorTypecCst|tj�S)z�Return true if the object is a member descriptor.

        Member descriptors are specialized descriptors defined in extension
        modules.)r	r
r)rr
r
r�ismemberdescriptorsrcCsdS)z�Return true if the object is a member descriptor.

        Member descriptors are specialized descriptors defined in extension
        modules.Fr
)rr
r
rr�s�GetSetDescriptorTypecCst|tj�S)z�Return true if the object is a getset descriptor.

        getset descriptors are specialized descriptors defined in extension
        modules.)r	r
r)rr
r
r�isgetsetdescriptor�srcCsdS)z�Return true if the object is a getset descriptor.

        getset descriptors are specialized descriptors defined in extension
        modules.Fr
)rr
r
rr�scCst|tj�S)a(Return true if the object is a user-defined function.

    Function objects provide these attributes:
        __doc__         documentation string
        __name__        name with which this function was defined
        __code__        code object containing compiled function bytecode
        __defaults__    tuple of any default values for arguments
        __globals__     global namespace in which this function was defined
        __annotations__ dict of parameter annotations
        __kwdefaults__  dict of keyword only parameters with defaults)r	r
�FunctionType)rr
r
rr�srcCs tt|�st|�o|jjt@�S)z�Return true if the object is a user-defined generator function.

    Generator function objects provide the same attributes as functions.
    See help(isfunction) for a list of attributes.)�boolrr�__code__�co_flagsZCO_GENERATOR)rr
r
r�isgeneratorfunction�sr#cCs tt|�st|�o|jjt@�S)zuReturn true if the object is a coroutine function.

    Coroutine functions are defined with "async def" syntax.
    )r rrr!r"ZCO_COROUTINE)rr
r
r�iscoroutinefunction�sr$cCs tt|�st|�o|jjt@�S)z�Return true if the object is an asynchronous generator function.

    Asynchronous generator functions are defined with "async def"
    syntax and have "yield" expressions in their body.
    )r rrr!r"ZCO_ASYNC_GENERATOR)rr
r
r�isasyncgenfunction�sr%cCst|tj�S)z7Return true if the object is an asynchronous generator.)r	r
�AsyncGeneratorType)rr
r
r�
isasyncgen�sr'cCst|tj�S)aReturn true if the object is a generator.

    Generator objects provide these attributes:
        __iter__        defined to support iteration over container
        close           raises a new GeneratorExit exception inside the
                        generator to terminate the iteration
        gi_code         code object
        gi_frame        frame object or possibly None once the generator has
                        been exhausted
        gi_running      set to 1 when generator is executing, 0 otherwise
        next            return the next item from the container
        send            resumes the generator and "sends" a value that becomes
                        the result of the current yield-expression
        throw           used to raise an exception inside the generator)r	r
�
GeneratorType)rr
r
r�isgenerator�sr)cCst|tj�S)z)Return true if the object is a coroutine.)r	r
�
CoroutineType)rr
r
r�iscoroutine�sr+cCs6t|tj�p4t|tj�r(t|jjt@�p4t|tj	j
�S)z?Return true if object can be passed to an ``await`` expression.)r	r
r*r(r �gi_coder"ZCO_ITERABLE_COROUTINE�collections�abc�	Awaitable)rr
r
r�isawaitable�sr0cCst|tj�S)abReturn true if the object is a traceback.

    Traceback objects provide these attributes:
        tb_frame        frame object at this level
        tb_lasti        index of last attempted instruction in bytecode
        tb_lineno       current line number in Python source code
        tb_next         next inner traceback object (called by this level))r	r
�
TracebackType)rr
r
r�istraceback�sr2cCst|tj�S)a`Return true if the object is a frame object.

    Frame objects provide these attributes:
        f_back          next outer frame object (this frame's caller)
        f_builtins      built-in namespace seen by this frame
        f_code          code object being executed in this frame
        f_globals       global namespace seen by this frame
        f_lasti         index of last attempted instruction in bytecode
        f_lineno        current line number in Python source code
        f_locals        local namespace seen by this frame
        f_trace         tracing function for this frame, or None)r	r
�	FrameType)rr
r
r�isframe�sr4cCst|tj�S)aEReturn true if the object is a code object.

    Code objects provide these attributes:
        co_argcount         number of arguments (not including *, ** args
                            or keyword only arguments)
        co_code             string of raw compiled bytecode
        co_cellvars         tuple of names of cell variables
        co_consts           tuple of constants used in the bytecode
        co_filename         name of file in which this code object was created
        co_firstlineno      number of first line in Python source code
        co_flags            bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg
                            | 16=nested | 32=generator | 64=nofree | 128=coroutine
                            | 256=iterable_coroutine | 512=async_generator
        co_freevars         tuple of names of free variables
        co_kwonlyargcount   number of keyword only arguments (not including ** arg)
        co_lnotab           encoded mapping of line numbers to bytecode indices
        co_name             name with which this code object was defined
        co_names            tuple of names of local variables
        co_nlocals          number of local variables
        co_stacksize        virtual machine stack space required
        co_varnames         tuple of names of arguments and local variables)r	r
�CodeType)rr
r
r�iscode�sr6cCst|tj�S)a,Return true if the object is a built-in function or method.

    Built-in functions and methods provide these attributes:
        __doc__         documentation string
        __name__        original name of this function or method
        __self__        instance to which a method is bound, or None)r	r
�BuiltinFunctionType)rr
r
r�	isbuiltinsr8cCs t|�pt|�pt|�pt|�S)z<Return true if the object is any kind of function or method.)r8rrr)rr
r
r�	isroutinesr9cCs�t|t�sdS|jt@rdStt|�tj�s0dSt|d�r>dSx&|jj	�D]\}}t
|dd�rJdSqJWx@|jD]6}x0t
|df�D] }t
||d�}t
|dd�r�dSq�WqnWdS)z:Return true if the object is an abstract base class (ABC).FT�__abstractmethods__�__isabstractmethod__N)r	r�	__flags__�TPFLAGS_IS_ABSTRACT�
issubclassr.�ABCMetar�__dict__�items�getattr�	__bases__)r�name�value�baser
r
r�
isabstract%s"


rGcCs&t|�r|ft|�}nf}g}t�}t|�}yBx<|jD]2}x,|jj�D]\}}t|tj	�rH|j
|�qHWq8WWntk
r�YnXx�|D]�}	yt||	�}
|	|kr�t�Wn:tk
r�x$|D]}|	|jkr�|j|	}
Pq�Ww�YnX|s�||
��r|j
|	|
f�|j
|	�q�W|jdd�d�|S)z�Return all members of an object as (name, value) pairs sorted by name.
    Optionally, only return members that satisfy a given predicate.cSs|dS)Nrr
)Zpairr
r
r�<lambda>fszgetmembers.<locals>.<lambda>)�key)r�getmro�set�dirrCr@rAr	r
�DynamicClassAttribute�append�AttributeErrorrB�add�sort)rZ	predicate�mro�results�	processed�namesrF�k�vrIrEr
r
r�
getmembers=s:




rX�	Attributezname kind defining_class objectcCs\t|�}tt|��}tdd�|D��}|f|}||}t|�}x:|D]2}x,|jj�D]\}}t|tj�rV|j	|�qVWqFWg}	t
�}
�x�|D�]�}d}d}
d}||
k�r�y|dkr�td��t||�}
Wn"tk
r�}zWYdd}~Xn�Xt|
d|�}||k�r�d}d}x(|D] }t||d�}||
k�r|}�qWxH|D]@}y|j
||�}Wntk
�rh�w:YnX||
k�r:|}�q:W|dk	�r�|}x4|D],}||jk�r�|j|}||k�r�|}P�q�W|dk�r�q�|
dk	�r�|
n|}t|t��r�d}|}n@t|t��rd}|}n*t|t��r"d	}|}nt|��r2d
}nd}|	j	t||||��|
j|�q�W|	S)aNReturn list of attribute-descriptor tuples.

    For each name in dir(cls), the return list contains a 4-tuple
    with these elements:

        0. The name (a string).

        1. The kind of attribute this is, one of these strings:
               'class method'    created via classmethod()
               'static method'   created via staticmethod()
               'property'        created via property()
               'method'          any other flavor of method or descriptor
               'data'            not a method

        2. The class which defined this attribute (a class).

        3. The object as obtained by calling getattr; if this fails, or if the
           resulting object does not live anywhere in the class' mro (including
           metaclasses) then the object is looked up in the defining class's
           dict (found by walking the mro).

    If one of the items in dir(cls) is stored in the metaclass it will now
    be discovered and not have None be listed as the class in which it was
    defined.  Any items whose home class cannot be discovered are skipped.
    cSsg|]}|ttfkr|�qSr
)rr)�.0�clsr
r
r�
<listcomp>�sz(classify_class_attrs.<locals>.<listcomp>Nr@z)__dict__ is special, don't want the proxy�__objclass__z
static methodzclass method�property�method�data)rJr�tuplerLr@rAr	r
rMrNrK�	ExceptionrB�__getattr__rO�staticmethod�classmethodr^r9rYrP)r[rRZmetamroZclass_basesZ	all_basesrUrFrVrW�resultrTrDZhomeclsZget_objZdict_obj�excZlast_clsZsrch_clsZsrch_obj�obj�kindr
r
r�classify_class_attrsks�

















rjcCs|jS)zHReturn tuple of base classes (including cls) in method resolution order.)�__mro__)r[r
r
rrJ�srJ)�stopcs��dkrdd�}n�fdd�}|}t|�|i}tj�}xD||�rz|j}t|�}||ksbt|�|krptdj|���|||<q8W|S)anGet the object wrapped by *func*.

   Follows the chain of :attr:`__wrapped__` attributes returning the last
   object in the chain.

   *stop* is an optional callback accepting an object in the wrapper chain
   as its sole argument that allows the unwrapping to be terminated early if
   the callback returns a true value. If the callback never returns a true
   value, the last object in the chain is returned as usual. For example,
   :func:`signature` uses this to stop unwrapping if any object in the
   chain has a ``__signature__`` attribute defined.

   :exc:`ValueError` is raised if a cycle is encountered.

    NcSs
t|d�S)N�__wrapped__)r)�fr
r
r�_is_wrapper�szunwrap.<locals>._is_wrappercst|d�o�|�S)Nrm)r)rn)rlr
rro�sz!wrapper loop when unwrapping {!r})�id�sys�getrecursionlimitrm�len�
ValueError�format)�funcrlrorn�memoZrecursion_limitZid_funcr
)rlr�unwrap�s

rxcCs|j�}t|�t|j��S)zBReturn the indent size, in spaces, at the start of a line of text.)�
expandtabsrs�lstrip)�lineZexpliner
r
r�
indentsize	sr|cCsRtjj|j�}|dkrdSx&|jjd�dd�D]}t||�}q0Wt|�sNdS|S)N�.r���)rq�modules�get�
__module__�__qualname__�splitrBr)rvr[rDr
r
r�
_findclasssr�cCs�t|�rRxD|jD]:}|tk	ry
|j}Wntk
r<wYnX|dk	r|SqWdSt|�r�|jj}|j}t|�r�t	t	||d�d�|jkr�|}n|j
}n�t|�r�|j}t|�}|dks�t	||�|k	r�dSn�t
|��r
|j}|j}t|�o�|jd||jk�r|}n|j
}nzt|t��rJ|j}|j}t|�}|dk�sDt	||�|k	�r�dSn:t|��s^t|��r�|j}|j}t	||�|k	�r�dSndSxJ|jD]@}yt	||�j}Wntk
�r��w�YnX|dk	�r�|S�q�WdS)N�__func__r})rrkr�__doc__rOrr��__name__�__self__rB�	__class__rr�r8r�r	r^�fgetrrr])rhrF�docrD�selfr[rvr
r
r�_finddocsb




r�cCsdy
|j}Wntk
rdSX|dkrNyt|�}Wnttfk
rLdSXt|t�s\dSt|�S)z�Get the documentation string for an object.

    All tabs are expanded to spaces.  To clean up docstrings that are
    indented to line up with blocks of code, any whitespace than can be
    uniformly removed from the second line onwards is removed.N)r�rOr��	TypeErrorr	�str�cleandoc)rr�r
r
r�getdocSs

r�cCs�y|j�jd�}Wntk
r&dSXtj}x:|dd�D]*}t|j��}|r<t|�|}t||�}q<W|r~|dj�|d<|tjkr�x*tdt|��D]}|||d�||<q�Wx|r�|dr�|j	�q�Wx|r�|dr�|j	d�q�Wdj
|�SdS)z�Clean up indentation from docstrings.

    Any whitespace that can be uniformly removed from the second line
    onwards is removed.�
Nrrr~)ryr��UnicodeErrorrq�maxsizersrz�min�range�pop�join)r��linesZmarginr{Zcontent�indent�ir
r
rr�fs(
r�cCs�t|�r&t|d�r|jStdj|���t|�rdt|d�rVtjj|j	�}t|d�rV|jStdj|���t
|�rr|j}t|�r�|j
}t|�r�|j}t|�r�|j}t|�r�|jStdj|���dS)z@Work out which source or compiled file an object was defined in.�__file__z{!r} is a built-in moduler�z{!r} is a built-in classzO{!r} is not a module, class, method, function, traceback, frame, or code objectN)rrr�r�rurrqrr�r�rr�rr!r2�tb_framer4�f_coder6�co_filename)rr
r
r�getfile�s,


r�cCsTtjj|�}dd�tjj�D�}|j�x&|D]\}}|j|�r.|d|�Sq.WdS)z1Return the module name for a given file, or None.cSsg|]}t|�|f�qSr
)rs)rZ�suffixr
r
rr\�sz!getmodulename.<locals>.<listcomp>N)�os�path�basename�	importlib�	machinery�all_suffixesrQ�endswith)r�Zfname�suffixesZneglenr�r
r
r�
getmodulename�s
r�cs�t|��tjjdd�}|tjjdd�7}t�fdd�|D��r`tjj��dtjj	d�nt�fdd�tjj
D��r~dStjj��r��Stt
|��dd�dk	r��S�tjkr��SdS)z�Return the filename that can be used to locate an object's source.
    Return None if no way can be identified to get the source.
    Nc3s|]}�j|�VqdS)N)r�)rZ�s)�filenamer
r�	<genexpr>�sz getsourcefile.<locals>.<genexpr>rc3s|]}�j|�VqdS)N)r�)rZr�)r�r
rr��s�
__loader__)r�r�r��DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXES�anyr�r��splitext�SOURCE_SUFFIXES�EXTENSION_SUFFIXES�existsrB�	getmodule�	linecache�cache)rZall_bytecode_suffixesr
)r�r�
getsourcefile�s
r�cCs,|dkrt|�pt|�}tjjtjj|��S)z�Return an absolute path to the source or compiled file for an object.

    The idea is for each object to have a unique origin, so this routine
    normalizes the result as much as possible.N)r�r�r�r��normcase�abspath)r�	_filenamer
r
r�
getabsfile�sr�c

Cs�t|�r|St|d�r$tjj|j�S|dk	rD|tkrDtjjt|�Syt||�}Wntk
rfdSX|tkr�tjjt|�Sxnt	tjj
��D]\\}}t|�r�t|d�r�|j}|tj|d�kr�q�|t|<t|�}|j
t|<ttjj|�<q�W|tk�r
tjjt|�Stjd}t|d��s$dSt||j
��rLt||j
�}||k�rL|Stjd}t||j
��r~t||j
�}	|	|k�r~|SdS)zAReturn the module an object was defined in, or None if not found.r�Nr��__main__r��builtins)rrrqrr�r��
modulesbyfiler�r��listrAr��_filesbymodnamer�r�r��realpathrB)
rr��file�modname�modulern�mainZ
mainobjectZbuiltinZ
builtinobjectr
r
rr��sD





r�c
Cs�t|�}|rtj|�n$t|�}|jd�o2|jd�s<td��t||�}|rZtj||j	�}n
tj|�}|sptd��t
|�r�|dfSt|��r |j}t
jd|d�}g}xRtt|��D]B}|j||�}|r�||ddkr�||fS|j|jd	�|f�q�W|�r|j�||dd	fStd
��t|��r0|j}t|��r@|j}t|��rP|j}t|��r`|j}t|��r�t|d��s~td��|jd	}	t
jd
�}x*|	dk�r�|j||	��r�P|	d	}	�q�W||	fStd��dS)abReturn the entire source file and starting line number for an object.

    The argument may be a module, class, method, function, traceback, frame,
    or code object.  The source code is returned as a list of all the lines
    in the file and the line number indexes a line in that list.  An OSError
    is raised if the source code cannot be retrieved.�<�>zsource code not availablezcould not get source coderz^(\s*)class\s*z\b�crzcould not find class definition�co_firstlinenoz"could not find function definitionz>^(\s*def\s)|(\s*async\s+def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)zcould not find code objectN) r�r��
checkcacher��
startswithr��OSErrorr��getlinesr@rrr��re�compiler�rs�matchrN�grouprQrr�rr!r2r�r4r�r6rr�)
rr�r�r�rDZpatZ
candidatesr�r��lnumr
r
r�
findsource�s^









r�cCs>yt|�\}}Wnttfk
r(dSXt|�r�d}|rR|ddd�dkrRd}x(|t|�krz||j�dkrz|d}qTW|t|�kr�||dd�dkr�g}|}x>|t|�kr�||dd�dkr�|j||j��|d}q�Wdj|�S�nH|dk�r:t	||�}|d}|dk�r:||j
�dd�dk�r:t	||�|k�r:||j�j
�g}|dk�r�|d}||j�j
�}x\|dd�dk�r�t	||�|k�r�|g|dd�<|d}|dk�r�P||j�j
�}�q|Wx*|�r|dj�dk�rg|dd�<�q�Wx*|�r.|d	j�dk�r.g|d
d�<�qWdj|�SdS)zwGet lines of comments immediately preceding an object's source code.

    Returns None when source can't be found.
    Nr�z#!r��#)r�r�r~r~)r�r�r�rrs�striprNryr�r|rz)rr�r��startZcomments�endr�Zcommentr
r
r�getcommentsAsJ "
$
&
r�c@seZdZdS)�
EndOfBlockN)r�r�r�r
r
r
rr�nsr�c@s eZdZdZdd�Zdd�ZdS)�BlockFinderz@Provide a tokeneater() method to detect the end of a code block.cCs.d|_d|_d|_d|_d|_d|_d|_dS)NrFr)r��islambda�started�passline�indecorator�decoratorhasargs�last)r�r
r
r�__init__rszBlockFinder.__init__cCs&|jrD|jrD|dkr d|_n|dkr<|dkr6d|_d|_d|_n�|dkrZ|jrXd|_n�|dkrv|jrtd|_d|_n�|tjkr�d|_|d	|_|jr�t�|jr�|jr�d|_nr|jr�nj|tj	kr�|j
d
|_
d|_nL|tjk�r|j
d
|_
|j
d	k�r"t�n"|j
d	k�r"|tjtj
fk�r"t�dS)N�@T�def�class�lambda�(�)Frr)r�r�r�)r�r�r�r�r��tokenize�NEWLINEr�r��INDENTr��DEDENT�COMMENT�NL)r�r�tokenZsrowcolZerowcolr{r
r
r�
tokeneater{sB


zBlockFinder.tokeneaterN)r�r�r�r�r�r�r
r
r
rr�ps	r�cCsZt�}y,tjt|�j�}x|D]}|j|�qWWnttfk
rJYnX|d|j�S)z@Extract the block of code at the top of the given list of lines.N)	r�r��generate_tokens�iter�__next__r�r��IndentationErrorr�)r�Zblockfinder�tokensZ_tokenr
r
r�getblock�s
r�cCsbt|�}t|�\}}t|�r"|j}t|�s>t|�rF|jjdkrF|dfSt||d��|dfSdS)a�Return a list of source lines and starting line number for an object.

    The argument may be a module, class, method, function, traceback, frame,
    or code object.  The source code is returned as a list of the lines
    corresponding to the object and the line number indicates where in the
    original source file the first line of code was found.  An OSError is
    raised if the source code cannot be retrieved.z<module>rNr)	rxr�r2r�rr4r��co_namer�)rr�r�r
r
r�getsourcelines�sr�cCst|�\}}dj|�S)aReturn the text of the source code for an object.

    The argument may be a module, class, method, function, traceback, frame,
    or code object.  The source code is returned as a single string.  An
    OSError is raised if the source code cannot be retrieved.r�)r�r�)rr�r�r
r
r�	getsource�sr�cCsVg}|jtdd�d�x:|D]2}|j||jf�||kr|jt||||��qW|S)z-Recursive helper function for getclasstree().r�r�)rI)rQrrNrC�walktree)�classes�children�parentrSr�r
r
rr��s
r�FcCs�i}g}xn|D]f}|jrbxZ|jD]<}||kr4g||<|||krN||j|�|r ||kr Pq Wq||kr|j|�qWx|D]}||kr~|j|�q~Wt||d�S)a�Arrange the given list of classes into a hierarchy of nested lists.

    Where a nested list appears, it contains classes derived from the class
    whose entry immediately precedes the list.  Each entry is a 2-tuple
    containing a class and a tuple of its base classes.  If the 'unique'
    argument is true, exactly one entry appears in the returned structure
    for each class in the given list.  Otherwise, classes using multiple
    inheritance and their descendants will appear multiple times.N)rCrNr�)r��uniquer��rootsr�rr
r
r�getclasstree�s"	

r�	Argumentszargs, varargs, varkwcCs t|�\}}}}t||||�S)aGet information about the arguments accepted by a code object.

    Three things are returned: (args, varargs, varkw), where
    'args' is the list of argument names. Keyword-only arguments are
    appended. 'varargs' and 'varkw' are the names of the * and **
    arguments or None.)�_getfullargsr)�co�args�varargs�
kwonlyargs�varkwr
r
r�getargs�src	Cs�t|�stdj|���|j}|j}|j}t|d|��}t||||��}d}||7}d}|jt@rx|j|}|d}d}|jt	@r�|j|}||||fS)aGet information about the arguments accepted by a code object.

    Four things are returned: (args, varargs, kwonlyargs, varkw), where
    'args' and 'kwonlyargs' are lists of argument names, and 'varargs'
    and 'varkw' are the names of the * and ** arguments or None.z{!r} is not a code objectNrr)
r6r�ru�co_argcount�co_varnames�co_kwonlyargcountr�r"�
CO_VARARGS�CO_VARKEYWORDS)	r�nargsrUZnkwargsrr	�steprr
r
r
rrs"



r�ArgSpeczargs varargs keywords defaultscCsDtjdtdd�t|�\}}}}}}}|s.|r6td��t||||�S)aeGet the names and default values of a function's parameters.

    A tuple of four things is returned: (args, varargs, keywords, defaults).
    'args' is a list of the argument names, including keyword-only argument names.
    'varargs' and 'keywords' are the names of the * and ** parameters or None.
    'defaults' is an n-tuple of the default values of the last n parameters.

    This function is deprecated, as it does not support annotations or
    keyword-only parameters and will raise ValueError if either is present
    on the supplied callable.

    For a more structured introspection API, use inspect.signature() instead.

    Alternatively, use getfullargspec() for an API with a similar namedtuple
    based interface, but full support for annotations and keyword-only
    parameters.

    Deprecated since Python 3.5, use `inspect.getfullargspec()`.
    zhinspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()r�)�
stacklevelzdFunction has keyword-only parameters or annotations, use getfullargspec() API which can support them)�warnings�warn�DeprecationWarning�getfullargspecrtr)rvrrr
�defaultsr	�kwonlydefaults�annr
r
r�
getargspec s
r�FullArgSpeczGargs, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotationsc
Cs`yt|ddtd�}Wn,tk
r@}ztd�|�WYdd}~XnXg}d}d}g}f}i}f}i}	|j|jk	rx|j|d<x�|jj�D]�}
|
j}|
j	}|t
kr�|j|�nv|tkr�|j|�|
j
|
jk	r�||
j
f7}nJ|tkr�|}n<|tk�r|j|�|
j
|
jk	�r|
j
|	|<n|tk�r|}|
j|
jk	r�|
j||<q�W|	�sBd}	|�sLd}t||||||	|�S)a$Get the names and default values of a callable object's parameters.

    A tuple of seven things is returned:
    (args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations).
    'args' is a list of the parameter names.
    'varargs' and 'varkw' are the names of the * and ** parameters or None.
    'defaults' is an n-tuple of the default values of the last n parameters.
    'kwonlyargs' is a list of keyword-only parameter names.
    'kwonlydefaults' is a dictionary mapping names from kwonlyargs to defaults.
    'annotations' is a dictionary mapping parameter names to annotations.

    Notable differences from inspect.signature():
      - the "self" parameter is always reported, even for bound methods
      - wrapper chains defined by __wrapped__ *not* unwrapped automatically
    F)�follow_wrapper_chains�skip_bound_arg�sigclszunsupported callableN�return)�_signature_from_callable�	Signaturerbr��return_annotation�empty�
parameters�valuesrirD�_POSITIONAL_ONLYrN�_POSITIONAL_OR_KEYWORD�default�_VAR_POSITIONAL�
_KEYWORD_ONLY�_VAR_KEYWORD�
annotationr)
rv�sig�exrrr
r	r�annotations�
kwdefaults�paramrirDr
r
rrAsT





r�ArgInfozargs varargs keywords localscCs t|j�\}}}t||||j�S)a9Get information about arguments passed into a particular frame.

    A tuple of four things is returned: (args, varargs, varkw, locals).
    'args' is a list of the argument names.
    'varargs' and 'varkw' are the names of the * and ** arguments or None.
    'locals' is the locals dictionary of the given frame.)rr�r4�f_locals)�framerrr
r
r
r�getargvalues�sr7cCsVt|dd�dkr t|�jdd�St|t�rN|jd|fkr>|jS|jd|jSt|�S)Nr�Ztypingztyping.r�r�r})rB�repr�replacer	rr�r�)r.Zbase_moduler
r
r�formatannotation�s
r:cst|dd���fdd�}|S)Nr�cs
t|��S)N)r:)r.)r�r
r�_formatannotation�sz5formatannotationrelativeto.<locals>._formatannotation)rB)rr;r
)r�r�formatannotationrelativeto�sr<cCsd|S)N�*r
)rDr
r
rrH�srHcCsd|S)Nz**r
)rDr
r
rrH�scCsdt|�S)N�=)r8)rEr
r
rrH�scCsd|S)Nz -> r
)�textr
r
rrH�sc
s(���fdd�}
g}|r(t|�t|�}xFt|�D]:\}}|
|�}|rb||krb||
|||�}|j|�q2W|dk	r�|j||
|���n|r�|jd�|r�x:|D]2}|
|�}|r�||kr�||
||�7}|j|�q�W|dk	r�|j|	|
|���ddj|�d}d�k�r$||��d��7}|S)	a�Format an argument spec from the values returned by getfullargspec.

    The first seven arguments are (args, varargs, varkw, defaults,
    kwonlyargs, kwonlydefaults, annotations).  The other five arguments
    are the corresponding optional formatting functions that are called to
    turn names and values into strings.  The last argument is an optional
    function to format the sequence of arguments.cs(�|�}|�kr$|d��|�7}|S)Nz: r
)�argrf)r1r:�	formatargr
r�formatargandannotation�sz-formatargspec.<locals>.formatargandannotationNr=r�z, r�r!)rs�	enumeraterNr�)rrr
rr	rr1rA�
formatvarargs�formatvarkw�formatvalueZ
formatreturnsr:rB�specsZfirstdefaultr�r@�specZ	kwonlyargrfr
)r1r:rAr�
formatargspec�s2


rIcCsd|S)Nr=r
)rDr
r
rrH�scCsd|S)Nz**r
)rDr
r
rrH�scCsdt|�S)Nr>)r8)rEr
r
rrH�scCs�|||fdd�}g}	x&tt|��D]}
|	j|||
��q"W|rZ|	j||�|||��|rx|	j||�|||��ddj|	�dS)afFormat an argument spec from the 4 values returned by getargvalues.

    The first four arguments are (args, varargs, varkw, locals).  The
    next four arguments are the corresponding optional formatting functions
    that are called to turn names and values into strings.  The ninth
    argument is an optional function to format the sequence of arguments.cSs||�|||�S)Nr
)rD�localsrArFr
r
r�convert�sz formatargvalues.<locals>.convertr�z, r�)r�rsrNr�)rrr
rJrArDrErFrKrGr�r
r
r�formatargvalues�srLcs��fdd�|D�}t|�}|dkr,|d}n>|dkr@dj|�}n*dj|dd��}|dd�=dj|�|}td	|||rzd
nd|dkr�dnd
|f��dS)Ncsg|]}|�krt|��qSr
)r8)rZrD)r'r
rr\�sz&_missing_arguments.<locals>.<listcomp>rrr�z	{} and {}z, {} and {}z, z*%s() missing %i required %s argument%s: %s�
positionalzkeyword-onlyr�r����rN)rsrur�r�)�f_nameZargnames�posr'rU�missingr��tailr
)r'r�_missing_arguments�s


rSc
	s�t|�|}t�fdd�|D��}|r:|dk}	d|f}
n2|rTd}	d|t|�f}
nt|�dk}	tt|��}
d}|r�d}||dkr�d	nd||dkr�d	ndf}td
||
|	r�d	nd|||dkr�|r�dndf��dS)
Ncsg|]}|�kr|�qSr
r
)rZr@)r'r
rr\sz_too_many.<locals>.<listcomp>rzat least %dTz
from %d to %dr�z7 positional argument%s (and %d keyword-only argument%s)r�z5%s() takes %s positional argument%s but %d%s %s givenZwasZwere)rsr�r�)
rOrZkwonlyrZdefcountZgivenr'ZatleastZkwonly_givenZpluralr/Z
kwonly_sig�msgr
)r'r�	_too_manys$rUcOs6|d}|dd�}t|�}|\}}}}}	}
}|j}i}
t|�rV|jdk	rV|jf|}t|�}t|�}|rrt|�nd}t||�}x t|�D]}|||
||<q�W|r�t||d��|
|<t||	�}|r�i|
|<xd|j	�D]X\}}||k�r|�st
d||f��||
||<q�||
k�r,t
d||f��||
|<q�W||k�r^|�r^t|||	||||
�||k�r�|d||�}x&|D]}||
k�r~t||d|
��q~Wx8t
|||d��D] \}}||
k�r�|||
|<�q�Wd}x>|	D]6}||
k�r�|
�r||
k�r|
||
|<n|d7}�q�W|�r2t||	d|
�|
S)z�Get the mapping of arguments to values.

    A dict is returned, with keys the function argument names (including the
    names of the * and ** arguments, if any), and values the respective bound
    values from 'positional' and 'named'.rrNz*%s() got an unexpected keyword argument %rz(%s() got multiple values for argument %rTF)rr�rr�rsr�r�rarKrAr�rUrSrC)Zfunc_and_positionalZnamedrvrMrHrrr
rr	rrrOZ	arg2valueZnum_posZnum_argsZnum_defaults�nr�Zpossible_kwargs�kwrEZreqr@rQ�kwargr
r
r�getcallargs!sd








rY�ClosureVarsz"nonlocals globals builtins unboundc	Cst|�r|j}t|�s$tdj|���|j}|jdkr:i}ndd�t|j|j�D�}|j	}|j
dtj�}t
|�rt|j}i}i}t�}xn|jD]d}|d	kr�q�y||||<Wq�tk
r�y||||<Wntk
r�|j|�YnXYq�Xq�Wt||||�S)
a
    Get the mapping of free variables to their current values.

    Returns a named tuple of dicts mapping the current nonlocal, global
    and builtin references as seen by the body of the function. A final
    set of unbound names that could not be resolved is also provided.
    z'{!r}' is not a Python functionNcSsi|]\}}|j|�qSr
)�
cell_contents)rZ�varZcellr
r
r�
<dictcomp>vsz"getclosurevars.<locals>.<dictcomp>�__builtins__�None�True�False)r_r`ra)rr�rr�rur!�__closure__�zip�co_freevars�__globals__r�r�r@rrK�co_names�KeyErrorrPrZ)	rv�codeZ
nonlocal_varsZ	global_nsZ
builtin_nsZglobal_varsZbuiltin_varsZ
unbound_namesrDr
r
r�getclosurevarsas8	
ri�	Tracebackz+filename lineno function code_context indexcCs�t|�r|j}|j}n|j}t|�s2tdj|���t|�p@t|�}|dkr�|d|d}yt	|�\}}Wnt
k
r�d}}Yq�Xtdt|t
|�|��}||||�}|d|}nd}}t|||jj||�S)a�Get information about a frame or traceback object.

    A tuple of five things is returned: the filename, the line number of
    the current line, the function name, a list of lines of context from
    the source code, and the index of the current line within that list.
    The optional second argument specifies the number of lines of context
    to return, which are centered around the current line.z'{!r} is not a frame or traceback objectrrr�N)r2�	tb_linenor��f_linenor4r�rur�r�r�r��maxr�rsrjr�r�)r6�context�linenor�r�r�r��indexr
r
r�getframeinfo�s$rqcCs|jS)zCGet the line number from a frame object, allowing for optimization.)rl)r6r
r
r�	getlineno�srr�	FrameInfor6cCs6g}x,|r0|ft||�}|jt|��|j}qW|S)z�Get a list of records for a frame and all higher (calling) frames.

    Each record contains a frame object, filename, line number, function
    name, a list of lines of context, and index within the context.)rqrNrs�f_back)r6rn�	framelist�	frameinfor
r
r�getouterframes�s
rwcCs8g}x.|r2|jft||�}|jt|��|j}qW|S)z�Get a list of records for a traceback's frame and all lower frames.

    Each record contains a frame object, filename, line number, function
    name, a list of lines of context, and index within the context.)r�rqrNrs�tb_next)�tbrnrurvr
r
r�getinnerframes�s
rzcCsttd�rtjd�SdS)z?Return the frame of the caller or None if this is not possible.�	_getframerN)rrqr{r
r
r
r�currentframe�sr|cCsttjd�|�S)z@Return a list of records for the stack above the caller's frame.r)rwrqr{)rnr
r
r�stack�sr}cCsttj�d|�S)zCReturn a list of records for the stack below the current exception.r�)rzrq�exc_info)rnr
r
r�trace�srcCstjdj|�S)Nrk)rr@r)�klassr
r
r�_static_getmro�sr�cCs8i}ytj|d�}Wntk
r(YnXtj||t�S)Nr@)r�__getattribute__rO�dictr��	_sentinel)rh�attrZ
instance_dictr
r
r�_check_instance�sr�cCsFx@t|�D]4}tt|��tkr
y
|j|Stk
r<Yq
Xq
WtS)N)r��_shadowed_dictrr�r@rg)r�r��entryr
r
r�_check_class�s

r�cCs&yt|�Wntk
r dSXdS)NFT)r�r�)rhr
r
r�_is_type�s
r�cCsntjd}x^t|�D]R}y|j|�d}Wntk
r>YqXt|�tjko`|jdko`|j|ks|SqWt	S)Nr@)
rr@r�rrgr
rr�r]r�)r��	dict_attrr�Z
class_dictr
r
rr�s


r�cCst}t|�s>t|�}t|�}|tks2t|�tjkrBt||�}n|}t||�}|tk	r�|tk	r�tt|�d�tk	r�tt|�d�tk	r�|S|tk	r�|S|tk	r�|S||kr�xDtt|��D]4}tt|��tkr�y
|j	|St
k
r�Yq�Xq�W|tk	r�|St|��dS)a�Retrieve attributes without triggering dynamic lookup via the
       descriptor protocol,  __getattr__ or __getattribute__.

       Note: this function may not be able to retrieve all attributes
       that getattr can fetch (like dynamically created attributes)
       and may find attributes that getattr can't (like descriptors
       that raise AttributeError). It can also return descriptor objects
       instead of instance members in some cases. See the
       documentation for details.
    rrN)r�r�rr�r
rr�r�r�r@rgrO)rhr�r*Zinstance_resultr�r�Zklass_resultr�r
r
r�getattr_statics6


r��GEN_CREATED�GEN_RUNNING�
GEN_SUSPENDED�
GEN_CLOSEDcCs,|jr
tS|jdkrtS|jjdkr(tStS)a#Get current state of a generator-iterator.

    Possible states are:
      GEN_CREATED: Waiting to start execution.
      GEN_RUNNING: Currently being executed by the interpreter.
      GEN_SUSPENDED: Currently suspended at a yield expression.
      GEN_CLOSED: Execution has completed.
    Nrr~)�
gi_runningr��gi_framer��f_lastir�r�)�	generatorr
r
r�getgeneratorstateGs	
r�cCs:t|�stdj|���t|dd�}|dk	r2|jjSiSdS)z�
    Get the mapping of generator local variables to their current values.

    A dict is returned, with the keys the local variable names and values the
    bound values.z '{!r}' is not a Python generatorr�N)r)r�rurBr�r5)r�r6r
r
r�getgeneratorlocalsYsr��CORO_CREATED�CORO_RUNNING�CORO_SUSPENDED�CORO_CLOSEDcCs,|jr
tS|jdkrtS|jjdkr(tStS)a&Get current state of a coroutine object.

    Possible states are:
      CORO_CREATED: Waiting to start execution.
      CORO_RUNNING: Currently being executed by the interpreter.
      CORO_SUSPENDED: Currently suspended at an await expression.
      CORO_CLOSED: Execution has completed.
    Nrr~)�
cr_runningr��cr_framer�r�r�r�)�	coroutiner
r
r�getcoroutinestateqs	
r�cCs"t|dd�}|dk	r|jSiSdS)z�
    Get the mapping of coroutine local variables to their current values.

    A dict is returned, with the keys the local variable names and values the
    bound values.r�N)rBr5)r�r6r
r
r�getcoroutinelocals�sr��
from_bytescCs6yt||�}Wntk
r"dSXt|t�s2|SdS)z�Private helper. Checks if ``cls`` has an attribute
    named ``method_name`` and returns it only if it is a
    pure python function.
    N)rBrOr	�_NonUserDefinedCallables)r[Zmethod_name�methr
r
r�"_signature_get_user_defined_method�s
r�cCs�|j}t|j��}|jpf}|jp$i}|r2||}y|j||�}Wn6tk
rx}zdj|�}	t|	�|�WYdd}~XnXd}
�x|j�D�]\}}y|j	|}
Wnt
k
r�YnlX|jtkr�|j
|�q�|jtk�r||kr�d}
|j|
d�||<n|j
|j�q�|jtk�r"|j|
d�||<|
r�|jtk	�s6t�|jtk�rf||jtd�}|||<|j|�q�|jttfk�r�|j|�q�|jtkr�|j
|j�q�W|j|j�d�S)z�Private helper to calculate how 'wrapped_sig' signature will
    look like after applying a 'functools.partial' object (or alike)
    on it.
    z+partial object {!r} has incorrect argumentsNFT)r*)ri)r&)r&rrAr�keywords�bind_partialr�rurt�	argumentsrgrir(r�r)r9rDr,�AssertionError�move_to_endr-r+r')�wrapped_sig�partialZ
extra_argsZ
old_params�
new_paramsZpartial_argsZpartial_keywordsZbar0rTZtransform_to_kwonly�
param_namer3Z	arg_valueZ	new_paramr
r
r�_signature_get_partial�sN






r�cCsnt|jj��}|s&|djttfkr.td��|dj}|ttfkrR|dd�}n|t	k	rbtd��|j
|d�S)zWPrivate helper to transform signatures for unbound
    functions to bound methods.
    rzinvalid method signaturerNzinvalid argument type)r&)rar&r'rir-r,rtr)r(r+r9)r/�paramsrir
r
r�_signature_bound_method�s
r�cCs&t|�p$t|�p$t|t�p$|ttfkS)zxPrivate helper to test if `obj` is a callable that might
    support Argument Clinic's __text_signature__ protocol.
    )r8rr	r�rr)rhr
r
r�_signature_is_builtins
r�cCs�t|�st|�rdSt|dd�}t|dd�}t|dt�}t|dt�}t|dd�}t|tj�o�t|t�o�|dkszt|t�o�|dks�t|t	�o�t|t	�S)z�Private helper to test if `obj` is a duck type of FunctionType.
    A good example of such objects are functions compiled with
    Cython, which have all attributes that a pure Python function
    would have, but have their code statically compiled.
    Fr�Nr!�__defaults__�__kwdefaults__�__annotations__)
�callablerrB�_voidr	r
r5r�rar�)rhrDrhrr2r1r
r
r�_signature_is_functionlike!s
r�cCsr|jd�st�|jd�}|dkr*|jd�}|jd�}|d	ksH||ksHt�|jd�}|d
ksf||ksft�|d|�S)z� Private helper to get first parameter name from a
    __text_signature__ of a builtin method, which should
    be in the following format: '($param1, ...)'.
    Assumptions are that the first argument won't have
    a default value or an annotation.
    z($�,rr��:r>r�r~r~r~)r�r��find)rHrPZcposr
r
r�_signature_get_bound_param:s



r�cCsl|s|ddfSd}d}dd�|jd�D�}t|�j}tj|�}d}d}g}|j}	d}
tj}tj}t|�}
|
j	tj
ksxt�x�|D]�}
|
j	|
j}}||kr�|dkr�|r�d}q~|s�t�d}|
d	7}
q~|d
kr�|s�t�|dks�t�d}|
d	}q~||k�r|dk�r|dk�st�|
}q~|�r<d}||k�o0|dk�s<|	d
�|	|�|dkr~|	d�q~Wdj
|�}|||fS)a�
    Private helper function. Takes a signature in Argument Clinic's
    extended signature format.

    Returns a tuple of three things:
      * that signature re-rendered in standard Python syntax,
      * the index of the "self" parameter (generally 0), or None if
        the function does not have a "self" parameter, and
      * the index of the last "positional only" parameter,
        or None if the signature has no positional-only parameters.
    NcSsg|]}|jd��qS)�ascii)�encode)rZ�lr
r
rr\dsz6_signature_strip_non_python_syntax.<locals>.<listcomp>r�Frr�Tr�/�$r�z, � r�)r�r�r�r�rNr��OP�
ERRORTOKEN�nextr�ENCODINGr��stringr�)�	signature�self_parameter�last_positional_onlyr�r�Ztoken_streamZ
delayed_commaZskip_next_commar?rPZcurrent_parameterr�r��trr��clean_signaturer
r
r�"_signature_strip_non_python_syntaxQsZ







r�Tcs`|j�t|�\}}}d|d}ytj|�}Wntk
rFd}YnXt|tj�sbtdj|���|j	d}	g��j
�t��d}i�t|dd�}
|
r�t
jj|
d�}|r�|j�t
jj��dd����fd	d
��	G�	fdd�dtj���f�������fd
d�	}t|	jj�}t|	jj�}
tj||
dd�}|dk	�r8�j�n�j�x<ttt|���D](\}\}}|||�||k�rP�j��qPW|	jj�r��j�||	jj���j�x*t|	jj |	jj!�D]\}}|||��q�W|	jj"�r�j#�||	jj"��|dk	�rR��s�t$�t|dd�}|dk	}t%|�}|�r8|�s,|�r8�j&d�n�dj'�jd�}|�d<|�|j
d�S)zdPrivate helper to parse content of '__text_signature__'
    and return a Signature based on it.
    zdef fooz: passNz"{!r} builtin has invalid signaturerr�cSs(t|tj�st�|jdkr"td��|jS)Nz'Annotations are not currently supported)r	�astr@r�r.rt)�noder
r
r�
parse_name�s
z&_signature_fromstr.<locals>.parse_namecs�yt|��}Wn>tk
rLyt|��}Wntk
rFt��YnXYnXt|t�rbtj|�St|ttf�rztj	|�St|t
�r�tj|�S|dkr�tj|�St��dS)NTF)TFN)
�eval�	NameError�RuntimeErrorr	r�r�ZStr�int�floatZNum�bytesZBytesZNameConstant)r�rE)�module_dict�sys_module_dictr
r�
wrap_value�s 





z&_signature_fromstr.<locals>.wrap_valuecs$eZdZ�fdd�Z�fdd�ZdS)z,_signature_fromstr.<locals>.RewriteSymbolicscs`g}|}x"t|tj�r*|j|j�|j}q
Wt|tj�s>t��|j|j�dj	t
|��}�|�S)Nr})r	r�rYrNr�rE�Namer�rpr��reversed)r�r��arVrE)r�r
r�visit_Attribute�s
z<_signature_fromstr.<locals>.RewriteSymbolics.visit_Attributecst|jtj�st���|j�S)N)r	Zctxr�ZLoadrtrp)r�r�)r�r
r�
visit_Name�sz7_signature_fromstr.<locals>.RewriteSymbolics.visit_NameN)r�r�r�r�r�r
)r�r
r�RewriteSymbolics�sr�cs��|�}|�krdS|rp|tk	rpy��j|�}tj|�}Wntk
rR�}YnX|�kr`dS|�k	rl|n|}�j�|�|�d��dS)N)r*r.)�_emptyZvisitr�Zliteral_evalrtrN)Z	name_nodeZdefault_noder*rD�o)�	Parameterr�r%�invalidrir&r�r
r�p�s
z_signature_fromstr.<locals>.p)�	fillvaluer�)ri)r$)(�_parameter_clsr�r��parse�SyntaxErrorr	ZModulertruZbodyr%rrBrqrr�r@�copyZNodeTransformerr�rr�	itertools�zip_longest�POSITIONAL_ONLY�POSITIONAL_OR_KEYWORDrCr�Zvararg�VAR_POSITIONAL�KEYWORD_ONLYrcr	Zkw_defaultsrX�VAR_KEYWORDr�rr�r9)r[rhr�rr�r�r�Zprogramr�rnZmodule_namer�rrr�r�rDr*�_selfZself_isboundZ
self_ismoduler
)
r�r�r%r�rir�r&r�r�r�r�_signature_fromstr�sl









r�cCsBt|�stdj|���t|dd�}|s4tdj|���t||||�S)zHPrivate helper function to get signature for
    builtin callables.
    z%{!r} is not a Python builtin function�__text_signature__Nz#no signature found for builtin {!r})r�r�rurBrtr�)r[rvrr�r
r
r�_signature_from_builtin&sr�cCs�d}t|�s(t|�rd}ntdj|���|j}|j}|j}|j}t|d|��}|j	}||||�}	|j
}
|j}|j}|r�t
|�}
nd}
g}||
}x4|d|�D]$}|
j|t�}|j|||td��q�WxBt||d��D].\}}|
j|t�}|j|||t||d��q�W|jt@�rH|||}|
j|t�}|j|||td��xJ|	D]B}t}|dk	�rl|j|t�}|
j|t�}|j|||t|d���qNW|jt@�r�||}|jt@�r�|d7}||}|
j|t�}|j|||td��|||
jd	t�|d
�S)zCPrivate helper: constructs Signature for the given python function.FTz{!r} is not a Python functionNr)r.ri)r.rir*rr!)r$�__validate_parameters__)rr�r�rur�r!rr
rarr�r�r�rsr�r�rNr)rCr"rr+r,rr-)r[rvZis_duck_functionr�Z	func_codeZ	pos_countZ	arg_namesrMZkeyword_only_countZkeyword_onlyr1rr2Zpos_default_countr&Znon_default_countrDr.�offsetr*rpr
r
r�_signature_from_function6sj










r�)rrc!Cs�t|�stdj|���t|tj�rDt|j|||d�}|r@t|�S|S|rtt	|dd�d�}t|tj�rtt||||d�Sy
|j
}Wntk
r�Yn&X|dk	r�t|t�s�tdj|���|Sy
|j
}Wntk
r�Yn�Xt|tj��rft|j|||d�}t||d�}t|jj��d}|jtjk�r(|St|jj��}|�sP||dk	�sPt�|f|}	|j|	d	�St|��szt|��r�t||�St|��r�t|||d
�St|tj��r�t|j|||d�}t||�Sd}t|t ��r�t!t |�d�}
|
dk	�rt|
|||d�}nJt!|d�}|dk	�r&t||||d�}n$t!|d
�}|dk	�rJt||||d�}|dk�rTxL|j"dd�D]:}
y
|
j#}Wntk
�r�YnX|�rdt$|||�S�qdWt |j"k�rT|j%t&j%k�r�|j't&j'k�r�t(t&�St)dj|���nrt|t*��sTt!t |�d�}
|
dk	�rTyt|
|||d�}Wn8t)k
�rR}zdj|�}t)|�|�WYdd}~XnX|dk	�rp|�rlt|�S|St|tj+��r�dj|�}t)|��t)dj|���dS)zQPrivate helper function to get signature for arbitrary
    callable objects.
    z{!r} is not a callable object)rrr cSs
t|d�S)N�
__signature__)r)rnr
r
rrH�sz*_signature_from_callable.<locals>.<lambda>)rlNz1unexpected object {!r} in __signature__ attributer)r&)r�__call__�__new__r�rz(no signature found for builtin type {!r}zno signature found for {!r}z,no signature found for builtin function {!r}z+callable {!r} is not supported by signature)Nr~),r�r�rur	r
rr"r�r�rxr�rOr#�_partialmethod�	functools�
partialmethodrvr�rar&r'rir�r�r�r9rr�r�r�r�r�rr�rkr�r�r�rr�r�rtr�r7)rhrrr r/r�r�Zfirst_wrapped_paramZ
sig_paramsr�Zcall�newZinitrFZtext_sigr0rTr
r
rr"�s�	



















r"c@seZdZdZdS)r�z1A private marker - used in Parameter & Signature.N)r�r�r�r�r
r
r
rr�P	sr�c@seZdZdZdS)r�z6Marker object for Signature.empty and Parameter.empty.N)r�r�r�r�r
r
r
rr�T	sr�c@s(eZdZdZdZdZdZdZdd�ZdS)	�_ParameterKindrrr���cCs|jS)N)�_name_)r�r
r
r�__str___	sz_ParameterKind.__str__N)	r�r�r�r�r�r�r�r�rr
r
r
rr�X	sr�zpositional-onlyzpositional or keywordzvariadic positionalzkeyword-onlyzvariadic keywordc@s�eZdZdZd!ZeZeZe	Z
eZe
ZeZeed�dd�Zd	d
�Zdd�Zed
d��Zedd��Zedd��Zedd��Zeeeed�dd�Zdd�Zdd�Zdd�Zdd�Zd S)"r�aRepresents a parameter in a function signature.

    Has the following public attributes:

    * name : str
        The name of the parameter as a string.
    * default : object
        The default value for the parameter if specified.  If the
        parameter has no default value, this attribute is set to
        `Parameter.empty`.
    * annotation
        The annotation for the parameter if specified.  If the
        parameter has no annotation, this attribute is set to
        `Parameter.empty`.
    * kind : str
        Describes how argument values are bound to the parameter.
        Possible values: `Parameter.POSITIONAL_ONLY`,
        `Parameter.POSITIONAL_OR_KEYWORD`, `Parameter.VAR_POSITIONAL`,
        `Parameter.KEYWORD_ONLY`, `Parameter.VAR_KEYWORD`.
    �_name�_kind�_default�_annotation)r*r.cCs"yt|�|_Wn$tk
r2td|�d���YnX|tk	rf|jttfkrfd}|jt|j��}t|��||_||_	|tkr�td��t
|t�s�djt|�j
�}t|��|ddko�|dd�j��r|jtkr�d	}|jt|j��}t|��t|_d
j|dd��}|j��stdj|���||_dS)Nzvalue z is not a valid Parameter.kindz({} parameters cannot have default valuesz*name is a required attribute for Parameterzname must be a str, not a {}rr}rzLimplicit arguments must be passed as positional or keyword arguments, not {}z
implicit{}z"{!r} is not a valid parameter name)r�rrtr�r+r-ru�_get_paramkind_descrrrr	r�rr�r��isdigitr)r(�isidentifierr)r�rDrir*r.rTr
r
rr��	s4


zParameter.__init__cCs t|�|j|jf|j|jd�fS)N)rr)rrrrr)r�r
r
r�
__reduce__�	s
zParameter.__reduce__cCs|d|_|d|_dS)Nrr)rr)r��stater
r
r�__setstate__�	s
zParameter.__setstate__cCs|jS)N)r)r�r
r
rrD�	szParameter.namecCs|jS)N)r)r�r
r
rr*�	szParameter.defaultcCs|jS)N)r)r�r
r
rr.�	szParameter.annotationcCs|jS)N)r)r�r
r
rri�	szParameter.kind)rDrir.r*cCsL|tkr|j}|tkr|j}|tkr*|j}|tkr8|j}t|�||||d�S)z+Creates a customized copy of the Parameter.)r*r.)r�rrrrr)r�rDrir.r*r
r
rr9�	szParameter.replacecCsj|j}|j}|jtk	r(dj|t|j��}|jtk	rDdj|t|j��}|tkrVd|}n|t	krfd|}|S)Nz{}:{}z{}={}r=z**)
rirrr�rur:rr8r+r-)r�ri�	formattedr
r
rr�	s


zParameter.__str__cCsdj|jj|�S)Nz	<{} "{}">)rur�r�)r�r
r
r�__repr__�	szParameter.__repr__cCst|j|j|j|jf�S)N)�hashrDrir.r*)r�r
r
r�__hash__�	szParameter.__hash__cCsJ||krdSt|t�stS|j|jkoH|j|jkoH|j|jkoH|j|jkS)NT)r	r��NotImplementedrrrr)r��otherr
r
r�__eq__
s
zParameter.__eq__N)rrrr)r�r�r�r��	__slots__r(r�r)r�r+r�r,r�r-r�r�r%r�r	rr^rDr*r.rir�r9rr
rrr
r
r
rr�t	s*(r�c@sheZdZdZdZdd�Zedd��Zed	d
��Zedd��Z	d
d�Z
dd�Zdd�Zdd�Z
dd�ZdS)�BoundArgumentsaResult of `Signature.bind` call.  Holds the mapping of arguments
    to the function's parameters.

    Has the following public attributes:

    * arguments : OrderedDict
        An ordered mutable mapping of parameters' names to arguments' values.
        Does not contain arguments' default values.
    * signature : Signature
        The Signature object that created this instance.
    * args : tuple
        Tuple of positional arguments values.
    * kwargs : dict
        Dict of keyword arguments values.
    r��
_signature�__weakref__cCs||_||_dS)N)r�r)r�r�r�r
r
rr�
szBoundArguments.__init__cCs|jS)N)r)r�r
r
rr�#
szBoundArguments.signaturecCs|g}xn|jjj�D]^\}}|jttfkr*Py|j|}Wntk
rNPYqX|jtkrf|j	|�q|j
|�qWt|�S)N)rr&rArir-r,r�rgr+�extendrNra)r�rr�r3r@r
r
rr'
s
zBoundArguments.argscCs�i}d}x�|jjj�D]x\}}|sF|jttfkr6d}n||jkrFd}q|sLqy|j|}Wntk
rnYqX|jtkr�|j|�q|||<qW|S)NFT)	rr&rArir-r,r�rg�update)r��kwargsZkwargs_startedr�r3r@r
r
rr>
s&

zBoundArguments.kwargscCs�|j}g}x�|jjj�D]v\}}y|j|||f�Wqtk
r�|jtk	rX|j}n"|jt	krhf}n|jt
krxi}nw|j||f�YqXqWt|�|_dS)z�Set default values for missing arguments.

        For variable-positional arguments (*args) the default is an
        empty tuple.

        For variable-keyword arguments (**kwargs) the default is an
        empty dict.
        N)r�rr&rArNrgr*r�rir+r-r)r�r�Z
new_argumentsrDr3�valr
r
r�apply_defaults\
s	


zBoundArguments.apply_defaultscCs2||krdSt|t�stS|j|jko0|j|jkS)NT)r	rrr�r�)r�rr
r
rrx
s
zBoundArguments.__eq__cCs|d|_|d|_dS)Nrr�)rr�)r�r
r
r
rr�
s
zBoundArguments.__setstate__cCs|j|jd�S)N)rr�)rr�)r�r
r
r�__getstate__�
szBoundArguments.__getstate__cCsDg}x(|jj�D]\}}|jdj||��qWdj|jjdj|��S)Nz{}={!r}z	<{} ({})>z, )r�rArNrur�r�r�)r�rr@rEr
r
rr
�
szBoundArguments.__repr__N)r�rr)r�r�r�r�rr�r^r�rrrrrrr
r
r
r
rr
src@s�eZdZdZd-ZeZeZe	Z
d.e	dd�dd�Zed	d
��Z
edd��Zedd
�dd��Zedd��Zedd��Zeed�dd�Zdd�Zdd�Zdd�Zdd�dd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�ZdS)/r#aA Signature object represents the overall signature of a function.
    It stores a Parameter object for each parameter accepted by the
    function, as well as information specific to the function itself.

    A Signature object has the following public attributes and methods:

    * parameters : OrderedDict
        An ordered mapping of parameters' names to the corresponding
        Parameter objects (keyword-only arguments are in the same order
        as listed in `code.co_varnames`).
    * return_annotation : object
        The annotation for the return type of the function if specified.
        If the function has no annotation for its return type, this
        attribute is set to `Signature.empty`.
    * bind(*args, **kwargs) -> BoundArguments
        Creates a mapping from positional and keyword arguments to
        parameters.
    * bind_partial(*args, **kwargs) -> BoundArguments
        Creates a partial mapping from positional and keyword arguments
        to parameters (simulating 'functools.partial' behavior.)
    �_return_annotation�_parametersNT)r$r�cCs�|dkrt�}n�|r�t�}t}d}x�t|�D]�\}}|j}	|j}
|	|krjd}|jt|�t|	��}t|��n|	|krzd}|	}|	ttfkr�|j	t
kr�|r�d}t|��nd}|
|kr�dj|
�}t|��|||
<q,Wntdd�|D��}tj|�|_
||_dS)	z�Constructs Signature from the given list of Parameter
        objects and 'return_annotation'.  All arguments are optional.
        NFz7wrong parameter order: {} parameter before {} parameterz-non-default argument follows default argumentTzduplicate parameter name: {!r}css|]}|j|fVqdS)N)rD)rZr3r
r
rr��
sz%Signature.__init__.<locals>.<genexpr>)rr(rCrirDrurrtr)r*r�r
�MappingProxyTyperr)r�r&r$r�r�Ztop_kindZ
kind_defaults�idxr3rirDrTr
r
rr��
s>






zSignature.__init__cCstjdtdd�t||�S)z�Constructs Signature for the given python function.

        Deprecated since Python 3.5, use `Signature.from_callable()`.
        z_inspect.Signature.from_function() is deprecated since Python 3.5, use Signature.from_callable()r�)r)rrrr�)r[rvr
r
r�
from_function�
s
zSignature.from_functioncCstjdtdd�t||�S)z�Constructs Signature for the given builtin function.

        Deprecated since Python 3.5, use `Signature.from_callable()`.
        z^inspect.Signature.from_builtin() is deprecated since Python 3.5, use Signature.from_callable()r�)r)rrrr�)r[rvr
r
r�from_builtin�
s
zSignature.from_builtin)�follow_wrappedcCst|||d�S)z3Constructs Signature for the given callable object.)r r)r")r[rhr#r
r
r�
from_callable�
szSignature.from_callablecCs|jS)N)r)r�r
r
rr&szSignature.parameterscCs|jS)N)r)r�r
r
rr$szSignature.return_annotation)r&r$cCs0|tkr|jj�}|tkr |j}t|�||d�S)z�Creates a customized copy of the Signature.
        Pass 'parameters' and/or 'return_annotation' arguments
        to override them in the new copy.
        )r$)r�r&r'rr)r�r&r$r
r
rr9	s
zSignature.replacecCs8tdd�|jj�D��}dd�|jj�D�}|||jfS)Ncss|]}|jtkr|VqdS)N)rir,)rZr3r
r
rr�sz(Signature._hash_basis.<locals>.<genexpr>cSsi|]}|jtkr||j�qSr
)rir,rD)rZr3r
r
rr]sz)Signature._hash_basis.<locals>.<dictcomp>)rar&r'r$)r�r��
kwo_paramsr
r
r�_hash_basisszSignature._hash_basiscCs(|j�\}}}t|j��}t|||f�S)N)r&�	frozensetr'r)r�r�r%r$r
r
rr!szSignature.__hash__cCs*||krdSt|t�stS|j�|j�kS)NT)r	r#rr&)r�rr
r
rr&s

zSignature.__eq__F)r�cCs�t�}t|jj��}f}t|�}�xxyt|�}Wn�tk
r�yt|�}	Wntk
rbPYn�X|	jtkrrPn�|	j|kr�|	jt	kr�d}
|
j
|	jd�}
t|
�d�|	f}PnH|	jtks�|	j
tk	r�|	f}Pn*|r�|	f}Pnd}
|
j
|	jd�}
t|
�d�Yq$Xyt|�}	Wn tk
�r&td�d�Yq$X|	jttfk�rBtd�d�|	jtk�rn|g}|j|�t|�||	j<P|	j|k�r�tdj
|	jd��d�|||	j<q$Wd}x�tj||�D]�}	|	jtk�r�|	}�q�|	jtk�r֐q�|	j}
y|j|
�}WnHtk
�r2|�r.|	jtk�r.|	j
tk�r.tdj
|
d��d�Yn(X|	jt	k�rRtdj
|	jd���|||
<�q�W|�r�|dk	�r||||j<ntdj
tt|��d���|j||�S)z#Private method. Don't use directly.zA{arg!r} parameter is positional only, but was passed as a keyword)r@Nz$missing a required argument: {arg!r}ztoo many positional argumentsz$multiple values for argument {arg!r}z*got an unexpected keyword argument {arg!r})rr�r&r'r��
StopIterationrir+rDr(rur�r-r*r�r,rrar��chainr�rg�_bound_arguments_cls)r�rrr�r�r&Z
parameters_exZarg_valsZarg_valr3rTr'Zkwargs_paramr�r
r
r�_bind-s�







zSignature._bindcOs|dj|dd�|�S)z�Get a BoundArguments object, that maps the passed `args`
        and `kwargs` to the function's signature.  Raises `TypeError`
        if the passed arguments can not be bound.
        rrN)r+)rrr
r
r�bind�szSignature.bindcOs|dj|dd�|dd�S)z�Get a BoundArguments object, that partially maps the
        passed `args` and `kwargs` to the function's signature.
        Raises `TypeError` if the passed arguments can not be bound.
        rrNT)r�)r+)rrr
r
rr��szSignature.bind_partialcCs t|�t|jj��fd|jifS)Nr)rrarr'r)r�r
r
rr	�szSignature.__reduce__cCs|d|_dS)Nr)r)r�r
r
r
rr�szSignature.__setstate__cCsdj|jj|�S)Nz<{} {}>)rur�r�)r�r
r
rr
�szSignature.__repr__c	Cs�g}d}d}xr|jj�D]d}t|�}|j}|tkr8d}n|rJ|jd�d}|tkrXd}n|tkrr|rr|jd�d}|j|�qW|r�|jd�djdj	|��}|j
tk	r�t|j
�}|dj|�7}|S)NFTr�r=z({})z, z -> {})
r&r'r�rir(rNr+r,rur�r$r�r:)	r�rfZrender_pos_only_separatorZrender_kw_only_separatorr3rriZrenderedZannor
r
rr�s0




zSignature.__str__)rr)N)r�r�r�r�rr�r�rr*r�r%r�rer!r"r$r^r&r$r�r9r&rrr+r,r�r	rr
rr
r
r
rr#�
s26	r#)r#cCstj||d�S)z/Get a signature object for the passed callable.)r#)r#r$)rhr#r
r
rr��sr�cCs�ddl}ddl}|j�}|jddd�|jdddd	d
�|j�}|j}|jd�\}}}y|j|�}}	WnLtk
r�}
z0dj	|t
|
�j|
�}t|t
jd
�td�WYdd}
~
XnX|r�|jd�}|	}x|D]}
t||
�}q�W|	jt
jk�rtdt
jd
�td�|j�r�tdj	|��tdj	t|	���tdj	|	j��||	k�rxtdj	t|	j���t|	d��r�tdj	|	j��n6yt|�\}}Wntk
�r�YnXtdj	|��td�ntt|��dS)z6 Logic for inspecting an object given at command line rNrzCThe object to be analysed. It supports the 'module:qualname' syntax)�helpz-dz	--details�
store_truez9Display info about the module rather than its source code)�actionr-r�zFailed to import {} ({}: {}))r�r�r}z#Can't get info for builtin modules.rz
Target: {}z
Origin: {}z
Cached: {}z
Loader: {}�__path__zSubmodule search path: {}zLine: {}r�)�argparser��ArgumentParser�add_argument�
parse_argsr�	partition�
import_modulerbrurr��printrq�stderr�exitr�rB�builtin_module_namesZdetailsr��
__cached__r8r�rr0r�r�)r1r��parserr�targetZmod_nameZ	has_attrsZattrsrhr�rgrT�parts�part�__ror
r
r�_main�sV



rAr�)rri)N)N)N)F)N)r)r6)r)r)r)r)T)T)�r��
__author__r.r�Zdis�collections.abcr-�enum�importlib.machineryr�r�r�r�r�rqr�r�r
rr�r��operatorrrr�globalsZmod_dictZCOMPILER_FLAG_NAMESrArVrWr=rrrrrrrrrr#r$r%r'r)r+r0r2r4r6r8r9rGrXrYrjrJrxr|r�r�r�r�r�r�r�r�r�r�r�r�r�rbr�r�r�r�r�r�rrrrrrrrr4r7r:r<r�rIrLrSrUrYrZrirjrqrr�_fieldsrsrwrzr|r}rrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�Z_WrapperDescriptor�allZ_MethodWrapperr�r@Z_ClassMethodWrapperr7r�r�r�r�r�r�r�r�r�r�r�r"r�r��IntEnumr�r�r(r�r)r�r+r�r,r�r-Z_PARAM_NAME_MAPPING�__getitem__rr�rr#r�rAr�r
r
r
r�<module>sf	



	
	
,
t$
;
	
.I-7





[


	(>
5

 


		0

LHRHk:
stat.cpython-36.opt-2.pyc000064400000006147150335715140011121 0ustar003


 \��
@sdZdZdZdZdZdZdZdZdZd	Z	d
d�Z
dd
�ZdZdZ
dZdZdZdZdZdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#Zd$ZeZd%Zd&Zd'Zd(Z d)Z!d&Z"d'Z#d(Z$d*Z%d+Z&d,Z'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0d,Z1d+Z2dZ3d-Z4d.Z5d/Z6d0Z7d1Z8ed2fed3fed4fed5fe
d6fed7ffe"d8ffe#d9ffe$eBd:fed;fe$d<ffe&d8ffe'd9ffe(eBd:fed;fe(d<ffe*d8ffe+d9ffe,eBd=fed>fe,d<fff
Z9d?d@�Z:d+Z;d#Z<d(Z=d,Z>dZ?dZ@dZAd'ZBdZCd.ZDdZEdZFd$ZGd%ZHdZId&ZJd-ZKyddAlLTWneMk
�rYnXdBS)C����������	cCs|d@S)Ni��)�moderr�/usr/lib64/python3.6/stat.py�S_IMODEsrcCs|d@S)Ni�r)rrrr
�S_IFMTsri@i i`i�ii�i�cCst|�tkS)N)r�S_IFDIR)rrrr
�S_ISDIR.srcCst|�tkS)N)r�S_IFCHR)rrrr
�S_ISCHR2srcCst|�tkS)N)r�S_IFBLK)rrrr
�S_ISBLK6srcCst|�tkS)N)r�S_IFREG)rrrr
�S_ISREG:srcCst|�tkS)N)r�S_IFIFO)rrrr
�S_ISFIFO>srcCst|�tkS)N)r�S_IFLNK)rrrr
�S_ISLNKBsrcCst|�tkS)N)r�S_IFSOCK)rrrr
�S_ISSOCKFsriii���@i��8� �iiiii �l�-�b�d�c�p�r�w�s�S�x�t�TcCsPg}x@tD]8}x2|D] \}}||@|kr|j|�PqW|jd�q
Wdj|�S)Nr%�)�_filemode_table�append�join)rZperm�table�bit�charrrr
�filemode�s

r8)�*N)N�ST_MODE�ST_INO�ST_DEV�ST_NLINK�ST_UID�ST_GID�ST_SIZE�ST_ATIME�ST_MTIME�ST_CTIMErrrrrrrrrrrrrrrr�S_ISUID�S_ISGID�S_ENFMT�S_ISVTX�S_IREAD�S_IWRITE�S_IEXEC�S_IRWXU�S_IRUSR�S_IWUSR�S_IXUSR�S_IRWXG�S_IRGRP�S_IWGRP�S_IXGRP�S_IRWXO�S_IROTH�S_IWOTH�S_IXOTH�	UF_NODUMP�UF_IMMUTABLE�	UF_APPEND�	UF_OPAQUE�UF_NOUNLINK�
UF_COMPRESSED�	UF_HIDDEN�SF_ARCHIVED�SF_IMMUTABLE�	SF_APPEND�SF_NOUNLINK�SF_SNAPSHOTr2r8�FILE_ATTRIBUTE_ARCHIVE�FILE_ATTRIBUTE_COMPRESSED�FILE_ATTRIBUTE_DEVICE�FILE_ATTRIBUTE_DIRECTORY�FILE_ATTRIBUTE_ENCRYPTED�FILE_ATTRIBUTE_HIDDEN�FILE_ATTRIBUTE_INTEGRITY_STREAM�FILE_ATTRIBUTE_NORMAL�"FILE_ATTRIBUTE_NOT_CONTENT_INDEXED�FILE_ATTRIBUTE_NO_SCRUB_DATA�FILE_ATTRIBUTE_OFFLINE�FILE_ATTRIBUTE_READONLY�FILE_ATTRIBUTE_REPARSE_POINT�FILE_ATTRIBUTE_SPARSE_FILE�FILE_ATTRIBUTE_SYSTEM�FILE_ATTRIBUTE_TEMPORARY�FILE_ATTRIBUTE_VIRTUAL�_stat�ImportErrorrrrr
�<module>s�	


inspect.cpython-36.opt-1.pyc000064400000233121150335715140011604 0ustar003


 \���@s�dZd�ZddlZddlZddlZddlZddlZddlZ	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlmZddlmZmZe�Zx"ejj�D]\ZZeede<q�Wd�Zd
d�Z dd
�Z!dd�Z"dd�Z#dd�Z$e%ed��rdd�Z&ndd�Z&e%ed��r6dd�Z'ndd�Z'dd�Z(dd�Z)d d!�Z*d"d#�Z+d$d%�Z,d&d'�Z-d(d)�Z.d*d+�Z/d,d-�Z0d.d/�Z1d0d1�Z2d2d3�Z3d4d5�Z4d6d7�Z5d�d8d9�Z6ed:d;�Z7d<d=�Z8d>d?�Z9dd@�dAdB�Z:dCdD�Z;dEdF�Z<dGdH�Z=dIdJ�Z>dKdL�Z?dMdN�Z@dOdP�ZAdQdR�ZBd�dSdT�ZCiZDiZEd�dUdV�ZFdWdX�ZGdYdZ�ZHGd[d\�d\eI�ZJGd]d^�d^�ZKd_d`�ZLdadb�ZMdcdd�ZNdedf�ZOd�dhdi�ZPedjdk�ZQdldm�ZRdndo�ZSedpdq�ZTdrds�ZUedtdu�ZVdvdw�ZWedxdy�ZXdzd{�ZYd�d|d}�ZZd~d�Z[dddfiie\d�d��d�d��d�d��d�d��eZfd�d��Z]e\d�d��d�d��d�d��fd�d��Z^d�d��Z_d�d��Z`d�d��Zaed�d��Zbd�d��Zced�d��Zdd�d�d��Zed�d��Zfed�d�edjg�Zhd�d�d��Zid�d�d��Zjd�d��Zkd�d�d��Zl�dd�d��Zmen�Zod�d��Zpd�d��Zqd�d��Zrd�d��Zsd�d��Zteofd�d��Zud�Zvd�Zwd�Zxd�Zyd�d��Zzd�d��Z{d�Z|d�Z}d�Z~d�Zd�d��Z�d�dÄZ�e�e�j��Z�e�e�j��Z�e�e�j�d��Z�e�e�e�ej�fZ�d�dƄZ�ffd�dȄZ�d�dʄZ�d�d̄Z�d�d΄Z�d�dЄZ�d�d҄Z��dd�dՄZ��dd�dׄZ�d�dلZ�d�d�dڜd�d܄Z�Gd�dބdރZ�Gd�d�d�Z�Gd�d�d�ej��Z�e�j�Z�e�j�Z�e�j�Z�e�j�Z�e�j�Z�e�d�e�d�e�d�e�d�e�d�iZ�e�j�Z�Gd�d�d�Z�Gd�d�d�Z�Gd�d�d�Z�d�d�d�d�Z�d�d�Z�e�d�k�r�e��dS(aGet useful information from live Python objects.

This module encapsulates the interface provided by the internal special
attributes (co_*, im_*, tb_*, etc.) in a friendlier fashion.
It also provides some help for examining source code and class layout.

Here are some of the useful functions provided by this module:

    ismodule(), isclass(), ismethod(), isfunction(), isgeneratorfunction(),
        isgenerator(), istraceback(), isframe(), iscode(), isbuiltin(),
        isroutine() - check object types
    getmembers() - get members of an object that satisfy a given condition

    getfile(), getsourcefile(), getsource() - find an object's source code
    getdoc(), getcomments() - get documentation on an object
    getmodule() - determine the module that an object came from
    getclasstree() - arrange classes so as to represent their hierarchy

    getargvalues(), getcallargs() - get info about function arguments
    getfullargspec() - same, with support for Python 3 features
    formatargspec(), formatargvalues() - format an argument spec
    getouterframes(), getinnerframes() - get info about frames
    currentframe() - get the current stack frame
    stack(), trace() - get info about frames on the stack or in a traceback

    signature() - get a Signature object for the callable
�Ka-Ping Yee <ping@lfw.org>�'Yury Selivanov <yselivanov@sprymix.com>�N)�
attrgetter)�
namedtuple�OrderedDictZCO_��cCst|tj�S)z�Return true if the object is a module.

    Module objects provide these attributes:
        __cached__      pathname to byte compiled file
        __doc__         documentation string
        __file__        filename (missing for built-in modules))�
isinstance�types�
ModuleType)�object�r
�/usr/lib64/python3.6/inspect.py�ismodule@srcCs
t|t�S)z�Return true if the object is a class.

    Class objects provide these attributes:
        __doc__         documentation string
        __module__      name of module in which this class was defined)r	�type)rr
r
r�isclassIsrcCst|tj�S)a_Return true if the object is an instance method.

    Instance method objects provide these attributes:
        __doc__         documentation string
        __name__        name with which this method was defined
        __func__        function object containing implementation of method
        __self__        instance to which this method is bound)r	r
�
MethodType)rr
r
r�ismethodQsrcCs:t|�st|�st|�rdSt|�}t|d�o8t|d�S)a�Return true if the object is a method descriptor.

    But not if ismethod() or isclass() or isfunction() are true.

    This is new in Python 2.2, and, for example, is true of int.__add__.
    An object passing this test has a __get__ attribute but not a __set__
    attribute, but beyond that the set of attributes varies.  __name__ is
    usually sensible, and __doc__ often is.

    Methods implemented via descriptors that also pass one of the other
    tests return false from the ismethoddescriptor() test, simply because
    the other tests promise more -- you can, e.g., count on having the
    __func__ attribute (etc) when an object passes ismethod().F�__get__�__set__)rr�
isfunctionr�hasattr)r�tpr
r
r�ismethoddescriptor[srcCs8t|�st|�st|�rdSt|�}t|d�o6t|d�S)a�Return true if the object is a data descriptor.

    Data descriptors have both a __get__ and a __set__ attribute.  Examples are
    properties (defined in Python) and getsets and members (defined in C).
    Typically, data descriptors will also have __name__ and __doc__ attributes
    (properties, getsets, and members have both of these attributes), but this
    is not guaranteed.Frr)rrrrr)rrr
r
r�isdatadescriptorosr�MemberDescriptorTypecCst|tj�S)z�Return true if the object is a member descriptor.

        Member descriptors are specialized descriptors defined in extension
        modules.)r	r
r)rr
r
r�ismemberdescriptorsrcCsdS)z�Return true if the object is a member descriptor.

        Member descriptors are specialized descriptors defined in extension
        modules.Fr
)rr
r
rr�s�GetSetDescriptorTypecCst|tj�S)z�Return true if the object is a getset descriptor.

        getset descriptors are specialized descriptors defined in extension
        modules.)r	r
r)rr
r
r�isgetsetdescriptor�srcCsdS)z�Return true if the object is a getset descriptor.

        getset descriptors are specialized descriptors defined in extension
        modules.Fr
)rr
r
rr�scCst|tj�S)a(Return true if the object is a user-defined function.

    Function objects provide these attributes:
        __doc__         documentation string
        __name__        name with which this function was defined
        __code__        code object containing compiled function bytecode
        __defaults__    tuple of any default values for arguments
        __globals__     global namespace in which this function was defined
        __annotations__ dict of parameter annotations
        __kwdefaults__  dict of keyword only parameters with defaults)r	r
�FunctionType)rr
r
rr�srcCs tt|�st|�o|jjt@�S)z�Return true if the object is a user-defined generator function.

    Generator function objects provide the same attributes as functions.
    See help(isfunction) for a list of attributes.)�boolrr�__code__�co_flagsZCO_GENERATOR)rr
r
r�isgeneratorfunction�sr#cCs tt|�st|�o|jjt@�S)zuReturn true if the object is a coroutine function.

    Coroutine functions are defined with "async def" syntax.
    )r rrr!r"ZCO_COROUTINE)rr
r
r�iscoroutinefunction�sr$cCs tt|�st|�o|jjt@�S)z�Return true if the object is an asynchronous generator function.

    Asynchronous generator functions are defined with "async def"
    syntax and have "yield" expressions in their body.
    )r rrr!r"ZCO_ASYNC_GENERATOR)rr
r
r�isasyncgenfunction�sr%cCst|tj�S)z7Return true if the object is an asynchronous generator.)r	r
�AsyncGeneratorType)rr
r
r�
isasyncgen�sr'cCst|tj�S)aReturn true if the object is a generator.

    Generator objects provide these attributes:
        __iter__        defined to support iteration over container
        close           raises a new GeneratorExit exception inside the
                        generator to terminate the iteration
        gi_code         code object
        gi_frame        frame object or possibly None once the generator has
                        been exhausted
        gi_running      set to 1 when generator is executing, 0 otherwise
        next            return the next item from the container
        send            resumes the generator and "sends" a value that becomes
                        the result of the current yield-expression
        throw           used to raise an exception inside the generator)r	r
�
GeneratorType)rr
r
r�isgenerator�sr)cCst|tj�S)z)Return true if the object is a coroutine.)r	r
�
CoroutineType)rr
r
r�iscoroutine�sr+cCs6t|tj�p4t|tj�r(t|jjt@�p4t|tj	j
�S)z?Return true if object can be passed to an ``await`` expression.)r	r
r*r(r �gi_coder"ZCO_ITERABLE_COROUTINE�collections�abc�	Awaitable)rr
r
r�isawaitable�sr0cCst|tj�S)abReturn true if the object is a traceback.

    Traceback objects provide these attributes:
        tb_frame        frame object at this level
        tb_lasti        index of last attempted instruction in bytecode
        tb_lineno       current line number in Python source code
        tb_next         next inner traceback object (called by this level))r	r
�
TracebackType)rr
r
r�istraceback�sr2cCst|tj�S)a`Return true if the object is a frame object.

    Frame objects provide these attributes:
        f_back          next outer frame object (this frame's caller)
        f_builtins      built-in namespace seen by this frame
        f_code          code object being executed in this frame
        f_globals       global namespace seen by this frame
        f_lasti         index of last attempted instruction in bytecode
        f_lineno        current line number in Python source code
        f_locals        local namespace seen by this frame
        f_trace         tracing function for this frame, or None)r	r
�	FrameType)rr
r
r�isframe�sr4cCst|tj�S)aEReturn true if the object is a code object.

    Code objects provide these attributes:
        co_argcount         number of arguments (not including *, ** args
                            or keyword only arguments)
        co_code             string of raw compiled bytecode
        co_cellvars         tuple of names of cell variables
        co_consts           tuple of constants used in the bytecode
        co_filename         name of file in which this code object was created
        co_firstlineno      number of first line in Python source code
        co_flags            bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg
                            | 16=nested | 32=generator | 64=nofree | 128=coroutine
                            | 256=iterable_coroutine | 512=async_generator
        co_freevars         tuple of names of free variables
        co_kwonlyargcount   number of keyword only arguments (not including ** arg)
        co_lnotab           encoded mapping of line numbers to bytecode indices
        co_name             name with which this code object was defined
        co_names            tuple of names of local variables
        co_nlocals          number of local variables
        co_stacksize        virtual machine stack space required
        co_varnames         tuple of names of arguments and local variables)r	r
�CodeType)rr
r
r�iscode�sr6cCst|tj�S)a,Return true if the object is a built-in function or method.

    Built-in functions and methods provide these attributes:
        __doc__         documentation string
        __name__        original name of this function or method
        __self__        instance to which a method is bound, or None)r	r
�BuiltinFunctionType)rr
r
r�	isbuiltinsr8cCs t|�pt|�pt|�pt|�S)z<Return true if the object is any kind of function or method.)r8rrr)rr
r
r�	isroutinesr9cCs�t|t�sdS|jt@rdStt|�tj�s0dSt|d�r>dSx&|jj	�D]\}}t
|dd�rJdSqJWx@|jD]6}x0t
|df�D] }t
||d�}t
|dd�r�dSq�WqnWdS)z:Return true if the object is an abstract base class (ABC).FT�__abstractmethods__�__isabstractmethod__N)r	r�	__flags__�TPFLAGS_IS_ABSTRACT�
issubclassr.�ABCMetar�__dict__�items�getattr�	__bases__)r�name�value�baser
r
r�
isabstract%s"


rGcCs&t|�r|ft|�}nf}g}t�}t|�}yBx<|jD]2}x,|jj�D]\}}t|tj	�rH|j
|�qHWq8WWntk
r�YnXx�|D]�}	yt||	�}
|	|kr�t�Wn:tk
r�x$|D]}|	|jkr�|j|	}
Pq�Ww�YnX|s�||
��r|j
|	|
f�|j
|	�q�W|jdd�d�|S)z�Return all members of an object as (name, value) pairs sorted by name.
    Optionally, only return members that satisfy a given predicate.cSs|dS)Nrr
)Zpairr
r
r�<lambda>fszgetmembers.<locals>.<lambda>)�key)r�getmro�set�dirrCr@rAr	r
�DynamicClassAttribute�append�AttributeErrorrB�add�sort)rZ	predicate�mro�results�	processed�namesrF�k�vrIrEr
r
r�
getmembers=s:




rX�	Attributezname kind defining_class objectcCs\t|�}tt|��}tdd�|D��}|f|}||}t|�}x:|D]2}x,|jj�D]\}}t|tj�rV|j	|�qVWqFWg}	t
�}
�x�|D�]�}d}d}
d}||
k�r�y|dkr�td��t||�}
Wn"tk
r�}zWYdd}~Xn�Xt|
d|�}||k�r�d}d}x(|D] }t||d�}||
k�r|}�qWxH|D]@}y|j
||�}Wntk
�rh�w:YnX||
k�r:|}�q:W|dk	�r�|}x4|D],}||jk�r�|j|}||k�r�|}P�q�W|dk�r�q�|
dk	�r�|
n|}t|t��r�d}|}n@t|t��rd}|}n*t|t��r"d	}|}nt|��r2d
}nd}|	j	t||||��|
j|�q�W|	S)aNReturn list of attribute-descriptor tuples.

    For each name in dir(cls), the return list contains a 4-tuple
    with these elements:

        0. The name (a string).

        1. The kind of attribute this is, one of these strings:
               'class method'    created via classmethod()
               'static method'   created via staticmethod()
               'property'        created via property()
               'method'          any other flavor of method or descriptor
               'data'            not a method

        2. The class which defined this attribute (a class).

        3. The object as obtained by calling getattr; if this fails, or if the
           resulting object does not live anywhere in the class' mro (including
           metaclasses) then the object is looked up in the defining class's
           dict (found by walking the mro).

    If one of the items in dir(cls) is stored in the metaclass it will now
    be discovered and not have None be listed as the class in which it was
    defined.  Any items whose home class cannot be discovered are skipped.
    cSsg|]}|ttfkr|�qSr
)rr)�.0�clsr
r
r�
<listcomp>�sz(classify_class_attrs.<locals>.<listcomp>Nr@z)__dict__ is special, don't want the proxy�__objclass__z
static methodzclass method�property�method�data)rJr�tuplerLr@rAr	r
rMrNrK�	ExceptionrB�__getattr__rO�staticmethod�classmethodr^r9rYrP)r[rRZmetamroZclass_basesZ	all_basesrUrFrVrW�resultrTrDZhomeclsZget_objZdict_obj�excZlast_clsZsrch_clsZsrch_obj�obj�kindr
r
r�classify_class_attrsks�

















rjcCs|jS)zHReturn tuple of base classes (including cls) in method resolution order.)�__mro__)r[r
r
rrJ�srJ)�stopcs��dkrdd�}n�fdd�}|}t|�|i}tj�}xD||�rz|j}t|�}||ksbt|�|krptdj|���|||<q8W|S)anGet the object wrapped by *func*.

   Follows the chain of :attr:`__wrapped__` attributes returning the last
   object in the chain.

   *stop* is an optional callback accepting an object in the wrapper chain
   as its sole argument that allows the unwrapping to be terminated early if
   the callback returns a true value. If the callback never returns a true
   value, the last object in the chain is returned as usual. For example,
   :func:`signature` uses this to stop unwrapping if any object in the
   chain has a ``__signature__`` attribute defined.

   :exc:`ValueError` is raised if a cycle is encountered.

    NcSs
t|d�S)N�__wrapped__)r)�fr
r
r�_is_wrapper�szunwrap.<locals>._is_wrappercst|d�o�|�S)Nrm)r)rn)rlr
rro�sz!wrapper loop when unwrapping {!r})�id�sys�getrecursionlimitrm�len�
ValueError�format)�funcrlrorn�memoZrecursion_limitZid_funcr
)rlr�unwrap�s

rxcCs|j�}t|�t|j��S)zBReturn the indent size, in spaces, at the start of a line of text.)�
expandtabsrs�lstrip)�lineZexpliner
r
r�
indentsize	sr|cCsRtjj|j�}|dkrdSx&|jjd�dd�D]}t||�}q0Wt|�sNdS|S)N�.r���)rq�modules�get�
__module__�__qualname__�splitrBr)rvr[rDr
r
r�
_findclasssr�cCs�t|�rRxD|jD]:}|tk	ry
|j}Wntk
r<wYnX|dk	r|SqWdSt|�r�|jj}|j}t|�r�t	t	||d�d�|jkr�|}n|j
}n�t|�r�|j}t|�}|dks�t	||�|k	r�dSn�t
|��r
|j}|j}t|�o�|jd||jk�r|}n|j
}nzt|t��rJ|j}|j}t|�}|dk�sDt	||�|k	�r�dSn:t|��s^t|��r�|j}|j}t	||�|k	�r�dSndSxJ|jD]@}yt	||�j}Wntk
�r��w�YnX|dk	�r�|S�q�WdS)N�__func__r})rrkr�__doc__rOrr��__name__�__self__rB�	__class__rr�r8r�r	r^�fgetrrr])rhrF�docrD�selfr[rvr
r
r�_finddocsb




r�cCsdy
|j}Wntk
rdSX|dkrNyt|�}Wnttfk
rLdSXt|t�s\dSt|�S)z�Get the documentation string for an object.

    All tabs are expanded to spaces.  To clean up docstrings that are
    indented to line up with blocks of code, any whitespace than can be
    uniformly removed from the second line onwards is removed.N)r�rOr��	TypeErrorr	�str�cleandoc)rr�r
r
r�getdocSs

r�cCs�y|j�jd�}Wntk
r&dSXtj}x:|dd�D]*}t|j��}|r<t|�|}t||�}q<W|r~|dj�|d<|tjkr�x*tdt|��D]}|||d�||<q�Wx|r�|dr�|j	�q�Wx|r�|dr�|j	d�q�Wdj
|�SdS)z�Clean up indentation from docstrings.

    Any whitespace that can be uniformly removed from the second line
    onwards is removed.�
Nrrr~)ryr��UnicodeErrorrq�maxsizersrz�min�range�pop�join)r��linesZmarginr{Zcontent�indent�ir
r
rr�fs(
r�cCs�t|�r&t|d�r|jStdj|���t|�rdt|d�rVtjj|j	�}t|d�rV|jStdj|���t
|�rr|j}t|�r�|j
}t|�r�|j}t|�r�|j}t|�r�|jStdj|���dS)z@Work out which source or compiled file an object was defined in.�__file__z{!r} is a built-in moduler�z{!r} is a built-in classzO{!r} is not a module, class, method, function, traceback, frame, or code objectN)rrr�r�rurrqrr�r�rr�rr!r2�tb_framer4�f_coder6�co_filename)rr
r
r�getfile�s,


r�cCsTtjj|�}dd�tjj�D�}|j�x&|D]\}}|j|�r.|d|�Sq.WdS)z1Return the module name for a given file, or None.cSsg|]}t|�|f�qSr
)rs)rZ�suffixr
r
rr\�sz!getmodulename.<locals>.<listcomp>N)�os�path�basename�	importlib�	machinery�all_suffixesrQ�endswith)r�Zfname�suffixesZneglenr�r
r
r�
getmodulename�s
r�cs�t|��tjjdd�}|tjjdd�7}t�fdd�|D��r`tjj��dtjj	d�nt�fdd�tjj
D��r~dStjj��r��Stt
|��dd�dk	r��S�tjkr��SdS)z�Return the filename that can be used to locate an object's source.
    Return None if no way can be identified to get the source.
    Nc3s|]}�j|�VqdS)N)r�)rZ�s)�filenamer
r�	<genexpr>�sz getsourcefile.<locals>.<genexpr>rc3s|]}�j|�VqdS)N)r�)rZr�)r�r
rr��s�
__loader__)r�r�r��DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXES�anyr�r��splitext�SOURCE_SUFFIXES�EXTENSION_SUFFIXES�existsrB�	getmodule�	linecache�cache)rZall_bytecode_suffixesr
)r�r�
getsourcefile�s
r�cCs,|dkrt|�pt|�}tjjtjj|��S)z�Return an absolute path to the source or compiled file for an object.

    The idea is for each object to have a unique origin, so this routine
    normalizes the result as much as possible.N)r�r�r�r��normcase�abspath)r�	_filenamer
r
r�
getabsfile�sr�c

Cs�t|�r|St|d�r$tjj|j�S|dk	rD|tkrDtjjt|�Syt||�}Wntk
rfdSX|tkr�tjjt|�Sxnt	tjj
��D]\\}}t|�r�t|d�r�|j}|tj|d�kr�q�|t|<t|�}|j
t|<ttjj|�<q�W|tk�r
tjjt|�Stjd}t|d��s$dSt||j
��rLt||j
�}||k�rL|Stjd}t||j
��r~t||j
�}	|	|k�r~|SdS)zAReturn the module an object was defined in, or None if not found.r�Nr��__main__r��builtins)rrrqrr�r��
modulesbyfiler�r��listrAr��_filesbymodnamer�r�r��realpathrB)
rr��file�modname�modulern�mainZ
mainobjectZbuiltinZ
builtinobjectr
r
rr��sD





r�c
Cs�t|�}|rtj|�n$t|�}|jd�o2|jd�s<td��t||�}|rZtj||j	�}n
tj|�}|sptd��t
|�r�|dfSt|��r |j}t
jd|d�}g}xRtt|��D]B}|j||�}|r�||ddkr�||fS|j|jd	�|f�q�W|�r|j�||dd	fStd
��t|��r0|j}t|��r@|j}t|��rP|j}t|��r`|j}t|��r�t|d��s~td��|jd	}	t
jd
�}x*|	dk�r�|j||	��r�P|	d	}	�q�W||	fStd��dS)abReturn the entire source file and starting line number for an object.

    The argument may be a module, class, method, function, traceback, frame,
    or code object.  The source code is returned as a list of all the lines
    in the file and the line number indexes a line in that list.  An OSError
    is raised if the source code cannot be retrieved.�<�>zsource code not availablezcould not get source coderz^(\s*)class\s*z\b�crzcould not find class definition�co_firstlinenoz"could not find function definitionz>^(\s*def\s)|(\s*async\s+def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)zcould not find code objectN) r�r��
checkcacher��
startswithr��OSErrorr��getlinesr@rrr��re�compiler�rs�matchrN�grouprQrr�rr!r2r�r4r�r6rr�)
rr�r�r�rDZpatZ
candidatesr�r��lnumr
r
r�
findsource�s^









r�cCs>yt|�\}}Wnttfk
r(dSXt|�r�d}|rR|ddd�dkrRd}x(|t|�krz||j�dkrz|d}qTW|t|�kr�||dd�dkr�g}|}x>|t|�kr�||dd�dkr�|j||j��|d}q�Wdj|�S�nH|dk�r:t	||�}|d}|dk�r:||j
�dd�dk�r:t	||�|k�r:||j�j
�g}|dk�r�|d}||j�j
�}x\|dd�dk�r�t	||�|k�r�|g|dd�<|d}|dk�r�P||j�j
�}�q|Wx*|�r|dj�dk�rg|dd�<�q�Wx*|�r.|d	j�dk�r.g|d
d�<�qWdj|�SdS)zwGet lines of comments immediately preceding an object's source code.

    Returns None when source can't be found.
    Nr�z#!r��#)r�r�r~r~)r�r�r�rrs�striprNryr�r|rz)rr�r��startZcomments�endr�Zcommentr
r
r�getcommentsAsJ "
$
&
r�c@seZdZdS)�
EndOfBlockN)r�r�r�r
r
r
rr�nsr�c@s eZdZdZdd�Zdd�ZdS)�BlockFinderz@Provide a tokeneater() method to detect the end of a code block.cCs.d|_d|_d|_d|_d|_d|_d|_dS)NrFr)r��islambda�started�passline�indecorator�decoratorhasargs�last)r�r
r
r�__init__rszBlockFinder.__init__cCs&|jrD|jrD|dkr d|_n|dkr<|dkr6d|_d|_d|_n�|dkrZ|jrXd|_n�|dkrv|jrtd|_d|_n�|tjkr�d|_|d	|_|jr�t�|jr�|jr�d|_nr|jr�nj|tj	kr�|j
d
|_
d|_nL|tjk�r|j
d
|_
|j
d	k�r"t�n"|j
d	k�r"|tjtj
fk�r"t�dS)N�@T�def�class�lambda�(�)Frr)r�r�r�)r�r�r�r�r��tokenize�NEWLINEr�r��INDENTr��DEDENT�COMMENT�NL)r�r�tokenZsrowcolZerowcolr{r
r
r�
tokeneater{sB


zBlockFinder.tokeneaterN)r�r�r�r�r�r�r
r
r
rr�ps	r�cCsZt�}y,tjt|�j�}x|D]}|j|�qWWnttfk
rJYnX|d|j�S)z@Extract the block of code at the top of the given list of lines.N)	r�r��generate_tokens�iter�__next__r�r��IndentationErrorr�)r�Zblockfinder�tokensZ_tokenr
r
r�getblock�s
r�cCsbt|�}t|�\}}t|�r"|j}t|�s>t|�rF|jjdkrF|dfSt||d��|dfSdS)a�Return a list of source lines and starting line number for an object.

    The argument may be a module, class, method, function, traceback, frame,
    or code object.  The source code is returned as a list of the lines
    corresponding to the object and the line number indicates where in the
    original source file the first line of code was found.  An OSError is
    raised if the source code cannot be retrieved.z<module>rNr)	rxr�r2r�rr4r��co_namer�)rr�r�r
r
r�getsourcelines�sr�cCst|�\}}dj|�S)aReturn the text of the source code for an object.

    The argument may be a module, class, method, function, traceback, frame,
    or code object.  The source code is returned as a single string.  An
    OSError is raised if the source code cannot be retrieved.r�)r�r�)rr�r�r
r
r�	getsource�sr�cCsVg}|jtdd�d�x:|D]2}|j||jf�||kr|jt||||��qW|S)z-Recursive helper function for getclasstree().r�r�)rI)rQrrNrC�walktree)�classes�children�parentrSr�r
r
rr��s
r�FcCs�i}g}xn|D]f}|jrbxZ|jD]<}||kr4g||<|||krN||j|�|r ||kr Pq Wq||kr|j|�qWx|D]}||kr~|j|�q~Wt||d�S)a�Arrange the given list of classes into a hierarchy of nested lists.

    Where a nested list appears, it contains classes derived from the class
    whose entry immediately precedes the list.  Each entry is a 2-tuple
    containing a class and a tuple of its base classes.  If the 'unique'
    argument is true, exactly one entry appears in the returned structure
    for each class in the given list.  Otherwise, classes using multiple
    inheritance and their descendants will appear multiple times.N)rCrNr�)r��uniquer��rootsr�rr
r
r�getclasstree�s"	

r�	Argumentszargs, varargs, varkwcCs t|�\}}}}t||||�S)aGet information about the arguments accepted by a code object.

    Three things are returned: (args, varargs, varkw), where
    'args' is the list of argument names. Keyword-only arguments are
    appended. 'varargs' and 'varkw' are the names of the * and **
    arguments or None.)�_getfullargsr)�co�args�varargs�
kwonlyargs�varkwr
r
r�getargs�src	Cs�t|�stdj|���|j}|j}|j}t|d|��}t||||��}d}||7}d}|jt@rx|j|}|d}d}|jt	@r�|j|}||||fS)aGet information about the arguments accepted by a code object.

    Four things are returned: (args, varargs, kwonlyargs, varkw), where
    'args' and 'kwonlyargs' are lists of argument names, and 'varargs'
    and 'varkw' are the names of the * and ** arguments or None.z{!r} is not a code objectNrr)
r6r�ru�co_argcount�co_varnames�co_kwonlyargcountr�r"�
CO_VARARGS�CO_VARKEYWORDS)	r�nargsrUZnkwargsrr	�steprr
r
r
rrs"



r�ArgSpeczargs varargs keywords defaultscCsDtjdtdd�t|�\}}}}}}}|s.|r6td��t||||�S)aeGet the names and default values of a function's parameters.

    A tuple of four things is returned: (args, varargs, keywords, defaults).
    'args' is a list of the argument names, including keyword-only argument names.
    'varargs' and 'keywords' are the names of the * and ** parameters or None.
    'defaults' is an n-tuple of the default values of the last n parameters.

    This function is deprecated, as it does not support annotations or
    keyword-only parameters and will raise ValueError if either is present
    on the supplied callable.

    For a more structured introspection API, use inspect.signature() instead.

    Alternatively, use getfullargspec() for an API with a similar namedtuple
    based interface, but full support for annotations and keyword-only
    parameters.

    Deprecated since Python 3.5, use `inspect.getfullargspec()`.
    zhinspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()r�)�
stacklevelzdFunction has keyword-only parameters or annotations, use getfullargspec() API which can support them)�warnings�warn�DeprecationWarning�getfullargspecrtr)rvrrr
�defaultsr	�kwonlydefaults�annr
r
r�
getargspec s
r�FullArgSpeczGargs, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotationsc
Cs`yt|ddtd�}Wn,tk
r@}ztd�|�WYdd}~XnXg}d}d}g}f}i}f}i}	|j|jk	rx|j|d<x�|jj�D]�}
|
j}|
j	}|t
kr�|j|�nv|tkr�|j|�|
j
|
jk	r�||
j
f7}nJ|tkr�|}n<|tk�r|j|�|
j
|
jk	�r|
j
|	|<n|tk�r|}|
j|
jk	r�|
j||<q�W|	�sBd}	|�sLd}t||||||	|�S)a$Get the names and default values of a callable object's parameters.

    A tuple of seven things is returned:
    (args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations).
    'args' is a list of the parameter names.
    'varargs' and 'varkw' are the names of the * and ** parameters or None.
    'defaults' is an n-tuple of the default values of the last n parameters.
    'kwonlyargs' is a list of keyword-only parameter names.
    'kwonlydefaults' is a dictionary mapping names from kwonlyargs to defaults.
    'annotations' is a dictionary mapping parameter names to annotations.

    Notable differences from inspect.signature():
      - the "self" parameter is always reported, even for bound methods
      - wrapper chains defined by __wrapped__ *not* unwrapped automatically
    F)�follow_wrapper_chains�skip_bound_arg�sigclszunsupported callableN�return)�_signature_from_callable�	Signaturerbr��return_annotation�empty�
parameters�valuesrirD�_POSITIONAL_ONLYrN�_POSITIONAL_OR_KEYWORD�default�_VAR_POSITIONAL�
_KEYWORD_ONLY�_VAR_KEYWORD�
annotationr)
rv�sig�exrrr
r	r�annotations�
kwdefaults�paramrirDr
r
rrAsT





r�ArgInfozargs varargs keywords localscCs t|j�\}}}t||||j�S)a9Get information about arguments passed into a particular frame.

    A tuple of four things is returned: (args, varargs, varkw, locals).
    'args' is a list of the argument names.
    'varargs' and 'varkw' are the names of the * and ** arguments or None.
    'locals' is the locals dictionary of the given frame.)rr�r4�f_locals)�framerrr
r
r
r�getargvalues�sr7cCsVt|dd�dkr t|�jdd�St|t�rN|jd|fkr>|jS|jd|jSt|�S)Nr�Ztypingztyping.r�r�r})rB�repr�replacer	rr�r�)r.Zbase_moduler
r
r�formatannotation�s
r:cst|dd���fdd�}|S)Nr�cs
t|��S)N)r:)r.)r�r
r�_formatannotation�sz5formatannotationrelativeto.<locals>._formatannotation)rB)rr;r
)r�r�formatannotationrelativeto�sr<cCsd|S)N�*r
)rDr
r
rrH�srHcCsd|S)Nz**r
)rDr
r
rrH�scCsdt|�S)N�=)r8)rEr
r
rrH�scCsd|S)Nz -> r
)�textr
r
rrH�sc
s(���fdd�}
g}|r(t|�t|�}xFt|�D]:\}}|
|�}|rb||krb||
|||�}|j|�q2W|dk	r�|j||
|���n|r�|jd�|r�x:|D]2}|
|�}|r�||kr�||
||�7}|j|�q�W|dk	r�|j|	|
|���ddj|�d}d�k�r$||��d��7}|S)	a�Format an argument spec from the values returned by getfullargspec.

    The first seven arguments are (args, varargs, varkw, defaults,
    kwonlyargs, kwonlydefaults, annotations).  The other five arguments
    are the corresponding optional formatting functions that are called to
    turn names and values into strings.  The last argument is an optional
    function to format the sequence of arguments.cs(�|�}|�kr$|d��|�7}|S)Nz: r
)�argrf)r1r:�	formatargr
r�formatargandannotation�sz-formatargspec.<locals>.formatargandannotationNr=r�z, r�r!)rs�	enumeraterNr�)rrr
rr	rr1rA�
formatvarargs�formatvarkw�formatvalueZ
formatreturnsr:rB�specsZfirstdefaultr�r@�specZ	kwonlyargrfr
)r1r:rAr�
formatargspec�s2


rIcCsd|S)Nr=r
)rDr
r
rrH�scCsd|S)Nz**r
)rDr
r
rrH�scCsdt|�S)Nr>)r8)rEr
r
rrH�scCs�|||fdd�}g}	x&tt|��D]}
|	j|||
��q"W|rZ|	j||�|||��|rx|	j||�|||��ddj|	�dS)afFormat an argument spec from the 4 values returned by getargvalues.

    The first four arguments are (args, varargs, varkw, locals).  The
    next four arguments are the corresponding optional formatting functions
    that are called to turn names and values into strings.  The ninth
    argument is an optional function to format the sequence of arguments.cSs||�|||�S)Nr
)rD�localsrArFr
r
r�convert�sz formatargvalues.<locals>.convertr�z, r�)r�rsrNr�)rrr
rJrArDrErFrKrGr�r
r
r�formatargvalues�srLcs��fdd�|D�}t|�}|dkr,|d}n>|dkr@dj|�}n*dj|dd��}|dd�=dj|�|}td	|||rzd
nd|dkr�dnd
|f��dS)Ncsg|]}|�krt|��qSr
)r8)rZrD)r'r
rr\�sz&_missing_arguments.<locals>.<listcomp>rrr�z	{} and {}z, {} and {}z, z*%s() missing %i required %s argument%s: %s�
positionalzkeyword-onlyr�r����rN)rsrur�r�)�f_nameZargnames�posr'rU�missingr��tailr
)r'r�_missing_arguments�s


rSc
	s�t|�|}t�fdd�|D��}|r:|dk}	d|f}
n2|rTd}	d|t|�f}
nt|�dk}	tt|��}
d}|r�d}||dkr�d	nd||dkr�d	ndf}td
||
|	r�d	nd|||dkr�|r�dndf��dS)
Ncsg|]}|�kr|�qSr
r
)rZr@)r'r
rr\sz_too_many.<locals>.<listcomp>rzat least %dTz
from %d to %dr�z7 positional argument%s (and %d keyword-only argument%s)r�z5%s() takes %s positional argument%s but %d%s %s givenZwasZwere)rsr�r�)
rOrZkwonlyrZdefcountZgivenr'ZatleastZkwonly_givenZpluralr/Z
kwonly_sig�msgr
)r'r�	_too_manys$rUcOs6|d}|dd�}t|�}|\}}}}}	}
}|j}i}
t|�rV|jdk	rV|jf|}t|�}t|�}|rrt|�nd}t||�}x t|�D]}|||
||<q�W|r�t||d��|
|<t||	�}|r�i|
|<xd|j	�D]X\}}||k�r|�st
d||f��||
||<q�||
k�r,t
d||f��||
|<q�W||k�r^|�r^t|||	||||
�||k�r�|d||�}x&|D]}||
k�r~t||d|
��q~Wx8t
|||d��D] \}}||
k�r�|||
|<�q�Wd}x>|	D]6}||
k�r�|
�r||
k�r|
||
|<n|d7}�q�W|�r2t||	d|
�|
S)z�Get the mapping of arguments to values.

    A dict is returned, with keys the function argument names (including the
    names of the * and ** arguments, if any), and values the respective bound
    values from 'positional' and 'named'.rrNz*%s() got an unexpected keyword argument %rz(%s() got multiple values for argument %rTF)rr�rr�rsr�r�rarKrAr�rUrSrC)Zfunc_and_positionalZnamedrvrMrHrrr
rr	rrrOZ	arg2valueZnum_posZnum_argsZnum_defaults�nr�Zpossible_kwargs�kwrEZreqr@rQ�kwargr
r
r�getcallargs!sd








rY�ClosureVarsz"nonlocals globals builtins unboundc	Cst|�r|j}t|�s$tdj|���|j}|jdkr:i}ndd�t|j|j�D�}|j	}|j
dtj�}t
|�rt|j}i}i}t�}xn|jD]d}|d	kr�q�y||||<Wq�tk
r�y||||<Wntk
r�|j|�YnXYq�Xq�Wt||||�S)
a
    Get the mapping of free variables to their current values.

    Returns a named tuple of dicts mapping the current nonlocal, global
    and builtin references as seen by the body of the function. A final
    set of unbound names that could not be resolved is also provided.
    z'{!r}' is not a Python functionNcSsi|]\}}|j|�qSr
)�
cell_contents)rZ�varZcellr
r
r�
<dictcomp>vsz"getclosurevars.<locals>.<dictcomp>�__builtins__�None�True�False)r_r`ra)rr�rr�rur!�__closure__�zip�co_freevars�__globals__r�r�r@rrK�co_names�KeyErrorrPrZ)	rv�codeZ
nonlocal_varsZ	global_nsZ
builtin_nsZglobal_varsZbuiltin_varsZ
unbound_namesrDr
r
r�getclosurevarsas8	
ri�	Tracebackz+filename lineno function code_context indexcCs�t|�r|j}|j}n|j}t|�s2tdj|���t|�p@t|�}|dkr�|d|d}yt	|�\}}Wnt
k
r�d}}Yq�Xtdt|t
|�|��}||||�}|d|}nd}}t|||jj||�S)a�Get information about a frame or traceback object.

    A tuple of five things is returned: the filename, the line number of
    the current line, the function name, a list of lines of context from
    the source code, and the index of the current line within that list.
    The optional second argument specifies the number of lines of context
    to return, which are centered around the current line.z'{!r} is not a frame or traceback objectrrr�N)r2�	tb_linenor��f_linenor4r�rur�r�r�r��maxr�rsrjr�r�)r6�context�linenor�r�r�r��indexr
r
r�getframeinfo�s$rqcCs|jS)zCGet the line number from a frame object, allowing for optimization.)rl)r6r
r
r�	getlineno�srr�	FrameInfor6cCs6g}x,|r0|ft||�}|jt|��|j}qW|S)z�Get a list of records for a frame and all higher (calling) frames.

    Each record contains a frame object, filename, line number, function
    name, a list of lines of context, and index within the context.)rqrNrs�f_back)r6rn�	framelist�	frameinfor
r
r�getouterframes�s
rwcCs8g}x.|r2|jft||�}|jt|��|j}qW|S)z�Get a list of records for a traceback's frame and all lower frames.

    Each record contains a frame object, filename, line number, function
    name, a list of lines of context, and index within the context.)r�rqrNrs�tb_next)�tbrnrurvr
r
r�getinnerframes�s
rzcCsttd�rtjd�SdS)z?Return the frame of the caller or None if this is not possible.�	_getframerN)rrqr{r
r
r
r�currentframe�sr|cCsttjd�|�S)z@Return a list of records for the stack above the caller's frame.r)rwrqr{)rnr
r
r�stack�sr}cCsttj�d|�S)zCReturn a list of records for the stack below the current exception.r�)rzrq�exc_info)rnr
r
r�trace�srcCstjdj|�S)Nrk)rr@r)�klassr
r
r�_static_getmro�sr�cCs8i}ytj|d�}Wntk
r(YnXtj||t�S)Nr@)r�__getattribute__rO�dictr��	_sentinel)rh�attrZ
instance_dictr
r
r�_check_instance�sr�cCsFx@t|�D]4}tt|��tkr
y
|j|Stk
r<Yq
Xq
WtS)N)r��_shadowed_dictrr�r@rg)r�r��entryr
r
r�_check_class�s

r�cCs&yt|�Wntk
r dSXdS)NFT)r�r�)rhr
r
r�_is_type�s
r�cCsntjd}x^t|�D]R}y|j|�d}Wntk
r>YqXt|�tjko`|jdko`|j|ks|SqWt	S)Nr@)
rr@r�rrgr
rr�r]r�)r��	dict_attrr�Z
class_dictr
r
rr�s


r�cCst}t|�s>t|�}t|�}|tks2t|�tjkrBt||�}n|}t||�}|tk	r�|tk	r�tt|�d�tk	r�tt|�d�tk	r�|S|tk	r�|S|tk	r�|S||kr�xDtt|��D]4}tt|��tkr�y
|j	|St
k
r�Yq�Xq�W|tk	r�|St|��dS)a�Retrieve attributes without triggering dynamic lookup via the
       descriptor protocol,  __getattr__ or __getattribute__.

       Note: this function may not be able to retrieve all attributes
       that getattr can fetch (like dynamically created attributes)
       and may find attributes that getattr can't (like descriptors
       that raise AttributeError). It can also return descriptor objects
       instead of instance members in some cases. See the
       documentation for details.
    rrN)r�r�rr�r
rr�r�r�r@rgrO)rhr�r*Zinstance_resultr�r�Zklass_resultr�r
r
r�getattr_statics6


r��GEN_CREATED�GEN_RUNNING�
GEN_SUSPENDED�
GEN_CLOSEDcCs,|jr
tS|jdkrtS|jjdkr(tStS)a#Get current state of a generator-iterator.

    Possible states are:
      GEN_CREATED: Waiting to start execution.
      GEN_RUNNING: Currently being executed by the interpreter.
      GEN_SUSPENDED: Currently suspended at a yield expression.
      GEN_CLOSED: Execution has completed.
    Nrr~)�
gi_runningr��gi_framer��f_lastir�r�)�	generatorr
r
r�getgeneratorstateGs	
r�cCs:t|�stdj|���t|dd�}|dk	r2|jjSiSdS)z�
    Get the mapping of generator local variables to their current values.

    A dict is returned, with the keys the local variable names and values the
    bound values.z '{!r}' is not a Python generatorr�N)r)r�rurBr�r5)r�r6r
r
r�getgeneratorlocalsYsr��CORO_CREATED�CORO_RUNNING�CORO_SUSPENDED�CORO_CLOSEDcCs,|jr
tS|jdkrtS|jjdkr(tStS)a&Get current state of a coroutine object.

    Possible states are:
      CORO_CREATED: Waiting to start execution.
      CORO_RUNNING: Currently being executed by the interpreter.
      CORO_SUSPENDED: Currently suspended at an await expression.
      CORO_CLOSED: Execution has completed.
    Nrr~)�
cr_runningr��cr_framer�r�r�r�)�	coroutiner
r
r�getcoroutinestateqs	
r�cCs"t|dd�}|dk	r|jSiSdS)z�
    Get the mapping of coroutine local variables to their current values.

    A dict is returned, with the keys the local variable names and values the
    bound values.r�N)rBr5)r�r6r
r
r�getcoroutinelocals�sr��
from_bytescCs6yt||�}Wntk
r"dSXt|t�s2|SdS)z�Private helper. Checks if ``cls`` has an attribute
    named ``method_name`` and returns it only if it is a
    pure python function.
    N)rBrOr	�_NonUserDefinedCallables)r[Zmethod_name�methr
r
r�"_signature_get_user_defined_method�s
r�cCs�|j}t|j��}|jpf}|jp$i}|r2||}y|j||�}Wn6tk
rx}zdj|�}	t|	�|�WYdd}~XnXd}
�x
|j�D�]�\}}y|j	|}
Wnt
k
r�YnlX|jtkr�|j
|�q�|jtk�r||kr�d}
|j|
d�||<n|j
|j�q�|jtk�r"|j|
d�||<|
r�|jtk�rV||jtd�}|||<|j|�q�|jttfk�rr|j|�q�|jtkr�|j
|j�q�W|j|j�d�S)z�Private helper to calculate how 'wrapped_sig' signature will
    look like after applying a 'functools.partial' object (or alike)
    on it.
    z+partial object {!r} has incorrect argumentsNFT)r*)ri)r&)r&rrAr�keywords�bind_partialr�rurt�	argumentsrgrir(r�r)r9rDr,�move_to_endr-r+r')�wrapped_sig�partialZ
extra_argsZ
old_params�
new_paramsZpartial_argsZpartial_keywordsZbar0rTZtransform_to_kwonly�
param_namer3Z	arg_valueZ	new_paramr
r
r�_signature_get_partial�sL






r�cCsnt|jj��}|s&|djttfkr.td��|dj}|ttfkrR|dd�}n|t	k	rbtd��|j
|d�S)zWPrivate helper to transform signatures for unbound
    functions to bound methods.
    rzinvalid method signaturerNzinvalid argument type)r&)rar&r'rir-r,rtr)r(r+r9)r/�paramsrir
r
r�_signature_bound_method�s
r�cCs&t|�p$t|�p$t|t�p$|ttfkS)zxPrivate helper to test if `obj` is a callable that might
    support Argument Clinic's __text_signature__ protocol.
    )r8rr	r�rr)rhr
r
r�_signature_is_builtins
r�cCs�t|�st|�rdSt|dd�}t|dd�}t|dt�}t|dt�}t|dd�}t|tj�o�t|t�o�|dkszt|t�o�|dks�t|t	�o�t|t	�S)z�Private helper to test if `obj` is a duck type of FunctionType.
    A good example of such objects are functions compiled with
    Cython, which have all attributes that a pure Python function
    would have, but have their code statically compiled.
    Fr�Nr!�__defaults__�__kwdefaults__�__annotations__)
�callablerrB�_voidr	r
r5r�rar�)rhrDrhrr2r1r
r
r�_signature_is_functionlike!s
r�cCs<|jd�}|dkr|jd�}|jd�}|jd�}|d|�S)z� Private helper to get first parameter name from a
    __text_signature__ of a builtin method, which should
    be in the following format: '($param1, ...)'.
    Assumptions are that the first argument won't have
    a default value or an annotation.
    �,rr��:r>r�r~)�find)rHrPZcposr
r
r�_signature_get_bound_param:s




r�cCs$|s|ddfSd}d}dd�|jd�D�}t|�j}tj|�}d}d}g}|j}	d}
tj}tj}t|�}
x�|D]�}
|
j	|
j
}}||kr�|dkr�|r�d}qnd}|
d	7}
qn|d
kr�d}|
d	}qn||kr�|dkr�|
}qn|r�d}||ko�|dks�|	d
�|	|�|dkrn|	d�qnWdj|�}|||fS)a�
    Private helper function. Takes a signature in Argument Clinic's
    extended signature format.

    Returns a tuple of three things:
      * that signature re-rendered in standard Python syntax,
      * the index of the "self" parameter (generally 0), or None if
        the function does not have a "self" parameter, and
      * the index of the last "positional only" parameter,
        or None if the signature has no positional-only parameters.
    NcSsg|]}|jd��qS)�ascii)�encode)rZ�lr
r
rr\dsz6_signature_strip_non_python_syntax.<locals>.<listcomp>r�Frr�Tr�/�$r�z, � r�)r�r�r�r�rNr��OP�
ERRORTOKEN�nextr�stringr�)�	signature�self_parameter�last_positional_onlyr�r�Ztoken_streamZ
delayed_commaZskip_next_commar?rPZcurrent_parameterr�r��trr��clean_signaturer
r
r�"_signature_strip_non_python_syntaxQsP





r�TcsV|j�t|�\}}}d|d}ytj|�}Wntk
rFd}YnXt|tj�sbtdj|���|j	d}	g��j
�t��d}i�t|dd�}
|
r�t
jj|
d�}|r�|j�t
jj��dd����fd	d
��	G�	fdd�dtj���f�������fd
d�	}t|	jj�}t|	jj�}
tj||
dd�}|dk	�r8�j�n�j�x<ttt|���D](\}\}}|||�||k�rP�j��qPW|	jj�r��j�||	jj���j�x*t|	jj |	jj!�D]\}}|||��q�W|	jj"�r�j#�||	jj"��|dk	�rHt|dd�}|dk	}t$|�}|�r.|�s"|�r.�j%d�n�dj&�jd�}|�d<|�|j
d�S)zdPrivate helper to parse content of '__text_signature__'
    and return a Signature based on it.
    zdef fooz: passNz"{!r} builtin has invalid signaturerr�cSs|jdkrtd��|jS)Nz'Annotations are not currently supported)r.rtr@)�noder
r
r�
parse_name�s
z&_signature_fromstr.<locals>.parse_namecs�yt|��}Wn>tk
rLyt|��}Wntk
rFt��YnXYnXt|t�rbtj|�St|ttf�rztj	|�St|t
�r�tj|�S|dkr�tj|�St��dS)NTF)TFN)
�eval�	NameError�RuntimeErrorr	r��astZStr�int�floatZNum�bytesZBytesZNameConstant)r�rE)�module_dict�sys_module_dictr
r�
wrap_value�s 





z&_signature_fromstr.<locals>.wrap_valuecs$eZdZ�fdd�Z�fdd�ZdS)z,_signature_fromstr.<locals>.RewriteSymbolicscs`g}|}x"t|tj�r*|j|j�|j}q
Wt|tj�s>t��|j|j�dj	t
|��}�|�S)Nr})r	r�rYrNr�rE�Namer�rpr��reversed)r�r��arVrE)r�r
r�visit_Attribute�s
z<_signature_fromstr.<locals>.RewriteSymbolics.visit_Attributecst|jtj�st���|j�S)N)r	Zctxr�ZLoadrtrp)r�r�)r�r
r�
visit_Name�sz7_signature_fromstr.<locals>.RewriteSymbolics.visit_NameN)r�r�r�r�r�r
)r�r
r�RewriteSymbolics�sr�cs��|�}|�krdS|rp|tk	rpy��j|�}tj|�}Wntk
rR�}YnX|�kr`dS|�k	rl|n|}�j�|�|�d��dS)N)r*r.)�_emptyZvisitr�Zliteral_evalrtrN)Z	name_nodeZdefault_noder*rD�o)�	Parameterr�r%�invalidrir&r�r
r�p�s
z_signature_fromstr.<locals>.p)�	fillvaluer�)ri)r$)'�_parameter_clsr�r��parse�SyntaxErrorr	ZModulertruZbodyr%rrBrqrr�r@�copyZNodeTransformerr�rr�	itertools�zip_longest�POSITIONAL_ONLY�POSITIONAL_OR_KEYWORDrCr�Zvararg�VAR_POSITIONAL�KEYWORD_ONLYrcr	Zkw_defaultsrX�VAR_KEYWORDrr�r9)r[rhr�rr�r�r�Zprogramr�rnZmodule_namer�rrr�r�rDr*�_selfZself_isboundZ
self_ismoduler
)
r�r�r%r�rir�r&r�r�r�r�_signature_fromstr�sj








r�cCsBt|�stdj|���t|dd�}|s4tdj|���t||||�S)zHPrivate helper function to get signature for
    builtin callables.
    z%{!r} is not a Python builtin function�__text_signature__Nz#no signature found for builtin {!r})r�r�rurBrtr�)r[rvrr�r
r
r�_signature_from_builtin&sr�cCs�d}t|�s(t|�rd}ntdj|���|j}|j}|j}|j}t|d|��}|j	}||||�}	|j
}
|j}|j}|r�t
|�}
nd}
g}||
}x4|d|�D]$}|
j|t�}|j|||td��q�WxBt||d��D].\}}|
j|t�}|j|||t||d��q�W|jt@�rH|||}|
j|t�}|j|||td��xJ|	D]B}t}|dk	�rl|j|t�}|
j|t�}|j|||t|d���qNW|jt@�r�||}|jt@�r�|d7}||}|
j|t�}|j|||td��|||
jd	t�|d
�S)zCPrivate helper: constructs Signature for the given python function.FTz{!r} is not a Python functionNr)r.ri)r.rir*rr!)r$�__validate_parameters__)rr�r�rur�r!rr
rarr�r�r�rsr�r�rNr)rCr"rr+r,rr-)r[rvZis_duck_functionr�Z	func_codeZ	pos_countZ	arg_namesrMZkeyword_only_countZkeyword_onlyr1rr2Zpos_default_countr&Znon_default_countrDr.�offsetr*rpr
r
r�_signature_from_function6sj










r�)rrc!Cs�t|�stdj|���t|tj�rDt|j|||d�}|r@t|�S|S|rtt	|dd�d�}t|tj�rtt||||d�Sy
|j
}Wntk
r�Yn&X|dk	r�t|t�s�tdj|���|Sy
|j
}Wntk
r�YnvXt|tj��rLt|j|||d�}t||d�}t|jj��d}|jtjk�r(|St|jj��}|f|}	|j|	d	�St|��s`t|��rjt||�St|��r�t|||d
�St|tj��r�t|j|||d�}t||�Sd}t|t��r�t t|�d�}
|
dk	�r�t|
|||d�}nJt |d�}|dk	�rt||||d�}n$t |d
�}|dk	�r0t||||d�}|dk�r:xL|j!dd�D]:}
y
|
j"}Wntk
�rnYnX|�rJt#|||�S�qJWt|j!k�r:|j$t%j$k�r�|j&t%j&k�r�t't%�St(dj|���nrt|t)��s:t t|�d�}
|
dk	�r:yt|
|||d�}Wn8t(k
�r8}zdj|�}t(|�|�WYdd}~XnX|dk	�rV|�rRt|�S|St|tj*��rvdj|�}t(|��t(dj|���dS)zQPrivate helper function to get signature for arbitrary
    callable objects.
    z{!r} is not a callable object)rrr cSs
t|d�S)N�
__signature__)r)rnr
r
rrH�sz*_signature_from_callable.<locals>.<lambda>)rlNz1unexpected object {!r} in __signature__ attributer)r&)r�__call__�__new__r�rz(no signature found for builtin type {!r}zno signature found for {!r}z,no signature found for builtin function {!r}z+callable {!r} is not supported by signature)Nr~)+r�r�rur	r
rr"r�r�rxr�rOr#�_partialmethod�	functools�
partialmethodrvr�rar&r'rir�r�r9rr�r�r�r�r�rr�rkr�r�r�rr�r�rtr�r7)rhrrr r/r�r�Zfirst_wrapped_paramZ
sig_paramsr�Zcall�newZinitrFZtext_sigr0rTr
r
rr"�s�	



















r"c@seZdZdZdS)r�z1A private marker - used in Parameter & Signature.N)r�r�r�r�r
r
r
rr�P	sr�c@seZdZdZdS)r�z6Marker object for Signature.empty and Parameter.empty.N)r�r�r�r�r
r
r
rr�T	sr�c@s(eZdZdZdZdZdZdZdd�ZdS)	�_ParameterKindrrr���cCs|jS)N)�_name_)r�r
r
r�__str___	sz_ParameterKind.__str__N)	r�r�r�r�r�r�r�r�r�r
r
r
rr�X	sr�zpositional-onlyzpositional or keywordzvariadic positionalzkeyword-onlyzvariadic keywordc@s�eZdZdZd!ZeZeZe	Z
eZe
ZeZeed�dd�Zd	d
�Zdd�Zed
d��Zedd��Zedd��Zedd��Zeeeed�dd�Zdd�Zdd�Zdd�Zdd�Zd S)"r�aRepresents a parameter in a function signature.

    Has the following public attributes:

    * name : str
        The name of the parameter as a string.
    * default : object
        The default value for the parameter if specified.  If the
        parameter has no default value, this attribute is set to
        `Parameter.empty`.
    * annotation
        The annotation for the parameter if specified.  If the
        parameter has no annotation, this attribute is set to
        `Parameter.empty`.
    * kind : str
        Describes how argument values are bound to the parameter.
        Possible values: `Parameter.POSITIONAL_ONLY`,
        `Parameter.POSITIONAL_OR_KEYWORD`, `Parameter.VAR_POSITIONAL`,
        `Parameter.KEYWORD_ONLY`, `Parameter.VAR_KEYWORD`.
    �_name�_kind�_default�_annotation)r*r.cCs"yt|�|_Wn$tk
r2td|�d���YnX|tk	rf|jttfkrfd}|jt|j��}t|��||_||_	|tkr�td��t
|t�s�djt|�j
�}t|��|ddko�|dd�j��r|jtkr�d	}|jt|j��}t|��t|_d
j|dd��}|j��stdj|���||_dS)Nzvalue z is not a valid Parameter.kindz({} parameters cannot have default valuesz*name is a required attribute for Parameterzname must be a str, not a {}rr}rzLimplicit arguments must be passed as positional or keyword arguments, not {}z
implicit{}z"{!r} is not a valid parameter name)r�rrtr�r+r-ru�_get_paramkind_descrrrr	r�rr�r��isdigitr)r(�isidentifierr)r�rDrir*r.rTr
r
rr��	s4


zParameter.__init__cCs t|�|j|jf|j|jd�fS)N)rr)rrrrr)r�r
r
r�
__reduce__�	s
zParameter.__reduce__cCs|d|_|d|_dS)Nrr)rr)r��stater
r
r�__setstate__�	s
zParameter.__setstate__cCs|jS)N)r)r�r
r
rrD�	szParameter.namecCs|jS)N)r)r�r
r
rr*�	szParameter.defaultcCs|jS)N)r)r�r
r
rr.�	szParameter.annotationcCs|jS)N)r)r�r
r
rri�	szParameter.kind)rDrir.r*cCsL|tkr|j}|tkr|j}|tkr*|j}|tkr8|j}t|�||||d�S)z+Creates a customized copy of the Parameter.)r*r.)r�rrrrr)r�rDrir.r*r
r
rr9�	szParameter.replacecCsj|j}|j}|jtk	r(dj|t|j��}|jtk	rDdj|t|j��}|tkrVd|}n|t	krfd|}|S)Nz{}:{}z{}={}r=z**)
rirrr�rur:rr8r+r-)r�ri�	formattedr
r
rr��	s


zParameter.__str__cCsdj|jj|�S)Nz	<{} "{}">)rur�r�)r�r
r
r�__repr__�	szParameter.__repr__cCst|j|j|j|jf�S)N)�hashrDrir.r*)r�r
r
r�__hash__�	szParameter.__hash__cCsJ||krdSt|t�stS|j|jkoH|j|jkoH|j|jkoH|j|jkS)NT)r	r��NotImplementedrrrr)r��otherr
r
r�__eq__
s
zParameter.__eq__N)rrrr)r�r�r�r��	__slots__r(r�r)r�r+r�r,r�r-r�r�r%r�rr	r^rDr*r.rir�r9r�rr
rr
r
r
rr�t	s*(r�c@sheZdZdZdZdd�Zedd��Zed	d
��Zedd��Z	d
d�Z
dd�Zdd�Zdd�Z
dd�ZdS)�BoundArgumentsaResult of `Signature.bind` call.  Holds the mapping of arguments
    to the function's parameters.

    Has the following public attributes:

    * arguments : OrderedDict
        An ordered mutable mapping of parameters' names to arguments' values.
        Does not contain arguments' default values.
    * signature : Signature
        The Signature object that created this instance.
    * args : tuple
        Tuple of positional arguments values.
    * kwargs : dict
        Dict of keyword arguments values.
    r��
_signature�__weakref__cCs||_||_dS)N)r�r)r�r�r�r
r
rr�
szBoundArguments.__init__cCs|jS)N)r)r�r
r
rr�#
szBoundArguments.signaturecCs|g}xn|jjj�D]^\}}|jttfkr*Py|j|}Wntk
rNPYqX|jtkrf|j	|�q|j
|�qWt|�S)N)rr&rArir-r,r�rgr+�extendrNra)r�rr�r3r@r
r
rr'
s
zBoundArguments.argscCs�i}d}x�|jjj�D]x\}}|sF|jttfkr6d}n||jkrFd}q|sLqy|j|}Wntk
rnYqX|jtkr�|j|�q|||<qW|S)NFT)	rr&rArir-r,r�rg�update)r��kwargsZkwargs_startedr�r3r@r
r
rr>
s&

zBoundArguments.kwargscCs�|j}g}x�|jjj�D]v\}}y|j|||f�Wqtk
r�|jtk	rX|j}n"|jt	krhf}n|jt
krxi}nw|j||f�YqXqWt|�|_dS)z�Set default values for missing arguments.

        For variable-positional arguments (*args) the default is an
        empty tuple.

        For variable-keyword arguments (**kwargs) the default is an
        empty dict.
        N)r�rr&rArNrgr*r�rir+r-r)r�r�Z
new_argumentsrDr3�valr
r
r�apply_defaults\
s	


zBoundArguments.apply_defaultscCs2||krdSt|t�stS|j|jko0|j|jkS)NT)r	rrr�r�)r�rr
r
rrx
s
zBoundArguments.__eq__cCs|d|_|d|_dS)Nrr�)rr�)r�rr
r
rr	�
s
zBoundArguments.__setstate__cCs|j|jd�S)N)rr�)rr�)r�r
r
r�__getstate__�
szBoundArguments.__getstate__cCsDg}x(|jj�D]\}}|jdj||��qWdj|jjdj|��S)Nz{}={!r}z	<{} ({})>z, )r�rArNrur�r�r�)r�rr@rEr
r
rr�
szBoundArguments.__repr__N)r�rr)r�r�r�r�rr�r^r�rrrrr	rrr
r
r
rr
src@s�eZdZdZd-ZeZeZe	Z
d.e	dd�dd�Zed	d
��Z
edd��Zedd
�dd��Zedd��Zedd��Zeed�dd�Zdd�Zdd�Zdd�Zdd�dd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�ZdS)/r#aA Signature object represents the overall signature of a function.
    It stores a Parameter object for each parameter accepted by the
    function, as well as information specific to the function itself.

    A Signature object has the following public attributes and methods:

    * parameters : OrderedDict
        An ordered mapping of parameters' names to the corresponding
        Parameter objects (keyword-only arguments are in the same order
        as listed in `code.co_varnames`).
    * return_annotation : object
        The annotation for the return type of the function if specified.
        If the function has no annotation for its return type, this
        attribute is set to `Signature.empty`.
    * bind(*args, **kwargs) -> BoundArguments
        Creates a mapping from positional and keyword arguments to
        parameters.
    * bind_partial(*args, **kwargs) -> BoundArguments
        Creates a partial mapping from positional and keyword arguments
        to parameters (simulating 'functools.partial' behavior.)
    �_return_annotation�_parametersNT)r$r�cCs�|dkrt�}n�|r�t�}t}d}x�t|�D]�\}}|j}	|j}
|	|krjd}|jt|�t|	��}t|��n|	|krzd}|	}|	ttfkr�|j	t
kr�|r�d}t|��nd}|
|kr�dj|
�}t|��|||
<q,Wntdd�|D��}tj|�|_
||_dS)	z�Constructs Signature from the given list of Parameter
        objects and 'return_annotation'.  All arguments are optional.
        NFz7wrong parameter order: {} parameter before {} parameterz-non-default argument follows default argumentTzduplicate parameter name: {!r}css|]}|j|fVqdS)N)rD)rZr3r
r
rr��
sz%Signature.__init__.<locals>.<genexpr>)rr(rCrirDrurrtr)r*r�r
�MappingProxyTyperr)r�r&r$r�r�Ztop_kindZ
kind_defaults�idxr3rirDrTr
r
rr��
s>






zSignature.__init__cCstjdtdd�t||�S)z�Constructs Signature for the given python function.

        Deprecated since Python 3.5, use `Signature.from_callable()`.
        z_inspect.Signature.from_function() is deprecated since Python 3.5, use Signature.from_callable()r�)r)rrrr�)r[rvr
r
r�
from_function�
s
zSignature.from_functioncCstjdtdd�t||�S)z�Constructs Signature for the given builtin function.

        Deprecated since Python 3.5, use `Signature.from_callable()`.
        z^inspect.Signature.from_builtin() is deprecated since Python 3.5, use Signature.from_callable()r�)r)rrrr�)r[rvr
r
r�from_builtin�
s
zSignature.from_builtin)�follow_wrappedcCst|||d�S)z3Constructs Signature for the given callable object.)r r)r")r[rhr!r
r
r�
from_callable�
szSignature.from_callablecCs|jS)N)r)r�r
r
rr&szSignature.parameterscCs|jS)N)r)r�r
r
rr$szSignature.return_annotation)r&r$cCs0|tkr|jj�}|tkr |j}t|�||d�S)z�Creates a customized copy of the Signature.
        Pass 'parameters' and/or 'return_annotation' arguments
        to override them in the new copy.
        )r$)r�r&r'rr)r�r&r$r
r
rr9	s
zSignature.replacecCs8tdd�|jj�D��}dd�|jj�D�}|||jfS)Ncss|]}|jtkr|VqdS)N)rir,)rZr3r
r
rr�sz(Signature._hash_basis.<locals>.<genexpr>cSsi|]}|jtkr||j�qSr
)rir,rD)rZr3r
r
rr]sz)Signature._hash_basis.<locals>.<dictcomp>)rar&r'r$)r�r��
kwo_paramsr
r
r�_hash_basisszSignature._hash_basiscCs(|j�\}}}t|j��}t|||f�S)N)r$�	frozensetr'r)r�r�r#r$r
r
rr
!szSignature.__hash__cCs*||krdSt|t�stS|j�|j�kS)NT)r	r#rr$)r�rr
r
rr&s

zSignature.__eq__F)r�cCs�t�}t|jj��}f}t|�}�xxyt|�}Wn�tk
r�yt|�}	Wntk
rbPYn�X|	jtkrrPn�|	j|kr�|	jt	kr�d}
|
j
|	jd�}
t|
�d�|	f}PnH|	jtks�|	j
tk	r�|	f}Pn*|r�|	f}Pnd}
|
j
|	jd�}
t|
�d�Yq$Xyt|�}	Wn tk
�r&td�d�Yq$X|	jttfk�rBtd�d�|	jtk�rn|g}|j|�t|�||	j<P|	j|k�r�tdj
|	jd��d�|||	j<q$Wd}x�tj||�D]�}	|	jtk�r�|	}�q�|	jtk�r֐q�|	j}
y|j|
�}WnHtk
�r2|�r.|	jtk�r.|	j
tk�r.tdj
|
d��d�Yn(X|	jt	k�rRtdj
|	jd���|||
<�q�W|�r�|dk	�r||||j<ntdj
tt|��d���|j||�S)z#Private method. Don't use directly.zA{arg!r} parameter is positional only, but was passed as a keyword)r@Nz$missing a required argument: {arg!r}ztoo many positional argumentsz$multiple values for argument {arg!r}z*got an unexpected keyword argument {arg!r})rr�r&r'r��
StopIterationrir+rDr(rur�r-r*r�r,rrar��chainr�rg�_bound_arguments_cls)r�rrr�r�r&Z
parameters_exZarg_valsZarg_valr3rTr'Zkwargs_paramr�r
r
r�_bind-s�







zSignature._bindcOs|dj|dd�|�S)z�Get a BoundArguments object, that maps the passed `args`
        and `kwargs` to the function's signature.  Raises `TypeError`
        if the passed arguments can not be bound.
        rrN)r))rrr
r
r�bind�szSignature.bindcOs|dj|dd�|dd�S)z�Get a BoundArguments object, that partially maps the
        passed `args` and `kwargs` to the function's signature.
        Raises `TypeError` if the passed arguments can not be bound.
        rrNT)r�)r))rrr
r
rr��szSignature.bind_partialcCs t|�t|jj��fd|jifS)Nr)rrarr'r)r�r
r
rr�szSignature.__reduce__cCs|d|_dS)Nr)r)r�rr
r
rr	�szSignature.__setstate__cCsdj|jj|�S)Nz<{} {}>)rur�r�)r�r
r
rr�szSignature.__repr__c	Cs�g}d}d}xr|jj�D]d}t|�}|j}|tkr8d}n|rJ|jd�d}|tkrXd}n|tkrr|rr|jd�d}|j|�qW|r�|jd�djdj	|��}|j
tk	r�t|j
�}|dj|�7}|S)NFTr�r=z({})z, z -> {})
r&r'r�rir(rNr+r,rur�r$r�r:)	r�rfZrender_pos_only_separatorZrender_kw_only_separatorr3r
riZrenderedZannor
r
rr��s0




zSignature.__str__)rr)N)r�r�r�r�rr�r�rr(r�r%r�rerr r"r^r&r$r�r9r$r
rr)r*r�rr	rr�r
r
r
rr#�
s26	r#)r!cCstj||d�S)z/Get a signature object for the passed callable.)r!)r#r")rhr!r
r
rr��sr�cCs�ddl}ddl}|j�}|jddd�|jdddd	d
�|j�}|j}|jd�\}}}y|j|�}}	WnLtk
r�}
z0dj	|t
|
�j|
�}t|t
jd
�td�WYdd}
~
XnX|r�|jd�}|	}x|D]}
t||
�}q�W|	jt
jk�rtdt
jd
�td�|j�r�tdj	|��tdj	t|	���tdj	|	j��||	k�rxtdj	t|	j���t|	d��r�tdj	|	j��n6yt|�\}}Wntk
�r�YnXtdj	|��td�ntt|��dS)z6 Logic for inspecting an object given at command line rNrzCThe object to be analysed. It supports the 'module:qualname' syntax)�helpz-dz	--details�
store_truez9Display info about the module rather than its source code)�actionr+r�zFailed to import {} ({}: {}))r�r�r}z#Can't get info for builtin modules.rz
Target: {}z
Origin: {}z
Cached: {}z
Loader: {}�__path__zSubmodule search path: {}zLine: {}r�)�argparser��ArgumentParser�add_argument�
parse_argsr�	partition�
import_modulerbrurr��printrq�stderr�exitr�rB�builtin_module_namesZdetailsr��
__cached__r8r�rr.r�r�)r/r��parserr�targetZmod_nameZ	has_attrsZattrsrhr�rgrT�parts�part�__ror
r
r�_main�sV



r?r�)rri)N)N)N)F)N)r)r6)r)r)r)r)T)T)�r��
__author__r.r�Zdis�collections.abcr-�enum�importlib.machineryr�r�r�r�r�rqr�r�r
rr�r��operatorrrr�globalsZmod_dictZCOMPILER_FLAG_NAMESrArVrWr=rrrrrrrrrr#r$r%r'r)r+r0r2r4r6r8r9rGrXrYrjrJrxr|r�r�r�r�r�r�r�r�r�r�r�r�r�rbr�r�r�r�r�r�rrrrrrrrr4r7r:r<r�rIrLrSrUrYrZrirjrqrr�_fieldsrsrwrzr|r}rrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�Z_WrapperDescriptor�allZ_MethodWrapperr�r@Z_ClassMethodWrapperr7r�r�r�r�r�r�r�r�r�r�r�r"r�r��IntEnumr�r�r(r�r)r�r+r�r,r�r-Z_PARAM_NAME_MAPPING�__getitem__rr�rr#r�r?r�r
r
r
r�<module>sf	



	
	
,
t$
;
	
.I-7





[


	(>
5

 


		0

LHRHk:
decimal.cpython-36.opt-1.pyc000064400000000541150335715140011533 0ustar003


 \@�@svy0ddlTddlmZddlmZddlmZWn@ek
rpddlTddlmZddlmZddlmZYnXdS)�)�*)�__doc__)�__version__)�__libmpdec_version__N)Z_decimalrrr�ImportErrorZ
_pydecimal�rr�/usr/lib64/python3.6/decimal.py�<module>sselectors.cpython-36.opt-2.pyc000064400000032633150335715140012150 0ustar003


 \�K�@s�ddlmZmZddlmZmZddlZddlZddlZd(Z	d)Z
dd�Zeddd	d
dg�Zde_
ejd*kr�dej_
dej_
dej_
dej_
Gdd�de�ZGdd�ded�ZGdd�de�ZGdd�de�Zeed�r�Gdd�de�Zeed��rGd d!�d!e�Zeed"��rGd#d$�d$e�Zeed%��r:Gd&d'�d'e�Zd'e�k�rLeZn:d!e�k�r^eZn(d$e�k�rpeZnde�k�r�eZneZdS)+�)�ABCMeta�abstractmethod)�
namedtuple�MappingN�c
Csft|t�r|}n<yt|j��}Wn*tttfk
rJtdj|��d�YnX|dkrbtdj|���|S)NzInvalid file object: {!r}rzInvalid file descriptor: {})�
isinstance�int�fileno�AttributeError�	TypeError�
ValueError�format)�fileobj�fd�r�!/usr/lib64/python3.6/selectors.py�_fileobj_to_fds
r�SelectorKeyrr�events�dataz�SelectorKey(fileobj, fd, events, data)

    Object used to associate a file object to its backing
    file descriptor, selected event mask, and attached data.
��zFile object registered.zUnderlying file descriptor.z3Events that must be waited for on this file object.zzOptional opaque data associated to this file object.
    For example, this could be used to store a per-client session ID.c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_SelectorMappingcCs
||_dS)N)�	_selector)�selfZselectorrrr�__init__>sz_SelectorMapping.__init__cCst|jj�S)N)�lenr�
_fd_to_key)rrrr�__len__Asz_SelectorMapping.__len__cCsBy|jj|�}|jj|Stk
r<tdj|��d�YnXdS)Nz{!r} is not registered)r�_fileobj_lookupr�KeyErrorr
)rrrrrr�__getitem__Ds
z_SelectorMapping.__getitem__cCst|jj�S)N)�iterrr)rrrr�__iter__Ksz_SelectorMapping.__iter__N)�__name__�
__module__�__qualname__rrr!r#rrrrr;src@sjeZdZeddd��Zedd��Zddd�Zeddd	��Zd
d�Zdd
�Z	edd��Z
dd�Zdd�ZdS)�BaseSelectorNcCst�dS)N)�NotImplementedError)rrrrrrr�register^szBaseSelector.registercCst�dS)N)r()rrrrr�
unregisteruszBaseSelector.unregistercCs|j|�|j|||�S)N)r*r))rrrrrrr�modify�s
zBaseSelector.modifycCst�dS)N)r()r�timeoutrrr�select�szBaseSelector.selectcCsdS)Nr)rrrr�close�szBaseSelector.closecCsJ|j�}|dkrtd��y||Stk
rDtdj|��d�YnXdS)NzSelector is closedz{!r} is not registered)�get_map�RuntimeErrorr r
)rr�mappingrrr�get_key�szBaseSelector.get_keycCst�dS)N)r()rrrrr/�szBaseSelector.get_mapcCs|S)Nr)rrrr�	__enter__�szBaseSelector.__enter__cGs|j�dS)N)r.)r�argsrrr�__exit__�szBaseSelector.__exit__)N)N)N)
r$r%r&rr)r*r+r-r.r2r/r3r5rrrrr'Os
r')�	metaclassc@sPeZdZdd�Zdd�Zddd�Zdd	�Zdd
d�Zdd
�Zdd�Z	dd�Z
dS)�_BaseSelectorImplcCsi|_t|�|_dS)N)rr�_map)rrrrr�sz_BaseSelectorImpl.__init__cCsHyt|�Stk
rBx"|jj�D]}|j|kr$|jSq$W�YnXdS)N)rrr�valuesrr)rr�keyrrrr�s	

z!_BaseSelectorImpl._fileobj_lookupNcCsd|s|ttB@r"tdj|���t||j|�||�}|j|jkrTtdj||j���||j|j<|S)NzInvalid events: {!r}z"{!r} (FD {}) is already registered)	�
EVENT_READ�EVENT_WRITErr
rrrrr )rrrrr:rrrr)�sz_BaseSelectorImpl.registercCs@y|jj|j|��}Wn$tk
r:tdj|��d�YnX|S)Nz{!r} is not registered)r�poprr r
)rrr:rrrr*�s
z_BaseSelectorImpl.unregistercCs�y|j|j|�}Wn$tk
r8tdj|��d�YnX||jkr^|j|�|j|||�}n"||jkr�|j|d�}||j|j	<|S)Nz{!r} is not registered)r)
rrr r
rr*r)r�_replacer)rrrrr:rrrr+�s


z_BaseSelectorImpl.modifycCs|jj�d|_dS)N)r�clearr8)rrrrr.s
z_BaseSelectorImpl.closecCs|jS)N)r8)rrrrr/sz_BaseSelectorImpl.get_mapcCs$y
|j|Stk
rdSXdS)N)rr )rrrrr�_key_from_fds	
z_BaseSelectorImpl._key_from_fd)N)N)r$r%r&rrr)r*r+r.r/r@rrrrr7�s


r7cs\eZdZ�fdd�Zd
�fdd�	Z�fdd�ZejdkrDdd	d
�Zne	j	Zddd�Z	�Z
S)�SelectSelectorcst�j�t�|_t�|_dS)N)�superr�set�_readers�_writers)r)�	__class__rrr%s
zSelectSelector.__init__Ncs@t�j|||�}|t@r&|jj|j�|t@r<|jj|j�|S)N)rBr)r;rD�addrr<rE)rrrrr:)rFrrr)*szSelectSelector.registercs,t�j|�}|jj|j�|jj|j�|S)N)rBr*rD�discardrrE)rrr:)rFrrr*2szSelectSelector.unregisterZwin32cCs$tj||||�\}}}|||gfS)N)r-)r�r�w�_r,�xrrr�_select9szSelectSelector._selectc	
Cs�|dkrdnt|d�}g}y|j|j|jg|�\}}}Wntk
rL|SXt|�}t|�}xV||BD]J}d}||kr�|tO}||kr�|tO}|j|�}|rh|j	|||j
@f�qhW|S)Nr)�maxrMrDrE�InterruptedErrorrCr;r<r@�appendr)	rr,�readyrIrJrKrrr:rrrr-?s$
zSelectSelector.select)N)N)N)r$r%r&rr)r*�sys�platformrMr-�
__classcell__rr)rFrrA"s
rA�pollcs@eZdZ�fdd�Zd
�fdd�	Z�fdd�Zddd	�Z�ZS)�PollSelectorcst�j�tj�|_dS)N)rBrr-rU�_poll)r)rFrrrZs
zPollSelector.__init__NcsLt�j|||�}d}|t@r&|tjO}|t@r8|tjO}|jj|j|�|S)Nr)	rBr)r;r-�POLLINr<�POLLOUTrWr)rrrrr:�poll_events)rFrrr)^s

zPollSelector.registercst�j|�}|jj|j�|S)N)rBr*rWr)rrr:)rFrrr*hszPollSelector.unregisterc
Cs�|dkrd}n|dkrd}ntj|d�}g}y|jj|�}Wntk
rR|SXx^|D]V\}}d}|tj@rz|tO}|tj@r�|t	O}|j
|�}|rZ|j|||j@f�qZW|S)Nrg@�@)
�math�ceilrWrUrOr-rXr<rYr;r@rPr)rr,rQ�
fd_event_listr�eventrr:rrrr-ms(
zPollSelector.select)N)N)r$r%r&rr)r*r-rTrr)rFrrVWs
rV�epollcsTeZdZ�fdd�Zdd�Zd�fdd�	Z�fdd	�Zdd
d�Z�fdd
�Z�Z	S)�
EpollSelectorcst�j�tj�|_dS)N)rBrr-r_�_epoll)r)rFrrr�s
zEpollSelector.__init__cCs
|jj�S)N)rar	)rrrrr	�szEpollSelector.filenoNcstt�j|||�}d}|t@r&|tjO}|t@r8|tjO}y|jj|j|�Wn"t	k
rnt�j
|��YnX|S)Nr)rBr)r;r-�EPOLLINr<�EPOLLOUTrar�
BaseExceptionr*)rrrrr:Zepoll_events)rFrrr)�s

zEpollSelector.registercs8t�j|�}y|jj|j�Wntk
r2YnX|S)N)rBr*rar�OSError)rrr:)rFrrr*�szEpollSelector.unregisterc	
Cs�|dkrd}n |dkrd}ntj|d�d}tt|j�d�}g}y|jj||�}Wntk
rh|SXx^|D]V\}}d}|tj	@r�|t
O}|tj@r�|tO}|j
|�}|rp|j|||j@f�qpW|S)Nrrg@�@g����MbP?���)r[r\rNrrrarUrOr-rbr<rcr;r@rPr)	rr,�max_evrQr]rr^rr:rrrr-�s*
zEpollSelector.selectcs|jj�t�j�dS)N)rar.rB)r)rFrrr.�s
zEpollSelector.close)N)N)
r$r%r&rr	r)r*r-r.rTrr)rFrr`�s

 r`�devpollcsTeZdZ�fdd�Zdd�Zd�fdd�	Z�fdd	�Zdd
d�Z�fdd
�Z�Z	S)�DevpollSelectorcst�j�tj�|_dS)N)rBrr-rh�_devpoll)r)rFrrr�s
zDevpollSelector.__init__cCs
|jj�S)N)rjr	)rrrrr	�szDevpollSelector.filenoNcsLt�j|||�}d}|t@r&|tjO}|t@r8|tjO}|jj|j|�|S)Nr)	rBr)r;r-rXr<rYrjr)rrrrr:rZ)rFrrr)�s

zDevpollSelector.registercst�j|�}|jj|j�|S)N)rBr*rjr)rrr:)rFrrr*�szDevpollSelector.unregisterc
Cs�|dkrd}n|dkrd}ntj|d�}g}y|jj|�}Wntk
rR|SXx^|D]V\}}d}|tj@rz|tO}|tj@r�|t	O}|j
|�}|rZ|j|||j@f�qZW|S)Nrg@�@)
r[r\rjrUrOr-rXr<rYr;r@rPr)rr,rQr]rr^rr:rrrr-�s(
zDevpollSelector.selectcs|jj�t�j�dS)N)rjr.rB)r)rFrrr.s
zDevpollSelector.close)N)N)
r$r%r&rr	r)r*r-r.rTrr)rFrri�s

ri�kqueuecsTeZdZ�fdd�Zdd�Zd�fdd�	Z�fdd	�Zdd
d�Z�fdd
�Z�Z	S)�KqueueSelectorcst�j�tj�|_dS)N)rBrr-rk�_kqueue)r)rFrrrs
zKqueueSelector.__init__cCs
|jj�S)N)rmr	)rrrrr	szKqueueSelector.filenoNcs�t�j|||�}y`|t@r@tj|jtjtj�}|jj	|gdd�|t
@rntj|jtjtj�}|jj	|gdd�Wn"tk
r�t�j
|��YnX|S)Nr)rBr)r;r-�keventr�KQ_FILTER_READZ	KQ_EV_ADDrm�controlr<�KQ_FILTER_WRITErdr*)rrrrr:�kev)rFrrr)szKqueueSelector.registercs�t�j|�}|jt@rVtj|jtjtj�}y|j	j
|gdd�Wntk
rTYnX|jt@r�tj|jtj
tj�}y|j	j
|gdd�Wntk
r�YnX|S)Nr)rBr*rr;r-rnrroZKQ_EV_DELETErmrprer<rq)rrr:rr)rFrrr*'s 

zKqueueSelector.unregisterc

Cs�|dkrdnt|d�}t|j�}g}y|jjd||�}Wntk
rL|SXxb|D]Z}|j}|j}d}|tj	krz|t
O}|tjkr�|tO}|j
|�}	|	rT|j|	||	j@f�qTW|S)Nr)rNrrrmrprOZident�filterr-ror;rqr<r@rPr)
rr,rgrQZkev_listrrr�flagrr:rrrr-<s&




zKqueueSelector.selectcs|jj�t�j�dS)N)rmr.rB)r)rFrrr.Rs
zKqueueSelector.close)N)N)
r$r%r&rr	r)r*r-r.rTrr)rFrrl
s
rlr�)rr)�abcrr�collectionsrrr[r-rRr;r<rr�__doc__�version_inforrrrrr'r7rA�hasattrrVr`rirl�globalsZDefaultSelectorrrrr�<module>sF
~U3
1G8M_bootlocale.cpython-36.opt-1.pyc000064400000001672150335715140012425 0ustar003


 \�@sddZddlZddlZejjd�r,d	dd�Zn4y
ejWnek
rTd
dd�ZYnXddd�ZdS)z�A minimal subset of the locale module used at interpreter startup
(imported by the _io module), in order to reduce startup time.

Don't import directly from third-party code; use the `locale` module instead!
�N�winTcCstj�dS)N�)�_localeZ_getdefaultlocale)�do_setlocale�r�#/usr/lib64/python3.6/_bootlocale.py�getpreferredencodingsrcCsddl}|j|�S)Nr)�localer)rr	rrrrscCs$tjtj�}|r tjdkr d}|S)N�darwinzUTF-8)r�nl_langinfo�CODESET�sys�platform)r�resultrrrrs)T)T)T)�__doc__r
rr�
startswithrr�AttributeErrorrrrr�<module>s
ast.cpython-36.opt-1.pyc000064400000026672150335715140010741 0ustar003


 \�/�@s�dZddlTd!dd�ZeeefZdd�Zd"dd�Zd
d�Z	dd�Z
d#dd�Zdd�Zdd�Z
d$dd�Zdd�ZGdd�de�ZGdd�de�Zd S)%aH
    ast
    ~~~

    The `ast` module helps Python applications to process trees of the Python
    abstract syntax grammar.  The abstract syntax itself might change with
    each Python release; this module helps to find out programmatically what
    the current grammar looks like and allows modifications of it.

    An abstract syntax tree can be generated by passing `ast.PyCF_ONLY_AST` as
    a flag to the `compile()` builtin function or by using the `parse()`
    function from this module.  The result will be a tree of objects whose
    classes all inherit from `ast.AST`.

    A modified abstract syntax tree can be compiled into a Python code object
    using the built-in `compile()` function.

    Additionally various helper functions are provided that make working with
    the trees simpler.  The main intention of the helper functions and this
    module in general is to provide an easy to use interface for libraries
    that work tightly with the python syntax (template engines for example).


    :copyright: Copyright 2008 by Armin Ronacher.
    :license: Python License.
�)�*�	<unknown>�execcCst|||t�S)zn
    Parse the source into an AST node.
    Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
    )�compileZ
PyCF_ONLY_AST)�source�filename�mode�r	�/usr/lib64/python3.6/ast.py�parsesrcs:t|t�rt|dd�}t|t�r&|j}�fdd���|�S)a
    Safely evaluate an expression node or a string containing a Python
    expression.  The string or node provided may only consist of the following
    Python literal structures: strings, bytes, numbers, tuples, lists, dicts,
    sets, booleans, and None.
    �eval)rcs�t|t�r|jSt|ttf�r$|jSt|t�r4|jSt|t�rNt	t
�|j��St|t�rht
t
�|j��St|t�r�tt
�|j��St|t�r�t�fdd�t|j|j�D��St|t�r�|jSt|t�o�t|jttf��r
�|j�}t|t��rrt|jt��r|
S|Snht|t��rrt|jttf��rr�|j�}�|j �}t|t��rrt|t��rrt|jt��rj||S||St!dt"|���dS)Nc3s"|]\}}�|��|�fVqdS)Nr	)�.0�k�v)�_convertr	r
�	<genexpr>Asz1literal_eval.<locals>._convert.<locals>.<genexpr>zmalformed node or string: )#�
isinstance�Constant�value�StrZBytes�sZNum�nZTuple�tuple�mapZeltsZList�list�Set�setZDict�dict�zip�keys�valuesZNameConstantZUnaryOp�opZUAddZUSub�operand�
_NUM_TYPESZBinOpZAddZSub�left�right�
ValueError�repr)�noder"r$r%)rr	r
r3s>









zliteral_eval.<locals>._convert)r�strrZ
Expression�body)Znode_or_stringr	)rr
�literal_eval(s

"r+TFcs2���fdd��t|t�s*td|jj���|�S)a�
    Return a formatted dump of the tree in *node*.  This is mainly useful for
    debugging purposes.  The returned string will show the names and the values
    for fields.  This makes the code impossible to evaluate, so if evaluation is
    wanted *annotate_fields* must be set to False.  Attributes such as line
    numbers and column offsets are not dumped by default.  If this is wanted,
    *include_attributes* can be set to True.
    cs�t�t�r��fdd�t��D�}d�jjdj�r>dd�|D�ndd�|D��f}�r��jr�||rfdphd7}|dj��fd	d��jD��7}|d
St�t�r�ddj�fdd��D��St��S)
Ncsg|]\}}|�|�f�qSr	r	)r
�a�b)�_formatr	r
�
<listcomp>csz)dump.<locals>._format.<locals>.<listcomp>z%s(%sz, css|]}d|VqdS)z%s=%sNr	)r
�fieldr	r	r
resz(dump.<locals>._format.<locals>.<genexpr>css|]\}}|VqdS)Nr	)r
r,r-r	r	r
rgs� c3s$|]}d|�t�|��fVqdS)z%s=%sN)�getattr)r
r,)r.r(r	r
rks�)z[%s]c3s|]}�|�VqdS)Nr	)r
�x)r.r	r
ros)	r�AST�iter_fields�	__class__�__name__�join�_attributesrr')r(Zfields�rv)r.�annotate_fields�include_attributes)r(r
r.as


zdump.<locals>._formatzexpected AST, got %r)rr5�	TypeErrorr7r8)r(r<r=r	)r.r<r=r
�dumpXs	
r?cCsBx<dD]4}||jkr||jkrt||�rt||t||��qW|S)z�
    Copy source location (`lineno` and `col_offset` attributes) from
    *old_node* to *new_node* if possible, and return *new_node*.
    �lineno�
col_offset)r@rA)r:�hasattr�setattrr2)�new_nodeZold_node�attrr	r	r
�
copy_locationvs


rFcs�fdd���|dd�|S)a{
    When you compile a node tree with compile(), the compiler expects lineno and
    col_offset attributes for every node that supports them.  This is rather
    tedious to fill in for generated nodes, so this helper adds these attributes
    recursively where not already set, by setting them to the values of the
    parent node.  It works recursively starting at *node*.
    csfd|jkr"t|d�s||_n|j}d|jkrDt|d�s>||_n|j}xt|�D]}�|||�qNWdS)Nr@rA)r:rBr@rA�iter_child_nodes)r(r@rA�child)�_fixr	r
rI�s



z#fix_missing_locations.<locals>._fix�rr	)r(r	)rIr
�fix_missing_locations�s
rKrJcCs2x,t|�D] }d|jkr
t|dd�||_q
W|S)z�
    Increment the line number of each node in the tree starting at *node* by *n*.
    This is useful to "move code" to a different location in a file.
    r@r)�walkr:r2r@)r(rrHr	r	r
�increment_lineno�s
rMccs>x8|jD].}y|t||�fVWqtk
r4YqXqWdS)zs
    Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
    that is present on *node*.
    N)�_fieldsr2�AttributeError)r(r0r	r	r
r6�s
r6ccsTxNt|�D]B\}}t|t�r$|Vq
t|t�r
x|D]}t|t�r4|Vq4Wq
WdS)z�
    Yield all direct child nodes of *node*, that is, all fields that are nodes
    and all items of fields that are lists of nodes.
    N)r6rr5r)r(�namer0�itemr	r	r
rG�s



rGcCs�t|ttttf�s"td|jj��|jo6t|jdt	�s<dS|jdj
}t|t�rZ|j}n"t|t
�rxt|j
t�rx|j
}ndS|r�ddl}|j|�}|S)z�
    Return the docstring for the given node or None if no docstring can
    be found.  If the node provided does not have docstrings a TypeError
    will be raised.
    z%r can't have docstringsrN)rZAsyncFunctionDefZFunctionDefZClassDefZModuler>r7r8r*ZExprrrrrr)�inspectZcleandoc)r(Zclean�textrRr	r	r
�
get_docstring�s

rTccs@ddlm}||g�}x$|r:|j�}|jt|��|VqWdS)z�
    Recursively yield all descendant nodes in the tree starting at *node*
    (including *node* itself), in no specified order.  This is useful if you
    only want to modify nodes in place and don't care about the context.
    r)�dequeN)�collectionsrU�popleft�extendrG)r(rUZtodor	r	r
rL�s
rLc@s eZdZdZdd�Zdd�ZdS)�NodeVisitora<
    A node visitor base class that walks the abstract syntax tree and calls a
    visitor function for every node found.  This function may return a value
    which is forwarded by the `visit` method.

    This class is meant to be subclassed, with the subclass adding visitor
    methods.

    Per default the visitor functions for the nodes are ``'visit_'`` +
    class name of the node.  So a `TryFinally` node visit function would
    be `visit_TryFinally`.  This behavior can be changed by overriding
    the `visit` method.  If no visitor function exists for a node
    (return value `None`) the `generic_visit` visitor is used instead.

    Don't use the `NodeVisitor` if you want to apply changes to nodes during
    traversing.  For this a special visitor exists (`NodeTransformer`) that
    allows modifications.
    cCs"d|jj}t|||j�}||�S)z
Visit a node.Zvisit_)r7r8r2�
generic_visit)�selfr(�methodZvisitorr	r	r
�visit�szNodeVisitor.visitcCs\xVt|�D]J\}}t|t�r@x6|D]}t|t�r"|j|�q"Wq
t|t�r
|j|�q
WdS)z9Called if no explicit visitor function exists for a node.N)r6rrr5r])r[r(r0rrQr	r	r
rZ�s



zNodeVisitor.generic_visitN)r8�
__module__�__qualname__�__doc__r]rZr	r	r	r
rY�srYc@seZdZdZdd�ZdS)�NodeTransformera\
    A :class:`NodeVisitor` subclass that walks the abstract syntax tree and
    allows modification of nodes.

    The `NodeTransformer` will walk the AST and use the return value of the
    visitor methods to replace or remove the old node.  If the return value of
    the visitor method is ``None``, the node will be removed from its location,
    otherwise it is replaced with the return value.  The return value may be the
    original node in which case no replacement takes place.

    Here is an example transformer that rewrites all occurrences of name lookups
    (``foo``) to ``data['foo']``::

       class RewriteName(NodeTransformer):

           def visit_Name(self, node):
               return copy_location(Subscript(
                   value=Name(id='data', ctx=Load()),
                   slice=Index(value=Str(s=node.id)),
                   ctx=node.ctx
               ), node)

    Keep in mind that if the node you're operating on has child nodes you must
    either transform the child nodes yourself or call the :meth:`generic_visit`
    method for the node first.

    For nodes that were part of a collection of statements (that applies to all
    statement nodes), the visitor may also return a list of nodes rather than
    just a single node.

    Usually you use the transformer like this::

       node = YourTransformer().visit(node)
    cCs�x�t|�D]�\}}t|t�r|g}xL|D]D}t|t�r`|j|�}|dkrJq&nt|t�s`|j|�q&|j|�q&W||dd�<q
t|t�r
|j|�}|dkr�t||�q
t|||�q
W|S)N)	r6rrr5r]rX�append�delattrrC)r[r(r0Z	old_valueZ
new_valuesrrDr	r	r
rZ.s&







zNodeTransformer.generic_visitN)r8r^r_r`rZr	r	r	r
ra
s"raN)rr)TF)rJ)T)r`Z_astr�int�float�complexr#r+r?rFrKrMr6rGrTrL�objectrYrar	r	r	r
�<module>s

0


%xdrlib.cpython-36.pyc000064400000020160150335715140010461 0ustar003


 \�@sxdZddlZddlmZddlmZddddgZGd	d�de�ZGd
d�de�Z	dd�Z
Gd
d�d�ZGdd�d�ZdS)zRImplements (a subset of) Sun XDR -- eXternal Data Representation.

See: RFC 1014

�N)�BytesIO)�wraps�Error�Packer�Unpacker�ConversionErrorc@s(eZdZdZdd�Zdd�Zdd�ZdS)	rz�Exception class for this module. Use:

    except xdrlib.Error as var:
        # var has the Error instance for the exception

    Public ivars:
        msg -- contains the message

    cCs
||_dS)N)�msg)�selfr�r
�/usr/lib64/python3.6/xdrlib.py�__init__szError.__init__cCs
t|j�S)N)�reprr)r	r
r
r�__repr__szError.__repr__cCs
t|j�S)N)�strr)r	r
r
r�__str__sz
Error.__str__N)�__name__�
__module__�__qualname__�__doc__rrrr
r
r
rrs	c@seZdZdS)rN)rrrr
r
r
rr scst���fdd��}|S)z5 Wrap any raised struct.errors in a ConversionError. csDy
�||�Stjk
r>}zt|jd�d�WYdd}~XnXdS)Nr)�struct�errorr�args)r	�value�e)�functionr
r�result&s
z&raise_conversion_error.<locals>.result)r)rrr
)rr�raise_conversion_error#src@s�eZdZdZdd�Zdd�Zdd�ZeZedd	��Z	ed
d��Z
e
Zdd
�Zdd�Z
e
Zedd��Zedd��Zdd�ZeZdd�ZeZeZdd�Zdd�Zdd�ZdS)rz0Pack various data representations into a buffer.cCs|j�dS)N)�reset)r	r
r
rr2szPacker.__init__cCst�|_dS)N)r�_Packer__buf)r	r
r
rr5szPacker.resetcCs
|jj�S)N)r�getvalue)r	r
r
r�
get_buffer8szPacker.get_buffercCs|jjtjd|��dS)Nz>L)r�writer�pack)r	�xr
r
r�	pack_uint=szPacker.pack_uintcCs|jjtjd|��dS)Nz>l)rr!rr")r	r#r
r
r�pack_intAszPacker.pack_intcCs"|r|jjd�n|jjd�dS)Nss)rr!)r	r#r
r
r�	pack_boolGszPacker.pack_boolcCs�y|j|d?d@�Wn8ttjfk
rN}zt|jd�d�WYdd}~XnXy|j|d@�Wn8ttjfk
r�}zt|jd�d�WYdd}~XnXdS)N� l��r)r$�	TypeErrorrrrr)r	r#rr
r
r�pack_uhyperKs"zPacker.pack_uhypercCs|jjtjd|��dS)Nz>f)rr!rr")r	r#r
r
r�
pack_floatWszPacker.pack_floatcCs|jjtjd|��dS)Nz>d)rr!rr")r	r#r
r
r�pack_double[szPacker.pack_doublecCsP|dkrtd��|d|�}|ddd}||t|�d}|jj|�dS)Nrz fstring size must be nonnegative���)�
ValueError�lenrr!)r	�n�s�datar
r
r�pack_fstring_szPacker.pack_fstringcCs"t|�}|j|�|j||�dS)N)r0r$r4)r	r2r1r
r
r�pack_stringis
zPacker.pack_stringcCs.x|D]}|jd�||�qW|jd�dS)N�r)r$)r	�list�	pack_item�itemr
r
r�	pack_listqs

zPacker.pack_listcCs.t|�|krtd��x|D]}||�qWdS)Nzwrong array size)r0r/)r	r1r7r8r9r
r
r�pack_farrayws
zPacker.pack_farraycCs$t|�}|j|�|j|||�dS)N)r0r$r;)r	r7r8r1r
r
r�
pack_array}s
zPacker.pack_arrayN)rrrrrrr Zget_bufrr$r%Z	pack_enumr&r)Z
pack_hyperr*r+r4Zpack_fopaquer5Zpack_opaqueZ
pack_bytesr:r;r<r
r
r
rr/s*
c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZeZdd�Z
dd�Zdd�Zdd�Zdd�Zdd�ZeZdd�ZeZeZd d!�Zd"d#�Zd$d%�Zd&S)'rz;Unpacks various data representations from the given buffer.cCs|j|�dS)N)r)r	r3r
r
rr�szUnpacker.__init__cCs||_d|_dS)Nr)�_Unpacker__buf�_Unpacker__pos)r	r3r
r
rr�szUnpacker.resetcCs|jS)N)r>)r	r
r
r�get_position�szUnpacker.get_positioncCs
||_dS)N)r>)r	Zpositionr
r
r�set_position�szUnpacker.set_positioncCs|jS)N)r=)r	r
r
rr �szUnpacker.get_buffercCs|jt|j�krtd��dS)Nzunextracted data remains)r>r0r=r)r	r
r
r�done�sz
Unpacker.donecCsB|j}|d|_}|j||�}t|�dkr2t�tjd|�dS)Nr-z>Lr)r>r=r0�EOFErrorr�unpack)r	�i�jr3r
r
r�unpack_uint�szUnpacker.unpack_uintcCsB|j}|d|_}|j||�}t|�dkr2t�tjd|�dS)Nr-z>lr)r>r=r0rBrrC)r	rDrEr3r
r
r�
unpack_int�szUnpacker.unpack_intcCst|j��S)N)�boolrG)r	r
r
r�unpack_bool�szUnpacker.unpack_boolcCs |j�}|j�}t|�d>|BS)Nr')rF�int)r	�hi�lor
r
r�
unpack_uhyper�szUnpacker.unpack_uhypercCs|j�}|dkr|d}|S)Nll)rM)r	r#r
r
r�unpack_hyper�szUnpacker.unpack_hypercCsB|j}|d|_}|j||�}t|�dkr2t�tjd|�dS)Nr-z>fr)r>r=r0rBrrC)r	rDrEr3r
r
r�unpack_float�szUnpacker.unpack_floatcCsB|j}|d|_}|j||�}t|�dkr2t�tjd|�dS)N�z>dr)r>r=r0rBrrC)r	rDrEr3r
r
r�
unpack_double�szUnpacker.unpack_doublecCsT|dkrtd��|j}||ddd}|t|j�kr<t�||_|j|||�S)Nrz fstring size must be nonnegativer,r-)r/r>r0r=rB)r	r1rDrEr
r
r�unpack_fstring�szUnpacker.unpack_fstringcCs|j�}|j|�S)N)rFrR)r	r1r
r
r�
unpack_string�szUnpacker.unpack_stringcCsFg}x<|j�}|dkrP|dkr.td|f��|�}|j|�qW|S)Nrr6z0 or 1 expected, got %r)rFr�append)r	�unpack_itemr7r#r9r
r
r�unpack_list�szUnpacker.unpack_listcCs&g}xt|�D]}|j|��qW|S)N)�rangerT)r	r1rUr7rDr
r
r�
unpack_farray�szUnpacker.unpack_farraycCs|j�}|j||�S)N)rFrX)r	rUr1r
r
r�unpack_array�szUnpacker.unpack_arrayN)rrrrrrr?r@r rArFrGZunpack_enumrIrMrNrOrQrRZunpack_fopaquerSZ
unpack_opaqueZunpack_bytesrVrXrYr
r
r
rr�s.
)
rr�ior�	functoolsr�__all__�	Exceptionrrrrrr
r
r
r�<module>sUkeyword.cpython-36.opt-2.pyc000064400000002733150335715140011627 0ustar003


 \��!@srddgZdddddddd	d
ddd
ddddddddddddddddddd d!d"g!Zee�jZd#d$�Zed%krne�d&S)'�	iskeyword�kwlist�False�None�True�and�as�assert�break�class�continue�def�del�elif�else�except�finally�for�from�global�if�import�in�is�lambda�nonlocal�not�or�pass�raise�return�try�while�with�yieldcCs|ddl}ddl}|jdd�}|r*|dp,d}t|�dkrD|d}nd}t|dd��}|j�}WdQRX|r�|dt|dj��d�nd}t|��T}|jd�}g}	x>|D]6}
d	|
kr�|j|
�}|r�|	j	d
|j
d�d|�q�WWdQRX|	j�y0|jd|�d}|jd
|�}
|	|||
�<Wn,t
k
�rR|jjd�|jd�YnXt|ddd��}|j|�WdQRXdS)N��zPython/graminit.czLib/keyword.py�)�newline�
z	"([^"]+)"z{1, "z	        'z',z#--start keywords--z#--end keywords--z'target does not contain format markers
�w)�sys�re�argv�len�open�	readlines�strip�compile�search�append�group�sort�index�
ValueError�stderr�write�exit�
writelines)r*r+�args�iptfile�optfile�fp�format�nl�strprog�lines�line�match�start�end�rH�/usr/lib64/python3.6/keyword.py�main7s6
$



*rJ�__main__N)�__all__r�	frozenset�__contains__rrJ�__name__rHrHrHrI�<module>
sJ
&__future__.cpython-36.pyc000064400000010111150335715140011276 0ustar003


 \��	@s�dZddddddddd	g	Zd
geZdZdZd
ZdZdZdZdZ	dZ
dZGdd�d�Zed!d"e�Z
ed#d$e�Zed%d&e�Zed'd(e�Zed)d*e�Zed+d,e�Zed-d.e	�Zed/d0e
�Zed1d2e�Zd S)3afRecord of phased-in incompatible language changes.

Each line is of the form:

    FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease ","
                              CompilerFlag ")"

where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples
of the same form as sys.version_info:

    (PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int
     PY_MINOR_VERSION, # the 1; an int
     PY_MICRO_VERSION, # the 0; an int
     PY_RELEASE_LEVEL, # "alpha", "beta", "candidate" or "final"; string
     PY_RELEASE_SERIAL # the 3; an int
    )

OptionalRelease records the first release in which

    from __future__ import FeatureName

was accepted.

In the case of MandatoryReleases that have not yet occurred,
MandatoryRelease predicts the release in which the feature will become part
of the language.

Else MandatoryRelease records when the feature became part of the language;
in releases at or after that, modules no longer need

    from __future__ import FeatureName

to use the feature in question, but may continue to use such imports.

MandatoryRelease may also be None, meaning that a planned feature got
dropped.

Instances of class _Feature have two corresponding methods,
.getOptionalRelease() and .getMandatoryRelease().

CompilerFlag is the (bitfield) flag that should be passed in the fourth
argument to the builtin function compile() to enable the feature in
dynamically compiled code.  This flag is stored in the .compiler_flag
attribute on _Future instances.  These values must match the appropriate
#defines of CO_xxx flags in Include/compile.h.

No feature line is ever to be deleted from this file.
�
nested_scopes�
generators�division�absolute_import�with_statement�print_function�unicode_literals�barry_as_FLUFL�generator_stop�all_feature_names��i i@i�iiiic@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_FeaturecCs||_||_||_dS)N)�optional�	mandatory�
compiler_flag)�selfZoptionalReleaseZmandatoryReleaser�r�"/usr/lib64/python3.6/__future__.py�__init__Osz_Feature.__init__cCs|jS)z�Return first release in which this feature was recognized.

        This is a 5-tuple, of the same form as sys.version_info.
        )r)rrrr�getOptionalReleaseTsz_Feature.getOptionalReleasecCs|jS)z�Return release in which this feature will become mandatory.

        This is a 5-tuple, of the same form as sys.version_info, or, if
        the feature was dropped, is None.
        )r)rrrr�getMandatoryRelease\sz_Feature.getMandatoryReleasecCsdt|j|j|jf�S)Nr
)�reprrrr)rrrr�__repr__esz_Feature.__repr__N)�__name__�
__module__�__qualname__rrrrrrrrr
Ns	r
���beta�alpha��final���	�N)rrrrr)rrrrr)rrrrr)rr rr!r)rrrrr)r rrrr)rr"rrr)r rrrr)rr"rrr)rr#rrr)rr#rrr)r rrrr)rr#rrr)r rrrr)r rrrr)r r$rrr)r r"rrr)r r%rrr)�__doc__r
�__all__Z	CO_NESTEDZCO_GENERATOR_ALLOWEDZCO_FUTURE_DIVISIONZCO_FUTURE_ABSOLUTE_IMPORTZCO_FUTURE_WITH_STATEMENTZCO_FUTURE_PRINT_FUNCTIONZCO_FUTURE_UNICODE_LITERALSZCO_FUTURE_BARRY_AS_BDFLZCO_FUTURE_GENERATOR_STOPr
rrrrrrrrr	rrrr�<module>0s^
antigravity.cpython-36.opt-2.pyc000064400000001175150335715140012503 0ustar003


 \��@s&ddlZddlZejd�dd�ZdS)�Nzhttps://xkcd.com/353/cCs\tj|�j�}dd�|dd�|dd�fD�\}}td||dd�||dd�f�dS)NcSsg|]}dtjd|��qS)z%fz0.)�float�fromhex)�.0�x�r�#/usr/lib64/python3.6/antigravity.py�
<listcomp>szgeohash.<locals>.<listcomp>�� z	%d%s %d%s�)�hashlibZmd5Z	hexdigest�print)ZlatitudeZ	longitudeZdatedow�h�p�qrrr�geohashs&r)Z
webbrowserr�openrrrrr�<module>s
pstats.cpython-36.opt-1.pyc000064400000052543150335715140011464 0ustar003


 \�g�@sfdZddlZddlZddlZddlZddlZddlmZdgZGdd�d�Z	Gdd�d�Z
dd	�Zd
d�Zdd
�Z
dd�Zdd�Zdd�Zdd�Zedk�rbddlZyddlZWnek
r�YnXGdd�dej�Zeej�dkr�ejdZndZyTee�Zx"ejdd�D]Zeje��qWedejd�ej �edejd�Wne!k
�r`YnXdS)z3Class for printing reports on profiled python code.�N)�
cmp_to_key�Statsc@s�eZdZdZdd�dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dBdFdJdNdQdTdWdZd]dbdfdidmdqd!�Z
d"d#�Zd$d%�Zd&d'�Z
d(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zdrd9d:�Zd;d<�Zd=d>�ZdS)sra�This class is used for creating reports from data generated by the
    Profile class.  It is a "friend" of that class, and imports data either
    by direct access to members of Profile class, or by reading in a dictionary
    that was emitted (via marshal) from the Profile class.

    The big change from the previous Profiler (in terms of raw functionality)
    is that an "add()" method has been provided to combine Stats from
    several distinct profile runs.  Both the constructor and the add()
    method now take arbitrarily many file names as arguments.

    All the print methods now take an argument that indicates how many lines
    to print.  If the arg is a floating point number between 0 and 1.0, then
    it is taken as a decimal percentage of the available lines to be printed
    (e.g., .1 means print 10% of all available lines).  If it is an integer,
    it is taken to mean the number of lines of data that you wish to have
    printed.

    The sort_stats() method now processes some additional options (i.e., in
    addition to the old -1, 0, 1, or 2 that are respectively interpreted as
    'stdname', 'calls', 'time', and 'cumulative').  It takes an arbitrary number
    of quoted strings to select the sort order.

    For example sort_stats('time', 'name') sorts on the major key of 'internal
    function time', and on the minor key of 'the name of the function'.  Look at
    the two tables in sort_stats() and get_sort_arg_defs(self) for more
    examples.

    All methods return self, so you can string together commands like:
        Stats('foo', 'goo').strip_dirs().sort_stats('calls').                            print_stats(5).print_callers(5)
    N)�streamcGsF|ptj|_t|�sd}n|d}|dd�}|j|�|j|�dS)Nr�)�sys�stdoutr�len�init�add)�selfr�args�arg�r�/usr/lib64/python3.6/pstats.py�__init__As
zStats.__init__cCs�d|_g|_d|_d|_d|_d|_d|_t�|_i|_	i|_
|j|�y|j�Wn8t
k
r�td|jrx|jdnd|jd��YnXdS)NrzInvalid timing data %sr�)�file���)�all_callees�files�fcn_list�total_tt�total_calls�
prim_calls�max_name_len�set�	top_level�stats�
sort_arg_dict�
load_stats�get_top_level_stats�	Exception�printr)rr
rrrr	Ks"
z
Stats.initcCs�|dkri|_dSt|t�rxt|d��}tj|�|_WdQRXy"tj|�}tj	|j
�d|}WnYnX|g|_n t|d�r�|j
�|j|_i|_|js�td|j|f��dS)N�rbz    �create_statsz.Cannot create or construct a %r object from %r)r�
isinstance�str�open�marshal�load�os�stat�timeZctime�st_mtimer�hasattrr$�	TypeError�	__class__)rr
�fZ
file_statsrrrr^s(



zStats.load_statscCs�x~|jj�D]p\}\}}}}}|j|7_|j|7_|j|7_d|kr\|jj|�tt|��|j	krtt|��|_	qWdS)N�jprofiler�profiler)r2rr3)
r�itemsrrrrr
r�func_std_stringr)r�func�cc�nc�tt�ct�callersrrrr tszStats.get_top_level_statscGs�|s|Sx�t|�D]�}t|�t|�kr.t|�}|j|j7_|j|j7_|j|j7_|j|j7_x|jD]}|jj|�qvW|j	|j	kr�|j	|_	d|_
xJ|jj�D]<\}}||jkr�|j|}nddddif}t
||�|j|<q�WqW|S)Nr)�reversed�typerrrrrrr
rrrr4�add_func_stats)r�arg_list�itemr6r+Z
old_func_statrrrr
~s(
z	Stats.addc
Cs(t|d��}tj|j|�WdQRXdS)z:Write the profile data to a file we know how to load back.�wbN)r'r(�dumpr)r�filenamer1rrr�
dump_stats�szStats.dump_statsr�
call count��cumulative time��	file name��line number��
function name�name/file/liner�primitive call count��
standard name��
internal time)�callsZncallsZcumtime�
cumulativerrC�line�module�nameZnflZpcalls�stdnamer,ZtottimecCs�|jszi|_}i}xP|jj�D]B\}}|}x4|r`|s8P||krJd||<P|||<|dd�}q.Wq Wx|D]
}||=qlW|jS)z)Expand all abbreviations that are unique.rNrr)r�sort_arg_dict_defaultr4)r�dictZbad_list�word�tupZfragmentrrr�get_sort_arg_defs�s 


zStats.get_sort_arg_defscGs"|sd|_|St|�dkrFt|dt�rFddddddddi|dg}|j�}f}d|_d}x:|D]2}|||d}|j|||d7_d	}qbWg}xB|jj�D]4\}\}}	}
}}|j||	|
|f|t	|�|f�q�W|j
tt|�j
�d
�g|_}
x|D]}|
j|d��qW|S)
NrrrYrTr,rRrUrz, )�keyrr)rrr%�intr^�	sort_typerr4�appendr5�sortr�	TupleComp�compare)rZfieldZ
sort_arg_defsZ
sort_tupleZ	connectorr\Z
stats_listr6r7r8r9r:r;r�tuplerrr�
sort_stats�s2


zStats.sort_statscCs|jr|jj�|S)N)r�reverse)rrrr�
reverse_order�s
zStats.reverse_ordercCs�|j}i|_}d}x�|j�D]�\}\}}}}}	t|�}
tt|
��|krTtt|
��}i}x |	j�D]\}}
|
|t|�<qbW|
|kr�t||
|||||f�||
<q|||||f||
<qW|j}t�|_}x|D]}|jt|��q�W||_	d|_
d|_|S)Nr)rr4�func_strip_pathrr5r>rrr
rrr)rZoldstatsZnewstatsrr6r7r8r9r:r;ZnewfuncZ
newcallers�func2�callerZold_topZnew_toprrr�
strip_dirs�s.

zStats.strip_dirsc
Cs||jr
dSi|_}xb|jj�D]T\}\}}}}}||krBi||<x0|j�D]$\}}	||krdi||<|	|||<qLWq WdS)N)rrr4)
rrr6r7r8r9r:r;rkrlrrr�calc_calleess
zStats.calc_calleesc
Cs|}t|t�rpytj|�}Wn&tjk
rB|d|7}||fSXg}x�|D]}|jt|��rN|j|�qNWnzt|�}t|t	�r�d|ko�dknr�t
||d�}|d|�}n2t|t
�r�d|ko�|knr�|}|d|�}t|�t|�k�r|dt|�t|�|f7}||fS)Nz#   <Invalid regular expression %r>
gg�?g�?rz6   List reduced from %r to %r due to restriction <%r>
)r%r&�re�compile�error�searchr5rbr�floatr`)rZsel�list�msgZnew_listZrexr6�countrrr�eval_print_amounts,


""zStats.eval_print_amountcCs�|j}|jr*|jdd�}d|jd}nt|jj��}d}x|D]}|j|||�\}}qBWt|�}|spd|fSt||j	d�|t|j�kr�d}x(|D] }tt
|��|kr�tt
|��}q�W|d|fS)Nz   Ordered by: �
z!   Random listing order was used
r)rrR)rrrartr�keysrwrr"rr5)rZsel_list�widthZ	stat_listruZ	selectionrvr6rrr�get_print_list2s$

zStats.get_print_listcGs�x|jD]}t||jd�qW|jr0t|jd�d}x"|jD]}t|t|�|jd�q<Wt||jdd|jd�|j|jkr�td|jd|jd�td|j|jd�t|jd�|j|�\}}|r�|j	�x|D]}|j
|�q�Wt|jd�t|jd�|S)	N)r� �zfunction calls)�endrz(%d primitive calls)zin %.3f secondsz        )rr"rr�func_get_function_namerrrr{�print_title�
print_line)r�amountrC�indentr6rzrtrrr�print_statsJs(
zStats.print_statscGs~|j|�\}}|rz|j�|j|d�x:|D]2}||jkrP|j|||j|�q,|j||i�q,Wt|jd�t|jd�|S)Nz	called...)r)r{rn�print_call_headingr�print_call_liner"r)rr�rzrtr6rrr�
print_calleesas

zStats.print_calleesc
Gsl|j|�\}}|rh|j|d�x0|D](}|j|\}}}}}	|j|||	d�q$Wt|jd�t|jd�|S)Nzwas called by...z<-)r)r{r�rr�r"r)
rr�rzrtr6r7r8r9r:r;rrr�
print_callersps
zStats.print_callersc
Csxtdj|�||jd�d}x<|jj�D].\}}}}}|r(tt|j���}	t|	t�}Pq(W|rttd|d|jd�dS)Nz	Function )rFr|z    ncalls  tottime  cumtime)	r"�ljustrr�values�next�iterr%rf)
r�	name_sizeZcolumn_titleZ	subheaderr7r8r9r:r;�valuerrrr�{s
zStats.print_call_heading�->cCstt|�j|�|d|jd�|s2t|jd�dSt|j��}d}x�|D]�}t|�}||}	t|	t�r�|	\}
}}}
|
|kr�d|
|f}n
d|
f}d|jdd	t	|��t
|�t
|
�|f}|d
}n$d||	t
|j|d�f}|d}t||||jd�d}qHWdS)
Nr|)r~r)rrz%d/%dz%dz%s %s %s  %srPrRrz	%s(%r) %srF)r"r5r�r�sortedryr%rf�rjustr�f8r)rr��sourceZ	call_dictZarrowZclistr�r6rXr�r8r7r9r:ZsubstatsZ
left_widthrrrr��s*



zStats.print_call_linecCs"tdd|jd�td|jd�dS)Nz-   ncalls  tottime  percall  cumtime  percallr|)r~rzfilename:lineno(function))r)r"r)rrrrr��szStats.print_titlecCs�|j|\}}}}}t|�}||kr4|dt|�}t|jd�d|jd�tt|�d|jd�|dkrxtdd|jd�ntt||�d|jd�tt|�d|jd�|dkr�td	d|jd�ntt||�d|jd�tt|�|jd�dS)
N�/�	r|)r~rrr})rz        z        )rr&r"r�rr�r5)rr6r7r8r9r:r;�crrrr��szStats.print_liner�rr�r�)r�rEr�rr�r�)r�rEr�rFr�r�)r�rGr�rFr�r�)r�rG�rHr�r�)r�rI�rHr�r�)r�rI�rJr�r�)r�rK�rHr�r�)r�rI�rLr�r�)r�rM�rLr�rHr�rJr�r�r�r�)r�rNr�rr�r�)r�rO�rPr�r�)r�rQr�rRr�r�)r�rSr�rRr�r�)r�rS)r�)�__name__�
__module__�__qualname__�__doc__rr	rr r
rDrZr^rgrirmrnrwr{r�r�r�r�r�r�r�rrrrr sF

 
c@s eZdZdZdd�Zdd�ZdS)rda�This class provides a generic function for comparing any two tuples.
    Each instance records a list of tuple-indices (from most significant
    to least significant), and sort direction (ascending or decending) for
    each tuple-index.  The compare functions can then be used as the function
    argument to the system sort() function when a list of tuples need to be
    sorted in the instances order.cCs
||_dS)N)�comp_select_list)rr�rrrr�szTupleComp.__init__cCsBx<|jD]2\}}||}||}||kr.|S||kr|SqWdS)Nr)r�)r�left�right�index�	direction�l�rrrrre�szTupleComp.compareN)r�r�r�r�rrerrrrrd�srdcCs|\}}}tjj|�||fS)N)r*�path�basename)�	func_namerCrVrXrrrrj�s
rjcCs|dS)NrRr)r6rrrr�srcCsN|dd�d	krB|d}|jd�r<|jd�r<d|dd
�S|Snd|SdS)NrR�~r�<�>z{%s}rz	%s:%d(%s))r�rr)�
startswith�endswith)r�rXrrrr5�sr5cCs@|\}}}}}|\}}}	}
}||||||	||
t||�fS)z3Add together all the stats for two profile entries.)�add_callers)�targetr�r7r8r9r:r;Zt_ccZt_ncZt_ttZt_ctZ	t_callersrrrr>�sr>cCs�i}x|j�D]\}}|||<qWxb|j�D]V\}}||krzt|t�rhtdd�t|||�D��||<q�|||7<q,|||<q,W|S)z*Combine two caller lists in a single list.cSsg|]}|d|d�qS)rrr)�.0�irrr�
<listcomp>�szadd_callers.<locals>.<listcomp>)r4r%rf�zip)r�r�Znew_callersr6rlrrrr��s
r�cCs"d}x|j�D]}||7}qW|S)z@Sum the caller statistics to get total number of calls received.r)r�)r;r8rTrrr�count_callssr�cCsd|S)Nz%8.3fr)�xrrrr�sr��__main__c@s�eZdZd6dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)7�ProfileBrowserNcCs6tjj|�d|_d|_tj|_|dk	r2|j|�dS)Nz% )	�cmd�Cmdr�promptrrrr�do_read)r�profilerrrrszProfileBrowser.__init__cCs�|j�}g}x�|D]�}y|jt|��wWntk
r>YnXy8t|�}|dksZ|dkrjtd|jd�w|j|�wWntk
r�YnX|j|�qW|jr�t|j|�|�ntd|jd�dS)Nrrz#Fraction argument must be in [0, 1])rzNo statistics object is loaded.)	�splitrbr`�
ValueErrorrsr"rr�getattr)r�fnrVrZ	processedZtermZfracrrr�generic"s,

zProfileBrowser.genericcCsXtd|jd�td|jd�td|jd�td|jd�td|jd�td|jd�dS)NzArguments may be:)rz0* An integer maximum number of entries to print.z:* A decimal fractional number between 0 and 1, controllingz-  what fraction of selected entries to print.z8* A regular expression; only entries with function namesz  that match it are printed.)r"r)rrrr�generic_help:szProfileBrowser.generic_helpcCsd|jrRy|jj|�Wq`tk
rN}ztd||f|jd�WYdd}~Xq`Xntd|jd�dS)Nz$Failed to load statistics for %s: %s)rzNo statistics object is loaded.r)rr
�IOErrorr"r)rrV�errr�do_addBs*zProfileBrowser.do_addcCstd|jd�dS)Nz>Add profile info from given file to current statistics object.)r)r"r)rrrr�help_addKszProfileBrowser.help_addcCs|jd|�S)Nr�)r�)rrVrrr�
do_calleesNszProfileBrowser.do_calleescCstd|jd�|j�dS)Nz6Print callees statistics from the current stat object.)r)r"rr�)rrrr�help_calleesPszProfileBrowser.help_calleescCs|jd|�S)Nr�)r�)rrVrrr�
do_callersTszProfileBrowser.do_callerscCstd|jd�|j�dS)Nz6Print callers statistics from the current stat object.)r)r"rr�)rrrr�help_callersVszProfileBrowser.help_callerscCstd|jd�dS)Nr)rr)r"r)rrVrrr�do_EOFZszProfileBrowser.do_EOFcCstd|jd�dS)NzLeave the profile brower.)r)r"r)rrrr�help_EOF]szProfileBrowser.help_EOFcCsdS)Nrr)rrVrrr�do_quit`szProfileBrowser.do_quitcCstd|jd�dS)NzLeave the profile brower.)r)r"r)rrrr�	help_quitbszProfileBrowser.help_quitcCs�|r�yt|�|_Wnjtk
rF}zt|jd|jd�dSd}~Xn8tk
r|}zt|jjd||jd�dSd}~XnX|d|_	n6t
|j	�dkr�|j	dd�}|j|�ntd|jd�dS)	Nr)r�:z% rRz1No statistics object is current -- cannot reload.r���)rr�OSErrorr"rrr!r0r�r�rr�)rrV�errrrrr�eszProfileBrowser.do_readcCs td|jd�td|jd�dS)Nz+Read in profile data from a specified file.)rz*Without argument, reload the current file.)r"r)rrrr�	help_readvszProfileBrowser.help_readcCs$|jr|jj�ntd|jd�dS)NzNo statistics object is loaded.)rr)rrir"r)rrVrrr�
do_reversezszProfileBrowser.do_reversecCstd|jd�dS)Nz/Reverse the sort order of the profiling report.)r)r"r)rrrr�help_reverse�szProfileBrowser.help_reversecs�|jstd|jd�dS|jj��|rRt�fdd�|j�D��rR|jj|j��n@td|jd�x0tjj	�D]"\}}td||df|jd�qlWdS)	NzNo statistics object is loaded.)rc3s|]}|�kVqdS)Nr)r�r�)�abbrevsrr�	<genexpr>�sz)ProfileBrowser.do_sort.<locals>.<genexpr>z/Valid sort keys (unique prefixes are accepted):z%s -- %srr)
rr"rr^�allr�rgrrZr4)rrVr_r�r)r�r�do_sort�s
zProfileBrowser.do_sortcCs td|jd�td|jd�dS)Nz.Sort profile data according to specified keys.)rz3(Typing `sort' without arguments lists valid keys.))r"r)rrrr�	help_sort�szProfileBrowser.help_sortcs�fdd�tjD�S)Ncsg|]}|j��r|�qSr)r�)r��a)�textrrr��sz0ProfileBrowser.complete_sort.<locals>.<listcomp>)rrZ)rr�rr)r�r�
complete_sort�szProfileBrowser.complete_sortcCs|jd|�S)Nr�)r�)rrVrrr�do_stats�szProfileBrowser.do_statscCstd|jd�|j�dS)Nz.Print statistics from the current stat object.)r)r"rr�)rrrr�
help_stats�szProfileBrowser.help_statscCs$|jr|jj�ntd|jd�dS)NzNo statistics object is loaded.)r)rrmr"r)rrVrrr�do_strip�szProfileBrowser.do_stripcCstd|jd�dS)Nz<Strip leading path information from filenames in the report.)r)r"r)rrrr�
help_strip�szProfileBrowser.help_stripcCstd|jd�dS)NzShow help for a given command.)r)r"r)rrrr�	help_help�szProfileBrowser.help_helpcCs|r|SdS)Nr)r�stoprVrrr�postcmd�szProfileBrowser.postcmd)N)r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�s4
	r�rrRz*Welcome to the profile statistics browser.)rzGoodbye.)"r�rr*r,r(ro�	functoolsr�__all__rrdrjrr5r>r�r�r�r�r��readline�ImportErrorr�r�r�argvZinitprofileZbrowserr�r�r"rZcmdloop�KeyboardInterruptrrrr�<module>sN
doctest.cpython-36.pyc000064400000223507150335715140010654 0ustar003


 \Ǘ�!@stdZdZdddddddd	d
ddd
ddddddddddddddddddd d!d"g!Zd#d$lZd#d$lZd#d$lZd#d$lZd#d$lZd#d$lZd#d$l	Z	d#d$l
Z
d#d$lZd#d$lZd#d$l
Z
d#d%lmZd#d&lmZed'd(�ZiZd)d�Zed�Zed�Zed�Zed�Zed�Zed�ZeeBeBeBeBeBZed
�Zed�Zed�Zed
�Zed�Z eeBeBeBe BZ!d*Z"d+Z#d,d-�Z$dqd/d0�Z%d1d2�Z&drd4d5�Z'd6d7�Z(Gd8d9�d9e�Z)d:d;�Z*d<d=�Z+d>d?�Z,Gd@dA�dAe	j-�Z.dBdC�Z/GdDd�d�Z0GdEd�d�Z1GdFd�d�Z2GdGd�d�Z3GdHd�d�Z4GdId�d�Z5GdJd�de6�Z7GdKd�de6�Z8GdLd�de4�Z9d$a:dsdOd�Z;dMd$d$d$d$dMd#d$dNe2�d$fdPd�Z<dtdRd�Z=d#a>dSd�Z?GdTdU�dUe
j@�ZAGdVdW�dWeA�ZBGdXdY�dYe
jC�ZDdudZd�ZEGd[d\�d\eA�ZFdMd$d$e2�d$fd]d^�ZGd_d�ZHd`d�ZIdad �ZJdvdbd!�ZKdwdcdd�ZLdxded"�ZMGdfdg�dg�ZNeNdhdidjdkdldm�ZOdndo�ZPeQdpk�rpejReP��d$S)ya�Module doctest -- a framework for running examples in docstrings.

In simplest use, end each module M to be tested with:

def _test():
    import doctest
    doctest.testmod()

if __name__ == "__main__":
    _test()

Then running the module as a script will cause the examples in the
docstrings to get executed and verified:

python M.py

This won't display anything unless an example fails, in which case the
failing example(s) and the cause(s) of the failure(s) are printed to stdout
(why not stderr? because stderr is a lame hack <0.2 wink>), and the final
line of output is "Test failed.".

Run it with the -v switch instead:

python M.py -v

and a detailed report of all examples tried is printed to stdout, along
with assorted summaries at the end.

You can force verbose mode by passing "verbose=True" to testmod, or prohibit
it by passing "verbose=False".  In either of those cases, sys.argv is not
examined by testmod.

There are a variety of other ways to run doctests, including integration
with the unittest framework, and support for running non-Python text
files containing doctests.  There are also many ways to override parts
of doctest's default behaviors.  See the Library Reference Manual for
details.
zreStructuredText en�register_optionflag�DONT_ACCEPT_TRUE_FOR_1�DONT_ACCEPT_BLANKLINE�NORMALIZE_WHITESPACE�ELLIPSIS�SKIP�IGNORE_EXCEPTION_DETAIL�COMPARISON_FLAGS�REPORT_UDIFF�REPORT_CDIFF�REPORT_NDIFF�REPORT_ONLY_FIRST_FAILURE�REPORTING_FLAGS�	FAIL_FAST�Example�DocTest�
DocTestParser�
DocTestFinder�
DocTestRunner�
OutputChecker�DocTestFailure�UnexpectedException�DebugRunner�testmod�testfile�run_docstring_examples�DocTestSuite�DocFileSuite�set_unittest_reportflags�script_from_examples�
testsource�	debug_src�debug�N)�StringIO)�
namedtuple�TestResultszfailed attemptedcCstj|dtt�>�S)N�)�OPTIONFLAGS_BY_NAME�
setdefault�len)�name�r+�/usr/lib64/python3.6/doctest.pyr�sz<BLANKLINE>z...cCs<d}x2tjD](}|j|d�}|tt|�kr||jO}qW|S)z�
    Return the compiler-flags associated with the future features that
    have been imported into the given namespace (globs).
    r"N)�
__future__Zall_feature_names�get�getattrZ
compiler_flag)�globs�flagsZfnameZfeaturer+r+r,�_extract_future_flags�sr2�cCsVtj|�r|St|t�r,t|t�t�dg�S|dkrJtjtj	|�j
dStd��dS)a�
    Return the module specified by `module`.  In particular:
      - If `module` is a module, then return module.
      - If `module` is a string, then import and return the
        module with that name.
      - If `module` is None, then return the calling module.
        The calling module is assumed to be the module of
        the stack frame at the given depth in the call stack.
    �*N�__name__z"Expected a module, string, or None)�inspect�ismodule�
isinstance�str�
__import__�globals�locals�sys�modules�	_getframe�	f_globals�	TypeError)�moduleZdepthr+r+r,�_normalize_module�s


rCc	Cs�|r\t|d�}t||�}t|dd�dk	r\t|jd�r\|jj|�}|j|�}|jtj	d�|fSt
||d��}|j�|fSQRXdS)N��
__loader__�get_data�
)�encoding)rC�_module_relative_pathr/�hasattrrErF�decode�replace�os�linesep�open�read)�filename�package�module_relativerHZ
file_contents�fr+r+r,�_load_testfile�s


rU�cCstjd|d|�S)z~
    Add the given number of space characters to the beginning of
    every non-blank line in `s`, and return the result.
    z
(?m)^(?!$)� )�re�sub)�s�indentr+r+r,�_indent�sr\cCs*t�}|\}}}tj||||d�|j�S)zz
    Return a string containing a traceback message for the given
    exc_info tuple (as returned by sys.exc_info()).
    )�file)r#�	traceback�print_exception�getvalue)�exc_infoZexcout�exc_typeZexc_valZexc_tbr+r+r,�_exception_traceback�s
rcc@seZdZdd�Zddd�ZdS)�	_SpoofOutcCs&tj|�}|r"|jd�r"|d7}|S)NrG)r#r`�endswith)�self�resultr+r+r,r`�s
z_SpoofOut.getvalueNcCs|j|�tj|�dS)N)�seekr#�truncate)rf�sizer+r+r,ris
z_SpoofOut.truncate)N)r5�
__module__�__qualname__r`rir+r+r+r,rd�s	rdcCs�t|kr||kS|jt�}t|�dks*t�dt|�}}|d}|rb|j|�r^t|�}|d=ndS|d}|r�|j|�r�|t|�8}|d=ndS||kr�dSx2|D]*}|j|||�}|dkr�dS|t|�7}q�WdS)z_
    Essentially the only subtle case:
    >>> _ellipsis_match('aa...aa', 'aaa')
    False
    r3r"Fr&T���rm)�ELLIPSIS_MARKER�splitr)�AssertionError�
startswithre�find)�want�gotZws�startpos�endpos�wr+r+r,�_ellipsis_matchs2



rxcCs|j�}|rd|SdSdS)z)Return a commented form of the given linez# �#N)�rstrip)�liner+r+r,�
_comment_line9sr|cCshdt|�}}|jd�}|dkr$|}|jdd|�}|dkr>|}|jdd|�}|dkr\|d}|||�S)Nr"rG�:�.r&)r)rr�rfind)�msg�start�end�ir+r+r,�_strip_exception_detailsAs
r�c@s2eZdZdZdd�Zddd�Zdd�Zd	d
�ZdS)�_OutputRedirectingPdbz�
    A specialized version of the python debugger that redirects stdout
    to a given stream when interacting with the user.  Stdout is *not*
    redirected when traced code is executed.
    cCs(||_d|_tjj||dd�d|_dS)NFT)�stdout�nosigintr&)�_OutputRedirectingPdb__out�$_OutputRedirectingPdb__debugger_used�pdb�Pdb�__init__Zuse_rawinput)rf�outr+r+r,r�asz_OutputRedirectingPdb.__init__NcCs*d|_|dkrtj�j}tjj||�dS)NT)r�r=r?�f_backr�r��	set_trace)rf�framer+r+r,r�is
z_OutputRedirectingPdb.set_tracecCs|jrtjj|�dS)N)r�r�r��set_continue)rfr+r+r,r�osz"_OutputRedirectingPdb.set_continuecGs.tj}|jt_ztjj|f|��S|t_XdS)N)r=r�r�r�r��trace_dispatch)rf�args�save_stdoutr+r+r,r�us
z$_OutputRedirectingPdb.trace_dispatch)N)r5rkrl�__doc__r�r�r�r�r+r+r+r,r�[s

r�cCs�tj|�std|��|jd�r(td��tjj|jd��}t	|d�rXtjj|j
�d}n�|jdkr�tt
j�dkr�t
jddkr�tjjt
jd�d}q�tj}nFt	|d�r�x,|jD]"}tjj||�}tjj|�r�|Sq�Wtd	|j��tjj||�S)
NzExpected a module: %r�/z1Module-relative files may not have absolute paths�__file__r"�__main__��__path__zBCan't resolve paths relative to the module %r (it has no __file__))r6r7rArq�
ValueErrorrM�path�joinrorJr�r5r)r=�argv�curdirr��exists)rBZ	test_pathZbasedirZ	directoryZfullpathr+r+r,rI�s&





rIc@s*eZdZdZd
dd�Zdd�Zdd	�ZdS)ran
    A single doctest example, consisting of source code and expected
    output.  `Example` defines the following attributes:

      - source: A single Python statement, always ending with a newline.
        The constructor adds a newline if needed.

      - want: The expected output from running the source code (either
        from stdout, or a traceback in case of exception).  `want` ends
        with a newline unless it's empty, in which case it's an empty
        string.  The constructor adds a newline if needed.

      - exc_msg: The exception message generated by the example, if
        the example is expected to generate an exception; or `None` if
        it is not expected to generate an exception.  This exception
        message is compared against the return value of
        `traceback.format_exception_only()`.  `exc_msg` ends with a
        newline unless it's `None`.  The constructor adds a newline
        if needed.

      - lineno: The line number within the DocTest string containing
        this Example where the Example begins.  This line number is
        zero-based, with respect to the beginning of the DocTest.

      - indent: The example's indentation in the DocTest string.
        I.e., the number of space characters that precede the
        example's first prompt.

      - options: A dictionary mapping from option flags to True or
        False, which is used to override default options for this
        example.  Any option flags not contained in this dictionary
        are left at their default value (as specified by the
        DocTestRunner's optionflags).  By default, no options are set.
    Nr"cCsz|jd�s|d7}|r*|jd�r*|d7}|dk	rF|jd�rF|d7}||_||_||_||_|dkrji}||_||_dS)NrG)re�sourcers�linenor[�options�exc_msg)rfr�rsr�r�r[r�r+r+r,r��s
zExample.__init__cCs\t|�t|�k	rtS|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkS)N)�type�NotImplementedr�rsr�r[r�r�)rf�otherr+r+r,�__eq__�szExample.__eq__cCst|j|j|j|j|jf�S)N)�hashr�rsr�r[r�)rfr+r+r,�__hash__�szExample.__hash__)Nr"r"N)r5rkrlr�r�r�r�r+r+r+r,r�s
"
c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rae
    A collection of doctest examples that should be run in a single
    namespace.  Each `DocTest` defines the following attributes:

      - examples: the list of examples.

      - globs: The namespace (aka globals) that the examples should
        be run in.

      - name: A name identifying the DocTest (typically, the name of
        the object whose docstring this DocTest was extracted from).

      - filename: The name of the file that this DocTest was extracted
        from, or `None` if the filename is unknown.

      - lineno: The line number within filename where this DocTest
        begins, or `None` if the line number is unavailable.  This
        line number is zero-based, with respect to the beginning of
        the file.

      - docstring: The string that the examples were extracted from,
        or `None` if the string is unavailable.
    cCs@t|t�std��||_||_|j�|_||_||_||_	dS)z�
        Create a new DocTest containing the given examples.  The
        DocTest's globals are initialized with a copy of `globs`.
        z8DocTest no longer accepts str; use DocTestParser insteadN)
r8r9rp�examples�	docstring�copyr0r*rQr�)rfr�r0r*rQr�r�r+r+r,r�
s
zDocTest.__init__cCsRt|j�dkrd}n"t|j�dkr(d}ndt|j�}d|jj|j|j|j|fS)Nr"zno examplesr&z	1 examplez%d examplesz<%s %s from %s:%s (%s)>)r)r��	__class__r5r*rQr�)rfr�r+r+r,�__repr__szDocTest.__repr__cCs\t|�t|�k	rtS|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkS)N)r�r�r�r�r0r*rQr�)rfr�r+r+r,r�#szDocTest.__eq__cCst|j|j|j|jf�S)N)r�r�r*rQr�)rfr+r+r,r�.szDocTest.__hash__cCs:t|t�stS|j|j|jt|�f|j|j|jt|�fkS)N)r8rr�r*rQr��id)rfr�r+r+r,�__lt__2s
zDocTest.__lt__N)	r5rkrlr�r�r�r�r�r�r+r+r+r,r�sc@s�eZdZdZejdejejB�ZejdejejBej	B�Z
ejd�jZddd�Z
dd	�Zdd
d�Zdd
�Zejdej�Zdd�Zejdej�Zdd�Zdd�Zdd�ZdS)rzD
    A class used to parse strings containing doctest examples.
    a�
        # Source consists of a PS1 line followed by zero or more PS2 lines.
        (?P<source>
            (?:^(?P<indent> [ ]*) >>>    .*)    # PS1 line
            (?:\n           [ ]*  \.\.\. .*)*)  # PS2 lines
        \n?
        # Want consists of any non-blank lines that do not start with PS1.
        (?P<want> (?:(?![ ]*$)    # Not a blank line
                     (?![ ]*>>>)  # Not a line starting with PS1
                     .+$\n?       # But any other line
                  )*)
        a�
        # Grab the traceback header.  Different versions of Python have
        # said different things on the first traceback line.
        ^(?P<hdr> Traceback\ \(
            (?: most\ recent\ call\ last
            |   innermost\ last
            ) \) :
        )
        \s* $                # toss trailing whitespace on the header.
        (?P<stack> .*?)      # don't blink: absorb stuff until...
        ^ (?P<msg> \w+ .*)   #     a line *starts* with alphanum.
        z^[ ]*(#.*)?$�<string>cs|j�}|j|���dkr8dj�fdd�|jd�D��}g}d\}}x�|jj|�D]�}|j|||j���||jd||j��7}|j	|||�\}}}	}
|j
|�s�|jt||	|
|�t|j
d��|d��||jd|j�|j��7}|j�}qRW|j||d��|S)	a=
        Divide the given string into examples and intervening text,
        and return them as a list of alternating Examples and strings.
        Line numbers for the Examples are 0-based.  The optional
        argument `name` is a name identifying this string, and is only
        used for error messages.
        r"rGcsg|]}|�d��qS)Nr+)�.0�l)�
min_indentr+r,�
<listcomp>ysz'DocTestParser.parse.<locals>.<listcomp>r[)r�r[r�N)r"r")�
expandtabs�_min_indentr�ro�_EXAMPLE_RE�finditer�appendr��count�_parse_example�_IS_BLANK_OR_COMMENTrr)�groupr�)rf�stringr*�outputZcharnor��mr�r�rsr�r+)r�r,�parsems&


zDocTestParser.parsecCst|j||�|||||�S)a"
        Extract all doctest examples from the given string, and
        collect them into a `DocTest` object.

        `globs`, `name`, `filename`, and `lineno` are attributes for
        the new `DocTest` object.  See the documentation for `DocTest`
        for more information.
        )r�get_examples)rfr�r0r*rQr�r+r+r,�get_doctest�s	zDocTestParser.get_doctestcCsdd�|j||�D�S)a�
        Extract all doctest examples from the given string, and return
        them as a list of `Example` objects.  Line numbers are
        0-based, because it's most common in doctests that nothing
        interesting appears on the same line as opening triple-quote,
        and so the first interesting line is called "line 1" then.

        The optional argument `name` is a name identifying this
        string, and is only used for error messages.
        cSsg|]}t|t�r|�qSr+)r8r)r��xr+r+r,r��sz.DocTestParser.get_examples.<locals>.<listcomp>)r�)rfr�r*r+r+r,r��szDocTestParser.get_examplesc
s
t|jd���|jd�jd�}|j|�||�|j|dd�d�d||�dj�fdd	�|D��}|jd
�}|jd�}t|�dkr�tjd|d�r�|d=|j|d�||t|��dj�fdd	�|D��}|jj|�}|r�|jd
�}nd}|j	|||�}	||	||fS)a�
        Given a regular expression match from `_EXAMPLE_RE` (`m`),
        return a pair `(source, want)`, where `source` is the matched
        example's source code (with prompts and indentation stripped);
        and `want` is the example's expected output (with indentation
        stripped).

        `name` is the string's name, and `lineno` is the line number
        where the example starts; both are used for error messages.
        r[r�rGr&NrWr~csg|]}|�dd��qS)rVNr+)r�Zsl)r[r+r,r��sz0DocTestParser._parse_example.<locals>.<listcomp>rsz *$csg|]}|�d��qS)Nr+)r�Zwl)r[r+r,r��sr�rmrm)
r)r�ro�_check_prompt_blank�
_check_prefixr�rX�match�
_EXCEPTION_RE�
_find_options)
rfr�r*r��source_linesr�rs�
want_linesr�r�r+)r[r,r��s$ 

zDocTestParser._parse_examplez#\s*doctest:\s*([^\n\'"]*)$c	Cs�i}x�|jj|�D]z}|jd�jdd�j�}x^|D]V}|ddksR|dd�tkrhtd|d||f��t|dd�}|ddk||<q2WqW|r�|j|�r�td	|||f��|S)
a
        Return a dictionary containing option overrides extracted from
        option directives in the given source string.

        `name` is the string's name, and `lineno` is the line number
        where the example starts; both are used for error messages.
        r&�,rWr"z+-Nz7line %r of the doctest for %s has an invalid option: %r�+zSline %r of the doctest for %s has an option directive on a line with no example: %r)�_OPTION_DIRECTIVE_REr�r�rLror'r�r�)	rfr�r*r�r�r�Zoption_strings�option�flagr+r+r,r��s
zDocTestParser._find_optionsz
^([ ]*)(?=\S)cCs2dd�|jj|�D�}t|�dkr*t|�SdSdS)z;Return the minimum indentation of any non-blank line in `s`cSsg|]}t|��qSr+)r))r�r[r+r+r,r�sz-DocTestParser._min_indent.<locals>.<listcomp>r"N)�
_INDENT_RE�findallr)�min)rfrZ�indentsr+r+r,r�szDocTestParser._min_indentc	Csbx\t|�D]P\}}t|�|dkr
||ddkr
td||d||||d�|f��q
WdS)a

        Given the lines of a source string (including prompts and
        leading indentation), check to make sure that every prompt is
        followed by a space character.  If any line is not followed by
        a space character, then raise ValueError.
        rVrDrWz8line %r of the docstring for %s lacks blank after %s: %rr&N)�	enumerater)r�)rf�linesr[r*r�r�r{r+r+r,r�
s
 z!DocTestParser._check_prompt_blankcCsDx>t|�D]2\}}|r
|j|�r
td||d||f��q
WdS)z�
        Check that every line in the given list starts with the given
        prefix; if any line does not, then raise a ValueError.
        zGline %r of the docstring for %s has inconsistent leading whitespace: %rr&N)r�rqr�)rfr��prefixr*r�r�r{r+r+r,r�szDocTestParser._check_prefixN)r�)r�)r5rkrlr�rX�compile�	MULTILINE�VERBOSEr��DOTALLr�r�r�r�r�r�r�r�r�r�r�r�r�r+r+r+r,r=s"
'
3c@sNeZdZdZde�ddfdd�Zddd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)ra<
    A class used to extract the DocTests that are relevant to a given
    object, from its docstring and the docstrings of its contained
    objects.  Doctests can currently be extracted from the following
    object types: modules, functions, classes, methods, staticmethods,
    classmethods, and properties.
    FTcCs||_||_||_||_dS)at
        Create a new doctest finder.

        The optional argument `parser` specifies a class or
        function that should be used to create new DocTest objects (or
        objects that implement the same interface as DocTest).  The
        signature for this factory function should match the signature
        of the DocTest constructor.

        If the optional argument `recurse` is false, then `find` will
        only examine the given object, and not any contained objects.

        If the optional argument `exclude_empty` is false, then `find`
        will include tests for objects with empty docstrings.
        N)�_parser�_verbose�_recurse�_exclude_empty)rf�verbose�parser�recurse�
exclude_emptyr+r+r,r�1szDocTestFinder.__init__Nc	CsP|dkr.t|dd�}|dkr.tdt|�f��|dkr<d}n|dkrNtj|�}ytj|�}Wntk
rtd}YndX|s�tj|�}|d|d	d�dks�d}|dkr�d}n*|dk	r�tj	||j
�}n
tj	|�}|s�d}|dk�r�|dkr�i}n
|j
j�}n|j�}|dk	�r|j|�d|k�r*d|d<g}|j
||||||i�|j�|S)
aj
        Return a list of the DocTests that are defined by the given
        object's docstring, or by any of its contained objects'
        docstrings.

        The optional parameter `module` is the module that contains
        the given object.  If the module is not specified or is None, then
        the test finder will attempt to automatically determine the
        correct module.  The object's module is used:

            - As a default namespace, if `globs` is not specified.
            - To prevent the DocTestFinder from extracting DocTests
              from objects that are imported from other modules.
            - To find the name of the file containing the object.
            - To help find the line number of the object within its
              file.

        Contained objects whose module does not match `module` are ignored.

        If `module` is False, no attempt to find the module will be made.
        This is obscure, of use mostly in tests:  if `module` is False, or
        is None but cannot be found automatically, then all objects are
        considered to belong to the (non-existent) module, so all contained
        objects will (recursively) be searched for doctests.

        The globals for each DocTest is formed by combining `globs`
        and `extraglobs` (bindings in `extraglobs` override bindings
        in `globs`).  A new copy of the globals dictionary is created
        for each DocTest.  If `globs` is not specified, then it
        defaults to the module's `__dict__`, if specified, or {}
        otherwise.  If `extraglobs` is not specified, then it defaults
        to {}.

        Nr5zJDocTestFinder.find: name must be given when obj.__name__ doesn't exist: %rFr"r3z<]>r����)r/r�r�r6�	getmoduleZ
getsourcefilerAZgetfile�	linecache�getlines�__dict__r��update�_find�sort)	rf�objr*rBr0�
extraglobsr]r��testsr+r+r,rrGsJ$







zDocTestFinder.findcCs�|dkrdStj|�dk	r(|tj|�kStj|�r>|j|jkStj|�r|t|d�r\|jj}nt|d�rn|j}ndS|j	|kStj
|�r�|j	|jkSt|d�r�|j	|jkSt|t�r�dSt
d��dS)zY
        Return true if the given object is defined in the given
        module.
        NT�__objclass__rkz"object must be a class or function)r6r��
isfunctionr��__globals__ZismethoddescriptorrJr�rkr5�isclassr8�propertyr�)rfrB�objectZobj_modr+r+r,�_from_module�s(








zDocTestFinder._from_modulec	Cs(|jrtd|�t|�|kr"dSd|t|�<|j|||||�}|dk	rR|j|�tj|�r�|jr�x^|jj	�D]P\}	}
d||	f}	tj
tj|
��s�tj|
�rn|j
||
�rn|j||
|	||||�qnWtj|�o�|j�rtx�t|di�j	�D]�\}	}
t|	t��stdt|	�f��tj
|
��p8tj|
��p8tj|
��p8t|
t��sNtdt|
�f��d||	f}	|j||
|	||||�q�Wtj|��r$|j�r$x�|jj	�D]�\}	}
t|
t��r�t||	�}
t|
t��r�t||	�j}
tj
|
��s�tj|
��s�t|
t��r�|j
||
��r�d||	f}	|j||
|	||||��q�WdS)	zm
        Find tests for the given object and any contained objects, and
        add them to `tests`.
        zFinding tests in %sNr&z%s.%s�__test__z5DocTestFinder.find: __test__ keys must be strings: %rz`DocTestFinder.find: __test__ values must be strings, functions, methods, classes, or modules: %rz%s.__test__.%s)r��printr��	_get_testr�r6r7r�r��itemsZ	isroutineZunwrapr�r�r�r/r8r9r�r��staticmethod�classmethod�__func__r�)rfr�r�r*rBr�r0�seen�testZvalname�valr+r+r,r��sP


zDocTestFinder._findc	Cs�t|t�r|}nJy,|jdkr"d}n|j}t|t�s:t|�}Wnttfk
rXd}YnX|j||�}|jrv|rvdS|dkr�d}n*t|d|j�}|dd�dkr�|dd�}|j	j
|||||�S)	zs
        Return a DocTest for the given object, if it defines a docstring;
        otherwise, return None.
        Nr�r�rVz.pycr&���rm)r8r9r�rA�AttributeError�_find_linenor�r/r5r�r�)	rfr�r*rBr0r�r�r�rQr+r+r,r�s(



zDocTestFinder._get_testcCsd}tj|�rd}tj|�rd|dkr(dStjdt|dd��}x$t|�D]\}}|j|�rH|}PqHWtj|�rt|j	}tj
|�r�|j}tj|�r�|j
}tj|�r�|j}tj|�r�t|dd�d}|dk	�r|dkr�|dStjd�}x(t|t|��D]}|j||�r�|Sq�WdS)	z�
        Return a line number of the given object's docstring.  Note:
        this method assumes that the object has a docstring.
        Nr"z^\s*class\s*%s\br5�-�co_firstlinenor&z(^|.*:)\s*\w*("|\'))r6r7r�rXr�r/r�r�Zismethodr�r��__code__Zistraceback�tb_frameZisframe�f_codeZiscode�ranger))rfr�r�r�Zpatr�r{r+r+r,r-s<









zDocTestFinder._find_lineno)NNNN)r5rkrlr�rr�rrr�r�r�rr+r+r+r,r(s
f?%c@s�eZdZdZddZd dd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Ze
jd�Zd!dd�Zd"dd�Zd#dd�Zdd�ZdS)$ra3	
    A class used to run DocTest test cases, and accumulate statistics.
    The `run` method is used to process a single DocTest case.  It
    returns a tuple `(f, t)`, where `t` is the number of test cases
    tried, and `f` is the number of test cases that failed.

        >>> tests = DocTestFinder().find(_TestClass)
        >>> runner = DocTestRunner(verbose=False)
        >>> tests.sort(key = lambda test: test.name)
        >>> for test in tests:
        ...     print(test.name, '->', runner.run(test))
        _TestClass -> TestResults(failed=0, attempted=2)
        _TestClass.__init__ -> TestResults(failed=0, attempted=2)
        _TestClass.get -> TestResults(failed=0, attempted=2)
        _TestClass.square -> TestResults(failed=0, attempted=1)

    The `summarize` method prints a summary of all the test cases that
    have been run by the runner, and returns an aggregated `(f, t)`
    tuple:

        >>> runner.summarize(verbose=1)
        4 items passed all tests:
           2 tests in _TestClass
           2 tests in _TestClass.__init__
           2 tests in _TestClass.get
           1 tests in _TestClass.square
        7 tests in 4 items.
        7 passed and 0 failed.
        Test passed.
        TestResults(failed=0, attempted=7)

    The aggregated number of tried examples and failed examples is
    also available via the `tries` and `failures` attributes:

        >>> runner.tries
        7
        >>> runner.failures
        0

    The comparison between expected outputs and actual outputs is done
    by an `OutputChecker`.  This comparison may be customized with a
    number of option flags; see the documentation for `testmod` for
    more information.  If the option flags are insufficient, then the
    comparison may also be customized by passing a subclass of
    `OutputChecker` to the constructor.

    The test runner's display output can be controlled in two ways.
    First, an output function (`out) can be passed to
    `TestRunner.run`; this function will be called with strings that
    should be displayed.  It defaults to `sys.stdout.write`.  If
    capturing the output is not sufficient, then the display output
    can be also customized by subclassing DocTestRunner, and
    overriding the methods `report_start`, `report_success`,
    `report_unexpected_exception`, and `report_failure`.
    r4�FNr"cCsN|pt�|_|dkrdtjk}||_||_||_d|_d|_i|_	t
�|_dS)ac
        Create a new test runner.

        Optional keyword arg `checker` is the `OutputChecker` that
        should be used to compare the expected outputs and actual
        outputs of doctest examples.

        Optional keyword arg 'verbose' prints lots of stuff if true,
        only failures if false; by default, it's true iff '-v' is in
        sys.argv.

        Optional argument `optionflags` can be used to control how the
        test runner compares expected output to actual output, and how
        it displays failures.  See the documentation for `testmod` for
        more information.
        Nz-vr")r�_checkerr=r�r��optionflags�original_optionflags�tries�failures�_name2ftrd�_fakeout)rf�checkerr�r
r+r+r,r��s
zDocTestRunner.__init__cCsH|jrD|jr.|dt|j�dt|j��n|dt|j�d�dS)z�
        Report that the test runner is about to process the given
        example.  (Only displays a message if verbose=True)
        zTrying:
zExpecting:
zExpecting nothing
N)r�rsr\r�)rfr�r�exampler+r+r,�report_start�s zDocTestRunner.report_startcCs|jr|d�dS)zt
        Report that the given example ran successfully.  (Only
        displays a message if verbose=True)
        zok
N)r�)rfr�rrrtr+r+r,�report_success�szDocTestRunner.report_successcCs&||j||�|jj|||j��dS)z7
        Report that the given example failed.
        N)�_failure_headerr�output_differencer
)rfr�rrrtr+r+r,�report_failure�szDocTestRunner.report_failurecCs$||j||�dtt|���dS)zO
        Report that the given example raised an unexpected exception.
        zException raised:
N)rr\rc)rfr�rrrar+r+r,�report_unexpected_exception�sz)DocTestRunner.report_unexpected_exceptioncCs�|jg}|jrR|jdk	r4|jdk	r4|j|jd}nd}|jd|j||jf�n|jd|jd|jf�|jd�|j}|jt|��dj|�S)Nr&�?zFile "%s", line %s, in %szLine %s, in %szFailed example:rG)�DIVIDERrQr�r�r*r�r\r�)rfrrr�r�r�r+r+r,r�s
zDocTestRunner._failure_headercCs�d}}|j}td�\}}}	|jj}
�xXt|j�D�]H\}}|jt@oL|dk}
||_|jr�x:|jj�D],\}}|r�|j|O_qf|j|M_qfW|jt	@r�q2|d7}|
s�|j
|||�d|j|f}y,tt
|j|d|d�|j�|jj�d}Wn4tk
�r�Yntj�}|jj�YnX|jj�}|jjd�|}|dk�rh|
|j||j��r�|}n|tj|dd��d
}|
�s�|t|�7}|jdk�r�|	}nB|
|j||j��r�|}n*|jt@�r�|
t|j�t|�|j��r�|}||k�r|
�sl|j||||�nf||k�r0|
�s&|j ||||�|d7}n<||	k�rZ|
�sP|j!||||�|d7}nd�slt"d	|f��|r2|jt#@r2Pq2W||_|j$|||�t%||�S)a�
        Run the examples in `test`.  Write the outcome of each example
        with one of the `DocTestRunner.report_*` methods, using the
        writer function `out`.  `compileflags` is the set of compiler
        flags that should be used to execute examples.  Return a tuple
        `(f, t)`, where `t` is the number of examples tried, and `f`
        is the number of examples that failed.  The examples are run
        in the namespace `test.globs`.
        r"rDr&z<doctest %s[%d]>ZsingleNr3Fzunknown outcomerm)&r
r
r�check_outputr�r�rr�r�rrr*�execr�r�r0�debuggerr��KeyboardInterruptr=rarr`rirsr^�format_exception_onlyrcr�rr�rrrrpr�_DocTestRunner__record_outcomer%)rfr�compileflagsr�rrr�SUCCESS�FAILUREZBOOMZcheck�
examplenumr�quietZ
optionflagrrQZ	exceptionrtZoutcomer�r+r+r,Z__run�s�












zDocTestRunner.__runcCsL|jj|jd�\}}||||f|j|j<|j|7_|j|7_dS)z{
        Record the fact that the given DocTest (`test`) generated `f`
        failures out of `t` tried examples.
        r"N)r"r")rr.r*rr)rfrrT�t�f2�t2r+r+r,Z__record_outcomeuszDocTestRunner.__record_outcomez.<doctest (?P<name>.+)\[(?P<examplenum>\d+)\]>$cCsV|jj|�}|rF|jd�|jjkrF|jjt|jd��}|jjdd�S|j	||�SdS)Nr*r&T)�keepends)
�%_DocTestRunner__LINECACHE_FILENAME_REr�r�rr*r��intr��
splitlines�save_linecache_getlines)rfrQ�module_globalsr�rr+r+r,Z__patched_linecache_getlines�s
z*DocTestRunner.__patched_linecache_getlinesTc	s�||_|dkrt|j�}tj�|dkrV�j��dks@�j�dkrH�j}n��fdd�}|jt_tj	�}t
j}t��|_
|j
j�|j
jt
_tj|_|jt_tj}tjt_z|j|||�S�t_|t
_tj|�|jt_|t_|r�|jj�ddl}d|_XdS)aJ
        Run the examples in `test`, and display the results using the
        writer function `out`.

        The examples are run in the namespace `test.globs`.  If
        `clear_globs` is true (the default), then this namespace will
        be cleared after the test runs, to help with garbage
        collection.  If you would like to examine the namespace after
        the test completes, then use `clear_globs=False`.

        `compileflags` gives the set of flags that should be used by
        the Python compiler when running the examples.  If not
        specified, then it will default to the set of future-import
        flags that apply to `globs`.

        The output of each example is checked using
        `DocTestRunner.check_output`, and the results are formatted by
        the `DocTestRunner.report_*` methods.
        Nzutf-8cs t|j�d���}�j|�dS)N�backslashreplace)r9�encode�write)rZ)rHr�r+r,r��szDocTestRunner.run.<locals>.outr")rr2r0r=r�rH�lowerr3r�gettracer�r�r�r�resetr�r�r/�*_DocTestRunner__patched_linecache_getlines�displayhook�__displayhook__�_DocTestRunner__run�settrace�clear�builtins�_)	rfrr#r��clear_globsZ
save_traceZsave_set_traceZsave_displayhookr=r+)rHr�r,�run�s<





zDocTestRunner.runc
Cs�|dkr|j}g}g}g}d}}xp|jj�D]b}|\}\}	}
|	|
ksJt�||
7}||	7}|
dkrn|j|�q.|	dkr�|j||
f�q.|j|�q.W|�r
|r�tt|�d�|j�x|D]}td|�q�W|�r
tt|�d�|j�x |D]\}}td||f�q�W|�rZt|j�tt|�d�|j�x(|D] \}\}	}
td|	|
|f��q6W|�r�t|d	t|j�d
�t||d|d�|�r�td
|d�n|�r�td�t	||�S)a�
        Print a summary of all the test cases that have been run by
        this DocTestRunner, and return a tuple `(f, t)`, where `f` is
        the total number of failed examples, and `t` is the total
        number of tried examples.

        The optional `verbose` argument controls how detailed the
        summary is.  If the verbosity is not specified, then the
        DocTestRunner's verbosity is used.
        Nr"zitems had no tests:z   zitems passed all tests:z %3d tests in %szitems had failures:z %3d of %3d in %sztests inzitems.z
passed andzfailed.z***Test Failed***z	failures.zTest passed.)
r�rr�rpr�r�r)r�rr%)
rfr�ZnotestsZpassedZfailedZtotaltZtotalfr�r*rTr(�thingr�r+r+r,�	summarize�sR

zDocTestRunner.summarizecCsV|j}xJ|jj�D]<\}\}}||krB||\}}||}||}||f||<qWdS)N)rr�)rfr��dr*rTr(r)r*r+r+r,�mergeszDocTestRunner.merge)NNr")N)NNT)N)r5rkrlr�rr�rrrrrr:r"rXr�r,r7r@rBrDr+r+r+r,ras7
$
}



I
9c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)ra_
    A class used to check the whether the actual output from a doctest
    example matches the expected output.  `OutputChecker` defines two
    methods: `check_output`, which compares a given pair of outputs,
    and returns true if they match; and `output_difference`, which
    returns a string describing the differences between two outputs.
    cCst|jdd�d�S)z=
        Convert string to hex-escaped ASCII string.
        �ASCIIr1)r9r2)rfrZr+r+r,�_toAscii!szOutputChecker._toAsciicCs�|j|�}|j|�}||kr dS|t@sH||fdkr8dS||fdkrHdS|t@s�tjdtjt�d|�}tjdd|�}||kr�dS|t@r�d	j|j	��}d	j|j	��}||kr�dS|t
@r�t||�r�dSd
S)
a�
        Return True iff the actual output from an example (`got`)
        matches the expected output (`want`).  These strings are
        always considered to match if they are identical; but
        depending on what option flags the test runner is using,
        several non-exact match types are also possible.  See the
        documentation for `TestRunner` for more information about
        option flags.
        T�True
�1
�False
�0
z(?m)^%s\s*?$r�z
(?m)^\s*?$rWF)rGrH)rIrJ)rFrrrXrY�escape�BLANKLINE_MARKERrr�rorrx)rfrsrtr
r+r+r,r's0


zOutputChecker.check_outputcCs<|ttBtB@sdS|t@r dS|jd�dko:|jd�dkS)NFTrGr3)r	r
rr�)rfrsrtr
r+r+r,�_do_a_fancy_difffszOutputChecker._do_a_fancy_diffc
CsF|j}|t@stjdt|�}|j|||�r�|jdd�}|jdd�}|t@rptj	||dd�}t
|�dd�}d}nf|t@r�tj||dd�}t
|�dd�}d}n8|t
@r�tjtjd	�}	t
|	j||��}d
}nds�td��d
d�|D�}d|tdj|��S|�r|�rdt|�t|�fS|�r,dt|�S|�r>dt|�SdSdS)z�
        Return a string describing the differences between the
        expected output for a given example (`example`) and the actual
        output (`got`).  `optionflags` is the set of option flags used
        to compare `want` and `got`.
        z(?m)^[ ]*(?=
)T)r+r3)�nNz#unified diff with -expected +actualz-context diff with expected followed by actual)Zcharjunkzndiff with -expected +actualr"zBad diff optioncSsg|]}|j�d�qS)rG)rz)r�r{r+r+r,r��sz3OutputChecker.output_difference.<locals>.<listcomp>zDifferences (%s):
r�zExpected:
%sGot:
%szExpected:
%sGot nothing
zExpected nothing
Got:
%szExpected nothing
Got nothing
)rsrrXrYrLrMr.r	�difflibZunified_diff�listr
Zcontext_diffrZDifferZIS_CHARACTER_JUNKZcomparerpr\r�)
rfrrtr
rsr�Z	got_linesZdiffZkindZenginer+r+r,r}s8zOutputChecker.output_differenceN)r5rkrlr�rFrrMrr+r+r+r,rs
?c@s eZdZdZdd�Zdd�ZdS)rz�A DocTest example has failed in debugging mode.

    The exception instance has variables:

    - test: the DocTest object being run

    - example: the Example object that failed

    - got: the actual output
    cCs||_||_||_dS)N)rrrt)rfrrrtr+r+r,r��szDocTestFailure.__init__cCs
t|j�S)N)r9r)rfr+r+r,�__str__�szDocTestFailure.__str__N)r5rkrlr�r�rQr+r+r+r,r�s
c@s eZdZdZdd�Zdd�ZdS)rz�A DocTest example has encountered an unexpected exception

    The exception instance has variables:

    - test: the DocTest object being run

    - example: the Example object that failed

    - exc_info: the exception info
    cCs||_||_||_dS)N)rrra)rfrrrar+r+r,r��szUnexpectedException.__init__cCs
t|j�S)N)r9r)rfr+r+r,rQ�szUnexpectedException.__str__N)r5rkrlr�r�rQr+r+r+r,r�s
c@s*eZdZdZd
dd�Zdd�Zdd	�ZdS)ra�	Run doc tests but raise an exception as soon as there is a failure.

       If an unexpected exception occurs, an UnexpectedException is raised.
       It contains the test, the example, and the original exception:

         >>> runner = DebugRunner(verbose=False)
         >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42',
         ...                                    {}, 'foo', 'foo.py', 0)
         >>> try:
         ...     runner.run(test)
         ... except UnexpectedException as f:
         ...     failure = f

         >>> failure.test is test
         True

         >>> failure.example.want
         '42\n'

         >>> exc_info = failure.exc_info
         >>> raise exc_info[1] # Already has the traceback
         Traceback (most recent call last):
         ...
         KeyError

       We wrap the original exception to give the calling application
       access to the test and example information.

       If the output doesn't match, then a DocTestFailure is raised:

         >>> test = DocTestParser().get_doctest('''
         ...      >>> x = 1
         ...      >>> x
         ...      2
         ...      ''', {}, 'foo', 'foo.py', 0)

         >>> try:
         ...    runner.run(test)
         ... except DocTestFailure as f:
         ...    failure = f

       DocTestFailure objects provide access to the test:

         >>> failure.test is test
         True

       As well as to the example:

         >>> failure.example.want
         '2\n'

       and the actual output:

         >>> failure.got
         '1\n'

       If a failure or error occurs, the globals are left intact:

         >>> del test.globs['__builtins__']
         >>> test.globs
         {'x': 1}

         >>> test = DocTestParser().get_doctest('''
         ...      >>> x = 2
         ...      >>> raise KeyError
         ...      ''', {}, 'foo', 'foo.py', 0)

         >>> runner.run(test)
         Traceback (most recent call last):
         ...
         doctest.UnexpectedException: <DocTest foo from foo.py:0 (2 examples)>

         >>> del test.globs['__builtins__']
         >>> test.globs
         {'x': 2}

       But the globals are cleared if there is no error:

         >>> test = DocTestParser().get_doctest('''
         ...      >>> x = 2
         ...      ''', {}, 'foo', 'foo.py', 0)

         >>> runner.run(test)
         TestResults(failed=0, attempted=1)

         >>> test.globs
         {}

       NTcCs$tj||||d�}|r |jj�|S)NF)rr@r0r<)rfrr#r�r?�rr+r+r,r@.s
zDebugRunner.runcCst|||��dS)N)r)rfr�rrrar+r+r,r4sz'DebugRunner.report_unexpected_exceptioncCst|||��dS)N)r)rfr�rrrtr+r+r,r7szDebugRunner.report_failure)NNT)r5rkrlr�r@rrr+r+r+r,r�sY
TFc	Cs�|dkrtjjd�}tj|�s,td|f��|dkr:|j}t|d�}	|rVt||d�}
nt	||d�}
x$|	j
||||d�D]}|
j|�qvW|r�|
j�t
dkr�|
a
n
t
j|
�t|
j|
j�S)a*
m=None, name=None, globs=None, verbose=None, report=True,
       optionflags=0, extraglobs=None, raise_on_error=False,
       exclude_empty=False

    Test examples in docstrings in functions and classes reachable
    from module m (or the current module if m is not supplied), starting
    with m.__doc__.

    Also test examples reachable from dict m.__test__ if it exists and is
    not None.  m.__test__ maps names to functions, classes and strings;
    function and class docstrings are tested even if the name is private;
    strings are tested directly, as if they were docstrings.

    Return (#failures, #tests).

    See help(doctest) for an overview.

    Optional keyword arg "name" gives the name of the module; by default
    use m.__name__.

    Optional keyword arg "globs" gives a dict to be used as the globals
    when executing examples; by default, use m.__dict__.  A copy of this
    dict is actually used for each docstring, so that each docstring's
    examples start with a clean slate.

    Optional keyword arg "extraglobs" gives a dictionary that should be
    merged into the globals that are used to execute examples.  By
    default, no extra globals are used.  This is new in 2.4.

    Optional keyword arg "verbose" prints lots of stuff if true, prints
    only failures if false; by default, it's true iff "-v" is in sys.argv.

    Optional keyword arg "report" prints a summary at the end when true,
    else prints nothing at the end.  In verbose mode, the summary is
    detailed, else very brief (in fact, empty if all tests passed).

    Optional keyword arg "optionflags" or's together module constants,
    and defaults to 0.  This is new in 2.3.  Possible values (see the
    docs for details):

        DONT_ACCEPT_TRUE_FOR_1
        DONT_ACCEPT_BLANKLINE
        NORMALIZE_WHITESPACE
        ELLIPSIS
        SKIP
        IGNORE_EXCEPTION_DETAIL
        REPORT_UDIFF
        REPORT_CDIFF
        REPORT_NDIFF
        REPORT_ONLY_FIRST_FAILURE

    Optional keyword arg "raise_on_error" raises an exception on the
    first unexpected exception or failure. This allows failures to be
    post-mortem debugged.

    Advanced tomfoolery:  testmod runs methods of a local instance of
    class doctest.Tester, then merges the results into (or creates)
    global Tester instance doctest.master.  Methods of doctest.master
    can be called directly too, if you want to do something unusual.
    Passing report=0 to testmod is especially useful then, to delay
    displaying a summary.  Invoke doctest.master.summarize(verbose)
    when you're done fiddling.
    Nr�ztestmod: module required; %r)r�)r�r
)r0r�)r=r>r.r6r7rAr5rrrrrr@rB�masterrDr%rr)r�r*r0r��reportr
r��raise_on_errorr��finder�runnerrr+r+r,rCs$E


cCs�|r|rtd��t||||p d�\}}|dkr<tjj|�}|dkrJi}n|j�}|dk	rd|j|�d|krtd|d<|	r�t||d�}
nt||d�}
|
j	||||d�}|
j
|�|r�|
j�tdkr�|
an
tj
|
�t|
j|
j�S)a


    Test examples in the given file.  Return (#failures, #tests).

    Optional keyword arg "module_relative" specifies how filenames
    should be interpreted:

      - If "module_relative" is True (the default), then "filename"
         specifies a module-relative path.  By default, this path is
         relative to the calling module's directory; but if the
         "package" argument is specified, then it is relative to that
         package.  To ensure os-independence, "filename" should use
         "/" characters to separate path segments, and should not
         be an absolute path (i.e., it may not begin with "/").

      - If "module_relative" is False, then "filename" specifies an
        os-specific path.  The path may be absolute or relative (to
        the current working directory).

    Optional keyword arg "name" gives the name of the test; by default
    use the file's basename.

    Optional keyword argument "package" is a Python package or the
    name of a Python package whose directory should be used as the
    base directory for a module relative filename.  If no package is
    specified, then the calling module's directory is used as the base
    directory for module relative filenames.  It is an error to
    specify "package" if "module_relative" is False.

    Optional keyword arg "globs" gives a dict to be used as the globals
    when executing examples; by default, use {}.  A copy of this dict
    is actually used for each docstring, so that each docstring's
    examples start with a clean slate.

    Optional keyword arg "extraglobs" gives a dictionary that should be
    merged into the globals that are used to execute examples.  By
    default, no extra globals are used.

    Optional keyword arg "verbose" prints lots of stuff if true, prints
    only failures if false; by default, it's true iff "-v" is in sys.argv.

    Optional keyword arg "report" prints a summary at the end when true,
    else prints nothing at the end.  In verbose mode, the summary is
    detailed, else very brief (in fact, empty if all tests passed).

    Optional keyword arg "optionflags" or's together module constants,
    and defaults to 0.  Possible values (see the docs for details):

        DONT_ACCEPT_TRUE_FOR_1
        DONT_ACCEPT_BLANKLINE
        NORMALIZE_WHITESPACE
        ELLIPSIS
        SKIP
        IGNORE_EXCEPTION_DETAIL
        REPORT_UDIFF
        REPORT_CDIFF
        REPORT_NDIFF
        REPORT_ONLY_FIRST_FAILURE

    Optional keyword arg "raise_on_error" raises an exception on the
    first unexpected exception or failure. This allows failures to be
    post-mortem debugged.

    Optional keyword arg "parser" specifies a DocTestParser (or
    subclass) that should be used to extract tests from the files.

    Optional keyword arg "encoding" specifies an encoding that should
    be used to convert the file to unicode.

    Advanced tomfoolery:  testmod runs methods of a local instance of
    class doctest.Tester, then merges the results into (or creates)
    global Tester instance doctest.master.  Methods of doctest.master
    can be called directly too, if you want to do something unusual.
    Passing report=0 to testmod is especially useful then, to delay
    displaying a summary.  Invoke doctest.master.summarize(verbose)
    when you're done fiddling.
    z8Package may only be specified for module-relative paths.zutf-8Nr5r�)r�r
r")r�rUrMr��basenamer�r�rrr�r@rBrSrDr%rr)rQrSr*rRr0r�rTr
r�rUr�rH�textrWrr+r+r,r�s0R



�NoNamec	CsDt|dd�}t||d�}x&|j|||d�D]}|j||d�q*WdS)ar
    Test examples in the given object's docstring (`f`), using `globs`
    as globals.  Optional argument `name` is used in failure messages.
    If the optional argument `verbose` is true, then generate output
    even if there are no failures.

    `compileflags` gives the set of flags that should be used by the
    Python compiler when running the examples.  If not specified, then
    it will default to the set of future-import flags that apply to
    `globs`.

    Optional keyword arg `optionflags` specifies options for the
    testing and output.  See the documentation for `testmod` for more
    information.
    F)r�r�)r�r
)r0)r#N)rrrrr@)	rTr0r�r*r#r
rVrWrr+r+r,r&scCs"|t@|krtd|��t}|a|S)a?Sets the unittest option flags.

    The old flag is returned so that a runner could restore the old
    value if it wished to:

      >>> import doctest
      >>> old = doctest._unittest_reportflags
      >>> doctest.set_unittest_reportflags(REPORT_NDIFF |
      ...                          REPORT_ONLY_FIRST_FAILURE) == old
      True

      >>> doctest._unittest_reportflags == (REPORT_NDIFF |
      ...                                   REPORT_ONLY_FIRST_FAILURE)
      True

    Only reporting flags can be set:

      >>> doctest.set_unittest_reportflags(ELLIPSIS)
      Traceback (most recent call last):
      ...
      ValueError: ('Only reporting flags allowed', 8)

      >>> doctest.set_unittest_reportflags(old) == (REPORT_NDIFF |
      ...                                   REPORT_ONLY_FIRST_FAILURE)
      True
    zOnly reporting flags allowed)r
r��_unittest_reportflags)r1�oldr+r+r,rCs

c@sjeZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�ZeZ
dd�ZdS)�DocTestCaser"NcCs.tjj|�||_||_||_||_||_dS)N)�unittest�TestCaser��_dt_optionflags�_dt_checker�_dt_test�	_dt_setUp�_dt_tearDown)rfrr
�setUp�tearDownrr+r+r,r�iszDocTestCase.__init__cCs|j}|jdk	r|j|�dS)N)rbrc)rfrr+r+r,ress
zDocTestCase.setUpcCs(|j}|jdk	r|j|�|jj�dS)N)rbrdr0r<)rfrr+r+r,rfys

zDocTestCase.tearDowncCs�|j}tj}t�}|j}|t@s(|tO}t||jdd�}z$dd|_	|j
||jdd�\}}Wd|t_X|r~|j|j
|j����dS)NF)r
rr�rr)r�r?)rbr=r�r#r`r
r[rrarr@r3ZfailureException�format_failurer`)rfrr\�newr
rWrrr+r+r,�runTest�s
zDocTestCase.runTestcCsP|j}|jdkrd}n
d|j}dj|jjd�dd��}d|j|j|||fS)Nzunknown line numberz%sr~r&z:Failed doctest test for %s
  File "%s", line %s, in %s

%srm)rbr�r�r*rorQ)rf�errrr�Zlnamer+r+r,rg�s

zDocTestCase.format_failurecCs6|j�t|j|jdd�}|j|jdd�|j�dS)a�Run the test case without results and without catching exceptions

           The unit test framework includes a debug method on test cases
           and test suites to support post-mortem debugging.  The test code
           is run in such a way that errors are not caught.  This way a
           caller can catch the errors and initiate post-mortem debugging.

           The DocTestCase provides a debug method that raises
           UnexpectedException errors if there is an unexpected
           exception:

             >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42',
             ...                {}, 'foo', 'foo.py', 0)
             >>> case = DocTestCase(test)
             >>> try:
             ...     case.debug()
             ... except UnexpectedException as f:
             ...     failure = f

           The UnexpectedException contains the test, the example, and
           the original exception:

             >>> failure.test is test
             True

             >>> failure.example.want
             '42\n'

             >>> exc_info = failure.exc_info
             >>> raise exc_info[1] # Already has the traceback
             Traceback (most recent call last):
             ...
             KeyError

           If the output doesn't match, then a DocTestFailure is raised:

             >>> test = DocTestParser().get_doctest('''
             ...      >>> x = 1
             ...      >>> x
             ...      2
             ...      ''', {}, 'foo', 'foo.py', 0)
             >>> case = DocTestCase(test)

             >>> try:
             ...    case.debug()
             ... except DocTestFailure as f:
             ...    failure = f

           DocTestFailure objects provide access to the test:

             >>> failure.test is test
             True

           As well as to the example:

             >>> failure.example.want
             '2\n'

           and the actual output:

             >>> failure.got
             '1\n'

           F)r
rr�)r?N)rerr`rar@rbrf)rfrWr+r+r,r!�s
BzDocTestCase.debugcCs|jjS)N)rbr*)rfr+r+r,r��szDocTestCase.idcCsPt|�t|�k	rtS|j|jkoN|j|jkoN|j|jkoN|j|jkoN|j|jkS)N)r�r�rbr`rcrdra)rfr�r+r+r,r��szDocTestCase.__eq__cCst|j|j|j|jf�S)N)r�r`rcrdra)rfr+r+r,r��szDocTestCase.__hash__cCs,|jjjd�}d|ddj|dd��fS)Nr~z%s (%s)r&rmrm)rbr*ror�)rfr*r+r+r,r��szDocTestCase.__repr__cCsd|jjS)Nz	Doctest: )rbr*)rfr+r+r,�shortDescription	szDocTestCase.shortDescription)r"NNN)r5rkrlr�rerfrirgr!r�r�r�r�rQrkr+r+r+r,r]gs
	H
r]c@s0eZdZdd�Zdd�Zdd�Zdd�ZeZd	S)
�SkipDocTestCasecCs||_tj|d�dS)N)rBr]r�)rfrBr+r+r,r�	szSkipDocTestCase.__init__cCs|jd�dS)Nz-DocTestSuite will not work with -O2 and above)ZskipTest)rfr+r+r,re	szSkipDocTestCase.setUpcCsdS)Nr+)rfr+r+r,�	test_skip	szSkipDocTestCase.test_skipcCsd|jjS)NzSkipping tests from %s)rBr5)rfr+r+r,rk	sz SkipDocTestCase.shortDescriptionN)r5rkrlr�rermrkrQr+r+r+r,rl	s
rlc@seZdZdd�ZdS)�
_DocTestSuitecCsdS)Nr+)rf�indexr+r+r,�_removeTestAtIndex	sz _DocTestSuite._removeTestAtIndexN)r5rkrlrpr+r+r+r,rn	srnc	Ks�|dkrt�}t|�}|j|||d�}|rPtjjdkrPt�}|jt|��|S|j	�t�}x\|D]T}t
|j�dkrxqd|js�|j
}|dd�dkr�|dd	�}||_|jt|f|��qdW|S)
a
    Convert doctest tests for a module to a unittest test suite.

    This converts each documentation string in a module that
    contains doctest tests to a unittest test case.  If any of the
    tests in a doc string fail, then the test case fails.  An exception
    is raised showing the name of the file containing the test and a
    (sometimes approximate) line number.

    The `module` argument provides the module to be tested.  The argument
    can be either a module or a module name.

    If no argument is given, the calling module is used.

    A number of options may be provided as keyword arguments:

    setUp
      A set-up function.  This is called before running the
      tests in each file. The setUp function will be passed a DocTest
      object.  The setUp function can access the test globals as the
      globs attribute of the test passed.

    tearDown
      A tear-down function.  This is called after running the
      tests in each file.  The tearDown function will be passed a DocTest
      object.  The tearDown function can access the test globals as the
      globs attribute of the test passed.

    globs
      A dictionary containing initial global variables for the tests.

    optionflags
       A set of doctest option flags expressed as an integer.
    N)r0r�r3r"rVz.pycr&rrm)rrCrrr=r1�optimizern�addTestrlr�r)r�rQr�r])	rBr0r�Ztest_finderr�r��suiterrQr+r+r,r	s(%
c@s(eZdZdd�Zdd�ZeZdd�ZdS)�DocFileCasecCsdj|jjjd��S)Nr>r~)r�rbr*ro)rfr+r+r,r�`	szDocFileCase.idcCs|jjS)N)rbrQ)rfr+r+r,r�c	szDocFileCase.__repr__cCsd|jj|jj|fS)Nz2Failed doctest test for %s
  File "%s", line 0

%s)rbr*rQ)rfrjr+r+r,rgg	szDocFileCase.format_failureN)r5rkrlr�r�rQrgr+r+r+r,rt^	srtc
Ksx|dkri}n|j�}|r(|r(td��t||||p6d�\}}d|krN||d<tjj|�}|j||||d�}	t|	f|�S)Nz8Package may only be specified for module-relative paths.zutf-8r�r")r�r�rUrMr�rXr�rt)
r�rSrRr0r�rHr��docr*rr+r+r,�DocFileTestl	s
rvcOsHt�}|jdd�r$t|jd��|d<x|D]}|jt|f|��q*W|S)a�A unittest suite for one or more doctest files.

    The path to each doctest file is given as a string; the
    interpretation of that string depends on the keyword argument
    "module_relative".

    A number of options may be provided as keyword arguments:

    module_relative
      If "module_relative" is True, then the given file paths are
      interpreted as os-independent module-relative paths.  By
      default, these paths are relative to the calling module's
      directory; but if the "package" argument is specified, then
      they are relative to that package.  To ensure os-independence,
      "filename" should use "/" characters to separate path
      segments, and may not be an absolute path (i.e., it may not
      begin with "/").

      If "module_relative" is False, then the given file paths are
      interpreted as os-specific paths.  These paths may be absolute
      or relative (to the current working directory).

    package
      A Python package or the name of a Python package whose directory
      should be used as the base directory for module relative paths.
      If "package" is not specified, then the calling module's
      directory is used as the base directory for module relative
      filenames.  It is an error to specify "package" if
      "module_relative" is False.

    setUp
      A set-up function.  This is called before running the
      tests in each file. The setUp function will be passed a DocTest
      object.  The setUp function can access the test globals as the
      globs attribute of the test passed.

    tearDown
      A tear-down function.  This is called after running the
      tests in each file.  The tearDown function will be passed a DocTest
      object.  The tearDown function can access the test globals as the
      globs attribute of the test passed.

    globs
      A dictionary containing initial global variables for the tests.

    optionflags
      A set of doctest option flags expressed as an integer.

    parser
      A DocTestParser (or subclass) that should be used to extract
      tests from the files.

    encoding
      An encoding that will be used to convert the files to unicode.
    rSTrR)rnr.rCrrrv)�paths�kwrsr�r+r+r,r�	s8
cCs�g}x�t�j|�D]x}t|t�rj|j|jdd
��|j}|r�|jd�|dd�|jd�dd�D�7}q|dd�|jd�dd�D�7}qWx|r�|d
dkr�|j�q�Wx|r�|d	dkr�|jd	�q�Wdj	|�dS)awExtract script from text with examples.

       Converts text with examples to a Python script.  Example input is
       converted to regular code.  Example output and all other words
       are converted to comments:

       >>> text = '''
       ...       Here are examples of simple math.
       ...
       ...           Python has super accurate integer addition
       ...
       ...           >>> 2 + 2
       ...           5
       ...
       ...           And very friendly error messages:
       ...
       ...           >>> 1/0
       ...           To Infinity
       ...           And
       ...           Beyond
       ...
       ...           You can use logic if you want:
       ...
       ...           >>> if 0:
       ...           ...    blah
       ...           ...    blah
       ...           ...
       ...
       ...           Ho hum
       ...           '''

       >>> print(script_from_examples(text))
       # Here are examples of simple math.
       #
       #     Python has super accurate integer addition
       #
       2 + 2
       # Expected:
       ## 5
       #
       #     And very friendly error messages:
       #
       1/0
       # Expected:
       ## To Infinity
       ## And
       ## Beyond
       #
       #     You can use logic if you want:
       #
       if 0:
          blah
          blah
       #
       #     Ho hum
       <BLANKLINE>
       Nr&z# Expected:cSsg|]}d|�qS)z## r+)r�r�r+r+r,r�
sz(script_from_examples.<locals>.<listcomp>rGcSsg|]}t|��qSr+)r|)r�r�r+r+r,r�
sryr"rmrmrmrm)
rr�r8rr�r�rsro�popr�)rZr�Zpiecersr+r+r,r�	s:

"csJt|�}t�j|�}�fdd�|D�}|s4t�d��|d}t|j�}|S)aExtract the test sources from a doctest docstring as a script.

    Provide the module (or dotted name of the module) containing the
    test to be debugged and the name (within the module) of the object
    with the doc string with tests to be debugged.
    csg|]}|j�kr|�qSr+)r*)r�r()r*r+r,r�*
sztestsource.<locals>.<listcomp>znot found in testsr")rCrrrr�rr�)rBr*r�r�testsrcr+)r*r,r!
s

cCst|�}t|||�dS)z4Debug a single doctest docstring, in argument `src`'N)r�debug_script)�src�pmr0rzr+r+r,r 1
sc
Cs�ddl}|r|j�}ni}|rvyt|||�Wq�ttj�d�|jdd�}|j�|jdtj�d�Yq�Xn|jdd�j	d|||�dS)z7Debug a test script.  `src` is the script, as a string.r"Nr&T)r�r3zexec(%r))
r�r�rr�r=rar�r6Zinteractionr@)r|r}r0r��pr+r+r,r{6
s
r{cCs$t|�}t||�}t|||j�dS)z�Debug a single doctest docstring.

    Provide the module (or dotted name of the module) containing the
    test to be debugged and the name (within the module) of the object
    with the docstring with tests to be debugged.
    N)rCrr{r�)rBr*r}rzr+r+r,r!J
s
c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
_TestClassz�
    A pointless class, for sanity-checking of docstring testing.

    Methods:
        square()
        get()

    >>> _TestClass(13).get() + _TestClass(-12).get()
    1
    >>> hex(_TestClass(13).square().get())
    '0xa9'
    cCs
||_dS)z�val -> _TestClass object with associated value val.

        >>> t = _TestClass(123)
        >>> print(t.get())
        123
        N)r)rfrr+r+r,r�f
sz_TestClass.__init__cCs|jd|_|S)zosquare() -> square TestClass's associated value

        >>> _TestClass(13).square().get()
        169
        r3)r)rfr+r+r,�squarep
sz_TestClass.squarecCs|jS)z~get() -> return TestClass's associated value.

        >>> x = _TestClass(-42)
        >>> print(x.get())
        -42
        )r)rfr+r+r,r.z
sz_TestClass.getN)r5rkrlr�r�r�r.r+r+r+r,rX
s

rz�
                      Example of a string object, searched as-is.
                      >>> x = 1; y = 2
                      >>> x + y, x * y
                      (3, 2)
                      a�
                                    In 2.2, boolean expressions displayed
                                    0 or 1.  By default, we still accept
                                    them.  This can be disabled by passing
                                    DONT_ACCEPT_TRUE_FOR_1 to the new
                                    optionflags argument.
                                    >>> 4 == 4
                                    1
                                    >>> 4 == 4
                                    True
                                    >>> 4 > 4
                                    0
                                    >>> 4 > 4
                                    False
                                    z�
                Blank lines can be marked with <BLANKLINE>:
                    >>> print('foo\n\nbar\n')
                    foo
                    <BLANKLINE>
                    bar
                    <BLANKLINE>
            z�
                If the ellipsis flag is used, then '...' can be used to
                elide substrings in the desired output:
                    >>> print(list(range(1000))) #doctest: +ELLIPSIS
                    [0, 1, 2, ..., 999]
            a�
                If the whitespace normalization flag is used, then
                differences in whitespace are ignored.
                    >>> print(list(range(30))) #doctest: +NORMALIZE_WHITESPACE
                    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
                     15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
                     27, 28, 29]
            )rr�zbool-int equivalencezblank linesZellipsiszwhitespace normalizationcCs tjdd�}|jdddddd�|jd	d
dtj�gdd
�|jddddd�|jdddd�|j�}|j}|j}d}x|jD]}|t|O}q|W|j	r�|t
O}x||D]t}|jd�r�tj
j|�\}}tj
jd|�t|dd��}tj
d=t|||d�\}	}
nt|d||d�\}	}
|	r�dSq�WdS)Nzdoctest runner)Zdescriptionz-vz	--verbose�
store_trueFz'print very verbose output for all tests)�action�default�helpz-oz--optionr�zqspecify a doctest option flag to apply to the test run; may be specified more than once to apply multiple options)r��choicesr�r�z-fz--fail-fastzystop running tests after first failure (this is a shorthand for -o FAIL_FAST, and is in addition to any other -o options))r�r�r]r�z file containing the tests to run)�nargsr�r"z.pyrD)r�r
)rSr�r
r&���)�argparse�ArgumentParser�add_argumentr'�keys�
parse_argsr]r�r�Z	fail_fastrrerMr�ror=�insertr:rr)r�r�Z	testfilesr�r�r�rQ�dirnamer�rr>r+r+r,�_test�
s<



r�r�)r3)rV)	NNNNTr"NFF)FrZNr")NNNN)FN)FN)F)Sr�Z
__docformat__�__all__r-r�rOr6r�rMr�rXr=r^r^�ior#�collectionsr$r%r'rrrrrrrrr	r
rrrr
rLrnr2rCrUr\rcrdrxr|r�r�r�rIrrrrrr�	ExceptionrrrrSrrrr[rr_r]rlZ	TestSuiternrrtrvrrrr r{r!rr�r�r5�exitr+r+r+r,�<module>.s


1%.DKl;;n
fx
$!
@IR


,		+
stringprep.cpython-36.pyc000064400000023460150335715140011400 0ustar003


 \u2��@s�dZddlmZejdkst�dd�Zedddd	d
ddd
dddgeedd���Z	dd�Z
dddddddddddd d!d"d#d$d%d&d'd(dd)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDd=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdEdFdGdHdIdJdKdLdMdNdOdPdQdNddRdSdTdUdVdSdWddXdYdZdd[d\d]d^d_d`dadbd_dcdddedfdgdhdhdhdididjdkdldmdndodododpdqdrdsdsdtdddudvdwdxd&dydzd{d|d}d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d}d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dddyd�d�d�dkd�dmdndd�d�d�d�d�d�dsd�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dtdydudvd�d�d�djdwdkd�dmdndd�d�d�d�d�d�d�dtdydudvd�did�d�djdwd�dd�d�d�d�d�d�d�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�d dxd�d)d�d�d!dd'd�dd�d�d�d&d(d!dd�d"d%d�d�d�dd�d dxd�d)d�d�d!dd'd�dd�d�d�d&d(d!dd�d"d%d�d�d�dd�d dxd�d)d�d�d!dd'd�dd�d�d�d&d(d!dd�d"d%d�d�d�dd�d dxd�d)d�d�d!dd'd�dd�d�d�d&d(d!dd�d"d%d�d�d�dd�d dxd�d)d�d�d!dd'd�dd�d�d�d&d(d!dd�d"d%d�d�d�ddː��Zd�d̈́Zd�dτZ
d�dфZd�dӄZd�dՄZd�dׄZed�d�d�d
dd�d�dgeedd݃�eed�d߃�eed�d��eed�d���Zd�d�Zd�d�Zd�d�Zd�d�Zd�d�Zeed�d��Zd�d�Zeed�d��Zd�d�Zed�d�d�d�geed�d���eed�d߃��Zd�d��Zed�geed�d����Z�d�d�Z�d�d�Z �d�d�Z!�dS(z�Library that exposes various tables found in the StringPrep RFC 3454.

There are two kinds of tables: sets, for which a member test is provided,
and mappings, for which a mapping function is provided.
�)�	ucd_3_2_0z3.2.0cCsBtj|�dkrdSt|�}d|ko,dknr6dS|d@dkS)NZCnFi�i���)rr)�unicodedata�category�ord)�code�c�r
�"/usr/lib64/python3.6/stringprep.py�in_table_a1sr�iOiiii
i i i
 i` i��i�i�cCst|�tkS)N)r�b1_set)rr
r
r�in_table_b1sruμZssui̇uʼn�suǰuιu ιuΐuΰuσuβuθuυuύuϋuφuπuκuρuεuեւuẖuẗuẘuẙuaʾuṡuὐuὒuὔuὖuἀιuἁιuἂιuἃιuἄιuἅιuἆιuἇιuἠιuἡιuἢιuἣιuἤιuἥιuἦιuἧιuὠιuὡιuὢιuὣιuὤιuὥιuὦιuὧιuὰιuαιuάιuᾶuᾶιuὴιuηιuήιuῆuῆιuῒuῖuῗuῢuῤuῦuῧuὼιuωιuώιuῶuῶιZrsr	u°cuɛu°f�h�i�l�n�no�p�q�rZsmZtelZtm�z�b�e�f�muγ�dZhpaZauZovZpaZnauμaZmaZkaZkbZmbZgbZpfZnfuμf�hzZkhzZmhzZghzZthzZkpaZmpaZgpaZpvZnvuμvZmvZkvZpwZnwuμwZmw�kwukωumωZbquc∕kgzco.ZdbZgyZhpZkkZkmZphZppmZprZsv�wbZffZfiZflZffiZffl�stuմնuմեuմիuվնuմխ�a�g�j�k�o�t�u�v�w�x�yuαuδuζuηuλuνuξuοuτuχuψuω(����i0iIii�iEizi�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�iPiRiTiVi�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i� i!i!i!i	!i!i!i
!i!i!i!i!i!i!i!i!i!i!i !i!!i"!i$!i(!i,!i-!i0!i1!i3!i>!i?!iE!iq3is3iu3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i	�i
�i�i�i
�i�i�i�i�i�i�i�i�i�i�i�i�i4�i5�i6�i7�i8�i9�i:�i;�i<�i=�i>�i?�i@�iA�iB�iC�iD�iE�iF�iG�iH�iI�iJ�iK�iL�iM�ih�ii�ij�ik�il�im�in�io�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i�i�i�i�i	�i
�i
�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i8�i9�i;�i<�i=�i>�i@�iA�iB�iC�iD�iF�iJ�iK�iL�iM�iN�iO�iP�il�im�in�io�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i�i	�i
�i�i�i
�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i �i!�i<�i=�i>�i?�i@�iA�iB�iC�iD�iE�iF�iG�iH�iI�iJ�iK�iL�iM�iN�iO�iP�iQ�iR�iS�iT�iU�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i
�i�i�i�i�i �i!�i"�i#�i$�i%�i&�i'�i(�i)�i*�i+�i,�i-�i.�i/�i0�i1�i2�i3�i4�iG�iV�iW�iX�iY�iZ�i[�i\�i]�i^�i_�i`�ia�ib�ic�id�ie�if�ig�ih�ii�ij�ik�il�im�in�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��cCs"tjt|��}|dk	r|S|j�S)N)�
b3_exceptions�getr�lower)rrr
r
r�map_table_b3�sr3cCsHt|�}tjd|�}djdd�|D��}tjd|�}||kr@|S|SdS)NZNFKC�cSsg|]}t|��qSr
)r3)�.0Zchr
r
r�
<listcomp>�sz map_table_b2.<locals>.<listcomp>)r3rZ	normalize�join)r#ZalrZblr	r
r
r�map_table_b2�sr8cCs|dkS)N� r
)rr
r
r�in_table_c11�sr:cCstj|�dko|dkS)N�Zsr9)rr)rr
r
r�in_table_c12�sr<cCstj|�dkS)Nr;)rr)rr
r
r�in_table_c11_c12�sr=cCst|�dkotj|�dkS)N��Cc)rrr)rr
r
r�in_table_c21�sr@i�iii( i) id ij ip i��i��is�i{�cCs.t|�}|dkrdStj|�dkr&dS|tkS)Nr>Fr?T)rrr�c22_specials)rr	r
r
r�in_table_c22�srBcCstj|�dkpt|�tkS)Nr?)rrrrA)rr
r
r�in_table_c21_c22�srCcCstj|�dkS)NZCo)rr)rr
r
r�in_table_c3�srDcCs0t|�}|dkrdS|dkr dSt|�d@dkS)Ni�Fi�T��)rFrE)r)rr	r
r
r�in_table_c4�srGcCstj|�dkS)NZCs)rr)rr
r
r�in_table_c5�srHi��cCst|�tkS)N)r�c6_set)rr
r
r�in_table_c6�srJi�/i�/cCst|�tkS)N)r�c7_set)rr
r
r�in_table_c7�srLi@iAi i i* i/ cCst|�tkS)N)r�c8_set)rr
r
r�in_table_c8srNii i�cCst|�tkS)N)r�c9_set)rr
r
r�in_table_c9srPcCstj|�dkS)N�R�AL)rQrR)r�
bidirectional)rr
r
r�in_table_d1srTcCstj|�dkS)N�L)rrS)rr
r
r�in_table_d2srVN)"�__doc__rrZunidata_version�AssertionErrorr�set�list�rangerrr0r3r8r:r<r=r@rArBrCrDrGrHrIrJrKrLrMrNrOrPrTrVr
r
r
r�<module>s|,P,shlex.cpython-36.opt-2.pyc000064400000014474150335715140011273 0ustar003


 \�2�@s�ddlZddlZddlZddlmZddlmZdddgZGdd�d�Zdd
d�Z	ej
dej�jZ
dd�Zd
d�Zedkr�eej�dkr�ee��n,ejdZee��Zeeee��WdQRXdS)�N)�deque)�StringIO�shlex�split�quotec@sbeZdZddd�Zdd�Zddd�Zd	d
�Zdd�Zd
d�Zdd�Z	ddd�Z
dd�Zdd�ZdS)rNFcCst|t�rt|�}|dk	r(||_||_ntj|_d|_||_|rHd|_nd|_d|_	d|_
|jrn|j
d7_
d|_d|_d|_
d|_d	|_d
|_t�|_d|_d|_d|_t�|_d|_|s�d}n|d
kr�d}||_|�rt�|_|j
d7_
|j
jtj|��}|j
j|�|_
dS)N��#Z?abcdfeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_u|ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞz 	
Fz'"�\�"� �rTz();<>|&z~-./*?=)�
isinstance�strr�instream�infile�sys�stdin�posix�eof�
commenters�	wordchars�
whitespace�whitespace_split�quotes�escape�
escapedquotes�stater�pushback�lineno�debug�token�	filestack�source�punctuation_chars�_pushback_chars�	maketrans�dict�fromkeys�	translate)�selfrrrr#�t�r+�/usr/lib64/python3.6/shlex.py�__init__sJ
zshlex.__init__cCs*|jdkrtdt|��|jj|�dS)Nrzshlex: pushing token )r�print�reprr�
appendleft)r)�tokr+r+r,�
push_tokenDs
zshlex.push_tokencCspt|t�rt|�}|jj|j|j|jf�||_||_d|_|jrl|dk	r\t	d|jf�nt	d|jf�dS)Nrzshlex: pushing to file %szshlex: pushing to stream %s)
r
rrr!r0rrrrr.)r)�	newstream�newfiler+r+r,�push_sourceJs
zshlex.push_sourcecCsD|jj�|jj�\|_|_|_|jr:td|j|jf�d|_dS)Nzshlex: popping to %s, line %dr)	r�closer!�popleftrrrr.r)r)r+r+r,�
pop_sourceXs
zshlex.pop_sourcecCs�|jr.|jj�}|jdkr*tdt|��|S|j�}|jdk	r~x<||jkr||j|j��}|rr|\}}|j||�|j	�}qBWx*||j
kr�|js�|j
S|j�|j	�}q�W|jdkr�||j
kr�tdt|��ntd�|S)Nrzshlex: popping token z
shlex: token=zshlex: token=EOF)
rr7rr.r/�
read_tokenr"�
sourcehookr5�	get_tokenrr!r8)r)r1�raw�specr4r3r+r+r,r;as.




zshlex.get_tokencCs�d}d}�x\|jr$|jr$|jj�}n|jjd�}|dkrF|jd7_|jdkrbtd|j|f�|jdkrvd|_	Pq|jdk�r�|s�d|_P�qd||j
kr�|jdkr�td	�|j	s�|jr|rPnqn�||jkr�|jj
�|jd7_n�|jo�||jk�rd
}||_n�||jk�r"||_	d
|_np||jk�r<||_	d|_nV||jk�r^|j�sV||_	||_n4|j�rt||_	d
|_n||_	|j	�s�|jr|rPnqq|j|jk�r<d}|�s�|jdk�r�td
�td��||jk�r�|j�s�|j	|7_	d|_Pnd
|_n>|j�r,||jk�r,|j|jk�r,|j}||_n|j	|7_	q|j|jk�r�|�sl|jdk�rdtd�td��||jk�r�||jk�r�||k�r�|j	|j7_	|j	|7_	||_q|jdkr|�s�d|_Pq||j
k�r|jdk�r�td�d|_|j	�s|jr|rPnqq||jk�rZ|jj
�|jd7_|j�rdd|_|j	�sR|jr|rPnqq|jdk�r�||jk�r�|j	|7_	n ||j
k�r�|jj|�d|_Pq|j�r�||jk�r�||_q|j�r�||jk�r�d
}||_q||jk�s||jk�s|j�r|j	|7_	q|j�r&|jj|�n|jj|�|jdk�rFtd�d|_|j	�s^|jr|rPqqqW|j	}d|_	|j�r�|�r�|dk�r�d}|jdk�r�|�r�tdt|��ntd�|S)NFrr�
�z&shlex: in state %r I see character: %rr�z+shlex: I see whitespace in whitespace state�a�cTz shlex: I see EOF in quotes statezNo closing quotationz shlex: I see EOF in escape statezNo escaped characterz%shlex: I see whitespace in word statez&shlex: I see punctuation in word statezshlex: raw token=zshlex: raw token=EOF)rArB)r#r$�popr�readrrr.rr rrr�readlinerrrr�
ValueErrorr�appendrr0r/)r)ZquotedZescapedstateZnextchar�resultr+r+r,r9�s�









zshlex.read_tokencCsX|ddkr|dd�}t|jt�rJtjj|�rJtjjtjj|j�|�}|t|d�fS)Nrr
r�r���)	r
rr�os�path�isabs�join�dirname�open)r)r4r+r+r,r:s
zshlex.sourcehookcCs(|dkr|j}|dkr|j}d||fS)Nz"%s", line %d: )rr)r)rrr+r+r,�error_leaders
zshlex.error_leadercCs|S)Nr+)r)r+r+r,�__iter__#szshlex.__iter__cCs|j�}||jkrt�|S)N)r;r�
StopIteration)r)r r+r+r,�__next__&s
zshlex.__next__)NNFF)N)NN)
�__name__�
__module__�__qualname__r-r2r5r8r;r9r:rQrRrTr+r+r+r,rs
.
	 	
FTcCs$t||d�}d|_|sd|_t|�S)N)rTr)rrr�list)�sZcommentsrZlexr+r+r,r,s
z[^\w@%+=:,./-]cCs,|sdSt|�dkr|Sd|jdd�dS)Nz''�'z'"'"')�_find_unsafe�replace)rYr+r+r,r6s
cCs(x"|j�}|sPtdt|��qWdS)NzToken: )r;r.r/)ZlexerZttr+r+r,�
_print_tokensBs
r]�__main__r)FT)rK�rer�collectionsr�ior�__all__rr�compile�ASCII�searchr[rr]rU�len�argv�fnrP�fr+r+r+r,�<module>
s$



posixpath.cpython-36.opt-2.pyc000064400000021431150335715140012156 0ustar003

�\dh�?�'@sbdZdZdZdZdZdZdZdZddlZddl	Z	ddl
Z
ddlZddlTd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/g'Zd0d1�Z
d2d	�Zd3d
�Zd4d�Zd5d
�Zd6d�Zejje_d7d�Zd8d�Zd9d�Zd:d�Zd;d�Zd<d�Zd=d�Zdadad>d�Zd?d�Zd@d�Z dAdB�dCd+�Z!dDdE�Z"e	j#dFkZ$dIdGd-�Z%dHd.�Z&dS)J�.z..�/�:z:/bin:/usr/binNz	/dev/null�)�*�normcase�isabs�join�
splitdrive�split�splitext�basename�dirname�commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�ismount�
expanduser�
expandvars�normpath�abspath�samefile�sameopenfile�samestat�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenames�relpath�
commonpath�
ALLOW_MISSINGcCst|t�rdSdSdS)N�/r)�
isinstance�bytes)�path�r1�!/usr/lib64/python3.6/posixpath.py�_get_sep)s
r3cCs.tj|�}t|ttf�s*tdj|jj���|S)Nz2normcase() argument must be str or bytes, not '{}')	�os�fspathr.r/�str�	TypeError�format�	__class__�__name__)�sr1r1r2r4s

cCstj|�}t|�}|j|�S)N)r4r5r3�
startswith)r;r"r1r1r2r@s
c
Gs�tj|�}t|�}|}yd|s,|dd�|xJttj|�D]:}|j|�rN|}q:|s^|j|�rh||7}q:|||7}q:WWn.tttfk
r�t	j
d|f|���YnX|S)Nrr)r4r5r3�mapr<�endswithr7�AttributeError�BytesWarning�genericpath�_check_arg_types)�a�pr"r0�br1r1r2rKs 


cCs`tj|�}t|�}|j|�d}|d|�||d�}}|rX||t|�krX|j|�}||fS)N�)r4r5r3�rfind�len�rstrip)rDr"�i�head�tailr1r1r2r
hs

cCs6tj|�}t|t�rd}d}nd}d}tj||d|�S)Nr-�.rr)r4r5r.r/rA�	_splitext)rDr"r&r1r1r2rys

cCstj|�}|dd�|fS)Nr)r4r5)rDr1r1r2r	�s
cCs,tj|�}t|�}|j|�d}||d�S)NrF)r4r5r3rG)rDr"rJr1r1r2r�s
cCsNtj|�}t|�}|j|�d}|d|�}|rJ||t|�krJ|j|�}|S)NrF)r4r5r3rGrHrI)rDr"rJrKr1r1r2r
�s

cCs4ytj|�}Wnttfk
r&dSXtj|j�S)NF)r4�lstat�OSErrorr?�stat�S_ISLNK�st_mode)r0�str1r1r2r�s
cCs(ytj|�Wntk
r"dSXdS)NFT)r4rOrP)r0r1r1r2r�s
cCs�ytj|�}Wntk
r"dSXtj|j�r4dSt|t�rJt|d�}n
t|d�}t	|�}ytj|�}Wntk
r~dSX|j
}|j
}||kr�dS|j}|j}||kr�dSdS)NFs..z..T)r4rOrPrQrRrSr.r/rr(�st_dev�st_ino)r0�s1�parent�s2�dev1�dev2�ino1�ino2r1r1r2r�s.

c	Cs4tj|�}t|t�rd}nd}|j|�s,|St|�}|j|d�}|dkrPt|�}|dkr�dtjkr�ddl	}y|j
tj��j}Wq�t
k
r�|SXq�tjd}nRddl	}|d|�}t|t�r�t|d�}y|j|�}Wnt
k
r�|SX|j}t|t��rtj|�}d}nd}|j|�}|||d��p2|S)	N�~�~rFr�HOME�ASCIIr-r)r4r5r.r/r<r3�findrH�environ�pwd�getpwuid�getuid�pw_dir�KeyErrorr6�getpwnam�fsencoderI)	r0�tilder"rJrd�userhome�name�pwent�rootr1r1r2r�sB







cCs\tj|�}t|t�rVd|kr |Sts:ddl}|jd|j�atj}d}d}t	tdd�}n:d|krb|St
s|ddl}|jd|j�a
t
j}d	}d
}tj}d}x�|||�}|s�P|jd�\}}|j
d�}	|	j|�r�|	j|�r�|	dd�}	y.|dk�rtjtjtj|	��}
n||	}
Wntk
�r&|}Yq�X||d�}|d|�|
}t|�}||7}q�W|S)
N�$rs\$(\w+|\{[^}]*\})�{�}�environb�$z\$(\w+|\{[^}]*\})�{�}rF���)r4r5r.r/�	_varprogb�re�compilera�search�getattr�_varprogrc�span�groupr<r>rj�fsdecoderhrH)r0ryr{�start�endrcrJ�m�jrm�valuerLr1r1r2rsP





c	Cs�tj|�}t|t�r&d}d}d}d}nd}d}d}d}||krB|S|j|�}|rr|j|d	�rr|j|d
�rrd	}|j|�}g}xV|D]N}|||fkr�q�||ks�|r�|s�|r�|d|kr�|j|�q�|r�|j�q�W|}|j|�}|r�|||}|p�|S)
Nr-�rMs..r�rz..��rFrw)	r4r5r.r/r<r
�append�popr)	r0r"�empty�dot�dotdot�initial_slashes�comps�	new_comps�compr1r1r2rRs>





cCs@tj|�}t|�s8t|t�r&tj�}ntj�}t||�}t|�S)N)	r4r5rr.r/�getcwdb�getcwdrr)r0�cwdr1r1r2rxs



F)�strictcCs,tj|�}t|dd�||i�\}}t|�S)Nr)r4r5�
_joinrealpathr)�filenamer�r0�okr1r1r2r(�s
c
Cs�t|t�rd}d}d}nd}d}d}tj}|tkr8t}n|rBf}nt}d}	t|�rb|dd�}|}�x"|�r�|j|�\}
}}|
sf|
|kr�qf|
|kr�|r�t	|�\}}
|
|kr�t
|||�}qf|}qft
||
�}ytj|�}
Wn|k
r�d}YnXtj
|
j�}|�s
|}qf||k�rH||}|dk	�r(qf|�r:tj|�nt
||�dfSd||<t|tj|�||�\}}|�s|t
||�dfS|||<qfW|d	fS)
Nr-rMs..rrz..rFFT)r.r/r4r�r,�FileNotFoundErrorrPr�	partitionr
rrOrQrRrSr��readlink)r0�restr��seenr"r r!r��
ignored_error�maxlinksrm�_�newpathrT�is_linkr�r1r1r2r��sd





r��darwinc	Cs�|std��tj|�}t|t�r.d}d}d}nd}d}d}|dkrH|}n
tj|�}yndd	�t|�j|�D�}d
d	�t|�j|�D�}tt||g��}|gt|�|||d�}|s�|St	|�St
ttt
fk
r�tjd||��YnXdS)Nzno path specifiedrMr-s..rrz..cSsg|]}|r|�qSr1r1)�.0�xr1r1r2�
<listcomp>�szrelpath.<locals>.<listcomp>cSsg|]}|r|�qSr1r1)r�r�r1r1r2r��sr*)�
ValueErrorr4r5r.r/rr
rHrrr7r?r@�DeprecationWarningrArB)	r0r�r r"r!�
start_list�	path_listrJ�rel_listr1r1r2r*�s0


c	s2|std��tttj|��}t|dt�r4d�d�nd�d�yƇfdd�|D�}yt�fd	d
�|D��\}Wntk
r�td�d�YnX�fdd�|D�}t|�}t	|�}|}x.t
|�D]"\}}|||kr�|d|�}Pq�W|r�n
�dd�}|�j|�Stt
fk
�r,tjd|���YnXdS)Nz%commonpath() arg is an empty sequencerr-rMrrcsg|]}|j���qSr1)r
)r�r0)r"r1r2r�szcommonpath.<locals>.<listcomp>c3s|]}|dd��kVqdS)NrFr1)r�rD)r"r1r2�	<genexpr>szcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathscsg|]}�fdd�|D��qS)csg|]}|r|�kr|�qSr1r1)r��c)r r1r2r�sz)commonpath.<locals>.<listcomp>.<listcomp>r1)r�r;)r r1r2r�sr+)r+)r��tupler=r4r5r.r/�set�min�max�	enumeraterr7r?rArB)	�paths�split_pathsrrWrY�commonrJr��prefixr1)r r"r2r+s6)N)'r r!r&r"r#r$r%r'r4�sysrQrA�__all__r3rrrr
rrN�__doc__r	rr
rrrrr}rxrrrr(r��platformr)r*r+r1r1r1r2�<module>sX

	
	

*25&	F

)telnetlib.cpython-36.opt-1.pyc000064400000043263150335715140012127 0ustar003


 \`Z�@sJdZddlZddlZddlZddlmZdgZdZdZ	e
dg�Ze
dg�Ze
dg�Z
e
d	g�Ze
d
g�Ze
dg�Ze
dg�Ze
dg�Ze
d
g�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Z e
dg�Z!e
dg�Z"e
dg�Z#e
dg�Z$e
dg�Z%e
dg�Z&e
d g�Z'e
d!g�Z(e
d"g�Z)e
d#g�Z*e
d$g�Z+e
d%g�Z,e
d&g�Z-e
d'g�Z.e
d(g�Z/e
d)g�Z0e
d*g�Z1e
d+g�Z2e
dg�Z3e
d,g�Z4e
d-g�Z5e
d.g�Z6e
d/g�Z7e
d0g�Z8e
d1g�Z9e
d2g�Z:e
d3g�Z;e
d4g�Z<e
d5g�Z=e
d6g�Z>e
d7g�Z?e
d8g�Z@e
d9g�ZAe
d:g�ZBe
d;g�ZCe
d<g�ZDe
d=g�ZEe
d>g�ZFe
d?g�ZGe
d@g�ZHe
dAg�ZIe
dBg�ZJe
dCg�ZKe
dDg�ZLe
dEg�ZMe
dFg�ZNe
dGg�ZOe
dHg�ZPe
dg�ZQe
dg�ZReSedI��rejTZUnejVZUGdJd�d�ZWdKdL�ZXeYdMk�rFeX�dS)NaQTELNET client class.

Based on RFC 854: TELNET Protocol Specification, by J. Postel and
J. Reynolds

Example:

>>> from telnetlib import Telnet
>>> tn = Telnet('www.python.org', 79)   # connect to finger port
>>> tn.write(b'guido\r\n')
>>> print(tn.read_all())
Login       Name               TTY         Idle    When    Where
guido    Guido van Rossum      pts/2        <Dec  2 11:10> snag.cnri.reston..

>>>

Note that read_all() won't read until eof -- it just reads some data
-- but it guarantees to read at least one byte unless EOF is hit.

It is possible to pass a Telnet object to a selector in order to wait until
more data is available.  Note that in this case, read_eager() may return b''
even if there was data on the socket, because the protocol negotiation may have
eaten the data.  This is why EOFError is needed in some cases to distinguish
between "no data" and "connection closed" (since the socket also appears ready
for reading when it is closed).

To do:
- option negotiation
- timeout should be intrinsic to the connection object instead of an
  option on one of the read calls only

�N)�	monotonic�Telnet�������������������������������	�
���
������������������ �!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�0�1����PollSelectorc@seZdZdZddejfdd�Zdejfdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zd<dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd=d6d7�Zd8d9�Z d:d;�Z!dS)>ra�Telnet interface class.

    An instance of this class represents a connection to a telnet
    server.  The instance is initially not connected; the open()
    method must be used to establish a connection.  Alternatively, the
    host name and optional port number can be passed to the
    constructor, too.

    Don't try to reopen an already connected instance.

    This class has many read_*() methods.  Note that some of them
    raise EOFError when the end of the connection is read, because
    they can return an empty string for other reasons.  See the
    individual doc strings.

    read_until(expected, [timeout])
        Read until the expected string has been seen, or a timeout is
        hit (default is no timeout); may block.

    read_all()
        Read all data until EOF; may block.

    read_some()
        Read at least one byte or EOF; may block.

    read_very_eager()
        Read all data available already queued or on the socket,
        without blocking.

    read_eager()
        Read either data already queued or some data available on the
        socket, without blocking.

    read_lazy()
        Read all data in the raw queue (processing it first), without
        doing any socket I/O.

    read_very_lazy()
        Reads all data in the cooked queue, without doing any socket
        I/O.

    read_sb_data()
        Reads available data between SB ... SE sequence. Don't block.

    set_option_negotiation_callback(callback)
        Each time a telnet option is read on the input flow, this callback
        (if set) is called with the following parameters :
        callback(telnet socket, command, option)
            option will be chr(0) when there is no option.
        No other action is done afterwards by telnetlib.

    NrcCsht|_||_||_||_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
|dk	rd|j|||�dS)z�Constructor.

        When called without arguments, create an unconnected instance.
        With a hostname argument, it connects the instance; port number
        and timeout are optional.
        N�r)�
DEBUGLEVEL�
debuglevel�host�port�timeout�sock�rawq�irawq�cookedq�eof�iacseq�sb�sbdataq�option_callback�open)�selfrLrMrN�rZ�!/usr/lib64/python3.6/telnetlib.py�__init__�szTelnet.__init__cCs6d|_|st}||_||_||_tj||f|�|_dS)z�Connect to a host.

        The optional second argument is the port number, which
        defaults to the standard telnet port (23).

        Don't try to reopen an already connected instance.
        rN)rS�TELNET_PORTrLrMrN�socketZcreate_connectionrO)rYrLrMrNrZrZr[rX�szTelnet.opencCs|j�dS)z#Destructor -- close the connection.N)�close)rYrZrZr[�__del__�szTelnet.__del__cGs@|jdkr<td|j|jfdd�|r4t||�nt|�dS)z�Print a debug message, when the debug level is > 0.

        If extra arguments are present, they are substituted in the
        message using the standard string formatting operator.

        rzTelnet(%s,%s):� )�endN)rK�printrLrM)rY�msg�argsrZrZr[rd�s

z
Telnet.msgcCs
||_dS)zhSet the debug level.

        The higher it is, the more debug output you get (on sys.stdout).

        N)rK)rYrKrZrZr[�set_debuglevel�szTelnet.set_debuglevelcCs.|j}d|_d|_d|_d|_|r*|j�dS)zClose the connection.NTrIr)rOrSrTrUr_)rYrOrZrZr[r_szTelnet.closecCs|jS)z)Return the socket object used internally.)rO)rYrZrZr[�
get_socketszTelnet.get_socketcCs
|jj�S)z9Return the fileno() of the socket object used internally.)rO�fileno)rYrZrZr[rhsz
Telnet.filenocCs4t|kr|jttt�}|jd|�|jj|�dS)z�Write a string to the socket, doubling any IAC characters.

        Can block if the connection is blocked.  May raise
        OSError if the connection is closed.

        zsend %rN)�IAC�replacerdrO�sendall)rY�bufferrZrZr[�writeszTelnet.writecCs t|�}|j�|jj|�}|dkrN||}|jd|�}|j|d�|_|S|dk	r`t�|}t���}|j|tj�x�|j	�s|j
|�r�tdt|j�|�}|j�|j�|jj||�}|dkr�||}|jd|�}|j|d�|_|S|dk	rx|t�}|dkrxPqxWWdQRX|j
�S)aRead until a given string is encountered or until timeout.

        When no match is found, return whatever is available instead,
        possibly the empty string.  Raise EOFError if the connection
        is closed and no cooked data is available.

        rN)�len�process_rawqrR�find�_time�_TelnetSelector�register�	selectors�
EVENT_READrS�select�max�	fill_rawq�read_very_lazy)rY�matchrN�n�i�buf�deadline�selectorrZrZr[�
read_until$s8



zTelnet.read_untilcCs4|j�x|js"|j�|j�q
W|j}d|_|S)z7Read all data until EOF; block until connection closed.rI)rorSrxrR)rYr}rZrZr[�read_allIszTelnet.read_allcCs>|j�x$|jr,|jr,|j�|j�q
W|j}d|_|S)z�Read at least one byte of cooked data unless EOF is hit.

        Return b'' if EOF is hit.  Block if no data is immediately
        available.

        rI)rorRrSrx)rYr}rZrZr[�	read_someSszTelnet.read_somecCs6|j�x$|jr,|j�r,|j�|j�q
W|j�S)aRead everything that's possible without blocking in I/O (eager).

        Raise EOFError if connection closed and no cooked data
        available.  Return b'' if no cooked data available otherwise.
        Don't block unless in the midst of an IAC sequence.

        )rorS�
sock_availrxry)rYrZrZr[�read_very_eagerbs
zTelnet.read_very_eagercCs>|j�x,|jr4|jr4|j�r4|j�|j�q
W|j�S)z�Read readily available data.

        Raise EOFError if connection closed and no cooked data
        available.  Return b'' if no cooked data available otherwise.
        Don't block unless in the midst of an IAC sequence.

        )rorRrSr�rxry)rYrZrZr[�
read_eagerps
zTelnet.read_eagercCs|j�|j�S)aProcess and return data that's already in the queues (lazy).

        Raise EOFError if connection closed and no data available.
        Return b'' if no cooked data available otherwise.  Don't block
        unless in the midst of an IAC sequence.

        )rory)rYrZrZr[�	read_lazy~szTelnet.read_lazycCs,|j}d|_|r(|jr(|jr(td��|S)z�Return any data available in the cooked queue (very lazy).

        Raise EOFError if connection closed and no data available.
        Return b'' if no cooked data available otherwise.  Don't block.

        rIztelnet connection closed)rRrSrP�EOFError)rYr}rZrZr[ry�s
zTelnet.read_very_lazycCs|j}d|_|S)aReturn any data available in the SB ... SE queue.

        Return b'' if no SB ... SE available. Should only be called
        after seeing a SB or SE command. When a new SB command is
        found, old unread SB data will be discarded. Don't block.

        rI)rV)rYr}rZrZr[�read_sb_data�szTelnet.read_sb_datacCs
||_dS)zIProvide a callback function called after each receipt of a telnet option.N)rW)rY�callbackrZrZr[�set_option_negotiation_callback�sz&Telnet.set_option_negotiation_callbackcCsXddg}�y�x�|j�r|j�}|jsj|tkr0q|dkr:q|tkrZ||j|||j<qn|j|7_qt|j�dk�r(|ttt	t
fkr�|j|7_qd|_|tkr�||j|||j<nh|tkr�d|_d|_n&|t
kr�d|_|j|d|_d|d<|j�r|j|j|t�n|jdt|��qt|j�dkr|jdd�}d|_|}|ttfk�r�|jd|tk�rrd�ptd	t|��|j�r�|j|j||�n|jjtt
|�q|t	t
fkr|jd|t	k�r�d
�p�dt|��|j�r�|j|j||�q|jjtt|�qWWn"tk
�r2d|_d|_YnX|j|d|_|j|d|_dS)
z�Transfer from raw queue to cooked queue.

        Set self.eof when connection is closed.  Don't block unless in
        the midst of an IAC sequence.

        rI�rrzIAC %d not recognizedrz	IAC %s %d�DO�DONT�WILL�WONTN)rP�rawq_getcharrT�theNULLrirUrnr�r�r�r��SBrV�SErWrO�NOOPTrd�ordrkr�rR)rYr}�c�cmd�optrZrZr[ro�shzTelnet.process_rawqcCsZ|js|j�|jrt�|j|j|jd�}|jd|_|jt|j�krVd|_d|_|S)z�Get next char from raw queue.

        Block if no data is immediately available.  Raise EOFError
        when connection is closed.

        rrIr)rPrxrSr�rQrn)rYr�rZrZr[r��szTelnet.rawq_getcharcCsL|jt|j�krd|_d|_|jjd�}|jd|�||_|j||_dS)z�Fill raw queue from exactly one recv() system call.

        Block if no data is immediately available.  Set self.eof when
        connection is closed.

        rIr�2zrecv %rN)rQrnrPrOZrecvrdrS)rYr}rZrZr[rxszTelnet.fill_rawqc
Cs.t��}|j|tj�t|jd��SQRXdS)z-Test whether data is available on the socket.rN)rrrsrtru�boolrv)rYrrZrZr[r�szTelnet.sock_availcCs�tjdkr|j�dSt���}|j|tj�|jtjtj�x�x�|j�D]�\}}|j	|kr�y|j
�}Wntk
r�td�dSX|r�tj
j|jd��tj
j�qH|j	tjkrHtjj�jd�}|s�dS|j|�qHWq>WWdQRXdS)z9Interaction function, emulates a very dumb telnet client.Zwin32Nz(*** Connection closed by remote host ***�ascii)�sys�platform�mt_interactrrrsrtru�stdinrvZfileobjr�r�rc�stdoutrm�decode�flush�readline�encode)rYr�keyZevents�text�linerZrZr[�interacts,

zTelnet.interactcCs@ddl}|j|jf�x$tjj�}|s(P|j|jd��qWdS)z$Multithreaded version of interact().rNr�)�_thread�start_new_thread�listenerr�r�r�rmr�)rYr�r�rZrZr[r�1s
zTelnet.mt_interactcCsVxPy|j�}Wntk
r*td�dSX|rDtjj|jd��qtjj�qWdS)z>Helper for mt_interact() -- this executes in the other thread.z(*** Connection closed by remote host ***Nr�)r�r�rcr�r�rmr�r�)rY�datarZrZr[r�;szTelnet.listenercCsPd}|dd�}tt|��}x8|D]0}t||d�s"|s@ddl}|j||�||<q"W|dk	rht�|}t���}|j|tj	�x�|j
�s|j�xP|D]H}||j|j
�}|r�|j�}	|j
d|	�}
|j
|	d�|_
|||
fSq�W|dk	�r|j|�}|t�}|�s|dkr�Pnq�|j�q�WWdQRX|j�}
|
�rF|j
�rFt�dd|
fS)a�Read until one from a list of a regular expressions matches.

        The first argument is a list of regular expressions, either
        compiled (re.RegexObject instances) or uncompiled (strings).
        The optional second argument is a timeout, in seconds; default
        is no timeout.

        Return a tuple of three items: the index in the list of the
        first regular expression that matches; the match object
        returned; and the text read up till and including the match.

        If EOF is read and no text was read, raise EOFError.
        Otherwise, when nothing matches, return (-1, None, text) where
        text is the text received so far (may be the empty string if a
        timeout happened).

        If a regular expression ends with a greedy match (e.g. '.*')
        or if more than one expression can match the same input, the
        results are undeterministic, and may depend on the I/O timing.

        N�searchrr���)�rangern�hasattr�re�compilerqrrrsrtrurSror�rRrbrvrxryr�)rY�listrNr��indicesr|r~r�m�er�ZreadyrZrZr[�expectHsB






z
Telnet.expectcCs|S)NrZ)rYrZrZr[�	__enter__�szTelnet.__enter__cCs|j�dS)N)r_)rY�type�value�	tracebackrZrZr[�__exit__�szTelnet.__exit__)N)N)"�__name__�
__module__�__qualname__�__doc__r^Z_GLOBAL_DEFAULT_TIMEOUTr\rXr`rdrfr_rgrhrmr�r�r�r�r�r�ryr�r�ror�rxr�r�r�r�r�r�r�rZrZrZr[r�s<5

%

H

8cCs�d}x0tjdd�r4tjddkr4|d}tjd=qWd}tjdd�rRtjd}d}tjdd�r�tjd}yt|�}Wn tk
r�tj|d�}YnXt��(}|j|�|j||dd	�|j	�WdQRXdS)
z�Test program for telnetlib.

    Usage: python telnetlib.py [-d] ... [host [port]]

    Default host is localhost; default port is 23.

    rrNz-dZ	localhostrZtcpg�?)rN)
r��argv�int�
ValueErrorr^Z
getservbynamerrfrXr�)rKrLrMZportstrZtnrZrZr[�test�s$


r��__main__)Zr�r�r^rtZtimerrq�__all__rJr]�bytesrir�r�r�r�r�r�ZNOPZDMZBRKZIPZAOZAYTZECZELZGAr�ZBINARYZECHOZRCPZSGAZNAMSZSTATUSZTMZRCTEZNAOLZNAOPZNAOCRDZNAOHTSZNAOHTDZNAOFFDZNAOVTSZNAOVTDZNAOLFDZXASCIIZLOGOUTZBMZDETZSUPDUPZSUPDUPOUTPUTZSNDLOCZTTYPEZEORZTUIDZOUTMRKZTTYLOCZVT3270REGIMEZX3PADZNAWSZTSPEEDZLFLOWZLINEMODEZXDISPLOCZOLD_ENVIRONZAUTHENTICATIONZENCRYPTZNEW_ENVIRONZTN3270EZXAUTH�CHARSETZRSPZCOM_PORT_OPTIONZSUPPRESS_LOCAL_ECHOZTLSZKERMITZSEND_URLZ	FORWARD_XZPRAGMA_LOGONZ
SSPI_LOGONZPRAGMA_HEARTBEATZEXOPLr�r�rHrrZSelectSelectorrr�r�rZrZrZr[�<module> s�







































































}
pydoc.cpython-36.opt-2.pyc000064400000221004150335715140011253 0ustar003

�]dhM��@s�dgZdZdZdZddlZddlZddlZddlZddl	Zddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlmZddlmZddlmZd	d
�Zdd�Zd
d�Zdd�Zdd�Z dd�Z!dd�Z"ej#dej$�Z%dd�Z&dd�Z'dd�Z(dd�Z)d d!�Z*dtd"d#�Z+d$d%�Z,d&d'�Z-d(d)�Z.d*d+�Z/ifd,d-�Z0Gd.d/�d/e1�Z2d0d1�Z3difd2d3�Z4Gd4d5�d5�Z5Gd6d7�d7e�Z6Gd8d9�d9e5�Z7Gd:d;�d;e�Z8Gd<d=�d=e5�Z9Gd>d?�d?e9�Z:d@dA�a;dBdC�Z<dDdE�Z=dFdG�Z>dHdI�Z?dJdK�Z@dLdM�ZAdNdO�ZBdPdQ�ZCdudRdS�ZDe9�ZEe:�ZFe7�ZGdvdTdU�ZHdwdWdX�ZIdxdYdZ�ZJdyd[d\�ZKdzd^d_�ZLGd`da�da�ZMeM�ZNGdbdc�dc�ZOddde�ZPdfdg�ZQd{didj�ZRd|dkdl�dmdn�ZSdodp�ZTdqdr�ZUeVdsk�r�eU�dS)}�helpzKa-Ping Yee <ping@lfw.org>z26 February 2001z�Guido van Rossum, for an excellent programming language.
Tommy Burnette, the original creator of manpy.
Paul Prescod, for all his work on onlinehelp.
Richard Chamberlain, for the first implementation of textdoc.
�N)�deque)�Repr)�format_exception_onlycCs`g}g}xRtjD]H}tjj|p d�}tjj|�}||krtjj|�r|j|�|j|�qW|S)N�.)�sys�path�os�abspath�normcase�isdir�append)�dirsZnormdirs�dirZnormdir�r�/usr/lib64/python3.6/pydoc.py�pathdirsLs
rcCs.tj|�ptj|�}|r*tjdd|j��p,dS)Nz^ *
�)�inspect�getdocZgetcomments�re�sub�rstrip)�object�resultrrrrXsrcCsh|j�jd�}t|�dkr&|ddfSt|�dkrZ|dj�rZ|ddj|dd��fSddj|�fS)N�
�rr�)�strip�split�lenr�join)�doc�linesrrr�splitdoc]sr$cCs"|j}|j|kr|jd|}|S)Nr)�__name__�
__module__)r�modname�namerrr�	classnamefs
r)cCs>tj|�p:tj|�p:tj|�p:tj|�p:tj|�p:tj|�S)N)r�ismodule�isclass�	isroutineZisframeZistracebackZiscode)rrrr�isdatamsr-cGs2x,|r,|dj|j|d��}|dd�}qW|S)Nrrr)r!r)�textZpairsrrr�replacessr/cCsXt|�|krTtd|dd�}td|d|�}|d|�d|t|�|d�S|S)Nr�rz...)r �max)r.�maxlenZpreZpostrrr�cramzs
$r3z at 0x[0-9a-f]{6,16}(>+)$cCstjd|�S)Nz\1)�_re_stripidr)r.rrr�stripid�sr5cCs(tj|�p&tj|�p&tj|�p&tj|�S)N)r�
isfunction�ismethod�	isbuiltinZismethoddescriptor)�objrrr�_is_some_method�s


r:cCs<tj|�rdStj|�r8t|dd�}tj|�p4|dkSdS)NT�__self__F)rr7r8�getattrr*)�fn�selfrrr�_is_bound_method�s

r?cCshi}x tj|t�D]\}}d||<qWx|jD]}|jt|��q.Wx|j�D]}t||�||<qNW|S)Nr)r�
getmembersr:�	__bases__�update�
allmethods�keysr<)�cl�methods�key�value�baserrrrC�srCcCs<g}g}x*|D]"}||�r&|j|�q|j|�qW||fS)N)r
)�s�	predicate�yes�no�xrrr�_split_list�s
rOcCs\|dkrdS|jd�r$|jd�r$dS|jd�r<t|d�r<dS|dk	rL||kS|jd�SdS)N�
__author__�__builtins__�
__cached__�__credits__�__date__�__doc__�__file__�__spec__�
__loader__r&r%�__package__�__path__�__qualname__�	__slots__�__version__r�__r�_�_fieldsT>rWrXrZr&rQrRrPr]rSrTr%rVr\rYrUr[)�
startswith�endswith�hasattr)r(�allr9rrr�visiblename�srecCsDg}x:tj|�D],\}}}}tj|�r*d}|j||||f�qW|S)Nzdata descriptor)r�classify_class_attrs�isdatadescriptorr
)r�resultsr(�kind�clsrHrrrrf�s
rfcs\t|dg��y�fdd�t��D��Wntk
r>i�YnX�fdd�}|j|d�dS)Nr`csi|]\}}|t��|�qSr)r )�.0�ir()�fieldsrr�
<dictcomp>�sz#sort_attributes.<locals>.<dictcomp>cs�j|dd�|dfS)Nr)�get)�attr)�field_orderrr�<lambda>�sz!sort_attributes.<locals>.<lambda>)rG)r<�	enumerate�	TypeError�sort)�attrsrZkeyfuncr)rqrmr�sort_attributes�s
rwcCs<tjj|�r8x*dD]"}tjjtjj|d|��rdSqWdS)N�.py�.pyc�__init__TF)rxry)r	rr�isfiler!)r�extrrr�	ispackage�s

r}cCs�|j�}x,|dd�dks$|j�r4|j�}|s
Pq
W|j�}|dd�dkrZ|dd�}|dd�dkr�|dd�}|d	d�dkr�|dd
�}x|j�s�|j�}|s�Pq�W|jd�dj�}nd}|S)Nr�#�zr"""r0z"""�\r���r�)�readlinerr)�file�linerrrr�source_synopsis�s&
r�c
Cstj|�j}|j|d�\}}|dks.||k�r|jttjj��rJtjj	}n |jttjj
��rftjj}nd}|dkr�ytj
|�}Wntk
r�dSX|�t|�}WdQRXnZ|d|�}tjjd||d�}ytjj|�}	Wn
dStjd=|	j�r|	jj�dnd}||f||<|S)NZ__temp__)�loaderr)NN)r	�stat�st_mtimerorb�tuple�	importlib�	machinery�BYTECODE_SUFFIXES�SourcelessFileLoader�EXTENSION_SUFFIXES�ExtensionFileLoader�tokenize�open�OSErrorr��util�spec_from_file_location�
_bootstrap�_loadr�modulesrU�
splitlines)
�filename�cache�mtimeZ
lastupdaterZ
loader_clsr�r��spec�modulerrr�synopsis�s4



r�c@seZdZdd�Zdd�ZdS)�ErrorDuringImportcCs||_|\|_|_|_dS)N)r��excrH�tb)r>r��exc_inforrrrz#szErrorDuringImport.__init__cCs|jj}d|j||jfS)Nzproblem in %s - %s: %s)r�r%r�rH)r>r�rrr�__str__'szErrorDuringImport.__str__N)r%r&r[rzr�rrrrr�!sr�c	Cs�tjj}t|d��}||jt|��k}WdQRXtjj|�}tjj	|�\}}|r`tj
j||�}ntj
j||�}tjj
|||d�}ytjj|�St|tj���YnXdS)N�rb)r�)r�r��MAGIC_NUMBERr��readr r	r�basename�splitext�_bootstrap_externalr��SourceFileLoaderr�r�r�r�rr�)	r�magicr�Zis_bytecoder�r(r|r�r�rrr�
importfile+sr�cs"yb|rX�tjkrX�tjkrX�fdd�tjD�}x(�g|D]}tj|||<tj|=q:Wt��}Wnxtj�\}}}}	�tjkr�ttj�j|	��n<|tkr�t|j|	��n&t	|t
�r�|j�kr�dSt�tj���YnXx@�jd�dd�D]*}
yt
||
�}Wq�tk
�rdSXq�W|S)Ncsg|]}|j�d�r|�qS)r)ra)rk�m)rrr�
<listcomp>Qszsafeimport.<locals>.<listcomp>rr)rr��builtin_module_names�
__import__r�r�rV�SyntaxErrorr��
issubclass�ImportErrorr(rr<�AttributeError)r�	forceloadr�ZsubsrGr�r�rHr��info�partr)rr�
safeimport=s.


r�c@s|eZdZejjddejdd��Zd
dd�Z	ddd�Z
e
ZZZ
ZZZejjejd	d
ejdd��fdd�ZdS)�Doc�
PYTHONDOCSz%https://docs.python.org/%d.%d/libraryNrcGs�||f|}tj|�r |j|�Stj|�r4|j|�Sy@tj|�rJ|j|�Stj|�r^|j|�Stj|�rr|j	|�SWnt
k
r�YnXt|t�r�|j
|�S|j|�S)N)r�isgetsetdescriptor�docdata�ismemberdescriptorr*�	docmoduler+�docclassr,�
docroutiner��
isinstance�property�docproperty�docother)r>rr(�argsrrr�documentss"










zDoc.documentcGs*d|odt|�t|�jf}t|��dS)Nz.don't know how to document object%s of type %s� )�repr�typer%rt)r>rr(r��messagerrr�fail�szDoc.fail�libzpython%d.%dcCs�ytj|�}Wntk
r&d}YnXtjjd|j�}tjj|�}t	|t
t��r�|jdks||j|�r�|jtjj
|d
��r�|jdkr�|jd�r�d|jd�|jj�f}q�tjj
||jj�d�}nd}|S)Nz
(built-in)r��errno�
exceptions�gc�imp�marshal�posix�signalr�_thread�	zipimportz
site-packages�	xml.etree�test.pydoc_mod�http://�https://z%s/%s�/z.html)
r�r�r�r�r�r�r�rr�r�)r�r�)r�r�)r�
getabsfilertr	�environror�rrr�r�r%rar!r�lower)r>rZbasedirr��doclocrrr�	getdocloc�s$



z
Doc.getdocloc)N)N)r%r&r[r	r�ror�version_infor�r�r�r�r�r�r�r�r�rr!�base_exec_prefixr�rrrrr�ms

r�c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZeZdd�Z	eZ
d
S)�HTMLReprcCs,tj|�d|_|_d|_d|_|_dS)N��
�d)rrz�maxlist�maxtuple�maxdict�	maxstring�maxother)r>rrrrz�s
zHTMLRepr.__init__cCst|dddddd�S)N�&z&amp;�<z&lt;�>z&gt;)r/)r>r.rrr�escape�szHTMLRepr.escapecCstj||�S)N)rr�)r>rrrrr��sz
HTMLRepr.reprcCsZtt|�d�r@ddjt|�jj��}t||�r@t||�||�S|jttt	|��|j
��S)Nr%�repr_r_)rcr�r!r%rr<r�r3r5r�r�)r>rN�level�
methodnamerrr�repr1�s

zHTMLRepr.repr1cCs^t||j�}t|�}d|krJdt|dd�krJd|d|j|�|dStjdd|j|��S)Nr�z\\r�rrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z<font color="#c040c0">\1</font>)r3r�r�r/r�rr)r>rNr��test�testreprrrr�repr_string�szHTMLRepr.repr_stringcCs8y|jttt|��|j��S|jd|jj�SdS)Nz
<%s instance>)r�r3r5r�r��	__class__r%)r>rNr�rrr�
repr_instance�szHTMLRepr.repr_instanceN)r%r&r[rzr�r�r�r��repr_strr�Zrepr_unicoderrrrr��sr�c@s
eZdZe�ZejZejZdd�Zd4dd�Zd5d	d
�Z	dd�Z
d
d�Zd6dd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdiiifdd�Zd7d d!�Zd8d"d#�Zddiifd$d%�Zd&d'�Zddiiidfd(d)�Zd*d+�Zd9d,d-�Zd:d.d/�Zd;d0d1�Zd<d2d3�ZdS)=�HTMLDoccCsd||fS)Nz�<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
%s
</body></html>r)r>�title�contentsrrr�page�szHTMLDoc.pagercCsd|||||pdfS)Na'
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="%s">
<td valign=bottom>&nbsp;<br>
<font color="%s" face="helvetica, arial">&nbsp;<br>%s</font></td
><td align=right valign=bottom
><font color="%s" face="helvetica, arial">%s</font></td></tr></table>
    z&nbsp;r)r>r��fgcol�bgcolZextrasrrr�heading�s	zHTMLDoc.heading�N�&nbsp;c	
Cs^|dkrdd|d}d|||f}	|r@|	d||||f}	n|	d|||f}	|	d|S)Nz<tt>z&nbsp;z</tt>z�<p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="%s">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="%s" face="helvetica, arial">%s</font></td></tr>
    zR
<tr bgcolor="%s"><td rowspan=2>%s</td>
<td colspan=2>%s</td></tr>
<tr><td>%s</td>z(
<tr><td bgcolor="%s">%s</td><td>%s</td>z'
<td width="100%%">%s</td></tr></table>r)
r>r�r�r�r��widthZpreludeZ
marginaliaZgaprrrr�section�szHTMLDoc.sectioncGsd|}|j|f|��S)Nz<big><strong>%s</strong></big>)r)r>r�r�rrr�
bigsection	szHTMLDoc.bigsectionc
Cs&|j|j��}t|dddddddd�	S)Nz

z
 
r�z&nbsp;rz<br>
)r��
expandtabsr/)r>r.rrr�	preformatszHTMLDoc.preformatrcCs�d}t|�|d|}xht|�D]\}|dd|}x>t|||||�D]$}|t|�krN||||�d}qNW|d}q"Wd|S)Nrrz<td width="%d%%" valign=top>r�z<br>
z</td>z7<table width="100%%" summary="list"><tr>%s</tr></table>)r �range)r>�list�formatZcolsr�rows�colrlrrr�multicolumnszHTMLDoc.multicolumncCsd|S)Nz<font color="#909090">%s</font>r)r>r.rrr�grey szHTMLDoc.greycGs*x$|D]}||krd|||fSqW|S)Nz<a href="%s">%s</a>r)r>r(Zdicts�dictrrr�namelink"s
zHTMLDoc.namelinkcCsN|jtjj|j�}}t||�rDt||�|krDd|j|t||�fSt||�S)Nz<a href="%s.html#%s">%s</a>)r%rr�ror&rcr<r))r>rr'r(r�rrr�	classlink)s
zHTMLDoc.classlinkcCsd|j|jfS)Nz<a href="%s.html">%s</a>)r%)r>rrrr�
modulelink1szHTMLDoc.modulelinkcCsR|\}}}}|r|j|�S|r,d||f}nd|}|rBd|}n|}d||fS)Nz
%s.%s.htmlz%s.htmlz"<strong>%s</strong>&nbsp;(package)z<a href="%s">%s</a>)r)r>Z
modpkginfor(rr}�shadowed�urlr.rrr�
modpkglink5s

zHTMLDoc.modpkglinkcCsd||fS)Nz<a href="file:%s">%s</a>r)r>rrrrr�filelinkDszHTMLDoc.filelinkcCs�|p|j}g}d}tjd�}�xL|j||�}	|	s2P|	j�\}
}|j||||
���|	j�\}}
}}}}|
r�||�jdd�}|jd||f�n�|r�dt|�}|jd|||�f�n�|r�dt|�}|jd|||�f�n�|�r$|||d�d	k�r|jd
|j	||��n|jd|�n@|||d�d	k�rR|j|j	||||��n|j|j	||��|}q W|j|||d���dj
|�S)
NrzD\b((http|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?(\w+))�"z&quot;z<a href="%s">%s</a>z'http://www.rfc-editor.org/rfc/rfc%d.txtz(http://www.python.org/dev/peps/pep-%04d/r�(zself.zself.<strong>%s</strong>r)r�r�compile�search�spanr
�groupsr/�intrr!)r>r.r��funcs�classesrFrh�here�pattern�match�start�endrd�schemeZrfcZpepZselfdotr(rrrr�markupHs<

zHTMLDoc.markupc
Cs�d}x�|D]�}t|�tf�kr�|\}}|d}||j||�}|r�||fkr�g}x|D]}	|j|j|	|��qVW|ddj|�d}|d}q
t|�tg�kr
|d|j|||�}q
Wd|S)	Nrz"<dt><font face="helvetica, arial">rz, �)z
</font></dt>z
<dd>
%s</dd>
z
<dl>
%s</dl>
)r�rr
r!�
formattree)
r>�treer'�parentr�entry�c�bases�parentsrIrrrr(ss 


zHTMLDoc.formattreec#s�|j}y
|j}Wntk
r(d}YnX|jd�}g}x@tt|�d�D],}|jddj|d|d��||f�qJWdj||d-d��}	d|	}
y&tj	|�}t
jj|�}�j
||�}
Wntk
r�d}
YnXg}t|d��r:t|j�}|dd�d.k�r&|d/d�dk�r&|dd0�j�}|jd
�j|��t|d��r\|j�jt|j���|�rt|
dd
j|�}
�j|�}|dk	�r�dt�}nd}�j|
ddd|
|�}tj|tj�}gi}}xltj|tj�D]Z\}}|dk	�stj|��p�||k�r�t|||��r�|j||f�d|||<||<�q�Wx�|D]�\}}xx|jD]n}|j|j}}tj j!|�}||k�rL|�rLt||��rLt"||�|k�rL||k�rL|d|||<||<�qLW�q<Wgi}}x�tj|tj#�D]p\}}|dk	�stj$|��stj|�|k�r�t|||��r�|j||f�d|||<tj%|��r�||||<�q�Wg}x6tj|t&�D]&\}}t|||��rd|j||f��qdW�j't(|��j)||�}|�o�d|}|d|}t|d��r*g}x.t*j+|j,�D]\}}} |j||| df��q�W|j-��j.|�j/�}!|�j0ddd|!�}n.|�rX�j.|�fdd��}!|�j0ddd|!�}|�r�dd �|D�}"�j1tj2|"d�|�g}!x*|D]"\}}|!j�j3|||||���q�W|�j0d!dd"d#j|!��}|�rg}!x*|D]"\}}|!j�j3|||||���q�W|�j0d$dd%d#j|!��}|�rbg}!x$|D]\}}|!j�j3||���q(W|�j0d&dd'd(j|!��}t|d)��r��j't|j4��j)�}!|�j0d*dd|!�}t|d+��rʈj't|j5��j)�}!|�j0d,dd|!�}|S)1Nrrz5<a href="%s.html"><font color="#ffffff">%s</font></a>z)<big><big><strong>%s</strong></big></big>z
(built-in)r]��$z
Revision: z
version %srTz (%s)z, z-<br><a href="%(docloc)s">Module Reference</a>rz#ffffffz#7799eez<a href=".">index</a><br>r~z.html#z#-z<tt>%s</tt>z
<p>%s</p>
rZrzPackage Contentsz#aa55cccs�j|d�S)Nr)r)�t)r>rrrr�sz#HTMLDoc.docmodule.<locals>.<lambda>�ModulescSsg|]\}}|�qSrr)rkrGrHrrrr��sz%HTMLDoc.docmodule.<locals>.<listcomp>ZClassesz#ee77aar�Z	Functionsz#eeaa77ZDataz#55aa55z<br>
rPZAuthorrSZCreditsr�z$Revision: r�r�)6r%�__all__r�rrr r
r!rr��urllib�parseZquoterrtrc�strr]rr�rTr��localsrr@r*r+�	getmodulererAr&rr�ror<r,r8r6r-r&rr�pkgutil�iter_modulesrZrur
rrr(�getclasstreer�rPrS)#r>rr(�mod�ignoredrd�partsZlinksrlZ
linkedname�headrrrr��versionr�rr�rZcdictrGrHrIr'r�rZfdict�datar"�modpkgs�importer�ispkgr��	classlistr)r>rr��s�


&


$




$

zHTMLDoc.docmodulecs�j}|p|}�j}g}	|	j�G�fdd�d�}
|
��ttj���}t|�dkr��j��d�x"|D]}�d�j|�j	��qfW�d���������fdd�}
����fd	d
�}��������fdd�}�fd
d�t
��D�}i�xv|D]n\}}}}d|d|�|<}yt�|�}Wntk
�r:YnXy|�|<Wq�t
k
�r^Yq�Xq�Wx�|�rT|�r||j��n|dd�t|�fdd��\}}�tjk�r�|}�qfn"��k�r�d}nd�j��j	�}|d7}t|��|
d||dd��}|
d||dd��}|
d||dd��}|d||dd��}|d||d d��}|}�qfWd!j|	�}	||k�rxd"||f}nd#|||f}|�r�g}x"|D]}|j�j|�j	���q�W|d$d%j|�}�jt���j����}|�o�d&|}�j|d'd(|	d)|�S)*Ncs eZdZdd�Z�fdd�ZdS)z(HTMLDoc.docclass.<locals>.HorizontalRulecSs
d|_dS)Nr)�needone)r>rrrrzsz1HTMLDoc.docclass.<locals>.HorizontalRule.__init__cs|jr�d�d|_dS)Nz<hr>
r)rF)r>)�pushrr�maybe
sz.HTMLDoc.docclass.<locals>.HorizontalRule.maybeN)r%r&r[rzrHr)rGrr�HorizontalRule
srIrz&<dl><dt>Method resolution order:</dt>
z<dd>%s</dd>
z</dl>
cs�t||�\}}|r��j��|�xl|D]d\}}}}yt�|�}Wn&tk
rh��j||���YnX��j||��������d�q(W|S)Nr)rOrHr<�	Exception�_docdescriptorr�)�msgrvrK�okr(ri�homeclsrH)rr�hr�mdictr<rrGr>rr�spillszHTMLDoc.docclass.<locals>.spillcsNt||�\}}|rJ�j��|�x&|D]\}}}}��j||���q(W|S)N)rOrHrK)rLrvrKrMr(rirNrH)rOr<rGr>rr�spilldescriptors/sz*HTMLDoc.docclass.<locals>.spilldescriptorsc
s�t||�\}}|r��j��|�x�|D]�\}}}}�jt�|�|��}t|�sZtj|�rht|dd�}	nd}	|	dkr��d|�n0�jt|��j	����}	d|	}	�d||	f��d�q(W|S)NrUz<dl><dt>%s</dl>
z<dd><tt>%s</tt>z<dl><dt>%s%s</dl>
r)
rOrHr�r<�callablerrgr&rr)
rLrvrKrMr(rirNrHrIr")rrrOrPr<rrGr>rr�	spilldata8s"
z#HTMLDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qS))r9)re)rkr(rirjrH)rrrr�Ms
z$HTMLDoc.docclass.<locals>.<listcomp>r~�-rcs|d�kS)Nrr)r1)�	thisclassrrrrfsz"HTMLDoc.docclass.<locals>.<lambda>zdefined herezinherited from %sz:<br>
z
Methods %scSs|ddkS)Nr�methodr)r1rrrrrvszClass methods %scSs|ddkS)Nrzclass methodr)r1rrrrrxszStatic methods %scSs|ddkS)Nrz
static methodr)r1rrrrrzszData descriptors %scSs|ddkS)Nrzdata descriptorr)r1rrrrr|szData and other attributes %scSs|ddkS)NrrAr)r1rrrrr~srz*<a name="%s">class <strong>%s</strong></a>z/<strong>%s</strong> = <a name="%s">class %s</a>z(%s)z, z<tt>%s<br>&nbsp;</tt>z#000000z#ffc8d8r0)r%rAr
rr�getmror rHrr&rfr<rJrt�popleftrO�builtinsrrwr!r&rrr)r>rr(r<rrr=�realnamer-r�rI�mrorIrQrRrTrvrGrirNrH�anchor�	inherited�tagr�r.r"r)	rrrOrPr<rrGr>rVrr��s�

	



















zHTMLDoc.docclasscCs|jd|j|��S)N�=)rr�)r>rrrr�formatvalue�szHTMLDoc.formatvaluecCs�|j}|p|}|r|jpdd|}	d}
d}t|�r�|jj}|rZ||k	r�d|j||�}
n0|jdk	rzd|j|jj|�}
nd|j||�}
||kr�d|	|f}
nD|r�tj||g�|kr�d|jd||f}d	}n|}d
|	||f}
d}tj|��rNytj|�}Wnt	t
fk
�r d}YnX|�rNt|�}|dk�rNd|}
|d	d�}|�sXd
}|
|j|�|
�ov|j
d|
�}|�r�d|S|jt|�|j|||�}|�o�d|}d||fSdS)NrrUrz from z method of %s instancez unbound %s methodz$<a name="%s"><strong>%s</strong></a>z<a href="#%s">%s</a>rz)<a name="%s"><strong>%s</strong></a> = %sz<lambda>z$<strong>%s</strong> <em>lambda</em> z(...)z'<font face="helvetica, arial">%s</font>z<dl><dt>%s</dt></dl>
z<dd><tt>%s</tt></dd>z<dl><dt>%s</dt>%s</dl>
r�)r%r?r;r�rr�getattr_staticr,�	signature�
ValueErrorrtr6r�rr&rr)r>rr(r<rrrFrEr[r]�note�skipdocs�imclassr�Zreallink�argspecrc�declr"rrrr��sX


zHTMLDoc.docroutinecCsTg}|j}|r|d|�|jdk	rB|jt|�|j�}|d|�|d�dj|�S)Nz!<dl><dt><strong>%s</strong></dt>
z<dd><tt>%s</tt></dd>
z</dl>
r)r
rUr&rrr!)r>r(rHr<rhrGr"rrrrK�s
zHTMLDoc._docdescriptorcCs|j|||�S)N)rK)r>rr(r<rErrrr��szHTMLDoc.docpropertycGs|rd|pd}||j|�S)Nz<strong>%s</strong> = r)r�)r>rr(r<r=Zlhsrrrr��szHTMLDoc.docothercCs|j|||�S)N)rK)r>rr(r<rErrrr��szHTMLDoc.docdatacCs�g}|dkri}xLtj|g�D]<\}}}tdd�|D��r<q|j|d|||kf�d||<qW|j�|j||j�}|j|dd|�S)Ncss*|]"}dt|�kodknVqdS)i�i��N)�ord)rk�chrrr�	<genexpr>�sz HTMLDoc.index.<locals>.<genexpr>rrz#ffffffz#ee77aa)r9r:�anyr
rur
rr)r>rrrBrCr(rDr�rrr�index�sz
HTMLDoc.index)r)rrNr)r)N)NN)NNN)NN)NNN)N)r%r&r[r��_repr_instancer�r�r�rrrrr
rrrrrrr&r(r�r�rar�rKr�r�r�rnrrrrr��s:



+

y:


r�c@s0eZdZdd�Zdd�Zdd�ZeZdd�Zd	S)
�TextReprcCs,tj|�d|_|_d|_d|_|_dS)Nr�r�r�)rrzr�r�r�r�r�)r>rrrrzs
zTextRepr.__init__cCsTtt|�d�r@ddjt|�jj��}t||�r@t||�||�Sttt|��|j	�S)Nr%r�r_)
rcr�r!r%rr<r3r5r�r�)r>rNr�r�rrrr�s

zTextRepr.repr1cCsHt||j�}t|�}d|krDdt|dd�krDd|d||dS|S)Nr�z\\rr�r)r3r�r�r/)r>rNr�r�r�rrrr�
s
zTextRepr.repr_stringc
Cs,yttt|��|j�Sd|jjSdS)Nz
<%s instance>)r3r5r�r�r�r%)r>rNr�rrrr�szTextRepr.repr_instanceN)r%r&r[rzr�r�r�r�rrrrrp�s
	rpc@s�eZdZe�ZejZdd�Zddd�Zdd�Zdd
d�Z	ddd
�Z
ddd�Zdd�Zd dd�Z
dd�Zd!dd�Zd"dd�Zd#dd�ZdS)$�TextDoccCsdjdd�|D��S)Nrcss|]}|d|VqdS)�Nr)rkrkrrrrl(szTextDoc.bold.<locals>.<genexpr>)r!)r>r.rrr�bold&szTextDoc.bold�    cs>|sdS�fdd�|jd�D�}|r4|dj�|d<dj|�S)Nrcsg|]}�|�qSrr)rkr�)�prefixrrr�-sz"TextDoc.indent.<locals>.<listcomp>rrr�r�)rrr!)r>r.rur#r)rur�indent*szTextDoc.indentcCs$|j|�j�}|j|�d|dS)Nrz

)rvrrs)r>r�r�Zclean_contentsrrrr1szTextDoc.sectionNrc
s�d}x�|D]�}t|�tf�krt|\}}||t|��}|rj||fkrj�fdd�|D�}	|ddj|	�}|d}q
t|�tg�kr
||j|�||d�}q
W|S)Nrc3s|]}t|��VqdS)N)r))rkr,)r'rrrl@sz%TextDoc.formattree.<locals>.<genexpr>z(%s)z, rz    )r�r)r!r()
r>r)r'r*rurr+r,r-r.r)r'rr(8s

zTextDoc.formattreecCsD|j}tt|��\}}|jd||o(d|�}t|dd�}|j|�}|dk	r`||jd|d�}|rt||jd|�}g}	xNtj|tj�D]<\}
}|dk	s�tj	|�p�||kr�t
|
||�r�|	j|
|f�q�Wg}xXtj|tj�D]F\}
}|dk	�stj
|��stj	|�|kr�t
|
||�r�|j|
|f�q�Wg}
x6tj|t�D]&\}
}t
|
||��r8|
j|
|f��q8Wg}t�}t|d��r�xFtj|j�D]6\}}}|j|�|�r�|j|d�n
|j|��q�W|j�||jd	d
j|��}g}xBtj|tj�D]0\}
}|jj|d��r�|
|k�r�|j|
��q�W|�rJ|j�||jdd
j|��}|	�r�d
d�|	D�}|jtj|d�|�g}x&|	D]\}
}|j|j||
|���qzW||jdd
j|��}|�r�g}x&|D]\}
}|j|j||
|���q�W||jdd
j|��}|
�rFg}x*|
D]"\}
}|j|j||
|dd���q
W||jdd
j|��}t|d��r�t|j�}|dd�d"k�r�|d#d�dk�r�|dd$�j�}||jd|�}t|d��r�||jdt|j ��}t|d��r�||jdt|j!��}t|d��r||jdt|j"��}ytj#|�}Wnt$k
�r.d }YnX||jd!|�}|S)%N�NAMEz - r3zMODULE REFERENCEa.

The following documentation is automatically generated from the Python
source files.  It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations.  When in doubt, consult the module reference at the
location listed above.
ZDESCRIPTIONrZz
 (package)zPACKAGE CONTENTSrrZ
SUBMODULEScSsg|]\}}|�qSrr)rkrGrHrrrr��sz%TextDoc.docmodule.<locals>.<listcomp>r�CLASSES�	FUNCTIONS�F)r2ZDATAr]r/r0z
Revision: �VERSIONrTZDATErPZAUTHORrSZCREDITSz
(built-in)ZFILEz$Revision: r�r�)%r%r$rrr<r�rr@r+r8rer
r,r8r-�setrcr9r:rZ�addrur!r*rar(r;r�r�r6r]rrTrPrSr�rt)r>rr(r<Zsynop�descrrdr�rrGrHrrArBZ
modpkgs_namesrCr'rDZ
submodulesrEr�r@r�rrrr�Hs�





$
zTextDoc.docmodulecsX�j}|p|}�j}�jfdd�}||kr:d�j|�}n�j|�d|}|rlt||�}	|ddj|	�}t��}
|
r�|
dgp�g}|j�tt	j
���}t|�dkrԈd	�x|D]}
�d
||
��q�W�d�G�fdd
�d
�}|�������fdd�}����fdd�}�����fdd�}�fdd�t��D�}x�|�r"|�rT|j
��n|dd�t|�fdd��\}}�tjk�r�|}�q>n ��k�r�d}ndt��j�}t|��|d||dd��}|d||dd��}|d||d d��}|d!||d"d��}|d#||d$d��}|}�q>Wdj|�}|�s<|dS|d�j|j�d%�dS)&NcSs
t||�S)N)r))r,r�rrr�makename�sz"TextDoc.docclass.<locals>.makenamezclass z	 = class z(%s)z, rrzMethod resolution order:z    rcs eZdZdd�Z�fdd�ZdS)z(TextDoc.docclass.<locals>.HorizontalRulecSs
d|_dS)Nr)rF)r>rrrrz�sz1TextDoc.docclass.<locals>.HorizontalRule.__init__cs|jr�dd�d|_dS)NrUrzr)rF)r>)rGrrrH�sz.TextDoc.docclass.<locals>.HorizontalRule.maybeN)r%r&r[rzrHr)rGrrrI�srIcs�t||�\}}|r��j��|�x^|D]V\}}}}yt�|�}Wn&tk
rh��j||���Yq(X��j||����q(W|S)N)rOrHr<rJrKr�)rLrvrKrMr(rirNrH)rOr<rrGr>rrrQ�szTextDoc.docclass.<locals>.spillcsNt||�\}}|rJ�j��|�x&|D]\}}}}��j||���q(W|S)N)rOrHrK)rLrvrKrMr(rirNrH)rOr<rGr>rrrR�sz*TextDoc.docclass.<locals>.spilldescriptorsc
s�t||�\}}|r��j��|�x~|D]v\}}}}t|�sFtj|�rPt|�}nd}yt�|�}	Wntk
r�|j|}	YnX��j	|	|�d|d�d�q(W|S)Nrz)r2r"r)
rOrHrSrrgrr<r��__dict__r�)
rLrvrKrMr(rirNrHr"r9)rOr<rrGr>rrrT�s
z#TextDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qS))r9)re)rkr(rirjrH)rrrr�s
z$TextDoc.docclass.<locals>.<listcomp>rcs|d�kS)Nrr)r1)rVrrrr	sz"TextDoc.docclass.<locals>.<lambda>zdefined herezinherited from %szMethods %s:
cSs|ddkS)NrrWr)r1rrrrrszClass methods %s:
cSs|ddkS)Nrzclass methodr)r1rrrrrszStatic methods %s:
cSs|ddkS)Nrz
static methodr)r1rrrrrszData descriptors %s:
cSs|ddkS)Nrzdata descriptorr)r1rrrrrszData and other attributes %s:
cSs|ddkS)NrrAr)r1rrrrr sz |  )r%rAr&rs�mapr!rr
rrrXr rfrYrOrZrr)rwrvr)r>rr(r<r=r[r-rr�r.r"r�r\rIrIrQrRrTrvr^r_r)rOr<rrGr>rVrr��sl

	
















zTextDoc.docclasscCsd|j|�S)Nr`)r�)r>rrrrra*szTextDoc.formatvaluecCsr|j}|p|}d}d}t|�rn|jj}|rB||k	rndt||�}n,|jdk	r`dt|jj|�}ndt||�}||kr�|j|�}	n,|r�tj||g�|kr�d}|j|�d|}	d}
tj|��rytj	|�}Wnt
tfk
r�d}YnX|�rt|�}
|dk�r|j|�d	}	|
dd�}
|
�s&d
}
|	|
|}|�r@|dSt
|��pLd}
|d|
�oj|j|
�j�dSdS)
Nrrz from z method of %s instancez unbound %s methodrz = z<lambda>z lambda z(...)rr�)r%r?r;r�r)rsrrbr,rcrdrtr6rrvr)r>rr(r<rEr[rerfrgr�rhrcrir"rrrr�.sH


zTextDoc.docroutinecCsTg}|j}|r$||j|��|d�t|�p.d}|rJ||j|��|d�dj|�S)Nrr)r
rsrrvr!)r>r(rHr<rhrGr"rrrrK_szTextDoc._docdescriptorcCs|j|||�S)N)rK)r>rr(r<rErrrr�lszTextDoc.docpropertycCs|j|||�S)N)rK)r>rr(r<rErrrr�pszTextDoc.docdatac
Cs�|j|�}|rF|r|dpd|}|t|�}	|	dkrF|d|	�d}|rX|j|�dpZd|}|dk	r~|d|jt|��7}|S)Nz = rrz...r)r�r rsrvr6)
r>rr(r<r*r2r"r�r�Zchoprrrr�ts
zTextDoc.docother)rt)Nr)NN)NN)NNN)NNN)NNN)NNNNN)r%r&r[rpror�rsrvrr(r�r�rar�rKr�r�r�rrrrrqs


e
}
1

rqc@seZdZdd�ZdS)�
_PlainTextDoccCs|S)Nr)r>r.rrrrs�sz_PlainTextDoc.boldN)r%r&r[rsrrrrr��sr�cCst�at|�dS)N)�getpager�pager)r.rrrr��sr�cs<ttjd�stSttjd�s tStjj�s8tjj�r<tStjjd�pRtjjd���r�tj	dkrn�fdd�Stjjd�dkr��fd
d�S�fdd�Stjjd�dkr�tStj	dkr�dd�Sttd
�r�tj
d�dkr�dd�Sddl}|j�\}}tj
|�z0ttd
��r$tj
d|�dk�r$dd�StSWdtj|�XdS)N�isattyZMANPAGERZPAGERZwin32cstt|���S)N)�
tempfilepager�plain)r.)�	use_pagerrrrr�szgetpager.<locals>.<lambda>ZTERM�dumb�emacscstt|���S)N)�	pipepagerr�)r.)r�rrrr�scs
t|��S)N)r�)r.)r�rrrr�scSstt|�d�S)Nzmore <)r�r�)r.rrrrr�s�systemz(less) 2>/dev/nullrcSs
t|d�S)NZless)r�)r.rrrrr�sz	more "%s"cSs
t|d�S)NZmore)r�)r.rrrrr�s)r�r�)r�r�)rcr�stdin�
plainpager�stdoutr�r	r�ro�platformr��tempfileZmkstemp�close�ttypager�unlink)r��fdr�r)r�rr��s6


 r�cCstjdd|�S)Nz.r)rr)r.rrrr��sr�c Cs�ddl}|j|d|jd�}yDtj|jdd��*}y|j|�Wntk
rPYnXWdQRXWntk
rrYnXx(y|j	�PWqvtk
r�YqvXqvWdS)NrT)�shellr��backslashreplace)�errors)
�
subprocess�Popen�PIPE�io�
TextIOWrapperr��write�KeyboardInterruptr��wait)r.�cmdr��proc�piperrrr��s r�cCs`ddl}|j�}t|ddd��}|j|�WdQRXztj|d|d�Wdtj|�XdS)Nr�wr�)r�z "r)r�Zmktempr�r�r	r�r�)r.r�r�r�r�rrrr��sr�cCs$ttjdd�pd}|j|d�j|�S)N�encodingzutf-8r�)r<rr��encode�decode)r.r�rrr�_escape_stdout�sr�c
Cs�tt|��jd�}y2ddl}tjj�}|j|�}|j|�dd�}Wn(t	t
tjfk
rld}dd�}YnX�z2yt
tjjdd��}Wntk
r�d}YnX|dkr�d}|d}}tjjdj|d|��d�x�||d��r�tjjd	�tjj�|�}	|	dk�rtjjd�Pn,|	dk�rJtjjd||d�|d}q�|	dk�rn|||}|dk�rnd}tjjddj||||��d�||}q�WWd|�r�|j||j|�XdS)NrrcSstjjd�S)Nr)rr�r�rrrrrr�szttypager.<locals>.<lambda>cSstjj�dd�dd�S)Nrr�)rr�r�rrrrrr�sZLINESr�z
-- more --�q�Qz
          
�
�b�B�)r�r�)r�r)r�r�r�)r�r�r�ttyrr��filenoZ	tcgetattrZ	setcbreakr�r�r��UnsupportedOperationrr	r�rordr�r�r!�flushZ	tcsetattrZ	TCSAFLUSH)
r.r#r�r��oldZgetchar�hr�Zincr,rrrr��sL








&r�cCstjjtt|���dS)N)rr�r�r�r�)r.rrrr�sr�cCs�tj|�r>|jtjkr d|jSt|d�r4d|jSd|jStj|�rRd|jStj|�rtd|jj	|jj|jfStj
|�r�d|jj	|jj|jfStj|�r�d|jStj|�r�d	|jStj
|�r�d
|jSt|�jS)Nzbuilt-in module rZzpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%szclass z	function zmethod )rr*r%rr�rcr8r��__objclass__r&r�r+r6r7r�)�thingrrr�describe
s.
















r�cCs�dd�|jd�D�}d\}}xB|t|�kr^tdj|d|d��|�}|rZ||d}}qPqW|rj|}nt}x8||d�D](}yt||�}Wq|tk
r�dSXq|W|S)NcSsg|]}|r|�qSrr)rkr�rrrr�'szlocate.<locals>.<listcomp>rrr)Nr)rr r�r!rZr<r�)rr�r>r��nZ
nextmodulerr�rrr�locate%s 
r�cCsVt|t�r0t||�}|dkr(td|��||fSt|dd�}|t|t�rL|ndfSdS)Nz~No Python documentation found for %r.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.r%)r�r6r�r�r<)r�r�rr(rrr�resolve>s


r�� Python Library Documentation: %scCs�|dkrt}t||�\}}t|�}tj|�}|rTd|krT|d|d|jd��7}n|rn||k	rn|d|j7}tj|�p�tj|�p�tj	|�p�tj
|�p�tj|�p�t|t
�s�t|�}|d7}||d|j||�S)Nrz in z in module z objectz

)r.r�r�rr8�rfindr%r*r+r,r�r�r�r�r�r�)r�r�r�Zrendererrr(r~r�rrr�
render_docLs$






r�cCsfy2|dkrtt|||��n|jt|||t��Wn.ttfk
r`}zt|�WYdd}~XnXdS)N)r�r�r��	plaintextr�r��print)r�r�r��outputrHrrrr"esr"cCs�y`t||�\}}tjt|�tj||��}t|dddd��}|j|�WdQRXtd|d�Wn.tt	fk
r�}zt|�WYdd}~XnXdS)Nz.htmlr�zutf-8)r�Zwrote)
r��htmlr�r�r�r�r�r�r�r�)r�r�rr(r�r�rHrrr�writedocpsr�rcCs6|dkri}x$tj|g|�D]\}}}t|�qWdS)N)r9�
walk_packagesr�)r�pkgpath�donerCr'rDrrr�	writedocs{s
r�cJ@s�eZdZdddddd�d�d�d�d�d�d
d�ddd�dd�d�d�d�dd�d�ddd�d�d��d�d�d�dd&�!Zd'd(��dD�Z�de��d�d�d�d	�d
�ddS�ZdTdUdVdWdXdYdZd[d\d]d^d_d_d`d`da�ZxPej�D]D\ZZ	x8e	D]0Z
eje
e�Zeek�r�edbeZeee
<�q�W�q�W�d�d
�d�d�d�d�d�d�d�ddv�d�d�d�ddd�d�d�d�d�dd�dd�d��d �d!�d"�d#�d$�d%�d&�d'�d(�d)�d*d�d��d+�d,�d-�d.�d/�d0d��d1�d2�d3�d4�d5�d6�d7�d8�d9�d:�d;�d<�d=�d>�d?�d@d�dA�dBdd!dd
�dC�dD�dE�dFdʜIZ�dGd�d̈́Z
ed�dτ�Zed�dτ�Zd�d҄Ze�Zefd�dԄZd�dքZd�d؄Zd�dڄZd�d܄Z�dHd�d�Zd�d�Zd�d�Zd�d�Z�dId�d�Z�dJd�d�Zd�d�Z�dKd�d�Z d�S(L�Helperr�BOOLEAN�with�assert�break�	while for�class�CLASSES SPECIALMETHODS�continue�function�del�BASICMETHODS�if�else�try�for�break continue while�import�global�nonlocal NAMESPACES�
TRUTHVALUE�MODULES�in�SEQUENCEMETHODS�
COMPARISON�lambdary�nonlocal�global NAMESPACES�pass�raise�
EXCEPTIONS�return�while�break continue if TRUTHVALUE� CONTEXTMANAGERS EXCEPTIONS yield�yield)!�False�None�True�and�asr�r�r�r��defr��elifr��except�finallyr��fromr�r�r�r��isr�r��not�orr�r�r�r�r�r�r�cCsg|]}dD]}||�qqS)�'r)r�rr)rk�pr�rrrr��szHelper.<listcomp>r��fr��ur��'''r�"""�+rU�*�**r��//�%�<<�>>r��|�^�~r�r��<=�>=�==�!=�<>�+=�-=�*=�/=�%=�&=�|=�^=�<<=�>>=�**=�//=�j�J)�STRINGS�	OPERATORSr��UNARY�AUGMENTEDASSIGNMENT�BITWISE�COMPLEXzOPERATORS FORMATTING�POWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTS�ELLIPSISzSLICINGS DICTIONARYLITERALSz	def classr�PRIVATENAMESzPRIVATENAMES SPECIALMETHODSZ
BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)rz**�,rz...�:�@r�r_r^�`rr'�[�]r��types�RSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect�strings�4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES�string-methods�STRINGS FORMATTING�
formatstringsr�:encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPES�numbers�INTEGER FLOAT COMPLEX TYPES�integers�	int range�floating�
float math�	imaginary�
complex cmath�typesseq�$STRINGMETHODS FORMATTING range LISTS�DICTIONARIES�typesfunctions�	def TYPES�typesmethods�class def CLASSES TYPES�bltin-code-objects�compile FUNCTIONS TYPES�bltin-type-objects�types TYPES�TYPES�bltin-null-object�bltin-ellipsis-object�SLICINGS�specialattrs�!class SPECIALMETHODS PRIVATENAMES�typesmodules�operator-summary��lambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIES�EXPRESSIONS�objects�specialnames�bBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES�
customization�hash repr str SPECIALMETHODS�attribute-access�ATTRIBUTES SPECIALMETHODS�callable-types�CALLS SPECIALMETHODS�sequence-types�(SEQUENCES SEQUENCEMETHODS SPECIALMETHODS�MAPPINGS SPECIALMETHODS�
numeric-types�*NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS�	execmodel�%NAMESPACES DYNAMICFEATURES EXCEPTIONS�naming�3global nonlocal ASSIGNMENT DELETION DYNAMICFEATURES�dynamic-features�
NAMESPACESr��try except finally raise�conversions�identifiers�keywords SPECIALIDENTIFIERS�
id-classes�atom-identifiers�
atom-literals�=STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS�	SEQUENCES�	exprlists�TUPLES LITERALS�typesseq-mutable�LISTLITERALS�lists�LISTS LITERALS�typesmapping�DICTIONARYLITERALSr�DICTIONARIES LITERALS�attribute-references�(getattr hasattr setattr ATTRIBUTEMETHODS�
subscriptions�slicings�calls�power�unary�binary�shifting�bitwise�comparisons�EXPRESSIONS BASICMETHODS�booleans�EXPRESSIONS TRUTHVALUE�
assignmentr�	augassign�
NUMBERMETHODS�compound�for while break continue�truth� if while and or not BASICMETHODS�debugger�pdb�context-managers)IrFrZ
STRINGMETHODSZ
FORMATTING�UNICODEZNUMBERSZINTEGERZFLOATr!rlZMAPPINGSryZMETHODSZCODEOBJECTSZTYPEOBJECTSZFRAMEOBJECTSZ
TRACEBACKSZNONEr#ZSPECIALATTRIBUTESrxr�ZPACKAGESrOrZ
PRECEDENCEZOBJECTSZSPECIALMETHODSr�ZATTRIBUTEMETHODSZCALLABLEMETHODSr�ZMAPPINGMETHODSr�Z	EXECUTIONrcZDYNAMICFEATURESZSCOPINGZFRAMESr�ZCONVERSIONSZIDENTIFIERSZSPECIALIDENTIFIERSr$ZLITERALSZTUPLESZ
TUPLELITERALSZLISTSrpr=rtZ
ATTRIBUTESZ
SUBSCRIPTSrIZCALLSr"rZBINARYZSHIFTINGr r�r�Z	ASSERTIONZ
ASSIGNMENTrZDELETIONZ	RETURNINGZ	IMPORTINGZCONDITIONALZLOOPINGr�Z	DEBUGGINGZCONTEXTMANAGERSNcCs||_||_dS)N)�_input�_output)r>�inputr�rrrrz/szHelper.__init__cCs|jp
tjS)N)r�rr�)r>rrrrr3szHelper.<lambda>cCs|jp
tjS)N)r�rr�)r>rrrrr4scCs2tj�dddkr|�dSd|jj|jjfS)Nrr0�?rz<%s.%s instance>)r�stackr�r&r[)r>rrr�__repr__6s
zHelper.__repr__cCs6||jk	r|j|�n|j�|j�|jjd�dS)Na
You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type "help(object)".  Executing "help('string')"
has the same effect as typing a particular string at the help> prompt.
)�_GoInteractiver�intro�interactr�r�)r>�requestrrr�__call__>s
zHelper.__call__cCs�|jjd�x�y|jd�}|s PWnttfk
r<PYnX|j�}t|�dkr�|d|dkoldknr�|d|dd
�kr�|dd�}|j�dkr�P|d
kr�|j�q|j	|�qWdS)Nrzhelp> rrrr�rr��quitrr�)r�rr�r�)r�r�)
r�r��getliner��EOFErrorrr r�r�r)r>r�rrrr�Ks"
,
zHelper.interactcCs8|jtjkrt|�S|jj|�|jj�|jj�SdS)N)r�rr�r�r�r�r�)r>�promptrrrr�`s

zHelper.getlinecCs<t|�td�k�r|j�}|dkr,|j�n�|dkr>|j�n�|dkrP|j�n�|dkrb|j�n�|dd�dkr�|j|j�d�n�||jkr�|j|�nj|dkr�t	t
|�d�nR||jkr�|j|�n<||j
kr�|j|�n&|r�t	|d|jd
�nt	td|jd
�n$t|t��r|�nt	|d|jd
�|jjd�dS)Nr�keywords�symbols�topicsr��zmodules rr�r�r�zHelp on %s:)r�r)r�r�r�)r�r�listkeywords�listsymbols�
listtopics�listmodulesrr��
showsymbolr"�evalr��	showtopicr�r�r6r�r�r�r�)r>r�rrrris6






zHelper.helpcCs$|jjdjdtjdd���dS)Na�
Welcome to Python {0}'s help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/{0}/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".
z%d.%dr)r�r�r
rr�)r>rrrr�~szHelper.intror�Pc		Cs�tt|��}||}t|�|d|}x�t|�D]z}xht|�D]\}|||}|t|�kr@|jj||�||dkr@|jjdd|dt||��q@W|jjd�q2WdS)Nrr�r)r	�sortedr rr�r�)	r>�items�columnsrZcolwr�rowrrlrrrr	�s(zHelper.listcCs |jjd�|j|jj��dS)NzN
Here is a list of the Python keywords.  Enter any keyword to get more help.

)r�r�r	r�rD)r>rrrr��szHelper.listkeywordscCs |jjd�|j|jj��dS)Nzx
Here is a list of the punctuation symbols which Python assigns special meaning
to. Enter any symbol to get more help.

)r�r�r	r�rD)r>rrrr��szHelper.listsymbolscCs |jjd�|j|jj��dS)NzN
Here is a list of available topics.  Enter any topic name to get more help.

)r�r�r	r�rD)r>rrrr��szHelper.listtopicscCs,yddl}Wn tk
r,|jjd�dSX|jj||jj|��}|s`|jjdt|��dSt|�td�kr||j	||�S|\}}y|jj|}Wn(t
k
r�|jjdt|��dSX|j�d}|r�|p�dd|}|�r ddl}ddj
|j��d}	|j|	d	�}
|d
dj
|
�7}t|�dS)Nrzt
Sorry, topic and keyword documentation is not available because the
module "pydoc_data.topics" could not be found.
zno documentation found for %s
rrr�zRelated help topics: z, �Hz
%s
)�pydoc_data.topicsr�r�r�r�ror�r�r�r��KeyErrorr�textwrapr!rZwrapr�)r>�topic�
more_xrefs�
pydoc_data�target�label�xrefsr"r�r.Zwrapped_textrrrr��s6zHelper.showtopiccCs�yddl}Wntk
r dSX|jj||jj|��}|sDtd��t|t�rZ|j||�S|\}}|jj|}|r�|pxdd|}||fS)Nr�t
Sorry, topic and keyword documentation is not available because the
module "pydoc_data.topics" could not be found.
rzcould not find topicr�)r�r)	r�r�r�ror�rdr�r6�	_gettopic)r>r�r�r�r�r�r�r"rrrr��s	
zHelper._gettopiccCs*|j|}|jd�\}}}|j||�dS)Nr�)r��	partitionr�)r>�symbolr�r�r_r�rrrr��s
zHelper.showsymbolcsv|r |jjdj|��t|�nR|jjd�i}|fdd���fdd�}t�j�|d�|j|j��|jjd�dS)	Nzy
Here is a list of modules whose name or summary contains '{}'.
If there are any, enter a module name to get more help.

zI
Please wait a moment while I gather a list of all available modules...

cSs>|r$|dd�dkr$|dd�d}|jd�dkr:d||<dS)	N�	z	.__init__z
 (package)rrri����i����)�find)rr'r~r�rrr�callbacksz$Helper.listmodules.<locals>.callbackcs�d|d�dS)Nr)r')r�rr�onerrorsz#Helper.listmodules.<locals>.onerror)r�z�
Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".
)r�r�r
�apropos�
ModuleScanner�runr	rD)r>rGr�r�r)r�rr��s
zHelper.listmodules)r�r)r�r�)r�r�)r�r�)r�r)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�ry)r�r�)r�r)r�r�)r�ry)r�r�)r�r�)r�r�)r�r)r�r�r�r�)r�r�rr�)r�rUrrr�rrrrr�rrrr�r�r	r
rrr
)r�r�r	r
rrr
)rUr)rrrrrrrrrrrr)rrr�rrr)rr)r+r,)r-r.)r/r0)r1r)r-r2)r3r4)r5r6)r7r8)r9r:)r;r<)r>r?)r@rA)rBrC)rDrE)rGr)rHrI)rJr)r+rK)rLr�)rMrN)rPrF)rQrR)rSrT)rUrV)rWrX)rYrZ)rYr[)r\r])r^r_)r`ra)rbr)r�rd)rer)rfrg)rhr)rir)rjrk)rmrn)rorp)rqrr)rsrt)rru)rvrw)rxr�)ryr�)rzrO)r{rO)r|rO)r}rO)r~rO)rrO)r�r�)r�r�)r�r)r�r�)r�r�)r�r�)r�r�)r�r�)NN)rr�)r)r)r)!r%r&r[r�Z_strprefixesZ_symbols_inverser�r�r�Zsymbols_r�ror�rzr�r�r�r�rr�r�r�r�rr�r	r�r�r�r�r�r�r�rrrrr��s6





	
 r�c@seZdZddd�ZdS)r�NcCs
|r|j�}d|_i}xztjD]p}|dkrd||<|dkrH|d|d�qt|�jpTd}|jd�d}|d|}|j�j|�dkr|d||�qW�xdtj	|d�D�]R\}	}}
|jr�P|dkr�|d|d�q�ytj
|	|�}Wntk
r�w�YnX|j}t
|d	��rny|j|�}
Wn&tk
�r:|�r4||�w�YnXttj|
���pNd}t
|d
��rh|j|�}nd}n^ytjj|�}Wn&tk
�r�|�r�||�w�YnX|j�r�|jj�dnd}t|dd�}|d|}|j�j|�dkr�||||�q�W|�r|�dS)NF�__main__rrrrz - )r��
get_source�get_filenamerV)r�r�rr�r�rUrr�r9r��	_get_specr�r�rcr�rJr�r��StringIOr�r�r�r�r�r�r<)r>r�rGZ	completerr��seenr'r(r~rCrDr�r��sourcerr�rrrr�s`zModuleScanner.run)NNN)r%r&r[r�rrrrr�sr�cCsDdd�}dd�}tj��"tjd�t�j|||d�WdQRXdS)NcSs6|dd�dkr |dd�d}t||o.d|�dS)Nr�z	.__init__z
 (package)z- i����i����)r�)rr'r~rrrr�Oszapropos.<locals>.callbackcSsdS)Nr)r'rrrr�Sszapropos.<locals>.onerror�ignore)r�)�warnings�catch_warnings�filterwarningsr�r�)rGr�r�rrrr�Ms


r�cs�ddl�ddl�ddl�ddl�Gdd�d�jj��G�fdd�d�jj��G�����fdd�d�j�}|||�}|j�x|j	r�|j
r�tjd�q~W|S)	Nrc@seZdZdd�Zdd�ZdS)z!_start_server.<locals>.DocHandlercSsX|jjd�rd}nd}|jd�|jdd|�|j�|jj|j|j|�jd��dS)Nz.cssztext/cssz	text/html��zContent-Typez%s; charset=UTF-8zutf-8)	rrbZ
send_responseZsend_headerZend_headersZwfiler��
urlhandlerr�)r>�content_typerrr�do_GET�s

z(_start_server.<locals>.DocHandler.do_GETcWsdS)Nr)r>r�rrr�log_message�sz-_start_server.<locals>.DocHandler.log_messageN)r%r&r[r�r�rrrr�
DocHandler�sr�cs(eZdZdd�Z�fdd�Zdd�ZdS)z _start_server.<locals>.DocServercSs6d|_|j|f|_||_|jj||j|j�d|_dS)NZ	localhostF)�hostZaddressr�rIrz�handlerr�)r>�portr�rrrrz�s
z)_start_server.<locals>.DocServer.__init__csBx4|js4�j|jj�gggd�\}}}|r|j�qW|j�dS)Nr)r��selectZsocketr�Zhandle_requestZserver_close)r>Zrd�wrZex)r�rr�serve_until_quit�s
z1_start_server.<locals>.DocServer.serve_until_quitcSs |jj|�|jr|j|�dS)N)rI�server_activater�)r>rrrr��sz0_start_server.<locals>.DocServer.server_activateN)r%r&r[rzr�r�r)r�rr�	DocServer�sr�cs:eZdZ�fdd�Z����fdd�Zdd�Zdd�Zd	S)
z#_start_server.<locals>.ServerThreadcs,||_t|�|_�jj|�d|_d|_dS)NF)r�rr��Threadrz�serving�error)r>r�r�)�	threadingrrrz�s

z,_start_server.<locals>.ServerThread.__init__cstyF�jj�_��_�jj�_t|j��_�|j	|j
�}||_|j�Wn(t
k
rn}z||_WYdd}~XnXdS)N)�server�
HTTPServerrIr�r�ZMessageZMessageClass�staticmethodr�r��ready�	docserverr�rJr�)r>Zdocsvr�e)r�r��email�httprrr��s

z'_start_server.<locals>.ServerThread.runcSs,d|_|j|_|j|_d|j|jf|_dS)NTz
http://%s:%d/)r�r�Zserver_portr�r)r>r�rrrr��sz)_start_server.<locals>.ServerThread.readycSs&d|j_|j�d|_d|_d|_dS)NTF)r�r�r!r�r)r>rrr�stop�s
z(_start_server.<locals>.ServerThread.stopN)r%r&r[rzr�r�r�r)r�r�r�r�r�rr�ServerThread�s
r�g{�G�z�?)
Zhttp.serverZ
email.messager�r�r�ZBaseHTTPRequestHandlerr�r�r#r�r��timeZsleep)r�r�r�Zthreadr)r�r�r�r�r�r�r�
_start_server[s8&
r��	text/htmlcsG�fdd�dt�}|���fdd���fdd���fdd���fd	d
���fdd���fd
d���fdd���fdd����������fdd�}|jd�r�|dd�}|dkr�tjjtjjt��}tjj||�}t|��}dj|j	��SQRXn|dk�r||�St
d||f��dS)NcseZdZ�fdd�ZdS)z_url_handler.<locals>._HTMLDoccsd}d|}d||��|fS)Nzpydoc_data/_pydoc.cssz1<link rel="stylesheet" type="text/css" href="%s">a<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Pydoc: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
%s</head><body bgcolor="#f0f0f8">%s<div style="clear:both;padding-top:.5em;">%s</div>
</body></html>r)r>r�r��css_pathZcss_link)�html_navbarrrr��sz#_url_handler.<locals>._HTMLDoc.pageN)r%r&r[r�r)r�rr�_HTMLDoc�sr�cs>�jdtj�tj�dtj�f�}d|�jtjdd��fS)Nz%s [%s, %s]raZ
            <div style='float:left'>
                Python %s<br>%s
            </div>
            <div style='float:right'>
                <div style='text-align:center'>
                  <a href="index.html">Module Index</a>
                  : <a href="topics.html">Topics</a>
                  : <a href="keywords.html">Keywords</a>
                </div>
                <div>
                    <form action="get" style='display:inline;'>
                      <input type=text name=key size=15>
                      <input type=submit value="Get">
                    </form>&nbsp;
                    <form action="search" style='display:inline;'>
                      <input type=text name=key size=15>
                      <input type=submit value="Search">
                    </form>
                </div>
            </div>
            T)Zterse)r�r�Zpython_versionZpython_buildZpython_compiler)r@)r�rrr�
	s
z!_url_handler.<locals>.html_navbarcs�dd�}�jddd�}dd�tjD�}�j||�}|d�jd	dd
|�g}i}x tjD]}|j�j||��qVW|jd�dd
j|�fS)NcSsd||fS)Nz<a href="%s.html">%s</a>r)r(rrr�	bltinlink+	sz3_url_handler.<locals>.html_index.<locals>.bltinlinkz7<big><big><strong>Index of Modules</strong></big></big>z#ffffffz#7799eecSsg|]}|dkr|�qS)r�r)rkr(rrrr�1	sz4_url_handler.<locals>.html_index.<locals>.<listcomp>z<p>zBuilt-in Modulesz#ee77aaz|<p align=right><font color="#909090" face="helvetica,arial"><strong>pydoc</strong> by Ka-Ping Yee&lt;ping@lfw.org&gt;</font>zIndex of Modulesr)	rrr�r
rrr
rnr!)r�r�namesr�r�r)r�rr�
html_index(	sz _url_handler.<locals>.html_indexc	s�g��fdd�}tj��*tjd�dd�}t�j|||d�WdQRXdd�}g}�jd	d
d�}x"�D]\}}|j||�|�qhW|�jd|d
d
dj|��}d|fS)Ncs:|dd�dkr |dd�d}�j||o0d|f�dS)Nr�z	.__init__z
 (package)z- i����i����)r
)rr'r~)�
search_resultrrr�F	sz3_url_handler.<locals>.html_search.<locals>.callbackr�cSsdS)Nr)r'rrrr�M	sz2_url_handler.<locals>.html_search.<locals>.onerror)r�cSsd||fS)Nz<a href="%s.html">%s</a>r)r(rrrr�R	sz4_url_handler.<locals>.html_search.<locals>.bltinlinkz5<big><big><strong>Search Results</strong></big></big>z#ffffffz#7799eezkey = %sz#ee77aaz<br>zSearch Results)	r�r�r�r�r�rr
rr!)	rGr�r�r�rhrr(r~r�)r�)r�r�html_searchA	s 

z!_url_handler.<locals>.html_searchcsLdd�}�jddd�}ttjj��}�j||�}|�jddd|�}d|fS)NcSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrr�b	sz4_url_handler.<locals>.html_topics.<locals>.bltinlinkz,<big><big><strong>INDEX</strong></big></big>z#ffffffz#7799eeZTopicsz#ee77aa)rr�r�r�rDr
r)r�rr�r�)r�rr�html_topics_	sz!_url_handler.<locals>.html_topicscsL�jddd�}ttjj��}dd�}�j||�}|�jddd|�}d|fS)Nz,<big><big><strong>INDEX</strong></big></big>z#ffffffz#7799eecSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrr�v	sz6_url_handler.<locals>.html_keywords.<locals>.bltinlinkZKeywordsz#ee77aa)rr�r�r�rDr
r)rr�r�r�)r�rr�
html_keywordso	sz#_url_handler.<locals>.html_keywordscs�tj�}t||�}|j|�\}}||jkr0d}nd}�jd|dd�}d�j|�}�j|dd|�}|r�t|j	��}dd	�}�j
||�}�jd
dd|�}d||fdj|||f�fS)
NZKEYWORDZTOPICz)<big><big><strong>%s</strong></big></big>z#ffffffz#7799eez
<pre>%s</pre>z#ee77aacSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrr��	sz7_url_handler.<locals>.html_topicpage.<locals>.bltinlinkzRelated help topics: z%s %sr)
r�r�r�r�r�rr&rr�rr
rr!)r�ZbufZhtmlhelpr�r�r�rr�)r�rr�html_topicpage~	s&



z$_url_handler.<locals>.html_topicpagecs@t|dd�}|dkr$|dkr$td��t|�}�j||�}||fS)Nr)r�r�zcould not find object)r�rdr�r�)rr9r��content)r�rr�html_getobj�	sz!_url_handler.<locals>.html_getobjcsP�jddd�}dj�fdd�tt|�|�D��}|�j|dd|�}d||fS)	Nz,<big><big><strong>Error</strong></big></big>z#ffffffz#7799eez<br>c3s|]}�j|�VqdS)N)r�)rkr�)r�rrrl�	sz3_url_handler.<locals>.html_error.<locals>.<genexpr>z#bb0000z
Error - %s)rr!rr�r)rr�rr�)r�rr�
html_error�	sz _url_handler.<locals>.html_errorcst|}|jd�r|dd�}�y|d
kr4��\}}�n�|dkrH��\}}n�|dkr\��\}}n�d|k�r&|jd�\}}}|dkr��|�\}}n�|d	kr�y�|�\}}Wn tk
r��|�\}}YnXn\|d
k�r|dkr��\}}n4y�|�\}}Wn"tk
�r�|�\}}YnXntd��n�|�\}}Wn2tk
�rf}z�||�\}}WYdd}~XnX�j||�S)Nz.html�rrnr�r�r`z
search?keyz	topic?keyzget?keyz
bad pydoc url���)rrn)rrn)rbr�rdrJr�)rZcomplete_urlr�r��opr_r�)r�r�r�r�r�r�r�r�rr�
get_html_page�	s>



 z#_url_handler.<locals>.get_html_pager�rztext/cssrz	text/htmlz"unknown content type %r for url %s)r�rar	r�dirname�realpathrVr!r��	readlinesrt)rr�r�r�Z	path_herer��fpr)	r�r�r�r�r�r�r�r�r�r�_url_handler�s*	
(


rT)�open_browsercCs�ddl}tt|�}|jr&t|j�dS|jr�d}|r@|j|j�z�y^td|j�t|�xD|jr�td�}|j	�}|dkr|PqZ|dkr�|j|j�qZt|�qZWWnt
tfk
r�t�YnXWd|jr�|j�td�XdS)Nrz"Server commands: [b]rowser, [q]uitzServer ready atzserver> r�r�zServer stopped)
�
webbrowserr�rr�r�r�r�rr�r�r�r�r�)r�rrZserverthreadZserver_help_msgr�rrr�browse�	s2

rcCst|t�o|jtj�dkS)Nr)r�r6r�r	�sep)rNrrr�ispath
srcCsddl}Gdd�dt�}dtjkrXtjjtjd�}|tjkrJtjj|�tjjdd��yp|jtjdd�d�\}}d}d}d}d}xP|D]H\}	}
|	d	kr�d
}d
}|	dkr�t	|
�dS|	dkr�d
}|
}|	d
kr�d
}q�W|r�|dkr�d}t
||d�dS|�s|�x�|D]�}t|��r4tjj|��r4t
d|�Py`t|��rVtjj|��rVt|�}|�r�t|��r~tjj|��r~t|�nt|�n
tj|�Wn,tk
�r�}zt
|�WYdd}~XnX�qWWnN|j|fk
�rtjjtjjtjd��d}
t
dj|
tjd��YnXdS)Nrc@seZdZdS)zcli.<locals>.BadUsageN)r%r&r[rrrr�BadUsage

sr	rrrzbk:p:wFz-bTz-kz-pz-w)rzfile %r does not exista�pydoc - the Python documentation tool

{cmd} <name> ...
    Show text documentation on something.  <name> may be the name of a
    Python keyword, topic, function, module, or package, or a dotted
    reference to a class or function within a module or module in a
    package.  If <name> contains a '{sep}', it is used as the path to a
    Python source file to document. If name is 'keywords', 'topics',
    or 'modules', a listing of these things is displayed.

{cmd} -k <keyword>
    Search for a keyword in the synopsis lines of all available modules.

{cmd} -p <port>
    Start an HTTP server on the given port on the local machine.  Port
    number 0 can be used to get an arbitrary unused port.

{cmd} -b
    Start an HTTP server on an arbitrary unused port and open a Web browser
    to interactively browse documentation.  The -p option can be used with
    the -b option to explicitly specify the server port.

{cmd} -w <name> ...
    Write out the HTML documentation for a module to a file in the current
    directory.  If <name> contains a '{sep}', it is treated as a filename; if
    it names a directory, documentation is written for all the contents.
)r�r)�getoptrJrrr	r��argv�remove�insertr�rr�existsr�r{r�rr�r�rr�r�r�r�r
r)r
r	Z	scriptdirZoptsr�ZwritingZstart_serverrr��opt�val�argrHr�rrr�cli
sd




$rr�)NN)r)r)r�rN)r�rN)r)rN)r�)r)Wr3rPrTrSrZZimportlib._bootstrapr�Zimportlib._bootstrap_external�importlib.machinery�importlib.utilrr�r	r9r�rrr�r�Zurllib.parser4r��collectionsr�reprlibr�	tracebackrrrr$r)r-r/r3r�
IGNORECASEr4r5r:r?rCrOrerfrwr}r�r�rJr�r�r�r�r�r�rprqr�r�r�r�r�r�r�r�r�r�r�r.r�r�r�r�r"r�r�r�rr�r�r�rrrrr%rrrr�<module>$s�		


	'
0>*- d",






=
n%V
filecmp.cpython-36.opt-1.pyc000064400000020163150335715140011556 0ustar003


 \f&�@s�dZddlZddlZddlmZdddddgZiZd#Zddd
dddddgZdd�Z	d$dd�Z
dd�Zdd�ZGdd�d�Z
d%dd�Zee
fdd�Zdd�Zd d!�Zed"kr�e�dS)&z�Utilities for comparing files and directories.

Classes:
    dircmp

Functions:
    cmp(f1, f2, shallow=True) -> int
    cmpfiles(a, b, common) -> ([], [], [])
    clear_cache()

�N)�filterfalse�clear_cache�cmp�dircmp�cmpfiles�DEFAULT_IGNORES�iZRCSZCVSZtagsz.gitz.hgz.bzrZ_darcs�__pycache__cCstj�dS)zClear the filecmp cache.N)�_cache�clear�rr�/usr/lib64/python3.6/filecmp.pyrsTcCs�ttj|��}ttj|��}|dtjks8|dtjkr<dS|rL||krLdS|d|dkr`dStj||||f�}|dkr�t||�}tt�dkr�t�|t||||f<|S)a�Compare two files.

    Arguments:

    f1 -- First file name

    f2 -- Second file name

    shallow -- Just check stat signature (do not read the files).
               defaults to True.

    Return value:

    True if the files are the same, False otherwise.

    This function uses a cache for past comparisons and the results,
    with cache entries invalidated if their stat information
    changes.  The cache may be cleared by calling clear_cache().

    rFT�N�d)	�_sig�os�stat�S_IFREGr
�get�_do_cmp�lenr)�f1�f2�shallow�s1�s2Zoutcomerrr
rs
cCstj|j�|j|jfS)N)r�S_IFMT�st_mode�st_size�st_mtime)�strrr
rDs
rcCsbt}t|d��J}t|d��4}x,|j|�}|j|�}||kr>dS|sdSqWWdQRXWdQRXdS)N�rbFT)�BUFSIZE�open�read)rr�bufsize�fp1�fp2Zb1Zb2rrr
rIs

rc@s�eZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
ee	eeeeeeeeeeed�Zdd�ZdS)raMA class that manages the comparison of 2 directories.

    dircmp(a, b, ignore=None, hide=None)
      A and B are directories.
      IGNORE is a list of names to ignore,
        defaults to DEFAULT_IGNORES.
      HIDE is a list of names to hide,
        defaults to [os.curdir, os.pardir].

    High level usage:
      x = dircmp(dir1, dir2)
      x.report() -> prints a report on the differences between dir1 and dir2
       or
      x.report_partial_closure() -> prints report on differences between dir1
            and dir2, and reports on common immediate subdirectories.
      x.report_full_closure() -> like report_partial_closure,
            but fully recursive.

    Attributes:
     left_list, right_list: The files in dir1 and dir2,
        filtered by hide and ignore.
     common: a list of names in both dir1 and dir2.
     left_only, right_only: names only in dir1, dir2.
     common_dirs: subdirectories in both dir1 and dir2.
     common_files: files in both dir1 and dir2.
     common_funny: names in both dir1 and dir2 where the type differs between
        dir1 and dir2, or the name is not stat-able.
     same_files: list of identical files.
     diff_files: list of filenames which differ.
     funny_files: list of files which could not be compared.
     subdirs: a dictionary of dircmp objects, keyed by names in common_dirs.
     NcCsD||_||_|dkr$tjtjg|_n||_|dkr:t|_n||_dS)N)�left�rightr�curdir�pardir�hider�ignore)�self�a�br-r,rrr
�__init__xszdircmp.__init__cCsPttj|j�|j|j�|_ttj|j�|j|j�|_|jj	�|jj	�dS)N)
�_filterr�listdirr(r,r-�	left_listr)�
right_list�sort)r.rrr
�phase0�s
z
dircmp.phase0cCs�ttttjj|j�|j��}ttttjj|j�|j��}tt|j	t
|j|���|_tt|j	t
|j|���|_tt|j	t
|j|���|_dS)N)�dict�zip�mapr�path�normcaser4r5�list�__getitem__�filter�__contains__�commonr�	left_only�
right_only)r.r/r0rrr
�phase1�s
z
dircmp.phase1c
Cs:g|_g|_g|_�x |jD�]}tjj|j|�}tjj|j|�}d}ytj	|�}Wn&t
k
rz}z
d}WYdd}~XnXytj	|�}Wn&t
k
r�}z
d}WYdd}~XnX|�r&t	j|j�}t	j|j�}	||	kr�|jj
|�n>t	j|�r�|jj
|�n&t	j|��r|jj
|�n|jj
|�q|jj
|�qWdS)Nrr)�common_dirs�common_files�common_funnyrArr;�joinr(r)r�OSErrorrr�append�S_ISDIR�S_ISREG)
r.�xZa_pathZb_path�okZa_statZwhyZb_statZa_typeZb_typerrr
�phase2�s4
z
dircmp.phase2cCs&t|j|j|j�}|\|_|_|_dS)N)rr(r)rF�
same_files�
diff_files�funny_files)r.Zxxrrr
�phase3�sz
dircmp.phase3cCsRi|_xF|jD]<}tjj|j|�}tjj|j|�}t|||j|j	�|j|<qWdS)N)
�subdirsrErr;rHr(r)rr-r,)r.rMZa_xZb_xrrr
�phase4�s
z
dircmp.phase4cCs(|j�x|jj�D]}|j�qWdS)N)rUrT�values�phase4_closure)r.�sdrrr
rW�szdircmp.phase4_closurecCs�td|j|j�|jr2|jj�td|jd|j�|jrT|jj�td|jd|j�|jrp|jj�td|j�|jr�|jj�td|j�|jr�|jj�td|j�|j	r�|j	j�td|j	�|j
r�|j
j�td|j
�dS)	NZdiffzOnly in�:zIdentical files :zDiffering files :zTrouble with common files :zCommon subdirectories :zCommon funny cases :)�printr(r)rBr6rCrPrQrRrErG)r.rrr
�report�s,






z
dircmp.reportcCs.|j�x |jj�D]}t�|j�qWdS)N)r[rTrVrZ)r.rXrrr
�report_partial_closure�szdircmp.report_partial_closurecCs.|j�x |jj�D]}t�|j�qWdS)N)r[rTrVrZ�report_full_closure)r.rXrrr
r]�szdircmp.report_full_closure)rTrPrQrRrErFrGrArBrCr4r5cCs*||jkrt|��|j||�t||�S)N)�	methodmap�AttributeError�getattr)r.�attrrrr
�__getattr__�s
zdircmp.__getattr__)NN)�__name__�
__module__�__qualname__�__doc__r1r7rDrOrSrUrWr[r\r]r8r^rbrrrr
rVs" 
#

cCsNgggf}x>|D]6}tjj||�}tjj||�}|t|||�j|�qW|S)a]Compare common files in two directories.

    a, b -- directory names
    common -- list of file names found in both directories
    shallow -- if true, do comparison based solely on stat() information

    Returns a tuple of three lists:
      files that compare equal
      files that are different
      filenames that aren't regular files.

    )rr;rH�_cmprJ)r/r0rAr�resrMZaxZbxrrr
r�s

cCs,y|||||��Stk
r&dSXdS)N�)rI)r/r0Zsh�absrrrr
rgsrgcCstt|j|��S)N)r=rr@)Zflist�skiprrr
r2sr2cCsrddl}ddl}|j|jdd�d�\}}t|�dkrB|jdd��t|d|d�}d|krf|j�n|j�dS)	Nrr�rrizneed exactly two args�-r�)rmrn)�sys�getopt�argvrZGetoptErrorrr]r[)rorpZoptions�argsZddrrr
�demo$s
rs�__main__i )T)T)rfrr�	itertoolsr�__all__r
r"rrrrrrrrjrgr2rsrcrrrr
�<module>s&
'
%
	smtpd.cpython-36.pyc000064400000064075150335715140010341 0ustar003


 \���@s^dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
mZddddd	gZejdZd
ZGdd�d�Ze�ad
ZdZdZd%dd�ZGdd�dej�ZGdd�dej�ZGdd�de�ZGdd�de�ZGdd	�d	e�ZGdd�d�Z dd�Z!e"dk�rZe!�Z#e#j$Z$de$k�rpe$j%d�Z&e'e$de&�e(�e)�dg�Z*e$e&dd�Z$nddl+Z*e,e*e$�Z-e-e#j.e#j/fe#j0e#j1fe#j2e#j3d�Z4e#j5�r6yddl6Z6Wn.e7k
�r�e8d ej9d!�ej:d�YnXe6j;d"�d#Z<yej5e<�Wn.e=k
�r4e8d$ej9d!�ej:d�YnXyej>�Wne?k
�rXYnXdS)&a�An RFC 5321 smtp proxy with optional RFC 1870 and RFC 6531 extensions.

Usage: %(program)s [options] [localhost:localport [remotehost:remoteport]]

Options:

    --nosetuid
    -n
        This program generally tries to setuid `nobody', unless this flag is
        set.  The setuid call will fail if this program is not run as root (in
        which case, use this flag).

    --version
    -V
        Print the version number and exit.

    --class classname
    -c classname
        Use `classname' as the concrete SMTP proxy class.  Uses `PureProxy' by
        default.

    --size limit
    -s limit
        Restrict the total size of the incoming message to "limit" number of
        bytes via the RFC 1870 SIZE extension.  Defaults to 33554432 bytes.

    --smtputf8
    -u
        Enable the SMTPUTF8 extension and behave as an RFC 6531 smtp proxy.

    --debug
    -d
        Turn on debugging prints.

    --help
    -h
        Print this message and exit.

Version: %(__version__)s

If localhost is not given then `localhost' is used, and if localport is not
given then 8025 is used.  If remotehost is not given then `localhost' is used,
and if remoteport is not given, then 25 is used.
�N)�warn)�
get_addr_spec�get_angle_addr�SMTPChannel�
SMTPServer�DebuggingServer�	PureProxy�MailmanProxyzPython SMTP proxy version 0.3c@seZdZdd�Zdd�ZdS)�DevnullcCsdS)N�)�self�msgrr�/usr/lib64/python3.6/smtpd.py�writefsz
Devnull.writecCsdS)Nr)rrrr�flushgsz
Devnull.flushN)�__name__�
__module__�__qualname__rrrrrrr
esr
�
z, i�cCs4ttt�tjd�|r&t|tjd�tj|�dS)N)�file)�print�__doc__�globals�sys�stderr�exit)�coder
rrr�usagepsrc@s�eZdZdZdZdZejefdd��Ze	dd��Z
edd	d	fd
d�Zdd
�Z
dd�Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd ��Zejd!d ��Ze	d"d#��Zejd$d#��Ze	d%d&��Zejd'd&��Ze	d(d)��Zejd*d)��Ze	d+d,��Zejd-d,��Ze	d.d/��Zejd0d/��Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dS)Srr�icCs|S)Nr)�xrrr�<lambda>|szSMTPChannel.<lambda>cCs*yt|jj��Stk
r$|jSXdS)N)�max�command_size_limits�values�
ValueError�command_size_limit)rrrr�max_command_size_limit~sz"SMTPChannel.max_command_size_limitNFc	Cstjj|||d�||_||_||_||_||_||_|rF|rFt	d��|rdd|_
d|_d|_t
|_nd|_
d|_td�|_d	|_|j�d|_d
|_|jj�tj�|_y|j�|_Wn:tk
r�}z|j�|jdtjkr�dSd}~XnXtdt |j�t!d
�|j"d|jt#f�dS)N)�mapzFdecode_data and enable_SMTPUTF8 cannot be set to True at the same timerz
�.�s
�.�
FrzPeer:)rz	220 %s %s)$�asynchat�
async_chat�__init__�smtp_server�conn�addr�data_size_limit�enable_SMTPUTF8�_decode_datar%�_emptystring�_linesep�_dotsep�NEWLINE�_newline�ord�_set_rset_state�
seen_greeting�
extended_smtpr#�clear�socketZgetfqdn�fqdnZgetpeername�peer�OSError�close�args�errnoZENOTCONNr�repr�DEBUGSTREAM�push�__version__)	rZserverr1r2r3r(r4�decode_data�errrrrr/�s@


zSMTPChannel.__init__cCs.|j|_d|_g|_d|_d|_|jd�dS)z/Reset state variables to their post-DATA state.NFrs
)�COMMAND�
smtp_state�mailfrom�rcpttos�require_SMTPUTF8�	num_bytes�set_terminator)rrrr�_set_post_data_state�sz SMTPChannel._set_post_data_statecCs|j�d|_g|_dS)z.Reset all state variables except the greeting.rN)rT�
received_data�received_lines)rrrrr<�szSMTPChannel._set_rset_statecCstdtd�|jS)NzTAccess to __server attribute on SMTPChannel is deprecated, use 'smtp_server' instead�)r�DeprecationWarningr0)rrrr�__server�szSMTPChannel.__servercCstdtd�||_dS)NzRSetting __server attribute on SMTPChannel is deprecated, set 'smtp_server' insteadrW)rrXr0)r�valuerrrrY�scCstdtd�|jS)NzUAccess to __line attribute on SMTPChannel is deprecated, use 'received_lines' insteadrW)rrXrV)rrrr�__line�szSMTPChannel.__linecCstdtd�||_dS)NzSSetting __line attribute on SMTPChannel is deprecated, set 'received_lines' insteadrW)rrXrV)rrZrrrr[�scCstdtd�|jS)NzRAccess to __state attribute on SMTPChannel is deprecated, use 'smtp_state' insteadrW)rrXrN)rrrr�__state�szSMTPChannel.__statecCstdtd�||_dS)NzPSetting __state attribute on SMTPChannel is deprecated, set 'smtp_state' insteadrW)rrXrN)rrZrrrr\�scCstdtd�|jS)NzXAccess to __greeting attribute on SMTPChannel is deprecated, use 'seen_greeting' insteadrW)rrXr=)rrrr�
__greeting�szSMTPChannel.__greetingcCstdtd�||_dS)NzVSetting __greeting attribute on SMTPChannel is deprecated, set 'seen_greeting' insteadrW)rrXr=)rrZrrrr]�scCstdtd�|jS)NzSAccess to __mailfrom attribute on SMTPChannel is deprecated, use 'mailfrom' insteadrW)rrXrO)rrrr�
__mailfrom�szSMTPChannel.__mailfromcCstdtd�||_dS)NzQSetting __mailfrom attribute on SMTPChannel is deprecated, set 'mailfrom' insteadrW)rrXrO)rrZrrrr^�scCstdtd�|jS)NzQAccess to __rcpttos attribute on SMTPChannel is deprecated, use 'rcpttos' insteadrW)rrXrP)rrrr�	__rcpttos�szSMTPChannel.__rcpttoscCstdtd�||_dS)NzOSetting __rcpttos attribute on SMTPChannel is deprecated, set 'rcpttos' insteadrW)rrXrP)rrZrrrr_�scCstdtd�|jS)NzTAccess to __data attribute on SMTPChannel is deprecated, use 'received_data' insteadrW)rrXrU)rrrr�__data�szSMTPChannel.__datacCstdtd�||_dS)NzRSetting __data attribute on SMTPChannel is deprecated, set 'received_data' insteadrW)rrXrU)rrZrrrr`scCstdtd�|jS)NzKAccess to __fqdn attribute on SMTPChannel is deprecated, use 'fqdn' insteadrW)rrXrA)rrrr�__fqdn
szSMTPChannel.__fqdncCstdtd�||_dS)NzISetting __fqdn attribute on SMTPChannel is deprecated, set 'fqdn' insteadrW)rrXrA)rrZrrrrascCstdtd�|jS)NzKAccess to __peer attribute on SMTPChannel is deprecated, use 'peer' insteadrW)rrXrB)rrrr�__peerszSMTPChannel.__peercCstdtd�||_dS)NzISetting __peer attribute on SMTPChannel is deprecated, set 'peer' insteadrW)rrXrB)rrZrrrrbscCstdtd�|jS)NzKAccess to __conn attribute on SMTPChannel is deprecated, use 'conn' insteadrW)rrXr1)rrrr�__conn szSMTPChannel.__conncCstdtd�||_dS)NzISetting __conn attribute on SMTPChannel is deprecated, set 'conn' insteadrW)rrXr1)rrZrrrrc%scCstdtd�|jS)NzKAccess to __addr attribute on SMTPChannel is deprecated, use 'addr' insteadrW)rrXr2)rrrr�__addr+szSMTPChannel.__addrcCstdtd�||_dS)NzISetting __addr attribute on SMTPChannel is deprecated, set 'addr' insteadrW)rrXr2)rrZrrrrd0scCs&tjj|t|d|jrdnd��dS)Nz
zutf-8�ascii)r-r.rI�bytesrQ)rr
rrrrI7s
zSMTPChannel.pushcCs|d}|j|jkr|j}n|j|jkr*|j}|r<|j|kr<dS|rR|jt|�7_|jrl|jj	t
|d��n|jj	|�dS)Nzutf-8)rNrMr'�DATAr3rR�lenr5rV�append�str)r�data�limitrrr�collect_incoming_data<sz!SMTPChannel.collect_incoming_datac
Cs|jj|j�}tdt|�td�g|_|j|jk�r|jd}|_|sT|j	d�dS|j
sdt|d�}|jd�}|dkr�|j
�}d}n$|d|�j
�}||dd�j�}|jr�|j|n|j}||kr�|j	d�dSt|d	|d�}|�s�|j	d
|�dS||�dS|j|jk�r*|j	d�d|_dS|j�rT|j|jk�rT|j	d�d|_dSg}xJ|j|j�D]:}	|	�r�|	d|jk�r�|j|	dd��n
|j|	��qfW|jj|�|_|j|j|j|jf}
i}|j
�s�|j|jd
�}|j j!|
|�}|j"�|�s|j	d�n
|j	|�dS)NzData:)rrz500 Error: bad syntaxzutf-8� rz500 Error: line too longZsmtp_z&500 Error: command "%s" not recognizedz451 Internal confusionz552 Error: Too much mail data)�mail_options�rcpt_optionsz250 OK)#r6�joinrVrrGrHrNrMrRrIr5rj�find�upper�stripr>r#r&�getattrrgr3�splitr7r8rir:rUrBrOrProrpr0�process_messagerT)
r�lineZsz�i�command�argZmax_sz�methodrk�textrE�kwargsZstatusrrr�found_terminatorLsd






zSMTPChannel.found_terminatorcCsH|s|jd�dS|jr&|jd�dS|j�||_|jd|j�dS)Nz501 Syntax: HELO hostnamez503 Duplicate HELO/EHLOz250 %s)rIr=r<rA)rr{rrr�	smtp_HELO�s

zSMTPChannel.smtp_HELOcCs�|s|jd�dS|jr&|jd�dS|j�||_d|_|jd|j�|jrr|jd|j�|jdd7<|js�|jd�|jr�|jd	�|jdd
7<|jd�dS)Nz501 Syntax: EHLO hostnamez503 Duplicate HELO/EHLOTz250-%sz250-SIZE %s�MAIL�z250-8BITMIMEz250-SMTPUTF8�
z250 HELP)	rIr=r<r>rAr3r#r5r4)rr{rrr�	smtp_EHLO�s&



zSMTPChannel.smtp_EHLOcCs|r|jd�n
|jd�dS)Nz501 Syntax: NOOPz250 OK)rI)rr{rrr�	smtp_NOOP�szSMTPChannel.smtp_NOOPcCs|jd�|j�dS)Nz221 Bye)rIZclose_when_done)rr{rrr�	smtp_QUIT�s
zSMTPChannel.smtp_QUITcCs0t|�}|d|�j�|kr,||d�j�SdS)Nr)rhrsrt)r�keywordr{Zkeylenrrr�_strip_command_keyword�sz"SMTPChannel._strip_command_keywordcCsF|sdS|j�jd�r$t|�\}}nt|�\}}|s<||fS|j|fS)Nr�<)rr)�lstrip�
startswithrrZ	addr_spec)rr{�address�restrrr�_getaddr�szSMTPChannel._getaddrcCsNi}xD|D]<}|jd�\}}}|j�s2|r6|r6dS|r>|nd||<q
W|S)N�=T)�	partition�isalnum)r�params�resultZparam�eqrZrrr�
_getparams�s
zSMTPChannel._getparamscCs|r�d}|j�}|dkr$|jd�q�|dkr8|jd�q�|dkr^d}|jrR||7}|j|�q�|dkr�d	}|jrx||7}|j|�q�|d
kr�|jd�q�|dkr�|jd
�q�|dkr�|jd�q�|dkr�|jd�q�|dkr�|jd�q�|jd�n
|jd�dS)Nz [SP <mail-parameters>]ZEHLOz250 Syntax: EHLO hostnameZHELOz250 Syntax: HELO hostnamer�z 250 Syntax: MAIL FROM: <address>ZRCPTz250 Syntax: RCPT TO: <address>rgz250 Syntax: DATAZRSETz250 Syntax: RSETZNOOPz250 Syntax: NOOPZQUITz250 Syntax: QUITZVRFYz250 Syntax: VRFY <address>zD501 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFYzD250 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFY)rsrIr>)rr{ZextendedZlc_argr
rrr�	smtp_HELP�s:zSMTPChannel.smtp_HELPcCs@|r2|j|�\}}|r"|jd�q<|jd|�n
|jd�dS)NzB252 Cannot VRFY user, but will accept message and attempt deliveryz502 Could not VRFY %sz501 Syntax: VRFY <address>)r�rI)rr{r�r�rrr�	smtp_VRFY�szSMTPChannel.smtp_VRFYcCs�|js|jd�dStd|td�d}|jr4|d7}|dkrJ|j|�dS|jd|�}|j|�\}}|sv|j|�dS|jr�|r�|j|�dS|jr�|jd�dS|j�j	�|_
|j|j
�}|dkr�|j|�dS|j�s|j
dd	�}|dk�r|jd�dS|j�r>|j
dd
�}|dk�r&d|_n|d
k	�r>|jd�dS|j
dd�}|�r�|j��sh|j|�dS|j�r�t|�|jk�r�|jd�dSt|j��dk�r�|jd�dS||_td|jtd�|jd�dS)Nz503 Error: send HELO firstz	===> MAIL)rz 501 Syntax: MAIL FROM: <address>z [SP <mail-parameters>]zFROM:z503 Error: nested MAIL commandZBODY�7BIT�8BITMIMEz1501 Error: BODY can only be one of 7BIT, 8BITMIMEZSMTPUTF8FTz&501 Error: SMTPUTF8 takes no argumentsZSIZEz:552 Error: message size exceeds fixed maximum message sizerz:555 MAIL FROM parameters not recognized or not implementedzsender:z250 OK)r�r�)r=rIrrHr>r�r�rOrsrvror�r5�popr4rQ�isdigitr3�intrh�keys)rr{�	syntaxerrr�r�Zbody�smtputf8�sizerrr�	smtp_MAILsh














zSMTPChannel.smtp_MAILcCs|js|jd�dStd|td�|js6|jd�dSd}|jrH|d7}|dkr^|j|�dS|jd|�}|j|�\}}|s�|j|�dS|jr�|r�|j|�dS|j�j	�|_
|j|j
�}|dkr�|j|�dSt|j
��dkr�|jd	�dS|jj|�td
|jtd�|jd�dS)Nz503 Error: send HELO firstz	===> RCPT)rz503 Error: need MAIL commandz501 Syntax: RCPT TO: <address>z [SP <mail-parameters>]zTO:rz8555 RCPT TO parameters not recognized or not implementedzrecips:z250 OK)r=rIrrHrOr>r�r�rsrvrpr�rhr�rPri)rr{r�r�r�rrr�	smtp_RCPT7s@






zSMTPChannel.smtp_RCPTcCs(|r|jd�dS|j�|jd�dS)Nz501 Syntax: RSETz250 OK)rIr<)rr{rrr�	smtp_RSETZs

zSMTPChannel.smtp_RSETcCsZ|js|jd�dS|js(|jd�dS|r:|jd�dS|j|_|jd�|jd�dS)Nz503 Error: send HELO firstz503 Error: need RCPT commandz501 Syntax: DATAs
.
z#354 End data with <CR><LF>.<CR><LF>)r=rIrPrgrNrS)rr{rrr�	smtp_DATAas



zSMTPChannel.smtp_DATAcCs|jd�dS)Nz502 EXPN not implemented)rI)rr{rrr�	smtp_EXPNpszSMTPChannel.smtp_EXPN),rrrrMrgr&�collections�defaultdictr#�propertyr'�DATA_SIZE_DEFAULTr/rTr<Z_SMTPChannel__server�setterZ_SMTPChannel__lineZ_SMTPChannel__stateZ_SMTPChannel__greetingZ_SMTPChannel__mailfromZ_SMTPChannel__rcpttosZ_SMTPChannel__dataZ_SMTPChannel__fqdnZ_SMTPChannel__peerZ_SMTPChannel__connZ_SMTPChannel__addrrIrmrr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrws`&	>#6#c@s2eZdZeZedddfdd�Zdd�Zdd�ZdS)	rNFcCs�||_||_||_||_||_|r.|r.td��tjj||d�yNt	j
|dt	ji�}|j|dd|dd�|j
�|j|�|jd�Wn|j��Yn(Xtd|jjtjtj��||ftd�dS)	NzFdecode_data and enable_SMTPUTF8 cannot be set to True at the same time)r(�typerr�z0%s started at %s
	Local addr: %s
	Remote addr:%s)r)Z
_localaddr�_remoteaddrr3r4r5r%�asyncore�
dispatcherr/r@ZgetaddrinfoZSOCK_STREAMZ
create_socketZset_reuse_addrZbindZlistenrDr�	__class__r�time�ctimerH)rZ	localaddrZ
remoteaddrr3r(r4rKZgai_resultsrrrr/xs*

zSMTPServer.__init__cCs6tdt|�td�|j||||j|j|j|j�}dS)NzIncoming connection from %s)r)rrGrH�
channel_classr3Z_mapr4r5)rr1r2Zchannelrrr�handle_accepted�szSMTPServer.handle_acceptedcKst�dS)aOverride this abstract method to handle messages from the client.

        peer is a tuple containing (ipaddr, port) of the client that made the
        socket connection to our smtp port.

        mailfrom is the raw address the client claims the message is coming
        from.

        rcpttos is a list of raw addresses the client wishes to deliver the
        message to.

        data is a string containing the entire full text of the message,
        headers (if supplied) and all.  It has been `de-transparencied'
        according to RFC 821, Section 4.5.2.  In other words, a line
        containing a `.' followed by other text has had the leading dot
        removed.

        kwargs is a dictionary containing additional information.  It is
        empty if decode_data=True was given as init parameter, otherwise
        it will contain the following keys:
            'mail_options': list of parameters to the mail command.  All
                            elements are uppercase strings.  Example:
                            ['BODY=8BITMIME', 'SMTPUTF8'].
            'rcpt_options': same, for the rcpt command.

        This function should return None for a normal `250 Ok' response;
        otherwise, it should return the desired response string in RFC 821
        format.

        N)�NotImplementedError)rrBrOrPrkr~rrrrw�szSMTPServer.process_message)	rrrrr�r�r/r�rwrrrrrts
c@seZdZdd�Zdd�ZdS)rcCsrd}|j�}x`|D]X}|rP|rPd|d}t|t�sDt|jd��}t|�d}t|t�sbt|�}t|�qWdS)NrzX-Peer: rzutf-8)�
splitlines�
isinstancerjrG�encoder)rrBrkZ	inheaders�linesrxZ
peerheaderrrr�_print_message_content�s



z&DebuggingServer._print_message_contentcKsXtd�|r@|jd�r&td|d�|jd�r@td|d�|j||�td�dS)Nz%---------- MESSAGE FOLLOWS ----------rozmail options: %srpzrcpt options: %s
z%------------ END MESSAGE ------------)r�getr�)rrBrOrPrkr~rrrrw�s

zDebuggingServer.process_messageN)rrrr�rwrrrrr�scs,eZdZ�fdd�Zdd�Zdd�Z�ZS)rcs.d|kr|drtd��tt|�j||�dS)Nr4z$PureProxy does not support SMTPUTF8.)r%�superrr/)rrEr~)r�rrr/�szPureProxy.__init__c	Csh|jd�}d}x|D]}|sP|d7}qW|j|d|d�tj|�}|j|||�}td|td�dS)Nrrrz
X-Peer: %szwe got some refusals:)r)rv�insertr9rq�_deliverrrH)	rrBrOrPrkr�ryrx�refusedrrrrw�s


zPureProxy.process_messagecCs�ddl}i}yB|j�}|j|jd|jd�z|j|||�}Wd|j�XWn�|jk
r�}ztdtd�|j	}WYdd}~Xnjt
|jfk
r�}zHtd|jtd�t
|dd	�}t
|dd�}	x|D]}
||	f||
<q�WWYdd}~XnX|S)
Nrrzgot SMTPRecipientsRefused)rZgotZ	smtp_codeZ
smtp_error�ignore���)�smtplibZSMTPZconnectr�Zsendmail�quitZSMTPRecipientsRefusedrrHZ
recipientsrCZ
SMTPExceptionr�ru)rrOrPrkr�r��s�eZerrcode�errmsg�rrrrr��s$
"zPureProxy._deliver)rrrr/rwr��
__classcell__rr)r�rr�scs$eZdZ�fdd�Zdd�Z�ZS)r	cs.d|kr|drtd��tt|�j||�dS)Nr4z'MailmanProxy does not support SMTPUTF8.)r%r�rr/)rrEr~)r�rrr/
szMailmanProxy.__init__cCs:ddlm}ddlm}ddlm}ddlm}g}	x~|D]v}
|
j�jd�d}|jd�}t|�dkrhq:|d}
t|�dkr�|d	}nd
}|j	|
�s:|d!kr�q:|	j
|
|
|f�q:Wx|	D]\}
}
}|j|
�q�Wtddj
|�td�|�r|j|||�}td|td�i}||�}|j|�}|jd��s2||d<|jd��sPtjtj��|d<x�|	D]�\}
}
}td|
td�|j|
�}|�s�|j|
dd�}|||
<|d
k�r�|j|d	d�n�|dk�r�|j|d	d�nh|dk�r�|j|d	d�nN|d
k�r�|j|d	d�n4|d"k�rV|dk�rd|d<nd |d<|j|d	d��qVWdS)#Nr)�StringIO)�Utils)�Message)�MailList�@�-rWrr�admin�owner�requestrq�leavezforwarding recips:rn)rzwe got refusals:�fromZFromZdateZDatezsending message to)�lock)�tolist)Ztoadmin)Ztoowner)Z	torequestZ	subscribeZSubjectZunsubscribe)rr�r�r�rqr�)rqr�)�ior�ZMailmanr�r�r��lowerrvrhZlist_existsri�removerrqrHr�r�r�r�ZEnqueue)rrBrOrPrkr�r�r�r�Z	listnamesZrcptZlocal�partsZlistnamerzr�Zmlistsr�r
Zmlistrrrrwsd











zMailmanProxy.process_message)rrrr/rwr�rr)r�rr	sc@seZdZdZdZdZdZdS)�OptionsTrNF)rrr�setuid�	classname�
size_limitr4rrrrr�_sr�c
!Csty.tjtjdd�dddddddd	g�\}}Wn.tjk
r\}ztd|�WYdd}~XnXt�}x�|D]�\}}|d'kr�td�qj|d(kr�tt�tjd�qj|d)kr�d|_	qj|d*kr�||_
qj|d+kr�tjaqj|d,kr�d|_
qj|d-krjyt|�}||_Wqjtd|tjd�tjd�YqjXqjWt|�dk�r@d}d}nPt|�dk�r\|d}d}n4t|�d k�r||d}|d}ntdd!tj|��|jd"�}	|	dk�r�tdd#|�|d|	�|_yt||	dd��|_Wn$tk
�r�tdd$|�YnX|jd"�}	|	dk�r"tdd%|�|d|	�|_yt||	dd��|_Wn$tk
�rntdd&|�YnX|S).Nrz	nVhc:s:duzclass=Znosetuid�version�helpzsize=�debugr��-h�--helpr�-V�	--version�-n�
--nosetuidF�-c�--class�-d�--debug�-u�
--smtputf8T�-s�--sizezInvalid size: )rzlocalhost:8025zlocalhost:25rW�zInvalid arguments: %s�:zBad local spec: %szBad local port: %szBad remote spec: %szBad remote port: %s)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)�getoptr�argv�errorrr�rrJrr�r�rrHr4r�r�rh�
COMMASPACErqrr�	localhost�	localportr%�
remotehost�
remoteport)
ZoptsrEr��options�optr{Zint_sizeZ	localspecZ
remotespecryrrr�	parseargsfsp






r��__main__r)r)r4z7Cannot import module "pwd"; try running with -n option.)r�nobodyrWz3Cannot setuid "nobody"; try running with -n option.)r)@rr�osrFr�r�r@r�r-r��warningsrZemail._header_value_parserrr�__all__r�ZprogramrJr
rHr9r�r�rr.rr�rrrr	r�r�rr�r��rfindZlastdot�
__import__r�locals�modr�ruZclass_r�r�r�r�r�r4�proxyr��pwd�ImportErrorrrr�getpwnamr��PermissionErrorZloop�KeyboardInterruptrrrr�<module>-sx#

M-SB




macpath.cpython-36.opt-1.pyc000064400000013013150335715140011550 0ustar003


 \S� @s2dZdZdZdZdZdZdZdZdZddl	Z	ddl
TddlZddlTd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(g Zd)d*�Z
d+d	�Zd,d
�Zd-d�Zd.d
�Zd/d�Zejje_d0d�Zd1d�Zd2d�Zd3d4�Zd5d�Zd6d�Zd7d�Zd8d�ZGd9d:�d:e�Zd;d�Zd<d�Zd=d'�Z d>Z!dS)?z7Pathname and path-related operations for the Macintosh.�:z::�.�
NzDev:Null�)�*�normcase�isabs�join�
splitdrive�split�splitext�basename�dirname�commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�
expanduser�
expandvars�normpath�abspath�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenamescCst|t�rdSdSdS)N�:r)�
isinstance�bytes)�path�r*�/usr/lib64/python3.6/macpath.py�
_get_colons
r,cCs(t|ttf�s tdj|jj���|j�S)Nz2normcase() argument must be str or bytes, not '{}')r'r(�str�	TypeError�format�	__class__�__name__�lower)r)r*r*r+r#scCs t|�}||ko|dd�|kS)z�Return true if a path is absolute.
    On the Mac, relative paths begin with a colon,
    but as a special case, paths with no colons at all are also relative.
    Anything else is absolute (the string up to the first colon is the
    volume name).N�)r,)�s�colonr*r*r+r*sc
Gs�y�t|�}|}|s"|dd�|xl|D]d}|s:t|�r@|}q(|dd�|kr\|dd�}||krl||}|dd�|kr�||}||}q(W|Stttfk
r�tjd|f|���YnXdS)Nrr3r���)r,rr.�AttributeError�BytesWarning�genericpath�_check_arg_types)r4�pr5r)�tr*r*r+r5s(
cCs�t|�}||kr |dd�|fSd}x0tt|��D] }|||d�|kr2|d}q2W|d|d�||d�}}|r�||kr�||}||fS)z�Split a pathname into two parts: the directory leading up to the final
    bit, and the basename (the filename, without colons, in that directory).
    The result (s, t) is such that join(s, t) yields the original argument.Nrr3)r,�range�len)r4r5�col�ir)�filer*r*r+r
LscCs.t|t�rtj|dtd�Stj|ttt�SdS)Nr&�.)r'r(r9�	_splitextr!rr")r;r*r*r+r\s
cCs|dd�|fS)a@Split a pathname into a drive specification and the rest of the
    path.  Useful on DOS/Windows/NT; on the Mac, the drive is always
    empty (don't use the volume name -- it doesn't have the same
    syntactic and semantic oddities as DOS drive letters, such as there
    being a separate current directory per drive).Nrr*)r;r*r*r+r	cscCst|�dS)Nr)r
)r4r*r*r+r
oscCst|�dS)Nr3)r
)r4r*r*r+rpscCs*t|�sdSt|�}t|�dko(|dS)NF�r3)rr
r>)r4�
componentsr*r*r+�ismountrsrFc	Cs*yddl}|jj|d�dSdSdS)z6Return true if the pathname refers to a symbolic link.rNrDF)�Carbon.File�FileZResolveAliasFile)r4�Carbonr*r*r+rxs
cCs(ytj|�}Wntk
r"dSXdS)zCTest whether a path exists.  Returns True for broken symbolic linksFT)�os�lstat�OSError)r)�str*r*r+r�s
cCs|S)zEDummy to retain interface-compatibility with other operating systems.r*)r)r*r*r+r�scCs|S)zEDummy to retain interface-compatibility with other operating systems.r*)r)r*r*r+r�sc@seZdZdZdS)�
norm_errorzPath cannot be normalizedN)r1�
__module__�__qualname__�__doc__r*r*r*r+rN�srNcCs�t|�}||kr||S|j|�}d}x`|t|�dkr�||r|||dr||dkrr||d|d�=|d}q�td��q(|d}q(W|j|�}|dd�|kr�t|�dkr�||t|�kr�|dd�}|S)zLNormalize a pathname.  Will return the same result for
    equivalent paths.r3z+Cannot use :: immediately after volume nameNrDr6r6)r,r
r>rNr)r4r5�compsr@r*r*r+r�s 



,cCs6t|�s.t|t�rtj�}ntj�}t||�}t|�S)zReturn an absolute path.)rr'r(rJ�getcwdb�getcwdrr)r)�cwdr*r*r+r�s


cCs�t|�}yddl}Wntk
r(|SX|s2|St|�}|j|�}|d|}xR|dd�D]B}t||�}y|jj|d�dj�}Wq^|jj	k
r�Yq^Xq^W|S)Nrr3)
rrG�ImportErrorr,r
rrHZFSResolveAliasFileZas_pathname�Error)r)rIr5rE�cr*r*r+r$�s"


T)"rQrrr"rrr r!r#rJ�statr9�__all__r,rrrr
rrCr	r
rrFrrrr�	ExceptionrNrrr$r%r*r*r*r+�<module>sL


	nntplib.cpython-36.pyc000064400000101766150335715140010657 0ustar003


 \F��@s�dZddlZddlZddlZddlZddlZyddlZWnek
rPdZYnXdZddl	m
ZddlmZddd	d
ddd
dgZ
dZGdd�de�ZGdd	�d	e�ZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd
�d
e�ZdZdZddddddddd d!d"d#hZd$d%d&d'd(d)d*gZd)d*d+�Zd,Zejd-d.d/d0d1g�Zejd2d3d4d5g�Zd6d�Z
d7d8�Zdld9d:�Z dmd;d<�Z!dnd=d>�Z"e�r�d?d@�Z#GdAdB�dB�Z$GdCd�de$�Z%e�r�GdDdE�dEe$�Z&e
j'dE�e(dFk�r�ddl)Z)e)j*dGdH�Z+e+j,dIdJdKdLdM�e+j,dNdOdPdQdM�e+j,dRdSdoe-dUeefdV�e+j,dWdXdYe-dZdV�e+j,d[d\d]dd^d_�e+j.�Z/e/j0Z0e/j�s�e0dpk�rteZ0e%e/j1e0d`�Z2ne0dqk�r�eZ0e&e/j1e0d`�Z2e2j3�Z4dae4k�r�e2j5�e2j6e/j6�\Z7Z8Z9Z:Z;e<dbe;dce8dde9dee:�dfdg�Z=e>e-e:�e/j?dT�Z9e2j@e9e:�\Z7ZAxbeAD]Z\ZBZCe
eCd%�jDdhdT�dZEe
eCd$�ZFe-eCd*�ZGe<dijHeBe=eEdj�e=eFdk�eG���qWe2jI�dS)ra�An NNTP client class based on:
- RFC 977: Network News Transfer Protocol
- RFC 2980: Common NNTP Extensions
- RFC 3977: Network News Transfer Protocol (version 2)

Example:

>>> from nntplib import NNTP
>>> s = NNTP('news')
>>> resp, count, first, last, name = s.group('comp.lang.python')
>>> print('Group', name, 'has', count, 'articles, range', first, 'to', last)
Group comp.lang.python has 51 articles, range 5770 to 5821
>>> resp, subs = s.xhdr('subject', '{0}-{1}'.format(first, last))
>>> resp = s.quit()
>>>

Here 'resp' is the server response line.
Error responses are turned into exceptions.

To post an article from a file:
>>> f = open(filename, 'rb') # file containing article, including header
>>> resp = s.post(f)
>>>

For descriptions of all methods, read the comments in the code below.
Note that all arguments and return values representing article numbers
are strings, not numbers, since they are rarely used for calculations.
�NFT)�
decode_header)�_GLOBAL_DEFAULT_TIMEOUT�NNTP�	NNTPError�NNTPReplyError�NNTPTemporaryError�NNTPPermanentError�NNTPProtocolError�
NNTPDataErrorric@seZdZdZdd�ZdS)rz%Base class for all nntplib exceptionscGs>tj|f|��y|d|_Wntk
r8d|_YnXdS)NrzNo response given)�	Exception�__init__�response�
IndexError)�self�args�r�/usr/lib64/python3.6/nntplib.pyrbs
zNNTPError.__init__N)�__name__�
__module__�__qualname__�__doc__rrrrrr`sc@seZdZdZdS)rzUnexpected [123]xx replyN)rrrrrrrrrisc@seZdZdZdS)rz
4xx errorsN)rrrrrrrrrmsc@seZdZdZdS)rz
5xx errorsN)rrrrrrrrrqsc@seZdZdZdS)r	z"Response does not begin with [1-5]N)rrrrrrrrr	usc@seZdZdZdS)r
zError in response dataN)rrrrrrrrr
ys�wi3Z100Z101�211�215Z220Z221Z222Z224Z225Z230Z231Z282�subject�from�datez
message-idZ
referencesz:bytesz:lines)�bytes�liness
�	GroupInfo�group�last�first�flag�ArticleInfoZnumber�
message_idrcCsNg}x>t|�D]2\}}t|t�r6|j|j|p.d��q|j|�qWdj|�S)zvTakes a unicode string representing a munged header value
    and decodes it as a (possibly non-ASCII) readable value.�ascii�)�_email_decode_header�
isinstancer�append�decode�join)Z
header_str�parts�v�encrrrr�s
cCs�g}xh|D]`}|ddkr<|dd�jd�\}}}d|}n|jd�\}}}|j�}tj||�}|j|�q
Wt}t|�t|�kr�td��|dt|��|kr�td��|S)z�Parse a list of string representing the response to LIST OVERVIEW.FMT
    and return a list of header/metadata names.
    Raises NNTPDataError if the response is not compliant
    (cf. RFC 3977, section 8.4).r�:�Nz$LIST OVERVIEW.FMT response too shortz*LIST OVERVIEW.FMT redefines default fields)�	partition�lower�_OVERVIEW_FMT_ALTERNATIVES�getr*�_DEFAULT_OVERVIEW_FMT�lenr
)r�fmt�line�name�_�suffixZdefaultsrrr�_parse_overview_fmt�s

r=cCs�tt�}g}x�|D]�}i}|jd�^}}t|�}x�t|�D]�\}	}
|	t|�krPq:||	}|jd�}|	|kr�|r�|d}
|
r�|
dt|
��j�|
kr�td��|
r�|
t|
�d�nd}
|
|||	<q:W|j||f�qW|S)zZParse the response to an OVER or XOVER command according to the
    overview format `fmt`.�	r0z: Nz?OVER/XOVER response doesn't include names of additional headers)	r7r6�split�int�	enumerate�
startswithr3r
r*)rr8Zdata_process_funcZ
n_defaultsZoverviewr9ZfieldsZarticle_number�tokens�i�tokenZ
field_nameZis_metadata�hrrr�_parse_overview�s&

rGcCs�|dkr |d	d�}|dd
�}t|dd��}t|dd��}t|dd��}t|dd��}t|dd
��}t|dd��}|dkr�|d7}n|dkr�|d7}tj||||||�S)z�Parse a pair of (date, time) strings, and return a datetime object.
    If only the date is given, it is assumed to be date and time
    concatenated together (e.g. response to the DATE command).
    N����Fi��dili����i�������rM���rN)r@�datetime)�date_str�time_strZhoursZminutesZseconds�yearZmonthZdayrrr�_parse_datetime�s
rScCsPt|tj�sd}n
dj|�}|j}|r<|d}dj||�}ndj||�}||fS)aPFormat a date or datetime object as a pair of (date, time) strings
    in the format required by the NEWNEWS and NEWGROUPS commands.  If a
    date object is passed, the time is assumed to be midnight (00h00).

    The returned representation depends on the legacy flag:
    * if legacy is False (the default):
      date has the YYYYMMDD format and time the HHMMSS format
    * if legacy is True:
      date has the YYMMDD format and time the HHMMSS format.
    RFC 3977 compliant servers should understand both formats; therefore,
    legacy is only needed when talking to old servers.
    Z000000z({0.hour:02d}{0.minute:02d}{0.second:02d}rLz{0:02d}{1.month:02d}{1.day:02d}z{0:04d}{1.month:02d}{1.day:02d})r)rO�formatrR)ZdtZlegacyrQ�yrPrrr�_unparse_datetime�s

rVcCs|dkrtj�}|j||d�S)z�Wrap a socket in SSL/TLS. Arguments:
        - sock: Socket to wrap
        - context: SSL context to use for the encrypted connection
        Returns:
        - sock: New, encrypted socket.
        N)Zserver_hostname)�sslZ_create_stdlib_contextZwrap_socket)�sock�contextZhostnamerrr�_encrypt_onsrZc@seZdZdZdZdefdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZeZdd�Z
dd�Zdhdd�Zdd�Zdidd�Zdd�Zdjdd�Zdkdd �Zd!d"�Zd#d$�Zd%d&�Zdd'�d(d)�Zdd'�d*d+�Zdldd'�d,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zdd'�d6d7�Zd8d9�Z d:d;�Z!dmd<d=�Z"d>d?�Z#d@dA�Z$dndBdC�Z%dodd'�dDdE�Z&dpdd'�dFdG�Z'dqdd'�dHdI�Z(dJdK�Z)dd'�dLdM�Z*dd'�dNdO�Z+dd'�dPdQ�Z,dd'�dRdS�Z-dTdU�Z.dVdW�Z/dXdY�Z0dZd[�Z1d\d]�Z2d^d_�Z3d`da�Z4drdbdc�Z5ddde�Z6e7�rdsdfdg�Z8dS)t�	_NNTPBasezutf-8�surrogateescapeNcCsj||_||_d|_|j�|_d|_|j�d|_|rZd|jkrZ|j�|jsZd|_|j�d|_	d|_
dS)aSInitialize an instance.  Arguments:
        - file: file-like object (open for read/write in binary mode)
        - host: hostname of the server
        - readermode: if true, send 'mode reader' command after
                      connecting.
        - timeout: timeout (in seconds) used for socket connections

        readermode is sometimes necessary if you are connecting to an
        NNTP server on the local machine and intend to call
        reader-specific commands, such as `group'.  If you get
        unexpected NNTPPermanentErrors, you might need to set
        readermode.
        rNF�READER)�host�file�	debugging�_getresp�welcome�_caps�getcapabilities�readermode_afterauth�_setreadermode�tls_on�
authenticated)rr_r^�
readermode�timeoutrrrr8s
	z_NNTPBase.__init__cCs|S)Nr)rrrr�	__enter__gsz_NNTPBase.__enter__csR�fdd�}|�rNz*y�j�Wnttfk
r8YnXWd|�rL�j�XdS)Ncs
t�d�S)Nr_)�hasattrr)rrr�<lambda>ksz$_NNTPBase.__exit__.<locals>.<lambda>)�quit�OSError�EOFError�_close)rrZis_connectedr)rr�__exit__js
z_NNTPBase.__exit__cCs|jrtdt|j��|jS)z�Get the welcome message from the server
        (this is read and squirreled away by __init__()).
        If the response code is 200, posting is allowed;
        if it 201, posting is not allowed.z	*welcome*)r`�print�reprrb)rrrr�
getwelcomeusz_NNTPBase.getwelcomec
Cs�|jdkr�d|_d|_y|j�\}}Wnttfk
rDi|_Yn<X||_d|krhttt|d��|_d|kr�dj	|d�|_|jS)z�Get the server capabilities, as read by __init__().
        If the CAPABILITIES command is not supported, an empty dict is
        returned.Nr1�VERSIONZIMPLEMENTATION� )
rc�nntp_versionZnntp_implementation�capabilitiesrr�max�mapr@r,)r�resp�capsrrrrd~s
z_NNTPBase.getcapabilitiescCs
||_dS)z�Set the debugging level.  Argument 'level' means:
        0: no debugging output (default)
        1: print commands and responses but not body text etc.
        2: also print raw lines read and sent before stripping CR/LFN)r`)r�levelrrr�set_debuglevel�sz_NNTPBase.set_debuglevelcCs:|t}|jdkr tdt|��|jj|�|jj�dS)zfInternal: send one line to the server, appending CRLF.
        The `line` must be a bytes-like object.r1z*put*N)�_CRLFr`rsrtr_�write�flush)rr9rrr�_putline�s

z_NNTPBase._putlinecCs2|jrtdt|��|j|j|j�}|j|�dS)zkInternal: send one command to the server (through _putline()).
        The `line` must be a unicode string.z*cmd*N)r`rsrt�encode�encoding�errorsr�)rr9rrr�_putcmd�sz_NNTPBase._putcmdTcCs�|jjtd�}t|�tkr$td��|jdkr<tdt|��|sDt�|r�|dd�t	krf|dd�}n|dd�t	kr�|dd	�}|S)
z�Internal: return one line from the server, stripping _CRLF.
        Raise EOFError if the connection is closed.
        Returns a bytes object.r1z
line too longz*get*rINrNrN���r�)
r_�readline�_MAXLINEr7r
r`rsrtrpr�)rZ
strip_crlfr9rrr�_getline�s
z_NNTPBase._getlinecCsl|j�}|jrtdt|��|j|j|j�}|dd�}|dkrHt|��|dkrXt|��|dkrht	|��|S)z�Internal: get a response from the server.
        Raise various errors if the response indicates an error.
        Returns a unicode string.z*resp*Nr1�4�5Z123)
r�r`rsrtr+r�r�rrr	)rr|�crrrra�sz_NNTPBase._getrespc
Cs�d}z�t|ttf�r"t|d�}}|j�}|dd�tkrBt|��g}|dk	r�dtdf}xv|jd�}||krpP|j	d�r�|dd�}|j
|�q\Wn<d}x6|j�}||kr�P|j	d�r�|dd�}|j|�q�WWd|r�|j�X||fS)	aPInternal: get a response plus following text from the server.
        Raise various errors if the response indicates an error.

        Returns a (response, lines) tuple where `response` is a unicode
        string and `lines` is a list of bytes objects.
        If `file` is a file-like object, it must be open in binary mode.
        N�wb��.s.
Fs..r1)
r)�strr�openra�	_LONGRESPrr�r�rBr�r*�close)rr_Z
openedFiler|rZterminatorsr9�
terminatorrrr�_getlongresp�s8	



z_NNTPBase._getlongrespcCs|j|�|j�S)zWInternal: send a command and get the response.
        Same return value as _getresp().)r�ra)rr9rrr�	_shortcmd�s
z_NNTPBase._shortcmdcCs|j|�|j|�S)zoInternal: send a command and get the response plus following text.
        Same return value as _getlongresp().)r�r�)rr9r_rrr�_longcmds
z_NNTPBase._longcmdcs.�j|��j|�\}}|�fdd�|D�fS)z�Internal: send a command and get the response plus following text.
        Same as _longcmd() and _getlongresp(), except that the returned `lines`
        are unicode strings rather than bytes objects.
        csg|]}|j�j�j��qSr)r+r�r�)�.0r9)rrr�
<listcomp>sz,_NNTPBase._longcmdstring.<locals>.<listcomp>)r�r�)rr9r_r|�listr)rr�_longcmdstrings
z_NNTPBase._longcmdstringcCsby|jStk
rYnXy|jd�\}}Wn tk
rNtdd�}Yn
Xt|�}||_|S)zqInternal: get the overview format. Queries the server if not
        already done, else returns the cached value.zLIST OVERVIEW.FMTN)Z_cachedoverviewfmt�AttributeErrorr�rr6r=)rr|rr8rrr�_getoverviewfmtsz_NNTPBase._getoverviewfmtcCsdd�|D�S)NcSsg|]}t|j���qSr)rr?)r�r9rrrr�$sz(_NNTPBase._grouplist.<locals>.<listcomp>r)rrrrr�
_grouplist"sz_NNTPBase._grouplistcCs<i}|jd�\}}x |D]}|j�^}}|||<qW||fS)a!Process a CAPABILITIES command.  Not supported by all servers.
        Return:
        - resp: server response if successful
        - caps: a dictionary mapping capability names to lists of tokens
        (for example {'VERSION': ['2'], 'OVER': [], LIST: ['ACTIVE', 'HEADERS'] })
        ZCAPABILITIES)r�r?)rr}r|rr9r:rCrrrry&s
z_NNTPBase.capabilities)r_cCsbt|tjtjf�s$tdj|jj���t||jdk�\}}dj||�}|j	||�\}}||j
|�fS)z�Process a NEWGROUPS command.  Arguments:
        - date: a date or datetime object
        Return:
        - resp: server response if successful
        - list: list of newsgroup names
        zAthe date parameter must be a date or datetime object, not '{:40}'rIzNEWGROUPS {0} {1})r)rOr�	TypeErrorrT�	__class__rrVrxr�r�)rrr_rPrQ�cmdr|rrrr�	newgroups4sz_NNTPBase.newgroupscCsRt|tjtjf�s$tdj|jj���t||jdk�\}}dj|||�}|j	||�S)z�Process a NEWNEWS command.  Arguments:
        - group: group name or '*'
        - date: a date or datetime object
        Return:
        - resp: server response if successful
        - list: list of message ids
        zAthe date parameter must be a date or datetime object, not '{:40}'rIzNEWNEWS {0} {1} {2})
r)rOrr�rTr�rrVrxr�)rr rr_rPrQr�rrr�newnewsDsz_NNTPBase.newnewscCs4|dk	rd|}nd}|j||�\}}||j|�fS)a@Process a LIST or LIST ACTIVE command. Arguments:
        - group_pattern: a pattern indicating which groups to query
        - file: Filename string or file object to store the result in
        Returns:
        - resp: server response if successful
        - list: list of (group, last, first, flag) (strings)
        NzLIST ACTIVE ZLIST)r�r�)r�
group_patternr_�commandr|rrrrr�Ts

z_NNTPBase.listcCs�tjd�}|jd|�\}}|jd�s8|jd|�\}}i}x>|D]6}|j|j��}|rB|jdd�\}	}
|sp|
S|
||	<qBW|r�||fSdSdS)Nz^(?P<group>[^ 	]+)[ 	]+(.*)$zLIST NEWSGROUPS rzXGTITLE r1rIr')�re�compiler�rB�search�stripr )rr�Z
return_all�line_patr|r�groups�raw_line�matchr:Zdescrrr�_getdescriptionscs


z_NNTPBase._getdescriptionscCs|j|d�S)a�Get a description for a single group.  If more than one
        group matches ('group' is a pattern), return the first.  If no
        group matches, return an empty string.

        This elides the response code from the server, since it can
        only be '215' or '285' (for xgtitle) anyway.  If the response
        code is needed, use the 'descriptions' method.

        NOTE: This neither checks for a wildcard in 'group' nor does
        it check whether the group actually exists.F)r�)rr rrr�descriptionzsz_NNTPBase.descriptioncCs|j|d�S)z'Get descriptions for a range of groups.T)r�)rr�rrr�descriptions�sz_NNTPBase.descriptionscCs�|jd|�}|jd�s t|��|j�}d}}}t|�}|dkr�|d}|dkr�|d}|dkr�|d}|dkr�|dj�}|t|�t|�t|�|fS)aProcess a GROUP command.  Argument:
        - group: the group name
        Returns:
        - resp: server response if successful
        - count: number of articles
        - first: first article number
        - last: last article number
        - name: the group name
        zGROUP rrr1rIr�rJ)r�rBrr?r7r3r@)rr:r|�words�countr"r!�nrrrr �s

z_NNTPBase.groupcCs|jd|�S)aProcess a HELP command. Argument:
        - file: Filename string or file object to store the result in
        Returns:
        - resp: server response if successful
        - list: list of strings returned by the server in response to the
                HELP command
        ZHELP)r�)rr_rrr�help�sz_NNTPBase.helpcCs8|jd�st|��|j�}t|d�}|d}|||fS)z_Internal: parse the response line of a STAT, NEXT, LAST,
        ARTICLE, HEAD or BODY command.Z22r1rI)rBrr?r@)rr|r��art_numr%rrr�
_statparse�s
z_NNTPBase._statparsecCs|j|�}|j|�S)z/Internal: process a STAT, NEXT or LAST command.)r�r�)rr9r|rrr�_statcmd�s
z_NNTPBase._statcmdcCs"|r|jdj|��S|jd�SdS)a(Process a STAT command.  Argument:
        - message_spec: article number or message id (if not specified,
          the current article is selected)
        Returns:
        - resp: server response if successful
        - art_num: the article number
        - message_id: the message id
        zSTAT {0}ZSTATN)r�rT)r�message_specrrr�stat�s	z_NNTPBase.statcCs
|jd�S)z;Process a NEXT command.  No arguments.  Return as for STAT.ZNEXT)r�)rrrr�next�sz_NNTPBase.nextcCs
|jd�S)z;Process a LAST command.  No arguments.  Return as for STAT.ZLAST)r�)rrrrr!�sz_NNTPBase.lastcCs0|j||�\}}|j|�\}}}|t|||�fS)z2Internal: process a HEAD, BODY or ARTICLE command.)r�r�r$)rr9r_r|rr�r%rrr�_artcmd�sz_NNTPBase._artcmdcCs$|dk	rdj|�}nd}|j||�S)a0Process a HEAD command.  Argument:
        - message_spec: article number or message id
        - file: filename string or file object to store the headers in
        Returns:
        - resp: server response if successful
        - ArticleInfo: (article number, message id, list of header lines)
        NzHEAD {0}ZHEAD)rTr�)rr�r_r�rrr�head�sz_NNTPBase.headcCs$|dk	rdj|�}nd}|j||�S)a+Process a BODY command.  Argument:
        - message_spec: article number or message id
        - file: filename string or file object to store the body in
        Returns:
        - resp: server response if successful
        - ArticleInfo: (article number, message id, list of body lines)
        NzBODY {0}ZBODY)rTr�)rr�r_r�rrr�body�sz_NNTPBase.bodycCs$|dk	rdj|�}nd}|j||�S)a5Process an ARTICLE command.  Argument:
        - message_spec: article number or message id
        - file: filename string or file object to store the article in
        Returns:
        - resp: server response if successful
        - ArticleInfo: (article number, message id, list of article lines)
        NzARTICLE {0}ZARTICLE)rTr�)rr�r_r�rrr�article�sz_NNTPBase.articlecCs
|jd�S)zYProcess a SLAVE command.  Returns:
        - resp: server response if successful
        ZSLAVE)r�)rrrr�slavesz_NNTPBase.slavecsDtjd��|jdj||�|�\}}�fdd��|�fdd�|D�fS)aiProcess an XHDR command (optional server extension).  Arguments:
        - hdr: the header type (e.g. 'subject')
        - str: an article nr, a message id, or a range nr1-nr2
        - file: Filename string or file object to store the result in
        Returns:
        - resp: server response if successful
        - list: list of (nr, value) strings
        z^([0-9]+) ?(.*)
?zXHDR {0} {1}cs�j|�}|r|jdd�S|S)Nr1rI)r�r )r9�m)�patrr�
remove_numbers
z%_NNTPBase.xhdr.<locals>.remove_numbercsg|]}�|��qSrr)r�r9)r�rrr�sz"_NNTPBase.xhdr.<locals>.<listcomp>)r�r�r�rT)rZhdrr�r_r|rr)r�r�r�xhdr
s	
z_NNTPBase.xhdrcCs.|jdj||�|�\}}|j�}|t||�fS)aFProcess an XOVER command (optional server extension) Arguments:
        - start: start of range
        - end: end of range
        - file: Filename string or file object to store the result in
        Returns:
        - resp: server response if successful
        - list: list of dicts containing the response fields
        z
XOVER {0}-{1})r�rTr�rG)r�start�endr_r|rr8rrr�xovers	
z_NNTPBase.xoverc	Csxd|jkrdnd}t|ttf�r>|\}}|dj||p6d�7}n|dk	rR|d|}|j||�\}}|j�}|t||�fS)a�Process an OVER command.  If the command isn't supported, fall
        back to XOVER. Arguments:
        - message_spec:
            - either a message id, indicating the article to fetch
              information about
            - or a (start, end) tuple, indicating a range of article numbers;
              if end is None, information up to the newest message will be
              retrieved
            - or None, indicating the current article number must be used
        - file: Filename string or file object to store the result in
        Returns:
        - resp: server response if successful
        - list: list of dicts containing the response fields

        NOTE: the "message id" form isn't supported by XOVER
        ZOVERZXOVERz {0}-{1}r'Nrw)rcr)�tupler�rTr�r�rG)	rr�r_r�r�r�r|rr8rrr�over(sz_NNTPBase.overc	Csjtjdtd�tjd�}|jd||�\}}g}x0|D](}|j|j��}|r6|j|j	dd��q6W||fS)z�Process an XGTITLE command (optional server extension) Arguments:
        - group: group name wildcard (i.e. news.*)
        Returns:
        - resp: server response if successful
        - list: list of (name,title) stringszFThe XGTITLE extension is not actively used, use descriptions() insteadrIz^([^ 	]+)[ 	]+(.*)$zXGTITLE r1)
�warnings�warn�DeprecationWarningr�r�r�r�r�r*r )	rr r_r�r|Z	raw_linesrr�r�rrr�xgtitleCs

z_NNTPBase.xgtitlecCsjtjdtd�|jdj|��}|jd�s0t|��y|j�\}}Wntk
r\t|��Yn
X||fSdS)z�Process an XPATH command (optional server extension) Arguments:
        - id: Message id of article
        Returns:
        resp: server response if successful
        path: directory path to article
        z(The XPATH extension is not actively usedrIz	XPATH {0}Z223N)	r�r�r�r�rTrBrr?�
ValueError)r�idr|Zresp_num�pathrrr�xpathUs
z_NNTPBase.xpathcCsb|jd�}|jd�st|��|j�}t|�dkr8t|��|d}t|�dkrTt|��|t|d�fS)z�Process the DATE command.
        Returns:
        - resp: server response if successful
        - date: datetime object
        ZDATEZ111rIr1�N)r�rBrr?r7r
rS)rr|�elemrrrrris

z_NNTPBase.datecCs�|j|�}|jd�st|��t|ttf�r2|j�}xB|D]:}|jt�sT|j	d�t}|jd�rfd|}|j
j|�q8W|j
jd�|j
j�|j
�S)N�3s
r�s.
)r�rBrr)r�	bytearray�
splitlines�endswithr��rstripr_r�r�ra)rr��fr|r9rrr�_postzs





z_NNTPBase._postcCs|jd|�S)z�Process a POST command.  Arguments:
        - data: bytes object, iterable or file containing the article
        Returns:
        - resp: server response if successfulZPOST)r�)r�datarrr�post�sz_NNTPBase.postcCs|jdj|�|�S)aProcess an IHAVE command.  Arguments:
        - message_id: message-id of the article
        - data: file containing the article
        Returns:
        - resp: server response if successful
        Note that if the server refuses the article an exception is raised.z	IHAVE {0})r�rT)rr%r�rrr�ihave�sz_NNTPBase.ihavecCs|jj�|`dS)N)r_r�)rrrrrq�s
z_NNTPBase._closec
Csz|jd�}Wd|j�X|S)zdProcess a QUIT command and close the socket.  Returns:
        - resp: server response if successfulZQUITN)r�rq)rr|rrrrn�s
z_NNTPBase.quitcCs�|jrtd��|r"|r"td��y>|r^|r^ddl}|j�}|j|j�}|r^|d}|d}Wntk
rtYnX|s~dS|jd|�}|jd�r�|s�t|��n |jd|�}|jd�s�t	|��d|_
|j�|jr�d	|j
kr�|j
�d|_
|j�dS)
NzAlready logged in.z7At least one of `user` and `usenetrc` must be specifiedrrIzauthinfo user Z381zauthinfo pass Z281r])rhr��netrcZauthenticatorsr^ror�rBrrrcrdrerf)r�user�password�usenetrcr�ZcredentialsZauthr|rrr�login�s<



z_NNTPBase.logincCs`y|jd�|_WnJtk
r$Yn8tk
rZ}z|jjd�rHd|_n�WYdd}~XnXdS)Nzmode readerZ480T)r�rbrrr
rBre)r�errrrf�sz_NNTPBase._setreadermodecCs||jrtd��|jrtd��|jd�}|jd�rp|jj�t|j||j	�|_|jj
d�|_d|_d|_|j�nt
d��dS)	zzProcess a STARTTLS command. Arguments:
            - context: SSL context to use for the encrypted connection
            zTLS is already enabled.z+TLS cannot be started after authentication.�STARTTLSZ382�rwbTNzTLS failed to start.)rgr�rhr�rBr_r�rZrXr^�makefilercrdr)rrYr|rrr�starttls�s



z_NNTPBase.starttls)T)N)N)N)N)N)N)N)N)N)NNT)N)9rrrr�r�rrrkrrrurdr�debugr�r�r�rar�r�r�r�r�r�ryr�r�r�r�r�r�r r�r�r�r�r�r!r�r�r�r�r�r�r�r�r�r�rr�r�r�rqrnr�rf�	_have_sslr�rrrrr[(sj
.	

.







		
)
r[c@s*eZdZeddddefdd�Zdd�ZdS)rNFc	Cs�||_||_tj||f|�|_d}y8|jjd�}tj|||||�|sJ|rX|j|||�Wn$|rn|j	�|jj	��YnXdS)a,Initialize an instance.  Arguments:
        - host: hostname to connect to
        - port: port to connect to (default the standard NNTP port)
        - user: username to authenticate with
        - password: password to use with username
        - readermode: if true, send 'mode reader' command after
                      connecting.
        - usenetrc: allow loading username and password from ~/.netrc file
                    if not specified explicitly
        - timeout: timeout (in seconds) used for socket connections

        readermode is sometimes necessary if you are connecting to an
        NNTP server on the local machine and intend to call
        reader-specific commands, such as `group'.  If you get
        unexpected NNTPPermanentErrors, you might need to set
        readermode.
        Nr�)
r^�port�socket�create_connectionrXr�r[rr�r�)	rr^r�r�r�rir�rjr_rrrr�s

z
NNTP.__init__c
Cs ztj|�Wd|jj�XdS)N)r[rqrXr�)rrrrrq!szNNTP._close)rrr�	NNTP_PORTrrrqrrrrr�s"c@s,eZdZedddddefdd�Zdd�ZdS)�NNTP_SSLNFc	

Cs�tj||f|�|_d}	yJt|j||�|_|jjd�}	tj||	|||d�|sP|r^|j|||�Wn$|	rt|	j�|jj��YnXdS)z�This works identically to NNTP.__init__, except for the change
            in default port and the `ssl_context` argument for SSL connections.
            Nr�)rirj)	r�r�rXrZr�r[rr�r�)
rr^r�r�r�Zssl_contextrir�rjr_rrrr+s


zNNTP_SSL.__init__c
Cs ztj|�Wd|jj�XdS)N)r[rqrXr�)rrrrrqAszNNTP_SSL._close)rrr�
NNTP_SSL_PORTrrrqrrrrr�)s
r��__main__zJ        nntplib built-in demo - display the latest articles in a newsgroup)r�z-gz--groupzgmane.comp.python.generalz3group to fetch messages from (default: %(default)s))�defaultr�z-sz--serverznews.gmane.orgz+NNTP server hostname (default: %(default)s)z-pz--portr1z#NNTP port number (default: %s / %s))r��typer�z-nz
--nb-articles�
z2number of articles to fetch (default: %(default)s)z-Sz--ssl�
store_truezuse NNTP over SSL)�actionr�r�)r^r�r�ZGroupZhaszarticles, rangeZtocCs$t|�|kr |d|d�d}|S)NrJz...)r7)�sZlimrrr�cutlsr��<z{:7} {:20} {:42} ({})��*)N)N)Fr�r�r�)Jrr�r��collectionsrOr�rW�ImportErrorr�Zemail.headerrr(r�__all__r�rrrrrr	r
r�r�r�r6r4r��
namedtuplerr$r=rGrSrVrZr[rr�r*r�argparse�ArgumentParser�parser�add_argumentr@�
parse_argsrr�Zserverr�rdr}r�r r|r�r"r!r:rsr�r�Znb_articlesr�Z	overviewsZartnumr�r?ZauthorrrrTrnrrrr�<module>s�&
	


X-






 pty.cpython-36.opt-2.pyc000064400000005702150335715140010756 0ustar003


 \��@s�ddlmZddlZddlZdddgZdZdZdZdZdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zeefdd�Zeefdd�ZdS)�)�selectN�openpty�fork�spawn��cCs<ytj�Sttfk
r YnXt�\}}t|�}||fS)N)�osr�AttributeError�OSError�_open_terminal�
slave_open)�	master_fd�
slave_name�slave_fd�r�/usr/lib64/python3.6/pty.pyrs
cCsLytj�\}}Wnttfk
r(YnXtj|�}tj|�||fSt�S)N)rrr	r
�ttyname�closer)r
rrrrr�master_open!s

rc
Cslx^dD]V}xPdD]H}d||}ytj|tj�}Wntk
rHwYnX|d||fSWqWtd��dS)NZpqrstuvwxyzPQRSTZ0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devices)r�open�O_RDWRr
)�x�yZpty_name�fdrrrr1s

rcCsntj|tj�}yddlm}m}Wntk
r6|SXy|||d�|||d�Wntk
rhYnX|S)Nr)�ioctl�I_PUSHZptemZldterm)rrrZfcntlrr�ImportErrorr
)Ztty_name�resultrrrrrr=srcCs�ytj�\}}Wnttfk
r(Yn4X|tkrTytj�Wntk
rRYnX||fSt�\}}tj�}|tkr�tj�tj|�tj	|t
�tj	|t�tj	|t�|tkr�tj|�tj
tjt�tj�}tj|�n
tj|�||fS)N)r�forkptyr	r
�CHILD�setsidrrr�dup2�STDIN_FILENO�
STDOUT_FILENO�
STDERR_FILENOrrr)�pidrr
rZtmp_fdrrrrOs0



cCs&x |r tj||�}||d�}qWdS)N)r�write)r�data�nrrr�_writenwsr)cCstj|d�S)Ni)r�read)rrrr�_read}sr+cCsz|tg}xlt|gg�\}}}||krH||�}|s<|j|�ntjt|�t|kr
|t�}|sh|jt�q
t||�q
WdS)N)r"r�removerr&r#r))r
�master_read�
stdin_readZfdsZrfdsZwfdsZxfdsr'rrr�_copy�sr/cCs�t|�td�kr|f}t�\}}|tkr<tj|df|��ytjt�}tjt�d}Wntj	k
rrd}YnXyt
|||�Wn(tk
r�|r�tjttj
|�YnXtj|�tj|d�dS)N�rr)�typerrr�execlp�ttyZ	tcgetattrr"Zsetraw�errorr/r
Z	tcsetattrZ	TCSAFLUSHr�waitpid)�argvr-r.r%r
�modeZrestorerrrr�s$




)rrr3�__all__r"r#r$rrrrrrr)r+r/rrrrr�<module>	s 
(nntplib.cpython-36.opt-1.pyc000064400000101766150335715140011616 0ustar003


 \F��@s�dZddlZddlZddlZddlZddlZyddlZWnek
rPdZYnXdZddl	m
ZddlmZddd	d
ddd
dgZ
dZGdd�de�ZGdd	�d	e�ZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd
�d
e�ZdZdZddddddddd d!d"d#hZd$d%d&d'd(d)d*gZd)d*d+�Zd,Zejd-d.d/d0d1g�Zejd2d3d4d5g�Zd6d�Z
d7d8�Zdld9d:�Z dmd;d<�Z!dnd=d>�Z"e�r�d?d@�Z#GdAdB�dB�Z$GdCd�de$�Z%e�r�GdDdE�dEe$�Z&e
j'dE�e(dFk�r�ddl)Z)e)j*dGdH�Z+e+j,dIdJdKdLdM�e+j,dNdOdPdQdM�e+j,dRdSdoe-dUeefdV�e+j,dWdXdYe-dZdV�e+j,d[d\d]dd^d_�e+j.�Z/e/j0Z0e/j�s�e0dpk�rteZ0e%e/j1e0d`�Z2ne0dqk�r�eZ0e&e/j1e0d`�Z2e2j3�Z4dae4k�r�e2j5�e2j6e/j6�\Z7Z8Z9Z:Z;e<dbe;dce8dde9dee:�dfdg�Z=e>e-e:�e/j?dT�Z9e2j@e9e:�\Z7ZAxbeAD]Z\ZBZCe
eCd%�jDdhdT�dZEe
eCd$�ZFe-eCd*�ZGe<dijHeBe=eEdj�e=eFdk�eG���qWe2jI�dS)ra�An NNTP client class based on:
- RFC 977: Network News Transfer Protocol
- RFC 2980: Common NNTP Extensions
- RFC 3977: Network News Transfer Protocol (version 2)

Example:

>>> from nntplib import NNTP
>>> s = NNTP('news')
>>> resp, count, first, last, name = s.group('comp.lang.python')
>>> print('Group', name, 'has', count, 'articles, range', first, 'to', last)
Group comp.lang.python has 51 articles, range 5770 to 5821
>>> resp, subs = s.xhdr('subject', '{0}-{1}'.format(first, last))
>>> resp = s.quit()
>>>

Here 'resp' is the server response line.
Error responses are turned into exceptions.

To post an article from a file:
>>> f = open(filename, 'rb') # file containing article, including header
>>> resp = s.post(f)
>>>

For descriptions of all methods, read the comments in the code below.
Note that all arguments and return values representing article numbers
are strings, not numbers, since they are rarely used for calculations.
�NFT)�
decode_header)�_GLOBAL_DEFAULT_TIMEOUT�NNTP�	NNTPError�NNTPReplyError�NNTPTemporaryError�NNTPPermanentError�NNTPProtocolError�
NNTPDataErrorric@seZdZdZdd�ZdS)rz%Base class for all nntplib exceptionscGs>tj|f|��y|d|_Wntk
r8d|_YnXdS)NrzNo response given)�	Exception�__init__�response�
IndexError)�self�args�r�/usr/lib64/python3.6/nntplib.pyrbs
zNNTPError.__init__N)�__name__�
__module__�__qualname__�__doc__rrrrrr`sc@seZdZdZdS)rzUnexpected [123]xx replyN)rrrrrrrrrisc@seZdZdZdS)rz
4xx errorsN)rrrrrrrrrmsc@seZdZdZdS)rz
5xx errorsN)rrrrrrrrrqsc@seZdZdZdS)r	z"Response does not begin with [1-5]N)rrrrrrrrr	usc@seZdZdZdS)r
zError in response dataN)rrrrrrrrr
ys�wi3Z100Z101�211�215Z220Z221Z222Z224Z225Z230Z231Z282�subject�from�datez
message-idZ
referencesz:bytesz:lines)�bytes�liness
�	GroupInfo�group�last�first�flag�ArticleInfoZnumber�
message_idrcCsNg}x>t|�D]2\}}t|t�r6|j|j|p.d��q|j|�qWdj|�S)zvTakes a unicode string representing a munged header value
    and decodes it as a (possibly non-ASCII) readable value.�ascii�)�_email_decode_header�
isinstancer�append�decode�join)Z
header_str�parts�v�encrrrr�s
cCs�g}xh|D]`}|ddkr<|dd�jd�\}}}d|}n|jd�\}}}|j�}tj||�}|j|�q
Wt}t|�t|�kr�td��|dt|��|kr�td��|S)z�Parse a list of string representing the response to LIST OVERVIEW.FMT
    and return a list of header/metadata names.
    Raises NNTPDataError if the response is not compliant
    (cf. RFC 3977, section 8.4).r�:�Nz$LIST OVERVIEW.FMT response too shortz*LIST OVERVIEW.FMT redefines default fields)�	partition�lower�_OVERVIEW_FMT_ALTERNATIVES�getr*�_DEFAULT_OVERVIEW_FMT�lenr
)r�fmt�line�name�_�suffixZdefaultsrrr�_parse_overview_fmt�s

r=cCs�tt�}g}x�|D]�}i}|jd�^}}t|�}x�t|�D]�\}	}
|	t|�krPq:||	}|jd�}|	|kr�|r�|d}
|
r�|
dt|
��j�|
kr�td��|
r�|
t|
�d�nd}
|
|||	<q:W|j||f�qW|S)zZParse the response to an OVER or XOVER command according to the
    overview format `fmt`.�	r0z: Nz?OVER/XOVER response doesn't include names of additional headers)	r7r6�split�int�	enumerate�
startswithr3r
r*)rr8Zdata_process_funcZ
n_defaultsZoverviewr9ZfieldsZarticle_number�tokens�i�tokenZ
field_nameZis_metadata�hrrr�_parse_overview�s&

rGcCs�|dkr |d	d�}|dd
�}t|dd��}t|dd��}t|dd��}t|dd��}t|dd
��}t|dd��}|dkr�|d7}n|dkr�|d7}tj||||||�S)z�Parse a pair of (date, time) strings, and return a datetime object.
    If only the date is given, it is assumed to be date and time
    concatenated together (e.g. response to the DATE command).
    N����Fi��dili����i�������rM���rN)r@�datetime)�date_str�time_strZhoursZminutesZseconds�yearZmonthZdayrrr�_parse_datetime�s
rScCsPt|tj�sd}n
dj|�}|j}|r<|d}dj||�}ndj||�}||fS)aPFormat a date or datetime object as a pair of (date, time) strings
    in the format required by the NEWNEWS and NEWGROUPS commands.  If a
    date object is passed, the time is assumed to be midnight (00h00).

    The returned representation depends on the legacy flag:
    * if legacy is False (the default):
      date has the YYYYMMDD format and time the HHMMSS format
    * if legacy is True:
      date has the YYMMDD format and time the HHMMSS format.
    RFC 3977 compliant servers should understand both formats; therefore,
    legacy is only needed when talking to old servers.
    Z000000z({0.hour:02d}{0.minute:02d}{0.second:02d}rLz{0:02d}{1.month:02d}{1.day:02d}z{0:04d}{1.month:02d}{1.day:02d})r)rO�formatrR)ZdtZlegacyrQ�yrPrrr�_unparse_datetime�s

rVcCs|dkrtj�}|j||d�S)z�Wrap a socket in SSL/TLS. Arguments:
        - sock: Socket to wrap
        - context: SSL context to use for the encrypted connection
        Returns:
        - sock: New, encrypted socket.
        N)Zserver_hostname)�sslZ_create_stdlib_contextZwrap_socket)�sock�contextZhostnamerrr�_encrypt_onsrZc@seZdZdZdZdefdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZeZdd�Z
dd�Zdhdd�Zdd�Zdidd�Zdd�Zdjdd�Zdkdd �Zd!d"�Zd#d$�Zd%d&�Zdd'�d(d)�Zdd'�d*d+�Zdldd'�d,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zdd'�d6d7�Zd8d9�Z d:d;�Z!dmd<d=�Z"d>d?�Z#d@dA�Z$dndBdC�Z%dodd'�dDdE�Z&dpdd'�dFdG�Z'dqdd'�dHdI�Z(dJdK�Z)dd'�dLdM�Z*dd'�dNdO�Z+dd'�dPdQ�Z,dd'�dRdS�Z-dTdU�Z.dVdW�Z/dXdY�Z0dZd[�Z1d\d]�Z2d^d_�Z3d`da�Z4drdbdc�Z5ddde�Z6e7�rdsdfdg�Z8dS)t�	_NNTPBasezutf-8�surrogateescapeNcCsj||_||_d|_|j�|_d|_|j�d|_|rZd|jkrZ|j�|jsZd|_|j�d|_	d|_
dS)aSInitialize an instance.  Arguments:
        - file: file-like object (open for read/write in binary mode)
        - host: hostname of the server
        - readermode: if true, send 'mode reader' command after
                      connecting.
        - timeout: timeout (in seconds) used for socket connections

        readermode is sometimes necessary if you are connecting to an
        NNTP server on the local machine and intend to call
        reader-specific commands, such as `group'.  If you get
        unexpected NNTPPermanentErrors, you might need to set
        readermode.
        rNF�READER)�host�file�	debugging�_getresp�welcome�_caps�getcapabilities�readermode_afterauth�_setreadermode�tls_on�
authenticated)rr_r^�
readermode�timeoutrrrr8s
	z_NNTPBase.__init__cCs|S)Nr)rrrr�	__enter__gsz_NNTPBase.__enter__csR�fdd�}|�rNz*y�j�Wnttfk
r8YnXWd|�rL�j�XdS)Ncs
t�d�S)Nr_)�hasattrr)rrr�<lambda>ksz$_NNTPBase.__exit__.<locals>.<lambda>)�quit�OSError�EOFError�_close)rrZis_connectedr)rr�__exit__js
z_NNTPBase.__exit__cCs|jrtdt|j��|jS)z�Get the welcome message from the server
        (this is read and squirreled away by __init__()).
        If the response code is 200, posting is allowed;
        if it 201, posting is not allowed.z	*welcome*)r`�print�reprrb)rrrr�
getwelcomeusz_NNTPBase.getwelcomec
Cs�|jdkr�d|_d|_y|j�\}}Wnttfk
rDi|_Yn<X||_d|krhttt|d��|_d|kr�dj	|d�|_|jS)z�Get the server capabilities, as read by __init__().
        If the CAPABILITIES command is not supported, an empty dict is
        returned.Nr1�VERSIONZIMPLEMENTATION� )
rc�nntp_versionZnntp_implementation�capabilitiesrr�max�mapr@r,)r�resp�capsrrrrd~s
z_NNTPBase.getcapabilitiescCs
||_dS)z�Set the debugging level.  Argument 'level' means:
        0: no debugging output (default)
        1: print commands and responses but not body text etc.
        2: also print raw lines read and sent before stripping CR/LFN)r`)r�levelrrr�set_debuglevel�sz_NNTPBase.set_debuglevelcCs:|t}|jdkr tdt|��|jj|�|jj�dS)zfInternal: send one line to the server, appending CRLF.
        The `line` must be a bytes-like object.r1z*put*N)�_CRLFr`rsrtr_�write�flush)rr9rrr�_putline�s

z_NNTPBase._putlinecCs2|jrtdt|��|j|j|j�}|j|�dS)zkInternal: send one command to the server (through _putline()).
        The `line` must be a unicode string.z*cmd*N)r`rsrt�encode�encoding�errorsr�)rr9rrr�_putcmd�sz_NNTPBase._putcmdTcCs�|jjtd�}t|�tkr$td��|jdkr<tdt|��|sDt�|r�|dd�t	krf|dd�}n|dd�t	kr�|dd	�}|S)
z�Internal: return one line from the server, stripping _CRLF.
        Raise EOFError if the connection is closed.
        Returns a bytes object.r1z
line too longz*get*rINrNrN���r�)
r_�readline�_MAXLINEr7r
r`rsrtrpr�)rZ
strip_crlfr9rrr�_getline�s
z_NNTPBase._getlinecCsl|j�}|jrtdt|��|j|j|j�}|dd�}|dkrHt|��|dkrXt|��|dkrht	|��|S)z�Internal: get a response from the server.
        Raise various errors if the response indicates an error.
        Returns a unicode string.z*resp*Nr1�4�5Z123)
r�r`rsrtr+r�r�rrr	)rr|�crrrra�sz_NNTPBase._getrespc
Cs�d}z�t|ttf�r"t|d�}}|j�}|dd�tkrBt|��g}|dk	r�dtdf}xv|jd�}||krpP|j	d�r�|dd�}|j
|�q\Wn<d}x6|j�}||kr�P|j	d�r�|dd�}|j|�q�WWd|r�|j�X||fS)	aPInternal: get a response plus following text from the server.
        Raise various errors if the response indicates an error.

        Returns a (response, lines) tuple where `response` is a unicode
        string and `lines` is a list of bytes objects.
        If `file` is a file-like object, it must be open in binary mode.
        N�wb��.s.
Fs..r1)
r)�strr�openra�	_LONGRESPrr�r�rBr�r*�close)rr_Z
openedFiler|rZterminatorsr9�
terminatorrrr�_getlongresp�s8	



z_NNTPBase._getlongrespcCs|j|�|j�S)zWInternal: send a command and get the response.
        Same return value as _getresp().)r�ra)rr9rrr�	_shortcmd�s
z_NNTPBase._shortcmdcCs|j|�|j|�S)zoInternal: send a command and get the response plus following text.
        Same return value as _getlongresp().)r�r�)rr9r_rrr�_longcmds
z_NNTPBase._longcmdcs.�j|��j|�\}}|�fdd�|D�fS)z�Internal: send a command and get the response plus following text.
        Same as _longcmd() and _getlongresp(), except that the returned `lines`
        are unicode strings rather than bytes objects.
        csg|]}|j�j�j��qSr)r+r�r�)�.0r9)rrr�
<listcomp>sz,_NNTPBase._longcmdstring.<locals>.<listcomp>)r�r�)rr9r_r|�listr)rr�_longcmdstrings
z_NNTPBase._longcmdstringcCsby|jStk
rYnXy|jd�\}}Wn tk
rNtdd�}Yn
Xt|�}||_|S)zqInternal: get the overview format. Queries the server if not
        already done, else returns the cached value.zLIST OVERVIEW.FMTN)Z_cachedoverviewfmt�AttributeErrorr�rr6r=)rr|rr8rrr�_getoverviewfmtsz_NNTPBase._getoverviewfmtcCsdd�|D�S)NcSsg|]}t|j���qSr)rr?)r�r9rrrr�$sz(_NNTPBase._grouplist.<locals>.<listcomp>r)rrrrr�
_grouplist"sz_NNTPBase._grouplistcCs<i}|jd�\}}x |D]}|j�^}}|||<qW||fS)a!Process a CAPABILITIES command.  Not supported by all servers.
        Return:
        - resp: server response if successful
        - caps: a dictionary mapping capability names to lists of tokens
        (for example {'VERSION': ['2'], 'OVER': [], LIST: ['ACTIVE', 'HEADERS'] })
        ZCAPABILITIES)r�r?)rr}r|rr9r:rCrrrry&s
z_NNTPBase.capabilities)r_cCsbt|tjtjf�s$tdj|jj���t||jdk�\}}dj||�}|j	||�\}}||j
|�fS)z�Process a NEWGROUPS command.  Arguments:
        - date: a date or datetime object
        Return:
        - resp: server response if successful
        - list: list of newsgroup names
        zAthe date parameter must be a date or datetime object, not '{:40}'rIzNEWGROUPS {0} {1})r)rOr�	TypeErrorrT�	__class__rrVrxr�r�)rrr_rPrQ�cmdr|rrrr�	newgroups4sz_NNTPBase.newgroupscCsRt|tjtjf�s$tdj|jj���t||jdk�\}}dj|||�}|j	||�S)z�Process a NEWNEWS command.  Arguments:
        - group: group name or '*'
        - date: a date or datetime object
        Return:
        - resp: server response if successful
        - list: list of message ids
        zAthe date parameter must be a date or datetime object, not '{:40}'rIzNEWNEWS {0} {1} {2})
r)rOrr�rTr�rrVrxr�)rr rr_rPrQr�rrr�newnewsDsz_NNTPBase.newnewscCs4|dk	rd|}nd}|j||�\}}||j|�fS)a@Process a LIST or LIST ACTIVE command. Arguments:
        - group_pattern: a pattern indicating which groups to query
        - file: Filename string or file object to store the result in
        Returns:
        - resp: server response if successful
        - list: list of (group, last, first, flag) (strings)
        NzLIST ACTIVE ZLIST)r�r�)r�
group_patternr_�commandr|rrrrr�Ts

z_NNTPBase.listcCs�tjd�}|jd|�\}}|jd�s8|jd|�\}}i}x>|D]6}|j|j��}|rB|jdd�\}	}
|sp|
S|
||	<qBW|r�||fSdSdS)Nz^(?P<group>[^ 	]+)[ 	]+(.*)$zLIST NEWSGROUPS rzXGTITLE r1rIr')�re�compiler�rB�search�stripr )rr�Z
return_all�line_patr|r�groups�raw_line�matchr:Zdescrrr�_getdescriptionscs


z_NNTPBase._getdescriptionscCs|j|d�S)a�Get a description for a single group.  If more than one
        group matches ('group' is a pattern), return the first.  If no
        group matches, return an empty string.

        This elides the response code from the server, since it can
        only be '215' or '285' (for xgtitle) anyway.  If the response
        code is needed, use the 'descriptions' method.

        NOTE: This neither checks for a wildcard in 'group' nor does
        it check whether the group actually exists.F)r�)rr rrr�descriptionzsz_NNTPBase.descriptioncCs|j|d�S)z'Get descriptions for a range of groups.T)r�)rr�rrr�descriptions�sz_NNTPBase.descriptionscCs�|jd|�}|jd�s t|��|j�}d}}}t|�}|dkr�|d}|dkr�|d}|dkr�|d}|dkr�|dj�}|t|�t|�t|�|fS)aProcess a GROUP command.  Argument:
        - group: the group name
        Returns:
        - resp: server response if successful
        - count: number of articles
        - first: first article number
        - last: last article number
        - name: the group name
        zGROUP rrr1rIr�rJ)r�rBrr?r7r3r@)rr:r|�words�countr"r!�nrrrr �s

z_NNTPBase.groupcCs|jd|�S)aProcess a HELP command. Argument:
        - file: Filename string or file object to store the result in
        Returns:
        - resp: server response if successful
        - list: list of strings returned by the server in response to the
                HELP command
        ZHELP)r�)rr_rrr�help�sz_NNTPBase.helpcCs8|jd�st|��|j�}t|d�}|d}|||fS)z_Internal: parse the response line of a STAT, NEXT, LAST,
        ARTICLE, HEAD or BODY command.Z22r1rI)rBrr?r@)rr|r��art_numr%rrr�
_statparse�s
z_NNTPBase._statparsecCs|j|�}|j|�S)z/Internal: process a STAT, NEXT or LAST command.)r�r�)rr9r|rrr�_statcmd�s
z_NNTPBase._statcmdcCs"|r|jdj|��S|jd�SdS)a(Process a STAT command.  Argument:
        - message_spec: article number or message id (if not specified,
          the current article is selected)
        Returns:
        - resp: server response if successful
        - art_num: the article number
        - message_id: the message id
        zSTAT {0}ZSTATN)r�rT)r�message_specrrr�stat�s	z_NNTPBase.statcCs
|jd�S)z;Process a NEXT command.  No arguments.  Return as for STAT.ZNEXT)r�)rrrr�next�sz_NNTPBase.nextcCs
|jd�S)z;Process a LAST command.  No arguments.  Return as for STAT.ZLAST)r�)rrrrr!�sz_NNTPBase.lastcCs0|j||�\}}|j|�\}}}|t|||�fS)z2Internal: process a HEAD, BODY or ARTICLE command.)r�r�r$)rr9r_r|rr�r%rrr�_artcmd�sz_NNTPBase._artcmdcCs$|dk	rdj|�}nd}|j||�S)a0Process a HEAD command.  Argument:
        - message_spec: article number or message id
        - file: filename string or file object to store the headers in
        Returns:
        - resp: server response if successful
        - ArticleInfo: (article number, message id, list of header lines)
        NzHEAD {0}ZHEAD)rTr�)rr�r_r�rrr�head�sz_NNTPBase.headcCs$|dk	rdj|�}nd}|j||�S)a+Process a BODY command.  Argument:
        - message_spec: article number or message id
        - file: filename string or file object to store the body in
        Returns:
        - resp: server response if successful
        - ArticleInfo: (article number, message id, list of body lines)
        NzBODY {0}ZBODY)rTr�)rr�r_r�rrr�body�sz_NNTPBase.bodycCs$|dk	rdj|�}nd}|j||�S)a5Process an ARTICLE command.  Argument:
        - message_spec: article number or message id
        - file: filename string or file object to store the article in
        Returns:
        - resp: server response if successful
        - ArticleInfo: (article number, message id, list of article lines)
        NzARTICLE {0}ZARTICLE)rTr�)rr�r_r�rrr�article�sz_NNTPBase.articlecCs
|jd�S)zYProcess a SLAVE command.  Returns:
        - resp: server response if successful
        ZSLAVE)r�)rrrr�slavesz_NNTPBase.slavecsDtjd��|jdj||�|�\}}�fdd��|�fdd�|D�fS)aiProcess an XHDR command (optional server extension).  Arguments:
        - hdr: the header type (e.g. 'subject')
        - str: an article nr, a message id, or a range nr1-nr2
        - file: Filename string or file object to store the result in
        Returns:
        - resp: server response if successful
        - list: list of (nr, value) strings
        z^([0-9]+) ?(.*)
?zXHDR {0} {1}cs�j|�}|r|jdd�S|S)Nr1rI)r�r )r9�m)�patrr�
remove_numbers
z%_NNTPBase.xhdr.<locals>.remove_numbercsg|]}�|��qSrr)r�r9)r�rrr�sz"_NNTPBase.xhdr.<locals>.<listcomp>)r�r�r�rT)rZhdrr�r_r|rr)r�r�r�xhdr
s	
z_NNTPBase.xhdrcCs.|jdj||�|�\}}|j�}|t||�fS)aFProcess an XOVER command (optional server extension) Arguments:
        - start: start of range
        - end: end of range
        - file: Filename string or file object to store the result in
        Returns:
        - resp: server response if successful
        - list: list of dicts containing the response fields
        z
XOVER {0}-{1})r�rTr�rG)r�start�endr_r|rr8rrr�xovers	
z_NNTPBase.xoverc	Csxd|jkrdnd}t|ttf�r>|\}}|dj||p6d�7}n|dk	rR|d|}|j||�\}}|j�}|t||�fS)a�Process an OVER command.  If the command isn't supported, fall
        back to XOVER. Arguments:
        - message_spec:
            - either a message id, indicating the article to fetch
              information about
            - or a (start, end) tuple, indicating a range of article numbers;
              if end is None, information up to the newest message will be
              retrieved
            - or None, indicating the current article number must be used
        - file: Filename string or file object to store the result in
        Returns:
        - resp: server response if successful
        - list: list of dicts containing the response fields

        NOTE: the "message id" form isn't supported by XOVER
        ZOVERZXOVERz {0}-{1}r'Nrw)rcr)�tupler�rTr�r�rG)	rr�r_r�r�r�r|rr8rrr�over(sz_NNTPBase.overc	Csjtjdtd�tjd�}|jd||�\}}g}x0|D](}|j|j��}|r6|j|j	dd��q6W||fS)z�Process an XGTITLE command (optional server extension) Arguments:
        - group: group name wildcard (i.e. news.*)
        Returns:
        - resp: server response if successful
        - list: list of (name,title) stringszFThe XGTITLE extension is not actively used, use descriptions() insteadrIz^([^ 	]+)[ 	]+(.*)$zXGTITLE r1)
�warnings�warn�DeprecationWarningr�r�r�r�r�r*r )	rr r_r�r|Z	raw_linesrr�r�rrr�xgtitleCs

z_NNTPBase.xgtitlecCsjtjdtd�|jdj|��}|jd�s0t|��y|j�\}}Wntk
r\t|��Yn
X||fSdS)z�Process an XPATH command (optional server extension) Arguments:
        - id: Message id of article
        Returns:
        resp: server response if successful
        path: directory path to article
        z(The XPATH extension is not actively usedrIz	XPATH {0}Z223N)	r�r�r�r�rTrBrr?�
ValueError)r�idr|Zresp_num�pathrrr�xpathUs
z_NNTPBase.xpathcCsb|jd�}|jd�st|��|j�}t|�dkr8t|��|d}t|�dkrTt|��|t|d�fS)z�Process the DATE command.
        Returns:
        - resp: server response if successful
        - date: datetime object
        ZDATEZ111rIr1�N)r�rBrr?r7r
rS)rr|�elemrrrrris

z_NNTPBase.datecCs�|j|�}|jd�st|��t|ttf�r2|j�}xB|D]:}|jt�sT|j	d�t}|jd�rfd|}|j
j|�q8W|j
jd�|j
j�|j
�S)N�3s
r�s.
)r�rBrr)r�	bytearray�
splitlines�endswithr��rstripr_r�r�ra)rr��fr|r9rrr�_postzs





z_NNTPBase._postcCs|jd|�S)z�Process a POST command.  Arguments:
        - data: bytes object, iterable or file containing the article
        Returns:
        - resp: server response if successfulZPOST)r�)r�datarrr�post�sz_NNTPBase.postcCs|jdj|�|�S)aProcess an IHAVE command.  Arguments:
        - message_id: message-id of the article
        - data: file containing the article
        Returns:
        - resp: server response if successful
        Note that if the server refuses the article an exception is raised.z	IHAVE {0})r�rT)rr%r�rrr�ihave�sz_NNTPBase.ihavecCs|jj�|`dS)N)r_r�)rrrrrq�s
z_NNTPBase._closec
Csz|jd�}Wd|j�X|S)zdProcess a QUIT command and close the socket.  Returns:
        - resp: server response if successfulZQUITN)r�rq)rr|rrrrn�s
z_NNTPBase.quitcCs�|jrtd��|r"|r"td��y>|r^|r^ddl}|j�}|j|j�}|r^|d}|d}Wntk
rtYnX|s~dS|jd|�}|jd�r�|s�t|��n |jd|�}|jd�s�t	|��d|_
|j�|jr�d	|j
kr�|j
�d|_
|j�dS)
NzAlready logged in.z7At least one of `user` and `usenetrc` must be specifiedrrIzauthinfo user Z381zauthinfo pass Z281r])rhr��netrcZauthenticatorsr^ror�rBrrrcrdrerf)r�user�password�usenetrcr�ZcredentialsZauthr|rrr�login�s<



z_NNTPBase.logincCs`y|jd�|_WnJtk
r$Yn8tk
rZ}z|jjd�rHd|_n�WYdd}~XnXdS)Nzmode readerZ480T)r�rbrrr
rBre)r�errrrf�sz_NNTPBase._setreadermodecCs||jrtd��|jrtd��|jd�}|jd�rp|jj�t|j||j	�|_|jj
d�|_d|_d|_|j�nt
d��dS)	zzProcess a STARTTLS command. Arguments:
            - context: SSL context to use for the encrypted connection
            zTLS is already enabled.z+TLS cannot be started after authentication.�STARTTLSZ382�rwbTNzTLS failed to start.)rgr�rhr�rBr_r�rZrXr^�makefilercrdr)rrYr|rrr�starttls�s



z_NNTPBase.starttls)T)N)N)N)N)N)N)N)N)N)NNT)N)9rrrr�r�rrrkrrrurdr�debugr�r�r�rar�r�r�r�r�r�ryr�r�r�r�r�r�r r�r�r�r�r�r!r�r�r�r�r�r�r�r�r�r�rr�r�r�rqrnr�rf�	_have_sslr�rrrrr[(sj
.	

.







		
)
r[c@s*eZdZeddddefdd�Zdd�ZdS)rNFc	Cs�||_||_tj||f|�|_d}y8|jjd�}tj|||||�|sJ|rX|j|||�Wn$|rn|j	�|jj	��YnXdS)a,Initialize an instance.  Arguments:
        - host: hostname to connect to
        - port: port to connect to (default the standard NNTP port)
        - user: username to authenticate with
        - password: password to use with username
        - readermode: if true, send 'mode reader' command after
                      connecting.
        - usenetrc: allow loading username and password from ~/.netrc file
                    if not specified explicitly
        - timeout: timeout (in seconds) used for socket connections

        readermode is sometimes necessary if you are connecting to an
        NNTP server on the local machine and intend to call
        reader-specific commands, such as `group'.  If you get
        unexpected NNTPPermanentErrors, you might need to set
        readermode.
        Nr�)
r^�port�socket�create_connectionrXr�r[rr�r�)	rr^r�r�r�rir�rjr_rrrr�s

z
NNTP.__init__c
Cs ztj|�Wd|jj�XdS)N)r[rqrXr�)rrrrrq!szNNTP._close)rrr�	NNTP_PORTrrrqrrrrr�s"c@s,eZdZedddddefdd�Zdd�ZdS)�NNTP_SSLNFc	

Cs�tj||f|�|_d}	yJt|j||�|_|jjd�}	tj||	|||d�|sP|r^|j|||�Wn$|	rt|	j�|jj��YnXdS)z�This works identically to NNTP.__init__, except for the change
            in default port and the `ssl_context` argument for SSL connections.
            Nr�)rirj)	r�r�rXrZr�r[rr�r�)
rr^r�r�r�Zssl_contextrir�rjr_rrrr+s


zNNTP_SSL.__init__c
Cs ztj|�Wd|jj�XdS)N)r[rqrXr�)rrrrrqAszNNTP_SSL._close)rrr�
NNTP_SSL_PORTrrrqrrrrr�)s
r��__main__zJ        nntplib built-in demo - display the latest articles in a newsgroup)r�z-gz--groupzgmane.comp.python.generalz3group to fetch messages from (default: %(default)s))�defaultr�z-sz--serverznews.gmane.orgz+NNTP server hostname (default: %(default)s)z-pz--portr1z#NNTP port number (default: %s / %s))r��typer�z-nz
--nb-articles�
z2number of articles to fetch (default: %(default)s)z-Sz--ssl�
store_truezuse NNTP over SSL)�actionr�r�)r^r�r�ZGroupZhaszarticles, rangeZtocCs$t|�|kr |d|d�d}|S)NrJz...)r7)�sZlimrrr�cutlsr��<z{:7} {:20} {:42} ({})��*)N)N)Fr�r�r�)Jrr�r��collectionsrOr�rW�ImportErrorr�Zemail.headerrr(r�__all__r�rrrrrr	r
r�r�r�r6r4r��
namedtuplerr$r=rGrSrVrZr[rr�r*r�argparse�ArgumentParser�parser�add_argumentr@�
parse_argsrr�Zserverr�rdr}r�r r|r�r"r!r:rsr�r�Znb_articlesr�Z	overviewsZartnumr�r?ZauthorrrrTrnrrrr�<module>s�&
	


X-






 string.cpython-36.opt-1.pyc000064400000017436150335715140011456 0ustar003


 \.�@s�dZddddddddd	d
ddgZd
dlZdZdZdZeeZdZeddZdZ	dZ
eee
eZddd�Zd
dl
Zd
dlmZGdd�de�ZGdd�ded�ZGdd�d�ZdS)anA collection of string constants.

Public module variables:

whitespace -- a string containing all ASCII whitespace
ascii_lowercase -- a string containing all ASCII lowercase letters
ascii_uppercase -- a string containing all ASCII uppercase letters
ascii_letters -- a string containing all ASCII letters
digits -- a string containing all ASCII decimal digits
hexdigits -- a string containing all ASCII hexadecimal digits
octdigits -- a string containing all ASCII octal digits
punctuation -- a string containing all ASCII punctuation characters
printable -- a string containing all ASCII characters considered printable

�
ascii_letters�ascii_lowercase�ascii_uppercase�capwords�digits�	hexdigits�	octdigits�	printable�punctuation�
whitespace�	Formatter�Template�Nz 	

ZabcdefghijklmnopqrstuvwxyzZABCDEFGHIJKLMNOPQRSTUVWXYZ�
0123456789ZabcdefZABCDEFZ01234567z !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~cCs|pdjdd�|j|�D��S)a�capwords(s [,sep]) -> string

    Split the argument into words using split, capitalize each
    word using capitalize, and join the capitalized words using
    join.  If the optional second argument sep is absent or None,
    runs of whitespace characters are replaced by a single space
    and leading and trailing whitespace are removed, otherwise
    sep is used to split and join the words.

    � css|]}|j�VqdS)N)�
capitalize)�.0�x�r�/usr/lib64/python3.6/string.py�	<genexpr>0szcapwords.<locals>.<genexpr>)�join�split)�s�seprrrr%s)�ChainMapcs eZdZdZ�fdd�Z�ZS)�_TemplateMetaclassa/
    %(delim)s(?:
      (?P<escaped>%(delim)s) |   # Escape sequence of two delimiters
      (?P<named>%(id)s)      |   # delimiter and a Python identifier
      {(?P<braced>%(id)s)}   |   # delimiter and a braced identifier
      (?P<invalid>)              # Other ill-formed delimiter exprs
    )
    csXtt|�j|||�d|kr$|j}ntjtj|j�|jd�}tj||j	tj
B�|_dS)N�pattern)Zdelim�id)�superr�__init__r�_re�escape�	delimiter�	idpattern�compile�flags�VERBOSE)�cls�name�basesZdctr)�	__class__rrrAs
z_TemplateMetaclass.__init__)�__name__�
__module__�__qualname__rr�
__classcell__rr)r*rr7src@s>eZdZdZdZdZejZdd�Z	dd�Z
dd	�Zd
d�ZdS)
rz.A string class for supporting $-substitutions.�$z(?-i:[_a-zA-Z][_a-zA-Z0-9]*)cCs
||_dS)N)�template)�selfr0rrrrXszTemplate.__init__cCsd|jd�}|jd|�jdd�}|s.d}d}n"|tdj|dd���}t|�}td||f��dS)N�invalidT)�keepends��z.Invalid placeholder in string: line %d, col %d���)�startr0�
splitlines�lenr�
ValueError)r1�mo�i�lines�colno�linenorrr�_invalid]s
zTemplate._invalidcsl|std��|^�}t|�dkr(td��|s2|�n|rFt||d��n|d���fdd�}�jj|�j�S)Nz>descriptor 'substitute' of 'Template' object needs an argumentr4zToo many positional argumentsr
csd|jd�p|jd�}|dk	r(t�|�S|jd�dk	r<�jS|jd�dk	rT�j|�td�j��dS)N�named�braced�escapedr2z#Unrecognized named group in pattern)�group�strr"r@r:r)r;rA)�mappingr1rr�convertws
z$Template.substitute.<locals>.convert)�	TypeErrorr9�	_ChainMapr�subr0)�args�kwsrGr)rFr1r�
substituteiszTemplate.substitutecsl|std��|^�}t|�dkr(td��|s2|�n|rFt||d��n|d���fdd�}�jj|�j�S)NzCdescriptor 'safe_substitute' of 'Template' object needs an argumentr4zToo many positional argumentsr
cs||jd�p|jd�}|dk	rByt�|�Stk
r@|j�SX|jd�dk	rV�jS|jd�dk	rl|j�Std�j��dS)NrArBrCr2z#Unrecognized named group in pattern)rDrE�KeyErrorr"r:r)r;rA)rFr1rrrG�s
z)Template.safe_substitute.<locals>.convert)rHr9rIrrJr0)rKrLrGr)rFr1r�safe_substitute�s
zTemplate.safe_substituteN)
r+r,r-�__doc__r"r#r �
IGNORECASEr%rr@rMrOrrrrrMs)�	metaclassc@sVeZdZdd�Zdd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)rcOsz|std��|^}}y|^}}WnJtk
rjd|kr\|jd�}ddl}|jdtdd�n
td�d�YnX|j|||�S)Nz;descriptor 'format' of 'Formatter' object needs an argument�
format_stringr
z9Passing 'format_string' as keyword argument is deprecated�)�
stacklevelz@format() missing 1 required positional argument: 'format_string')rHr:�pop�warnings�warn�DeprecationWarning�vformat)rK�kwargsr1rSrWrrr�format�s

zFormatter.formatcCs.t�}|j||||d�\}}|j|||�|S)NrT)�set�_vformat�check_unused_args)r1rSrKr[�	used_args�result�_rrrrZ�szFormatter.vformatr
c	Cs�|dkrtd��g}x�|j|�D]�\}}	}
}|r:|j|�|	dk	r |	dkrl|dkrZtd��t|�}	|d7}n|	j�r�|r�td��d}|j|	||�\}}
|j|
�|j||�}|j|
||||d|d�\}
}|j|j	||
��q Wdj
|�|fS)Nr
zMax string recursion exceededr5FzJcannot switch from manual field specification to automatic field numberingr4)�auto_arg_index)r:�parse�appendrE�isdigit�	get_field�add�
convert_fieldr^�format_fieldr)r1rSrKr[r`Zrecursion_depthrcraZliteral_text�
field_name�format_spec�
conversion�objZarg_usedrrrr^�s4


zFormatter._vformatcCst|t�r||S||SdS)N)�
isinstance�int)r1�keyrKr[rrr�	get_value�s
zFormatter.get_valuecCsdS)Nr)r1r`rKr[rrrr_szFormatter.check_unused_argscCs
t||�S)N)r\)r1�valuerlrrrrjszFormatter.format_fieldcCsN|dkr|S|dkrt|�S|dkr,t|�S|dkr<t|�Stdj|���dS)Nr�r�az"Unknown conversion specifier {0!s})rE�repr�asciir:r\)r1rsrmrrrriszFormatter.convert_fieldcCs
tj|�S)N)�_stringZformatter_parser)r1rSrrrrdszFormatter.parsec	CsNtj|�\}}|j|||�}x(|D] \}}|r:t||�}q"||}q"W||fS)N)rxZformatter_field_name_splitrr�getattr)	r1rkrKr[�first�restrnZis_attrr<rrrrg(szFormatter.get_fieldN)r
)r+r,r-r\rZr^rrr_rjrirdrgrrrrr�s
5	)N)rP�__all__rxr
rrrrrrr	rr�rer �collectionsrrI�typerrrrrrr�<module>s&


`trace.cpython-36.pyc000064400000046051150335715140010302 0ustar003


 \=p�@s,dZddgZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZyddlZWn"ek
r�ejZdd�ZYnXdd	�Zd
d�ZdZGdd
�d
�Zdd�Zdd�ZGdd�d�Zdd�Zdd�Zddd�Zdd�ZGdd�d�Zdd�Ze dk�r(e�dS) a�program/module to trace Python program or function execution

Sample use, command line:
  trace.py -c -f counts --ignore-dir '$prefix' spam.py eggs
  trace.py -t --ignore-dir '$prefix' spam.py eggs
  trace.py --trackcalls spam.py eggs

Sample use, programmatically
  import sys

  # create a Trace object, telling it what to ignore, and whether to
  # do tracing or line-counting or both.
  tracer = trace.Trace(ignoredirs=[sys.base_prefix, sys.base_exec_prefix,],
                       trace=0, count=1)
  # run the new command using the given tracer
  tracer.run('main()')
  # make a report, placing output in /tmp
  r = tracer.results()
  r.write_results(show_missing=True, coverdir="/tmp")
�Trace�CoverageResults�N)�	monotoniccCstjd�dS)N)�sys�settrace�rr�/usr/lib64/python3.6/trace.py�_unsettraceEsr	cCstj|�tj|�dS)N)�	threadingrr)�funcrrr�	_settraceHs
rcCstjd�tjd�dS)N)rrr
rrrrr	Ls
z#pragma NO COVERc@seZdZddd�Zdd�ZdS)�_IgnoreNcCs:|s
t�nt|�|_|sgndd�|D�|_ddi|_dS)NcSsg|]}tjj|��qSr)�os�path�normpath)�.0�drrr�
<listcomp>Usz$_Ignore.__init__.<locals>.<listcomp>z<string>�)�set�_mods�_dirs�_ignore)�self�modules�dirsrrr�__init__Ss
z_Ignore.__init__cCs�||jkr|j|S||jkr,d|j|<dSx*|jD] }|j|d�r4d|j|<dSq4W|dkrnd|j|<dSx,|jD]"}|j|tj�rvd|j|<dSqvWd|j|<dS)Nr�.r)rr�
startswithrr�sep)r�filename�
modulename�modrrrr�namesYs$







z
_Ignore.names)NN)�__name__�
__module__�__qualname__rr#rrrrr
Rs
r
cCs tjj|�}tjj|�\}}|S)z-Return a plausible module name for the patch.)rr�basename�splitext)r�baser �extrrr�_modname�sr+cCs�tjj|�}d}xJtjD]@}tjj|�}|j|�r|t|�tjkrt|�t|�kr|}qW|rv|t|�dd�}n|}tjj|�\}}|jtjd�}tj	r�|jtj	d�}tjj
|�\}}|jd�S)z,Return a plausible module name for the path.�rNr)rr�normcaserr�lenr�
splitdrive�replace�altsepr(�lstrip)rZcomparepathZlongest�dirr)Zdriver r*rrr�_fullmodname�s r4c@s:eZdZddd�Zdd�Zdd�Zdd
d�Zddd
�ZdS)rNcCs�||_|jdkri|_|jj�|_||_|jdkr8i|_|jj�|_||_|jdkrZi|_|jj�|_||_||_|jr�y@t|jd��}tj	|�\}}}WdQRX|j
|j|||��Wn@tt
tfk
r�}ztd|j|ftjd�WYdd}~XnXdS)N�rbzSkipping counts file %r: %s)�file)�counts�copyZcounter�calledfuncs�callers�infile�outfile�open�pickle�load�update�	__class__�OSError�EOFError�
ValueError�printr�stderr)rr7r9r;r:r<�f�errrrrr�s,


zCoverageResults.__init__cCs|jd�o|jd�S)z_Return True if the filename does not refer to a file
        we want to have reported.
        �<�>)r�endswith)rr rrr�is_ignored_filename�sz#CoverageResults.is_ignored_filenamec	Csz|j}|j}|j}|j}|j}|j}x$|D]}|j|d�||||<q*Wx|D]}d||<qPWx|D]}d||<qfWdS)z.Merge in the data from another CoverageResultsrrN)r7r9r:�get)	r�otherr7r9r:Zother_countsZother_calledfuncsZ
other_callers�keyrrrr@�s


zCoverageResults.updateTFc!Cs�|jrDt�td�|j}x(t|�D]\}}}td|||f�q$W|jr�t�td�d}}	xvt|j�D]h\\}
}}\}
}}|
|kr�t�td|
d�|
}d}	|
|
kr�|	|
kr�td|
�|
}	td||||f�qlWi}x8|jD].\}}|j|i�}||<|j||f||<q�Wi}�x$|j�D�]\}}|j|��r@�q&|jd��rX|d	d�}|d	k�r�t	j
jt	j
j|��}t
|�}n$|}t	j
j|��s�t	j|�t|�}|�r�t|�}ni}tj|�}t	j
j||d�}t|d��}tj|j�\}}Wd	QRX|j|||||�\}}|�r&|�r&td
||�}||||f||<�q&W|�r�|�r�td�x2t|�D]&}||\}}}}td||��q`W|j�r�y&tj|j|j|jft|jd�d
�Wn6tk
�r�} ztd| tj d�WYd	d	} ~ XnXd	S)af
        Write the coverage results.

        :param show_missing: Show lines that had no hits.
        :param summary: Include coverage summary per module.
        :param coverdir: If None, the results of each module are placed in its
                         directory, otherwise it is included in the directory
                         specified.
        zfunctions called:z*filename: %s, modulename: %s, funcname: %szcalling relationships:r,z***z  -->z    %s.%s -> %s.%sz.pycNrz.coverr5�dzlines   cov%   module   (path)z%5d   %3d%%   %s   (%s)�wbz"Can't save counts files because %s)r6���)!r9rE�sortedr:r7rM�itemsrLrKrr�dirname�abspathr+�exists�makedirsr4�_find_executable_linenos�	linecache�getlines�joinr=�tokenize�detect_encoding�readline�write_results_file�intr<r>�dumprBrrF)!rZshow_missing�summary�coverdirZcallsr r!�funcnameZlastfileZ	lastcfileZpfileZpmodZpfunc�cfileZcmodZcfuncZper_file�lineno�	lines_hitZsums�countr3�lnotab�sourceZ	coverpath�fp�encoding�_�n_hits�n_linesZpercent�mrHrrr�
write_results�s|






zCoverageResults.write_resultscCs�yt|d|d�}Wn6tk
rH}ztd||ftjd�dSd}~XnXd}d}	|��x�t|d�D]r\}
}|
|kr�|jd||
�|	d7}	|d7}n.|
|kr�t|kr�|jd	�|d7}n
|jd
�|j|jd��qdWWdQRX|	|fS)
z'Return a coverage results file in path.�w)rmz3trace: Could not open %r for writing: %s - skipping)r6rNrz%5d: z>>>>>> z       �)rr)	r=rBrErrF�	enumerate�write�PRAGMA_NOCOVER�
expandtabs)rr�linesrjrhrmr<rHrprorg�linerrrr`5s(



z"CoverageResults.write_results_file)NNNNN)TFN)N)r$r%r&rrLr@rrr`rrrrr�s

[cCs0i}x&tj|�D]\}}||krd||<qW|S)z:Return dict where keys are lines in the line number table.r)�disZfindlinestarts)�code�strs�linenosrnrgrrr�_find_lines_from_codeUs
rcCs8t||�}x(|jD]}tj|�r|jt||��qW|S)z<Return lineno dict for all code objects reachable from code.)r�	co_consts�inspectZiscoder@�_find_lines)r|r}r~�crrrr�_s


r�c
Cs�i}tj}t||d��r}tj|j�}x^|D]V\}}}}	}
|tjkr||tjkr||\}}|	\}
}xt||
d�D]}d||<qlW|}q*WWdQRX|S)z�Return a dict of possible docstring positions.

    The dict maps line numbers to strings.  There is an entry for
    line that contains only a string or a part of a triple-quoted
    string.
    )rmrN)�token�INDENTr=r]�generate_tokensr_�STRING�range)r rmrZ
prev_ttyperG�tokZttypeZtstr�start�endrzZslineZscolZelineZecol�irrr�
_find_stringsks

r�cCs�y(tj|��}|j�}|j}WdQRXWn6tk
r^}ztd||ftjd�iSd}~XnXt||d�}t	||�}t
||�S)zAReturn dict where keys are line numbers in the line number table.Nz%Not printing coverage data for %r: %s)r6�exec)r]r=�readrmrBrErrF�compiler�r�)r rG�progrmrHr|r}rrrrY�s
rYc	@s�eZdZddddffdddf	dd�Zdd�Zdd	d
�Zdd�Zd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rrrNFc

Cs�||_||_t||�|_i|_i|_d|_||_i|_i|_	i|_
d|_|	rTt�|_|rb|j
|_nZ|rp|j|_nL|r�|r�|j|_|j|_n2|r�|j|_|j|_n|r�|j|_|j|_nd|_dS)ax
        @param count true iff it should count number of times each
                     line is executed
        @param trace true iff it should print out each line that is
                     being counted
        @param countfuncs true iff it should just output a list of
                     (filename, modulename, funcname,) for functions
                     that were called at least once;  This overrides
                     `count' and `trace'
        @param ignoremods a list of the names of modules to ignore
        @param ignoredirs a list of the names of directories to ignore
                     all of the (recursive) contents of
        @param infile file from which to read stored counts to be
                     added into the results
        @param outfile file in which to write the results
        @param timing true iff timing information be displayed
        rNr)r;r<r
�ignorer7Zpathtobasename�	donothing�trace�_calledfuncs�_callers�
_caller_cache�
start_time�_time�globaltrace_trackcallers�globaltrace�globaltrace_countfuncs�globaltrace_lt�localtrace_trace_and_count�
localtrace�localtrace_trace�localtrace_count)
rrir��
countfuncs�countcallers�
ignoremods�
ignoredirsr;r<�timingrrrr�s6




zTrace.__init__cCs ddl}|j}|j|||�dS)Nr)�__main__�__dict__�runctx)r�cmdr��dictrrr�run�sz	Trace.runc
CsL|dkri}|dkri}|js(t|j�zt|||�Wd|jsFt�XdS)N)r�rr�r�r	)rr��globals�localsrrrr��s
zTrace.runctxcOs<d}|jstj|j�z|||�}Wd|js6tjd�X|S)N)r�rrr�)rr�args�kw�resultrrr�runfunc�sz
Trace.runfuncc
Cs�|j}|j}|rt|�}nd}|j}d}||jkrL|j|dk	r�|j|}n�d|j|<dd�tj|�D�}t|�dkr�dd�tj|d�D�}t|�dkr�dd�tj|d�D�}	t|	�dkr�|	dj}||j|<|dk	r�d||f}|||fS)NcSsg|]}tj|�r|�qSr)r�Z
isfunction)rrGrrrr�sz1Trace.file_module_function_of.<locals>.<listcomp>rcSsg|]}t|t�r|�qSr)�
isinstancer�)rrrrrr�srcSsg|]}t|d�r|�qS)�	__bases__)�hasattr)rr�rrrr�sz%s.%s)	�f_code�co_filenamer+�co_namer��gcZ
get_referrersr.r$)
r�framer|r r!reZclsnameZfuncsZdicts�classesrrr�file_module_function_of�s,




zTrace.file_module_function_ofcCs0|dkr,|j|�}|j|j�}d|j||f<dS)zkHandler for call events.

        Adds information about who called who to the self._callers dict.
        �callrN)r��f_backr�)rr��why�arg�	this_funcZparent_funcrrrr�s
zTrace.globaltrace_trackcallerscCs |dkr|j|�}d|j|<dS)zoHandler for call events.

        Adds (filename, modulename, funcname) to the self._calledfuncs dict.
        r�rN)r�r�)rr�r�r�r�rrrr�s
zTrace.globaltrace_countfuncscCsj|dkrf|j}|jjdd�}|rbt|�}|dk	rf|jj||�}|sf|jrZtd||jf�|j	SndSdS)z�Handler for call events.

        If the code block being entered is to be ignored, returns `None',
        else returns self.localtrace.
        r��__file__Nz! --- modulename: %s, funcname: %s)
r��	f_globalsrMr+r�r#r�rEr�r�)rr�r�r�r|r r!Z	ignore_itrrrr�szTrace.globaltrace_ltcCs�|dkr~|jj}|j}||f}|jj|d�d|j|<|jrTtdt�|jdd�tj	j
|�}td||tj||�fdd�|j
S)	Nrzrrz%.2f� )r�z
%s(%d): %sr,)r�r��f_linenor7rMr�rEr�rrr'rZ�getliner�)rr�r�r�r rgrO�bnamerrrr�2sz Trace.localtrace_trace_and_countcCsd|dkr^|jj}|j}|jr4tdt�|jdd�tjj|�}td||t	j
||�fdd�|jS)Nrzz%.2fr�)r�z
%s(%d): %sr,)r�r�r�r�rEr�rrr'rZr�r�)rr�r�r�r rgr�rrrr�AszTrace.localtrace_tracecCs<|dkr6|jj}|j}||f}|jj|d�d|j|<|jS)Nrzrr)r�r�r�r7rMr�)rr�r�r�r rgrOrrrr�NszTrace.localtrace_countcCst|j|j|j|j|jd�S)N)r;r<r9r:)rr7r;r<r�r�)rrrr�resultsVs
z
Trace.results)NN)r$r%r&rr�r�r�r�r�r�r�r�r�r�r�rrrrr�s0
)	
cs�tj�}|jdddd�|jdd�}|jddd	d
d�|jdd
d	dd�|jddd	dd�|jddd	dd�|jd�}|j�}|jddd	dd�|jddd	dd�|jdddd�|jd d!d"d�|jd#d$d	d%d�|jd&d'd	d(d�|jd)d*d	d+d�|jd,d-�}|jd.d/gd0d1�|jd2d/gd3d1�|jd4d5d6d7�|jd8tjd9d7�|j�}|j�r�d:d;jt	j
�f}tjj
t	jf|���tjj
t	jf|�����fd<d=��d>d?�|jD�|_�fd@d?�|jD�|_|j�r|j�s�|jdA�t|j|jdB�}|j|j|j|j�St|j|j|j|jg��s*|jdC�|j�rL|j�sB|j�rL|jdD�|j�rh|j�rh|jdE�|jdk�r~|jdF�|jf|j�t	_ tjj!|j�t	jdG<t"|j|j|j|j|j|j|j|j|j#dH�	}yJt$|j��}t%|j&�|jdI�}WdQRX|jdJdddK�}	|j'||	|	�WnPt(k
�rT}
zt	j)dLt	j dG|
f�WYdd}
~
Xnt*k
�rhYnX|j+�}|j,�s�|j|j|j|j�dS)MNz	--version�versionz	trace 2.0)�actionr�zMain optionsz(One of these (or --report) must be givenz-cz--count�
store_truez�Count the number of times each line is executed and write the counts to <module>.cover for each module executed, in the module's directory. See also --coverdir, --file, --no-report below.)r��helpz-tz--tracez3Print each line to sys.stdout before it is executedz-lz--listfuncsz�Keep track of which functions are executed at least once and write the results to sys.stdout after the program exits. Cannot be specified alongside --trace or --count.z-Tz--trackcallsz^Keep track of caller/called pairs and write the results to sys.stdout after the program exits.Z	Modifiersz-rz--reportz�Generate a report from a counts file; does not execute any code. --file must specify the results file to read, which must have been created in a previous run with --count --file=FILEz-Rz--no-reportz^Do not generate the coverage report files. Useful if you want to accumulate over several runs.z-fz--filez+File to accumulate counts over several runs)r�z-Cz
--coverdirz�Directory where the report files go. The coverage report for <package>.<module> will be written to file <dir>/<package>/<module>.coverz-mz	--missingz?Annotate executable lines that were not executed with ">>>>>> "z-sz	--summaryz\Write a brief summary for each file to sys.stdout. Can only be used with --count or --reportz-gz--timingzQPrefix each line with the time since the program started. Only used while tracingZFilterszCan be specified multiple timesz--ignore-module�appendzqIgnore the given module(s) and its submodules (if it is a package). Accepts comma separated list of module names.)r��defaultr�z--ignore-dirzWIgnore files in the given directory (multiple directories can be joined by os.pathsep).r �?zfile to run as main program)�nargsr��	argumentszarguments to the program�libzpython{0.major}.{0.minor}cs4tjjtjj|��}|jd��jd��}tjj|�S)Nz$prefixz$exec_prefix)rr�
expanduser�
expandvarsr0r)�s)�_exec_prefix�_prefixrr�parse_ignore_dir�szmain.<locals>.parse_ignore_dircSs$g|]}|jd�D]}|j��qqS)�,)�split�strip)rr�r"rrrr�szmain.<locals>.<listcomp>cs&g|]}|jtj�D]}�|��qqSr)r�r�pathsep)rr�r�)r�rrr�sz-r/--report requires -f/--file)r;r<zLmust specify one of --trace, --count, --report, --listfuncs, or --trackcallsz8cannot specify both --listfuncs and (--trace or --count)z3--summary can only be used with --count or --reportz3filename is missing: required with the main optionsr)r�r�r�r�r;r<r�r�r�)r�r$�__package__�
__cached__zCannot run file %r because: %s)-�argparse�ArgumentParser�add_argumentZadd_argument_groupZadd_mutually_exclusive_groupZ	REMAINDER�
parse_argsZ
ignore_dir�formatr�version_inforrr\�base_prefix�base_exec_prefixZ
ignore_moduleZreportr6�errorrrrZmissingrcrd�anyr�riZ	listfuncsZ
trackcallsr r��argvrUrr�r=r�r�r�rB�exit�
SystemExitr�Z	no_report)�parserZgrpZ_grpZoptsZrel_pathr��trlr|ZglobsrHr)r�r�r�r�main\s�


















(r�r�)N)!�__doc__�__all__r�rZr�rerr�r]r�r�r{r>Ztimerr�r
�ImportErrorrrr	rwr
r+r4rrr�r�rYrr�r$rrrr�<module>1sH2/

M
base64.cpython-36.opt-2.pyc000064400000026051150335715140011226 0ustar003


 \�O�@s�ddlZddlZddlZdddddddd	d
ddd
ddddddgZeefZdd�ZdBdd�ZdCdd�Z	dd�Z
dd�Zejdd�Z
ejdd�Zdd�Zdd�ZdZdadad d�ZdDd!d	�Zd"d
�ZdEd#d�Zdadad$Zd%ZdFd&d'�Zddddd(�d)d�Zddd*d+�d,d�Zd-Zda da!da"dGd.d�Z#d/d
�Z$d0Z%e%d1d2Z&d3d�Z'd4d�Z(d5d6�Z)d7d�Z*d8d9�Z+d:d�Z,d;d<�Z-d=d>�Z.d?d@�Z/e0dAk�r�e.�dS)H�N�encode�decode�encodebytes�decodebytes�	b64encode�	b64decode�	b32encode�	b32decode�	b16encode�	b16decode�	b85encode�	b85decode�	a85encode�	a85decode�standard_b64encode�standard_b64decode�urlsafe_b64encode�urlsafe_b64decodecCsxt|t�r2y
|jd�Stk
r0td��YnXt|t�r@|Syt|�j�Stk
rrtd|j	j
�d�YnXdS)N�asciiz4string argument should contain only ASCII charactersz>argument should be a bytes-like object or ASCII string, not %r)�
isinstance�strr�UnicodeEncodeError�
ValueError�bytes_types�
memoryview�tobytes�	TypeError�	__class__�__name__)�s�r �/usr/lib64/python3.6/base64.py�_bytes_from_decode_data"s


r"cCs,tj|dd�}|dk	r(|jtjd|��S|S)NF)�newlines+/)�binascii�
b2a_base64�	translate�bytes�	maketrans)r�altchars�encodedr r r!r3sFcCsPt|�}|dk	r*t|�}|jtj|d��}|rFtjd|�rFtjd��tj|�S)Ns+/s^[A-Za-z0-9+/]*={0,2}$zNon-base64 digit found)	r"r&r'r(�re�matchr$�Error�
a2b_base64)rr)Zvalidater r r!rAs
cCst|�S)N)r)rr r r!rZscCst|�S)N)r)rr r r!rass+/s-_cCst|�jt�S)N)rr&�_urlsafe_encode_translation)rr r r!roscCst|�}|jt�}t|�S)N)r"r&�_urlsafe_decode_translationr)rr r r!rxs
s ABCDEFGHIJKLMNOPQRSTUVWXYZ234567csBtdkr,dd�tD���fdd��D�ad�t|t�sBt|�j�}t|�d}|rb|dd|}t�}tj	}t}xjt
dt|�d�D]V}||||d�d�}|||d?||d	?d
@||d?d
@||d
@7}q�W|dkr�d
|dd�<nF|dk�rd|dd�<n.|dk�r$d|dd�<n|dk�r:d|dd�<t|�S)NcSsg|]}t|f��qSr )r')�.0�ir r r!�
<listcomp>�szb32encode.<locals>.<listcomp>csg|]}�D]}||�qqSr r )r1�a�b)�b32tabr r!r3�s��r�big��i��
�s======��s====��s===�=i�������������)�_b32tab2�_b32alphabetrrrr�len�	bytearray�int�
from_bytes�ranger')r�leftoverr*rKZb32tab2r2�cr )r6r!r�s4
*


c

Cs�tdkrdd�tt�D�at|�}t|�dr8tjd��|dk	r^t|�}|jtj	dd|��}|rj|j
�}t|�}|jd�}|t|�}t�}t}x�t
dt|�d�D]l}|||d�}d}	y"x|D]}
|	d	>||
}	q�WWn tk
r�tjd
�d�YnX||	jd	d�7}q�W|d�s(|dk�r2tjd��|�rz|�rz|	d	|K}	|	jd	d�}dd	|d}|d|�|dd�<t|�S)NcSsi|]\}}||�qSr r )r1�k�vr r r!�
<dictcomp>�szb32decode.<locals>.<dictcomp>�zIncorrect paddings01�OrBrr7zNon-base32 digit foundr9r=rAr@r>�+>rr=rAr@r>���)�_b32rev�	enumeraterGr"rHr$r-r&r'r(�upper�rstriprIrL�KeyError�to_bytes)
r�casefoldZmap01�lZpadchars�decodedZb32revr2Zquanta�accrNZlastrMr r r!r	�s@



cCstj|�j�S)N)r$ZhexlifyrX)rr r r!r
�scCs4t|�}|r|j�}tjd|�r*tjd��tj|�S)Ns	[^0-9A-F]zNon-base16 digit found)r"rXr+�searchr$r-Z	unhexlify)rr\r r r!r�s

s<~s~>c	s�t|t�st|�j�}t|�d}|r4|d|}tjdt|�d�j|�}����fdd�|D�}|r�|r�|ddkr��dd	|d<|d
d|�|d<d
j|�S)Nr@r8z!%dIcsRg|]J}�r|rdn6�r&|dkr&dn&�|d�|dd�|d�qS)�zi    �yi�^	�Ui9r )r1Zword)�chars�chars2�foldnuls�
foldspacesr r!r3!sz_85encode.<locals>.<listcomp>r=rarr7�rErErErE)	rrrrrH�struct�StructZunpack�join)	r5rdre�padrfrg�paddingZwords�chunksr )rdrerfrgr!�	_85encodes

ro)rg�wrapcolrl�adobecs�tdkr*dd�tdd�D�add�tD�at|tt|d|��|rHt���r�t|rVdnd�����fd	d�td
t����D�}|r�t|d
�d�kr�|jd�dj|��|r��t	7��S)NcSsg|]}t|f��qSr )r')r1r2r r r!r3Dsza85encode.<locals>.<listcomp>�!�vcSsg|]}tD]}||�qqSr )�	_a85chars)r1r4r5r r r!r3EsTr?r=csg|]}�||���qSr r )r1r2)�resultrpr r!r3Msrrh�
rE)
rtrL�
_a85chars2ro�	_A85START�maxrH�appendrk�_A85END)r5rgrprlrqrnr )rurpr!r/s"

s 	

)rgrq�ignorecharscCs�t|�}|rH|jt�s$tdjt���|jt�r<|dd�}n|dd�}tjd�j	}g}|j
}g}|j
}|j}	�x|dD�]�}
d|
ko�dkn�r||
�t|�dk�rrd}x|D]}
d	||
d
}q�Wy|||��Wn"tj
k
�rtd�d�YnX|	�qz|
dk�r0|�r&td
��|d�qz|�rX|
dk�rX|�rNtd��|d�qz|
|k�rfqzqztd|
��qzWdj|�}dt|�}
|
�r�|d|
�}|S)Nz1Ascii85 encoded byte sequences must end with {!r}r?z!I�ur@�!rr7rcrrzAscii85 overflowrazz inside Ascii85 5-tuplesrbzy inside Ascii85 5-tuples    zNon-Ascii85 digit found: %crh���rsuuuurr�u�z�y)r"�endswithr{r�format�
startswithrxrirj�packrz�clearrH�errorrk)r5rgrqr|�packIr^Zdecoded_appendZcurrZcurr_appendZ
curr_clear�xr_rurmr r r!rXsV







sU0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~cCs2tdkr$dd�tD�add�tD�at|tt|�S)NcSsg|]}t|f��qSr )r')r1r2r r r!r3�szb85encode.<locals>.<listcomp>cSsg|]}tD]}||�qqSr )�	_b85chars)r1r4r5r r r!r3�s)r��_b85alphabet�
_b85chars2ro)r5rlr r r!r�s	c
CsZtdkr0dgdaxtt�D]\}}|t|<qWt|�}t|�d}|d|}g}tjd�j}x�tdt|�d�D]�}|||d�}d}y"x|D]}|dt|}q�WWnJt	k
r�x2t|�D]&\}}t|dkr�t
d||�d�q�W�YnXy|j||��Wqttjk
�r2t
d|�d�YqtXqtWd	j
|�}	|�rV|	d|�}	|	S)
N�r7�~z!Irrcz#bad base85 character at position %dz+base85 overflow in hunk starting at byte %drh)�_b85decrWr�r"rHrirjr�rLrrrzr�rk)
r5r2rNrm�outr��chunkr_�jrur r r!r
�s<


�Lr@rAcCs`xZ|jt�}|sPx0t|�tkrB|jtt|��}|s8P||7}qWtj|�}|j|�qWdS)N)�read�
MAXBINSIZErHr$r%�write)�input�outputr�ns�liner r r!r�s

cCs,x&|j�}|sPtj|�}|j|�qWdS)N)�readliner$r.r�)r�r�r�rr r r!r�s
cCs�yt|�}Wn8tk
rD}zd|jj}t|�|�WYdd}~XnX|jdkrjd|j|jjf}t|��|jdkr�d|j|jjf}t|��dS)	Nz"expected bytes-like object, not %srNr5�Bz-expected single byte elements, not %r from %sr=z(expected 1-D data, not %d-D data from %s)rNr5r�)rrrrr��ndim)r�m�err�msgr r r!�_input_type_check�s

r�cCsPt|�g}x8tdt|�t�D]$}|||t�}|jtj|��qWdj|�S)Nrrh)r�rLrHr�rzr$r%rk)r�piecesr2r�r r r!rscCsddl}|jdtd�t|�S)NrzAencodestring() is a deprecated alias since 3.1, use encodebytes()r?)�warnings�warn�DeprecationWarningr)rr�r r r!�encodestringsr�cCst|�tj|�S)N)r�r$r.)rr r r!rscCsddl}|jdtd�t|�S)NrzHdecodestring() is a deprecated alias since Python 3.1, use decodebytes()r?)r�r�r�r)rr�r r r!�decodestring$sr�c	Csddl}ddl}y|j|jdd�d�\}}WnP|jk
r~}z2|j|_t|�td|jd�|jd�WYdd}~XnXt}xF|D]>\}}|dkr�t}|dkr�t	}|dkr�t	}|d	kr�t
�dSq�W|o�|dd
k�rt|dd��}|||jj�WdQRXn||j
j|jj�dS)Nrr=Zdeutz�usage: %s [-d|-e|-u|-t] [file|-]
        -d, -u: decode
        -e: encode (default)
        -t: encode and decode string 'Aladdin:open sesame'r?z-ez-dz-uz-t�-�rb)�sys�getopt�argvr��stderr�stdout�print�exitrr�test�open�buffer�stdin)	r�r�Zopts�argsr��func�or4�fr r r!�main.s0r�cCs<d}tt|��t|�}tt|��t|�}tt|��dS)NsAladdin:open sesame)r��reprrr)Zs0�s1�s2r r r!r�Hsr��__main__)N)NF)FN)F)FFF)F)1r+rir$�__all__r'rIrr"rrrrr(r/r0rrrGrFrVrr	r
rrtrwrxr{rorrr�r�r�r�rr
ZMAXLINESIZEr�rrr�rr�rr�r�r�rr r r r!�<module>	sf

	&
C

)H
-	
	


_sitebuiltins.cpython-36.pyc000064400000006555150335715140012066 0ustar003


 \+�@s@dZddlZGdd�de�ZGdd�de�ZGdd�de�ZdS)	z=
The objects used by the site module to add custom builtins.
�Nc@s&eZdZdd�Zdd�Zddd�ZdS)	�QuittercCs||_||_dS)N)�name�eof)�selfrr�r�%/usr/lib64/python3.6/_sitebuiltins.py�__init__szQuitter.__init__cCsd|j|jfS)NzUse %s() or %s to exit)rr)rrrr�__repr__szQuitter.__repr__Nc	Cs(ytjj�WnYnXt|��dS)N)�sys�stdin�close�
SystemExit)r�coderrr�__call__s
zQuitter.__call__)N)�__name__�
__module__�__qualname__rr	rrrrrr
src@s:eZdZdZdZfffdd�Zdd�Zdd�Zd	d
�ZdS)�_Printerzninteractive prompt objects for printing the license text, a list of
    contributors and the copyright notice.�cs4ddl�||_||_d|_��fdd�|D�|_dS)Nrcs$g|]}�D]}�jj||��qqSr)�path�join)�.0�dir�filename)�files�osrr�
<listcomp>(sz%_Printer.__init__.<locals>.<listcomp>)r�_Printer__name�_Printer__data�_Printer__lines�_Printer__filenames)rr�datar�dirsr)rrrr#sz_Printer.__init__cCs~|jr
dSd}xH|jD]>}y$t|d��}|j�}WdQRXPWqtk
rRYqXqW|sb|j}|jd�|_t|j�|_dS)N�r�
)	rr �open�read�OSErrorr�split�len�_Printer__linecnt)rr!r�fprrr�__setup,s
z_Printer.__setupcCs8|j�t|j�|jkr$dj|j�Sd|jfdSdS)Nr$z!Type %s() to see the full %s text�)�_Printer__setupr)r�MAXLINESrr)rrrrr	<sz_Printer.__repr__cCs�|j�d}d}x�y,x&t|||j�D]}t|j|�q&WWntk
rTPYqX||j7}d}x |dkr�t|�}|dkrfd}qfW|dkrPqWdS)Nz0Hit Return for more, or q (and Return) to quit: r��q)r0r1)r.�ranger/�printr�
IndexError�input)r�prompt�lineno�i�keyrrrrCs"

z_Printer.__call__N)	rrr�__doc__r/rr.r	rrrrrrs	rc@s eZdZdZdd�Zdd�ZdS)�_Helpera3Define the builtin 'help'.

    This is a wrapper around pydoc.help that provides a helpful message
    when 'help' is typed at the Python interactive prompt.

    Calling help() at the Python prompt starts an interactive help session.
    Calling help(thing) prints help for the python object 'thing'.
    cCsdS)NzHType help() for interactive help, or help(object) for help about object.r)rrrrr	bsz_Helper.__repr__cOsddl}|j||�S)Nr)�pydoc�help)r�args�kwdsr<rrrresz_Helper.__call__N)rrrr:r	rrrrrr;Xsr;)r:r
�objectrrr;rrrr�<module>s;this.cpython-36.opt-2.pyc000064400000002363150335715140011111 0ustar003


 \��@sddZiZx>d	D]6Zx0ed�D]$Zeedde�eeee�<qWqWedjdd�eD���dS)
aXGur Mra bs Clguba, ol Gvz Crgref

Ornhgvshy vf orggre guna htyl.
Rkcyvpvg vf orggre guna vzcyvpvg.
Fvzcyr vf orggre guna pbzcyrk.
Pbzcyrk vf orggre guna pbzcyvpngrq.
Syng vf orggre guna arfgrq.
Fcnefr vf orggre guna qrafr.
Ernqnovyvgl pbhagf.
Fcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf.
Nygubhtu cenpgvpnyvgl orngf chevgl.
Reebef fubhyq arire cnff fvyragyl.
Hayrff rkcyvpvgyl fvyraprq.
Va gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff.
Gurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg.
Nygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh'er Qhgpu.
Abj vf orggre guna arire.
Nygubhtu arire vf bsgra orggre guna *evtug* abj.
Vs gur vzcyrzragngvba vf uneq gb rkcynva, vg'f n onq vqrn.
Vs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn.
Anzrfcnprf ner bar ubaxvat terng vqrn -- yrg'f qb zber bs gubfr!�A�a��
�cCsg|]}tj||��qS�)�d�get)�.0�crr�/usr/lib64/python3.6/this.py�
<listcomp>srN)rr)�srr
�range�i�chr�print�joinrrrr�<module>s

(smtplib.cpython-36.pyc000064400000105016150335715140010653 0ustar003


 \���@sndZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZdddddd	d
ddd
ddgZdZdZdZdZdZejdej�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd	�d	e�Z Gdd
�d
e�Z!Gdd�de�Z"Gd d�de�Z#d!d
�Z$d"d#�Z%d$d�Z&d%d&�Z'd'd(�Z(yddl)Z)Wne*k
�r�d)Z+YnXd*Z+Gd+d�d�Z,e+�r�Gd,d-�d-e,�Z-ej.d-�d.Z/Gd/d0�d0e,�Z0e1d1k�rjd2d3�Z2e2d4�Z3e2d5�j4d6�Z5e6d7�d8Z7x ej8j9�Z:e:�s$Pe7e:Z7�qWe6d9e;e7��e,d:�Z<e<j=d;�e<j>e3e5e7�e<j?�dS)<aSMTP/ESMTP client class.

This should follow RFC 821 (SMTP), RFC 1869 (ESMTP), RFC 2554 (SMTP
Authentication) and RFC 2487 (Secure SMTP over TLS).

Notes:

Please remember, when doing ESMTP, that the names of the SMTP service
extensions are NOT the same thing as the option keywords for the RCPT
and MAIL commands!

Example:

  >>> import smtplib
  >>> s=smtplib.SMTP("localhost")
  >>> print(s.help())
  This is Sendmail version 8.8.4
  Topics:
      HELO    EHLO    MAIL    RCPT    DATA
      RSET    NOOP    QUIT    HELP    VRFY
      EXPN    VERB    ETRN    DSN
  For more info use "HELP <topic>".
  To report bugs in the implementation send email to
      sendmail-bugs@sendmail.org.
  For local information send email to Postmaster at your site.
  End of HELP info
  >>> s.putcmd("vrfy","someone@here")
  >>> s.getreply()
  (250, "Somebody OverHere <somebody@here.my.org>")
  >>> s.quit()
�N)�body_encode�
SMTPException�SMTPServerDisconnected�SMTPResponseException�SMTPSenderRefused�SMTPRecipientsRefused�
SMTPDataError�SMTPConnectError�
SMTPHeloError�SMTPAuthenticationError�	quoteaddr�	quotedata�SMTP�i�z
s
i z	auth=(.*)c@seZdZdZdS)rz4Base class for all exceptions raised by this module.N)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.6/smtplib.pyrGsc@seZdZdZdS)�SMTPNotSupportedErrorz�The command or option is not supported by the SMTP server.

    This exception is raised when an attempt is made to run a command or a
    command with an option which is not supported by the server.
    N)rrrrrrrrrJsrc@seZdZdZdS)rz�Not connected to any SMTP server.

    This exception is raised when the server unexpectedly disconnects,
    or when an attempt is made to use the SMTP instance before
    connecting it to a server.
    N)rrrrrrrrrQsc@seZdZdZdd�ZdS)ra2Base class for all exceptions that include an SMTP error code.

    These exceptions are generated in some instances when the SMTP
    server returns an error code.  The error code is stored in the
    `smtp_code' attribute of the error, and the `smtp_error' attribute
    is set to the error message.
    cCs||_||_||f|_dS)N)�	smtp_code�
smtp_error�args)�self�code�msgrrr�__init__bszSMTPResponseException.__init__N)rrrrrrrrrrYsc@seZdZdZdd�ZdS)rz�Sender address refused.

    In addition to the attributes set by on all SMTPResponseException
    exceptions, this sets `sender' to the string that the SMTP refused.
    cCs"||_||_||_|||f|_dS)N)rr�senderr)rrrrrrrrnszSMTPSenderRefused.__init__N)rrrrrrrrrrgsc@seZdZdZdd�ZdS)rz�All recipient addresses refused.

    The errors for each recipient are accessible through the attribute
    'recipients', which is a dictionary of exactly the same sort as
    SMTP.sendmail() returns.
    cCs||_|f|_dS)N)�
recipientsr)rrrrrr|szSMTPRecipientsRefused.__init__N)rrrrrrrrrrtsc@seZdZdZdS)rz'The SMTP server didn't accept the data.N)rrrrrrrrr�sc@seZdZdZdS)r	z&Error during connection establishment.N)rrrrrrrrr	�sc@seZdZdZdS)r
z"The server refused our HELO reply.N)rrrrrrrrr
�sc@seZdZdZdS)rzvAuthentication error.

    Most probably the server didn't accept the username/password
    combination provided.
    N)rrrrrrrrr�scCs>tjj|�\}}||fdkr6|j�jd�r.|Sd|Sd|S)z�Quote a subset of the email addresses defined by RFC 821.

    Should be able to handle anything email.utils.parseaddr can handle.
    ��<z<%s>)r r )�email�utils�	parseaddr�strip�
startswith)�
addrstring�displayname�addrrrrr�scCs$tjj|�\}}||fdkr |S|S)Nr )r r )r"r#r$)r'r(r)rrr�
_addr_only�sr*cCstjddtjdt|��S)z�Quote data for email.

    Double leading '.', and change Unix newline '\n', or Mac '\r' into
    Internet CRLF end-of-line.
    z(?m)^\.z..z(?:\r\n|\n|\r(?!\n)))�re�sub�CRLF)�datarrrr
�scCstjdd|�S)Ns(?m)^\.s..)r+r,)Zbindatarrr�_quote_periods�sr/cCstjdt|�S)Nz(?:\r\n|\n|\r(?!\n)))r+r,r-)r.rrr�	_fix_eols�sr0FTc@s�eZdZdZdZdZdZdZdZdZ	e
Zdddej
dfdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�ZdMdd�Zdd�ZdNdd�Zdd�ZdOdd�ZdPdd�ZdQdd �Zd!d"�ZdRd#d$�Zd%d&�Zd'd(�Zd)d*�Zffd+d,�Z ffd-d.�Z!d/d0�Z"d1d2�Z#e#Z$d3d4�Z%d5d6�Z&d7d8�d9d:�Z'dSd;d<�Z(dTd=d>�Z)dUd?d@�Z*d7d8�dAdB�Z+dVdCdD�Z,fffdEdF�Z-ddfffdGdH�Z.dIdJ�Z/dKdL�Z0dS)Wra�This class manages a connection to an SMTP or ESMTP server.
    SMTP Objects:
        SMTP objects have the following attributes:
            helo_resp
                This is the message given by the server in response to the
                most recent HELO command.

            ehlo_resp
                This is the message given by the server in response to the
                most recent EHLO command. This is usually multiline.

            does_esmtp
                This is a True value _after you do an EHLO command_, if the
                server supports ESMTP.

            esmtp_features
                This is a dictionary, which, if the server supports ESMTP,
                will _after you do an EHLO command_, contain the names of the
                SMTP service extensions this server supports, and their
                parameters (if any).

                Note, all extension names are mapped to lower case in the
                dictionary.

        See each method's docstrings for details.  In general, there is a
        method of the same name to perform each SMTP command.  There is also a
        method called 'sendmail' that will do an entire mail transaction.
        rN�ehlor c
Cs�||_||_i|_d|_||_|rL|j||�\}}|dkrL|j�t||��|dk	r\||_nPt	j
�}d|krt||_n8d}	yt	jt	j��}	Wnt	j
k
r�YnXd|	|_dS)aInitialize a new instance.

        If specified, `host' is the name of the remote host to which to
        connect.  If specified, `port' specifies the port to which to connect.
        By default, smtplib.SMTP_PORT is used.  If a host is specified the
        connect method is called, and if it returns anything other than a
        success code an SMTPConnectError is raised.  If specified,
        `local_hostname` is used as the FQDN of the local host in the HELO/EHLO
        command.  Otherwise, the local hostname is found using
        socket.getfqdn(). The `source_address` parameter takes a 2-tuple (host,
        port) for the socket to bind to as its source address before
        connecting. If the host is '' and port is 0, the OS default behavior
        will be used.

        �ascii��N�.z	127.0.0.1z[%s])�_host�timeout�esmtp_features�command_encoding�source_address�connect�closer	�local_hostname�socketZgetfqdnZ
gethostbynameZgethostnameZgaierror)
r�host�portr<r6r9rrZfqdnr)rrrr�s*
z
SMTP.__init__cCs|S)Nr)rrrr�	__enter__szSMTP.__enter__cGsNz>y$|jd�\}}|dkr$t||��Wntk
r:YnXWd|j�XdS)NZQUIT��)�docmdrrr;)rrr�messagerrr�__exit__s
z
SMTP.__exit__cCs
||_dS)z�Set the debug output level.

        A non-false value results in debug messages for connection and for all
        messages sent to and received from the server.

        N)�
debuglevel)rrErrr�set_debuglevelszSMTP.set_debuglevelcGs@|jdkr,ttjj�j�f|�dtji�nt|dtji�dS)N��file)rE�print�datetimeZnowZtime�sys�stderr)rrrrr�_print_debug's
"zSMTP._print_debugcCs2|jdkr|jd||f|j�tj||f||j�S)Nrzconnect: to)rErMr9r=�create_connection)rr>r?r6rrr�_get_socket-s
zSMTP._get_socket�	localhostcCs�|r
||_|r~|jd�|jd�kr~|jd�}|dkr~|d|�||dd�}}yt|�}Wntk
r|td��YnX|s�|j}|jdkr�|jd||f�|j	|||j
�|_d|_|j
�\}}|jdkr�|jdt|��||fS)apConnect to a host on a given port.

        If the hostname ends with a colon (`:') followed by a number, and
        there is no port specified, that suffix will be stripped off and the
        number interpreted as the port number to use.

        Note: This method is automatically invoked by __init__, if a host is
        specified during instantiation.

        �:rNrGznonnumeric portzconnect:)r9�find�rfind�int�
ValueError�OSError�default_portrErMrOr6�sockrH�getreply�repr)rr>r?r9�irrrrrr:5s(


zSMTP.connectcCs�|jdkr|jdt|��t|d�rx|jrxt|t�r@|j|j�}y|jj	|�Wq�t
k
rt|j�td��Yq�Xntd��dS)zSend `s' to the server.rzsend:rXzServer not connectedzplease run connect() firstN)
rErMrZ�hasattrrX�
isinstance�str�encoder8ZsendallrVr;r)r�srrr�sendWs

z	SMTP.sendcCs2|dkrd|tf}nd||tf}|j|�dS)zSend a command to the server.r z%s%sz%s %s%sN)r-ra)r�cmdrr^rrr�putcmdiszSMTP.putcmdcCsPg}|jdkr|jjd�|_�xy|jjtd�}Wn:tk
rn}z|j�tdt|���WYdd}~XnX|s�|j�td��|j	dkr�|j
dt|��t|�tkr�|j�t
dd	��|j|d
d�jd��|dd�}yt|�}Wntk
�rd}PYnX|dd
�d
kr Pq Wdj|�}|j	dk�rH|j
d||f�||fS)a�Get a reply from the server.

        Returns a tuple consisting of:

          - server response code (e.g. '250', or such, if all goes well)
            Note: returns -1 if it can't read response code.

          - server response string corresponding to response code (multiline
            responses are converted to a single, multiline string).

        Raises SMTPServerDisconnected if end-of-file is reached.
        N�rbrGz Connection unexpectedly closed: zConnection unexpectedly closedrzreply:i�zLine too long.�s 	
��-�
zreply: retcode (%s); Msg: %a���)rHrX�makefile�readline�_MAXLINErVr;rr^rErMrZ�lenr�appendr%rTrU�join)r�resp�line�erZerrcode�errmsgrrrrYqs>




z
SMTP.getreplycCs|j||�|j�S)z-Send a command, and return its response code.)rcrY)rrbrrrrrB�sz
SMTP.docmdcCs,|jd|p|j�|j�\}}||_||fS)zwSMTP 'helo' command.
        Hostname to send for this command defaults to the FQDN of the local
        host.
        �helo)rcr<rY�	helo_resp)r�namerrrrrrt�sz	SMTP.heloc
CsLi|_|j|j|p|j�|j�\}}|d
krJt|�dkrJ|j�td��||_|dkr`||fSd|_	t
|jt�s�tt
|j���|jjd�jd�}|d=x�|D]�}tj|�}|r�|jjdd�d	|jd�d|jd<q�tjd
|�}|r�|jd�j�}|j|jd�d�j�}	|dk�r6|jj|d�d	|	|j|<q�|	|j|<q�W||fS)zx SMTP 'ehlo' command.
        Hostname to send for this command defaults to the FQDN of the local
        host.
        rGrzServer not connected�zlatin-1�
�authr � z((?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*) ?�featureNri)r7rc�ehlo_msgr<rYrmr;r�	ehlo_resp�
does_esmtpr]�bytes�AssertionErrorrZ�decode�split�
OLDSTYLE_AUTH�match�get�groupsr+�group�lower�string�endr%)
rrvrrrp�eachZ
auth_match�mr{Zparamsrrrr1�s4

&
z	SMTP.ehlocCs|j�|jkS)z7Does the server support a given SMTP service extension?)r�r7)r�optrrr�has_extn�sz
SMTP.has_extncCs|jd|�|j�dS)z;SMTP 'help' command.
        Returns help text from server.�helprG)rcrY)rrrrrr��sz	SMTP.helpcCsd|_|jd�S)z&SMTP 'rset' command -- resets session.r2�rset)r8rB)rrrrr��sz	SMTP.rsetcCs&y|j�Wntk
r YnXdS)aInternal 'rset' command which ignores any SMTPServerDisconnected error.

        Used internally in the library, since the server disconnected error
        should appear to the application when the *next* command is issued, if
        we are doing an internal "safety" reset.
        N)r�r)rrrr�_rset�sz
SMTP._rsetcCs
|jd�S)z-SMTP 'noop' command -- doesn't do anything :>�noop)rB)rrrrr�sz	SMTP.noopcCshd}|rH|jrHtdd�|D��r:|jd�r2d|_ntd��ddj|�}|jdd	t|�|f�|j�S)
a8SMTP 'mail' command -- begins mail xfer session.

        This method may raise the following exceptions:

         SMTPNotSupportedError  The options parameter includes 'SMTPUTF8'
                                but the SMTPUTF8 extension is not supported by
                                the server.
        r css|]}|j�dkVqdS)�smtputf8N)r�)�.0�xrrr�	<genexpr>szSMTP.mail.<locals>.<genexpr>r�zutf-8z SMTPUTF8 not supported by serverrz�mailz	FROM:%s%s)	r~�anyr�r8rrorcrrY)rr�options�
optionlistrrrr�s	

z	SMTP.mailcCs<d}|r|jrddj|�}|jddt|�|f�|j�S)z;SMTP 'rcpt' command -- indicates 1 recipient for this mail.r rz�rcptzTO:%s%s)r~rorcrrY)rZrecipr�r�rrrr�s

z	SMTP.rcptcCs�|jd�|j�\}}|jdkr0|jd||f�|dkrDt||��n|t|t�r\t|�jd�}t	|�}|d	d�t
kr||t
}|dt
}|j|�|j�\}}|jdkr�|jd||f�||fSdS)
a�SMTP 'DATA' command -- sends message data to server.

        Automatically quotes lines beginning with a period per rfc821.
        Raises SMTPDataError if there is an unexpected reply to the
        DATA command; the return value from this method is the final
        response code received when the all data is sent.  If msg
        is a string, lone '\r' and '\n' characters are converted to
        '\r\n' characters.  If msg is bytes, it is transmitted as is.
        r.rzdata:ibr2�N�.���)rcrYrErMrr]r^r0r_r/�bCRLFra)rrr�repl�qrrrr.!s"





z	SMTP.datacCs|jdt|��|j�S)z5SMTP 'verify' command -- checks for address validity.�vrfy)rcr*rY)r�addressrrr�verify>szSMTP.verifycCs|jdt|��|j�S)z.SMTP 'expn' command -- expands a mailing list.�expn)rcr*rY)rr�rrrr�Esz	SMTP.expncCsf|jdkrb|jdkrbd|j�dko.dknsb|j�\}}d|koRdknsbt||��dS)abCall self.ehlo() and/or self.helo() if needed.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
        N��ri+)rur}r1rtr
)rrrprrr�ehlo_or_helo_if_neededLs
 zSMTP.ehlo_or_helo_if_neededT)�initial_response_okc	Cs�|j�}|r|�nd}|dk	rJt|jd�dd�}|jd|d|�\}}n|jd|�\}}|dkr�tj|�}t||�jd�dd�}|j|�\}}|d
kr�||fSt||��dS)a�Authentication command - requires response processing.

        'mechanism' specifies which authentication mechanism is to
        be used - the valid values are those listed in the 'auth'
        element of 'esmtp_features'.

        'authobject' must be a callable object taking a single argument:

                data = authobject(challenge)

        It will be called to process the server's challenge response; the
        challenge argument it is passed will be a bytes.  It should return
        an ASCII string that will be base64 encoded and sent to the server.

        Keyword arguments:
            - initial_response_ok: Allow sending the RFC 4954 initial-response
              to the AUTH command, if the authentication methods supports it.
        Nr2r )ZeolZAUTHrziN���)r�r�)�upper�
encode_base64r_rB�base64Zdecodebytesr)	rZ	mechanismZ
authobjectr�Zinitial_responseZresponserrp�	challengerrrry]s
z	SMTP.authcCs0|dkrdS|jdtj|jjd�|d�j�S)zh Authobject to use with CRAM-MD5 authentication. Requires self.user
        and self.password to be set.Nrzr2Zmd5)�user�hmacZHMAC�passwordr_Z	hexdigest)rr�rrr�
auth_cram_md5�szSMTP.auth_cram_md5cCsd|j|jfS)ze Authobject to use with PLAIN authentication. Requires self.user and
        self.password to be set.z%s%s)r�r�)rr�rrr�
auth_plain�szSMTP.auth_plaincCs|dkr|jS|jSdS)ze Authobject to use with LOGIN authentication. Requires self.user and
        self.password to be set.N)r�r�)rr�rrr�
auth_login�szSMTP.auth_logincs�|j�|jd�std��|jdj��dddg}�fdd�|D�}|sPtd��|||_|_xv|D]n}d	|j�j	d
d�}y.|j
|t||�|d�\}}	|dkr�||	fSWqdtk
r�}
z
|
}WYdd}
~
XqdXqdW|�dS)awLog in on an SMTP server that requires authentication.

        The arguments are:
            - user:         The user name to authenticate with.
            - password:     The password for the authentication.

        Keyword arguments:
            - initial_response_ok: Allow sending the RFC 4954 initial-response
              to the AUTH command, if the authentication methods supports it.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.

        This method will return normally if the authentication was successful.

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
         SMTPAuthenticationError  The server didn't accept the username/
                                  password combination.
         SMTPNotSupportedError    The AUTH command is not supported by the
                                  server.
         SMTPException            No suitable authentication method was
                                  found.
        ryz,SMTP AUTH extension not supported by server.zCRAM-MD5ZPLAINZLOGINcsg|]}|�kr|�qSrr)r�ry)�advertised_authlistrr�
<listcomp>�szSMTP.login.<locals>.<listcomp>z(No suitable authentication method found.Zauth_�-�_)r�r��N)r�r�)
r�r�rr7r�rr�r�r��replacery�getattrr)rr�r�r�Zpreferred_authsZauthlistZ
authmethodZmethod_namerrprrZlast_exceptionr)r�r�login�s*



z
SMTP.logincCs�|j�|jd�std��|jd�\}}|dkr�ts<td��|dk	rT|dk	rTtd��|dk	rl|dk	rltd��|dk	s||dk	r�d	dl}|jd
t	d�|dkr�t
j||d�}|j|j
|jd
�|_
d|_d|_d|_i|_d	|_n
t||��||fS)a�Puts the connection to the SMTP server into TLS mode.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.

        If the server supports TLS, this will encrypt the rest of the SMTP
        session. If you provide the keyfile and certfile parameters,
        the identity of the SMTP server and client can be checked. This,
        however, depends on whether the socket module really checks the
        certificates.

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
        �starttlsz+STARTTLS extension not supported by server.ZSTARTTLSr3z&No SSL support included in this PythonNz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadr�)�certfile�keyfile)�server_hostname)r�r�rrB�	_have_ssl�RuntimeErrorrU�warnings�warn�DeprecationWarning�ssl�_create_stdlib_context�wrap_socketrXr5rHrur}r7r~r)rr�r��contextrpZreplyr�rrrr��s8

z
SMTP.starttlscCsf|j�g}t|t�r$t|�jd�}|jr^|jd�rF|jdt|��x|D]}|j|�qLW|j	||�\}}	|dkr�|dkr�|j
�n|j�t||	|��i}
t|t�r�|g}xP|D]H}|j
||�\}}	|dkr�|dkr�||	f|
|<|dkr�|j
�t|
��q�Wt|
�t|�k�r$|j�t|
��|j|�\}}	|dk�rb|dk�rP|j
�n|j�t||	��|
S)a|This command performs an entire mail transaction.

        The arguments are:
            - from_addr    : The address sending this mail.
            - to_addrs     : A list of addresses to send this mail to.  A bare
                             string will be treated as a list with 1 address.
            - msg          : The message to send.
            - mail_options : List of ESMTP options (such as 8bitmime) for the
                             mail command.
            - rcpt_options : List of ESMTP options (such as DSN commands) for
                             all the rcpt commands.

        msg may be a string containing characters in the ASCII range, or a byte
        string.  A string is encoded to bytes using the ascii codec, and lone
        \r and \n characters are converted to \r\n characters.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.  If the server does ESMTP, message size
        and each of the specified options will be passed to it.  If EHLO
        fails, HELO will be tried and ESMTP options suppressed.

        This method will return normally if the mail is accepted for at least
        one recipient.  It returns a dictionary, with one entry for each
        recipient that was refused.  Each entry contains a tuple of the SMTP
        error code and the accompanying error message sent by the server.

        This method may raise the following exceptions:

         SMTPHeloError          The server didn't reply properly to
                                the helo greeting.
         SMTPRecipientsRefused  The server rejected ALL recipients
                                (no mail was sent).
         SMTPSenderRefused      The server didn't accept the from_addr.
         SMTPDataError          The server replied with an unexpected
                                error code (other than a refusal of
                                a recipient).
         SMTPNotSupportedError  The mail_options parameter includes 'SMTPUTF8'
                                but the SMTPUTF8 extension is not supported by
                                the server.

        Note: the connection will be open even after an exception is raised.

        Example:

         >>> import smtplib
         >>> s=smtplib.SMTP("localhost")
         >>> tolist=["one@one.org","two@two.org","three@three.org","four@four.org"]
         >>> msg = '''\
         ... From: Me@my.org
         ... Subject: testin'...
         ...
         ... This is a test '''
         >>> s.sendmail("me@my.org",tolist,msg)
         { "three@three.org" : ( 550 ,"User unknown" ) }
         >>> s.quit()

        In the above example, the message was accepted for delivery to three
        of the four addresses, and one was rejected, with the error code
        550.  If all addresses are accepted, then the method will return an
        empty dictionary.

        r2�sizezsize=%drwi��)r�r]r^r0r_r~r�rnrmr�r;r�rr�rr.r)r�	from_addr�to_addrsr�mail_options�rcpt_optionsZ
esmtp_optsZoptionrrpZsenderrsr�rrr�sendmailsF@









z
SMTP.sendmailcCs�|j�|jd�}|dkr d}nt|�dkr2d}ntd��|dkr||d|krZ||dn
||d}tjj|g�d	d}|dkr�d
d�||d||d
||dfD�}dd�tjj|�D�}tj|�}	|	d
=|	d=d}
ydj|f|��j	d�Wn.t
k
�r(|jd��s td��d}
YnXt
j��R}|
�r^tjj||jjdd�d�}|d�}ntjj|�}|j|	dd�|j�}
WdQRX|j|||
||�S)a~Converts message to a bytestring and passes it to sendmail.

        The arguments are as for sendmail, except that msg is an
        email.message.Message object.  If from_addr is None or to_addrs is
        None, these arguments are taken from the headers of the Message as
        described in RFC 2822 (a ValueError is raised if there is more than
        one set of 'Resent-' headers).  Regardless of the values of from_addr and
        to_addr, any Bcc field (or Resent-Bcc field, when the Message is a
        resent) of the Message object won't be transmitted.  The Message
        object is then serialized using email.generator.BytesGenerator and
        sendmail is called to transmit the message.  If the sender or any of
        the recipient addresses contain non-ASCII and the server advertises the
        SMTPUTF8 capability, the policy is cloned with utf8 set to True for the
        serialization, and SMTPUTF8 and BODY=8BITMIME are asserted on the send.
        If the server does not support SMTPUTF8, an SMTPNotSupported error is
        raised.  Otherwise the generator is called without modifying the
        policy.

        zResent-DateNr rGzResent-z0message has more than one 'Resent-' header blockZSender�FromrcSsg|]}|dk	r|�qS)Nr)r��frrrr��sz%SMTP.send_message.<locals>.<listcomp>�ToZBccZCccSsg|]}|d�qS)rGr)r��arrrr��sz
Resent-BccFr2r�z�One or more source or delivery addresses require internationalized email support, but the server does not advertise the required SMTPUTF8 capabilityT)�utf8)�policy�SMTPUTF8�
BODY=8BITMIMEz
)�linesep)r�r�)r�Zget_allrmrUr"r#Zgetaddresses�copyror_�UnicodeEncodeErrorr�r�io�BytesIO�	generatorZBytesGeneratorr�ZcloneZflatten�getvaluer�)rrr�r�r�r�ZresentZ
header_prefixZaddr_fieldsZmsg_copyZ
internationalZbytesmsg�gZflatmsgrrr�send_message|sJ





zSMTP.send_messagecCs<z|j}d|_|r|j�Wd|j}d|_|r6|j�XdS)z(Close the connection to the SMTP server.N)rHr;rX)rrHrXrrrr;�sz
SMTP.closecCs.|jd�}d|_|_i|_d|_|j�|S)zTerminate the SMTP session.�quitNF)rBr}rur7r~r;)r�resrrrr��s
z	SMTP.quit)rPrN)r )r )r )r )r )N)N)N)NNN)1rrrrrErHrur|r}r~�	SMTP_PORTrWr=�_GLOBAL_DEFAULT_TIMEOUTrr@rDrFrMrOr:rarcrYrBrtr1r�r�r�r�r�r�r�r.r�r�r�r�ryr�r�r�r�r�r�r�r;r�rrrrr�s^-
	
"
1



3
'
	

B
8gL
c@s8eZdZdZeZdddddejddfdd�Zdd�Z	dS)	�SMTP_SSLa� This is a subclass derived from SMTP that connects over an SSL
        encrypted socket (to use this class you need a socket module that was
        compiled with SSL support). If host is not specified, '' (the local
        host) is used. If port is omitted, the standard SMTP-over-SSL port
        (465) is used.  local_hostname and source_address have the same meaning
        as they do in the SMTP class.  keyfile and certfile are also optional -
        they can contain a PEM formatted private key and certificate chain file
        for the SSL connection. context also optional, can contain a
        SSLContext, and is an alternative to keyfile and certfile; If it is
        specified both keyfile and certfile must be None.

        r rNc	
Cs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}	|	jdtd�||_||_|dkrxtj||d�}||_t	j
||||||�dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadr�)r�r�)rUr�r�r�r�r�r�r�r�rr)
rr>r?r<r�r�r6r9r�r�rrrr�s zSMTP_SSL.__init__cCsD|jdkr|jd||f�tj||f||j�}|jj||jd�}|S)Nrzconnect:)r�)rErMr=rNr9r�r�r5)rr>r?r6Z
new_socketrrrrO	s

zSMTP_SSL._get_socket)
rrrr�
SMTP_SSL_PORTrWr=r�rrOrrrrr��sr�i�c@s0eZdZdZdZdeddfdd�Zdd	d
�ZdS)�LMTPa�LMTP - Local Mail Transfer Protocol

    The LMTP protocol, which is very similar to ESMTP, is heavily based
    on the standard SMTP client. It's common to use Unix sockets for
    LMTP, so our connect() method must support that as well as a regular
    host:port server.  local_hostname and source_address have the same
    meaning as they do in the SMTP class.  To specify a Unix socket,
    you must use an absolute path as the host, starting with a '/'.

    Authentication is supported, using the regular SMTP mechanism. When
    using a Unix socket, LMTP generally don't support or require any
    authentication, but your mileage might vary.Zlhlor NcCstj|||||d�dS)zInitialize a new instance.)r<r9N)rr)rr>r?r<r9rrrr)sz
LMTP.__init__rPrcCs�|ddkrtj||||d�Sy(tjtjtj�|_d|_|jj|�WnBtk
r�|jdkrl|j	d|�|jr||jj
�d|_�YnX|j�\}}|jdkr�|j	d|�||fS)z=Connect to the LMTP daemon, on either a Unix or a TCP socket.r�/)r9Nz
connect fail:zconnect:)rr:r=ZAF_UNIXZSOCK_STREAMrXrHrVrErMr;rY)rr>r?r9rrrrrr:/s"


zLMTP.connect)rPrN)rrrrr|�	LMTP_PORTrr:rrrrr�s
r��__main__cCs(tjj|d�tjj�tjj�j�S)Nz: )rK�stdout�write�flush�stdinrkr%)�promptrrrr�Is
r�r�r��,zEnter message, end with ^D:r zMessage length is %drPrG)@rr=r�r+Zemail.utilsr"Z
email.messageZemail.generatorr�r�r�rJrKZemail.base64mimerr��__all__r�r�r-r�rl�compile�Ir�rVrrrrrrrr	r
rrr*r
r/r0r��ImportErrorr�rr�rnr�r�rr�Zfromaddrr�ZtoaddrsrIrr�rkrqrmZserverrFr�r�rrrr�<module>!s�



	
)0
/


tabnanny.cpython-36.pyc000064400000015501150335715140011012 0ustar003


 \�,�@s�dZdZddlZddlZddlZddlZeed�s:ed��dddgZda	da
d	d
�Zdd�ZGd
d�de
�Zdd�ZGdd�d�Zdd�Zdd�Zedkr�e�dS)a�The Tab Nanny despises ambiguous indentation.  She knows no mercy.

tabnanny -- Detection of ambiguous indentation

For the time being this module is intended to be called as a script.
However it is possible to import it into an IDE and use the function
check() described below.

Warning: The API provided by this module is likely to change in future
releases; such changes may not be backward compatible.
�6�N�NLz4tokenize.NL doesn't exist -- tokenize module too old�check�NannyNag�process_tokenscGs:d}x$|D]}tjj|t|��d}q
Wtjjd�dS)N�� �
)�sys�stderr�write�str)�args�sep�arg�r� /usr/lib64/python3.6/tabnanny.py�errprint#s

rcCs�ytjtjdd�d�\}}Wn*tjk
rH}zt|�dSd}~XnXx0|D](\}}|dkrhtda|dkrPtdaqPW|s�tdtjdd�dSx|D]}t|�q�WdS)N�Zqvz-qz-vzUsage:rz[-v] file_or_directory ...)�getoptr
�argv�errorr�
filename_only�verboser)Zoptsr�msg�o�arrrr�main*s
rc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)rzk
    Raised by process_tokens() if detecting an ambiguous indent.
    Captured and handled in check().
    cCs||||_|_|_dS)N)�linenor�line)�selfrrrrrr�__init__AszNannyNag.__init__cCs|jS)N)r)r rrr�
get_linenoCszNannyNag.get_linenocCs|jS)N)r)r rrr�get_msgEszNannyNag.get_msgcCs|jS)N)r)r rrr�get_lineGszNannyNag.get_lineN)�__name__�
__module__�__qualname__�__doc__r!r"r#r$rrrrr<s
c	%Cs"tjj|�r�tjj|�r�tr,td|f�tj|�}xT|D]L}tjj||�}tjj|�rhtjj|�s�tjj|dd��dkr<t	|�q<WdSyt
j|�}Wn0tk
r�}zt
d||f�dSd}~XnXtdkr�td|��zytt
j|j��W�n�t
jk
�r2}zt
d||f�dSd}~Xn�tk
�rb}zt
d	||f�dSd}~Xn�tk
�r�}z||j�}|j�}t�r�td
||f�td|f�t|j��n6d|k�r�d
|d
}t�r�t|�nt||t|��dSd}~XnXWd|j�Xt�rtd|f�dS)a~check(file_or_dir)

    If file_or_dir is a directory and not a symbolic link, then recursively
    descend the directory tree named by file_or_dir, checking all .py files
    along the way. If file_or_dir is an ordinary Python source file, it is
    checked for whitespace related problems. The diagnostic messages are
    written to standard output using the print statement.
    z%r: listing directory�Nz.pyz%r: I/O Error: %srzchecking %r ...z%r: Token Error: %sz%r: Indentation Error: %sz)%r: *** Line %d: trouble in tab city! ***zoffending line: %rr�"z%r: Clean bill of health.���)�os�path�isdir�islinkr�print�listdir�join�normcaser�tokenize�open�OSErrorrr�generate_tokens�readline�
TokenError�IndentationErrorrr"r$r#r�repr�close)	�file�names�name�fullname�frZnag�badlinerrrrrJsT





c@sLeZdZd\ZZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZdS)�
Whitespacez 	c	Cs�||_tjtj}}g}d}}}x~|jD]t}||krJ|d}|d}q,||kr�|d}|d}|t|�kr�|dg|t|�d}||d||<d}q,Pq,W||_||_t|�|f|_t|�dk|_	dS)Nrr)
�rawrC�S�T�len�n�nt�tuple�norm�	is_simple)	r ZwsrErF�count�brHrIZchrrrr!�s(
zWhitespace.__init__cCs|j\}}tt|�d|�S)Nr)rK�maxrG)r rM�trailingrrr�longest_run_of_spaces�s
z Whitespace.longest_run_of_spacescCsL|j\}}d}x*t|t|��D]}|||||}qW||||jS)Nr)rK�rangerGrI)r �tabsizerMrPZil�irrr�indent_level�s

zWhitespace.indent_levelcCs|j|jkS)N)rK)r �otherrrr�equal�szWhitespace.equalcCsft|j�|j��d}g}xFtd|d�D]4}|j|�|j|�kr*|j||j|�|j|�f�q*W|S)Nr)rOrQrRrU�append)r rVrHr�tsrrr�not_equal_witness�szWhitespace.not_equal_witnesscCsr|j|jkrdS|jr(|jr(|j|jkSt|j�|j��d}x.td|d�D]}|j|�|j|�krNdSqNWdS)NFr�T)rHrLrIrOrQrRrU)r rVrHrYrrr�less�szWhitespace.lesscCsft|j�|j��d}g}xFtd|d�D]4}|j|�|j|�kr*|j||j|�|j|�f�q*W|S)Nr)rOrQrRrUrX)r rVrHrrYrrr�not_less_witnessszWhitespace.not_less_witnessN)r%r&r'rErFr!rQrUrWrZr\r]rrrrrC�srCcCs8dd�|D�}d}t|�dkr&|d}|ddj|�S)Ncss|]}t|d�VqdS)rN)r
)�.0�tuprrr�	<genexpr>sz#format_witnesses.<locals>.<genexpr>zat tab sizer�srz, )rGr2)�wZfirsts�prefixrrr�format_witnesses
s
rdcCstj}tj}tj}tjtjf}td�g}d}x�|D]�\}}}	}
}||krNd}q2||kr�d}t|�}|dj|�s�|dj|�}
dt	|
�}t
|	d||��|j|�q2||kr�d}|d=q2|o�||kr2d}t|�}|d	j|�s2|d
j
|�}
dt	|
�}t
|	d||��q2WdS)Nrrrzindent not greater e.g. zindent not equal e.g. ���rererere)r4�INDENT�DEDENT�NEWLINE�COMMENTrrCr\r]rdrrXrWrZ)�tokensrfrgrhZJUNK�indentsZcheck_equal�type�token�start�endrZthisguyZwitnessrrrrrs6

�__main__)r(�__version__r,r
rr4�hasattr�
ValueError�__all__rrrr�	ExceptionrrrCrdrr%rrrr�<module>
s(

=7traceback.cpython-36.pyc000064400000046300150335715140011120 0ustar003


 \�[�@s:dZddlZddlZddlZddlZddddddd	d
ddd
ddddddddgZd3dd�Zdd�Zd4dd�Zd5dd	�Z	d6dd�Z
dZdZd7dd�Z
d8d d�Zd!d�Zd"d#�Zd$d%�Zd9d&d
�Zd:d'd�Zd;d(d
�Zd<d)d�Zd=d*d�Zd>d+d�Zd,d�ZGd-d�d�Zd.d�Zd/d�Zd0ZGd1d�de�ZGd2d�d�ZdS)?z@Extract, format and print information about Python stack traces.�N�
extract_stack�
extract_tb�format_exception�format_exception_only�format_list�format_stack�	format_tb�	print_exc�
format_exc�print_exception�
print_last�print_stack�print_tb�clear_frames�FrameSummary�StackSummary�TracebackException�
walk_stack�walk_tbcCs8|dkrtj}x$tj|�j�D]}t||dd�qWdS)zyPrint the list of tuples as returned by extract_tb() or
    extract_stack() as a formatted stack trace to the given file.N�)�file�end)�sys�stderrr�	from_list�format�print)�extracted_listr�item�r�!/usr/lib64/python3.6/traceback.py�
print_listsr!cCstj|�j�S)a�Format a list of tuples or FrameSummary objects for printing.

    Given a list of tuples or FrameSummary objects as returned by
    extract_tb() or extract_stack(), return a list of strings ready
    for printing.

    Each string in the resulting list corresponds to the item with the
    same index in the argument list.  Each string ends in a newline;
    the strings may contain internal newlines as well, for those items
    whose source text line is not None.
    )rrr)rrrr rscCstt||d�|d�dS)aPrint up to 'limit' stack trace entries from the traceback 'tb'.

    If 'limit' is omitted or None, all entries are printed.  If 'file'
    is omitted or None, the output goes to sys.stderr; otherwise
    'file' should be an open file or file-like object with a write()
    method.
    )�limit)rN)r!r)�tbr"rrrr r-scCst||d�j�S)z5A shorthand for 'format_list(extract_tb(tb, limit))'.)r")rr)r#r"rrr r7scCstjt|�|d�S)a#
    Return a StackSummary object representing a list of
    pre-processed entries from traceback.

    This is useful for alternate formatting of stack traces.  If
    'limit' is omitted or None, all entries are extracted.  A
    pre-processed stack trace entry is a FrameSummary object
    containing attributes filename, lineno, name, and line
    representing the information that is usually printed for a stack
    trace.  The line is a string with leading and trailing
    whitespace stripped; if the source is not available it is None.
    )r")r�extractr)r#r"rrr r;s
zG
The above exception was the direct cause of the following exception:

zF
During handling of the above exception, another exception occurred:

TcCsF|dkrtj}x2tt|�|||d�j|d�D]}t||dd�q,WdS)a�Print exception up to 'limit' stack trace entries from 'tb' to 'file'.

    This differs from print_tb() in the following ways: (1) if
    traceback is not None, it prints a header "Traceback (most recent
    call last):"; (2) it prints the exception type and value after the
    stack trace; (3) if type is SyntaxError and value has the
    appropriate format, it prints the line where the syntax error
    occurred with a caret on the next line indicating the approximate
    position of the error.
    N)r")�chainr)rr)rrr�typerr)�etype�valuer#r"rr%�linerrr rWs
cCs ttt|�|||d�j|d��S)azFormat a stack trace and the exception information.

    The arguments have the same meaning as the corresponding arguments
    to print_exception().  The return value is a list of strings, each
    ending in a newline and some containing internal newlines.  When
    these lines are concatenated and printed, exactly the same text is
    printed as does print_exception().
    )r")r%)�listrr&r)r'r(r#r"r%rrr rlscCstt||d�j��S)aFormat the exception part of a traceback.

    The arguments are the exception type and value such as given by
    sys.last_type and sys.last_value. The return value is a list of
    strings, each ending in a newline.

    Normally, the list contains a single string; however, for
    SyntaxError exceptions, it contains several lines that (when
    printed) display detailed information about where the syntax
    error occurred.

    The message indicating which exception occurred is always the last
    string in the list.

    N)r*rr)r'r(rrr r|scCs0t|�}|dks|r d|}nd||f}|S)Nz%s
z%s: %s
)�	_some_str)r'r(�valuestrr)rrr �_format_final_exc_line�s

r-c	Cs"yt|�Sdt|�jSdS)Nz<unprintable %s object>)�strr&�__name__)r(rrr r+�sr+cCsttj�|||d��dS)z>Shorthand for 'print_exception(*sys.exc_info(), limit, file)'.)r"rr%N)rr�exc_info)r"rr%rrr r	�scCsdjttj�||d���S)z%Like print_exc() but return a string.r)r"r%)�joinrrr0)r"r%rrr r
�scCs.ttd�std��ttjtjtj|||�dS)znThis is a shorthand for 'print_exception(sys.last_type,
    sys.last_value, sys.last_traceback, limit, file)'.�	last_typezno last exceptionN)�hasattrr�
ValueErrorrr2�
last_value�last_traceback)r"rr%rrr r�s
cCs*|dkrtj�j}tt||d�|d�dS)z�Print a stack trace from its invocation point.

    The optional 'f' argument can be used to specify an alternate
    stack frame at which to start. The optional 'limit' and 'file'
    arguments have the same meaning as for print_exception().
    N)r")r)r�	_getframe�f_backr!r)�fr"rrrr r
�s
cCs"|dkrtj�j}tt||d��S)z5Shorthand for 'format_list(extract_stack(f, limit))'.N)r")rr7r8rr)r9r"rrr r�s
cCs0|dkrtj�j}tjt|�|d�}|j�|S)asExtract the raw traceback from the current stack frame.

    The return value has the same format as for extract_tb().  The
    optional 'f' and 'limit' arguments have the same meaning as for
    print_stack().  Each item in the list is a quadruple (filename,
    line number, function name, text), and the entries are in order
    from oldest to newest stack frame.
    N)r")rr7r8rr$r�reverse)r9r"�stackrrr r�s
	
cCs<x6|dk	r6y|jj�Wntk
r,YnX|j}qWdS)zEClear all references to local variables in the frames of a traceback.N)�tb_frame�clear�RuntimeError�tb_next)r#rrr r�s
c@sReZdZdZdZdddd	�d
d�Zdd
�Zdd�Zdd�Zdd�Z	e
dd��ZdS)ra,A single frame from a traceback.

    - :attr:`filename` The filename for the frame.
    - :attr:`lineno` The line within filename for the frame that was
      active when the frame was captured.
    - :attr:`name` The name of the function or method that was executing
      when the frame was captured.
    - :attr:`line` The text from the linecache module for the
      of code that was running when the frame was captured.
    - :attr:`locals` Either None if locals were not supplied, or a dict
      mapping the name to the repr() of the variable.
    �filename�lineno�name�_line�localsTN)�lookup_linerDr)cCsF||_||_||_||_|r"|j|r<tdd�|j�D��nd|_dS)a�Construct a FrameSummary.

        :param lookup_line: If True, `linecache` is consulted for the source
            code line. Otherwise, the line will be looked up when first needed.
        :param locals: If supplied the frame locals, which will be captured as
            object representations.
        :param line: If provided, use this instead of looking up the line in
            the linecache.
        css|]\}}|t|�fVqdS)N)�repr)�.0�k�vrrr �	<genexpr>sz(FrameSummary.__init__.<locals>.<genexpr>N)r@rArBrCr)�dict�itemsrD)�selfr@rArBrErDr)rrr �__init__�szFrameSummary.__init__cCs`t|t�r:|j|jko8|j|jko8|j|jko8|j|jkSt|t�r\|j|j|j|jf|kStS)N)	�
isinstancerr@rArBrD�tupler)�NotImplemented)rM�otherrrr �__eq__s

zFrameSummary.__eq__cCs|j|j|j|jf|S)N)r@rArBr))rM�posrrr �__getitem__szFrameSummary.__getitem__cCst|j|j|j|jg�S)N)�iterr@rArBr))rMrrr �__iter__szFrameSummary.__iter__cCsdj|j|j|jd�S)Nz7<FrameSummary file {filename}, line {lineno} in {name}>)r@rArB)rr@rArB)rMrrr �__repr__szFrameSummary.__repr__cCs&|jdkr tj|j|j�j�|_|jS)N)rC�	linecache�getliner@rA�strip)rMrrr r)s
zFrameSummary.line)r@rArBrCrD)r/�
__module__�__qualname__�__doc__�	__slots__rNrSrUrWrX�propertyr)rrrr r�s
ccs8|dkrtj�jj}x|dk	r2||jfV|j}qWdS)z�Walk a stack yielding the frame and line number for each frame.

    This will follow f.f_back from the given frame. If no frame is given, the
    current stack is used. Usually used with StackSummary.extract.
    N)rr7r8�f_lineno)r9rrr r"s

ccs&x |dk	r |j|jfV|j}qWdS)z�Walk a traceback yielding the frame and line number for each frame.

    This will follow tb.tb_next (and thus is in the opposite order to
    walk_stack). Usually used with StackSummary.extract.
    N)r<�	tb_linenor?)r#rrr r/s
�c@s:eZdZdZedddd�dd��Zedd	��Zd
d�ZdS)rzA stack of frames.NTF)r"�lookup_lines�capture_localsc
	Cs�|dkr(ttdd�}|dk	r(|dkr(d}|dk	rV|dkrFtj||�}ntj||d�}|�}t�}xb|D]Z\}}|j}	|	j}
|	j	}|j
|
�tj|
|j
�|r�|j}nd}|jt|
||d|d��qhWx|D]}
tj|
�q�W|r�x|D]
}|jq�W|S)a?Create a StackSummary from a traceback or stack object.

        :param frame_gen: A generator that yields (frame, lineno) tuples to
            include in the stack.
        :param limit: None to include all frames or the number of frames to
            include.
        :param lookup_lines: If True, lookup lines for each frame immediately,
            otherwise lookup is deferred until the frame is rendered.
        :param capture_locals: If True, the local variables from each frame will
            be captured as object representations into the FrameSummary.
        N�tracebacklimitr)�maxlenF)rErD)�getattrr�	itertools�islice�collections�deque�set�f_code�co_filename�co_name�addrY�	lazycache�	f_globals�f_locals�appendr�
checkcacher))
�klass�	frame_genr"rdre�result�fnamesr9rA�cor@rBrtrrr r$?s6



zStackSummary.extractcCsPt�}xD|D]<}t|t�r&|j|�q|\}}}}|jt||||d��qW|S)z�
        Create a StackSummary object from a supplied list of
        FrameSummary objects or old-style list of tuples.
        )r))rrOrru)rw�a_listry�framer@rArBr)rrr ros


zStackSummary.from_listc
Csxg}d}d}d}d}�x$|D�]}|dksX||jksX|dksX||jksX|dksX||jkr�|tkr�|t8}|jd|�d|dkr�dnd�d��|j}|j}|j}d}|d7}|tkr�qg}|jd	j|j|j|j��|jr�|jd
j|jj���|j�r(x0t	|jj
��D]\}}	|jdj||	d���qW|jdj|��qW|tk�rt|t8}|jd|�d|dk�rhdnd�d��|S)
aFormat the stack ready for printing.

        Returns a list of strings ready for printing.  Each string in the
        resulting list corresponds to a single frame from the stack.
        Each string ends in a newline; the strings may contain internal
        newlines as well, for those items with source text lines.

        For long sequences of the same frame and line, the first few
        repetitions are shown, followed by a summary line stating the exact
        number of further repetitions.
        Nrz  [Previous line repeated z
 more time��srz]
z  File "{}", line {}, in {}
z    {}
z    {name} = {value}
)rBr()r@rArB�_RECURSIVE_CUTOFFrurr)r[rD�sortedrLr1)
rMry�	last_file�	last_line�	last_name�countr}�rowrBr(rrr r�sD 
"zStackSummary.format)r/r\r]r^�classmethodr$rrrrrr r<s.c@s^eZdZdZddddd�dd�Zedd	��Zd
d�Zdd
�Zdd�Z	dd�Z
dd�dd�ZdS)ra�An exception ready for rendering.

    The traceback module captures enough attributes from the original exception
    to this intermediary form to ensure that no references are held, while
    still being able to fully print or format it.

    Use `from_exception` to create TracebackException instances from exception
    objects, or the constructor to create TracebackException instances from
    individual components.

    - :attr:`__cause__` A TracebackException of the original *__cause__*.
    - :attr:`__context__` A TracebackException of the original *__context__*.
    - :attr:`__suppress_context__` The *__suppress_context__* value from the
      original exception.
    - :attr:`stack` A `StackSummary` representing the traceback.
    - :attr:`exc_type` The class of the original traceback.
    - :attr:`filename` For syntax errors - the filename where the error
      occurred.
    - :attr:`lineno` For syntax errors - the linenumber where the error
      occurred.
    - :attr:`text` For syntax errors - the text where the error
      occurred.
    - :attr:`offset` For syntax errors - the offset into the text where the
      error occurred.
    - :attr:`msg` For syntax errors - the compiler error message.
    NTF)r"rdre�_seenc
	Cs<|dkrt�}|jt|��|r\|jdk	r\t|j�|kr\tt|j�|j|jj|d||d�}nd}|r�|jdk	r�t|j�|kr�tt|j�|j|jj|d||d�}	nd}	||_||_|	|_|r�|j	nd|_	t
jt|�|||d�|_
||_t|�|_|o�t|t��r*|j|_t|j�|_|j|_|j|_|j|_|�r8|j�dS)NF)r"rdrer�)r"rdre)rmrq�id�	__cause__rr&�
__traceback__�__context__�
exc_traceback�__suppress_context__rr$rr;�exc_typer+�_str�
issubclass�SyntaxErrorr@r.rA�text�offset�msg�_load_lines)
rMr��	exc_valuer�r"rdrer��cause�contextrrr rN�sT




zTracebackException.__init__cOs|t|�||jf|�|�S)z.Create a TracebackException from an exception.)r&r�)�cls�exc�args�kwargsrrr �from_exceptionsz!TracebackException.from_exceptioncCs:x|jD]
}|jqW|jr&|jj�|jr6|jj�dS)z7Private API. force all lines in the stack to be loaded.N)r;r)r�r�r�)rMr}rrr r�s

zTracebackException._load_linescCs|j|jkS)N)�__dict__)rMrRrrr rSszTracebackException.__eq__cCs|jS)N)r�)rMrrr �__str__szTracebackException.__str__c	cs|jdkrtd|j�VdS|jj}|jj}|dkr@|d|}t|jt�s^t||j�VdS|jpfd}t|j	�ptd}dj
||�V|j}|j}|dk	�rdj
|j
��V|dk	�r|jd	�}tt|�|�d
}|d|�j�}dd�|D�}d
j
dj|��V|j�p
d}dj
||�VdS)a�Format the exception part of the traceback.

        The return value is a generator of strings, each ending in a newline.

        Normally, the generator emits a single string; however, for
        SyntaxError exceptions, it emites several lines that (when
        printed) display detailed information about where the syntax
        error occurred.

        The message indicating which exception occurred is always the last
        string in the output.
        N�__main__�builtins�.z<string>�?z  File "{}", line {}
z    {}
�
r~css|]}|j�r|pdVqdS)� N)�isspace)rG�crrr rJHsz;TracebackException.format_exception_only.<locals>.<genexpr>z    {}^
rz<no detail available>z{}: {}
)r�r�)r�r-r�r]r\r�r�r@r.rArr�r�r[�rstrip�min�len�lstripr1r�)	rM�stype�smodr@rA�badliner��
caretspacer�rrr r s2




z(TracebackException.format_exception_only)r%ccs�|rV|jdk	r*|jj|d�EdHtVn,|jdk	rV|jrV|jj|d�EdHtV|jdk	rfdV|jj�EdH|j�EdHdS)a�Format the exception.

        If chain is not *True*, *__cause__* and *__context__* will not be formatted.

        The return value is a generator of strings, each ending in a newline and
        some containing internal newlines. `print_exception` is a wrapper around
        this method which just prints the lines to a file.

        The message indicating which exception occurred is always the last
        string in the output.
        N)r%z#Traceback (most recent call last):
)	r�r�_cause_messager�r��_context_messager�r;r)rMr%rrr rMs


zTracebackException.format)r/r\r]r^rNr�r�r�rSr�rrrrrr r�s9	-)N)NN)N)N)NNT)NT)NNT)NT)NNT)NNN)NN)NN) r^rkrirYr�__all__r!rrrrr�r�rrrr-r+r	r
rr
rrrrrrr�r*rrrrrr �<module>sF












?
zgetopt.cpython-36.opt-2.pyc000064400000007057150335715140011451 0ustar003


 \A�@s�ddddgZddlZyddlmZWnek
r@dd�ZYnXGd	d�de�ZeZgfd
d�Zgfdd�Z	dd
�Z
dd�Zdd�Zdd�Z
edkr�ddlZeeejdd�dddg��dS)�GetoptError�error�getopt�
gnu_getopt�N)�gettextcCs|S)N�)�srr�/usr/lib64/python3.6/getopt.py�_)sr
c@s&eZdZdZdZddd�Zdd�ZdS)r�cCs||_||_tj|||�dS)N)�msg�opt�	Exception�__init__)�selfrr
rrr	r.szGetoptError.__init__cCs|jS)N)r)rrrr	�__str__3szGetoptError.__str__N)r)�__name__�
__module__�__qualname__r
rrrrrrr	r+s
cCs�g}t|�td�kr|g}nt|�}x�|r�|djd�r�|ddkr�|ddkr^|dd�}P|djd�r�t||ddd�||dd��\}}q&t||ddd�||dd��\}}q&W||fS)Nrr�-z--��)�type�list�
startswith�do_longs�	do_shorts)�args�	shortopts�longopts�optsrrr	r8s (*cCs6g}g}t|t�r|g}nt|�}|jd�r>|dd�}d}ntjjd�rPd}nd}x�|�r,|ddkrz||dd�7}P|ddd�dkr�t||ddd�||dd��\}}qV|ddd�d	kr�|dd	kr�t||ddd�||dd��\}}qV|�r||7}PqV|j	|d�|dd�}qVW||fS)
N�+rTZPOSIXLY_CORRECTFrz--rr)
�
isinstance�strrr�os�environ�getrr�append)rrrr Z	prog_argsZall_options_firstrrr	rcs2

( (cCs�y|jd�}Wntk
r&d}Yn X|d|�||dd�}}t||�\}}|r�|dkr�|svttd�||��|d|dd�}}n|dk	r�ttd�||��|jd||p�df�||fS)N�=rzoption --%s requires argumentrz%option --%s must not have an argumentz--r)�index�
ValueError�
long_has_argsrr
r')r r
rr�i�optarg�has_argrrr	r�s
rcs��fdd�|D�}|s(ttd������|kr8d�fS�d|krLd�fSt|�dkrjttd�����|d	}|jd�}|r�|dd
�}||fS)Ncsg|]}|j��r|�qSr)r)�.0�o)r
rr	�
<listcomp>�sz!long_has_args.<locals>.<listcomp>zoption --%s not recognizedFr(Trzoption --%s not a unique prefixr���)rr
�len�endswith)r
rZ
possibilitiesZunique_matchr.r)r
r	r+�s
r+cCs�x�|dkr�|d|dd�}}t||�rj|dkr^|sHttd�||��|d|dd�}}|d}}nd}|jd||f�qW||fS)Nrrrzoption -%s requires argumentr)�
short_has_argrr
r')r Z	optstringrrr
r-rrr	r�s

rcCsXx@tt|��D]0}|||ko(dknr|jd|d�SqWttd�||��dS)N�:rzoption -%s not recognized)�ranger3rrr
)r
rr,rrr	r5�sr5�__main__rza:bzalpha=Zbeta)�__all__r$rr
�ImportErrorrrrrrrr+rr5r�sys�print�argvrrrr	�<module>"s +2re.cpython-36.opt-1.pyc000064400000033354150335715140010553 0ustar003


 \�<�#@s�dZddlZddlZddlZddlZyddlZWnek
rHdZYnXddddddd	d
ddd
ddddddddddddddddgZdZGdd �d ej	�Z
e�je
j
�ejZd=d!d�Zd>d"d�Zd?d#d�Zd@d$d�ZdAd%d�ZdBd&d�ZdCd'd	�ZdDd(d
�ZdEd)d�Zd*d�ZdFd+d
�Zed,�Zed-�Zd.d�ZiZeejd/d��Z d0Z!d1d2�Z"ej#e!�d3d4��Z$d5d6�Z%d7d8�Z&ddl'Z'd9d:�Z(e'j)e e(e"�Gd;d<�d<�Z*dS)Ga`Support for regular expressions (RE).

This module provides regular expression matching operations similar to
those found in Perl.  It supports both 8-bit and Unicode strings; both
the pattern and the strings being processed can contain null bytes and
characters outside the US ASCII range.

Regular expressions can contain both special and ordinary characters.
Most ordinary characters, like "A", "a", or "0", are the simplest
regular expressions; they simply match themselves.  You can
concatenate ordinary characters, so last matches the string 'last'.

The special characters are:
    "."      Matches any character except a newline.
    "^"      Matches the start of the string.
    "$"      Matches the end of the string or just before the newline at
             the end of the string.
    "*"      Matches 0 or more (greedy) repetitions of the preceding RE.
             Greedy means that it will match as many repetitions as possible.
    "+"      Matches 1 or more (greedy) repetitions of the preceding RE.
    "?"      Matches 0 or 1 (greedy) of the preceding RE.
    *?,+?,?? Non-greedy versions of the previous three special characters.
    {m,n}    Matches from m to n repetitions of the preceding RE.
    {m,n}?   Non-greedy version of the above.
    "\\"     Either escapes special characters or signals a special sequence.
    []       Indicates a set of characters.
             A "^" as the first character indicates a complementing set.
    "|"      A|B, creates an RE that will match either A or B.
    (...)    Matches the RE inside the parentheses.
             The contents can be retrieved or matched later in the string.
    (?aiLmsux) Set the A, I, L, M, S, U, or X flag for the RE (see below).
    (?:...)  Non-grouping version of regular parentheses.
    (?P<name>...) The substring matched by the group is accessible by name.
    (?P=name)     Matches the text matched earlier by the group named name.
    (?#...)  A comment; ignored.
    (?=...)  Matches if ... matches next, but doesn't consume the string.
    (?!...)  Matches if ... doesn't match next.
    (?<=...) Matches if preceded by ... (must be fixed length).
    (?<!...) Matches if not preceded by ... (must be fixed length).
    (?(id/name)yes|no) Matches yes pattern if the group with id/name matched,
                       the (optional) no pattern otherwise.

The special sequences consist of "\\" and a character from the list
below.  If the ordinary character is not on the list, then the
resulting RE will match the second character.
    \number  Matches the contents of the group of the same number.
    \A       Matches only at the start of the string.
    \Z       Matches only at the end of the string.
    \b       Matches the empty string, but only at the start or end of a word.
    \B       Matches the empty string, but not at the start or end of a word.
    \d       Matches any decimal digit; equivalent to the set [0-9] in
             bytes patterns or string patterns with the ASCII flag.
             In string patterns without the ASCII flag, it will match the whole
             range of Unicode digits.
    \D       Matches any non-digit character; equivalent to [^\d].
    \s       Matches any whitespace character; equivalent to [ \t\n\r\f\v] in
             bytes patterns or string patterns with the ASCII flag.
             In string patterns without the ASCII flag, it will match the whole
             range of Unicode whitespace characters.
    \S       Matches any non-whitespace character; equivalent to [^\s].
    \w       Matches any alphanumeric character; equivalent to [a-zA-Z0-9_]
             in bytes patterns or string patterns with the ASCII flag.
             In string patterns without the ASCII flag, it will match the
             range of Unicode alphanumeric characters (letters plus digits
             plus underscore).
             With LOCALE, it will match the set [0-9_] plus characters defined
             as letters for the current locale.
    \W       Matches the complement of \w.
    \\       Matches a literal backslash.

This module exports the following functions:
    match     Match a regular expression pattern to the beginning of a string.
    fullmatch Match a regular expression pattern to all of a string.
    search    Search a string for the presence of a pattern.
    sub       Substitute occurrences of a pattern found in a string.
    subn      Same as sub, but also return the number of substitutions made.
    split     Split a string by the occurrences of a pattern.
    findall   Find all occurrences of a pattern in a string.
    finditer  Return an iterator yielding a match object for each match.
    compile   Compile a pattern into a RegexObject.
    purge     Clear the regular expression cache.
    escape    Backslash all non-alphanumerics in a string.

Some of the functions in this module takes flags as optional parameters:
    A  ASCII       For string patterns, make \w, \W, \b, \B, \d, \D
                   match the corresponding ASCII character categories
                   (rather than the whole Unicode categories, which is the
                   default).
                   For bytes patterns, this flag is the only available
                   behaviour and needn't be specified.
    I  IGNORECASE  Perform case-insensitive matching.
    L  LOCALE      Make \w, \W, \b, \B, dependent on the current locale.
    M  MULTILINE   "^" matches the beginning of lines (after a newline)
                   as well as the string.
                   "$" matches the end of lines (before a newline) as well
                   as the end of the string.
    S  DOTALL      "." matches any character at all, including the newline.
    X  VERBOSE     Ignore whitespace and comments for nicer looking RE's.
    U  UNICODE     For compatibility only. Ignored for string patterns (it
                   is the default), and forbidden for bytes patterns.

This module also defines an exception 'error'.

�N�match�	fullmatch�search�sub�subn�split�findall�finditer�compile�purge�template�escape�error�A�I�L�M�S�X�U�ASCII�
IGNORECASE�LOCALE�	MULTILINE�DOTALL�VERBOSE�UNICODEz2.2.1c@sbeZdZejZejZejZ	ej
ZejZ
ejZejZeZeZe	ZeZe
ZeZeZejZeZejZdS)�	RegexFlagN)�__name__�
__module__�__qualname__�sre_compile�SRE_FLAG_ASCIIr�SRE_FLAG_IGNORECASEr�SRE_FLAG_LOCALEr�SRE_FLAG_UNICODEr�SRE_FLAG_MULTILINEr�SRE_FLAG_DOTALLr�SRE_FLAG_VERBOSErrrrrrrr�SRE_FLAG_TEMPLATE�TEMPLATE�T�SRE_FLAG_DEBUG�DEBUG�r.r.�/usr/lib64/python3.6/re.pyr�s"rcCst||�j|�S)zqTry to apply the pattern at the start of the string, returning
    a match object, or None if no match was found.)�_compiler)�pattern�string�flagsr.r.r/r�scCst||�j|�S)zkTry to apply the pattern to all of the string, returning
    a match object, or None if no match was found.)r0r)r1r2r3r.r.r/r�scCst||�j|�S)ztScan through string looking for a match to the pattern, returning
    a match object, or None if no match was found.)r0r)r1r2r3r.r.r/r�scCst||�j|||�S)aZReturn the string obtained by replacing the leftmost
    non-overlapping occurrences of the pattern in string by the
    replacement repl.  repl can be either a string or a callable;
    if a string, backslash escapes in it are processed.  If it is
    a callable, it's passed the match object and must return
    a replacement string to be used.)r0r)r1�replr2�countr3r.r.r/r�scCst||�j|||�S)a�Return a 2-tuple containing (new_string, number).
    new_string is the string obtained by replacing the leftmost
    non-overlapping occurrences of the pattern in the source
    string by the replacement repl.  number is the number of
    substitutions that were made. repl can be either a string or a
    callable; if a string, backslash escapes in it are processed.
    If it is a callable, it's passed the match object and must
    return a replacement string to be used.)r0r)r1r4r2r5r3r.r.r/r�s	cCst||�j||�S)a�Split the source string by the occurrences of the pattern,
    returning a list containing the resulting substrings.  If
    capturing parentheses are used in pattern, then the text of all
    groups in the pattern are also returned as part of the resulting
    list.  If maxsplit is nonzero, at most maxsplit splits occur,
    and the remainder of the string is returned as the final element
    of the list.)r0r)r1r2�maxsplitr3r.r.r/r�scCst||�j|�S)aReturn a list of all non-overlapping matches in the string.

    If one or more capturing groups are present in the pattern, return
    a list of groups; this will be a list of tuples if the pattern
    has more than one group.

    Empty matches are included in the result.)r0r)r1r2r3r.r.r/r�scCst||�j|�S)z�Return an iterator over all non-overlapping matches in the
    string.  For each match, the iterator returns a match object.

    Empty matches are included in the result.)r0r	)r1r2r3r.r.r/r	�scCs
t||�S)zACompile a regular expression pattern, returning a pattern object.)r0)r1r3r.r.r/r
�scCstj�tj�dS)z#Clear the regular expression cachesN)�_cache�clear�
_compile_repl�cache_clearr.r.r.r/r�scCst||tB�S)z6Compile a template pattern, returning a pattern object)r0r+)r1r3r.r.r/r�sZ@_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890s@_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890cCs�t|t�r\t}t|�}x:t|�D].\}}||kr |dkrBd||<q d|||<q Wdj|�St}g}td�}xH|D]@}||kr�|j|�qr|dkr�|j	d�qr|j|�|j|�qrWt
|�SdS)	zU
    Escape all the characters in pattern except ASCII letters, numbers and '_'.
    �z\000�\��\rs\000N)�
isinstance�str�
_alphanum_str�list�	enumerate�join�_alphanum_bytes�ord�append�extend�bytes)r1�alphanum�s�i�c�escr.r.r/r
�s(




r=ic
Cs�y6tt|�||f\}}|dks0|tjtj�kr4|SWntk
rJYnXt|t�rf|rbtd��|St	j
|�sxtd��t	j||�}|t
@s�tt�tkr�tj�|jt@r�ts�|Stjtj�}nd}||ftt|�||f<|S)Nz5cannot process flags argument with a compiled patternz1first argument must be string or compiled pattern)r7�type�_locale�	setlocale�LC_CTYPE�KeyErrorr?�
_pattern_type�
ValueErrorr!�isstring�	TypeErrorr
r-�len�	_MAXCACHEr8r3r)r1r3�p�locr.r.r/r0s0


r0cCstj||�S)N)�	sre_parse�parse_template)r4r1r.r.r/r9:sr9cCstj||�}tj||�S)N)r\r]�expand_template)r1rrr.r.r/�_expand?sr_cCs@t||�}|dr0t|d�dkr0|ddS|fdd�}|S)Nr�cSstj||�S)N)r\r^)rrr.r.r/�filterJsz_subx.<locals>.filter)r9rX)r1rrar.r.r/�_subxDs

rbcCst|j|jffS)N)r0r1r3)rZr.r.r/�_pickleRsrcc@seZdZddd�Zdd�ZdS)�Scannerrc
Cs�ddlm}m}||_g}tj�}||_xP|D]H\}}|j�}	|jtj	|||	ddtj
||�ffg��|j|	|d�q.Wtj	||d|ffg�}tj
|�|_dS)Nr)�BRANCH�
SUBPATTERNr`���)�
sre_constantsrerf�lexiconr\�Patternr3�	opengrouprG�
SubPattern�parse�
closegroupr!r
�scanner)
�selfrir3rerfrZrK�phrase�action�gidr.r.r/�__init__[s
zScanner.__init__c	Cs�g}|j}|jj|�j}d}xf|�}|s*P|j�}||kr<P|j|jdd}t|�rl||_|||j��}|dk	r|||�|}qW|||d�fS)Nrr`)rGror�endri�	lastindex�callable�group)	rpr2�resultrGrrL�m�jrrr.r.r/�scanjs&zScanner.scanN)r)rrr rtr|r.r.r.r/rdZs
rd)r)r)r)rr)rr)rr)r)r)r)r)+�__doc__�enumr!r\�	functoolsrP�ImportError�__all__�__version__�IntFlagr�globals�update�__members__rrrrrrrrr	r
rr�	frozensetrArEr
r7rOrTrYr0�	lru_cacher9r_rb�copyregrc�picklerdr.r.r.r/�<module>xsX




	







 symtable.cpython-36.opt-1.pyc000064400000024123150335715140011757 0ustar003


 \m�@sNdZddlZddlmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZddlZdddddgZd	d�ZGd
d�d�Ze�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�Zedk�rJddlZddlZeejd��Zej �Z!WdQRXee!ej"j#ejd�dd�Z$x0e$j%�D]$Z&e$j'e&�Z(e)e(e(j*�e(j+���q"WdS)z2Interface to the compiler's internal symbol tables�N)�USE�
DEF_GLOBAL�	DEF_LOCAL�	DEF_PARAM�
DEF_IMPORT�	DEF_BOUND�	DEF_ANNOT�	SCOPE_OFF�
SCOPE_MASK�FREE�LOCAL�GLOBAL_IMPLICIT�GLOBAL_EXPLICIT�CELL�symtable�SymbolTable�Class�Function�SymbolcCstj|||�}t||�S)N)�	_symtabler�_newSymbolTable)�code�filenameZcompile_type�top�r� /usr/lib64/python3.6/symtable.pyrsc@s$eZdZdd�Zdd�Zdd�ZdS)�SymbolTableFactorycCstj�|_dS)N)�weakref�WeakValueDictionary�_SymbolTableFactory__memo)�selfrrr�__init__szSymbolTableFactory.__init__cCs6|jtjkrt||�S|jtjkr,t||�St||�S)N)�typer�
TYPE_FUNCTIONr�
TYPE_CLASSrr)r �tablerrrr�news


zSymbolTableFactory.newcCs8||f}|jj|d�}|dkr4|j||�}|j|<|S)N)r�getr&)r r%r�key�objrrr�__call__s
zSymbolTableFactory.__call__N)�__name__�
__module__�__qualname__r!r&r*rrrrrsrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS) rcCs||_||_i|_dS)N)�_table�	_filename�_symbols)r Z	raw_tablerrrrr!'szSymbolTable.__init__cCsN|jtkrd}nd|jj}|jjdkr6dj||j�Sdj||jj|j�SdS)N�z%s �globalz<{0}SymbolTable for module {1}>z<{0}SymbolTable for {1} in {2}>)�	__class__rr+r.�name�formatr/)r Zkindrrr�__repr__,s
zSymbolTable.__repr__cCs:|jjtjkrdS|jjtjkr$dS|jjtjkr6dSdS)N�moduleZfunction�class)r.r"rZTYPE_MODULEr#r$)r rrr�get_type9szSymbolTable.get_typecCs|jjS)N)r.�id)r rrr�get_idCszSymbolTable.get_idcCs|jjS)N)r.r4)r rrr�get_nameFszSymbolTable.get_namecCs|jjS)N)r.�lineno)r rrr�
get_linenoIszSymbolTable.get_linenocCst|jjtjk�S)N)�boolr.r"rr#)r rrr�is_optimizedLszSymbolTable.is_optimizedcCst|jj�S)N)r?r.�nested)r rrr�	is_nestedOszSymbolTable.is_nestedcCst|jj�S)N)r?r.�children)r rrr�has_childrenRszSymbolTable.has_childrencCsdS)z7Return true if the scope uses exec.  Deprecated method.Fr)r rrr�has_execUszSymbolTable.has_execcCs|jjj�S)N)r.�symbols�keys)r rrr�get_identifiersYszSymbolTable.get_identifierscCsD|jj|�}|dkr@|jj|}|j|�}t|||�}|j|<|S)N)r0r'r.rF�_SymbolTable__check_childrenr)r r4Zsym�flags�
namespacesrrr�lookup\s
zSymbolTable.lookupcs�fdd��j�D�S)Ncsg|]}�j|��qSr)rL)�.0�ident)r rr�
<listcomp>esz+SymbolTable.get_symbols.<locals>.<listcomp>)rH)r r)r r�get_symbolsdszSymbolTable.get_symbolscs��fdd��jjD�S)Ncs"g|]}|j�krt|�j��qSr)r4rr/)rM�st)r4r rrrOhsz0SymbolTable.__check_children.<locals>.<listcomp>)r.rC)r r4r)r4r rZ__check_childrengszSymbolTable.__check_childrencs�fdd��jjD�S)Ncsg|]}t|�j��qSr)rr/)rMrQ)r rrrOmsz,SymbolTable.get_children.<locals>.<listcomp>)r.rC)r r)r r�get_childrenls
zSymbolTable.get_childrenN)r+r,r-r!r6r9r;r<r>r@rBrDrErHrLrPrIrRrrrrr%s

c@sDeZdZdZdZdZdZdd�Zdd�Zdd�Z	dd	�Z
d
d�ZdS)rNcst��fdd��j�D��S)Ncs g|]}��jj|�r|�qSr)r.rF)rMrN)r �	test_funcrrrOzsz.Function.__idents_matching.<locals>.<listcomp>)�tuplerH)r rSr)r rSrZ__idents_matchingyszFunction.__idents_matchingcCs |jdkr|jdd��|_|jS)NcSs|t@S)N)r)�xrrr�<lambda>sz)Function.get_parameters.<locals>.<lambda>)�_Function__params�_Function__idents_matching)r rrr�get_parameters}s
zFunction.get_parameterscs0|jdkr*ttf��fdd�}|j|�|_|jS)Ncs|t?t@�kS)N)r	r
)rU)�locsrrrV�sz%Function.get_locals.<locals>.<lambda>)�_Function__localsrrrX)r �testr)rZr�
get_locals�s

zFunction.get_localscs0|jdkr*ttf��fdd�}|j|�|_|jS)Ncs|t?t@�kS)N)r	r
)rU)�globrrrV�sz&Function.get_globals.<locals>.<lambda>)�_Function__globalsr
rrX)r r\r)r^r�get_globals�s

zFunction.get_globalscCs$|jdkrdd�}|j|�|_|jS)NcSs|t?t@tkS)N)r	r
r)rUrrrrV�sz$Function.get_frees.<locals>.<lambda>)�_Function__freesrX)r �is_freerrr�	get_frees�s
zFunction.get_frees)r+r,r-rWr[rar_rXrYr]r`rcrrrrrqsc@seZdZdZdd�ZdS)rNcCs:|jdkr4i}x|jjD]}d||j<qWt|�|_|jS)N�)�_Class__methodsr.rCr4rT)r �drQrrr�get_methods�s

zClass.get_methods)r+r,r-rergrrrrr�sc@s�eZdZd dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)!rNcCs(||_||_|t?t@|_|p f|_dS)N)�
_Symbol__name�_Symbol__flagsr	r
�_Symbol__scope�_Symbol__namespaces)r r4rJrKrrrr!�szSymbol.__init__cCsdj|j�S)Nz<symbol {0!r}>)r5rh)r rrrr6�szSymbol.__repr__cCs|jS)N)rh)r rrrr<�szSymbol.get_namecCst|jtj@�S)N)r?rirr)r rrr�
is_referenced�szSymbol.is_referencedcCst|jt@�S)N)r?rir)r rrr�is_parameter�szSymbol.is_parametercCst|jttfk�S)N)r?rjr
r)r rrr�	is_global�szSymbol.is_globalcCst|jtk�S)N)r?rjr)r rrr�is_declared_global�szSymbol.is_declared_globalcCst|jt@�S)N)r?rir)r rrr�is_local�szSymbol.is_localcCst|jt@�S)N)r?rir)r rrr�is_annotated�szSymbol.is_annotatedcCst|jtk�S)N)r?rjr)r rrrrb�szSymbol.is_freecCst|jt@�S)N)r?rir)r rrr�is_imported�szSymbol.is_importedcCst|jt@�S)N)r?rir)r rrr�is_assigned�szSymbol.is_assignedcCs
t|j�S)a�Returns true if name binding introduces new namespace.

        If the name is used as the target of a function or class
        statement, this will be true.

        Note that a single name can be bound to multiple objects.  If
        is_namespace() is true, the name may also be bound to other
        objects, like an int or list, that does not introduce a new
        namespace.
        )r?rk)r rrr�is_namespace�szSymbol.is_namespacecCs|jS)z.Return a list of namespaces bound to this name)rk)r rrr�get_namespaces�szSymbol.get_namespacescCs t|j�dkrtd��|jdS)z�Returns the single namespace bound to this name.

        Raises ValueError if the name is bound to multiple namespaces.
        rdz$name is bound to multiple namespacesr)�lenrk�
ValueError)r rrr�
get_namespace�szSymbol.get_namespace)N)r+r,r-r!r6r<rlrmrnrorprqrbrrrsrtrurxrrrrr�s

�__main__rd�exec),�__doc__rrrrrrrrr	r
rrr
rrr�__all__rrr�objectrrrrr+�os�sys�open�argv�f�read�src�path�split�modrHrNrL�info�printrprtrrrr�<module>s&@L&
C

ipaddress.cpython-36.opt-2.pyc000064400000110743150335715140012122 0ustar003

�\dh�/�@s�dZddlZdZdZGdd�de�ZGdd�de�Zd	d
�Zd<dd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�ZGd"d#�d#�ZejGd$d%�d%e��ZejGd&d'�d'e��ZGd(d)�d)�ZGd*d+�d+ee�ZGd,d-�d-e�ZGd.d/�d/ee�ZGd0d1�d1�Zee_Gd2d3�d3�ZGd4d5�d5ee�ZGd6d7�d7e�ZGd8d9�d9ee�Z Gd:d;�d;�Z!e!e_dS)=z1.0�N� �c@seZdZdS)�AddressValueErrorN)�__name__�
__module__�__qualname__�rr�!/usr/lib64/python3.6/ipaddress.pyrsrc@seZdZdS)�NetmaskValueErrorN)rrrrrrr	r
sr
cCsTyt|�Sttfk
r YnXyt|�Sttfk
rBYnXtd|��dS)Nz0%r does not appear to be an IPv4 or IPv6 address)�IPv4Addressrr
�IPv6Address�
ValueError)�addressrrr	�
ip_addresssrTcCsXy
t||�Sttfk
r"YnXy
t||�Sttfk
rFYnXtd|��dS)Nz0%r does not appear to be an IPv4 or IPv6 network)�IPv4Networkrr
�IPv6Networkr
)r�strictrrr	�
ip_network9s

rcCsTyt|�Sttfk
r YnXyt|�Sttfk
rBYnXtd|��dS)Nz2%r does not appear to be an IPv4 or IPv6 interface)�
IPv4Interfacerr
�
IPv6Interfacer
)rrrr	�ip_interfaceWsrcCs.y|jdd�Stk
r(td��YnXdS)N��bigz&Address negative or too large for IPv4)�to_bytes�
OverflowErrorr
)rrrr	�v4_int_to_packedzsrcCs.y|jdd�Stk
r(td��YnXdS)N�rz&Address negative or too large for IPv6)rrr
)rrrr	�v6_int_to_packed�s
rcCs*t|�jd�}t|�dkr&td|��|S)N�/�zOnly one '/' permitted in %r)�str�split�lenr)r�addrrrr	�_split_optional_netmask�sr$ccsRt|�}t|�}}x.|D]&}|j|jdkr<||fV|}|}qW||fVdS)N�)�iter�next�_ip)�	addresses�it�first�last�iprrr	�_find_address_range�s


r.cCs$|dkr|St|||d@j��S)Nrr%)�min�
bit_length)Znumber�bitsrrr	�_count_righthand_zero_bits�sr2ccs�t|t�ot|t�std��|j|jkr8td||f��||krHtd��|jdkrXt}n|jdkrht}ntd��|j}|j}|j}x^||kr�t	t
||�||dj�d�}||||f�}|V|d|>7}|d|jkr�Pq�WdS)Nz1first and last must be IP addresses, not networksz%%s and %s are not of the same versionz*last IP address must be greater than firstr�zunknown IP versionr%)
�
isinstance�_BaseAddress�	TypeError�versionr
rr�_max_prefixlenr(r/r2r0�	_ALL_ONES)r+r,r-Zip_bitsZ	first_intZlast_intZnbits�netrrr	�summarize_address_range�s0





r;ccs�t|�}i}xL|rX|j�}|j�}|j|�}|dkr>|||<q||kr||=|j|�qWd}x4t|j��D]$}|dk	r�|j|jkr�ql|V|}qlWdS)N)�list�pop�supernet�get�append�sorted�values�broadcast_address)r)Zto_merge�subnetsr:r>Zexistingr,rrr	�_collapse_addresses_internals$

rEcCs8g}g}g}x�|D]�}t|t�rT|rH|dj|jkrHtd||df��|j|�q|j|jkr�|r�|dj|jkr�td||df��y|j|j�Wq�tk
r�|j|j	�Yq�Xq|r�|dj|jkr�td||df��|j|�qWt
t|��}|�r,x&t|�D]\}}|j
t||���qWt||�S)	Nr%z%%s and %s are not of the same version���rFrFrFrFrF)r4r5�_versionr6r@�
_prefixlenr8r-�AttributeError�network_addressrA�setr.�extendr;rE)r)ZaddrsZipsZnetsr-r+r,rrr	�collapse_addresses2s4

rMcCs(t|t�r|j�St|t�r$|j�StS)N)r4�_BaseNetwork�_get_networks_keyr5�_get_address_key�NotImplemented)�objrrr	�get_mixed_type_keyhs


rSc@s�eZdZfZedd��Zedd��Zedd��Zedd��Zd	d
�Z	dd�Z
ed
d��Zedd��Z
edd��Zedd��Zedd��Zdd�ZdS)�_IPAddressBasecCs|j�S)N)�_explode_shorthand_ip_string)�selfrrr	�exploded�sz_IPAddressBase.explodedcCst|�S)N)r )rVrrr	�
compressed�sz_IPAddressBase.compressedcCs|j�S)N)�_reverse_pointer)rVrrr	�reverse_pointer�s	z_IPAddressBase.reverse_pointercCsdt|�f}t|��dS)Nz%200s has no version specified)�type�NotImplementedError)rV�msgrrr	r7�sz_IPAddressBase.versioncCsF|dkrd}t|||jf��||jkrBd}t|||j|jf��dS)Nrz-%d (< 0) is not permitted as an IPv%d addressz2%d (>= 2**%d) is not permitted as an IPv%d address)rrGr9r8)rVrr]rrr	�_check_int_address�s

z!_IPAddressBase._check_int_addresscCs.t|�}||kr*d}t|||||jf��dS)Nz6%r (len %d != %d) is not permitted as an IPv%d address)r"rrG)rVrZexpected_lenZaddress_lenr]rrr	�_check_packed_address�s
z$_IPAddressBase._check_packed_addresscCs|j|j|?AS)N)r9)�cls�	prefixlenrrr	�_ip_int_from_prefix�sz"_IPAddressBase._ip_int_from_prefixc	Cs\t||j�}|j|}||?}d|>d}||krX|jd}|j|d�}d}t||��|S)Nr%�rz&Netmask pattern %r mixes zeroes & ones)r2r8rr
)	r`�ip_intZtrailing_zeroesraZleading_onesZall_onesZbyteslenZdetailsr]rrr	�_prefix_from_ip_int�s


z"_IPAddressBase._prefix_from_ip_intcCsd|}t|�d�dS)Nz%r is not a valid netmask)r
)r`Znetmask_strr]rrr	�_report_invalid_netmask�sz&_IPAddressBase._report_invalid_netmaskcCsjtjj|�s|j|�yt|�}Wntk
r@|j|�YnXd|koV|jknsf|j|�|S)Nr)�_BaseV4�_DECIMAL_DIGITS�
issupersetrf�intr
r8)r`Z
prefixlen_strrarrr	�_prefix_from_prefix_string�s

z)_IPAddressBase._prefix_from_prefix_stringcCs�y|j|�}Wntk
r,|j|�YnXy
|j|�Stk
rLYnX||jN}y
|j|�Stk
r�|j|�YnXdS)N)�_ip_int_from_stringrrfrer
r9)r`�ip_strrdrrr	�_prefix_from_ip_string�s


z%_IPAddressBase._prefix_from_ip_stringcCs|jt|�ffS)N)�	__class__r )rVrrr	�
__reduce__sz_IPAddressBase.__reduce__N)rrr�	__slots__�propertyrWrXrZr7r^r_�classmethodrbrerfrkrnrprrrr	rT�s	
"rTc@s`eZdZfZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dS)r5cCs|jS)N)r()rVrrr	�__int__&sz_BaseAddress.__int__cCs2y|j|jko|j|jkStk
r,tSXdS)N)r(rGrIrQ)rV�otherrrr	�__eq__)s
z_BaseAddress.__eq__cCsFt|t�stS|j|jkr*td||f��|j|jkrB|j|jkSdS)Nz%%s and %s are not of the same versionF)r4r5rQrGr6r()rVrurrr	�__lt__0s
z_BaseAddress.__lt__cCs t|t�stS|jt|�|�S)N)r4rjrQro)rVrurrr	�__add__<s
z_BaseAddress.__add__cCs t|t�stS|jt|�|�S)N)r4rjrQro)rVrurrr	�__sub__As
z_BaseAddress.__sub__cCsd|jjt|�fS)Nz%s(%r))rorr )rVrrr	�__repr__Fsz_BaseAddress.__repr__cCst|j|j��S)N)r �_string_from_ip_intr()rVrrr	�__str__Isz_BaseAddress.__str__cCsttt|j���S)N)�hash�hexrjr()rVrrr	�__hash__Lsz_BaseAddress.__hash__cCs
|j|fS)N)rG)rVrrr	rPOsz_BaseAddress._get_address_keycCs|j|jffS)N)ror()rVrrr	rpRsz_BaseAddress.__reduce__N)rrrrqrtrvrwrxryrzr|rrPrprrrr	r5s	r5c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
edd��Zedd��Zedd��Zedd��Zedd ��Zed!d"��Zed#d$��Zed%d&��Zd'd(�Zd)d*�Zd+d,�ZdAd/d0�ZdBd1d2�Zed3d4��Zed5d6��Zed7d8��Zed9d:��Zed;d<��Z ed=d>��Z!ed?d@��Z"d.S)CrNcCs
i|_dS)N)�_cache)rVrrrr	�__init___sz_BaseNetwork.__init__cCsd|jjt|�fS)Nz%s(%r))rorr )rVrrr	rzbsz_BaseNetwork.__repr__cCsd|j|jfS)Nz%s/%d)rJra)rVrrr	r|esz_BaseNetwork.__str__ccs<t|j�}t|j�}x"t|d|�D]}|j|�Vq$WdS)Nr%)rjrJrC�range�_address_class)rV�network�	broadcast�xrrr	�hostshs

z_BaseNetwork.hostsccs<t|j�}t|j�}x"t||d�D]}|j|�Vq$WdS)Nr%)rjrJrCr�r�)rVr�r�r�rrr	�__iter__ts

z_BaseNetwork.__iter__cCslt|j�}t|j�}|dkr>|||kr0td��|j||�S|d7}|||krZtd��|j||�SdS)Nrzaddress out of ranger%)rjrJrC�
IndexErrorr�)rV�nr�r�rrr	�__getitem__zs

z_BaseNetwork.__getitem__cCs^t|t�stS|j|jkr*td||f��|j|jkrB|j|jkS|j|jkrZ|j|jkSdS)Nz%%s and %s are not of the same versionF)r4rNrQrGr6rJ�netmask)rVrurrr	rw�s
z_BaseNetwork.__lt__cCsFy,|j|jko,|j|jko,t|j�t|j�kStk
r@tSXdS)N)rGrJrjr�rIrQ)rVrurrr	rv�sz_BaseNetwork.__eq__cCstt|j�t|j�A�S)N)r}rjrJr�)rVrrr	r�sz_BaseNetwork.__hash__cCsL|j|jkrdSt|t�rdSt|j�t|j�koBt|j�kSSdS)NF)rGr4rNrjrJr(rC)rVrurrr	�__contains__�s
z_BaseNetwork.__contains__cCs(|j|kp&|j|kp&|j|kp&|j|kS)N)rJrC)rVrurrr	�overlaps�s


z_BaseNetwork.overlapscCs<|jjd�}|dkr8|jt|j�t|j�B�}||jd<|S)NrC)r�r?r�rjrJ�hostmask)rVr�rrr	rC�s
z_BaseNetwork.broadcast_addresscCs8|jjd�}|dkr4|jt|j�|jA�}||jd<|S)Nr�)r�r?r�rjr�r9)rVr�rrr	r��s

z_BaseNetwork.hostmaskcCsd|j|jfS)Nz%s/%d)rJrH)rVrrr	�with_prefixlen�sz_BaseNetwork.with_prefixlencCsd|j|jfS)Nz%s/%s)rJr�)rVrrr	�with_netmask�sz_BaseNetwork.with_netmaskcCsd|j|jfS)Nz%s/%s)rJr�)rVrrr	�
with_hostmask�sz_BaseNetwork.with_hostmaskcCst|j�t|j�dS)Nr%)rjrCrJ)rVrrr	�
num_addresses�sz_BaseNetwork.num_addressescCsdt|�f}t|��dS)Nz%%200s has no associated address class)r[r\)rVr]rrr	r��sz_BaseNetwork._address_classcCs|jS)N)rH)rVrrr	ra�sz_BaseNetwork.prefixlenccsD|j|jkstd||f��t|t�s2td|��|j|jkoH|j|jksZtd||f��||krfdS|jd|j|jf�}|j	�\}}x�||ko�||k�r|j|jkr�|j|jkr�|V|j	�\}}q�|j|jkr�|j|jkr�|V|j	�\}}q�t
d|||f��q�W||k�r|Vn$||k�r.|Vnt
d|||f��dS)Nz%%s and %s are not of the same versionz%s is not a network objectz%s not contained in %sz%s/%sz3Error performing exclusion: s1: %s s2: %s other: %s)rGr6r4rNrJrCr
rorarD�AssertionError)rVru�s1�s2rrr	�address_exclude�s<$



z_BaseNetwork.address_excludecCs`|j|jkrtd||f��|j|jkr,dS|j|jkr<dS|j|jkrLdS|j|jkr\dSdS)Nz"%s and %s are not of the same typer%rrFrF)rGr6rJr�)rVrurrr	�compare_networks.s!z_BaseNetwork.compare_networkscCs|j|j|jfS)N)rGrJr�)rVrrr	rO^sz_BaseNetwork._get_networks_keyr%Nc	cs�|j|jkr|VdS|dk	rJ||jkr0td��|dkr@td��||j}|dkrZtd��|j|}||jkr~td||f��t|j�}t|j�d}t|j�d|?}x(t|||�D]}|j||f�}|Vq�WdS)Nznew prefix must be longerr%z(cannot set prefixlen_diff and new_prefixrzprefix length diff must be > 0z0prefix length diff %d is invalid for netblock %s)	rHr8r
rjrJrCr�r�ro)	rV�prefixlen_diff�
new_prefix�
new_prefixlen�start�end�stepZnew_addrZcurrentrrr	rDhs,




z_BaseNetwork.subnetscCs�|jdkr|S|dk	rB||jkr(td��|dkr8td��|j|}|j|}|dkrftd|j|f��|jt|j�t|j�|>@|f�S)Nrznew prefix must be shorterr%z(cannot set prefixlen_diff and new_prefixz;current prefixlen is %d, cannot have a prefixlen_diff of %d)rHr
rarorjrJr�)rVr�r�r�rrr	r>�s 



z_BaseNetwork.supernetcCs|jjo|jjS)N)rJ�is_multicastrC)rVrrr	r��s	z_BaseNetwork.is_multicastcCs|jjo|jjS)N)rJ�is_reservedrC)rVrrr	r��s	z_BaseNetwork.is_reservedcCs|jjo|jjS)N)rJ�
is_link_localrC)rVrrr	r��sz_BaseNetwork.is_link_localcCs|jjo|jjS)N)rJ�
is_privaterC)rVrrr	r��s	z_BaseNetwork.is_privatecCs|jS)N)r�)rVrrr	�	is_global�s	z_BaseNetwork.is_globalcCs|jjo|jjS)N)rJ�is_unspecifiedrC)rVrrr	r�s	z_BaseNetwork.is_unspecifiedcCs|jjo|jjS)N)rJ�is_loopbackrC)rVrrr	r�s	z_BaseNetwork.is_loopback)r%N)r%N)#rrrr�rzr|r�r�r�rwrvrr�r�rrrCr�r�r�r�r�r�rar�r�rOrDr>r�r�r�r�r�r�r�rrrr	rNVs>	

	N0

5
)rNc
@s�eZdZfZdZdedZed�Zeddddd	d
ddd
h	�Z	eZ
iZdd�Ze
dd��Ze
dd��Ze
dd��Ze
dd��Zdd�Zdd�Zdd�Zedd��Zed d!��Zd"S)#rgrrr%�
0123456789���������rrcCst|�S)N)r )rVrrr	rU0sz$_BaseV4._explode_shorthand_ip_stringcCsn||jkrdt|t�r|}n.y|j|�}Wntk
rF|j|�}YnXt|j|��}||f|j|<|j|S)N)�_netmask_cacher4rjrkr
rnrrb)r`�argrar�rrr	�
_make_netmask3s	

z_BaseV4._make_netmaskcCs||std��|jd�}t|�dkr.td|��ytjt|j|�d�Stk
rv}ztd||f�d�WYdd}~XnXdS)NzAddress cannot be empty�.rzExpected 4 octets in %rrz%s in %r)rr!r"rj�
from_bytes�map�_parse_octetr
)r`rmZoctets�excrrr	rlKs
z_BaseV4._ip_int_from_stringcCs�|std��|jj|�s(d}t||��t|�dkrDd}t||��t|d�}|dkrr|ddkrrd	}t||��|d
kr�td|��|S)NzEmpty octet not permittedz#Only decimal digits permitted in %r�z$At most 3 characters permitted in %r�
�r�0z3Ambiguous (octal/decimal) value in %r not permittedr�zOctet %d (> 255) not permitted)r
rhrir"rj)r`Z	octet_strr]Z	octet_intrrr	r�es
z_BaseV4._parse_octetcCsdjtt|jdd���S)Nr�rr)�joinr�r r)r`rdrrr	r{�sz_BaseV4._string_from_ip_intcCs�|jd�}t|�dkr�y$x|D]}t|�|jkrdSqWWntk
rNdSXx0t|�D]$\}}|dkrZ|||dkrZdSqZWdSyt|�}Wntk
r�dSXd|ko�|jkSS)Nr�rFrr%T)r!r"rj�_valid_mask_octetsr
�	enumerater8)rVr��maskr��idx�yrrr	�_is_valid_netmask�s"

z_BaseV4._is_valid_netmaskcsh|jd�}y�fdd�tt|�D�}Wntk
r:dSXt|�t|�krPdS|d|dkrddSdS)	Nr�csg|]}|�jkr|�qSr)r�)�.0r�)rVrr	�
<listcomp>�sz(_BaseV4._is_hostmask.<locals>.<listcomp>Frr%TrF)r!r�rjr
r")rVrmr1�partsr)rVr	�_is_hostmask�s

z_BaseV4._is_hostmaskcCs&t|�jd�ddd�}dj|�dS)Nr�r%z
.in-addr.arparF)r r!r�)rVZreverse_octetsrrr	rY�sz_BaseV4._reverse_pointercCs|jS)N)r8)rVrrr	�
max_prefixlen�sz_BaseV4.max_prefixlencCs|jS)N)rG)rVrrr	r7�sz_BaseV4.versionN)rrrrqrG�
IPV4LENGTHr9�	frozensetrhr�r8r�rUrsr�rlr�r{r�r�rYrrr�r7rrrr	rgs"	%
	rgc@s�eZdZdZdd�Zedd��Zedd��Zeej	�d	d
���Z
eej	�dd���Zed
d��Zedd��Z
edd��Zedd��ZdS)rr(�__weakref__cCsrt|t�r|j|�||_dSt|t�rF|j|d�tj|d�|_dSt|�}d|krbtd|��|j	|�|_dS)NrrrzUnexpected '/' in %r)
r4rjr^r(�bytesr_r�r rrl)rVr�addr_strrrr	r��s


zIPv4Address.__init__cCs
t|j�S)N)rr()rVrrr	�packedszIPv4Address.packedcCs||jjkS)N)�
_constants�_reserved_network)rVrrr	r�s	zIPv4Address.is_reservedcs4t�fdd��jjD��o2t�fdd��jjD��S)Nc3s|]}�|kVqdS)Nr)r�r:)rVrr	�	<genexpr>(sz)IPv4Address.is_private.<locals>.<genexpr>c3s|]}�|kVqdS)Nr)r�r:)rVrr	r�)s)�anyr��_private_networks�all�_private_networks_exceptions)rVr)rVr	r�szIPv4Address.is_privatecCs||jjko|jS)N)r��_public_networkr�)rVrrr	r�,szIPv4Address.is_globalcCs||jjkS)N)r��_multicast_network)rVrrr	r�>s	zIPv4Address.is_multicastcCs||jjkS)N)r��_unspecified_address)rVrrr	r�Is	zIPv4Address.is_unspecifiedcCs||jjkS)N)r��_loopback_network)rVrrr	r�TszIPv4Address.is_loopbackcCs||jjkS)N)r��_linklocal_network)rVrrr	r�^szIPv4Address.is_link_localN)r(r�)rrrrqr�rrr�r��	functools�	lru_cacher�r�r�r�r�r�rrrr	r�s#
rc@sjeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zej	Z	e
dd��Ze
d
d��Ze
dd��Z
e
dd��ZdS)rcCs�t|ttf�r2tj||�t|j�|_|j|_	dSt|t
�r�tj||d�t|�dkrht|d�|_	n|j|_	t|dd�|_|jj|_|jj
|_
dSt|�}tj||d�t|dd�|_|jj	|_	|jj|_|jj
|_
dS)Nrr%F)r)r4r�rjrr�rr(r�r8rH�tupler"r�r�r$)rVrr#rrr	r�ks(




zIPv4Interface.__init__cCsd|j|j�|jjfS)Nz%s/%d)r{r(r�ra)rVrrr	r|�szIPv4Interface.__str__cCsDtj||�}|s|tkr|Sy|j|jkStk
r>dSXdS)NF)rrvrQr�rI)rVru�
address_equalrrr	rv�szIPv4Interface.__eq__cCsNtj||�}|tkrtSy|j|jkp4|j|jko4|Stk
rHdSXdS)NF)rrwrQr�rI)rVru�address_lessrrr	rw�szIPv4Interface.__lt__cCst|j|jt|jj�f�S)N)r}r(rHrjr�rJ)rVrrr	r�szIPv4Interface.__hash__cCs
t|j�S)N)rr()rVrrr	r-�szIPv4Interface.ipcCsd|j|j�|jfS)Nz%s/%s)r{r(rH)rVrrr	r��szIPv4Interface.with_prefixlencCsd|j|j�|jfS)Nz%s/%s)r{r(r�)rVrrr	r��szIPv4Interface.with_netmaskcCsd|j|j�|jfS)Nz%s/%s)r{r(r�)rVrrr	r��szIPv4Interface.with_hostmaskN)rrrr�r|rvrwrrTrprrr-r�r�r�rrrr	risrc@s.eZdZeZddd�Zeej�dd���Z	dS)rTcCs�tj||�t|ttf�r&|}|j}n^t|t�rT|d}t|�dkrL|dn|j}n0t|�}|j	|d�}t|�dkr~|dn|j}t
|�|_|j|�\|_
|_t|j�}|t|j
�@|kr�|r�td|��nt
|t|j
�@�|_|j|jdkr�|j|_dS)Nrr%rz%s has host bits set)rNr�r4rjr�r8r�r"r$rlrrJr�r�rHr
r�r�)rVrrr#r��argsr�rrr	r��s(%


zIPv4Network.__init__cCs&|jtd�ko|jtd�ko$|jS)Nz
100.64.0.0/10)rJrrCr�)rVrrr	r�s
zIPv4Network.is_globalN)T)
rrrrr�r�rrr�r�r�rrrr	r�s

Crc@s�eZdZed�Zed�Zed�Zed�Zed�ed�ed�ed�ed�ed�ed	�ed
�ed�ed�ed
�ed�ed�ed�gZed�ed�gZ	ed�Z
ed�ZdS)�_IPv4Constantsz169.254.0.0/16z127.0.0.0/8z224.0.0.0/4z
100.64.0.0/10z	0.0.0.0/8z
10.0.0.0/8z
172.16.0.0/12z192.0.0.0/24z192.0.0.170/31z192.0.2.0/24z192.168.0.0/16z
198.18.0.0/15z198.51.100.0/24z203.0.113.0/24z240.0.0.0/4z255.255.255.255/32z192.0.0.9/32z
192.0.0.10/32z0.0.0.0N)
rrrrr�r�r�r�r�r�r�rr�rrrr	r�s,

r�c@s�eZdZfZdZdedZdZed�Z	eZ
iZedd��Z
edd	��Zed
d��Zedd
��Zeddd��Zdd�Zdd�Zedd��Zedd��ZdS)�_BaseV6r3rr%rcZ0123456789ABCDEFabcdefcCsJ||jkr@t|t�r|}n
|j|�}t|j|��}||f|j|<|j|S)N)r�r4rjrkrrb)r`r�rar�rrr	r�Zs	


z_BaseV6._make_netmaskcCs�|std��|jd�}d}t|�|kr:d||f}t|��d|dkr�yt|j��j}Wn4tk
r�}ztd||f�d�WYdd}~XnX|jd|d	?d
@�|jd|d
@�|jd}t|�|kr�d|d|f}t|��d}xDtdt|�d�D].}	||	�s�|dk	�r$d|}t|��|	}�q�W|dk	�r�|}
t|�|d}|d
�st|
d8}
|
�rtd}t||��|d�s�|d8}|�r�d}t||��|j|
|}|dk�r:d}t||jd|f��njt|�|jk�r�d}t||j|f��|d
�sd}t||��|d�s*d}t||��t|�}
d
}d
}ytd
}
x,t|
�D] }	|
d	K}
|
|j	||	�O}
�qJW|
d	|K}
x0t|d
�D] }	|
d	K}
|
|j	||	�O}
�q�W|
St
k
�r�}ztd||f�d�WYdd}~XnXdS)NzAddress cannot be empty�:r�z At least %d parts expected in %rr�r%z%s in %rz%xri��z!At most %d colons permitted in %rz At most one '::' permitted in %rrz0Leading ':' only permitted as part of '::' in %rz1Trailing ':' only permitted as part of '::' in %rz/Expected at most %d other parts with '::' in %rz,Exactly %d parts expected without '::' in %rrFrFrF)rr!r"rr=r(r@�
_HEXTET_COUNTr��
_parse_hextetr
)r`rmr�Z
_min_partsr]Zipv4_intr�Z
_max_partsZ
skip_index�iZparts_hiZparts_loZ
parts_skippedrdrrr	rlls�
$









z_BaseV6._ip_int_from_stringcCs>|jj|�std|��t|�dkr4d}t||��t|d�S)NzOnly hex digits permitted in %rrz$At most 4 characters permitted in %rr)�_HEX_DIGITSrir
r"rj)r`Z
hextet_strr]rrr	r��sz_BaseV6._parse_hextetc	Cs�d}d}d}d}xJt|�D]>\}}|dkrP|d7}|dkr>|}||krX|}|}qd}d}qW|dkr�||}|t|�kr�|dg7}dg|||�<|dkr�dg|}|S)	Nr%rr��rFrFrFrF)r�r")	r`�hextetsZbest_doublecolon_startZbest_doublecolon_lenZdoublecolon_startZdoublecolon_len�indexZhextetZbest_doublecolon_endrrr	�_compress_hextets�s.

z_BaseV6._compress_hextetsNcsZ|dkrt|j�}||jkr$td��d|��fdd�tddd�D�}|j|�}dj|�S)	NzIPv6 address is too largez%032xcs&g|]}dt�||d�d��qS)z%xrr)rj)r�r�)�hex_strrr	r�3sz/_BaseV6._string_from_ip_int.<locals>.<listcomp>rrrr�)rjr(r9r
r�r�r�)r`rdr�r)r�r	r{s


z_BaseV6._string_from_ip_intcs�t|t�rt|j�}nt|t�r,t|j�}nt|�}|j|�}d|��fdd�tddd�D�}t|ttf�r�ddj	|�|j
fSdj	|�S)	Nz%032xcsg|]}�||d��qS)rr)r�r�)r�rr	r�Ksz8_BaseV6._explode_shorthand_ip_string.<locals>.<listcomp>rrrz%s/%dr�)r4rr rJrr-rlr�rNr�rH)rVrmrdr�r)r�r	rU8s



z$_BaseV6._explode_shorthand_ip_stringcCs&|jddd�jdd�}dj|�dS)Nr%r�r�r�z	.ip6.arparF)rW�replacer�)rVZ
reverse_charsrrr	rYPsz_BaseV6._reverse_pointercCs|jS)N)r8)rVrrr	r�Ysz_BaseV6.max_prefixlencCs|jS)N)rG)rVrrr	r7]sz_BaseV6.version)N)rrrrqrG�
IPV6LENGTHr9r�r�r�r8r�rsr�rlr�r�r{rUrYrrr�r7rrrr	r�Fs"	h0	r�c@s�eZdZdZdd�Zedd��Zedd��Zed	d
��Zedd��Z	ed
d��Z
eej�dd���Z
edd��Zedd��Zedd��Zedd��Zedd��Zedd��ZdS)rr(r�cCsrt|t�r|j|�||_dSt|t�rF|j|d�tj|d�|_dSt|�}d|krbtd|��|j	|�|_dS)NrrrzUnexpected '/' in %r)
r4rjr^r(r�r_r�r rrl)rVrr�rrr	r�hs


zIPv6Address.__init__cCs
t|j�S)N)rr()rVrrr	r��szIPv6Address.packedcCs||jjkS)N)r�r�)rVrrr	r��s	zIPv6Address.is_multicastcst�fdd��jjD��S)Nc3s|]}�|kVqdS)Nr)r�r�)rVrr	r��sz*IPv6Address.is_reserved.<locals>.<genexpr>)r�r��_reserved_networks)rVr)rVr	r��s	zIPv6Address.is_reservedcCs||jjkS)N)r�r�)rVrrr	r��szIPv6Address.is_link_localcCs||jjkS)N)r��_sitelocal_network)rVrrr	�
is_site_local�szIPv6Address.is_site_localcsH�j}|dk	r|jSt�fdd��jjD��oFt�fdd��jjD��S)Nc3s|]}�|kVqdS)Nr)r�r:)rVrr	r��sz)IPv6Address.is_private.<locals>.<genexpr>c3s|]}�|kVqdS)Nr)r�r:)rVrr	r��s)�ipv4_mappedr�r�r�r�r�r�)rVr�r)rVr	r��s
zIPv6Address.is_privatecCs|jS)N)r�)rVrrr	r��szIPv6Address.is_globalcCs
|jdkS)Nr)r()rVrrr	r��s	zIPv6Address.is_unspecifiedcCs
|jdkS)Nr%)r()rVrrr	r��s	zIPv6Address.is_loopbackcCs |jd?dkrdSt|jd@�S)Nri��l��)r(r)rVrrr	r��s	zIPv6Address.ipv4_mappedcCs4|jd?dkrdSt|jd?d@�t|jd@�fS)N�`i �@l��)r(r)rVrrr	�teredos
zIPv6Address.teredocCs$|jd?dkrdSt|jd?d@�S)N�pi �Pl��)r(r)rVrrr	�	sixtofours	zIPv6Address.sixtofourN)r(r�)rrrrqr�rrr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr	rbs$

rc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zej	Z	e
dd��Ze
d
d��Ze
dd��Z
e
dd��Ze
dd��Ze
dd��ZdS)rcCs�t|ttf�r2tj||�t|j�|_|j|_	dSt|t
�r�tj||d�t|�dkrht|d�|_	n|j|_	t|dd�|_|jj|_|jj
|_
dSt|�}tj||d�t|dd�|_|jj|_|jj	|_	|jj
|_
dS)Nrr%F)r)r4r�rjrr�rr(r�r8rHr�r"r�r�r$)rVrr#rrr	r�+s(




zIPv6Interface.__init__cCsd|j|j�|jjfS)Nz%s/%d)r{r(r�ra)rVrrr	r|CszIPv6Interface.__str__cCsDtj||�}|s|tkr|Sy|j|jkStk
r>dSXdS)NF)rrvrQr�rI)rVrur�rrr	rvGszIPv6Interface.__eq__cCsNtj||�}|tkrtSy|j|jkp4|j|jko4|Stk
rHdSXdS)NF)rrwrQr�rI)rVrur�rrr	rwSszIPv6Interface.__lt__cCst|j|jt|jj�f�S)N)r}r(rHrjr�rJ)rVrrr	r_szIPv6Interface.__hash__cCs
t|j�S)N)rr()rVrrr	r-dszIPv6Interface.ipcCsd|j|j�|jfS)Nz%s/%s)r{r(rH)rVrrr	r�hszIPv6Interface.with_prefixlencCsd|j|j�|jfS)Nz%s/%s)r{r(r�)rVrrr	r�mszIPv6Interface.with_netmaskcCsd|j|j�|jfS)Nz%s/%s)r{r(r�)rVrrr	r�rszIPv6Interface.with_hostmaskcCs|jdko|jjS)Nr)r(r�r�)rVrrr	r�wszIPv6Interface.is_unspecifiedcCs|jdko|jjS)Nr%)r(r�r�)rVrrr	r�{szIPv6Interface.is_loopbackN)rrrr�r|rvrwrrTrprrr-r�r�r�r�r�rrrr	r)src@s.eZdZeZd	dd�Zdd�Zedd��ZdS)
rTcCs�tj||�t|ttf�r&|}|j}n^t|t�rT|d}t|�dkrL|dn|j}n0t|�}|j	|d�}t|�dkr~|dn|j}t
|�|_|j|�\|_
|_t|j�}|t|j
�@|kr�|r�td|��nt
|t|j
�@�|_|j|jdkr�|j|_dS)Nrr%rz%s has host bits set)rNr�r4rjr�r8r�r"r$rlrrJr�r�rHr
r�r�)rVrrr#r�r�r�rrr	r��s( 


zIPv6Network.__init__ccs@t|j�}t|j�}x&t|d|d�D]}|j|�Vq(WdS)Nr%)rjrJrCr�r�)rVr�r�r�rrr	r��s

zIPv6Network.hostscCs|jjo|jjS)N)rJr�rC)rVrrr	r��szIPv6Network.is_site_localN)T)	rrrrr�r�r�rrr�rrrr	r�s
>rc@s�eZdZed�Zed�Zed�ed�ed�ed�ed�ed�ed	�ed
�ed�ed�g
Zed�ed
�ed�ed�ed�ed�gZed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed �gZed!�Z	d"S)#�_IPv6Constantsz	fe80::/10zff00::/8z::1/128z::/128z
::ffff:0:0/96z64:ff9b:1::/48z100::/64z	2001::/23z
2001:db8::/32z	2002::/16zfc00::/7z
2001:1::1/128z
2001:1::2/128z2001:3::/32z2001:4:112::/48z2001:20::/28z2001:30::/28z::/8z100::/8z200::/7z400::/6z800::/5z1000::/4z4000::/3z6000::/3z8000::/3zA000::/3zC000::/3zE000::/4zF000::/5zF800::/6zFE00::/9z	fec0::/10N)
rrrrr�r�r�r�r�r�rrrr	r��s6


r�)T)"�__version__r�r�r�r
rr
rrrrrr$r.r2r;rErMrSrT�total_orderingr5rNrgrrrr�r�r�rrrr�rrrr	�<module>sV
#716:EE
Sa&HWj-bisect.cpython-36.opt-2.pyc000064400000002546150335715140011416 0ustar003


 \#
�@sVddd�ZeZddd�ZeZd
dd�Zddd	�Zydd
lTWnek
rPYnXdS)�NcCsd|dkrtd��|dkr t|�}x2||krR||d}|||krH|}q"|d}q"W|j||�dS)Nrzlo must be non-negative��)�
ValueError�len�insert)�a�x�lo�hi�mid�r�/usr/lib64/python3.6/bisect.py�insort_rights	
rcCsX|dkrtd��|dkr t|�}x2||krR||d}|||krH|}q"|d}q"W|S)Nrzlo must be non-negativerr)rr)rrr	r
rrrr
�bisect_rights
rcCsd|dkrtd��|dkr t|�}x2||krR||d}|||krL|d}q"|}q"W|j||�dS)Nrzlo must be non-negativerr)rrr)rrr	r
rrrr
�insort_left/s	

rcCsX|dkrtd��|dkr t|�}x2||krR||d}|||krL|d}q"|}q"W|S)Nrzlo must be non-negativerr)rr)rrr	r
rrrr
�bisect_leftCs

r)�*)rN)rN)rN)rN)rZinsortrZbisectrrZ_bisect�ImportErrorrrrr
�<module>s



pydoc.cpython-36.opt-1.pyc000064400000242765150335715140011273 0ustar003

�]dhM��@s�dZdgZdZdZdZddlZddlZddlZddl	Zddl
ZddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZdd	lmZd
d�Zdd
�Zdd�Zdd�Z dd�Z!dd�Z"dd�Z#ej$dej%�Z&dd�Z'dd�Z(dd�Z)dd �Z*d!d"�Z+dud#d$�Z,d%d&�Z-d'd(�Z.d)d*�Z/d+d,�Z0ifd-d.�Z1Gd/d0�d0e2�Z3d1d2�Z4difd3d4�Z5Gd5d6�d6�Z6Gd7d8�d8e�Z7Gd9d:�d:e6�Z8Gd;d<�d<e�Z9Gd=d>�d>e6�Z:Gd?d@�d@e:�Z;dAdB�a<dCdD�Z=dEdF�Z>dGdH�Z?dIdJ�Z@dKdL�ZAdMdN�ZBdOdP�ZCdQdR�ZDdvdSdT�ZEe:�ZFe;�ZGe8�ZHdwdUdV�ZIdxdXdY�ZJdydZd[�ZKdzd\d]�ZLd{d_d`�ZMGdadb�db�ZNeN�ZOGdcdd�dd�ZPdedf�ZQdgdh�ZRd|djdk�ZSd}dldm�dndo�ZTdpdq�ZUdrds�ZVeWdtk�r�eV�dS)~a�Generate Python documentation in HTML or text for interactive use.

At the Python interactive prompt, calling help(thing) on a Python object
documents the object, and calling help() starts up an interactive
help session.

Or, at the shell command line outside of Python:

Run "pydoc <name>" to show documentation on something.  <name> may be
the name of a function, module, package, or a dotted reference to a
class or function within a module or module in a package.  If the
argument contains a path segment delimiter (e.g. slash on Unix,
backslash on Windows) it is treated as the path to a Python source file.

Run "pydoc -k <keyword>" to search for a keyword in the synopsis lines
of all available modules.

Run "pydoc -p <port>" to start an HTTP server on the given port on the
local machine.  Port number 0 can be used to get an arbitrary unused port.

Run "pydoc -b" to start an HTTP server on an arbitrary unused port and
open a Web browser to interactively browse documentation.  The -p option
can be used with the -b option to explicitly specify the server port.

Run "pydoc -w <name>" to write out the HTML documentation for a module
to a file named "<name>.html".

Module docs for core modules are assumed to be in

    https://docs.python.org/X.Y/library/

This can be overridden by setting the PYTHONDOCS environment variable
to a different URL or to a local directory containing the Library
Reference Manual pages.
�helpzKa-Ping Yee <ping@lfw.org>z26 February 2001z�Guido van Rossum, for an excellent programming language.
Tommy Burnette, the original creator of manpy.
Paul Prescod, for all his work on onlinehelp.
Richard Chamberlain, for the first implementation of textdoc.
�N)�deque)�Repr)�format_exception_onlycCs`g}g}xRtjD]H}tjj|p d�}tjj|�}||krtjj|�r|j|�|j|�qW|S)zAConvert sys.path into a list of absolute, existing, unique paths.�.)�sys�path�os�abspath�normcase�isdir�append)�dirsZnormdirs�dirZnormdir�r�/usr/lib64/python3.6/pydoc.py�pathdirsLs
rcCs.tj|�ptj|�}|r*tjdd|j��p,dS)z-Get the doc string or comments for an object.z^ *
�)�inspect�getdocZgetcomments�re�sub�rstrip)�object�resultrrrrXsrcCsh|j�jd�}t|�dkr&|ddfSt|�dkrZ|dj�rZ|ddj|dd��fSddj|�fS)z>Split a doc string into a synopsis line (if any) and the rest.�
�rr�N)�strip�split�lenr�join)�doc�linesrrr�splitdoc]sr$cCs"|j}|j|kr|jd|}|S)z@Get a class name and qualify it with a module name if necessary.r)�__name__�
__module__)r�modname�namerrr�	classnamefs
r)cCs>tj|�p:tj|�p:tj|�p:tj|�p:tj|�p:tj|�S)z>Check if an object is of a type that probably means it's data.)r�ismodule�isclass�	isroutineZisframeZistracebackZiscode)rrrr�isdatamsr-cGs2x,|r,|dj|j|d��}|dd�}qW|S)z/Do a series of global replacements on a string.rrrN)r!r)�textZpairsrrr�replacessr/cCsXt|�|krTtd|dd�}td|d|�}|d|�d|t|�|d�S|S)zCOmit part of a string if needed to make it fit in a maximum length.r�rNz...)r �max)r.�maxlenZpreZpostrrr�cramzs
$r3z at 0x[0-9a-f]{6,16}(>+)$cCstjd|�S)z>Remove the hexadecimal id from a Python object representation.z\1)�_re_stripidr)r.rrr�stripid�sr5cCs(tj|�p&tj|�p&tj|�p&tj|�S)N)r�
isfunction�ismethod�	isbuiltinZismethoddescriptor)�objrrr�_is_some_method�s


r:cCs<tj|�rdStj|�r8t|dd�}tj|�p4|dkSdS)zo
    Returns True if fn is a bound method, regardless of whether
    fn was implemented in Python or in C.
    T�__self__NF)rr7r8�getattrr*)�fn�selfrrr�_is_bound_method�s

r?cCshi}x tj|t�D]\}}d||<qWx|jD]}|jt|��q.Wx|j�D]}t||�||<qNW|S)Nr)r�
getmembersr:�	__bases__�update�
allmethods�keysr<)�cl�methods�key�value�baserrrrC�srCcCs<g}g}x*|D]"}||�r&|j|�q|j|�qW||fS)z�Split sequence s via predicate, and return pair ([true], [false]).

    The return value is a 2-tuple of lists,
        ([x for x in s if predicate(x)],
         [x for x in s if not predicate(x)])
    )r
)�s�	predicate�yes�no�xrrr�_split_list�s
rOcCs\|dkrdS|jd�r$|jd�r$dS|jd�r<t|d�r<dS|dk	rL||kS|jd�SdS)z3Decide whether to show documentation on a variable.�
__author__�__builtins__�
__cached__�__credits__�__date__�__doc__�__file__�__spec__�
__loader__r&r%�__package__�__path__�__qualname__�	__slots__�__version__r�__r�_�_fieldsTN>rWrXrZr&rQrRrPr]rSrTr%rVr\rYrUr[)�
startswith�endswith�hasattr)r(�allr9rrr�visiblename�srecCsDg}x:tj|�D],\}}}}tj|�r*d}|j||||f�qW|S)zCWrap inspect.classify_class_attrs, with fixup for data descriptors.zdata descriptor)r�classify_class_attrs�isdatadescriptorr
)r�resultsr(�kind�clsrHrrrrf�s
rfcs\t|dg��y�fdd�t��D��Wntk
r>i�YnX�fdd�}|j|d�dS)zGSort the attrs list in-place by _fields and then alphabetically by namer`csi|]\}}|t��|�qSr)r )�.0�ir()�fieldsrr�
<dictcomp>�sz#sort_attributes.<locals>.<dictcomp>cs�j|dd�|dfS)Nr)�get)�attr)�field_orderrr�<lambda>�sz!sort_attributes.<locals>.<lambda>)rGN)r<�	enumerate�	TypeError�sort)�attrsrZkeyfuncr)rqrmr�sort_attributes�s
rwcCs<tjj|�r8x*dD]"}tjjtjj|d|��rdSqWdS)z3Guess whether a path refers to a package directory.�.py�.pyc�__init__TF)rxry)r	rr�isfiler!)r�extrrr�	ispackage�s

r}cCs�|j�}x,|dd�dks$|j�r4|j�}|s
Pq
W|j�}|dd�dkrZ|dd�}|dd�dkr�|dd�}|d	d�dkr�|dd
�}x|j�s�|j�}|s�Pq�W|jd�dj�}nd}|S)Nr�#�zr"""r0z"""�\r���r�)�readlinerr)�file�linerrrr�source_synopsis�s&
r�c
Cstj|�j}|j|d�\}}|dks.||k�r|jttjj��rJtjj	}n |jttjj
��rftjj}nd}|dkr�ytj
|�}Wntk
r�dSX|�t|�}WdQRXnZ|d|�}tjjd||d�}ytjj|�}	Wn
dStjd=|	j�r|	jj�dnd}||f||<|S)z.Get the one-line summary out of a module file.NZ__temp__)�loaderr)NN)r	�stat�st_mtimerorb�tuple�	importlib�	machinery�BYTECODE_SUFFIXES�SourcelessFileLoader�EXTENSION_SUFFIXES�ExtensionFileLoader�tokenize�open�OSErrorr��util�spec_from_file_location�
_bootstrap�_loadr�modulesrU�
splitlines)
�filename�cache�mtimeZ
lastupdaterZ
loader_clsr�r��spec�modulerrr�synopsis�s4



r�c@s eZdZdZdd�Zdd�ZdS)�ErrorDuringImportzEErrors that occurred while trying to import something to document it.cCs||_|\|_|_|_dS)N)r��excrH�tb)r>r��exc_inforrrrz#szErrorDuringImport.__init__cCs|jj}d|j||jfS)Nzproblem in %s - %s: %s)r�r%r�rH)r>r�rrr�__str__'szErrorDuringImport.__str__N)r%r&r[rUrzr�rrrrr�!sr�c	Cs�tjj}t|d��}||jt|��k}WdQRXtjj|�}tjj	|�\}}|r`tj
j||�}ntj
j||�}tjj
|||d�}ytjj|�St|tj���YnXdS)z<Import a Python source file or compiled file given its path.�rbN)r�)r�r��MAGIC_NUMBERr��readr r	r�basename�splitext�_bootstrap_externalr��SourceFileLoaderr�r�r�r�rr�)	r�magicr�Zis_bytecoder�r(r|r�r�rrr�
importfile+sr�cs"yb|rX�tjkrX�tjkrX�fdd�tjD�}x(�g|D]}tj|||<tj|=q:Wt��}Wnxtj�\}}}}	�tjkr�ttj�j|	��n<|tkr�t|j|	��n&t	|t
�r�|j�kr�dSt�tj���YnXx@�jd�dd�D]*}
yt
||
�}Wq�tk
�rdSXq�W|S)a�Import a module; handle errors; return None if the module isn't found.

    If the module *is* found but an exception occurs, it's wrapped in an
    ErrorDuringImport exception and reraised.  Unlike __import__, if a
    package path is specified, the module at the end of the path is returned,
    not the package at the beginning.  If the optional 'forceload' argument
    is 1, we reload the module from disk (unless it's a dynamic extension).csg|]}|j�d�r|�qS)r)ra)rk�m)rrr�
<listcomp>Qszsafeimport.<locals>.<listcomp>Nrr)rr��builtin_module_names�
__import__r�r�rV�SyntaxErrorr��
issubclass�ImportErrorr(rr<�AttributeError)r�	forceloadr�ZsubsrGr�r�rHr��info�partr)rr�
safeimport=s.


r�c@s|eZdZejjddejdd��Zd
dd�Z	ddd�Z
e
ZZZ
ZZZejjejd	d
ejdd��fdd�ZdS)�Doc�
PYTHONDOCSz%https://docs.python.org/%d.%d/libraryNrcGs�||f|}tj|�r |j|�Stj|�r4|j|�Sy@tj|�rJ|j|�Stj|�r^|j|�Stj|�rr|j	|�SWnt
k
r�YnXt|t�r�|j
|�S|j|�S)z%Generate documentation for an object.)r�isgetsetdescriptor�docdata�ismemberdescriptorr*�	docmoduler+�docclassr,�
docroutiner��
isinstance�property�docproperty�docother)r>rr(�argsrrr�documentss"










zDoc.documentcGs*d|odt|�t|�jf}t|��dS)z+Raise an exception for unimplemented types.z.don't know how to document object%s of type %s� N)�repr�typer%rt)r>rr(r��messagerrr�fail�szDoc.fail�libzpython%d.%dcCs�ytj|�}Wntk
r&d}YnXtjjd|j�}tjj|�}t	|t
t��r�|jdks||j|�r�|jtjj
|d
��r�|jdkr�|jd�r�d|jd�|jj�f}q�tjj
||jj�d�}nd}|S)z*Return the location of module docs or Nonez
(built-in)r��errno�
exceptions�gc�imp�marshal�posix�signalr�_thread�	zipimportz
site-packages�	xml.etree�test.pydoc_mod�http://�https://z%s/%s�/z.htmlN)
r�r�r�r�r�r�r�rr�r�)r�r�)r�r�)r�
getabsfilertr	�environror�rrr�r�r%rar!r�lower)r>rZbasedirr��doclocrrr�	getdocloc�s$



z
Doc.getdocloc)N)N)r%r&r[r	r�ror�version_infor�r�r�r�r�r�r�r�r�rr!�base_exec_prefixr�rrrrr�ms

r�c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZeZ	dd
�Z
eZdS)�HTMLReprzBClass for safely making an HTML representation of a Python object.cCs,tj|�d|_|_d|_d|_|_dS)N��
�d)rrz�maxlist�maxtuple�maxdict�	maxstring�maxother)r>rrrrz�s
zHTMLRepr.__init__cCst|dddddd�S)N�&z&amp;�<z&lt;�>z&gt;)r/)r>r.rrr�escape�szHTMLRepr.escapecCstj||�S)N)rr�)r>rrrrr��sz
HTMLRepr.reprcCsZtt|�d�r@ddjt|�jj��}t||�r@t||�||�S|jttt	|��|j
��S)Nr%�repr_r_)rcr�r!r%rr<r�r3r5r�r�)r>rN�level�
methodnamerrr�repr1�s

zHTMLRepr.repr1cCs^t||j�}t|�}d|krJdt|dd�krJd|d|j|�|dStjdd|j|��S)Nr�z\\r�rrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z<font color="#c040c0">\1</font>)r3r�r�r/r�rr)r>rNr��test�testreprrrr�repr_string�szHTMLRepr.repr_stringcCs8y|jttt|��|j��S|jd|jj�SdS)Nz
<%s instance>)r�r3r5r�r��	__class__r%)r>rNr�rrr�
repr_instance�szHTMLRepr.repr_instanceN)r%r&r[rUrzr�r�r�r��repr_strr�Zrepr_unicoderrrrr��sr�c@seZdZdZe�ZejZejZdd�Zd5dd�Z	d6d
d�Z
dd
�Zdd�Zd7dd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdiiifdd �Zd8d!d"�Zd9d#d$�Zddiifd%d&�Zd'd(�Zddiiidfd)d*�Zd+d,�Zd:d-d.�Zd;d/d0�Zd<d1d2�Zd=d3d4�ZdS)>�HTMLDocz'Formatter class for HTML documentation.cCsd||fS)zFormat an HTML page.z�<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
%s
</body></html>r)r>�title�contentsrrr�page�szHTMLDoc.pagercCsd|||||pdfS)zFormat a page heading.a'
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="%s">
<td valign=bottom>&nbsp;<br>
<font color="%s" face="helvetica, arial">&nbsp;<br>%s</font></td
><td align=right valign=bottom
><font color="%s" face="helvetica, arial">%s</font></td></tr></table>
    z&nbsp;r)r>r��fgcol�bgcolZextrasrrr�heading�s	zHTMLDoc.heading�N�&nbsp;c	
Cs^|dkrdd|d}d|||f}	|r@|	d||||f}	n|	d|||f}	|	d|S)	z Format a section with a heading.Nz<tt>z&nbsp;z</tt>z�<p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="%s">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="%s" face="helvetica, arial">%s</font></td></tr>
    zR
<tr bgcolor="%s"><td rowspan=2>%s</td>
<td colspan=2>%s</td></tr>
<tr><td>%s</td>z(
<tr><td bgcolor="%s">%s</td><td>%s</td>z'
<td width="100%%">%s</td></tr></table>r)
r>r�r�r�r��widthZpreludeZ
marginaliaZgaprrrr�section�szHTMLDoc.sectioncGsd|}|j|f|��S)z$Format a section with a big heading.z<big><strong>%s</strong></big>)r)r>r�r�rrr�
bigsection	szHTMLDoc.bigsectionc
Cs&|j|j��}t|dddddddd�	S)z!Format literal preformatted text.z

z
 
r�z&nbsp;rz<br>
)r��
expandtabsr/)r>r.rrr�	preformatszHTMLDoc.preformatrcCs�d}t|�|d|}xht|�D]\}|dd|}x>t|||||�D]$}|t|�krN||||�d}qNW|d}q"Wd|S)z0Format a list of items into a multi-column list.rrz<td width="%d%%" valign=top>r�z<br>
z</td>z7<table width="100%%" summary="list"><tr>%s</tr></table>)r �range)r>�list�formatZcolsr�rows�colrlrrr�multicolumnszHTMLDoc.multicolumncCsd|S)Nz<font color="#909090">%s</font>r)r>r.rrr�grey szHTMLDoc.greycGs*x$|D]}||krd|||fSqW|S)z:Make a link for an identifier, given name-to-URL mappings.z<a href="%s">%s</a>r)r>r(Zdicts�dictrrr�namelink"s
zHTMLDoc.namelinkcCsN|jtjj|j�}}t||�rDt||�|krDd|j|t||�fSt||�S)zMake a link for a class.z<a href="%s.html#%s">%s</a>)r%rr�ror&rcr<r))r>rr'r(r�rrr�	classlink)s
zHTMLDoc.classlinkcCsd|j|jfS)zMake a link for a module.z<a href="%s.html">%s</a>)r%)r>rrrr�
modulelink1szHTMLDoc.modulelinkcCsR|\}}}}|r|j|�S|r,d||f}nd|}|rBd|}n|}d||fS)z;Make a link for a module or package to display in an index.z
%s.%s.htmlz%s.htmlz"<strong>%s</strong>&nbsp;(package)z<a href="%s">%s</a>)r)r>Z
modpkginfor(rr}�shadowed�urlr.rrr�
modpkglink5s

zHTMLDoc.modpkglinkcCsd||fS)zMake a link to source file.z<a href="file:%s">%s</a>r)r>rrrrr�filelinkDszHTMLDoc.filelinkcCs�|p|j}g}d}tjd�}�xL|j||�}	|	s2P|	j�\}
}|j||||
���|	j�\}}
}}}}|
r�||�jdd�}|jd||f�n�|r�dt|�}|jd|||�f�n�|r�dt|�}|jd|||�f�n�|�r$|||d�d	k�r|jd
|j	||��n|jd|�n@|||d�d	k�rR|j|j	||||��n|j|j	||��|}q W|j|||d���d
j
|�S)z�Mark up some plain text, given a context of symbols to look for.
        Each context dictionary maps object names to anchor names.rzD\b((http|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?(\w+))�"z&quot;z<a href="%s">%s</a>z'http://www.rfc-editor.org/rfc/rfc%d.txtz(http://www.python.org/dev/peps/pep-%04d/r�(zself.zself.<strong>%s</strong>Nr)r�r�compile�search�spanr
�groupsr/�intrr!)r>r.r��funcs�classesrFrh�here�pattern�match�start�endrd�schemeZrfcZpepZselfdotr(rrrr�markupHs<

zHTMLDoc.markupc
Cs�d}x�|D]�}t|�tf�kr�|\}}|d}||j||�}|r�||fkr�g}x|D]}	|j|j|	|��qVW|ddj|�d}|d}q
t|�tg�kr
|d|j|||�}q
Wd|S)	zAProduce HTML for a class tree as given by inspect.getclasstree().rz"<dt><font face="helvetica, arial">rz, �)z
</font></dt>z
<dd>
%s</dd>
z
<dl>
%s</dl>
)r�rr
r!�
formattree)
r>�treer'�parentr�entry�c�bases�parentsrIrrrr(ss 


zHTMLDoc.formattreec#s�|j}y
|j}Wntk
r(d}YnX|jd�}g}x@tt|�d�D],}|jddj|d|d��||f�qJWdj||d.d��}	d|	}
y&tj	|�}t
jj|�}�j
||�}
Wntk
r�d}
YnXg}t|d��r:t|j�}|dd�d/k�r&|d0d�d	k�r&|dd1�j�}|jd�j|��t|d��r\|j�jt|j���|�rt|
d
dj|�}
�j|�}|dk	�r�dt�}nd}�j|
ddd|
|�}tj|tj�}gi}}xltj|tj�D]Z\}}|dk	�stj|��p�||k�r�t|||��r�|j||f�d|||<||<�q�Wx�|D]�\}}xx|jD]n}|j|j}}tj j!|�}||k�rL|�rLt||��rLt"||�|k�rL||k�rL|d|||<||<�qLW�q<Wgi}}x�tj|tj#�D]p\}}|dk	�stj$|��stj|�|k�r�t|||��r�|j||f�d|||<tj%|��r�||||<�q�Wg}x6tj|t&�D]&\}}t|||��rd|j||f��qdW�j't(|��j)||�}|�o�d|}|d|}t|d��r*g}x.t*j+|j,�D]\}}} |j||| df��q�W|j-��j.|�j/�}!|�j0ddd|!�}n.|�rX�j.|�fdd��}!|�j0ddd|!�}|�r�d d!�|D�}"�j1tj2|"d�|�g}!x*|D]"\}}|!j�j3|||||���q�W|�j0d"dd#d$j|!��}|�rg}!x*|D]"\}}|!j�j3|||||���q�W|�j0d%dd&d$j|!��}|�rbg}!x$|D]\}}|!j�j3||���q(W|�j0d'dd(d)j|!��}t|d*��r��j't|j4��j)�}!|�j0d+dd|!�}t|d,��rʈj't|j5��j)�}!|�j0d-dd|!�}|S)2z/Produce HTML documentation for a module object.Nrrz5<a href="%s.html"><font color="#ffffff">%s</font></a>z)<big><big><strong>%s</strong></big></big>z
(built-in)r]��$z
Revision: z
version %srTz (%s)z, z-<br><a href="%(docloc)s">Module Reference</a>rz#ffffffz#7799eez<a href=".">index</a><br>r~z.html#z#-z<tt>%s</tt>z
<p>%s</p>
rZrzPackage Contentsz#aa55cccs�j|d�S)Nr)r)�t)r>rrrr�sz#HTMLDoc.docmodule.<locals>.<lambda>�ModulescSsg|]\}}|�qSrr)rkrGrHrrrr��sz%HTMLDoc.docmodule.<locals>.<listcomp>ZClassesz#ee77aar�Z	Functionsz#eeaa77ZDataz#55aa55z<br>
rPZAuthorrSZCreditsr�z$Revision: r�r�)6r%�__all__r�rrr r
r!rr��urllib�parseZquoterrtrc�strr]rr�rTr��localsrr@r*r+�	getmodulererAr&rr�ror<r,r8r6r-r&rr�pkgutil�iter_modulesrZrur
rrr(�getclasstreer�rPrS)#r>rr(�mod�ignoredrd�partsZlinksrlZ
linkedname�headrrrr��versionr�rr�rZcdictrGrHrIr'r�rZfdict�datar"�modpkgs�importer�ispkgr��	classlistr)r>rr��s�


&


$




$

zHTMLDoc.docmodulecs�j}|p|}�j}g}	|	j�G�fdd�d�}
|
��ttj���}t|�dkr��j��d�x"|D]}�d�j|�j	��qfW�d���������fdd�}
����fd	d
�}��������fdd�}�fd
d�t
��D�}i�xv|D]n\}}}}d|d|�|<}yt�|�}Wntk
�r:YnXy|�|<Wq�t
k
�r^Yq�Xq�Wx�|�rT|�r||j��n|dd�t|�fdd��\}}�tjk�r�|}�qfn"��k�r�d}nd�j��j	�}|d7}t|��|
d||dd��}|
d||dd��}|
d||dd��}|d||dd��}|d||d d��}|}�qfWd!j|	�}	||k�rxd"||f}nd#|||f}|�r�g}x"|D]}|j�j|�j	���q�W|d$d%j|�}�jt���j����}|�o�d&|}�j|d'd(|	d)|�S)*z.Produce HTML documentation for a class object.cs eZdZdd�Z�fdd�ZdS)z(HTMLDoc.docclass.<locals>.HorizontalRulecSs
d|_dS)Nr)�needone)r>rrrrzsz1HTMLDoc.docclass.<locals>.HorizontalRule.__init__cs|jr�d�d|_dS)Nz<hr>
r)rF)r>)�pushrr�maybe
sz.HTMLDoc.docclass.<locals>.HorizontalRule.maybeN)r%r&r[rzrHr)rGrr�HorizontalRule
srIrz&<dl><dt>Method resolution order:</dt>
z<dd>%s</dd>
z</dl>
cs�t||�\}}|r��j��|�xl|D]d\}}}}yt�|�}Wn&tk
rh��j||���YnX��j||��������d�q(W|S)Nr)rOrHr<�	Exception�_docdescriptorr�)�msgrvrK�okr(ri�homeclsrH)rr�hr�mdictr<rrGr>rr�spillszHTMLDoc.docclass.<locals>.spillcsNt||�\}}|rJ�j��|�x&|D]\}}}}��j||���q(W|S)N)rOrHrK)rLrvrKrMr(rirNrH)rOr<rGr>rr�spilldescriptors/sz*HTMLDoc.docclass.<locals>.spilldescriptorsc
s�t||�\}}|r��j��|�x�|D]�\}}}}�jt�|�|��}t|�sZtj|�rht|dd�}	nd}	|	dkr��d|�n0�jt|��j	����}	d|	}	�d||	f��d�q(W|S)NrUz<dl><dt>%s</dl>
z<dd><tt>%s</tt>z<dl><dt>%s%s</dl>
r)
rOrHr�r<�callablerrgr&rr)
rLrvrKrMr(rirNrHrIr")rrrOrPr<rrGr>rr�	spilldata8s"
z#HTMLDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qS))r9)re)rkr(rirjrH)rrrr�Ms
z$HTMLDoc.docclass.<locals>.<listcomp>r~�-rcs|d�kS)Nrr)r1)�	thisclassrrrrfsz"HTMLDoc.docclass.<locals>.<lambda>zdefined herezinherited from %sz:<br>
z
Methods %scSs|ddkS)Nr�methodr)r1rrrrrvszClass methods %scSs|ddkS)Nrzclass methodr)r1rrrrrxszStatic methods %scSs|ddkS)Nrz
static methodr)r1rrrrrzszData descriptors %scSs|ddkS)Nrzdata descriptorr)r1rrrrr|szData and other attributes %scSs|ddkS)NrrAr)r1rrrrr~srz*<a name="%s">class <strong>%s</strong></a>z/<strong>%s</strong> = <a name="%s">class %s</a>z(%s)z, z<tt>%s<br>&nbsp;</tt>z#000000z#ffc8d8r0)r%rAr
rr�getmror rHrr&rfr<rJrt�popleftrO�builtinsrrwr!r&rrr)r>rr(r<rrr=�realnamer-r�rI�mrorIrQrRrTrvrGrirNrH�anchor�	inherited�tagr�r.r"r)	rrrOrPr<rrGr>rVrr��s�

	



















zHTMLDoc.docclasscCs|jd|j|��S)z)Format an argument default value as text.�=)rr�)r>rrrr�formatvalue�szHTMLDoc.formatvaluecCs�|j}|p|}|r|jpdd|}	d}
d}t|�r�|jj}|rZ||k	r�d|j||�}
n0|jdk	rzd|j|jj|�}
nd|j||�}
||kr�d|	|f}
nD|r�tj||g�|kr�d	|jd||f}d
}n|}d|	||f}
d}tj|��rNytj|�}Wnt	t
fk
�r d}YnX|�rNt|�}|dk�rNd
|}
|d
d�}|�sXd}|
|j|�|
�ov|j
d|
�}|�r�d|S|jt|�|j|||�}|�o�d|}d||fSdS)z;Produce HTML documentation for a function or method object.rrUrz from Nz method of %s instancez unbound %s methodz$<a name="%s"><strong>%s</strong></a>z<a href="#%s">%s</a>rz)<a name="%s"><strong>%s</strong></a> = %sz<lambda>z$<strong>%s</strong> <em>lambda</em> z(...)z'<font face="helvetica, arial">%s</font>z<dl><dt>%s</dt></dl>
z<dd><tt>%s</tt></dd>z<dl><dt>%s</dt>%s</dl>
r�)r%r?r;r�rr�getattr_staticr,�	signature�
ValueErrorrtr6r�rr&rr)r>rr(r<rrrFrEr[r]�note�skipdocs�imclassr�Zreallink�argspecrc�declr"rrrr��sX


zHTMLDoc.docroutinecCsTg}|j}|r|d|�|jdk	rB|jt|�|j�}|d|�|d�dj|�S)Nz!<dl><dt><strong>%s</strong></dt>
z<dd><tt>%s</tt></dd>
z</dl>
r)r
rUr&rrr!)r>r(rHr<rhrGr"rrrrK�s
zHTMLDoc._docdescriptorcCs|j|||�S)z*Produce html documentation for a property.)rK)r>rr(r<rErrrr��szHTMLDoc.docpropertycGs|rd|pd}||j|�S)z-Produce HTML documentation for a data object.z<strong>%s</strong> = r)r�)r>rr(r<r=Zlhsrrrr��szHTMLDoc.docothercCs|j|||�S)z1Produce html documentation for a data descriptor.)rK)r>rr(r<rErrrr��szHTMLDoc.docdatacCs�g}|dkri}xLtj|g�D]<\}}}tdd�|D��r<q|j|d|||kf�d||<qW|j�|j||j�}|j|dd|�S)z2Generate an HTML index for a directory of modules.Ncss*|]"}dt|�kodknVqdS)i�i��N)�ord)rk�chrrr�	<genexpr>�sz HTMLDoc.index.<locals>.<genexpr>rrz#ffffffz#ee77aa)r9r:�anyr
rur
rr)r>rrrBrCr(rDr�rrr�index�sz
HTMLDoc.index)r)rrNr)r)N)NN)NNN)NN)NNN)N)r%r&r[rUr��_repr_instancer�r�r�rrrrr
rrrrrrr&r(r�r�rar�rKr�r�r�rnrrrrr��s<



+

y:


r�c@s4eZdZdZdd�Zdd�Zdd�ZeZdd	�Zd
S)�TextReprzAClass for safely making a text representation of a Python object.cCs,tj|�d|_|_d|_d|_|_dS)Nr�r�r�)rrzr�r�r�r�r�)r>rrrrzs
zTextRepr.__init__cCsTtt|�d�r@ddjt|�jj��}t||�r@t||�||�Sttt|��|j	�S)Nr%r�r_)
rcr�r!r%rr<r3r5r�r�)r>rNr�r�rrrr�s

zTextRepr.repr1cCsHt||j�}t|�}d|krDdt|dd�krDd|d||dS|S)Nr�z\\rr�r)r3r�r�r/)r>rNr�r�r�rrrr�
s
zTextRepr.repr_stringc
Cs,yttt|��|j�Sd|jjSdS)Nz
<%s instance>)r3r5r�r�r�r%)r>rNr�rrrr�szTextRepr.repr_instanceN)	r%r&r[rUrzr�r�r�r�rrrrrp�s	rpc@s�eZdZdZe�ZejZdd�Zddd�Zdd�Z	ddd�Z
dd
d�Zd dd�Zdd�Z
d!dd�Zdd�Zd"dd�Zd#dd�Zd$dd�Zd	S)%�TextDocz'Formatter class for text documentation.cCsdjdd�|D��S)z(Format a string in bold by overstriking.rcss|]}|d|VqdS)�Nr)rkrkrrrrl(szTextDoc.bold.<locals>.<genexpr>)r!)r>r.rrr�bold&szTextDoc.bold�    cs>|sdS�fdd�|jd�D�}|r4|dj�|d<dj|�S)z6Indent text by prepending a given prefix to each line.rcsg|]}�|�qSrr)rkr�)�prefixrrr�-sz"TextDoc.indent.<locals>.<listcomp>rrr�r�)rrr!)r>r.rur#r)rur�indent*szTextDoc.indentcCs$|j|�j�}|j|�d|dS)z&Format a section with a given heading.rz

)rvrrs)r>r�r�Zclean_contentsrrrr1szTextDoc.sectionNrc
s�d}x�|D]�}t|�tf�krt|\}}||t|��}|rj||fkrj�fdd�|D�}	|ddj|	�}|d}q
t|�tg�kr
||j|�||d�}q
W|S)zBRender in text a class tree as returned by inspect.getclasstree().rc3s|]}t|��VqdS)N)r))rkr,)r'rrrl@sz%TextDoc.formattree.<locals>.<genexpr>z(%s)z, rz    )r�r)r!r()
r>r)r'r*rurr+r,r-r.r)r'rr(8s

zTextDoc.formattreecCsD|j}tt|��\}}|jd||o(d|�}t|dd�}|j|�}|dk	r`||jd|d�}|rt||jd|�}g}	xNtj|tj�D]<\}
}|dk	s�tj	|�p�||kr�t
|
||�r�|	j|
|f�q�Wg}xXtj|tj�D]F\}
}|dk	�stj
|��stj	|�|kr�t
|
||�r�|j|
|f�q�Wg}
x6tj|t�D]&\}
}t
|
||��r8|
j|
|f��q8Wg}t�}t|d��r�xFtj|j�D]6\}}}|j|�|�r�|j|d	�n
|j|��q�W|j�||jd
dj|��}g}xBtj|tj�D]0\}
}|jj|d��r�|
|k�r�|j|
��q�W|�rJ|j�||jd
dj|��}|	�r�dd�|	D�}|jtj|d�|�g}x&|	D]\}
}|j|j||
|���qzW||jddj|��}|�r�g}x&|D]\}
}|j|j||
|���q�W||jddj|��}|
�rFg}x*|
D]"\}
}|j|j||
|dd���q
W||jddj|��}t|d��r�t|j�}|dd�d#k�r�|d$d�dk�r�|dd%�j�}||jd|�}t|d��r�||jdt|j ��}t|d��r�||jdt|j!��}t|d��r||jd t|j"��}ytj#|�}Wnt$k
�r.d!}YnX||jd"|�}|S)&z5Produce text documentation for a given module object.�NAMEz - r3NzMODULE REFERENCEa.

The following documentation is automatically generated from the Python
source files.  It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations.  When in doubt, consult the module reference at the
location listed above.
ZDESCRIPTIONrZz
 (package)zPACKAGE CONTENTSrrZ
SUBMODULEScSsg|]\}}|�qSrr)rkrGrHrrrr��sz%TextDoc.docmodule.<locals>.<listcomp>r�CLASSES�	FUNCTIONS�F)r2ZDATAr]r/r0z
Revision: �VERSIONrTZDATErPZAUTHORrSZCREDITSz
(built-in)ZFILEz$Revision: r�r�)%r%r$rrr<r�rr@r+r8rer
r,r8r-�setrcr9r:rZ�addrur!r*rar(r;r�r�r6r]rrTrPrSr�rt)r>rr(r<Zsynop�descrrdr�rrGrHrrArBZ
modpkgs_namesrCr'rDZ
submodulesrEr�r@r�rrrr�Hs�





$
zTextDoc.docmodulecsX�j}|p|}�j}�jfdd�}||kr:d�j|�}n�j|�d|}|rlt||�}	|ddj|	�}t��}
|
r�|
dgp�g}|j�tt	j
���}t|�dkrԈd	�x|D]}
�d
||
��q�W�d�G�fdd
�d
�}|�������fdd�}����fdd�}�����fdd�}�fdd�t��D�}x�|�r"|�rT|j
��n|dd�t|�fdd��\}}�tjk�r�|}�q>n ��k�r�d}ndt��j�}t|��|d||dd��}|d||dd��}|d||d d��}|d!||d"d��}|d#||d$d��}|}�q>Wdj|�}|�s<|dS|d�j|j�d%�dS)&z4Produce text documentation for a given class object.cSs
t||�S)N)r))r,r�rrr�makename�sz"TextDoc.docclass.<locals>.makenamezclass z	 = class z(%s)z, rrzMethod resolution order:z    rcs eZdZdd�Z�fdd�ZdS)z(TextDoc.docclass.<locals>.HorizontalRulecSs
d|_dS)Nr)rF)r>rrrrz�sz1TextDoc.docclass.<locals>.HorizontalRule.__init__cs|jr�dd�d|_dS)NrUrzr)rF)r>)rGrrrH�sz.TextDoc.docclass.<locals>.HorizontalRule.maybeN)r%r&r[rzrHr)rGrrrI�srIcs�t||�\}}|r��j��|�x^|D]V\}}}}yt�|�}Wn&tk
rh��j||���Yq(X��j||����q(W|S)N)rOrHr<rJrKr�)rLrvrKrMr(rirNrH)rOr<rrGr>rrrQ�szTextDoc.docclass.<locals>.spillcsNt||�\}}|rJ�j��|�x&|D]\}}}}��j||���q(W|S)N)rOrHrK)rLrvrKrMr(rirNrH)rOr<rGr>rrrR�sz*TextDoc.docclass.<locals>.spilldescriptorsc
s�t||�\}}|r��j��|�x~|D]v\}}}}t|�sFtj|�rPt|�}nd}yt�|�}	Wntk
r�|j|}	YnX��j	|	|�d|d�d�q(W|S)Nrz)r2r"r)
rOrHrSrrgrr<r��__dict__r�)
rLrvrKrMr(rirNrHr"r9)rOr<rrGr>rrrT�s
z#TextDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qS))r9)re)rkr(rirjrH)rrrr�s
z$TextDoc.docclass.<locals>.<listcomp>rcs|d�kS)Nrr)r1)rVrrrr	sz"TextDoc.docclass.<locals>.<lambda>zdefined herezinherited from %szMethods %s:
cSs|ddkS)NrrWr)r1rrrrrszClass methods %s:
cSs|ddkS)Nrzclass methodr)r1rrrrrszStatic methods %s:
cSs|ddkS)Nrz
static methodr)r1rrrrrszData descriptors %s:
cSs|ddkS)Nrzdata descriptorr)r1rrrrrszData and other attributes %s:
cSs|ddkS)NrrAr)r1rrrrr sz |  )r%rAr&rs�mapr!rr
rrrXr rfrYrOrZrr)rwrvr)r>rr(r<r=r[r-rr�r.r"r�r\rIrIrQrRrTrvr^r_r)rOr<rrGr>rVrr��sl

	
















zTextDoc.docclasscCsd|j|�S)z)Format an argument default value as text.r`)r�)r>rrrrra*szTextDoc.formatvaluecCsr|j}|p|}d}d}t|�rn|jj}|rB||k	rndt||�}n,|jdk	r`dt|jj|�}ndt||�}||kr�|j|�}	n,|r�tj||g�|kr�d}|j|�d|}	d}
tj|��rytj	|�}Wnt
tfk
r�d}YnX|�rt|�}
|d	k�r|j|�d
}	|
dd
�}
|
�s&d}
|	|
|}|�r@|dSt
|��pLd}
|d|
�oj|j|
�j�dSdS)z;Produce text documentation for a function or method object.rrz from Nz method of %s instancez unbound %s methodrz = z<lambda>z lambda z(...)rr�)r%r?r;r�r)rsrrbr,rcrdrtr6rrvr)r>rr(r<rEr[rerfrgr�rhrcrir"rrrr�.sH


zTextDoc.docroutinecCsTg}|j}|r$||j|��|d�t|�p.d}|rJ||j|��|d�dj|�S)Nrr)r
rsrrvr!)r>r(rHr<rhrGr"rrrrK_szTextDoc._docdescriptorcCs|j|||�S)z*Produce text documentation for a property.)rK)r>rr(r<rErrrr�lszTextDoc.docpropertycCs|j|||�S)z1Produce text documentation for a data descriptor.)rK)r>rr(r<rErrrr�pszTextDoc.docdatac
Cs�|j|�}|rF|r|dpd|}|t|�}	|	dkrF|d|	�d}|rX|j|�dpZd|}|dk	r~|d|jt|��7}|S)z-Produce text documentation for a data object.z = rrNz...r)r�r rsrvr6)
r>rr(r<r*r2r"r�r�Zchoprrrr�ts
zTextDoc.docother)rt)Nr)NN)NN)NNN)NNN)NNN)NNNNN)r%r&r[rUrpror�rsrvrr(r�r�rar�rKr�r�r�rrrrrqs


e
}
1

rqc@seZdZdZdd�ZdS)�
_PlainTextDocz2Subclass of TextDoc which overrides string stylingcCs|S)Nr)r>r.rrrrs�sz_PlainTextDoc.boldN)r%r&r[rUrsrrrrr��sr�cCst�at|�dS)zCThe first time this is called, determine what kind of pager to use.N)�getpager�pager)r.rrrr��sr�cs<ttjd�stSttjd�s tStjj�s8tjj�r<tStjjd�pRtjjd���r�tj	dkrn�fdd�Stjjd�dkr��fd
d�S�fdd�Stjjd�dkr�tStj	dkr�dd�Sttd
�r�tj
d�dkr�dd�Sddl}|j�\}}tj
|�z0ttd
��r$tj
d|�dk�r$dd�StSWdtj|�XdS)z2Decide what method to use for paging through text.�isattyZMANPAGERZPAGERZwin32cstt|���S)N)�
tempfilepager�plain)r.)�	use_pagerrrrr�szgetpager.<locals>.<lambda>ZTERM�dumb�emacscstt|���S)N)�	pipepagerr�)r.)r�rrrr�scs
t|��S)N)r�)r.)r�rrrr�scSstt|�d�S)Nzmore <)r�r�)r.rrrrr�s�systemz(less) 2>/dev/nullrcSs
t|d�S)NZless)r�)r.rrrrr�sNz	more "%s"cSs
t|d�S)NZmore)r�)r.rrrrr�s)r�r�)r�r�)rcr�stdin�
plainpager�stdoutr�r	r�ro�platformr��tempfileZmkstemp�close�ttypager�unlink)r��fdr�r)r�rr��s6


 r�cCstjdd|�S)z%Remove boldface formatting from text.z.r)rr)r.rrrr��sr�c Cs�ddl}|j|d|jd�}yDtj|jdd��*}y|j|�Wntk
rPYnXWdQRXWntk
rrYnXx(y|j	�PWqvtk
r�YqvXqvWdS)z3Page through text by feeding it to another program.rNT)�shellr��backslashreplace)�errors)
�
subprocess�Popen�PIPE�io�
TextIOWrapperr��write�KeyboardInterruptr��wait)r.�cmdr��proc�piperrrr��s r�cCs`ddl}|j�}t|ddd��}|j|�WdQRXztj|d|d�Wdtj|�XdS)z<Page through text by invoking a program on a temporary file.rN�wr�)r�z "r)r�Zmktempr�r�r	r�r�)r.r�r�r�r�rrrr��sr�cCs$ttjdd�pd}|j|d�j|�S)N�encodingzutf-8r�)r<rr��encode�decode)r.r�rrr�_escape_stdout�sr�c
Cs�tt|��jd�}y2ddl}tjj�}|j|�}|j|�dd�}Wn(t	t
tjfk
rld}dd�}YnX�z2yt
tjjdd��}Wntk
r�d}YnX|dkr�d	}|d}}tjjdj|d|��d�x�||d��r�tjjd
�tjj�|�}	|	dk�rtjjd
�Pn,|	dk�rJtjjd
||d�|d}q�|	dk�rn|||}|dk�rnd}tjjddj||||��d�||}q�WWd|�r�|j||j|�XdS)z%Page through text on a text terminal.rrNcSstjjd�S)Nr)rr�r�rrrrrr�szttypager.<locals>.<lambda>cSstjj�dd�dd�S)Nrr�)rr�r�rrrrrr�sZLINESr�z
-- more --�q�Qz
          
�
�b�B�)r�r�)r�r)r�r�r�)r�r�r�ttyrr��filenoZ	tcgetattrZ	setcbreakr�r�r��UnsupportedOperationrr	r�rordr�r�r!�flushZ	tcsetattrZ	TCSAFLUSH)
r.r#r�r��oldZgetchar�hr�Zincr,rrrr��sL








&r�cCstjjtt|���dS)z>Simply print unformatted text.  This is the ultimate fallback.N)rr�r�r�r�)r.rrrr�sr�cCs�tj|�r>|jtjkr d|jSt|d�r4d|jSd|jStj|�rRd|jStj|�rtd|jj	|jj|jfStj
|�r�d|jj	|jj|jfStj|�r�d|jStj|�r�d	|jStj
|�r�d
|jSt|�jS)z/Produce a short description of the given thing.zbuilt-in module rZzpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%szclass z	function zmethod )rr*r%rr�rcr8r��__objclass__r&r�r+r6r7r�)�thingrrr�describe
s.
















r�cCs�dd�|jd�D�}d\}}xB|t|�kr^tdj|d|d��|�}|rZ||d}}qPqW|rj|}nt}x8||d�D](}yt||�}Wq|tk
r�dSXq|W|S)z@Locate an object by name or dotted path, importing as necessary.cSsg|]}|r|�qSrr)rkr�rrrr�'szlocate.<locals>.<listcomp>rNrr)Nr)rr r�r!rZr<r�)rr�r>r��nZ
nextmodulerr�rrr�locate%s 
r�cCsVt|t�r0t||�}|dkr(td|��||fSt|dd�}|t|t�rL|ndfSdS)zDGiven an object or a path to an object, get the object and its name.Nz~No Python documentation found for %r.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.r%)r�r6r�r�r<)r�r�rr(rrr�resolve>s


r�� Python Library Documentation: %scCs�|dkrt}t||�\}}t|�}tj|�}|rTd|krT|d|d|jd��7}n|rn||k	rn|d|j7}tj|�p�tj|�p�tj	|�p�tj
|�p�tj|�p�t|t
�s�t|�}|d7}||d|j||�S)zBRender text documentation, given an object or a path to an object.Nrz in z in module z objectz

)r.r�r�rr8�rfindr%r*r+r,r�r�r�r�r�r�)r�r�r�Zrendererrr(r~r�rrr�
render_docLs$






r�cCsfy2|dkrtt|||��n|jt|||t��Wn.ttfk
r`}zt|�WYdd}~XnXdS)zCDisplay text documentation, given an object or a path to an object.N)r�r�r��	plaintextr�r��print)r�r�r��outputrHrrrr"esr"cCs�y`t||�\}}tjt|�tj||��}t|dddd��}|j|�WdQRXtd|d�Wn.tt	fk
r�}zt|�WYdd}~XnXdS)z<Write HTML documentation to a file in the current directory.z.htmlr�zutf-8)r�NZwrote)
r��htmlr�r�r�r�r�r�r�r�)r�r�rr(r�r�rHrrr�writedocpsr�rcCs6|dkri}x$tj|g|�D]\}}}t|�qWdS)zAWrite out HTML documentation for all modules in a directory tree.N)r9�
walk_packagesr�)r�pkgpath�donerCr'rDrrr�	writedocs{s
r�cJ@s�eZdZdddddd�d�d�d�d�d�d
d�ddd�dd�d�d�d�dd�d�ddd�d�d��d�d�d�dd&�!Zd'd(��dD�Z�de��d�d�d�d	�d
�ddS�ZdTdUdVdWdXdYdZd[d\d]d^d_d_d`d`da�ZxPej�D]D\ZZ	x8e	D]0Z
eje
e�Zeek�r�edbeZeee
<�q�W�q�W�d�d
�d�d�d�d�d�d�d�ddv�d�d�d�ddd�d�d�d�d�dd�dd�d��d �d!�d"�d#�d$�d%�d&�d'�d(�d)�d*d�d��d+�d,�d-�d.�d/�d0d��d1�d2�d3�d4�d5�d6�d7�d8�d9�d:�d;�d<�d=�d>�d?�d@d�dA�dBdd!dd
�dC�dD�dE�dFdʜIZ�dGd�d̈́Z
ed�dτ�Zed�dτ�Zd�d҄Ze�Zefd�dԄZd�dքZd�d؄Zd�dڄZd�d܄Z�dHd�d�Zd�d�Zd�d�Zd�d�Z�dId�d�Z�dJd�d�Zd�d�Z�dKd�d�Z d�S(L�Helperr�BOOLEAN�with�assert�break�	while for�class�CLASSES SPECIALMETHODS�continue�function�del�BASICMETHODS�if�else�try�for�break continue while�import�global�nonlocal NAMESPACES�
TRUTHVALUE�MODULES�in�SEQUENCEMETHODS�
COMPARISON�lambdary�nonlocal�global NAMESPACES�pass�raise�
EXCEPTIONS�return�while�break continue if TRUTHVALUE� CONTEXTMANAGERS EXCEPTIONS yield�yield)!�False�None�True�and�asr�r�r�r��defr��elifr��except�finallyr��fromr�r�r�r��isr�r��not�orr�r�r�r�r�r�r�cCsg|]}dD]}||�qqS)�'r)r�rr)rk�pr�rrrr��szHelper.<listcomp>r��fr��ur��'''r�"""�+rU�*�**r��//�%�<<�>>r��|�^�~r�r��<=�>=�==�!=�<>�+=�-=�*=�/=�%=�&=�|=�^=�<<=�>>=�**=�//=�j�J)�STRINGS�	OPERATORSr��UNARY�AUGMENTEDASSIGNMENT�BITWISE�COMPLEXzOPERATORS FORMATTING�POWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTS�ELLIPSISzSLICINGS DICTIONARYLITERALSz	def classr�PRIVATENAMESzPRIVATENAMES SPECIALMETHODSZ
BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)rz**�,rz...�:�@r�r_r^�`rr'�[�]r��types�RSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect�strings�4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES�string-methods�STRINGS FORMATTING�
formatstringsr�:encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPES�numbers�INTEGER FLOAT COMPLEX TYPES�integers�	int range�floating�
float math�	imaginary�
complex cmath�typesseq�$STRINGMETHODS FORMATTING range LISTS�DICTIONARIES�typesfunctions�	def TYPES�typesmethods�class def CLASSES TYPES�bltin-code-objects�compile FUNCTIONS TYPES�bltin-type-objects�types TYPES�TYPES�bltin-null-object�bltin-ellipsis-object�SLICINGS�specialattrs�!class SPECIALMETHODS PRIVATENAMES�typesmodules�operator-summary��lambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIES�EXPRESSIONS�objects�specialnames�bBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES�
customization�hash repr str SPECIALMETHODS�attribute-access�ATTRIBUTES SPECIALMETHODS�callable-types�CALLS SPECIALMETHODS�sequence-types�(SEQUENCES SEQUENCEMETHODS SPECIALMETHODS�MAPPINGS SPECIALMETHODS�
numeric-types�*NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS�	execmodel�%NAMESPACES DYNAMICFEATURES EXCEPTIONS�naming�3global nonlocal ASSIGNMENT DELETION DYNAMICFEATURES�dynamic-features�
NAMESPACESr��try except finally raise�conversions�identifiers�keywords SPECIALIDENTIFIERS�
id-classes�atom-identifiers�
atom-literals�=STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS�	SEQUENCES�	exprlists�TUPLES LITERALS�typesseq-mutable�LISTLITERALS�lists�LISTS LITERALS�typesmapping�DICTIONARYLITERALSr�DICTIONARIES LITERALS�attribute-references�(getattr hasattr setattr ATTRIBUTEMETHODS�
subscriptions�slicings�calls�power�unary�binary�shifting�bitwise�comparisons�EXPRESSIONS BASICMETHODS�booleans�EXPRESSIONS TRUTHVALUE�
assignmentr�	augassign�
NUMBERMETHODS�compound�for while break continue�truth� if while and or not BASICMETHODS�debugger�pdb�context-managers)IrFrZ
STRINGMETHODSZ
FORMATTING�UNICODEZNUMBERSZINTEGERZFLOATr!rlZMAPPINGSryZMETHODSZCODEOBJECTSZTYPEOBJECTSZFRAMEOBJECTSZ
TRACEBACKSZNONEr#ZSPECIALATTRIBUTESrxr�ZPACKAGESrOrZ
PRECEDENCEZOBJECTSZSPECIALMETHODSr�ZATTRIBUTEMETHODSZCALLABLEMETHODSr�ZMAPPINGMETHODSr�Z	EXECUTIONrcZDYNAMICFEATURESZSCOPINGZFRAMESr�ZCONVERSIONSZIDENTIFIERSZSPECIALIDENTIFIERSr$ZLITERALSZTUPLESZ
TUPLELITERALSZLISTSrpr=rtZ
ATTRIBUTESZ
SUBSCRIPTSrIZCALLSr"rZBINARYZSHIFTINGr r�r�Z	ASSERTIONZ
ASSIGNMENTrZDELETIONZ	RETURNINGZ	IMPORTINGZCONDITIONALZLOOPINGr�Z	DEBUGGINGZCONTEXTMANAGERSNcCs||_||_dS)N)�_input�_output)r>�inputr�rrrrz/szHelper.__init__cCs|jp
tjS)N)r�rr�)r>rrrrr3szHelper.<lambda>cCs|jp
tjS)N)r�rr�)r>rrrrr4scCs2tj�dddkr|�dSd|jj|jjfS)Nrr0�?rz<%s.%s instance>)r�stackr�r&r[)r>rrr�__repr__6s
zHelper.__repr__cCs6||jk	r|j|�n|j�|j�|jjd�dS)Na
You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type "help(object)".  Executing "help('string')"
has the same effect as typing a particular string at the help> prompt.
)�_GoInteractiver�intro�interactr�r�)r>�requestrrr�__call__>s
zHelper.__call__cCs�|jjd�x�y|jd�}|s PWnttfk
r<PYnX|j�}t|�dkr�|d|dkoldknr�|d|dd
�kr�|dd�}|j�dkr�P|d
kr�|j�q|j	|�qWdS)Nrzhelp> rrrr�rr��quitrr�)r�rr�r�)r�r�)
r�r��getliner��EOFErrorrr r�r�r)r>r�rrrr�Ks"
,
zHelper.interactcCs8|jtjkrt|�S|jj|�|jj�|jj�SdS)z.Read one line, using input() when appropriate.N)r�rr�r�r�r�r�)r>�promptrrrr�`s

zHelper.getlinecCs<t|�td�k�r|j�}|dkr,|j�n�|dkr>|j�n�|dkrP|j�n�|dkrb|j�n�|dd�dkr�|j|j�d�n�||jkr�|j|�nj|dkr�t	t
|�d�nR||jkr�|j|�n<||j
kr�|j|�n&|r�t	|d|jd
�nt	td|jd
�n$t|t��r|�nt	|d|jd
�|jjd�dS)Nr�keywords�symbols�topicsr��zmodules rr�r�r�zHelp on %s:)r�r)r�r�r�)r�r�listkeywords�listsymbols�
listtopics�listmodulesrr��
showsymbolr"�evalr��	showtopicr�r�r6r�r�r�r�)r>r�rrrris6






zHelper.helpcCs$|jjdjdtjdd���dS)Na�
Welcome to Python {0}'s help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/{0}/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".
z%d.%dr)r�r�r
rr�)r>rrrr�~szHelper.intror�Pc		Cs�tt|��}||}t|�|d|}x�t|�D]z}xht|�D]\}|||}|t|�kr@|jj||�||dkr@|jjdd|dt||��q@W|jjd�q2WdS)Nrr�r)r	�sortedr rr�r�)	r>�items�columnsrZcolwr�rowrrlrrrr	�s(zHelper.listcCs |jjd�|j|jj��dS)NzN
Here is a list of the Python keywords.  Enter any keyword to get more help.

)r�r�r	r�rD)r>rrrr��szHelper.listkeywordscCs |jjd�|j|jj��dS)Nzx
Here is a list of the punctuation symbols which Python assigns special meaning
to. Enter any symbol to get more help.

)r�r�r	r�rD)r>rrrr��szHelper.listsymbolscCs |jjd�|j|jj��dS)NzN
Here is a list of available topics.  Enter any topic name to get more help.

)r�r�r	r�rD)r>rrrr��szHelper.listtopicscCs,yddl}Wn tk
r,|jjd�dSX|jj||jj|��}|s`|jjdt|��dSt|�td�kr||j	||�S|\}}y|jj|}Wn(t
k
r�|jjdt|��dSX|j�d}|r�|p�dd|}|�r ddl}ddj
|j��d}	|j|	d	�}
|d
dj
|
�7}t|�dS)Nrzt
Sorry, topic and keyword documentation is not available because the
module "pydoc_data.topics" could not be found.
zno documentation found for %s
rrr�zRelated help topics: z, �Hz
%s
)�pydoc_data.topicsr�r�r�r�ror�r�r�r��KeyErrorr�textwrapr!rZwrapr�)r>�topic�
more_xrefs�
pydoc_data�target�label�xrefsr"r�r.Zwrapped_textrrrr��s6zHelper.showtopiccCs�yddl}Wntk
r dSX|jj||jj|��}|sDtd��t|t�rZ|j||�S|\}}|jj|}|r�|pxdd|}||fS)a*Return unbuffered tuple of (topic, xrefs).

        If an error occurs here, the exception is caught and displayed by
        the url handler.

        This function duplicates the showtopic method but returns its
        result directly so it can be formatted for display in an html page.
        rN�t
Sorry, topic and keyword documentation is not available because the
module "pydoc_data.topics" could not be found.
rzcould not find topicr�)r�r)	r�r�r�ror�rdr�r6�	_gettopic)r>r�r�r�r�r�r�r"rrrr��s	
zHelper._gettopiccCs*|j|}|jd�\}}}|j||�dS)Nr�)r��	partitionr�)r>�symbolr�r�r_r�rrrr��s
zHelper.showsymbolcsv|r |jjdj|��t|�nR|jjd�i}|fdd���fdd�}t�j�|d�|j|j��|jjd�dS)	Nzy
Here is a list of modules whose name or summary contains '{}'.
If there are any, enter a module name to get more help.

zI
Please wait a moment while I gather a list of all available modules...

cSs>|r$|dd�dkr$|dd�d}|jd�dkr:d||<dS)	N�	z	.__init__z
 (package)rrri����i����)�find)rr'r~r�rrr�callbacksz$Helper.listmodules.<locals>.callbackcs�d|d�dS)Nr)r')r�rr�onerrorsz#Helper.listmodules.<locals>.onerror)r�z�
Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".
)r�r�r
�apropos�
ModuleScanner�runr	rD)r>rGr�r�r)r�rr��s
zHelper.listmodules)r�r)r�r�)r�r�)r�r�)r�r)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�ry)r�r�)r�r)r�r�)r�ry)r�r�)r�r�)r�r�)r�r)r�r�r�r�)r�r�rr�)r�rUrrr�rrrrr�rrrr�r�r	r
rrr
)r�r�r	r
rrr
)rUr)rrrrrrrrrrrr)rrr�rrr)rr)r+r,)r-r.)r/r0)r1r)r-r2)r3r4)r5r6)r7r8)r9r:)r;r<)r>r?)r@rA)rBrC)rDrE)rGr)rHrI)rJr)r+rK)rLr�)rMrN)rPrF)rQrR)rSrT)rUrV)rWrX)rYrZ)rYr[)r\r])r^r_)r`ra)rbr)r�rd)rer)rfrg)rhr)rir)rjrk)rmrn)rorp)rqrr)rsrt)rru)rvrw)rxr�)ryr�)rzrO)r{rO)r|rO)r}rO)r~rO)rrO)r�r�)r�r�)r�r)r�r�)r�r�)r�r�)r�r�)r�r�)NN)rr�)r)r)r)!r%r&r[r�Z_strprefixesZ_symbols_inverser�r�r�Zsymbols_r�ror�rzr�r�r�r�rr�r�r�r�rr�r	r�r�r�r�r�r�r�rrrrr��s6





	
 r�c@seZdZdZddd�ZdS)r�z7An interruptible scanner that searches module synopses.NcCs
|r|j�}d|_i}xztjD]p}|dkrd||<|dkrH|d|d�qt|�jpTd}|jd�d}|d|}|j�j|�dkr|d||�qW�xdtj	|d�D�]R\}	}}
|jr�P|dkr�|d|d�q�ytj
|	|�}Wntk
r�w�YnX|j}t
|d	��rny|j|�}
Wn&tk
�r:|�r4||�w�YnXttj|
���pNd}t
|d
��rh|j|�}nd}n^ytjj|�}Wn&tk
�r�|�r�||�w�YnX|j�r�|jj�dnd}t|dd�}|d|}|j�j|�dkr�||||�q�W|�r|�dS)NF�__main__rrrrz - )r��
get_source�get_filenamerV)r�r�rr�r�rUrr�r9r��	_get_specr�r�rcr�rJr�r��StringIOr�r�r�r�r�r�r<)r>r�rGZ	completerr��seenr'r(r~rCrDr�r��sourcerr�rrrr�s`zModuleScanner.run)NNN)r%r&r[rUr�rrrrr�sr�cCsDdd�}dd�}tj��"tjd�t�j|||d�WdQRXdS)zAPrint all the one-line module summaries that contain a substring.cSs6|dd�dkr |dd�d}t||o.d|�dS)Nr�z	.__init__z
 (package)z- i����i����)r�)rr'r~rrrr�Oszapropos.<locals>.callbackcSsdS)Nr)r'rrrr�Sszapropos.<locals>.onerror�ignore)r�N)�warnings�catch_warnings�filterwarningsr�r�)rGr�r�rrrr�Ms


r�cs�ddl�ddl�ddl�ddl�Gdd�d�jj��G�fdd�d�jj��G�����fdd�d�j�}|||�}|j�x|j	r�|j
r�tjd	�q~W|S)
a7Start an HTTP server thread on a specific port.

    Start an HTML/text server thread, so HTML or text documents can be
    browsed dynamically and interactively with a Web browser.  Example use:

        >>> import time
        >>> import pydoc

        Define a URL handler.  To determine what the client is asking
        for, check the URL and content_type.

        Then get or generate some text or HTML code and return it.

        >>> def my_url_handler(url, content_type):
        ...     text = 'the URL sent was: (%s, %s)' % (url, content_type)
        ...     return text

        Start server thread on port 0.
        If you use port 0, the server will pick a random port number.
        You can then use serverthread.port to get the port number.

        >>> port = 0
        >>> serverthread = pydoc._start_server(my_url_handler, port)

        Check that the server is really started.  If it is, open browser
        and get first page.  Use serverthread.url as the starting page.

        >>> if serverthread.serving:
        ...    import webbrowser

        The next two lines are commented out so a browser doesn't open if
        doctest is run on this module.

        #...    webbrowser.open(serverthread.url)
        #True

        Let the server do its thing. We just need to monitor its status.
        Use time.sleep so the loop doesn't hog the CPU.

        >>> starttime = time.time()
        >>> timeout = 1                    #seconds

        This is a short timeout for testing purposes.

        >>> while serverthread.serving:
        ...     time.sleep(.01)
        ...     if serverthread.serving and time.time() - starttime > timeout:
        ...          serverthread.stop()
        ...          break

        Print any errors that may have occurred.

        >>> print(serverthread.error)
        None
   rNc@seZdZdd�Zdd�ZdS)z!_start_server.<locals>.DocHandlercSsX|jjd�rd}nd}|jd�|jdd|�|j�|jj|j|j|�jd��dS)	z�Process a request from an HTML browser.

            The URL received is in self.path.
            Get an HTML page from self.urlhandler and send it.
            z.cssztext/cssz	text/html��zContent-Typez%s; charset=UTF-8zutf-8N)	rrbZ
send_responseZsend_headerZend_headersZwfiler��
urlhandlerr�)r>�content_typerrr�do_GET�s

z(_start_server.<locals>.DocHandler.do_GETcWsdS)Nr)r>r�rrr�log_message�sz-_start_server.<locals>.DocHandler.log_messageN)r%r&r[r�r�rrrr�
DocHandler�sr�cs(eZdZdd�Z�fdd�Zdd�ZdS)z _start_server.<locals>.DocServercSs6d|_|j|f|_||_|jj||j|j�d|_dS)NZ	localhostF)�hostZaddressr�rIrz�handlerr�)r>�portr�rrrrz�s
z)_start_server.<locals>.DocServer.__init__csBx4|js4�j|jj�gggd�\}}}|r|j�qW|j�dS)Nr)r��selectZsocketr�Zhandle_requestZserver_close)r>Zrd�wrZex)r�rr�serve_until_quit�s
z1_start_server.<locals>.DocServer.serve_until_quitcSs |jj|�|jr|j|�dS)N)rI�server_activater�)r>rrrr��sz0_start_server.<locals>.DocServer.server_activateN)r%r&r[rzr�r�r)r�rr�	DocServer�sr�cs:eZdZ�fdd�Z����fdd�Zdd�Zdd�Zd	S)
z#_start_server.<locals>.ServerThreadcs,||_t|�|_�jj|�d|_d|_dS)NF)r�rr��Threadrz�serving�error)r>r�r�)�	threadingrrrz�s

z,_start_server.<locals>.ServerThread.__init__cstyF�jj�_��_�jj�_t|j��_�|j	|j
�}||_|j�Wn(t
k
rn}z||_WYdd}~XnXdS)zStart the server.N)�server�
HTTPServerrIr�r�ZMessageZMessageClass�staticmethodr�r��ready�	docserverr�rJr�)r>Zdocsvr�e)r�r��email�httprrr��s

z'_start_server.<locals>.ServerThread.runcSs,d|_|j|_|j|_d|j|jf|_dS)NTz
http://%s:%d/)r�r�Zserver_portr�r)r>r�rrrr��sz)_start_server.<locals>.ServerThread.readycSs&d|j_|j�d|_d|_d|_dS)z&Stop the server and this thread nicelyTNF)r�r�r!r�r)r>rrr�stop�s
z(_start_server.<locals>.ServerThread.stopN)r%r&r[rzr�r�r�r)r�r�r�r�r�rr�ServerThread�s
r�g{�G�z�?)
Zhttp.serverZ
email.messager�r�r�ZBaseHTTPRequestHandlerr�r�r#r�r��timeZsleep)r�r�r�Zthreadr)r�r�r�r�r�r�r�
_start_server[s8&
r��	text/htmlcsG�fdd�dt�}|���fdd���fdd���fdd���fd	d
���fdd���fd
d���fdd���fdd����������fdd�}|jd�r�|dd�}|dkr�tjjtjjt��}tjj||�}t|��}dj|j	��SQRXn|dk�r||�St
d||f��dS)aThe pydoc url handler for use with the pydoc server.

    If the content_type is 'text/css', the _pydoc.css style
    sheet is read and returned if it exits.

    If the content_type is 'text/html', then the result of
    get_html_page(url) is returned.
    cseZdZ�fdd�ZdS)z_url_handler.<locals>._HTMLDoccsd}d|}d||��|fS)zFormat an HTML page.zpydoc_data/_pydoc.cssz1<link rel="stylesheet" type="text/css" href="%s">a<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Pydoc: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
%s</head><body bgcolor="#f0f0f8">%s<div style="clear:both;padding-top:.5em;">%s</div>
</body></html>r)r>r�r��css_pathZcss_link)�html_navbarrrr��sz#_url_handler.<locals>._HTMLDoc.pageN)r%r&r[r�r)r�rr�_HTMLDoc�sr�cs>�jdtj�tj�dtj�f�}d|�jtjdd��fS)Nz%s [%s, %s]raZ
            <div style='float:left'>
                Python %s<br>%s
            </div>
            <div style='float:right'>
                <div style='text-align:center'>
                  <a href="index.html">Module Index</a>
                  : <a href="topics.html">Topics</a>
                  : <a href="keywords.html">Keywords</a>
                </div>
                <div>
                    <form action="get" style='display:inline;'>
                      <input type=text name=key size=15>
                      <input type=submit value="Get">
                    </form>&nbsp;
                    <form action="search" style='display:inline;'>
                      <input type=text name=key size=15>
                      <input type=submit value="Search">
                    </form>
                </div>
            </div>
            T)Zterse)r�r�Zpython_versionZpython_buildZpython_compiler)r@)r�rrr�
	s
z!_url_handler.<locals>.html_navbarcs�dd�}�jddd�}dd�tjD�}�j||�}|d�jd	dd
|�g}i}x tjD]}|j�j||��qVW|jd�dd
j|�fS)zModule Index page.cSsd||fS)Nz<a href="%s.html">%s</a>r)r(rrr�	bltinlink+	sz3_url_handler.<locals>.html_index.<locals>.bltinlinkz7<big><big><strong>Index of Modules</strong></big></big>z#ffffffz#7799eecSsg|]}|dkr|�qS)r�r)rkr(rrrr�1	sz4_url_handler.<locals>.html_index.<locals>.<listcomp>z<p>zBuilt-in Modulesz#ee77aaz|<p align=right><font color="#909090" face="helvetica,arial"><strong>pydoc</strong> by Ka-Ping Yee&lt;ping@lfw.org&gt;</font>zIndex of Modulesr)	rrr�r
rrr
rnr!)r�r�namesr�r�r)r�rr�
html_index(	sz _url_handler.<locals>.html_indexc	s�g��fdd�}tj��*tjd�dd�}t�j|||d�WdQRXdd	�}g}�jd
dd�}x"�D]\}}|j||�|�qhW|�jd
|dddj|��}d|fS)zSearch results page.cs:|dd�dkr |dd�d}�j||o0d|f�dS)Nr�z	.__init__z
 (package)z- i����i����)r
)rr'r~)�
search_resultrrr�F	sz3_url_handler.<locals>.html_search.<locals>.callbackr�cSsdS)Nr)r'rrrr�M	sz2_url_handler.<locals>.html_search.<locals>.onerror)r�NcSsd||fS)Nz<a href="%s.html">%s</a>r)r(rrrr�R	sz4_url_handler.<locals>.html_search.<locals>.bltinlinkz5<big><big><strong>Search Results</strong></big></big>z#ffffffz#7799eezkey = %sz#ee77aaz<br>zSearch Results)	r�r�r�r�r�rr
rr!)	rGr�r�r�rhrr(r~r�)r�)r�r�html_searchA	s 

z!_url_handler.<locals>.html_searchcsLdd�}�jddd�}ttjj��}�j||�}|�jddd|�}d|fS)zIndex of topic texts available.cSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrr�b	sz4_url_handler.<locals>.html_topics.<locals>.bltinlinkz,<big><big><strong>INDEX</strong></big></big>z#ffffffz#7799eeZTopicsz#ee77aa)rr�r�r�rDr
r)r�rr�r�)r�rr�html_topics_	sz!_url_handler.<locals>.html_topicscsL�jddd�}ttjj��}dd�}�j||�}|�jddd|�}d|fS)zIndex of keywords.z,<big><big><strong>INDEX</strong></big></big>z#ffffffz#7799eecSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrr�v	sz6_url_handler.<locals>.html_keywords.<locals>.bltinlinkZKeywordsz#ee77aa)rr�r�r�rDr
r)rr�r�r�)r�rr�
html_keywordso	sz#_url_handler.<locals>.html_keywordscs�tj�}t||�}|j|�\}}||jkr0d}nd}�jd|dd�}d�j|�}�j|dd|�}|r�t|j	��}dd	�}�j
||�}�jd
dd|�}d||fdj|||f�fS)
zTopic or keyword help page.ZKEYWORDZTOPICz)<big><big><strong>%s</strong></big></big>z#ffffffz#7799eez
<pre>%s</pre>z#ee77aacSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrr��	sz7_url_handler.<locals>.html_topicpage.<locals>.bltinlinkzRelated help topics: z%s %sr)
r�r�r�r�r�rr&rr�rr
rr!)r�ZbufZhtmlhelpr�r�r�rr�)r�rr�html_topicpage~	s&



z$_url_handler.<locals>.html_topicpagecs@t|dd�}|dkr$|dkr$td��t|�}�j||�}||fS)Nr)r�r�zcould not find object)r�rdr�r�)rr9r��content)r�rr�html_getobj�	sz!_url_handler.<locals>.html_getobjcsP�jddd�}dj�fdd�tt|�|�D��}|�j|dd|�}d||fS)	Nz,<big><big><strong>Error</strong></big></big>z#ffffffz#7799eez<br>c3s|]}�j|�VqdS)N)r�)rkr�)r�rrrl�	sz3_url_handler.<locals>.html_error.<locals>.<genexpr>z#bb0000z
Error - %s)rr!rr�r)rr�rr�)r�rr�
html_error�	sz _url_handler.<locals>.html_errorcst|}|jd�r|dd
�}�y|dkr4��\}}�n�|dkrH��\}}n�|dkr\��\}}n�d|k�r&|jd�\}}}|d	kr��|�\}}n�|d
kr�y�|�\}}Wn tk
r��|�\}}YnXn\|dk�r|dkr��\}}n4y�|�\}}Wn"tk
�r�|�\}}YnXntd��n�|�\}}Wn2tk
�rf}z�||�\}}WYdd}~XnX�j||�S)zGenerate an HTML page for url.z.htmlN�rrnr�r�r`z
search?keyz	topic?keyzget?keyz
bad pydoc url���)rrn)rrn)rbr�rdrJr�)rZcomplete_urlr�r��opr_r�)r�r�r�r�r�r�r�r�rr�
get_html_page�	s>



 z#_url_handler.<locals>.get_html_pager�rNztext/cssrz	text/htmlz"unknown content type %r for url %s)r�rar	r�dirname�realpathrVr!r��	readlinesrt)rr�r�r�Z	path_herer��fpr)	r�r�r�r�r�r�r�r�r�r�_url_handler�s*	
(


rT)�open_browsercCs�ddl}tt|�}|jr&t|j�dS|jr�d}|r@|j|j�z�y^td|j�t|�xD|jr�td�}|j	�}|dkr|PqZ|dkr�|j|j�qZt|�qZWWnt
tfk
r�t�YnXWd|jr�|j�td�XdS)	z�Start the enhanced pydoc Web server and open a Web browser.

    Use port '0' to start the server on an arbitrary port.
    Set open_browser to False to suppress opening a browser.
    rNz"Server commands: [b]rowser, [q]uitzServer ready atzserver> r�r�zServer stopped)
�
webbrowserr�rr�r�r�r�rr�r�r�r�r�)r�rrZserverthreadZserver_help_msgr�rrr�browse�	s2

rcCst|t�o|jtj�dkS)Nr)r�r6r�r	�sep)rNrrr�ispath
srcCsddl}Gdd�dt�}dtjkrXtjjtjd�}|tjkrJtjj|�tjjdd��yp|jtjdd�d�\}}d	}d	}d	}d}xP|D]H\}	}
|	d
kr�d}d}|	dkr�t	|
�dS|	d
kr�d}|
}|	dkr�d}q�W|r�|dkr�d}t
||d�dS|�s|�x�|D]�}t|��r4tjj|��r4t
d|�Py`t|��rVtjj|��rVt|�}|�r�t|��r~tjj|��r~t|�nt|�n
tj|�Wn,tk
�r�}zt
|�WYdd}~XnX�qWWnN|j|fk
�rtjjtjjtjd��d}
t
dj|
tjd��YnXdS)z@Command-line interface (looks at sys.argv to decide what to do).rNc@seZdZdS)zcli.<locals>.BadUsageN)r%r&r[rrrr�BadUsage

sr	rrrzbk:p:wFz-bTz-kz-pz-w)rzfile %r does not exista�pydoc - the Python documentation tool

{cmd} <name> ...
    Show text documentation on something.  <name> may be the name of a
    Python keyword, topic, function, module, or package, or a dotted
    reference to a class or function within a module or module in a
    package.  If <name> contains a '{sep}', it is used as the path to a
    Python source file to document. If name is 'keywords', 'topics',
    or 'modules', a listing of these things is displayed.

{cmd} -k <keyword>
    Search for a keyword in the synopsis lines of all available modules.

{cmd} -p <port>
    Start an HTTP server on the given port on the local machine.  Port
    number 0 can be used to get an arbitrary unused port.

{cmd} -b
    Start an HTTP server on an arbitrary unused port and open a Web browser
    to interactively browse documentation.  The -p option can be used with
    the -b option to explicitly specify the server port.

{cmd} -w <name> ...
    Write out the HTML documentation for a module to a file in the current
    directory.  If <name> contains a '{sep}', it is treated as a filename; if
    it names a directory, documentation is written for all the contents.
)r�r)�getoptrJrrr	r��argv�remove�insertr�rr�existsr�r{r�rr�r�rr�r�r�r�r
r)r
r	Z	scriptdirZoptsr�ZwritingZstart_serverrr��opt�val�argrHr�rrr�cli
sd




$rr�)NN)r)r)r�rN)r�rN)r)rN)r�)r)XrUr3rPrTrSrZZimportlib._bootstrapr�Zimportlib._bootstrap_external�importlib.machinery�importlib.utilrr�r	r9r�rrr�r�Zurllib.parser4r��collectionsr�reprlibr�	tracebackrrrr$r)r-r/r3r�
IGNORECASEr4r5r:r?rCrOrerfrwr}r�r�rJr�r�r�r�r�r�rprqr�r�r�r�r�r�r�r�r�r�r�r.r�r�r�r�r"r�r�r�rr�r�r�rrrrr%rrrr�<module>#s�		


	'
0>*- d",






=
n%V
fractions.cpython-36.pyc000064400000043774150335715140011205 0ustar003


 \W\�@s�dZddlmZddlZddlZddlZddlZddlZddgZdd�Z	dd�Z
ejjZ
ejjZejd	ejejB�ZGd
d�dej�ZdS)z+Fraction, infinite-precision, real numbers.�)�DecimalN�Fraction�gcdcCsfddl}|jdtd�t|�tko0t|�knr\|p<|dkrPtj||�Stj||�St||�S)z�Calculate the Greatest Common Divisor of a and b.

    Unless b==0, the result will have the same sign as b (so that when
    b is divided by it, the result comes out positive).
    rNz6fractions.gcd() is deprecated. Use math.gcd() instead.�)�warnings�warn�DeprecationWarning�type�int�mathr�_gcd)�a�br�r�!/usr/lib64/python3.6/fractions.pyrs cCsx|r|||}}qW|S)Nr)r
rrrrr sraC
    \A\s*                      # optional whitespace at the start, then
    (?P<sign>[-+]?)            # an optional sign, then
    (?=\d|\.\d)                # lookahead for digit or .digit
    (?P<num>\d*)               # numerator (possibly empty)
    (?:                        # followed by
       (?:/(?P<denom>\d+))?    # an optional denominator
    |                          # or
       (?:\.(?P<decimal>\d*))? # an optional fractional part
       (?:E(?P<exp>[-+]?\d+))? # and optional exponent
    )
    \s*\Z                      # and optional whitespace to finish
cs�eZdZdZdSZdTdd��fdd	�Zed
d��Zedd
��ZdUdd�Z	e
dd��Ze
dd��Zdd�Z
dd�Zdd�Zdd�Zeeej�\ZZdd�Zeeej�\ZZdd �Zeeej�\ZZd!d"�Zeeej�\ZZ d#d$�Z!d%d&�Z"d'd(�Z#d)d*�Z$d+d,�Z%d-d.�Z&d/d0�Z'd1d2�Z(d3d4�Z)d5d6�Z*d7d8�Z+d9d:�Z,dVd;d<�Z-d=d>�Z.d?d@�Z/dAdB�Z0dCdD�Z1dEdF�Z2dGdH�Z3dIdJ�Z4dKdL�Z5dMdN�Z6dOdP�Z7dQdR�Z8�Z9S)Wra]This class implements rational numbers.

    In the two-argument form of the constructor, Fraction(8, 6) will
    produce a rational number equivalent to 4/3. Both arguments must
    be Rational. The numerator defaults to 0 and the denominator
    defaults to 1 so that Fraction(3) == 3 and Fraction() == 0.

    Fractions can also be constructed from:

      - numeric strings similar to those accepted by the
        float constructor (for example, '-2.3' or '1e10')

      - strings of the form '123/456'

      - float and Decimal instances

      - other Rational instances (including integers)

    �
_numerator�_denominatorrNT)�
_normalizecsRtt|�j|�}|dk�rdt|�tkr6||_d|_|St|tj	�rV|j
|_|j|_|St|tt
f�rx|j�\|_|_|St|t��rZtj|�}|dkr�td|��t|jd�p�d�}|jd�}|r�t|�}nvd}|jd�}|�rdt|�}||t|�}||9}|jd	�}	|	�rBt|	�}	|	d
k�r4|d|	9}n|d|	9}|jd�dk�rb|}ntd
��nft|�tk�o�t|�kn�r�n@t|tj	��r�t|tj	��r�|j
|j|j
|j}}ntd��|d
k�r�td|��|�rBt|�tk�ot|�kn�r(tj||�}
|d
k�r2|
}
n
t||�}
||
}||
}||_||_|S)a�Constructs a Rational.

        Takes a string like '3/2' or '1.5', another Rational instance, a
        numerator/denominator pair, or a float.

        Examples
        --------

        >>> Fraction(10, -8)
        Fraction(-5, 4)
        >>> Fraction(Fraction(1, 7), 5)
        Fraction(1, 35)
        >>> Fraction(Fraction(1, 7), Fraction(2, 3))
        Fraction(3, 14)
        >>> Fraction('314')
        Fraction(314, 1)
        >>> Fraction('-35/4')
        Fraction(-35, 4)
        >>> Fraction('3.1415') # conversion from numeric string
        Fraction(6283, 2000)
        >>> Fraction('-47e-2') # string may include a decimal exponent
        Fraction(-47, 100)
        >>> Fraction(1.47)  # direct construction from float (exact conversion)
        Fraction(6620291452234629, 4503599627370496)
        >>> Fraction(2.25)
        Fraction(9, 4)
        >>> Fraction(Decimal('1.47'))
        Fraction(147, 100)

        N�z Invalid literal for Fraction: %rZnum�0�denom�decimal�
�exprZsign�-z2argument should be a string or a Rational instancez+both arguments should be Rational instanceszFraction(%s, 0))�superr�__new__r	r
rr�
isinstance�numbers�Rational�	numerator�denominator�floatr�as_integer_ratio�str�_RATIONAL_FORMAT�match�
ValueError�group�len�	TypeError�ZeroDivisionErrorrrr)�clsr r!r�self�mrrZscaler�g)�	__class__rrrTsr







$

$

zFraction.__new__cCsDt|tj�r||�St|t�s8td|j|t|�jf��||j��S)z�Converts a finite float to a rational number, exactly.

        Beware that Fraction.from_float(0.3) != Fraction(3, 10).

        z.%s.from_float() only takes floats, not %r (%s))rr�Integralr"r*�__name__r	r#)r,�frrr�
from_float�s
zFraction.from_floatcCsVddlm}t|tj�r&|t|��}n$t||�sJtd|j|t|�jf��||j	��S)zAConverts a finite Decimal instance to a rational number, exactly.r)rz2%s.from_decimal() only takes Decimals, not %r (%s))
rrrrr1r
r*r2r	r#)r,Zdecrrrr�from_decimal�s
zFraction.from_decimal�@Bc
Cs�|dkrtd��|j|kr"t|�Sd\}}}}|j|j}}xP||}|||}	|	|kr\P||||||	f\}}}}||||}}q>W|||}
t||
|||
|�}t||�}t||�t||�kr�|S|SdS)aWClosest Fraction to self with denominator at most max_denominator.

        >>> Fraction('3.141592653589793').limit_denominator(10)
        Fraction(22, 7)
        >>> Fraction('3.141592653589793').limit_denominator(100)
        Fraction(311, 99)
        >>> Fraction(4321, 8765).limit_denominator(10000)
        Fraction(4321, 8765)

        rz$max_denominator should be at least 1rN)rrrr)r'rrr�abs)
r-Zmax_denominatorZp0Zq0Zp1Zq1�n�dr
Zq2�kZbound1Zbound2rrr�limit_denominator�s& 

zFraction.limit_denominatorcCs|jS)N)r)r
rrrr szFraction.numeratorcCs|jS)N)r)r
rrrr!szFraction.denominatorcCsd|jj|j|jfS)z
repr(self)z
%s(%s, %s))r0r2rr)r-rrr�__repr__szFraction.__repr__cCs(|jdkrt|j�Sd|j|jfSdS)z	str(self)rz%s/%sN)rr$r)r-rrr�__str__s

zFraction.__str__csT��fdd�}d�jd|_�j|_��fdd�}d�jd|_�j|_||fS)a�Generates forward and reverse operators given a purely-rational
        operator and a function from the operator module.

        Use this like:
        __op__, __rop__ = _operator_fallbacks(just_rational_op, operator.op)

        In general, we want to implement the arithmetic operations so
        that mixed-mode operations either call an implementation whose
        author knew about the types of both arguments, or convert both
        to the nearest built in type and do the operation there. In
        Fraction, that means that we define __add__ and __radd__ as:

            def __add__(self, other):
                # Both types have numerators/denominator attributes,
                # so do the operation directly
                if isinstance(other, (int, Fraction)):
                    return Fraction(self.numerator * other.denominator +
                                    other.numerator * self.denominator,
                                    self.denominator * other.denominator)
                # float and complex don't have those operations, but we
                # know about those types, so special case them.
                elif isinstance(other, float):
                    return float(self) + other
                elif isinstance(other, complex):
                    return complex(self) + other
                # Let the other type take over.
                return NotImplemented

            def __radd__(self, other):
                # radd handles more types than add because there's
                # nothing left to fall back to.
                if isinstance(other, numbers.Rational):
                    return Fraction(self.numerator * other.denominator +
                                    other.numerator * self.denominator,
                                    self.denominator * other.denominator)
                elif isinstance(other, Real):
                    return float(other) + float(self)
                elif isinstance(other, Complex):
                    return complex(other) + complex(self)
                return NotImplemented


        There are 5 different cases for a mixed-type addition on
        Fraction. I'll refer to all of the above code that doesn't
        refer to Fraction, float, or complex as "boilerplate". 'r'
        will be an instance of Fraction, which is a subtype of
        Rational (r : Fraction <: Rational), and b : B <:
        Complex. The first three involve 'r + b':

            1. If B <: Fraction, int, float, or complex, we handle
               that specially, and all is well.
            2. If Fraction falls back to the boilerplate code, and it
               were to return a value from __add__, we'd miss the
               possibility that B defines a more intelligent __radd__,
               so the boilerplate should return NotImplemented from
               __add__. In particular, we don't handle Rational
               here, even though we could get an exact answer, in case
               the other type wants to do something special.
            3. If B <: Fraction, Python tries B.__radd__ before
               Fraction.__add__. This is ok, because it was
               implemented with knowledge of Fraction, so it can
               handle those instances before delegating to Real or
               Complex.

        The next two situations describe 'b + r'. We assume that b
        didn't know about Fraction in its implementation, and that it
        uses similar boilerplate code:

            4. If B <: Rational, then __radd_ converts both to the
               builtin rational type (hey look, that's us) and
               proceeds.
            5. Otherwise, __radd__ tries to find the nearest common
               base ABC, and fall back to its builtin type. Since this
               class doesn't subclass a concrete type, there's no
               implementation to fall back to, so we need to try as
               hard as possible to return an actual value, or the user
               will get a TypeError.

        csPt|ttf�r�||�St|t�r0�t|�|�St|t�rH�t|�|�StSdS)N)rr
rr"�complex�NotImplemented)r
r)�fallback_operator�monomorphic_operatorrr�forwardvs


z-Fraction._operator_fallbacks.<locals>.forward�__csZt|tj�r�||�St|tj�r4�t|�t|��St|tj�rR�t|�t|��StSdS)N)rrrZRealr"�Complexr>r?)rr
)r@rArr�reverse�s
z-Fraction._operator_fallbacks.<locals>.reverseZ__r)r2�__doc__)rAr@rBrEr)r@rAr�_operator_fallbacks&sP	
zFraction._operator_fallbackscCs,|j|j}}t|j||j|||�S)za + b)r!rr )r
r�da�dbrrr�_add�sz
Fraction._addcCs,|j|j}}t|j||j|||�S)za - b)r!rr )r
rrHrIrrr�_sub�sz
Fraction._subcCst|j|j|j|j�S)za * b)rr r!)r
rrrr�_mul�sz
Fraction._mulcCst|j|j|j|j�S)za / b)rr r!)r
rrrr�_div�sz
Fraction._divcCstj||�S)za // b)r�floor)r
rrrr�__floordiv__�szFraction.__floordiv__cCstj||�S)za // b)rrN)rr
rrr�
__rfloordiv__�szFraction.__rfloordiv__cCs||}|||S)za % br)r
r�divrrr�__mod__�szFraction.__mod__cCs||}|||S)za % br)rr
rQrrr�__rmod__�szFraction.__rmod__cCs�t|tj�r�|jdkr�|j}|dkr>t|j||j|dd�S|jdkrft|j||j|dd�St|j||j|dd�Sq�t|�t|�Snt|�|SdS)z�a ** b

        If b is not an integer, the result will be a float or complex
        since roots are generally irrational. If b is an integer, the
        result will be rational.

        rrF)rN)	rrrr!r rrrr")r
rZpowerrrr�__pow__�s 




zFraction.__pow__cCs\|jdkr|jdkr||jSt|tj�r<t|j|j�|S|jdkrP||jS|t|�S)za ** brr)	rrrrrrr r!r")rr
rrr�__rpow__�s


zFraction.__rpow__cCst|j|jdd�S)z++a: Coerces a subclass instance to FractionF)r)rrr)r
rrr�__pos__�szFraction.__pos__cCst|j|jdd�S)z-aF)r)rrr)r
rrr�__neg__�szFraction.__neg__cCstt|j�|jdd�S)zabs(a)F)r)rr7rr)r
rrr�__abs__�szFraction.__abs__cCs*|jdkr|j|jS|j|jSdS)ztrunc(a)rN)rr)r
rrr�	__trunc__�s
zFraction.__trunc__cCs|j|jS)zWill be math.floor(a) in 3.0.)r r!)r
rrr�	__floor__�szFraction.__floor__cCs|j|jS)zWill be math.ceil(a) in 3.0.)r r!)r
rrr�__ceil__szFraction.__ceil__cCs�|dkrZt|j|j�\}}|d|jkr,|S|d|jkrB|dS|ddkrR|S|dSdt|�}|dkr�tt||�|�Stt||�|�SdS)zOWill be round(self, ndigits) in 3.0.

        Rounds half toward even.
        Nrrrr)�divmodr r!r7r�round)r-ZndigitsrNZ	remainderZshiftrrr�	__round__szFraction.__round__cCsPt|jtdt�}|st}nt|j�|t}|dkr:|n|}|dkrLdS|S)z
hash(self)rrr������)�powr�_PyHASH_MODULUS�_PyHASH_INFr7r)r-ZdinvZhash_�resultrrr�__hash__!szFraction.__hash__cCs�t|�tkr |j|ko|jdkSt|tj�rD|j|jkoB|j|jkSt|tj	�r`|j
dkr`|j}t|t�r�t
j|�s~t
j|�r�d|kS||j|�kSntSdS)za == brrgN)r	r
rrrrrr r!rD�imag�realr"r�isnan�isinfr4r?)r
rrrr�__eq__7s
zFraction.__eq__cCsht|tj�r&||j|j|j|j�St|t�r`tj	|�sDtj
|�rN|d|�S|||j|��SntSdS)acHelper for comparison operators, for internal use only.

        Implement comparison between a Rational instance `self`, and
        either another Rational instance or a float `other`.  If
        `other` is not a Rational instance or a float, return
        NotImplemented. `op` should be one of the six standard
        comparison operators.

        gN)
rrrrr!rr r"rrhrir4r?)r-�other�oprrr�_richcmpLs

zFraction._richcmpcCs|j|tj�S)za < b)rm�operator�lt)r
rrrr�__lt__bszFraction.__lt__cCs|j|tj�S)za > b)rmrn�gt)r
rrrr�__gt__fszFraction.__gt__cCs|j|tj�S)za <= b)rmrn�le)r
rrrr�__le__jszFraction.__le__cCs|j|tj�S)za >= b)rmrn�ge)r
rrrr�__ge__nszFraction.__ge__cCs
|jdkS)za != 0r)r)r
rrr�__bool__rszFraction.__bool__cCs|jt|�ffS)N)r0r$)r-rrr�
__reduce__xszFraction.__reduce__cCs t|�tkr|S|j|j|j�S)N)r	rr0rr)r-rrr�__copy__{szFraction.__copy__cCs t|�tkr|S|j|j|j�S)N)r	rr0rr)r-�memorrr�__deepcopy__�szFraction.__deepcopy__)rr)rN)r6)N):r2�
__module__�__qualname__rF�	__slots__r�classmethodr4r5r;�propertyr r!r<r=rGrJrn�add�__add__�__radd__rK�sub�__sub__�__rsub__rL�mul�__mul__�__rmul__rM�truediv�__truediv__�__rtruediv__rOrPrRrSrTrUrVrWrXrYrZr[r^rerjrmrprrrtrvrwrxryr{�
__classcell__rr)r0rr<sVm
7k
)rFrrrrrn�re�sys�__all__rr�	hash_info�modulusrb�infrc�compile�VERBOSE�
IGNORECASEr%rrrrrr�<module>swarnings.cpython-36.pyc000064400000031714150335715140011034 0ustar003


 \8H�
@sdZddlZddddddd	d
gZd;dd�Zd<dd�Zd
d�Zdd�ZeZdd�ZeZ	dd�Z
dedddfdd�Zeddfdd�Z
dd�Zdd	�ZGdd�de�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd=d+d�Zd>d,d�ZGd-d.�d.e�ZGd/d
�d
e�ZdZy0dd0lmZm Z m!Z!mZmZm"Z"e Z#e!Z$d1ZWn.e%k
�rfgZd2Z#iZ$d*a&d3d4�Z"YnXeej'�e�se(e)gZ*e*j+e,�xe*D]Z-e
d5e-d6��q�Wej.j/Z/e/d*k�r�d7Z0ne/�r�d2Z0nd5Z0e
e0e1d*d8�e2ed9��r�d:Z3nd5Z3e
e3e4d*d8�[dS)?z&Python part of the warnings subsystem.�N�warn�
warn_explicit�showwarning�
formatwarning�filterwarnings�simplefilter�
resetwarnings�catch_warningscCst||||||�}t|�dS)z7Hook to write a warning to a file; replace if you like.N)�WarningMessage�_showwarnmsg_impl)�message�category�filename�lineno�file�line�msg�r� /usr/lib64/python3.6/warnings.pyr
scCst||||d|�}t|�S)z.Function to format a warning the standard way.N)r
�_formatwarnmsg_impl)rr
rrrrrrrrscCsP|j}|dkr tj}|dkr dSt|�}y|j|�Wntk
rJYnXdS)N)r�sys�stderr�_formatwarnmsg�write�OSError)rr�textrrrrsrcCsLd|j|j|jj|jf}|jdkr`yddl}|j|j|j�}Wqftk
r\d}d}YqfXn|j}|r~|j	�}|d|7}|j
dk	�rHyddl}|j|j
�}Wntk
r�d}YnX|dk	�rH|d7}xx|D]p}|d|j|jf7}y$|dk	�r
|j|j|j�}nd}Wntk
�r*d}YnX|r�|j	�}|d|7}q�W|S)Nz%s:%s: %s: %s
rz  %s
z.Object allocated at (most recent call first):
z  File "%s", lineno %s
z    %s
)
rrr
�__name__rr�	linecache�getline�	Exception�strip�source�tracemalloc�get_object_traceback)r�srrr"�tb�framerrrr#sF






rcCsdyt}Wntk
rYn<X|tk	rXt|�s6td��||j|j|j|j|j	|j
�dSt|�dS)z7Hook to write a warning to a file; replace if you like.z:warnings.showwarning() must be set to a function or methodN)r�	NameError�_showwarning_orig�callable�	TypeErrorrr
rrrrr)r�swrrr�_showwarnmsgUsr,cCsJyt}Wntk
rYn&X|tk	rB||j|j|j|j|jd�St|�S)z.Function to format a warning the standard way.)r)	rr'�_formatwarning_origrr
rrrr)r�fwrrrrjs
r�FcCs�ddl}|dkstd	|f��t|t�s0td
��t|t�sBtd��t|t�sTtd��t|t�sftd
��t|t�rx|dks�td��t||j	||j
�||j	|�||d�dS)a�Insert an entry into the list of warnings filters (at the front).

    'action' -- one of "error", "ignore", "always", "default", "module",
                or "once"
    'message' -- a regex that the warning message must match
    'category' -- a class that the warning must be a subclass of
    'module' -- a regex that the module name must match
    'lineno' -- an integer line number, 0 matches all warnings
    'append' -- if true, append to the list of filters
    rN�error�ignore�always�default�module�oncezinvalid action: %rzmessage must be a stringzcategory must be a classz#category must be a Warning subclasszmodule must be a stringzlineno must be an int >= 0)�append)r0r1r2r3r4r5)�re�AssertionError�
isinstance�str�type�
issubclass�Warning�int�_add_filter�compile�I)�actionrr
r4rr6r7rrrrwscCsH|dkstd|f��t|t�r(|dks0td	��t|d
|d
||d�d
S)
a�Insert a simple entry into the list of warnings filters (at the front).

    A simple filter matches all modules and messages.
    'action' -- one of "error", "ignore", "always", "default", "module",
                or "once"
    'category' -- a class that the warning must be a subclass of
    'lineno' -- an integer line number, 0 matches all warnings
    'append' -- if true, append to the list of filters
    r0r1r2r3r4r5zinvalid action: %rrzlineno must be an int >= 0N)r6)r0r1r2r3r4r5)r8r9r>r?)rBr
rr6rrrr�s

cGsR|s6ytj|�Wntk
r&YnXtjd|�n|tkrHtj|�t�dS)Nr)�filters�remove�
ValueError�insertr6�_filters_mutated)r6�itemrrrr?�s
r?cCsgtdd�<t�dS)zAClear the list of warning filters, so that no filters are active.N)rCrGrrrrr�sc@seZdZdZdS)�_OptionErrorz,Exception used by option processing helpers.N)r�
__module__�__qualname__�__doc__rrrrrI�srIcCsRxL|D]D}yt|�Wqtk
rH}ztd|tjd�WYdd}~XqXqWdS)NzInvalid -W option ignored:)r)�
_setoptionrI�printrr)�args�argrrrr�_processoptions�s

rQcCs�ddl}|jd�}t|�dkr,td|f��xt|�dkrF|jd�q.Wdd�|D�\}}}}}t|�}|j|�}t|�}|j|�}|r�|d}|r�yt|�}|dkr�t	�Wq�t	t
fk
r�td	|f��Yq�Xnd}t|||||�dS)
Nr�:�ztoo many fields (max 5): %rr/cSsg|]}|j��qSr)r )�.0r$rrr�
<listcomp>�sz_setoption.<locals>.<listcomp>�$zinvalid lineno %r)r7�split�lenrIr6�
_getaction�escape�_getcategoryr>rE�
OverflowErrorr)rPr7�partsrBrr
r4rrrrrM�s.


rMcCsB|sdS|dkrdSxd	D]}|j|�r|SqWtd|f��dS)
Nr3�allr2r1r4r5r0zinvalid action: %r)r3r2r1r4r5r0)�
startswithrI)rB�arrrrY�s

rYcCs�ddl}|stS|jd|�rNyt|�}Wq�tk
rJtd|f��Yq�Xn�|jd�}|d|�}||dd�}yt|dd|g�}Wn"tk
r�td|f��YnXyt	||�}Wn"t
k
r�td|f��YnXt|t�s�td|f��|S)Nrz^[a-zA-Z0-9_]+$zunknown warning category: %r�.�zinvalid module name: %rzinvalid warning category: %r)r7r=�match�evalr'rI�rfind�
__import__�ImportError�getattr�AttributeErrorr<)r
r7�cat�ir4�klass�mrrrr[�s,

r[cCs|jj}d|kod|kS)zFSignal whether the frame is an internal CPython implementation detail.�	importlib�
_bootstrap)�f_code�co_filename)r&rrrr�_is_internal_frame�srrcCs&|j}x|dk	r t|�r |j}qW|S)z;Find the next frame that doesn't involve CPython internals.N)�f_backrr)r&rrr�_next_external_frames
rtrbcCsvt|t�r|j}|dkrt}t|t�o.t|t�sDtdjt|�j���yZ|dks\t	t
jd��rht
j|�}n4t
jd�}x(t|d�D]}t
|�}|dkr�t�q�WWntk
r�t
j}d}YnX|j}|j}d|kr�|d}nd}|jd�}	|	�r|	j�}
|
jd��rP|	dd�}	n>|dk�rFyt
jd	}	Wntk
�rDd}	YnX|	�sP|}	|jd
i�}t|||	|||||�dS)z:Issue a warning, or maybe ignore it or raise an exception.Nz/category must be a Warning subclass, not '{:s}'rbrz<string>�__file__z.pyc�__main__rZ__warningregistry__���)r9r=�	__class__�UserWarningr;r<r*�formatrrrr�	_getframe�rangertrE�__dict__�	f_globals�f_lineno�get�lower�endswith�argvri�
setdefaultr)rr
�
stacklevelr!r&�x�globalsrr4rZfnl�registryrrrr
sL






cCs�t|�}|dkr8|pd}|dd�j�dkr8|dd�}|dkrDi}|jdd�tkrd|j�t|d<t|t�r~t|�}|j}n|}||�}|||f}	|j|	�r�dSx^t	D]R}
|
\}}}
}}|dks�|j
|�r�t||
�r�|dks�|j
|�r�|dks�||kr�Pq�Wt}|dk�rd||	<dSddl
}|j||�|dk�r:|�|d	k�rnd||	<||f}tj|��rddSdt|<nf|d
k�rznZ|dk�r�d||	<||df}|j|��r�dSd||<n$|dk�r�d||	<ntd
||
f��t|||||�}t|�dS)Nz	<unknown>�z.py�versionrr1rbr0r5r2r4r3z1Unrecognized action (%r) in warnings.filters:
 %s���r�)r>r�r��_filters_version�clearr9r=r:rxrCrcr<�
defaultactionr�getlines�onceregistry�RuntimeErrorr
r,)rr
rrr4r��module_globalsr!r�keyrHrBrrj�mod�lnrZoncekeyZaltkeyrrrrAsl














c@s"eZdZd
Zdd	d
�Zdd�ZdS)r
rr
rrrrr!Nc
Cs:t�}x|jD]}	t||	||	�qW|r0|jnd|_dS)N)�locals�_WARNING_DETAILS�setattrr�_category_name)
�selfrr
rrrrr!�local_values�attrrrr�__init__�szWarningMessage.__init__cCsd|j|j|j|j|jfS)NzD{message : %r, category : %r, filename : %r, lineno : %s, line : %r})rr�rrr)r�rrr�__str__�szWarningMessage.__str__)rr
rrrrr!)NNN)rrJrKr�r�r�rrrrr
�s

r
c@s8eZdZdZddd�dd�Zdd�Zd	d
�Zdd�ZdS)
r	a�A context manager that copies and restores the warnings filter upon
    exiting the context.

    The 'record' argument specifies whether warnings should be captured by a
    custom implementation of warnings.showwarning() and be appended to a list
    returned by the context manager. Otherwise None is returned by the context
    manager. The objects appended to the list are arguments whose attributes
    mirror the arguments to showwarning().

    The 'module' argument is to specify an alternative module to the module
    named 'warnings' and imported under that name. This argument is only useful
    when testing the warnings module itself.

    FN)�recordr4cCs(||_|dkrtjdn||_d|_dS)z�Specify whether to record warnings and if an alternative module
        should be used other than sys.modules['warnings'].

        For compatibility with Python 3.0, please consider all arguments to be
        keyword-only.

        N�warningsF)�_recordr�modules�_module�_entered)r�r�r4rrrr��szcatch_warnings.__init__cCsPg}|jr|jd�|jtjdk	r4|jd|j�t|�j}d|dj|�fS)Nzrecord=Truer�z	module=%rz%s(%s)z, )r�r6r�rr�r;r�join)r�rO�namerrr�__repr__�s

zcatch_warnings.__repr__cCs~|jrtd|��d|_|jj|_|jdd�|j_|jj�|jj|_|jj|_|j	rvg}|j
|j_|jj|j_|SdSdS)NzCannot enter %r twiceT)r�r�r�rC�_filtersrGr�_showwarningrr�r6r()r��logrrr�	__enter__�s




zcatch_warnings.__enter__cGs>|jstd|��|j|j_|jj�|j|j_|j|j_dS)Nz%Cannot exit %r without entering first)	r�r�r�r�rCrGr�rr)r��exc_inforrr�__exit__�s


zcatch_warnings.__exit__)rrJrKrLr�r�r�r�rrrrr	�s
	)rC�_defaultaction�
_onceregistryrrrGTr3cCstd7adS)Nrb)r�rrrrrG�srGr1)r
r0)r
r6�gettotalrefcountr2)NN)N)NrbN)NNNN)5rLr�__all__rrrrr(r,r-rr=rrr?rrrIrQrMrYr[rrrtrr�objectr
r	Z_warnings_defaults�	_warningsrCr�r�rGr�r�rgr��warnoptions�
ImportWarning�PendingDeprecationWarningZsilencer6�DeprecationWarning�cls�flags�
bytes_warningZbytes_action�BytesWarning�hasattrZresource_action�ResourceWarningrrrr�<module>sv

0

	
5
FJ 



genericpath.cpython-36.opt-2.pyc000064400000006164150335715140012436 0ustar003

�\dh��@s�ddlZddlZdddddddd	d
ddd
gZdd�Zdd	�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd
�Zdd�Z
dd�Zdd�ZejGdd
�d
��ZdS)�N�commonprefix�exists�getatime�getctime�getmtime�getsize�isdir�isfile�samefile�sameopenfile�samestat�
ALLOW_MISSINGcCs(ytj|�Wntk
r"dSXdS)NFT)�os�stat�OSError)�path�r�#/usr/lib64/python3.6/genericpath.pyrs
cCs0ytj|�}Wntk
r"dSXtj|j�S)NF)rrr�S_ISREG�st_mode)r�strrrr	s
cCs0ytj|�}Wntk
r"dSXtj|j�S)NF)rrr�S_ISDIRr)�srrrrr's
cCstj|�jS)N)rr�st_size)�filenamerrrr0scCstj|�jS)N)rr�st_mtime)rrrrr5scCstj|�jS)N)rr�st_atime)rrrrr:scCstj|�jS)N)rr�st_ctime)rrrrr?scCsl|sdSt|dttf�s*tttj|��}t|�}t|�}x,t|�D] \}}|||krD|d|�SqDW|S)N�r)	�
isinstance�list�tuple�mapr�fspath�min�max�	enumerate)�m�s1�s2�i�crrrrEscCs|j|jko|j|jkS)N)�st_ino�st_dev)r(r)rrrrWscCstj|�}tj|�}t||�S)N)rrr)�f1�f2r(r)rrrr
^s

cCstj|�}tj|�}t||�S)N)r�fstatr)�fp1�fp2r(r)rrrrgs

cCs�|j|�}|r"|j|�}t||�}|j|�}||kr~|d}x@||kr||||d�|krr|d|�||d�fS|d7}q>W||dd�fS)N�r)�rfindr%)�p�sep�altsep�extsep�sepIndex�altsepIndex�dotIndex�
filenameIndexrrr�	_splitextus




r=cGsbd}}xB|D]:}t|t�r"d}qt|t�r2d}qtd||jjf�d�qW|r^|r^td�d�dS)NFTz*%s() argument must be str or bytes, not %rz.Can't mix strings and bytes in path components)r�str�bytes�	TypeError�	__class__�__name__)�funcname�args�hasstr�hasbytesrrrr�_check_arg_types�s


rGc@seZdZdd�Zdd�ZdS)r
cCsdS)Nzos.path.ALLOW_MISSINGr)�selfrrr�__repr__�szALLOW_MISSING.__repr__cCs|jjS)N)rArB)rHrrr�
__reduce__�szALLOW_MISSING.__reduce__N)rB�
__module__�__qualname__rIrJrrrrr
�s)rr�__all__rr	rrrrrrrr
rr=rG�object�__new__r
rrrr�<module>s$

		wave.cpython-36.opt-1.pyc000064400000042653150335715140011111 0ustar003


 \-E�@s�dZddlZdddddgZGdd�de�Zd	ZdZddlZddlZddl	Z	dd
l
mZddlm
Z
e
dd�ZGdd�d�ZGdd�d�Zddd�ZeZdS)a$
Stuff to parse WAVE files.

Usage.

Reading WAVE files:
      f = wave.open(file, 'r')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods read(), seek(), and close().
When the setpos() and rewind() methods are not used, the seek()
method is not  necessary.

This returns an instance of a class with the following public methods:
      getnchannels()  -- returns number of audio channels (1 for
                         mono, 2 for stereo)
      getsampwidth()  -- returns sample width in bytes
      getframerate()  -- returns sampling frequency
      getnframes()    -- returns number of audio frames
      getcomptype()   -- returns compression type ('NONE' for linear samples)
      getcompname()   -- returns human-readable version of
                         compression type ('not compressed' linear samples)
      getparams()     -- returns a namedtuple consisting of all of the
                         above in the above order
      getmarkers()    -- returns None (for compatibility with the
                         aifc module)
      getmark(id)     -- raises an error since the mark does not
                         exist (for compatibility with the aifc module)
      readframes(n)   -- returns at most n frames of audio
      rewind()        -- rewind to the beginning of the audio stream
      setpos(pos)     -- seek to the specified position
      tell()          -- return the current position
      close()         -- close the instance (make it unusable)
The position returned by tell() and the position given to setpos()
are compatible and have nothing to do with the actual position in the
file.
The close() method is called automatically when the class instance
is destroyed.

Writing WAVE files:
      f = wave.open(file, 'w')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods write(), tell(), seek(), and
close().

This returns an instance of a class with the following public methods:
      setnchannels(n) -- set the number of channels
      setsampwidth(n) -- set the sample width
      setframerate(n) -- set the frame rate
      setnframes(n)   -- set the number of frames
      setcomptype(type, name)
                      -- set the compression type and the
                         human-readable compression type
      setparams(tuple)
                      -- set all parameters at once
      tell()          -- return current position in output file
      writeframesraw(data)
                      -- write audio frames without pathing up the
                         file header
      writeframes(data)
                      -- write audio frames and patch up the file header
      close()         -- patch up the file header and close the
                         output file
You should set the parameters before the first writeframesraw or
writeframes.  The total number of frames does not need to be set,
but when it is set to the correct value, the header does not have to
be patched up.
It is best to first set all parameters, perhaps possibly the
compression type, and then write audio frames using writeframesraw.
When all frames have been written, either call writeframes(b'') or
close() to patch up the sizes in the header.
The close() method is called automatically when the class instance
is destroyed.
�N�open�openfp�Error�	Wave_read�
Wave_writec@seZdZdS)rN)�__name__�
__module__�__qualname__�r
r
�/usr/lib64/python3.6/wave.pyrNs��b�h�i)�Chunk)�
namedtuple�_wave_paramsz7nchannels sampwidth framerate nframes comptype compnamec@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,S)-raPVariables used in this class:

    These variables are available to the user though appropriate
    methods of this class:
    _file -- the open file with methods read(), close(), and seek()
              set through the __init__() method
    _nchannels -- the number of audio channels
              available through the getnchannels() method
    _nframes -- the number of audio frames
              available through the getnframes() method
    _sampwidth -- the number of bytes per audio sample
              available through the getsampwidth() method
    _framerate -- the sampling frequency
              available through the getframerate() method
    _comptype -- the AIFF-C compression type ('NONE' if AIFF)
              available through the getcomptype() method
    _compname -- the human-readable AIFF-C compression type
              available through the getcomptype() method
    _soundpos -- the position in the audio stream
              available through the tell() method, set through the
              setpos() method

    These variables are used internally only:
    _fmt_chunk_read -- 1 iff the FMT chunk has been read
    _data_seek_needed -- 1 iff positioned correctly in audio
              file for readframes()
    _data_chunk -- instantiation of a chunk class for the DATA chunk
    _framesize -- size of one frame in the file
    cCsd|_d|_t|dd�|_|jj�dkr0td��|jjd�dkrHtd��d|_d|_x�d|_	yt|jdd�}Wnt
k
r�PYnX|j�}|d	kr�|j|�d|_n2|d
kr�|js�td��||_|j|j
|_d|_	P|j�qVW|js�|j�rtd��dS)
Nr)Z	bigendiansRIFFz file does not start with RIFF id�sWAVEznot a WAVE filersfmt sdatazdata chunk before fmt chunkz#fmt chunk and/or data chunk missing)�_convert�	_soundposr�_fileZgetnamer�readZ_fmt_chunk_read�_data_chunk�_data_seek_needed�EOFError�_read_fmt_chunkZ	chunksize�
_framesize�_nframes�skip)�self�file�chunkZ	chunknamer
r
r�initfp}s:
zWave_read.initfpc	CsRd|_t|t�r"tj|d�}||_y|j|�Wn|jrF|j��YnXdS)N�rb)�_i_opened_the_file�
isinstance�str�builtinsrr"�close)r�fr
r
r�__init__�s
zWave_read.__init__cCs|j�dS)N)r()rr
r
r�__del__�szWave_read.__del__cCs|S)Nr
)rr
r
r�	__enter__�szWave_read.__enter__cGs|j�dS)N)r()r�argsr
r
r�__exit__�szWave_read.__exit__cCs|jS)N)r)rr
r
r�getfp�szWave_read.getfpcCsd|_d|_dS)Nrr)rr)rr
r
r�rewind�szWave_read.rewindcCs"d|_|j}|rd|_|j�dS)N)rr$r()rr r
r
rr(�s
zWave_read.closecCs|jS)N)r)rr
r
r�tell�szWave_read.tellcCs|jS)N)�
_nchannels)rr
r
r�getnchannels�szWave_read.getnchannelscCs|jS)N)r)rr
r
r�
getnframes�szWave_read.getnframescCs|jS)N)�
_sampwidth)rr
r
r�getsampwidth�szWave_read.getsampwidthcCs|jS)N)�
_framerate)rr
r
r�getframerate�szWave_read.getframeratecCs|jS)N)�	_comptype)rr
r
r�getcomptype�szWave_read.getcomptypecCs|jS)N)�	_compname)rr
r
r�getcompname�szWave_read.getcompnamecCs*t|j�|j�|j�|j�|j�|j��S)N)rr3r6r8r4r:r<)rr
r
r�	getparams�szWave_read.getparamscCsdS)Nr
)rr
r
r�
getmarkers�szWave_read.getmarkerscCstd��dS)Nzno marks)r)r�idr
r
r�getmark�szWave_read.getmarkcCs*|dks||jkrtd��||_d|_dS)Nrzposition not in ranger)rrrr)r�posr
r
r�setpos�szWave_read.setposcCs�|jr8|jjdd�|j|j}|r2|jj|d�d|_|dkrDdS|jj||j�}|jdkrxtjdkrxt	j
||j�}|jr�|r�|j|�}|jt|�|j
|j|_|S)Nr�r�big)rr�seekrrrr5�sys�	byteorder�audioop�byteswapr�lenr2)r�nframesrA�datar
r
r�
readframes�s

zWave_read.readframescCsztjd|jd��\}|_|_}}|tkrNtjd|jd��d}|dd|_ntd|f��|j|j|_d	|_	d
|_
dS)Nz<HHLLH�z<H�r��zunknown format: %r�NONEznot compressed)�structZunpack_fromrr2r7�WAVE_FORMAT_PCMr5rrr9r;)rr!Z
wFormatTagZdwAvgBytesPerSecZwBlockAlign�	sampwidthr
r
rr�s zWave_read._read_fmt_chunkN)rrr	�__doc__r"r*r+r,r.r/r0r(r1r3r4r6r8r:r<r=r>r@rBrMrr
r
r
rr^s,
c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:S);ra�Variables used in this class:

    These variables are user settable through appropriate methods
    of this class:
    _file -- the open file with methods write(), close(), tell(), seek()
              set through the __init__() method
    _comptype -- the AIFF-C compression type ('NONE' in AIFF)
              set through the setcomptype() or setparams() method
    _compname -- the human-readable AIFF-C compression type
              set through the setcomptype() or setparams() method
    _nchannels -- the number of audio channels
              set through the setnchannels() or setparams() method
    _sampwidth -- the number of bytes per audio sample
              set through the setsampwidth() or setparams() method
    _framerate -- the sampling frequency
              set through the setframerate() or setparams() method
    _nframes -- the number of audio frames written to the header
              set through the setnframes() or setparams() method

    These variables are used internally only:
    _datalength -- the size of the audio samples written to the header
    _nframeswritten -- the number of frames actually written
    _datawritten -- the size of the audio samples actually written
    c	CsRd|_t|t�r"tj|d�}||_y|j|�Wn|jrF|j��YnXdS)N�wb)r$r%r&r'rr"r()rr)r
r
rr*#s
zWave_write.__init__cCs@||_d|_d|_d|_d|_d|_d|_d|_d|_d|_	dS)NrF)
rrr2r5r7r�_nframeswritten�_datawritten�_datalength�_headerwritten)rr r
r
rr"/szWave_write.initfpcCs|j�dS)N)r()rr
r
rr+;szWave_write.__del__cCs|S)Nr
)rr
r
rr,>szWave_write.__enter__cGs|j�dS)N)r()rr-r
r
rr.AszWave_write.__exit__cCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerzbad # of channels)rYrr2)r�	nchannelsr
r
r�setnchannelsGs
zWave_write.setnchannelscCs|jstd��|jS)Nznumber of channels not set)r2r)rr
r
rr3NszWave_write.getnchannelscCs0|jrtd��|dks|dkr&td��||_dS)Nz0cannot change parameters after starting to writerrzbad sample width)rYrr5)rrUr
r
r�setsampwidthSs
zWave_write.setsampwidthcCs|jstd��|jS)Nzsample width not set)r5r)rr
r
rr6ZszWave_write.getsampwidthcCs0|jrtd��|dkrtd��tt|��|_dS)Nz0cannot change parameters after starting to writerzbad frame rate)rYr�int�roundr7)r�	framerater
r
r�setframerate_s
zWave_write.setframeratecCs|jstd��|jS)Nzframe rate not set)r7r)rr
r
rr8fszWave_write.getframeratecCs|jrtd��||_dS)Nz0cannot change parameters after starting to write)rYrr)rrKr
r
r�
setnframeskszWave_write.setnframescCs|jS)N)rX)rr
r
rr4pszWave_write.getnframescCs.|jrtd��|dkrtd��||_||_dS)Nz0cannot change parameters after starting to writerRzunsupported compression type)rR)rYrr9r;)r�comptype�compnamer
r
r�setcomptypesszWave_write.setcomptypecCs|jS)N)r9)rr
r
rr:{szWave_write.getcomptypecCs|jS)N)r;)rr
r
rr<~szWave_write.getcompnamecCsV|\}}}}}}|jrtd��|j|�|j|�|j|�|j|�|j||�dS)Nz0cannot change parameters after starting to write)rYrr]r^rbrcrf)rZparamsr\rUrarKrdrer
r
r�	setparams�s



zWave_write.setparamscCs>|js|js|jr td��t|j|j|j|j|j|j�S)Nznot all parameters set)r2r5r7rrrr9r;)rr
r
rr=�szWave_write.getparamscCstd��dS)Nzsetmark() not supported)r)rr?rA�namer
r
r�setmark�szWave_write.setmarkcCstd��dS)Nzno marks)r)rr?r
r
rr@�szWave_write.getmarkcCsdS)Nr
)rr
r
rr>�szWave_write.getmarkerscCs|jS)N)rX)rr
r
rr1�szWave_write.tellcCs�t|ttf�st|�jd�}|jt|��t|�|j|j}|j	rN|j	|�}|jdkrpt
jdkrptj
||j�}|jj|�|jt|�7_|j||_dS)N�BrrD)r%�bytes�	bytearray�
memoryview�cast�_ensure_header_writtenrJr5r2rrFrGrHrIr�writerYrX)rrLrKr
r
r�writeframesraw�s
zWave_write.writeframesrawcCs"|j|�|j|jkr|j�dS)N)rqrZrY�_patchheader)rrLr
r
r�writeframes�s
zWave_write.writeframescCsXz2|jr0|jd�|j|jkr&|j�|jj�Wdd|_|j}|rRd|_|j�XdS)Nr)rrorZrYrr�flushr$r()rr r
r
rr(�s
zWave_write.closecCs>|js:|jstd��|js"td��|js0td��|j|�dS)Nz# channels not specifiedzsample width not specifiedzsampling rate not specified)r[r2rr5r7�
_write_header)rZdatasizer
r
rro�sz!Wave_write._ensure_header_writtencCs�|jjd�|js$||j|j|_|j|j|j|_y|jj�|_Wntt	fk
rfd|_YnX|jjt
jdd|jdddt|j|j
|j|j
|j|j|j|jdd��|jdk	r�|jj�|_|jjt
jd	|j��d
|_dS)NsRIFFz<L4s4sLHHLLHH4s�$sWAVEsfmt �rQsdataz<LT)rrprr2r5rZr1�_form_length_pos�AttributeError�OSErrorrS�packrTr7�_data_length_posr[)rZ
initlengthr
r
rru�s$


zWave_write._write_headercCs�|j|jkrdS|jj�}|jj|jd�|jjtjdd|j��|jj|j	d�|jjtjd|j��|jj|d�|j|_dS)Nrz<Lrv)
rYrZrr1rErxrprSr{r|)rZcurposr
r
rrr�s
zWave_write._patchheaderN) rrr	rVr*r"r+r,r.r]r3r^r6rbr8rcr4rfr:r<rgr=rir@r>r1rqrsr(rorurrr
r
r
rr	s:


cCsJ|dkrt|d�r|j}nd}|dkr.t|�S|dkr>t|�Std��dS)	N�moder#�r�wrWz$mode must be 'r', 'rb', 'w', or 'wb')r~r#)rrW)�hasattrr}rrr)r)r}r
r
rr�s
)Nr
rNr)N)rVr'�__all__�	ExceptionrrTZ_array_fmtsrHrSrFr!r�collectionsrrrrrrr
r
r
r�<module>Hs$,d

netrc.cpython-36.opt-1.pyc000064400000007376150335715140011265 0ustar003


 \4�@sXdZddlZddlZddlZddgZGdd�de�ZGdd�d�ZedkrTe	e��dS)z-An object-oriented interface to .netrc files.�N�netrc�NetrcParseErrorc@s"eZdZdZddd�Zdd�ZdS)rz5Exception raised on syntax errors in the .netrc file.NcCs"||_||_||_tj||�dS)N)�filename�lineno�msg�	Exception�__init__)�selfrrr�r
�/usr/lib64/python3.6/netrc.pyrszNetrcParseError.__init__cCsd|j|j|jfS)Nz%s (%s, line %s))rrr)r	r
r
r�__str__szNetrcParseError.__str__)NN)�__name__�
__module__�__qualname__�__doc__rrr
r
r
rr
s
c@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)rNcCsx|dk}|dkrFytjjtjdd�}Wntk
rDtd��YnXi|_i|_t|��}|j	|||�WdQRXdS)N�HOMEz.netrcz'Could not find .netrc: $HOME is not set)
�os�path�join�environ�KeyError�OSError�hosts�macros�open�_parse)r	�file�
default_netrc�fpr
r
rrs
znetrc.__init__cCs�tj|�}|jd7_|jjdd�|_�x�|j}|j�}}|sFPn�|ddkrv|j|kr,t|�dkr,|jj�q,n�|dkr�|j�}nz|dkr�d}nl|dkr�|j�}g|j	|<d	|_
x4|jj�}	|	s�|	d
kr�d|_
P|j	|j|	�q�Wq,ntd|||j��d}
d}}i|j
|<�x�|j�}|jd��s:|dk�r~|�r^|
||f|j
|<|j|�Pntd
||t|�f||j���q|dk�s�|dk�r�|j�}
�q|dk�r�|j�}�q|dk�r�tjdk�r�|�r�tj|j��}
|
jtj�k�r|ddl}y|j|
j�d}Wn tk
�r*d|
j}YnXy|jtj��d}Wn"tk
�rddtj�}YnXtd||f||j��|
jtjtjB@�r�td||j��|j�}ntd|||j���qWq,WdS)Nz !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~�#�r��machine�default�macdefz 	�
z 	
zbad toplevel token %rz&malformed %s entry %s terminated by %s�login�user�account�password�posixzuid %sz9~/.netrc file owner (%s) does not match current user (%s)zY~/.netrc access too permissive: access permissions must restrict access to only the ownerzbad follower token %r>r r#r"r$)�shlexZ	wordcharsZ
commenters�replacerZ	get_token�lenZinstream�readlinerZ
whitespace�appendrr�
startswithZ
push_token�reprr�name�fstat�fileno�st_uid�getuid�pwd�getpwuidr�st_mode�stat�S_IRWXG�S_IRWXO)r	rrrZlexerZsaved_linenoZtoplevelZttZ	entryname�liner&r(r)Zpropr7Zfownerr'r
r
rr#s�












znetrc._parsecCs0||jkr|j|Sd|jkr(|jdSdSdS)z8Return a (user, account, password) tuple for given host.r#N)r)r	�hostr
r
r�authenticatorsts




znetrc.authenticatorscCs�d}xf|jj�D]X}|j|}|d|�d|d�d�7}|drT|d|d�d�7}|d|d	�d�7}qWxF|jj�D]8}|d
|�d�7}x|j|D]}||7}q�W|d7}qxW|S)z3Dump the class data in the format of a .netrc file.r zmachine z
	login rr%r!z		account z
	password �zmacdef )r�keysr)r	Zrepr>ZattrsZmacror=r
r
r�__repr__}s
znetrc.__repr__)N)r
rrrrr?rBr
r
r
rrs
Q	�__main__)
rrr+r:�__all__rrrr
�printr
r
r
r�<module>swpyclbr.cpython-36.opt-1.pyc000064400000020257150335715140011436 0ustar003


 \�4�@s�dZddlZddlZddlZddlZddlmZmZm	Z	ddddgZ
iZGdd�d�ZGd	d�d�Z
dd
d�Zddd�Zddd
�Zdd�Zdd�Zdd�Zedkr�e�dS)a�Parse a Python module and describe its classes and methods.

Parse enough of a Python file to recognize imports and class and
method definitions, and to find out the superclasses of a class.

The interface consists of a single function:
        readmodule_ex(module [, path])
where module is the name of a Python module, and path is an optional
list of directories where the module is to be searched.  If present,
path is prepended to the system search path sys.path.  The return
value is a dictionary.  The keys of the dictionary are the names of
the classes defined in the module (including classes that are defined
via the from XXX import YYY construct).  The values are class
instances of the class Class defined here.  One special key/value pair
is present for packages: the key '__path__' has a list as its value
which contains the package search path.

A class is described by the class Class in this module.  Instances
of this class have the following instance variables:
        module -- the module name
        name -- the name of the class
        super -- a list of super classes (Class instances)
        methods -- a dictionary of methods
        file -- the file in which the class was defined
        lineno -- the line in the file on which the class statement occurred
The dictionary of methods uses the method names as keys and the line
numbers on which the method was defined as values.
If the name of a super class is not recognized, the corresponding
entry in the list of super classes is not a class instance but a
string giving the name of the super class.  Since import statements
are recognized and imported modules are scanned as well, this
shouldn't happen often.

A function is described by the class Function in this module.
Instances of this class have the following instance variables:
        module -- the module name
        name -- the name of the class
        file -- the file in which the class was defined
        lineno -- the line in the file on which the class statement occurred
�N)�NAME�DEDENT�OP�
readmodule�
readmodule_ex�Class�Functioncs(eZdZdZ�fdd�Zdd�Z�ZS)rz"Class to represent a Python class.cs4||_||_|dkrg}||_i|_||_||_dS)N)�module�name�super�methods�file�lineno)�selfr	r
rr
r)�	__class__��/usr/lib64/python3.6/pyclbr.py�__init__7szClass.__init__cCs||j|<dS)N)r)rr
rrrr�
_addmethodAszClass._addmethod)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__rr)rrr5s
c@seZdZdZdd�ZdS)rz.Class to represent a top-level Python functioncCs||_||_||_||_dS)N)r	r
r
r)rr	r
r
rrrrrFszFunction.__init__N)rrrrrrrrrrDscCs:i}x0t||pg�j�D]\}}t|t�r|||<qW|S)z}Backwards compatible interface.

    Call readmodule_ex() and then only keep Class objects from the
    resulting dictionary.)�_readmodule�items�
isinstancer)r	�path�res�key�valuerrrrLs

cCst||p
g�S)z�Read a module file and return a dictionary of classes.

    Search for MODULE in PATH and sys.path, read and parse the
    module and return a dictionary with one entry for each class
    found in the module.
    )r)r	rrrrrXsc&!Cs�|dk	rd||f}n|}|tkr*t|Si}|tjkrL|dkrL|t|<|S|jd�}|dkr�|d|�}||dd�}t|||�}|dk	r�d||f}d|kr�tdj|���t||d|�Sd}	|dk	r�|}
n
|tj}
tj	j
||
�}|t|<|jdk	�r|j|d<y|jj
|�}|dk�r$|SWnttfk
�r@|SX|jj|�}
tj|�}	g}tj|	j�}�y<�x4|D�]*\}}}}}|tk�r�|\}}x$|�r�|dd|k�r�|d=�q�W�qt|dk�rl|\}}x$|�r�|dd|k�r�|d=�q�Wt|�dd	�\}}}|tk�r�qt|�rH|dd}t|t��rZ|j||�nt|||
|�||<|jd|f��qt|d
k�rD|\}}x$|�r�|dd|k�r�|d=�q�Wt|�dd	�\}}}|tk�rȐqtt|�dd	�\}}}d}|dk�rg}d}g}�xt|�dd	�\}}}|dk�r�|dk�r�dj|�}||k�rD||}nL|jd�}t|�dk�r�|d} |d}| tk�r�t| }!||!k�r�|!|}|j|�g}|dk�r�|d7}nX|dk�r�|d8}|dk�r
Pn8|d
k�r�|dk�r�n"|tt fk�r�|dk�r�|j|��q�W|}t||||
|�}|�s2|||<|j||f��qt|dk�r�|ddk�r�t!|�}"xl|"D]d\}#}$yL|dk�r�t|#|�n2yt|#||�Wn tk
�r�t|#g�YnXWnYnX�qjWn�|dk�rt|ddk�rtt"|�\}#}|#�st|dk�r�qtt!|�}yt|#||�}!Wn�wtYnXxd|D]\\}}%||!k�rd|!|||%�p`|<n4|dk�r>x(|!D] }|ddk�rt|!|||<�qtW�q>W�qtWWnt#k
�r�YnX|	j$�|S)a.Do the hard work for readmodule[_ex].

    If INPACKAGE is given, it must be the dotted name of the package in
    which we are searching for a submodule, and then PATH must be the
    package search path; otherwise, we are searching for a top-level
    module, and PATH is combined with sys.path.
    Nz%s.%s�.r��__path__zNo package named {}�def��class�(�)�,���import�from�*�_���r0r0r0r0r0r0)r(r)���r0)%�_modules�sys�builtin_module_names�rfindr�ImportError�formatr�	importlib�util�_find_spec_from_path�submodule_search_locations�loader�
get_source�AttributeError�get_filename�io�StringIO�tokenize�generate_tokens�readliner�nextrrrrr�append�join�split�lenr�_getnamelist�_getname�
StopIteration�close)&r	rZ	inpackageZ
fullmodule�dict�i�packageZ	submodule�parent�fZsearch_path�spec�sourceZfname�stack�g�	tokentype�token�startZ_end�_linerZ
thisindentZ	meth_nameZ	cur_class�
class_nameZinherit�names�levelr�n�c�m�d�modules�modZ_mod2Zn2rrrras	


























"rcCstg}xjt|�\}}|sP|dkr.t|�\}}nd}|j||f�x |dkr`d|kr`t|�d}qBW|dkrPqW|S)N�asr)�
r")rKrFrE)rVr\r
rXZname2rrrrJsrJcCs�g}t|�dd�\}}|tkr0|dkr0d|fS|j|�xJt|�dd�\}}|dkrZPt|�dd�\}}|tkrxP|j|�q<Wdj|�|fS)Nrr+r.r!)rErrFrG)rV�partsrWrXrrrrK3s
rKc
Csddl}ddlm}tjd}|jj|�r`|jj|�g}|jj|�}|j	�j
d�rd|dd
�}ng}t||�}t|j
��}|jdd�d�x�|D]z}t|t�r�td	|j|j|j�t|jj�|d�d�}x@|D]\}}	|d
kr�td||	�q�Wq�t|t�r�td|j|j�q�WdS)Nr)�
itemgetterr"z.pyr%cSst|dd�S)Nrr)�getattr)�arrr�<lambda>Tsz_main.<locals>.<lambda>)rr&r#z  defr$���)�os�operatorrgr3�argvr�exists�dirname�basename�lower�endswithr�list�values�sortrr�printr
rr�sortedrrr)
rlrgrcrrNZobjs�objrr
rrrr�_mainFs*




rz�__main__)N)N)N)rr@r3�importlib.utilr8rBrXrrr�__all__r2rrrrrrJrKrzrrrrr�<module>(s$

	
?imghdr.cpython-36.opt-1.pyc000064400000010070150335715140011405 0ustar003


 \��@s2dZddlmZdgZd%dd�ZgZdd�Zeje�dd	�Zeje�d
d�Z	eje	�dd
�Z
eje
�dd�Zeje�dd�Zeje�dd�Z
eje
�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�d d!�Zd"d#�Zed$k�r.e�dS)&z<Recognize image file formats based on their first few bytes.�)�PathLike�whatNc
Cs�d}zl|dkrNt|ttf�r2t|d�}|jd�}n|j�}|jd�}|j|�xtD]}|||�}|rT|SqTWWd|r~|j�XdS)N�rb� )	�
isinstance�strr�open�read�tell�seek�tests�close)�file�h�f�locationZtf�res�r�/usr/lib64/python3.6/imghdr.pyrs 





cCs|dd�dkrdSdS)z JPEG data in JFIF or Exif format��
�JFIF�ExifZjpegN)rrr)rrrrr�	test_jpeg%srcCs|jd�rdSdS)Ns�PNG

Zpng)�
startswith)rrrrr�test_png,s
rcCs|dd�dkrdSdS)zGIF ('87 and '89 variants)Nr�GIF87a�GIF89aZgif)rrr)rrrrr�test_gif2srcCs|dd�dkrdSdS)z-TIFF (can be in Motorola or Intel byte order)N��MM�IIZtiff)r r!r)rrrrr�	test_tiff9sr"cCs|jd�rdSdS)zSGI image librarys�ZrgbN)r)rrrrr�test_rgb@s
r#cCs<t|�dkr8|dtd�kr8|ddkr8|ddkr8dSd	S)
zPBM (portable bitmap)�r�P�s14rs 	

ZpbmN)�len�ord)rrrrr�test_pbmGs(r)cCs<t|�dkr8|dtd�kr8|ddkr8|ddkr8dSd	S)
zPGM (portable graymap)r$rr%r&s25rs 	

ZpgmN)r'r()rrrrr�test_pgmOs(r*cCs<t|�dkr8|dtd�kr8|ddkr8|ddkr8dSd	S)
zPPM (portable pixmap)r$rr%r&s36rs 	

ZppmN)r'r()rrrrr�test_ppmWs(r+cCs|jd�rdSdS)zSun raster filesY�j�ZrastN)r)rrrrr�	test_rast_s
r,cCs|jd�rdSdS)zX bitmap (X10 or X11)s#define ZxbmN)r)rrrrr�test_xbmfs
r-cCs|jd�rdSdS)NsBMZbmp)r)rrrrr�test_bmpms
r.cCs"|jd�r|dd�dkrdSdS)NsRIFF��sWEBPZwebp)r)rrrrr�	test_webpssr1cCs|jd�rdSdS)Nsv/1Zexr)r)rrrrr�test_exrys
r2cCs�ddl}d}|jdd�r8|jddkr8|jdd�=d}y8|jdd�r`t|jdd�|d�ntdg|d�Wn*tk
r�|jjd�|jd�YnXdS)Nrr&z-rr�.z
[Interrupted]
)�sys�argv�testall�KeyboardInterrupt�stderr�write�exit)r4�	recursiverrr�test�sr<cCs�ddl}ddl}x�|D]�}|jj|�rzt|ddd�|s>|rptd�ddl}|j|jj|d��}t||d�q�td�qt|ddd�|jj	�ytt
|��Wqtk
r�td	�YqXqWdS)
Nrz/:� )�endzrecursing down:�*z*** directory (use -r) ***�:z*** not found ***)r4�os�path�isdir�print�glob�joinr6�stdout�flushr�OSError)�listr;Ztoplevelr4rA�filenamerE�namesrrrr6�s"


r6�__main__)N)�__doc__rAr�__all__rrr�appendrrr"r#r)r*r+r,r-r.r1r2r<r6�__name__rrrr�<module>sD














tarfile.cpython-36.opt-2.pyc000064400000164625150335715140011602 0ustar003

�\dh���'@s>dZdZdZdZdZddlmZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZyddlZWnek
r�dZYnXyddlZWnek
r�dZYnXeefZyeef7ZWnek
r�YnXdd	d
ddd
dddddddddgZdZdZdZdZedZdZ dZ!dZ"dZ#dZ$d Z%dZ&d!Z'd"Z(d#Z)d$Z*d%Z+d&Z,d'Z-d(Z.d)Z/d*Z0d+Z1d,Z2d-Z3dZ4d.Z5d/Z6e5Z7e%e&e'e(e+e,e-e)e*e.e/e0fZ8e%e&e-e0fZ9e.e/e0fZ:d�Z;d0d1d6d7hZ<e=e=e=e>e>e>d8�Z?e	j@d9k�r�d:ZAnejB�ZAd;d<�ZCd=d>�ZDd?d@�ZEdAe7fdBdC�ZFdDdE�ZGdedfdFdG�ZHdHdI�ZIdJdK�ZJGdLd�deK�ZLGdMd�deL�ZMGdNd�deL�ZNGdOd
�d
eL�ZOGdPd�deL�ZPGdQd�deL�ZQGdRdS�dSeQ�ZRGdTdU�dUeQ�ZSGdVdW�dWeQ�ZTGdXdY�dYeQ�ZUGdZd[�d[eQ�ZVGd\d]�d]�ZWGd^d_�d_�ZXGd`da�daeY�ZZGdbdc�dceY�Z[Gddde�dee
j\�Z]Gdfdg�dgeL�Z^Gdhdi�die^�Z_Gdjdk�dke^�Z`Gdldm�dme^�ZaGdndo�doe^�ZbGdpdq�dqe^�ZcGdrds�dse^�Zde^eeMfZed�dtdu�Zfdvdw�Zgdxdy�Zhdzd{�Ziegeheid|�ZjeY�Zkejld}�ZmGd~d	�d	eY�ZnGdd�deY�Zod�d
�ZpeojZd�d��Zqerd�k�r:eq�dS)�z0.9.0u"Lars Gustäbel (lars@gustaebel.de)z5$Date: 2011-02-25 17:42:01 +0200 (Fri, 25 Feb 2011) $z?$Id: tarfile.py 88586 2011-02-25 15:42:01Z marc-andre.lemburg $u4Gustavo Niemeyer, Niels Gustäbel, Richard Townsend.�)�openN�TarFile�TarInfo�
is_tarfile�TarError�	ReadError�CompressionError�StreamError�ExtractError�HeaderError�ENCODING�USTAR_FORMAT�
GNU_FORMAT�
PAX_FORMAT�DEFAULT_FORMATrTz/etc/python/tarfile.cfg�i�sustar  sustar00�d��0�1�2�3�4�5�6�7�L�K�S�x�g�X���path�linkpath�size�mtime�uid�gid�uname�gname)ZatimeZctimer(r)r*r'�ntzutf-8cCs8|dkrtd��|j||�}|d|�|t|�tS)Nzmetadata cannot contain None)�
ValueError�encode�len�NUL)�s�length�encoding�errors�r6�/usr/lib64/python3.6/tarfile.py�stn�sr8cCs*|jd�}|dkr|d|�}|j||�S)Nrr#���)�find�decode)r2r4r5�pr6r6r7�nts�s
r=cCs�|ddkrfd}x0tt|�d�D]}|dK}|||d7}q"W|ddkr�dt|�d|}n@y"t|dd�}t|j�p�d	d�}Wntk
r�td
��YnX|S)Nr��r#���ascii�strict�0zinvalid header)r>r?)�ranger0r=�int�stripr.�InvalidHeaderError)r2�n�ir6r6r7�nti�srKr@cCs�t|�}d|ko"d|dknrDtd|d|fd�t}n�|tkr�d|d|kopd|dknr�|dkr�tdg�}ntdg�}d||}x6t|d�D]}|jd|d@�|dL}q�Wntd	��|S)
Nrr@r#z%0*orBrAr>r?zoverflow in number field)rF�bytesr1r�	bytearrayrE�insertr.)rI�digits�formatr2rJr6r6r7�itn�s 2
rQcCs0dttjd|��}dttjd|��}||fS)NrAZ
148B8x356BZ
148b8x356b)�sum�structZunpack_from)�bufZunsigned_chksumZ
signed_chksumr6r6r7�calc_chksums�s	rUc	Cs�|pd}|dkrdS|dkr.tj|||�dSt||�\}}x8t|�D],}|j|�}t|�|krh|d��|j|�qFW|dkr�|j|�}t|�|kr�|d��|j|�dS)N�irzunexpected end of datai@)�shutil�copyfileobj�divmodrE�readr0�write)	�src�dstr3�	exception�bufsize�blocks�	remainder�brTr6r6r7rX�s$


rXcCs ddl}|jdtd�tj|�S)Nrz$deprecated in favor of stat.filemoder$)�warnings�warn�DeprecationWarning�stat�filemode)�modercr6r6r7rgsrgcCs8ttjdd�}|dk	r(|j|d�j|�}t|dd�dS)Nr4�backslashreplace� )�end)�getattr�sys�stdoutr/r;�print)r2r4r6r6r7�_safe_printsrpc@seZdZdS)rN)�__name__�
__module__�__qualname__r6r6r6r7rsc@seZdZdS)r
N)rqrrrsr6r6r6r7r
!sc@seZdZdS)rN)rqrrrsr6r6r6r7r$sc@seZdZdS)rN)rqrrrsr6r6r6r7r'sc@seZdZdS)r	N)rqrrrsr6r6r6r7r	*sc@seZdZdS)rN)rqrrrsr6r6r6r7r-sc@seZdZdS)�EmptyHeaderErrorN)rqrrrsr6r6r6r7rt0srtc@seZdZdS)�TruncatedHeaderErrorN)rqrrrsr6r6r6r7ru3sruc@seZdZdS)�EOFHeaderErrorN)rqrrrsr6r6r6r7rv6srvc@seZdZdS)rHN)rqrrrsr6r6r6r7rH9srHc@seZdZdS)�SubsequentHeaderErrorN)rqrrrsr6r6r6r7rw<srwc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
_LowLevelFilecCsFtjtjtjBtjBd�|}ttd�r2|tjO}tj||d�|_dS)N)�r�w�O_BINARYi�)	�os�O_RDONLY�O_WRONLY�O_CREAT�O_TRUNC�hasattrr{r�fd)�self�namerhr6r6r7�__init__Is

z_LowLevelFile.__init__cCstj|j�dS)N)r|�closer�)r�r6r6r7r�Rsz_LowLevelFile.closecCstj|j|�S)N)r|rZr�)r�r'r6r6r7rZUsz_LowLevelFile.readcCstj|j|�dS)N)r|r[r�)r�r2r6r6r7r[Xsz_LowLevelFile.writeN)rqrrrsr�r�rZr[r6r6r6r7rxCs	rxc@speZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
ddd�Zddd�Zdd�Z
dd�ZdS)�_Streamc	Cs�d|_|dkrt||�}d|_|dkr6t|�}|j�}|p<d|_||_||_||_||_d|_	d|_
d|_�yL|dkr�yddl}Wnt
k
r�td��YnX||_|jd�|_|d	kr�|j�|j|_n|j�n�|d
k�r:yddl}Wnt
k
�r
td��YnX|d	k�r.d|_|j�|_t|_n
|j�|_n||dk�r�yddl}Wnt
k
�rntd
��YnX|d	k�r�d|_|j�|_|j|_n
|j�|_n|dk�r�td|��Wn&|j�s�|jj�d|_�YnXdS)NTF�*��r�gzzzlib module is not availablery�bz2zbz2 module is not available�xzzlzma module is not available�tarzunknown compression type %r) �_extfileobjrx�_StreamProxy�getcomptyper�rh�comptype�fileobjr_rT�pos�closed�zlib�ImportErrorr�crc32�crc�
_init_read_gz�errorr^�_init_write_gzr��dbufZBZ2Decompressor�cmp�OSErrorZ
BZ2Compressor�lzmaZLZMADecompressor�	LZMAErrorZLZMACompressorr�)	r�r�rhr�r�r_r�r�r�r6r6r7r�fsl












z_Stream.__init__cCst|d�r|jr|j�dS)Nr�)r�r�r�)r�r6r6r7�__del__�sz_Stream.__del__cCs�|jjd|jj|jj|jjd�|_tjdtt	j	���}|j
d|d�|jjd�rf|jdd
�|_|j
|jj
dd	�t�dS)N�	rz<Ls�s�z.gz�z
iso-8859-1�replace���)r�ZcompressobjZDEFLATED�	MAX_WBITSZ
DEF_MEM_LEVELr�rS�packrF�time�_Stream__writer��endswithr/r1)r�Z	timestampr6r6r7r��sz_Stream._init_write_gzcCsR|jdkr|jj||j�|_|jt|�7_|jdkrD|jj|�}|j|�dS)Nr�r�)	r�r�r�r�r�r0r��compressr�)r�r2r6r6r7r[�s

z
_Stream.writecCsR|j|7_x>t|j�|jkrL|jj|jd|j��|j|jd�|_qWdS)N)rTr0r_r�r[)r�r2r6r6r7Z__write�sz_Stream.__writecCs�|jr
dSd|_z�|jdkr:|jdkr:|j|jj�7_|jdkr�|jr�|jj|j�d|_|jdkr�|jjtj	d|j
��|jjtj	d|jd@��Wd|js�|jj
�XdS)NTrzr�r�r�z<Ll��)r�rhr�rTr��flushr�r[rSr�r�r�r�r�)r�r6r6r7r��s
z
_Stream.closecCs�|jj|jj�|_d|_|jd�dkr0td��|jd�dkrFtd��t|jd��}|jd�|d	@r�t|jd��d
t|jd��}|j	|�|d@r�x|jd�}|s�|t
kr�Pq�W|d@r�x|jd�}|s�|t
kr�Pq�W|d@r�|jd�dS)
Nr�r$s�znot a gzip filer#�zunsupported compression method��rAr@rV)r�Z
decompressobjr�r�r��
_Stream__readrr�ordrZr1)r��flagZxlenr2r6r6r7r��s.
 


z_Stream._init_read_gzcCs|jS)N)r�)r�r6r6r7�tellsz_Stream.tellrcCs\||jdkrNt||j|j�\}}xt|�D]}|j|j�q.W|j|�ntd��|jS)Nrz seeking backwards is not allowed)r�rYr_rErZr	)r�r�r`rarJr6r6r7�seeksz_Stream.seekNcCsZ|dkr:g}x |j|j�}|s P|j|�qWdj|�}n
|j|�}|jt|�7_|S)Nr�)�_readr_�append�joinr�r0)r�r'�trTr6r6r7rZs
z_Stream.readcCs�|jdkr|j|�St|j�}|jg}xd||kr�|j|j�}|sBPy|jj|�}Wn|jk
rptd��YnX|j	|�|t|�7}q(Wdj
|�}||d�|_|d|�S)Nr�zinvalid compressed datar�)r�r�r0r�r_r�Z
decompressr^rr�r�)r�r'�cr�rTr6r6r7r�*s"





z
_Stream._readcCsnt|j�}|jg}x6||krH|jj|j�}|s0P|j|�|t|�7}qWdj|�}||d�|_|d|�S)Nr�)r0rTr�rZr_r�r�)r�r'r�r�rTr6r6r7Z__read@s



z_Stream.__read)r)N)rqrrrsr�r�r�r[r�r�r�r�r�rZr�r�r6r6r6r7r�[sF
	

r�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
r�cCs||_|jjt�|_dS)N)r�rZ�	BLOCKSIZErT)r�r�r6r6r7r�Vsz_StreamProxy.__init__cCs|jj|_|jS)N)r�rZrT)r�r'r6r6r7rZZs
z_StreamProxy.readcCsP|jjd�rdS|jdd�dkr8|jdd�dkr8d	S|jjd�rHdSd
SdS)Ns�r�rr�sBZhr��
s1AY&SYr��]���7zXZr�r�)r�r�)rT�
startswith)r�r6r6r7r�^s$z_StreamProxy.getcomptypecCs|jj�dS)N)r�r�)r�r6r6r7r�hsz_StreamProxy.closeN)rqrrrsr�rZr�r�r6r6r6r7r�Qs
r�c@sfeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Ze	j
fdd�Zddd�Zdd�Z
dd�ZdS)�_FileInFileNcCs�||_||_||_d|_t|dd�|_d|_|dkr>d|fg}d|_g|_d}|j}xT|D]L\}}||kr~|jj	d||df�|jj	d||||f�||7}||}qZW||jkr�|jj	d||jdf�dS)Nrr�FT)
r��offsetr'�positionrlr�r��	map_index�mapr�)r�r�r�r'Z	blockinfoZlastposZrealposr6r6r7r�us(

z_FileInFile.__init__cCsdS)Nr6)r�r6r6r7r��sz_FileInFile.flushcCsdS)NTr6)r�r6r6r7�readable�sz_FileInFile.readablecCsdS)NFr6)r�r6r6r7�writable�sz_FileInFile.writablecCs
|jj�S)N)r��seekable)r�r6r6r7r��sz_FileInFile.seekablecCs|jS)N)r�)r�r6r6r7r��sz_FileInFile.tellcCs�|tjkr tt|d�|j�|_nj|tjkr\|dkrFt|j|d�|_q�t|j||j�|_n.|tjkr�tt|j||j�d�|_ntd��|jS)NrzInvalid argument)	�io�SEEK_SET�min�maxr'r��SEEK_CUR�SEEK_ENDr.)r�r��whencer6r6r7r��s


z_FileInFile.seekc	Cs|dkr|j|j}nt||j|j�}d}x�|dk�rxZ|j|j\}}}}||jkob|knrlPq:|jd7_|jt|j�kr:d|_q:Wt|||j�}|r�|jj||j|�|jj|�}t|�|kr�t	d��||7}n|t
|7}||8}|j|7_q.W|S)Nr�rr#zunexpected end of data)r'r�r�r�r�r0r�r�rZrr1)	r�r'rT�data�start�stopr�r3rbr6r6r7rZ�s.

z_FileInFile.readcCs&|jt|��}||dt|��<t|�S)N)rZr0)r�rbrTr6r6r7�readinto�sz_FileInFile.readintocCs
d|_dS)NT)r�)r�r6r6r7r��sz_FileInFile.close)N)N)rqrrrsr�r�r�r�r�r�r�r�r�rZr�r�r6r6r6r7r�os

r�cseZdZ�fdd�Z�ZS)�ExFileObjectcs&t|j|j|j|j�}t�j|�dS)N)r�r��offset_datar'�sparse�superr�)r��tarfile�tarinfor�)�	__class__r6r7r��s
zExFileObject.__init__)rqrrrsr��
__classcell__r6r6)r�r7r��sr�c@seZdZdS)�FilterErrorN)rqrrrsr6r6r6r7r��sr�cseZdZ�fdd�Z�ZS)�AbsolutePathErrorcs ||_t�jd|j�d��dS)Nzmember z has an absolute path)r�r�r�r�)r�r�)r�r6r7r��szAbsolutePathError.__init__)rqrrrsr�r�r6r6)r�r7r��sr�cseZdZ�fdd�Z�ZS)�OutsideDestinationErrorcs.||_||_t�j|j�d|�d�d�dS)Nz would be extracted to z, z which is outside the destination)r��_pathr�r�r�)r�r�r%)r�r6r7r��sz OutsideDestinationError.__init__)rqrrrsr�r�r6r6)r�r7r��sr�cseZdZ�fdd�Z�ZS)�SpecialFileErrorcs||_t�j|j�d��dS)Nz is a special file)r�r�r�r�)r�r�)r�r6r7r��szSpecialFileError.__init__)rqrrrsr�r�r6r6)r�r7r��sr�cseZdZ�fdd�Z�ZS)�AbsoluteLinkErrorcs||_t�j|j�d��dS)Nz! is a symlink to an absolute path)r�r�r�r�)r�r�)r�r6r7r��szAbsoluteLinkError.__init__)rqrrrsr�r�r6r6)r�r7r��sr�cseZdZ�fdd�Z�ZS)�LinkOutsideDestinationErrorcs.||_||_t�j|j�d|�d�d�dS)Nz would link to z, z which is outside the destination)r�r�r�r�r�)r�r�r%)r�r6r7r��sz$LinkOutsideDestinationError.__init__)rqrrrsr�r�r6r6)r�r7r��sr�cseZdZ�fdd�Z�ZS)�LinkFallbackErrorcs2||_||_t�jd|j�d�d|�d��dS)Nzlink z would be extracted as a zcopy of z, which was rejected)r�r�r�r�r�)r�r�r%)r�r6r7r�szLinkFallbackError.__init__)rqrrrsr�r�r6r6)r�r7r�sr�cCs$i}|j}tjj|tjjd�}|jdtjf�rH|jjdtj�}|d<tjj|�r\t	|��tjjtjj
||�tjjd�}tjj||g�|kr�t||��|j
}|dk	�r|d@}|�r�|j�s�|j�r�|d@s�|dM}|dO}n|j�s�|j�r�d}nt|��||j
k�r||d<|�r |jdk	�r,d|d	<|jdk	�r@d|d
<|jdk	�rTd|d<|jdk	�rhd|d<|j��s||j��r tjj|j��r�t|��tjj|j�}||jk�r�||d
<|j��r�tjj
|tjj|�|j�}ntjj
||j�}tjj|tjjd�}tjj||g�|k�r t||��|S)N)rC�/r�i��@�Ii�rhr)r*r+r,�linknamei����)r�r|r%�realpath�
ALLOW_MISSINGr��sep�lstrip�isabsr�r��
commonpathr�rh�isreg�islnk�isdir�issymr�r)r*r+r,r�r��normpath�dirnamer�)�member�	dest_pathZfor_data�	new_attrsr�Ztarget_pathrhZ
normalizedr6r6r7�_get_filtered_attrssd






r�cCs|S)Nr6)r�r�r6r6r7�fully_trusted_filterTsr�cCs(t||d�}|r$|jf|ddi��S|S)NF�deep)r�r�)r�r�r�r6r6r7�
tar_filterWsr�cCs(t||d�}|r$|jf|ddi��S|S)NTr�F)r�r�)r�r�r�r6r6r7�data_filter]sr�)Z
fully_trustedr�r�s([0-9]{1,20}) c@s�eZdZdlZdmdd�Zdd�Zdd�Zeee�Zdd�Z	dd�Z
ee	e
�Zd d!�Ze
e
e
e
e
e
e
e
d"e
d#�
d$d%�Zd&d'�Zeed(fd)d*�Zd+d,�Zd-d.�Zd/d0�Zed1d2��Zd3d4�Zed5d6��Zed7d8��Zed9d:��Zed;d<��Zed=d>��Zed?d@��ZdAdB�Z dCdD�Z!dEdF�Z"dGdH�Z#dIdJ�Z$dKdL�Z%dMdN�Z&dOdP�Z'dQdR�Z(dSdT�Z)dUdV�Z*dWdX�Z+dYdZ�Z,d[d\�Z-d]d^�Z.d_d`�Z/dadb�Z0dcdd�Z1dedf�Z2dgdh�Z3didj�Z4dkS)nrr�rhr)r*r'r(�chksum�typer�r+r,�devmajor�devminorr�r��pax_headersr�r��_sparse_structs�_link_targetr�cCsj||_d|_d|_d|_d|_d|_d|_t|_d|_	d|_
d|_d|_d|_
d|_d|_d|_i|_dS)Ni�rr�)r�rhr)r*r'r(r��REGTYPEr�r�r+r,r�r�r�r�r�r�)r�r�r6r6r7r��s"zTarInfo.__init__cCs|jS)N)r�)r�r6r6r7�_getpath�szTarInfo._getpathcCs
||_dS)N)r�)r�r�r6r6r7�_setpath�szTarInfo._setpathcCs|jS)N)r�)r�r6r6r7�_getlinkpath�szTarInfo._getlinkpathcCs
||_dS)N)r�)r�r�r6r6r7�_setlinkpath�szTarInfo._setlinkpathcCsd|jj|jt|�fS)Nz<%s %r at %#x>)r�rqr��id)r�r6r6r7�__repr__�szTarInfo.__repr__T)
r�r(rhr�r)r*r+r,r��_KEEPc
Cs�|	rtj|�}n
tj|�}||
k	r(||_||
k	r6||_||
k	rD||_||
k	rR||_||
k	r`||_||
k	rn||_||
k	r|||_||
k	r�||_	|S)N)
�copy�deepcopyr�r(rhr�r)r*r+r,)r�r�r(rhr�r)r*r+r,r�r	�resultr6r6r7r��s(
zTarInfo.replacecCs�|jdkrd}n
|jd@}|j||j|j|j|j|j|j|j|j	|j
|j|jd�
}|dt
kr~|djd�r~|dd7<|S)Ni�)
r�rhr)r*r'r(r�r�r�r+r,r�r�r�r�r�)rhr�r)r*r'r(r�r�r�r+r,r�r��DIRTYPEr�)r�rh�infor6r6r7�get_info�s&


zTarInfo.get_info�surrogateescapecCs~|j�}x(|j�D]\}}|dkrtd|��qW|tkrH|j|||�S|tkr^|j|||�S|tkrr|j||�Std��dS)Nz%s may not be Nonezinvalid format)	r�itemsr.r
�create_ustar_headerr�create_gnu_headerr�create_pax_header)r�rPr4r5rr��valuer6r6r7�tobuf�sz
TarInfo.tobufcCsnt|d<t|dj||��tkr(td��t|dj||��tkr^|j|d||�\|d<|d<|j|t||�S)N�magicr�zlinkname is too longr��prefix)	�POSIX_MAGICr0r/�LENGTH_LINKr.�LENGTH_NAME�_posix_split_name�_create_headerr
)r�rr4r5r6r6r7r�szTarInfo.create_ustar_headercCs�t|d<d}t|dj||��tkr<||j|dt||�7}t|dj||��tkrl||j|dt||�7}||j|t	||�S)Nrr�r�r�)
�	GNU_MAGICr0r/r�_create_gnu_long_header�GNUTYPE_LONGLINKr�GNUTYPE_LONGNAMErr)r�rr4r5rTr6r6r7rszTarInfo.create_gnu_headerc
Cs4t|d<|jj�}x�ddtfddtfddfD]h\}}}||kr@q,y||jd	d
�Wn"tk
rv||||<w,YnXt||�|kr,||||<q,WxldD]d\}}||kr�d||<q�||}d|ko�d|dkn�s�t|t	�r�t
|�||<d||<q�W|�r|j|t|�}	nd}	|	|j
|td	d�S)Nrr�r%r�r&r+� r,rBrCr)r@r*r'�r(rr#r�r�)r+r+r")r,r,r"�r)r@�r*r@�r'r#�r(r#)r$r%r&r')rr�r
rrr/�UnicodeEncodeErrorr0�
isinstance�float�str�_create_pax_generic_header�XHDTYPErr
)
r�rr4r�r�Zhnamer3rO�valrTr6r6r7rs4
.zTarInfo.create_pax_headercCs|j|td�S)Nzutf-8)r,�XGLTYPE)�clsr�r6r6r7�create_pax_global_header?sz TarInfo.create_pax_global_headercCs�|jd�}xltdt|��D]R}dj|d|��}dj||d��}t|j||��tkrt|j||��tkrPqWtd��||fS)Nr�r#zname is too long)�splitrEr0r�r/�
LENGTH_PREFIXrr.)r�r�r4r5Z
componentsrJrr6r6r7rEs
zTarInfo._posix_split_namecCs�|jd�ttfk}|r@t|jdd�d|�}t|jdd�d|�}ntdd||�}tdd||�}|jdt�}|dkrxtd��t|jdd�d	||�t|jd
d�d@d|�t|jdd�d|�t|jd
d�d|�t|jdd�d|�t|jdd�d|�d|t|jdd�d	||�|jdt�t|jdd�d||�t|jdd�d||�t|jdd�d|�t|jdd�d|�t|jdd�d||�g}tj	dt
dj|��}	t|	t
d��d}
|	dd�t
d|
d�|	d d�}	|	S)!Nr�r�rr@r�r�zTarInfo.type must not be Noner�rrhi�r)r*r'r#r(s        r�rr+r"r,rrz%dsr�ilz%06orBiei����i����)�get�CHRTYPE�BLKTYPErQr8rr.rrSr�r�r�rUrL)rrPr4r5Zhas_device_fieldsr�r�Zfiletype�partsrTr�r6r6r7rUs8
&zTarInfo._create_headercCs.tt|�t�\}}|dkr*|t|t7}|S)Nr)rYr0r�r1)Zpayloadr`rar6r6r7�_create_payloadszTarInfo._create_payloadcCsR|j||�t}i}d|d<||d<t|�|d<t|d<|j|t||�|j|�S)Nz
././@LongLinkr�r�r'r)r/r1r0rrr
r8)r0r�r�r4r5rr6r6r7r�szTarInfo._create_gnu_long_headercCs:d}x@|j�D]4\}}y|jdd�Wqtk
r@d}PYqXqWd}|rV|d7}x�|j�D]�\}}|jd�}|r�|j|d�}n
|jd�}t|�t|�d}d	}	}
x"|tt|
��}	|	|
kr�P|	}
q�W|tt|
�d
�d|d|d
7}q`Wi}d|d<||d<t|�|d<t|d<|j|td
d�|j	|�S)NFzutf-8rCTr�s21 hdrcharset=BINARY
rr�rrB� �=�
z././@PaxHeaderr�r�r'rr�)
rr/r(r0r+rLrrr
r8)r0r�r�r4Zbinary�keywordrZrecords�lrIr<rr6r6r7r,�s<

*z"TarInfo._create_pax_generic_headercCstt|�dkrtd��t|�tkr(td��|jt�tkr>td��t|dd��}|t|�krbt	d��|�}t
|dd�||�|_t|dd	��|_t|d	d
��|_
t|d
d��|_t|dd��|_t|dd��|_||_|dd
�|_t
|d
d�||�|_t
|dd�||�|_t
|dd�||�|_t|dd��|_t|dd��|_t
|dd�||�}|jtk�r�|jjd��r�t|_|jtk�r6d}g}xrtd�D]f}	y0t|||d��}
t||d|d��}Wntk
�r�PYnX|j|
|f�|d7}�q�Wt|d�}t|dd��}
|||
f|_ |j!��rN|jj"d�|_|�rp|jt#k�rp|d|j|_|S)Nrzempty headerztruncated headerzend of file header��zbad checksumr�l�t�|��ii	i)iIiQiYi�r�i�r�r#�i�i�i�)$r0rtr�ru�countr1rvrKrUrHr=r�rhr)r*r'r(r�r�r�r+r,r�r��AREGTYPEr�r
�GNUTYPE_SPARSErEr.r��boolrr��rstrip�	GNU_TYPES)r0rTr4r5r��objrr��structsrJr��numbytes�
isextended�origsizer6r6r7�frombuf�sZ
zTarInfo.frombufcCs8|jjt�}|j||j|j�}|jj�t|_|j|�S)N)	r�rZr�rQr4r5r�r��_proc_member)r0r�rTrLr6r6r7�fromtarfileszTarInfo.fromtarfilecCsT|jttfkr|j|�S|jtkr,|j|�S|jtttfkrF|j	|�S|j
|�SdS)N)r�r!r �
_proc_gnulongrH�_proc_sparser-r/�SOLARIS_XHDTYPE�	_proc_pax�
_proc_builtin)r�r�r6r6r7rR!s



zTarInfo._proc_membercCsR|jj�|_|j}|j�s$|jtkr4||j|j�7}||_|j	|j
|j|j�|S)N)
r�r�r�r�r��SUPPORTED_TYPES�_blockr'r��_apply_pax_infor�r4r5)r�r�r�r6r6r7rX.szTarInfo._proc_builtincCs�|jj|j|j��}y|j|�}Wntk
r>td��YnX|j|_|jt	krft
||j|j�|_
n|jtkr�t
||j|j�|_|S)Nz missing or bad subsequent header)r�rZrZr'rSrrwr�r�r!r=r4r5r�r r�)r�r�rT�nextr6r6r7rT?s

zTarInfo._proc_gnulongc
Cs�|j\}}}|`x�|r�|jjt�}d}xvtd�D]j}y0t|||d��}t||d|d��}	Wntk
rzPYnX|r�|	r�|j||	f�|d7}q0Wt|d�}qW||_	|jj
�|_|j|j|j
�|_||_
|S)Nr�r#rEi�)rr�rZr�rErKr.r�rIr�r�r�rZr'r�)
r�r�rMrOrPrTr�rJr�rNr6r6r7rUUs(zTarInfo._proc_sparsecCs�|jj|j|j��}|jtkr&|j}n
|jj�}d}d}g}�x0t|�|koV||dk�rnt	j
||�}|srtd��yt|j
d��}Wntk
r�td��YnX|dkr�td��||t|�kr�td��|jd�|d}	||jd�d|	�}
|
jd�\}}}
|�s"|dk�s"||	dk�r*td��|j|||
f�|dk�rd|dk�rd|
dk�r`|j}nd	}||7}q@W|dk�r~d	}x`|D]X\}}}
|j|d	d	|j�}|tk�r�|j|
||j|j�}n|j|
d	d	|j�}|||<�q�Wy|j|�}Wntk
�rtd
��YnXd|k�r&|j||�nFd|k�r>|j||�n.|jd
�dk�rl|jd�dk�rl|j|||�|jttfk�r�|j ||j|j�|j!|_!d|k�r�|j"}|j#��s�|jt$k�r�||j|j�7}||_!|S)Nrzinvalid headerr#�r:r�s
hdrcharsetsBINARYzutf-8z missing or bad subsequent headerzGNU.sparse.mapzGNU.sparse.sizezGNU.sparse.major�1zGNU.sparse.minorrDr')%r�rZrZr'r�r/r�r
r0�_header_length_prefix_re�matchrHrF�groupr.r�rk�	partitionr�r4�_decode_pax_fieldr5�PAX_NAME_FIELDSrSrrw�_proc_gnusparse_01�_proc_gnusparse_00r4�_proc_gnusparse_10r-rVr[r�r�r�rY)r�r�rTr�r�r4�raw_headersrar3Zheader_value_end_offsetZkeyword_and_valueZraw_keywordZequalsZ	raw_valuer<rr\r�r6r6r7rWqsx

 







 
zTarInfo._proc_paxcCs�g}g}x�|D]�\}}}|dkrVy|jt|j���Wq�tk
rRtd��Yq�Xq|dkry|jt|j���Wqtk
r�td��YqXqWtt||��|_dS)NsGNU.sparse.offsetzinvalid headersGNU.sparse.numbytes)r�rFr;r.rH�list�zipr�)r�r\riZoffsetsrN�_r<rr6r6r7rg�szTarInfo._proc_gnusparse_00cCs@dd�|djd�D�}tt|ddd�|ddd���|_dS)NcSsg|]}t|��qSr6)rF)�.0�xr6r6r7�
<listcomp>sz.TarInfo._proc_gnusparse_01.<locals>.<listcomp>zGNU.sparse.map�,r$r#)r2rjrkr�)r�r\r�r�r6r6r7rf�szTarInfo._proc_gnusparse_01cCs�d}g}|jjt�}|jdd�\}}t|�}xJt|�|dkrvd|krV||jjt�7}|jdd�\}}|jt|��q.W|jj�|_t	t
|ddd�|ddd���|_dS)Nr;r#r$)r�rZr�r2rFr0r�r�r�rjrkr�)r�r\r�r�Zfieldsr�rTZnumberr6r6r7rhszTarInfo._proc_gnusparse_10c
Cs�x�|j�D]�\}}|dkr(t|d|�q
|dkrBt|dt|��q
|dkr\t|dt|��q
|tkr
|tkr�yt||�}Wntk
r�d}YnX|dkr�|jd�}t|||�q
W|j�|_dS)NzGNU.sparse.namer%zGNU.sparse.sizer'zGNU.sparse.realsizerr�)	r�setattrrF�
PAX_FIELDS�PAX_NUMBER_FIELDSr.rJr
r�)r�r�r4r5r<rr6r6r7r[s"

zTarInfo._apply_pax_infocCs.y|j|d�Stk
r(|j||�SXdS)NrC)r;�UnicodeDecodeError)r�rr4Zfallback_encodingZfallback_errorsr6r6r7rd,szTarInfo._decode_pax_fieldcCs"t|t�\}}|r|d7}|tS)Nr#)rYr�)r�rFr`rar6r6r7rZ4szTarInfo._blockcCs
|jtkS)N)r��
REGULAR_TYPES)r�r6r6r7r�=sz
TarInfo.isregcCs|j�S)N)r�)r�r6r6r7�isfile?szTarInfo.isfilecCs
|jtkS)N)r�r
)r�r6r6r7r�Asz
TarInfo.isdircCs
|jtkS)N)r��SYMTYPE)r�r6r6r7r�Csz
TarInfo.issymcCs
|jtkS)N)r��LNKTYPE)r�r6r6r7r�Esz
TarInfo.islnkcCs
|jtkS)N)r�r5)r�r6r6r7�ischrGsz
TarInfo.ischrcCs
|jtkS)N)r�r6)r�r6r6r7�isblkIsz
TarInfo.isblkcCs
|jtkS)N)r��FIFOTYPE)r�r6r6r7�isfifoKszTarInfo.isfifocCs
|jdk	S)N)r�)r�r6r6r7�issparseMszTarInfo.issparsecCs|jtttfkS)N)r�r5r6r{)r�r6r6r7�isdevOsz
TarInfo.isdevN)r�rhr)r*r'r(r�r�r�r+r,r�r�r�r�r�r�r�rr)r�)5rqrrrs�	__slots__r�rr�propertyr%rrr&rr	r�rrrrrrr�classmethodr1r�staticmethodrr8rr,rQrSrRrXrTrUrWrgrfrhr[rdrZr�rvr�r�r�ryrzr|r}r~r6r6r6r7rssd



1*
3?
z	c
@s�eZdZdZdZdZdZeZe	Z
dZeZ
eZdZdjdd�Zedddefd	d
��Zedkdd��Zedldd��Zedmdd��Zedndd��Zddddd�Zdd�Zdd�Zdd�Zdd �Zdod!d"�Zdpdd$�d%d&�Zdqdd'�d(d)�Z drd*d+�Z!d,d-�Z"dsddd/�d0d1�Z#d2d3�Z$dtddd/�d5d6�Z%d7d8�Z&dud9d:�Z'd;d<�Z(d=d>�Z)d?d@�Z*dvdddA�dBdC�Z+dDdE�Z,dFdG�Z-dHdI�Z.dJdK�Z/dLdM�Z0dNdO�Z1dPdQ�Z2dRdS�Z3dTdU�Z4dVdW�Z5dXdY�Z6dwdZd[�Z7d\d]�Z8dxd^d_�Z9d`da�Z:dbdc�Z;ddde�Z<dfdg�Z=dhdi�Z>dS)yrrFr#NryrcCs�ddddd�}||krtd��||_|||_|sj|jdkrVtjj|�rVd|_d|_t||j�}d	|_n@|dkr�t|d
�r�t	|j
ttf�r�|j
}t|d�r�|j|_d|_|r�tjj
|�nd|_
||_|dk	r�||_|dk	r�||_|dk	r�||_|dk	�r||_|dk	�r||_|	|_|
dk	�r4|jtk�r4|
|_ni|_|dk	�rJ||_|dk	�rZ||_|
|_d	|_g|_d	|_|jj�|_i|_�y�|jd
k�r�d|_ |j!�|_ |jdk�r8x�|jj"|j�y|jj#|�}|jj$|�WnTt%k
�r|jj"|j�PYn0t&k
�r0}zt't|���WYdd}~XnX�q�W|jdk�r�d|_|j�r�|jj(|jj)��}|jj*|�|jt+|�7_Wn&|j�s�|jj,�d|_�YnXdS)N�rbzr+b�wbZxb)ry�arzrnz!mode must be 'r', 'a', 'w' or 'x'r�rzFr�rhTryrn)r�rzrn)-r.rh�_moder|r%�exists�	bltn_openr�r�r)r�r+rL�abspathr�rPr��dereference�ignore_zerosr4r5rr��debug�
errorlevel�copybufsizer��members�_loadedr�r��inodes�firstmemberr\r�rSr�rvrrr1r
r[r0r�)r�r�rhr�rPr�r�r�r4r5r�r�r�r�Zmodes�erTr6r6r7r�os�






$
zTarFile.__init__c

s�|r|rtd��|dkr��fdd�}xtt�j|d�D]b}t��j|�}|dk	r\|j�}	y||d|f|�Sttfk
r�|dk	r�|j|	�w8Yq8Xq8Wtd���nd|k�r|jdd	�\}
}|
p�d}
|p�d
}|�jkr�t��j|�}ntd|��|||
|f|�Sd|k�r�|jdd	�\}
}|
�p.d}
|�p8d
}|
dk�rLtd��t	||
|||�}y�||
|f|�}Wn|j
��YnXd|_|S|dk�r��j|||f|�Std��dS)Nznothing to openry�r:*cs�j|dkS)N�taropen)�	OPEN_METH)r�)r0r6r7�not_compressedsz$TarFile.open.<locals>.not_compressed)�keyz%file could not be opened successfully�:r#r�zunknown compression type %r�|rzzmode must be 'r' or 'w'Fr�rnzundiscernible mode)ryr�)ryrz)r�rzrn)
r.�sortedr�rlr�rrr�r2r�r�r�r�)
r0r�rhr�r_�kwargsr�r��funcZ	saved_posrg�streamr�r6)r0r7r�sP%







zTarFile.opencKs |dkrtd��||||f|�S)Nryr�rzrnz!mode must be 'r', 'a', 'w' or 'x')ryr�rzrn)r.)r0r�rhr�r�r6r6r7r�9szTarFile.taropenr�cKs�|d
krtd��yddl}|jWn ttfk
rBtd��YnXy|j||d||�}Wn.tk
r�|dk	r�|dkr�td���YnXy|j|||f|�}WnBtk
r�|j	�|dkr�td���Yn|j	��YnXd	|_
|S)Nryrzrnzmode must be 'r', 'w' or 'x'rzgzip module is not availablerbznot a gzip fileF)ryrzrn)r.�gzipZGzipFiler��AttributeErrorrr�rr�r�r�)r0r�rhr��
compresslevelr�r�r�r6r6r7�gzopenAs2
zTarFile.gzopencKs�|d
krtd��yddl}Wntk
r8td��YnX|j|pD|||d�}y|j|||f|�}WnFttfk
r�|j�|dkr�t	d���Yn|j��YnXd	|_
|S)Nryrzrnzmode must be 'r', 'w' or 'x'rzbz2 module is not available)r�znot a bzip2 fileF)ryrzrn)r.r�r�rZBZ2Filer�r��EOFErrorr�rr�)r0r�rhr�r�r�r�r�r6r6r7�bz2opencs(zTarFile.bz2opencKs�|d
krtd��yddl}Wntk
r8td��YnX|j|pD|||d�}y|j|||f|�}WnH|jtfk
r�|j�|dkr�t	d���Yn|j��YnXd	|_
|S)Nryrzrnzmode must be 'r', 'w' or 'x'rzlzma module is not available)�presetznot an lzma fileF)ryrzrn)r.r�r�rZLZMAFiler�r�r�r�rr�)r0r�rhr�r�r�r�r�r6r6r7�xzopen�s&zTarFile.xzopenr�r�r�r�)r�r�r�r�c
Cs�|jr
dSd|_z`|jdkrn|jjttd�|jtd7_t|jt�\}}|dkrn|jjtt|�Wd|j	s�|jj
�XdS)NTr�rzrnr$r)r�rzrn)r�rhr�r[r1r�r�rY�
RECORDSIZEr�r�)r�r`rar6r6r7r��s
z
TarFile.closecCs"|j|�}|dkrtd|��|S)Nzfilename %r not found)�
_getmember�KeyError)r�r�r�r6r6r7�	getmember�s
zTarFile.getmembercCs|j�|js|j�|jS)N)�_checkr��_loadr�)r�r6r6r7�
getmembers�szTarFile.getmemberscCsdd�|j�D�S)NcSsg|]
}|j�qSr6)r�)rmr�r6r6r7ro�sz$TarFile.getnames.<locals>.<listcomp>)r�)r�r6r6r7�getnames�szTarFile.getnamescCsp|jd�|dk	r|j}|dkr$|}tjj|�\}}|jtjd�}|jd�}|j�}||_	|dkr�t
td�r�|jr�tj|�}q�tj
|�}ntj|j��}d}|j}t
j|��r|j|jf}	|jr�|jdkr�|	|jkr�||j|	kr�t}
|j|	}nt}
|	d�rx||j|	<nht
j|��r"t}
nVt
j|��r4t}
nDt
j|��rPt}
tj|�}n(t
j|��rbt }
nt
j!|��rtt"}
ndS||_||_#|j$|_%|j&|_'|
tk�r�|j(|_)nd|_)|j*|_+|
|_,||_-t.�r�yt.j/|j%�d|_0Wnt1k
�r�YnXt2�r*yt2j3|j'�d|_4Wnt1k
�r(YnX|
t t"fk�rlt
td��rlt
td��rltj5|j6�|_7tj8|j6�|_9|S)	N�awxr��lstatr�r#r�major�minor):r�r�r|r%�
splitdriver�r�r�r�r�r�r�r�rf�fstat�fileno�st_mode�S_ISREG�st_ino�st_dev�st_nlinkr�rxr�S_ISDIRr
�S_ISFIFOr{�S_ISLNKrw�readlink�S_ISCHRr5�S_ISBLKr6rh�st_uidr)�st_gidr*�st_sizer'�st_mtimer(r�r��pwd�getpwuidr+r��grpZgetgrgidr,r��st_rdevr�r�r�)r�r��arcnamer�Zdrvr�Zstatresr�Zstmd�inoder�r6r6r7�
gettarinfo�s~	




zTarFile.gettarinfoT)r�cCs0|j�|dkr|}�x|D�]
}|r�|jdkr:td�nttj|j��td|jpX|j|jpb|jf�|j	�sz|j
�r�tdd|j|jf�ntd|j
�|jdkr�td�ntdtj|j�dd��t|j|j�r�d	nd
�|�r"|j��r
td|j�|j��r"td|j�t�qWdS)
Nz
??????????z%s/%sz%10sz%d,%dz%10dz????-??-?? ??:??:??z%d-%02d-%02d %02d:%02d:%02dr�r�r�z-> zlink to )r�rhrprfrgr+r)r,r*ryrzr�r�r'r(r�Z	localtimer�r�r�r�r�ro)r��verboser�r�r6r6r7rj;s2





zTarFile.list)�filterc	
Csv|jd�|dkr|}|dk	rPddl}|jdtd�||�rP|jdd|�dS|jdk	r�tjj|�|jkr�|jdd|�dS|jd|�|j	||�}|dkr�|jdd|�dS|dk	r�||�}|dkr�|jdd|�dS|j
��rt|d	��}|j||�WdQRXnd|j
��rh|j|�|�rrxHtj|�D].}|jtjj||�tjj||�|||d
��q4Wn
|j|�dS)Nr�rzuse the filter argument insteadr$ztarfile: Excluded %rztarfile: Skipped %rr#ztarfile: Unsupported type %rr�)r�)r�rcrdre�_dbgr�r|r%r�r�r�r��addfiler��listdir�addr�)	r�r�r��	recursiveZexcluder�rcr��fr6r6r7r�asB



zTarFile.addcCs�|jd�tj|�}|j|j|j|j�}|jj|�|jt	|�7_|j
}|dk	r�t||j|j|d�t
|jt�\}}|dkr�|jjtt|�|d7}|j|t7_|jj|�dS)Nr�)r_rr#)r�r
rrPr4r5r�r[r�r0r�rXr'rYr�r1r�r�)r�r�r�rTr_r`rar6r6r7r��s

zTarFile.addfilec"CsH|dk�r|j}|dk�r�tjjd�}|dkr�ytt�}Wntk
rNYnBXddl}|jddd�}|�|j	|�WdQRX|jdddd�}|r�yt
|}Wn&tk
r�td|�d	��d�YnX||_|St
�r�tjdt�tStSt|t��rtd��|St|��r|Syt
|Stk
�rBtd|�d	��d�YnXdS)NZ PYTHON_TARFILE_EXTRACTION_FILTERr�#)Z
interpolationZcomment_prefixesr�r�)Zfallbackzfilter z
 not foundz4The default behavior of tarfile extraction has been z$changed to disallow common exploits z(including CVE-2007-4559). z1By default, absolute/parent paths are disallowed z and some mode bits are cleared. z/See https://access.redhat.com/articles/7004769 zfor more details.z#String names are not supported for z2TarFile.extraction_filter. Use a function such as ztarfile.data_filter directly.)r�zXThe default behavior of tarfile extraction has been changed to disallow common exploits zsThe default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). z�The default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed z�The default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. z�The default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. See https://access.redhat.com/articles/7004769 aThe default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. See https://access.redhat.com/articles/7004769 for more details.zUString names are not supported for TarFile.extraction_filter. Use a function such as zrString names are not supported for TarFile.extraction_filter. Use a function such as tarfile.data_filter directly.)�extraction_filterr|�environr4r��_CONFIG_FILENAME�FileNotFoundError�configparserZConfigParserZ	read_file�_NAMED_FILTERSr�r.�_RH_SAFER_DEFAULTrcrd�RuntimeWarningr�r�r)r+�	TypeError�callable)r�r�r��filer�Zconfr6r6r7�_get_filter_function�sR


zTarFile._get_filter_function�.)�
numeric_ownerr�c"Cs�g}|j|�}|dkr|}xT|D]L}|j|||�\}}	|dkr@q |j�rR|j|	�|j|||j�||d�q W|jdd�dd��x$|D�]}	y�y||	|�}Wn4tk
r�}
z|j|	t|
��w�WYdd}
~
XnX|dkr�|j|	d�w�t	j
j||j�}yt	j
|�}Wn$tk
�r.|j|d�w�YnXtj|j��sL|j|d�w�|j|||d	�|j||�|j||�Wq�tk
�r�}
z|j|
�WYdd}
~
Xq�Xq�WdS)
N)�	set_attrsr��filter_functioncSs|jS)N)r�)r�r6r6r7�<lambda>	sz$TarFile.extractall.<locals>.<lambda>T)r��reversezexcluded by filterZmissingznot a directory)r�)r��_get_extract_tarinfor�r��_extract_one�sort�_FILTER_ERRORS�_log_no_directory_fixup�reprr|r%r�r�r�r�rfr�r��chown�utime�chmodr
�_handle_nonfatal_error)r�r%r�r�r�Zdirectoriesr�r�r��
unfiltered�exc�dirpathr�r�r6r6r7�
extractall�sP


zTarFile.extractallcCs|jdd|j|f�dS)Nr$z(tarfile: Not fixing up directory %r (%s))r�r�)r�r��reasonr6r6r7r�1	szTarFile._log_no_directory_fixupr�c	Cs8|j|�}|j|||�\}}|dk	r4|j||||�dS)N)r�r�r�)	r�r�r%r�r�r�r�r�r�r6r6r7�extract5	s

zTarFile.extractcCs�t|t�r|j|�}n|}d}y|||�}WnZttfk
r\}z|j|�WYdd}~Xn,tk
r�}z|j|�WYdd}~XnX|dkr�|jdd|j	�dS|j
�r�tj|�}tj
j||j�|_||fS)Nr$ztarfile: Excluded %r)NN)r)r+r�r�r��_handle_fatal_errorr
r�r�r�r�r
r|r%r�r�r)r�r�r�r%r��filteredr�r6r6r7r�I	s"

zTarFile._get_extract_tarinfocCs�|jd�y&|j|tjj||j�||||d�WnVtk
r\}z|j|�WYdd}~Xn,tk
r�}z|j	|�WYdd}~XnXdS)Nry)r�r�r��extraction_root)
r��_extract_memberr|r%r�r�r�r�r
r�)r�r�r%r�r�r�r�r6r6r7r�g	s
zTarFile._extract_onecCs"|jdkr�n|jdd|�dS)Nr#ztarfile: %s)r�r�)r�r�r6r6r7r�{	s
zTarFile._handle_nonfatal_errorcCsn|jdkr�n\t|t�rP|jdkr6|jdd|j�qj|jdd|j|jf�n|jddt|�j|f�dS)Nrr#ztarfile: %sztarfile: %s %rztarfile: %s %s)r�r)r��filenamer��strerrorr�rq)r�r�r6r6r7r��	s


zTarFile._handle_fatal_errorcCs�|jd�t|t�r |j|�}n|}|j�s6|jtkrB|j||�S|j�sR|j	�rzt|j
t�rhtd��q~|j
|j|��SndSdS)Nryz'cannot extract (sym)link as file object)r�r)r+r�r�r�rY�
fileobjectr�r�r�r�r	�extractfile�_find_link_target)r�r�r�r6r6r7r��	s


zTarFile.extractfile)r�r�cCs\|jd�}|jdtj�}tjj|�}|r@tjj|�r@tj|�|j�sP|j	�rj|j
dd|j|jf�n|j
d|j�|j
�r�|j||�n�|j�r�|j||�n~|j�r�|j||�nh|j�s�|j�r�|j||�nJ|j�s�|j	�r�|j||||d�n&|jtk�r|j||�n|j||�|�rX|j|||�|j	��sX|j||�|j||�dS)Nr�r#z%s -> %s)r�r�)rJr�r|r�r%r�r��makedirsr�r�r�r�r�r��makefiler��makedirr|�makefiforyrz�makedev�makelink_with_filterr�rY�makeunknownr�r�r�)r�r��
targetpathr�r�r�r�Z	upperdirsr6r6r7r��	s:



zTarFile._extract_membercCs@y&|jdkrtj|�ntj|d�Wntk
r:YnXdS)Ni�)rhr|�mkdir�FileExistsError)r�r�rr6r6r7r�	s
zTarFile.makedircCs�|j}|j|j�|j}t|d��f}|jdk	rrx,|jD]"\}}|j|�t|||t|�q6W|j|j�|j	�nt|||jt|�WdQRXdS)Nr�)
r�r�r�r�r�r�rXrr'�truncate)r�r�r�sourcer_�targetr�r'r6r6r7r�	s


zTarFile.makefilecCs"|j||�|jdd|j�dS)Nr#z9tarfile: Unknown file type %r, extracted as regular file.)rr�r�)r�r�rr6r6r7r
szTarFile.makeunknowncCs"ttd�rtj|�ntd��dS)N�mkfifozfifo not supported by system)r�r|r
r
)r�r�rr6r6r7r
s
zTarFile.makefifocCsnttd�sttd�r td��|j}|dkr2d}|j�rF|tjO}n
|tjO}tj||tj	|j
|j��dS)N�mknodrz'special devices not supported by systemi�)r�r|r
rhrzrf�S_IFBLK�S_IFCHRrrr�r�)r�r�rrhr6r6r7r
s
zTarFile.makedevcCs|j||dd�S)N)r)r�r�rr6r6r7�makelink%
szTarFile.makelinkc	$Cs&d}yT|j�r6tjj|�r$tj|�tj|j|�dStjj|j�rVtj	|j|�dSWnt
k
rpd}YnXy|j|�}Wn$tk
r�|r�t
d��n�YnX|dkr�|}nR|dkr�t
d��y|||�}Wn2tk
�r}zt||j�|�WYdd}~XnX|dk	�r"|j||||d�dS)NFTz%unable to resolve link inside archivez6makelink_with_filter: if filter_function is not None, z%extraction_root must also not be None)r�r�z[makelink_with_filter: if filter_function is not None, extraction_root must also not be None)r�r|r%�lexists�unlink�symlinkr�r�r�link�symlink_exceptionr�r�r
r�r�r�r�)	r�r�rr�r�Zkeyerror_to_extracterrorr�r��causer6r6r7r(
sB	

 
zTarFile.makelink_with_filtercCs�ttd�r�tj�dkr�|j}|j}|s�ytrB|jrBtj|j�d}Wntk
rXYnXyt	rv|j
rvt	j|j
�d}Wntk
r�YnX|dkr�d}|dkr�d}y4|j�r�ttd�r�tj
|||�ntj|||�Wntk
r�td��YnXdS)	N�geteuidrr$r#�lchownzcould not change ownerr9r9)r�r|rr*r)r�r,Zgetgrnamr�r�r+�getpwnamr�rr�r�r
)r�r�rr��g�ur6r6r7r�Z
s0

z
TarFile.chowncCsL|jdkrdSttd�rHytj||j�Wntk
rFtd��YnXdS)Nr�zcould not change mode)rhr�r|r�r�r
)r�r�rr6r6r7r�{
s

z
TarFile.chmodcCsV|j}|dkrdSttd�s dSytj|||f�Wntk
rPtd��YnXdS)Nr�z"could not change modification time)r(r�r|r�r�r
)r�r�rr(r6r6r7r��
s
z
TarFile.utimecCs�|jd�|jdk	r$|j}d|_|S|j|jj�krZ|jj|jd�|jjd�sZtd��d}�xby|jj	|�}W�nHt
k
r�}z2|jr�|jdd|j|f�|jt
7_wbWYdd}~Xn�tk
�r,}zN|j�r|jdd|j|f�|jt
7_wbn|jdk�rtt|���WYdd}~Xn�tk
�rT|jdk�rPtd��Ynjtk
�r�}z|jdk�r~tt|���WYdd}~Xn0tk
�r�}ztt|���WYdd}~XnXPqbW|dk	�r�|jj|�nd|_|S)	NZrar#zunexpected end of datar$z0x%X: %srz
empty fileT)r�r�r�r�r�r�rZrr�rSrvr�r�r�rHr+rtrurwr�r�r�)r��mr�r�r6r6r7r\�
sL


zTarFile.nextc	Cs�|j�}d}|dk	rHy|j|�}Wntk
r:d}YnX|d|�}|rXtjj|�}xLt|�D]@}|r||j|jkrbd}qb|r�tjj|j�}n|j}||krb|SqbW|r�t|��dS)NFT)	r��indexr.r|r%r��reversedr�r�)	r�r�r��	normalizer�Zskippingrr��member_namer6r6r7r��
s,
zTarFile._getmembercCs"x|j�}|dkrPqWd|_dS)NT)r\r�)r�r�r6r6r7r��
s
z
TarFile._loadcCs:|jrtd|jj��|dk	r6|j|kr6td|j��dS)Nz%s is closedzbad operation for mode %r)r�r�r�rqrh)r�rhr6r6r7r��
szTarFile._checkcCs`|j�r.djtdtjj|j�|jf��}d}n
|j}|}|j||dd�}|dkr\t	d|��|S)Nr�T)r�r zlinkname %r not found)
r�r�r�r|r%r�r�r�r�r�)r�r�r��limitr�r6r6r7r�s zTarFile._find_link_targetccs�|jr|jEdHdSd}|jdk	r:|j�}|d7}|VxN|t|j�krV|j|}n"|jst|j�}|sxd|_dSndS|d7}|Vq<WdS)Nrr#T)r�r�r�r\r0)r�rr�r6r6r7�__iter__s&
zTarFile.__iter__cCs||jkrt|tjd�dS)N)r�)r�rorm�stderr)r��level�msgr6r6r7r�7s
zTarFile._dbgcCs|j�|S)N)r�)r�r6r6r7�	__enter__=szTarFile.__enter__cCs,|dkr|j�n|js"|jj�d|_dS)NT)r�r�r�r�)r�r�r�	tracebackr6r6r7�__exit__As


zTarFile.__exit__)
NryNNNNNNrNNNN)ryN)ryNr�)ryNr�)ryNN)NNN)T)NTN)N)r�N)r�T)N)TF)NF)N)?rqrrrsr�r�r�r�rrPrr4r5rr�r�r�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�rjr�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrr�r�r�r\r�r�r�r�r#r�r'r)r6r6r6r7rSs�
lZ!

d&=
5D
62!6
(

	cCs.yt|�}|j�dStk
r(dSXdS)NTF)rr�r)r�r�r6r6r7rOscCsddl}d}|j|d�}|jdddddd	�|jd
dtdd
�|j�}|jddddd�|jdddd5dd�|jdddd6dd�|jdddd d�|j�}|jr�|jr�|jd!d"�|j	�r*|j	}t
|��rt|d#�� }|j�t
|j�tjd$�WdQRX|j�r&t
d%j|��n|jd!d&j|���n�|j�r�|j}t
|��rjtj|d'��}|j|jd(�WdQRXn|jd!d&j|���n�|j�rPt|j�d!k�r�|jd}tj}n,t|j�d)k�r�|j\}}n|jd!|j��t
|��r<tj|d'��}|j||jd*�WdQRX|j�rN|d+k�r&d,j|�}	nd-j||�}	t
|	�n|jd!d&j|��n�|j�r�|jjd�}
tjj|
�\}}d.d.d/d/d0d0d0d0d1�}
||
k�r�d2|
|nd3}|j}tj|
|�� }x|D]}|j|��q�WWdQRX|j�rt
d4j|
��n|jd!|j��dS)7Nrz3A simple command line interface for tarfile module.)�descriptionz-vz	--verbose�
store_trueFzVerbose output)�action�default�helpz--filterz<filtername>zFilter for extraction)�metavar�choicesr.z-lz--list�	<tarfile>zShow listing of a tarfile)r/r.z-ez	--extract�+�<output_dir>zExtract tarfile into target dir)�nargsr/r.z-cz--create�<name>�<file>zCreate tarfile from sourcesz-tz--testzTest if a tarfile is validr#z&--filter is only valid for extraction
ry)r�z{!r} is a tar archive.z{!r} is not a tar archive.
zr:*)r�r$)r%r�r�z{!r} file is extracted.z+{!r} file is extracted into {!r} directory.r�r�r�)z.gzz.tgzz.xzz.txzz.bz2z.tbzz.tbz2z.tb2zw:rzz{!r} file created.)r1r3)r5r6)�argparse�ArgumentParser�add_argumentr�Zadd_mutually_exclusive_group�
parse_argsr�r��exitZtestrrr�rormr$r�rPrjrr0r|�curdirZformat_helpr�Zcreate�popr%�splitextr�)r7r*�parserrb�argsr\r�Ztfr<r&Ztar_namerlZextZcompressionsZtar_modeZ	tar_files�	file_namer6r6r7�main]s�










rB�__main__)r%r&r'r(r)r*r+r,)T)s�version�
__author__Z__date__Z	__cvsid__�__credits__�builtinsrr�rmr|r�rWrfr�rSr
�rercr�r�r�r��NotImplementedErrorrr��	NameError�__all__r�r�r1r�r�rrrrr3rrGrxrwr5r6r
r{ZCONTTYPEr!r rHr-r/rVr
rrrrYrurKrrrer*rFrsr�r�getfilesystemencodingr8r=rKrQrUrXrgrp�	Exceptionrr
rrr	rrtrurvrHrwrxr��objectr�r��BufferedReaderr�r�r�r�r�r�r�r�r�r�r�r�r�r�r	�compiler`rrrrBrqr6r6r6r7�<module> s$



wh



D
eb
platform.cpython-36.pyc000064400000067751150335715140011042 0ustar003

�\dhn��@sBdZdZdZddlZddlZddlZddlZddlZddlZy
ej	Z
Wn(ek
rnejd�krfdZ
nd	Z
YnXd
Z
dddd
d
dddddd�
Zejd�Zdd�Zejdej�Zejdddfdd�Zdd�Zejdej�Zejdej�Zejdej�Zd�Zd/d0�Zddded1fd2d3�Zd4d5�Zdddefd6d7�Zd�d9d:�Zd�d;d<�Z ejd=�Z!d�d>d?�Z"d�dAd�dBd�dDd�dEd�dGd�dHd�dId�dKd�dLd�dMd�dNiZ#d�dDd�dOd�dPd�dQd�dRd�dSiZ$d�dTdU�Z%dVdW�Z&d�dXdY�Z'dZd[�Z(d�d\d]�Z)d^d_�Z*d`da�Z+d�dbdc�Z,ddde�Z-d�dfdg�Z.d�dhdi�Z/d�d�d�dm�Z0ejddfdndo�Z1ej2dpdq�Z3da4drds�Z5dtdu�Z6dvdw�Z7dxdy�Z8dzd{�Z9d|d}�Z:d~d�Z;ejd�ej�Z<ejd�ej�Z=ejd��Z>ejd��Z?iZ@d�d�d��ZAd�d��ZBd�d��ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGd�d��ZHiZId�d�d��ZeJd�k�r>d�ejKk�pd�ejKkZLd�ejKk�o$d�ejKkZMeNeeMeL��ejOd�dS)�a8 This module tries to retrieve as much platform-identifying data as
    possible. It makes this information available via function APIs.

    If called from the command line, it prints the platform
    information concatenated as single string to stdout. The output
    format is useable as part of a filename.

a
    Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
    Copyright (c) 2000-2010, eGenix.com Software GmbH; mailto:info@egenix.com

    Permission to use, copy, modify, and distribute this software and its
    documentation for any purpose and without fee or royalty is hereby granted,
    provided that the above copyright notice appear in all copies and that
    both that copyright notice and this permission notice appear in
    supporting documentation or portions thereof, including modifications,
    that you make.

    EGENIX.COM SOFTWARE GMBH DISCLAIMS ALL WARRANTIES WITH REGARD TO
    THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
    FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
    INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
    FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
    NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
    WITH THE USE OR PERFORMANCE OF THIS SOFTWARE !

z1.0.8�N�dos�win32�win16ZNULz	/dev/nullz/etc�
���(�2��)
ZdevZalpha�aZbeta�b�cZRC�rc�pl�pz([0-9]+|[._+-])cCsfg}x\tj|�D]N}|dkryt|d�}d}Wn tk
rNtj|d�}YnX|j||f�qW|S)Nz._+-r�dr)�
_component_re�split�int�
ValueError�_ver_stages�get�extend)�version�result�v�t�r� /usr/lib64/python3.6/platform.py�_comparable_version�s
rsC(__libc_init)|(GLIBC_([0-9.]+))|(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)�i@c
Cs�t}ttjd�rtjj|�}t|d���`}|j|�}d}�xH|t|�k�r�d|ksZd|krhtj	||�}nd}|s�|j
�t|�kr�|j|�}	|	r�|t|t|�d�d�|	}d}q<|s�Pdd	�|j�D�\}
}}}
}}|
r�|r�d
}n�|�r|dk�rd}|}n||�||�k�rx|}n^|
�rx|dk�rxd
}|�rR|�sN||�||�k�rR|}|�rx|t|�d�|k�rx||}|j
�}q<WWdQRX||fS)a Tries to determine the libc version that the file executable
        (which defaults to the Python interpreter) is linked against.

        Returns a tuple of strings (lib,version) which default to the
        given parameters in case the lookup fails.

        Note that the function has intimate knowledge of how different
        libc versions add symbols to the executable and thus is probably
        only useable for executables compiled using gcc.

        The file is read and scanned in chunks of chunksize bytes.

    �realpath�rbrslibcsGLIBCNi�cSs"g|]}|dk	r|jd�n|�qS)N�latin1)�decode)�.0�srrr�
<listcomp>�szlibc_ver.<locals>.<listcomp>Zlibc�glibc)
r�hasattr�os�pathr!�open�read�len�_libc_search�search�end�max�groups)�
executable�librZ	chunksize�V�fZbinary�pos�m�chunkZlibcinitr(ZglibcversionZsoZthreadsZ	soversionrrr�libc_ver�sJ




 r;cCsptjjd�r�d}td��`}xX|D]P}|j�}t|�dkr |\}}nq |dkrV|j�}q |dkr |jd�}|d}q WWdQRX|||fStjjd�r�td��D}x<|D]4}|jd�}	t|	�dkr�|	d	d
kr�d
|	d|fSq�WWdQRXtjjd��rftjd�}
x:t	t|
�ddd�D]"}|
|dd
�dk�r|
|=�qW|
�rf|
j
�d}|
dd
d�}|||fS|||fS)z� Tries some special tricks to get the distribution
        information in case the default method fails.

        Currently supports older SuSE Linux, Caldera OpenLinux and
        Slackware Linux distributions.

    z/var/adm/inst-log/info�SuSE�ZMIN_DIST_VERSIONZ
DIST_IDENT�-Nz/etc/.installedrZ	OpenLinux�z/usr/lib/setup�zslack-version-�	slackware���rBrB)r*r+�existsr,rr.�strip�isdir�listdir�range�sort)�distnamer�idr7�lineZtv�tag�value�valuesZpkgZverfiles�nrrr�_dist_try_harder�s>	










rPz(\w+)[-_](release|version)z'(.+) release ([\d.]+)[^(]*(?:\((.+)\))?z1([^0-9]+)(?: release )?([\d.]+)[^(]*(?:\((.+)\))?r<�debian�fedora�redhat�centos�	almalinux�mandrake�mandriva�rocksrA�	yellowdog�gentoo�UnitedLinux�
turbolinux�arch�mageiacCszd}d}tj|�}|dk	r&t|j��Stj|�}|dk	rDt|j��S|j�j�}|rp|d}t|�dkrp|d}d||fS)Nr rr?)�_lsb_release_version�match�tupler3�_release_versionrDrr.)�	firstlinerrJr9�lrrr�_parse_release_file0s

rer?cCs(ddl}|jdtdd�t|||||�S)NrzFdist() and linux_distribution() functions are deprecated in Python 3.5r=)�
stacklevel)�warnings�warn�PendingDeprecationWarning�_linux_distribution)rIrrJ�supported_dists�full_distribution_namergrrr�linux_distributionKs


rmcCs�ytjt�}Wntk
r(|||fSX|j�xD|D]0}tj|�}|dk	r8|j�\}}	||kr8|}Pq8Wt|||�St	tj
jt|�dddd��}
|
j�}WdQRXt
|�\}}}
|r�|r�|}|r�|}|
r�|
}|||fS)a� Tries to determine the name of the Linux OS distribution name.

        The function first looks for a distribution release file in
        /etc and then reverts to _dist_try_harder() in case no
        suitable files are found.

        supported_dists may be given to define the set of Linux
        distributions to look for. It defaults to a list of currently
        supported Linux distributions identified by their release file
        name.

        If full_distribution_name is true (default), the full
        distribution read from the OS is returned. Otherwise the short
        name taken from supported_dists is used.

        Returns a tuple (distname, version, id) which default to the
        args given as parameters.

    N�rzutf-8�surrogateescape)�encoding�errors)r*rF�_UNIXCONFDIR�OSErrorrH�_release_filenamer`r3rPr,r+�join�readlinere)rIrrJrkrlZetc�filer9Z	_distnameZdummyr7rcZ_versionZ_idrrrrjUs0

rjcCs*ddl}|jdtdd�t||||dd�S)aS Tries to determine the name of the Linux OS distribution name.

        The function first looks for a distribution release file in
        /etc and then reverts to _dist_try_harder() in case no
        suitable files are found.

        Returns a tuple (distname, version, id) which default to the
        args given as parameters.

    rNzFdist() and linux_distribution() functions are deprecated in Python 3.5r=)rf)rkrl)rgrhrirj)rIrrJrkrgrrr�dist�s
rxrncCs&ddl}|jdtdd�tj|||�S)z! Portable popen() interface.
    rNzuse os.popen insteadr=)rf)rgrh�DeprecationWarningr*�popen)�cmd�mode�bufsizergrrrrz�srzcCsd|jd�}|r|j|�ytt|�}Wntk
r>|}YnXttt|��}dj|dd��}|S)z� Normalize the version and build strings and return a single
        version string using the format major.minor.build (or patchlevel).
    �.N�)r�append�maprr�list�strru)r�buildrdZintsZstringsrrr�
_norm_version�s


r�z'(?:([\w ]+) ([\w.]+) .*\[.* ([\d.]+)\])c	Cs�tj|kr|||fSxddD]R}y&tj|�}|j�}|j�rBtd��Wn$tk
rh}zwWYdd}~XqXPqW|||fS|j�}tj	|�}|dk	r�|j
�\}}}|d	dkr�|dd
�}|ddkr�|dd�}t|�}|||fS)
a+ Tries to figure out the OS version used and returns
        a tuple (system, release, version).

        It uses the "ver" shell command for this which is known
        to exists on Windows, DOS. XXX Others too ?

        In case this fails, the given parameters are used as
        defaults.

    �ver�command /c ver�
cmd /c verzcommand failedNr?r~)r�r�r�rBrBrBrB)�sys�platformr*rzr-�closersrD�_ver_outputr`r3r�)	�system�releaserZsupported_platformsr{�pipe�infoZwhyr9rrr�_syscmd_ver�s,





r��Z2000ZXPr=Z
2003ServerZpost2003��Vista�7�8rz8.1zpost8.1Z10Zpost10Z
2008ServerZ2008ServerR2Z
2012ServerZ2012ServerR2Zpost2012ServerR2c(Cs�yddlm}Wntk
r,||||fSXyddlm}m}m}m}Wn,tk
rvddlm}m}m}m}YnX|�}	|	j	p�|	dd�\}
}}dj
|
||�}tj|
|f�p�tj|
df�p�|}|	dd�|
|fk�r$ydj
|	j
�}Wn8tk
�r"|dd�d	k�rd
|dd�}YnXt|	dd�dk�rZtj|
|f��pXtj|
df��pX|}d}
z.y||d�}
||
d
�d}WnYnXWd|
�r�||
�X||||fS)Nr)�getwindowsversion)�	OpenKeyEx�QueryValueEx�CloseKey�HKEY_LOCAL_MACHINErz{0}.{1}.{2}r=zSP{}�
z
Service Pack ZSPZproduct_typez,SOFTWARE\Microsoft\Windows NT\CurrentVersionZCurrentType)r�r��ImportError�winregr�r�r�r��_winregZplatform_version�format�_WIN32_CLIENT_RELEASESrZservice_pack_major�AttributeError�getattr�_WIN32_SERVER_RELEASES)r�r�csd�ptyper�r�r�r�r�ZwinverZmaj�minr��keyrrr�	win32_versD

r�cCs�d}tjj|�sdSyddl}Wntk
r4dSXt|d��}|j|�}WdQRX|d}d	}tj�j}|d
krxd}|||fS)Nz0/System/Library/CoreServices/SystemVersion.plistrr"ZProductVersionr �ppc�Power MacintoshZPowerPC)r r r )r�r�)	r*r+rC�plistlibr�r,�load�uname�machine)�fnr�r7rr��versioninfor�rrr�_mac_ver_xmlEs
r�cCst�}|dk	r|S|||fS)a< Get MacOS version information and return it as tuple (release,
        versioninfo, machine) with versioninfo being a tuple (version,
        dev_stage, non_release_version).

        Entries which cannot be determined are set to the parameter values
        which default to ''. All tuple entries are strings.
    N)r�)r�r�r�r�rrr�mac_ver[sr�cCs@ddlm}y|j|�}|dkr$|S|Stk
r:|SXdS)Nr)�System)�	java.langr�ZgetPropertyr�)�name�defaultr�rMrrr�
_java_getpropns
r�cCs�yddl}Wntk
r(||||fSXtd|�}td|�}|\}}}td|�}td|�}td|�}|||f}|\}}	}
td|
�}
td	|�}td
|	�}	||	|
f}||||fS)a] Version interface for Jython.

        Returns a tuple (release, vendor, vminfo, osinfo) with vminfo being
        a tuple (vm_name, vm_release, vm_vendor) and osinfo being a
        tuple (os_name, os_version, os_arch).

        Values which cannot be determined are set to the defaults
        given as parameters (which all default to '').

    rNzjava.vendorzjava.versionzjava.vm.namezjava.vm.vendorzjava.vm.versionzjava.os.archzjava.os.namezjava.os.version)r�r�r�)r��vendor�vminfo�osinfo�javaZvm_nameZ
vm_releaseZ	vm_vendor�os_name�
os_version�os_archrrr�java_verys"












r�cCs�|dkrd|||fS|dkr�|dkr0|||fS|jd�}|r�yt|d�}Wntk
rbYn X|d}t|�|d<dj|�}|dkr�d	}q�d	}n,|d
kr�d}|r�|d}q�d
}n|dkr�d}|||fS)z� Returns (system, release, version) aliased to common
        marketing names used for some systems.

        It also does some reordering of the information in some cases
        where it would otherwise cause confusion.

    ZRhapsodyzMacOS X ServerZSunOS�5r~rr�6ZSolarisZIRIX64ZIRIXz (64bit)�64bitrr�Windows)rr)rrrr�ru)r�r�rrd�majorrrr�system_alias�s2	



r�cGs�djdd�tt|�D��}|jdd�}|jdd�}|jdd�}|jdd�}|jd	d�}|jd
d�}|jdd�}|jdd�}|jd
d�}x|jdd�}||kr�P|}q�Wx|ddkr�|dd�}q�W|S)zq Helper to format the platform string in a filename
        compatible format e.g. "system-version-machine".
    r>css|]}|j�VqdS)N)rD)r%�xrrr�	<genexpr>�sz_platform.<locals>.<genexpr>� �_�/�\�:�;�"�(�)�unknownr z--r?NrBrB)ru�filterr.�replace)�argsr�Zcleanedrrr�	_platform�s$r�cCsDyddl}Wntk
r |SXy|j�Stk
r>|SXdS)z8 Helper to determine the node name of this machine.
    rN)�socketr�Zgethostnamers)r�r�rrr�_node�sr�cCsFtjj|�}x4tjj|�r@tjjtjjtjj|�tj|���}qW|S)zT In case filepath is a symlink, follow it until a
        real file is reached.
    )r*r+�abspath�islink�normpathru�dirname�readlink)�filepathrrr�_follow_symlinkss
"r�cCshtjdkr|Sytjd|tf�}Wnttfk
r<|SX|j�j�}|j	�}|s\|r`|S|SdS)z. Interface to the system's uname command.
    rrrzuname %s 2> %sN)rrr)
r�r�r*rz�DEV_NULLr�rsr-rDr�)Zoptionr�r7�outputrrrr�
_syscmd_unames

r�cCs|tjd	kr|St|�}ytjd|gtjtjd�}Wnttfk
rJ|SX|j	�dj
d�}|j�}|sp|rt|S|SdS)
z� Interface to the system's file command.

        The function uses the -b option of the file command to have it
        omit the filename in its output. Follow the symlinks. It returns
        default in case the command should fail.

    rrrrw)�stdout�stderrrzlatin-1N)rrr)r�r�r��
subprocess�Popen�PIPEZSTDOUTr�rsZcommunicater$�wait)�targetr��procr�rrrr�_syscmd_files	


r��	WindowsPEr��MSDOS)rrrcCs.|sLddl}y|jd�}Wn |jk
r:|jd�}YnXt|d�d}|r\t|d�}nd}|r�|tjkr�tjtkr�ttj\}}|r�|}|r�|}||fSd|kr�||fSd	|kr�d
}nd|kr�d}nd
|kr�d}d|kr�d}n@d|k�rd|k�rd}nd}n d|k�rd}nd|k�r&d}n||fS)a� Queries the given executable (defaults to the Python interpreter
        binary) for various architecture information.

        Returns a tuple (bits, linkage) which contains information about
        the bit architecture and the linkage format used for the
        executable. Both values are returned as strings.

        Values that cannot be determined are returned as given by the
        parameter presets. If bits is given as '', the sizeof(pointer)
        (or sizeof(long) on Python version < 1.5.2) is used as
        indicator for the supported pointer size.

        The function relies on the system's "file" command to do the
        actual work. This is available on most if not all Unix
        platforms. On some non-Unix platforms where the "file" command
        does not exist and the executable is set to the Python interpreter
        binary defaults from _default_architecture are used.

    rN�Prd��bitr r4z32-bit�32bitZN32Zn32bitz64-bitr�ZELFZPEr�r�ZCOFFzMS-DOSr�)	�structZcalcsize�errorr�r�r�r4r��_default_architecture)r4�bits�linkager��sizeZfileoutrrdrrr�architectureBsL





r��uname_resultz-system node release version machine processorcCs�d}tdk	rtSd}ytj�\}}}}}Wntk
rBd}YnX|sdttd|||||f���r�|r�tj}d}d}t�}d}d}|dkr�t	�\}}}}	|r�|r�d}|s�dtj
kr�tj
jdd�}ntj
jdd�}|s�tj
jd|�}|�r<t|�\}}}|d	k�rd
}n4|dk�r<|d
k�r<d
}d|dd
�k�r8d}nd}|dk�rf|�s`|dk�r\d}nd}d
}n8|dd�dk�r�t
�\}}
}}d}dj|�}|�s�|
}|dk�r
|�s�|dk�r�|}d}yddl}
Wntk
�r�Yn&X|
jdd�\}}|dk�rd}nd}|�stdd�}|dk�r(d}|dk�r6d}|dk�rDd}|dk�rRd}|dk�r`d}|dk�rnd}|dk�r�|d
k�r�d
}d}t||||||�atS)an Fairly portable uname interface. Returns a tuple
        of strings (system, node, release, version, machine, processor)
        identifying the underlying platform.

        Note that unlike the os.uname function this also returns
        possible processor information as an additional tuple entry.

        Entries which cannot be determined are set to ''.

    rNr r?rZPROCESSOR_ARCHITEW6432ZPROCESSOR_ARCHITECTUREZPROCESSOR_IDENTIFIERzMicrosoft Windowsr�Z	Microsoftz6.0rr�rr�Z16bit�r��Javaz, ZOpenVMS�0zSYI$_CPU�ZAlphaZVAXz-pr�)rr)�_uname_cacher*r�r�r�r�r�r�r�r��environrr�r�ru�vms_libr�Zgetsyir�r�)Zno_os_uname�	processorr��noder�rr�Zuse_syscmd_verr�r�r�r�r�rZcsidZ
cpu_numberrrrr��s�

 














r�cCst�jS)z� Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'.

        An empty string is returned if the value cannot be determined.

    )r�r�rrrrr�%sr�cCst�jS)z� Returns the computer's network name (which may not be fully
        qualified)

        An empty string is returned if the value cannot be determined.

    )r�rrrrrr.srcCst�jS)z� Returns the system's release, e.g. '2.2.0' or 'NT'

        An empty string is returned if the value cannot be determined.

    )r�r�rrrrr�8sr�cCst�jS)z� Returns the system's release version, e.g. '#3 on degas'

        An empty string is returned if the value cannot be determined.

    )r�rrrrrrAsrcCst�jS)zt Returns the machine type, e.g. 'i386'

        An empty string is returned if the value cannot be determined.

    )r�r�rrrrr�Jsr�cCst�jS)a Returns the (true) processor name, e.g. 'amdk6'

        An empty string is returned if the value cannot be
        determined. Note that many platforms do not provide this
        information or simply return the same value as for machine(),
        e.g.  NetBSD does this.

    )r�rrrrrrSs
rzL([\w.+]+)\s*\(#?([^,]+)(?:,\s*([\w ]*)(?:,\s*([\w :]*))?)?\)\s*\[([^\]]+)\]?z;IronPython\s*([\d\.]+)(?: \(([\d\.]+)\))? on (.NET [\d\.]+)zU([\d.]+)\s*\(IronPython\s*[\d.]+\s*\(([\d.]+)\) on ([\w.]+ [\d.]+(?: \(\d+-bit\))?)\)zE([\w.+]+)\s*\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*\[PyPy [^\]]+\]?cCs|dkrtj}tj|d�}|dk	r&|Sd|kr�d}|jd�rHtj|�}n
tj|�}|dkrjtdt	|���|j
�\}}}d}d}n�tjjd�r�d}tj|�}|dkr�tdt	|���|j
�\}}}}	}
|dkr�d}tj}n�d|k�r"d}t
j|�}|dk�rtd	t	|���|j
�\}}}}	d}n\tj|�}|dk�rFtd
t	|���|j
�\}}}}	}d}|dk�rld}n|	�r~|d|	}ttd
��r�tj\}
}}n<ttd��r�tj\}
}}n"ttd��r�tj\}
}}nd}d}|jd�}
t|
�dk�r|
jd�dj|
�}|||||||f}|t|<|S)a� Returns a parsed version of Python's sys.version as tuple
        (name, version, branch, revision, buildno, builddate, compiler)
        referring to the Python implementation name, version, branch,
        revision, build number, build date/time as string and the compiler
        identification string.

        Note that unlike the Python sys.version, the returned value
        for the Python version will always include the patchlevel (it
        defaults to '.0').

        The function returns empty strings for tuple entries that
        cannot be determined.

        sys_version may be given to parse an alternative version
        string, e.g. if the version was read from a different Python
        interpreter.

    NZ
IronPythonz*failed to parse IronPython sys.version: %sr r�ZJythonz&failed to parse Jython sys.version: %sZPyPyz$failed to parse PyPy sys.version: %sz'failed to parse CPython sys.version: %sZCPythonr��_git�
_mercurial�
subversionr~r=r�)r�r�_sys_version_cacher�
startswith�_ironpython_sys_version_parserr`� _ironpython26_sys_version_parserr�reprr3r��_sys_version_parser�_pypy_sys_version_parserr)rrrrr.r�ru)�sys_versionrr�r`rZalt_versionZcompilerZbuildnoZ	builddateZ	buildtimer�ZbranchZrevisionrdrrr�_sys_version}s|











rcCs
t�dS)aR Returns a string identifying the Python implementation.

        Currently, the following implementations are identified:
          'CPython' (C implementation of Python),
          'IronPython' (.NET implementation of Python),
          'Jython' (Java implementation of Python),
          'PyPy' (Python implementation of Python).

    r)rrrrr�python_implementation�srcCs
t�dS)z� Returns the Python version as string 'major.minor.patchlevel'

        Note that unlike the Python sys.version, the returned value
        will always include the patchlevel (it defaults to 0).

    r?)rrrrr�python_version�srcCstt�djd��S)z� Returns the Python version as tuple (major, minor, patchlevel)
        of strings.

        Note that unlike the Python sys.version, the returned value
        will always include the patchlevel (it defaults to 0).

    r?r~)rarrrrrr�python_version_tuple�s	rcCs
t�dS)z� Returns a string identifying the Python implementation
        branch.

        For CPython this is the Subversion branch from which the
        Python binary was built.

        If not available, an empty string is returned.

    r=)rrrrr�
python_branch
srcCs
t�dS)z� Returns a string identifying the Python implementation
        revision.

        For CPython this is the Subversion revision from which the
        Python binary was built.

        If not available, an empty string is returned.

    r)rrrrr�python_revisionsrcCst�dd�S)zh Returns a tuple (buildno, builddate) stating the Python
        build number and date as strings.

    r�r�)rrrrr�python_build%srcCs
t�dS)zS Returns a string identifying the compiler used for compiling
        Python.

    r�)rrrrr�python_compiler-srcCs�tj||fd�}|dk	r|St�\}}}}}}||kr:d}|rPt|||�\}}}|dkr�t|�\}	}
}}|rxt||�}
nt||||�}
�n.|dk�rtj��"tjddt	�t
d�\}}}WdQRX|r�|r�t||||d|||�}
n$ttj
�\}}t||||d||�}
n�|dk�r\t�\}}}\}}}|�s8|�rFt|||�}
nt|||d	|||�}
n\|d
k�r�|�rxt||�}
nt|||�}
n2|�r�t||�}
n ttj
�\}}t||||||�}
|
t||f<|
S)a� Returns a single string identifying the underlying platform
        with as much useful information as possible (but no more :).

        The output is intended to be human readable rather than
        machine parseable. It may look different on different
        platforms and this is intended.

        If "aliased" is true, the function will use aliases for
        various platforms that report system names which differ from
        their common names, e.g. SunOS will be reported as
        Solaris. The system_alias() function is used to implement
        this.

        Setting terse to true causes the function to return only the
        absolute minimum information needed to identify the platform.

    Nr r��Linux�ignorez?dist\(\) and linux_distribution\(\) functions are deprecated .*�withr�ZonZMacOS)r)�_platform_cacherr�r�r�r�rg�catch_warnings�filterwarningsrirxr;r�r4r�r�)�aliased�terserr�rr�rr�rZrelZversr�r�r�rIZdistversionZdistidZlibcnameZlibcversionrnrr�r�r�r�r�r�rrrr�9s\







r��__main__rz--terseZ
nonaliasedz--nonaliased)rrr)r<rQrRrSrTrUrVrWrXrArYrZr[r\r]r^rB)rnrB)r �rrr)r r r r)r�r)r�r?)r�r=)r�N)r�r)r�r?)r�r=)r�r)r�N)rr)rN)r�r=)r�r)r�r?)r�r=)r�r)r�N)r r r r �r r r )r r r �r r r �r r r )r r r!r")r )r )r )r r�)r r�)r r�)N)rr)P�__doc__Z
__copyright__�__version__�collectionsr�r*�rer�rg�devnullr�r�r�rrr�compilerr�ASCIIr/r4r;rPrtr_rbZ_supported_distsrermrjrxrzr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��
namedtupler�r�r�r�rr�rr�rrrr	rrrrrrrrrrr�__name__�argvrr�print�exitrrrr�<module>
s�e 




:26
	



0
0

#6 


T	
			
k




[
plistlib.cpython-36.pyc000064400000066124150335715140011031 0ustar003

�\dh#~�@sbdZddddddddd	d
ddd
dgZddlZddlZddlZddlZddlZddlmZddl	Z	ddl
Z
ddlZddlZddl
mZddlmZejdded�Ze�jej�Gdd�de�ZGdd�de�Zejdd��ZGdd�de�Zdd�Zdd�Zdd�Zd d�Z Gd!d�d�Z!d"Z"ej#d#�Z$dPd%d&�Z%d'd(�Z&ej#d)ej'�Z(d*d+�Z)d,d-�Z*d.d/�Z+Gd0d1�d1�Z,Gd2d3�d3�Z-Gd4d5�d5e-�Z.d6d7�Z/Gd8d�de0�Z1d9d:d;d<d=�Z2e3�Z4Gd>d?�d?�Z5d@dA�Z6e7e8e9eje:fZ;GdBdC�dCe3�Z<dDdE�Z=e>ee/e,e.dF�e?ee=e5e<dF�iZ@ddGedH�dId�ZAddGedH�dJd
�ZBe>dGdKdL�dMd�ZCe>dKdGdN�dOd�ZDdS)Qa�plistlib.py -- a tool to generate and parse MacOSX .plist files.

The property list (.plist) file format is a simple XML pickle supporting
basic object types, like dictionaries, lists, numbers and strings.
Usually the top level object is a dictionary.

To write out a plist file, use the dump(value, file)
function. 'value' is the top level object, 'file' is
a (writable) file object.

To parse a plist from a file, use the load(file) function,
with a (readable) file object as the only argument. It
returns the top level object (again, usually a dictionary).

To work with plist data in bytes objects, you can use loads()
and dumps().

Values can be strings, integers, floats, booleans, tuples, lists,
dictionaries (but only with string keys), Data, bytes, bytearray, or
datetime.datetime objects.

Generate Plist example:

    pl = dict(
        aString = "Doodah",
        aList = ["A", "B", 12, 32.1, [1, 2, 3]],
        aFloat = 0.1,
        anInt = 728,
        aDict = dict(
            anotherString = "<hello & hi there!>",
            aUnicodeValue = "M\xe4ssig, Ma\xdf",
            aTrueValue = True,
            aFalseValue = False,
        ),
        someData = b"<binary gunk>",
        someMoreData = b"<lots of binary gunk>" * 10,
        aDate = datetime.datetime.fromtimestamp(time.mktime(time.gmtime())),
    )
    with open(fileName, 'wb') as fp:
        dump(pl, fp)

Parse Plist example:

    with open(fileName, 'rb') as fp:
        pl = load(fp)
    print(pl["aKey"])
�	readPlist�
writePlist�readPlistFromBytes�writePlistToBytes�Plist�Data�Dict�InvalidFileException�FMT_XML�
FMT_BINARY�load�dump�loads�dumps�N)�BytesIO)�warn)�ParserCreate�PlistFormatzFMT_XML FMT_BINARY)�modulec@s(eZdZfZdd�Zdd�Zdd�ZdS)�
_InternalDictcCs:y||}Wntk
r(t|��YnXtdtd�|S)NzLAttribute access from plist dicts is deprecated, use d[key] notation instead�)�KeyError�AttributeErrorr�DeprecationWarning)�self�attr�value�r� /usr/lib64/python3.6/plistlib.py�__getattr__Vsz_InternalDict.__getattr__cCstdtd�|||<dS)NzLAttribute access from plist dicts is deprecated, use d[key] notation insteadr)rr)rrrrrr�__setattr___sz_InternalDict.__setattr__cCs8y
||=Wntk
r&t|��YnXtdtd�dS)NzLAttribute access from plist dicts is deprecated, use d[key] notation insteadr)rrrr)rrrrr�__delattr__ds
z_InternalDict.__delattr__N)�__name__�
__module__�__qualname__�	__slots__rr r!rrrrrOs	rcseZdZ�fdd�Z�ZS)rcstdtd�t�jf|�dS)Nz?The plistlib.Dict class is deprecated, use builtin dict insteadr)rr�super�__init__)r�kwargs)�	__class__rrr'osz
Dict.__init__)r"r#r$r'�
__classcell__rr)r)rrmsc	cs2t|t�r(t||��}|VWdQRXn|VdS)N)�
isinstance�str�open)�
pathOrFile�mode�fprrr�_maybe_openus
r1cs4eZdZdZ�fdd�Zedd��Zdd�Z�ZS)rzuThis class has been deprecated. Use dump() and load()
    functions instead, together with regular dict objects.
    cstdtd�t�jf|�dS)NzJThe Plist class is deprecated, use the load() and dump() functions insteadr)rrr&r')rr()r)rrr'�szPlist.__init__c	Cs2t|d��}t|�}WdQRX|�}|j|�|S)z,Deprecated. Use the load() function instead.�rbN)r1r�update)�clsr.r0rZplistrrr�fromFile�s

zPlist.fromFilec
Cs$t|d��}t||�WdQRXdS)z,Deprecated. Use the dump() function instead.�wbN)r1r)rr.r0rrr�write�szPlist.write)	r"r#r$�__doc__r'�classmethodr5r7r*rr)r)rrs	c
Cs2tdtd�t|d��}t|ddtd�SQRXdS)z�
    Read a .plist from a path or file. pathOrFile should either
    be a file name, or a readable binary file object.

    This function is deprecated, use load instead.
    z8The readPlist function is deprecated, use load() insteadrr2NF)�fmt�use_builtin_types�	dict_type)rrr1rr)r.r0rrrr�s
cCs8tdtd�t|d��}t||tddd�WdQRXdS)z�
    Write 'value' to a .plist file. 'pathOrFile' may either be a
    file name or a (writable) file object.

    This function is deprecated, use dump instead.
    z9The writePlist function is deprecated, use dump() insteadrr6TF)r:�	sort_keys�skipkeysN)rrr1rr	)rr.r0rrrr�scCs tdtd�tt|�ddtd�S)z}
    Read a plist data from a bytes object. Return the root object.

    This function is deprecated, use loads instead.
    zBThe readPlistFromBytes function is deprecated, use loads() insteadrNF)r:r;r<)rrrrr)�datarrrr�scCs,tdtd�t�}t||tddd�|j�S)zp
    Return 'value' as a plist-formatted bytes object.

    This function is deprecated, use dumps instead.
    zAThe writePlistToBytes function is deprecated, use dumps() insteadrTF)r:r=r>)rrrrr	�getvalue)r�frrrr�s
c@s>eZdZdZdd�Zedd��Zddd�Zd	d
�Zdd�Z	d
S)rz]
    Wrapper for binary data.

    This class is deprecated, use a bytes object instead.
    cCst|t�std��||_dS)Nzdata must be as bytes)r+�bytes�	TypeErrorr?)rr?rrrr'�s
z
Data.__init__cCs|t|��S)N)�_decode_base64)r4r?rrr�
fromBase64�szData.fromBase64�LcCst|j|�S)N)�_encode_base64r?)r�
maxlinelengthrrr�asBase64�sz
Data.asBase64cCs4t||j�r|j|jkSt|t�r,|j|kStSdS)N)r+r)r?rB�NotImplemented)r�otherrrr�__eq__�s


zData.__eq__cCsd|jjt|j�fS)Nz%s(%s))r)r"�reprr?)rrrr�__repr__�sz
Data.__repr__N)rF)
r"r#r$r8r'r9rErIrLrNrrrrr�s
s�<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
zv[\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]rFcCsT|dd}g}x8tdt|�|�D]$}||||�}|jtj|��q"Wdj|�S)N��r�)�range�len�append�binasciiZ
b2a_base64�join)�srHZ
maxbinsize�pieces�i�chunkrrrrGsrGcCs(t|t�rtj|jd��Stj|�SdS)Nzutf-8)r+r,rUZ
a2b_base64�encode)rWrrrrD
s
rDz{(?P<year>\d\d\d\d)(?:-(?P<month>\d\d)(?:-(?P<day>\d\d)(?:T(?P<hour>\d\d)(?::(?P<minute>\d\d)(?::(?P<second>\d\d))?)?)?)?)?ZcCsNd}tj|�j�}g}x,|D]$}||}|dkr2P|jt|��qWtj|�S)N�year�month�day�hour�minute�second)r\r]r^r_r`ra)�_dateParser�match�	groupdictrT�int�datetime)rW�orderZgdZlst�key�valrrr�_date_from_strings
rjcCs d|j|j|j|j|j|jfS)Nz%04d-%02d-%02dT%02d:%02d:%02dZ)r\r]r^r_r`ra)�drrr�_date_to_string&srlcCsZtj|�}|dk	rtd��|jdd�}|jdd�}|jdd�}|jdd�}|jd	d
�}|S)Nz<strings can't contains control characters; use bytes insteadz
�
�
�&z&amp;�<z&lt;�>z&gt;)�_controlCharPat�search�
ValueError�replace)�text�mrrr�_escape,s
rxc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'S)(�_PlistParsercCs"g|_d|_d|_||_||_dS)N)�stack�current_key�root�_use_builtin_types�
_dict_type)rr;r<rrrr'9s
z_PlistParser.__init__cCs8t�|_|j|j_|j|j_|j|j_|jj|�|j	S)N)
r�parser�handle_begin_elementZStartElementHandler�handle_end_elementZEndElementHandler�handle_dataZCharacterDataHandlerZ	ParseFiler|)rZfileobjrrr�parse@s


z_PlistParser.parsecCs*g|_t|d|d�}|dk	r&||�dS)NZbegin_)r?�getattr)r�element�attrs�handlerrrrr�Hsz!_PlistParser.handle_begin_elementcCs"t|d|d�}|dk	r|�dS)NZend_)r�)rr�r�rrrr�Nsz_PlistParser.handle_end_elementcCs|jj|�dS)N)r?rT)rr?rrrr�Ssz_PlistParser.handle_datacCs�|jdk	rFt|jdti��s.td|jj��||jd|j<d|_nB|jsT||_n4t|jdtg��sxtd|jj��|jdj|�dS)N�zunexpected element at line %d���r�r�r�)	r{r+rz�typertr�CurrentLineNumberr|rT)rrrrr�
add_objectVs
z_PlistParser.add_objectcCsdj|j�}g|_|S)N�)rVr?)rr?rrr�get_datafsz_PlistParser.get_datacCs"|j�}|j|�|jj|�dS)N)r~r�rzrT)rr�rkrrr�
begin_dictms
z_PlistParser.begin_dictcCs*|jrtd|j|jjf��|jj�dS)Nz%missing value for key '%s' at line %d)r{rtrr�rz�pop)rrrr�end_dictrsz_PlistParser.end_dictcCs:|jst|jdti��r,td|jj��|j�|_dS)Nr�zunexpected key at line %dr�)r{r+rzr�rtrr�r�)rrrr�end_keyxsz_PlistParser.end_keycCsg}|j|�|jj|�dS)N)r�rzrT)rr��arrr�begin_array~s
z_PlistParser.begin_arraycCs|jj�dS)N)rzr�)rrrr�	end_array�sz_PlistParser.end_arraycCs|jd�dS)NT)r�)rrrr�end_true�sz_PlistParser.end_truecCs|jd�dS)NF)r�)rrrr�	end_false�sz_PlistParser.end_falsecCs|jt|j���dS)N)r�rer�)rrrr�end_integer�sz_PlistParser.end_integercCs|jt|j���dS)N)r��floatr�)rrrr�end_real�sz_PlistParser.end_realcCs|j|j��dS)N)r�r�)rrrr�
end_string�sz_PlistParser.end_stringcCs2|jr|jt|j���n|jtj|j���dS)N)r}r�rDr�rrE)rrrr�end_data�sz_PlistParser.end_datacCs|jt|j���dS)N)r�rjr�)rrrr�end_date�sz_PlistParser.end_dateN)r"r#r$r'r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrry8s&ryc@s8eZdZddd�Zdd�Zdd�Zdd
d�Zdd
�Zd	S)�_DumbXMLWriterr�	cCs||_g|_||_||_dS)N)�filerz�
_indent_level�indent)rr��indent_levelr�rrrr'�sz_DumbXMLWriter.__init__cCs,|jj|�|jd|�|jd7_dS)Nz<%s>r�)rzrT�writelnr�)rr�rrr�
begin_element�sz_DumbXMLWriter.begin_elementcCs@|jdkst�|jj�|ks t�|jd8_|jd|�dS)Nrr�z</%s>)r��AssertionErrorrzr�r�)rr�rrr�end_element�sz_DumbXMLWriter.end_elementNcCs8|dk	r&t|�}|jd|||f�n|jd|�dS)Nz<%s>%s</%s>z<%s/>)rxr�)rr�rrrr�simple_element�sz_DumbXMLWriter.simple_elementcCsH|r8t|t�r|jd�}|jj|j|j�|jj|�|jjd�dS)Nzutf-8�
)r+r,r[r�r7r�r�)r�linerrrr��s

z_DumbXMLWriter.writeln)rr�)N)r"r#r$r'r�r�r�r�rrrrr��s


r�c@sFeZdZddd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Z	dS)�_PlistWriterr�	r�TFcCs.|r|jt�tj||||�||_||_dS)N)r7�PLISTHEADERr�r'�
_sort_keys�	_skipkeys)rr�r�r�ZwriteHeaderr=r>rrrr'�s

z_PlistWriter.__init__cCs"|jd�|j|�|jd�dS)Nz<plist version="1.0">z</plist>)r��write_value)rrrrrr7�s

z_PlistWriter.writecCs4t|t�r|jd|��n|dkr0|jd��n|dkrD|jd�n�t|t�r�d|ko`dknrx|jd	d
|�nt|��n�t|t�r�|jdt|��n�t|t�r�|j|�n|t|t	�r�|j
|�nft|ttf�r�|j
|�nLt|tj��r|jdt|��n,t|ttf��r |j|�ntd
t|���dS)N�stringT�trueFZfalser��?�@Zintegerz%d�realZdatezunsupported type: %sr�l����l)r+r,r�re�
OverflowErrorr�rM�dict�
write_dictr�
write_datarB�	bytearray�write_bytesrfrl�tuple�list�write_arrayrCr�)rrrrrr��s.





z_PlistWriter.write_valuecCs|j|j�dS)N)r�r?)rr?rrrr��sz_PlistWriter.write_datacCs~|jd�|jd8_tddt|jjdd	�|j��}x&t||�jd�D]}|rL|j|�qLW|jd7_|j	d�dS)
Nr?r��rFr�� �r�s        )
r�r��maxrSr�rurG�splitr�r�)rr?rHr�rrrr��s
z_PlistWriter.write_bytescCs�|rx|jd�|jr"t|j��}n|j�}x@|D]8\}}t|t�sR|jrJq0td��|jd|�|j	|�q0W|j
d�n
|jd�dS)Nr�zkeys must be stringsrh)r�r��sorted�itemsr+r,r�rCr�r�r�)rrkr�rhrrrrr�s

z_PlistWriter.write_dictcCs@|r2|jd�x|D]}|j|�qW|jd�n
|jd�dS)N�array)r�r�r�r�)rr�rrrrr�s

z_PlistWriter.write_arrayN)rr�r�TF)
r"r#r$r'r7r�r�r�r�r�rrrrr��s
%
r�cCs�d	}x|D]}|j|�r
dSq
WxntjdftjdftjdffD]N\}}|j|�sRq>x8|D]0}||jd�j|�}|dt|��|krXdSqXWq>WdS)
N�<?xml�<plistTzutf-8z	utf-16-bez	utf-16-le�asciiF)r�r�)�
startswith�codecs�BOM_UTF8�BOM_UTF16_BE�BOM_UTF16_LE�decoder[rS)�header�prefixesZpfxZbom�encoding�start�prefixrrr�_is_fmt_xml*s



r�c@seZdZddd�ZdS)r�Invalid filecCstj||�dS)N)rtr')r�messagerrrr'LszInvalidFileException.__init__N)r�)r"r#r$r'rrrrrKs�B�H�L�Q)r�rrOr�c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�_BinaryPlistParsera
    Read or write a binary plist file, following the description of the binary
    format.  Raise InvalidFileException in case of error, otherwise return the
    root object.

    see also: http://opensource.apple.com/source/CF/CF-744.18/CFBinaryPList.c
    cCs||_||_dS)N)r}r~)rr;r<rrrr'[sz_BinaryPlistParser.__init__cCs�y|||_|jjdtj�|jjd�}t|�dkr6t��tjd|�\}|_	}}}|jj|�|j
||�|_tg||_
|j|�Stttjttfk
r�t��YnXdS)N� z>6xBBQQQi��)�_fp�seek�os�SEEK_END�readrSr�struct�unpack�	_ref_size�
_read_ints�_object_offsets�
_undefined�_objects�_read_object�OSError�
IndexError�errorr�rt)rr0�trailer�offset_size�num_objects�
top_object�offset_table_offsetrrrr�_s
z_BinaryPlistParser.parsecCsL|dkrH|jjd�dd@}d|>}dt|}tj||jj|��dS|S)z$ return the size of the next object.�r�rrPrq)r�r��_BINARY_FORMATr�r�)r�tokenLrwrWrArrr�	_get_sizexsz_BinaryPlistParser._get_sizecsv|jj�|���tkr2tjd|�t�����S�sHt���|krNt��t��fdd�td�|��D��SdS)Nrqc3s&|]}tj�||��d�VqdS)�bigN)re�
from_bytes)�.0rY)r?�sizerr�	<genexpr>�sz0_BinaryPlistParser._read_ints.<locals>.<genexpr>r)	r�r�r�r�r�rSrr�rR)r�nr�r)r?r�rr��sz_BinaryPlistParser._read_intscCs|j||j�S)N)r�r�)rr�rrr�
_read_refs�sz_BinaryPlistParser._read_refscs��j|}|tk	r|S�j|}�jj|��jjd�d}|d@|d@}}|dkr^d}�n�|dkrnd}�n||dkr~d	}�nl|dkr�d
}�n\|dkr�tj�jjd|>�d|d
kd�}�n0|dkr�tj	d�jjd��d}�n|dk�rtj	d�jjd��d}�n�|dk�rDtj	d�jjd��d}t
j
ddd�t
j|d�}�n�|dk�r��j|�}�jj|�}t
|�|k�rxt���j�s�t|�}�n^|dk�rΈj|�}�jj|�}	t
|	�|k�r�t��|	jd�}�n|dk�r�j|�d}�jj|�}	t
|	�|k�rt��|	jd�}n�|dk�rX�j|�}�j|�}
g}|�j|<|j�fdd�|
D��n�|d k�r�j|�}�j|�}�j|�}
�j�}|�j|<y2x,t||
�D]\}}
�j|
�|�j|�<�q�WWntk
�r�t��YnXnt��|�j|<|S)!zx
        read the object by reference.

        May recursively read sub-objects (content of an array/dict/set)
        r�r��r�Nr�F�	TrQr�r�rP)�signed�"z>frO�#z>d�3i�)Zsecondsr��Pr��`rzutf-16be�c3s|]}�j|�VqdS)N)r�)r��x)rrrr��sz2_BinaryPlistParser._read_object.<locals>.<genexpr>��)r�r�r�r�r�r�rer�r�r�rfZ	timedeltar�rSrr}rr�r��extendr~�zipr�rC)r�ref�result�offset�tokenZtokenHr�rArWr?Zobj_refsZkey_refs�k�or)rrr��s�


















z_BinaryPlistParser._read_objectN)
r"r#r$r8r'r�r�r�r�r�rrrrr�Ss

r�cCs0|dkrdS|dkrdS|d>d>r(dSdSdS)	Nr�r�r�rr�rO�ir)�countrrr�_count_to_size�src@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�_BinaryPlistWritercCs||_||_||_dS)N)r�r�r�)rr0r=r>rrrr'sz_BinaryPlistWriter.__init__c
Cs�g|_i|_i|_|j|�t|j�}dg||_t|�|_t|j|_	|j
jd�x|jD]}|j|�q\W|j
|�}|j
j�}t|�}dt||}|j
jtj|f|j���d}|||j|||f}	|j
jtjd|	���dS)Nrsbplist00rq�	>5xBBBQQQ)r)�_objlist�	_objtable�_objidtable�_flattenrSr�rr�r��_ref_formatr�r7�
_write_object�
_getrefnum�tellr��pack)
rrr��objr�r�r�Z
offset_formatZsort_versionr�rrrr7
s(





z_BinaryPlistWriter.writec	Cs~t|t�r"t|�|f|jkrZdSn8t|t�rHt|j�|jf|jkrZdSnt|�|jkrZdSt|j	�}|j	j
|�t|t�r�||jt|�|f<n0t|t�r�||jt|j�|jf<n||jt|�<t|t��rPg}g}|j�}|j
r�t|�}xB|D]:\}}t|t��s|j�rq�td��|j
|�|j
|�q�WxLtj||�D]}|j|��q:Wn*t|ttf��rzx|D]}|j|��qfWdS)Nzkeys must be strings)r+�_scalarsr�rrr?�idrrSrrTr�r�r�r�r,r�rC�	itertools�chainrr�r�)	rrZrefnum�keys�valuesr�r�vrrrrr7sB






z_BinaryPlistWriter._flattencCsNt|t�r|jt|�|fSt|t�r<|jt|j�|jfS|jt|�SdS)N)r+r rr�rr?rr!)rrrrrrgs


z_BinaryPlistWriter._getrefnumcCs�|dkr"|jjtjd||B��n�|dkrH|jjtjd|dBd|��nh|dkrn|jjtjd|dBd|��nB|dkr�|jjtjd
|dBd|��n|jjtjd|dBd
|��dS)Nr�z>Br�r�z>BBBr�z>BBH�r�z>BBL�z>BBQ�ril)r�r7r�r)rrr�rrr�_write_sizeosz_BinaryPlistWriter._write_sizecs��j|�}�jj��j|<|dkr2�jjd��n�|dkrJ�jjd��n�|dkrb�jjd��n�t|t��rl|dkr�y�jjtjdd|��Wn tj	k
r�t
|�d�YnXn�|d'krԈjjtjdd|��n�|d(kr�jjtjd
d|��nt|d)k�r�jjtjdd|��nR|d*k�r8�jjtjdd|��n0|d+k�r`�jjd|jdddd��nt
|���nxt|t��r��jjtjdd|���nRt|t
j
��r�|t
j
dd	d	�j�}�jjtjdd|���nt|t��r�jdt|j���jj|j��n�t|ttf��r0�jdt|���jj|��n�t|t��r�y|jd�}�jdt|��Wn4tk
�r�|jd�}�jdt|�d �YnX�jj|��nDt|ttf��r��fd!d"�|D�}t|�}�jd#|��jjtjd$�j|f|���n�t|t��r�gg}}�j�r&t|j��}	n|j�}	xR|	D]J\}
}t|
t��s\�j�rT�q4t d%��|j!�j|
��|j!�j|���q4Wt|�}�jd&|��jjtjd$�j|f|����jjtjd$�j|f|���nt |��dS),N�F�Tr�rz>Bqr)r�r�z>BBr�z>BHr'r�z>BLr(r�z>BQr��r�)rz>Bdri�rr�rzutf-16berrcsg|]}�j|��qSr)r)r�r)rrr�
<listcomp>�sz4_BinaryPlistWriter._write_object.<locals>.<listcomp>rrqzkeys must be stringsrrilll)"rr�rr�r7r+rer�rr�r��to_bytesr�rfZ
total_secondsrr*rSr?rBr�r,r[�UnicodeEncodeErrorr�r�rr�r�r�r�r�rCrT)rrrrA�tZrefsrWZkeyRefsZvalRefsZ	rootItemsrr&r)rrrs�





$
"$z _BinaryPlistWriter._write_objectN)	r"r#r$r'r7rrr*rrrrrrs-0rcCs|dd�dkS)Nr�sbplist00r)r�rrr�_is_fmt_binary�sr2)�detectr�writerT)r:r;r<cCsn|dkrL|jd�}|jd�x:tj�D]}|d|�r&|d}Pq&Wt��nt|d}|||d�}|j|�S)z�Read a .plist file. 'fp' should be (readable) file object.
    Return the unpacked root object (which usually is a dictionary).
    Nr�rr3r)r;r<)r�r��_FORMATSr%rr�)r0r:r;r<r��info�P�prrrr�s

cCst|�}t||||d�S)zqRead a .plist file from a bytes object.
    Return the unpacked root object (which usually is a dictionary).
    )r:r;r<)rr)rr:r;r<r0rrrr
sF)r:r=r>cCs:|tkrtd|f��t|d|||d�}|j|�dS)zQWrite 'value' to a .plist file. 'fp' should be a (writable)
    file object.
    zUnsupported format: %rr4)r=r>N)r5rtr7)rr0r:r=r>r4rrrrs)r:r>r=cCs t�}t|||||d�|j�S)z?Return a bytes object with the contents for a .plist file.
    )r:r>r=)rrr@)rr:r>r=r0rrrrs)rF)Er8�__all__rUr��
contextlibrf�enum�iorr"r��rer��warningsrZxml.parsers.expatr�Enumr"r�globalsr3�__members__r�rr�contextmanagerr1rrrrrrr��compilerrrGrD�ASCIIrbrjrlrxryr�r�r�rtrr��objectr�r�rr,rer�rBr rr2r	r
r5rr
rrrrrr�<module>/sz



0
	
h&d!#
S	
	ntpath.cpython-36.opt-2.pyc000064400000026021150335715140011435 0ustar003


 \6Z�'@s:dZdZdZdZdZdZdZdZddlZddl	Z	ddl
Z
ddlZdd	lTd
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0g'Zd1d2�Z
d3d
�Zd4d�Zd5d�Zd6d
�Zd7d!�Zd8d�Zd9d�Zejje_d:d�Zd;d�Zd<d�Zd=d�Zydd>lmZWnek
�r.dZYnXd?d�Zd@d�ZdAd�Z dBd�Z!dCdD�Z"yddElm#Z#Wnek
�r�e"Z$Yn
XdFd �Z$e$Z%e&e	dG��o�e	j'�dHdIkZ(dQdJd,�Z)dKd0�Z*y,e	j'�ddI�dRk�r�ddMlm+Z+ne�Wn"e,efk
�rdNdO�Z+YnXyddPlm-Z.Wnek
�r4YnXdS)S�.z..�\�;�/z.;C:\binZnul�N)�*�normcase�isabs�join�
splitdrive�split�splitext�basename�dirname�commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�ismount�
expanduser�
expandvars�normpath�abspath�splitunc�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenames�relpath�samefile�sameopenfile�samestat�
commonpathcCst|t�rdSdSdS)Ns\/z\/)�
isinstance�bytes)�path�r1�/usr/lib64/python3.6/ntpath.py�
_get_bothseps"s
r3cCsxtj|�}y.t|t�r&|jdd�j�S|jdd�j�SWn:ttfk
rrt|ttf�sltd|j	j
�d��YnXdS)N�/�\rrz0normcase() argument must be str or bytes, not %r)�os�fspathr.r/�replace�lower�	TypeError�AttributeError�str�	__class__�__name__)�sr1r1r2r,s

cCs2tj|�}t|�d}t|�dko0|dt|�kS)N�r)r6r7r
�lenr3)r?r1r1r2rCs
c

GsVtj|�}t|t�r"d}d}d}nd}d}d}y�|sD|dd�|t|�\}}x�ttj|�D]�}t|�\}}	|	r�|	d|kr�|s�|r�|}|	}q^n*|r�||kr�|j�|j�kr�|}|	}q^|}|r�|d
|kr�||}||	}q^W|�r|d|k�r|�r|dd�|k�r|||S||Sttt	fk
�rPt
jd	|f|���YnXdS)Nr5s\/�:rz\/�:rr@r	���rD)r6r7r.r/r
�mapr9r:r;�BytesWarning�genericpath�_check_arg_types)
r0�pathsr!�seps�colonZresult_driveZresult_path�pZp_driveZp_pathr1r1r2r	KsF


cCstj|�}t|�dk�rt|t�r0d}d}d}nd}d}d}|j||�}|dd�|dkr�|dd	�|kr�|j|d�}|dkr�|dd�|fS|j||d
�}||d
kr�|dd�|fS|dkr�t|�}|d|�||d�fS|d
d�|k�r|dd�|dd�fS|dd�|fS)
N�r5r4rBrrrCr�r@rDrD)r6r7rAr.r/r8�find)rLr!r$rKZnormp�indexZindex2r1r1r2r
zs.

$cCsFddl}|jdtd�t|�\}}t|�dkr>|dd�|fS||fS)Nrz<ntpath.splitunc is deprecated, use ntpath.splitdrive insteadrM)�warnings�warn�DeprecationWarningr
rA)rLrQ�driver0r1r1r2r�scCs|tj|�}t|�}t|�\}}t|�}x |rF||d|krF|d8}q(W|d|�||d�}}|j|�pn|}|||fS)Nr@)r6r7r3r
rA�rstrip)rLrJ�d�i�head�tailr1r1r2r�s
cCs8tj|�}t|t�r$tj|ddd�Stj|ddd�SdS)Nr5r4�.rrr)r6r7r.r/rG�	_splitext)rLr1r1r2r�s

cCst|�dS)Nr@)r)rLr1r1r2r
�scCst|�dS)Nr)r)rLr1r1r2r�scCs4ytj|�}Wnttfk
r&dSXtj|j�S)NF)r6�lstat�OSErrorr;�stat�S_ISLNK�st_mode)r0�str1r1r2r�s
cCs(ytj|�}Wntk
r"dSXdS)NFT)r6r\r])r0rar1r1r2rs
)�_getvolumepathnamecCsttj|�}t|�}t|�}t|�\}}|rD|d|krD|pB||kS||krPdStrl|j|�t|�j|�kSdSdS)NrTF)r6r7r3rr
rbrU)r0rJ�root�restr1r1r2rs
c
Cstj|�}t|t�rd}nd}|j|�s,|Sdt|�}}x$||kr^||t|�kr^|d7}q<Wdtjkrvtjd}n\dtjkr�tjd}nFdtjkr�|Sytjd}Wntk
r�d}YnXt	|tjd�}t|t�r�tj
|�}|dk�rt	t|�|d|��}|||d�S)	N�~�~r@�HOMEZUSERPROFILEZHOMEPATHZ	HOMEDRIVE�)r6r7r.r/�
startswithrAr3�environ�KeyErrorr	�fsencoder)r0�tilderW�n�userhomerTr1r1r2r5s2









cCs<tj|�}t|t�rhd|kr(d|kr(|Sddl}t|j|jdd�}d}d}d}d}d}ttd	d�}nFd
|kr|d|kr||Sddl}|j|jd}d}d}d
}d}d
}tj}|dd�}	d}
t	|�}�xn|
|k�r6||
|
d�}||k�r\||
dd�}t	|�}y&|j
|�}
|	||d|
d�7}	Wn*tk
�rV|	||7}	|d}
YnX�n�||k�rN||
d|
d�|k�r�|	|7}	|
d7}
n�||
dd�}t	|�}y|j
|�}
Wn*tk
�r�|	||7}	|d}
YnhX|d|
�}
y.|dk�rtjtjtj
|
��}n||
}Wn"tk
�r@||
|}YnX|	|7}	�n�||k�r$||
d|
d�|k�r�|	|7}	|
d7}
�q,||
d|
d�|k�rb||
dd�}t	|�}y|j
|�}
Wn.tk
�r�|	|||7}	|d}
YnlX|d|
�}
y.|dk�r&tjtjtj
|
��}n||
}Wn&tk
�rV|||
|}YnX|	|7}	n�|dd�}
|
d7}
||
|
d�}x6|�r�||k�r�|
|7}
|
d7}
||
|
d�}�q�Wy.|dk�r�tjtjtj
|
��}n||
}Wntk
�r
||
}YnX|	|7}	|�r,|
d8}
n|	|7}	|
d7}
q�W|	S)N�$�%rz_-�ascii�'�{�}�environb�$�%�'�{�}r@rM)r6r7r.r/�stringZ
ascii_lettersZdigits�getattrrjrArP�
ValueErrorrl�fsdecoderk)r0r|ZvarcharsZquoteZpercentZbraceZrbraceZdollarrj�resrPZpathlen�c�var�valuer1r1r2rgs�











c	Cs\tj|�}t|t�r*d}d}d}d}d}nd}d}d	}d
}d}|j|�rL|S|j||�}t|�\}}|j|�r�||7}|j|�}|j|�}d
}x�|t	|�k�r2||s�|||kr�||=q�|||k�r(|d
ko�||d|k�r||d|d�=|d8}n&|d
k�r|j
|��r||=n|d7}q�|d7}q�W|�rN|�rN|j|�||j|�S)Nr5r4rZs..�\\.\�\\?\rrrz..�\\.\�\\?\rr@)r�r�)r�r�)
r6r7r.r/rir8r
�lstriprrA�endswith�appendr	)	r0r!r$rr Zspecial_prefixes�prefix�compsrWr1r1r2r�sF








cCs@tj|�}t|�s8t|t�r&tj�}ntj�}t||�}t|�S)N)	r6r7rr.r/�getcwdb�getcwdr	r)r0�cwdr1r1r2�_abspath_fallback	s



r�)�_getfullpathnamecCs.ytt|��Sttfk
r(t|�SXdS)N)rr�r]r~r�)r0r1r1r2r!s�getwindowsversionrNrMcCsdtj|�}t|t�r"d}d}d}nd}d}d}|dkr:|}|sFtd��tj|�}y�tt|��}tt|��}t|�\}}t|�\}	}
t|�t|	�kr�td|	|f��d	d
�|j	|�D�}dd
�|
j	|�D�}d}
x0t
||�D]"\}}t|�t|�kr�P|
d
7}
q�W|gt|�|
||
d�}|�s(|St|�St
ttttfk
�r^tjd||��YnXdS)Nr5rZs..rrz..zno path specifiedz&path is on mount %r, start on mount %rcSsg|]}|r|�qSr1r1)�.0�xr1r1r2�
<listcomp>Jszrelpath.<locals>.<listcomp>cSsg|]}|r|�qSr1r1)r�r�r1r1r2r�Ksrr@r))r6r7r.r/r~rrr
rr�ziprAr	r:r;rFrSrGrH)r0�startr!rr Z	start_absZpath_absZstart_driveZ
start_restZ
path_driveZ	path_rest�
start_list�	path_listrWZe1Ze2�rel_listr1r1r2r).sF


cs�|std��tttj|��}t|dt�r8d�d�d�nd�d�d��y>��fd	d
�|D�}�fdd
�|D�}yt�fdd
�|D��\}Wntk
r�td�d�YnXttdd
�|D���dkr�td��t	|dj
����\}}|j��}�fdd
�|D�}�fdd
�|D�}t|�}t
|�}xBt|�D]&\}	}
|
||	k�r,|d|	�}P�q,W|dt|��}|�rt|�n|}|�j|�Sttfk
�r�tjd|���YnXdS)Nz%commonpath() arg is an empty sequencerr5r4rZrrrcs g|]}t|j���j���qSr1)r
r8r9)r�rL)r$r!r1r2r�wszcommonpath.<locals>.<listcomp>csg|]\}}|j���qSr1)r)r�rVrL)r!r1r2r�xsc3s"|]\}}|dd��kVqdS)Nr@r1)r�rVrL)r!r1r2�	<genexpr>{szcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathscss|]\}}|VqdS)Nr1)r�rVrLr1r1r2r��sr@zPaths don't have the same drivecsg|]}|r|�kr|�qSr1r1)r�r�)rr1r2r��scsg|]}�fdd�|D��qS)csg|]}|r|�kr|�qSr1r1)r�r�)rr1r2r��sz)commonpath.<locals>.<listcomp>.<listcomp>r1)r�r?)rr1r2r��sr-)r-)r~�tuplerEr6r7r.r/�setrAr
r8r�min�max�	enumerater	r:r;rGrH)rIZdrivesplits�split_pathsrrTr0�common�s1�s2rWr�r�r1)r$rr!r2r-fsF
�)�_getfinalpathnamecCstt|��S)N)rr)�fr1r1r2r��sr�)�_isdir)N)r�r)/rr r%r!r"r$r#r&r6�sysr^rG�__all__r3rrr	r
rrrr[�__doc__r
rrr�ntrb�ImportErrorrrrrr�r�rr'�hasattrr�r(r)r-r�r;r�rr1r1r1r2�<module>sz



/4

2q1

85types.cpython-36.opt-2.pyc000064400000015574150335715140011316 0ustar003


 \�"�@s�ddlZdd�Zee�Zedd��Zeej�Zeej�Zeej	�Z
dd�Zee��Zdd	�Z
e
�Z
ee
�Ze
j�d
d�Ze�Zee�ZGdd
�d
�Zee�j�Zee�Zegj�Zee�Zye�Wn8ek
r�ej�dZee�Zeej�ZdZ[YnXeej�Z eej!�Z"[[[[[
fddfdd�Z#fdfdd�Z$dd�Z%Gdd�d�Z&ddl'Z(ddl)j*Z+Gdd�d�Z,dd�Z-dd�e.�D�Z/dS)�NcCsdS)N�rrr�/usr/lib64/python3.6/types.py�_fsrcCsdS)Nrrrrr�<lambda>
srccs
dVdS)N�rrrrr�_gsrc�sdS)Nrrrrr�_csrcCs
dVdS)Nrrrrr�_agsr	c@seZdZdd�ZdS)�_CcCsdS)Nr)�selfrrr�_m!sz_C._mN)�__name__�
__module__�__qualname__rrrrrr
 sr
�cCs2t|||�\}}}|dk	r"||�||||f|�S)N)�
prepare_class)�name�bases�kwds�	exec_body�meta�nsrrr�	new_class9srcCs~|dkri}nt|�}d|kr*|jd�}n|r<t|d�}nt}t|t�rTt||�}t|d�rp|j||f|�}ni}|||fS)N�	metaclassr�__prepare__)�dict�pop�type�
isinstance�_calculate_meta�hasattrr)rrrrrrrrr@s


rcCsB|}x8|D]0}t|�}t||�r"q
t||�r2|}q
td��q
W|S)Nzxmetaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases)r�
issubclass�	TypeError)rr�winner�base�	base_metarrrr`s


rc@sHeZdZddd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�DynamicClassAttributeNcCs>||_||_||_|p|j|_|dk|_tt|dd��|_dS)N�__isabstractmethod__F)�fget�fset�fdel�__doc__�
overwrite_doc�bool�getattrr')rr(r)r*�docrrr�__init__}s
zDynamicClassAttribute.__init__cCs6|dkr|jr|St��n|jdkr,td��|j|�S)Nzunreadable attribute)r'�AttributeErrorr()r�instance�
ownerclassrrr�__get__�s
zDynamicClassAttribute.__get__cCs"|jdkrtd��|j||�dS)Nzcan't set attribute)r)r1)rr2�valuerrr�__set__�s
zDynamicClassAttribute.__set__cCs |jdkrtd��|j|�dS)Nzcan't delete attribute)r*r1)rr2rrr�
__delete__�s
z DynamicClassAttribute.__delete__cCs8|jr|jnd}t|�||j|j|p(|j�}|j|_|S)N)r,r+rr)r*)rr(�fdoc�resultrrr�getter�szDynamicClassAttribute.gettercCs$t|�|j||j|j�}|j|_|S)N)rr(r*r+r,)rr)r9rrr�setter�szDynamicClassAttribute.settercCs$t|�|j|j||j�}|j|_|S)N)rr(r)r+r,)rr*r9rrr�deleter�szDynamicClassAttribute.deleter)NNNN)N)
r
rrr0r4r6r7r:r;r<rrrrr&qs


	r&c@s�eZdZdd�Zdd�Zdd�Zdd�Zed	d
��Zedd��Z	ed
d��Z
edd��ZeZe	Z
e
ZeZdd�Zdd�ZeZdS)�_GeneratorWrappercCs2||_|jtk|_t|dd�|_t|dd�|_dS)Nr
r)�_GeneratorWrapper__wrapped�	__class__�
GeneratorType�_GeneratorWrapper__isgenr.r
r)r�genrrrr0�sz_GeneratorWrapper.__init__cCs|jj|�S)N)r>�send)r�valrrrrC�sz_GeneratorWrapper.sendcGs|jj|f|��S)N)r>�throw)r�tp�restrrrrE�sz_GeneratorWrapper.throwcCs
|jj�S)N)r>�close)rrrrrH�sz_GeneratorWrapper.closecCs|jjS)N)r>�gi_code)rrrrrI�sz_GeneratorWrapper.gi_codecCs|jjS)N)r>�gi_frame)rrrrrJ�sz_GeneratorWrapper.gi_framecCs|jjS)N)r>�
gi_running)rrrrrK�sz_GeneratorWrapper.gi_runningcCs|jjS)N)r>�gi_yieldfrom)rrrrrL�sz_GeneratorWrapper.gi_yieldfromcCs
t|j�S)N)�nextr>)rrrr�__next__�sz_GeneratorWrapper.__next__cCs|jr|jS|S)N)rAr>)rrrr�__iter__�sz_GeneratorWrapper.__iter__N)r
rrr0rCrErH�propertyrIrJrKrL�cr_code�cr_frame�
cr_running�cr_awaitrNrO�	__await__rrrrr=�sr=cs�t��std���jtkr�t�dd�jtkr��jj}|d@r@�S|d@r��j}t|j|j	|j
|j|jdB|j|j
|j|j|j|j|j|j|j|j��_�Stj���fdd��}|S)Nz$types.coroutine() expects a callable�__code__i�� �csT�||�}|jtks*|jtkr.|jjd@r.|St|tj�rPt|tj�rPt	|�S|S)NrX)
r?�
CoroutineTyper@rI�co_flagsr�_collections_abc�	Generator�	Coroutiner=)�args�kwargs�coro)�funcrr�wrapped�s

zcoroutine.<locals>.wrapped)�callabler"r?�FunctionTyper.�CodeTyperVrZ�co_argcount�co_kwonlyargcount�
co_nlocals�co_stacksize�co_code�	co_consts�co_names�co_varnames�co_filename�co_name�co_firstlineno�	co_lnotab�co_freevars�co_cellvars�
_functools�wraps)rarZ�corbr)rar�	coroutine�s(

rwcCs g|]}|dd�dkr|�qS)Nr�_r)�.0�nrrr�
<listcomp>
sr{)0�sysrrrd�
LambdaTyperVre�__dict__�MappingProxyType�implementation�SimpleNamespacerr@rrYrHr	�AsyncGeneratorTyper
r�
MethodType�len�BuiltinFunctionType�append�BuiltinMethodType�
ModuleTyper"�exc_info�tb�
TracebackType�tb_frame�	FrameType�GetSetDescriptorType�__globals__�MemberDescriptorTyperrrr&�	functoolsrt�collections.abc�abcr[r=rw�globals�__all__rrrr�<module>sP








 :
%7modulefinder.cpython-36.opt-2.pyc000064400000034201150335715140012613 0ustar003


 \�Y�@sddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	e	j
��e	jde�ddl
Z
WdQRXejdZejdZejdZejdZeefZejZiZdd�ZiZd	d
�ZGdd�d�ZGd
d�d�Zdd�Zedk�ry
e�ZWnek
�red�YnXdS)�N�ignore�
LOAD_CONST�IMPORT_NAME�
STORE_NAME�STORE_GLOBALcCstj|g�j|�dS)N)�packagePathMap�
setdefault�append)Zpackagename�path�r�$/usr/lib64/python3.6/modulefinder.py�AddPackagePath sr
cCs|t|<dS)N)�replacePackageMap)Zoldname�newnamerrr�ReplacePackage+src@seZdZddd�Zdd�ZdS)�ModuleNcCs(||_||_||_d|_i|_i|_dS)N)�__name__�__file__�__path__�__code__�globalnames�starimports)�self�name�filer
rrr�__init__1szModule.__init__cCsLd|jf}|jdk	r&|d|jf}|jdk	r@|d|jf}|d}|S)Nz	Module(%rz, %r�))rrr)r�srrr�__repr__>s

zModule.__repr__)NN)r�
__module__�__qualname__rrrrrrr/s

rc@s�eZdZddggfdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zd7dd�Z	d9dd�Z
dd�Zdd�Zd:dd�Z
dd�Zdd�Zdd�Zd d!�Zd<d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd=d,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)>�ModuleFinderNrcCsB|dkrtj}||_i|_i|_||_d|_||_||_g|_dS)Nr)	�sysr
�modules�
badmodules�debug�indent�excludes�
replace_paths�processed_paths)rr
r%r'r(rrrrIszModuleFinder.__init__cGs^||jkrZxt|j�D]}tddd�qWt|dd�x|D]}tt|�dd�q<Wt�dS)Nz   � )�end)r%�ranger&�print�repr)r�level�str�args�i�argrrr�msgUs

zModuleFinder.msgcGs,|d}||jkr(|jd|_|j|�dS)Nr�)r%r&r4)rr1r/rrr�msgin^s
zModuleFinder.msgincGs,|d}||jkr(|jd|_|j|�dS)Nrr5)r%r&r4)rr1r/rrr�msgoutds
zModuleFinder.msgoutcCsB|jdd|�t|��"}ddtjf}|jd|||�WdQRXdS)N��
run_script��r�__main__)r4�open�imp�	PY_SOURCE�load_module)r�pathname�fp�stuffrrrr9js
zModuleFinder.run_scriptcCsTtjj|�\}}tjj|�\}}t|��"}|dtjf}|j||||�WdQRXdS)Nr;)�osr
�split�splitextr=r>r?r@)rrA�dirrZextrBrCrrr�	load_fileps

zModuleFinder.load_filer5c	Cs\|jdd||||�|j||d�}|j||�\}}|j||�}|sF|S|jrX|j||�dS)N��import_hook)r/)r4�determine_parent�find_head_package�	load_tailr�ensure_fromlist)	rr�caller�fromlistr/�parent�q�tail�mrrrrJwszModuleFinder.import_hookcCs(|jdd||�|s|dkr.|jdd�dS|j}|dkr�|jrJ|d8}|dkrn|j|}|jdd|�|S|jd�|kr�td��dj|jd�d|��}|j|}|jdd|�|S|jr�|j|}|jdd|�|Sd|k�r|j	d�}|d|�}|j|}|jdd|�|S|jdd�dS)	N�rKrzdetermine_parent -> Noner5zdetermine_parent ->�.zrelative importpath too deep)
r6r7rrr#�count�ImportError�joinrE�rfind)rrOr/ZpnamerQr2rrrrK�s<





zModuleFinder.determine_parentcCs�|jdd||�d|kr@|jd�}|d|�}||dd�}n|}d}|r\d|j|f}n|}|j|||�}|r�|jdd||f�||fS|r�|}d}|j|||�}|r�|jdd||f�||fS|jdd|�td	|��dS)
NrUrLrVr5r:z%s.%szfind_head_package ->z"raise ImportError: No module namedzNo module named )r6�findr�
import_moduler7rX)rrQrr2�headrSZqnamerRrrrrL�s.
zModuleFinder.find_head_packagecCs�|jdd||�|}xz|r�|jd�}|dkr4t|�}|d|�||dd�}}d|j|f}|j|||�}|s|jdd|�td|��qW|jdd	|�|S)
NrUrMrVrr5z%s.%sz"raise ImportError: No module namedzNo module named zload_tail ->)r6r[�lenrr\r7rX)rrRrSrTr2r]ZmnamerrrrM�s
zModuleFinder.load_tailcCs�|jdd|||�xl|D]d}|dkrF|s||j|�}|r||j||d�qt||�sd|j|f}|j|||�}|std|��qWdS)NrUrN�*r5z%s.%szNo module named )r4�find_all_submodulesrN�hasattrrr\rX)rrTrP�	recursive�sub�all�subnameZsubmodrrrrN�s


zModuleFinder.ensure_fromlistc
Cs�|js
dSi}g}|tjjdd�7}|tjjdd�7}|tjjdd�7}x�|jD]�}ytj|�}Wn$tk
r�|j	dd|�wVYnXx\|D]T}d}x6|D].}t
|�}	||	d�|kr�|d|	�}Pq�W|r�|dkr�|||<q�WqVW|j�S)Nr8zcan't list directoryr)r�	importlib�	machinery�EXTENSION_SUFFIXES�SOURCE_SUFFIXES�BYTECODE_SUFFIXESrD�listdir�OSErrorr4r^�keys)
rrTr#�suffixesrG�namesr�modZsuff�nrrrr`�s.

z ModuleFinder.find_all_submodulescCs|jdd|||�y|j|}Wntk
r4YnX|jdd|�|S||jkrb|jdd�dS|r�|jdkr�|jdd�dSy|j||o�|j|�\}}}Wn"tk
r�|jddd�dSXz|j||||�}Wd|r�|j	�X|r�t
|||�|jdd|�|S)NrIr\zimport_module ->zimport_module -> None)r6r#�KeyErrorr7r$r�find_modulerXr@�close�setattr)rZpartname�fqnamerQrTrBrArCrrrr\�s6

zModuleFinder.import_modulecCs|\}}}|jdd||od|�|tjkrH|j||�}|jdd|�|S|tjkrht|j�d|d�}	nj|tjkr�yt	j
j|j��}
Wn:tk
r�}z|jddt
|�|��WYdd}~XnXtj|
�}	nd}	|j|�}||_|	�r
|jr�|j|	�}	|	|_|j|	|�|jdd|�|S)Nr8r@rBzload_module ->�
�execzraise ImportError: )r6r>Z
PKG_DIRECTORY�load_packager7r?�compile�readZPY_COMPILEDrf�_bootstrap_external�_validate_bytecode_headerrXr0�marshal�loads�
add_modulerr(�replace_paths_in_coder�	scan_code)rrvrBrA�	file_info�suffix�mode�typerT�coZmarshal_data�excrrrr@s2





zModuleFinder.load_modulecCs<||jkri|j|<|r*d|j||j<nd|j|d<dS)Nr5�-)r$r)rrrOrrr�_add_badmodule4s


zModuleFinder._add_badmodulecCs||jkr|j||�dSy|j|||d�Wn@tk
rn}z$|jddt|��|j||�WYdd}~Xn�X|�rx�|D]�}||jkr�|j||�q|y|j|||g|d�Wq|tk
r�}z0|jddt|��|d|}|j||�WYdd}~Xq|Xq|WdS)N)r/r8zImportError:rV)r$r�rJrXr4r0)rrrOrPr/r4rc�fullnamerrr�_safe_import_hook<s&


zModuleFinder._safe_import_hookccs�|j}|j}|j}dd�tj|�D�}x�t|�D]�\}\}}|tkrVd||ffVq0|tkr0|dkr0||dd||ddko�tknr0|||dd}	|||dd}
|	dkr�d|
||ffVq0d|	|
||ffVq0q0WdS)	NcSs"g|]\}}}|tkr||f�qSr)�EXTENDED_ARG)�.0�_�opr3rrr�
<listcomp>Xsz-ModuleFinder.scan_opcodes.<locals>.<listcomp>�storer8r5r�absolute_import�relative_import)	�co_code�co_names�	co_consts�disZ_unpack_opargs�	enumerate�	STORE_OPSrr)rr��codero�constsZopargsr2r�Zopargr/rPrrr�scan_opcodesSs 0zModuleFinder.scan_opcodescCs�|j}|j}�xT||�D�]F\}}|dkr<|\}d|j|<q|dk�r|\}}d}	|dk	rtd|krfd}	dd�|D�}|j|||dd�|	�r`d}
|jr�|jj|jd	|�}
|
dkr�|jj|�}
|
dk	r�|jj|
j�|j	j|
j	�|
j
dkr�d|j	|<n
d|j	|<q|d
k�rX|\}}}|�r4|j||||d�n"|j||d�}|j|jd|dd�qt|��qWx,|j
D]"}
t|
t|���rl|j|
|��qlWdS)Nr�r5r�rr_cSsg|]}|dkr|�qS)r_r)r��frrrr�usz*ModuleFinder.scan_code.<locals>.<listcomp>)r/rVr�)r�r�rr�rr#�getr�updaterrrK�RuntimeErrorr��
isinstancer�r�)rr�rTr��scannerZwhatr1rrPZ	have_starZmmr/rQ�crrrr�hsH



zModuleFinder.scan_codecCs�|jdd||�tj|�}|r"|}|j|�}||_|g|_|jtj|g�|_|jd|j�\}}}z"|j||||�|j	dd|�|S|r�|j
�XdS)Nr8ryrzload_package ->)r6rr�r�rrrrsr@r7rt)rrvrArrTrBZbufrCrrrry�s

zModuleFinder.load_packagecCs*||jkr|j|St|�|j|<}|S)N)r#r)rrvrTrrrr��s

zModuleFinder.add_modulecCsr|dk	r|jd|}n|}||jkr<|jdd|�t|��|dkrf|tjkr`ddddtjffS|j}tj	||�S)NrVrIzfind_module -> Excludedr:)
rr'r7rXr"�builtin_module_namesr>Z	C_BUILTINr
rs)rrr
rQr�rrrrs�s

zModuleFinder.find_modulecCs"t�tdd�tdd�t|jj��}xJ|D]B}|j|}|jrTtddd�ntddd�td	||jppd
�q2W|j�\}}|r�t�td�x2|D]*}t|j|j��}td|d
dj|��q�W|�rt�tddd�td�x2|D]*}t|j|j��}td|d
dj|��q�WdS)Nz
  %-25s %s�Name�File�----�Pr*)r+rTz%-25sr:zMissing modules:�?z
imported fromz, z7Submodules that appear to be missing, but could also bez#global names in the parent package:)r�r�)r�r�)	r-�sortedr#rmrr�any_missing_mayber$rY)rrm�keyrT�missing�mayberZmodsrrr�report�s0



zModuleFinder.reportcCs|j�\}}||S)N)r�)rr�r�rrr�any_missing�szModuleFinder.any_missingcCs�g}g}x�|jD]�}||jkr q|jd�}|dkr>|j|�q||dd�}|d|�}|jj|�}|dk	r�||j|kr�|j|�q�||jkr�q�|jr�|j|�q�|j|�q|j|�qW|j�|j�||fS)NrVrr5)	r$r'rZr	r#r�rr�sort)rr�r�rr2reZpkgnameZpkgrrrr��s0	



zModuleFinder.any_missing_maybecCstjj|j�}}x2|jD](\}}|j|�r||t|�d�}PqW|jr�||jkr�||krt|j	dd||f�n|j	dd|f�|jj
|�t|j�}x8t
t|��D](}t||t|��r�|j||�||<q�Wtj|j|j|j|j|j|jt|�|j|j||j|j|j|j|j �S)Nr8zco_filename %r changed to %rz co_filename %r remains unchanged)!rDr
�normpath�co_filenamer(�
startswithr^r%r)r7r	�listr�r,r�r�r��types�CodeType�co_argcount�co_kwonlyargcount�
co_nlocals�co_stacksize�co_flagsr��tupler��co_varnames�co_name�co_firstlineno�	co_lnotab�co_freevars�co_cellvars)rr�Znew_filenameZoriginal_filenamer�r;r�r2rrrr�s,



z"ModuleFinder.replace_paths_in_code���)NNr�r�)r�)rr�)r�)N)rrr rr4r6r7r9rHrJrKrLrMrNr`r\r@r�r�r�r�ryr�rsr�r�r�r�rrrrr!Gs2	

#

1
".r!cCs�ddl}y|jtjdd�d�\}}Wn*|jk
rP}zt|�dSd}~XnXd}d}g}g}xb|D]Z\}}	|dkr�|d}|dkr�d}|dkr�||	jtj�}|dkr�d}|dkrh|j|	�qhW|s�d	}
n|d}
tj	dd�}tj	j
|
�|d<||}|dk�r.td
�x|D]}tdt|���qWt|||�}
xp|dd�D]`}|dk�r^d}�qH|�r�|dd�d
k�r�|
j
|dd�ddg�n
|
j
|�n
|
j|��qHW|
j|
�|
j�|
S)Nrr5zdmp:qx:z-dz-mz-pz-qz-xzhello.pyzpath:z   r8z.*r_���r�)�getoptr"�argv�errorr-rErD�pathsepr	r
�dirnamer.r!rJrHr9r�)r�Zoptsr1r4r%ZdomodsZaddpathZexclude�o�aZscriptr
�item�mfr3rrr�test:sX



r�r<z
[interrupted]) r�Zimportlib._bootstrap_externalrf�importlib.machineryr~rDr"r�Zstruct�warnings�catch_warnings�simplefilter�DeprecationWarningr>Zopmaprrrrr�r�rr
rrrr!r�rr��KeyboardInterruptr-rrrr�<module>s@




v;

hashlib.cpython-36.opt-2.pyc000064400000012320150335715140011546 0ustar003

�\dh_"�$@sfdZd$Zee�Zee�Zed%ZyddlmZWne	k
rLdd�ZYnXe�s`iZ
dd�Zdd�Ze�sxd&dd�Z
d'dd�Zy dd lZeZeZejej�ZWn$e	k
r�e�r��e
ZeZYnXdd!lmZydd"lmZWne	k
�r�YnXxLeD]DZyee�e�e<Wn*ek
�rBdd lZejd#e�YnX�qW[[[[[ej��s`[
[d S)(a3hashlib module - A common interface to many hash functions.

new(name, data=b'', **kwargs) - returns a new hash object implementing the
                                given hash function; initializing the hash
                                using the given binary data.

Named constructor functions are also available, these are faster
than using new(name):

md5(), sha1(), sha224(), sha256(), sha384(), sha512(), blake2b(), blake2s(),
sha3_224, sha3_256, sha3_384, sha3_512, shake_128, and shake_256.

More algorithms may be available on your platform but the above are guaranteed
to exist.  See the algorithms_guaranteed and algorithms_available attributes
to find out what algorithm names can be passed to new().

NOTE: If you want the adler32 or crc32 hash functions they are available in
the zlib module.

Choose your hash function wisely.  Some have known collision weaknesses.
sha384 and sha512 will be slow on 32 bit platforms.

Hash objects have these methods:
 - update(data): Update the hash object with the bytes in data. Repeated calls
                 are equivalent to a single call with the concatenation of all
                 the arguments.
 - digest():     Return the digest of the bytes passed to the update() method
                 so far as a bytes object.
 - hexdigest():  Like digest() except the digest is returned as a string
                 of double length, containing only hexadecimal digits.
 - copy():       Return a copy (clone) of the hash object. This can be used to
                 efficiently compute the digests of datas that share a common
                 initial substring.

For example, to obtain the digest of the byte string 'Nobody inspects the
spammish repetition':

    >>> import hashlib
    >>> m = hashlib.md5()
    >>> m.update(b"Nobody inspects")
    >>> m.update(b" the spammish repetition")
    >>> m.digest()
    b'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9'

More condensed:

    >>> hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest()
    'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2'

�md5�sha1�sha224�sha256�sha384�sha512�blake2b�blake2s�sha3_224�sha3_256�sha3_384�sha3_512�	shake_128�	shake_256�new�algorithms_guaranteed�algorithms_available�pbkdf2_hmac�)�
get_fips_modecCsdS)Nr�rrr�/usr/lib64/python3.6/hashlib.py�_hashlib_get_fips_modeIsrc	
Cs�t}|j|�}|dk	r|S�y2|dkrDddl}|j|d<|d<�n|dkrjddl}|j|d<|d<�n�|dkr�ddl}|j|d<|d	<|j|d<|d<n�|dkr�ddl	}|j
|d<|d
<|j|d
<|d<nv|dk�r�ddl}|j
|d<|j|d<nN|dk�rLddl}|j|d<|j|d<|j|d<|j|d<|j|d<|j|d<Wntk
�rdYnX|j|�}|dk	�r~|Std|��dS)N�SHA1rr�MD5r�SHA256r�SHA224r�SHA512r�SHA384rrrr	r
rrr
rzunsupported hash type )rr)rr)rrrr)rrrr)rr>rr	rr
r
r)�__builtin_constructor_cache�get�_sha1r�_md5r�_sha256rr�_sha512rr�_blake2rr�_sha3r	r
rrr
r�ImportError�
ValueError)	�name�cache�constructorr r!r"r#r$r%rrr�__get_builtin_constructorPsL









r+cCsZtj�s|dkrt|�Sy ttd|�}tj�s6|�|Sttfk
rTt|�SXdS)Nrrrr
Zopenssl_>r
rrr)�_hashlibrr+�getattr�AttributeErrorr')r(�frrr�__get_openssl_constructor{sr0�cKst|�|f|�S)N)r+)r(�data�kwargsrrr�__py_new�sr4cKs�tj�r(|}ddddddd�j||�}n|d
kr@t|�|f|�Sy:|jd
d�}tj|||d�}tj�rx||krx|j|�|Stk
r�tj�r��t|�|�SXdS)Nzsha3-224zsha3-256zsha3-384zsha3-512Zshake128Zshake256)r	r
rrr
rrr�usedforsecurityT)r5>rr)r,rrr+�poprZ	_set_namer')r(r2r3Z	orig_namer5Zretvalrrr�
__hash_new�s,

r7N)r)�scryptzcode for hash %s was not found.)rrrrrrrrr	r
rrr
r)rrrr)r1)r1)�__doc__Z__always_supported�setrr�__all__r,rrr&rr+r0r4r7rZ
__get_hash�unionZopenssl_md_meth_namesrr8Z__func_name�globalsr'ZloggingZ	exceptionrrrr�<module>6s\+

'


tty.cpython-36.opt-2.pyc000064400000001715150335715140010762 0ustar003


 \o�@sHddlTddgZdZdZdZdZdZdZd	Ze	fd
d�Z
e	fdd�ZdS)
�)�*�setraw�	setcbreak������cCs�t|�}|tttBtBtBtB@|t<|tt@|t<|t	t
tB@|t	<|t	tB|t	<|t
ttBtBtB@|t
<d|tt<d|tt<t|||�dS)Nrr)�	tcgetattr�IFLAGZBRKINTZICRNLZINPCKZISTRIPZIXON�OFLAGZOPOST�CFLAGZCSIZEZPARENBZCS8�LFLAG�ECHO�ICANONZIEXTENZISIG�CC�VMIN�VTIME�	tcsetattr)�fd�when�mode�r�/usr/lib64/python3.6/tty.pyrs"cCsFt|�}|tttB@|t<d|tt<d|tt<t|||�dS)Nrr)rrrrrrrr)rrrrrrrs
N)Ztermios�__all__rr
rrZISPEEDZOSPEEDrZ	TCSAFLUSHrrrrrr�<module>santigravity.cpython-36.opt-1.pyc000064400000001415150335715140012477 0ustar003


 \��@s&ddlZddlZejd�dd�ZdS)�Nzhttps://xkcd.com/353/cCs\tj|�j�}dd�|dd�|dd�fD�\}}td||dd�||dd�f�dS)z�Compute geohash() using the Munroe algorithm.

    >>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
    37.857713 -122.544543

    cSsg|]}dtjd|��qS)z%fz0.)�float�fromhex)�.0�x�r�#/usr/lib64/python3.6/antigravity.py�
<listcomp>szgeohash.<locals>.<listcomp>N�� z	%d%s %d%s�)�hashlibZmd5Z	hexdigest�print)ZlatitudeZ	longitudeZdatedow�h�p�qrrr�geohashs&r)Z
webbrowserr�openrrrrr�<module>s
pathlib.cpython-36.pyc000064400000117556150335715140010640 0ustar003

�\dh���@s$ddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
mZmZmZddlmZddlmZmZmZmZmZmZmZddlmZdZd	d
ddd
dgZdZ dZ!dZ"dd�Z#Gdd�de$�Z%Gdd�de%�Z&Gdd�de%�Z'e&�Z(e'�Z)Gdd�d�Z*Gdd�de*�Z+e+�Z,dd�Z-e.ed ��rTej/�e-�Z-Gd!d"�d"�Z0Gd#d$�d$�Z1Gd%d&�d&e0�Z2Gd'd(�d(e0�Z3Gd)d*�d*e0�Z4Gd+d,�d,e	�Z5Gd-d	�d	e$�Z6ej7j8e6�Gd.d
�d
e6�Z9Gd/d�de6�Z:Gd0d�de6�Z;Gd1d
�d
e;e9�Z<Gd2d�de;e:�Z=dS)3�N)�Sequence)�contextmanager)�EINVAL�ENOENT�ENOTDIR�ELOOP)�
attrgetter)�S_ISDIR�S_ISLNK�S_ISREG�S_ISSOCK�S_ISBLK�S_ISCHR�S_ISFIFO)�quote_from_bytesT�PurePath�
PurePosixPath�PureWindowsPath�Path�	PosixPath�WindowsPath��{i�cCsd|kpd|kpd|kS)N�*�?�[�)�patrr�/usr/lib64/python3.6/pathlib.py�_is_wildcard_pattern"src@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_FlavourzPA flavour implements a particular (platform-specific) set of path
    semantics.cCs|jj|_dS)N)�sep�join)�selfrrr�__init__,sz_Flavour.__init__cCs g}|j}|j}d}}t|�}x�|D]�}|s0q&|r@|j||�}|j|�\}}}	||	kr�xPt|	j|��D] }
|
rh|
dkrh|jtj|
��qhWn|	r�|	dkr�|jtj|	��|s�|r&|s�x6|D].}|s�q�|r�|j||�}|j|�d}|r�Pq�WPq&W|�s|�r|j||�|j	�|||fS)N��.r)
r!�altsep�reversed�replace�	splitroot�split�append�sys�intern�reverse)r#�partsZparsedr!r'�drv�root�it�partZrel�xrrr�parse_parts/s@

z_Flavour.parse_partscCs||r,|rr|rr||||g|dd�fSnF|rd||ksL|j|�|j|�krr||||dd�fSn||||fS|||fS)z�
        Join the two paths represented by the respective
        (drive, root, parts) tuples.  Return a new (drive, root, parts) tuple.
        �N)�casefold)r#r1r2r0Zdrv2Zroot2Zparts2rrr�join_parsed_partsUs
z_Flavour.join_parsed_partsN)�__name__�
__module__�__qualname__�__doc__r$r6r9rrrrr (s&r c@s�eZdZdZdZdZeZej	dkZ
edd�ee
d�e
d�d	�D��ed
d�ee
d�e
d�d	�D��BZd
Zddddhdd�ed	d�D�Bdd�ed	d�D�BZefdd�Zdd�Zdd�Zefdd�Zdd�Zd d!�Zd"d#�Zd$S)%�_WindowsFlavour�\�/T�ntccs|]}t|�VqdS)N)�chr)�.0r5rrr�	<genexpr>ssz_WindowsFlavour.<genexpr>�a�zr7ccs|]}t|�VqdS)N)rB)rCr5rrrrDts�A�Zz\\?\ZCONZPRNZAUXZNULcCsh|]}d|�qS)zCOM%dr)rC�irrr�	<setcomp>zsz_WindowsFlavour.<setcomp>�
cCsh|]}d|�qS)zLPT%dr)rCrIrrrrJ{scCsb|dd�}|dd�}||krP||krP|j|�\}}|dd�}|dd�}nd}|dd�}||kov||kov||k�r|j|d�}|dk�r|j||d�}||dk�r|dkr�t|�}|r�||d|�|||dd�fS|d|�|||dd�fSd}	}
|dk�r<||jk�r<|dd�}	|dd�}|}||k�rT|}
|j|�}||	|
|fS)	Nrr7�r%��:���rO)�_split_extended_path�find�len�
drive_letters�lstrip)r#r4r!�first�second�prefixZthird�indexZindex2r1r2rrrr*�s6
"

z_WindowsFlavour.splitrootcCs|j�S)N)�lower)r#�srrrr8�sz_WindowsFlavour.casefoldcCsdd�|D�S)NcSsg|]}|j��qSr)rY)rC�prrr�
<listcomp>�sz2_WindowsFlavour.casefold_parts.<locals>.<listcomp>r)r#r0rrr�casefold_parts�sz_WindowsFlavour.casefold_partscCsXd}|j|�rP|dd�}|dd�}|jd�rP||dd�7}d|dd�}||fS)Nr%�zUNC\rMr?)�
startswith)r#rZZ
ext_prefixrWrrrrP�s

z$_WindowsFlavour._split_extended_pathcCs6|sdS|djd�rdS|djd�dj�|jkS)NFrz\\r7r&rO)r_�	partition�upper�reserved_names)r#r0rrr�is_reserved�s
z_WindowsFlavour.is_reservedcCsd|j}t|�dkrJ|ddkrJ|j�dd�jd�}d|t|jd��fSdt|j�jd��SdS)NrLr7rNr@z
file:///%s/%szutf-8zfile:)�driverR�as_posixrT�urlquote_from_bytes�encode)r#�pathrd�restrrr�make_uri�sz_WindowsFlavour.make_uric
Cs�dtjkrtjd}n`dtjkr,tjd}nJdtjkrnytjd}Wntk
r\d}YnX|tjd}ntd��|r�tjd|kr�|j|f�\}}}|d
tjdkr�td	|��||d<|s�|r�|||j|dd��}n
|j|�}|S)N�HOMEZUSERPROFILEZHOMEPATHZ	HOMEDRIVEr%zCan't determine home directoryZUSERNAMEr7z%Can't determine home directory for %rrOrO)�os�environ�KeyError�RuntimeErrorr6r")r#�username�userhomer1r2r0rrr�
gethomedir�s,




z_WindowsFlavour.gethomedirN)r:r;r<r!r'�has_drv�ntpath�pathmodrl�name�is_supported�set�range�ordrSZext_namespace_prefixrbr*r8r]rPrcrjrrrrrrr>gs"
"&	'
r>c@sZeZdZdZdZdZeZej	dkZ
efdd�Zdd�Zd	d
�Z
dd�Zd
d�Zdd�ZdS)�
_PosixFlavourr@r%FrAcCsV|rH|d|krH|j|�}t|�t|�dkr<d|d|fSd||fSn
dd|fSdS)NrrLr%)rTrR)r#r4r!Z
stripped_partrrrr*�s
z_PosixFlavour.splitrootcCs|S)Nr)r#rZrrrr8	sz_PosixFlavour.casefoldcCs|S)Nr)r#r0rrrr]sz_PosixFlavour.casefold_partscCsdS)NFr)r#r0rrrrcsz_PosixFlavour.is_reservedcCst|�}dt|�S)Nzfile://)�bytesrf)r#rhZbpathrrrrjsz_PosixFlavour.make_uricCst|s:y
tjdStk
r6ddl}|jtj��jSXn6ddl}y|j|�jStk
rntd|��YnXdS)Nrkrz%Can't determine home directory for %r)	rlrmrn�pwd�getpwuid�getuid�pw_dir�getpwnamro)r#rpr}rrrrrs
z_PosixFlavour.gethomedirN)r:r;r<r!r'rs�	posixpathrurlrvrwr*r8r]rcrjrrrrrrr{�s
r{c@seZdZdZdS)�	_AccessorzjAn accessor implements a particular (system-specific or not) way of
    accessing paths on the filesystem.N)r:r;r<r=rrrrr�,sr�c@s�eZdZdd�Zdd�Zeej�Zeej�Zeej�Zeej	�Z	eej
�Z
eej�Zeed�rjeej
�Z
ndd�Z
eej�Zeej�Zeej�Zeej�Zeej�Zeed�r�ejZn
dd
d�Zeej�Zdd
�ZejZeejj�Zeejj�ZdS)�_NormalAccessorcstj���fdd��}t|�S)Ncs�t|�f|��S)N)�str)�pathobj�args)�strfuncrr�wrapped4sz._NormalAccessor._wrap_strfunc.<locals>.wrapped)�	functools�wraps�staticmethod)r�r�r)r�r�
_wrap_strfunc3sz_NormalAccessor._wrap_strfunccstj���fdd��}t|�S)Ncs�t|�t|�f|��S)N)r�)ZpathobjAZpathobjBr�)r�rrr�:sz5_NormalAccessor._wrap_binary_strfunc.<locals>.wrapped)r�r�r�)r�r�r)r�r�_wrap_binary_strfunc9sz$_NormalAccessor._wrap_binary_strfunc�lchmodcCstd��dS)Nz%lchmod() not available on this system)�NotImplementedError)r#r��moderrrr�Nsz_NormalAccessor.lchmod�symlinkFcCstd��dS)Nz)os.symlink() not available on this system)r�)r#�src�dst�target_is_directoryrrrr�^sz_NormalAccessor.symlinkcCs
tj|�S)N)rl�readlink)r#rhrrrr�esz_NormalAccessor.readlinkN)F)r:r;r<r�r�rl�stat�lstat�open�listdir�scandir�chmod�hasattrr��mkdir�unlink�rmdir�renamer)r��utimer��getcwdr�rh�
expanduser�realpathrrrrr�1s0














r�cCsP|d}|dd�}|dkr"t}n$d|kr4td��nt|�rBt}nt}|||�S)Nrr7z**z:Invalid pattern: '**' can only be an entire path component)�_RecursiveWildcardSelector�
ValueErrorr�_WildcardSelector�_PreciseSelector)�
pattern_partsr�child_parts�clsrrr�_make_selectorvs
r��	lru_cachec@s eZdZdZdd�Zdd�ZdS)�	_SelectorzYA selector matches a specific glob pattern part against the children
    of a given path.cCs.||_|rt|�|_d|_nt�|_d|_dS)NTF)r�r��	successor�dironly�_TerminatingSelector)r#r�rrrr$�s
z_Selector.__init__cCs<t|�}|j}|j}|jj}||�s,tg�S|j||||�S)zuIterate over all child paths of `parent_path` matched by this
        selector.  This can contain parent_path itself.)�type�is_dir�exists�	_accessorr��iter�_select_from)r#�parent_pathZpath_clsr�r�r�rrr�select_from�sz_Selector.select_fromN)r:r;r<r=r$r�rrrrr��s	r�c@seZdZdd�ZdS)r�ccs
|VdS)Nr)r#r�r�r�r�rrrr��sz!_TerminatingSelector._select_fromN)r:r;r<r�rrrrr��sr�c@seZdZdd�Zdd�ZdS)r�cCs||_tj||�dS)N)rvr�r$)r#rvr�rrrr$�sz_PreciseSelector.__init__ccs^yD|j|j�}|jr|n||�rBx |jj||||�D]
}|Vq4WWntk
rXdSXdS)N)�_make_child_relpathrvr�r�r��PermissionError)r#r�r�r�r�rhr[rrrr��sz_PreciseSelector._select_fromN)r:r;r<r$r�rrrrr��sr�c@seZdZdd�Zdd�ZdS)r�cCs"tjtj|��|_tj||�dS)N)�re�compile�fnmatch�	translaterr�r$)r#rr�rrrr$�sz_WildcardSelector.__init__ccs�y||jj}t||��}xb|D]Z}|js0|j�r|j}||�}	|jj|	�r|j|�}
x |j	j
|
|||�D]
}|VqhWqWWntk
r�dSXdS)N)�_flavourr8�listr�r�rvr�matchr�r�r�r�)r#r�r�r�r��cf�entries�entryrvZ
casefoldedrhr[rrrr��s

z_WildcardSelector._select_fromN)r:r;r<r$r�rrrrr��sr�c@s$eZdZdd�Zdd�Zdd�ZdS)r�cCstj||�dS)N)r�r$)r#rr�rrrr$�sz#_RecursiveWildcardSelector.__init__ccsz|VyZt||��}xH|D]@}|j�r|j�r|j|j�}x|j|||�D]
}|VqLWqWWntk
rtdSXdS)N)r�r��
is_symlinkr�rv�_iterate_directoriesr�)r#r�r�r�r�r�rhr[rrrr��s
z/_RecursiveWildcardSelector._iterate_directoriesc	cs�yjt�}zT|jj}xF|j|||�D]4}x.|||||�D]}||kr6|V|j|�q6Wq"WWd|j�XWntk
r~dSXdS)N)rxr�r�r��add�clearr�)	r#r�r�r�r�ZyieldedZsuccessor_selectZstarting_pointr[rrrr��sz'_RecursiveWildcardSelector._select_fromN)r:r;r<r$r�r�rrrrr��sr�c@s4eZdZdZdZdd�Zdd	�Zd
d�Zdd
�ZdS)�_PathParentszvThis object provides sequence-like access to the logical ancestors
    of a path.  Don't try to construct it yourself.�_pathcls�_drv�_root�_partscCs&t|�|_|j|_|j|_|j|_dS)N)r�r�r�r�r�)r#rhrrrr$�s
z_PathParents.__init__cCs(|js|jrt|j�dSt|j�SdS)Nr7)r�r�rRr�)r#rrr�__len__�sz_PathParents.__len__cCs@|dks|t|�krt|��|jj|j|j|jd|d��S)Nrr7)rR�
IndexErrorr��_from_parsed_partsr�r�r�)r#�idxrrr�__getitem__sz_PathParents.__getitem__cCsdj|jj�S)Nz<{}.parents>)�formatr�r:)r#rrr�__repr__
sz_PathParents.__repr__N)r�r�r�r�)	r:r;r<r=�	__slots__r$r�r�r�rrrrr��sr�c@s�eZdZdZdZZd	d
�Zdd�Zed
d��Zed[dd��Z	ed\dd��Z
edd��Zdd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zed&d'��Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zeed�d4d5�Zeed�d6d5�Zed7d8��Zed9d:��Z ed;d<��Z!ed=d>��Z"ed?d@��Z#dAdB�Z$dCdD�Z%dEdF�Z&edGdH��Z'dIdJ�Z(dKdL�Z)dMdN�Z*edOdP��Z+edQdR��Z,dSdT�Z-dUdV�Z.dWdX�Z/dYS)]ra|Base class for manipulating paths without I/O.

    PurePath represents a filesystem path and offers operations which
    don't imply any actual filesystem I/O.  Depending on your system,
    instantiating a PurePath will return either a PurePosixPath or a
    PureWindowsPath object.  You can also instantiate either of these classes
    directly, regardless of your system.
    r�r�r��_str�_hash�_pparts�_cached_cpartscGs$|tkrtjdkrtnt}|j|�S)z�Construct a PurePath from one or several strings and or existing
        PurePath objects.  The strings and path objects are combined so as
        to yield a canonicalized path, which is incorporated into the
        new PurePath object.
        rA)rrlrvrr�_from_parts)r�r�rrr�__new__szPurePath.__new__cCs|jt|j�fS)N)�	__class__�tupler�)r#rrr�
__reduce__&szPurePath.__reduce__cCshg}xV|D]N}t|t�r$||j7}q
tj|�}t|t�rH|jt|��q
tdt|���q
W|j	j
|�S)NzNargument should be a str object or an os.PathLike object returning str, not %r)�
isinstancerr�rl�fspathr�r,�	TypeErrorr�r�r6)r�r�r0rErrr�_parse_args+s



zPurePath._parse_argsTcCs<tj|�}|j|�\}}}||_||_||_|r8|j�|S)N)�objectr�r�r�r�r��_init)r�r��initr#r1r2r0rrrr�?s
zPurePath._from_partscCs,tj|�}||_||_||_|r(|j�|S)N)r�r�r�r�r�r�)r�r1r2r0r�r#rrrr�Ls
zPurePath._from_parsed_partscCs4|s|r$|||jj|dd��S|jj|�SdS)Nr7)r�r")r�r1r2r0rrr�_format_parsed_partsVszPurePath._format_parsed_partscCsdS)Nr)r#rrrr�]szPurePath._initcCs@|j|�\}}}|jj|j|j|j|||�\}}}|j|||�S)N)r�r�r9r�r�r�r�)r#r�r1r2r0rrr�_make_childaszPurePath._make_childcCs<y|jStk
r6|j|j|j|j�p,d|_|jSXdS)z[Return the string representation of the path, suitable for
        passing to system calls.r&N)r��AttributeErrorr�r�r�r�)r#rrr�__str__gszPurePath.__str__cCst|�S)N)r�)r#rrr�
__fspath__qszPurePath.__fspath__cCs|j}t|�j|jd�S)zNReturn the string representation of the path with forward (/)
        slashes.r@)r�r�r)r!)r#�frrrretszPurePath.as_posixcCstjt|��S)zaReturn the bytes representation of the path.  This is only
        recommended to use under Unix.)rl�fsencoder�)r#rrr�	__bytes__zszPurePath.__bytes__cCsdj|jj|j��S)Nz{}({!r}))r�r�r:re)r#rrrr�szPurePath.__repr__cCs|j�std��|jj|�S)z Return the path as a 'file' URI.z.relative path can't be expressed as a file URI)�is_absoluter�r�rj)r#rrr�as_uri�szPurePath.as_uricCs2y|jStk
r,|jj|j�|_|jSXdS)N)r�r�r�r]r�)r#rrr�_cparts�s
zPurePath._cpartscCs&t|t�stS|j|jko$|j|jkS)N)r�r�NotImplementedr�r�)r#�otherrrr�__eq__�s
zPurePath.__eq__cCs2y|jStk
r,tt|j��|_|jSXdS)N)r�r��hashr�r�)r#rrr�__hash__�s
zPurePath.__hash__cCs(t|t�s|j|jk	rtS|j|jkS)N)r�rr�r�r�)r#r�rrr�__lt__�szPurePath.__lt__cCs(t|t�s|j|jk	rtS|j|jkS)N)r�rr�r�r�)r#r�rrr�__le__�szPurePath.__le__cCs(t|t�s|j|jk	rtS|j|jkS)N)r�rr�r�r�)r#r�rrr�__gt__�szPurePath.__gt__cCs(t|t�s|j|jk	rtS|j|jkS)N)r�rr�r�r�)r#r�rrr�__ge__�szPurePath.__ge__z.The drive prefix (letter or UNC path), if any.)�doczThe root of the path, if any.cCs|j|j}|S)z/The concatenation of the drive and root, or ''.)r�r�)r#�anchorrrrr��szPurePath.anchorcCs.|j}t|�|js|jrdndkr&dS|dS)z!The final path component, if any.r7rr%rO)r�rRr�r�)r#r0rrrrv�sz
PurePath.namecCsD|j}|jd�}d|ko*t|�dknr<||d�SdSdS)z*The final component's last suffix, if any.r&rr7Nr%)rv�rfindrR)r#rvrIrrr�suffix�s

 zPurePath.suffixcCs:|j}|jd�rgS|jd�}dd�|jd�dd�D�S)z1A list of the final component's suffixes, if any.r&cSsg|]}d|�qS)r&r)rCr�rrrr\�sz%PurePath.suffixes.<locals>.<listcomp>r7N)rv�endswithrTr+)r#rvrrr�suffixes�s


zPurePath.suffixescCsD|j}|jd�}d|ko*t|�dknr<|d|�S|SdS)z0The final path component, minus its last suffix.r&rr7N)rvr�rR)r#rvrIrrr�stem�s

 z
PurePath.stemcCs�|jstd|f��|jj|f�\}}}|sZ|d|jj|jjgksZ|sZ|sZt|�dkrftd|��|j|j|j	|j
dd�|g�S)z-Return a new path with the file name changed.z%r has an empty namer7zInvalid name %rNrOrO)rvr�r�r6r!r'rRr�r�r�r�)r#rvr1r2r0rrr�	with_name�szPurePath.with_namecCs�|j}|j|ks |jr,|j|kr,td|��|r<|jd�sD|dkrPtd|��|j}|shtd|f��|j}|s|||}n|dt|��|}|j|j	|j
|jdd�|g�S)z�Return a new path with the file suffix changed.  If the path
        has no suffix, add given suffix.  If the given suffix is an empty
        string, remove the suffix from the path.
        zInvalid suffix %rr&z%r has an empty nameNr7rO)r�r!r'r�r_rvr�rRr�r�r�r�)r#r�r�rvZ
old_suffixrrr�with_suffix�s
zPurePath.with_suffixc
Gs�|std��|j}|j}|j}|r8||g|dd�}n|}|j|�\}}}|rf||g|dd�}	n|}	t|	�}
|jj}|
dkr�|p�|n||d|
��||	�kr�|j|||�}t	dj
t|�t|����|jd|
dkr�|nd||
d��S)z�Return the relative path to another path identified by the passed
        arguments.  If the operation is not possible (because this is not
        a subpath of the other path), raise ValueError.
        zneed at least one argumentr7Nrz{!r} does not start with {!r}r%)
r�r�r�r�r�rRr�r]r�r�r�r�r�)
r#r�r0r1r2Z	abs_partsZto_drvZto_rootZto_partsZto_abs_parts�nr�Z	formattedrrr�relative_tos(	(zPurePath.relative_tocCs.y|jStk
r(t|j�|_|jSXdS)zZAn object providing sequence-like access to the
        components in the filesystem path.N)r�r�r�r�)r#rrrr0"s
zPurePath.partscGs
|j|�S)z�Combine this path with one or several arguments, and return a
        new path representing either a subpath (if all arguments are relative
        paths) or a totally different path (if one of the arguments is
        anchored).
        )r�)r#r�rrr�joinpath.szPurePath.joinpathcCs|j|f�S)N)r�)r#�keyrrr�__truediv__6szPurePath.__truediv__cCs|j|g|j�S)N)r�r�)r#rrrr�__rtruediv__9szPurePath.__rtruediv__cCs@|j}|j}|j}t|�dkr*|s&|r*|S|j|||dd��S)zThe logical parent of the path.r7NrO)r�r�r�rRr�)r#r1r2r0rrr�parent<szPurePath.parentcCst|�S)z*A sequence of this path's logical parents.)r�)r#rrr�parentsFszPurePath.parentscCs|js
dS|jjpt|j�S)zSTrue if the path is absolute (has both a root and, if applicable,
        a drive).F)r�r�rs�boolr�)r#rrrr�KszPurePath.is_absolutecCs|jj|j�S)zaReturn True if the path contains one of the special names reserved
        by the system, if any.)r�rcr�)r#rrrrcRszPurePath.is_reservedc	Cs�|jj}||�}|jj|f�\}}}|s0td��|rF|||j�krFdS|r\|||j�kr\dS|j}|sj|r�t|�t|�kr~dS|dd�}nt|�t|�kr�dSx.tt	|�t	|��D]\}}t
j||�s�dSq�WdS)zE
        Return True if this path matches the given pattern.
        z
empty patternFr7NT)r�r8r6r�r�r�r�rR�zipr(r�Zfnmatchcase)	r#Zpath_patternr�r1r2Z	pat_partsr0r4rrrrr�Ws(zPurePath.matchN)r�r�r�r�r�r�r�)T)T)0r:r;r<r=r�r�r��classmethodr�r�r�r�r�r�r�r�rer�r�r��propertyr�r�r�r�r�r�r�rrdr2r�rvr�rrrrrr0rr	r
rrr�rcr�rrrrrs^
	
	
	
 
c@seZdZdZeZfZdS)rz�PurePath subclass for non-Windows systems.

    On a POSIX system, instantiating a PurePath should return this object.
    However, you can also instantiate it directly on any system.
    N)r:r;r<r=�_posix_flavourr�r�rrrrrusc@seZdZdZeZfZdS)rz�PurePath subclass for Windows systems.

    On a Windows system, instantiating a PurePath should return this object.
    However, you can also instantiate it directly on any system.
    N)r:r;r<r=�_windows_flavourr�r�rrrrrsc@s�eZdZdZdaZdd�Zdbdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dcdd�Zdddd�Ze
dd��Ze
dd��Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zded&d'�Zd(d)�Zd*d+�Zd,d-�Zdgd0d1�Zd2d3�Zdhd4d5�Zd6d7�Zdid8d9�Zdjd;d<�Zdkd=d>�Zd?d@�Z dAdB�Z!dCdD�Z"dEdF�Z#dGdH�Z$dIdJ�Z%dKdL�Z&dldMdN�Z'dOdP�Z(dQdR�Z)dSdT�Z*dUdV�Z+dWdX�Z,dYdZ�Z-d[d\�Z.d]d^�Z/d_d`�Z0dS)mra�PurePath subclass that can make system calls.

    Path represents a filesystem path but unlike PurePath, also offers
    methods to do system calls on path objects. Depending on your system,
    instantiating a Path will return either a PosixPath or a WindowsPath
    object. You can also instantiate a PosixPath or WindowsPath directly,
    but cannot instantiate a WindowsPath on a POSIX system or vice versa.
    r��_closedcOsL|tkrtjdkrtnt}|j|dd�}|jjs@td|j	f��|j
�|S)NrAF)r�z$cannot instantiate %r on your system)rrlrvrrr�r�rwr�r:r�)r�r��kwargsr#rrrr��szPath.__new__NcCs"d|_|dk	r|j|_nt|_dS)NF)rr��_normal_accessor)r#�templaterrrr��s
z
Path._initcCs|j|g}|j|j|j|�S)N)r�r�r�r�)r#r4r0rrrr��szPath._make_child_relpathcCs|jr|j�|S)N)r�
_raise_closed)r#rrr�	__enter__�szPath.__enter__cCs
d|_dS)NT)r)r#�t�v�tbrrr�__exit__�sz
Path.__exit__cCstd��dS)NzI/O operation on closed path)r�)r#rrrr�szPath._raise_closed�cCs|jj|||�S)N)r�r�)r#rv�flagsr�rrr�_opener�szPath._opener�cCs|jr|j�|jj|||�S)zm
        Open the file pointed by this path and return a file descriptor,
        as os.open() does.
        )rrr�r�)r#rr�rrr�	_raw_open�szPath._raw_opencCs|tj��S)zjReturn a new path pointing to the current working directory
        (as returned by os.getcwd()).
        )rlr�)r�rrr�cwd�szPath.cwdcCs||�jjd��S)zrReturn a new path pointing to the user's home directory (as
        returned by os.path.expanduser('~')).
        N)r�rr)r�rrr�home�sz	Path.homecCsB|j�}y|j�}Wntk
r2tj|�}YnXtjj||�S)zoReturn whether other_path is the same or not as this file
        (as returned by os.path.samefile()).
        )r�r�rlrh�samestat)r#Z
other_path�stZother_strrr�samefile�sz
Path.samefileccsL|jr|j�x8|jj|�D](}|dkr*q|j|�V|jr|j�qWdS)zyIterate over the files in this directory.  Does not yield any
        result for the special paths '.' and '..'.
        r&�..N>r&r')rrr�r�r�)r#rvrrr�iterdir�szPath.iterdirccsl|stdj|���|jj|�}|jj|f�\}}}|s:|rBtd��tt|��}x|j|�D]
}|VqZWdS)z�Iterate over this subtree and yield all existing files (of any
        kind, including directories) matching the given pattern.
        zUnacceptable pattern: {!r}z%Non-relative patterns are unsupportedN)	r�r�r�r8r6r�r�r�r�)r#�patternr1r2r��selectorr[rrr�glob�sz	Path.globccs^|jj|�}|jj|f�\}}}|s(|r0td��tdt|��}x|j|�D]
}|VqLWdS)z�Recursively yield all existing files (of any kind, including
        directories) matching the given pattern, anywhere in this subtree.
        z%Non-relative patterns are unsupported�**N)r,)r�r8r6r�r�r�r�)r#r)r1r2r�r*r[rrr�rglobsz
Path.rglobcCsD|jr|j�|j�r|S|jtj�g|jdd�}|j|d�|S)aReturn an absolute version of this path.  This function works
        even if the path doesn't point to anything.

        No normalization is done, i.e. all '.' and '..' will be kept along.
        Use resolve() to get the canonical path to a file.
        F)r�)r)rrr�r�rlr�r�r�)r#�objrrr�absolutesz
Path.absoluteFcCs�|jr|j�dd�}y|jj||d�}Wn,tk
rV}z||��WYdd}~XnX|j|f�}|s�y|j�Wn*tk
r�}z||�WYdd}~XnX|S)z�
        Make the path absolute, resolving all symlinks on the way and also
        normalizing it (for example turning slashes into backslashes under
        Windows).
        cSs0t|dd�}|jtks|tkr,td|j��dS)N�winerrorrzSymlink loop from %r)�getattr�errnor�_WINERROR_CANT_RESOLVE_FILENAMEro�filename)�er0rrr�check_eloop*sz!Path.resolve.<locals>.check_eloop)�strictN)rrr�r��OSErrorr�r�)r#r7r6rZr5r[rrr�resolve!szPath.resolvecCs|jj|�S)zh
        Return the result of the stat() system call on this path, like
        os.stat() does.
        )r�r�)r#rrrr�?sz	Path.statcCsddl}|j|j�j�jS)z:
        Return the login name of the file owner.
        rN)r}r~r��st_uidZpw_name)r#r}rrr�ownerFsz
Path.ownercCsddl}|j|j�j�jS)z8
        Return the group name of the file gid.
        rN)�grpZgetgrgidr��st_gidZgr_name)r#r<rrr�groupMsz
Path.group�rr7c	Cs,|jr|j�tjt|�||||||jd�S)z|
        Open the file pointed by this path and return a file object, as
        the built-in open() function does.
        )�opener)rr�ior�r�r)r#r��	buffering�encoding�errors�newlinerrrr�Tsz	Path.openc	Cs |jdd��
}|j�SQRXdS)zK
        Open the file in bytes mode, read it, and close the file.
        �rb)r�N)r��read)r#r�rrr�
read_bytes_szPath.read_bytesc	Cs$|jd||d��
}|j�SQRXdS)zJ
        Open the file in text mode, read it, and close the file.
        r?)r�rCrDN)r�rG)r#rCrDr�rrr�	read_textfszPath.read_textc	Cs*t|�}|jdd��}|j|�SQRXdS)zO
        Open the file in bytes mode, write to it, and close the file.
        �wb)r�N)�
memoryviewr��write)r#�dataZviewr�rrr�write_bytesmszPath.write_bytesc	Cs@t|t�std|jj��|jd||d��}|j|�SQRXdS)zN
        Open the file in text mode, write to it, and close the file.
        zdata must be str, not %s�w)r�rCrDN)r�r�r�r�r:r�rL)r#rMrCrDr�rrr�
write_textvs

zPath.write_textTcCsr|jr|j�|r>y|jj|d�Wntk
r8YnXdStjtjB}|sX|tjO}|j	||�}tj
|�dS)zS
        Create this file with the given access mode, if it doesn't exist.
        N)rrr�r�r8rl�O_CREAT�O_WRONLY�O_EXCLr!�close)r#r��exist_okr�fdrrr�touch�s
z
Path.touchcCs�|jr|j�y|jj||�Wnjtk
rf|s@|j|krB�|jjddd�|j|d|d�Yn&tk
r�|s�|j�r��YnXdS)z<
        Create a new directory at this given path.
        T)rrUFN)rrr�r��FileNotFoundErrorrr8r�)r#r�rrUrrrr��sz
Path.mkdircCs |jr|j�|jj||�dS)zF
        Change the permissions of the path, like os.chmod().
        N)rrr�r�)r#r�rrrr��sz
Path.chmodcCs |jr|j�|jj||�dS)z�
        Like chmod(), except if the path points to a symlink, the symlink's
        permissions are changed, rather than its target's.
        N)rrr�r�)r#r�rrrr��szPath.lchmodcCs|jr|j�|jj|�dS)zd
        Remove this file or link.
        If the path is a directory, use rmdir() instead.
        N)rrr�r�)r#rrrr��szPath.unlinkcCs|jr|j�|jj|�dS)zF
        Remove this directory.  The directory must be empty.
        N)rrr�r�)r#rrrr��sz
Path.rmdircCs|jr|j�|jj|�S)z�
        Like stat(), except if the path points to a symlink, the symlink's
        status information is returned, rather than its target's.
        )rrr�r�)r#rrrr��sz
Path.lstatcCs |jr|j�|jj||�dS)z5
        Rename this path to the given path.
        N)rrr�r�)r#�targetrrrr��szPath.renamecCs |jr|j�|jj||�dS)zo
        Rename this path to the given path, clobbering the existing
        destination if it exists.
        N)rrr�r))r#rYrrrr)�szPath.replacecCs"|jr|j�|jj|||�dS)z�
        Make this path a symlink pointing to the given path.
        Note the order of arguments (self, target) is the reverse of os.symlink's.
        N)rrr�r�)r#rYr�rrr�
symlink_to�szPath.symlink_tocCsBy|j�Wn0tk
r<}z|jttfkr.�dSd}~XnXdS)z+
        Whether this path exists.
        FNT)r�r8r2rr)r#r5rrrr��szPath.existscCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z3
        Whether this path is a directory.
        FN)r	r��st_moder8r2rr)r#r5rrrr��szPath.is_dircCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)zq
        Whether this path is a regular file (also True for symlinks pointing
        to regular files).
        FN)rr�r[r8r2rr)r#r5rrr�is_file
szPath.is_filecCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z7
        Whether this path is a symbolic link.
        FN)r
r�r[r8r2rr)r#r5rrrr�szPath.is_symlinkcCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z6
        Whether this path is a block device.
        FN)r
r�r[r8r2rr)r#r5rrr�is_block_device$szPath.is_block_devicecCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z:
        Whether this path is a character device.
        FN)rr�r[r8r2rr)r#r5rrr�is_char_device1szPath.is_char_devicecCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z.
        Whether this path is a FIFO.
        FN)rr�r[r8r2rr)r#r5rrr�is_fifo>szPath.is_fifocCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z0
        Whether this path is a socket.
        FN)rr�r[r8r2rr)r#r5rrr�	is_socketKszPath.is_socketcCsb|jp
|jr^|jr^|jddd�dkr^|jj|jddd��}|j|g|jdd��S|S)zl Return a new path with expanded ~ and ~user constructs
        (as returned by os.path.expanduser)
        rNr7�~)r�r�r�r�rrr�)r#Zhomedirrrrr�Xs
zPath.expanduser)r�r)N)r)r )FrO)r?rONNN)NN)NN)rT)r FF)F)1r:r;r<r=r�r�r�r�rrrrr!rr"r#r&r(r+r-r/r9r�r;r>r�rHrIrNrPrWr�r�r�r�r�r�r�r)rZr�r�r\r�r]r^r_r`r�rrrrr�s^






	



				





c@seZdZdZfZdS)rzsPath subclass for non-Windows systems.

    On a POSIX system, instantiating a Path should return this object.
    N)r:r;r<r=r�rrrrrdsc@s$eZdZdZfZdd�Zdd�ZdS)rzqPath subclass for Windows systems.

    On a Windows system, instantiating a Path should return this object.
    cCstd��dS)Nz*Path.owner() is unsupported on this system)r�)r#rrrr;rszWindowsPath.ownercCstd��dS)Nz*Path.group() is unsupported on this system)r�)r#rrrr>uszWindowsPath.groupN)r:r;r<r=r�r;r>rrrrrks)>r�r�rArtrlr�r�r-�collectionsr�
contextlibrr2rrrr�operatorrr�r	r
rrr
rrZurllib.parserrfZsupports_symlinks�__all__Z_WINERROR_NOT_READYZ_WINERROR_INVALID_NAMEr3rr�r r>r{rrr�r�rr�r�r�r�r�r�r�r�r�r�PathLike�registerrrrrrrrrr�<module>sd$
?6>
%f

[macpath.cpython-36.pyc000064400000013013150335715140010611 0ustar003


 \S� @s2dZdZdZdZdZdZdZdZdZddl	Z	ddl
TddlZddlTd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(g Zd)d*�Z
d+d	�Zd,d
�Zd-d�Zd.d
�Zd/d�Zejje_d0d�Zd1d�Zd2d�Zd3d4�Zd5d�Zd6d�Zd7d�Zd8d�ZGd9d:�d:e�Zd;d�Zd<d�Zd=d'�Z d>Z!dS)?z7Pathname and path-related operations for the Macintosh.�:z::�.�
NzDev:Null�)�*�normcase�isabs�join�
splitdrive�split�splitext�basename�dirname�commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�
expanduser�
expandvars�normpath�abspath�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenamescCst|t�rdSdSdS)N�:r)�
isinstance�bytes)�path�r*�/usr/lib64/python3.6/macpath.py�
_get_colons
r,cCs(t|ttf�s tdj|jj���|j�S)Nz2normcase() argument must be str or bytes, not '{}')r'r(�str�	TypeError�format�	__class__�__name__�lower)r)r*r*r+r#scCs t|�}||ko|dd�|kS)z�Return true if a path is absolute.
    On the Mac, relative paths begin with a colon,
    but as a special case, paths with no colons at all are also relative.
    Anything else is absolute (the string up to the first colon is the
    volume name).N�)r,)�s�colonr*r*r+r*sc
Gs�y�t|�}|}|s"|dd�|xl|D]d}|s:t|�r@|}q(|dd�|kr\|dd�}||krl||}|dd�|kr�||}||}q(W|Stttfk
r�tjd|f|���YnXdS)Nrr3r���)r,rr.�AttributeError�BytesWarning�genericpath�_check_arg_types)r4�pr5r)�tr*r*r+r5s(
cCs�t|�}||kr |dd�|fSd}x0tt|��D] }|||d�|kr2|d}q2W|d|d�||d�}}|r�||kr�||}||fS)z�Split a pathname into two parts: the directory leading up to the final
    bit, and the basename (the filename, without colons, in that directory).
    The result (s, t) is such that join(s, t) yields the original argument.Nrr3)r,�range�len)r4r5�col�ir)�filer*r*r+r
LscCs.t|t�rtj|dtd�Stj|ttt�SdS)Nr&�.)r'r(r9�	_splitextr!rr")r;r*r*r+r\s
cCs|dd�|fS)a@Split a pathname into a drive specification and the rest of the
    path.  Useful on DOS/Windows/NT; on the Mac, the drive is always
    empty (don't use the volume name -- it doesn't have the same
    syntactic and semantic oddities as DOS drive letters, such as there
    being a separate current directory per drive).Nrr*)r;r*r*r+r	cscCst|�dS)Nr)r
)r4r*r*r+r
oscCst|�dS)Nr3)r
)r4r*r*r+rpscCs*t|�sdSt|�}t|�dko(|dS)NF�r3)rr
r>)r4�
componentsr*r*r+�ismountrsrFc	Cs*yddl}|jj|d�dSdSdS)z6Return true if the pathname refers to a symbolic link.rNrDF)�Carbon.File�FileZResolveAliasFile)r4�Carbonr*r*r+rxs
cCs(ytj|�}Wntk
r"dSXdS)zCTest whether a path exists.  Returns True for broken symbolic linksFT)�os�lstat�OSError)r)�str*r*r+r�s
cCs|S)zEDummy to retain interface-compatibility with other operating systems.r*)r)r*r*r+r�scCs|S)zEDummy to retain interface-compatibility with other operating systems.r*)r)r*r*r+r�sc@seZdZdZdS)�
norm_errorzPath cannot be normalizedN)r1�
__module__�__qualname__�__doc__r*r*r*r+rN�srNcCs�t|�}||kr||S|j|�}d}x`|t|�dkr�||r|||dr||dkrr||d|d�=|d}q�td��q(|d}q(W|j|�}|dd�|kr�t|�dkr�||t|�kr�|dd�}|S)zLNormalize a pathname.  Will return the same result for
    equivalent paths.r3z+Cannot use :: immediately after volume nameNrDr6r6)r,r
r>rNr)r4r5�compsr@r*r*r+r�s 



,cCs6t|�s.t|t�rtj�}ntj�}t||�}t|�S)zReturn an absolute path.)rr'r(rJ�getcwdb�getcwdrr)r)�cwdr*r*r+r�s


cCs�t|�}yddl}Wntk
r(|SX|s2|St|�}|j|�}|d|}xR|dd�D]B}t||�}y|jj|d�dj�}Wq^|jj	k
r�Yq^Xq^W|S)Nrr3)
rrG�ImportErrorr,r
rrHZFSResolveAliasFileZas_pathname�Error)r)rIr5rE�cr*r*r+r$�s"


T)"rQrrr"rrr r!r#rJ�statr9�__all__r,rrrr
rrCr	r
rrFrrrr�	ExceptionrNrrr$r%r*r*r*r+�<module>sL


	_osx_support.cpython-36.pyc000064400000022754150335715140011754 0ustar003


 \�J�
@s�dZddlZddlZddlZddddgZd1Zd2ZdZd3dd�Zdd�Z	dd�Z
dadd�Zdd�Z
dd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d�Zd.d�Zd/d�Zd0d�ZdS)4zShared OS X support functions.�N�compiler_fixup�customize_config_vars�customize_compiler�get_platform_osx�CFLAGS�LDFLAGS�CPPFLAGS�
BASECFLAGS�	BLDSHARED�LDSHARED�CC�CXX�	PY_CFLAGS�
PY_LDFLAGS�PY_CPPFLAGS�PY_CORE_CFLAGS�PY_CORE_LDFLAGSZ_OSX_SUPPORT_INITIAL_cCs�|dkrtjd}|jtj�}tjj|�\}}tjdkrH|dkrH|d}tjj|�s�x*|D]"}tjj	||�}tjj|�rZ|SqZWdS|SdS)z�Tries to find 'executable' in the directories listed in 'path'.

    A string listing directories separated by 'os.pathsep'; defaults to
    os.environ['PATH'].  Returns the complete filename or None if not found.
    N�PATHZwin32z.exe)
�os�environ�split�pathsep�path�splitext�sys�platform�isfile�join)�
executabler�paths�baseZext�p�f�r#�$/usr/lib64/python3.6/_osx_support.py�_find_executables

r%cCs�ddl}yddl}|j�}Wn(tk
rDtdtj�fd�}YnX|j|��0}d||jf}tj	|�s||j
�jd�j�SdSQRXdS)z0Output from successful command execution or NonerNz/tmp/_osx_support.%szw+bz%s 2>/dev/null >'%s'zutf-8)
�
contextlib�tempfileZNamedTemporaryFile�ImportError�openr�getpid�closing�name�system�read�decode�strip)Z
commandstringr&r'�fp�cmdr#r#r$�_read_output7sr3cCst|�ptd|f�pdS)z0Find a build tool on current path or using xcrunz/usr/bin/xcrun -find %s�)r%r3)Ztoolnamer#r#r$�_find_build_toolJsr5cCsxtdkrtdaytd�}Wntk
r,YnHXztjd|j��}Wd|j�X|dk	rtdj|jd�j	d�dd��atS)z*Return the OS X system version as a stringNr4z0/System/Library/CoreServices/SystemVersion.plistz=<key>ProductUserVisibleVersion</key>\s*<string>(.*?)</string>�.��)
�_SYSTEM_VERSIONr)�OSError�re�searchr.�closer�groupr)r"�mr#r#r$�_get_system_versionSs

r@cCs&x t|�D]}|jt�r
||=q
WdS)z-Remove original unmodified values for testingN)�list�
startswith�_INITPRE)�_config_vars�kr#r#r$�_remove_original_valuesqs
rFcCs8|j|d�}||kr,t||kr,||t|<|||<dS)z@Save modified and original unmodified value of configuration varr4N)�getrC)rD�cvZnewvalueZoldvaluer#r#r$�_save_modified_valuexsrIcCsTt�}|r@ytdd�|jd�D��}Wntk
r>d}YnX|rPt|dk�SdS)	z=Returns True if universal builds are supported on this systemcss|]}t|�VqdS)N)�int)�.0�ir#r#r$�	<genexpr>�sz-_supports_universal_builds.<locals>.<genexpr>r6r4�
�F)rNrO)r@�tupler�
ValueError�bool)Zosx_versionr#r#r$�_supports_universal_builds�s
rScCs�dtjkr|S|dj�d}}t|�s4td�}n<tjj|�jd�rptd|j	dd�f�}|rpd|krptd�}|s|t
d	��||kr�xTtD]L}||kr�|tjkr�||j�}|d
kr�|n|d|d<t||dj
|��q�W|S)
z7Find appropriate C compiler for extension module buildsrrZclang�gccz'%s' --version�'z'"'"'zllvm-gcczCannot locate working compilerr
z++� )rrrr%r5r�basenamerBr3�replace�SystemError�_COMPILER_CONFIG_VARSrIr)rDZccZoldcc�datarHZcv_splitr#r#r$�_find_appropriate_compiler�s(


r\cCsZxTtD]L}||kr|tjkr||}tjdd|tjd�}tjdd|�}t|||�qW|S)z5Remove all universal build arguments from config varsz
-arch\s+\w+\srV)�flagsz-isysroot [^ 	]*)�_UNIVERSAL_CONFIG_VARSrrr;�sub�ASCIIrI)rDrHr]r#r#r$�_remove_universal_flags�s
racCs�dtjkr|Stjd|d�dk	r�tjd|djdd�f�}|r�x@tD]8}||krH|tjkrH||}tjdd	|�}t|||�qHW|S)
z-Remove any unsupported archs from config varsrz-arch\s+ppcrNzNecho 'int main{};' | '%s' -c -arch ppc -x c -o /dev/null /dev/null 2>/dev/nullrUz'"'"'z-arch\s+ppc\w*\srV)	rrr;r<r-rXr^r_rI)rDZstatusrHr]r#r#r$�_remove_unsupported_archs�s
	
rbcCshdtjkrdtjd}xNtD]F}||krd||kr||}tjdd|�}|d|}t|||�qW|S)z2Allow override of all archs with ARCHFLAGS env var�	ARCHFLAGSz-archz
-arch\s+\w+\srV)rrr^r;r_rI)rDZarchrHr]r#r#r$�_override_all_archss


rdcCs||jdd�}tjd|�}|dk	rx|jd�}tjj|�sxx@tD]8}||kr<|tjkr<||}tj	dd|�}t
|||�q<W|S)z+Remove references to any SDKs not availablerr4z-isysroot\s+(\S+)Nr7z-isysroot\s+\S+(?:\s|$)rV)rGr;r<r>rr�existsr^rr_rI)rD�cflagsr?ZsdkrHr]r#r#r$�_check_for_unavailable_sdks

rgcCsXd}}t|�}t�s d}}nd|k}d|k}|s>dtjkrxx8y|jd�}|||d�=Wq@tk
rrPYq@Xq@Wdtjkr�|r�|tjdj�}|r�x8y|jd�}|||d�=Wq�tk
r�PYq�Xq�Wd}d|kr�|jd�}||d}n d|k�r|jd�}||d}|�rTtjj|��rTd	d
l	m
}|jd|�|jd�|S)
ae
    This function will strip '-isysroot PATH' and '-arch ARCH' from the
    compile flags if the user has specified one them in extra_compile_flags.

    This is needed because '-arch ARCH' adds another architecture to the
    build, without a way to remove an architecture. Furthermore GCC will
    barf if multiple '-isysroot' arguments are present.
    FTz-archz	-isysrootrcr8Nr7r)�logz4Compiling with an SDK that doesn't seem to exist: %sz$Please check your Xcode installation)rArSrr�indexrQrr�isdirZ	distutilsrh�warn)Zcompiler_soZcc_argsZ	stripArchZstripSysrootriZsysroot�idxrhr#r#r$r0sF	






cCs"t�st|�t|�t|�|S)a�Customize Python build configuration variables.

    Called internally from sysconfig with a mutable mapping
    containing name/value pairs parsed from the configured
    makefile used to build this interpreter.  Returns
    the mapping updated as needed to reflect the environment
    in which the interpreter is running; in the case of
    a Python from a binary installer, the installed
    environment may be very different from the build
    environment, i.e. different OS levels, different
    built tools, different available CPU architectures.

    This customization is performed whenever
    distutils.sysconfig.get_config_vars() is first
    called.  It may be used in environments where no
    compilers are present, i.e. when installing pure
    Python dists.  Customization of compiler paths
    and detection of unavailable archs is deferred
    until the first extension module build is
    requested (in distutils.sysconfig.customize_compiler).

    Currently called from distutils.sysconfig
    )rSrardrg)rDr#r#r$rps
cCst|�t|�t|�|S)z�Customize compiler path and configuration variables.

    This customization is performed when the first
    extension module build is requested
    in distutils.sysconfig.customize_compiler).
    )r\rbrd)rDr#r#r$r�s	c
Cs||jdd�}t�p|}|p|}|�rr|}d}|jtd|jdd��}|r�y$tdd�|jd�dd	�D��}Wq�tk
r�d}Yq�Xnd}|dko�d|j�k�r6d
}tjd|�}tt	t
|���}t|�dkr�|d}n\|dkr�d
}nN|d k�r�d}n>|d!k�rd}n.|d"k�rd}n|d#k�r&d}ntd|f��n<|dk�rRtj
d$k�rrd}n |d%k�rrtj
d&k�rnd}nd}|||fS)'z Filter values for get_platform()�MACOSX_DEPLOYMENT_TARGETr4Zmacosxrcss|]}t|�VqdS)N)rJ)rKrLr#r#r$rM�sz#get_platform_osx.<locals>.<genexpr>r6rr8rNrOz-archZfatz
-arch\s+(\S+)r7�i386�ppc�x86_64ZintelZfat3�ppc64Zfat64Z	universalz%Don't know machine value for archs=%r� �PowerPC�Power_Macintosh)rNr)rNr)rNrO)rnro)rnrp)rnrorp)rqrp)rnrorqrpl)rsrtl)rGr@rCrPrrQr0r;�findall�sorted�set�lenr�maxsize)rD�osname�release�machineZmacverZ
macreleaserfZarchsr#r#r$r�sP


$






)
rrrr	r
rrr
rrrrr)r
rrr
)N)�__doc__rr;r�__all__r^rZrCr%r3r5r9r@rFrIrSr\rarbrdrgrrrrr#r#r#r$�<module>s<
>(@)crypt.cpython-36.opt-1.pyc000064400000004304150335715140011277 0ustar003


 \H�@s�dZddlZddlZddlmZddlmZ	ej
ejdZe�Z
Gdd�de	dd��Zdd	d
�Zddd�Zed
ddd�Zedddd�Zedddd�Zedddd�ZgZx:eeeefD]*Zede�Zer�ee�ejkr�eje�q�W[[dS)zEWrapper to the POSIX crypt library call and associated functionality.�N)�SystemRandom)�
namedtuplez./c@seZdZdZdd�ZdS)�_MethodziClass representing a salt method per the Modular Crypt Format or the
    legacy 2-character crypt method.cCsdj|j�S)Nz<crypt.METHOD_{}>)�format�name)�self�r�/usr/lib64/python3.6/crypt.py�__repr__sz_Method.__repr__N)�__name__�
__module__�__qualname__�__doc__r
rrrr	r
srz name ident salt_chars total_sizecCsH|dkrtd}|jr"dj|j�nd}|djdd�t|j�D��7}|S)zsGenerate a salt for the specified method.

    If not specified, the strongest available method will be used.

    Nrz${}$�css|]}tjt�VqdS)N)�_srZchoice�
_saltchars)�.0�charrrr	�	<genexpr>szmksalt.<locals>.<genexpr>)�methodsZidentr�join�rangeZ
salt_chars)�method�srrr	�mksalts
rcCs&|dkst|t�rt|�}tj||�S)aRReturn a string representing the one-way hash of a password, with a salt
    prepended.

    If ``salt`` is not specified or is ``None``, the strongest
    available method will be selected and a salt generated.  Otherwise,
    ``salt`` may be one of the ``crypt.METHOD_*`` values, or a string as
    returned by ``crypt.mksalt()``.

    N)�
isinstancerr�_crypt�crypt)ZwordZsaltrrr	r#s
rZCRYPT��
ZMD5�1��"ZSHA256�5��?ZSHA512�6�jr)N)N)rr�stringZ_stringZrandomrZ
_SystemRandom�collectionsrZ_namedtupleZ
ascii_lettersZdigitsrrrrrZMETHOD_CRYPTZ
METHOD_MD5Z
METHOD_SHA256Z
METHOD_SHA512r�_methodZ_result�lenZ
total_size�appendrrrr	�<module>s&	


nturl2path.cpython-36.opt-1.pyc000064400000002735150335715140012247 0ustar003


 \�	�@sdZdd�Zdd�ZdS)z3Convert a NT pathname to a file URL and vice versa.cCsddl}ddl}|jdd�}d|kr\|dd�dkr@|dd�}|jd�}|jjd	j|��S|jd�}t|�dks�|dd|jkr�d|}t	|��|dd
j
�}|d
jd�}|d}x$|D]}|r�|d	|jj|�}q�W|jd�o�|jd��r�|d	7}|S)z{OS-specific conversion from a relative URL of the 'file' scheme
    to a file system path; not recommended for general use.�N�:�|�z////��/�\�z	Bad URL: ���r	)�string�urllib.parse�replace�split�parseZunquote�join�lenZ
ascii_letters�OSError�upper�endswith)Zurlr
�urllib�
components�comp�error�drive�path�r�"/usr/lib64/python3.6/nturl2path.py�url2pathnames(	


rcCs�ddl}d|krD|dd�dkr(d|}|jd�}|jjdj|��S|jd�}t|�dksjt|d�dkrzd	|}t|��|jj|dj��}|djd�}d
|d}x$|D]}|r�|d|jj|�}q�W|S)z{OS-specific conversion from a file system path to a relative URL
    of the 'file' scheme; not recommended for general use.rNrrz\\rrrz
Bad path: z///)rr
rZquoterrrr)�prrrrrrrrr�pathname2url(s"


rN)�__doc__rrrrrr�<module>s%platform.cpython-36.opt-2.pyc000064400000045711150335715140011772 0ustar003

�\dhn��@s>dZdZddlZddlZddlZddlZddlZddlZy
ejZ	Wn(e
k
rjejd�krbdZ	ndZ	YnXd	Zd
ddddd
ddddd�
Z
ejd�Zdd�Zejdej�Zejdddfdd�Zdd�Zejdej�Zejdej�Zejdej�Zd�Zd.d/�Zddded0fd1d2�Zd3d4�Zdddefd5d6�Zd�d8d9�Zd�d:d;�Zejd<�Z d�d=d>�Z!d�d@d�dAd�dCd�dDd�dFd�dGd�dHd�dJd�dKd�dLd�dMiZ"d�dCd�dNd�dOd�dPd�dQd�dRiZ#d�dSdT�Z$dUdV�Z%d�dWdX�Z&dYdZ�Z'd�d[d\�Z(d]d^�Z)d_d`�Z*d�dadb�Z+dcdd�Z,d�dedf�Z-d�dgdh�Z.d�d�d�dl�Z/ejddfdmdn�Z0ej1dodp�Z2da3dqdr�Z4dsdt�Z5dudv�Z6dwdx�Z7dydz�Z8d{d|�Z9d}d~�Z:ejdej�Z;ejd�ej�Z<ejd��Z=ejd��Z>iZ?d�d�d��Z@d�d��ZAd�d��ZBd�d��ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGiZHd�d�d��ZeId�k�r:d�ejJk�p
d�ejJkZKd�ejJk�o d�ejJkZLeMeeLeK��ejNd�dS)�a
    Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
    Copyright (c) 2000-2010, eGenix.com Software GmbH; mailto:info@egenix.com

    Permission to use, copy, modify, and distribute this software and its
    documentation for any purpose and without fee or royalty is hereby granted,
    provided that the above copyright notice appear in all copies and that
    both that copyright notice and this permission notice appear in
    supporting documentation or portions thereof, including modifications,
    that you make.

    EGENIX.COM SOFTWARE GMBH DISCLAIMS ALL WARRANTIES WITH REGARD TO
    THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
    FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
    INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
    FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
    NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
    WITH THE USE OR PERFORMANCE OF THIS SOFTWARE !

z1.0.8�N�dos�win32�win16ZNULz	/dev/nullz/etc�
���(�2��)
ZdevZalpha�aZbeta�b�cZRC�rc�pl�pz([0-9]+|[._+-])cCsfg}x\tj|�D]N}|dkryt|d�}d}Wn tk
rNtj|d�}YnX|j||f�qW|S)Nz._+-r�dr)�
_component_re�split�int�
ValueError�_ver_stages�get�extend)�version�result�v�t�r� /usr/lib64/python3.6/platform.py�_comparable_version�s
rsC(__libc_init)|(GLIBC_([0-9.]+))|(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)�i@c
Cs�t}ttjd�rtjj|�}t|d���`}|j|�}d}�xH|t|�k�r�d|ksZd|krhtj	||�}nd}|s�|j
�t|�kr�|j|�}	|	r�|t|t|�d�d�|	}d}q<|s�Pdd�|j�D�\}
}}}
}}|
r�|r�d	}n�|�r|d
k�rd
}|}n||�||�k�rx|}n^|
�rx|d
k�rxd	}|�rR|�sN||�||�k�rR|}|�rx|t|�d�|k�rx||}|j
�}q<WWdQRX||fS)N�realpath�rbrslibcsGLIBCi�cSs"g|]}|dk	r|jd�n|�qS)N�latin1)�decode)�.0�srrr�
<listcomp>�szlibc_ver.<locals>.<listcomp>Zlibc�glibc)
r�hasattr�os�pathr!�open�read�len�_libc_search�search�end�max�groups)�
executable�librZ	chunksize�V�fZbinary�pos�m�chunkZlibcinitr(ZglibcversionZsoZthreadsZ	soversionrrr�libc_ver�sJ




 r;cCsptjjd�r�d}td��`}xX|D]P}|j�}t|�dkr |\}}nq |dkrV|j�}q |dkr |jd�}|d}q WWdQRX|||fStjjd�r�td��D}x<|D]4}|jd�}	t|	�dkr�|	dd	kr�d	|	d
|fSq�WWdQRXtjjd��rftjd�}
x:t	t|
�d
dd�D]"}|
|dd�d
k�r|
|=�qW|
�rf|
j
�d}|
ddd�}|||fS|||fS)Nz/var/adm/inst-log/info�SuSE�ZMIN_DIST_VERSIONZ
DIST_IDENT�-z/etc/.installedrZ	OpenLinux�z/usr/lib/setup�zslack-version-�	slackware���rBrB)r*r+�existsr,rr.�strip�isdir�listdir�range�sort)�distnamer�idr7�lineZtv�tag�value�valuesZpkgZverfiles�nrrr�_dist_try_harder�s>	










rPz(\w+)[-_](release|version)z'(.+) release ([\d.]+)[^(]*(?:\((.+)\))?z1([^0-9]+)(?: release )?([\d.]+)[^(]*(?:\((.+)\))?r<�debian�fedora�redhat�centos�	almalinux�mandrake�mandriva�rocksrA�	yellowdog�gentoo�UnitedLinux�
turbolinux�arch�mageiacCszd}d}tj|�}|dk	r&t|j��Stj|�}|dk	rDt|j��S|j�j�}|rp|d}t|�dkrp|d}d||fS)Nr rr?)�_lsb_release_version�match�tupler3�_release_versionrDrr.)�	firstlinerrJr9�lrrr�_parse_release_file0s

rer?cCs(ddl}|jdtdd�t|||||�S)NrzFdist() and linux_distribution() functions are deprecated in Python 3.5r=)�
stacklevel)�warnings�warn�PendingDeprecationWarning�_linux_distribution)rIrrJ�supported_dists�full_distribution_namergrrr�linux_distributionKs


rmcCs�ytjt�}Wntk
r(|||fSX|j�xD|D]0}tj|�}|dk	r8|j�\}}	||kr8|}Pq8Wt|||�St	tj
jt|�dddd��}
|
j�}WdQRXt
|�\}}}
|r�|r�|}|r�|}|
r�|
}|||fS)N�rzutf-8�surrogateescape)�encoding�errors)r*rF�_UNIXCONFDIR�OSErrorrH�_release_filenamer`r3rPr,r+�join�readlinere)rIrrJrkrlZetc�filer9Z	_distnameZdummyr7rcZ_versionZ_idrrrrjUs0

rjcCs*ddl}|jdtdd�t||||dd�S)NrzFdist() and linux_distribution() functions are deprecated in Python 3.5r=)rf)rkrl)rgrhrirj)rIrrJrkrgrrr�dist�s
rxrncCs&ddl}|jdtdd�tj|||�S)Nrzuse os.popen insteadr=)rf)rgrh�DeprecationWarningr*�popen)�cmd�mode�bufsizergrrrrz�srzcCsd|jd�}|r|j|�ytt|�}Wntk
r>|}YnXttt|��}dj|dd��}|S)N�.�)r�append�maprr�list�strru)r�buildrdZintsZstringsrrr�
_norm_version�s


r�z'(?:([\w ]+) ([\w.]+) .*\[.* ([\d.]+)\])c	Cs�tj|kr|||fSxddD]R}y&tj|�}|j�}|j�rBtd��Wn$tk
rh}zwWYdd}~XqXPqW|||fS|j�}tj	|�}|dk	r�|j
�\}}}|ddkr�|dd	�}|d
dkr�|dd�}t|�}|||fS)N�ver�command /c ver�
cmd /c verzcommand failedr?r~)r�r�r�rBrBrBrB)�sys�platformr*rzr-�closersrD�_ver_outputr`r3r�)	�system�releaserZsupported_platformsr{�pipe�infoZwhyr9rrr�_syscmd_ver�s,





r��Z2000ZXPr=Z
2003ServerZpost2003��Vista�7�8rz8.1zpost8.1Z10Zpost10Z
2008ServerZ2008ServerR2Z
2012ServerZ2012ServerR2Zpost2012ServerR2c(Cs�yddlm}Wntk
r,||||fSXyddlm}m}m}m}Wn,tk
rvddlm}m}m}m}YnX|�}	|	j	p�|	dd�\}
}}dj
|
||�}tj|
|f�p�tj|
df�p�|}|	dd�|
|fk�r$ydj
|	j
�}Wn8tk
�r"|dd�d	k�rd
|dd�}YnXt|	dd�dk�rZtj|
|f��pXtj|
df��pX|}d}
z.y||d�}
||
d
�d}WnYnXWd|
�r�||
�X||||fS)Nr)�getwindowsversion)�	OpenKeyEx�QueryValueEx�CloseKey�HKEY_LOCAL_MACHINErz{0}.{1}.{2}r=zSP{}�
z
Service Pack ZSPZproduct_typez,SOFTWARE\Microsoft\Windows NT\CurrentVersionZCurrentType)r�r��ImportError�winregr�r�r�r��_winregZplatform_version�format�_WIN32_CLIENT_RELEASESrZservice_pack_major�AttributeError�getattr�_WIN32_SERVER_RELEASES)r�r�csd�ptyper�r�r�r�r�ZwinverZmaj�minr��keyrrr�	win32_versD

r�cCs�d}tjj|�sdSyddl}Wntk
r4dSXt|d��}|j|�}WdQRX|d}d	}tj�j}|d
krxd}|||fS)Nz0/System/Library/CoreServices/SystemVersion.plistrr"ZProductVersionr �ppc�Power MacintoshZPowerPC)r r r )r�r�)	r*r+rC�plistlibr�r,�load�uname�machine)�fnr�r7rr��versioninfor�rrr�_mac_ver_xmlEs
r�cCst�}|dk	r|S|||fS)N)r�)r�r�r�r�rrr�mac_ver[sr�cCs@ddlm}y|j|�}|dkr$|S|Stk
r:|SXdS)Nr)�System)�	java.langr�ZgetPropertyr�)�name�defaultr�rMrrr�
_java_getpropns
r�cCs�yddl}Wntk
r(||||fSXtd|�}td|�}|\}}}td|�}td|�}td|�}|||f}|\}}	}
td|
�}
td|�}td	|	�}	||	|
f}||||fS)
Nrzjava.vendorzjava.versionzjava.vm.namezjava.vm.vendorzjava.vm.versionzjava.os.archzjava.os.namezjava.os.version)r�r�r�)r��vendor�vminfo�osinfo�javaZvm_nameZ
vm_releaseZ	vm_vendor�os_name�
os_version�os_archrrr�java_verys"












r�cCs�|dkrd|||fS|dkr�|dkr0|||fS|jd�}|r�yt|d�}Wntk
rbYn X|d}t|�|d<dj|�}|dkr�d	}q�d	}n,|d
kr�d}|r�|d}q�d
}n|dkr�d}|||fS)NZRhapsodyzMacOS X ServerZSunOS�5r~rr�6ZSolarisZIRIX64ZIRIXz (64bit)�64bitrr�Windows)rr)rrrr�ru)r�r�rrd�majorrrr�system_alias�s2	



r�cGs�djdd�tt|�D��}|jdd�}|jdd�}|jdd�}|jdd�}|jd	d�}|jd
d�}|jdd�}|jdd�}|jd
d�}x|jdd�}||kr�P|}q�Wx|ddkr�|dd�}q�W|S)Nr>css|]}|j�VqdS)N)rD)r%�xrrr�	<genexpr>�sz_platform.<locals>.<genexpr>� �_�/�\�:�;�"�(�)�unknownr z--r?rBrB)ru�filterr.�replace)�argsr�Zcleanedrrr�	_platform�s$r�cCsDyddl}Wntk
r |SXy|j�Stk
r>|SXdS)Nr)�socketr�Zgethostnamers)r�r�rrr�_node�sr�cCsFtjj|�}x4tjj|�r@tjjtjjtjj|�tj|���}qW|S)N)r*r+�abspath�islink�normpathru�dirname�readlink)�filepathrrr�_follow_symlinkss
"r�cCshtjdkr|Sytjd|tf�}Wnttfk
r<|SX|j�j�}|j	�}|s\|r`|S|SdS)Nrrrzuname %s 2> %s)rrr)
r�r�r*rz�DEV_NULLr�rsr-rDr�)Zoptionr�r7�outputrrrr�
_syscmd_unames

r�cCs|tjdkr|St|�}ytjd|gtjtjd�}Wnttfk
rJ|SX|j	�dj
d�}|j�}|sp|rt|S|SdS)	Nrrrrw)�stdout�stderrrzlatin-1)rrr)r�r�r��
subprocess�Popen�PIPEZSTDOUTr�rsZcommunicater$�wait)�targetr��procr�rrrr�_syscmd_files	


r��	WindowsPEr��MSDOS)rrrcCs.|sLddl}y|jd�}Wn |jk
r:|jd�}YnXt|d�d}|r\t|d�}nd}|r�|tjkr�tjtkr�ttj\}}|r�|}|r�|}||fSd|kr�||fSd|kr�d	}nd
|kr�d}nd|kr�d
}d|kr�d}n@d|k�rd|k�rd}nd}n d|k�rd}nd|k�r&d}n||fS)Nr�Prd��bitr r4z32-bit�32bitZN32Zn32bitz64-bitr�ZELFZPEr�r�ZCOFFzMS-DOSr�)	�structZcalcsize�errorr�r�r�r4r��_default_architecture)r4�bits�linkager��sizeZfileoutrrdrrr�architectureBsL





r��uname_resultz-system node release version machine processorcCs�d}tdk	rtSd}ytj�\}}}}}Wntk
rBd}YnX|sdttd|||||f���r�|r�tj}d}d}t�}d}d}|dkr�t	�\}}}}	|r�|r�d}|s�dtj
kr�tj
jdd�}ntj
jdd�}|s�tj
jd|�}|�r<t|�\}}}|dk�rd	}n4|d
k�r<|d	k�r<d	}d|dd�k�r8d
}nd}|dk�rf|�s`|dk�r\d}nd}d	}n8|dd�dk�r�t
�\}}
}}d}dj|�}|�s�|
}|dk�r
|�s�|dk�r�|}d}yddl}
Wntk
�r�Yn&X|
jdd�\}}|dk�rd}nd}|�stdd�}|dk�r(d}|dk�r6d}|dk�rDd}|dk�rRd}|dk�r`d}|dk�rnd}|d
k�r�|d	k�r�d	}d
}t||||||�atS)Nrr r?rZPROCESSOR_ARCHITEW6432ZPROCESSOR_ARCHITECTUREZPROCESSOR_IDENTIFIERzMicrosoft Windowsr�Z	Microsoftz6.0rr�rr�Z16bit�r��Javaz, ZOpenVMS�0zSYI$_CPU�ZAlphaZVAXz-pr�)rr)�_uname_cacher*r�r�r�r�r�r�r�r��environrr�r�ru�vms_libr�Zgetsyir�r�)Zno_os_uname�	processorr��noder�rr�Zuse_syscmd_verr�r�r�r�r�rZcsidZ
cpu_numberrrrr��s�

 














r�cCst�jS)N)r�r�rrrrr�%sr�cCst�jS)N)r�rrrrrr.srcCst�jS)N)r�r�rrrrr�8sr�cCst�jS)N)r�rrrrrrAsrcCst�jS)N)r�r�rrrrr�Jsr�cCst�jS)N)r�rrrrrrSs
rzL([\w.+]+)\s*\(#?([^,]+)(?:,\s*([\w ]*)(?:,\s*([\w :]*))?)?\)\s*\[([^\]]+)\]?z;IronPython\s*([\d\.]+)(?: \(([\d\.]+)\))? on (.NET [\d\.]+)zU([\d.]+)\s*\(IronPython\s*[\d.]+\s*\(([\d.]+)\) on ([\w.]+ [\d.]+(?: \(\d+-bit\))?)\)zE([\w.+]+)\s*\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*\[PyPy [^\]]+\]?cCs|dkrtj}tj|d�}|dk	r&|Sd|kr�d}|jd�rHtj|�}n
tj|�}|dkrjtdt	|���|j
�\}}}d}d}n�tjjd�r�d}tj|�}|dkr�tdt	|���|j
�\}}}}	}
|dkr�d}tj}n�d|k�r"d}t
j|�}|dk�rtdt	|���|j
�\}}}}	d}n\tj|�}|dk�rFtd	t	|���|j
�\}}}}	}d
}|dk�rld}n|	�r~|d|	}ttd��r�tj\}
}}n<ttd
��r�tj\}
}}n"ttd��r�tj\}
}}nd}d}|jd�}
t|
�dk�r|
jd�dj|
�}|||||||f}|t|<|S)NZ
IronPythonz*failed to parse IronPython sys.version: %sr r�ZJythonz&failed to parse Jython sys.version: %sZPyPyz$failed to parse PyPy sys.version: %sz'failed to parse CPython sys.version: %sZCPythonr��_git�
_mercurial�
subversionr~r=r�)r�r�_sys_version_cacher�
startswith�_ironpython_sys_version_parserr`� _ironpython26_sys_version_parserr�reprr3r��_sys_version_parser�_pypy_sys_version_parserr)rrrrr.r�ru)�sys_versionrr�r`rZalt_versionZcompilerZbuildnoZ	builddateZ	buildtimer�ZbranchZrevisionrdrrr�_sys_version}s|











rcCs
t�dS)Nr)rrrrr�python_implementation�srcCs
t�dS)Nr?)rrrrr�python_version�srcCstt�djd��S)Nr?r~)rarrrrrr�python_version_tuple�s	rcCs
t�dS)Nr=)rrrrr�
python_branch
srcCs
t�dS)Nr)rrrrr�python_revisionsrcCst�dd�S)Nr�r�)rrrrr�python_build%srcCs
t�dS)Nr�)rrrrr�python_compiler-srcCs�tj||fd�}|dk	r|St�\}}}}}}||kr:d}|rPt|||�\}}}|dkr�t|�\}	}
}}|rxt||�}
nt||||�}
�n.|d
k�rtj��"tjddt	�t
d�\}}}WdQRX|r�|r�t||||d|||�}
n$ttj
�\}}t||||d||�}
n�|dk�r\t�\}}}\}}}|�s8|�rFt|||�}
nt|||d|||�}
n\|d	k�r�|�rxt||�}
nt|||�}
n2|�r�t||�}
n ttj
�\}}t||||||�}
|
t||f<|
S)Nr r��Linux�ignorez?dist\(\) and linux_distribution\(\) functions are deprecated .*�withr�ZonZMacOS)r)�_platform_cacherr�r�r�r�rg�catch_warnings�filterwarningsrirxr;r�r4r�r�)�aliased�terserr�rr�rr�rZrelZversr�r�r�rIZdistversionZdistidZlibcnameZlibcversionrnrr�r�r�r�r�r�rrrr�9s\







r��__main__rz--terseZ
nonaliasedz--nonaliased)rrr)r<rQrRrSrTrUrVrWrXrArYrZr[r\r]r^rB)rnrB)r �rrr)r r r r)r�r)r�r?)r�r=)r�N)r�r)r�r?)r�r=)r�r)r�N)rr)rN)r�r=)r�r)r�r?)r�r=)r�r)r�N)r r r r �r r r )r r r �r r r �r r r )r r r!r")r )r )r )r r�)r r�)r r�)N)rr)OZ
__copyright__�__version__�collectionsr�r*�rer�rg�devnullr�r�r�rrr�compilerr�ASCIIr/r4r;rPrtr_rbZ_supported_distsrermrjrxrzr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��
namedtupler�r�r�r�rr�rr�rrrr	rrrrrrrrrrr�__name__�argvrr�print�exitrrrr�<module>os� 




:26
	



0
0

#6 


T	
			
k




[
mailcap.cpython-36.opt-2.pyc000064400000013011150335715140011540 0ustar003

�\dhk#�@s�ddlZddlZddlZddgZdd�Zejd�jZGdd�de�Z	d	d�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zddgfdd�Zd"dd�Zgfdd�Zdd�Zdd�Zdd �Zed!kr�e�dS)#�N�getcaps�	findmatchcCsd|krd|dfSdSdS)N�linenor�)rr�)�entryrr�/usr/lib64/python3.6/mailcap.py�lineno_sort_key
sr	z[^\xa1-\U0010FFFF\w@+=:,./-]c@seZdZdS)�UnsafeMailcapInputN)�__name__�
__module__�__qualname__rrrrr
sr
cCs�i}d}x�t�D]�}yt|d�}Wntk
r8wYnX|�t||�\}}WdQRXx6|j�D]*\}}||kr||||<qb|||||<qbWqW|S)Nr�r)�listmailcapfiles�open�OSError�_readmailcapfile�items)�capsrZmailcap�fpZmorecaps�key�valuerrrrs

cCsPdtjkr"tjd}|jtj�}n*dtjkr8tjd}nd}|ddddg}|S)NZMAILCAPS�HOME�.z	/.mailcapz/etc/mailcapz/usr/etc/mailcapz/usr/local/etc/mailcap)�os�environ�split�pathsep)ZpathstrZmailcaps�homerrrr3s


rcCs tjdtd�t|d�\}}|S)Nz2readmailcapfile is deprecated, use getcaps instead�)�warnings�warn�DeprecationWarningr)rr�_rrr�readmailcapfileEsr$c	Csi}x�|j�}|sP|ddks|j�dkr.q|}x4|d
d�dkrf|j�}|sTd}|dd�|}q4Wt|�\}}|oz|s~q|dk	r�||d<|d7}|jd	�}x$tt|��D]}||j�||<q�Wd	j|�j�}||kr�||j|�q|g||<qW||fS)Nr�#�rz\
�
rr�/���r))	�readline�strip�	parseliner�range�len�join�lower�append)	rrr�lineZnextliner�fields�types�jrrrrMs6	
rc
Cs�g}dt|�}}x.||kr@t|||�\}}|j|�|d}qWt|�dkrRdS|d|d|dd�}}}d|i}x^|D]V}|jd�}|dkr�|}d}	n$|d|�j�}||dd�j�}	||kr�q�|	||<q�W||fS)Nrrr�view�=r&)NN)r.�
parsefieldr1�findr+)
r2r3�i�n�fieldrr6�restZfkeyZfvaluerrrr,vs*

 

r,cCsT|}x:||kr>||}|dkr"Pq|dkr4|d}q|d}qW|||�j�|fS)N�;�\rr)r+)r2r:r;�start�crrrr8�s

r8r6z	/dev/nullc
Cs�t|�r"d|f}tj|t�dSt|||�}xd|D]\}d|krnt|d||�}|dkrZq4|rntj|�dkrnq4t|||||�}	|	dk	r4|	|fSq4WdS)NzHRefusing to use mailcap with filename %r. Use a safe temporary filename.�testr)NN)NN)�_find_unsafer r!r
�lookup�substr�system)
r�MIMEtyper�filename�plist�msg�entries�erB�commandrrrr�s 	

cslg}||kr|||}|jd�}|dd}||krB|||}�dk	r\�fdd�|D�}t|td�}|S)Nr(rz/*csg|]}�|kr|�qSrr)�.0rL)rrr�
<listcomp>�szlookup.<locals>.<listcomp>)r)r�sortedr	)rrGrrKZ	MIMEtypesr)rrrD�s
rDcCs\d}dt|�}}�xB||k�rV||}|d}|dkrb|dkrX|||d�}|d}||}q||}|d}|dkr�||}q|dkr�||}q|dkr�t|�r�d|f}tj|t�dS||}q|d	k�rH|}	x ||kr�||d
kr�|d}q�W||	|�}
|d}t|
|�}t|��r>d||
f}tj|t�dS||}q|d|}qW|S)Nr&rr�%r?�s�tz9Refusing to substitute MIME type %r into a shell command.�{�}z=Refusing to substitute parameter %r (%s) into a shell command)r.rCr r!r
�	findparam)r<rGrHrI�resr:r;rArJr@�nameZparamrrrrE�sH








rEcCsF|j�d}t|�}x,|D]$}|d|�j�|kr||d�SqWdS)Nr7r&)r0r.)rXrIr;�prrrrV�s
rVc	Cs�ddl}t�}|jdd�s(t|�dSx�tdt|j�d�D]�}|j||d�}t|�dkrjtd�dS|d}|d}t||d|�\}}|s�tdt�q<td|�t	j
|�}|r<td|�q<WdS)	Nrrrz"usage: mailcap [MIMEtype file] ...r6zNo viewer found forz
Executing:zExit status:)�sysr�argv�showr-r.�printr�typerrF)	rZrr:�argsrG�filerMrL�stsrrrrBs&

rBcCs�td�xt�D]}td|�qWt�|s4t�}td�t�t|�}xX|D]P}t|�||}x:|D]2}t|�}x|D]}td|||�q|Wt�qjWqPWdS)NzMailcap files:�	zMailcap entries:z  %-15s)r]rrrP)r�fnZckeysr^rKrL�keys�krrrr\s"


r\�__main__)N)rr �re�__all__r	�compile�searchrC�Warningr
rrr$rr,r8rrDrErVrBr\rrrrr�<module>s()

)chunk.cpython-36.pyc000064400000011446150335715140010314 0ustar003


 \1�@sdZGdd�d�ZdS)aSimple class to read IFF chunks.

An IFF chunk (used in formats such as AIFF, TIFF, RMFF (RealMedia File
Format)) has the following structure:

+----------------+
| ID (4 bytes)   |
+----------------+
| size (4 bytes) |
+----------------+
| data           |
| ...            |
+----------------+

The ID is a 4-byte string which identifies the type of chunk.

The size field (a 32-bit value, encoded using big-endian byte order)
gives the size of the whole chunk, including the 8-byte header.

Usually an IFF-type file consists of one or more chunks.  The proposed
usage of the Chunk class defined here is to instantiate an instance at
the start of each chunk and read from the instance until it reaches
the end, after which a new instance can be instantiated.  At the end
of the file, creating a new instance will fail with an EOFError
exception.

Usage:
while True:
    try:
        chunk = Chunk(file)
    except EOFError:
        break
    chunktype = chunk.getname()
    while True:
        data = chunk.read(nbytes)
        if not data:
            pass
        # do something with data

The interface is file-like.  The implemented methods are:
read, close, seek, tell, isatty.
Extra methods are: skip() (called by close, skips to the end of the chunk),
getname() (returns the name (ID) of the chunk)

The __init__ method has one required argument, a file-like object
(including a chunk instance), and one optional argument, a flag which
specifies whether or not chunks are aligned on 2-byte boundaries.  The
default is 1, i.e. aligned.
c@sZeZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zddd�Zdd�Z	ddd�Z
dd�ZdS)�ChunkTFcCs�ddl}d|_||_|rd}nd}||_|jd�|_t|j�dkrFt�y |j|d|jd��d|_	Wn|j
k
r�t�YnX|r�|j	d|_	d|_y|jj�|_
Wnttfk
r�d|_YnXd|_dS)	N�F�>�<��L�T)�struct�closed�align�file�read�	chunkname�len�EOFErrorZunpack_from�	chunksize�error�	size_read�tell�offset�AttributeError�OSError�seekable)�selfrr
Z	bigendianZ
inclheaderrZstrflag�r�/usr/lib64/python3.6/chunk.py�__init__4s, 
zChunk.__init__cCs|jS)z*Return the name (ID) of the current chunk.)r
)rrrr�getnameNsz
Chunk.getnamecCs|jS)z%Return the size of the current chunk.)r)rrrr�getsizeRsz
Chunk.getsizecCs |jsz|j�Wdd|_XdS)NT)r	�skip)rrrr�closeVszChunk.closecCs|jrtd��dS)NzI/O operation on closed fileF)r	�
ValueError)rrrr�isatty]szChunk.isattyrcCsv|jrtd��|jstd��|dkr0||j}n|dkrB||j}|dksT||jkrXt�|jj|j	|d�||_dS)z�Seek to specified position into the chunk.
        Default position is 0 (start of chunk).
        If the file is not seekable, this will result in an error.
        zI/O operation on closed filezcannot seek��rN)
r	r rrrr�RuntimeErrorr�seekr)r�pos�whencerrrr%bs
z
Chunk.seekcCs|jrtd��|jS)NzI/O operation on closed file)r	r r)rrrrrusz
Chunk.tellr"cCs�|jrtd��|j|jkrdS|dkr2|j|j}||j|jkrN|j|j}|jj|�}|jt|�|_|j|jkr�|jr�|jd@r�|jjd�}|jt|�|_|S)z�Read at most size bytes from the chunk.
        If size is omitted or negative, read until the end
        of the chunk.
        zI/O operation on closed file�rr")r	r rrrrrr
)r�size�data�dummyrrrrzs 
z
Chunk.readcCs�|jrtd��|jrlyB|j|j}|jr:|jd@r:|d}|jj|d�|j||_dStk
rjYnXx4|j|jkr�t	d|j|j�}|j
|�}|snt�qnWdS)z�Skip the rest of the chunk.
        If you are not interested in the contents of the chunk,
        this method should be called so that the file points to
        the start of the next chunk.
        zI/O operation on closed filer"Ni )r	r rrrr
rr%r�minrr)r�nr+rrrr�s"
z
Chunk.skipN)TTF)r���)r.)�__name__�
__module__�__qualname__rrrrr!r%rrrrrrrr3s


rN)�__doc__rrrrr�<module>1senum.cpython-36.opt-2.pyc000064400000045332150335715140011111 0ustar003


 \F��@s>ddlZddlmZmZddlmZddlmZyddl	m
Z
Wn ek
r`ddlm
Z
YnXdddd	d
ddgZ
d
d�Zdd�Zdd�Zdd�Ze�ZGdd�d�ZGdd�de�ZdZGdd�de�ZGdd�ded�ZGdd�dee�Zdd�ZGdd	�d	e�ZGdd
�d
ee�Zd d!�Zd"d�Z d#d$�Z!d%d&�Z"dS)'�N)�MappingProxyType�DynamicClassAttribute)�reduce)�or_)�OrderedDict�EnumMeta�Enum�IntEnum�Flag�IntFlag�auto�uniquecCst|d�pt|d�pt|d�S)N�__get__�__set__�
__delete__)�hasattr)�obj�r�/usr/lib64/python3.6/enum.py�_is_descriptors

rcCsT|dd�|dd�ko"dknoR|dd�dkoR|dd�dkoRt|�dkS)	N��__��_�������r)�len)�namerrr�
_is_dunders(rcCsL|d|dkodknoJ|dd�dkoJ|dd�dkoJt|�dkS)Nr�rr���rr!)r)rrrr�
_is_sunder$s r"cCsdd�}||_d|_dS)NcSstd|��dS)Nz%r cannot be pickled)�	TypeError)�self�protorrr�_break_on_call_reduce-sz6_make_class_unpicklable.<locals>._break_on_call_reducez	<unknown>)�
__reduce_ex__�
__module__)�clsr&rrr�_make_class_unpicklable+sr*c@seZdZeZdS)rN)�__name__r(�__qualname__�
_auto_null�valuerrrrr3scs(eZdZ�fdd�Z�fdd�Z�ZS)�	_EnumDictcst�j�g|_g|_dS)N)�super�__init__�
_member_names�_last_values)r$)�	__class__rrr1As
z_EnumDict.__init__cs�t|�r.|dkrtd��|dkr�t|d|�n�t|�rD|dkr�d}n�||jkr\td|��nxt|�s�||kr�td	|||f��t|t�r�|j	t
kr�|j|d
t|j�|j
dd��|_	|j	}|jj|�|j
j|�t�j||�dS)N�_order_�_create_pseudo_member_�_generate_next_value_�	_missing_z(_names_ are reserved for future Enum use�_generate_next_value�	__order__zAttempted to reuse key: %rz%r already defined as: %rr )r5r6r7r8)r"�
ValueError�setattrrr2r#r�
isinstancerr.r-r9rr3�appendr0�__setitem__)r$�keyr.)r4rrr?Fs,	


"z_EnumDict.__setitem__)r+r(r,r1r?�
__classcell__rr)r4rr/:sr/cs�eZdZedd��Z�fdd�Zdd�Zd(ddddd	�d
d�Zdd
�Z�fdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zedd��Zdd�Zdd�Z�fd d!�Zddddd	�d"d#�Zed$d%��Zed&d'��Z�ZS))rcCs0t�}|j|�\}}|dk	r,t|dd�|d<|S)Nr7)r/�_get_mixins_�getattr)�metaclsr)�bases�	enum_dict�member_type�
first_enumrrr�__prepare__rs
zEnumMeta.__prepare__cs�|j|�\�}|j��|�\}}}�fdd��jD�}x�jD]
}	�|	=q>W�jdd�}
t|�dh@}|r~tdjdj|����d�kr�d�d<t�j	|||��}g|_
t�|_�|_
d	d
�|j�D�}
i|_d�k�r�tk	�rd}t�fdd�|D���st|��x6�jD�]*}||}t|t��s0|f}n|}�tk�rD|f}|�sf||�}t|d��s�||_n6||f|��}t|d��s��tk�r�||_n
�|�|_|j}||_||_|j|�x8|jj�D]\}	}|j|jk�r�|}P�q�W|j
j|�||
k�rt|||�||j|<y||j|<Wntk
�r6YnX�qWxPdD]H}	t||	�}t�|	d�}t||	d�}|dk	�rD||k�rDt||	|��qDWtdk	�r�|�r�||_ tj	|_	|
dk	�r�t|
t!��r�|
j"dd�j#�}
|
|j
k�r�td��|S)Ncsi|]}�||�qSrr)�.0�k)�	classdictrr�
<dictcomp>�sz$EnumMeta.__new__.<locals>.<dictcomp>r5�mrozInvalid enum member name: {0}�,�__doc__zAn enumeration.cSs.h|]&}|jj�D]\}}t|t�r|�qqSr)�__dict__�itemsr=r)rJ�crK�vrrr�	<setcomp>�sz#EnumMeta.__new__.<locals>.<setcomp>r'�__getnewargs_ex__�__getnewargs__�
__reduce__c3s|]}|�jkVqdS)N)rQ)rJ�m)rGrr�	<genexpr>�sz#EnumMeta.__new__.<locals>.<genexpr>�_value_�__repr__�__str__�
__format__� z#member order does not match _order_)rVrWr'rX)r\r]r^r')$rB�
_find_new_r2�pop�setr;�format�joinr0�__new__�_member_names_r�_member_map_�
_member_type_rN�_value2member_map_�object�anyr*r=�tuplerr[�_name_�__objclass__r1rRr>r<r#rCr�__new_member__�str�replace�split)rDr)rErLrHre�save_new�use_args�enum_membersrr5�
invalid_names�
enum_class�dynamic_attributes�methods�member_namer.�args�enum_member�canonical_member�class_method�
obj_method�enum_method)r4)rLrGrre|s�












zEnumMeta.__new__cCsdS)NTr)r$rrr�__bool__szEnumMeta.__bool__Nr )�module�qualname�type�startcCs*|dkr|j||�S|j||||||d�S)N)r�r�r�r�)re�_create_)r)r.�namesr�r�r�r�rrr�__call__szEnumMeta.__call__cCst||�o|j|jkS)N)r=rmrg)r)�memberrrr�__contains__)szEnumMeta.__contains__cs(||jkrtd|j��t�j|�dS)Nz%s: cannot delete Enum member.)rg�AttributeErrorr+r0�__delattr__)r)�attr)r4rrr�,s
zEnumMeta.__delattr__cCsddddg|jS)Nr4rP�__members__r()rf)r$rrr�__dir__4s
zEnumMeta.__dir__cCs>t|�rt|��y
|j|Stk
r8t|�d�YnXdS)N)rr�rg�KeyError)r)rrrr�__getattr__8s	
zEnumMeta.__getattr__cCs
|j|S)N)rg)r)rrrr�__getitem__HszEnumMeta.__getitem__cs�fdd��jD�S)Nc3s|]}�j|VqdS)N)rg)rJr)r)rrrZLsz$EnumMeta.__iter__.<locals>.<genexpr>)rf)r)r)r)r�__iter__KszEnumMeta.__iter__cCs
t|j�S)N)rrf)r)rrr�__len__NszEnumMeta.__len__cCs
t|j�S)N)rrg)r)rrrr�QszEnumMeta.__members__cCs
d|jS)Nz	<enum %r>)r+)r)rrrr\[szEnumMeta.__repr__cs�fdd�t�j�D�S)Nc3s|]}�j|VqdS)N)rg)rJr)r)rrrZ_sz(EnumMeta.__reversed__.<locals>.<genexpr>)�reversedrf)r)r)r)r�__reversed__^szEnumMeta.__reversed__cs0|jjdi�}||krtd��t�j||�dS)NrgzCannot reassign members.)rQ�getr�r0�__setattr__)r)rr.�
member_map)r4rrr�aszEnumMeta.__setattr__cCs�|j}|dkr|fn||f}|j|�\}	}
|j||�}t|t�rP|jdd�j�}t|ttf�r�|r�t|dt�r�|g}}g}
xDt	|�D]8\}}|
j
||||
dd��}|
j|�|j||f�q�Wx6|D].}t|t�r�|||}}n|\}}|||<q�W|j||||�}|dk�rTyt
jd�jd}Wn(ttfk
�rR}zWYdd}~XnX|dk�rht|�n||_|dk	�r~||_|S)NrOr_rrr+)r4rBrIr=rprqrrrl�list�	enumerater7r>re�sys�	_getframe�	f_globalsr�r;r*r(r,)r)�
class_namer�r�r�r�r�rDrErrHrL�original_names�last_values�countrr.�itemrz�member_valuerw�excrrrr�ns<
 







zEnumMeta._create_cCs�|sttfSd}}x,|D]$}|tk	rt|t�r|jrtd��qWt|t�sTtd��t|dt�st|d}|d}n8x6|djD](}t|t�r�|dkr�|}q�|dkr�|}q�W||fS)NzCannot extend enumerationszHnew enumerations must be created as `ClassName([mixin_type,] enum_type)`rr r!)rjr�
issubclassrfr#�__mro__)rErGrH�baserrrrB�s(




zEnumMeta._get_mixins_c	Cs�|jdd�}|dk	}|dkrtxVdD]H}x8||fD],}t||d�}|ddjtjtjhkr0|}Pq0W|dk	r"Pq"Wtj}|tjkr�d}nd}|||fS)NreroFT)rore)r�rCrerjr)	rLrGrHrers�method�possible�targetrtrrrr`�s(


zEnumMeta._find_new_)N)r+r(r,�classmethodrIrer�r�r�r�r�r�r�r�r��propertyr�r\r�r�r��staticmethodrBr`rArr)r4rrps&



5-c@s~eZdZdd�Zdd�Zedd��Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Ze
dd��Ze
dd��Zeddd��ZdS)rcCsjt|�|kr|Sy||jkr&|j|SWn6tk
r^x |jj�D]}|j|krD|SqDWYnX|j|�S)N)r�rir#rg�valuesr[r8)r)r.r�rrrres

zEnum.__new__cCs8x2t|�D]"}y|dStk
r*Yq
Xq
W|SdS)Nr )r�r#)rr�r�r��
last_valuerrrr7s
zEnum._generate_next_value_cCstd||jf��dS)Nz%r is not a valid %s)r;r+)r)r.rrrr8"szEnum._missing_cCsd|jj|j|jfS)Nz<%s.%s: %r>)r4r+rmr[)r$rrrr\&sz
Enum.__repr__cCsd|jj|jfS)Nz%s.%s)r4r+rm)r$rrrr]*szEnum.__str__cs&�fdd��jj�D�}dddg|S)Ncs2g|]*}|jD]}|ddkr|�jkr|�qqS)rr)rQrg)rJr)rY)r$rr�
<listcomp>/s
z Enum.__dir__.<locals>.<listcomp>r4rPr()r4rN)r$�added_behaviorr)r$rr�-s
zEnum.__dir__cCs0|jtkrt}t|�}n|j}|j}|j||�S)N)rhrjrpr[r^)r$�format_specr)�valrrrr^6s

zEnum.__format__cCs
t|j�S)N)�hashrm)r$rrr�__hash__Esz
Enum.__hash__cCs|j|jffS)N)r4r[)r$r%rrrr'HszEnum.__reduce_ex__cCs|jS)N)rm)r$rrrrRsz	Enum.namecCs|jS)N)r[)r$rrrr.Wsz
Enum.valueNc
s�ttj|�}�rt���n|���fdd��j�D�}y|jdd�d�Wn$tk
rp|jdd�d�YnX||||d�}t|_|j|j	�|||<|S)Ncs g|]}�|�r|�|f�qSrr)rJr)�filter�sourcerrr�qsz!Enum._convert.<locals>.<listcomp>cSs|d|dfS)Nr rr)�trrr�<lambda>vszEnum._convert.<locals>.<lambda>)r@cSs|dS)Nrr)r�rrrr�ys)r�)
�varsr��modules�keys�sortr#�_reduce_ex_by_namer'�updater�)r)rr�r�r��module_globals�membersr)r�r�r�_convert\s

z
Enum._convert)N)r+r(r,rer7r�r8r\r]r�r^r�r'rrr.r�rrrrr�s		
)�	metaclassc@seZdZdS)r	N)r+r(r,rrrrr	�scCs|jS)N)r)r$r%rrrr��sr�c@sleZdZdd�Zedd��Zedd��Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�ZdS)r
cCsd|s|dk	r|SdSxBt|�D]6}yt|�}PWqtk
rRtd|�d�YqXqWd|dS)Nr zInvalid Flag value: %rr)r��	_high_bit�	Exceptionr#)rr�r�r�r��high_bitrrrr7�s	zFlag._generate_next_value_cCs.|}|dkr|}|j|�}|dkr*|}|S)Nr)r6)r)r.�original_value�possible_memberrrrr8�s
zFlag._missing_cCsb|jj|d�}|dkr^t||�\}}|r:td||jf��tj|�}d|_||_|jj	||�}|S)Nz%r is not a valid %s)
rir��
_decomposer;r+rjrermr[�
setdefault)r)r.�
pseudo_memberr�extra_flagsrrrr6�s
zFlag._create_pseudo_member_cCs"t||j�stS|j|j@|jkS)N)r=r4�NotImplementedr[)r$�otherrrrr��szFlag.__contains__cCsV|j}|jdk	r$d|j|j|jfSt||j�\}}d|jdjdd�|D��|jfS)Nz<%s.%s: %r>�|cSsg|]}t|jp|j��qSr)rprmr[)rJrYrrrr��sz!Flag.__repr__.<locals>.<listcomp>)r4rmr+r[r�rd)r$r)r��	uncoveredrrrr\�s
z
Flag.__repr__cCs�|j}|jdk	r d|j|jfSt||j�\}}t|�dkr^|djdkr^d|j|djfSd|jdjdd�|D��fSdS)Nz%s.%sr rz%s.%rr�cSsg|]}t|jp|j��qSr)rprmr[)rJrYrrrr��sz Flag.__str__.<locals>.<listcomp>)r4rmr+r�r[rrd)r$r)r�r�rrrr]�s
zFlag.__str__cCs
t|j�S)N)�boolr[)r$rrrr��sz
Flag.__bool__cCs"t||j�stS|j|j|jB�S)N)r=r4r�r[)r$r�rrr�__or__�szFlag.__or__cCs"t||j�stS|j|j|j@�S)N)r=r4r�r[)r$r�rrr�__and__�szFlag.__and__cCs"t||j�stS|j|j|jA�S)N)r=r4r�r[)r$r�rrr�__xor__�szFlag.__xor__csDt�j�j�\�}��fdd��jD�}tt|�jd��}�j|�S)Ncs&g|]}|�kr|j�j@r|�qSr)r[)rJrY)r�r$rrr��sz#Flag.__invert__.<locals>.<listcomp>r)r�r4r[r�_or_)r$r��inverted_members�invertedr)r�r$r�
__invert__�szFlag.__invert__N)r+r(r,r7r�r8r6r�r\r]r�r�r�r�r�rrrrr
�s

c@sPeZdZedd��Zedd��Zdd�Zdd�Zd	d
�ZeZ	eZ
eZdd�Zd
S)rcCs*t|t�std||jf��|j|�}|S)Nz%r is not a valid %s)r=�intr;r+r6)r)r.�
new_memberrrrr8�s

zIntFlag._missing_cCs�|jj|d�}|dkr�|g}t||�\}}xL|rvt|�}d|}||jkr\||kr\|j|�||krld}q,||N}q,Wx6t|�D]*}tj||�}d|_||_	|jj
||�}q�W|S)Nrr)rir�r�r�r>r�r�rermr[r�)r)r.r��need_to_createrr��bit�
flag_valuerrrr6�s&


zIntFlag._create_pseudo_member_cCs0t||jtf�stS|j|j|j|�jB�}|S)N)r=r4r�r�r[)r$r��resultrrrr�szIntFlag.__or__cCs,t||jtf�stS|j|j|j|�j@�S)N)r=r4r�r�r[)r$r�rrrr�#szIntFlag.__and__cCs,t||jtf�stS|j|j|j|�jA�S)N)r=r4r�r�r[)r$r�rrrr�(szIntFlag.__xor__cCs|j|j�}|S)N)r4r[)r$r�rrrr�1szIntFlag.__invert__N)
r+r(r,r�r8r6r�r�r��__ror__�__rand__�__rxor__r�rrrrr�scCs|j�dS)Nr )�
bit_length)r.rrrr�6sr�cCsbg}x0|jj�D]"\}}||jkr|j||jf�qW|r^djdd�|D��}td||f��|S)Nz, cSsg|]\}}d||f�qS)z%s -> %sr)rJ�aliasrrrrr�Bszunique.<locals>.<listcomp>z duplicate values found in %r: %s)r�rRrr>rdr;)�enumeration�
duplicatesrr��
alias_detailsrrrr
:s
cCs�|}|dk}|r*dd�t|jj��D�}ndd�t|jj��D�}g}x4|D],\}}|rL||@|krL|j|�||M}qLW|r�||jkr�|j|j|�|jdd�dd�t|�d	kr�|dj|kr�|jd�||fS)
NrcSs"g|]\}}|jdk	r||f�qS)N)r)rJrTrYrrrr�Rsz_decompose.<locals>.<listcomp>cSs*g|]"\}}|jdk	st|�r||f�qS)N)r�
_power_of_two)rJrTrYrrrr�YscSs|jS)N)r[)rYrrrr�dsz_decompose.<locals>.<lambda>T)r@�reverser )r�rirRr>r�rr.ra)�flagr.�not_covered�negative�flags_to_checkr�r�r�rrrr�Gs$

r�cCs|dkrdS|dt|�kS)Nr Fr)r�)r.rrrr�jsr�)#r��typesrr�	functoolsr�operatorrr��_collectionsr�ImportError�collections�__all__rrr"r*rjr-r�dictr/rr�rr�r	r�r
rr�r
r�r�rrrr�<module>s@3mA
#struct.cpython-36.pyc000064400000000472150335715140010525 0ustar003


 \�@s8ddddddddgZdd	lTdd
lmZddlmZdS)
ZcalcsizeZpackZ	pack_intoZunpackZunpack_fromZiter_unpackZStruct�error�)�*)�_clearcache)�__doc__N)�__all__Z_structrr�rr�/usr/lib64/python3.6/struct.py�<module>s
lzma.cpython-36.opt-2.pyc000064400000013253150335715140011105 0ustar003


 \�2�$@s�dddddddddd	d
ddd
ddddddddddddddddddd d!d"d#g$Zd$d%lZd$d%lZd$d%lZd$d&lTd$d'lmZmZd$d%lZd$Zd(Z	d)Z
Gd*d�dej�Zd0d%d1d%d%d%d%d%d,�d-d �Z
ed2d%d%fd.d!�Zed%d%fd/d"�Zd%S)3Z
CHECK_NONEZCHECK_CRC32ZCHECK_CRC64ZCHECK_SHA256ZCHECK_ID_MAXZ
CHECK_UNKNOWNZFILTER_LZMA1ZFILTER_LZMA2ZFILTER_DELTAZ
FILTER_X86ZFILTER_IA64Z
FILTER_ARMZFILTER_ARMTHUMBZFILTER_POWERPCZFILTER_SPARC�FORMAT_AUTO�	FORMAT_XZZFORMAT_ALONEZ
FORMAT_RAWZMF_HC3ZMF_HC4ZMF_BT2ZMF_BT3ZMF_BT4Z	MODE_FASTZMODE_NORMALZPRESET_DEFAULTZPRESET_EXTREME�LZMACompressor�LZMADecompressor�LZMAFile�	LZMAError�open�compress�
decompressZis_check_supported�N)�*)�_encode_filter_properties�_decode_filter_properties��c@s�eZdZd!dd"ddd�dd�Zdd�Zed	d
��Zdd�Zd
d�Zdd�Z	dd�Z
d$dd�Zd&dd�Zd(dd�Z
d*dd�Zdd�Zejfdd�Zdd �ZdS)+rN�rr)�format�check�preset�filtersc	Cs&d|_d|_t|_|dkrL|dkr*td��|dk	r:td��|dkrFt}t}n@|dkr~|dkr`t}t}t	||||d
�|_
d|_ntdj|���t
|tttjf�r�d|kr�|d7}tj||�|_d|_||_n*t|d�s�t|d�r�||_||_ntd��|jtk�r"tj|jtt||d�}tj|�|_dS)NFr�rbrzACannot specify an integrity check when opening a file for readingzICannot specify a preset compression level when opening a file for reading�w�wb�a�ab�x�xb)rrrrr
zInvalid mode: {!r}�bT�read�writez6filename must be a str, bytes, file or PathLike object)Ztrailing_errorrr)rr���)rrrrrr)�_fp�_closefp�_MODE_CLOSED�_mode�
ValueErrorr�
_MODE_READr�_MODE_WRITEr�_compressor�_posr�
isinstance�str�bytes�os�PathLike�builtinsr�hasattr�	TypeError�_compressionZDecompressReaderrr�io�BufferedReader�_buffer)	�self�filename�moderrrrZ	mode_code�raw�r9�/usr/lib64/python3.6/lzma.py�__init__1sB,
zLZMAFile.__init__cCs�|jtkrdSzB|jtkr,|jj�d|_n"|jtkrN|jj|jj	��d|_Wdz|j
rd|jj�Wdd|_d|_
t|_XXdS)NF)r#r"r%r4�closer&r rr'�flushr!)r5r9r9r:r<�s




zLZMAFile.closecCs
|jtkS)N)r#r")r5r9r9r:�closed�szLZMAFile.closedcCs|j�|jj�S)N)�_check_not_closedr �fileno)r5r9r9r:r@�szLZMAFile.filenocCs|j�o|jj�S)N)�readabler4�seekable)r5r9r9r:rB�szLZMAFile.seekablecCs|j�|jtkS)N)r?r#r%)r5r9r9r:rA�szLZMAFile.readablecCs|j�|jtkS)N)r?r#r&)r5r9r9r:�writable�szLZMAFile.writablecCs|j�|jj|�S)N)�_check_can_readr4�peek)r5�sizer9r9r:rE�sz
LZMAFile.peekcCs|j�|jj|�S)N)rDr4r)r5rFr9r9r:r�sz
LZMAFile.readcCs"|j�|dkrtj}|jj|�S)Nr
)rDr2�DEFAULT_BUFFER_SIZEr4�read1)r5rFr9r9r:rH�szLZMAFile.read1cCs|j�|jj|�S)N)rDr4�readline)r5rFr9r9r:rI�szLZMAFile.readlinecCs:|j�|jj|�}|jj|�|jt|�7_t|�S)N)Z_check_can_writer'rr rr(�len)r5�dataZ
compressedr9r9r:r�s
zLZMAFile.writecCs|j�|jj||�S)N)Z_check_can_seekr4�seek)r5�offset�whencer9r9r:rL�sz
LZMAFile.seekcCs"|j�|jtkr|jj�S|jS)N)r?r#r%r4�tellr()r5r9r9r:rO�s

z
LZMAFile.tell)Nrrr)rr)rr)rr)r)�__name__�
__module__�__qualname__r;r<�propertyr>r@rBrArCrErrHrIrr2�SEEK_SETrLrOr9r9r9r:r&sT

	



r)rrrr�encoding�errors�newlinecCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|jdd�}	t||	||||d�}
d|kr�tj|
|||�S|
SdS)	N�trzInvalid mode: %rz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary mode�)rrrr)r$�replacerr2�
TextIOWrapper)r6r7rrrrrUrVrWZlz_modeZbinary_filer9r9r:rs

cCs t||||�}|j|�|j�S)N)rrr=)rKrrrr�compr9r9r:r6scCsrg}xbt|||�}y|j|�}Wntk
r>|r8Pn�YnX|j|�|jsXtd��|j}|sPqWdj|�S)NzACompressed data ended before the end-of-stream marker was reached�)rr	r�append�eofZunused_data�join)rKrZmemlimitrZresultsZdecomp�resr9r9r:r	Bs 
)rrr)�__all__r.r2r,Z_lzmarr
r1r"r%r&Z
BaseStreamrrrrrr	r9r9r9r:�<module>s0

b-doctest.cpython-36.opt-1.pyc000064400000223122150335715140011604 0ustar003


 \Ǘ�!@stdZdZdddddddd	d
ddd
ddddddddddddddddddd d!d"g!Zd#d$lZd#d$lZd#d$lZd#d$lZd#d$lZd#d$lZd#d$l	Z	d#d$l
Z
d#d$lZd#d$lZd#d$l
Z
d#d%lmZd#d&lmZed'd(�ZiZd)d�Zed�Zed�Zed�Zed�Zed�Zed�ZeeBeBeBeBeBZed
�Zed�Zed�Zed
�Zed�Z eeBeBeBe BZ!d*Z"d+Z#d,d-�Z$dqd/d0�Z%d1d2�Z&drd4d5�Z'd6d7�Z(Gd8d9�d9e�Z)d:d;�Z*d<d=�Z+d>d?�Z,Gd@dA�dAe	j-�Z.dBdC�Z/GdDd�d�Z0GdEd�d�Z1GdFd�d�Z2GdGd�d�Z3GdHd�d�Z4GdId�d�Z5GdJd�de6�Z7GdKd�de6�Z8GdLd�de4�Z9d$a:dsdOd�Z;dMd$d$d$d$dMd#d$dNe2�d$fdPd�Z<dtdRd�Z=d#a>dSd�Z?GdTdU�dUe
j@�ZAGdVdW�dWeA�ZBGdXdY�dYe
jC�ZDdudZd�ZEGd[d\�d\eA�ZFdMd$d$e2�d$fd]d^�ZGd_d�ZHd`d�ZIdad �ZJdvdbd!�ZKdwdcdd�ZLdxded"�ZMGdfdg�dg�ZNeNdhdidjdkdldm�ZOdndo�ZPeQdpk�rpejReP��d$S)ya�Module doctest -- a framework for running examples in docstrings.

In simplest use, end each module M to be tested with:

def _test():
    import doctest
    doctest.testmod()

if __name__ == "__main__":
    _test()

Then running the module as a script will cause the examples in the
docstrings to get executed and verified:

python M.py

This won't display anything unless an example fails, in which case the
failing example(s) and the cause(s) of the failure(s) are printed to stdout
(why not stderr? because stderr is a lame hack <0.2 wink>), and the final
line of output is "Test failed.".

Run it with the -v switch instead:

python M.py -v

and a detailed report of all examples tried is printed to stdout, along
with assorted summaries at the end.

You can force verbose mode by passing "verbose=True" to testmod, or prohibit
it by passing "verbose=False".  In either of those cases, sys.argv is not
examined by testmod.

There are a variety of other ways to run doctests, including integration
with the unittest framework, and support for running non-Python text
files containing doctests.  There are also many ways to override parts
of doctest's default behaviors.  See the Library Reference Manual for
details.
zreStructuredText en�register_optionflag�DONT_ACCEPT_TRUE_FOR_1�DONT_ACCEPT_BLANKLINE�NORMALIZE_WHITESPACE�ELLIPSIS�SKIP�IGNORE_EXCEPTION_DETAIL�COMPARISON_FLAGS�REPORT_UDIFF�REPORT_CDIFF�REPORT_NDIFF�REPORT_ONLY_FIRST_FAILURE�REPORTING_FLAGS�	FAIL_FAST�Example�DocTest�
DocTestParser�
DocTestFinder�
DocTestRunner�
OutputChecker�DocTestFailure�UnexpectedException�DebugRunner�testmod�testfile�run_docstring_examples�DocTestSuite�DocFileSuite�set_unittest_reportflags�script_from_examples�
testsource�	debug_src�debug�N)�StringIO)�
namedtuple�TestResultszfailed attemptedcCstj|dtt�>�S)N�)�OPTIONFLAGS_BY_NAME�
setdefault�len)�name�r+�/usr/lib64/python3.6/doctest.pyr�sz<BLANKLINE>z...cCs<d}x2tjD](}|j|d�}|tt|�kr||jO}qW|S)z�
    Return the compiler-flags associated with the future features that
    have been imported into the given namespace (globs).
    r"N)�
__future__Zall_feature_names�get�getattrZ
compiler_flag)�globs�flagsZfnameZfeaturer+r+r,�_extract_future_flags�sr2�cCsVtj|�r|St|t�r,t|t�t�dg�S|dkrJtjtj	|�j
dStd��dS)a�
    Return the module specified by `module`.  In particular:
      - If `module` is a module, then return module.
      - If `module` is a string, then import and return the
        module with that name.
      - If `module` is None, then return the calling module.
        The calling module is assumed to be the module of
        the stack frame at the given depth in the call stack.
    �*N�__name__z"Expected a module, string, or None)�inspect�ismodule�
isinstance�str�
__import__�globals�locals�sys�modules�	_getframe�	f_globals�	TypeError)�moduleZdepthr+r+r,�_normalize_module�s


rCc	Cs�|r\t|d�}t||�}t|dd�dk	r\t|jd�r\|jj|�}|j|�}|jtj	d�|fSt
||d��}|j�|fSQRXdS)N��
__loader__�get_data�
)�encoding)rC�_module_relative_pathr/�hasattrrErF�decode�replace�os�linesep�open�read)�filename�package�module_relativerHZ
file_contents�fr+r+r,�_load_testfile�s


rU�cCstjd|d|�S)z~
    Add the given number of space characters to the beginning of
    every non-blank line in `s`, and return the result.
    z
(?m)^(?!$)� )�re�sub)�s�indentr+r+r,�_indent�sr\cCs*t�}|\}}}tj||||d�|j�S)zz
    Return a string containing a traceback message for the given
    exc_info tuple (as returned by sys.exc_info()).
    )�file)r#�	traceback�print_exception�getvalue)�exc_infoZexcout�exc_typeZexc_valZexc_tbr+r+r,�_exception_traceback�s
rcc@seZdZdd�Zddd�ZdS)�	_SpoofOutcCs&tj|�}|r"|jd�r"|d7}|S)NrG)r#r`�endswith)�self�resultr+r+r,r`�s
z_SpoofOut.getvalueNcCs|j|�tj|�dS)N)�seekr#�truncate)rf�sizer+r+r,ris
z_SpoofOut.truncate)N)r5�
__module__�__qualname__r`rir+r+r+r,rd�s	rdcCs�t|kr||kS|jt�}dt|�}}|d}|rR|j|�rNt|�}|d=ndS|d}|r�|j|�r||t|�8}|d=ndS||kr�dSx2|D]*}|j|||�}|dkr�dS|t|�7}q�WdS)z_
    Essentially the only subtle case:
    >>> _ellipsis_match('aa...aa', 'aaa')
    False
    r"Fr&T���rm)�ELLIPSIS_MARKER�splitr)�
startswithre�find)�want�gotZws�startpos�endpos�wr+r+r,�_ellipsis_matchs0



rwcCs|j�}|rd|SdSdS)z)Return a commented form of the given linez# �#N)�rstrip)�liner+r+r,�
_comment_line9sr{cCshdt|�}}|jd�}|dkr$|}|jdd|�}|dkr>|}|jdd|�}|dkr\|d}|||�S)Nr"rG�:�.r&)r)rq�rfind)�msg�start�end�ir+r+r,�_strip_exception_detailsAs
r�c@s2eZdZdZdd�Zddd�Zdd�Zd	d
�ZdS)�_OutputRedirectingPdbz�
    A specialized version of the python debugger that redirects stdout
    to a given stream when interacting with the user.  Stdout is *not*
    redirected when traced code is executed.
    cCs(||_d|_tjj||dd�d|_dS)NFT)�stdout�nosigintr&)�_OutputRedirectingPdb__out�$_OutputRedirectingPdb__debugger_used�pdb�Pdb�__init__Zuse_rawinput)rf�outr+r+r,r�asz_OutputRedirectingPdb.__init__NcCs*d|_|dkrtj�j}tjj||�dS)NT)r�r=r?�f_backr�r��	set_trace)rf�framer+r+r,r�is
z_OutputRedirectingPdb.set_tracecCs|jrtjj|�dS)N)r�r�r��set_continue)rfr+r+r,r�osz"_OutputRedirectingPdb.set_continuecGs.tj}|jt_ztjj|f|��S|t_XdS)N)r=r�r�r�r��trace_dispatch)rf�args�save_stdoutr+r+r,r�us
z$_OutputRedirectingPdb.trace_dispatch)N)r5rkrl�__doc__r�r�r�r�r+r+r+r,r�[s

r�cCs�tj|�std|��|jd�r(td��tjj|jd��}t	|d�rXtjj|j
�d}n�|jdkr�tt
j�dkr�t
jddkr�tjjt
jd�d}q�tj}nFt	|d�r�x,|jD]"}tjj||�}tjj|�r�|Sq�Wtd	|j��tjj||�S)
NzExpected a module: %r�/z1Module-relative files may not have absolute paths�__file__r"�__main__��__path__zBCan't resolve paths relative to the module %r (it has no __file__))r6r7rArp�
ValueErrorrM�path�joinrorJr�r5r)r=�argv�curdirr��exists)rBZ	test_pathZbasedirZ	directoryZfullpathr+r+r,rI�s&





rIc@s*eZdZdZd
dd�Zdd�Zdd	�ZdS)ran
    A single doctest example, consisting of source code and expected
    output.  `Example` defines the following attributes:

      - source: A single Python statement, always ending with a newline.
        The constructor adds a newline if needed.

      - want: The expected output from running the source code (either
        from stdout, or a traceback in case of exception).  `want` ends
        with a newline unless it's empty, in which case it's an empty
        string.  The constructor adds a newline if needed.

      - exc_msg: The exception message generated by the example, if
        the example is expected to generate an exception; or `None` if
        it is not expected to generate an exception.  This exception
        message is compared against the return value of
        `traceback.format_exception_only()`.  `exc_msg` ends with a
        newline unless it's `None`.  The constructor adds a newline
        if needed.

      - lineno: The line number within the DocTest string containing
        this Example where the Example begins.  This line number is
        zero-based, with respect to the beginning of the DocTest.

      - indent: The example's indentation in the DocTest string.
        I.e., the number of space characters that precede the
        example's first prompt.

      - options: A dictionary mapping from option flags to True or
        False, which is used to override default options for this
        example.  Any option flags not contained in this dictionary
        are left at their default value (as specified by the
        DocTestRunner's optionflags).  By default, no options are set.
    Nr"cCsz|jd�s|d7}|r*|jd�r*|d7}|dk	rF|jd�rF|d7}||_||_||_||_|dkrji}||_||_dS)NrG)re�sourcerr�linenor[�options�exc_msg)rfr�rrr�r�r[r�r+r+r,r��s
zExample.__init__cCs\t|�t|�k	rtS|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkS)N)�type�NotImplementedr�rrr�r[r�r�)rf�otherr+r+r,�__eq__�szExample.__eq__cCst|j|j|j|j|jf�S)N)�hashr�rrr�r[r�)rfr+r+r,�__hash__�szExample.__hash__)Nr"r"N)r5rkrlr�r�r�r�r+r+r+r,r�s
"
c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rae
    A collection of doctest examples that should be run in a single
    namespace.  Each `DocTest` defines the following attributes:

      - examples: the list of examples.

      - globs: The namespace (aka globals) that the examples should
        be run in.

      - name: A name identifying the DocTest (typically, the name of
        the object whose docstring this DocTest was extracted from).

      - filename: The name of the file that this DocTest was extracted
        from, or `None` if the filename is unknown.

      - lineno: The line number within filename where this DocTest
        begins, or `None` if the line number is unavailable.  This
        line number is zero-based, with respect to the beginning of
        the file.

      - docstring: The string that the examples were extracted from,
        or `None` if the string is unavailable.
    cCs,||_||_|j�|_||_||_||_dS)z�
        Create a new DocTest containing the given examples.  The
        DocTest's globals are initialized with a copy of `globs`.
        N)�examples�	docstring�copyr0r*rQr�)rfr�r0r*rQr�r�r+r+r,r�
s
zDocTest.__init__cCsRt|j�dkrd}n"t|j�dkr(d}ndt|j�}d|jj|j|j|j|fS)Nr"zno examplesr&z	1 examplez%d examplesz<%s %s from %s:%s (%s)>)r)r��	__class__r5r*rQr�)rfr�r+r+r,�__repr__szDocTest.__repr__cCs\t|�t|�k	rtS|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkS)N)r�r�r�r�r0r*rQr�)rfr�r+r+r,r�#szDocTest.__eq__cCst|j|j|j|jf�S)N)r�r�r*rQr�)rfr+r+r,r�.szDocTest.__hash__cCs:t|t�stS|j|j|jt|�f|j|j|jt|�fkS)N)r8rr�r*rQr��id)rfr�r+r+r,�__lt__2s
zDocTest.__lt__N)	r5rkrlr�r�r�r�r�r�r+r+r+r,r�sc@s�eZdZdZejdejejB�ZejdejejBej	B�Z
ejd�jZddd�Z
dd	�Zdd
d�Zdd
�Zejdej�Zdd�Zejdej�Zdd�Zdd�Zdd�ZdS)rzD
    A class used to parse strings containing doctest examples.
    a�
        # Source consists of a PS1 line followed by zero or more PS2 lines.
        (?P<source>
            (?:^(?P<indent> [ ]*) >>>    .*)    # PS1 line
            (?:\n           [ ]*  \.\.\. .*)*)  # PS2 lines
        \n?
        # Want consists of any non-blank lines that do not start with PS1.
        (?P<want> (?:(?![ ]*$)    # Not a blank line
                     (?![ ]*>>>)  # Not a line starting with PS1
                     .+$\n?       # But any other line
                  )*)
        a�
        # Grab the traceback header.  Different versions of Python have
        # said different things on the first traceback line.
        ^(?P<hdr> Traceback\ \(
            (?: most\ recent\ call\ last
            |   innermost\ last
            ) \) :
        )
        \s* $                # toss trailing whitespace on the header.
        (?P<stack> .*?)      # don't blink: absorb stuff until...
        ^ (?P<msg> \w+ .*)   #     a line *starts* with alphanum.
        z^[ ]*(#.*)?$�<string>cs|j�}|j|���dkr8dj�fdd�|jd�D��}g}d\}}x�|jj|�D]�}|j|||j���||jd||j��7}|j	|||�\}}}	}
|j
|�s�|jt||	|
|�t|j
d��|d��||jd|j�|j��7}|j�}qRW|j||d��|S)	a=
        Divide the given string into examples and intervening text,
        and return them as a list of alternating Examples and strings.
        Line numbers for the Examples are 0-based.  The optional
        argument `name` is a name identifying this string, and is only
        used for error messages.
        r"rGcsg|]}|�d��qS)Nr+)�.0�l)�
min_indentr+r,�
<listcomp>ysz'DocTestParser.parse.<locals>.<listcomp>r[)r�r[r�N)r"r")�
expandtabs�_min_indentr�ro�_EXAMPLE_RE�finditer�appendr��count�_parse_example�_IS_BLANK_OR_COMMENTrr)�groupr�)rf�stringr*�outputZcharnor��mr�r�rrr�r+)r�r,�parsems&


zDocTestParser.parsecCst|j||�|||||�S)a"
        Extract all doctest examples from the given string, and
        collect them into a `DocTest` object.

        `globs`, `name`, `filename`, and `lineno` are attributes for
        the new `DocTest` object.  See the documentation for `DocTest`
        for more information.
        )r�get_examples)rfr�r0r*rQr�r+r+r,�get_doctest�s	zDocTestParser.get_doctestcCsdd�|j||�D�S)a�
        Extract all doctest examples from the given string, and return
        them as a list of `Example` objects.  Line numbers are
        0-based, because it's most common in doctests that nothing
        interesting appears on the same line as opening triple-quote,
        and so the first interesting line is called "line 1" then.

        The optional argument `name` is a name identifying this
        string, and is only used for error messages.
        cSsg|]}t|t�r|�qSr+)r8r)r��xr+r+r,r��sz.DocTestParser.get_examples.<locals>.<listcomp>)r�)rfr�r*r+r+r,r��szDocTestParser.get_examplesc
s
t|jd���|jd�jd�}|j|�||�|j|dd�d�d||�dj�fdd	�|D��}|jd
�}|jd�}t|�dkr�tjd|d�r�|d=|j|d�||t|��dj�fdd	�|D��}|jj|�}|r�|jd
�}nd}|j	|||�}	||	||fS)a�
        Given a regular expression match from `_EXAMPLE_RE` (`m`),
        return a pair `(source, want)`, where `source` is the matched
        example's source code (with prompts and indentation stripped);
        and `want` is the example's expected output (with indentation
        stripped).

        `name` is the string's name, and `lineno` is the line number
        where the example starts; both are used for error messages.
        r[r�rGr&NrWr}csg|]}|�dd��qS)rVNr+)r�Zsl)r[r+r,r��sz0DocTestParser._parse_example.<locals>.<listcomp>rrz *$csg|]}|�d��qS)Nr+)r�Zwl)r[r+r,r��srrmrm)
r)r�ro�_check_prompt_blank�
_check_prefixr�rX�match�
_EXCEPTION_RE�
_find_options)
rfr�r*r��source_linesr�rr�
want_linesr�r�r+)r[r,r��s$ 

zDocTestParser._parse_examplez#\s*doctest:\s*([^\n\'"]*)$c	Cs�i}x�|jj|�D]z}|jd�jdd�j�}x^|D]V}|ddksR|dd�tkrhtd|d||f��t|dd�}|ddk||<q2WqW|r�|j|�r�td	|||f��|S)
a
        Return a dictionary containing option overrides extracted from
        option directives in the given source string.

        `name` is the string's name, and `lineno` is the line number
        where the example starts; both are used for error messages.
        r&�,rWr"z+-Nz7line %r of the doctest for %s has an invalid option: %r�+zSline %r of the doctest for %s has an option directive on a line with no example: %r)�_OPTION_DIRECTIVE_REr�r�rLror'r�r�)	rfr�r*r�r�r�Zoption_strings�option�flagr+r+r,r��s
zDocTestParser._find_optionsz
^([ ]*)(?=\S)cCs2dd�|jj|�D�}t|�dkr*t|�SdSdS)z;Return the minimum indentation of any non-blank line in `s`cSsg|]}t|��qSr+)r))r�r[r+r+r,r�sz-DocTestParser._min_indent.<locals>.<listcomp>r"N)�
_INDENT_RE�findallr)�min)rfrZ�indentsr+r+r,r�szDocTestParser._min_indentc	Csbx\t|�D]P\}}t|�|dkr
||ddkr
td||d||||d�|f��q
WdS)a

        Given the lines of a source string (including prompts and
        leading indentation), check to make sure that every prompt is
        followed by a space character.  If any line is not followed by
        a space character, then raise ValueError.
        rVrDrWz8line %r of the docstring for %s lacks blank after %s: %rr&N)�	enumerater)r�)rf�linesr[r*r�r�rzr+r+r,r�
s
 z!DocTestParser._check_prompt_blankcCsDx>t|�D]2\}}|r
|j|�r
td||d||f��q
WdS)z�
        Check that every line in the given list starts with the given
        prefix; if any line does not, then raise a ValueError.
        zGline %r of the docstring for %s has inconsistent leading whitespace: %rr&N)r�rpr�)rfr��prefixr*r�r�rzr+r+r,r�szDocTestParser._check_prefixN)r�)r�)r5rkrlr�rX�compile�	MULTILINE�VERBOSEr��DOTALLr�r�r�r�r�r�r�r�r�r�r�r�r�r+r+r+r,r=s"
'
3c@sNeZdZdZde�ddfdd�Zddd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)ra<
    A class used to extract the DocTests that are relevant to a given
    object, from its docstring and the docstrings of its contained
    objects.  Doctests can currently be extracted from the following
    object types: modules, functions, classes, methods, staticmethods,
    classmethods, and properties.
    FTcCs||_||_||_||_dS)at
        Create a new doctest finder.

        The optional argument `parser` specifies a class or
        function that should be used to create new DocTest objects (or
        objects that implement the same interface as DocTest).  The
        signature for this factory function should match the signature
        of the DocTest constructor.

        If the optional argument `recurse` is false, then `find` will
        only examine the given object, and not any contained objects.

        If the optional argument `exclude_empty` is false, then `find`
        will include tests for objects with empty docstrings.
        N)�_parser�_verbose�_recurse�_exclude_empty)rf�verbose�parser�recurse�
exclude_emptyr+r+r,r�1szDocTestFinder.__init__Nc	CsP|dkr.t|dd�}|dkr.tdt|�f��|dkr<d}n|dkrNtj|�}ytj|�}Wntk
rtd}YndX|s�tj|�}|d|d	d�dks�d}|dkr�d}n*|dk	r�tj	||j
�}n
tj	|�}|s�d}|dk�r�|dkr�i}n
|j
j�}n|j�}|dk	�r|j|�d|k�r*d|d<g}|j
||||||i�|j�|S)
aj
        Return a list of the DocTests that are defined by the given
        object's docstring, or by any of its contained objects'
        docstrings.

        The optional parameter `module` is the module that contains
        the given object.  If the module is not specified or is None, then
        the test finder will attempt to automatically determine the
        correct module.  The object's module is used:

            - As a default namespace, if `globs` is not specified.
            - To prevent the DocTestFinder from extracting DocTests
              from objects that are imported from other modules.
            - To find the name of the file containing the object.
            - To help find the line number of the object within its
              file.

        Contained objects whose module does not match `module` are ignored.

        If `module` is False, no attempt to find the module will be made.
        This is obscure, of use mostly in tests:  if `module` is False, or
        is None but cannot be found automatically, then all objects are
        considered to belong to the (non-existent) module, so all contained
        objects will (recursively) be searched for doctests.

        The globals for each DocTest is formed by combining `globs`
        and `extraglobs` (bindings in `extraglobs` override bindings
        in `globs`).  A new copy of the globals dictionary is created
        for each DocTest.  If `globs` is not specified, then it
        defaults to the module's `__dict__`, if specified, or {}
        otherwise.  If `extraglobs` is not specified, then it defaults
        to {}.

        Nr5zJDocTestFinder.find: name must be given when obj.__name__ doesn't exist: %rFr"r3z<]>r����)r/r�r�r6�	getmoduleZ
getsourcefilerAZgetfile�	linecache�getlines�__dict__r��update�_find�sort)	rf�objr*rBr0�
extraglobsr]r��testsr+r+r,rqGsJ$







zDocTestFinder.findcCs�|dkrdStj|�dk	r(|tj|�kStj|�r>|j|jkStj|�r|t|d�r\|jj}nt|d�rn|j}ndS|j	|kStj
|�r�|j	|jkSt|d�r�|j	|jkSt|t�r�dSt
d��dS)zY
        Return true if the given object is defined in the given
        module.
        NT�__objclass__rkz"object must be a class or function)r6r��
isfunctionr��__globals__ZismethoddescriptorrJr�rkr5�isclassr8�propertyr�)rfrB�objectZobj_modr+r+r,�_from_module�s(








zDocTestFinder._from_modulec	Cs(|jrtd|�t|�|kr"dSd|t|�<|j|||||�}|dk	rR|j|�tj|�r�|jr�x^|jj	�D]P\}	}
d||	f}	tj
tj|
��s�tj|
�rn|j
||
�rn|j||
|	||||�qnWtj|�o�|j�rtx�t|di�j	�D]�\}	}
t|	t��stdt|	�f��tj
|
��p8tj|
��p8tj|
��p8t|
t��sNtdt|
�f��d||	f}	|j||
|	||||�q�Wtj|��r$|j�r$x�|jj	�D]�\}	}
t|
t��r�t||	�}
t|
t��r�t||	�j}
tj
|
��s�tj|
��s�t|
t��r�|j
||
��r�d||	f}	|j||
|	||||��q�WdS)	zm
        Find tests for the given object and any contained objects, and
        add them to `tests`.
        zFinding tests in %sNr&z%s.%s�__test__z5DocTestFinder.find: __test__ keys must be strings: %rz`DocTestFinder.find: __test__ values must be strings, functions, methods, classes, or modules: %rz%s.__test__.%s)r��printr��	_get_testr�r6r7r�r��itemsZ	isroutineZunwrapr�r�r�r/r8r9r�r��staticmethod�classmethod�__func__r�)rfr�r�r*rBr�r0�seen�testZvalname�valr+r+r,r��sP


zDocTestFinder._findc	Cs�t|t�r|}nJy,|jdkr"d}n|j}t|t�s:t|�}Wnttfk
rXd}YnX|j||�}|jrv|rvdS|dkr�d}n*t|d|j�}|dd�dkr�|dd�}|j	j
|||||�S)	zs
        Return a DocTest for the given object, if it defines a docstring;
        otherwise, return None.
        Nr�r�rVz.pycr&���rm)r8r9r�rA�AttributeError�_find_linenor�r/r5r�r�)	rfr�r*rBr0r�r�r�rQr+r+r,r�s(



zDocTestFinder._get_testcCsd}tj|�rd}tj|�rd|dkr(dStjdt|dd��}x$t|�D]\}}|j|�rH|}PqHWtj|�rt|j	}tj
|�r�|j}tj|�r�|j
}tj|�r�|j}tj|�r�t|dd�d}|dk	�r|dkr�|dStjd�}x(t|t|��D]}|j||�r�|Sq�WdS)	z�
        Return a line number of the given object's docstring.  Note:
        this method assumes that the object has a docstring.
        Nr"z^\s*class\s*%s\br5�-�co_firstlinenor&z(^|.*:)\s*\w*("|\'))r6r7r�rXr�r/r�r�Zismethodr�r��__code__Zistraceback�tb_frameZisframe�f_codeZiscode�ranger))rfr�r�r�Zpatr�rzr+r+r,r-s<









zDocTestFinder._find_lineno)NNNN)r5rkrlr�rr�rqr�r�r�rr+r+r+r,r(s
f?%c@s�eZdZdZddZd dd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Ze
jd�Zd!dd�Zd"dd�Zd#dd�Zdd�ZdS)$ra3	
    A class used to run DocTest test cases, and accumulate statistics.
    The `run` method is used to process a single DocTest case.  It
    returns a tuple `(f, t)`, where `t` is the number of test cases
    tried, and `f` is the number of test cases that failed.

        >>> tests = DocTestFinder().find(_TestClass)
        >>> runner = DocTestRunner(verbose=False)
        >>> tests.sort(key = lambda test: test.name)
        >>> for test in tests:
        ...     print(test.name, '->', runner.run(test))
        _TestClass -> TestResults(failed=0, attempted=2)
        _TestClass.__init__ -> TestResults(failed=0, attempted=2)
        _TestClass.get -> TestResults(failed=0, attempted=2)
        _TestClass.square -> TestResults(failed=0, attempted=1)

    The `summarize` method prints a summary of all the test cases that
    have been run by the runner, and returns an aggregated `(f, t)`
    tuple:

        >>> runner.summarize(verbose=1)
        4 items passed all tests:
           2 tests in _TestClass
           2 tests in _TestClass.__init__
           2 tests in _TestClass.get
           1 tests in _TestClass.square
        7 tests in 4 items.
        7 passed and 0 failed.
        Test passed.
        TestResults(failed=0, attempted=7)

    The aggregated number of tried examples and failed examples is
    also available via the `tries` and `failures` attributes:

        >>> runner.tries
        7
        >>> runner.failures
        0

    The comparison between expected outputs and actual outputs is done
    by an `OutputChecker`.  This comparison may be customized with a
    number of option flags; see the documentation for `testmod` for
    more information.  If the option flags are insufficient, then the
    comparison may also be customized by passing a subclass of
    `OutputChecker` to the constructor.

    The test runner's display output can be controlled in two ways.
    First, an output function (`out) can be passed to
    `TestRunner.run`; this function will be called with strings that
    should be displayed.  It defaults to `sys.stdout.write`.  If
    capturing the output is not sufficient, then the display output
    can be also customized by subclassing DocTestRunner, and
    overriding the methods `report_start`, `report_success`,
    `report_unexpected_exception`, and `report_failure`.
    r4�FNr"cCsN|pt�|_|dkrdtjk}||_||_||_d|_d|_i|_	t
�|_dS)ac
        Create a new test runner.

        Optional keyword arg `checker` is the `OutputChecker` that
        should be used to compare the expected outputs and actual
        outputs of doctest examples.

        Optional keyword arg 'verbose' prints lots of stuff if true,
        only failures if false; by default, it's true iff '-v' is in
        sys.argv.

        Optional argument `optionflags` can be used to control how the
        test runner compares expected output to actual output, and how
        it displays failures.  See the documentation for `testmod` for
        more information.
        Nz-vr")r�_checkerr=r�r��optionflags�original_optionflags�tries�failures�_name2ftrd�_fakeout)rf�checkerr�rr+r+r,r��s
zDocTestRunner.__init__cCsH|jrD|jr.|dt|j�dt|j��n|dt|j�d�dS)z�
        Report that the test runner is about to process the given
        example.  (Only displays a message if verbose=True)
        zTrying:
zExpecting:
zExpecting nothing
N)r�rrr\r�)rfr�r��exampler+r+r,�report_start�s zDocTestRunner.report_startcCs|jr|d�dS)zt
        Report that the given example ran successfully.  (Only
        displays a message if verbose=True)
        zok
N)r�)rfr�r�rrsr+r+r,�report_success�szDocTestRunner.report_successcCs&||j||�|jj|||j��dS)z7
        Report that the given example failed.
        N)�_failure_headerr�output_differencer)rfr�r�rrsr+r+r,�report_failure�szDocTestRunner.report_failurecCs$||j||�dtt|���dS)zO
        Report that the given example raised an unexpected exception.
        zException raised:
N)rr\rc)rfr�r�rrar+r+r,�report_unexpected_exception�sz)DocTestRunner.report_unexpected_exceptioncCs�|jg}|jrR|jdk	r4|jdk	r4|j|jd}nd}|jd|j||jf�n|jd|jd|jf�|jd�|j}|jt|��dj|�S)Nr&�?zFile "%s", line %s, in %szLine %s, in %szFailed example:rG)�DIVIDERrQr�r�r*r�r\r�)rfr�rr�r�r�r+r+r,r�s
zDocTestRunner._failure_headercCs�d}}|j}td�\}}}	|jj}
�xFt|j�D�]6\}}|jt@oL|dk}
||_|jr�x:|jj�D],\}}|r�|j|O_qf|j|M_qfW|jt	@r�q2|d7}|
s�|j
|||�d|j|f}y,tt
|j|d|d�|j�|jj�d}Wn4tk
�r�Yntj�}|jj�YnX|jj�}|jjd�|}|dk�rh|
|j||j��r�|}n|tj|dd��d}|
�s�|t|�7}|jdk�r�|	}nB|
|j||j��r�|}n*|jt@�r�|
t|j�t|�|j��r�|}||k�r|
�sZ|j||||�nT||k�r0|
�s&|j ||||�|d7}n*||	k�rZ|
�sP|j!||||�|d7}n|r2|jt"@r2Pq2W||_|j#|||�t$||�S)	a�
        Run the examples in `test`.  Write the outcome of each example
        with one of the `DocTestRunner.report_*` methods, using the
        writer function `out`.  `compileflags` is the set of compiler
        flags that should be used to execute examples.  Return a tuple
        `(f, t)`, where `t` is the number of examples tried, and `f`
        is the number of examples that failed.  The examples are run
        in the namespace `test.globs`.
        r"rDr&z<doctest %s[%d]>ZsingleNr3rm)%rr	r�check_outputr�r�rr�r�rrr*�execr�r�r0�debuggerr��KeyboardInterruptr=rarr`rirrr^�format_exception_onlyrcr�rr�rrrr�_DocTestRunner__record_outcomer%)rfr��compileflagsr�rrr
�SUCCESS�FAILUREZBOOMZcheck�
examplenumr�quietZ
optionflagrrQZ	exceptionrsZoutcomer�r+r+r,Z__run�s�












zDocTestRunner.__runcCsL|jj|jd�\}}||||f|j|j<|j|7_|j|7_dS)z{
        Record the fact that the given DocTest (`test`) generated `f`
        failures out of `t` tried examples.
        r"N)r"r")rr.r*rr)rfr�rT�t�f2�t2r+r+r,Z__record_outcomeuszDocTestRunner.__record_outcomez.<doctest (?P<name>.+)\[(?P<examplenum>\d+)\]>$cCsV|jj|�}|rF|jd�|jjkrF|jjt|jd��}|jjdd�S|j	||�SdS)Nr*r%T)�keepends)
�%_DocTestRunner__LINECACHE_FILENAME_REr�r�r�r*r��intr��
splitlines�save_linecache_getlines)rfrQ�module_globalsr�rr+r+r,Z__patched_linecache_getlines�s
z*DocTestRunner.__patched_linecache_getlinesTc	s�||_|dkrt|j�}tj�|dkrV�j��dks@�j�dkrH�j}n��fdd�}|jt_tj	�}t
j}t��|_
|j
j�|j
jt
_tj|_|jt_tj}tjt_z|j|||�S�t_|t
_tj|�|jt_|t_|r�|jj�ddl}d|_XdS)aJ
        Run the examples in `test`, and display the results using the
        writer function `out`.

        The examples are run in the namespace `test.globs`.  If
        `clear_globs` is true (the default), then this namespace will
        be cleared after the test runs, to help with garbage
        collection.  If you would like to examine the namespace after
        the test completes, then use `clear_globs=False`.

        `compileflags` gives the set of flags that should be used by
        the Python compiler when running the examples.  If not
        specified, then it will default to the set of future-import
        flags that apply to `globs`.

        The output of each example is checked using
        `DocTestRunner.check_output`, and the results are formatted by
        the `DocTestRunner.report_*` methods.
        Nzutf-8cs t|j�d���}�j|�dS)N�backslashreplace)r9�encode�write)rZ)rHr�r+r,r��szDocTestRunner.run.<locals>.outr")r�r2r0r=r�rH�lowerr2r�gettracer�r�r�r�resetr�r�r.�*_DocTestRunner__patched_linecache_getlines�displayhook�__displayhook__�_DocTestRunner__run�settrace�clear�builtins�_)	rfr�r"r��clear_globsZ
save_traceZsave_set_traceZsave_displayhookr<r+)rHr�r,�run�s<





zDocTestRunner.runc
Cs�|dkr|j}g}g}g}d}}xd|jj�D]V}|\}\}	}
||
7}||	7}|
dkrb|j|�q.|	dkrz|j||
f�q.|j|�q.W|r�|r�tt|�d�|j�x|D]}td|�q�W|r�tt|�d�|j�x |D]\}}td||f�q�W|�rJt|j�tt|�d�|j�x(|D] \}\}	}
td|	|
|f��q&W|�rvt|d	t|j�d
�t||d|d�|�r�td
|d�n|�r�td�t||�S)a�
        Print a summary of all the test cases that have been run by
        this DocTestRunner, and return a tuple `(f, t)`, where `f` is
        the total number of failed examples, and `t` is the total
        number of tried examples.

        The optional `verbose` argument controls how detailed the
        summary is.  If the verbosity is not specified, then the
        DocTestRunner's verbosity is used.
        Nr"zitems had no tests:z   zitems passed all tests:z %3d tests in %szitems had failures:z %3d of %3d in %sztests inzitems.z
passed andzfailed.z***Test Failed***z	failures.zTest passed.)	r�rr�r�r�r)r�rr%)
rfr�ZnotestsZpassedZfailedZtotaltZtotalfr�r*rTr'�thingr�r+r+r,�	summarize�sP

zDocTestRunner.summarizecCsV|j}xJ|jj�D]<\}\}}||krB||\}}||}||}||f||<qWdS)N)rr�)rfr��dr*rTr'r(r)r+r+r,�mergeszDocTestRunner.merge)NNr")N)NNT)N)r5rkrlr�rr�rrrrrr9r!rXr�r+r6r?rArCr+r+r+r,ras7
$
}



I
9c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)ra_
    A class used to check the whether the actual output from a doctest
    example matches the expected output.  `OutputChecker` defines two
    methods: `check_output`, which compares a given pair of outputs,
    and returns true if they match; and `output_difference`, which
    returns a string describing the differences between two outputs.
    cCst|jdd�d�S)z=
        Convert string to hex-escaped ASCII string.
        �ASCIIr0)r9r1)rfrZr+r+r,�_toAscii!szOutputChecker._toAsciicCs�|j|�}|j|�}||kr dS|t@sH||fdkr8dS||fdkrHdS|t@s�tjdtjt�d|�}tjdd|�}||kr�dS|t@r�d	j|j	��}d	j|j	��}||kr�dS|t
@r�t||�r�dSd
S)
a�
        Return True iff the actual output from an example (`got`)
        matches the expected output (`want`).  These strings are
        always considered to match if they are identical; but
        depending on what option flags the test runner is using,
        several non-exact match types are also possible.  See the
        documentation for `TestRunner` for more information about
        option flags.
        T�True
�1
�False
�0
z(?m)^%s\s*?$r�z
(?m)^\s*?$rWF)rFrG)rHrI)rErrrXrY�escape�BLANKLINE_MARKERrr�rorrw)rfrrrsrr+r+r,r's0


zOutputChecker.check_outputcCs<|ttBtB@sdS|t@r dS|jd�dko:|jd�dkS)NFTrGr3)r	r
rr�)rfrrrsrr+r+r,�_do_a_fancy_difffszOutputChecker._do_a_fancy_diffc
Cs8|j}|t@stjdt|�}|j|||�r�|jdd�}|jdd�}|t@rptj	||dd�}t
|�dd�}d}nZ|t@r�tj||dd�}t
|�dd�}d}n,|t
@r�tjtjd	�}	t
|	j||��}d
}ndd�|D�}d
|tdj|��S|o�|�rdt|�t|�fS|�rdt|�S|�r0dt|�SdSdS)z�
        Return a string describing the differences between the
        expected output for a given example (`example`) and the actual
        output (`got`).  `optionflags` is the set of option flags used
        to compare `want` and `got`.
        z(?m)^[ ]*(?=
)T)r*r3)�nNz#unified diff with -expected +actualz-context diff with expected followed by actual)Zcharjunkzndiff with -expected +actualcSsg|]}|j�d�qS)rG)ry)r�rzr+r+r,r��sz3OutputChecker.output_difference.<locals>.<listcomp>zDifferences (%s):
r�zExpected:
%sGot:
%szExpected:
%sGot nothing
zExpected nothing
Got:
%szExpected nothing
Got nothing
)rrrrXrYrKrLr-r	�difflibZunified_diff�listr
Zcontext_diffrZDifferZIS_CHARACTER_JUNKZcomparer\r�)
rfrrsrrrr�Z	got_linesZdiffZkindZenginer+r+r,r}s6
zOutputChecker.output_differenceN)r5rkrlr�rErrLrr+r+r+r,rs
?c@s eZdZdZdd�Zdd�ZdS)rz�A DocTest example has failed in debugging mode.

    The exception instance has variables:

    - test: the DocTest object being run

    - example: the Example object that failed

    - got: the actual output
    cCs||_||_||_dS)N)r�rrs)rfr�rrsr+r+r,r��szDocTestFailure.__init__cCs
t|j�S)N)r9r�)rfr+r+r,�__str__�szDocTestFailure.__str__N)r5rkrlr�r�rPr+r+r+r,r�s
c@s eZdZdZdd�Zdd�ZdS)rz�A DocTest example has encountered an unexpected exception

    The exception instance has variables:

    - test: the DocTest object being run

    - example: the Example object that failed

    - exc_info: the exception info
    cCs||_||_||_dS)N)r�rra)rfr�rrar+r+r,r��szUnexpectedException.__init__cCs
t|j�S)N)r9r�)rfr+r+r,rP�szUnexpectedException.__str__N)r5rkrlr�r�rPr+r+r+r,r�s
c@s*eZdZdZd
dd�Zdd�Zdd	�ZdS)ra�	Run doc tests but raise an exception as soon as there is a failure.

       If an unexpected exception occurs, an UnexpectedException is raised.
       It contains the test, the example, and the original exception:

         >>> runner = DebugRunner(verbose=False)
         >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42',
         ...                                    {}, 'foo', 'foo.py', 0)
         >>> try:
         ...     runner.run(test)
         ... except UnexpectedException as f:
         ...     failure = f

         >>> failure.test is test
         True

         >>> failure.example.want
         '42\n'

         >>> exc_info = failure.exc_info
         >>> raise exc_info[1] # Already has the traceback
         Traceback (most recent call last):
         ...
         KeyError

       We wrap the original exception to give the calling application
       access to the test and example information.

       If the output doesn't match, then a DocTestFailure is raised:

         >>> test = DocTestParser().get_doctest('''
         ...      >>> x = 1
         ...      >>> x
         ...      2
         ...      ''', {}, 'foo', 'foo.py', 0)

         >>> try:
         ...    runner.run(test)
         ... except DocTestFailure as f:
         ...    failure = f

       DocTestFailure objects provide access to the test:

         >>> failure.test is test
         True

       As well as to the example:

         >>> failure.example.want
         '2\n'

       and the actual output:

         >>> failure.got
         '1\n'

       If a failure or error occurs, the globals are left intact:

         >>> del test.globs['__builtins__']
         >>> test.globs
         {'x': 1}

         >>> test = DocTestParser().get_doctest('''
         ...      >>> x = 2
         ...      >>> raise KeyError
         ...      ''', {}, 'foo', 'foo.py', 0)

         >>> runner.run(test)
         Traceback (most recent call last):
         ...
         doctest.UnexpectedException: <DocTest foo from foo.py:0 (2 examples)>

         >>> del test.globs['__builtins__']
         >>> test.globs
         {'x': 2}

       But the globals are cleared if there is no error:

         >>> test = DocTestParser().get_doctest('''
         ...      >>> x = 2
         ...      ''', {}, 'foo', 'foo.py', 0)

         >>> runner.run(test)
         TestResults(failed=0, attempted=1)

         >>> test.globs
         {}

       NTcCs$tj||||d�}|r |jj�|S)NF)rr?r0r;)rfr�r"r�r>�rr+r+r,r?.s
zDebugRunner.runcCst|||��dS)N)r)rfr�r�rrar+r+r,r4sz'DebugRunner.report_unexpected_exceptioncCst|||��dS)N)r)rfr�r�rrsr+r+r,r7szDebugRunner.report_failure)NNT)r5rkrlr�r?rrr+r+r+r,r�sY
TFc	Cs�|dkrtjjd�}tj|�s,td|f��|dkr:|j}t|d�}	|rVt||d�}
nt	||d�}
x$|	j
||||d�D]}|
j|�qvW|r�|
j�t
dkr�|
a
n
t
j|
�t|
j|
j�S)a*
m=None, name=None, globs=None, verbose=None, report=True,
       optionflags=0, extraglobs=None, raise_on_error=False,
       exclude_empty=False

    Test examples in docstrings in functions and classes reachable
    from module m (or the current module if m is not supplied), starting
    with m.__doc__.

    Also test examples reachable from dict m.__test__ if it exists and is
    not None.  m.__test__ maps names to functions, classes and strings;
    function and class docstrings are tested even if the name is private;
    strings are tested directly, as if they were docstrings.

    Return (#failures, #tests).

    See help(doctest) for an overview.

    Optional keyword arg "name" gives the name of the module; by default
    use m.__name__.

    Optional keyword arg "globs" gives a dict to be used as the globals
    when executing examples; by default, use m.__dict__.  A copy of this
    dict is actually used for each docstring, so that each docstring's
    examples start with a clean slate.

    Optional keyword arg "extraglobs" gives a dictionary that should be
    merged into the globals that are used to execute examples.  By
    default, no extra globals are used.  This is new in 2.4.

    Optional keyword arg "verbose" prints lots of stuff if true, prints
    only failures if false; by default, it's true iff "-v" is in sys.argv.

    Optional keyword arg "report" prints a summary at the end when true,
    else prints nothing at the end.  In verbose mode, the summary is
    detailed, else very brief (in fact, empty if all tests passed).

    Optional keyword arg "optionflags" or's together module constants,
    and defaults to 0.  This is new in 2.3.  Possible values (see the
    docs for details):

        DONT_ACCEPT_TRUE_FOR_1
        DONT_ACCEPT_BLANKLINE
        NORMALIZE_WHITESPACE
        ELLIPSIS
        SKIP
        IGNORE_EXCEPTION_DETAIL
        REPORT_UDIFF
        REPORT_CDIFF
        REPORT_NDIFF
        REPORT_ONLY_FIRST_FAILURE

    Optional keyword arg "raise_on_error" raises an exception on the
    first unexpected exception or failure. This allows failures to be
    post-mortem debugged.

    Advanced tomfoolery:  testmod runs methods of a local instance of
    class doctest.Tester, then merges the results into (or creates)
    global Tester instance doctest.master.  Methods of doctest.master
    can be called directly too, if you want to do something unusual.
    Passing report=0 to testmod is especially useful then, to delay
    displaying a summary.  Invoke doctest.master.summarize(verbose)
    when you're done fiddling.
    Nr�ztestmod: module required; %r)r�)r�r)r0r�)r=r>r.r6r7rAr5rrrrqr?rA�masterrCr%rr)r�r*r0r��reportrr��raise_on_errorr��finder�runnerr�r+r+r,rCs$E


cCs�|r|rtd��t||||p d�\}}|dkr<tjj|�}|dkrJi}n|j�}|dk	rd|j|�d|krtd|d<|	r�t||d�}
nt||d�}
|
j	||||d�}|
j
|�|r�|
j�tdkr�|
an
tj
|
�t|
j|
j�S)a


    Test examples in the given file.  Return (#failures, #tests).

    Optional keyword arg "module_relative" specifies how filenames
    should be interpreted:

      - If "module_relative" is True (the default), then "filename"
         specifies a module-relative path.  By default, this path is
         relative to the calling module's directory; but if the
         "package" argument is specified, then it is relative to that
         package.  To ensure os-independence, "filename" should use
         "/" characters to separate path segments, and should not
         be an absolute path (i.e., it may not begin with "/").

      - If "module_relative" is False, then "filename" specifies an
        os-specific path.  The path may be absolute or relative (to
        the current working directory).

    Optional keyword arg "name" gives the name of the test; by default
    use the file's basename.

    Optional keyword argument "package" is a Python package or the
    name of a Python package whose directory should be used as the
    base directory for a module relative filename.  If no package is
    specified, then the calling module's directory is used as the base
    directory for module relative filenames.  It is an error to
    specify "package" if "module_relative" is False.

    Optional keyword arg "globs" gives a dict to be used as the globals
    when executing examples; by default, use {}.  A copy of this dict
    is actually used for each docstring, so that each docstring's
    examples start with a clean slate.

    Optional keyword arg "extraglobs" gives a dictionary that should be
    merged into the globals that are used to execute examples.  By
    default, no extra globals are used.

    Optional keyword arg "verbose" prints lots of stuff if true, prints
    only failures if false; by default, it's true iff "-v" is in sys.argv.

    Optional keyword arg "report" prints a summary at the end when true,
    else prints nothing at the end.  In verbose mode, the summary is
    detailed, else very brief (in fact, empty if all tests passed).

    Optional keyword arg "optionflags" or's together module constants,
    and defaults to 0.  Possible values (see the docs for details):

        DONT_ACCEPT_TRUE_FOR_1
        DONT_ACCEPT_BLANKLINE
        NORMALIZE_WHITESPACE
        ELLIPSIS
        SKIP
        IGNORE_EXCEPTION_DETAIL
        REPORT_UDIFF
        REPORT_CDIFF
        REPORT_NDIFF
        REPORT_ONLY_FIRST_FAILURE

    Optional keyword arg "raise_on_error" raises an exception on the
    first unexpected exception or failure. This allows failures to be
    post-mortem debugged.

    Optional keyword arg "parser" specifies a DocTestParser (or
    subclass) that should be used to extract tests from the files.

    Optional keyword arg "encoding" specifies an encoding that should
    be used to convert the file to unicode.

    Advanced tomfoolery:  testmod runs methods of a local instance of
    class doctest.Tester, then merges the results into (or creates)
    global Tester instance doctest.master.  Methods of doctest.master
    can be called directly too, if you want to do something unusual.
    Passing report=0 to testmod is especially useful then, to delay
    displaying a summary.  Invoke doctest.master.summarize(verbose)
    when you're done fiddling.
    z8Package may only be specified for module-relative paths.zutf-8Nr5r�)r�rr")r�rUrMr��basenamer�r�rrr�r?rArRrCr%rr)rQrSr*rRr0r�rSrr�rTr�rH�textrVr�r+r+r,r�s0R



�NoNamec	CsDt|dd�}t||d�}x&|j|||d�D]}|j||d�q*WdS)ar
    Test examples in the given object's docstring (`f`), using `globs`
    as globals.  Optional argument `name` is used in failure messages.
    If the optional argument `verbose` is true, then generate output
    even if there are no failures.

    `compileflags` gives the set of flags that should be used by the
    Python compiler when running the examples.  If not specified, then
    it will default to the set of future-import flags that apply to
    `globs`.

    Optional keyword arg `optionflags` specifies options for the
    testing and output.  See the documentation for `testmod` for more
    information.
    F)r�r�)r�r)r0)r"N)rrrqr?)	rTr0r�r*r"rrUrVr�r+r+r,r&scCs"|t@|krtd|��t}|a|S)a?Sets the unittest option flags.

    The old flag is returned so that a runner could restore the old
    value if it wished to:

      >>> import doctest
      >>> old = doctest._unittest_reportflags
      >>> doctest.set_unittest_reportflags(REPORT_NDIFF |
      ...                          REPORT_ONLY_FIRST_FAILURE) == old
      True

      >>> doctest._unittest_reportflags == (REPORT_NDIFF |
      ...                                   REPORT_ONLY_FIRST_FAILURE)
      True

    Only reporting flags can be set:

      >>> doctest.set_unittest_reportflags(ELLIPSIS)
      Traceback (most recent call last):
      ...
      ValueError: ('Only reporting flags allowed', 8)

      >>> doctest.set_unittest_reportflags(old) == (REPORT_NDIFF |
      ...                                   REPORT_ONLY_FIRST_FAILURE)
      True
    zOnly reporting flags allowed)r
r��_unittest_reportflags)r1�oldr+r+r,rCs

c@sjeZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�ZeZ
dd�ZdS)�DocTestCaser"NcCs.tjj|�||_||_||_||_||_dS)N)�unittest�TestCaser��_dt_optionflags�_dt_checker�_dt_test�	_dt_setUp�_dt_tearDown)rfr�r�setUp�tearDownrr+r+r,r�iszDocTestCase.__init__cCs|j}|jdk	r|j|�dS)N)rarb)rfr�r+r+r,rdss
zDocTestCase.setUpcCs(|j}|jdk	r|j|�|jj�dS)N)rarcr0r;)rfr�r+r+r,reys

zDocTestCase.tearDowncCs�|j}tj}t�}|j}|t@s(|tO}t||jdd�}z$dd|_	|j
||jdd�\}}Wd|t_X|r~|j|j
|j����dS)NF)rrr�rr
)r�r>)rar=r�r#r_r
rZrr`rr?r2ZfailureException�format_failurer`)rfr�r[�newrrVrrr+r+r,�runTest�s
zDocTestCase.runTestcCsP|j}|jdkrd}n
d|j}dj|jjd�dd��}d|j|j|||fS)Nzunknown line numberz%sr}r&z:Failed doctest test for %s
  File "%s", line %s, in %s

%srm)rar�r�r*rorQ)rf�errr�r�Zlnamer+r+r,rf�s

zDocTestCase.format_failurecCs6|j�t|j|jdd�}|j|jdd�|j�dS)a�Run the test case without results and without catching exceptions

           The unit test framework includes a debug method on test cases
           and test suites to support post-mortem debugging.  The test code
           is run in such a way that errors are not caught.  This way a
           caller can catch the errors and initiate post-mortem debugging.

           The DocTestCase provides a debug method that raises
           UnexpectedException errors if there is an unexpected
           exception:

             >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42',
             ...                {}, 'foo', 'foo.py', 0)
             >>> case = DocTestCase(test)
             >>> try:
             ...     case.debug()
             ... except UnexpectedException as f:
             ...     failure = f

           The UnexpectedException contains the test, the example, and
           the original exception:

             >>> failure.test is test
             True

             >>> failure.example.want
             '42\n'

             >>> exc_info = failure.exc_info
             >>> raise exc_info[1] # Already has the traceback
             Traceback (most recent call last):
             ...
             KeyError

           If the output doesn't match, then a DocTestFailure is raised:

             >>> test = DocTestParser().get_doctest('''
             ...      >>> x = 1
             ...      >>> x
             ...      2
             ...      ''', {}, 'foo', 'foo.py', 0)
             >>> case = DocTestCase(test)

             >>> try:
             ...    case.debug()
             ... except DocTestFailure as f:
             ...    failure = f

           DocTestFailure objects provide access to the test:

             >>> failure.test is test
             True

           As well as to the example:

             >>> failure.example.want
             '2\n'

           and the actual output:

             >>> failure.got
             '1\n'

           F)rrr�)r>N)rdrr_r`r?rare)rfrVr+r+r,r!�s
BzDocTestCase.debugcCs|jjS)N)rar*)rfr+r+r,r��szDocTestCase.idcCsPt|�t|�k	rtS|j|jkoN|j|jkoN|j|jkoN|j|jkoN|j|jkS)N)r�r�rar_rbrcr`)rfr�r+r+r,r��szDocTestCase.__eq__cCst|j|j|j|jf�S)N)r�r_rbrcr`)rfr+r+r,r��szDocTestCase.__hash__cCs,|jjjd�}d|ddj|dd��fS)Nr}z%s (%s)r&rmrm)rar*ror�)rfr*r+r+r,r��szDocTestCase.__repr__cCsd|jjS)Nz	Doctest: )rar*)rfr+r+r,�shortDescription	szDocTestCase.shortDescription)r"NNN)r5rkrlr�rdrerhrfr!r�r�r�r�rPrjr+r+r+r,r\gs
	H
r\c@s0eZdZdd�Zdd�Zdd�Zdd�ZeZd	S)
�SkipDocTestCasecCs||_tj|d�dS)N)rBr\r�)rfrBr+r+r,r�	szSkipDocTestCase.__init__cCs|jd�dS)Nz-DocTestSuite will not work with -O2 and above)ZskipTest)rfr+r+r,rd	szSkipDocTestCase.setUpcCsdS)Nr+)rfr+r+r,�	test_skip	szSkipDocTestCase.test_skipcCsd|jjS)NzSkipping tests from %s)rBr5)rfr+r+r,rj	sz SkipDocTestCase.shortDescriptionN)r5rkrlr�rdrlrjrPr+r+r+r,rk	s
rkc@seZdZdd�ZdS)�
_DocTestSuitecCsdS)Nr+)rf�indexr+r+r,�_removeTestAtIndex	sz _DocTestSuite._removeTestAtIndexN)r5rkrlror+r+r+r,rm	srmc	Ks�|dkrt�}t|�}|j|||d�}|rPtjjdkrPt�}|jt|��|S|j	�t�}x\|D]T}t
|j�dkrxqd|js�|j
}|dd�dkr�|dd	�}||_|jt|f|��qdW|S)
a
    Convert doctest tests for a module to a unittest test suite.

    This converts each documentation string in a module that
    contains doctest tests to a unittest test case.  If any of the
    tests in a doc string fail, then the test case fails.  An exception
    is raised showing the name of the file containing the test and a
    (sometimes approximate) line number.

    The `module` argument provides the module to be tested.  The argument
    can be either a module or a module name.

    If no argument is given, the calling module is used.

    A number of options may be provided as keyword arguments:

    setUp
      A set-up function.  This is called before running the
      tests in each file. The setUp function will be passed a DocTest
      object.  The setUp function can access the test globals as the
      globs attribute of the test passed.

    tearDown
      A tear-down function.  This is called after running the
      tests in each file.  The tearDown function will be passed a DocTest
      object.  The tearDown function can access the test globals as the
      globs attribute of the test passed.

    globs
      A dictionary containing initial global variables for the tests.

    optionflags
       A set of doctest option flags expressed as an integer.
    N)r0r�r3r"rVz.pycr&rrm)rrCrqr=r1�optimizerm�addTestrkr�r)r�rQr�r\)	rBr0r�Ztest_finderr�r��suiter�rQr+r+r,r	s(%
c@s(eZdZdd�Zdd�ZeZdd�ZdS)�DocFileCasecCsdj|jjjd��S)Nr=r})r�rar*ro)rfr+r+r,r�`	szDocFileCase.idcCs|jjS)N)rarQ)rfr+r+r,r�c	szDocFileCase.__repr__cCsd|jj|jj|fS)Nz2Failed doctest test for %s
  File "%s", line 0

%s)rar*rQ)rfrir+r+r,rfg	szDocFileCase.format_failureN)r5rkrlr�r�rPrfr+r+r+r,rs^	srsc
Ksx|dkri}n|j�}|r(|r(td��t||||p6d�\}}d|krN||d<tjj|�}|j||||d�}	t|	f|�S)Nz8Package may only be specified for module-relative paths.zutf-8r�r")r�r�rUrMr�rWr�rs)
r�rSrRr0r�rHr��docr*r�r+r+r,�DocFileTestl	s
rucOsHt�}|jdd�r$t|jd��|d<x|D]}|jt|f|��q*W|S)a�A unittest suite for one or more doctest files.

    The path to each doctest file is given as a string; the
    interpretation of that string depends on the keyword argument
    "module_relative".

    A number of options may be provided as keyword arguments:

    module_relative
      If "module_relative" is True, then the given file paths are
      interpreted as os-independent module-relative paths.  By
      default, these paths are relative to the calling module's
      directory; but if the "package" argument is specified, then
      they are relative to that package.  To ensure os-independence,
      "filename" should use "/" characters to separate path
      segments, and may not be an absolute path (i.e., it may not
      begin with "/").

      If "module_relative" is False, then the given file paths are
      interpreted as os-specific paths.  These paths may be absolute
      or relative (to the current working directory).

    package
      A Python package or the name of a Python package whose directory
      should be used as the base directory for module relative paths.
      If "package" is not specified, then the calling module's
      directory is used as the base directory for module relative
      filenames.  It is an error to specify "package" if
      "module_relative" is False.

    setUp
      A set-up function.  This is called before running the
      tests in each file. The setUp function will be passed a DocTest
      object.  The setUp function can access the test globals as the
      globs attribute of the test passed.

    tearDown
      A tear-down function.  This is called after running the
      tests in each file.  The tearDown function will be passed a DocTest
      object.  The tearDown function can access the test globals as the
      globs attribute of the test passed.

    globs
      A dictionary containing initial global variables for the tests.

    optionflags
      A set of doctest option flags expressed as an integer.

    parser
      A DocTestParser (or subclass) that should be used to extract
      tests from the files.

    encoding
      An encoding that will be used to convert the files to unicode.
    rSTrR)rmr.rCrqru)�paths�kwrrr�r+r+r,r�	s8
cCs�g}x�t�j|�D]x}t|t�rj|j|jdd
��|j}|r�|jd�|dd�|jd�dd�D�7}q|dd�|jd�dd�D�7}qWx|r�|d
dkr�|j�q�Wx|r�|d	dkr�|jd	�q�Wdj	|�dS)awExtract script from text with examples.

       Converts text with examples to a Python script.  Example input is
       converted to regular code.  Example output and all other words
       are converted to comments:

       >>> text = '''
       ...       Here are examples of simple math.
       ...
       ...           Python has super accurate integer addition
       ...
       ...           >>> 2 + 2
       ...           5
       ...
       ...           And very friendly error messages:
       ...
       ...           >>> 1/0
       ...           To Infinity
       ...           And
       ...           Beyond
       ...
       ...           You can use logic if you want:
       ...
       ...           >>> if 0:
       ...           ...    blah
       ...           ...    blah
       ...           ...
       ...
       ...           Ho hum
       ...           '''

       >>> print(script_from_examples(text))
       # Here are examples of simple math.
       #
       #     Python has super accurate integer addition
       #
       2 + 2
       # Expected:
       ## 5
       #
       #     And very friendly error messages:
       #
       1/0
       # Expected:
       ## To Infinity
       ## And
       ## Beyond
       #
       #     You can use logic if you want:
       #
       if 0:
          blah
          blah
       #
       #     Ho hum
       <BLANKLINE>
       Nr&z# Expected:cSsg|]}d|�qS)z## r+)r�r�r+r+r,r�
sz(script_from_examples.<locals>.<listcomp>rGcSsg|]}t|��qSr+)r{)r�r�r+r+r,r�
srxr"rmrmrmrm)
rr�r8rr�r�rrro�popr�)rZr�Zpiecerrr+r+r,r�	s:

"csJt|�}t�j|�}�fdd�|D�}|s4t�d��|d}t|j�}|S)aExtract the test sources from a doctest docstring as a script.

    Provide the module (or dotted name of the module) containing the
    test to be debugged and the name (within the module) of the object
    with the doc string with tests to be debugged.
    csg|]}|j�kr|�qSr+)r*)r�r')r*r+r,r�*
sztestsource.<locals>.<listcomp>znot found in testsr")rCrrqr�rr�)rBr*r�r��testsrcr+)r*r,r!
s

cCst|�}t|||�dS)z4Debug a single doctest docstring, in argument `src`'N)r�debug_script)�src�pmr0ryr+r+r,r 1
sc
Cs�ddl}|r|j�}ni}|rvyt|||�Wq�ttj�d�|jdd�}|j�|jdtj�d�Yq�Xn|jdd�j	d|||�dS)z7Debug a test script.  `src` is the script, as a string.r"Nr&T)r�r3zexec(%r))
r�r�rr�r=rar�r5Zinteractionr?)r{r|r0r��pr+r+r,rz6
s
rzcCs$t|�}t||�}t|||j�dS)z�Debug a single doctest docstring.

    Provide the module (or dotted name of the module) containing the
    test to be debugged and the name (within the module) of the object
    with the docstring with tests to be debugged.
    N)rCrrzr�)rBr*r|ryr+r+r,r!J
s
c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
_TestClassz�
    A pointless class, for sanity-checking of docstring testing.

    Methods:
        square()
        get()

    >>> _TestClass(13).get() + _TestClass(-12).get()
    1
    >>> hex(_TestClass(13).square().get())
    '0xa9'
    cCs
||_dS)z�val -> _TestClass object with associated value val.

        >>> t = _TestClass(123)
        >>> print(t.get())
        123
        N)r)rfrr+r+r,r�f
sz_TestClass.__init__cCs|jd|_|S)zosquare() -> square TestClass's associated value

        >>> _TestClass(13).square().get()
        169
        r3)r)rfr+r+r,�squarep
sz_TestClass.squarecCs|jS)z~get() -> return TestClass's associated value.

        >>> x = _TestClass(-42)
        >>> print(x.get())
        -42
        )r)rfr+r+r,r.z
sz_TestClass.getN)r5rkrlr�r�rr.r+r+r+r,r~X
s

r~z�
                      Example of a string object, searched as-is.
                      >>> x = 1; y = 2
                      >>> x + y, x * y
                      (3, 2)
                      a�
                                    In 2.2, boolean expressions displayed
                                    0 or 1.  By default, we still accept
                                    them.  This can be disabled by passing
                                    DONT_ACCEPT_TRUE_FOR_1 to the new
                                    optionflags argument.
                                    >>> 4 == 4
                                    1
                                    >>> 4 == 4
                                    True
                                    >>> 4 > 4
                                    0
                                    >>> 4 > 4
                                    False
                                    z�
                Blank lines can be marked with <BLANKLINE>:
                    >>> print('foo\n\nbar\n')
                    foo
                    <BLANKLINE>
                    bar
                    <BLANKLINE>
            z�
                If the ellipsis flag is used, then '...' can be used to
                elide substrings in the desired output:
                    >>> print(list(range(1000))) #doctest: +ELLIPSIS
                    [0, 1, 2, ..., 999]
            a�
                If the whitespace normalization flag is used, then
                differences in whitespace are ignored.
                    >>> print(list(range(30))) #doctest: +NORMALIZE_WHITESPACE
                    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
                     15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
                     27, 28, 29]
            )r~r�zbool-int equivalencezblank linesZellipsiszwhitespace normalizationcCs tjdd�}|jdddddd�|jd	d
dtj�gdd
�|jddddd�|jdddd�|j�}|j}|j}d}x|jD]}|t|O}q|W|j	r�|t
O}x||D]t}|jd�r�tj
j|�\}}tj
jd|�t|dd��}tj
d=t|||d�\}	}
nt|d||d�\}	}
|	r�dSq�WdS)Nzdoctest runner)Zdescriptionz-vz	--verbose�
store_trueFz'print very verbose output for all tests)�action�default�helpz-oz--optionr�zqspecify a doctest option flag to apply to the test run; may be specified more than once to apply multiple options)r��choicesr�r�z-fz--fail-fastzystop running tests after first failure (this is a shorthand for -o FAIL_FAST, and is in addition to any other -o options))r�r�r]r�z file containing the tests to run)�nargsr�r"z.pyrD)r�r)rSr�rr&���)�argparse�ArgumentParser�add_argumentr'�keys�
parse_argsr]r�r�Z	fail_fastrrerMr�ror=�insertr:rr)r�r�Z	testfilesr�r�r�rQ�dirnamer�rr=r+r+r,�_test�
s<



r�r�)r3)rV)	NNNNTr"NFF)FrYNr")NNNN)FN)FN)F)Sr�Z
__docformat__�__all__r-r�rNr6r�rMr�rXr=r^r]�ior#�collectionsr$r%r'rrrrrrrrr	r
rrrr
rKrnr2rCrUr\rcrdrwr{r�r�r�rIrrrrrr�	ExceptionrrrrRrrrrZrr^r\rkZ	TestSuitermrrsrurrrr rzr!r~r�r�r5�exitr+r+r+r,�<module>.s


1%.DKl;;n
fx
$!
@IR


,		+
socketserver.cpython-36.opt-2.pyc000064400000032017150335715140012660 0ustar003


 \�i�@sdZddlZddlZddlZddlZddlZyddlZWnek
rTddlZYnXddl	m
Z
ddlmZddddd	d
ddd
g	Z
eed�r�e
jdddg�eed�r�e
jddddg�eed�r�ejZnejZGdd�d�ZGdd�de�ZGdd�de�Zeed��rGdd�d�ZGdd
�d
�Zeed��rXGdd�dee�ZGdd�dee�ZGdd�dee�ZGd d	�d	ee�Zeed��r�Gd!d�de�ZGd"d�de�ZGd#d�dee�ZGd$d�dee�ZGd%d
�d
�Z Gd&d�de �Z!Gd'd(�d(e
�Z"Gd)d�de �Z#dS)*z0.4�N)�BufferedIOBase)�	monotonic�
BaseServer�	TCPServer�	UDPServer�ThreadingUDPServer�ThreadingTCPServer�BaseRequestHandler�StreamRequestHandler�DatagramRequestHandler�ThreadingMixIn�fork�ForkingUDPServer�ForkingTCPServer�ForkingMixIn�AF_UNIX�UnixStreamServer�UnixDatagramServer�ThreadingUnixStreamServer�ThreadingUnixDatagramServer�PollSelectorc@s�eZdZdZdd�Zdd�Zd%dd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�ZdS)&rNcCs ||_||_tj�|_d|_dS)NF)�server_address�RequestHandlerClass�	threadingZEvent�_BaseServer__is_shut_down�_BaseServer__shutdown_request)�selfrr�r�$/usr/lib64/python3.6/socketserver.py�__init__�s
zBaseServer.__init__cCsdS)Nr)rrrr�server_activate�szBaseServer.server_activate��?cCsx|jj�zVt��F}|j|tj�x0|jsR|j|�}|jr<P|rH|j�|j	�q$WWdQRXWdd|_|jj
�XdS)NF)r�clear�_ServerSelector�register�	selectors�
EVENT_READr�select�_handle_request_noblock�service_actions�set)rZ
poll_interval�selector�readyrrr�
serve_forever�s

zBaseServer.serve_forevercCsd|_|jj�dS)NT)rr�wait)rrrr�shutdown�szBaseServer.shutdowncCsdS)Nr)rrrrr)szBaseServer.service_actionsc
Cs�|jj�}|dkr|j}n|jdk	r0t||j�}|dk	rBt�|}t��R}|j|tj�x<|j	|�}|rp|j
�S|dk	rZ|t�}|dkrZ|j�SqZWWdQRXdS)Nr)�socketZ
gettimeout�timeout�min�timer#r$r%r&r'r(�handle_timeout)rr1Zdeadliner+r,rrr�handle_requests"




zBaseServer.handle_requestcCs�y|j�\}}Wntk
r$dSX|j||�r�y|j||�Wq�tk
rl|j||�|j|�Yq�|j|��Yq�Xn
|j|�dS)N)�get_request�OSError�verify_request�process_request�	Exception�handle_error�shutdown_request)r�request�client_addressrrrr(3s

z"BaseServer._handle_request_noblockcCsdS)Nr)rrrrr4JszBaseServer.handle_timeoutcCsdS)NTr)rr=r>rrrr8QszBaseServer.verify_requestcCs|j||�|j|�dS)N)�finish_requestr<)rr=r>rrrr9YszBaseServer.process_requestcCsdS)Nr)rrrr�server_closebszBaseServer.server_closecCs|j|||�dS)N)r)rr=r>rrrr?jszBaseServer.finish_requestcCs|j|�dS)N)�
close_request)rr=rrrr<nszBaseServer.shutdown_requestcCsdS)Nr)rr=rrrrArszBaseServer.close_requestcCsHtddtjd�td|tjd�ddl}|j�tddtjd�dS)N�-�()�filez4Exception happened during processing of request fromr)�print�sys�stderr�	traceback�	print_exc)rr=r>rHrrrr;vszBaseServer.handle_errorcCs|S)Nr)rrrr�	__enter__�szBaseServer.__enter__cGs|j�dS)N)r@)r�argsrrr�__exit__�szBaseServer.__exit__)r!)�__name__�
__module__�__qualname__r1rr r-r/r)r5r(r4r8r9r@r?r<rAr;rJrLrrrrr�s$-

	
c@sbeZdZejZejZdZdZ	ddd�Z
dd�Zdd	�Zd
d�Z
dd
�Zdd�Zdd�Zdd�ZdS)r�FTc	CsTtj|||�tj|j|j�|_|rPy|j�|j�Wn|j��YnXdS)N)rrr0�address_family�socket_type�server_bindr r@)rrrZbind_and_activaterrrr�s
zTCPServer.__init__cCs8|jr|jjtjtjd�|jj|j�|jj�|_dS)N�)�allow_reuse_addressr0�
setsockoptZ
SOL_SOCKETZSO_REUSEADDRZbindrZgetsockname)rrrrrS�szTCPServer.server_bindcCs|jj|j�dS)N)r0Zlisten�request_queue_size)rrrrr �szTCPServer.server_activatecCs|jj�dS)N)r0�close)rrrrr@�szTCPServer.server_closecCs
|jj�S)N)r0�fileno)rrrrrY�szTCPServer.filenocCs
|jj�S)N)r0Zaccept)rrrrr6�szTCPServer.get_requestcCs4y|jtj�Wntk
r$YnX|j|�dS)N)r/r0ZSHUT_WRr7rA)rr=rrrr<�s
zTCPServer.shutdown_requestcCs|j�dS)N)rX)rr=rrrrAszTCPServer.close_requestN)T)rMrNrOr0ZAF_INETrQZSOCK_STREAMrRrWrUrrSr r@rYr6r<rArrrrr�s/


c@s:eZdZdZejZdZdd�Zdd�Z	dd�Z
d	d
�ZdS)rFi cCs |jj|j�\}}||jf|fS)N)r0Zrecvfrom�max_packet_size)r�dataZclient_addrrrrr6szUDPServer.get_requestcCsdS)Nr)rrrrr szUDPServer.server_activatecCs|j|�dS)N)rA)rr=rrrr<szUDPServer.shutdown_requestcCsdS)Nr)rr=rrrrAszUDPServer.close_requestN)rMrNrOrUr0Z
SOCK_DGRAMrRrZr6r r<rArrrrrscsReZdZdZdZdZdZdd�dd�Zdd	�Zd
d�Z	dd
�Z
�fdd�Z�ZS)ri,NrCF)�blockingcCs�|jdkrdSxht|j�|jkrvy tjdd�\}}|jj|�Wqtk
r^|jj�Yqtk
rrPYqXqWxt|jj	�D]f}y.|r�dntj
}tj||�\}}|jj|�Wq�tk
r�|jj|�Yq�tk
r�Yq�Xq�WdS)NrTr���)�active_children�len�max_children�os�waitpid�discard�ChildProcessErrorr"r7�copy�WNOHANG)rr\�pid�_�flagsrrr�collect_children,s&
zForkingMixIn.collect_childrencCs|j�dS)N)rj)rrrrr4OszForkingMixIn.handle_timeoutcCs|j�dS)N)rj)rrrrr)VszForkingMixIn.service_actionscCs�tj�}|r8|jdkrt�|_|jj|�|j|�dSd}z:y|j||�d}Wn tk
rr|j||�YnXWdz|j	|�Wdtj
|�XXdS)NrTr)rar
r^r*�addrAr?r:r;r<�_exit)rr=r>rgZstatusrrrr9]s 

zForkingMixIn.process_requestcst�j�|j|jd�dS)N)r\)�superr@rj�_block_on_close)r)�	__class__rrr@vs
zForkingMixIn.server_close)
rMrNrOr1r^r`rnrjr4r)r9r@�
__classcell__rr)rorr#s#cs8eZdZdZdZdZdd�Zdd�Z�fdd�Z�Z	S)	rFNcCsHz6y|j||�Wn tk
r2|j||�YnXWd|j|�XdS)N)r?r:r;r<)rr=r>rrr�process_request_thread�s
z%ThreadingMixIn.process_request_threadcCsRtj|j||fd�}|j|_|jrF|jrF|jdkr:g|_|jj|�|j�dS)N)�targetrK)	rZThreadrq�daemon_threadsZdaemonrn�_threads�append�start)rr=r>�trrrr9�s
zThreadingMixIn.process_requestcs:t�j�|jr6|j}d|_|r6x|D]}|j�q&WdS)N)rmr@rnrt�join)rZthreadsZthread)rorrr@�s

zThreadingMixIn.server_close)
rMrNrOrsrnrtrqr9r@rprr)rorr{s
c@seZdZdS)rN)rMrNrOrrrrr�sc@seZdZdS)rN)rMrNrOrrrrr�sc@seZdZdS)rN)rMrNrOrrrrr�sc@seZdZdS)rN)rMrNrOrrrrr�sc@seZdZejZdS)rN)rMrNrOr0rrQrrrrr�sc@seZdZejZdS)rN)rMrNrOr0rrQrrrrr�sc@seZdZdS)rN)rMrNrOrrrrr�sc@seZdZdS)rN)rMrNrOrrrrr�sc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
r	c
Cs6||_||_||_|j�z|j�Wd|j�XdS)N)r=r>�server�setup�handle�finish)rr=r>ryrrrr�szBaseRequestHandler.__init__cCsdS)Nr)rrrrrz�szBaseRequestHandler.setupcCsdS)Nr)rrrrr{�szBaseRequestHandler.handlecCsdS)Nr)rrrrr|�szBaseRequestHandler.finishN)rMrNrOrrzr{r|rrrrr	�s
c@s,eZdZd	ZdZdZdZdd�Zdd�ZdS)
r
rTrNFcCsz|j|_|jdk	r |jj|j�|jr:|jjtjtjd�|jj	d|j
�|_|jdkrdt
|j�|_n|jj	d|j�|_dS)NT�rbr�wb)r=Z
connectionr1Z
settimeout�disable_nagle_algorithmrVr0ZIPPROTO_TCPZTCP_NODELAY�makefile�rbufsize�rfile�wbufsize�
_SocketWriter�wfile)rrrrrz�s



zStreamRequestHandler.setupcCsF|jjs.y|jj�Wntjk
r,YnX|jj�|jj�dS)N)r��closed�flushr0�errorrXr�)rrrrr|s
zStreamRequestHandler.finishr])	rMrNrOr�r�r1rrzr|rrrrr
�s
c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
r�cCs
||_dS)N)�_sock)rZsockrrrrsz_SocketWriter.__init__cCsdS)NTr)rrrr�writablesz_SocketWriter.writablec	Cs&|jj|�t|��}|jSQRXdS)N)r�Zsendall�
memoryview�nbytes)r�bZviewrrr�write"s
z_SocketWriter.writecCs
|jj�S)N)r�rY)rrrrrY'sz_SocketWriter.filenoN)rMrNrOrr�r�rYrrrrr�sr�c@seZdZdd�Zdd�ZdS)rcCs2ddlm}|j\|_|_||j�|_|�|_dS)Nr)�BytesIO)�ior�r=Zpacketr0r�r�)rr�rrrrz.szDatagramRequestHandler.setupcCs|jj|jj�|j�dS)N)r0Zsendtor��getvaluer>)rrrrr|4szDatagramRequestHandler.finishN)rMrNrOrzr|rrrrr*s)$�__version__r0r%ra�errnorFr�ImportErrorZdummy_threadingr�rr3r�__all__�hasattr�extendrr#ZSelectSelectorrrrrrrrrrrrrrr	r
r�rrrrr�<module>{sZ


n~X..-crypt.cpython-36.opt-2.pyc000064400000003054150335715140011301 0ustar003


 \H�@s�ddlZddlZddlmZddlmZej	ej
dZe�ZGdd�dedd��Z
ddd	�Zdd
d�Ze
ddd
d�Ze
dddd�Ze
dddd�Ze
dddd�ZgZx:eeeefD]*Zede�Zer�ee�ejkr�eje�q�W[[dS)�N)�SystemRandom)�
namedtuplez./c@seZdZdd�ZdS)�_MethodcCsdj|j�S)Nz<crypt.METHOD_{}>)�format�name)�self�r�/usr/lib64/python3.6/crypt.py�__repr__sz_Method.__repr__N)�__name__�
__module__�__qualname__r
rrrr	r
srz name ident salt_chars total_sizecCsH|dkrtd}|jr"dj|j�nd}|djdd�t|j�D��7}|S)Nrz${}$�css|]}tjt�VqdS)N)�_srZchoice�
_saltchars)�.0�charrrr	�	<genexpr>szmksalt.<locals>.<genexpr>)�methodsZidentr�join�rangeZ
salt_chars)�method�srrr	�mksalts
rcCs&|dkst|t�rt|�}tj||�S)N)�
isinstancerr�_crypt�crypt)ZwordZsaltrrr	r#s
rZCRYPT��
ZMD5�1��"ZSHA256�5��?ZSHA512�6�jr)N)N)r�stringZ_stringZrandomrZ
_SystemRandom�collectionsrZ_namedtupleZ
ascii_lettersZdigitsrrrrrZMETHOD_CRYPTZ
METHOD_MD5Z
METHOD_SHA256Z
METHOD_SHA512r�_methodZ_result�lenZ
total_size�appendrrrr	�<module>s$	


tempfile.cpython-36.opt-1.pyc000064400000055341150335715140011752 0ustar003

�\dh�m�@sBdZddddddddd	d
ddd
g
ZddlZddlZddlZddlZ	ddl
ZddlZ
ddlmZddlZyddlZWnek
r�ddlZYnXejZe	je	jBe	jBZee	d�r�ee	jOZeZee	d�r�ee	jOZee	d�r�e	j Z ndZ dZ!e�Z"ee	d��re	j#Z$nee	d��re	j%Z$ndd�Z$dd�Z&dd�Z'dd�Z(Gdd �d �Z)d!d"�Z*d#d$�Z+da,d%d&�Z-d'd(�Z.d)d*�Z/d+d,�Z0d-d	�Z1d.d�Z2da3d/d�Z4d0d
�Z5dDd2d�Z6dEd3d�Z7d4e!dfd5d�Z8Gd6d7�d7�Z9Gd8d9�d9�Z:dGd=d�Z;e	j<d>k�se	j=j>d?k�re;Z?nee	d@�a@dIdAd�Z?GdBd�d�ZAGdCd�deB�ZCdS)Ja�Temporary files.

This module provides generic, low- and high-level interfaces for
creating temporary files and directories.  All of the interfaces
provided by this module can be used without fear of race conditions
except for 'mktemp'.  'mktemp' is subject to race conditions and
should not be used; it is provided for backward compatibility only.

The default path names are returned as str.  If you supply bytes as
input, all return values will be in bytes.  Ex:

    >>> tempfile.mkstemp()
    (4, '/tmp/tmptpu9nin8')
    >>> tempfile.mkdtemp(suffix=b'')
    b'/tmp/tmppbi8f0hy'

This module also provides some data items to the user:

  TMP_MAX  - maximum number of names that will be tried before
             giving up.
  tempdir  - If this is set to a string before the first use of
             any routine from this module, it will be considered as
             another candidate location to store temporary files.
�NamedTemporaryFile�
TemporaryFile�SpooledTemporaryFile�TemporaryDirectory�mkstemp�mkdtemp�mktemp�TMP_MAX�
gettempprefix�tempdir�
gettempdir�gettempprefixb�gettempdirb�N)�Random�
O_NOFOLLOW�O_BINARYi'Ztmp�lstat�statcCstj|tj�}tj|�dS)N)�_os�open�O_RDONLY�close)�fn�fd�r� /usr/lib64/python3.6/tempfile.py�_statTsrcCs*yt|�Wntk
r dSXdSdS)NFT)r�OSError)rrrr�_existsXs
rcGs`d}xJ|D]B}|dkrq
t|t�r8|tkr2td��t}q
|tkrHtd��t}q
W|dkr\tS|S)zBLook at the type of all args and divine their implied return type.Nz1Can't mix bytes and non-bytes in path components.)�
isinstance�bytes�str�	TypeError)�argsZreturn_type�argrrr�_infer_return_typeas

r%cCsdt|||�}|dkr|�}|dkr:|tkr0t}n
tjt�}|dkrX|tkrRt�}nt�}||||fS)z9Common parameter processing for most APIs in this module.N)r%r!�templater�fsencoderr
)�prefix�suffix�dir�output_typerrr�_sanitize_paramsvs
r,c@s0eZdZdZdZedd��Zdd�Zdd�Zd	S)
�_RandomNameSequencea,An instance of _RandomNameSequence generates an endless
    sequence of unpredictable strings which can safely be incorporated
    into file names.  Each string is eight characters long.  Multiple
    threads can safely use the same instance at the same time.

    _RandomNameSequence is an iterator.Z%abcdefghijklmnopqrstuvwxyz0123456789_cCs,tj�}|t|dd�kr&t�|_||_|jS)N�_rng_pid)r�getpid�getattr�_RandomZ_rngr.)�selfZcur_pidrrr�rng�s
z_RandomNameSequence.rngcCs|S)Nr)r2rrr�__iter__�sz_RandomNameSequence.__iter__cs0|j�|jj���fdd�td�D�}dj|�S)Ncsg|]}����qSrr)�.0Zdummy)�c�chooserr�
<listcomp>�sz0_RandomNameSequence.__next__.<locals>.<listcomp>��)�
charactersr3Zchoice�range�join)r2Zlettersr)r6r7r�__next__�sz_RandomNameSequence.__next__N)	�__name__�
__module__�__qualname__�__doc__r;�propertyr3r4r>rrrrr-�s
r-cCs�g}x$dD]}tj|�}|r
|j|�q
Wtjdkr\|jtjjd�tjjd�ddd	d
g�n|jddd
g�y|jtj��Wn$t	t
fk
r�|jtj�YnX|S)z[Generate a list of candidate temporary directories which
    _get_default_tempdir will try.�TMPDIR�TEMP�TMP�ntz~\AppData\Local\Tempz%SYSTEMROOT%\Tempzc:\tempzc:\tmpz\tempz\tmpz/tmpz/var/tmpz/usr/tmp)rDrErF)r�getenv�append�name�extend�path�
expanduser�
expandvars�getcwd�AttributeErrorr�curdir)�dirlistZenvname�dirnamerrr�_candidate_tempdir_list�s



rTcCs4t�}t�}�x|D�]}|tjkr0tjj|�}x�td�D]�}t|�}tjj||�}y\tj	|t
d�}z<z*tj	|ddd��}|jd�WdQRXWdtj
|�XWdtj|�X|Stk
r�Yq:tk
�rtjdkr�tjj|�r�tj|tj�r�w:PYq:tk
�rPYq:Xq:WqWttjd	|��dS)
aqCalculate the default directory to use for temporary files.
    This routine should be called exactly once.

    We determine whether or not a candidate temp dir is usable by
    trying to create and write to a file in that directory.  If this
    is successful, the test file is deleted.  To prevent denial of
    service, the name of the test file must be randomized.�di��wbF)�closefdsblatNrGz)No usable temporary directory found in %s)r-rTrrQrL�abspathr<�nextr=r�_bin_openflags�_io�writer�unlink�FileExistsError�PermissionErrorrJ�isdir�access�W_OKr�FileNotFoundError�_errno�ENOENT)ZnamerrRr*�seqrJ�filenamer�fprrr�_get_default_tempdir�s:	
ric
Cs2tdkr.tj�ztdkr t�aWdtj�XtS)z7Common setup sequence for all user-callable interfaces.N)�_name_sequence�
_once_lock�acquirer-�releaserrrr�_get_candidate_names�s

rnc
Cs�t�}|tkrttj|�}x�tt�D]�}t|�}tjj	||||�}ytj
||d�}	WnRtk
rnw$Yn>tk
r�tj
dkr�tjj|�r�tj|tj�r�w$n�YnX|	tjj|�fSWttjd��dS)z>Code common to mkstemp, TemporaryFile, and NamedTemporaryFile.i�rGz#No usable temporary file name foundN)rnr �maprr'r<rrYrLr=rr^r_rJr`rarbrXrd�EEXIST)
r*ZpreZsuf�flagsr+�namesrfrJ�filerrrr�_mkstemp_inner�s$rtcGsJ|tjkr ||f|�ddi�n&tjdks8tjj|�rF||f|��dS)N�follow_symlinksFrG)r�supports_follow_symlinksrJrL�islink)�funcrLr#rrr�_dont_follow_symlinkss
rycCs>y
tj}Wntk
rYnXt||d�ttj|d�dS)Nri�)r�chflagsrPry�chmod)rLrzrrr�_resetpermss
r|cCstS)z-The default prefix for temporary directories.)r&rrrrr	*scCstjt��S)z6The default prefix for temporary directories as bytes.)rr'r	rrrrr.sc
Cs2tdkr.tj�ztdkr t�aWdtj�XtS)zAccessor for tempfile.tempdir.N)r
rkrlrirmrrrrr4s

cCstjt��S)z)A bytes version of tempfile.gettempdir().)rr'rrrrrr
@sFcCs2t|||�\}}}}|rt}nt}t|||||�S)a�User-callable function to create and return a unique temporary
    file.  The return value is a pair (fd, name) where fd is the
    file descriptor returned by os.open, and name is the filename.

    If 'suffix' is not None, the file name will end with that suffix,
    otherwise there will be no suffix.

    If 'prefix' is not None, the file name will begin with that prefix,
    otherwise a default prefix is used.

    If 'dir' is not None, the file will be created in that directory,
    otherwise a default directory is used.

    If 'text' is specified and true, the file is opened in text
    mode.  Else (the default) the file is opened in binary mode.  On
    some operating systems, this makes no difference.

    If any of 'suffix', 'prefix' and 'dir' are not None, they must be the
    same type.  If they are bytes, the returned name will be bytes; str
    otherwise.

    The file is readable and writable only by the creating user ID.
    If the operating system uses permission bits to indicate whether a
    file is executable, the file is executable by no one. The file
    descriptor is not inherited by children of this process.

    Caller is responsible for deleting the file when done with it.
    )r,�_text_openflagsrZrt)r)r(r*�textr+rqrrrrDs
cCs�t|||�\}}}}t�}|tkr.ttj|�}x�tt�D]�}t|�}tj	j
||||�}ytj|d�WnRtk
r�w8Yn>t
k
r�tjdkr�tj	j|�r�tj|tj�r�w8n�YnX|SWttjd��dS)aUser-callable function to create and return a unique temporary
    directory.  The return value is the pathname of the directory.

    Arguments are as for mkstemp, except that the 'text' argument is
    not accepted.

    The directory is readable, writable, and searchable only by the
    creating user.

    Caller is responsible for deleting the directory when done with it.
    i�rGz(No usable temporary directory name foundN)r,rnr rorr'r<rrYrLr=�mkdirr^r_rJr`rarbrdrp)r)r(r*r+rrrfrJrsrrrrls&
r:cCs`|dkrt�}t�}x:tt�D].}t|�}tjj||||�}t|�s|SqWt	t
jd��dS)a�User-callable function to return a unique temporary file name.  The
    file is not created.

    Arguments are similar to mkstemp, except that the 'text' argument is
    not accepted, and suffix=None, prefix=None and bytes file names are not
    supported.

    THIS FUNCTION IS UNSAFE AND SHOULD NOT BE USED.  The file name may
    refer to a file that did not exist at some point, but by the time
    you get around to creating it, someone else may have beaten you to
    the punch.
    Nz"No usable temporary filename found)rrnr<rrYrrLr=rr^rdrp)r)r(r*rrrfrJrsrrrr�sc@sLeZdZdZdZdZd
dd�Zejdkr@ej	fdd	�Z
d
d�Zndd	�Z
dS)�_TemporaryFileCloserz�A separate object allowing proper closing of a temporary file's
    underlying file object, without adding a __del__ method to the
    temporary file.NFTcCs||_||_||_dS)N)rsrJ�delete)r2rsrJr�rrr�__init__�sz_TemporaryFileCloser.__init__rGcCs>|jr:|jdk	r:d|_z|jj�Wd|jr8||j�XdS)NT)�close_calledrsrr�rJ)r2r]rrrr�sz_TemporaryFileCloser.closecCs|j�dS)N)r)r2rrr�__del__�sz_TemporaryFileCloser.__del__cCs|jsd|_|jj�dS)NT)r�rsr)r2rrrr�s)T)r?r@rArBrsr�r�rrJr]rr�rrrrr��s



r�c@sBeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�_TemporaryFileWrapperz�Temporary file wrapper

    This class provides a wrapper around files opened for
    temporary use.  In particular, it seeks to automatically
    remove the file when it is no longer needed.
    TcCs$||_||_||_t|||�|_dS)N)rsrJr�r��_closer)r2rsrJr�rrrr��sz_TemporaryFileWrapper.__init__cs^|jd}t||�}t|d�rD|�tj���fdd��}|j|_|}t|t�sZt|||�|S)Nrs�__call__cs
�||�S)Nr)r#�kwargs)rxrr�func_wrapper�sz7_TemporaryFileWrapper.__getattr__.<locals>.func_wrapper)	�__dict__r0�hasattr�
_functools�wrapsr�r�int�setattr)r2rJrs�ar�r)rxr�__getattr__�s



z!_TemporaryFileWrapper.__getattr__cCs|jj�|S)N)rs�	__enter__)r2rrrr�s
z_TemporaryFileWrapper.__enter__cCs|jj|||�}|j�|S)N)rs�__exit__r)r2�exc�value�tb�resultrrrr�sz_TemporaryFileWrapper.__exit__cCs|jj�dS)zA
        Close the temporary file, possibly deleting it.
        N)r�r)r2rrrrsz_TemporaryFileWrapper.closeccsx|jD]
}|VqWdS)N)rs)r2�linerrrr4sz_TemporaryFileWrapper.__iter__N)T)
r?r@rArBr�r�r�r�rr4rrrrr��s
r��w+b�Tc

Cs�t|||�\}}}}t}	tjdkr0|r0|	tjO}	t||||	|�\}
}y tj|
||||d�}t|||�St	k
r�tj
|�tj|
��YnXdS)a�Create and return a temporary file.
    Arguments:
    'prefix', 'suffix', 'dir' -- as for mkstemp.
    'mode' -- the mode argument to io.open (default "w+b").
    'buffering' -- the buffer size argument to io.open (default -1).
    'encoding' -- the encoding argument to io.open (default None)
    'newline' -- the newline argument to io.open (default None)
    'delete' -- whether the file is deleted on close (default True).
    The file is created as mkstemp() would do it.

    Returns an object with a file-like interface; the name of the file
    is accessible as its 'name' attribute.  The file will be automatically
    deleted when it is closed unless the 'delete' argument is set to False.
    rG)�	buffering�newline�encodingN)r,rZrrJZO_TEMPORARYrtr[rr��
BaseExceptionr]r)
�moder�r�r�r)r(r*r�r+rqrrJrsrrrrs




�posix�cygwin�	O_TMPFILEcCs�t|||�\}}}}t}tr�y$|tjBtj@}	tj||	d�}
Wn*tk
rXdaYnBtk
rjYn0Xyt	j|
||||d�Stj
|
��YnXt|||||�\}
}ytj|�t	j|
||||d�Stj
|
��YnXdS)a>Create and return a temporary file.
        Arguments:
        'prefix', 'suffix', 'dir' -- as for mkstemp.
        'mode' -- the mode argument to io.open (default "w+b").
        'buffering' -- the buffer size argument to io.open (default -1).
        'encoding' -- the encoding argument to io.open (default None)
        'newline' -- the newline argument to io.open (default None)
        The file is created as mkstemp() would do it.

        Returns an object with a file-like interface.  The file has no
        name, and will cease to exist when it is closed.
        i�F)r�r�r�N)
r,rZ�_O_TMPFILE_WORKSrr��O_CREATr�IsADirectoryErrorrr[rrtr])r�r�r�r�r)r(r*r+rqZflags2rrJrrrrNs0






c@s�eZdZdZdZd8dd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zedd��Z
edd��Zdd�Zdd�Zdd�Zedd ��Zed!d"��Zed#d$��Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zed-d.��Zd/d0�Zd9d1d2�Zd3d4�Zd5d6�ZdS):rz�Temporary file wrapper, specialized to switch from BytesIO
    or StringIO to a real file when it exceeds a certain size or
    when a fileno is needed.
    Fr�w+br�Nc		CsHd|krtj�|_ntjdd�|_||_d|_|||||||d�|_dS)N�b�
)r�F)r�r�r)r(r�r�r*)r[�BytesIO�_file�StringIO�	_max_size�_rolled�_TemporaryFileArgs)	r2�max_sizer�r�r�r�r)r(r*rrrr��szSpooledTemporaryFile.__init__cCs,|jr
dS|j}|r(|j�|kr(|j�dS)N)r�r��tell�rollover)r2rsr�rrr�_check�s
zSpooledTemporaryFile._checkcCsN|jr
dS|j}tf|j�}|_|`|j|j��|j|j�d�d|_dS)NrT)r�r�rr�r\�getvalue�seekr�)r2rsZnewfilerrrr��szSpooledTemporaryFile.rollovercCs|jjrtd��|S)Nz%Cannot enter context with closed file)r��closed�
ValueError)r2rrrr��szSpooledTemporaryFile.__enter__cCs|jj�dS)N)r�r)r2r�r�r�rrrr��szSpooledTemporaryFile.__exit__cCs
|jj�S)N)r�r4)r2rrrr4�szSpooledTemporaryFile.__iter__cCs|jj�dS)N)r�r)r2rrrr�szSpooledTemporaryFile.closecCs|jjS)N)r�r�)r2rrrr��szSpooledTemporaryFile.closedcCs8y|jjStk
r2d|jdkr(�|jdSXdS)Nr�r�r�)r�r�rPr�)r2rrrr��szSpooledTemporaryFile.encodingcCs|j�|jj�S)N)r�r��fileno)r2rrrr��szSpooledTemporaryFile.filenocCs|jj�dS)N)r��flush)r2rrrr��szSpooledTemporaryFile.flushcCs
|jj�S)N)r��isatty)r2rrrr��szSpooledTemporaryFile.isattycCs(y|jjStk
r"|jdSXdS)Nr�)r�r�rPr�)r2rrrr��szSpooledTemporaryFile.modecCs"y|jjStk
rdSXdS)N)r�rJrP)r2rrrrJ�szSpooledTemporaryFile.namecCs8y|jjStk
r2d|jdkr(�|jdSXdS)Nr�r�r�)r��newlinesrPr�)r2rrrr��szSpooledTemporaryFile.newlinescGs|jj|�S)N)r��read)r2r#rrrr��szSpooledTemporaryFile.readcGs|jj|�S)N)r��readline)r2r#rrrr��szSpooledTemporaryFile.readlinecGs|jj|�S)N)r��	readlines)r2r#rrrr��szSpooledTemporaryFile.readlinescGs|jj|�dS)N)r�r�)r2r#rrrr��szSpooledTemporaryFile.seekcCs|jjS)N)r��	softspace)r2rrrr�szSpooledTemporaryFile.softspacecCs
|jj�S)N)r�r�)r2rrrr�szSpooledTemporaryFile.tellcCs6|dkr|jj�n||jkr&|j�|jj|�dS)N)r��truncater�r�)r2�sizerrrr�s

zSpooledTemporaryFile.truncatecCs|j}|j|�}|j|�|S)N)r�r\r�)r2�srs�rvrrrr\s

zSpooledTemporaryFile.writecCs|j}|j|�}|j|�|S)N)r��
writelinesr�)r2�iterablersr�rrrr�s

zSpooledTemporaryFile.writelines���)rr�r�NNNNN)N)r?r@rArBr�r�r�r�r�r�r4rrCr�r�r�r�r�r�rJr�r�r�r�r�r�r�r�r\r�rrrrr�s8
		
c@sReZdZdZddd�Zedd��Zedd��Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)ra+Create and return a temporary directory.  This has the same
    behavior as mkdtemp but can be used as a context manager.  For
    example:

        with TemporaryDirectory() as tmpdir:
            ...

    Upon exiting the context, the directory and everything contained
    in it are removed.
    NcCs0t|||�|_tj||j|jdj|�d�|_dS)NzImplicitly cleaning up {!r})�warn_message)rrJ�_weakref�finalize�_cleanup�format�
_finalizer)r2r)r(r*rrrr�(s
zTemporaryDirectory.__init__cs ��fdd�}tj�|d�dS)Ncs�t|dt�r|yV|�kr(ttjj|��t|�ytj|�Wn"ttfk
r`�j|�YnXWq�t	k
rxYq�Xnt|dt	�r�n�dS)Nr)
�
issubclassr_r|rrLrSr]r��_rmtreerc)rxrL�exc_info)�clsrJrr�onerror0sz+TemporaryDirectory._rmtree.<locals>.onerror)r�)�_shutilZrmtree)r�rJr�r)r�rJrr�.szTemporaryDirectory._rmtreecCs|j|�tj|t�dS)N)r��	_warnings�warn�ResourceWarning)r�rJr�rrrr�Es
zTemporaryDirectory._cleanupcCsdj|jj|j�S)Nz	<{} {!r}>)r��	__class__r?rJ)r2rrr�__repr__JszTemporaryDirectory.__repr__cCs|jS)N)rJ)r2rrrr�MszTemporaryDirectory.__enter__cCs|j�dS)N)�cleanup)r2r�r�r�rrrr�PszTemporaryDirectory.__exit__cCs|jj�r|j|j�dS)N)r��detachr�rJ)r2rrrr�Ss
zTemporaryDirectory.cleanup)NNN)r?r@rArBr��classmethodr�r�r�r�r�r�rrrrrs

)NNNF)NNNr�)r�r�NNNNNTr�)r�r�NNNNN)DrB�__all__�	functoolsr��warningsr��ior[�osrZshutilr��errnordZrandomrr1�weakrefr��_thread�ImportErrorZ
_dummy_thread�
allocate_lockZ_allocate_lock�O_RDWRr��O_EXCLr}r�rrZrrr&rkrrrrr%r,r-rTrirjrnrtryr|r	rr
rr
rrrr�r�rrJ�sys�platformrr�r�objectrrrrr�<module>s�




	-
(
' +?
$

8_threading_local.cpython-36.pyc000064400000014433150335715140012461 0ustar003


 \.�@s^dZddlmZddlmZdgZGdd�d�Zedd��ZGd	d�d�Zdd
l	m
Z
mZdS)a%Thread-local objects.

(Note that this module provides a Python version of the threading.local
 class.  Depending on the version of Python you're using, there may be a
 faster one available.  You should always import the `local` class from
 `threading`.)

Thread-local objects support the management of thread-local data.
If you have data that you want to be local to a thread, simply create
a thread-local object and use its attributes:

  >>> mydata = local()
  >>> mydata.number = 42
  >>> mydata.number
  42

You can also access the local-object's dictionary:

  >>> mydata.__dict__
  {'number': 42}
  >>> mydata.__dict__.setdefault('widgets', [])
  []
  >>> mydata.widgets
  []

What's important about thread-local objects is that their data are
local to a thread. If we access the data in a different thread:

  >>> log = []
  >>> def f():
  ...     items = sorted(mydata.__dict__.items())
  ...     log.append(items)
  ...     mydata.number = 11
  ...     log.append(mydata.number)

  >>> import threading
  >>> thread = threading.Thread(target=f)
  >>> thread.start()
  >>> thread.join()
  >>> log
  [[], 11]

we get different data.  Furthermore, changes made in the other thread
don't affect data seen in this thread:

  >>> mydata.number
  42

Of course, values you get from a local object, including a __dict__
attribute, are for whatever thread was current at the time the
attribute was read.  For that reason, you generally don't want to save
these values across threads, as they apply only to the thread they
came from.

You can create custom local objects by subclassing the local class:

  >>> class MyLocal(local):
  ...     number = 2
  ...     def __init__(self, **kw):
  ...         self.__dict__.update(kw)
  ...     def squared(self):
  ...         return self.number ** 2

This can be useful to support default values, methods and
initialization.  Note that if you define an __init__ method, it will be
called each time the local object is used in a separate thread.  This
is necessary to initialize each thread's dictionary.

Now if we create a local object:

  >>> mydata = MyLocal(color='red')

Now we have a default number:

  >>> mydata.number
  2

an initial color:

  >>> mydata.color
  'red'
  >>> del mydata.color

And a method that operates on the data:

  >>> mydata.squared()
  4

As before, we can access the data in a separate thread:

  >>> log = []
  >>> thread = threading.Thread(target=f)
  >>> thread.start()
  >>> thread.join()
  >>> log
  [[('color', 'red')], 11]

without affecting this thread's data:

  >>> mydata.number
  2
  >>> mydata.color
  Traceback (most recent call last):
  ...
  AttributeError: 'MyLocal' object has no attribute 'color'

Note that subclasses can define slots, but they are not thread
local. They are shared across threads:

  >>> class MyLocal(local):
  ...     __slots__ = 'number'

  >>> mydata = MyLocal()
  >>> mydata.number = 42
  >>> mydata.color = 'red'

So, the separate thread:

  >>> thread = threading.Thread(target=f)
  >>> thread.start()
  >>> thread.join()

affects what we see:

  >>> mydata.number
  11

>>> del mydata
�)�ref)�contextmanager�localc@s,eZdZdZdZdd�Zd	d
�Zdd�Zd
S)�
_localimplz#A class managing thread-local dicts�key�dicts�	localargs�	locallock�__weakref__cCsdtt|��|_i|_dS)Nz_threading_local._localimpl.)�str�idrr)�self�r�(/usr/lib64/python3.6/_threading_local.py�__init__�sz_localimpl.__init__cCst�}|jt|�dS)zPReturn the dict for the current thread. Raises KeyError if none
        defined.�)�current_threadrr)r
�threadrrr�get_dict�sz_localimpl.get_dictcshi}|j}t�}t|�}|f�fdd�	}|f�fdd�	}t||��t||���|j|<�|f|j|<|S)z8Create a new dict for the current thread, and return it.cs��}|dk	r|j|=dS)N)�__dict__)�_rr)�wrthreadrr�
local_deleted�sz-_localimpl.create_dict.<locals>.local_deletedcs��}|dk	r|jj|�}dS)N)r�pop)r�idtr�dct)�wrlocalrr�thread_deleted�sz._localimpl.create_dict.<locals>.thread_deleted)rrrrrr)r
Z	localdictrrrrrr)rrr�create_dict�s


z_localimpl.create_dictN)rrrr	r
)�__name__�
__module__�__qualname__�__doc__�	__slots__rrrrrrrr�s
rccsvtj|d�}y|j�}Wn2tk
rJ|j�}|j\}}|j||�YnX|j�tj|d|�dVWdQRXdS)N�_local__implr)	�object�__getattribute__r�KeyErrorrrrr	�__setattr__)r
�implr�args�kwrrr�_patch�s
r,c@s0eZdZdZdd�Zdd�Zdd�Zd	d
�ZdS)
rr$rcOsX|s|r|jtjkrtd��tj|�}t�}||f|_t�|_tj|d|�|j	�|S)Nz*Initialization arguments are not supportedr$)
rr%�	TypeError�__new__rr�RLockr	r(r)�clsr*r+r
r)rrrr.�s

z
local.__new__c
Cs t|��tj||�SQRXdS)N)r,r%r&)r
�namerrrr&�s
zlocal.__getattribute__cCs:|dkrtd|jj��t|��tj|||�SQRXdS)Nrz+%r object attribute '__dict__' is read-only)�AttributeError�	__class__rr,r%r()r
r1�valuerrrr(�s
zlocal.__setattr__c
Cs8|dkrtd|jj��t|��tj||�SQRXdS)Nrz+%r object attribute '__dict__' is read-only)r2r3rr,r%�__delattr__)r
r1rrrr5�s
zlocal.__delattr__N)r$r)rr r!r#r.r&r(r5rrrrr�s
)rr/N)r"�weakrefr�
contextlibr�__all__rr,rZ	threadingrr/rrrr�<module>�s,&weakref.cpython-36.opt-2.pyc000064400000036707150335715140011577 0ustar003


 \�O�
@s�ddlmZmZmZmZmZmZmZmZddl	m
Z
mZddlZddl
Z
ddlZeefZdddddd	d
ddd
dddg
ZGdd�de�ZGdd
�d
ej�ZGdd�de�ZGdd�dej�ZGdd�d�ZdS)�)�getweakrefcount�getweakrefs�ref�proxy�CallableProxyType�	ProxyType�
ReferenceType�_remove_dead_weakref)�WeakSet�_IterationGuardNrrrr�WeakKeyDictionaryrrr�
ProxyTypes�WeakValueDictionaryr
�
WeakMethod�finalizecs@eZdZdZddd�Z�fdd	�Zd
d�Zdd
�Zej	Z	�Z
S)r�	_func_ref�
_meth_type�_alive�__weakref__Ncs~y|j}|j}Wn(tk
r8tdjt|���d�YnX��fdd�}tj|||�}t||�|_t|�|_	d|_
t|��|S)Nz)argument should be a bound method, not {}cs&��}|jr"d|_�dk	r"�|�dS)NF)r)�arg�self)�callback�self_wr��/usr/lib64/python3.6/weakref.py�_cb3s
zWeakMethod.__new__.<locals>._cbT)�__self__�__func__�AttributeError�	TypeError�format�typer�__new__rrr)�cls�methr�obj�funcrrr)rrrr",s

zWeakMethod.__new__cs2t�j�}|j�}|dks"|dkr&dS|j||�S)N)�super�__call__rr)rr%r&)�	__class__rrr(Bs

zWeakMethod.__call__cCs>t|t�r:|js|jr"||kStj||�o8|j|jkSdS)NF)�
isinstancerrr�__eq__r)r�otherrrrr+Is

zWeakMethod.__eq__cCs>t|t�r:|js|jr"||k	Stj||�p8|j|jkSdS)NT)r*rrr�__ne__r)rr,rrrr-Ps

zWeakMethod.__ne__)rrrr)N)�__name__�
__module__�__qualname__�	__slots__r"r(r+r-r�__hash__�
__classcell__rr)r)rr$s
c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZeZdd�Z
d*dd�Zdd�Zdd�ZeZdd�Zdd�Zd d!�Zd"d#�Zd+d$d%�Zd&d'�Zd(d)�ZdS),rcst|std��|^}}t|�dkr0tdt|���t|�tf�fdd�	}||_g|_t�|_i|_�|j	||�dS)NzGdescriptor '__init__' of 'WeakValueDictionary' object needs an argument�z$expected at most 1 arguments, got %dcs4|�}|dk	r0|jr$|jj|j�n|�|j�dS)N)�
_iterating�_pending_removals�append�key)�wr�selfref�_atomic_removalr)�drr�removems
z,WeakValueDictionary.__init__.<locals>.remove)
r�lenrr	�_remover6�setr5�data�update)�args�kwrr=r)r<r�__init__fs	
zWeakValueDictionary.__init__cCs,|j}|j}x|r&|j�}t||�qWdS)N)r6rA�popr	)r�lr<r8rrr�_commit_removals}s
z$WeakValueDictionary._commit_removalscCs4|jr|j�|j|�}|dkr,t|��n|SdS)N)r6rHrA�KeyError)rr8�orrr�__getitem__�s
zWeakValueDictionary.__getitem__cCs|jr|j�|j|=dS)N)r6rHrA)rr8rrr�__delitem__�szWeakValueDictionary.__delitem__cCs|jr|j�t|j�S)N)r6rHr>rA)rrrr�__len__�szWeakValueDictionary.__len__cCs<|jr|j�y|j|�}Wntk
r2dSX|dk	S)NF)r6rHrArI)rr8rJrrr�__contains__�sz WeakValueDictionary.__contains__cCsd|jjt|�fS)Nz<%s at %#x>)r)r.�id)rrrr�__repr__�szWeakValueDictionary.__repr__cCs&|jr|j�t||j|�|j|<dS)N)r6rH�KeyedRefr?rA)rr8�valuerrr�__setitem__�szWeakValueDictionary.__setitem__cCsF|jr|j�t�}x,|jj�D]\}}|�}|dk	r |||<q W|S)N)r6rHrrA�items)r�newr8r9rJrrr�copy�szWeakValueDictionary.copycCsZddlm}|jr|j�|j�}x2|jj�D]$\}}|�}|dk	r.|||||�<q.W|S)Nr)�deepcopy)rVrWr6rHr)rArT)r�memorWrUr8r9rJrrr�__deepcopy__�sz WeakValueDictionary.__deepcopy__NcCsL|jr|j�y|j|}Wntk
r0|SX|�}|dkrD|S|SdS)N)r6rHrArI)rr8�defaultr9rJrrr�get�szWeakValueDictionary.getc
csV|jr|j�t|��6x.|jj�D] \}}|�}|dk	r$||fVq$WWdQRXdS)N)r6rHrrArT)r�kr9�vrrrrT�s
zWeakValueDictionary.itemsc
csN|jr|j�t|��.x&|jj�D]\}}|�dk	r$|Vq$WWdQRXdS)N)r6rHrrArT)rr\r9rrr�keys�s

zWeakValueDictionary.keysc	cs6|jr|j�t|��|jj�EdHWdQRXdS)N)r6rHrrA�values)rrrr�
itervaluerefs�s

z!WeakValueDictionary.itervaluerefsc
csN|jr|j�t|��.x&|jj�D]}|�}|dk	r$|Vq$WWdQRXdS)N)r6rHrrAr_)rr9r%rrrr_�s
zWeakValueDictionary.valuescCs<|jr|j�x(|jj�\}}|�}|dk	r||fSqWdS)N)r6rHrA�popitem)rr8r9rJrrrra�szWeakValueDictionary.popitemcGs`|jr|j�y|jj|��}Wntk
r8d}YnX|dkrX|rN|dSt|��n|SdS)Nr)r6rHrArFrI)rr8rCrJrrrrFs

zWeakValueDictionary.popcCs`y|j|�}Wntk
r(d}YnX|dkrX|jr@|j�t||j|�|j|<|S|SdS)N)rArIr6rHrQr?)rr8rZrJrrr�
setdefaults
zWeakValueDictionary.setdefaultcOs�|std��|^}}t|�dkr0tdt|���|r<|dnd}|jrN|j�|j}|dk	r�t|d�srti�|�}x&|j�D]\}}t||j	|�||<q|Wt|�r�|j
|�dS)NzEdescriptor 'update' of 'WeakValueDictionary' object needs an argumentr4z$expected at most 1 arguments, got %drrT)rr>r6rHrA�hasattrr!rTrQr?rB)rC�kwargsr�dictr<r8rJrrrrB s 
zWeakValueDictionary.updatecCs|jr|j�t|jj��S)N)r6rH�listrAr_)rrrr�	valuerefs3s
zWeakValueDictionary.valuerefs)N)N)r.r/r0rErHrKrLrMrNrPrSrV�__copy__rYr[rTr^�__iter__r`r_rarFrbrBrgrrrrrZs,			

			

cs(eZdZdZdd�Z�fdd�Z�ZS)rQr8cCstj|||�}||_|S)N)rr"r8)r!�obrr8rrrrr"NszKeyedRef.__new__cst�j||�dS)N)r'rE)rrjrr8)r)rrrESszKeyedRef.__init__)r8)r.r/r0r1r"rEr3rr)r)rrQBs
rQc@s�eZdZd*dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZeZdd�Z
d+dd�Zdd�Zdd�Zdd�ZeZdd�Zd d!�Zd"d#�Zd$d%�Zd,d&d'�Zd-d(d)�ZdS).rNcCsFi|_t|�fdd�}||_g|_t�|_d|_|dk	rB|j|�dS)NcSs.|�}|dk	r*|jr"|jj|�n|j|=dS)N)r5r6r7rA)r\r:rrrrr=ds
z*WeakKeyDictionary.__init__.<locals>.removeF)rArr?r6r@r5�
_dirty_lenrB)rrer=rrrrEbszWeakKeyDictionary.__init__cCs>|j}|j}x,|r8y||j�=Wqtk
r4YqXqWdS)N)r6rArFrI)rrGr<rrrrHssz"WeakKeyDictionary._commit_removalscs&|j��fdd�|jD�|_d|_dS)Ncsg|]}|�kr|�qSrr)�.0r\)r<rr�
<listcomp>�sz5WeakKeyDictionary._scrub_removals.<locals>.<listcomp>F)rAr6rk)rr)r<r�_scrub_removals�sz!WeakKeyDictionary._scrub_removalscCsd|_|jt|�=dS)NT)rkrAr)rr8rrrrL�szWeakKeyDictionary.__delitem__cCs|jt|�S)N)rAr)rr8rrrrK�szWeakKeyDictionary.__getitem__cCs(|jr|jr|j�t|j�t|j�S)N)rkr6rnr>rA)rrrrrM�szWeakKeyDictionary.__len__cCsd|jjt|�fS)Nz<%s at %#x>)r)r.rO)rrrrrP�szWeakKeyDictionary.__repr__cCs||jt||j�<dS)N)rArr?)rr8rRrrrrS�szWeakKeyDictionary.__setitem__cCs8t�}x,|jj�D]\}}|�}|dk	r|||<qW|S)N)rrArT)rrUr8rRrJrrrrV�szWeakKeyDictionary.copycCsLddlm}|j�}x2|jj�D]$\}}|�}|dk	r |||�||<q W|S)Nr)rW)rVrWr)rArT)rrXrWrUr8rRrJrrrrY�szWeakKeyDictionary.__deepcopy__cCs|jjt|�|�S)N)rAr[r)rr8rZrrrr[�szWeakKeyDictionary.getcCs,yt|�}Wntk
r dSX||jkS)NF)rrrA)rr8r9rrrrN�s
zWeakKeyDictionary.__contains__c
csHt|��6x.|jj�D] \}}|�}|dk	r||fVqWWdQRXdS)N)rrArT)rr9rRr8rrrrT�s

zWeakKeyDictionary.itemsc
cs<t|��*x"|jD]}|�}|dk	r|VqWWdQRXdS)N)rrA)rr9r%rrrr^�s

zWeakKeyDictionary.keysc
cs@t|��.x&|jj�D]\}}|�dk	r|VqWWdQRXdS)N)rrArT)rr9rRrrrr_�s

zWeakKeyDictionary.valuescCs
t|j�S)N)rfrA)rrrr�keyrefs�s
zWeakKeyDictionary.keyrefscCs4d|_x(|jj�\}}|�}|dk	r||fSqWdS)NT)rkrAra)rr8rRrJrrrra�szWeakKeyDictionary.popitemcGsd|_|jjt|�f|��S)NT)rkrArFr)rr8rCrrrrF�szWeakKeyDictionary.popcCs|jjt||j�|�S)N)rArbrr?)rr8rZrrrrb�szWeakKeyDictionary.setdefaultcKs`|j}|dk	rJt|d�s$ti�|�}x$|j�D]\}}||t||j�<q.Wt|�r\|j|�dS)NrT)rArcr!rTrr?r>rB)rrerdr<r8rRrrrrB�s
zWeakKeyDictionary.update)N)N)N)N)r.r/r0rErHrnrLrKrMrPrSrVrhrYr[rNrTr^rir_rorarFrbrBrrrrrWs,

	

c@s�eZdZfZiZdZej�ZdZ	dZ
Gdd�d�Zdd�Zddd�Z
d	d
�Zdd�Zed
d��Zedd��Zejdd��Zdd�Zedd��Zedd��ZdS)rFc@seZdZdZdS)	zfinalize._Info�weakrefr&rCrd�atexit�indexN)rpr&rCrdrqrr)r.r/r0r1rrrr�_InfosrscOsp|js ddl}|j|j�dt_|j�}t||�|_||_||_	|pFd|_
d|_t|j�|_
||j|<dt_dS)NrT)�_registered_with_atexitrq�register�	_exitfuncrrsrrpr&rCrd�next�_index_iterrr�	_registry�_dirty)rr%r&rCrdrq�inforrrrEs

zfinalize.__init__NcCs2|jj|d�}|r.|jr.|j|j|jp*i�SdS)N)ryrF�	_shutdownr&rCrd)r�_r{rrrr(szfinalize.__call__cCsH|jj|�}|o|j�}|dk	rD|jj|d�rD||j|j|jp@ifSdS)N)ryr[rprFr&rCrd)rr{r%rrr�detach&szfinalize.detachcCs:|jj|�}|o|j�}|dk	r6||j|j|jp2ifSdS)N)ryr[rpr&rCrd)rr{r%rrr�peek.sz
finalize.peekcCs
||jkS)N)ry)rrrr�alive6szfinalize.alivecCs|jj|�}t|�o|jS)N)ryr[�boolrq)rr{rrrrq;szfinalize.atexitcCs|jj|�}|rt|�|_dS)N)ryr[r�rq)rrRr{rrrrqAscCs^|jj|�}|o|j�}|dkr6dt|�jt|�fSdt|�jt|�t|�jt|�fSdS)Nz<%s object at %#x; dead>z!<%s object at %#x; for %r at %#x>)ryr[rpr!r.rO)rr{r%rrrrPGszfinalize.__repr__cCs2dd�|jj�D�}|jdd�d�dd�|D�S)NcSsg|]\}}|jr||f�qSr)rq)rl�f�irrrrmSsz-finalize._select_for_exit.<locals>.<listcomp>cSs
|djS)Nr4)rr)�itemrrr�<lambda>Tsz+finalize._select_for_exit.<locals>.<lambda>)r8cSsg|]\}}|�qSrr)rlr�r�rrrrmUs)ryrT�sort)r#�Lrrr�_select_for_exitPszfinalize._select_for_exitcCs�d}z�|jr�ddl}|j�r(d}|j�d}x\|dks<tjrJ|j�}dt_|sPP|j�}y
|�Wq.tk
r�t	j
t	j��Yq.Xq.WWddt_|r�|j
�XdS)NFrT)ry�gc�	isenabled�disablerrzr�rF�	Exception�sys�
excepthook�exc_infor|�enable)r#�reenable_gcr��pendingr�rrrrvWs.
zfinalize._exitfunc)N)r.r/r0r1ryr|�	itertools�countrxrzrtrsrEr(r~r�propertyr�rq�setterrP�classmethodr�rvrrrrr�s"
	)�_weakrefrrrrrrrr	�_weakrefsetr
r�collectionsr�r�r
�__all__r�MutableMappingrrQrrrrrr�<module>s (

6igettext.cpython-36.pyc000064400000033567150335715140010700 0ustar003


 \T�@s�dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	dddddd	d
ddd
dddddddgZ
ejjej
dd�ZejdejejB�Zdd�Zdd�ZdPZd)d*�eed+�D�Zd,d-d.d/�ZdRd0d1�Zd2d3�Zd4d5�Zd6d7�ZGd8d�d�ZGd9d�de�ZdSd;d�ZiZdTd<d�Z dUd=d	�Z!ia"ia#d>a$dVd?d
�Z%dWd@d�Z&dXdAd�Z'dBd
�Z(dCd�Z)dDd�Z*dEd�Z+dFd�Z,dGd�Z-dHd�Z.dId�Z/e Z0dS)Ya�Internationalization and localization support.

This module provides internationalization (I18N) and localization (L10N)
support for your Python programs by providing an interface to the GNU gettext
message catalog library.

I18N refers to the operation by which a program is made aware of multiple
languages.  L10N refers to the adaptation of your program, once
internationalized, to the local language and cultural habits.

�N)�ENOENT�NullTranslations�GNUTranslations�Catalog�find�translation�install�
textdomain�bindtextdomain�bind_textdomain_codeset�dgettext�	dngettext�gettext�lgettext�	ldgettext�
ldngettext�	lngettext�ngettextZshare�localea�
        (?P<WHITESPACES>[ \t]+)                    | # spaces and horizontal tabs
        (?P<NUMBER>[0-9]+\b)                       | # decimal integer
        (?P<NAME>n\b)                              | # only n is allowed
        (?P<PARENTHESIS>[()])                      |
        (?P<OPERATOR>[-*/%+?:]|[><!]=?|==|&&|\|\|) | # !, *, /, %, +, -, <, >,
                                                     # <=, >=, ==, !=, &&, ||,
                                                     # ? :
                                                     # unary and bitwise ops
                                                     # not allowed
        (?P<INVALID>\w+|.)                           # invalid token
    ccsTxHtjt|�D]8}|j}|dkr"q|j|�}|dkr@td|��|VqWdVdS)NZWHITESPACESZINVALIDz invalid token in plural form: %s�)�re�finditer�_token_pattern�	lastgroup�group�
ValueError)�pluralZmoZkind�value�r�/usr/lib64/python3.6/gettext.py�	_tokenizeTs

r cCs|rtd|�Std�SdS)Nz#unexpected token in plural form: %szunexpected end of plural form)r)rrrr�_error_sr!�||�&&�==�!=�<�>�<=�>=�+�-�*�/�%cCs i|]\}}|D]
}||�qqSrr)�.0�iZops�oprrr�
<dictcomp>msr2��or�andz//)z||z&&r-cCs�d}t|�}x|dkr(|d7}t|�}qW|dkr\t|�\}}d||f}|dkr�td��nP|dkrrd	||f}n:yt|d
�}Wntk
r�t|�d�YnXd||f}t|�}d}xh|tk�r t|}||kr�P|dkr�|dkr�d|}tj||�}t||d�\}	}d|||	f}|}q�W||k�o6dkn�rFd|}|dk�r�|dk�r�t|d�\}
}|dk�rzt|��t|�\}}d|
||f}|dk�r�d|}||fS)Nr�!znot �(z%s(%s)�)z%unbalanced parenthesis in plural form�nz%s%s�
z%s%d�d��z(%s)r3z%s %s %s�?r�:z%s if %s else %s)r<r=)r<r=)�next�_parser�intr!�_binary_ops�	_c2py_ops�get)�tokensZpriority�result�nexttok�subr�jr0r1�rightZif_trueZif_falserrrrApsP



rAcCs:yt|�}Wn(tk
r4td|jjf�d�YnX|S)Nz'Plural value must be an integer, got %s)�round�	TypeError�	__class__�__name__)r9r0rrr�_as_int�srPcCs�t|�dkrtd��y~tt|��\}}|r2t|��d}x>|D]6}|dkrb|d7}|dkrrtd��q<|dkr<|d8}q<Wd	ti}td
||�|dStk
r�td��YnXdS)
z�Gets a C expression as used in PO files for plural forms and returns a
    Python function that implements an equivalent expression.
    i�z"plural form expression is too longrr7r3�z%plural form expression is too complexr8rPz�if True:
            def func(n):
                if not isinstance(n, int):
                    n = _as_int(n)
                return int(%s)
            �funcN)�lenrrAr r!rP�exec�RecursionError)rrGrHZdepth�c�nsrrr�c2py�s(

rXc
Cs:tj|�}d}d	}d
}d}|jd�}|dkrN||d�}|d|�}||O}nd}|jd�}|dkr�||d�}|d|�}||O}nd}|jd�}|dkr�||d�}|d|�}||O}nd}|}	g}
xbt|d�D]R}||@s�|	}||@�r�||7}||@�r||7}||@�r ||7}|
j|�q�W|
j�|
S)Nr3r��@r�.�_r3rYr=)rZ	normalizer�range�append�reverse)
�locZCOMPONENT_CODESETZCOMPONENT_TERRITORYZCOMPONENT_MODIFIER�mask�posZmodifier�codesetZ	territoryZlanguageZretr0�valrrr�_expand_lang�sJ










rec@speZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
ddd�ZdS)rNcCs.i|_d|_d|_d|_|dk	r*|j|�dS)N)�_info�_charset�_output_charset�	_fallbackrA)�self�fprrr�__init__�szNullTranslations.__init__cCsdS)Nr)rjrkrrrrAszNullTranslations._parsecCs|jr|jj|�n||_dS)N)ri�add_fallback)rj�fallbackrrrrmszNullTranslations.add_fallbackcCs|jr|jj|�S|S)N)rir)rj�messagerrrr	szNullTranslations.gettextcCs2|jr|jj|�S|jr$|j|j�S|jtj��S)N)rirrh�encoder�getpreferredencoding)rjrorrrrs
zNullTranslations.lgettextcCs*|jr|jj|||�S|dkr"|S|SdS)Nr3)rir)rj�msgid1�msgid2r9rrrrs
zNullTranslations.ngettextcCsH|jr|jj|||�S|dkr$|}n|}|jr:|j|j�S|jtj��S)Nr3)rirrhrprrq)rjrrrsr9�tmsgrrrrszNullTranslations.lngettextcCs|jS)N)rf)rjrrr�info(szNullTranslations.infocCs|jS)N)rg)rjrrr�charset+szNullTranslations.charsetcCs|jS)N)rh)rjrrr�output_charset.szNullTranslations.output_charsetcCs
||_dS)N)rh)rjrvrrr�set_output_charset1sz#NullTranslations.set_output_charsetcCsvddl}|j|jd<t|d�rrd|kr6|jd|jd<d|krJ|j|jd<d|kr^|j|jd<d|krr|j|jd<dS)Nrr\�__contains__rrrr)�builtinsr�__dict__�hasattrrrr)rj�namesrzrrrr4s
zNullTranslations.install)N)N)rO�
__module__�__qualname__rlrArmrrrrrurvrwrxrrrrrr�s
c@sHeZdZdZdZdZdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)rl�*l�$<rr3cCs|d?|d@fS)z/Returns a tuple of major version, minor version�i��r)rj�versionrrr�
_get_versionsJszGNUTranslations._get_versionsc"Cs�tj}t|dd�}i|_}dd�|_|j�}t|�}|d|dd��d}||jkrv|d	|dd
��\}}	}
}d}n6||jkr�|d|dd
��\}}	}
}d
}nt	dd|��|j
|�\}
}|
|jkr�t	ddt|
�|���xt
d|	�D�]�}||||
|
d��\}}||}|||||d��\}}||}||k�r^||k�r^|||�}|||�}nt	dd|��|dk�rRd}x�|jd�D]�}|j�j�}|�s��q�d}}d|k�r�|jdd�\}}|j�j�}|j�}||j|<|}n|�r|j|d|7<|dk�r|jd�d|_n0|dk�r�|jd�}|djd�d}t|�|_�q�W|j�p\d}d|k�r�|jd�\}} |jd�}t||�}x>t|�D]\}}!t|!|�|||f<�q�Wnt||�|t||�<|
d7}
|d7}q�WdS)z8Override this method to support alternative .mo formats.�namercSst|dk�S)Nr3)rB)r9rrr�<lambda>Usz(GNUTranslations._parse.<locals>.<lambda>z<INr=rz<4IrQz<IIz>4Iz>IIzBad magic numberzBad version number �zFile is corrupt�
r?r3�
zcontent-typezcharset=zplural-forms�;zplural=�ascii�)�struct�unpack�getattr�_catalogr�readrS�LE_MAGIC�BE_MAGIC�OSErrorr��VERSIONS�strr]�split�decode�strip�lowerrfrgrX�	enumerate)"rjrkr��filenameZcatalogZbufZbuflen�magicr�ZmsgcountZ	masteridxZtransidxZiiZ
major_versionZ
minor_versionr0ZmlenZmoffZmendZtlenZtoffZtend�msgrtZlastkZb_item�item�k�vrrvrrrs�xrrrrANsr














zGNUTranslations._parsecCsRt�}|jj||�}||kr2|jr.|jj|�S|}|jrD|j|j�S|jtj��S)N)	�objectr�rErirrhrprrq)rjro�missingrtrrrr�szGNUTranslations.lgettextcCsvy|j||j|�f}Wn<tk
rT|jr>|jj|||�S|dkrL|}n|}YnX|jrh|j|j�S|jtj��S)Nr3)	r�r�KeyErrorrirrhrprrq)rjrrrsr9rtrrrr�s
zGNUTranslations.lngettextcCs6t�}|jj||�}||kr2|jr.|jj|�S|S|S)N)r�r�rErir)rjror�rtrrrr�szGNUTranslations.gettextcCsZy|j||j|�f}Wn<tk
rT|jr>|jj|||�S|dkrL|}n|}YnX|S)Nr3)r�rr�rir)rjrrrsr9rtrrrr�s
zGNUTranslations.ngettextN)rr3)rOr~rr�r�r�r�rArrrrrrrrrBsT	FcCs�|dkrt}|dkrTg}x(dD] }tjj|�}|r|jd�}PqWd|krT|jd�g}x0|D](}x"t|�D]}||krl|j|�qlWq^W|r�g}	nd}	xL|D]D}|dkr�Ptjj||dd|�}
tjj	|
�r�|r�|	j|
�q�|
Sq�W|	S)	N�LANGUAGE�LC_ALL�LC_MESSAGES�LANGr?�Cz%s.mo)r�r�r�r�)
�_default_localedir�os�environrEr�r^re�path�join�exists)�domain�	localedir�	languages�allZenvarrdZnelangsZlangZnelangrG�mofilerrrr�s8




cCs�|dkrt}t|||dd�}|s6|r*t�Sttd|��d}x�|D]|}|tjj|�f}	tj	|	�}
|
dkr�t
|d��}tj|	||��}
WdQRXtj|
�}
|r�|
j
|�|dkr�|
}q@|j|
�q@W|S)NT)r�z$No translation file found for domain�rb)rrrr�rr�r��abspath�
_translationsrE�open�
setdefault�copyrxrm)r�r�r�Zclass_rnrcZmofilesrGr��key�trkrrrr�s*



cCst||d|d�}|j|�dS)NT)rnrc)rr)r�r�rcr}r�rrrrsZmessagescCs|dk	r|atS)N)�_current_domain)r�rrrr	'scCs|dk	r|t|<tj|t�S)N)�_localedirsrEr�)r�r�rrrr
.scCs|dk	r|t|<tj|�S)N)�_localecodesetsrE)r�rcrrrr5scCs@y t|tj|d�tj|�d�}Wntk
r4|SX|j|�S)N)rc)rr�rEr�r�r)r�ror�rrrr<scCsRtj|�}yt|tj|d�|d�}Wn"tk
rF|j|pBtj��SX|j|�S)N)rc)	r�rErr�r�rprrqr)r�rorcr�rrrrDs
cCsTy t|tj|d�tj|�d�}Wn$tk
rD|dkr<|S|SYnX|j|||�S)N)rcr3)rr�rEr�r�r)r�rrrsr9r�rrrr
Ls
cCshtj|�}yt|tj|d�|d�}Wn4tk
rX|dkrB|}n|}|j|pTtj��SX|j|||�S)N)rcr3)	r�rErr�r�rprrqr)r�rrrsr9rcr�rtrrrrWs
cCs
tt|�S)N)rr�)rorrrrcscCs
tt|�S)N)rr�)rorrrrfscCstt|||�S)N)r
r�)rrrsr9rrrriscCstt|||�S)N)rr�)rrrsr9rrrrls�r"�r#�r$r%�r&r'r(r)�r*r+�r,r-r.)r�r�r�r�r�r����)r�)NNF)NNNFN)NNN)N)N)N)1�__doc__rr��ior�rr��sys�errnor�__all__r�r��base_prefixr��compile�VERBOSE�DOTALLrr r!rCr�rDrArPrXrerrrr�rrr�r�r�r	r
rrrr
rrrrrrrrrr�<module>s^&8



1$*K
&




socketserver.cpython-36.opt-1.pyc000064400000057274150335715140012673 0ustar003


 \�i�@sdZdZddlZddlZddlZddlZddlZyddlZWnek
rXddl	ZYnXddl
mZddlm
Zdddd	d
ddd
dg	Zeed�r�ejdddg�eed�r�ejddddg�eed�r�ejZnejZGdd�d�ZGdd�de�ZGdd�de�Zeed��rGdd�d�ZGdd�d�Zeed��r\Gdd�dee�ZGdd�dee�ZGd d	�d	ee�ZGd!d
�d
ee�Zeed��r�Gd"d�de�ZGd#d�de�ZGd$d�dee�ZGd%d�dee�Z Gd&d�d�Z!Gd'd�de!�Z"Gd(d)�d)e�Z#Gd*d
�d
e!�Z$dS)+apGeneric socket server classes.

This module tries to capture the various aspects of defining a server:

For socket-based servers:

- address family:
        - AF_INET{,6}: IP (Internet Protocol) sockets (default)
        - AF_UNIX: Unix domain sockets
        - others, e.g. AF_DECNET are conceivable (see <socket.h>
- socket type:
        - SOCK_STREAM (reliable stream, e.g. TCP)
        - SOCK_DGRAM (datagrams, e.g. UDP)

For request-based servers (including socket-based):

- client address verification before further looking at the request
        (This is actually a hook for any processing that needs to look
         at the request before anything else, e.g. logging)
- how to handle multiple requests:
        - synchronous (one request is handled at a time)
        - forking (each request is handled by a new process)
        - threading (each request is handled by a new thread)

The classes in this module favor the server type that is simplest to
write: a synchronous TCP/IP server.  This is bad class design, but
save some typing.  (There's also the issue that a deep class hierarchy
slows down method lookups.)

There are five classes in an inheritance diagram, four of which represent
synchronous servers of four types:

        +------------+
        | BaseServer |
        +------------+
              |
              v
        +-----------+        +------------------+
        | TCPServer |------->| UnixStreamServer |
        +-----------+        +------------------+
              |
              v
        +-----------+        +--------------------+
        | UDPServer |------->| UnixDatagramServer |
        +-----------+        +--------------------+

Note that UnixDatagramServer derives from UDPServer, not from
UnixStreamServer -- the only difference between an IP and a Unix
stream server is the address family, which is simply repeated in both
unix server classes.

Forking and threading versions of each type of server can be created
using the ForkingMixIn and ThreadingMixIn mix-in classes.  For
instance, a threading UDP server class is created as follows:

        class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass

The Mix-in class must come first, since it overrides a method defined
in UDPServer! Setting the various member variables also changes
the behavior of the underlying server mechanism.

To implement a service, you must derive a class from
BaseRequestHandler and redefine its handle() method.  You can then run
various versions of the service by combining one of the server classes
with your request handler class.

The request handler class must be different for datagram or stream
services.  This can be hidden by using the request handler
subclasses StreamRequestHandler or DatagramRequestHandler.

Of course, you still have to use your head!

For instance, it makes no sense to use a forking server if the service
contains state in memory that can be modified by requests (since the
modifications in the child process would never reach the initial state
kept in the parent process and passed to each child).  In this case,
you can use a threading server, but you will probably have to use
locks to avoid two requests that come in nearly simultaneous to apply
conflicting changes to the server state.

On the other hand, if you are building e.g. an HTTP server, where all
data is stored externally (e.g. in the file system), a synchronous
class will essentially render the service "deaf" while one request is
being handled -- which may be for a very long time if a client is slow
to read all the data it has requested.  Here a threading or forking
server is appropriate.

In some cases, it may be appropriate to process part of a request
synchronously, but to finish processing in a forked child depending on
the request data.  This can be implemented by using a synchronous
server and doing an explicit fork in the request handler class
handle() method.

Another approach to handling multiple simultaneous requests in an
environment that supports neither threads nor fork (or where these are
too expensive or inappropriate for the service) is to maintain an
explicit table of partially finished requests and to use a selector to
decide which request to work on next (or whether to handle a new
incoming request).  This is particularly important for stream services
where each client can potentially be connected for a long time (if
threads or subprocesses cannot be used).

Future work:
- Standard classes for Sun RPC (which uses either UDP or TCP)
- Standard mix-in classes to implement various authentication
  and encryption schemes

XXX Open problems:
- What to do with out-of-band data?

BaseServer:
- split generic "request" functionality out into BaseServer class.
  Copyright (C) 2000  Luke Kenneth Casson Leighton <lkcl@samba.org>

  example: read entries from a SQL database (requires overriding
  get_request() to return a table entry from the database).
  entry is processed by a RequestHandlerClass.

z0.4�N)�BufferedIOBase)�	monotonic�
BaseServer�	TCPServer�	UDPServer�ThreadingUDPServer�ThreadingTCPServer�BaseRequestHandler�StreamRequestHandler�DatagramRequestHandler�ThreadingMixIn�fork�ForkingUDPServer�ForkingTCPServer�ForkingMixIn�AF_UNIX�UnixStreamServer�UnixDatagramServer�ThreadingUnixStreamServer�ThreadingUnixDatagramServer�PollSelectorc@s�eZdZdZdZdd�Zdd�Zd&dd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdS)'ra�Base class for server classes.

    Methods for the caller:

    - __init__(server_address, RequestHandlerClass)
    - serve_forever(poll_interval=0.5)
    - shutdown()
    - handle_request()  # if you do not use serve_forever()
    - fileno() -> int   # for selector

    Methods that may be overridden:

    - server_bind()
    - server_activate()
    - get_request() -> request, client_address
    - handle_timeout()
    - verify_request(request, client_address)
    - server_close()
    - process_request(request, client_address)
    - shutdown_request(request)
    - close_request(request)
    - service_actions()
    - handle_error()

    Methods for derived classes:

    - finish_request(request, client_address)

    Class variables that may be overridden by derived classes or
    instances:

    - timeout
    - address_family
    - socket_type
    - allow_reuse_address

    Instance variables:

    - RequestHandlerClass
    - socket

    NcCs ||_||_tj�|_d|_dS)z/Constructor.  May be extended, do not override.FN)�server_address�RequestHandlerClass�	threadingZEvent�_BaseServer__is_shut_down�_BaseServer__shutdown_request)�selfrr�r�$/usr/lib64/python3.6/socketserver.py�__init__�s
zBaseServer.__init__cCsdS)zSCalled by constructor to activate the server.

        May be overridden.

        Nr)rrrr�server_activate�szBaseServer.server_activate��?cCsx|jj�zVt��F}|j|tj�x0|jsR|j|�}|jr<P|rH|j�|j	�q$WWdQRXWdd|_|jj
�XdS)z�Handle one request at a time until shutdown.

        Polls for shutdown every poll_interval seconds. Ignores
        self.timeout. If you need to do periodic tasks, do them in
        another thread.
        NF)r�clear�_ServerSelector�register�	selectors�
EVENT_READr�select�_handle_request_noblock�service_actions�set)rZ
poll_interval�selector�readyrrr�
serve_forever�s

zBaseServer.serve_forevercCsd|_|jj�dS)z�Stops the serve_forever loop.

        Blocks until the loop has finished. This must be called while
        serve_forever() is running in another thread, or it will
        deadlock.
        TN)rr�wait)rrrr�shutdown�szBaseServer.shutdowncCsdS)z�Called by the serve_forever() loop.

        May be overridden by a subclass / Mixin to implement any code that
        needs to be run during the loop.
        Nr)rrrrr)szBaseServer.service_actionsc
Cs�|jj�}|dkr|j}n|jdk	r0t||j�}|dk	rBt�|}t��R}|j|tj�x<|j	|�}|rp|j
�S|dk	rZ|t�}|dkrZ|j�SqZWWdQRXdS)zOHandle one request, possibly blocking.

        Respects self.timeout.
        Nr)�socketZ
gettimeout�timeout�min�timer#r$r%r&r'r(�handle_timeout)rr1Zdeadliner+r,rrr�handle_requests"




zBaseServer.handle_requestcCs�y|j�\}}Wntk
r$dSX|j||�r�y|j||�Wq�tk
rl|j||�|j|�Yq�|j|��Yq�Xn
|j|�dS)z�Handle one request, without blocking.

        I assume that selector.select() has returned that the socket is
        readable before this function was called, so there should be no risk of
        blocking in get_request().
        N)�get_request�OSError�verify_request�process_request�	Exception�handle_error�shutdown_request)r�request�client_addressrrrr(3s

z"BaseServer._handle_request_noblockcCsdS)zcCalled if no new request arrives within self.timeout.

        Overridden by ForkingMixIn.
        Nr)rrrrr4JszBaseServer.handle_timeoutcCsdS)znVerify the request.  May be overridden.

        Return True if we should proceed with this request.

        Tr)rr=r>rrrr8QszBaseServer.verify_requestcCs|j||�|j|�dS)zVCall finish_request.

        Overridden by ForkingMixIn and ThreadingMixIn.

        N)�finish_requestr<)rr=r>rrrr9YszBaseServer.process_requestcCsdS)zDCalled to clean-up the server.

        May be overridden.

        Nr)rrrr�server_closebszBaseServer.server_closecCs|j|||�dS)z8Finish one request by instantiating RequestHandlerClass.N)r)rr=r>rrrr?jszBaseServer.finish_requestcCs|j|�dS)z3Called to shutdown and close an individual request.N)�
close_request)rr=rrrr<nszBaseServer.shutdown_requestcCsdS)z)Called to clean up an individual request.Nr)rr=rrrrArszBaseServer.close_requestcCsHtddtjd�td|tjd�ddl}|j�tddtjd�dS)ztHandle an error gracefully.  May be overridden.

        The default is to print a traceback and continue.

        �-�()�filez4Exception happened during processing of request fromrN)�print�sys�stderr�	traceback�	print_exc)rr=r>rHrrrr;vszBaseServer.handle_errorcCs|S)Nr)rrrr�	__enter__�szBaseServer.__enter__cGs|j�dS)N)r@)r�argsrrr�__exit__�szBaseServer.__exit__)r!)�__name__�
__module__�__qualname__�__doc__r1rr r-r/r)r5r(r4r8r9r@r?r<rAr;rJrLrrrrr�s&+

	
c@sfeZdZdZejZejZdZ	dZ
ddd�Zdd�Zd	d
�Z
dd�Zd
d�Zdd�Zdd�Zdd�ZdS)ra3Base class for various socket-based server classes.

    Defaults to synchronous IP stream (i.e., TCP).

    Methods for the caller:

    - __init__(server_address, RequestHandlerClass, bind_and_activate=True)
    - serve_forever(poll_interval=0.5)
    - shutdown()
    - handle_request()  # if you don't use serve_forever()
    - fileno() -> int   # for selector

    Methods that may be overridden:

    - server_bind()
    - server_activate()
    - get_request() -> request, client_address
    - handle_timeout()
    - verify_request(request, client_address)
    - process_request(request, client_address)
    - shutdown_request(request)
    - close_request(request)
    - handle_error()

    Methods for derived classes:

    - finish_request(request, client_address)

    Class variables that may be overridden by derived classes or
    instances:

    - timeout
    - address_family
    - socket_type
    - request_queue_size (only for stream sockets)
    - allow_reuse_address

    Instance variables:

    - server_address
    - RequestHandlerClass
    - socket

    �FTc	CsTtj|||�tj|j|j�|_|rPy|j�|j�Wn|j��YnXdS)z/Constructor.  May be extended, do not override.N)rrr0�address_family�socket_type�server_bindr r@)rrrZbind_and_activaterrrr�s
zTCPServer.__init__cCs8|jr|jjtjtjd�|jj|j�|jj�|_dS)zOCalled by constructor to bind the socket.

        May be overridden.

        �N)�allow_reuse_addressr0�
setsockoptZ
SOL_SOCKETZSO_REUSEADDRZbindrZgetsockname)rrrrrT�szTCPServer.server_bindcCs|jj|j�dS)zSCalled by constructor to activate the server.

        May be overridden.

        N)r0Zlisten�request_queue_size)rrrrr �szTCPServer.server_activatecCs|jj�dS)zDCalled to clean-up the server.

        May be overridden.

        N)r0�close)rrrrr@�szTCPServer.server_closecCs
|jj�S)zMReturn socket file number.

        Interface required by selector.

        )r0�fileno)rrrrrZ�szTCPServer.filenocCs
|jj�S)zYGet the request and client address from the socket.

        May be overridden.

        )r0Zaccept)rrrrr6�szTCPServer.get_requestcCs4y|jtj�Wntk
r$YnX|j|�dS)z3Called to shutdown and close an individual request.N)r/r0ZSHUT_WRr7rA)rr=rrrr<�s
zTCPServer.shutdown_requestcCs|j�dS)z)Called to clean up an individual request.N)rY)rr=rrrrAszTCPServer.close_requestN)T)rMrNrOrPr0ZAF_INETrRZSOCK_STREAMrSrXrVrrTr r@rZr6r<rArrrrr�s-


c@s>eZdZdZdZejZdZdd�Z	dd�Z
dd	�Zd
d�ZdS)
rzUDP server class.Fi cCs |jj|j�\}}||jf|fS)N)r0Zrecvfrom�max_packet_size)r�dataZclient_addrrrrr6szUDPServer.get_requestcCsdS)Nr)rrrrr szUDPServer.server_activatecCs|j|�dS)N)rA)rr=rrrr<szUDPServer.shutdown_requestcCsdS)Nr)rr=rrrrAszUDPServer.close_requestN)
rMrNrOrPrVr0Z
SOCK_DGRAMrSr[r6r r<rArrrrrscsVeZdZdZdZdZdZdZdd�dd�Zd	d
�Z	dd�Z
d
d�Z�fdd�Z�Z
S)rz5Mix-in class to handle each request in a new process.i,NrCF)�blockingcCs�|jdkrdSxht|j�|jkrvy tjdd�\}}|jj|�Wqtk
r^|jj�Yqtk
rrPYqXqWxt|jj	�D]f}y.|r�dntj
}tj||�\}}|jj|�Wq�tk
r�|jj|�Yq�tk
r�Yq�Xq�WdS)z7Internal routine to wait for children that have exited.NrUr���)�active_children�len�max_children�os�waitpid�discard�ChildProcessErrorr"r7�copy�WNOHANG)rr]�pid�_�flagsrrr�collect_children,s&
zForkingMixIn.collect_childrencCs|j�dS)zvWait for zombies after self.timeout seconds of inactivity.

            May be extended, do not override.
            N)rk)rrrrr4OszForkingMixIn.handle_timeoutcCs|j�dS)z�Collect the zombie child processes regularly in the ForkingMixIn.

            service_actions is called in the BaseServer's serve_forver loop.
            N)rk)rrrrr)VszForkingMixIn.service_actionscCs�tj�}|r8|jdkrt�|_|jj|�|j|�dSd}z:y|j||�d}Wn tk
rr|j||�YnXWdz|j	|�Wdtj
|�XXdS)z-Fork a new subprocess to process the request.NrUr)rbr
r_r*�addrAr?r:r;r<�_exit)rr=r>rhZstatusrrrr9]s 

zForkingMixIn.process_requestcst�j�|j|jd�dS)N)r])�superr@rk�_block_on_close)r)�	__class__rrr@vs
zForkingMixIn.server_close)rMrNrOrPr1r_rarorkr4r)r9r@�
__classcell__rr)rprr#s#cs<eZdZdZdZdZdZdd�Zdd�Z�fdd	�Z	�Z
S)
rz4Mix-in class to handle each request in a new thread.FNcCsHz6y|j||�Wn tk
r2|j||�YnXWd|j|�XdS)zgSame as in BaseServer but as a thread.

        In addition, exception handling is done here.

        N)r?r:r;r<)rr=r>rrr�process_request_thread�s
z%ThreadingMixIn.process_request_threadcCsRtj|j||fd�}|j|_|jrF|jrF|jdkr:g|_|jj|�|j�dS)z*Start a new thread to process the request.)�targetrKN)	rZThreadrr�daemon_threadsZdaemonro�_threads�append�start)rr=r>�trrrr9�s
zThreadingMixIn.process_requestcs:t�j�|jr6|j}d|_|r6x|D]}|j�q&WdS)N)rnr@roru�join)rZthreadsZthread)rprrr@�s

zThreadingMixIn.server_close)rMrNrOrPrtrorurrr9r@rqrr)rprr{s
c@seZdZdS)rN)rMrNrOrrrrr�sc@seZdZdS)rN)rMrNrOrrrrr�sc@seZdZdS)rN)rMrNrOrrrrr�sc@seZdZdS)rN)rMrNrOrrrrr�sc@seZdZejZdS)rN)rMrNrOr0rrRrrrrr�sc@seZdZejZdS)rN)rMrNrOr0rrRrrrrr�sc@seZdZdS)rN)rMrNrOrrrrr�sc@seZdZdS)rN)rMrNrOrrrrr�sc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r	a�Base class for request handler classes.

    This class is instantiated for each request to be handled.  The
    constructor sets the instance variables request, client_address
    and server, and then calls the handle() method.  To implement a
    specific service, all you need to do is to derive a class which
    defines a handle() method.

    The handle() method can find the request as self.request, the
    client address as self.client_address, and the server (in case it
    needs access to per-server information) as self.server.  Since a
    separate instance is created for each request, the handle() method
    can define other arbitrary instance variables.

    c
Cs6||_||_||_|j�z|j�Wd|j�XdS)N)r=r>�server�setup�handle�finish)rr=r>rzrrrr�szBaseRequestHandler.__init__cCsdS)Nr)rrrrr{�szBaseRequestHandler.setupcCsdS)Nr)rrrrr|�szBaseRequestHandler.handlecCsdS)Nr)rrrrr}�szBaseRequestHandler.finishN)rMrNrOrPrr{r|r}rrrrr	�s

c@s0eZdZdZd
ZdZdZdZdd�Zdd	�Z	dS)r
z4Define self.rfile and self.wfile for stream sockets.rUrNFcCsz|j|_|jdk	r |jj|j�|jr:|jjtjtjd�|jj	d|j
�|_|jdkrdt
|j�|_n|jj	d|j�|_dS)NT�rbr�wb)r=Z
connectionr1Z
settimeout�disable_nagle_algorithmrWr0ZIPPROTO_TCPZTCP_NODELAY�makefile�rbufsize�rfile�wbufsize�
_SocketWriter�wfile)rrrrr{�s



zStreamRequestHandler.setupcCsF|jjs.y|jj�Wntjk
r,YnX|jj�|jj�dS)N)r��closed�flushr0�errorrYr�)rrrrr}s
zStreamRequestHandler.finishr^)
rMrNrOrPr�r�r1r�r{r}rrrrr
�s	
c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r�z�Simple writable BufferedIOBase implementation for a socket

    Does not hold data in a buffer, avoiding any need to call flush().cCs
||_dS)N)�_sock)rZsockrrrrsz_SocketWriter.__init__cCsdS)NTr)rrrr�writablesz_SocketWriter.writablec	Cs&|jj|�t|��}|jSQRXdS)N)r�Zsendall�
memoryview�nbytes)r�bZviewrrr�write"s
z_SocketWriter.writecCs
|jj�S)N)r�rZ)rrrrrZ'sz_SocketWriter.filenoN)rMrNrOrPrr�r�rZrrrrr�s
r�c@s eZdZdZdd�Zdd�ZdS)rz6Define self.rfile and self.wfile for datagram sockets.cCs2ddlm}|j\|_|_||j�|_|�|_dS)Nr)�BytesIO)�ior�r=Zpacketr0r�r�)rr�rrrr{.szDatagramRequestHandler.setupcCs|jj|jj�|j�dS)N)r0Zsendtor��getvaluer>)rrrrr}4szDatagramRequestHandler.finishN)rMrNrOrPr{r}rrrrr*s)%rP�__version__r0r%rb�errnorFr�ImportErrorZdummy_threadingr�rr3r�__all__�hasattr�extendrr#ZSelectSelectorrrrrrrrrrrrrrr	r
r�rrrrr�<module>ws\


n~X..-tempfile.cpython-36.pyc000064400000055341150335715140011013 0ustar003

�\dh�m�@sBdZddddddddd	d
ddd
g
ZddlZddlZddlZddlZ	ddl
ZddlZ
ddlmZddlZyddlZWnek
r�ddlZYnXejZe	je	jBe	jBZee	d�r�ee	jOZeZee	d�r�ee	jOZee	d�r�e	j Z ndZ dZ!e�Z"ee	d��re	j#Z$nee	d��re	j%Z$ndd�Z$dd�Z&dd�Z'dd�Z(Gdd �d �Z)d!d"�Z*d#d$�Z+da,d%d&�Z-d'd(�Z.d)d*�Z/d+d,�Z0d-d	�Z1d.d�Z2da3d/d�Z4d0d
�Z5dDd2d�Z6dEd3d�Z7d4e!dfd5d�Z8Gd6d7�d7�Z9Gd8d9�d9�Z:dGd=d�Z;e	j<d>k�se	j=j>d?k�re;Z?nee	d@�a@dIdAd�Z?GdBd�d�ZAGdCd�deB�ZCdS)Ja�Temporary files.

This module provides generic, low- and high-level interfaces for
creating temporary files and directories.  All of the interfaces
provided by this module can be used without fear of race conditions
except for 'mktemp'.  'mktemp' is subject to race conditions and
should not be used; it is provided for backward compatibility only.

The default path names are returned as str.  If you supply bytes as
input, all return values will be in bytes.  Ex:

    >>> tempfile.mkstemp()
    (4, '/tmp/tmptpu9nin8')
    >>> tempfile.mkdtemp(suffix=b'')
    b'/tmp/tmppbi8f0hy'

This module also provides some data items to the user:

  TMP_MAX  - maximum number of names that will be tried before
             giving up.
  tempdir  - If this is set to a string before the first use of
             any routine from this module, it will be considered as
             another candidate location to store temporary files.
�NamedTemporaryFile�
TemporaryFile�SpooledTemporaryFile�TemporaryDirectory�mkstemp�mkdtemp�mktemp�TMP_MAX�
gettempprefix�tempdir�
gettempdir�gettempprefixb�gettempdirb�N)�Random�
O_NOFOLLOW�O_BINARYi'Ztmp�lstat�statcCstj|tj�}tj|�dS)N)�_os�open�O_RDONLY�close)�fn�fd�r� /usr/lib64/python3.6/tempfile.py�_statTsrcCs*yt|�Wntk
r dSXdSdS)NFT)r�OSError)rrrr�_existsXs
rcGs`d}xJ|D]B}|dkrq
t|t�r8|tkr2td��t}q
|tkrHtd��t}q
W|dkr\tS|S)zBLook at the type of all args and divine their implied return type.Nz1Can't mix bytes and non-bytes in path components.)�
isinstance�bytes�str�	TypeError)�argsZreturn_type�argrrr�_infer_return_typeas

r%cCsdt|||�}|dkr|�}|dkr:|tkr0t}n
tjt�}|dkrX|tkrRt�}nt�}||||fS)z9Common parameter processing for most APIs in this module.N)r%r!�templater�fsencoderr
)�prefix�suffix�dir�output_typerrr�_sanitize_paramsvs
r,c@s0eZdZdZdZedd��Zdd�Zdd�Zd	S)
�_RandomNameSequencea,An instance of _RandomNameSequence generates an endless
    sequence of unpredictable strings which can safely be incorporated
    into file names.  Each string is eight characters long.  Multiple
    threads can safely use the same instance at the same time.

    _RandomNameSequence is an iterator.Z%abcdefghijklmnopqrstuvwxyz0123456789_cCs,tj�}|t|dd�kr&t�|_||_|jS)N�_rng_pid)r�getpid�getattr�_RandomZ_rngr.)�selfZcur_pidrrr�rng�s
z_RandomNameSequence.rngcCs|S)Nr)r2rrr�__iter__�sz_RandomNameSequence.__iter__cs0|j�|jj���fdd�td�D�}dj|�S)Ncsg|]}����qSrr)�.0Zdummy)�c�chooserr�
<listcomp>�sz0_RandomNameSequence.__next__.<locals>.<listcomp>��)�
charactersr3Zchoice�range�join)r2Zlettersr)r6r7r�__next__�sz_RandomNameSequence.__next__N)	�__name__�
__module__�__qualname__�__doc__r;�propertyr3r4r>rrrrr-�s
r-cCs�g}x$dD]}tj|�}|r
|j|�q
Wtjdkr\|jtjjd�tjjd�ddd	d
g�n|jddd
g�y|jtj��Wn$t	t
fk
r�|jtj�YnX|S)z[Generate a list of candidate temporary directories which
    _get_default_tempdir will try.�TMPDIR�TEMP�TMP�ntz~\AppData\Local\Tempz%SYSTEMROOT%\Tempzc:\tempzc:\tmpz\tempz\tmpz/tmpz/var/tmpz/usr/tmp)rDrErF)r�getenv�append�name�extend�path�
expanduser�
expandvars�getcwd�AttributeErrorr�curdir)�dirlistZenvname�dirnamerrr�_candidate_tempdir_list�s



rTcCs4t�}t�}�x|D�]}|tjkr0tjj|�}x�td�D]�}t|�}tjj||�}y\tj	|t
d�}z<z*tj	|ddd��}|jd�WdQRXWdtj
|�XWdtj|�X|Stk
r�Yq:tk
�rtjdkr�tjj|�r�tj|tj�r�w:PYq:tk
�rPYq:Xq:WqWttjd	|��dS)
aqCalculate the default directory to use for temporary files.
    This routine should be called exactly once.

    We determine whether or not a candidate temp dir is usable by
    trying to create and write to a file in that directory.  If this
    is successful, the test file is deleted.  To prevent denial of
    service, the name of the test file must be randomized.�di��wbF)�closefdsblatNrGz)No usable temporary directory found in %s)r-rTrrQrL�abspathr<�nextr=r�_bin_openflags�_io�writer�unlink�FileExistsError�PermissionErrorrJ�isdir�access�W_OKr�FileNotFoundError�_errno�ENOENT)ZnamerrRr*�seqrJ�filenamer�fprrr�_get_default_tempdir�s:	
ric
Cs2tdkr.tj�ztdkr t�aWdtj�XtS)z7Common setup sequence for all user-callable interfaces.N)�_name_sequence�
_once_lock�acquirer-�releaserrrr�_get_candidate_names�s

rnc
Cs�t�}|tkrttj|�}x�tt�D]�}t|�}tjj	||||�}ytj
||d�}	WnRtk
rnw$Yn>tk
r�tj
dkr�tjj|�r�tj|tj�r�w$n�YnX|	tjj|�fSWttjd��dS)z>Code common to mkstemp, TemporaryFile, and NamedTemporaryFile.i�rGz#No usable temporary file name foundN)rnr �maprr'r<rrYrLr=rr^r_rJr`rarbrXrd�EEXIST)
r*ZpreZsuf�flagsr+�namesrfrJ�filerrrr�_mkstemp_inner�s$rtcGsJ|tjkr ||f|�ddi�n&tjdks8tjj|�rF||f|��dS)N�follow_symlinksFrG)r�supports_follow_symlinksrJrL�islink)�funcrLr#rrr�_dont_follow_symlinkss
rycCs>y
tj}Wntk
rYnXt||d�ttj|d�dS)Nri�)r�chflagsrPry�chmod)rLrzrrr�_resetpermss
r|cCstS)z-The default prefix for temporary directories.)r&rrrrr	*scCstjt��S)z6The default prefix for temporary directories as bytes.)rr'r	rrrrr.sc
Cs2tdkr.tj�ztdkr t�aWdtj�XtS)zAccessor for tempfile.tempdir.N)r
rkrlrirmrrrrr4s

cCstjt��S)z)A bytes version of tempfile.gettempdir().)rr'rrrrrr
@sFcCs2t|||�\}}}}|rt}nt}t|||||�S)a�User-callable function to create and return a unique temporary
    file.  The return value is a pair (fd, name) where fd is the
    file descriptor returned by os.open, and name is the filename.

    If 'suffix' is not None, the file name will end with that suffix,
    otherwise there will be no suffix.

    If 'prefix' is not None, the file name will begin with that prefix,
    otherwise a default prefix is used.

    If 'dir' is not None, the file will be created in that directory,
    otherwise a default directory is used.

    If 'text' is specified and true, the file is opened in text
    mode.  Else (the default) the file is opened in binary mode.  On
    some operating systems, this makes no difference.

    If any of 'suffix', 'prefix' and 'dir' are not None, they must be the
    same type.  If they are bytes, the returned name will be bytes; str
    otherwise.

    The file is readable and writable only by the creating user ID.
    If the operating system uses permission bits to indicate whether a
    file is executable, the file is executable by no one. The file
    descriptor is not inherited by children of this process.

    Caller is responsible for deleting the file when done with it.
    )r,�_text_openflagsrZrt)r)r(r*�textr+rqrrrrDs
cCs�t|||�\}}}}t�}|tkr.ttj|�}x�tt�D]�}t|�}tj	j
||||�}ytj|d�WnRtk
r�w8Yn>t
k
r�tjdkr�tj	j|�r�tj|tj�r�w8n�YnX|SWttjd��dS)aUser-callable function to create and return a unique temporary
    directory.  The return value is the pathname of the directory.

    Arguments are as for mkstemp, except that the 'text' argument is
    not accepted.

    The directory is readable, writable, and searchable only by the
    creating user.

    Caller is responsible for deleting the directory when done with it.
    i�rGz(No usable temporary directory name foundN)r,rnr rorr'r<rrYrLr=�mkdirr^r_rJr`rarbrdrp)r)r(r*r+rrrfrJrsrrrrls&
r:cCs`|dkrt�}t�}x:tt�D].}t|�}tjj||||�}t|�s|SqWt	t
jd��dS)a�User-callable function to return a unique temporary file name.  The
    file is not created.

    Arguments are similar to mkstemp, except that the 'text' argument is
    not accepted, and suffix=None, prefix=None and bytes file names are not
    supported.

    THIS FUNCTION IS UNSAFE AND SHOULD NOT BE USED.  The file name may
    refer to a file that did not exist at some point, but by the time
    you get around to creating it, someone else may have beaten you to
    the punch.
    Nz"No usable temporary filename found)rrnr<rrYrrLr=rr^rdrp)r)r(r*rrrfrJrsrrrr�sc@sLeZdZdZdZdZd
dd�Zejdkr@ej	fdd	�Z
d
d�Zndd	�Z
dS)�_TemporaryFileCloserz�A separate object allowing proper closing of a temporary file's
    underlying file object, without adding a __del__ method to the
    temporary file.NFTcCs||_||_||_dS)N)rsrJ�delete)r2rsrJr�rrr�__init__�sz_TemporaryFileCloser.__init__rGcCs>|jr:|jdk	r:d|_z|jj�Wd|jr8||j�XdS)NT)�close_calledrsrr�rJ)r2r]rrrr�sz_TemporaryFileCloser.closecCs|j�dS)N)r)r2rrr�__del__�sz_TemporaryFileCloser.__del__cCs|jsd|_|jj�dS)NT)r�rsr)r2rrrr�s)T)r?r@rArBrsr�r�rrJr]rr�rrrrr��s



r�c@sBeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�_TemporaryFileWrapperz�Temporary file wrapper

    This class provides a wrapper around files opened for
    temporary use.  In particular, it seeks to automatically
    remove the file when it is no longer needed.
    TcCs$||_||_||_t|||�|_dS)N)rsrJr�r��_closer)r2rsrJr�rrrr��sz_TemporaryFileWrapper.__init__cs^|jd}t||�}t|d�rD|�tj���fdd��}|j|_|}t|t�sZt|||�|S)Nrs�__call__cs
�||�S)Nr)r#�kwargs)rxrr�func_wrapper�sz7_TemporaryFileWrapper.__getattr__.<locals>.func_wrapper)	�__dict__r0�hasattr�
_functools�wrapsr�r�int�setattr)r2rJrs�ar�r)rxr�__getattr__�s



z!_TemporaryFileWrapper.__getattr__cCs|jj�|S)N)rs�	__enter__)r2rrrr�s
z_TemporaryFileWrapper.__enter__cCs|jj|||�}|j�|S)N)rs�__exit__r)r2�exc�value�tb�resultrrrr�sz_TemporaryFileWrapper.__exit__cCs|jj�dS)zA
        Close the temporary file, possibly deleting it.
        N)r�r)r2rrrrsz_TemporaryFileWrapper.closeccsx|jD]
}|VqWdS)N)rs)r2�linerrrr4sz_TemporaryFileWrapper.__iter__N)T)
r?r@rArBr�r�r�r�rr4rrrrr��s
r��w+b�Tc

Cs�t|||�\}}}}t}	tjdkr0|r0|	tjO}	t||||	|�\}
}y tj|
||||d�}t|||�St	k
r�tj
|�tj|
��YnXdS)a�Create and return a temporary file.
    Arguments:
    'prefix', 'suffix', 'dir' -- as for mkstemp.
    'mode' -- the mode argument to io.open (default "w+b").
    'buffering' -- the buffer size argument to io.open (default -1).
    'encoding' -- the encoding argument to io.open (default None)
    'newline' -- the newline argument to io.open (default None)
    'delete' -- whether the file is deleted on close (default True).
    The file is created as mkstemp() would do it.

    Returns an object with a file-like interface; the name of the file
    is accessible as its 'name' attribute.  The file will be automatically
    deleted when it is closed unless the 'delete' argument is set to False.
    rG)�	buffering�newline�encodingN)r,rZrrJZO_TEMPORARYrtr[rr��
BaseExceptionr]r)
�moder�r�r�r)r(r*r�r+rqrrJrsrrrrs




�posix�cygwin�	O_TMPFILEcCs�t|||�\}}}}t}tr�y$|tjBtj@}	tj||	d�}
Wn*tk
rXdaYnBtk
rjYn0Xyt	j|
||||d�Stj
|
��YnXt|||||�\}
}ytj|�t	j|
||||d�Stj
|
��YnXdS)a>Create and return a temporary file.
        Arguments:
        'prefix', 'suffix', 'dir' -- as for mkstemp.
        'mode' -- the mode argument to io.open (default "w+b").
        'buffering' -- the buffer size argument to io.open (default -1).
        'encoding' -- the encoding argument to io.open (default None)
        'newline' -- the newline argument to io.open (default None)
        The file is created as mkstemp() would do it.

        Returns an object with a file-like interface.  The file has no
        name, and will cease to exist when it is closed.
        i�F)r�r�r�N)
r,rZ�_O_TMPFILE_WORKSrr��O_CREATr�IsADirectoryErrorrr[rrtr])r�r�r�r�r)r(r*r+rqZflags2rrJrrrrNs0






c@s�eZdZdZdZd8dd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zedd��Z
edd��Zdd�Zdd�Zdd�Zedd ��Zed!d"��Zed#d$��Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zed-d.��Zd/d0�Zd9d1d2�Zd3d4�Zd5d6�ZdS):rz�Temporary file wrapper, specialized to switch from BytesIO
    or StringIO to a real file when it exceeds a certain size or
    when a fileno is needed.
    Fr�w+br�Nc		CsHd|krtj�|_ntjdd�|_||_d|_|||||||d�|_dS)N�b�
)r�F)r�r�r)r(r�r�r*)r[�BytesIO�_file�StringIO�	_max_size�_rolled�_TemporaryFileArgs)	r2�max_sizer�r�r�r�r)r(r*rrrr��szSpooledTemporaryFile.__init__cCs,|jr
dS|j}|r(|j�|kr(|j�dS)N)r�r��tell�rollover)r2rsr�rrr�_check�s
zSpooledTemporaryFile._checkcCsN|jr
dS|j}tf|j�}|_|`|j|j��|j|j�d�d|_dS)NrT)r�r�rr�r\�getvalue�seekr�)r2rsZnewfilerrrr��szSpooledTemporaryFile.rollovercCs|jjrtd��|S)Nz%Cannot enter context with closed file)r��closed�
ValueError)r2rrrr��szSpooledTemporaryFile.__enter__cCs|jj�dS)N)r�r)r2r�r�r�rrrr��szSpooledTemporaryFile.__exit__cCs
|jj�S)N)r�r4)r2rrrr4�szSpooledTemporaryFile.__iter__cCs|jj�dS)N)r�r)r2rrrr�szSpooledTemporaryFile.closecCs|jjS)N)r�r�)r2rrrr��szSpooledTemporaryFile.closedcCs8y|jjStk
r2d|jdkr(�|jdSXdS)Nr�r�r�)r�r�rPr�)r2rrrr��szSpooledTemporaryFile.encodingcCs|j�|jj�S)N)r�r��fileno)r2rrrr��szSpooledTemporaryFile.filenocCs|jj�dS)N)r��flush)r2rrrr��szSpooledTemporaryFile.flushcCs
|jj�S)N)r��isatty)r2rrrr��szSpooledTemporaryFile.isattycCs(y|jjStk
r"|jdSXdS)Nr�)r�r�rPr�)r2rrrr��szSpooledTemporaryFile.modecCs"y|jjStk
rdSXdS)N)r�rJrP)r2rrrrJ�szSpooledTemporaryFile.namecCs8y|jjStk
r2d|jdkr(�|jdSXdS)Nr�r�r�)r��newlinesrPr�)r2rrrr��szSpooledTemporaryFile.newlinescGs|jj|�S)N)r��read)r2r#rrrr��szSpooledTemporaryFile.readcGs|jj|�S)N)r��readline)r2r#rrrr��szSpooledTemporaryFile.readlinecGs|jj|�S)N)r��	readlines)r2r#rrrr��szSpooledTemporaryFile.readlinescGs|jj|�dS)N)r�r�)r2r#rrrr��szSpooledTemporaryFile.seekcCs|jjS)N)r��	softspace)r2rrrr�szSpooledTemporaryFile.softspacecCs
|jj�S)N)r�r�)r2rrrr�szSpooledTemporaryFile.tellcCs6|dkr|jj�n||jkr&|j�|jj|�dS)N)r��truncater�r�)r2�sizerrrr�s

zSpooledTemporaryFile.truncatecCs|j}|j|�}|j|�|S)N)r�r\r�)r2�srs�rvrrrr\s

zSpooledTemporaryFile.writecCs|j}|j|�}|j|�|S)N)r��
writelinesr�)r2�iterablersr�rrrr�s

zSpooledTemporaryFile.writelines���)rr�r�NNNNN)N)r?r@rArBr�r�r�r�r�r�r4rrCr�r�r�r�r�r�rJr�r�r�r�r�r�r�r�r\r�rrrrr�s8
		
c@sReZdZdZddd�Zedd��Zedd��Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)ra+Create and return a temporary directory.  This has the same
    behavior as mkdtemp but can be used as a context manager.  For
    example:

        with TemporaryDirectory() as tmpdir:
            ...

    Upon exiting the context, the directory and everything contained
    in it are removed.
    NcCs0t|||�|_tj||j|jdj|�d�|_dS)NzImplicitly cleaning up {!r})�warn_message)rrJ�_weakref�finalize�_cleanup�format�
_finalizer)r2r)r(r*rrrr�(s
zTemporaryDirectory.__init__cs ��fdd�}tj�|d�dS)Ncs�t|dt�r|yV|�kr(ttjj|��t|�ytj|�Wn"ttfk
r`�j|�YnXWq�t	k
rxYq�Xnt|dt	�r�n�dS)Nr)
�
issubclassr_r|rrLrSr]r��_rmtreerc)rxrL�exc_info)�clsrJrr�onerror0sz+TemporaryDirectory._rmtree.<locals>.onerror)r�)�_shutilZrmtree)r�rJr�r)r�rJrr�.szTemporaryDirectory._rmtreecCs|j|�tj|t�dS)N)r��	_warnings�warn�ResourceWarning)r�rJr�rrrr�Es
zTemporaryDirectory._cleanupcCsdj|jj|j�S)Nz	<{} {!r}>)r��	__class__r?rJ)r2rrr�__repr__JszTemporaryDirectory.__repr__cCs|jS)N)rJ)r2rrrr�MszTemporaryDirectory.__enter__cCs|j�dS)N)�cleanup)r2r�r�r�rrrr�PszTemporaryDirectory.__exit__cCs|jj�r|j|j�dS)N)r��detachr�rJ)r2rrrr�Ss
zTemporaryDirectory.cleanup)NNN)r?r@rArBr��classmethodr�r�r�r�r�r�rrrrrs

)NNNF)NNNr�)r�r�NNNNNTr�)r�r�NNNNN)DrB�__all__�	functoolsr��warningsr��ior[�osrZshutilr��errnordZrandomrr1�weakrefr��_thread�ImportErrorZ
_dummy_thread�
allocate_lockZ_allocate_lock�O_RDWRr��O_EXCLr}r�rrZrrr&rkrrrrr%r,r-rTrirjrnrtryr|r	rr
rr
rrrr�r�rrJ�sys�platformrr�r�objectrrrrr�<module>s�




	-
(
' +?
$

8hashlib.cpython-36.opt-1.pyc000064400000013043150335715140011550 0ustar003

�\dh_"�$@sfdZd$Zee�Zee�Zed%ZyddlmZWne	k
rLdd�ZYnXe�s`iZ
dd�Zdd�Ze�sxd&dd�Z
d'dd�Zy dd lZeZeZejej�ZWn$e	k
r�e�r��e
ZeZYnXdd!lmZydd"lmZWne	k
�r�YnXxLeD]DZyee�e�e<Wn*ek
�rBdd lZejd#e�YnX�qW[[[[[ej��s`[
[d S)(a3hashlib module - A common interface to many hash functions.

new(name, data=b'', **kwargs) - returns a new hash object implementing the
                                given hash function; initializing the hash
                                using the given binary data.

Named constructor functions are also available, these are faster
than using new(name):

md5(), sha1(), sha224(), sha256(), sha384(), sha512(), blake2b(), blake2s(),
sha3_224, sha3_256, sha3_384, sha3_512, shake_128, and shake_256.

More algorithms may be available on your platform but the above are guaranteed
to exist.  See the algorithms_guaranteed and algorithms_available attributes
to find out what algorithm names can be passed to new().

NOTE: If you want the adler32 or crc32 hash functions they are available in
the zlib module.

Choose your hash function wisely.  Some have known collision weaknesses.
sha384 and sha512 will be slow on 32 bit platforms.

Hash objects have these methods:
 - update(data): Update the hash object with the bytes in data. Repeated calls
                 are equivalent to a single call with the concatenation of all
                 the arguments.
 - digest():     Return the digest of the bytes passed to the update() method
                 so far as a bytes object.
 - hexdigest():  Like digest() except the digest is returned as a string
                 of double length, containing only hexadecimal digits.
 - copy():       Return a copy (clone) of the hash object. This can be used to
                 efficiently compute the digests of datas that share a common
                 initial substring.

For example, to obtain the digest of the byte string 'Nobody inspects the
spammish repetition':

    >>> import hashlib
    >>> m = hashlib.md5()
    >>> m.update(b"Nobody inspects")
    >>> m.update(b" the spammish repetition")
    >>> m.digest()
    b'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9'

More condensed:

    >>> hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest()
    'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2'

�md5�sha1�sha224�sha256�sha384�sha512�blake2b�blake2s�sha3_224�sha3_256�sha3_384�sha3_512�	shake_128�	shake_256�new�algorithms_guaranteed�algorithms_available�pbkdf2_hmac�)�
get_fips_modecCsdS)Nr�rrr�/usr/lib64/python3.6/hashlib.py�_hashlib_get_fips_modeIsrc	
Cs�t}|j|�}|dk	r|S�y2|dkrDddl}|j|d<|d<�n|dkrjddl}|j|d<|d<�n�|dkr�ddl}|j|d<|d	<|j|d<|d<n�|dkr�ddl	}|j
|d<|d
<|j|d
<|d<nv|dk�r�ddl}|j
|d<|j|d<nN|dk�rLddl}|j|d<|j|d<|j|d<|j|d<|j|d<|j|d<Wntk
�rdYnX|j|�}|dk	�r~|Std|��dS)N�SHA1rr�MD5r�SHA256r�SHA224r�SHA512r�SHA384rrrr	r
rrr
rzunsupported hash type )rr)rr)rrrr)rrrr)rr>rr	rr
r
r)�__builtin_constructor_cache�get�_sha1r�_md5r�_sha256rr�_sha512rr�_blake2rr�_sha3r	r
rrr
r�ImportError�
ValueError)	�name�cache�constructorr r!r"r#r$r%rrr�__get_builtin_constructorPsL









r+cCsZtj�s|dkrt|�Sy ttd|�}tj�s6|�|Sttfk
rTt|�SXdS)Nrrrr
Zopenssl_>r
rrr)�_hashlibrr+�getattr�AttributeErrorr')r(�frrr�__get_openssl_constructor{sr0�cKst|�|f|�S)z�new(name, data=b'', **kwargs) - Return a new hashing object using the
        named algorithm; optionally initialized with data (which must be
        a bytes-like object).
        )r+)r(�data�kwargsrrr�__py_new�sr4cKs�tj�r(|}ddddddd�j||�}n|dkr@t|�|f|�Sy:|jd
d�}tj|||d�}tj�rx||krx|j|�|Stk
r�tj�r��t|�|�SXd
S)z�new(name, data=b'') - Return a new hashing object using the named algorithm;
    optionally initialized with data (which must be a bytes-like object).
    zsha3-224zsha3-256zsha3-384zsha3-512Zshake128Zshake256)r	r
rrr
rrr�usedforsecurityT)r5N>rr)r,rrr+�poprZ	_set_namer')r(r2r3Z	orig_namer5Zretvalrrr�
__hash_new�s,

r7N)r)�scryptzcode for hash %s was not found.)rrrrrrrrr	r
rrr
r)rrrr)r1)r1)�__doc__Z__always_supported�setrr�__all__r,rrr&rr+r0r4r7rZ
__get_hash�unionZopenssl_md_meth_namesrr8Z__func_name�globalsr'ZloggingZ	exceptionrrrr�<module>6s\+

'


imp.cpython-36.opt-1.pyc000064400000022742150335715140010731 0ustar003


 \�)�
@s�dZddlmZmZmZmZmZmZmZm	Z	m
Z
yddlmZWnek
rXdZYnXddl
mZmZmZmZddlmZddlmZddlmZddlZddlZddlZddlZddlZddlZejd	ed
d�dZdZd
Z d
Z!dZ"dZ#dZ$dZ%dZ&dZ'dd�Z(dd�Z)dd�Z*d8dd�Z+dd�Z,dd�Z-Gd d!�d!�Z.Gd"d#�d#�Z/Gd$d%�d%e/ej0�Z1d9d&d'�Z2Gd(d)�d)e/e�Z3d:d*d+�Z4d,d-�Z5d.d/�Z6d;d0d1�Z7d2d3�Z8d4d5�Z9e�r�d<d6d7�Z:ndZ:dS)=z�This module provides the components needed to build your own __import__
function.  Undocumented functions are obsolete.

In most cases it is preferred you consider using the importlib module's
functionality over this module.

�)	�	lock_held�acquire_lock�release_lock�get_frozen_object�is_frozen_package�init_frozen�
is_builtin�	is_frozen�_fix_co_filename)�create_dynamicN)�_ERR_MSG�_exec�_load�_builtin_from_name)�SourcelessFileLoader)�	machinery)�utilzhthe imp module is deprecated in favour of importlib; see the module's documentation for alternative uses�)�
stacklevel��������	cCs
tj|�S)z_**DEPRECATED**

    Create a new module.

    The module is not entered into sys.modules.

    )�types�
ModuleType)�name�r �/usr/lib64/python3.6/imp.py�
new_module0sr"cCstjS)z@**DEPRECATED**

    Return the magic number for .pyc files.
    )r�MAGIC_NUMBERr r r r!�	get_magic;sr$cCstjjS)z$Return the magic tag for .pyc files.)�sys�implementation�	cache_tagr r r r!�get_tagCsr(c
Cs*tj��tjd�tj||�SQRXdS)a�**DEPRECATED**

    Given the path to a .py file, return the path to its .pyc file.

    The .py file does not need to exist; this simply returns the path to the
    .pyc file calculated as if the .py file were imported.

    If debug_override is not None, then it must be a boolean and is used in
    place of sys.flags.optimize.

    If sys.implementation.cache_tag is None then NotImplementedError is raised.

    �ignoreN)�warnings�catch_warnings�simplefilterr�cache_from_source)�path�debug_overrider r r!r-Hs

r-cCs
tj|�S)a~**DEPRECATED**

    Given the path to a .pyc. file, return the path to its .py file.

    The .pyc file does not need to exist; this simply returns the path to
    the .py file calculated to correspond to the .pyc file.  If path does
    not conform to PEP 3147 format, ValueError will be raised. If
    sys.implementation.cache_tag is None then NotImplementedError is raised.

    )r�source_from_cache)r.r r r!r0[sr0cCs<dd�tjD�}dd�tjD�}dd�tjD�}|||S)z**DEPRECATED**cSsg|]}|dtf�qS)�rb)�C_EXTENSION)�.0�sr r r!�
<listcomp>ksz get_suffixes.<locals>.<listcomp>cSsg|]}|dtf�qS)�r)�	PY_SOURCE)r3r4r r r!r5lscSsg|]}|dtf�qS)r1)�PY_COMPILED)r3r4r r r!r5ms)r�EXTENSION_SUFFIXES�SOURCE_SUFFIXES�BYTECODE_SUFFIXES)�
extensions�source�bytecoder r r!�get_suffixesisr?c@s eZdZdZdd�Zdd�ZdS)�NullImporterz-**DEPRECATED**

    Null import object.

    cCs2|dkrtddd��ntjj|�r.td|d��dS)N�zempty pathname)r.zexisting directory)�ImportError�osr.�isdir)�selfr.r r r!�__init__zszNullImporter.__init__cCsdS)zAlways returns None.Nr )rE�fullnamer r r!�find_module�szNullImporter.find_moduleN)�__name__�
__module__�__qualname__�__doc__rFrHr r r r!r@rsr@cs.eZdZdZd�fdd�	Z�fdd�Z�ZS)�_HackedGetDatazMCompatibility support for 'file' arguments of various load_*()
    functions.Ncst�j||�||_dS)N)�superrF�file)rErGr.rO)�	__class__r r!rF�sz_HackedGetData.__init__c	sX|jrH||jkrH|jjs |j}nt|jd�|_}|�
|j�SQRXnt�j|�SdS)z;Gross hack to contort loader to deal w/ load_*()'s bad API.r6N)rOr.�closed�open�readrN�get_data)rEr.rO)rPr r!rT�sz_HackedGetData.get_data)N)rIrJrKrLrFrT�
__classcell__r r )rPr!rM�srMc@seZdZdZdS)�_LoadSourceCompatibilityz5Compatibility support for implementing load_source().N)rIrJrKrLr r r r!rV�srVcCs\t|||�}tj|||d�}|tjkr8t|tj|�}nt|�}tj||�|_	|j	|j
_|S)N)�loader)rVr�spec_from_file_locationr%�modulesr
rr�SourceFileLoader�
__loader__�__spec__rW)r�pathnamerOrW�spec�moduler r r!�load_source�s

r`c@seZdZdZdS)�_LoadCompiledCompatibilityz7Compatibility support for implementing load_compiled().N)rIrJrKrLr r r r!ra�sracCsZt|||�}tj|||d�}|tjkr8t|tj|�}nt|�}t||�|_|j|j	_
|S)z**DEPRECATED**)rW)rarrXr%rYr
rrr[r\rW)rr]rOrWr^r_r r r!�
load_compiled�s

rbcCs�tjj|�rhtjdd�tjdd�}x>|D](}tjj|d|�}tjj|�r.|}Pq.Wtdj	|���t
j||gd�}|tj
kr�t|tj
|�St|�SdS)z**DEPRECATED**NrFz{!r} is not a package)�submodule_search_locations)rCr.rDrr:r;�join�exists�
ValueError�formatrrXr%rYr
r)rr.r<�	extensionZ	init_pathr^r r r!�load_package�s

ric	Cs|\}}}|r2|jd
�s"d|kr2tdj|���n�|dkrZ|tthkrZdj|�}t|��n�|tkrnt|||�S|tkr�t|||�S|tkr�tdk	r�|dkr�t	|d��}t|||�SQRXnt|||�SnL|t
kr�t||�S|tkr�t
|�S|tk�r�t|�Sdj||�}t||d	��dS)z�**DEPRECATED**

    Load a module, given information returned by find_module().

    The module name must include the full package name, if any.

    r6�U�+zinvalid file open mode {!r}Nz.file object required for import (type code {})r1z*Don't know how to import {} (type code {}))r)r6rj)�
startswithrfrgr7r8r`rbr2�load_dynamicrR�
PKG_DIRECTORYri�	C_BUILTIN�init_builtin�	PY_FROZENrrB)	rrO�filenameZdetails�suffix�mode�type_�msgZopened_filer r r!�load_module�s.




rwcCs�t|t�stdjt|����n$t|td�tf�sBtdjt|����|dkr�t|�rbddddtffSt	|�rzddddt
ffStj}x�|D]�}t
jj||�}xHdtjdgD]6}d|}t
jj||�}t
jj|�r�d|ddtffSq�Wx:t�D].\}}}||}	t
jj||	�}t
jj|�r�Pq�Wq�Pq�Wttj|�|d��d}
d	|k�rjt|d
��}tj|j�d}
WdQRXt|||
d�}|||||ffS)a,**DEPRECATED**

    Search for a module.

    If path is omitted or None, search for a built-in, frozen or special
    module and continue search in sys.path. The module name cannot
    contain '.'; to search for a submodule of a package, pass the
    submodule name and the package's __path__.

    z'name' must be a str, not {}Nz%'path' must be None or a list, not {}rAz.pyrrF)r�br1)�encoding)�
isinstance�str�	TypeErrorrg�type�list�RuntimeErrorrror	rqr%r.rCrdrr;�isfilernr?rBrrR�tokenize�detect_encoding�readline)rr.�entryZpackage_directoryrsZpackage_file_nameZ	file_pathrtru�	file_nameryrOr r r!rH�s@


rHcCs
tj|�S)zw**DEPRECATED**

    Reload the module and return it.

    The module must have been successfully imported before.

    )�	importlib�reload)r_r r r!r�3sr�cCs"yt|�Stk
rdSXdS)zl**DEPRECATED**

    Load and return a built-in module by name, or None is such module doesn't
    exist
    N)rrB)rr r r!rp>srpcCs0ddl}|jj||�}|jj|||d�}t|�S)z:**DEPRECATED**

        Load an extension module.
        rN)rrW�origin)�importlib.machineryr�ExtensionFileLoader�
ModuleSpecr)rr.rOr�rWr^r r r!rmKs
rm)N)N)N)N)N);rL�_imprrrrrrrr	r
rrBZimportlib._bootstraprr
rrZimportlib._bootstrap_externalrr�rrrCr%r�rr*�warn�DeprecationWarningZSEARCH_ERRORr7r8r2ZPY_RESOURCErnrorqZPY_CODERESOURCEZIMP_HOOKr"r$r(r-r0r?r@rMrZrVr`rarbrirwrHr�rprmr r r r!�<module>s^,


	

#
4sre_compile.cpython-36.opt-2.pyc000064400000022776150335715140012455 0ustar003


 \�K�@s�ddlZddlZddlTeehZeeehZ	e
ehZe
ehZdUZd$d%�eD�Zd&d'�ZdVd(d)�Zd*d+�Zejd,Zd-e>d-Zd.d/d0Zeefd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Zd=d>�Z d?d@�Z!dAdB�Z"dWdCdD�Z#dS)X�N)�*�i�1�s����E����������������������������������a�����cs.i|]&}|D]�t�fdd�|D����qqS)c3s|]}�|kr|VqdS)N�)�.0�j)�ir$�#/usr/lib64/python3.6/sre_compile.py�	<genexpr>=sz<dictcomp>.<genexpr>)�tuple)r%�tr$)r'r(�
<dictcomp>=sr,cCsr|j}t}t}t}t}t}|t@rD|t@rD|t@rD|t	@rDt
}	nd}	�x"|D�]\}
}|
|k�r|t@�rtj||�}|	r�||	kr�|t
�||�}
|d�|
tkr�|t�x&|f|	|D]}|t�||�q�W|t�||�|
||
<n|t|
�||�n||
�||�qP|
tk�r�|t@�rF|t|
�|fdd�}n||
�d}||�}
|d�t|||||	�||�|
||
<qP|
tk�r�|t@�r�|t�n|t�qP|
|k�r�|t@�r�td|
f��n�t|��rR|
tk	�rR|
tk�r�|t�n|t�||�}
|d�||d�||d�t||d|�|t �||�|
||
<nl|t�||�}
|d�||d�||d�t||d|�||�|
||
<|
tk�r�|t!�n|t"�qP|
t#k�r.|\}}}}|�r�|t$�||dd�t||||B|@�|�rj|t$�||ddd�qP|
|k�rB||
�qP|
|k�r�||
�||�}
|d�|ddk�r||d�n*|dj%�\}}||k�r�td��||�t||d|�|t �||�|
||
<qP|
t&k�r||
�||�}
|d�t|||�|t �||�|
||
<qP|
t'k�r�||
�|t(@�r@t)j*||�}|t@�rXt+j*||�}n"|t@�rz|t	@�rzt,j*||�}||�qP|
t-k�r&||
�g}|j}xZ|dD]N}||�}
|d�t|||�|t.�|||��|d�||�|
||
<�q�W|t�x|D]}||�|||<�q
WqP|
t/k�rt||
�|t@�rLt0|}n|t@�rj|t	@�rjt1|}||�qP|
t2k�r�|t@�r�|t|
�n||
�||d�qP|
t3k�r\||
�||dd�||�}|d�t||d|�|d�rF|t.�||�}|d�||�|d||<t||d|�||�|||<n||�|d||<qPtd|
f��qPWdS)	NrcSstj||�S)N)�_sre�getlower)�literal�flagsr$r$r(�fixupfsz_compile.<locals>.fixupz*internal: unsupported template operator %r��z(look-behind requires fixed-width patternz%internal: unsupported operand type %r)4�append�len�_LITERAL_CODES�_REPEATING_CODES�_SUCCESS_CODES�
_ASSERT_CODES�SRE_FLAG_IGNORECASE�SRE_FLAG_LOCALE�SRE_FLAG_UNICODE�SRE_FLAG_ASCII�_ignorecase_fixesr-r.�	IN_IGNORE�NOT_LITERAL�NEGATE�LITERAL�FAILURE�	OP_IGNORE�IN�_compile_charset�ANY�SRE_FLAG_DOTALL�ANY_ALL�SRE_FLAG_TEMPLATE�error�_simple�REPEAT�
MAX_REPEAT�
REPEAT_ONE�MIN_REPEAT_ONE�_compile�SUCCESS�	MAX_UNTIL�	MIN_UNTIL�
SUBPATTERN�MARK�getwidth�CALL�AT�SRE_FLAG_MULTILINE�AT_MULTILINE�get�	AT_LOCALE�
AT_UNICODE�BRANCH�JUMP�CATEGORY�	CH_LOCALE�
CH_UNICODE�GROUPREF�GROUPREF_EXISTS)�code�patternr0�emit�_len�
LITERAL_CODES�REPEATING_CODES�
SUCCESS_CODES�ASSERT_CODES�fixes�op�av�lo�skip�kr1�group�	add_flags�	del_flags�p�hi�tail�
tailappend�skipyes�skipnor$r$r(rQ@s.







































rQcCs�|j}x�t|||�D]�\}}||�|tkr.q|tkr@||�q|tksP|tkrj||d�||d�q|tkr~|j|�q|tkr�|j|�q|t	kr�|t
@r�|t|�q�|t@r�|t
@r�|t|�q�||�qtd|f��qW|t�dS)Nrr2z%internal: unsupported set operator %r)r4�_optimize_charsetrArB�RANGE�RANGE_IGNORE�CHARSET�extend�
BIGCHARSETrar;rbr<r=rcrKrC)�charsetr0rfr1rnrhrorpr$r$r(rF�s,

rFcCsdg}g}td�}�xt|D�]j\}}�x^�y|tkrx|rn||�}d||<|rv||krvx"||D]}	d||	<q\Wnd||<n�|tkr�t|d|dd�}
|r�t||
�}
|r�|r�xN|
D].}d||<||kr�x||D]}	d||	<q�Wq�Wnx>|
D]}d||<q�Wn(|tk�r|j||f�n|j||f�WnTtk
�r|t|�dk�rV|dd7}w&|�rj|tk�rjt	}|j||f�YnXPq&WqWg}d}
xj|j
d|
�}|dk�r�Pt|�dk�r�d}P|j
d|�}
|
dk�r�|j|t|�f�P|j||
f��q�W|dk	�rvxF|D]>\}}
|
|dk�r2|jt|f�n|jt||
dff��qW||7}|�snt|�t|�k�rr|S|St|�dk�r�t|�}|jt|f�||7}|St
|�}i}td�}d}t�}xftddd�D]V}|||d�}||k�r||||d<n$|||d<||<|d7}||7}�q�Wt|�}|gt|�|dd�<|jt|f�||7}|S)N�r2r�i�r3i)�	bytearrayrBr~�range�maprAr4�
IndexErrorr5r�find�
_mk_bitmapr��bytes�_bytes_to_codesr�)r�r1rn�outry�charmaprorprqrs�rr'�runs�qrw�data�comps�mapping�block�chunkr$r$r(r}�s�









r}�r2�0�1�cs8|jt�ddd�����fdd�tt��d��D�S)Nr2cs"g|]}��|�|�d��qS)r3r$)r%r')�	_CODEBITS�_int�sr$r(�
<listcomp>zsz_mk_bitmap.<locals>.<listcomp>r���)�	translate�_BITS_TRANSr�r5)�bitsr�r�r$)r�r�r�r(r�xsr�cCst|�jd�}|j�S)N�I)�
memoryview�cast�tolist)�b�ar$r$r(r�}sr�cCs<|dj�\}}||ko"dkno:|dddtkS)Nr3r2r)rWrU)rprqrxr$r$r(rL�srLcCsvdgt|�}xbtdt|��D]P}||d}x>||||kr`|dkrRd||<P||d}q0W|d||<qW|S)Nrr2)r5r�)�prefix�tabler'�idxr$r$r(�_generate_overlap_table�s	r�c
Cs�g}|j}d}x�|jD]�\}}|tkr0||�q|tkr�|\}}}}	|t@rNPt|	�\}
}}|dkr�|dk	rvt|�}n|dk	r�t|�|}|j|
�|s�PqPqW||dfS||dfS)NTF)r4r�rBrUr:�_get_literal_prefixr5r�)
rgr��prefixappend�prefix_skiprorprtrurvrw�prefix1�prefix_skip1�got_allr$r$r(r��s,



r�cCs"g}|j}|j�r|jd\}}|tkr�|\}}}}|r�|t@r�|d\}}|tkrd|||f�nR|tkr�g}	|	j}
x�|dD].}|s�P|d\}}|tkr�|
||f�q�Pq�W|	}nf|tk�rg}	|	j}
xP|dD]0}|s�P|d\}}|tk�r|
||f�q�Pq�W|	}n|tk�r|}|S)Nrr2)r4r�rUr:rBr_rE)rgr��
charsetappendrorprtrurvrw�c�cappendr$r$r(�_get_charset_prefix�sF


r�cCsZ|j�\}}|tkrt}|dkr8|jtdd||g�dSg}d}g}|t@sft|�\}}}|sft|�}|j}	|	t�t|�}
|	d�d}|r�t	}|dkr�|r�|t
B}n|r�|tB}|	|�|tkr�|	|�n|	t�|dt�}|	t|t��|�r4|	t|��|dk�rt|�}|	|�|j|�|jt
|��n|�rFt|||�t|�|
||
<dS)Nr�)rW�MAXCODEr��INFOr:r�r�r4r5�SRE_INFO_PREFIX�SRE_INFO_LITERAL�SRE_INFO_CHARSET�minr�rF)rfrgr0rqrxr�r�r�r�rhrr�maskr$r$r(�
_compile_info�sP



r�cCst|ttf�S)N)�
isinstance�strr�)�objr$r$r(�isstringsr�cCs8|jj|B}g}t|||�t||j|�|jt�|S)N)rgr0r�rQr�r4rR)rwr0rfr$r$r(�_codes
r�cCs�t|�r|}tj||�}nd}t||�}|jj}dg|jj}x|j�D]\}}|||<qHWtj	|||jj
B||jjd||�S)Nr2)r��	sre_parse�parser�rg�	groupdict�groups�itemsr-�compiler0)rwr0rgrf�
groupindex�
indexgrouprsr'r$r$r(r�-s

r��rr�rr�rr�r	r
r�rr
�rr�rr�rr�rr�rr�rr�rr�rr�rr�r r!�r"r#)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�)NN)r)$r-r��
sre_constantsrBr@r6rM�
MIN_REPEATrNr7rRrCr8�ASSERT�
ASSERT_NOTr9�
_equivalencesr>rQrFr}�CODESIZEr�r�r��intr�r�rLr�r�r�r�r�r�r�r$r$r$r(�<module>
sR
 
{
)9sched.cpython-36.pyc000064400000014646150335715140010277 0ustar003


 \o�@s�dZddlZddlZddlmZyddlZWnek
rHddlZYnXddlmZ	dgZ
Gdd�dedd��Zd	ej_d
ej_dej
_dej_d
ej_e�ZGdd�d�ZdS)a�A generally useful event scheduler class.

Each instance of this class manages its own queue.
No multi-threading is implied; you are supposed to hack that
yourself, or use a single instance per application.

Each instance is parametrized with two functions, one that is
supposed to return the current time, one that is supposed to
implement a delay.  You can implement real-time scheduling by
substituting time and sleep from built-in module time, or you can
implement simulated time by writing your own functions.  This can
also be used to integrate scheduling with STDWIN events; the delay
function is allowed to modify the queue.  Time can be expressed as
integers or floating point numbers, as long as it is consistent.

Events are specified by tuples (time, priority, action, argument, kwargs).
As in UNIX, lower priority numbers mean higher priority; in this
way the queue can be maintained as a priority queue.  Execution of the
event means calling the action function, passing it the argument
sequence in "argument" (remember that in Python, multiple function
arguments are be packed in a sequence) and keyword parameters in "kwargs".
The action function may be an instance method so it
has another way to reference private data (besides global variables).
�N)�
namedtuple)�	monotonic�	schedulerc@s8eZdZgZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�EventcCs|j|jf|j|jfkS)N)�time�priority)�s�o�r
�/usr/lib64/python3.6/sched.py�__eq__'szEvent.__eq__cCs|j|jf|j|jfkS)N)rr)rr	r
r
r�__lt__(szEvent.__lt__cCs|j|jf|j|jfkS)N)rr)rr	r
r
r�__le__)szEvent.__le__cCs|j|jf|j|jfkS)N)rr)rr	r
r
r�__gt__*szEvent.__gt__cCs|j|jf|j|jfkS)N)rr)rr	r
r
r�__ge__+szEvent.__ge__N)	�__name__�
__module__�__qualname__�	__slots__rr
rrrr
r
r
rr%srz(time, priority, action, argument, kwargszaNumeric type compatible with the return value of the
timefunc function passed to the constructor.zSEvents scheduled for the same time will be executed
in the order of their priority.z?Executing the event means executing
action(*argument, **kwargs)zGargument is a sequence holding the positional
arguments for the action.zDkwargs is a dictionary holding the keyword
arguments for the action.c@s^eZdZeejfdd�Zfefdd�Zfefdd�Z	dd�Z
d	d
�Zddd
�Ze
dd��ZdS)rcCs g|_tj�|_||_||_dS)zGInitialize a new instance, passing the time and delay
        functionsN)�_queue�	threading�RLock�_lock�timefunc�	delayfunc)�selfrrr
r
r�__init__<s
zscheduler.__init__c
Cs@|tkri}t|||||�}|j�tj|j|�WdQRX|S)z�Enter a new event in the queue at an absolute time.

        Returns an ID for the event which can be used to remove it,
        if necessary.

        N)�	_sentinelrr�heapq�heappushr)rrr�action�argument�kwargs�eventr
r
r�enterabsDszscheduler.enterabscCs|j�|}|j|||||�S)z{A variant that specifies the time as a relative time.

        This is actually the more commonly used interface.

        )rr$)r�delayrr r!r"rr
r
r�enterRszscheduler.enterc	Cs.|j�|jj|�tj|j�WdQRXdS)z�Remove an event from the queue.

        This must be presented the ID as returned by enter().
        If the event is not in the queue, this raises ValueError.

        N)rr�remover�heapify)rr#r
r
r�cancel[szscheduler.cancelc	Cs|j�
|jSQRXdS)z!Check whether the queue is empty.N)rr)rr
r
r�emptyfszscheduler.emptyTcCs�|j}|j}|j}|j}tj}x||�>|s,P|d\}}}	}
}|�}||krRd}
nd}
||�WdQRX|
r�|sx||S|||�q |	|
|�|d�q WdS)aExecute events until the queue is empty.
        If blocking is False executes the scheduled events due to
        expire soonest (if any) and then return the deadline of the
        next scheduled call in the scheduler.

        When there is a positive delay until the first event, the
        delay function is called and the event is left in the queue;
        otherwise, the event is removed from the queue and executed
        (its action function is called, passing it the argument).  If
        the delay function returns prematurely, it is simply
        restarted.

        It is legal for both the delay function and the action
        function to modify the queue or to raise an exception;
        exceptions are not caught but the scheduler's state remains
        well-defined so run() may be called again.

        A questionable hack is added to allow other threads to run:
        just after an event is executed, a delay of 0 is executed, to
        avoid monopolizing the CPU when other threads are also
        runnable.

        rTFN)rrrrr�heappop)rZblocking�lock�qrr�poprrr r!r"Znowr%r
r
r�runks*
z
scheduler.runc
Cs:|j�|jdd�}WdQRXtttj|gt|���S)z�An ordered list of upcoming events.

        Events are named tuples with fields for:
            time, priority, action, arguments, kwargs

        N)rr�list�maprr+�len)rZeventsr
r
r�queue�szscheduler.queueN)T)rrr�_timerZsleeprrr$r&r)r*r/�propertyr3r
r
r
rr:s	
2)�__doc__rr�collectionsrr�ImportErrorZdummy_threadingrr4�__all__rrr r!r"�objectrrr
r
r
r�<module>s"	_collections_abc.cpython-36.pyc000064400000070177150335715140012474 0ustar003


 \g�@srdZddlmZmZddlZdddddd	d
ddd
dddddddddddddddgZdZeed��Z	eee
���Zeeij���Z
eeij���Zeeij���Zeeg��Zeeeg���Zeeed���Zeeedd >���Zeee���Zeed!��Zeef��Zeee���Zeij��Zeij��Zeij��Z eej!�Z"ed"d#���Z#d$d%�Z$e$�Z$ee$�Z%e$j&�[$d&d'�Z'e'�Z'ee'�Z(['d(d)�Z)Gd*d	�d	ed+�Z*Gd,d�ded+�Z+Gd-d�de+�Z,e,j-e%�Gd.d�ded+�Z.Gd/d�de.�Z/Gd0d�de/�Z0e0j-e(�Gd1d
�d
ed+�Z1Gd2d�de1�Z2e2j-e	�e2j-e�e2j-e
�e2j-e�e2j-e�e2j-e�e2j-e�e2j-e�e2j-e�e2j-e�e2j-e�e2j-e�e2j-e�Gd3d
�d
e1�Z3Gd4d�de2�Z4e4j-e#�Gd5d�ded+�Z5Gd6d�ded+�Z6Gd7d�de5e1e6�Z7Gd8d�ded+�Z8Gd9d�de7�Z9e9j-e:�Gd:d�de9�Z;e;j-e�Gd;d�de7�Z<e<j-e"�Gd<d�de5�Z=Gd=d�de=e9�Z>e>j-e�Gd>d�de=e9�Z?e?j-e �Gd?d�de=�Z@e@j-e�Gd@d�de<�ZAeAj-eB�GdAd�de3e7�ZCeCj-eD�eCj-eE�eCj-e�eCj-eF�GdBd�deC�ZGeGj-eH�eGj-e
�GdCd�deC�ZIeIj-eJ�eIj-e
�dS)DzjAbstract Base Classes (ABCs) for collections, according to PEP 3119.

Unit tests are in test_collections.
�)�ABCMeta�abstractmethodN�	Awaitable�	Coroutine�
AsyncIterable�
AsyncIterator�AsyncGenerator�Hashable�Iterable�Iterator�	Generator�
Reversible�Sized�	Container�Callable�
Collection�Set�
MutableSet�Mapping�MutableMapping�MappingView�KeysView�	ItemsView�
ValuesView�Sequence�MutableSequence�
ByteStringzcollections.abc��i��ccsdVS)N�r r r �(/usr/lib64/python3.6/_collections_abc.py�<lambda>8sr"c�sdS)Nr r r r r!�_coro:sr#cCs
dVdS)Nr r r r r!�_ag@sr$cGsH|j}x<|D]4}x.|D]"}||jkr|j|dkr6tSPqWtSqWdS)NT)�__mro__�__dict__�NotImplemented)�C�methods�mro�method�Br r r!�_check_methodsHs


r-c@s(eZdZfZedd��Zedd��ZdS)r	cCsdS)Nrr )�selfr r r!�__hash__XszHashable.__hash__cCs|tkrt|d�StS)Nr/)r	r-r')�clsr(r r r!�__subclasshook__\s
zHashable.__subclasshook__N)�__name__�
__module__�__qualname__�	__slots__rr/�classmethodr1r r r r!r	Ts)�	metaclassc@s(eZdZfZedd��Zedd��ZdS)rccs
dVdS)Nr )r.r r r!�	__await__gszAwaitable.__await__cCs|tkrt|d�StS)Nr8)rr-r')r0r(r r r!r1ks
zAwaitable.__subclasshook__N)r2r3r4r5rr8r6r1r r r r!rcsc@s>eZdZfZedd��Zed
dd��Zdd�Zedd	��Z	dS)rcCst�dS)zcSend a value into the coroutine.
        Return next yielded value or raise StopIteration.
        N)�
StopIteration)r.�valuer r r!�sendvszCoroutine.sendNcCs4|dkr|dkr|�|�}|dk	r,|j|�}|�dS)zgRaise an exception in the coroutine.
        Return next yielded value or raise StopIteration.
        N)�with_traceback)r.�typ�val�tbr r r!�throw}s
zCoroutine.throwcCs4y|jt�Wnttfk
r&Yn
Xtd��dS)z.Raise GeneratorExit inside coroutine.
        zcoroutine ignored GeneratorExitN)r@�
GeneratorExitr9�RuntimeError)r.r r r!�close�s
zCoroutine.closecCs|tkrt|dddd�StS)Nr8r;r@rC)rr-r')r0r(r r r!r1�szCoroutine.__subclasshook__)NN)
r2r3r4r5rr;r@rCr6r1r r r r!rrs
c@s(eZdZfZedd��Zedd��ZdS)rcCst�S)N)r)r.r r r!�	__aiter__�szAsyncIterable.__aiter__cCs|tkrt|d�StS)NrD)rr-r')r0r(r r r!r1�s
zAsyncIterable.__subclasshook__N)r2r3r4r5rrDr6r1r r r r!r�sc@s0eZdZfZedd��Zdd�Zedd��ZdS)rc�st�dS)z@Return the next item or raise StopAsyncIteration when exhausted.N)�StopAsyncIteration)r.r r r!�	__anext__�szAsyncIterator.__anext__cCs|S)Nr )r.r r r!rD�szAsyncIterator.__aiter__cCs|tkrt|dd�StS)NrFrD)rr-r')r0r(r r r!r1�szAsyncIterator.__subclasshook__N)	r2r3r4r5rrFrDr6r1r r r r!r�sc@sFeZdZfZdd�Zedd��Zeddd��Zdd	�Ze	d
d��Z
dS)
rc�s|jd�IdHS)zpReturn the next item from the asynchronous generator.
        When exhausted, raise StopAsyncIteration.
        N)�asend)r.r r r!rF�szAsyncGenerator.__anext__c�st�dS)zuSend a value into the asynchronous generator.
        Return next yielded value or raise StopAsyncIteration.
        N)rE)r.r:r r r!rG�szAsyncGenerator.asendNc�s4|dkr|dkr|�|�}|dk	r,|j|�}|�dS)zyRaise an exception in the asynchronous generator.
        Return next yielded value or raise StopAsyncIteration.
        N)r<)r.r=r>r?r r r!�athrow�s
zAsyncGenerator.athrowc�s:y|jt�IdHWnttfk
r,Yn
Xtd��dS)z.Raise GeneratorExit inside coroutine.
        Nz,asynchronous generator ignored GeneratorExit)rHrArErB)r.r r r!�aclose�s
zAsyncGenerator.aclosecCs|tkrt|ddddd�StS)NrDrFrGrHrI)rr-r')r0r(r r r!r1�s
zAsyncGenerator.__subclasshook__)NN)r2r3r4r5rFrrGrHrIr6r1r r r r!r�s
c@s(eZdZfZedd��Zedd��ZdS)r
ccsdS)Nr )r.r r r!�__iter__�szIterable.__iter__cCs|tkrt|d�StS)NrJ)r
r-r')r0r(r r r!r1�s
zIterable.__subclasshook__N)r2r3r4r5rrJr6r1r r r r!r
�sc@s0eZdZfZedd��Zdd�Zedd��ZdS)rcCst�dS)zKReturn the next item from the iterator. When exhausted, raise StopIterationN)r9)r.r r r!�__next__szIterator.__next__cCs|S)Nr )r.r r r!rJszIterator.__iter__cCs|tkrt|dd�StS)NrJrK)rr-r')r0r(r r r!r1szIterator.__subclasshook__N)	r2r3r4r5rrKrJr6r1r r r r!rsc@s(eZdZfZedd��Zedd��ZdS)r
ccsdS)Nr )r.r r r!�__reversed__)szReversible.__reversed__cCs|tkrt|dd�StS)NrLrJ)r
r-r')r0r(r r r!r1.szReversible.__subclasshook__N)r2r3r4r5rrLr6r1r r r r!r
%sc@sFeZdZfZdd�Zedd��Zeddd��Zdd	�Ze	d
d��Z
dS)
rcCs
|jd�S)z^Return the next item from the generator.
        When exhausted, raise StopIteration.
        N)r;)r.r r r!rK9szGenerator.__next__cCst�dS)zcSend a value into the generator.
        Return next yielded value or raise StopIteration.
        N)r9)r.r:r r r!r;?szGenerator.sendNcCs4|dkr|dkr|�|�}|dk	r,|j|�}|�dS)zgRaise an exception in the generator.
        Return next yielded value or raise StopIteration.
        N)r<)r.r=r>r?r r r!r@Fs
zGenerator.throwcCs4y|jt�Wnttfk
r&Yn
Xtd��dS)z.Raise GeneratorExit inside generator.
        zgenerator ignored GeneratorExitN)r@rAr9rB)r.r r r!rCSs
zGenerator.closecCs|tkrt|ddddd�StS)NrJrKr;r@rC)rr-r')r0r(r r r!r1]s
zGenerator.__subclasshook__)NN)r2r3r4r5rKrr;r@rCr6r1r r r r!r5s
c@s(eZdZfZedd��Zedd��ZdS)rcCsdS)Nrr )r.r r r!�__len__ksz
Sized.__len__cCs|tkrt|d�StS)NrM)rr-r')r0r(r r r!r1os
zSized.__subclasshook__N)r2r3r4r5rrMr6r1r r r r!rgsc@s(eZdZfZedd��Zedd��ZdS)rcCsdS)NFr )r.�xr r r!�__contains__zszContainer.__contains__cCs|tkrt|d�StS)NrO)rr-r')r0r(r r r!r1~s
zContainer.__subclasshook__N)r2r3r4r5rrOr6r1r r r r!rvsc@seZdZfZedd��ZdS)rcCs|tkrt|ddd�StS)NrMrJrO)rr-r')r0r(r r r!r1�szCollection.__subclasshook__N)r2r3r4r5r6r1r r r r!r�sc@s(eZdZfZedd��Zedd��ZdS)rcOsdS)NFr )r.�args�kwdsr r r!�__call__�szCallable.__call__cCs|tkrt|d�StS)NrR)rr-r')r0r(r r r!r1�s
zCallable.__subclasshook__N)r2r3r4r5rrRr6r1r r r r!r�sc@s�eZdZdZfZdd�Zdd�Zdd�Zdd	�Zd
d�Z	e
dd
��Zdd�ZeZ
dd�Zdd�ZeZdd�Zdd�Zdd�ZeZdd�ZdS)raZA set is a finite, iterable container.

    This class provides concrete generic implementations of all
    methods except for __contains__, __iter__ and __len__.

    To override the comparisons (presumably for speed, as the
    semantics are fixed), redefine __le__ and __ge__,
    then the other operations will automatically follow suit.
    cCs@t|t�stSt|�t|�kr"dSx|D]}||kr(dSq(WdS)NFT)�
isinstancerr'�len)r.�other�elemr r r!�__le__�s

z
Set.__le__cCs(t|t�stSt|�t|�ko&|j|�S)N)rSrr'rTrW)r.rUr r r!�__lt__�s
z
Set.__lt__cCs(t|t�stSt|�t|�ko&|j|�S)N)rSrr'rT�__ge__)r.rUr r r!�__gt__�s
z
Set.__gt__cCs@t|t�stSt|�t|�kr"dSx|D]}||kr(dSq(WdS)NFT)rSrr'rT)r.rUrVr r r!rY�s

z
Set.__ge__cCs(t|t�stSt|�t|�ko&|j|�S)N)rSrr'rTrW)r.rUr r r!�__eq__�s
z
Set.__eq__cCs||�S)z�Construct an instance of the class from any iterable input.

        Must override this method if the class constructor signature
        does not accept an iterable for an input.
        r )r0�itr r r!�_from_iterable�szSet._from_iterablecs&t|t�stS�j�fdd�|D��S)Nc3s|]}|�kr|VqdS)Nr )�.0r:)r.r r!�	<genexpr>�szSet.__and__.<locals>.<genexpr>)rSr
r'r])r.rUr )r.r!�__and__�s
zSet.__and__cCsx|D]}||krdSqWdS)z1Return True if two sets have a null intersection.FTr )r.rUr:r r r!�
isdisjoint�s
zSet.isdisjointcCs*t|t�stSdd�||fD�}|j|�S)Ncss|]}|D]
}|Vq
qdS)Nr )r^�s�er r r!r_�szSet.__or__.<locals>.<genexpr>)rSr
r'r])r.rU�chainr r r!�__or__�s
z
Set.__or__cs:t�t�s"t�t�stS|j���|j�fdd�|D��S)Nc3s|]}|�kr|VqdS)Nr )r^r:)rUr r!r_�szSet.__sub__.<locals>.<genexpr>)rSrr
r'r])r.rUr )rUr!�__sub__�s



zSet.__sub__cs:t|t�s"t|t�stS�j|�}�j�fdd�|D��S)Nc3s|]}|�kr|VqdS)Nr )r^r:)r.r r!r_�szSet.__rsub__.<locals>.<genexpr>)rSrr
r'r])r.rUr )r.r!�__rsub__�s



zSet.__rsub__cCs2t|t�s"t|t�stS|j|�}||||BS)N)rSrr
r'r])r.rUr r r!�__xor__s



zSet.__xor__cCs�tj}d|d}t|�}d|d}||M}x4|D],}t|�}|||d>AdAdN}||M}q4W|dd}||M}||kr�||d8}|d
kr�d	}|S)a+Compute the hash value of a set.

        Note that we don't define __hash__: not all sets are hashable.
        But if you define a hashable set type, its __hash__ should
        call this function.

        This must be compatible __eq__.

        All sets ought to compare equal if they contain the same
        elements, regardless of how they are implemented, and
        regardless of the order of the elements; so there's not much
        freedom for __eq__ or __hash__.  We match the algorithm used
        by the built-in frozenset type.
        �riM��r�i�M[l�4~2i�
i��6i��8#���)�sys�maxsizerT�hash)r.�MAX�MASK�n�hrN�hxr r r!�_hash	s 
z	Set._hashN)r2r3r4�__doc__r5rWrXrZrYr[r6r]r`�__rand__rare�__ror__rfrgrh�__rxor__rtr r r r!r�s$


	c@sdeZdZdZfZedd��Zedd��Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�ZdS)ra�A mutable set is a finite, iterable container.

    This class provides concrete generic implementations of all
    methods except for __contains__, __iter__, __len__,
    add(), and discard().

    To override the comparisons (presumably for speed, as the
    semantics are fixed), all you have to do is redefine __le__ and
    then the other operations will automatically follow suit.
    cCst�dS)zAdd an element.N)�NotImplementedError)r.r:r r r!�add:szMutableSet.addcCst�dS)z8Remove an element.  Do not raise an exception if absent.N)ry)r.r:r r r!�discard?szMutableSet.discardcCs||krt|��|j|�dS)z5Remove an element. If not a member, raise a KeyError.N)�KeyErrorr{)r.r:r r r!�removeDszMutableSet.removecCs<t|�}yt|�}Wntk
r,t�YnX|j|�|S)z2Return the popped value.  Raise KeyError if empty.)�iter�nextr9r|r{)r.r\r:r r r!�popJs

zMutableSet.popcCs,yx|j�qWWntk
r&YnXdS)z6This is slow (creates N new iterators!) but effective.N)r�r|)r.r r r!�clearTs
zMutableSet.clearcCsx|D]}|j|�qW|S)N)rz)r.r\r:r r r!�__ior__\s
zMutableSet.__ior__cCs x||D]}|j|�q
W|S)N)r{)r.r\r:r r r!�__iand__aszMutableSet.__iand__cCsV||kr|j�n@t|t�s&|j|�}x*|D]"}||krD|j|�q,|j|�q,W|S)N)r�rSrr]r{rz)r.r\r:r r r!�__ixor__fs



zMutableSet.__ixor__cCs.||kr|j�nx|D]}|j|�qW|S)N)r�r{)r.r\r:r r r!�__isub__ss


zMutableSet.__isub__N)r2r3r4rur5rrzr{r}r�r�r�r�r�r�r r r r!r,s


c@sReZdZfZedd��Zddd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZdZdS)rcCst�dS)N)r|)r.�keyr r r!�__getitem__�szMapping.__getitem__NcCs"y||Stk
r|SXdS)z<D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.N)r|)r.r��defaultr r r!�get�szMapping.getcCs*y||Wntk
r dSXdSdS)NFT)r|)r.r�r r r!rO�s
zMapping.__contains__cCst|�S)z:D.keys() -> a set-like object providing a view on D's keys)r)r.r r r!�keys�szMapping.keyscCst|�S)z<D.items() -> a set-like object providing a view on D's items)r)r.r r r!�items�sz
Mapping.itemscCst|�S)z6D.values() -> an object providing a view on D's values)r)r.r r r!�values�szMapping.valuescCs&t|t�stSt|j��t|j��kS)N)rSrr'�dictr�)r.rUr r r!r[�s
zMapping.__eq__)N)
r2r3r4r5rr�r�rOr�r�r�r[rLr r r r!r�s

c@s(eZdZd	Zdd�Zdd�Zdd�ZdS)
r�_mappingcCs
||_dS)N)r�)r.�mappingr r r!�__init__�szMappingView.__init__cCs
t|j�S)N)rTr�)r.r r r!rM�szMappingView.__len__cCs
dj|�S)Nz&{0.__class__.__name__}({0._mapping!r}))�format)r.r r r!�__repr__�szMappingView.__repr__N)r�)r2r3r4r5r�rMr�r r r r!r�sc@s,eZdZfZedd��Zdd�Zdd�ZdS)rcCst|�S)N)�set)r.r\r r r!r]�szKeysView._from_iterablecCs
||jkS)N)r�)r.r�r r r!rO�szKeysView.__contains__ccs|jEdHdS)N)r�)r.r r r!rJ�szKeysView.__iter__N)r2r3r4r5r6r]rOrJr r r r!r�sc@s,eZdZfZedd��Zdd�Zdd�ZdS)rcCst|�S)N)r�)r.r\r r r!r]�szItemsView._from_iterablecCs@|\}}y|j|}Wntk
r*dSX||kp:||kSdS)NF)r�r|)r.�itemr�r:�vr r r!rO�szItemsView.__contains__ccs$x|jD]}||j|fVqWdS)N)r�)r.r�r r r!rJ�szItemsView.__iter__N)r2r3r4r5r6r]rOrJr r r r!r�s	c@s eZdZfZdd�Zdd�ZdS)rcCs2x,|jD]"}|j|}||ks&||krdSqWdS)NTF)r�)r.r:r�r�r r r!rO�s

zValuesView.__contains__ccs x|jD]}|j|VqWdS)N)r�)r.r�r r r!rJ�szValuesView.__iter__N)r2r3r4r5rOrJr r r r!r�sc@s\eZdZfZedd��Zedd��Ze�Zefdd�Z	dd�Z
d	d
�Zdd�Zddd�Z
d
S)rcCst�dS)N)r|)r.r�r:r r r!�__setitem__szMutableMapping.__setitem__cCst�dS)N)r|)r.r�r r r!�__delitem__szMutableMapping.__delitem__cCs<y||}Wn tk
r,||jkr(�|SX||=|SdS)z�D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
          If key is not found, d is returned if given, otherwise KeyError is raised.
        N)r|�_MutableMapping__marker)r.r�r�r:r r r!r�s
zMutableMapping.popcCs@ytt|��}Wntk
r(t�YnX||}||=||fS)z�D.popitem() -> (k, v), remove and return some (key, value) pair
           as a 2-tuple; but raise KeyError if D is empty.
        )rr~r9r|)r.r�r:r r r!�popitem$s
zMutableMapping.popitemcCs,yx|j�qWWntk
r&YnXdS)z,D.clear() -> None.  Remove all items from D.N)r�r|)r.r r r!r�0s
zMutableMapping.clearcOs�|std��|^}}t|�dkr0tdt|���|r�|d}t|t�rbx^|D]}||||<qLWnDt|d�r�x8|j�D]}||||<qvWnx|D]\}}|||<q�Wx|j�D]\}}|||<q�WdS)aK D.update([E, ]**F) -> None.  Update D from mapping/iterable E and F.
            If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
            If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
            In either case, this is followed by: for k, v in F.items(): D[k] = v
        z@descriptor 'update' of 'MutableMapping' object needs an argumentrz+update expected at most 1 arguments, got %drr�N)�	TypeErrorrTrSr�hasattrr�r�)rPrQr.rUr�r:r r r!�update8s$


zMutableMapping.updateNcCs*y||Stk
r$|||<YnX|S)z@D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D)r|)r.r�r�r r r!�
setdefaultSs
zMutableMapping.setdefault)N)r2r3r4r5rr�r��objectr�r�r�r�r�r�r r r r!r�sc@sJeZdZdZfZedd��Zdd�Zdd�Zdd	�Z	ddd
�Z
dd�ZdS)rz�All the operations on a read-only sequence.

    Concrete subclasses must override __new__ or __init__,
    __getitem__, and __len__.
    cCst�dS)N)�
IndexError)r.�indexr r r!r�kszSequence.__getitem__ccs>d}y x||}|V|d7}qWWntk
r8dSXdS)Nrr)r�)r.�ir�r r r!rJoszSequence.__iter__cCs&x |D]}||ks||krdSqWdS)NTFr )r.r:r�r r r!rOys
zSequence.__contains__ccs(x"ttt|���D]}||VqWdS)N)�reversed�rangerT)r.r�r r r!rLszSequence.__reversed__rNcCs�|dk	r"|dkr"tt|�|d�}|dk	r>|dkr>|t|�7}|}xT|dksT||kr�y ||}||ksn||krr|SWntk
r�PYnX|d7}qDWt�dS)z�S.index(value, [start, [stop]]) -> integer -- return first index of value.
           Raises ValueError if the value is not present.

           Supporting start and stop arguments is optional, but
           recommended.
        Nrr)�maxrTr��
ValueError)r.r:�start�stopr�r�r r r!r��szSequence.indexcst�fdd�|D��S)zBS.count(value) -> integer -- return number of occurrences of valuec3s"|]}|�ks|�krdVqdS)rNr )r^r�)r:r r!r_�sz!Sequence.count.<locals>.<genexpr>)�sum)r.r:r )r:r!�count�szSequence.count)rN)r2r3r4rur5rr�rJrOrLr�r�r r r r!ras

c@seZdZdZfZdS)rzMThis unifies bytes and bytearray.

    XXX Should add all their methods.
    N)r2r3r4rur5r r r r!r�sc@sneZdZfZedd��Zedd��Zedd��Zdd�Zd	d
�Z	dd�Z
d
d�Zddd�Zdd�Z
dd�ZdS)rcCst�dS)N)r�)r.r�r:r r r!r��szMutableSequence.__setitem__cCst�dS)N)r�)r.r�r r r!r��szMutableSequence.__delitem__cCst�dS)z3S.insert(index, value) -- insert value before indexN)r�)r.r�r:r r r!�insert�szMutableSequence.insertcCs|jt|�|�dS)z:S.append(value) -- append value to the end of the sequenceN)r�rT)r.r:r r r!�append�szMutableSequence.appendcCs,yx|j�qWWntk
r&YnXdS)z,S.clear() -> None -- remove all items from SN)r�r�)r.r r r!r��s
zMutableSequence.clearcCsLt|�}x>t|d�D].}|||d||||<|||d<qWdS)z!S.reverse() -- reverse *IN PLACE*rirN)rTr�)r.rqr�r r r!�reverse�szMutableSequence.reversecCsx|D]}|j|�qWdS)zMS.extend(iterable) -- extend sequence by appending elements from the iterableN)r�)r.r�r�r r r!�extend�s
zMutableSequence.extendrcCs||}||=|S)z�S.pop([index]) -> item -- remove and return item at index (default last).
           Raise IndexError if list is empty or index is out of range.
        r )r.r�r�r r r!r��szMutableSequence.popcCs||j|�=dS)zvS.remove(value) -- remove first occurrence of value.
           Raise ValueError if the value is not present.
        N)r�)r.r:r r r!r}�szMutableSequence.removecCs|j|�|S)N)r�)r.r�r r r!�__iadd__�s
zMutableSequence.__iadd__Nrk)rk)r2r3r4r5rr�r�r�r�r�r�r�r�r}r�r r r r!r�s	
)Kru�abcrrrl�__all__r2�typer~�bytes_iterator�	bytearray�bytearray_iteratorr��dict_keyiteratorr��dict_valueiteratorr��dict_itemiterator�
list_iteratorr��list_reverseiteratorr��range_iterator�longrange_iteratorr��set_iterator�str_iterator�tuple_iterator�zip�zip_iterator�	dict_keys�dict_values�
dict_itemsr&�mappingproxy�	generatorr#�	coroutinerCr$�async_generatorr-r	rr�registerrrrr
rr
rrrrrr�	frozensetrrrrrrrr�r�tuple�str�
memoryviewr�bytesr�listr r r r!�<module>s�
	
)
0













/



O
2



\
=



	

A
signal.cpython-36.pyc000064400000004725150335715140010463 0ustar003


 \K�@s
ddlZddlTddlmZddlmZe�Zej	de
dd��ej	de
d	d��d
ekrlej	de
dd��d
d�Zdd�Zeej
�dd��Z
eej�dd��Zd
ekr�eej�dd
��Zejje_dekr�eej�dd��Zdek�reej�dd��Zeje_[[dS)�N)�*)�wraps)�IntEnum�SignalscCs(|j�r|jd�r|jd�p&|jd�S)NZSIGZSIG_ZCTRL_)�isupper�
startswith)�name�r	�/usr/lib64/python3.6/signal.py�<lambda>
sr�HandlerscCs|dkS)N�SIG_DFL�SIG_IGN)r
rr	)rr	r	r
rs�pthread_sigmaskZSigmaskscCs|dkS)N�	SIG_BLOCK�SIG_UNBLOCK�SIG_SETMASK)rrrr	)rr	r	r
rscCs"y||�Stk
r|SXdS)zsConvert a numeric value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    N)�
ValueError)�valueZ
enum_klassr	r	r
�_int_to_enumsrcCs&yt|�Sttfk
r |SXdS)zmConvert an IntEnum member to a numeric value.
    If it's not an IntEnum member return the value itself.
    N)�intr�	TypeError)rr	r	r
�_enum_to_int#srcCstjt|�t|��}t|t�S)N)�_signal�signalrrr)�	signalnum�handlerr	r	r
r-srcCstj|�}t|t�S)N)r�	getsignalrr)rrr	r	r
r3s
rcCstj||�}tdd�|D��S)Ncss|]}t|t�VqdS)N)rr)�.0�xr	r	r
�	<genexpr>=sz"pthread_sigmask.<locals>.<genexpr>)rr�set)Zhow�maskZsigs_setr	r	r
r:s�
sigpendingcCstj�}tdd�|D��S)Ncss|]}t|t�VqdS)N)rr)rrr	r	r
r Eszsigpending.<locals>.<genexpr>)rr#r!)Zsigsr	r	r
r#Bs�sigwaitcCstj|�}t|t�S)N)rr$rr)ZsigsetZretsigr	r	r
r$Is
)r�	functoolsrZ_wraps�enumrZ_IntEnum�globalsZ_globals�_convert�__name__rrrrr�__doc__r#r$r	r	r	r
�<module>s6






timeit.cpython-36.opt-2.pyc000064400000012770150335715140011440 0ustar003


 \4�@s�ddlZddlZddlZddlZddddgZdZdZdZejZ	e
Zd	Zd
d�Z
Gdd�d�Zd
d
e	edfdd�Zd
d
e	eedfdd�Zddd�dd�Zedkr�eje��dS)�N�Timer�timeit�repeat�
default_timerz<timeit-src>i@B�z�
def inner(_it, _timer{init}):
    {setup}
    _t0 = _timer()
    for _i in _it:
        {stmt}
    _t1 = _timer()
    return _t1 - _t0
cCs|jddd|�S)N�
� )�replace)�src�indent�r�/usr/lib64/python3.6/timeit.py�reindentPsrc@sLeZdZddedfdd�Zd
dd�Zefdd�Zeefd	d
�Z	ddd�Z
dS)r�passNcCs�||_i}|dkrt�n|}d}t|t�rJt|td�|d}t|d�}n*t|�rl||d<|d7}d}d}ntd��t|t�r�t||td�t|d	�}n&t|�r�||d
<|d7}d}ntd
��t	j
|||d�}	|	|_t|	td�}
t|
||�|d|_
dS)N��execr��_setupz, _setup=_setupz_setup()z&setup is neither a string nor callable�Z_stmtz
, _stmt=_stmtz_stmt()z%stmt is neither a string nor callable)�stmt�setup�init�inner)�timer�_globals�
isinstance�str�compile�dummy_src_namer�callable�
ValueError�template�formatr
rr)�selfrrr�globalsZlocal_nsZ	global_nsrZ
stmtprefixr
�coderrr
�__init__fs6

zTimer.__init__cCsJddl}ddl}|jdk	r:t|j�d|jjd�tf|jt<|j|d�dS)Nrr)�file)�	linecache�	tracebackr
�len�splitr�cache�	print_exc)r#r'r(r)rrr
r-�s

zTimer.print_excc
CsBtjd|�}tj�}tj�z|j||j�}Wd|r<tj�X|S)N)�	itertoolsr�gc�	isenabled�disablerr�enable)r#�number�itZgcoldZtimingrrr
r�s

zTimer.timeitcCs.g}x$t|�D]}|j|�}|j|�qW|S)N)�ranger�append)r#rr3�r�i�trrr
r�s

zTimer.repeatcCsFx<tdd�D].}d|}|j|�}|r0|||�|dkrPqW||fS)N��
g�������?)r5r)r#�callbackr8r3�
time_takenrrr
�	autorange�s

zTimer.autorange)N)N)�__name__�
__module__�__qualname__rr&r-�default_numberr�default_repeatrr>rrrr
rTs"
rcCst||||�j|�S)N)rr)rrrr3r$rrr
r�scCst||||�j||�S)N)rr)rrrrr3r$rrr
r�s)�_wrap_timerc s^|dkrtjdd�}ddl}y(|j|ddddddd	d
ddg	�\}}Wn2|jk
rx}zt|�td
�dSd}~XnXt}dj|�p�d}d}g}t}	d}
d}dddd�}d��x�|D�]�\}
}|
d8kr�t|�}|
d9kr�|j	|�|
d:k�r||k�r�|}ntdtj
d�dS|
d;k�r0t|�}	|	dk�r0d}	|
d<k�r@tj}|
d=k�rPtj}|
d>k�r`tj
}|
d?k�r�|
�rx�d7�|
d7}
|
d@kr�ttd)d*�dSq�Wdj|��p�d}ddl}tjjd|j�|dk	�r�||�}t|||�}|dk�r(d}|
�r�fd+d,�}y|j|�\}}Wn|j�dSy|j|	|�}Wn|j�dSt|�}|
�rxtd-d)j�fd.d/�|D���td0|d)d*�|d|}|dk	�r�||}n>d1d/�|j�D�}|jd2d3�x|D]\}}||k�r�P�q�Wtd4|	�|||f�t|�}|d|}t|�}||d5k�rZ|d|}ddl}|jd6�|||ftd7d�dS)ANr:rz
n:u:s:r:tcpvhznumber=zsetup=zrepeat=�time�clockZprocess�verbosezunit=�helpz#use -h/--help for command line help�rrg@�@g��.A)�usecZmsecZsecr�-n�--number�-s�--setup�-u�--unitz4Unrecognized unit. Please select usec, msec, or sec.)r'�-r�--repeat�-t�--time�-c�--clock�-p�	--process�-v�	--verbose�-h�--helpr)�endcsd}t|j||�d��dS)Nz#{num} loops -> {secs:.{prec}g} secs)ZnumZsecsZprec)�printr")r3r=�msg)�	precisionrr
r<@szmain.<locals>.callbackz
raw times:csg|]}d�|f�qS)z%.*gr)�.0�x)r`rr
�
<listcomp>Oszmain.<locals>.<listcomp>z	%d loops,cSsg|]\}}||f�qSrr)raZunit�scalerrr
rcUsT)�reversezbest of %d: %.*g %s per looprztThe test results are likely unreliable. The worst
time (%.*g %s) was more than four times slower than the best time.r)rKrL)rMrN)rOrP)rQrR)rSrT)rUrV)rWrX)rYrZ)r[r\)�sys�argv�getopt�errorr^r�joinrC�intr6�stderrrErFZprocess_time�__doc__�os�path�insert�curdirrr>r-r�min�items�sort�max�warnings�
warn_explicit�UserWarning)�argsrDrhZopts�errrrr3rrrGZ	time_unitZunits�o�arnr9r<�_r7ZbestrJrdZscalesZworstrvr)r`r
�main�s�















r~�__main__)N)r/rfrEr.�__all__rrBrCZperf_counterrr$rr!rrrrr~r?�exitrrrr
�<module>5s(
ycProfile.cpython-36.opt-1.pyc000064400000010310150335715140011673 0ustar003


 \�@szdZdddgZddlZddlZddd�Zddd�Zejje_ejje_Gd	d�dej�Zd
d�Z	dd
�Z
edkrve
�dS)zUPython interface for the 'lsprof' profiler.
   Compatible with the 'profile' module.
�run�runctx�Profile�N�cCstjt�j|||�S)N)�
_pyprofile�_Utilsrr)�	statement�filename�sort�r� /usr/lib64/python3.6/cProfile.pyrscCstjt�j|||||�S)N)rrrr)r�globals�localsr	r
rrrrsc@sJeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)ra`Profile(timer=None, timeunit=None, subcalls=True, builtins=True)

    Builds a profiler object using the specified timer function.
    The default timer is a fast built-in one based on real time.
    For custom timer functions returning integers, timeunit can
    be a float specifying a scale (i.e. how long each integer unit
    is, in seconds).
    rcCs$ddl}|j|�j�j|�j�dS)Nr)�pstats�StatsZ
strip_dirsZ
sort_stats�print_stats)�selfr
rrrrr(szProfile.print_statsc
Cs8ddl}t|d��}|j�|j|j|�WdQRXdS)Nr�wb)�marshal�open�create_stats�dump�stats)r�filer�frrr�
dump_stats,szProfile.dump_statscCs|j�|j�dS)N)�disable�snapshot_stats)rrrrr2szProfile.create_statscCs6|j�}i|_i}xX|D]P}t|j�}|j}||j}|j}|j}i}	|	|t|j�<|||||	f|j|<qWx�|D]�}|j	rrt|j�}x�|j	D]�}
y|t|
j�}	Wnt
k
r�w�YnX|
j}||
j}|
j}|
j}||	k�r|	|}||d7}||d7}||d7}||d7}||||f|	|<q�WqrWdS)Nrr��)Zgetstatsr�label�codeZ	callcountZreccallcountZ
inlinetimeZ	totaltime�idZcalls�KeyError)rZentriesZcallersdicts�entry�funcZncZccZttZctZcallersZsubentry�prevrrrr6s>






zProfile.snapshot_statscCsddl}|j}|j|||�S)Nr)�__main__�__dict__r)r�cmdr'�dictrrrr\szProfile.runc
Cs(|j�zt|||�Wd|j�X|S)N)�enable�execr)rr)r
rrrrras

zProfile.runctxc
Os"|j�z
|||�S|j�XdS)N)r+r)rr%�args�kwrrr�runcalljs
zProfile.runcallN���)r0)�__name__�
__module__�__qualname__�__doc__rrrrrrr/rrrrrs
&	cCs(t|t�rdd|fS|j|j|jfSdS)N�~r)�
isinstance�str�co_filename�co_firstlineno�co_name)r!rrrr ss

r c
Cs&ddl}ddl}ddl}ddlm}d}||d�}d|_|jdddd	dd
�|jddd
ddt|jj	�d�|j
dd�s�|j�|jd�|j
�\}}||j
dd�<t|�dk�r|d}|jjd|jj|��t|d��}	t|	j�|d�}
WdQRX|dddd�}t|
|d|j|j�n|j�|S)Nr)�OptionParserz@cProfile.py [-o output_file_path] [-s sort] scriptfile [arg] ...)�usageFz-oz	--outfile�outfilezSave stats to <outfile>)�dest�help�defaultz-sz--sortr
z?Sort order when printing to stdout, based on pstats.Stats classr)r>r?r@�choicesr�rbr,r')�__file__r1�__package__�
__cached__r0)�os�sysrZoptparser;Zallow_interspersed_argsZ
add_option�sortedrZsort_arg_dict_default�argvZprint_usage�exit�
parse_args�len�path�insert�dirnamer�compile�readrr=r
)rFrGrr;r<�parserZoptionsr-Zprogname�fpr!Zglobsrrr�main{s8




rTr'r0)Nr0r0)Nr0)r4�__all__Z_lsprofZprofilerrrZProfilerrr rTr1rrrr�<module>s




X%ipaddress.cpython-36.pyc000064400000177050150335715140011166 0ustar003

�\dh�/�@s�dZdZddlZdZdZGdd�de�ZGdd	�d	e�Zd
d�Zd=d
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�ZGd#d$�d$�ZejGd%d&�d&e��ZejGd'd(�d(e��ZGd)d*�d*�ZGd+d,�d,ee�ZGd-d.�d.e�ZGd/d0�d0ee�ZGd1d2�d2�Zee_Gd3d4�d4�ZGd5d6�d6ee�ZGd7d8�d8e�Z Gd9d:�d:ee�Z!Gd;d<�d<�Z"e"e_dS)>z�A fast, lightweight IPv4/IPv6 manipulation library in Python.

This library is used to create/poke/manipulate IPv4 and IPv6 addresses
and networks.

z1.0�N� �c@seZdZdZdS)�AddressValueErrorz%A Value Error related to the address.N)�__name__�
__module__�__qualname__�__doc__�r	r	�!/usr/lib64/python3.6/ipaddress.pyrsrc@seZdZdZdS)�NetmaskValueErrorz%A Value Error related to the netmask.N)rrrrr	r	r	r
rsrcCsTyt|�Sttfk
r YnXyt|�Sttfk
rBYnXtd|��dS)a�Take an IP string/int and return an object of the correct type.

    Args:
        address: A string or integer, the IP address.  Either IPv4 or
          IPv6 addresses may be supplied; integers less than 2**32 will
          be considered to be IPv4 by default.

    Returns:
        An IPv4Address or IPv6Address object.

    Raises:
        ValueError: if the *address* passed isn't either a v4 or a v6
          address

    z0%r does not appear to be an IPv4 or IPv6 addressN)�IPv4Addressrr�IPv6Address�
ValueError)�addressr	r	r
�
ip_addresssrTcCsXy
t||�Sttfk
r"YnXy
t||�Sttfk
rFYnXtd|��dS)a�Take an IP string/int and return an object of the correct type.

    Args:
        address: A string or integer, the IP network.  Either IPv4 or
          IPv6 networks may be supplied; integers less than 2**32 will
          be considered to be IPv4 by default.

    Returns:
        An IPv4Network or IPv6Network object.

    Raises:
        ValueError: if the string passed isn't either a v4 or a v6
          address. Or if the network has host bits set.

    z0%r does not appear to be an IPv4 or IPv6 networkN)�IPv4Networkrr�IPv6Networkr)r�strictr	r	r
�
ip_network9s

rcCsTyt|�Sttfk
r YnXyt|�Sttfk
rBYnXtd|��dS)agTake an IP string/int and return an object of the correct type.

    Args:
        address: A string or integer, the IP address.  Either IPv4 or
          IPv6 addresses may be supplied; integers less than 2**32 will
          be considered to be IPv4 by default.

    Returns:
        An IPv4Interface or IPv6Interface object.

    Raises:
        ValueError: if the string passed isn't either a v4 or a v6
          address.

    Notes:
        The IPv?Interface classes describe an Address on a particular
        Network, so they're basically a combination of both the Address
        and Network classes.

    z2%r does not appear to be an IPv4 or IPv6 interfaceN)�
IPv4Interfacerr�
IPv6Interfacer)rr	r	r
�ip_interfaceWsrcCs.y|jdd�Stk
r(td��YnXdS)a`Represent an address as 4 packed bytes in network (big-endian) order.

    Args:
        address: An integer representation of an IPv4 IP address.

    Returns:
        The integer address packed as 4 bytes in network (big-endian) order.

    Raises:
        ValueError: If the integer is negative or too large to be an
          IPv4 IP address.

    ��bigz&Address negative or too large for IPv4N)�to_bytes�
OverflowErrorr)rr	r	r
�v4_int_to_packedzsrcCs.y|jdd�Stk
r(td��YnXdS)z�Represent an address as 16 packed bytes in network (big-endian) order.

    Args:
        address: An integer representation of an IPv6 IP address.

    Returns:
        The integer address packed as 16 bytes in network (big-endian) order.

    �rz&Address negative or too large for IPv6N)rrr)rr	r	r
�v6_int_to_packed�s
rcCs*t|�jd�}t|�dkr&td|��|S)zAHelper to split the netmask and raise AddressValueError if needed�/�zOnly one '/' permitted in %r)�str�split�lenr)r�addrr	r	r
�_split_optional_netmask�sr%ccsRt|�}t|�}}x.|D]&}|j|jdkr<||fV|}|}qW||fVdS)z�Find a sequence of sorted deduplicated IPv#Address.

    Args:
        addresses: a list of IPv#Address objects.

    Yields:
        A tuple containing the first and last IP addresses in the sequence.

    �N)�iter�next�_ip)�	addresses�it�first�last�ipr	r	r
�_find_address_range�s


r/cCs$|dkr|St|||d@j��S)z�Count the number of zero bits on the right hand side.

    Args:
        number: an integer.
        bits: maximum number of bits to count.

    Returns:
        The number of zero bits on the right hand side of the number.

    rr&)�min�
bit_length)Znumber�bitsr	r	r
�_count_righthand_zero_bits�sr3ccs�t|t�ot|t�std��|j|jkr8td||f��||krHtd��|jdkrXt}n|jdkrht}ntd��|j}|j}|j}x^||kr�t	t
||�||dj�d�}||||f�}|V|d|>7}|d|jkr�Pq�WdS)	a�Summarize a network range given the first and last IP addresses.

    Example:
        >>> list(summarize_address_range(IPv4Address('192.0.2.0'),
        ...                              IPv4Address('192.0.2.130')))
        ...                                #doctest: +NORMALIZE_WHITESPACE
        [IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/31'),
         IPv4Network('192.0.2.130/32')]

    Args:
        first: the first IPv4Address or IPv6Address in the range.
        last: the last IPv4Address or IPv6Address in the range.

    Returns:
        An iterator of the summarized IPv(4|6) network objects.

    Raise:
        TypeError:
            If the first and last objects are not IP addresses.
            If the first and last objects are not the same version.
        ValueError:
            If the last object is not greater than the first.
            If the version of the first address is not 4 or 6.

    z1first and last must be IP addresses, not networksz%%s and %s are not of the same versionz*last IP address must be greater than firstr�zunknown IP versionr&N)
�
isinstance�_BaseAddress�	TypeError�versionrrr�_max_prefixlenr)r0r3r1�	_ALL_ONES)r,r-r.Zip_bitsZ	first_intZlast_intZnbits�netr	r	r
�summarize_address_range�s0





r<ccs�t|�}i}xL|rX|j�}|j�}|j|�}|dkr>|||<q||kr||=|j|�qWd}x4t|j��D]$}|dk	r�|j|jkr�ql|V|}qlWdS)auLoops through the addresses, collapsing concurrent netblocks.

    Example:

        ip1 = IPv4Network('192.0.2.0/26')
        ip2 = IPv4Network('192.0.2.64/26')
        ip3 = IPv4Network('192.0.2.128/26')
        ip4 = IPv4Network('192.0.2.192/26')

        _collapse_addresses_internal([ip1, ip2, ip3, ip4]) ->
          [IPv4Network('192.0.2.0/24')]

        This shouldn't be called directly; it is called via
          collapse_addresses([]).

    Args:
        addresses: A list of IPv4Network's or IPv6Network's

    Returns:
        A list of IPv4Network's or IPv6Network's depending on what we were
        passed.

    N)�list�pop�supernet�get�append�sorted�values�broadcast_address)r*Zto_merge�subnetsr;r?Zexistingr-r	r	r
�_collapse_addresses_internals$

rFcCs8g}g}g}x�|D]�}t|t�rT|rH|dj|jkrHtd||df��|j|�q|j|jkr�|r�|dj|jkr�td||df��y|j|j�Wq�tk
r�|j|j	�Yq�Xq|r�|dj|jkr�td||df��|j|�qWt
t|��}|�r,x&t|�D]\}}|j
t||���qWt||�S)	a�Collapse a list of IP objects.

    Example:
        collapse_addresses([IPv4Network('192.0.2.0/25'),
                            IPv4Network('192.0.2.128/25')]) ->
                           [IPv4Network('192.0.2.0/24')]

    Args:
        addresses: An iterator of IPv4Network or IPv6Network objects.

    Returns:
        An iterator of the collapsed IPv(4|6)Network objects.

    Raises:
        TypeError: If passed a list of mixed version objects.

    r&z%%s and %s are not of the same version���rGrGrGrGrG)r5r6�_versionr7rA�
_prefixlenr9r.�AttributeError�network_addressrB�setr/�extendr<rF)r*ZaddrsZipsZnetsr.r,r-r	r	r
�collapse_addresses2s4

rNcCs(t|t�r|j�St|t�r$|j�StS)a2Return a key suitable for sorting between networks and addresses.

    Address and Network objects are not sortable by default; they're
    fundamentally different so the expression

        IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24')

    doesn't make any sense.  There are some times however, where you may wish
    to have ipaddress sort these for you anyway. If you need to do this, you
    can use this function as the key= argument to sorted().

    Args:
      obj: either a Network or Address object.
    Returns:
      appropriate key.

    )r5�_BaseNetwork�_get_networks_keyr6�_get_address_key�NotImplemented)�objr	r	r
�get_mixed_type_keyhs


rTc@s�eZdZdZfZedd��Zedd��Zedd��Zedd	��Z	d
d�Z
dd
�Zedd��Z
edd��Zedd��Zedd��Zedd��Zdd�ZdS)�_IPAddressBasezThe mother class.cCs|j�S)z:Return the longhand version of the IP address as a string.)�_explode_shorthand_ip_string)�selfr	r	r
�exploded�sz_IPAddressBase.explodedcCst|�S)z;Return the shorthand version of the IP address as a string.)r!)rWr	r	r
�
compressed�sz_IPAddressBase.compressedcCs|j�S)aIThe name of the reverse DNS pointer for the IP address, e.g.:
            >>> ipaddress.ip_address("127.0.0.1").reverse_pointer
            '1.0.0.127.in-addr.arpa'
            >>> ipaddress.ip_address("2001:db8::1").reverse_pointer
            '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa'

        )�_reverse_pointer)rWr	r	r
�reverse_pointer�s	z_IPAddressBase.reverse_pointercCsdt|�f}t|��dS)Nz%200s has no version specified)�type�NotImplementedError)rW�msgr	r	r
r8�sz_IPAddressBase.versioncCsF|dkrd}t|||jf��||jkrBd}t|||j|jf��dS)Nrz-%d (< 0) is not permitted as an IPv%d addressz2%d (>= 2**%d) is not permitted as an IPv%d address)rrHr:r9)rWrr^r	r	r
�_check_int_address�s

z!_IPAddressBase._check_int_addresscCs.t|�}||kr*d}t|||||jf��dS)Nz6%r (len %d != %d) is not permitted as an IPv%d address)r#rrH)rWrZexpected_lenZaddress_lenr^r	r	r
�_check_packed_address�s
z$_IPAddressBase._check_packed_addresscCs|j|j|?AS)z�Turn the prefix length into a bitwise netmask

        Args:
            prefixlen: An integer, the prefix length.

        Returns:
            An integer.

        )r:)�cls�	prefixlenr	r	r
�_ip_int_from_prefix�sz"_IPAddressBase._ip_int_from_prefixc	Cs\t||j�}|j|}||?}d|>d}||krX|jd}|j|d�}d}t||��|S)aReturn prefix length from the bitwise netmask.

        Args:
            ip_int: An integer, the netmask in expanded bitwise format

        Returns:
            An integer, the prefix length.

        Raises:
            ValueError: If the input intermingles zeroes & ones
        r&�rz&Netmask pattern %r mixes zeroes & ones)r3r9rr)	ra�ip_intZtrailing_zeroesrbZleading_onesZall_onesZbyteslenZdetailsr^r	r	r
�_prefix_from_ip_int�s


z"_IPAddressBase._prefix_from_ip_intcCsd|}t|�d�dS)Nz%r is not a valid netmask)r)raZnetmask_strr^r	r	r
�_report_invalid_netmask�sz&_IPAddressBase._report_invalid_netmaskcCsjtjj|�s|j|�yt|�}Wntk
r@|j|�YnXd|koV|jknsf|j|�|S)a	Return prefix length from a numeric string

        Args:
            prefixlen_str: The string to be converted

        Returns:
            An integer, the prefix length.

        Raises:
            NetmaskValueError: If the input is not a valid netmask
        r)�_BaseV4�_DECIMAL_DIGITS�
issupersetrg�intrr9)raZ
prefixlen_strrbr	r	r
�_prefix_from_prefix_string�s

z)_IPAddressBase._prefix_from_prefix_stringcCs�y|j|�}Wntk
r,|j|�YnXy
|j|�Stk
rLYnX||jN}y
|j|�Stk
r�|j|�YnXdS)aTurn a netmask/hostmask string into a prefix length

        Args:
            ip_str: The netmask/hostmask to be converted

        Returns:
            An integer, the prefix length.

        Raises:
            NetmaskValueError: If the input is not a valid netmask/hostmask
        N)�_ip_int_from_stringrrgrfrr:)ra�ip_strrer	r	r
�_prefix_from_ip_string�s


z%_IPAddressBase._prefix_from_ip_stringcCs|jt|�ffS)N)�	__class__r!)rWr	r	r
�
__reduce__sz_IPAddressBase.__reduce__N)rrrr�	__slots__�propertyrXrYr[r8r_r`�classmethodrcrfrgrlrorqr	r	r	r
rU�s	
"rUc@sdeZdZdZfZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�ZdS)r6z�A generic IP object.

    This IP class contains the version independent methods which are
    used by single IP addresses.
    cCs|jS)N)r))rWr	r	r
�__int__&sz_BaseAddress.__int__cCs2y|j|jko|j|jkStk
r,tSXdS)N)r)rHrJrR)rW�otherr	r	r
�__eq__)s
z_BaseAddress.__eq__cCsFt|t�stS|j|jkr*td||f��|j|jkrB|j|jkSdS)Nz%%s and %s are not of the same versionF)r5r6rRrHr7r))rWrvr	r	r
�__lt__0s
z_BaseAddress.__lt__cCs t|t�stS|jt|�|�S)N)r5rkrRrp)rWrvr	r	r
�__add__<s
z_BaseAddress.__add__cCs t|t�stS|jt|�|�S)N)r5rkrRrp)rWrvr	r	r
�__sub__As
z_BaseAddress.__sub__cCsd|jjt|�fS)Nz%s(%r))rprr!)rWr	r	r
�__repr__Fsz_BaseAddress.__repr__cCst|j|j��S)N)r!�_string_from_ip_intr))rWr	r	r
�__str__Isz_BaseAddress.__str__cCsttt|j���S)N)�hash�hexrkr))rWr	r	r
�__hash__Lsz_BaseAddress.__hash__cCs
|j|fS)N)rH)rWr	r	r
rQOsz_BaseAddress._get_address_keycCs|j|jffS)N)rpr))rWr	r	r
rqRsz_BaseAddress.__reduce__N)rrrrrrrurwrxryrzr{r}r�rQrqr	r	r	r
r6sr6c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zedd��Zedd��Zedd��Zedd��Zed d!��Zed"d#��Zed$d%��Zed&d'��Zd(d)�Zd*d+�Zd,d-�ZdBd0d1�ZdCd2d3�Zed4d5��Zed6d7��Zed8d9��Zed:d;��Z ed<d=��Z!ed>d?��Z"ed@dA��Z#d/S)DrOz~A generic IP network object.

    This IP class contains the version independent methods which are
    used by networks.

    cCs
i|_dS)N)�_cache)rWrr	r	r
�__init___sz_BaseNetwork.__init__cCsd|jjt|�fS)Nz%s(%r))rprr!)rWr	r	r
r{bsz_BaseNetwork.__repr__cCsd|j|jfS)Nz%s/%d)rKrb)rWr	r	r
r}esz_BaseNetwork.__str__ccs<t|j�}t|j�}x"t|d|�D]}|j|�Vq$WdS)z�Generate Iterator over usable hosts in a network.

        This is like __iter__ except it doesn't return the network
        or broadcast addresses.

        r&N)rkrKrD�range�_address_class)rW�network�	broadcast�xr	r	r
�hostshs

z_BaseNetwork.hostsccs<t|j�}t|j�}x"t||d�D]}|j|�Vq$WdS)Nr&)rkrKrDr�r�)rWr�r�r�r	r	r
�__iter__ts

z_BaseNetwork.__iter__cCslt|j�}t|j�}|dkr>|||kr0td��|j||�S|d7}|||krZtd��|j||�SdS)Nrzaddress out of ranger&)rkrKrD�
IndexErrorr�)rW�nr�r�r	r	r
�__getitem__zs

z_BaseNetwork.__getitem__cCs^t|t�stS|j|jkr*td||f��|j|jkrB|j|jkS|j|jkrZ|j|jkSdS)Nz%%s and %s are not of the same versionF)r5rOrRrHr7rK�netmask)rWrvr	r	r
rx�s
z_BaseNetwork.__lt__cCsFy,|j|jko,|j|jko,t|j�t|j�kStk
r@tSXdS)N)rHrKrkr�rJrR)rWrvr	r	r
rw�sz_BaseNetwork.__eq__cCstt|j�t|j�A�S)N)r~rkrKr�)rWr	r	r
r��sz_BaseNetwork.__hash__cCsL|j|jkrdSt|t�rdSt|j�t|j�koBt|j�kSSdS)NF)rHr5rOrkrKr)rD)rWrvr	r	r
�__contains__�s
z_BaseNetwork.__contains__cCs(|j|kp&|j|kp&|j|kp&|j|kS)z*Tell if self is partly contained in other.)rKrD)rWrvr	r	r
�overlaps�s


z_BaseNetwork.overlapscCs<|jjd�}|dkr8|jt|j�t|j�B�}||jd<|S)NrD)r�r@r�rkrK�hostmask)rWr�r	r	r
rD�s
z_BaseNetwork.broadcast_addresscCs8|jjd�}|dkr4|jt|j�|jA�}||jd<|S)Nr�)r�r@r�rkr�r:)rWr�r	r	r
r��s

z_BaseNetwork.hostmaskcCsd|j|jfS)Nz%s/%d)rKrI)rWr	r	r
�with_prefixlen�sz_BaseNetwork.with_prefixlencCsd|j|jfS)Nz%s/%s)rKr�)rWr	r	r
�with_netmask�sz_BaseNetwork.with_netmaskcCsd|j|jfS)Nz%s/%s)rKr�)rWr	r	r
�
with_hostmask�sz_BaseNetwork.with_hostmaskcCst|j�t|j�dS)z&Number of hosts in the current subnet.r&)rkrDrK)rWr	r	r
�
num_addresses�sz_BaseNetwork.num_addressescCsdt|�f}t|��dS)Nz%%200s has no associated address class)r\r])rWr^r	r	r
r��sz_BaseNetwork._address_classcCs|jS)N)rI)rWr	r	r
rb�sz_BaseNetwork.prefixlenccsD|j|jkstd||f��t|t�s2td|��|j|jkoH|j|jksZtd||f��||krfdS|jd|j|jf�}|j	�\}}x�||ko�||k�r|j|jkr�|j|jkr�|V|j	�\}}q�|j|jkr�|j|jkr�|V|j	�\}}q�t
d|||f��q�W||k�r|Vn$||k�r.|Vnt
d|||f��dS)a�Remove an address from a larger block.

        For example:

            addr1 = ip_network('192.0.2.0/28')
            addr2 = ip_network('192.0.2.1/32')
            list(addr1.address_exclude(addr2)) =
                [IPv4Network('192.0.2.0/32'), IPv4Network('192.0.2.2/31'),
                 IPv4Network('192.0.2.4/30'), IPv4Network('192.0.2.8/29')]

        or IPv6:

            addr1 = ip_network('2001:db8::1/32')
            addr2 = ip_network('2001:db8::1/128')
            list(addr1.address_exclude(addr2)) =
                [ip_network('2001:db8::1/128'),
                 ip_network('2001:db8::2/127'),
                 ip_network('2001:db8::4/126'),
                 ip_network('2001:db8::8/125'),
                 ...
                 ip_network('2001:db8:8000::/33')]

        Args:
            other: An IPv4Network or IPv6Network object of the same type.

        Returns:
            An iterator of the IPv(4|6)Network objects which is self
            minus other.

        Raises:
            TypeError: If self and other are of differing address
              versions, or if other is not a network object.
            ValueError: If other is not completely contained by self.

        z%%s and %s are not of the same versionz%s is not a network objectz%s not contained in %sNz%s/%sz3Error performing exclusion: s1: %s s2: %s other: %s)rHr7r5rOrKrDrrprbrE�AssertionError)rWrv�s1�s2r	r	r
�address_exclude�s<$



z_BaseNetwork.address_excludecCs`|j|jkrtd||f��|j|jkr,dS|j|jkr<dS|j|jkrLdS|j|jkr\dSdS)a�Compare two IP objects.

        This is only concerned about the comparison of the integer
        representation of the network addresses.  This means that the
        host bits aren't considered at all in this method.  If you want
        to compare host bits, you can easily enough do a
        'HostA._ip < HostB._ip'

        Args:
            other: An IP object.

        Returns:
            If the IP versions of self and other are the same, returns:

            -1 if self < other:
              eg: IPv4Network('192.0.2.0/25') < IPv4Network('192.0.2.128/25')
              IPv6Network('2001:db8::1000/124') <
                  IPv6Network('2001:db8::2000/124')
            0 if self == other
              eg: IPv4Network('192.0.2.0/24') == IPv4Network('192.0.2.0/24')
              IPv6Network('2001:db8::1000/124') ==
                  IPv6Network('2001:db8::1000/124')
            1 if self > other
              eg: IPv4Network('192.0.2.128/25') > IPv4Network('192.0.2.0/25')
                  IPv6Network('2001:db8::2000/124') >
                      IPv6Network('2001:db8::1000/124')

          Raises:
              TypeError if the IP versions are different.

        z"%s and %s are not of the same typer&rrGrG)rHr7rKr�)rWrvr	r	r
�compare_networks.s!z_BaseNetwork.compare_networkscCs|j|j|jfS)z�Network-only key function.

        Returns an object that identifies this address' network and
        netmask. This function is a suitable "key" argument for sorted()
        and list.sort().

        )rHrKr�)rWr	r	r
rP^sz_BaseNetwork._get_networks_keyr&Nc	cs�|j|jkr|VdS|dk	rJ||jkr0td��|dkr@td��||j}|dkrZtd��|j|}||jkr~td||f��t|j�}t|j�d}t|j�d|?}x(t|||�D]}|j||f�}|Vq�WdS)a�The subnets which join to make the current subnet.

        In the case that self contains only one IP
        (self._prefixlen == 32 for IPv4 or self._prefixlen == 128
        for IPv6), yield an iterator with just ourself.

        Args:
            prefixlen_diff: An integer, the amount the prefix length
              should be increased by. This should not be set if
              new_prefix is also set.
            new_prefix: The desired new prefix length. This must be a
              larger number (smaller prefix) than the existing prefix.
              This should not be set if prefixlen_diff is also set.

        Returns:
            An iterator of IPv(4|6) objects.

        Raises:
            ValueError: The prefixlen_diff is too small or too large.
                OR
            prefixlen_diff and new_prefix are both set or new_prefix
              is a smaller number than the current prefix (smaller
              number means a larger network)

        Nznew prefix must be longerr&z(cannot set prefixlen_diff and new_prefixrzprefix length diff must be > 0z0prefix length diff %d is invalid for netblock %s)	rIr9rrkrKrDr�r�rp)	rW�prefixlen_diff�
new_prefix�
new_prefixlen�start�end�stepZnew_addrZcurrentr	r	r
rEhs,




z_BaseNetwork.subnetscCs�|jdkr|S|dk	rB||jkr(td��|dkr8td��|j|}|j|}|dkrftd|j|f��|jt|j�t|j�|>@|f�S)a�The supernet containing the current network.

        Args:
            prefixlen_diff: An integer, the amount the prefix length of
              the network should be decreased by.  For example, given a
              /24 network and a prefixlen_diff of 3, a supernet with a
              /21 netmask is returned.

        Returns:
            An IPv4 network object.

        Raises:
            ValueError: If self.prefixlen - prefixlen_diff < 0. I.e., you have
              a negative prefix length.
                OR
            If prefixlen_diff and new_prefix are both set or new_prefix is a
              larger number than the current prefix (larger number means a
              smaller network)

        rNznew prefix must be shorterr&z(cannot set prefixlen_diff and new_prefixz;current prefixlen is %d, cannot have a prefixlen_diff of %d)rIrrbrprkrKr�)rWr�r�r�r	r	r
r?�s 



z_BaseNetwork.supernetcCs|jjo|jjS)z�Test if the address is reserved for multicast use.

        Returns:
            A boolean, True if the address is a multicast address.
            See RFC 2373 2.7 for details.

        )rK�is_multicastrD)rWr	r	r
r��s	z_BaseNetwork.is_multicastcCs|jjo|jjS)z�Test if the address is otherwise IETF reserved.

        Returns:
            A boolean, True if the address is within one of the
            reserved IPv6 Network ranges.

        )rK�is_reservedrD)rWr	r	r
r��s	z_BaseNetwork.is_reservedcCs|jjo|jjS)z�Test if the address is reserved for link-local.

        Returns:
            A boolean, True if the address is reserved per RFC 4291.

        )rK�
is_link_localrD)rWr	r	r
r��sz_BaseNetwork.is_link_localcCs|jjo|jjS)z�Test if this address is allocated for private networks.

        Returns:
            A boolean, True if the address is reserved per
            iana-ipv4-special-registry or iana-ipv6-special-registry.

        )rK�
is_privaterD)rWr	r	r
r��s	z_BaseNetwork.is_privatecCs|jS)z�Test if this address is allocated for public networks.

        Returns:
            A boolean, True if the address is not reserved per
            iana-ipv4-special-registry or iana-ipv6-special-registry.

        )r�)rWr	r	r
�	is_global�s	z_BaseNetwork.is_globalcCs|jjo|jjS)z�Test if the address is unspecified.

        Returns:
            A boolean, True if this is the unspecified address as defined in
            RFC 2373 2.5.2.

        )rK�is_unspecifiedrD)rWr	r	r
r�s	z_BaseNetwork.is_unspecifiedcCs|jjo|jjS)z�Test if the address is a loopback address.

        Returns:
            A boolean, True if the address is a loopback address as defined in
            RFC 2373 2.5.3.

        )rK�is_loopbackrD)rWr	r	r
r�s	z_BaseNetwork.is_loopback)r&N)r&N)$rrrrr�r{r}r�r�r�rxrwr�r�r�rsrDr�r�r�r�r�r�rbr�r�rPrEr?r�r�r�r�r�r�r�r	r	r	r
rOVs@

	N0

5
)rOc
@s�eZdZdZfZdZdedZed�Z	edddd	d
ddd
dh	�Z
eZiZdd�Z
edd��Zedd��Zedd��Zedd��Zdd�Zdd�Zdd�Zedd ��Zed!d"��Zd#S)$rhzyBase IPv4 object.

    The following methods are used by IPv4 objects in both single IP
    addresses and networks.

    rr r&�
0123456789���������rrcCst|�S)N)r!)rWr	r	r
rV0sz$_BaseV4._explode_shorthand_ip_stringcCsn||jkrdt|t�r|}n.y|j|�}Wntk
rF|j|�}YnXt|j|��}||f|j|<|j|S)aMake a (netmask, prefix_len) tuple from the given argument.

        Argument can be:
        - an integer (the prefix length)
        - a string representing the prefix length (e.g. "24")
        - a string representing the prefix netmask (e.g. "255.255.255.0")
        )�_netmask_cacher5rkrlrrorrc)ra�argrbr�r	r	r
�
_make_netmask3s	

z_BaseV4._make_netmaskcCs||std��|jd�}t|�dkr.td|��ytjt|j|�d�Stk
rv}ztd||f�d�WYdd}~XnXdS)aTurn the given IP string into an integer for comparison.

        Args:
            ip_str: A string, the IP ip_str.

        Returns:
            The IP ip_str as an integer.

        Raises:
            AddressValueError: if ip_str isn't a valid IPv4 Address.

        zAddress cannot be empty�.rzExpected 4 octets in %rrz%s in %rN)rr"r#rk�
from_bytes�map�_parse_octetr)rarnZoctets�excr	r	r
rmKs
z_BaseV4._ip_int_from_stringcCs�|std��|jj|�s(d}t||��t|�dkrDd}t||��t|d�}|dkrr|ddkrrd	}t||��|d
kr�td|��|S)aConvert a decimal octet into an integer.

        Args:
            octet_str: A string, the number to parse.

        Returns:
            The octet as an integer.

        Raises:
            ValueError: if the octet isn't strictly a decimal from [0..255].

        zEmpty octet not permittedz#Only decimal digits permitted in %r�z$At most 3 characters permitted in %r�
�r�0z3Ambiguous (octal/decimal) value in %r not permittedr�zOctet %d (> 255) not permitted)rrirjr#rk)raZ	octet_strr^Z	octet_intr	r	r
r�es
z_BaseV4._parse_octetcCsdjtt|jdd���S)z�Turns a 32-bit integer into dotted decimal notation.

        Args:
            ip_int: An integer, the IP address.

        Returns:
            The IP address as a string in dotted decimal notation.

        r�rr)�joinr�r!r)rarer	r	r
r|�sz_BaseV4._string_from_ip_intcCs�|jd�}t|�dkr�y$x|D]}t|�|jkrdSqWWntk
rNdSXx0t|�D]$\}}|dkrZ|||dkrZdSqZWdSyt|�}Wntk
r�dSXd|ko�|jkSS)z�Verify that the netmask is valid.

        Args:
            netmask: A string, either a prefix or dotted decimal
              netmask.

        Returns:
            A boolean, True if the prefix represents a valid IPv4
            netmask.

        r�rFrr&T)r"r#rk�_valid_mask_octetsr�	enumerater9)rWr��maskr��idx�yr	r	r
�_is_valid_netmask�s"

z_BaseV4._is_valid_netmaskcsh|jd�}y�fdd�tt|�D�}Wntk
r:dSXt|�t|�krPdS|d|dkrddSdS)	z�Test if the IP string is a hostmask (rather than a netmask).

        Args:
            ip_str: A string, the potential hostmask.

        Returns:
            A boolean, True if the IP string is a hostmask.

        r�csg|]}|�jkr|�qSr	)r�)�.0r�)rWr	r
�
<listcomp>�sz(_BaseV4._is_hostmask.<locals>.<listcomp>Frr&TrG)r"r�rkrr#)rWrnr2�partsr	)rWr
�_is_hostmask�s

z_BaseV4._is_hostmaskcCs&t|�jd�ddd�}dj|�dS)z�Return the reverse DNS pointer name for the IPv4 address.

        This implements the method described in RFC1035 3.5.

        r�Nr&z
.in-addr.arparG)r!r"r�)rWZreverse_octetsr	r	r
rZ�sz_BaseV4._reverse_pointercCs|jS)N)r9)rWr	r	r
�
max_prefixlen�sz_BaseV4.max_prefixlencCs|jS)N)rH)rWr	r	r
r8�sz_BaseV4.versionN)rrrrrrrH�
IPV4LENGTHr:�	frozensetrir�r9r�rVrtr�rmr�r|r�r�rZrsr�r8r	r	r	r
rhs$%
	rhc@s�eZdZdZdZdd�Zedd��Zedd	��Zee	j
�d
d���Zee	j
�dd
���Zedd��Z
edd��Zedd��Zedd��ZdS)rz/Represent and manipulate single IPv4 Addresses.r)�__weakref__cCsrt|t�r|j|�||_dSt|t�rF|j|d�tj|d�|_dSt|�}d|krbtd|��|j	|�|_dS)a�
        Args:
            address: A string or integer representing the IP

              Additionally, an integer can be passed, so
              IPv4Address('192.0.2.1') == IPv4Address(3221225985).
              or, more generally
              IPv4Address(int(IPv4Address('192.0.2.1'))) ==
                IPv4Address('192.0.2.1')

        Raises:
            AddressValueError: If ipaddress isn't a valid IPv4 address.

        NrrrzUnexpected '/' in %r)
r5rkr_r)�bytesr`r�r!rrm)rWr�addr_strr	r	r
r��s


zIPv4Address.__init__cCs
t|j�S)z*The binary representation of this address.)rr))rWr	r	r
�packedszIPv4Address.packedcCs||jjkS)z�Test if the address is otherwise IETF reserved.

         Returns:
             A boolean, True if the address is within the
             reserved IPv4 Network range.

        )�
_constants�_reserved_network)rWr	r	r
r�s	zIPv4Address.is_reservedcs4t�fdd��jjD��o2t�fdd��jjD��S)a�``True`` if the address is defined as not globally reachable by
        iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
        (for IPv6) with the following exceptions:

        * ``is_private`` is ``False`` for ``100.64.0.0/10``
        * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
            semantics of the underlying IPv4 addresses and the following condition holds
            (see :attr:`IPv6Address.ipv4_mapped`)::

                address.is_private == address.ipv4_mapped.is_private

        ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10``
        IPv4 range where they are both ``False``.
        c3s|]}�|kVqdS)Nr	)r�r;)rWr	r
�	<genexpr>(sz)IPv4Address.is_private.<locals>.<genexpr>c3s|]}�|kVqdS)Nr	)r�r;)rWr	r
r�)s)�anyr��_private_networks�all�_private_networks_exceptions)rWr	)rWr
r�szIPv4Address.is_privatecCs||jjko|jS)ar``True`` if the address is defined as globally reachable by
        iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
        (for IPv6) with the following exception:

        For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
        semantics of the underlying IPv4 addresses and the following condition holds
        (see :attr:`IPv6Address.ipv4_mapped`)::

            address.is_global == address.ipv4_mapped.is_global

        ``is_global`` has value opposite to :attr:`is_private`, except for the ``100.64.0.0/10``
        IPv4 range where they are both ``False``.
        )r��_public_networkr�)rWr	r	r
r�,szIPv4Address.is_globalcCs||jjkS)z�Test if the address is reserved for multicast use.

        Returns:
            A boolean, True if the address is multicast.
            See RFC 3171 for details.

        )r��_multicast_network)rWr	r	r
r�>s	zIPv4Address.is_multicastcCs||jjkS)z�Test if the address is unspecified.

        Returns:
            A boolean, True if this is the unspecified address as defined in
            RFC 5735 3.

        )r��_unspecified_address)rWr	r	r
r�Is	zIPv4Address.is_unspecifiedcCs||jjkS)z�Test if the address is a loopback address.

        Returns:
            A boolean, True if the address is a loopback per RFC 3330.

        )r��_loopback_network)rWr	r	r
r�TszIPv4Address.is_loopbackcCs||jjkS)z�Test if the address is reserved for link-local.

        Returns:
            A boolean, True if the address is link-local per RFC 3927.

        )r��_linklocal_network)rWr	r	r
r�^szIPv4Address.is_link_localN)r)r�)rrrrrrr�rsr�r��	functools�	lru_cacher�r�r�r�r�r�r	r	r	r
r�s#
rc@sjeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zej	Z	e
dd��Ze
d
d��Ze
dd��Z
e
dd��ZdS)rcCs�t|ttf�r2tj||�t|j�|_|j|_	dSt|t
�r�tj||d�t|�dkrht|d�|_	n|j|_	t|dd�|_|jj|_|jj
|_
dSt|�}tj||d�t|dd�|_|jj	|_	|jj|_|jj
|_
dS)Nrr&F)r)r5r�rkrr�rr)r�r9rI�tupler#r�r�r%)rWrr$r	r	r
r�ks(




zIPv4Interface.__init__cCsd|j|j�|jjfS)Nz%s/%d)r|r)r�rb)rWr	r	r
r}�szIPv4Interface.__str__cCsDtj||�}|s|tkr|Sy|j|jkStk
r>dSXdS)NF)rrwrRr�rJ)rWrv�
address_equalr	r	r
rw�szIPv4Interface.__eq__cCsNtj||�}|tkrtSy|j|jkp4|j|jko4|Stk
rHdSXdS)NF)rrxrRr�rJ)rWrv�address_lessr	r	r
rx�szIPv4Interface.__lt__cCst|j|jt|jj�f�S)N)r~r)rIrkr�rK)rWr	r	r
r��szIPv4Interface.__hash__cCs
t|j�S)N)rr))rWr	r	r
r.�szIPv4Interface.ipcCsd|j|j�|jfS)Nz%s/%s)r|r)rI)rWr	r	r
r��szIPv4Interface.with_prefixlencCsd|j|j�|jfS)Nz%s/%s)r|r)r�)rWr	r	r
r��szIPv4Interface.with_netmaskcCsd|j|j�|jfS)Nz%s/%s)r|r)r�)rWr	r	r
r��szIPv4Interface.with_hostmaskN)rrrr�r}rwrxr�rUrqrsr.r�r�r�r	r	r	r
risrc@s2eZdZdZeZddd�Zeej	�dd���Z
dS)	raeThis class represents and manipulates 32-bit IPv4 network + addresses..

    Attributes: [examples for IPv4Network('192.0.2.0/27')]
        .network_address: IPv4Address('192.0.2.0')
        .hostmask: IPv4Address('0.0.0.31')
        .broadcast_address: IPv4Address('192.0.2.32')
        .netmask: IPv4Address('255.255.255.224')
        .prefixlen: 27

    TcCs�tj||�t|ttf�r&|}|j}n^t|t�rT|d}t|�dkrL|dn|j}n0t|�}|j	|d�}t|�dkr~|dn|j}t
|�|_|j|�\|_
|_t|j�}|t|j
�@|kr�|r�td|��nt
|t|j
�@�|_|j|jdkr�|j|_dS)aInstantiate a new IPv4 network object.

        Args:
            address: A string or integer representing the IP [& network].
              '192.0.2.0/24'
              '192.0.2.0/255.255.255.0'
              '192.0.0.2/0.0.0.255'
              are all functionally the same in IPv4. Similarly,
              '192.0.2.1'
              '192.0.2.1/255.255.255.255'
              '192.0.2.1/32'
              are also functionally equivalent. That is to say, failing to
              provide a subnetmask will create an object with a mask of /32.

              If the mask (portion after the / in the argument) is given in
              dotted quad form, it is treated as a netmask if it starts with a
              non-zero field (e.g. /255.0.0.0 == /8) and as a hostmask if it
              starts with a zero field (e.g. 0.255.255.255 == /8), with the
              single exception of an all-zero mask which is treated as a
              netmask == /0. If no mask is given, a default of /32 is used.

              Additionally, an integer can be passed, so
              IPv4Network('192.0.2.1') == IPv4Network(3221225985)
              or, more generally
              IPv4Interface(int(IPv4Interface('192.0.2.1'))) ==
                IPv4Interface('192.0.2.1')

        Raises:
            AddressValueError: If ipaddress isn't a valid IPv4 address.
            NetmaskValueError: If the netmask isn't valid for
              an IPv4 address.
            ValueError: If strict is True and a network address is not
              supplied.

        rr&r z%s has host bits setN)rOr�r5rkr�r9r�r#r%rmrrKr�r�rIrr�r�)rWrrr$r��argsr�r	r	r
r��s(%


zIPv4Network.__init__cCs&|jtd�ko|jtd�ko$|jS)z�Test if this address is allocated for public networks.

        Returns:
            A boolean, True if the address is not reserved per
            iana-ipv4-special-registry.

        z
100.64.0.0/10)rKrrDr�)rWr	r	r
r�s
zIPv4Network.is_globalN)T)rrrrrr�r�rsr�r�r�r	r	r	r
r�s

Crc@s�eZdZed�Zed�Zed�Zed�Zed�ed�ed�ed�ed�ed�ed	�ed
�ed�ed�ed
�ed�ed�ed�gZed�ed�gZ	ed�Z
ed�ZdS)�_IPv4Constantsz169.254.0.0/16z127.0.0.0/8z224.0.0.0/4z
100.64.0.0/10z	0.0.0.0/8z
10.0.0.0/8z
172.16.0.0/12z192.0.0.0/24z192.0.0.170/31z192.0.2.0/24z192.168.0.0/16z
198.18.0.0/15z198.51.100.0/24z203.0.113.0/24z240.0.0.0/4z255.255.255.255/32z192.0.0.9/32z
192.0.0.10/32z0.0.0.0N)
rrrrr�r�r�r�r�r�r�rr�r	r	r	r
r�s,

r�c@s�eZdZdZfZdZdedZdZe	d�Z
eZiZe
dd��Ze
d	d
��Ze
dd��Ze
d
d��Ze
ddd��Zdd�Zdd�Zedd��Zedd��ZdS)�_BaseV6zyBase IPv6 object.

    The following methods are used by IPv6 objects in both single IP
    addresses and networks.

    r4r r&rdZ0123456789ABCDEFabcdefcCsJ||jkr@t|t�r|}n
|j|�}t|j|��}||f|j|<|j|S)aMake a (netmask, prefix_len) tuple from the given argument.

        Argument can be:
        - an integer (the prefix length)
        - a string representing the prefix length (e.g. "24")
        - a string representing the prefix netmask (e.g. "255.255.255.0")
        )r�r5rkrlr
rc)rar�rbr�r	r	r
r�Zs	


z_BaseV6._make_netmaskcCs�|std��|jd�}d}t|�|kr:d||f}t|��d|dkr�yt|j��j}Wn4tk
r�}ztd||f�d�WYdd}~XnX|jd	|d
?d@�|jd	|d@�|jd}t|�|kr�d|d|f}t|��d}xDtdt|�d�D].}	||	�s�|dk	�r$d
|}t|��|	}�q�W|dk	�r�|}
t|�|d}|d�st|
d8}
|
�rtd}t||��|d�s�|d8}|�r�d}t||��|j|
|}|dk�r:d}t||jd|f��njt|�|jk�r�d}t||j|f��|d�sd}t||��|d�s*d}t||��t|�}
d}d}ytd}
x,t|
�D] }	|
d
K}
|
|j	||	�O}
�qJW|
d
|K}
x0t|d�D] }	|
d
K}
|
|j	||	�O}
�q�W|
St
k
�r�}ztd||f�d�WYdd}~XnXdS)z�Turn an IPv6 ip_str into an integer.

        Args:
            ip_str: A string, the IPv6 ip_str.

        Returns:
            An int, the IPv6 address

        Raises:
            AddressValueError: if ip_str isn't a valid IPv6 Address.

        zAddress cannot be empty�:r�z At least %d parts expected in %rr�r&z%s in %rNz%xri��z!At most %d colons permitted in %rz At most one '::' permitted in %rrz0Leading ':' only permitted as part of '::' in %rz1Trailing ':' only permitted as part of '::' in %rz/Expected at most %d other parts with '::' in %rz,Exactly %d parts expected without '::' in %rrGrGrG)rr"r#rr>r)rA�
_HEXTET_COUNTr��
_parse_hextetr)rarnr�Z
_min_partsr^Zipv4_intr�Z
_max_partsZ
skip_index�iZparts_hiZparts_loZ
parts_skippedrer	r	r
rmls�
$









z_BaseV6._ip_int_from_stringcCs>|jj|�std|��t|�dkr4d}t||��t|d�S)a&Convert an IPv6 hextet string into an integer.

        Args:
            hextet_str: A string, the number to parse.

        Returns:
            The hextet as an integer.

        Raises:
            ValueError: if the input isn't strictly a hex number from
              [0..FFFF].

        zOnly hex digits permitted in %rrz$At most 4 characters permitted in %rr)�_HEX_DIGITSrjrr#rk)raZ
hextet_strr^r	r	r
r��sz_BaseV6._parse_hextetc	Cs�d}d}d}d}xJt|�D]>\}}|dkrP|d7}|dkr>|}||krX|}|}qd}d}qW|dkr�||}|t|�kr�|dg7}dg|||�<|dkr�dg|}|S)	a�Compresses a list of hextets.

        Compresses a list of strings, replacing the longest continuous
        sequence of "0" in the list with "" and adding empty strings at
        the beginning or at the end of the string such that subsequently
        calling ":".join(hextets) will produce the compressed version of
        the IPv6 address.

        Args:
            hextets: A list of strings, the hextets to compress.

        Returns:
            A list of strings.

        r&rr��rGrGrGrG)r�r#)	ra�hextetsZbest_doublecolon_startZbest_doublecolon_lenZdoublecolon_startZdoublecolon_len�indexZhextetZbest_doublecolon_endr	r	r
�_compress_hextets�s.

z_BaseV6._compress_hextetsNcsZ|dkrt|j�}||jkr$td��d|��fdd�tddd�D�}|j|�}d	j|�S)
a,Turns a 128-bit integer into hexadecimal notation.

        Args:
            ip_int: An integer, the IP address.

        Returns:
            A string, the hexadecimal representation of the address.

        Raises:
            ValueError: The address is bigger than 128 bits of all ones.

        NzIPv6 address is too largez%032xcs&g|]}dt�||d�d��qS)z%xrr)rk)r�r�)�hex_strr	r
r�3sz/_BaseV6._string_from_ip_int.<locals>.<listcomp>rrrr�)rkr)r:rr�r�r�)rarer�r	)r�r
r|s


z_BaseV6._string_from_ip_intcs�t|t�rt|j�}nt|t�r,t|j�}nt|�}|j|�}d|��fdd�tddd�D�}t|ttf�r�ddj	|�|j
fSdj	|�S)	z�Expand a shortened IPv6 address.

        Args:
            ip_str: A string, the IPv6 address.

        Returns:
            A string, the expanded IPv6 address.

        z%032xcsg|]}�||d��qS)rr	)r�r�)r�r	r
r�Ksz8_BaseV6._explode_shorthand_ip_string.<locals>.<listcomp>rrrz%s/%dr�)r5rr!rKrr.rmr�rOr�rI)rWrnrer�r	)r�r
rV8s



z$_BaseV6._explode_shorthand_ip_stringcCs&|jddd�jdd�}dj|�dS)z�Return the reverse DNS pointer name for the IPv6 address.

        This implements the method described in RFC3596 2.5.

        Nr&r�r�r�z	.ip6.arparG)rX�replacer�)rWZ
reverse_charsr	r	r
rZPsz_BaseV6._reverse_pointercCs|jS)N)r9)rWr	r	r
r�Ysz_BaseV6.max_prefixlencCs|jS)N)rH)rWr	r	r
r8]sz_BaseV6.version)N)rrrrrrrH�
IPV6LENGTHr:r�r�r�r9r�rtr�rmr�r�r|rVrZrsr�r8r	r	r	r
r�Fs$h0	r�c@s�eZdZdZdZdd�Zedd��Zedd	��Zed
d��Z	edd
��Z
edd��Zeej
�dd���Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��ZdS) r
z/Represent and manipulate single IPv6 Addresses.r)r�cCsrt|t�r|j|�||_dSt|t�rF|j|d�tj|d�|_dSt|�}d|krbtd|��|j	|�|_dS)aInstantiate a new IPv6 address object.

        Args:
            address: A string or integer representing the IP

              Additionally, an integer can be passed, so
              IPv6Address('2001:db8::') ==
                IPv6Address(42540766411282592856903984951653826560)
              or, more generally
              IPv6Address(int(IPv6Address('2001:db8::'))) ==
                IPv6Address('2001:db8::')

        Raises:
            AddressValueError: If address isn't a valid IPv6 address.

        NrrrzUnexpected '/' in %r)
r5rkr_r)r�r`r�r!rrm)rWrr�r	r	r
r�hs


zIPv6Address.__init__cCs
t|j�S)z*The binary representation of this address.)rr))rWr	r	r
r��szIPv6Address.packedcCs||jjkS)z�Test if the address is reserved for multicast use.

        Returns:
            A boolean, True if the address is a multicast address.
            See RFC 2373 2.7 for details.

        )r�r�)rWr	r	r
r��s	zIPv6Address.is_multicastcst�fdd��jjD��S)z�Test if the address is otherwise IETF reserved.

        Returns:
            A boolean, True if the address is within one of the
            reserved IPv6 Network ranges.

        c3s|]}�|kVqdS)Nr	)r�r�)rWr	r
r��sz*IPv6Address.is_reserved.<locals>.<genexpr>)r�r��_reserved_networks)rWr	)rWr
r��s	zIPv6Address.is_reservedcCs||jjkS)z�Test if the address is reserved for link-local.

        Returns:
            A boolean, True if the address is reserved per RFC 4291.

        )r�r�)rWr	r	r
r��szIPv6Address.is_link_localcCs||jjkS)a`Test if the address is reserved for site-local.

        Note that the site-local address space has been deprecated by RFC 3879.
        Use is_private to test if this address is in the space of unique local
        addresses as defined by RFC 4193.

        Returns:
            A boolean, True if the address is reserved per RFC 3513 2.5.6.

        )r��_sitelocal_network)rWr	r	r
�
is_site_local�szIPv6Address.is_site_localcsH�j}|dk	r|jSt�fdd��jjD��oFt�fdd��jjD��S)a�``True`` if the address is defined as not globally reachable by
        iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
        (for IPv6) with the following exceptions:

        * ``is_private`` is ``False`` for ``100.64.0.0/10``
        * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
            semantics of the underlying IPv4 addresses and the following condition holds
            (see :attr:`IPv6Address.ipv4_mapped`)::

                address.is_private == address.ipv4_mapped.is_private

        ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10``
        IPv4 range where they are both ``False``.
        Nc3s|]}�|kVqdS)Nr	)r�r;)rWr	r
r��sz)IPv6Address.is_private.<locals>.<genexpr>c3s|]}�|kVqdS)Nr	)r�r;)rWr	r
r��s)�ipv4_mappedr�r�r�r�r�r�)rWr�r	)rWr
r��s
zIPv6Address.is_privatecCs|jS)ar``True`` if the address is defined as globally reachable by
        iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
        (for IPv6) with the following exception:

        For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
        semantics of the underlying IPv4 addresses and the following condition holds
        (see :attr:`IPv6Address.ipv4_mapped`)::

            address.is_global == address.ipv4_mapped.is_global

        ``is_global`` has value opposite to :attr:`is_private`, except for the ``100.64.0.0/10``
        IPv4 range where they are both ``False``.
        )r�)rWr	r	r
r��szIPv6Address.is_globalcCs
|jdkS)z�Test if the address is unspecified.

        Returns:
            A boolean, True if this is the unspecified address as defined in
            RFC 2373 2.5.2.

        r)r))rWr	r	r
r��s	zIPv6Address.is_unspecifiedcCs
|jdkS)z�Test if the address is a loopback address.

        Returns:
            A boolean, True if the address is a loopback address as defined in
            RFC 2373 2.5.3.

        r&)r))rWr	r	r
r��s	zIPv6Address.is_loopbackcCs |jd?dkrdSt|jd@�S)z�Return the IPv4 mapped address.

        Returns:
            If the IPv6 address is a v4 mapped address, return the
            IPv4 mapped address. Return None otherwise.

        ri��Nl��)r)r)rWr	r	r
r��s	zIPv6Address.ipv4_mappedcCs4|jd?dkrdSt|jd?d@�t|jd@�fS)z�Tuple of embedded teredo IPs.

        Returns:
            Tuple of the (server, client) IPs or None if the address
            doesn't appear to be a teredo address (doesn't start with
            2001::/32)

        �`i N�@l��)r)r)rWr	r	r
�teredos
zIPv6Address.teredocCs$|jd?dkrdSt|jd?d@�S)z�Return the IPv4 6to4 embedded address.

        Returns:
            The IPv4 6to4-embedded address if present or None if the
            address doesn't appear to contain a 6to4 embedded address.

        �pi N�Pl��)r)r)rWr	r	r
�	sixtofours	zIPv6Address.sixtofourN)r)r�)rrrrrrr�rsr�r�r�r�r�r�r�r�r�r�r�r�r�r�r	r	r	r
r
bs $

r
c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zej	Z	e
dd��Ze
d
d��Ze
dd��Z
e
dd��Ze
dd��Ze
dd��ZdS)rcCs�t|ttf�r2tj||�t|j�|_|j|_	dSt|t
�r�tj||d�t|�dkrht|d�|_	n|j|_	t|dd�|_|jj|_|jj
|_
dSt|�}tj||d�t|dd�|_|jj|_|jj	|_	|jj
|_
dS)Nrr&F)r)r5r�rkr
r�rr)r�r9rIr�r#r�r�r%)rWrr$r	r	r
r�+s(




zIPv6Interface.__init__cCsd|j|j�|jjfS)Nz%s/%d)r|r)r�rb)rWr	r	r
r}CszIPv6Interface.__str__cCsDtj||�}|s|tkr|Sy|j|jkStk
r>dSXdS)NF)r
rwrRr�rJ)rWrvr�r	r	r
rwGszIPv6Interface.__eq__cCsNtj||�}|tkrtSy|j|jkp4|j|jko4|Stk
rHdSXdS)NF)r
rxrRr�rJ)rWrvr�r	r	r
rxSszIPv6Interface.__lt__cCst|j|jt|jj�f�S)N)r~r)rIrkr�rK)rWr	r	r
r�_szIPv6Interface.__hash__cCs
t|j�S)N)r
r))rWr	r	r
r.dszIPv6Interface.ipcCsd|j|j�|jfS)Nz%s/%s)r|r)rI)rWr	r	r
r�hszIPv6Interface.with_prefixlencCsd|j|j�|jfS)Nz%s/%s)r|r)r�)rWr	r	r
r�mszIPv6Interface.with_netmaskcCsd|j|j�|jfS)Nz%s/%s)r|r)r�)rWr	r	r
r�rszIPv6Interface.with_hostmaskcCs|jdko|jjS)Nr)r)r�r�)rWr	r	r
r�wszIPv6Interface.is_unspecifiedcCs|jdko|jjS)Nr&)r)r�r�)rWr	r	r
r�{szIPv6Interface.is_loopbackN)rrrr�r}rwrxr�rUrqrsr.r�r�r�r�r�r	r	r	r
r)src@s2eZdZdZeZd
dd�Zdd�Zedd��Z	d	S)ravThis class represents and manipulates 128-bit IPv6 networks.

    Attributes: [examples for IPv6('2001:db8::1000/124')]
        .network_address: IPv6Address('2001:db8::1000')
        .hostmask: IPv6Address('::f')
        .broadcast_address: IPv6Address('2001:db8::100f')
        .netmask: IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff0')
        .prefixlen: 124

    TcCs�tj||�t|ttf�r&|}|j}n^t|t�rT|d}t|�dkrL|dn|j}n0t|�}|j	|d�}t|�dkr~|dn|j}t
|�|_|j|�\|_
|_t|j�}|t|j
�@|kr�|r�td|��nt
|t|j
�@�|_|j|jdkr�|j|_dS)a�Instantiate a new IPv6 Network object.

        Args:
            address: A string or integer representing the IPv6 network or the
              IP and prefix/netmask.
              '2001:db8::/128'
              '2001:db8:0000:0000:0000:0000:0000:0000/128'
              '2001:db8::'
              are all functionally the same in IPv6.  That is to say,
              failing to provide a subnetmask will create an object with
              a mask of /128.

              Additionally, an integer can be passed, so
              IPv6Network('2001:db8::') ==
                IPv6Network(42540766411282592856903984951653826560)
              or, more generally
              IPv6Network(int(IPv6Network('2001:db8::'))) ==
                IPv6Network('2001:db8::')

            strict: A boolean. If true, ensure that we have been passed
              A true network address, eg, 2001:db8::1000/124 and not an
              IP address on a network, eg, 2001:db8::1/124.

        Raises:
            AddressValueError: If address isn't a valid IPv6 address.
            NetmaskValueError: If the netmask isn't valid for
              an IPv6 address.
            ValueError: If strict was True and a network address was not
              supplied.

        rr&r z%s has host bits setN)rOr�r5rkr�r9r�r#r%rmr
rKr�r�rIrr�r�)rWrrr$r�r�r�r	r	r
r��s( 


zIPv6Network.__init__ccs@t|j�}t|j�}x&t|d|d�D]}|j|�Vq(WdS)z�Generate Iterator over usable hosts in a network.

          This is like __iter__ except it doesn't return the
          Subnet-Router anycast address.

        r&N)rkrKrDr�r�)rWr�r�r�r	r	r
r��s

zIPv6Network.hostscCs|jjo|jjS)a`Test if the address is reserved for site-local.

        Note that the site-local address space has been deprecated by RFC 3879.
        Use is_private to test if this address is in the space of unique local
        addresses as defined by RFC 4193.

        Returns:
            A boolean, True if the address is reserved per RFC 3513 2.5.6.

        )rKr�rD)rWr	r	r
r��szIPv6Network.is_site_localN)T)
rrrrr
r�r�r�rsr�r	r	r	r
r�s

>rc@s�eZdZed�Zed�Zed�ed�ed�ed�ed�ed�ed	�ed
�ed�ed�g
Zed�ed
�ed�ed�ed�ed�gZed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed �gZed!�Z	d"S)#�_IPv6Constantsz	fe80::/10zff00::/8z::1/128z::/128z
::ffff:0:0/96z64:ff9b:1::/48z100::/64z	2001::/23z
2001:db8::/32z	2002::/16zfc00::/7z
2001:1::1/128z
2001:1::2/128z2001:3::/32z2001:4:112::/48z2001:20::/28z2001:30::/28z::/8z100::/8z200::/7z400::/6z800::/5z1000::/4z4000::/3z6000::/3z8000::/3zA000::/3zC000::/3zE000::/4zF000::/5zF800::/6zFE00::/9z	fec0::/10N)
rrrrr�r�r�r�r�r�r	r	r	r
r��s6


r�)T)#r�__version__r�r�r�rrrrrrrrr%r/r3r<rFrNrTrU�total_orderingr6rOrhrrrr�r�r�r
rrr�r	r	r	r
�<module>	sX
#716:EE
Sa&HWj-smtplib.cpython-36.opt-1.pyc000064400000104721150335715140011614 0ustar003


 \���@sndZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZdddddd	d
ddd
ddgZdZdZdZdZdZejdej�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd	�d	e�Z Gdd
�d
e�Z!Gdd�de�Z"Gd d�de�Z#d!d
�Z$d"d#�Z%d$d�Z&d%d&�Z'd'd(�Z(yddl)Z)Wne*k
�r�d)Z+YnXd*Z+Gd+d�d�Z,e+�r�Gd,d-�d-e,�Z-ej.d-�d.Z/Gd/d0�d0e,�Z0e1d1k�rjd2d3�Z2e2d4�Z3e2d5�j4d6�Z5e6d7�d8Z7x ej8j9�Z:e:�s$Pe7e:Z7�qWe6d9e;e7��e,d:�Z<e<j=d;�e<j>e3e5e7�e<j?�dS)<aSMTP/ESMTP client class.

This should follow RFC 821 (SMTP), RFC 1869 (ESMTP), RFC 2554 (SMTP
Authentication) and RFC 2487 (Secure SMTP over TLS).

Notes:

Please remember, when doing ESMTP, that the names of the SMTP service
extensions are NOT the same thing as the option keywords for the RCPT
and MAIL commands!

Example:

  >>> import smtplib
  >>> s=smtplib.SMTP("localhost")
  >>> print(s.help())
  This is Sendmail version 8.8.4
  Topics:
      HELO    EHLO    MAIL    RCPT    DATA
      RSET    NOOP    QUIT    HELP    VRFY
      EXPN    VERB    ETRN    DSN
  For more info use "HELP <topic>".
  To report bugs in the implementation send email to
      sendmail-bugs@sendmail.org.
  For local information send email to Postmaster at your site.
  End of HELP info
  >>> s.putcmd("vrfy","someone@here")
  >>> s.getreply()
  (250, "Somebody OverHere <somebody@here.my.org>")
  >>> s.quit()
�N)�body_encode�
SMTPException�SMTPServerDisconnected�SMTPResponseException�SMTPSenderRefused�SMTPRecipientsRefused�
SMTPDataError�SMTPConnectError�
SMTPHeloError�SMTPAuthenticationError�	quoteaddr�	quotedata�SMTP�i�z
s
i z	auth=(.*)c@seZdZdZdS)rz4Base class for all exceptions raised by this module.N)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.6/smtplib.pyrGsc@seZdZdZdS)�SMTPNotSupportedErrorz�The command or option is not supported by the SMTP server.

    This exception is raised when an attempt is made to run a command or a
    command with an option which is not supported by the server.
    N)rrrrrrrrrJsrc@seZdZdZdS)rz�Not connected to any SMTP server.

    This exception is raised when the server unexpectedly disconnects,
    or when an attempt is made to use the SMTP instance before
    connecting it to a server.
    N)rrrrrrrrrQsc@seZdZdZdd�ZdS)ra2Base class for all exceptions that include an SMTP error code.

    These exceptions are generated in some instances when the SMTP
    server returns an error code.  The error code is stored in the
    `smtp_code' attribute of the error, and the `smtp_error' attribute
    is set to the error message.
    cCs||_||_||f|_dS)N)�	smtp_code�
smtp_error�args)�self�code�msgrrr�__init__bszSMTPResponseException.__init__N)rrrrrrrrrrYsc@seZdZdZdd�ZdS)rz�Sender address refused.

    In addition to the attributes set by on all SMTPResponseException
    exceptions, this sets `sender' to the string that the SMTP refused.
    cCs"||_||_||_|||f|_dS)N)rr�senderr)rrrrrrrrnszSMTPSenderRefused.__init__N)rrrrrrrrrrgsc@seZdZdZdd�ZdS)rz�All recipient addresses refused.

    The errors for each recipient are accessible through the attribute
    'recipients', which is a dictionary of exactly the same sort as
    SMTP.sendmail() returns.
    cCs||_|f|_dS)N)�
recipientsr)rrrrrr|szSMTPRecipientsRefused.__init__N)rrrrrrrrrrtsc@seZdZdZdS)rz'The SMTP server didn't accept the data.N)rrrrrrrrr�sc@seZdZdZdS)r	z&Error during connection establishment.N)rrrrrrrrr	�sc@seZdZdZdS)r
z"The server refused our HELO reply.N)rrrrrrrrr
�sc@seZdZdZdS)rzvAuthentication error.

    Most probably the server didn't accept the username/password
    combination provided.
    N)rrrrrrrrr�scCs>tjj|�\}}||fdkr6|j�jd�r.|Sd|Sd|S)z�Quote a subset of the email addresses defined by RFC 821.

    Should be able to handle anything email.utils.parseaddr can handle.
    ��<z<%s>)r r )�email�utils�	parseaddr�strip�
startswith)�
addrstring�displayname�addrrrrr�scCs$tjj|�\}}||fdkr |S|S)Nr )r r )r"r#r$)r'r(r)rrr�
_addr_only�sr*cCstjddtjdt|��S)z�Quote data for email.

    Double leading '.', and change Unix newline '\n', or Mac '\r' into
    Internet CRLF end-of-line.
    z(?m)^\.z..z(?:\r\n|\n|\r(?!\n)))�re�sub�CRLF)�datarrrr
�scCstjdd|�S)Ns(?m)^\.s..)r+r,)Zbindatarrr�_quote_periods�sr/cCstjdt|�S)Nz(?:\r\n|\n|\r(?!\n)))r+r,r-)r.rrr�	_fix_eols�sr0FTc@s�eZdZdZdZdZdZdZdZdZ	e
Zdddej
dfdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�ZdMdd�Zdd�ZdNdd�Zdd�ZdOdd�ZdPdd�ZdQdd �Zd!d"�ZdRd#d$�Zd%d&�Zd'd(�Zd)d*�Zffd+d,�Z ffd-d.�Z!d/d0�Z"d1d2�Z#e#Z$d3d4�Z%d5d6�Z&d7d8�d9d:�Z'dSd;d<�Z(dTd=d>�Z)dUd?d@�Z*d7d8�dAdB�Z+dVdCdD�Z,fffdEdF�Z-ddfffdGdH�Z.dIdJ�Z/dKdL�Z0dS)Wra�This class manages a connection to an SMTP or ESMTP server.
    SMTP Objects:
        SMTP objects have the following attributes:
            helo_resp
                This is the message given by the server in response to the
                most recent HELO command.

            ehlo_resp
                This is the message given by the server in response to the
                most recent EHLO command. This is usually multiline.

            does_esmtp
                This is a True value _after you do an EHLO command_, if the
                server supports ESMTP.

            esmtp_features
                This is a dictionary, which, if the server supports ESMTP,
                will _after you do an EHLO command_, contain the names of the
                SMTP service extensions this server supports, and their
                parameters (if any).

                Note, all extension names are mapped to lower case in the
                dictionary.

        See each method's docstrings for details.  In general, there is a
        method of the same name to perform each SMTP command.  There is also a
        method called 'sendmail' that will do an entire mail transaction.
        rN�ehlor c
Cs�||_||_i|_d|_||_|rL|j||�\}}|dkrL|j�t||��|dk	r\||_nPt	j
�}d|krt||_n8d}	yt	jt	j��}	Wnt	j
k
r�YnXd|	|_dS)aInitialize a new instance.

        If specified, `host' is the name of the remote host to which to
        connect.  If specified, `port' specifies the port to which to connect.
        By default, smtplib.SMTP_PORT is used.  If a host is specified the
        connect method is called, and if it returns anything other than a
        success code an SMTPConnectError is raised.  If specified,
        `local_hostname` is used as the FQDN of the local host in the HELO/EHLO
        command.  Otherwise, the local hostname is found using
        socket.getfqdn(). The `source_address` parameter takes a 2-tuple (host,
        port) for the socket to bind to as its source address before
        connecting. If the host is '' and port is 0, the OS default behavior
        will be used.

        �ascii��N�.z	127.0.0.1z[%s])�_host�timeout�esmtp_features�command_encoding�source_address�connect�closer	�local_hostname�socketZgetfqdnZ
gethostbynameZgethostnameZgaierror)
r�host�portr<r6r9rrZfqdnr)rrrr�s*
z
SMTP.__init__cCs|S)Nr)rrrr�	__enter__szSMTP.__enter__cGsNz>y$|jd�\}}|dkr$t||��Wntk
r:YnXWd|j�XdS)NZQUIT��)�docmdrrr;)rrr�messagerrr�__exit__s
z
SMTP.__exit__cCs
||_dS)z�Set the debug output level.

        A non-false value results in debug messages for connection and for all
        messages sent to and received from the server.

        N)�
debuglevel)rrErrr�set_debuglevelszSMTP.set_debuglevelcGs@|jdkr,ttjj�j�f|�dtji�nt|dtji�dS)N��file)rE�print�datetimeZnowZtime�sys�stderr)rrrrr�_print_debug's
"zSMTP._print_debugcCs2|jdkr|jd||f|j�tj||f||j�S)Nrzconnect: to)rErMr9r=�create_connection)rr>r?r6rrr�_get_socket-s
zSMTP._get_socket�	localhostcCs�|r
||_|r~|jd�|jd�kr~|jd�}|dkr~|d|�||dd�}}yt|�}Wntk
r|td��YnX|s�|j}|jdkr�|jd||f�|j	|||j
�|_d|_|j
�\}}|jdkr�|jdt|��||fS)apConnect to a host on a given port.

        If the hostname ends with a colon (`:') followed by a number, and
        there is no port specified, that suffix will be stripped off and the
        number interpreted as the port number to use.

        Note: This method is automatically invoked by __init__, if a host is
        specified during instantiation.

        �:rNrGznonnumeric portzconnect:)r9�find�rfind�int�
ValueError�OSError�default_portrErMrOr6�sockrH�getreply�repr)rr>r?r9�irrrrrr:5s(


zSMTP.connectcCs�|jdkr|jdt|��t|d�rx|jrxt|t�r@|j|j�}y|jj	|�Wq�t
k
rt|j�td��Yq�Xntd��dS)zSend `s' to the server.rzsend:rXzServer not connectedzplease run connect() firstN)
rErMrZ�hasattrrX�
isinstance�str�encoder8ZsendallrVr;r)r�srrr�sendWs

z	SMTP.sendcCs2|dkrd|tf}nd||tf}|j|�dS)zSend a command to the server.r z%s%sz%s %s%sN)r-ra)r�cmdrr^rrr�putcmdiszSMTP.putcmdcCsPg}|jdkr|jjd�|_�xy|jjtd�}Wn:tk
rn}z|j�tdt|���WYdd}~XnX|s�|j�td��|j	dkr�|j
dt|��t|�tkr�|j�t
dd	��|j|d
d�jd��|dd�}yt|�}Wntk
�rd}PYnX|dd
�d
kr Pq Wdj|�}|j	dk�rH|j
d||f�||fS)a�Get a reply from the server.

        Returns a tuple consisting of:

          - server response code (e.g. '250', or such, if all goes well)
            Note: returns -1 if it can't read response code.

          - server response string corresponding to response code (multiline
            responses are converted to a single, multiline string).

        Raises SMTPServerDisconnected if end-of-file is reached.
        N�rbrGz Connection unexpectedly closed: zConnection unexpectedly closedrzreply:i�zLine too long.�s 	
��-�
zreply: retcode (%s); Msg: %a���)rHrX�makefile�readline�_MAXLINErVr;rr^rErMrZ�lenr�appendr%rTrU�join)r�resp�line�erZerrcode�errmsgrrrrYqs>




z
SMTP.getreplycCs|j||�|j�S)z-Send a command, and return its response code.)rcrY)rrbrrrrrB�sz
SMTP.docmdcCs,|jd|p|j�|j�\}}||_||fS)zwSMTP 'helo' command.
        Hostname to send for this command defaults to the FQDN of the local
        host.
        �helo)rcr<rY�	helo_resp)r�namerrrrrrt�sz	SMTP.heloc
Cs2i|_|j|j|p|j�|j�\}}|d
krJt|�dkrJ|j�td��||_|dkr`||fSd|_	|jj
d�jd�}|d=x�|D]�}tj
|�}|r�|jjdd�d	|jd�d|jd<q�tj
d
|�}|r�|jd�j�}|j|jd�d�j�}	|dk�r|jj|d�d	|	|j|<q�|	|j|<q�W||fS)zx SMTP 'ehlo' command.
        Hostname to send for this command defaults to the FQDN of the local
        host.
        rGrzServer not connected�zlatin-1�
�authr � z((?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*) ?�featureNri)r7rc�ehlo_msgr<rYrmr;r�	ehlo_resp�
does_esmtp�decode�split�
OLDSTYLE_AUTH�match�get�groupsr+�group�lower�string�endr%)
rrvrrrp�eachZ
auth_match�mr{Zparamsrrrr1�s2

&
z	SMTP.ehlocCs|j�|jkS)z7Does the server support a given SMTP service extension?)r�r7)r�optrrr�has_extn�sz
SMTP.has_extncCs|jd|�|j�dS)z;SMTP 'help' command.
        Returns help text from server.�helprG)rcrY)rrrrrr��sz	SMTP.helpcCsd|_|jd�S)z&SMTP 'rset' command -- resets session.r2�rset)r8rB)rrrrr��sz	SMTP.rsetcCs&y|j�Wntk
r YnXdS)aInternal 'rset' command which ignores any SMTPServerDisconnected error.

        Used internally in the library, since the server disconnected error
        should appear to the application when the *next* command is issued, if
        we are doing an internal "safety" reset.
        N)r�r)rrrr�_rset�sz
SMTP._rsetcCs
|jd�S)z-SMTP 'noop' command -- doesn't do anything :>�noop)rB)rrrrr�sz	SMTP.noopcCshd}|rH|jrHtdd�|D��r:|jd�r2d|_ntd��ddj|�}|jdd	t|�|f�|j�S)
a8SMTP 'mail' command -- begins mail xfer session.

        This method may raise the following exceptions:

         SMTPNotSupportedError  The options parameter includes 'SMTPUTF8'
                                but the SMTPUTF8 extension is not supported by
                                the server.
        r css|]}|j�dkVqdS)�smtputf8N)r�)�.0�xrrr�	<genexpr>szSMTP.mail.<locals>.<genexpr>r�zutf-8z SMTPUTF8 not supported by serverrz�mailz	FROM:%s%s)	r~�anyr�r8rrorcrrY)rr�options�
optionlistrrrr�s	

z	SMTP.mailcCs<d}|r|jrddj|�}|jddt|�|f�|j�S)z;SMTP 'rcpt' command -- indicates 1 recipient for this mail.r rz�rcptzTO:%s%s)r~rorcrrY)rZrecipr�r�rrrr�s

z	SMTP.rcptcCs�|jd�|j�\}}|jdkr0|jd||f�|dkrDt||��n|t|t�r\t|�jd�}t	|�}|d	d�t
kr||t
}|dt
}|j|�|j�\}}|jdkr�|jd||f�||fSdS)
a�SMTP 'DATA' command -- sends message data to server.

        Automatically quotes lines beginning with a period per rfc821.
        Raises SMTPDataError if there is an unexpected reply to the
        DATA command; the return value from this method is the final
        response code received when the all data is sent.  If msg
        is a string, lone '\r' and '\n' characters are converted to
        '\r\n' characters.  If msg is bytes, it is transmitted as is.
        r.rzdata:ibr2�N�.���)rcrYrErMrr]r^r0r_r/�bCRLFra)rrr�repl�qrrrr.!s"





z	SMTP.datacCs|jdt|��|j�S)z5SMTP 'verify' command -- checks for address validity.�vrfy)rcr*rY)r�addressrrr�verify>szSMTP.verifycCs|jdt|��|j�S)z.SMTP 'expn' command -- expands a mailing list.�expn)rcr*rY)rr�rrrr�Esz	SMTP.expncCsf|jdkrb|jdkrbd|j�dko.dknsb|j�\}}d|koRdknsbt||��dS)abCall self.ehlo() and/or self.helo() if needed.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
        N��ri+)rur}r1rtr
)rrrprrr�ehlo_or_helo_if_neededLs
 zSMTP.ehlo_or_helo_if_neededT)�initial_response_okc	Cs�|j�}|r|�nd}|dk	rJt|jd�dd�}|jd|d|�\}}n|jd|�\}}|dkr�tj|�}t||�jd�dd�}|j|�\}}|d
kr�||fSt||��dS)a�Authentication command - requires response processing.

        'mechanism' specifies which authentication mechanism is to
        be used - the valid values are those listed in the 'auth'
        element of 'esmtp_features'.

        'authobject' must be a callable object taking a single argument:

                data = authobject(challenge)

        It will be called to process the server's challenge response; the
        challenge argument it is passed will be a bytes.  It should return
        an ASCII string that will be base64 encoded and sent to the server.

        Keyword arguments:
            - initial_response_ok: Allow sending the RFC 4954 initial-response
              to the AUTH command, if the authentication methods supports it.
        Nr2r )ZeolZAUTHrziN���)r�r�)�upper�
encode_base64r_rB�base64Zdecodebytesr)	rZ	mechanismZ
authobjectr�Zinitial_responseZresponserrp�	challengerrrry]s
z	SMTP.authcCs0|dkrdS|jdtj|jjd�|d�j�S)zh Authobject to use with CRAM-MD5 authentication. Requires self.user
        and self.password to be set.Nrzr2Zmd5)�user�hmacZHMAC�passwordr_Z	hexdigest)rr�rrr�
auth_cram_md5�szSMTP.auth_cram_md5cCsd|j|jfS)ze Authobject to use with PLAIN authentication. Requires self.user and
        self.password to be set.z%s%s)r�r�)rr�rrr�
auth_plain�szSMTP.auth_plaincCs|dkr|jS|jSdS)ze Authobject to use with LOGIN authentication. Requires self.user and
        self.password to be set.N)r�r�)rr�rrr�
auth_login�szSMTP.auth_logincs�|j�|jd�std��|jdj��dddg}�fdd�|D�}|sPtd��|||_|_xv|D]n}d	|j�j	d
d�}y.|j
|t||�|d�\}}	|dkr�||	fSWqdtk
r�}
z
|
}WYdd}
~
XqdXqdW|�dS)awLog in on an SMTP server that requires authentication.

        The arguments are:
            - user:         The user name to authenticate with.
            - password:     The password for the authentication.

        Keyword arguments:
            - initial_response_ok: Allow sending the RFC 4954 initial-response
              to the AUTH command, if the authentication methods supports it.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.

        This method will return normally if the authentication was successful.

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
         SMTPAuthenticationError  The server didn't accept the username/
                                  password combination.
         SMTPNotSupportedError    The AUTH command is not supported by the
                                  server.
         SMTPException            No suitable authentication method was
                                  found.
        ryz,SMTP AUTH extension not supported by server.zCRAM-MD5ZPLAINZLOGINcsg|]}|�kr|�qSrr)r�ry)�advertised_authlistrr�
<listcomp>�szSMTP.login.<locals>.<listcomp>z(No suitable authentication method found.Zauth_�-�_)r�r��N)r�r�)
r�r�rr7r�rr�r�r��replacery�getattrr)rr�r�r�Zpreferred_authsZauthlistZ
authmethodZmethod_namerrprrZlast_exceptionr)r�r�login�s*



z
SMTP.logincCs�|j�|jd�std��|jd�\}}|dkr�ts<td��|dk	rT|dk	rTtd��|dk	rl|dk	rltd��|dk	s||dk	r�d	dl}|jd
t	d�|dkr�t
j||d�}|j|j
|jd
�|_
d|_d|_d|_i|_d	|_n
t||��||fS)a�Puts the connection to the SMTP server into TLS mode.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.

        If the server supports TLS, this will encrypt the rest of the SMTP
        session. If you provide the keyfile and certfile parameters,
        the identity of the SMTP server and client can be checked. This,
        however, depends on whether the socket module really checks the
        certificates.

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
        �starttlsz+STARTTLS extension not supported by server.ZSTARTTLSr3z&No SSL support included in this PythonNz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadr�)�certfile�keyfile)�server_hostname)r�r�rrB�	_have_ssl�RuntimeErrorrU�warnings�warn�DeprecationWarning�ssl�_create_stdlib_context�wrap_socketrXr5rHrur}r7r~r)rr�r��contextrpZreplyr�rrrr��s8

z
SMTP.starttlscCsf|j�g}t|t�r$t|�jd�}|jr^|jd�rF|jdt|��x|D]}|j|�qLW|j	||�\}}	|dkr�|dkr�|j
�n|j�t||	|��i}
t|t�r�|g}xP|D]H}|j
||�\}}	|dkr�|dkr�||	f|
|<|dkr�|j
�t|
��q�Wt|
�t|�k�r$|j�t|
��|j|�\}}	|dk�rb|dk�rP|j
�n|j�t||	��|
S)a|This command performs an entire mail transaction.

        The arguments are:
            - from_addr    : The address sending this mail.
            - to_addrs     : A list of addresses to send this mail to.  A bare
                             string will be treated as a list with 1 address.
            - msg          : The message to send.
            - mail_options : List of ESMTP options (such as 8bitmime) for the
                             mail command.
            - rcpt_options : List of ESMTP options (such as DSN commands) for
                             all the rcpt commands.

        msg may be a string containing characters in the ASCII range, or a byte
        string.  A string is encoded to bytes using the ascii codec, and lone
        \r and \n characters are converted to \r\n characters.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.  If the server does ESMTP, message size
        and each of the specified options will be passed to it.  If EHLO
        fails, HELO will be tried and ESMTP options suppressed.

        This method will return normally if the mail is accepted for at least
        one recipient.  It returns a dictionary, with one entry for each
        recipient that was refused.  Each entry contains a tuple of the SMTP
        error code and the accompanying error message sent by the server.

        This method may raise the following exceptions:

         SMTPHeloError          The server didn't reply properly to
                                the helo greeting.
         SMTPRecipientsRefused  The server rejected ALL recipients
                                (no mail was sent).
         SMTPSenderRefused      The server didn't accept the from_addr.
         SMTPDataError          The server replied with an unexpected
                                error code (other than a refusal of
                                a recipient).
         SMTPNotSupportedError  The mail_options parameter includes 'SMTPUTF8'
                                but the SMTPUTF8 extension is not supported by
                                the server.

        Note: the connection will be open even after an exception is raised.

        Example:

         >>> import smtplib
         >>> s=smtplib.SMTP("localhost")
         >>> tolist=["one@one.org","two@two.org","three@three.org","four@four.org"]
         >>> msg = '''\
         ... From: Me@my.org
         ... Subject: testin'...
         ...
         ... This is a test '''
         >>> s.sendmail("me@my.org",tolist,msg)
         { "three@three.org" : ( 550 ,"User unknown" ) }
         >>> s.quit()

        In the above example, the message was accepted for delivery to three
        of the four addresses, and one was rejected, with the error code
        550.  If all addresses are accepted, then the method will return an
        empty dictionary.

        r2�sizezsize=%drwi��)r�r]r^r0r_r~r�rnrmr�r;r�rr�rr.r)r�	from_addr�to_addrsr�mail_options�rcpt_optionsZ
esmtp_optsZoptionrrpZsenderrsr�rrr�sendmailsF@









z
SMTP.sendmailcCs�|j�|jd�}|dkr d}nt|�dkr2d}ntd��|dkr||d|krZ||dn
||d}tjj|g�d	d}|dkr�d
d�||d||d
||dfD�}dd�tjj|�D�}tj|�}	|	d
=|	d=d}
ydj|f|��j	d�Wn.t
k
�r(|jd��s td��d}
YnXt
j��R}|
�r^tjj||jjdd�d�}|d�}ntjj|�}|j|	dd�|j�}
WdQRX|j|||
||�S)a~Converts message to a bytestring and passes it to sendmail.

        The arguments are as for sendmail, except that msg is an
        email.message.Message object.  If from_addr is None or to_addrs is
        None, these arguments are taken from the headers of the Message as
        described in RFC 2822 (a ValueError is raised if there is more than
        one set of 'Resent-' headers).  Regardless of the values of from_addr and
        to_addr, any Bcc field (or Resent-Bcc field, when the Message is a
        resent) of the Message object won't be transmitted.  The Message
        object is then serialized using email.generator.BytesGenerator and
        sendmail is called to transmit the message.  If the sender or any of
        the recipient addresses contain non-ASCII and the server advertises the
        SMTPUTF8 capability, the policy is cloned with utf8 set to True for the
        serialization, and SMTPUTF8 and BODY=8BITMIME are asserted on the send.
        If the server does not support SMTPUTF8, an SMTPNotSupported error is
        raised.  Otherwise the generator is called without modifying the
        policy.

        zResent-DateNr rGzResent-z0message has more than one 'Resent-' header blockZSender�FromrcSsg|]}|dk	r|�qS)Nr)r��frrrr��sz%SMTP.send_message.<locals>.<listcomp>�ToZBccZCccSsg|]}|d�qS)rGr)r��arrrr��sz
Resent-BccFr2r�z�One or more source or delivery addresses require internationalized email support, but the server does not advertise the required SMTPUTF8 capabilityT)�utf8)�policy�SMTPUTF8�
BODY=8BITMIMEz
)�linesep)r�r�)r�Zget_allrmrUr"r#Zgetaddresses�copyror_�UnicodeEncodeErrorr�r�io�BytesIO�	generatorZBytesGeneratorr�ZcloneZflatten�getvaluer�)rrr�r�r�r�ZresentZ
header_prefixZaddr_fieldsZmsg_copyZ
internationalZbytesmsg�gZflatmsgrrr�send_message|sJ





zSMTP.send_messagecCs<z|j}d|_|r|j�Wd|j}d|_|r6|j�XdS)z(Close the connection to the SMTP server.N)rHr;rX)rrHrXrrrr;�sz
SMTP.closecCs.|jd�}d|_|_i|_d|_|j�|S)zTerminate the SMTP session.�quitNF)rBr}rur7r~r;)r�resrrrr��s
z	SMTP.quit)rPrN)r )r )r )r )r )N)N)N)NNN)1rrrrrErHrur|r}r~�	SMTP_PORTrWr=�_GLOBAL_DEFAULT_TIMEOUTrr@rDrFrMrOr:rarcrYrBrtr1r�r�r�r�r�r�r�r.r�r�r�r�ryr�r�r�r�r�r�r�r;r�rrrrr�s^-
	
"
1



3
'
	

B
8gL
c@s8eZdZdZeZdddddejddfdd�Zdd�Z	dS)	�SMTP_SSLa� This is a subclass derived from SMTP that connects over an SSL
        encrypted socket (to use this class you need a socket module that was
        compiled with SSL support). If host is not specified, '' (the local
        host) is used. If port is omitted, the standard SMTP-over-SSL port
        (465) is used.  local_hostname and source_address have the same meaning
        as they do in the SMTP class.  keyfile and certfile are also optional -
        they can contain a PEM formatted private key and certificate chain file
        for the SSL connection. context also optional, can contain a
        SSLContext, and is an alternative to keyfile and certfile; If it is
        specified both keyfile and certfile must be None.

        r rNc	
Cs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}	|	jdtd�||_||_|dkrxtj||d�}||_t	j
||||||�dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadr�)r�r�)rUr�r�r�r�r�r�r�r�rr)
rr>r?r<r�r�r6r9r�r�rrrr�s zSMTP_SSL.__init__cCsD|jdkr|jd||f�tj||f||j�}|jj||jd�}|S)Nrzconnect:)r�)rErMr=rNr9r�r�r5)rr>r?r6Z
new_socketrrrrO	s

zSMTP_SSL._get_socket)
rrrr�
SMTP_SSL_PORTrWr=r�rrOrrrrr��sr�i�c@s0eZdZdZdZdeddfdd�Zdd	d
�ZdS)�LMTPa�LMTP - Local Mail Transfer Protocol

    The LMTP protocol, which is very similar to ESMTP, is heavily based
    on the standard SMTP client. It's common to use Unix sockets for
    LMTP, so our connect() method must support that as well as a regular
    host:port server.  local_hostname and source_address have the same
    meaning as they do in the SMTP class.  To specify a Unix socket,
    you must use an absolute path as the host, starting with a '/'.

    Authentication is supported, using the regular SMTP mechanism. When
    using a Unix socket, LMTP generally don't support or require any
    authentication, but your mileage might vary.Zlhlor NcCstj|||||d�dS)zInitialize a new instance.)r<r9N)rr)rr>r?r<r9rrrr)sz
LMTP.__init__rPrcCs�|ddkrtj||||d�Sy(tjtjtj�|_d|_|jj|�WnBtk
r�|jdkrl|j	d|�|jr||jj
�d|_�YnX|j�\}}|jdkr�|j	d|�||fS)z=Connect to the LMTP daemon, on either a Unix or a TCP socket.r�/)r9Nz
connect fail:zconnect:)rr:r=ZAF_UNIXZSOCK_STREAMrXrHrVrErMr;rY)rr>r?r9rrrrrr:/s"


zLMTP.connect)rPrN)rrrrr|�	LMTP_PORTrr:rrrrr�s
r��__main__cCs(tjj|d�tjj�tjj�j�S)Nz: )rK�stdout�write�flush�stdinrkr%)�promptrrrr�Is
r�r�r��,zEnter message, end with ^D:r zMessage length is %drPrG)@rr=r�r+Zemail.utilsr"Z
email.messageZemail.generatorr�r�r�rJrKZemail.base64mimerr��__all__r�r�r-r�rl�compile�Ir�rVrrrrrrrr	r
rrr*r
r/r0r��ImportErrorr�rr�rnr�r�rr�Zfromaddrr�ZtoaddrsrIrr�rkrqrmZserverrFr�r�rrrr�<module>!s�



	
)0
/


configparser.cpython-36.pyc000064400000130276150335715140011671 0ustar003


 \X��@s�dZddlmZddlmZmZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddddd	d
ddd
ddddddddddddgZdZdZGdd�de�ZGdd�de�ZGdd�de�ZGd d�de�ZGd!d�de�ZGd"d	�d	e�ZGd#d�de�ZGd$d�de�ZGd%d
�d
e�ZGd&d
�d
e�ZGd'd�de�Ze�ZGd(d�d�Z Gd)d�de �Z!Gd*d�de �Z"Gd+d�de �Z#Gd,d�de�Z$Gd-d�de$�Z%Gd.d�de%�Z&Gd/d�de�Z'Gd0d�de�Z(dS)1a�Configuration file parser.

A configuration file consists of sections, lead by a "[section]" header,
and followed by "name: value" entries, with continuations and such in
the style of RFC 822.

Intrinsic defaults can be specified by passing them into the
ConfigParser constructor as a dictionary.

class:

ConfigParser -- responsible for parsing a list of
                    configuration files, and managing the parsed database.

    methods:

    __init__(defaults=None, dict_type=_default_dict, allow_no_value=False,
             delimiters=('=', ':'), comment_prefixes=('#', ';'),
             inline_comment_prefixes=None, strict=True,
             empty_lines_in_values=True, default_section='DEFAULT',
             interpolation=<unset>, converters=<unset>):
        Create the parser. When `defaults' is given, it is initialized into the
        dictionary or intrinsic defaults. The keys must be strings, the values
        must be appropriate for %()s string interpolation.

        When `dict_type' is given, it will be used to create the dictionary
        objects for the list of sections, for the options within a section, and
        for the default values.

        When `delimiters' is given, it will be used as the set of substrings
        that divide keys from values.

        When `comment_prefixes' is given, it will be used as the set of
        substrings that prefix comments in empty lines. Comments can be
        indented.

        When `inline_comment_prefixes' is given, it will be used as the set of
        substrings that prefix comments in non-empty lines.

        When `strict` is True, the parser won't allow for any section or option
        duplicates while reading from a single source (file, string or
        dictionary). Default is True.

        When `empty_lines_in_values' is False (default: True), each empty line
        marks the end of an option. Otherwise, internal empty lines of
        a multiline option are kept as part of the value.

        When `allow_no_value' is True (default: False), options without
        values are accepted; the value presented for these is None.

        When `default_section' is given, the name of the special section is
        named accordingly. By default it is called ``"DEFAULT"`` but this can
        be customized to point to any other valid section name. Its current
        value can be retrieved using the ``parser_instance.default_section``
        attribute and may be modified at runtime.

        When `interpolation` is given, it should be an Interpolation subclass
        instance. It will be used as the handler for option value
        pre-processing when using getters. RawConfigParser object s don't do
        any sort of interpolation, whereas ConfigParser uses an instance of
        BasicInterpolation. The library also provides a ``zc.buildbot``
        inspired ExtendedInterpolation implementation.

        When `converters` is given, it should be a dictionary where each key
        represents the name of a type converter and each value is a callable
        implementing the conversion from string to the desired datatype. Every
        converter gets its corresponding get*() method on the parser object and
        section proxies.

    sections()
        Return all the configuration section names, sans DEFAULT.

    has_section(section)
        Return whether the given section exists.

    has_option(section, option)
        Return whether the given option exists in the given section.

    options(section)
        Return list of configuration options for the named section.

    read(filenames, encoding=None)
        Read and parse the iterable of named configuration files, given by
        name.  A single filename is also allowed.  Non-existing files
        are ignored.  Return list of successfully read files.

    read_file(f, filename=None)
        Read and parse one configuration file, given as a file object.
        The filename defaults to f.name; it is only used in error
        messages (if f has no `name' attribute, the string `<???>' is used).

    read_string(string)
        Read configuration from a given string.

    read_dict(dictionary)
        Read configuration from a dictionary. Keys are section names,
        values are dictionaries with keys and values that should be present
        in the section. If the used dictionary type preserves order, sections
        and their keys will be added in order. Values are automatically
        converted to strings.

    get(section, option, raw=False, vars=None, fallback=_UNSET)
        Return a string value for the named option.  All % interpolations are
        expanded in the return values, based on the defaults passed into the
        constructor and the DEFAULT section.  Additional substitutions may be
        provided using the `vars' argument, which must be a dictionary whose
        contents override any pre-existing defaults. If `option' is a key in
        `vars', the value from `vars' is used.

    getint(section, options, raw=False, vars=None, fallback=_UNSET)
        Like get(), but convert value to an integer.

    getfloat(section, options, raw=False, vars=None, fallback=_UNSET)
        Like get(), but convert value to a float.

    getboolean(section, options, raw=False, vars=None, fallback=_UNSET)
        Like get(), but convert value to a boolean (currently case
        insensitively defined as 0, false, no, off for False, and 1, true,
        yes, on for True).  Returns False or True.

    items(section=_UNSET, raw=False, vars=None)
        If section is given, return a list of tuples with (name, value) for
        each option in the section. Otherwise, return a list of tuples with
        (section_name, section_proxy) for each section, including DEFAULTSECT.

    remove_section(section)
        Remove the given file section and all its options.

    remove_option(section, option)
        Remove the given option from the given section.

    set(section, option, value)
        Set the given option.

    write(fp, space_around_delimiters=True)
        Write the configuration state in .ini format. If
        `space_around_delimiters' is True (the default), delimiters
        between keys and values are surrounded by spaces.
�)�MutableMapping)�OrderedDict�ChainMapN�NoSectionError�DuplicateOptionError�DuplicateSectionError�
NoOptionError�InterpolationError�InterpolationDepthError�InterpolationMissingOptionError�InterpolationSyntaxError�ParsingError�MissingSectionHeaderError�ConfigParser�SafeConfigParser�RawConfigParser�
Interpolation�BasicInterpolation�ExtendedInterpolation�LegacyInterpolation�SectionProxy�ConverterMapping�DEFAULTSECT�MAX_INTERPOLATION_DEPTHZDEFAULT�
c@s&eZdZdZddd�Zdd�ZeZdS)	�Errorz'Base class for ConfigParser exceptions.�cCs||_tj||�dS)N)�message�	Exception�__init__)�self�msg�r"�$/usr/lib64/python3.6/configparser.pyr�szError.__init__cCs|jS)N)r)r r"r"r#�__repr__�szError.__repr__N)r)�__name__�
__module__�__qualname__�__doc__rr$�__str__r"r"r"r#r�s
rc@seZdZdZdd�ZdS)rz2Raised when no section matches a requested option.cCs$tj|d|f�||_|f|_dS)NzNo section: %r)rr�section�args)r r*r"r"r#r�szNoSectionError.__init__N)r%r&r'r(rr"r"r"r#r�sc@seZdZdZddd�ZdS)raRaised when a section is repeated in an input source.

    Possible repetitions that raise this exception are: multiple creation
    using the API or in strict parsers when a section is found more than once
    in a single input file, string or dictionary.
    NcCs�t|�dg}|dk	rRdt|�g}|dk	r8|jdj|��|jd�|j|�|}n|jdd�tj|dj|��||_||_	||_
|||f|_dS)Nz already existszWhile reading from z [line {0:2d}]z
: section rzSection r)�repr�append�format�extend�insertrr�joinr*�source�linenor+)r r*r2r3r!rr"r"r#r�s

zDuplicateSectionError.__init__)NN)r%r&r'r(rr"r"r"r#r�sc@seZdZdZddd�ZdS)rz�Raised by strict parsers when an option is repeated in an input source.

    Current implementation raises this exception only when an option is found
    more than once in a single file, string or dictionary.
    NcCs�t|�dt|�dg}|dk	rZdt|�g}|dk	r@|jdj|��|jd�|j|�|}n|jdd�tj|dj|��||_||_	||_
||_||||f|_dS)	Nz in section z already existszWhile reading from z [line {0:2d}]z	: option rzOption r)
r,r-r.r/r0rrr1r*�optionr2r3r+)r r*r4r2r3r!rr"r"r#r�s 

zDuplicateOptionError.__init__)NN)r%r&r'r(rr"r"r"r#r�sc@seZdZdZdd�ZdS)rz!A requested option was not found.cCs.tj|d||f�||_||_||f|_dS)NzNo option %r in section: %r)rrr4r*r+)r r4r*r"r"r#r�s
zNoOptionError.__init__N)r%r&r'r(rr"r"r"r#r�sc@seZdZdZdd�ZdS)r	z0Base class for interpolation-related exceptions.cCs(tj||�||_||_|||f|_dS)N)rrr4r*r+)r r4r*r!r"r"r#rszInterpolationError.__init__N)r%r&r'r(rr"r"r"r#r	�sc@seZdZdZdd�ZdS)rzAA string substitution required a setting which was not available.cCs8dj||||�}tj||||�||_||||f|_dS)Nz�Bad value substitution: option {!r} in section {!r} contains an interpolation key {!r} which is not a valid option name. Raw value: {!r})r.r	r�	referencer+)r r4r*�rawvalr5r!r"r"r#r
s
z(InterpolationMissingOptionError.__init__N)r%r&r'r(rr"r"r"r#rsc@seZdZdZdS)rz�Raised when the source text contains invalid syntax.

    Current implementation raises this exception when the source text into
    which substitutions are made does not conform to the required syntax.
    N)r%r&r'r(r"r"r"r#rsc@seZdZdZdd�ZdS)r
z0Raised when substitutions are nested too deeply.cCs0dj||t|�}tj||||�|||f|_dS)Nz�Recursion limit exceeded in value substitution: option {!r} in section {!r} contains an interpolation key which cannot be substituted in {} steps. Raw value: {!r})r.rr	rr+)r r4r*r6r!r"r"r#rs
z InterpolationDepthError.__init__N)r%r&r'r(rr"r"r"r#r
sc@s<eZdZdZd
dd�Zedd��Zejdd��Zdd	�ZdS)r
z>Raised when a configuration file does not follow legal syntax.NcCsX|r|rtd��n|r(|r(td��n|r0|}tj|d|�||_g|_|f|_dS)Nz:Cannot specify both `filename' and `source'. Use `source'.z%Required argument `source' not given.z"Source contains parsing errors: %r)�
ValueErrorrrr2�errorsr+)r r2�filenamer"r"r#r+s

zParsingError.__init__cCstjdtdd�|jS)zDeprecated, use `source'.zSThe 'filename' attribute will be removed in future versions.  Use 'source' instead.�)�
stacklevel)�warnings�warn�DeprecationWarningr2)r r"r"r#r9:s
zParsingError.filenamecCstjdtdd�||_dS)zDeprecated, user `source'.zSThe 'filename' attribute will be removed in future versions.  Use 'source' instead.r:)r;N)r<r=r>r2)r �valuer"r"r#r9Ds
cCs*|jj||f�|jd||f7_dS)Nz
	[line %2d]: %s)r8r-r)r r3�liner"r"r#r-NszParsingError.append)NN)	r%r&r'r(r�propertyr9�setterr-r"r"r"r#r
(s



c@seZdZdZdd�ZdS)rz@Raised when a key-value pair is found before any section header.cCs8tj|d|||f�||_||_||_|||f|_dS)Nz7File contains no section headers.
file: %r, line: %d
%r)rrr2r3r@r+)r r9r3r@r"r"r#rVsz"MissingSectionHeaderError.__init__N)r%r&r'r(rr"r"r"r#rSsc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)rzBDummy interpolation that passes the value through with no changes.cCs|S)Nr")r �parserr*r4r?�defaultsr"r"r#�
before_getjszInterpolation.before_getcCs|S)Nr")r rCr*r4r?r"r"r#�
before_setmszInterpolation.before_setcCs|S)Nr")r rCr*r4r?r"r"r#�before_readpszInterpolation.before_readcCs|S)Nr")r rCr*r4r?r"r"r#�before_writesszInterpolation.before_writeN)r%r&r'r(rErFrGrHr"r"r"r#rgs
c@s2eZdZdZejd�Zdd�Zdd�Zdd�Z	d	S)
ra!Interpolation as implemented in the classic ConfigParser.

    The option values can contain format strings which refer to other values in
    the same section, or values in the special default section.

    For example:

        something: %(dir)s/whatever

    would resolve the "%(dir)s" to the value of dir.  All reference
    expansions are done late, on demand. If a user needs to use a bare % in
    a configuration file, she can escape it by writing %%. Other % usage
    is considered a user error and raises `InterpolationSyntaxError'.z
%\(([^)]+)\)scCs$g}|j||||||d�dj|�S)N�r)�_interpolate_somer1)r rCr*r4r?rD�Lr"r"r#rE�szBasicInterpolation.before_getcCs<|jdd�}|jjd|�}d|kr8td||jd�f��|S)Nz%%r�%z1invalid interpolation syntax in %r at position %d)�replace�_KEYCRE�subr7�find)r rCr*r4r?�	tmp_valuer"r"r#rF�szBasicInterpolation.before_setcCsp|j||d|d�}|tkr&t|||���xB|�rj|jd�}	|	dkrP|j|�dS|	dkrv|j|d|	��||	d�}|dd�}
|
dkr�|jd�|dd�}q*|
dk�rV|jj|�}|dkr�t||d|��|j|j	d��}||j
�d�}y||}
Wn&tk
�r"t||||�d�YnXd|
k�rJ|j
||||
|||d�n
|j|
�q*t||d	|f��q*WdS)
NT)�raw�fallbackrLrrIr:�(z'bad interpolation variable reference %rz/'%%' must be followed by '%%' or '(', found: %r)�getrr
rPr-rN�matchr�optionxform�group�end�KeyErrorrrJ)r rCr4�accum�restr*�map�depthr6�p�c�m�var�vr"r"r#rJ�sF






z$BasicInterpolation._interpolate_someN)
r%r&r'r(�re�compilerNrErFrJr"r"r"r#rws


c@s2eZdZdZejd�Zdd�Zdd�Zdd�Z	d	S)
rzyAdvanced variant of interpolation, supports the syntax used by
    `zc.buildout'. Enables interpolation between sections.z
\$\{([^}]+)\}cCs$g}|j||||||d�dj|�S)NrIr)rJr1)r rCr*r4r?rDrKr"r"r#rE�sz ExtendedInterpolation.before_getcCs<|jdd�}|jjd|�}d|kr8td||jd�f��|S)Nz$$r�$z1invalid interpolation syntax in %r at position %d)rMrNrOr7rP)r rCr*r4r?rQr"r"r#rF�sz ExtendedInterpolation.before_setcCs�|j||d|d�}|tkr&t|||���x�|�r�|jd�}	|	dkrP|j|�dS|	dkrv|j|d|	��||	d�}|dd�}
|
dkr�|jd�|dd�}q*|
dk�r�|jj|�}|dkr�t||d|��|jd�j	d	�}||j
�d�}|}
|}yrt|�dk�r |j|d�}||}nHt|�dk�rV|d}
|j|d�}|j|
|dd
�}nt||d|f��Wn2t
ttfk
�r�t|||d	j|��d�YnXd|k�r�|j|||||
t|j|
dd
��|d�n
|j|�q*t||d|f��q*WdS)
NT)rRrSrfrrIr:�{z'bad interpolation variable reference %r�:)rRzMore than one ':' found: %rz-'$' must be followed by '$' or '{', found: %r)rUrr
rPr-rNrVrrX�splitrY�lenrWrZrrrr1rJ�dict�items)r rCr4r[r\r*r]r^r6r_r`ra�pathZsect�optrcr"r"r#rJ�s^







z'ExtendedInterpolation._interpolate_someN)
r%r&r'r(rdrerNrErFrJr"r"r"r#r�s

c@s6eZdZdZejd�Zdd�Zdd�Ze	dd��Z
d	S)
rz{Deprecated interpolation used in old versions of ConfigParser.
    Use BasicInterpolation or ExtendedInterpolation instead.z%\(([^)]*)\)s|.c
Cs�|}t}x�|r�|d8}|r�d|kr�tj|j|d�}|jj||�}y||}Wq�tk
r�}	zt||||	jd�d�WYdd}	~	Xq�Xq
Pq
W|r�d|kr�t	|||��|S)NrIz%()rCr)
r�	functools�partial�_interpolation_replacerNrOrZrr+r
)
r rCr*r4r?�varsr6r^rM�er"r"r#rEs"(zLegacyInterpolation.before_getcCs|S)Nr")r rCr*r4r?r"r"r#rF#szLegacyInterpolation.before_setcCs,|jd�}|dkr|j�Sd|j|�SdS)NrIz%%(%s)s)rXrW)rVrC�sr"r"r#rq&s
z*LegacyInterpolation._interpolation_replaceN)r%r&r'r(rdrerNrErF�staticmethodrqr"r"r"r#r	s

c
s.eZdZdZdZdZdZe�Ze	j
ee	j�Ze	j
ej
dd�e	j�Ze	j
ej
dd�e	j�Ze	j
d�Zddddd	d	d	d	d
�Zded	fdddedddeeed�dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdfdd�Zdgdd �Zdhd"d#�Zdid%d&�Zdjd'd(�Zd	ded)�d*d+�Z d,d-�Z!d	ded)�d.d/�Z"d	ded)�d0d1�Z#d	ded)�d2d3�Z$d	ded)�d4d5�Z%ed	df�fd6d7�	Z&d8d9�Z'd:d;�Z(d<d=�Z)dkd>d?�Z*dld@dA�Z+dBdC�Z,dDdE�Z-dFdG�Z.dHdI�Z/dJdK�Z0dLdM�Z1dNdO�Z2dPdQ�Z3dRdS�Z4dTdU�Z5dVdW�Z6dXdY�Z7dZd[�Z8d\d]�Z9d^d^d^d_�d`da�Z:e;dbdc��Z<�Z=S)mrz,ConfigParser that does not do interpolation.z�
        \[                                 # [
        (?P<header>[^]]+)                  # very permissive!
        \]                                 # ]
        a�
        (?P<option>.*?)                    # very permissive!
        \s*(?P<vi>{delim})\s*              # any number of space/tab,
                                           # followed by any of the
                                           # allowed delimiters,
                                           # followed by any space/tab
        (?P<value>.*)$                     # everything up to eol
        a�
        (?P<option>.*?)                    # very permissive!
        \s*(?:                             # any number of space/tab,
        (?P<vi>{delim})\s*                 # optionally followed by
                                           # any of the allowed
                                           # delimiters, followed by any
                                           # space/tab
        (?P<value>.*))?$                   # everything up to eol
        z=|:)�delimz\STF)�1�yes�trueZon�0�noZfalseZoffN�=rh�#�;)�
delimiters�comment_prefixes�inline_comment_prefixes�strict�empty_lines_in_values�default_section�
interpolation�
converterscCsX||_|j�|_|j�|_t|�|_|j�|_t||	�|j|	<|rhx$|j�D]\}}
|
|j|j|�<qLWt	|�|_
|dkr�|r�|jn|j|_
nNdjdd�|D��}|r�tj|jj|d�tj�|_
ntj|jj|d�tj�|_
t	|p�f�|_t	|p�f�|_||_||_||_|	|_|
|_|jtk�r*|j|_|jdk�r>t�|_|tk	�rT|jj|�dS)Nr|rh�|css|]}tj|�VqdS)N)rd�escape)�.0�dr"r"r#�	<genexpr>lsz+RawConfigParser.__init__.<locals>.<genexpr>)rv)r|rh) �_dict�	_sections�	_defaultsr�_converters�_proxiesrrlrW�tuple�_delimiters�	OPTCRE_NV�OPTCRE�_optcrer1rdre�_OPT_NV_TMPLr.�VERBOSE�	_OPT_TMPL�_comment_prefixes�_inline_comment_prefixes�_strict�_allow_no_value�_empty_lines_in_valuesr��_interpolation�_UNSET�_DEFAULT_INTERPOLATIONr�update)r rDZ	dict_typeZallow_no_valuerr�r�r�r�r�r�r��keyr?r�r"r"r#rXs>






zRawConfigParser.__init__cCs|jS)N)r�)r r"r"r#rD�szRawConfigParser.defaultscCst|jj��S)z3Return a list of section names, excluding [DEFAULT])�listr��keys)r r"r"r#�sections�szRawConfigParser.sectionscCsJ||jkrtd|��||jkr(t|��|j�|j|<t||�|j|<dS)z�Create a new section in the configuration.

        Raise DuplicateSectionError if a section by the specified name
        already exists. Raise ValueError if name is DEFAULT.
        zInvalid section name: %rN)r�r7r�rr�rr�)r r*r"r"r#�add_section�s

zRawConfigParser.add_sectioncCs
||jkS)z~Indicate whether the named section is present in the configuration.

        The DEFAULT section is not acknowledged.
        )r�)r r*r"r"r#�has_section�szRawConfigParser.has_sectioncCsJy|j|j�}Wntk
r0t|�d�YnX|j|j�t|j��S)z9Return a list of option names for the given section name.N)r��copyrZrr�r�r�r�)r r*Zoptsr"r"r#�options�szRawConfigParser.optionscCs�t|ttjf�r|g}g}xl|D]d}y(t||d��}|j||�WdQRXWntk
rbw YnXt|tj�rztj|�}|j|�q W|S)a�Read and parse a filename or an iterable of filenames.

        Files that cannot be opened are silently ignored; this is
        designed so that you can specify an iterable of potential
        configuration file locations (e.g. current directory, user's
        home directory, systemwide directory), and all existing
        configuration files in the iterable will be read.  A single
        filename may also be given.

        Return list of successfully read files.
        )�encodingN)	�
isinstance�str�os�PathLike�open�_read�OSError�fspathr-)r �	filenamesr�Zread_okr9�fpr"r"r#�read�s

zRawConfigParser.readcCs<|dkr,y
|j}Wntk
r*d}YnX|j||�dS)aPLike read() but the argument must be a file-like object.

        The `f' argument must be iterable, returning one line at a time.
        Optional second argument is the `source' specifying the name of the
        file being read. If not given, it is taken from f.name. If `f' has no
        `name' attribute, `<???>' is used.
        Nz<???>)�name�AttributeErrorr�)r �fr2r"r"r#�	read_file�s

zRawConfigParser.read_file�<string>cCstj|�}|j||�dS)z'Read configuration from a given string.N)�io�StringIOr�)r �stringr2Zsfiler"r"r#�read_string�s
zRawConfigParser.read_string�<dict>cCs�t�}x�|j�D]�\}}t|�}y|j|�Wn(ttfk
rV|jrR||krR�YnX|j|�xl|j�D]`\}}|jt|��}|dk	r�t|�}|jr�||f|kr�t	|||��|j||f�|j|||�qlWqWdS)aRead configuration from a dictionary.

        Keys are section names, values are dictionaries with keys and values
        that should be present in the section. If the used dictionary type
        preserves order, sections and their keys will be added in order.

        All types held in the dictionary are converted to strings during
        reading, including section names, option names and keys.

        Optional second argument is the `source' specifying the name of the
        dictionary being read.
        N)
�setrlr�r�rr7r��addrWr)r Z
dictionaryr2�elements_addedr*r�r�r?r"r"r#�	read_dict�s"

zRawConfigParser.read_dictcCs"tjdtdd�|j||d�dS)z"Deprecated, use read_file instead.zRThis method will be removed in future versions.  Use 'parser.read_file()' instead.r:)r;)r2N)r<r=r>r�)r r�r9r"r"r#�readfp�s
zRawConfigParser.readfp)rRrrrScCs�y|j||�}Wn$tk
r4|tkr,�n|SYnX|j|�}y||}Wn,tk
rx|tkrpt||��n|SYnX|s�|dkr�|S|jj|||||�SdS)a]Get an option value for a given section.

        If `vars' is provided, it must be a dictionary. The option is looked up
        in `vars' (if provided), `section', and in `DEFAULTSECT' in that order.
        If the key is not found and `fallback' is provided, it is used as
        a fallback value. `None' can be provided as a `fallback' value.

        If interpolation is enabled and the optional argument `raw' is False,
        all interpolations are expanded in the return values.

        Arguments `raw', `vars', and `fallback' are keyword only.

        The section DEFAULT is special.
        N)�
_unify_valuesrr�rWrZrr�rE)r r*r4rRrrrSr�r?r"r"r#rU�s"


zRawConfigParser.getcKs||j||f|��S)N)rU)r r*�convr4�kwargsr"r"r#�_get"szRawConfigParser._getcKsDy|j|||f||d�|��Sttfk
r>|tkr:�|SXdS)N)rRrr)r�rrr�)r r*r4r�rRrrrSr�r"r"r#�	_get_conv%szRawConfigParser._get_convcKs|j||tf|||d�|��S)N)rRrrrS)r��int)r r*r4rRrrrSr�r"r"r#�getint0szRawConfigParser.getintcKs|j||tf|||d�|��S)N)rRrrrS)r��float)r r*r4rRrrrSr�r"r"r#�getfloat5szRawConfigParser.getfloatcKs |j|||jf|||d�|��S)N)rRrrrS)r��_convert_to_boolean)r r*r4rRrrrSr�r"r"r#�
getboolean:szRawConfigParser.getbooleanc
s��tkrt�j�S�jj��y�j�j��Wn&tk
rV��jkrRt	���YnX|r�x"|j�D]\}}|��j
|�<qfW���fdd��|r��fdd���fdd��j�D�S)a�Return a list of (name, value) tuples for each option in a section.

        All % interpolations are expanded in the return values, based on the
        defaults passed into the constructor, unless the optional argument
        `raw' is true.  Additional substitutions may be provided using the
        `vars' argument, which must be a dictionary whose contents overrides
        any pre-existing defaults.

        The section DEFAULT is special.
        cs�jj��|�|��S)N)r�rE)r4)r�r*r r"r#�<lambda>Vsz'RawConfigParser.items.<locals>.<lambda>cs�|S)Nr")r4)r�r"r#r�Yscsg|]}|�|�f�qSr"r")r�r4)�value_getterr"r#�
<listcomp>Zsz)RawConfigParser.items.<locals>.<listcomp>)r��superrlr�r�r�r�rZr�rrWr�)r r*rRrrr�r?)�	__class__)r�r*r r�r#rl?s


zRawConfigParser.itemscCs.x$|j�D]}||}||=||fSWt�dS)z�Remove a section from the parser and return it as
        a (section_name, section_proxy) tuple. If no section is present, raise
        KeyError.

        The section DEFAULT is never returned because it cannot be removed.
        N)r�rZ)r r�r?r"r"r#�popitem\s

zRawConfigParser.popitemcCs|j�S)N)�lower)r Z	optionstrr"r"r#rWiszRawConfigParser.optionxformcCsX|s||jkr$|j|�}||jkS||jkr2dS|j|�}||j|kpR||jkSdS)z�Check for the existence of a given option in a given section.
        If the specified `section' is None or an empty string, DEFAULT is
        assumed. If the specified `section' does not exist, returns False.FN)r�rWr�r�)r r*r4r"r"r#�
has_optionls



zRawConfigParser.has_optioncCsn|r|jj||||�}|s&||jkr.|j}n.y|j|}Wntk
rZt|�d�YnX|||j|�<dS)zSet an option.N)r�rFr�r�r�rZrrW)r r*r4r?�sectdictr"r"r#r�zszRawConfigParser.setcCsl|rdj|jd�}n
|jd}|jr>|j||j|jj�|�x(|jD]}|j|||j|j�|�qFWdS)z�Write an .ini-format representation of the configuration state.

        If `space_around_delimiters' is True (the default), delimiters
        between keys and values are surrounded by spaces.
        z {} rN)r.r�r��_write_sectionr�rlr�)r r�Zspace_around_delimitersr�r*r"r"r#�write�s

zRawConfigParser.writecCs~|jdj|��x^|D]V\}}|jj||||�}|dk	s@|jrV|t|�jdd�}nd}|jdj||��qW|jd�dS)z-Write a single section to the specified `fp'.z[{}]
N�
z
	rz{}{}
)r�r.r�rHr�r�rM)r r�Zsection_nameZ
section_itemsZ	delimiterr�r?r"r"r#r��szRawConfigParser._write_sectioncCsf|s||jkr|j}n.y|j|}Wntk
rDt|�d�YnX|j|�}||k}|rb||=|S)zRemove an option.N)r�r�r�rZrrW)r r*r4r��existedr"r"r#�
remove_option�s
zRawConfigParser.remove_optioncCs"||jk}|r|j|=|j|=|S)zRemove a file section.)r�r�)r r*r�r"r"r#�remove_section�s

zRawConfigParser.remove_sectioncCs(||jkr|j|�rt|��|j|S)N)r�r�rZr�)r r�r"r"r#�__getitem__�szRawConfigParser.__getitem__cCs@||jkr|jj�n||jkr.|j|j�|j||i�dS)N)r�r��clearr�r�)r r�r?r"r"r#�__setitem__�s


zRawConfigParser.__setitem__cCs2||jkrtd��|j|�s$t|��|j|�dS)Nz"Cannot remove the default section.)r�r7r�rZr�)r r�r"r"r#�__delitem__�s


zRawConfigParser.__delitem__cCs||jkp|j|�S)N)r�r�)r r�r"r"r#�__contains__�szRawConfigParser.__contains__cCst|j�dS)NrI)rjr�)r r"r"r#�__len__�szRawConfigParser.__len__cCstj|jf|jj��S)N)�	itertools�chainr�r�r�)r r"r"r#�__iter__�szRawConfigParser.__iter__cCs2t�}d}d}d}d}d}d}	�x�t|dd�D�]�\}}
tj}dd�|jD�}x||tjkr�|r�i}
x`|j�D]T\}}|
j||d�}|dkr�ql||
|<|dks�|dkrl|
|dj�rlt||�}qlW|
}qPWx"|j	D]}|
j
�j|�r�d}Pq�W|tjk�rd}|
d|�j
�}|�s^|j�rV|dk�r\|dk	�r\|�r\||dk	�r\||j
d�q.tj}q.|jj|
�}|�rx|j�nd}|dk	�r�|�r�||k�r�||j
|�q.|}|jj|�}|�rL|jd�}||jk�r|j�r�||k�r�t|||��|j|}|j|�n@||jk�r|j}n,|j�}||j|<t||�|j|<|j|�d}q.|dk�rdt|||
��q.|jj|�}|�r|jd	d
d�\}}}|�s�|j|	|||
�}	|j |j!��}|j�r�||f|k�r�t"||||��|j||f�|dk	�r�|j
�}|g||<nd||<q.|j|	|||
�}	q.W|j#�|	�r.|	�dS)
aParse a sectioned configuration file.

        Each section in a configuration file contains a header, indicated by
        a name in square brackets (`[]'), plus key/value options, indicated by
        `name' and `value' delimited with a specific substring (`=' or `:' by
        default).

        Values can span multiple lines, as long as they are indented deeper
        than the first line of the value. Depending on the parser's mode, blank
        lines may be treated as parts of multiline values or ignored.

        Configuration files may include comments, prefixed by specific
        characters (`#' and `;' by default). Comments may appear on their own
        in an otherwise empty line or may be entered in lines holding values or
        section names.
        NrrI)�startcSsi|]
}d|�qS)rI���r")r�r_r"r"r#�
<dictcomp>�sz)RawConfigParser._read.<locals>.<dictcomp>r�headerr4�vir?r�)$r��	enumerate�sys�maxsizer�rlrP�isspace�minr��strip�
startswithr�r-�NONSPACECRE�searchr��SECTCRErVrXr�r�rr�r�r�r�rr�rr��
_handle_errorrW�rstripr�_join_multiline_values)r r��fpnamer�ZcursectZsectnameZoptnamer3Zindent_levelrsr@Z
comment_startZinline_prefixesZ
next_prefixes�prefix�indexr?Zfirst_nonspaceZcur_indent_levelZmor�Zoptvalr"r"r#r��s� 









zRawConfigParser._readcCsz|j|jf}tj|f|jj��}xT|D]L\}}xB|j�D]6\}}t|t�rXdj|�j	�}|j
j||||�||<q8Wq&WdS)Nr�)r�r�r�r�r�rlr�r�r1r�r�rG)r rDZall_sectionsr*r�r��valr"r"r#r�Ys
z&RawConfigParser._join_multiline_valuescCs |st|�}|j|t|��|S)N)r
r-r,)r �excr�r3r@r"r"r#r�eszRawConfigParser._handle_errorc
Cs�i}y|j|}Wn&tk
r8||jkr4t|��YnXi}|rvx2|j�D]&\}}|dk	rdt|�}|||j|�<qLWt|||j�S)z�Create a sequence of lookups with 'vars' taking priority over
        the 'section' which takes priority over the DEFAULTSECT.

        N)	r�rZr�rrlr�rW�	_ChainMapr�)r r*rrZsectiondictZvardictr�r?r"r"r#r�ks
zRawConfigParser._unify_valuescCs(|j�|jkrtd|��|j|j�S)zJReturn a boolean value translating from other types if necessary.
        zNot a boolean: %s)r��BOOLEAN_STATESr7)r r?r"r"r#r�sz#RawConfigParser._convert_to_booleanr)r*r4r?cCsFt|t�std��t|t�s$td��|js0|rBt|t�sBtd��dS)a�Raises a TypeError for non-string values.

        The only legal non-string value if we allow valueless
        options is None, so we need to check if the value is a
        string if:
        - we do not allow valueless options, or
        - we allow valueless options but the value is not None

        For compatibility reasons this method is not used in classic set()
        for RawConfigParsers. It is invoked in every case for mapping protocol
        access and in ConfigParser.set().
        zsection names must be stringszoption keys must be stringszoption values must be stringsN)r�r��	TypeErrorr�)r r*r4r?r"r"r#�_validate_value_types�s


z%RawConfigParser._validate_value_typescCs|jS)N)r�)r r"r"r#r��szRawConfigParser.converters)r|rh)r}r~)N)N)r�)r�)N)N)T)>r%r&r'r(Z
_SECT_TMPLr�r�rr�rdrer�r�r.r�r�r�r�
_default_dictrr�rrDr�r�r�r�r�r�r�r�r�rUr�r�r�r�r�rlr�rWr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrAr��
__classcell__r"r")r�r#r/sv	
$	




	%




zcs4eZdZdZe�Zd�fdd�	Z�fdd�Z�ZS)rz(ConfigParser implementing interpolation.Ncs"|j||d�t�j|||�dS)zmSet an option.  Extends RawConfigParser.set by validating type and
        interpolation syntax on the value.)r4r?N)rr�r�)r r*r4r?)r�r"r#r��szConfigParser.setcs|j|d�t�j|�dS)z�Create a new section in the configuration.  Extends
        RawConfigParser.add_section by validating if the section name is
        a string.)r*N)rr�r�)r r*)r�r"r#r��szConfigParser.add_section)N)	r%r&r'r(rr�r�r�rr"r")r�r#r�scs eZdZdZ�fdd�Z�ZS)rz8ConfigParser alias for backwards compatibility purposes.cs"t�j||�tjdtdd�dS)Nz�The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.r:)r;)r�rr<r=r>)r r+r�)r�r"r#r�szSafeConfigParser.__init__)r%r&r'r(rrr"r")r�r#r�sc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Ze
dd��Ze
dd��Zddddd�dd�ZdS)rz+A proxy for a single section from a parser.cCsJ||_||_x8|jD].}d|}tj|jt||�d�}t|||�qWdS)z@Creates a view on a section of the specified `name` in `parser`.rU)�_implN)�_parser�_namer�rorprU�getattr�setattr)r rCr�r�r��getterr"r"r#r�szSectionProxy.__init__cCsdj|j�S)Nz
<Section: {}>)r.r)r r"r"r#r$�szSectionProxy.__repr__cCs(|jj|j|�st|��|jj|j|�S)N)rr�rrZrU)r r�r"r"r#r��szSectionProxy.__getitem__cCs"|jj||d�|jj|j||�S)N)r4r?)rrr�r)r r�r?r"r"r#r��szSectionProxy.__setitem__cCs,|jj|j|�o|jj|j|�s(t|��dS)N)rr�rr�rZ)r r�r"r"r#r��szSectionProxy.__delitem__cCs|jj|j|�S)N)rr�r)r r�r"r"r#r��szSectionProxy.__contains__cCst|j��S)N)rj�_options)r r"r"r#r��szSectionProxy.__len__cCs|j�j�S)N)rr�)r r"r"r#r��szSectionProxy.__iter__cCs*|j|jjkr|jj|j�S|jj�SdS)N)rrr�r�rD)r r"r"r#r�szSectionProxy._optionscCs|jS)N)r)r r"r"r#rC�szSectionProxy.parsercCs|jS)N)r)r r"r"r#r��szSectionProxy.nameNF)rRrrrcKs(|s|jj}||j|f|||d�|��S)z�Get an option value.

        Unless `fallback` is provided, `None` will be returned if the option
        is not found.

        )rRrrrS)rrUr)r r4rSrRrrrr�r"r"r#rU�s
zSectionProxy.get)N)r%r&r'r(rr$r�r�r�r�r�r�rrArCr�rUr"r"r"r#r�s	c@sJeZdZdZejd�Zdd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�ZdS)ra/Enables reuse of get*() methods between the parser and section proxies.

    If a parser class implements a getter directly, the value for the given
    key will be ``None``. The presence of the converter name here enables
    section proxies to find and use the implementation on the parser class.
    z^get(?P<name>.+)$cCsZ||_i|_xHt|j�D]:}|jj|�}|stt|j|��rBqd|j|jd�<qWdS)Nr�)r�_data�dir�	GETTERCRErV�callablerrX)r rCr
rar"r"r#rszConverterMapping.__init__cCs
|j|S)N)r)r r�r"r"r#r�szConverterMapping.__getitem__c
Cs�yd|}Wn(tk
r4tdj|t|����YnX|dkrFtd��||j|<tj|jj|d�}||_	t
|j||�x.|jj�D] }tj|j|d�}t
|||�q�WdS)NrUzIncompatible key: {} (type: {})z)Incompatible key: cannot use "" as a name)r�)r)
rr7r.�typerrorprr�Z	converterr	�valuesrU)r r�r?�k�func�proxyr
r"r"r#r�s
zConverterMapping.__setitem__cCs�yd|p
d}Wntk
r,t|��YnX|j|=xDtj|jf|jj��D]*}yt||�WqNtk
rvwNYqNXqNWdS)NrU)	rrZrr�r�rr�delattrr�)r r�rZinstr"r"r#r�,szConverterMapping.__delitem__cCs
t|j�S)N)�iterr)r r"r"r#r�:szConverterMapping.__iter__cCs
t|j�S)N)rjr)r r"r"r#r�=szConverterMapping.__len__N)
r%r&r'r(rdrerrr�r�r�r�r�r"r"r"r#rs
	))r(�collections.abcr�collectionsrrrr�ror�r�r�rdr�r<�__all__rrrrrrrrr	rrr
r
r�objectr�rrrrrrrrrr"r"r"r#�<module>�sX
	

+HJ&u
Fasyncore.cpython-36.opt-1.pyc000064400000036740150335715140011772 0ustar003


 \�N�@shdZddlZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZeee
eeeeh�ZyeWnek
r�iZYnXdd�ZGdd�de�ZeeefZdd	�Zd
d�Z dd
�Z!dd�Z"d&dd�Z#d'dd�Z$e$Z%d(dd�Z&Gdd�d�Z'Gdd�de'�Z(dd�Z)d)dd �Z*ej+d!k�rdGd"d#�d#�Z,Gd$d%�d%e'�Z-dS)*a�Basic infrastructure for asynchronous socket service clients and servers.

There are only two ways to have a program on a single processor do "more
than one thing at a time".  Multi-threaded programming is the simplest and
most popular way to do it, but there is another very different technique,
that lets you have nearly all the advantages of multi-threading, without
actually using multiple threads. it's really only practical if your program
is largely I/O bound. If your program is CPU bound, then pre-emptive
scheduled threads are probably what you really need. Network servers are
rarely CPU-bound, however.

If your operating system supports the select() system call in its I/O
library (and nearly all do), then you can use it to juggle multiple
communication channels at once; doing other work while your I/O is taking
place in the "background."  Although this strategy can seem strange and
complex, especially at first, it is in many ways easier to understand and
control than multi-threaded programming. The module documented here solves
many of the difficult problems for you, making the task of building
sophisticated high-performance network servers and clients a snap.
�N)
�EALREADY�EINPROGRESS�EWOULDBLOCK�
ECONNRESET�EINVAL�ENOTCONN�	ESHUTDOWN�EISCONN�EBADF�ECONNABORTED�EPIPE�EAGAIN�	errorcodec
Cs>y
tj|�Stttfk
r8|tkr0t|Sd|SXdS)NzUnknown error %s)�os�strerror�
ValueError�
OverflowError�	NameErrorr)�err�r� /usr/lib64/python3.6/asyncore.py�	_strerrorDs
rc@seZdZdS)�ExitNowN)�__name__�
__module__�__qualname__rrrrrLsrcCs:y|j�Wn(tk
r"�Yn|j�YnXdS)N)�handle_read_event�_reraised_exceptions�handle_error)�objrrr�readQsr cCs:y|j�Wn(tk
r"�Yn|j�YnXdS)N)�handle_write_eventrr)rrrr�writeYsr"cCs:y|j�Wn(tk
r"�Yn|j�YnXdS)N)�handle_expt_eventrr)rrrr�
_exceptionasr$cCs�yX|tj@r|j�|tj@r&|j�|tj@r8|j�|tjtjBtj	B@rV|j
�Wnhtk
r�}z&|jdt
kr�|j�n|j
�WYdd}~Xn(tk
r��Yn|j�YnXdS)Nr)�select�POLLINr�POLLOUTr!�POLLPRIr#ZPOLLHUPZPOLLERRZPOLLNVAL�handle_close�OSError�args�
_DISCONNECTEDrr)r�flags�errr�	readwriteis"



r/�c	CsN|dkrt}|�rJg}g}g}x^t|j��D]N\}}|j�}|j�}|rR|j|�|rh|jrh|j|�|sp|r,|j|�q,Wg|ko�|ko�|knr�tj|�dSt	j	||||�\}}}x(|D] }|j
|�}|dkr�q�t|�q�Wx*|D]"}|j
|�}|dk�rq�t|�q�Wx.|D]&}|j
|�}|dk�r<�q t
|��q WdS)N)�
socket_map�list�items�readable�writable�append�	accepting�timeZsleepr%�getr r"r$)	�timeout�map�r�wr.�fdrZis_rZis_wrrr�poll}sD

"








r?cCs�|dkrt}|dk	r t|d�}tj�}|r�x^t|j��D]N\}}d}|j�r^|tjtjBO}|j	�rx|j
rx|tjO}|r:|j||�q:W|j|�}x.|D]&\}}|j
|�}|dkr�q�t||�q�WdS)Ni�r)r1�intr%r?r2r3r4r&r(r5r7r'�registerr9r/)r:r;Zpollsterr>rr-r<rrr�poll2�s(


rB�>@FcCsj|dkrt}|r ttd�r t}nt}|dkrBx8|r>|||�q.Wn$x"|rd|dkrd|||�|d}qDWdS)Nr?r�)r1�hasattrr%rBr?)r:Zuse_pollr;�countZpoll_funrrr�loop�s
rGc@s6eZdZdZdZdZdZdZdZe	dh�Z
dAdd�Zdd�ZeZ
dBdd	�ZdCd
d�Zejejfdd
�ZdDdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdEd'd(�Z d)d*�Z!d+d,�Z"d-d.�Z#d/d0�Z$d1d2�Z%d3d4�Z&d5d6�Z'd7d8�Z(d9d:�Z)d;d<�Z*d=d>�Z+d?d@�Z,dS)F�
dispatcherFN�warningcCs�|dkrt|_n||_d|_|r�|jd�|j||�d|_y|j�|_Wq�tk
r�}z,|j	dt
tfkrvd|_n|j|��WYdd}~Xq�Xnd|_
dS)NrTF)r1�_map�_fileno�setblocking�
set_socket�	connectedZgetpeername�addrr*r+rr�del_channel�socket)�self�sockr;rrrr�__init__�s 

zdispatcher.__init__cCs�|jjd|jjg}|jr.|jr.|jd�n|jr>|jd�|jdk	r�y|jd|j�Wn$tk
r�|jt|j��YnXddj	|�t
|�fS)N�.Z	listeningrNz%s:%dz<%s at %#x>� )�	__class__rrr7rOr6rN�	TypeError�repr�join�id)rRZstatusrrr�__repr__�s

zdispatcher.__repr__cCs|dkr|j}|||j<dS)N)rJrK)rRr;rrr�add_channelszdispatcher.add_channelcCs,|j}|dkr|j}||kr"||=d|_dS)N)rKrJ)rRr;r>rrrrPszdispatcher.del_channelcCs.||f|_tj||�}|jd�|j|�dS)Nr)Zfamily_and_typerQrLrM)rRZfamily�typerSrrr�
create_sockets

zdispatcher.create_socketcCs||_|j�|_|j|�dS)N)rQ�filenorKr])rRrSr;rrrrM s
zdispatcher.set_socketcCsDy*|jjtjtj|jjtjtj�dB�Wntk
r>YnXdS)NrD)rQZ
setsockopt�
SOL_SOCKETZSO_REUSEADDR�
getsockoptr*)rRrrr�set_reuse_addr&s
zdispatcher.set_reuse_addrcCsdS)NTr)rRrrrr47szdispatcher.readablecCsdS)NTr)rRrrrr5:szdispatcher.writablecCs(d|_tjdkr|dkrd}|jj|�S)NT�nt�)r7r�namerQ�listen)rRZnumrrrrgAszdispatcher.listencCs||_|jj|�S)N)rOrQ�bind)rRrOrrrrhGszdispatcher.bindcCspd|_d|_|jj|�}|tttfks8|tkrBtj	dkrB||_
dS|dtfkr^||_
|j�nt
|t|��dS)NFTrdr)rN�
connectingrQZ
connect_exrrrrrrfrOr	�handle_connect_eventr*r)rRZaddressrrrr�connectKs
zdispatcher.connectcCsny|jj�\}}WnNtk
r&dStk
r`}z |jdtttfkrNdS�WYdd}~Xn
X||fSdS)Nr)rQ�acceptrXr*r+rrr
)rRZconnrO�whyrrrrlYszdispatcher.acceptcCsfy|jj|�}|Stk
r`}z4|jdtkr4dS|jdtkrN|j�dS�WYdd}~XnXdS)Nr)rQ�sendr*r+rr,r))rR�data�resultrmrrrrngszdispatcher.sendcCshy$|jj|�}|s|j�dS|SWn>tk
rb}z"|jdtkrP|j�dS�WYdd}~XnXdS)N�r)rQ�recvr)r*r+r,)rR�buffer_sizerormrrrrrtszdispatcher.recvcCsnd|_d|_d|_|j�|jdk	rjy|jj�Wn6tk
rh}z|jdtt	fkrX�WYdd}~XnXdS)NFr)
rNr7rirPrQ�closer*r+rr
)rRrmrrrrt�s
zdispatcher.closecCstjjdt|��dS)Nzlog: %s
)�sys�stderrr"�str)rR�messagerrr�log�szdispatcher.log�infocCs||jkrtd||f�dS)Nz%s: %s)�ignore_log_types�print)rRrxr^rrr�log_info�s
zdispatcher.log_infocCs:|jr|j�n&|js.|jr$|j�|j�n|j�dS)N)r7�
handle_acceptrNrirj�handle_read)rRrrrr�s

zdispatcher.handle_read_eventcCs@|jjtjtj�}|dkr(t|t|���|j�d|_d|_dS)NrTF)	rQrbra�SO_ERRORr*r�handle_connectrNri)rRrrrrrj�szdispatcher.handle_connect_eventcCs*|jr
dS|js|jr|j�|j�dS)N)r7rNrirj�handle_write)rRrrrr!�szdispatcher.handle_write_eventcCs0|jjtjtj�}|dkr$|j�n|j�dS)Nr)rQrbrar�r)�handle_expt)rRrrrrr#�s
zdispatcher.handle_expt_eventcCsXt�\}}}}yt|�}Wndt|�}YnX|jd||||fd�|j�dS)Nz)<__repr__(self) failed for object at %0x>z:uncaptured python exception, closing channel %s (%s:%s %s)�error)�compact_tracebackrYr[r}r))rRZnil�t�v�tbinfoZ	self_reprrrrr�szdispatcher.handle_errorcCs|jdd�dS)Nz!unhandled incoming priority eventrI)r})rRrrrr��szdispatcher.handle_exptcCs|jdd�dS)Nzunhandled read eventrI)r})rRrrrr�szdispatcher.handle_readcCs|jdd�dS)Nzunhandled write eventrI)r})rRrrrr��szdispatcher.handle_writecCs|jdd�dS)Nzunhandled connect eventrI)r})rRrrrr��szdispatcher.handle_connectcCs|j�}|dk	r|j|�dS)N)rl�handle_accepted)rRZpairrrrr~�szdispatcher.handle_acceptcCs|j�|jdd�dS)Nzunhandled accepted eventrI)rtr})rRrSrOrrrr��szdispatcher.handle_acceptedcCs|jdd�|j�dS)Nzunhandled close eventrI)r}rt)rRrrrr)�szdispatcher.handle_close)NN)N)N)N)rz)-rrr�debugrNr7ri�closingrO�	frozensetr{rTr\�__str__r]rPrQZAF_INETZSOCK_STREAMr_rMrcr4r5rgrhrkrlrnrrrtryr}rrjr!r#rr�rr�r�r~r�r)rrrrrH�sL

 


	


rHc@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�dispatcher_with_sendNcCstj|||�d|_dS)Nrq)rHrT�
out_buffer)rRrSr;rrrrT�szdispatcher_with_send.__init__cCs.d}tj||jdd��}|j|d�|_dS)Nri)rHrnr�)rRZnum_sentrrr�
initiate_sendsz"dispatcher_with_send.initiate_sendcCs|j�dS)N)r�)rRrrrr�sz!dispatcher_with_send.handle_writecCs|jpt|j�S)N)rN�lenr�)rRrrrr5szdispatcher_with_send.writablecCs0|jr|jdt|��|j||_|j�dS)Nz
sending %s)r�r}rYr�r�)rRrorrrrnszdispatcher_with_send.send)NN)rrrrTr�r�r5rnrrrrr��s

r�cCs�tj�\}}}g}|std��x0|rN|j|jjj|jjjt|j	�f�|j
}q W~|d\}}}djdd�|D��}|||f|||fS)Nztraceback does not existrDrVcSsg|]}d|�qS)z
[%s|%s|%s]r)�.0�xrrr�
<listcomp>)sz%compact_traceback.<locals>.<listcomp>���)ru�exc_info�AssertionErrorr6�tb_frame�f_code�co_filename�co_namerw�	tb_lineno�tb_nextrZ)r�r��tbr��fileZfunction�linerzrrrr�s
r�cCs�|dkrt}x~t|j��D]n}y|j�Wqtk
rb}z|jdtkrLn|sR�WYdd}~Xqtk
rv�Yq|s��YqXqW|j�dS)Nr)	r1r2�valuesrtr*r+r
r�clear)r;Z
ignore_allr�rrr�	close_all,s r��posixc@sNeZdZdd�Zdd�Zdd�Zdd�Zdd
d�ZeZeZ	dd
�Z
dd�Zd	S)�file_wrappercCstj|�|_dS)N)r�dupr>)rRr>rrrrTQszfile_wrapper.__init__cCs*|jdkrtjd|t|d�|j�dS)Nrzunclosed file %r)�source)r>�warnings�warn�ResourceWarningrt)rRrrr�__del__Ts
zfile_wrapper.__del__cGstj|jf|��S)N)rr r>)rRr+rrrrrZszfile_wrapper.recvcGstj|jf|��S)N)rr"r>)rRr+rrrrn]szfile_wrapper.sendNcCs*|tjkr|tjkr|rdStd��dS)Nrz-Only asyncore specific behaviour implemented.)rQrar��NotImplementedError)rR�levelZoptnameZbuflenrrrrb`s


zfile_wrapper.getsockoptcCs(|jdkrdS|j}d|_tj|�dS)NrrDr�)r>rrt)rRr>rrrrtks

zfile_wrapper.closecCs|jS)N)r>)rRrrrr`rszfile_wrapper.fileno)N)rrrrTr�rrrnrbr r"rtr`rrrrr�Ls
r�c@seZdZddd�Zdd�ZdS)�file_dispatcherNcCsPtj|d|�d|_y|j�}Wntk
r4YnX|j|�tj|d�dS)NTF)rHrTrNr`�AttributeError�set_filer�set_blocking)rRr>r;rrrrTws
zfile_dispatcher.__init__cCs"t|�|_|jj�|_|j�dS)N)r�rQr`rKr])rRr>rrrr��s
zfile_dispatcher.set_file)N)rrrrTr�rrrrr�us
r�)r0N)r0N)rCFNN)NF).�__doc__r%rQrur8r�r�errnorrrrrrrr	r
rrr
rr�r,r1rr�	Exceptionr�KeyboardInterrupt�
SystemExitrr r"r$r/r?rBZpoll3rGrHr�r�r�rfr�r�rrrr�<module>/sB<


'

-
)mailbox.cpython-36.opt-1.pyc000064400000174270150335715140011603 0ustar003


 \ 3�@sRdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
ZddlZddlZyddl
Z
Wnek
r�dZ
YnXddddddd	d
ddd
ddddddgZejjd�ZGdd�d�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd	�d	ejj�ZGd d
�d
e�ZGd!d"�d"e�ZGd#d�de�ZGd$d�de�ZGd%d
�d
e�Z Gd&d�de�Z!Gd'd(�d(�Z"Gd)d*�d*e"�Z#d=d,d-�Z$d.d/�Z%d0d1�Z&d2d3�Z'd4d5�Z(d6d7�Z)Gd8d�de*�Z+Gd9d�de+�Z,Gd:d�de+�Z-Gd;d�de+�Z.Gd<d�de+�Z/dS)>zDRead/write support for Maildir, mbox, MH, Babyl, and MMDF mailboxes.�N�Mailbox�Maildir�mbox�MH�Babyl�MMDF�Message�MaildirMessage�mboxMessage�	MHMessage�BabylMessage�MMDFMessage�Error�NoSuchMailboxError�
NotEmptyError�ExternalClashError�FormatError�asciic@seZdZdZdCdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dDdd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�ZdEd0d1�Zd2d3�ZdFd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Z d>d?�Z!d@Z"dGdAdB�Z#dS)Hrz*A group of messages in a particular place.NTcCs tjjtjj|��|_||_dS)zInitialize a Mailbox instance.N)�os�path�abspath�
expanduser�_path�_factory)�selfr�factory�create�r�/usr/lib64/python3.6/mailbox.py�__init__$szMailbox.__init__cCstd��dS)z$Add message and return assigned key.z&Method must be implemented by subclassN)�NotImplementedError)r�messagerrr�add)szMailbox.addcCstd��dS)z=Remove the keyed message; raise KeyError if it doesn't exist.z&Method must be implemented by subclassN)r )r�keyrrr�remove-szMailbox.removecCs|j|�dS)N)r$)rr#rrr�__delitem__1szMailbox.__delitem__cCs(y|j|�Wntk
r"YnXdS)z'If the keyed message exists, remove it.N)r$�KeyError)rr#rrr�discard4szMailbox.discardcCstd��dS)z>Replace the keyed message; raise KeyError if it doesn't exist.z&Method must be implemented by subclassN)r )rr#r!rrr�__setitem__;szMailbox.__setitem__cCs$y
|j|�Stk
r|SXdS)z9Return the keyed message, or default if it doesn't exist.N)�__getitem__r&)rr#�defaultrrr�get?s
zMailbox.getc	Cs6|js|j|�Stj|j|���}|j|�SQRXdS)z=Return the keyed message; raise KeyError if it doesn't exist.N)r�get_message�
contextlib�closing�get_file)rr#�filerrrr)Fs
zMailbox.__getitem__cCstd��dS)z4Return a Message representation or raise a KeyError.z&Method must be implemented by subclassN)r )rr#rrrr,NszMailbox.get_messagecCstj|j|��j�S)z�Return a string representation or raise a KeyError.

        Uses email.message.Message to create a 7bit clean string
        representation of the message.)�email�message_from_bytes�	get_bytes�	as_string)rr#rrr�
get_stringRszMailbox.get_stringcCstd��dS)z8Return a byte string representation or raise a KeyError.z&Method must be implemented by subclassN)r )rr#rrrr3YszMailbox.get_bytescCstd��dS)z6Return a file-like representation or raise a KeyError.z&Method must be implemented by subclassN)r )rr#rrrr/]szMailbox.get_filecCstd��dS)zReturn an iterator over keys.z&Method must be implemented by subclassN)r )rrrr�iterkeysaszMailbox.iterkeyscCst|j��S)zReturn a list of keys.)�listr6)rrrr�keyseszMailbox.keysccs@x:|j�D].}y||}Wntk
r0w
YnX|Vq
WdS)z%Return an iterator over all messages.N)r6r&)rr#�valuerrr�
itervaluesiszMailbox.itervaluescCs|j�S)N)r:)rrrr�__iter__rszMailbox.__iter__cCst|j��S)z,Return a list of messages. Memory intensive.)r7r:)rrrr�valuesuszMailbox.valuesccsDx>|j�D]2}y||}Wntk
r0w
YnX||fVq
WdS)z.Return an iterator over (key, message) tuples.N)r6r&)rr#r9rrr�	iteritemsyszMailbox.iteritemscCst|j��S)z9Return a list of (key, message) tuples. Memory intensive.)r7r=)rrrr�items�sz
Mailbox.itemscCstd��dS)z9Return True if the keyed message exists, False otherwise.z&Method must be implemented by subclassN)r )rr#rrr�__contains__�szMailbox.__contains__cCstd��dS)z*Return a count of messages in the mailbox.z&Method must be implemented by subclassN)r )rrrr�__len__�szMailbox.__len__cCs x|j�D]}|j|�q
WdS)zDelete all messages.N)r8r')rr#rrr�clear�sz
Mailbox.clearcCs0y||}Wntk
r |SX|j|�|S)z3Delete the keyed message and return it, or default.)r&r')rr#r*�resultrrr�pop�s
zMailbox.popcCs*x$|j�D]}||j|�fSWtd��dS)z6Delete an arbitrary (key, message) pair and return it.zNo messages in mailboxN)r6rCr&)rr#rrr�popitem�szMailbox.popitemcCsxt|d�r|j�}nt|d�r(|j�}n|}d}x6|D].\}}y|||<Wq6tk
rbd}Yq6Xq6W|rttd��dS)z4Change the messages that correspond to certain keys.r=r>FTzNo message with key(s)N)�hasattrr=r>r&)r�arg�sourceZbad_keyr#r!rrr�update�s



zMailbox.updatecCstd��dS)z&Write any pending changes to the disk.z&Method must be implemented by subclassN)r )rrrr�flush�sz
Mailbox.flushcCstd��dS)zLock the mailbox.z&Method must be implemented by subclassN)r )rrrr�lock�szMailbox.lockcCstd��dS)z#Unlock the mailbox if it is locked.z&Method must be implemented by subclassN)r )rrrr�unlock�szMailbox.unlockcCstd��dS)zFlush and close the mailbox.z&Method must be implemented by subclassN)r )rrrr�close�sz
Mailbox.closecCs,y
|jd�Stk
r&td��YnXdS)Nrz?String input must be ASCII-only; use bytes or a Message instead)�encode�UnicodeError�
ValueError)rr!rrr�_string_to_bytes�s
zMailbox._string_to_bytesFc	Cst|tjj�rxtj�}tjj||d�}|j|�|j	d�|j
�}|jdt�}|j
|�|jrt|jt�rt|j
t��n�t|tttjf��rt|tj�r�tjdtd�|j�}t|t�r�|j|�}|r�|jdd�}|jdt�}|j
|�|jo�|jt��r�|j
t�n�t|d��r�t|d��r4tjd	td�|j}d
}x�|j�}|jd��r`|d
d�d}n|jd
��r||d
d�d}|�s�P|�r�|jd��r�d|dd
�}|jdt�}|j
|�|}�q:W|j�r�|�r�|jt��r�|j
t�ntdt|���d
S)z%Dump message contents to target file.r�
z8Use of StringIO input is deprecated, use BytesIO instead�s
From s
>From �read�bufferzDUse of text mode files is deprecated, use a binary mode file insteadNs
��
�sFrom s>From �zInvalid message type: %s������)�
isinstancer1r!r�io�BytesIO�	generator�BytesGenerator�flatten�seekrS�replace�linesep�write�_append_newline�endswith�str�bytes�StringIO�warnings�warn�DeprecationWarning�getvaluerPrErT�readline�
startswith�	TypeError�type)	rr!�targetZmangle_from_rT�gen�dataZlastline�linerrr�
_dump_message�sZ







zMailbox._dump_message)NT)N)N)N)F)$�__name__�
__module__�__qualname__�__doc__rr"r$r%r'r(r+r)r,r5r3r/r6r8r:r;r<r=r>r?r@rArCrDrHrIrJrKrLrPrervrrrrr!sB

		
	
c@s�eZdZdZdZd6dd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)7rzA qmail-style Maildir mailbox.�:NTcCs�tj||||�tjj|jd�tjj|jd�tjj|jd�d�|_tjj|j�s�|r�tj|jd�x*|jj	�D]}tj|d�qnWn
t
|j��i|_ddd�|_d|_
d|_d	S)
zInitialize a Maildir instance.�tmp�new�cur)r|r}r~i�r)r~r}g�������?N)rrrr�joinr�_paths�exists�mkdirr<r�_toc�_toc_mtimes�
_last_read�_skewfactor)r�dirnamerrrrrrr
s
zMaildir.__init__cCs~|j�}y|j||�Wn*tk
rB|j�tj|j��YnXt|�t|t	�r||j
�}|j|j�}||jkr�d}nd}d}tj
j|j�j|j�d}tj
j|j|||�}t|t	�r�tj|jtj
j|j�|j�f�yLytj|j|�Wn(ttfk
�rtj|j|�YnXtj|j�WnNtk
�rx}z0tj|j�|jtjk�rftd|��n�WYdd}~XnX|S)z$Add message and return assigned key.�r}rz$Name clash with existing message: %sN)�_create_tmprv�
BaseExceptionrLrr$�name�_sync_closer[r	�
get_subdir�colon�get_infor�basename�splitrr�utime�getatime�get_date�link�AttributeError�PermissionError�rename�OSError�errnoZEEXISTr)rr!Ztmp_file�subdir�suffix�uniq�dest�errrr"!sB



zMaildir.addcCs tjtjj|j|j|���dS)z=Remove the keyed message; raise KeyError if it doesn't exist.N)rr$rrr�_lookup)rr#rrrr$KszMaildir.removecCs,y|j|�Wnttfk
r&YnXdS)z'If the keyed message exists, remove it.N)r$r&�FileNotFoundError)rr#rrrr'OszMaildir.discardcCs�|j|�}|j|�}|j|�}t|t�r.|}n|}tjj|�}|j|kr`|j|j|j�d}nd}|j	|�tjj
|j|�}	tjj
|j|||�}
t|t�r�tj|	tjj
|	�|j�f�tj|	|
�dS)z>Replace the keyed message; raise KeyError if it doesn't exist.rWr�NrZ)r�r"r[r	rrr�r�r�r'rrr�r�r�r�)rr#r!Zold_subpathZtemp_keyZtemp_subpathZdominant_subpathr�r�Ztmp_path�new_pathrrrr(Ws"






zMaildir.__setitem__cCs�|j|�}ttjj|j|�d�� }|jr4|j|�}nt|�}WdQRXtjj|�\}}|j	|�|j
|kr�|j|j|j
�d�|jtjj
tjj|j|���|S)z4Return a Message representation or raise a KeyError.�rbNrWrZ)r��openrrrrrr	r��
set_subdirr��set_info�set_date�getmtime)rr#Zsubpath�f�msgr�r�rrrr,rs


zMaildir.get_messagec
Cs8ttjj|j|j|��d��}|j�jtd�SQRXdS)z2Return a bytes representation or raise a KeyError.r�rQN)	r�rrrrr�rSrbrc)rr#r�rrrr3�szMaildir.get_bytescCs$ttjj|j|j|��d�}t|�S)z6Return a file-like representation or raise a KeyError.r�)r�rrrrr��
_ProxyFile)rr#r�rrrr/�szMaildir.get_fileccsH|j�x:|jD]0}y|j|�Wntk
r8wYnX|VqWdS)zReturn an iterator over keys.N)�_refreshr�r�r&)rr#rrrr6�szMaildir.iterkeyscCs|j�||jkS)z9Return True if the keyed message exists, False otherwise.)r�r�)rr#rrrr?�szMaildir.__contains__cCs|j�t|j�S)z*Return a count of messages in the mailbox.)r��lenr�)rrrrr@�szMaildir.__len__cCsdS)z"Write any pending changes to disk.Nr)rrrrrI�sz
Maildir.flushcCsdS)zLock the mailbox.Nr)rrrrrJ�szMaildir.lockcCsdS)z#Unlock the mailbox if it is locked.Nr)rrrrrK�szMaildir.unlockcCsdS)zFlush and close the mailbox.Nr)rrrrrL�sz
Maildir.closecCs`g}xVtj|j�D]F}t|�dkr|ddkrtjjtjj|j|��r|j|dd��qW|S)zReturn a list of folder names.rWr�.N)r�listdirrr�r�isdirr�append)rrB�entryrrr�list_folders�szMaildir.list_folderscCs ttjj|jd|�|jdd�S)z/Return a Maildir instance for the named folder.r�F)rr)rrrrrr)r�folderrrr�
get_folder�szMaildir.get_foldercCs\tjj|jd|�}t||jd�}tjj|d�}tjj|�sXtjtj|tj	tj
Bd��|S)z>Create a folder and return a Maildir instance representing it.r�)rZ
maildirfolderi�)rrrrrrr�rLr��O_CREAT�O_WRONLY)rr�rrBZmaildirfolder_pathrrr�
add_folder�szMaildir.add_foldercCs,tjj|jd|�}xTtjtjj|d��tjtjj|d��D](}t|�dksZ|ddkr>td|��q>WxPtj|�D]B}|dkrv|dkrv|dkrvtjjtjj||��rvtd||f��qvWx`tj|d	d
�D]N\}}}x |D]}tj	tjj||��q�Wx |D]}tj
tjj||��q�Wq�Wtj
|�dS)z-Delete the named folder, which must be empty.r�r}r~rWrzFolder contains message(s): %sr|z%Folder contains subdirectory '%s': %sF)�topdownN)rrrrr�r�rr��walkr$�rmdir)rr�rr��root�dirs�filesrrr�
remove_folder�s 

zMaildir.remove_foldercCs\tj�}xNtjtjj|jd��D]4}tjj|jd|�}|tjj|�dkr tj|�q WdS)zDelete old files in "tmp".r|i@�N)�timerr�rrrr�r$)r�nowr�rrrr�clean�s
z
Maildir.cleanrWcCs�tj�}tj�}d|kr$|jdd�}d|kr8|jdd�}dt|�t|dd�tj�tj|f}tj	j
|jd|�}ytj|�Wn@t
k
r�tjd7_yt|�Stk
r�YnXYnXtd	|��d
S)z=Create a file in the tmp subdirectory and open and return it.�/z\057r{z\072z%s.M%sP%sQ%s.%srWg��.Ar|z&Name clash prevented file creation: %sN)r��socket�gethostnamerb�intr�getpidr�_countrrr�statr��_create_carefully�FileExistsErrorr)rr�Zhostnamer�rrrrr��s&zMaildir._create_tmpcCs�tj�|jd|jkrbd}x<|jD]2}tjj|j|�}||j|krLd}||j|<q$W|sbdSi|_xl|jD]b}|j|}xRtj	|�D]D}tjj
||�}tjj|�r�q�|j|j
�d}tjj
||�|j|<q�WqpWtj�|_dS)z!Update table of contents mapping.rUFTNr)r�r�r�r�rrr�r�r�r�rr�r�r�)rZrefreshr��mtimerr��pr�rrrr��s&
zMaildir._refreshcCszy,tjjtjj|j|j|��r*|j|SWntk
r@YnX|j�y
|j|Stk
rttd|��YnXdS)z=Use TOC to return subpath for given key, or raise a KeyError.zNo message with key: %sN)rrr�rrr�r&r�)rr#rrrr�#s
zMaildir._lookupcCsVt|d�s|j�|_x<y|t|j�Stk
r8dStk
rLwYqXqWdS)z0Return the next message in a one-time iteration.�
_onetime_keysN)rEr6r��next�
StopIterationr&)rrrrr�1s

zMaildir.next)NT)rwrxryrzr�rr"r$r'r(r,r3r/r6r?r@rIrJrKrLr�r�r�r�r�r�r�r�r�r�rrrrrs6
*
	
$c@s�eZdZdZd$dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd%d d!�Zd"d#�ZdS)&�_singlefileMailboxzA single-file mailbox.NTcCs�tj||||�yt|jd�}Wnntk
r�}zR|jtjkr\|rPt|jd�}q~t|j��n"|jtjtj	fkr|t|jd�}n�WYdd}~XnX||_
d|_d|_d|_
d|_d|_d|_dS)z!Initialize a single-file mailbox.zrb+zwb+r�NrF)rrr�rr�r��ENOENTr�EACCES�EROFS�_filer��	_next_key�_pending�
_pending_sync�_locked�_file_length)rrrrr�r�rrrrAs$z_singlefileMailbox.__init__cCs8|j�|j|�|j|j<|jd7_d|_|jdS)z$Add message and return assigned key.rWT)r��_append_messager�r�r�)rr!rrrr"Xs
z_singlefileMailbox.addcCs|j|�|j|=d|_dS)z=Remove the keyed message; raise KeyError if it doesn't exist.TN)r�r�r�)rr#rrrr$bs
z_singlefileMailbox.removecCs$|j|�|j|�|j|<d|_dS)z>Replace the keyed message; raise KeyError if it doesn't exist.TN)r�r�r�r�)rr#r!rrrr(hs
z_singlefileMailbox.__setitem__ccs|j�|jj�EdHdS)zReturn an iterator over keys.N)r�r�r8)rrrrr6nsz_singlefileMailbox.iterkeyscCs|j�||jkS)z9Return True if the keyed message exists, False otherwise.)r�r�)rr#rrrr?ssz_singlefileMailbox.__contains__cCs|j�t|j�S)z*Return a count of messages in the mailbox.)r�r�r�)rrrrr@xsz_singlefileMailbox.__len__cCs|jst|j�d|_dS)zLock the mailbox.TN)r��
_lock_filer�)rrrrrJ}s
z_singlefileMailbox.lockcCs|jrt|j�d|_dS)z#Unlock the mailbox if it is locked.FN)r��_unlock_filer�)rrrrrK�s
z_singlefileMailbox.unlockc
Cs�|js |jrt|j�d|_dS|jjdd�|jj�}||jkrTtd|j|f��t|j	�}y�i}|j
|�x�t|jj
��D]|}|j|\}}|jj|�|j|�|j�}x0|jjtd||jj���}|s�P|j|�q�W||j�f||<|j|�q~W|j�|_Wn"|j�tj|j��YnXt|�|jj�tj|j	�j}	tj|j|	�ytj|j|j	�Wn2tk
�r�tj|j	�tj|j|j	�YnXt|j	d�|_||_d|_d|_|j�r�t|jdd�dS)	z"Write any pending changes to disk.FNrrUz4Size of mailbox file changed (expected %i, found %i)izrb+)�dotlock) r�r��_sync_flushr�ra�tellr�r�_create_temporaryr�_pre_mailbox_hook�sortedr�r8�_pre_message_hookrS�minrd�_post_message_hookrLrr$r�r�r��st_mode�chmodr�r�r�r�r�)
rZcur_lenZnew_fileZnew_tocr#�start�stopZ	new_startrT�moderrrrI�s^
	






z_singlefileMailbox.flushcCsdS)z,Called before writing the mailbox to file f.Nr)rr�rrrr��sz$_singlefileMailbox._pre_mailbox_hookcCsdS)z-Called before writing each message to file f.Nr)rr�rrrr��sz$_singlefileMailbox._pre_message_hookcCsdS)z,Called after writing each message to file f.Nr)rr�rrrr��sz%_singlefileMailbox._post_message_hookcCs4z|j�Wdz|jr|j�Wd|jj�XXdS)zFlush and close the mailbox.N)rIr�rKr�rL)rrrrrL�sz_singlefileMailbox.closecCsJ|jdkr|j�|dk	rFy
|j|Stk
rDtd|��YnXdS)z'Return (start, stop) or raise KeyError.NzNo message with key: %s)r��
_generate_tocr&)rr#rrrr��s

z_singlefileMailbox._lookupcCs�|jjdd�|jj�}t|j�dkr:|jr:|j|j�y&|j|j�|j|�}|j	|j�Wn"t
k
r�|jj|��YnX|jj�|jj�|_
|S)z;Append message to mailbox and return (start, stop) offsets.rrU)r�rar�r�r�r�r�r��_install_messager�r��truncaterIr�)rr!ZbeforeZoffsetsrrrr��s


z"_singlefileMailbox._append_message)NT)N)rwrxryrzrr"r$r(r6r?r@rJrKrIr�r�r�rLr�r�rrrrr�>s"

@

r�c@sBeZdZdZdZdd�Zddd�Zddd	�Zdd
d�Zdd
�Z	dS)�	_mboxMMDFzAn mbox or MMDF mailbox.TcCsp|j|�\}}|jj|�|jj�jtd�}|jj||jj��}|j|jtd��}|j	|dd�j
d��|S)z4Return a Message representation or raise a KeyError.�rQrXNr)r�r�rarnrbrcrSr��_message_factory�set_from�decode)rr#r�r��	from_line�stringr�rrrr,sz_mboxMMDF.get_messageFcCstj|j|��j|d�S)z3Return a string representation or raise a KeyError.)�unixfrom)r1r2r3r4)rr#�from_rrrr5sz_mboxMMDF.get_stringcCsJ|j|�\}}|jj|�|s(|jj�|jj||jj��}|jtd�S)z3Return a string representation or raise a KeyError.rQ)r�r�rarnrSr�rbrc)rr#r�r�r�r�rrrr3s
z_mboxMMDF.get_bytescCs<|j|�\}}|jj|�|s(|jj�t|j|jj�|�S)z6Return a file-like representation or raise a KeyError.)r�r�rarn�_PartialFiler�)rr#r�r�r�rrrr/s

z_mboxMMDF.get_filecCsd}t|t�r|j|�}t|t�rf|jd�rf|jd�}|dkr\|d|�}||dd�}q�|}d}nJt|t�r�|j�jd�}d|}n(t|t	j
j�r�|j�}|dk	r�|jd�}|dkr�dt
jt
j��j�}|jj�}|jj|t�|j||j|j�|jj�}||fS)	z1Format a message and blindly write to self._file.NsFrom rQrWr�rsFrom MAILER-DAEMON rZ)r[rgrPrhro�find�_mboxMMDFMessage�get_fromrMr1r!r�get_unixfromr��asctime�gmtimer�r�rdrcrv�
_mangle_from_)rr!r��newlineZauthorr�r�rrrr�&s0







z_mboxMMDF._install_messageN)F)F)F)
rwrxryrzr�r,r5r3r/r�rrrrr�s


	
r�c@s2eZdZdZdZdZd
dd�Zdd�Zdd	�ZdS)rzA classic mbox mailbox.TNcCst|_tj||||�dS)zInitialize an mbox mailbox.N)r
r�r�r)rrrrrrrrLsz
mbox.__init__cCs|jt�dS)z,Called after writing each message to file f.N)rdrc)rr�rrrr�Qszmbox._post_message_hookcCs�gg}}d}|jjd�x�|jj�}|jj�}|jd�r|t|�t|�krl|rb|j|tt��n
|j|�|j|�d}q|s�|r�|j|tt��n
|j|�Pq|tkr�d}qd}qWtt	t
||���|_t|j�|_|jj�|_
dS)z0Generate key-to-(start, stop) table of contents.FrsFrom TN)r�rar�rnror�r�rc�dict�	enumerate�zipr�r�r�)r�starts�stopsZlast_was_empty�line_posrurrrr�Us0






zmbox._generate_toc)NT)	rwrxryrzr�rerr�r�rrrrrCs
c@s2eZdZdZddd�Zdd�Zdd	�Zd
d�ZdS)
rzAn MMDF mailbox.NTcCst|_tj||||�dS)zInitialize an MMDF mailbox.N)r
r�r�r)rrrrrrrrzsz
MMDF.__init__cCs|jdt�dS)z-Called before writing each message to file f.sN)rdrc)rr�rrrr�szMMDF._pre_message_hookcCs|jtdt�dS)z,Called after writing each message to file f.sN)rdrc)rr�rrrr��szMMDF._post_message_hookcCs�gg}}|jjd�d}x�|}|jj�}|jj�}|jdt�r�|j|�xV|}|jj�}|jj�}|dtkr�|j|tt��PqN|sN|j|�PqNWq|sPqWtt	t
||���|_t|j�|_|jjdd�|jj�|_
dS)z0Generate key-to-(start, stop) table of contents.rsrUN)r�rarnr�rorcr�r�rrrr�r�r�)rrr�next_posrrurrrr��s2






zMMDF._generate_toc)NT)rwrxryrzrr�r�r�rrrrrws

c@s�eZdZdZd0dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�ZdS)1rzAn MH mailbox.NTcCsttj||||�tjj|j�sj|r`tj|jd�tjtjtjj	|jd�tj
tjBtjBd��n
t
|j��d|_dS)zInitialize an MH instance.i�z
.mh_sequencesi�FN)rrrrr�rr�rLr�rr��O_EXCLr�rr�)rrrrrrrr�s
zMH.__init__cCs�|j�}t|�dkrd}nt|�d}tjj|jt|��}t|�}d}z�|j	rVt
|�zfy|j||�Wn:tk
r�|j	r�t
|�t|�d}tj|��YnXt|t�r�|j||�Wd|j	r�t
|�XWd|s�t|�X|S)z$Add message and return assigned key.rrWFTN)r8r��maxrrrrrgr�r�r�rvr�r�r�r$r[r�_dump_sequences)rr!r8Znew_keyr�r��closedrrrr"�s6


zMH.addcCsxtjj|jt|��}yt|d�}Wn>tk
r`}z"|jtjkrNt	d|��n�WYdd}~XnX|j
�tj|�dS)z=Remove the keyed message; raise KeyError if it doesn't exist.zrb+zNo message with key: %sN)rrrrrgr�r�r�r�r&rLr$)rr#rr�r�rrrr$�sz	MH.removecCs�tjj|jt|��}yt|d�}Wn>tk
r`}z"|jtjkrNt	d|��n�WYdd}~XnXzd|j
rrt|�z@tjtj|tj
tjB��|j||�t|t�r�|j||�Wd|j
r�t|�XWdt|�XdS)z>Replace the keyed message; raise KeyError if it doesn't exist.zrb+zNo message with key: %sN)rrrrrgr�r�r�r�r&r�r�rLr��O_TRUNCrvr[rr
r�r�)rr#r!rr�r�rrrr(�s$
zMH.__setitem__c Cs�y@|jr$ttjj|jt|��d�}nttjj|jt|��d�}Wn>tk
r~}z"|jtj	krlt
d|��n�WYdd}~XnX|�2|jr�t|�zt|�}Wd|jr�t
|�XWdQRXx*|j�j�D]\}}||kr�|j|�q�W|S)z4Return a Message representation or raise a KeyError.zrb+r�zNo message with key: %sN)r�r�rrrrrgr�r�r�r&r�rr��
get_sequencesr>�add_sequence)rr#r�r�r�r��key_listrrrr,�s&zMH.get_messagec Cs�y@|jr$ttjj|jt|��d�}nttjj|jt|��d�}Wn>tk
r~}z"|jtj	krlt
d|��n�WYdd}~XnX|�6|jr�t|�z|j�j
td�S|jr�t|�XWdQRXdS)z2Return a bytes representation or raise a KeyError.zrb+r�zNo message with key: %sNrQ)r�r�rrrrrgr�r�r�r&r�rSrbrcr�)rr#r�r�rrrr3szMH.get_bytescCsfyttjj|jt|��d�}Wn>tk
r\}z"|jtjkrJt	d|��n�WYdd}~XnXt
|�S)z6Return a file-like representation or raise a KeyError.r�zNo message with key: %sN)r�rrrrrgr�r�r�r&r�)rr#r�r�rrrr/)szMH.get_filecCsttdd�tj|j�D���S)zReturn an iterator over keys.css|]}|j�rt|�VqdS)N)�isdigitr�)�.0r�rrr�	<genexpr>6szMH.iterkeys.<locals>.<genexpr>)�iterr�rr�r)rrrrr64szMH.iterkeyscCstjjtjj|jt|���S)z9Return True if the keyed message exists, False otherwise.)rrr�rrrg)rr#rrrr?9szMH.__contains__cCstt|j���S)z*Return a count of messages in the mailbox.)r�r7r6)rrrrr@=sz
MH.__len__cCs2|js.ttjj|jd�d�|_t|j�d|_dS)zLock the mailbox.z
.mh_sequenceszrb+TN)r�r�rrrrr�r�)rrrrrJAs
zMH.lockcCs(|jr$t|j�t|j�|`d|_dS)z#Unlock the mailbox if it is locked.FN)r�r�r�r�)rrrrrKHs


z	MH.unlockcCsdS)z&Write any pending changes to the disk.Nr)rrrrrIPszMH.flushcCs|jr|j�dS)zFlush and close the mailbox.N)r�rK)rrrrrLTszMH.closecCs@g}x6tj|j�D]&}tjjtjj|j|��r|j|�qW|S)zReturn a list of folder names.)rr�rrr�rr�)rrBr�rrrr�Ys
zMH.list_folderscCsttjj|j|�|jdd�S)z+Return an MH instance for the named folder.F)rr)rrrrrr)rr�rrrr�asz
MH.get_foldercCsttjj|j|�|jd�S)z:Create a folder and return an MH instance representing it.)r)rrrrrr)rr�rrrr�fsz
MH.add_foldercCs`tjj|j|�}tj|�}|dgkr:tjtjj|d��n|gkrDntd|j��tj|�dS)z-Delete the named folder, which must be empty.z
.mh_sequenceszFolder not empty: %sN)rrrrr�r$rr�)rr�rZentriesrrrr�ks

zMH.remove_folderc
si}ttjj|jd�ddd���}t|j���x�|D]�}y�|jd�\}}t�}xT|j�D]H}|j�rr|j	t
|��qVdd�|jd�D�\}}	|jt||	d	��qVW�fd
d�t
|�D�||<t||�dkr�||=Wq2tk
r�td
|j���Yq2Xq2WWdQRX|S)z=Return a name-to-key-list dictionary to define each sequence.z
.mh_sequences�r�ASCII)�encodingr{css|]}t|�VqdS)N)r�)r�xrrrr�sz#MH.get_sequences.<locals>.<genexpr>�-rWcsg|]}|�kr|�qSrr)rr#)�all_keysrr�
<listcomp>�sz$MH.get_sequences.<locals>.<listcomp>rz"Invalid sequence specification: %sN)r�rrrr�setr8r�rr"r�rH�ranger�r�rOr�rstrip)
rZresultsr�rur��contentsr8�specr�r�r)rrr
ws&

 zMH.get_sequencescCs
ttjj|jd�ddd�}z�tjtj|jtjtjB��x�|j	�D]�\}}t
|�dkrXqB|j|d�d}d}xbtt
|��D]R}|d	|kr�|s�d
}|jd�n*|r�d}|jd||f�n|jd
|�|}q|W|r�|jt|�d�qB|jd�qBWWdt|�XdS)z:Set sequences using the given name-to-key-list dictionary.z
.mh_sequenceszr+r)rrr{NFrWTrz%s %sz %s�
)r�rrrrrLr�r�rr>r�rdr�rrgr�)r�	sequencesr�r�r8�prevZ
completingr#rrr�
set_sequences�s.zMH.set_sequencesc	CsL|j�}d}g}x�|j�D]�}|d|kr�|j||df�y4tjtjj|jt|��tjj|jt|d���WnHt	t
fk
r�tjtjj|jt|��tjj|jt|d���YnXtjtjj|jt|���|d7}qW|d|_
t|�dkr�dSxB|j�D]6\}}x*|D]"\}}||k�r|||j|�<�qW�qW|j|�dS)z?Re-name messages to eliminate numbering gaps. Invalidates keys.rrWN)r
r6r�rr�rrrrgr�r�r��unlinkr�r�r>�indexr#)	rr!r"Zchangesr#r�r�oldr}rrr�pack�s, 

zMH.packcCs||j�}|j�}x<|j�D]0\}}||kr6|j|�q||kr||j|�=qWx|D]}||krT|g||<qTW|j|�dS)z;Inspect a new MHMessage and update sequences appropriately.N)r
r>r�r%r#)rr!r#Zpending_sequencesZ
all_sequencesr�r�sequencerrrr
�s
zMH._dump_sequences)NT)rwrxryrzrr"r$r(r,r3r/r6r?r@rJrKrIrLr�r�r�r�r
r#r'r
rrrrr�s.
"c@s�eZdZdZedddddddh�Zd%dd�Zd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd �Zd!d"�Zd#d$�Zd	S)&rzAn Rmail-style Babyl mailbox.�unseen�deletedZfiled�answered�	forwardedZedited�resentNTcCstj||||�i|_dS)zInitialize a Babyl mailbox.N)r�r�_labels)rrrrrrrr�szBabyl.__init__cCs(tj||�}t|t�r$|j�|j|<|S)z$Add message and return assigned key.)r�r"r[r�
get_labelsr.)rr!r#rrrr"�s
z	Babyl.addcCs"tj||�||jkr|j|=dS)z=Remove the keyed message; raise KeyError if it doesn't exist.N)r�r$r.)rr#rrrr$�s
zBabyl.removecCs*tj|||�t|t�r&|j�|j|<dS)z>Replace the keyed message; raise KeyError if it doesn't exist.N)r�r(r[rr/r.)rr#r!rrrr(�s
zBabyl.__setitem__c
Cs�|j|�\}}|jj|�|jj�tj�}x4|jj�}|dtksJ|rLP|j|jtd��q.Wtj�}x0|jj�}|tks�|r�P|j|jtd��qlW||jj	�}|jj
|�}|jtd�}t|j�|�}	|	j
|j��||jkr�|	j|j|�|	S)z4Return a Message representation or raise a KeyError.s*** EOOH ***rQ)r�r�rarnr\r]rcrdrbr�rSrrm�set_visibler.�
set_labels)
rr#r�r��original_headersruZvisible_headers�nZbodyr�rrrr,�s.



zBabyl.get_messagec	Cs�|j|�\}}|jj|�|jj�tj�}x4|jj�}|dtksJ|rLP|j|jtd��q.Wx|jj�}|tks||rdPqdW|j	�}||jj
�}|jj|�}|jtd�}||S)z3Return a string representation or raise a KeyError.s*** EOOH ***rQ)r�r�rarnr\r]rcrdrbrmr�rS)	rr#r�r�r2ruZheadersr3rtrrrr3s$


zBabyl.get_bytescCstj|j|�jdt��S)z6Return a file-like representation or raise a KeyError.rQ)r\r]r3rbrc)rr#rrrr/%szBabyl.get_filecCs@|j�t�}x|jj�D]}|j|�qW|j|j�t|�S)z4Return a list of user-defined labels in the mailbox.)r�rr.r<rH�difference_update�_special_labelsr7)r�labelsZ
label_listrrrr/)szBabyl.get_labelscCs>gg}}|jjd�d}g}x�|}|jj�}|jj�}|dtkr�t|�t|�krf|j|tt��|j|�dd�|jj�dd�jd�D�}|j|�q |dks�|dtkr�t|�t|�kr�|j|tt��q |s |j|tt��Pq Wtt	t
||���|_tt	|��|_t|j�|_
|jjdd	�|jj�|_dS)
z0Generate key-to-(start, stop) table of contents.rscSsg|]}|j�r|j��qSr)�strip)r�labelrrrr@sz'Babyl._generate_toc.<locals>.<listcomp>rWN�,�rU)r�rarnr�rcr�r�r�rrrr�r.r�r�)rrrrZlabel_listsrrur6rrrr�2s4



zBabyl._generate_toccCsVdt}|dt7}|j�}dd�|D�}|ddj|�t7}|d7}|j|�dS)	z,Called before writing the mailbox to file f.sBABYL OPTIONS:s
Version: 5css|]}|j�VqdS)N)rM)rr8rrrrUsz*Babyl._pre_mailbox_hook.<locals>.<genexpr>sLabels:r9r:N)rcr/rrd)rr�Zbabylr6rrrr�PszBabyl._pre_mailbox_hookcCs|jdt�dS)z-Called before writing each message to file f.�N)rdrc)rr�rrrr�ZszBabyl._pre_message_hookcCs|jtd�dS)z,Called after writing each message to file f.r:N)rdrc)rr�rrrr�^szBabyl._post_message_hookcCs�|jj�}t|t�r�g}g}x0|j�D]$}||jkr@|j|�q&|j|�q&W|jjd�x |D]}|jjd|j��q`W|jjd�x$|D]}|jjd|j�d�q�W|jjt	�n|jjdt	�t|t
jj��r0t
j�}t
jj|dd�}|j|�|jd�x6|j�}|jj|jd	t	��|d	k�s8|�r
P�q
W|jjd
t	�t|t��r�t
j�}	t
jj|	dd�}
|
j|j��xz|	j�}|jj|jd	t	��|d	k�s�|�r�P�q�WnB|jd�x6|j�}|jj|jd	t	��|d	k�s�|�r�P�q�Wx,|jd�}|�sP|jj|jd	t	���qW�nZt|ttt
jf��r,t|t
j��rhtjdtd
�|j�}t|t��r~|j|�}|jd�d}|ddk�r|jj|d|�jd	t	��|jjd
t	�|jj|d|�jd	t	��|jj||d�jd	t	��n(|jjd
t	t	�|jj|jd	t	���n^t |d��rzt |d��rXtjdtd
�|j!}|j�}
d}x�|j�}|j"d��r�|dd�d	}n|j"d��r�|dd�d	}|jj|jd	t	��|d	k�s�|�rf|�r�d}|jjd
t	�|j|
�nP�qfWx�|j�}|�sP|j"d��r,|dd�t	}n:|j"d��rJ|dd�t	}n|j"d	��rf|dd�t	}|jj|��q�Wnt#dt$|���|jj�}||fS)z0Write message contents and return (start, stop).�1s, s,,� r9s1,,FrrQs*** EOOH ***iz8Use of StringIO input is deprecated, use BytesIO insteadrRs

rUrWNrnrTzDUse of text mode files is deprecated, use a binary mode file insteadTs
rVzInvalid message type: %srZrYrZrYrZrZ)%r�r�r[rr/r5r�rdrMrcr1r!rr\r]r^r_r`rarnrb�get_visiblerSrhrgrirjrkrlrmrPr�rErTrfrprq)rr!r�Zspecial_labelsr6r8Zorig_bufferZorig_generatorruZ
vis_bufferZ
vis_generatorrTZ
body_startZoriginal_posZ
first_passr�rrrr�bs�











zBabyl._install_message)NT)rwrxryrz�	frozensetr5rr"r$r(r,r3r/r/r�r�r�r�r�rrrrr�s 

	
c@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
rz0Message with mailbox-format-specific properties.NcCs�t|tjj�r4|jtj|��t|t�r�|j|�n�t|t�rP|jtj	|��n~t|t
�rl|jtj|��nbt|tj
�r�|jtj|��nDt|d�r�|jtj|��n(|dkr�tjjj|�ntdt|���dS)zInitialize a Message instance.rSNzInvalid message type: %s)r[r1r!r�_become_message�copy�deepcopy�_explain_torhr2rgZmessage_from_stringr\�
TextIOWrapperZmessage_from_filerEZmessage_from_binary_filerrprq)rr!rrrr�s



zMessage.__init__cCs8t|dg�}x&|jD]}||kr|j||j|<qWdS)z0Assume the non-format-specific state of message.�_type_specific_attributesN)�getattr�__dict__)rr!Z
type_specificr�rrrr@�szMessage._become_messagecCst|t�rdStd��dS)z:Copy format-specific state to message insofar as possible.Nz Cannot convert to specified type)r[rrp)rr!rrrrC�s
zMessage._explain_to)N)rwrxryrzrr@rCrrrrr�s
c@s|eZdZdZdddgZddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)r	z)Message with Maildir-specific properties.�_subdir�_info�_dateNcCs&d|_d|_tj�|_tj||�dS)z%Initialize a MaildirMessage instance.r}r�N)rHrIr�rJrr)rr!rrrr�s
zMaildirMessage.__init__cCs|jS)zReturn 'new' or 'cur'.)rH)rrrrr��szMaildirMessage.get_subdircCs(|dks|dkr||_ntd|��dS)zSet subdir to 'new' or 'cur'.r}r~z!subdir must be 'new' or 'cur': %sN)rHrO)rr�rrrr�szMaildirMessage.set_subdircCs"|jjd�r|jdd�SdSdS)z*Return as a string the flags that are set.z2,rUNr�)rIro)rrrr�	get_flags
szMaildirMessage.get_flagscCsddjt|��|_dS)z)Set the given flags and unset all others.z2,r�N)rr�rI)r�flagsrrr�	set_flagsszMaildirMessage.set_flagscCs$|jdjt|j��t|�B��dS)z.Set the given flag(s) without changing others.r�N)rMrrrK)r�flagrrr�add_flagszMaildirMessage.add_flagcCs,|j�r(|jdjt|j��t|���dS)z7Unset the given string flag(s) without changing others.r�N)rKrMrr)rrNrrr�remove_flagszMaildirMessage.remove_flagcCs|jS)z<Return delivery date of message, in seconds since the epoch.)rJ)rrrrr�szMaildirMessage.get_datecCs4yt|�|_Wn tk
r.td|��YnXdS)z9Set delivery date of message, in seconds since the epoch.zcan't convert to float: %sN)�floatrJrOrp)rZdaterrrr�"szMaildirMessage.set_datecCs|jS)z%Get the message's "info" as a string.)rI)rrrrr�)szMaildirMessage.get_infocCs&t|t�r||_ntdt|���dS)z Set the message's "info" string.zinfo must be a string: %sN)r[rgrIrprq)r�inforrrr�-s
zMaildirMessage.set_infocCs�t|t�r8|j|j��|j|j��|j|j���nht|t�r�t	|j��}d|kr`|j
d�|j�dkrv|j
d�d|kr�|j
d�d|kr�|j
d�d|kr�|j
d�|jd	tj
|j���n�t|t��rt	|j��}d|kr�|jd
�d|k�r|jd�d|k�r�|jd�n�t|t��r�t	|j��}d|k�rD|jd
�d|k�rX|jd
�d|k�rl|jd�d|k�r�|jd�nt|t��r�ntdt|���dS)z;Copy Maildir-specific state to message insofar as possible.�S�Rr~�O�T�D�F�Az
MAILER-DAEMONr)�replied�flaggedr*r+�Pr,z$Cannot convert to specified type: %sN)r[r	rMrKr�r�r�r�r�rrOr�r�r�rrr�	add_labelrrprq)rr!rLrrrrC4sN

















zMaildirMessage._explain_to)N)rwrxryrzrErr�r�rKrMrOrPr�r�r�r�rCrrrrr	�s

c@sZeZdZdZdgZddd�Zdd�Zddd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)r�z/Message with mbox- or MMDF-specific properties.�_fromNcCsV|jdd�t|tjj�rF|j�}|dk	rF|jd�rF|j|dd��tj||�dS)z'Initialize an mboxMMDFMessage instance.z
MAILER-DAEMONTNzFrom rX)r�r[r1r!rr�ror)rr!r�rrrresz_mboxMMDFMessage.__init__cCs|jS)z Return contents of "From " line.)r^)rrrrr�nsz_mboxMMDFMessage.get_fromcCs4|dk	r*|dkrtj�}|dtj|�7}||_dS)z>Set "From " line, formatting and appending time_ if specified.NT� )r�r�r�r^)rr�Ztime_rrrr�rs
z_mboxMMDFMessage.set_fromcCs|jdd�|jdd�S)z*Return as a string the flags that are set.�Statusr�zX-Status)r+)rrrrrKzsz_mboxMMDFMessage.get_flagscCs�t|�}d
\}}x&dD]}||kr||7}|j|�qWx&dD]}||kr>||7}|j|�q>W|djt|��7}y|jd|�Wn tk
r�|jd|�YnXy|jd|�Wn tk
r�|jd|�YnXd	S)
z)Set the given flags and unset all others.r�rTrUrWrXrYr`zX-StatusN)r�r�)rTrU)rWrXrY)rr$rr��replace_headerr&Z
add_header)rrLZstatus_flagsZ
xstatus_flagsrNrrrrM~s&

z_mboxMMDFMessage.set_flagscCs$|jdjt|j��t|�B��dS)z.Set the given flag(s) without changing others.r�N)rMrrrK)rrNrrrrO�sz_mboxMMDFMessage.add_flagcCs4d|ksd|kr0|jdjt|j��t|���dS)z7Unset the given string flag(s) without changing others.r`zX-Statusr�N)rMrrrK)rrNrrrrP�sz_mboxMMDFMessage.remove_flagcCs�t|t�r�t|j��}d|kr(|jd�d|kr:|jd�d|krL|jd�d|kr^|jd�d|krp|jd�|d	=|d
=dj|j�j�dd
��}y|j	t
jtj
|d���Wnttfk
r�YnX�n
t|t�r�|j|j��|j|j��n�t|t��rZt|j��}d|k�r$|jd�d|k�r8|jd�d|k�rL|jd�|d	=|d
=n�t|t��r�t|j��}d|k�r�|jd�d|k�r�|jd�d|k�r�|jd�|d	=|d
=nt|t��r�ntdt|���d
S)zACopy mbox- or MMDF-specific state to message insofar as possible.rUr~rXrYrTrSrWrVZstatuszx-statusr_rXNz%a %b %d %H:%M:%S %Yr)rZr[r*r+z$Cannot convert to specified type: %s���)r[r	rrKr�rOrr�r�r��calendarZtimegmr�ZstrptimerO�
OverflowErrorr�rMr�rrrr]rrprq)rr!rLZ
maybe_daterrrrC�s^



















z_mboxMMDFMessage._explain_to)N)N)
rwrxryrzrErr�r�rKrMrOrPrCrrrrr�`s
	
r�c@seZdZdZdS)r
z&Message with mbox-specific properties.N)rwrxryrzrrrrr
�sc@sHeZdZdZdgZddd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)rz$Message with MH-specific properties.�
_sequencesNcCsg|_tj||�dS)z!Initialize an MHMessage instance.N)rerr)rr!rrrr�szMHMessage.__init__cCs|jdd�S)z4Return a list of sequences that include the message.N)re)rrrrr
�szMHMessage.get_sequencescCst|�|_dS)z3Set the list of sequences that include the message.N)r7re)rr!rrrr#�szMHMessage.set_sequencescCs6t|t�r"||jkr2|jj|�ntdt|���dS)z8Add sequence to list of sequences including the message.zsequence type must be str: %sN)r[rgrer�rprq)rr(rrrr�s

zMHMessage.add_sequencecCs*y|jj|�Wntk
r$YnXdS)zARemove sequence from the list of sequences including the message.N)rer$rO)rr(rrr�remove_sequence�szMHMessage.remove_sequencecCsJt|t�rdt|j��}d|kr*|jd�n|jd�|jd�d|krP|jd�d|krb|jd�n�t|t�r�t|j��}d|kr�|jd�n
|jd	�d|kr�|jd�d|kr�|jd
�n�t|t�r�x||j�D]}|j|�q�Wn`t|t	��r(t|j��}d|k�r|j
d�d|k�rF|j
d�nt|t��r6ntdt
|���d
S)z6Copy MH-specific state to message insofar as possible.r)r~rSr[rXrZrT�ROrUrYr+z$Cannot convert to specified type: %sN)r[r	rr
r�rOr�rrrr]rrprq)rr!r!r(rrrrC�s@










zMHMessage._explain_to)N)rwrxryrzrErr
r#rrfrCrrrrr�s
c@sbeZdZdZddgZddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)rz'Message with Babyl-specific properties.r.�_visibleNcCsg|_t�|_tj||�dS)z#Initialize a BabylMessage instance.N)r.rrhr)rr!rrrr"szBabylMessage.__init__cCs|jdd�S)z'Return a list of labels on the message.N)r.)rrrrr/(szBabylMessage.get_labelscCst|�|_dS)z&Set the list of labels on the message.N)r7r.)rr6rrrr1,szBabylMessage.set_labelscCs6t|t�r"||jkr2|jj|�ntdt|���dS)z+Add label to list of labels on the message.zlabel must be a string: %sN)r[rgr.r�rprq)rr8rrrr]0s

zBabylMessage.add_labelcCs*y|jj|�Wntk
r$YnXdS)z4Remove label from the list of labels on the message.N)r.r$rO)rr8rrr�remove_label8szBabylMessage.remove_labelcCs
t|j�S)z3Return a Message representation of visible headers.)rrh)rrrrr>?szBabylMessage.get_visiblecCst|�|_dS)z2Set the Message representation of visible headers.N)rrh)rZvisiblerrrr0CszBabylMessage.set_visiblecCsjx6|jj�D](}||kr,|jj|||�q|j|=qWx,dD]$}||kr>||jkr>|||j|<q>WdS)	z9Update and/or sensibly generate a set of visible headers.�Date�From�Reply-To�To�CC�SubjectN)rjrkrlrmrnro)rhr8ra)r�headerrrr�update_visibleGs
zBabylMessage.update_visiblecCsvt|t�r~t|j��}d|kr*|jd�n|jd�|jd�d|ksNd|krX|jd�d|krj|jd�d	|kr||jd
�n�t|t�r�t|j��}d|kr�|jd�n
|jd�d	|kr�|jd
�d|kr�|jd�n�t|t��rt|j��}d|k�r|jd�d|k�rr|jd�nXt|t	��rT|j
|j��x<|j�D]}|j|��q>Wnt|t
��rbntdt|���dS)z9Copy Babyl-specific state to message insofar as possible.r)r~rSr,r-r\r+rTr*rVrgrUrWrYrZz$Cannot convert to specified type: %sN)r[r	rr/r�rOr�rrrr0r>r]rrprq)rr!r6r8rrrrCRsF










zBabylMessage._explain_to)N)rwrxryrzrErr/r1r]rir>r0rqrCrrrrrs
c@seZdZdZdS)r
z&Message with MMDF-specific properties.N)rwrxryrzrrrrr
|sc@s�eZdZdZd&dd�Zd'dd�Zd(dd�Zd)d	d
�Zd*dd�Zd
d�Z	dd�Z
d+dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zed$d%��ZdS),r�zA read-only wrapper of a file.NcCs$||_|dkr|j�|_n||_dS)zInitialize a _ProxyFile.N)r�r��_pos)rr��posrrrr�sz_ProxyFile.__init__cCs|j||jj�S)zRead bytes.)�_readr�rS)r�sizerrrrS�sz_ProxyFile.readcCs|j||jj�S)zRead bytes.)rtr��read1)rrurrrrv�sz_ProxyFile.read1cCs|j||jj�S)zRead a line.)rtr�rn)rrurrrrn�sz_ProxyFile.readlinecCs>g}x4|D],}|j|�|dk	r
|t|�8}|dkr
Pq
W|S)zRead multiple lines.Nr)r�r�)r�sizehintrBrurrr�	readlines�s

z_ProxyFile.readlinesccs x|j�}|sdS|VqWdS)zIterate over lines.N)rn)rrurrrr;�s
z_ProxyFile.__iter__cCs|jS)zReturn the position.)rr)rrrrr��sz_ProxyFile.tellrcCs4|dkr|jj|j�|jj||�|jj�|_dS)zChange position.rWN)r�rarrr�)r�offset�whencerrrra�sz_ProxyFile.seekc
Cs0t|d�r,zt|jd�r"|jj�Wd|`XdS)zClose the file.r�rLN)rEr�rL)rrrrrL�s

z_ProxyFile.closecCs2|dkrd}|jj|j�||�}|jj�|_|S)z"Read size bytes using read_method.NrWrZ)r�rarrr�)rru�read_methodrBrrrrt�sz_ProxyFile._readcCs|S)z$Context management protocol support.r)rrrr�	__enter__�sz_ProxyFile.__enter__cGs|j�dS)N)rL)r�excrrr�__exit__�sz_ProxyFile.__exit__cCs
|jj�S)N)r��readable)rrrrr�sz_ProxyFile.readablecCs
|jj�S)N)r��writable)rrrrr��sz_ProxyFile.writablecCs
|jj�S)N)r��seekable)rrrrr��sz_ProxyFile.seekablecCs
|jj�S)N)r�rI)rrrrrI�sz_ProxyFile.flushcCs&t|d�sdSt|jd�sdS|jjS)Nr�TrF)rEr�r)rrrrr�s

z_ProxyFile.closed)N)N)N)N)N)r)rwrxryrzrrSrvrnrxr;r�rarLrtr|r~rr�r�rI�propertyrrrrrr��s$





		r�c@s<eZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
�ZdS)r�z&A read-only wrapper of part of a file.NcCstj|||�||_||_dS)zInitialize a _PartialFile.N)r�r�_start�_stop)rr�r�r�rrrr�sz_PartialFile.__init__cCstj|�|jS)z*Return the position with respect to start.)r�r�r�)rrrrr��sz_PartialFile.tellrcCs<|dkr|j|_d}n|dkr*|j|_d}tj|||�dS)z8Change position, possibly with respect to start or stop.rrWrUN)r�rrr�r�ra)rryrzrrrra�sz_PartialFile.seekcCsB|j|j}|dkrdS|dks0|dks0||kr4|}tj|||�S)z;Read size bytes using read_method, honoring start and stop.rr�N)r�rrr�rt)rrur{Z	remainingrrrrt�sz_PartialFile._readcCst|d�r|`dS)Nr�)rEr�)rrrrrLs
z_PartialFile.close)NN)r)	rwrxryrzrr�rartrLrrrrr��s


	r�Tc4Cs�d}�yZtrpytj|tjtjB�WnJtk
rn}z.|jtjtjtjfkr\t	d|j
��n�WYdd}~XnX|�r^yt|j
d�}|j�Wn:tk
r�}z|jtjtjfkr�dS�WYdd}~XnXy`yt
j|j
|j
d�d}Wn2ttfk
�rt
j|j
|j
d�d}YnXt
j|j
�Wn0tk
�r\t
j|j
�t	d|j
��YnXWn8t�r|tj|tj�|�r�t
j|j
d��YnXdS)z(Lock file f using lockf and dot locking.Fzlockf: lock unavailable: %sNz.lockTzdot lock unavailable: %s)�fcntl�lockfZLOCK_EXZLOCK_NBr�r�ZEAGAINr�r�rr�r�rLrr�r�r�r�r$r�r$�LOCK_UN)r�r�Zdotlock_doner�Zpre_lockrrrr�
sH
r�cCs8trtj|tj�tjj|jd�r4tj|jd�dS)z*Unlock file f using lockf and dot locking.z.lockN)r�r�r�rrr�r�r$)r�rrrr�4sr�cCs8tj|tjtjBtjBd�}z
t|d�Stj|�XdS)zCCreate a file if it doesn't exist and open for reading and writing.i�zrb+N)rr�r�r�O_RDWRrL)r�fdrrrr�;s
r�cCs$td|ttj��tj�tj�f�S)zBCreate a temp file based on path and open for reading and writing.z%s.%s.%s.%s)r�r�r�r�r�rr�)rrrrr�Csr�cCs$|j�ttd�r tj|j��dS)z0Ensure changes to file f are physically on disk.�fsyncN)rIrErr��fileno)r�rrrr�Is
r�cCst|�|j�dS)z:Close file f, ensuring all changes are physically on disk.N)r�rL)r�rrrr�Osr�c@seZdZdZdS)rz"Raised for module-specific errors.N)rwrxryrzrrrrrUsc@seZdZdZdS)rz:The specified mailbox does not exist and won't be created.N)rwrxryrzrrrrrXsc@seZdZdZdS)rz>The specified mailbox is not empty and deletion was requested.N)rwrxryrzrrrrr[sc@seZdZdZdS)rz)Another process caused an action to fail.N)rwrxryrzrrrrr^sc@seZdZdZdS)rz)A file appears to have an invalid format.N)rwrxryrzrrrrras)T)0rzrr�rcr�r�rArjr1Z
email.messageZemail.generatorr\r-r��ImportError�__all__rcrMrrr�r�rrrrr!rr	r�r
rrr
r�r�r�r�r�r�r�r��	Exceptionrrrrrrrrr�<module>sp

h8DB4-3z%mqH_c'
*operator.cpython-36.opt-2.pyc000064400000026300150335715140011772 0ustar003


 \o*�6@s$dddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5g6Zd6d7lmZd8d%�Zd9d"�Zd:d�Zd;d*�Zd<d
�Zd=d�Z	d>d,�Z
d?d4�Zd@d�ZdAd�Z
dBd�ZdCd�ZdDd�ZdEd	�ZdFd�ZdGd�ZeZdHd$�ZdId(�ZdJd)�ZdKd&�ZdLd+�ZdMd-�ZdNd.�ZdOd/�ZdPd0�ZdQd2�ZdRd3�ZdSd5�ZdTd�Z dUd�Z!dVd�Z"dWd�Z#dXd�Z$dYd�Z%dZd1�Z&dpd[d#�Z'Gd\d�d�Z(Gd]d�d�Z)Gd^d'�d'�Z*d_d
�Z+d`d�Z,dad�Z-dbd�Z.dcd�Z/ddd�Z0ded�Z1dfd�Z2dgd�Z3dhd�Z4did�Z5djd�Z6dkd �Z7dld!�Z8yd6dml9TWne:k
�r^YnXd6dnl9m;Z;eZ<eZ=eZ>eZ?eZ@e	ZAe
ZBeZCeZDeZEeZFeZGeZHeZIeZJeZKeZLeZMeZNeZOeZPeZQeZReZSeZTeZUe ZVe!ZWe#ZXe$ZYe&ZZe+Z[e,Z\e-Z]e.Z^e/Z_e0Z`e1Zae2Zbe3Zce4Zde5Zee6Zfe7Zge8ZhdoS)q�abs�add�and_�
attrgetter�concat�contains�countOf�delitem�eq�floordiv�ge�getitem�gt�iadd�iand�iconcat�	ifloordiv�ilshift�imatmul�imod�imul�index�indexOf�inv�invert�ior�ipow�irshift�is_�is_not�isub�
itemgetter�itruediv�ixor�le�length_hint�lshift�lt�matmul�methodcaller�mod�mul�ne�neg�not_�or_�pos�pow�rshift�setitem�sub�truediv�truth�xor�)rcCs||kS)N�)�a�br8r8� /usr/lib64/python3.6/operator.pyr&scCs||kS)Nr8)r9r:r8r8r;r#scCs||kS)Nr8)r9r:r8r8r;r	#scCs||kS)Nr8)r9r:r8r8r;r+'scCs||kS)Nr8)r9r:r8r8r;r+scCs||kS)Nr8)r9r:r8r8r;r
/scCs|S)Nr8)r9r8r8r;r-5scCs|rdSdS)NTFr8)r9r8r8r;r59scCs||kS)Nr8)r9r:r8r8r;r=scCs||k	S)Nr8)r9r:r8r8r;rAscCst|�S)N)�_abs)r9r8r8r;rGscCs||S)Nr8)r9r:r8r8r;rKscCs||@S)Nr8)r9r:r8r8r;rOscCs||S)Nr8)r9r:r8r8r;r
SscCs|j�S)N)�	__index__)r9r8r8r;rWscCs|S)Nr8)r9r8r8r;r[scCs||>S)Nr8)r9r:r8r8r;r%`scCs||S)Nr8)r9r:r8r8r;r)dscCs||S)Nr8)r9r:r8r8r;r*hscCs||S)Nr8)r9r:r8r8r;r'lscCs|S)Nr8)r9r8r8r;r,pscCs||BS)Nr8)r9r:r8r8r;r.tscCs|
S)Nr8)r9r8r8r;r/xscCs||S)Nr8)r9r:r8r8r;r0|scCs||?S)Nr8)r9r:r8r8r;r1�scCs||S)Nr8)r9r:r8r8r;r3�scCs||S)Nr8)r9r:r8r8r;r4�scCs||AS)Nr8)r9r:r8r8r;r6�scCs(t|d�s dt|�j}t|��||S)N�__getitem__z!'%s' object can't be concatenated)�hasattr�type�__name__�	TypeError)r9r:�msgr8r8r;r�s
cCs||kS)Nr8)r9r:r8r8r;r�scCs&d}x|D]}||kr
|d7}q
W|S)Nr7�r8)r9r:�count�ir8r8r;r�s

cCs
||=dS)Nr8)r9r:r8r8r;r�scCs||S)Nr8)r9r:r8r8r;r�scCs.x(t|�D]\}}||kr
|Sq
Wtd��dS)Nz$sequence.index(x): x not in sequence)�	enumerate�
ValueError)r9r:rF�jr8r8r;r�scCs|||<dS)Nr8)r9r:�cr8r8r;r2�scCs�t|t�s dt|�j}t|��yt|�Stk
r<YnXyt|�j}Wntk
r`|SXy||�}Wntk
r�|SX|tkr�|St|t�s�dt|�j}t|��|dkr�d}t	|��|S)Nz/'%s' object cannot be interpreted as an integerz'__length_hint__ must be integer, not %sr7z$__length_hint__() should return >= 0)
�
isinstance�intr@rArB�len�__length_hint__�AttributeError�NotImplementedrH)�obj�defaultrCZhint�valr8r8r;r$�s4	

c@s0eZdZdZdd�Zdd�Zdd�Zd	d
�ZdS)
r�_attrs�_callcsn|s<t|t�std��|f|_|jd���fdd�}||_n.|f||_ttt|j����fdd�}||_dS)Nzattribute name must be a string�.csx�D]}t||�}qW|S)N)�getattr)rQ�name)�namesr8r;�func�s
z!attrgetter.__init__.<locals>.funccst�fdd��D��S)Nc3s|]}|��VqdS)Nr8)�.0�getter)rQr8r;�	<genexpr>�sz4attrgetter.__init__.<locals>.func.<locals>.<genexpr>)�tuple)rQ)�getters)rQr;rZ�s)	rK�strrBrT�splitrUr^�mapr)�self�attrZattrsrZr8)r_rYr;�__init__�s

zattrgetter.__init__cCs
|j|�S)N)rU)rcrQr8r8r;�__call__�szattrgetter.__call__cCs$d|jj|jjdjtt|j��fS)Nz	%s.%s(%s)z, )�	__class__�
__module__�__qualname__�joinrb�reprrT)rcr8r8r;�__repr__szattrgetter.__repr__cCs|j|jfS)N)rgrT)rcr8r8r;�
__reduce__szattrgetter.__reduce__N)rTrU)rArhri�	__slots__rerfrlrmr8r8r8r;r�s
c@s0eZdZdZdd�Zdd�Zdd�Zd	d
�ZdS)
r �_itemsrUcsF�s �f|_�fdd�}||_n"�f�|_��fdd�}||_dS)Ncs|�S)Nr8)rQ)�itemr8r;rZsz!itemgetter.__init__.<locals>.funccst�fdd��D��S)Nc3s|]}�|VqdS)Nr8)r[rF)rQr8r;r]sz4itemgetter.__init__.<locals>.func.<locals>.<genexpr>)r^)rQ)�items)rQr;rZs)rorU)rcrprqrZr8)rprqr;reszitemgetter.__init__cCs
|j|�S)N)rU)rcrQr8r8r;rfszitemgetter.__call__cCs$d|jj|jjdjtt|j��fS)Nz	%s.%s(%s)z, )rgrhrArjrbrkro)rcr8r8r;rl szitemgetter.__repr__cCs|j|jfS)N)rgro)rcr8r8r;rm%szitemgetter.__reduce__N)rorU)rArhrirnrerfrlrmr8r8r8r;r 	s
c@s0eZdZd
Zdd�Zdd�Zdd	�Zd
d�ZdS)r(�_name�_args�_kwargscOsVt|�dkrd}t|��|d}|d|_t|jt�s>td��|dd�|_||_dS)N�z9methodcaller needs at least one argument, the method namer7rDzmethod name must be a string)rMrBrrrKr`rsrt)�args�kwargsrCrcr8r8r;re1s
zmethodcaller.__init__cCst||j�|j|j�S)N)rWrrrsrt)rcrQr8r8r;rf<szmethodcaller.__call__cCsTt|j�g}|jtt|j��|jdd�|jj�D��d|jj|jj	dj
|�fS)Ncss|]\}}d||fVqdS)z%s=%rNr8)r[�k�vr8r8r;r]Bsz(methodcaller.__repr__.<locals>.<genexpr>z	%s.%s(%s)z, )rkrr�extendrbrsrtrqrgrhrArj)rcrvr8r8r;rl?szmethodcaller.__repr__cCsD|js|j|jf|jfSddlm}||j|jf|j�|jfSdS)Nr7)�partial)rtrgrrrs�	functoolsr{)rcr{r8r8r;rmGszmethodcaller.__reduce__N)rrrsrt)rArhrirnrerfrlrmr8r8r8r;r((s
cCs||7}|S)Nr8)r9r:r8r8r;rQscCs||M}|S)Nr8)r9r:r8r8r;rVscCs,t|d�s dt|�j}t|��||7}|S)Nr>z!'%s' object can't be concatenated)r?r@rArB)r9r:rCr8r8r;r[s

cCs||}|S)Nr8)r9r:r8r8r;rcscCs||K}|S)Nr8)r9r:r8r8r;rhscCs||;}|S)Nr8)r9r:r8r8r;rmscCs||9}|S)Nr8)r9r:r8r8r;rrscCs||}|S)Nr8)r9r:r8r8r;rwscCs||O}|S)Nr8)r9r:r8r8r;r|scCs||C}|S)Nr8)r9r:r8r8r;r�scCs||L}|S)Nr8)r9r:r8r8r;r�scCs||8}|S)Nr8)r9r:r8r8r;r�scCs||}|S)Nr8)r9r:r8r8r;r!�scCs||N}|S)Nr8)r9r:r8r8r;r"�s)�*)�__doc__N)r7)i�__all__�builtinsrr<r&r#r	r+rr
r-r5rrrrr
rrrr%r)r*r'r,r.r/r0r1r3r4r6rrrrrrr2r$rr r(rrrrrrrrrrrrr!r"�	_operator�ImportErrorr~�__lt__�__le__�__eq__�__ne__�__ge__�__gt__�__not__�__abs__�__add__�__and__�__floordiv__r=�__inv__�
__invert__�
__lshift__�__mod__�__mul__�
__matmul__�__neg__�__or__�__pos__�__pow__�
__rshift__�__sub__�__truediv__�__xor__�
__concat__�__contains__�__delitem__r>�__setitem__�__iadd__�__iand__�__iconcat__�
__ifloordiv__�__ilshift__�__imod__�__imul__�__imatmul__�__ior__�__ipow__�__irshift__�__isub__�__itruediv__�__ixor__r8r8r8r;�<module>
s�
)')sched.cpython-36.opt-1.pyc000064400000014646150335715140011236 0ustar003


 \o�@s�dZddlZddlZddlmZyddlZWnek
rHddlZYnXddlmZ	dgZ
Gdd�dedd��Zd	ej_d
ej_dej
_dej_d
ej_e�ZGdd�d�ZdS)a�A generally useful event scheduler class.

Each instance of this class manages its own queue.
No multi-threading is implied; you are supposed to hack that
yourself, or use a single instance per application.

Each instance is parametrized with two functions, one that is
supposed to return the current time, one that is supposed to
implement a delay.  You can implement real-time scheduling by
substituting time and sleep from built-in module time, or you can
implement simulated time by writing your own functions.  This can
also be used to integrate scheduling with STDWIN events; the delay
function is allowed to modify the queue.  Time can be expressed as
integers or floating point numbers, as long as it is consistent.

Events are specified by tuples (time, priority, action, argument, kwargs).
As in UNIX, lower priority numbers mean higher priority; in this
way the queue can be maintained as a priority queue.  Execution of the
event means calling the action function, passing it the argument
sequence in "argument" (remember that in Python, multiple function
arguments are be packed in a sequence) and keyword parameters in "kwargs".
The action function may be an instance method so it
has another way to reference private data (besides global variables).
�N)�
namedtuple)�	monotonic�	schedulerc@s8eZdZgZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�EventcCs|j|jf|j|jfkS)N)�time�priority)�s�o�r
�/usr/lib64/python3.6/sched.py�__eq__'szEvent.__eq__cCs|j|jf|j|jfkS)N)rr)rr	r
r
r�__lt__(szEvent.__lt__cCs|j|jf|j|jfkS)N)rr)rr	r
r
r�__le__)szEvent.__le__cCs|j|jf|j|jfkS)N)rr)rr	r
r
r�__gt__*szEvent.__gt__cCs|j|jf|j|jfkS)N)rr)rr	r
r
r�__ge__+szEvent.__ge__N)	�__name__�
__module__�__qualname__�	__slots__rr
rrrr
r
r
rr%srz(time, priority, action, argument, kwargszaNumeric type compatible with the return value of the
timefunc function passed to the constructor.zSEvents scheduled for the same time will be executed
in the order of their priority.z?Executing the event means executing
action(*argument, **kwargs)zGargument is a sequence holding the positional
arguments for the action.zDkwargs is a dictionary holding the keyword
arguments for the action.c@s^eZdZeejfdd�Zfefdd�Zfefdd�Z	dd�Z
d	d
�Zddd
�Ze
dd��ZdS)rcCs g|_tj�|_||_||_dS)zGInitialize a new instance, passing the time and delay
        functionsN)�_queue�	threading�RLock�_lock�timefunc�	delayfunc)�selfrrr
r
r�__init__<s
zscheduler.__init__c
Cs@|tkri}t|||||�}|j�tj|j|�WdQRX|S)z�Enter a new event in the queue at an absolute time.

        Returns an ID for the event which can be used to remove it,
        if necessary.

        N)�	_sentinelrr�heapq�heappushr)rrr�action�argument�kwargs�eventr
r
r�enterabsDszscheduler.enterabscCs|j�|}|j|||||�S)z{A variant that specifies the time as a relative time.

        This is actually the more commonly used interface.

        )rr$)r�delayrr r!r"rr
r
r�enterRszscheduler.enterc	Cs.|j�|jj|�tj|j�WdQRXdS)z�Remove an event from the queue.

        This must be presented the ID as returned by enter().
        If the event is not in the queue, this raises ValueError.

        N)rr�remover�heapify)rr#r
r
r�cancel[szscheduler.cancelc	Cs|j�
|jSQRXdS)z!Check whether the queue is empty.N)rr)rr
r
r�emptyfszscheduler.emptyTcCs�|j}|j}|j}|j}tj}x||�>|s,P|d\}}}	}
}|�}||krRd}
nd}
||�WdQRX|
r�|sx||S|||�q |	|
|�|d�q WdS)aExecute events until the queue is empty.
        If blocking is False executes the scheduled events due to
        expire soonest (if any) and then return the deadline of the
        next scheduled call in the scheduler.

        When there is a positive delay until the first event, the
        delay function is called and the event is left in the queue;
        otherwise, the event is removed from the queue and executed
        (its action function is called, passing it the argument).  If
        the delay function returns prematurely, it is simply
        restarted.

        It is legal for both the delay function and the action
        function to modify the queue or to raise an exception;
        exceptions are not caught but the scheduler's state remains
        well-defined so run() may be called again.

        A questionable hack is added to allow other threads to run:
        just after an event is executed, a delay of 0 is executed, to
        avoid monopolizing the CPU when other threads are also
        runnable.

        rTFN)rrrrr�heappop)rZblocking�lock�qrr�poprrr r!r"Znowr%r
r
r�runks*
z
scheduler.runc
Cs:|j�|jdd�}WdQRXtttj|gt|���S)z�An ordered list of upcoming events.

        Events are named tuples with fields for:
            time, priority, action, arguments, kwargs

        N)rr�list�maprr+�len)rZeventsr
r
r�queue�szscheduler.queueN)T)rrr�_timerZsleeprrr$r&r)r*r/�propertyr3r
r
r
rr:s	
2)�__doc__rr�collectionsrr�ImportErrorZdummy_threadingrr4�__all__rrr r!r"�objectrrr
r
r
r�<module>s"	linecache.cpython-36.opt-1.pyc000064400000007304150335715140012054 0ustar003


 \��@sndZddlZddlZddlZddlZdddgZddd�Ziadd�Zddd	�Z	dd
d�Z
ddd�Zd
d�ZdS)z�Cache lines from Python source files.

This is intended to read lines from modules imported -- hence if a filename
is not found, it will look down the module search path for a file by
that name.
�N�getline�
clearcache�
checkcachecCs:t||�}d|ko t|�knr2||dSdSdS)N��)�getlines�len)�filename�lineno�module_globals�lines�r
�!/usr/lib64/python3.6/linecache.pyrs
cCsiadS)zClear the cache entirely.N)�cacher
r
r
rrscCsR|tkr(t|}t|�dkr(t|dSy
t||�Stk
rLt�gSXdS)z�Get the lines for a Python source file from the cache.
    Update the cache if it doesn't contain an entry for this file already.r�N)rr�updatecache�MemoryErrorr)r	r�entryr
r
rr%s
rcCs�|dkrttj��}n|tkr&|g}ndSx~|D]v}t|}t|�dkrJq0|\}}}}|dkr`q0ytj|�}Wntk
r�t|=w0YnX||jks�||jkr0t|=q0WdS)zUDiscard cache entries that are out of date.
    (This is not checked upon each call!)Nr)	�listr�keysr�os�stat�OSError�st_size�st_mtime)r	�	filenamesr�size�mtimer�fullnamerr
r
rr5s&
c"Cs�|tkrtt|�dkrt|=|s8|jd�r<|jd�r<gS|}ytj|�}W�ntk
�rV|}t||�r�yt|d�}Wnttfk
r�Yn<X|dkr�gSt|�ddd�|j	�D�|ft|<t|dStj
j|�r�gSxjtj
D]\}ytj
j
||�}Wnttfk
�r w�YnXytj|�}PWq�tk
�rHYq�Xq�WgSYnXy"tj|��}|j�}WdQRXWntk
�r�gSX|�r�|d
jd	��r�|dd	7<|j|j}	}
|	|
||ft|<|S)z�Update a cache entry and return its list of lines.
    If something's wrong, print a message, discard the cache entry,
    and return an empty list.r�<�>rNcSsg|]}|d�qS)�
r
)�.0�liner
r
r�
<listcomp>qszupdatecache.<locals>.<listcomp>rr!���r%)rr�
startswith�endswithrrr�	lazycache�ImportError�
splitlines�path�isabs�sys�join�	TypeError�AttributeError�tokenize�open�	readlinesrr)r	rrr�basename�data�dirname�fprrrr
r
rrRsV



rcCs�|tkr tt|�dkrdSdS|s:|jd�r>|jd�r>dS|r�d|kr�|jd�}|d}t|dd	�}|r�|r�tj||�}|ft|<dSdS)
a�Seed the cache for filename with module_globals.

    The module loader will be asked for the source only when getlines is
    called, not immediately.

    If there is an entry in the cache already, it is not altered.

    :return: True if a lazy load is registered in the cache,
        otherwise False. To register such a load a module loader with a
        get_source method must be found, the filename must be a cachable
        filename, and the filename must not be already cached.
    rTFrr �
__loader__�__name__�
get_sourceN)rrr&r'�get�getattr�	functools�partial)r	r�name�loaderr:�	get_linesr
r
rr(�s


r()N)N)N)N)
�__doc__r=r-rr1�__all__rrrrrrr(r
r
r
r�<module>s




Athis.cpython-36.pyc000064400000002363150335715140010151 0ustar003


 \��@sddZiZx>d	D]6Zx0ed�D]$Zeedde�eeee�<qWqWedjdd�eD���dS)
aXGur Mra bs Clguba, ol Gvz Crgref

Ornhgvshy vf orggre guna htyl.
Rkcyvpvg vf orggre guna vzcyvpvg.
Fvzcyr vf orggre guna pbzcyrk.
Pbzcyrk vf orggre guna pbzcyvpngrq.
Syng vf orggre guna arfgrq.
Fcnefr vf orggre guna qrafr.
Ernqnovyvgl pbhagf.
Fcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf.
Nygubhtu cenpgvpnyvgl orngf chevgl.
Reebef fubhyq arire cnff fvyragyl.
Hayrff rkcyvpvgyl fvyraprq.
Va gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff.
Gurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg.
Nygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh'er Qhgpu.
Abj vf orggre guna arire.
Nygubhtu arire vf bsgra orggre guna *evtug* abj.
Vs gur vzcyrzragngvba vf uneq gb rkcynva, vg'f n onq vqrn.
Vs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn.
Anzrfcnprf ner bar ubaxvat terng vqrn -- yrg'f qb zber bs gubfr!�A�a��
�cCsg|]}tj||��qS�)�d�get)�.0�crr�/usr/lib64/python3.6/this.py�
<listcomp>srN)rr)�srr
�range�i�chr�print�joinrrrr�<module>s

(glob.cpython-36.opt-2.pyc000064400000006404150335715140011065 0ustar003


 \�@s�ddlZddlZddlZdddgZdd�dd�Zdd�dd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
ejd�Zejd�Zdd�Zdd�Zdd �Zd!d�ZdS)"�N�glob�iglob�escapeF)�	recursivecCstt||d��S)N)r)�listr)�pathnamer�r�/usr/lib64/python3.6/glob.pyr	scCs$t||d�}|r t|�r t|�}|S)NF)�_iglob�_isrecursive�next)rr�it�srrr	rsccstjj|�\}}t|�sF|r0tjj|�rB|Vntjj|�rB|VdS|s�|rjt|�rjt|||�EdHnt|||�EdHdS||kr�t|�r�t	||d�}n|g}t|�r�|r�t|�r�t}q�t}nt
}x2|D]*}x$||||�D]}tjj||�Vq�Wq�WdS)NT)�os�path�split�	has_magic�lexists�isdirr�_glob2�_glob1r
�_glob0�join)rr�dironly�dirname�basename�dirsZglob_in_dir�namerrr	r
's0
r
cCs0tt||��}t|�s$dd�|D�}tj||�S)Ncss|]}t|�s|VqdS)N)�	_ishidden)�.0�xrrr	�	<genexpr>Rsz_glob1.<locals>.<genexpr>)r�_iterdirr�fnmatch�filter)r�patternr�namesrrr	rOsrcCs8|stjj|�r4|gSntjjtjj||��r4|gSgS)N)rrrrr)rrrrrr	rUsrcCst||d�S)NF)r)rr%rrr	�glob0bsr'cCst||d�S)NF)r)rr%rrr	�glob1esr(ccs"|dd�Vt||�EdHdS)Nr)�	_rlistdir)rr%rrrr	rksrccs�|s"t|t�rttjd�}ntj}yXtj|��D}x<|D]4}y|sJ|j�rR|jVWq6tk
rhYq6Xq6WWdQRXWntk
r�dSXdS)N�ASCII)�
isinstance�bytesr�curdir�scandir�is_dirr�OSError)rrr
�entryrrr	r"rs

r"ccshtt||��}xT|D]L}t|�s|V|r8tjj||�n|}x"t||�D]}tjj||�VqHWqWdS)N)rr"rrrrr))rrr&r r�yrrr	r)�s
r)z([*?[])s([*?[])cCs(t|t�rtj|�}n
tj|�}|dk	S)N)r+r,�magic_check_bytes�search�magic_check)r�matchrrr	r�s

rcCs|ddkS)Nr�.�.�.)r7r9r)rrrr	r�srcCst|t�r|dkS|dkSdS)Ns**z**)r+r,)r%rrr	r�s
rcCs<tjj|�\}}t|t�r(tjd|�}ntjd|�}||S)Ns[\1]z[\1])rr�
splitdriver+r,r3�subr5)rZdriverrr	r�s

)r�rer#�__all__rrr
rrr'r(rr"r)�compiler5r3rrrrrrrr	�<module>s&

(



imp.cpython-36.opt-2.pyc000064400000016177150335715140010737 0ustar003


 \�)�
@s�ddlmZmZmZmZmZmZmZmZm	Z	yddlm
Z
Wnek
rTdZ
YnXddlm
Z
mZmZmZddlmZddlmZddlmZddlZddlZddlZddlZddlZddlZejded	d
�dZdZd	ZdZ d
Z!dZ"dZ#dZ$dZ%dZ&dd�Z'dd�Z(dd�Z)d7dd�Z*dd�Z+dd�Z,Gdd �d �Z-Gd!d"�d"�Z.Gd#d$�d$e.ej/�Z0d8d%d&�Z1Gd'd(�d(e.e�Z2d9d)d*�Z3d+d,�Z4d-d.�Z5d:d/d0�Z6d1d2�Z7d3d4�Z8e
�r�d;d5d6�Z9ndZ9dS)<�)	�	lock_held�acquire_lock�release_lock�get_frozen_object�is_frozen_package�init_frozen�
is_builtin�	is_frozen�_fix_co_filename)�create_dynamicN)�_ERR_MSG�_exec�_load�_builtin_from_name)�SourcelessFileLoader)�	machinery)�utilzhthe imp module is deprecated in favour of importlib; see the module's documentation for alternative uses�)�
stacklevel��������	cCs
tj|�S)N)�types�
ModuleType)�name�r �/usr/lib64/python3.6/imp.py�
new_module0sr"cCstjS)N)r�MAGIC_NUMBERr r r r!�	get_magic;sr$cCstjjS)N)�sys�implementation�	cache_tagr r r r!�get_tagCsr(c
Cs*tj��tjd�tj||�SQRXdS)N�ignore)�warnings�catch_warnings�simplefilterr�cache_from_source)�path�debug_overrider r r!r-Hs

r-cCs
tj|�S)N)r�source_from_cache)r.r r r!r0[sr0cCs<dd�tjD�}dd�tjD�}dd�tjD�}|||S)NcSsg|]}|dtf�qS)�rb)�C_EXTENSION)�.0�sr r r!�
<listcomp>ksz get_suffixes.<locals>.<listcomp>cSsg|]}|dtf�qS)�r)�	PY_SOURCE)r3r4r r r!r5lscSsg|]}|dtf�qS)r1)�PY_COMPILED)r3r4r r r!r5ms)r�EXTENSION_SUFFIXES�SOURCE_SUFFIXES�BYTECODE_SUFFIXES)�
extensions�source�bytecoder r r!�get_suffixesisr?c@seZdZdd�Zdd�ZdS)�NullImportercCs2|dkrtddd��ntjj|�r.td|d��dS)N�zempty pathname)r.zexisting directory)�ImportError�osr.�isdir)�selfr.r r r!�__init__zszNullImporter.__init__cCsdS)Nr )rE�fullnamer r r!�find_module�szNullImporter.find_moduleN)�__name__�
__module__�__qualname__rFrHr r r r!r@rsr@cs*eZdZd�fdd�	Z�fdd�Z�ZS)�_HackedGetDataNcst�j||�||_dS)N)�superrF�file)rErGr.rN)�	__class__r r!rF�sz_HackedGetData.__init__c	sX|jrH||jkrH|jjs |j}nt|jd�|_}|�
|j�SQRXnt�j|�SdS)Nr6)rNr.�closed�open�readrM�get_data)rEr.rN)rOr r!rS�sz_HackedGetData.get_data)N)rIrJrKrFrS�
__classcell__r r )rOr!rL�srLc@seZdZdS)�_LoadSourceCompatibilityN)rIrJrKr r r r!rU�srUcCs\t|||�}tj|||d�}|tjkr8t|tj|�}nt|�}tj||�|_	|j	|j
_|S)N)�loader)rUr�spec_from_file_locationr%�modulesr
rr�SourceFileLoader�
__loader__�__spec__rV)r�pathnamerNrV�spec�moduler r r!�load_source�s

r_c@seZdZdS)�_LoadCompiledCompatibilityN)rIrJrKr r r r!r`�sr`cCsZt|||�}tj|||d�}|tjkr8t|tj|�}nt|�}t||�|_|j|j	_
|S)N)rV)r`rrWr%rXr
rrrZr[rV)rr\rNrVr]r^r r r!�
load_compiled�s

racCs�tjj|�rhtjdd�tjdd�}x>|D](}tjj|d|�}tjj|�r.|}Pq.Wtdj	|���t
j||gd�}|tj
kr�t|tj
|�St|�SdS)NrFz{!r} is not a package)�submodule_search_locations)rCr.rDrr:r;�join�exists�
ValueError�formatrrWr%rXr
r)rr.r<�	extensionZ	init_pathr]r r r!�load_package�s

rhc	Cs|\}}}|r2|jd	�s"d|kr2tdj|���n�|dkrZ|tthkrZdj|�}t|��n�|tkrnt|||�S|tkr�t|||�S|tkr�tdk	r�|dkr�t	|d��}t|||�SQRXnt|||�SnL|t
kr�t||�S|tkr�t
|�S|tk�r�t|�Sdj||�}t||d��dS)
Nr6�U�+zinvalid file open mode {!r}z.file object required for import (type code {})r1z*Don't know how to import {} (type code {}))r)r6ri)�
startswithrerfr7r8r_rar2�load_dynamicrQ�
PKG_DIRECTORYrh�	C_BUILTIN�init_builtin�	PY_FROZENrrB)	rrN�filenameZdetails�suffix�mode�type_�msgZopened_filer r r!�load_module�s.




rvcCs�t|t�stdjt|����n$t|td�tf�sBtdjt|����|dkr�t|�rbddddtffSt	|�rzddddt
ffStj}x�|D]�}t
jj||�}xHdtjdgD]6}d|}t
jj||�}t
jj|�r�d|ddtffSq�Wx:t�D].\}}}||}	t
jj||	�}t
jj|�r�Pq�Wq�Pq�Wttj|�|d��d}
d|k�rjt|d	��}tj|j�d}
WdQRXt|||
d
�}|||||ffS)Nz'name' must be a str, not {}z%'path' must be None or a list, not {}rAz.pyrrF)r�br1)�encoding)�
isinstance�str�	TypeErrorrf�type�list�RuntimeErrorrrnr	rpr%r.rCrcrr;�isfilermr?rBrrQ�tokenize�detect_encoding�readline)rr.�entryZpackage_directoryrrZpackage_file_nameZ	file_pathrsrt�	file_namerxrNr r r!rH�s@


rHcCs
tj|�S)N)�	importlib�reload)r^r r r!r�3sr�cCs"yt|�Stk
rdSXdS)N)rrB)rr r r!ro>srocCs0ddl}|jj||�}|jj|||d�}t|�S)Nr)rrV�origin)�importlib.machineryr�ExtensionFileLoader�
ModuleSpecr)rr.rNr�rVr]r r r!rlKs
rl)N)N)N)N)N):�_imprrrrrrrr	r
rrBZimportlib._bootstraprr
rrZimportlib._bootstrap_externalrr�rrrCr%r�rr*�warn�DeprecationWarningZSEARCH_ERRORr7r8r2ZPY_RESOURCErmrnrpZPY_CODERESOURCEZIMP_HOOKr"r$r(r-r0r?r@rLrYrUr_r`rarhrvrHr�rorlr r r r!�<module>	s\,


	

#
4zipfile.cpython-36.opt-2.pyc000064400000126401150335715140011604 0ustar003

�\dh48�2@s�ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
yddlZWnek
rxddl
ZYnXyddlZejZWnek
r�dZe
jZYnXyddlZWnek
r�dZYnXyddlZWnek
r�dZYnXdddddddd	d
ddd
gZGdd�de�ZGdd
�d
e�ZeZZdeZdgZdiZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%e	j&e$�Z'dZ(dZ)dZ*dZ+dZ,dZ-d Z.d!Z/dZ0d"Z1d#Z2d$Z3e	j&e2�Z4dZ5dZ6dZ7dZ8dZ9dZ:d Z;d!Z<dZ=d"Z>d%Z?d&Z@dZAd'ZBdZCd(ZDdZEd)ZFd*ZGd+ZHd,ZIe	j&eH�ZJdZKdZLdZMdZNdZOdZPd ZQd!ZRdZSd"ZTd%ZUd&ZVd-ZWd.ZXe	j&eW�ZYd/ZZd0Z[e	j&eZ�Z\dZ]dZ^dZ_dZ`dZadZbd Zcd!ZddZed"Zfd1Zge	jhd2�Zid3d4�Zjd5d6�Zkd7d	�Zld8d9�Zmd:d;�ZnGd<d
�d
eo�ZpGd=d>�d>�ZqGd?d@�d@�ZrGdAdB�dB�ZsdCdDdEdEdEdEdFdGdHdIdFdJdKdLdMdNdOdP�ZtdQdR�ZudSdT�ZvdUdV�ZwGdWdX�dX�ZxGdYdZ�dZ�ZyGd[d\�d\ejz�Z{Gd]d^�d^ejz�Z|Gd_d�d�Z}Gd`d�de}�Z~djdadb�Ze�dck�r�e�dS)k�N�
BadZipFile�
BadZipfile�error�
ZIP_STORED�ZIP_DEFLATED�	ZIP_BZIP2�ZIP_LZMA�
is_zipfile�ZipInfo�ZipFile�	PyZipFile�LargeZipFilec@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/zipfile.pyr+sc@seZdZdS)r
N)rrrrrrrr
/s��������-�.�?s<4s4H2LHsPK�������	z<4s4B4HL2L5H2LsPK�
��
���z<4s2B4HL2L2HsPKz<4sLQLsPKz
<4sQ2H2L4QsPKiPKz<HHc
Cs�tj}d}g}d}}xf|dt|�kr|||||d��\}}|d|}	||krv||krn|j|||��|	}d}|	}qW|s�|Sdj|�S)NFrrT�)�_EXTRA_FIELD_STRUCT�unpack�len�append�join)
�extraZxidsr,Zmodified�buffer�start�iZxidZxlen�jrrr�_strip_extra�s r5cCs*yt|�rdSWntk
r$YnXdS)NTF)�_EndRecData�OSError)�fprrr�_check_zipfile�sr9cCsVd}y8t|d�rt|d�}nt|d��}t|�}WdQRXWntk
rPYnX|S)NF�read)r8�rb)�hasattrr9�openr7)�filename�resultr8rrrr	�s
cCsy|j|td�Wntk
r(|SX|jt�}t|�tkrD|Stjt|�\}}}}|tkrd|S|dkst|dkr|t	d��|j|tt
d�|jt
�}t|�t
kr�|Stjt|�\
}}}	}
}}}
}}}|tkr�|S||t
<||t<||t<|
|t<||t<||t<||t<|S)Nrrrz3zipfiles that span multiple disks are not supported)�seek�sizeEndCentDir64Locatorr7r:r-�structr,�structEndArchive64Locator�stringEndArchive64Locatorr�sizeEndCentDir64�structEndArchive64�stringEndArchive64�_ECD_SIGNATURE�_ECD_DISK_NUMBER�_ECD_DISK_START�_ECD_ENTRIES_THIS_DISK�_ECD_ENTRIES_TOTAL�	_ECD_SIZE�_ECD_OFFSET)�fpin�offset�endrec�dataZsigZdisknoZreloffZdisksZsz�create_versionZread_versionZdisk_numZdisk_dirZdircountZ	dircount2ZdirsizeZ	diroffsetrrr�
_EndRecData64�s6

 rTc	Csf|jdd�|j�}y|jtd�Wntk
r:dSX|j�}t|�tkr�|dd�tkr�|dd�dkr�tjt	|�}t
|�}|jd�|j|t�t|t|�St
|d	td�}|j|d�|j�}|jt�}|dk�rb|||t�}t|�tk�rdSt
tjt	|��}|t}||t|t|�}|j|�|j||�t|||||�SdS)
Nrrrsr*rr���i)r@�tell�sizeEndCentDirr7r:r-�stringEndArchiverBr,�structEndArchive�listr.rT�max�rfind�_ECD_COMMENT_SIZE)	rOZfilesizerRrQZmaxCommentStartr2ZrecDataZcommentSize�commentrrrr6s>



r6c@sReZdZd(Zd*dd�Zdd�Zd+dd�Zd d!�Zd"d#�Ze	d,d$d%��Z
d&d'�ZdS)-r
�
orig_filenamer>�	date_time�
compress_typer^r0�
create_systemrS�extract_version�reserved�	flag_bits�volume�
internal_attr�
external_attr�
header_offset�CRC�
compress_size�	file_size�	_raw_time�_end_offset�NoName�rrcCs�||_|jtd��}|dkr(|d|�}tjdkrJtj|krJ|jtjd�}||_||_|ddkrjtd��t	|_
d|_d|_t
jdkr�d|_nd|_t|_t|_d|_d|_d|_d|_d|_d|_dS)Nr�/i�z+ZIP does not support timestamps before 1980r*Zwin32r)r_�find�chr�os�sep�replacer>r`�
ValueErrorrrar^r0�sys�platformrb�DEFAULT_VERSIONrSrcrdrerfrgrhrn)�selfr>r`Z	null_byterrr�__init__Xs0
zZipInfo.__init__cCs�d|jj|jfg}|jtkr8|jdtj|j|j��|jd?}|jd@}|rd|jdt	j
|��|rv|jd|�|j�}|s�|jr�|jd|j�|s�|j
r�|jtks�|j|j
kr�|jd|j
�|jd	�d
j|�S)Nz<%s filename=%rz compress_type=%sri��z filemode=%rz external_attr=%#xz
 file_size=%rz compress_size=%r�>�)�	__class__rr>rarr.�compressor_names�getrh�stat�filemode�is_dirrlrkr/)r{r?�hi�lo�isdirrrr�__repr__�s(




zZipInfo.__repr__NcCs||j}|ddd>|dd>B|dB}|dd>|d	d>B|ddB}|jd
@rfd}}}n|j}|j}|j}|j}d}	|dkr�|tkp�|tk}|r�d}
|tj|
dtj	|
�d	||�}|tks�|tkr�|s�t
d��d
}d
}t}	|jt
k�rtt|	�}	n|jtk�rtt|	�}	t|	|j�|_t|	|j�|_|j�\}}tjtt|j|j||j|||||t|�t|��
}
|
||S)Nri�r#rr rrr%rrz<HHQQz'Filesize would require ZIP64 extensionsl��)r`rerjrkrlr0�ZIP64_LIMITrB�pack�calcsizer
�
ZIP64_VERSIONrarr[�
BZIP2_VERSIONr�LZMA_VERSIONrcrS�_encodeFilenameFlags�structFileHeader�stringFileHeaderrdr-)r{�zip64�dt�dosdate�dostimerjrkrlr0�min_version�fmtr>re�headerrrr�
FileHeader�sF$$



zZipInfo.FileHeadercCs>y|jjd�|jfStk
r8|jjd�|jdBfSXdS)N�asciizutf-8i)r>�encodere�UnicodeEncodeError)r{rrrr��szZipInfo._encodeFilenameFlagscCs(|j}tj}�xt|�dk�r"|d|dd��\}}|dk�r|dkrZ|d|dd��}nV|dkrv|d|dd	��}n:|d
kr�|d|dd��}n|d
kr�f}ntd||f��d
}|jdkr�|||_|d7}|jdkr�|||_|d7}|jdk�r|j}|||_|d7}||dd�}qWdS)Nrz<HHr�z<QQQ�rz<QQrrz<Qrrz"Corrupt extra field %04x (size=%d)��������)r�r�)r0rBr,r-rrlrkri)r{r0r,�tp�lnZcounts�idx�oldrrr�_decodeExtra�s4





zZipInfo._decodeExtracCs�t|tj�rtj|�}tj|�}tj|j�}tj|j	�}|dd�}|dkrP|}tj
jtj
j|�d�}x$|dtj
tjfkr�|dd�}qjW|r�|d7}|||�}|jd@d>|_|r�d|_|jdO_n|j|_|S)Nrr!rrqi��r)�
isinstancert�PathLike�fspathr��S_ISDIR�st_mode�time�	localtime�st_mtime�path�normpath�
splitdriveru�altseprhrl�st_size)�clsr>�arcname�str��mtimer`�zinforrr�	from_file�s(



zZipInfo.from_filecCs|jddkS)Nrrq���)r>)r{rrrr�szZipInfo.is_dir)r_r>r`rar^r0rbrSrcrdrerfrgrhrirjrkrlrmrn�rprrrrr)ror�)N)N)rrr�	__slots__r|r�r�r�r��classmethodr�r�rrrrr
>s8
+
.$!c@s8eZdZdd�ZdZdd�Zdd�Zdd	�Zd
d�ZdS)�
_ZipDecryptercCshd}dgd}xTtd�D]H}|}x6td�D]*}|d@rH|d?d@|A}q*|d?d@}q*W|||<qW|S)Nl q[r�rri���)�range)Zpoly�tabler3�crcr4rrr�_GenerateCRCTable%s
z_ZipDecrypter._GenerateCRCTableNcCs|d?d@|j||Ad@AS)Nri����)�crctable)r{Zchr�rrr�_crc329sz_ZipDecrypter._crc32cCsBtjdkrtj�t_d|_d|_d|_x|D]}|j|�q,WdS)NixV4i�gE#i�xV4)r�r�r��key0�key1�key2�_UpdateKeys)r{�pwd�prrrr|=s


z_ZipDecrypter.__init__cCsX|j||j�|_|j|jd@d@|_|jddd@|_|j|jd?d@|j�|_dS)Nr�l��i�rr�)r�r�r�r�)r{�crrrr�Fsz_ZipDecrypter._UpdateKeyscCs0|jdB}|||dAd?d@A}|j|�|S)Nrrrr�)r�r�)r{r��krrr�__call__Ls

z_ZipDecrypter.__call__)	rrrr�r�r�r|r�r�rrrrr�s
	r�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�LZMACompressorcCs
d|_dS)N)�_comp)r{rrrr|WszLZMACompressor.__init__cCsFtjdtji�}tjtjtjtj|�gd�|_tjdddt	|��|S)N�id)�filtersz<BBHr#r)
�lzmaZ_encode_filter_properties�FILTER_LZMA1r��
FORMAT_RAW�_decode_filter_propertiesr�rBr�r-)r{Zpropsrrr�_initZszLZMACompressor._initcCs*|jdkr|j�|jj|�S|jj|�S)N)r�r��compress)r{rRrrrr�as
zLZMACompressor.compresscCs&|jdkr|j�|jj�S|jj�S)N)r�r��flush)r{rrrr�fs
zLZMACompressor.flushN)rrrr|r�r�r�rrrrr�Usr�c@seZdZdd�Zdd�ZdS)�LZMADecompressorcCsd|_d|_d|_dS)Nr*F)�_decomp�_unconsumed�eof)r{rrrr|nszLZMADecompressor.__init__cCs�|jdkr�|j|7_t|j�dkr*dStjd|jdd��\}t|j�d|krXdStjtjtjtj	|jdd|��gd�|_|jd|d�}|`|jj
|�}|jj|_|S)Nrr*z<Hr)r�)r�r�r-rBr,r�r�r�r�r��
decompressr�)r{rRZpsizer?rrrr�ss

zLZMADecompressor.decompressN)rrrr|r�rrrrr�lsr�ZstoreZshrink�reduceZimplode�tokenizeZdeflateZ	deflate64Zbzip2r�ZterseZlz77ZwavpackZppmd)rrrrrr r!r"rr#r$rrr)��a�bcCsX|tkr
nJ|tkr tsTtd��n4|tkr6tsTtd��n|tkrLtsTtd��ntd��dS)Nz.Compression requires the (missing) zlib modulez-Compression requires the (missing) bz2 modulez.Compression requires the (missing) lzma modulez(That compression method is not supported)	rr�zlib�RuntimeErrorr�bz2rr��NotImplementedError)�compressionrrr�_check_compression�sr�cCs@|tkrtjtjtjd�S|tkr*tj�S|tkr8t	�SdSdS)Nr'i�)
rr�ZcompressobjZZ_DEFAULT_COMPRESSIONZDEFLATEDrr�Z
BZ2Compressorrr�)rarrr�_get_compressor�s
r�cCsn|tkrdS|tkrtjd�S|tkr.tj�S|tkr<t�St	j
|�}|r\td||f��ntd|f��dS)Nr'zcompression type %d (%s)zcompression type %di�)rrr�Z
decompressobjrr�ZBZ2Decompressorrr�r�r�r�)raZdescrrrr�_get_decompressor�s

r�c@s0eZdZdd�Zddd�Zddd�Zd	d
�ZdS)�_SharedFilecCs2||_||_||_||_||_|j|_|j|_dS)N)�_file�_pos�_close�_lock�_writing�seekablerV)r{�file�pos�close�lock�writingrrrr|�sz_SharedFile.__init__rc	CsB|j�2|j�rtd��|jj|j�|jj�|_|jSQRXdS)Nz}Can't reposition in the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.)r�r�rwr�r@r�rV)r{rP�whencerrrr@�sz_SharedFile.seekrc	CsL|j�<|j�rtd��|jj|j�|jj|�}|jj�|_|SQRXdS)NzyCan't read from the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.)r�r�rwr�r@r�r:rV)r{�nrRrrrr:�sz_SharedFile.readcCs$|jdk	r |j}d|_|j|�dS)N)r�r�)r{�fileobjrrrr��s
z_SharedFile.closeN)rr�)r�)rrrr|r@r:r�rrrrr��s	


r�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�	_TellablecCs||_d|_dS)Nr)r8rP)r{r8rrrr|�sz_Tellable.__init__cCs|jj|�}|j|7_|S)N)r8�writerP)r{rRr�rrrr��sz_Tellable.writecCs|jS)N)rP)r{rrrrV�sz_Tellable.tellcCs|jj�dS)N)r8r�)r{rrrr��sz_Tellable.flushcCs|jj�dS)N)r8r�)r{rrrr�sz_Tellable.closeN)rrrr|r�rVr�r�rrrrr��s
r�cs�eZdZd%ZdZd&Zd'dd�Zd	d
�Zd)dd�Zd*d
d�Z	dd�Z
d,dd�Zdd�Zdd�Z
dd�Zdd�Z�fdd�Zdd�Zd-d d!�Zd"d#�Z�ZS).�
ZipExtFilerrir�NFcCs�||_||_||_|j|_|j|_|j|_t	|j�|_
d|_d|_d|_
d|_|jdk	rf|jd8_||_|j|_t|d�r�|j|_td�|_nd|_d|_y4|j�r�|j�|_|j|_|j|_|j|_d|_Wntk
r�YnXdS)NFr*rrrjT)�_fileobj�
_decrypter�_close_fileobjra�_compress_typerk�_compress_leftrl�_leftr��
_decompressor�_eof�_readbuffer�_offset�newlines�moder>�namer<rj�
_expected_crc�crc32�_running_crc�	_seekabler�rV�_orig_compress_start�_orig_compress_size�_orig_file_size�_orig_start_crc�AttributeError)r{r�r	�zipinfoZ	decrypterZ
close_fileobjrrrr|s:



zZipExtFile.__init__cCsvd|jj|jjfg}|jsX|jd|j|jf�|jtkrb|jdt	j
|j|j��n
|jd�|jd�dj|�S)Nz<%s.%sz name=%r mode=%rz compress_type=%sz	 [closed]r}r~)rrr�closedr.r
r	rrr�r�r/)r{r?rrrr�?s


zZipExtFile.__repr__cCsL|dkr>|jjd|j�d}|dkr>|j|j|�}||_|Stjj||�S)Nr�
r)rrrr�io�BufferedIOBase�readline)r{�limitr3�linerrrrMszZipExtFile.readlinecCsr|t|j�|jkr\|j|�}t|�|jkrJ||j|jd�|_d|_n|jt|�8_|j|j|jd�S)Nri)r-rrr:)r{r��chunkrrr�peek]s
zZipExtFile.peekcCsdS)NTr)r{rrr�readablejszZipExtFile.readablecCs|dks|dkrL|j|jd�}d|_d|_x|jsF||j|j�7}q.W|S||j}|t|j�kr~|j|j|�}||_|S|t|j�}|j|jd�}d|_d|_x^|dko�|j�r|j|�}|t|�kr�||_||_||d|�7}P||7}|t|�8}q�W|S)Nrr*)rrr�_read1�MAX_Nr-)r{r��buf�endrRrrrr:ms4

zZipExtFile.readcCs@|jdkrdSt||j�|_|jr<|j|jkr<td|j��dS)NzBad CRC-32 for file %r)rrr
rrr
)r{�newdatarrr�_update_crc�s

zZipExtFile._update_crccCs|dks|dkrV|j|jd�}d|_d|_x$|jsP|j|j�}|r.||7}Pq.W|S||j}|t|j�kr�|j|j|�}||_|S|t|j�}|j|jd�}d|_d|_|dk�rxN|j�s
|j|�}|t|�kr�||_||_||d|�7}P|r�||7}Pq�W|S)Nrr*)rrrrr r-)r{r�r!rRr"rrr�read1�s>



zZipExtFile.read1cCs"|js|dkrdS|jtkrH|jj}|t|�krR||j|t|��7}n
|j|�}|jtkrj|jdk|_nx|jtkr�t	||j
�}|jj||�}|jjp�|jdko�|jj|_|jr�||jj
�7}n |jj|�}|jjp�|jdk|_|d|j�}|jt|�8_|jdk�rd|_|j|�|S)Nrr*T)rrrrZunconsumed_tailr-�_read2rrr[�
MIN_READ_SIZEr�r�r�rr$)r{r�rRrrrr�s2





zZipExtFile._read1cCsj|jdkrdSt||j�}t||j�}|jj|�}|jt|�8_|sLt�|jdk	rft	t
|j|��}|S)Nrr*)rr[r'�minr�r:r-�EOFErrorr��bytes�map)r{r�rRrrrr&�s

zZipExtFile._read2c
s&z|jr|jj�Wdt�j�XdS)N)rr�r��super)r{)rrrr��szZipExtFile.closecCs|jS)N)r)r{rrrr��szZipExtFile.seekablercCs,|jstjd��|j�}|dkr&|}n.|dkr8||}n|dkrL|j|}ntd��||jkrd|j}|dkrpd}||}||j}|dkr�|t|j�kr�||_d}nR|dkr�|j	j
|j�|j|_
|j|_|j|_d|_d|_tj|j�|_d|_|}x,|dk�r"t|j|�}|j|�||8}q�W|j�S)Nz!underlying stream is not seekablerrrzCwhence must be os.SEEK_SET (0), os.SEEK_CUR (1), or os.SEEK_END (2)r*F)rr�UnsupportedOperationrVrrwrr-rr�r@rrr
rrrZzipfiler�rrrr(�
MAX_SEEK_READr:)r{rPr�Zcurr_posZnew_posZread_offsetZbuff_offsetZread_lenrrrr@�sD




zZipExtFile.seekcCs0|jstjd��|j|jt|j�|j}|S)Nz!underlying stream is not seekable)rrr-rrr-rr)r{ZfileposrrrrV*s
zZipExtFile.tell�i@i)NFr�)r�)rr�)r�)r)rrrr r'r.r|r�rrrr:r$r%rr&r�r�r@rV�
__classcell__rr)rrr�s$
*



!
%$
/r�cs@eZdZdd�Zedd��Zdd�Zdd�Z�fd	d
�Z�Z	S)�
_ZipWriteFilecCs4||_||_||_t|j�|_d|_d|_d|_dS)Nr)	�_zinfo�_zip64�_zipfiler�ra�_compressor�
_file_size�_compress_size�_crc)r{�zfr�r�rrrr|2sz_ZipWriteFile.__init__cCs|jjS)N)r4r8)r{rrrr�;sz_ZipWriteFile._fileobjcCsdS)NTr)r{rrr�writable?sz_ZipWriteFile.writablecCsf|jrtd��t|�}|j|7_t||j�|_|jrV|jj|�}|jt|�7_|j	j
|�|S)NzI/O operation on closed file.)rrwr-r6rr8r5r�r7r�r�)r{rR�nbytesrrrr�Bsz_ZipWriteFile.writecsX|jr
dSt�j�|jrN|jj�}|jt|�7_|jj|�|j|j	_
n
|j|j	_
|j|j	_
|j|j	_|j	jd@r�|jr�dnd}|jjtj|t|j	j
|j	j
|j	j��|jj�|j_nn|js�|jtkr�td��|jtkr�td��|jj�|j_|jj|j	j�|jj|j	j|j��|jj|jj�d|j_|jjj|j	�|j	|jj|j	j <dS)Nrz<LLQQz<LLLLz+File size unexpectedly exceeded ZIP64 limitz1Compressed size unexpectedly exceeded ZIP64 limitF)!rr,r�r5r�r7r-r�r�r2rkr6r8rjrlrer3rBr��
_DD_SIGNATURErVr4�	start_dirr�r�r@rir�r��filelistr.�
NameToInfor>)r{r!r�)rrrr�Ns8






z_ZipWriteFile.close)
rrrr|�propertyr�r:r�r�r0rr)rrr11s
	r1c@seZdZdZdZdedfdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zd;dd�Z
dd�Zdd�Zdd�Zedd��Zejdd��Zd<dd�Zd=dd �d!d"�Zd>d#d$�Zd?d%d&�Zd@d'd(�Zed)d*��Zd+d,�Zd-d.�ZdAd/d0�ZdBd1d2�Zd3d4�Zd5d6�Z d7d8�Z!d9d:�Z"dS)CrN�rTcCsF|dkrtd��t|�||_d|_d|_i|_g|_||_||_d|_	d|_
t|tj
�rdtj|�}t|t�r�d|_||_d	d
ddd
d
dd�}||}x^ytj||�|_Wn(tk
r�||kr�||}w��YnXPq�Wnd|_||_t|dd�|_d|_tj�|_d|_d|_�y|dk�r*|j�n�|dk�r�d|_y|jj�|_Wn2t tfk
�r|t!|j�|_d|_d|_Yn6Xy|jj"|j�Wn t tfk
�r�d|_YnXnf|dk�ry|j�|jj"|j�Wn6t#k
�r|jj"dd�d|_|jj�|_YnXntd��Wn$|j}d|_|j$|��YnXdS)NrA�w�x�az+ZipFile requires mode 'r', 'w', 'x', or 'a'Frr*r;zw+bzx+bzr+b�wbZxb)rArBrCrDzr+bzw+bzx+brr
Trz"Mode must be 'r', 'w', 'x', or 'a')rArBrCrD)rBrC)%rwr��_allowZip64�
_didModify�debugr?r>r�r	r��_commentr�rtr�r��str�_filePassedr>rr=r8r7�getattr�_fileRefCnt�	threading�RLockr�rr��_RealGetContentsrVr=rr�r@r�_fpclose)r{r�r	r��
allowZip64ZmodeDictr�r8rrrr|�s�







zZipFile.__init__cCs|S)Nr)r{rrr�	__enter__�szZipFile.__enter__cCs|j�dS)N)r�)r{�type�value�	tracebackrrr�__exit__�szZipFile.__exit__cCs�d|jj|jjfg}|jdk	rd|jr8|jd|j�n|jdk	rR|jd|j�|jd|j�n
|jd�|jd�dj|�S)Nz<%s.%sz file=%rz filename=%rz mode=%rz	 [closed]r}r~)	rrrr8rKr.r>r	r/)r{r?rrrr��s



zZipFile.__repr__cCs�|j}yt|�}Wntk
r.td��YnX|s<td��|jdkrNt|�|t}|t}|t|_	|t
||}|ttkr�|t
t8}|jdkr�||}td|||�|||_|j|jd�|j|�}tj|�}d}�x�||k�r�|jt�}	t|	�tk�rtd��tjt|	�}	|	ttk�r0td��|jdk�rDt|	�|j|	t�}
|	d}|d	@�rp|
jd
�}
n
|
jd�}
t|
�}|j|	t�|_|j|	t �|_!|	t"|_#|	dd�\|_$|_%|_&|_'|_(|_)}
}|_*|_+|_,|j&t-k�r�t.d
|j&d��|	dd�\|_/|_0|_1|
|_2|d?d|d?d@|d@|
d?|
d?d@|
d@df|_3|j4�|j#||_#|j5j6|�||j7|j8<|t|	t|	t|	t }|jdkr�td|�q�W|j}x*t9|j5dd�dd�D]}||_:|j#}�q�WdS)NzFile is not a zip filerrzgiven, inferred, offsetrzTruncated central directoryz&Bad magic number for central directoryr izutf-8�cp437rzzip file version %.1fr$r'r)r#i�rr%r�totalcSs|jS)N)ri)r�rrr�<lambda>Isz*ZipFile._RealGetContents.<locals>.<lambda>T)�key�reverse);r8r6r7rrH�printrMrN�_ECD_COMMENTrI�
_ECD_LOCATIONrHrGrErAr=r@r:r�BytesIO�sizeCentralDirr-rBr,�structCentralDir�
_CD_SIGNATURE�stringCentralDir�_CD_FILENAME_LENGTH�decoder
�_CD_EXTRA_FIELD_LENGTHr0�_CD_COMMENT_LENGTHr^�_CD_LOCAL_HEADER_OFFSETrirSrbrcrdrerarjrkrl�MAX_EXTRACT_VERSIONr�rfrgrhrmr`r�r>r.r?r>�sortedrn)r{r8rQZsize_cdZ	offset_cd�concatZinferredrRrY�centdirr>�flagsrC�t�dZ
end_offsetr�rrrrP�s|









4  
zZipFile._RealGetContentscCsdd�|jD�S)NcSsg|]
}|j�qSr)r>)�.0rRrrr�
<listcomp>Psz$ZipFile.namelist.<locals>.<listcomp>)r>)r{rrr�namelistNszZipFile.namelistcCs|jS)N)r>)r{rrr�infolistRszZipFile.infolistcCsPtdd	|d�x:|jD]0}d|jdd�}td|j||jf|d�qWdS)
Nz%-46s %19s %12s�	File Name�Modified    �Size)r�z%d-%02d-%02d %02d:%02d:%02dr!z
%-46s %s %12d)rurvrw)r]r>r`r>rl)r{r�r�Zdaterrr�printdirWszZipFile.printdircCs^d}xT|jD]J}y.|j|jd��}x|j|�r0q$WWdQRXWqtk
rT|jSXqWdS)NrrrAi)r>r=r>r:r)r{Z
chunk_sizer��frrr�testzip`szZipFile.testzipcCs$|jj|�}|dkr td|��|S)Nz(There is no item named %r in the archive)r?r��KeyError)r{r
�inforrr�getinfoms

zZipFile.getinfocCs8|r"t|t�r"tdt|�j��|r.||_nd|_dS)Nzpwd: expected bytes, got %s)r�r*�	TypeErrorrTrr�)r{r�rrr�setpasswordvs
zZipFile.setpasswordcCs|jS)N)rI)r{rrrr^szZipFile.commentcCs^t|t�stdt|�j��t|�tkrNddl}|jdtdd�|dt�}||_	d|_
dS)Nzcomment: expected bytes, got %srz3Archive comment is too long; truncating to %d bytesr)�
stacklevelT)r�r*r~rTrr-�ZIP_MAX_COMMENT�warnings�warnrIrG)r{r^r�rrrr^�s
c	Cs"|j|d|��
}|j�SQRXdS)NrA)r=r:)r{r
r�r8rrrr:�szZipFile.readF)�force_zip64cs�|d!krtd��|r2t|t�r2tdt|�j��|rF|dkrFtd���jsTtd��t|t�rd|}n$|dkr~t|�}�j|_	n
�j
|�}|dkr��j||d�S�jr�td���j
d	7_
t�j|j�j�j�fd
d��}�y�|jt�}t|�tk�r�td��tjt|�}|ttk�r td
��|j|t�}|t�rF|j|t�|jd@�rZtd��|jd@�rntd��|jd@�r�|jd�}	n
|jd�}	|	|j k�r�td|j |f��|j!dk	�r�|j"�|j#|j!k�r�td|j �d���|jd	@}
d}|
�r�|�s�j$}|�st%d|��t&|�}|jd�}t't(||dd���}
|jd@�rX|j)d?d@}n|j*d?d@}|
d|k�r�t%d|��t+||||d �S|j,��YnXdS)"NrArBzopen() requires mode "r" or "w"zpwd: expected bytes, got %sz'pwd is only supported for reading filesz2Attempt to use ZIP archive that was already closed)r�zyCan't read from the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.rcs�jS)N)r�r)r{rrrZ�szZipFile.open.<locals>.<lambda>zTruncated file headerz Bad magic number for file header� z$compressed patched data (flag bit 5)�@zstrong encryption (flag bit 6)izutf-8rXz/File name in directory %r and header %r differ.zOverlapped entries: z (possible zip bomb)z6File %r is encrypted, password required for extractionrrrr�r�r%zBad password for file %rT>rBrA)-rwr�r*r~rTrr8r
r�rar}�_open_to_writer�rMr�rirQr�r:�sizeFileHeaderr-rrBr,r��
_FH_SIGNATUREr��_FH_FILENAME_LENGTH�_FH_EXTRA_FIELD_LENGTHrer�rfr_rnrVrkr�r�r�rZr+rmrjr�r�)r{r
r	r�r�r�Zzef_fileZfheader�fnameZ	fname_strZis_encryptedZzdr��hZ
check_byter)r{rr=�s�








zZipFile.opencCs�|r|jrtd��|jr"td��t|d�s2d|_d|_d|_d|_|jt	kr\|jdO_|j
sp|jdO_|js|d|_|jo�|p�|jd	tk}|j
r�|j
j|j�|j
j�|_|j|�d
|_|j
j|j|��d
|_t|||�S)NzHforce_zip64 is True, but allowZip64 was False when opening the ZIP file.zzCan't write to the ZIP file while there is another write handle open on it. Close the first handle before opening another.rlrrri�rg�������?Ti�)rFrwr�r<rlrkrjrerarrrhr�r8r@r=rVri�_writecheckrGr�r�r1)r{r�r�r�rrrr�s4


zZipFile._open_to_writecCs*|dkrtj�}n
tj|�}|j|||�S)N)rt�getcwdr��_extract_member)r{�memberr�r�rrr�extract6s

zZipFile.extractcCsL|dkr|j�}|dkr"tj�}n
tj|�}x|D]}|j|||�q2WdS)N)rsrtr�r�r�)r{r��membersr�rrrr�
extractallCs


zZipFile.extractallcCs^|j}|s(d}tj|dt|��}||_|j|�}dd�|j|�D�}|jdd�|D��}|S)Nz:<>|"?*�_css|]}|jd�VqdS)�.N)�rstrip)rqrCrrr�	<genexpr>^sz1ZipFile._sanitize_windows_name.<locals>.<genexpr>css|]}|r|VqdS)Nr)rqrCrrrr�`s)�!_windows_illegal_name_trans_tablerJ�	maketransr-�	translate�splitr/)r�r��pathsepr�Zillegalrrr�_sanitize_windows_nameTs
zZipFile._sanitize_windows_namecsNt|t�s|j|�}|jjdtjj�}tjjrB|jtjjtjj�}tjj	|�d}dtjj
tjjf�tjjj�fdd�|j
tjj�D��}tjjdkr�|j|tjj�}tjj||�}tjj|�}tjj|�}|r�tjj|�r�tj|�|j��rtjj|��s
tj|�|S|j||d��(}t|d��}tj||�WdQRXWdQRX|S)	Nrqrr~c3s|]}|�kr|VqdS)Nr)rqrC)�invalid_path_partsrrr�tsz*ZipFile._extract_member.<locals>.<genexpr>�\)r�rE)r�r
r}r>rvrtr�rur�r��curdir�pardirr/r�r�r��dirname�exists�makedirsr�r��mkdirr=�shutil�copyfileobj)r{r�Z
targetpathr�r�Z	upperdirs�source�targetr)r�rr�cs.

&


 zZipFile._extract_membercCs�|j|jkr(ddl}|jd|jdd�|jdkr:td��|jsHtd	��t|j�|j	s�d}t
|j�tkrpd
}n|j
tkr�d}n|jtkr�d}|r�t|d
��dS)NrzDuplicate name: %rr)r�rBrCrDz&write() requires mode 'w', 'x', or 'a'z4Attempt to write ZIP archive that was already closedzFiles countZFilesizezZipfile sizez would require ZIP64 extensions)rBrCrD)r>r?r�r�r	rwr8r�rarFr-r>�ZIP_FILECOUNT_LIMITrlr�rir
)r{r�r��requires_zip64rrrr��s(



zZipFile._writecheckcCs0|jstd��|jrtd��tj||�}|j�r>d|_d|_n|dk	rN||_n|j	|_|j�r�|j
��|jrz|jj|j
�|jj�|_|jtkr�|jdO_|j|�d|_|jj|�||j|j<|jj|jd��|jj�|_
WdQRXn<t|d��,}|j|d��}tj||d�WdQRXWdQRXdS)Nz7Attempt to write to ZIP archive that was already closedz>Can't write to ZIP archive while an open writing handle existsrrTFr;rBiri )r8rwr�r
r�r�rkrjrar�r�rr@r=rVrirrer�rGr>r.r?r>r�r�r=r�r�)r{r>r�rar��src�destrrrr��s8

z
ZipFile.writecCs�t|t�r|jd�}t|t�spt|tjtj��dd�d�}|j|_|jd
dkrhd|_	|j	dO_	qtd|_	n|}|j
s�td	��|jr�td
��|dk	r�||_t
|�|_|j�*|j|dd��}|j|�WdQRXWdQRXdS)Nzutf-8r!)r>r`rrqi�Ari�z7Attempt to write to ZIP archive that was already closedz?Can't write to ZIP archive while an open writing handle exists.rB)r	r�i�Ai�)r�rJr�r
r�r�r�rar>rhr8rwr�r-rlr�r=r�)r{Zzinfo_or_arcnamerRrar�r�rrr�writestr�s.



zZipFile.writestrcCs|j�dS)N)r�)r{rrr�__del__�szZipFile.__del__cCs||jdkrdS|jrtd��zB|jdkr\|jr\|j�"|jrJ|jj|j�|j	�WdQRXWd|j}d|_|j
|�XdS)NzvCan't close the ZIP file while there is an open writing handle on it. Close the writing handle before closing the zip.rBrCrD)rBrCrD)r8r�rwr	rGr�rr@r=�_write_end_recordrQ)r{r8rrrr��s
z
ZipFile.closecCsr�xP|jD�]D}|j}|ddd>|dd>B|dB}|dd>|d	d>B|ddB}g}|jtksv|jtkr�|j|j�|j|j�d
}d
}n|j}|j}|jtkr�|j|j�d
}n|j}|j}	d}
|�rt|	d�}	t	j
ddt|�dd
t|�f|��|	}	t}
|j
tk�r(tt|
�}
n|j
tk�r>tt|
�}
t|
|j�}t|
|j�}yZ|j�\}
}t	j
tt||j||j||j
|||j||t|
�t|	�t|j�d|j|j|�}Wnltk
�rttt||j||j|j |j
|||j||t|j!�t|	�t|j�d|j|j|ft"j#d��YnX|j$j%|�|j$j%|
�|j$j%|	�|j$j%|j�q
W|j$j&�}t|j�}||j'}|j'}d}|t(k�r�d}n|tk�r�d}n|tk�r�d}|�r*|j)�s�t*|d��t	j
t+t,ddddd||||�}|j$j%|�t	j
t-t.d|d�}|j$j%|�t/|d�}t/|d
�}t/|d
�}t	j
t0t1dd||||t|j2��	}|j$j%|�|j$j%|j2�|j$j3�dS)Nri�r#rr rrr%rl��z<HH�Qr)r�zFiles countzCentral directory offsetzCentral directory sizez would require ZIP64 extensions�,ri��)r)4r>r`rlr�rkr.rir0r5rBr�r-r�rarr[r�rr�rcrSr�rbrdrbrdrjr^rgrh�DeprecationWarningr]rer>rx�stderrr8r�rVr=r�rFr
rFrGrCrDr(rYrXrIr�)r{r�r�r�r�r0rlrkriZ
extra_datar�rcrSr>rermZpos2ZcentDirCountZcentDirSizeZ
centDirOffsetr�Zzip64endrecZzip64locrecrQrrrr�s�$$



















zZipFile._write_end_recordcCs*|jd8_|jr&|jr&|j�dS)Nr)rMrKr�)r{r8rrrrQrszZipFile._fpclose)N)N)rAN)F)NN)NNN)NN)N)#rrrr8r�rr|rSrWr�rPrsrtrxrzr}rr@r^�setterr:r=r�r�r�r�r�r�r�r�r�r�r�r�rQrrrrr{s:WT
	
		
u
+

*
*
$fc@s0eZdZdeddfdd�Zd
dd	�Zd
d�ZdS)rrATrcCstj|||||d�||_dS)N)r	r�rR)rr|�	_optimize)r{r�r	r�rR�optimizerrrr||szPyZipFile.__init__r~NcCs�tj|�}|rF||�rF|jrBtjj|�r.dnd}td||f�dStjj|�\}}tjj|��rntjj|d�}tjj|��r�|r�d||f}n|}|jr�td|d|�|j	|dd�|�\}}	|jr�td
|	�|j
||	�tj|�}
|
jd�x�|
D]�}tjj||�}tjj
|�\}
}tjj|��rRtjjtjj|d���r�|j|||d�q�|dkr�|�r�||��r�|jr�td
|�q�|j	|dd�|�\}}	|j�r�td
|	�|j
||	�q�Wn�|j�r�td|�x�tj|�D]�}tjj||�}tjj
|�\}
}|dk�r�|�r0||��r0|j�r�td
|��q�|j	|dd�|�\}}	|j�rZtd
|	�|j
||	��q�WnP|dd�dk�r�td��|j	|dd�|�\}}	|j�r�td|	�|j
||	�dS)Nr�r�z%s %r skipped by filterfuncz__init__.pyz%s/%szAdding package in�asrrZAdding)�
filterfuncz.pyzfile %r skipped by filterfunczAdding files from directoryz.Files added with writepy() must end with ".py"zAdding file���r�r�r�r�)rtr�rHr�r�r]r�r/�isfile�
_get_codenamer��listdir�remove�splitext�writepyr�)r{�pathname�basenamer�Zlabel�dirr
Zinitnamer�r�Zdirlistr>r��rootZextrrrr��sx












zPyZipFile.writepyc
sd�fdd�	}|d}|d}tjj|dd�}tjj|dd�}tjj|dd�}�jdk�r\tjj|�r�tj|�jtj|�jkr�|}	}
n�tjj|�r�tj|�jtj|�jkr�|}
|}	n�tjj|�r�tj|�jtj|�jkr�|}
|}	nvtjj|��rtj|�jtj|�jk�r|}
|}	nD||��rRt	j
jd	k�r4|}
nt	j
jdk�rH|}
n|}
|}	n|}
}	n��jd	k�rr|}
|}	n<|}	�jdk�r�|}
n&�jdk�r�|}
nd
j�j�}t
|��tjj|
��o�tj|
�jtj|�jk�s�||�jd��s�|}
}	tjj|	�d}|�rd||f}|
|fS)Nrcs^ddl}�jrtd|�y|j|d|d�Wn,|jk
rX}zt|j�dSd}~XnXdS)NrZ	CompilingT)�doraiser�F)�
py_compilerHr]�compile�PyCompileError�msg)r�r�r��err)r{rr�_compile�s

z)PyZipFile._get_codename.<locals>._compilez.pyz.pycr~)�optimizationrrz"invalid value for 'optimize': {!r})r�z%s/%sr�)r�r�)�	importlib�util�cache_from_sourcer�rtr�r�r�r�rxrnr��formatrwr�)
r{r�r�r�Zfile_pyZfile_pycZpycache_opt0Zpycache_opt1Zpycache_opt2r�r�r�Zarchivenamer)r{rr��s`


zPyZipFile._get_codenamer�)r~N)rrrrr|r�r�rrrrrys
Rcsddl}|jd�}|dkr(tjdd�}|s:|ddkrLt|�tjd�|ddkr�t|�dkrvt|�tjd�t|dd	��}|j�WdQRX�n||ddk�r
t|�dkr�t|�tjd�t|dd	��}|j	�}WdQRX|�r�td
j
|��td��n|ddk�rbt|�dk�r8t|�tjd�t|dd	��}|j|d�WdQRXn�|ddk�rt|�dk�r�t|�tjd��fd
d��t|dd��h}x`|dd�D]P}tj
j|�}|�s�tj
jtj
j|��}|dtjtjfk�r�d}�|||��q�WWdQRXdS)NraE        Usage:
            zipfile.py -l zipfile.zip        # Show listing of a zipfile
            zipfile.py -t zipfile.zip        # Test if a zipfile is valid
            zipfile.py -e zipfile.zip target # Extract zipfile into target dir
            zipfile.py -c zipfile.zip src ... # Create zipfile from sources
        r�-l�-c�-e�-trrAz.The following enclosed file is corrupted: {!r}zDone testingrcsptjj|�r|j||t�nPtjj|�rl|r8|j||�x2tj|�D]$}�|tjj||�tjj||��qDWdS)N)rtr�r�r�rr�r�r/)r9r��zippathZnm)�addToZiprrr�Uszmain.<locals>.addToZiprBr~)r�r�r�r�)�textwrap�dedentrx�argvr]�exitr-rrxrzr�r�rtr�r�r�r�r�)�argsr�ZUSAGEr9Zbadfiler�r�r)r�r�main'sT




r��__main__li���ii��ii��)N)�rrt�re�importlib.utilr�rxr�r�r�rBZbinasciirN�ImportErrorZdummy_threadingr�rr�r��__all__�	Exceptionrr
rrr�r�r�rrrrrzr�r�r�rjrYrXr�rWrHrIrJrKrLrMrNr]r^r_rbrdrarcZ_CD_CREATE_VERSIONZ_CD_CREATE_SYSTEMZ_CD_EXTRACT_VERSIONZ_CD_EXTRACT_SYSTEMZ
_CD_FLAG_BITSZ_CD_COMPRESS_TYPEZ_CD_TIMEZ_CD_DATEZ_CD_CRCZ_CD_COMPRESSED_SIZEZ_CD_UNCOMPRESSED_SIZErergrhZ_CD_DISK_NUMBER_STARTZ_CD_INTERNAL_FILE_ATTRIBUTESZ_CD_EXTERNAL_FILE_ATTRIBUTESrir�r�r�r�Z_FH_EXTRACT_VERSIONZ_FH_EXTRACT_SYSTEMZ_FH_GENERAL_PURPOSE_FLAG_BITSZ_FH_COMPRESSION_METHODZ_FH_LAST_MOD_TIMEZ_FH_LAST_MOD_DATEZ_FH_CRCZ_FH_COMPRESSED_SIZEZ_FH_UNCOMPRESSED_SIZEr�r�rCrDrArFrGrEZ_CD64_SIGNATUREZ_CD64_DIRECTORY_RECSIZEZ_CD64_CREATE_VERSIONZ_CD64_EXTRACT_VERSIONZ_CD64_DISK_NUMBERZ_CD64_DISK_NUMBER_STARTZ_CD64_NUMBER_ENTRIES_THIS_DISKZ_CD64_NUMBER_ENTRIES_TOTALZ_CD64_DIRECTORY_SIZEZ_CD64_OFFSET_START_CENTDIRr<ZStructr+r5r9r	rTr6�objectr
r�r�r�r�r�r�r�r�r�rr�r1rrr�rrrrr�<module>sB









+=[=&-J/
B
symbol.cpython-36.opt-2.pyc000064400000004613150335715140011447 0ustar003


 \G�@s�dZdZdZdZdZdZdZdZdZd	Z	d
Z
dZdZd
Z
dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;d<Z<d=Z=d>Z>d?Z?d@Z@dAZAdBZBdCZCdDZDdEZEdFZFdGZGdHZHdIZIdJZJdKZKdLZLdMZMdNZNdOZOdPZPdQZQdRZRdSZSdTZTdUZUiZVx6eWeX�jY��D]$\ZZZ[e\e[�e\dV�k�rleZeVe[<�qlWdWdX�Z]e^dYk�r�e]�dZS)[�iiiiiiiii	i
iii
iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiU�cCs:ddl}ddl}t|j�dkr.|jddg|_|j�dS)Nr�zInclude/graminit.hz
Lib/symbol.py)�sys�token�len�argv�_main)rr�r	�/usr/lib64/python3.6/symbol.pyrks
r�__main__N)_Zsingle_inputZ
file_inputZ
eval_inputZ	decoratorZ
decoratorsZ	decoratedZ
async_funcdefZfuncdefZ
parametersZ
typedargslistZtfpdefZvarargslistZvfpdefZstmtZsimple_stmtZ
small_stmtZ	expr_stmtZ	annassignZtestlist_star_exprZ	augassignZdel_stmtZ	pass_stmtZ	flow_stmtZ
break_stmtZ
continue_stmtZreturn_stmtZ
yield_stmtZ
raise_stmtZimport_stmtZimport_nameZimport_fromZimport_as_nameZdotted_as_nameZimport_as_namesZdotted_as_namesZdotted_nameZglobal_stmtZ
nonlocal_stmtZassert_stmtZ
compound_stmtZ
async_stmtZif_stmtZ
while_stmtZfor_stmtZtry_stmtZ	with_stmtZ	with_itemZ
except_clauseZsuiteZtestZtest_nocondZlambdefZlambdef_nocondZor_testZand_testZnot_testZ
comparisonZcomp_opZ	star_expr�exprZxor_exprZand_exprZ
shift_exprZ
arith_exprZtermZfactorZpowerZ	atom_exprZatomZ
testlist_compZtrailerZ
subscriptlistZ	subscriptZsliceopZexprlistZtestlistZdictorsetmakerZclassdefZarglistZargumentZ	comp_iterZcomp_forZcomp_ifZ
encoding_declZ
yield_exprZ	yield_argZsym_name�list�globals�items�_nameZ_value�typer�__name__r	r	r	r
�<module>
s�
traceback.cpython-36.opt-1.pyc000064400000046300150335715140012057 0ustar003


 \�[�@s:dZddlZddlZddlZddlZddddddd	d
ddd
ddddddddgZd3dd�Zdd�Zd4dd�Zd5dd	�Z	d6dd�Z
dZdZd7dd�Z
d8d d�Zd!d�Zd"d#�Zd$d%�Zd9d&d
�Zd:d'd�Zd;d(d
�Zd<d)d�Zd=d*d�Zd>d+d�Zd,d�ZGd-d�d�Zd.d�Zd/d�Zd0ZGd1d�de�ZGd2d�d�ZdS)?z@Extract, format and print information about Python stack traces.�N�
extract_stack�
extract_tb�format_exception�format_exception_only�format_list�format_stack�	format_tb�	print_exc�
format_exc�print_exception�
print_last�print_stack�print_tb�clear_frames�FrameSummary�StackSummary�TracebackException�
walk_stack�walk_tbcCs8|dkrtj}x$tj|�j�D]}t||dd�qWdS)zyPrint the list of tuples as returned by extract_tb() or
    extract_stack() as a formatted stack trace to the given file.N�)�file�end)�sys�stderrr�	from_list�format�print)�extracted_listr�item�r�!/usr/lib64/python3.6/traceback.py�
print_listsr!cCstj|�j�S)a�Format a list of tuples or FrameSummary objects for printing.

    Given a list of tuples or FrameSummary objects as returned by
    extract_tb() or extract_stack(), return a list of strings ready
    for printing.

    Each string in the resulting list corresponds to the item with the
    same index in the argument list.  Each string ends in a newline;
    the strings may contain internal newlines as well, for those items
    whose source text line is not None.
    )rrr)rrrr rscCstt||d�|d�dS)aPrint up to 'limit' stack trace entries from the traceback 'tb'.

    If 'limit' is omitted or None, all entries are printed.  If 'file'
    is omitted or None, the output goes to sys.stderr; otherwise
    'file' should be an open file or file-like object with a write()
    method.
    )�limit)rN)r!r)�tbr"rrrr r-scCst||d�j�S)z5A shorthand for 'format_list(extract_tb(tb, limit))'.)r")rr)r#r"rrr r7scCstjt|�|d�S)a#
    Return a StackSummary object representing a list of
    pre-processed entries from traceback.

    This is useful for alternate formatting of stack traces.  If
    'limit' is omitted or None, all entries are extracted.  A
    pre-processed stack trace entry is a FrameSummary object
    containing attributes filename, lineno, name, and line
    representing the information that is usually printed for a stack
    trace.  The line is a string with leading and trailing
    whitespace stripped; if the source is not available it is None.
    )r")r�extractr)r#r"rrr r;s
zG
The above exception was the direct cause of the following exception:

zF
During handling of the above exception, another exception occurred:

TcCsF|dkrtj}x2tt|�|||d�j|d�D]}t||dd�q,WdS)a�Print exception up to 'limit' stack trace entries from 'tb' to 'file'.

    This differs from print_tb() in the following ways: (1) if
    traceback is not None, it prints a header "Traceback (most recent
    call last):"; (2) it prints the exception type and value after the
    stack trace; (3) if type is SyntaxError and value has the
    appropriate format, it prints the line where the syntax error
    occurred with a caret on the next line indicating the approximate
    position of the error.
    N)r")�chainr)rr)rrr�typerr)�etype�valuer#r"rr%�linerrr rWs
cCs ttt|�|||d�j|d��S)azFormat a stack trace and the exception information.

    The arguments have the same meaning as the corresponding arguments
    to print_exception().  The return value is a list of strings, each
    ending in a newline and some containing internal newlines.  When
    these lines are concatenated and printed, exactly the same text is
    printed as does print_exception().
    )r")r%)�listrr&r)r'r(r#r"r%rrr rlscCstt||d�j��S)aFormat the exception part of a traceback.

    The arguments are the exception type and value such as given by
    sys.last_type and sys.last_value. The return value is a list of
    strings, each ending in a newline.

    Normally, the list contains a single string; however, for
    SyntaxError exceptions, it contains several lines that (when
    printed) display detailed information about where the syntax
    error occurred.

    The message indicating which exception occurred is always the last
    string in the list.

    N)r*rr)r'r(rrr r|scCs0t|�}|dks|r d|}nd||f}|S)Nz%s
z%s: %s
)�	_some_str)r'r(�valuestrr)rrr �_format_final_exc_line�s

r-c	Cs"yt|�Sdt|�jSdS)Nz<unprintable %s object>)�strr&�__name__)r(rrr r+�sr+cCsttj�|||d��dS)z>Shorthand for 'print_exception(*sys.exc_info(), limit, file)'.)r"rr%N)rr�exc_info)r"rr%rrr r	�scCsdjttj�||d���S)z%Like print_exc() but return a string.r)r"r%)�joinrrr0)r"r%rrr r
�scCs.ttd�std��ttjtjtj|||�dS)znThis is a shorthand for 'print_exception(sys.last_type,
    sys.last_value, sys.last_traceback, limit, file)'.�	last_typezno last exceptionN)�hasattrr�
ValueErrorrr2�
last_value�last_traceback)r"rr%rrr r�s
cCs*|dkrtj�j}tt||d�|d�dS)z�Print a stack trace from its invocation point.

    The optional 'f' argument can be used to specify an alternate
    stack frame at which to start. The optional 'limit' and 'file'
    arguments have the same meaning as for print_exception().
    N)r")r)r�	_getframe�f_backr!r)�fr"rrrr r
�s
cCs"|dkrtj�j}tt||d��S)z5Shorthand for 'format_list(extract_stack(f, limit))'.N)r")rr7r8rr)r9r"rrr r�s
cCs0|dkrtj�j}tjt|�|d�}|j�|S)asExtract the raw traceback from the current stack frame.

    The return value has the same format as for extract_tb().  The
    optional 'f' and 'limit' arguments have the same meaning as for
    print_stack().  Each item in the list is a quadruple (filename,
    line number, function name, text), and the entries are in order
    from oldest to newest stack frame.
    N)r")rr7r8rr$r�reverse)r9r"�stackrrr r�s
	
cCs<x6|dk	r6y|jj�Wntk
r,YnX|j}qWdS)zEClear all references to local variables in the frames of a traceback.N)�tb_frame�clear�RuntimeError�tb_next)r#rrr r�s
c@sReZdZdZdZdddd	�d
d�Zdd
�Zdd�Zdd�Zdd�Z	e
dd��ZdS)ra,A single frame from a traceback.

    - :attr:`filename` The filename for the frame.
    - :attr:`lineno` The line within filename for the frame that was
      active when the frame was captured.
    - :attr:`name` The name of the function or method that was executing
      when the frame was captured.
    - :attr:`line` The text from the linecache module for the
      of code that was running when the frame was captured.
    - :attr:`locals` Either None if locals were not supplied, or a dict
      mapping the name to the repr() of the variable.
    �filename�lineno�name�_line�localsTN)�lookup_linerDr)cCsF||_||_||_||_|r"|j|r<tdd�|j�D��nd|_dS)a�Construct a FrameSummary.

        :param lookup_line: If True, `linecache` is consulted for the source
            code line. Otherwise, the line will be looked up when first needed.
        :param locals: If supplied the frame locals, which will be captured as
            object representations.
        :param line: If provided, use this instead of looking up the line in
            the linecache.
        css|]\}}|t|�fVqdS)N)�repr)�.0�k�vrrr �	<genexpr>sz(FrameSummary.__init__.<locals>.<genexpr>N)r@rArBrCr)�dict�itemsrD)�selfr@rArBrErDr)rrr �__init__�szFrameSummary.__init__cCs`t|t�r:|j|jko8|j|jko8|j|jko8|j|jkSt|t�r\|j|j|j|jf|kStS)N)	�
isinstancerr@rArBrD�tupler)�NotImplemented)rM�otherrrr �__eq__s

zFrameSummary.__eq__cCs|j|j|j|jf|S)N)r@rArBr))rM�posrrr �__getitem__szFrameSummary.__getitem__cCst|j|j|j|jg�S)N)�iterr@rArBr))rMrrr �__iter__szFrameSummary.__iter__cCsdj|j|j|jd�S)Nz7<FrameSummary file {filename}, line {lineno} in {name}>)r@rArB)rr@rArB)rMrrr �__repr__szFrameSummary.__repr__cCs&|jdkr tj|j|j�j�|_|jS)N)rC�	linecache�getliner@rA�strip)rMrrr r)s
zFrameSummary.line)r@rArBrCrD)r/�
__module__�__qualname__�__doc__�	__slots__rNrSrUrWrX�propertyr)rrrr r�s
ccs8|dkrtj�jj}x|dk	r2||jfV|j}qWdS)z�Walk a stack yielding the frame and line number for each frame.

    This will follow f.f_back from the given frame. If no frame is given, the
    current stack is used. Usually used with StackSummary.extract.
    N)rr7r8�f_lineno)r9rrr r"s

ccs&x |dk	r |j|jfV|j}qWdS)z�Walk a traceback yielding the frame and line number for each frame.

    This will follow tb.tb_next (and thus is in the opposite order to
    walk_stack). Usually used with StackSummary.extract.
    N)r<�	tb_linenor?)r#rrr r/s
�c@s:eZdZdZedddd�dd��Zedd	��Zd
d�ZdS)rzA stack of frames.NTF)r"�lookup_lines�capture_localsc
	Cs�|dkr(ttdd�}|dk	r(|dkr(d}|dk	rV|dkrFtj||�}ntj||d�}|�}t�}xb|D]Z\}}|j}	|	j}
|	j	}|j
|
�tj|
|j
�|r�|j}nd}|jt|
||d|d��qhWx|D]}
tj|
�q�W|r�x|D]
}|jq�W|S)a?Create a StackSummary from a traceback or stack object.

        :param frame_gen: A generator that yields (frame, lineno) tuples to
            include in the stack.
        :param limit: None to include all frames or the number of frames to
            include.
        :param lookup_lines: If True, lookup lines for each frame immediately,
            otherwise lookup is deferred until the frame is rendered.
        :param capture_locals: If True, the local variables from each frame will
            be captured as object representations into the FrameSummary.
        N�tracebacklimitr)�maxlenF)rErD)�getattrr�	itertools�islice�collections�deque�set�f_code�co_filename�co_name�addrY�	lazycache�	f_globals�f_locals�appendr�
checkcacher))
�klass�	frame_genr"rdre�result�fnamesr9rA�cor@rBrtrrr r$?s6



zStackSummary.extractcCsPt�}xD|D]<}t|t�r&|j|�q|\}}}}|jt||||d��qW|S)z�
        Create a StackSummary object from a supplied list of
        FrameSummary objects or old-style list of tuples.
        )r))rrOrru)rw�a_listry�framer@rArBr)rrr ros


zStackSummary.from_listc
Csxg}d}d}d}d}�x$|D�]}|dksX||jksX|dksX||jksX|dksX||jkr�|tkr�|t8}|jd|�d|dkr�dnd�d��|j}|j}|j}d}|d7}|tkr�qg}|jd	j|j|j|j��|jr�|jd
j|jj���|j�r(x0t	|jj
��D]\}}	|jdj||	d���qW|jdj|��qW|tk�rt|t8}|jd|�d|dk�rhdnd�d��|S)
aFormat the stack ready for printing.

        Returns a list of strings ready for printing.  Each string in the
        resulting list corresponds to a single frame from the stack.
        Each string ends in a newline; the strings may contain internal
        newlines as well, for those items with source text lines.

        For long sequences of the same frame and line, the first few
        repetitions are shown, followed by a summary line stating the exact
        number of further repetitions.
        Nrz  [Previous line repeated z
 more time��srz]
z  File "{}", line {}, in {}
z    {}
z    {name} = {value}
)rBr()r@rArB�_RECURSIVE_CUTOFFrurr)r[rD�sortedrLr1)
rMry�	last_file�	last_line�	last_name�countr}�rowrBr(rrr r�sD 
"zStackSummary.format)r/r\r]r^�classmethodr$rrrrrr r<s.c@s^eZdZdZddddd�dd�Zedd	��Zd
d�Zdd
�Zdd�Z	dd�Z
dd�dd�ZdS)ra�An exception ready for rendering.

    The traceback module captures enough attributes from the original exception
    to this intermediary form to ensure that no references are held, while
    still being able to fully print or format it.

    Use `from_exception` to create TracebackException instances from exception
    objects, or the constructor to create TracebackException instances from
    individual components.

    - :attr:`__cause__` A TracebackException of the original *__cause__*.
    - :attr:`__context__` A TracebackException of the original *__context__*.
    - :attr:`__suppress_context__` The *__suppress_context__* value from the
      original exception.
    - :attr:`stack` A `StackSummary` representing the traceback.
    - :attr:`exc_type` The class of the original traceback.
    - :attr:`filename` For syntax errors - the filename where the error
      occurred.
    - :attr:`lineno` For syntax errors - the linenumber where the error
      occurred.
    - :attr:`text` For syntax errors - the text where the error
      occurred.
    - :attr:`offset` For syntax errors - the offset into the text where the
      error occurred.
    - :attr:`msg` For syntax errors - the compiler error message.
    NTF)r"rdre�_seenc
	Cs<|dkrt�}|jt|��|r\|jdk	r\t|j�|kr\tt|j�|j|jj|d||d�}nd}|r�|jdk	r�t|j�|kr�tt|j�|j|jj|d||d�}	nd}	||_||_|	|_|r�|j	nd|_	t
jt|�|||d�|_
||_t|�|_|o�t|t��r*|j|_t|j�|_|j|_|j|_|j|_|�r8|j�dS)NF)r"rdrer�)r"rdre)rmrq�id�	__cause__rr&�
__traceback__�__context__�
exc_traceback�__suppress_context__rr$rr;�exc_typer+�_str�
issubclass�SyntaxErrorr@r.rA�text�offset�msg�_load_lines)
rMr��	exc_valuer�r"rdrer��cause�contextrrr rN�sT




zTracebackException.__init__cOs|t|�||jf|�|�S)z.Create a TracebackException from an exception.)r&r�)�cls�exc�args�kwargsrrr �from_exceptionsz!TracebackException.from_exceptioncCs:x|jD]
}|jqW|jr&|jj�|jr6|jj�dS)z7Private API. force all lines in the stack to be loaded.N)r;r)r�r�r�)rMr}rrr r�s

zTracebackException._load_linescCs|j|jkS)N)�__dict__)rMrRrrr rSszTracebackException.__eq__cCs|jS)N)r�)rMrrr �__str__szTracebackException.__str__c	cs|jdkrtd|j�VdS|jj}|jj}|dkr@|d|}t|jt�s^t||j�VdS|jpfd}t|j	�ptd}dj
||�V|j}|j}|dk	�rdj
|j
��V|dk	�r|jd	�}tt|�|�d
}|d|�j�}dd�|D�}d
j
dj|��V|j�p
d}dj
||�VdS)a�Format the exception part of the traceback.

        The return value is a generator of strings, each ending in a newline.

        Normally, the generator emits a single string; however, for
        SyntaxError exceptions, it emites several lines that (when
        printed) display detailed information about where the syntax
        error occurred.

        The message indicating which exception occurred is always the last
        string in the output.
        N�__main__�builtins�.z<string>�?z  File "{}", line {}
z    {}
�
r~css|]}|j�r|pdVqdS)� N)�isspace)rG�crrr rJHsz;TracebackException.format_exception_only.<locals>.<genexpr>z    {}^
rz<no detail available>z{}: {}
)r�r�)r�r-r�r]r\r�r�r@r.rArr�r�r[�rstrip�min�len�lstripr1r�)	rM�stype�smodr@rA�badliner��
caretspacer�rrr r s2




z(TracebackException.format_exception_only)r%ccs�|rV|jdk	r*|jj|d�EdHtVn,|jdk	rV|jrV|jj|d�EdHtV|jdk	rfdV|jj�EdH|j�EdHdS)a�Format the exception.

        If chain is not *True*, *__cause__* and *__context__* will not be formatted.

        The return value is a generator of strings, each ending in a newline and
        some containing internal newlines. `print_exception` is a wrapper around
        this method which just prints the lines to a file.

        The message indicating which exception occurred is always the last
        string in the output.
        N)r%z#Traceback (most recent call last):
)	r�r�_cause_messager�r��_context_messager�r;r)rMr%rrr rMs


zTracebackException.format)r/r\r]r^rNr�r�r�rSr�rrrrrr r�s9	-)N)NN)N)N)NNT)NT)NNT)NT)NNT)NNN)NN)NN) r^rkrirYr�__all__r!rrrrr�r�rrrr-r+r	r
rr
rrrrrrr�r*rrrrrr �<module>sF












?
zxdrlib.cpython-36.opt-1.pyc000064400000020160150335715140011420 0ustar003


 \�@sxdZddlZddlmZddlmZddddgZGd	d�de�ZGd
d�de�Z	dd�Z
Gd
d�d�ZGdd�d�ZdS)zRImplements (a subset of) Sun XDR -- eXternal Data Representation.

See: RFC 1014

�N)�BytesIO)�wraps�Error�Packer�Unpacker�ConversionErrorc@s(eZdZdZdd�Zdd�Zdd�ZdS)	rz�Exception class for this module. Use:

    except xdrlib.Error as var:
        # var has the Error instance for the exception

    Public ivars:
        msg -- contains the message

    cCs
||_dS)N)�msg)�selfr�r
�/usr/lib64/python3.6/xdrlib.py�__init__szError.__init__cCs
t|j�S)N)�reprr)r	r
r
r�__repr__szError.__repr__cCs
t|j�S)N)�strr)r	r
r
r�__str__sz
Error.__str__N)�__name__�
__module__�__qualname__�__doc__rrrr
r
r
rrs	c@seZdZdS)rN)rrrr
r
r
rr scst���fdd��}|S)z5 Wrap any raised struct.errors in a ConversionError. csDy
�||�Stjk
r>}zt|jd�d�WYdd}~XnXdS)Nr)�struct�errorr�args)r	�value�e)�functionr
r�result&s
z&raise_conversion_error.<locals>.result)r)rrr
)rr�raise_conversion_error#src@s�eZdZdZdd�Zdd�Zdd�ZeZedd	��Z	ed
d��Z
e
Zdd
�Zdd�Z
e
Zedd��Zedd��Zdd�ZeZdd�ZeZeZdd�Zdd�Zdd�ZdS)rz0Pack various data representations into a buffer.cCs|j�dS)N)�reset)r	r
r
rr2szPacker.__init__cCst�|_dS)N)r�_Packer__buf)r	r
r
rr5szPacker.resetcCs
|jj�S)N)r�getvalue)r	r
r
r�
get_buffer8szPacker.get_buffercCs|jjtjd|��dS)Nz>L)r�writer�pack)r	�xr
r
r�	pack_uint=szPacker.pack_uintcCs|jjtjd|��dS)Nz>l)rr!rr")r	r#r
r
r�pack_intAszPacker.pack_intcCs"|r|jjd�n|jjd�dS)Nss)rr!)r	r#r
r
r�	pack_boolGszPacker.pack_boolcCs�y|j|d?d@�Wn8ttjfk
rN}zt|jd�d�WYdd}~XnXy|j|d@�Wn8ttjfk
r�}zt|jd�d�WYdd}~XnXdS)N� l��r)r$�	TypeErrorrrrr)r	r#rr
r
r�pack_uhyperKs"zPacker.pack_uhypercCs|jjtjd|��dS)Nz>f)rr!rr")r	r#r
r
r�
pack_floatWszPacker.pack_floatcCs|jjtjd|��dS)Nz>d)rr!rr")r	r#r
r
r�pack_double[szPacker.pack_doublecCsP|dkrtd��|d|�}|ddd}||t|�d}|jj|�dS)Nrz fstring size must be nonnegative���)�
ValueError�lenrr!)r	�n�s�datar
r
r�pack_fstring_szPacker.pack_fstringcCs"t|�}|j|�|j||�dS)N)r0r$r4)r	r2r1r
r
r�pack_stringis
zPacker.pack_stringcCs.x|D]}|jd�||�qW|jd�dS)N�r)r$)r	�list�	pack_item�itemr
r
r�	pack_listqs

zPacker.pack_listcCs.t|�|krtd��x|D]}||�qWdS)Nzwrong array size)r0r/)r	r1r7r8r9r
r
r�pack_farrayws
zPacker.pack_farraycCs$t|�}|j|�|j|||�dS)N)r0r$r;)r	r7r8r1r
r
r�
pack_array}s
zPacker.pack_arrayN)rrrrrrr Zget_bufrr$r%Z	pack_enumr&r)Z
pack_hyperr*r+r4Zpack_fopaquer5Zpack_opaqueZ
pack_bytesr:r;r<r
r
r
rr/s*
c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZeZdd�Z
dd�Zdd�Zdd�Zdd�Zdd�ZeZdd�ZeZeZd d!�Zd"d#�Zd$d%�Zd&S)'rz;Unpacks various data representations from the given buffer.cCs|j|�dS)N)r)r	r3r
r
rr�szUnpacker.__init__cCs||_d|_dS)Nr)�_Unpacker__buf�_Unpacker__pos)r	r3r
r
rr�szUnpacker.resetcCs|jS)N)r>)r	r
r
r�get_position�szUnpacker.get_positioncCs
||_dS)N)r>)r	Zpositionr
r
r�set_position�szUnpacker.set_positioncCs|jS)N)r=)r	r
r
rr �szUnpacker.get_buffercCs|jt|j�krtd��dS)Nzunextracted data remains)r>r0r=r)r	r
r
r�done�sz
Unpacker.donecCsB|j}|d|_}|j||�}t|�dkr2t�tjd|�dS)Nr-z>Lr)r>r=r0�EOFErrorr�unpack)r	�i�jr3r
r
r�unpack_uint�szUnpacker.unpack_uintcCsB|j}|d|_}|j||�}t|�dkr2t�tjd|�dS)Nr-z>lr)r>r=r0rBrrC)r	rDrEr3r
r
r�
unpack_int�szUnpacker.unpack_intcCst|j��S)N)�boolrG)r	r
r
r�unpack_bool�szUnpacker.unpack_boolcCs |j�}|j�}t|�d>|BS)Nr')rF�int)r	�hi�lor
r
r�
unpack_uhyper�szUnpacker.unpack_uhypercCs|j�}|dkr|d}|S)Nll)rM)r	r#r
r
r�unpack_hyper�szUnpacker.unpack_hypercCsB|j}|d|_}|j||�}t|�dkr2t�tjd|�dS)Nr-z>fr)r>r=r0rBrrC)r	rDrEr3r
r
r�unpack_float�szUnpacker.unpack_floatcCsB|j}|d|_}|j||�}t|�dkr2t�tjd|�dS)N�z>dr)r>r=r0rBrrC)r	rDrEr3r
r
r�
unpack_double�szUnpacker.unpack_doublecCsT|dkrtd��|j}||ddd}|t|j�kr<t�||_|j|||�S)Nrz fstring size must be nonnegativer,r-)r/r>r0r=rB)r	r1rDrEr
r
r�unpack_fstring�szUnpacker.unpack_fstringcCs|j�}|j|�S)N)rFrR)r	r1r
r
r�
unpack_string�szUnpacker.unpack_stringcCsFg}x<|j�}|dkrP|dkr.td|f��|�}|j|�qW|S)Nrr6z0 or 1 expected, got %r)rFr�append)r	�unpack_itemr7r#r9r
r
r�unpack_list�szUnpacker.unpack_listcCs&g}xt|�D]}|j|��qW|S)N)�rangerT)r	r1rUr7rDr
r
r�
unpack_farray�szUnpacker.unpack_farraycCs|j�}|j||�S)N)rFrX)r	rUr1r
r
r�unpack_array�szUnpacker.unpack_arrayN)rrrrrrr?r@r rArFrGZunpack_enumrIrMrNrOrQrRZunpack_fopaquerSZ
unpack_opaqueZunpack_bytesrVrXrYr
r
r
rr�s.
)
rr�ior�	functoolsr�__all__�	Exceptionrrrrrr
r
r
r�<module>sUrlcompleter.cpython-36.opt-1.pyc000064400000013226150335715140012471 0ustar003


 \��@s�dZddlZddlZddlZdgZGdd�d�Zdd�ZyddlZWnek
r\dZ	Yn"Xej
e�j�ejdd	��d
Z	dS)a1Word completion for GNU readline.

The completer completes keywords, built-ins and globals in a selectable
namespace (which defaults to __main__); when completing NAME.NAME..., it
evaluates (!) the expression up to the last dot and completes its attributes.

It's very cool to do "import sys" type "sys.", hit the completion key (twice),
and see the list of names defined by the sys module!

Tip: to use the tab key as the completion key, call

    readline.parse_and_bind("tab: complete")

Notes:

- Exceptions raised by the completer function are *ignored* (and generally cause
  the completion to fail).  This is a feature -- since readline sets the tty
  device in raw (or cbreak) mode, printing a traceback wouldn't work well
  without some complicated hoopla to save, reset and restore the tty state.

- The evaluation of the NAME.NAME... form may cause arbitrary application
  defined code to be executed if an object with a __getattr__ hook is found.
  Since it is the responsibility of the application (or the user) to enable this
  feature, I consider this an acceptable risk.  More complicated expressions
  (e.g. function calls or indexing operations) are *not* evaluated.

- When the original stdin is not a tty device, GNU readline is never
  used, and this module (and the readline module) are silently inactive.

�N�	Completerc@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rNcCs8|rt|t�rtd��|dkr(d|_nd|_||_dS)a�Create a new completer for the command line.

        Completer([namespace]) -> completer instance.

        If unspecified, the default namespace where completions are performed
        is __main__ (technically, __main__.__dict__). Namespaces should be
        given as dictionaries.

        Completer instances should be used as the completion mechanism of
        readline via the set_completer() call:

        readline.set_completer(Completer(my_namespace).complete)
        znamespace must be a dictionaryN�r)�
isinstance�dict�	TypeError�use_main_ns�	namespace)�selfr�r
�#/usr/lib64/python3.6/rlcompleter.py�__init__'szCompleter.__init__cCs�|jrtj|_|j�sB|dkr>tr8tjd�tj�dSdSndS|dkrld|kr`|j	|�|_
n|j|�|_
y
|j
|Stk
r�dSXdS)z�Return the next possible completion for 'text'.

        This is called successively with state == 0, 1, 2, ... until it
        returns None.  The completion should begin with 'text'.

        r�	�N�.)
r�__main__�__dict__r�strip�_readline_available�readlineZinsert_textZ	redisplay�attr_matches�matches�global_matches�
IndexError)r	�text�stater
r
r�completeBs$

zCompleter.completecCst|�r|d}|S)N�()�callable)r	�val�wordr
r
r�_callable_postfixaszCompleter._callable_postfixc		Cs�ddl}g}dh}t|�}xT|jD]J}|d|�|kr"|j|�|dkrR|d}n|dkrb|d}|j|�q"Wx^|jtjgD]N}xH|j�D]<\}}|d|�|kr�||kr�|j|�|j|j	||��q�Wq~W|S)z�Compute matches when text is a simple name.

        Return a list of all keywords, built-in functions and names currently
        defined in self.namespace that match.

        rN�__builtins__�finally�try�:�False�None�True�break�continue�pass�else� >r"r#>r)r'r+r%r*r(r&)
�keyword�len�kwlist�add�appendr�builtinsr�itemsr )	r	rr-r�seen�nrZnspacerr
r
rrfs(


zCompleter.global_matchescCsnddl}|jd|�}|sgS|jdd�\}}yt||j�}Wntk
rPgSXtt|��}|jd�t	|d�r�|j
d�|jt|j
��g}t|�}	|dkr�d	}
n|d	kr�d
}
nd}
x�x~|D]v}|d|	�|ko�|
o�|d|	d�|
kr�d||f}yt||�}
Wntk
�rYnX|j|
|�}|j|�q�W|�sH|
�rJP|
d	k�rZd
}
q�d}
q�W|j�|S)a�Compute matches when text contains a dot.

        Assuming the text is of the form NAME.NAME....[NAME], and is
        evaluable in self.namespace, it will be evaluated and its attributes
        (as revealed by dir()) are used as possible completions.  (For class
        instances, class members are also considered.)

        WARNING: this can still invoke arbitrary C code, if an object
        with a __getattr__ hook is evaluated.

        rNz(\w+(\.\w+)*)\.(\w*)r�r!�	__class__r�_�__z%s.%s)�re�match�group�evalr�	Exception�set�dir�discard�hasattrr0�update�get_class_membersr7r.�getattrr r1�sort)r	rr:�m�expr�attrZ
thisobjectZwordsrr5Znoprefixrr;rr
r
rr�sN




zCompleter.attr_matches)N)�__name__�
__module__�__qualname__rrr rrr
r
r
rr&s

cCs2t|�}t|d�r.x|jD]}|t|�}qW|S)N�	__bases__)r@rBrMrD)�klassZret�baser
r
rrD�s

rDFcCs
tjd�S)N)r�
set_completerr
r
r
r�<lambda>�srQT)
�__doc__�atexitr2r�__all__rrDr�ImportErrorrrPr�registerr
r
r
r�<module>s
statistics.cpython-36.pyc000064400000043400150335715140011371 0ustar003


 \�P�@sDdZddddddddd	d
ddgZd
dlZd
dlZd
dlZd
dlZd
dlmZd
dlmZd
dl	m
Z
mZd
dlm
Z
mZGdd�de�Zd5dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd6d%d&�Zd'd
�Zd(d�Zd)d�Zd*d�Zd+d�Zd7d-d	�Zd.d�Z d8d/d0�Z!d9d1d�Z"d:d2d�Z#d;d3d�Z$d<d4d�Z%dS)=aq	
Basic statistics module.

This module provides functions for calculating statistics of data, including
averages, variance, and standard deviation.

Calculating averages
--------------------

==================  =============================================
Function            Description
==================  =============================================
mean                Arithmetic mean (average) of data.
harmonic_mean       Harmonic mean of data.
median              Median (middle value) of data.
median_low          Low median of data.
median_high         High median of data.
median_grouped      Median, or 50th percentile, of grouped data.
mode                Mode (most common value) of data.
==================  =============================================

Calculate the arithmetic mean ("the average") of data:

>>> mean([-1.0, 2.5, 3.25, 5.75])
2.625


Calculate the standard median of discrete data:

>>> median([2, 3, 4, 5])
3.5


Calculate the median, or 50th percentile, of data grouped into class intervals
centred on the data values provided. E.g. if your data points are rounded to
the nearest whole number:

>>> median_grouped([2, 2, 3, 3, 3, 4])  #doctest: +ELLIPSIS
2.8333333333...

This should be interpreted in this way: you have two data points in the class
interval 1.5-2.5, three data points in the class interval 2.5-3.5, and one in
the class interval 3.5-4.5. The median of these data points is 2.8333...


Calculating variability or spread
---------------------------------

==================  =============================================
Function            Description
==================  =============================================
pvariance           Population variance of data.
variance            Sample variance of data.
pstdev              Population standard deviation of data.
stdev               Sample standard deviation of data.
==================  =============================================

Calculate the standard deviation of sample data:

>>> stdev([2.5, 3.25, 5.5, 11.25, 11.75])  #doctest: +ELLIPSIS
4.38961843444...

If you have previously calculated the mean, you can pass it as the optional
second argument to the four "spread" functions to avoid recalculating it:

>>> data = [1, 2, 2, 4, 4, 4, 5, 6]
>>> mu = mean(data)
>>> pvariance(data, mu)
2.5


Exceptions
----------

A single exception is defined: StatisticsError is a subclass of ValueError.

�StatisticsError�pstdev�	pvariance�stdev�variance�median�
median_low�median_high�median_grouped�mean�mode�
harmonic_mean�N)�Fraction)�Decimal)�groupby�chain)�bisect_left�bisect_rightc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�"/usr/lib64/python3.6/statistics.pyrcscCs�d}t|�\}}||i}|j}ttt|��}xRt|t�D]D\}}	t||�}x0tt|	�D]"\}}|d7}||d�|||<qVWq8Wd|kr�|d}
t|
�s�t�nt	dd�t
|j��D��}
||
|fS)aC_sum(data [, start]) -> (type, sum, count)

    Return a high-precision sum of the given numeric data as a fraction,
    together with the type to be converted to and the count of items.

    If optional argument ``start`` is given, it is added to the total.
    If ``data`` is empty, ``start`` (defaulting to 0) is returned.


    Examples
    --------

    >>> _sum([3, 2.25, 4.5, -0.5, 1.0], 0.75)
    (<class 'float'>, Fraction(11, 1), 5)

    Some sources of round-off error will be avoided:

    # Built-in sum returns zero.
    >>> _sum([1e50, 1, -1e50] * 1000)
    (<class 'float'>, Fraction(1000, 1), 3000)

    Fractions and Decimals are also supported:

    >>> from fractions import Fraction as F
    >>> _sum([F(2, 3), F(7, 5), F(1, 4), F(5, 6)])
    (<class 'fractions.Fraction'>, Fraction(63, 20), 4)

    >>> from decimal import Decimal as D
    >>> data = [D("0.1375"), D("0.2108"), D("0.3061"), D("0.0419")]
    >>> _sum(data)
    (<class 'decimal.Decimal'>, Fraction(6963, 10000), 4)

    Mixed types are currently treated as an error, except that int is
    allowed.
    r
�Ncss|]\}}t||�VqdS)N)r)�.0�d�nrrr�	<genexpr>�sz_sum.<locals>.<genexpr>)�_exact_ratio�get�_coerce�int�typer�map�	_isfinite�AssertionError�sum�sorted�items)�data�start�countrrZpartialsZpartials_get�T�typ�values�totalrrr�_sumis$
r0cCs(y|j�Stk
r"tj|�SXdS)N)Z	is_finite�AttributeError�mathZisfinite)�xrrrr$�sr$cCs�|tk	std��||kr|S|tks,|tkr0|S|tkr<|St||�rJ|St||�rX|St|t�rf|St|t�rt|St|t�r�t|t�r�|St|t�r�t|t�r�|Sd}t||j|jf��dS)z�Coerce types T and S to a common type, or raise TypeError.

    Coercion rules are currently an implementation detail. See the CoerceTest
    test class in test_statistics for details.
    zinitial type T is boolz"don't know how to coerce %s and %sN)�boolr%r!�
issubclassr�float�	TypeErrorr)r,�S�msgrrrr �s*



r cCs�ydt|�tkst|�tkr"|j�Sy|j|jfStk
r`y|j�Stk
rZYnXYnXWn*ttfk
r�t	|�s�t
�|dfSXd}t|jt|�j
���dS)z�Return Real number x to exact (numerator, denominator) pair.

    >>> _exact_ratio(0.25)
    (1, 4)

    x is expected to be an int, Fraction, Decimal or float.
    Nz0can't convert type '{}' to numerator/denominator)r"r6r�as_integer_ratio�	numerator�denominatorr1�
OverflowError�
ValueErrorr$r%r7�formatr)r3r9rrrr�s
rcCsjt|�|kr|St|t�r(|jdkr(t}y||�Stk
rdt|t�r^||j�||j�S�YnXdS)z&Convert value to given numeric type T.rN)r"r5r!r<r6r7rr;)�valuer,rrr�_convert�s
rAcCs`tjt|��j�}|s|S|dd}x4tdt|��D]"}||d|kr6|d|�}Pq6W|S)Nr
r)�collections�Counter�iter�most_common�range�len)r)�tableZmaxfreq�irrr�_counts�srJcCs.t||�}|t|�kr&|||kr&|St�dS)z,Locate the leftmost value exactly equal to xN)rrGr>)�ar3rIrrr�
_find_lteq	s
rLcCs>t|||d�}|t|�dkr6||d|kr6|dSt�dS)z-Locate the rightmost value exactly equal to x)�lorN)rrGr>)rK�lr3rIrrr�
_find_rteqs rO�negative valueccs(x"|D]}|dkrt|��|VqWdS)z7Iterate over values, failing if any are less than zero.r
N)r)r.�errmsgr3rrr�	_fail_negs
rRcCsTt|�|krt|�}t|�}|dkr,td��t|�\}}}||ksFt�t|||�S)a�Return the sample arithmetic mean of data.

    >>> mean([1, 2, 3, 4, 4])
    2.8

    >>> from fractions import Fraction as F
    >>> mean([F(3, 7), F(1, 21), F(5, 3), F(1, 3)])
    Fraction(13, 21)

    >>> from decimal import Decimal as D
    >>> mean([D("0.5"), D("0.75"), D("0.625"), D("0.375")])
    Decimal('0.5625')

    If ``data`` is empty, StatisticsError will be raised.
    rz%mean requires at least one data point)rD�listrGrr0r%rA)r)rr,r/r+rrrr
#scCs�t|�|krt|�}d}t|�}|dkr2td��n<|dkrn|d}t|tjtf�rf|dkrbt|��|Std��y"t	dd�t
||�D��\}}}Wntk
r�dSX||ks�t�t
|||�S)aReturn the harmonic mean of data.

    The harmonic mean, sometimes called the subcontrary mean, is the
    reciprocal of the arithmetic mean of the reciprocals of the data,
    and is often appropriate when averaging quantities which are rates
    or ratios, for example speeds. Example:

    Suppose an investor purchases an equal value of shares in each of
    three companies, with P/E (price/earning) ratios of 2.5, 3 and 10.
    What is the average P/E ratio for the investor's portfolio?

    >>> harmonic_mean([2.5, 3, 10])  # For an equal investment portfolio.
    3.6

    Using the arithmetic mean would give an average of about 5.167, which
    is too high.

    If ``data`` is empty, or any element is less than zero,
    ``harmonic_mean`` will raise ``StatisticsError``.
    z.harmonic mean does not support negative valuesrz.harmonic_mean requires at least one data pointr
zunsupported typecss|]}d|VqdS)rNr)rr3rrrrdsz harmonic_mean.<locals>.<genexpr>)rDrSrGr�
isinstance�numbersZRealrr7r0rR�ZeroDivisionErrorr%rA)r)rQrr3r,r/r+rrrr=s&
"cCs\t|�}t|�}|dkr td��|ddkr8||dS|d}||d||dSdS)aBReturn the median (middle value) of numeric data.

    When the number of data points is odd, return the middle data point.
    When the number of data points is even, the median is interpolated by
    taking the average of the two middle values:

    >>> median([1, 3, 5])
    3
    >>> median([1, 3, 5, 7])
    4.0

    r
zno median for empty data�rN)r'rGr)r)rrIrrrrls
cCsLt|�}t|�}|dkr td��|ddkr8||dS||ddSdS)a	Return the low median of numeric data.

    When the number of data points is odd, the middle value is returned.
    When it is even, the smaller of the two middle values is returned.

    >>> median_low([1, 3, 5])
    3
    >>> median_low([1, 3, 5, 7])
    3

    r
zno median for empty datarWrN)r'rGr)r)rrrrr�scCs,t|�}t|�}|dkr td��||dS)aReturn the high median of data.

    When the number of data points is odd, the middle value is returned.
    When it is even, the larger of the two middle values is returned.

    >>> median_high([1, 3, 5])
    3
    >>> median_high([1, 3, 5, 7])
    5

    r
zno median for empty datarW)r'rGr)r)rrrrr�s
rc
Cs�t|�}t|�}|dkr"td��n|dkr2|dS||d}x*||fD]}t|ttf�rHtd|��qHWy||d}Wn(tk
r�t|�t|�d}YnXt||�}t	|||�}|}||d}	|||d||	S)a�Return the 50th percentile (median) of grouped continuous data.

    >>> median_grouped([1, 2, 2, 3, 4, 4, 4, 4, 4, 5])
    3.7
    >>> median_grouped([52, 52, 53, 54])
    52.5

    This calculates the median as the 50th percentile, and should be
    used when your data is continuous and grouped. In the above example,
    the values 1, 2, 3, etc. actually represent the midpoint of classes
    0.5-1.5, 1.5-2.5, 2.5-3.5, etc. The middle value falls somewhere in
    class 3.5-4.5, and interpolation is used to estimate it.

    Optional argument ``interval`` represents the class interval, and
    defaults to 1. Changing the class interval naturally will change the
    interpolated 50th percentile value:

    >>> median_grouped([1, 3, 3, 5, 7], interval=1)
    3.25
    >>> median_grouped([1, 3, 3, 5, 7], interval=2)
    3.5

    This function does not check whether the data points are at least
    ``interval`` apart.
    r
zno median for empty datarrWzexpected number but got %r)
r'rGrrT�str�bytesr7r6rLrO)
r)Zintervalrr3�obj�L�l1�l2Zcf�frrrr	�s&

cCsBt|�}t|�dkr |ddS|r6tdt|���ntd��dS)a�Return the most common data point from discrete or nominal data.

    ``mode`` assumes discrete data, and returns a single value. This is the
    standard treatment of the mode as commonly taught in schools:

    >>> mode([1, 1, 2, 3, 3, 3, 3, 4])
    3

    This also works with nominal (non-numeric) data:

    >>> mode(["red", "blue", "blue", "red", "green", "red", "red"])
    'red'

    If there is not exactly one most common value, ``mode`` will raise
    StatisticsError.
    rr
z.no unique mode; found %d equally common valueszno mode for empty dataN)rJrGr)r)rHrrrr�scs��dkrt|��t�fdd�|D��\}}}t�fdd�|D��\}}}||krX||ks\t�||dt|�8}|dks�td|��||fS)a;Return sum of square deviations of sequence data.

    If ``c`` is None, the mean is calculated in one pass, and the deviations
    from the mean are calculated in a second pass. Otherwise, deviations are
    calculated from ``c`` as given. Use the second case with care, as it can
    lead to garbage results.
    Nc3s|]}|�dVqdS)rWNr)rr3)�crrrsz_ss.<locals>.<genexpr>c3s|]}|�VqdS)Nr)rr3)r_rrrsrWr
z%negative sum of square deviations: %f)r
r0r%rG)r)r_r,r/r+�UZtotal2Zcount2r)r_r�_sssracCsLt|�|krt|�}t|�}|dkr,td��t||�\}}t||d|�S)a�Return the sample variance of data.

    data should be an iterable of Real-valued numbers, with at least two
    values. The optional argument xbar, if given, should be the mean of
    the data. If it is missing or None, the mean is automatically calculated.

    Use this function when your data is a sample from a population. To
    calculate the variance from the entire population, see ``pvariance``.

    Examples:

    >>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]
    >>> variance(data)
    1.3720238095238095

    If you have already calculated the mean of your data, you can pass it as
    the optional second argument ``xbar`` to avoid recalculating it:

    >>> m = mean(data)
    >>> variance(data, m)
    1.3720238095238095

    This function does not check that ``xbar`` is actually the mean of
    ``data``. Giving arbitrary values for ``xbar`` may lead to invalid or
    impossible results.

    Decimals and Fractions are supported:

    >>> from decimal import Decimal as D
    >>> variance([D("27.5"), D("30.25"), D("30.25"), D("34.5"), D("41.75")])
    Decimal('31.01875')

    >>> from fractions import Fraction as F
    >>> variance([F(1, 6), F(1, 2), F(5, 3)])
    Fraction(67, 108)

    rWz*variance requires at least two data pointsr)rDrSrGrrarA)r)�xbarrr,�ssrrrr"s&cCsHt|�|krt|�}t|�}|dkr,td��t||�\}}t|||�S)a�Return the population variance of ``data``.

    data should be an iterable of Real-valued numbers, with at least one
    value. The optional argument mu, if given, should be the mean of
    the data. If it is missing or None, the mean is automatically calculated.

    Use this function to calculate the variance from the entire population.
    To estimate the variance from a sample, the ``variance`` function is
    usually a better choice.

    Examples:

    >>> data = [0.0, 0.25, 0.25, 1.25, 1.5, 1.75, 2.75, 3.25]
    >>> pvariance(data)
    1.25

    If you have already calculated the mean of the data, you can pass it as
    the optional second argument to avoid recalculating it:

    >>> mu = mean(data)
    >>> pvariance(data, mu)
    1.25

    This function does not check that ``mu`` is actually the mean of ``data``.
    Giving arbitrary values for ``mu`` may lead to invalid or impossible
    results.

    Decimals and Fractions are supported:

    >>> from decimal import Decimal as D
    >>> pvariance([D("27.5"), D("30.25"), D("30.25"), D("34.5"), D("41.75")])
    Decimal('24.815')

    >>> from fractions import Fraction as F
    >>> pvariance([F(1, 4), F(5, 4), F(1, 2)])
    Fraction(13, 72)

    rz*pvariance requires at least one data point)rDrSrGrrarA)r)�murr,rcrrrrQs'cCs2t||�}y|j�Stk
r,tj|�SXdS)z�Return the square root of the sample variance.

    See ``variance`` for arguments and other details.

    >>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])
    1.0810874155219827

    N)r�sqrtr1r2)r)rb�varrrrr�s
	
cCs2t||�}y|j�Stk
r,tj|�SXdS)z�Return the square root of the population variance.

    See ``pvariance`` for arguments and other details.

    >>> pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])
    0.986893273527251

    N)rrer1r2)r)rdrfrrrr�s
	
)r
)rP)r)N)N)N)N)N)&�__doc__�__all__rBZdecimalr2rUZ	fractionsrr�	itertoolsrrZbisectrrr>rr0r$r rrArJrLrOrRr
rrrrr	rrarrrrrrrr�<module>MsD

: 

/
7*

/
0
rlcompleter.cpython-36.pyc000064400000013226150335715140011532 0ustar003


 \��@s�dZddlZddlZddlZdgZGdd�d�Zdd�ZyddlZWnek
r\dZ	Yn"Xej
e�j�ejdd	��d
Z	dS)a1Word completion for GNU readline.

The completer completes keywords, built-ins and globals in a selectable
namespace (which defaults to __main__); when completing NAME.NAME..., it
evaluates (!) the expression up to the last dot and completes its attributes.

It's very cool to do "import sys" type "sys.", hit the completion key (twice),
and see the list of names defined by the sys module!

Tip: to use the tab key as the completion key, call

    readline.parse_and_bind("tab: complete")

Notes:

- Exceptions raised by the completer function are *ignored* (and generally cause
  the completion to fail).  This is a feature -- since readline sets the tty
  device in raw (or cbreak) mode, printing a traceback wouldn't work well
  without some complicated hoopla to save, reset and restore the tty state.

- The evaluation of the NAME.NAME... form may cause arbitrary application
  defined code to be executed if an object with a __getattr__ hook is found.
  Since it is the responsibility of the application (or the user) to enable this
  feature, I consider this an acceptable risk.  More complicated expressions
  (e.g. function calls or indexing operations) are *not* evaluated.

- When the original stdin is not a tty device, GNU readline is never
  used, and this module (and the readline module) are silently inactive.

�N�	Completerc@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rNcCs8|rt|t�rtd��|dkr(d|_nd|_||_dS)a�Create a new completer for the command line.

        Completer([namespace]) -> completer instance.

        If unspecified, the default namespace where completions are performed
        is __main__ (technically, __main__.__dict__). Namespaces should be
        given as dictionaries.

        Completer instances should be used as the completion mechanism of
        readline via the set_completer() call:

        readline.set_completer(Completer(my_namespace).complete)
        znamespace must be a dictionaryN�r)�
isinstance�dict�	TypeError�use_main_ns�	namespace)�selfr�r
�#/usr/lib64/python3.6/rlcompleter.py�__init__'szCompleter.__init__cCs�|jrtj|_|j�sB|dkr>tr8tjd�tj�dSdSndS|dkrld|kr`|j	|�|_
n|j|�|_
y
|j
|Stk
r�dSXdS)z�Return the next possible completion for 'text'.

        This is called successively with state == 0, 1, 2, ... until it
        returns None.  The completion should begin with 'text'.

        r�	�N�.)
r�__main__�__dict__r�strip�_readline_available�readlineZinsert_textZ	redisplay�attr_matches�matches�global_matches�
IndexError)r	�text�stater
r
r�completeBs$

zCompleter.completecCst|�r|d}|S)N�()�callable)r	�val�wordr
r
r�_callable_postfixaszCompleter._callable_postfixc		Cs�ddl}g}dh}t|�}xT|jD]J}|d|�|kr"|j|�|dkrR|d}n|dkrb|d}|j|�q"Wx^|jtjgD]N}xH|j�D]<\}}|d|�|kr�||kr�|j|�|j|j	||��q�Wq~W|S)z�Compute matches when text is a simple name.

        Return a list of all keywords, built-in functions and names currently
        defined in self.namespace that match.

        rN�__builtins__�finally�try�:�False�None�True�break�continue�pass�else� >r"r#>r)r'r+r%r*r(r&)
�keyword�len�kwlist�add�appendr�builtinsr�itemsr )	r	rr-r�seen�nrZnspacerr
r
rrfs(


zCompleter.global_matchescCsnddl}|jd|�}|sgS|jdd�\}}yt||j�}Wntk
rPgSXtt|��}|jd�t	|d�r�|j
d�|jt|j
��g}t|�}	|dkr�d	}
n|d	kr�d
}
nd}
x�x~|D]v}|d|	�|ko�|
o�|d|	d�|
kr�d||f}yt||�}
Wntk
�rYnX|j|
|�}|j|�q�W|�sH|
�rJP|
d	k�rZd
}
q�d}
q�W|j�|S)a�Compute matches when text contains a dot.

        Assuming the text is of the form NAME.NAME....[NAME], and is
        evaluable in self.namespace, it will be evaluated and its attributes
        (as revealed by dir()) are used as possible completions.  (For class
        instances, class members are also considered.)

        WARNING: this can still invoke arbitrary C code, if an object
        with a __getattr__ hook is evaluated.

        rNz(\w+(\.\w+)*)\.(\w*)r�r!�	__class__r�_�__z%s.%s)�re�match�group�evalr�	Exception�set�dir�discard�hasattrr0�update�get_class_membersr7r.�getattrr r1�sort)r	rr:�m�expr�attrZ
thisobjectZwordsrr5Znoprefixrr;rr
r
rr�sN




zCompleter.attr_matches)N)�__name__�
__module__�__qualname__rrr rrr
r
r
rr&s

cCs2t|�}t|d�r.x|jD]}|t|�}qW|S)N�	__bases__)r@rBrMrD)�klassZret�baser
r
rrD�s

rDFcCs
tjd�S)N)r�
set_completerr
r
r
r�<lambda>�srQT)
�__doc__�atexitr2r�__all__rrDr�ImportErrorrrPr�registerr
r
r
r�<module>s
locale.cpython-36.pyc000064400000102377150335715140010447 0ustar003


 \�-�]@sdZddlZddlZddlZddlZddlZddlmZddl	Z	dddddd	d
ddd
dddddddddddddgZ
dd�Zdd�Zyddl
TWnLek
r�d Zd!Zd"ZdZd#Zd$Zd%Zd&ZeZd'd
�Z�d�d(d�ZYnXde�kr�eZde�kr�eZeZiZe	j e�d)d
��Zd*d+�Z!�d�d-d.�Z"d/d0�Z#ej$d1�Z%�d�d2d�Z&�d�d3d4�Z'�d�d5d�Z(�d�d7d�Z)d8d
�Zd9d:�Z*e+fd;d�Z,d<d�Z-d=d>�Z.eZ/d?d@�Z0dAdB�Z1dCd�Z2dDdE�Z3dFdG�Z4�d�dJd�Z5efdKd�Z6�d�dLd�ZefdMd	�Z7ej8j9dN��r�d�dOd�Z:n8ye;Wn"e<k
�r6�d�dPd�Z:YnX�d�dQd�Z:dRdRdSdTdTdUdVdWdXdYdSdZd[d\dSdSdSd]d^d_d`d\dadZdbdcd[dddedfdgdTdhdidUdjdkdldmdndodWdXdYdp�,Z=x2e>e=j?��D]"\Z@ZAe@jBdqdr�Z@e=jCe@eA��q�Wdsdsdsdtdudvdwdwdxdydzdzd{d|d}d~d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d~d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�dRd�dRdRd{d�dRdRd�d�d�d�d�d�d�d�d{d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d{d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d{d�d�d�d�d�d�d�d{d�d{dRd{d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d̐d�d�d�d�d�d�d�d�d�d�d�d�d�d	�d	�d
�dd��d�d
�d
�d
�d
�d
�d�d
�d�d�d�d�d�d�d�d�dd�d�d�d��d�d�d�dd͐d�d�d�d�d�d�d�d�d�d�d�d�d�dd�d�d��d�d�d �d �d �d!�d"�d#�d$�d%�d&�d&�d'�d(�d&�d&�d%�d%d{d�d{d�d{d�d)�d*�d)�d)�d+�d+�d+�d�d�d,�d-�d-�d-�d.�d.�d-�d-�d-�d-�d-�d/�d/�d/�d0�d/�d1�d2�d3�d3�d4�d5�d5�d6�d6�d6�d7�d6�d6�d8�d8�d9�d:�d;�d;�d<�d<�d=�d>�d?�d@�dA�dB�dC�dD�dD�dE�dE�dD�dB�dB�dF�dF�dG�dH�dI�dI�dJ�dK�dL�dM�dN�dN�dO�dP�dQ�dQ�dR�dR�dS�dT�dU�dU�dV�dV�dW�dW�dX�dYd�d��dZ�d[�d\�d]�d^�d_dǐd`d�dǐda�da�db�dc�db�db�db�db�dd�dd�de�de�dc�dc�da�df�df�dg�dh�di�di�dj�dk�dk�dl�dm�dn�do�dp�dq�dp�dr�dr�ds�ds�ds�dt�dudRdR�dv�dv�dw�dt�du�dt�dx�dy�dz�dz�dz�d{�d{�d|�dz�d}�d~�d~�d�d��d��d��d��d��d��d��d��d��d��d��d�d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d�d�d�d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d�d��d��d��d��d��d��d��d��d��d��dddddÐdÐdĐdĐdŐdƐdǐdȐdȐdɐdɐdʐdːd�d��d͐d�d��dϐdϐdАdѐd�d�d��dҐdҐdӐ�LZD�dԐdՐd֐dאdؐdِdڐdېdܐdݐdސdߐd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d��d��d��d��d��d��d��d��d��d��d��d�d�d�d�d�d�d�d�d�d	�d
�d�d�d
�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d �d!�d"�d#�d$�d%�d&�d'�d(�d)�d*�d+�d,�d-�d-�d.�d/�d0�d1�d2�d3�d4�d5�d6�d7�d8�d9�d:�d;�d<�d=�d>�d?�d@�dA�dB�dC�dD�dE�dF�dG�dH�dI�dJ�dK�dL�dM�dN�dO�dP�dQ�dR�dS�dT�dU�dV�dW�dX�dY�dZ�d[�d\�d]�d^�d_�d`�da�db�dc�dd�de�df�de�df�dg�dh�di�dj�dk�dl�dm�dl�dn�do�dp�dq�dr�ds�dt�du�dv�dw�dx�dy�dz�d{�d|�d}�d~�d�d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d���ZE�d��d��ZFyeWne<k
�
r�YnXe
jG�d��eH�d�k�reI�d��eI�eF�eI�eI�d��eI�e.�dS(�a�Locale support module.

The module provides low-level access to the C lib's locale APIs and adds high
level number formatting APIs as well as a locale aliasing engine to complement
these.

The aliasing engine includes support for many commonly used locale names and
maps them to values suitable for passing to the C lib's setlocale() function. It
also includes default encodings for all supported locale names.

�N)�str�	getlocale�getdefaultlocale�getpreferredencoding�Error�	setlocale�resetlocale�
localeconv�strcoll�strxfrmr�atof�atoi�format�
format_string�currency�	normalize�LC_CTYPE�
LC_COLLATE�LC_TIME�LC_MONETARY�
LC_NUMERIC�LC_ALL�CHAR_MAXcCs||k||kS)zZ strcoll(string,string) -> int.
        Compares two strings according to the locale.
    �)�a�brr�/usr/lib64/python3.6/locale.py�_strcoll!srcCs|S)z\ strxfrm(string) -> string.
        Returns a string that behaves for cmp locale-aware.
    r)�srrr�_strxfrm'sr)�*�������cCs,dgddddgddddddddddddd�S)zd localeconv() -> dict.
            Returns numeric and monetary locale-specific parameters.
        r!��.)�grouping�currency_symbol�n_sign_posn�
p_cs_precedes�
n_cs_precedes�mon_grouping�n_sep_by_space�
decimal_point�
negative_sign�
positive_sign�p_sep_by_space�int_curr_symbol�p_sign_posn�
thousands_sep�mon_thousands_sep�frac_digits�mon_decimal_point�int_frac_digitsrrrrrr	?s$cCs|dkrtd��dS)zd setlocale(integer,string=None) -> string.
            Activates/queries locale processing.
        Nr(�Cz*_locale emulation only supports "C" locale)Nr(r<)r)�category�valuerrrrWscCst�}tr|jt�|S)N)�_localeconv�_override_localeconv�update)�drrrr	ls
ccsPd}xF|D]>}|tkrdS|dkr>|dkr2td��x
|Vq4W|V|}q
WdS)Nrzinvalid grouping)r�
ValueError)r*Z
last_interval�intervalrrr�_grouping_intervalszs

rEFc
Cs�t�}||rdpd}||r dp"d}|s2|dfS|d
dkr\|j�}|t|�d�}|}nd}d}g}xNt|�D]B}	|s�|dd	kr�|}d}P|j||	d��|d|	�}qrW|r�|j|�|j�||j|�|t|�t|�dfS)Nr8r7r/r*rr&� r(�
0123456789���rH)r	�rstrip�lenrE�append�reverse�join)
r�monetary�convr7r*�strippedZright_spacesZleft_spaces�groupsrDrrr�_group�s0
rRcCsld}x$|r(||dkr(|d7}|d8}qWt|�d}x$|rZ||dkrZ|d8}|d8}q8W|||d�S)NrrFr&)rJ)rZamountZlposZrposrrr�_strip_padding�srSzG%(?:\((?P<key>.*?)\))?(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]cGsHtj|�}|s$t|j��t|�kr4tdt|���t||||f|��S)z�Returns the locale-aware substitution of a %? specifier
    (percent).

    additional is for format strings which contain one or more
    '*' modifiers.zHformat() must be given exactly one %%char format specifier, %s not valid)�_percent_re�matchrJ�grouprC�repr�_format)�percentr>r*rN�
additionalrUrrrr�s

c	Gs�|r||f|}n||}|d	dkr~d}|jd�}|rRt|d|d�\|d<}t�|r^dp`d}|j|�}|r�t||�}n2|d
dkr�d}|r�t||d�\}}|r�t||�}|S)Nr&ZeEfFgGrr))rNr:r1ZdiurHrH)�splitrRr	rMrS)	rYr>r*rNrZZ	formattedZseps�partsr1rrrrX�s(


rXc	Csttj|��}tjd|�}t|tj�rlg}x�|D]6}|j�ddkrP|jd�q0|jt	|j�||��q0Wn�t|t
�s||f}g}d}xz|D]r}|j�d	dkr�|jd�q�|jd�jd�}|jt|j�|||df||d|d|����|d|7}q�Wt
|�}||S)
z�Formats a string in the same way that the % formatting would use,
    but takes the current locale into account.
    Grouping is applied if the third parameter is true.z%sr&�%rZ	modifiersr FrHrH)
�listrT�finditer�sub�
isinstance�collections�MappingrVrKr�tuple�countrX)	�f�valr*ZpercentsZnew_fZnew_valZperc�iZ	starcountrrrr�s0


TcCsft�}||rdpd}|dkr&td��td|t|�|dd�}d|d	}|r�||rXd
pZd}||dkrld
pnd}||dkr�dp�d}	|r�||	r�dp�d|}n||	r�dp�d|}||dkr�dp�d}
||dkr�dp�d}|
dkr�d|d}n`|
dk�r||}nL|
dk�r||}n8|
dk�r2|jd|�}n |
dk�rJ|jd	|�}n||}|jdd�jd	d�S)zIFormats val according to the currency settings
    in the current locale.r;r9r!z9Currency formatting is not possible using the 'C' locale.z%%.%ifT)rN�<�>r5r+rr.r-r0r4rFr(r,r6r2r3�(�)r&r'r#r%)r	rCr�abs�replace)rgZsymbolr*Z
internationalrOZdigitsrZsmbZprecedesZ	separatedZsign_posZsignrrrr�s6





cCs
td|�S)z8Convert float to string, taking the locale into account.z%.12g)r)rgrrrr+scCs:t�}|d}|r|j|d�}|d}|r6|j|d�}|S)zHParses a string as a normalized number according to the locale settings.r7r(r1r))r	rn)�stringrO�tsZddrrr�
delocalize/srqcCs|t|��S)z<Parses a string as a float according to the locale settings.)rq)ro�funcrrrr?scCstt|��S)zAConverts a string to an integer according to the locale settings.)�intrq)rorrrr
CscCsBttd�tddd�}t|dt|��td�}t|dt|��dS)Nr(z%di�[r&�isg��Q�	@)rrr�printr
rr)�s1rrr�_testGs

rwcCs�d|kr|d|jd��}n|}tj|�}tjjj|j�|�}|}|j�}|tkr\t|}n(|jdd�}|jdd�}|tkr�t|}|d|S)Nr)�_r(�-)�index�	encodings�normalize_encoding�aliases�get�lower�locale_encoding_aliasrn)�code�encoding�langname�
norm_encodingrrr�_replace_encodingYs

r�cCsR|dkrFd|kr|dS|jd�\}}}|dkr4|S|dkrFt|d�S|d|S)	N�euror)z.ISO8859-15�
ISO8859-15�UTF-8z	ISO8859-1�@)r�r�)�	partitionr�)r��modifierrxr�rrr�_append_modifierps
r�c	Cs�|j�}d|kr|jdd�}d|kr6|jdd�\}}nd}d|krZ|jd�dd�\}}n|}d}|}|r�|jdd�}|jd	d�}|d|7}|}|r�|d|7}tj|d�}|dk	r�|S|�rtj|d�}|dk	�rd|kr�t||�S|jdd�dj�|k�r|S|�r�|}|�r"|d|7}tj|d�}|dk	�rnd|k�rLt||�S|jdd�\}}t||�d|S|�r�tj|d�}|dk	�r�d|k�r�t||�}t||�S|jdd�\}}|j�|k�r�t||�d|S|S)
a� Returns a normalized locale code for the given locale
        name.

        The returned locale code is formatted for use with
        setlocale().

        If normalization fails, the original name is returned
        unchanged.

        If the given encoding is not known, the function defaults to
        the default encoding for the locale code just like setlocale()
        does.

    �:r)r�r&r(Nr'ryrx)rrnr[�locale_aliasr~r�r�)	�
localenamer�r�r�r�Zlang_encr�Zlookup_nameZdefmodrrrr{s`








cCsrt|�}d|kr8|jdd�\}}|dkr8d|kr8|dfSd|krVt|jd�dd��S|dkrbd
Std	|��dS)a� Parses the locale code for localename and returns the
        result as tuple (language code, encoding).

        The localename is normalized and passed through the locale
        alias engine. A ValueError is raised in case the locale name
        cannot be parsed.

        The language code corresponds to RFC 1766.  code and encoding
        can be None in case the values cannot be determined or are
        unknown to this implementation.

    r�r&r�r)ziso-8859-15Nr'r<zunknown locale: %s)NN)rr[rdrC)r�r�r�rrr�_parse_localename�sr�cCsVy0|\}}|dkrd}|dkr"|S|d|SWn ttfk
rPtd��YnXdS)z� Builds a locale code from the given tuple (language code,
        encoding).

        No aliasing or normalizing takes place.

    Nr<r)zXLocale must be None, a string, or an iterable of two strings -- language code, encoding.)�	TypeErrorrC)ZlocaletupleZlanguager�rrr�_build_localename�sr��LANG�LANGUAGEcCs�yddl}|j�\}}Wnttfk
r0Yn8Xtjdkr`|r`|dd�dkr`tjt|d��}||fSddl	}|j
j}x6|D]*}||d�}|r~|dkr�|jd�d}Pq~Wd}t|�S)	a� Tries to determine the default locale settings and returns
        them as tuple (language code, encoding).

        According to POSIX, a program which has not called
        setlocale(LC_ALL, "") runs using the portable 'C' locale.
        Calling setlocale(LC_ALL, "") lets it use the default locale as
        defined by the LANG variable. Since we don't want to interfere
        with the current locale setting we thus emulate the behavior
        in the way described above.

        To maintain compatibility with other platforms, not only the
        LANG variable is tested, but a list of variables given as
        envvars parameter. The first found to be defined will be
        used. envvars defaults to the search path used in GNU gettext;
        it must always contain the variable name 'LANG'.

        Except for the code 'C', the language code corresponds to RFC
        1766.  code and encoding can be None in case the values cannot
        be determined.

    rNZwin32r'Z0xr�r�r<)
�_localeZ_getdefaultlocale�ImportError�AttributeError�sys�platform�windows_localer~rs�os�environr[r�)Zenvvarsr�r�r�r��lookupZvariabler�rrrrs$

cCs(t|�}|tkr d|kr td��t|�S)ap Returns the current setting for the given locale category as
        tuple (language code, encoding).

        category may be one of the LC_* value except LC_ALL. It
        defaults to LC_CTYPE.

        Except for the code 'C', the language code corresponds to RFC
        1766.  code and encoding can be None in case the values cannot
        be determined.

    �;z category LC_ALL is not supported)�
_setlocalerr�r�)r=r�rrrr5s
cCs&|rt|t�rtt|��}t||�S)a^ Set the locale for the given category.  The locale can be
        a string, an iterable of two strings (language code and encoding),
        or None.

        Iterables are converted to strings using the locale aliasing
        engine.  Locale strings are passed directly to the C lib.

        category may be given as one of the LC_* values.

    )ra�_builtin_strrr�r�)r=ZlocalerrrrGscCst|tt���dS)z� Sets the locale for category to the default setting.

        The default setting is determined by calling
        getdefaultlocale(). category defaults to LC_ALL.

    N)r�r�r)r=rrrrXs�wincCsddl}|jd�S)z1Return the charset that the user is likely using.rNF)�_bootlocaler)�do_setlocaler�rrrrdscCst�d}|dkrd}|S)zbReturn the charset that the user is likely using,
            by looking at environment variables.r&N�ascii)r)r��resrrrrns
cCsTddl}|r8tt�}yttd�Wntk
r6YnX|jd�}|rPtt|�|S)zdReturn the charset that the user is likely using,
            according to the system configuration.rNr(F)r�rrrr)r�r�Zoldloc�resultrrrrws

r<z	ISO8859-1ZJIS7ZeucJPzKOI8-CZCP1251ZCP1255ZCP1256z	ISO8859-2z	ISO8859-5z
ISO8859-15z
ISO8859-10z
ISO8859-11z
ISO8859-13z
ISO8859-14z
ISO8859-16z	ISO8859-3z	ISO8859-4z	ISO8859-6z	ISO8859-7z	ISO8859-8z	ISO8859-9ZSJISZTACTISZeucKRzUTF-8zKOI8-RzKOI8-TzKOI8-UZRK1048),�437�c�enZjisZjis7ZajecZkoi8cZmicrosoftcp1251Zmicrosoftcp1255Zmicrosoftcp1256Z88591Z88592Z88595Z885915r��latin_1�	iso8859_1�
iso8859_10�
iso8859_11�
iso8859_13�
iso8859_14�
iso8859_15�
iso8859_16�	iso8859_2�	iso8859_3�	iso8859_4�	iso8859_5�	iso8859_6�	iso8859_7�	iso8859_8�	iso8859_9�
iso2022_jp�	shift_jis�tactis�euc_jp�euc_kr�utf_8�koi8_rZkoi8_tZkoi8_u�kz1048�cp1251�cp1255�cp1256rxr(zaz_AZ.KOI8-Czaa_DJ.ISO8859-1zaa_ER.UTF-8zaa_ET.UTF-8zaf_ZA.ISO8859-1zagr_PE.UTF-8zak_GH.UTF-8zam_ET.UTF-8zen_US.ISO8859-1zan_ES.ISO8859-15zanp_IN.UTF-8zar_AA.ISO8859-6zar_AE.ISO8859-6zar_BH.ISO8859-6zar_DZ.ISO8859-6zar_EG.ISO8859-6zar_IN.UTF-8zar_IQ.ISO8859-6zar_JO.ISO8859-6zar_KW.ISO8859-6zar_LB.ISO8859-6zar_LY.ISO8859-6zar_MA.ISO8859-6zar_OM.ISO8859-6zar_QA.ISO8859-6zar_SA.ISO8859-6zar_SD.ISO8859-6zar_SS.UTF-8zar_SY.ISO8859-6zar_TN.ISO8859-6zar_YE.ISO8859-6zas_IN.UTF-8zast_ES.ISO8859-15zayc_PE.UTF-8zaz_AZ.ISO8859-9Ezaz_IR.UTF-8zbe_BY.CP1251zbe_BY.UTF-8@latinzbg_BG.UTF-8zbem_ZM.UTF-8zber_DZ.UTF-8zber_MA.UTF-8zbg_BG.CP1251zbhb_IN.UTF-8zbho_IN.UTF-8zbho_NP.UTF-8zbi_VU.UTF-8zbn_BD.UTF-8zbn_IN.UTF-8zbo_CN.UTF-8zbo_IN.UTF-8znb_NO.ISO8859-1zbr_FR.ISO8859-1zbrx_IN.UTF-8zbs_BA.ISO8859-2zbyn_ER.UTF-8zfr_CA.ISO8859-1zen_US.UTF-8zca_ES.ISO8859-1zca_AD.ISO8859-1zca_ES.UTF-8@valenciazca_FR.ISO8859-1zca_IT.ISO8859-1zce_RU.UTF-8zzh_CN.eucCNzzh_TW.eucTWzchr_US.UTF-8zckb_IQ.UTF-8zcmn_TW.UTF-8zcrh_UA.UTF-8zhr_HR.ISO8859-2zcs_CZ.ISO8859-2zcsb_PL.UTF-8zcv_RU.UTF-8zcy_GB.ISO8859-1zda_DK.ISO8859-1zde_DE.ISO8859-1zde_AT.ISO8859-1zde_BE.ISO8859-1zde_CH.ISO8859-1zde_IT.ISO8859-1zde_LI.UTF-8zde_LU.ISO8859-1zdoi_IN.UTF-8znl_NL.ISO8859-1znl_BE.ISO8859-1zdv_MV.UTF-8zdz_BT.UTF-8zee_EE.ISO8859-4zet_EE.ISO8859-1zel_GR.ISO8859-7zel_CY.ISO8859-7zel_GR.ISO8859-15zen_AG.UTF-8zen_AU.ISO8859-1zen_BE.ISO8859-1zen_BW.ISO8859-1zen_CA.ISO8859-1zen_DK.ISO8859-1zen_DL.UTF-8zen_GB.ISO8859-1zen_HK.ISO8859-1zen_IE.ISO8859-1zen_IL.UTF-8zen_IN.ISO8859-1zen_NG.UTF-8zen_NZ.ISO8859-1zen_PH.ISO8859-1zen_SC.UTF-8zen_SG.ISO8859-1zen_US.ISO8859-15zen_ZA.ISO8859-1zen_ZM.UTF-8zen_ZW.ISO8859-1zen_ZS.UTF-8zen_EN.ISO8859-1zeo_XX.ISO8859-3zeo.UTF-8zeo_EO.ISO8859-3zeo_US.UTF-8zes_ES.ISO8859-1zes_AR.ISO8859-1zes_BO.ISO8859-1zes_CL.ISO8859-1zes_CO.ISO8859-1zes_CR.ISO8859-1zes_CU.UTF-8zes_DO.ISO8859-1zes_EC.ISO8859-1zes_GT.ISO8859-1zes_HN.ISO8859-1zes_MX.ISO8859-1zes_NI.ISO8859-1zes_PA.ISO8859-1zes_PE.ISO8859-1zes_PR.ISO8859-1zes_PY.ISO8859-1zes_SV.ISO8859-1zes_US.ISO8859-1zes_UY.ISO8859-1zes_VE.ISO8859-1zet_EE.ISO8859-15zeu_ES.ISO8859-1zeu_FR.ISO8859-1zfa_IR.UTF-8zfa_IR.ISIRI-3342zff_SN.UTF-8zfi_FI.ISO8859-15zfil_PH.UTF-8zfi_FI.ISO8859-1zfo_FO.ISO8859-1zfr_FR.ISO8859-1zfr_BE.ISO8859-1zfr_CH.ISO8859-1zfr_LU.ISO8859-1zfur_IT.UTF-8zfy_DE.UTF-8zfy_NL.UTF-8zga_IE.ISO8859-1zgl_ES.ISO8859-1zgd_GB.ISO8859-1zgez_ER.UTF-8zgez_ET.UTF-8zgu_IN.UTF-8zgv_GB.ISO8859-1zha_NG.UTF-8zhak_TW.UTF-8zhe_IL.ISO8859-8zhi_IN.ISCII-DEVzhif_FJ.UTF-8zhne_IN.UTF-8zhsb_DE.ISO8859-2zht_HT.UTF-8zhu_HU.ISO8859-2zhy_AM.UTF-8zhy_AM.ARMSCII_8zia.UTF-8zia_FR.UTF-8zis_IS.ISO8859-1zid_ID.ISO8859-1zig_NG.UTF-8zik_CA.UTF-8zit_IT.ISO8859-1zit_CH.ISO8859-1ziu_CA.NUNACOM-8ziw_IL.UTF-8zja_JP.eucJPz
ja_JP.SJISzka_GE.GEORGIAN-ACADEMYzka_GE.GEORGIAN-PSzkab_DZ.UTF-8z
kk_KZ.ptcp154zkl_GL.ISO8859-1zkm_KH.UTF-8zkn_IN.UTF-8zko_KR.eucKRzkok_IN.UTF-8zks_IN.UTF-8zks_IN.UTF-8@devanagarizku_TR.ISO8859-9zkw_GB.ISO8859-1zky_KG.UTF-8zlb_LU.UTF-8zlg_UG.ISO8859-10zli_BE.UTF-8zli_NL.UTF-8zlij_IT.UTF-8zlt_LT.ISO8859-13zln_CD.UTF-8zlo_LA.MULELAO-1zlo_LA.IBM-CP1133zlv_LV.ISO8859-13zlzh_TW.UTF-8zmag_IN.UTF-8zmai_IN.UTF-8zmai_NP.UTF-8zmfe_MU.UTF-8zmg_MG.ISO8859-15zmhr_RU.UTF-8zmi_NZ.ISO8859-1zmiq_NI.UTF-8zmjw_IN.UTF-8zmk_MK.ISO8859-5zml_IN.UTF-8zmn_MN.UTF-8zmni_IN.UTF-8zmr_IN.UTF-8zms_MY.ISO8859-1zmt_MT.ISO8859-3zmy_MM.UTF-8znan_TW.UTF-8znds_DE.UTF-8znds_NL.UTF-8zne_NP.UTF-8znhn_MX.UTF-8zniu_NU.UTF-8zniu_NZ.UTF-8znl_AW.UTF-8znn_NO.ISO8859-1zno_NO.ISO8859-1zny_NO.ISO8859-1znr_ZA.ISO8859-1znso_ZA.ISO8859-15zoc_FR.ISO8859-1zom_ET.UTF-8zom_KE.ISO8859-1zor_IN.UTF-8zos_RU.UTF-8zpa_IN.UTF-8zpa_PK.UTF-8zpap_AN.UTF-8zpap_AW.UTF-8zpap_CW.UTF-8zpd_US.ISO8859-1zpd_DE.ISO8859-1zph_PH.ISO8859-1zpl_PL.ISO8859-2zpt_PT.ISO8859-1zpt_BR.ISO8859-1zpp_AN.ISO8859-1zps_AF.UTF-8zquz_PE.UTF-8zraj_IN.UTF-8zro_RO.ISO8859-2zru_RU.UTF-8zru_UA.KOI8-Uzru_RU.KOI8-Rzrw_RW.ISO8859-1zsa_IN.UTF-8zsat_IN.UTF-8zsc_IT.UTF-8zsd_IN.UTF-8zsd_IN.UTF-8@devanagarizsd_PK.UTF-8zse_NO.UTF-8zsr_RS.UTF-8@latinzsgs_LT.UTF-8zsr_CS.ISO8859-2zsh_HR.ISO8859-2zshn_MM.UTF-8zshs_CA.UTF-8zsi_LK.UTF-8zsid_ET.UTF-8zsk_SK.ISO8859-2zsl_SI.ISO8859-2zsl_CS.ISO8859-2zsm_WS.UTF-8zso_DJ.ISO8859-1zso_ET.UTF-8zso_KE.ISO8859-1zso_SO.ISO8859-1zsr_CS.ISO8859-5zsq_AL.ISO8859-2zsq_MK.UTF-8zsr_RS.UTF-8zsr_CS.UTF-8@latinzsr_CS.UTF-8zsr_ME.UTF-8zsr_CS.CP1251zss_ZA.ISO8859-1zst_ZA.ISO8859-1zsv_SE.ISO8859-1zsv_FI.ISO8859-1zsw_KE.UTF-8zsw_TZ.UTF-8zszl_PL.UTF-8z
ta_IN.TSCII-0zta_LK.UTF-8ztcy_IN.UTF-8zte_IN.UTF-8ztg_TJ.KOI8-Czth_TH.ISO8859-11zth_TH.TIS620zthe_NP.UTF-8zti_ER.UTF-8zti_ET.UTF-8ztig_ER.UTF-8ztk_TM.UTF-8ztl_PH.ISO8859-1ztn_ZA.ISO8859-15zto_TO.UTF-8ztpi_PG.UTF-8ztr_TR.ISO8859-9ztr_CY.ISO8859-9zts_ZA.ISO8859-1ztt_RU.TATAR-CYRztt_RU.UTF-8@iqtelifzug_CN.UTF-8zuk_UA.KOI8-Uz	en_US.utfzunm_US.UTF-8zur_PK.CP1256zur_IN.UTF-8zuz_UZ.UTF-8zve_ZA.UTF-8z
vi_VN.TCVNzvi_VN.VISCIIzwa_BE.ISO8859-1zwae_CH.UTF-8zwal_ET.UTF-8zwo_SN.UTF-8zxh_ZA.ISO8859-1zyi_US.CP1255zyo_NG.UTF-8zyue_HK.UTF-8zyuw_PG.UTF-8zzh_CN.gb2312z
zh_TW.big5zzh_HK.big5hkscszzh_SG.GB2312z	zh_SG.GBKzzu_ZA.ISO8859-1(LZa3Za3_azz
a3_az.koicZaa_djZaa_erZaa_etZafZaf_zaZagr_peZak_ghZamZam_etZamericanZan_esZanp_in�arZar_aaZar_aeZar_bhZar_dzZar_egZar_inZar_iqZar_joZar_kwZar_lbZar_lyZar_maZar_omZar_qaZar_saZar_sdZar_ssZar_syZar_tnZar_ye�arabic�asZas_inZast_esZayc_peZazZaz_azzaz_az.iso88599eZaz_irZbezbe@latinz
be_bg.utf8Zbe_byzbe_by@latinZbem_zmZber_dzZber_maZbgZbg_bgzbhb_in.utf8Zbho_inZbho_npZbi_vuZbn_bdZbn_inZbo_cnZbo_inZbokmalubokmål�brZbr_frZbrx_inZbsZbs_baZ	bulgarianZbyn_err�zc-frenchzc.asciizc.enz
c.iso88591zc.utf8Zc_czc_c.cZcaZca_adZca_eszca_es@valenciaZca_frZca_itZcatalanZce_ruZcextendz	chinese-sz	chinese-tZchr_usZckb_iqZcmn_twZcrh_uaZcroatianZcsZcs_csZcs_czZcsb_plZcv_ruZcyZcy_gbZczZcz_czZczechZdaZda_dkZdanishZdanskZdeZde_atZde_beZde_chZde_deZde_itz
de_li.utf8Zde_luZdeutschZdoi_inZdutchzdutch.iso88591Zdv_mvZdz_btZeeZee_eeZeestiZelZel_cyZel_grz
el_gr@euror�Zen_agZen_auZen_beZen_bwZen_caZen_dkz
en_dl.utf8Zen_gbZen_hkZen_ieZen_ilZen_inZen_ngZen_nzZen_phz
en_sc.utf8Zen_sgZen_ukZen_uszen_us@euro@euroZen_zaZen_zmZen_zwz
en_zw.utf8Zeng_gbZenglishzenglish.iso88591Z
english_ukzenglish_united-stateszenglish_united-states.437Z
english_usZeozeo.utf8Zeo_eoz
eo_us.utf8Zeo_xxZesZes_arZes_boZes_clZes_coZes_crZes_cuZes_doZes_ecZes_esZes_gtZes_hnZes_mxZes_niZes_paZes_peZes_prZes_pyZes_svZes_usZes_uyZes_veZestonianZetZet_eeZeuZeu_esZeu_frZfaZfa_irzfa_ir.isiri3342Zff_snZfiZfi_fiZfil_phZfinnishZfoZfo_fo�frZfr_beZfr_caZfr_chZfr_frZfr_luu	françaisZfre_frZfrenchzfrench.iso88591Z
french_franceZfur_itZfy_deZfy_nlZgaZga_ieZgalegoZgalicianZgdZgd_gbZger_deZgermanzgerman.iso88591Zgerman_germanyZgez_erZgez_etZglZgl_es�greekZgu_inZgvZgv_gbZha_ngZhak_twZheZhe_il�hebrew�hiZhi_inzhi_in.isciidevZhif_fjZhneZhne_inZhrZhr_hrZhrvatskiZhsb_deZht_htZhuZhu_huZ	hungarianZhy_amzhy_am.armscii8ZiaZia_frZ	icelandic�idZid_idZig_ngZik_ca�inZin_idrtZis_isz
iso-8859-1ziso-8859-15z	iso8859-1z
iso8859-15�
iso_8859_1�iso_8859_15�itZit_chZit_itZitalianZiuZiu_caziu_ca.nunacom8ZiwZiw_ilz
iw_il.utf8ZjaZja_jpz	ja_jp.euczja_jp.mscodez	ja_jp.pckZjapanZjapanesezjapanese-euczjapanese.eucZjp_jpZkaZka_gezka_ge.georgianacademyzka_ge.georgianpszka_ge.georgianrsZkab_dzZkk_kzZklZkl_glZkm_khZknZkn_inZkoZko_krz	ko_kr.eucZkok_in�koreanz
korean.eucZksZks_inzks_in@devanagari.utf8Zku_tr�kwZkw_gbZkyZky_kgZlb_luZlg_ugZli_beZli_nlZlij_itZ
lithuanianZln_cd�loZlo_lazlo_la.cp1133zlo_la.ibmcp1133zlo_la.mulelao1�ltZlt_ltZlvZlv_lvZlzh_twZmag_inZmaiZmai_inZmai_npZmfe_muZmg_mgZmhr_ruZmiZmi_nzZmiq_niZmjw_inZmkZmk_mkZmlZml_inZmn_mnZmni_inZmrZmr_inZmsZms_myZmtZmt_mtZmy_mmZnan_twZnbZnb_noZnds_deZnds_nlZne_npZnhn_mxZniu_nuZniu_nz�nlZnl_awZnl_beZnl_nlZnnZnn_no�noz
no@nynorskZno_nozno_no.iso88591@bokmalzno_no.iso88591@nynorskZ	norwegianZnrZnr_zaZnsoZnso_zaZnyZny_noZnynorskZocZoc_frZom_etZom_ke�orZor_inZos_ruZpaZpa_inZpa_pkZpap_anZpap_awZpap_cwZpdZpd_deZpd_usZphZph_phZplZpl_plZpolishZ
portugueseZportuguese_brazil�posixz
posix-utf2ZppZpp_anZps_afZptZpt_brZpt_ptZquz_peZraj_inZroZro_roZromanianZruZru_ruZru_uaZrumanianZrussianZrwZrw_rwZsa_inZsat_inZsc_itZsdZsd_inzsd_in@devanagari.utf8Zsd_pkZse_noZ
serbocroatianZsgs_ltZshzsh_ba.iso88592@bosniaZsh_hrzsh_hr.iso88592Zsh_spZsh_yuZshn_mmZshs_caZsiZsi_lkZsid_etZsinhalaZskZsk_skZslZsl_csZsl_siZslovakZsloveneZ	slovenianZsm_wsZso_djZso_etZso_keZso_soZspZsp_yuZspanishZ
spanish_spainZsqZsq_alZsq_mk�srzsr@cyrilliczsr@latnZsr_cszsr_cs.iso88592@latnz
sr_cs@latnZsr_meZsr_rsz
sr_rs@latnZsr_spZsr_yuzsr_yu.cp1251@cyrilliczsr_yu.iso88592zsr_yu.iso88595zsr_yu.iso88595@cyrilliczsr_yu.microsoftcp1251@cyrillicz
sr_yu.utf8zsr_yu.utf8@cyrilliczsr_yu@cyrillicZssZss_za�stZst_zaZsvZsv_fiZsv_seZsw_keZsw_tzZswedishZszl_plZtaZta_inzta_in.tsciizta_in.tscii0Zta_lkztcy_in.utf8ZteZte_inZtgZtg_tjZthZth_thzth_th.tactiszth_th.tis620�thaiZthe_npZti_erZti_etZtig_erZtk_tmZtlZtl_phZtnZtn_zaZto_toZtpi_pgZtrZtr_cyZtr_trrpZts_zaZttZtt_ruztt_ru.tatarcyrz
tt_ru@iqtelifZturkishZug_cnZukZuk_uaZunivZ	universalzuniversal.utf8@ucs4Zunm_usZurZur_inZur_pkZuzZuz_uzzuz_uz@cyrillicZveZve_zaZviZvi_vnz
vi_vn.tcvnzvi_vn.tcvn5712zvi_vn.visciizvi_vn.viscii111ZwaZwa_beZwae_chZwal_etZwo_snZxhZxh_zaZyiZyi_usZyo_ngZyue_hkZyuw_pgZzhZzh_cnz
zh_cn.big5z	zh_cn.eucZzh_hkzzh_hk.big5hkZzh_sgz	zh_sg.gbkZzh_twz	zh_tw.euczzh_tw.euctwZzuZzu_zaZaf_ZAZsq_ALZgsw_FRZam_ETZar_SAZar_IQZar_EGZar_LYZar_DZZar_MAZar_TNZar_OMZar_YEZar_SYZar_JOZar_LBZar_KWZar_AEZar_BHZar_QAZhy_AMZas_INZaz_AZZba_RUZeu_ESZbe_BYZbn_INZbs_BAZbr_FRZbg_BGZca_ESZzh_CHSZzh_TWZzh_CNZzh_HKZzh_SGZzh_MOZzh_CHTZco_FRZhr_HRZhr_BAZcs_CZZda_DKZgbz_AFZdiv_MVZnl_NLZnl_BEZen_USZen_GBZen_AUZen_CAZen_NZZen_IEZen_ZAZen_JAZen_CBZen_BZZen_TTZen_ZWZen_PHZen_INZen_MYZet_EEZfo_FOZfil_PHZfi_FIZfr_FRZfr_BEZfr_CAZfr_CHZfr_LUZfr_MCZfy_NLZgl_ESZka_GEZde_DEZde_CHZde_ATZde_LUZde_LIZel_GRZkl_GLZgu_INZha_NGZhe_ILZhi_INZhu_HUZis_ISZid_IDZiu_CAZga_IEZit_ITZit_CHZja_JPZkn_INZkk_KZZkh_KHZqut_GTZrw_RWZkok_INZko_KRZky_KGZlo_LAZlv_LVZlt_LTZdsb_DEZlb_LUZmk_MKZms_MYZms_BNZml_INZmt_MTZmi_NZZarn_CLZmr_INZmoh_CAZmn_MNZmn_CNZne_NPZnb_NOZnn_NOZoc_FRZor_INZps_AFZfa_IRZpl_PLZpt_BRZpt_PTZpa_INZquz_BOZquz_ECZquz_PEZro_ROZrm_CHZru_RUZsmn_FIZsmj_NOZsmj_SEZse_NOZse_SEZse_FIZsms_FIZsma_NOZsma_SEZsa_INZsr_SPZsr_BAZsi_LKZns_ZAZtn_ZAZsk_SKZsl_SIZes_ESZes_MXZes_GTZes_CRZes_PAZes_DOZes_VEZes_COZes_PEZes_ARZes_ECZes_CLZes_URZes_PYZes_BOZes_SVZes_HNZes_NIZes_PRZes_USZsw_KEZsv_SEZsv_FIZsyr_SYZtg_TJZtmz_DZZta_INZtt_RUZte_INZth_THZbo_BTZbo_CNZtr_TRZtk_TMZug_CNZuk_UAZwen_DEZur_PKZur_INZuz_UZZvi_VNZcy_GBZwo_SNZxh_ZAZsah_RUZii_CNZyo_NGZzu_ZA)�i6ii�i^iiiiiiii i$i(i,i0i4i8i<i@i+iMi,i,imi-i#iEi ii~iir%iiiiii|i�iiiii�ieiii	i	i	i	i	i	i	i	 i	$i	(i	,i	0i	4i	@i	Di	Hi%i8idiiiiiiiibiVi7iiiiiiioiGihi
i9iii!i]i]i<iiiiKi?iSi�i�iWii@iTi&i'i.ini/i>i>iLi:i�iziNi|iPiPiaiii�iHici)iiiiFikikikiiii;$i;i;i;i;i;i; i;i;iOiiiii[ili2ii$i
i
i
i
i
i
i
i
 i
$i
(i
,i
0i
4i
8i
<i
@i
Di
Hi
Li
Pi
TiAiiiZi(i_iIiDiJiiQiQiiBi�i"i.i i iCiCi*iRi�i4i�ixiji5c
Cs�i}|fdd�}|�|d=td�tdd�t�\}}td|pDd�td	|pRd�t�td
�tdd�xL|j�D]@\}}t|d�t|�\}}td|p�d�td
|p�d�t�qzWt�td�tdd�t�xP|j�D]D\}}t|d�t|�\}}td|�pd�td
|�p"d�t�q�Wyttd�Wn$td�td�td�YnpXt�td�tdd�xR|j�D]F\}}t|d�t|�\}}td|�p�d�td
|�p�d�t��q�WdS)z Test function.
    cSs4x.t�j�D] \}}|dd�dkr|||<qWdS)Nr#ZLC_)�globals�items)�
categories�k�vrrr�_init_categories�sz'_print_locale.<locals>._init_categoriesrz4Locale defaults as determined by getdefaultlocale():ry�Hz
Language: z(undefined)z
Encoding: zLocale settings on startup:z...z
   Language: z
   Encoding: z,Locale settings after calling resetlocale():r(zNOTE:z9setlocale(LC_ALL, "") does not support the default localez&given in the OS environment variables.z4Locale settings after calling setlocale(LC_ALL, ""):N)rurr�rrrr)r�r�Zlang�enc�namer=rrr�
_print_locale{sV





r��LC_MESSAGES�__main__zLocale aliasing:zNumber formatting:)N)F)FF)FF)F)TFF�rrr�r�)r�)N)T)T)T)J�__doc__r�r{Zencodings.aliases�rerb�builtinsrr��	functools�__all__rrr�r�rrrrr�rrrrCrr	rr�rr
r?r@�wrapsrErRrS�compilerTrrXrrrq�floatrr
rwr�r�r�rr�r�rrrr��
startswithr�CODESET�	NameErrorr��sortedr�r�r�rn�
setdefaultr�r�r�rK�__name__rurrrr�<module>s4


	



"-S5
	"}:

types.cpython-36.pyc000064400000020013150335715140010336 0ustar003


 \�"�@s�dZddlZdd�Zee�Zedd��Zeej�Zeej�Z	eej
�Zdd�Zee��Z
d	d
�Ze�Zee�Zej�dd�Ze�Zee�ZGd
d�d�Zee�j�Zee�Zegj�Zee�Zye�Wn:ek
�rej�dZee�Zeej�Z dZ[YnXeej�Z!eej"�Z#[[[[[fddfdd�Z$fdfdd�Z%dd�Z&Gdd�d�Z'ddl(Z)ddl*j+Z,Gdd�d�Z-dd�Z.dd�e/�D�Z0dS)zO
Define names for built-in types that aren't directly accessible as a builtin.
�NcCsdS)N�rrr�/usr/lib64/python3.6/types.py�_fsrcCsdS)Nrrrrr�<lambda>
srccs
dVdS)N�rrrrr�_gsrc�sdS)Nrrrrr�_csrcCs
dVdS)Nrrrrr�_agsr	c@seZdZdd�ZdS)�_CcCsdS)Nr)�selfrrr�_m!sz_C._mN)�__name__�
__module__�__qualname__rrrrrr
 sr
�cCs2t|||�\}}}|dk	r"||�||||f|�S)zBCreate a class object dynamically using the appropriate metaclass.N)�
prepare_class)�name�bases�kwds�	exec_body�meta�nsrrr�	new_class9srcCs~|dkri}nt|�}d|kr*|jd�}n|r<t|d�}nt}t|t�rTt||�}t|d�rp|j||f|�}ni}|||fS)azCall the __prepare__ method of the appropriate metaclass.

    Returns (metaclass, namespace, kwds) as a 3-tuple

    *metaclass* is the appropriate metaclass
    *namespace* is the prepared class namespace
    *kwds* is an updated copy of the passed in kwds argument with any
    'metaclass' entry removed. If no kwds argument is passed in, this will
    be an empty dict.
    N�	metaclassr�__prepare__)�dict�pop�type�
isinstance�_calculate_meta�hasattrr)rrrrrrrrr@s


rcCsB|}x8|D]0}t|�}t||�r"q
t||�r2|}q
td��q
W|S)z%Calculate the most derived metaclass.zxmetaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases)r�
issubclass�	TypeError)rr�winner�base�	base_metarrrr`s


rc@sLeZdZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�DynamicClassAttributeaRoute attribute access on a class to __getattr__.

    This is a descriptor, used to define attributes that act differently when
    accessed through an instance and through a class.  Instance access remains
    normal, but access to an attribute through a class will be routed to the
    class's __getattr__ method; this is done by raising AttributeError.

    This allows one to have properties active on an instance, and have virtual
    attributes on the class with the same name (see Enum for an example).

    NcCs>||_||_||_|p|j|_|dk|_tt|dd��|_dS)N�__isabstractmethod__F)�fget�fset�fdel�__doc__�
overwrite_doc�bool�getattrr')rr(r)r*�docrrr�__init__}s
zDynamicClassAttribute.__init__cCs6|dkr|jr|St��n|jdkr,td��|j|�S)Nzunreadable attribute)r'�AttributeErrorr()r�instance�
ownerclassrrr�__get__�s
zDynamicClassAttribute.__get__cCs"|jdkrtd��|j||�dS)Nzcan't set attribute)r)r1)rr2�valuerrr�__set__�s
zDynamicClassAttribute.__set__cCs |jdkrtd��|j|�dS)Nzcan't delete attribute)r*r1)rr2rrr�
__delete__�s
z DynamicClassAttribute.__delete__cCs8|jr|jnd}t|�||j|j|p(|j�}|j|_|S)N)r,r+rr)r*)rr(�fdoc�resultrrr�getter�szDynamicClassAttribute.gettercCs$t|�|j||j|j�}|j|_|S)N)rr(r*r+r,)rr)r9rrr�setter�szDynamicClassAttribute.settercCs$t|�|j|j||j�}|j|_|S)N)rr(r)r+r,)rr*r9rrr�deleter�szDynamicClassAttribute.deleter)NNNN)N)r
rrr+r0r4r6r7r:r;r<rrrrr&qs


	r&c@s�eZdZdd�Zdd�Zdd�Zdd�Zed	d
��Zedd��Z	ed
d��Z
edd��ZeZe	Z
e
ZeZdd�Zdd�ZeZdS)�_GeneratorWrappercCs2||_|jtk|_t|dd�|_t|dd�|_dS)Nr
r)�_GeneratorWrapper__wrapped�	__class__�
GeneratorType�_GeneratorWrapper__isgenr.r
r)r�genrrrr0�sz_GeneratorWrapper.__init__cCs|jj|�S)N)r>�send)r�valrrrrC�sz_GeneratorWrapper.sendcGs|jj|f|��S)N)r>�throw)r�tp�restrrrrE�sz_GeneratorWrapper.throwcCs
|jj�S)N)r>�close)rrrrrH�sz_GeneratorWrapper.closecCs|jjS)N)r>�gi_code)rrrrrI�sz_GeneratorWrapper.gi_codecCs|jjS)N)r>�gi_frame)rrrrrJ�sz_GeneratorWrapper.gi_framecCs|jjS)N)r>�
gi_running)rrrrrK�sz_GeneratorWrapper.gi_runningcCs|jjS)N)r>�gi_yieldfrom)rrrrrL�sz_GeneratorWrapper.gi_yieldfromcCs
t|j�S)N)�nextr>)rrrr�__next__�sz_GeneratorWrapper.__next__cCs|jr|jS|S)N)rAr>)rrrr�__iter__�sz_GeneratorWrapper.__iter__N)r
rrr0rCrErH�propertyrIrJrKrL�cr_code�cr_frame�
cr_running�cr_awaitrNrO�	__await__rrrrr=�sr=cs�t��std���jtkr�t�dd�jtkr��jj}|d@r@�S|d@r��j}t|j|j	|j
|j|jdB|j|j
|j|j|j|j|j|j|j|j��_�Stj���fdd��}|S)	z2Convert regular generator function to a coroutine.z$types.coroutine() expects a callable�__code__Ni�� �csT�||�}|jtks*|jtkr.|jjd@r.|St|tj�rPt|tj�rPt	|�S|S)NrX)
r?�
CoroutineTyper@rI�co_flagsr�_collections_abc�	Generator�	Coroutiner=)�args�kwargs�coro)�funcrr�wrapped�s

zcoroutine.<locals>.wrapped)�callabler"r?�FunctionTyper.�CodeTyperVrZ�co_argcount�co_kwonlyargcount�
co_nlocals�co_stacksize�co_code�	co_consts�co_names�co_varnames�co_filename�co_name�co_firstlineno�	co_lnotab�co_freevars�co_cellvars�
_functools�wraps)rarZ�corbr)rar�	coroutine�s(

rwcCs g|]}|dd�dkr|�qS)Nr�_r)�.0�nrrr�
<listcomp>
sr{)1r+�sysrrrd�
LambdaTyperVre�__dict__�MappingProxyType�implementation�SimpleNamespacerr@rrYrHr	�AsyncGeneratorTyper
r�
MethodType�len�BuiltinFunctionType�append�BuiltinMethodType�
ModuleTyper"�exc_info�tb�
TracebackType�tb_frame�	FrameType�GetSetDescriptorType�__globals__�MemberDescriptorTyperrrr&�	functoolsrt�collections.abc�abcr[r=rw�globals�__all__rrrr�<module>sR








 :
%7poplib.cpython-36.pyc000064400000032023150335715140010463 0ustar003


 \t:�
@sldZddlZddlZddlZyddlZdZWnek
rDdZYnXddgZGdd�de�Z	dZ
d	Zd
ZdZ
ee
ZdZGd
d�d�Zer�Gdd�de�Zejd�edk�rhddlZeejd�Zeej��ejejd�ejejd�ej�ej�\ZZxXeded�D]FZ ej!e �\Z"Z#Z$ede �xe#D]Z%ede%��q<Wed��qWej&�dS)z@A POP3 client class.

Based on the J. Myers POP3 draft, Jan. 96
�NTF�POP3�error_protoc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/poplib.pyrs�ni��
�
ic@seZdZdZdZeejfdd�Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd=d d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zejd0�Z d1d2�Z!d3d4�Z"d>d5d6�Z#d7d8�Z$d9d:�Z%d?d;d<�Z&dS)@raPThis class supports both the minimal and optional command sets.
    Arguments can be strings or integers (where appropriate)
    (e.g.: retr(1) and retr('1') both work equally well.

    Minimal Command Set:
            USER name               user(name)
            PASS string             pass_(string)
            STAT                    stat()
            LIST [msg]              list(msg = None)
            RETR msg                retr(msg)
            DELE msg                dele(msg)
            NOOP                    noop()
            RSET                    rset()
            QUIT                    quit()

    Optional Commands (some servers support these):
            RPOP name               rpop(name)
            APOP name digest        apop(name, digest)
            TOP msg n               top(msg, n)
            UIDL [msg]              uidl(msg = None)
            CAPA                    capa()
            STLS                    stls()
            UTF8                    utf8()

    Raises one exception: 'error_proto'.

    Instantiate with:
            POP3(hostname, port=110)

    NB:     the POP protocol locks the mailbox from user
            authorization until QUIT, so be sure to get in, suck
            the messages, and quit, each time you access the
            mailbox.

            POP is a line-based protocol, which means large mail
            messages consume lots of python cycles reading them
            line-by-line.

            If it's available on your mail server, use IMAP4
            instead, it doesn't suffer from the two problems
            above.
    zUTF-8cCs@||_||_d|_|j|�|_|jjd�|_d|_|j�|_	dS)NF�rbr)
�host�port�_tls_established�_create_socket�sock�makefile�file�
_debugging�_getresp�welcome)�selfr
r�timeoutrrr�__init__asz
POP3.__init__cCstj|j|jf|�S)N)�socketZcreate_connectionr
r)rrrrrrkszPOP3._create_socketcCs,|jdkrtdt|��|jj|t�dS)N�z*put*)r�print�reprrZsendall�CRLF)r�linerrr�_putlinens
z
POP3._putlinecCs.|jrtdt|��t||j�}|j|�dS)Nz*cmd*)rrr�bytes�encodingr )rrrrr�_putcmduszPOP3._putcmdcCs�|jjtd�}t|�tkr$td��|jdkr<tdt|��|sHtd��t|�}|dd�tkrp|dd�|fS|dd�t	kr�|dd�|fS|dd	�|fS)
Nrz
line too longz*get*z-ERR EOF����r%���r&)
r�readline�_MAXLINE�lenrrrrr�CR)rr�octetsrrr�_getlines
z
POP3._getlinecCs:|j�\}}|jdkr$tdt|��|jd�s6t|��|S)Nrz*resp*�+)r,rrr�
startswithr)r�resp�orrrr�s

z
POP3._getrespcCsp|j�}g}d}|j�\}}xH|dkrd|jd�rD|d}|dd�}||}|j|�|j�\}}qW|||fS)Nr�.s..r)rr,r.�append)rr/�listr+rr0rrr�_getlongresp�s


zPOP3._getlongrespcCs|j|�|j�S)N)r#r)rrrrr�	_shortcmd�s
zPOP3._shortcmdcCs|j|�|j�S)N)r#r4)rrrrr�_longcmd�s
z
POP3._longcmdcCs|jS)N)r)rrrr�
getwelcome�szPOP3.getwelcomecCs
||_dS)N)r)r�levelrrr�set_debuglevel�szPOP3.set_debuglevelcCs|jd|�S)zVSend user name, return response

        (should indicate password required).
        zUSER %s)r5)r�userrrrr:�sz	POP3.usercCs|jd|�S)z�Send password, return response

        (response includes message count, mailbox size).

        NB: mailbox is locked by server from here to 'quit()'
        zPASS %s)r5)rZpswdrrr�pass_�sz
POP3.pass_cCsF|jd�}|j�}|jr&tdt|��t|d�}t|d�}||fS)z]Get mailbox status.

        Result is tuple of 2 ints (message count, mailbox size)
        ZSTATz*stat*rr$)r5�splitrrr�int)rZretvalZretsZnumMessagesZsizeMessagesrrr�stat�s
z	POP3.statNcCs |dk	r|jd|�S|jd�S)aRequest listing, return result.

        Result without a message number argument is in form
        ['response', ['mesg_num octets', ...], octets].

        Result when a message number argument is given is a
        single response: the "scan listing" for that message.
        NzLIST %sZLIST)r5r6)r�whichrrrr3�s	z	POP3.listcCs|jd|�S)zoRetrieve whole message number 'which'.

        Result is in form ['response', ['line', ...], octets].
        zRETR %s)r6)rr?rrr�retr�sz	POP3.retrcCs|jd|�S)zFDelete message number 'which'.

        Result is 'response'.
        zDELE %s)r5)rr?rrr�dele�sz	POP3.delecCs
|jd�S)zXDoes nothing.

        One supposes the response indicates the server is alive.
        ZNOOP)r5)rrrr�noopsz	POP3.noopcCs
|jd�S)z(Unmark all messages marked for deletion.ZRSET)r5)rrrr�rsetsz	POP3.rsetcCs|jd�}|j�|S)zDSignoff: commit changes on server, unlock mailbox, close connection.ZQUIT)r5�close)rr/rrr�quits
z	POP3.quitcCs�z |j}d|_|dk	r|j�Wd|j}d|_|dk	r�zVy|jtj�Wn@tk
r�}z$|jtjkrxt	|dd�dkrx�WYdd}~XnXWd|j�XXdS)z8Close the connection without assuming anything about it.NZwinerrorri&')
rrDrZshutdownrZ	SHUT_RDWR�OSError�errnoZENOTCONN�getattr)rrr�excrrrrDsz
POP3.closecCs|jd|�S)zNot sure what this does.zRPOP %s)r5)rr:rrr�rpop2sz	POP3.rpops\+OK.[^<]*(<.*>)cCs\t||j�}|jj|j�}|s&td��ddl}|jd�|}|j|�j	�}|j
d||f�S)aAuthorisation

        - only possible if server has supplied a timestamp in initial greeting.

        Args:
                user     - mailbox user;
                password - mailbox password.

        NB: mailbox is locked by server from here to 'quit()'
        z!-ERR APOP not supported by serverrNrz
APOP %s %s)r!r"�	timestamp�matchrr�hashlib�groupZmd5Z	hexdigestr5)rr:ZpasswordZsecret�mrMZdigestrrr�apop9sz	POP3.apopcCs|jd||f�S)z�Retrieve message header of message number 'which'
        and first 'howmuch' lines of message body.

        Result is in form ['response', ['line', ...], octets].
        z	TOP %s %s)r6)rr?Zhowmuchrrr�topNszPOP3.topcCs |dk	r|jd|�S|jd�S)z�Return message digest (unique id) list.

        If 'which', result contains unique id for that message
        in the form 'response mesgnum uid', otherwise result is
        the list ['response', ['mesgnum uid', ...], octets]
        NzUIDL %sZUIDL)r5r6)rr?rrr�uidlWsz	POP3.uidlcCs
|jd�S)zITry to enter UTF-8 mode (see RFC 6856). Returns server response.
        ZUTF8)r5)rrrr�utf8csz	POP3.utf8c	Cstdd�}i}y8|jd�}|d}x |D]}||�\}}|||<q&WWn*tk
rn}ztd��WYdd}~XnX|S)aReturn server capabilities (RFC 2449) as a dictionary
        >>> c=poplib.POP3('localhost')
        >>> c.capa()
        {'IMPLEMENTATION': ['Cyrus', 'POP3', 'server', 'v2.2.12'],
         'TOP': [], 'LOGIN-DELAY': ['0'], 'AUTH-RESP-CODE': [],
         'EXPIRE': ['NEVER'], 'USER': [], 'STLS': [], 'PIPELINING': [],
         'UIDL': [], 'RESP-CODES': []}
        >>>

        Really, according to RFC 2449, the cyrus folks should avoid
        having the implementation split into multiple arguments...
        cSs"|jd�j�}|d|dd�fS)N�asciirr)�decoder<)rZlstrrr�	_parsecapvszPOP3.capa.<locals>._parsecapZCAPArz!-ERR CAPA not supported by serverN)r6r)	rrV�capsr/ZrawcapsZcaplineZcapnmZcapargsZ_errrrr�capais


z	POP3.capacCsxtstd��|jrtd��|j�}d|kr2td��|dkrBtj�}|jd�}|j|j|j	d�|_|jj
d�|_d|_|S)	z{Start a TLS session on the active connection as specified in RFC 2595.

                context - a ssl.SSLContext
        z-ERR TLS support missingz$-ERR TLS session already establishedZSTLSz!-ERR STLS not supported by serverN)�server_hostnamerT)�HAVE_SSLrrrX�ssl�_create_stdlib_contextr5�wrap_socketrr
rr)r�contextrWr/rrr�stls�s
z	POP3.stls)N)N)N)'rrr�__doc__r"�	POP3_PORTr�_GLOBAL_DEFAULT_TIMEOUTrrr r#r,rr4r5r6r7r9r:r;r>r3r@rArBrCrErDrJ�re�compilerKrPrQrRrSrXr_rrrrr2s@+	




	
c@s8eZdZdZeddejdfdd�Zdd�Zd	dd�Z	dS)
�POP3_SSLaPOP3 client class over SSL connection

        Instantiate with: POP3_SSL(hostname, port=995, keyfile=None, certfile=None,
                                   context=None)

               hostname - the hostname of the pop3 over ssl server
               port - port number
               keyfile - PEM formatted file that contains your private key
               certfile - PEM formatted certificate chain file
               context - a ssl.SSLContext

        See the methods of the parent class POP3 for more documentation.
        NcCs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}|jdtd�||_||_|dkrxtj||d�}||_t	j
||||�dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadr$)�certfile�keyfile)�
ValueError�warnings�warn�DeprecationWarningrgrfr[r\r^rr)rr
rrgrfrr^rirrrr�szPOP3_SSL.__init__cCs"tj||�}|jj||jd�}|S)N)rY)rrr^r]r
)rrrrrrr�s
zPOP3_SSL._create_socketcCstd��dS)z�The method unconditionally raises an exception since the
            STLS command doesn't make any sense on an already established
            SSL/TLS session.
            z$-ERR TLS session already establishedN)r)rrgrfr^rrrr_�sz
POP3_SSL.stls)NNN)
rrrr`�
POP3_SSL_PORTrrbrrr_rrrrre�s

re�__main__rr$�zMessage %d:z   z-----------------------)'r`rGrcrr[rZ�ImportError�__all__�	Exceptionrrarlr*ZLFrr(rrer2r�sys�argv�arr7r:r;r3r>ZnumMsgsZ	totalSize�range�ir@�header�msgr+rrErrrr�<module>sJ
l0


calendar.cpython-36.opt-1.pyc000064400000062434150335715140011717 0ustar003


 \�Z�@sdZddlZddlZddlZddlmZdddddd	d
ddd
ddddddddddddddgZeZ	Gdd�de�Z
Gdd�de�ZdZdZ
dd d!d d"d d"d d d"d d"d g
ZGd#d$�d$�ZGd%d&�d&�Zed'�Zed(�Zed)�Zed*�Zed+�\ZZZZZZZd,d�Zd-d	�Zd.d
�Zd/d�Z Gd0d�de!�Z"Gd1d�de"�Z#Gd2d�de"�Z$Gd3d4�d4�Z%Gd5d�de#�Z&Gd6d�de$�Z'e#�Z(e(j)Z*d7d�Z+e(j,Z-e(j.Z.e(j/Z0e(j1Z2e(j3Z3e(j4Z5e(j6Z7e(j8Z9dDZ:d9Z;e:e;fd:d;�Z<e:e;fd<d=�Z=d>Z>ej?e>dd�j@�ZAd?d�ZBd@dA�ZCeDdBk�reCejE�dS)Ea$Calendar printing functions

Note when comparing these calendars to the ones printed by cal(1): By
default, these calendars have Monday as the first day of the week, and
Sunday as the last (the European convention). Use setfirstweekday() to
set the first day of the week (0=Monday, 6=Sunday).�N)�repeat�IllegalMonthError�IllegalWeekdayError�setfirstweekday�firstweekday�isleap�leapdays�weekday�
monthrange�
monthcalendar�prmonth�month�prcal�calendar�timegm�
month_name�
month_abbr�day_name�day_abbr�Calendar�TextCalendar�HTMLCalendar�LocaleTextCalendar�LocaleHTMLCalendar�
weekheaderc@seZdZdd�Zdd�ZdS)rcCs
||_dS)N)r
)�selfr
�r� /usr/lib64/python3.6/calendar.py�__init__szIllegalMonthError.__init__cCs
d|jS)Nz!bad month number %r; must be 1-12)r
)rrrr�__str__szIllegalMonthError.__str__N)�__name__�
__module__�__qualname__rrrrrrrsc@seZdZdd�Zdd�ZdS)rcCs
||_dS)N)r	)rr	rrrr szIllegalWeekdayError.__init__cCs
d|jS)Nz7bad weekday number %r; must be 0 (Monday) to 6 (Sunday))r	)rrrrr"szIllegalWeekdayError.__str__N)r r!r"rrrrrrrs�����c@sFeZdZdd�ed�D�Zejddd��dd�Zd	d
�Zdd�Zd
S)�_localized_monthcCs g|]}tjd|dd�j�qS)i�r#)�datetime�date�strftime)�.0�irrr�
<listcomp>4sz_localized_month.<listcomp>�rcCsdS)N�r)�xrrr�<lambda>5sz_localized_month.<lambda>cCs
||_dS)N)�format)rr3rrrr7sz_localized_month.__init__cs4�j|}t|t�r&�fdd�|D�S|�j�SdS)Ncsg|]}|�j��qSr)r3)r,�f)rrrr.=sz0_localized_month.__getitem__.<locals>.<listcomp>)�_months�
isinstance�slicer3)rr-�funcsr)rr�__getitem__:s

z_localized_month.__getitem__cCsdS)N�
r)rrrr�__len__Asz_localized_month.__len__N)	r r!r"�ranger5�insertrr9r;rrrrr(2s
r(c@s6eZdZdd�ed�D�Zdd�Zdd�Zdd	�Zd
S)�_localized_daycCs g|]}tjdd|d�j�qS)i�r#)r)r*r+)r,r-rrrr.Hsz_localized_day.<listcomp>�cCs
||_dS)N)r3)rr3rrrrJsz_localized_day.__init__cs4�j|}t|t�r&�fdd�|D�S|�j�SdS)Ncsg|]}|�j��qSr)r3)r,r4)rrrr.Psz._localized_day.__getitem__.<locals>.<listcomp>)�_daysr6r7r3)rr-r8r)rrr9Ms

z_localized_day.__getitem__cCsdS)Nr?r)rrrrr;Tsz_localized_day.__len__N)r r!r"r<r@rr9r;rrrrr>Esr>z%Az%az%Bz%br?cCs$|ddko"|ddkp"|ddkS)z5Return True for leap years, False for non-leap years.�r�di�r)�yearrrrrdscCs@|d8}|d8}|d|d|d|d|d|dS)zFReturn number of leap years in range [y1, y2).
       Assume y1 <= y2.r#rArBi�r)Zy1Zy2rrrriscCstj|||�j�S)zTReturn weekday (0-6 ~ Mon-Sun) for year (1970-...), month (1-12),
       day (1-31).)r)r*r	)rCr
�dayrrrr	qscCsLd|kodkns t|��t||d�}t||tko@t|�}||fS)zQReturn weekday (0-6 ~ Mon-Sun) and number of days (28-31) for
       year, month.r#r/)rr	�mdays�Februaryr)rCr
�day1�ndaysrrrr
ws
c@s�eZdZdZddd�Zdd�Zdd�Zeee�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zd dd�Zd!dd�Zd"dd�ZdS)#rzo
    Base calendar class. This class doesn't do any formatting. It simply
    provides data to subclasses.
    rcCs
||_dS)N)r)rrrrrr�szCalendar.__init__cCs
|jdS)Nr?)�
_firstweekday)rrrr�getfirstweekday�szCalendar.getfirstweekdaycCs
||_dS)N)rI)rrrrrr�szCalendar.setfirstweekdayccs*x$t|j|jd�D]}|dVqWdS)zt
        Return an iterator for one week of weekday numbers starting with the
        configured first one.
        r?N)r<r)rr-rrr�iterweekdays�szCalendar.iterweekdaysccs�tj||d�}|j�|jd}|tj|d�8}tjdd�}xH|Vy||7}Wntk
rfPYnX|j|kr>|j�|jkr>Pq>WdS)z�
        Return an iterator for one month. The iterator will yield datetime.date
        values and will always iterate through complete weeks, so it will yield
        dates outside the specified month.
        r#r?)�daysN)r)r*r	rZ	timedelta�
OverflowErrorr
)rrCr
r*rLZonedayrrr�itermonthdates�szCalendar.itermonthdatesccs4x.t|j||�|j�D]\}}||dfVqWdS)z�
        Like itermonthdates(), but will yield (day number, weekday number)
        tuples. For days outside the specified month the day number is 0.
        r?N)�	enumerate�
itermonthdaysr)rrCr
r-�drrr�itermonthdays2�szCalendar.itermonthdays2ccsft||�\}}||jd}td|�EdHtd|d�EdH|j||d}td|�EdHdS)z�
        Like itermonthdates(), but will yield day numbers. For days outside
        the specified month the day number is 0.
        r?rNr#)r
rrr<)rrCr
rGrHZdays_beforeZ
days_afterrrrrP�szCalendar.itermonthdayscs.t|j||����fdd�tdt��d�D�S)z�
        Return a matrix (list of lists) representing a month's calendar.
        Each row represents a week; week entries are datetime.date values.
        csg|]}�||d��qS)r?r)r,r-)�datesrrr.�sz/Calendar.monthdatescalendar.<locals>.<listcomp>rr?)�listrNr<�len)rrCr
r)rSr�monthdatescalendar�szCalendar.monthdatescalendarcs.t|j||����fdd�tdt��d�D�S)z�
        Return a matrix representing a month's calendar.
        Each row represents a week; week entries are
        (day number, weekday number) tuples. Day numbers outside this month
        are zero.
        csg|]}�||d��qS)r?r)r,r-)rLrrr.�sz/Calendar.monthdays2calendar.<locals>.<listcomp>rr?)rTrRr<rU)rrCr
r)rLr�monthdays2calendar�szCalendar.monthdays2calendarcs.t|j||����fdd�tdt��d�D�S)z�
        Return a matrix representing a month's calendar.
        Each row represents a week; days outside this month are zero.
        csg|]}�||d��qS)r?r)r,r-)rLrrr.�sz.Calendar.monthdayscalendar.<locals>.<listcomp>rr?)rTrPr<rU)rrCr
r)rLr�monthdayscalendar�szCalendar.monthdayscalendar�cs>��fdd�tttd�D����fdd�tdt����D�S)a'
        Return the data for the specified year ready for formatting. The return
        value is a list of month rows. Each month row contains up to width months.
        Each month contains between 4 and 6 weeks and each week contains 1-7
        days. Days are datetime.date objects.
        csg|]}�j�|��qSr)rV)r,r-)rrCrrr.�sz.Calendar.yeardatescalendar.<locals>.<listcomp>r/csg|]}�||���qSrr)r,r-)�months�widthrrr.�sr)r<�JanuaryrU)rrCr[r)rZrr[rCr�yeardatescalendar�szCalendar.yeardatescalendarcs>��fdd�tttd�D����fdd�tdt����D�S)z�
        Return the data for the specified year ready for formatting (similar to
        yeardatescalendar()). Entries in the week lists are
        (day number, weekday number) tuples. Day numbers outside this month are
        zero.
        csg|]}�j�|��qSr)rW)r,r-)rrCrrr.�sz.Calendar.yeardays2calendar.<locals>.<listcomp>r/csg|]}�||���qSrr)r,r-)rZr[rrr.�sr)r<r\rU)rrCr[r)rZrr[rCr�yeardays2calendar�szCalendar.yeardays2calendarcs>��fdd�tttd�D����fdd�tdt����D�S)z�
        Return the data for the specified year ready for formatting (similar to
        yeardatescalendar()). Entries in the week lists are day numbers.
        Day numbers outside this month are zero.
        csg|]}�j�|��qSr)rX)r,r-)rrCrrr.�sz-Calendar.yeardayscalendar.<locals>.<listcomp>r/csg|]}�||���qSrr)r,r-)rZr[rrr.sr)r<r\rU)rrCr[r)rZrr[rCr�yeardayscalendar�szCalendar.yeardayscalendarN)r)rY)rY)rY)r r!r"�__doc__rrJr�propertyrrKrNrRrPrVrWrXr]r^r_rrrrr�s





c@sjeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
d�Z	ddd�Z
ddd�Zd dd�Zd!dd�Z
dS)"rzr
    Subclass of Calendar that outputs a calendar as a simple plain text
    similar to the UNIX program cal.
    cCst|j||�dd�dS)z3
        Print a single week (no newline).
        � )�endN)�print�
formatweek)r�theweekr[rrr�prweek
szTextCalendar.prweekcCs |dkrd}nd|}|j|�S)z*
        Returns a formatted day.
        rr0z%2i)�center)rrDr	r[�srrr�	formatdayszTextCalendar.formatdaycsdj��fdd�|D��S)zA
        Returns a single week in a string (no newline).
        rbc3s |]\}}�j||��VqdS)N)rj)r,rQ�wd)rr[rr�	<genexpr>sz*TextCalendar.formatweek.<locals>.<genexpr>)�join)rrfr[r)rr[rreszTextCalendar.formatweekcCs(|dkrt}nt}||d|�j|�S)z4
        Returns a formatted week day name.
        �	N)rrrh)rrDr[�namesrrr�
formatweekday szTextCalendar.formatweekdaycsdj��fdd��j�D��S)z-
        Return a header for a week.
        rbc3s|]}�j|��VqdS)N)rp)r,r-)rr[rrrl.sz0TextCalendar.formatweekheader.<locals>.<genexpr>)rmrK)rr[r)rr[r�formatweekheader*szTextCalendar.formatweekheaderTcCs"t|}|rd||f}|j|�S)z0
        Return a formatted month name.
        z%s %r)rrh)r�theyear�themonthr[�withyearrirrr�formatmonthname0szTextCalendar.formatmonthnamercCst|j||||�dd�dS)z+
        Print a month's calendar.
        r0)rcN)rd�formatmonth)rrrrs�w�lrrrr9szTextCalendar.prmonthcCs�td|�}td|�}|j||d|dd�}|j�}|d|7}||j|�j�7}|d|7}x4|j||�D]$}||j||�j�7}|d|7}qnW|S)z@
        Return a month's calendar string (multi-line).
        r$r#r?�
)�maxru�rstriprqrWre)rrrrsrwrxri�weekrrrrv?s

zTextCalendar.formatmonthr$r#�rYcs�td|�}td|�}td|�}|ddd�g}|j}|t��j�|||d�j��|d|��j|���x@t�j�|��D�]*\}}	t||dt	||ddd��}
|d|����fdd�|
D�}|t
|�|�j��|d|��fdd�|
D�}|t
|�|�j��|d|�td	d�|	D��}
xvt|
�D]j}g}x>|	D]6}|t|�k�rr|jd
�n|j�j|||���qTW|t
|�|�j��|d|��qFWq�Wd
j
|�S)zC
        Returns a year's calendar as a multi-line string.
        r$r#r?ryr:c3s|]}�j�|�d�VqdS)FN)ru)r,�k)�colwidthrrrrrrl`sz*TextCalendar.formatyear.<locals>.<genexpr>c3s|]
}�VqdS)Nr)r,r~)�headerrrrldscss|]}t|�VqdS)N)rU)r,�calrrrrlhsr0)rz�append�reprrhr{rqrOr^r<�min�formatstringrUrerm)rrrrwrx�c�m�v�ar-�rowrZroZheadersZheight�jZweeksr�r)rr�rrrr�
formatyearOs:


&
$
zTextCalendar.formatyearcCst|j|||||��dS)zPrint a year's calendar.N)rdr�)rrrrwrxr�r�rrr�pryeartszTextCalendar.pryearN)T)rr)rr)r$r#r}rY)rrr}rY)r r!r"r`rgrjrerprqrurrvr�r�rrrrrs


	


%c@sjeZdZdZdddddddgZd	d
�Zdd�Zd
d�Zdd�Zddd�Z	ddd�Z
ddd�Zd dd�ZdS)!rz4
    This calendar returns complete HTML pages.
    ZmonZtueZwedZthuZfriZsatZsuncCs"|dkrdSd|j||fSdS)z/
        Return a day as a table cell.
        rz<td class="noday">&nbsp;</td>z<td class="%s">%d</td>N)�
cssclasses)rrDr	rrrrj�szHTMLCalendar.formatdaycs dj�fdd�|D��}d|S)z8
        Return a complete week as a table row.
        r0c3s|]\}}�j||�VqdS)N)rj)r,rQrk)rrrrl�sz*HTMLCalendar.formatweek.<locals>.<genexpr>z<tr>%s</tr>)rm)rrfrir)rrre�szHTMLCalendar.formatweekcCsd|j|t|fS)z:
        Return a weekday name as a table header.
        z<th class="%s">%s</th>)r�r)rrDrrrrp�szHTMLCalendar.formatweekdaycs$dj�fdd��j�D��}d|S)z<
        Return a header for a week as a table row.
        r0c3s|]}�j|�VqdS)N)rp)r,r-)rrrrl�sz0HTMLCalendar.formatweekheader.<locals>.<genexpr>z<tr>%s</tr>)rmrK)rrir)rrrq�szHTMLCalendar.formatweekheaderTcCs*|rdt||f}ndt|}d|S)z5
        Return a month name as a table row.
        z%s %sz%sz.<tr><th colspan="7" class="month">%s</th></tr>)r)rrrrsrtrirrrru�szHTMLCalendar.formatmonthnamecCs�g}|j}|d�|d�||j|||d��|d�||j��|d�x*|j||�D]}||j|��|d�qXW|d�|d�dj|�S)z6
        Return a formatted month as a table.
        z@<table border="0" cellpadding="0" cellspacing="0" class="month">ry)rtz</table>r0)r�rurqrWrerm)rrrrsrtr�r�r|rrrrv�szHTMLCalendar.formatmonthrYcCs�g}|j}t|d�}|d�|d�|d||f�xntttd|�D]Z}t|t||d��}|d�x0|D](}|d�||j||d	d
��|d�qlW|d�qFW|d
�dj|�S)z?
        Return a formatted year as a table of tables.
        r#z?<table border="0" cellpadding="0" cellspacing="0" class="year">ryz.<tr><th colspan="%d" class="year">%s</th></tr>r/r:z<tr>z<td>F)rtz</td>z</tr>z</table>r0)r�rzr<r\r�rvrm)rrrr[r�r�r-rZr�rrrr��s 

zHTMLCalendar.formatyear�calendar.cssNcCs�|dkrtj�}g}|j}|d|�|d�|d�|d�|d|�|dk	r^|d|�|d|�|d	�|d
�||j||��|d�|d�d
j|�j|d�S)zB
        Return a formatted year as a complete HTML page.
        Nz$<?xml version="1.0" encoding="%s"?>
zn<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
z<html>
z<head>
zC<meta http-equiv="Content-Type" content="text/html; charset=%s" />
z4<link rel="stylesheet" type="text/css" href="%s" />
z<title>Calendar for %d</title>
z</head>
z<body>
z</body>
z</html>
r0�xmlcharrefreplace)�sys�getdefaultencodingr�r�rm�encode)rrrr[�css�encodingr�r�rrr�formatyearpage�s$zHTMLCalendar.formatyearpage)T)T)rY)rYr�N)
r r!r"r`r�rjrerprqrurvr�r�rrrrrys	



c@s$eZdZdd�Zdd�Zdd�ZdS)�different_localecCs
||_dS)N)�locale)rr�rrrr�szdifferent_locale.__init__cCs"tjtj�|_tjtj|j�dS)N)�_localeZ	getlocale�LC_TIME�	oldlocale�	setlocaler�)rrrr�	__enter__�szdifferent_locale.__enter__cGstjtj|j�dS)N)r�r�r�r�)r�argsrrr�__exit__�szdifferent_locale.__exit__N)r r!r"rr�r�rrrrr��sr�c@s,eZdZdZddd�Zdd�Zdd	d
�ZdS)
ra
    This class can be passed a locale name in the constructor and will return
    month and weekday names in the specified locale. If this locale includes
    an encoding all strings containing month and weekday names will be returned
    as unicode.
    rNcCs&tj||�|dkrtj�}||_dS)N)rrr��getdefaultlocaler�)rrr�rrrr�szLocaleTextCalendar.__init__c
CsBt|j��.|dkrt}nt}||}|d|�j|�SQRXdS)Nrn)r�r�rrrh)rrDr[ro�namerrrrpsz LocaleTextCalendar.formatweekdayTc
Cs8t|j��$t|}|r$d||f}|j|�SQRXdS)Nz%s %r)r�r�rrh)rrrrsr[rtrirrrrus
z"LocaleTextCalendar.formatmonthname)rN)T)r r!r"r`rrprurrrrr�s
	c@s,eZdZdZddd�Zdd�Zdd	d
�ZdS)
ra
    This class can be passed a locale name in the constructor and will return
    month and weekday names in the specified locale. If this locale includes
    an encoding all strings containing month and weekday names will be returned
    as unicode.
    rNcCs&tj||�|dkrtj�}||_dS)N)rrr�r�r�)rrr�rrrrszLocaleHTMLCalendar.__init__c
Cs0t|j��t|}d|j||fSQRXdS)Nz<th class="%s">%s</th>)r�r�rr�)rrDrirrrrp!sz LocaleHTMLCalendar.formatweekdayTc
Cs6t|j��"t|}|r$d||f}d|SQRXdS)Nz%s %sz.<tr><th colspan="7" class="month">%s</th></tr>)r�r�r)rrrrsrtrirrrru&s
z"LocaleHTMLCalendar.formatmonthname)rN)T)r r!r"r`rrprurrrrrs
cCs*t|kotkns t|��|t_dS)N)�MONDAY�SUNDAYrr�r)rrrrr3srYr}cCstt|||��dS)z1Prints multi-column formatting for year calendarsN)rdr�)�colsr�spacingrrrr3Gsr3cs |d9}|j�fdd�|D��S)zEReturns a string formatted from n strings, centered within n columns.rbc3s|]}|j��VqdS)N)rh)r,r�)rrrrlOszformatstring.<locals>.<genexpr>)rm)r�rr�r)rrr�Lsr�i�cCs^|dd�\}}}}}}tj||d�j�t|d}|d|}|d|}	|	d|}
|
S)zBUnrelated but handy function to calculate Unix timestamp from GMT.Nr}r#��<)r)r*�	toordinal�
_EPOCH_ORD)�tuplerCr
rDZhourZminute�secondrLZhoursZminutesZsecondsrrrrVscCs�ddl}|j�}|jd�}|jd�}|jddtddd�|jd	d
tddd�|jd
dtddd�|jddtddd�|jddddd�|jddddd�|jddddd�|jd d!d"d3d$d%�|jd&d'td(d)�|jd*d'td+d)�|j|dd��}|j�r|j�r|jd,�t	j
d�|j|jf}|jd#k�r�|j�rFt|d-�}nt
�}|j}|dk�rdt	j�}t||jd.�}	t	jjj}
|jdk�r�|
|jtjj�jf|	��n6|jdk�r�|
|j|jf|	��n|jd/�t	j
d�n�|j�r�t|d-�}nt�}t|j|jd0�}	|jdk�r&|j|	d1<|j|	d2<|jdk�rJ|j tjj�jf|	�}n2|jdk�rh|j |jf|	�}n|j!|j|jf|	�}t	jj}
|j�r�|j"|j�}t	jjj}
|
|�dS)4Nrztext only argumentszhtml only argumentsz-wz--widthr$z width of date column (default 2))�type�default�helpz-lz--linesr#z)number of lines for each week (default 1)z-sz	--spacingr}z"spacing between months (default 6)z-mz--monthsrYzmonths per row (default 3)z-cz--csszcalendar.csszCSS to use for page)r�r�z-Lz--localez.locale to be used from month and weekday namesz-ez
--encodingzencoding to use for outputz-tz--type�text�htmlzoutput type (text or html))r��choicesr�rC�?zyear number (1-9999))�nargsr�r�r
zmonth number (1-12, text only)z/if --locale is specified --encoding is required)r�)r�r�zincorrect number of arguments)rwrxr�r�)r�r�)#�argparse�ArgumentParserZadd_argument_group�add_argument�int�
parse_argsr�r��errorr��exitr�rrr��dictr��stdout�buffer�writerCr�r)r*Ztodayr
rrr[�linesr�rZr�rvr�)r�r��parserZ	textgroupZ	htmlgroupZoptionsr�r�r�Zoptdictr��resultrrr�main`s�









r��__main__��)Fr`r�r)r�r��	itertoolsr�__all__�
ValueErrorr�rrr\rFrEr(r>rrrrr<r�ZTUESDAYZ	WEDNESDAYZTHURSDAYZFRIDAYZSATURDAYr�rrr	r
�objectrrrr�rrr�rJrrrXrrgrer|rqrrrvr
r�rr�rZ	_colwidthZ_spacingr3r�ZEPOCHr*r�r�rr�r �argvrrrr�<module>sn



up
h
macurl2path.cpython-36.opt-1.pyc000064400000003515150335715140012363 0ustar003


 \�
�@s8dZddlZddlZddgZdd�Zdd�Zdd�ZdS)	zqMacintosh-specific module for conversion between pathnames and URLs.

Do not import directly; use urllib instead.�N�url2pathname�pathname2urlcCsttjj|�d}|r$|dkr$td��|dd�dkrB|dd�}n|dd�dkrZtd��|jd	�}d}x�|t|�k�r||d
kr�||=qj||dkr�|dkr�||ddkr�||d|d�=|d}qj||d
kr�|dkr�||dd
kr�||=qj|d}qjW|d�s"dj|dd��}nFd}x2|t|�k�rX||dk�rXd
||<|d}�q(Wddj|�}tjj|�S)z{OS-specific conversion from a relative URL of the 'file' scheme
    to a file system path; not recommended for general use.r�filez(Cannot convert non-local URL to pathnameN�z///�z//�/�.�..���:)rr	)�urllib�parseZ	splittype�RuntimeError�split�len�joinZunquote)�pathname�tp�
components�i�rv�r�#/usr/lib64/python3.6/macurl2path.pyr
s6

$
cCs�d|krtd��|jd�}|ddkr,|d=|d	dkr>|d
=x(tt|��D]}||dkrLd||<qLWtt|�}tjj|�r�ddj	|�Sdj	|�SdS)z{OS-specific conversion from a file system path to a relative URL
    of the 'file' scheme; not recommended for general use.rz*Cannot convert pathname containing slashesrrrr
z..N���r)
rr�ranger�map�_pncomp2url�os�path�isabsr)rrrrrrr4s

cCstjj|dd�dd�S)N�r)Zsafe)r
rZquote)Z	componentrrrrKsr)�__doc__Zurllib.parser
r�__all__rrrrrrr�<module>s*fileinput.cpython-36.opt-1.pyc000064400000031542150335715140012141 0ustar003


 \�8�@s�dZddlZddlZddddddd	d
ddd
dgZdad!dd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd	�Zdd
�Zdd�Z
Gdd�d�Zdd
�Zd"dd�Zdd�Zed kr�e�dS)#a�Helper class to quickly write a loop over all standard input files.

Typical use is:

    import fileinput
    for line in fileinput.input():
        process(line)

This iterates over the lines of all files listed in sys.argv[1:],
defaulting to sys.stdin if the list is empty.  If a filename is '-' it
is also replaced by sys.stdin.  To specify an alternative list of
filenames, pass it as the argument to input().  A single file name is
also allowed.

Functions filename(), lineno() return the filename and cumulative line
number of the line that has just been read; filelineno() returns its
line number in the current file; isfirstline() returns true iff the
line just read is the first line of its file; isstdin() returns true
iff the line was read from sys.stdin.  Function nextfile() closes the
current file so that the next iteration will read the first line from
the next file (if any); lines not read from the file will not count
towards the cumulative line count; the filename is not changed until
after the first line of the next file has been read.  Function close()
closes the sequence.

Before any lines have been read, filename() returns None and both line
numbers are zero; nextfile() has no effect.  After all lines have been
read, filename() and the line number functions return the values
pertaining to the last line read; nextfile() has no effect.

All files are opened in text mode by default, you can override this by
setting the mode parameter to input() or FileInput.__init__().
If an I/O error occurs during opening or reading a file, the OSError
exception is raised.

If sys.stdin is used more than once, the second and further use will
return no lines, except perhaps for interactive use, or if it has been
explicitly reset (e.g. using sys.stdin.seek(0)).

Empty files are opened and immediately closed; the only time their
presence in the list of filenames is noticeable at all is when the
last file opened is empty.

It is possible that the last line of a file doesn't end in a newline
character; otherwise lines are returned including the trailing
newline.

Class FileInput is the implementation; its methods filename(),
lineno(), fileline(), isfirstline(), isstdin(), nextfile() and close()
correspond to the functions in the module.  In addition it has a
readline() method which returns the next input line, and a
__getitem__() method which implements the sequence behavior.  The
sequence must be accessed in strictly sequential order; sequence
access and readline() cannot be mixed.

Optional in-place filtering: if the keyword argument inplace=1 is
passed to input() or to the FileInput constructor, the file is moved
to a backup file and standard output is directed to the input file.
This makes it possible to write a filter that rewrites its input file
in place.  If the keyword argument backup=".<some extension>" is also
given, it specifies the extension for the backup file, and the backup
file remains around; by default, the extension is ".bak" and it is
deleted when the output file is closed.  In-place filtering is
disabled when standard input is read.  XXX The current implementation
does not work for MS-DOS 8+3 filesystems.

XXX Possible additions:

- optional getopt argument processing
- isatty()
- read(), read(size), even readlines()

�N�input�close�nextfile�filename�lineno�
filelineno�fileno�isfirstline�isstdin�	FileInput�hook_compressed�hook_encodedF��rcCs(trtjrtd��t||||||�atS)aReturn an instance of the FileInput class, which can be iterated.

    The parameters are passed to the constructor of the FileInput class.
    The returned instance, in addition to being an iterator,
    keeps global state for the functions of this module,.
    zinput() already active)�_state�_file�RuntimeErrorr)�files�inplace�backup�bufsize�mode�openhook�r�!/usr/lib64/python3.6/fileinput.pyrSs	
cCst}da|r|j�dS)zClose the sequence.N)rr)�staterrrrascCststd��tj�S)a�
    Close the current file so that the next iteration will read the first
    line from the next file (if any); lines not read from the file will
    not count towards the cumulative line count. The filename is not
    changed until after the first line of the next file has been read.
    Before the first line has been read, this function has no effect;
    it cannot be used to skip the first file. After the last line of the
    last file has been read, this function has no effect.
    zno active input())rrrrrrrris
cCststd��tj�S)zr
    Return the name of the file currently being read.
    Before the first line has been read, returns None.
    zno active input())rrrrrrrrwscCststd��tj�S)z�
    Return the cumulative line number of the line that has just been read.
    Before the first line has been read, returns 0. After the last line
    of the last file has been read, returns the line number of that line.
    zno active input())rrrrrrrr�scCststd��tj�S)z�
    Return the line number in the current file. Before the first line
    has been read, returns 0. After the last line of the last file has
    been read, returns the line number of that line within the file.
    zno active input())rrrrrrrr�scCststd��tj�S)zg
    Return the file number of the current file. When no file is currently
    opened, returns -1.
    zno active input())rrrrrrrr�scCststd��tj�S)ze
    Returns true the line just read is the first line of its file,
    otherwise returns false.
    zno active input())rrr	rrrrr	�scCststd��tj�S)z]
    Returns true if the last line was read from sys.stdin,
    otherwise returns false.
    zno active input())rrr
rrrrr
�sc@s�eZdZdZd)dd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�ZdS)*ra?FileInput([files[, inplace[, backup[, bufsize, [, mode[, openhook]]]]]])

    Class FileInput is the implementation of the module; its methods
    filename(), lineno(), fileline(), isfirstline(), isstdin(), fileno(),
    nextfile() and close() correspond to the functions of the same name
    in the module.
    In addition it has a readline() method which returns the next
    input line, and a __getitem__() method which implements the
    sequence behavior. The sequence must be accessed in strictly
    sequential order; random access and readline() cannot be mixed.
    NFrrrcCs�t|t�r|f}n(|dkr(tjdd�}|s2d}nt|�}||_||_||_|rhddl}|j	dt
dd�d|_d|_d|_
d|_d|_d|_d|_d|_|dkr�td��d
|kr�ddl}|j	d
t
d�||_|r�|r�td��t|�s�td��||_dS)N��-rz!bufsize is deprecated and ignored�)�
stacklevelFr�rU�U�rbz=FileInput opening mode must be one of 'r', 'rU', 'U' and 'rb'z'U' mode is deprecatedz4FileInput cannot use an opening hook in inplace modez#FileInput openhook must be callable)r)rr r!r")�
isinstance�str�sys�argv�tuple�_files�_inplace�_backup�warnings�warn�DeprecationWarning�_savestdout�_output�	_filename�_startlineno�_filelinenor�_isstdin�_backupfilename�
ValueError�_mode�callable�	_openhook)�selfrrrrrrr+rrr�__init__�sF

zFileInput.__init__cCs|j�dS)N)r)r9rrr�__del__�szFileInput.__del__cCsz|j�Wdf|_XdS)N)rr()r9rrrr�szFileInput.closecCs|S)Nr)r9rrr�	__enter__�szFileInput.__enter__cCs|j�dS)N)r)r9�type�value�	tracebackrrr�__exit__�szFileInput.__exit__cCs|S)Nr)r9rrr�__iter__�szFileInput.__iter__cCs:x4|j�}|r |jd7_|S|js*t�|j�qWdS)Nr)�	_readliner2r�
StopIterationr)r9�linerrr�__next__�szFileInput.__next__cCs>||j�krtd��y|j�Stk
r8td��YnXdS)Nzaccessing lines out of orderzend of input reached)rrrErC�
IndexError)r9�irrr�__getitem__szFileInput.__getitem__c%Cs�|j}d|_|r|t_|j}d|_z|r0|j�Wd|j}d|_y|`Wntk
r\YnXz|rt|jrt|j�Wd|j	}d|_	|r�|j
r�ytj|�Wnt
k
r�YnXd|_XXdS)NF)r.r%�stdoutr/rrrB�AttributeErrorr3r4r*�os�unlink�OSError)r9Z
savestdout�output�fileZbackupfilenamerrrrs4zFileInput.nextfilecCs:x4|j�}|r |jd7_|S|js*|S|j�qWdS)Nr)rBr2rr)r9rDrrr�readline)szFileInput.readlinecCs�|jsd|jkrdSdS|jd|_|jdd�|_|j�|_d|_d|_d|_d|_|jdkr�d|_d|jkr�t	t
jd	t
j�|_nt
j|_d
|_�nV|j�r�|j|j
p�d|_ytj|j�Wntk
r�YnXtj|j|j�t|j|j�|_ytj|jj��j}Wn$tk
�r0t|jd�|_Yn~XtjtjBtjB}ttd
��rZ|tjO}tj|j||�}tj|d�|_yttd��r�tj|j|�Wntk
�r�YnXt
j|_|jt
_n,|j �r�|j |j|j�|_nt|j|j�|_|jj!|_"|j"�S)N�b�rrrFrz<stdin>�bufferTz.bak�w�O_BINARY�chmod)#r(r6r0rr1r2rr3r4�getattrr%�stdinr)r*rKrLrM�rename�open�fstatr�st_moder/�O_CREAT�O_WRONLY�O_TRUNC�hasattrrU�fdopenrVrIr.r8rPrB)r9Zpermr�fdrrrrB4s\







zFileInput._readlinecCs|jS)N)r0)r9rrrrnszFileInput.filenamecCs|j|jS)N)r1r2)r9rrrrqszFileInput.linenocCs|jS)N)r2)r9rrrrtszFileInput.filelinenocCs0|jr(y
|jj�Stk
r$dSXndSdS)Nr���rc)rrr5)r9rrrrws
zFileInput.filenocCs
|jdkS)Nr)r2)r9rrrr	�szFileInput.isfirstlinecCs|jS)N)r3)r9rrrr
�szFileInput.isstdin)NFrrrN)�__name__�
__module__�__qualname__�__doc__r:r;rr<r@rArErHrrPrBrrrrr	r
rrrrr�s&
):	cCsVtjj|�d}|dkr,ddl}|j||�S|dkrHddl}|j||�St||�SdS)Nrz.gzrz.bz2)rK�path�splitext�gziprZ�bz2ZBZ2File)rrZextrjrkrrrr�scs��fdd�}|S)Ncst||��d�S)N)�encoding�errors)rZ)rr)rlrmrrr�szhook_encoded.<locals>.openhookr)rlrmrr)rlrmrr
�scCs�ddl}d}d}|jtjdd�d�\}}x(|D] \}}|dkrDd}|dkr0|}q0Wxtt|||d�D]b}|dd�d	kr�|dd�}|dd�d
kr�|dd�}tdt�t�t�t�r�dp�d
|f�qdWtdt�t�t�f�dS)NrFrzib:z-iTz-b)rr�
�
z%d: %s[%d]%s %s�*rz
%d: %s[%d]rcrcrcrc)	�getoptr%r&r�printrrrr	)rqrrZopts�args�o�arDrrr�_test�s"rv�__main__)NFrrrN)N)rgr%rK�__all__rrrrrrrrr	r
rrr
rvrdrrrr�<module>Is,


	

			Y
hmac.cpython-36.opt-2.pyc000064400000010154150335715140011047 0ustar003

�\dh��@s�ddlZddlmZddlZddlZddlZe	dd�e
d�D��Ze	dd�e
d�D��ZdZ
Gdd�d�Zd	d
�ZGdd�dej�Zej�r�eZdd
d�ZdS)�N)�_compare_digestccs|]}|dAVqdS)�\N�)�.0�xrr�/usr/lib64/python3.6/hmac.py�	<genexpr>sr�ccs|]}|dAVqdS)�6Nr)rrrrrr
sc@sNeZdZdZddd�Zedd��Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)�HMAC�@Ncsftj�rtd��t|ttf�s0tdt|�j���dkrLt	j
dtd�tj
�t��r\�|_n,t�t�rxd�fdd�	|_nd�fd	d�	|_|j�|_|j�|_|jj|_t|jd
�r�|jj}|dkr�t	j
d||jftd�|j}nt	j
d
|jtd�|j}||_t|�|k�r|j|�j�}|j|d�}|jj|jt��|jj|jt��|dk	�rb|j|�dS)Nz*This class is not available in FIPS mode. zUse hmac.new().z,key: expected bytes or bytearray, but got %rz<HMAC() without an explicit digestmod argument is deprecated.��cstj�|�S)N)�_hashlib�new)�d)�	digestmodrr�<lambda>;szHMAC.__init__.<locals>.<lambda>cs
�j|�S)N)r)r)rrrr=s�
block_size�z:block_size of %d seems too small; using our default of %d.z<No block_size attribute on given digest object; Assuming %d.�z9This class is not available in FIPS mode. Use hmac.new().)r)r)�_hashlibopenssl�
get_fips_mode�
ValueError�
isinstance�bytes�	bytearray�	TypeError�type�__name__�	_warnings�warn�PendingDeprecationWarningrZmd5�callable�digest_cons�str�outer�inner�digest_size�hasattrr�	blocksize�RuntimeWarning�len�digest�ljust�update�	translate�trans_5C�trans_36)�self�key�msgrr*r)rr�__init__sJ





z
HMAC.__init__cCsd|jjS)Nzhmac-)r'�name)r3rrrr7]sz	HMAC.namecCs tj�rtd��|jj|�dS)Nz'hmac.HMAC is not available in FIPS mode)rrrr'r/)r3r5rrrr/aszHMAC.updatecCs:|jj|j�}|j|_|j|_|jj�|_|jj�|_|S)N)�	__class__�__new__r$r(r'�copyr&)r3�otherrrrr:hsz	HMAC.copycCs|jj�}|j|jj��|S)N)r&r:r/r'r-)r3�hrrr�_currentus
z
HMAC._currentcCs|j�}|j�S)N)r=r-)r3r<rrrr-~szHMAC.digestcCs|j�}|j�S)N)r=�	hexdigest)r3r<rrrr>�szHMAC.hexdigest)NN)r�
__module__�__qualname__r*r6�propertyr7r/r:r=r-r>rrrrrs
A
	
rcCsX|dkrtd��t|t�r"|j�St|�r2|d�}t|tj�sFtd��|jj�j	dd�S)Nz.'digestmod' argument is mandatory in FIPS moderz6Only OpenSSL hashlib hashes are accepted in FIPS mode.�_�-)
rrr%�lowerr#rZHASHrr7�replace)rrrr�_get_openssl_name�s
rFc@seZdZddd�ZdS)�HMAC_opensslNcCsLt|ttf�s tdt|�j��t|�}tjj	|||d�}|rH|j
|�|S)Nz,key: expected bytes or bytearray, but got %r)r)rrrrrrrF�_hmacopensslrr9r/)�clsr4r5rr7�resultrrrr9�s
zHMAC_openssl.__new__)NN)rr?r@r9rrrrrG�srGcCst|||�S)N)r)r4r5rrrrr�sr)NN)�warningsr �	_operatorrZcompare_digestZhashlibrrrHr�ranger1r2r(rrFrGrrrrrr�<module>szstatistics.cpython-36.opt-2.pyc000064400000016120150335715140012330 0ustar003


 \�P�@s@dddddddddd	d
dgZdd
lZdd
lZdd
lZdd
lZddlmZddlmZddlm	Z	m
Z
ddlmZm
Z
Gdd�de�Zd4dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd5d$d%�Zd&d	�Zd'd�Zd(d�Zd)d�Zd*d�Zd6d,d�Zd-d
�Zd7d.d/�Z d8d0d�Z!d9d1d�Z"d:d2d�Z#d;d3d�Z$d
S)<�StatisticsError�pstdev�	pvariance�stdev�variance�median�
median_low�median_high�median_grouped�mean�mode�
harmonic_mean�N)�Fraction)�Decimal)�groupby�chain)�bisect_left�bisect_rightc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�"/usr/lib64/python3.6/statistics.pyrcscCs�d}t|�\}}||i}|j}ttt|��}xRt|t�D]D\}}	t||�}x0tt|	�D]"\}}|d7}||d�|||<qVWq8Wd|kr�|d}
ntdd�t|j	��D��}
||
|fS)Nr
�css|]\}}t||�VqdS)N)r)�.0�d�nrrr�	<genexpr>�sz_sum.<locals>.<genexpr>)
�_exact_ratio�get�_coerce�int�typer�map�sum�sorted�items)�data�start�countrrZpartialsZpartials_get�T�typ�values�totalrrr�_sumis$
r.cCs(y|j�Stk
r"tj|�SXdS)N)Z	is_finite�AttributeError�mathZisfinite)�xrrr�	_isfinite�sr2cCs�||kr|S|tks|tkr |S|tkr,|St||�r:|St||�rH|St|t�rV|St|t�rd|St|t�r|t|t�r||St|t�r�t|t�r�|Sd}t||j|jf��dS)Nz"don't know how to coerce %s and %s)r!�bool�
issubclassr�float�	TypeErrorr)r*�S�msgrrrr �s(



r cCs�ydt|�tkst|�tkr"|j�Sy|j|jfStk
r`y|j�Stk
rZYnXYnXWnttfk
r�|dfSXd}t	|j
t|�j���dS)Nz0can't convert type '{}' to numerator/denominator)r"r5r�as_integer_ratio�	numerator�denominatorr/�
OverflowError�
ValueErrorr6�formatr)r1r8rrrr�s
rcCsjt|�|kr|St|t�r(|jdkr(t}y||�Stk
rdt|t�r^||j�||j�S�YnXdS)Nr)r"r4r!r;r5r6rr:)�valuer*rrr�_convert�s
r@cCs`tjt|��j�}|s|S|dd}x4tdt|��D]"}||d|kr6|d|�}Pq6W|S)Nr
r)�collections�Counter�iter�most_common�range�len)r'�tableZmaxfreq�irrr�_counts�srIcCs.t||�}|t|�kr&|||kr&|St�dS)N)rrFr=)�ar1rHrrr�
_find_lteq	s
rKcCs>t|||d�}|t|�dkr6||d|kr6|dSt�dS)N)�lor)rrFr=)rJ�lr1rHrrr�
_find_rteqs rN�negative valueccs(x"|D]}|dkrt|��|VqWdS)Nr
)r)r,�errmsgr1rrr�	_fail_negs
rQcCsHt|�|krt|�}t|�}|dkr,td��t|�\}}}t|||�S)Nrz%mean requires at least one data point)rC�listrFrr.r@)r'rr*r-r)rrrr
#scCs�t|�|krt|�}d}t|�}|dkr2td��n<|dkrn|d}t|tjtf�rf|dkrbt|��|Std��y"t	dd�t
||�D��\}}}Wntk
r�dSXt|||�S)Nz.harmonic mean does not support negative valuesrz.harmonic_mean requires at least one data pointr
zunsupported typecss|]}d|VqdS)rNr)rr1rrrrdsz harmonic_mean.<locals>.<genexpr>)
rCrRrFr�
isinstance�numbersZRealrr6r.rQ�ZeroDivisionErrorr@)r'rPrr1r*r-r)rrrr=s$
"cCs\t|�}t|�}|dkr td��|ddkr8||dS|d}||d||dSdS)Nr
zno median for empty data�r)r%rFr)r'rrHrrrrls
cCsLt|�}t|�}|dkr td��|ddkr8||dS||ddSdS)Nr
zno median for empty datarVr)r%rFr)r'rrrrr�scCs,t|�}t|�}|dkr td��||dS)Nr
zno median for empty datarV)r%rFr)r'rrrrr�s
rc
Cs�t|�}t|�}|dkr"td��n|dkr2|dS||d}x*||fD]}t|ttf�rHtd|��qHWy||d}Wn(tk
r�t|�t|�d}YnXt||�}t	|||�}|}||d}	|||d||	S)Nr
zno median for empty datarrVzexpected number but got %r)
r%rFrrS�str�bytesr6r5rKrN)
r'Zintervalrr1�obj�L�l1�l2Zcf�frrrr	�s&

cCsBt|�}t|�dkr |ddS|r6tdt|���ntd��dS)Nrr
z.no unique mode; found %d equally common valueszno mode for empty data)rIrFr)r'rGrrrr�scsd�dkrt|��t�fdd�|D��\}}}t�fdd�|D��\}}}||dt|�8}||fS)Nc3s|]}|�dVqdS)rVNr)rr1)�crrrsz_ss.<locals>.<genexpr>c3s|]}|�VqdS)Nr)rr1)r^rrrsrV)r
r.rF)r'r^r*r-r)�UZtotal2Zcount2r)r^r�_sssr`cCsLt|�|krt|�}t|�}|dkr,td��t||�\}}t||d|�S)NrVz*variance requires at least two data pointsr)rCrRrFrr`r@)r'�xbarrr*�ssrrrr"s&cCsHt|�|krt|�}t|�}|dkr,td��t||�\}}t|||�S)Nrz*pvariance requires at least one data point)rCrRrFrr`r@)r'�murr*rbrrrrQs'cCs2t||�}y|j�Stk
r,tj|�SXdS)N)r�sqrtr/r0)r'ra�varrrrr�s
	
cCs2t||�}y|j�Stk
r,tj|�SXdS)N)rrdr/r0)r'rcrerrrr�s
	
)r
)rO)r)N)N)N)N)N)%�__all__rAZdecimalr0rTZ	fractionsrr�	itertoolsrrZbisectrrr=rr.r2r rr@rIrKrNrQr
rrrrr	rr`rrrrrrrr�<module>OsB

: 

/
7*

/
0
_compression.cpython-36.opt-1.pyc000064400000010012150335715140012627 0ustar003


 \��@s:dZddlZejZGdd�dej�ZGdd�dej�ZdS)z7Internal classes used by the gzip, lzma and bz2 modules�Nc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
BaseStreamzMode-checking helper functions.cCs|jrtd��dS)NzI/O operation on closed file)�closed�
ValueError)�self�r�$/usr/lib64/python3.6/_compression.py�_check_not_closedszBaseStream._check_not_closedcCs|j�stjd��dS)NzFile not open for reading)�readable�io�UnsupportedOperation)rrrr�_check_can_readszBaseStream._check_can_readcCs|j�stjd��dS)NzFile not open for writing)�writabler
r)rrrr�_check_can_writeszBaseStream._check_can_writecCs(|j�stjd��|j�s$tjd��dS)Nz3Seeking is only supported on files open for readingz3The underlying file object does not support seeking)r	r
r�seekable)rrrr�_check_can_seeks
zBaseStream._check_can_seekN)�__name__�
__module__�__qualname__�__doc__rrrrrrrrr	s
rcsleZdZdZdd�Zffdd�Z�fdd�Zdd	�Zd
d�Zdd
d�Z	dd�Z
ejfdd�Z
dd�Z�ZS)�DecompressReaderz5Adapts the decompressor API to a RawIOBase reader APIcCsdS)NTr)rrrrr	$szDecompressReader.readablecKs>||_d|_d|_d|_||_||_|jf|j�|_||_dS)NFr����)�_fp�_eof�_pos�_size�_decomp_factory�_decomp_args�
_decompressor�_trailing_error)r�fpZdecomp_factoryZtrailing_errorZdecomp_argsrrr�__init__'szDecompressReader.__init__csd|_t�j�S)N)r�super�close)r)�	__class__rrr#;szDecompressReader.closecCs
|jj�S)N)rr)rrrrr?szDecompressReader.seekablecCsPt|��:}|jd��$}|jt|��}||dt|��<WdQRXWdQRXt|�S)N�B)�
memoryview�cast�read�len)r�bZviewZ	byte_view�datarrr�readintoBs$zDecompressReader.readintorcCs�|dkr|j�S|s|jr dSd}x�|jjr�|jjp@|jjt�}|sHP|jf|j	�|_y|jj
||�}Wq�|jk
r�PYq�Xn4|jjr�|jjt�}|s�t
d��nd}|jj
||�}|r&Pq&W|s�d|_|j|_dS|jt|�7_|S)Nr�zACompressed file ended before the end-of-stream marker was reachedT)�readallrr�eofZunused_datarr(�BUFFER_SIZErrZ
decompressrZneeds_input�EOFErrorrrr))r�sizer+Zrawblockrrrr(Hs>


zDecompressReader.readcCs,|jjd�d|_d|_|jf|j�|_dS)NrF)r�seekrrrrr)rrrr�_rewindrszDecompressReader._rewindcCs�|tjkrnV|tjkr"|j|}n@|tjkrT|jdkrHx|jtj�rFq8W|j|}ntdj	|���||jkrv|j
�n
||j8}x0|dkr�|jttj|��}|s�P|t|�8}q�W|jS)NrzInvalid value for whence: {})
r
�SEEK_SET�SEEK_CURr�SEEK_ENDrr(�DEFAULT_BUFFER_SIZEr�formatr4�minr))r�offset�whencer+rrrr3xs&







zDecompressReader.seekcCs|jS)z!Return the current file position.)r)rrrr�tell�szDecompressReader.tellr)r)rrrrr	r!r#rr,r(r4r
r5r3r=�
__classcell__rr)r$rr!s
*r)rr
r8r0�BufferedIOBaser�	RawIOBaserrrrr�<module>ssndhdr.cpython-36.opt-2.pyc000064400000013010150335715140011413 0ustar003


 \��@s.ddgZddlmZedd�Zdej_dej_dej_d	ej_d
ej	_dd�Z
dd�ZgZd
d�Z
eje
�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zed)k�r*e�d*S)+�what�whathdr�)�
namedtuple�
SndHeadersz.filetype framerate nchannels nframes sampwidthz�The value for type indicates the data type
and will be one of the strings 'aifc', 'aiff', 'au','hcom',
'sndr', 'sndt', 'voc', 'wav', '8svx', 'sb', 'ub', or 'ul'.zYThe sampling_rate will be either the actual
value or 0 if unknown or difficult to decode.z^The number of channels or 0 if it cannot be
determined or if the value is difficult to decode.z?The value for frames will be either the number
of frames or -1.zAEither the sample size in bits or
'A' for A-LAW or 'U' for u-LAW.cCst|�}|S)N)r)�filename�res�r�/usr/lib64/python3.6/sndhdr.pyr4scCsHt|d��4}|jd�}x"tD]}|||�}|rt|�SqWdSQRXdS)N�rbi)�open�read�testsr)r�f�hZtfrrrr	r:s


cCs�ddl}|jd�sdS|dd�dkr,d}n|dd�dkrBd}ndS|jd�y|j|d	�}Wnt|jfk
rzdSX||j�|j�|j�d|j	�fS)
NrsFORM��sAIFC�aifcsAIFFZaiff�r)
r�
startswith�seekr�EOFError�Error�getframerate�getnchannels�
getnframes�getsampwidth)rrrZfmt�arrr	�	test_aifcKs

rc
Cs�|jd�rt}n|dd�dkr&t}ndSd}||dd��}||dd��}||dd��}||dd	��}||d	d
��}d}	|dkr�d}
n$|d
kr�d}
n|dkr�d}
d
}	nd}
|	|}|r�||}nd}|||||
fS)Ns.snd��ds.�dns.Zaurr�����U���?)rr ���)r�get_long_be�get_long_le)
rr�func�filetypeZhdr_sizeZ	data_size�encoding�rate�	nchannelsZsample_sizeZsample_bitsZ
frame_sizeZnframerrr	�test_au`s2

r1cCsT|dd�dks |dd�dkr$dSt|dd��}|rBd	|}nd
}d|ddd
fS)N�A�EsFSSD��sHCOM��i"VrZhcomr$rr))r*)rrZdivisorr/rrr	�	test_hcom�s 
r8cCst|jd�sdSt|dd��}d}d|ko4dknrf||dkrfd||d}|rftd	|�}d
|dddfS)
NsCreative Voice Filer"�ri�r$�rg��.AZvocrr))r�get_short_le�int)rrZsbseekr/Zratecoderrr	�test_voc�s
$r=cCs�ddl}|jd�s4|dd�dks4|dd�dkr8dS|jd�y|j|d�}Wnt|jfk
rldSXd	|j�|j�|j�d|j	�fS)
NrsRIFFrrsWAVEr!sfmt rZwav)
�waverrZopenfprrrrrr)rrr>�wrrr	�test_wav�s,
r@cCs$|jd�s|dd�dkr dSdS)	NsFORMrrs8SVX�8svxrr$)rArr$rr)r)rrrrr	�	test_8svx�srBcCs<|jd�r8t|dd��}t|dd��}d|d|dfSdS)NsSOUNDrrr"r9Zsndtr$)rr+r;)rrZnsamplesr/rrr	�	test_sndt�s
rCcCsD|jd�r@t|dd��}d|ko,dknr@d|dd	dfSdS)
Nsr&ri�i�aZsndrr$rr))rr;)rrr/rrr	�	test_sndr�s
rDcCs,|dd>|dd>B|dd>B|dBS)Nrr#r$r!r&rr'r)�brrr	r*�sr*cCs,|dd>|dd>B|dd>B|dBS)Nr'r#r&r!r$rrr)rErrr	r+�sr+cCs|dd>|dBS)Nrrr$r)rErrr	�get_short_be�srFcCs|dd>|dBS)Nr$rrr)rErrr	r;�sr;cCs�ddl}d}|jdd�r8|jddkr8|jdd�=d}y8|jdd�r`t|jdd�|d�ntdg|d�Wn*tk
r�|jjd�|jd�YnXdS)Nrr$z-rr&�.z
[Interrupted]
)�sys�argv�testall�KeyboardInterrupt�stderr�write�exit)rH�	recursiverrr	�test�srPcCs�ddl}ddl}x�|D]�}|jj|�rzt|ddd�|s>|rptd�ddl}|j|jj|d��}t||d�q�td�qt|ddd�|jj	�ytt
|��Wqtk
r�td	�YqXqWdS)
Nrz/:� )�endzrecursing down:�*z*** directory (use -r) ***�:z*** not found ***)rH�os�path�isdir�print�glob�joinrJ�stdout�flushr�OSError)�listrOZtoplevelrHrUrrY�namesrrr	rJ�s"


rJ�__main__N)�__all__�collectionsrrr-�__doc__Z	framerater0ZnframesZ	sampwidthrrr
r�appendr1r8r=r@rBrCrDr*r+rFr;rPrJ�__name__rrrr	�<module>!sF









symbol.cpython-36.opt-1.pyc000064400000004727150335715140011454 0ustar003


 \G�@s�dZdZdZdZdZdZdZdZdZd	Z	d
Z
dZdZd
Z
dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;d<Z<d=Z=d>Z>d?Z?d@Z@dAZAdBZBdCZCdDZDdEZEdFZFdGZGdHZHdIZIdJZJdKZKdLZLdMZMdNZNdOZOdPZPdQZQdRZRdSZSdTZTdUZUdVZViZWx6eXeY�jZ��D]$\Z[Z\e]e\�e]dW�k�rpe[eWe\<�qpWdXdY�Z^e_dZk�r�e^�d[S)\z;Non-terminal symbols of Python grammar (from "graminit.h").�iiiiiiiii	i
iii
iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiU�cCs:ddl}ddl}t|j�dkr.|jddg|_|j�dS)Nr�zInclude/graminit.hz
Lib/symbol.py)�sys�token�len�argv�_main)rr�r	�/usr/lib64/python3.6/symbol.pyrks
r�__main__N)`�__doc__Zsingle_inputZ
file_inputZ
eval_inputZ	decoratorZ
decoratorsZ	decoratedZ
async_funcdefZfuncdefZ
parametersZ
typedargslistZtfpdefZvarargslistZvfpdefZstmtZsimple_stmtZ
small_stmtZ	expr_stmtZ	annassignZtestlist_star_exprZ	augassignZdel_stmtZ	pass_stmtZ	flow_stmtZ
break_stmtZ
continue_stmtZreturn_stmtZ
yield_stmtZ
raise_stmtZimport_stmtZimport_nameZimport_fromZimport_as_nameZdotted_as_nameZimport_as_namesZdotted_as_namesZdotted_nameZglobal_stmtZ
nonlocal_stmtZassert_stmtZ
compound_stmtZ
async_stmtZif_stmtZ
while_stmtZfor_stmtZtry_stmtZ	with_stmtZ	with_itemZ
except_clauseZsuiteZtestZtest_nocondZlambdefZlambdef_nocondZor_testZand_testZnot_testZ
comparisonZcomp_opZ	star_expr�exprZxor_exprZand_exprZ
shift_exprZ
arith_exprZtermZfactorZpowerZ	atom_exprZatomZ
testlist_compZtrailerZ
subscriptlistZ	subscriptZsliceopZexprlistZtestlistZdictorsetmakerZclassdefZarglistZargumentZ	comp_iterZcomp_forZcomp_ifZ
encoding_declZ
yield_exprZ	yield_argZsym_name�list�globals�items�_nameZ_value�typer�__name__r	r	r	r
�<module>s�

wave.cpython-36.opt-2.pyc000064400000027104150335715140011104 0ustar003


 \-E�@s�ddlZdddddgZGdd�de�ZdZdZddlZddlZddlZddl	m
Z
dd
lmZedd�Z
Gdd�d�ZGdd�d�Zddd�ZeZdS)�N�open�openfp�Error�	Wave_read�
Wave_writec@seZdZdS)rN)�__name__�
__module__�__qualname__�r
r
�/usr/lib64/python3.6/wave.pyrNs��b�h�i)�Chunk)�
namedtuple�_wave_paramsz7nchannels sampwidth framerate nframes comptype compnamec@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+S),rcCsd|_d|_t|dd�|_|jj�dkr0td��|jjd�dkrHtd��d|_d|_x�d|_	yt|jdd�}Wnt
k
r�PYnX|j�}|d	kr�|j|�d|_n2|d
kr�|js�td��||_|j|j
|_d|_	P|j�qVW|js�|j�rtd��dS)
Nr)Z	bigendiansRIFFz file does not start with RIFF id�sWAVEznot a WAVE filersfmt sdatazdata chunk before fmt chunkz#fmt chunk and/or data chunk missing)�_convert�	_soundposr�_fileZgetnamer�readZ_fmt_chunk_read�_data_chunk�_data_seek_needed�EOFError�_read_fmt_chunkZ	chunksize�
_framesize�_nframes�skip)�self�file�chunkZ	chunknamer
r
r�initfp}s:
zWave_read.initfpc	CsRd|_t|t�r"tj|d�}||_y|j|�Wn|jrF|j��YnXdS)N�rb)�_i_opened_the_file�
isinstance�str�builtinsrr"�close)r�fr
r
r�__init__�s
zWave_read.__init__cCs|j�dS)N)r()rr
r
r�__del__�szWave_read.__del__cCs|S)Nr
)rr
r
r�	__enter__�szWave_read.__enter__cGs|j�dS)N)r()r�argsr
r
r�__exit__�szWave_read.__exit__cCs|jS)N)r)rr
r
r�getfp�szWave_read.getfpcCsd|_d|_dS)Nrr)rr)rr
r
r�rewind�szWave_read.rewindcCs"d|_|j}|rd|_|j�dS)N)rr$r()rr r
r
rr(�s
zWave_read.closecCs|jS)N)r)rr
r
r�tell�szWave_read.tellcCs|jS)N)�
_nchannels)rr
r
r�getnchannels�szWave_read.getnchannelscCs|jS)N)r)rr
r
r�
getnframes�szWave_read.getnframescCs|jS)N)�
_sampwidth)rr
r
r�getsampwidth�szWave_read.getsampwidthcCs|jS)N)�
_framerate)rr
r
r�getframerate�szWave_read.getframeratecCs|jS)N)�	_comptype)rr
r
r�getcomptype�szWave_read.getcomptypecCs|jS)N)�	_compname)rr
r
r�getcompname�szWave_read.getcompnamecCs*t|j�|j�|j�|j�|j�|j��S)N)rr3r6r8r4r:r<)rr
r
r�	getparams�szWave_read.getparamscCsdS)Nr
)rr
r
r�
getmarkers�szWave_read.getmarkerscCstd��dS)Nzno marks)r)r�idr
r
r�getmark�szWave_read.getmarkcCs*|dks||jkrtd��||_d|_dS)Nrzposition not in ranger)rrrr)r�posr
r
r�setpos�szWave_read.setposcCs�|jr8|jjdd�|j|j}|r2|jj|d�d|_|dkrDdS|jj||j�}|jdkrxtjdkrxt	j
||j�}|jr�|r�|j|�}|jt|�|j
|j|_|S)Nr�r�big)rr�seekrrrr5�sys�	byteorder�audioop�byteswapr�lenr2)r�nframesrA�datar
r
r�
readframes�s

zWave_read.readframescCsztjd|jd��\}|_|_}}|tkrNtjd|jd��d}|dd|_ntd|f��|j|j|_d	|_	d
|_
dS)Nz<HHLLH�z<H�r��zunknown format: %r�NONEznot compressed)�structZunpack_fromrr2r7�WAVE_FORMAT_PCMr5rrr9r;)rr!Z
wFormatTagZdwAvgBytesPerSecZwBlockAlign�	sampwidthr
r
rr�s zWave_read._read_fmt_chunkN)rrr	r"r*r+r,r.r/r0r(r1r3r4r6r8r:r<r=r>r@rBrMrr
r
r
rr^s*
c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9S):rc	CsRd|_t|t�r"tj|d�}||_y|j|�Wn|jrF|j��YnXdS)N�wb)r$r%r&r'rr"r()rr)r
r
rr*#s
zWave_write.__init__cCs@||_d|_d|_d|_d|_d|_d|_d|_d|_d|_	dS)NrF)
rrr2r5r7r�_nframeswritten�_datawritten�_datalength�_headerwritten)rr r
r
rr"/szWave_write.initfpcCs|j�dS)N)r()rr
r
rr+;szWave_write.__del__cCs|S)Nr
)rr
r
rr,>szWave_write.__enter__cGs|j�dS)N)r()rr-r
r
rr.AszWave_write.__exit__cCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerzbad # of channels)rXrr2)r�	nchannelsr
r
r�setnchannelsGs
zWave_write.setnchannelscCs|jstd��|jS)Nznumber of channels not set)r2r)rr
r
rr3NszWave_write.getnchannelscCs0|jrtd��|dks|dkr&td��||_dS)Nz0cannot change parameters after starting to writerrzbad sample width)rXrr5)rrUr
r
r�setsampwidthSs
zWave_write.setsampwidthcCs|jstd��|jS)Nzsample width not set)r5r)rr
r
rr6ZszWave_write.getsampwidthcCs0|jrtd��|dkrtd��tt|��|_dS)Nz0cannot change parameters after starting to writerzbad frame rate)rXr�int�roundr7)r�	framerater
r
r�setframerate_s
zWave_write.setframeratecCs|jstd��|jS)Nzframe rate not set)r7r)rr
r
rr8fszWave_write.getframeratecCs|jrtd��||_dS)Nz0cannot change parameters after starting to write)rXrr)rrKr
r
r�
setnframeskszWave_write.setnframescCs|jS)N)rW)rr
r
rr4pszWave_write.getnframescCs.|jrtd��|dkrtd��||_||_dS)Nz0cannot change parameters after starting to writerRzunsupported compression type)rR)rXrr9r;)r�comptype�compnamer
r
r�setcomptypesszWave_write.setcomptypecCs|jS)N)r9)rr
r
rr:{szWave_write.getcomptypecCs|jS)N)r;)rr
r
rr<~szWave_write.getcompnamecCsV|\}}}}}}|jrtd��|j|�|j|�|j|�|j|�|j||�dS)Nz0cannot change parameters after starting to write)rXrr\r]rarbre)rZparamsr[rUr`rKrcrdr
r
r�	setparams�s



zWave_write.setparamscCs>|js|js|jr td��t|j|j|j|j|j|j�S)Nznot all parameters set)r2r5r7rrrr9r;)rr
r
rr=�szWave_write.getparamscCstd��dS)Nzsetmark() not supported)r)rr?rA�namer
r
r�setmark�szWave_write.setmarkcCstd��dS)Nzno marks)r)rr?r
r
rr@�szWave_write.getmarkcCsdS)Nr
)rr
r
rr>�szWave_write.getmarkerscCs|jS)N)rW)rr
r
rr1�szWave_write.tellcCs�t|ttf�st|�jd�}|jt|��t|�|j|j}|j	rN|j	|�}|jdkrpt
jdkrptj
||j�}|jj|�|jt|�7_|j||_dS)N�BrrD)r%�bytes�	bytearray�
memoryview�cast�_ensure_header_writtenrJr5r2rrFrGrHrIr�writerXrW)rrLrKr
r
r�writeframesraw�s
zWave_write.writeframesrawcCs"|j|�|j|jkr|j�dS)N)rprYrX�_patchheader)rrLr
r
r�writeframes�s
zWave_write.writeframescCsXz2|jr0|jd�|j|jkr&|j�|jj�Wdd|_|j}|rRd|_|j�XdS)Nr)rrnrYrXrq�flushr$r()rr r
r
rr(�s
zWave_write.closecCs>|js:|jstd��|js"td��|js0td��|j|�dS)Nz# channels not specifiedzsample width not specifiedzsampling rate not specified)rZr2rr5r7�
_write_header)rZdatasizer
r
rrn�sz!Wave_write._ensure_header_writtencCs�|jjd�|js$||j|j|_|j|j|j|_y|jj�|_Wntt	fk
rfd|_YnX|jjt
jdd|jdddt|j|j
|j|j
|j|j|j|jdd��|jdk	r�|jj�|_|jjt
jd	|j��d
|_dS)NsRIFFz<L4s4sLHHLLHH4s�$sWAVEsfmt �rQsdataz<LT)rrorr2r5rYr1�_form_length_pos�AttributeError�OSErrorrS�packrTr7�_data_length_posrZ)rZ
initlengthr
r
rrt�s$


zWave_write._write_headercCs�|j|jkrdS|jj�}|jj|jd�|jjtjdd|j��|jj|j	d�|jjtjd|j��|jj|d�|j|_dS)Nrz<Lru)
rXrYrr1rErwrorSrzr{)rZcurposr
r
rrq�s
zWave_write._patchheaderN)rrr	r*r"r+r,r.r\r3r]r6rar8rbr4rer:r<rfr=rhr@r>r1rprrr(rnrtrqr
r
r
rr	s8


cCsJ|dkrt|d�r|j}nd}|dkr.t|�S|dkr>t|�Std��dS)	N�moder#�r�wrVz$mode must be 'r', 'rb', 'w', or 'wb')r}r#)r~rV)�hasattrr|rrr)r)r|r
r
rr�s
)Nr
rNr)N)r'�__all__�	ExceptionrrTZ_array_fmtsrHrSrFr!r�collectionsrrrrrrr
r
r
r�<module>Js",d

codeop.cpython-36.opt-1.pyc000064400000014200150335715140011403 0ustar003


 \j�@sddZddlZdd�ejD�ZdddgZdZd	d
�Zdd�Zddd�ZGdd�d�Z	Gdd�d�Z
dS)a[Utilities to compile possibly incomplete Python source code.

This module provides two interfaces, broadly similar to the builtin
function compile(), which take program text, a filename and a 'mode'
and:

- Return code object if the command is complete and valid
- Return None if the command is incomplete
- Raise SyntaxError, ValueError or OverflowError if the command is a
  syntax error (OverflowError and ValueError can be produced by
  malformed literals).

Approach:

First, check if the source consists entirely of blank lines and
comments; if so, replace it with 'pass', because the built-in
parser doesn't always do the right thing for these.

Compile three times: as is, with \n, and with \n\n appended.  If it
compiles as is, it's complete.  If it compiles with one \n appended,
we expect more.  If it doesn't compile either way, we compare the
error we get when compiling with \n or \n\n appended.  If the errors
are the same, the code is broken.  But if the errors are different, we
expect more.  Not intuitive; not even guaranteed to hold in future
releases; but this matches the compiler's behavior from Python 1.4
through 2.2, at least.

Caveat:

It is possible (but not likely) that the parser stops parsing with a
successful outcome before reaching the end of the source; in this
case, trailing symbols may be ignored instead of causing an error.
For example, a backslash followed by two newlines may be followed by
arbitrary garbage.  This will be fixed once the API for the parser is
better.

The two interfaces are:

compile_command(source, filename, symbol):

    Compiles a single command in the manner described above.

CommandCompiler():

    Instances of this class have __call__ methods identical in
    signature to compile_command; the difference is that if the
    instance compiles program text containing a __future__ statement,
    the instance 'remembers' and compiles all subsequent program texts
    with the statement in force.

The module also provides another class:

Compile():

    Instances of this class act like the built-in function compile,
    but with 'memory' in the sense described above.
�NcCsg|]}tt|��qS�)�getattr�
__future__)�.0Zfnamerr�/usr/lib64/python3.6/codeop.py�
<listcomp>=sr�compile_command�Compile�CommandCompileric-Cs*x8|jd�D]}|j�}|r|ddkrPqW|dkr:d}d}}}d}}	}
y||||�}Wn"tk
r�}zWYdd}~XnXy||d||�}	Wn&tk
r�}z
|}WYdd}~XnXy||d||�}
Wn&tk
r�}z
|}WYdd}~XnX|�r|S|	�r&t|�t|�k�r&|�dS)N�
r�#�eval�passz

)�split�strip�SyntaxError�repr)�compiler�source�filename�symbol�line�errZerr1Zerr2�code�code1�code2�errr�_maybe_compileDs0rcCst|||t�S)N)�compile�PyCF_DONT_IMPLY_DEDENT)rrrrrr�_compileesr �<input>�singlecCstt|||�S)asCompile a command and determine whether it is incomplete.

    Arguments:

    source -- the source string; may contain \n characters
    filename -- optional filename from which source was read; default
                "<input>"
    symbol -- optional grammar start symbol; "single" (default) or "eval"

    Return value / exceptions raised:

    - Return a code object if the command is complete and valid
    - Return None if the command is incomplete
    - Raise SyntaxError, ValueError or OverflowError if the command is a
      syntax error (OverflowError and ValueError can be produced by
      malformed literals).
    )rr )rrrrrrrhsc@s eZdZdZdd�Zdd�ZdS)r	z�Instances of this class behave much like the built-in compile
    function, but if one is used to compile text containing a future
    statement, it "remembers" and compiles all subsequent program texts
    with the statement in force.cCs
t|_dS)N)r�flags)�selfrrr�__init__�szCompile.__init__cCs@t||||jd�}x(tD] }|j|j@r|j|jO_qW|S)N�)rr#�	_features�co_flagsZ
compiler_flag)r$rrrZcodeobZfeaturerrr�__call__�s

zCompile.__call__N)�__name__�
__module__�__qualname__�__doc__r%r)rrrrr	|sc@s"eZdZdZdd�Zd	dd�ZdS)
r
a(Instances of this class have __call__ methods identical in
    signature to compile_command; the difference is that if the
    instance compiles program text containing a __future__ statement,
    the instance 'remembers' and compiles all subsequent program texts
    with the statement in force.cCst�|_dS)N)r	r)r$rrrr%�szCommandCompiler.__init__�<input>r"cCst|j|||�S)a�Compile a command and determine whether it is incomplete.

        Arguments:

        source -- the source string; may contain \n characters
        filename -- optional filename from which source was read;
                    default "<input>"
        symbol -- optional grammar start symbol; "single" (default) or
                  "eval"

        Return value / exceptions raised:

        - Return a code object if the command is complete and valid
        - Return None if the command is incomplete
        - Raise SyntaxError, ValueError or OverflowError if the command is a
          syntax error (OverflowError and ValueError can be produced by
          malformed literals).
        )rr)r$rrrrrrr)�szCommandCompiler.__call__N)r.r")r*r+r,r-r%r)rrrrr
�s)r!r")r-rZall_feature_namesr'�__all__rrr rr	r
rrrr�<module>9s

!
shelve.cpython-36.pyc000064400000022364150335715140010473 0ustar003


 \C!�@s�dZddlmZmZddlmZddlZddddgZGd	d
�d
ej�Z	Gdd�dej�Z
Gdd�de
�ZGd
d�de
�Zddd�Z
dS)a�
Manage shelves of pickled objects.

A "shelf" is a persistent, dictionary-like object.  The difference
with dbm databases is that the values (not the keys!) in a shelf can
be essentially arbitrary Python objects -- anything that the "pickle"
module can handle.  This includes most class instances, recursive data
types, and objects containing lots of shared sub-objects.  The keys
are ordinary strings.

To summarize the interface (key is a string, data is an arbitrary
object):

        import shelve
        d = shelve.open(filename) # open, with (g)dbm filename -- no suffix

        d[key] = data   # store data at key (overwrites old data if
                        # using an existing key)
        data = d[key]   # retrieve a COPY of the data at key (raise
                        # KeyError if no such key) -- NOTE that this
                        # access returns a *copy* of the entry!
        del d[key]      # delete data stored at key (raises KeyError
                        # if no such key)
        flag = key in d # true if the key exists
        list = d.keys() # a list of all existing keys (slow!)

        d.close()       # close it

Dependent on the implementation, closing a persistent dictionary may
or may not be necessary to flush changes to disk.

Normally, d[key] returns a COPY of the entry.  This needs care when
mutable entries are mutated: for example, if d[key] is a list,
        d[key].append(anitem)
does NOT modify the entry d[key] itself, as stored in the persistent
mapping -- it only modifies the copy, which is then immediately
discarded, so that the append has NO effect whatsoever.  To append an
item to d[key] in a way that will affect the persistent mapping, use:
        data = d[key]
        data.append(anitem)
        d[key] = data

To avoid the problem with mutable entries, you may pass the keyword
argument writeback=True in the call to shelve.open.  When you use:
        d = shelve.open(filename, writeback=True)
then d keeps a cache of all entries you access, and writes them all back
to the persistent mapping when you call d.close().  This ensures that
such usage as d[key].append(anitem) works as intended.

However, using keyword argument writeback=True may consume vast amount
of memory for the cache, and it may make d.close() very slow, if you
access many of d's entries after opening it in this way: d has no way to
check which of the entries you access are mutable and/or which ones you
actually mutate, so it must cache, and write back at close, all of the
entries that you access.  You can call d.sync() to write back all the
entries in the cache, and empty the cache (d.sync() also synchronizes
the persistent dictionary on disk, if feasible).
�)�Pickler�	Unpickler)�BytesION�Shelf�
BsdDbShelf�DbfilenameShelf�openc@s8eZdZdZdd�ZeZZZZZ	Z
dd�ZdS)�_ClosedDictz>Marker for a closed dict.  Access attempts raise a ValueError.cGstd��dS)Nz!invalid operation on closed shelf)�
ValueError)�self�args�r
�/usr/lib64/python3.6/shelve.py�closedEsz_ClosedDict.closedcCsdS)Nz<Closed Dictionary>r
)rr
r
r�__repr__Isz_ClosedDict.__repr__N)�__name__�
__module__�__qualname__�__doc__r�__iter__�__len__�__getitem__�__setitem__�__delitem__�keysrr
r
r
rr	Bsr	c@s|eZdZdZddd�Zdd�Zd	d
�Zdd�Zd d
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)!rz�Base class for shelf implementations.

    This is initialized with a dictionary-like object.
    See the module's __doc__ string for an overview of the interface.
    NF�utf-8cCs.||_|dkrd}||_||_i|_||_dS)N�)�dict�	_protocol�	writeback�cache�keyencoding)rr�protocolrr!r
r
r�__init__TszShelf.__init__ccs&x |jj�D]}|j|j�VqWdS)N)rr�decoder!)r�kr
r
rr^szShelf.__iter__cCs
t|j�S)N)�lenr)rr
r
rrbsz
Shelf.__len__cCs|j|j�|jkS)N)�encoder!r)r�keyr
r
r�__contains__eszShelf.__contains__cCs|j|j�|jkr||S|S)N)r'r!r)rr(�defaultr
r
r�gethsz	Shelf.getcCsZy|j|}WnFtk
rTt|j|j|j��}t|�j�}|jrP||j|<YnX|S)N)	r �KeyErrorrrr'r!r�loadr)rr(�value�fr
r
rrmszShelf.__getitem__cCsF|jr||j|<t�}t||j�}|j|�|j�|j|j|j	�<dS)N)
rr rrr�dump�getvaluerr'r!)rr(r.r/�pr
r
rrws

zShelf.__setitem__cCs6|j|j|j�=y|j|=Wntk
r0YnXdS)N)rr'r!r r,)rr(r
r
rrs
zShelf.__delitem__cCs|S)Nr
)rr
r
r�	__enter__�szShelf.__enter__cCs|j�dS)N)�close)r�typer.�	tracebackr
r
r�__exit__�szShelf.__exit__cCsf|jdkrdSz0|j�y|jj�Wntk
r:YnXWdyt�|_Wnd|_YnXXdS)N)r�syncr4�AttributeErrorr	)rr
r
rr4�s

zShelf.closecCst|d�sdS|j�dS)Nr)�hasattrr4)rr
r
r�__del__�s
z
Shelf.__del__cCsX|jr>|jr>d|_x|jj�D]\}}|||<qWd|_i|_t|jd�rT|jj�dS)NFTr8)rr �itemsr:rr8)rr(�entryr
r
rr8�sz
Shelf.sync)NFr)N)rrrrr#rrr)r+rrrr3r7r4r;r8r
r
r
rrMs
	

c@sBeZdZdZddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dS)ra�Shelf implementation using the "BSD" db interface.

    This adds methods first(), next(), previous(), last() and
    set_location() that have no counterpart in [g]dbm databases.

    The actual database must be opened using one of the "bsddb"
    modules "open" routines (i.e. bsddb.hashopen, bsddb.btopen or
    bsddb.rnopen) and passed to the constructor.

    See the module's __doc__ string for an overview of the interface.
    NF�utf-8cCstj|||||�dS)N)rr#)rrr"rr!r
r
rr#�szBsdDbShelf.__init__cCs0|jj|�\}}t|�}|j|j�t|�j�fS)N)r�set_locationrr$r!rr-)rr(r.r/r
r
rr?�szBsdDbShelf.set_locationcCs.t|j�\}}t|�}|j|j�t|�j�fS)N)�nextrrr$r!rr-)rr(r.r/r
r
rr@�szBsdDbShelf.nextcCs.|jj�\}}t|�}|j|j�t|�j�fS)N)r�previousrr$r!rr-)rr(r.r/r
r
rrA�szBsdDbShelf.previouscCs.|jj�\}}t|�}|j|j�t|�j�fS)N)r�firstrr$r!rr-)rr(r.r/r
r
rrB�szBsdDbShelf.firstcCs.|jj�\}}t|�}|j|j�t|�j�fS)N)r�lastrr$r!rr-)rr(r.r/r
r
rrC�szBsdDbShelf.last)NFr>)
rrrrr#r?r@rArBrCr
r
r
rr�s
c@seZdZdZddd�ZdS)rz�Shelf implementation using the "dbm" generic dbm interface.

    This is initialized with the filename for the dbm database.
    See the module's __doc__ string for an overview of the interface.
    �cNFcCs$ddl}tj||j||�||�dS)Nr)�dbmrr#r)r�filename�flagr"rrEr
r
rr#�szDbfilenameShelf.__init__)rDNF)rrrrr#r
r
r
rr�srDFcCst||||�S)a�Open a persistent dictionary for reading and writing.

    The filename parameter is the base filename for the underlying
    database.  As a side-effect, an extension may be added to the
    filename and more than one file may be created.  The optional flag
    parameter has the same interpretation as the flag parameter of
    dbm.open(). The optional protocol parameter specifies the
    version of the pickle protocol.

    See the module's __doc__ string for an overview of the interface.
    )r)rFrGr"rr
r
rr�s
)rDNF)r�picklerr�ior�collections�__all__�MutableMappingr	rrrrr
r
r
r�<module>9sb+numbers.cpython-36.opt-2.pyc000064400000017767150335715140011633 0ustar003


 \(�@s�ddlmZmZdddddgZGdd�ded�ZGd	d�de�Zeje�Gd
d�de�Zeje	�Gdd�de�Z
Gdd�de
�Zeje�d
S)�)�ABCMeta�abstractmethod�Number�Complex�Real�Rational�Integralc@seZdZfZdZdS)rN)�__name__�
__module__�__qualname__�	__slots__�__hash__�rr�/usr/lib64/python3.6/numbers.pyrs)�	metaclassc@s�eZdZfZedd��Zdd�Zeedd���Zeedd���Z	ed	d
��Z
edd��Zed
d��Zedd��Z
dd�Zdd�Zedd��Zedd��Zedd��Zedd��Zedd��Zedd ��Zed!d"��Zed#d$��Zed%d&��Zd'S)(rcCsdS)Nr)�selfrrr�__complex__-szComplex.__complex__cCs|dkS)Nrr)rrrr�__bool__1szComplex.__bool__cCst�dS)N)�NotImplementedError)rrrr�real5szComplex.realcCst�dS)N)r)rrrr�imag>szComplex.imagcCst�dS)N)r)r�otherrrr�__add__GszComplex.__add__cCst�dS)N)r)rrrrr�__radd__LszComplex.__radd__cCst�dS)N)r)rrrr�__neg__QszComplex.__neg__cCst�dS)N)r)rrrr�__pos__VszComplex.__pos__cCs
||S)Nr)rrrrr�__sub__[szComplex.__sub__cCs
||S)Nr)rrrrr�__rsub___szComplex.__rsub__cCst�dS)N)r)rrrrr�__mul__cszComplex.__mul__cCst�dS)N)r)rrrrr�__rmul__hszComplex.__rmul__cCst�dS)N)r)rrrrr�__truediv__mszComplex.__truediv__cCst�dS)N)r)rrrrr�__rtruediv__rszComplex.__rtruediv__cCst�dS)N)r)r�exponentrrr�__pow__wszComplex.__pow__cCst�dS)N)r)r�baserrr�__rpow__|szComplex.__rpow__cCst�dS)N)r)rrrr�__abs__�szComplex.__abs__cCst�dS)N)r)rrrr�	conjugate�szComplex.conjugatecCst�dS)N)r)rrrrr�__eq__�szComplex.__eq__N)r	r
rrrrr�propertyrrrrrrrrrrr r!r#r%r&r'r(rrrrr s,c@s�eZdZfZedd��Zedd��Zedd��Zedd��Zed$d
d��Z	dd
�Z
dd�Zedd��Zedd��Z
edd��Zedd��Zedd��Zedd��Zdd�Zedd��Zed d!��Zd"d#�Zd	S)%rcCst�dS)N)r)rrrr�	__float__�szReal.__float__cCst�dS)N)r)rrrr�	__trunc__�szReal.__trunc__cCst�dS)N)r)rrrr�	__floor__�szReal.__floor__cCst�dS)N)r)rrrr�__ceil__�sz
Real.__ceil__NcCst�dS)N)r)rZndigitsrrr�	__round__�szReal.__round__cCs||||fS)Nr)rrrrr�
__divmod__�szReal.__divmod__cCs||||fS)Nr)rrrrr�__rdivmod__�szReal.__rdivmod__cCst�dS)N)r)rrrrr�__floordiv__�szReal.__floordiv__cCst�dS)N)r)rrrrr�
__rfloordiv__�szReal.__rfloordiv__cCst�dS)N)r)rrrrr�__mod__�szReal.__mod__cCst�dS)N)r)rrrrr�__rmod__�sz
Real.__rmod__cCst�dS)N)r)rrrrr�__lt__�szReal.__lt__cCst�dS)N)r)rrrrr�__le__�szReal.__le__cCstt|��S)N)�complex�float)rrrrr�szReal.__complex__cCs|
S)Nr)rrrrr�sz	Real.realcCsdS)Nrr)rrrrr�sz	Real.imagcCs|
S)Nr)rrrrr'szReal.conjugate)N)r	r
rrrr*r+r,r-r.r/r0r1r2r3r4r5r6rr)rrr'rrrrr�s&	
c@s8eZdZfZeedd���Zeedd���Zdd�ZdS)rcCst�dS)N)r)rrrr�	numeratorszRational.numeratorcCst�dS)N)r)rrrr�denominatorszRational.denominatorcCs|j|jS)N)r9r:)rrrrr*szRational.__float__N)	r	r
rrr)rr9r:r*rrrrrsc@s�eZdZfZedd��Zdd�Zed$dd��Zedd	��Zed
d��Z	edd
��Z
edd��Zedd��Zedd��Z
edd��Zedd��Zedd��Zedd��Zedd��Zdd�Zed d!��Zed"d#��ZdS)%rcCst�dS)N)r)rrrr�__int__+szIntegral.__int__cCst|�S)N)�int)rrrr�	__index__0szIntegral.__index__NcCst�dS)N)r)rr"�modulusrrrr#4s	zIntegral.__pow__cCst�dS)N)r)rrrrr�
__lshift__?szIntegral.__lshift__cCst�dS)N)r)rrrrr�__rlshift__DszIntegral.__rlshift__cCst�dS)N)r)rrrrr�
__rshift__IszIntegral.__rshift__cCst�dS)N)r)rrrrr�__rrshift__NszIntegral.__rrshift__cCst�dS)N)r)rrrrr�__and__SszIntegral.__and__cCst�dS)N)r)rrrrr�__rand__XszIntegral.__rand__cCst�dS)N)r)rrrrr�__xor__]szIntegral.__xor__cCst�dS)N)r)rrrrr�__rxor__bszIntegral.__rxor__cCst�dS)N)r)rrrrr�__or__gszIntegral.__or__cCst�dS)N)r)rrrrr�__ror__lszIntegral.__ror__cCst�dS)N)r)rrrr�
__invert__qszIntegral.__invert__cCstt|��S)N)r8r<)rrrrr*wszIntegral.__float__cCs|
S)Nr)rrrrr9{szIntegral.numeratorcCsdS)N�r)rrrrr:�szIntegral.denominator)N)r	r
rrrr;r=r#r?r@rArBrCrDrErFrGrHrIr*r)r9r:rrrrr&s&
N)
�abcrr�__all__rr�registerr7rr8rrr<rrrr�<module>sp
u
_tabnanny.cpython-36.opt-1.pyc000064400000015501150335715140011751 0ustar003


 \�,�@s�dZdZddlZddlZddlZddlZeed�s:ed��dddgZda	da
d	d
�Zdd�ZGd
d�de
�Zdd�ZGdd�d�Zdd�Zdd�Zedkr�e�dS)a�The Tab Nanny despises ambiguous indentation.  She knows no mercy.

tabnanny -- Detection of ambiguous indentation

For the time being this module is intended to be called as a script.
However it is possible to import it into an IDE and use the function
check() described below.

Warning: The API provided by this module is likely to change in future
releases; such changes may not be backward compatible.
�6�N�NLz4tokenize.NL doesn't exist -- tokenize module too old�check�NannyNag�process_tokenscGs:d}x$|D]}tjj|t|��d}q
Wtjjd�dS)N�� �
)�sys�stderr�write�str)�args�sep�arg�r� /usr/lib64/python3.6/tabnanny.py�errprint#s

rcCs�ytjtjdd�d�\}}Wn*tjk
rH}zt|�dSd}~XnXx0|D](\}}|dkrhtda|dkrPtdaqPW|s�tdtjdd�dSx|D]}t|�q�WdS)N�Zqvz-qz-vzUsage:rz[-v] file_or_directory ...)�getoptr
�argv�errorr�
filename_only�verboser)Zoptsr�msg�o�arrrr�main*s
rc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)rzk
    Raised by process_tokens() if detecting an ambiguous indent.
    Captured and handled in check().
    cCs||||_|_|_dS)N)�linenor�line)�selfrrrrrr�__init__AszNannyNag.__init__cCs|jS)N)r)r rrr�
get_linenoCszNannyNag.get_linenocCs|jS)N)r)r rrr�get_msgEszNannyNag.get_msgcCs|jS)N)r)r rrr�get_lineGszNannyNag.get_lineN)�__name__�
__module__�__qualname__�__doc__r!r"r#r$rrrrr<s
c	%Cs"tjj|�r�tjj|�r�tr,td|f�tj|�}xT|D]L}tjj||�}tjj|�rhtjj|�s�tjj|dd��dkr<t	|�q<WdSyt
j|�}Wn0tk
r�}zt
d||f�dSd}~XnXtdkr�td|��zytt
j|j��W�n�t
jk
�r2}zt
d||f�dSd}~Xn�tk
�rb}zt
d	||f�dSd}~Xn�tk
�r�}z||j�}|j�}t�r�td
||f�td|f�t|j��n6d|k�r�d
|d
}t�r�t|�nt||t|��dSd}~XnXWd|j�Xt�rtd|f�dS)a~check(file_or_dir)

    If file_or_dir is a directory and not a symbolic link, then recursively
    descend the directory tree named by file_or_dir, checking all .py files
    along the way. If file_or_dir is an ordinary Python source file, it is
    checked for whitespace related problems. The diagnostic messages are
    written to standard output using the print statement.
    z%r: listing directory�Nz.pyz%r: I/O Error: %srzchecking %r ...z%r: Token Error: %sz%r: Indentation Error: %sz)%r: *** Line %d: trouble in tab city! ***zoffending line: %rr�"z%r: Clean bill of health.���)�os�path�isdir�islinkr�print�listdir�join�normcaser�tokenize�open�OSErrorrr�generate_tokens�readline�
TokenError�IndentationErrorrr"r$r#r�repr�close)	�file�names�name�fullname�frZnag�badlinerrrrrJsT





c@sLeZdZd\ZZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZdS)�
Whitespacez 	c	Cs�||_tjtj}}g}d}}}x~|jD]t}||krJ|d}|d}q,||kr�|d}|d}|t|�kr�|dg|t|�d}||d||<d}q,Pq,W||_||_t|�|f|_t|�dk|_	dS)Nrr)
�rawrC�S�T�len�n�nt�tuple�norm�	is_simple)	r ZwsrErF�count�brHrIZchrrrr!�s(
zWhitespace.__init__cCs|j\}}tt|�d|�S)Nr)rK�maxrG)r rM�trailingrrr�longest_run_of_spaces�s
z Whitespace.longest_run_of_spacescCsL|j\}}d}x*t|t|��D]}|||||}qW||||jS)Nr)rK�rangerGrI)r �tabsizerMrPZil�irrr�indent_level�s

zWhitespace.indent_levelcCs|j|jkS)N)rK)r �otherrrr�equal�szWhitespace.equalcCsft|j�|j��d}g}xFtd|d�D]4}|j|�|j|�kr*|j||j|�|j|�f�q*W|S)Nr)rOrQrRrU�append)r rVrHr�tsrrr�not_equal_witness�szWhitespace.not_equal_witnesscCsr|j|jkrdS|jr(|jr(|j|jkSt|j�|j��d}x.td|d�D]}|j|�|j|�krNdSqNWdS)NFr�T)rHrLrIrOrQrRrU)r rVrHrYrrr�less�szWhitespace.lesscCsft|j�|j��d}g}xFtd|d�D]4}|j|�|j|�kr*|j||j|�|j|�f�q*W|S)Nr)rOrQrRrUrX)r rVrHrrYrrr�not_less_witnessszWhitespace.not_less_witnessN)r%r&r'rErFr!rQrUrWrZr\r]rrrrrC�srCcCs8dd�|D�}d}t|�dkr&|d}|ddj|�S)Ncss|]}t|d�VqdS)rN)r
)�.0�tuprrr�	<genexpr>sz#format_witnesses.<locals>.<genexpr>zat tab sizer�srz, )rGr2)�wZfirsts�prefixrrr�format_witnesses
s
rdcCstj}tj}tj}tjtjf}td�g}d}x�|D]�\}}}	}
}||krNd}q2||kr�d}t|�}|dj|�s�|dj|�}
dt	|
�}t
|	d||��|j|�q2||kr�d}|d=q2|o�||kr2d}t|�}|d	j|�s2|d
j
|�}
dt	|
�}t
|	d||��q2WdS)Nrrrzindent not greater e.g. zindent not equal e.g. ���rererere)r4�INDENT�DEDENT�NEWLINE�COMMENTrrCr\r]rdrrXrWrZ)�tokensrfrgrhZJUNK�indentsZcheck_equal�type�token�start�endrZthisguyZwitnessrrrrrs6

�__main__)r(�__version__r,r
rr4�hasattr�
ValueError�__all__rrrr�	ExceptionrrrCrdrr%rrrr�<module>
s(

=7queue.cpython-36.opt-2.pyc000064400000011547150335715140011272 0ustar003


 \L"�
@s�yddlZWnek
r(ddlZYnXddlmZddlmZmZddlm	Zddddd	gZ
Gd
d�de�ZGdd�de�Z
Gdd�d�ZGd
d�de�ZGdd	�d	e�ZdS)�N)�deque)�heappush�heappop)�	monotonic�Empty�Full�Queue�
PriorityQueue�	LifoQueuec@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/queue.pyr
sc@seZdZdS)rN)rrr
rrrrrsc@s�eZdZd dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zd!dd�Z	d"dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)#rrcCsN||_|j|�tj�|_tj|j�|_tj|j�|_tj|j�|_d|_	dS)Nr)
�maxsize�_init�	threadingZLock�mutexZ	Condition�	not_empty�not_full�all_tasks_done�unfinished_tasks)�selfrrrr�__init__s

zQueue.__init__c	CsH|j�8|jd}|dkr4|dkr*td��|jj�||_WdQRXdS)N�rz!task_done() called too many times)rr�
ValueErrorZ
notify_all)rZ
unfinishedrrr�	task_done2s

zQueue.task_donec	Cs,|j�x|jr|jj�q
WWdQRXdS)N)rr�wait)rrrr�joinHs	z
Queue.joinc	Cs|j�
|j�SQRXdS)N)r�_qsize)rrrr�qsizeUszQueue.qsizec	Cs|j�|j�SQRXdS)N)rr)rrrr�emptyZszQueue.emptyc
Cs0|j� d|jko |j�kSSQRXdS)Nr)rrr)rrrr�fullhsz
Queue.fullTNc
Cs�|j��|jdkr�|s*|j�|jkr�t�nz|dkrRxp|j�|jkrN|jj�q4WnR|dkrdtd��n@t�|}x4|j�|jkr�|t�}|dkr�t�|jj|�qpW|j|�|jd7_|j	j
�WdQRXdS)Nrz''timeout' must be a non-negative numbergr)rrrrrr�time�_putrr�notify)r�item�block�timeout�endtime�	remainingrrr�putss&




z	Queue.putc	Cs�|j��|s|j�s�t�nn|dkr<xd|j�s8|jj�q$WnL|dkrNtd��n:t�|}x.|j�s�|t�}|dkrxt�|jj|�qZW|j�}|jj�|SQRXdS)Nrz''timeout' must be a non-negative numberg)	rrrrrr#�_getrr%)rr'r(r)r*r&rrr�get�s$





z	Queue.getcCs|j|dd�S)NF)r')r+)rr&rrr�
put_nowait�szQueue.put_nowaitcCs|jdd�S)NF)r')r-)rrrr�
get_nowait�szQueue.get_nowaitcCst�|_dS)N)r�queue)rrrrrr�szQueue._initcCs
t|j�S)N)�lenr0)rrrrr�szQueue._qsizecCs|jj|�dS)N)r0�append)rr&rrrr$�sz
Queue._putcCs
|jj�S)N)r0�popleft)rrrrr,�sz
Queue._get)r)TN)TN)rrr
rrrr r!r"r+r-r.r/rrr$r,rrrrrs


 

c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
r	cCs
g|_dS)N)r0)rrrrrr�szPriorityQueue._initcCs
t|j�S)N)r1r0)rrrrr�szPriorityQueue._qsizecCst|j|�dS)N)rr0)rr&rrrr$�szPriorityQueue._putcCs
t|j�S)N)rr0)rrrrr,�szPriorityQueue._getN)rrr
rrr$r,rrrrr	�sc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
r
cCs
g|_dS)N)r0)rrrrrr�szLifoQueue._initcCs
t|j�S)N)r1r0)rrrrr�szLifoQueue._qsizecCs|jj|�dS)N)r0r2)rr&rrrr$�szLifoQueue._putcCs
|jj�S)N)r0�pop)rrrrr,�szLifoQueue._getN)rrr
rrr$r,rrrrr
�s)r�ImportErrorZdummy_threading�collectionsr�heapqrrr#r�__all__�	Exceptionrrrr	r
rrrr�<module>sBio.cpython-36.pyc000064400000006475150335715140007621 0ustar003


 \�
�@sldZdZdddddddd	d
ddd
ddddddgZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZejZde_dZdZdZGdd�dejejd�ZGdd�deje�ZGdd	�d	eje�ZGdd�deje�Zej e	�x"e
ee
eefD]Z!ej e!��qWxeefD]Z!ej e!��q W[!yddlm"Z"Wne#k
�r\YnXej e"�dS) a�The io module provides the Python interfaces to stream handling. The
builtin open function is defined in this module.

At the top of the I/O hierarchy is the abstract base class IOBase. It
defines the basic interface to a stream. Note, however, that there is no
separation between reading and writing to streams; implementations are
allowed to raise an OSError if they do not support a given operation.

Extending IOBase is RawIOBase which deals simply with the reading and
writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide
an interface to OS files.

BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its
subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer
streams that are readable, writable, and both respectively.
BufferedRandom provides a buffered interface to random access
streams. BytesIO is a simple stream of in-memory bytes.

Another IOBase subclass, TextIOBase, deals with the encoding and decoding
of streams into text. TextIOWrapper, which extends it, is a buffered text
interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO
is an in-memory stream for text.

Argument names are not part of the specification, and only the arguments
of open() are intended to be used as keyword arguments.

data:

DEFAULT_BUFFER_SIZE

   An int containing the default buffer size used by the module's buffered
   I/O classes. open() uses the file's blksize (as obtained by os.stat) if
   possible.
z�Guido van Rossum <guido@python.org>, Mike Verdone <mike.verdone@gmail.com>, Mark Russell <mark.russell@zen.co.uk>, Antoine Pitrou <solipsis@pitrou.net>, Amaury Forgeot d'Arc <amauryfa@gmail.com>, Benjamin Peterson <benjamin@python.org>�BlockingIOError�open�IOBase�	RawIOBase�FileIO�BytesIO�StringIO�BufferedIOBase�BufferedReader�BufferedWriter�BufferedRWPair�BufferedRandom�
TextIOBase�
TextIOWrapper�UnsupportedOperation�SEEK_SET�SEEK_CUR�SEEK_END�N)
�DEFAULT_BUFFER_SIZErrrrrrr	r
rr�IncrementalNewlineDecoderr�io��c@seZdZejjZdS)rN)�__name__�
__module__�__qualname__�_io�_IOBase�__doc__�rr�/usr/lib64/python3.6/io.pyrHs)�	metaclassc@seZdZejjZdS)rN)rrrr�
_RawIOBaserrrrr rKsc@seZdZejjZdS)rN)rrrr�_BufferedIOBaserrrrr rNsc@seZdZejjZdS)r
N)rrrr�_TextIOBaserrrrr r
Qs)�_WindowsConsoleIO)$r�
__author__�__all__r�abcrrrrrrrr	r
rrrr�OpenWrapperrrrrr�ABCMetarr"rr#rr$r
�register�klassr%�ImportErrorrrrr �<module>"s<
<


pprint.cpython-36.opt-1.pyc000064400000036633150335715140011464 0ustar003


 \|Q�
@s�dZddlZddlZddlZddlZddlm	Z
dddddd	gZd!dd
�dd�Zd"dd
�dd�Z
dd�Zdd�Zdd�ZGdd�d�Zdd�ZGdd	�d	�Zdd�Zeeeeeeeeed�h�Zdd�Zd#dd�Z dd�Z!e"d kr�e �dS)$a/Support to pretty-print lists, tuples, & dictionaries recursively.

Very simple, but useful, especially in debugging data structures.

Classes
-------

PrettyPrinter()
    Handle pretty-printing operations onto a stream using a configured
    set of formatting parameters.

Functions
---------

pformat()
    Format a Python object into a pretty-printed representation.

pprint()
    Pretty-print a Python object to a stream [default is sys.stdout].

saferepr()
    Generate a 'standard' repr()-like value, but protect against recursive
    data structures.

�N)�StringIO�pprint�pformat�
isreadable�isrecursive�saferepr�
PrettyPrinter��PF)�compactcCs t|||||d�}|j|�dS)zAPretty-print a Python object to a stream [default is sys.stdout].)�stream�indent�width�depthrN)rr)�objectrr
rrrZprinter�r�/usr/lib64/python3.6/pprint.pyr/scCst||||d�j|�S)z<Format a Python object into a pretty-printed representation.)r
rrr)rr)rr
rrrrrrr7scCst|idd�dS)z=Version of repr() which can handle recursive data structures.Nr)�
_safe_repr)rrrrr<scCst|idd�dS)z4Determine if saferepr(object) is readable by eval().Nrr	)r)rrrrr@scCst|idd�dS)z8Determine if object requires a recursive representation.Nr�)r)rrrrrDsc@s&eZdZdZdgZdd�Zdd�ZdS)�	_safe_keyaUHelper function for key functions when sorting unorderable objects.

    The wrapped-object will fallback to a Py2.x style comparison for
    unorderable types (sorting first comparing the type name and then by
    the obj ids).  Does not work recursively, so dict.items() must have
    _safe_key applied to both the key and the value.

    �objcCs
||_dS)N)r)�selfrrrr�__init__Tsz_safe_key.__init__cCsRy|j|jkStk
rLtt|j��t|j�ftt|j��t|j�fkSXdS)N)r�	TypeError�str�type�id)r�otherrrr�__lt__Ws
z_safe_key.__lt__N)�__name__�
__module__�__qualname__�__doc__�	__slots__rrrrrrrHsrcCst|d�t|d�fS)z&Helper function for comparing 2-tuplesrr	)r)�trrr�_safe_tuple^sr%c@s�eZdZd:dd�dd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�ZiZ	dd�Z
e
e	ej<dd�Z
e
e	ejj<dd�Zee	ej<dd�Zee	ej<dd�Zee	ej<ee	ej<dd�Zee	ej<dd�Zee	ej<d d!�Zee	ej<d"d#�Zee	ejj<d$d%�Z d&d'�Z!d(d)�Z"d*d+�Z#d,d-�Z$e$e	ej%j<d.d/�Z&e&e	ej'j<d0d1�Z(e(e	ej)j<d2d3�Z*e*e	ej+j<d4d5�Z,e,e	ej-j<d6d7�Z.e.e	ej/j<d8d9�Z0e0e	ej1j<dS);rr	r
NF)rcCs|t|�}t|�}|dkr td��|dk	r8|dkr8td��|sDtd��||_||_||_|dk	rf||_ntj|_t|�|_	dS)aDHandle pretty printing operations onto a stream using a set of
        configured parameters.

        indent
            Number of spaces to indent for each level of nesting.

        width
            Attempted maximum number of columns in the output.

        depth
            The maximum depth to print out nested structures.

        stream
            The desired output stream.  If omitted (or false), the standard
            output stream available at construction will be used.

        compact
            If true, several items will be combined in one line.

        rzindent must be >= 0Nzdepth must be > 0zwidth must be != 0)
�int�
ValueError�_depth�_indent_per_level�_width�_stream�_sys�stdout�bool�_compact)rr
rrrrrrrrcszPrettyPrinter.__init__cCs&|j||jddid�|jjd�dS)Nr�
)�_formatr+�write)rrrrrr�szPrettyPrinter.pprintcCs"t�}|j||ddid�|j�S)Nr)�	_StringIOr1�getvalue)rrZsiorrrr�szPrettyPrinter.pformatcCs|j|idd�dS)Nrr)�format)rrrrrr�szPrettyPrinter.isrecursivecCs |j|idd�\}}}|o|S)Nr)r5)rr�s�readable�	recursiverrrr�szPrettyPrinter.isreadablec	Cs�t|�}||kr.|jt|��d|_d|_dS|j|||�}|j||}	t|�|	kr�|jj	t
|�jd�}
|
dk	r�d||<|
|||||||d�||=dSt|t
�r�d||<|j||||||d�||=dS|j|�dS)NTFr	)rr2�
_recursion�
_recursive�	_readable�_reprr*�len�	_dispatch�getr�__repr__�
isinstance�dict�_pprint_dict)rrrr
�	allowance�context�level�objid�rep�	max_width�prrrr1�s,
zPrettyPrinter._formatc
Csj|j}|d�|jdkr*||jdd�t|�}|r^t|j�td�}	|j|	|||d||�|d�dS)N�{r	� )�key�})r2r)r=�sorted�itemsr%�_format_dict_items)
rrrr
rDrErFr2ZlengthrPrrrrC�s
zPrettyPrinter._pprint_dictcCslt|�s|jt|��dS|j}|j|jd�|jt|j��||t|j�d|d||�|jd�dS)N�(r	�))r=r2�repr�	__class__rr1�listrP)rrrr
rDrErF�clsrrr�_pprint_ordered_dict�sz"PrettyPrinter._pprint_ordered_dictcCs0|jd�|j||||d||�|jd�dS)N�[r	�])r2�
_format_items)rrrr
rDrErFrrr�_pprint_list�s
zPrettyPrinter._pprint_listcCsH|jd�t|�dkrdnd}|j||||t|�||�|j|�dS)NrRr	z,)rS)r2r=r[)rrrr
rDrErF�endcharrrr�
_pprint_tuple�s

zPrettyPrinter._pprint_tuplec	Cs�t|�s|jt|��dS|j}|tkr8|jd�d}n&|j|jd�d}|t|j�d7}t|td�}|j||||t|�||�|j|�dS)NrKrNz({z})r	)rM)	r=r2rTrU�setrrOrr[)	rrrr
rDrErF�typr]rrr�_pprint_set�s
zPrettyPrinter._pprint_setcCs�|j}t|�s|t|��dSg}|jd�}	|dkrD|d7}|d7}|j|}
}x�t|	�D]�\}}
t|
�}|t|	�dkr�|
|8}
t|�|
kr�|j|�q\tjd|
�}|j	�|}d}xtt|�D]h\}}||}|t|�dkr�|t|	�dkr�||8}tt|��|k�r&|�r |jt|��|}q�|}q�W|r\|jt|��q\Wt|�dk�r^||�dS|dk�rp|d�x8t|�D],\}}|dk�r�|dd|�||��qzW|dk�r�|d	�dS)
NTr	z\S*\s*�rRrr0rLrS)
r2r=rT�
splitlinesr*�	enumerate�append�re�findall�pop)rrrr
rDrErFr2Zchunks�linesZ
max_width1rI�i�linerH�partsZ
max_width2�current�j�part�	candidaterrr�_pprint_str�sT
 


zPrettyPrinter._pprint_strcCs�|j}t|�dkr"|t|��dS|dk}|rF|d7}|d7}|d�d}	x:t||j||�D]$}
||	�||
�|	s^dd|}	q^W|r�|d�dS)N�r	rRrbr0rLrS)r2r=rT�_wrap_bytes_reprr*)rrrr
rDrErFr2Zparens�delimrHrrr�
_pprint_bytes's"zPrettyPrinter._pprint_bytescCs>|j}|d�|jt|�||d|d||d�|d�dS)Nz
bytearray(�
r	rS)r2ru�bytes)rrrr
rDrErFr2rrr�_pprint_bytearray<s
zPrettyPrinter._pprint_bytearraycCs8|jd�|j|j�||d|d||�|jd�dS)Nz
mappingproxy(�
r	rS)r2r1�copy)rrrr
rDrErFrrr�_pprint_mappingproxyEs
z"PrettyPrinter._pprint_mappingproxycCs�|j}||j7}dd|}t|�d}	xrt|�D]f\}
\}}|
|	k}
|j|||�}||�|d�|j|||t|�d|
r�|nd||�|
s2||�q2WdS)Nz,
rLr	z: r)r2r)r=rdr<r1)rrPrr
rDrErFr2�delimnlZ
last_indexrjrM�ent�lastrHrrrrQMs

z PrettyPrinter._format_dict_itemscCsN|j}||j7}|jdkr,||jdd�dd|}d}	|j|d}
}t|�}yt|�}
Wntk
rvdSXd}x�|�sH|
}yt|�}
Wn(tk
r�d}||8}|
|8}
YnX|j�r|j|||�}t|�d}|
|kr�|}
|	r�|}	|
|k�r|
|8}
||	�d}	||�q~||	�|}	|j	||||�r<|nd||�q~WdS)	Nr	rLz,
rbFTrz, )
r2r)r*�iter�next�
StopIterationr/r<r=r1)rrPrr
rDrErFr2r|rtrrI�itZnext_entr~r}rH�wrrrr[^sN



zPrettyPrinter._format_itemscCs4|j||j�|j|�\}}}|s&d|_|r0d|_|S)NFT)r5rzr(r;r:)rrrErFrTr7r8rrrr<�szPrettyPrinter._reprcCst||||�S)z�Format object for a specific context, returning a string
        and flags indicating whether the representation is 'readable'
        and whether the object represents a recursive construct.
        )r)rrrE�	maxlevelsrFrrrr5�szPrettyPrinter.formatc	Cs�t|�s|jt|��dS|j|j||�}|j}|t|j�d7}|jd|j|d|f�|j||||d||�|jd�dS)Nr	z	%s(%s,
%srLrS)r=r2rTr<�default_factoryrUrrC)	rrrr
rDrErFZrdfrWrrr�_pprint_default_dict�sz"PrettyPrinter._pprint_default_dictc	Cs�t|�s|jt|��dS|j}|j|jd�|jdkrN|j|jdd�|j�}|j|||t|j�d|d||�|jd�dS)Nz({r	rLrz}))r=r2rTrUrr)�most_commonrQ)	rrrr
rDrErFrWrPrrr�_pprint_counter�s
zPrettyPrinter._pprint_counterc
Cs�t|j�s|jt|��dS|j}|j|jd�|t|j�d7}xrt|j�D]d\}}	|t|j�dkr�|j|	|||d||�|jd�qP|j|	||d||�|jdd|�qPWdS)NrRr	rSz,
rL)r=�mapsr2rTrUrrdr1)
rrrr
rDrErFrWrj�mrrr�_pprint_chain_map�s
zPrettyPrinter._pprint_chain_mapc	Cs�t|�s|jt|��dS|j}|j|jd�|t|j�d7}|jd�|jdkrz|j||||d||�|jd�n:|j|||d||�|j|j||�}|jdd||f�dS)NrRr	rYrz])z],
%smaxlen=%s)rL)r=r2rTrUr�maxlenr[r<)	rrrr
rDrErFrWZrmlrrr�
_pprint_deque�s

zPrettyPrinter._pprint_dequecCs|j|j|||||d�dS)Nr	)r1�data)rrrr
rDrErFrrr�_pprint_user_dict�szPrettyPrinter._pprint_user_dictcCs|j|j|||||d�dS)Nr	)r1r�)rrrr
rDrErFrrr�_pprint_user_list�szPrettyPrinter._pprint_user_listcCs|j|j|||||d�dS)Nr	)r1r�)rrrr
rDrErFrrr�_pprint_user_string�sz!PrettyPrinter._pprint_user_string)r	r
NN)2rr r!rrrrrr1r>rCrBr@rX�_collections�OrderedDictr\rVr^�tuplerar_�	frozensetrqrrurwrx�	bytearrayr{�_types�MappingProxyTyperQr[r<r5r��defaultdictr��Counterr��ChainMapr��dequer��UserDictr��UserListr��
UserStringrrrrrbsZ&




1


)	cCs�t|�}|tkrt|�ddfSt|dd�}t|t�o<|tjk�r8|sHdSt|�}|rj||krjdd||kfS||kr�t|�ddfSd||<d}d}g}	|	j	}
|d7}t
}t|j�t
d�}xf|D]^\}
}||
|||�\}}}|||||�\}}}|
d||f�|�o
|�o
|}|�s|r�d}q�W||=d	d
j|	�||fSt|t��rP|tjk�sht|t��rd|tjk�rdt|t��r�|�s~dSd}n"t|�dk�r�d
}n|�s�dSd}t|�}|�r�||k�r�|dd||kfS||k�r�t|�ddfSd||<d}d}g}	|	j	}
|d7}x>|D]6}t
||||�\}}}|
|�|�s:d}|�rd}�qW||=|d
j|	�||fSt|�}||�o~|jd�dfS)NTFr@�{}z{...}r	)rMz%s: %sz{%s}z, �[]z[%s]z(%s,)�()z(%s)z...�<)r�TF)r�TF)r�TF)r�_builtin_scalarsrT�getattr�
issubclassrBr@rr9rerrOrPr%�joinrVr�r=�
startswith)rrEr�rFr`�rrGr7r8Z
componentsrerrP�k�vZkreprZ	kreadableZkrecurZvreprZ	vreadableZvrecurr5�oZoreprZ	oreadableZorecurrHrrrr�s|



rcCsdt|�jt|�fS)Nz<Recursion on %s with id=%s>)rrr)rrrrr91sr9cCs�ddl}|dkr,dd
ddgddd	�fgd
}t�}|j�}t|idd�|j�}|j|�|j�}td||�td||�dS)Nr�stringr	r�rr��)��i��z_safe_repr:zpformat:)r	r)�timerrr�print)rr�rJZt1Zt2Zt3rrr�
_perfcheck6s
r�ccs�d}t|�dd}xhtdt|�d�D]T}|||d�}||}||krR||8}tt|��|krv|rpt|�V|}q&|}q&W|r�t|�VdS)N�rrr)r=�rangerT)rrrDrmr~rjrorprrrrsCs
rs�__main__)Nr	r
N)r	r
N)N)#r"�collectionsr�rf�sysr,�typesr��iorr3�__all__rrrrrrr%rrr�rrwr�r&�float�complexr.rr�r9r�rsrrrrr�<module>#s6
D

pdb.cpython-36.opt-1.pyc000064400000131727150335715140010715 0ustar003


 \���"@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
Gdd�de�Zddddd	d
ddd
g	Zdd�Zdd�Zdd�ZGdd�de�ZdZGdd�dejej�Zedk	�rbd
ddddddddd d!d"d#d$d%d&d'd(dd)d*d+d,d-d.d/d0d1d2d3d4d5d6d7g"Zx*eD]"Zeeed8e�jj�d97Z�q,Weejj7Z[[dId:d�ZdJd;d�Z d<d	�Z!d=d
�Z"d>d�Z#dKd?d�Z$d@d�Z%dAZ&dBdC�Z'dDd
�Z(dEZ)dFdG�Z*e+dHk�r�ddl,Z,e,j*�dS)La�	
The Python Debugger Pdb
=======================

To use the debugger in its simplest form:

        >>> import pdb
        >>> pdb.run('<a statement>')

The debugger's prompt is '(Pdb) '.  This will stop in the first
function call in <a statement>.

Alternatively, if a statement terminated with an unhandled exception,
you can use pdb's post-mortem facility to inspect the contents of the
traceback:

        >>> <a statement>
        <exception traceback>
        >>> import pdb
        >>> pdb.pm()

The commands recognized by the debugger are listed in the next
section.  Most can be abbreviated as indicated; e.g., h(elp) means
that 'help' can be typed as 'h' or 'help' (but not as 'he' or 'hel',
nor as 'H' or 'Help' or 'HELP').  Optional arguments are enclosed in
square brackets.  Alternatives in the command syntax are separated
by a vertical bar (|).

A blank line repeats the previous command literally, except for
'list', where it lists the next 11 lines.

Commands that the debugger doesn't recognize are assumed to be Python
statements and are executed in the context of the program being
debugged.  Python statements can also be prefixed with an exclamation
point ('!').  This is a powerful way to inspect the program being
debugged; it is even possible to change variables or call functions.
When an exception occurs in such a statement, the exception name is
printed but the debugger's state is not changed.

The debugger supports aliases, which can save typing.  And aliases can
have parameters (see the alias help entry) which allows one a certain
level of adaptability to the context under examination.

Multiple commands may be entered on a single line, separated by the
pair ';;'.  No intelligence is applied to separating the commands; the
input is split at the first ';;', even if it is in the middle of a
quoted string.

If a file ".pdbrc" exists in your home directory or in the current
directory, it is read in and executed as if it had been typed at the
debugger prompt.  This is particularly useful for aliases.  If both
files exist, the one in the home directory is read first and aliases
defined there can be overridden by the local file.  This behavior can be
disabled by passing the "readrc=False" argument to the Pdb constructor.

Aside from aliases, the debugger is not directly programmable; but it
is implemented as a class from which you can derive your own debugger
class, which you can make as fancy as you like.


Debugger commands
=================

�Nc@seZdZdZdS)�RestartzBCauses a debugger to be restarted for the debugged python program.N)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.6/pdb.pyrUsr�run�pm�Pdb�runeval�runctx�runcall�	set_trace�post_mortem�helpcCsxtjdtj|��}yt|�}Wntk
r4dSX|�4x,t|dd�D]\}}|j|�rJ|||fSqJWWdQRXdS)Nzdef\s+%s\s*[(]�)�start)�re�compile�escape�open�OSError�	enumerate�match)�funcname�filenameZcre�fp�lineno�linerrr�
find_function\s
r cCsXtj|�\}}tj|�r,|j|jkr,|dfStj|�r>|dfStj||d��|dfS)Nr)�inspectZ
findsourceZisframe�	f_globals�f_localsZismoduleZgetblock)�obj�linesrrrr�getsourcelinesis
r&cCs8ttj|��}|j�x|D]\}}||kr|SqWdS)Nr)�list�disZfindlinestarts�reverse)�codeZlastiZ
linestarts�irrrr�lasti2linenorsr,c@seZdZdZdd�ZdS)�_rstrz#String that doesn't quote its repr.cCs|S)Nr)�selfrrr�__repr__}sz_rstr.__repr__N)rrrrr/rrrrr-{sr-z
-> c@seZdZdZd�dd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�ZeZd�d8d9�Zd:d;�ZeZ eZ!eZ"d<d=�Z#eZ$d>d?�Z%d@dA�Z&dBdC�Z'eZ(dDdE�Z)eZ*dFdG�Z+eZ,dHdI�Z-eZ.dJdK�Z/e/Z0eZ1eZ2dLdM�Z3e3Z4e3Z5dNdO�Z6dPdQ�Z7e7Z8dRdS�Z9e9Z:dTdU�Z;e;Z<dVdW�Z=e=Z>dXdY�Z?e?Z@dZd[�ZAeAZBd\d]�ZCeCZDd^d_�ZEeEZFZGd`da�ZHeHZIdbdc�ZJeZKddde�ZLeLZMeLZNdfdg�ZOdhdi�ZPePZQdjdk�ZReRZSdldm�ZTd�dndo�ZUdpdq�ZVdrds�ZWeZXeZYeZZdtdu�Z[e[Z\dvdw�Z]e]Z^dxdy�Z_eZ`fdfdzd{�Zad|d}�ZbeZcd~d�ZdeZed�d��Zfd�d��Zgd�d��Zhd�d��Zid�d��Zjd�d��Zkd�d�d�d�d�d�gZld�d��Zmenfd�d��Zod�d��ZpepZqd�d��Zrd�d��Zsd�d��Ztd�d��ZudS)�rN�tabFTc
$CsJtjj||d�tjj||||�|r,d|_d|_i|_i|_d|_	d|_
i|_yddl}|j
d�Wntk
rzYnXd|_||_g|_|�r(dtjkr�tjd}y.ttjj|d���}	|jj|	�WdQRXWntk
r�YnXy$td��}	|jj|	�WdQRXWntk
�r&YnXi|_i|_i|_d|_d|_dS)	N)�skiprz(Pdb) �Fz 	
`@#$%^&*()=+[{]}\|;:'",<>?�HOMEz.pdbrc)�bdb�Bdb�__init__�cmd�CmdZuse_rawinput�prompt�aliases�
displaying�
mainpyfile�_wait_for_mainpyfile�	tb_lineno�readlineZset_completer_delims�ImportError�allow_kbdint�nosigint�rcLines�os�environr�path�join�extendr�commands�commands_doprompt�commands_silent�commands_defining�
commands_bnum)
r.�completekey�stdin�stdoutr1rBZreadrcr?ZenvHomeZrcFilerrrr6�sH


zPdb.__init__cCs*|jr
t�|jd�|j�|j|�dS)Nz-
Program interrupted. (Use 'cont' to resume).)rA�KeyboardInterrupt�message�set_stepr)r.Zsignum�framerrr�sigint_handler�s

zPdb.sigint_handlercCstjj|�|j�dS)N)r4r5�reset�forget)r.rrrrV�sz	Pdb.resetcCs&d|_g|_d|_d|_|jj�dS)Nr)r�stack�curindex�curframer>�clear)r.rrrrW�s
z
Pdb.forgetcCsl|j�|j||�\|_|_x*|rFt|jj|j�}||j|j<|j	}qW|j|jd|_
|j
j|_|j
�S)Nr)rWZ	get_stackrXrYr,�tb_frame�f_code�tb_lastir>�tb_nextrZr#�curframe_locals�execRcLines)r.�f�tbrrrr�setup�s

z	Pdb.setupcCsh|js
dS|j}|j�g|_xD|rb|j�j�}|r |ddkr |j|�r |jt|�7_dSq WdS)Nr�#T)rCr)�pop�strip�onecmd�reversed)r.rCrrrrra�s
zPdb.execRcLinescCs.|jr
dS|j|�r*|jd�|j|d�dS)znThis method is called when there is the remote possibility
        that we ever need to stop in this function.Nz--Call--)r=Z	stop_hererR�interaction)r.rTZ
argument_listrrr�	user_call�s


z
Pdb.user_callcCsH|jr.|j|j|jj�ks$|jdkr(dSd|_|j|�rD|j|d�dS)z;This function is called when we stop or break at this line.rNF)r=r<�canonicr]�co_filename�f_lineno�bp_commandsrj)r.rTrrr�	user_line�s

z
Pdb.user_linecCs�t|dd�r�|j|jkr�|j}d|_|j}|j|d�x|j|D]}|j|�qBW||_|j|sv|j|j|j	�|j
|r�|j�|j�dSdS)z�Call every command that was set for the current active breakpoint
        (if there is one).

        Returns True if the normal interaction function must be called,
        False otherwise.�	currentbpFrNr)
�getattrrqrI�lastcmdrdrhrK�print_stack_entryrXrYrJ�_cmdlooprW)r.rTrqZlastcmd_backrrrrros 

zPdb.bp_commandscCs.|jr
dS||jd<|jd�|j|d�dS)z7This function is called when a return trap is set here.N�
__return__z
--Return--)r=r#rRrj)r.rTZreturn_valuerrr�user_returns


zPdb.user_returncCsj|jr
dS|\}}}||f|jd<|r4|tkr4dnd}|jd|tj||�dj�f�|j||�dS)zoThis function is called if an exception occurs,
        but only if we are to stop at or just below this level.NZ
__exception__z	Internal r2z%s%sr���)r=r#�
StopIterationrR�	traceback�format_exception_onlyrgrj)r.rT�exc_info�exc_type�	exc_value�
exc_traceback�prefixrrr�user_exception's
zPdb.user_exceptioncCsDx>yd|_|j�d|_PWqtk
r:|jd�YqXqWdS)NTFz--KeyboardInterrupt--)rA�cmdlooprQrR)r.rrrru;szPdb._cmdloopcCsb|jj|j�}|r^xJ|j�D]>\}}|j|�}||k	r||kr|||<|jd|||f�qWdS)Nzdisplay %s: %r  [old: %r])r;�getrZ�items�_getval_exceptrR)r.r;�exprZoldvalueZnewvaluerrr�preloopHs
zPdb.preloopcCsZtjrtjtjtj�dt_|j||�r4|j�dS|j|j|j�|j	�|j�dS)N)
r�_previous_sigint_handler�signal�SIGINTrdrWrtrXrYru)r.rTrzrrrrjUszPdb.interactioncCs|dk	r|jt|��dS)z{Custom displayhook for the exec in default(), which prevents
        assignment of the _ variable in the builtins.
        N)rR�repr)r.r$rrr�displayhookcszPdb.displayhookc	Cs�|dd�dkr|dd�}|j}|jj}ydt|ddd�}tj}tj}tj}z(|jt_|jt_|jt_t|||�Wd|t_|t_|t_XWn4tj	�dd�}|j
tj|�dj
��YnXdS)Nr�!�
z<stdin>Zsingle�rx)r`rZr"r�sysrPrOr��execr|�errorrzr{rg)	r.r�locals�globalsr*Zsave_stdoutZ
save_stdinZsave_displayhookr|rrr�defaultks(zPdb.defaultcCs�|j�s|S|j�}xx|d|jkr�|j|d}d}x0|dd�D] }|jdt|�|�}|d7}qDW|jddj|dd���}|j�}qW|ddkr�|jd�}|dkr�||d	d�j�}|jj	|�|d|�j
�}|S)
z*Handle alias expansion and ';;' separator.rrN�%z%*� �aliasz;;r�)rg�splitr:�replace�strrG�find�lstrip�cmdqueue�append�rstrip)r.r�argsZiiZtmpArgZmarker�nextrrr�precmd�s&
z
Pdb.precmdcCs"|jstjj||�S|j|�SdS)z�Interpret the argument as though it had been typed in response
        to the prompt.

        Checks whether this line is typed at the normal prompt or in
        a breakpoint command list definition.
        N)rLr7r8rh�handle_command_def)r.rrrrrh�sz
Pdb.onecmdcCs�|j|�\}}}|sdS|dkr0d|j|j<dS|dkrBg|_dS|j|j}|rf|j|d|�n
|j|�yt|d|�}Wntk
r�|j}YnX|j	|j
kr�d|j|j<g|_dSdS)	z8Handles one command line during command list definition.NZsilentT�endrr��do_F)Z	parselinerKrMr�rIr�rr�AttributeErrorr�r�commands_resumingrJ)r.rr7�argZcmdlist�funcrrrr��s,
zPdb.handle_command_defcCst||jd�dS)N)�file)�printrP)r.�msgrrrrR�szPdb.messagecCstd||jd�dS)Nz***)r�)r�rP)r.r�rrrr��sz	Pdb.errorcCs�|j�jd�rgSy|j||||�}Wntk
r>g}YnXtj|d�}xP|D]H}tjj|�rt|j|d�qTtjj	|�rT|j
�jd�rT|j|d�qTW|S)	N�:�,�*�/�.py�.pyw)r�r�)r�r�)rg�endswith�_complete_expression�	Exception�globrDrF�isdirr��isfile�lower)r.�textr�begidx�endidxZret�globs�fnrrr�_complete_location�s

zPdb._complete_locationcs�fdd�ttjj�D�S)Ncs.g|]&\}}|dk	rt|�j��rt|��qS)N)r��
startswith)�.0r+�bp)r�rr�
<listcomp>�sz*Pdb._complete_bpnumber.<locals>.<listcomp>)rr4�
Breakpoint�
bpbynumber)r.r�rr�r�r)r�r�_complete_bpnumber�szPdb._complete_bpnumbercs�|js
gS|jjj�}|j|j�d�kr��jd��y0|�d}x�dd�D]}t||�}qPWWnttfk
r|gSXdj	�dd��d���fdd�t
|�D�S�fdd�|j�D�SdS)	N�.rrcs"g|]}|j�d�r�|�qS)rrx)r�)r��n)�dottedr�rrr��sz,Pdb._complete_expression.<locals>.<listcomp>csg|]}|j��r|�qSr)r�)r�r�)r�rrr��srxrx)rZr"�copy�updater`r�rr�KeyErrorr�rG�dir�keys)r.r�rr�r��nsr$�partr)r�r�r�rr��s
zPdb._complete_expressioncCs(|sttjj�d}n"yt|�}Wn|jd�dS||_||jkrf|j||j||j	|f}nd}g|j|<d|j|<d|j	|<|j
}d|_
d|_zzy|j�Wnht
k
�r|r�|d|j|<|d|j|<|d|j	|<n|j|=|j|=|j	|=|jd	�YnXWdd|_||_
XdS)
a4commands [bpnumber]
        (com) ...
        (com) end
        (Pdb)

        Specify a list of commands for breakpoint number bpnumber.
        The commands themselves are entered on the following lines.
        Type a line containing just 'end' to terminate the commands.
        The commands are executed when the breakpoint is hit.

        To remove all commands from a breakpoint, type commands and
        follow it immediately with end; that is, give no commands.

        With no bpnumber argument, commands refers to the last
        breakpoint set.

        You can use breakpoint commands to start your program up
        again.  Simply use the continue command, or step, or any other
        command that resumes execution.

        Specifying any command resuming execution (currently continue,
        step, next, return, jump, quit and their abbreviations)
        terminates the command list (as if that command was
        immediately followed by end).  This is because any time you
        resume execution (even with a simple next or step), you may
        encounter another breakpoint -- which could have its own
        command list, leading to ambiguities about which list to
        execute.

        If you use the 'silent' command in the command list, the usual
        message about stopping at a breakpoint is not printed.  This
        may be desirable for breakpoints that are to print a specific
        message and then continue.  If none of the other commands
        print anything, you will see no sign that the breakpoint was
        reached.
        rz.Usage: commands [bnum]
        ...
        endNTFz(com) rr�z1command definition aborted, old commands restored)�lenr4r�r��intr�rMrIrJrKr9rLr�rQ)r.r�ZbnumZold_command_defsZprompt_backrrr�do_commandss@%




zPdb.do_commandsrcCs@|s<|jr8|jd�x"tjjD]}|r|j|j��qWdSd}d}d}|jd�}|dkr~||dd�j�}|d|�j�}|j	d�}d}	|dk�r|d|�j�}|j
|�}
|
s�|jd|�dS|
}||dd�j�}yt|�}Wn$t
k
�r|jd|�dSXn�yt|�}Wn�t
k
�r�yt||jj|j�}Wn|}YnXy.t|d	��rl|j}|j}|j}	|j}|j}Wn@|j|�\}
}}|
�s�|jd
|�dS|
}	t|�}YnXYnX|�s�|j�}|j||�}|�r<|j|||||	�}|�r|j|�n*|j||�d}|jd|j|j|jf�dS)
a�b(reak) [ ([filename:]lineno | function) [, condition] ]
        Without argument, list all breaks.

        With a line number argument, set a break at this line in the
        current file.  With a function name, set a break at the first
        executable line of that function.  If a second argument is
        present, it is a string specifying an expression which must
        evaluate to true before the breakpoint is honored.

        The line number may be prefixed with a filename and a colon,
        to specify a breakpoint in another file (probably one that
        hasn't been loaded yet).  The file is searched for on
        sys.path; the .py suffix may be omitted.
        z!Num Type         Disp Enb   WhereNr�rrr�z%r not found from sys.pathzBad lineno: %s�__func__zJThe specified object %r is not a function or was not found along sys.path.zBreakpoint %d at %s:%drx) �breaksrRr4r�r�Zbpformatr�r�r��rfind�lookupmoduler�r��
ValueError�evalrZr"r`�hasattrr��__code__�co_name�co_firstlinenorm�lineinfo�defaultFile�	checklineZ	set_break�
get_breaks�numberr�r)r.r�Z	temporaryr�rr�condZcommaZcolonrrbr�r*�ok�lnr�errrrr�do_breakTs~






zPdb.do_breakcCs"|jjj}|dkr|jr|j}|S)zProduce a reasonable default.z<string>)rZr]rmr<)r.rrrrr��s
zPdb.defaultFilecCs|j|d�dS)z�tbreak [ ([filename:]lineno | function) [, condition] ]
        Same arguments as break, but sets a temporary breakpoint: it
        is automatically deleted when first hit.
        rN)r�)r.r�rrr�	do_tbreak�sz
Pdb.do_tbreakc
Cs�d}|jd�}t|�dkr(|dj�}nt|�dkrB|dj�}n|S|dkrR|S|jd�}|ddkr~|d=t|�dkr~|S|j�}t|�dkr�|d}n|j|d�}|r�|}|d}t||�}	|	p�|S)	N�'rr�r2r�r.)NNN)r�r�rgr�r�r )
r.Z
identifierZfailedZidstring�id�partsZfname�itemrbZanswerrrrr��s.



zPdb.lineinfocCs�t|d�r|jjnd}tj|||�}|s6|jd�dS|j�}|sp|ddksp|dd�dksp|dd�dkr~|jd	�dS|S)
z�Check whether specified line seems to be executable.

        Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank
        line or EOF). Warning: testing is not comprehensive.
        rZNzEnd of filerrer�z"""z'''zBlank or comment)r�rZr"�	linecache�getlinerRrgr�)r.rrr�rrrrr��s
 
z
Pdb.checklinecCsl|j�}x^|D]V}y|j|�}Wn,tk
rL}z|j|�WYdd}~XqX|j�|jd|�qWdS)z�enable bpnumber [bpnumber ...]
        Enables the breakpoints given as a space separated list of
        breakpoint numbers.
        Nz
Enabled %s)r��get_bpbynumberr�r��enablerR)r.r�r�r+r�r�rrr�	do_enable�s
z
Pdb.do_enablecCsl|j�}x^|D]V}y|j|�}Wn,tk
rL}z|j|�WYdd}~XqX|j�|jd|�qWdS)aNdisable bpnumber [bpnumber ...]
        Disables the breakpoints given as a space separated list of
        breakpoint numbers.  Disabling a breakpoint means it cannot
        cause the program to stop execution, but unlike clearing a
        breakpoint, it remains in the list of breakpoints and can be
        (re-)enabled.
        NzDisabled %s)r�r�r�r��disablerR)r.r�r�r+r�r�rrr�
do_disable
s
zPdb.do_disablecCs�|jdd�}y|d}Wntk
r0d}YnXy|j|dj��}WnHtk
rf|jd�YnXtk
r�}z|j|�WYdd}~Xn.X||_|s�|jd|j�n|jd|j�dS)a#condition bpnumber [condition]
        Set a new condition for the breakpoint, an expression which
        must evaluate to true before the breakpoint is honored.  If
        condition is absent, any existing condition is removed; i.e.,
        the breakpoint is made unconditional.
        r�rNrzBreakpoint number expectedz#Breakpoint %d is now unconditional.z$New condition set for breakpoint %d.)	r��
IndexErrorr�rgr�r�r�rRr�)r.r�r�r�r�r�rrr�do_condition!s
zPdb.do_conditioncCs�|j�}yt|dj��}Wnd}YnXy|j|dj��}WnHtk
rb|jd�Ynvtk
r�}z|j|�WYdd}~XnLX||_|dkr�|dkr�d|}nd}|jd||j	f�n|jd|j	�dS)	a�ignore bpnumber [count]
        Set the ignore count for the given breakpoint number.  If
        count is omitted, the ignore count is set to 0.  A breakpoint
        becomes active when the ignore count is zero.  When non-zero,
        the count is decremented each time the breakpoint is reached
        and the breakpoint is not disabled and any associated
        condition evaluates to true.
        rrzBreakpoint number expectedNz%d crossingsz
1 crossingz%Will ignore next %s of breakpoint %d.z-Will stop next time breakpoint %d is reached.)
r�r�rgr�r�r�r��ignorerRr�)r.r�r��countr�r�Zcountstrrrr�	do_ignore<s(	

z
Pdb.do_ignorec
!Cs�|sxytd�}Wntk
r(d}YnX|j�j�}|dkrtdd�tjjD�}|j�x|D]}|jd|�q^WdSd	|k�r|j	d	�}|d|�}||d
d�}yt
|�}Wntk
r�d|}YnX|j||�}|j
||�}|�r�|j|�nx|D]}|jd|��qWdS|j�}	xd|	D]\}y|j|�}Wn.tk
�rl}z|j|�WYdd}~XnX|j|�|jd|��q,WdS)
a=cl(ear) filename:lineno
cl(ear) [bpnumber [bpnumber...]]
        With a space separated list of breakpoint numbers, clear
        those breakpoints.  Without argument, clear all breaks (but
        first ask confirmation).  With a filename:lineno argument,
        clear all breaks at that line in that file.
        zClear all breaks? �no�y�yescSsg|]}|r|�qSrr)r�r�rrrr�msz Pdb.do_clear.<locals>.<listcomp>z
Deleted %sNr�rzInvalid line number (%s))r�r�)�input�EOFErrorrgr�r4r�r�Zclear_all_breaksrRr�r�r�r�Zclear_breakr�r�r�Zclear_bpbynumber)
r.r�ZreplyZbplistr�r+rrr�Z
numberlistrrr�do_clear_sF






zPdb.do_clearcCs|j�dS)z�w(here)
        Print a stack trace, with the most recent frame at the bottom.
        An arrow indicates the "current frame", which determines the
        context of most commands.  'bt' is an alias for this command.
        N)�print_stack_trace)r.r�rrr�do_where�szPdb.do_wherecCs>||_|j|jd|_|jj|_|j|j|j�d|_dS)Nr)rYrXrZr#r`rtr)r.r�rrr�
_select_frame�s

zPdb._select_framecCsx|jdkr|jd�dSyt|p"d�}Wn"tk
rJ|jd|�dSX|dkrZd}ntd|j|�}|j|�dS)z�u(p) [count]
        Move the current frame count (default one) levels up in the
        stack trace (to an older frame).
        rzOldest frameNrzInvalid frame count (%s))rYr�r�r��maxr)r.r�r��newframerrr�do_up�s

z	Pdb.do_upcCs�|jdt|j�kr"|jd�dSyt|p,d�}Wn"tk
rT|jd|�dSX|dkrnt|j�d}ntt|j�d|j|�}|j|�dS)z�d(own) [count]
        Move the current frame count (default one) levels down in the
        stack trace (to a newer frame).
        rzNewest frameNzInvalid frame count (%s)r)rYr�rXr�r�r��minr)r.r�r�rrrr�do_down�s
zPdb.do_downcCsf|rPyt|�}Wn"tk
r2|jd|�dSX||jjkrT|jd�dSnd}|j|j|�dS)aNunt(il) [lineno]
        Without argument, continue execution until the line with a
        number greater than the current one is reached.  With a line
        number, continue execution until a line with a number greater
        or equal to that is reached.  In both cases, also stop when
        the current frame returns.
        zError in argument: %rNz7"until" line number is smaller than current line numberr)r�r�r�rZrnZ	set_until)r.r�rrrr�do_until�s
zPdb.do_untilcCs|j�dS)z�s(tep)
        Execute the current line, stop at the first possible occasion
        (either in a function that is called or in the current
        function).
        r)rS)r.r�rrr�do_step�szPdb.do_stepcCs|j|j�dS)zxn(ext)
        Continue execution until the next line in the current function
        is reached or it returns.
        r)Zset_nextrZ)r.r�rrr�do_next�szPdb.do_nextcCs<|r4ddl}tjdd�}|j|�t_|tjdd�<t�dS)arun [args...]
        Restart the debugged python program. If a string is supplied
        it is split with "shlex", and the result is used as the new
        sys.argv.  History, breakpoints, actions and debugger options
        are preserved.  "restart" is an alias for "run".
        rNr)�shlexr��argvr�r)r.r�rZargv0rrr�do_run�sz
Pdb.do_runcCs|j|j�dS)zPr(eturn)
        Continue execution until the current function returns.
        r)Z
set_returnrZ)r.r�rrr�	do_returnsz
Pdb.do_returncCs>|js2ytjtj|j�t_Wntk
r0YnX|j�dS)z]c(ont(inue))
        Continue execution, only stop when a breakpoint is encountered.
        r)rBr�r�rUrr�r�Zset_continue)r.r�rrr�do_continueszPdb.do_continuecCs�|jdt|j�kr"|jd�dSyt|�}Wntk
rL|jd�YnnXy:||j_|j|jd|f|j|j<|j|j|j�Wn0tk
r�}z|jd|�WYdd}~XnXdS)a�j(ump) lineno
        Set the next line that will be executed.  Only available in
        the bottom-most frame.  This lets you jump back and execute
        code again, or jump forward to skip code that you don't want
        to run.

        It should be noted that not all jumps are allowed -- for
        instance it is not possible to jump into the middle of a
        for loop or out of a finally clause.
        rz)You can only jump within the bottom frameNz)The 'jump' command requires a line numberrzJump failed: %s)	rYr�rXr�r�r�rZrnrt)r.r��errr�do_jump"s
zPdb.do_jumpcCsztjd�|jj}|j}t|j|j|j�}d|j	j
�|_	|jd�tj|j
|||f�|jd�tj|j�|j|_dS)z�debug code
        Enter a recursive debugger that steps through the code
        argument (which is an arbitrary expression or statement to be
        executed in the current environment).
        Nz(%s) zENTERING RECURSIVE DEBUGGERzLEAVING RECURSIVE DEBUGGER)r��settracerZr"r`rrNrOrPr9rgrR�call_tracingr	Ztrace_dispatchrs)r.r�r�r��prrr�do_debug?s


zPdb.do_debugcCsd|_|j�dS)z[q(uit)
exit
        Quit from the debugger. The program being executed is aborted.
        Tr)�_user_requested_quit�set_quit)r.r�rrr�do_quitRszPdb.do_quitcCs|jd�d|_|j�dS)z=EOF
        Handles the receipt of EOF as a command.
        r2Tr)rRrr)r.r�rrr�do_EOF]s
z
Pdb.do_EOFcCs�|jj}|j}|j}|jd@r&|d}|jd@r8|d}xJt|�D]>}|j|}||krp|jd|||f�qB|jd|f�qBWdS)zHa(rgs)
        Print the argument list of the current function.
        �r�z%s = %rz%s = *** undefined ***N)rZr]r`�co_argcount�co_flags�range�co_varnamesrR)r.r��co�dictr�r+�namerrr�do_argsfs


zPdb.do_argscCs.d|jkr |jt|jd��n
|jd�dS)zQretval
        Print the return value for the last return of a function.
        rvzNot yet returned!N)r`rRr�r�)r.r�rrr�	do_retvalws
z
Pdb.do_retvalc
CsNyt||jj|j�Stj�dd�}|jtj|�dj	���YnXdS)Nr�rrx)
r�rZr"r`r�r|r�rzr{rg)r.r�r|rrr�_getval�szPdb._getvalc
Cshy.|dkrt||jj|j�St||j|j�SWn4tj�dd�}tj|�dj	�}t
d|�SdS)Nr�rz** raised %s **rx)r�rZr"r`r#r�r|rzr{rgr-)r.r�rTr|r�rrrr��szPdb._getval_exceptc
Cs*y|jt|j|���WnYnXdS)z@p expression
        Print the value of the expression.
        N)rRr�r&)r.r�rrr�do_p�szPdb.do_pc
Cs,y|jtj|j|���WnYnXdS)zHpp expression
        Pretty-print the value of the expression.
        N)rR�pprintZpformatr&)r.r�rrr�do_pp�sz	Pdb.do_ppcCsdd|_d}|r�|dkr�y^d|krX|jd�\}}t|j��}t|j��}||krr||}nt|j��}td|d�}Wq�tk
r�|jd|�dSXn0|jdks�|dkr�td|jj	d�}n
|jd}|dkr�|d}|jj
j}|j|�}yZt
j||jj�}|j||d|�|||j�t|t|��|_t|�|k�rF|jd	�Wntk
�r^YnXdS)
a�l(ist) [first [,last] | .]

        List source code for the current file.  Without arguments,
        list 11 lines around the current line or continue the previous
        listing.  With . as argument, list 11 lines around the current
        line.  With one argument, list 11 lines starting at that line.
        With two arguments, list the given range; if the second
        argument is less than the first, it is a count.

        The current line in the current frame is indicated by "->".
        If an exception is being debugged, the line where the
        exception was originally raised or propagated is indicated by
        ">>", if it differs from the current line.
        r'Nr�r�r�zError in argument: %r�
z[EOF])rsr�r�rgrr�r�rrZrnr]rm�get_file_breaksr��getlinesr"�_print_linesrr�rRrQ)r.r�Zlast�firstr�	breaklistr%rrr�do_list�s>



zPdb.do_listcCsh|jjj}|j|�}yt|j�\}}Wn*tk
rP}z|j|�dSd}~XnX|j||||j�dS)z\longlist | ll
        List the whole source code for the current function or frame.
        N)rZr]rmr,r&rr�r.)r.r�rr0r%rr�rrr�do_longlist�s


zPdb.do_longlistcCsjy|j|�}Wn
dSyt|�\}}Wn.ttfk
rX}z|j|�dSd}~XnX|j||�dS)z^source expression
        Try to get source code for the given object and display it.
        N)r&r&r�	TypeErrorr�r.)r.r�r$r%rr�rrr�	do_source�s
z
Pdb.do_sourcec
Cs�|r|j}|jj|d
�}nd}}x�t||�D]|\}}t|�jd�}	t|	�dkrX|	d7}	||krj|	d7}	n|	d7}	||kr�|	d7}	n||kr�|	d7}	|j|	d|j��q.Wd	S)zPrint a range of lines.rr�rr��Bz->z>>�	Nrxrx)	rnr>r�rr��rjustr�rRr�)
r.r%rr�rTZcurrent_linenoZ
exc_linenorr�srrrr.�s 

zPdb._print_linescCs�y|j|�}Wn
dSd}y
|j}Wntk
r<YnX|rV|jd|j�dSy|jj}Wntk
rvYnX|r�|jd|j�dS|jtkr�|jd|j|j	f�dS|jt|��dS)z;whatis arg
        Print the type of the argument.
        NzFunction %sz	Method %szClass %s.%s)
r&r�r�rRr�r��	__class__�typerr)r.r��valuer*rrr�	do_whatiss.

z
Pdb.do_whatiscCsp|s<|jd�x\|jj|ji�j�D]}|jd|�q$Wn0|j|�}||jj|ji�|<|jd||f�dS)z�display [expression]

        Display the value of the expression if it changed, each time execution
        stops in the current frame.

        Without expression, list all display expressions for the current frame.
        zCurrently displaying:z%s: %rzdisplay %s: %rN)rRr;r�rZr�r��
setdefault)r.r�r��valrrr�
do_display4s

zPdb.do_displaycCsT|r@y|jj|ji�|=WqPtk
r<|jd|�YqPXn|jj|jd�dS)z�undisplay [expression]

        Do not display the expression any more in the current frame.

        Without expression, clear all display expressions for the current frame.
        znot displaying %sN)r;r�rZr�r�rf)r.r�rrr�do_undisplayGszPdb.do_undisplaycs�fdd�|jj|ji�D�S)Ncsg|]}|j��r|�qSr)r�)r�r)r�rrr�Wsz*Pdb.complete_undisplay.<locals>.<listcomp>)r;r�rZ)r.r�rr�r�r)r�r�complete_undisplayVszPdb.complete_undisplaycCs*|jjj�}|j|j�tjd|d�dS)z�interact

        Start an interactive interpreter whose global namespace
        contains all the (global and local) names found in the current scope.
        z
*interactive*)ZlocalN)rZr"r�r�r`r*�interact)r.r�r�rrr�do_interactZszPdb.do_interactcCs�|j�}t|�dkrLt|jj��}x$|D]}|jd||j|f�q(WdS|d|jkr�t|�dkr�|jd|d|j|df�ndj|dd��|j|d<dS)acalias [name [command [parameter parameter ...] ]]
        Create an alias called 'name' that executes 'command'.  The
        command must *not* be enclosed in quotes.  Replaceable
        parameters can be indicated by %1, %2, and so on, while %* is
        replaced by all the parameters.  If no command is given, the
        current alias for name is shown. If no name is given, all
        aliases are listed.

        Aliases may be nested and can contain anything that can be
        legally typed at the pdb prompt.  Note!  You *can* override
        internal pdb commands with aliases!  Those internal commands
        are then hidden until the alias is removed.  Aliasing is
        recursively applied to the first word of the command line; all
        other words in the line are left alone.

        As an example, here are two useful aliases (especially when
        placed in the .pdbrc file):

        # Print instance variables (usage "pi classInst")
        alias pi for k in %1.__dict__.keys(): print("%1.",k,"=",%1.__dict__[k])
        # Print instance variables in self
        alias ps pi self
        rz%s = %sNrr�)r�r��sortedr:r�rRrG)r.r�r�r�r�rrr�do_aliasds
"zPdb.do_aliascCs6|j�}t|�dkrdS|d|jkr2|j|d=dS)z9unalias name
        Delete the specified alias.
        rN)r�r�r:)r.r�r�rrr�
do_unalias�s
zPdb.do_unaliascs�fdd�|jD�S)Ncsg|]}|j��r|�qSr)r�)r��a)r�rrr��sz(Pdb.complete_unalias.<locals>.<listcomp>)r:)r.r�rr�r�r)r�r�complete_unalias�szPdb.complete_unaliasrr
rrrrcCs8yx|jD]}|j|�q
WWntk
r2YnXdS)N)rXrtrQ)r.�frame_linenorrrr�s
zPdb.print_stack_tracecCs6|\}}||jkrd}nd}|j||j||��dS)Nz> z  )rZrRZformat_stack_entry)r.rIZ
prompt_prefixrTrr�rrrrt�s
zPdb.print_stack_entrycCs�|stjj||�Sy<yt|d|�}|�Stk
rJt|d|�}YnXWn"tk
rp|jd|�Yn0Xtjjdkr�|jd|�dS|j	|j
j��dS)z�h(elp)
        Without argument, print the list of available commands.
        With a command name as argument, print help about that command.
        "help pdb" shows the full pdb documentation.
        "help exec" gives help on the ! command.
        Zhelp_r�zNo help for %rr�zJNo help for %r; please do not run Python with -OO if you need command helpN)r7r8�do_helprrr�r�r��flags�optimizerRrr�)r.r�ZtopicZcommandrrrrJ�szPdb.do_helpcCs|j|jjpdj��dS)a�(!) statement
        Execute the (one-line) statement in the context of the current
        stack frame.  The exclamation point can be omitted unless the
        first word of the statement resembles a debugger command.  To
        assign to a global variable you must always prefix the command
        with a 'global' command, e.g.:
        (Pdb) global list_options; list_options = ['-l']
        (Pdb)
        r2N)rR�	help_execrrg)r.rrrrM�s
z
Pdb.help_execcCs
t�dS)N)r)r.rrr�help_pdb�szPdb.help_pdbcCs�tjj|�rtjj|�r|Stjjtjd|�}tjj|�rP|j|�|jkrP|Stjj|�\}}|dkrp|d}tjj|�r�|SxHtjD]>}xtjj	|�r�tj
|�}q�Wtjj||�}tjj|�r�|Sq�WdS)z�Helper function for break/clear parsing -- may be overridden.

        lookupmodule() translates (possibly incomplete) file or module name
        into an absolute file name.
        rr2z.pyN)rDrF�isabs�existsrGr�rlr<�splitext�islink�readlink)r.rrb�rootZext�dirname�fullnamerrrr��s"zPdb.lookupmodulec
Cstddl}|jj�|jjd|td��d|_|j|�|_d|_t	|d��}d|j
�|jf}WdQRX|j|�dS)Nr�__main__)r�__file__�__builtins__TF�rbzexec(compile(%r, %r, 'exec')))rW�__dict__r[r�rYr=rlr<rr�readr	)r.rrWr�	statementrrr�
_runscript�s

zPdb._runscript)r0NNNFT)r)N)vrrrr�r6rUrVrWrdrarkrprorwr�rur�rjr�r�r�rhr�rRr�r�r�r�r�Zcomplete_commandsr�r�Zdo_bZcomplete_breakZ
complete_br�Zcomplete_tbreakr�r�r�Zcomplete_enabler�Zcomplete_disabler�Zcomplete_conditionr�Zcomplete_ignorerZdo_clZcomplete_clearZcomplete_clrZdo_wZdo_btrrZdo_urZdo_dr	Zdo_untr
Zdo_srZdo_nrZ
do_restartrZdo_rrZdo_cZdo_contrZdo_jrZcomplete_debugrZdo_qZdo_exitrr$Zdo_ar%Zdo_rvr&r�r'r)Zcomplete_printZ
complete_pZcomplete_ppr1Zdo_lr2Zdo_llr4Zcomplete_sourcer.r<Zcomplete_whatisr?Zcomplete_displayr@rArCrErFrHr�r�line_prefixrtrJZdo_hrMrNr�r^rrrrr�s�
/	


M
]!!.	
		1!
#	
�whereZdownZup�breakZtbreakr[r�r�r�Z	conditionrI�stepr�ZuntilZjump�returnZretval�continuer'Zlonglistr�rZppZwhatis�sourceZdisplayZ	undisplayrBr�Zunalias�debug�quitr�z

cCst�j|||�dS)N)rr	)r]r�r�rrrr	#scCst�j|||�S)N)rr)Z
expressionr�r�rrrr&scCst|||�dS)N)r	)r]r�r�rrrr
)scOst�j||�S)N)rr)r��kwdsrrrr-scCst�jtj�j�dS)N)rrr��	_getframe�f_backrrrrr0scCsB|dkrtj�d}|dkr$td��t�}|j�|jd|�dS)Nr�zAA valid traceback must be passed if no exception is being handled)r�r|r�rrVrj)�trrrrr5scCsttj�dS)N)rr��last_tracebackrrrrr
Cszimport x; x.main()cCstt�dS)N)r	�TESTCMDrrrr�testKsrncCsddl}|jt�dS)Nr)�pydocZpagerr)rorrrrOsa�usage: pdb.py [-c command] ... pyfile [arg] ...

Debug the Python program given by pyfile.

Initial commands are read from .pdbrc files in your home directory
and in the current directory, if they exist.  Commands supplied with
-c are executed after commands from .pdbrc files.

To let the script run until an exception occurs, use "-c continue".
To let the script run up to a given line X in the debugged file, use
"-c 'until X'".c	Cs�ddl}|jtjdd�dddg�\}}|s>tt�tjd�g}x<|D]4\}}|dkrjtt�tj�qH|dkrH|j|�qHW|d}tjj	|�s�td
|d�tjd�|tjdd�<tjj
|�tjd<t�}|jj
|�x�y|j|�|jr�Ptd�Wq�tk
�r0td
|d�tddj|��Yq�tk
�r`tddd�ttj�d�Yq�tk
�r�tj�tjd�Yq�tj�td�td�tj�d}|jd|�td|d�Yq�Xq�WdS)Nrrzhc:�--helpz
--command=r��-h�-c�	--commandzError:zdoes not existz*The program finished and will be restartedZ
Restartingzwith arguments:r6r�z/The program exited via sys.exit(). Exit status:)r�z2Uncaught exception. Entering post mortem debuggingz1Running 'cont' or 'step' will restart the programz#Post mortem debugger finished. The z will be restarted)rqrp)rrrs)�getoptr�r
r��_usage�exitr�rDrFrPrUrrCrHr^rrrG�
SystemExitr|�SyntaxErrorrz�	print_excrj)	rtZoptsr�rI�optZoptargr<�pdbrkrrr�main`sV 



r|rW)NN)NN)N)-rrDrr�r7r4r(r*r�r(r�r!rzr�r�r�__all__r r&r,r�r-r_r5r8rZ_help_orderZ_commandrrrgrMr	rr
rrrr
rmrnrrur|rr{rrrr�<module>Bst
		

"


<
mailcap.cpython-36.pyc000064400000016053150335715140010611 0ustar003

�\dhk#�@s�dZddlZddlZddlZddgZdd�Zejd�jZGdd	�d	e	�Z
d
d�Zdd�Zd
d�Z
dd�Zdd�Zdd�Zddgfdd�Zd#dd�Zgfdd�Zdd�Zdd�Zd d!�Zed"kr�e�dS)$z%Mailcap file handling.  See RFC 1524.�N�getcaps�	findmatchcCsd|krd|dfSdSdS)N�linenor�)rr�)�entryrr�/usr/lib64/python3.6/mailcap.py�lineno_sort_key
sr	z[^\xa1-\U0010FFFF\w@+=:,./-]c@seZdZdZdS)�UnsafeMailcapInputz)Warning raised when refusing unsafe inputN)�__name__�
__module__�__qualname__�__doc__rrrrr
sr
cCs�i}d}x�t�D]�}yt|d�}Wntk
r8wYnX|�t||�\}}WdQRXx6|j�D]*\}}||kr||||<qb|||||<qbWqW|S)a�Return a dictionary containing the mailcap database.

    The dictionary maps a MIME type (in all lowercase, e.g. 'text/plain')
    to a list of dictionaries corresponding to mailcap entries.  The list
    collects all the entries for that MIME type from all available mailcap
    files.  Each dictionary contains key-value pairs for that MIME type,
    where the viewing command is stored with the key "view".

    r�rN)�listmailcapfiles�open�OSError�_readmailcapfile�items)�capsrZmailcap�fpZmorecaps�key�valuerrrrs

cCsPdtjkr"tjd}|jtj�}n*dtjkr8tjd}nd}|ddddg}|S)z7Return a list of all mailcap files found on the system.ZMAILCAPS�HOME�.z	/.mailcapz/etc/mailcapz/usr/etc/mailcapz/usr/local/etc/mailcap)�os�environ�split�pathsep)ZpathstrZmailcaps�homerrrr3s


rcCs tjdtd�t|d�\}}|S)z?Read a mailcap file and return a dictionary keyed by MIME type.z2readmailcapfile is deprecated, use getcaps instead�N)�warnings�warn�DeprecationWarningr)rr�_rrr�readmailcapfileEsr%c	Csi}x�|j�}|sP|ddks|j�dkr.q|}x4|dd�dkrf|j�}|sTd}|dd�|}q4Wt|�\}}|oz|s~q|dk	r�||d<|d	7}|jd
�}x$tt|��D]}||j�||<q�Wd
j|�j�}||kr�||j|�q|g||<qW||fS)
a�Read a mailcap file and return a dictionary keyed by MIME type.

    Each MIME type is mapped to an entry consisting of a list of
    dictionaries; the list will contain more than one such dictionary
    if a given MIME type appears more than once in the mailcap file.
    Each dictionary contains key-value pairs for that MIME type, where
    the viewing command is stored with the key "view".
    r�#�r Nz\
�
rr�/���r*)	�readline�strip�	parseliner�range�len�join�lower�append)	rrr�lineZnextliner�fields�types�jrrrrMs6	
rc
Cs�g}dt|�}}x.||kr@t|||�\}}|j|�|d}qWt|�dkrRdS|d|d|dd�}}}d|i}x^|D]V}|jd�}|dkr�|}d}	n$|d|�j�}||dd�j�}	||kr�q�|	||<q�W||fS)	z�Parse one entry in a mailcap file and return a dictionary.

    The viewing command is stored as the value with the key "view",
    and the rest of the fields produce key-value pairs in the dict.
    rrr N�view�=r')NN)r/�
parsefieldr2�findr,)
r3r4�i�n�fieldrr7�restZfkeyZfvaluerrrr-vs*

 

r-cCsT|}x:||kr>||}|dkr"Pq|dkr4|d}q|d}qW|||�j�|fS)z/Separate one key-value pair in a mailcap entry.�;�\r r)r,)r3r;r<�start�crrrr9�s

r9r7z	/dev/nullc
Cs�t|�r"d|f}tj|t�dSt|||�}xd|D]\}d|krnt|d||�}|dkrZq4|rntj|�dkrnq4t|||||�}	|	dk	r4|	|fSq4WdS)aFind a match for a mailcap entry.

    Return a tuple containing the command line, and the mailcap entry
    used; (None, None) if no match is found.  This may invoke the
    'test' command of several matching entries before deciding which
    entry to use.

    zHRefusing to use mailcap with filename %r. Use a safe temporary filename.N�testr)NN)NN)�_find_unsafer!r"r
�lookup�substr�system)
r�MIMEtyper�filename�plist�msg�entries�erC�commandrrrr�s 	

cslg}||kr|||}|jd�}|dd}||krB|||}�dk	r\�fdd�|D�}t|td�}|S)Nr)rz/*csg|]}�|kr|�qSrr)�.0rM)rrr�
<listcomp>�szlookup.<locals>.<listcomp>)r)r�sortedr	)rrHrrLZ	MIMEtypesr)rrrE�s
rEcCs\d}dt|�}}�xB||k�rV||}|d}|dkrb|dkrX|||d�}|d}||}q||}|d}|dkr�||}q|dkr�||}q|dkr�t|�r�d|f}tj|t�dS||}q|d	k�rH|}	x ||kr�||d
kr�|d}q�W||	|�}
|d}t|
|�}t|��r>d||
f}tj|t�dS||}q|d|}qW|S)Nr'rr�%r@�s�tz9Refusing to substitute MIME type %r into a shell command.�{�}z=Refusing to substitute parameter %r (%s) into a shell command)r/rDr!r"r
�	findparam)r=rHrIrJ�resr;r<rBrKrA�nameZparamrrrrF�sH








rFcCsF|j�d}t|�}x,|D]$}|d|�j�|kr||d�SqWdS)Nr8r')r1r/)rYrJr<�prrrrW�s
rWc	Cs�ddl}t�}|jdd�s(t|�dSx�tdt|j�d�D]�}|j||d�}t|�dkrjtd�dS|d}|d}t||d|�\}}|s�tdt�q<td|�t	j
|�}|r<td|�q<WdS)	Nrrr z"usage: mailcap [MIMEtype file] ...r7zNo viewer found forz
Executing:zExit status:)�sysr�argv�showr.r/�printr�typerrG)	r[rr;�argsrH�filerNrM�stsrrrrCs&

rCcCs�td�xt�D]}td|�qWt�|s4t�}td�t�t|�}xX|D]P}t|�||}x:|D]2}t|�}x|D]}td|||�q|Wt�qjWqPWdS)NzMailcap files:�	zMailcap entries:z  %-15s)r^rrrQ)r�fnZckeysr_rLrM�keys�krrrr]s"


r]�__main__)N)rrr!�re�__all__r	�compile�searchrD�Warningr
rrr%rr-r9rrErFrWrCr]rrrrr�<module>s*)

)sysconfig.cpython-36.opt-2.pyc000064400000032026150335715140012145 0ustar003

�]dh,a�
@sddlZddlZddlmZmZddddddd	d
ddd
gZddddddddd�ddddddddd�ddddddddd�ddd d d!d"d#d$�d%d%d&d'd(d)d#d$�d*d*d+d+d,d)d#d$�d-�ZdnZejj	�dZ
d5ejdd6�Zd7ejdd6�Z
ejjej�Zejjej�Zejjej�Zejjej�ZdadZd8d9�Zej�rLejjeej��Zneej��Zejd:k�r�ej �j!do��r�eejj"eee��Zd=ej#k�r�eej#d=�Zd>d?�Z$e%ed@d�Z&e&�r�ejd:k�r�e&j �j!dp��r�ejjejje&��Z&dqdBdC�Z'e'dD�Z(e(�r,x&drD]Z)dGee)d2<dHee)dI<�q
WdJdK�Z*dLdM�Z+dNdO�Z,dPdQ�Z-dRdS�Z.dsdTdU�Z/dVd�Z0dWdX�Z1dYdZ�Z2d[d\�Z3d]d^�Z4dtd_d
�Z5d`d�Z6dad�Z7dbd�Z8e-�ddDfdcd	�Z9e-�ddDfddd�Z:ded�Z;dfd�Z<dgd
�Z=dhd�Z>didj�Z?dkdl�Z@eAdmk�re@�dS)u�N)�pardir�realpath�get_config_h_filename�get_config_var�get_config_vars�get_makefile_filename�get_path�get_path_names�	get_paths�get_platform�get_python_version�get_scheme_names�parse_config_hz/{installed_base}/lib64/python{py_version_short}z){platbase}/lib64/python{py_version_short}z1{base}/lib/python{py_version_short}/site-packagesz7{platbase}/lib64/python{py_version_short}/site-packagesz;{installed_base}/include/python{py_version_short}{abiflags}z?{installed_platbase}/include/python{py_version_short}{abiflags}z
{base}/binz{base})�stdlib�
platstdlib�purelib�platlib�include�platinclude�scripts�dataz{installed_base}/lib/pythonz{base}/lib/pythonz{installed_base}/include/pythonz{installed_base}/Libz
{base}/Libz{base}/Lib/site-packagesz{installed_base}/Includez{base}/Scriptsz#{userbase}/Python{py_version_nodot}z1{userbase}/Python{py_version_nodot}/site-packagesz+{userbase}/Python{py_version_nodot}/Includez+{userbase}/Python{py_version_nodot}/Scriptsz
{userbase})rrrrrrrz){userbase}/lib64/python{py_version_short}z5{userbase}/lib/python{py_version_short}/site-packagesz7{userbase}/lib64/python{py_version_short}/site-packagesz+{userbase}/include/python{py_version_short}z{userbase}/binz{userbase}/lib/pythonz#{userbase}/lib/python/site-packagesz{userbase}/include)�posix_prefix�
posix_home�nt�nt_user�
posix_user�osx_framework_userrrrrrrrz%d.%d�z%d%dcCs"yt|�Stk
r|SXdS)N)r�OSError)�path�r �!/usr/lib64/python3.6/sysconfig.py�_safe_realpathcsr"r�\pcbuild\win32�\pcbuild\amd64Z_PYTHON_PROJECT_BASEcCs.x(dD] }tjjtjj|d|��rdSqWdS)N�
Setup.dist�Setup.local�ModulesTF)r%r&)�osr�isfile�join)�d�fnr r r!�_is_python_source_dirxs
r-�_homeFcCs|rtrtt�Stt�S)N)�	_sys_homer-�
_PROJECT_BASE)�
check_homer r r!�is_python_build�sr2Trrz{srcdir}/Includez{projectbase}/.rcCsdy|jf|�Stk
r^y|jftj�Stk
rX}ztd|��WYdd}~XnXYnXdS)Nz{%s})�format�KeyErrorr(�environ�AttributeError)�s�
local_vars�varr r r!�_subst_vars�sr:cCs4|j�}x&|j�D]\}}||kr$q|||<qWdS)N)�keys�items)�target_dict�
other_dict�target_keys�key�valuer r r!�_extend_dict�s
rBcCsfi}|dkri}t|t��xDt|j�D]4\}}tjdkrHtjj|�}tjjt	||��||<q*W|S)N�posixr)rCr)
rBr�_INSTALL_SCHEMESr<r(�namer�
expanduser�normpathr:)�scheme�vars�resr@rAr r r!�_expand_vars�s
rKcCstjdkrdStjS)NrCr)r(rEr r r r!�_get_default_scheme�s
rLcCs�tjjdd�}dd�}tjdkrBtjjd�p.d}|r8|S||d�Stjdkr|td	�}|r||r`|S|dd
|dtjdd��S|r�|S|dd
�SdS)N�PYTHONUSERBASEcWstjjtjj|��S)N)r(rrFr*)�argsr r r!�joinuser�sz_getuserbase.<locals>.joinuserr�APPDATA�~�Python�darwin�PYTHONFRAMEWORK�Libraryz%d.%drz.local)r(r5�getrE�sys�platformr�version_info)�env_baserO�base�	frameworkr r r!�_getuserbase�s"



r]cCsZddl}|jd�}|jd�}|jd�}|dkr2i}i}i}t|dd��}|j�}	WdQRXx�|	D]�}
|
jd�s`|
j�dkr|q`|j|
�}|r`|jd	d
�\}}
|
j�}
|
jdd�}d|kr�|
||<q`yt	|
�}
Wn$t
k
r�|
jdd�||<Yq`X|
||<q`Wt|j��}d}�x
t
|�dk�r�x�t|�D�]�}||}|j|�}|j|�}|�rv|�rv|j�|j�k�rp|n|}n|�r�|n|}|dk	�r�|jd	�}d}||k�r�t||�}n�||k�r�d}nx|tjk�r�tj|}n`||k�r0|jd��r
|dd�|k�r
d}n$d||k�rd}nt|d|�}nd||<}|�r||j�d�}|d|j��||}d|k�r~|||<n~yt	|�}Wn"t
k
�r�|j�||<Yn
X|||<|j|�|jd��r|dd�|k�r|dd�}||k�r|||<n|||<|j|��q,W�qWx.|j�D]"\}}
t|
t��r&|
j�||<�q&W|j|�|S)Nrz"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)z\$\(([A-Za-z][A-Za-z0-9_]*)\)z\${([A-Za-z][A-Za-z0-9_]*)}�surrogateescape)�errors�#��rz$$�$�CFLAGS�LDFLAGS�CPPFLAGSTF�PY_�)rdrerf)�re�compile�open�	readlines�
startswith�strip�match�group�replace�int�
ValueError�listr;�len�tuple�search�start�strr(r5�end�remover<�
isinstance�update)�filenamerIri�_variable_rx�_findvar1_rx�_findvar2_rx�done�notdone�f�lines�line�m�n�v�tmpv�	variables�renamed_variablesrErA�m1�m2�found�item�after�kr r r!�_parse_makefile�s�	


















r�cCsdtrtjjtptd�Sttd�r0dttj	f}nd}ttj
d�rP|dtj
j7}tjjtd�|d�S)N�Makefile�abiflagszconfig-%s%s�config�
_multiarchz-%sr)
�
_PYTHON_BUILDr(rr*r/r0�hasattrrW�_PY_VERSION_SHORTr��implementationr�r)�config_dir_namer r r!rLs
c	Cs(tjjddjtjtjttjdd�d��S)N�_PYTHON_SYSCONFIGDATA_NAMEz+_sysconfigdata_{abi}_{platform}_{multiarch}r�ra)�abirX�	multiarch)	r(r5rVr3rWr�rX�getattrr�r r r r!�_get_sysconfigdata_nameYs
r�c,Cs�ddl}i}t�}yt||�WnJtk
rj}z.d|}t|d�rR|d|j}t|��WYdd}~XnXt�}y"t|��}t||�WdQRXWnJtk
r�}z.d|}t|d�r�|d|j}t|��WYdd}~XnXt	r�|d|d<t
�}dtjk�r$ddl
}|j|�}	||	_|	tj|<dt�tf}
ttd	��rF|
d
7}
tj|
dd�tjj|
|d
�}t|ddd��(}|jd�|jd�|j||d�WdQRXtdddd��}|j|
�WdQRXdS)Nrz.invalid Python installation: unable to open %s�strerrorz (%s)�LDSHARED�	BLDSHAREDrSzbuild/lib.%s-%s�gettotalrefcountz-pydebugT)�exist_okz.py�w�utf8)�encodingzB# system configuration generated and used by the sysconfig module
zbuild_time_vars = )�streamzpybuilddir.txt�ascii)�pprintrr�rr�r�rrkrr�r�rWrX�types�
ModuleType�build_time_vars�modulesrr�r(�makedirsrr*�write)r�rI�makefile�e�msg�config_hr�rEr��module�
pybuilddir�destfiler r r!�_generate_posix_varsbsL







r�cCs0t�}t|t�t�dgd�}|j}|j|�dS)Nr�r)r��
__import__�globals�localsr�r})rIrE�_tempr�r r r!�_init_posix�sr�cCsVtd�|d<td�|d<td�|d<d|d<d	|d
<t|d<tjjttj��|d<dS)
Nr�LIBDESTr�
BINLIBDESTr�	INCLUDEPYz.pyd�
EXT_SUFFIXz.exe�EXE�VERSION�BINDIR)r�_PY_VERSION_SHORT_NO_DOTr(r�dirnamer"rW�
executable)rIr r r!�_init_non_posix�sr�c	Cs�|dkri}ddl}|jd�}|jd�}xx|j�}|s8P|j|�}|r�|jdd�\}}yt|�}Wntk
rvYnX|||<q*|j|�}|r*d||jd�<q*W|S)Nrz"#define ([A-Z][A-Za-z0-9_]+) (.*)
z&/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/
rbr)rirj�readlinerorprrrs)	�fprIri�	define_rx�undef_rxr�r�r�r�r r r!r�s*




cCsBtr,tjdkr"tjjtptd�}q4tp(t}ntd�}tjj|d�S)Nr�PCrz
pyconfig-64.h)r�r(rErr*r/r0r)�inc_dirr r r!r�s

cCsttt��S)N)rv�sortedrDr r r r!r
�scCstS)N)�_SCHEME_KEYSr r r r!r	�scCs|rt||�St|SdS)N)rKrD)rHrI�expandr r r!r
�s
cCst|||�|S)N)r
)rErHrIr�r r r!r�scGs|tdk�rFiattd<ttd<ttd<ttd<ttd<ttd<ttd<ttd<ttd	<ttd
<yt	j
td<Wntk
r�dtd<YnXtj
d
kr�tt�tj
dkr�tt�tjd�}|dk	r�|td<t�td<tjdt�}tj
dk�rt�rtjjt��}tjj||�}ntjjt��}t|�td<t	jdk�rFddl}|jt�|�rtg}x|D]}|jtj|���qVW|StSdS)N�prefix�exec_prefix�
py_version�py_version_short�py_version_nodot�installed_baser[�installed_platbase�platbase�projectbaser�rarrCr��SO�userbase�srcdirrSr)�_CONFIG_VARS�_PREFIX�_EXEC_PREFIX�_PY_VERSIONr�r��_BASE_PREFIX�_BASE_EXEC_PREFIXr0rWr�r6r(rEr�r�rVr]r�rr�rr*r"rX�_osx_support�customize_config_vars�append)rNr�r�r[r��valsrEr r r!rsP






cCs*|dkrddl}|jdtd�t�j|�S)Nr�rz SO is deprecated, use EXT_SUFFIXr)�warnings�warn�DeprecationWarningrrV)rEr�r r r!rPscCstjdkrnd}tjj|�}|d(kr(tjStjjd|�}tj|t|�|�j�}|dkr\dS|dkrhdStjStjd	ks�ttd
�r�tjSdtj	kr�tj	dStj
�\}}}}}|j�jdd
�}|jdd�}|jdd�}|dd�dkr�d||fS|dd�dk�rV|ddk�rd}dt|d�d|dd�f}ddd�}	|d|	tj
7}n�|dd�d k�rtd||fS|dd�d!k�r�d"|||fS|dd#�d$k�r�d$}ddl}
|
jd%�}|j|�}|�r|j�}n2|dd#�d&k�rddl}
|
jt�|||�\}}}d'|||fS))Nrz bit (rb�)�amd64z	win-amd64�itaniumzwin-ia64rC�uname�_PYTHON_HOST_PLATFORM�/ra� �_�-��linuxz%s-%s�sunosr�5�solarisz%d.%srhr�32bit�64bit)i���l����z.%s��irix�aixz%s-%s.%s��cygwinz[\d.]+rSz%s-%s-%s���)r(rErW�version�findrXru�lowerr�r5r�rqrr�maxsizerirjrorpr��get_platform_osxr)r��i�j�look�osname�host�releaser�machine�bitnessri�rel_rer�r�r r r!r\sZ


 



cCstS)N)r�r r r r!r�scCsJxDtt|j���D]0\}\}}|dkr2td|�td||f�qWdS)Nrz%s: z
	%s = "%s")�	enumerater�r<�print)�titler�indexr@rAr r r!�_print_dict�srcCsfdtjkrt�dStdt��tdt��tdt��t�tdt��t�tdt	��dS)Nz--generate-posix-varszPlatform: "%s"zPython version: "%s"z!Current installation scheme: "%s"�Paths�	Variables)
rW�argvr�rrrrLrr
rr r r r!�_main�s
r�__main__)rrrrrrr)r#r$)r#r$)F)rr)N)N)Br(rWZos.pathrr�__all__rDr�r�splitr�rYr�r�rrGr�r��base_prefixr�r�r��base_exec_prefixr�r��
_USER_BASEr"r�r�r0�getcwdrEr�endswithr*r5r-r�r/r2r�rHr:rBrKrLr]r�rr�r�r�r�rrr
r	r
rrrrrrr�__name__r r r r!�<module>s�

	

|
	?
 M[
copy.cpython-36.opt-1.pyc000064400000015651150335715140011117 0ustar003


 \o"�@sjdZddlZddlZddlmZGdd�de�ZeZyddlm	Z	Wne
k
r\dZ	YnXdddgZd	d�ZiZ
Zd
d�ZxHed�eeeeeeeeeeeejee�ee�ejejfD]Z eee <q�We!edd�Z e dk	r�eee <e"jee"<e#jee#<e$jee$<e%jee%<e	dk	�r"e	jee	<[[ dgfd
d�Z&iZ'Zdd�Z(e(eed�<e(eee�<e(eee�<e(ee<e(ee<e(ee<e(ee<e(ee<e(ee<ye(eej)<Wne*k
�r�YnXe(ee<e(eej<e(eej<e(eej<e&fdd�Z+e+ee"<e&fdd�Z,e,ee<e&fdd�Z-e-ee#<e	dk	�r2e-ee	<dd�Z.e.eej/<[dd�Z0ddde&fdd�Z1[[[	dS)a�Generic (shallow and deep) copying operations.

Interface summary:

        import copy

        x = copy.copy(y)        # make a shallow copy of y
        x = copy.deepcopy(y)    # make a deep copy of y

For module specific errors, copy.Error is raised.

The difference between shallow and deep copying is only relevant for
compound objects (objects that contain other objects, like lists or
class instances).

- A shallow copy constructs a new compound object and then (to the
  extent possible) inserts *the same objects* into it that the
  original contains.

- A deep copy constructs a new compound object and then, recursively,
  inserts *copies* into it of the objects found in the original.

Two problems often exist with deep copy operations that don't exist
with shallow copy operations:

 a) recursive objects (compound objects that, directly or indirectly,
    contain a reference to themselves) may cause a recursive loop

 b) because deep copy copies *everything* it may copy too much, e.g.
    administrative data structures that should be shared even between
    copies

Python's deep copy operation avoids these problems by:

 a) keeping a table of objects already copied during the current
    copying pass

 b) letting user-defined classes override the copying operation or the
    set of components copied

This version does not copy types like module, class, function, method,
nor stack trace, stack frame, nor file, socket, window, nor array, nor
any similar types.

Classes can use the same interfaces to control copying that they use
to control pickling: they can define methods called __getinitargs__(),
__getstate__() and __setstate__().  See the documentation for module
"pickle" for information on these methods.
�N)�dispatch_tablec@seZdZdS)�ErrorN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/copy.pyr7sr)�PyStringMap�copy�deepcopycCs�t|�}tj|�}|r||�Syt|t�}Wntk
rDd}YnX|rRt|�St|dd�}|rj||�Stj|�}|r�||�}n>t|dd�}|r�|d�}n$t|dd�}|r�|�}ntd|��t	|t
�r�|St|df|��S)zlShallow copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    F�__copy__N�
__reduce_ex__��
__reduce__z%un(shallow)copyable object of type %s)�type�_copy_dispatch�get�
issubclass�	TypeError�_copy_immutable�getattrrr�
isinstance�str�_reconstruct)�x�cls�copier�issc�reductor�rvrrrr
Bs4





cCs|S)Nr)rrrrrosr�CodeTypec
Cs8|dkri}t|�}|j||�}||k	r,|St|�}tj|�}|rN|||�}n�yt|t�}Wntk
rtd}YnX|r�t||�}n�t|dd�}|r�||�}nxtj|�}|r�||�}	n>t|dd�}|r�|d�}	n$t|dd�}|r�|�}	nt	d|��t
|	t��r|}nt||f|	��}||k	�r4|||<t
||�|S)ziDeep copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    Nr�__deepcopy__r
rrz"un(deep)copyable object of type %s)�idrr�_deepcopy_dispatchrr�_deepcopy_atomicrrrrrr�_keep_alive)
r�memoZ_nil�d�yrrrrrrrrr�sJ








cCs|S)Nr)rr&rrrr$�sr$cCs6g}||t|�<|j}x|D]}||||��qW|S)N)r"�append)rr&rr(r)�arrr�_deepcopy_list�s
r+csh��fdd�|D�}y�t|�Stk
r4YnXx,t||�D]\}}||k	rBt|�}PqBW|}|S)Ncsg|]}�|���qSrr)�.0r*)rr&rr�
<listcomp>�sz#_deepcopy_tuple.<locals>.<listcomp>)r"�KeyError�zip�tuple)rr&rr(�k�jr)rr&r�_deepcopy_tuple�sr3cCs>i}||t|�<x(|j�D]\}}|||�||||�<qW|S)N)r"�items)rr&rr(�key�valuerrr�_deepcopy_dict�s
r7cCst|�|jt|j|��S)N)r�__func__r�__self__)rr&rrr�_deepcopy_method�sr:cCs>y|t|�j|�Wn"tk
r8|g|t|�<YnXdS)aMKeeps a reference to the object x in the memo.

    Because we remember objects by their id, we have
    to assure that possibly temporary objects are kept
    alive by referencing them.
    We store a reference at the id of the memo, which should
    normally not be used unless someone tries to deepcopy
    the memo itself...
    N)r"r)r.)rr&rrrr%�s
r%csx�dk	}|r$|r$��fdd�|D�}||�}	|r<|	�t|�<|dk	r�|rR�|��}t|	d�rh|	j|�nbt|t�r�t|�dkr�|\}}
nd}
|dk	r�|	jj|�|
dk	r�x |
j�D]\}}t	|	||�q�W|dk	�r|r�x<|D]}
�|
��}
|	j
|
�q�Wnx|D]}
|	j
|
��qW|dk	�rt|�rXxL|D]&\}}�|��}�|��}||	|<�q,Wnx|D]\}}||	|<�q^W|	S)Nc3s|]}�|��VqdS)Nr)r,�arg)rr&rr�	<genexpr>sz_reconstruct.<locals>.<genexpr>�__setstate__�)r"�hasattrr=rr0�len�__dict__�updater4�setattrr))rr&�func�args�stateZlistiterZdictiterrZdeepr(Z	slotstater5r6�itemr)rr&rrsF









r)2�__doc__�types�weakref�copyregr�	Exceptionr�errorZorg.python.corer	�ImportError�__all__r
rr'rr�int�float�bool�complexrr0�bytes�	frozenset�range�slice�BuiltinFunctionType�Ellipsis�NotImplemented�FunctionType�ref�tr�list�dict�set�	bytearrayrr#r$r �AttributeErrorr+r3r7r:�
MethodTyper%rrrrr�<module>1s~

+






8




+argparse.cpython-36.opt-2.pyc000064400000143201150335715140011743 0ustar003


 \a�@s,dZddddddddd	d
ddd
ddddgZddlZddlZddlZddlZ	ddl
ZddlZ
ddlmZmZdZdZdZdZdZdZdZGdd�de�Zdd�ZGd d�de�ZGd!d�de�ZGd"d�de�ZGd#d�de�ZGd$d	�d	e�Zd%d&�Z Gd'd�de!�Z"Gd(d�de!�Z#Gd)d�de�Z$Gd*d+�d+e$�Z%Gd,d-�d-e$�Z&Gd.d/�d/e&�Z'Gd0d1�d1e&�Z(Gd2d3�d3e$�Z)Gd4d5�d5e$�Z*Gd6d7�d7e$�Z+Gd8d9�d9e$�Z,Gd:d;�d;e$�Z-Gd<d=�d=e$�Z.Gd>d�de�Z/Gd?d
�d
e�Z0Gd@dA�dAe�Z1GdBdC�dCe1�Z2GdDdE�dEe2�Z3GdFd�dee1�Z4dS)Gz1.1�ArgumentParser�
ArgumentError�ArgumentTypeError�FileType�
HelpFormatter�ArgumentDefaultsHelpFormatter�RawDescriptionHelpFormatter�RawTextHelpFormatter�MetavarTypeHelpFormatter�	Namespace�Action�ONE_OR_MORE�OPTIONAL�PARSER�	REMAINDER�SUPPRESS�ZERO_OR_MORE�N)�gettext�ngettextz==SUPPRESS==�?�*�+zA...z...Z_unrecognized_argsc@s$eZdZdd�Zdd�Zdd�ZdS)�_AttributeHoldercCs�t|�j}g}i}x|j�D]}|jt|��qWx8|j�D],\}}|j�r`|jd||f�q<|||<q<W|r�|jdt|��d|dj|�fS)Nz%s=%rz**%sz%s(%s)z, )�type�__name__�	_get_args�append�repr�_get_kwargs�isidentifier�join)�selfZ	type_name�arg_stringsZ	star_args�arg�name�value�r&� /usr/lib64/python3.6/argparse.py�__repr__vs
z_AttributeHolder.__repr__cCst|jj��S)N)�sorted�__dict__�items)r!r&r&r'r�sz_AttributeHolder._get_kwargscCsgS)Nr&)r!r&r&r'r�sz_AttributeHolder._get_argsN)r�
__module__�__qualname__r(rrr&r&r&r'rms	rcCs&t||d�dkrt|||�t||�S)N)�getattr�setattr)�	namespacer$r%r&r&r'�
_ensure_value�sr1c@s�eZdZd:dd�Zdd�Zdd	�ZGd
d�de�Zdd
�Zdd�Z	dd�Z
dd�Zd;dd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�ZdS)<r��NcCs�|dkr@yttjd�}Wnttfk
r6d}YnX|d8}||_||_||_t|t	|d|d��|_||_
d|_d|_d|_
|j|d�|_|j|_tjdtj�|_tjd�|_dS)NZCOLUMNS�Pr2�rz\s+z\n\n\n+)�int�_os�environ�KeyError�
ValueError�_prog�_indent_increment�_max_help_position�min�max�_width�_current_indent�_level�_action_max_length�_Section�
_root_section�_current_section�_re�compile�ASCII�_whitespace_matcher�_long_break_matcher)r!�progZindent_incrementZmax_help_position�widthr&r&r'�__init__�s&
zHelpFormatter.__init__cCs"|j|j7_|jd7_dS)N�)rAr<rB)r!r&r&r'�_indent�szHelpFormatter._indentcCs"|j|j8_|jd8_dS)NrO)rAr<rB)r!r&r&r'�_dedent�szHelpFormatter._dedentc@seZdZddd�Zdd�ZdS)zHelpFormatter._SectionNcCs||_||_||_g|_dS)N)�	formatter�parent�headingr+)r!rRrSrTr&r&r'rN�szHelpFormatter._Section.__init__cCs�|jdk	r|jj�|jj}|dd�|jD��}|jdk	rD|jj�|sLdS|jtk	rz|jdk	rz|jj}d|d|jf}nd}|d||dg�S)NcSsg|]\}}||��qSr&r&)�.0�func�argsr&r&r'�
<listcomp>�sz6HelpFormatter._Section.format_help.<locals>.<listcomp>�z%*s%s:
�
)	rSrRrP�_join_partsr+rQrTrrA)r!r Z	item_helpZcurrent_indentrTr&r&r'�format_help�s



z"HelpFormatter._Section.format_help)N)rr,r-rNr\r&r&r&r'rD�s
rDcCs|jjj||f�dS)N)rFr+r)r!rVrWr&r&r'�	_add_item�szHelpFormatter._add_itemcCs0|j�|j||j|�}|j|jg�||_dS)N)rPrDrFr]r\)r!rTZsectionr&r&r'�
start_section�szHelpFormatter.start_sectioncCs|jj|_|j�dS)N)rFrSrQ)r!r&r&r'�end_section�s
zHelpFormatter.end_sectioncCs$|tk	r |dk	r |j|j|g�dS)N)rr]�_format_text)r!�textr&r&r'�add_text�szHelpFormatter.add_textcCs&|tk	r"||||f}|j|j|�dS)N)rr]�
_format_usage)r!�usage�actions�groups�prefixrWr&r&r'�	add_usage�szHelpFormatter.add_usagecCsz|jtk	rv|j}||�g}x |j|�D]}|j||��q&Wtdd�|D��}||j}t|j|�|_|j|j	|g�dS)NcSsg|]}t|��qSr&)�len)rU�sr&r&r'rX
sz.HelpFormatter.add_argument.<locals>.<listcomp>)
�helpr�_format_action_invocation�_iter_indented_subactionsrr?rArCr]�_format_action)r!�actionZget_invocationZinvocations�	subactionZinvocation_lengthZ
action_lengthr&r&r'�add_arguments


zHelpFormatter.add_argumentcCsx|D]}|j|�qWdS)N)rq)r!reror&r&r'�
add_argumentss
zHelpFormatter.add_argumentscCs.|jj�}|r*|jjd|�}|jd�d}|S)Nz

rZ)rEr\rK�sub�strip)r!rkr&r&r'r\s

zHelpFormatter.format_helpcCsdjdd�|D��S)NrYcSsg|]}|r|tk	r|�qSr&)r)rU�partr&r&r'rX!sz-HelpFormatter._join_parts.<locals>.<listcomp>)r )r!Zpart_stringsr&r&r'r[ s
zHelpFormatter._join_partscs|dkrtd�}|dk	r,|t|jd�}�n�|dkrN|rNdt|jd�}�n�|dk�rdt|jd�}g}g}x(|D] }|jr�|j|�qv|j|�qvW|j}	|	|||�}
djdd�||
gD��}|j|j�t	|�t	|��k�rd}|	||�}|	||�}
t
j||�}t
j||
�}d�fdd	�	}t	|�t	|�d
�k�r�dt	|�t	|�d}|�r�||g|||�}|j|||��n |�r�||g|||�}n|g}nZdt	|�}||}|||�}t	|�dk�r�g}|j|||��|j|||��|g|}dj|�}d
||fS)Nzusage: )rLz%(prog)s� cSsg|]}|r|�qSr&r&)rUrjr&r&r'rXAsz/HelpFormatter._format_usage.<locals>.<listcomp>z%\(.*?\)+(?=\s|$)|\[.*?\]+(?=\s|$)|\S+cs�g}g}|dk	rt|�d}nt|�d}xb|D]Z}|dt|��krp|rp|j|dj|��g}t|�d}|j|�|t|�d7}q0W|r�|j|dj|��|dk	r�|dt|�d�|d<|S)NrOrvr)rirr )�parts�indentrg�lines�lineZline_lenru)�
text_widthr&r'�	get_linesUs"

z.HelpFormatter._format_usage.<locals>.get_linesg�?rOrZz%s%s

)N)
�_�dictr;�option_stringsr�_format_actions_usager r@rArirG�findall�extend)r!rdrerfrgrLZ	optionals�positionalsro�formatZaction_usageZpart_regexpZ	opt_usageZ	pos_usageZ	opt_partsZ	pos_partsr|rxryrwr&)r{r'rc%sV






zHelpFormatter._format_usagec
Cs�t�}i}x�|D]�}y|j|jd�}Wntk
r>wYqX|t|j�}|||�|jkrx|jD]}|j|�qhW|js�||kr�||d7<nd||<d||<n*||kr�||d7<nd||<d||<xt|d|�D]}	d	||	<q�WqWg}
�x2t|�D�]$\}	}|j	t
k�rj|
jd�|j|	�d	k�rF|j
|	�n"|j|	d�d	k�r.|j
|	d�n�|j�s�|j|�}|j||�}||k�r�|ddk�r�|ddk�r�|dd�}|
j|�nh|jd}
|jdk�r�d
|
}n"|j|�}|j||�}d|
|f}|j�r$||k�r$d|}|
j|��q
Wx(t|d
d�D]}	||	g|
|	|	�<�qBWdjdd�|
D��}d}d}tjd|d|�}tjd|d|�}tjd||fd|�}tjdd|�}|j�}|S)Nrz [�[�]z (�(�)rO�|z%sz%s %sz[%s]T)�reverservcSsg|]}|dk	r|�qS)Nr&)rU�itemr&r&r'rX�sz7HelpFormatter._format_actions_usage.<locals>.<listcomp>z[\[(]z[\])]z(%s) z\1z (%s)z%s *%srYz\(([^|]*)\)���r�)�set�index�_group_actionsr:ri�add�required�range�	enumeraterkrr�get�popr�#_get_default_metavar_for_positional�_format_args�nargs�!_get_default_metavar_for_optionalr)r rGrsrt)r!rerf�
group_actionsZinserts�group�start�endro�irw�defaultru�
option_string�args_stringra�open�closer&r&r'r��sr







z#HelpFormatter._format_actions_usagecCsFd|kr|t|jd�}t|j|jd�}d|j}|j|||�dS)Nz%(prog))rL�rvz

)r~r;r?r@rA�
_fill_text)r!rar{rxr&r&r'r`�s

zHelpFormatter._format_textc
CsBt|jd|j�}t|j|d�}||jd}|j|�}|jsV|jd|f}d|}n@t|�|kr~|jd||f}d|}d}n|jd|f}d|}|}|g}|jr�|j	|�}	|j
|	|�}
|jd|d|
df�x@|
dd�D]}|jd|d|f�q�Wn|jd��s|jd�x$|j
|�D]}|j|j|���qW|j|�S)	Nr2r�rYz%*s%s
z	%*s%-*s  rrOrZ)r>rCr=r?r@rArlrkri�_expand_help�_split_linesr�endswithrmrnr[)
r!roZ
help_positionZ
help_widthZaction_widthZ
action_header�tupZindent_firstrwZ	help_textZ
help_linesrzrpr&r&r'rn�s6




zHelpFormatter._format_actioncCs�|js&|j|�}|j||�d�\}|Sg}|jdkrB|j|j�n8|j|�}|j||�}x |jD]}|jd||f�q`Wdj|�SdS)NrOrz%s %sz, )	rr��_metavar_formatterr�r�r�r�rr )r!ror��metavarrwr�r�r&r&r'rls


z'HelpFormatter._format_action_invocationcsP|jdk	r|j�n.|jdk	r<dd�|jD�}ddj|��n|��fdd�}|S)NcSsg|]}t|��qSr&)�str)rUZchoicer&r&r'rX8sz4HelpFormatter._metavar_formatter.<locals>.<listcomp>z{%s}�,cst�t�r�S�f|SdS)N)�
isinstance�tuple)Z
tuple_size)�resultr&r'r�=s
z0HelpFormatter._metavar_formatter.<locals>.format)r��choicesr )r!ro�default_metavarZchoice_strsr�r&)r�r'r�4s

z HelpFormatter._metavar_formattercCs�|j||�}|jdkr$d|d�}n�|jtkr<d|d�}n�|jtkrTd|d�}nh|jtkrld|d�}nP|jtkr|d}n@|jtkr�d|d�}n(d	d
�t|j�D�}dj|�||j�}|S)Nz%srOz[%s]z
[%s [%s ...]]r2z%s [%s ...]z...z%s ...cSsg|]}d�qS)z%sr&)rUr}r&r&r'rXSsz.HelpFormatter._format_args.<locals>.<listcomp>rv)	r�r�r
rrrrr�r )r!ror�Zget_metavarr�Zformatsr&r&r'r�Ds 





zHelpFormatter._format_argscCs�tt|�|jd�}x"t|�D]}||tkr||=qWx,t|�D] }t||d�r@||j||<q@W|jd�dk	r�djdd�|dD��}||d<|j	|�|S)N)rLrr�z, cSsg|]}t|��qSr&)r�)rU�cr&r&r'rX`sz.HelpFormatter._expand_help.<locals>.<listcomp>)
r~�varsr;�listr�hasattrrr�r �_get_help_string)r!roZparamsr$Zchoices_strr&r&r'r�Ws
zHelpFormatter._expand_helpccs@y
|j}Wntk
rYnX|j�|�EdH|j�dS)N)�_get_subactions�AttributeErrorrPrQ)r!roZget_subactionsr&r&r'rmds
z'HelpFormatter._iter_indented_subactionscCs|jjd|�j�}tj||�S)Nrv)rJrsrt�	_textwrapZwrap)r!rarMr&r&r'r�nszHelpFormatter._split_linescCs$|jjd|�j�}tj||||d�S)Nrv)Zinitial_indentZsubsequent_indent)rJrsrtr�Zfill)r!rarMrxr&r&r'r�rs
zHelpFormatter._fill_textcCs|jS)N)rk)r!ror&r&r'r�wszHelpFormatter._get_help_stringcCs
|jj�S)N)�dest�upper)r!ror&r&r'r�zsz/HelpFormatter._get_default_metavar_for_optionalcCs|jS)N)r�)r!ror&r&r'r�}sz1HelpFormatter._get_default_metavar_for_positional)r2r3N)N)rr,r-rNrPrQ�objectrDr]r^r_rbrhrqrrr\r[rcr�r`rnrlr�r�r�rmr�r�r�r�r�r&r&r&r'r�s:	

`a/

c@seZdZdd�ZdS)rcs dj�fdd�|jdd�D��S)NrYc3s|]}�|VqdS)Nr&)rUrz)rxr&r'�	<genexpr>�sz9RawDescriptionHelpFormatter._fill_text.<locals>.<genexpr>T)�keepends)r �
splitlines)r!rarMrxr&)rxr'r��sz&RawDescriptionHelpFormatter._fill_textN)rr,r-r�r&r&r&r'r�sc@seZdZdd�ZdS)rcCs|j�S)N)r�)r!rarMr&r&r'r��sz!RawTextHelpFormatter._split_linesN)rr,r-r�r&r&r&r'r�sc@seZdZdd�ZdS)rcCs>|j}d|jkr:|jtk	r:ttg}|js2|j|kr:|d7}|S)Nz
%(default)z (default: %(default)s))rkr�rr
rrr�)r!rorkZdefaulting_nargsr&r&r'r��s

z.ArgumentDefaultsHelpFormatter._get_help_stringN)rr,r-r�r&r&r&r'r�sc@seZdZdd�Zdd�ZdS)r	cCs|jjS)N)rr)r!ror&r&r'r��sz:MetavarTypeHelpFormatter._get_default_metavar_for_optionalcCs|jjS)N)rr)r!ror&r&r'r��sz<MetavarTypeHelpFormatter._get_default_metavar_for_positionalN)rr,r-r�r�r&r&r&r'r	�scCsN|dkrdS|jrdj|j�S|jdtfkr2|jS|jdtfkrF|jSdSdS)N�/)rr r�rr�)�argumentr&r&r'�_get_action_name�sr�c@seZdZdd�Zdd�ZdS)rcCst|�|_||_dS)N)r��
argument_name�message)r!r�r�r&r&r'rN�s
zArgumentError.__init__cCs(|jdkrd}nd}|t|j|jd�S)Nz%(message)sz'argument %(argument_name)s: %(message)s)r�r�)r�r~r�)r!r�r&r&r'�__str__�s

zArgumentError.__str__N)rr,r-rNr�r&r&r&r'r�sc@seZdZdS)rN)rr,r-r&r&r&r'r�sc@s(eZdZd	dd�Zdd�Zd
dd�ZdS)rNFcCs@||_||_||_||_||_||_||_||_|	|_|
|_	dS)N)
rr�r��constr�rr�r�rkr�)r!rr�r�r�r�rr�r�rkr�r&r&r'rNszAction.__init__c	s(ddddddddd	g	}�fd
d�|D�S)Nrr�r�r�r�rr�rkr�csg|]}|t�|�f�qSr&)r.)rUr$)r!r&r'rX;sz&Action._get_kwargs.<locals>.<listcomp>r&)r!�namesr&)r!r'r/szAction._get_kwargscCsttd���dS)Nz.__call__() not defined)�NotImplementedErrorr})r!�parserr0�valuesr�r&r&r'�__call__=szAction.__call__)NNNNNFNN)N)rr,r-rNrr�r&r&r&r'r�s6
cs(eZdZd�fdd�	Zddd�Z�ZS)	�_StoreActionNFcsT|dkrtd��|dk	r,|tkr,tdt��tt|�j|||||||||	|
d�
dS)Nrz�nargs for store actions must be > 0; if you have nothing to store, actions such as store true or store const may be more appropriatez nargs must be %r to supply const)
rr�r�r�r�rr�r�rkr�)r:r
�superr�rN)r!rr�r�r�r�rr�r�rkr�)�	__class__r&r'rNCs
z_StoreAction.__init__cCst||j|�dS)N)r/r�)r!r�r0r�r�r&r&r'r�`sz_StoreAction.__call__)NNNNNFNN)N)rr,r-rNr��
__classcell__r&r&)r�r'r�Asr�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_StoreConstActionNFc	s"tt|�j||d||||d�dS)Nr)rr�r�r�r�r�rk)r�r�rN)r!rr�r�r�r�rkr�)r�r&r'rNfs
z_StoreConstAction.__init__cCst||j|j�dS)N)r/r�r�)r!r�r0r�r�r&r&r'r�wsz_StoreConstAction.__call__)NFNN)N)rr,r-rNr�r�r&r&)r�r'r�ds

r�cseZdZd�fdd�	Z�ZS)�_StoreTrueActionFNcs tt|�j||d|||d�dS)NT)rr�r�r�r�rk)r�r�rN)r!rr�r�r�rk)r�r&r'rN}s
z_StoreTrueAction.__init__)FFN)rr,r-rNr�r&r&)r�r'r�{sr�cseZdZd�fdd�	Z�ZS)�_StoreFalseActionTFNcs tt|�j||d|||d�dS)NF)rr�r�r�r�rk)r�r�rN)r!rr�r�r�rk)r�r&r'rN�s
z_StoreFalseAction.__init__)TFN)rr,r-rNr�r&r&)r�r'r��sr�cs(eZdZd�fdd�	Zddd�Z�ZS)	�
_AppendActionNFcsT|dkrtd��|dk	r,|tkr,tdt��tt|�j|||||||||	|
d�
dS)Nrz�nargs for append actions must be > 0; if arg strings are not supplying the value to append, the append const action may be more appropriatez nargs must be %r to supply const)
rr�r�r�r�rr�r�rkr�)r:r
r�r�rN)r!rr�r�r�r�rr�r�rkr�)r�r&r'rN�s
z_AppendAction.__init__cCs0tjt||jg��}|j|�t||j|�dS)N)�_copy�copyr1r�rr/)r!r�r0r�r�r+r&r&r'r��s
z_AppendAction.__call__)NNNNNFNN)N)rr,r-rNr�r�r&r&)r�r'r��sr�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_AppendConstActionNFc
s$tt|�j||d|||||d�dS)Nr)rr�r�r�r�r�rkr�)r�r�rN)r!rr�r�r�r�rkr�)r�r&r'rN�s
z_AppendConstAction.__init__cCs2tjt||jg��}|j|j�t||j|�dS)N)r�r�r1r�rr�r/)r!r�r0r�r�r+r&r&r'r��sz_AppendConstAction.__call__)NFNN)N)rr,r-rNr�r�r&r&)r�r'r��s
r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_CountActionNFcs tt|�j||d|||d�dS)Nr)rr�r�r�r�rk)r�r�rN)r!rr�r�r�rk)r�r&r'rN�s
z_CountAction.__init__cCs$t||jd�d}t||j|�dS)NrrO)r1r�r/)r!r�r0r�r�Z	new_countr&r&r'r��sz_CountAction.__call__)NFN)N)rr,r-rNr�r�r&r&)r�r'r��s	r�cs.eZdZeedf�fdd�	Zddd�Z�ZS)�_HelpActionNcstt|�j|||d|d�dS)Nr)rr�r�r�rk)r�r�rN)r!rr�r�rk)r�r&r'rN�s
z_HelpAction.__init__cCs|j�|j�dS)N)�
print_help�exit)r!r�r0r�r�r&r&r'r��sz_HelpAction.__call__)N)rr,r-rrNr�r�r&r&)r�r'r��sr�cs0eZdZdeedf�fdd�	Zddd�Z�ZS)�_VersionActionNz&show program's version number and exitcs$tt|�j|||d|d�||_dS)Nr)rr�r�r�rk)r�r�rN�version)r!rr�r�r�rk)r�r&r'rNs
z_VersionAction.__init__cCsD|j}|dkr|j}|j�}|j|�|j|j�tj�|j�dS)N)r��_get_formatterrb�_print_messager\�_sys�stdoutr�)r!r�r0r�r�r�rRr&r&r'r�s
z_VersionAction.__call__)N)rr,r-rrNr�r�r&r&)r�r'r�s
	r�csNeZdZGdd�de�Zeddf�fdd�	Zdd�Zdd	�Zdd
d�Z	�Z
S)
�_SubParsersActioncseZdZ�fdd�Z�ZS)z&_SubParsersAction._ChoicesPseudoActioncs@|}}|r|ddj|�7}ttj|�}|jg|||d�dS)Nz (%s)z, )rr�rkr�)r r�r��_ChoicesPseudoActionrN)r!r$�aliasesrkr�r�Zsup)r�r&r'rN"s
z/_SubParsersAction._ChoicesPseudoAction.__init__)rr,r-rNr�r&r&)r�r'r� sr�Ncs>||_||_tj�|_g|_tt|�j||t	|j||d�dS)N)rr�r�r�rkr�)
�_prog_prefix�
_parser_class�_collections�OrderedDict�_name_parser_map�_choices_actionsr�r�rNr)r!rrL�parser_classr�rkr�)r�r&r'rN*s

z_SubParsersAction.__init__cKs�|jd�dkr d|j|f|d<|jdf�}d|krX|jd�}|j|||�}|jj|�|jf|�}||j|<x|D]}||j|<qtW|S)NrLz%s %sr�rk)r�r�r�r�r�rr�r�)r!r$�kwargsr�rkZ
choice_actionr��aliasr&r&r'�
add_parser?s


z_SubParsersAction.add_parsercCs|jS)N)r�)r!r&r&r'r�Vsz!_SubParsersAction._get_subactionsc
Cs�|d}|dd�}|jtk	r,t||j|�y|j|}Wn<tk
rv|dj|j�d�}td�|}t||��YnX|j|d�\}	}x$t	|	�j
�D]\}
}t||
|�q�W|r�t	|�jtg�t
|t�j|�dS)NrrOz, )�parser_namer�z5unknown parser %(parser_name)r (choices: %(choices)s))r�rr/r�r9r r}r�parse_known_argsr�r+�
setdefault�_UNRECOGNIZED_ARGS_ATTRr.r�)r!r�r0r�r�r�r"rW�msgZsubnamespace�keyr%r&r&r'r�Ys"
	z_SubParsersAction.__call__)N)rr,r-rr�rrNr�r�r�r�r&r&)r�r'r�sr�c@s&eZdZddd�Zdd�Zdd	�ZdS)r�rrONcCs||_||_||_||_dS)N)�_mode�_bufsize�	_encoding�_errors)r!�mode�bufsize�encoding�errorsr&r&r'rN�szFileType.__init__cCs�|dkr>d|jkrtjSd|jkr(tjStd�|j}t|��yt||j|j|j|j	�St
k
r�}ztd�}t|||f��WYdd}~XnXdS)N�-r��wzargument "-" with mode %rzcan't open '%s': %s)r�r��stdinr�r}r:r�r�r�r��OSErrorr)r!�stringr��er�r&r&r'r��s

zFileType.__call__cCsT|j|jf}d|jfd|jfg}djdd�|D�dd�|D��}dt|�j|fS)Nr�r�z, cSsg|]}|dkrt|��qS)rOr�)r)rUr#r&r&r'rX�sz%FileType.__repr__.<locals>.<listcomp>cSs$g|]\}}|dk	rd||f�qS)Nz%s=%rr&)rU�kwr#r&r&r'rX�sz%s(%s))r�r�r�r�r rr)r!rWr�Zargs_strr&r&r'r(�s
zFileType.__repr__r�)r�r�NN)rr,r-rNr�r(r&r&r&r'r~s
c@s$eZdZdd�Zdd�Zdd�ZdS)r
cKs"x|D]}t||||�qWdS)N)r/)r!r�r$r&r&r'rN�s
zNamespace.__init__cCst|t�stSt|�t|�kS)N)r�r
�NotImplementedr�)r!�otherr&r&r'�__eq__�s
zNamespace.__eq__cCs
||jkS)N)r*)r!r�r&r&r'�__contains__�szNamespace.__contains__N)rr,r-rNrrr&r&r&r'r
�scs�eZdZ�fdd�Zdd�Zd&dd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd'dd�Zdd�Zd d!�Zd"d#�Zd$d%�Z�ZS)(�_ActionsContainercstt|�j�||_||_||_||_i|_|jddt	�|jddt	�|jddt
�|jddt�|jddt�|jddt
�|jddt�|jddt�|jdd	t�|jdd
t�|jddt�|j�g|_i|_g|_g|_i|_tjd�|_g|_dS)
NroZstoreZstore_const�
store_trueZstore_falserZappend_const�countrkr��parsersz^-\d+$|^-\d*\.\d+$)r�r	rN�description�argument_default�prefix_chars�conflict_handler�_registries�registerr�r�r�r�r�r�r�r�r�r��_get_handler�_actions�_option_string_actions�_action_groups�_mutually_exclusive_groups�	_defaultsrGrH�_negative_number_matcher�_has_negative_number_optionals)r!r
rrr)r�r&r'rN�s2z_ActionsContainer.__init__cCs|jj|i�}|||<dS)N)rr�)r!�
registry_namer%r��registryr&r&r'r�sz_ActionsContainer.registerNcCs|j|j||�S)N)rr�)r!rr%r�r&r&r'�
_registry_getsz_ActionsContainer._registry_getcKs6|jj|�x$|jD]}|j|kr||j|_qWdS)N)r�updaterr�r�)r!r�ror&r&r'�set_defaultss
z_ActionsContainer.set_defaultscCs8x(|jD]}|j|kr|jdk	r|jSqW|jj|d�S)N)rr�r�rr�)r!r�ror&r&r'�get_defaults
z_ActionsContainer.get_defaultcOs0|j}|s(t|�dkrJ|dd|krJ|r<d|kr<td��|j||�}n|j||�}d|kr�|d}||jkr�|j||d<n|jdk	r�|j|d<|j|�}t|�s�td|f��|f|�}|j	d|j
|j
�}t|�s�td|f��t|d	��r&y|j�j
|d�Wntk
�r$td
��YnX|j|�S)NrOrr�z+dest supplied twice for positional argumentr�zunknown action "%s"rz%r is not callabler�z,length of metavar tuple does not match nargs)rrir:�_get_positional_kwargs�_get_optional_kwargsrr�_pop_action_class�callablerrr�r�r��	TypeError�_add_action)r!rWr��charsr�Zaction_classro�	type_funcr&r&r'rqs2	"




z_ActionsContainer.add_argumentcOs t|f|�|�}|jj|�|S)N)�_ArgumentGrouprr)r!rWr�r�r&r&r'�add_argument_groupJsz$_ActionsContainer.add_argument_groupcKst|f|�}|jj|�|S)N)�_MutuallyExclusiveGrouprr)r!r�r�r&r&r'�add_mutually_exclusive_groupOsz._ActionsContainer.add_mutually_exclusive_groupcCsh|j|�|jj|�||_x|jD]}||j|<q$Wx,|jD]"}|jj|�r>|js>|jjd�q>W|S)NT)	�_check_conflictrr�	containerrrr�matchr)r!ror�r&r&r'r&Ts
z_ActionsContainer._add_actioncCs|jj|�dS)N)r�remove)r!ror&r&r'�_remove_actionisz _ActionsContainer._remove_actioncCs�i}x8|jD].}|j|kr0td�}t||j��|||j<qWi}xR|jD]H}|j|krt|j|j|j|jd�||j<x|jD]}||j||<q|WqJWx4|jD]*}|j	|j
d�}x|jD]}|||<q�Wq�Wx |jD]}|j||�j
|�q�WdS)Nz.cannot merge actions - two groups are named %r)�titler
r)r�)rr2r}r:r*r
rr�rr,r�rr�r&)r!r.Ztitle_group_mapr�r�Z	group_mapro�mutex_groupr&r&r'�_add_container_actionsls,


z(_ActionsContainer._add_container_actionscKs^d|krtd�}t|��|jd�ttgkr2d|d<|jd�tkrPd|krPd|d<t||gd�S)Nr�z1'required' is an invalid argument for positionalsr�Tr�)r�r)r}r%r�r
rr~)r!r�r�r�r&r&r'r!�sz(_ActionsContainer._get_positional_kwargsc	Os�g}g}xv|D]n}|d|jkr@||jd�}td�}t||��|j|�|d|jkrt|�dkr|d|jkr|j|�qW|jdd�}|dkr�|r�|d}n|d}|j|j�}|s�td�}t||��|jdd�}t|||d	�S)
Nr)�optionrzNinvalid option string %(option)r: must start with a character %(prefix_chars)rrOr�z%dest= is required for options like %rr�r})r�r)	rr}r:rrir��lstrip�replacer~)	r!rWr�rZlong_option_stringsr�r�r�Zdest_option_stringr&r&r'r"�s0



z&_ActionsContainer._get_optional_kwargscCs|jd|�}|jd||�S)Nro)r�r)r!r�r�ror&r&r'r#�sz#_ActionsContainer._pop_action_classcCsDd|j}y
t||�Stk
r>td�}t||j��YnXdS)Nz_handle_conflict_%sz%invalid conflict_resolution value: %r)rr.r�r}r:)r!Zhandler_func_namer�r&r&r'r�s

z_ActionsContainer._get_handlercCsPg}x0|jD]&}||jkr|j|}|j||f�qW|rL|j�}|||�dS)N)rrrr)r!roZconfl_optionalsr�Zconfl_optionalrr&r&r'r-�s

z!_ActionsContainer._check_conflictcCs6tddt|��}djdd�|D��}t|||��dS)Nzconflicting option string: %szconflicting option strings: %sz, cSsg|]\}}|�qSr&r&)rUr�ror&r&r'rX�sz<_ActionsContainer._handle_conflict_error.<locals>.<listcomp>)rrir r)r!ro�conflicting_actionsr�Zconflict_stringr&r&r'�_handle_conflict_error�s


z(_ActionsContainer._handle_conflict_errorcCsBx<|D]4\}}|jj|�|jj|d�|js|jj|�qWdS)N)rr0rr�r.r1)r!ror8r�r&r&r'�_handle_conflict_resolve�s
z*_ActionsContainer._handle_conflict_resolve)N)N)rr,r-rNrrrr rqr*r,r&r1r4r!r"r#rr-r9r:r�r&r&)r�r'r	�s$4
	
/($
		r	cs6eZdZd�fdd�	Z�fdd�Z�fdd�Z�ZS)	r)Ncs�|j}|d|j�|d|j�|d|j�tt|�j}|fd|i|��||_g|_|j	|_	|j
|_
|j|_|j|_|j
|_
|j|_dS)Nrrrr
)r�rrrr�r)rNr2r�rrrrrr)r!r.r2r
r�rZ
super_init)r�r&r'rN�sz_ArgumentGroup.__init__cs tt|�j|�}|jj|�|S)N)r�r)r&r�r)r!ro)r�r&r'r&sz_ArgumentGroup._add_actioncs tt|�j|�|jj|�dS)N)r�r)r1r�r0)r!ro)r�r&r'r1sz_ArgumentGroup._remove_action)NN)rr,r-rNr&r1r�r&r&)r�r'r)�sr)cs.eZdZd�fdd�	Zdd�Zdd�Z�ZS)	r+Fcs tt|�j|�||_||_dS)N)r�r+rNr��
_container)r!r.r�)r�r&r'rNsz _MutuallyExclusiveGroup.__init__cCs2|jrtd�}t|��|jj|�}|jj|�|S)Nz-mutually exclusive arguments must be optional)r�r}r:r;r&r�r)r!ror�r&r&r'r&$sz#_MutuallyExclusiveGroup._add_actioncCs|jj|�|jj|�dS)N)r;r1r�r0)r!ror&r&r'r1,sz&_MutuallyExclusiveGroup._remove_action)F)rr,r-rNr&r1r�r&r&)r�r'r+sr+cseZdZddddgeddddddf�fdd�	Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	d<dd�Z
d=dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd>d1d2�Zd?d3d4�Zd@d5d6�ZdAd8d9�Zd:d;�Z�ZS)BrNr��errorTc
s&tt|�j}
|
|||	|
d�|dkr6tjjtjd�}||_||_	||_
||_||_||_
||_|j}|td��|_|td��|_d|_dd�}|jdd|�d|kr�dn|d}|j
r�|j|d	|d
ddttd�d
�xD|D]<}|j|�y
|j}Wntk
�rYq�X|jj|�q�WdS)N)r
rrrrzpositional argumentszoptional argumentscSs|S)Nr&)rr&r&r'�identityjsz)ArgumentParser.__init__.<locals>.identityrr��hr2rkzshow this help message and exit)ror�rk)r�rrNr7�path�basenamer��argvrLrd�epilog�formatter_class�fromfile_prefix_chars�add_help�allow_abbrevr*r}�_positionals�
_optionals�_subparsersrrqrr4rr�r)r!rLrdr
rB�parentsrCrrDrrrErFZ	superinitZ	add_groupr=Zdefault_prefixrSZdefaults)r�r&r'rNDsB


zArgumentParser.__init__cs"ddddddg}�fdd�|D�S)	NrLrdr
rCrrEcsg|]}|t�|�f�qSr&)r.)rUr$)r!r&r'rX�sz.ArgumentParser._get_kwargs.<locals>.<listcomp>r&)r!r�r&)r!r'r�szArgumentParser._get_kwargsc	Ks�|jdk	r|jtd��|jdt|��d|ks8d|krht|jdd��}t|jdd��}|j||�|_n|j|_|jd�dkr�|j	�}|j
�}|j}|j|j
||d�|j�j�|d<|j|d�}|fd	gi|��}|jj|�|S)
Nz(cannot have multiple subparser argumentsr�r2r
ZsubcommandsrLrYrr)rIr<r}r�rr�r*rGr�r��_get_positional_actionsrrhrdr\rtr#r&)	r!r�r2r
rRr�rfZ
parsers_classror&r&r'�add_subparsers�s$
zArgumentParser.add_subparserscCs$|jr|jj|�n|jj|�|S)N)rrHr&rG)r!ror&r&r'r&�szArgumentParser._add_actioncCsdd�|jD�S)NcSsg|]}|jr|�qSr&)r)rUror&r&r'rX�sz8ArgumentParser._get_optional_actions.<locals>.<listcomp>)r)r!r&r&r'�_get_optional_actions�sz$ArgumentParser._get_optional_actionscCsdd�|jD�S)NcSsg|]}|js|�qSr&)r)rUror&r&r'rX�sz:ArgumentParser._get_positional_actions.<locals>.<listcomp>)r)r!r&r&r'rK�sz&ArgumentParser._get_positional_actionscCs4|j||�\}}|r0td�}|j|dj|��|S)Nzunrecognized arguments: %srv)r�r}r<r )r!rWr0rAr�r&r&r'�
parse_args�s
zArgumentParser.parse_argscCs|dkrtjdd�}nt|�}|dkr.t�}x>|jD]4}|jtk	r6t||j�s6|jtk	r6t	||j|j�q6Wx*|j
D] }t||�svt	|||j
|�qvWy<|j||�\}}t|t�r�|j
t|t��t|t�||fStk
�rtj�d}|jt|��YnXdS)NrO)r�rAr�r
rr�rr�r�r/r�_parse_known_argsr�r�r.�delattrr�exc_infor<r�)r!rWr0ror��errr&r&r'r��s,




zArgumentParser.parse_known_argscs"�	jdk	r�	j���i�x`�	jD]V}|j}xJt|j�D]<\}}�j|g�}|j|d|��|j||dd��q6Wq Wi�g}t��}	xnt|	�D]b\}}
|
dkr�|jd�xF|	D]}
|jd�q�Wq��	j	|
�}|dkr�d}n|�|<d}|j|�q�Wdj
|��t��t��d�����	fdd�	������	�fd	d
�}
�	j������	�fdd�}g�d
�
��rpt
��}nd}x|�
|k�r�t�
fdd��D��}�
|k�r�|�
�}|�
k�r�|�
�qvn|�
�
�k�r��
|�}�j|�|�
|
�
��
�qvW|�
�}�j�|d��g}x��	jD]|}|�k�r|j�r>|jt|��nT|jdk	�rt|jt��rt�|j��r|jt�|j�k�rt�|j�	j||j���qW|�r��	jtd�dj
|��xb�	jD]X}|j�r�xH|jD]}|�k�r�P�q�Wdd�|jD�}td�}�	j|dj
|���q�W��fS)NrOz--r��A�OrYcs��j|��j||�}||jk	rf�j|�x:�j|g�D]*}|�kr8td�}t|�}t|||��q8W|tk	r||��||�dS)Nznot allowed with argument %s)r��_get_valuesr�r�r}r�rr)roZargument_stringsr�Zargument_valuesZconflict_actionr�Zaction_name)�action_conflictsr0�seen_actions�seen_non_default_actionsr!r&r'�take_actions


z5ArgumentParser._parse_known_args.<locals>.take_actioncs��|}|\}}}�j}g}�x>|dkr>�j�|�|dS|dk	�r||d�}�j}|dkr�|d|kr�|j|g|f�|d}	|	|d}|dd�p�d}
�j}||kr�||}|
}ntd�}t|||��n@|dkr�|d}
|g}|j|||f�Pntd�}t|||��q |d}�|d�}|||�}||}
�||
�}|j|||f�Pq Wx |D]\}}}�|||��qdW|
S)NrOrSrzignored explicit argument %r)�_match_argumentrrrr}r)�start_index�option_tupleror��explicit_argZmatch_argumentZ
action_tuples�	arg_countr'�charZnew_explicit_argZ
optionals_mapr��stoprWr�Zselected_patterns)r"�arg_strings_pattern�extras�option_string_indicesr!rYr&r'�consume_optional3sN



z:ArgumentParser._parse_known_args.<locals>.consume_optionalcsr�j}�|d�}|�|�}x8t�|�D]*\}}�|||�}||7}�||�q(W�t|�d��dd�<|S)N)�_match_arguments_partial�zipri)r[Z
match_partialZselected_patternZ
arg_countsror^rW)r"rar�r!rYr&r'�consume_positionals�s
z=ArgumentParser._parse_known_args.<locals>.consume_positionalsrcsg|]}|�kr|�qSr&r&)rUr�)r[r&r'rX�sz4ArgumentParser._parse_known_args.<locals>.<listcomp>z(the following arguments are required: %sz, cSsg|]}|jtk	rt|��qSr&)rkrr�)rUror&r&r'rX�sz#one of the arguments %s is requiredrv)Nr�)rD�_read_args_from_filesrr�r�r�r��iterr�_parse_optionalr r�rKr?r>rr�r�r�r�r�r�r�r.r/�
_get_valuer<r})r!r"r0r3r�r�Zmutex_actionZ	conflictsZarg_string_pattern_partsZarg_strings_iter�
arg_stringr\�patternrdrgZmax_option_string_indexZnext_option_string_indexZpositionals_end_indexZstringsZ
stop_indexZrequired_actionsror�r�r�r&)rVr"rarbr0rcr�rWrXr!r[rYr'rO�s�





J










z ArgumentParser._parse_known_argscCs�g}x�|D]�}|s"|d|jkr.|j|�q
ylt|dd���R}g}x2|j�j�D]"}x|j|�D]}|j|�qdWqTW|j|�}|j|�WdQRXWq
tk
r�t	j
�d}|jt|��Yq
Xq
W|S)NrrO)
rDrr��readr��convert_arg_line_to_argsrhr�rr�rQr<r�)r!r"Znew_arg_stringsrlZ	args_file�arg_liner#rRr&r&r'rh�s 

z$ArgumentParser._read_args_from_filescCs|gS)Nr&)r!rpr&r&r'ro�sz'ArgumentParser.convert_arg_line_to_argscCst|j|�}tj||�}|dkrfdtd�ttd�ttd�i}tdd|j�|j}|j|j|�}t	||��t
|jd��S)Nzexpected one argumentzexpected at most one argumentzexpected at least one argumentzexpected %s argumentzexpected %s argumentsrO)�_get_nargs_patternrGr/r}r
rrr�r�rrir�)r!rora�
nargs_patternr/Znargs_errorsr�r�r&r&r'rZs

zArgumentParser._match_argumentcstg}xjtt|�dd�D]V}|d|�}dj�fdd�|D��}tj||�}|dk	r|jdd�|j�D��PqW|S)NrrOrYcsg|]}�j|��qSr&)rq)rUro)r!r&r'rXsz;ArgumentParser._match_arguments_partial.<locals>.<listcomp>cSsg|]}t|��qSr&)ri)rUrr&r&r'rX!sr�)r�rir rGr/r�rf)r!rerar�r�Z
actions_slicermr/r&)r!r'res
z'ArgumentParser._match_arguments_partialc
Cs|sdS|d|jkrdS||jkr8|j|}||dfSt|�dkrHdSd|kr~|jdd�\}}||jkr~|j|}|||fS|jr�|j|�}t|�dkr�djdd�|D��}||d�}td�}|j||�nt|�dkr�|\}	|	S|j	j
|��r|j�sdSd	|k�rdSd|dfS)
NrrO�=z, cSsg|]\}}}|�qSr&r&)rUror�r]r&r&r'rXGsz2ArgumentParser._parse_optional.<locals>.<listcomp>)r5Zmatchesz4ambiguous option: %(option)s could match %(matches)srv)rrri�splitrF�_get_option_tuplesr r}r<rr/r)
r!rlror�r]Z
option_tuplesZoptionsrWr�r\r&r&r'rj's>










zArgumentParser._parse_optionalc
Cs0g}|j}|d|kr~|d|kr~d|kr<|jdd�\}}n|}d}x�|jD],}|j|�rL|j|}|||f}|j|�qLWn�|d|ko�|d|k�r|}d}|dd�}|dd�}	xr|jD]T}||kr�|j|}|||	f}|j|�q�|j|�r�|j|}|||f}|j|�q�Wn|jtd�|�|S)NrrOrsr2zunexpected option string: %s)rrtr�
startswithrr<r})
r!r�r�r'Z
option_prefixr]ror�Zshort_option_prefixZshort_explicit_argr&r&r'rubs8







z!ArgumentParser._get_option_tuplescCs�|j}|dkrd}nX|tkr"d}nJ|tkr0d}n<|tkr>d}n.|tkrLd}n |tkrZd}nddjd	|�}|jr�|jdd
�}|jdd
�}|S)Nz(-*A-*)z(-*A?-*)z	(-*[A-]*)z
(-*A[A-]*)z([-AO]*)z(-*A[-AO]*)z(-*%s-*)z-*rSrYr�)	r�r
rrrrr rr7)r!ror�rrr&r&r'rq�s$z!ArgumentParser._get_nargs_patterncsx�jttgkr2y|jd�Wntk
r0YnX|rz�jtkrz�jrP�j}n�j}t	|t
�rx�j�|�}�j�|�n�|r��jt
kr��jr��jdk	r��j}n|}�j�|�n�t|�dkr�jdtgkr�|\}�j�|�}�j�|�n��jtk�r��fdd�|D�}nb�jtk�rD��fdd�|D�}�j�|d�n0��fdd�|D�}x|D]}�j�|��q^W|S)Nz--rOcsg|]}�j�|��qSr&)rk)rU�v)ror!r&r'rX�sz.ArgumentParser._get_values.<locals>.<listcomp>csg|]}�j�|��qSr&)rk)rUrw)ror!r&r'rX�srcsg|]}�j�|��qSr&)rk)rUrw)ror!r&r'rX�s)r�rrr0r:r
rr�r�r�r�rk�_check_valuerri)r!ror"r%rlrwr&)ror!r'rU�s>


zArgumentParser._get_valuescCs�|jd|j|j�}t|�s0td�}t|||��y||�}Wn�tk
r~t|jdt|j��}tt	j
�d�}t||��YnLttfk
r�t|jdt|j��}||d�}td�}t|||��YnX|S)Nrz%r is not callablerrO)rr%z!invalid %(type)s value: %(value)r)
rrr$r}rrr.rr�r�rQr%r:)r!rorlr(r�r�r$rWr&r&r'rk�s 
zArgumentParser._get_valuecCsF|jdk	rB||jkrB|djtt|j��d�}td�}t|||��dS)Nz, )r%r�z3invalid choice: %(value)r (choose from %(choices)s))r�r �maprr}r)r!ror%rWr�r&r&r'rx	s
zArgumentParser._check_valuecCs$|j�}|j|j|j|j�|j�S)N)r�rhrdrrr\)r!rRr&r&r'�format_usage	szArgumentParser.format_usagecCsx|j�}|j|j|j|j�|j|j�x:|jD]0}|j|j	�|j|j�|j
|j�|j�q0W|j|j
�|j�S)N)r�rhrdrrrbr
rr^r2rrr�r_rBr\)r!rRZaction_groupr&r&r'r\	szArgumentParser.format_helpcCs|j|jd�S)N)rL)rCrL)r!r&r&r'r�0	szArgumentParser._get_formattercCs"|dkrtj}|j|j�|�dS)N)r�r�r�rz)r!�filer&r&r'�print_usage6	szArgumentParser.print_usagecCs"|dkrtj}|j|j�|�dS)N)r�r�r�r\)r!r{r&r&r'r�;	szArgumentParser.print_helpcCs |r|dkrtj}|j|�dS)N)r��stderr�write)r!r�r{r&r&r'r�@	szArgumentParser._print_messagercCs |r|j|tj�tj|�dS)N)r�r�r}r�)r!Zstatusr�r&r&r'r�I	szArgumentParser.exitcCs0|jtj�|j|d�}|jdtd�|�dS)N)rLr�r2z%(prog)s: error: %(message)s
)r|r�r}rLr�r})r!r�rWr&r&r'r<N	s	zArgumentParser.error)NN)NN)N)N)N)rN) rr,r-rrNrrLr&rMrKrNr�rOrhrorZrerjrurqrUrkrxrzr\r�r|r�r�r�r<r�r&r&)r�r'r1sN4

#w;,,4


	
)5�__version__�__all__�collectionsr�r�r��osr7�rerG�sysr��textwrapr�rr}rrr
rrrrr�r�rr1rrrrr	r��	Exceptionrrrr�r�r�r�r�r�r�r�r�r�rr
r	r)r+rr&r&r&r'�<module>@s~
n
	[#%`65"pickle.cpython-36.opt-2.pyc000064400000111634150335715140011413 0ustar003


 \���@sddlmZddlmZddlmZmZmZddlmZddl	m
Z
ddlZddlmZddl
mZmZddlZddlZddlZddlZd	d
ddd
ddddg	ZeefZdZdddddddgZdZdZGdd	�d	e�ZGdd
�d
e�ZGdd�de�ZGdd�de�Z ydd l!m"Z"Wne#k
�r.dZ"YnXd!Z$d"Z%d#Z&d$Z'd%Z(d&Z)d'Z*d(Z+d)Z,d*Z-d+Z.d,Z/d-Z0d.Z1d/Z2d0Z3d1Z4d2Z5d3Z6d4Z7d5Z8d6Z9d7Z:d8Z;d9Z<d:Z=d;Z>d<Z?d=Z@d>ZAd?ZBd@ZCdAZDdBZEdCZFdDZGdEZHdFZIdGZJdHZKdIZLdJZMdKZNdLZOdMZPdNZQdOZRdPZSdQZTdRZUdSZVdTZWdUZXdVZYdWZZeJeTeUeVgZ[dXZ\dYZ]dZZ^d[Z_d\Z`d]Zad^Zbd_Zcd`ZddaZedbZfdcZgejhddde�ei�D��Gdfdg�dg�ZjGdhdi�di�Zkdjdk�Zldldm�Zmdndo�Zndpdq�ZoGdrds�ds�ZpGdtdu�du�Zqd�dvdw�dxdy�Zrd�dvdw�dzd{�Zsdvd|d}d~�dd��Ztdvd|d}d~�d�d��Zuy0dd�lvmZmZmZmwZwmxZxmyZymzZzm{Z{m|Z|Wn4e#k
�r^epeqZwZxereseteuf\ZyZzZ{Z|YnXd�d��Z}e~d�k�rddlZej�d�d��Z�e�j�d�ej�d��d�d�d��e�j�d�d�d�d�d��e�j�d�d�d�d��e�j��Z�e�j��r�e}�n>e�j��s�e�j��n,ddl�Z�x"e�j�D]Z�e{e��Z�e�j�e���q�WdS)��)�FunctionType)�dispatch_table)�_extension_registry�_inverted_registry�_extension_cache)�islice)�partialN)�maxsize)�pack�unpack�PickleError�
PicklingError�UnpicklingError�Pickler�	Unpickler�dump�dumps�load�loadsz4.0z1.0z1.1z1.2z1.3z2.0z3.0��c@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/pickle.pyr@sc@seZdZdS)r
N)rrrrrrrr
Dsc@seZdZdS)rN)rrrrrrrrKs	c@seZdZdd�ZdS)�_StopcCs
||_dS)N)�value)�selfrrrr�__init__Ysz_Stop.__init__N)rrrrrrrrrXsr)�PyStringMap�(�.�0�1�2�F�I�J�K�L�M�N�P�Q�R�S�T�U�V�X�a�b�c�d�}�e�g�h�i�j�l�]�o�p�q�r�s�t�)�u�GsI01
sI00
�������������������������B�C��������������������cCsg|]}tjd|�r|�qS)z[A-Z][A-Z0-9_]+$)�re�match)�.0�xrrr�
<listcomp>�srfc@s:eZdZdZdd�Zdd�Zdd�Zdd
d�Zdd
�ZdS)�_Framer�@icCs||_d|_dS)N)�
file_write�
current_frame)rrirrrr�sz_Framer.__init__cCstj�|_dS)N)�io�BytesIOrj)rrrr�
start_framing�sz_Framer.start_framingcCs*|jr&|jj�dkr&|jdd�d|_dS)NrT)�force)rj�tell�commit_frame)rrrr�end_framing�sz_Framer.end_framingFcCst|jrp|j}|j�|jks|rp|j��2}t|�}|j}|t�|td|��||�WdQRX|jd�|j	�dS)Nz<Qr)
rjro�_FRAME_SIZE_TARGET�	getbuffer�lenri�FRAMEr
�seek�truncate)rrn�f�data�n�writerrrrp�s

z_Framer.commit_framecCs |jr|jj|�S|j|�SdS)N)rjr{ri)rryrrrr{�sz
_Framer.writeNi)F)	rrrrrrrmrqrpr{rrrrrg�s

rgc@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)�	_UnframerNcCs||_||_d|_dS)N)�	file_read�
file_readlinerj)rr}r~Z	file_tellrrrr�sz_Unframer.__init__cCsV|jrH|jj|�}|r0|dkr0d|_|j|�St|�|krDtd��|S|j|�SdS)Nrz$pickle exhausted before end of frame)rj�readr}rtr)rrzryrrrr�s
z_Unframer.readcCsF|jr:|jj�}|s"d|_|j�S|ddkr6td��|S|j�SdS)N��
rz$pickle exhausted before end of frame����
)rj�readliner~r)rryrrrr��s
z_Unframer.readlinecCs2|jr|jj�dkrtd��tj|j|��|_dS)N�z4beginning of a new frame before end of current frame)rjrrrkrlr})r�
frame_sizerrr�
load_frame�sz_Unframer.load_frame)N)rrrrrr�r�rrrrr|�s


r|cCslxb|jd�D]T}|dkr(tdj||���y|}t||�}Wqtk
r^tdj||���YqXqW||fS)N�.z<locals>z&Can't get local attribute {!r} on {!r}z Can't get attribute {!r} on {!r})�split�AttributeError�format�getattr)�obj�nameZsubpath�parentrrr�
_getattributes
r�cCszt|dd�}|dk	r|Sx\ttjj��D]J\}}|dks(|dkrBq(yt||�d|krZ|SWq(tk
rpYq(Xq(WdS)Nr�__main__r)r��list�sys�modules�itemsr�r�)r�r��module_name�modulerrr�whichmodules
r�cCsh|dkrdS|j�d?d}|j|ddd�}|dkrd|dkrd|ddkrd|dd
@dkrd|dd
�}|S)Nrr�rr��littleT)�	byteorder�signed���r����r�)�
bit_length�to_bytes)re�nbytes�resultrrr�encode_long$sr�cCstj|ddd�S)Nr�T)r�r�)�int�
from_bytes)ryrrr�decode_longBsr�c@sheZdZd7dd�dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Zd8dd�Z	dd�Z
dd�Zd9dd�ZiZ
dd�Zee
ed�<dd�Zee
e<dd�Zee
e<dd�Zee
e<d d!�Zee
e<d"d#�Zee
e<d$d%�Zee
e<d&d'�Zee
e<d(Zd)d*�Zd+d,�Z e e
e!<e"dk	�re e
e"<d-d.�Z#d/d0�Z$e$e
e%<d1d2�Z&e&e
e'<d:d3d4�Z(d5d6�Z)e(e
e*<e)e
e<dS);�_PicklerNT)�fix_importscCs�|dkrt}|dkrt}n$d|ko,tkns>tdt��y|j|_Wntk
rftd��YnXt|j�|_|jj|_i|_	t
|�|_|dk|_d|_
|o�|dk|_dS)Nrzpickle protocol must be <= %dz"file must have a 'write' attributer�r)�DEFAULT_PROTOCOL�HIGHEST_PROTOCOL�
ValueErrorr{�_file_writer��	TypeErrorrg�framer�memor��proto�bin�fastr�)r�file�protocolr�rrrr[s"


z_Pickler.__init__cCs|jj�dS)N)r��clear)rrrr�
clear_memo�sz_Pickler.clear_memocCsrt|d�std|jjf��|jdkr<|jttd|j��|jdkrP|jj	�|j
|�|jt�|jj�dS)Nr�z2Pickler.__init__() was not called by %s.__init__()r�z<Br)
�hasattrr
�	__class__rr�r{�PROTOr
r�rm�save�STOPrq)rr�rrrr�s





z
_Pickler.dumpcCs:|jr
dSt|j�}|j|j|��||f|jt|�<dS)N)r�rtr�r{�put�id)rr��idxrrr�memoize�s

z_Pickler.memoizecCsT|jdkrtS|jr:|dkr*ttd|�Sttd|�Sntt|�jd�dSdS)Nr�z<Bz<I�asciir�)	r��MEMOIZEr��BINPUTr
�LONG_BINPUT�PUT�repr�encode)rr�rrrr��s
z_Pickler.putcCs@|jr*|dkrttd|�Sttd|�Stt|�jd�dS)Nr�z<Bz<Ir�r�)r��BINGETr
�LONG_BINGET�GETr�r�)r�irrr�get�s
z_Pickler.getcCs�|jj�|j|�}|dk	r.|r.|j|�dS|jjt|��}|dk	r^|j|j|d��dSt|�}|j	j|�}|dk	r�|||�dSt
|dt�j|�}|dk	r�||�}n�yt|t�}	Wnt
k
r�d}	YnX|	r�|j|�dSt
|dd�}|dk	�r||j�}n0t
|dd�}|dk	�r&|�}ntd|j|f��t|t��rT|j||�dSt|t��sltd|��t|�}
d|
k�o�d	kn�s�td
|��|j|d|i�dS)NrrF�
__reduce_ex__�
__reduce__zCan't pickle %r object: %rz%s must return string or tupler��z3Tuple returned by %s must have two to five elementsr�)r�rp�
persistent_id�	save_persr�r�r�r{�type�dispatchr�r�
issubclassr��save_globalr�r
r�
isinstance�str�tuplert�save_reduce)rr��save_persistent_id�pidre�trx�reduce�rvZissc�lrrrr��sT








z
_Pickler.savecCsdS)Nr)rr�rrrr�sz_Pickler.persistent_idcCsb|jr |j|dd�|jt�n>y |jtt|�jd�d�Wntk
r\td��YnXdS)NF)r�r�r�z2persistent IDs in protocol 0 must be ASCII strings)	r�r�r{�	BINPERSID�PERSIDr�r��UnicodeEncodeErrorr
)rr�rrrr�s z_Pickler.save_perscCst|t�std��t|�s"td��|j}|j}t|dd�}	|jdkr�|	dkr�|\}
}}t|
d�sntdj	|	���|dk	r�|
|j
k	r�td	j	|	���|jd
kr�||
�||�||�|t�n,t|
j
|
f|�|�}||�|f�|t�n�|jdko�|	dk�r\|d}
t|
d��std
��|dk	�r6|
|j
k	�r6td��|dd�}||
�||�|t�n||�||�|t�|dk	�r�t|�|jk�r�|t|j|jt|�d��n
|j|�|dk	�r�|j|�|dk	�r�|j|�|dk	�r�||�|t�dS)Nz'args from save_reduce() must be a tuplez(func from save_reduce() must be callabler�r��
__newobj_ex__�__new__z#args[0] from {} args has no __new__z(args[0] from {} args has the wrong classr�
__newobj__rz+args[0] from __newobj__ args has no __new__z0args[0] from __newobj__ args has the wrong classr�)r�r�r
�callabler�r{r�r�r�r�r��	NEWOBJ_EXrr��REDUCE�NEWOBJr�r��POPr�r��_batch_appends�_batch_setitems�BUILD)r�func�args�stateZ	listitemsZ	dictitemsr�r�r{Z	func_name�cls�kwargsrrrr�sd







"





z_Pickler.save_reducecCs|jt�dS)N)r{�NONE)rr�rrr�	save_none�sz_Pickler.save_nonecCs4|jdkr|j|rtnt�n|j|r*tnt�dS)Nr�)r�r{�NEWTRUE�NEWFALSE�TRUE�FALSE)rr�rrr�	save_bool�s
z_Pickler.save_boolcCs�|jr~|dkrN|dkr.|jttd|��dS|dkrN|jttd|��dSd
|ko`dknr~|jttd|��dS|jd	kr�t|�}t|�}|d
kr�|jt	td|�|�n|jt
td|�|�dS|jtt|�j
d�d�dS)Nrr�z<Bi��z<Hli���z<ir�r�r�sL
i�)r�r{�BININT1r
�BININT2�BININTr�r�rt�LONG1�LONG4�LONGr�r�)rr��encodedrzrrr�	save_long�s&
z_Pickler.save_longcCs<|jr|jttd|��n|jtt|�jd�d�dS)Nz>dr�r�)r�r{�BINFLOATr
�FLOATr�r�)rr�rrr�
save_float�sz_Pickler.save_floatcCs�|jdkr@|s |jtf|d�n|jtjt|d�df|d�dSt|�}|dkrj|jtt	d|�|�nD|dkr�|jdkr�|jt
t	d|�|�n|jtt	d	|�|�|j|�dS)
Nr)r��latin1r�z<Bl��rz<Qz<I)
r�r��bytes�codecsr�r�rtr{�SHORT_BINBYTESr
�	BINBYTES8�BINBYTESr�)rr�rzrrr�
save_bytes�s
z_Pickler.save_bytescCs�|jr�|jdd�}t|�}|dkrF|jdkrF|jttd|�|�q�|dkrr|jdkrr|jttd|�|�q�|jttd|�|�n0|j	d	d
�}|j	dd�}|jt
|jd
�d�|j|�dS)Nzutf-8�
surrogatepassr�rz<Bl��z<Qz<I�\z\u005c�
z\u000azraw-unicode-escaper�)r�r�rtr�r{�SHORT_BINUNICODEr
�BINUNICODE8�
BINUNICODE�replace�UNICODEr�)rr�rrzrrr�save_str�sz_Pickler.save_strcCsB|s(|jr|jt�n|jtt�dSt|�}|j}|j}|dkr�|jdkr�x|D]}||�qTWt	|�|kr�|j
|t	|�d�}|jt||�n|jt|�|j
|�dS|j}|t�x|D]}||�q�Wt	|�|k�r,|j
|t	|�d�}|j�r|t|�n|t|d|�dS|t�|j
|�dS)Nrr�rr�)r�r{�EMPTY_TUPLE�MARK�TUPLErtr�r�r�r�r�r��_tuplesize2coder��POP_MARK)rr�rzr�r��elementr�r{rrr�
save_tuple�s:


z_Pickler.save_tuplecCs8|jr|jt�n|jtt�|j|�|j|�dS)N)r�r{�
EMPTY_LISTr�LISTr�r�)rr�rrr�	save_lists

z_Pickler.save_listi�cCs�|j}|j}|js4x|D]}||�|t�qWdSt|�}xrtt||j��}t|�}|dkr�|t	�x|D]}||�qlW|t
�n|r�||d�|t�||jkr>dSq>WdS)Nr�r)r�r{r��APPEND�iterr�r�
_BATCHSIZErtr�APPENDS)rr�r�r{re�it�tmprzrrrr�s*



z_Pickler._batch_appendscCs<|jr|jt�n|jtt�|j|�|j|j��dS)N)r�r{�
EMPTY_DICTr�DICTr�r�r�)rr�rrr�	save_dict.s

z_Pickler.save_dictc	Cs�|j}|j}|js@x(|D] \}}||�||�|t�qWdSt|�}x�tt||j��}t|�}|dkr�|t	�x |D]\}}||�||�qxW|t
�n(|r�|d\}}||�||�|t�||jkrJdSqJWdS)Nr�r)r�r{r��SETITEMr"r�rr#rtr�SETITEMS)	rr�r�r{�k�vr%r&rzrrrr�;s2

z_Pickler._batch_setitemscCs�|j}|j}|jdkr0|jtt|�f|d�dS|t�|j|�t|�}xXtt	||j
��}t|�}|dkr�|t�x|D]}||�qzW|t
�||j
krLdSqLWdS)Nr)r�r)r�r{r�r��setr��	EMPTY_SETr�r"rr#rtr�ADDITEMS)rr�r�r{r%Zbatchrz�itemrrr�save_setZs$



z_Pickler.save_setcCs�|j}|j}|jdkr0|jtt|�f|d�dS|t�x|D]}||�q>Wt|�|jkr�|t	|j
|jt|�d��dS|t�|j|�dS)Nr)r�r)
r�r{r�r��	frozensetr�rr�r�rr��	FROZENSETr�)rr�r�r{r1rrr�save_frozensetrs

 z_Pickler.save_frozensetc
CsT|j}|j}|dkr t|dd�}|dkr.|j}t||�}y(t|dd�tj|}t||�\}}Wn,t	t
tfk
r�td|||f��YnX||k	r�td|||f��|j
dk�rtj||f�}	|	�r|	dkr�|ttd|	��n0|	d	k�r|ttd
|	��n|ttd|	��dS|jd�d}
||k�r4|
}|j
d
k�r^|j|�|j|�|t�n�||k	�rz|jt||
f�n�|j
dk�r�|tt|d�dt|d�d�n�|j�r�tj}tj}||f|k�r�|||f\}}n||k�r�||}y(|tt|d�dt|d�d�Wn*tk
�rDtd|||j
f��YnX|j|�dS)Nrr)�levelz(Can't pickle %r: it's not found as %s.%sz2Can't pickle %r: it's not the same object as %s.%sr�r�z<Bi��z<Hz<ir�rrzutf-8r�r�z?can't pickle global identifier '%s.%s' using pickle protocol %i) r{r�r�rr��
__import__r�r�r��ImportError�KeyErrorr�r
r�rr��EXT1r
�EXT2�EXT4�
rpartitionr��STACK_GLOBALr��GLOBALrr��_compat_pickleZREVERSE_NAME_MAPPINGZREVERSE_IMPORT_MAPPINGr�r�)
rr�r�r{r�r�r�Zobj2r��codeZlastnameZr_name_mappingZr_import_mappingrrrr��sn







$
&z_Pickler.save_globalcCs`|td�kr|jtd|d�S|tt�kr:|jttf|d�S|td�krV|jtd|d�S|j|�S)N)r�.)N).)r�r��NotImplementedr�)rr�rrr�	save_type�sz_Pickler.save_type)N)T)NNNN)N)+rrrrr�rr�r�r�r�r�r�r�r�r�r�r��boolrr�r�floatr
rrr�rr�r r�r#r�r)�dictr r�r2r.r5r3r�rCrrrrrr�YsV)
	
B
c1		

B	r�c@sneZdZdddd�dd�Zdd�Zd	d
�Zdd�ZiZd
d�Zeee	d<dd�Z
e
eed<dd�Zeee
d<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�Zeeed<d d!�Zeeed<d"d#�Zeeed<d$d%�Zeeed<d&d'�Z e ee!d<d(d)�Z"e"ee#d<d*d+�Z$e$ee%d<d,d-�Z&e&ee'd<d.d/�Z(d0d1�Z)e)ee*d<d2d3�Z+e+ee,d<d4d5�Z-e-ee.d<d6d7�Z/e/ee0d<d8d9�Z1e1ee2d<d:d;�Z3e3ee4d<d<d=�Z5e5ee6d<d>d?�Z7e7ee8d<d@dA�Z9e9ee:d<dBdC�Z;e;ee<d<dDdE�Z=e=ee>d<dFdG�Z?e?ee@d<dHdI�ZAeAeeBd<dJdK�ZCeCeeDd<dLdM�ZEeEeeFd<dNdO�ZGeGeeHd<dPdQ�ZIeIeeJd<dRdS�ZKeKeeLd<dTdU�ZMeMeeNd<dVdW�ZOeOeePd<dXdY�ZQeQeeRd<dZd[�ZSd\d]�ZTeTeeUd<d^d_�ZVeVeeWd<d`da�ZXeXeeYd<dbdc�ZZeZee[d<ddde�Z\e\ee]d<dfdg�Z^e^ee_d<dhdi�Z`e`eead<djdk�Zbebeecd<dldm�Zdedeeed<dndo�Zfdpdq�Zgdrds�Zheheeid<dtdu�Zjejeekd<dvdw�Zleleemd<dxdy�Zneneeod<dzd{�Zpepeeqd<d|d}�Zrereesd<d~d�Zteteeud<d�d��Zveveewd<d�d��Zxexeeyd<d�d��Zzezee{d<d�d��Z|e|ee}d<d�d��Z~e~eed<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�S)��
_UnpicklerT�ASCII�strict)r��encoding�errorscCs2|j|_|j|_i|_||_||_d|_||_dS)Nr)	r��_file_readliner�
_file_readr�rJrKr�r�)rr�r�rJrKrrrr�sz_Unpickler.__init__cCs�t|d�std|jjf��t|j|j�|_|jj|_|jj	|_	g|_
g|_|jj|_d|_
|j}|j}y*x$|d�}|s|t�||d|�qlWWn"tk
r�}z|jSd}~XnXdS)NrMz4Unpickler.__init__() was not called by %s.__init__()rr�)r�rr�rr|rMrL�	_unframerrr��	metastack�stack�appendr�r��EOFErrorrr)rrr��keyZstopinstrrrrs(



z_Unpickler.loadcCs |j}|jj�|_|jj|_|S)N)rPrO�poprQ)rr�rrr�pop_marks
z_Unpickler.pop_markcCstd��dS)Nz%unsupported persistent id encountered)r)rr�rrr�persistent_load%sz_Unpickler.persistent_loadcCs<|jd�d}d|ko tkns2td|��||_dS)Nr�rzunsupported pickle protocol: %d)rr�r�r�)rr�rrr�
load_proto*sz_Unpickler.load_protorcCs8td|jd��\}|tjkr(td|��|jj|�dS)Nz<Q�zframe size > sys.maxsize: %d)rrr�r	r�rNr�)rr�rrrr�1s
z_Unpickler.load_framecCsLy|j�dd�jd�}Wntk
r6td��YnX|j|j|��dS)Nr�r�z2persistent IDs in protocol 0 must be ASCII stringsr�)r��decode�UnicodeDecodeErrorrrQrV)rr�rrr�load_persid8sz_Unpickler.load_persidcCs|jj�}|j|j|��dS)N)rPrTrQrV)rr�rrr�load_binpersidAs
z_Unpickler.load_binpersidcCs|jd�dS)N)rQ)rrrr�	load_noneFsz_Unpickler.load_nonecCs|jd�dS)NF)rQ)rrrr�
load_falseJsz_Unpickler.load_falsecCs|jd�dS)NT)rQ)rrrr�	load_trueNsz_Unpickler.load_truecCsL|j�}|tdd�krd}n |tdd�kr4d}n
t|d�}|j|�dS)Nr�FTr)r�r�r�r�rQ)rry�valrrr�load_intRs
z_Unpickler.load_intcCs|jtd|jd��d�dS)Nz<irr)rQrr)rrrr�load_binint]sz_Unpickler.load_binintcCs|j|jd�d�dS)Nr�r)rQr)rrrr�load_binint1asz_Unpickler.load_binint1cCs|jtd|jd��d�dS)Nz<Hr�r)rQrr)rrrr�load_binint2esz_Unpickler.load_binint2cCs@|j�dd�}|r,|ddkr,|dd�}|jt|d��dS)Nr�r*rr�r��Lr�)r�rQr�)rr`rrr�	load_longisz_Unpickler.load_longcCs*|jd�d}|j|�}|jt|��dS)Nr�r)rrQr�)rrzryrrr�
load_long1ps
z_Unpickler.load_long1cCs>td|jd��\}|dkr"td��|j|�}|jt|��dS)Nz<irrz#LONG pickle has negative byte count)rrrrQr�)rrzryrrr�
load_long4vs

z_Unpickler.load_long4cCs|jt|j�dd���dS)Nr�r�)rQrEr�)rrrr�
load_floatsz_Unpickler.load_floatcCs|jtd|jd��d�dS)Nz>drXr)rQrr)rrrr�
load_binfloat�sz_Unpickler.load_binfloatcCs"|jdkr|S|j|j|j�SdS)Nr)rJrYrK)rrrrr�_decode_string�s
z_Unpickler._decode_stringcCsl|j�dd�}t|�dkrF|d|dkrF|ddkrF|dd�}ntd��|j|jtj|�d��dS)	Nr�r�rs"'z)the STRING opcode argument must be quotedr�r�r�)r�rtrrQrkr	�
escape_decode)rryrrr�load_string�s
(z_Unpickler.load_stringcCs@td|jd��\}|dkr"td��|j|�}|j|j|��dS)Nz<irrz(BINSTRING pickle has negative byte count)rrrrQrk)rrtryrrr�load_binstring�s

z_Unpickler.load_binstringcCs:td|jd��\}|tkr&tdt��|j|j|��dS)Nz<Irz2BINBYTES exceeds system's maximum size of %d bytes)rrr	rrQ)rrtrrr�
load_binbytes�s
z_Unpickler.load_binbytescCs |jt|j�dd�d��dS)Nr�zraw-unicode-escaper�)rQr�r�)rrrr�load_unicode�sz_Unpickler.load_unicodecCsBtd|jd��\}|tkr&tdt��|jt|j|�dd��dS)Nz<Irz4BINUNICODE exceeds system's maximum size of %d byteszutf-8r)rrr	rrQr�)rrtrrr�load_binunicode�s
z_Unpickler.load_binunicodecCsBtd|jd��\}|tkr&tdt��|jt|j|�dd��dS)Nz<QrXz5BINUNICODE8 exceeds system's maximum size of %d byteszutf-8r)rrr	rrQr�)rrtrrr�load_binunicode8�s
z_Unpickler.load_binunicode8cCs:td|jd��\}|tkr&tdt��|j|j|��dS)Nz<QrXz3BINBYTES8 exceeds system's maximum size of %d bytes)rrr	rrQ)rrtrrr�load_binbytes8�s
z_Unpickler.load_binbytes8cCs,|jd�d}|j|�}|j|j|��dS)Nr�r)rrQrk)rrtryrrr�load_short_binstring�s
z_Unpickler.load_short_binstringcCs"|jd�d}|j|j|��dS)Nr�r)rrQ)rrtrrr�load_short_binbytes�sz_Unpickler.load_short_binbytescCs*|jd�d}|jt|j|�dd��dS)Nr�rzutf-8r)rrQr�)rrtrrr�load_short_binunicode�sz _Unpickler.load_short_binunicodecCs|j�}|jt|��dS)N)rUrQr�)rr�rrr�
load_tuple�sz_Unpickler.load_tuplecCs|jf�dS)N)rQ)rrrr�load_empty_tuple�sz_Unpickler.load_empty_tuplecCs|jdf|jd<dS)Nr�r�r�)rP)rrrr�load_tuple1�sz_Unpickler.load_tuple1cCs$|jd|jdfg|jdd�<dS)Nr�r�r�r�r�)rP)rrrr�load_tuple2�sz_Unpickler.load_tuple2cCs,|jd|jd|jdfg|jdd�<dS)Nrr�r����r�r�r{)rP)rrrr�load_tuple3�sz_Unpickler.load_tuple3cCs|jg�dS)N)rQ)rrrr�load_empty_list�sz_Unpickler.load_empty_listcCs|ji�dS)N)rQ)rrrr�load_empty_dictionary�sz _Unpickler.load_empty_dictionarycCs|jt��dS)N)rQr.)rrrr�load_empty_set�sz_Unpickler.load_empty_setcCs|j�}|jt|��dS)N)rUrQr3)rr�rrr�load_frozenset�sz_Unpickler.load_frozensetcCs|j�}|j|�dS)N)rUrQ)rr�rrr�	load_list�sz_Unpickler.load_listcs4|j���fdd�tdt��d�D�}|j|�dS)Ncsi|]}�|d�|�qS)r�r)rdr�)r�rr�
<dictcomp>sz(_Unpickler.load_dict.<locals>.<dictcomp>rr�)rU�rangertrQ)r�dr)r�r�	load_dicts
z_Unpickler.load_dictcCs�|st|t�st|d�rly||�}Wqvtk
rh}z&td|jt|�ftj�d��WYdd}~XqvXn
|j|�}|j	|�dS)NZ__getinitargs__zin constructor for %s: %sr�)
r�r�r�r�rr�r��exc_infor�rQ)r�klassr�r�errrrr�_instantiates
0
z_Unpickler._instantiatecCsL|j�dd�jd�}|j�dd�jd�}|j||�}|j||j��dS)Nr�r�r�r�)r�rY�
find_classr�rU)rr�r�r�rrr�	load_instsz_Unpickler.load_instcCs"|j�}|jd�}|j||�dS)Nr)rUrTr�)rr�r�rrr�load_obj!s
z_Unpickler.load_objcCs2|jj�}|jj�}|j|f|��}|j|�dS)N)rPrTr�rQ)rr�r�r�rrr�load_newobj(s

z_Unpickler.load_newobjcCs>|jj�}|jj�}|jj�}|j|f|�|�}|j|�dS)N)rPrTr�rQ)rr�r�r�r�rrr�load_newobj_ex/s



z_Unpickler.load_newobj_excCsF|j�dd�jd�}|j�dd�jd�}|j||�}|j|�dS)Nr�zutf-8r�r�)r�rYr�rQ)rr�r�r�rrr�load_global7sz_Unpickler.load_globalcCsJ|jj�}|jj�}t|�tk	s,t|�tk	r4td��|j|j||��dS)NzSTACK_GLOBAL requires str)rPrTr�r�rrQr�)rr�r�rrr�load_stack_global>s


z_Unpickler.load_stack_globalcCs|jd�d}|j|�dS)Nr�r)r�
get_extension)rrArrr�	load_ext1Fsz_Unpickler.load_ext1cCs td|jd��\}|j|�dS)Nz<Hr�)rrr�)rrArrr�	load_ext2Ksz_Unpickler.load_ext2cCs td|jd��\}|j|�dS)Nz<ir)rrr�)rrArrr�	load_ext4Psz_Unpickler.load_ext4cCspg}tj||�}||k	r&|j|�dStj|�}|sP|dkrDtd��td|��|j|�}|t|<|j|�dS)NrzEXT specifies code <= 0zunregistered extension code %d)rr�rQrrr�r�)rrAZnilr�rSrrrr�Us


z_Unpickler.get_extensioncCs�|jdkrF|jrF||ftjkr2tj||f\}}n|tjkrFtj|}t|dd�|jdkrpttj||�dSt	tj||�SdS)Nrr)r6r)
r�r�r@ZNAME_MAPPINGZIMPORT_MAPPINGr7r�r�r�r�)rr�r�rrrr�es


z_Unpickler.find_classcCs&|j}|j�}|d}||�|d<dS)Nr�r�r�)rPrT)rrPr�r�rrr�load_reducersz_Unpickler.load_reducecCs|jr|jd=n|j�dS)Nr�r�)rPrU)rrrr�load_popys
z_Unpickler.load_popcCs|j�dS)N)rU)rrrr�
load_pop_mark�sz_Unpickler.load_pop_markcCs|j|jd�dS)Nr�r�)rQrP)rrrr�load_dup�sz_Unpickler.load_dupcCs(t|j�dd��}|j|j|�dS)Nr�r�)r�r�rQr�)rr�rrr�load_get�sz_Unpickler.load_getcCs"|jd�d}|j|j|�dS)Nr�r)rrQr�)rr�rrr�load_binget�sz_Unpickler.load_bingetcCs&td|jd��\}|j|j|�dS)Nz<Ir)rrrQr�)rr�rrr�load_long_binget�sz_Unpickler.load_long_bingetcCs8t|j�dd��}|dkr$td��|jd|j|<dS)Nr�rznegative PUT argumentr�r�)r�r�r�rPr�)rr�rrr�load_put�sz_Unpickler.load_putcCs2|jd�d}|dkrtd��|jd|j|<dS)Nr�rznegative BINPUT argumentr�)rr�rPr�)rr�rrr�load_binput�sz_Unpickler.load_binputcCs6td|jd��\}|tkr"td��|jd|j|<dS)Nz<Irznegative LONG_BINPUT argumentr�r�)rrr	r�rPr�)rr�rrr�load_long_binput�sz_Unpickler.load_long_binputcCs|j}|jd|t|�<dS)Nr�r�)r�rPrt)rr�rrr�load_memoize�sz_Unpickler.load_memoizecCs$|j}|j�}|d}|j|�dS)Nr�r�)rPrTrQ)rrPrr�rrr�load_append�sz_Unpickler.load_appendcCsH|j�}|jd}t|t�r(|j|�n|j}x|D]}||�q4WdS)Nr�r�)rUrPr�r��extendrQ)rr�Zlist_objrQr1rrr�load_appends�s


z_Unpickler.load_appendscCs*|j}|j�}|j�}|d}|||<dS)Nr�r�)rPrT)rrPrrSrFrrr�load_setitem�s
z_Unpickler.load_setitemcCsD|j�}|jd}x,tdt|�d�D]}||d|||<q$WdS)Nr�rr�r�)rUrPr�rt)rr�rFr�rrr�
load_setitems�s
z_Unpickler.load_setitemscCsH|j�}|jd}t|t�r(|j|�n|j}x|D]}||�q4WdS)Nr�r�)rUrPr�r.�update�add)rr�Zset_objr�r1rrr�
load_additems�s


z_Unpickler.load_additemsc
Cs�|j}|j�}|d}t|dd�}|dk	r6||�dSd}t|t�rXt|�dkrX|\}}|r�|j}tj}x6|j	�D]*\}}	t
|�tkr�|	|||�<qr|	||<qrW|r�x |j	�D]\}}	t|||	�q�WdS)Nr��__setstate__r�r�)
rPrTr�r�r�rt�__dict__r��internr�r�r��setattr)
rrPr�Zinst�setstateZ	slotstateZ	inst_dictr�r,r-rrr�
load_build�s(z_Unpickler.load_buildcCs"|jj|j�g|_|jj|_dS)N)rOrQrP)rrrr�	load_mark�sz_Unpickler.load_markcCs|jj�}t|��dS)N)rPrTr)rrrrr�	load_stop�s
z_Unpickler.load_stopN)�rrrrrrUrVr�rWr�r�rur[r�r\r�r]r�r^r�r_r�ra�INTrbr�rcr�rdr�rfrrgr�rhrrirrjrrkrm�STRINGrn�	BINSTRINGrorrprrqrrrrrsrrt�SHORT_BINSTRINGrur
rvrrwrrxrry�TUPLE1rz�TUPLE2r|�TUPLE3r}rr~r'rr/r�r4r�rr�r(r�r��INSTr��OBJr�r�r�r�r�r?r�r>r�r:r�r;r�r<r�r�r�r�r�r�r�rr��DUPr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r!r�r$r�r*r�r+r�r0r�r�r�rr�r�rrrrrG�s$		
		rGT)r�cCst|||d�j|�dS)N)r�)r�r)r�r�r�r�rrr�_dumpsr�cCs(tj�}t|||d�j|�|j�}|S)N)r�)rkrlr�r�getvalue)r�r�r�rx�resrrr�_dumpssr�rHrI)r�rJrKcCst||||d�j�S)N)r�rJrK)rGr)r�r�rJrKrrr�_load
sr�cCs0t|t�rtd��tj|�}t||||d�j�S)Nz%Can't load pickle from unicode string)r�rJrK)r�r�r�rkrlrGr)�sr�rJrKr�rrr�_loadss


r�)	rr
rrrrrrrcCsddl}|j�S)Nr)�doctestZtestmod)r�rrr�_test*sr�r�z$display contents of the pickle files)Zdescription�pickle_file�br�*zthe pickle file)r��nargs�helpz-tz--test�
store_truezrun self-test suite)�actionr�z-vz)run verbosely; only affects self-test run)N)N)��typesr�copyregrrrr�	itertoolsr�	functoolsrr�r	Zstructr
rrbrkr	r@�__all__r�	bytearrayZbytes_typesZformat_versionZcompatible_formatsr�r��	Exceptionrr
rrZorg.python.corer r8rr�r�rr�rr�r�r�rr�r�r�r�r�r�r�r�rrr!r�r?r(r'r$r�r�r�r�rrr�r�r�r�r*rrr+rr�r�r�r�r:r;r<r�r�r�r�r�r�rrrr
rrrr/r0r4r�r>r�rur��dirrgr|r�r�r�r�r�rGr�r�r�r��_picklerrrrrrr�r�argparse�ArgumentParser�parser�add_argumentZFileType�
parse_argsr�Ztestr�Z
print_help�pprintrxr�rrrr�<module>s,

$*
-0




asyncore.cpython-36.pyc000064400000036740150335715140011033 0ustar003


 \�N�@shdZddlZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZeee
eeeeh�ZyeWnek
r�iZYnXdd�ZGdd�de�ZeeefZdd	�Zd
d�Z dd
�Z!dd�Z"d&dd�Z#d'dd�Z$e$Z%d(dd�Z&Gdd�d�Z'Gdd�de'�Z(dd�Z)d)dd �Z*ej+d!k�rdGd"d#�d#�Z,Gd$d%�d%e'�Z-dS)*a�Basic infrastructure for asynchronous socket service clients and servers.

There are only two ways to have a program on a single processor do "more
than one thing at a time".  Multi-threaded programming is the simplest and
most popular way to do it, but there is another very different technique,
that lets you have nearly all the advantages of multi-threading, without
actually using multiple threads. it's really only practical if your program
is largely I/O bound. If your program is CPU bound, then pre-emptive
scheduled threads are probably what you really need. Network servers are
rarely CPU-bound, however.

If your operating system supports the select() system call in its I/O
library (and nearly all do), then you can use it to juggle multiple
communication channels at once; doing other work while your I/O is taking
place in the "background."  Although this strategy can seem strange and
complex, especially at first, it is in many ways easier to understand and
control than multi-threaded programming. The module documented here solves
many of the difficult problems for you, making the task of building
sophisticated high-performance network servers and clients a snap.
�N)
�EALREADY�EINPROGRESS�EWOULDBLOCK�
ECONNRESET�EINVAL�ENOTCONN�	ESHUTDOWN�EISCONN�EBADF�ECONNABORTED�EPIPE�EAGAIN�	errorcodec
Cs>y
tj|�Stttfk
r8|tkr0t|Sd|SXdS)NzUnknown error %s)�os�strerror�
ValueError�
OverflowError�	NameErrorr)�err�r� /usr/lib64/python3.6/asyncore.py�	_strerrorDs
rc@seZdZdS)�ExitNowN)�__name__�
__module__�__qualname__rrrrrLsrcCs:y|j�Wn(tk
r"�Yn|j�YnXdS)N)�handle_read_event�_reraised_exceptions�handle_error)�objrrr�readQsr cCs:y|j�Wn(tk
r"�Yn|j�YnXdS)N)�handle_write_eventrr)rrrr�writeYsr"cCs:y|j�Wn(tk
r"�Yn|j�YnXdS)N)�handle_expt_eventrr)rrrr�
_exceptionasr$cCs�yX|tj@r|j�|tj@r&|j�|tj@r8|j�|tjtjBtj	B@rV|j
�Wnhtk
r�}z&|jdt
kr�|j�n|j
�WYdd}~Xn(tk
r��Yn|j�YnXdS)Nr)�select�POLLINr�POLLOUTr!�POLLPRIr#ZPOLLHUPZPOLLERRZPOLLNVAL�handle_close�OSError�args�
_DISCONNECTEDrr)r�flags�errr�	readwriteis"



r/�c	CsN|dkrt}|�rJg}g}g}x^t|j��D]N\}}|j�}|j�}|rR|j|�|rh|jrh|j|�|sp|r,|j|�q,Wg|ko�|ko�|knr�tj|�dSt	j	||||�\}}}x(|D] }|j
|�}|dkr�q�t|�q�Wx*|D]"}|j
|�}|dk�rq�t|�q�Wx.|D]&}|j
|�}|dk�r<�q t
|��q WdS)N)�
socket_map�list�items�readable�writable�append�	accepting�timeZsleepr%�getr r"r$)	�timeout�map�r�wr.�fdrZis_rZis_wrrr�poll}sD

"








r?cCs�|dkrt}|dk	r t|d�}tj�}|r�x^t|j��D]N\}}d}|j�r^|tjtjBO}|j	�rx|j
rx|tjO}|r:|j||�q:W|j|�}x.|D]&\}}|j
|�}|dkr�q�t||�q�WdS)Ni�r)r1�intr%r?r2r3r4r&r(r5r7r'�registerr9r/)r:r;Zpollsterr>rr-r<rrr�poll2�s(


rB�>@FcCsj|dkrt}|r ttd�r t}nt}|dkrBx8|r>|||�q.Wn$x"|rd|dkrd|||�|d}qDWdS)Nr?r�)r1�hasattrr%rBr?)r:Zuse_pollr;�countZpoll_funrrr�loop�s
rGc@s6eZdZdZdZdZdZdZdZe	dh�Z
dAdd�Zdd�ZeZ
dBdd	�ZdCd
d�Zejejfdd
�ZdDdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdEd'd(�Z d)d*�Z!d+d,�Z"d-d.�Z#d/d0�Z$d1d2�Z%d3d4�Z&d5d6�Z'd7d8�Z(d9d:�Z)d;d<�Z*d=d>�Z+d?d@�Z,dS)F�
dispatcherFN�warningcCs�|dkrt|_n||_d|_|r�|jd�|j||�d|_y|j�|_Wq�tk
r�}z,|j	dt
tfkrvd|_n|j|��WYdd}~Xq�Xnd|_
dS)NrTF)r1�_map�_fileno�setblocking�
set_socket�	connectedZgetpeername�addrr*r+rr�del_channel�socket)�self�sockr;rrrr�__init__�s 

zdispatcher.__init__cCs�|jjd|jjg}|jr.|jr.|jd�n|jr>|jd�|jdk	r�y|jd|j�Wn$tk
r�|jt|j��YnXddj	|�t
|�fS)N�.Z	listeningrNz%s:%dz<%s at %#x>� )�	__class__rrr7rOr6rN�	TypeError�repr�join�id)rRZstatusrrr�__repr__�s

zdispatcher.__repr__cCs|dkr|j}|||j<dS)N)rJrK)rRr;rrr�add_channelszdispatcher.add_channelcCs,|j}|dkr|j}||kr"||=d|_dS)N)rKrJ)rRr;r>rrrrPszdispatcher.del_channelcCs.||f|_tj||�}|jd�|j|�dS)Nr)Zfamily_and_typerQrLrM)rRZfamily�typerSrrr�
create_sockets

zdispatcher.create_socketcCs||_|j�|_|j|�dS)N)rQ�filenorKr])rRrSr;rrrrM s
zdispatcher.set_socketcCsDy*|jjtjtj|jjtjtj�dB�Wntk
r>YnXdS)NrD)rQZ
setsockopt�
SOL_SOCKETZSO_REUSEADDR�
getsockoptr*)rRrrr�set_reuse_addr&s
zdispatcher.set_reuse_addrcCsdS)NTr)rRrrrr47szdispatcher.readablecCsdS)NTr)rRrrrr5:szdispatcher.writablecCs(d|_tjdkr|dkrd}|jj|�S)NT�nt�)r7r�namerQ�listen)rRZnumrrrrgAszdispatcher.listencCs||_|jj|�S)N)rOrQ�bind)rRrOrrrrhGszdispatcher.bindcCspd|_d|_|jj|�}|tttfks8|tkrBtj	dkrB||_
dS|dtfkr^||_
|j�nt
|t|��dS)NFTrdr)rN�
connectingrQZ
connect_exrrrrrrfrOr	�handle_connect_eventr*r)rRZaddressrrrr�connectKs
zdispatcher.connectcCsny|jj�\}}WnNtk
r&dStk
r`}z |jdtttfkrNdS�WYdd}~Xn
X||fSdS)Nr)rQ�acceptrXr*r+rrr
)rRZconnrO�whyrrrrlYszdispatcher.acceptcCsfy|jj|�}|Stk
r`}z4|jdtkr4dS|jdtkrN|j�dS�WYdd}~XnXdS)Nr)rQ�sendr*r+rr,r))rR�data�resultrmrrrrngszdispatcher.sendcCshy$|jj|�}|s|j�dS|SWn>tk
rb}z"|jdtkrP|j�dS�WYdd}~XnXdS)N�r)rQ�recvr)r*r+r,)rR�buffer_sizerormrrrrrtszdispatcher.recvcCsnd|_d|_d|_|j�|jdk	rjy|jj�Wn6tk
rh}z|jdtt	fkrX�WYdd}~XnXdS)NFr)
rNr7rirPrQ�closer*r+rr
)rRrmrrrrt�s
zdispatcher.closecCstjjdt|��dS)Nzlog: %s
)�sys�stderrr"�str)rR�messagerrr�log�szdispatcher.log�infocCs||jkrtd||f�dS)Nz%s: %s)�ignore_log_types�print)rRrxr^rrr�log_info�s
zdispatcher.log_infocCs:|jr|j�n&|js.|jr$|j�|j�n|j�dS)N)r7�
handle_acceptrNrirj�handle_read)rRrrrr�s

zdispatcher.handle_read_eventcCs@|jjtjtj�}|dkr(t|t|���|j�d|_d|_dS)NrTF)	rQrbra�SO_ERRORr*r�handle_connectrNri)rRrrrrrj�szdispatcher.handle_connect_eventcCs*|jr
dS|js|jr|j�|j�dS)N)r7rNrirj�handle_write)rRrrrr!�szdispatcher.handle_write_eventcCs0|jjtjtj�}|dkr$|j�n|j�dS)Nr)rQrbrar�r)�handle_expt)rRrrrrr#�s
zdispatcher.handle_expt_eventcCsXt�\}}}}yt|�}Wndt|�}YnX|jd||||fd�|j�dS)Nz)<__repr__(self) failed for object at %0x>z:uncaptured python exception, closing channel %s (%s:%s %s)�error)�compact_tracebackrYr[r}r))rRZnil�t�v�tbinfoZ	self_reprrrrr�szdispatcher.handle_errorcCs|jdd�dS)Nz!unhandled incoming priority eventrI)r})rRrrrr��szdispatcher.handle_exptcCs|jdd�dS)Nzunhandled read eventrI)r})rRrrrr�szdispatcher.handle_readcCs|jdd�dS)Nzunhandled write eventrI)r})rRrrrr��szdispatcher.handle_writecCs|jdd�dS)Nzunhandled connect eventrI)r})rRrrrr��szdispatcher.handle_connectcCs|j�}|dk	r|j|�dS)N)rl�handle_accepted)rRZpairrrrr~�szdispatcher.handle_acceptcCs|j�|jdd�dS)Nzunhandled accepted eventrI)rtr})rRrSrOrrrr��szdispatcher.handle_acceptedcCs|jdd�|j�dS)Nzunhandled close eventrI)r}rt)rRrrrr)�szdispatcher.handle_close)NN)N)N)N)rz)-rrr�debugrNr7ri�closingrO�	frozensetr{rTr\�__str__r]rPrQZAF_INETZSOCK_STREAMr_rMrcr4r5rgrhrkrlrnrrrtryr}rrjr!r#rr�rr�r�r~r�r)rrrrrH�sL

 


	


rHc@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�dispatcher_with_sendNcCstj|||�d|_dS)Nrq)rHrT�
out_buffer)rRrSr;rrrrT�szdispatcher_with_send.__init__cCs.d}tj||jdd��}|j|d�|_dS)Nri)rHrnr�)rRZnum_sentrrr�
initiate_sendsz"dispatcher_with_send.initiate_sendcCs|j�dS)N)r�)rRrrrr�sz!dispatcher_with_send.handle_writecCs|jpt|j�S)N)rN�lenr�)rRrrrr5szdispatcher_with_send.writablecCs0|jr|jdt|��|j||_|j�dS)Nz
sending %s)r�r}rYr�r�)rRrorrrrnszdispatcher_with_send.send)NN)rrrrTr�r�r5rnrrrrr��s

r�cCs�tj�\}}}g}|std��x0|rN|j|jjj|jjjt|j	�f�|j
}q W~|d\}}}djdd�|D��}|||f|||fS)Nztraceback does not existrDrVcSsg|]}d|�qS)z
[%s|%s|%s]r)�.0�xrrr�
<listcomp>)sz%compact_traceback.<locals>.<listcomp>���)ru�exc_info�AssertionErrorr6�tb_frame�f_code�co_filename�co_namerw�	tb_lineno�tb_nextrZ)r�r��tbr��fileZfunction�linerzrrrr�s
r�cCs�|dkrt}x~t|j��D]n}y|j�Wqtk
rb}z|jdtkrLn|sR�WYdd}~Xqtk
rv�Yq|s��YqXqW|j�dS)Nr)	r1r2�valuesrtr*r+r
r�clear)r;Z
ignore_allr�rrr�	close_all,s r��posixc@sNeZdZdd�Zdd�Zdd�Zdd�Zdd
d�ZeZeZ	dd
�Z
dd�Zd	S)�file_wrappercCstj|�|_dS)N)r�dupr>)rRr>rrrrTQszfile_wrapper.__init__cCs*|jdkrtjd|t|d�|j�dS)Nrzunclosed file %r)�source)r>�warnings�warn�ResourceWarningrt)rRrrr�__del__Ts
zfile_wrapper.__del__cGstj|jf|��S)N)rr r>)rRr+rrrrrZszfile_wrapper.recvcGstj|jf|��S)N)rr"r>)rRr+rrrrn]szfile_wrapper.sendNcCs*|tjkr|tjkr|rdStd��dS)Nrz-Only asyncore specific behaviour implemented.)rQrar��NotImplementedError)rR�levelZoptnameZbuflenrrrrb`s


zfile_wrapper.getsockoptcCs(|jdkrdS|j}d|_tj|�dS)NrrDr�)r>rrt)rRr>rrrrtks

zfile_wrapper.closecCs|jS)N)r>)rRrrrr`rszfile_wrapper.fileno)N)rrrrTr�rrrnrbr r"rtr`rrrrr�Ls
r�c@seZdZddd�Zdd�ZdS)�file_dispatcherNcCsPtj|d|�d|_y|j�}Wntk
r4YnX|j|�tj|d�dS)NTF)rHrTrNr`�AttributeError�set_filer�set_blocking)rRr>r;rrrrTws
zfile_dispatcher.__init__cCs"t|�|_|jj�|_|j�dS)N)r�rQr`rKr])rRr>rrrr��s
zfile_dispatcher.set_file)N)rrrrTr�rrrrr�us
r�)r0N)r0N)rCFNN)NF).�__doc__r%rQrur8r�r�errnorrrrrrrr	r
rrr
rr�r,r1rr�	Exceptionr�KeyboardInterrupt�
SystemExitrr r"r$r/r?rBZpoll3rGrHr�r�r�rfr�r�rrrr�<module>/sB<


'

-
)csv.cpython-36.pyc000064400000027121150335715140007774 0ustar003


 \4?�@sLdZddlZddlmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZddlmZddlmZddlmZddd	d
ddd
ddddddddddddddgZGdd�d�ZGdd�de�Zede�Gdd�de�Zede�Gd d�de�Zed!e�Gd"d�d�ZGd#d�d�ZyeWnek
�r8eZYnXGd$d�d�ZdS)%z+
csv.py - read/write/investigate CSV files
�N)�Error�__version__�writer�reader�register_dialect�unregister_dialect�get_dialect�
list_dialects�field_size_limit�
QUOTE_MINIMAL�	QUOTE_ALL�QUOTE_NONNUMERIC�
QUOTE_NONE�__doc__)�Dialect)�OrderedDict)�StringIOrrr
rrrr�excel�	excel_tabr
rrrrr	�Snifferrr�
DictReader�
DictWriter�unix_dialectc@sDeZdZdZdZdZdZdZdZdZ	dZ
dZdZdd�Z
dd�ZdS)	rz�Describe a CSV dialect.

    This must be subclassed (see csv.excel).  Valid attributes are:
    delimiter, quotechar, escapechar, doublequote, skipinitialspace,
    lineterminator, quoting.

    �FNcCs|jtkrd|_|j�dS)NT)�	__class__r�_valid�	_validate)�self�r�/usr/lib64/python3.6/csv.py�__init__+s
zDialect.__init__cCs@yt|�Wn.tk
r:}ztt|���WYdd}~XnXdS)N)�_Dialect�	TypeErrorr�str)r�errrr0szDialect._validate)�__name__�
__module__�__qualname__r�_namer�	delimiter�	quotecharZ
escapechar�doublequote�skipinitialspace�lineterminator�quotingr rrrrrrsc@s(eZdZdZdZdZdZdZdZe	Z
dS)rz;Describe the usual properties of Excel-generated CSV files.�,�"TFz
N)r%r&r'rr)r*r+r,r-rr.rrrrr7sc@seZdZdZdZdS)rzEDescribe the usual properties of Excel-generated TAB-delimited files.�	N)r%r&r'rr)rrrrrAsz	excel-tabc@s(eZdZdZdZdZdZdZdZe	Z
dS)rz:Describe the usual properties of Unix-generated CSV files.r/r0TF�
N)r%r&r'rr)r*r+r,r-rr.rrrrrFsZunixc@s@eZdZddd�Zdd�Zedd��Zejd	d��Zd
d�ZdS)
rNrcOs6||_||_||_t||f|�|�|_||_d|_dS)Nr)�_fieldnames�restkey�restvalr�dialect�line_num)r�f�
fieldnamesr4r5r6�args�kwdsrrrr RszDictReader.__init__cCs|S)Nr)rrrr�__iter__[szDictReader.__iter__cCs@|jdkr0yt|j�|_Wntk
r.YnX|jj|_|jS)N)r3�nextr�
StopIterationr7)rrrrr9^s

zDictReader.fieldnamescCs
||_dS)N)r3)r�valuerrrr9hscCs�|jdkr|jt|j�}|jj|_x|gkr:t|j�}q&Wtt|j|��}t|j�}t|�}||krz||d�||j<n*||kr�x |j|d�D]}|j||<q�W|S)Nr)	r7r9r=rr�zip�lenr4r5)r�row�dZlfZlr�keyrrr�__next__ls




zDictReader.__next__)NNNr)	r%r&r'r r<�propertyr9�setterrErrrrrQs

c@s6eZdZddd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)rr�raisercOsB||_||_|j�dkr$td|��||_t||f|�|�|_dS)NrH�ignorez-extrasaction (%s) must be 'raise' or 'ignore')rHrI)r9r5�lower�
ValueError�extrasactionr)rr8r9r5rLr6r:r;rrrr �szDictWriter.__init__cCs tt|j|j��}|j|�dS)N)�dictr@r9�writerow)r�headerrrr�writeheader�szDictWriter.writeheadercsN�jdkr8�j��j}|r8tddjdd�|D������fdd��jD�S)NrHz(dict contains fields not in fieldnames: z, cSsg|]}t|��qSr)�repr)�.0�xrrr�
<listcomp>�sz,DictWriter._dict_to_list.<locals>.<listcomp>c3s|]}�j|�j�VqdS)N)�getr5)rRrD)�rowdictrrr�	<genexpr>�sz+DictWriter._dict_to_list.<locals>.<genexpr>)rL�keysr9rK�join)rrVZwrong_fieldsr)rVrr�
_dict_to_list�s
zDictWriter._dict_to_listcCs|jj|j|��S)N)rrNrZ)rrVrrrrN�szDictWriter.writerowcCs|jjt|j|��S)N)r�	writerows�maprZ)rZrowdictsrrrr[�szDictWriter.writerowsN)rrHr)r%r&r'r rPrZrNr[rrrrr�s
	c@s:eZdZdZdd�Zd
dd�Zdd�Zd	d
�Zdd�ZdS)rze
    "Sniffs" the format of a CSV file (i.e. delimiter, quotechar)
    Returns a Dialect object.
    cCsdddddg|_dS)Nr/r1�;� �:)�	preferred)rrrrr �szSniffer.__init__NcCsd|j||�\}}}}|s(|j||�\}}|s4td��Gdd�dt�}||_||_|pVd|_||_|S)zI
        Returns a dialect (or None) corresponding to the sample
        zCould not determine delimiterc@seZdZdZdZeZdS)zSniffer.sniff.<locals>.dialectZsniffedz
N)r%r&r'r(r-rr.rrrrr6�sr6r0)�_guess_quote_and_delimiter�_guess_delimiterrrr+r)r*r,)r�sample�
delimitersr*r+r)r,r6rrr�sniff�s

z
Sniffer.sniffcCs�g}x0dD](}tj|tjtjB�}|j|�}|r
Pq
W|s>dSi}i}d}|j}	x�|D]�}
|	d	d
}|
|}|r�|j|d�d
||<y|	dd
}|
|}Wntk
r�wVYnX|r�|dks�||kr�|j|d�d
||<y|	dd
}Wntk
�rwVYnX|
|rV|d
7}qVWt||jd
�}
|�rZt||jd
�}|||k}|dk�rbd}nd}d}tjdtj	|�|
d�tj�}|j
|��r�d}nd}|
|||fS)a�
        Looks for text enclosed between two identical quotes
        (the probable quotechar) which are preceded and followed
        by the same character (the probable delimiter).
        For example:
                         ,'some text',
        The quote with the most wins, same with the delimiter.
        If there is no quotechar the delimiter can't be determined
        this way.
        �I(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)�G(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)�G(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\n)�-(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?:$|\n)rFNr�quote��delimZspace)rDr2z]((%(delim)s)|^)\W*%(quote)s[^%(delim)s\n]*%(quote)s[^%(delim)s\n]*%(quote)s\W*((%(delim)s)|$))rlrjT)rfrgrhri)rFNr)�re�compile�DOTALL�	MULTILINE�findall�
groupindexrU�KeyError�max�escape�search)r�datardZmatchesZrestrZregexpZquotes�delimsZspacesrr�m�nrDr*rlr,Z	dq_regexpr+rrrra�s`


z"Sniffer._guess_quote_and_delimitercCsttd|jd���}dd�td�D�}tdt|��}d}i}i}i}dt|t|��}	}
�x|	t|�k�rn|d7}xT||	|
�D]D}x>|D]6}|j|i�}
|j|�}|
j|d�d|
|<|
||<q�Wq�Wx�|j�D]�}t||j	��}t|�dk�r|dddk�rq�t|�dk�rht
|d	d
�d�||<|j||�||d||dtdd
�|D��f||<q�|d||<q�W|j	�}t
||�}d}d}x�t|�dk�r||k�rx\|D]T\}}|ddk�r�|ddk�r�|d||k�r�|dk�s�||k�r�|||<�q�W|d8}�q�Wt|�dk�r`t|j��d}|dj|�|djd|�k}||fS|
}	|
|7}
q\W|�szdSt|�dk�r�xF|jD]<}||j�k�r�|dj|�|djd|�k}||fS�q�Wdd�|j	�D�}|j�|dd}|dj|�|djd|�k}||fS)a�
        The delimiter /should/ occur the same number of times on
        each row. However, due to malformed data, it may not. We don't want
        an all or nothing approach, so we allow for small variations in this
        number.
          1) build a table of the frequency of each character on every line.
          2) build a table of frequencies of this frequency (meta-frequency?),
             e.g.  'x occurred 5 times in 10 rows, 6 times in 1000 rows,
             7 times in 2 rows'
          3) use the mode of the meta-frequency to determine the /expected/
             frequency for that character
          4) find out how often the character actually meets that goal
          5) the character that best meets its goal is the delimiter
        For performance reasons, the data is evaluated in chunks, so it can
        try and evaluate the smallest portion of the data possible, evaluating
        additional chunks as necessary.
        Nr2cSsg|]}t|��qSr)�chr)rR�crrrrT.sz,Sniffer._guess_delimiter.<locals>.<listcomp>��
rrkcSs|dS)Nrkr)rSrrr�<lambda>Hsz*Sniffer._guess_delimiter.<locals>.<lambda>)rDcss|]}|dVqdS)rkNr)rR�itemrrrrWMsz+Sniffer._guess_delimiter.<locals>.<genexpr>g�?g�������?g{�G�z�?z%c rcSsg|]\}}||f�qSrr)rR�k�vrrrrTws)rr���)�list�filter�split�range�minrArU�countrX�itemsrt�remove�sum�floatr`�sort)rrwrd�asciiZchunkLengthZ	iterationZ
charFrequencyZmodesrx�start�end�line�charZ
metaFrequencyZfreqr�ZmodeListZtotalZconsistencyZ	thresholdr�r�rlr,rCrrrrbst

 zSniffer._guess_delimiterc
Cs�tt|�|j|��}t|�}t|�}i}xt|�D]}d||<q2Wd}x�|D]�}|dkrZP|d7}t|�|krpqLx�t|j��D]x}	xJtt	t
gD]0}
y|
||	�PWq�ttfk
r�Yq�Xq�Wt||	�}
|
||	kr~||	dkr�|
||	<q~||	=q~WqLWd}x�|j
�D]~\}	}t|�td�k�rLt||	�|k�rB|d7}n|d8}n<y|||	�Wn"ttfk
�r~|d7}Yn
X|d8}�qW|dkS)Nr�rk)rrrer=rAr�r�rX�intr��complexrK�
OverflowErrorr��typer")
rrcZrdrrO�columnsZcolumnTypes�iZcheckedrB�colZthisTypeZ	hasHeaderZcolTyperrr�
has_header�sJ





zSniffer.has_header)N)	r%r&r'rr rerarbr�rrrrr�s
Lg) rrmZ_csvrrrrrrrr	r
rrr
rrr!�collectionsr�ior�__all__rrrrrr��	NameErrorr�rrrrr�<module>s2@



2
macurl2path.cpython-36.opt-2.pyc000064400000002721150335715140012362 0ustar003


 \�
�@s4ddlZddlZddgZdd�Zdd�Zdd�ZdS)�N�url2pathname�pathname2urlcCsttjj|�d}|r$|dkr$td��|dd�dkrB|dd�}n|dd�dkrZtd��|jd�}d}x�|t|�k�r||d	kr�||=qj||d
kr�|dkr�||ddkr�||d|d�=|d}qj||dkr�|dkr�||ddkr�||=qj|d}qjW|d�s"d
j|dd��}nFd}x2|t|�k�rX||d
k�rXd||<|d}�q(Wd
d
j|�}tjj|�S)Nr�filez(Cannot convert non-local URL to pathname�z///�z//�/�.�..���:)rr	)�urllib�parseZ	splittype�RuntimeError�split�len�joinZunquote)�pathname�tp�
components�i�rv�r�#/usr/lib64/python3.6/macurl2path.pyr
s6

$
cCs�d|krtd��|jd�}|ddkr,|d=|ddkr>|d	=x(tt|��D]}||dkrLd||<qLWtt|�}tjj|�r�ddj	|�Sdj	|�SdS)
Nrz*Cannot convert pathname containing slashesrrrr
z..���r)
rr�ranger�map�_pncomp2url�os�path�isabsr)rrrrrrr4s

cCstjj|dd�dd�S)N�r)Zsafe)r
rZquote)Z	componentrrrrKsr)Zurllib.parser
r�__all__rrrrrrr�<module>s
*_osx_support.cpython-36.opt-1.pyc000064400000022754150335715140012713 0ustar003


 \�J�
@s�dZddlZddlZddlZddddgZd1Zd2ZdZd3dd�Zdd�Z	dd�Z
dadd�Zdd�Z
dd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d�Zd.d�Zd/d�Zd0d�ZdS)4zShared OS X support functions.�N�compiler_fixup�customize_config_vars�customize_compiler�get_platform_osx�CFLAGS�LDFLAGS�CPPFLAGS�
BASECFLAGS�	BLDSHARED�LDSHARED�CC�CXX�	PY_CFLAGS�
PY_LDFLAGS�PY_CPPFLAGS�PY_CORE_CFLAGS�PY_CORE_LDFLAGSZ_OSX_SUPPORT_INITIAL_cCs�|dkrtjd}|jtj�}tjj|�\}}tjdkrH|dkrH|d}tjj|�s�x*|D]"}tjj	||�}tjj|�rZ|SqZWdS|SdS)z�Tries to find 'executable' in the directories listed in 'path'.

    A string listing directories separated by 'os.pathsep'; defaults to
    os.environ['PATH'].  Returns the complete filename or None if not found.
    N�PATHZwin32z.exe)
�os�environ�split�pathsep�path�splitext�sys�platform�isfile�join)�
executabler�paths�baseZext�p�f�r#�$/usr/lib64/python3.6/_osx_support.py�_find_executables

r%cCs�ddl}yddl}|j�}Wn(tk
rDtdtj�fd�}YnX|j|��0}d||jf}tj	|�s||j
�jd�j�SdSQRXdS)z0Output from successful command execution or NonerNz/tmp/_osx_support.%szw+bz%s 2>/dev/null >'%s'zutf-8)
�
contextlib�tempfileZNamedTemporaryFile�ImportError�openr�getpid�closing�name�system�read�decode�strip)Z
commandstringr&r'�fp�cmdr#r#r$�_read_output7sr3cCst|�ptd|f�pdS)z0Find a build tool on current path or using xcrunz/usr/bin/xcrun -find %s�)r%r3)Ztoolnamer#r#r$�_find_build_toolJsr5cCsxtdkrtdaytd�}Wntk
r,YnHXztjd|j��}Wd|j�X|dk	rtdj|jd�j	d�dd��atS)z*Return the OS X system version as a stringNr4z0/System/Library/CoreServices/SystemVersion.plistz=<key>ProductUserVisibleVersion</key>\s*<string>(.*?)</string>�.��)
�_SYSTEM_VERSIONr)�OSError�re�searchr.�closer�groupr)r"�mr#r#r$�_get_system_versionSs

r@cCs&x t|�D]}|jt�r
||=q
WdS)z-Remove original unmodified values for testingN)�list�
startswith�_INITPRE)�_config_vars�kr#r#r$�_remove_original_valuesqs
rFcCs8|j|d�}||kr,t||kr,||t|<|||<dS)z@Save modified and original unmodified value of configuration varr4N)�getrC)rD�cvZnewvalueZoldvaluer#r#r$�_save_modified_valuexsrIcCsTt�}|r@ytdd�|jd�D��}Wntk
r>d}YnX|rPt|dk�SdS)	z=Returns True if universal builds are supported on this systemcss|]}t|�VqdS)N)�int)�.0�ir#r#r$�	<genexpr>�sz-_supports_universal_builds.<locals>.<genexpr>r6r4�
�F)rNrO)r@�tupler�
ValueError�bool)Zosx_versionr#r#r$�_supports_universal_builds�s
rScCs�dtjkr|S|dj�d}}t|�s4td�}n<tjj|�jd�rptd|j	dd�f�}|rpd|krptd�}|s|t
d	��||kr�xTtD]L}||kr�|tjkr�||j�}|d
kr�|n|d|d<t||dj
|��q�W|S)
z7Find appropriate C compiler for extension module buildsrrZclang�gccz'%s' --version�'z'"'"'zllvm-gcczCannot locate working compilerr
z++� )rrrr%r5r�basenamerBr3�replace�SystemError�_COMPILER_CONFIG_VARSrIr)rDZccZoldcc�datarHZcv_splitr#r#r$�_find_appropriate_compiler�s(


r\cCsZxTtD]L}||kr|tjkr||}tjdd|tjd�}tjdd|�}t|||�qW|S)z5Remove all universal build arguments from config varsz
-arch\s+\w+\srV)�flagsz-isysroot [^ 	]*)�_UNIVERSAL_CONFIG_VARSrrr;�sub�ASCIIrI)rDrHr]r#r#r$�_remove_universal_flags�s
racCs�dtjkr|Stjd|d�dk	r�tjd|djdd�f�}|r�x@tD]8}||krH|tjkrH||}tjdd	|�}t|||�qHW|S)
z-Remove any unsupported archs from config varsrz-arch\s+ppcrNzNecho 'int main{};' | '%s' -c -arch ppc -x c -o /dev/null /dev/null 2>/dev/nullrUz'"'"'z-arch\s+ppc\w*\srV)	rrr;r<r-rXr^r_rI)rDZstatusrHr]r#r#r$�_remove_unsupported_archs�s
	
rbcCshdtjkrdtjd}xNtD]F}||krd||kr||}tjdd|�}|d|}t|||�qW|S)z2Allow override of all archs with ARCHFLAGS env var�	ARCHFLAGSz-archz
-arch\s+\w+\srV)rrr^r;r_rI)rDZarchrHr]r#r#r$�_override_all_archss


rdcCs||jdd�}tjd|�}|dk	rx|jd�}tjj|�sxx@tD]8}||kr<|tjkr<||}tj	dd|�}t
|||�q<W|S)z+Remove references to any SDKs not availablerr4z-isysroot\s+(\S+)Nr7z-isysroot\s+\S+(?:\s|$)rV)rGr;r<r>rr�existsr^rr_rI)rD�cflagsr?ZsdkrHr]r#r#r$�_check_for_unavailable_sdks

rgcCsXd}}t|�}t�s d}}nd|k}d|k}|s>dtjkrxx8y|jd�}|||d�=Wq@tk
rrPYq@Xq@Wdtjkr�|r�|tjdj�}|r�x8y|jd�}|||d�=Wq�tk
r�PYq�Xq�Wd}d|kr�|jd�}||d}n d|k�r|jd�}||d}|�rTtjj|��rTd	d
l	m
}|jd|�|jd�|S)
ae
    This function will strip '-isysroot PATH' and '-arch ARCH' from the
    compile flags if the user has specified one them in extra_compile_flags.

    This is needed because '-arch ARCH' adds another architecture to the
    build, without a way to remove an architecture. Furthermore GCC will
    barf if multiple '-isysroot' arguments are present.
    FTz-archz	-isysrootrcr8Nr7r)�logz4Compiling with an SDK that doesn't seem to exist: %sz$Please check your Xcode installation)rArSrr�indexrQrr�isdirZ	distutilsrh�warn)Zcompiler_soZcc_argsZ	stripArchZstripSysrootriZsysroot�idxrhr#r#r$r0sF	






cCs"t�st|�t|�t|�|S)a�Customize Python build configuration variables.

    Called internally from sysconfig with a mutable mapping
    containing name/value pairs parsed from the configured
    makefile used to build this interpreter.  Returns
    the mapping updated as needed to reflect the environment
    in which the interpreter is running; in the case of
    a Python from a binary installer, the installed
    environment may be very different from the build
    environment, i.e. different OS levels, different
    built tools, different available CPU architectures.

    This customization is performed whenever
    distutils.sysconfig.get_config_vars() is first
    called.  It may be used in environments where no
    compilers are present, i.e. when installing pure
    Python dists.  Customization of compiler paths
    and detection of unavailable archs is deferred
    until the first extension module build is
    requested (in distutils.sysconfig.customize_compiler).

    Currently called from distutils.sysconfig
    )rSrardrg)rDr#r#r$rps
cCst|�t|�t|�|S)z�Customize compiler path and configuration variables.

    This customization is performed when the first
    extension module build is requested
    in distutils.sysconfig.customize_compiler).
    )r\rbrd)rDr#r#r$r�s	c
Cs||jdd�}t�p|}|p|}|�rr|}d}|jtd|jdd��}|r�y$tdd�|jd�dd	�D��}Wq�tk
r�d}Yq�Xnd}|dko�d|j�k�r6d
}tjd|�}tt	t
|���}t|�dkr�|d}n\|dkr�d
}nN|d k�r�d}n>|d!k�rd}n.|d"k�rd}n|d#k�r&d}ntd|f��n<|dk�rRtj
d$k�rrd}n |d%k�rrtj
d&k�rnd}nd}|||fS)'z Filter values for get_platform()�MACOSX_DEPLOYMENT_TARGETr4Zmacosxrcss|]}t|�VqdS)N)rJ)rKrLr#r#r$rM�sz#get_platform_osx.<locals>.<genexpr>r6rr8rNrOz-archZfatz
-arch\s+(\S+)r7�i386�ppc�x86_64ZintelZfat3�ppc64Zfat64Z	universalz%Don't know machine value for archs=%r� �PowerPC�Power_Macintosh)rNr)rNr)rNrO)rnro)rnrp)rnrorp)rqrp)rnrorqrpl)rsrtl)rGr@rCrPrrQr0r;�findall�sorted�set�lenr�maxsize)rD�osname�release�machineZmacverZ
macreleaserfZarchsr#r#r$r�sP


$






)
rrrr	r
rrr
rrrrr)r
rrr
)N)�__doc__rr;r�__all__r^rZrCr%r3r5r9r@rFrIrSr\rarbrdrgrrrrr#r#r#r$�<module>s<
>(@)_threading_local.cpython-36.opt-2.pyc000064400000006050150335715140013415 0ustar003


 \.�@sZddlmZddlmZdgZGdd�d�Zedd��ZGdd�d�Zdd	lm	Z	m
Z
d
S)�)�ref)�contextmanager�localc@s(eZdZd
Zdd�Zdd	�Zd
d�ZdS)�
_localimpl�key�dicts�	localargs�	locallock�__weakref__cCsdtt|��|_i|_dS)Nz_threading_local._localimpl.)�str�idrr)�self�r�(/usr/lib64/python3.6/_threading_local.py�__init__�sz_localimpl.__init__cCst�}|jt|�dS)N�)�current_threadrr)r
�threadrrr�get_dict�sz_localimpl.get_dictcshi}|j}t�}t|�}|f�fdd�	}|f�fdd�	}t||��t||���|j|<�|f|j|<|S)Ncs��}|dk	r|j|=dS)N)�__dict__)�_rr)�wrthreadrr�
local_deleted�sz-_localimpl.create_dict.<locals>.local_deletedcs��}|dk	r|jj|�}dS)N)r�pop)r�idtr�dct)�wrlocalrr�thread_deleted�sz._localimpl.create_dict.<locals>.thread_deleted)rrrrrr)r
Z	localdictrrrrrr)rrr�create_dict�s


z_localimpl.create_dictN)rrrr	r
)�__name__�
__module__�__qualname__�	__slots__rrrrrrrr�srccsvtj|d�}y|j�}Wn2tk
rJ|j�}|j\}}|j||�YnX|j�tj|d|�dVWdQRXdS)N�_local__implr)	�object�__getattribute__r�KeyErrorrrrr	�__setattr__)r
�implr�args�kwrrr�_patch�s
r+c@s0eZdZdZdd�Zdd�Zdd�Zd	d
�ZdS)
rr#rcOsX|s|r|jtjkrtd��tj|�}t�}||f|_t�|_tj|d|�|j	�|S)Nz*Initialization arguments are not supportedr#)
rr$�	TypeError�__new__rr�RLockr	r'r)�clsr)r*r
r(rrrr-�s

z
local.__new__c
Cs t|��tj||�SQRXdS)N)r+r$r%)r
�namerrrr%�s
zlocal.__getattribute__cCs:|dkrtd|jj��t|��tj|||�SQRXdS)Nrz+%r object attribute '__dict__' is read-only)�AttributeError�	__class__rr+r$r')r
r0�valuerrrr'�s
zlocal.__setattr__c
Cs8|dkrtd|jj��t|��tj||�SQRXdS)Nrz+%r object attribute '__dict__' is read-only)r1r2rr+r$�__delattr__)r
r0rrrr4�s
zlocal.__delattr__N)r#r)rr r!r"r-r%r'r4rrrrr�s
)rr.N)�weakrefr�
contextlibr�__all__rr+rZ	threadingrr.rrrr�<module>�s,&bz2.cpython-36.opt-2.pyc000064400000014123150335715140010634 0ustar003


 \�0�
@s�ddddddgZdZddlmZdd	lZdd	lZdd	lZdd	lZydd
l	m
Z
Wn ek
rpdd
lm
Z
YnXddl
mZmZdZdZd
ZGdd�dej�Zddd�Zddd�Zdd�Zd	S)�BZ2File�
BZ2Compressor�BZ2Decompressor�open�compress�
decompressz%Nadeem Vawda <nadeem.vawda@gmail.com>�)rN)�RLock)rr��c@s�eZdZd(dd�Zdd�Zedd	��Zd
d�Zdd
�Zdd�Z	dd�Z
d)dd�Zd+dd�Zd-dd�Z
dd�Zd/dd�Zd1dd�Zd d!�Zd"d#�Zejfd$d%�Zd&d'�ZdS)2r�rN�	cCsTt�|_d|_d|_t|_|dk	r.tjdt�d|ko@dknsNt	d��|dkr`d}t
}nb|dkr|d
}t}t|�|_
nF|dkr�d}t}t|�|_
n*|dkr�d}t}t|�|_
nt	d|f��t|tttjf��r�t||�|_d|_||_n.t|d��st|d��r||_||_ntd��|jt
k�rJtj|jttd�}tj|�|_nd|_dS)NFz)Use of 'buffering' argument is deprecatedr	rz%compresslevel must be between 1 and 9�r�rb�w�wb�x�xb�a�abzInvalid mode: %rT�read�writez6filename must be a str, bytes, file or PathLike object)Ztrailing_errorr)r
rr)rr)rr)rr)r�_lock�_fp�_closefp�_MODE_CLOSED�_mode�warnings�warn�DeprecationWarning�
ValueError�
_MODE_READ�_MODE_WRITEr�_compressor�
isinstance�str�bytes�os�PathLike�
_builtin_open�hasattr�	TypeError�_compressionZDecompressReaderr�OSError�io�BufferedReader�_buffer�_pos)�self�filename�mode�	buffering�
compresslevelZ	mode_code�raw�r7�/usr/lib64/python3.6/bz2.py�__init__+sL
zBZ2File.__init__cCs�|j��|jtkrdSz<|jtkr.|jj�n"|jtkrP|jj|j	j
��d|_	Wdz|jrf|jj�Wdd|_d|_t|_d|_XXWdQRXdS)NF)rrrr r/�closer!rrr"�flushr)r1r7r7r8r:ps 



z
BZ2File.closecCs
|jtkS)N)rr)r1r7r7r8�closed�szBZ2File.closedcCs|j�|jj�S)N)�_check_not_closedr�fileno)r1r7r7r8r>�szBZ2File.filenocCs|j�o|jj�S)N)�readabler/�seekable)r1r7r7r8r@�szBZ2File.seekablecCs|j�|jtkS)N)r=rr )r1r7r7r8r?�szBZ2File.readablecCs|j�|jtkS)N)r=rr!)r1r7r7r8�writable�szBZ2File.writablerc	Cs&|j�|j�|jj|�SQRXdS)N)r�_check_can_readr/�peek)r1�nr7r7r8rC�szBZ2File.peekr	c	Cs&|j�|j�|jj|�SQRXdS)N)rrBr/r)r1�sizer7r7r8r�szBZ2File.readc	Cs4|j�$|j�|dkrtj}|jj|�SQRXdS)Nr)rrBr-�DEFAULT_BUFFER_SIZEr/�read1)r1rEr7r7r8rG�s
z
BZ2File.read1c	Cs&|j�|j�|jj|�SQRXdS)N)rrBr/�readinto)r1�br7r7r8rH�szBZ2File.readintoc	CsJt|t�s$t|d�std��|j�}|j�|j�|jj|�SQRXdS)N�	__index__zInteger argument expected)	r#�intr)r*rJrrBr/�readline)r1rEr7r7r8rL�s

zBZ2File.readlinec	CsJt|t�s$t|d�std��|j�}|j�|j�|jj|�SQRXdS)NrJzInteger argument expected)	r#rKr)r*rJrrBr/�	readlines)r1rEr7r7r8rM�s

zBZ2File.readlinescCsL|j�<|j�|jj|�}|jj|�|jt|�7_t|�SQRXdS)N)rZ_check_can_writer"rrrr0�len)r1�dataZ
compressedr7r7r8r�sz
BZ2File.writec
Cs |j�tjj||�SQRXdS)N)rr+�
BaseStream�
writelines)r1�seqr7r7r8rQ�szBZ2File.writelinesc
Cs(|j�|j�|jj||�SQRXdS)N)rZ_check_can_seekr/�seek)r1�offset�whencer7r7r8rSszBZ2File.seekc	Cs4|j�$|j�|jtkr$|jj�S|jSQRXdS)N)rr=rr r/�tellr0)r1r7r7r8rVs


zBZ2File.tell)rNr)r���)rWrW)rWrW)rWrW)rW)�__name__�
__module__�__qualname__r9r:�propertyr<r>r@r?rArCrrGrHrLrMrrQr-�SEEK_SETrSrVr7r7r7r8r s"
E




	

rrcCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|jdd�}t|||d�}d|kr�tj||||�S|SdS)	N�trIzInvalid mode: %rz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary moder
)r5)r�replacerr-�
TextIOWrapper)r2r3r5�encoding�errors�newlineZbz_modeZbinary_filer7r7r8r!scCst|�}|j|�|j�S)N)rrr;)rOr5�compr7r7r8rJscCsjg}xZ|r^t�}y|j|�}Wntk
r<|r6Pn�YnX|j|�|jsVtd��|j}qWdj|�S)NzACompressed data ended before the end-of-stream marker was reached�)rrr,�append�eofrZunused_data�join)rOZresultsZdecomp�resr7r7r8rUs

)rrNNN)r)�__all__�
__author__�builtinsrr(r-r&rr+Z	threadingr�ImportErrorZdummy_threadingZ_bz2rrrr r!rPrrrr7r7r7r8�<module>s,

(
sysconfig.cpython-36.opt-1.pyc000064400000037035150335715140012151 0ustar003

�]dh,a�
@sdZddlZddlZddlmZmZdddddd	d
ddd
dgZddddddddd�ddddddddd�ddddddddd�d d d!d!d"d#d$d%�d&d&d'd(d)d*d$d%�d+d+d,d,d-d*d$d%�d.�ZdoZej	j
�dZd6ejdd7�Z
d8ejdd7�Zejjej�Zejjej�Zejjej�Zejjej�ZdadZd9d:�Zej�rPejjeej��Zneej��Zej d;k�r�ej!�j"dp��r�eejj#eee��Zd>ej$k�r�eej$d>�Zd?d@�Z%e&edAd�Z'e'�r�ej d;k�r�e'j!�j"dq��r�ejjejje'��Z'drdCdD�Z(e(dE�Z)e)�r0x&dsD]Z*dHee*d3<dIee*dJ<�qWdKdL�Z+dMdN�Z,dOdP�Z-dQdR�Z.dSdT�Z/dtdUdV�Z0dWd�Z1dXdY�Z2dZd[�Z3d\d]�Z4d^d_�Z5dud`d�Z6dad�Z7dbd
�Z8dcd	�Z9e.�ddEfddd
�Z:e.�ddEfded�Z;dfd�Z<dgd�Z=dhd�Z>did�Z?djdk�Z@dldm�ZAeBdnk�reA�dS)vz-Access to Python's configuration information.�N)�pardir�realpath�get_config_h_filename�get_config_var�get_config_vars�get_makefile_filename�get_path�get_path_names�	get_paths�get_platform�get_python_version�get_scheme_names�parse_config_hz/{installed_base}/lib64/python{py_version_short}z){platbase}/lib64/python{py_version_short}z1{base}/lib/python{py_version_short}/site-packagesz7{platbase}/lib64/python{py_version_short}/site-packagesz;{installed_base}/include/python{py_version_short}{abiflags}z?{installed_platbase}/include/python{py_version_short}{abiflags}z
{base}/binz{base})�stdlib�
platstdlib�purelib�platlib�include�platinclude�scripts�dataz{installed_base}/lib/pythonz{base}/lib/pythonz{installed_base}/include/pythonz{installed_base}/Libz
{base}/Libz{base}/Lib/site-packagesz{installed_base}/Includez{base}/Scriptsz#{userbase}/Python{py_version_nodot}z1{userbase}/Python{py_version_nodot}/site-packagesz+{userbase}/Python{py_version_nodot}/Includez+{userbase}/Python{py_version_nodot}/Scriptsz
{userbase})rrrrrrrz){userbase}/lib64/python{py_version_short}z5{userbase}/lib/python{py_version_short}/site-packagesz7{userbase}/lib64/python{py_version_short}/site-packagesz+{userbase}/include/python{py_version_short}z{userbase}/binz{userbase}/lib/pythonz#{userbase}/lib/python/site-packagesz{userbase}/include)�posix_prefix�
posix_home�nt�nt_user�
posix_user�osx_framework_userrrrrrrrz%d.%d�z%d%dcCs"yt|�Stk
r|SXdS)N)r�OSError)�path�r �!/usr/lib64/python3.6/sysconfig.py�_safe_realpathcsr"r�\pcbuild\win32�\pcbuild\amd64Z_PYTHON_PROJECT_BASEcCs.x(dD] }tjjtjj|d|��rdSqWdS)N�
Setup.dist�Setup.local�ModulesTF)r%r&)�osr�isfile�join)�d�fnr r r!�_is_python_source_dirxs
r-�_homeFcCs|rtrtt�Stt�S)N)�	_sys_homer-�
_PROJECT_BASE)�
check_homer r r!�is_python_build�sr2Trrz{srcdir}/Includez{projectbase}/.rcCsdy|jf|�Stk
r^y|jftj�Stk
rX}ztd|��WYdd}~XnXYnXdS)Nz{%s})�format�KeyErrorr(�environ�AttributeError)�s�
local_vars�varr r r!�_subst_vars�sr:cCs4|j�}x&|j�D]\}}||kr$q|||<qWdS)N)�keys�items)�target_dict�
other_dict�target_keys�key�valuer r r!�_extend_dict�s
rBcCsfi}|dkri}t|t��xDt|j�D]4\}}tjdkrHtjj|�}tjjt	||��||<q*W|S)N�posixr)rCr)
rBr�_INSTALL_SCHEMESr<r(�namer�
expanduser�normpathr:)�scheme�vars�resr@rAr r r!�_expand_vars�s
rKcCstjdkrdStjS)NrCr)r(rEr r r r!�_get_default_scheme�s
rLcCs�tjjdd�}dd�}tjdkrBtjjd�p.d}|r8|S||d�Stjdkr|td	�}|r||r`|S|dd
|dtjdd��S|r�|S|dd
�SdS)N�PYTHONUSERBASEcWstjjtjj|��S)N)r(rrFr*)�argsr r r!�joinuser�sz_getuserbase.<locals>.joinuserr�APPDATA�~�Python�darwin�PYTHONFRAMEWORK�Libraryz%d.%drz.local)r(r5�getrE�sys�platformr�version_info)�env_baserO�base�	frameworkr r r!�_getuserbase�s"



r]cCsZddl}|jd�}|jd�}|jd�}|dkr2i}i}i}t|dd��}|j�}	WdQRXx�|	D]�}
|
jd�s`|
j�d	kr|q`|j|
�}|r`|jd
d�\}}
|
j�}
|
jdd	�}d
|kr�|
||<q`yt	|
�}
Wn$t
k
r�|
jdd
�||<Yq`X|
||<q`Wt|j��}d}�x
t
|�dk�r�x�t|�D�]�}||}|j|�}|j|�}|�rv|�rv|j�|j�k�rp|n|}n|�r�|n|}|dk	�r�|jd
�}d}||k�r�t||�}n�||k�r�d}nx|tjk�r�tj|}n`||k�r0|jd��r
|dd�|k�r
d	}n$d||k�rd}nt|d|�}nd	||<}|�r||j�d�}|d|j��||}d
|k�r~|||<n~yt	|�}Wn"t
k
�r�|j�||<Yn
X|||<|j|�|jd��r|dd�|k�r|dd�}||k�r|||<n|||<|j|��q,W�qWx.|j�D]"\}}
t|
t��r&|
j�||<�q&W|j|�|S)z�Parse a Makefile-style file.

    A dictionary containing name/value pairs is returned.  If an
    optional dictionary is passed in as the second argument, it is
    used instead of a new dictionary.
    rNz"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)z\$\(([A-Za-z][A-Za-z0-9_]*)\)z\${([A-Za-z][A-Za-z0-9_]*)}�surrogateescape)�errors�#��rz$$�$�CFLAGS�LDFLAGS�CPPFLAGSTF�PY_�)rdrerf)�re�compile�open�	readlines�
startswith�strip�match�group�replace�int�
ValueError�listr;�len�tuple�search�start�strr(r5�end�remover<�
isinstance�update)�filenamerIri�_variable_rx�_findvar1_rx�_findvar2_rx�done�notdone�f�lines�line�m�n�v�tmpv�	variables�renamed_variablesrErA�m1�m2�found�item�after�kr r r!�_parse_makefile�s�	


















r�cCsdtrtjjtptd�Sttd�r0dttj	f}nd}ttj
d�rP|dtj
j7}tjjtd�|d�S)z Return the path of the Makefile.�Makefile�abiflagszconfig-%s%s�config�
_multiarchz-%sr)
�
_PYTHON_BUILDr(rr*r/r0�hasattrrW�_PY_VERSION_SHORTr��implementationr�r)�config_dir_namer r r!rLs
c	Cs(tjjddjtjtjttjdd�d��S)N�_PYTHON_SYSCONFIGDATA_NAMEz+_sysconfigdata_{abi}_{platform}_{multiarch}r�ra)�abirX�	multiarch)	r(r5rVr3rWr�rX�getattrr�r r r r!�_get_sysconfigdata_nameYs
r�c,Cs�ddl}i}t�}yt||�WnJtk
rj}z.d|}t|d�rR|d|j}t|��WYdd}~XnXt�}y"t|��}t||�WdQRXWnJtk
r�}z.d|}t|d�r�|d|j}t|��WYdd}~XnXt	r�|d|d<t
�}dtjk�r$ddl
}|j|�}	||	_|	tj|<d	t�tf}
ttd
��rF|
d7}
tj|
dd
�tjj|
|d�}t|ddd��(}|jd�|jd�|j||d�WdQRXtdddd��}|j|
�WdQRXdS)z;Generate the Python module containing build-time variables.rNz.invalid Python installation: unable to open %s�strerrorz (%s)�LDSHARED�	BLDSHAREDrSzbuild/lib.%s-%s�gettotalrefcountz-pydebugT)�exist_okz.py�w�utf8)�encodingzB# system configuration generated and used by the sysconfig module
zbuild_time_vars = )�streamzpybuilddir.txt�ascii)�pprintrr�rr�r�rrkrr�r�rWrX�types�
ModuleType�build_time_vars�modulesrr�r(�makedirsrr*�write)r�rI�makefile�e�msg�config_hr�rEr��module�
pybuilddir�destfiler r r!�_generate_posix_varsbsL







r�cCs0t�}t|t�t�dgd�}|j}|j|�dS)z7Initialize the module as appropriate for POSIX systems.r�rN)r��
__import__�globals�localsr�r})rIrE�_tempr�r r r!�_init_posix�sr�cCsVtd�|d<td�|d<td�|d<d|d<d	|d
<t|d<tjjttj��|d<d
S)z+Initialize the module as appropriate for NTr�LIBDESTr�
BINLIBDESTr�	INCLUDEPYz.pyd�
EXT_SUFFIXz.exe�EXE�VERSION�BINDIRN)r�_PY_VERSION_SHORT_NO_DOTr(r�dirnamer"rW�
executable)rIr r r!�_init_non_posix�sr�c	Cs�|dkri}ddl}|jd�}|jd�}xx|j�}|s8P|j|�}|r�|jdd�\}}yt|�}Wntk
rvYnX|||<q*|j|�}|r*d||jd�<q*W|S)z�Parse a config.h-style file.

    A dictionary containing name/value pairs is returned.  If an
    optional dictionary is passed in as the second argument, it is
    used instead of a new dictionary.
    Nrz"#define ([A-Z][A-Za-z0-9_]+) (.*)
z&/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/
rbr)rirj�readlinerorprrrs)	�fprIri�	define_rx�undef_rxr�r�r�r�r r r!r�s*




cCsBtr,tjdkr"tjjtptd�}q4tp(t}ntd�}tjj|d�S)zReturn the path of pyconfig.h.r�PCrz
pyconfig-64.h)r�r(rErr*r/r0r)�inc_dirr r r!r�s

cCsttt��S)z,Return a tuple containing the schemes names.)rv�sortedrDr r r r!r
�scCstS)z*Return a tuple containing the paths names.)�_SCHEME_KEYSr r r r!r	�scCs|rt||�St|SdS)z�Return a mapping containing an install scheme.

    ``scheme`` is the install scheme name. If not provided, it will
    return the default scheme for the current platform.
    N)rKrD)rHrI�expandr r r!r
�s
cCst|||�|S)z[Return a path corresponding to the scheme.

    ``scheme`` is the install scheme name.
    )r
)rErHrIr�r r r!r�scGs|tdk�rFiattd<ttd<ttd<ttd<ttd<ttd<ttd<ttd	<ttd
<ttd<yt	j
td<Wntk
r�d
td<YnXtj
dkr�tt�tj
dkr�tt�tjd�}|dk	r�|td<t�td<tjdt�}tj
dk�rt�rtjjt��}tjj||�}ntjjt��}t|�td<t	jdk�rFddl}|jt�|�rtg}x|D]}|jtj|���qVW|StSdS)anWith no arguments, return a dictionary of all configuration
    variables relevant for the current platform.

    On Unix, this means every variable defined in Python's installed Makefile;
    On Windows it's a much smaller set.

    With arguments, return a list of values that result from looking up
    each argument in the configuration variable dictionary.
    N�prefix�exec_prefix�
py_version�py_version_short�py_version_nodot�installed_baser[�installed_platbase�platbase�projectbaser�rarrCr��SO�userbase�srcdirrSr)�_CONFIG_VARS�_PREFIX�_EXEC_PREFIX�_PY_VERSIONr�r��_BASE_PREFIX�_BASE_EXEC_PREFIXr0rWr�r6r(rEr�r�rVr]r�rr�rr*r"rX�_osx_support�customize_config_vars�append)rNr�r�r[r��valsrEr r r!rsP






cCs*|dkrddl}|jdtd�t�j|�S)z�Return the value of a single variable using the dictionary returned by
    'get_config_vars()'.

    Equivalent to get_config_vars().get(name)
    r�rNz SO is deprecated, use EXT_SUFFIXr)�warnings�warn�DeprecationWarningrrV)rEr�r r r!rPscCstjdkrnd}tjj|�}|d)kr(tjStjjd|�}tj|t|�|�j�}|dkr\dS|dkrhdStjStjd	ks�ttd
�r�tjSdtj	kr�tj	dStj
�\}}}}}|j�jdd
�}|jdd�}|jdd�}|dd�dkr�d||fS|dd�dk�rV|ddk�rd}dt|d�d|dd�f}ddd�}	|d|	tj
7}n�|dd �d!k�rtd||fS|dd�d"k�r�d#|||fS|dd$�d%k�r�d%}ddl}
|
jd&�}|j|�}|�r|j�}n2|dd$�d'k�rddl}
|
jt�|||�\}}}d(|||fS)*a�Return a string that identifies the current platform.

    This is used mainly to distinguish platform-specific build directories and
    platform-specific built distributions.  Typically includes the OS name
    and version and the architecture (as supplied by 'os.uname()'),
    although the exact information included depends on the OS; eg. for IRIX
    the architecture isn't particularly important (IRIX only runs on SGI
    hardware), but for Linux the kernel version isn't particularly
    important.

    Examples of returned values:
       linux-i586
       linux-alpha (?)
       solaris-2.6-sun4u
       irix-5.3
       irix64-6.2

    Windows will return one of:
       win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)
       win-ia64 (64bit Windows on Itanium)
       win32 (all others - specifically, sys.platform is returned)

    For other non-POSIX platforms, currently just returns 'sys.platform'.
    rz bit (rb�)�amd64z	win-amd64�itaniumzwin-ia64rC�uname�_PYTHON_HOST_PLATFORM�/ra� �_�-N��linuxz%s-%s�sunosr�5�solarisz%d.%srhr�32bit�64bit)i���l����z.%s��irix�aixz%s-%s.%s��cygwinz[\d.]+rSz%s-%s-%s���)r(rErW�version�findrXru�lowerr�r5r�rqrr�maxsizerirjrorpr��get_platform_osxr)r��i�j�look�osname�host�releaser�machine�bitnessri�rel_rer�r�r r r!r\sZ


 



cCstS)N)r�r r r r!r�scCsJxDtt|j���D]0\}\}}|dkr2td|�td||f�qWdS)Nrz%s: z
	%s = "%s")�	enumerater�r<�print)�titler�indexr@rAr r r!�_print_dict�srcCsfdtjkrt�dStdt��tdt��tdt��t�tdt��t�tdt	��dS)z*Display all information sysconfig detains.z--generate-posix-varsNzPlatform: "%s"zPython version: "%s"z!Current installation scheme: "%s"�Paths�	Variables)
rW�argvr�rrrrLrr
rr r r r!�_main�s
r�__main__)rrrrrrr)r#r$)r#r$)F)rr)N)N)C�__doc__r(rWZos.pathrr�__all__rDr�r�splitr�rYr�r�rrGr�r��base_prefixr�r�r��base_exec_prefixr�r��
_USER_BASEr"r�r�r0�getcwdrEr�endswithr*r5r-r�r/r2r�rHr:rBrKrLr]r�rr�r�r�r�rrr
r	r
rrrrrrr�__name__r r r r!�<module>s�

	

|
	?
 M[
timeit.cpython-36.pyc000064400000026525150335715140010503 0ustar003


 \4�@s�dZddlZddlZddlZddlZddddgZdZdZd	Zej	Z
eZd
Z
dd�ZGd
d�d�Zdde
edfdd�Zdde
eedfdd�Zddd�dd�Zedkr�eje��dS)amTool for measuring execution time of small code snippets.

This module avoids a number of common traps for measuring execution
times.  See also Tim Peters' introduction to the Algorithms chapter in
the Python Cookbook, published by O'Reilly.

Library usage: see the Timer class.

Command line usage:
    python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-p] [-h] [--] [statement]

Options:
  -n/--number N: how many times to execute 'statement' (default: see below)
  -r/--repeat N: how many times to repeat the timer (default 3)
  -s/--setup S: statement to be executed once initially (default 'pass').
                Execution time of this setup statement is NOT timed.
  -p/--process: use time.process_time() (default is time.perf_counter())
  -t/--time: use time.time() (deprecated)
  -c/--clock: use time.clock() (deprecated)
  -v/--verbose: print raw timing results; repeat for more digits precision
  -u/--unit: set the output time unit (usec, msec, or sec)
  -h/--help: print this usage message and exit
  --: separate options from statement, use when statement starts with -
  statement: statement to be timed (default 'pass')

A multi-line statement may be given by specifying each line as a
separate argument; indented lines are possible by enclosing an
argument in quotes and using leading spaces.  Multiple -s options are
treated similarly.

If -n is not given, a suitable number of loops is calculated by trying
successive powers of 10 until the total time is at least 0.2 seconds.

Note: there is a certain baseline overhead associated with executing a
pass statement.  It differs between versions.  The code here doesn't try
to hide it, but you should be aware of it.  The baseline overhead can be
measured by invoking the program without arguments.

Classes:

    Timer

Functions:

    timeit(string, string) -> float
    repeat(string, string) -> list
    default_timer() -> float

�N�Timer�timeit�repeat�
default_timerz<timeit-src>i@B�z�
def inner(_it, _timer{init}):
    {setup}
    _t0 = _timer()
    for _i in _it:
        {stmt}
    _t1 = _timer()
    return _t1 - _t0
cCs|jddd|�S)z*Helper to reindent a multi-line statement.�
� )�replace)�src�indent�r�/usr/lib64/python3.6/timeit.py�reindentPsrc@sPeZdZdZddedfdd�Zddd�Zefdd	�Ze	efd
d�Z
ddd
�ZdS)ra�Class for timing execution speed of small code snippets.

    The constructor takes a statement to be timed, an additional
    statement used for setup, and a timer function.  Both statements
    default to 'pass'; the timer function is platform-dependent (see
    module doc string).  If 'globals' is specified, the code will be
    executed within that namespace (as opposed to inside timeit's
    namespace).

    To measure the execution time of the first statement, use the
    timeit() method.  The repeat() method is a convenience to call
    timeit() multiple times and return a list of results.

    The statements may contain newlines, as long as they don't contain
    multi-line string literals.
    �passNcCs�||_i}|dkrt�n|}d}t|t�rJt|td�|d}t|d�}n*t|�rl||d<|d7}d}d}ntd	��t|t�r�t||td�t|d
�}n&t|�r�||d<|d7}d
}ntd��t	j
|||d�}	|	|_t|	td�}
t|
||�|d|_
dS)z#Constructor.  See class doc string.N��execr��_setupz, _setup=_setupz_setup()z&setup is neither a string nor callable�Z_stmtz
, _stmt=_stmtz_stmt()z%stmt is neither a string nor callable)�stmt�setup�init�inner)�timer�_globals�
isinstance�str�compile�dummy_src_namer�callable�
ValueError�template�formatr
rr)�selfrrr�globalsZlocal_nsZ	global_nsrZ
stmtprefixr
�coderrr
�__init__fs6

zTimer.__init__cCsJddl}ddl}|jdk	r:t|j�d|jjd�tf|jt<|j|d�dS)a�Helper to print a traceback from the timed code.

        Typical use:

            t = Timer(...)       # outside the try/except
            try:
                t.timeit(...)    # or t.repeat(...)
            except:
                t.print_exc()

        The advantage over the standard traceback is that source lines
        in the compiled template will be displayed.

        The optional file argument directs where the traceback is
        sent; it defaults to sys.stderr.
        rNr)�file)�	linecache�	tracebackr
�len�splitr�cache�	print_exc)r#r'r(r)rrr
r-�s

zTimer.print_excc
CsBtjd|�}tj�}tj�z|j||j�}Wd|r<tj�X|S)a�Time 'number' executions of the main statement.

        To be precise, this executes the setup statement once, and
        then returns the time it takes to execute the main statement
        a number of times, as a float measured in seconds.  The
        argument is the number of times through the loop, defaulting
        to one million.  The main statement, the setup statement and
        the timer function to be used are passed to the constructor.
        N)�	itertoolsr�gc�	isenabled�disablerr�enable)r#�number�itZgcoldZtimingrrr
r�s

zTimer.timeitcCs.g}x$t|�D]}|j|�}|j|�qW|S)a�Call timeit() a few times.

        This is a convenience function that calls the timeit()
        repeatedly, returning a list of results.  The first argument
        specifies how many times to call timeit(), defaulting to 3;
        the second argument specifies the timer argument, defaulting
        to one million.

        Note: it's tempting to calculate mean and standard deviation
        from the result vector and report these.  However, this is not
        very useful.  In a typical case, the lowest value gives a
        lower bound for how fast your machine can run the given code
        snippet; higher values in the result vector are typically not
        caused by variability in Python's speed, but by other
        processes interfering with your timing accuracy.  So the min()
        of the result is probably the only number you should be
        interested in.  After that, you should look at the entire
        vector and apply common sense rather than statistics.
        )�ranger�append)r#rr3�r�i�trrr
r�s

zTimer.repeatcCsFx<tdd�D].}d|}|j|�}|r0|||�|dkrPqW||fS)a�Return the number of loops and time taken so that total time >= 0.2.

        Calls the timeit method with *number* set to successive powers of
        ten (10, 100, 1000, ...) up to a maximum of one billion, until
        the time taken is at least 0.2 second, or the maximum is reached.
        Returns ``(number, time_taken)``.

        If *callback* is given and is not None, it will be called after
        each trial with two arguments: ``callback(number, time_taken)``.
        ��
g�������?)r5r)r#�callbackr8r3�
time_takenrrr
�	autorange�s

zTimer.autorange)N)N)�__name__�
__module__�__qualname__�__doc__rr&r-�default_numberr�default_repeatrr>rrrr
rTs"
rcCst||||�j|�S)zCConvenience function to create Timer object and call timeit method.)rr)rrrr3r$rrr
r�scCst||||�j||�S)zCConvenience function to create Timer object and call repeat method.)rr)rrrrr3r$rrr
r�s)�_wrap_timerc s^|dkrtjdd�}ddl}y(|j|dddddd	d
ddd
g	�\}}Wn2|jk
rx}zt|�td�dSd}~XnXt}dj|�p�d}d}g}t}	d}
d}dddd�}d��x�|D�]�\}
}|
d9kr�t|�}|
d:kr�|j	|�|
d;k�r||k�r�|}ntdtj
d�dS|
d<k�r0t|�}	|	dk�r0d}	|
d=k�r@tj}|
d>k�rPtj}|
d?k�r`tj
}|
d@k�r�|
�rx�d7�|
d7}
|
dAkr�ttd*d+�dSq�Wdj|��p�d}ddl}tjjd|j�|dk	�r�||�}t|||�}|dk�r(d}|
�r�fd,d-�}y|j|�\}}Wn|j�dSy|j|	|�}Wn|j�dSt|�}|
�rxtd.d*j�fd/d0�|D���td1|d*d+�|d|}|dk	�r�||}n>d2d0�|j�D�}|jd3d4�x|D]\}}||k�r�P�q�Wtd5|	�|||f�t|�}|d|}t|�}||d6k�rZ|d|}ddl}|jd7�|||ftd8d�dS)Ba�Main program, used when run as a script.

    The optional 'args' argument specifies the command line to be parsed,
    defaulting to sys.argv[1:].

    The return value is an exit code to be passed to sys.exit(); it
    may be None to indicate success.

    When an exception happens during timing, a traceback is printed to
    stderr and the return value is 1.  Exceptions at other times
    (including the template compilation) are not caught.

    '_wrap_timer' is an internal interface used for unit testing.  If it
    is not None, it must be a callable that accepts a timer function
    and returns another timer function (used for unit testing).
    Nr:rz
n:u:s:r:tcpvhznumber=zsetup=zrepeat=�time�clockZprocess�verbosezunit=�helpz#use -h/--help for command line help�rrg@�@g��.A)�usecZmsecZsecr�-n�--number�-s�--setup�-u�--unitz4Unrecognized unit. Please select usec, msec, or sec.)r'�-r�--repeat�-t�--time�-c�--clock�-p�	--process�-v�	--verbose�-h�--helpr)�endcsd}t|j||�d��dS)Nz#{num} loops -> {secs:.{prec}g} secs)ZnumZsecsZprec)�printr")r3r=�msg)�	precisionrr
r<@szmain.<locals>.callbackz
raw times:csg|]}d�|f�qS)z%.*gr)�.0�x)rarr
�
<listcomp>Oszmain.<locals>.<listcomp>z	%d loops,cSsg|]\}}||f�qSrr)rbZunit�scalerrr
rdUsT)�reversezbest of %d: %.*g %s per looprztThe test results are likely unreliable. The worst
time (%.*g %s) was more than four times slower than the best time.r)rLrM)rNrO)rPrQ)rRrS)rTrU)rVrW)rXrY)rZr[)r\r])�sys�argv�getopt�errorr_r�joinrD�intr6�stderrrFrGZprocess_timerB�os�path�insert�curdirrr>r-r�min�items�sort�max�warnings�
warn_explicit�UserWarning)�argsrEriZopts�errrrr3rrrHZ	time_unitZunits�o�arnr9r<�_r7ZbestrKreZscalesZworstrvr)rar
�main�s�















r~�__main__)N)rBr/rgrFr.�__all__rrCrDZperf_counterrr$rr!rrrrr~r?�exitrrrr
�<module>3s*
yselectors.cpython-36.pyc000064400000042443150335715140011210 0ustar003


 \�K�@s�dZddlmZmZddlmZmZddlZddlZddl	Z	d)Z
d*Zdd�Zedd	d
ddg�Z
d
e
_e	jd+kr�de
j_de
j_de
j_de
j_Gdd�de�ZGdd�ded�ZGdd�de�ZGdd�de�Zeed�r�Gdd�de�Zeed ��rGd!d"�d"e�Zeed#��r"Gd$d%�d%e�Zeed&��r>Gd'd(�d(e�Zd(e�k�rPeZn:d"e�k�rbeZn(d%e�k�rteZnde�k�r�eZneZdS),z|Selectors module.

This module allows high-level and efficient I/O multiplexing, built upon the
`select` module primitives.
�)�ABCMeta�abstractmethod)�
namedtuple�MappingN�c
Csft|t�r|}n<yt|j��}Wn*tttfk
rJtdj|��d�YnX|dkrbtdj|���|S)z�Return a file descriptor from a file object.

    Parameters:
    fileobj -- file object or file descriptor

    Returns:
    corresponding file descriptor

    Raises:
    ValueError if the object is invalid
    zInvalid file object: {!r}NrzInvalid file descriptor: {})�
isinstance�int�fileno�AttributeError�	TypeError�
ValueError�format)�fileobj�fd�r�!/usr/lib64/python3.6/selectors.py�_fileobj_to_fds
r�SelectorKeyrr�events�dataz�SelectorKey(fileobj, fd, events, data)

    Object used to associate a file object to its backing
    file descriptor, selected event mask, and attached data.
��zFile object registered.zUnderlying file descriptor.z3Events that must be waited for on this file object.zzOptional opaque data associated to this file object.
    For example, this could be used to store a per-client session ID.c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_SelectorMappingz)Mapping of file objects to selector keys.cCs
||_dS)N)�	_selector)�selfZselectorrrr�__init__>sz_SelectorMapping.__init__cCst|jj�S)N)�lenr�
_fd_to_key)rrrr�__len__Asz_SelectorMapping.__len__cCsBy|jj|�}|jj|Stk
r<tdj|��d�YnXdS)Nz{!r} is not registered)r�_fileobj_lookupr�KeyErrorr
)rrrrrr�__getitem__Ds
z_SelectorMapping.__getitem__cCst|jj�S)N)�iterrr)rrrr�__iter__Ksz_SelectorMapping.__iter__N)�__name__�
__module__�__qualname__�__doc__rrr!r#rrrrr;s
rc@sneZdZdZeddd��Zedd��Zddd�Zedd	d
��Zdd�Z	d
d�Z
edd��Zdd�Zdd�Z
dS)�BaseSelectora-Selector abstract base class.

    A selector supports registering file objects to be monitored for specific
    I/O events.

    A file object is a file descriptor or any object with a `fileno()` method.
    An arbitrary object can be attached to the file object, which can be used
    for example to store context information, a callback, etc.

    A selector can use various implementations (select(), poll(), epoll()...)
    depending on the platform. The default `Selector` class uses the most
    efficient implementation on the current platform.
    NcCst�dS)a3Register a file object.

        Parameters:
        fileobj -- file object or file descriptor
        events  -- events to monitor (bitwise mask of EVENT_READ|EVENT_WRITE)
        data    -- attached data

        Returns:
        SelectorKey instance

        Raises:
        ValueError if events is invalid
        KeyError if fileobj is already registered
        OSError if fileobj is closed or otherwise is unacceptable to
                the underlying system call (if a system call is made)

        Note:
        OSError may or may not be raised
        N)�NotImplementedError)rrrrrrr�register^szBaseSelector.registercCst�dS)ajUnregister a file object.

        Parameters:
        fileobj -- file object or file descriptor

        Returns:
        SelectorKey instance

        Raises:
        KeyError if fileobj is not registered

        Note:
        If fileobj is registered but has since been closed this does
        *not* raise OSError (even if the wrapped syscall does)
        N)r))rrrrr�
unregisteruszBaseSelector.unregistercCs|j|�|j|||�S)ayChange a registered file object monitored events or attached data.

        Parameters:
        fileobj -- file object or file descriptor
        events  -- events to monitor (bitwise mask of EVENT_READ|EVENT_WRITE)
        data    -- attached data

        Returns:
        SelectorKey instance

        Raises:
        Anything that unregister() or register() raises
        )r+r*)rrrrrrr�modify�s
zBaseSelector.modifycCst�dS)aqPerform the actual selection, until some monitored file objects are
        ready or a timeout expires.

        Parameters:
        timeout -- if timeout > 0, this specifies the maximum wait time, in
                   seconds
                   if timeout <= 0, the select() call won't block, and will
                   report the currently ready file objects
                   if timeout is None, select() will block until a monitored
                   file object becomes ready

        Returns:
        list of (key, events) for ready file objects
        `events` is a bitwise mask of EVENT_READ|EVENT_WRITE
        N)r))r�timeoutrrr�select�szBaseSelector.selectcCsdS)zmClose the selector.

        This must be called to make sure that any underlying resource is freed.
        Nr)rrrr�close�szBaseSelector.closecCsJ|j�}|dkrtd��y||Stk
rDtdj|��d�YnXdS)zzReturn the key associated to a registered file object.

        Returns:
        SelectorKey for this file object
        NzSelector is closedz{!r} is not registered)�get_map�RuntimeErrorr r
)rr�mappingrrr�get_key�szBaseSelector.get_keycCst�dS)z2Return a mapping of file objects to selector keys.N)r))rrrrr0�szBaseSelector.get_mapcCs|S)Nr)rrrr�	__enter__�szBaseSelector.__enter__cGs|j�dS)N)r/)r�argsrrr�__exit__�szBaseSelector.__exit__)N)N)N)r$r%r&r'rr*r+r,r.r/r3r0r4r6rrrrr(Os

r()�	metaclassc@sTeZdZdZdd�Zdd�Zddd�Zd	d
�Zddd�Zd
d�Z	dd�Z
dd�ZdS)�_BaseSelectorImplzBase selector implementation.cCsi|_t|�|_dS)N)rr�_map)rrrrr�sz_BaseSelectorImpl.__init__cCsHyt|�Stk
rBx"|jj�D]}|j|kr$|jSq$W�YnXdS)alReturn a file descriptor from a file object.

        This wraps _fileobj_to_fd() to do an exhaustive search in case
        the object is invalid but we still have it in our map.  This
        is used by unregister() so we can unregister an object that
        was previously registered even if it is closed.  It is also
        used by _SelectorMapping.
        N)rrr�valuesrr)rr�keyrrrr�s	

z!_BaseSelectorImpl._fileobj_lookupNcCsd|s|ttB@r"tdj|���t||j|�||�}|j|jkrTtdj||j���||j|j<|S)NzInvalid events: {!r}z"{!r} (FD {}) is already registered)	�
EVENT_READ�EVENT_WRITErr
rrrrr )rrrrr;rrrr*�sz_BaseSelectorImpl.registercCs@y|jj|j|��}Wn$tk
r:tdj|��d�YnX|S)Nz{!r} is not registered)r�poprr r
)rrr;rrrr+�s
z_BaseSelectorImpl.unregistercCs�y|j|j|�}Wn$tk
r8tdj|��d�YnX||jkr^|j|�|j|||�}n"||jkr�|j|d�}||j|j	<|S)Nz{!r} is not registered)r)
rrr r
rr+r*r�_replacer)rrrrr;rrrr,�s


z_BaseSelectorImpl.modifycCs|jj�d|_dS)N)r�clearr9)rrrrr/s
z_BaseSelectorImpl.closecCs|jS)N)r9)rrrrr0sz_BaseSelectorImpl.get_mapcCs$y
|j|Stk
rdSXdS)z�Return the key associated to a given file descriptor.

        Parameters:
        fd -- file descriptor

        Returns:
        corresponding key, or None if not found
        N)rr )rrrrr�_key_from_fds	
z_BaseSelectorImpl._key_from_fd)N)N)r$r%r&r'rrr*r+r,r/r0rArrrrr8�s


r8cs`eZdZdZ�fdd�Zd�fdd�	Z�fdd�Zejd	krHdd
d�Z	ne
j
Z	ddd
�Z
�ZS)�SelectSelectorzSelect-based selector.cst�j�t�|_t�|_dS)N)�superr�set�_readers�_writers)r)�	__class__rrr%s
zSelectSelector.__init__Ncs@t�j|||�}|t@r&|jj|j�|t@r<|jj|j�|S)N)rCr*r<rE�addrr=rF)rrrrr;)rGrrr**szSelectSelector.registercs,t�j|�}|jj|j�|jj|j�|S)N)rCr+rE�discardrrF)rrr;)rGrrr+2szSelectSelector.unregisterZwin32cCs$tj||||�\}}}|||gfS)N)r.)r�r�w�_r-�xrrr�_select9szSelectSelector._selectc	
Cs�|dkrdnt|d�}g}y|j|j|jg|�\}}}Wntk
rL|SXt|�}t|�}xV||BD]J}d}||kr�|tO}||kr�|tO}|j|�}|rh|j	|||j
@f�qhW|S)Nr)�maxrNrErF�InterruptedErrorrDr<r=rA�appendr)	rr-�readyrJrKrLrrr;rrrr.?s$
zSelectSelector.select)N)N)N)r$r%r&r'rr*r+�sys�platformrNr.�
__classcell__rr)rGrrB"s
rB�pollcsDeZdZdZ�fdd�Zd�fdd�	Z�fdd�Zdd	d
�Z�ZS)
�PollSelectorzPoll-based selector.cst�j�tj�|_dS)N)rCrr.rV�_poll)r)rGrrrZs
zPollSelector.__init__NcsLt�j|||�}d}|t@r&|tjO}|t@r8|tjO}|jj|j|�|S)Nr)	rCr*r<r.�POLLINr=�POLLOUTrXr)rrrrr;�poll_events)rGrrr*^s

zPollSelector.registercst�j|�}|jj|j�|S)N)rCr+rXr)rrr;)rGrrr+hszPollSelector.unregisterc
Cs�|dkrd}n|dkrd}ntj|d�}g}y|jj|�}Wntk
rR|SXx^|D]V\}}d}|tj@rz|tO}|tj@r�|t	O}|j
|�}|rZ|j|||j@f�qZW|S)Nrg@�@)
�math�ceilrXrVrPr.rYr=rZr<rArQr)rr-rR�
fd_event_listr�eventrr;rrrr.ms(
zPollSelector.select)N)N)	r$r%r&r'rr*r+r.rUrr)rGrrWWs

rW�epollcsXeZdZdZ�fdd�Zdd�Zd�fdd�	Z�fd	d
�Zddd�Z�fd
d�Z	�Z
S)�
EpollSelectorzEpoll-based selector.cst�j�tj�|_dS)N)rCrr.r`�_epoll)r)rGrrr�s
zEpollSelector.__init__cCs
|jj�S)N)rbr	)rrrrr	�szEpollSelector.filenoNcstt�j|||�}d}|t@r&|tjO}|t@r8|tjO}y|jj|j|�Wn"t	k
rnt�j
|��YnX|S)Nr)rCr*r<r.�EPOLLINr=�EPOLLOUTrbr�
BaseExceptionr+)rrrrr;Zepoll_events)rGrrr*�s

zEpollSelector.registercs8t�j|�}y|jj|j�Wntk
r2YnX|S)N)rCr+rbr�OSError)rrr;)rGrrr+�szEpollSelector.unregisterc	
Cs�|dkrd}n |dkrd}ntj|d�d}tt|j�d�}g}y|jj||�}Wntk
rh|SXx^|D]V\}}d}|tj	@r�|t
O}|tj@r�|tO}|j
|�}|rp|j|||j@f�qpW|S)Nrrg@�@g����MbP?���)r\r]rOrrrbrVrPr.rcr=rdr<rArQr)	rr-�max_evrRr^rr_rr;rrrr.�s*
zEpollSelector.selectcs|jj�t�j�dS)N)rbr/rC)r)rGrrr/�s
zEpollSelector.close)N)N)r$r%r&r'rr	r*r+r.r/rUrr)rGrra�s

 ra�devpollcsXeZdZdZ�fdd�Zdd�Zd�fdd�	Z�fd	d
�Zddd�Z�fd
d�Z	�Z
S)�DevpollSelectorzSolaris /dev/poll selector.cst�j�tj�|_dS)N)rCrr.ri�_devpoll)r)rGrrr�s
zDevpollSelector.__init__cCs
|jj�S)N)rkr	)rrrrr	�szDevpollSelector.filenoNcsLt�j|||�}d}|t@r&|tjO}|t@r8|tjO}|jj|j|�|S)Nr)	rCr*r<r.rYr=rZrkr)rrrrr;r[)rGrrr*�s

zDevpollSelector.registercst�j|�}|jj|j�|S)N)rCr+rkr)rrr;)rGrrr+�szDevpollSelector.unregisterc
Cs�|dkrd}n|dkrd}ntj|d�}g}y|jj|�}Wntk
rR|SXx^|D]V\}}d}|tj@rz|tO}|tj@r�|t	O}|j
|�}|rZ|j|||j@f�qZW|S)Nrg@�@)
r\r]rkrVrPr.rYr=rZr<rArQr)rr-rRr^rr_rr;rrrr.�s(
zDevpollSelector.selectcs|jj�t�j�dS)N)rkr/rC)r)rGrrr/s
zDevpollSelector.close)N)N)r$r%r&r'rr	r*r+r.r/rUrr)rGrrj�s

rj�kqueuecsXeZdZdZ�fdd�Zdd�Zd�fdd�	Z�fd	d
�Zddd�Z�fd
d�Z	�Z
S)�KqueueSelectorzKqueue-based selector.cst�j�tj�|_dS)N)rCrr.rl�_kqueue)r)rGrrrs
zKqueueSelector.__init__cCs
|jj�S)N)rnr	)rrrrr	szKqueueSelector.filenoNcs�t�j|||�}y`|t@r@tj|jtjtj�}|jj	|gdd�|t
@rntj|jtjtj�}|jj	|gdd�Wn"tk
r�t�j
|��YnX|S)Nr)rCr*r<r.�keventr�KQ_FILTER_READZ	KQ_EV_ADDrn�controlr=�KQ_FILTER_WRITErer+)rrrrr;�kev)rGrrr*szKqueueSelector.registercs�t�j|�}|jt@rVtj|jtjtj�}y|j	j
|gdd�Wntk
rTYnX|jt@r�tj|jtj
tj�}y|j	j
|gdd�Wntk
r�YnX|S)Nr)rCr+rr<r.rorrpZKQ_EV_DELETErnrqrfr=rr)rrr;rs)rGrrr+'s 

zKqueueSelector.unregisterc

Cs�|dkrdnt|d�}t|j�}g}y|jjd||�}Wntk
rL|SXxb|D]Z}|j}|j}d}|tj	krz|t
O}|tjkr�|tO}|j
|�}	|	rT|j|	||	j@f�qTW|S)Nr)rOrrrnrqrPZident�filterr.rpr<rrr=rArQr)
rr-rhrRZkev_listrsr�flagrr;rrrr.<s&




zKqueueSelector.selectcs|jj�t�j�dS)N)rnr/rC)r)rGrrr/Rs
zKqueueSelector.close)N)N)r$r%r&r'rr	r*r+r.r/rUrr)rGrrm
s
rmr�)rr)r'�abcrr�collectionsrrr\r.rSr<r=rr�version_inforrrrrr(r8rB�hasattrrWrarjrm�globalsZDefaultSelectorrrrr�<module>sH
~U3
1G8Mreprlib.cpython-36.opt-2.pyc000064400000012176150335715140011604 0ustar003


 \��@s�dddgZddlZddlmZyddlmZWn ek
rNddlmZYnXddd�ZGd	d�d�Z	d
d�Z
e	�ZejZdS)
�Repr�repr�recursive_repr�N)�islice)�	get_ident�...cs�fdd�}|S)NcsXt�����fdd�}t�d�|_t�d�|_t�d�|_t�d�|_t�di�|_|S)NcsBt|�t�f}|�kr�S�j|�z�|�}Wd�j|�X|S)N)�idr�add�discard)�self�key�result)�	fillvalue�repr_running�
user_function��/usr/lib64/python3.6/reprlib.py�wrappers
z<recursive_repr.<locals>.decorating_function.<locals>.wrapper�
__module__�__doc__�__name__�__qualname__�__annotations__)�set�getattrrrrrr)rr)r)rrr�decorating_functionsz+recursive_repr.<locals>.decorating_functionr)rrr)rrrsc@s~eZdZdd�Zdd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS) rcCsFd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
dS)N�����()�maxlevel�maxtuple�maxlist�maxarray�maxdict�maxset�maxfrozenset�maxdeque�	maxstring�maxlong�maxother)rrrr�__init__)sz
Repr.__init__cCs|j||j�S)N)�repr1r!)r�xrrrr6sz	Repr.reprcCsVt|�j}d|kr$|j�}dj|�}t|d|�rFt|d|�||�S|j||�SdS)N� �_�repr_)�typer�split�join�hasattrr�
repr_instance)rr.�level�typename�partsrrrr-9s

z
Repr.repr1�c
s�t|�}|dkr|rd}nX|d�|j���fdd�t||�D�}	||krT|	jd�dj|	�}|dkrr|rr||}d|||fS)Nrz...�csg|]}�|���qSrr)�.0�elem)�newlevelr-rr�
<listcomp>Jsz'Repr._repr_iterable.<locals>.<listcomp>z, z%s%s%s)�lenr-r�appendr4)
rr.r7�left�right�maxiter�trail�n�s�piecesr)r>r-r�_repr_iterableCs

zRepr._repr_iterablecCs|j||dd|jd�S)N�(�)�,)rIr")rr.r7rrr�
repr_tuplePszRepr.repr_tuplecCs|j||dd|j�S)N�[�])rIr#)rr.r7rrr�	repr_listSszRepr.repr_listcCs,|sd|jSd|j}|j|||d|j�S)Nzarray('%s')z
array('%s', [z]))�typecoderIr$)rr.r7�headerrrr�
repr_arrayVs

zRepr.repr_arraycCs$|sdSt|�}|j||dd|j�S)Nzset()�{�})�_possibly_sortedrIr&)rr.r7rrr�repr_set\sz
Repr.repr_setcCs$|sdSt|�}|j||dd|j�S)Nzfrozenset()zfrozenset({z}))rVrIr')rr.r7rrr�repr_frozensetbs
zRepr.repr_frozensetcCs|j||dd|j�S)Nzdeque([z]))rIr()rr.r7rrr�
repr_dequeiszRepr.repr_dequecCs�t|�}|dkrdS|dkr dS|d}|j}g}xBtt|�|j�D].}|||�}||||�}	|jd||	f�qDW||jkr�|jd�dj|�}
d|
fS)	Nrz{}z{...}r;z%s: %sz...z, z{%s})r@r-rrVr%rAr4)rr.r7rFr>r-rHr�keyrepr�valreprrGrrr�	repr_dictls 



zRepr.repr_dictcCs�tj|d|j��}t|�|jkr�td|jdd�}td|jd|�}tj|d|�|t|�|d��}|d|�d|t|�|d�}|S)Nr��z...)�builtinsrr)r@�max)rr.r7rG�i�jrrr�repr_str{s&$z
Repr.repr_strcCshtj|�}t|�|jkrdtd|jdd�}td|jd|�}|d|�d|t|�|d�}|S)Nrr]r^z...)r_rr@r*r`)rr.r7rGrarbrrr�repr_int�s
$z
Repr.repr_intcCs�ytj|�}Wn$tk
r2d|jjt|�fSXt|�|jkr�td|jdd�}td|jd|�}|d|�d|t|�|d�}|S)Nz<%s instance at %#x>rr]r^z...)	r_r�	Exception�	__class__rrr@r+r`)rr.r7rGrarbrrrr6�s$zRepr.repr_instanceN)r:)rrrr,rr-rIrMrPrSrWrXrYr\rcrdr6rrrrr's



	cCs&yt|�Stk
r t|�SXdS)N)�sortedre�list)r.rrrrV�srV)r)
�__all__r_�	itertoolsr�_threadr�ImportErrorZ
_dummy_threadrrrV�aReprrrrrr�<module>s

s	profile.cpython-36.pyc000064400000033117150335715140010643 0ustar003


 \
V�@s�dZddlZddlZddlZddlZddlmZdddgZGdd�d�Zdd
d�Z	ddd�Z
Gdd�d�Zd
d�Ze
dkr�e�dS)z Class for profiling Python code.�N)�OptionParser�run�runctx�Profilec@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_Utilsz�Support class for utility functions which are shared by
    profile.py and cProfile.py modules.
    Not supposed to be used directly.
    cCs
||_dS)N)�profiler)�selfr�r	�/usr/lib64/python3.6/profile.py�__init__1sz_Utils.__init__cCsF|j�}z(y|j|�Wntk
r,YnXWd|j|||�XdS)N)rr�
SystemExit�_show)r�	statement�filename�sort�profr	r	r
r4s
z
_Utils.runcCsJ|j�}z,y|j|||�Wntk
r0YnXWd|j|||�XdS)N)rrrr
)rr�globals�localsrrrr	r	r
r=s
z
_Utils.runctxcCs"|dk	r|j|�n
|j|�dS)N)�
dump_stats�print_stats)rrrrr	r	r
r
Fsz_Utils._showN)�__name__�
__module__�__qualname__�__doc__rrrr
r	r	r	r
r+s
		r�cCstt�j|||�S)aRun statement under profiler optionally saving results in filename

    This function takes a single argument that can be passed to the
    "exec" statement, and an optional file name.  In all cases this
    routine attempts to "exec" its first argument and gather profiling
    statistics from the execution. If no file name is present, then this
    function automatically prints a simple profiling report, sorted by the
    standard name string (file/line/function-name) that is presented in
    each line.
    )rrr)rrrr	r	r
rRscCstt�j|||||�S)z�Run statement under profiler, supplying your own globals and locals,
    optionally saving results in filename.

    statement and filename have the same semantics as profile.run
    )rrr)rrrrrr	r	r
r_sc@s�eZdZdZdZd4dd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
ee
e
ee
e
d�Zdd�ZGdd�d�ZGdd�d�Zdd�Zdd �Zd6d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd7d0d1�Zd2d3�ZdS)8raProfiler class.

    self.cur is always a tuple.  Each such tuple corresponds to a stack
    frame that is currently active (self.cur[-2]).  The following are the
    definitions of its members.  We use this external "parallel stack" to
    avoid contaminating the program that we are profiling. (old profiler
    used to write into the frames local dictionary!!) Derived classes
    can change the definition of some entries, as long as they leave
    [-2:] intact (frame and previous tuple).  In case an internal error is
    detected, the -3 element is used as the function name.

    [ 0] = Time that needs to be charged to the parent frame's function.
           It is used so that a function call will not have to access the
           timing data for the parent frame.
    [ 1] = Total time spent in this frame's function, excluding time in
           subfunctions (this latter is tallied in cur[2]).
    [ 2] = Total time spent in subfunctions, excluding time executing the
           frame's function (this latter is tallied in cur[1]).
    [-3] = Name of the function that corresponds to this frame.
    [-2] = Actual frame that we correspond to (used to sync exception handling).
    [-1] = Our parent 6-tuple (corresponds to frame.f_back).

    Timing data for each function is stored as a 5-tuple in the dictionary
    self.timings[].  The index is always the name stored in self.cur[-3].
    The following are the definitions of the members:

    [0] = The number of times this function was called, not counting direct
          or indirect recursion,
    [1] = Number of times this function appears on the stack, minus one
    [2] = Total time spent internal to this function
    [3] = Cumulative time that this function was present on the stack.  In
          non-recursive functions, this is the total execution time from start
          to finish of each invocation of a function, including time spent in
          all subfunctions.
    [4] = A dictionary indicating for each function name, the number of times
          it was called by us.
    rNcCs�i|_d|_d|_d|_|dkr&|j}||_|sHtj|_|_|j	|_
nl||_|j�}yt|�}Wn"tk
r�||_|j	|_
Yn0X|dkr�|j
|_
n|j|_
|tfdd�}||_|j�|_|jd�dS)N��cSs
||��S)Nr	)�timer�sumr	r	r
�get_time_timer�sz(Profile.__init__.<locals>.get_time_timerr)�timings�cur�cmd�c_func_name�bias�timeZprocess_timer�get_time�trace_dispatch_i�
dispatcher�len�	TypeError�trace_dispatch�trace_dispatch_lr�t�
simulate_call)rrr$r-Zlengthrr	r	r
r�s0


zProfile.__init__cCs�|j}|�}|d|d|j|j}|dkr8|j|_|j||||�rd|�}|d|d|_n|�}|d|d||_dS)Nrr�c_call)rr-r$rr#�dispatch)r�frame�event�argrr-�rr	r	r
r+�szProfile.trace_dispatchcCsT|j}|�|j|j}|dkr(|j|_|j||||�rD|�|_n|�||_dS)Nr/)rr-r$rr#r0)rr1r2r3rr-r	r	r
r'�s
zProfile.trace_dispatch_icCs`|j}|�d|j|j}|dkr,|j|_|j||||�rL|�d|_n|�d||_dS)NgN@r/)rr-r$rr#r0)rr1r2r3rr-r	r	r
�trace_dispatch_mac�szProfile.trace_dispatch_maccCsT|j}|�|j|j}|dkr(|j|_|j||||�rD|�|_n|�||_dS)Nr/)r&r-r$rr#r0)rr1r2r3r&r-r	r	r
r,�s
zProfile.trace_dispatch_lc	CsD|j\}}}}}}||k	r*|r*|j||�S|||||||f|_dS)Nr)r!�trace_dispatch_return)	rr1r-�rpt�rit�ret�rfn�rframe�rcurr	r	r
�trace_dispatch_exception�s
z Profile.trace_dispatch_exceptioncCs|jr�|j|jdk	r�|j\}}}}}}t|tj�s�|j|jksXtd|||j||jf��|j|d�|jdks�|j|jdks�td|jdf��|j}	|	j|	j	|	j
f}
|dd|
||jf|_|j}|
|kr�||
\}}
}}}||
d|||f||
<nddddif||
<dS)	NrzBad callr�r���r?���)r!�f_back�
isinstancer�
fake_frame�AssertionErrorr6�f_code�co_filename�co_firstlineno�co_namer )rr1r-r7r8r9r:r;r<Zfcode�fnr �cc�ns�tt�ct�callersr	r	r
�trace_dispatch_calls&
zProfile.trace_dispatch_callc
Csndd|jf}|dd|||jf|_|j}||krX||\}}}}}	||d|||	f||<nddddif||<dS)Nrrr)r#r!r )
rr1r-rIr rJrKrLrMrNr	r	r
�trace_dispatch_c_callszProfile.trace_dispatch_c_callcCs�||jdk	rB||jdjks0td|jdf��|j|jd	d�|j\}}}}}}||}||}|\}	}
}}}
}|	|
|||||
|f|_|j}||\}}}}}|s�||}|d}||kr�||d||<nd||<||d||||f||<dS)
Nrz
Bad returnr>rrr?r?r@r?)r!rArDr6r )rr1r-r7r8r9r:r<Zframe_totalZpptZpitZpetZpfn�pframeZpcurr rJrKrLrMrNr	r	r
r6#s$"zProfile.trace_dispatch_return)�callZ	exception�returnr/Zc_exceptionZc_returncCs"|jdrdS||_|j|�dS)Nr���)r!r"r.)rr"r	r	r
�set_cmdYs
zProfile.set_cmdc@seZdZdd�Zdd�ZdS)zProfile.fake_codecCs||_||_||_d|_dS)Nr)rF�co_linerHrG)rr�line�namer	r	r
r_szProfile.fake_code.__init__cCst|j|j|jf�S)N)�reprrFrVrH)rr	r	r
�__repr__eszProfile.fake_code.__repr__N)rrrrrZr	r	r	r
�	fake_code^sr[c@seZdZdd�ZdS)zProfile.fake_framecCs||_||_dS)N)rErA)r�codeZpriorr	r	r
riszProfile.fake_frame.__init__N)rrrrr	r	r	r
rChsrCcCsF|jdd|�}|jr |jd}nd}|j||�}|jd||d�dS)NZprofilerrrRr?)r[r!rCr0)rrXr\rQr1r	r	r
r.mszProfile.simulate_callcCsN|j}|�|j}x*|jdr<|jd||jd|�d}qW|�||_dS)NrrSrrrTr?)r&r-r!r0)rr&r-r	r	r
�simulate_cmd_completeyszProfile.simulate_cmd_completercCs$ddl}|j|�j�j|�j�dS)Nr)�pstatsZStatsZ
strip_dirsZ
sort_statsr)rrr^r	r	r
r�szProfile.print_statsc
Cs0t|d��}|j�tj|j|�WdQRXdS)N�wb)�open�create_stats�marshal�dump�stats)r�file�fr	r	r
r�szProfile.dump_statscCs|j�|j�dS)N)r]�snapshot_stats)rr	r	r
ra�szProfile.create_statsc	Csfi|_xZ|jj�D]L\}\}}}}}|j�}d}x|j�D]}||7}q:W|||||f|j|<qWdS)Nr)rdr �items�copy�values)	r�funcrJrKrLrMrNZncZcallcntr	r	r
rg�szProfile.snapshot_statscCsddl}|j}|j|||�S)Nr)�__main__�__dict__r)rr"rl�dictr	r	r
r�szProfile.runcCs8|j|�tj|j�zt|||�Wdtjd�X|S)N)rU�sys�
setprofiler(�exec)rr"rrr	r	r
r�s
zProfile.runctxcOs6|jt|��tj|j�z
|||�Stjd�XdS)N)rUrYrorpr()rrk�args�kwr	r	r
�runcall�s

zProfile.runcallcCs8|jtk	rtd��|j}d|_z|j||�S||_XdS)Nz&Subclasses must override .calibrate().r)�	__class__rr*r$�_calibrate_inner)r�m�verboseZ
saved_biasr	r	r
�	calibrate�s
zProfile.calibratecCs$|j}dd�}|fdd�}||�|�}||�|�}||}|rLtd|�t�}	|�}|	jdt�t��|�}||}
|r�td|
�d}d}x>|	jj�D]0\\}
}}\}}}}}|dkr�||7}||7}q�W|r�td|�td|�||d
k�rtd|��||d|}|�r td|�|S)NcSsxt|�D]}d}q
WdS)Nr)�range)�n�i�xr	r	r
�f1�sz$Profile._calibrate_inner.<locals>.f1cSsxt|�D]}|d�q
WdS)N�d)rz)rwr~r|r	r	r
rf�sz#Profile._calibrate_inner.<locals>.fz elapsed time without profiling =zf(m)zelapsed time with profiling =grfr~z!'CPU seconds' profiler reported =ztotal # calls =rz internal error: total calls = %dg@z+mean stopwatch overhead per profile event =)rfr~)	r&�printrrrrr rh�
ValueError)rrwrxr&r~rfZt0Zt1Zelapsed_noprofile�pZelapsed_profileZtotal_callsZ
reported_timerrW�funcnamerJrKrLrMrNZmeanr	r	r
rv�sB

"


zProfile._calibrate_inner)NNrT)rT)r)rrrrr$rr+r'r5r,r=rOrPr6r0rUr[rCr.r]rrrargrrrtryrvr	r	r	r
rhs>%
''




1
c
Cs�d}t|d�}d|_|jdddddd�|jd	d
dddd�tjd
d�s\|j�tjd�|j�\}}|tjdd�<t|�dkr�|d}tj	j
dtj	j|��t
|d��}t|j�|d�}WdQRX|dddd�}t||d|j|j�n|j�|S)Nz?profile.py [-o output_file_path] [-s sort] scriptfile [arg] ...)�usageFz-oz	--outfile�outfilezSave stats to <outfile>)�dest�help�defaultz-sz--sortrz?Sort order when printing to stdout, based on pstats.Stats classrrr�rbrqrl)�__file__r�__package__�
__cached__rT)rZallow_interspersed_argsZ
add_optionro�argvZprint_usage�exit�
parse_argsr)�path�insert�os�dirnamer`�compile�readrr�r)r��parserZoptionsrrZprogname�fpr\Zglobsr	r	r
�main*s2




r�rlrT)NrTrT)NrT)rror�r%rbZoptparser�__all__rrrrr�rr	r	r	r
�<module>	s 

'

	E"pydoc.cpython-36.pyc000064400000243052150335715140010322 0ustar003

�]dhM��@s�dZdgZdZdZdZddlZddlZddlZddl	Zddl
ZddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZdd	lmZd
d�Zdd
�Zdd�Zdd�Z dd�Z!dd�Z"dd�Z#ej$dej%�Z&dd�Z'dd�Z(dd�Z)dd �Z*d!d"�Z+dud#d$�Z,d%d&�Z-d'd(�Z.d)d*�Z/d+d,�Z0ifd-d.�Z1Gd/d0�d0e2�Z3d1d2�Z4difd3d4�Z5Gd5d6�d6�Z6Gd7d8�d8e�Z7Gd9d:�d:e6�Z8Gd;d<�d<e�Z9Gd=d>�d>e6�Z:Gd?d@�d@e:�Z;dAdB�a<dCdD�Z=dEdF�Z>dGdH�Z?dIdJ�Z@dKdL�ZAdMdN�ZBdOdP�ZCdQdR�ZDdvdSdT�ZEe:�ZFe;�ZGe8�ZHdwdUdV�ZIdxdXdY�ZJdydZd[�ZKdzd\d]�ZLd{d_d`�ZMGdadb�db�ZNeN�ZOGdcdd�dd�ZPdedf�ZQdgdh�ZRd|djdk�ZSd}dldm�dndo�ZTdpdq�ZUdrds�ZVeWdtk�r�eV�dS)~a�Generate Python documentation in HTML or text for interactive use.

At the Python interactive prompt, calling help(thing) on a Python object
documents the object, and calling help() starts up an interactive
help session.

Or, at the shell command line outside of Python:

Run "pydoc <name>" to show documentation on something.  <name> may be
the name of a function, module, package, or a dotted reference to a
class or function within a module or module in a package.  If the
argument contains a path segment delimiter (e.g. slash on Unix,
backslash on Windows) it is treated as the path to a Python source file.

Run "pydoc -k <keyword>" to search for a keyword in the synopsis lines
of all available modules.

Run "pydoc -p <port>" to start an HTTP server on the given port on the
local machine.  Port number 0 can be used to get an arbitrary unused port.

Run "pydoc -b" to start an HTTP server on an arbitrary unused port and
open a Web browser to interactively browse documentation.  The -p option
can be used with the -b option to explicitly specify the server port.

Run "pydoc -w <name>" to write out the HTML documentation for a module
to a file named "<name>.html".

Module docs for core modules are assumed to be in

    https://docs.python.org/X.Y/library/

This can be overridden by setting the PYTHONDOCS environment variable
to a different URL or to a local directory containing the Library
Reference Manual pages.
�helpzKa-Ping Yee <ping@lfw.org>z26 February 2001z�Guido van Rossum, for an excellent programming language.
Tommy Burnette, the original creator of manpy.
Paul Prescod, for all his work on onlinehelp.
Richard Chamberlain, for the first implementation of textdoc.
�N)�deque)�Repr)�format_exception_onlycCs`g}g}xRtjD]H}tjj|p d�}tjj|�}||krtjj|�r|j|�|j|�qW|S)zAConvert sys.path into a list of absolute, existing, unique paths.�.)�sys�path�os�abspath�normcase�isdir�append)�dirsZnormdirs�dirZnormdir�r�/usr/lib64/python3.6/pydoc.py�pathdirsLs
rcCs.tj|�ptj|�}|r*tjdd|j��p,dS)z-Get the doc string or comments for an object.z^ *
�)�inspect�getdocZgetcomments�re�sub�rstrip)�object�resultrrrrXsrcCsh|j�jd�}t|�dkr&|ddfSt|�dkrZ|dj�rZ|ddj|dd��fSddj|�fS)z>Split a doc string into a synopsis line (if any) and the rest.�
�rr�N)�strip�split�lenr�join)�doc�linesrrr�splitdoc]sr$cCs"|j}|j|kr|jd|}|S)z@Get a class name and qualify it with a module name if necessary.r)�__name__�
__module__)r�modname�namerrr�	classnamefs
r)cCs>tj|�p:tj|�p:tj|�p:tj|�p:tj|�p:tj|�S)z>Check if an object is of a type that probably means it's data.)r�ismodule�isclass�	isroutineZisframeZistracebackZiscode)rrrr�isdatamsr-cGs2x,|r,|dj|j|d��}|dd�}qW|S)z/Do a series of global replacements on a string.rrrN)r!r)�textZpairsrrr�replacessr/cCsXt|�|krTtd|dd�}td|d|�}|d|�d|t|�|d�S|S)zCOmit part of a string if needed to make it fit in a maximum length.r�rNz...)r �max)r.�maxlenZpreZpostrrr�cramzs
$r3z at 0x[0-9a-f]{6,16}(>+)$cCstjd|�S)z>Remove the hexadecimal id from a Python object representation.z\1)�_re_stripidr)r.rrr�stripid�sr5cCs(tj|�p&tj|�p&tj|�p&tj|�S)N)r�
isfunction�ismethod�	isbuiltinZismethoddescriptor)�objrrr�_is_some_method�s


r:cCs<tj|�rdStj|�r8t|dd�}tj|�p4|dkSdS)zo
    Returns True if fn is a bound method, regardless of whether
    fn was implemented in Python or in C.
    T�__self__NF)rr7r8�getattrr*)�fn�selfrrr�_is_bound_method�s

r?cCshi}x tj|t�D]\}}d||<qWx|jD]}|jt|��q.Wx|j�D]}t||�||<qNW|S)Nr)r�
getmembersr:�	__bases__�update�
allmethods�keysr<)�cl�methods�key�value�baserrrrC�srCcCs<g}g}x*|D]"}||�r&|j|�q|j|�qW||fS)z�Split sequence s via predicate, and return pair ([true], [false]).

    The return value is a 2-tuple of lists,
        ([x for x in s if predicate(x)],
         [x for x in s if not predicate(x)])
    )r
)�s�	predicate�yes�no�xrrr�_split_list�s
rOcCs\|dkrdS|jd�r$|jd�r$dS|jd�r<t|d�r<dS|dk	rL||kS|jd�SdS)z3Decide whether to show documentation on a variable.�
__author__�__builtins__�
__cached__�__credits__�__date__�__doc__�__file__�__spec__�
__loader__r&r%�__package__�__path__�__qualname__�	__slots__�__version__r�__r�_�_fieldsTN>rWrXrZr&rQrRrPr]rSrTr%rVr\rYrUr[)�
startswith�endswith�hasattr)r(�allr9rrr�visiblename�srecCsDg}x:tj|�D],\}}}}tj|�r*d}|j||||f�qW|S)zCWrap inspect.classify_class_attrs, with fixup for data descriptors.zdata descriptor)r�classify_class_attrs�isdatadescriptorr
)r�resultsr(�kind�clsrHrrrrf�s
rfcs\t|dg��y�fdd�t��D��Wntk
r>i�YnX�fdd�}|j|d�dS)zGSort the attrs list in-place by _fields and then alphabetically by namer`csi|]\}}|t��|�qSr)r )�.0�ir()�fieldsrr�
<dictcomp>�sz#sort_attributes.<locals>.<dictcomp>cs�j|dd�|dfS)Nr)�get)�attr)�field_orderrr�<lambda>�sz!sort_attributes.<locals>.<lambda>)rGN)r<�	enumerate�	TypeError�sort)�attrsrZkeyfuncr)rqrmr�sort_attributes�s
rwcCs<tjj|�r8x*dD]"}tjjtjj|d|��rdSqWdS)z3Guess whether a path refers to a package directory.�.py�.pyc�__init__TF)rxry)r	rr�isfiler!)r�extrrr�	ispackage�s

r}cCs�|j�}x,|dd�dks$|j�r4|j�}|s
Pq
W|j�}|dd�dkrZ|dd�}|dd�dkr�|dd�}|d	d�dkr�|dd
�}x|j�s�|j�}|s�Pq�W|jd�dj�}nd}|S)Nr�#�zr"""r0z"""�\r���r�)�readlinerr)�file�linerrrr�source_synopsis�s&
r�c
Cstj|�j}|j|d�\}}|dks.||k�r|jttjj��rJtjj	}n |jttjj
��rftjj}nd}|dkr�ytj
|�}Wntk
r�dSX|�t|�}WdQRXnZ|d|�}tjjd||d�}ytjj|�}	Wn
dStjd=|	j�r|	jj�dnd}||f||<|S)z.Get the one-line summary out of a module file.NZ__temp__)�loaderr)NN)r	�stat�st_mtimerorb�tuple�	importlib�	machinery�BYTECODE_SUFFIXES�SourcelessFileLoader�EXTENSION_SUFFIXES�ExtensionFileLoader�tokenize�open�OSErrorr��util�spec_from_file_location�
_bootstrap�_loadr�modulesrU�
splitlines)
�filename�cache�mtimeZ
lastupdaterZ
loader_clsr�r��spec�modulerrr�synopsis�s4



r�c@s eZdZdZdd�Zdd�ZdS)�ErrorDuringImportzEErrors that occurred while trying to import something to document it.cCs||_|\|_|_|_dS)N)r��excrH�tb)r>r��exc_inforrrrz#szErrorDuringImport.__init__cCs|jj}d|j||jfS)Nzproblem in %s - %s: %s)r�r%r�rH)r>r�rrr�__str__'szErrorDuringImport.__str__N)r%r&r[rUrzr�rrrrr�!sr�c	Cs�tjj}t|d��}||jt|��k}WdQRXtjj|�}tjj	|�\}}|r`tj
j||�}ntj
j||�}tjj
|||d�}ytjj|�St|tj���YnXdS)z<Import a Python source file or compiled file given its path.�rbN)r�)r�r��MAGIC_NUMBERr��readr r	r�basename�splitext�_bootstrap_externalr��SourceFileLoaderr�r�r�r�rr�)	r�magicr�Zis_bytecoder�r(r|r�r�rrr�
importfile+sr�cs"yb|rX�tjkrX�tjkrX�fdd�tjD�}x(�g|D]}tj|||<tj|=q:Wt��}Wnxtj�\}}}}	�tjkr�ttj�j|	��n<|tkr�t|j|	��n&t	|t
�r�|j�kr�dSt�tj���YnXx@�jd�dd�D]*}
yt
||
�}Wq�tk
�rdSXq�W|S)a�Import a module; handle errors; return None if the module isn't found.

    If the module *is* found but an exception occurs, it's wrapped in an
    ErrorDuringImport exception and reraised.  Unlike __import__, if a
    package path is specified, the module at the end of the path is returned,
    not the package at the beginning.  If the optional 'forceload' argument
    is 1, we reload the module from disk (unless it's a dynamic extension).csg|]}|j�d�r|�qS)r)ra)rk�m)rrr�
<listcomp>Qszsafeimport.<locals>.<listcomp>Nrr)rr��builtin_module_names�
__import__r�r�rV�SyntaxErrorr��
issubclass�ImportErrorr(rr<�AttributeError)r�	forceloadr�ZsubsrGr�r�rHr��info�partr)rr�
safeimport=s.


r�c@s|eZdZejjddejdd��Zd
dd�Z	ddd�Z
e
ZZZ
ZZZejjejd	d
ejdd��fdd�ZdS)�Doc�
PYTHONDOCSz%https://docs.python.org/%d.%d/libraryNrcGs�||f|}tj|�r |j|�Stj|�r4|j|�Sy@tj|�rJ|j|�Stj|�r^|j|�Stj|�rr|j	|�SWnt
k
r�YnXt|t�r�|j
|�S|j|�S)z%Generate documentation for an object.)r�isgetsetdescriptor�docdata�ismemberdescriptorr*�	docmoduler+�docclassr,�
docroutiner��
isinstance�property�docproperty�docother)r>rr(�argsrrr�documentss"










zDoc.documentcGs*d|odt|�t|�jf}t|��dS)z+Raise an exception for unimplemented types.z.don't know how to document object%s of type %s� N)�repr�typer%rt)r>rr(r��messagerrr�fail�szDoc.fail�libzpython%d.%dcCs�ytj|�}Wntk
r&d}YnXtjjd|j�}tjj|�}t	|t
t��r�|jdks||j|�r�|jtjj
|d
��r�|jdkr�|jd�r�d|jd�|jj�f}q�tjj
||jj�d�}nd}|S)z*Return the location of module docs or Nonez
(built-in)r��errno�
exceptions�gc�imp�marshal�posix�signalr�_thread�	zipimportz
site-packages�	xml.etree�test.pydoc_mod�http://�https://z%s/%s�/z.htmlN)
r�r�r�r�r�r�r�rr�r�)r�r�)r�r�)r�
getabsfilertr	�environror�rrr�r�r%rar!r�lower)r>rZbasedirr��doclocrrr�	getdocloc�s$



z
Doc.getdocloc)N)N)r%r&r[r	r�ror�version_infor�r�r�r�r�r�r�r�r�rr!�base_exec_prefixr�rrrrr�ms

r�c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZeZ	dd
�Z
eZdS)�HTMLReprzBClass for safely making an HTML representation of a Python object.cCs,tj|�d|_|_d|_d|_|_dS)N��
�d)rrz�maxlist�maxtuple�maxdict�	maxstring�maxother)r>rrrrz�s
zHTMLRepr.__init__cCst|dddddd�S)N�&z&amp;�<z&lt;�>z&gt;)r/)r>r.rrr�escape�szHTMLRepr.escapecCstj||�S)N)rr�)r>rrrrr��sz
HTMLRepr.reprcCsZtt|�d�r@ddjt|�jj��}t||�r@t||�||�S|jttt	|��|j
��S)Nr%�repr_r_)rcr�r!r%rr<r�r3r5r�r�)r>rN�level�
methodnamerrr�repr1�s

zHTMLRepr.repr1cCs^t||j�}t|�}d|krJdt|dd�krJd|d|j|�|dStjdd|j|��S)Nr�z\\r�rrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z<font color="#c040c0">\1</font>)r3r�r�r/r�rr)r>rNr��test�testreprrrr�repr_string�szHTMLRepr.repr_stringcCs8y|jttt|��|j��S|jd|jj�SdS)Nz
<%s instance>)r�r3r5r�r��	__class__r%)r>rNr�rrr�
repr_instance�szHTMLRepr.repr_instanceN)r%r&r[rUrzr�r�r�r��repr_strr�Zrepr_unicoderrrrr��sr�c@seZdZdZe�ZejZejZdd�Zd5dd�Z	d6d
d�Z
dd
�Zdd�Zd7dd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdiiifdd �Zd8d!d"�Zd9d#d$�Zddiifd%d&�Zd'd(�Zddiiidfd)d*�Zd+d,�Zd:d-d.�Zd;d/d0�Zd<d1d2�Zd=d3d4�ZdS)>�HTMLDocz'Formatter class for HTML documentation.cCsd||fS)zFormat an HTML page.z�<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
%s
</body></html>r)r>�title�contentsrrr�page�szHTMLDoc.pagercCsd|||||pdfS)zFormat a page heading.a'
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="%s">
<td valign=bottom>&nbsp;<br>
<font color="%s" face="helvetica, arial">&nbsp;<br>%s</font></td
><td align=right valign=bottom
><font color="%s" face="helvetica, arial">%s</font></td></tr></table>
    z&nbsp;r)r>r��fgcol�bgcolZextrasrrr�heading�s	zHTMLDoc.heading�N�&nbsp;c	
Cs^|dkrdd|d}d|||f}	|r@|	d||||f}	n|	d|||f}	|	d|S)	z Format a section with a heading.Nz<tt>z&nbsp;z</tt>z�<p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="%s">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="%s" face="helvetica, arial">%s</font></td></tr>
    zR
<tr bgcolor="%s"><td rowspan=2>%s</td>
<td colspan=2>%s</td></tr>
<tr><td>%s</td>z(
<tr><td bgcolor="%s">%s</td><td>%s</td>z'
<td width="100%%">%s</td></tr></table>r)
r>r�r�r�r��widthZpreludeZ
marginaliaZgaprrrr�section�szHTMLDoc.sectioncGsd|}|j|f|��S)z$Format a section with a big heading.z<big><strong>%s</strong></big>)r)r>r�r�rrr�
bigsection	szHTMLDoc.bigsectionc
Cs&|j|j��}t|dddddddd�	S)z!Format literal preformatted text.z

z
 
r�z&nbsp;rz<br>
)r��
expandtabsr/)r>r.rrr�	preformatszHTMLDoc.preformatrcCs�d}t|�|d|}xht|�D]\}|dd|}x>t|||||�D]$}|t|�krN||||�d}qNW|d}q"Wd|S)z0Format a list of items into a multi-column list.rrz<td width="%d%%" valign=top>r�z<br>
z</td>z7<table width="100%%" summary="list"><tr>%s</tr></table>)r �range)r>�list�formatZcolsr�rows�colrlrrr�multicolumnszHTMLDoc.multicolumncCsd|S)Nz<font color="#909090">%s</font>r)r>r.rrr�grey szHTMLDoc.greycGs*x$|D]}||krd|||fSqW|S)z:Make a link for an identifier, given name-to-URL mappings.z<a href="%s">%s</a>r)r>r(Zdicts�dictrrr�namelink"s
zHTMLDoc.namelinkcCsN|jtjj|j�}}t||�rDt||�|krDd|j|t||�fSt||�S)zMake a link for a class.z<a href="%s.html#%s">%s</a>)r%rr�ror&rcr<r))r>rr'r(r�rrr�	classlink)s
zHTMLDoc.classlinkcCsd|j|jfS)zMake a link for a module.z<a href="%s.html">%s</a>)r%)r>rrrr�
modulelink1szHTMLDoc.modulelinkcCsR|\}}}}|r|j|�S|r,d||f}nd|}|rBd|}n|}d||fS)z;Make a link for a module or package to display in an index.z
%s.%s.htmlz%s.htmlz"<strong>%s</strong>&nbsp;(package)z<a href="%s">%s</a>)r)r>Z
modpkginfor(rr}�shadowed�urlr.rrr�
modpkglink5s

zHTMLDoc.modpkglinkcCsd||fS)zMake a link to source file.z<a href="file:%s">%s</a>r)r>rrrrr�filelinkDszHTMLDoc.filelinkcCs�|p|j}g}d}tjd�}�xL|j||�}	|	s2P|	j�\}
}|j||||
���|	j�\}}
}}}}|
r�||�jdd�}|jd||f�n�|r�dt|�}|jd|||�f�n�|r�dt|�}|jd|||�f�n�|�r$|||d�d	k�r|jd
|j	||��n|jd|�n@|||d�d	k�rR|j|j	||||��n|j|j	||��|}q W|j|||d���d
j
|�S)z�Mark up some plain text, given a context of symbols to look for.
        Each context dictionary maps object names to anchor names.rzD\b((http|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?(\w+))�"z&quot;z<a href="%s">%s</a>z'http://www.rfc-editor.org/rfc/rfc%d.txtz(http://www.python.org/dev/peps/pep-%04d/r�(zself.zself.<strong>%s</strong>Nr)r�r�compile�search�spanr
�groupsr/�intrr!)r>r.r��funcs�classesrFrh�here�pattern�match�start�endrd�schemeZrfcZpepZselfdotr(rrrr�markupHs<

zHTMLDoc.markupc
Cs�d}x�|D]�}t|�tf�kr�|\}}|d}||j||�}|r�||fkr�g}x|D]}	|j|j|	|��qVW|ddj|�d}|d}q
t|�tg�kr
|d|j|||�}q
Wd|S)	zAProduce HTML for a class tree as given by inspect.getclasstree().rz"<dt><font face="helvetica, arial">rz, �)z
</font></dt>z
<dd>
%s</dd>
z
<dl>
%s</dl>
)r�rr
r!�
formattree)
r>�treer'�parentr�entry�c�bases�parentsrIrrrr(ss 


zHTMLDoc.formattreec#s�|j}y
|j}Wntk
r(d}YnX|jd�}g}x@tt|�d�D],}|jddj|d|d��||f�qJWdj||d.d��}	d|	}
y&tj	|�}t
jj|�}�j
||�}
Wntk
r�d}
YnXg}t|d��r:t|j�}|dd�d/k�r&|d0d�d	k�r&|dd1�j�}|jd�j|��t|d��r\|j�jt|j���|�rt|
d
dj|�}
�j|�}|dk	�r�dt�}nd}�j|
ddd|
|�}tj|tj�}gi}}xltj|tj�D]Z\}}|dk	�stj|��p�||k�r�t|||��r�|j||f�d|||<||<�q�Wx�|D]�\}}xx|jD]n}|j|j}}tj j!|�}||k�rL|�rLt||��rLt"||�|k�rL||k�rL|d|||<||<�qLW�q<Wgi}}x�tj|tj#�D]p\}}|dk	�stj$|��stj|�|k�r�t|||��r�|j||f�d|||<tj%|��r�||||<�q�Wg}x6tj|t&�D]&\}}t|||��rd|j||f��qdW�j't(|��j)||�}|�o�d|}|d|}t|d��r*g}x.t*j+|j,�D]\}}} |j||| df��q�W|j-��j.|�j/�}!|�j0ddd|!�}n.|�rX�j.|�fdd��}!|�j0ddd|!�}|�r�d d!�|D�}"�j1tj2|"d�|�g}!x*|D]"\}}|!j�j3|||||���q�W|�j0d"dd#d$j|!��}|�rg}!x*|D]"\}}|!j�j3|||||���q�W|�j0d%dd&d$j|!��}|�rbg}!x$|D]\}}|!j�j3||���q(W|�j0d'dd(d)j|!��}t|d*��r��j't|j4��j)�}!|�j0d+dd|!�}t|d,��rʈj't|j5��j)�}!|�j0d-dd|!�}|S)2z/Produce HTML documentation for a module object.Nrrz5<a href="%s.html"><font color="#ffffff">%s</font></a>z)<big><big><strong>%s</strong></big></big>z
(built-in)r]��$z
Revision: z
version %srTz (%s)z, z-<br><a href="%(docloc)s">Module Reference</a>rz#ffffffz#7799eez<a href=".">index</a><br>r~z.html#z#-z<tt>%s</tt>z
<p>%s</p>
rZrzPackage Contentsz#aa55cccs�j|d�S)Nr)r)�t)r>rrrr�sz#HTMLDoc.docmodule.<locals>.<lambda>�ModulescSsg|]\}}|�qSrr)rkrGrHrrrr��sz%HTMLDoc.docmodule.<locals>.<listcomp>ZClassesz#ee77aar�Z	Functionsz#eeaa77ZDataz#55aa55z<br>
rPZAuthorrSZCreditsr�z$Revision: r�r�)6r%�__all__r�rrr r
r!rr��urllib�parseZquoterrtrc�strr]rr�rTr��localsrr@r*r+�	getmodulererAr&rr�ror<r,r8r6r-r&rr�pkgutil�iter_modulesrZrur
rrr(�getclasstreer�rPrS)#r>rr(�mod�ignoredrd�partsZlinksrlZ
linkedname�headrrrr��versionr�rr�rZcdictrGrHrIr'r�rZfdict�datar"�modpkgs�importer�ispkgr��	classlistr)r>rr��s�


&


$




$

zHTMLDoc.docmodulecs�j}|p|}�j}g}	|	j�G�fdd�d�}
|
��ttj���}t|�dkr��j��d�x"|D]}�d�j|�j	��qfW�d���������fdd�}
����fd	d
�}��������fdd�}�fd
d�t
��D�}i�xv|D]n\}}}}d|d|�|<}yt�|�}Wntk
�r:YnXy|�|<Wq�t
k
�r^Yq�Xq�Wx�|�rb|�r||j��n|dd�t|�fdd��\}}�tjk�r�|}�qfn"��k�r�d}nd�j��j	�}|d7}t|��|
d||dd��}|
d||dd��}|
d||dd��}|d||dd��}|d||d d��}|gk�sZt�|}�qfWd!j|	�}	||k�r�d"||f}nd#|||f}|�r�g}x"|D]}|j�j|�j	���q�W|d$d%j|�}�jt���j����}|�o�d&|}�j|d'd(|	d)|�S)*z.Produce HTML documentation for a class object.cs eZdZdd�Z�fdd�ZdS)z(HTMLDoc.docclass.<locals>.HorizontalRulecSs
d|_dS)Nr)�needone)r>rrrrzsz1HTMLDoc.docclass.<locals>.HorizontalRule.__init__cs|jr�d�d|_dS)Nz<hr>
r)rF)r>)�pushrr�maybe
sz.HTMLDoc.docclass.<locals>.HorizontalRule.maybeN)r%r&r[rzrHr)rGrr�HorizontalRule
srIrz&<dl><dt>Method resolution order:</dt>
z<dd>%s</dd>
z</dl>
cs�t||�\}}|r��j��|�xl|D]d\}}}}yt�|�}Wn&tk
rh��j||���YnX��j||��������d�q(W|S)Nr)rOrHr<�	Exception�_docdescriptorr�)�msgrvrK�okr(ri�homeclsrH)rr�hr�mdictr<rrGr>rr�spillszHTMLDoc.docclass.<locals>.spillcsNt||�\}}|rJ�j��|�x&|D]\}}}}��j||���q(W|S)N)rOrHrK)rLrvrKrMr(rirNrH)rOr<rGr>rr�spilldescriptors/sz*HTMLDoc.docclass.<locals>.spilldescriptorsc
s�t||�\}}|r��j��|�x�|D]�\}}}}�jt�|�|��}t|�sZtj|�rht|dd�}	nd}	|	dkr��d|�n0�jt|��j	����}	d|	}	�d||	f��d�q(W|S)NrUz<dl><dt>%s</dl>
z<dd><tt>%s</tt>z<dl><dt>%s%s</dl>
r)
rOrHr�r<�callablerrgr&rr)
rLrvrKrMr(rirNrHrIr")rrrOrPr<rrGr>rr�	spilldata8s"
z#HTMLDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qS))r9)re)rkr(rirjrH)rrrr�Ms
z$HTMLDoc.docclass.<locals>.<listcomp>r~�-rcs|d�kS)Nrr)r1)�	thisclassrrrrfsz"HTMLDoc.docclass.<locals>.<lambda>zdefined herezinherited from %sz:<br>
z
Methods %scSs|ddkS)Nr�methodr)r1rrrrrvszClass methods %scSs|ddkS)Nrzclass methodr)r1rrrrrxszStatic methods %scSs|ddkS)Nrz
static methodr)r1rrrrrzszData descriptors %scSs|ddkS)Nrzdata descriptorr)r1rrrrr|szData and other attributes %scSs|ddkS)NrrAr)r1rrrrr~srz*<a name="%s">class <strong>%s</strong></a>z/<strong>%s</strong> = <a name="%s">class %s</a>z(%s)z, z<tt>%s<br>&nbsp;</tt>z#000000z#ffc8d8r0)r%rAr
rr�getmror rHrr&rfr<rJrt�popleftrO�builtinsrrw�AssertionErrorr!r&rrr)r>rr(r<rrr=�realnamer-r�rI�mrorIrQrRrTrvrGrirNrH�anchor�	inherited�tagr�r.r"r)	rrrOrPr<rrGr>rVrr��s�

	



















zHTMLDoc.docclasscCs|jd|j|��S)z)Format an argument default value as text.�=)rr�)r>rrrr�formatvalue�szHTMLDoc.formatvaluecCs�|j}|p|}|r|jpdd|}	d}
d}t|�r�|jj}|rZ||k	r�d|j||�}
n0|jdk	rzd|j|jj|�}
nd|j||�}
||kr�d|	|f}
nD|r�tj||g�|kr�d	|jd||f}d
}n|}d|	||f}
d}tj|��rNytj|�}Wnt	t
fk
�r d}YnX|�rNt|�}|dk�rNd
|}
|d
d�}|�sXd}|
|j|�|
�ov|j
d|
�}|�r�d|S|jt|�|j|||�}|�o�d|}d||fSdS)z;Produce HTML documentation for a function or method object.rrUrz from Nz method of %s instancez unbound %s methodz$<a name="%s"><strong>%s</strong></a>z<a href="#%s">%s</a>rz)<a name="%s"><strong>%s</strong></a> = %sz<lambda>z$<strong>%s</strong> <em>lambda</em> z(...)z'<font face="helvetica, arial">%s</font>z<dl><dt>%s</dt></dl>
z<dd><tt>%s</tt></dd>z<dl><dt>%s</dt>%s</dl>
r�)r%r?r;r�rr�getattr_staticr,�	signature�
ValueErrorrtr6r�rr&rr)r>rr(r<rrrFrEr\r^�note�skipdocs�imclassr�Zreallink�argspecrd�declr"rrrr��sX


zHTMLDoc.docroutinecCsTg}|j}|r|d|�|jdk	rB|jt|�|j�}|d|�|d�dj|�S)Nz!<dl><dt><strong>%s</strong></dt>
z<dd><tt>%s</tt></dd>
z</dl>
r)r
rUr&rrr!)r>r(rHr<rhrGr"rrrrK�s
zHTMLDoc._docdescriptorcCs|j|||�S)z*Produce html documentation for a property.)rK)r>rr(r<rErrrr��szHTMLDoc.docpropertycGs|rd|pd}||j|�S)z-Produce HTML documentation for a data object.z<strong>%s</strong> = r)r�)r>rr(r<r=Zlhsrrrr��szHTMLDoc.docothercCs|j|||�S)z1Produce html documentation for a data descriptor.)rK)r>rr(r<rErrrr��szHTMLDoc.docdatacCs�g}|dkri}xLtj|g�D]<\}}}tdd�|D��r<q|j|d|||kf�d||<qW|j�|j||j�}|j|dd|�S)z2Generate an HTML index for a directory of modules.Ncss*|]"}dt|�kodknVqdS)i�i��N)�ord)rk�chrrr�	<genexpr>�sz HTMLDoc.index.<locals>.<genexpr>rrz#ffffffz#ee77aa)r9r:�anyr
rur
rr)r>rrrBrCr(rDr�rrr�index�sz
HTMLDoc.index)r)rrNr)r)N)NN)NNN)NN)NNN)N)r%r&r[rUr��_repr_instancer�r�r�rrrrr
rrrrrrr&r(r�r�rbr�rKr�r�r�rorrrrr��s<



+

y:


r�c@s4eZdZdZdd�Zdd�Zdd�ZeZdd	�Zd
S)�TextReprzAClass for safely making a text representation of a Python object.cCs,tj|�d|_|_d|_d|_|_dS)Nr�r�r�)rrzr�r�r�r�r�)r>rrrrzs
zTextRepr.__init__cCsTtt|�d�r@ddjt|�jj��}t||�r@t||�||�Sttt|��|j	�S)Nr%r�r_)
rcr�r!r%rr<r3r5r�r�)r>rNr�r�rrrr�s

zTextRepr.repr1cCsHt||j�}t|�}d|krDdt|dd�krDd|d||dS|S)Nr�z\\rr�r)r3r�r�r/)r>rNr�r�r�rrrr�
s
zTextRepr.repr_stringc
Cs,yttt|��|j�Sd|jjSdS)Nz
<%s instance>)r3r5r�r�r�r%)r>rNr�rrrr�szTextRepr.repr_instanceN)	r%r&r[rUrzr�r�r�r�rrrrrq�s	rqc@s�eZdZdZe�ZejZdd�Zddd�Zdd�Z	ddd�Z
dd
d�Zd dd�Zdd�Z
d!dd�Zdd�Zd"dd�Zd#dd�Zd$dd�Zd	S)%�TextDocz'Formatter class for text documentation.cCsdjdd�|D��S)z(Format a string in bold by overstriking.rcss|]}|d|VqdS)�Nr)rkrlrrrrm(szTextDoc.bold.<locals>.<genexpr>)r!)r>r.rrr�bold&szTextDoc.bold�    cs>|sdS�fdd�|jd�D�}|r4|dj�|d<dj|�S)z6Indent text by prepending a given prefix to each line.rcsg|]}�|�qSrr)rkr�)�prefixrrr�-sz"TextDoc.indent.<locals>.<listcomp>rrr�r�)rrr!)r>r.rvr#r)rvr�indent*szTextDoc.indentcCs$|j|�j�}|j|�d|dS)z&Format a section with a given heading.rz

)rwrrt)r>r�r�Zclean_contentsrrrr1szTextDoc.sectionNrc
s�d}x�|D]�}t|�tf�krt|\}}||t|��}|rj||fkrj�fdd�|D�}	|ddj|	�}|d}q
t|�tg�kr
||j|�||d�}q
W|S)zBRender in text a class tree as returned by inspect.getclasstree().rc3s|]}t|��VqdS)N)r))rkr,)r'rrrm@sz%TextDoc.formattree.<locals>.<genexpr>z(%s)z, rz    )r�r)r!r()
r>r)r'r*rvrr+r,r-r.r)r'rr(8s

zTextDoc.formattreecCsD|j}tt|��\}}|jd||o(d|�}t|dd�}|j|�}|dk	r`||jd|d�}|rt||jd|�}g}	xNtj|tj�D]<\}
}|dk	s�tj	|�p�||kr�t
|
||�r�|	j|
|f�q�Wg}xXtj|tj�D]F\}
}|dk	�stj
|��stj	|�|kr�t
|
||�r�|j|
|f�q�Wg}
x6tj|t�D]&\}
}t
|
||��r8|
j|
|f��q8Wg}t�}t|d��r�xFtj|j�D]6\}}}|j|�|�r�|j|d	�n
|j|��q�W|j�||jd
dj|��}g}xBtj|tj�D]0\}
}|jj|d��r�|
|k�r�|j|
��q�W|�rJ|j�||jd
dj|��}|	�r�dd�|	D�}|jtj|d�|�g}x&|	D]\}
}|j|j||
|���qzW||jddj|��}|�r�g}x&|D]\}
}|j|j||
|���q�W||jddj|��}|
�rFg}x*|
D]"\}
}|j|j||
|dd���q
W||jddj|��}t|d��r�t|j�}|dd�d#k�r�|d$d�dk�r�|dd%�j�}||jd|�}t|d��r�||jdt|j ��}t|d��r�||jdt|j!��}t|d��r||jd t|j"��}ytj#|�}Wnt$k
�r.d!}YnX||jd"|�}|S)&z5Produce text documentation for a given module object.�NAMEz - r3NzMODULE REFERENCEa.

The following documentation is automatically generated from the Python
source files.  It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations.  When in doubt, consult the module reference at the
location listed above.
ZDESCRIPTIONrZz
 (package)zPACKAGE CONTENTSrrZ
SUBMODULEScSsg|]\}}|�qSrr)rkrGrHrrrr��sz%TextDoc.docmodule.<locals>.<listcomp>r�CLASSES�	FUNCTIONS�F)r2ZDATAr]r/r0z
Revision: �VERSIONrTZDATErPZAUTHORrSZCREDITSz
(built-in)ZFILEz$Revision: r�r�)%r%r$rrr<r�rr@r+r8rer
r,r8r-�setrcr9r:rZ�addrur!r*rar(r;r�r�r6r]rrTrPrSr�rt)r>rr(r<Zsynop�descrrdr�rrGrHrrArBZ
modpkgs_namesrCr'rDZ
submodulesrEr�r@r�rrrr�Hs�





$
zTextDoc.docmodulecsf�j}|p|}�j}�jfdd�}||kr:d�j|�}n�j|�d|}|rlt||�}	|ddj|	�}t��}
|
r�|
dgp�g}|j�tt	j
���}t|�dkrԈd	�x|D]}
�d
||
��q�W�d�G�fdd
�d
�}|�������fdd�}����fdd�}�����fdd�}�fdd�t��D�}x�|�r0|�rT|j
��n|dd�t|�fdd��\}}�tjk�r�|}�q>n ��k�r�d}ndt��j�}t|��|d||dd��}|d||dd��}|d||d d��}|d!||d"d��}|d#||d$d��}|gk�s(t�|}�q>Wdj|�}|�sJ|dS|d�j|j�d%�dS)&z4Produce text documentation for a given class object.cSs
t||�S)N)r))r,r�rrr�makename�sz"TextDoc.docclass.<locals>.makenamezclass z	 = class z(%s)z, rrzMethod resolution order:z    rcs eZdZdd�Z�fdd�ZdS)z(TextDoc.docclass.<locals>.HorizontalRulecSs
d|_dS)Nr)rF)r>rrrrz�sz1TextDoc.docclass.<locals>.HorizontalRule.__init__cs|jr�dd�d|_dS)NrUr{r)rF)r>)rGrrrH�sz.TextDoc.docclass.<locals>.HorizontalRule.maybeN)r%r&r[rzrHr)rGrrrI�srIcs�t||�\}}|r��j��|�x^|D]V\}}}}yt�|�}Wn&tk
rh��j||���Yq(X��j||����q(W|S)N)rOrHr<rJrKr�)rLrvrKrMr(rirNrH)rOr<rrGr>rrrQ�szTextDoc.docclass.<locals>.spillcsNt||�\}}|rJ�j��|�x&|D]\}}}}��j||���q(W|S)N)rOrHrK)rLrvrKrMr(rirNrH)rOr<rGr>rrrR�sz*TextDoc.docclass.<locals>.spilldescriptorsc
s�t||�\}}|r��j��|�x~|D]v\}}}}t|�sFtj|�rPt|�}nd}yt�|�}	Wntk
r�|j|}	YnX��j	|	|�d|d�d�q(W|S)Nr{)r2r"r)
rOrHrSrrgrr<r��__dict__r�)
rLrvrKrMr(rirNrHr"r9)rOr<rrGr>rrrT�s
z#TextDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qS))r9)re)rkr(rirjrH)rrrr�s
z$TextDoc.docclass.<locals>.<listcomp>rcs|d�kS)Nrr)r1)rVrrrr	sz"TextDoc.docclass.<locals>.<lambda>zdefined herezinherited from %szMethods %s:
cSs|ddkS)NrrWr)r1rrrrrszClass methods %s:
cSs|ddkS)Nrzclass methodr)r1rrrrrszStatic methods %s:
cSs|ddkS)Nrz
static methodr)r1rrrrrszData descriptors %s:
cSs|ddkS)Nrzdata descriptorr)r1rrrrrszData and other attributes %s:
cSs|ddkS)NrrAr)r1rrrrr sz |  )r%rAr&rt�mapr!rr
rrrXr rfrYrOrZrr)rwr[rwr)r>rr(r<r=r\r-r�r�r.r"r�r]rIrIrQrRrTrvr_r`r)rOr<rrGr>rVrr��sn

	
















zTextDoc.docclasscCsd|j|�S)z)Format an argument default value as text.ra)r�)r>rrrrrb*szTextDoc.formatvaluecCsr|j}|p|}d}d}t|�rn|jj}|rB||k	rndt||�}n,|jdk	r`dt|jj|�}ndt||�}||kr�|j|�}	n,|r�tj||g�|kr�d}|j|�d|}	d}
tj|��rytj	|�}Wnt
tfk
r�d}YnX|�rt|�}
|d	k�r|j|�d
}	|
dd
�}
|
�s&d}
|	|
|}|�r@|dSt
|��pLd}
|d|
�oj|j|
�j�dSdS)z;Produce text documentation for a function or method object.rrz from Nz method of %s instancez unbound %s methodrz = z<lambda>z lambda z(...)rr�)r%r?r;r�r)rtrrcr,rdrertr6rrwr)r>rr(r<rEr\rfrgrhr�rirdrjr"rrrr�.sH


zTextDoc.docroutinecCsTg}|j}|r$||j|��|d�t|�p.d}|rJ||j|��|d�dj|�S)Nrr)r
rtrrwr!)r>r(rHr<rhrGr"rrrrK_szTextDoc._docdescriptorcCs|j|||�S)z*Produce text documentation for a property.)rK)r>rr(r<rErrrr�lszTextDoc.docpropertycCs|j|||�S)z1Produce text documentation for a data descriptor.)rK)r>rr(r<rErrrr�pszTextDoc.docdatac
Cs�|j|�}|rF|r|dpd|}|t|�}	|	dkrF|d|	�d}|rX|j|�dpZd|}|dk	r~|d|jt|��7}|S)z-Produce text documentation for a data object.z = rrNz...r)r�r rtrwr6)
r>rr(r<r*r2r"r�r�Zchoprrrr�ts
zTextDoc.docother)ru)Nr)NN)NN)NNN)NNN)NNN)NNNNN)r%r&r[rUrqrpr�rtrwrr(r�r�rbr�rKr�r�r�rrrrrrs


e
}
1

rrc@seZdZdZdd�ZdS)�
_PlainTextDocz2Subclass of TextDoc which overrides string stylingcCs|S)Nr)r>r.rrrrt�sz_PlainTextDoc.boldN)r%r&r[rUrtrrrrr��sr�cCst�at|�dS)zCThe first time this is called, determine what kind of pager to use.N)�getpager�pager)r.rrrr��sr�cs<ttjd�stSttjd�s tStjj�s8tjj�r<tStjjd�pRtjjd���r�tj	dkrn�fdd�Stjjd�dkr��fd
d�S�fdd�Stjjd�dkr�tStj	dkr�dd�Sttd
�r�tj
d�dkr�dd�Sddl}|j�\}}tj
|�z0ttd
��r$tj
d|�dk�r$dd�StSWdtj|�XdS)z2Decide what method to use for paging through text.�isattyZMANPAGERZPAGERZwin32cstt|���S)N)�
tempfilepager�plain)r.)�	use_pagerrrrr�szgetpager.<locals>.<lambda>ZTERM�dumb�emacscstt|���S)N)�	pipepagerr�)r.)r�rrrr�scs
t|��S)N)r�)r.)r�rrrr�scSstt|�d�S)Nzmore <)r�r�)r.rrrrr�s�systemz(less) 2>/dev/nullrcSs
t|d�S)NZless)r�)r.rrrrr�sNz	more "%s"cSs
t|d�S)NZmore)r�)r.rrrrr�s)r�r�)r�r�)rcr�stdin�
plainpager�stdoutr�r	r�ro�platformr��tempfileZmkstemp�close�ttypager�unlink)r��fdr�r)r�rr��s6


 r�cCstjdd|�S)z%Remove boldface formatting from text.z.r)rr)r.rrrr��sr�c Cs�ddl}|j|d|jd�}yDtj|jdd��*}y|j|�Wntk
rPYnXWdQRXWntk
rrYnXx(y|j	�PWqvtk
r�YqvXqvWdS)z3Page through text by feeding it to another program.rNT)�shellr��backslashreplace)�errors)
�
subprocess�Popen�PIPE�io�
TextIOWrapperr��write�KeyboardInterruptr��wait)r.�cmdr��proc�piperrrr��s r�cCs`ddl}|j�}t|ddd��}|j|�WdQRXztj|d|d�Wdtj|�XdS)z<Page through text by invoking a program on a temporary file.rN�wr�)r�z "r)r�Zmktempr�r�r	r�r�)r.r�r�r�r�rrrr��sr�cCs$ttjdd�pd}|j|d�j|�S)N�encodingzutf-8r�)r<rr��encode�decode)r.r�rrr�_escape_stdout�sr�c
Cs�tt|��jd�}y2ddl}tjj�}|j|�}|j|�dd�}Wn(t	t
tjfk
rld}dd�}YnX�z2yt
tjjdd��}Wntk
r�d}YnX|dkr�d	}|d}}tjjdj|d|��d�x�||d��r�tjjd
�tjj�|�}	|	dk�rtjjd
�Pn,|	dk�rJtjjd
||d�|d}q�|	dk�rn|||}|dk�rnd}tjjddj||||��d�||}q�WWd|�r�|j||j|�XdS)z%Page through text on a text terminal.rrNcSstjjd�S)Nr)rr�r�rrrrrr�szttypager.<locals>.<lambda>cSstjj�dd�dd�S)Nrr�)rr�r�rrrrrr�sZLINESr�z
-- more --�q�Qz
          
�
�b�B�)r�r�)r�r)r�r�r�)r�r�r�ttyrr��filenoZ	tcgetattrZ	setcbreakr�r�r��UnsupportedOperationrr	r�rorer�r�r!�flushZ	tcsetattrZ	TCSAFLUSH)
r.r#r�r��oldZgetchar�hr�Zincr,rrrr��sL








&r�cCstjjtt|���dS)z>Simply print unformatted text.  This is the ultimate fallback.N)rr�r�r�r�)r.rrrr�sr�cCs�tj|�r>|jtjkr d|jSt|d�r4d|jSd|jStj|�rRd|jStj|�rtd|jj	|jj|jfStj
|�r�d|jj	|jj|jfStj|�r�d|jStj|�r�d	|jStj
|�r�d
|jSt|�jS)z/Produce a short description of the given thing.zbuilt-in module rZzpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%szclass z	function zmethod )rr*r%rr�rcr8r��__objclass__r&r�r+r6r7r�)�thingrrr�describe
s.
















r�cCs�dd�|jd�D�}d\}}xB|t|�kr^tdj|d|d��|�}|rZ||d}}qPqW|rj|}nt}x8||d�D](}yt||�}Wq|tk
r�dSXq|W|S)z@Locate an object by name or dotted path, importing as necessary.cSsg|]}|r|�qSrr)rkr�rrrr�'szlocate.<locals>.<listcomp>rNrr)Nr)rr r�r!rZr<r�)rr�r>r��nZ
nextmodulerr�rrr�locate%s 
r�cCsVt|t�r0t||�}|dkr(td|��||fSt|dd�}|t|t�rL|ndfSdS)zDGiven an object or a path to an object, get the object and its name.Nz~No Python documentation found for %r.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.r%)r�r6r�r�r<)r�r�rr(rrr�resolve>s


r�� Python Library Documentation: %scCs�|dkrt}t||�\}}t|�}tj|�}|rTd|krT|d|d|jd��7}n|rn||k	rn|d|j7}tj|�p�tj|�p�tj	|�p�tj
|�p�tj|�p�t|t
�s�t|�}|d7}||d|j||�S)zBRender text documentation, given an object or a path to an object.Nrz in z in module z objectz

)r.r�r�rr8�rfindr%r*r+r,r�r�r�r�r�r�)r�r�r�Zrendererrr(rr�rrr�
render_docLs$






r�cCsfy2|dkrtt|||��n|jt|||t��Wn.ttfk
r`}zt|�WYdd}~XnXdS)zCDisplay text documentation, given an object or a path to an object.N)r�r�r��	plaintextr�r��print)r�r�r��outputrHrrrr"esr"cCs�y`t||�\}}tjt|�tj||��}t|dddd��}|j|�WdQRXtd|d�Wn.tt	fk
r�}zt|�WYdd}~XnXdS)z<Write HTML documentation to a file in the current directory.z.htmlr�zutf-8)r�NZwrote)
r��htmlr�r�r�r�r�r�r�r�)r�r�rr(r�r�rHrrr�writedocpsr�rcCs6|dkri}x$tj|g|�D]\}}}t|�qWdS)zAWrite out HTML documentation for all modules in a directory tree.N)r9�
walk_packagesr�)r�pkgpath�donerCr'rDrrr�	writedocs{s
r�cJ@s�eZdZdddddd�d�d�d�d�d�d
d�ddd�dd�d�d�d�dd�d�ddd�d�d��d�d�d�dd&�!Zd'd(��dD�Z�de��d�d�d�d	�d
�ddS�ZdTdUdVdWdXdYdZd[d\d]d^d_d_d`d`da�ZxPej�D]D\ZZ	x8e	D]0Z
eje
e�Zeek�r�edbeZeee
<�q�W�q�W�d�d
�d�d�d�d�d�d�d�ddv�d�d�d�ddd�d�d�d�d�dd�dd�d��d �d!�d"�d#�d$�d%�d&�d'�d(�d)�d*d�d��d+�d,�d-�d.�d/�d0d��d1�d2�d3�d4�d5�d6�d7�d8�d9�d:�d;�d<�d=�d>�d?�d@d�dA�dBdd!dd
�dC�dD�dE�dFdʜIZ�dGd�d̈́Z
ed�dτ�Zed�dτ�Zd�d҄Ze�Zefd�dԄZd�dքZd�d؄Zd�dڄZd�d܄Z�dHd�d�Zd�d�Zd�d�Zd�d�Z�dId�d�Z�dJd�d�Zd�d�Z�dKd�d�Z d�S(L�Helperr�BOOLEAN�with�assert�break�	while for�class�CLASSES SPECIALMETHODS�continue�function�del�BASICMETHODS�if�else�try�for�break continue while�import�global�nonlocal NAMESPACES�
TRUTHVALUE�MODULES�in�SEQUENCEMETHODS�
COMPARISON�lambdarz�nonlocal�global NAMESPACES�pass�raise�
EXCEPTIONS�return�while�break continue if TRUTHVALUE� CONTEXTMANAGERS EXCEPTIONS yield�yield)!�False�None�True�and�asr�r�r�r��defr��elifr��except�finallyr��fromr�r�r�r��isr�r��not�orr�r�r�r�r�r�r�cCsg|]}dD]}||�qqS)�'r)r�rr)rk�pr�rrrr��szHelper.<listcomp>r��fr��ur��'''r�"""�+rU�*�**r��//�%�<<�>>r��|�^�~r�r��<=�>=�==�!=�<>�+=�-=�*=�/=�%=�&=�|=�^=�<<=�>>=�**=�//=�j�J)�STRINGS�	OPERATORSr��UNARY�AUGMENTEDASSIGNMENT�BITWISE�COMPLEXzOPERATORS FORMATTING�POWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTS�ELLIPSISzSLICINGS DICTIONARYLITERALSz	def classr�PRIVATENAMESzPRIVATENAMES SPECIALMETHODSZ
BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)rz**�,rz...�:�@r�r_r^�`rr'�[�]r��types�RSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect�strings�4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES�string-methods�STRINGS FORMATTING�
formatstringsr�:encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPES�numbers�INTEGER FLOAT COMPLEX TYPES�integers�	int range�floating�
float math�	imaginary�
complex cmath�typesseq�$STRINGMETHODS FORMATTING range LISTS�DICTIONARIES�typesfunctions�	def TYPES�typesmethods�class def CLASSES TYPES�bltin-code-objects�compile FUNCTIONS TYPES�bltin-type-objects�types TYPES�TYPES�bltin-null-object�bltin-ellipsis-object�SLICINGS�specialattrs�!class SPECIALMETHODS PRIVATENAMES�typesmodules�operator-summary��lambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIES�EXPRESSIONS�objects�specialnames�bBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES�
customization�hash repr str SPECIALMETHODS�attribute-access�ATTRIBUTES SPECIALMETHODS�callable-types�CALLS SPECIALMETHODS�sequence-types�(SEQUENCES SEQUENCEMETHODS SPECIALMETHODS�MAPPINGS SPECIALMETHODS�
numeric-types�*NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS�	execmodel�%NAMESPACES DYNAMICFEATURES EXCEPTIONS�naming�3global nonlocal ASSIGNMENT DELETION DYNAMICFEATURES�dynamic-features�
NAMESPACESr��try except finally raise�conversions�identifiers�keywords SPECIALIDENTIFIERS�
id-classes�atom-identifiers�
atom-literals�=STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS�	SEQUENCES�	exprlists�TUPLES LITERALS�typesseq-mutable�LISTLITERALS�lists�LISTS LITERALS�typesmapping�DICTIONARYLITERALSr�DICTIONARIES LITERALS�attribute-references�(getattr hasattr setattr ATTRIBUTEMETHODS�
subscriptions�slicings�calls�power�unary�binary�shifting�bitwise�comparisons�EXPRESSIONS BASICMETHODS�booleans�EXPRESSIONS TRUTHVALUE�
assignmentr �	augassign�
NUMBERMETHODS�compound�for while break continue�truth� if while and or not BASICMETHODS�debugger�pdb�context-managers)IrGrZ
STRINGMETHODSZ
FORMATTING�UNICODEZNUMBERSZINTEGERZFLOATr"rmZMAPPINGSrzZMETHODSZCODEOBJECTSZTYPEOBJECTSZFRAMEOBJECTSZ
TRACEBACKSZNONEr$ZSPECIALATTRIBUTESryr�ZPACKAGESrPrZ
PRECEDENCEZOBJECTSZSPECIALMETHODSr�ZATTRIBUTEMETHODSZCALLABLEMETHODSr�ZMAPPINGMETHODSr�Z	EXECUTIONrdZDYNAMICFEATURESZSCOPINGZFRAMESr�ZCONVERSIONSZIDENTIFIERSZSPECIALIDENTIFIERSr%ZLITERALSZTUPLESZ
TUPLELITERALSZLISTSrqr>ruZ
ATTRIBUTESZ
SUBSCRIPTSrJZCALLSr#rZBINARYZSHIFTINGr!r�r�Z	ASSERTIONZ
ASSIGNMENTr ZDELETIONZ	RETURNINGZ	IMPORTINGZCONDITIONALZLOOPINGr�Z	DEBUGGINGZCONTEXTMANAGERSNcCs||_||_dS)N)�_input�_output)r>�inputr�rrrrz/szHelper.__init__cCs|jp
tjS)N)r�rr�)r>rrrrr3szHelper.<lambda>cCs|jp
tjS)N)r�rr�)r>rrrrr4scCs2tj�dddkr|�dSd|jj|jjfS)Nrr0�?rz<%s.%s instance>)r�stackr�r&r[)r>rrr�__repr__6s
zHelper.__repr__cCs6||jk	r|j|�n|j�|j�|jjd�dS)Na
You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type "help(object)".  Executing "help('string')"
has the same effect as typing a particular string at the help> prompt.
)�_GoInteractiver�intro�interactr�r�)r>�requestrrr�__call__>s
zHelper.__call__cCs�|jjd�x�y|jd�}|s PWnttfk
r<PYnX|j�}t|�dkr�|d|dkoldknr�|d|dd
�kr�|dd�}|j�dkr�P|d
kr�|j�q|j	|�qWdS)Nrzhelp> rrrr�rr��quitrr�)r�rr�r�)r�r�)
r�r��getliner��EOFErrorrr r�r�r)r>r�rrrr�Ks"
,
zHelper.interactcCs8|jtjkrt|�S|jj|�|jj�|jj�SdS)z.Read one line, using input() when appropriate.N)r�rr�r�r�r�r�)r>�promptrrrr�`s

zHelper.getlinecCs<t|�td�k�r|j�}|dkr,|j�n�|dkr>|j�n�|dkrP|j�n�|dkrb|j�n�|dd�dkr�|j|j�d�n�||jkr�|j|�nj|dkr�t	t
|�d�nR||jkr�|j|�n<||j
kr�|j|�n&|r�t	|d|jd
�nt	td|jd
�n$t|t��r|�nt	|d|jd
�|jjd�dS)Nr�keywords�symbols�topicsr��zmodules rr�r�r�zHelp on %s:)r�r)r�r�r�)r�r�listkeywords�listsymbols�
listtopics�listmodulesrr��
showsymbolr"�evalr��	showtopicr�r�r6r�r�r�r�)r>r�rrrris6






zHelper.helpcCs$|jjdjdtjdd���dS)Na�
Welcome to Python {0}'s help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/{0}/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".
z%d.%dr)r�r�r
rr�)r>rrrr�~szHelper.intror�Pc		Cs�tt|��}||}t|�|d|}x�t|�D]z}xht|�D]\}|||}|t|�kr@|jj||�||dkr@|jjdd|dt||��q@W|jjd�q2WdS)Nrr�r)r	�sortedr rr�r�)	r>�items�columnsrZcolwr�rowrrlrrrr	�s(zHelper.listcCs |jjd�|j|jj��dS)NzN
Here is a list of the Python keywords.  Enter any keyword to get more help.

)r�r�r	r�rD)r>rrrr��szHelper.listkeywordscCs |jjd�|j|jj��dS)Nzx
Here is a list of the punctuation symbols which Python assigns special meaning
to. Enter any symbol to get more help.

)r�r�r	r�rD)r>rrrr��szHelper.listsymbolscCs |jjd�|j|jj��dS)NzN
Here is a list of available topics.  Enter any topic name to get more help.

)r�r�r	r�rD)r>rrrr��szHelper.listtopicscCs,yddl}Wn tk
r,|jjd�dSX|jj||jj|��}|s`|jjdt|��dSt|�td�kr||j	||�S|\}}y|jj|}Wn(t
k
r�|jjdt|��dSX|j�d}|r�|p�dd|}|�r ddl}ddj
|j��d}	|j|	d	�}
|d
dj
|
�7}t|�dS)Nrzt
Sorry, topic and keyword documentation is not available because the
module "pydoc_data.topics" could not be found.
zno documentation found for %s
rrr�zRelated help topics: z, �Hz
%s
)�pydoc_data.topicsr�r�r�r�ror�r�r�r��KeyErrorr�textwrapr!rZwrapr�)r>�topic�
more_xrefs�
pydoc_data�target�label�xrefsr"r�r.Zwrapped_textrrrr��s6zHelper.showtopiccCs�yddl}Wntk
r dSX|jj||jj|��}|sDtd��t|t�rZ|j||�S|\}}|jj|}|r�|pxdd|}||fS)a*Return unbuffered tuple of (topic, xrefs).

        If an error occurs here, the exception is caught and displayed by
        the url handler.

        This function duplicates the showtopic method but returns its
        result directly so it can be formatted for display in an html page.
        rN�t
Sorry, topic and keyword documentation is not available because the
module "pydoc_data.topics" could not be found.
rzcould not find topicr�)r�r)	r�r�r�ror�rer�r6�	_gettopic)r>r�r�r�r�r�r�r"rrrr��s	
zHelper._gettopiccCs*|j|}|jd�\}}}|j||�dS)Nr�)r��	partitionr�)r>�symbolr�r�r_r�rrrr��s
zHelper.showsymbolcsv|r |jjdj|��t|�nR|jjd�i}|fdd���fdd�}t�j�|d�|j|j��|jjd�dS)	Nzy
Here is a list of modules whose name or summary contains '{}'.
If there are any, enter a module name to get more help.

zI
Please wait a moment while I gather a list of all available modules...

cSs>|r$|dd�dkr$|dd�d}|jd�dkr:d||<dS)	N�	z	.__init__z
 (package)rrri����i����)�find)rr'rr�rrr�callbacksz$Helper.listmodules.<locals>.callbackcs�d|d�dS)Nr)r')r�rr�onerrorsz#Helper.listmodules.<locals>.onerror)r�z�
Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".
)r�r�r
�apropos�
ModuleScanner�runr	rD)r>rGr�r�r)r�rr��s
zHelper.listmodules)r�r)r�r�)r�r�)r�r�)r�r)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�rz)r�r�)r�r)r�r�)r�rz)r�r�)r�r�)r�r�)r�r)r�r�r�r�)r�r�rr�)rrUrrr�rrrrr�rrr	r�r�r
rrr
r)r�r�r
rrr
r)rUr	)rrrrrrrrrrrr)rrr�rrr	)rr)r,r-)r.r/)r0r1)r2r)r.r3)r4r5)r6r7)r8r9)r:r;)r<r=)r?r@)rArB)rCrD)rErF)rHr)rIrJ)rKr)r,rL)rMr�)rNrO)rQrG)rRrS)rTrU)rVrW)rXrY)rZr[)rZr\)r]r^)r_r`)rarb)rcr)r�re)rfr)rgrh)rir)rjr)rkrl)rnro)rprq)rrrs)rtru)rrv)rwrx)ryr�)rzr�)r{rP)r|rP)r}rP)r~rP)rrP)r�rP)r�r�)r�r�)r�r )r�r�)r�r�)r�r�)r�r�)r�r�)NN)rr�)r)r)r)!r%r&r[r�Z_strprefixesZ_symbols_inverser�r�r�Zsymbols_r�ror�rzr�r�r�r�rr�r�r�r�rr�r	r�r�r�r�r�r�r�rrrrr��s6





	
 r�c@seZdZdZddd�ZdS)r�z7An interruptible scanner that searches module synopses.NcCs
|r|j�}d|_i}xztjD]p}|dkrd||<|dkrH|d|d�qt|�jpTd}|jd�d}|d|}|j�j|�dkr|d||�qW�xdtj	|d�D�]R\}	}}
|jr�P|dkr�|d|d�q�ytj
|	|�}Wntk
r�w�YnX|j}t
|d	��rny|j|�}
Wn&tk
�r:|�r4||�w�YnXttj|
���pNd}t
|d
��rh|j|�}nd}n^ytjj|�}Wn&tk
�r�|�r�||�w�YnX|j�r�|jj�dnd}t|dd�}|d|}|j�j|�dkr�||||�q�W|�r|�dS)NF�__main__rrrrz - )r��
get_source�get_filenamerV)r�r�rr�r�rUrr�r9r��	_get_specr�r�rcr�rJr�r��StringIOr�r�r�r�r�r�r<)r>r�rGZ	completerr��seenr'r(rrCrDr�r��sourcerr�rrrr�s`zModuleScanner.run)NNN)r%r&r[rUr�rrrrr�sr�cCsDdd�}dd�}tj��"tjd�t�j|||d�WdQRXdS)zAPrint all the one-line module summaries that contain a substring.cSs6|dd�dkr |dd�d}t||o.d|�dS)Nr�z	.__init__z
 (package)z- i����i����)r�)rr'rrrrr�Oszapropos.<locals>.callbackcSsdS)Nr)r'rrrr�Sszapropos.<locals>.onerror�ignore)r�N)�warnings�catch_warnings�filterwarningsr�r�)rGr�r�rrrr�Ms


r�cs�ddl�ddl�ddl�ddl�Gdd�d�jj��G�fdd�d�jj��G�����fdd�d�j�}|||�}|j�x|j	r�|j
r�tjd	�q~W|S)
a7Start an HTTP server thread on a specific port.

    Start an HTML/text server thread, so HTML or text documents can be
    browsed dynamically and interactively with a Web browser.  Example use:

        >>> import time
        >>> import pydoc

        Define a URL handler.  To determine what the client is asking
        for, check the URL and content_type.

        Then get or generate some text or HTML code and return it.

        >>> def my_url_handler(url, content_type):
        ...     text = 'the URL sent was: (%s, %s)' % (url, content_type)
        ...     return text

        Start server thread on port 0.
        If you use port 0, the server will pick a random port number.
        You can then use serverthread.port to get the port number.

        >>> port = 0
        >>> serverthread = pydoc._start_server(my_url_handler, port)

        Check that the server is really started.  If it is, open browser
        and get first page.  Use serverthread.url as the starting page.

        >>> if serverthread.serving:
        ...    import webbrowser

        The next two lines are commented out so a browser doesn't open if
        doctest is run on this module.

        #...    webbrowser.open(serverthread.url)
        #True

        Let the server do its thing. We just need to monitor its status.
        Use time.sleep so the loop doesn't hog the CPU.

        >>> starttime = time.time()
        >>> timeout = 1                    #seconds

        This is a short timeout for testing purposes.

        >>> while serverthread.serving:
        ...     time.sleep(.01)
        ...     if serverthread.serving and time.time() - starttime > timeout:
        ...          serverthread.stop()
        ...          break

        Print any errors that may have occurred.

        >>> print(serverthread.error)
        None
   rNc@seZdZdd�Zdd�ZdS)z!_start_server.<locals>.DocHandlercSsX|jjd�rd}nd}|jd�|jdd|�|j�|jj|j|j|�jd��dS)	z�Process a request from an HTML browser.

            The URL received is in self.path.
            Get an HTML page from self.urlhandler and send it.
            z.cssztext/cssz	text/html��zContent-Typez%s; charset=UTF-8zutf-8N)	rrbZ
send_responseZsend_headerZend_headersZwfiler��
urlhandlerr�)r>�content_typerrr�do_GET�s

z(_start_server.<locals>.DocHandler.do_GETcWsdS)Nr)r>r�rrr�log_message�sz-_start_server.<locals>.DocHandler.log_messageN)r%r&r[r�r�rrrr�
DocHandler�sr�cs(eZdZdd�Z�fdd�Zdd�ZdS)z _start_server.<locals>.DocServercSs6d|_|j|f|_||_|jj||j|j�d|_dS)NZ	localhostF)�hostZaddressr�rIrz�handlerr�)r>�portr�rrrrz�s
z)_start_server.<locals>.DocServer.__init__csBx4|js4�j|jj�gggd�\}}}|r|j�qW|j�dS)Nr)r��selectZsocketr�Zhandle_requestZserver_close)r>Zrd�wrZex)r�rr�serve_until_quit�s
z1_start_server.<locals>.DocServer.serve_until_quitcSs |jj|�|jr|j|�dS)N)rI�server_activater�)r>rrrr��sz0_start_server.<locals>.DocServer.server_activateN)r%r&r[rzr�r�r)r�rr�	DocServer�sr�cs:eZdZ�fdd�Z����fdd�Zdd�Zdd�Zd	S)
z#_start_server.<locals>.ServerThreadcs,||_t|�|_�jj|�d|_d|_dS)NF)r�rr��Threadrz�serving�error)r>r�r�)�	threadingrrrz�s

z,_start_server.<locals>.ServerThread.__init__cstyF�jj�_��_�jj�_t|j��_�|j	|j
�}||_|j�Wn(t
k
rn}z||_WYdd}~XnXdS)zStart the server.N)�server�
HTTPServerrIr�r�ZMessageZMessageClass�staticmethodr�r��ready�	docserverr�rJr�)r>Zdocsvr�e)r�r��email�httprrr��s

z'_start_server.<locals>.ServerThread.runcSs,d|_|j|_|j|_d|j|jf|_dS)NTz
http://%s:%d/)r�r�Zserver_portr�r)r>r�rrrr��sz)_start_server.<locals>.ServerThread.readycSs&d|j_|j�d|_d|_d|_dS)z&Stop the server and this thread nicelyTNF)r�r�r!r�r)r>rrr�stop�s
z(_start_server.<locals>.ServerThread.stopN)r%r&r[rzr�r�r�r)r�r�r�r�r�rr�ServerThread�s
r�g{�G�z�?)
Zhttp.serverZ
email.messager�r�r�ZBaseHTTPRequestHandlerr�r�r#r�r��timeZsleep)r�r�r�Zthreadr)r�r�r�r�r�r�r�
_start_server[s8&
r��	text/htmlcsG�fdd�dt�}|���fdd���fdd���fdd���fd	d
���fdd���fd
d���fdd���fdd����������fdd�}|jd�r�|dd�}|dkr�tjjtjjt��}tjj||�}t|��}dj|j	��SQRXn|dk�r||�St
d||f��dS)aThe pydoc url handler for use with the pydoc server.

    If the content_type is 'text/css', the _pydoc.css style
    sheet is read and returned if it exits.

    If the content_type is 'text/html', then the result of
    get_html_page(url) is returned.
    cseZdZ�fdd�ZdS)z_url_handler.<locals>._HTMLDoccsd}d|}d||��|fS)zFormat an HTML page.zpydoc_data/_pydoc.cssz1<link rel="stylesheet" type="text/css" href="%s">a<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Pydoc: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
%s</head><body bgcolor="#f0f0f8">%s<div style="clear:both;padding-top:.5em;">%s</div>
</body></html>r)r>r�r��css_pathZcss_link)�html_navbarrrr��sz#_url_handler.<locals>._HTMLDoc.pageN)r%r&r[r�r)r�rr�_HTMLDoc�sr�cs>�jdtj�tj�dtj�f�}d|�jtjdd��fS)Nz%s [%s, %s]raZ
            <div style='float:left'>
                Python %s<br>%s
            </div>
            <div style='float:right'>
                <div style='text-align:center'>
                  <a href="index.html">Module Index</a>
                  : <a href="topics.html">Topics</a>
                  : <a href="keywords.html">Keywords</a>
                </div>
                <div>
                    <form action="get" style='display:inline;'>
                      <input type=text name=key size=15>
                      <input type=submit value="Get">
                    </form>&nbsp;
                    <form action="search" style='display:inline;'>
                      <input type=text name=key size=15>
                      <input type=submit value="Search">
                    </form>
                </div>
            </div>
            T)Zterse)r�r�Zpython_versionZpython_buildZpython_compiler)r@)r�rrr�
	s
z!_url_handler.<locals>.html_navbarcs�dd�}�jddd�}dd�tjD�}�j||�}|d�jd	dd
|�g}i}x tjD]}|j�j||��qVW|jd�dd
j|�fS)zModule Index page.cSsd||fS)Nz<a href="%s.html">%s</a>r)r(rrr�	bltinlink+	sz3_url_handler.<locals>.html_index.<locals>.bltinlinkz7<big><big><strong>Index of Modules</strong></big></big>z#ffffffz#7799eecSsg|]}|dkr|�qS)r�r)rkr(rrrr�1	sz4_url_handler.<locals>.html_index.<locals>.<listcomp>z<p>zBuilt-in Modulesz#ee77aaz|<p align=right><font color="#909090" face="helvetica,arial"><strong>pydoc</strong> by Ka-Ping Yee&lt;ping@lfw.org&gt;</font>zIndex of Modulesr)	rrr�r
rrr
ror!)r�r�namesr�r�r)r�rr�
html_index(	sz _url_handler.<locals>.html_indexc	s�g��fdd�}tj��*tjd�dd�}t�j|||d�WdQRXdd	�}g}�jd
dd�}x"�D]\}}|j||�|�qhW|�jd
|dddj|��}d|fS)zSearch results page.cs:|dd�dkr |dd�d}�j||o0d|f�dS)Nr�z	.__init__z
 (package)z- i����i����)r
)rr'r)�
search_resultrrr�F	sz3_url_handler.<locals>.html_search.<locals>.callbackr�cSsdS)Nr)r'rrrr�M	sz2_url_handler.<locals>.html_search.<locals>.onerror)r�NcSsd||fS)Nz<a href="%s.html">%s</a>r)r(rrrr�R	sz4_url_handler.<locals>.html_search.<locals>.bltinlinkz5<big><big><strong>Search Results</strong></big></big>z#ffffffz#7799eezkey = %sz#ee77aaz<br>zSearch Results)	r�r�r�r�r�rr
rr!)	rGr�r�r�rhrr(rr�)r�)r�r�html_searchA	s 

z!_url_handler.<locals>.html_searchcsLdd�}�jddd�}ttjj��}�j||�}|�jddd|�}d|fS)zIndex of topic texts available.cSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrr�b	sz4_url_handler.<locals>.html_topics.<locals>.bltinlinkz,<big><big><strong>INDEX</strong></big></big>z#ffffffz#7799eeZTopicsz#ee77aa)rr�r�r�rDr
r)r�rr�r�)r�rr�html_topics_	sz!_url_handler.<locals>.html_topicscsL�jddd�}ttjj��}dd�}�j||�}|�jddd|�}d|fS)zIndex of keywords.z,<big><big><strong>INDEX</strong></big></big>z#ffffffz#7799eecSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrr�v	sz6_url_handler.<locals>.html_keywords.<locals>.bltinlinkZKeywordsz#ee77aa)rr�r�r�rDr
r)rr�r�r�)r�rr�
html_keywordso	sz#_url_handler.<locals>.html_keywordscs�tj�}t||�}|j|�\}}||jkr0d}nd}�jd|dd�}d�j|�}�j|dd|�}|r�t|j	��}dd	�}�j
||�}�jd
dd|�}d||fdj|||f�fS)
zTopic or keyword help page.ZKEYWORDZTOPICz)<big><big><strong>%s</strong></big></big>z#ffffffz#7799eez
<pre>%s</pre>z#ee77aacSsd||fS)Nz<a href="topic?key=%s">%s</a>r)r(rrrr��	sz7_url_handler.<locals>.html_topicpage.<locals>.bltinlinkzRelated help topics: z%s %sr)
r�r�r�r�r�rr&rr�rr
rr!)r�ZbufZhtmlhelpr�r�r�rr�)r�rr�html_topicpage~	s&



z$_url_handler.<locals>.html_topicpagecs@t|dd�}|dkr$|dkr$td��t|�}�j||�}||fS)Nr)r�r�zcould not find object)r�rer�r�)rr9r��content)r�rr�html_getobj�	sz!_url_handler.<locals>.html_getobjcsP�jddd�}dj�fdd�tt|�|�D��}|�j|dd|�}d||fS)	Nz,<big><big><strong>Error</strong></big></big>z#ffffffz#7799eez<br>c3s|]}�j|�VqdS)N)r�)rkr�)r�rrrm�	sz3_url_handler.<locals>.html_error.<locals>.<genexpr>z#bb0000z
Error - %s)rr!rr�r)rr�rr�)r�rr�
html_error�	sz _url_handler.<locals>.html_errorcst|}|jd�r|dd
�}�y|dkr4��\}}�n�|dkrH��\}}n�|dkr\��\}}n�d|k�r&|jd�\}}}|d	kr��|�\}}n�|d
kr�y�|�\}}Wn tk
r��|�\}}YnXn\|dk�r|dkr��\}}n4y�|�\}}Wn"tk
�r�|�\}}YnXntd��n�|�\}}Wn2tk
�rf}z�||�\}}WYdd}~XnX�j||�S)zGenerate an HTML page for url.z.htmlN�rror�r�raz
search?keyz	topic?keyzget?keyz
bad pydoc url���)rro)rro)rbr�rerJr�)rZcomplete_urlr�r��opr_r�)r�r�r�r�r�r�r�r�rr�
get_html_page�	s>



 z#_url_handler.<locals>.get_html_pager�rNztext/cssrz	text/htmlz"unknown content type %r for url %s)r�rar	r�dirname�realpathrVr!r��	readlinesrt)rr�r�r�Z	path_herer��fpr)	r�r�r�r�r�r�r�r�r�r�_url_handler�s*	
(


rT)�open_browsercCs�ddl}tt|�}|jr&t|j�dS|jr�d}|r@|j|j�z�y^td|j�t|�xD|jr�td�}|j	�}|dkr|PqZ|dkr�|j|j�qZt|�qZWWnt
tfk
r�t�YnXWd|jr�|j�td�XdS)	z�Start the enhanced pydoc Web server and open a Web browser.

    Use port '0' to start the server on an arbitrary port.
    Set open_browser to False to suppress opening a browser.
    rNz"Server commands: [b]rowser, [q]uitzServer ready atzserver> r�r�zServer stopped)
�
webbrowserr�rr�r�r�r�rr�r�r�r�r�)r�rrZserverthreadZserver_help_msgr�rrr�browse�	s2

rcCst|t�o|jtj�dkS)Nr)r�r6r�r	�sep)rNrrr�ispath
sr	cCsddl}Gdd�dt�}dtjkrXtjjtjd�}|tjkrJtjj|�tjjdd��yp|jtjdd�d�\}}d	}d	}d	}d}xP|D]H\}	}
|	d
kr�d}d}|	dkr�t	|
�dS|	d
kr�d}|
}|	dkr�d}q�W|r�|dkr�d}t
||d�dS|�s|�x�|D]�}t|��r4tjj|��r4t
d|�Py`t|��rVtjj|��rVt|�}|�r�t|��r~tjj|��r~t|�nt|�n
tj|�Wn,tk
�r�}zt
|�WYdd}~XnX�qWWnN|j|fk
�rtjjtjjtjd��d}
t
dj|
tjd��YnXdS)z@Command-line interface (looks at sys.argv to decide what to do).rNc@seZdZdS)zcli.<locals>.BadUsageN)r%r&r[rrrr�BadUsage

sr
rrrzbk:p:wFz-bTz-kz-pz-w)rzfile %r does not exista�pydoc - the Python documentation tool

{cmd} <name> ...
    Show text documentation on something.  <name> may be the name of a
    Python keyword, topic, function, module, or package, or a dotted
    reference to a class or function within a module or module in a
    package.  If <name> contains a '{sep}', it is used as the path to a
    Python source file to document. If name is 'keywords', 'topics',
    or 'modules', a listing of these things is displayed.

{cmd} -k <keyword>
    Search for a keyword in the synopsis lines of all available modules.

{cmd} -p <port>
    Start an HTTP server on the given port on the local machine.  Port
    number 0 can be used to get an arbitrary unused port.

{cmd} -b
    Start an HTTP server on an arbitrary unused port and open a Web browser
    to interactively browse documentation.  The -p option can be used with
    the -b option to explicitly specify the server port.

{cmd} -w <name> ...
    Write out the HTML documentation for a module to a file in the current
    directory.  If <name> contains a '{sep}', it is treated as a filename; if
    it names a directory, documentation is written for all the contents.
)r�r)�getoptrJrrr	r�argv�remove�insertr�rr	�existsr�r{r�rr�r�rr�r�r�r�r
r)rr
Z	scriptdirZoptsr�ZwritingZstart_serverrr��opt�val�argrHr�rrr�cli
sd




$rr�)NN)r)r)r�rN)r�rN)r)rN)r�)r)XrUr3rPrTrSrZZimportlib._bootstrapr�Zimportlib._bootstrap_external�importlib.machinery�importlib.utilrr�r	r9r�rrr�r�Zurllib.parser4r��collectionsr�reprlibr�	tracebackrrrr$r)r-r/r3r�
IGNORECASEr4r5r:r?rCrOrerfrwr}r�r�rJr�r�r�r�r�r�rqrrr�r�r�r�r�r�r�r�r�r�r�r.r�r�r�r�r"r�r�r�rr�r�r�rrr	rr%rrrr�<module>#s�		


	'
0>*- d",






=
n%V
opcode.cpython-36.opt-1.pyc000064400000012447150335715140011416 0ustar003


 \��@s�dZddddddddd	d
ddd
g
ZyddlmZejd�Wnek
rPYnX�dZgZgZgZ	gZ
gZgZgZ
gZiZdd�ed�D�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zed(d)�ed*d+�ed,d-�ed.d/�ed0d1�ed2d3�ed4d5�ed6d7�ed8d9�ed:d;�ed<d=�ed>d?�ed@dA�edBdC�edDdE�edFdG�edHdI�edJdK�edLdM�edNdO�edPdQ�edRdS�edTdU�edVdW�edXdY�edZd[�ed\d]�ed^d_�ed`da�edbdc�eddde�edfdg�edhdi�edjdk�edldm�edndo�edpdq�edrds�edtdu�edvdw�edxdy�edzd{�ed|d}�ed~d�ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��d�Zed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ejd��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ejd��ed�d��ed�d��ed�dÃed�dŃed�dǃed�dɃed�d˃ed�d̓ed�dσed�dуed�dӃed�dՃed�d׃ed�dكejdكed�dۃejdۃed�d݃ejd݃ed�d߃ed�d�ed�d�ed�d�ed�d�ed�d�e
jd�ed�d�e
jd�ed�d�e
jd�ed�d�e
jd�ed�d�ed�d�ed�d��ed�d��ed�d��ed�d��ed�d��e
jd��edd��d�Zed��d�e�d�d�e�d�d�e�d�d�e�d�d�e�d	�d
�e�d�d�e�d
�d�e�d�d�e�d�d�[[[[�dS(zy
opcode module - potentially shared between dis and other modules which
operate on bytecodes (e.g. peephole optimizers).
�cmp_op�hasconst�hasname�hasjrel�hasjabs�haslocal�
hascompare�hasfree�opname�opmap�
HAVE_ARGUMENT�EXTENDED_ARG�hasnargs�)�stack_effectr�<�<=�==�!=�>�>=�in�not in�is�is not�exception match�BADcCsg|]}d|f�qS)z<%r>�)�.0�oprr�/usr/lib64/python3.6/opcode.py�
<listcomp>%sr �cCs|t|<|t|<dS)N)r	r
)�namerrrr�def_op'sr#cCst||�tj|�dS)N)r#r�append)r"rrrr�name_op+s
r%cCst||�tj|�dS)N)r#rr$)r"rrrr�jrel_op/s
r&cCst||�tj|�dS)N)r#rr$)r"rrrr�jabs_op3s
r'ZPOP_TOP�ZROT_TWO�Z	ROT_THREE�ZDUP_TOP�ZDUP_TOP_TWO�ZNOP�	ZUNARY_POSITIVE�
ZUNARY_NEGATIVE�Z	UNARY_NOT�ZUNARY_INVERT�ZBINARY_MATRIX_MULTIPLY�ZINPLACE_MATRIX_MULTIPLY�ZBINARY_POWER�ZBINARY_MULTIPLY�Z
BINARY_MODULO�Z
BINARY_ADD�ZBINARY_SUBTRACT�Z
BINARY_SUBSCR�ZBINARY_FLOOR_DIVIDE�ZBINARY_TRUE_DIVIDE�ZINPLACE_FLOOR_DIVIDE�ZINPLACE_TRUE_DIVIDE�Z	GET_AITER�2Z	GET_ANEXT�3ZBEFORE_ASYNC_WITH�4ZINPLACE_ADD�7ZINPLACE_SUBTRACT�8ZINPLACE_MULTIPLY�9ZINPLACE_MODULO�;ZSTORE_SUBSCR�<Z
DELETE_SUBSCR�=Z
BINARY_LSHIFT�>Z
BINARY_RSHIFT�?Z
BINARY_AND�@Z
BINARY_XOR�AZ	BINARY_OR�BZ
INPLACE_POWER�CZGET_ITER�DZGET_YIELD_FROM_ITER�EZ
PRINT_EXPR�FZLOAD_BUILD_CLASS�GZ
YIELD_FROM�HZ
GET_AWAITABLE�IZINPLACE_LSHIFT�KZINPLACE_RSHIFT�LZINPLACE_AND�MZINPLACE_XOR�NZ
INPLACE_OR�OZ
BREAK_LOOP�PZWITH_CLEANUP_START�QZWITH_CLEANUP_FINISH�RZRETURN_VALUE�SZIMPORT_STAR�TZSETUP_ANNOTATIONS�UZYIELD_VALUE�VZ	POP_BLOCK�WZEND_FINALLY�XZ
POP_EXCEPT�Y�ZZ
STORE_NAMEZDELETE_NAME�[ZUNPACK_SEQUENCE�\ZFOR_ITER�]Z	UNPACK_EX�^Z
STORE_ATTR�_ZDELETE_ATTR�`ZSTORE_GLOBAL�aZ
DELETE_GLOBAL�bZ
LOAD_CONST�dZ	LOAD_NAME�eZBUILD_TUPLE�fZ
BUILD_LIST�gZ	BUILD_SET�hZ	BUILD_MAP�iZ	LOAD_ATTR�jZ
COMPARE_OP�kZIMPORT_NAME�lZIMPORT_FROM�mZJUMP_FORWARD�nZJUMP_IF_FALSE_OR_POP�oZJUMP_IF_TRUE_OR_POP�pZ
JUMP_ABSOLUTE�qZPOP_JUMP_IF_FALSE�rZPOP_JUMP_IF_TRUE�sZLOAD_GLOBAL�tZ
CONTINUE_LOOP�wZ
SETUP_LOOP�xZSETUP_EXCEPT�yZ
SETUP_FINALLY�zZ	LOAD_FAST�|Z
STORE_FAST�}ZDELETE_FAST�~ZSTORE_ANNOTATION�Z
RAISE_VARARGS�Z
CALL_FUNCTION�Z
MAKE_FUNCTION�ZBUILD_SLICE�ZLOAD_CLOSURE�Z
LOAD_DEREF�ZSTORE_DEREF�ZDELETE_DEREF�ZCALL_FUNCTION_KW�ZCALL_FUNCTION_EX�Z
SETUP_WITH�ZLIST_APPEND�ZSET_ADD�ZMAP_ADD�ZLOAD_CLASSDEREF��ZBUILD_LIST_UNPACK�ZBUILD_MAP_UNPACK�ZBUILD_MAP_UNPACK_WITH_CALL�ZBUILD_TUPLE_UNPACK�ZBUILD_SET_UNPACK�ZSETUP_ASYNC_WITH�ZFORMAT_VALUE�ZBUILD_CONST_KEY_MAP�ZBUILD_STRING�ZBUILD_TUPLE_UNPACK_WITH_CALL�N)rrrrrrrrrrrr)�__doc__�__all__Z_opcoderr$�ImportErrorrrrrrrrrr
r
�ranger	r#r%r&r'rrrrrr�<module>s6


	





















































































































_weakrefset.cpython-36.opt-2.pyc000064400000017226150335715140012445 0ustar003


 \I�@s2ddlmZdgZGdd�d�ZGdd�d�ZdS)�)�ref�WeakSetc@s$eZdZdd�Zdd�Zdd�ZdS)�_IterationGuardcCst|�|_dS)N)r�
weakcontainer)�selfr�r�#/usr/lib64/python3.6/_weakrefset.py�__init__sz_IterationGuard.__init__cCs |j�}|dk	r|jj|�|S)N)r�
_iterating�add)r�wrrr�	__enter__sz_IterationGuard.__enter__cCs0|j�}|dk	r,|j}|j|�|s,|j�dS)N)rr
�remove�_commit_removals)r�e�t�br�srrr�__exit__s
z_IterationGuard.__exit__N)�__name__�
__module__�__qualname__r	r
rrrrrr
src@seZdZd>dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZeZd d!�Zd"d#�Zd$d%�ZeZd&d'�Zd(d)�Zd*d+�ZeZd,d-�Zd.d/�ZeZd0d1�Zd2d3�Zd4d5�Z e Z!d6d7�Z"d8d9�Z#d:d;�Z$e$Z%d<d=�Z&dS)?rNcCsBt�|_t|�fdd�}||_g|_t�|_|dk	r>|j|�dS)NcSs2|�}|dk	r.|jr"|jj|�n|jj|�dS)N)r
�_pending_removals�append�data�discard)�item�selfrefrrrr�_remove&s
z!WeakSet.__init__.<locals>._remove)�setrrrrr
�update)rrrrrrr	$szWeakSet.__init__cCs(|j}|jj}x|r"||j��qWdS)N)rrr�pop)r�lrrrrr4szWeakSet._commit_removalsc
cs<t|��*x"|jD]}|�}|dk	r|VqWWdQRXdS)N)rr)r�itemrefrrrr�__iter__:s

zWeakSet.__iter__cCst|j�t|j�S)N)�lenrr)rrrr�__len__CszWeakSet.__len__cCs,yt|�}Wntk
r dSX||jkS)NF)r�	TypeErrorr)rr�wrrrr�__contains__Fs
zWeakSet.__contains__cCs|jt|�ft|dd�fS)N�__dict__)�	__class__�list�getattr)rrrr�
__reduce__MszWeakSet.__reduce__cCs&|jr|j�|jjt||j��dS)N)rrrrrr)rrrrrrQszWeakSet.addcCs|jr|j�|jj�dS)N)rrr�clear)rrrrr/Vsz
WeakSet.clearcCs
|j|�S)N)r+)rrrr�copy[szWeakSet.copycCsV|jr|j�xBy|jj�}Wntk
r:td��YnX|�}|dk	r|SqWdS)Nzpop from empty WeakSet)rrrr!�KeyError)rr#rrrrr!^szWeakSet.popcCs"|jr|j�|jjt|��dS)N)rrrrr)rrrrrrjszWeakSet.removecCs"|jr|j�|jjt|��dS)N)rrrrr)rrrrrroszWeakSet.discardcCs*|jr|j�x|D]}|j|�qWdS)N)rrr)r�other�elementrrrr ts
zWeakSet.updatecCs|j|�|S)N)r )rr2rrr�__ior__zs
zWeakSet.__ior__cCs|j�}|j|�|S)N)r0�difference_update)rr2�newsetrrr�
difference~s
zWeakSet.differencecCs|j|�dS)N)�__isub__)rr2rrrr5�szWeakSet.difference_updatecCs<|jr|j�||kr"|jj�n|jjdd�|D��|S)Ncss|]}t|�VqdS)N)r)�.0rrrr�	<genexpr>�sz#WeakSet.__isub__.<locals>.<genexpr>)rrrr/r5)rr2rrrr8�szWeakSet.__isub__cs�j�fdd�|D��S)Nc3s|]}|�kr|VqdS)Nr)r9r)rrrr:�sz'WeakSet.intersection.<locals>.<genexpr>)r+)rr2r)rr�intersection�szWeakSet.intersectioncCs|j|�dS)N)�__iand__)rr2rrr�intersection_update�szWeakSet.intersection_updatecCs(|jr|j�|jjdd�|D��|S)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz#WeakSet.__iand__.<locals>.<genexpr>)rrrr=)rr2rrrr<�szWeakSet.__iand__cCs|jjdd�|D��S)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz#WeakSet.issubset.<locals>.<genexpr>)r�issubset)rr2rrrr>�szWeakSet.issubsetcCs|jtdd�|D��kS)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz!WeakSet.__lt__.<locals>.<genexpr>)rr)rr2rrr�__lt__�szWeakSet.__lt__cCs|jjdd�|D��S)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz%WeakSet.issuperset.<locals>.<genexpr>)r�
issuperset)rr2rrrr@�szWeakSet.issupersetcCs|jtdd�|D��kS)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz!WeakSet.__gt__.<locals>.<genexpr>)rr)rr2rrr�__gt__�szWeakSet.__gt__cCs(t||j�stS|jtdd�|D��kS)Ncss|]}t|�VqdS)N)r)r9rrrrr:�sz!WeakSet.__eq__.<locals>.<genexpr>)�
isinstancer+�NotImplementedrr)rr2rrr�__eq__�szWeakSet.__eq__cCs|j�}|j|�|S)N)r0�symmetric_difference_update)rr2r6rrr�symmetric_difference�s
zWeakSet.symmetric_differencecCs|j|�dS)N)�__ixor__)rr2rrrrE�sz#WeakSet.symmetric_difference_updatecs@�jr�j��|kr"�jj�n�jj�fdd�|D���S)Nc3s|]}t|�j�VqdS)N)rr)r9r)rrrr:�sz#WeakSet.__ixor__.<locals>.<genexpr>)rrrr/rE)rr2r)rrrG�szWeakSet.__ixor__cCs|jdd�||fD��S)Ncss|]}|D]
}|Vq
qdS)Nr)r9rrrrrr:�sz WeakSet.union.<locals>.<genexpr>)r+)rr2rrr�union�sz
WeakSet.unioncCst|j|��dkS)Nr)r%r;)rr2rrr�
isdisjoint�szWeakSet.isdisjoint)N)'rrrr	rr$r&r)r.rr/r0r!rrr r4r7�__sub__r5r8r;�__and__r=r<r>�__le__r?r@�__ge__rArDrF�__xor__rErGrH�__or__rIrrrrr#sH
			N)�_weakrefr�__all__rrrrrr�<module>sformatter.cpython-36.opt-1.pyc000064400000042255150335715140012150 0ustar003


 \';�@s�dZddlZddlZejdedd�dZGdd�d�ZGdd	�d	�ZGd
d�d�ZGdd
�d
e�Z	Gdd�de�Z
ddd�Zedkr�e�dS)aGeneric output formatting.

Formatter objects transform an abstract flow of formatting events into
specific output events on writer objects. Formatters manage several stack
structures to allow various properties of a writer object to be changed and
restored; writers need not be able to handle relative changes nor any sort
of ``change back'' operation. Specific writer properties which may be
controlled via formatter objects are horizontal alignment, font, and left
margin indentations. A mechanism is provided which supports providing
arbitrary, non-exclusive style settings to a writer as well. Additional
interfaces facilitate formatting events which are not reversible, such as
paragraph separation.

Writer objects encapsulate device interfaces. Abstract devices, such as
file formats, are supported as well as physical devices. The provided
implementations all work with abstract devices. The interface makes
available mechanisms for setting the properties which formatter objects
manage and inserting data into the output.
�Nz"the formatter module is deprecated�)�
stacklevelc@s�eZdZdZd(dd�Zdd�Zdd�Zd	d
�Zd)dd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd*d$d%�Zd+d&d'�ZdS),�
NullFormattera=A formatter which does nothing.

    If the writer parameter is omitted, a NullWriter instance is created.
    No methods of the writer are called by NullFormatter instances.

    Implementations should inherit from this class if implementing a writer
    interface but don't need to inherit any implementation.

    NcCs|dkrt�}||_dS)N)�
NullWriter�writer)�selfr�r�!/usr/lib64/python3.6/formatter.py�__init__)szNullFormatter.__init__cCsdS)Nr)r�	blanklinerrr	�
end_paragraph-szNullFormatter.end_paragraphcCsdS)Nr)rrrr	�add_line_break.szNullFormatter.add_line_breakcOsdS)Nr)r�args�kwrrr	�add_hor_rule/szNullFormatter.add_hor_rulecCsdS)Nr)r�format�counterrrrr	�add_label_data0szNullFormatter.add_label_datacCsdS)Nr)r�datarrr	�add_flowing_data1szNullFormatter.add_flowing_datacCsdS)Nr)rrrrr	�add_literal_data2szNullFormatter.add_literal_datacCsdS)Nr)rrrr	�flush_softspace3szNullFormatter.flush_softspacecCsdS)Nr)r�alignrrr	�push_alignment4szNullFormatter.push_alignmentcCsdS)Nr)rrrr	�
pop_alignment5szNullFormatter.pop_alignmentcCsdS)Nr)r�xrrr	�	push_font6szNullFormatter.push_fontcCsdS)Nr)rrrr	�pop_font7szNullFormatter.pop_fontcCsdS)Nr)r�marginrrr	�push_margin8szNullFormatter.push_margincCsdS)Nr)rrrr	�
pop_margin9szNullFormatter.pop_margincCsdS)Nr)r�spacingrrr	�set_spacing:szNullFormatter.set_spacingcGsdS)Nr)r�stylesrrr	�
push_style;szNullFormatter.push_style�cCsdS)Nr)r�nrrr	�	pop_style<szNullFormatter.pop_stylecCsdS)Nr)r�flagrrr	�assert_line_data=szNullFormatter.assert_line_data)N)N)r%)r%)�__name__�
__module__�__qualname__�__doc__r
rr
rrrrrrrrrrr r"r$r'r)rrrr	rs&	


rc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd.dd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd/d*d+�Zd0d,d-�Zd
S)1�AbstractFormatterz�The standard formatter.

    This implementation has demonstrated wide applicability to many writers,
    and may be used directly in most circumstances.  It has been used to
    implement a full-featured World Wide Web browser.

    cCsR||_d|_g|_g|_g|_d|_g|_d|_d|_d|_	d|_
d|_d|_dS)Nr%r)
rr�align_stack�
font_stack�margin_stackr!�style_stack�nospace�	softspace�para_end�parskip�
hard_break�
have_label)rrrrr	r
NszAbstractFormatter.__init__cCsb|js|jj�d|_|j|krF|jrF|jj||j�||_d|_d|_|_|_d|_dS)Nrr%)	r7r�send_line_breakr8r6�send_paragraphr3r5r4)rrrrr	r]s
zAbstractFormatter.end_paragraphcCs8|jp
|js"|jj�d|_|_d|_|_d|_dS)Nrr%)r7r5rr9r8r6r3r4)rrrr	r
hs

z AbstractFormatter.add_line_breakcOsF|js|jj�|jj||�d|_|_d|_|_|_|_dS)Nr%r)	r7rr9�
send_hor_ruler3r8r5r4r6)rrrrrr	ros

zAbstractFormatter.add_hor_ruleNcCs�|js|jr|jj�|js2|jj|r,dp.d�t|t�rR|jj|j	||��n|jj|�d|_
|_|_|_d|_|_dS)Nr%r)
r8r7rr9r5r:�
isinstance�str�send_label_data�format_counterr3r4r6)rrrrrrr	rvs

z AbstractFormatter.add_label_datacCsxd}xn|D]f}|dkr$|d|}q
|dkrF|dkrp||j||�}q
|dkrh|dkrp||j||�}q
||}q
W|S)N��1z%dZaArZiI)�
format_letter�format_roman)rrr�label�crrr	r?�s
z AbstractFormatter.format_countercCs@d}x6|dkr:t|dd�\}}tt|�|�}||}qW|S)Nr@rr%�)�divmod�chr�ord)r�caserrDr�srrr	rB�s
zAbstractFormatter.format_letterc	Cs�ddddg}dddg}d\}}x�|d	kr�t|d
�\}}|dkrX||||d|}nT|d
krv|||||}n6|dkr�||}|d}nd}||||}||}|d}q W|dkr�|j�S|S)N�irrE�m�v�l�dr@r�
�	r%���I)r@r)rG�upper)	rrJrZonesZfivesrD�indexrrKrrr	rC�s&


zAbstractFormatter.format_romancCs�|sdS|dd�j�}|dd�j�}dj|j��}|jrF|rFdS|sP|jrx|sj|jsfd|_d|_dS|jsxd|}d|_|_|_|_|_||_|j	j
|�dS)Nr%� r���)�isspace�join�splitr3r4r6r7r5r8r�send_flowing_data)rrZprespaceZ	postspacerrr	r�s$
z"AbstractFormatter.add_flowing_datacCsZ|sdS|jr|jjd�|dd�dk|_d|_|_|_|_|_|jj|�dS)NrXr%�
rrY)	r4rr]r7r3r5r6r8�send_literal_data)rrrrr	r�sz"AbstractFormatter.add_literal_datacCs:|jr6d|_|_|_|_|_d|_|jjd�dS)Nrr%rX)r4r7r5r6r8r3rr])rrrr	r�sz!AbstractFormatter.flush_softspacecCs@|r.||jkr.|jj|�||_|jj|�n|jj|j�dS)N)rr�
new_alignmentr/�append)rrrrr	r�s
z AbstractFormatter.push_alignmentcCsH|jr|jd=|jr2|jd|_}|jj|�nd|_|jjd�dS)Nr%rYrY)r/rrr`)rrrrr	r�szAbstractFormatter.pop_alignmentc
Cs�|\}}}}|jr6d|_|_|_d|_|jjd�|jr~|jd\}}}}	|tkrZ|}|tkrf|}|tkrr|}|tkr~|	}||||f}|jj|�|jj	|�dS)Nrr%rXrY)
r4r7r5r3rr]r0�AS_ISra�new_font)
r�font�sizerL�bZttZcsizeZci�cbZcttrrr	r�s$zAbstractFormatter.push_fontcCs4|jr|jd=|jr |jd}nd}|jj|�dS)Nr%rYrY)r0rrc)rrdrrr	r�szAbstractFormatter.pop_fontcCsD|jj|�dd�|jD�}|r.|r.|d}|jj|t|��dS)NcSsg|]}|r|�qSrr)�.0rMrrr	�
<listcomp>sz1AbstractFormatter.push_margin.<locals>.<listcomp>r%rY)r1rar�
new_margin�len)rr�fstackrrr	rs

zAbstractFormatter.push_margincCsF|jr|jd=dd�|jD�}|r,|d}nd}|jj|t|��dS)Nr%cSsg|]}|r|�qSrr)rhrMrrr	ri
sz0AbstractFormatter.pop_margin.<locals>.<listcomp>rYrY)r1rrjrk)rrlrrrr	r 
s
zAbstractFormatter.pop_margincCs||_|jj|�dS)N)r!r�new_spacing)rr!rrr	r"szAbstractFormatter.set_spacingcGsZ|jr*d|_|_|_d|_|jjd�x|D]}|jj|�q0W|jjt	|j��dS)Nrr%rX)
r4r7r5r3rr]r2ra�
new_styles�tuple)rr#Zstylerrr	r$s
zAbstractFormatter.push_styler%cCs$|j|d�=|jjt|j��dS)N)r2rrnro)rr&rrr	r'!szAbstractFormatter.pop_stylecCs$||_|_d|_|_|_dS)Nr)r3r7r5r6r8)rr(rrr	r)%sz"AbstractFormatter.assert_line_data)N)r%)r%)r*r+r,r-r
rr
rrr?rBrCrrrrrrrrr r"r$r'r)rrrr	r.@s,
	
	
	
r.c@sxeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)raMinimal writer interface to use in testing & inheritance.

    A writer which only provides the interface definition; no actions are
    taken on any methods.  This should be the base class for all writers
    which do not need to inherit any implementation methods.

    cCsdS)Nr)rrrr	r
2szNullWriter.__init__cCsdS)Nr)rrrr	�flush3szNullWriter.flushcCsdS)Nr)rrrrr	r`4szNullWriter.new_alignmentcCsdS)Nr)rrdrrr	rc5szNullWriter.new_fontcCsdS)Nr)rr�levelrrr	rj6szNullWriter.new_margincCsdS)Nr)rr!rrr	rm7szNullWriter.new_spacingcCsdS)Nr)rr#rrr	rn8szNullWriter.new_stylescCsdS)Nr)rrrrr	r:9szNullWriter.send_paragraphcCsdS)Nr)rrrr	r9:szNullWriter.send_line_breakcOsdS)Nr)rrrrrr	r;;szNullWriter.send_hor_rulecCsdS)Nr)rrrrr	r><szNullWriter.send_label_datacCsdS)Nr)rrrrr	r]=szNullWriter.send_flowing_datacCsdS)Nr)rrrrr	r_>szNullWriter.send_literal_dataN)r*r+r,r-r
rpr`rcrjrmrnr:r9r;r>r]r_rrrr	r*src@sheZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�AbstractWriterz�A writer which can be used in debugging formatters, but not much else.

    Each method simply announces itself by printing its name and
    arguments on standard output.

    cCstd|f�dS)Nznew_alignment(%r))�print)rrrrr	r`IszAbstractWriter.new_alignmentcCstd|f�dS)Nznew_font(%r))rs)rrdrrr	rcLszAbstractWriter.new_fontcCstd||f�dS)Nznew_margin(%r, %d))rs)rrrqrrr	rjOszAbstractWriter.new_margincCstd|f�dS)Nznew_spacing(%r))rs)rr!rrr	rmRszAbstractWriter.new_spacingcCstd|f�dS)Nznew_styles(%r))rs)rr#rrr	rnUszAbstractWriter.new_stylescCstd|f�dS)Nzsend_paragraph(%r))rs)rrrrr	r:XszAbstractWriter.send_paragraphcCstd�dS)Nzsend_line_break())rs)rrrr	r9[szAbstractWriter.send_line_breakcOstd�dS)Nzsend_hor_rule())rs)rrrrrr	r;^szAbstractWriter.send_hor_rulecCstd|f�dS)Nzsend_label_data(%r))rs)rrrrr	r>aszAbstractWriter.send_label_datacCstd|f�dS)Nzsend_flowing_data(%r))rs)rrrrr	r]dsz AbstractWriter.send_flowing_datacCstd|f�dS)Nzsend_literal_data(%r))rs)rrrrr	r_gsz AbstractWriter.send_literal_dataN)r*r+r,r-r`rcrjrmrnr:r9r;r>r]r_rrrr	rrAsrrc@sJeZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dS)�
DumbWritera;Simple writer class which writes output on the file object passed in
    as the file parameter or, if file is omitted, on standard output.  The
    output is simply word-wrapped to the number of columns specified by
    the maxcol parameter.  This class is suitable for reflowing a sequence
    of paragraphs.

    N�HcCs(|ptj|_||_tj|�|j�dS)N)�sys�stdout�file�maxcolrr
�reset)rrxryrrr	r
ts
zDumbWriter.__init__cCsd|_d|_dS)Nr)�col�atbreak)rrrr	rzzszDumbWriter.resetcCs |jjd|�d|_d|_dS)Nr^r)rx�writer{r|)rrrrr	r:~szDumbWriter.send_paragraphcCs|jjd�d|_d|_dS)Nr^r)rxr}r{r|)rrrr	r9�szDumbWriter.send_line_breakcOs:|jjd�|jjd|j�|jjd�d|_d|_dS)Nr^�-r)rxr}ryr{r|)rrrrrr	r;�s
zDumbWriter.send_hor_rulecCsV|jj|�|jd�}|dkr4d|_||dd�}|j�}|jt|�|_d|_dS)Nr^rr%)rxr}�rfindr{�
expandtabsrkr|)rrrLrrr	r_�s
zDumbWriter.send_literal_datacCs�|sdS|jp|dj�}|j}|j}|jj}xZ|j�D]N}|rn|t|�|kr^|d�d}n|d�|d}||�|t|�}d}q8W||_|dj�|_dS)Nrr^rXr%rY)r|rZr{ryrxr}r\rk)rrr|r{ryr}Zwordrrr	r]�s$zDumbWriter.send_flowing_data)Nru)r*r+r,r-r
rzr:r9r;r_r]rrrr	rtks

rtcCs�t�}t|�}|dk	r t|�}n$tjdd�r>ttjd�}ntj}z0x*|D]"}|dkrd|jd�qL|j|�qLWWd|tjk	r�|j�X|jd�dS)Nr%r^r)	rtr.�openrv�argv�stdinrr�close)rx�w�f�fp�linerrr	�test�s



r��__main__)N)
r-rv�warnings�warn�DeprecationWarningrbrr.rrrrtr�r*rrrr	�<module>s"k*C
difflib.cpython-36.opt-2.pyc000064400000060714150335715140011545 0ustar003


 \�I�@s4dddddddddd	d
dgZdd
lmZddlmZedd�Zdd�ZGdd�d�Z	d7dd�Z
dd�ZGdd�d�Zddl
Z
e
jd�jfdd�Zd8dd�Zdd�Zd9d"d�Zd#d$�Zd:d%d�Zd&d'�Zd;d*d	�Zdefd+d�Zddefd,d-�Zd.Zd/Zd0Zd1ZGd2d
�d
e�Z[
d3d�Z d4d5�Z!e"d6k�r0e!�dS)<�get_close_matches�ndiff�restore�SequenceMatcher�Differ�IS_CHARACTER_JUNK�IS_LINE_JUNK�context_diff�unified_diff�
diff_bytes�HtmlDiff�Match�)�nlargest)�
namedtupleza b sizecCs|rd||SdS)Ng@g�?�)�matches�lengthrr�/usr/lib64/python3.6/difflib.py�_calculate_ratio&src@speZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
ddd�Zdd�Zdd�Z
dd�ZdS)rN�TcCs(||_d|_|_||_|j||�dS)N)�isjunk�a�b�autojunk�set_seqs)�selfrrrrrrr�__init__�s;zSequenceMatcher.__init__cCs|j|�|j|�dS)N)�set_seq1�set_seq2)rrrrrrr�s	
zSequenceMatcher.set_seqscCs$||jkrdS||_d|_|_dS)N)r�matching_blocks�opcodes)rrrrrr�s
zSequenceMatcher.set_seq1cCs2||jkrdS||_d|_|_d|_|j�dS)N)rrr �
fullbcount�_SequenceMatcher__chain_b)rrrrrr�s
zSequenceMatcher.set_seq2cCs�|j}i|_}x*t|�D]\}}|j|g�}|j|�qWt�|_}|j}|r�x"|j�D]}||�r\|j	|�q\Wx|D]
}||=q|Wt�|_
}t|�}	|jr�|	dkr�|	dd}
x*|j
�D]\}}t|�|
kr�|j	|�q�Wx|D]
}||=q�WdS)N���d�)r�b2j�	enumerate�
setdefault�append�set�bjunkr�keys�addZbpopular�lenr�items)rrr&�i�elt�indicesZjunkrZpopular�nZntestZidxsrrrZ	__chain_b)s,



zSequenceMatcher.__chain_bcCsN|j|j|j|jjf\}}}}||d}	}
}i}g}
x�t||�D]�}|j}i}xn|j|||
�D]Z}||krpqb||krzP||dd�d}||<||krb||d||d|}	}
}qbW|}qBWxb|	|k�r*|
|k�r*|||
d��r*||	d||
dk�r*|	d|
d|d}	}
}q�WxX|	||k�r�|
||k�r�|||
|��r�||	|||
|k�r�|d7}�q.Wxb|	|k�r�|
|k�r�|||
d��r�||	d||
dk�r�|	d|
d|d}	}
}�q�WxV|	||k�r@|
||k�r@|||
|��r@||	|||
|k�r@|d}�q�Wt|	|
|�S)Nr
r%)rrr&r+�__contains__�range�getr)r�alo�ahi�blo�bhirrr&ZisbjunkZbestiZbestjZbestsizeZj2lenZnothingr0Zj2lengetZnewj2len�j�krrr�find_longest_matchPsB8$ 	"z"SequenceMatcher.find_longest_matchcCs�|jdk	r|jSt|j�t|j�}}d|d|fg}g}x�|r�|j�\}}}}|j||||�\}	}
}}|r:|j|�||	kr�||
kr�|j||	||
f�|	||kr:|
||kr:|j|	|||
||f�q:W|j�d}
}}g}x^|D]V\}}}|
||k�r|||k�r||7}q�|�r2|j|
||f�|||}
}}q�W|�r\|j|
||f�|j||df�tt	t
j|��|_|jS)Nr
)rr.rr�popr=r)�sort�list�mapr�_make)r�la�lbZqueuerr7r8r9r:r0r;r<�x�i1�j1Zk1Znon_adjacent�i2�j2Zk2rrr�get_matching_blocks�s8


z#SequenceMatcher.get_matching_blockscCs�|jdk	r|jSd}}g|_}x�|j�D]�\}}}d}||krP||krPd}n||kr^d}n||krjd}|r�|j|||||f�||||}}|r,|jd||||f�q,W|S)Nr
r�replace�delete�insert�equal)r rJr))rr0r;Zanswer�ai�bj�size�tagrrr�get_opcodess$

zSequenceMatcher.get_opcodes�c

csr|j�}|sdg}|dddkrZ|d\}}}}}|t|||�|t|||�|f|d<|dddkr�|d\}}}}}||t|||�|t|||�f|d<||}g}	x�|D]�\}}}}}|dko�|||k�r(|	j||t|||�|t|||�f�|	Vg}	t|||�t|||�}}|	j|||||f�q�W|	�rnt|	�dk�ob|	dddk�rn|	VdS)NrNr
r%)rNr
r%r
r%���rUrU)rS�max�minr)r.)
rr3ZcodesrRrFrHrGrIZnn�grouprrr�get_grouped_opcodes<s(&&((z#SequenceMatcher.get_grouped_opcodescCs0tdd�|j�D��}t|t|j�t|j��S)Ncss|]}|dVqdS)r%NrUr)�.0Ztriplerrr�	<genexpr>�sz(SequenceMatcher.ratio.<locals>.<genexpr>)�sumrJrr.rr)rrrrr�rationszSequenceMatcher.ratiocCs�|jdkr8i|_}x"|jD]}|j|d�d||<qW|j}i}|jd}}xH|jD]>}||�rl||}n|j|d�}|d||<|dkrV|d}qVWt|t|j�t|j��S)Nr
r%)r!rr6r4rrr.)rr!r1ZavailZavailhasrZnumbrrr�quick_ratio�s



zSequenceMatcher.quick_ratiocCs*t|j�t|j�}}tt||�||�S)N)r.rrrrW)rrCrDrrr�real_quick_ratio�sz SequenceMatcher.real_quick_ratio)NrrT)rT)�__name__�
__module__�__qualname__rrrrr"r=rJrSrYr]r^r_rrrrr+sl
@,'nG7
2rT�333333�?cCs�|dkstd|f��d|ko(dkns<td|f��g}t�}|j|�xL|D]D}|j|�|j�|krV|j�|krV|j�|krV|j|j�|f�qVWt||�}dd�|D�S)Nr
zn must be > 0: %rgg�?z cutoff must be in [0.0, 1.0]: %rcSsg|]\}}|�qSrr)rZZscorerErrr�
<listcomp>�sz%get_close_matches.<locals>.<listcomp>)	�
ValueErrorrrrr_r^r]r)�	_nlargest)ZwordZ
possibilitiesr3�cutoff�result�srErrrr�s



cCs4dt|�}}x ||kr.|||kr.|d7}qW|S)Nr
r%)r.)�line�chr0r3rrr�_count_leading�s
rlc@sFeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)rNcCs||_||_dS)N)�linejunk�charjunk)rrmrnrrrrMszDiffer.__init__c
cs�t|j||�}x�|j�D]�\}}}}}|dkrD|j||||||�}	n\|dkr^|jd|||�}	nB|dkrx|jd|||�}	n(|dkr�|jd|||�}	ntd|f��|	EdHqWdS)	NrKrL�-rM�+rN� zunknown tag %r)rrmrS�_fancy_replace�_dumpre)
rrr�cruncherrRr7r8r9r:�grrr�comparedszDiffer.compareccs*x$t||�D]}d|||fVqWdS)Nz%s %s)r5)rrRrE�lo�hir0rrrrs�szDiffer._dumpc
csr||||kr2|jd|||�}|jd|||�}n |jd|||�}|jd|||�}x||fD]}	|	EdHq\WdS)Nrpro)rs)
rrr7r8rr9r:�first�secondrurrr�_plain_replace�szDiffer._plain_replaceccsHd\}}t|j�}	d\}
}x�t||�D]�}||}
|	j|
�xxt||�D]j}||}||
krp|
dkrH||}
}qH|	j|�|	j�|krH|	j�|krH|	j�|krH|	j�||}}}qHWq&W||k�r�|
dkr�|j||||||�EdHdS|
|d}}}nd}
|j	||||||�EdH||||}}|
dk�rd}}|	j
||�x�|	j�D]�\}}}}}||||}}|dk�r�|d|7}|d|7}nb|dk�r�|d|7}nJ|d	k�r�|d
|7}n2|dk�r�|d|7}|d|7}ntd
|f���qTW|j
||||�EdHn
d|V|j	||d|||d|�EdHdS)N�G�z��?��?g�?rrK�^rLrorMrprNrqzunknown tag %rz  r%)r|r})NN)rrnr5rrr_r^r]r{�
_fancy_helperrrSre�_qformat)rrr7r8rr9r:Z
best_ratiorgrtZeqiZeqjr;rPr0rOZbest_iZbest_jZaeltZbelt�atags�btagsrRZai1Zai2Zbj1Zbj2rCrDrrrrr�sX










zDiffer._fancy_replaceccsbg}||kr<||kr*|j||||||�}qT|jd|||�}n||krT|jd|||�}|EdHdS)Nrorp)rrrs)rrr7r8rr9r:rurrrr�szDiffer._fancy_helperccs�tt|d�t|d��}t|t|d|�d��}t|t|d|�d��}||d�j�}||d�j�}d|V|r�dd||fVd|V|r�dd||fVdS)N�	rqz- z? %s%s
z+ )rWrl�rstrip)rZalineZbliner�r��commonrrrr�
s


zDiffer._qformat)NN)
r`rarbrrvrsr{rrrr�rrrrr�s^
)^Nz
\s*(?:#\s*)?$cCs||�dk	S)Nr)rjZpatrrrr>s� 	cCs||kS)Nr)rkZwsrrrrNscCs:|d}||}|dkr"dj|�S|s.|d8}dj||�S)Nr%z{}z{},{})�format)�start�stop�	beginningrrrr�_format_range_unifiedes
r�r�
ccsht|||||||�d}�xHtd||�j|�D�]0}	|s�d}|rJdj|�nd}
|r\dj|�nd}dj||
|�Vdj|||�V|	d|	d}}
t|d|
d	�}t|d
|
d�}dj|||�Vx�|	D]�\}}}}}|d
k�rx|||�D]}d|Vq�Wq�|dk�r2x |||�D]}d|V�qW|dkr�x |||�D]}d|V�qHWq�Wq.WdS)NFTz	{}rz
--- {}{}{}z
+++ {}{}{}r
r%�rT�z@@ -{} +{} @@{}rNrqrKrLrorMrprU>rKrL>rMrK)�_check_typesrrYr�r�)rr�fromfile�tofile�fromfiledate�
tofiledater3�lineterm�startedrX�fromdate�todatery�last�file1_range�file2_rangerRrFrHrGrIrjrrrr	ps0)

cCsB|d}||}|s|d8}|dkr.dj|�Sdj|||d�S)Nr%z{}z{},{})r�)r�r�r�rrrr�_format_range_context�s
r�ccs�t|||||||�tddddd�}d}	�xztd||�j|�D�]b}
|	s�d}	|rZdj|�nd	}|rldj|�nd	}d
j|||�Vdj|||�V|
d|
d}
}d|Vt|
d
|d�}dj||�Vtdd�|
D���r&xD|
D]<\}}}}}|dkr�x$|||�D]}|||V�q
Wq�Wt|
d|d�}dj||�Vtdd�|
D��r>xH|
D]@\}}}}}|dk�r^x$|||�D]}|||V�q�W�q^Wq>WdS)Nz+ z- z! z  )rMrLrKrNFTz	{}rz
*** {}{}{}z
--- {}{}{}r
r%z***************r�z
*** {} ****{}css |]\}}}}}|dkVqdS)rKrLN>rKrLr)rZrR�_rrrr[szcontext_diff.<locals>.<genexpr>rMrTr�z
--- {} ----{}css |]\}}}}}|dkVqdS)rKrMN>rMrKr)rZrRr�rrrr[srLrU)r��dictrrYr�r��any)rrr�r�r�r�r3r��prefixr�rXr�r�ryr�r�rRrFrHr�rjr�rGrIrrrr�s4,

cGs�|r2t|dt�r2tdt|d�j|df��|rdt|dt�rdtdt|d�j|df��x$|D]}t|t�sjtd|f��qjWdS)Nr
z)lines to compare must be str, not %s (%r)z"all arguments must be str, not: %r)�
isinstance�str�	TypeError�typer`)rr�args�argrrrr�s

r���
c		cs�dd�}	tt|	|��}tt|	|��}|	|�}|	|�}|	|�}|	|�}|	|�}|||||||||�}
x|
D]}|jdd�VqhWdS)NcSsPy|jdd�Stk
rJ}z"dt|�j|f}t|�|�WYdd}~XnXdS)N�ascii�surrogateescapez(all arguments must be bytes, not %s (%r))�decode�AttributeErrorr�r`r�)ri�err�msgrrrr�-szdiff_bytes.<locals>.decoder�r�)r@rA�encode)Zdfuncrrr�r�r�r�r3r�r��linesrjrrrr
"s
cCst||�j||�S)N)rrv)rrrmrnrrrr@s#c#s�ddl}|jd��t||||��ddgf�fdd�	���fdd���fdd�}|�}|dkrj|EdH�n.|d	7}d}�xddg|}	}
d
}xR|d
kr�yt|�\}}
}Wntk
r�dSX|	|}||
|f|
|<|	d	7}	q�W|	|k�r�dV|}n|	}d}	x.|�r.|	|}|	d	7}	|
|V|d	8}�qW|d	}yDx>|�rxt|�\}}
}|�r`|d	}n|d	8}||
|fV�q<WWqztk
�r�dSXqzWdS)Nr
z
(\++|\-+|\^+)cs�||d7<|dkr2|||jd�dd�fS|dkr�|jd�|jd�}}g}|fdd�}�j||�xHt|�D]<\}\}	}
|d|	�d|||	|
�d||
d�}qvW|dd�}n*|jd�dd�}|s�d	}d||d}|||fS)
Nr%r
r��?cSs&|j|jd�d|j�g�|jd�S)Nr%r
)r)rX�span)Zmatch_object�sub_inforrr�record_sub_info�sz3_mdiff.<locals>._make_line.<locals>.record_sub_info��rq)r>�sub�reversed)r�Z
format_key�sideZ	num_lines�textZmarkersr�r��keyZbegin�end)�	change_rerr�
_make_line�s 4z_mdiff.<locals>._make_linec3s�g}d\}}�xlx t|�dkr0|jt�d��qWdjdd�|D��}|jd�rX|}�n�|jd�r��|dd��|dd	�d
fVq�n�|jd�r�|d	8}�|dd�dd
fVq�nl|jd�rވ|dd�d}}|d	d}}�n>|jd��r�|dd��|dd	�d
fVq�n|jd��r8�|dd��|dd	�d
fVqn�|jd��rd|d	8}�|dd�dd
fVqn�|jd��r�|d	7}d�|dd	�d
fVqn�|jd��r�d�|dd	�}}|d	d}}n^|jd��r�|d	7}d�|dd	�d
fVqn2|jd��r�|dd�dd��|dd	�dfVqx|dk�r:|d	7}dV�qWx|dk�rZ|d	8}dV�q>W|jd��rldS||d
fVqWdS) Nr
r��XrcSsg|]}|d�qS)r
r)rZrjrrrrd�sz2_mdiff.<locals>._line_iterator.<locals>.<listcomp>z-?+?r�r%Tz--++ro�--?+�--+�- z-+?z-?+z+--rp�+ �+-rqFr�)r
r
)r�r�r�)r�r��rr�)Nr�T�rr�)r�NT)r.r)�next�join�
startswith)r�Znum_blanks_pendingZnum_blanks_to_yieldri�	from_line�to_line)r��diff_lines_iteratorrr�_line_iterator�sf



$z_mdiff.<locals>._line_iteratorc3s���}gg}}x�xpt|�dks,t|�dkr�yt|�\}}}Wntk
rRdSX|dk	rj|j||f�|dk	r|j||f�qW|jd�\}}|jd�\}}|||p�|fVqWdS)Nr
)r.r��
StopIterationr)r>)Z
line_iterator�	fromlines�tolinesr�r��
found_diffZfromDiffZto_diff)r�rr�_line_pair_iterators

z#_mdiff.<locals>._line_pair_iteratorr%F)NNN)�re�compilerr�r�)r�r��contextrmrnr�r�Zline_pair_iteratorZlines_to_write�indexZcontextLinesr�r�r�r0r)r�r�r�r�r�_mdiffesT"
8X!



r�an
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>
    <meta http-equiv="Content-Type"
          content="text/html; charset=%(charset)s" />
    <title></title>
    <style type="text/css">%(styles)s
    </style>
</head>

<body>
    %(table)s%(legend)s
</body>

</html>aH
        table.diff {font-family:Courier; border:medium;}
        .diff_header {background-color:#e0e0e0}
        td.diff_header {text-align:right}
        .diff_next {background-color:#c0c0c0}
        .diff_add {background-color:#aaffaa}
        .diff_chg {background-color:#ffff77}
        .diff_sub {background-color:#ffaaaa}aZ
    <table class="diff" id="difflib_chg_%(prefix)s_top"
           cellspacing="0" cellpadding="0" rules="groups" >
        <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
        <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
        %(header_row)s
        <tbody>
%(data_rows)s        </tbody>
    </table>a�
    <table class="diff" summary="Legends">
        <tr> <th colspan="2"> Legends </th> </tr>
        <tr> <td> <table border="" summary="Colors">
                      <tr><th> Colors </th> </tr>
                      <tr><td class="diff_add">&nbsp;Added&nbsp;</td></tr>
                      <tr><td class="diff_chg">Changed</td> </tr>
                      <tr><td class="diff_sub">Deleted</td> </tr>
                  </table></td>
             <td> <table border="" summary="Links">
                      <tr><th colspan="2"> Links </th> </tr>
                      <tr><td>(f)irst change</td> </tr>
                      <tr><td>(n)ext change</td> </tr>
                      <tr><td>(t)op</td> </tr>
                  </table></td> </tr>
    </table>c@s�eZdZeZeZeZeZdZdddefdd�Z	dd	d
�dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zddd�ZdS)rr
�NcCs||_||_||_||_dS)N)�_tabsize�_wrapcolumn�	_linejunk�	_charjunk)r�tabsizeZ
wrapcolumnrmrnrrrr�szHtmlDiff.__init__rF�zutf-8)�charsetcCs:|jt|j|j|j||||||d�|d�j|d�j|�S)N)r��numlines)ZstylesZlegend�tabler��xmlcharrefreplace)�_file_templater��_styles�_legend�
make_tabler�r�)rr�r��fromdesc�todescr�r�r�rrr�	make_file�s
zHtmlDiff.make_filecs8�fdd���fdd�|D�}�fdd�|D�}||fS)Ncs6|jdd�}|j�j�}|jdd�}|jdd�jd�S)Nrqr�r�r�)rK�
expandtabsr�r�)rj)rrr�expand_tabs�sz2HtmlDiff._tab_newline_replace.<locals>.expand_tabscsg|]}�|��qSrr)rZrj)r�rrrdsz1HtmlDiff._tab_newline_replace.<locals>.<listcomp>csg|]}�|��qSrr)rZrj)r�rrrdsr)rr�r�r)r�rr�_tab_newline_replace�s
	zHtmlDiff._tab_newline_replacecCs|s|j||f�dSt|�}|j}||ksB||jd�d|krT|j||f�dSd}d}d}xd||kr�||kr�||dkr�|d7}||}|d7}qb||dkr�|d7}d}qb|d7}|d7}qbW|d|�}	||d�}
|r�|	d}	d||
}
|j||	f�|j|d|
�dS)Nr�rTr
rr%r��>)r)r.r��count�_split_line)rZ	data_listZline_numr�rQrVr0r3ZmarkZline1Zline2rrrr�s8

zHtmlDiff._split_lineccs�x�|D]�\}}}|dkr&|||fVq||\}}\}}gg}	}
|j|	||�|j|
||�x@|	sh|
r�|	rx|	jd�}nd}|
r�|
jd�}nd}|||fVq`WqWdS)Nr
rrq)rrq)rrq)r�r>)r�diffs�fromdata�todata�flagZfromlineZfromtextZtolineZtotext�fromlist�tolistrrr�
_line_wrapper;s 

zHtmlDiff._line_wrappercCs�ggg}}}xz|D]r\}}}y4|j|jd|f|���|j|jd|f|���Wn(tk
r||jd�|jd�YnX|j|�qW|||fS)Nr
r%)r)�_format_liner�)rr�r�r��flaglistr�r�r�rrr�_collect_linesWs
zHtmlDiff._collect_linescCsryd|}d|j||f}Wntk
r6d}YnX|jdd�jdd�jdd	�}|jd
d�j�}d|||fS)
Nz%dz
 id="%s%s"r�&z&amp;r�z&gt;�<z&lt;rqz&nbsp;z<<td class="diff_header"%s>%s</td><td nowrap="nowrap">%s</td>)�_prefixr�rKr�)rr�r�Zlinenumr��idrrrr�ls
zHtmlDiff._format_linecCs0dtj}dtj}tjd7_||g|_dS)Nzfrom%d_zto%d_r%)r�_default_prefixr�)rZ
fromprefix�toprefixrrr�_make_prefix�s

zHtmlDiff._make_prefixcCs�|jd}dgt|�}dgt|�}d\}	}
d}xbt|�D]V\}}
|
r�|
s�d}
|}td||g�}d||	f||<|	d7}	d||	f||<q<d}
q<W|s�dg}dg}dg}d}|r�dg}|}n
d	g}}|ds�d
||d<d|||<|||||fS)
Nr%rr
FTz id="difflib_chg_%s_%d"z"<a href="#difflib_chg_%s_%d">n</a>z2<td></td><td>&nbsp;No Differences Found&nbsp;</td>z(<td></td><td>&nbsp;Empty File&nbsp;</td>z!<a href="#difflib_chg_%s_0">f</a>z#<a href="#difflib_chg_%s_top">t</a>)r
F)r�r.r'rV)rr�r�r�r�r�r��next_id�	next_hrefZnum_chgZ	in_changer�r0r�rrr�_convert_flags�s:

zHtmlDiff._convert_flagsc	CsV|j�|j||�\}}|r"|}nd}t||||j|jd�}|jrL|j|�}|j|�\}	}
}|j|	|
|||�\}	}
}}}
g}d}x`t	t
|��D]P}||dkr�|dkr�|jd�q�|j||
||||	||||
|f�q�W|s�|�rddd|dd|f}nd	}|jt
d	j|�||jd
d�}|jdd
�jdd�jdd�jdd�jdd�S)N)rmrnz1            <tr><td class="diff_next"%s>%s</td>%sz%<td class="diff_next">%s</td>%s</tr>
r
z)        </tbody>        
        <tbody>
z <thead><tr>%s%s%s%s</tr></thead>z!<th class="diff_next"><br /></th>z+<th colspan="2" class="diff_header">%s</th>rr%)Z	data_rows�
header_rowr�z+z<span class="diff_add">z-z<span class="diff_sub">z^z<span class="diff_chg">r�z</span>r�z&nbsp;zV            <tr><td class="diff_next"%s>%s</td>%s<td class="diff_next">%s</td>%s</tr>
)r�r�r�r�r�r�r�r�rr5r.r)�_table_templater�r�r�rK)rr�r�r�r�r�r�Z
context_linesr�r�r�r�rrriZfmtr0rr�rrrr��sJ


zHtmlDiff.make_table)rrFr�)rrFr�)r`rarbr�r�rr�r�rrr�r�r�r�r�r�r�rr�rrrrr�s$7/ccspyddd�t|�}Wn tk
r6td|��YnXd|f}x*|D]"}|dd�|krF|dd�VqFWdS)Nz- z+ )r%r�z)unknown delta choice (must be 1 or 2): %rz  r�)�int�KeyErrorre)ZdeltaZwhichrR�prefixesrjrrrrs
cCsddl}ddl}|j|�S)Nr
)�doctest�difflibZtestmod)rr	rrr�_test,sr
�__main__)rTrc)r�)rrrrrTr�)rrrrrTr�)r�r�r�r�rTr�)#�__all__�heapqrrf�collectionsrZ_namedtuplerrrrrlrr�r��matchrrr�r	r�rr�r
rr�r�r�rr��objectrrr
r`rrrr�<module>s\


0O

H
K
%!	
a 
linecache.cpython-38.pyc000064400000007435150335716500011125 0ustar00U

e5d��@sndZddlZddlZddlZddlZdddgZddd�Ziadd�Zddd	�Z	dd
d�Z
ddd�Zd
d�ZdS)z�Cache lines from Python source files.

This is intended to read lines from modules imported -- hence if a filename
is not found, it will look down the module search path for a file by
that name.
�N�getline�
clearcache�
checkcachecCs:t||�}d|kr"t|�kr2nn||dSdSdS)N��)�getlines�len)�filename�lineno�module_globals�lines�r
�!/usr/lib64/python3.8/linecache.pyrs
cCsiadS)zClear the cache entirely.N)�cacher
r
r
rrscCsX|tkr(t|}t|�dkr(t|dSzt||�WStk
rRt�gYSXdS)z�Get the lines for a Python source file from the cache.
    Update the cache if it doesn't contain an entry for this file already.r�N)rr�updatecache�MemoryErrorr)r	r�entryr
r
rr%src	Cs�|dkrtt���}n|tkr&|g}ndS|D]�}t|}t|�dkrHq.|\}}}}|dkr^q.zt�|�}Wn$tk
r�t�|d�Yq.YnX||jks�||j	kr.t�|d�q.dS)zUDiscard cache entries that are out of date.
    (This is not checked upon each call!)Nr)
�listr�keysr�os�stat�OSError�pop�st_size�st_mtime)r	�	filenamesr�size�mtimer�fullnamerr
r
rr5s&
c
Cs�|tkr$tt|�dkr$t�|d�|r<|�d�r@|�d�r@gS|}zt�|�}W�ntk
�rn|}t||�r�zt|d�}Wnt	tfk
r�YnDX|dkr�gYSt|�ddd�|�
�D�|ft|<t|dYStj�|�r�gYSt
jD]d}ztj�||�}Wnttfk
�r0Yq�YnXzt�|�}W�qjWq�tk
�r^Yq�Xq�gYSYnXz"t�|��}|��}W5QRXWntk
�r�gYSX|�r�|d	�d
��s�|d	d
7<|j|j}	}
|	|
||ft|<|S)z�Update a cache entry and return its list of lines.
    If something's wrong, print a message, discard the cache entry,
    and return an empty list.rN�<�>rcSsg|]}|d�qS)�
r
)�.0�liner
r
r�
<listcomp>qszupdatecache.<locals>.<listcomp>r���r")rrr�
startswith�endswithrrr�	lazycache�ImportError�
splitlines�path�isabs�sys�join�	TypeError�AttributeError�tokenize�open�	readlinesrr)r	rrr�basename�data�dirname�fprrrr
r
rrRs\
�



rcCs�|tkr tt|�dkrdSdS|r8|�d�r<|�d�r<dS|r�d|kr�|�d�}|d}t|dd	�}|r�|r�t�||�}|ft|<dSdS)
a�Seed the cache for filename with module_globals.

    The module loader will be asked for the source only when getlines is
    called, not immediately.

    If there is an entry in the cache already, it is not altered.

    :return: True if a lazy load is registered in the cache,
        otherwise False. To register such a load a module loader with a
        get_source method must be found, the filename must be a cachable
        filename, and the filename must not be already cached.
    rTFr r!�
__loader__�__name__�
get_sourceN)rrr'r(�get�getattr�	functools�partial)r	r�name�loaderr;�	get_linesr
r
rr)�s


r))N)N)N)N)
�__doc__r>r.rr2�__all__rrrrrrr)r
r
r
r�<module>s




Aformatter.cpython-38.opt-2.pyc000064400000035403150335716500012151 0ustar00U

e5d';�@s�ddlZddlZejdedd�dZGdd�d�ZGdd�d�ZGd	d
�d
�ZGdd�de�ZGd
d�de�Z	ddd�Z
edkr�e
�dS)�Nz"the formatter module is deprecated�)�
stacklevelc@s�eZdZd'dd�Zdd�Zdd�Zdd	�Zd(d
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd)d#d$�Zd*d%d&�ZdS)+�
NullFormatterNcCs|dkrt�}||_dS�N)�
NullWriter�writer��selfr�r
�!/usr/lib64/python3.8/formatter.py�__init__)szNullFormatter.__init__cCsdSrr
�r	�	blankliner
r
r�
end_paragraph-�zNullFormatter.end_paragraphcCsdSrr
�r	r
r
r�add_line_break.rzNullFormatter.add_line_breakcOsdSrr
�r	�args�kwr
r
r�add_hor_rule/rzNullFormatter.add_hor_rulecCsdSrr
�r	�format�counterrr
r
r�add_label_data0rzNullFormatter.add_label_datacCsdSrr
�r	�datar
r
r�add_flowing_data1rzNullFormatter.add_flowing_datacCsdSrr
rr
r
r�add_literal_data2rzNullFormatter.add_literal_datacCsdSrr
rr
r
r�flush_softspace3rzNullFormatter.flush_softspacecCsdSrr
�r	�alignr
r
r�push_alignment4rzNullFormatter.push_alignmentcCsdSrr
rr
r
r�
pop_alignment5rzNullFormatter.pop_alignmentcCsdSrr
)r	�xr
r
r�	push_font6rzNullFormatter.push_fontcCsdSrr
rr
r
r�pop_font7rzNullFormatter.pop_fontcCsdSrr
)r	�marginr
r
r�push_margin8rzNullFormatter.push_margincCsdSrr
rr
r
r�
pop_margin9rzNullFormatter.pop_margincCsdSrr
�r	�spacingr
r
r�set_spacing:rzNullFormatter.set_spacingcGsdSrr
�r	�stylesr
r
r�
push_style;rzNullFormatter.push_style�cCsdSrr
�r	�nr
r
r�	pop_style<rzNullFormatter.pop_stylecCsdSrr
�r	�flagr
r
r�assert_line_data=rzNullFormatter.assert_line_data)N)N)r0)r0)�__name__�
__module__�__qualname__rrrrrrrrr"r#r%r&r(r)r,r/r3r6r
r
r
rrs$


rc@s�eZdZdd�Zdd�Zdd�Zdd�Zd-d
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd.d)d*�Zd/d+d,�Zd	S)0�AbstractFormattercCsR||_d|_g|_g|_g|_d|_g|_d|_d|_d|_	d|_
d|_d|_dS�Nr0r)
rr!�align_stack�
font_stack�margin_stackr+�style_stack�nospace�	softspace�para_end�parskip�
hard_break�
have_labelrr
r
rrNszAbstractFormatter.__init__cCs`|js|j��d|_|j|krD|jsD|j�||j�||_d|_d|_|_|_d|_dS�Nrr0)	rDr�send_line_breakrErC�send_paragraphr@rBrAr
r
r
rr]s
zAbstractFormatter.end_paragraphcCs8|js"|js"|j��d|_|_d|_|_d|_dSrF)rDrBrrGrErCr@rArr
r
rrhs

z AbstractFormatter.add_line_breakcOsF|js|j��|jj||�d|_|_d|_|_|_|_dSr;)	rDrrG�
send_hor_ruler@rErBrArCrr
r
rros

zAbstractFormatter.add_hor_ruleNcCs�|js|js|j��|js0|j�|r*dp,d�t|t�rP|j�|�	||��n|j�|�d|_
|_|_|_d|_|_dSr;)
rErDrrGrBrH�
isinstance�str�send_label_data�format_counterr@rArCrr
r
rrvs

z AbstractFormatter.add_label_datacCstd}|D]f}|dkr"|d|}q|dkrD|dkrn||�||�}q|dkrf|dkrn||�||�}q||}q|S)N��1z%dZaArZiI)�
format_letter�format_roman)r	rr�label�cr
r
rrM�s
z AbstractFormatter.format_countercCs<d}|dkr8t|dd�\}}tt|�|�}||}q|S)NrNrr0�)�divmod�chr�ord)r	�caserrRr$�sr
r
rrP�s
zAbstractFormatter.format_letterc	Cs�ddddg}dddg}d\}}|d	kr�t|d
�\}}|dkrV||||d|}nT|d
krt|||||}n6|dkr�||}|d}nd}||||}||}|d}q|dkr�|��S|S)N�ir$rS�m�v�l�d)rNrr�
�	r0��rN�I)rU�upper)	r	rXrZonesZfivesrR�indexr$rYr
r
rrQ�s&


zAbstractFormatter.format_romancCs�|sdS|dd���}|dd���}d�|���}|jrD|sDdS|sN|jrv|sh|jsdd|_d|_dS|jsvd|}d|_|_|_|_|_||_|j	�
|�dS)Nr0���� r)�isspace�join�splitr@rArCrDrBrEr�send_flowing_data)r	rZprespaceZ	postspacer
r
rr�s*

�z"AbstractFormatter.add_flowing_datacCsZ|sdS|jr|j�d�|dd�dk|_d|_|_|_|_|_|j�|�dS)Nrgrf�
r)	rArrkrDr@rBrCrE�send_literal_datarr
r
rr�s�z"AbstractFormatter.add_literal_datacCs:|jr6d|_|_|_|_|_d|_|j�d�dS�Nrr0rg)rArDrBrCrEr@rrkrr
r
rr�s�z!AbstractFormatter.flush_softspacecCs@|r.||jkr.|j�|�||_|j�|�n|j�|j�dSr)r!r�
new_alignmentr<�appendr r
r
rr"�s
z AbstractFormatter.push_alignmentcCsH|jr|jd=|jr2|jd|_}|j�|�nd|_|j�d�dS�Nrf)r<r!rror r
r
rr#�szAbstractFormatter.pop_alignmentc
Cs�|\}}}}|jr6d|_|_|_d|_|j�d�|jr~|jd\}}}}	|tkrZ|}|tkrf|}|tkrr|}|tkr~|	}||||f}|j�|�|j�	|�dS)Nrr0rgrf)
rArDrBr@rrkr=�AS_ISrp�new_font)
r	�font�sizerZ�bZttZcsizeZci�cbZcttr
r
rr%�s$zAbstractFormatter.push_fontcCs4|jr|jd=|jr |jd}nd}|j�|�dSrq)r=rrs�r	rtr
r
rr&�szAbstractFormatter.pop_fontcCsB|j�|�dd�|jD�}|s,|r,|d}|j�|t|��dS)NcSsg|]}|r|�qSr
r
��.0r[r
r
r�
<listcomp>sz1AbstractFormatter.push_margin.<locals>.<listcomp>rf)r>rpr�
new_margin�len)r	r'�fstackr
r
rr(s
zAbstractFormatter.push_margincCsF|jr|jd=dd�|jD�}|r,|d}nd}|j�|t|��dS)NrfcSsg|]}|r|�qSr
r
ryr
r
rr{
sz0AbstractFormatter.pop_margin.<locals>.<listcomp>)r>rr|r})r	r~r'r
r
rr)
s
zAbstractFormatter.pop_margincCs||_|j�|�dSr)r+r�new_spacingr*r
r
rr,szAbstractFormatter.set_spacingcGsV|jr*d|_|_|_d|_|j�d�|D]}|j�|�q.|j�t	|j��dSrn)
rArDrBr@rrkr?rp�
new_styles�tuple)r	r.Zstyler
r
rr/szAbstractFormatter.push_styler0cCs$|j|d�=|j�t|j��dSr)r?rr�r�r1r
r
rr3!szAbstractFormatter.pop_stylecCs$||_|_d|_|_|_dS�Nr)r@rDrBrCrEr4r
r
rr6%sz"AbstractFormatter.assert_line_data)N)r0)r0)r7r8r9rrrrrrMrPrQrrrr"r#r%r&r(r)r,r/r3r6r
r
r
rr:@s*
	
	
	
r:c@steZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)rcCsdSrr
rr
r
rr2rzNullWriter.__init__cCsdSrr
rr
r
r�flush3rzNullWriter.flushcCsdSrr
r r
r
rro4rzNullWriter.new_alignmentcCsdSrr
rxr
r
rrs5rzNullWriter.new_fontcCsdSrr
�r	r'�levelr
r
rr|6rzNullWriter.new_margincCsdSrr
r*r
r
rr7rzNullWriter.new_spacingcCsdSrr
r-r
r
rr�8rzNullWriter.new_stylescCsdSrr
r
r
r
rrH9rzNullWriter.send_paragraphcCsdSrr
rr
r
rrG:rzNullWriter.send_line_breakcOsdSrr
rr
r
rrI;rzNullWriter.send_hor_rulecCsdSrr
rr
r
rrL<rzNullWriter.send_label_datacCsdSrr
rr
r
rrk=rzNullWriter.send_flowing_datacCsdSrr
rr
r
rrm>rzNullWriter.send_literal_dataN)r7r8r9rr�rorsr|rr�rHrGrIrLrkrmr
r
r
rr*src@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�AbstractWritercCstd|f�dS)Nznew_alignment(%r)��printr r
r
rroIszAbstractWriter.new_alignmentcCstd|f�dS)Nznew_font(%r)r�rxr
r
rrsLszAbstractWriter.new_fontcCstd||f�dS)Nznew_margin(%r, %d)r�r�r
r
rr|OszAbstractWriter.new_margincCstd|f�dS)Nznew_spacing(%r)r�r*r
r
rrRszAbstractWriter.new_spacingcCstd|f�dS)Nznew_styles(%r)r�r-r
r
rr�UszAbstractWriter.new_stylescCstd|f�dS)Nzsend_paragraph(%r)r�r
r
r
rrHXszAbstractWriter.send_paragraphcCstd�dS)Nzsend_line_break()r�rr
r
rrG[szAbstractWriter.send_line_breakcOstd�dS)Nzsend_hor_rule()r�rr
r
rrI^szAbstractWriter.send_hor_rulecCstd|f�dS)Nzsend_label_data(%r)r�rr
r
rrLaszAbstractWriter.send_label_datacCstd|f�dS)Nzsend_flowing_data(%r)r�rr
r
rrkdsz AbstractWriter.send_flowing_datacCstd|f�dS)Nzsend_literal_data(%r)r�rr
r
rrmgsz AbstractWriter.send_literal_dataN)r7r8r9rorsr|rr�rHrGrIrLrkrmr
r
r
rr�Asr�c@sFeZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dS)�
DumbWriterN�HcCs(|ptj|_||_t�|�|��dSr)�sys�stdout�file�maxcolrr�reset)r	r�r�r
r
rrts
zDumbWriter.__init__cCsd|_d|_dSr�)�col�atbreakrr
r
rr�zszDumbWriter.resetcCs |j�d|�d|_d|_dS�Nrlr�r��writer�r�r
r
r
rrH~szDumbWriter.send_paragraphcCs|j�d�d|_d|_dSr�r�rr
r
rrG�szDumbWriter.send_line_breakcOs:|j�d�|j�d|j�|j�d�d|_d|_dS)Nrl�-r)r�r�r�r�r�rr
r
rrI�s
zDumbWriter.send_hor_rulecCsV|j�|�|�d�}|dkr4d|_||dd�}|��}|jt|�|_d|_dS)Nrlrr0)r�r��rfindr��
expandtabsr}r�)r	rrZr
r
rrm�s
zDumbWriter.send_literal_datacCs�|sdS|jp|d��}|j}|j}|jj}|��D]N}|rl|t|�|kr\|d�d}n|d�|d}||�|t|�}d}q6||_|d��|_dS)Nrrlrgr0rf)r�rhr�r�r�r�rjr})r	rr�r�r�r�Zwordr
r
rrk�s$zDumbWriter.send_flowing_data)Nr�)
r7r8r9rr�rHrGrIrmrkr
r
r
rr�ks	

r�cCs�t�}t|�}|dk	r t|�}n$tjdd�r>ttjd�}ntj}z,|D]"}|dkrb|�d�qJ|�|�qJW5|tjk	r�|��X|�d�dS)Nr0rlr)	r�r:�openr��argv�stdin�closerr)r��w�f�fp�liner
r
r�test�s


r��__main__)N)r��warnings�warn�DeprecationWarningrrrr:rr�r�r�r7r
r
r
r�<module>s�"k*C
re.cpython-38.pyc000064400000034130150335716500007610 0ustar00U

e5d�=�@s�dZddlZddlZddlZddlZzddlZWnek
rHdZYnXddddddd	d
ddd
ddddddddddddddddddgZd ZGd!d"�d"ej	�Z
e��e
j
�ejZd@d#d�ZdAd$d�ZdBd%d�ZdCd&d�ZdDd'd�ZdEd(d�ZdFd)d	�ZdGd*d
�ZdHd+d�Zd,d�ZdId-d
�Zd.d/�d0D�Zd1d�Zee�d2d��Zee�d2d��d2��ZiZd3Z d4d5�Z!e�"e �d6d7��Z#d8d9�Z$d:d;�Z%ddl&Z&d<d=�Z'e&�(ee'e!�Gd>d?�d?�Z)dS)Ja�Support for regular expressions (RE).

This module provides regular expression matching operations similar to
those found in Perl.  It supports both 8-bit and Unicode strings; both
the pattern and the strings being processed can contain null bytes and
characters outside the US ASCII range.

Regular expressions can contain both special and ordinary characters.
Most ordinary characters, like "A", "a", or "0", are the simplest
regular expressions; they simply match themselves.  You can
concatenate ordinary characters, so last matches the string 'last'.

The special characters are:
    "."      Matches any character except a newline.
    "^"      Matches the start of the string.
    "$"      Matches the end of the string or just before the newline at
             the end of the string.
    "*"      Matches 0 or more (greedy) repetitions of the preceding RE.
             Greedy means that it will match as many repetitions as possible.
    "+"      Matches 1 or more (greedy) repetitions of the preceding RE.
    "?"      Matches 0 or 1 (greedy) of the preceding RE.
    *?,+?,?? Non-greedy versions of the previous three special characters.
    {m,n}    Matches from m to n repetitions of the preceding RE.
    {m,n}?   Non-greedy version of the above.
    "\\"     Either escapes special characters or signals a special sequence.
    []       Indicates a set of characters.
             A "^" as the first character indicates a complementing set.
    "|"      A|B, creates an RE that will match either A or B.
    (...)    Matches the RE inside the parentheses.
             The contents can be retrieved or matched later in the string.
    (?aiLmsux) The letters set the corresponding flags defined below.
    (?:...)  Non-grouping version of regular parentheses.
    (?P<name>...) The substring matched by the group is accessible by name.
    (?P=name)     Matches the text matched earlier by the group named name.
    (?#...)  A comment; ignored.
    (?=...)  Matches if ... matches next, but doesn't consume the string.
    (?!...)  Matches if ... doesn't match next.
    (?<=...) Matches if preceded by ... (must be fixed length).
    (?<!...) Matches if not preceded by ... (must be fixed length).
    (?(id/name)yes|no) Matches yes pattern if the group with id/name matched,
                       the (optional) no pattern otherwise.

The special sequences consist of "\\" and a character from the list
below.  If the ordinary character is not on the list, then the
resulting RE will match the second character.
    \number  Matches the contents of the group of the same number.
    \A       Matches only at the start of the string.
    \Z       Matches only at the end of the string.
    \b       Matches the empty string, but only at the start or end of a word.
    \B       Matches the empty string, but not at the start or end of a word.
    \d       Matches any decimal digit; equivalent to the set [0-9] in
             bytes patterns or string patterns with the ASCII flag.
             In string patterns without the ASCII flag, it will match the whole
             range of Unicode digits.
    \D       Matches any non-digit character; equivalent to [^\d].
    \s       Matches any whitespace character; equivalent to [ \t\n\r\f\v] in
             bytes patterns or string patterns with the ASCII flag.
             In string patterns without the ASCII flag, it will match the whole
             range of Unicode whitespace characters.
    \S       Matches any non-whitespace character; equivalent to [^\s].
    \w       Matches any alphanumeric character; equivalent to [a-zA-Z0-9_]
             in bytes patterns or string patterns with the ASCII flag.
             In string patterns without the ASCII flag, it will match the
             range of Unicode alphanumeric characters (letters plus digits
             plus underscore).
             With LOCALE, it will match the set [0-9_] plus characters defined
             as letters for the current locale.
    \W       Matches the complement of \w.
    \\       Matches a literal backslash.

This module exports the following functions:
    match     Match a regular expression pattern to the beginning of a string.
    fullmatch Match a regular expression pattern to all of a string.
    search    Search a string for the presence of a pattern.
    sub       Substitute occurrences of a pattern found in a string.
    subn      Same as sub, but also return the number of substitutions made.
    split     Split a string by the occurrences of a pattern.
    findall   Find all occurrences of a pattern in a string.
    finditer  Return an iterator yielding a Match object for each match.
    compile   Compile a pattern into a Pattern object.
    purge     Clear the regular expression cache.
    escape    Backslash all non-alphanumerics in a string.

Each function other than purge and escape can take an optional 'flags' argument
consisting of one or more of the following module constants, joined by "|".
A, L, and U are mutually exclusive.
    A  ASCII       For string patterns, make \w, \W, \b, \B, \d, \D
                   match the corresponding ASCII character categories
                   (rather than the whole Unicode categories, which is the
                   default).
                   For bytes patterns, this flag is the only available
                   behaviour and needn't be specified.
    I  IGNORECASE  Perform case-insensitive matching.
    L  LOCALE      Make \w, \W, \b, \B, dependent on the current locale.
    M  MULTILINE   "^" matches the beginning of lines (after a newline)
                   as well as the string.
                   "$" matches the end of lines (before a newline) as well
                   as the end of the string.
    S  DOTALL      "." matches any character at all, including the newline.
    X  VERBOSE     Ignore whitespace and comments for nicer looking RE's.
    U  UNICODE     For compatibility only. Ignored for string patterns (it
                   is the default), and forbidden for bytes patterns.

This module also defines an exception 'error'.

�N�match�	fullmatch�search�sub�subn�split�findall�finditer�compile�purge�template�escape�error�Pattern�Match�A�I�L�M�S�X�U�ASCII�
IGNORECASE�LOCALE�	MULTILINE�DOTALL�VERBOSE�UNICODEz2.2.1c@speZdZejZZejZZ	ej
ZZej
ZZejZZejZZejZZejZZejZdd�Zej Z dS)�	RegexFlagcCs�|jdk	rd|j��S|j}g}|dk}|r2|}|jD],}||j@r8||jM}|�d|j���q8|rx|�t|��d�|�}|r�t|�dkr�d|�d�}n
d|��}|S)Nzre.r�|�z~(�)�~)�_name_�_value_�	__class__�append�hex�join�len)�self�value�members�negative�m�res�r1�/usr/lib64/python3.8/re.py�__repr__�s&




zRegexFlag.__repr__N)!�__name__�
__module__�__qualname__�sre_compile�SRE_FLAG_ASCIIrr�SRE_FLAG_IGNORECASErr�SRE_FLAG_LOCALErr�SRE_FLAG_UNICODErr�SRE_FLAG_MULTILINErr�SRE_FLAG_DOTALLrr�SRE_FLAG_VERBOSErr�SRE_FLAG_TEMPLATE�TEMPLATE�T�SRE_FLAG_DEBUG�DEBUGr3�object�__str__r1r1r1r2r�s







rcCst||��|�S)zqTry to apply the pattern at the start of the string, returning
    a Match object, or None if no match was found.)�_compiler��pattern�string�flagsr1r1r2r�scCst||��|�S)zkTry to apply the pattern to all of the string, returning
    a Match object, or None if no match was found.)rFrrGr1r1r2r�scCst||��|�S)ztScan through string looking for a match to the pattern, returning
    a Match object, or None if no match was found.)rFrrGr1r1r2r�scCst||��|||�S)aZReturn the string obtained by replacing the leftmost
    non-overlapping occurrences of the pattern in string by the
    replacement repl.  repl can be either a string or a callable;
    if a string, backslash escapes in it are processed.  If it is
    a callable, it's passed the Match object and must return
    a replacement string to be used.)rFr�rH�replrI�countrJr1r1r2r�scCst||��|||�S)a�Return a 2-tuple containing (new_string, number).
    new_string is the string obtained by replacing the leftmost
    non-overlapping occurrences of the pattern in the source
    string by the replacement repl.  number is the number of
    substitutions that were made. repl can be either a string or a
    callable; if a string, backslash escapes in it are processed.
    If it is a callable, it's passed the Match object and must
    return a replacement string to be used.)rFrrKr1r1r2r�s	cCst||��||�S)a�Split the source string by the occurrences of the pattern,
    returning a list containing the resulting substrings.  If
    capturing parentheses are used in pattern, then the text of all
    groups in the pattern are also returned as part of the resulting
    list.  If maxsplit is nonzero, at most maxsplit splits occur,
    and the remainder of the string is returned as the final element
    of the list.)rFr)rHrI�maxsplitrJr1r1r2r�scCst||��|�S)aReturn a list of all non-overlapping matches in the string.

    If one or more capturing groups are present in the pattern, return
    a list of groups; this will be a list of tuples if the pattern
    has more than one group.

    Empty matches are included in the result.)rFrrGr1r1r2r�scCst||��|�S)z�Return an iterator over all non-overlapping matches in the
    string.  For each match, the iterator returns a Match object.

    Empty matches are included in the result.)rFr	rGr1r1r2r	�scCs
t||�S)zACompile a regular expression pattern, returning a Pattern object.)rF�rHrJr1r1r2r
�scCst��t��dS)z#Clear the regular expression cachesN)�_cache�clear�
_compile_repl�cache_clearr1r1r1r2r�scCst||tB�S)z6Compile a template pattern, returning a Pattern object)rFrArOr1r1r2rscCsi|]}|dt|��qS)�\)�chr)�.0�ir1r1r2�
<dictcomp>srXs()[]{}?*+-|^$\.&~# 	

cCs2t|t�r|�t�St|d�}|�t��d�SdS)z0
    Escape special characters in a string.
    �latin1N)�
isinstance�str�	translate�_special_chars_map�encode)rHr1r1r2r
s


�ic
Cs�t|t�r|j}ztt|�||fWStk
r8YnXt|t�rT|rPtd��|St�	|�sft
d��t�||�}|t@s�t
t�tkr�ztttt��=Wntttfk
r�YnX|tt|�||f<|S)Nz5cannot process flags argument with a compiled patternz1first argument must be string or compiled pattern)rZrr,rP�type�KeyErrorr�
ValueErrorr7�isstring�	TypeErrorr
rCr*�	_MAXCACHE�next�iter�
StopIteration�RuntimeError)rHrJ�pr1r1r2rF!s.

�
rFcCst�||�S�N)�	sre_parse�parse_template)rLrHr1r1r2rR;srRcCst�||�}t�||�Srk)rlrm�expand_template)rHrrr1r1r2�_expand@srocCs>t||�}|ds.t|d�dkr.|ddS|fdd�}|S)Nrr!cSst�||�Srk)rlrn)rrr1r1r2�filterKsz_subx.<locals>.filter)rRr*)rHrrpr1r1r2�_subxEs

rqcCst|j|jffSrk)rFrHrJ)rjr1r1r2�_pickleSsrrc@seZdZddd�Zdd�ZdS)�Scannerrc
Cs�ddlm}m}t|t�r |j}||_g}t��}||_	|D]H\}}|�
�}	|�t�|||	ddt�
||�ffg��|�|	|d�q<t�||d|ffg�}t�|�|_dS)Nr)�BRANCH�
SUBPATTERN���)�
sre_constantsrtrurZrr,�lexiconrl�StaterJ�	opengroupr'�
SubPattern�parse�
closegroupr7r
�scanner)
r+rxrJrtrurj�s�phrase�action�gidr1r1r2�__init__\s

�zScanner.__init__c	Cs�g}|j}|j�|�j}d}|�}|s(q�|��}||kr:q�|j|jdd}t|�rj||_|||���}|dk	rz||�|}q|||d�fS)Nrr!)r'r~r�endrx�	lastindex�callable�group)	r+rI�resultr'rrWr/�jr�r1r1r2�scanms$zScanner.scanN)r)r4r5r6r�r�r1r1r1r2rs[s
rs)r)r)r)rr)rr)rr)r)r)r)r)*�__doc__�enumr7rl�	functools�_locale�ImportError�__all__�__version__�IntFlagr�globals�update�__members__rrrrrrrrr	r
rrr]r
r`rrrPrerF�	lru_cacherRrorq�copyregrr�picklersr1r1r1r2�<module>s�k
�#



	







	

bisect.cpython-38.opt-2.pyc000064400000002024150335716500011410 0ustar00U

e5d��@sVddd�Zddd�Zd
dd�Zddd	�Zzdd
lTWnek
rHYnXeZeZdS)�NcCst||||�}|�||�dS�N)�bisect_right�insert��a�x�lo�hi�r
�/usr/lib64/python3.8/bisect.py�insort_rights	rcCsT|dkrtd��|dkr t|�}||krP||d}|||krF|}q |d}q |S�Nrzlo must be non-negative����
ValueError�len�rrrr	Zmidr
r
rrs
rcCst||||�}|�||�dSr)�bisect_leftrrr
r
r�insort_left$s	rcCsT|dkrtd��|dkr t|�}||krP||d}|||krJ|d}q |}q |Sr
rrr
r
rr1s
r)�*)rN)rN)rN)rN)rrrrZ_bisect�ImportErrorZbisectZinsortr
r
r
r�<module>s



hmac.cpython-38.opt-1.pyc000064400000016352150335716500011057 0ustar00U

&�.e��@s�dZddlZddlmZzddlZWnek
r@dZdZ	YnXe
ej�Z	ddlZddlZ
ddlZedd�ed�D��Zedd�ed�D��ZdZGdd	�d	�Zd
d�ZGdd
�d
ej�Ze
��r�eZddd�Zdd�ZdS)zqHMAC (Keyed-Hashing for Message Authentication) module.

Implements the HMAC algorithm as described by RFC 2104.
�N)�_compare_digestccs|]}|dAVqdS)�\N���.0�xrr�/usr/lib64/python3.8/hmac.py�	<genexpr>sr	�ccs|]}|dAVqdS)�6Nrrrrrr	sc@sReZdZdZdZddd�Zedd��Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�ZdS)�HMACz~RFC 2104 HMAC class.  Also complies with RFC 4231.

    This supports the API for Cryptographic Hash Functions (PEP 247).
    �@N�csVt��rtd��t|ttf�s0tdt|�j���s<td��t	��rL�|_
n,t�t�rhd�fdd�	|_
nd�fdd�	|_
|�
�|_|�
�|_
|j
j|_t|j
d�r�|j
j}|d	kr�t�d
||jftd�|j}nt�d|jtd�|j}||_t|�|k�r|�
|���}|�|d
�}|j�|�t��|j
�|�t��|dk	�rR|�|�dS)a?Create a new HMAC object.

        key: bytes or buffer, key for the keyed hash object.
        msg: bytes or buffer, Initial input for the hash or None.
        digestmod: A hash name suitable for hashlib.new(). *OR*
                   A hashlib constructor returning a new hash object. *OR*
                   A module supporting PEP 247.

                   Required as of 3.8, despite its position after the optional
                   msg argument.  Passing it as a keyword argument is
                   recommended, though not required for legacy API reasons.
        z9This class is not available in FIPS mode. Use hmac.new().�,key: expected bytes or bytearray, but got %rz'Missing required parameter 'digestmod'.�cst��|�S�N��_hashlib�new��d��	digestmodrr�<lambda>?rzHMAC.__init__.<locals>.<lambda>cs
��|�Sr�rrrrrrAr�
block_size�z:block_size of %d seems too small; using our default of %d.�z<No block_size attribute on given digest object; Assuming %d.�N)r)r)�_hashlibopenssl�
get_fips_mode�
ValueError�
isinstance�bytes�	bytearray�	TypeError�type�__name__�callable�digest_cons�str�outer�inner�digest_size�hasattrr�	_warnings�warn�	blocksize�RuntimeWarning�len�digest�ljust�update�	translate�trans_5C�trans_36)�self�key�msgrr1rrr�__init__#sR
�



����
z
HMAC.__init__cCsd|jjS)Nzhmac-)r,�name)r:rrrr>asz	HMAC.namecCs t��rtd��|j�|�dS)z,Feed data from msg into this hashing object.z'hmac.HMAC is not available in FIPS modeN)rr r!r,r6)r:r<rrrr6eszHMAC.updatecCs:|j�|j�}|j|_|j|_|j��|_|j��|_|S)zyReturn a separate copy of this hashing object.

        An update to this copy won't affect the original object.
        )�	__class__�__new__r)r-r,�copyr+)r:�otherrrrrAksz	HMAC.copycCs|j��}|�|j���|S)zwReturn a hash object for the current state.

        To be used only internally with digest() and hexdigest().
        )r+rAr6r,r4�r:�hrrr�_currentxs
z
HMAC._currentcCs|��}|��S)z�Return the hash value of this hashing object.

        This returns the hmac value as bytes.  The object is
        not altered in any way by this function; you can continue
        updating the object after calling this function.
        )rEr4rCrrrr4�szHMAC.digestcCs|��}|��S)zKLike digest(), but returns a string of hexadecimal digits instead.
        )rE�	hexdigestrCrrrrF�szHMAC.hexdigest)Nr)
r'�
__module__�__qualname__�__doc__r1r=�propertyr>r6rArEr4rFrrrrrs
>

	
rcCsHt|t�r|��St|�r"|d�}t|tj�s6td��|j���dd�S)Nrz6Only OpenSSL hashlib hashes are accepted in FIPS mode.�_�-)	r"r*�lowerr(rZHASHr%r>�replacerrrr�_get_openssl_name�s
�rOc@seZdZddd�ZdS)�HMAC_opensslNcCsLt|ttf�s tdt|�j��t|�}tjj	|||d�}|rH|�
|�|S)Nrr)r"r#r$r%r&r'rO�_hmacopensslrr@r6)�clsr;r<rr>�resultrrrr@�s
zHMAC_openssl.__new__)NN)r'rGrHr@rrrrrP�srPrcCst|||�S)a�Create a new hashing object and return it.

    key: bytes or buffer, The starting key for the hash.
    msg: bytes or buffer, Initial input for the hash, or None.
    digestmod: A hash name suitable for hashlib.new(). *OR*
               A hashlib constructor returning a new hash object. *OR*
               A module supporting PEP 247.

               Required as of 3.8, despite its position after the optional
               msg argument.  Passing it as a keyword argument is
               recommended, though not required for legacy API reasons.

    You can now feed arbitrary bytes into the object using its update()
    method, and can ask for the hash value at any time by calling its digest()
    or hexdigest() methods.
    )r)r;r<rrrrr�srcs�tdk	r(t�t�r(�tkr(t�||��St��r6�}n(t�t�rPd	�fdd�	}nd
�fdd�	}|�}|�}t|dd�}t|�|kr�||���}|d|t|�}|�	|�
t��|�	|�
t��|�	|�|�	|���|��S)aJFast inline implementation of HMAC.

    key: bytes or buffer, The key for the keyed hash object.
    msg: bytes or buffer, Input message.
    digest: A hash name suitable for hashlib.new() for best performance. *OR*
            A hashlib constructor returning a new hash object. *OR*
            A module supporting PEP 247.
    Nrcst��|�Srrr�r4rrr�rzdigest.<locals>.<lambda>cs
��|�SrrrrTrrr�rrr
r)r)r)
�_hashopensslr"r*�_openssl_md_methsZhmac_digestr(�getattrr3r4r6r7r9r8)r;r<r4r)r,r+r1rrTrr4�s,	��

r4)Nr)rI�warningsr/�	_operatorrZcompare_digestrrU�ImportErrorrV�	frozensetZopenssl_md_meth_namesZhashlibrrQr#�ranger8r9r-rrOrPr rr4rrrr�<module>s*

u
abc.cpython-38.opt-2.pyc000064400000006216150335716500010673 0ustar00U

e5d��@s�dd�ZGdd�de�ZGdd�de�ZGdd�de�Zz,dd	lmZm	Z	m
Z
mZmZm
Z
mZmZWn*ek
r�dd
lmZmZde_YnXGdd
�d
e�ZGdd�ded�ZdS)cCs
d|_|S�NT)�__isabstractmethod__)�funcobj�r�/usr/lib64/python3.8/abc.py�abstractmethodsrcs eZdZdZ�fdd�Z�ZS)�abstractclassmethodTcsd|_t��|�dSr�r�super�__init__��self�callable��	__class__rrr
$szabstractclassmethod.__init__��__name__�
__module__�__qualname__rr
�
__classcell__rrrrrsrcs eZdZdZ�fdd�Z�ZS)�abstractstaticmethodTcsd|_t��|�dSrrrrrrr
1szabstractstaticmethod.__init__rrrrrr)src@seZdZdZdS)�abstractpropertyTN)rrrrrrrrr6sr�)�get_cache_token�	_abc_init�
_abc_register�_abc_instancecheck�_abc_subclasscheck�	_get_dump�_reset_registry�
_reset_caches)�ABCMetar�abccsNeZdZ�fdd�Zdd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Z	�Z
S)r cs"t�j||||f|�}t|�|S�N)r	�__new__r)�mcls�name�bases�	namespace�kwargs�clsrrrr#TszABCMeta.__new__cCs
t||�Sr")r�r)�subclassrrr�registerYszABCMeta.registercCs
t||�Sr")r)r)�instancerrr�__instancecheck__`szABCMeta.__instancecheck__cCs
t||�Sr")rr*rrr�__subclasscheck__dszABCMeta.__subclasscheck__NcCs�td|j�d|j��|d�tdt���|d�t|�\}}}}td|��|d�td|��|d�td|��|d�td|��|d�dS)	NzClass: �.)�filezInv. counter: z_abc_registry: z_abc_cache: z_abc_negative_cache: z_abc_negative_cache_version: )�printrrrr)r)r1�
_abc_registry�
_abc_cache�_abc_negative_cache�_abc_negative_cache_versionrrr�_dump_registryhs�
�zABCMeta._dump_registrycCst|�dSr")r�r)rrr�_abc_registry_cleartszABCMeta._abc_registry_clearcCst|�dSr")rr8rrr�_abc_caches_clearxszABCMeta._abc_caches_clear)N)rrrr#r,r.r/r7r9r:rrrrrr Gs

r c@seZdZdZdS)�ABCrN)rrr�	__slots__rrrrr;}sr;)�	metaclassN)r�classmethodr�staticmethodr�propertyr�_abcrrrrrrrr�ImportErrorZ_py_abcr r�typer;rrrr�<module>s

	,6binhex.cpython-38.pyc000064400000027550150335716500010467 0ustar00U

e5d�6�@s�dZddlZddlZddlZddlZdddgZGdd�de�ZdZdZ	dZ
d	Zd
ZGdd�d�Z
d
d�ZGdd�d�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�ZdS)z�Macintosh binhex compression/decompression.

easy interface:
binhex(inputfilename, outputfilename)
hexbin(inputfilename, outputfilename)
�N�binhex�hexbin�Errorc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.8/binhex.pyrs�i��@��c@seZdZdd�ZdS)�FInfocCsd|_d|_d|_dS)Nz????r)�Type�Creator�Flags��selfrrr	�__init__0szFInfo.__init__N)rrrrrrrr	r
/sr
c	Cstt�}t�|d��2}|�d�}d|kr,d|_|�dd�|��}W5QRXtj�	|�\}}|�
ddd�}|||dfS)	N�rbirZTEXT��:�-r
)r
�io�open�readr�seek�tell�os�path�split�replace)�name�finfo�fp�dataZdsize�dir�filerrr	�getfileinfo5s
r'c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�openrsrccGsdS�Nr�r�argsrrr	rCszopenrsrc.__init__cGsdS�N�rr*rrr	rFsz
openrsrc.readcGsdSr)rr*rrr	�writeIszopenrsrc.writecCsdSr)rrrrr	�closeLszopenrsrc.closeN)rrrrrr.r/rrrr	r(Bsr(c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_Hqxcoderenginez(Write data to the coder in 3-byte chunkscCs ||_d|_d|_td|_dS)Nr-r
)�ofpr$�hqxdata�LINELEN�linelen�rr1rrr	rRsz_Hqxcoderengine.__init__cCsh|j||_t|j�}|dd}|jd|�}|j|d�|_|sHdS|jt�|�|_|�d�dS)N�r)r$�lenr2�binascii�b2a_hqx�_flush)rr$ZdatalenZtodorrr	r.Xs
z_Hqxcoderengine.writecCsrd}|t|j�|jkrH||j}|j�|j||�d�t|_|}q|j|d�|_|rn|j�|jd�dS)Nr�
s:
)r7r2r4r1r.r3)rZforce�firstZlastrrr	r:cs
z_Hqxcoderengine._flushcCs6|jr|jt�|j�|_|�d�|j��|`dS)Nr
)r$r2r8r9r:r1r/rrrr	r/ns


z_Hqxcoderengine.closeN)rrr�__doc__rr.r:r/rrrr	r0Os
r0c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_Rlecoderenginez4Write data to the RLE-coder in suitably large chunkscCs||_d|_dSr,)r1r$r5rrr	rxsz_Rlecoderengine.__init__cCs@|j||_t|j�tkrdSt�|j�}|j�|�d|_dSr,)r$r7�REASONABLY_LARGEr8�rlecode_hqxr1r.)rr$�rledatarrr	r.|sz_Rlecoderengine.writecCs0|jrt�|j�}|j�|�|j��|`dSr))r$r8r@r1r.r/)rrArrr	r/�s

z_Rlecoderengine.closeN)rrrr=rr.r/rrrr	r>usr>c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�BinHexc
Cs�|\}}}}d}t|t�r.|}t�|d�}d}zR|�d�t|�}	t|	�|_d|_|dkr`t	�}||_
||_|�||�t
|_Wn|r�|���YnXdS)NF�wbTs0(This file must be converted with BinHex 4.0)

:r)�
isinstance�strrrr.r0r>r1�crcr
�dlen�rlen�
_writeinfo�_DID_HEADER�stater/)
rZname_finfo_dlen_rlenr1r!r"rGrHZclose_on_errorZofnameZhqxerrrr	r�s*



zBinHex.__init__cCs�t|�}|dkrtd��t|g�|�d�d}|j|j}}t|t�rR|�d�}t|t�rf|�d�}||}t�	d|j
�}t�	d|j|j�}	||||	}
|�
|
�|��dS)N�?zFilename too longzlatin-1��>hz>ii)r7r�bytes�encoderrrDrE�struct�packrrGrH�_write�	_writecrc)rr!r"�nl�d�tpZcrZd2Zd3Zd4�inforrr	rI�s




zBinHex._writeinfocCs t�||j�|_|j�|�dSr))r8�crc_hqxrFr1r.�rr$rrr	rS�sz
BinHex._writecCs4|jdkrd}nd}|j�t�||j��d|_dS)NrrNz>H)rFr1r.rQrR)rZfmtrrr	rT�s

zBinHex._writecrccCs0|jtkrtd��|jt|�|_|�|�dS)NzWriting data at the wrong time)rKrJrrGr7rSrZrrr	r.�s
zBinHex.writecCs,|jdkrtd|jf��|��t|_dS)NrzIncorrect data size, diff=%r)rGrrHrT�	_DID_DATArKrrrr	�
close_data�s
zBinHex.close_datacCsB|jtkr|��|jtkr$td��|jt|�|_|�|�dS)Nz'Writing resource data at the wrong time)rKr[r\rrHr7rSrZrrr	�
write_rsrc�s

zBinHex.write_rsrccCsx|jdkrdSzJ|jtkr"|��|jtkr4td��|jdkrNtd|jf��|��W5d|_|j}|`|��XdS)NzClose at the wrong timerz$Incorrect resource-datasize, diff=%r)rKr1r/r[r\rrHrTr5rrr	r/�s



zBinHex.closeN)rrrrrIrSrTr.r\r]r/rrrr	rB�s
rBc	Cs�t|�}t||�}t�|d��*}|�d�}|s0q<|�|�q |��W5QRXt|d�}|�d�}|shqt|�|�qX|�	�|�	�dS)zEbinhex(infilename, outfilename): create binhex-encoded copy of a filer��N)
r'rBrrrr.r\r(r]r/)�inp�outr"r1�ifprVrrr	r�s



c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_Hqxdecoderenginez*Read data via the decoder in 4-byte chunkscCs||_d|_dS)Nr)ra�eof�rrarrr	rsz_Hqxdecoderengine.__init__cCs�d}|}|dkr�|jr|S|ddd}|j�|�}zt�|�\}|_Wq�Wntjk
rdYnX|j�d�}|s~td��||}q6||}|t|�}|s|jstd��q|S)z&Read at least wtd bytes (or until EOF)r-rrr6�r
zPremature EOF on binhex file)rcrarr8Za2b_hqxZ
Incompleterr7)rZtotalwtdZdecdata�wtdr$Z
decdatacur�newdatarrr	rs*


z_Hqxdecoderengine.readcCs|j��dSr)�rar/rrrr	r/%sz_Hqxdecoderengine.closeN)rrrr=rrr/rrrr	rb�s rbc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_RledecoderenginezRead data via the RLE-codercCs||_d|_d|_d|_dS)Nr-r)ra�
pre_buffer�post_bufferrcrdrrr	r+sz_Rledecoderengine.__init__cCsD|t|j�kr"|�|t|j��|jd|�}|j|d�|_|Sr))r7rk�_fill)rrf�rvrrr	r1s
z_Rledecoderengine.readcCs�|j|j�|d�|_|jjr>|jt�|j�|_d|_dSt|j�}|jdd�tdtkrl|d}nX|jdd�tkr�|d}n<|jdd�tdkr�|d}n|jdd�tkr�n|d	}|jt�|jd|��|_|j|d�|_dS)
Nrer-���rMr6���r���r
)	rjrarrcrkr8Z
rledecode_hqxr7�RUNCHAR)rrfZmarkrrr	rl8s*
�



�z_Rledecoderengine._fillcCs|j��dSr)rhrrrr	r/[sz_Rledecoderengine.closeN)rrrr=rrrlr/rrrr	ri(s
#ric@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�HexBincCsft|t�rt�|d�}|�d�}|s,td��|dkr6q|dkrqBqt|�}t|�|_d|_	|�
�dS)Nrr
zNo binhex data foundr;�:r)rDrErrrrrbrirarF�_readheader)rraZchZhqxifprrr	r_s


zHexBin.__init__cCs |j�|�}t�||j�|_|Sr))rarr8rYrF)rr7r$rrr	�_readuszHexBin._readcCsNt�d|j�d��dd@}|jd@|_||jkrDtd|j|f��d|_dS)NrNrri��zCRC error, computed %x, read %x)rQ�unpackrarrFr)rZfilecrcrrr	�	_checkcrczs
�zHexBin._checkcrccCs�|�d�}|�t|��}|�d�}|��|dd�}|dd�}t�d|dd��d}t�d|dd	��d|_t�d|d	d��d|_||_t�|_||j_	||j_
||j_t|_
dS)
Nr
���	rN�rz>l�)ru�ordrwrQrvrGrH�FNamer
rrrrJrK)rr7Zfname�rest�typeZcreator�flagsrrr	rt�s

zHexBin._readheadercGsj|jtkrtd��|r,|d}t||j�}n|j}d}t|�|krZ||�|t|��}q6|j||_|S)NzRead data at wrong timerr-)rKrJr�minrGr7ru)r�nrmrrr	r�s
zHexBin.readcCs6|jtkrtd��|jr$|�|j�}|��t|_dS)Nzclose_data at wrong time)rKrJrrGrurwr[�rZdummyrrr	r\�s
zHexBin.close_datacGsZ|jtkr|��|jtkr$td��|r>|d}t||j�}n|j}|j||_|�|�S)Nz Read resource data at wrong timer)rKrJr\r[rr�rHru)rr�rrr	�	read_rsrc�s

zHexBin.read_rsrccCsD|jdkrdSz|jr"|�|j�}|��W5d|_|j��XdSr))rKrar/rHr�rwr�rrr	r/�s
zHexBin.closeN)rrrrrurwrtrr\r�r/rrrr	rr^s

rrc	Cs�t|�}|j}|s|j}t�|d��"}|�d�}|s6qB|�|�q&W5QRX|��|�d�}|r�t	|d�}|�|�|�d�}|s�q�|�|�qv|�
�|�
�dS)z6hexbin(infilename, outfilename) - Decode binhexed filerCr^N)rrr
r~rrrr.r\r�r(r/)r_r`rar"r1rVrrr	r�s(




)r=rrrQr8�__all__�	ExceptionrrJr[r?r3rqr
r'r(r0r>rBrrbrirrrrrrr	�<module>s,


&^*6h_py_abc.cpython-38.pyc000064400000011100150335716500010566 0ustar00U

e5d-�@s(ddlmZdd�ZGdd�de�ZdS)�)�WeakSetcCstjS)z�Returns the current ABC cache token.

    The token is an opaque object (supporting equality testing) identifying the
    current version of the ABC cache for virtual subclasses. The token changes
    with every call to ``register()`` on any ABC.
    )�ABCMeta�_abc_invalidation_counter�rr�/usr/lib64/python3.8/_py_abc.py�get_cache_tokensrcsVeZdZdZdZ�fdd�Zdd�Zddd	�Zd
d�Zdd
�Z	dd�Z
dd�Z�ZS)rahMetaclass for defining Abstract Base Classes (ABCs).

    Use this metaclass to create an ABC.  An ABC can be subclassed
    directly, and then acts as a mix-in class.  You can also register
    unrelated concrete classes (even built-in classes) and unrelated
    ABCs as 'virtual subclasses' -- these and their descendants will
    be considered subclasses of the registering ABC by the built-in
    issubclass() function, but the registering ABC won't show up in
    their MRO (Method Resolution Order) nor will method
    implementations defined by the registering ABC be callable (not
    even via super()).
    rc	s�t�j||||f|�}dd�|��D�}|D]:}t|dt��D]&}t||d�}t|dd�r>|�|�q>q,t|�|_t�|_	t�|_
t�|_tj
|_|S)NcSs h|]\}}t|dd�r|�qS)�__isabstractmethod__F)�getattr)�.0�name�valuerrr�	<setcomp>&s�z"ABCMeta.__new__.<locals>.<setcomp>�__abstractmethods__rF)�super�__new__�itemsr	�set�add�	frozensetrr�
_abc_registry�
_abc_cache�_abc_negative_cacherr�_abc_negative_cache_version)	�mclsr�bases�	namespace�kwargs�clsZ	abstracts�baser��	__class__rrr#s�
zABCMeta.__new__cCsPt|t�std��t||�r |St||�r2td��|j�|�tjd7_|S)zsRegister a virtual subclass of an ABC.

        Returns the subclass, to allow usage as a class decorator.
        zCan only register classesz'Refusing to create an inheritance cycle�)	�
isinstance�type�	TypeError�
issubclass�RuntimeErrorrrrr)r�subclassrrr�register6s


zABCMeta.registerNcCs|td|j�d|j��|d�tdt���|d�|jD]@}|�d�r6t||�}t|t�r`t	|�}t|�d|��|d�q6dS)z'Debug helper to print the ABC registry.zClass: �.)�filezInv. counter: Z_abc_z: N)
�print�
__module__�__qualname__r�__dict__�
startswithr	r"rr)rr*rrrrr�_dump_registryHs



zABCMeta._dump_registrycCs|j��dS)z.Clear the registry (for debugging or testing).N)r�clear�rrrr�_abc_registry_clearSszABCMeta._abc_registry_clearcCs|j��|j��dS)z,Clear the caches (for debugging or testing).N)rr1rr2rrr�_abc_caches_clearWs
zABCMeta._abc_caches_clearcsb|j}|�jkrdSt|�}||krH�jtjkr>|�jkr>dS��|�St�fdd�||fD��S)z'Override for isinstance(instance, cls).TFc3s|]}��|�VqdS)N)�__subclasscheck__)r
�cr2rr�	<genexpr>jsz,ABCMeta.__instancecheck__.<locals>.<genexpr>)	r rr#rrrrr5�any)r�instancer'Zsubtyperr2r�__instancecheck__\s
��
zABCMeta.__instancecheck__cCst|t�std��||jkr dS|jtjkr>t�|_tj|_n||jkrLdS|�	|�}|t
k	r�t|t�slt�|r~|j�
|�n|j�
|�|S|t|dd�kr�|j�
|�dS|jD] }t||�r�|j�
|�dSq�|��D] }t||�r�|j�
|�dSq�|j�
|�dS)z'Override for issubclass(subclass, cls).z"issubclass() arg 1 must be a classTF�__mro__r)r"r#r$rrrrrr�__subclasshook__�NotImplemented�bool�AssertionErrorrr	rr%�__subclasses__)rr'�okZrclsZsclsrrrr5ls:







zABCMeta.__subclasscheck__)N)
�__name__r,r-�__doc__rrr(r0r3r4r:r5�
__classcell__rrrrrs
rN)Z_weakrefsetrrr#rrrrr�<module>s
io.cpython-38.pyc000064400000006600150335716500007612 0ustar00U

e5d�
�@sjdZdZdddddddd	d
ddd
dddddddgZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZejZde_dZdZdZGdd�dejejd�ZGdd�deje�ZGdd
�d
eje�ZGdd�deje�Z e�!e
�ee
eeefD]Z"e�!e"��qeefD]Z"e �!e"��q ["zdd lm#Z#Wne$k
�rZYnXe�!e#�dS)!a�The io module provides the Python interfaces to stream handling. The
builtin open function is defined in this module.

At the top of the I/O hierarchy is the abstract base class IOBase. It
defines the basic interface to a stream. Note, however, that there is no
separation between reading and writing to streams; implementations are
allowed to raise an OSError if they do not support a given operation.

Extending IOBase is RawIOBase which deals simply with the reading and
writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide
an interface to OS files.

BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its
subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer
streams that are readable, writable, and both respectively.
BufferedRandom provides a buffered interface to random access
streams. BytesIO is a simple stream of in-memory bytes.

Another IOBase subclass, TextIOBase, deals with the encoding and decoding
of streams into text. TextIOWrapper, which extends it, is a buffered text
interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO
is an in-memory stream for text.

Argument names are not part of the specification, and only the arguments
of open() are intended to be used as keyword arguments.

data:

DEFAULT_BUFFER_SIZE

   An int containing the default buffer size used by the module's buffered
   I/O classes. open() uses the file's blksize (as obtained by os.stat) if
   possible.
z�Guido van Rossum <guido@python.org>, Mike Verdone <mike.verdone@gmail.com>, Mark Russell <mark.russell@zen.co.uk>, Antoine Pitrou <solipsis@pitrou.net>, Amaury Forgeot d'Arc <amauryfa@gmail.com>, Benjamin Peterson <benjamin@python.org>�BlockingIOError�open�	open_code�IOBase�	RawIOBase�FileIO�BytesIO�StringIO�BufferedIOBase�BufferedReader�BufferedWriter�BufferedRWPair�BufferedRandom�
TextIOBase�
TextIOWrapper�UnsupportedOperation�SEEK_SET�SEEK_CUR�SEEK_END�N)�DEFAULT_BUFFER_SIZErrrrrrrr
rrr
�IncrementalNewlineDecoderr�io��c@seZdZejjZdS)rN)�__name__�
__module__�__qualname__�_io�_IOBase�__doc__�r r �/usr/lib64/python3.8/io.pyrHs)�	metaclassc@seZdZejjZdS)rN)rrrr�
_RawIOBaserr r r r!rKsc@seZdZejjZdS)r	N)rrrr�_BufferedIOBaserr r r r!r	Nsc@seZdZejjZdS)rN)rrrr�_TextIOBaserr r r r!rQs)�_WindowsConsoleIO)%r�
__author__�__all__r�abcrrrrrrrrr
rrr
rr�OpenWrapperrrrrr�ABCMetarr#rr$r	r%r�register�klassr&�ImportErrorr r r r!�<module>sT$
�@
�_sysconfigdata__linux_x86_64-linux-gnu.cpython-38.opt-2.pyc000064400000070732150335716500017467 0ustar00U

��.en���@s`dddddddddddddd	dd
ddd
dddddddddddddddddddddddddd d!d"d#dddd$d%dd&d'd(d$d)dddd*d+dddddddd,d$d$d$d$dd$dd$d$d$d$d$dddddddddd$dd$d$d$d$d$d$d$d$dd$d$d$d$d$dd$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$dd$d$d$dd$dd$dd$d$d$d$d$d$d$dd$d$d$d$d$d$d$d$d$dd$d$d$d$d$d$d$d$d$d$dd$d$d$d$d$d$dd$d$d$d$dd$d$d$d$d$d$d$d$dd$d$d$d$d$d$d$d$d$d$dd$ddd$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$dd$d$d$d$dd$d$d$d$d$ddd$d$dd$dddd$d$d$ddd$d$dddd$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$dd$d$d$d$d$d$d$d$dd$d$d$d$d$d$d$d$d$d$dd$d$dd$d$dd$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$dd$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$dd$d$d$d$d$d$dd$d$d$d$d$d$d$d$ddd$d$d$dd$d$ddd$d$d$d$d$d$d$dddddd$dd$d$dddddd$ddd$d$d$d$d$d$d$d$d$d$d$ddd$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$ddd$d$d$d$ddd$d$d$ddd$dd$d$d$d$d$d$d$d$d$d$d$d$d$d$ddd-ddd.d/d.d.d0d1d2dd3d4d5dd	d6ddd7dd8d9dd:d;dd<ddd=d>d?d@ddd)ddAdBddCdddd
dd$dDdEdFdGdddHddIdJd$dKddddLdMdddddddddNdOdPdddQd$d$dRdd
ddSddddTdUdddVddWd$dXdYddZd4d[d\dd]dd$ddd^d_d`dadbd7ddcddd=ded$dddfdgdhdgdfdhdfdfdgdgdfd\dfdfdfdfdgd$didjdkd$dldmddnd8d$dddddoddpdqdd$ddddrd$d6dsd$d$d$d$dddd$d$ddtdudsdvdwdwdsdx���ZdyS)z��ZarZrcsz!-Wno-unused-result -Wsign-comparez-IObjects -IInclude -IPythonz/usr/binz/usr/lib64/python3.8z-L. -lpython3.8zOgcc -pthread -shared -Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g�pythonzx86_64-redhat-linux-gnu�\zgcc -pthreadz-fPICa-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz?configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.ina-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvaK-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declarationz-Wl,-z,relro  -Wl,-z,now  -gz�-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -ga�'--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-ipv6' '--enable-shared' '--with-computed-gotos=yes' '--with-dbmliborder=gdbm:ndbm:bdb' '--with-system-expat' '--with-system-ffi' '--enable-loadable-sqlite-extensions' '--with-dtrace' '--with-lto' '--with-ssl-default-suites=openssl' '--with-valgrind' '--without-ensurepip' '--enable-optimizations' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS= -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv ' 'LDFLAGS= -Wl,-z,relro  -Wl,-z,now  -g ' 'CPPFLAGS=' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'z/usr/includez/usr/include/python3.8zA/builddir/build/BUILD/Python-3.8.17/build/optimized/coverage.infoz?/builddir/build/BUILD/Python-3.8.17/build/optimized/lcov-reportz2--no-branch-coverage --title "CPython lcov report"zN-IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Includezg++ -pthreadzE/usr /usr/lib64 /usr/lib64/python3.8 /usr/lib64/python3.8/lib-dynloadz /usr/lib64/python3.8/lib-dynloadi�zoREADME.rst ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Ext-dummyzInclude Lib Misc Ext-dummyzTREADME.rst ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in�.�z/usr/bin/dtracezInclude/pydtrace_probes.hzPython/pydtrace.ozdynload_shlib.oZnoz.cpython-38-x86_64-linux-gnu.soi�ZyeszG/usr/include /usr/include /usr/include/python3.8 /usr/include/python3.8z/usr/bin/install -cz/usr/bin/install -c -m 644z/usr/bin/install -c -m 755zlibpython3.8.so.1.0zModules/_io/_iomodule.hzg++ -pthread -sharedz:-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -gzlibpython3.8.soz3.8z
/usr/lib64z-lmzPython/z/usr/lib64/pkgconfigz0/usr/lib64/python3.8/config-3.8-x86_64-linux-gnuzlibpython3.8.az"-lcrypt -lpthread -ldl  -lutil -lmz0tkinter tkinter/test tkinter/test/test_tkinter \Zgccz-Xlinker -export-dynamic�trueZlnZlinuxz5/builddir/build/BUILD/Python-3.8.17/Modules/makesetupz/usr/share/manz/usr/bin/mkdir -pz�posix  errno  pwd  _sre  _codecs  _weakref  _functools  _operator  _collections  _abc  itertools  atexit  _signal  _stat  time  _thread  _locale  _io  faulthandler  _tracemalloc  _symtable  xxsubtypeavModules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/_abc.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_threadmodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  Modules/symtablemodule.o  Modules/xxsubtype.ozx86_64-linux-gnuz -DMULTIARCH=\"x86_64-linux-gnu\"z-Wl,--no-as-neededz-lssl -lcryptoa:-DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz:\ Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.oz-fprofile-generatez"-fprofile-use -fprofile-correctionz
-m test --pgoz
libpython3.sozno-frameworkz./python -Ez	python3.8a-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition  -fprofile-use -fprofile-correction -I/builddir/build/BUILD/Python-3.8.17/Include/internal -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Include -fPIC -DPy_BUILD_CORE_BUILTINa.-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition  -fprofile-use -fprofile-correction -I/builddir/build/BUILD/Python-3.8.17/Include/internala-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition  -fprofile-use -fprofile-correction -I/builddir/build/BUILD/Python-3.8.17/Include/internal -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Include -fPIC -DPy_BUILD_COREaT-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g -lcryptoz"z"a-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g�a-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition  -fprofile-use -fprofile-correction -I/builddir/build/BUILD/Python-3.8.17/Include/internal -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Include -fPICz)-x test_subprocess test_io test_lib2to3 \ZreadelfzMac/Resources/frameworkZvoidzCLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.8.17/build/optimizedz	@SGI_ABI@z/bin/shz.so���zcpython-38-x86_64-linux-gnuz2Parser Objects Python Modules Modules/_io Programsz:/builddir/build/BUILD/Python-3.8.17/Tools/gdb/libpython.pyz"/* Don't use ncurses extensions */z-szInclude Lib MisczLLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.8.17/build/optimized ./pythonz�LD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.8.17/build/optimized ./python /builddir/build/BUILD/Python-3.8.17/Tools/scripts/run_tests.pyi�zJpython3.8 /builddir/build/BUILD/Python-3.8.17/Tools/scripts/update_file.pyz#/builddir/build/BUILD/Python-3.8.17z)xml xml/dom xml/etree xml/parsers xml/saxz3/builddir/build/BUILD/Python-3.8.17/build/optimizedz
/usr/sharez/usr(�ZABIFLAGSZAC_APPLE_UNIVERSAL_BUILDZAIX_GENUINE_CPLUSPLUSZ	ALT_SOABIZANDROID_API_LEVELZARZARFLAGSZ
BASECFLAGSZBASECPPFLAGSZBASEMODLIBSZBINDIRZ
BINLIBDESTZ
BLDLIBRARYZ	BLDSHAREDZBUILDEXEZBUILDPYTHONZBUILD_GNU_TYPEZBYTESTR_DEPSZCCZCCSHAREDZCFLAGSZCFLAGSFORSHAREDZCFLAGS_ALIASINGZCONFIGFILESZCONFIGURE_CFLAGSZCONFIGURE_CFLAGS_NODISTZCONFIGURE_CPPFLAGSZCONFIGURE_LDFLAGSZCONFIGURE_LDFLAGS_NODISTZCONFIG_ARGSZCONFINCLUDEDIRZ
CONFINCLUDEPYZCOREPYTHONPATHZ
COVERAGE_INFOZCOVERAGE_REPORTZCOVERAGE_REPORT_OPTIONSZCPPFLAGSZCXXZDESTDIRSZDESTLIBZDESTPATHZ
DESTSHAREDZDFLAGSZDIRMODEZDISTZDISTDIRSZ	DISTFILESZ	DLINCLDIRZ
DLLLIBRARYZ"DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754ZDOUBLE_IS_BIG_ENDIAN_IEEE754ZDOUBLE_IS_LITTLE_ENDIAN_IEEE754ZDTRACEZDTRACE_DEPSZDTRACE_HEADERSZDTRACE_OBJSZDYNLOADFILEZENABLE_IPV6Z	ENSUREPIPZEXEZEXEMODEZ
EXTRATESTOPTSZ
EXT_SUFFIXZFILEMODEZFLOAT_WORDS_BIGENDIANZFLOCK_NEEDS_LIBBSDZGETPGRP_HAVE_ARGZGETTIMEOFDAY_NO_TZZ	GITBRANCHZGITTAGZ
GITVERSIONZGNULDZHAVE_ACCEPT4Z
HAVE_ACOSHZ
HAVE_ADDRINFOZ
HAVE_ALARMZHAVE_ALIGNED_REQUIREDZ
HAVE_ALLOCA_HZHAVE_ALTZONEZ
HAVE_ASINHZHAVE_ASM_TYPES_HZ
HAVE_ATANHZHAVE_BIND_TEXTDOMAIN_CODESETZHAVE_BLUETOOTH_BLUETOOTH_HZHAVE_BLUETOOTH_HZHAVE_BROKEN_MBSTOWCSZHAVE_BROKEN_NICEZHAVE_BROKEN_PIPE_BUFZHAVE_BROKEN_POLLZHAVE_BROKEN_POSIX_SEMAPHORESZHAVE_BROKEN_PTHREAD_SIGMASKZHAVE_BROKEN_SEM_GETVALUEZHAVE_BROKEN_UNSETENVZHAVE_BUILTIN_ATOMICZHAVE_CHFLAGSZ
HAVE_CHOWNZHAVE_CHROOTZ
HAVE_CLOCKZHAVE_CLOCK_GETRESZHAVE_CLOCK_GETTIMEZHAVE_CLOCK_SETTIMEZHAVE_COMPUTED_GOTOSZHAVE_CONFSTRZHAVE_CONIO_HZ
HAVE_COPYSIGNZHAVE_COPY_FILE_RANGEZHAVE_CRYPT_HZHAVE_CRYPT_RZHAVE_CTERMIDZHAVE_CTERMID_RZHAVE_CURSES_FILTERZ
HAVE_CURSES_HZHAVE_CURSES_HAS_KEYZHAVE_CURSES_IMMEDOKZHAVE_CURSES_IS_PADZHAVE_CURSES_IS_TERM_RESIZEDZHAVE_CURSES_RESIZETERMZHAVE_CURSES_RESIZE_TERMZHAVE_CURSES_SYNCOKZHAVE_CURSES_TYPEAHEADZHAVE_CURSES_USE_ENVZHAVE_CURSES_WCHGATZHAVE_DECL_ISFINITEZHAVE_DECL_ISINFZHAVE_DECL_ISNANZHAVE_DECL_RTLD_DEEPBINDZHAVE_DECL_RTLD_GLOBALZHAVE_DECL_RTLD_LAZYZHAVE_DECL_RTLD_LOCALZHAVE_DECL_RTLD_MEMBERZHAVE_DECL_RTLD_NODELETEZHAVE_DECL_RTLD_NOLOADZHAVE_DECL_RTLD_NOWZHAVE_DECL_TZNAMEZHAVE_DEVICE_MACROSZHAVE_DEV_PTCZ
HAVE_DEV_PTMXZ
HAVE_DIRECT_HZHAVE_DIRENT_D_TYPEZ
HAVE_DIRENT_HZ
HAVE_DIRFDZHAVE_DLFCN_HZHAVE_DLOPENZ	HAVE_DUP2Z	HAVE_DUP3Z$HAVE_DYLD_SHARED_CACHE_CONTAINS_PATHZHAVE_DYNAMIC_LOADINGZ
HAVE_ENDIAN_HZ
HAVE_EPOLLZHAVE_EPOLL_CREATE1ZHAVE_ERFZ	HAVE_ERFCZHAVE_ERRNO_HZ
HAVE_EXECVZHAVE_EXPLICIT_BZEROZHAVE_EXPLICIT_MEMSETZ
HAVE_EXPM1ZHAVE_FACCESSATZHAVE_FCHDIRZHAVE_FCHMODZ
HAVE_FCHMODATZHAVE_FCHOWNZ
HAVE_FCHOWNATZHAVE_FCNTL_HZHAVE_FDATASYNCZHAVE_FDOPENDIRZHAVE_FDWALKZHAVE_FEXECVEZHAVE_FINITEZ
HAVE_FLOCKZ	HAVE_FORKZHAVE_FORKPTYZHAVE_FPATHCONFZHAVE_FSEEK64ZHAVE_FSEEKOZHAVE_FSTATATZ
HAVE_FSTATVFSZ
HAVE_FSYNCZHAVE_FTELL64ZHAVE_FTELLOZ
HAVE_FTIMEZHAVE_FTRUNCATEZ
HAVE_FUTIMENSZHAVE_FUTIMESZHAVE_FUTIMESATZHAVE_GAI_STRERRORZ
HAVE_GAMMAZHAVE_GCC_ASM_FOR_MC68881ZHAVE_GCC_ASM_FOR_X64ZHAVE_GCC_ASM_FOR_X87ZHAVE_GCC_UINT128_TZHAVE_GETADDRINFOZHAVE_GETC_UNLOCKEDZHAVE_GETENTROPYZHAVE_GETGRGID_RZHAVE_GETGRNAM_RZHAVE_GETGROUPLISTZHAVE_GETGROUPSZHAVE_GETHOSTBYNAMEZHAVE_GETHOSTBYNAME_RZHAVE_GETHOSTBYNAME_R_3_ARGZHAVE_GETHOSTBYNAME_R_5_ARGZHAVE_GETHOSTBYNAME_R_6_ARGZHAVE_GETITIMERZHAVE_GETLOADAVGZ
HAVE_GETLOGINZHAVE_GETNAMEINFOZHAVE_GETPAGESIZEZHAVE_GETPEERNAMEZHAVE_GETPGIDZHAVE_GETPGRPZHAVE_GETPIDZHAVE_GETPRIORITYZ
HAVE_GETPWENTZHAVE_GETPWNAM_RZHAVE_GETPWUID_RZHAVE_GETRANDOMZHAVE_GETRANDOM_SYSCALLZHAVE_GETRESGIDZHAVE_GETRESUIDZHAVE_GETSIDZ
HAVE_GETSPENTZ
HAVE_GETSPNAMZHAVE_GETTIMEOFDAYZ
HAVE_GETWDZHAVE_GLIBC_MEMMOVE_BUGZ
HAVE_GRP_HZHAVE_HSTRERRORZHAVE_HTOLE64Z
HAVE_HYPOTZ
HAVE_IEEEFP_HZHAVE_IF_NAMEINDEXZHAVE_INET_ATONZHAVE_INET_PTONZHAVE_INITGROUPSZHAVE_INTTYPES_HZ	HAVE_IO_HZHAVE_IPA_PURE_CONST_BUGZ	HAVE_KILLZHAVE_KILLPGZHAVE_KQUEUEZHAVE_LANGINFO_HZHAVE_LARGEFILE_SUPPORTZ
HAVE_LCHFLAGSZHAVE_LCHMODZHAVE_LCHOWNZHAVE_LGAMMAZ
HAVE_LIBDLZHAVE_LIBDLDZHAVE_LIBIEEEZHAVE_LIBINTL_HZHAVE_LIBREADLINEZHAVE_LIBRESOLVZHAVE_LIBSENDFILEZHAVE_LIBUTIL_HZ	HAVE_LINKZHAVE_LINKATZHAVE_LINUX_CAN_BCM_HZHAVE_LINUX_CAN_HZHAVE_LINUX_CAN_RAW_FD_FRAMESZHAVE_LINUX_CAN_RAW_HZHAVE_LINUX_MEMFD_HZHAVE_LINUX_NETLINK_HZHAVE_LINUX_QRTR_HZHAVE_LINUX_RANDOM_HZHAVE_LINUX_TIPC_HZHAVE_LINUX_VM_SOCKETS_HZ
HAVE_LOCKFZ
HAVE_LOG1PZ	HAVE_LOG2ZHAVE_LONG_DOUBLEZ
HAVE_LSTATZHAVE_LUTIMESZHAVE_MADVISEZHAVE_MAKEDEVZHAVE_MBRTOWCZHAVE_MEMFD_CREATEZ
HAVE_MEMORY_HZHAVE_MEMRCHRZHAVE_MKDIRATZHAVE_MKFIFOZ
HAVE_MKFIFOATZ
HAVE_MKNODZHAVE_MKNODATZHAVE_MKTIMEZ	HAVE_MMAPZHAVE_MREMAPZHAVE_NCURSES_HZHAVE_NDIR_HZHAVE_NETPACKET_PACKET_HZ
HAVE_NET_IF_HZ	HAVE_NICEZHAVE_OPENATZHAVE_OPENPTYZ
HAVE_PATHCONFZ
HAVE_PAUSEZ
HAVE_PIPE2Z
HAVE_PLOCKZ	HAVE_POLLZHAVE_POLL_HZHAVE_POSIX_FADVISEZHAVE_POSIX_FALLOCATEZHAVE_POSIX_SPAWNZHAVE_POSIX_SPAWNPZ
HAVE_PREADZHAVE_PREADVZHAVE_PREADV2ZHAVE_PRLIMITZHAVE_PROCESS_HZHAVE_PROTOTYPESZHAVE_PTHREAD_CONDATTR_SETCLOCKZHAVE_PTHREAD_DESTRUCTORZHAVE_PTHREAD_GETCPUCLOCKIDZHAVE_PTHREAD_HZHAVE_PTHREAD_INITZHAVE_PTHREAD_KILLZHAVE_PTHREAD_SIGMASKZ
HAVE_PTY_HZHAVE_PUTENVZHAVE_PWRITEZHAVE_PWRITEVZ
HAVE_PWRITEV2Z
HAVE_READLINKZHAVE_READLINKATZ
HAVE_READVZ
HAVE_REALPATHZ
HAVE_RENAMEATZHAVE_RL_APPEND_HISTORYZHAVE_RL_CATCH_SIGNALZ#HAVE_RL_COMPLETION_APPEND_CHARACTERZ'HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOKZHAVE_RL_COMPLETION_MATCHESZ"HAVE_RL_COMPLETION_SUPPRESS_APPENDZHAVE_RL_PRE_INPUT_HOOKZHAVE_RL_RESIZE_TERMINALZ
HAVE_ROUNDZ
HAVE_RTPSPAWNZHAVE_SCHED_GET_PRIORITY_MAXZHAVE_SCHED_HZHAVE_SCHED_RR_GET_INTERVALZHAVE_SCHED_SETAFFINITYZHAVE_SCHED_SETPARAMZHAVE_SCHED_SETSCHEDULERZHAVE_SEM_GETVALUEZ
HAVE_SEM_OPENZHAVE_SEM_TIMEDWAITZHAVE_SEM_UNLINKZ
HAVE_SENDFILEZHAVE_SETEGIDZHAVE_SETEUIDZHAVE_SETGIDZHAVE_SETGROUPSZHAVE_SETHOSTNAMEZHAVE_SETITIMERZHAVE_SETLOCALEZHAVE_SETPGIDZHAVE_SETPGRPZHAVE_SETPRIORITYZ
HAVE_SETREGIDZHAVE_SETRESGIDZHAVE_SETRESUIDZ
HAVE_SETREUIDZHAVE_SETSIDZHAVE_SETUIDZHAVE_SETVBUFZ
HAVE_SHADOW_HZ
HAVE_SHM_OPENZHAVE_SHM_UNLINKZHAVE_SIGACTIONZHAVE_SIGALTSTACKZHAVE_SIGFILLSETZHAVE_SIGINFO_T_SI_BANDZHAVE_SIGINTERRUPTZ
HAVE_SIGNAL_HZHAVE_SIGPENDINGZ
HAVE_SIGRELSEZHAVE_SIGTIMEDWAITZHAVE_SIGWAITZHAVE_SIGWAITINFOZ
HAVE_SNPRINTFZHAVE_SOCKADDR_ALGZHAVE_SOCKADDR_SA_LENZHAVE_SOCKADDR_STORAGEZHAVE_SOCKETPAIRZHAVE_SPAWN_HZHAVE_SSIZE_TZHAVE_STATVFSZHAVE_STAT_TV_NSECZHAVE_STAT_TV_NSEC2ZHAVE_STDARG_PROTOTYPESZ
HAVE_STDINT_HZ
HAVE_STDLIB_HZHAVE_STD_ATOMICZHAVE_STRDUPZ
HAVE_STRFTIMEZHAVE_STRINGS_HZ
HAVE_STRING_HZHAVE_STRLCPYZHAVE_STROPTS_HZHAVE_STRSIGNALZHAVE_STRUCT_PASSWD_PW_GECOSZHAVE_STRUCT_PASSWD_PW_PASSWDZHAVE_STRUCT_STAT_ST_BIRTHTIMEZHAVE_STRUCT_STAT_ST_BLKSIZEZHAVE_STRUCT_STAT_ST_BLOCKSZHAVE_STRUCT_STAT_ST_FLAGSZHAVE_STRUCT_STAT_ST_GENZHAVE_STRUCT_STAT_ST_RDEVZHAVE_STRUCT_TM_TM_ZONEZHAVE_SYMLINKZHAVE_SYMLINKATZ	HAVE_SYNCZHAVE_SYSCONFZHAVE_SYSEXITS_HZHAVE_SYS_AUDIOIO_HZHAVE_SYS_BSDTTY_HZHAVE_SYS_DEVPOLL_HZHAVE_SYS_DIR_HZHAVE_SYS_ENDIAN_HZHAVE_SYS_EPOLL_HZHAVE_SYS_EVENT_HZHAVE_SYS_FILE_HZHAVE_SYS_IOCTL_HZHAVE_SYS_KERN_CONTROL_HZHAVE_SYS_LOADAVG_HZHAVE_SYS_LOCK_HZHAVE_SYS_MEMFD_HZHAVE_SYS_MKDEV_HZHAVE_SYS_MMAN_HZHAVE_SYS_MODEM_HZHAVE_SYS_NDIR_HZHAVE_SYS_PARAM_HZHAVE_SYS_POLL_HZHAVE_SYS_RANDOM_HZHAVE_SYS_RESOURCE_HZHAVE_SYS_SELECT_HZHAVE_SYS_SENDFILE_HZHAVE_SYS_SOCKET_HZHAVE_SYS_STATVFS_HZHAVE_SYS_STAT_HZHAVE_SYS_SYSCALL_HZHAVE_SYS_SYSMACROS_HZHAVE_SYS_SYS_DOMAIN_HZHAVE_SYS_TERMIO_HZHAVE_SYS_TIMES_HZHAVE_SYS_TIME_HZHAVE_SYS_TYPES_HZHAVE_SYS_UIO_HZ
HAVE_SYS_UN_HZHAVE_SYS_UTSNAME_HZHAVE_SYS_WAIT_HZHAVE_SYS_XATTR_HZHAVE_TCGETPGRPZHAVE_TCSETPGRPZHAVE_TEMPNAMZHAVE_TERMIOS_HZHAVE_TERM_HZHAVE_TGAMMAZHAVE_TIMEGMZ
HAVE_TIMESZHAVE_TMPFILEZHAVE_TMPNAMZ
HAVE_TMPNAM_RZHAVE_TM_ZONEZ
HAVE_TRUNCATEZHAVE_TZNAMEZ
HAVE_UCS4_TCLZ
HAVE_UNAMEZ
HAVE_UNISTD_HZ
HAVE_UNLINKATZ
HAVE_UNSETENVZHAVE_USABLE_WCHAR_TZHAVE_UTIL_HZHAVE_UTIMENSATZHAVE_UTIMESZHAVE_UTIME_HZHAVE_UUID_CREATEZHAVE_UUID_ENC_BEZHAVE_UUID_GENERATE_TIME_SAFEZHAVE_UUID_HZHAVE_UUID_UUID_HZ
HAVE_WAIT3Z
HAVE_WAIT4ZHAVE_WAITIDZHAVE_WAITPIDZHAVE_WCHAR_HZHAVE_WCSCOLLZ
HAVE_WCSFTIMEZHAVE_WCSXFRMZHAVE_WMEMCMPZHAVE_WORKING_TZSETZHAVE_WRITEVZ HAVE_X509_VERIFY_PARAM_SET1_HOSTZHAVE_ZLIB_COPYZHAVE__GETPTYZ
HOST_GNU_TYPEZINCLDIRSTOMAKEZ
INCLUDEDIRZ	INCLUDEPYZINSTALLZINSTALL_DATAZINSTALL_PROGRAMZINSTALL_SCRIPTZINSTALL_SHAREDZ
INSTSONAMEZIO_HZIO_OBJSZLDCXXSHAREDZLDFLAGSZ	LDLIBRARYZLDLIBRARYDIRZLDSHAREDZ	LDVERSIONZLIBCZLIBDESTZLIBDIRZLIBFFI_INCLUDEDIRZLIBMZ	LIBOBJDIRZLIBOBJSZLIBPCZLIBPLZ	LIBPYTHONZLIBRARYZLIBRARY_OBJSZLIBRARY_OBJS_OMIT_FROZENZLIBSZ
LIBSUBDIRSZLINKCCZ
LINKFORSHAREDZLIPO_32BIT_FLAGSZLIPO_INTEL64_FLAGSZ
LLVM_PROF_ERRZLLVM_PROF_FILEZLLVM_PROF_MERGERZLNZLOCALMODLIBSZMACHDEPZMACHDEP_OBJSZMACHDESTLIBZMACOSX_DEPLOYMENT_TARGETZMAINCCZMAJOR_IN_MKDEVZMAJOR_IN_SYSMACROSZ	MAKESETUPZMANDIRZMKDIR_PZMODBUILT_NAMESZMODDISABLED_NAMESZMODLIBSZMODOBJSZMODULE_OBJSZ	MULTIARCHZMULTIARCH_CPPFLAGSZMVWDELCH_IS_EXPRESSIONZNO_AS_NEEDEDZOBJECT_OBJSZOPENSSL_INCLUDESZOPENSSL_LDFLAGSZOPENSSL_LIBSZOPTZOTHER_LIBTOOL_OPTZPACKAGE_BUGREPORTZPACKAGE_NAMEZPACKAGE_STRINGZPACKAGE_TARNAMEZPACKAGE_URLZPACKAGE_VERSIONZPARSER_HEADERSZPARSER_OBJSZPGO_PROF_GEN_FLAGZPGO_PROF_USE_FLAGZPOBJSZPOSIX_SEMAPHORES_NOT_ENABLEDZPROFILE_TASKZ$PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INTZPTHREAD_SYSTEM_SCHED_SUPPORTEDZ
PY3LIBRARYZPYLONG_BITS_IN_DIGITZPYTHONZPYTHONFRAMEWORKZPYTHONFRAMEWORKDIRZPYTHONFRAMEWORKINSTALLDIRZPYTHONFRAMEWORKPREFIXZ
PYTHONPATHZPYTHON_FOR_BUILDZPYTHON_FOR_REGENZPYTHON_HEADERSZPYTHON_OBJSZPY_BUILTIN_MODULE_CFLAGSZ	PY_CFLAGSZPY_CFLAGS_NODISTZPY_COERCE_C_LOCALEZPY_CORE_CFLAGSZPY_CORE_LDFLAGSZPY_CPPFLAGSZPY_FORMAT_SIZE_TZ
PY_LDFLAGSZPY_LDFLAGS_NODISTZPY_SSL_DEFAULT_CIPHERSZPY_SSL_DEFAULT_CIPHER_STRINGZPY_STDMODULE_CFLAGSZPy_DEBUGZPy_ENABLE_SHAREDZPy_HASH_ALGORITHMZ
Py_TRACE_REFSZ
QUICKTESTOPTSZREADELFZ	RESSRCDIRZ
RETSIGTYPEZ	RUNSHAREDZ	SCRIPTDIRZSETPGRP_HAVE_ARGZSGI_ABIZSHELLZSHLIBSZSHLIB_SUFFIXZSHM_NEEDS_LIBRTZSIGNED_RIGHT_SHIFT_ZERO_FILLSZSITEPATHZ
SIZEOF_DOUBLEZSIZEOF_FLOATZ
SIZEOF_FPOS_TZ
SIZEOF_INTZSIZEOF_LONGZSIZEOF_LONG_DOUBLEZSIZEOF_LONG_LONGZSIZEOF_OFF_TZSIZEOF_PID_TZSIZEOF_PTHREAD_KEY_TZSIZEOF_PTHREAD_TZSIZEOF_SHORTZ
SIZEOF_SIZE_TZ
SIZEOF_TIME_TZSIZEOF_UINTPTR_TZ
SIZEOF_VOID_PZSIZEOF_WCHAR_TZSIZEOF__BOOLZSOABIZSRCDIRSZ
SRC_GDB_HOOKSZSTDC_HEADERSZSTRICT_SYSV_CURSESZ	STRIPFLAGZSUBDIRSZ
SUBDIRSTOOZSYSLIBSZSYS_SELECT_WITH_SYS_TIMEZTCLTK_INCLUDESZ
TCLTK_LIBSZTESTOPTSZTESTPATHZ
TESTPYTHONZTESTPYTHONOPTSZ
TESTRUNNERZTESTTIMEOUTZTIMEMODULE_LIBZTIME_WITH_SYS_TIMEZTM_IN_SYS_TIMEZUNICODE_DEPSZUNIVERSALSDKZUPDATE_FILEZUSE_COMPUTED_GOTOSZVERSIONZVPATHZWINDOW_HAS_FLAGSZWITH_DECIMAL_CONTEXTVARZWITH_DOC_STRINGSZWITH_DTRACEZ	WITH_DYLDZWITH_LIBINTLZWITH_NEXT_FRAMEWORKZ
WITH_PYMALLOCZ
WITH_VALGRINDZX87_DOUBLE_ROUNDINGZ
XMLLIBSUBDIRSZabs_builddirZ
abs_srcdirZdatarootdir�exec_prefix�prefixZsrcdirN)Zbuild_time_vars�rr�>/usr/lib64/python3.8/_sysconfigdata__linux_x86_64-linux-gnu.py�<module>sb2,/��������cgi.cpython-38.pyc000064400000063655150335716500007762 0ustar00U

&�.e���@sjdZdZddlmZmZmZddlmZddlZddl	Z	ddl
Zddlm
Z
ddlmZddlZddlZddlZdd	d
ddd
ddddddgZdadadd�Zdd�Zdd�Zdd�Zeadade	jdddfdd
�Zd1d!d�Zd"d#�Zd$d�Z Gd%d�d�Z!Gd&d	�d	�Z"e	jfd'd
�Z#d2d(d�Z$e	jfd)d�Z%d*d�Z&d+d�Z'd,d�Z(d-d�Z)d.d/�Z*e+d0k�rfe#�dS)3z�Support module for CGI (Common Gateway Interface) scripts.

This module defines a number of utilities for use by CGI scripts
written in Python.
z2.6�)�StringIO�BytesIO�
TextIOWrapper)�MappingN)�
FeedParser)�Message�MiniFieldStorage�FieldStorage�parse�parse_multipart�parse_header�test�print_exception�
print_environ�
print_form�print_directory�print_arguments�print_environ_usage�cGsFtr,ts,zttd�aWntk
r*YnXts6tantat|�dS)a�Write a log message, if there is a log file.

    Even though this function is called initlog(), you should always
    use log(); log is a variable that is set either to initlog
    (initially), to dolog (once the log file has been opened), or to
    nolog (when logging is disabled).

    The first argument is a format string; the remaining arguments (if
    any) are arguments to the % operator, so e.g.
        log("%s: %s", "a", "b")
    will write "a: b" to the log file, followed by a newline.

    If the global logfp is not None, it should be a file object to
    which log data is written.

    If the global logfp is None, the global logfile may be a string
    giving a filename to open, in append mode.  This file should be
    world writable!!!  If the file can't be opened, logging is
    silently disabled (since there is no safe place where we could
    send an error message).

    �aN)�logfile�logfp�open�OSError�nolog�log�dolog�Zallargs�r�/usr/lib64/python3.8/cgi.py�initlog8sr cGst�||d�dS)z=Write a log message to the log file.  See initlog() for docs.�
N)r�write)Zfmt�argsrrrr[srcGsdS)z9Dummy function, assigned to log when logging is disabled.Nrrrrrr_srcCsdatrt��datadS)zClose the log file.rN)rr�closer rrrrr�closelogcs
r%c
Cs^|dkrtj}t|d�r |j}nd}t|t�r4|j}d|krDd|d<|ddk�rt|d�\}}|dkrxt|||d	�S|d
kr�t	|d�}t
r�|t
kr�td��|�|��
|�}	nd
}	d|kr�|	r�|	d}	|	|d}	n*tjdd��r|	r�|	d}	|	tjd}	|	|d<n<d|k�r |d}	n(tjdd��r<tjd}	nd
}	|	|d<tjj|	||||d�S)a�Parse a query in the environment or from a file (default stdin)

        Arguments, all optional:

        fp              : file pointer; default: sys.stdin.buffer

        environ         : environment dictionary; default: os.environ

        keep_blank_values: flag indicating whether blank values in
            percent-encoded forms should be treated as blank strings.
            A true value indicates that blanks should be retained as
            blank strings.  The default false value indicates that
            blank values are to be ignored and treated as if they were
            not included.

        strict_parsing: flag indicating what to do with parsing errors.
            If false (the default), errors are silently ignored.
            If true, errors raise a ValueError exception.

        separator: str. The symbol to use for separating the query arguments.
            Defaults to &.
    N�encodingzlatin-1�REQUEST_METHOD�GET�POST�CONTENT_TYPEzmultipart/form-data)�	separator�!application/x-www-form-urlencoded�CONTENT_LENGTH�Maximum content length exceededr�QUERY_STRING�&�)r&r+)�sys�stdin�hasattrr&�
isinstancer�bufferrr�int�maxlen�
ValueError�read�decode�argv�urllibr
Zparse_qs)
�fp�environ�keep_blank_values�strict_parsingr+r&�ctype�pdictZclength�qsrrrr
vsL




��utf-8�replacer0csx|d�d�}d�|�}t�}|�|�z|d|d<Wntk
rLYnXt||||ddi|d���fd	d
��D�S)a�Parse multipart input.

    Arguments:
    fp   : input file
    pdict: dictionary containing other parameters of content-type header
    encoding, errors: request encoding and error handler, passed to
        FieldStorage

    Returns a dictionary just like parse_qs(): keys are the field names, each
    value is a list of values for that field. For non-file fields, the value
    is a list of strings.
    �boundary�asciiz multipart/form-data; boundary={}zCONTENT-LENGTHzContent-Lengthr'r))�headersr&�errorsr?r+csi|]}|��|��qSr)�getlist)�.0�k�Zfsrr�
<dictcomp>�sz#parse_multipart.<locals>.<dictcomp>)r;�formatrZset_type�KeyErrorr	)r>rCr&rJr+rGrBrIrrNrr�s


�ccs�|dd�dkr�|dd�}|�d�}|dkr`|�dd|�|�dd|�dr`|�d|d�}q&|dkrpt|�}|d|�}|��V||d�}qdS)Nr1�;r�"�\"�)�find�count�len�strip)�s�end�frrr�_parseparam�s
(
r]cCs�td|�}|��}i}|D]�}|�d�}|dkr|d|�����}||dd���}t|�dkr�|d|dkr�dkr�nn |dd�}|�d	d
��dd�}|||<q||fS)zfParse a Content-type like header.

    Return the main content-type and a dictionary of options.

    rR�=rNr1rU���rSz\\�\rT)r]�__next__rVrY�lowerrXrF)�line�parts�keyrC�p�i�name�valuerrrr�s
,
c@s@eZdZdZdZdZdZdZiZdZ	iZ
iZdd�Zdd�Z
dS)rz=Like FieldStorage, for use when no file uploads are possible.NcCs||_||_dS)z&Constructor from field name and value.N�rhri��selfrhrirrr�__init__	szMiniFieldStorage.__init__cCsd|j|jfS)z Return printable representation.zMiniFieldStorage(%r, %r)rj�rlrrr�__repr__szMiniFieldStorage.__repr__)�__name__�
__module__�__qualname__�__doc__�filename�list�type�file�type_options�disposition�disposition_optionsrIrmrorrrrr�sc@s�eZdZdZdddejdddddddfdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
d:dd�Zd;dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZdZd'd(�Zd)d*�Zd+Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Z dS)<r	a�Store a sequence of fields, reading multipart/form-data.

    This class provides naming, typing, files stored on disk, and
    more.  At the top level, it is accessible like a dictionary, whose
    keys are the field names.  (Note: None can occur as a field name.)
    The items are either a Python list (if there's multiple values) or
    another FieldStorage or MiniFieldStorage object.  If it's a single
    object, it has the following attributes:

    name: the field name, if specified; otherwise None

    filename: the filename, if specified; otherwise None; this is the
        client side filename, *not* the file name on which it is
        stored (that's a temporary file you don't deal with)

    value: the value as a *string*; for file uploads, this
        transparently reads the file every time you request the value
        and returns *bytes*

    file: the file(-like) object from which you can read the data *as
        bytes* ; None if the data is stored a simple string

    type: the content-type, or None if not specified

    type_options: dictionary of options specified on the content-type
        line

    disposition: content-disposition, or None if not specified

    disposition_options: dictionary of corresponding options

    headers: a dictionary(-like) object (sometimes email.message.Message or a
        subclass thereof) containing *all* headers

    The class is subclassable, mostly for the purpose of overriding
    the make_file() method, which is called internally to come up with
    a file open for reading and writing.  This makes it possible to
    override the default choice of storing all files in a temporary
    directory and unlinking them as soon as they have been opened.

    N�rrErFcCsZd}||_||_|
|_||_d|kr0|d��}d|_|dksF|dkr�d|krX|d}
ntjdd�rrtjd}
nd}
|
�t	�
�d�}
t|
�}|dkr�d	d
i}|dkr�i}|dkr�d
|d	<d|kr�|d|d	<d|kr�|d|_d
|kr�|d
|d<nt|t
tf��std��||_|dk�r*tjj|_n<t|t��r@|j|_n&t|d��rXt|d��s`td��||_||_|	|_t|t��s�tdt|�j��||_d|_||_di}}d|jk�r�t|jd�\}}||_||_ d|_!d|k�r�|d|_!d|_"d|k�r
|d|_"|j"dk	|_#d	|jk�r6t|jd	�\}}n(|j�sH|dk�rTdi}}n
d
i}}||_||_$d|k�r�|d�|j|j�|_%nd|_%d}d|jk�r�zt&|jd�}Wnt'k
�r�YnXt(�r�|t(k�r�t'd��||_)|jdk�r|dk�r||_d|_*|_+d|_,|d
k�r,|�-�n*|dd�dk�rN|�.|||�n|�/�dS)a$Constructor.  Read multipart/* until last part.

        Arguments, all optional:

        fp              : file pointer; default: sys.stdin.buffer
            (not used when the request method is GET)
            Can be :
            1. a TextIOWrapper object
            2. an object whose read() and readline() methods return bytes

        headers         : header dictionary-like object; default:
            taken from environ as per CGI spec

        outerboundary   : terminating multipart boundary
            (for internal use only)

        environ         : environment dictionary; default: os.environ

        keep_blank_values: flag indicating whether blank values in
            percent-encoded forms should be treated as blank strings.
            A true value indicates that blanks should be retained as
            blank strings.  The default false value indicates that
            blank values are to be ignored and treated as if they were
            not included.

        strict_parsing: flag indicating what to do with parsing errors.
            If false (the default), errors are silently ignored.
            If true, errors raise a ValueError exception.

        limit : used internally to read parts of multipart/form-data forms,
            to exit from the reading loop when reached. It is the difference
            between the form content-length and the number of bytes already
            read

        encoding, errors : the encoding and error handler used to decode the
            binary stream to strings. Must be the same as the charset defined
            for the page sending the form (content-type : meta http-equiv or
            header)

        max_num_fields: int. If set, then __init__ throws a ValueError
            if there are more than n fields read by parse_qsl().

        r(r'NZHEADr/r1r�surrogateescapezcontent-typer,r)r*r-�content-lengthz?headers must be mapping or an instance of email.message.Messager:�readlinezfp must be file pointerz#outerboundary must be bytes, not %srzcontent-dispositionrhrtz
text/plainrGr{r_r.�
z
multipart/)0r@rA�max_num_fieldsr+�upper�
qs_on_postr2r<�encode�localeZgetpreferredencodingrr5rr�	TypeErrorrIr3r6r>rr4r&rJ�bytesrvrp�
outerboundary�
bytes_read�limitrryrzrhrt�_binary_filerx�
innerboundaryr7r9r8�lengthrurw�done�read_urlencoded�
read_multi�read_single)rlr>rIr�r?r@rAr�r&rJr�r+�methodrDZcdisprCrBZclenrrrrm?s�/
�


�






�

zFieldStorage.__init__cCs(z|j��Wntk
r"YnXdS�N)rwr$�AttributeErrorrnrrr�__del__�szFieldStorage.__del__cCs|Sr�rrnrrr�	__enter__�szFieldStorage.__enter__cGs|j��dSr�)rwr$)rlr#rrr�__exit__�szFieldStorage.__exit__cCsd|j|j|jfS)z"Return a printable representation.zFieldStorage(%r, %r, %r))rhrtrirnrrrro�s
�zFieldStorage.__repr__cCst|���Sr�)�iter�keysrnrrr�__iter__�szFieldStorage.__iter__cCsT|dkrt|��|jr:|j�d�|j��}|j�d�n|jdk	rL|j}nd}|S)Nrir)r�rw�seekr:rurkrrr�__getattr__�s

zFieldStorage.__getattr__cCs^|jdkrtd��g}|jD]}|j|kr|�|�q|sBt|��t|�dkrV|dS|SdS)zDictionary style indexing.N�
not indexabler1r)rur�rh�appendrQrX)rlre�found�itemrrr�__getitem__s


zFieldStorage.__getitem__cCs8||kr0||}t|t�r(dd�|D�S|jSn|SdS)z8Dictionary style get() method, including 'value' lookup.cSsg|]
}|j�qSr�ri�rL�xrrr�
<listcomp>sz)FieldStorage.getvalue.<locals>.<listcomp>N�r5ruri�rlre�defaultrirrr�getvalues
zFieldStorage.getvaluecCs4||kr,||}t|t�r$|djS|jSn|SdS)z! Return the first value received.rNr�r�rrr�getfirsts

zFieldStorage.getfirstcCs:||kr2||}t|t�r(dd�|D�S|jgSngSdS)z  Return list of received values.cSsg|]
}|j�qSrr�r�rrrr�.sz(FieldStorage.getlist.<locals>.<listcomp>Nr�)rlrerirrrrK)s

zFieldStorage.getlistcCs*|jdkrtd��ttdd�|jD���S)zDictionary style keys() method.Nr�css|]}|jVqdSr��rh�rLr�rrr�	<genexpr>8sz$FieldStorage.keys.<locals>.<genexpr>)rur��setrnrrrr�4s
zFieldStorage.keyscs*|jdkrtd��t�fdd�|jD��S)z%Dictionary style __contains__ method.Nr�c3s|]}|j�kVqdSr�r�r��rerrr�>sz,FieldStorage.__contains__.<locals>.<genexpr>)rur��any)rlrerr�r�__contains__:s
zFieldStorage.__contains__cCst|���S)z Dictionary style len(x) support.)rXr�rnrrr�__len__@szFieldStorage.__len__cCs|jdkrtd��t|j�S)NzCannot be converted to bool.)rur��boolrnrrr�__bool__Ds
zFieldStorage.__bool__c	Cs�|j�|j�}t|t�s0td|jt|�jf��|�|j	|j
�}|jrT|d|j7}tj
j||j|j|j	|j
|j|jd�}dd�|D�|_|��dS)z+Internal: read data in query string format.�%s should return bytes, got %sr0�r&rJr�r+cSsg|]\}}t||��qSr�r�rLrerirrrr�Vsz0FieldStorage.read_urlencoded.<locals>.<listcomp>N)r>r:r�r5r�r9rvrpr;r&rJr�r=r
�	parse_qslr@rAr�r+ru�
skip_lines)rlrD�queryrrrr�Is&
��zFieldStorage.read_urlencodedcCsL|j}t|�std|f��g|_|jrftjj|j|j|j	|j
|j|j|j
d�}|j�dd�|D��|jpp|j}|j��}t|t�s�td|jt|�jf��|jt|�7_|��d|jkr�|r�|j��}|jt|�7_q�|j}|dk	�r|t|j�8}t�}	d}
|j��}|
|7}
|���s�q0�q|
�s:�q@|jt|
�7_|	�|
�|j
|j��|	��}d	|k�rz|d	=|jdk�r�dn
|j|j}
||j||||||
|j
|j||j
�}|dk	�r�|d
8}|j�r�|t|j�8}|dk�r�td��|j|j7_|j�|�|j �s@|j|j!k�r4dk�rnn�q@�q|�"�dS)
z/Internal: read a part that is itself multipart.z&Invalid boundary in multipart form: %rr�css|]\}}t||�VqdSr�r�r�rrrr�fsz*FieldStorage.read_multi.<locals>.<genexpr>r��--Nr{r}r1rzMax number of fields exceeded)#r��valid_boundaryr9rur�r=r
r�r@rAr&rJr�r+�extend�FieldStorageClass�	__class__r>r~r5r�rvrpr�rXrYrZfeedr;r$r�r�r�r�r�)rlr?r@rAZibr��klassZ
first_liner��parserZhdr_text�datarIr��partrrrr�[s��

��





��

(zFieldStorage.read_multicCs4|jdkr|��|��n|��|j�d�dS)zInternal: read an atomic part.rN)r��read_binaryr��
read_linesrwr�rnrrrr��s


zFieldStorage.read_singlei cCs�|��|_|j}|dkr�|dkr�|j�t||j��}t|t�sVt	d|jt
|�jf��|jt
|�7_|std|_q�|j�|�|t
|�}qdS)zInternal: read binary data.rr�r_N)�	make_filerwr�r>r:�min�bufsizer5r�r9rvrpr�rXr�r")rlZtodor�rrrr��s

�zFieldStorage.read_binarycCs@|jrt�|_|_nt�|_|_|jr4|��n|��dS)z0Internal: read lines until EOF or outerboundary.N)r�rrw�_FieldStorage__filerr��read_lines_to_outerboundary�read_lines_to_eofrnrrrr��s
zFieldStorage.read_linescCsv|jdk	rF|j��t|�dkrF|��|_|j��}|j�|�d|_|jrZ|j�|�n|j�|�|j	|j
��dS)z line is always bytes, not stringNi�)r��tellrXr�rwr�r"r�r;r&rJ)rlrcr�rrrZ__write�s


zFieldStorage.__writecCs:|j�d�}|jt|�7_|s*d|_q6|�|�qdS)zInternal: read lines until EOF.�r_N)r>r~r�rXr��_FieldStorage__write)rlrcrrrr��szFieldStorage.read_lines_to_eofc	CsJd|j}|d}d}d}d}|jdk	rFd|jkr>|krFnn�qF|j�d�}|jt|�7_|t|�7}|s~d|_�qF|dkr�||}d}|�d�r�|r�|��}||kr��qF||kr�d	|_�qF|}|�	d
�r�d
}|dd�}d}nL|�	d��rd}|dd�}d}n*|�	d��r.d}|dd�}d
}nd}d
}|�
||�qdS)z�Internal: read lines until outerboundary.
        Data is read as bytes: boundaries and line ends must be converted
        to bytes for comparisons.
        r�r{TrNr�r_�
r1s
����
F)r�r�r>r~r�rXr��
startswith�rstrip�endswithr�)	rl�
next_boundary�
last_boundaryZdelim�last_line_lfendZ_readrc�strippedlineZodelimrrrr��sN
$
z(FieldStorage.read_lines_to_outerboundarycCs�|jr|jrdSd|j}|d}d}|j�d�}|jt|�7_|sPd|_q�|�d�r�|r�|��}||krpq�||kr�d|_q�|�d�}q&dS)z5Internal: skip lines until outer boundary if defined.Nr�Tr�r_r1r�)r�r�r>r~r�rXr�rY)rlr�r�r�rcr�rrrr�s$
zFieldStorage.skip_linescCs&|jrt�d�Stjd|jdd�SdS)a�Overridable: return a readable & writable file.

        The file will be used as follows:
        - data is written to it
        - seek(0)
        - data is read from it

        The file is opened in binary mode for files, in text mode
        for other fields

        This version opens a temporary file for reading and writing,
        and immediately deletes (unlinks) it.  The trick (on Unix!) is
        that the file can still be used, but it can't be opened by
        another process, and it will automatically be deleted when it
        is closed or when the current process terminates.

        If you want a more permanent file, you derive a class which
        overrides this method.  If you want a visible temporary file
        that is nevertheless automatically deleted when the script
        terminates, try defining a __del__ method in a derived class
        which unlinks the temporary files you have created.

        zwb+zw+r!)r&�newlineN)r��tempfileZ
TemporaryFiler&rnrrrr�(s
�zFieldStorage.make_file)N)N)!rprqrrrs�osr?rmr�r�r�ror�r�r�r�r�rKr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr	sL)�
&


E	
2cCs�td�t�tjt_zNt�}t�t�t|�t|�t	�dd�}|fdd�}td�|�Wnt
�YnXtd�daz&t�}t�t�t|�t|�Wnt
�YnXd	S)
z�Robust test CGI script, usable as main program.

    Write minimal HTTP headers and dump all information provided to
    the script in HTML form.

    zContent-type: text/htmlcSstd�dS)Nz,testing print_exception() -- <I>italics?</I>)�execrrrrr\[sztest.<locals>.fcSs
|�dSr�r)r\rrr�g]sztest.<locals>.gz9<H3>What follows is a test, not an actual exception:</H3>z*<H1>Second try with a small maxlen...</H1>�2N)�printr2�stdout�stderrr	rrrrrrr8)r?�formr\r�rrrr
Js4
c	Csx|dkrt��\}}}ddl}t�td�|�||�|�||�}tdt�d�|dd���t�|d�f�~dS)Nrz+<H3>Traceback (most recent call last):</H3>z<PRE>%s<B>%s</B></PRE>rr_)	r2�exc_info�	tracebackr��	format_tb�format_exception_only�html�escape�join)rvri�tbr�r�rurrrrqs

��c	Cs\t|���}t�td�td�|D]"}tdt�|�dt�||��q&td�t�dS)z#Dump the shell environment as HTML.z<H3>Shell Environment:</H3>�<DL>�<DT>�<DD>�</DL>N)�sortedr�r�r�r�)r?r�rerrrrs cCs�t|���}t�td�|s&td�td�|D]Z}tdt�|�ddd�||}tdt�tt|���d	�td
t�t|���q2td�t�dS)
z$Dump the contents of a form as HTML.z<H3>Form Contents:</H3>z<P>No form fields.r�r��:� )r[z<i>z</i>r�r�N)r�r�r�r�r��reprrv)r�r�rerirrrr�sc
Csjt�td�zt��}Wn6tk
rP}ztdt�t|���W5d}~XYnXtt�|��t�dS)z#Dump the current directory as HTML.z#<H3>Current Working Directory:</H3>zOSError:N)r�r��getcwdrr�r��str)�pwd�msgrrrr�s&cCs(t�td�t�ttj�t�dS)Nz <H3>Command Line Arguments:</H3>)r�r2r<rrrrr�s

cCstd�dS)z9Dump a list of environment variables used by CGI as HTML.a�
<H3>These environment variables could have been set:</H3>
<UL>
<LI>AUTH_TYPE
<LI>CONTENT_LENGTH
<LI>CONTENT_TYPE
<LI>DATE_GMT
<LI>DATE_LOCAL
<LI>DOCUMENT_NAME
<LI>DOCUMENT_ROOT
<LI>DOCUMENT_URI
<LI>GATEWAY_INTERFACE
<LI>LAST_MODIFIED
<LI>PATH
<LI>PATH_INFO
<LI>PATH_TRANSLATED
<LI>QUERY_STRING
<LI>REMOTE_ADDR
<LI>REMOTE_HOST
<LI>REMOTE_IDENT
<LI>REMOTE_USER
<LI>REQUEST_METHOD
<LI>SCRIPT_NAME
<LI>SERVER_NAME
<LI>SERVER_PORT
<LI>SERVER_PROTOCOL
<LI>SERVER_ROOT
<LI>SERVER_SOFTWARE
</UL>
In addition, HTTP headers sent by the server may be passed in the
environment as well.  Here are some common variable names:
<UL>
<LI>HTTP_ACCEPT
<LI>HTTP_CONNECTION
<LI>HTTP_HOST
<LI>HTTP_PRAGMA
<LI>HTTP_REFERER
<LI>HTTP_USER_AGENT
</UL>
N)r�rrrrr�scCs(ddl}t|t�rd}nd}|�||�S)Nrs^[ -~]{0,200}[!-~]$z^[ -~]{0,200}[!-~]$)�rer5r��match)rZr�Z_vb_patternrrrr��s

r��__main__)rErFr0)NNNN),rs�__version__�iorrrZcollections.abcrr2r�Zurllib.parser=Zemail.parserrZ
email.messagerr�r�r��__all__rrr rrr%rr8r?r
rr]rrr	r
rrrrrrr�rprrrr�<module>sh�#	�
F
:'
/
gzip.cpython-38.opt-1.pyc000064400000043412150335716500011115 0ustar00U

e5d�S�@sdZddlZddlZddlZddlZddlZddlZddlZddlZdddddgZ	d\Z
ZZZ
Zd	\ZZd
ZdZdZd
edddfdd�Zdd�ZGdd�d�ZGdd�de�ZGdd�dej�ZGdd�dej�Zefdd�dd�Zdd�Zdd�Ze dk�re�dS)z�Functions that read and write gzipped files.

The user of the file doesn't have to worry about the compression,
but random access is not allowed.�N�BadGzipFile�GzipFile�open�compress�
decompress)�����)rrr��	�rbcCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|�dd�}t|tttjf�r|t|||�}n,t|d	�s�t|d
�r�td|||�}nt	d��d|kr�t
�||||�S|SdS)aOpen a gzip-compressed file in binary or text mode.

    The filename argument can be an actual filename (a str or bytes object), or
    an existing file object to read from or write to.

    The mode argument can be "r", "rb", "w", "wb", "x", "xb", "a" or "ab" for
    binary mode, or "rt", "wt", "xt" or "at" for text mode. The default mode is
    "rb", and the default compresslevel is 9.

    For binary mode, this function is equivalent to the GzipFile constructor:
    GzipFile(filename, mode, compresslevel). In this case, the encoding, errors
    and newline arguments must not be provided.

    For text mode, a GzipFile object is created, and wrapped in an
    io.TextIOWrapper instance with the specified encoding, error handling
    behavior, and line ending(s).

    �t�bzInvalid mode: %rNz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary mode��read�writez1filename must be a str or bytes object, or a file)�
ValueError�replace�
isinstance�str�bytes�os�PathLiker�hasattr�	TypeError�io�
TextIOWrapper)�filename�mode�
compresslevel�encoding�errors�newlineZgz_modeZbinary_file�r%�/usr/lib64/python3.8/gzip.pyrs$cCs|�t�d|��dS)Nz<L)r�structZpack)�output�valuer%r%r&�write32uEsr*c@s<eZdZdZddd�Zdd�Zddd�Zd	d
�Zdd�Zd
S)�_PaddedFilez�Minimal read-only file object that prepends a string to the contents
    of an actual file. Shouldn't be used outside of gzip.py, as it lacks
    essential functionality.�cCs ||_t|�|_||_d|_dS�Nr)�_buffer�len�_length�file�_read)�self�f�prependr%r%r&�__init__Os
z_PaddedFile.__init__cCs~|jdkr|j�|�S|j||jkrJ|j}|j|7_|j||j�S|j}d|_|j|d�|j�||j|�SdS�N)r2r1rr0r.)r3�sizerr%r%r&rUs
�z_PaddedFile.readcCs>|jdkr||_n|jt|�8_dSt|j�|_d|_dSr-)r2r.r/r0)r3r5r%r%r&r5bs
z_PaddedFile.prependcCsd|_d|_|j�|�Sr7)r2r.r1�seek)r3Zoffr%r%r&r9ksz_PaddedFile.seekcCsdS�NTr%�r3r%r%r&�seekablepsz_PaddedFile.seekableN)r,)r,)	�__name__�
__module__�__qualname__�__doc__r6rr5r9r<r%r%r%r&r+Js

	r+c@seZdZdZdS)rz6Exception raised in some cases for invalid gzip files.N)r=r>r?r@r%r%r%r&rtsc@s�eZdZdZdZddeddfdd�Zedd��Zedd��Z	d	d
�Z
dd�Zd
d�Zdd�Z
d,dd�Zd-dd�Zdd�Zedd��Zdd�Zejfdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zejfd(d)�Zd.d*d+�ZdS)/ra
The GzipFile class simulates most of the methods of a file object with
    the exception of the truncate() method.

    This class only supports opening files in binary mode. If you need to open a
    compressed file in text mode, use the gzip.open() function.

    NcCs4|r"d|ksd|kr"td�|���|r6d|kr6|d7}|dkrTt�||pJd�}|_|dkr|t|dd�}t|ttf�s�d}n
t	�
|�}|dkr�t|d	d�}|�d
�r�t|_
t|�}t�|�|_||_nN|�d��rt|_
|�|�t�|tjtjtjd�|_||_ntd�|���||_|j
tk�r0|�|�dS)
aGConstructor for the GzipFile class.

        At least one of fileobj and filename must be given a
        non-trivial value.

        The new class instance is based on fileobj, which can be a regular
        file, an io.BytesIO object, or any other object which simulates a file.
        It defaults to None, in which case filename is opened to provide
        a file object.

        When fileobj is not None, the filename argument is only used to be
        included in the gzip file header, which may include the original
        filename of the uncompressed file.  It defaults to the filename of
        fileobj, if discernible; otherwise, it defaults to the empty string,
        and in this case the original filename is not included in the header.

        The mode argument can be any of 'r', 'rb', 'a', 'ab', 'w', 'wb', 'x', or
        'xb' depending on whether the file will be read or written.  The default
        is the mode of fileobj if discernible; otherwise, the default is 'rb'.
        A mode of 'r' is equivalent to one of 'rb', and similarly for 'w' and
        'wb', 'a' and 'ab', and 'x' and 'xb'.

        The compresslevel argument is an integer from 0 to 9 controlling the
        level of compression; 1 is fastest and produces the least compression,
        and 9 is slowest and produces the most compression. 0 is no compression
        at all. The default is 9.

        The mtime argument is an optional numeric timestamp to be written
        to the last modification time field in the stream when compressing.
        If omitted or None, the current time is used.

        r�UzInvalid mode: {!r}rNr�namerr �r)�w�a�xr)r�format�builtinsr�	myfileobj�getattrrrrr�fspath�
startswith�READr �_GzipReaderr�BufferedReaderr.rB�WRITE�_init_write�zlibZcompressobjZDEFLATED�	MAX_WBITSZ
DEF_MEM_LEVELr�_write_mtime�fileobj�_write_gzip_header)r3rr r!rU�mtime�rawr%r%r&r6�s@#


�zGzipFile.__init__cCsBddl}|�dtd�|jtkr<|jdd�dkr<|jdS|jS)Nrzuse the name attributer����.gz)�warnings�warn�DeprecationWarningr rPrB)r3r[r%r%r&r�s

zGzipFile.filenamecCs
|jjjS)z0Last modification time read from stream, or None)r.rX�_last_mtimer;r%r%r&rW�szGzipFile.mtimecCs.t|j�}d|dd�dtt|��dS)Nz<gzip r���� �>)�reprrU�hex�id)r3�sr%r%r&�__repr__�s
zGzipFile.__repr__cCs.||_t�d�|_d|_g|_d|_d|_dS�Nr,r)rBrR�crc32�crcr8Zwritebuf�bufsize�offset)r3rr%r%r&rQ�szGzipFile._init_writecCs|j�d�|j�d�z<tj�|j�}t|t�s<|�d�}|�	d�rR|dd�}Wnt
k
rld}YnXd}|rzt}|j�t|��d��|j
}|dkr�t��}t|jt|��|tkr�d}n|tkr�d	}nd
}|j�|�|j�d�|�r|j�|d
�dS)N���zlatin-1s.gzrYr,r�����)rUrr�path�basenamerBrr�encode�endswith�UnicodeEncodeError�FNAME�chrrT�timer*�int�_COMPRESS_LEVEL_BEST�_COMPRESS_LEVEL_FAST)r3r!Zfname�flagsrWZxflr%r%r&rV�s6



zGzipFile._write_gzip_headercCs�|��|jtkr&ddl}t|jd��|jdkr8td��t|t	�rLt
|�}nt|�}|j}|dkr�|j�
|j�|��|j|7_t�||j�|_|j|7_|S)Nrz$write() on read-only GzipFile objectz!write() on closed GzipFile object)�_check_not_closedr rP�errno�OSError�EBADFrUrrrr/�
memoryview�nbytesrrr8rRrhrirk)r3�datarZlengthr%r%r&rs 



zGzipFile.writer_cCs2|��|jtkr&ddl}t|jd��|j�|�S)Nrz$read() on write-only GzipFile object)r~r rMrr�r�r.r�r3r8rr%r%r&rs

z
GzipFile.readcCs@|��|jtkr&ddl}t|jd��|dkr4tj}|j�	|�S)zdImplements BufferedIOBase.read1()

        Reads up to a buffer's worth of data if size is negative.rNz%read1() on write-only GzipFile object)
r~r rMrr�r�r�DEFAULT_BUFFER_SIZEr.�read1r�r%r%r&r�&s
zGzipFile.read1cCs2|��|jtkr&ddl}t|jd��|j�|�S)Nrz$peek() on write-only GzipFile object)r~r rMrr�r�r.�peek)r3�nrr%r%r&r�3s

z
GzipFile.peekcCs
|jdkSr7�rUr;r%r%r&�closed:szGzipFile.closedcCs�|j}|dkrdSd|_zP|jtkrR|�|j���t||j	�t||j
d@�n|jtkrf|j��W5|j}|r�d|_|��XdS)N���)
rUrI�closer rPrr�flushr*rir8rMr.)r3rUrIr%r%r&r�>s

zGzipFile.closecCs4|��|jtkr0|j�|j�|��|j��dSr7)r~r rPrUrrr�)r3Z	zlib_moder%r%r&r�Qs
zGzipFile.flushcCs
|j��S)z�Invoke the underlying file object's fileno() method.

        This will raise AttributeError if the underlying file object
        doesn't support fileno().
        )rU�filenor;r%r%r&r�XszGzipFile.filenocCs"|jtkrtd��|j�d�dS)z[Return the uncompressed stream file position indicator to the
        beginning of the filezCan't rewind in write moderN)r rMr�r.r9r;r%r%r&�rewind`s
zGzipFile.rewindcCs
|jtkSr7)r rMr;r%r%r&�readablegszGzipFile.readablecCs
|jtkSr7)r rPr;r%r%r&�writablejszGzipFile.writablecCsdSr:r%r;r%r%r&r<mszGzipFile.seekablecCs�|jtkr�|tjkr2|tjkr*|j|}ntd��||jkrDtd��||j}d}t|d�D]}|�	|�q^|�	d|d�n |jt
kr�|��|j�
||�S|jS)NzSeek from end not supportedzNegative seek in write modes�rp)r rPr�SEEK_SET�SEEK_CURrkrr��rangerrMr~r.r9)r3rk�whence�count�chunk�ir%r%r&r9ps 





z
GzipFile.seekcCs|��|j�|�Sr7)r~r.�readline)r3r8r%r%r&r��szGzipFile.readline)r_)r_)r_)r=r>r?r@rIr{r6�propertyrrWrfrQrVrrr�r�r�r�rRZZ_SYNC_FLUSHr�r�r�r�r�r<rr�r9r�r%r%r%r&rxs:
�
I

 



csZeZdZ�fdd�Zdd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Z	�fdd�Z
�ZS)rNcs,t�jt|�tjtjd�d|_d|_dS)N)ZwbitsT)�superr6r+rRZ
decompressobjrS�_new_memberr^)r3�fp��	__class__r%r&r6�s
�z_GzipReader.__init__cCst�d�|_d|_dSrg)rRrh�_crc�_stream_sizer;r%r%r&�
_init_read�sz_GzipReader._init_readcCsF|j�|�}t|�|krB|j�|t|��}|s8td��||7}q|S)z�Read exactly *n* bytes from `self._fp`

        This method is required because self._fp may be unbuffered,
        i.e. return short reads.
        �ACompressed file ended before the end-of-stream marker was reached)�_fprr/�EOFError)r3r�r�rr%r%r&�_read_exact�s
z_GzipReader._read_exactcCs�|j�d�}|dkrdS|dkr,td|��t�d|�d��\}}|_|dkrVtd��|t@r|t�d	|�d��\}|�|�|t@r�|j�d
�}|r�|dkr�q�q�|t	@r�|j�d
�}|r�|dkr�q�q�|t
@r�|�d�dS)
Nrr,FrlzNot a gzipped file (%r)z<BBIxxr
zUnknown compression methodz<HrrpT)r�rrr'�unpackr�r^�FEXTRArw�FCOMMENT�FHCRC)r3�magic�method�flagZ	extra_lenrer%r%r&�_read_gzip_header�s0�

z_GzipReader._read_gzip_headerr_cCs�|dkr|��S|sdS|jjr>|��d|_|jf|j�|_|jrf|��|��s`|j	|_
dSd|_|j�t
j�}|j�||�}|jjdkr�|j�|jj�n|jjdkr�|j�|jj�|dkr�q�|dkrtd��q|�|�|j	t|�7_	|S)Nrr,TFr�)�readallZ
_decompressor�eof�	_read_eofr�Z_decomp_factoryZ_decomp_argsr�r�Z_posZ_sizer�rrr�rZunconsumed_tailr5Zunused_datar��_add_read_datar/)r3r8�bufZ
uncompressr%r%r&r�s:�

z_GzipReader.readcCs$t�||j�|_|jt|�|_dSr7)rRrhr�r�r/)r3r�r%r%r&r��sz_GzipReader._add_read_datacCs�t�d|�d��\}}||jkr<tdt|�t|j�f��n||jd@krRtd��d}|dkrl|j�d�}qV|r||j�	|�dS)Nz<IIr
zCRC check failed %s != %sr�z!Incorrect length of data producedrpr)
r'r�r�r�rrcr�r�rr5)r3rhZisize�cr%r%r&r��s

�
z_GzipReader._read_eofcst���d|_dSr:)r��_rewindr�r;r�r%r&r�s
z_GzipReader._rewind)r_)r=r>r?r6r�r�r�rr�r�r��
__classcell__r%r%r�r&rN�s!
3rN)rWc	Cs6t��}t|d||d��}|�|�W5QRX|��S)z�Compress data in one shot and return the compressed string.
    Optional argument is the compression level, in range of 0-9.
    �wb)rUr r!rW)r�BytesIOrr�getvalue)r�r!rWr�r4r%r%r&rsc
Cs0tt�|�d��}|��W5QR�SQRXdS)zYDecompress a gzip compressed string in one shot.
    Return the decompressed string.
    r�N)rrr�r)r�r4r%r%r&rsc	Cs�ddlm}|dd�}|��}|jdddd�|jd	dd
d�|jdddd
d�|jdddgdd�|��}t}|jr|t}n
|jr�t	}|j
D]�}|jr�|dkr�tddt
jjd�}t
jj}n>|dd�dkr�t
�d|���t|d�}t�|dd�d�}nB|dk�r"t
jj}tddt
jj|d�}nt�|d�}t|dd�}|�d�}|�sP�q^|�|��q<|t
jjk	�rt|��|t
jjk	r�|��q�dS)Nr)�ArgumentParserzeA simple command line interface for the gzip module: act like gzip, but do not delete the input file.)Zdescriptionz--fast�
store_truezcompress faster)�action�helpz--bestzcompress betterz-dz--decompresszact like gunzip instead of gzip�args�*�-r1)�nargs�default�metavarrr)rr rUrYrZzfilename doesn't end in .gz: r�)rr rUr!r�)�argparser�Zadd_mutually_exclusive_group�add_argument�
parse_args�_COMPRESS_LEVEL_TRADEOFFZfastr|Zbestr{r�rr�sys�stdin�buffer�stdout�exitrrHrrr�)	r��parser�groupr�r!�argr4�gr�r%r%r&�main'sR�
�



�
r��__main__)!r@r'r�ryrrRrHrZ_compression�__all__ZFTEXTr�r�rwr�rMrPr|r�r{rr*r+r�rZ
BaseStreamrZDecompressReaderrNrrr�r=r%r%r%r&�<module>s: �
,*	0
pyclbr.cpython-38.opt-1.pyc000064400000024325150335716500011441 0ustar00U

e5d�;�@s�dZddlZddlZddlZddlZddlmZmZm	Z	ddddgZ
iZGdd	�d	�ZGd
d�de�Z
Gdd�de�Zdd
�Zddd�Zddd�Zddd�Zd dd�Zdd�Zdd�Zdd�Zdd�Zedkr�e�dS)!aParse a Python module and describe its classes and functions.

Parse enough of a Python file to recognize imports and class and
function definitions, and to find out the superclasses of a class.

The interface consists of a single function:
    readmodule_ex(module, path=None)
where module is the name of a Python module, and path is an optional
list of directories where the module is to be searched.  If present,
path is prepended to the system search path sys.path.  The return value
is a dictionary.  The keys of the dictionary are the names of the
classes and functions defined in the module (including classes that are
defined via the from XXX import YYY construct).  The values are
instances of classes Class and Function.  One special key/value pair is
present for packages: the key '__path__' has a list as its value which
contains the package search path.

Classes and Functions have a common superclass: _Object.  Every instance
has the following attributes:
    module  -- name of the module;
    name    -- name of the object;
    file    -- file in which the object is defined;
    lineno  -- line in the file where the object's definition starts;
    parent  -- parent of this object, if any;
    children -- nested objects contained in this object.
The 'children' attribute is a dictionary mapping names to objects.

Instances of Function describe functions with the attributes from _Object.

Instances of Class describe classes with the attributes from _Object,
plus the following:
    super   -- list of super classes (Class instances if possible);
    methods -- mapping of method names to beginning line numbers.
If the name of a super class is not recognized, the corresponding
entry in the list of super classes is not a class instance but a
string giving the name of the super class.  Since import statements
are recognized and imported modules are scanned as well, this
shouldn't happen often.
�N)�NAME�DEDENT�OP�
readmodule�
readmodule_ex�Class�Functionc@s eZdZdZdd�Zdd�ZdS)�_Objectz+Information about Python class or function.cCs(||_||_||_||_||_i|_dS�N)�module�name�file�lineno�parent�children��selfrrr
rr�r�/usr/lib64/python3.8/pyclbr.py�__init__6sz_Object.__init__cCs||j|<dSr
)r)rr�objrrr�	_addchild>sz_Object._addchildN)�__name__�
__module__�__qualname__�__doc__rrrrrrr	4sr	c@seZdZdZddd�ZdS)rz7Information about a Python function, including methods.NcCst�||||||�dSr
)r	rrrrrrDszFunction.__init__)N)rrrrrrrrrrBscs*eZdZdZd�fdd�	Zdd�Z�ZS)rz!Information about a Python class.Ncs0t�||||||�|dkr gn||_i|_dSr
)r	r�super�methods)rrrrr
rr��	__class__rrrJszClass.__init__cCs||j|<dSr
)r)rrrrrr�
_addmethodOszClass._addmethod)N)rrrrrr �
__classcell__rrrrrHscCs:t|j||j||�}|�||�t|t�r6|�||�|S)z*Return a Function after nesting within ob.)rrr
r�
isinstancerr )�ob�	func_namerZnewfuncrrr�_nest_functionSs

r%cCs&t|j|||j||�}|�||�|S)z'Return a Class after nesting within ob.)rrr
r)r#�
class_namerrZnewclassrrr�_nest_class[sr'cCs6i}t||pg���D]\}}t|t�r|||<q|S)z�Return Class objects for the top-level classes in module.

    This is the original interface, before Functions were added.
    )�_readmodule�itemsr"r)r�path�res�key�valuerrrras


cCst||p
g�S)z�Return a dictionary with all functions and classes in module.

    Search for module in PATH + sys.path.
    If possible, include imported superclasses.
    Do this by reading source, without importing (and executing) it.
    )r()rr*rrrrmsc	Cs�|dk	rd||f}n|}|tkr*t|Si}|tjkrL|dkrL|t|<|S|�d�}|dkr�|d|�}||dd�}t|||�}|dk	r�d||f}d|kr�td�|���t||d|�Sd}	|dk	r�|}
n
|tj}
tj	�
||
�}|dk�rtd|��|d	��|t|<|jdk	�r$|j|d<z|j
�|�}Wnttfk
�rR|YSX|dk�rb|S|j
�|�}
t|||
|||�S)
a.Do the hard work for readmodule[_ex].

    If inpackage is given, it must be the dotted name of the package in
    which we are searching for a submodule, and then PATH must be the
    package search path; otherwise, we are searching for a top-level
    module, and path is combined with sys.path.
    Nz%s.%s�.r��__path__zNo package named {}zno module named )r)�_modules�sys�builtin_module_names�rfindr(�ImportError�formatr*�	importlib�util�_find_spec_from_path�ModuleNotFoundError�submodule_search_locations�loader�
get_source�AttributeError�get_filename�_create_tree)rr*�	inpackage�
fullmodule�tree�i�packageZ	submoduler�fZsearch_path�spec�source�fnamerrrr(vsJ	





r(c!
CsHt�|�}g}t�|j�}�z|D�]�\}	}
}}}
|	tkr`|\}}|r^|dd|kr^|d=qBq"|
dkr�|\}}|r�|dd|kr�|d=qpt|�dd�\}	}}|	tkr�q"d}|r�|dd}t|||�}nt	||||�}|||<|�
||f�q"|
dk�r�|\}}|�r(|dd|k�r(|d=�qt|�dd�\}	}}|	tk�rJq"t|�dd�\}	}
}d}|
dk�r�g}d}g}t|�dd�\}	}
}|
d	k�r|dk�rd
�|�}||k�r�||}nL|�d�}t
|�dk�r|d}|d}|tk�rt|}||k�r||}|�
|�g}|
dk�r0|d7}nZ|
d
k�rR|d8}|dk�r��q�n8|
dk�rh|dk�rhn"|	ttfk�rz|dk�rz|�
|
��qz|}|�r�|dd}t||||�}nt|||||�}|||<|�
||f�q"|
dk�rh|ddk�rht|�}|D]d\}}zL|dk�r t||�n2zt|||�Wn tk
�rPt|g�YnXWnYnX�qq"|
dkr"|ddkr"t|�\}}
|r"|
dk�r�q"t|�}zt|||�}WnYq"YnX|D]X\}} ||k�r�|||| �p�|<n0|dk�r�|D] }|ddk�r�||||<�q��q�q"Wntk
�r:YnX|��|S)a�Return the tree for a particular module.

    fullmodule (full module name), inpackage+module, becomes o.module.
    path is passed to recursive calls of _readmodule.
    fname becomes o.file.
    source is tokenized.  Imports cause recursive calls to _readmodule.
    tree is {} or {'__path__': <submodule search locations>}.
    inpackage, None or string, is passed to recursive calls of _readmodule.

    The effect of recursive calls is mutation of global _modules.
    ���r/�defr�N�class�()�)�,�r.���rOrP�import�from�*�_)�io�StringIO�tokenize�generate_tokens�readliner�nextrr%r�append�join�split�lenr1rr'r�_getnamelistr(r5�_getname�
StopIteration�close)!rBr*rIrHrCrArF�stack�g�	tokentype�token�startZ_end�_linerZ
thisindentr$Zcur_funcZcur_objr&Zinherit�names�levelr�n�c�m�dZ	cur_class�modules�modZ_mod2Zn2rrrr@�s�
















��



r@cCslg}t|�\}}|sqh|dkr,t|�\}}nd}|�||f�|dkr\d|kr\t|�d}q>|dkrqhq|S)z�Return list of (dotted-name, as-name or None) tuples for token source g.

    An as-name is the name that follows 'as' in an as clause.
    �asNrP�
r/)rbr]r\)rfrkrrhZname2rrrraEsracCs�g}t|�dd�\}}|tkr0|dkr0d|fS|�|�t|�dd�\}}|dkrXq�t|�dd�\}}|tkrvq�|�|�q:d�|�|fS)zBReturn (dotted-name or None, next-token) tuple for token source g.r�rUNr.)r\rr]r^)rf�partsrgrhrrrrb[s
rbc
CsXddl}ztjd}Wnt}YnX|j�|�rj|j�|�g}|j�|�}|���	d�rn|dd�}ng}t
||�}dd�}t|��|dd	�}d
}|�rT|�
�}t|t�r�q�t|d�s�d|_t|t�r�t|j��|dd	�}|D]}	|j||	_q�|�|�t|t��r,td�d
|j|j|j|j��q�t|t�r�td�d
|j|j|j��q�dS)z?Print module output (default this file) for quick visual check.rNr/z.py���cSst|dd�S)Nrr)�getattr)�arrr�<lambda>|�z_main.<locals>.<lambda>T)r,�reverseru�indentz{}class {} {} {}� z{}def {} {})�osr2�argv�__file__r*�exists�dirname�basename�lower�endswithr�sorted�values�popr"�list�hasattrr}r	r�extendr�printr6rrrr)
rrrr*rCZ
lineno_keyZobjsZindent_levelrZnew_objsr#rrr�_mainmsL





�
�
r��__main__)N)N)N)N)rrWr2�importlib.utilr7rYrhrrr�__all__r1r	rrr%r'rrr(r@rarbr�rrrrr�<module>s,(


	
@&reprlib.cpython-38.pyc000064400000012271150335716500010643 0ustar00U

e5d��@s^dZdddgZddlZddlmZddlmZd
d	d�ZGd
d�d�Zdd�Z	e�Z
e
jZdS)zGRedo the builtin repr() (representation) but with limits on most sizes.�Repr�repr�recursive_repr�N)�islice)�	get_ident�...cs�fdd�}|S)zGDecorator to make a repr function return fillvalue for a recursive callcsXt�����fdd�}t�d�|_t�d�|_t�d�|_t�d�|_t�di�|_|S)Nc	sBt|�t�f}|�kr�S��|�z�|�}W5��|�X|S�N)�idr�add�discard)�self�key�result)�	fillvalue�repr_running�
user_function��/usr/lib64/python3.8/reprlib.py�wrappers
z<recursive_repr.<locals>.decorating_function.<locals>.wrapper�
__module__�__doc__�__name__�__qualname__�__annotations__)�set�getattrrrrrr)rr�r)rrr�decorating_functionsz+recursive_repr.<locals>.decorating_functionr)rrrrrr	sc@s~eZdZdd�Zdd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS) rcCsFd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
dS)N�����()�maxlevel�maxtuple�maxlist�maxarray�maxdict�maxset�maxfrozenset�maxdeque�	maxstring�maxlong�maxother)rrrr�__init__&sz
Repr.__init__cCs|�||j�Sr)�repr1r#)r�xrrrr3sz	Repr.reprcCsVt|�j}d|kr$|��}d�|�}t|d|�rFt|d|�||�S|�||�SdS)N� �_�repr_)�typer�split�join�hasattrr�
repr_instance)rr0�level�typename�partsrrrr/6s

z
Repr.repr1�c
s�t|�}|dkr|rd}nX|d�|j���fdd�t||�D�}	||krT|	�d�d�|	�}|dkrr|rr||}d|||fS)Nrr�csg|]}�|���qSrr)�.0�elem��newlevelr/rr�
<listcomp>Gsz'Repr._repr_iterable.<locals>.<listcomp>�, z%s%s%s)�lenr/r�appendr6)
rr0r9�left�right�maxiter�trail�n�s�piecesrr@r�_repr_iterable@s

zRepr._repr_iterablecCs|�||dd|jd�S)N�(�)�,)rMr$�rr0r9rrr�
repr_tupleMszRepr.repr_tuplecCs|�||dd|j�S)N�[�])rMr%rQrrr�	repr_listPszRepr.repr_listcCs,|sd|jSd|j}|�|||d|j�S)Nzarray('%s')z
array('%s', [�]))�typecoderMr&)rr0r9�headerrrr�
repr_arraySs

zRepr.repr_arraycCs$|sdSt|�}|�||dd|j�S)Nzset()�{�})�_possibly_sortedrMr(rQrrr�repr_setYsz
Repr.repr_setcCs$|sdSt|�}|�||dd|j�S)Nzfrozenset()zfrozenset({z}))r\rMr)rQrrr�repr_frozenset_s�zRepr.repr_frozensetcCs|�||dd|j�S)Nzdeque([rV)rMr*rQrrr�
repr_dequefszRepr.repr_dequecCs�t|�}|dkrdS|dkr dS|d}|j}g}tt|�|j�D].}|||�}||||�}	|�d||	f�qB||jkr�|�d�d�|�}
d|
fS)	Nrz{}z{...}r=z%s: %srrCz{%s})rDr/rr\r'rEr6)rr0r9rJrAr/rLr
�keyrepr�valreprrKrrr�	repr_dictis 



zRepr.repr_dictcCs�t�|d|j��}t|�|jkr�td|jdd�}td|jd|�}t�|d|�|t|�|d��}|d|�d|t|�|d�}|S�Nr��r)�builtinsrr+rD�max�rr0r9rK�i�jrrr�repr_strxs&$z
Repr.repr_strcCsht�|�}t|�|jkrdtd|jdd�}td|jd|�}|d|�d|t|�|d�}|Src)rfrrDr,rgrhrrr�repr_int�s
$z
Repr.repr_intcCs�zt�|�}Wn(tk
r6d|jjt|�fYSXt|�|jkr�td|jdd�}td|jd|�}|d|�d|t|�|d�}|S)Nz<%s instance at %#x>rrdrer)	rfr�	Exception�	__class__rr	rDr-rgrhrrrr8�s$zRepr.repr_instanceN)r<)rrrr.rr/rMrRrUrYr]r^r_rbrkrlr8rrrrr$s



	cCs,z
t|�WStk
r&t|�YSXdSr)�sortedrm�list)r0rrrr\�s
r\)r)r�__all__rf�	itertoolsr�_threadrrrr\�aReprrrrrr�<module>s

s	lzma.cpython-38.opt-2.pyc000064400000013333150335716500011107 0ustar00U

e5d�2�$@s�dddddddddd	d
ddd
ddddddddddddddddddd d!d"d#g$Zd$d%lZd$d%lZd$d%lZd$d&lTd$d'lmZmZd$d%lZd$Zd(Z	d)Z
Gd*d�dej�Zd1d%d,d%d%d%d%d%d-�d.d �Z
ed,d%d%fd/d!�Zed%d%fd0d"�Zd%S)2Z
CHECK_NONEZCHECK_CRC32ZCHECK_CRC64ZCHECK_SHA256ZCHECK_ID_MAXZ
CHECK_UNKNOWNZFILTER_LZMA1ZFILTER_LZMA2ZFILTER_DELTAZ
FILTER_X86ZFILTER_IA64Z
FILTER_ARMZFILTER_ARMTHUMBZFILTER_POWERPCZFILTER_SPARC�FORMAT_AUTO�	FORMAT_XZZFORMAT_ALONEZ
FORMAT_RAWZMF_HC3ZMF_HC4ZMF_BT2ZMF_BT3ZMF_BT4Z	MODE_FASTZMODE_NORMALZPRESET_DEFAULTZPRESET_EXTREME�LZMACompressor�LZMADecompressor�LZMAFile�	LZMAError�open�compress�
decompressZis_check_supported�N)�*)�_encode_filter_properties�_decode_filter_properties��c@s�eZdZd!ddddd�dd�Zdd�Zed	d
��Zdd�Zd
d�Zdd�Z	dd�Z
d"dd�Zd#dd�Zd$dd�Z
d%dd�Zdd�Zejfdd�Zdd �ZdS)&rN�r�����format�check�preset�filtersc	Cs&d|_d|_t|_|dkrL|dkr*td��|dk	r:td��|dkrFt}t}n@|dkr~|dkr`t}t}t	||||d�|_
d|_ntd	�|���t
|tttjf�r�d
|kr�|d
7}t�||�|_d|_||_n*t|d�s�t|d
�r�||_||_ntd��|jtk�r"tj|jtt||d�}t�|�|_dS)NF)r�rbrzACannot specify an integrity check when opening a file for readingzICannot specify a preset compression level when opening a file for reading)�w�wb�aZab�xZxbrr
zInvalid mode: {!r}�bT�read�writez6filename must be a str, bytes, file or PathLike object)Ztrailing_errorrr)�_fp�_closefp�_MODE_CLOSED�_mode�
ValueErrorr�
_MODE_READr�_MODE_WRITEr�_compressor�_posr�
isinstance�str�bytes�os�PathLike�builtinsr�hasattr�	TypeError�_compressionZDecompressReaderrr�io�BufferedReader�_buffer)	�self�filename�moderrrrZ	mode_code�raw�r8�/usr/lib64/python3.8/lzma.py�__init__1sL,�
�zLZMAFile.__init__cCs�|jtkrdSzB|jtkr,|j��d|_n"|jtkrN|j�|j	�
��d|_	W5z|jrd|j��W5d|_d|_t|_XXdS)NF)r"r!rr �closer$r3r%rr&�flush�r4r8r8r9r;�s




zLZMAFile.closecCs
|jtkS�N)r"r!r=r8r8r9�closed�szLZMAFile.closedcCs|��|j��Sr>)�_check_not_closedr�filenor=r8r8r9rA�szLZMAFile.filenocCs|��o|j��Sr>)�readabler3�seekabler=r8r8r9rC�szLZMAFile.seekablecCs|��|jtkSr>)r@r"r$r=r8r8r9rB�szLZMAFile.readablecCs|��|jtkSr>)r@r"r%r=r8r8r9�writable�szLZMAFile.writablecCs|��|j�|�Sr>)�_check_can_readr3�peek�r4�sizer8r8r9rF�sz
LZMAFile.peekcCs|��|j�|�Sr>)rEr3rrGr8r8r9r�sz
LZMAFile.readcCs"|��|dkrtj}|j�|�S)Nr
)rEr1�DEFAULT_BUFFER_SIZEr3�read1rGr8r8r9rJ�szLZMAFile.read1cCs|��|j�|�Sr>)rEr3�readlinerGr8r8r9rK�szLZMAFile.readlinecCs:|��|j�|�}|j�|�|jt|�7_t|�Sr>)Z_check_can_writer&rrrr'�len)r4�dataZ
compressedr8r8r9r�s
zLZMAFile.writecCs|��|j�||�Sr>)Z_check_can_seekr3�seek)r4�offset�whencer8r8r9rN�sz
LZMAFile.seekcCs"|��|jtkr|j��S|jSr>)r@r"r$r3�tellr'r=r8r8r9rQ�s

z
LZMAFile.tell)Nr)r)r)r)r)�__name__�
__module__�__qualname__r:r;�propertyr?rArCrBrDrFrrJrKrr1�SEEK_SETrNrQr8r8r8r9r&s(�U


	



rr)rrrr�encoding�errors�newlinecCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|�dd�}	t||	||||d�}
d|kr�t�|
|||�S|
SdS)	N�trzInvalid mode: %rz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary mode�r)r#�replacerr1�
TextIOWrapper)r5r6rrrrrWrXrYZlz_modeZbinary_filer8r8r9rs"
�cCs t||||�}|�|�|��Sr>)rrr<)rMrrrr�compr8r8r9r6scCspg}t|||�}z|�|�}Wn tk
r>|r8Yqfn�YnX|�|�|jsXtd��|j}|sqfqd�|�S)NzACompressed data ended before the end-of-stream marker was reached�)rr	r�append�eofZunused_data�join)rMrZmemlimitrZresultsZdecomp�resr8r8r9r	Bs
)r)�__all__r-r1r+Z_lzmarr
r0r!r$r%Z
BaseStreamrrrrrr	r8r8r8r9�<module>st�
b�/csv.cpython-38.pyc000064400000027210150335716500007776 0ustar00U

e5d?�@s@dZddlZddlmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZddlmZddlmZdddd	d
ddd
dddddddddddddgZGdd�d�ZGdd
�d
e�Zed
e�Gdd�de�Zede�Gdd�de�Zed e�Gd!d�d�ZGd"d�d�ZzeWnek
�r,eZYnXGd#d�d�ZdS)$z+
csv.py - read/write/investigate CSV files
�N)�Error�__version__�writer�reader�register_dialect�unregister_dialect�get_dialect�
list_dialects�field_size_limit�
QUOTE_MINIMAL�	QUOTE_ALL�QUOTE_NONNUMERIC�
QUOTE_NONE�__doc__)�Dialect)�StringIOrrr
rrrr�excel�	excel_tabr
rrrrr	�Snifferrr�
DictReader�
DictWriter�unix_dialectc@sDeZdZdZdZdZdZdZdZdZ	dZ
dZdZdd�Z
dd�ZdS)	rz�Describe a CSV dialect.

    This must be subclassed (see csv.excel).  Valid attributes are:
    delimiter, quotechar, escapechar, doublequote, skipinitialspace,
    lineterminator, quoting.

    �FNcCs|jtkrd|_|��dS)NT)�	__class__r�_valid�	_validate��self�r�/usr/lib64/python3.8/csv.py�__init__*s
zDialect.__init__c
Cs@zt|�Wn.tk
r:}ztt|���W5d}~XYnXdS�N)�_Dialect�	TypeErrorr�str)r�errrr/szDialect._validate)�__name__�
__module__�__qualname__r�_namer�	delimiter�	quotecharZ
escapechar�doublequote�skipinitialspace�lineterminator�quotingr rrrrrrsc@s(eZdZdZdZdZdZdZdZe	Z
dS)rz;Describe the usual properties of Excel-generated CSV files.�,�"TF�
N)r&r'r(rr*r+r,r-r.rr/rrrrr6sc@seZdZdZdZdS)rzEDescribe the usual properties of Excel-generated TAB-delimited files.�	N)r&r'r(rr*rrrrr@sz	excel-tabc@s(eZdZdZdZdZdZdZdZe	Z
dS)rz:Describe the usual properties of Unix-generated CSV files.r0r1TF�
N)r&r'r(rr*r+r,r-r.rr/rrrrrEsZunixc@s@eZdZddd�Zdd�Zedd��Zejd	d��Zd
d�ZdS)
rNrcOs6||_||_||_t||f|�|�|_||_d|_dS�Nr)�_fieldnames�restkey�restvalr�dialect�line_num)r�f�
fieldnamesr7r8r9�args�kwdsrrrr QszDictReader.__init__cCs|Sr!rrrrr�__iter__ZszDictReader.__iter__cCs@|jdkr0zt|j�|_Wntk
r.YnX|jj|_|jSr!)r6�nextr�
StopIterationr:rrrrr<]s

zDictReader.fieldnamescCs
||_dSr!)r6)r�valuerrrr<gscCs�|jdkr|jt|j�}|jj|_|gkr8t|j�}q$tt|j|��}t|j�}t|�}||krv||d�||j<n&||kr�|j|d�D]}|j||<q�|Sr5)	r:r<r@r�dict�zip�lenr7r8)r�row�dZlfZlr�keyrrr�__next__ks



zDictReader.__next__)NNNr)	r&r'r(r r?�propertyr<�setterrIrrrrrPs�
	
	
c@s6eZdZddd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)rr�raisercOsB||_||_|��dkr$td|��||_t||f|�|�|_dS)N)rL�ignorez-extrasaction (%s) must be 'raise' or 'ignore')r<r8�lower�
ValueError�extrasactionr)rr;r<r8rPr9r=r>rrrr �s�zDictWriter.__init__cCstt|j|j��}|�|�Sr!)rCrDr<�writerow)r�headerrrr�writeheader�szDictWriter.writeheadercsN�jdkr8����j}|r8tdd�dd�|D������fdd��jD�S)NrLz(dict contains fields not in fieldnames: z, cSsg|]}t|��qSr)�repr)�.0�xrrr�
<listcomp>�sz,DictWriter._dict_to_list.<locals>.<listcomp>c3s|]}��|�j�VqdSr!)�getr8)rUrH��rowdictrrr�	<genexpr>�sz+DictWriter._dict_to_list.<locals>.<genexpr>)rP�keysr<rO�join)rrZZwrong_fieldsrrYr�
_dict_to_list�s
�zDictWriter._dict_to_listcCs|j�|�|��Sr!)rrQr^)rrZrrrrQ�szDictWriter.writerowcCs|j�t|j|��Sr!)r�	writerows�mapr^)rZrowdictsrrrr_�szDictWriter.writerowsN)rrLr)r&r'r(r rSr^rQr_rrrrr�s�

c@s:eZdZdZdd�Zd
dd�Zdd�Zd	d
�Zdd�ZdS)rze
    "Sniffs" the format of a CSV file (i.e. delimiter, quotechar)
    Returns a Dialect object.
    cCsdddddg|_dS)Nr0r3�;� �:)�	preferredrrrrr �szSniffer.__init__NcCsd|�||�\}}}}|s(|�||�\}}|s4td��Gdd�dt�}||_||_|pVd|_||_|S)zI
        Returns a dialect (or None) corresponding to the sample
        zCould not determine delimiterc@seZdZdZdZeZdS)zSniffer.sniff.<locals>.dialectZsniffedr2N)r&r'r(r)r.rr/rrrrr9�sr9r1)�_guess_quote_and_delimiter�_guess_delimiterrrr,r*r+r-)r�sample�
delimitersr+r,r*r-r9rrr�sniff�s
�
�
z
Sniffer.sniffc	Cs�g}dD]*}t�|tjtjB�}|�|�}|rq4q|s<dSi}i}d}|j}	|D]�}
|	dd}|
|}|r�|�|d�d||<z|	dd}|
|}Wntk
r�YqRYnX|r�|dks�||kr�|�|d�d||<z|	dd}Wntk
�rYqRYnX|
|rR|d7}qRt||jd	�}
|�rXt||jd	�}|||k}|d
k�r`d}nd}d}t�dt�	|�|
d
�tj�}|�
|��r�d}nd}|
|||fS)a�
        Looks for text enclosed between two identical quotes
        (the probable quotechar) which are preceded and followed
        by the same character (the probable delimiter).
        For example:
                         ,'some text',
        The quote with the most wins, same with the delimiter.
        If there is no quotechar the delimiter can't be determined
        this way.
        )zI(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)zG(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)zG(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\n)z-(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?:$|\n))rFNrr�quote��delimNZspace�rHr4rz]((%(delim)s)|^)\W*%(quote)s[^%(delim)s\n]*%(quote)s[^%(delim)s\n]*%(quote)s\W*((%(delim)s)|$))rlrjTF)�re�compile�DOTALL�	MULTILINE�findall�
groupindexrX�KeyError�max�escape�search)r�datarhZmatchesZrestrZregexpZquotes�delimsZspacesrs�m�nrHr+rlr-Z	dq_regexpr,rrrre�s`




��z"Sniffer._guess_quote_and_delimitercCsttd|�d���}dd�td�D�}tdt|��}d}i}i}i}d|}	}
|	t|�k�rR|d7}||	|
�D]@}|D]6}|�|i�}
|�|�}|
�|d�d|
|<|
||<qxqp|��D]�}t||�	��}t|�dkr�|dddkr�q�t|�dk�rLt
|d	d
�d�||<|�||�||d||dtdd
�|D��f||<q�|d||<q�|�	�}t
t||t|���}d}d}t|�dk�r�||k�r�|D]T\}}|ddk�r�|ddk�r�|d||k�r�|dk�s�||k�r�|||<�q�|d8}�q�t|�dk�rDt|���d}|d�|�|d�d|�k}||fS|
}	|
|7}
qN|�s\dSt|�dk�r�|jD]@}||��k�rp|d�|�|d�d|�k}||fS�qpdd�|�	�D�}|��|dd}|d�|�|d�d|�k}||fS)a�
        The delimiter /should/ occur the same number of times on
        each row. However, due to malformed data, it may not. We don't want
        an all or nothing approach, so we allow for small variations in this
        number.
          1) build a table of the frequency of each character on every line.
          2) build a table of frequencies of this frequency (meta-frequency?),
             e.g.  'x occurred 5 times in 10 rows, 6 times in 1000 rows,
             7 times in 2 rows'
          3) use the mode of the meta-frequency to determine the /expected/
             frequency for that character
          4) find out how often the character actually meets that goal
          5) the character that best meets its goal is the delimiter
        For performance reasons, the data is evaluated in chunks, so it can
        try and evaluate the smallest portion of the data possible, evaluating
        additional chunks as necessary.
        Nr4cSsg|]}t|��qSr)�chr)rU�crrrrW-sz,Sniffer._guess_delimiter.<locals>.<listcomp>��
rrkcSs|dS)Nrkr)rVrrr�<lambda>G�z*Sniffer._guess_delimiter.<locals>.<lambda>rmcss|]}|dVqdS)rkNr)rU�itemrrrr[Lsz+Sniffer._guess_delimiter.<locals>.<genexpr>g�?g�������?g{�G�z�?z%c )rrcSsg|]\}}||f�qSrr)rU�k�vrrrrWvs���)�list�filter�split�range�minrErX�countr\�itemsru�remove�sum�floatrd�sort)rrxrh�asciiZchunkLengthZ	iterationZ
charFrequencyZmodesry�start�end�line�charZ
metaFrequencyZfreqr�ZmodeListZtotalZconsistencyZ	thresholdr�r�rlr-rGrrrrfs�

����

��zSniffer._guess_delimiterc
Cs�tt|�|�|��}t|�}t|�}i}t|�D]}d||<q0d}|D]�}|dkrVq�|d7}t|�|krlqFt|���D]x}	tt	t
fD]4}
z|
||	�Wq�Wq�ttfk
r�Yq�Xq�t||	�}
|
||	krx||	dkr�|
||	<qx||	=qxqFd}|�
�D]~\}	}t|�td�k�r@t||	�|k�r6|d7}n|d8}n<z|||	�Wn"ttfk
�rr|d7}Yn
X|d8}�q|dkS)Nr�rk)rrrir@rEr�r�r\�intr��complexrO�
OverflowErrorr��typer#)
rrgZrdrrR�columnsZcolumnTypes�i�checkedrF�colZthisTypeZ	hasHeaderZcolTyperrr�
has_headersJ






zSniffer.has_header)N)	r&r'r(rr rirerfr�rrrrr�s
Lg)rrnZ_csvrrrrrrrr	r
rrr
rrr"�ior�__all__rrrrrr��	NameErrorr�rrrrr�<module>sJ@�


2
wave.cpython-38.pyc000064400000043347150335716500010156 0ustar00U

e5d6G�@s�dZddlZdddddgZGdd�de�Zd	Zd
ZddlZddlZddl	Z	ddl
mZddlm
Z
ddlZe
d
d�ZGdd�d�ZGdd�d�Zddd�Zddd�ZdS)a%
Stuff to parse WAVE files.

Usage.

Reading WAVE files:
      f = wave.open(file, 'r')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods read(), seek(), and close().
When the setpos() and rewind() methods are not used, the seek()
method is not  necessary.

This returns an instance of a class with the following public methods:
      getnchannels()  -- returns number of audio channels (1 for
                         mono, 2 for stereo)
      getsampwidth()  -- returns sample width in bytes
      getframerate()  -- returns sampling frequency
      getnframes()    -- returns number of audio frames
      getcomptype()   -- returns compression type ('NONE' for linear samples)
      getcompname()   -- returns human-readable version of
                         compression type ('not compressed' linear samples)
      getparams()     -- returns a namedtuple consisting of all of the
                         above in the above order
      getmarkers()    -- returns None (for compatibility with the
                         aifc module)
      getmark(id)     -- raises an error since the mark does not
                         exist (for compatibility with the aifc module)
      readframes(n)   -- returns at most n frames of audio
      rewind()        -- rewind to the beginning of the audio stream
      setpos(pos)     -- seek to the specified position
      tell()          -- return the current position
      close()         -- close the instance (make it unusable)
The position returned by tell() and the position given to setpos()
are compatible and have nothing to do with the actual position in the
file.
The close() method is called automatically when the class instance
is destroyed.

Writing WAVE files:
      f = wave.open(file, 'w')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods write(), tell(), seek(), and
close().

This returns an instance of a class with the following public methods:
      setnchannels(n) -- set the number of channels
      setsampwidth(n) -- set the sample width
      setframerate(n) -- set the frame rate
      setnframes(n)   -- set the number of frames
      setcomptype(type, name)
                      -- set the compression type and the
                         human-readable compression type
      setparams(tuple)
                      -- set all parameters at once
      tell()          -- return current position in output file
      writeframesraw(data)
                      -- write audio frames without patching up the
                         file header
      writeframes(data)
                      -- write audio frames and patch up the file header
      close()         -- patch up the file header and close the
                         output file
You should set the parameters before the first writeframesraw or
writeframes.  The total number of frames does not need to be set,
but when it is set to the correct value, the header does not have to
be patched up.
It is best to first set all parameters, perhaps possibly the
compression type, and then write audio frames using writeframesraw.
When all frames have been written, either call writeframes(b'') or
close() to patch up the sizes in the header.
The close() method is called automatically when the class instance
is destroyed.
�N�open�openfp�Error�	Wave_read�
Wave_writec@seZdZdS)rN)�__name__�
__module__�__qualname__�r
r
�/usr/lib64/python3.8/wave.pyrNs�)N�b�hN�i)�Chunk)�
namedtuple�_wave_paramsz7nchannels sampwidth framerate nframes comptype compnamec@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,S)-raPVariables used in this class:

    These variables are available to the user though appropriate
    methods of this class:
    _file -- the open file with methods read(), close(), and seek()
              set through the __init__() method
    _nchannels -- the number of audio channels
              available through the getnchannels() method
    _nframes -- the number of audio frames
              available through the getnframes() method
    _sampwidth -- the number of bytes per audio sample
              available through the getsampwidth() method
    _framerate -- the sampling frequency
              available through the getframerate() method
    _comptype -- the AIFF-C compression type ('NONE' if AIFF)
              available through the getcomptype() method
    _compname -- the human-readable AIFF-C compression type
              available through the getcomptype() method
    _soundpos -- the position in the audio stream
              available through the tell() method, set through the
              setpos() method

    These variables are used internally only:
    _fmt_chunk_read -- 1 iff the FMT chunk has been read
    _data_seek_needed -- 1 iff positioned correctly in audio
              file for readframes()
    _data_chunk -- instantiation of a chunk class for the DATA chunk
    _framesize -- size of one frame in the file
    cCs�d|_d|_t|dd�|_|j��dkr0td��|j�d�dkrHtd��d|_d|_d|_	zt|jdd�}Wnt
k
r�Yq�YnX|��}|d	kr�|�|�d|_n2|d
kr�|js�td��||_|j|j
|_d|_	q�|��qT|jr�|js�td��dS)
Nr)Z	bigendian�RIFFz file does not start with RIFF id��WAVEznot a WAVE filer�fmt �datazdata chunk before fmt chunkz#fmt chunk and/or data chunk missing)�_convert�	_soundposr�_fileZgetnamer�readZ_fmt_chunk_read�_data_chunk�_data_seek_needed�EOFError�_read_fmt_chunkZ	chunksize�
_framesize�_nframes�skip)�self�file�chunkZ	chunknamer
r
r�initfp~s8


zWave_read.initfpcCsRd|_t|t�r"t�|d�}||_z|�|�Wn|jrF|���YnXdS)N�rb��_i_opened_the_file�
isinstance�str�builtinsrr&�close�r#�fr
r
r�__init__�s
zWave_read.__init__cCs|��dS�N�r-�r#r
r
r�__del__�szWave_read.__del__cCs|Sr1r
r3r
r
r�	__enter__�szWave_read.__enter__cGs|��dSr1r2�r#�argsr
r
r�__exit__�szWave_read.__exit__cCs|jSr1)rr3r
r
r�getfp�szWave_read.getfpcCsd|_d|_dS)Nrr)rrr3r
r
r�rewind�szWave_read.rewindcCs"d|_|j}|rd|_|��dSr1)rr)r-�r#r$r
r
rr-�s
zWave_read.closecCs|jSr1)rr3r
r
r�tell�szWave_read.tellcCs|jSr1)�
_nchannelsr3r
r
r�getnchannels�szWave_read.getnchannelscCs|jSr1)r!r3r
r
r�
getnframes�szWave_read.getnframescCs|jSr1)�
_sampwidthr3r
r
r�getsampwidth�szWave_read.getsampwidthcCs|jSr1)�
_framerater3r
r
r�getframerate�szWave_read.getframeratecCs|jSr1��	_comptyper3r
r
r�getcomptype�szWave_read.getcomptypecCs|jSr1��	_compnamer3r
r
r�getcompname�szWave_read.getcompnamecCs*t|��|��|��|��|��|���Sr1)rr>rArCr?rFrIr3r
r
r�	getparams�s�zWave_read.getparamscCsdSr1r
r3r
r
r�
getmarkers�szWave_read.getmarkerscCstd��dS�Nzno marks�r�r#�idr
r
r�getmark�szWave_read.getmarkcCs*|dks||jkrtd��||_d|_dS)Nrzposition not in ranger)r!rrr)r#�posr
r
r�setpos�szWave_read.setposcCs�|jr8|j�dd�|j|j}|r2|j�|d�d|_|dkrDdS|j�||j�}|jdkrxtjdkrxt	�
||j�}|jr�|r�|�|�}|jt|�|j
|j|_|S)Nr�r�big)rr�seekrr rr@�sys�	byteorder�audioop�byteswapr�lenr=)r#�nframesrQ�datar
r
r�
readframes�s

zWave_read.readframescCs�z$t�d|�d��\}|_|_}}Wntjk
r@td�YnX|tkr�zt�d|�d��d}Wntjk
r�td�YnX|dd|_|js�t	d��nt	d	|f��|js�t	d
��|j|j|_
d|_d|_dS)
Nz<HHLLH�z<H�r���bad sample widthzunknown format: %r�bad # of channels�NONEznot compressed)
�structZunpack_fromrr=rB�errorr�WAVE_FORMAT_PCMr@rr rErH)r#r%Z
wFormatTagZdwAvgBytesPerSecZwBlockAlign�	sampwidthr
r
rr�s$$
zWave_read._read_fmt_chunkN)rrr	�__doc__r&r0r4r5r8r9r:r-r<r>r?rArCrFrIrJrKrPrRr]rr
r
r
rr_s,
c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:S);ra�Variables used in this class:

    These variables are user settable through appropriate methods
    of this class:
    _file -- the open file with methods write(), close(), tell(), seek()
              set through the __init__() method
    _comptype -- the AIFF-C compression type ('NONE' in AIFF)
              set through the setcomptype() or setparams() method
    _compname -- the human-readable AIFF-C compression type
              set through the setcomptype() or setparams() method
    _nchannels -- the number of audio channels
              set through the setnchannels() or setparams() method
    _sampwidth -- the number of bytes per audio sample
              set through the setsampwidth() or setparams() method
    _framerate -- the sampling frequency
              set through the setframerate() or setparams() method
    _nframes -- the number of audio frames written to the header
              set through the setnframes() or setparams() method

    These variables are used internally only:
    _datalength -- the size of the audio samples written to the header
    _nframeswritten -- the number of frames actually written
    _datawritten -- the size of the audio samples actually written
    cCsRd|_t|t�r"t�|d�}||_z|�|�Wn|jrF|���YnXdS)N�wbr(r.r
r
rr0.s
zWave_write.__init__cCs@||_d|_d|_d|_d|_d|_d|_d|_d|_d|_	dS)NrF)
rrr=r@rBr!�_nframeswritten�_datawritten�_datalength�_headerwrittenr;r
r
rr&:szWave_write.initfpcCs|��dSr1r2r3r
r
rr4FszWave_write.__del__cCs|Sr1r
r3r
r
rr5IszWave_write.__enter__cGs|��dSr1r2r6r
r
rr8LszWave_write.__exit__cCs(|jrtd��|dkrtd��||_dS)N�0cannot change parameters after starting to writerrc)rlrr=)r#�	nchannelsr
r
r�setnchannelsRs
zWave_write.setnchannelscCs|jstd��|jS)Nznumber of channels not set)r=rr3r
r
rr>YszWave_write.getnchannelscCs0|jrtd��|dks|dkr&td��||_dS)Nrorrrb)rlrr@)r#rhr
r
r�setsampwidth^s
zWave_write.setsampwidthcCs|jstd��|jS)Nzsample width not set)r@rr3r
r
rrAeszWave_write.getsampwidthcCs0|jrtd��|dkrtd��tt|��|_dS)Nrorzbad frame rate)rlr�int�roundrB)r#�	framerater
r
r�setframeratejs
zWave_write.setframeratecCs|jstd��|jS)Nzframe rate not set)rBrr3r
r
rrCqszWave_write.getframeratecCs|jrtd��||_dS�Nro)rlrr!)r#r[r
r
r�
setnframesvszWave_write.setnframescCs|jSr1�rkr3r
r
rr?{szWave_write.getnframescCs.|jrtd��|dkrtd��||_||_dS)Nro)rdzunsupported compression type)rlrrErH)r#�comptype�compnamer
r
r�setcomptype~szWave_write.setcomptypecCs|jSr1rDr3r
r
rrF�szWave_write.getcomptypecCs|jSr1rGr3r
r
rrI�szWave_write.getcompnamecCsV|\}}}}}}|jrtd��|�|�|�|�|�|�|�|�|�||�dSrw)rlrrqrrrvrxr|)r#Zparamsrprhrur[rzr{r
r
r�	setparams�s



zWave_write.setparamscCs8|jr|jr|jstd��t|j|j|j|j|j|j�S)Nznot all parameters set)r=r@rBrrr!rErHr3r
r
rrJ�s�zWave_write.getparamscCstd��dS)Nzsetmark() not supportedrM)r#rOrQ�namer
r
r�setmark�szWave_write.setmarkcCstd��dSrLrMrNr
r
rrP�szWave_write.getmarkcCsdSr1r
r3r
r
rrK�szWave_write.getmarkerscCs|jSr1ryr3r
r
rr<�szWave_write.tellcCs�t|ttf�st|��d�}|�t|��t|�|j|j}|j	rN|�	|�}|jdkrpt
jdkrpt�
||j�}|j�|�|jt|�7_|j||_dS)N�BrrT)r*�bytes�	bytearray�
memoryview�cast�_ensure_header_writtenrZr@r=rrVrWrXrYr�writerlrk)r#r\r[r
r
r�writeframesraw�s
zWave_write.writeframesrawcCs"|�|�|j|jkr|��dSr1)r�rmrl�_patchheader)r#r\r
r
r�writeframes�s
zWave_write.writeframescCsXz2|jr0|�d�|j|jkr&|��|j��W5d|_|j}|rRd|_|��XdS)Nr)rr)r-r�rmrlr��flushr;r
r
rr-�s
zWave_write.closecCs>|js:|jstd��|js"td��|js0td��|�|�dS)Nz# channels not specifiedzsample width not specifiedzsampling rate not specified)rnr=rr@rB�
_write_header)r#Zdatasizer
r
rr��sz!Wave_write._ensure_header_writtencCs�|jr
t�|j�d�|js.||j|j|_|j|j|j|_z|j��|_	Wnt
tfk
rpd|_	YnX|j�t�
dd|jdddt|j|j|j|j|j|j|j|jdd��|j	dk	r�|j��|_|j�t�
d	|j��d
|_dS)Nrz<L4s4sLHHLLHH4s�$rr�rar�<LT)rn�AssertionErrorrr�r!r=r@rmr<�_form_length_pos�AttributeError�OSErrorre�packrgrB�_data_length_pos)r#Z
initlengthr
r
rr��s4

�
zWave_write._write_headercCs�|js
t�|j|jkrdS|j��}|j�|jd�|j�t	�
dd|j��|j�|jd�|j�t	�
d|j��|j�|d�|j|_dS)Nrr�r�)rnr�rlrmrr<rUr�r�rer�r�)r#Zcurposr
r
rr��s

zWave_write._patchheaderN) rrr	rir0r&r4r5r8rqr>rrrArvrCrxr?r|rFrIr}rJrrPrKr<r�r�r-r�r�r�r
r
r
rrs:


cCsJ|dkrt|d�r|j}nd}|dkr.t|�S|dkr>t|�Std��dS)N�moder')�rr')�wrjz$mode must be 'r', 'rb', 'w', or 'wb')�hasattrr�rrr�r/r�r
r
rr�s
cCstjdtdd�t||d�S)NzBwave.openfp is deprecated since Python 3.7. Use wave.open instead.r_)�
stacklevel)r�)�warnings�warn�DeprecationWarningrr�r
r
rrs
�)N)N)rir,�__all__�	ExceptionrrgZ_array_fmtsrXrerVr%r�collectionsrr�rrrrrr
r
r
r�<module>s(I�6d

threading.cpython-38.opt-1.pyc000064400000115003150335716500012105 0ustar00U

e5d���@s2dZddlZddlZddlZddlmZddl	m
Z
ddlmZ
mZzddlmZWn ek
rtddlmZYnXddd	d
ddd
ddddddddddddddddgZejZejZejZejZzejZdZe�d�Wnek
r�d ZYnXej Z!z
ej"Z#Wnek
�rdZ#YnXej$Z$[da%da&d!d�Z'd"d�Z(eZ)d#d�Z"Gd$d%�d%�Z*e*Z+Gd&d	�d	�Z,Gd'd�d�Z-Gd(d�de-�Z.Gd)d�d�Z/Gd*d�d�Z0Gd+d�de1�Z2e�j3Z4e4�dLd-d.�Z5e�a6iZ7iZ8e
�Z9e�a:e;�a<Gd/d�d�Z=zdd0lm>a?m@ZAWnHek
�rVdd1lBmCZDdd2lmEZEeEdd3�Z@d4d�ZAd5d�a?YnXd6d7�ZFGd8d�de=�ZGGd9d:�d:e=�ZHGd;d<�d<e=�ZId=d
�ZJeJZKd>d�ZLeLZMd?d@�ZNdAd�ZOddBlmPZPeH�aQdCdD�ZRdEd�ZSzddFlmTZUWn"ek
�rddGlVmUZUYnXdHdI�ZWeXedJ��r.ejYeWdK�dS)Mz;Thread module emulating a subset of Java's threading model.�N)�	monotonic)�WeakSet)�islice�count)�deque�	get_ident�active_count�	Condition�current_thread�	enumerate�main_thread�TIMEOUT_MAX�Event�Lock�RLock�	Semaphore�BoundedSemaphore�Thread�Barrier�BrokenBarrierError�Timer�ThreadError�
setprofile�settrace�local�
stack_size�
excepthook�ExceptHookArgsT�
get_native_idFcCs|adS)z�Set a profile function for all threads started from the threading module.

    The func will be passed to sys.setprofile() for each thread, before its
    run() method is called.

    N)�
_profile_hook��func�r"�!/usr/lib64/python3.8/threading.pyr9scCs|adS)z�Set a trace function for all threads started from the threading module.

    The func will be passed to sys.settrace() for each thread, before its run()
    method is called.

    N)�_trace_hookr r"r"r#rCscOstdkrt||�St||�S)a2Factory function that returns a new reentrant lock.

    A reentrant lock must be released by the thread that acquired it. Once a
    thread has acquired a reentrant lock, the same thread may acquire it again
    without blocking; the thread must release it once for each time it has
    acquired it.

    N)�_CRLock�_PyRLock)�args�kwargsr"r"r#rQs	
c@sVeZdZdZdd�Zdd�Zddd	�ZeZd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)�_RLocka,This class implements reentrant lock objects.

    A reentrant lock must be released by the thread that acquired it. Once a
    thread has acquired a reentrant lock, the same thread may acquire it
    again without blocking; the thread must release it once for each time it
    has acquired it.

    cCst�|_d|_d|_dS�Nr)�_allocate_lock�_block�_owner�_count��selfr"r"r#�__init__hsz_RLock.__init__c	Cs^|j}zt|j}Wntk
r(YnXd|j��r:dnd|jj|jj||j	t
t|��fS)Nz)<%s %s.%s object owner=%r count=%d at %s>�lockedZunlocked)r-�_active�name�KeyErrorr,r2�	__class__�
__module__�__qualname__r.�hex�id)r0�ownerr"r"r#�__repr__ms
�z_RLock.__repr__T���cCsDt�}|j|kr"|jd7_dS|j�||�}|r@||_d|_|S)aAcquire a lock, blocking or non-blocking.

        When invoked without arguments: if this thread already owns the lock,
        increment the recursion level by one, and return immediately. Otherwise,
        if another thread owns the lock, block until the lock is unlocked. Once
        the lock is unlocked (not owned by any thread), then grab ownership, set
        the recursion level to one, and return. If more than one thread is
        blocked waiting until the lock is unlocked, only one at a time will be
        able to grab ownership of the lock. There is no return value in this
        case.

        When invoked with the blocking argument set to true, do the same thing
        as when called without arguments, and return true.

        When invoked with the blocking argument set to false, do not block. If a
        call without an argument would block, return false immediately;
        otherwise, do the same thing as when called without arguments, and
        return true.

        When invoked with the floating-point timeout argument set to a positive
        value, block for at most the number of seconds specified by timeout
        and as long as the lock cannot be acquired.  Return true if the lock has
        been acquired, false if the timeout has elapsed.

        �)rr-r.r,�acquire)r0�blocking�timeout�me�rcr"r"r#r?|s
z_RLock.acquirecCs<|jt�krtd��|jd|_}|s8d|_|j��dS)amRelease a lock, decrementing the recursion level.

        If after the decrement it is zero, reset the lock to unlocked (not owned
        by any thread), and if any other threads are blocked waiting for the
        lock to become unlocked, allow exactly one of them to proceed. If after
        the decrement the recursion level is still nonzero, the lock remains
        locked and owned by the calling thread.

        Only call this method when the calling thread owns the lock. A
        RuntimeError is raised if this method is called when the lock is
        unlocked.

        There is no return value.

        �cannot release un-acquired lockr>N)r-r�RuntimeErrorr.r,�release)r0rr"r"r#rF�sz_RLock.releasecCs|��dS�N�rF�r0�t�v�tbr"r"r#�__exit__�sz_RLock.__exit__cCs|j��|\|_|_dSrG)r,r?r.r-)r0�stater"r"r#�_acquire_restore�s
z_RLock._acquire_restorecCs<|jdkrtd��|j}d|_|j}d|_|j��||fS)NrrD)r.rEr-r,rF)r0rr;r"r"r#�
_release_save�s

z_RLock._release_savecCs|jt�kSrG)r-rr/r"r"r#�	_is_owned�sz_RLock._is_ownedN)Tr=)
�__name__r7r8�__doc__r1r<r?�	__enter__rFrMrOrPrQr"r"r"r#r)^s	
$
r)c@steZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
ddd�Zddd�Zddd�Z
dd�ZeZdS)r	ajClass that implements a condition variable.

    A condition variable allows one or more threads to wait until they are
    notified by another thread.

    If the lock argument is given and not None, it must be a Lock or RLock
    object, and it is used as the underlying lock. Otherwise, a new RLock object
    is created and used as the underlying lock.

    NcCs�|dkrt�}||_|j|_|j|_z|j|_Wntk
rDYnXz|j|_Wntk
rfYnXz|j|_Wntk
r�YnXt�|_	dSrG)
r�_lockr?rFrP�AttributeErrorrOrQ�_deque�_waiters�r0�lockr"r"r#r1�s$zCondition.__init__cCs
|j��SrG)rUrTr/r"r"r#rT�szCondition.__enter__cGs|jj|�SrG)rUrM)r0r'r"r"r#rM�szCondition.__exit__cCsd|jt|j�fS)Nz<Condition(%s, %d)>)rU�lenrXr/r"r"r#r<�szCondition.__repr__cCs|j��dSrG)rUrFr/r"r"r#rP�szCondition._release_savecCs|j��dSrG)rUr?)r0�xr"r"r#rOszCondition._acquire_restorecCs"|j�d�r|j��dSdSdS)NrFT)rUr?rFr/r"r"r#rQs
zCondition._is_ownedcCs�|��std��t�}|��|j�|�|��}d}z>|dkrN|��d}n |dkrd|�d|�}n
|�d�}|W�S|�|�|s�z|j�|�Wnt	k
r�YnXXdS)akWait until notified or until a timeout occurs.

        If the calling thread has not acquired the lock when this method is
        called, a RuntimeError is raised.

        This method releases the underlying lock, and then blocks until it is
        awakened by a notify() or notify_all() call for the same condition
        variable in another thread, or until the optional timeout occurs. Once
        awakened or timed out, it re-acquires the lock and returns.

        When the timeout argument is present and not None, it should be a
        floating point number specifying a timeout for the operation in seconds
        (or fractions thereof).

        When the underlying lock is an RLock, it is not released using its
        release() method, since this may not actually unlock the lock when it
        was acquired multiple times recursively. Instead, an internal interface
        of the RLock class is used, which really unlocks it even when it has
        been recursively acquired several times. Another internal interface is
        then used to restore the recursion level when the lock is reacquired.

        zcannot wait on un-acquired lockFNTr)
rQrEr+r?rX�appendrPrO�remove�
ValueError)r0rA�waiterZsaved_stateZgotitr"r"r#�waits*

zCondition.waitcCsXd}|}|�}|sT|dk	rB|dkr.t�|}n|t�}|dkrBqT|�|�|�}q|S)z�Wait until a condition evaluates to True.

        predicate should be a callable which result will be interpreted as a
        boolean value.  A timeout may be provided giving the maximum time to
        wait.

        Nr)�_timera)r0Z	predicaterA�endtimeZwaittime�resultr"r"r#�wait_for>s

zCondition.wait_forr>c	Csf|��std��|j}tt||��}|s,dS|D]0}|��z|�|�Wq0tk
r^Yq0Xq0dS)aKWake up one or more threads waiting on this condition, if any.

        If the calling thread has not acquired the lock when this method is
        called, a RuntimeError is raised.

        This method wakes up at most n of the threads waiting for the condition
        variable; it is a no-op if no threads are waiting.

        z!cannot notify on un-acquired lockN)rQrErXrW�_islicerFr^r_)r0�nZall_waitersZwaiters_to_notifyr`r"r"r#�notifyUs
zCondition.notifycCs|�t|j��dS)z�Wake up all threads waiting on this condition.

        If the calling thread has not acquired the lock when this method
        is called, a RuntimeError is raised.

        N)rhr[rXr/r"r"r#�
notify_alllszCondition.notify_all)N)N)N)r>)rRr7r8rSr1rTrMr<rPrOrQrarerhriZ	notifyAllr"r"r"r#r	�s
	
0

	c@s8eZdZdZd
dd�Zddd�ZeZd	d
�Zdd�ZdS)raGThis class implements semaphore objects.

    Semaphores manage a counter representing the number of release() calls minus
    the number of acquire() calls, plus an initial value. The acquire() method
    blocks if necessary until it can return without making the counter
    negative. If not given, value defaults to 1.

    r>cCs&|dkrtd��tt��|_||_dS)Nrz$semaphore initial value must be >= 0)r_r	r�_cond�_value�r0�valuer"r"r#r1�szSemaphore.__init__TNc	Cs�|s|dk	rtd��d}d}|j�f|jdkrr|s4q�|dk	rd|dkrPt�|}n|t�}|dkrdq�|j�|�q$|jd8_d}W5QRX|S)a�Acquire a semaphore, decrementing the internal counter by one.

        When invoked without arguments: if the internal counter is larger than
        zero on entry, decrement it by one and return immediately. If it is zero
        on entry, block, waiting until some other thread has called release() to
        make it larger than zero. This is done with proper interlocking so that
        if multiple acquire() calls are blocked, release() will wake exactly one
        of them up. The implementation may pick one at random, so the order in
        which blocked threads are awakened should not be relied on. There is no
        return value in this case.

        When invoked with blocking set to true, do the same thing as when called
        without arguments, and return true.

        When invoked with blocking set to false, do not block. If a call without
        an argument would block, return false immediately; otherwise, do the
        same thing as when called without arguments, and return true.

        When invoked with a timeout other than None, it will block for at
        most timeout seconds.  If acquire does not complete successfully in
        that interval, return false.  Return true otherwise.

        Nz.can't specify timeout for non-blocking acquireFrr>T)r_rjrkrbra)r0r@rArCrcr"r"r#r?�s$

zSemaphore.acquirec	Cs.|j�|jd7_|j��W5QRXdS)z�Release a semaphore, incrementing the internal counter by one.

        When the counter is zero on entry and another thread is waiting for it
        to become larger than zero again, wake up that thread.

        r>N)rjrkrhr/r"r"r#rF�szSemaphore.releasecCs|��dSrGrHrIr"r"r#rM�szSemaphore.__exit__)r>)TN)	rRr7r8rSr1r?rTrFrMr"r"r"r#rxs

-c@s"eZdZdZddd�Zdd�ZdS)	ra�Implements a bounded semaphore.

    A bounded semaphore checks to make sure its current value doesn't exceed its
    initial value. If it does, ValueError is raised. In most situations
    semaphores are used to guard resources with limited capacity.

    If the semaphore is released too many times it's a sign of a bug. If not
    given, value defaults to 1.

    Like regular semaphores, bounded semaphores manage a counter representing
    the number of release() calls minus the number of acquire() calls, plus an
    initial value. The acquire() method blocks if necessary until it can return
    without making the counter negative. If not given, value defaults to 1.

    r>cCst�||�||_dSrG)rr1�_initial_valuerlr"r"r#r1�szBoundedSemaphore.__init__c	CsB|j�2|j|jkrtd��|jd7_|j��W5QRXdS)a6Release a semaphore, incrementing the internal counter by one.

        When the counter is zero on entry and another thread is waiting for it
        to become larger than zero again, wake up that thread.

        If the number of releases exceeds the number of acquires,
        raise a ValueError.

        z!Semaphore released too many timesr>N)rjrkrnr_rhr/r"r"r#rF�s

zBoundedSemaphore.releaseN)r>)rRr7r8rSr1rFr"r"r"r#r�s
c@sFeZdZdZdd�Zdd�Zdd�ZeZdd	�Zd
d�Z	dd
d�Z
dS)rz�Class implementing event objects.

    Events manage a flag that can be set to true with the set() method and reset
    to false with the clear() method. The wait() method blocks until the flag is
    true.  The flag is initially false.

    cCstt��|_d|_dS)NF)r	rrj�_flagr/r"r"r#r1�szEvent.__init__cCs|j�t��dSrG)rjr1rr/r"r"r#�_reset_internal_locks�szEvent._reset_internal_lockscCs|jS)z5Return true if and only if the internal flag is true.)ror/r"r"r#�is_setszEvent.is_setc	Cs&|j�d|_|j��W5QRXdS)z�Set the internal flag to true.

        All threads waiting for it to become true are awakened. Threads
        that call wait() once the flag is true will not block at all.

        TN)rjrorir/r"r"r#�setsz	Event.setc	Cs|j�d|_W5QRXdS)z�Reset the internal flag to false.

        Subsequently, threads calling wait() will block until set() is called to
        set the internal flag to true again.

        FN)rjror/r"r"r#�clearszEvent.clearNc
Cs8|j�(|j}|s|j�|�}|W5QR�SQRXdS)aHBlock until the internal flag is true.

        If the internal flag is true on entry, return immediately. Otherwise,
        block until another thread calls set() to set the flag to true, or until
        the optional timeout occurs.

        When the timeout argument is present and not None, it should be a
        floating point number specifying a timeout for the operation in seconds
        (or fractions thereof).

        This method returns the internal flag on exit, so it will always return
        True except if a timeout is given and the operation times out.

        N)rjrora)r0rAZsignaledr"r"r#ras
z
Event.wait)N)rRr7r8rSr1rprqZisSetrrrsrar"r"r"r#r�s

c@s�eZdZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Ze
dd��Ze
dd��Ze
dd��ZdS)rz�Implements a Barrier.

    Useful for synchronizing a fixed number of threads at known synchronization
    points.  Threads block on 'wait()' and are simultaneously awoken once they
    have all made that call.

    NcCs.tt��|_||_||_||_d|_d|_dS)aWCreate a barrier, initialised to 'parties' threads.

        'action' is a callable which, when supplied, will be called by one of
        the threads after they have all entered the barrier and just prior to
        releasing them all. If a 'timeout' is provided, it is used as the
        default for all subsequent 'wait()' calls.

        rN)r	rrj�_action�_timeout�_parties�_stater.)r0�parties�actionrAr"r"r#r1Fs	zBarrier.__init__c
Cs�|dkr|j}|j�r|��|j}|jd7_z6|d|jkrL|��n
|�|�|W�W5QR�S|jd8_|��XW5QRXdS)aNWait for the barrier.

        When the specified number of threads have started waiting, they are all
        simultaneously awoken. If an 'action' was provided for the barrier, one
        of the threads will have executed that callback prior to returning.
        Returns an individual index number from 0 to 'parties-1'.

        Nr>)rurj�_enterr.�_exitrv�_release�_wait)r0rA�indexr"r"r#raVs	

zBarrier.waitcCs(|jdkr|j��q|jdkr$t�dS)N�r=r>r)rwrjrarr/r"r"r#rzts


zBarrier._entercCs>z"|jr|��d|_|j��Wn|���YnXdS)Nr>)rtrwrjri�_breakr/r"r"r#r|szBarrier._releasecs4�j��fdd�|�s"���t��jdkr0t�dS)Ncs
�jdkSr*�rwr"r/r"r#�<lambda>��zBarrier._wait.<locals>.<lambda>r)rjrer�rrw�r0rAr"r/r#r}�s
z
Barrier._waitcCs(|jdkr$|jdkr$d|_|j��dS)Nrr)r.rwrjrir/r"r"r#r{�s

z
Barrier._exitc	CsT|j�D|jdkr6|jdkr$d|_q<|jdkr<d|_nd|_|j��W5QRXdS)z�Reset the barrier to the initial state.

        Any threads currently waiting will get the BrokenBarrier exception
        raised.

        rr=���N)rjr.rwrir/r"r"r#�reset�s


z
Barrier.resetc	Cs|j�|��W5QRXdS)z�Place the barrier into a 'broken' state.

        Useful in case of error.  Any currently waiting threads and threads
        attempting to 'wait()' will have BrokenBarrierError raised.

        N)rjr�r/r"r"r#�abort�sz
Barrier.abortcCsd|_|j��dS)Nr�)rwrjrir/r"r"r#r��szBarrier._breakcCs|jS)z:Return the number of threads required to trip the barrier.)rvr/r"r"r#rx�szBarrier.partiescCs|jdkr|jSdS)z>Return the number of threads currently waiting at the barrier.r)rwr.r/r"r"r#�	n_waiting�s
zBarrier.n_waitingcCs
|jdkS)z0Return True if the barrier is in a broken state.r�r�r/r"r"r#�broken�szBarrier.broken)NN)N)rRr7r8rSr1rarzr|r}r{r�r�r��propertyrxr�r�r"r"r"r#r=s 




c@seZdZdS)rN)rRr7r8r"r"r"r#r�s�	Thread-%dcCs
|t�SrG)�_counter)�templater"r"r#�_newname�sr�c@seZdZdZdZd:dd�dd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zer\dd�Z
dd�Zdd�Zdd�Zdd�Zd;dd�Zd<d"d#�Zed$d%��Zejd&d%��Zed'd(��Zer�ed)d*��Zd+d,�Zd-d.�Zed/d0��Zejd1d0��Zd2d3�Zd4d5�Zd6d7�Zd8d9�ZdS)=raA class that represents a thread of control.

    This class can be safely subclassed in a limited fashion. There are two ways
    to specify the activity: by passing a callable object to the constructor, or
    by overriding the run() method in a subclass.

    FNr"��daemoncCs�|dkri}||_t|pt��|_||_||_|dk	r>||_n
t�j|_d|_	t
rXd|_d|_t
�|_d|_d|_tj|_t�|_t�|�dS)aKThis constructor should always be called with keyword arguments. Arguments are:

        *group* should be None; reserved for future extension when a ThreadGroup
        class is implemented.

        *target* is the callable object to be invoked by the run()
        method. Defaults to None, meaning nothing is called.

        *name* is the thread name. By default, a unique name is constructed of
        the form "Thread-N" where N is a small decimal number.

        *args* is the argument tuple for the target invocation. Defaults to ().

        *kwargs* is a dictionary of keyword arguments for the target
        invocation. Defaults to {}.

        If a subclass overrides the constructor, it must make sure to invoke
        the base class constructor (Thread.__init__()) before doing anything
        else to the thread.

        NFT)�_target�strr��_name�_args�_kwargs�	_daemonicr
r��_ident�_HAVE_THREAD_NATIVE_ID�
_native_id�_tstate_lockr�_started�_is_stopped�_initialized�_sys�stderr�_stderr�_make_invoke_excepthook�_invoke_excepthook�	_dangling�add)r0�group�targetr4r'r(r�r"r"r#r1�s&
zThread.__init__cCs(|j��|r|��nd|_d|_dS�NT)r�rp�_set_tstate_lockr�r�)r0�is_aliver"r"r#rp(s


zThread._reset_internal_lockscCs^d}|j��rd}|��|jr$d}|jr2|d7}|jdk	rJ|d|j7}d|jj|j|fS)N�initialZstartedZstoppedz daemonz %sz<%s(%s, %s)>)	r�rqr�r�r�r�r6rRr�)r0Zstatusr"r"r#r<4s

zThread.__repr__cCs�|jstd��|j��r td��t�|t|<W5QRXzt|jd�Wn,tk
rtt�t|=W5QRX�YnX|j�	�dS)a-Start the thread's activity.

        It must be called at most once per thread object. It arranges for the
        object's run() method to be invoked in a separate thread of control.

        This method will raise a RuntimeError if called more than once on the
        same thread object.

        zthread.__init__() not calledz threads can only be started oncer"N)
r�rEr�rq�_active_limbo_lock�_limbo�_start_new_thread�
_bootstrap�	Exceptionrar/r"r"r#�startBs

zThread.startcCs.z|jr|j|j|j�W5|`|`|`XdS)aXMethod representing the thread's activity.

        You may override this method in a subclass. The standard run() method
        invokes the callable object passed to the object's constructor as the
        target argument, if any, with sequential and keyword arguments taken
        from the args and kwargs arguments, respectively.

        N)r�r�r�r/r"r"r#�run[s	z
Thread.runcCs4z|��Wn"|jr(tdkr(YdS�YnXdSrG)�_bootstrap_innerr�r�r/r"r"r#r�ls
zThread._bootstrapcCst�|_dSrG)rr�r/r"r"r#�
_set_ident�szThread._set_identcCst�|_dSrG)rr�r/r"r"r#�_set_native_id�szThread._set_native_idc	Cs8t�|_|j��|js4t�t�|j�W5QRXdS)z�
        Set a lock object which will be released by the interpreter when
        the underlying thread state (see pystate.h) gets deleted.
        N)�
_set_sentinelr�r?r��_shutdown_locks_lock�_shutdown_locksr�r/r"r"r#r��s

zThread._set_tstate_lockcCs�z�|��|��tr|��|j��t�|t|j	<t
|=W5QRXtrVt�
t�trdt�t�z|��Wn|�|�YnXW5t� ztt�=WnYnXW5QRXXdSrG)r�r3rr�r�r�r�r�rrr�r�r$r�rrrr�r�r/r"r"r#r��s,



zThread._bootstrap_innerc	Cs>|j}|dk	rd|_d|_|js:t�t�|�W5QRXdSr�)r�r�r�r�r��discardrYr"r"r#�_stop�szThread._stopc	Cst�tt�=W5QRXdS)zARemove current thread from the dict of currently running threads.N)r�r3rr/r"r"r#�_delete�szThread._deletecCsZ|jstd��|j��s td��|t�kr2td��|dkrD|��n|jt|d�d�dS)aWait until the thread terminates.

        This blocks the calling thread until the thread whose join() method is
        called terminates -- either normally or through an unhandled exception
        or until the optional timeout occurs.

        When the timeout argument is present and not None, it should be a
        floating point number specifying a timeout for the operation in seconds
        (or fractions thereof). As join() always returns None, you must call
        is_alive() after join() to decide whether a timeout happened -- if the
        thread is still alive, the join() call timed out.

        When the timeout argument is not present or None, the operation will
        block until the thread terminates.

        A thread can be join()ed many times.

        join() raises a RuntimeError if an attempt is made to join the current
        thread as that would cause a deadlock. It is also an error to join() a
        thread before it has been started and attempts to do so raises the same
        exception.

        �Thread.__init__() not calledz'cannot join thread before it is startedzcannot join current threadNr)rA)r�rEr�rqr
�_wait_for_tstate_lock�maxr�r"r"r#�join�s


zThread.joinTr=cCs0|j}|dkrn|�||�r,|��|��dSrG)r�r?rFr�)r0�blockrArZr"r"r#r��szThread._wait_for_tstate_lockcCs|jS)z�A string used for identification purposes only.

        It has no semantics. Multiple threads may be given the same name. The
        initial name is set by the constructor.

        )r�r/r"r"r#r4s	zThread.namecCst|�|_dSrG)r�r��r0r4r"r"r#r4scCs|jS)a4Thread identifier of this thread or None if it has not been started.

        This is a nonzero integer. See the get_ident() function. Thread
        identifiers may be recycled when a thread exits and another thread is
        created. The identifier is available even after the thread has exited.

        )r�r/r"r"r#�idents
zThread.identcCs|jS)z�Native integral thread ID of this thread, or None if it has not been started.

            This is a non-negative integer. See the get_native_id() function.
            This represents the Thread ID as reported by the kernel.

            )r�r/r"r"r#�	native_id$s	zThread.native_idcCs&|js|j��sdS|�d�|jS)z�Return whether the thread is alive.

        This method returns True just before the run() method starts until just
        after the run() method terminates. The module function enumerate()
        returns a list of all alive threads.

        F)r�r�rqr�r/r"r"r#r�/s	
zThread.is_alivecCs ddl}|jdtdd�|��S)zhReturn whether the thread is alive.

        This method is deprecated, use is_alive() instead.
        rNz/isAlive() is deprecated, use is_alive() instead�)�
stacklevel)�warnings�warn�DeprecationWarningr�)r0r�r"r"r#�isAlive=s�zThread.isAlivecCs|jS)a�A boolean value indicating whether this thread is a daemon thread.

        This must be set before start() is called, otherwise RuntimeError is
        raised. Its initial value is inherited from the creating thread; the
        main thread is not a daemon thread and therefore all threads created in
        the main thread default to daemon = False.

        The entire Python program exits when only daemon threads are left.

        )r�r/r"r"r#r�Gs
z
Thread.daemoncCs*|jstd��|j��r td��||_dS)Nr�z)cannot set daemon status of active thread)r�rEr�rqr��r0Zdaemonicr"r"r#r�Vs

cCs|jSrGr�r/r"r"r#�isDaemon^szThread.isDaemoncCs
||_dSrGr�r�r"r"r#�	setDaemonaszThread.setDaemoncCs|jSrG�r4r/r"r"r#�getNamedszThread.getNamecCs
||_dSrGr�r�r"r"r#�setNamegszThread.setName)NNNr"N)N)Tr=) rRr7r8rSr�r1rpr<r�r�r�r�r�r�r�r�r�r�r�r�r�r4�setterr�r�r�r�r�r�r�r�r�r"r"r"r#r�sR��/	
&









)�_excepthook�_ExceptHookArgs)�print_exception)�
namedtuplez'exc_type exc_value exc_traceback threadcCst|�SrG)r�)r'r"r"r#rwscCs�|jtkrdStdk	r(tjdk	r(tj}n$|jdk	rH|jj}|dkrLdSndS|jdk	r`|jj}nt�}td|�d�|dd�t	|j|j
|j|d�|��dS)z9
        Handle uncaught Thread.run() exception.
        NzException in thread �:T��file�flush)r�)
�exc_type�
SystemExitr�r��threadr�r4r�print�_print_exception�	exc_value�
exc_tracebackr�)r'r�r4r"r"r#rzs(



��csPt�tj��dkrtd���dkr*td��tj�t�t������fdd�}|S)Nzthreading.excepthook is Nonezsys.excepthook is Nonec
s�z�z,t}|dkr�}t��|f��}||�Wn�tk
r�}zbd|_~�dk	rb�jdk	rb�j}n|j}�d|dd��dk	r��jdk	r��j}n�}|���W5d}~XYnXW5d}XdS)NTz"Exception in threading.excepthook:r�)rrr��__suppress_context__r�r�)r�r'�hook�excr�Zsys_excepthook�Zlocal_printZ	local_sysZold_excepthookZold_sys_excepthookZsys_exc_infor"r#�invoke_excepthook�s*� z2_make_invoke_excepthook.<locals>.invoke_excepthook)rr�rE�exc_infor�)r�r"r�r#r��s r�c@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
rz�Call a function after a specified number of seconds:

            t = Timer(30.0, f, args=None, kwargs=None)
            t.start()
            t.cancel()     # stop the timer's action if it's still waiting

    NcCsFt�|�||_||_|dk	r"|ng|_|dk	r4|ni|_t�|_dSrG)rr1�interval�functionr'r(r�finished)r0r�r�r'r(r"r"r#r1�s
zTimer.__init__cCs|j��dS)z)Stop the timer if it hasn't finished yet.N)r�rrr/r"r"r#�cancel�szTimer.cancelcCs6|j�|j�|j��s(|j|j|j�|j��dSrG)r�rar�rqr�r'r(rrr/r"r"r#r��s
z	Timer.run)NN)rRr7r8rSr1r�r�r"r"r"r#r�s
c@seZdZdd�ZdS)�_MainThreadc	CsTtj|ddd�|��|j��|��tr6|��t�|t	|j
<W5QRXdS)NZ
MainThreadF�r4r�)rr1r�r�rrr�r�r�r�r3r�r/r"r"r#r1�s
z_MainThread.__init__N)rRr7r8r1r"r"r"r#r��sr�c@s.eZdZdd�Zdd�Zdd�Zd
dd	�ZdS)�_DummyThreadc	CsPtj|td�dd�|j��|��tr2|��t�|t	|j
<W5QRXdS)NzDummy-%dTr�)rr1r�r�rrr�r�r�r�r3r�r/r"r"r#r1s
z_DummyThread.__init__cCsdSrGr"r/r"r"r#r�
sz_DummyThread._stopcCsdSr�r"r/r"r"r#r�sz_DummyThread.is_aliveNcCsdSrGr"r�r"r"r#r�sz_DummyThread.join)N)rRr7r8r1r�r�r�r"r"r"r#r�s
r�cCs,ztt�WStk
r&t�YSXdS)z�Return the current Thread object, corresponding to the caller's thread of control.

    If the caller's thread of control was not created through the threading
    module, a dummy thread object with limited functionality is returned.

    N)r3rr5r�r"r"r"r#r
sc
Cs,t�tt�tt�W5QR�SQRXdS)z�Return the number of Thread objects currently alive.

    The returned count is equal to the length of the list returned by
    enumerate().

    N)r�r[r3r�r"r"r"r#r(scCstt���tt���SrG)�listr3�valuesr�r"r"r"r#�
_enumerate4sr�c
Cs4t�&tt���tt���W5QR�SQRXdS)z�Return a list of all Thread objects currently alive.

    The list includes daemonic threads, dummy thread objects created by
    current_thread(), and the main thread. It excludes terminated threads and
    threads that have not yet been started.

    N)r�r�r3r�r�r"r"r"r#r8s)rc	Csftjr
dStj}|��t��t�tt�}t��W5QRX|sFqb|D]}|�	�|��qJq dS)zS
    Wait until the Python thread state of all non-daemon threads get deleted.
    N)
�_main_threadr�r�rFr�r�r�r�rsr?)ZtlockZlocksrZr"r"r#�	_shutdownKs	r�cCstS)z�Return the main thread object.

    In normal conditions, the main thread is the thread from which the
    Python interpreter was started.
    )r�r"r"r"r#rss)�_local)rc	Cs�t�ai}ztt�}Wntk
r2t�}YnX|at�at�a	t�xtt
��}|�t�|D]>}||kr�|�
d�t�}||_|||<qb|�
d�|��qbt��t��t�|�W5QRXdS)zL
    Cleanup threading module state that should not exist after a fork.
    TFN)r+r�r3rr5r�r�r�rrr�r��updater�rpr�r�r�rs)Z
new_activeZcurrentZthreadsr�r�r"r"r#�_after_fork�s0






r��register_at_fork)Zafter_in_child)r�)ZrS�os�_os�sysr��_thread�timerrbZ_weakrefsetr�	itertoolsrrfrr.�_collectionsrrW�ImportError�collections�__all__�start_new_threadr��
allocate_lockr+r�rrr�r]rV�errorrrr%r
rr$rrrr)r&r	rrrrrEr�__next__r�r�r�r3r�r�r�rrr�rr�rr�r�	tracebackr�r�r�r�rr�r�r
Z
currentThreadrZactiveCountr�rrr�r�rr�rZ_threading_localr��hasattrr�r"r"r"r#�<module>s��




q'P&O
�5
(5difflib.cpython-38.pyc000064400000164060150335716500010607 0ustar00U

e5dZH�@s8dZddddddddd	d
ddgZd
dlmZd
dlmZedd�Zdd�Z	Gdd�d�Z
d8dd�Zdd�ZGdd�d�Z
d
dlZe�d�jfdd�Zd9dd�Zdd �Zd:d#d	�Zd$d%�Zd;d&d�Zd'd(�Zd<d+d
�Zdefd,d�Zddefd-d.�Zd/Zd0Zd1Zd2ZGd3d�de�Z [d4d�Z!d5d6�Z"e#d7k�r4e"�dS)=ae
Module difflib -- helpers for computing deltas between objects.

Function get_close_matches(word, possibilities, n=3, cutoff=0.6):
    Use SequenceMatcher to return list of the best "good enough" matches.

Function context_diff(a, b):
    For two lists of strings, return a delta in context diff format.

Function ndiff(a, b):
    Return a delta: the difference between `a` and `b` (lists of strings).

Function restore(delta, which):
    Return one of the two sequences that generated an ndiff delta.

Function unified_diff(a, b):
    For two lists of strings, return a delta in unified diff format.

Class SequenceMatcher:
    A flexible class for comparing pairs of sequences of any type.

Class Differ:
    For producing human-readable deltas from sequences of lines of text.

Class HtmlDiff:
    For producing HTML side by side comparison with change highlights.
�get_close_matches�ndiff�restore�SequenceMatcher�Differ�IS_CHARACTER_JUNK�IS_LINE_JUNK�context_diff�unified_diff�
diff_bytes�HtmlDiff�Match�)�nlargest)�
namedtupleza b sizecCs|rd||SdS)Ng@��?�)�matches�lengthrr�/usr/lib64/python3.8/difflib.py�_calculate_ratio&src@steZdZdZddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zddd�Zdd�Z
dd�Zdd�ZdS) ra�
    SequenceMatcher is a flexible class for comparing pairs of sequences of
    any type, so long as the sequence elements are hashable.  The basic
    algorithm predates, and is a little fancier than, an algorithm
    published in the late 1980's by Ratcliff and Obershelp under the
    hyperbolic name "gestalt pattern matching".  The basic idea is to find
    the longest contiguous matching subsequence that contains no "junk"
    elements (R-O doesn't address junk).  The same idea is then applied
    recursively to the pieces of the sequences to the left and to the right
    of the matching subsequence.  This does not yield minimal edit
    sequences, but does tend to yield matches that "look right" to people.

    SequenceMatcher tries to compute a "human-friendly diff" between two
    sequences.  Unlike e.g. UNIX(tm) diff, the fundamental notion is the
    longest *contiguous* & junk-free matching subsequence.  That's what
    catches peoples' eyes.  The Windows(tm) windiff has another interesting
    notion, pairing up elements that appear uniquely in each sequence.
    That, and the method here, appear to yield more intuitive difference
    reports than does diff.  This method appears to be the least vulnerable
    to synching up on blocks of "junk lines", though (like blank lines in
    ordinary text files, or maybe "<P>" lines in HTML files).  That may be
    because this is the only method of the 3 that has a *concept* of
    "junk" <wink>.

    Example, comparing two strings, and considering blanks to be "junk":

    >>> s = SequenceMatcher(lambda x: x == " ",
    ...                     "private Thread currentThread;",
    ...                     "private volatile Thread currentThread;")
    >>>

    .ratio() returns a float in [0, 1], measuring the "similarity" of the
    sequences.  As a rule of thumb, a .ratio() value over 0.6 means the
    sequences are close matches:

    >>> print(round(s.ratio(), 3))
    0.866
    >>>

    If you're only interested in where the sequences match,
    .get_matching_blocks() is handy:

    >>> for block in s.get_matching_blocks():
    ...     print("a[%d] and b[%d] match for %d elements" % block)
    a[0] and b[0] match for 8 elements
    a[8] and b[17] match for 21 elements
    a[29] and b[38] match for 0 elements

    Note that the last tuple returned by .get_matching_blocks() is always a
    dummy, (len(a), len(b), 0), and this is the only case in which the last
    tuple element (number of elements matched) is 0.

    If you want to know how to change the first sequence into the second,
    use .get_opcodes():

    >>> for opcode in s.get_opcodes():
    ...     print("%6s a[%d:%d] b[%d:%d]" % opcode)
     equal a[0:8] b[0:8]
    insert a[8:8] b[8:17]
     equal a[8:29] b[17:38]

    See the Differ class for a fancy human-friendly file differencer, which
    uses SequenceMatcher both to compare sequences of lines, and to compare
    sequences of characters within similar (near-matching) lines.

    See also function get_close_matches() in this module, which shows how
    simple code building on SequenceMatcher can be used to do useful work.

    Timing:  Basic R-O is cubic time worst case and quadratic time expected
    case.  SequenceMatcher is quadratic time for the worst case and has
    expected-case behavior dependent in a complicated way on how many
    elements the sequences have in common; best case time is linear.

    Methods:

    __init__(isjunk=None, a='', b='')
        Construct a SequenceMatcher.

    set_seqs(a, b)
        Set the two sequences to be compared.

    set_seq1(a)
        Set the first sequence to be compared.

    set_seq2(b)
        Set the second sequence to be compared.

    find_longest_match(alo, ahi, blo, bhi)
        Find longest matching block in a[alo:ahi] and b[blo:bhi].

    get_matching_blocks()
        Return list of triples describing matching subsequences.

    get_opcodes()
        Return list of 5-tuples describing how to turn a into b.

    ratio()
        Return a measure of the sequences' similarity (float in [0,1]).

    quick_ratio()
        Return an upper bound on .ratio() relatively quickly.

    real_quick_ratio()
        Return an upper bound on ratio() very quickly.
    N�TcCs(||_d|_|_||_|�||�dS)a!Construct a SequenceMatcher.

        Optional arg isjunk is None (the default), or a one-argument
        function that takes a sequence element and returns true iff the
        element is junk.  None is equivalent to passing "lambda x: 0", i.e.
        no elements are considered to be junk.  For example, pass
            lambda x: x in " \t"
        if you're comparing lines as sequences of characters, and don't
        want to synch up on blanks or hard tabs.

        Optional arg a is the first of two sequences to be compared.  By
        default, an empty string.  The elements of a must be hashable.  See
        also .set_seqs() and .set_seq1().

        Optional arg b is the second of two sequences to be compared.  By
        default, an empty string.  The elements of b must be hashable. See
        also .set_seqs() and .set_seq2().

        Optional arg autojunk should be set to False to disable the
        "automatic junk heuristic" that treats popular elements as junk
        (see module documentation for more information).
        N)�isjunk�a�b�autojunk�set_seqs)�selfrrrrrrr�__init__�s;zSequenceMatcher.__init__cCs|�|�|�|�dS)z�Set the two sequences to be compared.

        >>> s = SequenceMatcher()
        >>> s.set_seqs("abcd", "bcde")
        >>> s.ratio()
        0.75
        N)�set_seq1�set_seq2)rrrrrrr�s	
zSequenceMatcher.set_seqscCs$||jkrdS||_d|_|_dS)aMSet the first sequence to be compared.

        The second sequence to be compared is not changed.

        >>> s = SequenceMatcher(None, "abcd", "bcde")
        >>> s.ratio()
        0.75
        >>> s.set_seq1("bcde")
        >>> s.ratio()
        1.0
        >>>

        SequenceMatcher computes and caches detailed information about the
        second sequence, so if you want to compare one sequence S against
        many sequences, use .set_seq2(S) once and call .set_seq1(x)
        repeatedly for each of the other sequences.

        See also set_seqs() and set_seq2().
        N)r�matching_blocks�opcodes)rrrrrr�s
zSequenceMatcher.set_seq1cCs2||jkrdS||_d|_|_d|_|��dS)aMSet the second sequence to be compared.

        The first sequence to be compared is not changed.

        >>> s = SequenceMatcher(None, "abcd", "bcde")
        >>> s.ratio()
        0.75
        >>> s.set_seq2("abcd")
        >>> s.ratio()
        1.0
        >>>

        SequenceMatcher computes and caches detailed information about the
        second sequence, so if you want to compare one sequence S against
        many sequences, use .set_seq2(S) once and call .set_seq1(x)
        repeatedly for each of the other sequences.

        See also set_seqs() and set_seq1().
        N)rr r!�
fullbcount�_SequenceMatcher__chain_b)rrrrrr�s
zSequenceMatcher.set_seq2cCs�|j}i|_}t|�D]\}}|�|g�}|�|�qt�|_}|j}|r~|��D]}||�rV|�	|�qV|D]
}||=qrt�|_
}t|�}	|jr�|	dkr�|	dd}
|�
�D]\}}t|�|
kr�|�	|�q�|D]
}||=q�dS)N���d�)r�b2j�	enumerate�
setdefault�append�set�bjunkr�keys�addZbpopular�lenr�items)rrr'�i�elt�indicesZjunkrZpopular�nZntestZidxsrrrZ	__chain_b)s,
zSequenceMatcher.__chain_bcCs4|j|j|j|jjf\}}}}||d}	}
}i}g}
t||�D]�}|j}i}|�|||
�D]\}||krlq^||krxq�||dd�d}||<||kr^||d||d|}	}
}q^|}q@|	|k�r |
|k�r |||
d��s ||	d||
dk�r |	d|
d|d}	}
}q�|	||k�rt|
||k�rt|||
|��st||	|||
|k�rt|d7}�q |	|k�r�|
|k�r�|||
d��r�||	d||
dk�r�|	d|
d|d}	}
}�qt|	||k�r(|
||k�r(|||
|��r(||	|||
|k�r(|d}�q�t|	|
|�S)a�Find longest matching block in a[alo:ahi] and b[blo:bhi].

        If isjunk is not defined:

        Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where
            alo <= i <= i+k <= ahi
            blo <= j <= j+k <= bhi
        and for all (i',j',k') meeting those conditions,
            k >= k'
            i <= i'
            and if i == i', j <= j'

        In other words, of all maximal matching blocks, return one that
        starts earliest in a, and of all those maximal matching blocks that
        start earliest in a, return the one that starts earliest in b.

        >>> s = SequenceMatcher(None, " abcd", "abcd abcd")
        >>> s.find_longest_match(0, 5, 0, 9)
        Match(a=0, b=4, size=5)

        If isjunk is defined, first the longest matching block is
        determined as above, but with the additional restriction that no
        junk element appears in the block.  Then that block is extended as
        far as possible by matching (only) junk elements on both sides.  So
        the resulting block never matches on junk except as identical junk
        happens to be adjacent to an "interesting" match.

        Here's the same example as before, but considering blanks to be
        junk.  That prevents " abcd" from matching the " abcd" at the tail
        end of the second sequence directly.  Instead only the "abcd" can
        match, and matches the leftmost "abcd" in the second sequence:

        >>> s = SequenceMatcher(lambda x: x==" ", " abcd", "abcd abcd")
        >>> s.find_longest_match(0, 5, 0, 9)
        Match(a=1, b=0, size=4)

        If no blocks match, return (alo, blo, 0).

        >>> s = SequenceMatcher(None, "ab", "c")
        >>> s.find_longest_match(0, 2, 0, 1)
        Match(a=0, b=0, size=0)
        r
r&)rrr'r,�__contains__�range�getr)r�alo�ahi�blo�bhirrr'ZisbjunkZbestiZbestjZbestsizeZj2lenZnothingr1Zj2lengetZnewj2len�j�krrr�find_longest_matchPsR8"����	�� ��z"SequenceMatcher.find_longest_matchcCs||jdk	r|jSt|j�t|j�}}d|d|fg}g}|r�|��\}}}}|�||||�\}	}
}}|r8|�|�||	kr�||
kr�|�||	||
f�|	||kr8|
||kr8|�|	|||
||f�q8|��d}
}}g}|D]V\}}}|
||k�r|||k�r||7}q�|�r,|�|
||f�|||}
}}q�|�rT|�|
||f�|�||df�tt	t
j|��|_|jS)aReturn list of triples describing matching subsequences.

        Each triple is of the form (i, j, n), and means that
        a[i:i+n] == b[j:j+n].  The triples are monotonically increasing in
        i and in j.  New in Python 2.5, it's also guaranteed that if
        (i, j, n) and (i', j', n') are adjacent triples in the list, and
        the second is not the last triple in the list, then i+n != i' or
        j+n != j'.  IOW, adjacent triples never describe adjacent equal
        blocks.

        The last triple is a dummy, (len(a), len(b), 0), and is the only
        triple with n==0.

        >>> s = SequenceMatcher(None, "abxcd", "abcd")
        >>> list(s.get_matching_blocks())
        [Match(a=0, b=0, size=2), Match(a=3, b=2, size=2), Match(a=5, b=4, size=0)]
        Nr
)r r/rr�popr>r*�sort�list�mapr�_make)r�la�lbZqueuer r8r9r:r;r1r<r=�x�i1�j1Zk1Znon_adjacent�i2�j2Zk2rrr�get_matching_blocks�s8


z#SequenceMatcher.get_matching_blockscCs�|jdk	r|jSd}}g|_}|��D]�\}}}d}||krN||krNd}n||kr\d}n||krhd}|r�|�|||||f�||||}}|r*|�d||||f�q*|S)a[Return list of 5-tuples describing how to turn a into b.

        Each tuple is of the form (tag, i1, i2, j1, j2).  The first tuple
        has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the
        tuple preceding it, and likewise for j1 == the previous j2.

        The tags are strings, with these meanings:

        'replace':  a[i1:i2] should be replaced by b[j1:j2]
        'delete':   a[i1:i2] should be deleted.
                    Note that j1==j2 in this case.
        'insert':   b[j1:j2] should be inserted at a[i1:i1].
                    Note that i1==i2 in this case.
        'equal':    a[i1:i2] == b[j1:j2]

        >>> a = "qabxcd"
        >>> b = "abycdf"
        >>> s = SequenceMatcher(None, a, b)
        >>> for tag, i1, i2, j1, j2 in s.get_opcodes():
        ...    print(("%7s a[%d:%d] (%s) b[%d:%d] (%s)" %
        ...           (tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2])))
         delete a[0:1] (q) b[0:0] ()
          equal a[1:3] (ab) b[0:2] (ab)
        replace a[3:4] (x) b[2:3] (y)
          equal a[4:6] (cd) b[3:5] (cd)
         insert a[6:6] () b[5:6] (f)
        Nr
r�replace�delete�insert�equal)r!rKr*)rr1r<Zanswer�ai�bj�size�tagrrr�get_opcodess$

zSequenceMatcher.get_opcodes�c
csn|��}|sdg}|dddkrZ|d\}}}}}|t|||�|t|||�|f|d<|dddkr�|d\}}}}}||t|||�|t|||�f|d<||}g}	|D]�\}}}}}|dk�r(|||k�r(|	�||t|||�|t|||�f�|	Vg}	t|||�t|||�}}|	�|||||f�q�|	�rjt|	�dk�rd|	dddk�sj|	VdS)a� Isolate change clusters by eliminating ranges with no changes.

        Return a generator of groups with up to n lines of context.
        Each group is in the same format as returned by get_opcodes().

        >>> from pprint import pprint
        >>> a = list(map(str, range(1,40)))
        >>> b = a[:]
        >>> b[8:8] = ['i']     # Make an insertion
        >>> b[20] += 'x'       # Make a replacement
        >>> b[23:28] = []      # Make a deletion
        >>> b[30] += 'y'       # Make another replacement
        >>> pprint(list(SequenceMatcher(None,a,b).get_grouped_opcodes()))
        [[('equal', 5, 8, 5, 8), ('insert', 8, 8, 8, 9), ('equal', 8, 11, 9, 12)],
         [('equal', 16, 19, 17, 20),
          ('replace', 19, 20, 20, 21),
          ('equal', 20, 22, 21, 23),
          ('delete', 22, 27, 23, 23),
          ('equal', 27, 30, 23, 26)],
         [('equal', 31, 34, 27, 30),
          ('replace', 34, 35, 30, 31),
          ('equal', 35, 38, 31, 34)]]
        )rOr
r&r
r&r
rO���r&N)rT�max�minr*r/)
rr4ZcodesrSrGrIrHrJZnn�grouprrr�get_grouped_opcodes<s(&&(&z#SequenceMatcher.get_grouped_opcodescCs0tdd�|��D��}t|t|j�t|j��S)a�Return a measure of the sequences' similarity (float in [0,1]).

        Where T is the total number of elements in both sequences, and
        M is the number of matches, this is 2.0*M / T.
        Note that this is 1 if the sequences are identical, and 0 if
        they have nothing in common.

        .ratio() is expensive to compute if you haven't already computed
        .get_matching_blocks() or .get_opcodes(), in which case you may
        want to try .quick_ratio() or .real_quick_ratio() first to get an
        upper bound.

        >>> s = SequenceMatcher(None, "abcd", "bcde")
        >>> s.ratio()
        0.75
        >>> s.quick_ratio()
        0.75
        >>> s.real_quick_ratio()
        1.0
        css|]}|dVqdS)rVNr)�.0Ztriplerrr�	<genexpr>�sz(SequenceMatcher.ratio.<locals>.<genexpr>)�sumrKrr/rr)rrrrr�rationszSequenceMatcher.ratiocCs�|jdkr4i|_}|jD]}|�|d�d||<q|j}i}|jd}}|jD]>}||�rf||}n|�|d�}|d||<|dkrP|d}qPt|t|j�t|j��S)z�Return an upper bound on ratio() relatively quickly.

        This isn't defined beyond that it is an upper bound on .ratio(), and
        is faster to compute.
        Nr
r&)r"rr7r5rrr/)rr"r2ZavailZavailhasrZnumbrrr�quick_ratio�s






zSequenceMatcher.quick_ratiocCs*t|j�t|j�}}tt||�||�S)z�Return an upper bound on ratio() very quickly.

        This isn't defined beyond that it is an upper bound on .ratio(), and
        is faster to compute than either .ratio() or .quick_ratio().
        )r/rrrrX)rrDrErrr�real_quick_ratio�sz SequenceMatcher.real_quick_ratio)NrrT)rU)�__name__�
__module__�__qualname__�__doc__rrrrr#r>rKrTrZr^r_r`rrrrr+sj
@,'nG7
2rU�333333�?cCs�|dkstd|f��d|kr*dks:ntd|f��g}t�}|�|�|D]D}|�|�|��|krR|��|krR|��|krR|�|��|f�qRt||�}dd�|D�S)a�Use SequenceMatcher to return list of the best "good enough" matches.

    word is a sequence for which close matches are desired (typically a
    string).

    possibilities is a list of sequences against which to match word
    (typically a list of strings).

    Optional arg n (default 3) is the maximum number of close matches to
    return.  n must be > 0.

    Optional arg cutoff (default 0.6) is a float in [0, 1].  Possibilities
    that don't score at least that similar to word are ignored.

    The best (no more than n) matches among the possibilities are returned
    in a list, sorted by similarity score, most similar first.

    >>> get_close_matches("appel", ["ape", "apple", "peach", "puppy"])
    ['apple', 'ape']
    >>> import keyword as _keyword
    >>> get_close_matches("wheel", _keyword.kwlist)
    ['while']
    >>> get_close_matches("Apple", _keyword.kwlist)
    []
    >>> get_close_matches("accept", _keyword.kwlist)
    ['except']
    r
zn must be > 0: %rgrz cutoff must be in [0.0, 1.0]: %rcSsg|]\}}|�qSrr)r[ZscorerFrrr�
<listcomp>�sz%get_close_matches.<locals>.<listcomp>)	�
ValueErrorrrrr`r_r^r*�	_nlargest)ZwordZ
possibilitiesr4�cutoff�result�srFrrrr�s"


�
�
cCsd�dd�t||�D��S)zAReplace whitespace with the original whitespace characters in `s`rcss*|]"\}}|dkr|��r|n|VqdS)� N)�isspace)r[�cZtag_crrrr\�s�z$_keep_original_ws.<locals>.<genexpr>)�join�zip)rkZtag_srrr�_keep_original_ws�s
�rqc@sJeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)ra�

    Differ is a class for comparing sequences of lines of text, and
    producing human-readable differences or deltas.  Differ uses
    SequenceMatcher both to compare sequences of lines, and to compare
    sequences of characters within similar (near-matching) lines.

    Each line of a Differ delta begins with a two-letter code:

        '- '    line unique to sequence 1
        '+ '    line unique to sequence 2
        '  '    line common to both sequences
        '? '    line not present in either input sequence

    Lines beginning with '? ' attempt to guide the eye to intraline
    differences, and were not present in either input sequence.  These lines
    can be confusing if the sequences contain tab characters.

    Note that Differ makes no claim to produce a *minimal* diff.  To the
    contrary, minimal diffs are often counter-intuitive, because they synch
    up anywhere possible, sometimes accidental matches 100 pages apart.
    Restricting synch points to contiguous matches preserves some notion of
    locality, at the occasional cost of producing a longer diff.

    Example: Comparing two texts.

    First we set up the texts, sequences of individual single-line strings
    ending with newlines (such sequences can also be obtained from the
    `readlines()` method of file-like objects):

    >>> text1 = '''  1. Beautiful is better than ugly.
    ...   2. Explicit is better than implicit.
    ...   3. Simple is better than complex.
    ...   4. Complex is better than complicated.
    ... '''.splitlines(keepends=True)
    >>> len(text1)
    4
    >>> text1[0][-1]
    '\n'
    >>> text2 = '''  1. Beautiful is better than ugly.
    ...   3.   Simple is better than complex.
    ...   4. Complicated is better than complex.
    ...   5. Flat is better than nested.
    ... '''.splitlines(keepends=True)

    Next we instantiate a Differ object:

    >>> d = Differ()

    Note that when instantiating a Differ object we may pass functions to
    filter out line and character 'junk'.  See Differ.__init__ for details.

    Finally, we compare the two:

    >>> result = list(d.compare(text1, text2))

    'result' is a list of strings, so let's pretty-print it:

    >>> from pprint import pprint as _pprint
    >>> _pprint(result)
    ['    1. Beautiful is better than ugly.\n',
     '-   2. Explicit is better than implicit.\n',
     '-   3. Simple is better than complex.\n',
     '+   3.   Simple is better than complex.\n',
     '?     ++\n',
     '-   4. Complex is better than complicated.\n',
     '?            ^                     ---- ^\n',
     '+   4. Complicated is better than complex.\n',
     '?           ++++ ^                      ^\n',
     '+   5. Flat is better than nested.\n']

    As a single multi-line string it looks like this:

    >>> print(''.join(result), end="")
        1. Beautiful is better than ugly.
    -   2. Explicit is better than implicit.
    -   3. Simple is better than complex.
    +   3.   Simple is better than complex.
    ?     ++
    -   4. Complex is better than complicated.
    ?            ^                     ---- ^
    +   4. Complicated is better than complex.
    ?           ++++ ^                      ^
    +   5. Flat is better than nested.

    Methods:

    __init__(linejunk=None, charjunk=None)
        Construct a text differencer, with optional filters.

    compare(a, b)
        Compare two sequences of lines; generate the resulting delta.
    NcCs||_||_dS)a�
        Construct a text differencer, with optional filters.

        The two optional keyword parameters are for filter functions:

        - `linejunk`: A function that should accept a single string argument,
          and return true iff the string is junk. The module-level function
          `IS_LINE_JUNK` may be used to filter out lines without visible
          characters, except for at most one splat ('#').  It is recommended
          to leave linejunk None; the underlying SequenceMatcher class has
          an adaptive notion of "noise" lines that's better than any static
          definition the author has ever been able to craft.

        - `charjunk`: A function that should accept a string of length 1. The
          module-level function `IS_CHARACTER_JUNK` may be used to filter out
          whitespace characters (a blank or tab; **note**: bad idea to include
          newline in this!).  Use of IS_CHARACTER_JUNK is recommended.
        N��linejunk�charjunk)rrsrtrrrrHszDiffer.__init__c
	cs�t|j||�}|��D]�\}}}}}|dkrB|�||||||�}	n\|dkr\|�d|||�}	nB|dkrv|�d|||�}	n(|dkr�|�d|||�}	ntd|f��|	Ed	Hqd	S)
a�
        Compare two sequences of lines; generate the resulting delta.

        Each sequence must contain individual single-line strings ending with
        newlines. Such sequences can be obtained from the `readlines()` method
        of file-like objects.  The delta generated also consists of newline-
        terminated strings, ready to be printed as-is via the writeline()
        method of a file-like object.

        Example:

        >>> print(''.join(Differ().compare('one\ntwo\nthree\n'.splitlines(True),
        ...                                'ore\ntree\nemu\n'.splitlines(True))),
        ...       end="")
        - one
        ?  ^
        + ore
        ?  ^
        - two
        - three
        ?  -
        + tree
        + emu
        rLrM�-rN�+rOrl�unknown tag %rN)rrsrT�_fancy_replace�_dumprg)
rrr�cruncherrSr8r9r:r;�grrr�compare_szDiffer.compareccs&t||�D]}d|||fVq
dS)z4Generate comparison results for a same-tagged range.z%s %sN)r6)rrSrF�lo�hir1rrrry�szDiffer._dumpc
cs�||kr||kst�||||krF|�d|||�}|�d|||�}n |�d|||�}|�d|||�}||fD]}	|	EdHqndS)Nrvru)�AssertionErrorry)
rrr8r9rr:r;�first�secondr{rrr�_plain_replace�szDiffer._plain_replaceccs:d\}}t|j�}	d\}
}t||�D]�}||}
|	�|
�t||�D]j}||}||
krl|
dkrD||}
}qD|	�|�|	��|krD|	��|krD|	��|krD|	��||}}}qDq$||kr�|
dkr�|�||||||�EdHdS|
|d}}}nd}
|�	||||||�EdH||||}}|
dk�r
d}}|	�
||�|	��D]�\}}}}}||||}}|dk�r�|d|7}|d|7}nb|dk�r�|d	|7}nJ|d
k�r�|d|7}n2|dk�r�|d
|7}|d
|7}ntd|f���qH|�
||||�EdHn
d|V|�	||d|||d|�EdHdS)aL
        When replacing one block of lines with another, search the blocks
        for *similar* lines; the best-matching pair (if any) is used as a
        synch point, and intraline difference marking is done on the
        similar pair. Lots of work, but often worth it.

        Example:

        >>> d = Differ()
        >>> results = d._fancy_replace(['abcDefghiJkl\n'], 0, 1,
        ...                            ['abcdefGhijkl\n'], 0, 1)
        >>> print(''.join(results), end="")
        - abcDefghiJkl
        ?    ^  ^  ^
        + abcdefGhijkl
        ?    ^  ^  ^
        )g�G�z��?g�?)NNNrrrL�^rMrurNrvrOrlrw�  r&)rrtr6rrr`r_r^r��
_fancy_helperrrTrg�_qformat)rrr8r9rr:r;Z
best_ratiorirzZeqiZeqjr<rQr1rPZbest_iZbest_jZaeltZbelt�atags�btagsrSZai1Zai2Zbj1Zbj2rDrErrrrx�s\




�
�





zDiffer._fancy_replaceccsbg}||kr<||kr*|�||||||�}qT|�d|||�}n||krT|�d|||�}|EdHdS)Nrurv)rxry)rrr8r9rr:r;r{rrrr��szDiffer._fancy_helperccsXt||���}t||���}d|V|r8d|�d�Vd|V|rTd|�d�VdS)a�
        Format "?" output and deal with tabs.

        Example:

        >>> d = Differ()
        >>> results = d._qformat('\tabcDefghiJkl\n', '\tabcdefGhijkl\n',
        ...                      '  ^ ^  ^      ', '  ^ ^  ^      ')
        >>> for line in results: print(repr(line))
        ...
        '- \tabcDefghiJkl\n'
        '? \t ^ ^  ^\n'
        '+ \tabcdefGhijkl\n'
        '? \t ^ ^  ^\n'
        �- z? �
�+ N)rq�rstrip)rZalineZbliner�r�rrrr�s

zDiffer._qformat)NN)rarbrcrdrr|ryr�rxr�r�rrrrr�s]
)^Nz
\s*(?:#\s*)?$cCs||�dk	S)z�
    Return True for ignorable line: iff `line` is blank or contains a single '#'.

    Examples:

    >>> IS_LINE_JUNK('\n')
    True
    >>> IS_LINE_JUNK('  #   \n')
    True
    >>> IS_LINE_JUNK('hello\n')
    False
    Nr)�lineZpatrrrr3s� 	cCs||kS)z�
    Return True for ignorable character: iff `ch` is a space or tab.

    Examples:

    >>> IS_CHARACTER_JUNK(' ')
    True
    >>> IS_CHARACTER_JUNK('\t')
    True
    >>> IS_CHARACTER_JUNK('\n')
    False
    >>> IS_CHARACTER_JUNK('x')
    False
    r)ZchZwsrrrrCscCs:|d}||}|dkr"d�|�S|s.|d8}d�||�S�z Convert range to the "ed" formatr&z{}z{},{}��format��start�stopZ	beginningrrrr�_format_range_unifiedZs
r�rr�ccsPt|||||||�d}td||��|�D�]}	|s|d}|rFd�|�nd}
|rXd�|�nd}d�||
|�Vd�|||�V|	d|	d	}}
t|d
|
d�}t|d|
d
�}d�|||�V|	D]�\}}}}}|dkr�|||�D]}d|Vq�q�|dk�r"|||�D]}d|V�q|dkr�|||�D]}d|V�q6q�q*dS)a�
    Compare two sequences of lines; generate the delta as a unified diff.

    Unified diffs are a compact way of showing line changes and a few
    lines of context.  The number of context lines is set by 'n' which
    defaults to three.

    By default, the diff control lines (those with ---, +++, or @@) are
    created with a trailing newline.  This is helpful so that inputs
    created from file.readlines() result in diffs that are suitable for
    file.writelines() since both the inputs and outputs have trailing
    newlines.

    For inputs that do not have trailing newlines, set the lineterm
    argument to "" so that the output will be uniformly newline free.

    The unidiff format normally has a header for filenames and modification
    times.  Any or all of these may be specified using strings for
    'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.
    The modification times are normally expressed in the ISO 8601 format.

    Example:

    >>> for line in unified_diff('one two three four'.split(),
    ...             'zero one tree four'.split(), 'Original', 'Current',
    ...             '2005-01-26 23:30:50', '2010-04-02 10:20:52',
    ...             lineterm=''):
    ...     print(line)                 # doctest: +NORMALIZE_WHITESPACE
    --- Original        2005-01-26 23:30:50
    +++ Current         2010-04-02 10:20:52
    @@ -1,4 +1,4 @@
    +zero
     one
    -two
    -three
    +tree
     four
    FNT�	{}r�
--- {}{}{}z
+++ {}{}{}r
rVr&�rU�z@@ -{} +{} @@{}rOrl>rMrLru>rLrNrv)�_check_typesrrZr�r�)rr�fromfile�tofile�fromfiledate�
tofiledater4�lineterm�startedrY�fromdate�todater��last�file1_range�file2_rangerSrGrIrHrJr�rrrr	es0)
cCsB|d}||}|s|d8}|dkr.d�|�Sd�|||d�Sr�r�r�rrr�_format_range_context�s
r�ccs�t|||||||�tddddd�}d}	td||��|�D�]R}
|	s�d}	|rVd	�|�nd
}|rhd	�|�nd
}d�|||�Vd�|||�V|
d
|
d}
}d|Vt|
d|d�}d�||�Vtdd�|
D���r|
D]8\}}}}}|dkr�|||�D]}|||V�qq�t|
d|d�}d�||�Vtdd�|
D��r:|
D]<\}}}}}|dk�rP|||�D]}|||V�qt�qPq:dS)ah
    Compare two sequences of lines; generate the delta as a context diff.

    Context diffs are a compact way of showing line changes and a few
    lines of context.  The number of context lines is set by 'n' which
    defaults to three.

    By default, the diff control lines (those with *** or ---) are
    created with a trailing newline.  This is helpful so that inputs
    created from file.readlines() result in diffs that are suitable for
    file.writelines() since both the inputs and outputs have trailing
    newlines.

    For inputs that do not have trailing newlines, set the lineterm
    argument to "" so that the output will be uniformly newline free.

    The context diff format normally has a header for filenames and
    modification times.  Any or all of these may be specified using
    strings for 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.
    The modification times are normally expressed in the ISO 8601 format.
    If not specified, the strings default to blanks.

    Example:

    >>> print(''.join(context_diff('one\ntwo\nthree\nfour\n'.splitlines(True),
    ...       'zero\none\ntree\nfour\n'.splitlines(True), 'Original', 'Current')),
    ...       end="")
    *** Original
    --- Current
    ***************
    *** 1,4 ****
      one
    ! two
    ! three
      four
    --- 1,4 ----
    + zero
      one
    ! tree
      four
    r�r�z! r�)rNrMrLrOFNTr�rz
*** {}{}{}r�r
rVz***************r&r�z
*** {} ****{}css |]\}}}}}|dkVqdS)>rMrLNr�r[rS�_rrrr\�szcontext_diff.<locals>.<genexpr>rNrUr�z
--- {} ----{}css |]\}}}}}|dkVqdS)>rLrNNrr�rrrr\srM)r��dictrrZr�r��any)rrr�r�r�r�r4r��prefixr�rYr�r�r�r�r�rSrGrIr�r�r�rHrJrrrr�s4,

cGs�|r0t|dt�s0tdt|d�j|df��|r`t|dt�s`tdt|d�j|df��|D]}t|t�sdtd|f��qddS)Nr
z)lines to compare must be str, not %s (%r)z"all arguments must be str, not: %r)�
isinstance�str�	TypeError�typera)rr�args�argrrrr�s��
r���
c		cs~dd�}	tt|	|��}tt|	|��}|	|�}|	|�}|	|�}|	|�}|	|�}|||||||||�}
|
D]}|�dd�VqfdS)a�
    Compare `a` and `b`, two sequences of lines represented as bytes rather
    than str. This is a wrapper for `dfunc`, which is typically either
    unified_diff() or context_diff(). Inputs are losslessly converted to
    strings so that `dfunc` only has to worry about strings, and encoded
    back to bytes on return. This is necessary to compare files with
    unknown or inconsistent encoding. All other inputs (except `n`) must be
    bytes rather than str.
    c
SsRz|�dd�WStk
rL}z dt|�j|f}t|�|�W5d}~XYnXdS)N�ascii�surrogateescapez(all arguments must be bytes, not %s (%r))�decode�AttributeErrorr�rar�)rk�err�msgrrrr�"s�zdiff_bytes.<locals>.decoder�r�N)rArB�encode)Zdfuncrrr�r�r�r�r4r�r��linesr�rrrr
scCst||��||�S)aJ
    Compare `a` and `b` (lists of strings); return a `Differ`-style delta.

    Optional keyword parameters `linejunk` and `charjunk` are for filter
    functions, or can be None:

    - linejunk: A function that should accept a single string argument and
      return true iff the string is junk.  The default is None, and is
      recommended; the underlying SequenceMatcher class has an adaptive
      notion of "noise" lines.

    - charjunk: A function that accepts a character (string of length
      1), and returns true iff the character is junk. The default is
      the module-level function IS_CHARACTER_JUNK, which filters out
      whitespace characters (a blank or tab; note: it's a bad idea to
      include newline in this!).

    Tools/scripts/ndiff.py is a command-line front-end to this function.

    Example:

    >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
    ...              'ore\ntree\nemu\n'.splitlines(keepends=True))
    >>> print(''.join(diff), end="")
    - one
    ?  ^
    + ore
    ?  ^
    - two
    - three
    ?  -
    + tree
    + emu
    )rr|)rrrsrtrrrr5s#c#s�ddl}|�d��t||||��ddgf�fdd�	���fdd���fdd	�}|�}|dkrj|EdH�n|d
7}d}ddg|}	}
d}|dkr�zt|�\}}
}Wntk
r�YdSX|	|}||
|f|
|<|	d
7}	q�|	|kr�dV|}n|	}d}	|�r"|	|}|	d
7}	|
|V|d
8}q�|d
}z@|�rht|�\}}
}|�rP|d
}n|d
8}||
|fV�q,Wqvtk
�r�YdSXqvdS)
a�Returns generator yielding marked up from/to side by side differences.

    Arguments:
    fromlines -- list of text lines to compared to tolines
    tolines -- list of text lines to be compared to fromlines
    context -- number of context lines to display on each side of difference,
               if None, all from/to text lines will be generated.
    linejunk -- passed on to ndiff (see ndiff documentation)
    charjunk -- passed on to ndiff (see ndiff documentation)

    This function returns an iterator which returns a tuple:
    (from line tuple, to line tuple, boolean flag)

    from/to line tuple -- (line num, line text)
        line num -- integer or None (to indicate a context separation)
        line text -- original line text with following markers inserted:
            '\0+' -- marks start of added text
            '\0-' -- marks start of deleted text
            '\0^' -- marks start of changed text
            '\1' -- marks end of added/deleted/changed text

    boolean flag -- None indicates context separation, True indicates
        either "from" or "to" line contains a change, otherwise False.

    This function/iterator was originally developed to generate side by side
    file difference for making HTML pages (see HtmlDiff class for example
    usage).

    Note, this function utilizes the ndiff function to generate the side by
    side difference markup.  Optional ndiff arguments may be passed to this
    function and they in turn will be passed to ndiff.
    r
Nz
(\++|\-+|\^+)cs�||d7<|dkr2|||�d�dd�fS|dkr�|�d�|�d�}}g}|fdd�}��||�t|�D]<\}\}	}
|d|	�d|||	|
�d	||
d�}qt|dd�}n*|�d�dd�}|s�d
}d||d	}|||fS)aReturns line of text with user's change markup and line formatting.

        lines -- list of lines from the ndiff generator to produce a line of
                 text from.  When producing the line of text to return, the
                 lines used are removed from this list.
        format_key -- '+' return first line in list with "add" markup around
                          the entire line.
                      '-' return first line in list with "delete" markup around
                          the entire line.
                      '?' return first line in list with add/delete/change
                          intraline markup (indices obtained from second line)
                      None return first line in list with no markup
        side -- indice into the num_lines list (0=from,1=to)
        num_lines -- from/to current line number.  This is NOT intended to be a
                     passed parameter.  It is present as a keyword argument to
                     maintain memory of the current line numbers between calls
                     of this function.

        Note, this function is purposefully not defined at the module scope so
        that data it needs from its parent function (within whose context it
        is defined) does not need to be of module scope.
        r&Nr
r��?cSs&|�|�d�d|��g�|�d�S)Nr&r
)r*rY�span)Zmatch_object�sub_inforrr�record_sub_info�sz3_mdiff.<locals>._make_line.<locals>.record_sub_info��rl)r?�sub�reversed)r�Z
format_key�sideZ	num_lines�textZmarkersr�r��keyZbegin�end)�	change_rerr�
_make_line�s 2z_mdiff.<locals>._make_linec3sng}d\}}t|�dkr*|�t�d��qd�dd�|D��}|�d�rP|}�n�|�d�r|�|dd	��|dd
�dfVq�n�|�d�r�|d
8}�|d
d	�ddfVq�nl|�d�rֈ|d
d	�d}}|d
d	}}�n>|�d��r�|dd	��|dd
�dfVq�n|�d��r0�|dd	��|dd
�dfVqn�|�d
��r\|d
8}�|d
d	�ddfVqn�|�d��r�|d
7}d�|dd
�dfVqn�|�d��r�d�|dd
�}}|d
d	}}n^|�d��r�|d
7}d�|dd
�dfVqn2|�d��r�|dd�dd	��|dd
�dfVq|d	k�r0|d
7}dV�q|d	k�rL|d
8}dV�q0|�d��r\dS||dfVqdS)a�Yields from/to lines of text with a change indication.

        This function is an iterator.  It itself pulls lines from a
        differencing iterator, processes them and yields them.  When it can
        it yields both a "from" and a "to" line, otherwise it will yield one
        or the other.  In addition to yielding the lines of from/to text, a
        boolean flag is yielded to indicate if the text line(s) have
        differences in them.

        Note, this function is purposefully not defined at the module scope so
        that data it needs from its parent function (within whose context it
        is defined) does not need to be of module scope.
        )r
r
r��XrcSsg|]}|d�qS)r
r�r[r�rrrrf�sz2_mdiff.<locals>._line_iterator.<locals>.<listcomp>z-?+?r�r
r&Tz--++ruN)z--?+z--+r�z-+?z-?+z+--rv)r�z+-rlF)N�rr�T)r�NT)r/r*�nextro�
startswith)r�Znum_blanks_pendingZnum_blanks_to_yieldrk�	from_line�to_line)r��diff_lines_iteratorrr�_line_iterator�sd



$



z_mdiff.<locals>._line_iteratorc3s���}gg}}t|�dks(t|�dkr�zt|�\}}}Wntk
rPYdSX|dk	rh|�||f�|dk	r|�||f�q|�d�\}}|�d�\}}|||p�|fVqdS)atYields from/to lines of text with a change indication.

        This function is an iterator.  It itself pulls lines from the line
        iterator.  Its difference from that iterator is that this function
        always yields a pair of from/to text lines (with the change
        indication).  If necessary it will collect single from/to lines
        until it has a matching pair from/to pair to yield.

        Note, this function is purposefully not defined at the module scope so
        that data it needs from its parent function (within whose context it
        is defined) does not need to be of module scope.
        r
N)r/r��
StopIterationr*r?)Z
line_iterator�	fromlines�tolinesr�r��
found_diffZfromDiffZto_diff)r�rr�_line_pair_iterators

z#_mdiff.<locals>._line_pair_iteratorr&F)NNN)�re�compilerr�r�)r�r��contextrsrtr�r�Zline_pair_iteratorZlines_to_write�indexZcontextLinesr�r�r�r1r)r�r�r�r�r�_mdiffZsR"
8X!



r�an
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>
    <meta http-equiv="Content-Type"
          content="text/html; charset=%(charset)s" />
    <title></title>
    <style type="text/css">%(styles)s
    </style>
</head>

<body>
    %(table)s%(legend)s
</body>

</html>aH
        table.diff {font-family:Courier; border:medium;}
        .diff_header {background-color:#e0e0e0}
        td.diff_header {text-align:right}
        .diff_next {background-color:#c0c0c0}
        .diff_add {background-color:#aaffaa}
        .diff_chg {background-color:#ffff77}
        .diff_sub {background-color:#ffaaaa}aZ
    <table class="diff" id="difflib_chg_%(prefix)s_top"
           cellspacing="0" cellpadding="0" rules="groups" >
        <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
        <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
        %(header_row)s
        <tbody>
%(data_rows)s        </tbody>
    </table>a�
    <table class="diff" summary="Legends">
        <tr> <th colspan="2"> Legends </th> </tr>
        <tr> <td> <table border="" summary="Colors">
                      <tr><th> Colors </th> </tr>
                      <tr><td class="diff_add">&nbsp;Added&nbsp;</td></tr>
                      <tr><td class="diff_chg">Changed</td> </tr>
                      <tr><td class="diff_sub">Deleted</td> </tr>
                  </table></td>
             <td> <table border="" summary="Links">
                      <tr><th colspan="2"> Links </th> </tr>
                      <tr><td>(f)irst change</td> </tr>
                      <tr><td>(n)ext change</td> </tr>
                      <tr><td>(t)op</td> </tr>
                  </table></td> </tr>
    </table>c@s�eZdZdZeZeZeZeZdZddde	fdd�Z
dd
d�dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zddd�ZdS) ra{For producing HTML side by side comparison with change highlights.

    This class can be used to create an HTML table (or a complete HTML file
    containing the table) showing a side by side, line by line comparison
    of text with inter-line and intra-line change highlights.  The table can
    be generated in either full or contextual difference mode.

    The following methods are provided for HTML generation:

    make_table -- generates HTML for a single side by side table
    make_file -- generates complete HTML file with a single side by side table

    See tools/scripts/diff.py for an example usage of this class.
    r
�NcCs||_||_||_||_dS)a�HtmlDiff instance initializer

        Arguments:
        tabsize -- tab stop spacing, defaults to 8.
        wrapcolumn -- column number where lines are broken and wrapped,
            defaults to None where lines are not wrapped.
        linejunk,charjunk -- keyword arguments passed into ndiff() (used by
            HtmlDiff() to generate the side by side HTML differences).  See
            ndiff() documentation for argument default values and descriptions.
        N)�_tabsize�_wrapcolumn�	_linejunk�	_charjunk)r�tabsizeZ
wrapcolumnrsrtrrrr�szHtmlDiff.__init__rF�zutf-8)�charsetcCs:|jt|j|j|j||||||d�|d��|d��|�S)aReturns HTML file of side by side comparison with change highlights

        Arguments:
        fromlines -- list of "from" lines
        tolines -- list of "to" lines
        fromdesc -- "from" file column header string
        todesc -- "to" file column header string
        context -- set to True for contextual differences (defaults to False
            which shows full differences).
        numlines -- number of context lines.  When context is set True,
            controls number of lines displayed before and after the change.
            When context is False, controls the number of lines to place
            the "next" link anchors before the next change (so click of
            "next" link jumps to just before the change).
        charset -- charset of the HTML document
        )r��numlines)ZstylesZlegend�tabler��xmlcharrefreplace)�_file_templater��_styles�_legend�
make_tabler�r�)rr�r��fromdesc�todescr�r�r�rrr�	make_file�s����zHtmlDiff.make_filecs8�fdd���fdd�|D�}�fdd�|D�}||fS)aReturns from/to line lists with tabs expanded and newlines removed.

        Instead of tab characters being replaced by the number of spaces
        needed to fill in to the next tab stop, this function will fill
        the space with tab characters.  This is done so that the difference
        algorithms can identify changes in a file when tabs are replaced by
        spaces and vice versa.  At the end of the HTML generation, the tab
        characters will be replaced with a nonbreakable space.
        cs6|�dd�}|��j�}|�dd�}|�dd��d�S)Nrlr��	r�)rL�
expandtabsr�r�)r�)rrr�expand_tabs�sz2HtmlDiff._tab_newline_replace.<locals>.expand_tabscsg|]}�|��qSrrr��r�rrrf�sz1HtmlDiff._tab_newline_replace.<locals>.<listcomp>csg|]}�|��qSrrr�r�rrrf�sr)rr�r�r)r�rr�_tab_newline_replace�s
	zHtmlDiff._tab_newline_replacecCs|s|�||f�dSt|�}|j}||ksB||�d�d|krT|�||f�dSd}d}d}||kr�||kr�||dkr�|d7}||}|d7}q`||dkr�|d7}d}q`|d7}|d7}q`|d|�}	||d�}
|r�|	d}	d||
}
|�||	f�|�|d|
�dS)	a�Builds list of text lines by splitting text lines at wrap point

        This function will determine if the input text line needs to be
        wrapped (split) into separate lines.  If so, the first wrap point
        will be determined and the first line appended to the output
        text line list.  This function is used recursively to handle
        the second part of the split line to further split it.
        Nr�rUr
rr&r��>)r*r/r��count�_split_line)rZ	data_listZline_numr�rRrWr1r4ZmarkZline1Zline2rrrr��s8


zHtmlDiff._split_lineccs�|D]�\}}}|dkr$|||fVq||\}}\}}gg}	}
|�|	||�|�|
||�|	sd|
r|	rt|	�d�}nd}|
r�|
�d�}nd}|||fVq\qdS)z5Returns iterator that splits (wraps) mdiff text linesNr
)rrl)r�r?)r�diffs�fromdata�todata�flagZfromlineZfromtextZtolineZtotext�fromlist�tolistrrr�
_line_wrapper0s 
zHtmlDiff._line_wrapperc	Cs�ggg}}}|D]r\}}}z4|�|jd|f|���|�|jd|f|���Wn(tk
rz|�d�|�d�YnX|�|�q|||fS)z�Collects mdiff output into separate lists

        Before storing the mdiff from/to data into a list, it is converted
        into a single line of text with HTML markup.
        r
r&N)r*�_format_liner�)rr�r�r��flaglistr�r�r�rrr�_collect_linesLs
zHtmlDiff._collect_linescCsrzd|}d|j||f}Wntk
r6d}YnX|�dd��dd��dd	�}|�d
d���}d|||fS)
aReturns HTML markup of "from" / "to" text lines

        side -- 0 or 1 indicating "from" or "to" text
        flag -- indicates if difference on line
        linenum -- line number (used for line number column)
        text -- line text to be marked up
        z%dz
 id="%s%s"r�&z&amp;r�z&gt;�<z&lt;rl�&nbsp;z<<td class="diff_header"%s>%s</td><td nowrap="nowrap">%s</td>)�_prefixr�rLr�)rr�r�Zlinenumr��idrrrr�as
�zHtmlDiff._format_linecCs0dtj}dtj}tjd7_||g|_dS)zCreate unique anchor prefixeszfrom%d_zto%d_r&N)r�_default_prefixr)rZ
fromprefix�toprefixrrr�_make_prefixxs

zHtmlDiff._make_prefixcCs�|jd}dgt|�}dgt|�}d\}	}
d}t|�D]V\}}
|
r�|
s�d}
|}td||g�}d||	f||<|	d7}	d||	f||<q:d}
q:|s�dg}dg}dg}d}|r�d	g}|}n
d
g}}|ds�d||d<d|||<|||||fS)
zMakes list of "next" linksr&r)r
Fr
Tz id="difflib_chg_%s_%d"z"<a href="#difflib_chg_%s_%d">n</a>Fz2<td></td><td>&nbsp;No Differences Found&nbsp;</td>z(<td></td><td>&nbsp;Empty File&nbsp;</td>z!<a href="#difflib_chg_%s_0">f</a>z#<a href="#difflib_chg_%s_top">t</a>)rr/r(rW)rr�r�r�r�r�r�next_id�	next_hrefZnum_chgZ	in_changer�r1r�rrr�_convert_flags�s>
�
zHtmlDiff._convert_flagsc
CsR|��|�||�\}}|r"|}nd}t||||j|jd�}|jrL|�|�}|�|�\}	}
}|�|	|
|||�\}	}
}}}
g}d}t	t
|��D]P}||dkr�|dkr�|�d�q�|�||
||||	||||
|f�q�|s�|�rddd|dd|f}nd	}|jt
d	�|�||jd
d�}|�dd
��dd��dd��dd��dd�S)a�Returns HTML table of side by side comparison with change highlights

        Arguments:
        fromlines -- list of "from" lines
        tolines -- list of "to" lines
        fromdesc -- "from" file column header string
        todesc -- "to" file column header string
        context -- set to True for contextual differences (defaults to False
            which shows full differences).
        numlines -- number of context lines.  When context is set True,
            controls number of lines displayed before and after the change.
            When context is False, controls the number of lines to place
            the "next" link anchors before the next change (so click of
            "next" link jumps to just before the change).
        NrrzV            <tr><td class="diff_next"%s>%s</td>%s<td class="diff_next">%s</td>%s</tr>
r
z)        </tbody>        
        <tbody>
z <thead><tr>%s%s%s%s</tr></thead>z!<th class="diff_next"><br /></th>z+<th colspan="2" class="diff_header">%s</th>rr&)Z	data_rows�
header_rowr�z+z<span class="diff_add">z-z<span class="diff_sub">z^z<span class="diff_chg">r�z</span>r�r)rr�r�r�r�r�r�rrr6r/r*�_table_templater�rorrL)rr�r�r�r�r�r�Z
context_linesr�r�r�r�r
r	rkZfmtr1rr�rrrr��sl�
��

������zHtmlDiff.make_table)rrFr�)rrFr�)rarbrcrdr�r�r
r�rrrr�r�r�r�rr�rrr�rrrrr�s2�
��7/�ccsnzddd�t|�}Wn"tk
r8td|�d�YnXd|f}|D]"}|dd�|krF|dd�VqFdS)a0
    Generate one of the two sequences that generated a delta.

    Given a `delta` produced by `Differ.compare()` or `ndiff()`, extract
    lines originating from file 1 or 2 (parameter `which`), stripping off line
    prefixes.

    Examples:

    >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
    ...              'ore\ntree\nemu\n'.splitlines(keepends=True))
    >>> diff = list(diff)
    >>> print(''.join(restore(diff, 1)), end="")
    one
    two
    three
    >>> print(''.join(restore(diff, 2)), end="")
    ore
    tree
    emu
    r�r�)r&r�z)unknown delta choice (must be 1 or 2): %rNr�r�)�int�KeyErrorrg)ZdeltaZwhichrS�prefixesr�rrrrs��cCsddl}ddl}|�|�S)Nr
)�doctest�difflibZtestmod)rrrrr�_test!sr�__main__)rUre)r�)rrrrrUr�)rrrrrUr�)r�r�r�r�rUr�)$rd�__all__�heapqrrh�collectionsrZ_namedtuplerrrrrqrr�r��matchrrr�r	r�rr�r
rr�r�r�r
r��objectrrrrarrrr�<module>s��


1	I
�
I�
L�
%�
	
a 
smtplib.cpython-38.opt-1.pyc000064400000105434150335716500011621 0ustar00U

e5dɯ�
@srdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZdddddd	d
ddd
dddg
ZdZdZdZdZdZdZe�dej�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd	�d	e�Z Gdd
�d
e�Z!Gdd�de�Z"Gd d�de�Z#Gd!d
�d
e�Z$d"d�Z%d#d$�Z&d%d�Z'd&d'�Z(d(d)�Z)zddl*Z*Wne+k
�r�d*Z,YnXd+Z,Gd,d�d�Z-e,�r�Gd-d.�d.e-�Z.e�/d.�d/Z0Gd0d1�d1e-�Z1e2d2k�rnd3d4�Z3e3d5�Z4e3d6��5d7�Z6e7d8�d9Z8ej9�:�Z;e;�s*�q6e8e;Z8�qe7d:e<e8��e-d;�Z=e=�>d<�e=�?e4e6e8�e=�@�dS)=aSMTP/ESMTP client class.

This should follow RFC 821 (SMTP), RFC 1869 (ESMTP), RFC 2554 (SMTP
Authentication) and RFC 2487 (Secure SMTP over TLS).

Notes:

Please remember, when doing ESMTP, that the names of the SMTP service
extensions are NOT the same thing as the option keywords for the RCPT
and MAIL commands!

Example:

  >>> import smtplib
  >>> s=smtplib.SMTP("localhost")
  >>> print(s.help())
  This is Sendmail version 8.8.4
  Topics:
      HELO    EHLO    MAIL    RCPT    DATA
      RSET    NOOP    QUIT    HELP    VRFY
      EXPN    VERB    ETRN    DSN
  For more info use "HELP <topic>".
  To report bugs in the implementation send email to
      sendmail-bugs@sendmail.org.
  For local information send email to Postmaster at your site.
  End of HELP info
  >>> s.putcmd("vrfy","someone@here")
  >>> s.getreply()
  (250, "Somebody OverHere <somebody@here.my.org>")
  >>> s.quit()
�N)�body_encode�
SMTPException�SMTPNotSupportedError�SMTPServerDisconnected�SMTPResponseException�SMTPSenderRefused�SMTPRecipientsRefused�
SMTPDataError�SMTPConnectError�
SMTPHeloError�SMTPAuthenticationError�	quoteaddr�	quotedata�SMTP�i��
s
i �z	auth=(.*)c@seZdZdZdS)rz4Base class for all exceptions raised by this module.N��__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.8/smtplib.pyrHsc@seZdZdZdS)rz�The command or option is not supported by the SMTP server.

    This exception is raised when an attempt is made to run a command or a
    command with an option which is not supported by the server.
    NrrrrrrKsc@seZdZdZdS)rz�Not connected to any SMTP server.

    This exception is raised when the server unexpectedly disconnects,
    or when an attempt is made to use the SMTP instance before
    connecting it to a server.
    NrrrrrrRsc@seZdZdZdd�ZdS)ra2Base class for all exceptions that include an SMTP error code.

    These exceptions are generated in some instances when the SMTP
    server returns an error code.  The error code is stored in the
    `smtp_code' attribute of the error, and the `smtp_error' attribute
    is set to the error message.
    cCs||_||_||f|_dS�N)�	smtp_code�
smtp_error�args)�self�code�msgrrr�__init__cszSMTPResponseException.__init__N�rrrrr!rrrrrZsc@seZdZdZdd�ZdS)rz�Sender address refused.

    In addition to the attributes set by on all SMTPResponseException
    exceptions, this sets `sender' to the string that the SMTP refused.
    cCs"||_||_||_|||f|_dSr)rr�senderr)rrr r#rrrr!oszSMTPSenderRefused.__init__Nr"rrrrrhsc@seZdZdZdd�ZdS)rz�All recipient addresses refused.

    The errors for each recipient are accessible through the attribute
    'recipients', which is a dictionary of exactly the same sort as
    SMTP.sendmail() returns.
    cCs||_|f|_dSr)�
recipientsr)rr$rrrr!}szSMTPRecipientsRefused.__init__Nr"rrrrrusc@seZdZdZdS)r	z'The SMTP server didn't accept the data.Nrrrrrr	�sc@seZdZdZdS)r
z&Error during connection establishment.Nrrrrrr
�sc@seZdZdZdS)rz"The server refused our HELO reply.Nrrrrrr�sc@seZdZdZdS)rzvAuthentication error.

    Most probably the server didn't accept the username/password
    combination provided.
    Nrrrrrr�scCs>tj�|�\}}||fdkr6|���d�r.|Sd|Sd|S)z�Quote a subset of the email addresses defined by RFC 821.

    Should be able to handle anything email.utils.parseaddr can handle.
    ��r&�<z<%s>)�email�utils�	parseaddr�strip�
startswith�Z
addrstringZdisplayname�addrrrrr
�scCs$tj�|�\}}||fdkr |S|S)Nr%)r(r)r*r-rrr�
_addr_only�sr/c	Cst�ddt�dt|��S)z�Quote data for email.

    Double leading '.', and change Unix newline '\n', or Mac '\r' into
    Internet CRLF end-of-line.
    z(?m)^\.z..�(?:\r\n|\n|\r(?!\n))��re�sub�CRLF��datarrrr�s�cCst�dd|�S)Ns(?m)^\.s..)r2r3)Zbindatarrr�_quote_periods�sr7cCst�dt|�S)Nr0r1r5rrr�	_fix_eols�sr8FTc@szeZdZdZdZdZdZdZdZdZ	dZ
eZddde
jdfdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�ZdNdd�Zdd�ZdOdd�Zdd�ZdPdd�ZdQdd�ZdRdd �Zd!d"�ZdSd#d$�Zd%d&�Zd'd(�Zd)d*�Z dTd,d-�Z!dUd.d/�Z"d0d1�Z#d2d3�Z$e$Z%d4d5�Z&d6d7�Z'd8d9�d:d;�Z(dVd<d=�Z)dWd>d?�Z*dXd@dA�Z+d8d9�dBdC�Z,dYdDdE�Z-dZdFdG�Z.d[dHdI�Z/dJdK�Z0dLdM�Z1dS)\ra�This class manages a connection to an SMTP or ESMTP server.
    SMTP Objects:
        SMTP objects have the following attributes:
            helo_resp
                This is the message given by the server in response to the
                most recent HELO command.

            ehlo_resp
                This is the message given by the server in response to the
                most recent EHLO command. This is usually multiline.

            does_esmtp
                This is a True value _after you do an EHLO command_, if the
                server supports ESMTP.

            esmtp_features
                This is a dictionary, which, if the server supports ESMTP,
                will _after you do an EHLO command_, contain the names of the
                SMTP service extensions this server supports, and their
                parameters (if any).

                Note, all extension names are mapped to lower case in the
                dictionary.

        See each method's docstrings for details.  In general, there is a
        method of the same name to perform each SMTP command.  There is also a
        method called 'sendmail' that will do an entire mail transaction.
        rN�ehlor&c
Cs�||_||_i|_d|_||_d|_|rR|�||�\}}|dkrR|��t||��|dk	rb||_	nPt
��}d|krz||_	n8d}	zt
�t
�
��}	Wnt
jk
r�YnXd|	|_	dS)aInitialize a new instance.

        If specified, `host` is the name of the remote host to which to
        connect.  If specified, `port` specifies the port to which to connect.
        By default, smtplib.SMTP_PORT is used.  If a host is specified the
        connect method is called, and if it returns anything other than a
        success code an SMTPConnectError is raised.  If specified,
        `local_hostname` is used as the FQDN of the local host in the HELO/EHLO
        command.  Otherwise, the local hostname is found using
        socket.getfqdn(). The `source_address` parameter takes a 2-tuple (host,
        port) for the socket to bind to as its source address before
        connecting. If the host is '' and port is 0, the OS default behavior
        will be used.

        �asciir��N�.z	127.0.0.1z[%s])�_host�timeout�esmtp_features�command_encoding�source_address�_auth_challenge_count�connect�closer
�local_hostname�socketZgetfqdnZ
gethostbynameZgethostnameZgaierror)
r�host�portrEr>rArr Zfqdnr.rrrr!�s,
z
SMTP.__init__cCs|Srr�rrrr�	__enter__szSMTP.__enter__cGsNz>z$|�d�\}}|dkr$t||��Wntk
r:YnXW5|��XdS)NZQUIT��)rD�docmdrr)rrr�messagerrr�__exit__s
z
SMTP.__exit__cCs
||_dS)z�Set the debug output level.

        A non-false value results in debug messages for connection and for all
        messages sent to and received from the server.

        N)�
debuglevel)rrOrrr�set_debuglevel"szSMTP.set_debuglevelcGs@|jdkr,ttj����f|�dtji�nt|dtji�dS)N��file)rO�print�datetimeZnow�time�sys�stderr�rrrrr�_print_debug+s
"zSMTP._print_debugcCs2|jdkr|�d||f|j�t�||f||j�S)Nrzconnect: to)rOrYrArF�create_connection)rrGrHr>rrr�_get_socket1s

�zSMTP._get_socket�	localhostcCs�|r
||_|s||�d�|�d�kr||�d�}|dkr||d|�||dd�}}zt|�}Wntk
rztd��YnX|s�|j}t�d|||�|�	|||j
�|_d|_|�
�\}}|jdkr�|�dt|��||fS)apConnect to a host on a given port.

        If the hostname ends with a colon (`:') followed by a number, and
        there is no port specified, that suffix will be stripped off and the
        number interpreted as the port number to use.

        Note: This method is automatically invoked by __init__, if a host is
        specified during instantiation.

        �:rNrQznonnumeric portzsmtplib.connect�connect:)rA�find�rfind�int�
ValueError�OSError�default_portrV�auditr[r>�sockrR�getreplyrOrY�repr)rrGrHrA�irr rrrrC9s&

zSMTP.connectcCs�|jdkr|�dt|��|jr|t|t�r6|�|j�}t�	d||�z|j�
|�Wq�tk
rx|��t
d��Yq�Xnt
d��dS)zSend `s' to the server.rzsend:zsmtplib.send�Server not connectedzplease run connect() firstN)rOrYrhrf�
isinstance�str�encoder@rVreZsendallrcrDr)r�srrr�sendZs

z	SMTP.sendcCsd|dkr|}n|�d|��}d|ks,d|krN|�dd��dd�}td|����|�|�t���dS)	zSend a command to the server.r&� �
�
z\nz\rz=command and arguments contain prohibited newline characters: N)�replacerbror4)r�cmdrrnrrr�putcmdms�zSMTP.putcmdc
CsPg}|jdkr|j�d�|_z|j�td�}Wn:tk
rj}z|��tdt|���W5d}~XYnX|s�|��td��|j	dkr�|�
dt|��t|�tkr�|��t
dd	��|�|d
d��d��|dd�}zt|�}Wn tk
�rd
}Y�q YnX|dd
�dkr�q qd�|�}|j	dk�rH|�
d||f�||fS)a�Get a reply from the server.

        Returns a tuple consisting of:

          - server response code (e.g. '250', or such, if all goes well)
            Note: returns -1 if it can't read response code.

          - server response string corresponding to response code (multiline
            responses are converted to a single, multiline string).

        Raises SMTPServerDisconnected if end-of-file is reached.
        N�rbrQz Connection unexpectedly closed: zConnection unexpectedly closedrzreply:i�zLine too long.�s 	
�����-�
zreply: retcode (%s); Msg: %a)rRrfZmakefile�readline�_MAXLINErcrDrrlrOrYrh�lenr�appendr+rarb�join)r�resp�line�erZerrcode�errmsgrrrrgzs>

�


z
SMTP.getreplycCs|�||�|��S)z-Send a command, and return its response code.�rurg)rrtrrrrrL�sz
SMTP.docmdcCs,|�d|p|j�|��\}}||_||fS)zwSMTP 'helo' command.
        Hostname to send for this command defaults to the FQDN of the local
        host.
        �helo)rurErg�	helo_resp)r�namerr rrrr��sz	SMTP.heloc
Cs.i|_|�|j|p|j�|��\}}|dkrJt|�dkrJ|��td��||_|dkr`||fSd|_	|j�
d��d�}|d=|D]�}t�
|�}|r�|j�dd	�d
|�d�d|jd<q�t�
d|�}|r�|�d���}|j|�d�d
���}	|dk�r|j�|d	�d
|	|j|<q�|	|j|<q�||fS)zx SMTP 'ehlo' command.
        Hostname to send for this command defaults to the FQDN of the local
        host.
        ryrrj�rQzlatin-1rr�authr&rpz((?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*) ?�featureN)r?ru�ehlo_msgrErgr~rDr�	ehlo_resp�
does_esmtp�decode�split�
OLDSTYLE_AUTH�match�get�groupsr2�group�lower�string�endr+)
rr�rr r��eachZ
auth_match�mr�Zparamsrrrr9�sB
��

��z	SMTP.ehlocCs|��|jkS)z7Does the server support a given SMTP service extension?)r�r?)r�optrrr�has_extn�sz
SMTP.has_extncCs|�d|�|��dS)z;SMTP 'help' command.
        Returns help text from server.�helprQr�rXrrrr��sz	SMTP.helpcCsd|_|�d�S)z&SMTP 'rset' command -- resets session.r:�rset)r@rLrIrrrr��sz	SMTP.rsetcCs&z|��Wntk
r YnXdS)aInternal 'rset' command which ignores any SMTPServerDisconnected error.

        Used internally in the library, since the server disconnected error
        should appear to the application when the *next* command is issued, if
        we are doing an internal "safety" reset.
        N)r�rrIrrr�_rset�sz
SMTP._rsetcCs
|�d�S)z-SMTP 'noop' command -- doesn't do anything :>�noop)rLrIrrrr�	sz	SMTP.nooprcCshd}|rH|jrHtdd�|D��r:|�d�r2d|_ntd��dd�|�}|�dd	t|�|f�|��S)
a8SMTP 'mail' command -- begins mail xfer session.

        This method may raise the following exceptions:

         SMTPNotSupportedError  The options parameter includes 'SMTPUTF8'
                                but the SMTPUTF8 extension is not supported by
                                the server.
        r&css|]}|��dkVqdS)�smtputf8N)r�)�.0�xrrr�	<genexpr>szSMTP.mail.<locals>.<genexpr>r�zutf-8z SMTPUTF8 not supported by serverrp�mailz	FROM:%s%s)	r��anyr�r@rr�rur
rg)rr#�options�
optionlistrrrr�
s	

�z	SMTP.mailcCs<d}|r|jrdd�|�}|�ddt|�|f�|��S)z;SMTP 'rcpt' command -- indicates 1 recipient for this mail.r&rp�rcptzTO:%s%s)r�r�rur
rg)rZrecipr�r�rrrr�"s

z	SMTP.rcptcCs�|�d�|��\}}|jdkr0|�d||f�|dkrDt||��n|t|t�r\t|��d�}t	|�}|dd�t
kr||t
}|dt
}|�|�|��\}}|jdkr�|�d||f�||fSdS)	a�SMTP 'DATA' command -- sends message data to server.

        Automatically quotes lines beginning with a period per rfc821.
        Raises SMTPDataError if there is an unexpected reply to the
        DATA command; the return value from this method is the final
        response code received when the all data is sent.  If msg
        is a string, lone '\r' and '\n' characters are converted to
        '\r\n' characters.  If msg is bytes, it is transmitted as is.
        r6rzdata:ibr:���N�.)rurgrOrYr	rkrlr8rmr7�bCRLFro)rr r�repl�qrrrr6*s"





z	SMTP.datacCs|�dt|��|��S)z5SMTP 'verify' command -- checks for address validity.�vrfy�rur/rg�rZaddressrrr�verifyGszSMTP.verifycCs|�dt|��|��S)z.SMTP 'expn' command -- expands a mailing list.�expnr�r�rrrr�Nsz	SMTP.expncCsb|jdkr^|jdkr^d|��dkr0dks^n|��\}}d|krRdks^nt||��dS)abCall self.ehlo() and/or self.helo() if needed.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
        N��ri+)r�r�r9r�r)rrr�rrr�ehlo_or_helo_if_neededUs
zSMTP.ehlo_or_helo_if_neededT��initial_response_okc	Cs�|��}|r|�nd}|dk	rPt|�d�dd�}|�d|d|�\}}d|_n|�d|�\}}d|_|d	kr�|jd7_t�|�}t||��d�dd�}|�|�\}}|jtkrftd
t	||f���qf|dkr�||fSt
||��dS)a�Authentication command - requires response processing.

        'mechanism' specifies which authentication mechanism is to
        be used - the valid values are those listed in the 'auth'
        element of 'esmtp_features'.

        'authobject' must be a callable object taking a single argument:

                data = authobject(challenge)

        It will be called to process the server's challenge response; the
        challenge argument it is passed will be a bytes.  It should return
        an ASCII string that will be base64 encoded and sent to the server.

        Keyword arguments:
            - initial_response_ok: Allow sending the RFC 4954 initial-response
              to the AUTH command, if the authentication methods supports it.
        Nr:r&)ZeolZAUTHrprQriNz4Server AUTH mechanism infinite loop. Last response: ���i�)�upper�
encode_base64rmrLrB�base64Zdecodebytes�
_MAXCHALLENGErrhr)	rZ	mechanismZ
authobjectr�Zinitial_responseZresponserr��	challengerrrr�fs2
�

��z	SMTP.authcCs0|dkrdS|jdt�|j�d�|d���S)zh Authobject to use with CRAM-MD5 authentication. Requires self.user
        and self.password to be set.Nrpr:Zmd5)�user�hmacZHMAC�passwordrmZ	hexdigest�rr�rrr�
auth_cram_md5�s
�zSMTP.auth_cram_md5cCsd|j|jfS)ze Authobject to use with PLAIN authentication. Requires self.user and
        self.password to be set.z%s%s)r�r�r�rrr�
auth_plain�szSMTP.auth_plaincCs"|dks|jdkr|jS|jSdS)ze Authobject to use with LOGIN authentication. Requires self.user and
        self.password to be set.N�)rBr�r�r�rrr�
auth_login�szSMTP.auth_logincs�|��|�d�std��|jd���dddg}�fdd�|D�}|sPtd��|||_|_|D]t}d	|���	d
d�}z4|j
|t||�|d�\}}	|d
kr�||	fWSWqbtk
r�}
z|
}W5d}
~
XYqbXqb|�dS)awLog in on an SMTP server that requires authentication.

        The arguments are:
            - user:         The user name to authenticate with.
            - password:     The password for the authentication.

        Keyword arguments:
            - initial_response_ok: Allow sending the RFC 4954 initial-response
              to the AUTH command, if the authentication methods supports it.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.

        This method will return normally if the authentication was successful.

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
         SMTPAuthenticationError  The server didn't accept the username/
                                  password combination.
         SMTPNotSupportedError    The AUTH command is not supported by the
                                  server.
         SMTPException            No suitable authentication method was
                                  found.
        r�z,SMTP AUTH extension not supported by server.zCRAM-MD5ZPLAINZLOGINcsg|]}|�kr|�qSrr)r�r��Zadvertised_authlistrr�
<listcomp>�s�zSMTP.login.<locals>.<listcomp>z(No suitable authentication method found.Zauth_�-�_r�r�N)
r�r�rr?r�rr�r�r�rsr��getattrr)rr�r�r�Zpreferred_authsZauthlistZ
authmethodZmethod_namerr�r�Zlast_exceptionrr�r�login�s0
�
�
z
SMTP.logincCs�|��|�d�std��|�d�\}}|dkr�ts<td��|dk	rT|dk	rTtd��|dk	rl|dk	rltd��|dk	s||dk	r�d	dl}|�d
t	d�|dkr�t
j||d�}|j|j
|jd
�|_
d|_d|_d|_i|_d	|_n
t||��||fS)a�Puts the connection to the SMTP server into TLS mode.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.

        If the server supports TLS, this will encrypt the rest of the SMTP
        session. If you provide the keyfile and certfile parameters,
        the identity of the SMTP server and client can be checked. This,
        however, depends on whether the socket module really checks the
        certificates.

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
        �starttlsz+STARTTLS extension not supported by server.ZSTARTTLSr;z&No SSL support included in this PythonN�4context and keyfile arguments are mutually exclusive�5context and certfile arguments are mutually exclusiver�Akeyfile and certfile are deprecated, use a custom context insteadr���certfile�keyfile�Zserver_hostname)r�r�rrL�	_have_ssl�RuntimeErrorrb�warnings�warn�DeprecationWarning�ssl�_create_stdlib_context�wrap_socketrfr=rRr�r�r?r�r)rr�r��contextr�Zreplyr�rrrr��sB
����
z
SMTP.starttlscCs^|��g}t|t�r$t|��d�}|jrZ|�d�rF|�dt|��|D]}|�|�qJ|�	||�\}}	|dkr�|dkr�|�
�n|��t||	|��i}
t|t�r�|g}|D]H}|�
||�\}}	|dkr�|dkr�||	f|
|<|dkr�|�
�t|
��q�t|
�t|�k�r|��t|
��|�|�\}}	|dk�rZ|dk�rH|�
�n|��t||	��|
S)a|This command performs an entire mail transaction.

        The arguments are:
            - from_addr    : The address sending this mail.
            - to_addrs     : A list of addresses to send this mail to.  A bare
                             string will be treated as a list with 1 address.
            - msg          : The message to send.
            - mail_options : List of ESMTP options (such as 8bitmime) for the
                             mail command.
            - rcpt_options : List of ESMTP options (such as DSN commands) for
                             all the rcpt commands.

        msg may be a string containing characters in the ASCII range, or a byte
        string.  A string is encoded to bytes using the ascii codec, and lone
        \r and \n characters are converted to \r\n characters.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.  If the server does ESMTP, message size
        and each of the specified options will be passed to it.  If EHLO
        fails, HELO will be tried and ESMTP options suppressed.

        This method will return normally if the mail is accepted for at least
        one recipient.  It returns a dictionary, with one entry for each
        recipient that was refused.  Each entry contains a tuple of the SMTP
        error code and the accompanying error message sent by the server.

        This method may raise the following exceptions:

         SMTPHeloError          The server didn't reply properly to
                                the helo greeting.
         SMTPRecipientsRefused  The server rejected ALL recipients
                                (no mail was sent).
         SMTPSenderRefused      The server didn't accept the from_addr.
         SMTPDataError          The server replied with an unexpected
                                error code (other than a refusal of
                                a recipient).
         SMTPNotSupportedError  The mail_options parameter includes 'SMTPUTF8'
                                but the SMTPUTF8 extension is not supported by
                                the server.

        Note: the connection will be open even after an exception is raised.

        Example:

         >>> import smtplib
         >>> s=smtplib.SMTP("localhost")
         >>> tolist=["one@one.org","two@two.org","three@three.org","four@four.org"]
         >>> msg = '''\
         ... From: Me@my.org
         ... Subject: testin'...
         ...
         ... This is a test '''
         >>> s.sendmail("me@my.org",tolist,msg)
         { "three@three.org" : ( 550 ,"User unknown" ) }
         >>> s.quit()

        In the above example, the message was accepted for delivery to three
        of the four addresses, and one was rejected, with the error code
        550.  If all addresses are accepted, then the method will return an
        empty dictionary.

        r:�sizezsize=%dr�i��)r�rkrlr8rmr�r�rr~r�rDr�rr�rr6r	)r�	from_addr�to_addrsr �mail_options�rcpt_optionsZ
esmtp_optsZoptionrr�Zsenderrsr�rrr�sendmail&sF@








z
SMTP.sendmailc	Cs�|��|�d�}|dkr d}nt|�dkr2d}ntd��|dkr||d|krZ||dn
||d}tj�|g�d	d}|dkr�d
d�||d||d
||dfD�}dd�tj�|�D�}t�|�}	|	d
=|	d=d}
zd�|f|���	d�Wn.t
k
�r(|�d��s td��d}
YnXt
���R}|
�r^tjj||jjdd�d�}|d�}ntj�|�}|j|	dd�|��}
W5QRX|�|||
||�S)a~Converts message to a bytestring and passes it to sendmail.

        The arguments are as for sendmail, except that msg is an
        email.message.Message object.  If from_addr is None or to_addrs is
        None, these arguments are taken from the headers of the Message as
        described in RFC 2822 (a ValueError is raised if there is more than
        one set of 'Resent-' headers).  Regardless of the values of from_addr and
        to_addr, any Bcc field (or Resent-Bcc field, when the Message is a
        resent) of the Message object won't be transmitted.  The Message
        object is then serialized using email.generator.BytesGenerator and
        sendmail is called to transmit the message.  If the sender or any of
        the recipient addresses contain non-ASCII and the server advertises the
        SMTPUTF8 capability, the policy is cloned with utf8 set to True for the
        serialization, and SMTPUTF8 and BODY=8BITMIME are asserted on the send.
        If the server does not support SMTPUTF8, an SMTPNotSupported error is
        raised.  Otherwise the generator is called without modifying the
        policy.

        zResent-DateNr&rQzResent-z0message has more than one 'Resent-' header blockZSender�FromrcSsg|]}|dk	r|�qSrr)r��frrrr��s�z%SMTP.send_message.<locals>.<listcomp>�ToZBccZCccSsg|]}|d�qS)rQr)r��arrrr��sz
Resent-BccFr:r�z�One or more source or delivery addresses require internationalized email support, but the server does not advertise the required SMTPUTF8 capabilityT)�utf8)�policy�SMTPUTF8�
BODY=8BITMIMEr)�linesep)r�r�)r�Zget_allr~rbr(r)Zgetaddresses�copyr�rm�UnicodeEncodeErrorr�r�io�BytesIO�	generatorZBytesGeneratorr�ZcloneZflatten�getvaluer�)rr r�r�r�r�ZresentZ
header_prefixZaddr_fieldsZmsg_copyZ
internationalZbytesmsg�gZflatmsgrrr�send_message�sX

�
�

�
�

�
�zSMTP.send_messagecCs<z|j}d|_|r|��W5|j}d|_|r6|��XdS)z(Close the connection to the SMTP server.N)rfrDrR)rrfrRrrrrD�sz
SMTP.closecCs.|�d�}d|_|_i|_d|_|��|S)zTerminate the SMTP session.�quitNF)rLr�r�r?r�rD)r�resrrrr��s
z	SMTP.quit)r\rN)r&)r&)r&)r&)r&)r)r)N)N)N)NNN)rr)NNrr)2rrrrrOrfrRr�r�r�r��	SMTP_PORTrdrF�_GLOBAL_DEFAULT_TIMEOUTr!rJrNrPrYr[rCrorurgrLr�r9r�r�r�r�r�r�r�r6r�r�r�r�r�r�r�r�r�r�r�r�rDr�rrrrr�sh�
0
	
!

1



3


0
	

B
8�
h�
M
c@s8eZdZdZeZdddddejddfdd�Zdd�Z	dS)	�SMTP_SSLa� This is a subclass derived from SMTP that connects over an SSL
        encrypted socket (to use this class you need a socket module that was
        compiled with SSL support). If host is not specified, '' (the local
        host) is used. If port is omitted, the standard SMTP-over-SSL port
        (465) is used.  local_hostname and source_address have the same meaning
        as they do in the SMTP class.  keyfile and certfile are also optional -
        they can contain a PEM formatted private key and certificate chain file
        for the SSL connection. context also optional, can contain a
        SSLContext, and is an alternative to keyfile and certfile; If it is
        specified both keyfile and certfile must be None.

        r&rNc	
Cs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}	|	�dtd�||_||_|dkrxtj||d�}||_t	�
||||||�dS)Nr�r�rr�r�r�)rbr�r�r�r�r�r�r�r�rr!)
rrGrHrEr�r�r>rAr�r�rrrr!s(���zSMTP_SSL.__init__cCsD|jdkr|�d||f�t�||f||j�}|jj||jd�}|S)Nrr^r�)rOrYrFrZrAr�r�r=)rrGrHr>Z
new_socketrrrr[s
��zSMTP_SSL._get_socket)
rrrr�
SMTP_SSL_PORTrdrFr�r!r[rrrrr��s
�
r�i�c@s0eZdZdZdZdeddfdd�Zdd	d
�ZdS)�LMTPa�LMTP - Local Mail Transfer Protocol

    The LMTP protocol, which is very similar to ESMTP, is heavily based
    on the standard SMTP client. It's common to use Unix sockets for
    LMTP, so our connect() method must support that as well as a regular
    host:port server.  local_hostname and source_address have the same
    meaning as they do in the SMTP class.  To specify a Unix socket,
    you must use an absolute path as the host, starting with a '/'.

    Authentication is supported, using the regular SMTP mechanism. When
    using a Unix socket, LMTP generally don't support or require any
    authentication, but your mileage might vary.Zlhlor&NcCstj|||||d�dS)zInitialize a new instance.)rErAN)rr!)rrGrHrErArrrr!;s�z
LMTP.__init__r\rcCs�|ddkrtj||||d�Sz(t�tjtj�|_d|_|j�|�WnBtk
r�|jdkrl|�	d|�|jr||j�
�d|_�YnX|��\}}|jdkr�|�	d|�||fS)z=Connect to the LMTP daemon, on either a Unix or a TCP socket.r�/)rANz
connect fail:r^)rrCrFZAF_UNIXZSOCK_STREAMrfrRrcrOrYrDrg)rrGrHrArr rrrrCAs"


zLMTP.connect)r\rN)rrrrr��	LMTP_PORTr!rCrrrrr�+s
�
r��__main__cCs(tj�|d�tj��tj����S)Nz: )rV�stdout�write�flush�stdinr|r+)�promptrrrr[s
rr�r��,zEnter message, end with ^D:r&zMessage length is %dr\rQ)ArrFr�r2Zemail.utilsr(Z
email.messageZemail.generatorr�r�r�rTrVZemail.base64mimerr��__all__r�r�r4r�r}r��compile�Ir�rcrrrrrrr	r
rrr
r/rr7r8r��ImportErrorr�rr�rr�r�rrZfromaddrr�ZtoaddrsrSr rr|r�r~ZserverrPr�r�rrrr�<module>s�)�


	
:0
/


stringprep.cpython-38.opt-1.pyc000064400000025321150335716500012340 0ustar00U

e5du2��@s�dZddlmZdd�Zeddddd	d
ddd
ddgeedd���Zdd�Zddddddddddddd d!d"d#d$d%d&d'dd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCd<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdDdEdFdGdHdIdJdKdLdMdNdOdPdMddQdRdSdTdUdRdVddWdXdYddZd[d\d]d^d_d`dad^dbdcdddedfdgdgdgdhdhdidjdkdldmdndndndodpdqdrdrdsdcdtdudvdwd%dxdydzd{d|d}d~dd�d�d�d�d�d�d�d�d�d�d�d�d|d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dcdxd�d�d�djd�dldmdd�d�d�d�d�d�drd�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dsdxdtdud�d�d�didvdjd�dldmdd�d�d�d�d�d�d�dsdxdtdud�dhd�d�didvd�dd�d�d�d�d�d�d�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�dsdcdxdtdud�dgdhd�d�didvdjd�dldmdndd�d�d�d�d�d�drd�ddwd�d(d�d�d dd&d�dd�d�d�d%d'd dd�d!d$d�d�d�dd�ddwd�d(d�d�d dd&d�dd�d�d�d%d'd dd�d!d$d�d�d�dd�ddwd�d(d�d�d dd&d�dd�d�d�d%d'd dd�d!d$d�d�d�dd�ddwd�d(d�d�d dd&d�dd�d�d�d%d'd dd�d!d$d�d�d�dd�ddwd�d(d�d�d dd&d�dd�d�d�d%d'd dd�d!d$d�d�d�ddʐ��Z	d�d̄Z
d�d΄Zd�dЄZd�d҄Z
d�dԄZd�dքZed�d�d�dd
d�d�dgeedd܃�eed�dރ�eed�d��eed�d���Zd�d�Zd�d�Zd�d�Zd�d�Zd�d�Zeed�d��Zd�d�Zeed�d��Zd�d�Zed�d�d�d�geed�d���eed�dރ��Zd�d��Zed�geed�d����Zd��d�Z�d�d�Z�d�d�Z�dS(z�Library that exposes various tables found in the StringPrep RFC 3454.

There are two kinds of tables: sets, for which a member test is provided,
and mappings, for which a mapping function is provided.
�)�	ucd_3_2_0cCsBt�|�dkrdSt|�}d|kr.dkr6nndS|d@dkS)NZCnF�������r)�unicodedata�category�ord��code�c�r�"/usr/lib64/python3.8/stringprep.py�in_table_a1sr�iOiiii
i i i
 i` i��i�i�cCst|�tkS�N)r
�b1_set�rrrr�in_table_b1sruμZssui̇uʼn�suǰuιu ιuΐuΰuσuβuθuυuύuϋuφuπuκuρuεuեւuẖuẗuẘuẙuaʾuṡuὐuὒuὔuὖuἀιuἁιuἂιuἃιuἄιuἅιuἆιuἇιuἠιuἡιuἢιuἣιuἤιuἥιuἦιuἧιuὠιuὡιuὢιuὣιuὤιuὥιuὦιuὧιuὰιuαιuάιuᾶuᾶιuὴιuηιuήιuῆuῆιuῒuῖuῗuῢuῤuῦuῧuὼιuωιuώιuῶuῶιZrsr
u°cuɛu°f�h�i�l�nZno�p�q�rZsmZtelZtm�z�b�e�f�muγ�dZhpaZauZovZpaZnauμaZmaZkaZkbZmbZgbZpfZnfuμf�hzZkhzZmhzZghzZthzZkpaZmpaZgpaZpvZnvuμvZmvZkvZpwZnwuμwZmw�kwukωumωZbquc∕kgzco.ZdbZgyZhpZkkZkmZphZppmZprZsv�wbZffZfiZflZffiZffl�stuմնuմեuմիuվնuմխ�a�g�j�k�o�t�u�v�w�x�yuαuδuζuηuλuνuξuοuτuχuψuω(����i0iIii�iEizi�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�iPiRiTiVi�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i� i!i!i!i	!i!i!i
!i!i!i!i!i!i!i!i!i!i!i !i!!i"!i$!i(!i,!i-!i0!i1!i3!i>!i?!iE!iq3is3iu3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i	�i
�i�i�i
�i�i�i�i�i�i�i�i�i�i�i�i�i4�i5�i6�i7�i8�i9�i:�i;�i<�i=�i>�i?�i@�iA�iB�iC�iD�iE�iF�iG�iH�iI�iJ�iK�iL�iM�ih�ii�ij�ik�il�im�in�io�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i�i�i�i�i	�i
�i
�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i8�i9�i;�i<�i=�i>�i@�iA�iB�iC�iD�iF�iJ�iK�iL�iM�iN�iO�iP�il�im�in�io�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i�i	�i
�i�i�i
�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i �i!�i<�i=�i>�i?�i@�iA�iB�iC�iD�iE�iF�iG�iH�iI�iJ�iK�iL�iM�iN�iO�iP�iQ�iR�iS�iT�iU�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i
�i�i�i�i�i �i!�i"�i#�i$�i%�i&�i'�i(�i)�i*�i+�i,�i-�i.�i/�i0�i1�i2�i3�i4�iG�iV�iW�iX�iY�iZ�i[�i\�i]�i^�i_�i`�ia�ib�ic�id�ie�if�ig�ih�ii�ij�ik�il�im�in�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��cCs"t�t|��}|dk	r|S|��Sr)�
b3_exceptions�getr
�lower)rrrrr�map_table_b3�sr8cCsHt|�}t�d|�}d�dd�|D��}t�d|�}||kr@|S|SdS)NZNFKC�cSsg|]}t|��qSr)r8)�.0Zchrrr�
<listcomp>�sz map_table_b2.<locals>.<listcomp>)r8rZ	normalize�join)r(ZalrZblr
rrr�map_table_b2�sr=cCs|dkS)N� rrrrr�in_table_c11�sr?cCst�|�dko|dkS)N�Zsr>�rr	rrrr�in_table_c12�srBcCst�|�dkS)Nr@rArrrr�in_table_c11_c12�srCcCst|�dkot�|�dkS)N��Cc)r
rr	rrrr�in_table_c21�srFi�iii( i) id ij ip i��i��is�i{�cCs.t|�}|dkrdSt�|�dkr&dS|tkS)NrDFrET)r
rr	�c22_specialsrrrr�in_table_c22�srHcCst�|�dkpt|�tkS)NrE)rr	r
rGrrrr�in_table_c21_c22�s
�rIcCst�|�dkS)NZCorArrrr�in_table_c3�srJcCs0t|�}|dkrdS|dkr dSt|�d@dkS)NrFrTrr)r
rrrr�in_table_c4�srKcCst�|�dkS)NZCsrArrrr�in_table_c5�srLrcCst|�tkSr)r
�c6_setrrrr�in_table_c6�srNi�/i�/cCst|�tkSr)r
�c7_setrrrr�in_table_c7�srPi@iAi i i* i/ cCst|�tkSr)r
�c8_setrrrr�in_table_c8srRii i�cCst|�tkSr)r
�c9_setrrrr�in_table_c9srTcCst�|�dkS)N)�RZAL�rZ
bidirectionalrrrr�in_table_d1srWcCst�|�dkS)N�LrVrrrr�in_table_d2srYN) �__doc__rrr�set�list�rangerrr5r8r=r?rBrCrFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrWrYrrrr�<module>sN,��&P,
_collections_abc.cpython-38.opt-2.pyc000064400000056204150335716500013432 0ustar00U

e5d�e�@spddlmZmZddlZddddddd	d
ddd
ddddddddddddddgZdZeed��Zeee	���Z
eei����Zeei�
���Zeei����Zeeg��Zeeeg���Zeeed���Zeeedd>���Zeee���Zeed ��Zeed!��Zeee���Zei���Zei�
��Zei���Zeej �Z!ed"d#���Z"d$d%�Z#e#�Z#ee#�Z$e#�%�[#d&d'�Z&e&�Z&ee&�Z'[&d(d)�Z(Gd*d�ded+�Z)Gd,d�ded+�Z*Gd-d�de*�Z+e+�,e$�Gd.d�ded+�Z-Gd/d�de-�Z.Gd0d�de.�Z/e/�,e'�Gd1d	�d	ed+�Z0Gd2d
�d
e0�Z1e1�,e�e1�,e
�e1�,e�e1�,e�e1�,e�e1�,e�e1�,e�e1�,e�e1�,e�e1�,e�e1�,e�e1�,e�e1�,e�Gd3d�de0�Z2Gd4d�de1�Z3e3�,e"�Gd5d
�d
ed+�Z4Gd6d�ded+�Z5Gd7d�de4e0e5�Z6Gd8d�ded+�Z7Gd9d�de6�Z8e8�,e9�Gd:d�de8�Z:e:�,e�Gd;d�de6�Z;e;�,e!�Gd<d�de4�Z<Gd=d�de<e8�Z=e=�,e�Gd>d�de<e8�Z>e>�,e�Gd?d�de<e6�Z?e?�,e�Gd@d�de;�Z@e@�,eA�GdAd�de2e6�ZBeB�,eC�eB�,eD�eB�,e�eB�,eE�GdBd�deB�ZFeF�,eG�eF�,e	�GdCd�deB�ZHeH�,eI�eH�,e	�dS)D�)�ABCMeta�abstractmethodN�	Awaitable�	Coroutine�
AsyncIterable�
AsyncIterator�AsyncGenerator�Hashable�Iterable�Iterator�	Generator�
Reversible�Sized�	Container�Callable�
Collection�Set�
MutableSet�Mapping�MutableMapping�MappingView�KeysView�	ItemsView�
ValuesView�Sequence�MutableSequence�
ByteStringzcollections.abc��i���ccsdVS�Nr r r r �(/usr/lib64/python3.8/_collections_abc.py�<lambda>8rr#c�sdSr!r r r r r"�_coro:rr$cCs
dVdSr!r r r r r"�_ag@rr%cGsN|j}|D]>}|D],}||jkr|j|dkr:tSq
qtSq
dS)NT)�__mro__�__dict__�NotImplemented)�C�methods�mro�method�Br r r"�_check_methodsHs

r.c@s(eZdZdZedd��Zedd��ZdS)r	r cCsdS�Nrr ��selfr r r"�__hash__XszHashable.__hash__cCs|tkrt|d�StS)Nr2)r	r.r(��clsr)r r r"�__subclasshook__\s
zHashable.__subclasshook__N)�__name__�
__module__�__qualname__�	__slots__rr2�classmethodr5r r r r"r	Ts

)�	metaclassc@s(eZdZdZedd��Zedd��ZdS)rr ccs
dVdSr!r r0r r r"�	__await__gszAwaitable.__await__cCs|tkrt|d�StS)Nr<)rr.r(r3r r r"r5ks
zAwaitable.__subclasshook__N)r6r7r8r9rr<r:r5r r r r"rcs

c@s>eZdZdZedd��Zeddd��Zdd�Zed	d
��Z	dS)rr cCst�dSr!��
StopIteration�r1�valuer r r"�sendvszCoroutine.sendNcCs4|dkr|dkr|�|�}|dk	r,|�|�}|�dSr!��with_traceback�r1�typ�val�tbr r r"�throw}s
zCoroutine.throwc	Cs4z|�t�Wnttfk
r&Yn
Xtd��dS)Nzcoroutine ignored GeneratorExit�rH�
GeneratorExitr>�RuntimeErrorr0r r r"�close�s
zCoroutine.closecCs|tkrt|dddd�StS)Nr<rArHrL)rr.r(r3r r r"r5�szCoroutine.__subclasshook__)NN)
r6r7r8r9rrArHrLr:r5r r r r"rrs

c@s(eZdZdZedd��Zedd��ZdS)rr cCst�Sr!)rr0r r r"�	__aiter__�szAsyncIterable.__aiter__cCs|tkrt|d�StS)NrM)rr.r(r3r r r"r5�s
zAsyncIterable.__subclasshook__N)r6r7r8r9rrMr:r5r r r r"r�s

c@s0eZdZdZedd��Zdd�Zedd��ZdS)	rr c�st�dSr!��StopAsyncIterationr0r r r"�	__anext__�szAsyncIterator.__anext__cCs|Sr!r r0r r r"rM�szAsyncIterator.__aiter__cCs|tkrt|dd�StS)NrPrM)rr.r(r3r r r"r5�szAsyncIterator.__subclasshook__N)	r6r7r8r9rrPrMr:r5r r r r"r�s
c@sFeZdZdZdd�Zedd��Zed
dd��Zd	d
�Ze	dd��Z
dS)rr c�s|�d�IdHSr!)�asendr0r r r"rP�szAsyncGenerator.__anext__c�st�dSr!rNr?r r r"rQ�szAsyncGenerator.asendNc�s4|dkr|dkr|�|�}|dk	r,|�|�}|�dSr!rBrDr r r"�athrow�s
zAsyncGenerator.athrowc	�s:z|�t�IdHWnttfk
r,Yn
Xtd��dS)Nz,asynchronous generator ignored GeneratorExit)rRrJrOrKr0r r r"�aclose�s
zAsyncGenerator.aclosecCs|tkrt|ddddd�StS)NrMrPrQrRrS)rr.r(r3r r r"r5�s�zAsyncGenerator.__subclasshook__)NN)r6r7r8r9rPrrQrRrSr:r5r r r r"r�s

c@s(eZdZdZedd��Zedd��ZdS)r
r ccsdSr!r r0r r r"�__iter__�szIterable.__iter__cCs|tkrt|d�StS)NrT)r
r.r(r3r r r"r5�s
zIterable.__subclasshook__N)r6r7r8r9rrTr:r5r r r r"r
�s

c@s0eZdZdZedd��Zdd�Zedd��ZdS)	rr cCst�dSr!r=r0r r r"�__next__szIterator.__next__cCs|Sr!r r0r r r"rTszIterator.__iter__cCs|tkrt|dd�StS)NrTrU)rr.r(r3r r r"r5szIterator.__subclasshook__N)	r6r7r8r9rrUrTr:r5r r r r"rs
c@s(eZdZdZedd��Zedd��ZdS)r
r ccsdSr!r r0r r r"�__reversed__)szReversible.__reversed__cCs|tkrt|dd�StS)NrVrT)r
r.r(r3r r r"r5.szReversible.__subclasshook__N)r6r7r8r9rrVr:r5r r r r"r
%s

c@sFeZdZdZdd�Zedd��Zed
dd��Zd	d
�Ze	dd��Z
dS)rr cCs
|�d�Sr!)rAr0r r r"rU9szGenerator.__next__cCst�dSr!r=r?r r r"rA?szGenerator.sendNcCs4|dkr|dkr|�|�}|dk	r,|�|�}|�dSr!rBrDr r r"rHFs
zGenerator.throwc	Cs4z|�t�Wnttfk
r&Yn
Xtd��dS)Nzgenerator ignored GeneratorExitrIr0r r r"rLSs
zGenerator.closecCs|tkrt|ddddd�StS)NrTrUrArHrL)rr.r(r3r r r"r5]s�zGenerator.__subclasshook__)NN)r6r7r8r9rUrrArHrLr:r5r r r r"r5s

c@s(eZdZdZedd��Zedd��ZdS)rr cCsdSr/r r0r r r"�__len__ksz
Sized.__len__cCs|tkrt|d�StS)NrW)rr.r(r3r r r"r5os
zSized.__subclasshook__N)r6r7r8r9rrWr:r5r r r r"rgs

c@s(eZdZdZedd��Zedd��ZdS)rr cCsdS�NFr )r1�xr r r"�__contains__zszContainer.__contains__cCs|tkrt|d�StS)NrZ)rr.r(r3r r r"r5~s
zContainer.__subclasshook__N)r6r7r8r9rrZr:r5r r r r"rvs

c@seZdZdZedd��ZdS)rr cCs|tkrt|ddd�StS)NrWrTrZ)rr.r(r3r r r"r5�szCollection.__subclasshook__N)r6r7r8r9r:r5r r r r"r�sc@s(eZdZdZedd��Zedd��ZdS)rr cOsdSrXr )r1�args�kwdsr r r"�__call__�szCallable.__call__cCs|tkrt|d�StS)Nr])rr.r(r3r r r"r5�s
zCallable.__subclasshook__N)r6r7r8r9rr]r:r5r r r r"r�s

c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Ze	dd
��Z
dd�ZeZdd�Z
dd�ZeZdd�Zdd�Zdd�ZeZdd�ZdS)rr cCs>t|t�stSt|�t|�kr"dS|D]}||kr&dSq&dS�NFT��
isinstancerr(�len�r1�other�elemr r r"�__le__�s
z
Set.__le__cCs(t|t�stSt|�t|�ko&|�|�Sr!�r`rr(rare�r1rcr r r"�__lt__�s
z
Set.__lt__cCs(t|t�stSt|�t|�ko&|�|�Sr!)r`rr(ra�__ge__rgr r r"�__gt__�s
z
Set.__gt__cCs>t|t�stSt|�t|�kr"dS|D]}||kr&dSq&dSr^r_rbr r r"ri�s
z
Set.__ge__cCs(t|t�stSt|�t|�ko&|�|�Sr!rfrgr r r"�__eq__�s
z
Set.__eq__cCs||�Sr!r )r4�itr r r"�_from_iterable�szSet._from_iterablecs&t|t�stS���fdd�|D��S)Nc3s|]}|�kr|VqdSr!r ��.0r@r0r r"�	<genexpr>�szSet.__and__.<locals>.<genexpr>�r`r
r(rmrgr r0r"�__and__�s
zSet.__and__cCs|D]}||krdSqdSr^r )r1rcr@r r r"�
isdisjoint�szSet.isdisjointcCs*t|t�stSdd�||fD�}|�|�S)Ncss|]}|D]
}|Vq
qdSr!r )ro�s�er r r"rp�szSet.__or__.<locals>.<genexpr>rq)r1rc�chainr r r"�__or__�s
z
Set.__or__cs:t�t�s"t�t�stS|����|��fdd�|D��S)Nc3s|]}|�kr|VqdSr!r rn�rcr r"rp�s�zSet.__sub__.<locals>.<genexpr>�r`rr
r(rmrgr rxr"�__sub__�s



zSet.__sub__cs:t|t�s"t|t�stS��|�}���fdd�|D��S)Nc3s|]}|�kr|VqdSr!r rnr0r r"rp�s�zSet.__rsub__.<locals>.<genexpr>ryrgr r0r"�__rsub__�s



zSet.__rsub__cCs2t|t�s"t|t�stS|�|�}||||BSr!ryrgr r r"�__xor__s



zSet.__xor__cCs�tj}d|d}t|�}d|d}||M}|D],}t|�}|||d>AdAdN}||M}q2|dd}||M}||kr�||d8}|d	kr�d
}|S)N�riM��r�i�M[l�4~2i�
i��6���i��8#)�sys�maxsizera�hash)r1�MAX�MASK�n�hrY�hxr r r"�_hash	s 
z	Set._hashN)r6r7r8r9rerhrjrirkr:rmrr�__rand__rsrw�__ror__rzr{r|�__rxor__r�r r r r"r�s$


c@s`eZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dS)rr cCst�dSr!��NotImplementedErrorr?r r r"�add:szMutableSet.addcCst�dSr!r�r?r r r"�discard?szMutableSet.discardcCs||krt|��|�|�dSr!)�KeyErrorr�r?r r r"�removeDszMutableSet.removecCs>t|�}zt|�}Wntk
r.td�YnX|�|�|Sr!)�iter�nextr>r�r��r1rlr@r r r"�popJs
zMutableSet.popcCs(z|��qWntk
r"YnXdSr!)r�r�r0r r r"�clearTszMutableSet.clearcCs|D]}|�|�q|Sr!)r�r�r r r"�__ior__\szMutableSet.__ior__cCs||D]}|�|�q|Sr!)r�r�r r r"�__iand__aszMutableSet.__iand__cCsR||kr|��n<t|t�s&|�|�}|D]"}||krB|�|�q*|�|�q*|Sr!)r�r`rrmr�r�r�r r r"�__ixor__fs


zMutableSet.__ixor__cCs*||kr|��n|D]}|�|�q|Sr!)r�r�r�r r r"�__isub__ss

zMutableSet.__isub__N)r6r7r8r9rr�r�r�r�r�r�r�r�r�r r r r"r,s



c@sReZdZdZedd��Zddd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdZdS)rr cCst�dSr!�r��r1�keyr r r"�__getitem__�szMapping.__getitem__NcCs(z
||WStk
r"|YSXdSr!r��r1r��defaultr r r"�get�s
zMapping.getcCs,z||Wntk
r"YdSXdSdSr^r�r�r r r"rZ�s
zMapping.__contains__cCst|�Sr!)rr0r r r"�keys�szMapping.keyscCst|�Sr!)rr0r r r"�items�sz
Mapping.itemscCst|�Sr!)rr0r r r"�values�szMapping.valuescCs&t|t�stSt|���t|���kSr!)r`rr(�dictr�rgr r r"rk�s
zMapping.__eq__)N)
r6r7r8r9rr�r�rZr�r�r�rkrVr r r r"r�s


c@s(eZdZdZdd�Zdd�Zdd�ZdS)	r��_mappingcCs
||_dSr!r�)r1�mappingr r r"�__init__�szMappingView.__init__cCs
t|j�Sr!)rar�r0r r r"rW�szMappingView.__len__cCs
d�|�S)Nz&{0.__class__.__name__}({0._mapping!r}))�formatr0r r r"�__repr__�szMappingView.__repr__N)r6r7r8r9r�rWr�r r r r"r�sc@s,eZdZdZedd��Zdd�Zdd�ZdS)	rr cCst|�Sr!��set�r1rlr r r"rm�szKeysView._from_iterablecCs
||jkSr!r�r�r r r"rZ�szKeysView.__contains__ccs|jEdHdSr!r�r0r r r"rT�szKeysView.__iter__N�r6r7r8r9r:rmrZrTr r r r"r�s

c@s,eZdZdZedd��Zdd�Zdd�ZdS)	rr cCst|�Sr!r�r�r r r"rm�szItemsView._from_iterablecCsB|\}}z|j|}Wntk
r,YdSX||kp<||kSdSrX)r�r�)r1�itemr�r@�vr r r"rZ�szItemsView.__contains__ccs |jD]}||j|fVqdSr!r�r�r r r"rT�s
zItemsView.__iter__Nr�r r r r"r�s

	c@s eZdZdZdd�Zdd�ZdS)rr cCs0|jD]$}|j|}||ks$||krdSqdS�NTFr�)r1r@r�r�r r r"rZ�s


zValuesView.__contains__ccs|jD]}|j|VqdSr!r�r�r r r"rT�s
zValuesView.__iter__N)r6r7r8r9rZrTr r r r"r�sc@s^eZdZdZedd��Zedd��Ze�Zefdd�Z	dd	�Z
d
d�Zddd
�Zddd�Z
dS)rr cCst�dSr!r��r1r�r@r r r"�__setitem__szMutableMapping.__setitem__cCst�dSr!r�r�r r r"�__delitem__szMutableMapping.__delitem__cCs@z||}Wn$tk
r0||jkr(�|YSX||=|SdSr!)r��_MutableMapping__marker)r1r�r�r@r r r"r�s

zMutableMapping.popcCsBztt|��}Wntk
r*td�YnX||}||=||fSr!)r�r�r>r�r�r r r"�popitem$szMutableMapping.popitemcCs(z|��qWntk
r"YnXdSr!)r�r�r0r r r"r�0szMutableMapping.clearcKs|t|t�r"|D]}||||<qn<t|d�rH|��D]}||||<q4n|D]\}}|||<qL|��D]\}}|||<qfdS)Nr�)r`r�hasattrr�r�)r1rcr\r�r@r r r"�update8s


zMutableMapping.updateNcCs,z
||WStk
r&|||<YnX|Sr!r�r�r r r"�
setdefaultJs

zMutableMapping.setdefault)r )N)r6r7r8r9rr�r��objectr�r�r�r�r�r�r r r r"r�s


c@sFeZdZdZedd��Zdd�Zdd�Zdd	�Zddd
�Z	dd�Z
dS)rr cCst�dSr!��
IndexError�r1�indexr r r"r�bszSequence.__getitem__ccs<d}z||}|V|d7}qWntk
r6YdSXdS�Nrrr�)r1�ir�r r r"rTfszSequence.__iter__cCs$|D]}||ks||krdSqdSr�r )r1r@r�r r r"rZpszSequence.__contains__ccs$ttt|���D]}||VqdSr!)�reversed�rangera)r1r�r r r"rVvszSequence.__reversed__rNcCs�|dk	r"|dkr"tt|�|d�}|dk	r>|dkr>|t|�7}|}|dksR||kr�z"||}||ksl||krr|WSWntk
r�Yq�YnX|d7}qBt�dSr�)�maxrar��
ValueError)r1r@�start�stopr�r�r r r"r�zs


zSequence.indexcst�fdd�|D��S)Nc3s"|]}|�ks|�krdVqdS)rNr )ror��r@r r"rp�sz!Sequence.count.<locals>.<genexpr>)�sumr?r r�r"�count�szSequence.count)rN)r6r7r8r9rr�rTrZrVr�r�r r r r"rXs


c@seZdZdZdS)rr N)r6r7r8r9r r r r"r�sc@sneZdZdZedd��Zedd��Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�Zddd�Zdd�Z
dd�ZdS)rr cCst�dSr!r��r1r�r@r r r"r��szMutableSequence.__setitem__cCst�dSr!r�r�r r r"r��szMutableSequence.__delitem__cCst�dSr!r�r�r r r"�insert�szMutableSequence.insertcCs|�t|�|�dSr!)r�rar?r r r"�append�szMutableSequence.appendcCs(z|��qWntk
r"YnXdSr!)r�r�r0r r r"r��szMutableSequence.clearcCsHt|�}t|d�D].}|||d||||<|||d<qdS)Nr}r)rar�)r1r�r�r r r"�reverse�szMutableSequence.reversecCs(||krt|�}|D]}|�|�qdSr!)�listr�)r1r�r�r r r"�extend�szMutableSequence.extendrcCs||}||=|Sr!r )r1r�r�r r r"r��szMutableSequence.popcCs||�|�=dSr!)r�r?r r r"r��szMutableSequence.removecCs|�|�|Sr!)r�)r1r�r r r"�__iadd__�s
zMutableSequence.__iadd__N)r)r6r7r8r9rr�r�r�r�r�r�r�r�r�r�r r r r"r�s	



)J�abcrrr��__all__r6�typer��bytes_iterator�	bytearray�bytearray_iteratorr��dict_keyiteratorr��dict_valueiteratorr��dict_itemiterator�
list_iteratorr��list_reverseiteratorr��range_iterator�longrange_iteratorr��set_iterator�str_iterator�tuple_iterator�zip�zip_iterator�	dict_keys�dict_values�
dict_itemsr'�mappingproxy�	generatorr$�	coroutinerLr%�async_generatorr.r	rr�registerrrrr
rr
rrrrrr�	frozensetrrrrrrrr�r�tuple�str�
memoryviewr�bytesrr�r r r r"�<module>	s��	
)
0













/



O
2



S
=



	

C
fnmatch.cpython-38.pyc000064400000006435150335716500010631 0ustar00U

e5d��@sjdZddlZddlZddlZddlZddddgZdd�Zejdd	d
�dd��Zd
d�Z	dd�Z
dd�ZdS)a�Filename matching with shell patterns.

fnmatch(FILENAME, PATTERN) matches according to the local convention.
fnmatchcase(FILENAME, PATTERN) always takes case in account.

The functions operate by translating the pattern into a regular
expression.  They cache the compiled regular expressions for speed.

The function translate(PATTERN) returns a regular expression
corresponding to PATTERN.  (It does not compile it.)
�N�filter�fnmatch�fnmatchcase�	translatecCs"tj�|�}tj�|�}t||�S)a�Test whether FILENAME matches PATTERN.

    Patterns are Unix shell style:

    *       matches everything
    ?       matches any single character
    [seq]   matches any character in seq
    [!seq]  matches any char not in seq

    An initial period in FILENAME is not special.
    Both FILENAME and PATTERN are first case-normalized
    if the operating system requires it.
    If you don't want this, use fnmatchcase(FILENAME, PATTERN).
    )�os�path�normcaser)�name�pat�r�/usr/lib64/python3.8/fnmatch.pyrs�T)�maxsize�typedcCs<t|t�r(t|d�}t|�}t|d�}nt|�}t�|�jS)Nz
ISO-8859-1)�
isinstance�bytes�strr�re�compile�match)r
Zpat_strZres_str�resrrr�_compile_pattern&s

rcCshg}tj�|�}t|�}tjtkr@|D]}||�r&|�|�q&n$|D]}|tj�|��rD|�|�qD|S)zJConstruct a list from those elements of the iterable NAMES that match PAT.)rrrr�	posixpath�append)�namesr
�resultrr	rrrr0s
cCst|�}||�dk	S)z�Test whether FILENAME matches PATTERN, including case.

    This is a version of fnmatch() which doesn't case-normalize
    its arguments.
    N)r)r	r
rrrrr@sc	Cs�dt|�}}d}||k�r�||}|d}|dkr>|d}q|dkrP|d}q|dk�r�|}||krz||d	krz|d}||kr�||d
kr�|d}||kr�||d
kr�|d}q�||kr�|d}�q�|||�}d|kr�|�d
d�}n�g}||d	k�r|dn|d}|�d||�}|dk�r(�qN|�|||��|d}|d}�q|�|||��d�dd�|D��}t�dd|�}|d}|dd	k�r�d|dd�}n|ddk�r�d
|}d||f}q|t�|�}qd|S)zfTranslate a shell PATTERN to a regular expression.

    There is no way to quote meta-characters.
    r���*z.*�?�.�[�!�]z\[z--�\�\\��-�css"|]}|�dd��dd�VqdS)r$r%r'z\-N)�replace)�.0�srrr�	<genexpr>ts�ztranslate.<locals>.<genexpr>z([&~|])z\\\1�^N)r-r!z%s[%s]z	(?s:%s)\Z)�lenr)�findr�joinr�sub�escape)	r
�i�nr�c�jZstuffZchunks�krrrrJsV






�)�__doc__rrr�	functools�__all__r�	lru_cacherrrrrrrr�<module>s
	
ipaddress.cpython-38.pyc000064400000165113150335716500011166 0ustar00U

e5d��@s�dZdZddlZdZdZGdd�de�ZGdd	�d	e�Zd
d�Zd=d
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�ZGd#d$�d$�ZejGd%d&�d&e��ZejGd'd(�d(e��ZGd)d*�d*�ZGd+d,�d,ee�ZGd-d.�d.e�ZGd/d0�d0ee�ZGd1d2�d2�Zee_Gd3d4�d4�ZGd5d6�d6ee�ZGd7d8�d8e�Z Gd9d:�d:ee�Z!Gd;d<�d<�Z"e"e_dS)>z�A fast, lightweight IPv4/IPv6 manipulation library in Python.

This library is used to create/poke/manipulate IPv4 and IPv6 addresses
and networks.

z1.0�N� �c@seZdZdZdS)�AddressValueErrorz%A Value Error related to the address.N��__name__�
__module__�__qualname__�__doc__�r
r
�!/usr/lib64/python3.8/ipaddress.pyrsrc@seZdZdZdS)�NetmaskValueErrorz%A Value Error related to the netmask.Nrr
r
r
rrsrc	CsXz
t|�WSttfk
r"YnXz
t|�WSttfk
rFYnXtd|��dS)a�Take an IP string/int and return an object of the correct type.

    Args:
        address: A string or integer, the IP address.  Either IPv4 or
          IPv6 addresses may be supplied; integers less than 2**32 will
          be considered to be IPv4 by default.

    Returns:
        An IPv4Address or IPv6Address object.

    Raises:
        ValueError: if the *address* passed isn't either a v4 or a v6
          address

    z0%r does not appear to be an IPv4 or IPv6 addressN)�IPv4Addressrr�IPv6Address�
ValueError��addressr
r
r�
ip_addresss

�rTc	Cs\zt||�WSttfk
r$YnXzt||�WSttfk
rJYnXtd|��dS)a�Take an IP string/int and return an object of the correct type.

    Args:
        address: A string or integer, the IP network.  Either IPv4 or
          IPv6 networks may be supplied; integers less than 2**32 will
          be considered to be IPv4 by default.

    Returns:
        An IPv4Network or IPv6Network object.

    Raises:
        ValueError: if the string passed isn't either a v4 or a v6
          address. Or if the network has host bits set.

    z0%r does not appear to be an IPv4 or IPv6 networkN)�IPv4Networkrr�IPv6Networkr)r�strictr
r
r�
ip_network9s�rc	CsXz
t|�WSttfk
r"YnXz
t|�WSttfk
rFYnXtd|��dS)agTake an IP string/int and return an object of the correct type.

    Args:
        address: A string or integer, the IP address.  Either IPv4 or
          IPv6 addresses may be supplied; integers less than 2**32 will
          be considered to be IPv4 by default.

    Returns:
        An IPv4Interface or IPv6Interface object.

    Raises:
        ValueError: if the string passed isn't either a v4 or a v6
          address.

    Notes:
        The IPv?Interface classes describe an Address on a particular
        Network, so they're basically a combination of both the Address
        and Network classes.

    z2%r does not appear to be an IPv4 or IPv6 interfaceN)�
IPv4Interfacerr�
IPv6Interfacerrr
r
r�ip_interfaceWs

�rcCs0z|�dd�WStk
r*td��YnXdS)a`Represent an address as 4 packed bytes in network (big-endian) order.

    Args:
        address: An integer representation of an IPv4 IP address.

    Returns:
        The integer address packed as 4 bytes in network (big-endian) order.

    Raises:
        ValueError: If the integer is negative or too large to be an
          IPv4 IP address.

    ��bigz&Address negative or too large for IPv4N��to_bytes�
OverflowErrorrrr
r
r�v4_int_to_packedzsrcCs0z|�dd�WStk
r*td��YnXdS)z�Represent an address as 16 packed bytes in network (big-endian) order.

    Args:
        address: An integer representation of an IPv6 IP address.

    Returns:
        The integer address packed as 16 bytes in network (big-endian) order.

    �rz&Address negative or too large for IPv6Nrrr
r
r�v6_int_to_packed�s
r!cCs*t|��d�}t|�dkr&td|��|S)zAHelper to split the netmask and raise AddressValueError if needed�/�zOnly one '/' permitted in %r)�str�split�lenr)r�addrr
r
r�_split_optional_netmask�sr(ccsNt|�}t|�}}|D]&}|j|jdkr:||fV|}|}q||fVdS)z�Find a sequence of sorted deduplicated IPv#Address.

    Args:
        addresses: a list of IPv#Address objects.

    Yields:
        A tuple containing the first and last IP addresses in the sequence.

    �N)�iter�next�_ip)�	addresses�it�first�last�ipr
r
r�_find_address_range�s

r2cCs$|dkr|St|||d@���S)z�Count the number of zero bits on the right hand side.

    Args:
        number: an integer.
        bits: maximum number of bits to count.

    Returns:
        The number of zero bits on the right hand side of the number.

    rr))�min�
bit_length)Znumber�bitsr
r
r�_count_righthand_zero_bits�sr6ccs�t|t�rt|t�std��|j|jkr8td||f��||krHtd��|jdkrXt}n|jdkrht}ntd��|j}|j}|j}||kr�t	t
||�||d��d�}||||f�}|V|d|>7}|d|jkr�q�q�dS)	a�Summarize a network range given the first and last IP addresses.

    Example:
        >>> list(summarize_address_range(IPv4Address('192.0.2.0'),
        ...                              IPv4Address('192.0.2.130')))
        ...                                #doctest: +NORMALIZE_WHITESPACE
        [IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/31'),
         IPv4Network('192.0.2.130/32')]

    Args:
        first: the first IPv4Address or IPv6Address in the range.
        last: the last IPv4Address or IPv6Address in the range.

    Returns:
        An iterator of the summarized IPv(4|6) network objects.

    Raise:
        TypeError:
            If the first and last objects are not IP addresses.
            If the first and last objects are not the same version.
        ValueError:
            If the last object is not greater than the first.
            If the version of the first address is not 4 or 6.

    z1first and last must be IP addresses, not networks�%%s and %s are not of the same versionz*last IP address must be greater than firstr�zunknown IP versionr)N)
�
isinstance�_BaseAddress�	TypeError�versionrrr�_max_prefixlenr,r3r6r4�	_ALL_ONES)r/r0r1Zip_bitsZ	first_intZlast_intZnbits�netr
r
r�summarize_address_range�s8
��


�r@ccs�t|�}i}|rV|��}|��}|�|�}|dkr<|||<q||kr||=|�|�qd}t|���D]$}|dk	r�|j|jkr�qf|V|}qfdS)auLoops through the addresses, collapsing concurrent netblocks.

    Example:

        ip1 = IPv4Network('192.0.2.0/26')
        ip2 = IPv4Network('192.0.2.64/26')
        ip3 = IPv4Network('192.0.2.128/26')
        ip4 = IPv4Network('192.0.2.192/26')

        _collapse_addresses_internal([ip1, ip2, ip3, ip4]) ->
          [IPv4Network('192.0.2.0/24')]

        This shouldn't be called directly; it is called via
          collapse_addresses([]).

    Args:
        addresses: A list of IPv4Network's or IPv6Network's

    Returns:
        A list of IPv4Network's or IPv6Network's depending on what we were
        passed.

    N)�list�pop�supernet�get�append�sorted�values�broadcast_address)r-Zto_merge�subnetsr?rCZexistingr0r
r
r�_collapse_addresses_internals$

rJc	Cs0g}g}g}|D]�}t|t�rR|rF|dj|jkrFtd||df��|�|�q|j|jkr�|r�|dj|jkr�td||df��z|�|j�Wq�tk
r�|�|j	�Yq�Xq|r�|dj|jkr�td||df��|�|�qt
t|��}|�r$t|�D]\}}|�
t||���qt||�S)a�Collapse a list of IP objects.

    Example:
        collapse_addresses([IPv4Network('192.0.2.0/25'),
                            IPv4Network('192.0.2.128/25')]) ->
                           [IPv4Network('192.0.2.0/24')]

    Args:
        addresses: An iterator of IPv4Network or IPv6Network objects.

    Returns:
        An iterator of the collapsed IPv(4|6)Network objects.

    Raises:
        TypeError: If passed a list of mixed version objects.

    ���r7)r9r:�_versionr;rE�
_prefixlenr=r1�AttributeError�network_addressrF�setr2�extendr@rJ)r-ZaddrsZipsZnetsr1r/r0r
r
r�collapse_addresses2s@
���rRcCs(t|t�r|��St|t�r$|��StS)a2Return a key suitable for sorting between networks and addresses.

    Address and Network objects are not sortable by default; they're
    fundamentally different so the expression

        IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24')

    doesn't make any sense.  There are some times however, where you may wish
    to have ipaddress sort these for you anyway. If you need to do this, you
    can use this function as the key= argument to sorted().

    Args:
      obj: either a Network or Address object.
    Returns:
      appropriate key.

    )r9�_BaseNetwork�_get_networks_keyr:�_get_address_key�NotImplemented)�objr
r
r�get_mixed_type_keyhs


rXc@s�eZdZdZdZedd��Zedd��Zedd��Zed	d
��Z	dd�Z
d
d�Zedd��Z
edd��Zedd��Zedd��Zedd��Zedd��Zdd�ZdS)�_IPAddressBasezThe mother class.r
cCs|��S)z:Return the longhand version of the IP address as a string.)�_explode_shorthand_ip_string��selfr
r
r�exploded�sz_IPAddressBase.explodedcCst|�S)z;Return the shorthand version of the IP address as a string.�r$r[r
r
r�
compressed�sz_IPAddressBase.compressedcCs|��S)aIThe name of the reverse DNS pointer for the IP address, e.g.:
            >>> ipaddress.ip_address("127.0.0.1").reverse_pointer
            '1.0.0.127.in-addr.arpa'
            >>> ipaddress.ip_address("2001:db8::1").reverse_pointer
            '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa'

        )�_reverse_pointerr[r
r
r�reverse_pointer�s	z_IPAddressBase.reverse_pointercCsdt|�f}t|��dS)Nz%200s has no version specified��type�NotImplementedError�r\�msgr
r
rr<�sz_IPAddressBase.versioncCsF|dkrd}t|||jf��||jkrBd}t|||j|jf��dS)Nrz-%d (< 0) is not permitted as an IPv%d addressz2%d (>= 2**%d) is not permitted as an IPv%d address)rrLr>r=)r\rrfr
r
r�_check_int_address�s

�z!_IPAddressBase._check_int_addresscCs.t|�}||kr*d}t|||||jf��dS)Nz6%r (len %d != %d) is not permitted as an IPv%d address)r&rrL)r\rZexpected_lenZaddress_lenrfr
r
r�_check_packed_address�s�z$_IPAddressBase._check_packed_addresscCs|j|j|?AS)z�Turn the prefix length into a bitwise netmask

        Args:
            prefixlen: An integer, the prefix length.

        Returns:
            An integer.

        )r>)�cls�	prefixlenr
r
r�_ip_int_from_prefix�sz"_IPAddressBase._ip_int_from_prefixc	Cs\t||j�}|j|}||?}d|>d}||krX|jd}|�|d�}d}t||��|S)aReturn prefix length from the bitwise netmask.

        Args:
            ip_int: An integer, the netmask in expanded bitwise format

        Returns:
            An integer, the prefix length.

        Raises:
            ValueError: If the input intermingles zeroes & ones
        r)�rz&Netmask pattern %r mixes zeroes & ones)r6r=rr)	ri�ip_intZtrailing_zeroesrjZleading_onesZall_onesZbyteslenZdetailsrfr
r
r�_prefix_from_ip_int�s
�

z"_IPAddressBase._prefix_from_ip_intcCsd|}t|�d�dS)Nz%r is not a valid netmask)r)riZnetmask_strrfr
r
r�_report_invalid_netmask�sz&_IPAddressBase._report_invalid_netmaskcCsl|��r|��s|�|�zt|�}Wntk
rD|�|�YnXd|kr\|jkshn|�|�|S)a	Return prefix length from a numeric string

        Args:
            prefixlen_str: The string to be converted

        Returns:
            An integer, the prefix length.

        Raises:
            NetmaskValueError: If the input is not a valid netmask
        r)�isascii�isdigitro�intrr=)riZ
prefixlen_strrjr
r
r�_prefix_from_prefix_string�s

z)_IPAddressBase._prefix_from_prefix_stringcCs�z|�|�}Wntk
r,|�|�YnXz|�|�WStk
rNYnX||jN}z|�|�WStk
r�|�|�YnXdS)aTurn a netmask/hostmask string into a prefix length

        Args:
            ip_str: The netmask/hostmask to be converted

        Returns:
            An integer, the prefix length.

        Raises:
            NetmaskValueError: If the input is not a valid netmask/hostmask
        N)�_ip_int_from_stringrrornrr>)ri�ip_strrmr
r
r�_prefix_from_ip_string�s
z%_IPAddressBase._prefix_from_ip_stringcCsHt|ttf�r||jfSt|t�s*t|�}t|�dkr:|S|d|jfS)z�Helper function to parse address of Network/Interface.

        Arg:
            address: Argument of Network/Interface.

        Returns:
            (addr, prefix) tuple.
        r)r)r9�bytesrrr=�tupler(r&)rirr
r
r�_split_addr_prefixs

z!_IPAddressBase._split_addr_prefixcCs|jt|�ffS�N)�	__class__r$r[r
r
r�
__reduce__/sz_IPAddressBase.__reduce__N)rrrr	�	__slots__�propertyr]r_rar<rgrh�classmethodrkrnrorsrvryr|r
r
r
rrY�s2




	




!
rYc@sdeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�ZdS)r:z�A generic IP object.

    This IP class contains the version independent methods which are
    used by single IP addresses.
    r
cCs|jSrz�r,r[r
r
r�__int__>sz_BaseAddress.__int__cCs8z|j|jko|j|jkWStk
r2tYSXdSrz)r,rLrNrV�r\�otherr
r
r�__eq__As
�z_BaseAddress.__eq__cCsFt|t�stS|j|jkr*td||f��|j|jkrB|j|jkSdS�Nr7F)r9r:rVrLr;r,r�r
r
r�__lt__Hs
�z_BaseAddress.__lt__cCs t|t�stS|�t|�|�Srz�r9rrrVr{r�r
r
r�__add__Ts
z_BaseAddress.__add__cCs t|t�stS|�t|�|�Srzr�r�r
r
r�__sub__Ys
z_BaseAddress.__sub__cCsd|jjt|�fS�Nz%s(%r)�r{rr$r[r
r
r�__repr__^sz_BaseAddress.__repr__cCst|�|j��Srz)r$�_string_from_ip_intr,r[r
r
r�__str__asz_BaseAddress.__str__cCsttt|j���Srz)�hash�hexrrr,r[r
r
r�__hash__dsz_BaseAddress.__hash__cCs
|j|fSrz�rLr[r
r
rrUgsz_BaseAddress._get_address_keycCs|j|jffSrz)r{r,r[r
r
rr|jsz_BaseAddress.__reduce__N)rrrr	r}r�r�r�r�r�r�r�r�rUr|r
r
r
rr:3sr:c@s`eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
ejdd��Zejdd��Zedd��Zedd��Zedd��Zed d!��Zed"d#��Zed$d%��Zd&d'�Zd(d)�Zd*d+�ZdFd.d/�ZdGd0d1�Zed2d3��Zed4d5��Z d6d7�Z!d8d9�Z"ed:d;��Z#ed<d=��Z$ed>d?��Z%ed@dA��Z&edBdC��Z'edDdE��Z(d-S)HrSz}A generic IP network object.

    This IP class contains the version independent methods which are
    used by networks.
    cCsd|jjt|�fSr�r�r[r
r
rr�vsz_BaseNetwork.__repr__cCsd|j|jfS�N�%s/%d)rOrjr[r
r
rr�ysz_BaseNetwork.__str__ccs8t|j�}t|j�}t|d|�D]}|�|�Vq"dS)z�Generate Iterator over usable hosts in a network.

        This is like __iter__ except it doesn't return the network
        or broadcast addresses.

        r)N�rrrOrH�range�_address_class�r\�network�	broadcast�xr
r
r�hosts|s

z_BaseNetwork.hostsccs8t|j�}t|j�}t||d�D]}|�|�Vq"dS�Nr)r�r�r
r
r�__iter__�s

z_BaseNetwork.__iter__cCslt|j�}t|j�}|dkr>|||kr0td��|�||�S|d7}|||krZtd��|�||�SdS)Nrzaddress out of ranger))rrrOrH�
IndexErrorr�)r\�nr�r�r
r
r�__getitem__�s

z_BaseNetwork.__getitem__cCs^t|t�stS|j|jkr*td||f��|j|jkrB|j|jkS|j|jkrZ|j|jkSdSr�)r9rSrVrLr;rO�netmaskr�r
r
rr��s
�z_BaseNetwork.__lt__cCsLz.|j|jko,|j|jko,t|j�t|j�kWStk
rFtYSXdSrz)rLrOrrr�rNrVr�r
r
rr��s
��z_BaseNetwork.__eq__cCstt|j�t|j�A�Srz)r�rrrOr�r[r
r
rr��sz_BaseNetwork.__hash__cCs8|j|jkrdSt|t�rdS|j|jj@|jjkSdS�NF)rLr9rSr,r�rOr�r
r
r�__contains__�s

z_BaseNetwork.__contains__cCs(|j|kp&|j|kp&|j|kp&|j|kS)z*Tell if self is partly contained in other.)rOrHr�r
r
r�overlaps�s



�z_BaseNetwork.overlapscCs|�t|j�t|j�B�Srz)r�rrrO�hostmaskr[r
r
rrH�s�z_BaseNetwork.broadcast_addresscCs|�t|j�|jA�Srz)r�rrr�r>r[r
r
rr��sz_BaseNetwork.hostmaskcCsd|j|jfSr�)rOrMr[r
r
r�with_prefixlen�sz_BaseNetwork.with_prefixlencCsd|j|jfS�N�%s/%s)rOr�r[r
r
r�with_netmask�sz_BaseNetwork.with_netmaskcCsd|j|jfSr�)rOr�r[r
r
r�
with_hostmask�sz_BaseNetwork.with_hostmaskcCst|j�t|j�dS)z&Number of hosts in the current subnet.r))rrrHrOr[r
r
r�
num_addresses�sz_BaseNetwork.num_addressescCsdt|�f}t|��dS)Nz%%200s has no associated address classrbrer
r
rr��sz_BaseNetwork._address_classcCs|jSrz)rMr[r
r
rrj�sz_BaseNetwork.prefixlenccs|j|jkstd||f��t|t�s2td|��|�|�sLtd||f��||krXdS|�d|j|jf�}|�	�\}}||kr�||kr�|�|�r�|V|�	�\}}qz|�|�r�|V|�	�\}}qzt
d|||f��qz||kr�|Vn"||kr�|Vnt
d|||f��dS)a�Remove an address from a larger block.

        For example:

            addr1 = ip_network('192.0.2.0/28')
            addr2 = ip_network('192.0.2.1/32')
            list(addr1.address_exclude(addr2)) =
                [IPv4Network('192.0.2.0/32'), IPv4Network('192.0.2.2/31'),
                 IPv4Network('192.0.2.4/30'), IPv4Network('192.0.2.8/29')]

        or IPv6:

            addr1 = ip_network('2001:db8::1/32')
            addr2 = ip_network('2001:db8::1/128')
            list(addr1.address_exclude(addr2)) =
                [ip_network('2001:db8::1/128'),
                 ip_network('2001:db8::2/127'),
                 ip_network('2001:db8::4/126'),
                 ip_network('2001:db8::8/125'),
                 ...
                 ip_network('2001:db8:8000::/33')]

        Args:
            other: An IPv4Network or IPv6Network object of the same type.

        Returns:
            An iterator of the IPv(4|6)Network objects which is self
            minus other.

        Raises:
            TypeError: If self and other are of differing address
              versions, or if other is not a network object.
            ValueError: If other is not completely contained by self.

        r7z%s is not a network objectz%s not contained in %sNr�z3Error performing exclusion: s1: %s s2: %s other: %s)rLr;r9rS�	subnet_ofrr{rOrjrI�AssertionError)r\r��s1�s2r
r
r�address_exclude�s@$�


�

��z_BaseNetwork.address_excludecCs`|j|jkrtd||f��|j|jkr,dS|j|jkr<dS|j|jkrLdS|j|jkr\dSdS)a�Compare two IP objects.

        This is only concerned about the comparison of the integer
        representation of the network addresses.  This means that the
        host bits aren't considered at all in this method.  If you want
        to compare host bits, you can easily enough do a
        'HostA._ip < HostB._ip'

        Args:
            other: An IP object.

        Returns:
            If the IP versions of self and other are the same, returns:

            -1 if self < other:
              eg: IPv4Network('192.0.2.0/25') < IPv4Network('192.0.2.128/25')
              IPv6Network('2001:db8::1000/124') <
                  IPv6Network('2001:db8::2000/124')
            0 if self == other
              eg: IPv4Network('192.0.2.0/24') == IPv4Network('192.0.2.0/24')
              IPv6Network('2001:db8::1000/124') ==
                  IPv6Network('2001:db8::1000/124')
            1 if self > other
              eg: IPv4Network('192.0.2.128/25') > IPv4Network('192.0.2.0/25')
                  IPv6Network('2001:db8::2000/124') >
                      IPv6Network('2001:db8::1000/124')

          Raises:
              TypeError if the IP versions are different.

        z"%s and %s are not of the same typerKr)r)rLr;rOr�r�r
r
r�compare_networks6s!�z_BaseNetwork.compare_networkscCs|j|j|jfS)z�Network-only key function.

        Returns an object that identifies this address' network and
        netmask. This function is a suitable "key" argument for sorted()
        and list.sort().

        )rLrOr�r[r
r
rrTfsz_BaseNetwork._get_networks_keyr)Nc	cs�|j|jkr|VdS|dk	rJ||jkr0td��|dkr@td��||j}|dkrZtd��|j|}||jkr~td||f��t|j�}t|j�d}t|j�d|?}t|||�D]}|�||f�}|Vq�dS)a�The subnets which join to make the current subnet.

        In the case that self contains only one IP
        (self._prefixlen == 32 for IPv4 or self._prefixlen == 128
        for IPv6), yield an iterator with just ourself.

        Args:
            prefixlen_diff: An integer, the amount the prefix length
              should be increased by. This should not be set if
              new_prefix is also set.
            new_prefix: The desired new prefix length. This must be a
              larger number (smaller prefix) than the existing prefix.
              This should not be set if prefixlen_diff is also set.

        Returns:
            An iterator of IPv(4|6) objects.

        Raises:
            ValueError: The prefixlen_diff is too small or too large.
                OR
            prefixlen_diff and new_prefix are both set or new_prefix
              is a smaller number than the current prefix (smaller
              number means a larger network)

        Nznew prefix must be longerr)�(cannot set prefixlen_diff and new_prefixrzprefix length diff must be > 0z0prefix length diff %d is invalid for netblock %s)	rMr=rrrrOrHr�r�r{)	r\�prefixlen_diff�
new_prefix�
new_prefixlen�start�end�stepZnew_addrZcurrentr
r
rrIps2



��
z_BaseNetwork.subnetscCs�|jdkr|S|dk	rB||jkr(td��|dkr8td��|j|}|j|}|dkrftd|j|f��|�t|j�t|j�|>@|f�S)a�The supernet containing the current network.

        Args:
            prefixlen_diff: An integer, the amount the prefix length of
              the network should be decreased by.  For example, given a
              /24 network and a prefixlen_diff of 3, a supernet with a
              /21 netmask is returned.

        Returns:
            An IPv4 network object.

        Raises:
            ValueError: If self.prefixlen - prefixlen_diff < 0. I.e., you have
              a negative prefix length.
                OR
            If prefixlen_diff and new_prefix are both set or new_prefix is a
              larger number than the current prefix (larger number means a
              smaller network)

        rNznew prefix must be shorterr)r�z;current prefixlen is %d, cannot have a prefixlen_diff of %d)rMrrjr{rrrOr�)r\r�r�r�r
r
rrC�s&



���z_BaseNetwork.supernetcCs|jjo|jjS�z�Test if the address is reserved for multicast use.

        Returns:
            A boolean, True if the address is a multicast address.
            See RFC 2373 2.7 for details.

        )rO�is_multicastrHr[r
r
rr��s	�z_BaseNetwork.is_multicastcCshz:|j|jkr"t|�d|�d���|j|jko8|j|jkWStk
rbtd|�d|����YnXdS)Nz and z are not of the same versionz*Unable to test subnet containment between )rLr;rOrHrN)�a�br
r
r�
_is_subnet_of�s
�z_BaseNetwork._is_subnet_ofcCs|�||�S)z1Return True if this network is a subnet of other.�r�r�r
r
rr��sz_BaseNetwork.subnet_ofcCs|�||�S)z3Return True if this network is a supernet of other.r�r�r
r
r�supernet_of�sz_BaseNetwork.supernet_ofcCs|jjo|jjS)��Test if the address is otherwise IETF reserved.

        Returns:
            A boolean, True if the address is within one of the
            reserved IPv6 Network ranges.

        )rO�is_reservedrHr[r
r
rr��s	�z_BaseNetwork.is_reservedcCs|jjo|jjS�z�Test if the address is reserved for link-local.

        Returns:
            A boolean, True if the address is reserved per RFC 4291.

        )rO�
is_link_localrHr[r
r
rr��s�z_BaseNetwork.is_link_localcCs|jjo|jjS)z�Test if this address is allocated for private networks.

        Returns:
            A boolean, True if the address is reserved per
            iana-ipv4-special-registry or iana-ipv6-special-registry.

        )rO�
is_privaterHr[r
r
rr�s	�z_BaseNetwork.is_privatecCs|jS)z�Test if this address is allocated for public networks.

        Returns:
            A boolean, True if the address is not reserved per
            iana-ipv4-special-registry or iana-ipv6-special-registry.

        �r�r[r
r
r�	is_globals	z_BaseNetwork.is_globalcCs|jjo|jjS)��Test if the address is unspecified.

        Returns:
            A boolean, True if this is the unspecified address as defined in
            RFC 2373 2.5.2.

        )rO�is_unspecifiedrHr[r
r
rr�s	�z_BaseNetwork.is_unspecifiedcCs|jjo|jjS)��Test if the address is a loopback address.

        Returns:
            A boolean, True if the address is a loopback address as defined in
            RFC 2373 2.5.3.

        )rO�is_loopbackrHr[r
r
rr�(s	�z_BaseNetwork.is_loopback)r)N)r)N))rrrr	r�r�r�r�r�r�r�r�r�r��	functools�cached_propertyrHr�r~r�r�r�r�r�rjr�r�rTrIrCr��staticmethodr�r�r�r�r�r�r�r�r�r
r
r
rrSnsd








K0

5
)








rSc@s�eZdZdZdZdZdedZeZiZ	dd�Z
edd	��Zed
d��Z
edd
��Zedd��Zdd�Zedd��Zedd��ZdS)�_BaseV4zyBase IPv4 object.

    The following methods are used by IPv4 objects in both single IP
    addresses and networks.

    r
rr#r)cCst|�Srzr^r[r
r
rrZHsz$_BaseV4._explode_shorthand_ip_stringcCs�||jkr�t|t�r<|}d|kr.|jksjn|�|�n.z|�|�}Wntk
rh|�|�}YnXt|�	|��}||f|j|<|j|S�aMake a (netmask, prefix_len) tuple from the given argument.

        Argument can be:
        - an integer (the prefix length)
        - a string representing the prefix length (e.g. "24")
        - a string representing the prefix netmask (e.g. "255.255.255.0")
        r)
�_netmask_cacher9rrr=rorsrrvr
rk�ri�argrjr�r
r
r�
_make_netmaskKs	

z_BaseV4._make_netmaskc
Cs~|std��|�d�}t|�dkr.td|��zt�t|j|�d�WStk
rx}ztd||f�d�W5d}~XYnXdS)aTurn the given IP string into an integer for comparison.

        Args:
            ip_str: A string, the IP ip_str.

        Returns:
            The IP ip_str as an integer.

        Raises:
            AddressValueError: if ip_str isn't a valid IPv4 Address.

        �Address cannot be empty�.rzExpected 4 octets in %rr�%s in %rN)rr%r&rr�
from_bytes�map�_parse_octetr)riruZoctets�excr
r
rrtes
z_BaseV4._ip_int_from_stringcCs�|std��|��r|��s,d}t||��t|�dkrHd}t||��|dkrl|ddkrld}t||��t|d�}|d	kr�td
|��|S)aConvert a decimal octet into an integer.

        Args:
            octet_str: A string, the number to parse.

        Returns:
            The octet as an integer.

        Raises:
            ValueError: if the octet isn't strictly a decimal from [0..255].

        zEmpty octet not permittedz#Only decimal digits permitted in %r�z$At most 3 characters permitted in %r�0rz%Leading zeros are not permitted in %r�
�zOctet %d (> 255) not permitted)rrprqr&rr)riZ	octet_strrfZ	octet_intr
r
rr�s
z_BaseV4._parse_octetcCsd�tt|�dd���S)z�Turns a 32-bit integer into dotted decimal notation.

        Args:
            ip_int: An integer, the IP address.

        Returns:
            The IP address as a string in dotted decimal notation.

        r�rr)�joinr�r$r)rirmr
r
rr��sz_BaseV4._string_from_ip_intcCs&t|��d�ddd�}d�|�dS)z�Return the reverse DNS pointer name for the IPv4 address.

        This implements the method described in RFC1035 3.5.

        r�NrKz
.in-addr.arpa)r$r%r�)r\Zreverse_octetsr
r
rr`�sz_BaseV4._reverse_pointercCs|jSrz�r=r[r
r
r�
max_prefixlen�sz_BaseV4.max_prefixlencCs|jSrzr�r[r
r
rr<�sz_BaseV4.versionN)rrrr	r}rL�
IPV4LENGTHr>r=r�rZrr�rtr�r�r`r~r�r<r
r
r
rr�5s(


#
	
r�c@s�eZdZdZdZdd�Zedd��Zedd��Zee	�
�d	d
���Zee	�
�dd���Zed
d��Z
edd��Zedd��Zedd��ZdS)r
z/Represent and manipulate single IPv4 Addresses.�r,�__weakref__cCsrt|t�r|�|�||_dSt|t�rF|�|d�t�|d�|_dSt|�}d|krbtd|��|�	|�|_dS)a�
        Args:
            address: A string or integer representing the IP

              Additionally, an integer can be passed, so
              IPv4Address('192.0.2.1') == IPv4Address(3221225985).
              or, more generally
              IPv4Address(int(IPv4Address('192.0.2.1'))) ==
                IPv4Address('192.0.2.1')

        Raises:
            AddressValueError: If ipaddress isn't a valid IPv4 address.

        Nrrr"�Unexpected '/' in %r�
r9rrrgr,rwrhr�r$rrt�r\rZaddr_strr
r
r�__init__�s


zIPv4Address.__init__cCs
t|j�S�z*The binary representation of this address.)rr,r[r
r
r�packed�szIPv4Address.packedcCs||jjkS)z�Test if the address is otherwise IETF reserved.

         Returns:
             A boolean, True if the address is within the
             reserved IPv4 Network range.

        )�
_constants�_reserved_networkr[r
r
rr��s	zIPv4Address.is_reservedcst�fdd��jjD��S)z�Test if this address is allocated for private networks.

        Returns:
            A boolean, True if the address is reserved per
            iana-ipv4-special-registry.

        c3s|]}�|kVqdSrzr
��.0r?r[r
r�	<genexpr>sz)IPv4Address.is_private.<locals>.<genexpr>��anyr��_private_networksr[r
r[rr��s
zIPv4Address.is_privatecCs||jjko|jSrz)r��_public_networkr�r[r
r
rr�szIPv4Address.is_globalcCs||jjkS)z�Test if the address is reserved for multicast use.

        Returns:
            A boolean, True if the address is multicast.
            See RFC 3171 for details.

        �r��_multicast_networkr[r
r
rr�s	zIPv4Address.is_multicastcCs||jjkS)z�Test if the address is unspecified.

        Returns:
            A boolean, True if this is the unspecified address as defined in
            RFC 5735 3.

        )r��_unspecified_addressr[r
r
rr�s	zIPv4Address.is_unspecifiedcCs||jjkS)z�Test if the address is a loopback address.

        Returns:
            A boolean, True if the address is a loopback per RFC 3330.

        )r��_loopback_networkr[r
r
rr�"szIPv4Address.is_loopbackcCs||jjkS)z�Test if the address is reserved for link-local.

        Returns:
            A boolean, True if the address is link-local per RFC 3927.

        �r��_linklocal_networkr[r
r
rr�,szIPv4Address.is_link_localN)rrrr	r}r�r~r�r�r��	lru_cacher�r�r�r�r�r�r
r
r
rr
�s*#








	r
c@sxeZdZdd�Zejdd��Zdd�Zdd�Zd	d
�Z	dd�Z
ejZe
d
d��Ze
dd��Ze
dd��Ze
dd��ZdS)rcCsD|�|�\}}t�||�t||fdd�|_|jj|_|jj|_dS�NF)r)ryr
r�rr�r�rM�r\rr'�maskr
r
rr�9s

zIPv4Interface.__init__cCs|jjSrz�r�r�r[r
r
rr�AszIPv4Interface.hostmaskcCsd|�|j�|jfSr��r�r,rMr[r
r
rr�Es�zIPv4Interface.__str__cCsFt�||�}|r|tkr|Sz|j|jkWStk
r@YdSXdSr�)r
r�rVr�rN�r\r�Z
address_equalr
r
rr�IszIPv4Interface.__eq__cCsRt�||�}|tkrtSz|j|jkp4|j|jko4|WStk
rLYdSXdSr�)r
r�rVr�rN�r\r�Zaddress_lessr
r
rr�Us�zIPv4Interface.__lt__cCst|j|jt|jj�f�Srz�r�r,rMrrr�rOr[r
r
rr�aszIPv4Interface.__hash__cCs
t|j�Srz)r
r,r[r
r
rr1fszIPv4Interface.ipcCsd|�|j�|jfSr�rr[r
r
rr�js�zIPv4Interface.with_prefixlencCsd|�|j�|jfSr��r�r,r�r[r
r
rr�os�zIPv4Interface.with_netmaskcCsd|�|j�|jfSr��r�r,r�r[r
r
rr�ts�zIPv4Interface.with_hostmaskN)rrrr�r�r�r�r�r�r�r�rYr|r~r1r�r�r�r
r
r
rr7s 



rc@s2eZdZdZeZddd�Zee�	�dd���Z
dS)	raeThis class represents and manipulates 32-bit IPv4 network + addresses..

    Attributes: [examples for IPv4Network('192.0.2.0/27')]
        .network_address: IPv4Address('192.0.2.0')
        .hostmask: IPv4Address('0.0.0.31')
        .broadcast_address: IPv4Address('192.0.2.32')
        .netmask: IPv4Address('255.255.255.224')
        .prefixlen: 27

    Tcs�|�|�\�}t��|_|�|�\|_|_t|j�}|t|j�@|krl|rXtd|��nt|t|j�@�|_|j|jdkr�|j	|_
n|j|jkr��fdd�|_
dS)aInstantiate a new IPv4 network object.

        Args:
            address: A string or integer representing the IP [& network].
              '192.0.2.0/24'
              '192.0.2.0/255.255.255.0'
              '192.0.2.0/0.0.0.255'
              are all functionally the same in IPv4. Similarly,
              '192.0.2.1'
              '192.0.2.1/255.255.255.255'
              '192.0.2.1/32'
              are also functionally equivalent. That is to say, failing to
              provide a subnetmask will create an object with a mask of /32.

              If the mask (portion after the / in the argument) is given in
              dotted quad form, it is treated as a netmask if it starts with a
              non-zero field (e.g. /255.0.0.0 == /8) and as a hostmask if it
              starts with a zero field (e.g. 0.255.255.255 == /8), with the
              single exception of an all-zero mask which is treated as a
              netmask == /0. If no mask is given, a default of /32 is used.

              Additionally, an integer can be passed, so
              IPv4Network('192.0.2.1') == IPv4Network(3221225985)
              or, more generally
              IPv4Interface(int(IPv4Interface('192.0.2.1'))) ==
                IPv4Interface('192.0.2.1')

        Raises:
            AddressValueError: If ipaddress isn't a valid IPv4 address.
            NetmaskValueError: If the netmask isn't valid for
              an IPv4 address.
            ValueError: If strict is True and a network address is not
              supplied.
        �%s has host bits setr)cs
t��gSrz)r
r
�r'r
r�<lambda>��z&IPv4Network.__init__.<locals>.<lambda>N)ryr
rOr�r�rMrrrr=r�r��r\rrr�r�r
rrr��s#

�
zIPv4Network.__init__cCs&|jtd�ko|jtd�ko$|jS)z�Test if this address is allocated for public networks.

        Returns:
            A boolean, True if the address is not reserved per
            iana-ipv4-special-registry.

        �
100.64.0.0/10)rOrrHr�r[r
r
rr��s

��zIPv4Network.is_globalN)T)rrrr	r
r�r�r~r�r�r�r
r
r
rrzs
4rc@s�eZdZed�Zed�Zed�Zed�Zed�ed�ed�ed�ed�ed�ed	�ed
�ed�ed�ed
�ed�ed�ed�gZed�Z	e
d�ZdS)�_IPv4Constantsz169.254.0.0/16z127.0.0.0/8z224.0.0.0/4rz	0.0.0.0/8z
10.0.0.0/8z
172.16.0.0/12z192.0.0.0/29z192.0.0.170/31z192.0.2.0/24z192.168.0.0/16z
198.18.0.0/15z198.51.100.0/24z203.0.113.0/24z240.0.0.0/4z255.255.255.255/32z0.0.0.0N)rrrrr�r�r�r�r�r�r
r�r
r
r
rr�s*�rc@s�eZdZdZdZdZdedZdZe	d�Z
eZiZe
dd	��Ze
d
d��Ze
dd
��Ze
dd��Ze
ddd��Zdd�Zdd�Zedd��Zedd��ZdS)�_BaseV6zyBase IPv6 object.

    The following methods are used by IPv6 objects in both single IP
    addresses and networks.

    r
r8r#r)rlZ0123456789ABCDEFabcdefcCsl||jkrbt|t�r<|}d|kr.|jksFn|�|�n
|�|�}t|�|��}||f|j|<|j|Sr�)r�r9rrr=rorsrrkr�r
r
rr�s	


z_BaseV6._make_netmaskc
Cs�|std��|�d�}d}t|�|kr:d||f}t|��d|dkr�zt|���j}Wn4tk
r�}ztd||f�d�W5d}~XYnX|�d	|d
?d@�|�d	|d@�|jd}t|�|kr�d
|d|f}t|��d}tdt|�d�D]*}	||	s�|dk	�r d|}t|��|	}q�|dk	�r�|}
t|�|d}|d�sl|
d8}
|
�rld}t||��|d�s�|d8}|�r�d}t||��|j|
|}|dk�r2d}t||jd|f��njt|�|jk�r�d}t||j|f��|d�sd}t||��|d�s"d}t||��t|�}
d}d}znd}
t|
�D] }	|
d
K}
|
|�	||	�O}
�q@|
d
|K}
t|d�D] }	|
d
K}
|
|�	||	�O}
�qz|
WSt
k
�r�}ztd||f�d�W5d}~XYnXdS)z�Turn an IPv6 ip_str into an integer.

        Args:
            ip_str: A string, the IPv6 ip_str.

        Returns:
            An int, the IPv6 address

        Raises:
            AddressValueError: if ip_str isn't a valid IPv6 Address.

        r��:r�z At least %d parts expected in %rr�rKr�N�%xr �r)z!At most %d colons permitted in %rz At most one '::' permitted in %rrz0Leading ':' only permitted as part of '::' in %rz1Trailing ':' only permitted as part of '::' in %rz/Expected at most %d other parts with '::' in %rz,Exactly %d parts expected without '::' in %r)rr%r&r
rBr,rE�
_HEXTET_COUNTr��
_parse_hextetr)riru�partsZ
_min_partsrfZipv4_intr�Z
_max_partsZ
skip_index�iZparts_hiZparts_loZ
parts_skippedrmr
r
rrts�
$







z_BaseV6._ip_int_from_stringcCs>|j�|�std|��t|�dkr4d}t||��t|d�S)a&Convert an IPv6 hextet string into an integer.

        Args:
            hextet_str: A string, the number to parse.

        Returns:
            The hextet as an integer.

        Raises:
            ValueError: if the input isn't strictly a hex number from
              [0..FFFF].

        zOnly hex digits permitted in %rrz$At most 4 characters permitted in %rr )�_HEX_DIGITS�
issupersetrr&rr)riZ
hextet_strrfr
r
rr~sz_BaseV6._parse_hextetc	Cs�d}d}d}d}t|�D]>\}}|dkrN|d7}|dkr<|}||krV|}|}qd}d}q|dkr�||}|t|�kr~|dg7}dg|||�<|dkr�dg|}|S)a�Compresses a list of hextets.

        Compresses a list of strings, replacing the longest continuous
        sequence of "0" in the list with "" and adding empty strings at
        the beginning or at the end of the string such that subsequently
        calling ":".join(hextets) will produce the compressed version of
        the IPv6 address.

        Args:
            hextets: A list of strings, the hextets to compress.

        Returns:
            A list of strings.

        rKrr�r)�)�	enumerater&)	ri�hextetsZbest_doublecolon_startZbest_doublecolon_lenZdoublecolon_startZdoublecolon_len�indexZhextetZbest_doublecolon_endr
r
r�_compress_hextets�s0�

z_BaseV6._compress_hextetsNcsZ|dkrt|j�}||jkr$td��d|��fdd�tddd�D�}|�|�}d	�|�S)
a,Turns a 128-bit integer into hexadecimal notation.

        Args:
            ip_int: An integer, the IP address.

        Returns:
            A string, the hexadecimal representation of the address.

        Raises:
            ValueError: The address is bigger than 128 bits of all ones.

        NzIPv6 address is too large�%032xcs&g|]}dt�||d�d��qS)rrr )rr�r�r��Zhex_strr
r�
<listcomp>�sz/_BaseV6._string_from_ip_int.<locals>.<listcomp>rrrr)rrr,r>rr�rr�)rirmrr
rrr��s


z_BaseV6._string_from_ip_intcs�t|t�rt|j�}nt|t�r,t|j�}nt|�}|�|�}d|��fdd�tddd�D�}t|ttf�r�dd�	|�|j
fSd�	|�S)	z�Expand a shortened IPv6 address.

        Args:
            ip_str: A string, the IPv6 address.

        Returns:
            A string, the expanded IPv6 address.

        rcsg|]}�||d��qS)rr
rrr
rr�sz8_BaseV6._explode_shorthand_ip_string.<locals>.<listcomp>rrrr�r)r9rr$rOrr1rtr�rSr�rM)r\rurmrr
rrrZ�s



z$_BaseV6._explode_shorthand_ip_stringcCs&|jddd��dd�}d�|�dS)z�Return the reverse DNS pointer name for the IPv6 address.

        This implements the method described in RFC3596 2.5.

        NrKrrr�z	.ip6.arpa)r]�replacer�)r\Z
reverse_charsr
r
rr`�sz_BaseV6._reverse_pointercCs|jSrzr�r[r
r
rr�sz_BaseV6.max_prefixlencCs|jSrzr�r[r
r
rr<sz_BaseV6.version)N)rrrr	r}rL�
IPV6LENGTHr>r�	frozensetrr=r�rr�rtrrr�rZr`r~r�r<r
r
r
rr
�s0

g

/	
r
c@s�eZdZdZdZdd�Zedd��Zedd��Zed	d
��Z	edd��Z
ed
d��Zee�
�dd���Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��ZdS)rz/Represent and manipulate single IPv6 Addresses.r�cCsrt|t�r|�|�||_dSt|t�rF|�|d�t�|d�|_dSt|�}d|krbtd|��|�	|�|_dS)aInstantiate a new IPv6 address object.

        Args:
            address: A string or integer representing the IP

              Additionally, an integer can be passed, so
              IPv6Address('2001:db8::') ==
                IPv6Address(42540766411282592856903984951653826560)
              or, more generally
              IPv6Address(int(IPv6Address('2001:db8::'))) ==
                IPv6Address('2001:db8::')

        Raises:
            AddressValueError: If address isn't a valid IPv6 address.

        Nr rr"r�r�r�r
r
rr�s


zIPv6Address.__init__cCs
t|j�Sr�)r!r,r[r
r
rr�6szIPv6Address.packedcCs||jjkSr�r�r[r
r
rr�;s	zIPv6Address.is_multicastcst�fdd��jjD��S)r�c3s|]}�|kVqdSrzr
rr[r
rr�Osz*IPv6Address.is_reserved.<locals>.<genexpr>)r�r��_reserved_networksr[r
r[rr�Fs	zIPv6Address.is_reservedcCs||jjkSr�r�r[r
r
rr�QszIPv6Address.is_link_localcCs||jjkS�a`Test if the address is reserved for site-local.

        Note that the site-local address space has been deprecated by RFC 3879.
        Use is_private to test if this address is in the space of unique local
        addresses as defined by RFC 4193.

        Returns:
            A boolean, True if the address is reserved per RFC 3513 2.5.6.

        )r��_sitelocal_networkr[r
r
r�
is_site_local[szIPv6Address.is_site_localcst�fdd��jjD��S)z�Test if this address is allocated for private networks.

        Returns:
            A boolean, True if the address is reserved per
            iana-ipv6-special-registry.

        c3s|]}�|kVqdSrzr
r�r[r
rr�ssz)IPv6Address.is_private.<locals>.<genexpr>r�r[r
r[rr�is
zIPv6Address.is_privatecCs|jS)z�Test if this address is allocated for public networks.

        Returns:
            A boolean, true if the address is not reserved per
            iana-ipv6-special-registry.

        r�r[r
r
rr�us	zIPv6Address.is_globalcCs
|jdkS)r�rr�r[r
r
rr��s	zIPv6Address.is_unspecifiedcCs
|jdkS)r�r)r�r[r
r
rr��s	zIPv6Address.is_loopbackcCs |jd?dkrdSt|jd@�S)z�Return the IPv4 mapped address.

        Returns:
            If the IPv6 address is a v4 mapped address, return the
            IPv4 mapped address. Return None otherwise.

        rrN����r,r
r[r
r
r�ipv4_mapped�s	zIPv6Address.ipv4_mappedcCs4|jd?dkrdSt|jd?d@�t|jd@�fS)z�Tuple of embedded teredo IPs.

        Returns:
            Tuple of the (server, client) IPs or None if the address
            doesn't appear to be a teredo address (doesn't start with
            2001::/32)

        �`i N�@r'r(r[r
r
r�teredo�s

�zIPv6Address.teredocCs$|jd?dkrdSt|jd?d@�S)z�Return the IPv4 6to4 embedded address.

        Returns:
            The IPv4 6to4-embedded address if present or None if the
            address doesn't appear to contain a 6to4 embedded address.

        �pi N�Pr'r(r[r
r
r�	sixtofour�s	zIPv6Address.sixtofourN)rrrr	r}r�r~r�r�r�r�r&r�r�r�r�r�r�r)r,r/r
r
r
rrs8$





	










rc@s�eZdZdd�Zejdd��Zdd�Zdd�Zd	d
�Z	dd�Z
ejZe
d
d��Ze
dd��Ze
dd��Ze
dd��Ze
dd��Ze
dd��ZdS)rcCsD|�|�\}}t�||�t||fdd�|_|jj|_|jj|_dSr�)ryrr�rr�r�rMr�r
r
rr��s

zIPv6Interface.__init__cCs|jjSrzr�r[r
r
rr��szIPv6Interface.hostmaskcCsd|�|j�|jfSr�rr[r
r
rr��s�zIPv6Interface.__str__cCsFt�||�}|r|tkr|Sz|j|jkWStk
r@YdSXdSr�)rr�rVr�rNrr
r
rr��szIPv6Interface.__eq__cCsRt�||�}|tkrtSz|j|jkp4|j|jko4|WStk
rLYdSXdSr�)rr�rVr�rNrr
r
rr��s�zIPv6Interface.__lt__cCst|j|jt|jj�f�Srzrr[r
r
rr��szIPv6Interface.__hash__cCs
t|j�Srz)rr,r[r
r
rr1�szIPv6Interface.ipcCsd|�|j�|jfSr�rr[r
r
rr��s�zIPv6Interface.with_prefixlencCsd|�|j�|jfSr�rr[r
r
rr��s�zIPv6Interface.with_netmaskcCsd|�|j�|jfSr�rr[r
r
rr��s�zIPv6Interface.with_hostmaskcCs|jdko|jjS)Nr)r,r�r�r[r
r
rr�szIPv6Interface.is_unspecifiedcCs|jdko|jjSr�)r,r�r�r[r
r
rr�szIPv6Interface.is_loopbackN)rrrr�r�r�r�r�r�r�r�rYr|r~r1r�r�r�r�r�r
r
r
rr�s(





rc@s2eZdZdZeZd
dd�Zdd�Zedd��Z	d	S)ravThis class represents and manipulates 128-bit IPv6 networks.

    Attributes: [examples for IPv6('2001:db8::1000/124')]
        .network_address: IPv6Address('2001:db8::1000')
        .hostmask: IPv6Address('::f')
        .broadcast_address: IPv6Address('2001:db8::100f')
        .netmask: IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff0')
        .prefixlen: 124

    Tcs�|�|�\�}t��|_|�|�\|_|_t|j�}|t|j�@|krl|rXtd|��nt|t|j�@�|_|j|jdkr�|j	|_
n|j|jkr��fdd�|_
dS)a�Instantiate a new IPv6 Network object.

        Args:
            address: A string or integer representing the IPv6 network or the
              IP and prefix/netmask.
              '2001:db8::/128'
              '2001:db8:0000:0000:0000:0000:0000:0000/128'
              '2001:db8::'
              are all functionally the same in IPv6.  That is to say,
              failing to provide a subnetmask will create an object with
              a mask of /128.

              Additionally, an integer can be passed, so
              IPv6Network('2001:db8::') ==
                IPv6Network(42540766411282592856903984951653826560)
              or, more generally
              IPv6Network(int(IPv6Network('2001:db8::'))) ==
                IPv6Network('2001:db8::')

            strict: A boolean. If true, ensure that we have been passed
              A true network address, eg, 2001:db8::1000/124 and not an
              IP address on a network, eg, 2001:db8::1/124.

        Raises:
            AddressValueError: If address isn't a valid IPv6 address.
            NetmaskValueError: If the netmask isn't valid for
              an IPv6 address.
            ValueError: If strict was True and a network address was not
              supplied.
        rr)cs
t��gSrz)rr
rr
rrIr	z&IPv6Network.__init__.<locals>.<lambda>N)ryrrOr�r�rMrrrr=r�r�r
r
rrr�s

�
zIPv6Network.__init__ccs<t|j�}t|j�}t|d|d�D]}|�|�Vq&dS)z�Generate Iterator over usable hosts in a network.

          This is like __iter__ except it doesn't return the
          Subnet-Router anycast address.

        r)Nr�r�r
r
rr�Ks

zIPv6Network.hostscCs|jjo|jjSr$)rOr&rHr[r
r
rr&Ws�zIPv6Network.is_site_localN)T)
rrrr	rr�r�r�r~r&r
r
r
rrs
0rc@s�eZdZed�Zed�Zed�ed�ed�ed�ed�ed�ed	�ed
�ed�ed�g
Zed�ed
�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�gZed�ZdS)�_IPv6Constantsz	fe80::/10zff00::/8z::1/128z::/128z
::ffff:0:0/96z100::/64z	2001::/23z2001:2::/48z
2001:db8::/32z2001:10::/28zfc00::/7z::/8z100::/8z200::/7z400::/6z800::/5z1000::/4z4000::/3z6000::/3z8000::/3zA000::/3zC000::/3zE000::/4zF000::/5zF800::/6zFE00::/9z	fec0::/10N)	rrrrr�r�r�r#r%r
r
r
rr0gs<��r0)T)#r	�__version__r�r�r!rrrrrrrr!r(r2r6r@rJrRrXrY�total_orderingr:rSr�r
rrrr�r
rrrr0r
r
r
r�<module>sV
#7163:IuCR 5K\!configparser.cpython-38.opt-2.pyc000064400000074112150335716500012630 0ustar00U

e5df��@s�ddlmZddlmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZdddddd	d
ddd
dddddddddddgZe
ZdZdZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGd d�de�ZGd!d�de�ZGd"d
�d
e�ZGd#d�de�ZGd$d	�d	e�ZGd%d�de�ZGd&d
�d
e�Ze�ZGd'd�d�ZGd(d�de�Z Gd)d�de�Z!Gd*d�de�Z"Gd+d�de�Z#Gd,d�de#�Z$Gd-d�de$�Z%Gd.d�de�Z&Gd/d�de�Z'dS)0�)�MutableMapping)�ChainMapN�NoSectionError�DuplicateOptionError�DuplicateSectionError�
NoOptionError�InterpolationError�InterpolationDepthError�InterpolationMissingOptionError�InterpolationSyntaxError�ParsingError�MissingSectionHeaderError�ConfigParser�SafeConfigParser�RawConfigParser�
Interpolation�BasicInterpolation�ExtendedInterpolation�LegacyInterpolation�SectionProxy�ConverterMapping�DEFAULTSECT�MAX_INTERPOLATION_DEPTHZDEFAULT�
c@s"eZdZddd�Zdd�ZeZdS)�Error�cCs||_t�||�dS�N)�message�	Exception�__init__)�self�msg�r"�$/usr/lib64/python3.8/configparser.pyr�szError.__init__cCs|jSr)r�r r"r"r#�__repr__�szError.__repr__N)r)�__name__�
__module__�__qualname__rr%�__str__r"r"r"r#r�s
rc@seZdZdd�ZdS)rcCs$t�|d|f�||_|f|_dS)NzNo section: %r)rr�section�args�r r*r"r"r#r�szNoSectionError.__init__N�r&r'r(rr"r"r"r#r�sc@seZdZddd�ZdS)rNcCs�t|�dg}|dk	rRdt|�g}|dk	r8|�d�|��|�d�|�|�|}n|�dd�t�|d�|��||_||_	||_
|||f|_dS)N� already exists�While reading from � [line {0:2d}]z
: section rzSection r)�repr�append�format�extend�insertrr�joinr*�source�linenor+)r r*r7r8r!rr"r"r#r�s

zDuplicateSectionError.__init__)NNr-r"r"r"r#r�sc@seZdZddd�ZdS)rNcCs�t|�dt|�dg}|dk	rZdt|�g}|dk	r@|�d�|��|�d�|�|�|}n|�dd�t�|d�|��||_||_	||_
||_||||f|_dS)	Nz in section r.r/r0z	: option rzOption r)
r1r2r3r4r5rrr6r*�optionr7r8r+)r r*r9r7r8r!rr"r"r#r�s"�

zDuplicateOptionError.__init__)NNr-r"r"r"r#r�sc@seZdZdd�ZdS)rcCs.t�|d||f�||_||_||f|_dS)NzNo option %r in section: %r�rrr9r*r+)r r9r*r"r"r#r�s�zNoOptionError.__init__Nr-r"r"r"r#r�sc@seZdZdd�ZdS)rcCs(t�||�||_||_|||f|_dSrr:)r r9r*r!r"r"r#rszInterpolationError.__init__Nr-r"r"r"r#r�sc@seZdZdd�ZdS)r
cCs8d�||||�}t�||||�||_||||f|_dS)Nz�Bad value substitution: option {!r} in section {!r} contains an interpolation key {!r} which is not a valid option name. Raw value: {!r})r3rr�	referencer+)r r9r*�rawvalr;r!r"r"r#rs�z(InterpolationMissingOptionError.__init__Nr-r"r"r"r#r
sc@seZdZdS)rN)r&r'r(r"r"r"r#rsc@seZdZdd�ZdS)r	cCs0d�||t|�}t�||||�|||f|_dS)Nz�Recursion limit exceeded in value substitution: option {!r} in section {!r} contains an interpolation key which cannot be substituted in {} steps. Raw value: {!r})r3rrrr+)r r9r*r<r!r"r"r#rs�z InterpolationDepthError.__init__Nr-r"r"r"r#r	sc@s8eZdZd	dd�Zedd��Zejdd��Zdd�ZdS)
rNcCsT|r|rtd��n|s$|s$td��n|r,|}t�|d|�||_g|_|f|_dS)Nz:Cannot specify both `filename' and `source'. Use `source'.z%Required argument `source' not given.z"Source contains parsing errors: %r)�
ValueErrorrrr7�errorsr+)r r7�filenamer"r"r#r,s

zParsingError.__init__cCstjdtdd�|jS�NzSThe 'filename' attribute will be removed in future versions.  Use 'source' instead.���
stacklevel��warnings�warn�DeprecationWarningr7r$r"r"r#r?;s�zParsingError.filenamecCstjdtdd�||_dSr@rD�r �valuer"r"r#r?Es�cCs*|j�||f�|jd||f7_dS)Nz
	[line %2d]: %s)r>r2r)r r8�liner"r"r#r2OszParsingError.append)NN)r&r'r(r�propertyr?�setterr2r"r"r"r#r)s

	
	c@seZdZdd�ZdS)r
cCs8t�|d|||f�||_||_||_|||f|_dS)Nz7File contains no section headers.
file: %r, line: %d
%r)rrr7r8rJr+)r r?r8rJr"r"r#rWs��z"MissingSectionHeaderError.__init__Nr-r"r"r"r#r
Tsc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rcCs|Srr")r �parserr*r9rI�defaultsr"r"r#�
before_getkszInterpolation.before_getcCs|Srr"�r rMr*r9rIr"r"r#�
before_setnszInterpolation.before_setcCs|Srr"rPr"r"r#�before_readqszInterpolation.before_readcCs|Srr"rPr"r"r#�before_writetszInterpolation.before_writeN)r&r'r(rOrQrRrSr"r"r"r#rhsc@s.eZdZe�d�Zdd�Zdd�Zdd�ZdS)	rz
%\(([^)]+)\)sc	Cs$g}|�||||||d�d�|�S�N�r��_interpolate_somer6�r rMr*r9rIrN�Lr"r"r#rO�szBasicInterpolation.before_getcCs<|�dd�}|j�d|�}d|kr8td||�d�f��|S)Nz%%r�%�1invalid interpolation syntax in %r at position %d��replace�_KEYCRE�subr=�find�r rMr*r9rIZ	tmp_valuer"r"r#rQ�s�zBasicInterpolation.before_setc
Csj|j||d|d�}|tkr&t|||��|�rf|�d�}	|	dkrL|�|�dS|	dkrr|�|d|	��||	d�}|dd�}
|
dkr�|�d�|dd�}q&|
dk�rR|j�|�}|dkr�t||d|��|�|�	d��}||�
�d�}z||}
Wn&tk
�rt||||�d�YnXd|
k�rF|�
||||
|||d�n
|�|
�q&t||d	|f��q&dS)
NT��raw�fallbackrZrrUrA�(�'bad interpolation variable reference %rz/'%%' must be followed by '%%' or '(', found: %r)�getrr	r`r2r^�matchr�optionxform�group�end�KeyErrorr
rW)r rMr9�accum�restr*�map�depthr<�p�c�m�var�vr"r"r#rW�s`



���
���z$BasicInterpolation._interpolate_someN�	r&r'r(�re�compiler^rOrQrWr"r"r"r#rxs
c@s.eZdZe�d�Zdd�Zdd�Zdd�ZdS)	rz
\$\{([^}]+)\}c	Cs$g}|�||||||d�d�|�SrTrVrXr"r"r#rO�sz ExtendedInterpolation.before_getcCs<|�dd�}|j�d|�}d|kr8td||�d�f��|S)Nz$$r�$r[r\rar"r"r#rQ�s�z ExtendedInterpolation.before_setcCs�|j||d|d�}|tkr&t|||��|�r�|�d�}	|	dkrL|�|�dS|	dkrr|�|d|	��||	d�}|dd�}
|
dkr�|�d�|dd�}q&|
dk�r�|j�|�}|dkr�t||d|��|�d��	d	�}||�
�d�}|}
|}zrt|�dk�r|�|d�}||}nHt|�dk�rR|d}
|�|d�}|j|
|dd
�}nt||d|f��Wn2t
ttfk
�r�t|||d	�|��d�YnXd|k�r�|�|||||
t|j|
dd
��|d�n
|�|�q&t||d|f��q&dS)
NTrbryrrUrA�{rf�:)rczMore than one ':' found: %rz-'$' must be followed by '$' or '{', found: %r)rgrr	r`r2r^rhrrj�splitrk�lenrirlrrr
r6rW�dict�items)r rMr9rmrnr*rorpr<rqrrrs�pathZsect�optrur"r"r#rW�sx



�
���
���z'ExtendedInterpolation._interpolate_someNrvr"r"r"r#r�s
c@s2eZdZe�d�Zdd�Zdd�Zedd��Z	dS)	rz%\(([^)]*)\)s|.c

Cs�|}t}|r�|d8}|r�d|kr�tj|j|d�}|j�||�}z||}Wq�tk
r�}	zt||||	jd�d�W5d}	~	XYq�Xqq�q|r�d|kr�t	|||��|S)NrUz%()rMr)
r�	functools�partial�_interpolation_replacer^r_rlr
r+r	)
r rMr*r9rI�varsr<rpr]�er"r"r#rOs0���zLegacyInterpolation.before_getcCs|Srr"rPr"r"r#rQ$szLegacyInterpolation.before_setcCs,|�d�}|dkr|��Sd|�|�SdS)NrUz%%(%s)s)rjri)rhrM�sr"r"r#r�'s
z*LegacyInterpolation._interpolation_replaceN)
r&r'r(rwrxr^rOrQ�staticmethodr�r"r"r"r#r
s

c
s2eZdZdZdZdZe�Ze�	eej
�Ze�	ejdd�ej
�Z
e�	ejdd�ej
�Ze�	d�Zddddddddd	�Zd
edfddd
ddeeed
�dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdcdd�Zdddd�Zdedd �Zdfd"d#�Zdgd$d%�Zdd
ed&�d'd(�Zd)d*�Z dd
ed&�d+d,�Z!dd
ed&�d-d.�Z"dd
ed&�d/d0�Z#dd
ed&�d1d2�Z$edd
f�fd3d4�	Z%d5d6�Z&d7d8�Z'd9d:�Z(dhd;d<�Z)did=d>�Z*d?d@�Z+dAdB�Z,dCdD�Z-dEdF�Z.dGdH�Z/dIdJ�Z0dKdL�Z1dMdN�Z2dOdP�Z3dQdR�Z4dSdT�Z5dUdV�Z6dWdX�Z7dYdZ�Z8d[d\�Z9d]d]d]d^�d_d`�Z:e;dadb��Z<�Z=S)jrz�
        \[                                 # [
        (?P<header>[^]]+)                  # very permissive!
        \]                                 # ]
        a�
        (?P<option>.*?)                    # very permissive!
        \s*(?P<vi>{delim})\s*              # any number of space/tab,
                                           # followed by any of the
                                           # allowed delimiters,
                                           # followed by any space/tab
        (?P<value>.*)$                     # everything up to eol
        a�
        (?P<option>.*?)                    # very permissive!
        \s*(?:                             # any number of space/tab,
        (?P<vi>{delim})\s*                 # optionally followed by
                                           # any of the allowed
                                           # delimiters, followed by any
                                           # space/tab
        (?P<value>.*))?$                   # everything up to eol
        z=|:�Zdelimz\STF)�1Zyes�trueZon�0ZnoZfalseZoffN��=r{)�#�;)�
delimiters�comment_prefixes�inline_comment_prefixes�strict�empty_lines_in_values�default_section�
interpolation�
convertersc
Cs<||_|��|_|��|_t|�|_|��|_t||	�|j|	<t|�|_|dkrd|rZ|j	n|j
|_nNd�dd�|D��}|r�t
�|jj|d�t
j�|_nt
�|jj|d�t
j�|_t|p�d�|_t|p�d�|_||_||_||_|	|_|
|_|jtkr�|j|_|jdk�rt�|_|tk	�r(|j�|�|�r8|�|�dS)Nr��|css|]}t�|�VqdSr)rw�escape)�.0�dr"r"r#�	<genexpr>jsz+RawConfigParser.__init__.<locals>.<genexpr>r�r")�_dict�	_sections�	_defaultsr�_converters�_proxiesr�tuple�_delimiters�	OPTCRE_NV�OPTCRE�_optcrer6rwrx�_OPT_NV_TMPLr3�VERBOSE�	_OPT_TMPL�_comment_prefixes�_inline_comment_prefixes�_strict�_allow_no_value�_empty_lines_in_valuesr��_interpolation�_UNSET�_DEFAULT_INTERPOLATIONr�update�_read_defaults)
r rNZ	dict_typeZallow_no_valuer�r�r�r�r�r�r�r�r�r"r"r#rYs@




��

zRawConfigParser.__init__cCs|jSr)r�r$r"r"r#rN�szRawConfigParser.defaultscCst|j���Sr)�listr��keysr$r"r"r#�sections�szRawConfigParser.sectionscCsJ||jkrtd|��||jkr(t|��|��|j|<t||�|j|<dS)NzInvalid section name: %r)r�r=r�rr�rr�r,r"r"r#�add_section�s

zRawConfigParser.add_sectioncCs
||jkSr)r�r,r"r"r#�has_section�szRawConfigParser.has_sectioncCsJz|j|��}Wntk
r0t|�d�YnX|�|j�t|���Sr)r��copyrlrr�r�r�r�)r r*Zoptsr"r"r#�options�szRawConfigParser.optionsc
Cs�t|tttjf�r|g}g}|D]f}z(t||d��}|�||�W5QRXWntk
rdYq YnXt|tj�r|t�|�}|�	|�q |S)N)�encoding)
�
isinstance�str�bytes�os�PathLike�open�_read�OSError�fspathr2)r �	filenamesr�Zread_okr?�fpr"r"r#�read�s

zRawConfigParser.readcCs<|dkr,z
|j}Wntk
r*d}YnX|�||�dS)Nz<???>)�name�AttributeErrorr�)r �fr7r"r"r#�	read_file�s

zRawConfigParser.read_file�<string>cCst�|�}|�||�dSr)�io�StringIOr�)r �stringr7Zsfiler"r"r#�read_string�s
zRawConfigParser.read_string�<dict>c
Cs�t�}|��D]�\}}t|�}z|�|�Wn(ttfk
rT|jrP||krP�YnX|�|�|��D]`\}}|�t|��}|dk	r�t|�}|jr�||f|kr�t	|||��|�||f�|�|||�qhqdSr)
�setrr�r�rr=r��addrir)r Z
dictionaryr7�elements_addedr*r��keyrIr"r"r#�	read_dict�s"

zRawConfigParser.read_dictcCs"tjdtdd�|j||d�dS)NzRThis method will be removed in future versions.  Use 'parser.read_file()' instead.rArB)r7)rErFrGr�)r r�r?r"r"r#�readfp�s�zRawConfigParser.readfp�rcr�rdcCs�z|�||�}Wn(tk
r8|tkr,�n|YSYnX|�|�}z||}Wn0tk
r�|tkrtt||��n|YSYnX|s�|dkr�|S|j�|||||�SdSr)�
_unify_valuesrr�rirlrr�rO)r r*r9rcr�rdr�rIr"r"r#rg�s$
�zRawConfigParser.getcKs||j||f|��Sr)rg)r r*�convr9�kwargsr"r"r#�_get"szRawConfigParser._getc	KsJz|j|||f||d�|��WSttfk
rD|tkr<�|YSXdS)N)rcr�)r�rrr�)r r*r9r�rcr�rdr�r"r"r#�	_get_conv%s�zRawConfigParser._get_convcKs|j||tf|||d�|��S�Nr�)r��int�r r*r9rcr�rdr�r"r"r#�getint0s
��zRawConfigParser.getintcKs|j||tf|||d�|��Sr�)r��floatr�r"r"r#�getfloat5s
��zRawConfigParser.getfloatcKs |j|||jf|||d�|��Sr�)r��_convert_to_booleanr�r"r"r#�
getboolean:s��zRawConfigParser.getbooleancs��tkrt���S�j���z���j��Wn&tk
rV��jkrRt	���YnXt
����}|r�|��D]\}}|���|�<qp���fdd��|r��fdd���fdd�|D�S)Ncs�j���|�|��Sr)r�rO�r9)r�r*r r"r#�<lambda>Ws
�z'RawConfigParser.items.<locals>.<lambda>cs�|Srr"r�)r�r"r#r�Z�csg|]}|�|�f�qSr"r")r�r9)�value_getterr"r#�
<listcomp>[sz)RawConfigParser.items.<locals>.<listcomp>)
r��superrr�r�r�r�rlr�rr�r�ri)r r*rcr�Z	orig_keysr�rI��	__class__)r�r*r r�r#r?s 


zRawConfigParser.itemscCs.|��D]}||}||=||fSt�dSr)r�rl�r r�rIr"r"r#�popitem]s
zRawConfigParser.popitemcCs|��Sr)�lower)r Z	optionstrr"r"r#rijszRawConfigParser.optionxformcCsV|r||jkr"|�|�}||jkS||jkr0dS|�|�}||j|kpP||jkSdS)NF)r�rir�r�)r r*r9r"r"r#�
has_optionms



�zRawConfigParser.has_optioncCsl|r|j�||||�}|r$||jkr,|j}n.z|j|}Wntk
rXt|�d�YnX|||�|�<dSr)r�rQr�r�r�rlrri)r r*r9rI�sectdictr"r"r#r�{s�zRawConfigParser.setcCsh|rd�|jd�}n
|jd}|jr>|�||j|j��|�|jD]}|�|||j|��|�qDdS)Nz {} r)r3r�r��_write_sectionr�rr�)r r�Zspace_around_delimitersr�r*r"r"r#�write�s

�
�zRawConfigParser.writecCsx|�d�|��|D]T\}}|j�||||�}|dk	s<|jsR|t|��dd�}nd}|�d�||��q|�d�dS)Nz[{}]
�
z
	rz{}{}
)r�r3r�rSr�r�r])r r�Zsection_nameZ
section_itemsZ	delimiterr�rIr"r"r#r��s�zRawConfigParser._write_sectioncCsd|r||jkr|j}n.z|j|}Wntk
rBt|�d�YnX|�|�}||k}|r`||=|Sr)r�r�r�rlrri)r r*r9r��existedr"r"r#�
remove_option�s
zRawConfigParser.remove_optioncCs"||jk}|r|j|=|j|=|Sr)r�r�)r r*r�r"r"r#�remove_section�s

zRawConfigParser.remove_sectioncCs&||jkr|�|�st|��|j|Sr)r�r�rlr��r r�r"r"r#�__getitem__�szRawConfigParser.__getitem__cCsX||kr|||krdS||jkr.|j��n||jkrF|j|��|�||i�dSr)r�r��clearr�r�r�r"r"r#�__setitem__�s

zRawConfigParser.__setitem__cCs2||jkrtd��|�|�s$t|��|�|�dS)Nz"Cannot remove the default section.)r�r=r�rlr�r�r"r"r#�__delitem__�s


zRawConfigParser.__delitem__cCs||jkp|�|�Sr)r�r�r�r"r"r#�__contains__�szRawConfigParser.__contains__cCst|j�dS)NrU)r}r�r$r"r"r#�__len__�szRawConfigParser.__len__cCst�|jf|j���Sr)�	itertools�chainr�r�r�r$r"r"r#�__iter__�szRawConfigParser.__iter__cCs t�}d}d}d}d}d}d}	t|dd�D�]�\}}
tj}dd�|jD�}|tjkr�|r�i}
|��D]T\}}|
�||d�}|dkr�qd||
|<|dks�|dkrd|
|d��rdt||�}qd|
}qJ|j	D]}|
�
��|�r�d}q�q�|tjkr�d}|
d|��
�}|�sN|j�rF|dk�rL|dk	�rL|�rL||dk	�rL||�
d�q*tj}q*|j�|
�}|�rh|��nd}|dk	�r�|�r�||k�r�||�
|�q*|}|j�|�}|�r<|�d�}||jk�r�|j�r�||k�r�t|||��|j|}|�|�n@||jk�r
|j}n,|��}||j|<t||�|j|<|�|�d}q*|dk�rTt|||
��q*|j�|�}|�r�|�d	d
d�\}}}|�s�|�|	|||
�}	|� |�!��}|j�r�||f|k�r�t"||||��|�||f�|dk	�r�|�
�}|g||<nd||<q*|�|	|||
�}	q*|�#�|	�r|	�dS)NrrU)�startcSsi|]
}|d�qS)���r")r�rqr"r"r#�
<dictcomp>�sz)RawConfigParser._read.<locals>.<dictcomp>rr�headerr9�virI)$r��	enumerate�sys�maxsizer�rr`�isspace�minr��strip�
startswithr�r2�NONSPACECRE�searchr�SECTCRErhrjr�r�rr�r�r�r�rr�r
r��
_handle_errorri�rstripr�_join_multiline_values)r r��fpnamer�ZcursectZsectnameZoptnamer8Zindent_levelr�rJZ
comment_startZinline_prefixesZ
next_prefixes�prefix�indexrIZfirst_nonspaceZcur_indent_levelZmorZoptvalr"r"r#r��s� 


��
��
�




��

zRawConfigParser._readcCsr|j|jf}t�|f|j���}|D]H\}}|��D]6\}}t|t�rTd�|��	�}|j
�||||�||<q4q$dS)Nr�)r�r�rrr�rr�r�r6rr�rR)r rNZall_sectionsr*r�r��valr"r"r#r[s�
�z&RawConfigParser._join_multiline_valuescCs&|��D]\}}||j|�|�<qdSr)rr�ri)r rNr�rIr"r"r#r�gszRawConfigParser._read_defaultscCs |st|�}|�|t|��|Sr)rr2r1)r �excrr8rJr"r"r#rmszRawConfigParser._handle_errorcCs�i}z|j|}Wn(tk
r:||jkr6t|�d�YnXi}|rt|��D]&\}}|dk	rdt|�}|||�|�<qLt|||j�Sr)	r�rlr�rrr�ri�	_ChainMapr�)r r*r�ZsectiondictZvardictr�rIr"r"r#r�ss
zRawConfigParser._unify_valuescCs(|��|jkrtd|��|j|��S)NzNot a boolean: %s)r��BOOLEAN_STATESr=rHr"r"r#r��sz#RawConfigParser._convert_to_booleanr)r*r9rIcCsDt|t�std��t|t�s$td��|jr.|r@t|t�s@td��dS)Nzsection names must be stringszoption keys must be stringszoption values must be strings)r�r��	TypeErrorr��r r*r9rIr"r"r#�_validate_value_types�s



z%RawConfigParser._validate_value_typescCs|jSr)r�r$r"r"r#r��szRawConfigParser.converters)N)N)r�)r�)N)N)T)>r&r'r(Z
_SECT_TMPLr�r�rr�rwrxr�rr3r�r�rr�
_default_dictrr�rrNr�r�r�r�r�r�r�r�r�rgr�r�r�r�r�rr�rir�r�r�r�r�r�r�r�r�r�rrr�rr�rr�r�rrKr��
__classcell__r"r"r�r#r0s�

���(	




	%����




zcs8eZdZe�Zd�fdd�	Z�fdd�Zdd�Z�ZS)	rNcs"|j||d�t��|||�dS�N)r9rI)rr�r�rr�r"r#r��szConfigParser.setcs|j|d�t��|�dS)N)r*)rr�r�r,r�r"r#r��szConfigParser.add_sectioncCs0z"|j}t�|_|�|j|i�W5||_XdSr)r�rr�r�)r rNZhold_interpolationr"r"r#r��s
zConfigParser._read_defaults)N)	r&r'r(rr�r�r�r�r!r"r"r�r#r�scseZdZ�fdd�Z�ZS)rcs"t�j||�tjdtdd�dS)Nz�The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.rArB)r�rrErFrG)r r+r�r�r"r#r�s�zSafeConfigParser.__init__)r&r'r(rr!r"r"r�r#r�sc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zedd��Z
edd��Zddddd�dd�ZdS)rcCsF||_||_|jD].}d|}tj|jt||�d�}t|||�qdS)Nrg��_impl)�_parser�_namer�r�r�rg�getattr�setattr)r rMr�r�r��getterr"r"r#r�s
zSectionProxy.__init__cCsd�|j�S)Nz
<Section: {}>)r3r&r$r"r"r#r%�szSectionProxy.__repr__cCs(|j�|j|�st|��|j�|j|�Sr)r%r�r&rlrgr�r"r"r#r��szSectionProxy.__getitem__cCs"|jj||d�|j�|j||�Sr")r%rr�r&r�r"r"r#r��szSectionProxy.__setitem__cCs,|j�|j|�r |j�|j|�s(t|��dSr)r%r�r&r�rlr�r"r"r#r��s�zSectionProxy.__delitem__cCs|j�|j|�Sr)r%r�r&r�r"r"r#r��szSectionProxy.__contains__cCst|���Sr)r}�_optionsr$r"r"r#r�szSectionProxy.__len__cCs|����Sr)r*rr$r"r"r#r�szSectionProxy.__iter__cCs*|j|jjkr|j�|j�S|j��SdSr)r&r%r�r�rNr$r"r"r#r*�szSectionProxy._optionscCs|jSr)r%r$r"r"r#rMszSectionProxy.parsercCs|jSr)r&r$r"r"r#r�szSectionProxy.nameNF)rcr�r$cKs(|s|jj}||j|f|||d�|��Sr�)r%rgr&)r r9rdrcr�r$r�r"r"r#rgs
��zSectionProxy.get)N)r&r'r(rr%r�r�r�r�rrr*rKrMr�rgr"r"r"r#r�s 	

�c@sFeZdZe�d�Zdd�Zdd�Zdd�Zdd	�Z	d
d�Z
dd
�ZdS)rz^get(?P<name>.+)$cCsR||_i|_t|j�D]6}|j�|�}|rtt|j|��s<qd|j|�d�<qdS)Nr�)r%�_data�dir�	GETTERCRErh�callabler'rj)r rMr)rsr"r"r#r%szConverterMapping.__init__cCs
|j|Sr)r+r�r"r"r#r�.szConverterMapping.__getitem__c	Cs�zd|}Wn(tk
r4td�|t|����YnX|dkrFtd��||j|<tj|jj|d�}||_	t
|j||�|j��D] }tj|j|d�}t
|||�q�dS)NrgzIncompatible key: {} (type: {})z)Incompatible key: cannot use "" as a name)r�r#)
rr=r3�typer+r�r�r%r�Z	converterr(�valuesrg)r r�rI�k�func�proxyr)r"r"r#r�1s �
zConverterMapping.__setitem__c	Cs~zd|p
d}Wntk
r,t|��YnX|j|=t�|jf|j���D],}zt||�WqLtk
rvYqLYqLXqLdS)Nrg)	rrlr+rrr%r0�delattrr�)r r�r1�instr"r"r#r�AszConverterMapping.__delitem__cCs
t|j�Sr)�iterr+r$r"r"r#rOszConverterMapping.__iter__cCs
t|j�Sr)r}r+r$r"r"r#rRszConverterMapping.__len__N)r&r'r(rwrxr-rr�r�r�rrr"r"r"r#rs
	)(Zcollections.abcr�collectionsrrr�r�rr�rwr
rE�__all__r~r rrrrrrrrrr
rr	rr
�objectr�rrrrrrrrrr"r"r"r#�<module>�sp�	
	

+HJ&| 
Ffileinput.cpython-38.pyc000064400000032077150335716500011211 0ustar00U

e5du9�@s�dZddlZddlZddddddd	d
ddd
dgZdad"ddd�dd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd	�Zdd
�Zdd�Z
Gdd�d�Zdd
�Zd#dd�Zdd �Zed!kr�e�dS)$a
Helper class to quickly write a loop over all standard input files.

Typical use is:

    import fileinput
    for line in fileinput.input():
        process(line)

This iterates over the lines of all files listed in sys.argv[1:],
defaulting to sys.stdin if the list is empty.  If a filename is '-' it
is also replaced by sys.stdin and the optional arguments mode and
openhook are ignored.  To specify an alternative list of filenames,
pass it as the argument to input().  A single file name is also allowed.

Functions filename(), lineno() return the filename and cumulative line
number of the line that has just been read; filelineno() returns its
line number in the current file; isfirstline() returns true iff the
line just read is the first line of its file; isstdin() returns true
iff the line was read from sys.stdin.  Function nextfile() closes the
current file so that the next iteration will read the first line from
the next file (if any); lines not read from the file will not count
towards the cumulative line count; the filename is not changed until
after the first line of the next file has been read.  Function close()
closes the sequence.

Before any lines have been read, filename() returns None and both line
numbers are zero; nextfile() has no effect.  After all lines have been
read, filename() and the line number functions return the values
pertaining to the last line read; nextfile() has no effect.

All files are opened in text mode by default, you can override this by
setting the mode parameter to input() or FileInput.__init__().
If an I/O error occurs during opening or reading a file, the OSError
exception is raised.

If sys.stdin is used more than once, the second and further use will
return no lines, except perhaps for interactive use, or if it has been
explicitly reset (e.g. using sys.stdin.seek(0)).

Empty files are opened and immediately closed; the only time their
presence in the list of filenames is noticeable at all is when the
last file opened is empty.

It is possible that the last line of a file doesn't end in a newline
character; otherwise lines are returned including the trailing
newline.

Class FileInput is the implementation; its methods filename(),
lineno(), fileline(), isfirstline(), isstdin(), nextfile() and close()
correspond to the functions in the module.  In addition it has a
readline() method which returns the next input line, and a
__getitem__() method which implements the sequence behavior.  The
sequence must be accessed in strictly sequential order; sequence
access and readline() cannot be mixed.

Optional in-place filtering: if the keyword argument inplace=1 is
passed to input() or to the FileInput constructor, the file is moved
to a backup file and standard output is directed to the input file.
This makes it possible to write a filter that rewrites its input file
in place.  If the keyword argument backup=".<some extension>" is also
given, it specifies the extension for the backup file, and the backup
file remains around; by default, the extension is ".bak" and it is
deleted when the output file is closed.  In-place filtering is
disabled when standard input is read.  XXX The current implementation
does not work for MS-DOS 8+3 filesystems.

XXX Possible additions:

- optional getopt argument processing
- isatty()
- read(), read(size), even readlines()

�N�input�close�nextfile�filename�lineno�
filelineno�fileno�isfirstline�isstdin�	FileInput�hook_compressed�hook_encodedF��r��mode�openhookcCs(trtjrtd��t|||||d�atS)aReturn an instance of the FileInput class, which can be iterated.

    The parameters are passed to the constructor of the FileInput class.
    The returned instance, in addition to being an iterator,
    keeps global state for the functions of this module,.
    zinput() already activer)�_state�_file�RuntimeErrorr)�files�inplace�backuprr�r�!/usr/lib64/python3.8/fileinput.pyrSs
cCst}da|r|��dS)zClose the sequence.N)rr)�staterrrr`scCststd��t��S)a�
    Close the current file so that the next iteration will read the first
    line from the next file (if any); lines not read from the file will
    not count towards the cumulative line count. The filename is not
    changed until after the first line of the next file has been read.
    Before the first line has been read, this function has no effect;
    it cannot be used to skip the first file. After the last line of the
    last file has been read, this function has no effect.
    �no active input())rrrrrrrrhs
cCststd��t��S)zr
    Return the name of the file currently being read.
    Before the first line has been read, returns None.
    r)rrrrrrrrvscCststd��t��S)z�
    Return the cumulative line number of the line that has just been read.
    Before the first line has been read, returns 0. After the last line
    of the last file has been read, returns the line number of that line.
    r)rrrrrrrrscCststd��t��S)z�
    Return the line number in the current file. Before the first line
    has been read, returns 0. After the last line of the last file has
    been read, returns the line number of that line within the file.
    r)rrrrrrrr�scCststd��t��S)zg
    Return the file number of the current file. When no file is currently
    opened, returns -1.
    r)rrrrrrrr�scCststd��t��S)ze
    Returns true the line just read is the first line of its file,
    otherwise returns false.
    r)rrr	rrrrr	�scCststd��t��S)z]
    Returns true if the last line was read from sys.stdin,
    otherwise returns false.
    r)rrr
rrrrr
�sc@s�eZdZdZd)ddd�dd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�ZdS)*ra;FileInput([files[, inplace[, backup]]], *, mode=None, openhook=None)

    Class FileInput is the implementation of the module; its methods
    filename(), lineno(), fileline(), isfirstline(), isstdin(), fileno(),
    nextfile() and close() correspond to the functions of the same name
    in the module.
    In addition it has a readline() method which returns the next
    input line, and a __getitem__() method which implements the
    sequence behavior. The sequence must be accessed in strictly
    sequential order; random access and readline() cannot be mixed.
    NFrrrcCst|t�r|f}nBt|tj�r,t�|�f}n(|dkrBtjdd�}|sLd}nt|�}||_||_	||_
d|_d|_d|_
d|_d|_d|_d|_d|_|dkr�td��d|kr�ddl}|�dtd	�||_d|kr�|�d
d�nd|_|�r|r�td��t|��std
��||_dS)N�)�-rF)rZrU�U�rbz=FileInput opening mode must be one of 'r', 'rU', 'U' and 'rb'rz'U' mode is deprecated�r�wz4FileInput cannot use an opening hook in inplace modez#FileInput openhook must be callable)�
isinstance�str�os�PathLike�fspath�sys�argv�tuple�_files�_inplace�_backup�_savestdout�_output�	_filename�_startlineno�_filelinenor�_isstdin�_backupfilename�
ValueError�warnings�warn�DeprecationWarning�_mode�replace�_write_mode�callable�	_openhook)�selfrrrrrr6rrr�__init__�sH
�
zFileInput.__init__cCs|��dS�N�r�r>rrr�__del__�szFileInput.__del__cCsz|��W5d|_XdS)Nr)r+rrBrrrr�szFileInput.closecCs|Sr@rrBrrr�	__enter__�szFileInput.__enter__cCs|��dSr@rA)r>�type�value�	tracebackrrr�__exit__�szFileInput.__exit__cCs|Sr@rrBrrr�__iter__�szFileInput.__iter__cCs6|��}|r|jd7_|S|js(t�|��qdS�Nr)�	_readliner2r�
StopIterationr�r>�linerrr�__next__�szFileInput.__next__cCsXddl}|jdtdd�||��kr,td��z
|��WStk
rRtd��YnXdS)NrzTSupport for indexing FileInput objects is deprecated. Use iterator protocol instead.r!)�
stacklevelzaccessing lines out of orderzend of input reached)r6r7r8rrrOrL�
IndexError)r>�ir6rrr�__getitem__s�
zFileInput.__getitem__cCs�|j}d|_|r|t_|j}d|_z|r0|�
�W5|j}d|_z|`Wntk
r\YnXz|rr|jsr|�
�W5|j}d|_|r�|js�zt	�
|�Wntk
r�YnXd|_XXdS)NF)r.r(�stdoutr/rrK�AttributeErrorr4r-r%�unlink�OSErrorr3r)r>Z
savestdout�output�fileZbackupfilenamerrrrs4

zFileInput.nextfilecCs6|��}|r|jd7_|S|js(|S|��qdSrJ)rKr2rrrMrrr�readline.szFileInput.readlinecCs�|jsd|jkrdSdS|jd|_|jdd�|_|��|_d|_d|_d|_d|_|jdkr�d|_d|jkr�t	t
jd	t
j�|_nt
j|_d
|_�nT|j�r�t
�|j�|jp�d|_zt
�|j�Wntk
r�YnXt
�|j|j�t|j|j�|_zt
�|j���j}Wn&tk
�r8t|j|j�|_YntXt
jt
jBt
jB}tt
d��rb|t
jO}t
�|j||�}t
�||j�|_zt
�|j|�Wntk
�r�YnXt
j |_!|jt
_ n,|j"�r�|�"|j|j�|_nt|j|j�|_|jj#|_$|�$�S)
N�b�rrrFrz<stdin>�bufferTz.bak�O_BINARY)%r+r9r0rr1r2rr3r4�getattrr(�stdinr,r%r'r-rVrW�rename�open�fstatr�st_moder;r/�O_CREAT�O_WRONLY�O_TRUNC�hasattrr^�fdopen�chmodrTr.r=rZrK)r>Zpermr�fdrrrrK9s\




�


zFileInput._readlinecCs|jSr@)r0rBrrrrrszFileInput.filenamecCs|j|jSr@)r1r2rBrrrruszFileInput.linenocCs|jSr@�r2rBrrrrxszFileInput.filelinenocCs4|jr,z|j��WStk
r(YdSXndSdS)N���)rrr5rBrrrr{s
zFileInput.filenocCs
|jdkSrJrlrBrrrr	�szFileInput.isfirstlinecCs|jSr@)r3rBrrrr
�szFileInput.isstdin)NFr)�__name__�
__module__�__qualname__�__doc__r?rCrrDrHrIrOrSrrZrKrrrrr	r
rrrrr�s*�)9	cCsVtj�|�d}|dkr,ddl}|�||�S|dkrHddl}|�||�St||�SdS)Nrz.gzrz.bz2)r%�path�splitext�gziprb�bz2ZBZ2File)rrZextrtrurrrr�scs��fdd�}|S)Ncst||��d�S)N��encoding�errors)rb)rrrvrrr�szhook_encoded.<locals>.openhookr)rwrxrrrvrr
�scCs�ddl}d}d}|�tjdd�d�\}}|D] \}}|dkrBd}|dkr.|}q.t|||d�D]b}|d	d�d
kr~|dd	�}|d	d�dkr�|dd	�}tdt�t�t�t�r�d
p�d|f�q^tdt�t�t�f�dS)NrFrzib:z-iTz-b)rrrm�
�
z%d: %s[%d]%s %s�*rz
%d: %s[%d])	�getoptr(r)r�printrrrr	)r|rrZopts�args�o�arNrrr�_test�s&�
r��__main__)NFr)N)rqr(r%�__all__rrrrrrrrr	r
rrr
r�rnrrrr�<module>s4J�
	

			^
ftplib.cpython-38.pyc000064400000066551150335716500010476 0ustar00U

e5d9��@sVdZddlZddlZddlmZdddddd	gZd
ZdZdZGd
d�de�Z	Gdd�de	�Z
Gdd�de	�ZGdd�de	�ZGdd�de	�Z
e	eefZdZdZGdd�d�ZzddlZWnek
r�dZYn0XejZGdd�de�Ze�d�e	eeejfZdadd�Zdadd�Zdd�Zdd�Z d d!�Z!d)d$d%�Z"d&d'�Z#e$d(k�rRe#�dS)*aSAn FTP client class and some helper functions.

Based on RFC 959: File Transfer Protocol (FTP), by J. Postel and J. Reynolds

Example:

>>> from ftplib import FTP
>>> ftp = FTP('ftp.python.org') # connect to host, default port
>>> ftp.login() # default, i.e.: user anonymous, passwd anonymous@
'230 Guest login ok, access restrictions apply.'
>>> ftp.retrlines('LIST') # list directory contents
total 9
drwxr-xr-x   8 root     wheel        1024 Jan  3  1994 .
drwxr-xr-x   8 root     wheel        1024 Jan  3  1994 ..
drwxr-xr-x   2 root     wheel        1024 Jan  3  1994 bin
drwxr-xr-x   2 root     wheel        1024 Jan  3  1994 etc
d-wxrwxr-x   2 ftp      wheel        1024 Sep  5 13:43 incoming
drwxr-xr-x   2 root     wheel        1024 Nov 17  1993 lib
drwxr-xr-x   6 1094     wheel        1024 Sep 13 19:07 pub
drwxr-xr-x   3 root     wheel        1024 Jan  3  1994 usr
-rw-r--r--   1 root     root          312 Aug  1  1994 welcome.msg
'226 Transfer complete.'
>>> ftp.quit()
'221 Goodbye.'
>>>

A nice test that reveals some of the network dialogue would be:
python ftplib.py -d localhost -l -p -l
�N)�_GLOBAL_DEFAULT_TIMEOUT�FTP�error_reply�
error_temp�
error_perm�error_proto�
all_errors��� c@seZdZdS)�ErrorN��__name__�
__module__�__qualname__�rr�/usr/lib64/python3.8/ftplib.pyr9src@seZdZdS)rNr
rrrrr:sc@seZdZdS)rNr
rrrrr;sc@seZdZdS)rNr
rrrrr<sc@seZdZdS)rNr
rrrrr=s�
s
c@s�eZdZdZdZdZeZeZ	dZ
dZdZdZ
dZdZddddedfdd	�Zd
d�Zdd
�Zd\dd�Zdd�Zdd�ZeZdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Z d'd(�Z!d)d*�Z"d+d,�Z#d-d.�Z$d/d0�Z%d1d2�Z&d]d3d4�Z'd^d5d6�Z(d_d7d8�Z)d`d:d;�Z*dad<d=�Z+dbd>d?�Z,dcd@dA�Z-dBdC�Z.dDdE�Z/dFdG�Z0dgfdHdI�Z1dJdK�Z2dLdM�Z3dNdO�Z4dPdQ�Z5dRdS�Z6dTdU�Z7dVdW�Z8dXdY�Z9dZd[�Z:dS)drayAn FTP client class.

    To create a connection, call the class using these arguments:
            host, user, passwd, acct, timeout

    The first four arguments are all strings, and have default value ''.
    timeout must be numeric and defaults to None if not passed,
    meaning that no timeout will be set on any ftp socket(s)
    If a timeout is passed, then this is now the default timeout for all ftp
    socket operations for this instance.

    Then use self.connect() with optional host and port argument.

    To download a file, use ftp.retrlines('RETR ' + filename),
    or ftp.retrbinary() with slightly different arguments.
    To upload a file, use ftp.storlines() or ftp.storbinary(),
    which have an open file as argument (see their definitions
    below for details).
    The download/upload functions first issue appropriate TYPE
    and PORT or PASV commands.
    r�Nr	zlatin-1FcCs0||_||_|r,|�|�|r,|�|||�dS�N)�source_address�timeout�connect�login)�self�host�user�passwd�acctrrrrr�__init__rs
zFTP.__init__cCs|Srr�rrrr�	__enter__{sz
FTP.__enter__c	GsN|jdk	rJz*z|��Wnttfk
r0YnXW5|jdk	rH|��XdSr)�sock�close�quit�OSError�EOFError)r�argsrrr�__exit__s


zFTP.__exit__����cCs�|dkr||_|dkr||_|dkr*||_|dk	r8||_t�d||j|j�tj|j|jf|j|jd�|_|jj	|_
|jjd|jd�|_
|��|_|jS)	awConnect to host.  Arguments are:
         - host: hostname to connect to (string, default previous host)
         - port: port to connect to (integer, default previous port)
         - timeout: the timeout to set against the ftp socket(s)
         - source_address: a 2-tuple (host, port) for the socket to bind
           to as its source address before connecting.
        rrr)Nzftplib.connect�r�r��encoding)r�portrr�sys�audit�socket�create_connectionr"�family�af�makefiler-�file�getresp�welcome)rrr.rrrrrr�s �

zFTP.connectcCs|jrtd|�|j��|jS)z`Get the welcome message from the server.
        (this is read and squirreled away by connect())z	*welcome*)�	debugging�print�sanitizer8r rrr�
getwelcome�szFTP.getwelcomecCs
||_dS)z�Set the debugging level.
        The required argument level means:
        0: no debugging output (default)
        1: print commands and responses but not body text etc.
        2: also print raw lines read and sent before stripping CR/LFN)r9)r�levelrrr�set_debuglevel�szFTP.set_debuglevelcCs
||_dS)z�Use passive or active mode for data transfers.
        With a false argument, use the normal PORT mode,
        With a true argument, use the PASV command.N)�
passiveserver)r�valrrr�set_pasv�szFTP.set_pasvcCsJ|dd�dkrBt|�d��}|dd�d|d||d�}t|�S)N�>�PASS �pass r�*)�len�rstrip�repr)r�s�irrrr;�s$zFTP.sanitizecCs`d|ksd|krtd��t�d||�|t}|jdkrHtd|�|��|j�|�	|j
��dS)N�
�
z4an illegal newline character should not be containedzftplib.sendcmdr	z*put*)�
ValueErrorr/r0�CRLFr9r:r;r"�sendall�encoder-�r�linerrr�putline�s
zFTP.putlinecCs$|jrtd|�|��|�|�dS)Nz*cmd*)r9r:r;rSrQrrr�putcmd�sz
FTP.putcmdcCs�|j�|jd�}t|�|jkr.td|j��|jdkrHtd|�|��|sPt�|dd�t	krn|dd�}n|dd�t	kr�|dd�}|S)Nr	�got more than %d bytesz*get*������)
r6�readline�maxlinerFrr9r:r;r&rNrQrrr�getline�s
zFTP.getlinecCs`|��}|dd�dkr\|dd�}|��}|d|}|dd�|kr$|dd�dkr$q\q$|S)N���-rL)rZ)rrR�codeZnextlinerrr�getmultiline�s�zFTP.getmultilinecCsp|��}|jrtd|�|��|dd�|_|dd�}|dkrD|S|dkrTt|��|dkrdt|��t|��dS)Nz*resp*r[r	>�1�3�2�4�5)r_r9r:r;Zlastresprrr)r�resp�crrrr7�szFTP.getrespcCs$|��}|dd�dkr t|��|S)z%Expect a response beginning with '2'.Nr	rb)r7r�rrerrr�voidresp�szFTP.voidrespcCsTdt}|jdkr"td|�|��|j�|t�|��}|dd�dkrPt|��|S)z�Abort a file transfer.  Uses out-of-band data.
        This does not follow the procedure from the RFC to send Telnet
        IP and Synch; that doesn't seem to work with the servers I've
        tried.  Instead, just send the ABOR command as OOB data.�ABORr	z*put urgent*Nr[��225�426�226)	�B_CRLFr9r:r;r"rO�MSG_OOBr_r�rrRrerrr�aborts
z	FTP.abortcCs|�|�|��S)z'Send a command and return the response.)rTr7�r�cmdrrr�sendcmds
zFTP.sendcmdcCs|�|�|��S)z8Send a command and expect a response beginning with '2'.)rTrhrrrrr�voidcmds
zFTP.voidcmdcCsB|�d�}t|d�t|d�g}||}dd�|�}|�|�S)zUSend a PORT command with the current host and the given
        port number.
        �.�zPORT �,)�splitrH�joinru)rrr.ZhbytesZpbytes�bytesrsrrr�sendports

zFTP.sendportcCsbd}|jtjkrd}|jtjkr$d}|dkr4td��dt|�|t|�dg}dd�|�}|�|�S)zESend an EPRT command with the current host and the given port number.rr	�zunsupported address familyrzEPRT �|)r4r1�AF_INETZAF_INET6rrHrzru)rrr.r4Zfieldsrsrrr�sendeprt&szFTP.sendeprtcCsltjd|jdd�}|��d}|j��d}|jtjkrF|�||�}n|�||�}|jt	k	rh|�
|j�|S)z3Create a new socket and send a PORT command for it.)rrr	)r3Zbacklogr)r1Z
create_serverr4Zgetsocknamer"rr|r�rr�
settimeout)rr"r.rrerrr�makeport3s
zFTP.makeportcCs\|jtjkr:t|�d��\}}|jr*|}qT|j��d}nt|�d�|j���\}}||fS)z<Internal: Does the PASV or EPSV handshake -> (address, port)�PASVrZEPSV)	r4r1r�parse227rt�trust_server_pasv_ipv4_addressr"Zgetpeername�parse229)rZuntrusted_hostr.rrrr�makepasv@szFTP.makepasvc
	Cs6d}|jr�|��\}}tj||f|j|jd�}zL|dk	rF|�d|�|�|�}|ddkrd|��}|ddkrxt|��Wn|�	��YnXn�|�
��r}|dk	r�|�d|�|�|�}|ddkr�|��}|ddkr�t|��|��\}}	|jtk	�r
|�
|j�W5QRX|dd�dk�r.t|�}||fS)	a�Initiate a transfer over the data connection.

        If the transfer is active, send a port command and the
        transfer command, and accept the connection.  If the server is
        passive, send a pasv command, connect to it, and start the
        transfer command.  Either way, return the socket for the
        connection and the expected size of the transfer.  The
        expected size may be None if it could not be determined.

        Optional `rest' argument can be a string that is sent as the
        argument to a REST command.  This is essentially a server
        marker used to tell the server to skip over any data up to the
        given marker.
        Nr*zREST %srrbr`r[�150)r?r�r1r2rrrtr7rr#r�Zacceptrr��parse150)
rrs�rest�sizerr.�connrer"Zsockaddrrrr�ntransfercmdLs>�



zFTP.ntransfercmdcCs|�||�dS)z0Like ntransfercmd() but returns only the socket.r)r�)rrsr�rrr�transfercmd�szFTP.transfercmdcCs�|sd}|sd}|sd}|dkr0|dkr0|d}|�d|�}|ddkrX|�d|�}|ddkrr|�d	|�}|dd
kr�t|��|S)zLogin, default anonymous.Z	anonymousr>rr]z
anonymous@zUSER rrarC�ACCT rb�rtr)rrrrrerrrr�s z	FTP.loginrc	Cs^|�d�|�||��:}|�|�}|s(q2||�qtdk	rLt|t�rL|��W5QRX|��S)a�Retrieve data in binary mode.  A new port is created for you.

        Args:
          cmd: A RETR command.
          callback: A single parameter callable to be called on each
                    block of data read.
          blocksize: The maximum number of bytes to read from the
                     socket at one time.  [default: 8192]
          rest: Passed to transfercmd().  [default: None]

        Returns:
          The response code.
        �TYPE IN)rur�Zrecv�
_SSLSocket�
isinstance�unwraprh)rrs�callback�	blocksizer�r��datarrr�
retrbinary�s


zFTP.retrbinaryc
Cs�|dkrt}|�d�}|�|���}|jd|jd���}|�|jd�}t|�|jkr`td|j��|j	dkrxt
dt|��|s~q�|d	d�tkr�|dd	�}n|d
d�dkr�|dd
�}||�q4t
dk	r�t|t
�r�|��W5QRXW5QRX|��S)ahRetrieve data in line mode.  A new port is created for you.

        Args:
          cmd: A RETR, LIST, or NLST command.
          callback: An optional single parameter callable that is called
                    for each line with the trailing CRLF stripped.
                    [default: print_line()]

        Returns:
          The response code.
        N�TYPE Ar+r,r	rUr}z*retr*rVrWrL)�
print_linertr�r5r-rXrYrFrr9r:rHrNr�r�r�rh)rrsr�rer��fprRrrr�	retrlines�s,
�

z
FTP.retrlinesc	Csl|�d�|�||��H}|�|�}|s(q@|�|�|r||�qtdk	rZt|t�rZ|��W5QRX|��S)a9Store a file in binary mode.  A new port is created for you.

        Args:
          cmd: A STOR command.
          fp: A file-like object with a read(num_bytes) method.
          blocksize: The maximum data size to read from fp and send over
                     the connection at once.  [default: 8192]
          callback: An optional single parameter callable that is called on
                    each block of data after it is sent.  [default: None]
          rest: Passed to transfercmd().  [default: None]

        Returns:
          The response code.
        r�N)rur��readrOr�r�r�rh)rrsr�r�r�r�r��bufrrr�
storbinary�s



zFTP.storbinaryc	Cs�|�d�|�|���}|�|jd�}t|�|jkrBtd|j��|sHq�|dd�tkrx|dtkrp|dd�}|t}|�|�|r||�qtdk	r�t	|t�r�|�
�W5QRX|��S)ahStore a file in line mode.  A new port is created for you.

        Args:
          cmd: A STOR command.
          fp: A file-like object with a readline() method.
          callback: An optional single parameter callable that is called on
                    each line after it is sent.  [default: None]

        Returns:
          The response code.
        r�r	rUrVNrW)rur�rXrYrFrrnrOr�r�r�rh)rrsr�r�r�r�rrr�	storlines�s"


z
FTP.storlinescCsd|}|�|�S)zSend new account name.r��ru)rZpasswordrsrrrrszFTP.acctcGs0d}|D]}|d|}qg}|�||j�|S)zBReturn a list of files in a given directory (default the current).ZNLST� )r��append)rr'rs�arg�filesrrr�nlstszFTP.nlstcGshd}d}|dd�r>t|d�td�kr>|dd�|d}}|D]}|rB|d|}qB|�||�dS)aList a directory in long form.
        By default list current directory to stdout.
        Optional last argument is callback function; all
        non-empty arguments before it are concatenated to the
        LIST command.  (This *should* only be used for a pathname.)ZLISTNrWrr�)�typer�)rr'rs�funcr�rrr�dir(s zFTP.dirc
cs�|r|�dd�|�d�|r*d|}nd}g}|�||j�|D]\}|�t��d�\}}}i}	|dd��d�D] }
|
�d�\}}}||	|��<qt||	fVqDdS)	a<List a directory in a standardized format by using MLSD
        command (RFC-3659). If path is omitted the current directory
        is assumed. "facts" is a list of strings representing the type
        of information desired (e.g. ["type", "size", "perm"]).

        Return a generator object yielding a tuple of two elements
        for every file found in path.
        First element is the file name, the second one is a dictionary
        including a variable number of "facts" depending on the server
        and whether "facts" argument has been provided.
        z
OPTS MLST �;zMLSD %sZMLSDr�NrW�=)	rtrzr�r�rGrN�	partitionry�lower)
r�pathZfactsrs�linesrRZfacts_found�_�name�entryZfact�key�valuerrr�mlsd7s
zFTP.mlsdcCs0|�d|�}|ddkr"t|��|�d|�S)zRename a file.zRNFR rrazRNTO )rtrru)rZfromnameZtonamererrr�renameSsz
FTP.renamecCs.|�d|�}|dd�dkr"|St|��dS)zDelete a file.zDELE Nr[>�250�200r�)r�filenamererrr�deleteZsz
FTP.deletec
Csp|dkrRz|�d�WStk
rN}z|jddd�dkr>�W5d}~XYq^Xn|dkr^d}d	|}|�|�S)
zChange to a directory.z..ZCDUPrNr[�500rrvzCWD )rurr')r�dirname�msgrsrrr�cwdbszFTP.cwdcCs:|�d|�}|dd�dkr6|dd���}t|�SdS)zRetrieve the size of a file.zSIZE Nr[Z213)rt�strip�int)rr�rerIrrrr�oszFTP.sizecCs$|�d|�}|�d�sdSt|�S)z+Make a directory, return its full pathname.zMKD �257r�ru�
startswith�parse257)rr�rerrr�mkdws
zFTP.mkdcCs|�d|�S)zRemove a directory.zRMD r�)rr�rrr�rmd�szFTP.rmdcCs |�d�}|�d�sdSt|�S)z!Return current working directory.ZPWDr�rr�rgrrr�pwd�s

zFTP.pwdcCs|�d�}|��|S)zQuit, and close the connection.ZQUIT)rur#rgrrrr$�s
zFTP.quitcCsDz |j}d|_|dk	r|��W5|j}d|_|dk	r>|��XdS)z8Close the connection without assuming anything about it.N)r"r#r6)rr"r6rrrr#�sz	FTP.close)rrr)N)N)N)rrr)rN)N)rNN)N);rrr�__doc__r9r�FTP_PORTr.�MAXLINErYr"r6r8r?r-r�rrr!r(rr<r>�debugrAr;rSrTrZr_r7rhrqrtrur|r�r�r�r�r�rr�r�r�r�rr�r�r�r�r�r�r�r�r�r�r$r#rrrrrJsp�
	






7



#

	
		c	@sneZdZdZejZdddddddedf	dd�Zddd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
ddd�Zdd�ZdS)�FTP_TLSa�A FTP subclass which adds TLS support to FTP as described
        in RFC-4217.

        Connect as usual to port 21 implicitly securing the FTP control
        connection before authenticating.

        Securing the data connection requires user to explicitly ask
        for it by calling prot_p() method.

        Usage example:
        >>> from ftplib import FTP_TLS
        >>> ftps = FTP_TLS('ftp.python.org')
        >>> ftps.login()  # login anonymously previously securing control channel
        '230 Guest login ok, access restrictions apply.'
        >>> ftps.prot_p()  # switch to secure data connection
        '200 Protection level set to P'
        >>> ftps.retrlines('LIST')  # list directory content securely
        total 9
        drwxr-xr-x   8 root     wheel        1024 Jan  3  1994 .
        drwxr-xr-x   8 root     wheel        1024 Jan  3  1994 ..
        drwxr-xr-x   2 root     wheel        1024 Jan  3  1994 bin
        drwxr-xr-x   2 root     wheel        1024 Jan  3  1994 etc
        d-wxrwxr-x   2 ftp      wheel        1024 Sep  5 13:43 incoming
        drwxr-xr-x   2 root     wheel        1024 Nov 17  1993 lib
        drwxr-xr-x   6 1094     wheel        1024 Sep 13 19:07 pub
        drwxr-xr-x   3 root     wheel        1024 Jan  3  1994 usr
        -rw-r--r--   1 root     root          312 Aug  1  1994 welcome.msg
        '226 Transfer complete.'
        >>> ftps.quit()
        '221 Goodbye.'
        >>>
        rNc
	Cs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}
|
�dtd�||_||_|dkr|tj|j||d�}||_	d|_
t�|||||||	�dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadr})�certfile�keyfileF)
rM�warnings�warn�DeprecationWarningr�r��sslZ_create_stdlib_context�ssl_version�context�_prot_prr)rrrrrr�r�r�rrr�rrrr�s(��zFTP_TLS.__init__TcCs*|rt|jtj�s|��t�||||�Sr)r�r"r��	SSLSocket�authrr)rrrrZsecurerrrr�sz
FTP_TLS.logincCsft|jtj�rtd��|jtjkr.|�d�}n
|�d�}|jj	|j|j
d�|_|jjd|jd�|_
|S)z2Set up secure control connection by using TLS/SSL.zAlready using TLSzAUTH TLSzAUTH SSL�Zserver_hostnamer+)�moder-)r�r"r�r�rMr�ZPROTOCOL_TLSrur��wrap_socketrr5r-r6rgrrrr��s

�zFTP_TLS.authcCs0t|jtj�std��|�d�}|j��|_|S)z/Switch back to a clear-text control connection.z
not using TLSZCCC)r�r"r�r�rMrur�rgrrr�ccc�s

zFTP_TLS.ccccCs|�d�|�d�}d|_|S)zSet up secure data connection.zPBSZ 0zPROT PT�rur�rgrrr�prot_p�s

zFTP_TLS.prot_pcCs|�d�}d|_|S)z"Set up clear text data connection.zPROT CFr�rgrrr�prot_cs
zFTP_TLS.prot_ccCs2t�|||�\}}|jr*|jj||jd�}||fS)Nr�)rr�r�r�r�r)rrsr�r�r�rrrr�s�zFTP_TLS.ntransfercmdcCs8dt}|j�|�|��}|dd�dkr4t|��|S)Nrir[rj)rnr"rOr_rrprrrrqsz
FTP_TLS.abort)rrrT)N)rrrr�r�ZPROTOCOL_TLS_CLIENTr�rrrr�r�r�r�r�rqrrrrr��s 
�



r�cCs\|dd�dkrt|��tdkr<ddl}|�d|j|jB�at�|�}|sNdSt|�d��S)z�Parse the '150' response for a RETR request.
    Returns the expected transfer size or None; size is not guaranteed to
    be present in the 150 message.
    Nr[r�rz150 .* \((\d+) bytes\)r	)	r�_150_re�re�compile�
IGNORECASE�ASCII�matchr��group)rer��mrrrr�)s
�
r�cCs�|dd�dkrt|��tdkr6ddl}|�d|j�at�|�}|sLt|��|��}d�|dd��}t	|d�d>t	|d	�}||fS)
z�Parse the '227' response for a PASV request.
    Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)'
    Return ('host.addr.as.numbers', port#) tuple.Nr[Z227rz#(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)rvr\�rB)
r�_227_rer�r�r��searchr�groupsrzr�)rer�r�Znumbersrr.rrrr�=s
r�cCs�|dd�dkrt|��|�d�}|dkr2t|��|�d|d�}|dkrRt|��||d||dkrrt|��||d|��||d�}t|�dkr�t|��|d}t|d�}||fS)	z�Parse the '229' response for an EPSV request.
    Raises error_proto if it does not contain '(|||port|)'
    Return ('host.addr.as.numbers', port#) tuple.Nr[Z229�(r�)r	rB)r�findrryrFr�)reZpeer�left�right�partsrr.rrrr�Qs 
r�cCs�|dd�dkrt|��|dd�dkr,dSd}d}t|�}||kr�||}|d}|dkrz||ks�||dkrrq�|d}||}q<|S)	z�Parse the '257' response for a MKD or PWD request.
    This is a response to a MKD or PWD request: a directory name.
    Returns the directoryname in the 257 reply.Nr[r�rBz "rr	�")rrF)rer�rJ�nrfrrrr�gs 
r�cCst|�dS)z+Default retrlines callback to print a line.N)r:)rRrrrr�~sr�r�Ic	Cs�|s|}d|}|�|�|�|�t|�d��\}}|�||�|�d|�}|dd�dkrdt�|�d|�}|dd�dkr�t�|��|��dS)z+Copy file from one FTP-instance to another.zTYPE r�zSTOR Nr[>�125r��RETR )rur�rtr|rrh)	�sourceZ
sourcename�targetZ
targetnamer�Z
sourcehostZ
sourceportZtreplyZsreplyrrr�ftpcp�s

r�cCs�ttj�dkr"ttj�t�d�ddl}d}d}tjddkrR|d}tjd=q2tjddd�dkr�tjddd�}tjd=tjd}t|�}|�	|�d}}}z|�|�}Wn(t
k
r�|dk	r�tj�d�Yn:Xz|�
|�\}}}Wn"tk
�rtj�d	�YnX|�|||�tjdd�D]�}	|	dd�d
k�r`|�|	dd��nt|	dd�dk�r�d}
|	dd��r�|
d|	dd�}
|�|
�}n0|	d
k�r�|�|j�n|�d|	tjjd��q6|��dS)z�Test program.
    Usage: ftp [-d] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ...

    -d dir
    -l list
    -p password
    r}rNr	z-dz-rrz5Could not open account file -- using anonymous login.z$No account -- using anonymous login.z-lZCWDr�z-pr�i)rFr/�argvr:�testr��exit�netrcrr>r%�stderr�writeZauthenticators�KeyErrorrr�rtrAr?r��stdoutr$)r�r9ZrcfilerZftpZuseridrrZnetrcobjr6rsrerrrr��sV	




�


�r��__main__)rr�)%r�r/r1r�__all__ror�r��	Exceptionrrrrrr%r&rrNrnrr��ImportErrorr�r�r�r�ZSSLErrorr�r�r�r�r�r�r�r�r�rrrrr�<module>sR&
�
Z
|

9
_compression.cpython-38.pyc000064400000010064150335716500011702 0ustar00U

e5d��@s:dZddlZejZGdd�dej�ZGdd�dej�ZdS)z7Internal classes used by the gzip, lzma and bz2 modules�Nc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
BaseStreamzMode-checking helper functions.cCs|jrtd��dS)NzI/O operation on closed file)�closed�
ValueError��self�r�$/usr/lib64/python3.8/_compression.py�_check_not_closedszBaseStream._check_not_closedcCs|��st�d��dS)NzFile not open for reading)�readable�io�UnsupportedOperationrrrr�_check_can_readszBaseStream._check_can_readcCs|��st�d��dS)NzFile not open for writing)�writablerrrrrr�_check_can_writeszBaseStream._check_can_writecCs(|��st�d��|��s$t�d��dS)Nz3Seeking is only supported on files open for readingz3The underlying file object does not support seeking)r
rr�seekablerrrr�_check_can_seeks
zBaseStream._check_can_seekN)�__name__�
__module__�__qualname__�__doc__r	r
rrrrrrr	s
rcsjeZdZdZdd�Zddd�Z�fdd�Zd	d
�Zdd�Zddd�Z	dd�Z
ejfdd�Z
dd�Z�ZS)�DecompressReaderz5Adapts the decompressor API to a RawIOBase reader APIcCsdS)NTrrrrrr
$szDecompressReader.readablercKs>||_d|_d|_d|_||_||_|jf|j�|_||_dS)NFr���)�_fp�_eof�_pos�_size�_decomp_factory�_decomp_args�
_decompressor�_trailing_error)r�fpZdecomp_factoryZtrailing_errorZdecomp_argsrrr�__init__'szDecompressReader.__init__csd|_t���S�N)r�super�closer��	__class__rrr$;szDecompressReader.closecCs
|j��Sr")rrrrrrr?szDecompressReader.seekablec
CsPt|��:}|�d��$}|�t|��}||dt|��<W5QRXW5QRXt|�S)N�B)�
memoryview�cast�read�len)r�bZviewZ	byte_view�datarrr�readintoBs$zDecompressReader.readintorcCs�|dkr|��S|r|jrdSd}|jjr�|jjp<|j�t�}|sDq�|jf|j	�|_z|j�
||�}Wq�|jk
r�Yq�Yq�Xn4|jjr�|j�t�}|s�t
d��nd}|j�
||�}|r"q�q"|s�d|_|j|_dS|jt|�7_|S)Nr�zACompressed file ended before the end-of-stream marker was reachedT)�readallrr�eofZunused_datarr*�BUFFER_SIZErr�
decompressrZneeds_input�EOFErrorrrr+)r�sizer-Zrawblockrrrr*Hs@

��
zDecompressReader.readcCs,|j�d�d|_d|_|jf|j�|_dS)NrF)r�seekrrrrrrrrr�_rewindrszDecompressReader._rewindcCs�|tjkrnR|tjkr"|j|}n<|tjkrP|jdkrD|�tj�rDq6|j|}ntd�	|���||jkrr|�
�n
||j8}|dkr�|�ttj|��}|s�q�|t|�8}q||jS)NrzInvalid value for whence: {})
r�SEEK_SET�SEEK_CURr�SEEK_ENDrr*�DEFAULT_BUFFER_SIZEr�formatr7�minr+)r�offset�whencer-rrrr6xs&






zDecompressReader.seekcCs|jS)z!Return the current file position.)rrrrr�tell�szDecompressReader.tell)r)r)rrrrr
r!r$rr.r*r7rr8r6r@�
__classcell__rrr%rr!s

*r)rrr;r2�BufferedIOBaser�	RawIOBaserrrrr�<module>skeyword.cpython-38.pyc000064400000001750150335716500010670 0ustar00U

e5d��#@sddZddgZddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%g#Zee�jZd&S)'a�Keywords (from "Grammar/Grammar")

This file is automatically generated; please don't muck it up!

To update the symbols in this file, 'cd' to the top directory of
the python source tree and run:

    python3 -m Parser.pgen.keywordgen Grammar/Grammar                                       Grammar/Tokens                                       Lib/keyword.py

Alternatively, you can run 'make regen-keyword'.
�	iskeyword�kwlist�False�None�True�and�as�assert�async�await�break�class�continue�def�del�elif�else�except�finally�for�from�global�if�import�in�is�lambda�nonlocal�not�or�pass�raise�return�try�while�with�yieldN)�__doc__�__all__r�	frozenset�__contains__r�r*r*�/usr/lib64/python3.8/keyword.py�<module>sL�&cgi.cpython-38.opt-1.pyc000064400000063655150335716500010721 0ustar00U

&�.e���@sjdZdZddlmZmZmZddlmZddlZddl	Z	ddl
Zddlm
Z
ddlmZddlZddlZddlZdd	d
ddd
ddddddgZdadadd�Zdd�Zdd�Zdd�Zeadade	jdddfdd
�Zd1d!d�Zd"d#�Zd$d�Z Gd%d�d�Z!Gd&d	�d	�Z"e	jfd'd
�Z#d2d(d�Z$e	jfd)d�Z%d*d�Z&d+d�Z'd,d�Z(d-d�Z)d.d/�Z*e+d0k�rfe#�dS)3z�Support module for CGI (Common Gateway Interface) scripts.

This module defines a number of utilities for use by CGI scripts
written in Python.
z2.6�)�StringIO�BytesIO�
TextIOWrapper)�MappingN)�
FeedParser)�Message�MiniFieldStorage�FieldStorage�parse�parse_multipart�parse_header�test�print_exception�
print_environ�
print_form�print_directory�print_arguments�print_environ_usage�cGsFtr,ts,zttd�aWntk
r*YnXts6tantat|�dS)a�Write a log message, if there is a log file.

    Even though this function is called initlog(), you should always
    use log(); log is a variable that is set either to initlog
    (initially), to dolog (once the log file has been opened), or to
    nolog (when logging is disabled).

    The first argument is a format string; the remaining arguments (if
    any) are arguments to the % operator, so e.g.
        log("%s: %s", "a", "b")
    will write "a: b" to the log file, followed by a newline.

    If the global logfp is not None, it should be a file object to
    which log data is written.

    If the global logfp is None, the global logfile may be a string
    giving a filename to open, in append mode.  This file should be
    world writable!!!  If the file can't be opened, logging is
    silently disabled (since there is no safe place where we could
    send an error message).

    �aN)�logfile�logfp�open�OSError�nolog�log�dolog�Zallargs�r�/usr/lib64/python3.8/cgi.py�initlog8sr cGst�||d�dS)z=Write a log message to the log file.  See initlog() for docs.�
N)r�write)Zfmt�argsrrrr[srcGsdS)z9Dummy function, assigned to log when logging is disabled.Nrrrrrr_srcCsdatrt��datadS)zClose the log file.rN)rr�closer rrrrr�closelogcs
r%c
Cs^|dkrtj}t|d�r |j}nd}t|t�r4|j}d|krDd|d<|ddk�rt|d�\}}|dkrxt|||d	�S|d
kr�t	|d�}t
r�|t
kr�td��|�|��
|�}	nd
}	d|kr�|	r�|	d}	|	|d}	n*tjdd��r|	r�|	d}	|	tjd}	|	|d<n<d|k�r |d}	n(tjdd��r<tjd}	nd
}	|	|d<tjj|	||||d�S)a�Parse a query in the environment or from a file (default stdin)

        Arguments, all optional:

        fp              : file pointer; default: sys.stdin.buffer

        environ         : environment dictionary; default: os.environ

        keep_blank_values: flag indicating whether blank values in
            percent-encoded forms should be treated as blank strings.
            A true value indicates that blanks should be retained as
            blank strings.  The default false value indicates that
            blank values are to be ignored and treated as if they were
            not included.

        strict_parsing: flag indicating what to do with parsing errors.
            If false (the default), errors are silently ignored.
            If true, errors raise a ValueError exception.

        separator: str. The symbol to use for separating the query arguments.
            Defaults to &.
    N�encodingzlatin-1�REQUEST_METHOD�GET�POST�CONTENT_TYPEzmultipart/form-data)�	separator�!application/x-www-form-urlencoded�CONTENT_LENGTH�Maximum content length exceededr�QUERY_STRING�&�)r&r+)�sys�stdin�hasattrr&�
isinstancer�bufferrr�int�maxlen�
ValueError�read�decode�argv�urllibr
Zparse_qs)
�fp�environ�keep_blank_values�strict_parsingr+r&�ctype�pdictZclength�qsrrrr
vsL




��utf-8�replacer0csx|d�d�}d�|�}t�}|�|�z|d|d<Wntk
rLYnXt||||ddi|d���fd	d
��D�S)a�Parse multipart input.

    Arguments:
    fp   : input file
    pdict: dictionary containing other parameters of content-type header
    encoding, errors: request encoding and error handler, passed to
        FieldStorage

    Returns a dictionary just like parse_qs(): keys are the field names, each
    value is a list of values for that field. For non-file fields, the value
    is a list of strings.
    �boundary�asciiz multipart/form-data; boundary={}zCONTENT-LENGTHzContent-Lengthr'r))�headersr&�errorsr?r+csi|]}|��|��qSr)�getlist)�.0�k�Zfsrr�
<dictcomp>�sz#parse_multipart.<locals>.<dictcomp>)r;�formatrZset_type�KeyErrorr	)r>rCr&rJr+rGrBrIrrNrr�s


�ccs�|dd�dkr�|dd�}|�d�}|dkr`|�dd|�|�dd|�dr`|�d|d�}q&|dkrpt|�}|d|�}|��V||d�}qdS)Nr1�;r�"�\"�)�find�count�len�strip)�s�end�frrr�_parseparam�s
(
r]cCs�td|�}|��}i}|D]�}|�d�}|dkr|d|�����}||dd���}t|�dkr�|d|dkr�dkr�nn |dd�}|�d	d
��dd�}|||<q||fS)zfParse a Content-type like header.

    Return the main content-type and a dictionary of options.

    rR�=rNr1rU���rSz\\�\rT)r]�__next__rVrY�lowerrXrF)�line�parts�keyrC�p�i�name�valuerrrr�s
,
c@s@eZdZdZdZdZdZdZiZdZ	iZ
iZdd�Zdd�Z
dS)rz=Like FieldStorage, for use when no file uploads are possible.NcCs||_||_dS)z&Constructor from field name and value.N�rhri��selfrhrirrr�__init__	szMiniFieldStorage.__init__cCsd|j|jfS)z Return printable representation.zMiniFieldStorage(%r, %r)rj�rlrrr�__repr__szMiniFieldStorage.__repr__)�__name__�
__module__�__qualname__�__doc__�filename�list�type�file�type_options�disposition�disposition_optionsrIrmrorrrrr�sc@s�eZdZdZdddejdddddddfdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
d:dd�Zd;dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZdZd'd(�Zd)d*�Zd+Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Z dS)<r	a�Store a sequence of fields, reading multipart/form-data.

    This class provides naming, typing, files stored on disk, and
    more.  At the top level, it is accessible like a dictionary, whose
    keys are the field names.  (Note: None can occur as a field name.)
    The items are either a Python list (if there's multiple values) or
    another FieldStorage or MiniFieldStorage object.  If it's a single
    object, it has the following attributes:

    name: the field name, if specified; otherwise None

    filename: the filename, if specified; otherwise None; this is the
        client side filename, *not* the file name on which it is
        stored (that's a temporary file you don't deal with)

    value: the value as a *string*; for file uploads, this
        transparently reads the file every time you request the value
        and returns *bytes*

    file: the file(-like) object from which you can read the data *as
        bytes* ; None if the data is stored a simple string

    type: the content-type, or None if not specified

    type_options: dictionary of options specified on the content-type
        line

    disposition: content-disposition, or None if not specified

    disposition_options: dictionary of corresponding options

    headers: a dictionary(-like) object (sometimes email.message.Message or a
        subclass thereof) containing *all* headers

    The class is subclassable, mostly for the purpose of overriding
    the make_file() method, which is called internally to come up with
    a file open for reading and writing.  This makes it possible to
    override the default choice of storing all files in a temporary
    directory and unlinking them as soon as they have been opened.

    N�rrErFcCsZd}||_||_|
|_||_d|kr0|d��}d|_|dksF|dkr�d|krX|d}
ntjdd�rrtjd}
nd}
|
�t	�
�d�}
t|
�}|dkr�d	d
i}|dkr�i}|dkr�d
|d	<d|kr�|d|d	<d|kr�|d|_d
|kr�|d
|d<nt|t
tf��std��||_|dk�r*tjj|_n<t|t��r@|j|_n&t|d��rXt|d��s`td��||_||_|	|_t|t��s�tdt|�j��||_d|_||_di}}d|jk�r�t|jd�\}}||_||_ d|_!d|k�r�|d|_!d|_"d|k�r
|d|_"|j"dk	|_#d	|jk�r6t|jd	�\}}n(|j�sH|dk�rTdi}}n
d
i}}||_||_$d|k�r�|d�|j|j�|_%nd|_%d}d|jk�r�zt&|jd�}Wnt'k
�r�YnXt(�r�|t(k�r�t'd��||_)|jdk�r|dk�r||_d|_*|_+d|_,|d
k�r,|�-�n*|dd�dk�rN|�.|||�n|�/�dS)a$Constructor.  Read multipart/* until last part.

        Arguments, all optional:

        fp              : file pointer; default: sys.stdin.buffer
            (not used when the request method is GET)
            Can be :
            1. a TextIOWrapper object
            2. an object whose read() and readline() methods return bytes

        headers         : header dictionary-like object; default:
            taken from environ as per CGI spec

        outerboundary   : terminating multipart boundary
            (for internal use only)

        environ         : environment dictionary; default: os.environ

        keep_blank_values: flag indicating whether blank values in
            percent-encoded forms should be treated as blank strings.
            A true value indicates that blanks should be retained as
            blank strings.  The default false value indicates that
            blank values are to be ignored and treated as if they were
            not included.

        strict_parsing: flag indicating what to do with parsing errors.
            If false (the default), errors are silently ignored.
            If true, errors raise a ValueError exception.

        limit : used internally to read parts of multipart/form-data forms,
            to exit from the reading loop when reached. It is the difference
            between the form content-length and the number of bytes already
            read

        encoding, errors : the encoding and error handler used to decode the
            binary stream to strings. Must be the same as the charset defined
            for the page sending the form (content-type : meta http-equiv or
            header)

        max_num_fields: int. If set, then __init__ throws a ValueError
            if there are more than n fields read by parse_qsl().

        r(r'NZHEADr/r1r�surrogateescapezcontent-typer,r)r*r-�content-lengthz?headers must be mapping or an instance of email.message.Messager:�readlinezfp must be file pointerz#outerboundary must be bytes, not %srzcontent-dispositionrhrtz
text/plainrGr{r_r.�
z
multipart/)0r@rA�max_num_fieldsr+�upper�
qs_on_postr2r<�encode�localeZgetpreferredencodingrr5rr�	TypeErrorrIr3r6r>rr4r&rJ�bytesrvrp�
outerboundary�
bytes_read�limitrryrzrhrt�_binary_filerx�
innerboundaryr7r9r8�lengthrurw�done�read_urlencoded�
read_multi�read_single)rlr>rIr�r?r@rAr�r&rJr�r+�methodrDZcdisprCrBZclenrrrrm?s�/
�


�






�

zFieldStorage.__init__cCs(z|j��Wntk
r"YnXdS�N)rwr$�AttributeErrorrnrrr�__del__�szFieldStorage.__del__cCs|Sr�rrnrrr�	__enter__�szFieldStorage.__enter__cGs|j��dSr�)rwr$)rlr#rrr�__exit__�szFieldStorage.__exit__cCsd|j|j|jfS)z"Return a printable representation.zFieldStorage(%r, %r, %r))rhrtrirnrrrro�s
�zFieldStorage.__repr__cCst|���Sr�)�iter�keysrnrrr�__iter__�szFieldStorage.__iter__cCsT|dkrt|��|jr:|j�d�|j��}|j�d�n|jdk	rL|j}nd}|S)Nrir)r�rw�seekr:rurkrrr�__getattr__�s

zFieldStorage.__getattr__cCs^|jdkrtd��g}|jD]}|j|kr|�|�q|sBt|��t|�dkrV|dS|SdS)zDictionary style indexing.N�
not indexabler1r)rur�rh�appendrQrX)rlre�found�itemrrr�__getitem__s


zFieldStorage.__getitem__cCs8||kr0||}t|t�r(dd�|D�S|jSn|SdS)z8Dictionary style get() method, including 'value' lookup.cSsg|]
}|j�qSr�ri�rL�xrrr�
<listcomp>sz)FieldStorage.getvalue.<locals>.<listcomp>N�r5ruri�rlre�defaultrirrr�getvalues
zFieldStorage.getvaluecCs4||kr,||}t|t�r$|djS|jSn|SdS)z! Return the first value received.rNr�r�rrr�getfirsts

zFieldStorage.getfirstcCs:||kr2||}t|t�r(dd�|D�S|jgSngSdS)z  Return list of received values.cSsg|]
}|j�qSrr�r�rrrr�.sz(FieldStorage.getlist.<locals>.<listcomp>Nr�)rlrerirrrrK)s

zFieldStorage.getlistcCs*|jdkrtd��ttdd�|jD���S)zDictionary style keys() method.Nr�css|]}|jVqdSr��rh�rLr�rrr�	<genexpr>8sz$FieldStorage.keys.<locals>.<genexpr>)rur��setrnrrrr�4s
zFieldStorage.keyscs*|jdkrtd��t�fdd�|jD��S)z%Dictionary style __contains__ method.Nr�c3s|]}|j�kVqdSr�r�r��rerrr�>sz,FieldStorage.__contains__.<locals>.<genexpr>)rur��any)rlrerr�r�__contains__:s
zFieldStorage.__contains__cCst|���S)z Dictionary style len(x) support.)rXr�rnrrr�__len__@szFieldStorage.__len__cCs|jdkrtd��t|j�S)NzCannot be converted to bool.)rur��boolrnrrr�__bool__Ds
zFieldStorage.__bool__c	Cs�|j�|j�}t|t�s0td|jt|�jf��|�|j	|j
�}|jrT|d|j7}tj
j||j|j|j	|j
|j|jd�}dd�|D�|_|��dS)z+Internal: read data in query string format.�%s should return bytes, got %sr0�r&rJr�r+cSsg|]\}}t||��qSr�r�rLrerirrrr�Vsz0FieldStorage.read_urlencoded.<locals>.<listcomp>N)r>r:r�r5r�r9rvrpr;r&rJr�r=r
�	parse_qslr@rAr�r+ru�
skip_lines)rlrD�queryrrrr�Is&
��zFieldStorage.read_urlencodedcCsL|j}t|�std|f��g|_|jrftjj|j|j|j	|j
|j|j|j
d�}|j�dd�|D��|jpp|j}|j��}t|t�s�td|jt|�jf��|jt|�7_|��d|jkr�|r�|j��}|jt|�7_q�|j}|dk	�r|t|j�8}t�}	d}
|j��}|
|7}
|���s�q0�q|
�s:�q@|jt|
�7_|	�|
�|j
|j��|	��}d	|k�rz|d	=|jdk�r�dn
|j|j}
||j||||||
|j
|j||j
�}|dk	�r�|d
8}|j�r�|t|j�8}|dk�r�td��|j|j7_|j�|�|j �s@|j|j!k�r4dk�rnn�q@�q|�"�dS)
z/Internal: read a part that is itself multipart.z&Invalid boundary in multipart form: %rr�css|]\}}t||�VqdSr�r�r�rrrr�fsz*FieldStorage.read_multi.<locals>.<genexpr>r��--Nr{r}r1rzMax number of fields exceeded)#r��valid_boundaryr9rur�r=r
r�r@rAr&rJr�r+�extend�FieldStorageClass�	__class__r>r~r5r�rvrpr�rXrYrZfeedr;r$r�r�r�r�r�)rlr?r@rAZibr��klassZ
first_liner��parserZhdr_text�datarIr��partrrrr�[s��

��





��

(zFieldStorage.read_multicCs4|jdkr|��|��n|��|j�d�dS)zInternal: read an atomic part.rN)r��read_binaryr��
read_linesrwr�rnrrrr��s


zFieldStorage.read_singlei cCs�|��|_|j}|dkr�|dkr�|j�t||j��}t|t�sVt	d|jt
|�jf��|jt
|�7_|std|_q�|j�|�|t
|�}qdS)zInternal: read binary data.rr�r_N)�	make_filerwr�r>r:�min�bufsizer5r�r9rvrpr�rXr�r")rlZtodor�rrrr��s

�zFieldStorage.read_binarycCs@|jrt�|_|_nt�|_|_|jr4|��n|��dS)z0Internal: read lines until EOF or outerboundary.N)r�rrw�_FieldStorage__filerr��read_lines_to_outerboundary�read_lines_to_eofrnrrrr��s
zFieldStorage.read_linescCsv|jdk	rF|j��t|�dkrF|��|_|j��}|j�|�d|_|jrZ|j�|�n|j�|�|j	|j
��dS)z line is always bytes, not stringNi�)r��tellrXr�rwr�r"r�r;r&rJ)rlrcr�rrrZ__write�s


zFieldStorage.__writecCs:|j�d�}|jt|�7_|s*d|_q6|�|�qdS)zInternal: read lines until EOF.�r_N)r>r~r�rXr��_FieldStorage__write)rlrcrrrr��szFieldStorage.read_lines_to_eofc	CsJd|j}|d}d}d}d}|jdk	rFd|jkr>|krFnn�qF|j�d�}|jt|�7_|t|�7}|s~d|_�qF|dkr�||}d}|�d�r�|r�|��}||kr��qF||kr�d	|_�qF|}|�	d
�r�d
}|dd�}d}nL|�	d��rd}|dd�}d}n*|�	d��r.d}|dd�}d
}nd}d
}|�
||�qdS)z�Internal: read lines until outerboundary.
        Data is read as bytes: boundaries and line ends must be converted
        to bytes for comparisons.
        r�r{TrNr�r_�
r1s
����
F)r�r�r>r~r�rXr��
startswith�rstrip�endswithr�)	rl�
next_boundary�
last_boundaryZdelim�last_line_lfendZ_readrc�strippedlineZodelimrrrr��sN
$
z(FieldStorage.read_lines_to_outerboundarycCs�|jr|jrdSd|j}|d}d}|j�d�}|jt|�7_|sPd|_q�|�d�r�|r�|��}||krpq�||kr�d|_q�|�d�}q&dS)z5Internal: skip lines until outer boundary if defined.Nr�Tr�r_r1r�)r�r�r>r~r�rXr�rY)rlr�r�r�rcr�rrrr�s$
zFieldStorage.skip_linescCs&|jrt�d�Stjd|jdd�SdS)a�Overridable: return a readable & writable file.

        The file will be used as follows:
        - data is written to it
        - seek(0)
        - data is read from it

        The file is opened in binary mode for files, in text mode
        for other fields

        This version opens a temporary file for reading and writing,
        and immediately deletes (unlinks) it.  The trick (on Unix!) is
        that the file can still be used, but it can't be opened by
        another process, and it will automatically be deleted when it
        is closed or when the current process terminates.

        If you want a more permanent file, you derive a class which
        overrides this method.  If you want a visible temporary file
        that is nevertheless automatically deleted when the script
        terminates, try defining a __del__ method in a derived class
        which unlinks the temporary files you have created.

        zwb+zw+r!)r&�newlineN)r��tempfileZ
TemporaryFiler&rnrrrr�(s
�zFieldStorage.make_file)N)N)!rprqrrrs�osr?rmr�r�r�ror�r�r�r�r�rKr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr	sL)�
&


E	
2cCs�td�t�tjt_zNt�}t�t�t|�t|�t	�dd�}|fdd�}td�|�Wnt
�YnXtd�daz&t�}t�t�t|�t|�Wnt
�YnXd	S)
z�Robust test CGI script, usable as main program.

    Write minimal HTTP headers and dump all information provided to
    the script in HTML form.

    zContent-type: text/htmlcSstd�dS)Nz,testing print_exception() -- <I>italics?</I>)�execrrrrr\[sztest.<locals>.fcSs
|�dSr�r)r\rrr�g]sztest.<locals>.gz9<H3>What follows is a test, not an actual exception:</H3>z*<H1>Second try with a small maxlen...</H1>�2N)�printr2�stdout�stderrr	rrrrrrr8)r?�formr\r�rrrr
Js4
c	Csx|dkrt��\}}}ddl}t�td�|�||�|�||�}tdt�d�|dd���t�|d�f�~dS)Nrz+<H3>Traceback (most recent call last):</H3>z<PRE>%s<B>%s</B></PRE>rr_)	r2�exc_info�	tracebackr��	format_tb�format_exception_only�html�escape�join)rvri�tbr�r�rurrrrqs

��c	Cs\t|���}t�td�td�|D]"}tdt�|�dt�||��q&td�t�dS)z#Dump the shell environment as HTML.z<H3>Shell Environment:</H3>�<DL>�<DT>�<DD>�</DL>N)�sortedr�r�r�r�)r?r�rerrrrs cCs�t|���}t�td�|s&td�td�|D]Z}tdt�|�ddd�||}tdt�tt|���d	�td
t�t|���q2td�t�dS)
z$Dump the contents of a form as HTML.z<H3>Form Contents:</H3>z<P>No form fields.r�r��:� )r[z<i>z</i>r�r�N)r�r�r�r�r��reprrv)r�r�rerirrrr�sc
Csjt�td�zt��}Wn6tk
rP}ztdt�t|���W5d}~XYnXtt�|��t�dS)z#Dump the current directory as HTML.z#<H3>Current Working Directory:</H3>zOSError:N)r�r��getcwdrr�r��str)�pwd�msgrrrr�s&cCs(t�td�t�ttj�t�dS)Nz <H3>Command Line Arguments:</H3>)r�r2r<rrrrr�s

cCstd�dS)z9Dump a list of environment variables used by CGI as HTML.a�
<H3>These environment variables could have been set:</H3>
<UL>
<LI>AUTH_TYPE
<LI>CONTENT_LENGTH
<LI>CONTENT_TYPE
<LI>DATE_GMT
<LI>DATE_LOCAL
<LI>DOCUMENT_NAME
<LI>DOCUMENT_ROOT
<LI>DOCUMENT_URI
<LI>GATEWAY_INTERFACE
<LI>LAST_MODIFIED
<LI>PATH
<LI>PATH_INFO
<LI>PATH_TRANSLATED
<LI>QUERY_STRING
<LI>REMOTE_ADDR
<LI>REMOTE_HOST
<LI>REMOTE_IDENT
<LI>REMOTE_USER
<LI>REQUEST_METHOD
<LI>SCRIPT_NAME
<LI>SERVER_NAME
<LI>SERVER_PORT
<LI>SERVER_PROTOCOL
<LI>SERVER_ROOT
<LI>SERVER_SOFTWARE
</UL>
In addition, HTTP headers sent by the server may be passed in the
environment as well.  Here are some common variable names:
<UL>
<LI>HTTP_ACCEPT
<LI>HTTP_CONNECTION
<LI>HTTP_HOST
<LI>HTTP_PRAGMA
<LI>HTTP_REFERER
<LI>HTTP_USER_AGENT
</UL>
N)r�rrrrr�scCs(ddl}t|t�rd}nd}|�||�S)Nrs^[ -~]{0,200}[!-~]$z^[ -~]{0,200}[!-~]$)�rer5r��match)rZr�Z_vb_patternrrrr��s

r��__main__)rErFr0)NNNN),rs�__version__�iorrrZcollections.abcrr2r�Zurllib.parser=Zemail.parserrZ
email.messagerr�r�r��__all__rrr rrr%rr8r?r
rr]rrr	r
rrrrrrr�rprrrr�<module>sh�#	�
F
:'
/
_markupbase.cpython-38.opt-2.pyc000064400000016112150335716500012433 0ustar00U

e5d9�@sRddlZe�d�jZe�d�jZe�d�Ze�d�Ze�d�Z[Gdd�d�ZdS)	�Nz[a-zA-Z][-_.a-zA-Z0-9]*\s*z(\'[^\']*\'|"[^"]*")\s*z--\s*>z	]\s*]\s*>z]\s*>c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdZdd
�Z	d"dd�Z
d#dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!S)$�
ParserBasecCs|jtkrtd��dS)Nz)_markupbase.ParserBase must be subclassed)�	__class__r�RuntimeError��self�r�#/usr/lib64/python3.8/_markupbase.py�__init__s
�zParserBase.__init__cCstd��dS)Nz.subclasses of ParserBase must override error())�NotImplementedError)r�messagerrr�error s�zParserBase.errorcCsd|_d|_dS)N�r��lineno�offsetrrrr�reset$szParserBase.resetcCs|j|jfS�Nrrrrr�getpos(szParserBase.getposcCsb||kr|S|j}|�d||�}|rN|j||_|�d||�}||d|_n|j|||_|S)N�
r
)�rawdata�countr�rindexr)r�i�jrZnlines�posrrr�	updatepos0szParserBase.updatepos�c
Cs�|j}|d}|||d�dkr*|dS|||d�dkrBdSt|�}|||d�dkrh|�|�S||dkr~|�|�S|�||�\}}|dkr�|S|d	kr�d
|_||k�r�||}|dkr�||d|�}|d	kr�|�|�n
|�|�|dS|dk�r t||�}|�sdS|�	�}n�|dk�r<|�||�\}	}nt||jk�rR|d}n^|dk�r�|d	k�rx|�
|d|�}n$|d
k�r�|�d|�n
|�d�n|�d||�|dkr�|Sq�dS)N�r
�>)�-r���z--�[rZdoctyperz"'Z4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ>�linktype�attlist�element�linkz&unsupported '[' char in %s declarationz"unexpected '[' char in declarationz!unexpected %r char in declaration)r�len�
parse_comment�parse_marked_section�
_scan_name�_decl_othercharsZhandle_decl�unknown_decl�_declstringlit_match�end�_parse_doctype_subsetr)
rrrr�nZdecltype�c�data�m�namerrr�parse_declaration@sZ












�zParserBase.parse_declarationr
cCs�|j}|�|d|�\}}|dkr&|S|dkr@t�||d�}n4|dkrZt�||d�}n|�d||d|��|s|dS|r�|�d�}|�||d|��|�d�S)N�r>�rcdata�temp�ignore�cdata�include>�endif�else�ifz+unknown status keyword %r in marked sectionr )	rr)�_markedsectionclose�search�_msmarkedsectioncloser�startr+r-)rr�reportrZsectNamer�matchrrrr(�s
zParserBase.parse_marked_sectioncCsj|j}|||d�dkr$|�d�t�||d�}|s<dS|r`|�d�}|�||d|��|�d�S)N��<!--z"unexpected call to parse_comment()r r)rr�
_commentcloser?rAZhandle_commentr-)rrrBrrCrrrrr'�s

zParserBase.parse_commentc
Cs*|j}t|�}|}||k�r&||}|dk�r0|||d�}|dkrJdS|dkrp|�||d�|�d|�|d|kr�dS|d|kr�dS|||d�dkr�|j|d	d
�}|d	kr|Sq|�|d|�\}}|dkr�dS|dk�r|�||d�|�d|�t|d
|�}	|	||�}|d	k�r$|Sq|dk�r�|d|k�rLdS|�|d|�\}}|d	k�rn|S||dk�r$|d}q|dk�r�|d}||k�r�||���r�|d}�q�||k�r�||dk�r�|S|�||�|�d�ndSq|���r
|d}q|�||�|�d|�qdS)N�<rr z<!r
z*unexpected char in internal subset (in %r)rDrEr)rB>r$r#�notation�entityz)unknown declaration %r in internal subsetZ_parse_doctype_�%�;�]rz%unexpected char after internal subsetz%unexpected char %r in internal subset)rr&rrr'r)�getattr�isspace)
rr�declstartposrr/rr0�sr3Zmethrrrr.�sp


�








z ParserBase._parse_doctype_subsetcCsF|�||�\}}|dkrdS|j}d||d�krB|�d|�dSdS)Nr rr
)r)r�find)rrrOr3rrrrr�_parse_doctype_element�sz!ParserBase._parse_doctype_elementcCs�|j}|�||�\}}|||d�}|dkr2dS|dkrB|dS|�||�\}}|dkr^|S|||d�}|dkrzdS|dkr�d||d�kr�|�d|�d}ndS|||d���r�|d}q�||d�s�dSn|�||�\}}|||d�}|�sdS|dk�rDt||�}|�r&|��}ndS|||d�}|�sDdS|d	k�r�||d�d	k�rddS|�|d|�\}}|dk�r�|S|||d�}|�s�dS|dkrB|dSqBdS)
Nr
rr rr�(�)�'"�#)rr)rQrNr,r-)rrrOrr3rr0r2rrr�_parse_doctype_attlistsX





z!ParserBase._parse_doctype_attlistcCs�|�||�\}}|dkr|S|j}|||d�}|s:dS|dkrJ|dS|dkrnt||�}|sddS|��}q"|�||�\}}|dkr"|Sq"dS)Nrr
r rrU)r)rr,r-)rrrOr3rrr0r2rrr�_parse_doctype_notation=s"

z"ParserBase._parse_doctype_notationcCs�|j}|||d�dkrR|d}|||d�}|s:dS|��rP|d}q"qVq"n|}|�||�\}}|dkrr|S|j||d�}|s�dS|dkr�t||�}|r�|��}q�dSqr|dkr�|dS|�||�\}}|dkrr|SqrdS)Nr
rJr rrUr)rrNr)r,r-)rrrOrrr0r3r2rrr�_parse_doctype_entityTs4


z ParserBase._parse_doctype_entitycCs�|j}t|�}||krdSt||�}|r\|��}|��}|t|�|krLdS|��|��fS|�||�|�d|||d��dS)N)Nr zexpected name token at %r�)	rr&�_declname_match�group�strip�lowerr-rr)rrrOrr/r2rPr3rrrr)xs
�zParserBase._scan_namecCsdSrr)rr1rrrr+�szParserBase.unknown_declN)r
)r
)�__name__�
__module__�__qualname__r	rrrrr*r4r(r'r.rRrWrXrYr)r+rrrrrs 
R

C9$r)	�re�compilerCr[r,rFr>r@rrrrr�<module>s


_compression.cpython-38.opt-2.pyc000064400000007536150335716500012654 0ustar00U

e5d��@s6ddlZejZGdd�dej�ZGdd�dej�ZdS)�Nc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
BaseStreamcCs|jrtd��dS)NzI/O operation on closed file)�closed�
ValueError��self�r�$/usr/lib64/python3.8/_compression.py�_check_not_closedszBaseStream._check_not_closedcCs|��st�d��dS)NzFile not open for reading)�readable�io�UnsupportedOperationrrrr�_check_can_readszBaseStream._check_can_readcCs|��st�d��dS)NzFile not open for writing)�writablerrrrrr�_check_can_writeszBaseStream._check_can_writecCs(|��st�d��|��s$t�d��dS)Nz3Seeking is only supported on files open for readingz3The underlying file object does not support seeking)r
rr�seekablerrrr�_check_can_seeks
zBaseStream._check_can_seekN)�__name__�
__module__�__qualname__r	r
rrrrrrr	srcsfeZdZdd�Zddd�Z�fdd�Zdd	�Zd
d�Zdd
d�Zdd�Z	e
jfdd�Zdd�Z
�ZS)�DecompressReadercCsdS)NTrrrrrr
$szDecompressReader.readablercKs>||_d|_d|_d|_||_||_|jf|j�|_||_dS)NFr���)�_fp�_eof�_pos�_size�_decomp_factory�_decomp_args�
_decompressor�_trailing_error)r�fpZdecomp_factoryZtrailing_errorZdecomp_argsrrr�__init__'szDecompressReader.__init__csd|_t���S�N)r�super�closer��	__class__rrr#;szDecompressReader.closecCs
|j��Sr!)rrrrrrr?szDecompressReader.seekablec
CsPt|��:}|�d��$}|�t|��}||dt|��<W5QRXW5QRXt|�S)N�B)�
memoryview�cast�read�len)r�bZviewZ	byte_view�datarrr�readintoBs$zDecompressReader.readintorcCs�|dkr|��S|r|jrdSd}|jjr�|jjp<|j�t�}|sDq�|jf|j	�|_z|j�
||�}Wq�|jk
r�Yq�Yq�Xn4|jjr�|j�t�}|s�t
d��nd}|j�
||�}|r"q�q"|s�d|_|j|_dS|jt|�7_|S)Nr�zACompressed file ended before the end-of-stream marker was reachedT)�readallrr�eofZunused_datarr)�BUFFER_SIZErr�
decompressrZneeds_input�EOFErrorrrr*)r�sizer,Zrawblockrrrr)Hs@

��
zDecompressReader.readcCs,|j�d�d|_d|_|jf|j�|_dS)NrF)r�seekrrrrrrrrr�_rewindrszDecompressReader._rewindcCs�|tjkrnR|tjkr"|j|}n<|tjkrP|jdkrD|�tj�rDq6|j|}ntd�	|���||jkrr|�
�n
||j8}|dkr�|�ttj|��}|s�q�|t|�8}q||jS)NrzInvalid value for whence: {})
r�SEEK_SET�SEEK_CURr�SEEK_ENDrr)�DEFAULT_BUFFER_SIZEr�formatr6�minr*)r�offset�whencer,rrrr5xs&






zDecompressReader.seekcCs|jSr!)rrrrr�tell�szDecompressReader.tell)r)r)rrrr
r r#rr-r)r6rr7r5r?�
__classcell__rrr$rr!s

*r)rr:r1�BufferedIOBaser�	RawIOBaserrrrr�<module>scompileall.cpython-38.pyc000064400000022304150335716500011323 0ustar00U

e5dn5�	@s�dZddlZddlZddlZddlZddlZddlmZdddgZ	ddd	�Z
dd
d�Zdd�Zddd�Z
ddd�Zdd�Zedkr�ee��Ze�e�dS)a�Module/script to byte-compile all .py files to .pyc files.

When called as a script with arguments, this compiles the directories
given as arguments recursively; the -l option prevents it from
recursing into directories.

Without arguments, if compiles all modules on sys.path, without
recursing into subdirectories.  (Even though it should do so for
packages -- for now, you'll have to deal with packages separately.)

See module py_compile for details of the actual byte-compilation.
�N)�partial�compile_dir�compile_file�compile_path�
ccs|dkrt|tj�rt�|�}|s0td�|��zt�|�}Wn.tk
rl|dkrdtd�|��g}YnX|��|D]�}|dkr�qztj	�
||�}|dk	r�tj	�
||�}nd}tj	�|�s�||fVqz|dkrz|tjkrz|tj
krztj	�|�rztj	�|�szt|||d|d�EdHqzdS)N�zListing {!r}...zCan't list {!r}�__pycache__r�)�ddir�	maxlevels�quiet)�
isinstance�os�PathLike�fspath�print�format�listdir�OSError�sort�path�join�isdir�curdir�pardir�islink�	_walk_dir)�dirr
rr�names�name�fullname�dfile�r"�"/usr/lib64/python3.8/compileall.pyrs:


�
��rF���r	c
Cs�d}
|dkrtd��|dkrFzddlm}
Wntk
rDd}YnXt||||d�}d}|dkr�|
dk	r�|ppd}|
|d��0}
|
�tt||||||	d	�|�}t|dd
�}W5QRXn(|D]"\}}t	||||||||	�s�d}q�|S)aByte-compile all modules in the given directory tree.

    Arguments (only dir is required):

    dir:       the directory to byte-compile
    maxlevels: maximum recursion level (default 10)
    ddir:      the directory that will be prepended to the path to the
               file as it is compiled into each byte-code file.
    force:     if True, force compilation, even if timestamps are up-to-date
    quiet:     full output with False or 0, errors only with 1,
               no output with 2
    legacy:    if True, produce legacy pyc paths instead of PEP 3147 paths
    optimize:  optimization level or -1 for level of the interpreter
    workers:   maximum number of parallel workers
    invalidation_mode: how the up-to-dateness of the pyc will be checked
    Nrz%workers must be greater or equal to 0r	)�ProcessPoolExecutor)rrr
T)Zmax_workers)�force�rxr�legacy�optimize�invalidation_mode)�defaultF)
�
ValueErrorZconcurrent.futuresr%�ImportErrorr�mapr�_compile_file_tuple�minr)rrr
r&r'rr(r)�workersr*r%Zfiles_and_ddirs�successZexecutorZresults�filer!r"r"r#r2sF
����cKs|\}}t||f|�S)z-Needs to be toplevel for ProcessPoolExecutor.)r)Zfile_and_dfile�kwargsr3r!r"r"r#r/esr/c
Cs�d}|dkr"t|tj�r"t�|�}tj�|�}	|dk	rFtj�||	�}
nd}
|dk	rd|�|�}|rd|Stj�|��r�|r�|d}nB|dkr�|dkr�|nd}
t	j
j||
d�}nt	j
�|�}tj�|�}|	dd	�|	d	d�}}|d
k�r�|�s\zXt
t�|�j�}t�dt	j
jd|�}t|d��}|�d
�}W5QRX||k�rB|WSWntk
�rZYnX|�sptd�|��ztj|||
d||d�}W�ntjk
�r}zjd}|dk�r�|WY�RS|�r�td�|��ntddd�|jjtjjdd�}|� tjj�}t|�W5d}~XYn�t!t"tfk
�r�}zRd}|dk�rJ|WY�:S|�r`td�|��ntddd�t|j#j$d|�W5d}~XYnX|dk�r�d}|S)aTByte-compile one file.

    Arguments (only fullname is required):

    fullname:  the file to byte-compile
    ddir:      if given, the directory name compiled in to the
               byte-code file.
    force:     if True, force compilation, even if timestamps are up-to-date
    quiet:     full output with False or 0, errors only with 1,
               no output with 2
    legacy:    if True, produce legacy pyc paths instead of PEP 3147 paths
    optimize:  optimization level or -1 for level of the interpreter
    invalidation_mode: how the up-to-dateness of the pyc will be checked
    TrN�crr	�)�optimization���z.pyz<4sll�rb�zCompiling {!r}...)r)r*Fz*** Error compiling {!r}...z*** )�end�backslashreplace)�errors�:)%r
rrrr�basenamer�search�isfile�	importlib�util�cache_from_source�dirname�int�stat�st_mtime�structZpack�MAGIC_NUMBER�open�readrrr�
py_compile�compile�PyCompileError�msg�encode�sys�stdout�encoding�decode�SyntaxError�UnicodeError�	__class__�__name__)r r
r&r'rr(r)r*r2rr!Zmo�cfile�optZ	cache_dir�head�tail�mtimeZexpectZchandleZactual�ok�errrP�er"r"r#rjs�


�
�

�
�
$
c	CsTd}tjD]D}|r|tjkr2|r2|dkrNtd�q
|oLt||d|||||d�}q
|S)a�Byte-compile all module on sys.path.

    Arguments (all optional):

    skip_curdir: if true, skip current directory (default True)
    maxlevels:   max recursion level (default 0)
    force: as for compile_dir() (default False)
    quiet: as for compile_dir() (default 0)
    legacy: as for compile_dir() (default False)
    optimize: as for compile_dir() (default -1)
    invalidation_mode: as for compiler_dir()
    TrzSkipping current directoryN)rr(r)r*)rRrrrrr)	Zskip_curdirrr&rr(r)r*r2rr"r"r#r�s 

�
c
Cs�ddl}|jdd�}|jdddddd	d
�|jdtdd
d�|jddddd�|jdddddd�|jddddd�|jdddddd �|jd!d"d#dd$d �|jd%d&d'd(d)�|jd*d+d,d-d.�|jd/d0d1td2d3�d4d5�tjD�}|jd6t|�d7d8�|��}|j}|j	�r$ddl
}|�|j	�|_	|jdk	�r8|j}n|j
}|j�r�zF|jd9k�rZtjnt|j�� }|D]}|�|����qjW5QRXWn4tk
�r�|jd:k�r�td;�|j��Yd<SX|j�r�|j�d9d=���}	tj|	}
nd}
d>}z�|�rl|D]h}tj�|��r6t||j|j |j	|j|j!|
d?��sbd<}n,t"|||j|j |j	|j|j!|j#|
d@�	�s�d<}�q�|WSt$|j!|j |j|
dA�WSWn,t%k
�r�|jd:k�r�tdB�Yd<SXd>S)CzScript main program.rNz1Utilities to support installing Python libraries.)Zdescriptionz-lZstore_constrrz!don't recurse into subdirectories)�actionZconstr+�dest�helpz-r�	recursionzhcontrol the maximum recursion level. if `-l` and `-r` options are specified, then `-r` takes precedence.)�typercrdz-f�
store_truer&z/force rebuild even if timestamps are up to date)rbrcrdz-q�countrzIoutput only error messages; -qq will suppress the error messages as well.)rbrcr+rdz-br(z0use legacy (pre-PEP3147) compiled file locationsz-dZDESTDIRr
z�directory to prepend to file paths for use in compile-time tracebacks and in runtime tracebacks in cases where the source file is unavailable)�metavarrcr+rdz-xZREGEXPr'zskip files matching the regular expression; the regexp is searched for in the full path of each file considered for compilationz-iZFILE�flistzzadd all the files and directories listed in FILE to the list considered for compilation; if "-", names are read from stdin)rircrd�compile_destzFILE|DIR�*zrzero or more file and directory names to compile; if no arguments given, defaults to the equivalent of -l sys.path)ri�nargsrdz-jz	--workersr	zRun compileall concurrently)r+rfrdcSsg|]}|j���dd��qS)�_�-)r�lower�replace)�.0�moder"r"r#�
<listcomp>	s�zmain.<locals>.<listcomp>z--invalidation-modez�set .pyc invalidation mode; defaults to "checked-hash" if the SOURCE_DATE_EPOCH environment variable is set, and "timestamp" otherwise.)�choicesrdrorzError reading file list {}FrnT)r*)r1r*)r(r&rr*z
[interrupted])&�argparse�ArgumentParser�add_argumentrFrM�PycInvalidationMode�sorted�
parse_argsrkr'�rerNrerrjrR�stdinrK�append�striprrrrr*rq�upperrrrArr
r&r(rr1r�KeyboardInterrupt)
rv�parserZinvalidation_modes�argsZ
compile_destsr|r�f�lineZivl_moder*r2rcr"r"r#�main�s��
�
�
��
���
�
�
��� �
�
�r��__main__)Nrr)	rNFNrFr$r	N)NFNrFr$N)r	rFrFr$N)�__doc__rrR�importlib.utilrBrMrI�	functoolsr�__all__rrr/rrr�rYrFZexit_status�exitr"r"r"r#�<module>s<

�
3�
V�
"ibase64.cpython-38.opt-1.pyc000064400000041016150335716500011226 0ustar00U

e5d�O�@s�dZddlZddlZddlZddddddd	d
ddd
dddddddgZeefZdd�ZdCdd�Z	dDdd�Z
dd�Zdd�Ze�
dd�Ze�
dd�Zdd�Zdd�Zd Zdadad!d	�ZdEd"d
�Zd#d�ZdFd$d�Zdadad%Zd&ZdGd'd(�Zddddd)�d*d�Zddd+d,�d-d�Zd.Z da!da"da#dHd/d
�Z$d0d�Z%d1Z&e&d2d3Z'd4d�Z(d5d�Z)d6d7�Z*d8d�Z+d9d:�Z,d;d�Z-d<d=�Z.d>d?�Z/d@dA�Z0e1dBk�r�e/�dS)IzDBase16, Base32, Base64 (RFC 3548), Base85 and Ascii85 data encodings�N�encode�decode�encodebytes�decodebytes�	b64encode�	b64decode�	b32encode�	b32decode�	b16encode�	b16decode�	b85encode�	b85decode�	a85encode�	a85decode�standard_b64encode�standard_b64decode�urlsafe_b64encode�urlsafe_b64decodecCs|t|t�r4z|�d�WStk
r2td��YnXt|t�rB|Szt|���WStk
rvtd|j	j
�d�YnXdS)N�asciiz4string argument should contain only ASCII charactersz>argument should be a bytes-like object or ASCII string, not %r)�
isinstance�strr�UnicodeEncodeError�
ValueError�bytes_types�
memoryview�tobytes�	TypeError�	__class__�__name__��s�r!�/usr/lib64/python3.8/base64.py�_bytes_from_decode_data"s

��r#cCs,tj|dd�}|dk	r(|�t�d|��S|S)a*Encode the bytes-like object s using Base64 and return a bytes object.

    Optional altchars should be a byte string of length 2 which specifies an
    alternative alphabet for the '+' and '/' characters.  This allows an
    application to e.g. generate url or filesystem safe Base64 strings.
    F)�newlineN�+/)�binascii�
b2a_base64�	translate�bytes�	maketrans)r �altchars�encodedr!r!r"r3sFcCsNt|�}|dk	r*t|�}|�t�|d��}|rDt�d|�sDt�d��t�|�S)anDecode the Base64 encoded bytes-like object or ASCII string s.

    Optional altchars must be a bytes-like object or ASCII string of length 2
    which specifies the alternative alphabet used instead of the '+' and '/'
    characters.

    The result is returned as a bytes object.  A binascii.Error is raised if
    s is incorrectly padded.

    If validate is False (the default), characters that are neither in the
    normal base-64 alphabet nor the alternative alphabet are discarded prior
    to the padding check.  If validate is True, these non-alphabet characters
    in the input result in a binascii.Error.
    Nr%s[A-Za-z0-9+/]*={0,2}zNon-base64 digit found)	r#r(r)r*�re�	fullmatchr&�Error�
a2b_base64)r r+Zvalidater!r!r"rAs
cCst|�S)zrEncode bytes-like object s using the standard Base64 alphabet.

    The result is returned as a bytes object.
    )rrr!r!r"rZscCst|�S)aQDecode bytes encoded with the standard Base64 alphabet.

    Argument s is a bytes-like object or ASCII string to decode.  The result
    is returned as a bytes object.  A binascii.Error is raised if the input
    is incorrectly padded.  Characters that are not in the standard alphabet
    are discarded prior to the padding check.
    )rrr!r!r"rasr%s-_cCst|��t�S)z�Encode bytes using the URL- and filesystem-safe Base64 alphabet.

    Argument s is a bytes-like object to encode.  The result is returned as a
    bytes object.  The alphabet uses '-' instead of '+' and '_' instead of
    '/'.
    )rr(�_urlsafe_encode_translationrr!r!r"roscCst|�}|�t�}t|�S)a�Decode bytes using the URL- and filesystem-safe Base64 alphabet.

    Argument s is a bytes-like object or ASCII string to decode.  The result
    is returned as a bytes object.  A binascii.Error is raised if the input
    is incorrectly padded.  Characters that are not in the URL-safe base-64
    alphabet, and are not a plus '+' or slash '/', are discarded prior to the
    padding check.

    The alphabet uses '-' instead of '+' and '_' instead of '/'.
    )r#r(�_urlsafe_decode_translationrrr!r!r"rxs
s ABCDEFGHIJKLMNOPQRSTUVWXYZ234567cs>tdkr,dd�tD���fdd��D�ad�t|t�sBt|���}t|�d}|rb|dd|}t�}tj	}t}t
dt|�d�D]V}||||d�d�}|||d	?||d
?d@||d?d@||d@7}q�|d
kr�d|dd�<nF|dk�rd|dd�<n.|dk�r d|dd�<n|dk�r6d|dd�<t|�S)zKEncode the bytes-like object s using Base32 and return a bytes object.
    NcSsg|]}t|f��qSr!�r)��.0�ir!r!r"�
<listcomp>�szb32encode.<locals>.<listcomp>csg|]}�D]}||�qqSr!r!�r5�a�b�Zb32tabr!r"r7�s��r�big��i��
�s======i�����s====����s===�����=���)�_b32tab2�_b32alphabetrrrr�len�	bytearray�int�
from_bytes�ranger))r �leftoverr,rOZb32tab2r6�cr!r;r"r�s<
��
�


c
	Csztdkrdd�tt�D�at|�}t|�dr8t�d��|dk	r^t|�}|�t�	dd|��}|rj|�
�}t|�}|�d�}|t|�}t�}t}t
d	t|�d�D]h}|||d�}d	}	z|D]}
|	d
>||
}	q�Wn tk
r�t�d�d�YnX||	�d
d�7}q�|d�s |d
k�r*t�d��|�rr|�rr|	d
|K}	|	�d
d�}dd
|d}|d|�|dd�<t|�S)aZDecode the Base32 encoded bytes-like object or ASCII string s.

    Optional casefold is a flag specifying whether a lowercase alphabet is
    acceptable as input.  For security purposes, the default is False.

    RFC 3548 allows for optional mapping of the digit 0 (zero) to the
    letter O (oh), and for optional mapping of the digit 1 (one) to
    either the letter I (eye) or letter L (el).  The optional argument
    map01 when not None, specifies which letter the digit 1 should be
    mapped to (when map01 is not None, the digit 0 is always mapped to
    the letter O).  For security purposes the default is None, so that
    0 and 1 are not allowed in the input.

    The result is returned as a bytes object.  A binascii.Error is raised if
    the input is incorrectly padded or if there are non-alphabet
    characters present in the input.
    NcSsi|]\}}||�qSr!r!)r5�k�vr!r!r"�
<dictcomp>�szb32decode.<locals>.<dictcomp>�zIncorrect paddings01�OrHrr<zNon-base32 digit foundr>>rrBrErG��+���)�_b32rev�	enumeraterKr#rLr&r/r(r)r*�upper�rstriprMrP�KeyError�to_bytes)
r �casefoldZmap01�lZpadchars�decodedZb32revr6Zquanta�accrRZlastrQr!r!r"r	�s@


cCst�|���S)zKEncode the bytes-like object s using Base16 and return a bytes object.
    )r&Zhexlifyr]rr!r!r"r
�scCs4t|�}|r|��}t�d|�r*t�d��t�|�S)a�Decode the Base16 encoded bytes-like object or ASCII string s.

    Optional casefold is a flag specifying whether a lowercase alphabet is
    acceptable as input.  For security purposes, the default is False.

    The result is returned as a bytes object.  A binascii.Error is raised if
    s is incorrectly padded or if there are non-alphabet characters present
    in the input.
    s	[^0-9A-F]zNon-base16 digit found)r#r]r-�searchr&r/Z	unhexlify)r rar!r!r"r�s

s<~s~>c	s�t|t�st|���}t|�d}|r4|d|}t�dt|�d��|�}����fdd�|D�}|r�|s�|ddkr��dd	|d<|dd|�|d<d
�|�S)NrGr=z!%dIcsPg|]H}�r|sdn6�r$|dkr$dn&�|d�|dd�|d�qS)�zi    �yi�^	�Ui9r!)r5Zword��chars�chars2�foldnuls�
foldspacesr!r"r7!s�
�
�z_85encode.<locals>.<listcomp>rIrfrr<�)	rrrrrL�struct�StructZunpack�join)	r:rjrk�padrlrm�paddingZwords�chunksr!rir"�	_85encodes
�ru)rm�wrapcolrr�adobecs�tdkr*dd�tdd�D�add�tD�at|tt|d|��|rHt���r�t|rVdnd	�����fd
d�tdt����D�}|r�t|d�d�kr�|�d
�d�|��|r��t	7��S)a�Encode bytes-like object b using Ascii85 and return a bytes object.

    foldspaces is an optional flag that uses the special short sequence 'y'
    instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This
    feature is not supported by the "standard" Adobe encoding.

    wrapcol controls whether the output should have newline (b'\n') characters
    added to it. If this is non-zero, each output line will be at most this
    many characters long.

    pad controls whether the input is padded to a multiple of 4 before
    encoding. Note that the btoa implementation always pads.

    adobe controls whether the encoded byte sequence is framed with <~ and ~>,
    which is used by the Adobe implementation.
    NcSsg|]}t|f��qSr!r3r4r!r!r"r7Dsza85encode.<locals>.<listcomp>�!�vcSsg|]}tD]}||�qqSr!)�	_a85charsr8r!r!r"r7EsTrCrBcsg|]}�||���qSr!r!r4��resultrvr!r"r7Ms�rrIrn�
)
�
_a85chars2rPrzru�	_A85START�maxrL�appendrq�_A85END)r:rmrvrrrwrtr!r{r"r/s$�

s 	

)rmrw�ignorecharsc	Cs�t|�}|rH|�t�s$td�t���|�t�r<|dd�}n|dd�}t�d�j	}g}|j
}g}|j
}|j}	|dD]�}
d|
kr�dkr�nnl||
�t|�d	kr�d
}|D]}
d||
d}q�z|||��Wn tj
k
r�td�d�YnX|	�qv|
d
k�r |�rtd��|d�qv|�rH|
dk�rH|�r>td��|d�qv|
|k�rVqvqvtd|
��qvd�|�}dt|�}
|
�r�|d|
�}|S)a�Decode the Ascii85 encoded bytes-like object or ASCII string b.

    foldspaces is a flag that specifies whether the 'y' short sequence should be
    accepted as shorthand for 4 consecutive spaces (ASCII 0x20). This feature is
    not supported by the "standard" Adobe encoding.

    adobe controls whether the input sequence is in Adobe Ascii85 format (i.e.
    is framed with <~ and ~>).

    ignorechars should be a byte string containing characters to ignore from the
    input. This should only contain whitespace characters, and by default
    contains all whitespace characters in ASCII.

    The result is returned as a bytes object.
    z1Ascii85 encoded byte sequences must end with {!r}rC���N�!Isuuuurx�ur<rrhzAscii85 overflow�zzz inside Ascii85 5-tuples�yzy inside Ascii85 5-tuples    zNon-Ascii85 digit found: %crnrG)r#�endswithr�r�format�
startswithrrorp�packr��clearrL�errorrq)r:rmrwr��packIrcZdecoded_appendZcurrZcurr_appendZ
curr_clear�xrdr|rsr!r!r"rXsZ
��





sU0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~cCs2tdkr$dd�tD�add�tD�at|tt|�S)z�Encode bytes-like object b in base85 format and return a bytes object.

    If pad is true, the input is padded with b'\0' so its length is a multiple of
    4 bytes before encoding.
    NcSsg|]}t|f��qSr!r3r4r!r!r"r7�szb85encode.<locals>.<listcomp>cSsg|]}tD]}||�qqSr!)�	_b85charsr8r!r!r"r7�s)�
_b85chars2�_b85alphabetr�ru)r:rrr!r!r"r�s	c
	CsJtdkr,dgdatt�D]\}}|t|<qt|�}t|�d}|d|}g}t�d�j}tdt|�d�D]�}|||d�}d}z|D]}|dt|}q�WnFt	k
r�t|�D]&\}}t|dkr�t
d||�d�q��YnXz|�||��Wqntjk
�r$t
d	|�d�YqnXqnd
�
|�}	|�rF|	d|�}	|	S)zqDecode the base85-encoded bytes-like object or ASCII string b

    The result is returned as a bytes object.
    N�r<�~r�rrhz#bad base85 character at position %dz+base85 overflow in hunk starting at byte %drn)�_b85decr\r�r#rLrorpr�rPrrr�r�rq)
r:r6rRrs�outr��chunkrd�jr|r!r!r"r
�sH

����

�LrGrEcCsX|�t�}|sqTt|�tkr>|�tt|��}|s4q>||7}qt�|�}|�|�qdS)z1Encode a file; input and output are binary files.N)�read�
MAXBINSIZErLr&r'�write)�input�outputr �ns�liner!r!r"r�s


cCs(|��}|sq$t�|�}|�|�qdS)z1Decode a file; input and output are binary files.N)�readliner&r0r�)r�r�r�r r!r!r"r�s

c
Cs�zt|�}Wn8tk
rD}zd|jj}t|�|�W5d}~XYnX|jdkrjd|j|jjf}t|��|jdkr�d|j|jjf}t|��dS)Nz"expected bytes-like object, not %s)rRr:�Bz-expected single byte elements, not %r from %srBz(expected 1-D data, not %d-D data from %s)rrrrr��ndim)r �m�err�msgr!r!r"�_input_type_check�s
�
�r�cCsLt|�g}tdt|�t�D]$}|||t�}|�t�|��qd�|�S)zVEncode a bytestring into a bytes object containing multiple lines
    of base-64 data.rrn)r�rPrLr�r�r&r'rq)r �piecesr6r�r!r!r"rscCsddl}|�dtd�t|�S)zLegacy alias of encodebytes().rNzAencodestring() is a deprecated alias since 3.1, use encodebytes()rC)�warnings�warn�DeprecationWarningr�r r�r!r!r"�encodestrings�r�cCst|�t�|�S)z8Decode a bytestring of base-64 data into a bytes object.)r�r&r0rr!r!r"rscCsddl}|�dtd�t|�S)zLegacy alias of decodebytes().rNzHdecodestring() is a deprecated alias since Python 3.1, use decodebytes()rC)r�r�r�rr�r!r!r"�decodestring$s�r�c	
Csddl}ddl}z|�|jdd�d�\}}WnP|jk
r~}z0|j|_t|�td|jd�|�d�W5d}~XYnXt}|D]@\}}|dkr�t}|dkr�t	}|d	kr�t	}|d
kr�t
�dSq�|�r|ddk�rt|dd��}|||jj�W5QRXn||j
j|jj�dS)
zSmall main programrNrBZdeutz�usage: %s [-d|-e|-u|-t] [file|-]
        -d, -u: decode
        -e: encode (default)
        -t: encode and decode string 'Aladdin:open sesame'rCz-ez-dz-uz-t�-�rb)�sys�getopt�argvr��stderr�stdout�print�exitrr�test�open�buffer�stdin)	r�r�Zopts�argsr��func�or9�fr!r!r"�main.s2�r�cCs<d}tt|��t|�}tt|��t|�}tt|��dS)NsAladdin:open sesame)r��reprrr)Zs0�s1�s2r!r!r"r�Hsr��__main__)N)NF)FN)F)FFF)F)2�__doc__r-ror&�__all__r)rMrr#rrrrr*r1r2rrrKrJr[rr	r
rrzr~rr�rurrr�r�r�r�rr
ZMAXLINESIZEr�rrr�rr�rr�r�r�rr!r!r!r"�<module>s��

	&
C

)H
-	
	


ntpath.cpython-38.opt-2.pyc000064400000030500150335716500011435 0ustar00U

e5dVl�&@s$dZdZdZdZdZdZdZdZddlZddl	Z	ddl
Z
ddlZdd	lTd
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/g&Zd0d1�Z
d2d
�Zd3d�Zd4d�Zd5d
�Zd6d�Zd7d�Zejje_d8d�Zd9d�Zd:d�Zd;d�Zzdd<lmZWnek
�r$dZYnXd=d�Zd>d�Zd?d�Zd@d�Z dAdB�Z!zddClm"Z"Wnek
�rxe!Z#Yn
XdDd �Z#zddElm$Z$m%Z&Wnek
�r�e#Z'YnXdFdG�Z(dHdI�Z)dJd)�Z'e*e	dK��o�e	�+�dLdMkZ,dQdNd+�Z-dOd/�Z.zddPlm/Z0Wnek
�rYnXdS)R�.�..�\�;�/z.;C:\binZnul�N)�*�normcase�isabs�join�
splitdrive�split�splitext�basename�dirname�commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�ismount�
expanduser�
expandvars�normpath�abspath�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenames�relpath�samefile�sameopenfile�samestat�
commonpathcCst|t�rdSdSdS)N�\/�\/)�
isinstance�bytes��path�r4�/usr/lib64/python3.8/ntpath.py�
_get_bothseps"s
r6cCs8t�|�}t|t�r$|�dd���S|�dd���SdS)N�/�\rr)�os�fspathr0r1�replace�lower��sr4r4r5r,s

cCsjt�|�}t|t�r,|�dd��d�rBdSn|�dd��d�rBdSt|�d}t|�d	koh|d	t|�kS)
Nr7r8�\\?\Trr�\\?\�r)	r9r:r0r1r;�
startswithr�lenr6r=r4r4r5r	=s

c

GsTt�|�}t|t�r"d}d}d}nd}d}d}z�|sD|dd�|t|�\}}ttj|�D]~}t|�\}}	|	r�|	d|kr�|s�|s�|}|	}q\n*|r�||kr�|��|��kr�|}|	}q\|}|r�|d|kr�||}||	}q\|�r|d|k�r|�r|dd�|k�r|||WS||WSttt	fk
�rNt
jd	|f|���YnXdS)
Nr8r.�:rr/�:r���r
)r9r:r0r1r�mapr<�	TypeError�AttributeError�BytesWarning�genericpath�_check_arg_types)
r3�pathsr!�seps�colonZresult_driveZresult_path�pZp_driveZp_pathr4r4r5r
MsL


��
cCst�|�}t|�dk�rt|t�r0d}d}d}nd}d}d}|�||�}|dd�|dkr�|dd	�|kr�|�|d�}|d
kr�|dd�|fS|�||d�}||dkr�|dd�|fS|d
kr�t|�}|d|�||d�fS|dd�|k�r|dd�|dd�fS|dd�|fS)N�r8r7rDrrrEr�rFrA)r9r:rCr0r1r;�find)rPr!r$rOZnormp�indexZindex2r4r4r5r|s.

$cCsxt�|�}t|�}t|�\}}t|�}|rD||d|krD|d8}q&|d|�||d�}}|�|�pj|}|||fS�NrA)r9r:r6rrC�rstrip)rPrN�d�i�head�tailr4r4r5r�s

cCs8t�|�}t|t�r$t�|ddd�St�|ddd�SdS)Nr8r7�.rrr)r9r:r0r1rK�	_splitext�rPr4r4r5r
�s

cCst|�dSrU�rr]r4r4r5r�scCst|�dS)Nrr^r]r4r4r5r�sc
Cs8zt�|�}Wntttfk
r*YdSXt�|j�S)NF)r9�lstat�OSError�
ValueErrorrI�stat�S_ISLNK�st_mode�r3�str4r4r5r�s
c	Cs.zt�|�}Wnttfk
r(YdSXdS)NFT)r9r_r`rarer4r4r5r�s
)�_getvolumepathnamecCstt�|�}t|�}t|�}t|�\}}|rD|d|krD|pB||kS||krPdStrl|�|�t|��|�kSdSdS)NrTF)r9r:r6rrrgrV)r3rN�root�restr4r4r5rs
cCs�t�|�}t|t�rd}nd}|�|�s,|Sdt|�}}||kr\||t|�kr\|d7}q:dtjkrrtjd}nFdtjkr�|Sztjd}Wntk
r�d}YnXt	|tjd�}t|t�r�t�
|�}|dkr�t	t|�|d|��}|||d�S)N�~�~rAZUSERPROFILEZHOMEPATHZ	HOMEDRIVE�)r9r:r0r1rBrCr6�environ�KeyErrorr
�fsencoder)r3�tilderX�n�userhome�driver4r4r5r!s.








cCs2t�|�}t|t�rhd|kr(d|kr(|Sddl}t|j|jdd�}d}d}d}d}d}ttd	d�}nFd
|kr|d|kr||Sddl}|j|jd}d}d}d
}d}d
}tj}|dd�}	d}
t	|�}|
|k�r.||
|
d�}||k�rX||
dd�}t	|�}z&|�
|�}
|	||d|
d�7}	Wn*tk
�rR|	||7}	|d}
YnX�n�||k�rJ||
d|
d�|k�r�|	|7}	|
d7}
n�||
dd�}t	|�}z|�
|�}
Wn*tk
�r�|	||7}	|d}
YnhX|d|
�}
z.|dk�rt�tjt�
|
��}n||
}Wn"tk
�r<||
|}YnX|	|7}	�n�||k�r||
d|
d�|k�r�|	|7}	|
d7}
�q$||
d|
d�|k�r^||
dd�}t	|�}z|�
|�}
Wn.tk
�r�|	|||7}	|d}
YnlX|d|
�}
z.|dk�r"t�tjt�
|
��}n||
}Wn&tk
�rR|||
|}YnX|	|7}	n�|dd�}
|
d7}
||
|
d�}|�r�||k�r�|
|7}
|
d7}
||
|
d�}�q�z.|dk�r�t�tjt�
|
��}n||
}Wntk
�r||
}YnX|	|7}	|�r$|
d8}
n|	|7}	|
d7}
q�|	S)N�$�%rz_-�ascii�'�{�}�environb�$�%�'�{�}rArQ)r9r:r0r1�stringZ
ascii_lettersZdigits�getattrrmrCrTraro�fsdecodern)r3r�ZvarcharsZquoteZpercentZbraceZrbraceZdollarrm�resrTZpathlen�c�var�valuer4r4r5rQs�













c	CsPt�|�}t|t�r*d}d}d}d}d}nd}d}d}d	}d
}|�|�rL|S|�||�}t|�\}}|�|�r�||7}|�|�}|�|�}d}|t	|�k�r,||r�|||kr�||=q�|||k�r"|dkr�||d|kr�||d|d�=|d8}n&|dk�r|�
|��r||=n|d7}q�|d7}q�|�sB|�sB|�|�||�|�S)
Nr8r7r[�..)s\\.\r?rrrr)z\\.\r@rrA)
r9r:r0r1rBr;r�lstriprrC�endswith�appendr
)	r3r!r$rr Zspecial_prefixes�prefix�compsrXr4r4r5r�sF









cCs@t�|�}t|�s8t|t�r&t��}nt��}t||�}t|�S�N)	r9r:r	r0r1�getcwdb�getcwdr
r)r3�cwdr4r4r5�_abspath_fallback�s



r�)�_getfullpathnamec	Cs4ztt|��WSttfk
r.t|�YSXdSr�)rr�r`rar�r2r4r4r5rs)�_getfinalpathname�readlinkc
Cs�d}t�}t|�|kr�|�t|��z:|}t|�}t|�s\t|�sJ|}Wq�ttt|�|��}Wq
t	k
r�}z|j
|kr�WY�q��W5d}~XYq
tk
r�Yq�Yq
Xq
|S)N)rArQrR��� �2�C�Wi&i(i))�setr�add�_nt_readlinkr	rrr
rr`�winerrorra)r3�allowed_winerror�seenZold_path�exr4r4r5�_readlink_deeps&
r�cCs�d}d}|r�zt|�}|r$t||�n|WStk
r�}z�|j|krF�z0t|�}||krt|rft||�n|WWY�TSWntk
r�YnXt|�\}}|r�|s�||WY�S|r�t||�n|}W5d}~XYqXq|S)N)rArQrRr�r�r�r�r�r��{i�i�rl)r�r
r`r�r�r)r3r�rZr��new_path�namer4r4r5�_getfinalpathname_nonstrictCs(
 &r�c	
Cs^t|�}t|t�rBd}d}d}t��}t|�tt�t��krjdSn(d}d}d}t��}t|�tt�krjdS|�	|�}|s�t
|�s�t||�}zt|�}d	}Wn0t
k
r�}z|j}t|�}W5d}~XYnX|�sZ|�	|��rZ|�	|�r�||t|�d�}n|t|�d�}zt|�|k�r"|}Wn4t
k
�rX}z|j|k�rH|}W5d}~XYnX|S)
Nr?s\\?\UNC\s\\s\\.\NULr@z\\?\UNC\z\\z\\.\NULr)rr0r1r9r�rror&r�rBr	r
r�r`r�r�rC)	r3r�Z
unc_prefixZnew_unc_prefixr�Z
had_prefixZinitial_winerrorr�Zspathr4r4r5r'qsD



�getwindowsversionrRrQcCsft�|�}t|t�r"d}d}d}nd}d}d}|dkr:|}|sFtd��t�|�}z�tt|��}tt|��}t|�\}}t|�\}	}
t|�t|	�kr�td|	|f��d	d
�|�	|�D�}dd
�|
�	|�D�}d}
t
||�D]$\}}t|�t|�kr�q�|
d
7}
q�|gt|�|
||
d�}|�s(|WSt|�WSt
ttttfk
�r`t�d||��YnXdS)Nr8r[r�rrrzno path specifiedz&path is on mount %r, start on mount %rcSsg|]}|r|�qSr4r4��.0�xr4r4r5�
<listcomp>�szrelpath.<locals>.<listcomp>cSsg|]}|r|�qSr4r4r�r4r4r5r��srrAr))r9r:r0r1rarrrrr�ziprCr
rHrIrJ�DeprecationWarningrKrL)r3�startr!rr Z	start_absZpath_absZstart_driveZ
start_restZ
path_driveZ	path_rest�
start_list�	path_listrXZe1Ze2�rel_listr4r4r5r)�sJ


�

c	s�|std��tttj|��}t|dt�r8d�d�d�nd�d�d��z@��fd	d
�|D�}�fdd
�|D�}zt�fdd
�|D��\}Wntk
r�td�d�YnXttdd
�|D���dkr�td��t	|d�
����\}}|���}�fdd
�|D�}�fdd
�|D�}t|�}t
|�}t|�D]*\}	}
|
||	k�r*|d|	�}�qf�q*|dt|��}|�rt|�n|}|��|�WSttfk
�r�tjd|���YnXdS)Nz%commonpath() arg is an empty sequencerr8r7r[rrrcs g|]}t|��������qSr4)rr;r<)r�rP)r$r!r4r5r��szcommonpath.<locals>.<listcomp>csg|]\}}|����qSr4r^�r�rWrP�r!r4r5r��sc3s"|]\}}|dd��kVqdSrUr4r�r�r4r5�	<genexpr>�szcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathscss|]\}}|VqdSr�r4r�r4r4r5r��srAzPaths don't have the same drivecsg|]}|r|�kr|�qSr4r4�r�r��rr4r5r��scsg|]}�fdd�|D��qS)csg|]}|r|�kr|�qSr4r4r�r�r4r5r�sz)commonpath.<locals>.<listcomp>.<listcomp>r4)r�r>r�r4r5r�sr-)r-)ra�tuplerGr9r:r0r1r�rCrr;r�min�max�	enumerater
rHrIrKrL)rMZdrivesplits�split_pathsr	rsr3�common�s1�s2rXr�r�r4)r$rr!r5r-�sF

)�_isdir)N)1rr r%r!r"r$r#r&r9�sysrbrK�__all__r6rr	r
rrr
r\�__doc__rrrr�ntrg�ImportErrorrrrrr�r�rr�r�r�r'r�r��hasattrr�r(r)r-r�rr4r4r4r5�<module>s��
/8

0q2

*.2�
84contextvars.cpython-38.opt-2.pyc000064400000000365150335716500012525 0ustar00U

e5d��@s ddlmZmZmZmZdZdS)�)�Context�
ContextVar�Token�copy_contextN)Z_contextvarsrrrr�__all__�rr�#/usr/lib64/python3.8/contextvars.py�<module>s_sitebuiltins.cpython-38.opt-2.pyc000064400000005617150335716500013027 0ustar00U

e5d+�@s<ddlZGdd�de�ZGdd�de�ZGdd�de�ZdS)�Nc@s&eZdZdd�Zdd�Zddd�ZdS)	�QuittercCs||_||_dS�N��name�eof)�selfrr�r�%/usr/lib64/python3.8/_sitebuiltins.py�__init__szQuitter.__init__cCsd|j|jfS)NzUse %s() or %s to exitr�rrrr	�__repr__szQuitter.__repr__NcCs(ztj��WnYnXt|��dSr)�sys�stdin�close�
SystemExit)r�coderrr	�__call__s
zQuitter.__call__)N)�__name__�
__module__�__qualname__r
rrrrrr	r
src@s2eZdZdZddd�Zdd�Zdd�Zd	d
�ZdS)
�_Printer�rcs4ddl�||_||_d|_��fdd�|D�|_dS)Nrcs$g|]}�D]}�j�||��qqSr)�path�join)�.0�dir�filename��files�osrr	�
<listcomp>(s�z%_Printer.__init__.<locals>.<listcomp>)r�_Printer__name�_Printer__data�_Printer__lines�_Printer__filenames)rr�datar�dirsrrr	r
#s�z_Printer.__init__c
Cs~|jr
dSd}|jD]B}z(t|d��}|��}W5QRXWqXWqtk
rTYqXq|sb|j}|�d�|_t|j�|_dS)N�r�
)	r#r$�open�read�OSErrorr"�split�len�_Printer__linecnt)rr%r�fprrr	�__setup,s

z_Printer.__setupcCs8|��t|j�|jkr$d�|j�Sd|jfdSdS)Nr(z!Type %s() to see the full %s text�)�_Printer__setupr-r#�MAXLINESrr!rrrr	r<sz_Printer.__repr__cCs�|��d}d}z(t|||j�D]}t|j|�q"Wntk
rPYq�YqX||j7}d}|dkr~t|�}|dkr`d}q`|dkrq�qdS)Nz0Hit Return for more, or q (and Return) to quit: r)��qr5)r2�ranger3�printr#�
IndexError�input)r�prompt�lineno�i�keyrrr	rCs 

z_Printer.__call__N)rr)rrrr3r
r2rrrrrr	rs

	rc@seZdZdd�Zdd�ZdS)�_HelpercCsdS)NzHType help() for interactive help, or help(object) for help about object.rrrrr	rbsz_Helper.__repr__cOsddl}|j||�S)Nr)�pydoc�help)r�args�kwdsr?rrr	resz_Helper.__call__N)rrrrrrrrr	r>Xs
r>)r
�objectrrr>rrrr	�<module>s;mailbox.cpython-38.opt-1.pyc000064400000165432150335716500011606 0ustar00U

e5dE3�@sRdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
ZddlZddlZzddl
Z
Wnek
r�dZ
YnXddddddd	d
ddd
ddddddgZej�d�ZGdd�d�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd	�d	ejj�ZGd d
�d
e�ZGd!d"�d"e�ZGd#d�de�ZGd$d�de�ZGd%d
�d
e�Z Gd&d�de�Z!Gd'd(�d(�Z"Gd)d*�d*e"�Z#d=d,d-�Z$d.d/�Z%d0d1�Z&d2d3�Z'd4d5�Z(d6d7�Z)Gd8d�de*�Z+Gd9d�de+�Z,Gd:d�de+�Z-Gd;d�de+�Z.Gd<d�de+�Z/dS)>zDRead/write support for Maildir, mbox, MH, Babyl, and MMDF mailboxes.�N�Mailbox�Maildir�mbox�MH�Babyl�MMDF�Message�MaildirMessage�mboxMessage�	MHMessage�BabylMessage�MMDFMessage�Error�NoSuchMailboxError�
NotEmptyError�ExternalClashError�FormatError�asciic@seZdZdZdCdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dDdd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�ZdEd0d1�Zd2d3�ZdFd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Z d>d?�Z!d@Z"dGdAdB�Z#dS)Hrz*A group of messages in a particular place.NTcCs tj�tj�|��|_||_dS)zInitialize a Mailbox instance.N)�os�path�abspath�
expanduser�_path�_factory��selfr�factory�create�r�/usr/lib64/python3.8/mailbox.py�__init__$szMailbox.__init__cCstd��dS)�$Add message and return assigned key.�&Method must be implemented by subclassN��NotImplementedError�r�messagerrr�add)szMailbox.addcCstd��dS)�=Remove the keyed message; raise KeyError if it doesn't exist.r"Nr#�r�keyrrr�remove-szMailbox.removecCs|�|�dS�N)r+r)rrr�__delitem__1szMailbox.__delitem__cCs(z|�|�Wntk
r"YnXdS�z'If the keyed message exists, remove it.N)r+�KeyErrorr)rrr�discard4szMailbox.discardcCstd��dS)�>Replace the keyed message; raise KeyError if it doesn't exist.r"Nr#�rr*r&rrr�__setitem__;szMailbox.__setitem__cCs*z|�|�WStk
r$|YSXdS)z9Return the keyed message, or default if it doesn't exist.N)�__getitem__r/)rr*�defaultrrr�get?szMailbox.getc
CsB|js|�|�St�|�|���}|�|�W5QR�SQRXdS)z=Return the keyed message; raise KeyError if it doesn't exist.N)r�get_message�
contextlib�closing�get_file)rr*�filerrrr4Fs
zMailbox.__getitem__cCstd��dS)�4Return a Message representation or raise a KeyError.r"Nr#r)rrrr7NszMailbox.get_messagecCst�|�|����S)z�Return a string representation or raise a KeyError.

        Uses email.message.Message to create a 7bit clean string
        representation of the message.��email�message_from_bytes�	get_bytesZ	as_stringr)rrr�
get_stringRszMailbox.get_stringcCstd��dS)z8Return a byte string representation or raise a KeyError.r"Nr#r)rrrr@YszMailbox.get_bytescCstd��dS)�6Return a file-like representation or raise a KeyError.r"Nr#r)rrrr:]szMailbox.get_filecCstd��dS)�Return an iterator over keys.r"Nr#�rrrr�iterkeysaszMailbox.iterkeyscCst|���S)zReturn a list of keys.)�listrErDrrr�keyseszMailbox.keysc	cs>|��D]0}z||}Wntk
r0YqYnX|VqdS)z%Return an iterator over all messages.N�rEr/�rr*�valuerrr�
itervaluesis
zMailbox.itervaluescCs|��Sr,)rKrDrrr�__iter__rszMailbox.__iter__cCst|���S)z,Return a list of messages. Memory intensive.)rFrKrDrrr�valuesuszMailbox.valuesc	csB|��D]4}z||}Wntk
r0YqYnX||fVqdS)z.Return an iterator over (key, message) tuples.NrHrIrrr�	iteritemsys
zMailbox.iteritemscCst|���S)z9Return a list of (key, message) tuples. Memory intensive.)rFrNrDrrr�items�sz
Mailbox.itemscCstd��dS)�9Return True if the keyed message exists, False otherwise.r"Nr#r)rrr�__contains__�szMailbox.__contains__cCstd��dS)�*Return a count of messages in the mailbox.r"Nr#rDrrr�__len__�szMailbox.__len__cCs|��D]}|�|�qdS)zDelete all messages.N)rGr0r)rrr�clear�sz
Mailbox.clearcCs4z||}Wntk
r$|YSX|�|�|S)z3Delete the keyed message and return it, or default.)r/r0)rr*r5�resultrrr�pop�s

zMailbox.popcCs*|��D]}||�|�fStd��dS)z6Delete an arbitrary (key, message) pair and return it.zNo messages in mailboxN)rErVr/r)rrr�popitem�szMailbox.popitemc	Cstt|d�r|��}nt|d�r(|��}n|}d}|D].\}}z|||<Wq4tk
r`d}Yq4Xq4|rptd��dS)z4Change the messages that correspond to certain keys.rNrOFTzNo message with key(s)N)�hasattrrNrOr/)r�arg�sourceZbad_keyr*r&rrr�update�s



zMailbox.updatecCstd��dS)�&Write any pending changes to the disk.r"Nr#rDrrr�flush�sz
Mailbox.flushcCstd��dS)�Lock the mailbox.r"Nr#rDrrr�lock�szMailbox.lockcCstd��dS)�#Unlock the mailbox if it is locked.r"Nr#rDrrr�unlock�szMailbox.unlockcCstd��dS)�Flush and close the mailbox.r"Nr#rDrrr�close�sz
Mailbox.closecCs.z|�d�WStk
r(td��YnXdS)Nrz?String input must be ASCII-only; use bytes or a Message instead)�encode�UnicodeError�
ValueErrorr%rrr�_string_to_bytes�szMailbox._string_to_bytesFc	Cs�t|tjj�rvt��}tj�||d�}|�|�|�	d�|�
�}|�dt�}|�
|�|jrr|�t�sr|�
t��n�t|tttjf��rt|tj�r�t�dtd�|��}t|t�r�|�|�}|r�|�dd�}|�dt�}|�
|�|j�r�|�t��s�|�
t�n�t|d��r�t|d��r2t�d	td�|j}d
}|��}|�d��r\|d
d�d}n|�d
��rx|d
d�d}|�s��q�|�r�|�d��r�d|dd
�}|�dt�}|�
|�|}�q6|j�r�|�r�|�t��s�|�
t�ntdt|���d
S)z%Dump message contents to target file.r�
�8Use of StringIO input is deprecated, use BytesIO instead�s
From s
>From �read�buffer�DUse of text mode files is deprecated, use a binary mode file insteadN�
����
����From s>From ��Invalid message type: %s)�
isinstancer>r&r�io�BytesIO�	generator�BytesGenerator�flatten�seekrk�replace�linesep�write�_append_newline�endswith�str�bytes�StringIO�warnings�warn�DeprecationWarning�getvaluergrXrl�readline�
startswith�	TypeError�type)	rr&�targetZmangle_from_rl�gen�dataZlastline�linerrr�
_dump_message�s`


�


�
zMailbox._dump_message)NT)N)N)N)F)$�__name__�
__module__�__qualname__�__doc__r r'r+r-r0r3r6r4r7rAr@r:rErGrKrLrMrNrOrQrSrTrVrWr[r]r_rarcrgrr�rrrrr!sB

		
	
c@s�eZdZdZdZd6dd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)7rzA qmail-style Maildir mailbox.�:NTcCs�t�||||�tj�|jd�tj�|jd�tj�|jd�d�|_tj�|j�s�|r�t�|jd�|j�	�D]}t�|d�qln
t
|j��i|_ddd�|_d|_
d|_d	S)
zInitialize a Maildir instance.�tmp�new�cur)r�r�r��r)r�r�g�������?N)rr rr�joinr�_paths�exists�mkdirrMr�_toc�_toc_mtimes�
_last_read�_skewfactor)r�dirnamerrrrrrr 
s�
zMaildir.__init__c
Cs~|��}z|�||�Wn*tk
rB|��t�|j��YnXt|�t|t	�r||�
�}|j|��}||jkr�d}nd}d}tj
�|j��|j�d}tj
�|j|||�}t|t	�r�t�|jtj
�|j�|��f�zLzt�|j|�Wn(ttfk
�rt�|j|�YnXt�|j�WnNtk
�rx}z.t�|j�|jtjk�rftd|��n�W5d}~XYnX|S)r!�r�rz$Name clash with existing message: %sN)�_create_tmpr��
BaseExceptionrcrr+�name�_sync_closerur	�
get_subdir�colon�get_infor�basename�splitr�r�utime�getatime�get_date�link�AttributeError�PermissionError�rename�OSError�errnoZEEXISTr)rr&Ztmp_file�subdir�suffix�uniq�dest�errrr'!sF


��zMaildir.addcCs t�tj�|j|�|���dS�r(N)rr+rr�r�_lookupr)rrrr+KszMaildir.removec	Cs,z|�|�Wnttfk
r&YnXdSr.)r+r/�FileNotFoundErrorr)rrrr0OszMaildir.discardcCs�|�|�}|�|�}|�|�}t|t�r.|}n|}tj�|�}|j|kr`|j|�|j�d}nd}|�	|�tj�
|j|�}	tj�
|j|||�}
t|t�r�t�|	tj�
|	�|��f�t�|	|
�dS)r1rqr�N)r�r'rur	rrr�r�r�r0r�rr�r�r�r�)rr*r&Zold_subpathZtemp_keyZtemp_subpathZdominant_subpathr�r�Ztmp_path�new_pathrrrr3Ws$






�zMaildir.__setitem__c	Cs�|�|�}ttj�|j|�d�� }|jr4|�|�}nt|�}W5QRXtj�|�\}}|�	|�|j
|kr�|�|�|j
�d�|�tj�
tj�|j|���|S)r<�rbrq)r��openrrr�rrr	r��
set_subdirr��set_info�set_date�getmtime)rr*Zsubpath�f�msgr�r�rrrr7rs


zMaildir.get_messagec
CsDttj�|j|�|��d��}|���td�W5QR�SQRXdS)�2Return a bytes representation or raise a KeyError.r�rhN)	r�rrr�rr�rkr|r}�rr*r�rrrr@�szMaildir.get_bytescCs$ttj�|j|�|��d�}t|�S)rBr�)r�rrr�rr��
_ProxyFiler�rrrr:�szMaildir.get_filec	csF|��|jD]2}z|�|�Wntk
r8YqYnX|VqdS�rCN)�_refreshr�r�r/r)rrrrE�s

zMaildir.iterkeyscCs|��||jkS�rP)r�r�r)rrrrQ�szMaildir.__contains__cCs|��t|j�S�rR)r��lenr�rDrrrrS�szMaildir.__len__cCsdS)�"Write any pending changes to disk.NrrDrrrr]�sz
Maildir.flushcCsdS)r^NrrDrrrr_�szMaildir.lockcCsdS)r`NrrDrrrra�szMaildir.unlockcCsdS�rbNrrDrrrrc�sz
Maildir.closecCs\g}t�|j�D]F}t|�dkr|ddkrtj�tj�|j|��r|�|dd��q|S)�Return a list of folder names.�r�.N)r�listdirrr�r�isdirr��append�rrU�entryrrr�list_folders�s�zMaildir.list_folderscCs ttj�|jd|�|jdd�S)z/Return a Maildir instance for the named folder.r�F�rr)rrrr�rr�r�folderrrr�
get_folder�s�zMaildir.get_foldercCs\tj�|jd|�}t||jd�}tj�|d�}tj�|�sXt�t�|tj	tj
Bd��|S)z>Create a folder and return a Maildir instance representing it.r��rZ
maildirfolder�)rrr�rrrr�rcr��O_CREAT�O_WRONLY)rr�rrUZmaildirfolder_pathrrr�
add_folder�s�zMaildir.add_foldercCstj�|jd|�}t�tj�|d��t�tj�|d��D](}t|�dksX|ddkr<td|��q<t�|�D]B}|dkrp|dkrp|dkrptj�tj�||��rptd||f��qptj|d	d
�D]F\}}}|D]}t�	tj�||��q�|D]}t�
tj�||��q�q�t�
|�dS)�-Delete the named folder, which must be empty.r�r�r�r�rzFolder contains message(s): %sr�z%Folder contains subdirectory '%s': %sF)�topdownN)rrr�rr�r�rr��walkr+�rmdir)rr�rr��root�dirs�filesrrr�
remove_folder�s&���zMaildir.remove_foldercCsXt��}t�tj�|jd��D]4}tj�|jd|�}|tj�|�dkrt�|�qdS)zDelete old files in "tmp".r�i@�N)�timerr�rr�rr�r+)r�nowr�rrrr�clean�s
z
Maildir.cleanr�cCs�t��}t��}d|kr$|�dd�}d|kr8|�dd�}dt|�t|dd�t��tj|f}tj	�
|jd|�}zt�|�WnFt
k
r�tjd7_zt|�WYStk
r�YnXYnXtd	|��d
S)z=Create a file in the tmp subdirectory and open and return it.�/z\057r�z\072z%s.M%sP%sQ%s.%sr�g��.Ar�z&Name clash prevented file creation: %sN)r��socket�gethostnamer|�intr�getpidr�_countrr�r�statr��_create_carefully�FileExistsErrorr)rr�Zhostnamer�rrrrr��s,��zMaildir._create_tmpcCs�t��|jd|jkr^d}|jD]2}tj�|j|�}||j|krJd}||j|<q"|s^dSi|_|jD]^}|j|}t�	|�D]D}tj�
||�}tj�|�r�q�|�|j
�d}tj�
||�|j|<q�qjt��|_dS)z!Update table of contents mapping.�FTNr)r�r�r�r�rrr�r�r�r�r�r�r�r�)rZrefreshr��mtimerr��pr�rrrr��s&


zMaildir._refreshcCs�z.tj�tj�|j|j|��r,|j|WSWntk
rBYnX|��z|j|WStk
rztd|�d�YnXdS)z=Use TOC to return subpath for given key, or raise a KeyError.�No message with key: %sN)rrr�r�rr�r/r�r)rrrr�#szMaildir._lookupcCsXt|d�s|��|_z|t|j�WStk
r:YdStk
rPYqYqXqdS)z0Return the next message in a one-time iteration.�
_onetime_keysN)rXrEr��next�
StopIterationr/rDrrrr�1s

zMaildir.next)NT)r�r�r�r�r�r r'r+r0r3r7r@r:rErQrSr]r_rarcr�r�r�r�r�r�r�r�r�r�rrrrrs6
*
	
$c@s�eZdZdZd$dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd%d d!�Zd"d#�ZdS)&�_singlefileMailboxzA single-file mailbox.NTc
Cs�t�||||�zt|jd�}Wnntk
r�}zP|jtjkr\|rPt|jd�}q~t|j��n"|jtjtj	fkr|t|jd�}n�W5d}~XYnX||_
d|_d|_d|_
d|_d|_d|_dS)z!Initialize a single-file mailbox.�rb+zwb+r�NrF)rr r�rr�r��ENOENTr�EACCES�EROFS�_filer��	_next_key�_pending�
_pending_sync�_locked�_file_length)rrrrr�r�rrrr As$z_singlefileMailbox.__init__cCs8|��|�|�|j|j<|jd7_d|_|jdS)r!r�T)r��_append_messager�rrr%rrrr'Xs
z_singlefileMailbox.addcCs|�|�|j|=d|_dS)r(TN)r�r�rr)rrrr+bs
z_singlefileMailbox.removecCs$|�|�|�|�|j|<d|_dS)r1TN)r�r	r�rr2rrrr3hs
z_singlefileMailbox.__setitem__ccs|��|j��EdHdSr�)r�r�rGrDrrrrEnsz_singlefileMailbox.iterkeyscCs|��||jkSr�)r�r�r)rrrrQssz_singlefileMailbox.__contains__cCs|��t|j�Sr�)r�r�r�rDrrrrSxsz_singlefileMailbox.__len__cCs|jst|j�d|_dS)r^TN)r�
_lock_filerrDrrrr_}s
z_singlefileMailbox.lockcCs|jrt|j�d|_dS�r`FN)r�_unlock_filerrDrrrra�s
z_singlefileMailbox.unlockc
Cs�|js |jrt|j�d|_dS|j�dd�|j��}||jkrTtd|j|f��t|j	�}z�i}|�
|�t|j�
��D]x}|j|\}}|j�|�|�|�|��}|j�td||j����}|s�q�|�|�q�||��f||<|�|�q||��|_Wn"|��t�|j��YnXt|�|j��t�|j	�j}	t�|j|	�zt�|j|j	�Wn2tk
�r�t�|j	�t�|j|j	�YnXt|j	d�|_||_d|_d|_|j�r�t|jdd�dS)	r�FNrr�z4Size of mailbox file changed (expected %i, found %i)�r�)�dotlock) rr�_sync_flushrr{�tellrr�_create_temporaryr�_pre_mailbox_hook�sortedr�rG�_pre_message_hookrk�minr~�_post_message_hookrcrr+r�r�r��st_mode�chmodr�r�r�rr
)
rZcur_lenZnew_fileZnew_tocr*�start�stopZ	new_startrl�moderrrr]�s`
	

�



�
z_singlefileMailbox.flushcCsdS)�,Called before writing the mailbox to file f.Nr�rr�rrrr�sz$_singlefileMailbox._pre_mailbox_hookcCsdS)�-Called before writing each message to file f.Nrrrrrr�sz$_singlefileMailbox._pre_message_hookcCsdS��,Called after writing each message to file f.Nrrrrrr�sz%_singlefileMailbox._post_message_hookcCs4z|��W5z|jr|��W5|j��XXdSr�)rrcrrar]rDrrrrc�sz_singlefileMailbox.closecCsN|jdkr|��|dk	rJz|j|WStk
rHtd|�d�YnXdS)z'Return (start, stop) or raise KeyError.Nr�)r��
_generate_tocr/r)rrrr��s
z_singlefileMailbox._lookupcCs�|j�dd�|j��}t|j�dkr8|js8|�|j�z&|�|j�|�|�}|�	|j�Wn"t
k
r�|j�|��YnX|j��|j��|_
|S)z;Append message to mailbox and return (start, stop) offsets.rr�)rr{rr�r�rrr�_install_messagerr��truncater]r)rr&ZbeforeZoffsetsrrrr	�s


z"_singlefileMailbox._append_message)NT)N)r�r�r�r�r r'r+r3rErQrSr_rar]rrrrcr�r	rrrrr�>s"

@

r�c@sBeZdZdZdZdd�Zddd�Zddd	�Zdd
d�Zdd
�Z	dS)�	_mboxMMDFzAn mbox or MMDF mailbox.TcCsp|�|�\}}|j�|�|j���td�}|j�||j���}|�|�td��}|�	|dd��
d��|S)r<�rhrsNr)r�rr{r�r|r}rkr�_message_factory�set_from�decode)rr*rr�	from_line�stringr�rrrr7sz_mboxMMDF.get_messageFcCst�|�||��j|d�S)�3Return a string representation or raise a KeyError.)�unixfromr=)rr*�from_rrrrAs

��z_mboxMMDF.get_stringcCsJ|�|�\}}|j�|�|s(|j��|j�||j���}|�td�S)r+rh)r�rr{r�rkrr|r})rr*r-rrr*rrrr@s
z_mboxMMDF.get_bytescCs<|�|�\}}|j�|�|s(|j��t|j|j��|�S)rB)r�rr{r��_PartialFiler)rr*r-rrrrrr:s

z_mboxMMDF.get_filecCsd}t|t�r|�|�}t|t�rf|�d�rf|�d�}|dkr\|d|�}||dd�}q�|}d}nJt|t�r�|���d�}d|}n(t|t	j
j�r�|��}|dk	r�|�d�}|dkr�dt
�t
�����}|j��}|j�|t�|�||j|j�|j��}||fS)	z1Format a message and blindly write to self._file.Nrrrhrqr�r%rsFrom MAILER-DAEMON )rur�rgr�r��find�_mboxMMDFMessage�get_fromrdr>r&r�get_unixfromr��asctime�gmtimerrr~r}r��
_mangle_from_)rr&r)�newlineZauthorrrrrrr"&s0







z_mboxMMDF._install_messageN)F)F)F)
r�r�r�r�r5r7rAr@r:r"rrrrr$s


	
r$c@s2eZdZdZdZdZd
dd�Zdd�Zdd	�ZdS)rzA classic mbox mailbox.TNcCst|_t�||||�dS)zInitialize an mbox mailbox.N)r
r&r$r rrrrr Lsz
mbox.__init__cCs|�t�dSr�r~r}rrrrrQszmbox._post_message_hookcCs�gg}}d}|j�d�|j��}|j��}|�d�rzt|�t|�krj|r`|�|tt��n
|�|�|�|�d}q|s�|r�|�|tt��q�|�|�q�q|tkr�d}qd}qtt	t
||���|_t|j�|_|j��|_
dS)�0Generate key-to-(start, stop) table of contents.FrrrTN)rr{rr�r�r�r�r}�dict�	enumerate�zipr�rr)r�starts�stopsZlast_was_empty�line_posr�rrrr!Us.






zmbox._generate_toc)NT)	r�r�r�r�r5rr rr!rrrrrCs
c@s2eZdZdZddd�Zdd�Zdd	�Zd
d�ZdS)
rzAn MMDF mailbox.NTcCst|_t�||||�dS)zInitialize an MMDF mailbox.N)r
r&r$r rrrrr zsz
MMDF.__init__cCs|�dt�dS)r�Nr7rrrrrszMMDF._pre_message_hookcCs|�tdt�dS)r r?Nr7rrrrr�szMMDF._post_message_hookcCs�gg}}|j�d�d}|}|j��}|j��}|�dt�r�|�|�|}|j��}|j��}|dtkr�|�|tt��q�qJ|sJ|�|�q�qJq|sq�qtt	t
||���|_t|j�|_|j�dd�|j��|_
dS)r8rr?r�N)rr{r�rr�r}r�r�r9r:r;r�rr)rr<r=�next_posr>r�rrrr!�s.






zMMDF._generate_toc)NT)r�r�r�r�r rrr!rrrrrws

c@s�eZdZdZd0dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�ZdS)1rzAn MH mailbox.NTcCstt�||||�tj�|j�sj|r`t�|jd�t�t�tj�	|jd�tj
tjBtjBd��n
t
|j��d|_dS)zInitialize an MH instance.r��
.mh_sequencesi�FN)rr rrr�rr�rcr�r�r��O_EXCLr�rrrrrrr �s�
zMH.__init__cCs�|��}t|�dkrd}nt|�d}tj�|jt|��}t|�}d}z�|j
rVt|�zfz|�
||�Wn:tk
r�|j
r�t|�t	|�d}t�|��YnXt|t�r�|�||�W5|j
r�t|�XW5|s�t	|�X|S)r!rr�FT)rGr��maxrrr�rr�r�r�rr
rr�r�r+rur�_dump_sequences)rr&rGZnew_keyr�r��closedrrrr'�s6


zMH.addc
Csxtj�|jt|��}zt|d�}Wn>tk
r`}z |jtjkrNt	d|��n�W5d}~XYnX|�
�t�|�dS)r(r�r�N)rrr�rr�r�r�r�rr/rcr+)rr*rr�r�rrrr+�sz	MH.removec
Cs�tj�|jt|��}zt|d�}Wn>tk
r`}z |jtjkrNt	d|��n�W5d}~XYnXzd|jrrt|�z@t�t�|tjtjB��|�||�t|t�r�|�||�W5|jr�t
|�XW5t
|�XdS)r1r�r�N)rrr�rr�r�r�r�rr/r�rr
rrcr��O_TRUNCr�rurrD)rr*r&rr�r�rrrr3�s$
zMH.__setitem__c
Cs�z@|jr$ttj�|jt|��d�}nttj�|jt|��d�}Wn>tk
r~}z |jtj	krlt
d|��n�W5d}~XYnX|�2|jr�t|�zt
|�}W5|jr�t|�XW5QRX|����D]\}}||kr�|�|�q�|S)r<r�r�r�N)rr�rrr�rr�r�r�rr/r
rr�
get_sequencesrO�add_sequence)rr*r�r�r�r��key_listrrrr7�s&zMH.get_messagec
Cs�z@|jr$ttj�|jt|��d�}nttj�|jt|��d�}Wn>tk
r~}z |jtj	krlt
d|��n�W5d}~XYnX|�F|jr�t|�z |�
��td�W�W5QR�S|jr�t|�XW5QRXdS)r�r�r�r�Nrh)rr�rrr�rr�r�r�rr/r
rrkr|r}�rr*r�r�rrrr@s zMH.get_bytesc
Csfzttj�|jt|��d�}Wn>tk
r\}z |jtjkrJt	d|��n�W5d}~XYnXt
|�S)rBr�r�N)r�rrr�rr�r�r�rr/r�rJrrrr:)szMH.get_filecCsttdd�t�|j�D���S)rCcss|]}|��rt|�VqdSr,)�isdigitr�)�.0r�rrr�	<genexpr>6s�zMH.iterkeys.<locals>.<genexpr>)�iterrrr�rrDrrrrE4szMH.iterkeyscCstj�tj�|jt|���Sr�)rrr�r�rr�r)rrrrQ9szMH.__contains__cCstt|����Sr�)r�rFrErDrrrrS=sz
MH.__len__cCs2|js.ttj�|jd�d�|_t|j�d|_dS)r^rAr�TN)rr�rrr�rrr
rDrrrr_As
zMH.lockcCs(|jr$t|j�t|j�|`d|_dSr)rrrr�rDrrrraHs


z	MH.unlockcCsdS)r\NrrDrrrr]PszMH.flushcCs|jr|��dSr�)rrarDrrrrcTszMH.closecCs<g}t�|j�D]&}tj�tj�|j|��r|�|�q|S)r�)rr�rrr�r�r�r�rrrr�Ys
zMH.list_folderscCsttj�|j|�|jdd�S)z+Return an MH instance for the named folder.Fr��rrrr�rrr�rrrr�as�z
MH.get_foldercCsttj�|j|�|jd�S)z:Create a folder and return an MH instance representing it.r�rOr�rrrr�fs�z
MH.add_foldercCs`tj�|j|�}t�|�}|dgkr:t�tj�|d��n|gkrDntd|j��t�|�dS)r�rAzFolder not empty: %sN)rrr�rr�r+rr�)rr�r�entriesrrrr�ks

zMH.remove_folderc

si}ttj�|jd�ddd���}t|����|D]�}z�|�d�\}}t�}|��D]H}|��rn|�	t
|��qRdd�|�d�D�\}}	|�t||	d	��qR�fd
d�t
|�D�||<t||�dkr�||=Wq0tk
r�td
|����Yq0Xq0W5QRX|S)z=Return a name-to-key-list dictionary to define each sequence.rA�r�ASCII��encodingr�css|]}t|�VqdSr,)r�)rL�xrrrrM�sz#MH.get_sequences.<locals>.<genexpr>�-r�csg|]}|�kr|�qSrr)rLr*�Zall_keysrr�
<listcomp>�s�z$MH.get_sequences.<locals>.<listcomp>rz"Invalid sequence specification: %s)r�rrr�r�setrGr�rKr'r�r[�rangerr�rfr�rstrip)
rZresultsr�r�r��contentsrG�specrrrrWrrGws(
�zMH.get_sequencescCsttj�|jd�ddd�}z�t�t�|jtjtj	B��|�
�D]�\}}t|�dkrVq@|�|d�d}d}t
t|��D]R}|d	|kr�|s�d
}|�d�n*|r�d}|�d||f�n|�d
|�|}qx|r�|�t|�d�q@|�d�q@W5t|�XdS)z:Set sequences using the given name-to-key-list dictionary.rAzr+rRrSrr�NFr�TrVz%s %sz %s�
)r�rrr�rr�rcr�r�rFrOr�r~rrYr�)r�	sequencesr�r�rG�prevZ
completingr*rrr�
set_sequences�s.zMH.set_sequencesc	
Cs>|��}d}g}|��D]�}|d|kr�|�||df�z4t�tj�|jt|��tj�|jt|d���WnHt	t
fk
r�t�tj�|jt|��tj�|jt|d���YnXt�tj�|jt|���|d7}q|d|_
t|�dkr�dS|��D]0\}}|D]"\}}||k�r
|||�|�<�q
q�|�|�dS)z?Re-name messages to eliminate numbering gaps. Invalidates keys.rr�N)rGrEr�rr�rr�rr�r�r�r��unlinkrr�rO�indexra)	rr_r`Zchangesr*r�rI�oldr�rrr�pack�s0��



zMH.packcCst|��}|��}|��D]0\}}||kr4|�|�q||kr||�|�=q|D]}||krN|g||<qN|�|�dS)z;Inspect a new MHMessage and update sequences appropriately.N)rGrOr�rcra)rr&r*Zpending_sequencesZ
all_sequencesr�rI�sequencerrrrD�szMH._dump_sequences)NT)r�r�r�r�r r'r+r3r7r@r:rErQrSr_rar]rcr�r�r�r�rGrarerDrrrrr�s.
"c@s�eZdZdZedddddddh�Zd%dd�Zd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd �Zd!d"�Zd#d$�Zd	S)&rzAn Rmail-style Babyl mailbox.�unseen�deletedZfiled�answered�	forwardedZedited�resentNTcCst�||||�i|_dS)zInitialize a Babyl mailbox.N)r�r �_labelsrrrrr �szBabyl.__init__cCs(t�||�}t|t�r$|��|j|<|S)r!)r�r'rur�
get_labelsrl)rr&r*rrrr'�s
z	Babyl.addcCs"t�||�||jkr|j|=dSr�)r�r+rlr)rrrr+�s
zBabyl.removecCs*t�|||�t|t�r&|��|j|<dS)r1N)r�r3rurrmrlr2rrrr3�s
zBabyl.__setitem__c
Cs�|�|�\}}|j�|�|j��t��}|j��}|dtks\|sHq\|�|�td��q,t��}|j��}|tks�|s|q�|�|�td��qd||j�	�}|j�
|�}|�td�}t|��|�}	|	�
|���||jkr�|	�|j|�|	S)r<�*** EOOH ***rh)r�rr{r�rvrwr}r~r|rrkrr��set_visiblerl�
set_labels)
rr*rr�original_headersr�Zvisible_headers�nZbodyr�rrrr7�s*



zBabyl.get_messagec	Cs�|�|�\}}|j�|�|j��t��}|j��}|dtks\|sHq\|�|�td��q,|j��}|tksv|s\qvq\|�	�}||j�
�}|j�|�}|�td�}||S)r+rnrh)r�rr{r�rvrwr}r~r|r�rrk)	rr*rrrqr�Zheadersrrr�rrrr@s 


zBabyl.get_bytescCst�|�|��dt��S)rBrh)rvrwr@r|r}r)rrrr:%szBabyl.get_filecCs<|��t�}|j��D]}|�|�q|�|j�t|�S)z4Return a list of user-defined labels in the mailbox.)r�rYrlrMr[�difference_update�_special_labelsrF)r�labelsZ
label_listrrrrm)szBabyl.get_labelscCs:gg}}|j�d�d}g}|}|j��}|j��}|dtkr�t|�t|�krd|�|tt��|�|�dd�|j��dd��d�D�}|�|�q|dks�|dtkr�t|�t|�kr�|�|tt��q|s|�|tt��q�qtt	t
||���|_tt	|��|_t|j�|_
|j�dd	�|j��|_dS)
r8rscSsg|]}|��r|���qSr)�strip�rL�labelrrrrX@s�z'Babyl._generate_toc.<locals>.<listcomp>r�N�,�r�)rr{r�rr}r�r�r�r9r:r;r�rlrr)rr<r=r@Zlabel_listsr>r�rurrrr!2s4



�zBabyl._generate_toccCsVdt}|dt7}|��}dd�|D�}|dd�|�t7}|d7}|�|�dS)	rsBABYL OPTIONS:s
Version: 5css|]}|��VqdSr,)rdrwrrrrMUsz*Babyl._pre_mailbox_hook.<locals>.<genexpr>sLabels:ryrzN)r}rmr�r~)rr�ZbabylrurrrrPszBabyl._pre_mailbox_hookcCs|�dt�dS)r�Nr7rrrrrZszBabyl._pre_message_hookcCs|�td�dS)r rzNr7rrrrr^szBabyl._post_message_hookcCsx|j��}t|t�r�g}g}|��D]$}||jkr>|�|�q$|�|�q$|j�d�|D]}|j�d|���qZ|j�d�|D]}|j�d|��d�q�|j�t	�n|j�dt	�t|t
jj��rt
��}t
j�|dd�}|�|�|�d�|��}|j�|�d	t	��|d	k�s,|s��q,q�|j�d
t	�t|t��r�t
��}	t
j�|	dd�}
|
�|���|	��}|j�|�d	t	��|d	k�s�|�sn�q�qnn>|�d�|��}|j�|�d	t	��|d	k�s�|�s��q�q�|�d�}|�s��qf|j�|�d	t	���q�nTt|ttt
jf��rt|t
j��rJt�dtd
�|��}t|t��r`|�|�}|�d�d}|ddk�r�|j�|d|��d	t	��|j�d
t	�|j�|d|��d	t	��|j�||d��d	t	��n(|j�d
t	t	�|j�|�d	t	���nXt |d��rVt |d��r:t�dtd
�|j!}|��}
d}|��}|�"d��rl|dd�d	}n|�"d��r�|dd�d	}|j�|�d	t	��|d	k�s�|�sF|�r�d}|j�d
t	�|�|
�n�qڐqF|��}|�s�qf|�"d��r
|dd�t	}n:|�"d��r(|dd�t	}n|�"d	��rD|dd�t	}|j�|��q�nt#dt$|���|j��}||fS)z0Write message contents and return (start, stop).�1s, s,,� rys1,,Frrhrnr
rirjs

r�rqNr�rlrmTrnrorprt)%rrrurrmrtr�r~rdr}r>r&rrvrwrxryrzr{r�r|�get_visiblerkr�r�r�r�r�r�r�rgr/rXrlr�r�r�)rr&rZspecial_labelsrurxZorig_bufferZorig_generatorr�Z
vis_bufferZ
vis_generatorrlZ
body_startZoriginal_posZ
first_passrrrrr"bs�







�
�
zBabyl._install_message)NT)r�r�r�r��	frozensetrtr r'r+r3r7r@r:rmr!rrrr"rrrrr�s&
�
	
c@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
rz0Message with mailbox-format-specific properties.NcCs�t|tjj�r4|�t�|��t|t�r�|�|�n�t|t�rP|�t�	|��n~t|t
�rl|�t�|��nbt|tj
�r�|�t�|��nDt|d�r�|�t�|��n(|dkr�tjj�|�ntdt|���dS)zInitialize a Message instance.rkNrt)rur>r&r�_become_message�copyZdeepcopy�_explain_tor�r?r�Zmessage_from_stringrv�
TextIOWrapperZmessage_from_filerXZmessage_from_binary_filer r�r�r%rrrr �s



zMessage.__init__cCs4t|dg�}|jD]}||kr|j||j|<qdS)z0Assume the non-format-specific state of message.�_type_specific_attributesN)�getattr�__dict__)rr&Z
type_specificr�rrrr��s
zMessage._become_messagecCst|t�rdStd��dS)z:Copy format-specific state to message insofar as possible.Nz Cannot convert to specified type)rurr�r%rrrr��s
zMessage._explain_to)N)r�r�r�r�r r�r�rrrrr�s
c@s|eZdZdZdddgZddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)r	z)Message with Maildir-specific properties.�_subdir�_info�_dateNcCs&d|_d|_t��|_t�||�dS)z%Initialize a MaildirMessage instance.r�r�N)r�r�r�r�rr r%rrrr �s
zMaildirMessage.__init__cCs|jS)zReturn 'new' or 'cur'.)r�rDrrrr��szMaildirMessage.get_subdircCs(|dks|dkr||_ntd|��dS)zSet subdir to 'new' or 'cur'.r�r�z!subdir must be 'new' or 'cur': %sN)r�rf)rr�rrrr�szMaildirMessage.set_subdircCs"|j�d�r|jdd�SdSdS)�*Return as a string the flags that are set.�2,r�Nr�)r�r�rDrrr�	get_flags
szMaildirMessage.get_flagscCsdd�t|��|_dS)�)Set the given flags and unset all others.r�r�N)r�rr�)r�flagsrrr�	set_flagsszMaildirMessage.set_flagscCs$|�d�t|���t|�B��dS�z.Set the given flag(s) without changing others.r�N�r�r�rYr��r�flagrrr�add_flagszMaildirMessage.add_flagcCs,|��r(|�d�t|���t|���dS)�7Unset the given string flag(s) without changing others.r�N)r�r�r�rYr�rrr�remove_flagszMaildirMessage.remove_flagcCs|jS)z<Return delivery date of message, in seconds since the epoch.)r�rDrrrr�szMaildirMessage.get_datecCs6zt|�|_Wn"tk
r0td|�d�YnXdS)z9Set delivery date of message, in seconds since the epoch.zcan't convert to float: %sN)�floatr�rfr�)r�daterrrr�"szMaildirMessage.set_datecCs|jS)z%Get the message's "info" as a string.)r�rDrrrr�)szMaildirMessage.get_infocCs&t|t�r||_ntdt|���dS)z Set the message's "info" string.zinfo must be a string: %sN)rur�r�r�r�)r�inforrrr�-s
zMaildirMessage.set_infocCs�t|t�r8|�|���|�|���|�|����nht|t�r�t	|���}d|kr`|�
d�|��dkrv|�
d�d|kr�|�
d�d|kr�|�
d�d|kr�|�
d�|�d	t�
|����n�t|t��rt	|���}d|kr�|�d
�d|k�r|�d�d|k�r�|�d�n�t|t��r�t	|���}d|k�rD|�d
�d|k�rX|�d
�d|k�rl|�d�d|k�r�|�d�nt|t��r�ntdt|���dS)z;Copy Maildir-specific state to message insofar as possible.�S�Rr��O�T�D�F�A�
MAILER-DAEMONrg�replied�flaggedrhri�Prj�$Cannot convert to specified type: %sN)rur	r�r�r�r�r�r�r0rYr�r'r�r4rrHr�	add_labelrr�r�)rr&r�rrrr�4sP

















�zMaildirMessage._explain_to)N)r�r�r�r�r�r r�r�r�r�r�r�r�r�r�r�r�rrrrr	�s

c@sZeZdZdZdgZddd�Zdd�Zddd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)r0z/Message with mbox- or MMDF-specific properties.�_fromNcCsV|�dd�t|tjj�rF|��}|dk	rF|�d�rF|�|dd��t�||�dS)z'Initialize an mboxMMDFMessage instance.r�TNzFrom rs)r'rur>r&rr2r�r )rr&r,rrrr esz_mboxMMDFMessage.__init__cCs|jS)z Return contents of "From " line.)r�rDrrrr1nsz_mboxMMDFMessage.get_fromcCs4|dk	r*|dkrt��}|dt�|�7}||_dS)z>Set "From " line, formatting and appending time_ if specified.NT� )r�r4r3r�)rr-Ztime_rrrr'rs
z_mboxMMDFMessage.set_fromcCs|�dd�|�dd�S)r��Statusr��X-Status)r6rDrrrr�zsz_mboxMMDFMessage.get_flagscCs�t|�}d\}}dD]}||kr||7}|�|�qdD]}||kr8||7}|�|�q8|d�t|��7}z|�d|�Wn tk
r�|�d|�YnXz|�d|�Wn tk
r�|�d|�YnXdS)r�)r�r�)r�r�)r�r�r�r�r�r�N)rYr+r�r�replace_headerr/Z
add_header)rr�Zstatus_flagsZ
xstatus_flagsr�rrrr�~s&z_mboxMMDFMessage.set_flagscCs$|�d�t|���t|�B��dSr�r�r�rrrr��sz_mboxMMDFMessage.add_flagcCs4d|ksd|kr0|�d�t|���t|���dS)r�r�r�r�Nr�r�rrrr��sz_mboxMMDFMessage.remove_flagc	Cs�t|t�r�t|���}d|kr(|�d�d|kr:|�d�d|krL|�d�d|kr^|�d�d|krp|�d�|d	=|d
=d�|����dd
��}z|�	t
�t�
|d���Wnttfk
r�YnX�n
t|t�r�|�|���|�|���n�t|t��rZt|���}d|k�r$|�d�d|k�r8|�d�d|k�rL|�d�|d	=|d
=n�t|t��r�t|���}d|k�r�|�d�d|k�r�|�d�d|k�r�|�d�|d	=|d
=nt|t��r�ntdt|���d
S)zACopy mbox- or MMDF-specific state to message insofar as possible.r�r�r�r�r�r�r�r�Zstatuszx-statusr����Nz%a %b %d %H:%M:%S %Yrgr�r�rhrir�)rur	rYr�r�r�r�r1r�r��calendarZtimegmr��strptimerf�
OverflowErrorr0r�r'rrHrr�rr�r�)rr&r�Z
maybe_daterrrr��sb





�













�z_mboxMMDFMessage._explain_to)N)N)
r�r�r�r�r�r r1r'r�r�r�r�r�rrrrr0`s
	
r0c@seZdZdZdS)r
z&Message with mbox-specific properties.N�r�r�r�r�rrrrr
�sc@sHeZdZdZdgZddd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)rz$Message with MH-specific properties.�
_sequencesNcCsg|_t�||�dS)z!Initialize an MHMessage instance.N)r�rr r%rrrr �szMHMessage.__init__cCs|jdd�S)z4Return a list of sequences that include the message.N)r�rDrrrrG�szMHMessage.get_sequencescCst|�|_dS)z3Set the list of sequences that include the message.N)rFr�)rr_rrrra�szMHMessage.set_sequencescCs6t|t�r"||jkr2|j�|�ntdt|���dS)z8Add sequence to list of sequences including the message.zsequence type must be str: %sN)rur�r�r�r�r��rrfrrrrH�s

zMHMessage.add_sequencecCs*z|j�|�Wntk
r$YnXdS)zARemove sequence from the list of sequences including the message.N)r�r+rfr�rrr�remove_sequence�szMHMessage.remove_sequencecCsFt|t�rdt|���}d|kr*|�d�n|�d�|�d�d|krP|�d�d|krb|�d�n�t|t�r�t|���}d|kr�|�d�n
|�d	�d|kr�|�d�d|kr�|�d
�n�t|t�r�|��D]}|�|�q�n`t|t	��r$t|���}d|k�r|�
d�d|k�rB|�
d�nt|t��r2ntdt
|���d
S)z6Copy MH-specific state to message insofar as possible.rgr�r�r�r�r�r��ROr�r�rir�N)rur	rYrGr�r�r0rrHrr�rr�r�)rr&r_rfrrrr��sB










�zMHMessage._explain_to)N)r�r�r�r�r�r rGrarHr�r�rrrrr�s
c@sbeZdZdZddgZddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)rz'Message with Babyl-specific properties.rl�_visibleNcCsg|_t�|_t�||�dS)z#Initialize a BabylMessage instance.N)rlrr�r r%rrrr "szBabylMessage.__init__cCs|jdd�S)z'Return a list of labels on the message.N)rlrDrrrrm(szBabylMessage.get_labelscCst|�|_dS)z&Set the list of labels on the message.N)rFrl)rrurrrrp,szBabylMessage.set_labelscCs6t|t�r"||jkr2|j�|�ntdt|���dS)z+Add label to list of labels on the message.zlabel must be a string: %sN)rur�rlr�r�r��rrxrrrr�0s

zBabylMessage.add_labelcCs*z|j�|�Wntk
r$YnXdS)z4Remove label from the list of labels on the message.N)rlr+rfr�rrr�remove_label8szBabylMessage.remove_labelcCs
t|j�S)z3Return a Message representation of visible headers.�rr�rDrrrr~?szBabylMessage.get_visiblecCst|�|_dS)z2Set the Message representation of visible headers.Nr�)rZvisiblerrrroCszBabylMessage.set_visiblecCsb|j��D](}||kr*|j�|||�q
|j|=q
dD]$}||kr8||jkr8|||j|<q8dS)z9Update and/or sensibly generate a set of visible headers.)ZDateZFromzReply-ToZToZCCZSubjectN)r�rGr�)r�headerrrr�update_visibleGs
zBabylMessage.update_visiblecCsrt|t�r~t|���}d|kr*|�d�n|�d�|�d�d|ksNd|krX|�d�d|krj|�d�d	|kr||�d
�n�t|t�r�t|���}d|kr�|�d�n
|�d�d	|kr�|�d
�d|kr�|�d�n�t|t��rt|���}d|k�r|�d�d|k�rn|�d�nTt|t	��rP|�
|���|��D]}|�|��q<nt|t
��r^ntdt|���dS)z9Copy Babyl-specific state to message insofar as possible.rgr�r�rjrkr�rir�rhr�r�r�r�r�r�r�N)rur	rYrmr�r�r0rrHrror~r�rr�r�)rr&rurxrrrr�RsH










�zBabylMessage._explain_to)N)r�r�r�r�r�r rmrpr�r�r~ror�r�rrrrrs
c@seZdZdZdS)r
z&Message with MMDF-specific properties.Nr�rrrrr
|sc@s�eZdZdZd&dd�Zd'dd�Zd(dd�Zd)d	d
�Zd*dd�Zd
d�Z	dd�Z
d+dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zed$d%��ZdS),r�zA read-only wrapper of a file.NcCs$||_|dkr|��|_n||_dS)zInitialize a _ProxyFile.N)rr�_pos)rr��posrrrr �sz_ProxyFile.__init__cCs|�||jj�S�zRead bytes.)�_readrrk�r�sizerrrrk�sz_ProxyFile.readcCs|�||jj�Sr�)r�r�read1r�rrrr��sz_ProxyFile.read1cCs|�||jj�S)zRead a line.)r�rr�r�rrrr��sz_ProxyFile.readlinecCs<g}|D].}|�|�|dk	r|t|�8}|dkrq8q|S)zRead multiple lines.Nr)r�r�)r�sizehintrUr�rrr�	readlines�s
z_ProxyFile.readlinesccs|��}|sdS|VqdS)zIterate over lines.N)r�)rr�rrrrL�sz_ProxyFile.__iter__cCs|jS)zReturn the position.)r�rDrrrr�sz_ProxyFile.tellrcCs4|dkr|j�|j�|j�||�|j��|_dS)zChange position.r�N�rr{r�r�r�offset�whencerrrr{�sz_ProxyFile.seekcCs0t|d�r,zt|jd�r"|j��W5|`XdS)zClose the file.rrcN)rXrrcrDrrrrc�s

z_ProxyFile.closecCs2|dkrd}|j�|j�||�}|j��|_|S)z"Read size bytes using read_method.Nrqr�)rr��read_methodrUrrrr��sz_ProxyFile._readcCs|S)z$Context management protocol support.rrDrrr�	__enter__�sz_ProxyFile.__enter__cGs|��dSr,)rc)r�excrrr�__exit__�sz_ProxyFile.__exit__cCs
|j��Sr,)r�readablerDrrrr��sz_ProxyFile.readablecCs
|j��Sr,)r�writablerDrrrr��sz_ProxyFile.writablecCs
|j��Sr,)r�seekablerDrrrr��sz_ProxyFile.seekablecCs
|j��Sr,)rr]rDrrrr]�sz_ProxyFile.flushcCs&t|d�sdSt|jd�sdS|jjS)NrTrEF)rXrrErDrrrrE�s

z_ProxyFile.closed)N)N)N)N)N)r)r�r�r�r�r rkr�r�r�rLrr{rcr�r�r�r�r�r�r]�propertyrErrrrr��s&





		r�c@s<eZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
�ZdS)r.z&A read-only wrapper of part of a file.NcCst�|||�||_||_dS)zInitialize a _PartialFile.N)r�r �_start�_stop)rr�rrrrrr �sz_PartialFile.__init__cCst�|�|jS)z*Return the position with respect to start.)r�rr�rDrrrr�sz_PartialFile.tellrcCs<|dkr|j|_d}n|dkr*|j|_d}t�|||�dS)z8Change position, possibly with respect to start or stop.rr�r�N)r�r�r�r�r{r�rrrr{�sz_PartialFile.seekcCsB|j|j}|dkrdS|dks0|dks0||kr4|}t�|||�S)z;Read size bytes using read_method, honoring start and stop.rr%N)r�r�r�r�)rr�r�Z	remainingrrrr��sz_PartialFile._readcCst|d�r|`dS)Nr)rXrrDrrrrcs
z_PartialFile.close)NN)r)	r�r�r�r�r rr{r�rcrrrrr.�s


	r.Tc
Cs�d}�zbtrpzt�|tjtjB�WnJtk
rn}z,|jtjtjtjfkr\t	d|j
��n�W5d}~XYnX|�rfzt|j
d�}|��WnBtk
r�}z$|jtjtjfkr�WY�WdS�W5d}~XYnXz`zt
�|j
|j
d�d}Wn2ttfk
�r$t
�|j
|j
d�d}YnXt
�|j
�Wn0tk
�rdt
�|j
�t	d|j
��YnXWn8t�r�t�|tj�|�r�t
�|j
d��YnXdS)z(Lock file f using lockf and dot locking.Fzlockf: lock unavailable: %sN�.lockTzdot lock unavailable: %s)�fcntl�lockfZLOCK_EXZLOCK_NBr�r�ZEAGAINrrrr�rrcrr�r�r�r�rbr�r+�LOCK_UN)r�rZdotlock_doner�Zpre_lockrrrr

sL�
�r
cCs8trt�|tj�tj�|jd�r4t�|jd�dS)z*Unlock file f using lockf and dot locking.r�N)r�r�r�rrr�r�r+�r�rrrr4src	Cs<t�|tjtjBtjBd�}zt|d�W�St�|�XdS)zCCreate a file if it doesn't exist and open for reading and writing.r�r�N)rr�r�rB�O_RDWRrc)r�fdrrrr�;sr�cCs$td|tt���t��t��f�S)zBCreate a temp file based on path and open for reading and writing.z%s.%s.%s.%s)r�r�r�r�r�rr�)rrrrrCs�rcCs$|��ttd�r t�|���dS)z0Ensure changes to file f are physically on disk.�fsyncN)r]rXrr��filenor�rrrrIs
rcCst|�|��dS)z:Close file f, ensuring all changes are physically on disk.N)rrcr�rrrr�Osr�c@seZdZdZdS)rz"Raised for module-specific errors.Nr�rrrrrUsc@seZdZdZdS)rz:The specified mailbox does not exist and won't be created.Nr�rrrrrXsc@seZdZdZdS)rz>The specified mailbox is not empty and deletion was requested.Nr�rrrrr[sc@seZdZdZdS)rz)Another process caused an action to fail.Nr�rrrrr^sc@seZdZdZdS)rz)A file appears to have an invalid format.Nr�rrrrras)T)0r�rr�r�r�r�r�r�r>Z
email.messageZemail.generatorrvr8r��ImportError�__all__r}rdrrr�r$rrrrr&rr	r0r
rrr
r�r.r
rr�rrr��	Exceptionrrrrrrrrr�<module>s�
�h8DB4-3z%mqH_c'
*enum.cpython-38.opt-1.pyc000064400000062554150335716500011120 0ustar00U

e5d���@s�ddlZddlmZmZddddddd	gZd
d�Zdd
�Zdd�Zdd�Ze	�Z
Gdd�d�ZGdd�de�Z
dZGdd�de�ZGdd�ded�ZGdd�dee�Zdd�ZGdd�de�ZGdd�dee�Zdd�Zdd	�Zd d!�Zd"d#�ZdS)$�N)�MappingProxyType�DynamicClassAttribute�EnumMeta�Enum�IntEnum�Flag�IntFlag�auto�uniquecCst|d�pt|d�pt|d�S)z?
    Returns True if obj is a descriptor, False otherwise.
    �__get__�__set__�
__delete__)�hasattr)�obj�r�/usr/lib64/python3.8/enum.py�_is_descriptors

��rcCsLt|�dkoJ|dd�|dd�ko.dknoJ|ddkoJ|ddkS)z=
    Returns True if a __dunder__ name, False otherwise.
    �N�����__�_�����len��namerrr�
_is_dunders&�
�
�rcCsLt|�dkoJ|d|dko&dknoJ|dd�dkoJ|dd�dkS)z;
    Returns True if a _sunder_ name, False otherwise.
    rr���r�rrrrrr�
_is_sunder!s���r cCsdd�}||_d|_dS)z,
    Make the given class un-picklable.
    cSstd|��dS)Nz%r cannot be pickled)�	TypeError��self�protorrr�_break_on_call_reduce0sz6_make_class_unpicklable.<locals>._break_on_call_reducez	<unknown>N)�
__reduce_ex__�
__module__)�clsr%rrr�_make_class_unpicklable,sr)c@seZdZdZeZdS)r	zP
    Instances are replaced with an appropriate value in Enum class suites.
    N)�__name__r'�__qualname__�__doc__�
_auto_null�valuerrrrr	6scs,eZdZdZ�fdd�Z�fdd�Z�ZS)�	_EnumDictz�
    Track enum member order and ensure member names are not reused.

    EnumMeta will use the names found in self._member_names as the
    enumeration member names.
    cs&t���g|_g|_g|_d|_dS)NF)�super�__init__�
_member_names�_last_values�_ignore�_auto_called�r#��	__class__rrr1Ds

z_EnumDict.__init__csdt|�r�|dkrtd��|dkr<|jr.td��t|d|�nV|dkr�t|t�r`|�dd���}nt	|�}||_
t|�t|j�@}|r�td	|f��n�t
|�r�|d
kr�d}n�||jkr�td|��n�||j
kr�n�t|��sR||kr�td
|||f��t|t��r:|jtk�r4|�|dt|j�|jdd��|_d|_|j}|j�|�|j�|�t��||�dS)z�
        Changes anything not dundered or not a descriptor.

        If an enum member name is used twice, an error is raised; duplicate
        values are not checked for.

        Single underscore (sunder) names are reserved.
        )�_order_�_create_pseudo_member_�_generate_next_value_�	_missing_�_ignore_z(_names_ are reserved for future Enum user;z4_generate_next_value_ must be defined before members�_generate_next_valuer=�,� z-_ignore_ cannot specify already set names: %r�	__order__r9zAttempted to reuse key: %rz%r already defined as: %rrNT)r �
ValueErrorr5r!�setattr�
isinstance�str�replace�split�listr4�setr2rrr	r.r-r>rr3�appendr0�__setitem__)r#�keyr.�alreadyr7rrrKKsT	
��


�z_EnumDict.__setitem__)r*r'r+r,r1rK�
__classcell__rrr7rr/=sr/cs�eZdZdZedd��Z�fdd�Zdd�Zd/dddd	d
�dd�Zd
d�Z	�fdd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zedd��Zdd�Zdd �Z�fd!d"�Zdddd	d
�d#d$�Zd0d%d&�Zd'd(�Zed)d*��Zed+d,��Zed-d.��Z�ZS)1rz
    Metaclass for Enum
    cCs>|�||�t�}|�||�\}}|dk	r:t|dd�|d<|S)Nr;)�_check_for_existing_membersr/�_get_mixins_�getattr)�metaclsr(�bases�	enum_dict�member_type�
first_enumrrr�__prepare__�s�zEnumMeta.__prepare__c	s��dg��d��d}|D]}��|d�q|�||�\�}|���|�\}}}	�fdd��jD�}
�jD]
}�|=qn��dd�}t|
�ddh@}
|
r�td�d�	|
����d	�kr�d
�d	<t
��|||��}g|_i|_
�|_dd�|��D�}i|_d
�k�r2�tk	�r2d}t�fdd�|D���s2t|��jD�]*}|
|}t|t��sZ|f}n|}�tk�rn|f}|	�s�||�}t|d��s�||_n6||f|��}t|d��sƈtk�r�||_n
�|�|_|j}||_||_|j|�|j
��D]"\}}|j|jk�r�|}�q�q�|j�|�||k�r2t|||�||j
|<z||j|<Wntk
�r`YnX�q8dD]V}|�k�r|�qjt||�}t�|d�}t||d�}|dk	�rj||k�rjt|||��qjtdk	�r�|�r�||_ tj|_|dk	�rt|t!��r|�"dd��#�}||jk�rtd��|S)Nr=csi|]}|�|�qSrr)�.0�k)�	classdictrr�
<dictcomp>�sz$EnumMeta.__new__.<locals>.<dictcomp>r9�mro�zInvalid enum member name: {0}r?r,zAn enumeration.cSs.h|]&}|j��D]\}}t|t�r|�qqSr)�__dict__�itemsrDr)rX�crY�vrrr�	<setcomp>�s

�z#EnumMeta.__new__.<locals>.<setcomp>r&)�__getnewargs_ex__�__getnewargs__r&�
__reduce__c3s|]}|�jkVqdS�N)r^�rX�m)rUrr�	<genexpr>�sz#EnumMeta.__new__.<locals>.<genexpr>�_value_)�__repr__�__str__�
__format__r&r@z#member order does not match _order_)$�
setdefaultrJ�poprP�
_find_new_r2rIrB�format�joinr0�__new__�_member_names_�_member_map_�
_member_type_r\�_value2member_map_�object�anyr)rD�tuplerrj�_name_�__objclass__r1r_rCr!rQr�__new_member__rErFrG)rRr(rSrZ�ignorerLrVrs�save_new�use_args�enum_membersrr9�
invalid_names�
enum_class�dynamic_attributes�methods�member_namer.�args�enum_member�canonical_member�class_method�
obj_method�enum_methodr7)rZrUrrs�s��

��













zEnumMeta.__new__cCsdS)z6
        classes/types should always be True.
        Trr6rrr�__bool__3szEnumMeta.__bool__Nr��module�qualname�type�startcCs*|dkr|�||�S|j||||||d�S)a!
        Either returns an existing member, or creates a new enum class.

        This method is used both when an enum class is given a value to match
        to an enumeration member (i.e. Color(3)) and for the functional API
        (i.e. Color = Enum('Color', names='RED GREEN BLUE')).

        When used for the functional API:

        `value` will be the name of the new class.

        `names` should be either a string of white-space/comma delimited names
        (values will start at `start`), or an iterator/mapping of name, value pairs.

        `module` should be set to the module this class is being created in;
        if it is not set, an attempt to find that module will be made, but if
        it fails the class will not be picklable.

        `qualname` should be set to the actual location this class can be found
        at in its module; by default it is set to the global scope.  If this is
        not correct, unpickling will fail in some circumstances.

        `type`, if set, will be mixed in as the first base class.
        Nr�)rs�_create_)r(r.�namesr�r�r�r�rrr�__call__9s�zEnumMeta.__call__cCs:t|t�s$tdt|�j|jjf��t||�o8|j|jkS)N�3unsupported operand type(s) for 'in': '%s' and '%s')rDrr!r�r+r8r{ru)r(�memberrrr�__contains__^s
��zEnumMeta.__contains__cs(||jkrtd|j��t��|�dS)Nz%s: cannot delete Enum member.)ru�AttributeErrorr*r0�__delattr__)r(�attrr7rrr�es
zEnumMeta.__delattr__cCsddddg|jS)Nr8r,�__members__r'�rtr6rrr�__dir__ls
��zEnumMeta.__dir__cCs@t|�rt|��z|j|WStk
r:t|�d�YnXdS)a=
        Return the enum member matching `name`

        We use __getattr__ instead of descriptors or inserting into the enum
        class' __dict__ in order to support `name` and `value` being both
        properties for enum members (which live in the class' __dict__) and
        enum members themselves.
        N)rr�ru�KeyError�r(rrrr�__getattr__rs	zEnumMeta.__getattr__cCs
|j|Srf�rur�rrr�__getitem__�szEnumMeta.__getitem__cs�fdd��jD�S)z6
        Returns members in definition order.
        c3s|]}�j|VqdSrfr��rXr�r(rrri�sz$EnumMeta.__iter__.<locals>.<genexpr>r�r�rr�r�__iter__�szEnumMeta.__iter__cCs
t|j�Srf)rrtr�rrr�__len__�szEnumMeta.__len__cCs
t|j�S)z�
        Returns a mapping of member name->value.

        This mapping lists all enum members, including aliases. Note that this
        is a read-only view of the internal mapping.
        )rrur�rrrr��szEnumMeta.__members__cCs
d|jS)Nz	<enum %r>)r*r�rrrrk�szEnumMeta.__repr__cs�fdd�t�j�D�S)z>
        Returns members in reverse definition order.
        c3s|]}�j|VqdSrfr�r�r�rrri�sz(EnumMeta.__reversed__.<locals>.<genexpr>)�reversedrtr�rr�r�__reversed__�szEnumMeta.__reversed__cs0|j�di�}||krtd��t��||�dS)a
        Block attempts to reassign Enum members.

        A simple assignment to the class namespace only changes one of the
        several possible ways to get an Enum member from the Enum class,
        resulting in an inconsistent Enumeration.
        ruzCannot reassign members.N)r^�getr�r0�__setattr__)r(rr.�
member_mapr7rrr��szEnumMeta.__setattr__c
Cs~|j}|dkr|fn||f}|�||�\}	}
|�||�}t|t�rR|�dd���}t|ttf�r�|r�t|dt�r�|g}}g}
t	|�D]8\}}|
�
||||
dd��}|
�|�|�||f�q�|D].}t|t�r�|||}}n|\}}|||<q�|�||||�}|dk�rPzt
�d�jd}Wn*tttfk
�rN}zW5d}~XYnX|dk�rdt|�n||_|dk	�rz||_|S)a�
        Convenience method to create a new Enum class.

        `names` can be:

        * A string containing member names, separated either with spaces or
          commas.  Values are incremented by 1 from `start`.
        * An iterable of member names.  Values are incremented by 1 from `start`.
        * An iterable of (member name, value) pairs.
        * A mapping of member name -> value pairs.
        Nr?r@rrr*)r8rPrWrDrErFrGrzrH�	enumerater;rJrs�sys�	_getframe�	f_globalsr�rBr�r)r'r+)r(�
class_namer�r�r�r�r�rRrSrrVrZ�original_names�last_values�countrr.�itemr��member_valuer��excrrrr��s<
 







zEnumMeta._create_cs�ttj|�}|rt|�}n|}�fdd�|��D�}z|jdd�d�Wn$tk
rn|jdd�d�YnX||||d�}t|_|�|j	�|||<|S)z[
        Create a new Enum subclass that replaces a collection of global constants
        cs g|]\}}�|�r||f�qSrr)rXrr.��filterrr�
<listcomp>�s�z&EnumMeta._convert_.<locals>.<listcomp>cSs|d|dfS)Nrrr��trrr�<lambda>��z$EnumMeta._convert_.<locals>.<lambda>)rLcSs|dS�Nrrr�rrrr��r�)r�)
�varsr��modulesr_�sortr!�_reduce_ex_by_namer&�updater�)r(rr�r��source�module_globals�membersrr�r�	_convert_�s 	

�zEnumMeta._convert_cOs$ddl}|jdtdd�|j||�S)NrzI_convert is deprecated and will be removed in 3.9, use _convert_ instead.r)�
stacklevel)�warnings�warn�DeprecationWarningr�)r(r��kwargsr�rrr�_converts�zEnumMeta._convertcCs<|D]2}|jD]&}t|t�r|jrtd||jf��qqdS)Nz %s: cannot extend enumeration %r)�__mro__�
issubclassrrtr!r*)r�rS�chain�baserrrrO
s
��z$EnumMeta._check_for_existing_memberscsT|sttfS�fdd�}|d}t|t�s2td��||�p<t}|jrLtd��||fS)z�
        Returns the type for creating enum members, and the first inherited
        enum class.

        bases: the tuple of bases that was given to __new__
        cs�g}|D]t}d}|jD]d}|tkr&qqt|t�rL|jtk	rz|�|j�qqd|jkrvt|t�rbq|�|pl|�qq|}qqt|�dkr�td�|f��n|r�|dSdSdS)Nrsrz%r: too many data types: %rr)	r�rxr�rrvrJr^rr!)rS�
data_typesr��	candidater��r�rr�_find_data_types*




z.EnumMeta._get_mixins_.<locals>._find_data_typerzZnew enumerations should be created as `EnumName([mixin_type, ...] [data_type,] enum_type)`zCannot extend enumerations)rxrr�r!rt)r�rSr�rVrUrr�rrPs
zEnumMeta._get_mixins_c	Cs�|�dd�}|dk	}|dkrpdD]H}||fD].}t||d�}|ddjtjtjhkr,|}q\q,|dk	r qpq tj}|tjkr�d}nd}|||fS)a
        Returns the __new__ to be used for creating the enum members.

        classdict: the class dictionary given to __new__
        member_type: the data type whose __new__ will be used by default
        first_enum: enumeration to check for an overriding __new__
        rsN)r}rsFT)r�rQrsrxr)	rZrUrVrsr�method�possible�targetr�rrrrpCs*�
zEnumMeta._find_new_)N)N)r*r'r+r,�classmethodrWrsr�r�r�r�r�r�r�r�r��propertyr�rkr�r�r�r�r��staticmethodrOrPrprNrrr7rr�s8

%
	
5
!
	
.c@steZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
edd��Zedd��ZdS)rzV
    Generic enumeration.

    Derive from this class to define new enumerations.
    c
Cst|�|kr|Sz|j|WStk
r0Yn:tk
rh|j��D]}|j|krH|YSqHYnXzd}|�|�}Wn*tk
r�}z|}d}W5d}~XYnXzdt	||�r�|W�TSt
d||jf�}|dkr�|dkr�|�n|dk�rtd|j|f�}||_|�W5d}d}XdS)N�%r is not a valid %szDerror in %s._missing_: returned %r instead of None or a valid member)
r�rwr�r!ru�valuesrjr<�	ExceptionrDrBr*�__context__)r(r.r�r��result�e�ve_excrrrrsws@


��zEnum.__new__c	Cs6t|�D](}z|dWStk
r.YqXq|S)��
        Generate the next value when not given.

        name: the name of the member
        start: the initial start value or None
        count: the number of existing members
        last_value: the last value assigned or None
        rN)r�r!)rr�r�r��
last_valuerrrr;�s	zEnum._generate_next_value_cCsdSrfr)r(r.rrrr<�szEnum._missing_cCsd|jj|j|jfS)N�<%s.%s: %r>)r8r*r{rjr6rrrrk�s
�z
Enum.__repr__cCsd|jj|jfS)N�%s.%s)r8r*r{r6rrrrl�szEnum.__str__cs6�fdd��j��D�dd��jD�}dddg|S)z<
        Returns all members and all public methods
        cs2g|]*}|jD]}|ddkr|�jkr|�qqS�rr)r^ru)rXr(rhr6rrr��s
�z Enum.__dir__.<locals>.<listcomp>cSsg|]}|ddkr|�qSr�rrgrrrr��sr8r,r')r8r\r^)r#�added_behaviorrr6rr��s
��zEnum.__dir__cCsJt|�jtjtjfk}|jtks$|r2t}t|�}n|j}|j}|�||�S)z\
        Returns format using actual value type unless __str__ has been overridden.
        )	r�rlrrrvrxrErjrm)r#�format_spec�str_overriddenr(�valrrrrm�s	
zEnum.__format__cCs
t|j�Srf)�hashr{r6rrr�__hash__�sz
Enum.__hash__cCs|j|jffSrf�r8rjr"rrrr&�szEnum.__reduce_ex__cCs|jS)zThe name of the Enum member.)r{r6rrrr�sz	Enum.namecCs|jS)zThe value of the Enum member.�rjr6rrrr.�sz
Enum.valueN)r*r'r+r,rsr;r�r<rkrlr�rmr�r&rrr.rrrrrqs-


)�	metaclassc@seZdZdZdS)rz.Enum where members are also (and must be) intsN)r*r'r+r,rrrrr�scCs|jSrfrr"rrrr��sr�c@speZdZdZdd�Zedd��Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)rz
    Support for flags
    c	Csd|s|dk	r|SdSt|�D]:}zt|�}WqXWqtk
rTtd|�d�YqXqd|dS)r�NrzInvalid Flag value: %rr)r��	_high_bitr�r!)rr�r�r�r��high_bitrrrr;s	
zFlag._generate_next_value_cCs.|}|dkr|}|�|�}|dkr*|}|S)�V
        Returns member (possibly creating it) if one can be found for value.
        r)r:)r(r.�original_value�possible_memberrrrr<s
zFlag._missing_cCsb|j�|d�}|dkr^t||�\}}|r:td||jf��t�|�}d|_||_|j�	||�}|S)�L
        Create a composite member iff value contains only members.
        Nr�)
rwr��
_decomposerBr*rxrsr{rjrn)r(r.�
pseudo_memberr�extra_flagsrrrr:#s
zFlag._create_pseudo_member_cCs8t||j�s&tdt|�j|jjf��|j|j@|jkS)zP
        Returns True if self has at least the same flags set as other.
        r�)rDr8r!r�r+rj�r#�otherrrrr�7s��zFlag.__contains__cCsV|j}|jdk	r$d|j|j|jfSt||j�\}}d|jd�dd�|D��|jfS)Nr��|cSsg|]}t|jp|j��qSr�rEr{rjrgrrrr�Hsz!Flag.__repr__.<locals>.<listcomp>)r8r{r*rjr�rr�r#r(r��	uncoveredrrrrkAs
�z
Flag.__repr__cCs�|j}|jdk	r d|j|jfSt||j�\}}t|�dkr^|djdkr^d|j|djfSd|jd�dd�|D��fSdS)Nr�rrz%s.%rr�cSsg|]}t|jp|j��qSrr�rgrrrr�Vsz Flag.__str__.<locals>.<listcomp>)r8r{r*r�rjrrrr�rrrrlLs
�zFlag.__str__cCs
t|j�Srf)�boolrjr6rrrr�Ysz
Flag.__bool__cCs"t||j�stS|�|j|jB�Srf�rDr8�NotImplementedrjr�rrr�__or__\szFlag.__or__cCs"t||j�stS|�|j|j@�Srfrr�rrr�__and__aszFlag.__and__cCs"t||j�stS|�|j|jA�Srfrr�rrr�__xor__fszFlag.__xor__cCsNt|j|j�\}}|�d�}|jD] }||kr"|j|j@s"||B}q"|�|�Sr�)r�r8rj)r#r�r�invertedrhrrr�
__invert__ks


zFlag.__invert__N)r*r'r+r,r;r�r<r:r�rkrlr�rrrrrrrrr�s



c@sTeZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	eZ
eZe	Zdd
�Z
dS)rz)
    Support for integer-based Flags
    cCs*t|t�std||jf��|�|�}|S)r�r�)rD�intrBr*r:)r(r.�
new_memberrrrr<ys

zIntFlag._missing_cCs�|j�|d�}|dkr�|g}t||�\}}|rtt|�}d|}||jkrZ||krZ|�|�||krjd}q*||N}q*t|�D]*}t�||�}d|_||_	|j�
||�}q||S)r�Nrr)rwr�r�r�rJr�r	rsr{rjrn)r(r.r��need_to_createrr��bit�
flag_valuerrrr:�s(
�


zIntFlag._create_pseudo_member_cCs0t||jtf�stS|�|j|�|�jB�}|Srf�rDr8r	rrj)r#r�r�rrrr�szIntFlag.__or__cCs,t||jtf�stS|�|j|�|�j@�Srfrr�rrrr�szIntFlag.__and__cCs,t||jtf�stS|�|j|�|�jA�Srfrr�rrrr�szIntFlag.__xor__cCs|�|j�}|Srfr�)r#r�rrrr�szIntFlag.__invert__N)r*r'r+r,r�r<r:rrr�__ror__�__rand__�__rxor__rrrrrrts
	
 cCs|��dS)zJ
    returns index of highest bit, or -1 if value is zero or negative
    r)�
bit_length�r.rrrr��sr�cCs^g}|j��D]"\}}||jkr|�||jf�q|rZd�dd�|D��}td||f��|S)zI
    Class decorator for enumerations ensuring unique member values.
    z, cSsg|]\}}d||f�qS)z%s -> %sr)rX�aliasrrrrr��szunique.<locals>.<listcomp>z duplicate values found in %r: %s)r�r_rrJrrrB)�enumeration�
duplicatesrr��
alias_detailsrrrr
�s
��cCs�|}|dk}|r*dd�t|j���D�}ndd�t|j���D�}g}|D],\}}|rJ||@|krJ|�|�||M}qJ|s�||jkr�|�|j|�|jdd�dd�t|�d	kr�|dj|kr�|�d�||fS)
z-
    Extract all members from the value.
    rcSs"g|]\}}|jdk	r||f�qSrfr�rXrarhrrrr��s
�z_decompose.<locals>.<listcomp>cSs*g|]"\}}|jdk	st|�r||f�qSrf)r�
_power_of_tworrrrr��s
�cSs|jSrfr�)rhrrrr��r�z_decompose.<locals>.<lambda>T)rL�reverser)rHrwr_rJr�rr.ro)�flagr.�not_covered�negative�flags_to_checkr�r�r�rrrr��s(��

r�cCs|dkrdS|dt|�kS)NrFr)r�rrrrr�sr)r��typesrr�__all__rrr r)rxr-r	�dictr/rr�rr	rr�rrr�r
r�rrrrr�<module>s>�
	LivI%poplib.cpython-38.opt-2.pyc000064400000020522150335716500011427 0ustar00U

e5d�:�@shddlZddlZddlZddlZzddlZdZWnek
rHdZYnXddgZGdd�de�Z	dZ
dZd	Zd
Z
ee
ZdZGdd�d�Zer�Gd
d�de�Ze�d�edk�rdddlZeejd�Zee���e�ejd�e�ejd�e��e��\ZZeded�D]BZe� e�\Z!Z"Z#ede�e"D]Z$ede$��q<ed��qe�%�dS)�NTF�POP3�error_protoc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.8/poplib.pyrs�ni��
�
ic@seZdZdZeejfdd�Zdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd<dd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Ze�d/�Zd0d1�Z d2d3�Z!d=d4d5�Z"d6d7�Z#d8d9�Z$d>d:d;�Z%dS)?rzUTF-8cCsP||_||_d|_t�d|||�|�|�|_|j�d�|_d|_	|�
�|_dS)NFzpoplib.connect�rbr)�host�port�_tls_established�sys�audit�_create_socket�sock�makefile�file�
_debugging�_getresp�welcome)�selfr
r�timeoutrrr�__init__bsz
POP3.__init__cCst�|j|jf|�S�N)�socketZcreate_connectionr
r)rrrrrrmszPOP3._create_socketcCs:|jdkrtdt|��t�d||�|j�|t�dS)N�z*put*zpoplib.putline)r�print�reprrrrZsendall�CRLF�r�linerrr�_putlineps
z
POP3._putlinecCs.|jrtdt|��t||j�}|�|�dS)Nz*cmd*)rrr �bytes�encodingr$r"rrr�_putcmdxszPOP3._putcmdcCs�|j�td�}t|�tkr$td��|jdkr<tdt|��|sHtd��t|�}|dd�tkrp|dd�|fS|dd�t	kr�|dd�|fS|dd�|fS)Nrz
line too longz*get*z-ERR EOF������)
r�readline�_MAXLINE�lenrrrr r!�CR)rr#�octetsrrr�_getline�s
z
POP3._getlinecCs:|��\}}|jdkr$tdt|��|�d�s6t|��|S)Nrz*resp*�+)r/rrr �
startswithr)r�resp�orrrr�s

z
POP3._getrespcCsl|��}g}d}|��\}}|dkrb|�d�rB|d}|dd�}||}|�|�|��\}}q|||fS)Nr�.s..r)rr/r1�append)rr2�listr.r#r3rrr�_getlongresp�s

zPOP3._getlongrespcCs|�|�|��Sr)r'rr"rrr�	_shortcmd�s
zPOP3._shortcmdcCs|�|�|��Sr)r'r7r"rrr�_longcmd�s
z
POP3._longcmdcCs|jSr)r�rrrr�
getwelcome�szPOP3.getwelcomecCs
||_dSr)r)r�levelrrr�set_debuglevel�szPOP3.set_debuglevelcCs|�d|�S)NzUSER %s�r8�r�userrrrr@�sz	POP3.usercCs|�d|�S)NzPASS %sr>)rZpswdrrr�pass_�sz
POP3.pass_cCsF|�d�}|��}|jr&tdt|��t|d�}t|d�}||fS)NZSTATz*stat*r�)r8�splitrrr �int)rZretvalZretsZnumMessagesZsizeMessagesrrr�stat�s
z	POP3.statNcCs |dk	r|�d|�S|�d�S)NzLIST %sZLIST�r8r9�r�whichrrrr6�s	z	POP3.listcCs|�d|�S)NzRETR %s�r9rGrrr�retr�sz	POP3.retrcCs|�d|�S)NzDELE %sr>rGrrr�dele�sz	POP3.delecCs
|�d�S)NZNOOPr>r:rrr�noopsz	POP3.noopcCs
|�d�S)NZRSETr>r:rrr�rsetsz	POP3.rsetcCs|�d�}|��|S)NZQUIT)r8�close)rr2rrr�quits
z	POP3.quitcCs�z |j	}d|_	|dk	r|��W5|j}d|_|dk	r�zVz|�tj�Wn@tk
r�}z"|jtjkrxt|dd�dkrx�W5d}~XYnXW5|��XXdS)NZwinerrorri&')
rrNZshutdownrZ	SHUT_RDWR�OSError�errnoZENOTCONN�getattrr)rr�excrrrrrNs �z
POP3.closecCs|�d|�S)NzRPOP %sr>r?rrr�rpop5sz	POP3.rpops\+OK.[^<]*(<.*>)cCs\t||j�}|j�|j�}|s&td��ddl}|�d�|}|�|��	�}|�
d||f�S)Nz!-ERR APOP not supported by serverrrz
APOP %s %s)r%r&�	timestamp�matchrr�hashlib�groupZmd5Z	hexdigestr8)rr@ZpasswordZsecret�mrWZdigestrrr�apop<sz	POP3.apopcCs|�d||f�S)Nz	TOP %s %srI)rrHZhowmuchrrr�topQszPOP3.topcCs |dk	r|�d|�S|�d�S)NzUIDL %sZUIDLrFrGrrr�uidlZsz	POP3.uidlcCs
|�d�S)NZUTF8r>r:rrr�utf8fsz	POP3.utf8c	
Cspdd�}i}z4|�d�}|d}|D]}||�\}}|||<q$Wn*tk
rj}ztd��W5d}~XYnX|S)NcSs"|�d���}|d|dd�fS)N�asciirr)�decoderC)r#Zlstrrr�	_parsecapyszPOP3.capa.<locals>._parsecapZCAPArz!-ERR CAPA not supported by server)r9r)	rr`�capsr2ZrawcapsZcaplineZcapnmZcapargsZ_errrrr�capals

z	POP3.capacCsxtstd��|jrtd��|��}d|kr2td��|dkrBt��}|�d�}|j|j|j	d�|_|j�
d�|_d|_|S)Nz-ERR TLS support missing�$-ERR TLS session already establishedZSTLSz!-ERR STLS not supported by server�Zserver_hostnamerT)�HAVE_SSLrrrb�ssl�_create_stdlib_contextr8�wrap_socketrr
rr)r�contextrar2rrr�stls�s 
�z	POP3.stls)N)N)N)&rrrr&�	POP3_PORTr�_GLOBAL_DEFAULT_TIMEOUTrrr$r'r/rr7r8r9r;r=r@rArEr6rJrKrLrMrOrNrT�re�compilerUrZr[r\r]rbrjrrrrr3s@-�





	
c@s4eZdZeddejdfdd�Zdd�Zddd�ZdS)	�POP3_SSLNcCs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}|�dtd�||_||_|dkrxtj||d�}||_t	�
||||�dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadrB)�certfile�keyfile)�
ValueError�warnings�warn�DeprecationWarningrqrprfrgrirr)rr
rrqrprrirsrrrr�s$��zPOP3_SSL.__init__cCs"t�||�}|jj||jd�}|S)Nrd)rrrirhr
)rrrrrrr�s
�zPOP3_SSL._create_socketcCstd��dS)Nrc)r)rrqrprirrrrj�sz
POP3_SSL.stls)NNN)	rrr�
POP3_SSL_PORTrrlrrrjrrrrro�s�
ro�__main__rrB�zMessage %d:z   z-----------------------)&rQrmrrrfre�ImportError�__all__�	Exceptionrrkrvr-ZLFr!r+rror5r�argv�arr;r@rAr6rEZnumMsgsZ	totalSize�range�irJ�header�msgr.r#rOrrrr�<module>sJ
n0

asynchat.cpython-38.pyc000064400000015305150335716500011017 0ustar00U

e5d@,�@sDdZddlZddlmZGdd�dej�ZGdd�d�Zdd	�ZdS)
a�A class supporting chat-style (command/response) protocols.

This class adds support for 'chat' style protocols - where one side
sends a 'command', and the other sends a response (examples would be
the common internet protocols - smtp, nntp, ftp, etc..).

The handle_read() method looks at the input stream for the current
'terminator' (usually '\r\n' for single-line responses, '\r\n.\r\n'
for multi-line output), calling self.found_terminator() on its
receipt.

for example:
Say you build an async nntp client using this class.  At the start
of the connection, you'll have self.terminator set to '\r\n', in
order to process the single-line greeting.  Just before issuing a
'LIST' command you'll set it to '\r\n.\r\n'.  The output of the LIST
command will be accumulated (using your own 'collect_incoming_data'
method) up to the terminator, and then control will be returned to
you - by calling your self.found_terminator() method.
�N)�dequec@s�eZdZdZdZdZdZdZd(dd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�ZdS))�
async_chatz�This is an abstract class.  You must derive from this class, and add
    the two methods collect_incoming_data() and found_terminator()irzlatin-1NcCs(d|_g|_t�|_tj�|||�dS�N�)�ac_in_buffer�incomingr�
producer_fifo�asyncore�
dispatcher�__init__)�selfZsock�map�r� /usr/lib64/python3.8/asynchat.pyrCszasync_chat.__init__cCstd��dS�Nzmust be implemented in subclass��NotImplementedError�r�datarrr�collect_incoming_dataQsz async_chat.collect_incoming_datacCs|j�|�dS�N)r�appendrrrr�_collect_incoming_dataTsz!async_chat._collect_incoming_datacCsd�|j�}|jdd�=|Sr)�joinr)r�drrr�	_get_dataWszasync_chat._get_datacCstd��dSrr�rrrr�found_terminator\szasync_chat.found_terminatorcCsBt|t�r|jrt||j�}nt|t�r8|dkr8td��||_dS)zdSet the input delimiter.

        Can be a fixed string of any length, an integer, or None.
        rz-the number of received bytes must be positiveN)�
isinstance�str�use_encoding�bytes�encoding�int�
ValueError�
terminator)rZtermrrr�set_terminator_s
zasync_chat.set_terminatorcCs|jSr)r%rrrr�get_terminatorjszasync_chat.get_terminatorc
Cs�z|�|j�}WnDtk
r&YdStk
rT}z|��WY�dSd}~XYnXt|t�rr|jrrtt|j	�}|j
||_
|j
�r�t|j
�}|��}|s�|�
|j
�d|_
q~t|t��r|}||kr�|�
|j
�d|_
|j||_n2|�
|j
d|��|j
|d�|_
d|_|��q~t|�}|j
�|�}|dk�rv|dk�rX|�
|j
d|��|j
||d�|_
|��q~t|j
|�}|�r�||k�r�|�
|j
d|��|j
|d�|_
�q�q~|�
|j
�d|_
q~dS)Nrr���)Zrecv�ac_in_buffer_size�BlockingIOError�OSError�handle_errorrrr r!r"r�lenr'rr#r%r�find�find_prefix_at_end)rrZwhyZlbr%�nZterminator_len�indexrrr�handle_readrsR

	



zasync_chat.handle_readcCs|��dSr)�
initiate_sendrrrr�handle_write�szasync_chat.handle_writecCs|��dSr)�closerrrr�handle_close�szasync_chat.handle_closecCsxt|tttf�stdt|���|j}t|�|kr`tdt|�|�D]}|j	�
||||��q@n|j	�
|�|��dS)Nz#data argument must be byte-ish (%r)r)rr!�	bytearray�
memoryview�	TypeError�type�ac_out_buffer_sizer-�rangerrr3)rrZsabs�irrr�push�s�zasync_chat.pushcCs|j�|�|��dSr)rrr3)rZproducerrrr�push_with_producer�szasync_chat.push_with_producercCsdS)z4predicate for inclusion in the readable for select()�rrrrr�readable�szasync_chat.readablecCs|jp|jS)z4predicate for inclusion in the writable for select())r�	connectedrrrr�writable�szasync_chat.writablecCs|j�d�dS)zAautomatically close this channel once the outgoing queue is emptyN)rrrrrr�close_when_done�szasync_chat.close_when_donecCs|j�r|j�r|jd}|s:|jd=|dkr:|��dS|j}z|d|�}Wn:tk
r�|��}|rz|j�|�n|jd=YqYnXt|t�r�|j	r�t
||j�}z|�|�}Wnt
k
r�|��YdSX|�r|t|�ks�|t|�k�r
||d�|jd<n|jd=dSdS)Nr)rrBr6r;r9�more�
appendleftrrr r!r"�sendr+r,r-)r�firstZobsrZnum_sentrrrr3�s8

zasync_chat.initiate_sendcCs d|_|jdd�=|j��dSr)rrr�clearrrrr�discard_buffersszasync_chat.discard_buffers)NN)�__name__�
__module__�__qualname__�__doc__r)r;r r"rrrrrr&r'r2r4r6r>r?rArCrDr3rJrrrrr4s,
H(rc@seZdZddd�Zdd�ZdS)�simple_producer�cCs||_||_dSr)r�buffer_size)rrrQrrrrszsimple_producer.__init__cCsJt|j�|jkr6|jd|j�}|j|jd�|_|S|j}d|_|SdSr)r-rrQ)r�resultrrrrEszsimple_producer.moreN)rP)rKrLrMrrErrrrrOs
rOcCs0t|�d}|r,|�|d|��s,|d8}q|S)Nr@)r-�endswith)ZhaystackZneedle�lrrrr//s
r/)rNr	�collectionsrr
rrOr/rrrr�<module>s\ nntplib.cpython-38.opt-2.pyc000064400000051732150335716500011617 0ustar00U

e5d���@s�ddlZddlZddlZddlZddlZddlZzddlZWnek
rTdZYnXdZddl	m
ZddlmZdddd	d
ddd
gZ
dZGdd�de�ZGdd�de�ZGdd	�d	e�ZGdd
�d
e�ZGdd�de�ZGdd�de�ZdZdZdddddddddd d!d"hZd#d$d%d&d'd(d)gZd(d)d*�Zd+Ze�d,d-d.d/d0g�Ze�d1d2d3d4g�Zd5d
�Z
d6d7�Zdld8d9�Z dmd:d;�Z!dnd<d=�Z"e�r�d>d?�Z#Gd@dA�dA�Z$GdBd�de$�Z%e�r�GdCdD�dDe$�Z&e
�'dD�e(dEk�r�ddl)Z)e)j*dFdG�Z+e+j,dHdIdJdKdL�e+j,dMdNdOdPdL�e+j,dQdRdSe-dTeefdU�e+j,dVdWdXe-dYdU�e+j,dZd[d\dd]d^�e+�.�Z/e/j0Z0e/j�s�e0dSk�rxeZ0e%e/j1e0d_�Z2ne0dSk�r�eZ0e&e/j1e0d_�Z2e2�3�Z4d`e4k�r�e2�5�e2�6e/j6�\Z7Z8Z9Z:Z;e<dae;dbe8dce9dde:�dedf�Z=e>e-e:�e/j?dg�Z9e2�@e9e:�\Z7ZAeAD]Z\ZBZCe
eCd$��Ddhdg�dZEe
eCd#�ZFe-eCd)�ZGe<di�HeBe=eEdj�e=eFdk�eG���qe2�I�dS)o�NFT)�
decode_header)�_GLOBAL_DEFAULT_TIMEOUT�NNTP�	NNTPError�NNTPReplyError�NNTPTemporaryError�NNTPPermanentError�NNTPProtocolError�
NNTPDataErrorric@seZdZdd�ZdS)rcGs>tj|f|��z|d|_Wntk
r8d|_YnXdS)NrzNo response given)�	Exception�__init__�response�
IndexError)�self�args�r�/usr/lib64/python3.8/nntplib.pyrcs
zNNTPError.__init__N)�__name__�
__module__�__qualname__rrrrrrasc@seZdZdS)rN�rrrrrrrrjsc@seZdZdS)rNrrrrrrnsc@seZdZdS)rNrrrrrrrsc@seZdZdS)r	Nrrrrrr	vsc@seZdZdS)r
Nrrrrrr
zs�wi3Z100Z101�211�215Z220Z221Z222Z224Z225Z230Z231Z282�subject�from�datez
message-idZ
referencesz:bytesz:lines)�bytes�lines�
�	GroupInfo�group�last�first�flag�ArticleInfoZnumber�
message_idrcCsJg}t|�D]2\}}t|t�r4|�|�|p,d��q|�|�qd�|�S)N�ascii�)�_email_decode_header�
isinstancer�append�decode�join)Z
header_str�parts�v�encrrrr�s
cCs�g}|D]`}|ddkr:|dd��d�\}}}d|}n|�d�\}}}|��}t�||�}|�|�qt}t|�t|�kr�td��|dt|��|kr�td��|S)Nr�:�z$LIST OVERVIEW.FMT response too shortz*LIST OVERVIEW.FMT redefines default fields)�	partition�lower�_OVERVIEW_FMT_ALTERNATIVES�getr+�_DEFAULT_OVERVIEW_FMT�lenr
)r�fmt�line�name�_�suffix�defaultsrrr�_parse_overview_fmt�s
r?cCs�tt�}g}|D]�}i}|�d�^}}t|�}t|�D]�\}	}
|	t|�krLq6||	}|�d�}|	|kr�|s�|d}
|
r�|
dt|
����|
kr�td��|
r�|
t|
�d�nd}
|
|||	<q6|�||f�q|S)N�	r1z: z?OVER/XOVER response doesn't include names of additional headers)	r8r7�split�int�	enumerate�
startswithr4r
r+)rr9Zdata_process_funcZ
n_defaultsZoverviewr:ZfieldsZarticle_number�tokens�i�tokenZ
field_nameZis_metadata�hrrr�_parse_overview�s&
rIcCs�|dkr |dd�}|dd�}t|dd��}t|dd��}t|dd��}t|dd��}t|dd��}t|dd��}|dkr�|d7}n|dkr�|d	7}t�||||||�S)
Ni�������������Fi��dil)rB�datetime)�date_str�time_strZhoursZminutesZseconds�yearZmonthZdayrrr�_parse_datetime�s
rTcCsPt|tj�sd}n
d�|�}|j}|r<|d}d�||�}nd�||�}||fS)NZ000000z({0.hour:02d}{0.minute:02d}{0.second:02d}rOz{0:02d}{1.month:02d}{1.day:02d}z{0:04d}{1.month:02d}{1.day:02d})r*rP�formatrS)ZdtZlegacyrR�yrQrrr�_unparse_datetime�s

rWcCs|dkrt��}|j||d�S)N)Zserver_hostname)�sslZ_create_stdlib_contextZwrap_socket)�sock�contextZhostnamerrr�_encrypt_onsr[c@seZdZdZdZdefdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZeZdd�Z
dd�Zdhdd�Zdd�Zdidd�Zdd�Zdjdd�Zdkdd �Zd!d"�Zd#d$�Zd%d&�Zdd'�d(d)�Zdd'�d*d+�Zdldd'�d,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zdd'�d6d7�Zd8d9�Z d:d;�Z!dmd<d=�Z"d>d?�Z#d@dA�Z$dndBdC�Z%dodd'�dDdE�Z&dpdd'�dFdG�Z'dqdd'�dHdI�Z(dJdK�Z)dd'�dLdM�Z*dd'�dNdO�Z+dd'�dPdQ�Z,dd'�dRdS�Z-dTdU�Z.dVdW�Z/dXdY�Z0dZd[�Z1d\d]�Z2d^d_�Z3d`da�Z4drdbdc�Z5ddde�Z6e7�rdsdfdg�Z8dS)t�	_NNTPBasezutf-8�surrogateescapeNcCsj||_||_d|_|��|_d|_|��d|_|rZd|jkrZ|��|jsZd|_|��d|_	d|_
dS)NrF�READER)�host�file�	debugging�_getresp�welcome�_caps�getcapabilities�readermode_afterauth�_setreadermode�tls_on�
authenticated)rr`r_�
readermode�timeoutrrrr9s
	z_NNTPBase.__init__cCs|S�Nr�rrrr�	__enter__hsz_NNTPBase.__enter__c	sR�fdd�}|�rNz*z���Wnttfk
r8YnXW5|�rL���XdS)Ncs
t�d�S)Nr`)�hasattrrrmrr�<lambda>l�z$_NNTPBase.__exit__.<locals>.<lambda>)�_close�quit�OSError�EOFError)rrZis_connectedrrmr�__exit__ks
z_NNTPBase.__exit__cCs|jrtdt|j��|jS)Nz	*welcome*)ra�print�reprrcrmrrr�
getwelcomevsz_NNTPBase.getwelcomec	Cs�|jdkr�d|_d|_z|��\}}Wnttfk
rDi|_Yn<X||_d|krhttt|d��|_d|kr�d�	|d�|_|jS)Nr2ZVERSIONZIMPLEMENTATION� )
rd�nntp_versionZnntp_implementation�capabilitiesrr�max�maprBr-)r�resp�capsrrrres
z_NNTPBase.getcapabilitiescCs
||_dSrl)ra)r�levelrrr�set_debuglevel�sz_NNTPBase.set_debuglevelcCsHt�d||�|t}|jdkr.tdt|��|j�|�|j��dS)Nznntplib.putliner2z*put*)	�sys�audit�_CRLFrarwrxr`�write�flush�rr:rrr�_putline�s
z_NNTPBase._putlinecCs2|jrtdt|��|�|j|j�}|�|�dS)Nz*cmd*)rarwrx�encode�encoding�errorsr�r�rrr�_putcmd�sz_NNTPBase._putcmdTcCs�|j�td�}t|�tkr$td��|jdkr<tdt|��|sDt�|r�|dd�t	krf|dd�}n|dd�t	kr�|dd�}|S)Nr2z
line too longz*get*rM���)
r`�readline�_MAXLINEr8r
rarwrxrur�)rZ
strip_crlfr:rrr�_getline�s
z_NNTPBase._getlinecCsl|��}|jrtdt|��|�|j|j�}|dd�}|dkrHt|��|dkrXt|��|dkrht	|��|S)Nz*resp*r2�4�5Z123)
r�rarwrxr,r�r�rrr	)rr�crrrrb�sz_NNTPBase._getrespcCs�d}z�t|ttf�r"t|d�}}|��}|dd�tkrBt|��g}|dk	r�dtdf}|�	d�}||krnq�|�
d�r�|dd�}|�|�qZn8d}|�	�}||kr�q�|�
d�r�|dd�}|�|�q�W5|r�|��X||fS)N�wb��.s.
Fs..r2)
�closer*�strr�openrb�	_LONGRESPrr�r�rDr�r+)rr`Z
openedFilerrZterminatorsr:�
terminatorrrr�_getlongresp�s4	



z_NNTPBase._getlongrespcCs|�|�|��Srl)r�rbr�rrr�	_shortcmd�s
z_NNTPBase._shortcmdcCs|�|�|�|�Srl�r�r�)rr:r`rrr�_longcmds
z_NNTPBase._longcmdcs.��|���|�\}}|�fdd�|D�fS)Ncsg|]}|��j�j��qSr)r,r�r���.0r:rmrr�
<listcomp>s�z,_NNTPBase._longcmdstring.<locals>.<listcomp>r�)rr:r`r�listrrmr�_longcmdstring	s

�z_NNTPBase._longcmdstringcCsdz|jWStk
rYnXz|�d�\}}Wn tk
rPtdd�}Yn
Xt|�}||_|S)NzLIST OVERVIEW.FMT)Z_cachedoverviewfmt�AttributeErrorr�rr7r?)rrrr9rrr�_getoverviewfmtsz_NNTPBase._getoverviewfmtcCsdd�|D�S)NcSsg|]}t|����qSr)r rAr�rrrr�&sz(_NNTPBase._grouplist.<locals>.<listcomp>r)rrrrr�
_grouplist$sz_NNTPBase._grouplistcCs8i}|�d�\}}|D]}|��^}}|||<q||fS)NZCAPABILITIES)r�rA)rr�rrr:r;rErrrr|(s
z_NNTPBase.capabilities)r`cCsbt|tjtjf�s$td�|jj���t||jdk�\}}d�||�}|�	||�\}}||�
|�fS)N�Athe date parameter must be a date or datetime object, not '{:40}'rJzNEWGROUPS {0} {1})r*rPr�	TypeErrorrU�	__class__rrWr{r�r�)rrr`rQrR�cmdrrrrr�	newgroups6s��z_NNTPBase.newgroupscCsRt|tjtjf�s$td�|jj���t||jdk�\}}d�|||�}|�	||�S)Nr�rJzNEWNEWS {0} {1} {2})
r*rPrr�rUr�rrWr{r�)rr!rr`rQrRr�rrr�newnewsFs��z_NNTPBase.newnewscCs4|dk	rd|}nd}|�||�\}}||�|�fS)NzLIST ACTIVE ZLIST)r�r�)r�
group_patternr`�commandrrrrrr�Vs

z_NNTPBase.listcCs�t�d�}|�d|�\}}|�d�s8|�d|�\}}i}|D]:}|�|���}|r@|�dd�\}	}
|sr|
S|
||	<q@|r�||fSdSdS)Nz^(?P<group>[^ 	]+)[ 	]+(.*)$zLIST NEWSGROUPS r�XGTITLE r2rJr()�re�compiler�rD�search�stripr!)rr�Z
return_all�line_patrr�groups�raw_line�matchr;Zdescrrr�_getdescriptionses


z_NNTPBase._getdescriptionscCs|�|d�S)NF�r�)rr!rrr�description|sz_NNTPBase.descriptioncCs|�|d�S)NTr�)rr�rrr�descriptions�sz_NNTPBase.descriptionscCs�|�d|�}|�d�s t|��|��}d}}}t|�}|dkr�|d}|dkr�|d}|dkr�|d}|dkr�|d��}|t|�t|�t|�|fS)NzGROUP rrr2rJr�rK)r�rDrrAr8r4rB)rr;r�words�countr#r"�nrrrr!�s

z_NNTPBase.groupcCs|�d|�S)NZHELP)r�)rr`rrr�help�sz_NNTPBase.helpcCs8|�d�st|��|��}t|d�}|d}|||fS)NZ22r2rJ)rDrrArB)rrr��art_numr&rrr�
_statparse�s
z_NNTPBase._statparsecCs|�|�}|�|�Srl)r�r�)rr:rrrr�_statcmd�s
z_NNTPBase._statcmdcCs"|r|�d�|��S|�d�SdS)NzSTAT {0}ZSTAT)r�rU)r�message_specrrr�stat�s	z_NNTPBase.statcCs
|�d�S)NZNEXT�r�rmrrr�next�sz_NNTPBase.nextcCs
|�d�S)NZLASTr�rmrrrr"�sz_NNTPBase.lastcCs0|�||�\}}|�|�\}}}|t|||�fSrl)r�r�r%)rr:r`rrr�r&rrr�_artcmd�sz_NNTPBase._artcmdcCs$|dk	rd�|�}nd}|�||�S)NzHEAD {0}ZHEAD�rUr��rr�r`r�rrr�head�sz_NNTPBase.headcCs$|dk	rd�|�}nd}|�||�S)NzBODY {0}ZBODYr�r�rrr�body�sz_NNTPBase.bodycCs$|dk	rd�|�}nd}|�||�S)NzARTICLE {0}ZARTICLEr�r�rrr�article�sz_NNTPBase.articlecCs
|�d�S)NZSLAVE)r�rmrrr�slavesz_NNTPBase.slavecsDt�d��|�d�||�|�\}}�fdd��|�fdd�|D�fS)Nz^([0-9]+) ?(.*)
?zXHDR {0} {1}cs��|�}|r|�dd�S|S)Nr2rJ)r�r!)r:�m)�patrr�
remove_numbers
z%_NNTPBase.xhdr.<locals>.remove_numbercsg|]}�|��qSrrr�)r�rrr�sz"_NNTPBase.xhdr.<locals>.<listcomp>)r�r�r�rU)rZhdrr�r`rrr)r�r�r�xhdrs	
z_NNTPBase.xhdrcCs.|�d�||�|�\}}|��}|t||�fS)Nz
XOVER {0}-{1})r�rUr�rI)r�start�endr`rrr9rrr�xovers
	�z_NNTPBase.xoverc	Csxd|jkrdnd}t|ttf�r>|\}}|d�||p6d�7}n|dk	rR|d|}|�||�\}}|��}|t||�fS)NZOVERZXOVERz {0}-{1}r(rz)rdr*�tupler�rUr�r�rI)	rr�r`r�r�r�rrr9rrr�over*sz_NNTPBase.overc	Csft�dtd�t�d�}|�d||�\}}g}|D](}|�|���}|r4|�|�	dd��q4||fS)NzFThe XGTITLE extension is not actively used, use descriptions() insteadrJz^([^ 	]+)[ 	]+(.*)$r�r2)
�warnings�warn�DeprecationWarningr�r�r�r�r�r+r!)	rr!r`r�rZ	raw_linesrr�r�rrr�xgtitleEs�
z_NNTPBase.xgtitlecCslt�dtd�|�d�|��}|�d�s0t|��z|��\}}Wntk
r^t|�d�Yn
X||fSdS)Nz(The XPATH extension is not actively usedrJz	XPATH {0}Z223)	r�r�r�r�rUrDrrA�
ValueError)r�idrZresp_num�pathrrr�xpathWs�
z_NNTPBase.xpathcCsb|�d�}|�d�st|��|��}t|�dkr8t|��|d}t|�dkrTt|��|t|d�fS)NZDATEZ111rJr2�)r�rDrrAr8r
rT)rr�elemrrrrrks

z_NNTPBase.datecCs�|�|�}|�d�st|��t|ttf�r2|��}|D]:}|�t�sR|�	d�t}|�d�rdd|}|j
�|�q6|j
�d�|j
��|�
�S)N�3rr�s.
)r�rDrr*r�	bytearray�
splitlines�endswithr��rstripr`r�r�rb)rr��frr:rrr�_post|s




z_NNTPBase._postcCs|�d|�S)NZPOST)r�)r�datarrr�post�sz_NNTPBase.postcCs|�d�|�|�S)Nz	IHAVE {0})r�rU)rr&r�rrr�ihave�sz_NNTPBase.ihavecCs|j��|`dSrl)r`r�rmrrrrr�s
z_NNTPBase._closecCsz|�d�}W5|��X|S)NZQUIT)rrr�)rrrrrrs�s
z_NNTPBase.quitcCs�|jrtd��|s|std��z<|rX|sXddl}|��}|�|j�}|rX|d}|d}Wntk
rnYnX|sxdS|�d|�}|�d�r�|s�t|��n |�d|�}|�d�s�t	|��d|_
|��|jr�d	|j
kr�|�
�d|_
|��dS)
NzAlready logged in.z7At least one of `user` and `usenetrc` must be specifiedrrJzauthinfo user Z381zauthinfo pass Z281r^)rir��netrcZauthenticatorsr_rtr�rDrrrdrerfrg)r�user�password�usenetrcr�ZcredentialsZauthrrrr�login�s>�


z_NNTPBase.loginc
Cs`z|�d�|_WnJtk
r$Yn8tk
rZ}z|j�d�rHd|_n�W5d}~XYnXdS)Nzmode readerZ480T)r�rcrrr
rDrf)r�errrrg�sz_NNTPBase._setreadermodecCs||jrtd��|jrtd��|�d�}|�d�rp|j��t|j||j	�|_|j�
d�|_d|_d|_|��nt
d��dS)NzTLS is already enabled.z+TLS cannot be started after authentication.�STARTTLSZ382�rwbTzTLS failed to start.)rhr�rir�rDr`r�r[rYr_�makefilerdrer)rrZrrrr�starttls�s



z_NNTPBase.starttls)T)N)N)N)N)N)N)N)N)N)NNT)N)9rrrr�r�rrrnrvryrer��debugr�r�r�rbr�r�r�r�r�r�r|r�r�r�r�r�r�r!r�r�r�r�r�r"r�r�r�r�r�r�r�r�r�r�rr�r�r�rrrsr�rg�	_have_sslr�rrrrr\)sn
�
/		

.







		
)
r\c@s*eZdZeddddefdd�Zdd�ZdS)rNFc	Cs�||_||_t�d|||�t�||f|�|_d}z8|j�d�}t�	|||||�|sZ|rh|�
|||�Wn$|r~|��|j���YnXdS)N�nntplib.connectr�)r_�portr�r��socket�create_connectionrYr�r\rr�r�)	rr_r�r�r�rjr�rkr`rrrr�s$
�
z
NNTP.__init__cCs zt�|�W5|j��XdSrl�rYr�r\rrrmrrrrr$szNNTP._close)rrr�	NNTP_PORTrrrrrrrrr�s�
%c@s,eZdZedddddefdd�Zdd�ZdS)�NNTP_SSLNFc	
Cs�t�d|||�t�||f|�|_d}	zJt|j||�|_|j�d�}	tj||	|||d�|s`|rn|�	|||�Wn$|	r�|	�
�|j�
��YnXdS)Nr�r�)rjrk)r�r�r�r�rYr[r�r\rr�r�)
rr_r�r�r�Zssl_contextrjr�rkr`rrrr.s"
�
zNNTP_SSL.__init__cCs zt�|�W5|j��XdSrlr�rmrrrrrEszNNTP_SSL._close)rrr�
NNTP_SSL_PORTrrrrrrrrr�,s�
r��__main__zJ        nntplib built-in demo - display the latest articles in a newsgroup)r�z-gz--groupzgmane.comp.python.generalz3group to fetch messages from (default: %(default)s))�defaultr�z-sz--serverz
news.gmane.ioz+NNTP server hostname (default: %(default)s)z-pz--portr�z#NNTP port number (default: %s / %s))r�typer�z-nz
--nb-articles�
z2number of articles to fetch (default: %(default)s)z-Sz--ssl�
store_truezuse NNTP over SSL)�actionrr�)r_r�r�ZGroupZhaszarticles, range�tocCs$t|�|kr |d|d�d}|S)NrKz...)r8)�sZlimrrr�cutpsr	r2�<z{:7} {:20} {:42} ({})��*)N)N)F)Jr�r��collectionsrPr�r�rX�ImportErrorr�Zemail.headerrr)r�__all__r�rrrrrr	r
r�rr�r7r5r��
namedtupler r%r?rIrTrWr[r\rr�r+r�argparse�ArgumentParser�parser�add_argumentrB�
parse_argsrr�Zserverrrer�r�r!rr�r#r"r;rwr	r�Znb_articlesr�Z	overviewsZartnumr�rAZauthorrrrUrsrrrr�<module>Bs�
�
	���
��


Y.


�
�
���


�
doctest.cpython-38.pyc000064400000224310150335716500010650 0ustar00U

e5d_��!@stdZdZdddddddd	d
ddd
ddddddddddddddddddd d!d"g!Zd#d$lZd#d$lZd#d$lZd#d$lZd#d$lZd#d$lZd#d$l	Z	d#d$l
Z
d#d$lZd#d$lZd#d%l
mZd#d&lmZed'd(�ZiZd)d�Zed�Zed�Zed�Zed�Zed�Zed�ZeeBeBeBeBeBZed
�Zed�Zed�Zed
�Zed�ZeeBeBeBeBZ d*Z!d+Z"d,d-�Z#dsd/d0�Z$d1d2�Z%d3d4�Z&dtd6d7�Z'd8d9�Z(Gd:d;�d;e�Z)d<d=�Z*d>d?�Z+d@dA�Z,GdBdC�dCej-�Z.dDdE�Z/GdFd�d�Z0GdGd�d�Z1GdHd�d�Z2GdId�d�Z3GdJd�d�Z4GdKd�d�Z5GdLd�de6�Z7GdMd�de6�Z8GdNd�de4�Z9d$a:dudQd�Z;dOd$d$d$d$dOd#d$dPe2�d$fdRd�Z<dvdTd�Z=d#a>dUd�Z?GdVdW�dWej@�ZAGdXdY�dYeA�ZBGdZd[�d[ejC�ZDdwd\d�ZEGd]d^�d^eA�ZFdOd$d$e2�d$fd_d`�ZGdad�ZHdbd�ZIdcd �ZJdxddd!�ZKdydedf�ZLdzdgd"�ZMGdhdi�di�ZNeNdjdkdldmdndo�ZOdpdq�ZPeQdrk�rpe
�ReP��d$S){a�Module doctest -- a framework for running examples in docstrings.

In simplest use, end each module M to be tested with:

def _test():
    import doctest
    doctest.testmod()

if __name__ == "__main__":
    _test()

Then running the module as a script will cause the examples in the
docstrings to get executed and verified:

python M.py

This won't display anything unless an example fails, in which case the
failing example(s) and the cause(s) of the failure(s) are printed to stdout
(why not stderr? because stderr is a lame hack <0.2 wink>), and the final
line of output is "Test failed.".

Run it with the -v switch instead:

python M.py -v

and a detailed report of all examples tried is printed to stdout, along
with assorted summaries at the end.

You can force verbose mode by passing "verbose=True" to testmod, or prohibit
it by passing "verbose=False".  In either of those cases, sys.argv is not
examined by testmod.

There are a variety of other ways to run doctests, including integration
with the unittest framework, and support for running non-Python text
files containing doctests.  There are also many ways to override parts
of doctest's default behaviors.  See the Library Reference Manual for
details.
zreStructuredText en�register_optionflag�DONT_ACCEPT_TRUE_FOR_1�DONT_ACCEPT_BLANKLINE�NORMALIZE_WHITESPACE�ELLIPSIS�SKIP�IGNORE_EXCEPTION_DETAIL�COMPARISON_FLAGS�REPORT_UDIFF�REPORT_CDIFF�REPORT_NDIFF�REPORT_ONLY_FIRST_FAILURE�REPORTING_FLAGS�	FAIL_FAST�Example�DocTest�
DocTestParser�
DocTestFinder�
DocTestRunner�
OutputChecker�DocTestFailure�UnexpectedException�DebugRunner�testmod�testfile�run_docstring_examples�DocTestSuite�DocFileSuite�set_unittest_reportflags�script_from_examples�
testsource�	debug_src�debug�N)�StringIO)�
namedtuple�TestResultszfailed attemptedcCst�|dtt�>�S)N�)�OPTIONFLAGS_BY_NAME�
setdefault�len��name�r,�/usr/lib64/python3.8/doctest.pyr�sz<BLANKLINE>z...cCs8d}tjD](}|�|d�}|tt|�kr
||jO}q
|S)z�
    Return the compiler-flags associated with the future features that
    have been imported into the given namespace (globs).
    r"N)�
__future__Zall_feature_names�get�getattrZ
compiler_flag)�globs�flagsZfnameZfeaturer,r,r-�_extract_future_flags�s
r3�cCsVt�|�r|St|t�r,t|t�t�dg�S|dkrJtjt�	|�j
dStd��dS)a�
    Return the module specified by `module`.  In particular:
      - If `module` is a module, then return module.
      - If `module` is a string, then import and return the
        module with that name.
      - If `module` is None, then return the calling module.
        The calling module is assumed to be the module of
        the stack frame at the given depth in the call stack.
    �*N�__name__z"Expected a module, string, or None)�inspect�ismodule�
isinstance�str�
__import__�globals�locals�sys�modules�	_getframe�	f_globals�	TypeError)�moduleZdepthr,r,r-�_normalize_module�s


rDcCsdD]}|�|d�}q|S)N)z
�
�
)�replace)�data�newliner,r,r-�_newline_convert�srJc
Cs�|rVt|d�}t||�}t|dd�dk	rVt|jd�rV|j�|�}|�|�}t|�|fSt||d��}|�	�|fW5QR�SQRXdS)N��
__loader__�get_data)�encoding)
rD�_module_relative_pathr0�hasattrrLrM�decoderJ�open�read)�filename�package�module_relativerNZ
file_contents�fr,r,r-�_load_testfile�s


rX�cCst�d|d|�S)z~
    Add the given number of space characters to the beginning of
    every non-blank line in `s`, and return the result.
    z
(?m)^(?!$)� )�re�sub)�s�indentr,r,r-�_indent�sr_cCs*t�}|\}}}tj||||d�|��S)zz
    Return a string containing a traceback message for the given
    exc_info tuple (as returned by sys.exc_info()).
    )�file)r#�	traceback�print_exception�getvalue)�exc_infoZexcout�exc_typeZexc_valZexc_tbr,r,r-�_exception_traceback�s
rfc@seZdZdd�Zddd�ZdS)�	_SpoofOutcCs$t�|�}|r |�d�s |d7}|S�NrF)r#rc�endswith)�self�resultr,r,r-rcs
z_SpoofOut.getvalueNcCs|�|�t�|�dS�N)�seekr#�truncate)rj�sizer,r,r-rn	s
z_SpoofOut.truncate)N)r6�
__module__�__qualname__rcrnr,r,r,r-rg�s	rgcCs�t|kr||kS|�t�}t|�dks*t�dt|�}}|d}|rb|�|�r^t|�}|d=ndS|d}|r�|�|�r�|t|�8}|d=ndS||kr�dS|D],}|�|||�}|dkr�dS|t|�7}q�dS)z_
    Essentially the only subtle case:
    >>> _ellipsis_match('aa...aa', 'aaa')
    False
    r4r"F���T)�ELLIPSIS_MARKER�splitr)�AssertionError�
startswithri�find)�want�gotZws�startpos�endpos�wr,r,r-�_ellipsis_matchs2


r}cCs|��}|rd|SdSdS)z)Return a commented form of the given linez# �#N)�rstrip)�liner,r,r-�
_comment_line?sr�cCshdt|�}}|�d�}|dkr$|}|�dd|�}|dkr>|}|�dd|�}|dkr\|d}|||�S)Nr"rF�:�.r&)r)rw�rfind)�msg�start�end�ir,r,r-�_strip_exception_detailsGs
r�c@s2eZdZdZdd�Zddd�Zdd�Zd	d
�ZdS)�_OutputRedirectingPdbz�
    A specialized version of the python debugger that redirects stdout
    to a given stream when interacting with the user.  Stdout is *not*
    redirected when traced code is executed.
    cCs(||_d|_tjj||dd�d|_dS)NFT)�stdout�nosigintr&)�_OutputRedirectingPdb__out�$_OutputRedirectingPdb__debugger_used�pdb�Pdb�__init__Zuse_rawinput)rj�outr,r,r-r�gsz_OutputRedirectingPdb.__init__NcCs*d|_|dkrt��j}tj�||�dS)NT)r�r>r@�f_backr�r��	set_trace)rj�framer,r,r-r�os
z_OutputRedirectingPdb.set_tracecCs|jrtj�|�dSrl)r�r�r��set_continue�rjr,r,r-r�usz"_OutputRedirectingPdb.set_continuecGs2tj}|jt_ztjj|f|��W�S|t_XdSrl)r>r�r�r�r��trace_dispatch)rj�args�save_stdoutr,r,r-r�{s
z$_OutputRedirectingPdb.trace_dispatch)N)r6rprq�__doc__r�r�r�r�r,r,r,r-r�as

r�cCs�t�|�std|��|�d�r(td��tjj|�d��}t	|d�rXtj�|j
�d}n�|jdkr�tt
j�dkr�t
jddkr�tj�t
jd�d}q�tj}nFt	|d�r�|jD]&}tj�||�}tj�|�r�|Sq�td	|j��tj�||�S)
NzExpected a module: %r�/z1Module-relative files may not have absolute paths�__file__r"�__main__��__path__zBCan't resolve paths relative to the module %r (it has no __file__))r7r8rBrv�
ValueError�os�path�joinrtrPr�r6r)r>�argv�curdirr��exists)rCZ	test_pathZbasedirZ	directory�fullpathr,r,r-rO�s(






�rOc@s*eZdZdZd
dd�Zdd�Zdd	�ZdS)ran
    A single doctest example, consisting of source code and expected
    output.  `Example` defines the following attributes:

      - source: A single Python statement, always ending with a newline.
        The constructor adds a newline if needed.

      - want: The expected output from running the source code (either
        from stdout, or a traceback in case of exception).  `want` ends
        with a newline unless it's empty, in which case it's an empty
        string.  The constructor adds a newline if needed.

      - exc_msg: The exception message generated by the example, if
        the example is expected to generate an exception; or `None` if
        it is not expected to generate an exception.  This exception
        message is compared against the return value of
        `traceback.format_exception_only()`.  `exc_msg` ends with a
        newline unless it's `None`.  The constructor adds a newline
        if needed.

      - lineno: The line number within the DocTest string containing
        this Example where the Example begins.  This line number is
        zero-based, with respect to the beginning of the DocTest.

      - indent: The example's indentation in the DocTest string.
        I.e., the number of space characters that precede the
        example's first prompt.

      - options: A dictionary mapping from option flags to True or
        False, which is used to override default options for this
        example.  Any option flags not contained in this dictionary
        are left at their default value (as specified by the
        DocTestRunner's optionflags).  By default, no options are set.
    Nr"cCsv|�d�s|d7}|r(|�d�s(|d7}|dk	rB|�d�sB|d7}||_||_||_||_|dkrfi}||_||_dSrh)ri�sourcerx�linenor^�options�exc_msg)rjr�rxr�r�r^r�r,r,r-r��s
zExample.__init__cCs\t|�t|�k	rtS|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkSrl)�type�NotImplementedr�rxr�r^r�r��rj�otherr,r,r-�__eq__�s
�
�
�
�
�zExample.__eq__cCst|j|j|j|j|jf�Srl)�hashr�rxr�r^r�r�r,r,r-�__hash__�s�zExample.__hash__)Nr"r"N)r6rprqr�r�r�r�r,r,r,r-r�s"�
c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rae
    A collection of doctest examples that should be run in a single
    namespace.  Each `DocTest` defines the following attributes:

      - examples: the list of examples.

      - globs: The namespace (aka globals) that the examples should
        be run in.

      - name: A name identifying the DocTest (typically, the name of
        the object whose docstring this DocTest was extracted from).

      - filename: The name of the file that this DocTest was extracted
        from, or `None` if the filename is unknown.

      - lineno: The line number within filename where this DocTest
        begins, or `None` if the line number is unavailable.  This
        line number is zero-based, with respect to the beginning of
        the file.

      - docstring: The string that the examples were extracted from,
        or `None` if the string is unavailable.
    cCs>t|t�rtd��||_||_|��|_||_||_||_	dS)z�
        Create a new DocTest containing the given examples.  The
        DocTest's globals are initialized with a copy of `globs`.
        z8DocTest no longer accepts str; use DocTestParser insteadN)
r9r:ru�examples�	docstring�copyr1r+rTr�)rjr�r1r+rTr�r�r,r,r-r�s�
zDocTest.__init__cCsRt|j�dkrd}n"t|j�dkr(d}ndt|j�}d|jj|j|j|j|fS)Nr"zno examplesr&z	1 examplez%d examplesz<%s %s from %s:%s (%s)>)r)r��	__class__r6r+rTr�)rjr�r,r,r-�__repr__s��zDocTest.__repr__cCs\t|�t|�k	rtS|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkSrl)r�r�r�r�r1r+rTr�r�r,r,r-r�)s
�
�
�
�
�zDocTest.__eq__cCst|j|j|j|jf�Srl)r�r�r+rTr�r�r,r,r-r�4szDocTest.__hash__cCs:t|t�stS|j|j|jt|�f|j|j|jt|�fkSrl)r9rr�r+rTr��idr�r,r,r-�__lt__8s

�zDocTest.__lt__N)	r6rprqr�r�r�r�r�r�r,r,r,r-r�sc@s�eZdZdZe�dejejB�Ze�dejejBej	B�Z
e�d�jZddd�Z
dd	�Zdd
d�Zdd
�Ze�dej�Zdd�Ze�dej�Zdd�Zdd�Zdd�ZdS)rzD
    A class used to parse strings containing doctest examples.
    a�
        # Source consists of a PS1 line followed by zero or more PS2 lines.
        (?P<source>
            (?:^(?P<indent> [ ]*) >>>    .*)    # PS1 line
            (?:\n           [ ]*  \.\.\. .*)*)  # PS2 lines
        \n?
        # Want consists of any non-blank lines that do not start with PS1.
        (?P<want> (?:(?![ ]*$)    # Not a blank line
                     (?![ ]*>>>)  # Not a line starting with PS1
                     .+$\n?       # But any other line
                  )*)
        a�
        # Grab the traceback header.  Different versions of Python have
        # said different things on the first traceback line.
        ^(?P<hdr> Traceback\ \(
            (?: most\ recent\ call\ last
            |   innermost\ last
            ) \) :
        )
        \s* $                # toss trailing whitespace on the header.
        (?P<stack> .*?)      # don't blink: absorb stuff until...
        ^ (?P<msg> \w+ .*)   #     a line *starts* with alphanum.
        z^[ ]*(#.*)?$�<string>c
s|��}|�|���dkr8d��fdd�|�d�D��}g}d\}}|j�|�D]�}|�|||����||�d||���7}|�	|||�\}}}	}
|�
|�s�|�t||	|
|�t|�
d��|d��||�d|��|���7}|��}qP|�||d��|S)	a=
        Divide the given string into examples and intervening text,
        and return them as a list of alternating Examples and strings.
        Line numbers for the Examples are 0-based.  The optional
        argument `name` is a name identifying this string, and is only
        used for error messages.
        r"rFcsg|]}|�d��qSrlr,��.0�l�Z
min_indentr,r-�
<listcomp>sz'DocTestParser.parse.<locals>.<listcomp>�r"r"r^)r�r^r�N)�
expandtabs�_min_indentr�rt�_EXAMPLE_RE�finditer�appendr��count�_parse_example�_IS_BLANK_OR_COMMENTrr)�groupr�)rj�stringr+�outputZcharnor��mr�r�rxr�r,r�r-�parsess*
�

�
zDocTestParser.parsecCst|�||�|||||�S)a"
        Extract all doctest examples from the given string, and
        collect them into a `DocTest` object.

        `globs`, `name`, `filename`, and `lineno` are attributes for
        the new `DocTest` object.  See the documentation for `DocTest`
        for more information.
        )r�get_examples)rjr�r1r+rTr�r,r,r-�get_doctest�s	�zDocTestParser.get_doctestcCsdd�|�||�D�S)a�
        Extract all doctest examples from the given string, and return
        them as a list of `Example` objects.  Line numbers are
        0-based, because it's most common in doctests that nothing
        interesting appears on the same line as opening triple-quote,
        and so the first interesting line is called "line 1" then.

        The optional argument `name` is a name identifying this
        string, and is only used for error messages.
        cSsg|]}t|t�r|�qSr,)r9r)r��xr,r,r-r��s
�z.DocTestParser.get_examples.<locals>.<listcomp>)r�)rjr�r+r,r,r-r��szDocTestParser.get_examplesc
s
t|�d���|�d��d�}|�|�||�|�|dd�d�d||�d��fdd	�|D��}|�d
�}|�d�}t|�dkr�t�d|d�r�|d=|�|d�||t|��d��fd
d	�|D��}|j�|�}|r�|�d�}nd}|�	|||�}	||	||fS)a�
        Given a regular expression match from `_EXAMPLE_RE` (`m`),
        return a pair `(source, want)`, where `source` is the matched
        example's source code (with prompts and indentation stripped);
        and `want` is the example's expected output (with indentation
        stripped).

        `name` is the string's name, and `lineno` is the line number
        where the example starts; both are used for error messages.
        r^r�rFr&NrZr�csg|]}|�dd��qS)rYNr,)r�Zsl�r^r,r-r��sz0DocTestParser._parse_example.<locals>.<listcomp>rxz *$rrcsg|]}|�d��qSrlr,)r�Zwlr�r,r-r��sr�)
r)r�rt�_check_prompt_blank�
_check_prefixr�r[�match�
_EXCEPTION_RE�
_find_options)
rjr�r+r��source_linesr�rx�
want_linesr�r�r,r�r-r��s& 


�zDocTestParser._parse_examplez#\s*doctest:\s*([^\n\'"]*)$c	Cs�i}|j�|�D]v}|�d��dd���}|D]V}|ddksN|dd�tkrdtd|d||f��t|dd�}|ddk||<q.q|r�|�|�r�td	|||f��|S)
a
        Return a dictionary containing option overrides extracted from
        option directives in the given source string.

        `name` is the string's name, and `lineno` is the line number
        where the example starts; both are used for error messages.
        r&�,rZr"z+-Nz7line %r of the doctest for %s has an invalid option: %r�+zSline %r of the doctest for %s has an option directive on a line with no example: %r)�_OPTION_DIRECTIVE_REr�r�rGrtr'r�r�)	rjr�r+r�r�r�Zoption_strings�option�flagr,r,r-r��s"���zDocTestParser._find_optionsz
^([ ]*)(?=\S)cCs2dd�|j�|�D�}t|�dkr*t|�SdSdS)z;Return the minimum indentation of any non-blank line in `s`cSsg|]}t|��qSr,)r))r�r^r,r,r-r�
sz-DocTestParser._min_indent.<locals>.<listcomp>r"N)�
_INDENT_RE�findallr)�min)rjr]�indentsr,r,r-r�szDocTestParser._min_indentc	Cs^t|�D]P\}}t|�|dkr||ddkrtd||d||||d�|f��qdS)a

        Given the lines of a source string (including prompts and
        leading indentation), check to make sure that every prompt is
        followed by a space character.  If any line is not followed by
        a space character, then raise ValueError.
        rYrKrZz8line %r of the docstring for %s lacks blank after %s: %rr&N)�	enumerater)r�)rj�linesr^r+r�r�r�r,r,r-r�s ��z!DocTestParser._check_prompt_blankcCs>t|�D]0\}}|r|�|�std||d||f��qdS)z�
        Check that every line in the given list starts with the given
        prefix; if any line does not, then raise a ValueError.
        zGline %r of the docstring for %s has inconsistent leading whitespace: %rr&N)r�rvr�)rjr��prefixr+r�r�r�r,r,r-r�s
�zDocTestParser._check_prefixN)r�)r�)r6rprqr�r[�compile�	MULTILINE�VERBOSEr��DOTALLr�r�r�r�r�r�r�r�r�r�r�r�r�r,r,r,r-rCs(
��
'
3�c@sNeZdZdZde�ddfdd�Zddd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)ra<
    A class used to extract the DocTests that are relevant to a given
    object, from its docstring and the docstrings of its contained
    objects.  Doctests can currently be extracted from the following
    object types: modules, functions, classes, methods, staticmethods,
    classmethods, and properties.
    FTcCs||_||_||_||_dS)at
        Create a new doctest finder.

        The optional argument `parser` specifies a class or
        function that should be used to create new DocTest objects (or
        objects that implement the same interface as DocTest).  The
        signature for this factory function should match the signature
        of the DocTest constructor.

        If the optional argument `recurse` is false, then `find` will
        only examine the given object, and not any contained objects.

        If the optional argument `exclude_empty` is false, then `find`
        will include tests for objects with empty docstrings.
        N)�_parser�_verbose�_recurse�_exclude_empty)rj�verbose�parser�recurse�
exclude_emptyr,r,r-r�7szDocTestFinder.__init__Nc		CsN|dkr.t|dd�}|dkr.tdt|�f��|dkr<d}n|dkrNt�|�}zt�|�}Wntk
rtd}YndX|s�t�|�}|d|dd�dks�d}|dkr�d}n*|dk	r�t�	||j
�}n
t�	|�}|s�d}|dkr�|dkr�i}n
|j
��}n|��}|dk	�r|�|�d|k�r(d|d<g}|�
||||||i�|��|S)	aj
        Return a list of the DocTests that are defined by the given
        object's docstring, or by any of its contained objects'
        docstrings.

        The optional parameter `module` is the module that contains
        the given object.  If the module is not specified or is None, then
        the test finder will attempt to automatically determine the
        correct module.  The object's module is used:

            - As a default namespace, if `globs` is not specified.
            - To prevent the DocTestFinder from extracting DocTests
              from objects that are imported from other modules.
            - To find the name of the file containing the object.
            - To help find the line number of the object within its
              file.

        Contained objects whose module does not match `module` are ignored.

        If `module` is False, no attempt to find the module will be made.
        This is obscure, of use mostly in tests:  if `module` is False, or
        is None but cannot be found automatically, then all objects are
        considered to belong to the (non-existent) module, so all contained
        objects will (recursively) be searched for doctests.

        The globals for each DocTest is formed by combining `globs`
        and `extraglobs` (bindings in `extraglobs` override bindings
        in `globs`).  A new copy of the globals dictionary is created
        for each DocTest.  If `globs` is not specified, then it
        defaults to the module's `__dict__`, if specified, or {}
        otherwise.  If `extraglobs` is not specified, then it defaults
        to {}.

        Nr6zJDocTestFinder.find: name must be given when obj.__name__ doesn't exist: %rFr"���z<]>r�)r0r�r�r7�	getmoduleZ
getsourcefilerBZgetfile�	linecache�getlines�__dict__r��update�_find�sort)	rj�objr+rCr1�
extraglobsr`r��testsr,r,r-rwMsL$�






zDocTestFinder.findcCs�|dkrdSt�|�dk	r(|t�|�kSt�|�r>|j|jkSt�|�r|t|d�r\|jj}nt|d�rn|j}ndS|j	|kSt�
|�r�|j	|jkSt|d�r�|j	|jkSt|t�r�dSt
d��dS)zY
        Return true if the given object is defined in the given
        module.
        NT�__objclass__rpz"object must be a class or function)r7r��
isfunctionr��__globals__ZismethoddescriptorrPr�rpr6�isclassr9�propertyr�)rjrC�objectZobj_modr,r,r-�_from_module�s(








zDocTestFinder._from_modulec
Cs|jrtd|�t|�|kr"dSd|t|�<|�|||||�}|dk	rR|�|�t�|�r�|jr�|j�	�D]P\}	}
d||	f}	t�
t�|
��s�t�|
�rl|�
||
�rl|�||
|	||||�qlt�|��rn|j�rnt|di��	�D]�\}	}
t|	t��stdt|	�f��t�
|
��sJt�|
��sJt�|
��sJt|
t��sJtdt|
�f��d||	f}	|�||
|	||||�q�t�|��r|j�r|j�	�D]�\}	}
t|
t��r�t||	�}
t|
t��r�t||	�j}
t�
|
��s�t�|
��s�t|
t��r�|�
||
��r�d||	f}	|�||
|	||||��q�dS)	zm
        Find tests for the given object and any contained objects, and
        add them to `tests`.
        zFinding tests in %sNr&z%s.%s�__test__z5DocTestFinder.find: __test__ keys must be strings: %rz`DocTestFinder.find: __test__ values must be strings, functions, methods, classes, or modules: %rz%s.__test__.%s)r��printr��	_get_testr�r7r8r�r��itemsZ	isroutineZunwraprrr�r0r9r:r�r��staticmethod�classmethod�__func__r)rjr�r�r+rCr�r1�seen�testZvalname�valr,r,r-r��sn
�
�������
�
��zDocTestFinder._findc		Cs�t|t�r|}nJz,|jdkr"d}n|j}t|t�s:t|�}Wnttfk
rXd}YnX|�||�}|jrt|stdS|dkr�d}n.t|dd�p�|j}|dd�dkr�|dd�}|j	�
|||||�S)zs
        Return a DocTest for the given object, if it defines a docstring;
        otherwise, return None.
        Nr�r�����.pycrr)r9r:r�rB�AttributeError�_find_linenor�r0r6r�r�)	rjr�r+rCr1r�r�r�rTr,r,r-rs,




�zDocTestFinder._get_testcCsd}t�|�rd}t�|�rb|dkr(dSt�dt|dd��}t|�D]\}}|�|�rF|}qbqFt�|�rr|j	}t�
|�r�|j}t�|�r�|j
}t�|�r�|j}t�|�r�t|dd�d}|dk	�r
|dkr�|dSt�d�}t|t|��D]}|�||�r�|Sq�dS)	z�
        Return a line number of the given object's docstring.  Note:
        this method assumes that the object has a docstring.
        Nr"z^\s*class\s*%s\br6�-�co_firstlinenor&z(^|.*:)\s*\w*("|\'))r7r8rr[r�r0r�r�Zismethodr
r��__code__Zistraceback�tb_frameZisframe�f_codeZiscode�ranger))rjr�r�r�Zpatr�r�r,r,r-r4s>


�








zDocTestFinder._find_lineno)NNNN)r6rprqr�rr�rwrr�rrr,r,r,r-r.s�

f?&c@s�eZdZdZdZddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Ze
�d�Zd dd�Zd!dd�Zd"dd�Zdd�ZdS)#ra3	
    A class used to run DocTest test cases, and accumulate statistics.
    The `run` method is used to process a single DocTest case.  It
    returns a tuple `(f, t)`, where `t` is the number of test cases
    tried, and `f` is the number of test cases that failed.

        >>> tests = DocTestFinder().find(_TestClass)
        >>> runner = DocTestRunner(verbose=False)
        >>> tests.sort(key = lambda test: test.name)
        >>> for test in tests:
        ...     print(test.name, '->', runner.run(test))
        _TestClass -> TestResults(failed=0, attempted=2)
        _TestClass.__init__ -> TestResults(failed=0, attempted=2)
        _TestClass.get -> TestResults(failed=0, attempted=2)
        _TestClass.square -> TestResults(failed=0, attempted=1)

    The `summarize` method prints a summary of all the test cases that
    have been run by the runner, and returns an aggregated `(f, t)`
    tuple:

        >>> runner.summarize(verbose=1)
        4 items passed all tests:
           2 tests in _TestClass
           2 tests in _TestClass.__init__
           2 tests in _TestClass.get
           1 tests in _TestClass.square
        7 tests in 4 items.
        7 passed and 0 failed.
        Test passed.
        TestResults(failed=0, attempted=7)

    The aggregated number of tried examples and failed examples is
    also available via the `tries` and `failures` attributes:

        >>> runner.tries
        7
        >>> runner.failures
        0

    The comparison between expected outputs and actual outputs is done
    by an `OutputChecker`.  This comparison may be customized with a
    number of option flags; see the documentation for `testmod` for
    more information.  If the option flags are insufficient, then the
    comparison may also be customized by passing a subclass of
    `OutputChecker` to the constructor.

    The test runner's display output can be controlled in two ways.
    First, an output function (`out) can be passed to
    `TestRunner.run`; this function will be called with strings that
    should be displayed.  It defaults to `sys.stdout.write`.  If
    capturing the output is not sufficient, then the display output
    can be also customized by subclassing DocTestRunner, and
    overriding the methods `report_start`, `report_success`,
    `report_unexpected_exception`, and `report_failure`.
    zF**********************************************************************Nr"cCsN|pt�|_|dkrdtjk}||_||_||_d|_d|_i|_	t
�|_dS)ac
        Create a new test runner.

        Optional keyword arg `checker` is the `OutputChecker` that
        should be used to compare the expected outputs and actual
        outputs of doctest examples.

        Optional keyword arg 'verbose' prints lots of stuff if true,
        only failures if false; by default, it's true iff '-v' is in
        sys.argv.

        Optional argument `optionflags` can be used to control how the
        test runner compares expected output to actual output, and how
        it displays failures.  See the documentation for `testmod` for
        more information.
        N�-vr")r�_checkerr>r�r��optionflags�original_optionflags�tries�failures�_name2ftrg�_fakeout)rj�checkerr�rr,r,r-r��s
zDocTestRunner.__init__cCsH|jrD|jr.|dt|j�dt|j��n|dt|j�d�dS)z�
        Report that the test runner is about to process the given
        example.  (Only displays a message if verbose=True)
        zTrying:
zExpecting:
zExpecting nothing
N)r�rxr_r�)rjr�r�exampler,r,r-�report_start�s���zDocTestRunner.report_startcCs|jr|d�dS)zt
        Report that the given example ran successfully.  (Only
        displays a message if verbose=True)
        zok
N)r��rjr�rr!ryr,r,r-�report_success�szDocTestRunner.report_successcCs&||�||�|j�|||j��dS)z7
        Report that the given example failed.
        N)�_failure_headerr�output_differencerr#r,r,r-�report_failure�s�zDocTestRunner.report_failurecCs$||�||�dtt|���dS)zO
        Report that the given example raised an unexpected exception.
        zException raised:
N)r%r_rf�rjr�rr!rdr,r,r-�report_unexpected_exception�s
�
�z)DocTestRunner.report_unexpected_exceptioncCs�|jg}|jrR|jdk	r4|jdk	r4|j|jd}nd}|�d|j||jf�n|�d|jd|jf�|�d�|j}|�t|��d�|�S)Nr&�?zFile "%s", line %s, in %szLine %s, in %szFailed example:rF)�DIVIDERrTr�r�r+r�r_r�)rjrr!r�r�r�r,r,r-r%�s�
zDocTestRunner._failure_headerc	Cs�d}}|j}td�\}}}	|jj}
t|j�D�]H\}}|jt@oH|dk}
||_|jr�|j��D],\}}|r||j|O_q`|j|M_q`|jt	@r�q.|d7}|
s�|�
|||�d|j|f}z,tt
|j|d|d�|j�|j��d}Wn4tk
�r�Ynt��}|j��YnX|j��}|j�d�|}|dk�r`|
|j||j��r�|}n|tj|dd��d}|
�s�|t|�7}|jdk�r�|	}nB|
|j||j��r�|}n*|jt@�r�|
t|j�t|�|j��r�|}||k�r�|
�sd|�||||�nf||k�r(|
�s|� ||||�|d7}n<||	k�rR|
�sH|�!||||�|d7}nd	�sdt"d
|f��|r.|jt#@r.�qzq.||_|�$|||�t%||�S)a�
        Run the examples in `test`.  Write the outcome of each example
        with one of the `DocTestRunner.report_*` methods, using the
        writer function `out`.  `compileflags` is the set of compiler
        flags that should be used to execute examples.  Return a tuple
        `(f, t)`, where `t` is the number of examples tried, and `f`
        is the number of examples that failed.  The examples are run
        in the namespace `test.globs`.
        r"rKr&z<doctest %s[%d]>ZsingleNr4rrFzunknown outcome)&rrr�check_outputr�r�rr�rrr"r+�execr�r�r1�debuggerr��KeyboardInterruptr>rdrrcrnrxra�format_exception_onlyrfr�rr�r$r'r)rur�_DocTestRunner__record_outcomer%)rjr�compileflagsr�rrr�SUCCESS�FAILUREZBOOMZcheck�
examplenumr!�quietZ
optionflagr
rTZ	exceptionryZoutcomer�r,r,r-Z__run�s�
�
��



�




�
zDocTestRunner.__runcCsL|j�|jd�\}}||||f|j|j<|j|7_|j|7_dS)z{
        Record the fact that the given DocTest (`test`) generated `f`
        failures out of `t` tried examples.
        r�N)rr/r+rr)rjrrW�t�f2�t2r,r,r-Z__record_outcome|szDocTestRunner.__record_outcomez.<doctest (?P<name>.+)\[(?P<examplenum>\d+)\]>$cCsV|j�|�}|rF|�d�|jjkrF|jjt|�d��}|jjdd�S|�	||�SdS)Nr+r5T��keepends)
�%_DocTestRunner__LINECACHE_FILENAME_REr�r�rr+r��intr��
splitlines�save_linecache_getlines)rjrT�module_globalsr�r!r,r,r-Z__patched_linecache_getlines�s
z*DocTestRunner.__patched_linecache_getlinesTc		s||_|dkrt|j�}tj�|dkrV�j��dks@���dkrH�j}n��fdd�}|jt_t�	�}t
j}t��|_
|j
��|j
jt
_tj|_|jt_tj}tjt_z|�|||�W�S�t_|t
_t�|�|jt_|t_|�r�|j��ddl}d|_XdS)aJ
        Run the examples in `test`, and display the results using the
        writer function `out`.

        The examples are run in the namespace `test.globs`.  If
        `clear_globs` is true (the default), then this namespace will
        be cleared after the test runs, to help with garbage
        collection.  If you would like to examine the namespace after
        the test completes, then use `clear_globs=False`.

        `compileflags` gives the set of flags that should be used by
        the Python compiler when running the examples.  If not
        specified, then it will default to the set of future-import
        flags that apply to `globs`.

        The output of each example is checked using
        `DocTestRunner.check_output`, and the results are formatted by
        the `DocTestRunner.report_*` methods.
        N�utf-8cs t|��d���}��|�dS)N�backslashreplace)r:�encode�write)r]�rNr�r,r-r��szDocTestRunner.run.<locals>.outr")rr3r1r>r�rN�lowerrDr�gettracer�r�r�r.�resetr�r�r?�*_DocTestRunner__patched_linecache_getlines�displayhook�__displayhook__�settrace�clear�builtins�_�_DocTestRunner__run)	rjrr2r��clear_globsZ
save_traceZsave_set_traceZsave_displayhookrNr,rEr-�run�s<





zDocTestRunner.runc
Cs�|dkr|j}g}g}g}d}}|j��D]b}|\}\}	}
|	|
ksHt�||
7}||	7}|
dkrl|�|�q,|	dkr�|�||
f�q,|�|�q,|r�|r�tt|�d�|��|D]}td|�q�|r�tt|�d�|��|D]\}}td||f�q�|�rFt|j�tt|�d�|��|D] \}\}	}
td|	|
|f��q$|�rrt|d	t|j�d
�t||d|d�|�r�td
|d�n|�r�td�t	||�S)a�
        Print a summary of all the test cases that have been run by
        this DocTestRunner, and return a tuple `(f, t)`, where `f` is
        the total number of failed examples, and `t` is the total
        number of tried examples.

        The optional `verbose` argument controls how detailed the
        summary is.  If the verbosity is not specified, then the
        DocTestRunner's verbosity is used.
        Nr"zitems had no tests:z   zitems passed all tests:z %3d tests in %szitems had failures:z %3d of %3d in %sztests inzitems.z
passed andzfailed.z***Test Failed***z	failures.zTest passed.)
r�rrrur�rr)r�r+r%)
rjr�ZnotestsZpassedZfailedZtotaltZtotalfr�r+rWr7�thingr�r,r,r-�	summarize�sR
zDocTestRunner.summarizecCsR|j}|j��D]<\}\}}||kr@||\}}||}||}||f||<qdSrl)rr)rjr��dr+rWr7r8r9r,r,r-�mergeszDocTestRunner.merge)NNr")N)NNT)N)r6rprqr�r+r�r"r$r'r)r%rPr1r[r�r<rIrRrTrVr,r,r,r-rhs9
$
}



I
9c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)ra_
    A class used to check the whether the actual output from a doctest
    example matches the expected output.  `OutputChecker` defines two
    methods: `check_output`, which compares a given pair of outputs,
    and returns true if they match; and `output_difference`, which
    returns a string describing the differences between two outputs.
    cCst|�dd�d�S)z=
        Convert string to hex-escaped ASCII string.
        �ASCIIrB)r:rC)rjr]r,r,r-�_toAscii(szOutputChecker._toAsciicCs�|�|�}|�|�}||kr dS|t@sH||fdkr8dS||fdkrHdS|t@s�t�dt�t�d|�}t�dd|�}||kr�dS|t@r�d�|�	��}d�|�	��}||kr�dS|t
@r�t||�r�dSdS)	a�
        Return True iff the actual output from an example (`got`)
        matches the expected output (`want`).  These strings are
        always considered to match if they are identical; but
        depending on what option flags the test runner is using,
        several non-exact match types are also possible.  See the
        documentation for `TestRunner` for more information about
        option flags.
        T)zTrue
z1
)zFalse
z0
z(?m)^%s\s*?$r�z(?m)^[^\S\n]+$rZF)rXrrr[r\�escape�BLANKLINE_MARKERrr�rtrr}�rjrxryrr,r,r-r,.s4

�
zOutputChecker.check_outputcCs<|ttBtB@sdS|t@r dS|�d�dko:|�d�dkS)NFTrFr4)r	r
rr�r[r,r,r-�_do_a_fancy_diffms��zOutputChecker._do_a_fancy_diffc
Cs8|j}|t@st�dt|�}|�|||�r�|jdd�}|jdd�}|t@rptj	||dd�}t
|�dd�}d}nf|t@r�tj||dd�}t
|�dd�}d}n8|t
@r�tjtjd	�}	t
|	�||��}d
}nds�td��d
|td�|��S|�r|�rdt|�t|�fS|�rdt|�S|�r0dt|�SdSdS)z�
        Return a string describing the differences between the
        expected output for a given example (`example`) and the actual
        output (`got`).  `optionflags` is the set of option flags used
        to compare `want` and `got`.
        z(?m)^[ ]*(?=
)Tr:r4)�nNz#unified diff with -expected +actualz-context diff with expected followed by actual)Zcharjunkzndiff with -expected +actualr"zBad diff optionzDifferences (%s):
r�zExpected:
%sGot:
%szExpected:
%sGot nothing
zExpected nothing
Got:
%szExpected nothing
Got nothing
)rxrr[r\rZr\r>r	�difflibZunified_diff�listr
Zcontext_diffrZDifferZIS_CHARACTER_JUNKZcomparerur_r�)
rjr!ryrrxr�Z	got_linesZdiffZkindZenginer,r,r-r&�s6zOutputChecker.output_differenceN)r6rprqr�rXr,r\r&r,r,r,r-r s
?c@s eZdZdZdd�Zdd�ZdS)rz�A DocTest example has failed in debugging mode.

    The exception instance has variables:

    - test: the DocTest object being run

    - example: the Example object that failed

    - got: the actual output
    cCs||_||_||_dSrl)rr!ry)rjrr!ryr,r,r-r��szDocTestFailure.__init__cCs
t|j�Srl�r:rr�r,r,r-�__str__�szDocTestFailure.__str__N�r6rprqr�r�rar,r,r,r-r�s
c@s eZdZdZdd�Zdd�ZdS)rz�A DocTest example has encountered an unexpected exception

    The exception instance has variables:

    - test: the DocTest object being run

    - example: the Example object that failed

    - exc_info: the exception info
    cCs||_||_||_dSrl)rr!rd)rjrr!rdr,r,r-r��szUnexpectedException.__init__cCs
t|j�Srlr`r�r,r,r-ra�szUnexpectedException.__str__Nrbr,r,r,r-r�s
c@s*eZdZdZd
dd�Zdd�Zdd	�ZdS)ra�	Run doc tests but raise an exception as soon as there is a failure.

       If an unexpected exception occurs, an UnexpectedException is raised.
       It contains the test, the example, and the original exception:

         >>> runner = DebugRunner(verbose=False)
         >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42',
         ...                                    {}, 'foo', 'foo.py', 0)
         >>> try:
         ...     runner.run(test)
         ... except UnexpectedException as f:
         ...     failure = f

         >>> failure.test is test
         True

         >>> failure.example.want
         '42\n'

         >>> exc_info = failure.exc_info
         >>> raise exc_info[1] # Already has the traceback
         Traceback (most recent call last):
         ...
         KeyError

       We wrap the original exception to give the calling application
       access to the test and example information.

       If the output doesn't match, then a DocTestFailure is raised:

         >>> test = DocTestParser().get_doctest('''
         ...      >>> x = 1
         ...      >>> x
         ...      2
         ...      ''', {}, 'foo', 'foo.py', 0)

         >>> try:
         ...    runner.run(test)
         ... except DocTestFailure as f:
         ...    failure = f

       DocTestFailure objects provide access to the test:

         >>> failure.test is test
         True

       As well as to the example:

         >>> failure.example.want
         '2\n'

       and the actual output:

         >>> failure.got
         '1\n'

       If a failure or error occurs, the globals are left intact:

         >>> del test.globs['__builtins__']
         >>> test.globs
         {'x': 1}

         >>> test = DocTestParser().get_doctest('''
         ...      >>> x = 2
         ...      >>> raise KeyError
         ...      ''', {}, 'foo', 'foo.py', 0)

         >>> runner.run(test)
         Traceback (most recent call last):
         ...
         doctest.UnexpectedException: <DocTest foo from foo.py:0 (2 examples)>

         >>> del test.globs['__builtins__']
         >>> test.globs
         {'x': 2}

       But the globals are cleared if there is no error:

         >>> test = DocTestParser().get_doctest('''
         ...      >>> x = 2
         ...      ''', {}, 'foo', 'foo.py', 0)

         >>> runner.run(test)
         TestResults(failed=0, attempted=1)

         >>> test.globs
         {}

       NTcCs$t�||||d�}|r |j��|S)NF)rrRr1rM)rjrr2r�rQ�rr,r,r-rR3s
zDebugRunner.runcCst|||��dSrl)rr(r,r,r-r)9sz'DebugRunner.report_unexpected_exceptioncCst|||��dSrl)rr#r,r,r-r'<szDebugRunner.report_failure)NNT)r6rprqr�rRr)r'r,r,r,r-r�sZ
TFc	Cs�|dkrtj�d�}t�|�s,td|f��|dkr:|j}t|d�}	|rVt||d�}
nt	||d�}
|	j
||||d�D]}|
�|�qt|r�|
��t
dkr�|
a
n
t
�|
�t|
j|
j�S)a*
m=None, name=None, globs=None, verbose=None, report=True,
       optionflags=0, extraglobs=None, raise_on_error=False,
       exclude_empty=False

    Test examples in docstrings in functions and classes reachable
    from module m (or the current module if m is not supplied), starting
    with m.__doc__.

    Also test examples reachable from dict m.__test__ if it exists and is
    not None.  m.__test__ maps names to functions, classes and strings;
    function and class docstrings are tested even if the name is private;
    strings are tested directly, as if they were docstrings.

    Return (#failures, #tests).

    See help(doctest) for an overview.

    Optional keyword arg "name" gives the name of the module; by default
    use m.__name__.

    Optional keyword arg "globs" gives a dict to be used as the globals
    when executing examples; by default, use m.__dict__.  A copy of this
    dict is actually used for each docstring, so that each docstring's
    examples start with a clean slate.

    Optional keyword arg "extraglobs" gives a dictionary that should be
    merged into the globals that are used to execute examples.  By
    default, no extra globals are used.  This is new in 2.4.

    Optional keyword arg "verbose" prints lots of stuff if true, prints
    only failures if false; by default, it's true iff "-v" is in sys.argv.

    Optional keyword arg "report" prints a summary at the end when true,
    else prints nothing at the end.  In verbose mode, the summary is
    detailed, else very brief (in fact, empty if all tests passed).

    Optional keyword arg "optionflags" or's together module constants,
    and defaults to 0.  This is new in 2.3.  Possible values (see the
    docs for details):

        DONT_ACCEPT_TRUE_FOR_1
        DONT_ACCEPT_BLANKLINE
        NORMALIZE_WHITESPACE
        ELLIPSIS
        SKIP
        IGNORE_EXCEPTION_DETAIL
        REPORT_UDIFF
        REPORT_CDIFF
        REPORT_NDIFF
        REPORT_ONLY_FIRST_FAILURE

    Optional keyword arg "raise_on_error" raises an exception on the
    first unexpected exception or failure. This allows failures to be
    post-mortem debugged.

    Advanced tomfoolery:  testmod runs methods of a local instance of
    class doctest.Tester, then merges the results into (or creates)
    global Tester instance doctest.master.  Methods of doctest.master
    can be called directly too, if you want to do something unusual.
    Passing report=0 to testmod is especially useful then, to delay
    displaying a summary.  Invoke doctest.master.summarize(verbose)
    when you're done fiddling.
    Nr�ztestmod: module required; %r)r��r�r�r1r�)r>r?r/r7r8rBr6rrrrwrRrT�masterrVr%rr)r�r+r1r��reportrr��raise_on_errorr��finder�runnerrr,r,r-rHs$E


cCs�|r|std��t||||pd�\}}|dkr:tj�|�}|dkrHi}n|��}|dk	rb|�|�d|krrd|d<|	r�t||d�}
nt||d�}
|
�	||||d�}|
�
|�|r�|
��tdkr�|
an
t�
|
�t|
j|
j�S)a


    Test examples in the given file.  Return (#failures, #tests).

    Optional keyword arg "module_relative" specifies how filenames
    should be interpreted:

      - If "module_relative" is True (the default), then "filename"
         specifies a module-relative path.  By default, this path is
         relative to the calling module's directory; but if the
         "package" argument is specified, then it is relative to that
         package.  To ensure os-independence, "filename" should use
         "/" characters to separate path segments, and should not
         be an absolute path (i.e., it may not begin with "/").

      - If "module_relative" is False, then "filename" specifies an
        os-specific path.  The path may be absolute or relative (to
        the current working directory).

    Optional keyword arg "name" gives the name of the test; by default
    use the file's basename.

    Optional keyword argument "package" is a Python package or the
    name of a Python package whose directory should be used as the
    base directory for a module relative filename.  If no package is
    specified, then the calling module's directory is used as the base
    directory for module relative filenames.  It is an error to
    specify "package" if "module_relative" is False.

    Optional keyword arg "globs" gives a dict to be used as the globals
    when executing examples; by default, use {}.  A copy of this dict
    is actually used for each docstring, so that each docstring's
    examples start with a clean slate.

    Optional keyword arg "extraglobs" gives a dictionary that should be
    merged into the globals that are used to execute examples.  By
    default, no extra globals are used.

    Optional keyword arg "verbose" prints lots of stuff if true, prints
    only failures if false; by default, it's true iff "-v" is in sys.argv.

    Optional keyword arg "report" prints a summary at the end when true,
    else prints nothing at the end.  In verbose mode, the summary is
    detailed, else very brief (in fact, empty if all tests passed).

    Optional keyword arg "optionflags" or's together module constants,
    and defaults to 0.  Possible values (see the docs for details):

        DONT_ACCEPT_TRUE_FOR_1
        DONT_ACCEPT_BLANKLINE
        NORMALIZE_WHITESPACE
        ELLIPSIS
        SKIP
        IGNORE_EXCEPTION_DETAIL
        REPORT_UDIFF
        REPORT_CDIFF
        REPORT_NDIFF
        REPORT_ONLY_FIRST_FAILURE

    Optional keyword arg "raise_on_error" raises an exception on the
    first unexpected exception or failure. This allows failures to be
    post-mortem debugged.

    Optional keyword arg "parser" specifies a DocTestParser (or
    subclass) that should be used to extract tests from the files.

    Optional keyword arg "encoding" specifies an encoding that should
    be used to convert the file to unicode.

    Advanced tomfoolery:  testmod runs methods of a local instance of
    class doctest.Tester, then merges the results into (or creates)
    global Tester instance doctest.master.  Methods of doctest.master
    can be called directly too, if you want to do something unusual.
    Passing report=0 to testmod is especially useful then, to delay
    displaying a summary.  Invoke doctest.master.summarize(verbose)
    when you're done fiddling.
    �8Package may only be specified for module-relative paths.rANr6r�rdr")r�rXr�r��basenamer�r�rrr�rRrTrfrVr%rr)rTrVr+rUr1r�rgrr�rhr�rN�textrjrr,r,r-r�s2R�


�NoNamec	Cs@t|dd�}t||d�}|j|||d�D]}|j||d�q(dS)ar
    Test examples in the given object's docstring (`f`), using `globs`
    as globals.  Optional argument `name` is used in failure messages.
    If the optional argument `verbose` is true, then generate output
    even if there are no failures.

    `compileflags` gives the set of flags that should be used by the
    Python compiler when running the examples.  If not specified, then
    it will default to the set of future-import flags that apply to
    `globs`.

    Optional keyword arg `optionflags` specifies options for the
    testing and output.  See the documentation for `testmod` for more
    information.
    F)r�r�rd)r1)r2N)rrrwrR)	rWr1r�r+r2rrirjrr,r,r-r+scCs"|t@|krtd|��t}|a|S)a?Sets the unittest option flags.

    The old flag is returned so that a runner could restore the old
    value if it wished to:

      >>> import doctest
      >>> old = doctest._unittest_reportflags
      >>> doctest.set_unittest_reportflags(REPORT_NDIFF |
      ...                          REPORT_ONLY_FIRST_FAILURE) == old
      True

      >>> doctest._unittest_reportflags == (REPORT_NDIFF |
      ...                                   REPORT_ONLY_FIRST_FAILURE)
      True

    Only reporting flags can be set:

      >>> doctest.set_unittest_reportflags(ELLIPSIS)
      Traceback (most recent call last):
      ...
      ValueError: ('Only reporting flags allowed', 8)

      >>> doctest.set_unittest_reportflags(old) == (REPORT_NDIFF |
      ...                                   REPORT_ONLY_FIRST_FAILURE)
      True
    zOnly reporting flags allowed)r
r��_unittest_reportflags)r2�oldr,r,r-rHs

c@sleZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Ze
jZdd�ZdS)�DocTestCaser"NcCs.tj�|�||_||_||_||_||_dSrl)�unittest�TestCaser��_dt_optionflags�_dt_checker�_dt_test�	_dt_setUp�_dt_tearDown)rjrr�setUp�tearDownr r,r,r-r�nszDocTestCase.__init__cCs|j}|jdk	r|�|�dSrl)rvrw�rjrr,r,r-ryxs
zDocTestCase.setUpcCs(|j}|jdk	r|�|�|j��dSrl)rvrxr1rMr{r,r,r-rz~s

zDocTestCase.tearDowncCs~|j}tj}t�}|j}|t@s(|tO}t||jdd�}z d|_	|j
||jdd�\}}W5|t_X|rz|�|�
|�����dS)NF�rr r�zF----------------------------------------------------------------------)r�rQ)rvr>r�r#rtr
rorrur+rRrDZfailureException�format_failurerc)rjrrp�newrrjrrr,r,r-�runTest�s(��zDocTestCase.runTestcCsP|j}|jdkrd}n
d|j}d�|j�d�dd��}d|j|j|||fS)Nzunknown line numberz%sr�rrz:Failed doctest test for %s
  File "%s", line %s, in %s

%s)rvr�r�r+rtrT)rj�errrr�Zlnamer,r,r-r}�s

�zDocTestCase.format_failurecCs6|��t|j|jdd�}|j|jdd�|��dS)a�Run the test case without results and without catching exceptions

           The unit test framework includes a debug method on test cases
           and test suites to support post-mortem debugging.  The test code
           is run in such a way that errors are not caught.  This way a
           caller can catch the errors and initiate post-mortem debugging.

           The DocTestCase provides a debug method that raises
           UnexpectedException errors if there is an unexpected
           exception:

             >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42',
             ...                {}, 'foo', 'foo.py', 0)
             >>> case = DocTestCase(test)
             >>> try:
             ...     case.debug()
             ... except UnexpectedException as f:
             ...     failure = f

           The UnexpectedException contains the test, the example, and
           the original exception:

             >>> failure.test is test
             True

             >>> failure.example.want
             '42\n'

             >>> exc_info = failure.exc_info
             >>> raise exc_info[1] # Already has the traceback
             Traceback (most recent call last):
             ...
             KeyError

           If the output doesn't match, then a DocTestFailure is raised:

             >>> test = DocTestParser().get_doctest('''
             ...      >>> x = 1
             ...      >>> x
             ...      2
             ...      ''', {}, 'foo', 'foo.py', 0)
             >>> case = DocTestCase(test)

             >>> try:
             ...    case.debug()
             ... except DocTestFailure as f:
             ...    failure = f

           DocTestFailure objects provide access to the test:

             >>> failure.test is test
             True

           As well as to the example:

             >>> failure.example.want
             '2\n'

           and the actual output:

             >>> failure.got
             '1\n'

           Fr|)rQN)ryrrtrurRrvrz)rjrjr,r,r-r!�sB�zDocTestCase.debugcCs|jjSrl�rvr+r�r,r,r-r��szDocTestCase.idcCsPt|�t|�k	rtS|j|jkoN|j|jkoN|j|jkoN|j|jkoN|j|jkSrl)r�r�rvrtrwrxrur�r,r,r-r��s
�
�
�
�zDocTestCase.__eq__cCst|j|j|j|jf�Srl)r�rtrwrxrur�r,r,r-r��s�zDocTestCase.__hash__cCs,|jj�d�}d|dd�|dd��fS)Nr�z%s (%s)rr)rvr+rtr�)rjr+r,r,r-r�	szDocTestCase.__repr__cCsd|jjS)Nz	Doctest: r�r�r,r,r-�shortDescription		szDocTestCase.shortDescription)r"NNN)r6rprqr�ryrzrr}r!r�r�r�r�rrar�r,r,r,r-rqls�

H
rqc@s0eZdZdd�Zdd�Zdd�Zdd�ZeZd	S)
�SkipDocTestCasecCs||_t�|d�dSrl)rCrqr�)rjrCr,r,r-r�
	szSkipDocTestCase.__init__cCs|�d�dS)Nz-DocTestSuite will not work with -O2 and above)ZskipTestr�r,r,r-ry	szSkipDocTestCase.setUpcCsdSrlr,r�r,r,r-�	test_skip	szSkipDocTestCase.test_skipcCsd|jjS)NzSkipping tests from %s)rCr6r�r,r,r-r�	sz SkipDocTestCase.shortDescriptionN)r6rprqr�ryr�r�rar,r,r,r-r�	s
r�c@seZdZdd�ZdS)�
_DocTestSuitecCsdSrlr,)rj�indexr,r,r-�_removeTestAtIndex	sz _DocTestSuite._removeTestAtIndexN)r6rprqr�r,r,r,r-r�	sr�c	Ks�|dkrt�}t|�}|j|||d�}|sNtjjdkrNt�}|�t|��|S|�	�t�}|D]T}t
|j�dkrtq`|js�|j
}|dd�dkr�|dd�}||_|�t|f|��q`|S)a
    Convert doctest tests for a module to a unittest test suite.

    This converts each documentation string in a module that
    contains doctest tests to a unittest test case.  If any of the
    tests in a doc string fail, then the test case fails.  An exception
    is raised showing the name of the file containing the test and a
    (sometimes approximate) line number.

    The `module` argument provides the module to be tested.  The argument
    can be either a module or a module name.

    If no argument is given, the calling module is used.

    A number of options may be provided as keyword arguments:

    setUp
      A set-up function.  This is called before running the
      tests in each file. The setUp function will be passed a DocTest
      object.  The setUp function can access the test globals as the
      globs attribute of the test passed.

    tearDown
      A tear-down function.  This is called after running the
      tests in each file.  The tearDown function will be passed a DocTest
      object.  The tearDown function can access the test globals as the
      globs attribute of the test passed.

    globs
      A dictionary containing initial global variables for the tests.

    optionflags
       A set of doctest option flags expressed as an integer.
    Nrer4r"rrrr)rrDrwr>r2�optimizer��addTestr�r�r)r�rTr�rq)	rCr1r�Ztest_finderr�r��suiterrTr,r,r-r#	s(%c@s$eZdZdd�Zdd�Zdd�ZdS)�DocFileCasecCsd�|jj�d��S)NrOr�)r�rvr+rtr�r,r,r-r�e	szDocFileCase.idcCs|jjSrl)rvrTr�r,r,r-r�h	szDocFileCase.__repr__cCsd|jj|jj|fS)Nz2Failed doctest test for %s
  File "%s", line 0

%s)rvr+rT)rjr�r,r,r-r}k	s�zDocFileCase.format_failureN)r6rprqr�r�r}r,r,r,r-r�c	sr�c
Ksv|dkri}n|��}|r&|s&td��t||||p4d�\}}d|krL||d<tj�|�}|�||||d�}	t|	f|�S)NrkrAr�r")r�r�rXr�r�rlr�r�)
r�rVrUr1r�rNr��docr+rr,r,r-�DocFileTestp	s�r�cOsDt�}|�dd�r$t|�d��|d<|D]}|�t|f|��q(|S)a�A unittest suite for one or more doctest files.

    The path to each doctest file is given as a string; the
    interpretation of that string depends on the keyword argument
    "module_relative".

    A number of options may be provided as keyword arguments:

    module_relative
      If "module_relative" is True, then the given file paths are
      interpreted as os-independent module-relative paths.  By
      default, these paths are relative to the calling module's
      directory; but if the "package" argument is specified, then
      they are relative to that package.  To ensure os-independence,
      "filename" should use "/" characters to separate path
      segments, and may not be an absolute path (i.e., it may not
      begin with "/").

      If "module_relative" is False, then the given file paths are
      interpreted as os-specific paths.  These paths may be absolute
      or relative (to the current working directory).

    package
      A Python package or the name of a Python package whose directory
      should be used as the base directory for module relative paths.
      If "package" is not specified, then the calling module's
      directory is used as the base directory for module relative
      filenames.  It is an error to specify "package" if
      "module_relative" is False.

    setUp
      A set-up function.  This is called before running the
      tests in each file. The setUp function will be passed a DocTest
      object.  The setUp function can access the test globals as the
      globs attribute of the test passed.

    tearDown
      A tear-down function.  This is called after running the
      tests in each file.  The tearDown function will be passed a DocTest
      object.  The tearDown function can access the test globals as the
      globs attribute of the test passed.

    globs
      A dictionary containing initial global variables for the tests.

    optionflags
      A set of doctest option flags expressed as an integer.

    parser
      A DocTestParser (or subclass) that should be used to extract
      tests from the files.

    encoding
      An encoding that will be used to convert the files to unicode.
    rVTrU)r�r/rDr�r�)�paths�kwr�r�r,r,r-r�	s8cCs�g}t��|�D]x}t|t�rh|�|jdd��|j}|r�|�d�|dd�|�d�dd�D�7}q|dd�|�d�dd�D�7}q|r�|ddkr�|��q�|r�|d	dkr�|�d	�q�d�	|�dS)
awExtract script from text with examples.

       Converts text with examples to a Python script.  Example input is
       converted to regular code.  Example output and all other words
       are converted to comments:

       >>> text = '''
       ...       Here are examples of simple math.
       ...
       ...           Python has super accurate integer addition
       ...
       ...           >>> 2 + 2
       ...           5
       ...
       ...           And very friendly error messages:
       ...
       ...           >>> 1/0
       ...           To Infinity
       ...           And
       ...           Beyond
       ...
       ...           You can use logic if you want:
       ...
       ...           >>> if 0:
       ...           ...    blah
       ...           ...    blah
       ...           ...
       ...
       ...           Ho hum
       ...           '''

       >>> print(script_from_examples(text))
       # Here are examples of simple math.
       #
       #     Python has super accurate integer addition
       #
       2 + 2
       # Expected:
       ## 5
       #
       #     And very friendly error messages:
       #
       1/0
       # Expected:
       ## To Infinity
       ## And
       ## Beyond
       #
       #     You can use logic if you want:
       #
       if 0:
          blah
          blah
       #
       #     Ho hum
       <BLANKLINE>
       Nrrz# Expected:cSsg|]}d|�qS)z## r,r�r,r,r-r�
sz(script_from_examples.<locals>.<listcomp>rFcSsg|]}t|��qSr,)r�r�r,r,r-r�
s�r~r")
rr�r9rr�r�rxrt�popr�)r]r�Zpiecerxr,r,r-r�	s :

"�

csJt|�}t��|�}�fdd�|D�}|s4t�d��|d}t|j�}|S)aExtract the test sources from a doctest docstring as a script.

    Provide the module (or dotted name of the module) containing the
    test to be debugged and the name (within the module) of the object
    with the doc string with tests to be debugged.
    csg|]}|j�kr|�qSr,r*)r�r7r*r,r-r�.
s
ztestsource.<locals>.<listcomp>znot found in testsr")rDrrwr�rr�)rCr+r�r�testsrcr,r*r-r%
s

cCst|�}t|||�dS)z4Debug a single doctest docstring, in argument `src`'N)r�debug_script)�src�pmr1r�r,r,r-r 5
scCs�ddl}|r|��}ni}|rvzt|||�Wq�tt��d�|jdd�}|��|�dt��d�Yq�Xn|jdd��	d|||�dS)z7Debug a test script.  `src` is the script, as a string.r"Nr&T)r�r4zexec(%r))
r�r�r-rr>rdr�rHZinteractionrR)r�r�r1r��pr,r,r-r�:
s
r�cCs$t|�}t||�}t|||j�dS)z�Debug a single doctest docstring.

    Provide the module (or dotted name of the module) containing the
    test to be debugged and the name (within the module) of the object
    with the docstring with tests to be debugged.
    N)rDrr�r�)rCr+r�r�r,r,r-r!N
s
c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
_TestClassz�
    A pointless class, for sanity-checking of docstring testing.

    Methods:
        square()
        get()

    >>> _TestClass(13).get() + _TestClass(-12).get()
    1
    >>> hex(_TestClass(13).square().get())
    '0xa9'
    cCs
||_dS)z�val -> _TestClass object with associated value val.

        >>> t = _TestClass(123)
        >>> print(t.get())
        123
        N�r
)rjr
r,r,r-r�j
sz_TestClass.__init__cCs|jd|_|S)zosquare() -> square TestClass's associated value

        >>> _TestClass(13).square().get()
        169
        r4r�r�r,r,r-�squaret
sz_TestClass.squarecCs|jS)z~get() -> return TestClass's associated value.

        >>> x = _TestClass(-42)
        >>> print(x.get())
        -42
        r�r�r,r,r-r/~
sz_TestClass.getN)r6rprqr�r�r�r/r,r,r,r-r�\
s


r�z�
                      Example of a string object, searched as-is.
                      >>> x = 1; y = 2
                      >>> x + y, x * y
                      (3, 2)
                      a�
                                    In 2.2, boolean expressions displayed
                                    0 or 1.  By default, we still accept
                                    them.  This can be disabled by passing
                                    DONT_ACCEPT_TRUE_FOR_1 to the new
                                    optionflags argument.
                                    >>> 4 == 4
                                    1
                                    >>> 4 == 4
                                    True
                                    >>> 4 > 4
                                    0
                                    >>> 4 > 4
                                    False
                                    z�
                Blank lines can be marked with <BLANKLINE>:
                    >>> print('foo\n\nbar\n')
                    foo
                    <BLANKLINE>
                    bar
                    <BLANKLINE>
            z�
                If the ellipsis flag is used, then '...' can be used to
                elide substrings in the desired output:
                    >>> print(list(range(1000))) #doctest: +ELLIPSIS
                    [0, 1, 2, ..., 999]
            a�
                If the whitespace normalization flag is used, then
                differences in whitespace are ignored.
                    >>> print(list(range(30))) #doctest: +NORMALIZE_WHITESPACE
                    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
                     15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
                     27, 28, 29]
            )r�r�zbool-int equivalencezblank linesZellipsiszwhitespace normalizationcCs"ddl}|jdd�}|jdddddd	�|jd
ddt��gd
d�|jddddd�|jdddd�|��}|j}|j}d}|jD]}|t|O}q�|j	r�|t
O}|D]v}|�d�r�tj
�|�\}}tj
�d|�t|dd��}	tj
d=t|	||d�\}
}nt|d||d�\}
}|
r�dSq�dS)Nr"zdoctest runner)Zdescriptionrz	--verbose�
store_trueFz'print very verbose output for all tests)�action�default�helpz-oz--optionr�zqspecify a doctest option flag to apply to the test run; may be specified more than once to apply multiple options)r��choicesr�r�z-fz--fail-fastzystop running tests after first failure (this is a shorthand for -o FAIL_FAST, and is in addition to any other -o options))r�r�r`r�z file containing the tests to run)�nargsr�z.py���rd)rVr�rr&)�argparse�ArgumentParser�add_argumentr'�keys�
parse_argsr`r�r�Z	fail_fastrrir�r�rtr>�insertr;rr)r�r�r�Z	testfilesr�r�r�rT�dirnamer�rrOr,r,r-�_test�
sL�
�
��

�
r�r�)r4)rY)	NNNNTr"NFF)FrnNr")NNNN)FN)FN)F)Sr�Z
__docformat__�__all__r.r^r7r�r�r�r[r>rarr�ior#�collectionsr$r%r'rrrrrrrrr	r
rrrr
rZrsr3rDrJrXr_rfrgr}r�r�r�r�rOrrrrrr�	Exceptionrrrrfrrrrorrsrqr�Z	TestSuiter�rr�r�rrrr r�r!r�rr�r6�exitr,r,r,r-�<module>	sF'�-
���������

1%.DKl<;n�
h�
{�
$!
@
�
IR


,	�3-
fractions.cpython-38.opt-2.pyc000064400000026135150335716500012140 0ustar00U

e5d	_�@s�ddlmZddlZddlZddlZddlZddlZddgZdd�Zdd�Z	ej
jZej
j
Ze�dejejB�ZGd	d�dej�ZdS)
���DecimalN�Fraction�gcdcCsfddl}|�dtd�t|�tkr2t|�kr\nn&|p<|dkrPt�||�St�||�St||�S)Nrz6fractions.gcd() is deprecated. Use math.gcd() instead.�)�warnings�warn�DeprecationWarning�type�int�mathr�_gcd)�a�br�r�!/usr/lib64/python3.8/fractions.pyrs� cCs|r|||}}q|S�Nr�rrrrrr
 sr
aC
    \A\s*                      # optional whitespace at the start, then
    (?P<sign>[-+]?)            # an optional sign, then
    (?=\d|\.\d)                # lookahead for digit or .digit
    (?P<num>\d*)               # numerator (possibly empty)
    (?:                        # followed by
       (?:/(?P<denom>\d+))?    # an optional denominator
    |                          # or
       (?:\.(?P<decimal>\d*))? # an optional fractional part
       (?:E(?P<exp>[-+]?\d+))? # and optional exponent
    )
    \s*\Z                      # and optional whitespace to finish
cs�eZdZdZdQdd��fdd�Zedd	��Zed
d��Zdd
�ZdRdd�Z	e
dd��Ze
dd��Zdd�Z
dd�Zdd�Zdd�Zeeej�\ZZdd�Zeeej�\ZZdd �Zeeej�\ZZd!d"�Zeeej�\ZZ d#d$�Z!ee!ej"�\Z#Z$d%d&�Z%ee%e&�\Z'Z(d'd(�Z)ee)ej*�\Z+Z,d)d*�Z-d+d,�Z.d-d.�Z/d/d0�Z0d1d2�Z1d3d4�Z2d5d6�Z3d7d8�Z4dSd9d:�Z5d;d<�Z6d=d>�Z7d?d@�Z8dAdB�Z9dCdD�Z:dEdF�Z;dGdH�Z<dIdJ�Z=dKdL�Z>dMdN�Z?dOdP�Z@�ZAS)Tr��
_numerator�_denominatorrNT��
_normalizecsRtt|��|�}|dk�rdt|�tkr6||_d|_|St|tj	�rV|j
|_|j|_|St|tt
f�rx|��\|_|_|St|t��rZt�|�}|dkr�td|��t|�d�p�d�}|�d�}|r�t|�}nvd}|�d�}|�rdt|�}||t|�}||9}|�d�}	|	�rBt|	�}	|	d	k�r4|d|	9}n|d|	9}|�d
�dk�rb|}ntd��nft|�tk�r�t|�k�r�nnn@t|tj	��r�t|tj	��r�|j
|j|j
|j}}ntd
��|d	k�r�td|��|�rBt|�tk�rt|�k�r(nnt�||�}
|d	k�r2|
}
n
t||�}
||
}||
}||_||_|S)N�z Invalid literal for Fraction: %rZnum�0�denom�decimal�
�exprZsign�-z2argument should be a string or a Rational instancez+both arguments should be Rational instanceszFraction(%s, 0))�superr�__new__r
rrr�
isinstance�numbers�Rational�	numerator�denominator�floatr�as_integer_ratio�str�_RATIONAL_FORMAT�match�
ValueError�group�len�	TypeError�ZeroDivisionErrorrrr
)�clsr%r&r�self�mrrZscaler�g��	__class__rrr!Tsx

�





$
�

�
$

zFraction.__new__cCsDt|tj�r||�St|t�s8td|j|t|�jf��||���S)Nz.%s.from_float() only takes floats, not %r (%s))r"r#�Integralr'r/�__name__r
r()r1�frrr�
from_float�s
�zFraction.from_floatcCsVddlm}t|tj�r&|t|��}n$t||�sJtd|j|t|�jf��||�	��S)Nrrz2%s.from_decimal() only takes Decimals, not %r (%s))
rrr"r#r7rr/r8r
r()r1Zdecrrrr�from_decimal�s
��zFraction.from_decimalcCs|j|jfSrr�r2rrrr(�szFraction.as_integer_ratio�@Bc
Cs�|dkrtd��|j|kr"t|�Sd\}}}}|j|j}}||}|||}	|	|krZq�||||||	f\}}}}||||}}q<|||}
t||
|||
|�}t||�}t||�t||�kr�|S|SdS)Nrz$max_denominator should be at least 1)rrrr)r,rrr�abs)
r2Zmax_denominatorZp0Zq0Zp1Zq1�n�drZq2�kZbound1Zbound2rrr�limit_denominator�s$ 

zFraction.limit_denominatorcCs|jSr)r�rrrrr%szFraction.numeratorcCs|jSr)rrCrrrr&szFraction.denominatorcCsd|jj|j|jfS)Nz
%s(%s, %s))r6r8rrr<rrr�__repr__"s�zFraction.__repr__cCs(|jdkrt|j�Sd|j|jfSdS)Nrz%s/%s)rr)rr<rrr�__str__'s

zFraction.__str__csT��fdd�}d�jd|_�j|_��fdd�}d�jd|_�j|_||fS)NcsPt|ttf�r�||�St|t�r0�t|�|�St|t�rH�t|�|�StSdSr)r"rrr'�complex�NotImplementedr��fallback_operator�monomorphic_operatorrr�forward~s


z-Fraction._operator_fallbacks.<locals>.forward�__csZt|tj�r�||�St|tj�r4�t|�t|��St|tj�rR�t|�t|��StSdSr)r"r#r$ZRealr'�ComplexrFrG�rrrHrr�reverse�s
z-Fraction._operator_fallbacks.<locals>.reverseZ__r)r8�__doc__)rJrIrKrOrrHr�_operator_fallbacks.sP	
zFraction._operator_fallbackscCs,|j|j}}t|j||j|||�Sr�r&rr%�rr�da�dbrrr�_add�s�z
Fraction._addcCs,|j|j}}t|j||j|||�SrrRrSrrr�_sub�s�z
Fraction._subcCst|j|j|j|j�Sr�rr%r&rrrr�_mul�sz
Fraction._mulcCst|j|j|j|j�SrrXrrrr�_div�s
�z
Fraction._divcCs|j|j|j|jSr�r%r&rrrr�	_floordiv�szFraction._floordivcCs:|j|j}}t|j|||j�\}}|t|||�fSr)r&�divmodr%r)rrrTrUZdivZn_modrrr�_divmod�szFraction._divmodcCs,|j|j}}t|j||j|||�SrrRrSrrr�_mod�sz
Fraction._modcCs�t|tj�r�|jdkr�|j}|dkr>t|j||j|dd�S|jdkrft|j||j|dd�St|j||j|dd�Sq�t|�t|�Snt|�|SdS)NrrFr)	r"r#r$r&r%rrrr')rrZpowerrrr�__pow__�s&

�

��zFraction.__pow__cCs\|jdkr|jdkr||jSt|tj�r<t|j|j�|S|jdkrP||jS|t|�S)Nrr)	rrr"r#r$rr%r&r'rNrrr�__rpow__�s


zFraction.__rpow__cCst|j|jdd�S�NFr�rrrrCrrr�__pos__�szFraction.__pos__cCst|j|jdd�SrbrcrCrrr�__neg__�szFraction.__neg__cCstt|j�|jdd�Srb)rr>rrrCrrr�__abs__�szFraction.__abs__cCs*|jdkr|j|jS|j|jSdS)NrrrCrrr�	__trunc__s
zFraction.__trunc__cCs|j|jSrr[rCrrr�	__floor__
szFraction.__floor__cCs|j|jSrr[rCrrr�__ceil__szFraction.__ceil__cCs�|dkrZt|j|j�\}}|d|jkr,|S|d|jkrB|dS|ddkrR|S|dSdt|�}|dkr�tt||�|�Stt||�|�SdS)Nrrrr)r]r%r&r>r�round)r2ZndigitsZfloorZ	remainder�shiftrrr�	__round__szFraction.__round__cCsPt|jtdt�}|st}nt|j�|t}|dkr:|n|}|dkrLdS|S)Nrr������)�powr�_PyHASH_MODULUS�_PyHASH_INFr>r)r2ZdinvZhash_�resultrrr�__hash__,szFraction.__hash__cCs�t|�tkr |j|ko|jdkSt|tj�rD|j|jkoB|j|jkSt|tj	�r`|j
dkr`|j}t|t�r�t
�|�s~t
�|�r�d|kS||�|�kSntSdS)Nrr�)r
rrrr"r#r$r%r&rM�imag�realr'r�isnan�isinfr:rGrrrr�__eq__Bs
�
zFraction.__eq__cCsht|tj�r&||j|j|j|j�St|t�r`t�	|�sDt�
|�rN|d|�S|||�|��SntSdS)Nrt)
r"r#r$rr&rr%r'rrwrxr:rG)r2�other�oprrr�_richcmpWs
�

zFraction._richcmpcCs|�|tj�Sr)r|�operator�ltrrrr�__lt__mszFraction.__lt__cCs|�|tj�Sr)r|r}�gtrrrr�__gt__qszFraction.__gt__cCs|�|tj�Sr)r|r}�lerrrr�__le__uszFraction.__le__cCs|�|tj�Sr)r|r}�gerrrr�__ge__yszFraction.__ge__cCs
t|j�Sr)�boolrrCrrr�__bool__}szFraction.__bool__cCs|jt|�ffSr)r6r)r<rrr�
__reduce__�szFraction.__reduce__cCs t|�tkr|S|�|j|j�Sr�r
rr6rrr<rrr�__copy__�szFraction.__copy__cCs t|�tkr|S|�|j|j�Srr�)r2Zmemorrr�__deepcopy__�szFraction.__deepcopy__)rN)r=)N)Br8�
__module__�__qualname__�	__slots__r!�classmethodr:r;r(rB�propertyr%r&rDrErQrVr}�add�__add__�__radd__rW�sub�__sub__�__rsub__rY�mul�__mul__�__rmul__rZ�truediv�__truediv__�__rtruediv__r\�floordiv�__floordiv__�
__rfloordiv__r^r]�
__divmod__�__rdivmod__r_�mod�__mod__�__rmod__r`rardrerfrgrhrirlrsryr|rr�r�r�r�r�r�r��
__classcell__rrr5rr<sbm



7

k
)rrrr#r}�re�sys�__all__rr
�	hash_info�modulusrp�infrq�compile�VERBOSE�
IGNORECASEr*r$rrrrr�<module>s
�ntpath.cpython-38.opt-1.pyc000064400000034503150335716500011443 0ustar00U

e5dVl�&@s(dZdZdZdZdZdZdZdZdZdd	l	Z	dd	l
Z
dd	lZdd	lZdd
lTddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0g&Z
d1d2�Zd3d�Zd4d�Zd5d
�Zd6d�Zd7d�Zd8d�Zejje_d9d�Zd:d�Zd;d�Zd<d�Zzdd=lmZWnek
�r(d	ZYnXd>d�Zd?d�Zd@d�ZdAd �Z dBdC�Z!zddDlm"Z"Wnek
�r|e!Z#Yn
XdEd!�Z#zddFlm$Z$m%Z&Wnek
�r�e#Z'YnXdGdH�Z(dIdJ�Z)dKd*�Z'e*e
dL��o�e
�+�dMdNkZ,dRdOd,�Z-dPd0�Z.zddQlm/Z0Wnek
�r"YnXd	S)Sz�Common pathname manipulations, WindowsNT/95 version.

Instead of importing this module directly, import os and refer to this
module as os.path.
�.�..�\�;�/z.;C:\binZnul�N)�*�normcase�isabs�join�
splitdrive�split�splitext�basename�dirname�commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�ismount�
expanduser�
expandvars�normpath�abspath�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenames�relpath�samefile�sameopenfile�samestat�
commonpathcCst|t�rdSdSdS)N�\/�\/)�
isinstance�bytes��path�r4�/usr/lib64/python3.8/ntpath.py�
_get_bothseps"s
r6cCs8t�|�}t|t�r$|�dd���S|�dd���SdS)zaNormalize case of pathname.

    Makes all characters lowercase and all slashes into backslashes.�/�\rrN)�os�fspathr0r1�replace�lower��sr4r4r5r,s

cCsjt�|�}t|t�r,|�dd��d�rBdSn|�dd��d�rBdSt|�d}t|�d	koh|d	t|�kS)
zTest whether a path is absoluter7r8�\\?\Trr�\\?\�r)	r9r:r0r1r;�
startswithr�lenr6r=r4r4r5r	=s

c

GsTt�|�}t|t�r"d}d}d}nd}d}d}z�|sD|dd�|t|�\}}ttj|�D]~}t|�\}}	|	r�|	d|kr�|s�|s�|}|	}q\n*|r�||kr�|��|��kr�|}|	}q\|}|r�|d|kr�||}||	}q\|�r|d|k�r|�r|dd�|k�r|||WS||WSttt	fk
�rNt
jd	|f|���YnXdS)
Nr8r.�:rr/�:r���r
)r9r:r0r1r�mapr<�	TypeError�AttributeError�BytesWarning�genericpath�_check_arg_types)
r3�pathsr!�seps�colonZresult_driveZresult_path�pZp_driveZp_pathr4r4r5r
MsL


��
cCst�|�}t|�dk�rt|t�r0d}d}d}nd}d}d}|�||�}|dd�|dkr�|dd	�|kr�|�|d�}|d
kr�|dd�|fS|�||d�}||dkr�|dd�|fS|d
kr�t|�}|d|�||d�fS|dd�|k�r|dd�|dd�fS|dd�|fS)
a�Split a pathname into drive/UNC sharepoint and relative path specifiers.
    Returns a 2-tuple (drive_or_unc, path); either part may be empty.

    If you assign
        result = splitdrive(p)
    It is always true that:
        result[0] + result[1] == p

    If the path contained a drive letter, drive_or_unc will contain everything
    up to and including the colon.  e.g. splitdrive("c:/dir") returns ("c:", "/dir")

    If the path contained a UNC path, the drive_or_unc will contain the host name
    and share up to but not including the fourth directory separator character.
    e.g. splitdrive("//host/computer/dir") returns ("//host/computer", "/dir")

    Paths cannot contain both a drive letter and a UNC path.

    �r8r7rDrrrEr�rFNrA)r9r:rCr0r1r;�find)rPr!r$rOZnormp�indexZindex2r4r4r5r|s.

$cCsxt�|�}t|�}t|�\}}t|�}|rD||d|krD|d8}q&|d|�||d�}}|�|�pj|}|||fS)z~Split a pathname.

    Return tuple (head, tail) where tail is everything after the final slash.
    Either part may be empty.rAN)r9r:r6rrC�rstrip)rPrN�d�i�head�tailr4r4r5r�s

cCs8t�|�}t|t�r$t�|ddd�St�|ddd�SdS)Nr8r7�.rrr)r9r:r0r1rK�	_splitext�rPr4r4r5r
�s

cCst|�dS)z)Returns the final component of a pathnamerA�rr\r4r4r5r�scCst|�dS)z-Returns the directory component of a pathnamerr]r\r4r4r5r�sc
Cs8zt�|�}Wntttfk
r*YdSXt�|j�S)zhTest whether a path is a symbolic link.
    This will always return false for Windows prior to 6.0.
    F)r9�lstat�OSError�
ValueErrorrI�stat�S_ISLNK�st_mode�r3�str4r4r5r�s
c	Cs.zt�|�}Wnttfk
r(YdSXdS)zCTest whether a path exists.  Returns True for broken symbolic linksFT)r9r^r_r`rdr4r4r5r�s
)�_getvolumepathnamecCstt�|�}t|�}t|�}t|�\}}|rD|d|krD|pB||kS||krPdStrl|�|�t|��|�kSdSdS)zaTest whether a path is a mount point (a drive root, the root of a
    share, or a mounted volume)rTFN)r9r:r6rrrfrU)r3rN�root�restr4r4r5rs
cCs�t�|�}t|t�rd}nd}|�|�s,|Sdt|�}}||kr\||t|�kr\|d7}q:dtjkrrtjd}nFdtjkr�|Sztjd}Wntk
r�d}YnXt	|tjd�}t|t�r�t�
|�}|dkr�t	t|�|d|��}|||d�S)	zLExpand ~ and ~user constructs.

    If user or $HOME is unknown, do nothing.�~�~rAZUSERPROFILEZHOMEPATHZ	HOMEDRIVE�N)r9r:r0r1rBrCr6�environ�KeyErrorr
�fsencoder)r3�tilderW�n�userhome�driver4r4r5r!s.








cCs2t�|�}t|t�rhd|kr(d|kr(|Sddl}t|j|jdd�}d}d}d}d	}d}ttd
d�}nFd|kr|d|kr||Sddl}|j|jd}d
}d}d}d}d}tj}|dd�}	d}
t	|�}|
|k�r.||
|
d�}||k�rX||
dd�}t	|�}z&|�
|�}
|	||d|
d�7}	Wn*tk
�rR|	||7}	|d}
YnX�n�||k�rJ||
d|
d�|k�r�|	|7}	|
d7}
n�||
dd�}t	|�}z|�
|�}
Wn*tk
�r�|	||7}	|d}
YnhX|d|
�}
z.|dk�rt�tjt�
|
��}n||
}Wn"tk
�r<||
|}YnX|	|7}	�n�||k�r||
d|
d�|k�r�|	|7}	|
d7}
�q$||
d|
d�|k�r^||
dd�}t	|�}z|�
|�}
Wn.tk
�r�|	|||7}	|d}
YnlX|d|
�}
z.|dk�r"t�tjt�
|
��}n||
}Wn&tk
�rR|||
|}YnX|	|7}	n�|dd�}
|
d7}
||
|
d�}|�r�||k�r�|
|7}
|
d7}
||
|
d�}�q�z.|dk�r�t�tjt�
|
��}n||
}Wntk
�r||
}YnX|	|7}	|�r$|
d8}
n|	|7}	|
d7}
q�|	S)zfExpand shell variables of the forms $var, ${var} and %var%.

    Unknown variables are left unchanged.�$�%rNz_-�ascii�'�{�}�environb�$�%�'�{�}rArQ)r9r:r0r1�stringZ
ascii_lettersZdigits�getattrrlrCrTr`rn�fsdecoderm)r3rZvarcharsZquoteZpercentZbraceZrbraceZdollarrl�resrTZpathlen�c�var�valuer4r4r5rQs�













c	CsPt�|�}t|t�r*d}d}d}d}d}nd}d}d}d	}d
}|�|�rL|S|�||�}t|�\}}|�|�r�||7}|�|�}|�|�}d}|t	|�k�r,||r�|||kr�||=q�|||k�r"|dkr�||d|kr�||d|d�=|d8}n&|dk�r|�
|��r||=n|d7}q�|d7}q�|�sB|�sB|�|�||�|�S)
z0Normalize path, eliminating double slashes, etc.r8r7rZ�..)s\\.\r?rrrr)z\\.\r@rrA)
r9r:r0r1rBr;r�lstriprrC�endswith�appendr
)	r3r!r$rr Zspecial_prefixes�prefix�compsrWr4r4r5r�sF









cCs@t�|�}t|�s8t|t�r&t��}nt��}t||�}t|�S)z�Return the absolute version of a path as a fallback function in case
    `nt._getfullpathname` is not available or raises OSError. See bpo-31047 for
    more.

    )	r9r:r	r0r1�getcwdb�getcwdr
r)r3�cwdr4r4r5�_abspath_fallback�s



r�)�_getfullpathnamec	Cs4ztt|��WSttfk
r.t|�YSXdS)z&Return the absolute version of a path.N)rr�r_r`r�r2r4r4r5rs)�_getfinalpathname�readlinkc
Cs�d}t�}t|�|kr�|�t|��z:|}t|�}t|�s\t|�sJ|}Wq�ttt|�|��}Wq
t	k
r�}z|j
|kr�WY�q��W5d}~XYq
tk
r�Yq�Yq
Xq
|S)N)rArQrR��� �2�C�Wi&i(i))�setr�add�_nt_readlinkr	rrr
rr_�winerrorr`)r3�allowed_winerror�seenZold_path�exr4r4r5�_readlink_deeps&
r�cCs�d}d}|r�zt|�}|r$t||�n|WStk
r�}z�|j|krF�z0t|�}||krt|rft||�n|WWY�TSWntk
r�YnXt|�\}}|r�|s�||WY�S|r�t||�n|}W5d}~XYqXq|S)N)rArQrRr�r�r�r�r�r��{i�i�rk)r�r
r_r�r�r)r3r�rYr��new_path�namer4r4r5�_getfinalpathname_nonstrictCs(
 &r�c	
Cs^t|�}t|t�rBd}d}d}t��}t|�tt�t��krjdSn(d}d}d}t��}t|�tt�krjdS|�	|�}|s�t
|�s�t||�}zt|�}d	}Wn0t
k
r�}z|j}t|�}W5d}~XYnX|�sZ|�	|��rZ|�	|�r�||t|�d�}n|t|�d�}zt|�|k�r"|}Wn4t
k
�rX}z|j|k�rH|}W5d}~XYnX|S)
Nr?s\\?\UNC\s\\s\\.\NULr@z\\?\UNC\z\\z\\.\NULr)rr0r1r9r�rrnr&r�rBr	r
r�r_r�r�rC)	r3r�Z
unc_prefixZnew_unc_prefixr�Z
had_prefixZinitial_winerrorr�Zspathr4r4r5r'qsD



�getwindowsversionrRrQcCsft�|�}t|t�r"d}d}d}nd}d}d}|dkr:|}|sFtd��t�|�}z�tt|��}tt|��}t|�\}}t|�\}	}
t|�t|	�kr�td	|	|f��d
d�|�	|�D�}dd�|
�	|�D�}d
}
t
||�D]$\}}t|�t|�kr�q�|
d7}
q�|gt|�|
||
d�}|�s(|WSt|�WSt
ttttfk
�r`t�d||��YnXdS)z#Return a relative version of a pathr8rZr�rrrNzno path specifiedz&path is on mount %r, start on mount %rcSsg|]}|r|�qSr4r4��.0�xr4r4r5�
<listcomp>�szrelpath.<locals>.<listcomp>cSsg|]}|r|�qSr4r4r�r4r4r5r��srrAr))r9r:r0r1r`rrrrr�ziprCr
rHrIrJ�DeprecationWarningrKrL)r3�startr!rr Z	start_absZpath_absZstart_driveZ
start_restZ
path_driveZ	path_rest�
start_list�	path_listrWZe1Ze2�rel_listr4r4r5r)�sJ


�

c	s�|std��tttj|��}t|dt�r8d�d�d�nd�d�d��z@��fd	d
�|D�}�fdd
�|D�}zt�fdd
�|D��\}Wntk
r�td�d�YnXttdd
�|D���dkr�td��t	|d�
����\}}|���}�fdd
�|D�}�fdd
�|D�}t|�}t
|�}t|�D]*\}	}
|
||	k�r*|d|	�}�qf�q*|dt|��}|�rt|�n|}|��|�WSttfk
�r�tjd|���YnXdS)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr8r7rZrrrcs g|]}t|��������qSr4)rr;r<)r�rP)r$r!r4r5r��szcommonpath.<locals>.<listcomp>csg|]\}}|����qSr4r]�r�rVrP�r!r4r5r��sc3s"|]\}}|dd��kVqdS)NrAr4r�r�r4r5�	<genexpr>�szcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathsNcss|]\}}|VqdS)Nr4r�r4r4r5r��srAzPaths don't have the same drivecsg|]}|r|�kr|�qSr4r4�r�r��rr4r5r��scsg|]}�fdd�|D��qS)csg|]}|r|�kr|�qSr4r4r�r�r4r5r�sz)commonpath.<locals>.<listcomp>.<listcomp>r4)r�r>r�r4r5r�sr-)r-)r`�tuplerGr9r:r0r1r�rCrr;r�min�max�	enumerater
rHrIrKrL)rMZdrivesplits�split_pathsr	rrr3�common�s1�s2rWr�r�r4)r$rr!r5r-�sF

)�_isdir)N)1�__doc__rr r%r!r"r$r#r&r9�sysrarK�__all__r6rr	r
rrr
r[rrrr�ntrf�ImportErrorrrrrr�r�rr�r�r�r'r�r��hasattrr�r(r)r-r�rr4r4r4r5�<module>s�	�
/8

0q2

*.2�
84_compression.cpython-38.opt-1.pyc000064400000010064150335716500012641 0ustar00U

e5d��@s:dZddlZejZGdd�dej�ZGdd�dej�ZdS)z7Internal classes used by the gzip, lzma and bz2 modules�Nc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
BaseStreamzMode-checking helper functions.cCs|jrtd��dS)NzI/O operation on closed file)�closed�
ValueError��self�r�$/usr/lib64/python3.8/_compression.py�_check_not_closedszBaseStream._check_not_closedcCs|��st�d��dS)NzFile not open for reading)�readable�io�UnsupportedOperationrrrr�_check_can_readszBaseStream._check_can_readcCs|��st�d��dS)NzFile not open for writing)�writablerrrrrr�_check_can_writeszBaseStream._check_can_writecCs(|��st�d��|��s$t�d��dS)Nz3Seeking is only supported on files open for readingz3The underlying file object does not support seeking)r
rr�seekablerrrr�_check_can_seeks
zBaseStream._check_can_seekN)�__name__�
__module__�__qualname__�__doc__r	r
rrrrrrr	s
rcsjeZdZdZdd�Zddd�Z�fdd�Zd	d
�Zdd�Zddd�Z	dd�Z
ejfdd�Z
dd�Z�ZS)�DecompressReaderz5Adapts the decompressor API to a RawIOBase reader APIcCsdS)NTrrrrrr
$szDecompressReader.readablercKs>||_d|_d|_d|_||_||_|jf|j�|_||_dS)NFr���)�_fp�_eof�_pos�_size�_decomp_factory�_decomp_args�
_decompressor�_trailing_error)r�fpZdecomp_factoryZtrailing_errorZdecomp_argsrrr�__init__'szDecompressReader.__init__csd|_t���S�N)r�super�closer��	__class__rrr$;szDecompressReader.closecCs
|j��Sr")rrrrrrr?szDecompressReader.seekablec
CsPt|��:}|�d��$}|�t|��}||dt|��<W5QRXW5QRXt|�S)N�B)�
memoryview�cast�read�len)r�bZviewZ	byte_view�datarrr�readintoBs$zDecompressReader.readintorcCs�|dkr|��S|r|jrdSd}|jjr�|jjp<|j�t�}|sDq�|jf|j	�|_z|j�
||�}Wq�|jk
r�Yq�Yq�Xn4|jjr�|j�t�}|s�t
d��nd}|j�
||�}|r"q�q"|s�d|_|j|_dS|jt|�7_|S)Nr�zACompressed file ended before the end-of-stream marker was reachedT)�readallrr�eofZunused_datarr*�BUFFER_SIZErr�
decompressrZneeds_input�EOFErrorrrr+)r�sizer-Zrawblockrrrr*Hs@

��
zDecompressReader.readcCs,|j�d�d|_d|_|jf|j�|_dS)NrF)r�seekrrrrrrrrr�_rewindrszDecompressReader._rewindcCs�|tjkrnR|tjkr"|j|}n<|tjkrP|jdkrD|�tj�rDq6|j|}ntd�	|���||jkrr|�
�n
||j8}|dkr�|�ttj|��}|s�q�|t|�8}q||jS)NrzInvalid value for whence: {})
r�SEEK_SET�SEEK_CURr�SEEK_ENDrr*�DEFAULT_BUFFER_SIZEr�formatr7�minr+)r�offset�whencer-rrrr6xs&






zDecompressReader.seekcCs|jS)z!Return the current file position.)rrrrr�tell�szDecompressReader.tell)r)r)rrrrr
r!r$rr.r*r7rr8r6r@�
__classcell__rrr%rr!s

*r)rrr;r2�BufferedIOBaser�	RawIOBaserrrrr�<module>scopyreg.cpython-38.opt-2.pyc000064400000006633150335716500011621 0ustar00U

e5d��@s�dddddgZiZddd�Zdd�ZzeWnek
r@YnXdd	�Zeeee�d
d�ZdZd
d�Z	dd�Z
dd�Zdd�ZiZ
iZiZdd�Zdd�Zdd�ZdS)�pickle�constructor�
add_extension�remove_extension�clear_extension_cacheNcCs,t|�std��|t|<|dk	r(t|�dS)Nz$reduction functions must be callable)�callable�	TypeError�dispatch_tabler)�ob_type�pickle_function�constructor_ob�r�/usr/lib64/python3.8/copyreg.pyrs
cCst|�std��dS)Nzconstructors must be callable)rr)�objectrrr
rscCst|j|jffS�N)�complex�real�imag)�crrr
�pickle_complex"srcCs<|tkrt�|�}n$|�||�}|jtjkr8|�||�|Sr)r�__new__�__init__)�cls�base�state�objrrr
�_reconstructor)sricCs�|j}|jD]}t|d�r|jt@sq.qt}|tkr<d}n"||krVtd|j�d���||�}|||f}z
|j}Wn\t	k
r�t
|dd�r�td|j�d|���d�z
|j}Wnt	k
r�d}YnXYnX|�}|r�t||fSt|fSdS)N�	__flags__zcannot pickle z object�	__slots__zf object: a class that defines __slots__ without defining __getstate__ cannot be pickled with protocol )
�	__class__�__mro__�hasattrr�	_HEAPTYPErr�__name__�__getstate__�AttributeError�getattr�__dict__r)�self�protorrr�args�getstate�dictrrr
�
_reduce_ex6s4


�

r,cGs|j|f|��Sr�r)rr)rrr
�
__newobj__Zsr.cCs|j|f|�|�Srr-)rr)�kwargsrrr
�
__newobj_ex__]sr0cCs�|j�d�}|dk	r|Sg}t|d�s(n�|jD]�}d|jkr.|jd}t|t�rV|f}|D]^}|dkrjqZqZ|�d�r�|�d�s�|j�	d�}|r�|�
d||f�q�|�
|�qZ|�
|�qZq.z
||_WnYnX|S)N�
__slotnames__r)r&�__weakref__�__�_z_%s%s)r&�getr r�
isinstance�str�
startswith�endswithr"�lstrip�appendr1)r�namesr�slots�name�strippedrrr
�
_slotnamescs2





r@cCs�t|�}d|krdks&ntd��||f}t�|�|krNt�|�|krNdS|tkrjtd|t|f��|tkr�td|t|f��|t|<|t|<dS)N�i���zcode out of rangez)key %s is already registered with code %sz$code %s is already in use for key %s)�int�
ValueError�_extension_registryr5�_inverted_registry��moduler>�code�keyrrr
r�s$�
�
�cCsR||f}t�|�|ks$t�|�|kr4td||f��t|=t|=|tkrNt|=dS)Nz%key %s is not registered with code %s)rDr5rErC�_extension_cacherFrrr
r�s��cCst��dSr)rJ�clearrrrr
r�s)N)�__all__rrrr�	NameErrorrrr!r,r.r0r@rDrErJrrrrrrr
�<module>s2�

	$<calendar.cpython-38.pyc000064400000064672150335716500010771 0ustar00U

e5da�@s4dZddlZddlZddlZddlmZdddddd	d
ddd
ddddddddddddddgZeZ	Gdd�de�Z
Gdd�de�ZdZdZ
dd d!d d"d d"d d d"d d"d g
ZGd#d$�d$�ZGd%d&�d&�Zed'�Zed(�Zed)�Zed*�Zed+�\ZZZZZZZd,d�Zd-d	�Zd.d
�Zd/d�Z d0d1�Z!d2d3�Z"d4d5�Z#Gd6d�de$�Z%Gd7d�de%�Z&Gd8d�de%�Z'Gd9d:�d:�Z(Gd;d�de&�Z)Gd<d�de'�Z*e&�Z+e+j,Z-d=d�Z.e+j/Z0e+j1Z1e+j2Z3e+j4Z5e+j6Z6e+j7Z8e+j9Z:e+j;Z<d>Z=d?Z>e=e>fd@dA�Z?e=e>fdBdC�Z@dDZAe�BeAdd��C�ZDdEd�ZEdFdG�ZFeGdHk�r0eFejH�dS)Ia$Calendar printing functions

Note when comparing these calendars to the ones printed by cal(1): By
default, these calendars have Monday as the first day of the week, and
Sunday as the last (the European convention). Use setfirstweekday() to
set the first day of the week (0=Monday, 6=Sunday).�N)�repeat�IllegalMonthError�IllegalWeekdayError�setfirstweekday�firstweekday�isleap�leapdays�weekday�
monthrange�
monthcalendar�prmonth�month�prcal�calendar�timegm�
month_name�
month_abbr�day_name�day_abbr�Calendar�TextCalendar�HTMLCalendar�LocaleTextCalendar�LocaleHTMLCalendar�
weekheaderc@seZdZdd�Zdd�ZdS)rcCs
||_dS�N�r
)�selfr
�r� /usr/lib64/python3.8/calendar.py�__init__szIllegalMonthError.__init__cCs
d|jS)Nz!bad month number %r; must be 1-12r�rrrr�__str__szIllegalMonthError.__str__N��__name__�
__module__�__qualname__r r"rrrrrsc@seZdZdd�Zdd�ZdS)rcCs
||_dSr�r	)rr	rrrr  szIllegalWeekdayError.__init__cCs
d|jS)Nz7bad weekday number %r; must be 0 (Monday) to 6 (Sunday)r'r!rrrr""szIllegalWeekdayError.__str__Nr#rrrrrs�����c@sFeZdZdd�ed�D�Ze�ddd��dd�Zd	d
�Zdd�Zd
S)�_localized_monthcCs g|]}t�d|dd�j�qS�i�r(��datetime�date�strftime��.0�irrr�
<listcomp>4sz_localized_month.<listcomp>�rcCsdS)N�r)�xrrr�<lambda>5�z_localized_month.<lambda>cCs
||_dSr��format�rr=rrrr 7sz_localized_month.__init__cs4�j|}t|t�r&�fdd�|D�S|�j�SdS)Ncsg|]}|�j��qSrr<�r4�fr!rrr6=sz0_localized_month.__getitem__.<locals>.<listcomp>)�_months�
isinstance�slicer=�rr5Zfuncsrr!r�__getitem__:s

z_localized_month.__getitem__cCsdS)N�
rr!rrr�__len__Asz_localized_month.__len__N)	r$r%r&�rangerA�insertr rErGrrrrr-2s
r-c@s6eZdZdd�ed�D�Zdd�Zdd�Zdd	�Zd
S)�_localized_daycCs g|]}t�dd|d�j�qSr.r/r3rrrr6Hsz_localized_day.<listcomp>�cCs
||_dSrr<r>rrrr Jsz_localized_day.__init__cs4�j|}t|t�r&�fdd�|D�S|�j�SdS)Ncsg|]}|�j��qSrr<r?r!rrr6Psz._localized_day.__getitem__.<locals>.<listcomp>)�_daysrBrCr=rDrr!rrEMs

z_localized_day.__getitem__cCsdS�NrKrr!rrrrGTsz_localized_day.__len__N)r$r%r&rHrLr rErGrrrrrJEsrJz%Az%az%Bz%brKcCs$|ddko"|ddkp"|ddkS)z5Return True for leap years, False for non-leap years.�r�d�r)�yearrrrrdscCs@|d8}|d8}|d|d|d|d|d|dS)zFReturn number of leap years in range [y1, y2).
       Assume y1 <= y2.r(rNrOrPr)Zy1Zy2rrrriscCs8tj|krtjks&nd|d}t�|||���S)zBReturn weekday (0-6 ~ Mon-Sun) for year, month (1-12), day (1-31).i�rP)r0ZMINYEARZMAXYEARr1r	)rQr
�dayrrrr	qscCsJd|krdksnt|��t||d�}t||tko>t|�}||fS)zQReturn weekday (0-6 ~ Mon-Sun) and number of days (28-31) for
       year, month.r(r7)rr	�mdays�Februaryr)rQr
�day1�ndaysrrrr
xs
cCst||tkot|�Sr)rSrTr�rQr
rrr�	_monthlen�srXcCs$|dkr|ddfS||dfSdS)Nr(r7rrWrrr�
_prevmonth�srYcCs$|dkr|ddfS||dfSdS)Nr7r(rrWrrr�
_nextmonth�srZc@s�eZdZdZd#dd�Zdd�Zdd�Zeee�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd$dd�Zd%dd�Zd&d d!�Zd"S)'rzo
    Base calendar class. This class doesn't do any formatting. It simply
    provides data to subclasses.
    rcCs
||_dSr�r�rrrrrr �szCalendar.__init__cCs
|jdSrM�Z
_firstweekdayr!rrr�getfirstweekday�szCalendar.getfirstweekdaycCs
||_dSrr]r\rrrr�szCalendar.setfirstweekdayccs&t|j|jd�D]}|dVqdS)zt
        Return an iterator for one week of weekday numbers starting with the
        configured first one.
        rKN)rHr)rr5rrr�iterweekdays�szCalendar.iterweekdaysccs,|�||�D]\}}}t�|||�VqdS)z�
        Return an iterator for one month. The iterator will yield datetime.date
        values and will always iterate through complete weeks, so it will yield
        dates outside the specified month.
        N)�itermonthdays3r0r1)rrQr
�y�m�drrr�itermonthdates�szCalendar.itermonthdatesccsft||�\}}||jd}td|�EdHtd|d�EdH|j||d}td|�EdHdS)z�
        Like itermonthdates(), but will yield day numbers. For days outside
        the specified month the day number is 0.
        rKrNr()r
rrrH)rrQr
rUrV�days_before�
days_afterrrr�
itermonthdays�szCalendar.itermonthdaysccs0t|�||�|j�D]\}}||dfVqdS)z�
        Like itermonthdates(), but will yield (day number, weekday number)
        tuples. For days outside the specified month the day number is 0.
        rKN)�	enumeratergr)rrQr
r5rcrrr�itermonthdays2�szCalendar.itermonthdays2ccs�t||�\}}||jd}|j||d}t||�\}}t||�d}	t|	||	�D]}
|||
fVqXtd|d�D]}
|||
fVqxt||�\}}td|d�D]}
|||
fVq�dS)z�
        Like itermonthdates(), but will yield (year, month, day) tuples.  Can be
        used for dates outside of datetime.date range.
        rKr(N)r
rrYrXrHrZ)rrQr
rUrVrerfrarb�endrcrrrr`�szCalendar.itermonthdays3ccs<t|�||��D]&\}\}}}||||j|dfVqdS)z�
        Like itermonthdates(), but will yield (year, month, day, day_of_week) tuples.
        Can be used for dates outside of datetime.date range.
        rKN)rhr`r)rrQr
r5rarbrcrrr�itermonthdays4�szCalendar.itermonthdays4cs.t|�||����fdd�tdt��d�D�S)z�
        Return a matrix (list of lists) representing a month's calendar.
        Each row represents a week; week entries are datetime.date values.
        csg|]}�||d��qS�rKrr3�Zdatesrrr6�sz/Calendar.monthdatescalendar.<locals>.<listcomp>rrK)�listrdrH�len�rrQr
rrmr�monthdatescalendar�szCalendar.monthdatescalendarcs.t|�||����fdd�tdt��d�D�S)z�
        Return a matrix representing a month's calendar.
        Each row represents a week; week entries are
        (day number, weekday number) tuples. Day numbers outside this month
        are zero.
        csg|]}�||d��qSrlrr3��daysrrr6�sz/Calendar.monthdays2calendar.<locals>.<listcomp>rrK)rnrirHrorprrrr�monthdays2calendar�szCalendar.monthdays2calendarcs.t|�||����fdd�tdt��d�D�S)z�
        Return a matrix representing a month's calendar.
        Each row represents a week; days outside this month are zero.
        csg|]}�||d��qSrlrr3rrrrr6�sz.Calendar.monthdayscalendar.<locals>.<listcomp>rrK)rnrgrHrorprrrr�monthdayscalendar�szCalendar.monthdayscalendar�cs>��fdd�tttd�D����fdd�tdt����D�S)a'
        Return the data for the specified year ready for formatting. The return
        value is a list of month rows. Each month row contains up to width months.
        Each month contains between 4 and 6 weeks and each week contains 1-7
        days. Days are datetime.date objects.
        csg|]}���|��qSr)rqr3�rrQrrr6s�z.Calendar.yeardatescalendar.<locals>.<listcomp>r7csg|]}�||���qSrrr3��months�widthrrr6	sr�rH�Januaryro�rrQrzr�ryrrzrQr�yeardatescalendar�s�zCalendar.yeardatescalendarcs>��fdd�tttd�D����fdd�tdt����D�S)z�
        Return the data for the specified year ready for formatting (similar to
        yeardatescalendar()). Entries in the week lists are
        (day number, weekday number) tuples. Day numbers outside this month are
        zero.
        csg|]}���|��qSr)rtr3rwrrr6s�z.Calendar.yeardays2calendar.<locals>.<listcomp>r7csg|]}�||���qSrrr3rxrrr6srr{r}rr~r�yeardays2calendars�zCalendar.yeardays2calendarcs>��fdd�tttd�D����fdd�tdt����D�S)z�
        Return the data for the specified year ready for formatting (similar to
        yeardatescalendar()). Entries in the week lists are day numbers.
        Day numbers outside this month are zero.
        csg|]}���|��qSr)rur3rwrrr6s�z-Calendar.yeardayscalendar.<locals>.<listcomp>r7csg|]}�||���qSrrr3rxrrr6"srr{r}rr~r�yeardayscalendars�zCalendar.yeardayscalendarN)r)rv)rv)rv)r$r%r&�__doc__r r^r�propertyrr_rdrgrir`rkrqrtrurr�r�rrrrr�s"

	



c@sjeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
d�Z	ddd�Z
ddd�Zd dd�Zd!dd�Z
dS)"rzr
    Subclass of Calendar that outputs a calendar as a simple plain text
    similar to the UNIX program cal.
    cCst|�||�dd�dS)z3
        Print a single week (no newline).
        r8�rjN)�print�
formatweek�r�theweekrzrrr�prweek+szTextCalendar.prweekcCs |dkrd}nd|}|�|�S)z*
        Returns a formatted day.
        rr8z%2i��center)rrRr	rz�srrr�	formatday1szTextCalendar.formatdaycsd���fdd�|D��S)zA
        Returns a single week in a string (no newline).
        � c3s |]\}}��||��VqdSr�r��r4rcZwd�rrzrr�	<genexpr>?sz*TextCalendar.formatweek.<locals>.<genexpr>��joinr�rr�rr�;szTextCalendar.formatweekcCs(|dkrt}nt}||d|��|�S)z4
        Returns a formatted week day name.
        �	N)rrr�)rrRrz�namesrrr�
formatweekdayAszTextCalendar.formatweekdaycsd���fdd����D��S)z-
        Return a header for a week.
        r�c3s|]}��|��VqdSr�r�r3r�rrr�Osz0TextCalendar.formatweekheader.<locals>.<genexpr>�r�r_r�rr�r�formatweekheaderKszTextCalendar.formatweekheaderTcCs"t|}|rd||f}|�|�S)z0
        Return a formatted month name.
        �%s %r)rr��r�theyear�themonthrz�withyearr�rrr�formatmonthnameQszTextCalendar.formatmonthnamercCst|�||||�dd�dS)z+
        Print a month's calendar.
        r8r�N)r��formatmonth)rr�r��w�lrrrrZszTextCalendar.prmonthcCs�td|�}td|�}|�||d|dd�}|��}|d|7}||�|���7}|d|7}|�||�D]$}||�||���7}|d|7}ql|S)z@
        Return a month's calendar string (multi-line).
        r)r(rK�
)�maxr��rstripr�rtr�)rr�r�r�r�r��weekrrrr�`s

zTextCalendar.formatmonthr)r(�rvc	s�td|�}td|�}td|�}|ddd�g}|j}|t����|||d����|d|���|��t���|��D�]"\}}	t||dt	||ddd��}
|d|����fdd�|
D�}|t
|�|����|d|��fdd�|
D�}|t
|�|����|d|�td	d�|	D��}
t|
�D]f}g}|	D]6}|t|�k�rj|�d
�n|���|||���qL|t
|�|����|d|��q@q�d
�
|�S)zC
        Returns a year's calendar as a multi-line string.
        r)r(rKr�rFc3s|]}���|�d�VqdS)FN)r��r4�k)�colwidthrr�rrr��s�z*TextCalendar.formatyear.<locals>.<genexpr>c3s|]
}�VqdSrrr�)�headerrrr��scss|]}t|�VqdSr)ro)r4�calrrrr��sr8)r��append�reprr�r�r�rhr�rH�min�formatstringror�r�)rr�r�r��crb�v�ar5�rowryr�ZheadersZheight�jZweeksr�r)r�r�rr�r�
formatyearps<


&
$�zTextCalendar.formatyearcCst|�|||||�dd�dS)zPrint a year's calendar.r8r�N)r�r�)rr�r�r�r�rbrrr�pryear�szTextCalendar.pryearN)T)rr)rr)r)r(r�rv)rrr�rv)r$r%r&r�r�r�r�r�r�r�rr�r�r�rrrrr%s


	


%c@s�eZdZdZdddddddgZeZd	Zd
Zd
ZdZ	dZ
dd
�Zdd�Zdd�Z
dd�Zd dd�Zd!dd�Zd"dd�Zd#dd�ZdS)$rz4
    This calendar returns complete HTML pages.
    ZmonZtueZwedZthuZfriZsatZsunZnodayr
rQcCs(|dkrd|jSd|j||fSdS)z/
        Return a day as a table cell.
        rz<td class="%s">&nbsp;</td>z<td class="%s">%d</td>N)�cssclass_noday�
cssclasses)rrRr	rrrr��s
zHTMLCalendar.formatdaycs d��fdd�|D��}d|S)z8
        Return a complete week as a table row.
        r8c3s|]\}}��||�VqdSrr�r�r!rrr��sz*HTMLCalendar.formatweek.<locals>.<genexpr>�<tr>%s</tr>r�)rr�r�rr!rr��szHTMLCalendar.formatweekcCsd|j|t|fS)z:
        Return a weekday name as a table header.
        �<th class="%s">%s</th>)�cssclasses_weekday_headr)rrRrrrr��s�zHTMLCalendar.formatweekdaycs$d��fdd����D��}d|S)z<
        Return a header for a week as a table row.
        r8c3s|]}��|�VqdSrr�r3r!rrr��sz0HTMLCalendar.formatweekheader.<locals>.<genexpr>r�r�)rr�rr!rr��szHTMLCalendar.formatweekheaderTcCs0|rdt||f}ndt|}d|j|fS)z5
        Return a month name as a table row.
        �%s %sz%sz+<tr><th colspan="7" class="%s">%s</th></tr>)r�cssclass_month_head�rr�r�r�r�rrrr��s�zHTMLCalendar.formatmonthnamecCs�g}|j}|d|j�|d�||j|||d��|d�||���|d�|�||�D]}||�|��|d�q\|d�|d�d�|�S)z6
        Return a formatted month as a table.
        �=<table border="0" cellpadding="0" cellspacing="0" class="%s">r��r��</table>r8)r��cssclass_monthr�r�rtr�r�)rr�r�r�r�r�r�rrrr��s �
zHTMLCalendar.formatmonthrvcCs�g}|j}t|d�}|d|j�|d�|d||j|f�tttd|�D]V}t|t||d��}|d�|D](}|d�||j||d	d
��|d�qr|d�qN|d
�d�|�S)z?
        Return a formatted year as a table of tables.
        r(r�r�z,<tr><th colspan="%d" class="%s">%s</th></tr>r7rFz<tr>z<td>Fr�z</td>z</tr>r�r8)	r�r��
cssclass_year�cssclass_year_headrHr|r�r�r�)rr�rzr�r�r5ryrbrrrr��s,
��

zHTMLCalendar.formatyear�calendar.cssNcCs�|dkrt��}g}|j}|d|�|d�|d�|d�|d|�|dk	r^|d|�|d|�|d	�|d
�||�||��|d�|d�d
�|��|d�S)zB
        Return a formatted year as a complete HTML page.
        Nz$<?xml version="1.0" encoding="%s"?>
zn<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
z<html>
z<head>
zC<meta http-equiv="Content-Type" content="text/html; charset=%s" />
z4<link rel="stylesheet" type="text/css" href="%s" />
z<title>Calendar for %d</title>
z</head>
z<body>
z</body>
z</html>
r8�xmlcharrefreplace)�sys�getdefaultencodingr�r�r��encode)rr�rz�css�encodingr�r�rrr�formatyearpage
s$zHTMLCalendar.formatyearpage)T)T)rv)rvr�N)r$r%r&r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�s 



c@s$eZdZdd�Zdd�Zdd�ZdS)�different_localecCs
||_dSr��locale)rr�rrrr #szdifferent_locale.__init__cCs"t�tj�|_t�tj|j�dSr)�_localeZ	getlocale�LC_TIME�	oldlocale�	setlocaler�r!rrr�	__enter__&szdifferent_locale.__enter__cGst�tj|j�dSr)r�r�r�r�)r�argsrrr�__exit__*szdifferent_locale.__exit__N)r$r%r&r r�r�rrrrr�"sr�c@s,eZdZdZddd�Zdd�Zdd	d
�ZdS)
r�
    This class can be passed a locale name in the constructor and will return
    month and weekday names in the specified locale. If this locale includes
    an encoding all strings containing month and weekday names will be returned
    as unicode.
    rNcCs&t�||�|dkrt��}||_dSr)rr r��getdefaultlocaler��rrr�rrrr 6szLocaleTextCalendar.__init__c
CsNt|j��:|dkrt}nt}||}|d|��|�W5QR�SQRXdS)Nr�)r�r�rrr�)rrRrzr��namerrrr�<sz LocaleTextCalendar.formatweekdayTc
CsDt|j��0t|}|r$d||f}|�|�W5QR�SQRXdS)Nr�)r�r�rr�r�rrrr�Es
z"LocaleTextCalendar.formatmonthname)rN)T�r$r%r&r�r r�r�rrrrr.s
	c@s,eZdZdZddd�Zdd�Zdd	d
�ZdS)
rr�rNcCs&t�||�|dkrt��}||_dSr)rr r�r�r�r�rrrr TszLocaleHTMLCalendar.__init__c
Cs<t|j��(t|}d|j||fW5QR�SQRXdS)Nr�)r�r�rr�)rrRr�rrrr�Zsz LocaleHTMLCalendar.formatweekdayTc
CsBt|j��.t|}|r$d||f}d|W5QR�SQRXdS)Nr�z.<tr><th colspan="7" class="month">%s</th></tr>)r�r�rr�rrrr�_s
z"LocaleHTMLCalendar.formatmonthname)rN)Tr�rrrrrMs
cCs(t|krtksnt|��|t_dSr)�MONDAY�SUNDAYrr�rr[rrrrls�r�cCstt|||��dS)z1Prints multi-column formatting for year calendarsN)r�r��Zcolsr��spacingrrrr=�sr=cs |d9}|��fdd�|D��S)zEReturns a string formatted from n strings, centered within n columns.r�c3s|]}|���VqdSrr�)r4r��r�rrr��szformatstring.<locals>.<genexpr>r�r�rr�rr��sr�i�cCs^|dd�\}}}}}}t�||d���t|d}|d|}|d|}	|	d|}
|
S)zBUnrelated but handy function to calculate Unix timestamp from GMT.Nr�r(��<)r0r1�	toordinal�
_EPOCH_ORD)�tuplerQr
rRZhourZminute�secondrsZhoursZminutesZsecondsrrrr�scCs�ddl}|��}|�d�}|�d�}|jddtddd�|jd	d
tddd�|jd
dtddd�|jddtddd�|jddddd�|jddddd�|jddddd�|jd d!d"d#d$d%�|jd&d'td(d)�|jd*d'td+d)�|�|dd��}|j�r|j�s|�d,�t	�
d�|j|jf}|jd-k�r�|j�rDt|d.�}nt
�}|j}|dk�rbt	��}t||jd/�}	t	jjj}
|jdk�r�|
|jtj��jf|	��n6|jdk�r�|
|j|jf|	��n|�d0�t	�
d�n�|j�r�t|d.�}nt�}t|j|jd1�}	|jdk�r$|j|	d2<|j|	d3<|jdk�rH|j tj��jf|	�}n2|jdk�rf|j |jf|	�}n|j!|j|jf|	�}t	jj}
|j�r�|�"|j�}t	jjj}
|
|�dS)4Nrztext only argumentszhtml only argumentsz-wz--widthr)z width of date column (default 2))�type�default�helpz-lz--linesr(z)number of lines for each week (default 1)z-sz	--spacingr�z"spacing between months (default 6)z-mz--monthsrvzmonths per row (default 3)z-cz--cssr�zCSS to use for page)r�r�z-Lz--localez.locale to be used from month and weekday namesz-ez
--encodingzencoding to use for outputz-tz--type�text)r��htmlzoutput type (text or html))r��choicesr�rQ�?zyear number (1-9999))�nargsr�r�r
zmonth number (1-12, text only)z/if --locale is specified --encoding is requiredr�r�)r�r�zincorrect number of arguments)r�r�r�rb)#�argparse�ArgumentParserZadd_argument_group�add_argument�int�
parse_argsr�r��errorr��exitr�rrr��dictr��stdout�buffer�writerQr�r0r1Ztodayr
rrrz�linesr�ryr�r�r�)r�r��parserZ	textgroupZ	htmlgroupZoptionsr�r�r�Zoptdictr��resultrrr�main�s�

����������







r�__main__)Ir�r�r0r�r��	itertoolsr�__all__�
ValueErrorr�rrr|rTrSr-rJrrrrrHr�ZTUESDAYZ	WEDNESDAYZTHURSDAYZFRIDAYZSATURDAYr�rrr	r
rXrYrZ�objectrrrr�rrr�r^rrrurr�r�r�r�rrr�r
r�rr�rZ	_colwidthZ_spacingr=r�ZEPOCHr1r�r�rrr$�argvrrrr�<module>s��
u	
h
textwrap.cpython-38.opt-1.pyc000064400000032207150335716500012022 0ustar00U

e5d�K�@s�dZddlZddddddgZd	ZGd
d�d�Zddd�Zdd
d�Zdd�Ze�dej	�Z
e�dej	�Zdd�Zddd�Z
edkr�eed��dS)zText wrapping and filling.
�N�TextWrapper�wrap�fill�dedent�indent�shortenz	

 c
@s�eZdZdZiZed�ZeD]Zeeee�<qdZ	dZ
de�e�Z
de
dd�Ze�d	e	e
e
ed
�ej�Z[	[
[e�de
�Z[
e�d�Zd&ddd�dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdS)'ra	
    Object for wrapping/filling text.  The public interface consists of
    the wrap() and fill() methods; the other methods are just there for
    subclasses to override in order to tweak the default behaviour.
    If you want to completely replace the main wrapping algorithm,
    you'll probably have to override _wrap_chunks().

    Several instance attributes control various aspects of wrapping:
      width (default: 70)
        the maximum width of wrapped lines (unless break_long_words
        is false)
      initial_indent (default: "")
        string that will be prepended to the first line of wrapped
        output.  Counts towards the line's width.
      subsequent_indent (default: "")
        string that will be prepended to all lines save the first
        of wrapped output; also counts towards each line's width.
      expand_tabs (default: true)
        Expand tabs in input text to spaces before further processing.
        Each tab will become 0 .. 'tabsize' spaces, depending on its position
        in its line.  If false, each tab is treated as a single character.
      tabsize (default: 8)
        Expand tabs in input text to 0 .. 'tabsize' spaces, unless
        'expand_tabs' is false.
      replace_whitespace (default: true)
        Replace all whitespace characters in the input text by spaces
        after tab expansion.  Note that if expand_tabs is false and
        replace_whitespace is true, every tab will be converted to a
        single space!
      fix_sentence_endings (default: false)
        Ensure that sentence-ending punctuation is always followed
        by two spaces.  Off by default because the algorithm is
        (unavoidably) imperfect.
      break_long_words (default: true)
        Break words longer than 'width'.  If false, those words will not
        be broken, and some lines might be longer than 'width'.
      break_on_hyphens (default: true)
        Allow breaking hyphenated words. If true, wrapping will occur
        preferably on whitespaces and right after hyphens part of
        compound words.
      drop_whitespace (default: true)
        Drop leading and trailing whitespace from lines.
      max_lines (default: None)
        Truncate wrapped lines.
      placeholder (default: ' [...]')
        Append to the last line of truncated text.
    � z[\w!"\'&.,?]z[^\d\W]z[%s]z[^�Na�
        ( # any whitespace
          %(ws)s+
        | # em-dash between words
          (?<=%(wp)s) -{2,} (?=\w)
        | # word, possibly hyphenated
          %(nws)s+? (?:
            # hyphenated word
              -(?: (?<=%(lt)s{2}-) | (?<=%(lt)s-%(lt)s-))
              (?= %(lt)s -? %(lt)s)
            | # end of word
              (?=%(ws)s|\Z)
            | # em-dash
              (?<=%(wp)s) (?=-{2,}\w)
            )
        ))Zwp�ltZwsZnwsz(%s+)z[a-z][\.\!\?][\"\']?\Z�F�TF�z [...])�	max_lines�placeholderc
CsL||_||_||_||_||_||_||_||_|	|_|
|_	||_
||_dS�N)�width�initial_indent�subsequent_indent�expand_tabs�replace_whitespace�fix_sentence_endings�break_long_words�drop_whitespace�break_on_hyphens�tabsizerr)
�selfrrrrrrrrrrrr�r� /usr/lib64/python3.8/textwrap.py�__init__sszTextWrapper.__init__cCs(|jr|�|j�}|jr$|�|j�}|S)z�_munge_whitespace(text : string) -> string

        Munge whitespace in text: expand tabs and convert all other
        whitespace characters to spaces.  Eg. " foo\tbar\n\nbaz"
        becomes " foo    bar  baz".
        )r�
expandtabsrr�	translate�unicode_whitespace_trans�r�textrrr�_munge_whitespace�s
zTextWrapper._munge_whitespacecCs6|jdkr|j�|�}n|j�|�}dd�|D�}|S)aN_split(text : string) -> [string]

        Split the text to wrap into indivisible chunks.  Chunks are
        not quite the same as words; see _wrap_chunks() for full
        details.  As an example, the text
          Look, goof-ball -- use the -b option!
        breaks into the following chunks:
          'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ',
          'use', ' ', 'the', ' ', '-b', ' ', 'option!'
        if break_on_hyphens is True, or in:
          'Look,', ' ', 'goof-ball', ' ', '--', ' ',
          'use', ' ', 'the', ' ', '-b', ' ', option!'
        otherwise.
        TcSsg|]}|r|�qSrr)�.0�crrr�
<listcomp>�sz&TextWrapper._split.<locals>.<listcomp>)r�
wordsep_re�split�wordsep_simple_re�rr#�chunksrrr�_split�s

zTextWrapper._splitcCs\d}|jj}|t|�dkrX||ddkrN|||�rNd||d<|d7}q|d7}qdS)ag_fix_sentence_endings(chunks : [string])

        Correct for sentence endings buried in 'chunks'.  Eg. when the
        original text contains "... foo.\nBar ...", munge_whitespace()
        and split() will convert that to [..., "foo.", " ", "Bar", ...]
        which has one too few spaces; this method simply changes the one
        space to two.
        rr	rz  �N)�sentence_end_re�search�len)rr,�iZ	patsearchrrr�_fix_sentence_endings�s	
z!TextWrapper._fix_sentence_endingscCs^|dkrd}n||}|jrH|�|dd|��|d|d�|d<n|sZ|�|���dS)a
_handle_long_word(chunks : [string],
                             cur_line : [string],
                             cur_len : int, width : int)

        Handle a chunk of text (most likely a word, not whitespace) that
        is too long to fit in any line.
        r	���N)r�append�pop)rZreversed_chunks�cur_line�cur_lenrZ
space_leftrrr�_handle_long_word�s
zTextWrapper._handle_long_wordc	Cs�g}|jdkrtd|j��|jdk	rb|jdkr8|j}n|j}t|�t|j���|jkrbtd��|��|�r�g}d}|r�|j}n|j}|jt|�}|j	r�|d�
�dkr�|r�|d=|r�t|d�}|||kr�|�|���||7}q�q�q�|�r&t|d�|k�r&|�
||||�ttt|��}|j	�r\|�r\|d�
�dk�r\|t|d�8}|d=|rj|jdk�s�t|�d|jk�s�|�r�|j	�r�t|�dk�r�|d�
��s�||k�r�|�|d�|��qj|�r0|d�
��r|t|j�|k�r|�|j�|�|d�|���q�|t|d�8}|d=�q�|�rn|d��}t|�t|j�|jk�rn||j|d<�q�|�||j����q�qj|S)a�_wrap_chunks(chunks : [string]) -> [string]

        Wrap a sequence of text chunks and return a list of lines of
        length 'self.width' or less.  (If 'break_long_words' is false,
        some lines may be longer than this.)  Chunks correspond roughly
        to words and the whitespace between them: each chunk is
        indivisible (modulo 'break_long_words'), but a line break can
        come between any two chunks.  Chunks should not have internal
        whitespace; ie. a chunk is either all whitespace or a "word".
        Whitespace chunks will be removed from the beginning and end of
        lines, but apart from that whitespace is preserved.
        rzinvalid width %r (must be > 0)Nr	z#placeholder too large for max widthr4r)r�
ValueErrorrrrr1r�lstrip�reverser�stripr5r6r9�sum�map�join�rstrip)	rr,�linesrr7r8r�lZ	prev_linerrr�_wrap_chunks�s�




 ���
�
���
�zTextWrapper._wrap_chunkscCs|�|�}|�|�Sr)r$r-r"rrr�
_split_chunksPs
zTextWrapper._split_chunkscCs$|�|�}|jr|�|�|�|�S)a^wrap(text : string) -> [string]

        Reformat the single paragraph in 'text' so it fits in lines of
        no more than 'self.width' columns, and return a list of wrapped
        lines.  Tabs in 'text' are expanded with string.expandtabs(),
        and all other whitespace characters (including newline) are
        converted to space.
        )rErr3rDr+rrrrVs	

zTextWrapper.wrapcCsd�|�|��S)z�fill(text : string) -> string

        Reformat the single paragraph in 'text' to fit in lines of no
        more than 'self.width' columns, and return a new string
        containing the entire wrapped paragraph.
        �
)r@rr"rrrrdszTextWrapper.fill)
rrrTTFTTTr
)�__name__�
__module__�__qualname__�__doc__r!�ordZuspace�_whitespace�xZ
word_punctZletter�re�escapeZ
whitespaceZnowhitespace�compile�VERBOSEr(r*r/rr$r-r3r9rDrErrrrrrrsV0���
��!grcKstfd|i|��}|�|�S)a�Wrap a single paragraph of text, returning a list of wrapped lines.

    Reformat the single paragraph in 'text' so it fits in lines of no
    more than 'width' columns, and return a list of wrapped lines.  By
    default, tabs in 'text' are expanded with string.expandtabs(), and
    all other whitespace characters (including newline) are converted to
    space.  See TextWrapper class for available keyword args to customize
    wrapping behaviour.
    r)rr�r#r�kwargs�wrrrrps
cKstfd|i|��}|�|�S)a�Fill a single paragraph of text, returning a new string.

    Reformat the single paragraph in 'text' to fit in lines of no more
    than 'width' columns, and return a new string containing the entire
    wrapped paragraph.  As with wrap(), tabs are expanded and other
    whitespace characters converted to space.  See TextWrapper class for
    available keyword args to customize wrapping behaviour.
    r)rrrRrrrr}s	cKs,tf|dd�|��}|�d�|������S)a�Collapse and truncate the given text to fit in the given width.

    The text first has its whitespace collapsed.  If it then fits in
    the *width*, it is returned as is.  Otherwise, as many words
    as possible are joined and then the placeholder is appended::

        >>> textwrap.shorten("Hello  world!", width=12)
        'Hello world!'
        >>> textwrap.shorten("Hello  world!", width=11)
        'Hello [...]'
    r	)rrr)rrr@r=r)rRrrrr�sz^[ 	]+$z(^[ 	]*)(?:[^ 	
])cCs�d}t�d|�}t�|�}|D]b}|dkr0|}q|�|�r<q|�|�rL|}qtt||��D]$\}\}}||krZ|d|�}qqZqdr�|r�|�d�D]}q�|r�t�d|d|�}|S)a�Remove any common leading whitespace from every line in `text`.

    This can be used to make triple-quoted strings line up with the left
    edge of the display, while still presenting them in the source code
    in indented form.

    Note that tabs and spaces are both treated as whitespace, but they
    are not equal: the lines "  hello" and "\thello" are
    considered to have no common leading whitespace.

    Entirely blank lines are normalized to a newline character.
    NrrrFz(?m)^)	�_whitespace_only_re�sub�_leading_whitespace_re�findall�
startswith�	enumerate�zipr)rN)r#Zmargin�indentsrr2rM�y�linerrrr�s(


cs,�dkrdd�����fdd�}d�|��S)aFAdds 'prefix' to the beginning of selected lines in 'text'.

    If 'predicate' is provided, 'prefix' will only be added to the lines
    where 'predicate(line)' is True. If 'predicate' is not provided,
    it will default to adding 'prefix' to all non-empty lines that do not
    consist solely of whitespace characters.
    NcSs|��Sr)r=�r^rrr�	predicate�szindent.<locals>.predicatec3s*��d�D]}�|�r�|n|Vq
dS)NT)�
splitlinesr_�r`�prefixr#rr�prefixed_lines�szindent.<locals>.prefixed_linesr)r@)r#rcr`rdrrbrr�s�__main__z Hello there.
  This is indented.)r)r)N)rJrN�__all__rLrrrrrP�	MULTILINErUrWrrrG�printrrrr�<module>sa

3
hmac.cpython-38.pyc000064400000016352150335716500010120 0ustar00U

&�.e��@s�dZddlZddlmZzddlZWnek
r@dZdZ	YnXe
ej�Z	ddlZddlZ
ddlZedd�ed�D��Zedd�ed�D��ZdZGdd	�d	�Zd
d�ZGdd
�d
ej�Ze
��r�eZddd�Zdd�ZdS)zqHMAC (Keyed-Hashing for Message Authentication) module.

Implements the HMAC algorithm as described by RFC 2104.
�N)�_compare_digestccs|]}|dAVqdS)�\N���.0�xrr�/usr/lib64/python3.8/hmac.py�	<genexpr>sr	�ccs|]}|dAVqdS)�6Nrrrrrr	sc@sReZdZdZdZddd�Zedd��Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�ZdS)�HMACz~RFC 2104 HMAC class.  Also complies with RFC 4231.

    This supports the API for Cryptographic Hash Functions (PEP 247).
    �@N�csVt��rtd��t|ttf�s0tdt|�j���s<td��t	��rL�|_
n,t�t�rhd�fdd�	|_
nd�fdd�	|_
|�
�|_|�
�|_
|j
j|_t|j
d�r�|j
j}|d	kr�t�d
||jftd�|j}nt�d|jtd�|j}||_t|�|k�r|�
|���}|�|d
�}|j�|�t��|j
�|�t��|dk	�rR|�|�dS)a?Create a new HMAC object.

        key: bytes or buffer, key for the keyed hash object.
        msg: bytes or buffer, Initial input for the hash or None.
        digestmod: A hash name suitable for hashlib.new(). *OR*
                   A hashlib constructor returning a new hash object. *OR*
                   A module supporting PEP 247.

                   Required as of 3.8, despite its position after the optional
                   msg argument.  Passing it as a keyword argument is
                   recommended, though not required for legacy API reasons.
        z9This class is not available in FIPS mode. Use hmac.new().�,key: expected bytes or bytearray, but got %rz'Missing required parameter 'digestmod'.�cst��|�S�N��_hashlib�new��d��	digestmodrr�<lambda>?rzHMAC.__init__.<locals>.<lambda>cs
��|�Sr�rrrrrrAr�
block_size�z:block_size of %d seems too small; using our default of %d.�z<No block_size attribute on given digest object; Assuming %d.�N)r)r)�_hashlibopenssl�
get_fips_mode�
ValueError�
isinstance�bytes�	bytearray�	TypeError�type�__name__�callable�digest_cons�str�outer�inner�digest_size�hasattrr�	_warnings�warn�	blocksize�RuntimeWarning�len�digest�ljust�update�	translate�trans_5C�trans_36)�self�key�msgrr1rrr�__init__#sR
�



����
z
HMAC.__init__cCsd|jjS)Nzhmac-)r,�name)r:rrrr>asz	HMAC.namecCs t��rtd��|j�|�dS)z,Feed data from msg into this hashing object.z'hmac.HMAC is not available in FIPS modeN)rr r!r,r6)r:r<rrrr6eszHMAC.updatecCs:|j�|j�}|j|_|j|_|j��|_|j��|_|S)zyReturn a separate copy of this hashing object.

        An update to this copy won't affect the original object.
        )�	__class__�__new__r)r-r,�copyr+)r:�otherrrrrAksz	HMAC.copycCs|j��}|�|j���|S)zwReturn a hash object for the current state.

        To be used only internally with digest() and hexdigest().
        )r+rAr6r,r4�r:�hrrr�_currentxs
z
HMAC._currentcCs|��}|��S)z�Return the hash value of this hashing object.

        This returns the hmac value as bytes.  The object is
        not altered in any way by this function; you can continue
        updating the object after calling this function.
        )rEr4rCrrrr4�szHMAC.digestcCs|��}|��S)zKLike digest(), but returns a string of hexadecimal digits instead.
        )rE�	hexdigestrCrrrrF�szHMAC.hexdigest)Nr)
r'�
__module__�__qualname__�__doc__r1r=�propertyr>r6rArEr4rFrrrrrs
>

	
rcCsHt|t�r|��St|�r"|d�}t|tj�s6td��|j���dd�S)Nrz6Only OpenSSL hashlib hashes are accepted in FIPS mode.�_�-)	r"r*�lowerr(rZHASHr%r>�replacerrrr�_get_openssl_name�s
�rOc@seZdZddd�ZdS)�HMAC_opensslNcCsLt|ttf�s tdt|�j��t|�}tjj	|||d�}|rH|�
|�|S)Nrr)r"r#r$r%r&r'rO�_hmacopensslrr@r6)�clsr;r<rr>�resultrrrr@�s
zHMAC_openssl.__new__)NN)r'rGrHr@rrrrrP�srPrcCst|||�S)a�Create a new hashing object and return it.

    key: bytes or buffer, The starting key for the hash.
    msg: bytes or buffer, Initial input for the hash, or None.
    digestmod: A hash name suitable for hashlib.new(). *OR*
               A hashlib constructor returning a new hash object. *OR*
               A module supporting PEP 247.

               Required as of 3.8, despite its position after the optional
               msg argument.  Passing it as a keyword argument is
               recommended, though not required for legacy API reasons.

    You can now feed arbitrary bytes into the object using its update()
    method, and can ask for the hash value at any time by calling its digest()
    or hexdigest() methods.
    )r)r;r<rrrrr�srcs�tdk	r(t�t�r(�tkr(t�||��St��r6�}n(t�t�rPd	�fdd�	}nd
�fdd�	}|�}|�}t|dd�}t|�|kr�||���}|d|t|�}|�	|�
t��|�	|�
t��|�	|�|�	|���|��S)aJFast inline implementation of HMAC.

    key: bytes or buffer, The key for the keyed hash object.
    msg: bytes or buffer, Input message.
    digest: A hash name suitable for hashlib.new() for best performance. *OR*
            A hashlib constructor returning a new hash object. *OR*
            A module supporting PEP 247.
    Nrcst��|�Srrr�r4rrr�rzdigest.<locals>.<lambda>cs
��|�SrrrrTrrr�rrr
r)r)r)
�_hashopensslr"r*�_openssl_md_methsZhmac_digestr(�getattrr3r4r6r7r9r8)r;r<r4r)r,r+r1rrTrr4�s,	��

r4)Nr)rI�warningsr/�	_operatorrZcompare_digestrrU�ImportErrorrV�	frozensetZopenssl_md_meth_namesZhashlibrrQr#�ranger8r9r-rrOrPr rr4rrrr�<module>s*

u
chunk.cpython-38.opt-1.pyc000064400000011351150335716500011251 0ustar00U

e5d;�@sdZGdd�d�ZdS)aSimple class to read IFF chunks.

An IFF chunk (used in formats such as AIFF, TIFF, RMFF (RealMedia File
Format)) has the following structure:

+----------------+
| ID (4 bytes)   |
+----------------+
| size (4 bytes) |
+----------------+
| data           |
| ...            |
+----------------+

The ID is a 4-byte string which identifies the type of chunk.

The size field (a 32-bit value, encoded using big-endian byte order)
gives the size of the whole chunk, including the 8-byte header.

Usually an IFF-type file consists of one or more chunks.  The proposed
usage of the Chunk class defined here is to instantiate an instance at
the start of each chunk and read from the instance until it reaches
the end, after which a new instance can be instantiated.  At the end
of the file, creating a new instance will fail with an EOFError
exception.

Usage:
while True:
    try:
        chunk = Chunk(file)
    except EOFError:
        break
    chunktype = chunk.getname()
    while True:
        data = chunk.read(nbytes)
        if not data:
            pass
        # do something with data

The interface is file-like.  The implemented methods are:
read, close, seek, tell, isatty.
Extra methods are: skip() (called by close, skips to the end of the chunk),
getname() (returns the name (ID) of the chunk)

The __init__ method has one required argument, a file-like object
(including a chunk instance), and one optional argument, a flag which
specifies whether or not chunks are aligned on 2-byte boundaries.  The
default is 1, i.e. aligned.
c@sZeZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zddd�Zdd�Z	ddd�Z
dd�ZdS)�ChunkTFc	Cs�ddl}d|_||_|rd}nd}||_|�d�|_t|j�dkrFt�z |�|d|�d��d|_	Wn|j
k
r�td�YnX|r�|j	d|_	d|_z|j��|_
Wnttfk
r�d|_YnXd|_dS)	N�F�>�<��L�T)�struct�closed�align�file�read�	chunkname�len�EOFErrorZunpack_from�	chunksize�error�	size_read�tell�offset�AttributeError�OSError�seekable)�selfrr
Z	bigendianZ
inclheaderrZstrflag�r�/usr/lib64/python3.8/chunk.py�__init__4s, zChunk.__init__cCs|jS)z*Return the name (ID) of the current chunk.)r
�rrrr�getnameNsz
Chunk.getnamecCs|jS)z%Return the size of the current chunk.)rrrrr�getsizeRsz
Chunk.getsizecCs |jsz|��W5d|_XdS)NT)r	�skiprrrr�closeVszChunk.closecCs|jrtd��dS)N�I/O operation on closed fileF)r	�
ValueErrorrrrr�isatty]szChunk.isattyrcCsv|jrtd��|jstd��|dkr0||j}n|dkrB||j}|dksT||jkrXt�|j�|j	|d�||_dS)z�Seek to specified position into the chunk.
        Default position is 0 (start of chunk).
        If the file is not seekable, this will result in an error.
        r!zcannot seek��rN)
r	r"rrrr�RuntimeErrorr�seekr)r�pos�whencerrrr'bs
z
Chunk.seekcCs|jrtd��|jS)Nr!)r	r"rrrrrrusz
Chunk.tell���cCs�|jrtd��|j|jkrdS|dkr2|j|j}||j|jkrN|j|j}|j�|�}|jt|�|_|j|jkr�|jr�|jd@r�|j�d�}|jt|�|_|S)z�Read at most size bytes from the chunk.
        If size is omitted or negative, read until the end
        of the chunk.
        r!�rr$)r	r"rrrrrr
)r�size�data�dummyrrrrzs$��z
Chunk.readcCs�|jrtd��|jrnzD|j|j}|jr:|jd@r:|d}|j�|d�|j||_WdStk
rlYnX|j|jkr�t	d|j|j�}|�
|�}|snt�qndS)z�Skip the rest of the chunk.
        If you are not interested in the contents of the chunk,
        this method should be called so that the file points to
        the start of the next chunk.
        r!r$Ni )r	r"rrrr
rr'r�minrr)r�nr.rrrr�s"
z
Chunk.skipN)TTF)r)r*)�__name__�
__module__�__qualname__rrrr r#r'rrrrrrrr3s


rN)�__doc__rrrrr�<module>s2wave.cpython-38.opt-2.pyc000064400000027515150335716500011115 0ustar00U

e5d6G�@s�ddlZdddddgZGdd�de�ZdZd	ZddlZddlZddlZdd
l	m
Z
ddlmZddl
Z
edd
�ZGdd�d�ZGdd�d�Zddd�Zddd�ZdS)�N�open�openfp�Error�	Wave_read�
Wave_writec@seZdZdS)rN)�__name__�
__module__�__qualname__�r
r
�/usr/lib64/python3.8/wave.pyrNs�)N�b�hN�i)�Chunk)�
namedtuple�_wave_paramsz7nchannels sampwidth framerate nframes comptype compnamec@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+S),rcCs�d|_d|_t|dd�|_|j��dkr0td��|j�d�dkrHtd��d|_d|_d|_	zt|jdd�}Wnt
k
r�Yq�YnX|��}|d	kr�|�|�d|_n2|d
kr�|js�td��||_|j|j
|_d|_	q�|��qT|jr�|js�td��dS)
Nr)Z	bigendian�RIFFz file does not start with RIFF id��WAVEznot a WAVE filer�fmt �datazdata chunk before fmt chunkz#fmt chunk and/or data chunk missing)�_convert�	_soundposr�_fileZgetnamer�readZ_fmt_chunk_read�_data_chunk�_data_seek_needed�EOFError�_read_fmt_chunkZ	chunksize�
_framesize�_nframes�skip)�self�file�chunkZ	chunknamer
r
r�initfp~s8


zWave_read.initfpcCsRd|_t|t�r"t�|d�}||_z|�|�Wn|jrF|���YnXdS)N�rb��_i_opened_the_file�
isinstance�str�builtinsrr&�close�r#�fr
r
r�__init__�s
zWave_read.__init__cCs|��dS�N�r-�r#r
r
r�__del__�szWave_read.__del__cCs|Sr1r
r3r
r
r�	__enter__�szWave_read.__enter__cGs|��dSr1r2�r#�argsr
r
r�__exit__�szWave_read.__exit__cCs|jSr1)rr3r
r
r�getfp�szWave_read.getfpcCsd|_d|_dS)Nrr)rrr3r
r
r�rewind�szWave_read.rewindcCs"d|_|j}|rd|_|��dSr1)rr)r-�r#r$r
r
rr-�s
zWave_read.closecCs|jSr1)rr3r
r
r�tell�szWave_read.tellcCs|jSr1)�
_nchannelsr3r
r
r�getnchannels�szWave_read.getnchannelscCs|jSr1)r!r3r
r
r�
getnframes�szWave_read.getnframescCs|jSr1)�
_sampwidthr3r
r
r�getsampwidth�szWave_read.getsampwidthcCs|jSr1)�
_framerater3r
r
r�getframerate�szWave_read.getframeratecCs|jSr1��	_comptyper3r
r
r�getcomptype�szWave_read.getcomptypecCs|jSr1��	_compnamer3r
r
r�getcompname�szWave_read.getcompnamecCs*t|��|��|��|��|��|���Sr1)rr>rArCr?rFrIr3r
r
r�	getparams�s�zWave_read.getparamscCsdSr1r
r3r
r
r�
getmarkers�szWave_read.getmarkerscCstd��dS�Nzno marks�r�r#�idr
r
r�getmark�szWave_read.getmarkcCs*|dks||jkrtd��||_d|_dS)Nrzposition not in ranger)r!rrr)r#�posr
r
r�setpos�szWave_read.setposcCs�|jr8|j�dd�|j|j}|r2|j�|d�d|_|dkrDdS|j�||j�}|jdkrxtjdkrxt	�
||j�}|jr�|r�|�|�}|jt|�|j
|j|_|S)Nr�r�big)rr�seekrr rr@�sys�	byteorder�audioop�byteswapr�lenr=)r#�nframesrQ�datar
r
r�
readframes�s

zWave_read.readframescCs�z$t�d|�d��\}|_|_}}Wntjk
r@td�YnX|tkr�zt�d|�d��d}Wntjk
r�td�YnX|dd|_|js�t	d��nt	d	|f��|js�t	d
��|j|j|_
d|_d|_dS)
Nz<HHLLH�z<H�r���bad sample widthzunknown format: %r�bad # of channels�NONEznot compressed)
�structZunpack_fromrr=rB�errorr�WAVE_FORMAT_PCMr@rr rErH)r#r%Z
wFormatTagZdwAvgBytesPerSecZwBlockAlign�	sampwidthr
r
rr�s$$
zWave_read._read_fmt_chunkN)rrr	r&r0r4r5r8r9r:r-r<r>r?rArCrFrIrJrKrPrRr]rr
r
r
rr_s*
c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9S):rcCsRd|_t|t�r"t�|d�}||_z|�|�Wn|jrF|���YnXdS)N�wbr(r.r
r
rr0.s
zWave_write.__init__cCs@||_d|_d|_d|_d|_d|_d|_d|_d|_d|_	dS)NrF)
rrr=r@rBr!�_nframeswritten�_datawritten�_datalength�_headerwrittenr;r
r
rr&:szWave_write.initfpcCs|��dSr1r2r3r
r
rr4FszWave_write.__del__cCs|Sr1r
r3r
r
rr5IszWave_write.__enter__cGs|��dSr1r2r6r
r
rr8LszWave_write.__exit__cCs(|jrtd��|dkrtd��||_dS)N�0cannot change parameters after starting to writerrc)rkrr=)r#�	nchannelsr
r
r�setnchannelsRs
zWave_write.setnchannelscCs|jstd��|jS)Nznumber of channels not set)r=rr3r
r
rr>YszWave_write.getnchannelscCs0|jrtd��|dks|dkr&td��||_dS)Nrnrrrb)rkrr@)r#rhr
r
r�setsampwidth^s
zWave_write.setsampwidthcCs|jstd��|jS)Nzsample width not set)r@rr3r
r
rrAeszWave_write.getsampwidthcCs0|jrtd��|dkrtd��tt|��|_dS)Nrnrzbad frame rate)rkr�int�roundrB)r#�	framerater
r
r�setframeratejs
zWave_write.setframeratecCs|jstd��|jS)Nzframe rate not set)rBrr3r
r
rrCqszWave_write.getframeratecCs|jrtd��||_dS�Nrn)rkrr!)r#r[r
r
r�
setnframesvszWave_write.setnframescCs|jSr1�rjr3r
r
rr?{szWave_write.getnframescCs.|jrtd��|dkrtd��||_||_dS)Nrn)rdzunsupported compression type)rkrrErH)r#�comptype�compnamer
r
r�setcomptype~szWave_write.setcomptypecCs|jSr1rDr3r
r
rrF�szWave_write.getcomptypecCs|jSr1rGr3r
r
rrI�szWave_write.getcompnamecCsV|\}}}}}}|jrtd��|�|�|�|�|�|�|�|�|�||�dSrv)rkrrprqrurwr{)r#Zparamsrorhrtr[ryrzr
r
r�	setparams�s



zWave_write.setparamscCs8|jr|jr|jstd��t|j|j|j|j|j|j�S)Nznot all parameters set)r=r@rBrrr!rErHr3r
r
rrJ�s�zWave_write.getparamscCstd��dS)Nzsetmark() not supportedrM)r#rOrQ�namer
r
r�setmark�szWave_write.setmarkcCstd��dSrLrMrNr
r
rrP�szWave_write.getmarkcCsdSr1r
r3r
r
rrK�szWave_write.getmarkerscCs|jSr1rxr3r
r
rr<�szWave_write.tellcCs�t|ttf�st|��d�}|�t|��t|�|j|j}|j	rN|�	|�}|jdkrpt
jdkrpt�
||j�}|j�|�|jt|�7_|j||_dS)N�BrrT)r*�bytes�	bytearray�
memoryview�cast�_ensure_header_writtenrZr@r=rrVrWrXrYr�writerkrj)r#r\r[r
r
r�writeframesraw�s
zWave_write.writeframesrawcCs"|�|�|j|jkr|��dSr1)r�rlrk�_patchheader)r#r\r
r
r�writeframes�s
zWave_write.writeframescCsXz2|jr0|�d�|j|jkr&|��|j��W5d|_|j}|rRd|_|��XdS)Nr)rr)r-r�rlrkr��flushr;r
r
rr-�s
zWave_write.closecCs>|js:|jstd��|js"td��|js0td��|�|�dS)Nz# channels not specifiedzsample width not specifiedzsampling rate not specified)rmr=rr@rB�
_write_header)r#Zdatasizer
r
rr��sz!Wave_write._ensure_header_writtencCs�|j�d�|js$||j|j|_|j|j|j|_z|j��|_Wntt	fk
rfd|_YnX|j�t
�dd|jdddt|j|j
|j|j
|j|j|j|jdd��|jdk	r�|j��|_|j�t
�d	|j��d
|_dS)Nrz<L4s4sLHHLLHH4s�$rr�rar�<LT)rr�r!r=r@rlr<�_form_length_pos�AttributeError�OSErrorre�packrgrB�_data_length_posrm)r#Z
initlengthr
r
rr��s2
�
zWave_write._write_headercCs�|j|jkrdS|j��}|j�|jd�|j�t�dd|j��|j�|j	d�|j�t�d|j��|j�|d�|j|_dS)Nrr�r�)
rkrlrr<rUr�r�rer�r�)r#Zcurposr
r
rr��s
zWave_write._patchheaderN)rrr	r0r&r4r5r8rpr>rqrArurCrwr?r{rFrIr|rJr~rPrKr<r�r�r-r�r�r�r
r
r
rrs8


cCsJ|dkrt|d�r|j}nd}|dkr.t|�S|dkr>t|�Std��dS)N�moder')�rr')�wriz$mode must be 'r', 'rb', 'w', or 'wb')�hasattrr�rrr�r/r�r
r
rr�s
cCstjdtdd�t||d�S)NzBwave.openfp is deprecated since Python 3.7. Use wave.open instead.r_)�
stacklevel)r�)�warnings�warn�DeprecationWarningrr�r
r
rrs
�)N)N)r,�__all__�	ExceptionrrgZ_array_fmtsrXrerVr%r�collectionsrr�rrrrrr
r
r
r�<module>Js&�6d

heapq.cpython-38.opt-2.pyc000064400000025460150335716500011246 0ustar00U

e5d]Y�@sVdZddddddddgZd	d�Zd
d�Zdd�Zdd�Zd
d�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
ddd�dd�Zd(d d�Zd)d!d�Zzd"d#lTWnek
r�YnXzd"d$lmZWnek
r�YnXzd"d%lm	Z	Wnek
�r
YnXzd"d&lmZWnek
�r2YnXed'k�rRd"dlZee���dS)*uoHeap queues

[explanation by François Pinard]

Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0.  For the sake of comparison,
non-existing elements are considered to be infinite.  The interesting
property of a heap is that a[0] is always its smallest element.

The strange invariant above is meant to be an efficient memory
representation for a tournament.  The numbers below are `k', not a[k]:

                                   0

                  1                                 2

          3               4                5               6

      7       8       9       10      11      12      13      14

    15 16   17 18   19 20   21 22   23 24   25 26   27 28   29 30


In the tree above, each cell `k' is topping `2*k+1' and `2*k+2'.  In
a usual binary tournament we see in sports, each cell is the winner
over the two cells it tops, and we can trace the winner down the tree
to see all opponents s/he had.  However, in many computer applications
of such tournaments, we do not need to trace the history of a winner.
To be more memory efficient, when a winner is promoted, we try to
replace it by something else at a lower level, and the rule becomes
that a cell and the two cells it tops contain three different items,
but the top cell "wins" over the two topped cells.

If this heap invariant is protected at all time, index 0 is clearly
the overall winner.  The simplest algorithmic way to remove it and
find the "next" winner is to move some loser (let's say cell 30 in the
diagram above) into the 0 position, and then percolate this new 0 down
the tree, exchanging values, until the invariant is re-established.
This is clearly logarithmic on the total number of items in the tree.
By iterating over all items, you get an O(n ln n) sort.

A nice feature of this sort is that you can efficiently insert new
items while the sort is going on, provided that the inserted items are
not "better" than the last 0'th element you extracted.  This is
especially useful in simulation contexts, where the tree holds all
incoming events, and the "win" condition means the smallest scheduled
time.  When an event schedule other events for execution, they are
scheduled into the future, so they can easily go into the heap.  So, a
heap is a good structure for implementing schedulers (this is what I
used for my MIDI sequencer :-).

Various structures for implementing schedulers have been extensively
studied, and heaps are good for this, as they are reasonably speedy,
the speed is almost constant, and the worst case is not much different
than the average case.  However, there are other representations which
are more efficient overall, yet the worst cases might be terrible.

Heaps are also very useful in big disk sorts.  You most probably all
know that a big sort implies producing "runs" (which are pre-sorted
sequences, which size is usually related to the amount of CPU memory),
followed by a merging passes for these runs, which merging is often
very cleverly organised[1].  It is very important that the initial
sort produces the longest runs possible.  Tournaments are a good way
to that.  If, using all the memory available to hold a tournament, you
replace and percolate items that happen to fit the current run, you'll
produce runs which are twice the size of the memory for random input,
and much better for input fuzzily ordered.

Moreover, if you output the 0'th item on disk and get an input which
may not fit in the current tournament (because the value "wins" over
the last output value), it cannot fit in the heap, so the size of the
heap decreases.  The freed memory could be cleverly reused immediately
for progressively building a second heap, which grows at exactly the
same rate the first heap is melting.  When the first heap completely
vanishes, you switch heaps and start a new run.  Clever and quite
effective!

In a word, heaps are useful memory structures to know.  I use them in
a few applications, and I think it is good to keep a `heap' module
around. :-)

--------------------
[1] The disk balancing algorithms which are current, nowadays, are
more annoying than clever, and this is a consequence of the seeking
capabilities of the disks.  On devices which cannot seek, like big
tape drives, the story was quite different, and one had to be very
clever to ensure (far in advance) that each tape movement will be the
most effective possible (that is, will best participate at
"progressing" the merge).  Some tapes were even able to read
backwards, and this was also used to avoid the rewinding time.
Believe me, real good tape sorts were quite spectacular to watch!
From all times, sorting has always been a Great Art! :-)
�heappush�heappop�heapify�heapreplace�merge�nlargest�	nsmallest�heappushpopcCs"|�|�t|dt|�d�dS)N��)�append�	_siftdown�len��heap�item�r�/usr/lib64/python3.8/heapq.pyr�s
cCs.|��}|r*|d}||d<t|d�|S|S�Nr	)�pop�_siftup�rZlastelt�
returnitemrrrr�s
cCs|d}||d<t|d�|Sr�r�rrrrrrr�s
cCs0|r,|d|kr,|d|}|d<t|d�|Srrrrrrr�s
cCs,t|�}tt|d��D]}t||�qdS�N�)r
�reversed�ranger��x�n�irrrr�scCs.|��}|r*|d}||d<t|d�|S|Sr)r�_siftup_maxrrrr�_heappop_max�s
r#cCs|d}||d<t|d�|Sr)r"rrrr�_heapreplace_max�s
r$cCs,t|�}tt|d��D]}t||�qdSr)r
rrr"rrrr�_heapify_max�sr%cCsJ||}||kr>|dd?}||}||kr>|||<|}qq>q|||<dS�Nr
r�r�startpos�pos�newitem�	parentpos�parentrrrr�srcCs�t|�}|}||}d|d}||krj|d}||krL||||ksL|}||||<|}d|d}q |||<t|||�dS�Nrr
)r
r�rr)�endposr(r*�childpos�rightposrrrrsrcCsJ||}||kr>|dd?}||}||kr>|||<|}qq>q|||<dSr&rr'rrr�
_siftdown_maxsr2cCs�t|�}|}||}d|d}||krj|d}||krL||||ksL|}||||<|}d|d}q |||<t|||�dSr-)r
r2r.rrrr"%sr"NF��key�reversec	gsg}|j}|r t}t}t}d}nt}t}t}d}|dk�rttt	|��D]<\}	}
z|
j
}||�|	||g�WqHtk
r�YqHXqH||�t|�dkr�z2|d\}}	}}
|V|�|
d<|||
�q�Wq�tk
r�||�Yq�Xq�|�r|d\}}	}|V|j
EdHdSttt	|��D]J\}	}
z(|
j
}|�}|||�|	|||g�Wntk
�rjYnX�q$||�t|�dk�r�zF|d\}}	}}}
|V|�}||�|
d<||
d<|||
��q�Wntk
�r�||�YnX�qx|�r|d\}}	}}|V|j
EdHdS)N���r
r	r)rr%r#r$rrr�	enumerate�map�iter�__next__�
StopIterationr
�__self__)r4r5�	iterables�h�h_append�_heapify�_heappop�_heapreplace�	direction�order�it�next�value�s�	key_valuerrrr:sl


c	s�|dkr6t|�}t�}t||�d�}||kr0gS|gSzt|�}Wnttfk
rZYnX||krxt|�d�d|�S�dk�rt|�}dd�tt|�|�D�}|s�|St	|�|dd}|}t
}	|D].}
|
|kr�|	||
|f�|d\}}|d7}q�|��dd�|D�St|�}�fdd�tt|�|�D�}|�s>|St	|�|dd}|}t
}	|D]>}
�|
�}||k�r^|	||||
f�|d\}}}
|d7}�q^|��d	d�|D�S)
Nr
��defaultr4�r4cSsg|]\}}||f�qSrr��.0r!�elemrrr�
<listcomp>�sznsmallest.<locals>.<listcomp>r	cSsg|]\}}|�qSrr�rNrOrDrrrrP�scsg|]\}}�|�||f�qSrrrMrLrrrP�scSsg|]\}}}|�qSrr�rN�krDrOrrrrPs)r9�object�minr
�	TypeError�AttributeError�sorted�ziprr%r$�sort�r �iterabler4rE�sentinel�result�size�toprDrBrO�_orderrS�_elemrrLrr�sV


c	s�|dkr6t|�}t�}t||�d�}||kr0gS|gSzt|�}Wnttfk
rZYn X||krzt|�dd�d|�S�dk�rt|�}dd�ttd|d�|�D�}|s�|St	|�|dd}|}t
}	|D].}
||
kr�|	||
|f�|d\}}|d8}q�|jdd	�d
d�|D�St|�}�fdd�ttd|d�|�D�}|�sR|St	|�|dd}|}t
}	|D]>}
�|
�}||k�rt|	||||
f�|d\}}}
|d8}�qt|jdd	�dd�|D�S)
Nr
rJTr3cSsg|]\}}||f�qSrrrMrrrrP"sznlargest.<locals>.<listcomp>r	r6)r5cSsg|]\}}|�qSrrrQrrrrP/scsg|]\}}�|�||f�qSrrrMrLrrrP3scSsg|]\}}}|�qSrrrRrrrrPAs)r9rT�maxr
rVrWrXrYrrrrZr[rrLrr	sV

"
r	)�*)r$)r%)r#�__main__)N)N)�	__about__�__all__rrrrrr#r$r%rrr2r"rrr�_heapq�ImportError�__name__Zdoctest�printZtestmodrrrr�<module>!sP^
�

	5
<
;
_threading_local.cpython-38.opt-1.pyc000064400000014460150335716500013423 0ustar00U

e5d4�@s^dZddlmZddlmZdgZGdd�d�Zedd��ZGd	d�d�Zdd
l	m
Z
mZdS)a(Thread-local objects.

(Note that this module provides a Python version of the threading.local
 class.  Depending on the version of Python you're using, there may be a
 faster one available.  You should always import the `local` class from
 `threading`.)

Thread-local objects support the management of thread-local data.
If you have data that you want to be local to a thread, simply create
a thread-local object and use its attributes:

  >>> mydata = local()
  >>> mydata.number = 42
  >>> mydata.number
  42

You can also access the local-object's dictionary:

  >>> mydata.__dict__
  {'number': 42}
  >>> mydata.__dict__.setdefault('widgets', [])
  []
  >>> mydata.widgets
  []

What's important about thread-local objects is that their data are
local to a thread. If we access the data in a different thread:

  >>> log = []
  >>> def f():
  ...     items = sorted(mydata.__dict__.items())
  ...     log.append(items)
  ...     mydata.number = 11
  ...     log.append(mydata.number)

  >>> import threading
  >>> thread = threading.Thread(target=f)
  >>> thread.start()
  >>> thread.join()
  >>> log
  [[], 11]

we get different data.  Furthermore, changes made in the other thread
don't affect data seen in this thread:

  >>> mydata.number
  42

Of course, values you get from a local object, including a __dict__
attribute, are for whatever thread was current at the time the
attribute was read.  For that reason, you generally don't want to save
these values across threads, as they apply only to the thread they
came from.

You can create custom local objects by subclassing the local class:

  >>> class MyLocal(local):
  ...     number = 2
  ...     def __init__(self, /, **kw):
  ...         self.__dict__.update(kw)
  ...     def squared(self):
  ...         return self.number ** 2

This can be useful to support default values, methods and
initialization.  Note that if you define an __init__ method, it will be
called each time the local object is used in a separate thread.  This
is necessary to initialize each thread's dictionary.

Now if we create a local object:

  >>> mydata = MyLocal(color='red')

Now we have a default number:

  >>> mydata.number
  2

an initial color:

  >>> mydata.color
  'red'
  >>> del mydata.color

And a method that operates on the data:

  >>> mydata.squared()
  4

As before, we can access the data in a separate thread:

  >>> log = []
  >>> thread = threading.Thread(target=f)
  >>> thread.start()
  >>> thread.join()
  >>> log
  [[('color', 'red')], 11]

without affecting this thread's data:

  >>> mydata.number
  2
  >>> mydata.color
  Traceback (most recent call last):
  ...
  AttributeError: 'MyLocal' object has no attribute 'color'

Note that subclasses can define slots, but they are not thread
local. They are shared across threads:

  >>> class MyLocal(local):
  ...     __slots__ = 'number'

  >>> mydata = MyLocal()
  >>> mydata.number = 42
  >>> mydata.color = 'red'

So, the separate thread:

  >>> thread = threading.Thread(target=f)
  >>> thread.start()
  >>> thread.join()

affects what we see:

  >>> mydata.number
  11

>>> del mydata
�)�ref)�contextmanager�localc@s,eZdZdZdZdd�Zdd�Zdd�Zd	S)
�
_localimplz#A class managing thread-local dicts)�key�dicts�	localargs�	locallock�__weakref__cCsdtt|��|_i|_dS)Nz_threading_local._localimpl.)�str�idrr)�self�r�(/usr/lib64/python3.8/_threading_local.py�__init__�sz_localimpl.__init__cCst�}|jt|�dS)zPReturn the dict for the current thread. Raises KeyError if none
        defined.�)�current_threadrr)r
�threadrrr�get_dict�sz_localimpl.get_dictcshi}|j}t�}t|�}|f�fdd�	}|f�fdd�	}t||��t||���|j|<�|f|j|<|S)z8Create a new dict for the current thread, and return it.cs��}|dk	r|j|=dS�N)�__dict__)�_rr)�wrthreadrr�
local_deleted�sz-_localimpl.create_dict.<locals>.local_deletedcs��}|dk	r|j�|�}dSr)r�pop)r�idtr�dct)�wrlocalrr�thread_deleted�sz._localimpl.create_dict.<locals>.thread_deleted)rrrrrr)r
Z	localdictrrrrrr)rrr�create_dict�s


z_localimpl.create_dictN)�__name__�
__module__�__qualname__�__doc__�	__slots__rrrrrrrr�s
rc	csvt�|d�}z|��}Wn2tk
rJ|��}|j\}}|j||�YnX|j�t�|d|�dVW5QRXdS)N�_local__implr)	�object�__getattribute__r�KeyErrorrrrr	�__setattr__)r
�implr�args�kwrrr�_patch�s
r-c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r)r%rcOsX|s|r|jtjkrtd��t�|�}t�}||f|_t�|_t�|d|�|�	�|S)Nz*Initialization arguments are not supportedr%)
rr&�	TypeError�__new__rr�RLockr	r)r)�clsr+r,r
r*rrrr/�s

z
local.__new__c
Cs,t|��t�||�W5QR�SQRXdSr)r-r&r'�r
�namerrrr'�s
zlocal.__getattribute__c
CsF|dkrtd|jj��t|��t�|||�W5QR�SQRXdS�Nrz+%r object attribute '__dict__' is read-only)�AttributeError�	__class__r r-r&r))r
r3�valuerrrr)�s��
zlocal.__setattr__c
CsD|dkrtd|jj��t|��t�||�W5QR�SQRXdSr4)r5r6r r-r&�__delattr__r2rrrr8�s��
zlocal.__delattr__N)r r!r"r$r/r'r)r8rrrrr�s
)rr0N)r#�weakrefr�
contextlibr�__all__rr-rZ	threadingrr0rrrr�<module>s,

&sre_constants.cpython-38.opt-1.pyc000064400000014331150335716500013027 0ustar00U

e5d��@sDdZdZddlmZmZGdd�de�ZGdd�de�Zeed�Zd	d
�Z	e	d�Z
e
dd
�=e	d�Ze	d�Ze
eeeiZe
eeeiZe
eeeiZeeeeiZeeee iZ!ee"ee#iZ$e%e%e&e&e'e'e(e(e)e*e+e,e-e-e.e.iZ/e%e0e&e1e'e2e(e3e)e4e+e5e-e6e.e7iZ8dZ9dZ:dZ;dZ<dZ=dZ>dZ?dZ@dZAdZBdZCdZDeEdk�r@dd�ZFeGdd���ZHeH�Id�eH�Ide�eFeHe
d �eFeHed!�eFeHed!�eH�Id"e9�eH�Id#e:�eH�Id$e;�eH�Id%e<�eH�Id&e=�eH�Id'e>�eH�Id(e?�eH�Id)e@�eH�Id*eA�eH�Id+eB�eH�Id,eC�eH�Id-eD�W5QRXeJd.�d
S)/zInternal support module for srei��3�)�	MAXREPEAT�	MAXGROUPScs&eZdZdZdZd�fdd�	Z�ZS)�erroraiException raised for invalid regular expressions.

    Attributes:

        msg: The unformatted error message
        pattern: The regular expression pattern
        pos: The index in the pattern where compilation failed (may be None)
        lineno: The line corresponding to pos (may be None)
        colno: The column corresponding to pos (may be None)
    �reNcs�||_||_||_|dk	r�|dk	r�d||f}t|t�r>d}nd}|�|d|�d|_||�|d|�|_||kr�d||j|jf}nd|_|_t	��
|�dS)Nz%s at position %d�
�
r�z%s (line %d, column %d))�msg�pattern�pos�
isinstance�str�count�lineno�rfind�colno�super�__init__)�selfr	r
r�newline��	__class__��%/usr/lib64/python3.8/sre_constants.pyr%s
zerror.__init__)NN)�__name__�
__module__�__qualname__�__doc__r�
__classcell__rrrrrsrcs$eZdZ�fdd�Zdd�Z�ZS)�_NamedIntConstantcstt|��||�}||_|S�N)rr�__new__�name)�cls�valuer"rrrrr!9sz_NamedIntConstant.__new__cCs|jSr �r")rrrr�__repr__>sz_NamedIntConstant.__repr__)rrrr!r&rrrrrr8srrcCs8|����}dd�t|�D�}t��dd�|D��|S)NcSsg|]\}}t||��qSr)r)�.0�ir"rrr�
<listcomp>Esz_makecodes.<locals>.<listcomp>cSsi|]}|j|�qSrr%)r'�itemrrr�
<dictcomp>Fsz_makecodes.<locals>.<dictcomp>)�strip�split�	enumerate�globals�update)�names�itemsrrr�
_makecodesCsr3az
    FAILURE SUCCESS

    ANY ANY_ALL
    ASSERT ASSERT_NOT
    AT
    BRANCH
    CALL
    CATEGORY
    CHARSET BIGCHARSET
    GROUPREF GROUPREF_EXISTS
    IN
    INFO
    JUMP
    LITERAL
    MARK
    MAX_UNTIL
    MIN_UNTIL
    NOT_LITERAL
    NEGATE
    RANGE
    REPEAT
    REPEAT_ONE
    SUBPATTERN
    MIN_REPEAT_ONE

    GROUPREF_IGNORE
    IN_IGNORE
    LITERAL_IGNORE
    NOT_LITERAL_IGNORE

    GROUPREF_LOC_IGNORE
    IN_LOC_IGNORE
    LITERAL_LOC_IGNORE
    NOT_LITERAL_LOC_IGNORE

    GROUPREF_UNI_IGNORE
    IN_UNI_IGNORE
    LITERAL_UNI_IGNORE
    NOT_LITERAL_UNI_IGNORE
    RANGE_UNI_IGNORE

    MIN_REPEAT MAX_REPEAT
���Nz�
    AT_BEGINNING AT_BEGINNING_LINE AT_BEGINNING_STRING
    AT_BOUNDARY AT_NON_BOUNDARY
    AT_END AT_END_LINE AT_END_STRING

    AT_LOC_BOUNDARY AT_LOC_NON_BOUNDARY

    AT_UNI_BOUNDARY AT_UNI_NON_BOUNDARY
a�
    CATEGORY_DIGIT CATEGORY_NOT_DIGIT
    CATEGORY_SPACE CATEGORY_NOT_SPACE
    CATEGORY_WORD CATEGORY_NOT_WORD
    CATEGORY_LINEBREAK CATEGORY_NOT_LINEBREAK

    CATEGORY_LOC_WORD CATEGORY_LOC_NOT_WORD

    CATEGORY_UNI_DIGIT CATEGORY_UNI_NOT_DIGIT
    CATEGORY_UNI_SPACE CATEGORY_UNI_NOT_SPACE
    CATEGORY_UNI_WORD CATEGORY_UNI_NOT_WORD
    CATEGORY_UNI_LINEBREAK CATEGORY_UNI_NOT_LINEBREAK
r����� �@���__main__cCs*t|�}|D]}|�d|||f�qdS)Nz#define %s_%s %d
)�sorted�write)�f�d�prefixr2r*rrr�dump�srCzsre_constants.h�wao/*
 * Secret Labs' Regular Expression Engine
 *
 * regular expression matching engine
 *
 * NOTE: This file is generated by sre_constants.py.  If you need
 * to change anything in here, edit sre_constants.py and run it.
 *
 * Copyright (c) 1997-2001 by Secret Labs AB.  All rights reserved.
 *
 * See the _sre.c file for information on usage and redistribution.
 */

z#define SRE_MAGIC %d
ZSRE_OPZSREz#define SRE_FLAG_TEMPLATE %d
z#define SRE_FLAG_IGNORECASE %d
z#define SRE_FLAG_LOCALE %d
z#define SRE_FLAG_MULTILINE %d
z#define SRE_FLAG_DOTALL %d
z#define SRE_FLAG_UNICODE %d
z#define SRE_FLAG_VERBOSE %d
z#define SRE_FLAG_DEBUG %d
z#define SRE_FLAG_ASCII %d
z#define SRE_INFO_PREFIX %d
z#define SRE_INFO_LITERAL %d
z#define SRE_INFO_CHARSET %d
Zdone)Kr�MAGIC�_srerr�	Exceptionr�intrr3�OPCODES�ATCODES�CHCODES�LITERAL�LITERAL_IGNORE�NOT_LITERAL�NOT_LITERAL_IGNORE�	OP_IGNORE�LITERAL_LOC_IGNORE�NOT_LITERAL_LOC_IGNORE�OP_LOCALE_IGNORE�LITERAL_UNI_IGNORE�NOT_LITERAL_UNI_IGNORE�OP_UNICODE_IGNORE�AT_BEGINNINGZAT_BEGINNING_LINE�AT_ENDZAT_END_LINE�AT_MULTILINEZAT_BOUNDARYZAT_LOC_BOUNDARYZAT_NON_BOUNDARYZAT_LOC_NON_BOUNDARY�	AT_LOCALEZAT_UNI_BOUNDARYZAT_UNI_NON_BOUNDARY�
AT_UNICODEZCATEGORY_DIGITZCATEGORY_NOT_DIGITZCATEGORY_SPACEZCATEGORY_NOT_SPACEZ
CATEGORY_WORDZCATEGORY_LOC_WORDZCATEGORY_NOT_WORDZCATEGORY_LOC_NOT_WORDZCATEGORY_LINEBREAKZCATEGORY_NOT_LINEBREAK�	CH_LOCALEZCATEGORY_UNI_DIGITZCATEGORY_UNI_NOT_DIGITZCATEGORY_UNI_SPACEZCATEGORY_UNI_NOT_SPACEZCATEGORY_UNI_WORDZCATEGORY_UNI_NOT_WORDZCATEGORY_UNI_LINEBREAKZCATEGORY_UNI_NOT_LINEBREAK�
CH_UNICODE�SRE_FLAG_TEMPLATE�SRE_FLAG_IGNORECASE�SRE_FLAG_LOCALE�SRE_FLAG_MULTILINE�SRE_FLAG_DOTALL�SRE_FLAG_UNICODE�SRE_FLAG_VERBOSE�SRE_FLAG_DEBUG�SRE_FLAG_ASCII�SRE_INFO_PREFIX�SRE_INFO_LITERAL�SRE_INFO_CHARSETrrC�openr@r?�printrrrr�<module>s�!	
,
��������

ssl.cpython-38.opt-1.pyc000064400000127066150335716500010755 0ustar00U

e5dH��
@s�dZddlZddlZddlmZddlmZmZ	m
ZddlZddlm
Z
mZmZddlmZmZmZddlmZmZmZmZmZmZmZddlmZmZdd	lmZmZm Z m!Z!zdd
lm"Z"Wne#k
r�YnXddlm$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-ddlm.Z.m/Z/e	j0d
e1dd�ed�ej0de1dd�ed�e	j0de1dd�ed�e	j0de1dd�ed�ej0de1dd�ed�e	j0de1dd�ed�e2j3Z4e2_4dd�e2j5�6�D�Z7e8e2dd�Z9Gdd�de	�Z:Gd d!�d!e	�Z;Gd"d#�d#e	�Z<Gd$d%�d%e	�Z=ej>d&k�r"dd'lm?Z?m@Z@dd(lAmAZAmBZBmCZCmDZDdd)lAmEZEmFZFddlAZGddlHZHddlIZIddlJZJeKZLd*gZMeNed+�ZOe.ZPeZQd,d-�ZRd.d/�ZSd0d1�ZTd2d3�ZUed4d5�ZVd6d7�ZWGd8d9�d9ed9d:��ZXGd;d<�d<eXe�ZYGd=d>�d>e�ZZeYj[fdddd?�d@dA�Z\e3fe]dBeYj[ddddddC�dDdE�Z^e\Z_e^Z`GdFdG�dG�ZadHdI�ZbGdJdK�dKeA�ZceceZ_deaeZ_edddBe]e3ddLdLdf	dMdN�ZfdOdP�ZgdQZhdRZidSdT�ZjdUdV�Zke3dfdWdX�ZldYdZ�ZmdS)[a�
This module provides some more Pythonic support for SSL.

Object types:

  SSLSocket -- subtype of socket.socket which does SSL over the socket

Exceptions:

  SSLError -- exception raised for I/O errors

Functions:

  cert_time_to_seconds -- convert time string used for certificate
                          notBefore and notAfter functions to integer
                          seconds past the Epoch (the time values
                          returned from time.time())

  fetch_server_certificate (HOST, PORT) -- fetch the certificate provided
                          by the server running on HOST at port PORT.  No
                          validation of the certificate is performed.

Integer constants:

SSL_ERROR_ZERO_RETURN
SSL_ERROR_WANT_READ
SSL_ERROR_WANT_WRITE
SSL_ERROR_WANT_X509_LOOKUP
SSL_ERROR_SYSCALL
SSL_ERROR_SSL
SSL_ERROR_WANT_CONNECT

SSL_ERROR_EOF
SSL_ERROR_INVALID_ERROR_CODE

The following group define certificate requirements that one side is
allowing/requiring from the other side:

CERT_NONE - no certificates from the other side are required (or will
            be looked at if provided)
CERT_OPTIONAL - certificates are not required, but if provided will be
                validated, and if validation fails, the connection will
                also fail
CERT_REQUIRED - certificates are required, and will be validated, and
                if validation fails, the connection will also fail

The following constants identify various SSL protocol variants:

PROTOCOL_SSLv2
PROTOCOL_SSLv3
PROTOCOL_SSLv23
PROTOCOL_TLS
PROTOCOL_TLS_CLIENT
PROTOCOL_TLS_SERVER
PROTOCOL_TLSv1
PROTOCOL_TLSv1_1
PROTOCOL_TLSv1_2

The following constants identify various SSL alert message descriptions as per
http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-6

ALERT_DESCRIPTION_CLOSE_NOTIFY
ALERT_DESCRIPTION_UNEXPECTED_MESSAGE
ALERT_DESCRIPTION_BAD_RECORD_MAC
ALERT_DESCRIPTION_RECORD_OVERFLOW
ALERT_DESCRIPTION_DECOMPRESSION_FAILURE
ALERT_DESCRIPTION_HANDSHAKE_FAILURE
ALERT_DESCRIPTION_BAD_CERTIFICATE
ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE
ALERT_DESCRIPTION_CERTIFICATE_REVOKED
ALERT_DESCRIPTION_CERTIFICATE_EXPIRED
ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN
ALERT_DESCRIPTION_ILLEGAL_PARAMETER
ALERT_DESCRIPTION_UNKNOWN_CA
ALERT_DESCRIPTION_ACCESS_DENIED
ALERT_DESCRIPTION_DECODE_ERROR
ALERT_DESCRIPTION_DECRYPT_ERROR
ALERT_DESCRIPTION_PROTOCOL_VERSION
ALERT_DESCRIPTION_INSUFFICIENT_SECURITY
ALERT_DESCRIPTION_INTERNAL_ERROR
ALERT_DESCRIPTION_USER_CANCELLED
ALERT_DESCRIPTION_NO_RENEGOTIATION
ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION
ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
ALERT_DESCRIPTION_UNRECOGNIZED_NAME
ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE
ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE
ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY
�N)�
namedtuple)�Enum�IntEnum�IntFlag)�OPENSSL_VERSION_NUMBER�OPENSSL_VERSION_INFO�OPENSSL_VERSION)�_SSLContext�	MemoryBIO�
SSLSession)�SSLError�SSLZeroReturnError�SSLWantReadError�SSLWantWriteError�SSLSyscallError�SSLEOFError�SSLCertVerificationError)�txt2obj�nid2obj)�RAND_status�RAND_add�
RAND_bytes�RAND_pseudo_bytes)�RAND_egd)
�HAS_SNI�HAS_ECDH�HAS_NPN�HAS_ALPN�	HAS_SSLv2�	HAS_SSLv3�	HAS_TLSv1�HAS_TLSv1_1�HAS_TLSv1_2�HAS_TLSv1_3)�_DEFAULT_CIPHERS�_OPENSSL_API_VERSION�
_SSLMethodcCs|�d�o|dkS)NZ	PROTOCOL_�PROTOCOL_SSLv23��
startswith��name�r,�/usr/lib64/python3.8/ssl.py�<lambda>|�r.)�source�OptionscCs
|�d�S)NZOP_r(r*r,r,r-r.�r/ZAlertDescriptioncCs
|�d�S)NZALERT_DESCRIPTION_r(r*r,r,r-r.�r/ZSSLErrorNumbercCs
|�d�S)NZ
SSL_ERROR_r(r*r,r,r-r.�r/�VerifyFlagscCs
|�d�S)NZVERIFY_r(r*r,r,r-r.�r/�
VerifyModecCs
|�d�S)NZCERT_r(r*r,r,r-r.�r/cCsi|]\}}||�qSr,r,)�.0r+�valuer,r,r-�
<dictcomp>�sr6ZPROTOCOL_SSLv2c@s6eZdZejZejZejZ	ej
ZejZ
ejZejZdS)�
TLSVersionN)�__name__�
__module__�__qualname__�_sslZPROTO_MINIMUM_SUPPORTEDZMINIMUM_SUPPORTEDZPROTO_SSLv3�SSLv3ZPROTO_TLSv1ZTLSv1Z
PROTO_TLSv1_1ZTLSv1_1Z
PROTO_TLSv1_2ZTLSv1_2Z
PROTO_TLSv1_3ZTLSv1_3ZPROTO_MAXIMUM_SUPPORTEDZMAXIMUM_SUPPORTEDr,r,r,r-r7�sr7c@s(eZdZdZdZdZdZdZdZdZ	dS)	�_TLSContentTypez@Content types (record layer)

    See RFC 8446, section B.1
    ������N)
r8r9r:�__doc__�CHANGE_CIPHER_SPEC�ALERTZ	HANDSHAKEZAPPLICATION_DATA�HEADERZINNER_CONTENT_TYPEr,r,r,r-r=�sr=c@s�eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$S)%�
_TLSAlertTypezQAlert types for TLSContentType.ALERT messages

    See RFC 8466, section B.2
    r�
r>r?r@��(�)�*�+�,�-�.�/�0�1�2�3�<�F�G�P�V�Z�d�m�n�o�p�q�r�s�t�xN)&r8r9r:rDZCLOSE_NOTIFYZUNEXPECTED_MESSAGEZBAD_RECORD_MACZDECRYPTION_FAILEDZRECORD_OVERFLOWZDECOMPRESSION_FAILUREZHANDSHAKE_FAILUREZNO_CERTIFICATEZBAD_CERTIFICATEZUNSUPPORTED_CERTIFICATEZCERTIFICATE_REVOKEDZCERTIFICATE_EXPIREDZCERTIFICATE_UNKNOWNZILLEGAL_PARAMETERZ
UNKNOWN_CAZ
ACCESS_DENIEDZDECODE_ERRORZ
DECRYPT_ERRORZEXPORT_RESTRICTIONZPROTOCOL_VERSIONZINSUFFICIENT_SECURITYZINTERNAL_ERRORZINAPPROPRIATE_FALLBACKZ
USER_CANCELEDZNO_RENEGOTIATIONZMISSING_EXTENSIONZUNSUPPORTED_EXTENSIONZCERTIFICATE_UNOBTAINABLEZUNRECOGNIZED_NAMEZBAD_CERTIFICATE_STATUS_RESPONSEZBAD_CERTIFICATE_HASH_VALUEZUNKNOWN_PSK_IDENTITYZCERTIFICATE_REQUIREDZNO_APPLICATION_PROTOCOLr,r,r,r-rH�sFrHc@sheZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdS)�_TLSMessageTypezFMessage types (handshake protocol)

    See RFC 8446, section B.3
    r����������
���r>r?r@rA��C�rCN)r8r9r:rDZ
HELLO_REQUESTZCLIENT_HELLOZSERVER_HELLOZHELLO_VERIFY_REQUESTZNEWSESSION_TICKETZEND_OF_EARLY_DATAZHELLO_RETRY_REQUESTZENCRYPTED_EXTENSIONSZCERTIFICATEZSERVER_KEY_EXCHANGEZCERTIFICATE_REQUESTZSERVER_DONEZCERTIFICATE_VERIFYZCLIENT_KEY_EXCHANGEZFINISHEDZCERTIFICATE_URLZCERTIFICATE_STATUSZSUPPLEMENTAL_DATAZ
KEY_UPDATEZ
NEXT_PROTOZMESSAGE_HASHrEr,r,r,r-rg�s.rg�win32)�enum_certificates�	enum_crls)�socket�AF_INET�SOCK_STREAM�create_connection)�
SOL_SOCKET�SO_TYPE�
tls-unique�HOSTFLAG_NEVER_CHECK_SUBJECTcCs�|sdS|�d�}|s&|��|��kS|dkr<td�|���|�d�\}}}d|krbtd�|���|sttd�|���|dkr�td�|���|�d�\}}}|r�|s�dS|��|��kS)	a�Matching according to RFC 6125, section 6.4.3

    - Hostnames are compared lower case.
    - For IDNA, both dn and hostname must be encoded as IDN A-label (ACE).
    - Partial wildcards like 'www*.example.org', multiple wildcards, sole
      wildcard or wildcards in labels other then the left-most label are not
      supported and a CertificateError is raised.
    - A wildcard must match at least one character.
    F�*rhz1too many wildcards in certificate DNS name: {!r}.�.z9wildcard can only be present in the leftmost label: {!r}.z>sole wildcard without additional labels are not support: {!r}.z<partial wildcards in leftmost label are not supported: {!r}.)�count�lower�CertificateError�format�	partition)Zdn�hostnameZ	wildcardsZdn_leftmost�sepZdn_remainderZhostname_leftmostZhostname_remainderr,r,r-�_dnsname_matchs@

�������r�cCs�zt�|�}Wntk
r"Yn"Xt�|�|kr6|Std�|���zt�tj|�WStk
rvtd�|���Yntk
r�YnXtd�|���dS)z�Try to convert an IP address to packed binary form

    Supports IPv4 addresses on all platforms and IPv6 on platforms with IPv6
    support.
    z'{!r} is not a quad-dotted IPv4 address.z+{!r} is neither an IPv4 nor an IP6 address.z{!r} is not an IPv4 address.N)	�_socketZ	inet_aton�OSErrorZ	inet_ntoa�
ValueErrorr�Z	inet_ptonZAF_INET6�AttributeError)Zipname�addrr,r,r-�_inet_patonDs$��
r�cCst|���}||kS)z�Exact matching of IP addresses.

    RFC 6125 explicitly doesn't define an algorithm for this
    (section 1.7.2 - "Out of Scope").
    )r��rstrip)Zcert_ipaddress�host_ipZipr,r,r-�_ipaddress_matchgsr�cCsJ|std��zt|�}Wntk
r0d}YnXg}|�dd�}|D]^\}}|dkrz|dkrnt||�rndS|�|�qF|dkrF|dk	r�t||�r�dS|�|�qF|s�|�dd�D]6}|D],\}}|dkr�t||�r�dS|�|�q�q�t|�d	k�rtd
|d�t	t
|��f��n,t|�d	k�r>td||d
f��ntd��dS)a�Verify that *cert* (in decoded format as returned by
    SSLSocket.getpeercert()) matches the *hostname*.  RFC 2818 and RFC 6125
    rules are followed.

    The function matches IP addresses rather than dNSNames if hostname is a
    valid ipaddress string. IPv4 addresses are supported on all platforms.
    IPv6 addresses are supported on platforms with IPv6 support (AF_INET6
    and inet_pton).

    CertificateError is raised on failure. On success, the function
    returns nothing.
    ztempty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIREDNZsubjectAltNamer,ZDNSz
IP AddressZsubjectZ
commonNamerhz&hostname %r doesn't match either of %sz, zhostname %r doesn't match %rrz=no appropriate commonName or subjectAltName fields were found)r�r��getr��appendr��lenr��join�map�repr)�certr�r�ZdnsnamesZsan�keyr5�subr,r,r-�match_hostnamessB


�
�r��DefaultVerifyPathszQcafile capath openssl_cafile_env openssl_cafile openssl_capath_env openssl_capathcCsdt��}tj�|d|d�}tj�|d|d�}ttj�|�rF|ndtj�|�rX|ndf|��S)z/Return paths to default cafile and capath.
    rrhrirjN)	r;�get_default_verify_paths�os�environr�r��path�isfile�isdir)�parts�cafile�capathr,r,r-r��s��r�csDeZdZdZdZ�fdd�Ze�fdd��Ze�fdd��Z�Z	S)	�_ASN1Objectz#ASN.1 object identifier lookup
    r,cst�j|ft|dd���S)NFr*��super�__new__�_txt2obj)�cls�oid��	__class__r,r-r��sz_ASN1Object.__new__cst�j|ft|���S)z3Create _ASN1Object from OpenSSL numeric ID
        )r�r��_nid2obj)r�Znidr�r,r-�fromnid�sz_ASN1Object.fromnidcst�j|ft|dd���S)z=Create _ASN1Object from short name, long name or OID
        Tr*r�)r�r+r�r,r-�fromname�sz_ASN1Object.fromname)
r8r9r:rD�	__slots__r��classmethodr�r��
__classcell__r,r,r�r-r��sr�znid shortname longname oidc@seZdZdZdZdZdS)�PurposezDSSLContext purpose flags with X509v3 Extended Key Usage objects
    z1.3.6.1.5.5.7.3.1z1.3.6.1.5.5.7.3.2N)r8r9r:rD�SERVER_AUTHZCLIENT_AUTHr,r,r,r-r��sr�cs�eZdZdZdZdZdZefdd�Zdd�Z	d2d
d�Z
d3dd
�Zdd�Zdd�Z
dd�Zdd�Zejfdd�Zeed�r�e�fdd��Zej�fdd��Ze�fdd��Zej�fdd��Ze�fdd ��Zej�fd!d ��Zeed"��red#d$��Zejd%d$��Zned&d$��Ze�fd'd(��Zej�fd)d(��Ze�fd*d+��Ze�fd,d-��Zej�fd.d-��Ze�fd/d0��Zej�fd1d0��Z�Z S)4�
SSLContextz|An SSLContext holds various SSL-related configuration options and
    data, such as certificates and possibly a private key.)ZCAZROOTNcOst�||�}|S�N)r	r�)r��protocol�args�kwargs�selfr,r,r-r��szSSLContext.__new__cCs4|dkrdSt|t�r&|�d��d�S|�d�SdS)NZidna�ascii)�
isinstance�str�encode�decode)r�r�r,r,r-�_encode_hostname�s

zSSLContext._encode_hostnameFTc	Cs|jj|||||||d�S)N)�sock�server_side�do_handshake_on_connect�suppress_ragged_eofs�server_hostname�context�session)�sslsocket_class�_create)r�r�r�r�r�r�r�r,r,r-�wrap_socket�s�zSSLContext.wrap_socketcCs|jj||||�|�||d�S)N)r�r�r�r�)�sslobject_classr�r�)r��incoming�outgoingr�r�r�r,r,r-�wrap_bio�s�zSSLContext.wrap_biocCs`t�}|D]F}t|d�}t|�dks0t|�dkr8td��|�t|��|�|�q
|�|�dS)Nr�r�z(NPN protocols must be 1 to 255 in length)�	bytearray�bytesr�rr��extendZ_set_npn_protocols)r�Z
npn_protocols�protosr��br,r,r-�set_npn_protocolss
zSSLContext.set_npn_protocolscs8�dkrd�_n$t��s td����fdd�}|�_dS)Nznot a callable objectcs��|�}�|||�Sr�)r�)�sslobjZ
servernameZsslctx�r��server_name_callbackr,r-�shim_cbs
z3SSLContext.set_servername_callback.<locals>.shim_cb)Zsni_callback�callable�	TypeError)r�r�r�r,r�r-�set_servername_callbacksz"SSLContext.set_servername_callbackcCs`t�}|D]F}t|d�}t|�dks0t|�dkr8td��|�t|��|�|�q
|�|�dS)Nr�rr�z)ALPN protocols must be 1 to 255 in length)r�r�r�rr�r�Z_set_alpn_protocols)r�Zalpn_protocolsr�r�r�r,r,r-�set_alpn_protocols s
zSSLContext.set_alpn_protocolscCsvt�}z<t|�D].\}}}|dkr|dks4|j|kr|�|�qWntk
r`t�d�YnX|rr|j|d�|S)NZx509_asnTz-unable to enumerate Windows certificate store)�cadata)r�ryr�r��PermissionError�warnings�warn�load_verify_locations)r��	storename�purposeZcertsr��encodingZtrustr,r,r-�_load_windows_store_certs+sz$SSLContext._load_windows_store_certscCs@t|t�st|��tjdkr4|jD]}|�||�q"|��dS)Nrx)r�r�r��sys�platform�_windows_cert_storesr�Zset_default_verify_paths)r�r�r�r,r,r-�load_default_certs9s


zSSLContext.load_default_certs�minimum_versioncstt�j�Sr�)r7r�r��r�r�r,r-r�BszSSLContext.minimum_versioncs4|tjkr|jtjM_ttt�j�||�dSr�)	r7r<�optionsr1ZOP_NO_SSLv3r�r�r��__set__�r�r5r�r,r-r�Fs
cstt�j�Sr�)r7r��maximum_versionr�r�r,r-r�LszSSLContext.maximum_versioncsttt�j�||�dSr�)r�r�r�r�r�r�r,r-r�Pscstt�j�Sr�)r1r�r�r�r�r,r-r�TszSSLContext.optionscsttt�j�||�dSr�)r�r�r�r�r�r�r,r-r�Xsr�cCs|jtj@}|tjkSr��Z_host_flagsr;r�)r�Zncsr,r,r-�hostname_checks_common_name]sz&SSLContext.hostname_checks_common_namecCs,|r|jtjM_n|jtjO_dSr�r�r�r,r,r-r�bscCsdS)NTr,r�r,r,r-r�iscst�j}|dk	r|jSdSdS)a9TLS message callback

        The message callback provides a debugging hook to analyze TLS
        connections. The callback is called for any TLS protocol message
        (header, handshake, alert, and more), but not for application data.
        Due to technical  limitations, the callback can't be used to filter
        traffic or to abort a connection. Any exception raised in the
        callback is delayed until the handshake, read, or write operation
        has been performed.

        def msg_cb(conn, direction, version, content_type, msg_type, data):
            pass

        conn
            :class:`SSLSocket` or :class:`SSLObject` instance
        direction
            ``read`` or ``write``
        version
            :class:`TLSVersion` enum member or int for unknown version. For a
            frame header, it's the header version.
        content_type
            :class:`_TLSContentType` enum member or int for unsupported
            content type.
        msg_type
            Either a :class:`_TLSContentType` enum number for a header
            message, a :class:`_TLSAlertType` enum member for an alert
            message, a :class:`_TLSMessageType` enum member for other
            messages, or int for unsupported message types.
        data
            Raw, decrypted message content as bytes
        N)r��
_msg_callback�
user_function)r��innerr�r,r-r�ms!zSSLContext._msg_callbackcsb�dkr ttt�j�|d�dSt�d�s8t��d����fdd�}�|_ttt�j�||�dS)N�__call__z is not callable.cs�zt|�}Wntk
r YnXzt|�}Wntk
rBYnX|tjkrTt}n|tjkrdt}nt}z||�}Wntk
r�YnX�||||||�Sr�)r7r�r=rGrFrHrg)Zconn�	direction�versionZcontent_typeZmsg_type�dataZmsg_enum��callbackr,r-r��s,

�z'SSLContext._msg_callback.<locals>.inner)r�r�r�r��hasattrr�r�)r�rr�r�rr-r��s
cstt�j�Sr�)r&r�r�r�r�r,r-r��szSSLContext.protocolcstt�j�Sr�)r2r��verify_flagsr�r�r,r-r�szSSLContext.verify_flagscsttt�j�||�dSr�)r�r�rr�r�r�r,r-r�scs0t�j}z
t|�WStk
r*|YSXdSr�)r��verify_moder3r�r�r�r,r-r�s

zSSLContext.verify_modecsttt�j�||�dSr�)r�r�rr�r�r�r,r-r�s)FTTNN)FNN)!r8r9r:rDr�r�r��PROTOCOL_TLSr�r�r�r�r�r�r�r�r�r�r�rr	�propertyr��setterr�r�r;r�r�r�rrr�r,r,r�r-r��sn�
�





&%r�)r�r�r�cCs�t|t�st|��tt�}|tjkr0t|_d|_	|s<|s<|rL|�
|||�n|jtkr`|�|�t
|d�r�tj�d�}|r�tjjs�||_|S)z�Create a SSLContext object with default settings.

    NOTE: The protocol and settings may change anytime without prior
          deprecation. The values represent a fair balance between maximum
          compatibility and security.
    T�keylog_filename�
SSLKEYLOGFILE)r�r�r�r�rr�r��
CERT_REQUIREDr�check_hostnamer��	CERT_NONEr�rr�r�r�r��flags�ignore_environmentr)r�r�r�r�r��
keylogfiler,r,r-�create_default_context�s




rF)�	cert_reqsrr��certfile�keyfiler�r�r�cCs�t|t�st|��t|�}	|s$d|	_|dk	r2||	_|r<d|	_|rL|sLtd��|sT|r`|	�||�|sl|sl|r||	�|||�n|	jt	kr�|	�
|�t|	d�r�tj
�d�}
|
r�tjjs�|
|	_|	S)a/Create a SSLContext object for Python stdlib modules

    All Python stdlib modules shall use this function to create SSLContext
    objects in order to keep common settings in one place. The configuration
    is less restrict than create_default_context()'s to increase backward
    compatibility.
    FNT�certfile must be specifiedrr	)r�r�r�r�rrr��load_cert_chainr�rr�rr�r�r�r�r
rr)r�rrr�rrr�r�r�r�rr,r,r-�_create_unverified_context�s,



rc@s�eZdZdZdd�Zed2dd��Zedd	��Zej	d
d	��Zedd��Z
e
j	d
d��Z
edd��Zedd��Zedd��Z
d3dd�Zdd�Zd4dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd5d,d-�Zd.d/�Zd0d1�ZdS)6�	SSLObjectaThis class implements an interface on top of a low-level SSL object as
    implemented by OpenSSL. This object captures the state of an SSL connection
    but does not provide any network IO itself. IO needs to be performed
    through separate "BIO" objects which are OpenSSL's IO abstraction layer.

    This class does not have a public constructor. Instances are returned by
    ``SSLContext.wrap_bio``. This class is typically used by framework authors
    that want to implement asynchronous IO for SSL through memory buffers.

    When compared to ``SSLSocket``, this object lacks the following features:

     * Any form of network IO, including methods such as ``recv`` and ``send``.
     * The ``do_handshake_on_connect`` and ``suppress_ragged_eofs`` machinery.
    cOst|jj�d���dS)NzU does not have a public constructor. Instances are returned by SSLContext.wrap_bio().�r�r�r8�r�r�r�r,r,r-�__init__;s�zSSLObject.__init__FNc	Cs*|�|�}|j||||||d�}||_|S)N)r�r��ownerr�)r�Z	_wrap_bio�_sslobj)	r�r�r�r�r�r�r�r�r�r,r,r-r�As
�zSSLObject._createcCs|jjS)z(The SSLContext that is currently in use.�rr�r�r,r,r-r�MszSSLObject.contextcCs||j_dSr�r�r�Zctxr,r,r-r�RscCs|jjS)z!The SSLSession for client socket.�rr�r�r,r,r-r�VszSSLObject.sessioncCs||j_dSr�r�r�r�r,r,r-r�[scCs|jjS)z.Was the client session reused during handshake�r�session_reusedr�r,r,r-r"_szSSLObject.session_reusedcCs|jjS)z%Whether this is a server-side socket.)rr�r�r,r,r-r�dszSSLObject.server_sidecCs|jjS)z^The currently set server hostname (for SNI), or ``None`` if no
        server hostname is set.)rr�r�r,r,r-r�iszSSLObject.server_hostname�cCs(|dk	r|j�||�}n|j�|�}|S)z�Read up to 'len' bytes from the SSL object and return them.

        If 'buffer' is provided, read into this buffer and return the number of
        bytes read.
        N)r�read)r�r��buffer�vr,r,r-r$oszSSLObject.readcCs|j�|�S)z�Write 'data' to the SSL object and return the number of bytes
        written.

        The 'data' argument must support the buffer interface.
        )r�write�r�r�r,r,r-r'{szSSLObject.writecCs|j�|�S)z�Returns a formatted version of the data in the certificate provided
        by the other end of the SSL channel.

        Return None if no certificate was provided, {} if a certificate was
        provided, but not validated.
        )r�getpeercert�r�Zbinary_formr,r,r-r)�szSSLObject.getpeercertcCstjr|j��SdS)z�Return the currently selected NPN protocol as a string, or ``None``
        if a next protocol was not negotiated or if NPN is not supported by one
        of the peers.N)r;rr�selected_npn_protocolr�r,r,r-r+�szSSLObject.selected_npn_protocolcCstjr|j��SdS)z�Return the currently selected ALPN protocol as a string, or ``None``
        if a next protocol was not negotiated or if ALPN is not supported by one
        of the peers.N)r;rr�selected_alpn_protocolr�r,r,r-r,�sz SSLObject.selected_alpn_protocolcCs
|j��S)z_Return the currently selected cipher as a 3-tuple ``(name,
        ssl_version, secret_bits)``.)r�cipherr�r,r,r-r-�szSSLObject.ciphercCs
|j��S)z�Return a list of ciphers shared by the client during the handshake or
        None if this is not a valid server connection.
        )r�shared_ciphersr�r,r,r-r.�szSSLObject.shared_cipherscCs
|j��S)z�Return the current compression algorithm in use, or ``None`` if
        compression was not negotiated or not supported by one of the peers.)r�compressionr�r,r,r-r/�szSSLObject.compressioncCs
|j��S)z8Return the number of bytes that can be read immediately.)r�pendingr�r,r,r-r0�szSSLObject.pendingcCs|j��dS)zStart the SSL/TLS handshake.N)r�do_handshaker�r,r,r-r1�szSSLObject.do_handshakecCs
|j��S)z!Start the SSL shutdown handshake.)r�shutdownr�r,r,r-�unwrap�szSSLObject.unwrapr�cCs|j�|�S)z�Get channel binding data for current connection.  Raise ValueError
        if the requested `cb_type` is not supported.  Return bytes of the data
        or None if the data is not available (e.g. before the handshake).)r�get_channel_binding�r�Zcb_typer,r,r-r4�szSSLObject.get_channel_bindingcCs
|j��S)zZReturn a string identifying the protocol version used by the
        current SSL channel. �rr�r�r,r,r-r��szSSLObject.versioncCs
|j��Sr�)r�verify_client_post_handshaker�r,r,r-r7�sz&SSLObject.verify_client_post_handshake)FNNN)r#N)F)r�)r8r9r:rDrr�r�rr�rr�r"r�r�r$r'r)r+r,r-r.r/r0r1r3r4r�r7r,r,r,r-r,sH�








	
rcCstt|j�j|_|S)z*Copy docstring from SSLObject to SSLSocket)�getattrrr8rD)�funcr,r,r-�_sslcopydoc�sr:cseZdZdZdd�ZedX�fdd�	�Zeed	d
���Z	e	j
dd
��Z	eedd
���Zej
dd
��Zeedd���Zdd�Z
dYdd�Zdd�ZdZdd�Zdd�Zed[dd��Zedd��Zed d!��Zed"d#��Zed$d%��Zed&d'��Zd\�fd)d*�	Zd]�fd+d,�	Zd-d.�Zd^�fd/d0�	Zd_�fd1d2�	Zd`�fd3d4�	Zda�fd5d6�	Zdb�fd7d8�	Zdc�fd9d:�	Z d;d<�Z!d=d>�Z"ed?d@��Z#�fdAdB�Z$edCdD��Z%edEdF��Z&�fdGdH�Z'edddIdJ��Z(�fdKdL�Z)dMdN�Z*dOdP�Z+�fdQdR�Z,ededTdU��Z-edVdW��Z.�Z/S)f�	SSLSocketz�This class implements a subtype of socket.socket that wraps
    the underlying OS socket in an SSL context when necessary, and
    provides read and write methods over that channel. cOst|jj�d���dS)NzX does not have a public constructor. Instances are returned by SSLContext.wrap_socket().rrr,r,r-r�s�zSSLSocket.__init__FTNc

s�|�tt�tkrtd��|r8|r(td��|dk	r8td��|jrJ|sJtd��t|j|j	|j
|��d�}|j|f|�}	t
t|	�jf|�|	�|���|��||	_||	_d|	_d|	_||	_|�|�|	_||	_||	_z|	��Wn6tk
�r}
z|
jtjkr��d}W5d}
~
XYnXd}||	_ |�r�zH|	jj!|	||	j|	|	jd�|	_|�rj|	��}|d	k�rbtd
��|	�"�Wn$ttfk
�r�|	�#��YnX|	S)Nz!only stream sockets are supportedz4server_hostname can only be specified in client modez,session can only be specified in client modez'check_hostname requires server_hostname)�family�type�proto�filenoFT�rr��zHdo_handshake_on_connect should not be specified for non-blocking sockets)$Z
getsockoptrr�r}�NotImplementedErrorr�r�dictr<r=r>r?r�r�r;r�
settimeout�
gettimeout�detach�_context�_sessionZ_closedrr�r�r�r�r��getpeernamer��errnoZENOTCONN�
_connected�_wrap_socketr1�close)
r�r�r�r�r�r�r�r�r�r��eZ	connected�timeoutr�r,r-r��sj
��
zSSLSocket._createcCs|jSr�)rGr�r,r,r-r�szSSLSocket.contextcCs||_||j_dSr�)rGrr�rr,r,r-r�scCs|jdk	r|jjSdSr�rr�r,r,r-r� s
zSSLSocket.sessioncCs||_|jdk	r||j_dSr�)rHrr�r r,r,r-r�&s
cCs|jdk	r|jjSdSr�r!r�r,r,r-r",s
zSSLSocket.session_reusedcCstd|jj��dS)NzCan't dup() %s instances)rBr�r8r�r,r,r-�dup2s�z
SSLSocket.dupcCsdSr�r,)r��msgr,r,r-�_checkClosed6szSSLSocket._checkClosedcCs|js|��dSr�)rKrIr�r,r,r-�_check_connected:szSSLSocket._check_connectedr#c
Cs�|��|jdkrtd��z*|dk	r4|j�||�WS|j�|�WSWnVtk
r�}z8|jdtkr�|jr�|dk	r|WY�dSWY�dSn�W5d}~XYnXdS)zORead up to LEN bytes and return them.
        Return zero-length string on EOF.Nz'Read on closed or unwrapped SSL socket.rr/)rRrr�r$rr�Z
SSL_ERROR_EOFr�)r�r�r%�xr,r,r-r$Bs

zSSLSocket.readcCs&|��|jdkrtd��|j�|�S)zhWrite DATA to the underlying SSL channel.  Returns
        number of bytes of DATA actually transmitted.Nz(Write on closed or unwrapped SSL socket.)rRrr�r'r(r,r,r-r'Ws
zSSLSocket.writecCs|��|��|j�|�Sr�)rRrSrr)r*r,r,r-r)`szSSLSocket.getpeercertcCs*|��|jdkstjsdS|j��SdSr�)rRrr;rr+r�r,r,r-r+fszSSLSocket.selected_npn_protocolcCs*|��|jdkstjsdS|j��SdSr�)rRrr;rr,r�r,r,r-r,nsz SSLSocket.selected_alpn_protocolcCs$|��|jdkrdS|j��SdSr�)rRrr-r�r,r,r-r-vs
zSSLSocket.ciphercCs$|��|jdkrdS|j��SdSr�)rRrr.r�r,r,r-r.~s
zSSLSocket.shared_cipherscCs$|��|jdkrdS|j��SdSr�)rRrr/r�r,r,r-r/�s
zSSLSocket.compressionrcsF|��|jdk	r4|dkr(td|j��|j�|�St��||�SdS)Nrz3non-zero flags not allowed in calls to send() on %s)rRrr�r�r'r��send)r�r�r
r�r,r-rU�s
��zSSLSocket.sendcsL|��|jdk	r"td|j��n&|dkr8t��||�St��|||�SdS)Nz%sendto not allowed on instances of %s)rRrr�r�r��sendto)r�r�Z
flags_or_addrr�r�r,r-rV�s
�zSSLSocket.sendtocOstd|j��dS)Nz&sendmsg not allowed on instances of %s�rBr�rr,r,r-�sendmsg�s�zSSLSocket.sendmsgc
s�|��|jdk	r�|dkr(td|j��d}t|��H}|�d��2}t|�}||krn|�||d��}||7}qJW5QRXW5QRXnt��	||�SdS)Nrz6non-zero flags not allowed in calls to sendall() on %s�B)
rRrr�r��
memoryview�castr�rUr��sendall)r�r�r
r�ZviewZ	byte_viewZamountr&r�r,r-r\�s
�� zSSLSocket.sendallcs,|jdk	r|�|||�St��|||�SdS)z�Send a file, possibly by using os.sendfile() if this is a
        clear-text socket.  Return the total number of bytes sent.
        N)rZ_sendfile_use_sendr��sendfile)r��file�offsetr�r�r,r-r]�s
zSSLSocket.sendfilecsD|��|jdk	r2|dkr(td|j��|�|�St��||�SdS)Nrz3non-zero flags not allowed in calls to recv() on %s)rRrr�r�r$r��recv�r�Zbuflenr
r�r,r-r`�s
��
zSSLSocket.recvcsj|��|r|dkrt|�}n|dkr*d}|jdk	rV|dkrJtd|j��|�||�St��|||�SdS)Nr#rz8non-zero flags not allowed in calls to recv_into() on %s)rRr�rr�r�r$r��	recv_into�r�r%�nbytesr
r�r,r-rb�s

��zSSLSocket.recv_intocs4|��|jdk	r"td|j��nt��||�SdS)Nz'recvfrom not allowed on instances of %s)rRrr�r�r��recvfromrar�r,r-re�s
�zSSLSocket.recvfromcs6|��|jdk	r"td|j��nt��|||�SdS)Nz,recvfrom_into not allowed on instances of %s)rRrr�r�r��
recvfrom_intorcr�r,r-rf�s
�zSSLSocket.recvfrom_intocOstd|j��dS)Nz&recvmsg not allowed on instances of %srWrr,r,r-�recvmsg�s�zSSLSocket.recvmsgcOstd|j��dS)Nz+recvmsg_into not allowed on instances of %srWrr,r,r-�recvmsg_into�s�zSSLSocket.recvmsg_intocCs$|��|jdk	r|j��SdSdS)Nr)rRrr0r�r,r,r-r0�s

zSSLSocket.pendingcs|��d|_t��|�dSr�)rRrr�r2)r�Zhowr�r,r-r2�szSSLSocket.shutdowncCs.|jr|j��}d|_|Stdt|���dS�NzNo SSL wrapper around )rr2r�r�)r��sr,r,r-r3s

zSSLSocket.unwrapcCs$|jr|j��Stdt|���dSri)rr7r�r�r�r,r,r-r7s
z&SSLSocket.verify_client_post_handshakecsd|_t���dSr�)rr��_real_closer�r�r,r-rkszSSLSocket._real_closec	CsF|��|��}z$|dkr(|r(|�d�|j��W5|�|�XdS)NrA)rSrErDrr1)r��blockrOr,r,r-r1s
zSSLSocket.do_handshakec	s�|jrtd��|js|jdk	r&td��|jj|d|j||jd�|_z@|rVt��	|�}nd}t��
|�|s~d|_|jr~|��|WSt
tfk
r�d|_�YnXdS)Nz!can't connect in server-side modez/attempt to connect already-connected SSLSocket!Fr@T)r�r�rKrr�rLr�rHr��
connect_ex�connectr�r1r�)r�r�rmZrcr�r,r-�
_real_connect!s0�zSSLSocket._real_connectcCs|�|d�dS)�QConnects to remote ADDR, and then wraps the connection in
        an SSL channel.FN�ro�r�r�r,r,r-rn;szSSLSocket.connectcCs|�|d�S)rpTrqrrr,r,r-rm@szSSLSocket.connect_excs.t���\}}|jj||j|jdd�}||fS)z�Accepts a new connection from a remote client, and returns
        a tuple containing that new connection wrapped with a server-side
        SSL channel, and the address of the remote client.T)r�r�r�)r��acceptr�r�r�r�)r�Znewsockr�r�r,r-rsEs�zSSLSocket.acceptr�cCs4|jdk	r|j�|�S|tkr,td�|���dSdS)Nz({0} channel binding type not implemented)rr4�CHANNEL_BINDING_TYPESr�r�r5r,r,r-r4Qs
�zSSLSocket.get_channel_bindingcCs|jdk	r|j��SdSdSr�r6r�r,r,r-r�\s

zSSLSocket.version)FTTNNN)N)r#N)F)r)N)r)rN)r#r)Nr)r#r)Nr)F)r�)0r8r9r:rDrr�r�rr:r�rr�r"rPrRrSr$r'r)r+r,r-r.r/rUrVrXr\r]r`rbrerfrgrhr0r2r3r7rkr1rornrmrsr4r�r�r,r,r�r-r;�s��>



	











r;Tc
Csl|r|std��|r |s td��t|�}
||
_|r<|
�|�|rL|
�||�|	rZ|
�|	�|
j||||d�S)Nz5certfile must be specified for server-side operationsr)r�r�r�r�)r�r�rr�rZset_ciphersr�)r�rrr�r�ssl_version�ca_certsr�r�Zciphersr�r,r,r-r�is$

�r�cCs�ddlm}ddlm}d}d}z|�|dd����d}Wn$tk
rbtd	||f��Yn0X||dd�|�}||d|f|d
d��SdS)a�Return the time in seconds since the Epoch, given the timestring
    representing the "notBefore" or "notAfter" date from a certificate
    in ``"%b %d %H:%M:%S %Y %Z"`` strptime format (C locale).

    "notBefore" or "notAfter" dates must use UTC (RFC 5280).

    Month is one of: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
    UTC should be specified as GMT (see ASN1_TIME_print())
    r)�strptime)�timegm)ZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecz %d %H:%M:%S %Y GMTNrjrhz*time data %r does not match format "%%b%s"rirm)�timerwZcalendarrx�index�titler�)Z	cert_timerwrxZmonthsZtime_formatZmonth_numberZttr,r,r-�cert_time_to_seconds�s
�r|z-----BEGIN CERTIFICATE-----z-----END CERTIFICATE-----csRtt�|�dd��tg}|�fdd�tdt��d�D�7}|�td�d�|�S)z[Takes a certificate in binary DER format and returns the
    PEM version of it as a string.�ASCII�strictcsg|]}�||d��qS)�@r,)r4�i��fr,r-�
<listcomp>�sz(DER_cert_to_PEM_cert.<locals>.<listcomp>rr�
)	r��base64Zstandard_b64encode�
PEM_HEADER�ranger�r��
PEM_FOOTERr�)Zder_cert_bytesZssr,r�r-�DER_cert_to_PEM_cert�s
"r�cCs\|�t�stdt��|���t�s0tdt��|��tt�tt��}t�|�	dd��S)zhTakes a certificate in ASCII PEM format and returns the
    DER-encoded version of it as a byte sequencez(Invalid PEM encoding; must start with %sz&Invalid PEM encoding; must end with %sr}r~)
r)r�r��strip�endswithr�r�r�Zdecodebytesr�)Zpem_cert_string�dr,r,r-�PEM_cert_to_DER_cert�s
��r�c

Csd|\}}|dk	rt}nt}t|||d�}t|��&}|�|��}|�d�}	W5QRXW5QRXt|	�S)z�Retrieve the certificate from the server at the specified address,
    and return it as a PEM-encoded string.
    If 'ca_certs' is specified, validate the server cert against it.
    If 'ssl_version' is specified, use it in the connection attempt.N)rr�T)r
r�_create_stdlib_contextr~r�r)r�)
r�rurvZhostZportrr�r�ZsslsockZdercertr,r,r-�get_server_certificate�s�
r�cCst�|d�S)Nz	<unknown>)�_PROTOCOL_NAMESr�)Z
protocol_coder,r,r-�get_protocol_name�sr�)nrDr�r��collectionsr�enumrZ_EnumrZ_IntEnumrZ_IntFlagr;rrrr	r
rrr
rrrrrrr�rr�rrrrr�ImportErrorrrrrrrr r!r"r#r$r%�	_convert_r8r&rr'�__members__�itemsr�r8Z_SSLv2_IF_EXISTSr7r=rHrgr�ryrzr{r|r}r~rr�r�r�rJr�r�Zsocket_errorrtrZHAS_NEVER_CHECK_COMMON_NAMEZ_RESTRICTED_SERVER_CIPHERSr�r�r�r�r�r�r�r�r�r�r�rrrZ_create_default_https_contextr�rr:r;r�r�r�r|r�r�r�r�r�r�r,r,r,r-�<module>s�Y$0������
)
1#9�z�#�/�


_bootlocale.cpython-38.pyc000064400000002335150335716500011466 0ustar00U

e5d	�@szdZddlZddlZej�d�r,ddd�ZnJz
ejWn4ek
rjeed�r\ddd�Zn
d
d	d�ZYnXdd
d�ZdS)z�A minimal subset of the locale module used at interpreter startup
(imported by the _io module), in order to reduce startup time.

Don't import directly from third-party code; use the `locale` module instead!
�N�winTcCstjjrdSt��dS)N�UTF-8�)�sys�flags�	utf8_mode�_localeZ_getdefaultlocale��do_setlocale�r�#/usr/lib64/python3.8/_bootlocale.py�getpreferredencodingsr
ZgetandroidapilevelcCsdS)Nrrr	rrrr
scCstjjrdSddl}|�|�S)Nrr)rrr�localer
)r
rrrrr
scCs6|rt�tjjrdSt�tj�}|s2tjdkr2d}|S)Nr�darwin)�AssertionErrorrrrr�nl_langinfo�CODESET�platform)r
�resultrrrr
!s)T)T)T)T)	�__doc__rrr�
startswithr
r�AttributeError�hasattrrrrr�<module>s

_sysconfigdata_d_linux_x86_64-linux-gnu.cpython-38.pyc000064400000070505150335716500016671 0ustar00U

��.e]���@s`dddddddddddd	d
dddd
ddddddddddddddddddddddd	dd dd!d"d#d$d%dddd&d'dd(d)d*d&d+dd!dd,d-dddddddd.d&d&d&d&dd&dd&d&d&d&d&dddddddddd&dd&d&d&d&d&d&d&d&dd&d&d&d&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&dd&dd&dd&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&d&d&dd&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&ddd&d&dd&dddd&d&d&ddd&d&dddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&d&d&dd&d&dd&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&d&d&d&d&d&ddd&d&d&dd&d&ddd&d&d&d&d&d&d&dddddd&dd&d&dddddd&ddd&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&ddd&d&d&ddd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&dd
d/ddd0d1d0d0d2d3d4dd5d6d7ddd8dd	d9dd:d;dd<d=dd>ddd?d@dAdBddd+ddCdDddEdd	dddd&dFdGdHdIdddJddKdLd&dMddddNdOdddddddddPdQdRdddSd&d&dddddTddddUdVdddWddXd&dYdZdd[d6d\d]dd^d&d&ddd_d`dadbdcd9dddded?dfd&dddgdhdidhdgdidgdgdhdhdgd]dgdgdgdgdhd&djdkdld&dmdnddod:d&dddddpddqdrdd&ddddsd&dtdud&d&d&d&dddd&d&ddvdwdudxdydydudz���Zd{S)|�d�z"cpython-38-x86_64-linux-gnu"ZarZrcsz!-Wno-unused-result -Wsign-comparez-IObjects -IInclude -IPython�z/usr/binz/usr/lib64/python3.8z-L. -lpython3.8dzOgcc -pthread -shared -Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g�pythonzx86_64-redhat-linux-gnu�\zgcc -pthreadz-fPICa{-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -Ogz?configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.ina-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvaK-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declarationz-Wl,-z,relro  -Wl,-z,now  -gz�-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -ga�'--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-ipv6' '--enable-shared' '--with-computed-gotos=yes' '--with-dbmliborder=gdbm:ndbm:bdb' '--with-system-expat' '--with-system-ffi' '--enable-loadable-sqlite-extensions' '--with-dtrace' '--with-lto' '--with-ssl-default-suites=openssl' '--with-valgrind' '--without-ensurepip' '--with-pydebug' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS= -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv ' 'LDFLAGS= -Wl,-z,relro  -Wl,-z,now  -g ' 'CPPFLAGS=' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'z/usr/includez/usr/include/python3.8dz=/builddir/build/BUILD/Python-3.8.17/build/debug/coverage.infoz;/builddir/build/BUILD/Python-3.8.17/build/debug/lcov-reportz2--no-branch-coverage --title "CPython lcov report"zN-IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Includezg++ -pthreadzE/usr /usr/lib64 /usr/lib64/python3.8 /usr/lib64/python3.8/lib-dynloadz /usr/lib64/python3.8/lib-dynloadi�zoREADME.rst ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Ext-dummyzInclude Lib Misc Ext-dummyzTREADME.rst ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in�.�z/usr/bin/dtracezInclude/pydtrace_probes.hzPython/pydtrace.ozdynload_shlib.oZnoz .cpython-38d-x86_64-linux-gnu.soi�ZyeszI/usr/include /usr/include /usr/include/python3.8d /usr/include/python3.8dz/usr/bin/install -cz/usr/bin/install -c -m 644z/usr/bin/install -c -m 755zlibpython3.8d.so.1.0zModules/_io/_iomodule.hzg++ -pthread -sharedz:-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -gzlibpython3.8d.soz3.8dz
/usr/lib64z-lmzPython/z/usr/lib64/pkgconfigz1/usr/lib64/python3.8/config-3.8d-x86_64-linux-gnuzlibpython3.8d.az"-lcrypt -lpthread -ldl  -lutil -lmz0tkinter tkinter/test tkinter/test/test_tkinter \Zgccz-Xlinker -export-dynamic�trueZlnZlinuxz5/builddir/build/BUILD/Python-3.8.17/Modules/makesetupz/usr/share/manz/usr/bin/mkdir -pz�posix  errno  pwd  _sre  _codecs  _weakref  _functools  _operator  _collections  _abc  itertools  atexit  _signal  _stat  time  _thread  _locale  _io  faulthandler  _tracemalloc  _symtable  xxsubtypeavModules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/_abc.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_threadmodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  Modules/symtablemodule.o  Modules/xxsubtype.ozx86_64-linux-gnuz -DMULTIARCH=\"x86_64-linux-gnu\"z-Wl,--no-as-neededz-lssl -lcryptoa1-DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz:\ Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.oz-fprofile-generatez"-fprofile-use -fprofile-correctionz
-m test --pgozno-frameworkz./python -Ez	python3.8a�-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -Og -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Og -I/builddir/build/BUILD/Python-3.8.17/Include/internal -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Include -fPIC -DPy_BUILD_CORE_BUILTINa-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Og -I/builddir/build/BUILD/Python-3.8.17/Include/internala�-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -Og -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Og -I/builddir/build/BUILD/Python-3.8.17/Include/internal -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Include -fPIC -DPy_BUILD_COREaT-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g -lcryptoz"z"a-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g�a�-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -Og -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Og -I/builddir/build/BUILD/Python-3.8.17/Include/internal -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Include -fPICz)-x test_subprocess test_io test_lib2to3 \ZreadelfzMac/Resources/frameworkZvoidz?LD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.8.17/build/debugz	@SGI_ABI@z/bin/shz.so���zcpython-38d-x86_64-linux-gnuz2Parser Objects Python Modules Modules/_io Programsz:/builddir/build/BUILD/Python-3.8.17/Tools/gdb/libpython.pyz"/* Don't use ncurses extensions */z-szInclude Lib MisczHLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.8.17/build/debug ./pythonz�LD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.8.17/build/debug ./python /builddir/build/BUILD/Python-3.8.17/Tools/scripts/run_tests.pyi�zJpython3.8 /builddir/build/BUILD/Python-3.8.17/Tools/scripts/update_file.pyz3.8z#/builddir/build/BUILD/Python-3.8.17z)xml xml/dom xml/etree xml/parsers xml/saxz//builddir/build/BUILD/Python-3.8.17/build/debugz
/usr/sharez/usr(�ZABIFLAGSZAC_APPLE_UNIVERSAL_BUILDZAIX_GENUINE_CPLUSPLUSZ	ALT_SOABIZANDROID_API_LEVELZARZARFLAGSZ
BASECFLAGSZBASECPPFLAGSZBASEMODLIBSZBINDIRZ
BINLIBDESTZ
BLDLIBRARYZ	BLDSHAREDZBUILDEXEZBUILDPYTHONZBUILD_GNU_TYPEZBYTESTR_DEPSZCCZCCSHAREDZCFLAGSZCFLAGSFORSHAREDZCFLAGS_ALIASINGZCONFIGFILESZCONFIGURE_CFLAGSZCONFIGURE_CFLAGS_NODISTZCONFIGURE_CPPFLAGSZCONFIGURE_LDFLAGSZCONFIGURE_LDFLAGS_NODISTZCONFIG_ARGSZCONFINCLUDEDIRZ
CONFINCLUDEPYZCOREPYTHONPATHZ
COVERAGE_INFOZCOVERAGE_REPORTZCOVERAGE_REPORT_OPTIONSZCPPFLAGSZCXXZDESTDIRSZDESTLIBZDESTPATHZ
DESTSHAREDZDFLAGSZDIRMODEZDISTZDISTDIRSZ	DISTFILESZ	DLINCLDIRZ
DLLLIBRARYZ"DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754ZDOUBLE_IS_BIG_ENDIAN_IEEE754ZDOUBLE_IS_LITTLE_ENDIAN_IEEE754ZDTRACEZDTRACE_DEPSZDTRACE_HEADERSZDTRACE_OBJSZDYNLOADFILEZENABLE_IPV6Z	ENSUREPIPZEXEZEXEMODEZ
EXTRATESTOPTSZ
EXT_SUFFIXZFILEMODEZFLOAT_WORDS_BIGENDIANZFLOCK_NEEDS_LIBBSDZGETPGRP_HAVE_ARGZGETTIMEOFDAY_NO_TZZ	GITBRANCHZGITTAGZ
GITVERSIONZGNULDZHAVE_ACCEPT4Z
HAVE_ACOSHZ
HAVE_ADDRINFOZ
HAVE_ALARMZHAVE_ALIGNED_REQUIREDZ
HAVE_ALLOCA_HZHAVE_ALTZONEZ
HAVE_ASINHZHAVE_ASM_TYPES_HZ
HAVE_ATANHZHAVE_BIND_TEXTDOMAIN_CODESETZHAVE_BLUETOOTH_BLUETOOTH_HZHAVE_BLUETOOTH_HZHAVE_BROKEN_MBSTOWCSZHAVE_BROKEN_NICEZHAVE_BROKEN_PIPE_BUFZHAVE_BROKEN_POLLZHAVE_BROKEN_POSIX_SEMAPHORESZHAVE_BROKEN_PTHREAD_SIGMASKZHAVE_BROKEN_SEM_GETVALUEZHAVE_BROKEN_UNSETENVZHAVE_BUILTIN_ATOMICZHAVE_CHFLAGSZ
HAVE_CHOWNZHAVE_CHROOTZ
HAVE_CLOCKZHAVE_CLOCK_GETRESZHAVE_CLOCK_GETTIMEZHAVE_CLOCK_SETTIMEZHAVE_COMPUTED_GOTOSZHAVE_CONFSTRZHAVE_CONIO_HZ
HAVE_COPYSIGNZHAVE_COPY_FILE_RANGEZHAVE_CRYPT_HZHAVE_CRYPT_RZHAVE_CTERMIDZHAVE_CTERMID_RZHAVE_CURSES_FILTERZ
HAVE_CURSES_HZHAVE_CURSES_HAS_KEYZHAVE_CURSES_IMMEDOKZHAVE_CURSES_IS_PADZHAVE_CURSES_IS_TERM_RESIZEDZHAVE_CURSES_RESIZETERMZHAVE_CURSES_RESIZE_TERMZHAVE_CURSES_SYNCOKZHAVE_CURSES_TYPEAHEADZHAVE_CURSES_USE_ENVZHAVE_CURSES_WCHGATZHAVE_DECL_ISFINITEZHAVE_DECL_ISINFZHAVE_DECL_ISNANZHAVE_DECL_RTLD_DEEPBINDZHAVE_DECL_RTLD_GLOBALZHAVE_DECL_RTLD_LAZYZHAVE_DECL_RTLD_LOCALZHAVE_DECL_RTLD_MEMBERZHAVE_DECL_RTLD_NODELETEZHAVE_DECL_RTLD_NOLOADZHAVE_DECL_RTLD_NOWZHAVE_DECL_TZNAMEZHAVE_DEVICE_MACROSZHAVE_DEV_PTCZ
HAVE_DEV_PTMXZ
HAVE_DIRECT_HZHAVE_DIRENT_D_TYPEZ
HAVE_DIRENT_HZ
HAVE_DIRFDZHAVE_DLFCN_HZHAVE_DLOPENZ	HAVE_DUP2Z	HAVE_DUP3Z$HAVE_DYLD_SHARED_CACHE_CONTAINS_PATHZHAVE_DYNAMIC_LOADINGZ
HAVE_ENDIAN_HZ
HAVE_EPOLLZHAVE_EPOLL_CREATE1ZHAVE_ERFZ	HAVE_ERFCZHAVE_ERRNO_HZ
HAVE_EXECVZHAVE_EXPLICIT_BZEROZHAVE_EXPLICIT_MEMSETZ
HAVE_EXPM1ZHAVE_FACCESSATZHAVE_FCHDIRZHAVE_FCHMODZ
HAVE_FCHMODATZHAVE_FCHOWNZ
HAVE_FCHOWNATZHAVE_FCNTL_HZHAVE_FDATASYNCZHAVE_FDOPENDIRZHAVE_FDWALKZHAVE_FEXECVEZHAVE_FINITEZ
HAVE_FLOCKZ	HAVE_FORKZHAVE_FORKPTYZHAVE_FPATHCONFZHAVE_FSEEK64ZHAVE_FSEEKOZHAVE_FSTATATZ
HAVE_FSTATVFSZ
HAVE_FSYNCZHAVE_FTELL64ZHAVE_FTELLOZ
HAVE_FTIMEZHAVE_FTRUNCATEZ
HAVE_FUTIMENSZHAVE_FUTIMESZHAVE_FUTIMESATZHAVE_GAI_STRERRORZ
HAVE_GAMMAZHAVE_GCC_ASM_FOR_MC68881ZHAVE_GCC_ASM_FOR_X64ZHAVE_GCC_ASM_FOR_X87ZHAVE_GCC_UINT128_TZHAVE_GETADDRINFOZHAVE_GETC_UNLOCKEDZHAVE_GETENTROPYZHAVE_GETGRGID_RZHAVE_GETGRNAM_RZHAVE_GETGROUPLISTZHAVE_GETGROUPSZHAVE_GETHOSTBYNAMEZHAVE_GETHOSTBYNAME_RZHAVE_GETHOSTBYNAME_R_3_ARGZHAVE_GETHOSTBYNAME_R_5_ARGZHAVE_GETHOSTBYNAME_R_6_ARGZHAVE_GETITIMERZHAVE_GETLOADAVGZ
HAVE_GETLOGINZHAVE_GETNAMEINFOZHAVE_GETPAGESIZEZHAVE_GETPEERNAMEZHAVE_GETPGIDZHAVE_GETPGRPZHAVE_GETPIDZHAVE_GETPRIORITYZ
HAVE_GETPWENTZHAVE_GETPWNAM_RZHAVE_GETPWUID_RZHAVE_GETRANDOMZHAVE_GETRANDOM_SYSCALLZHAVE_GETRESGIDZHAVE_GETRESUIDZHAVE_GETSIDZ
HAVE_GETSPENTZ
HAVE_GETSPNAMZHAVE_GETTIMEOFDAYZ
HAVE_GETWDZHAVE_GLIBC_MEMMOVE_BUGZ
HAVE_GRP_HZHAVE_HSTRERRORZHAVE_HTOLE64Z
HAVE_HYPOTZ
HAVE_IEEEFP_HZHAVE_IF_NAMEINDEXZHAVE_INET_ATONZHAVE_INET_PTONZHAVE_INITGROUPSZHAVE_INTTYPES_HZ	HAVE_IO_HZHAVE_IPA_PURE_CONST_BUGZ	HAVE_KILLZHAVE_KILLPGZHAVE_KQUEUEZHAVE_LANGINFO_HZHAVE_LARGEFILE_SUPPORTZ
HAVE_LCHFLAGSZHAVE_LCHMODZHAVE_LCHOWNZHAVE_LGAMMAZ
HAVE_LIBDLZHAVE_LIBDLDZHAVE_LIBIEEEZHAVE_LIBINTL_HZHAVE_LIBREADLINEZHAVE_LIBRESOLVZHAVE_LIBSENDFILEZHAVE_LIBUTIL_HZ	HAVE_LINKZHAVE_LINKATZHAVE_LINUX_CAN_BCM_HZHAVE_LINUX_CAN_HZHAVE_LINUX_CAN_RAW_FD_FRAMESZHAVE_LINUX_CAN_RAW_HZHAVE_LINUX_MEMFD_HZHAVE_LINUX_NETLINK_HZHAVE_LINUX_QRTR_HZHAVE_LINUX_RANDOM_HZHAVE_LINUX_TIPC_HZHAVE_LINUX_VM_SOCKETS_HZ
HAVE_LOCKFZ
HAVE_LOG1PZ	HAVE_LOG2ZHAVE_LONG_DOUBLEZ
HAVE_LSTATZHAVE_LUTIMESZHAVE_MADVISEZHAVE_MAKEDEVZHAVE_MBRTOWCZHAVE_MEMFD_CREATEZ
HAVE_MEMORY_HZHAVE_MEMRCHRZHAVE_MKDIRATZHAVE_MKFIFOZ
HAVE_MKFIFOATZ
HAVE_MKNODZHAVE_MKNODATZHAVE_MKTIMEZ	HAVE_MMAPZHAVE_MREMAPZHAVE_NCURSES_HZHAVE_NDIR_HZHAVE_NETPACKET_PACKET_HZ
HAVE_NET_IF_HZ	HAVE_NICEZHAVE_OPENATZHAVE_OPENPTYZ
HAVE_PATHCONFZ
HAVE_PAUSEZ
HAVE_PIPE2Z
HAVE_PLOCKZ	HAVE_POLLZHAVE_POLL_HZHAVE_POSIX_FADVISEZHAVE_POSIX_FALLOCATEZHAVE_POSIX_SPAWNZHAVE_POSIX_SPAWNPZ
HAVE_PREADZHAVE_PREADVZHAVE_PREADV2ZHAVE_PRLIMITZHAVE_PROCESS_HZHAVE_PROTOTYPESZHAVE_PTHREAD_CONDATTR_SETCLOCKZHAVE_PTHREAD_DESTRUCTORZHAVE_PTHREAD_GETCPUCLOCKIDZHAVE_PTHREAD_HZHAVE_PTHREAD_INITZHAVE_PTHREAD_KILLZHAVE_PTHREAD_SIGMASKZ
HAVE_PTY_HZHAVE_PUTENVZHAVE_PWRITEZHAVE_PWRITEVZ
HAVE_PWRITEV2Z
HAVE_READLINKZHAVE_READLINKATZ
HAVE_READVZ
HAVE_REALPATHZ
HAVE_RENAMEATZHAVE_RL_APPEND_HISTORYZHAVE_RL_CATCH_SIGNALZ#HAVE_RL_COMPLETION_APPEND_CHARACTERZ'HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOKZHAVE_RL_COMPLETION_MATCHESZ"HAVE_RL_COMPLETION_SUPPRESS_APPENDZHAVE_RL_PRE_INPUT_HOOKZHAVE_RL_RESIZE_TERMINALZ
HAVE_ROUNDZ
HAVE_RTPSPAWNZHAVE_SCHED_GET_PRIORITY_MAXZHAVE_SCHED_HZHAVE_SCHED_RR_GET_INTERVALZHAVE_SCHED_SETAFFINITYZHAVE_SCHED_SETPARAMZHAVE_SCHED_SETSCHEDULERZHAVE_SEM_GETVALUEZ
HAVE_SEM_OPENZHAVE_SEM_TIMEDWAITZHAVE_SEM_UNLINKZ
HAVE_SENDFILEZHAVE_SETEGIDZHAVE_SETEUIDZHAVE_SETGIDZHAVE_SETGROUPSZHAVE_SETHOSTNAMEZHAVE_SETITIMERZHAVE_SETLOCALEZHAVE_SETPGIDZHAVE_SETPGRPZHAVE_SETPRIORITYZ
HAVE_SETREGIDZHAVE_SETRESGIDZHAVE_SETRESUIDZ
HAVE_SETREUIDZHAVE_SETSIDZHAVE_SETUIDZHAVE_SETVBUFZ
HAVE_SHADOW_HZ
HAVE_SHM_OPENZHAVE_SHM_UNLINKZHAVE_SIGACTIONZHAVE_SIGALTSTACKZHAVE_SIGFILLSETZHAVE_SIGINFO_T_SI_BANDZHAVE_SIGINTERRUPTZ
HAVE_SIGNAL_HZHAVE_SIGPENDINGZ
HAVE_SIGRELSEZHAVE_SIGTIMEDWAITZHAVE_SIGWAITZHAVE_SIGWAITINFOZ
HAVE_SNPRINTFZHAVE_SOCKADDR_ALGZHAVE_SOCKADDR_SA_LENZHAVE_SOCKADDR_STORAGEZHAVE_SOCKETPAIRZHAVE_SPAWN_HZHAVE_SSIZE_TZHAVE_STATVFSZHAVE_STAT_TV_NSECZHAVE_STAT_TV_NSEC2ZHAVE_STDARG_PROTOTYPESZ
HAVE_STDINT_HZ
HAVE_STDLIB_HZHAVE_STD_ATOMICZHAVE_STRDUPZ
HAVE_STRFTIMEZHAVE_STRINGS_HZ
HAVE_STRING_HZHAVE_STRLCPYZHAVE_STROPTS_HZHAVE_STRSIGNALZHAVE_STRUCT_PASSWD_PW_GECOSZHAVE_STRUCT_PASSWD_PW_PASSWDZHAVE_STRUCT_STAT_ST_BIRTHTIMEZHAVE_STRUCT_STAT_ST_BLKSIZEZHAVE_STRUCT_STAT_ST_BLOCKSZHAVE_STRUCT_STAT_ST_FLAGSZHAVE_STRUCT_STAT_ST_GENZHAVE_STRUCT_STAT_ST_RDEVZHAVE_STRUCT_TM_TM_ZONEZHAVE_SYMLINKZHAVE_SYMLINKATZ	HAVE_SYNCZHAVE_SYSCONFZHAVE_SYSEXITS_HZHAVE_SYS_AUDIOIO_HZHAVE_SYS_BSDTTY_HZHAVE_SYS_DEVPOLL_HZHAVE_SYS_DIR_HZHAVE_SYS_ENDIAN_HZHAVE_SYS_EPOLL_HZHAVE_SYS_EVENT_HZHAVE_SYS_FILE_HZHAVE_SYS_IOCTL_HZHAVE_SYS_KERN_CONTROL_HZHAVE_SYS_LOADAVG_HZHAVE_SYS_LOCK_HZHAVE_SYS_MEMFD_HZHAVE_SYS_MKDEV_HZHAVE_SYS_MMAN_HZHAVE_SYS_MODEM_HZHAVE_SYS_NDIR_HZHAVE_SYS_PARAM_HZHAVE_SYS_POLL_HZHAVE_SYS_RANDOM_HZHAVE_SYS_RESOURCE_HZHAVE_SYS_SELECT_HZHAVE_SYS_SENDFILE_HZHAVE_SYS_SOCKET_HZHAVE_SYS_STATVFS_HZHAVE_SYS_STAT_HZHAVE_SYS_SYSCALL_HZHAVE_SYS_SYSMACROS_HZHAVE_SYS_SYS_DOMAIN_HZHAVE_SYS_TERMIO_HZHAVE_SYS_TIMES_HZHAVE_SYS_TIME_HZHAVE_SYS_TYPES_HZHAVE_SYS_UIO_HZ
HAVE_SYS_UN_HZHAVE_SYS_UTSNAME_HZHAVE_SYS_WAIT_HZHAVE_SYS_XATTR_HZHAVE_TCGETPGRPZHAVE_TCSETPGRPZHAVE_TEMPNAMZHAVE_TERMIOS_HZHAVE_TERM_HZHAVE_TGAMMAZHAVE_TIMEGMZ
HAVE_TIMESZHAVE_TMPFILEZHAVE_TMPNAMZ
HAVE_TMPNAM_RZHAVE_TM_ZONEZ
HAVE_TRUNCATEZHAVE_TZNAMEZ
HAVE_UCS4_TCLZ
HAVE_UNAMEZ
HAVE_UNISTD_HZ
HAVE_UNLINKATZ
HAVE_UNSETENVZHAVE_USABLE_WCHAR_TZHAVE_UTIL_HZHAVE_UTIMENSATZHAVE_UTIMESZHAVE_UTIME_HZHAVE_UUID_CREATEZHAVE_UUID_ENC_BEZHAVE_UUID_GENERATE_TIME_SAFEZHAVE_UUID_HZHAVE_UUID_UUID_HZ
HAVE_WAIT3Z
HAVE_WAIT4ZHAVE_WAITIDZHAVE_WAITPIDZHAVE_WCHAR_HZHAVE_WCSCOLLZ
HAVE_WCSFTIMEZHAVE_WCSXFRMZHAVE_WMEMCMPZHAVE_WORKING_TZSETZHAVE_WRITEVZ HAVE_X509_VERIFY_PARAM_SET1_HOSTZHAVE_ZLIB_COPYZHAVE__GETPTYZ
HOST_GNU_TYPEZINCLDIRSTOMAKEZ
INCLUDEDIRZ	INCLUDEPYZINSTALLZINSTALL_DATAZINSTALL_PROGRAMZINSTALL_SCRIPTZINSTALL_SHAREDZ
INSTSONAMEZIO_HZIO_OBJSZLDCXXSHAREDZLDFLAGSZ	LDLIBRARYZLDLIBRARYDIRZLDSHAREDZ	LDVERSIONZLIBCZLIBDESTZLIBDIRZLIBFFI_INCLUDEDIRZLIBMZ	LIBOBJDIRZLIBOBJSZLIBPCZLIBPLZ	LIBPYTHONZLIBRARYZLIBRARY_OBJSZLIBRARY_OBJS_OMIT_FROZENZLIBSZ
LIBSUBDIRSZLINKCCZ
LINKFORSHAREDZLIPO_32BIT_FLAGSZLIPO_INTEL64_FLAGSZ
LLVM_PROF_ERRZLLVM_PROF_FILEZLLVM_PROF_MERGERZLNZLOCALMODLIBSZMACHDEPZMACHDEP_OBJSZMACHDESTLIBZMACOSX_DEPLOYMENT_TARGETZMAINCCZMAJOR_IN_MKDEVZMAJOR_IN_SYSMACROSZ	MAKESETUPZMANDIRZMKDIR_PZMODBUILT_NAMESZMODDISABLED_NAMESZMODLIBSZMODOBJSZMODULE_OBJSZ	MULTIARCHZMULTIARCH_CPPFLAGSZMVWDELCH_IS_EXPRESSIONZNO_AS_NEEDEDZOBJECT_OBJSZOPENSSL_INCLUDESZOPENSSL_LDFLAGSZOPENSSL_LIBSZOPTZOTHER_LIBTOOL_OPTZPACKAGE_BUGREPORTZPACKAGE_NAMEZPACKAGE_STRINGZPACKAGE_TARNAMEZPACKAGE_URLZPACKAGE_VERSIONZPARSER_HEADERSZPARSER_OBJSZPGO_PROF_GEN_FLAGZPGO_PROF_USE_FLAGZPOBJSZPOSIX_SEMAPHORES_NOT_ENABLEDZPROFILE_TASKZ$PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INTZPTHREAD_SYSTEM_SCHED_SUPPORTEDZ
PY3LIBRARYZPYLONG_BITS_IN_DIGITZPYTHONZPYTHONFRAMEWORKZPYTHONFRAMEWORKDIRZPYTHONFRAMEWORKINSTALLDIRZPYTHONFRAMEWORKPREFIXZ
PYTHONPATHZPYTHON_FOR_BUILDZPYTHON_FOR_REGENZPYTHON_HEADERSZPYTHON_OBJSZPY_BUILTIN_MODULE_CFLAGSZ	PY_CFLAGSZPY_CFLAGS_NODISTZPY_COERCE_C_LOCALEZPY_CORE_CFLAGSZPY_CORE_LDFLAGSZPY_CPPFLAGSZPY_FORMAT_SIZE_TZ
PY_LDFLAGSZPY_LDFLAGS_NODISTZPY_SSL_DEFAULT_CIPHERSZPY_SSL_DEFAULT_CIPHER_STRINGZPY_STDMODULE_CFLAGSZPy_DEBUGZPy_ENABLE_SHAREDZPy_HASH_ALGORITHMZ
Py_TRACE_REFSZ
QUICKTESTOPTSZREADELFZ	RESSRCDIRZ
RETSIGTYPEZ	RUNSHAREDZ	SCRIPTDIRZSETPGRP_HAVE_ARGZSGI_ABIZSHELLZSHLIBSZSHLIB_SUFFIXZSHM_NEEDS_LIBRTZSIGNED_RIGHT_SHIFT_ZERO_FILLSZSITEPATHZ
SIZEOF_DOUBLEZSIZEOF_FLOATZ
SIZEOF_FPOS_TZ
SIZEOF_INTZSIZEOF_LONGZSIZEOF_LONG_DOUBLEZSIZEOF_LONG_LONGZSIZEOF_OFF_TZSIZEOF_PID_TZSIZEOF_PTHREAD_KEY_TZSIZEOF_PTHREAD_TZSIZEOF_SHORTZ
SIZEOF_SIZE_TZ
SIZEOF_TIME_TZSIZEOF_UINTPTR_TZ
SIZEOF_VOID_PZSIZEOF_WCHAR_TZSIZEOF__BOOLZSOABIZSRCDIRSZ
SRC_GDB_HOOKSZSTDC_HEADERSZSTRICT_SYSV_CURSESZ	STRIPFLAGZSUBDIRSZ
SUBDIRSTOOZSYSLIBSZSYS_SELECT_WITH_SYS_TIMEZTCLTK_INCLUDESZ
TCLTK_LIBSZTESTOPTSZTESTPATHZ
TESTPYTHONZTESTPYTHONOPTSZ
TESTRUNNERZTESTTIMEOUTZTIMEMODULE_LIBZTIME_WITH_SYS_TIMEZTM_IN_SYS_TIMEZUNICODE_DEPSZUNIVERSALSDKZUPDATE_FILEZUSE_COMPUTED_GOTOSZVERSIONZVPATHZWINDOW_HAS_FLAGSZWITH_DECIMAL_CONTEXTVARZWITH_DOC_STRINGSZWITH_DTRACEZ	WITH_DYLDZWITH_LIBINTLZWITH_NEXT_FRAMEWORKZ
WITH_PYMALLOCZ
WITH_VALGRINDZX87_DOUBLE_ROUNDINGZ
XMLLIBSUBDIRSZabs_builddirZ
abs_srcdirZdatarootdir�exec_prefix�prefixZsrcdirN)Zbuild_time_vars�rr�?/usr/lib64/python3.8/_sysconfigdata_d_linux_x86_64-linux-gnu.py�<module>sb2+-��������re.cpython-38.opt-1.pyc000064400000034130150335716500010547 0ustar00U

e5d�=�@s�dZddlZddlZddlZddlZzddlZWnek
rHdZYnXddddddd	d
ddd
ddddddddddddddddddgZd ZGd!d"�d"ej	�Z
e��e
j
�ejZd@d#d�ZdAd$d�ZdBd%d�ZdCd&d�ZdDd'd�ZdEd(d�ZdFd)d	�ZdGd*d
�ZdHd+d�Zd,d�ZdId-d
�Zd.d/�d0D�Zd1d�Zee�d2d��Zee�d2d��d2��ZiZd3Z d4d5�Z!e�"e �d6d7��Z#d8d9�Z$d:d;�Z%ddl&Z&d<d=�Z'e&�(ee'e!�Gd>d?�d?�Z)dS)Ja�Support for regular expressions (RE).

This module provides regular expression matching operations similar to
those found in Perl.  It supports both 8-bit and Unicode strings; both
the pattern and the strings being processed can contain null bytes and
characters outside the US ASCII range.

Regular expressions can contain both special and ordinary characters.
Most ordinary characters, like "A", "a", or "0", are the simplest
regular expressions; they simply match themselves.  You can
concatenate ordinary characters, so last matches the string 'last'.

The special characters are:
    "."      Matches any character except a newline.
    "^"      Matches the start of the string.
    "$"      Matches the end of the string or just before the newline at
             the end of the string.
    "*"      Matches 0 or more (greedy) repetitions of the preceding RE.
             Greedy means that it will match as many repetitions as possible.
    "+"      Matches 1 or more (greedy) repetitions of the preceding RE.
    "?"      Matches 0 or 1 (greedy) of the preceding RE.
    *?,+?,?? Non-greedy versions of the previous three special characters.
    {m,n}    Matches from m to n repetitions of the preceding RE.
    {m,n}?   Non-greedy version of the above.
    "\\"     Either escapes special characters or signals a special sequence.
    []       Indicates a set of characters.
             A "^" as the first character indicates a complementing set.
    "|"      A|B, creates an RE that will match either A or B.
    (...)    Matches the RE inside the parentheses.
             The contents can be retrieved or matched later in the string.
    (?aiLmsux) The letters set the corresponding flags defined below.
    (?:...)  Non-grouping version of regular parentheses.
    (?P<name>...) The substring matched by the group is accessible by name.
    (?P=name)     Matches the text matched earlier by the group named name.
    (?#...)  A comment; ignored.
    (?=...)  Matches if ... matches next, but doesn't consume the string.
    (?!...)  Matches if ... doesn't match next.
    (?<=...) Matches if preceded by ... (must be fixed length).
    (?<!...) Matches if not preceded by ... (must be fixed length).
    (?(id/name)yes|no) Matches yes pattern if the group with id/name matched,
                       the (optional) no pattern otherwise.

The special sequences consist of "\\" and a character from the list
below.  If the ordinary character is not on the list, then the
resulting RE will match the second character.
    \number  Matches the contents of the group of the same number.
    \A       Matches only at the start of the string.
    \Z       Matches only at the end of the string.
    \b       Matches the empty string, but only at the start or end of a word.
    \B       Matches the empty string, but not at the start or end of a word.
    \d       Matches any decimal digit; equivalent to the set [0-9] in
             bytes patterns or string patterns with the ASCII flag.
             In string patterns without the ASCII flag, it will match the whole
             range of Unicode digits.
    \D       Matches any non-digit character; equivalent to [^\d].
    \s       Matches any whitespace character; equivalent to [ \t\n\r\f\v] in
             bytes patterns or string patterns with the ASCII flag.
             In string patterns without the ASCII flag, it will match the whole
             range of Unicode whitespace characters.
    \S       Matches any non-whitespace character; equivalent to [^\s].
    \w       Matches any alphanumeric character; equivalent to [a-zA-Z0-9_]
             in bytes patterns or string patterns with the ASCII flag.
             In string patterns without the ASCII flag, it will match the
             range of Unicode alphanumeric characters (letters plus digits
             plus underscore).
             With LOCALE, it will match the set [0-9_] plus characters defined
             as letters for the current locale.
    \W       Matches the complement of \w.
    \\       Matches a literal backslash.

This module exports the following functions:
    match     Match a regular expression pattern to the beginning of a string.
    fullmatch Match a regular expression pattern to all of a string.
    search    Search a string for the presence of a pattern.
    sub       Substitute occurrences of a pattern found in a string.
    subn      Same as sub, but also return the number of substitutions made.
    split     Split a string by the occurrences of a pattern.
    findall   Find all occurrences of a pattern in a string.
    finditer  Return an iterator yielding a Match object for each match.
    compile   Compile a pattern into a Pattern object.
    purge     Clear the regular expression cache.
    escape    Backslash all non-alphanumerics in a string.

Each function other than purge and escape can take an optional 'flags' argument
consisting of one or more of the following module constants, joined by "|".
A, L, and U are mutually exclusive.
    A  ASCII       For string patterns, make \w, \W, \b, \B, \d, \D
                   match the corresponding ASCII character categories
                   (rather than the whole Unicode categories, which is the
                   default).
                   For bytes patterns, this flag is the only available
                   behaviour and needn't be specified.
    I  IGNORECASE  Perform case-insensitive matching.
    L  LOCALE      Make \w, \W, \b, \B, dependent on the current locale.
    M  MULTILINE   "^" matches the beginning of lines (after a newline)
                   as well as the string.
                   "$" matches the end of lines (before a newline) as well
                   as the end of the string.
    S  DOTALL      "." matches any character at all, including the newline.
    X  VERBOSE     Ignore whitespace and comments for nicer looking RE's.
    U  UNICODE     For compatibility only. Ignored for string patterns (it
                   is the default), and forbidden for bytes patterns.

This module also defines an exception 'error'.

�N�match�	fullmatch�search�sub�subn�split�findall�finditer�compile�purge�template�escape�error�Pattern�Match�A�I�L�M�S�X�U�ASCII�
IGNORECASE�LOCALE�	MULTILINE�DOTALL�VERBOSE�UNICODEz2.2.1c@speZdZejZZejZZ	ej
ZZej
ZZejZZejZZejZZejZZejZdd�Zej Z dS)�	RegexFlagcCs�|jdk	rd|j��S|j}g}|dk}|r2|}|jD],}||j@r8||jM}|�d|j���q8|rx|�t|��d�|�}|r�t|�dkr�d|�d�}n
d|��}|S)Nzre.r�|�z~(�)�~)�_name_�_value_�	__class__�append�hex�join�len)�self�value�members�negative�m�res�r1�/usr/lib64/python3.8/re.py�__repr__�s&




zRegexFlag.__repr__N)!�__name__�
__module__�__qualname__�sre_compile�SRE_FLAG_ASCIIrr�SRE_FLAG_IGNORECASErr�SRE_FLAG_LOCALErr�SRE_FLAG_UNICODErr�SRE_FLAG_MULTILINErr�SRE_FLAG_DOTALLrr�SRE_FLAG_VERBOSErr�SRE_FLAG_TEMPLATE�TEMPLATE�T�SRE_FLAG_DEBUG�DEBUGr3�object�__str__r1r1r1r2r�s







rcCst||��|�S)zqTry to apply the pattern at the start of the string, returning
    a Match object, or None if no match was found.)�_compiler��pattern�string�flagsr1r1r2r�scCst||��|�S)zkTry to apply the pattern to all of the string, returning
    a Match object, or None if no match was found.)rFrrGr1r1r2r�scCst||��|�S)ztScan through string looking for a match to the pattern, returning
    a Match object, or None if no match was found.)rFrrGr1r1r2r�scCst||��|||�S)aZReturn the string obtained by replacing the leftmost
    non-overlapping occurrences of the pattern in string by the
    replacement repl.  repl can be either a string or a callable;
    if a string, backslash escapes in it are processed.  If it is
    a callable, it's passed the Match object and must return
    a replacement string to be used.)rFr�rH�replrI�countrJr1r1r2r�scCst||��|||�S)a�Return a 2-tuple containing (new_string, number).
    new_string is the string obtained by replacing the leftmost
    non-overlapping occurrences of the pattern in the source
    string by the replacement repl.  number is the number of
    substitutions that were made. repl can be either a string or a
    callable; if a string, backslash escapes in it are processed.
    If it is a callable, it's passed the Match object and must
    return a replacement string to be used.)rFrrKr1r1r2r�s	cCst||��||�S)a�Split the source string by the occurrences of the pattern,
    returning a list containing the resulting substrings.  If
    capturing parentheses are used in pattern, then the text of all
    groups in the pattern are also returned as part of the resulting
    list.  If maxsplit is nonzero, at most maxsplit splits occur,
    and the remainder of the string is returned as the final element
    of the list.)rFr)rHrI�maxsplitrJr1r1r2r�scCst||��|�S)aReturn a list of all non-overlapping matches in the string.

    If one or more capturing groups are present in the pattern, return
    a list of groups; this will be a list of tuples if the pattern
    has more than one group.

    Empty matches are included in the result.)rFrrGr1r1r2r�scCst||��|�S)z�Return an iterator over all non-overlapping matches in the
    string.  For each match, the iterator returns a Match object.

    Empty matches are included in the result.)rFr	rGr1r1r2r	�scCs
t||�S)zACompile a regular expression pattern, returning a Pattern object.)rF�rHrJr1r1r2r
�scCst��t��dS)z#Clear the regular expression cachesN)�_cache�clear�
_compile_repl�cache_clearr1r1r1r2r�scCst||tB�S)z6Compile a template pattern, returning a Pattern object)rFrArOr1r1r2rscCsi|]}|dt|��qS)�\)�chr)�.0�ir1r1r2�
<dictcomp>srXs()[]{}?*+-|^$\.&~# 	

cCs2t|t�r|�t�St|d�}|�t��d�SdS)z0
    Escape special characters in a string.
    �latin1N)�
isinstance�str�	translate�_special_chars_map�encode)rHr1r1r2r
s


�ic
Cs�t|t�r|j}ztt|�||fWStk
r8YnXt|t�rT|rPtd��|St�	|�sft
d��t�||�}|t@s�t
t�tkr�ztttt��=Wntttfk
r�YnX|tt|�||f<|S)Nz5cannot process flags argument with a compiled patternz1first argument must be string or compiled pattern)rZrr,rP�type�KeyErrorr�
ValueErrorr7�isstring�	TypeErrorr
rCr*�	_MAXCACHE�next�iter�
StopIteration�RuntimeError)rHrJ�pr1r1r2rF!s.

�
rFcCst�||�S�N)�	sre_parse�parse_template)rLrHr1r1r2rR;srRcCst�||�}t�||�Srk)rlrm�expand_template)rHrrr1r1r2�_expand@srocCs>t||�}|ds.t|d�dkr.|ddS|fdd�}|S)Nrr!cSst�||�Srk)rlrn)rrr1r1r2�filterKsz_subx.<locals>.filter)rRr*)rHrrpr1r1r2�_subxEs

rqcCst|j|jffSrk)rFrHrJ)rjr1r1r2�_pickleSsrrc@seZdZddd�Zdd�ZdS)�Scannerrc
Cs�ddlm}m}t|t�r |j}||_g}t��}||_	|D]H\}}|�
�}	|�t�|||	ddt�
||�ffg��|�|	|d�q<t�||d|ffg�}t�|�|_dS)Nr)�BRANCH�
SUBPATTERN���)�
sre_constantsrtrurZrr,�lexiconrl�StaterJ�	opengroupr'�
SubPattern�parse�
closegroupr7r
�scanner)
r+rxrJrtrurj�s�phrase�action�gidr1r1r2�__init__\s

�zScanner.__init__c	Cs�g}|j}|j�|�j}d}|�}|s(q�|��}||kr:q�|j|jdd}t|�rj||_|||���}|dk	rz||�|}q|||d�fS)Nrr!)r'r~r�endrx�	lastindex�callable�group)	r+rI�resultr'rrWr/�jr�r1r1r2�scanms$zScanner.scanN)r)r4r5r6r�r�r1r1r1r2rs[s
rs)r)r)r)rr)rr)rr)r)r)r)r)*�__doc__�enumr7rl�	functools�_locale�ImportError�__all__�__version__�IntFlagr�globals�update�__members__rrrrrrrrr	r
rrr]r
r`rrrPrerF�	lru_cacherRrorq�copyregrr�picklersr1r1r1r2�<module>s�k
�#



	







	

timeit.cpython-38.pyc000064400000027003150335716500010476 0ustar00U

e5d�4�@s�dZddlZddlZddlZddlZddddgZdZdZd	Zej	Z
eZd
Z
dd�ZGd
d�d�Zdde
edfdd�Zdde
eedfdd�Zddd�dd�Zedkr�e�e��dS)a9Tool for measuring execution time of small code snippets.

This module avoids a number of common traps for measuring execution
times.  See also Tim Peters' introduction to the Algorithms chapter in
the Python Cookbook, published by O'Reilly.

Library usage: see the Timer class.

Command line usage:
    python timeit.py [-n N] [-r N] [-s S] [-p] [-h] [--] [statement]

Options:
  -n/--number N: how many times to execute 'statement' (default: see below)
  -r/--repeat N: how many times to repeat the timer (default 5)
  -s/--setup S: statement to be executed once initially (default 'pass').
                Execution time of this setup statement is NOT timed.
  -p/--process: use time.process_time() (default is time.perf_counter())
  -v/--verbose: print raw timing results; repeat for more digits precision
  -u/--unit: set the output time unit (nsec, usec, msec, or sec)
  -h/--help: print this usage message and exit
  --: separate options from statement, use when statement starts with -
  statement: statement to be timed (default 'pass')

A multi-line statement may be given by specifying each line as a
separate argument; indented lines are possible by enclosing an
argument in quotes and using leading spaces.  Multiple -s options are
treated similarly.

If -n is not given, a suitable number of loops is calculated by trying
increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the
total time is at least 0.2 seconds.

Note: there is a certain baseline overhead associated with executing a
pass statement.  It differs between versions.  The code here doesn't try
to hide it, but you should be aware of it.  The baseline overhead can be
measured by invoking the program without arguments.

Classes:

    Timer

Functions:

    timeit(string, string) -> float
    repeat(string, string) -> list
    default_timer() -> float

�N�Timer�timeit�repeat�
default_timerz<timeit-src>i@B�z�
def inner(_it, _timer{init}):
    {setup}
    _t0 = _timer()
    for _i in _it:
        {stmt}
    _t1 = _timer()
    return _t1 - _t0
cCs|�ddd|�S)z*Helper to reindent a multi-line statement.�
� )�replace)�src�indent�r�/usr/lib64/python3.8/timeit.py�reindentOsrc@sPeZdZdZddedfdd�Zddd�Zefdd	�Ze	efd
d�Z
ddd
�ZdS)ra�Class for timing execution speed of small code snippets.

    The constructor takes a statement to be timed, an additional
    statement used for setup, and a timer function.  Both statements
    default to 'pass'; the timer function is platform-dependent (see
    module doc string).  If 'globals' is specified, the code will be
    executed within that namespace (as opposed to inside timeit's
    namespace).

    To measure the execution time of the first statement, use the
    timeit() method.  The repeat() method is a convenience to call
    timeit() multiple times and return a list of results.

    The statements may contain newlines, as long as they don't contain
    multi-line string literals.
    �passNcCs�||_i}|dkrt�n|}d}t|t�rJt|td�|d}t|d�}n*t|�rl||d<|d7}d}d}ntd	��t|t�r�t||td�t|d
�}n&t|�r�||d<|d7}d
}ntd��t	j
|||d�}	|	|_t|	td�}
t|
||�|d|_
dS)z#Constructor.  See class doc string.N��execr��_setupz, _setup=_setupz_setup()z&setup is neither a string nor callable�Z_stmtz
, _stmt=_stmtz_stmt()z%stmt is neither a string nor callable)�stmt�setup�init�inner)�timer�_globals�
isinstance�str�compile�dummy_src_namer�callable�
ValueError�template�formatr
rr)�selfrrr�globalsZlocal_nsZ	global_nsrZ
stmtprefixr
�coderrr
�__init__es6

zTimer.__init__cCsJddl}ddl}|jdk	r:t|j�d|j�d�tf|jt<|j|d�dS)a�Helper to print a traceback from the timed code.

        Typical use:

            t = Timer(...)       # outside the try/except
            try:
                t.timeit(...)    # or t.repeat(...)
            except:
                t.print_exc()

        The advantage over the standard traceback is that source lines
        in the compiled template will be displayed.

        The optional file argument directs where the traceback is
        sent; it defaults to sys.stderr.
        rNr��file)�	linecache�	tracebackr
�len�splitr�cache�	print_exc)r#r(r)r*rrr
r.�s

�
zTimer.print_exccCsBt�d|�}t��}t��z|�||j�}W5|r<t��X|S)a�Time 'number' executions of the main statement.

        To be precise, this executes the setup statement once, and
        then returns the time it takes to execute the main statement
        a number of times, as a float measured in seconds.  The
        argument is the number of times through the loop, defaulting
        to one million.  The main statement, the setup statement and
        the timer function to be used are passed to the constructor.
        N)�	itertoolsr�gcZ	isenabledZdisableZenablerr)r#�number�itZgcoldZtimingrrr
r�s

zTimer.timeitcCs*g}t|�D]}|�|�}|�|�q|S)a�Call timeit() a few times.

        This is a convenience function that calls the timeit()
        repeatedly, returning a list of results.  The first argument
        specifies how many times to call timeit(), defaulting to 5;
        the second argument specifies the timer argument, defaulting
        to one million.

        Note: it's tempting to calculate mean and standard deviation
        from the result vector and report these.  However, this is not
        very useful.  In a typical case, the lowest value gives a
        lower bound for how fast your machine can run the given code
        snippet; higher values in the result vector are typically not
        caused by variability in Python's speed, but by other
        processes interfering with your timing accuracy.  So the min()
        of the result is probably the only number you should be
        interested in.  After that, you should look at the entire
        vector and apply common sense rather than statistics.
        )�ranger�append)r#rr1�r�i�trrr
r�s

zTimer.repeatcCsPd}dD]8}||}|�|�}|r,|||�|dkr||fSq|d9}qdS)a�Return the number of loops and time taken so that total time >= 0.2.

        Calls the timeit method with increasing numbers from the sequence
        1, 2, 5, 10, 20, 50, ... until the time taken is at least 0.2
        second.  Returns (number, time_taken).

        If *callback* is given and is not None, it will be called after
        each trial with two arguments: ``callback(number, time_taken)``.
        �)r8�rg�������?�
N)r)r#�callbackr6�jr1�
time_takenrrr
�	autorange�s


zTimer.autorange)N)N)�__name__�
__module__�__qualname__�__doc__rr&r.�default_numberr�default_repeatrr>rrrr
rSs�
#
rcCst||||��|�S)zCConvenience function to create Timer object and call timeit method.)rr)rrrr1r$rrr
r�scCst||||��||�S)zCConvenience function to create Timer object and call repeat method.)rr)rrrrr1r$rrr
r�s)�_wrap_timerc
s|dkrtjdd�}ddl}z(|�|dddddd	d
ddd
g	�\}}Wn:|jk
r�}zt|�td�WY�dSd}~XYnXt}d�|�p�d}d�g}t}d}	d�ddddd��d�|D]�\}
}|
dkr�t|��|
dkr�|�	|�|
dk�r|�k�r|�ntdtj
d�dS|
dk�r6t|�}|dk�r6d}|
dk�rFtj}|
dk�rf|	�r^�d7�|	d7}	|
d kr�tt
d!d"�dSq�d�|��p�d}ddl}tj�d|j�|dk	�r�||�}t|||�}
�dk�rd}|	�r�fd#d$�}z|
�|�\�}Wn|
��YdSX|	�rt�z|
�|��}Wn|
��YdSX���fd%d&�}|	�rztd'd(�t||���t��fd)d*�|D�}t|�}td+��dk�r�d,nd-|||�f�t|�}t|�}||d.k�rddl}|�d/||�||�ftd-d�dS)0a�Main program, used when run as a script.

    The optional 'args' argument specifies the command line to be parsed,
    defaulting to sys.argv[1:].

    The return value is an exit code to be passed to sys.exit(); it
    may be None to indicate success.

    When an exception happens during timing, a traceback is printed to
    stderr and the return value is 1.  Exceptions at other times
    (including the template compilation) are not caught.

    '_wrap_timer' is an internal interface used for unit testing.  If it
    is not None, it must be a callable that accepts a timer function
    and returns another timer function (used for unit testing).
    Nr8rz
n:u:s:r:tcpvhznumber=zsetup=zrepeat=�timeZclockZprocess�verbosezunit=�helpz#use -h/--help for command line helpr9rrg��&�.>g���ư>g����MbP?g�?)ZnsecZusecZmsecZsec�)z-nz--number)z-sz--setup)z-uz--unitz:Unrecognized unit. Please select nsec, usec, msec, or sec.r')z-rz--repeat)z-pz	--process)z-vz	--verbose)z-hz--helpr)�endcs.d}|dk}t|j||rdnd|�d��dS)Nz%{num} loop{s} -> {secs:.{prec}g} secsr8�sr)ZnumrKZsecsZprec)�printr")r1r=�msgZplural)�	precisionrr
r;?s�zmain.<locals>.callbackcs`�}|dk	r�|}n8dd����D�}|jdd�|D]\}}||kr8qNq8d�|||fS)NcSsg|]\}}||f�qSrr)�.0�unit�scalerrr
�
<listcomp>Ysz-main.<locals>.format_time.<locals>.<listcomp>T)�reversez%.*g %s)�items�sort)�dtrPrQZscales)rN�	time_unit�unitsrr
�format_timeSs
zmain.<locals>.format_timez
raw times: %sz, csg|]}|��qSrr)rOrV)r1rr
rRdszmain.<locals>.<listcomp>z"%d loop%s, best of %d: %s per looprKrrztThe test results are likely unreliable. The worst time (%s) was more than four times slower than the best time (%s).)�sys�argv�getopt�errorrLr�joinrD�intr4�stderrrF�process_timerB�os�path�insert�curdirrr>r.r�map�min�max�warnings�
warn_explicit�UserWarning)�argsrEr\Zopts�errrrrrrG�o�arbr7r;�_Zraw_timingsrYZtimingsZbestZworstrir)r1rNrWrXr
�main�s���


�





����rq�__main__)N)rBr0rZrFr/�__all__rrCrD�perf_counterrr$rr!rrrrrqr?�exitrrrr
�<module>s61
�
�
modulefinder.cpython-38.pyc000064400000037365150335716500011674 0ustar00U

e5dn_�@sdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ejdZejdZ
ejdZejdZeefZejZdZdZdZd	Zd
ZdZdZiZd
d�ZiZdd�Zddd�ZGdd�d�ZGdd�d�Zdd�Z e!dk�rz
e �Z"Wne#k
�re$d�YnXdS)z3Find modules used by a script, using introspection.�N�
LOAD_CONST�IMPORT_NAME�
STORE_NAME�STORE_GLOBAL������cCst�|g��|�dS�N)�packagePathMap�
setdefault�append)Zpackagename�path�r�$/usr/lib64/python3.8/modulefinder.py�AddPackagePath(srcCs|t|<dSr)�replacePackageMap)Zoldname�newnamerrr�ReplacePackage3srcCstjj��tjj�||�}|dkr8tdj|d�|d��|jtjjkrVddddt	ffS|jtjj
krtddddtffS|j}|j�
|�r�dtj�|�ddtffSt|jtjj�r�t}n<t|jtjj�r�t}n&t|jtjj�r�t}nddddtffSt�|�}tj�|�d}|||d|ffS)zDAn importlib reimplementation of imp.find_module (for our purposes).NzNo module named {name!r})�name�����rb)�	importlib�	machinery�
PathFinder�invalidate_caches�	find_spec�ImportError�format�loader�BuiltinImporter�
_C_BUILTIN�FrozenImporter�
_PY_FROZEN�origin�
is_package�osr�dirname�_PKG_DIRECTORY�
isinstance�SourceFileLoader�
_PY_SOURCE�ExtensionFileLoader�_C_EXTENSION�SourcelessFileLoader�_PY_COMPILED�
_SEARCH_ERROR�io�	open_code�splitext)rr�specZ	file_pathZkind�file�suffixrrr�_find_module7s*
r:c@seZdZddd�Zdd�ZdS)�ModuleNcCs(||_||_||_d|_i|_i|_dSr)�__name__�__file__�__path__�__code__�globalnames�starimports)�selfrr8rrrr�__init__fszModule.__init__cCsLd|jf}|jdk	r&|d|jf}|jdk	r@|d|jf}|d}|S)Nz	Module(%rz, %r�))r<r=r>)rB�srrr�__repr__ss

zModule.__repr__)NN)r<�
__module__�__qualname__rCrFrrrrr;ds

r;c@s�eZdZd6dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zd7dd�Z	d8dd�Z
dd�Zdd�Zd9dd�Z
dd�Zdd�Zdd�Zd d!�Zd:d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd;d,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)<�ModuleFinderNrcCsZ|dkrtj}||_i|_i|_||_d|_|dk	r8|ng|_|dk	rJ|ng|_g|_dS)Nr)	�sysr�modules�
badmodules�debug�indent�excludes�
replace_paths�processed_paths)rBrrMrOrPrrrrC~szModuleFinder.__init__cGsV||jkrRt|j�D]}tddd�qt|dd�|D]}tt|�dd�q6t�dS)N�   � ��end)rM�rangerN�print�repr)rB�level�str�args�i�argrrr�msg�s
zModuleFinder.msgcGs,|d}||jkr(|jd|_|j|�dS�Nrr�rMrNr^�rBr[rYrrr�msgin�s
zModuleFinder.msgincGs,|d}||jkr(|jd|_|j|�dSr_r`rarrr�msgout�s
zModuleFinder.msgoutc	CsB|�dd|�t�|�� }ddtf}|�d|||�W5QRXdS)Nr�
run_scriptrr�__main__)r^r4r5r.�load_module)rB�pathname�fp�stuffrrrrd�s
zModuleFinder.run_scriptc	CsTtj�|�\}}tj�|�\}}t�|�� }|dtf}|�||||�W5QRXdS)Nr)r)r�splitr6r4r5r.rf)rBrg�dirrZextrhrirrr�	load_file�s

zModuleFinder.load_filerc	Cs\|�dd||||�|j||d�}|�||�\}}|�||�}|sF|S|jrX|�||�dS)Nr�import_hook�rY)r^�determine_parent�find_head_package�	load_tailr>�ensure_fromlist)	rBr�caller�fromlistrY�parent�q�tail�mrrrrm�szModuleFinder.import_hookcCsN|�dd||�|r|dkr,|�dd�dS|j}|dkr�|jrH|d8}|dkrx|j|}||ksft�|�dd|�|S|�d�|kr�td��d�|�	d�d|��}|j|}|�dd|�|S|jr�|j|}||ks�t�|�dd|�|Sd|k�r>|�
d�}|d|�}|j|}|j|k�s,t�|�dd|�|S|�dd�dS)	N�rorzdetermine_parent -> Nonerzdetermine_parent ->�.zrelative importpath too deep)rbrcr<r>rK�AssertionError�countr �joinrj�rfind)rBrsrYZpnamerur\rrrro�sB





zModuleFinder.determine_parentcCs�|�dd||�d|kr@|�d�}|d|�}||dd�}n|}d}|r\d|j|f}n|}|�|||�}|r�|�dd||f�||fS|r�|}d}|�|||�}|r�|�dd||f�||fS|�dd|�td	|��dS)
Nryrprzrr�%s.%szfind_head_package ->�"raise ImportError: No module named�No module named )rb�findr<�
import_modulercr )rBrurr\�headrwZqnamervrrrrp�s.
zModuleFinder.find_head_packagecCs�|�dd||�|}|r�|�d�}|dkr2t|�}|d|�||dd�}}d|j|f}|�|||�}|s|�dd|�td|��q|�dd	|�|S)
Nryrqrzrrrr�r�zload_tail ->)rbr��lenr<r�rcr )rBrvrwrxr\r�Zmnamerrrrq�s
zModuleFinder.load_tailcCs�|�dd|||�|D]d}|dkrD|sz|�|�}|rz|�||d�qt||�sd|j|f}|�|||�}|std|��qdS)Nryrr�*rrr�)r^�find_all_submodulesrr�hasattrr<r�r )rBrxrt�	recursive�sub�all�subnameZsubmodrrrrrs

zModuleFinder.ensure_fromlistc
	Cs�|js
dSi}g}|tjjdd�7}|tjjdd�7}|tjjdd�7}|jD]�}zt�|�}Wn&tk
r�|�	dd|�YqTYnX|D]R}d}|D]0}t
|�}	||	d�|kr�|d|	�}q�q�|r�|dkr�|||<q�qT|��S)Nrzcan't list directoryrC)r>rr�EXTENSION_SUFFIXES�SOURCE_SUFFIXES�BYTECODE_SUFFIXESr)�listdir�OSErrorr^r��keys)
rBrxrK�suffixesrk�namesr�modZsuff�nrrrr�s.

z ModuleFinder.find_all_submodulescCs
|�dd|||�z|j|}Wntk
r4YnX|�dd|�|S||jkrb|�dd�dS|r�|jdkr�|�dd�dSz|�||o�|j|�\}}}Wn$tk
r�|�ddd�YdSXz|�	||||�}W5|r�|��X|r�t
|||�|�dd|�|S)Nrr�zimport_module ->zimport_module -> None)rbrK�KeyErrorrcrLr>�find_moduler �closerf�setattr)rBZpartname�fqnamerurxrhrgrirrrr�.s:
�
zModuleFinder.import_modulec
Cs(|\}}}|�dd||od|�|tkrF|�||�}|�dd|�|S|tkr`t|��|d�}	n||tkr�z|��}
tj	�
|
|i�Wn:tk
r�}z|�ddt|�|��W5d}~XYnXt
�t|
�dd��}	nd}	|�|�}||_|	�r|j�r|�|	�}	|	|_|�|	|�|�dd|�|S)Nrrfrhzload_module ->�execzraise ImportError: �)rbr+�load_packagercr.�compile�readr2r�_bootstrap_external�
_classify_pycr rZ�marshal�loads�
memoryview�
add_moduler=rP�replace_paths_in_coder?�	scan_code)rBr�rhrg�	file_infor9�mode�typerx�co�data�excrrrrfNs4


zModuleFinder.load_modulecCs<||jkri|j|<|r*d|j||j<nd|j|d<dS)Nr�-)rLr<)rBrrsrrr�_add_badmoduleks


zModuleFinder._add_badmodulecCsB||jkr|�||�dSz|j|||d�Wn~tk
rn}z"|�ddt|��|�||�W5d}~XYn�tk
r�}z"|�ddt|��|�||�W5d}~XYn�X|�r>|D]�}|d|}||jkr�|�||�q�z|j|||g|d�Wq�tk
�r:}z"|�ddt|��|�||�W5d}~XYq�Xq�dS)NrnrzImportError:zSyntaxError:rz)rLr�rmr r^rZ�SyntaxError)rBrrsrtrYr^r��fullnamerrr�_safe_import_hookss,

zModuleFinder._safe_import_hookccs�|j}|j}|j}dd�t�|�D�}t|�D]�\}\}}|tkrTd||ffVq.|tkr.|dkr.||dd||ddkr�tkr.nq.|||dd}	|||dd}
|	dkr�d|
||ffVq.d|	|
||ffVq.q.dS)	NcSs"g|]\}}}|tkr||f�qSr)�EXTENDED_ARG)�.0�_�opr]rrr�
<listcomp>�s�z-ModuleFinder.scan_opcodes.<locals>.<listcomp>�storerrr�absolute_import�relative_import)	�co_code�co_names�	co_consts�disZ_unpack_opargs�	enumerate�	STORE_OPSrr)rBr��coder��constsZopargsr\r�ZopargrYrtrrr�scan_opcodes�s(��
zModuleFinder.scan_opcodescCs�|j}|j}||�D�]F\}}|dkr8|\}d|j|<q|dk�r|\}}d}	|dk	rpd|krbd}	dd�|D�}|j|||dd�|	�r\d}
|jr�|j�|jd	|�}
|
dkr�|j�|�}
|
dk	r�|j�|
j�|j	�|
j	�|
j
dkr�d|j	|<n
d|j	|<q|d
k�rT|\}}}|�r0|j||||d�n"|j||d�}|j|jd|dd�qt|��q|j
D]"}
t|
t|���rd|�|
|��qddS)Nr�rr�rr�cSsg|]}|dkr|�qS)r�r)r��frrrr��sz*ModuleFinder.scan_code.<locals>.<listcomp>rnrzr�)r�r�r@r�r>rK�getr<�updaterAr?ro�RuntimeErrorr�r,r�r�)rBr�rxr��scannerZwhatr[rrtZ	have_starZmmrYru�crrrr��sH





zModuleFinder.scan_codecCs�|�dd||�t�|�}|r"|}|�|�}||_|g|_|jt�|g�|_|�d|j�\}}}z&|�	||||�|�
dd|�|W�S|r�|��XdS)Nrr�rCzload_package ->)rbrr�r�r=r>r
r�r�rfrc)rBr�rgrrxrhZbufrirrrr��s

zModuleFinder.load_packagecCs*||jkr|j|St|�|j|<}|Sr)rKr;)rBr�rxrrrr��s

zModuleFinder.add_modulecCsn|dk	r|jd|}n|}||jkr<|�dd|�t|��|dkrd|tjkr^ddddtffS|j}t||�S)Nrzrzfind_module -> Excludedr)	r<rOrcr rJ�builtin_module_namesr$rr:)rBrrrur�rrrr��s

zModuleFinder.find_modulecCst�tdd�tdd�t|j���}|D]B}|j|}|jrRtddd�ntddd�td||jpnd	�q0|��\}}|r�t�td
�|D]*}t|j|���}td|dd
�|��q�|�rt�tddd�td�|D]*}t|j|���}td|dd
�|��q�dS)z�Print a report to stdout, listing the found modules with their
        paths, as well as modules that are missing, or seem to be missing.
        z
  %-25s %s)�NameZFile)�----r��PrSrTrxz%-25srzMissing modules:�?z
imported fromz, z7Submodules that appear to be missing, but could also bez#global names in the parent package:N)	rW�sortedrKr�r>r=�any_missing_mayberLr})rBr��keyrx�missing�mayberZmodsrrr�reports0
zModuleFinder.reportcCs|��\}}||S)z�Return a list of modules that appear to be missing. Use
        any_missing_maybe() if you want to know which modules are
        certain to be missing, and which *may* be missing.
        )r�)rBr�r�rrr�any_missing"szModuleFinder.any_missingcCs�g}g}|jD]�}||jkrq|�d�}|dkr<|�|�q||dd�}|d|�}|j�|�}|dk	r�||j|kr�|�|�q�||jkr�q�|jr�|�|�q�|�|�q|�|�q|��|��||fS)a�Return two lists, one with modules that are certainly missing
        and one with modules that *may* be missing. The latter names could
        either be submodules *or* just global names in the package.

        The reason it can't always be determined is that it's impossible to
        tell which names are imported when "from module import *" is done
        with an extension module, short of actually importing it.
        rzrrN)	rLrOr~rrKr�r@rA�sort)rBr�r�rr\r�ZpkgnameZpkgrrrr�*s0	




zModuleFinder.any_missing_maybecCs�tj�|j�}}|jD]*\}}|�|�r||t|�d�}qDq|jr�||jkr�||krr|�	dd||f�n|�	dd|f�|j�
|�t|j�}t
t|��D](}t||t|��r�|�||�||<q�|jt|�|d�S)Nrzco_filename %r changed to %rz co_filename %r remains unchanged)r��co_filename)r)r�normpathr�rP�
startswithr�rMrQrcr�listr�rVr,r�r��replace�tuple)rBr�Znew_filenameZoriginal_filenamer��rr�r\rrrr�Xs&
��
z"ModuleFinder.replace_paths_in_code)NrNN)NNr)r)r)r)N)r<rGrHrCr^rbrcrdrlrmrorprqrrr�r�rfr�r�r�r�r�r�r�r�r�r�r�rrrrrI|s2
	

#
 
1
".rIc
Cs�ddl}z|�tjdd�d�\}}Wn2|jk
rX}zt|�WY�dSd}~XYnXd}d}g}g}|D]Z\}}	|dkr�|d}|dkr�d}|dkr�||	�tj�}|dkr�d}|dkrn|�|	�qn|s�d	}
n|d}
tj	dd�}tj	�
|
�|d<||}|dk�r.td
�|D]}tdt|���qt|||�}
|dd�D]`}|dk�r\d}�qF|�r�|dd�d
k�r�|
�
|dd�ddg�n
|
�
|�n
|
�|��qF|
�|
�|
��|
S)Nrrzdmp:qx:z-dz-mz-pz-qz-xzhello.pyzpath:rR���z.*r�)�getoptrJ�argv�errorrWrjr)�pathseprrr*rXrIrmrlrdr�)r�Zoptsr[r^rMZdomodsZaddpathZexclude�o�aZscriptr�item�mfr]rrr�testpsX


r�rez
[interrupted])N)%�__doc__r�Zimportlib._bootstrap_externalr�importlib.machineryr�r)r4rJ�types�warningsZopmaprrrrr�r�r3r.r2r0r+r$r&r
rrrr:r;rIr�r<r��KeyboardInterruptrWrrrr�<module>sL




-w;

tracemalloc.cpython-38.opt-1.pyc000064400000041725150335716500012437 0ustar00U

e5d�B�@sddlmZmZddlmZddlZddlZddlZddl	Z	ddl
Tddl
mZmZdd�Z
Gdd	�d	�ZGd
d�d�Zdd
�ZeGdd�d��ZeGdd�de��Zdd�ZGdd�d�ZGdd�de�Zdd�ZGdd�d�ZGdd�de�ZGdd�de�ZGd d!�d!�Zd"d#�ZdS)$�)�Sequence�Iterable)�total_orderingN)�*)�_get_object_traceback�_get_tracescCs�dD]|}t|�dkr@|dkr@|r0d||fSd||fSt|�dksT|dkrx|rhd||fSd	||fS|d
}qdS)N)�BZKiBZMiBZGiB�TiB�drz%+.1f %sz%.1f %si(r	z%+.0f %sz%.0f %si)�abs)�sizeZsignZunit�r
�#/usr/lib64/python3.8/tracemalloc.py�_format_size
src@sDeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dS)�	StatisticzS
    Statistic difference on memory allocations between two Snapshot instance.
    ��	tracebackr�countcCs||_||_||_dS�Nr)�selfrrrr
r
r�__init__%szStatistic.__init__cCst|j|j|jf�Sr)�hashrrr�rr
r
r�__hash__*szStatistic.__hash__cCs$|j|jko"|j|jko"|j|jkSrr�r�otherr
r
r�__eq__-s

�
�zStatistic.__eq__cCsBd|jt|jd�|jf}|jr>|j|j}|dt|d�7}|S)Nz%s: size=%s, count=%iF�, average=%s)rrrr�r�textZaverager
r
r�__str__2s
��zStatistic.__str__cCsd|j|j|jfS)Nz)<Statistic traceback=%r size=%i count=%i>rrr
r
r�__repr__<s�zStatistic.__repr__cCs|j|j|jfSr)rrrrr
r
r�	_sort_key@szStatistic._sort_keyN��__name__�
__module__�__qualname__�__doc__�	__slots__rrrr r!r"r
r
r
rrs
rc@sDeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dS)�
StatisticDiffzd
    Statistic difference on memory allocations between an old and a new
    Snapshot instance.
    �rr�	size_diffr�
count_diffcCs"||_||_||_||_||_dSrr*)rrrr+rr,r
r
rrKs
zStatisticDiff.__init__cCst|j|j|j|j|jf�Sr)rrrr+rr,rr
r
rrRs�zStatisticDiff.__hash__cCs<|j|jko:|j|jko:|j|jko:|j|jko:|j|jkSrr*rr
r
rrVs
�
�
�
�zStatisticDiff.__eq__cCsPd|jt|jd�t|jd�|j|jf}|jrL|j|j}|dt|d�7}|S)Nz %s: size=%s (%s), count=%i (%+i)FTr)rrrr+rr,rr
r
rr ]s

��zStatisticDiff.__str__cCsd|j|j|j|j|jfS)Nz9<StatisticDiff traceback=%r size=%i (%+i) count=%i (%+i)>r*rr
r
rr!is��zStatisticDiff.__repr__cCs t|j�|jt|j�|j|jfSr)rr+rr,rrrr
r
rr"ns
�zStatisticDiff._sort_keyNr#r
r
r
rr)Dsr)cCs�g}|��D]d\}}|�|d�}|dk	rNt||j|j|j|j|j|j�}nt||j|j|j|j�}|�|�q|��D]*\}}t|d|jd|j�}|�|�qz|S�Nr)�items�popr)rr�append)�	old_group�	new_group�
statisticsr�statZpreviousr
r
r�_compare_grouped_statsts*

��r5c@s\eZdZdZdZdd�Zedd��Zedd��Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dS)�Framez
    Frame of a traceback.
    ��_framecCs
||_dSrr7�r�framer
r
rr�szFrame.__init__cCs
|jdSr-r7rr
r
r�filename�szFrame.filenamecCs
|jdS�N�r7rr
r
r�lineno�szFrame.linenocCs|j|jkSrr7rr
r
rr�szFrame.__eq__cCs|j|jkSrr7rr
r
r�__lt__�szFrame.__lt__cCs
t|j�Sr)rr8rr
r
rr�szFrame.__hash__cCsd|j|jfS)Nz%s:%s�r;r>rr
r
rr �sz
Frame.__str__cCsd|j|jfS)Nz<Frame filename=%r lineno=%r>r@rr
r
rr!�szFrame.__repr__N)r$r%r&r'r(r�propertyr;r>rr?rr r!r
r
r
rr6�s

r6c@sfeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
ddd�ZdS)�	Tracebackz`
    Sequence of Frame instances sorted from the oldest frame
    to the most recent frame.
    ��_framescCst�|�tt|��|_dSr)rr�tuple�reversedrD)r�framesr
r
rr�s
zTraceback.__init__cCs
t|j�Sr)�lenrDrr
r
r�__len__�szTraceback.__len__cCs4t|t�r"tdd�|j|D��St|j|�SdS)Ncss|]}t|�VqdSr)r6��.0�tracer
r
r�	<genexpr>�sz(Traceback.__getitem__.<locals>.<genexpr>)�
isinstance�slicerErDr6�r�indexr
r
r�__getitem__�s
zTraceback.__getitem__cCs|j|jkSr)r8rDr9r
r
r�__contains__�szTraceback.__contains__cCs
t|j�Sr)rrDrr
r
rr�szTraceback.__hash__cCs|j|jkSrrCrr
r
rr�szTraceback.__eq__cCs|j|jkSrrCrr
r
rr?�szTraceback.__lt__cCst|d�Sr-)�strrr
r
rr �szTraceback.__str__cCsdt|�fS)Nz<Traceback %r>)rErr
r
rr!�szTraceback.__repr__NFcCs�g}|dk	r2|dkr$||d�}q6|d|�}n|}|rBt|�}|D]@}|�d|j|jf�t�|j|j���}|rF|�d|�qF|S)Nrz  File "%s", line %sz    %s)rFr0r;r>�	linecache�getline�strip)r�limitZmost_recent_first�linesZframe_slicer:�liner
r
r�format�s 
�zTraceback.format)NF)r$r%r&r'r(rrIrRrSrrr?r r!r[r
r
r
rrB�srBcCs t|�}|dk	rt|�SdSdS)z�
    Get the traceback where the Python object *obj* was allocated.
    Return a Traceback instance.

    Return None if the tracemalloc module is not tracing memory allocations or
    did not trace the allocation of the object.
    N)rrB)�objrGr
r
r�get_object_traceback�sr]c@s`eZdZdZdZdd�Zedd��Zedd��Zed	d
��Z	dd�Z
d
d�Zdd�Zdd�Z
dS)�Tracez"
    Trace of a memory block.
    ��_tracecCs
||_dSrr_�rrLr
r
rrszTrace.__init__cCs
|jdSr-r_rr
r
r�domainszTrace.domaincCs
|jdSr<r_rr
r
rr	sz
Trace.sizecCst|jd�S)N�)rBr`rr
r
rr
szTrace.tracebackcCs|j|jkSrr_rr
r
rrszTrace.__eq__cCs
t|j�Sr)rr`rr
r
rrszTrace.__hash__cCsd|jt|jd�fS)Nz%s: %sF)rrrrr
r
rr sz
Trace.__str__cCsd|jt|jd�|jfS)Nz'<Trace domain=%s size=%s, traceback=%r>F)rbrrrrr
r
rr!s�zTrace.__repr__N)r$r%r&r'r(rrArbrrrrr r!r
r
r
rr^�s


r^c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�_TracescCst�|�||_dSr)rr�_traces)r�tracesr
r
rr s
z_Traces.__init__cCs
t|j�Sr)rHrerr
r
rrI%sz_Traces.__len__cCs4t|t�r"tdd�|j|D��St|j|�SdS)Ncss|]}t|�VqdSr)r^rJr
r
rrM*sz&_Traces.__getitem__.<locals>.<genexpr>)rNrOrErer^rPr
r
rrR(s
z_Traces.__getitem__cCs|j|jkSr)r`rerar
r
rrS.sz_Traces.__contains__cCs|j|jkSr)rerr
r
rr1sz_Traces.__eq__cCsdt|�S)Nz<Traces len=%s>)rHrr
r
rr!4sz_Traces.__repr__N)	r$r%r&rrIrRrSrr!r
r
r
rrdsrdcCs&tj�|�}|�d�r"|dd�}|S)Nz.pyc���)�os�path�normcase�endswith)r;r
r
r�_normalize_filename8s
rlc@seZdZdd�Zdd�ZdS)�
BaseFiltercCs
||_dSr)�	inclusive)rrnr
r
rr@szBaseFilter.__init__cCst�dSr)�NotImplementedErrorrar
r
r�_matchCszBaseFilter._matchN)r$r%r&rrpr
r
r
rrm?srmcsJeZdZd�fdd�	Zedd��Zdd�Zd	d
�Zdd�Zd
d�Z	�Z
S)�FilterNFcs2t��|�||_t|�|_||_||_||_dSr)�superrrnrl�_filename_patternr>�
all_framesrb)rrn�filename_patternr>rtrb��	__class__r
rrHs
zFilter.__init__cCs|jSr)rsrr
r
rruQszFilter.filename_patterncCs6t|�}t�||j�sdS|jdkr(dS||jkSdS)NFT)rl�fnmatchrsr>�rr;r>r
r
r�_match_frame_implUs
zFilter._match_frame_implcCs|�||�|jASr)rzrnryr
r
r�_match_frame^szFilter._match_framecsH�jr,t�fdd�|D��r"�jS�jSn|d\}}��||�SdS)Nc3s|]\}}��||�VqdSr)rz)rKr;r>rr
rrMcs�z*Filter._match_traceback.<locals>.<genexpr>r)rt�anyrnr{)rrr;r>r
rr�_match_tracebackas�
zFilter._match_tracebackcCsD|\}}}|�|�}|jdk	r@|jr2|o0||jkS|p>||jkS|Sr)r}rbrn)rrLrbrr�resr
r
rrpls


z
Filter._match)NFN)r$r%r&rrArurzr{r}rp�
__classcell__r
r
rvrrqGs�	
	rqcs0eZdZ�fdd�Zedd��Zdd�Z�ZS)�DomainFiltercst��|�||_dSr)rrr�_domain)rrnrbrvr
rrxszDomainFilter.__init__cCs|jSr)r�rr
r
rrb|szDomainFilter.domaincCs|\}}}||jk|jASr)rbrn)rrLrbrrr
r
rrp�s
zDomainFilter._match)r$r%r&rrArbrprr
r
rvrr�ws
r�c@sXeZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z	dd
�Z
ddd�Zddd�ZdS)�SnapshotzB
    Snapshot of traces of memory blocks allocated by Python.
    cCst|�|_||_dSr)rdrf�traceback_limit)rrfr�r
r
rr�s
zSnapshot.__init__c	Cs*t|d��}t�||tj�W5QRXdS)z1
        Write the snapshot into a file.
        �wbN)�open�pickle�dumpZHIGHEST_PROTOCOL)rr;�fpr
r
rr��sz
Snapshot.dumpc
Cs,t|d��}t�|�W5QR�SQRXdS)z.
        Load a snapshot from a file.
        �rbN)r�r��load)r;r�r
r
rr��sz
Snapshot.loadcs@|rt�fdd�|D��sdS|r<t�fdd�|D��r<dSdS)Nc3s|]}|���VqdSr�rp�rK�trace_filter�rLr
rrM�s�z)Snapshot._filter_trace.<locals>.<genexpr>Fc3s|]}|���VqdSrr�r�r�r
rrM�s�T)r|)r�include_filters�exclude_filtersrLr
r�r�
_filter_trace�s��zSnapshot._filter_tracecs�t|t�stdt|�j��|rjg�g�|D] }|jrB��|�q,��|�q,���fdd��jjD�}n�jj�	�}t
|�j�S)z�
        Create a new Snapshot instance with a filtered traces sequence, filters
        is a list of Filter or DomainFilter instances.  If filters is an empty
        list, return a new Snapshot instance with a copy of the traces.
        z)filters must be a list of filters, not %scsg|]}����|�r|�qSr
)r�rJ�r�r�rr
r�
<listcomp>�s��z*Snapshot.filter_traces.<locals>.<listcomp>)rNr�	TypeError�typer$rnr0rfre�copyr�r�)r�filtersr�Z
new_tracesr
r�r�
filter_traces�s
�zSnapshot.filter_tracesc

Cs�|dkrtd|f��|r.|dkr.td|��i}i}|�s|jjD]�}|\}}}z||}	WnZtk
r�|dkr||}
n(|dkr�|dd�}
n|dddff}
t|
�}	|	||<YnXz(||	}|j|7_|jd7_WqDtk
�rt|	|d�||	<YqDXqDn�|jjD]�}|\}}}|D]�}z||}	WnFtk
�r~|dk�r\|f}
n|ddff}
t|
�}	|	||<YnXz(||	}|j|7_|jd7_Wn&tk
�r�t|	|d�||	<YnX�q(�q|S)	N)rr;r>zunknown key_type: %r)r>r;z/cumulative mode cannot by used with key type %rrr>r=r)�
ValueErrorrfre�KeyErrorrBrrr)
r�key_type�
cumulativeZstatsZ
tracebacksrLrbrZtrace_tracebackrrGr4r:r
r
r�	_group_by�sZ�


zSnapshot._group_byFcCs,|�||�}t|���}|jdtjd�|S)zd
        Group statistics by key_type. Return a sorted list of Statistic
        instances.
        T��reverse�key)r��list�values�sortrr")rr�r�Zgroupedr3r
r
rr3�szSnapshot.statisticscCs6|�||�}|�||�}t||�}|jdtjd�|S)z�
        Compute the differences with an old snapshot old_snapshot. Get
        statistics as a sorted list of StatisticDiff instances, grouped by
        group_by.
        Tr�)r�r5r�r)r")rZold_snapshotr�r�r2r1r3r
r
r�
compare_tos

zSnapshot.compare_toN)F)F)
r$r%r&r'rr��staticmethodr�r�r�r�r3r�r
r
r
rr��s
3

r�cCs$t�std��t�}t�}t||�S)zI
    Take a snapshot of traces of memory blocks allocated by Python.
    zLthe tracemalloc module must be tracing memory allocations to take a snapshot)�
is_tracing�RuntimeErrorrZget_traceback_limitr�)rfr�r
r
r�
take_snapshot
s
r�)Zcollections.abcrr�	functoolsrrxrUZos.pathrhr�Z_tracemallocrrrrr)r5r6rBr]r^rdrlrmrqr�r�r�r
r
r
r�<module>s2&0"?%0	nturl2path.cpython-38.pyc000064400000003322150335716500011304 0ustar00U

e5dG�@sdZdd�Zdd�ZdS)z�Convert a NT pathname to a file URL and vice versa.

This module only exists to provide OS-specific code
for urllib.requests, thus do not use directly.
cCs�ddl}ddl}|�dd�}d|kr\|dd�dkr@|dd�}|�d�}|j�d	�|��S|�d�}t|�dks�|dd
|jkr�d|}t	|��|dd
�
�}|d�d�}|d}|D]}|r�|d	|j�|�}q�|�d�r�|�d�r�|d	7}|S)
z{OS-specific conversion from a relative URL of the 'file' scheme
    to a file system path; not recommended for general use.�N�:�|�z////��/�\���z	Bad URL: �)�string�urllib.parse�replace�split�parseZunquote�join�lenZ
ascii_letters�OSError�upper�endswith)Zurlr
�urllib�
components�comp�error�drive�path�r�"/usr/lib64/python3.8/nturl2path.py�url2pathnames(	

rcCs4ddl}|dd�dkrf|dd�}|dd���dkrJd|dd�}n|dd�d	krftd
|��d	|kr�|dd�dkr�d|}|�d�}|j�d�|��S|jd	dd
�}t|�dks�t|d�dkr�d
|}t|��|j�|d���}|d�d�}d|d	}|D] }|�r|d|j�|�}�q|S)z{OS-specific conversion from a file system path to a relative URL
    of the 'file' scheme; not recommended for general use.rNrz\\?\zUNC\rr	rrz
Bad path: z\\r)�maxsplitz///)rrrr
rZquoterr)�prrrrrrrrr�pathname2url-s.
rN)�__doc__rrrrrr�<module>s%_threading_local.cpython-38.opt-2.pyc000064400000006070150335716500013422 0ustar00U

e5d4�@sZddlmZddlmZdgZGdd�d�Zedd��ZGdd�d�Zdd	lm	Z	m
Z
d
S)�)�ref)�contextmanager�localc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
_localimpl)�key�dicts�	localargs�	locallock�__weakref__cCsdtt|��|_i|_dS)Nz_threading_local._localimpl.)�str�idrr)�self�r�(/usr/lib64/python3.8/_threading_local.py�__init__�sz_localimpl.__init__cCst�}|jt|�dS)N�)�current_threadrr)r
�threadrrr�get_dict�sz_localimpl.get_dictcshi}|j}t�}t|�}|f�fdd�	}|f�fdd�	}t||��t||���|j|<�|f|j|<|S)Ncs��}|dk	r|j|=dS�N)�__dict__)�_rr)�wrthreadrr�
local_deleted�sz-_localimpl.create_dict.<locals>.local_deletedcs��}|dk	r|j�|�}dSr)r�pop)r�idtr�dct)�wrlocalrr�thread_deleted�sz._localimpl.create_dict.<locals>.thread_deleted)rrrrrr)r
Z	localdictrrrrrr)rrr�create_dict�s


z_localimpl.create_dictN)�__name__�
__module__�__qualname__�	__slots__rrrrrrrr�src	csvt�|d�}z|��}Wn2tk
rJ|��}|j\}}|j||�YnX|j�t�|d|�dVW5QRXdS)N�_local__implr)	�object�__getattribute__r�KeyErrorrrrr	�__setattr__)r
�implr�args�kwrrr�_patch�s
r,c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r)r$rcOsX|s|r|jtjkrtd��t�|�}t�}||f|_t�|_t�|d|�|�	�|S)Nz*Initialization arguments are not supportedr$)
rr%�	TypeError�__new__rr�RLockr	r(r)�clsr*r+r
r)rrrr.�s

z
local.__new__c
Cs,t|��t�||�W5QR�SQRXdSr)r,r%r&�r
�namerrrr&�s
zlocal.__getattribute__c
CsF|dkrtd|jj��t|��t�|||�W5QR�SQRXdS�Nrz+%r object attribute '__dict__' is read-only)�AttributeError�	__class__r r,r%r()r
r2�valuerrrr(�s��
zlocal.__setattr__c
CsD|dkrtd|jj��t|��t�||�W5QR�SQRXdSr3)r4r5r r,r%�__delattr__r1rrrr7�s��
zlocal.__delattr__N)r r!r"r#r.r&r(r7rrrrr�s
)rr/N)�weakrefr�
contextlibr�__all__rr,rZ	threadingrr/rrrr�<module>�s,

&getopt.cpython-38.opt-1.pyc000064400000014137150335716500011450 0ustar00U

e5dA�@s�dZddddgZddlZzddlmZWnek
rDdd	�ZYnXGd
d�de�ZeZgfdd�Z	gfdd�Z
d
d�Zdd�Zdd�Z
dd�Zedkr�ddlZee	ejdd�dddg��dS)a�Parser for command line options.

This module helps scripts to parse the command line arguments in
sys.argv.  It supports the same conventions as the Unix getopt()
function (including the special meanings of arguments of the form `-'
and `--').  Long options similar to those supported by GNU software
may be used as well via an optional third argument.  This module
provides two functions and an exception:

getopt() -- Parse command line options
gnu_getopt() -- Like getopt(), but allow option and non-option arguments
to be intermixed.
GetoptError -- exception (class) raised with 'opt' attribute, which is the
option involved with the exception.
�GetoptError�error�getopt�
gnu_getopt�N)�gettextcCs|S�N�)�srr�/usr/lib64/python3.8/getopt.py�_)�rc@s&eZdZdZdZddd�Zdd�ZdS)r�cCs||_||_t�|||�dSr)�msg�opt�	Exception�__init__)�selfrrrrr
r.szGetoptError.__init__cCs|jSr)r)rrrr
�__str__3szGetoptError.__str__N)r
)�__name__�
__module__�__qualname__rrrrrrrr
r+s
cCs�g}t|�td�kr|g}nt|�}|r�|d�d�r�|ddkr�|ddkr\|dd�}q�|d�d�r�t||ddd�||dd��\}}q$t||ddd�||dd��\}}q$||fS)a@getopt(args, options[, long_options]) -> opts, args

    Parses command line options and parameter list.  args is the
    argument list to be parsed, without the leading reference to the
    running program.  Typically, this means "sys.argv[1:]".  shortopts
    is the string of option letters that the script wants to
    recognize, with options that require an argument followed by a
    colon (i.e., the same format that Unix getopt() uses).  If
    specified, longopts is a list of strings with the names of the
    long options which should be supported.  The leading '--'
    characters should not be included in the option name.  Options
    which require an argument should be followed by an equal sign
    ('=').

    The return value consists of two elements: the first is a list of
    (option, value) pairs; the second is the list of program arguments
    left after the option list was stripped (this is a trailing slice
    of the first argument).  Each option-and-value pair returned has
    the option as its first element, prefixed with a hyphen (e.g.,
    '-x'), and the option argument as its second element, or an empty
    string if the option has no argument.  The options occur in the
    list in the same order in which they were found, thus allowing
    multiple occurrences.  Long and short options may be mixed.

    r
r�-�--�N�)�type�list�
startswith�do_longs�	do_shorts)�args�	shortopts�longopts�optsrrr
r8s((cCs6g}g}t|t�r|g}nt|�}|�d�r>|dd�}d}ntj�d�rPd}nd}|�r.|ddkrz||dd�7}�q.|ddd	�dkr�t||dd	d�||dd��\}}qT|ddd�d
kr�|dd
kr�t||ddd�||dd��\}}qT|�r||7}�q.qT|�	|d�|dd�}qT||fS)agetopt(args, options[, long_options]) -> opts, args

    This function works like getopt(), except that GNU style scanning
    mode is used by default. This means that option and non-option
    arguments may be intermixed. The getopt() function stops
    processing options as soon as a non-option argument is
    encountered.

    If the first character of the option string is `+', or if the
    environment variable POSIXLY_CORRECT is set, then option
    processing stops as soon as a non-option argument is encountered.

    �+rNTZPOSIXLY_CORRECTFrrrr)
�
isinstance�strrr�os�environ�getrr�append)r r!r"r#Z	prog_argsZall_options_firstrrr
rcs2

( (cCs�z|�d�}Wntk
r&d}Yn X|d|�||dd�}}t||�\}}|r�|dkr�|svttd�||��|d|dd�}}n|dk	r�ttd�||��|�d||p�df�||fS)N�=rzoption --%s requires argumentrz%option --%s must not have an argumentrr
)�index�
ValueError�
long_has_argsrrr*)r#rr"r �i�optarg�has_argrrr
r�s
rcs��fdd�|D�}|s(ttd������|kr8d�fS�d|krLd�fSt|�dkrjttd�����|d	}|�d�}|r�|dd
�}||fS)Ncsg|]}|���r|�qSr)r)�.0�o�rrr
�
<listcomp>�s
z!long_has_args.<locals>.<listcomp>zoption --%s not recognizedFr+Trzoption --%s not a unique prefixr���)rr�len�endswith)rr"Z
possibilitiesZunique_matchr1rr4r
r.�s
r.cCs�|dkr�|d|dd�}}t||�rh|dkr\|sFttd�||��|d|dd�}}|d}}nd}|�d||f�q||fS)Nr
rrzoption -%s requires argumentr)�
short_has_argrrr*)r#Z	optstringr!r rr0rrr
r�s
�rcCsXtt|��D]4}|||kr(dkrnq|�d|d�Sqttd�||��dS)N�:rzoption -%s not recognized)�ranger7rrr)rr!r/rrr
r9�sr9�__main__rza:bzalpha=Zbeta)�__doc__�__all__r'rr�ImportErrorrrrrrrr.rr9r�sys�print�argvrrrr
�<module>s"!+2profile.cpython-38.opt-1.pyc000064400000034350150335716500011605 0ustar00U

e5d�[�@sxdZddlZddlZddlZddlZdddgZGdd�d�Zdd	d�Zdd
d�ZGdd�d�Z	dd
�Z
edkrte
�dS)z Class for profiling Python code.�N�run�runctx�Profilec@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_Utilsz�Support class for utility functions which are shared by
    profile.py and cProfile.py modules.
    Not supposed to be used directly.
    cCs
||_dS�N)�profiler)�selfr�r	�/usr/lib64/python3.8/profile.py�__init__0sz_Utils.__init__cCsF|��}z(z|�|�Wntk
r,YnXW5|�|||�XdSr)r�_showr�
SystemExit)r�	statement�filename�sort�profr	r	r
r3s
z
_Utils.runcCsJ|��}z,z|�|||�Wntk
r0YnXW5|�|||�XdSr)rrrr
)rr�globals�localsrrrr	r	r
r<s
z
_Utils.runctxcCs"|dk	r|�|�n
|�|�dSr)�
dump_stats�print_stats)rrrrr	r	r
rEsz_Utils._showN)�__name__�
__module__�__qualname__�__doc__rrrrr	r	r	r
r*s
		r���cCstt��|||�S)aRun statement under profiler optionally saving results in filename

    This function takes a single argument that can be passed to the
    "exec" statement, and an optional file name.  In all cases this
    routine attempts to "exec" its first argument and gather profiling
    statistics from the execution. If no file name is present, then this
    function automatically prints a simple profiling report, sorted by the
    standard name string (file/line/function-name) that is presented in
    each line.
    )rrr)rrrr	r	r
rQscCstt��|||||�S)z�Run statement under profiler, supplying your own globals and locals,
    optionally saving results in filename.

    statement and filename have the same semantics as profile.run
    )rrr)rrrrrr	r	r
r^sc@s�eZdZdZdZd5dd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
ee
e
ee
e
d�Zdd�ZGdd�d�ZGdd�d�Zdd�Zdd �Zd6d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0e_d7d1d2�Zd3d4�ZdS)8raProfiler class.

    self.cur is always a tuple.  Each such tuple corresponds to a stack
    frame that is currently active (self.cur[-2]).  The following are the
    definitions of its members.  We use this external "parallel stack" to
    avoid contaminating the program that we are profiling. (old profiler
    used to write into the frames local dictionary!!) Derived classes
    can change the definition of some entries, as long as they leave
    [-2:] intact (frame and previous tuple).  In case an internal error is
    detected, the -3 element is used as the function name.

    [ 0] = Time that needs to be charged to the parent frame's function.
           It is used so that a function call will not have to access the
           timing data for the parent frame.
    [ 1] = Total time spent in this frame's function, excluding time in
           subfunctions (this latter is tallied in cur[2]).
    [ 2] = Total time spent in subfunctions, excluding time executing the
           frame's function (this latter is tallied in cur[1]).
    [-3] = Name of the function that corresponds to this frame.
    [-2] = Actual frame that we correspond to (used to sync exception handling).
    [-1] = Our parent 6-tuple (corresponds to frame.f_back).

    Timing data for each function is stored as a 5-tuple in the dictionary
    self.timings[].  The index is always the name stored in self.cur[-3].
    The following are the definitions of the members:

    [0] = The number of times this function was called, not counting direct
          or indirect recursion,
    [1] = Number of times this function appears on the stack, minus one
    [2] = Total time spent internal to this function
    [3] = Cumulative time that this function was present on the stack.  In
          non-recursive functions, this is the total execution time from start
          to finish of each invocation of a function, including time spent in
          all subfunctions.
    [4] = A dictionary indicating for each function name, the number of times
          it was called by us.
    rNcCs�i|_d|_d|_d|_|dkr&|j}||_|sHtj|_|_|j	|_
nl||_|��}zt|�}Wn"tk
r�||_|j	|_
Yn0X|dkr�|j
|_
n|j|_
|tfdd�}||_|��|_|�d�dS)N��cSs
||��Srr	)�timer�sumr	r	r
�get_time_timer�sz(Profile.__init__.<locals>.get_time_timerr)�timings�cur�cmd�c_func_name�bias�time�process_timer�get_time�trace_dispatch_i�
dispatcher�len�	TypeError�trace_dispatch�trace_dispatch_lr�t�
simulate_call)rrr$r.Zlengthrr	r	r
r�s0


zProfile.__init__cCs�|j}|�}|d|d|j|j}|dkr8|j|_|j||||�rd|�}|d|d|_n|�}|d|d||_dS)Nr��c_call�rr.r$rr#�dispatch)r�frame�event�argrr.�rr	r	r
r,�szProfile.trace_dispatchcCsT|j}|�|j|j}|dkr(|j|_|j||||�rD|�|_n|�||_dS�Nr1r2�rr4r5r6rr.r	r	r
r(�s
zProfile.trace_dispatch_icCs`|j}|�d|j|j}|dkr,|j|_|j||||�rL|�d|_n|�d||_dS)NgN@r1r2r9r	r	r
�trace_dispatch_mac�szProfile.trace_dispatch_maccCsT|j}|�|j|j}|dkr(|j|_|j||||�rD|�|_n|�||_dSr8)r'r.r$rr#r3)rr4r5r6r'r.r	r	r
r-�s
zProfile.trace_dispatch_lc	CsD|j\}}}}}}||k	r*|r*|�||�S|||||||f|_dS�Nr0)r!�trace_dispatch_return)	rr4r.�rpt�rit�ret�rfn�rframe�rcurr	r	r
�trace_dispatch_exception�s
z Profile.trace_dispatch_exceptioncCs�|jr@|j|jdk	r@|j\}}}}}}t|tj�s@|�|d�|j}	|	j|	j|	j	f}
|dd|
||jf|_|j
}|
|kr�||
\}}
}}}||
d|||f||
<nddddif||
<dS�N���rr0)r!�f_back�
isinstancer�
fake_framer<�f_code�co_filename�co_firstlineno�co_namer )rr4r.r=r>r?r@rArBZfcode�fnr �cc�ns�tt�ct�callersr	r	r
�trace_dispatch_callszProfile.trace_dispatch_callc
Csndd|jf}|dd|||jf|_|j}||krX||\}}}}}	||d|||	f||<nddddif||<dS)Nrrr0)r#r!r )
rr4r.rMr rNrOrPrQrRr	r	r
�trace_dispatch_c_callszProfile.trace_dispatch_c_callcCs�||jdk	r |�|jdd�|j\}}}}}}||}||}|\}	}
}}}
}|	|
|||||
|f|_|j}||\}}}}}|s�||}|d}||kr�||d||<nd||<||d||||f||<dSrD)r!r<r )rr4r.r=r>r?r@rBZframe_totalZpptZpitZpetZpfn�pframeZpcurr rNrOrPrQrRr	r	r
r<"s"zProfile.trace_dispatch_return)�callZ	exception�returnr1Zc_exceptionZc_returncCs"|jdrdS||_|�|�dS)Nr)r!r"r/)rr"r	r	r
�set_cmdXs
zProfile.set_cmdc@seZdZdd�Zdd�ZdS)zProfile.fake_codecCs||_||_||_d|_dS�Nr)rJ�co_linerLrK)rr�line�namer	r	r
r^szProfile.fake_code.__init__cCst|j|j|jf�Sr)�reprrJrZrL�rr	r	r
�__repr__dszProfile.fake_code.__repr__N)rrrrr_r	r	r	r
�	fake_code]sr`c@seZdZdd�ZdS)zProfile.fake_framecCs||_||_dSr)rIrF)r�codeZpriorr	r	r
rhszProfile.fake_frame.__init__N)rrrrr	r	r	r
rHgsrHcCsF|�dd|�}|jr |jd}nd}|�||�}|jd||d�dS)NZprofilerrErV)r`r!rHr3)rr\rarUr4r	r	r
r/lszProfile.simulate_callcCsJ|j}|�|j}|jdr:|jd||jd|�d}q|�||_dS)NrrWrEr)r'r.r!r3)rr'r.r	r	r
�simulate_cmd_completexs
zProfile.simulate_cmd_completercCs$ddl}|�|����|���dSrY)�pstatsZStatsZ
strip_dirsZ
sort_statsr)rrrcr	r	r
r�szProfile.print_statsc	Cs0t|d��}|��t�|j|�W5QRXdS)N�wb)�open�create_stats�marshal�dump�stats)r�file�fr	r	r
r�szProfile.dump_statscCs|��|��dSr)rb�snapshot_statsr^r	r	r
rf�szProfile.create_statsc	Cs^i|_|j��D]H\}\}}}}}|��}d}|��D]}||7}q6|||||f|j|<qdSrY)rir �items�copy�values)	r�funcrNrOrPrQrRZncZcallcntr	r	r
rl�s
zProfile.snapshot_statscCsddl}|j}|�|||�SrY)�__main__�__dict__r)rr"rq�dictr	r	r
r�szProfile.runc	Cs8|�|�t�|j�zt|||�W5t�d�X|Sr)rX�sys�
setprofiler)�exec)rr"rrr	r	r
r�s
zProfile.runctxc	Os�t|�dkr|^}}}nV|s&td��nHd|krZ|�d�}|^}}ddl}|jdtdd�ntdt|�d��|�t|��t�	|j
�z|||�W�St�	d�XdS)	Nrz:descriptor 'runcall' of 'Profile' object needs an argumentrprz0Passing 'func' as keyword argument is deprecated)�
stacklevelz7runcall expected at least 1 positional argument, got %dr0)r*r+�pop�warnings�warn�DeprecationWarningrXr]rtrur))�args�kwrrpryr	r	r
�runcall�s(

�
�zProfile.runcallz($self, func, /, *args, **kw)cCs<|jtk	rtd��|j}d|_z|�||�W�S||_XdS)Nz&Subclasses must override .calibrate().r)�	__class__rr+r$�_calibrate_inner)r�m�verboseZ
saved_biasr	r	r
�	calibrate�s
zProfile.calibratecCs|j}dd�}|fdd�}||�|�}||�|�}||}|rLtd|�t�}	|�}|	�dt�t��|�}||}
|r�td|
�d}d}|	j��D]0\\}
}}\}}}}}|d	kr�||7}||7}q�|r�td
|�td|�||dkr�td
|��||d|}|�rtd|�|S)NcSst|�D]}d}qdSr;��range)�n�i�xr	r	r
�f1sz$Profile._calibrate_inner.<locals>.f1cSst|�D]}|d�qdS)N�dr�)r�r�r�r	r	r
rksz#Profile._calibrate_inner.<locals>.fz elapsed time without profiling =zf(m)zelapsed time with profiling =g)rkr�z!'CPU seconds' profiler reported =ztotal # calls =r0z internal error: total calls = %dg@z+mean stopwatch overhead per profile event =)	r'�printrrrrr rm�
ValueError)rr�r�r'r�rkZt0�t1Zelapsed_noprofile�pZelapsed_profileZtotal_callsZ
reported_timerr[�funcnamerNrOrPrQrRZmeanr	r	r
r��sB

�



zProfile._calibrate_inner)NN)r)r)rrrrr$rr,r(r:r-rCrSrTr<r3rXr`rHr/rbrrrfrlrrr~�__text_signature__r�r�r	r	r	r
rgsB&
''�



+
c
Cs�ddl}ddlm}d}||d�}d|_|jdddd	dd
�|jddd
ddd�|jdddddd
�tjdd�s�|��t�d�|�	�\}}|tjdd�<|j
dk	r�|j�|j
�|_
t
|�dk�r�|jr�ddl}d}|j|dd�}nR|d}	tj�d|j�|	��t�|	��}
t|
��|	d�}W5QRX|	dddd�}zt||d|j
|j�Wn6tk
�r�}zdt_t�|j�W5d}~XYnXn|��|S)Nr)�OptionParserzMprofile.py [-o output_file_path] [-s sort] [-m module | scriptfile] [arg] ...)�usageFz-oz	--outfile�outfilezSave stats to <outfile>)�dest�help�defaultz-m�module�
store_truezProfile a library module.)r��actionr�r�z-sz--sortrz?Sort order when printing to stdout, based on pstats.Stats classrr0rz(run_module(modname, run_name='__main__'))�
run_module�modnamervrq)�__file__r�__package__�
__cached__)�osZoptparser�Zallow_interspersed_argsZ
add_optionrt�argvZprint_usage�exit�
parse_argsr��path�abspathr*r��runpyr��insert�dirname�io�	open_code�compile�readrr�BrokenPipeError�stdout�errno)r�r�r��parserZoptionsr|r�raZglobsZprogname�fp�excr	r	r
�main9s^

�
�
�

�� r�rq)Nr)Nr)rr�rtr%rg�__all__rrrrr�rr	r	r	r
�<module>	s

'

	U9cProfile.cpython-38.opt-1.pyc000064400000012577150335716500011717 0ustar00U

e5db�@s�dZdddgZddlZddlZddlZddd�Zddd�Zejje_ejje_Gd	d�dej�Z	d
d�Z
dd
�Zedkr~e�dS)zUPython interface for the 'lsprof' profiler.
   Compatible with the 'profile' module.
�run�runctx�Profile�N���cCst�t��|||�S�N)�
_pyprofile�_Utilsrr)�	statement�filename�sort�r� /usr/lib64/python3.8/cProfile.pyrscCst�t��|||||�Sr)rrrr)r	�globals�localsr
rrrr
rs�c@s`eZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
de
_dd�Zdd�Z
dS)ra`Profile(timer=None, timeunit=None, subcalls=True, builtins=True)

    Builds a profiler object using the specified timer function.
    The default timer is a fast built-in one based on real time.
    For custom timer functions returning integers, timeunit can
    be a float specifying a scale (i.e. how long each integer unit
    is, in seconds).
    rcCs$ddl}|�|����|���dS�Nr)�pstats�StatsZ
strip_dirsZ
sort_stats�print_stats)�selfrrrrr
r)szProfile.print_statsc	Cs8ddl}t|d��}|��|�|j|�W5QRXdS)Nr�wb)�marshal�open�create_stats�dump�stats)r�filer�frrr
�
dump_stats-szProfile.dump_statscCs|��|��dSr)�disable�snapshot_stats�rrrr
r3szProfile.create_statsc
Cs,|��}i|_i}|D]P}t|j�}|j}||j}|j}|j}i}	|	|t|j�<|||||	f|j|<q|D]�}|j	rlt|j�}|j	D]�}
z|t|
j�}	Wnt
k
r�Yq�YnX|
j}||
j}|
j}|
j}||	k�r|	|}||d7}||d7}||d7}||d7}||||f|	|<q�qldS)Nr���)Zgetstatsr�label�codeZ	callcountZreccallcountZ
inlinetimeZ	totaltime�idZcalls�KeyError)r�entriesZcallersdicts�entry�funcZncZccZttZctZcallersZsubentry�prevrrr
r7s>






zProfile.snapshot_statscCsddl}|j}|�|||�Sr)�__main__�__dict__r)r�cmdr,�dictrrr
r]szProfile.runcCs(|��zt|||�W5|��X|Sr)�enabler�exec)rr.rrrrr
rbs

zProfile.runctxcOs�t|�dkr|^}}}nV|s&td��nHd|krZ|�d�}|^}}ddl}|jdtdd�ntdt|�d��|��z|||�W�S|��XdS)	Nr"z:descriptor 'runcall' of 'Profile' object needs an argumentr*rz0Passing 'func' as keyword argument is deprecated)�
stacklevelz7runcall expected at least 1 positional argument, got %dr!)�len�	TypeError�pop�warnings�warn�DeprecationWarningr0r)�args�kwrr*r6rrr
�runcallks&

�
�zProfile.runcallz($self, func, /, *args, **kw)cCs|��|Sr)r0r rrr
�	__enter__�szProfile.__enter__cGs|��dSr)r)r�exc_inforrr
�__exit__�szProfile.__exit__N)r)�__name__�
__module__�__qualname__�__doc__rrrrrrr;�__text_signature__r<r>rrrr
rs
&	cCs(t|t�rdd|fS|j|j|jfSdS)N�~r)�
isinstance�str�co_filename�co_firstlineno�co_name)r%rrr
r$�s

r$c
Cs�ddl}ddl}ddl}ddl}ddlm}d}||d�}d|_|jdddd	dd
�|jddd
ddt|j	j
�d�|jdddddd�|jdd�s�|��|�
d�|��\}}||jdd�<|jdk	r�|j�|j�|_t|�dk�r�|j�rd}	|j|dd�}
nR|d}|j�d|j�|��t�|��}t|��|d�}	W5QRX|dddd�}
zt|	|
d|j|j�Wn6tk
�r�}
zd|_|�
|
j�W5d}
~
XYnXn|��|S)Nr)�OptionParserzNcProfile.py [-o output_file_path] [-s sort] [-m module | scriptfile] [arg] ...)�usageFz-oz	--outfile�outfilezSave stats to <outfile>)�dest�help�defaultz-sz--sortrz?Sort order when printing to stdout, based on pstats.Stats classr)rMrNrO�choicesz-m�module�
store_truezProfile a library module)rM�actionrNrOr!r"z(run_module(modname, run_name='__main__'))�
run_module�modnamer1r,)�__file__r?�__package__�
__cached__) �os�sys�runpyrZoptparserJZallow_interspersed_argsZ
add_option�sortedrZsort_arg_dict_default�argvZprint_usage�exit�
parse_argsrL�path�abspathr3rQrT�insert�dirname�io�	open_code�compile�readrr�BrokenPipeError�stdout�errno)rYrZr[rrJrK�parserZoptionsr9r%ZglobsZprogname�fp�excrrr
�main�sd

�

�
�

�� rnr,)Nr)Nr)
rB�__all__Z_lsprofrdZprofilerrrZProfilerrr$rnr?rrrr
�<module>s




o;pipes.cpython-38.opt-2.pyc000064400000011502150335716500011260 0ustar00U

e5d�"�@slddlZddlZddlZddlmZdgZdZdZdZdZ	dZ
d	Zeeee	e
egZGd
d�d�Z
dd�ZdS)
�N)�quote�TemplateZffz-fzf-�--z.-z-.c@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rcCsd|_|��dS)Nr)�	debugging�reset��self�r	�/usr/lib64/python3.8/pipes.py�__init__UszTemplate.__init__cCsd|jfS)Nz<Template instance, steps=%r>��stepsrr	r	r
�__repr__ZszTemplate.__repr__cCs
g|_dS�Nrrr	r	r
r^szTemplate.resetcCs"t�}|jdd�|_|j|_|Sr)rr
r)r�tr	r	r
�clonebszTemplate.clonecCs
||_dSr)r)r�flagr	r	r
�debugjszTemplate.debugcCs�t|�td�k	rtd��|tkr.td|f��|tkr>td��|jr^|jddtkr^td��|dd	kr~t�d
|�s~td��|dd	kr�t�d|�s�td
��|j�	||f�dS)N�z%Template.append: cmd must be a stringzTemplate.append: bad kind %rz-Template.append: SOURCE can only be prepended����z'Template.append: already ends with SINKr�f�\$IN\bz#Template.append: missing $IN in cmd�\$OUT\bz$Template.append: missing $OUT in cmd)
�type�	TypeError�	stepkinds�
ValueError�SOURCEr
�SINK�re�search�append�r�cmd�kindr	r	r
r"nszTemplate.appendcCs�t|�td�k	rtd��|tkr.td|f��|tkr>td��|jr^|jddtkr^td��|ddkr~t�d	|�s~td
��|ddkr�t�d|�s�td��|j�	d||f�dS)
Nrz&Template.prepend: cmd must be a stringzTemplate.prepend: bad kind %rz+Template.prepend: SINK can only be appendedrrz,Template.prepend: already begins with SOURCErrz$Template.prepend: missing $IN in cmdrz%Template.prepend: missing $OUT in cmd)
rrrrrr
rr r!�insertr#r	r	r
�prepend~szTemplate.prependcCs6|dkr|�|�S|dkr$|�|�Std|f��dS)N�r�wz,Template.open: rw must be 'r' or 'w', not %r)�open_r�open_wr)r�fileZrwr	r	r
�open�s

�z
Template.opencCsB|jst|d�S|jddtkr*td��|�|d�}t�|d�S)Nr(rrz)Template.open_r: pipeline ends width SINKr)r
r-rr�makepipeline�os�popen�rr,r$r	r	r
r*�s
zTemplate.open_rcCsB|jst|d�S|jddtkr*td��|�d|�}t�|d�S)Nr)rrz,Template.open_w: pipeline begins with SOURCEr)r
r-rrr.r/r0r1r	r	r
r+�s
zTemplate.open_wcCst�|�||��Sr)r/�systemr.)r�infile�outfiler	r	r
�copy�sz
Template.copycCs(t||j|�}|jr$t|�d|}|S)Nzset -x; )r.r
r�print)rr3r4r$r	r	r
r.�s
zTemplate.makepipelineN)�__name__�
__module__�__qualname__rrrrrr"r'r-r*r+r5r.r	r	r	r
rRs

cCs�g}|D]\}}|�d||dg�q|s:|�ddddg�|ddd�\}}|ddkrr|sr|�dddddg�||dd<|ddd�\}}|ddkr�|s�|�ddddg�||dd<g}tdt|��D]v}||dd	}||d	}	|ddk�s|	ddkr�t��\}
}t�|
�|�|�|||dd<||d<q�|D]�}|\}
}}}|ddk�r�d
t|�d|}|ddk�r�dt|
�d|}|dd
k�r�|
�r�|dt|
�}|dd
k�r�|�r�|dt|�}||d<�qN|dd}|dd�D]T}|dd�\}}|ddk�rTd|k�rFd|d}|d|}n|d|}�q|�r�d}|D]}|dt|�}�qrdt|d�d}|d|d|}|S)Nr�catrrr�rr�zOUT=z; zIN=�-z <z >z{ z; }z |
�
zrm -f� ztrap z; exitz 1 2 3 13 14 15)	r"r&�range�len�tempfileZmkstempr/�closer)r3r
r4�listr$r%Zgarbage�iZlkindZrkind�fdZtemp�item�infZoutfZcmdlistZrmcmdr,Ztrapcmdr	r	r
r.�s`


r.)r r/rBZshlexr�__all__ZFILEIN_FILEOUTZ
STDIN_FILEOUTZ
FILEIN_STDOUTZSTDIN_STDOUTrrrrr.r	r	r	r
�<module><s �csmtplib.cpython-38.pyc000064400000105531150335716500010660 0ustar00U

e5dɯ�
@srdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZdddddd	d
ddd
dddg
ZdZdZdZdZdZdZe�dej�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd	�d	e�Z Gdd
�d
e�Z!Gdd�de�Z"Gd d�de�Z#Gd!d
�d
e�Z$d"d�Z%d#d$�Z&d%d�Z'd&d'�Z(d(d)�Z)zddl*Z*Wne+k
�r�d*Z,YnXd+Z,Gd,d�d�Z-e,�r�Gd-d.�d.e-�Z.e�/d.�d/Z0Gd0d1�d1e-�Z1e2d2k�rnd3d4�Z3e3d5�Z4e3d6��5d7�Z6e7d8�d9Z8ej9�:�Z;e;�s*�q6e8e;Z8�qe7d:e<e8��e-d;�Z=e=�>d<�e=�?e4e6e8�e=�@�dS)=aSMTP/ESMTP client class.

This should follow RFC 821 (SMTP), RFC 1869 (ESMTP), RFC 2554 (SMTP
Authentication) and RFC 2487 (Secure SMTP over TLS).

Notes:

Please remember, when doing ESMTP, that the names of the SMTP service
extensions are NOT the same thing as the option keywords for the RCPT
and MAIL commands!

Example:

  >>> import smtplib
  >>> s=smtplib.SMTP("localhost")
  >>> print(s.help())
  This is Sendmail version 8.8.4
  Topics:
      HELO    EHLO    MAIL    RCPT    DATA
      RSET    NOOP    QUIT    HELP    VRFY
      EXPN    VERB    ETRN    DSN
  For more info use "HELP <topic>".
  To report bugs in the implementation send email to
      sendmail-bugs@sendmail.org.
  For local information send email to Postmaster at your site.
  End of HELP info
  >>> s.putcmd("vrfy","someone@here")
  >>> s.getreply()
  (250, "Somebody OverHere <somebody@here.my.org>")
  >>> s.quit()
�N)�body_encode�
SMTPException�SMTPNotSupportedError�SMTPServerDisconnected�SMTPResponseException�SMTPSenderRefused�SMTPRecipientsRefused�
SMTPDataError�SMTPConnectError�
SMTPHeloError�SMTPAuthenticationError�	quoteaddr�	quotedata�SMTP�i��
s
i �z	auth=(.*)c@seZdZdZdS)rz4Base class for all exceptions raised by this module.N��__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.8/smtplib.pyrHsc@seZdZdZdS)rz�The command or option is not supported by the SMTP server.

    This exception is raised when an attempt is made to run a command or a
    command with an option which is not supported by the server.
    NrrrrrrKsc@seZdZdZdS)rz�Not connected to any SMTP server.

    This exception is raised when the server unexpectedly disconnects,
    or when an attempt is made to use the SMTP instance before
    connecting it to a server.
    NrrrrrrRsc@seZdZdZdd�ZdS)ra2Base class for all exceptions that include an SMTP error code.

    These exceptions are generated in some instances when the SMTP
    server returns an error code.  The error code is stored in the
    `smtp_code' attribute of the error, and the `smtp_error' attribute
    is set to the error message.
    cCs||_||_||f|_dS�N)�	smtp_code�
smtp_error�args)�self�code�msgrrr�__init__cszSMTPResponseException.__init__N�rrrrr!rrrrrZsc@seZdZdZdd�ZdS)rz�Sender address refused.

    In addition to the attributes set by on all SMTPResponseException
    exceptions, this sets `sender' to the string that the SMTP refused.
    cCs"||_||_||_|||f|_dSr)rr�senderr)rrr r#rrrr!oszSMTPSenderRefused.__init__Nr"rrrrrhsc@seZdZdZdd�ZdS)rz�All recipient addresses refused.

    The errors for each recipient are accessible through the attribute
    'recipients', which is a dictionary of exactly the same sort as
    SMTP.sendmail() returns.
    cCs||_|f|_dSr)�
recipientsr)rr$rrrr!}szSMTPRecipientsRefused.__init__Nr"rrrrrusc@seZdZdZdS)r	z'The SMTP server didn't accept the data.Nrrrrrr	�sc@seZdZdZdS)r
z&Error during connection establishment.Nrrrrrr
�sc@seZdZdZdS)rz"The server refused our HELO reply.Nrrrrrr�sc@seZdZdZdS)rzvAuthentication error.

    Most probably the server didn't accept the username/password
    combination provided.
    Nrrrrrr�scCs>tj�|�\}}||fdkr6|���d�r.|Sd|Sd|S)z�Quote a subset of the email addresses defined by RFC 821.

    Should be able to handle anything email.utils.parseaddr can handle.
    ��r&�<z<%s>)�email�utils�	parseaddr�strip�
startswith�Z
addrstringZdisplayname�addrrrrr
�scCs$tj�|�\}}||fdkr |S|S)Nr%)r(r)r*r-rrr�
_addr_only�sr/c	Cst�ddt�dt|��S)z�Quote data for email.

    Double leading '.', and change Unix newline '\n', or Mac '\r' into
    Internet CRLF end-of-line.
    z(?m)^\.z..�(?:\r\n|\n|\r(?!\n))��re�sub�CRLF��datarrrr�s�cCst�dd|�S)Ns(?m)^\.s..)r2r3)Zbindatarrr�_quote_periods�sr7cCst�dt|�S)Nr0r1r5rrr�	_fix_eols�sr8FTc@szeZdZdZdZdZdZdZdZdZ	dZ
eZddde
jdfdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�ZdNdd�Zdd�ZdOdd�Zdd�ZdPdd�ZdQdd�ZdRdd �Zd!d"�ZdSd#d$�Zd%d&�Zd'd(�Zd)d*�Z dTd,d-�Z!dUd.d/�Z"d0d1�Z#d2d3�Z$e$Z%d4d5�Z&d6d7�Z'd8d9�d:d;�Z(dVd<d=�Z)dWd>d?�Z*dXd@dA�Z+d8d9�dBdC�Z,dYdDdE�Z-dZdFdG�Z.d[dHdI�Z/dJdK�Z0dLdM�Z1dS)\ra�This class manages a connection to an SMTP or ESMTP server.
    SMTP Objects:
        SMTP objects have the following attributes:
            helo_resp
                This is the message given by the server in response to the
                most recent HELO command.

            ehlo_resp
                This is the message given by the server in response to the
                most recent EHLO command. This is usually multiline.

            does_esmtp
                This is a True value _after you do an EHLO command_, if the
                server supports ESMTP.

            esmtp_features
                This is a dictionary, which, if the server supports ESMTP,
                will _after you do an EHLO command_, contain the names of the
                SMTP service extensions this server supports, and their
                parameters (if any).

                Note, all extension names are mapped to lower case in the
                dictionary.

        See each method's docstrings for details.  In general, there is a
        method of the same name to perform each SMTP command.  There is also a
        method called 'sendmail' that will do an entire mail transaction.
        rN�ehlor&c
Cs�||_||_i|_d|_||_d|_|rR|�||�\}}|dkrR|��t||��|dk	rb||_	nPt
��}d|krz||_	n8d}	zt
�t
�
��}	Wnt
jk
r�YnXd|	|_	dS)aInitialize a new instance.

        If specified, `host` is the name of the remote host to which to
        connect.  If specified, `port` specifies the port to which to connect.
        By default, smtplib.SMTP_PORT is used.  If a host is specified the
        connect method is called, and if it returns anything other than a
        success code an SMTPConnectError is raised.  If specified,
        `local_hostname` is used as the FQDN of the local host in the HELO/EHLO
        command.  Otherwise, the local hostname is found using
        socket.getfqdn(). The `source_address` parameter takes a 2-tuple (host,
        port) for the socket to bind to as its source address before
        connecting. If the host is '' and port is 0, the OS default behavior
        will be used.

        �asciir��N�.z	127.0.0.1z[%s])�_host�timeout�esmtp_features�command_encoding�source_address�_auth_challenge_count�connect�closer
�local_hostname�socketZgetfqdnZ
gethostbynameZgethostnameZgaierror)
r�host�portrEr>rArr Zfqdnr.rrrr!�s,
z
SMTP.__init__cCs|Srr�rrrr�	__enter__szSMTP.__enter__cGsNz>z$|�d�\}}|dkr$t||��Wntk
r:YnXW5|��XdS)NZQUIT��)rD�docmdrr)rrr�messagerrr�__exit__s
z
SMTP.__exit__cCs
||_dS)z�Set the debug output level.

        A non-false value results in debug messages for connection and for all
        messages sent to and received from the server.

        N)�
debuglevel)rrOrrr�set_debuglevel"szSMTP.set_debuglevelcGs@|jdkr,ttj����f|�dtji�nt|dtji�dS)N��file)rO�print�datetimeZnow�time�sys�stderr�rrrrr�_print_debug+s
"zSMTP._print_debugcCs2|jdkr|�d||f|j�t�||f||j�S)Nrzconnect: to)rOrYrArF�create_connection)rrGrHr>rrr�_get_socket1s

�zSMTP._get_socket�	localhostcCs�|r
||_|s||�d�|�d�kr||�d�}|dkr||d|�||dd�}}zt|�}Wntk
rztd��YnX|s�|j}t�d|||�|�	|||j
�|_d|_|�
�\}}|jdkr�|�dt|��||fS)apConnect to a host on a given port.

        If the hostname ends with a colon (`:') followed by a number, and
        there is no port specified, that suffix will be stripped off and the
        number interpreted as the port number to use.

        Note: This method is automatically invoked by __init__, if a host is
        specified during instantiation.

        �:rNrQznonnumeric portzsmtplib.connect�connect:)rA�find�rfind�int�
ValueError�OSError�default_portrV�auditr[r>�sockrR�getreplyrOrY�repr)rrGrHrA�irr rrrrC9s&

zSMTP.connectcCs�|jdkr|�dt|��|jr|t|t�r6|�|j�}t�	d||�z|j�
|�Wq�tk
rx|��t
d��Yq�Xnt
d��dS)zSend `s' to the server.rzsend:zsmtplib.send�Server not connectedzplease run connect() firstN)rOrYrhrf�
isinstance�str�encoder@rVreZsendallrcrDr)r�srrr�sendZs

z	SMTP.sendcCsd|dkr|}n|�d|��}d|ks,d|krN|�dd��dd�}td|����|�|�t���dS)	zSend a command to the server.r&� �
�
z\nz\rz=command and arguments contain prohibited newline characters: N)�replacerbror4)r�cmdrrnrrr�putcmdms�zSMTP.putcmdc
CsPg}|jdkr|j�d�|_z|j�td�}Wn:tk
rj}z|��tdt|���W5d}~XYnX|s�|��td��|j	dkr�|�
dt|��t|�tkr�|��t
dd	��|�|d
d��d��|dd�}zt|�}Wn tk
�rd
}Y�q YnX|dd
�dkr�q qd�|�}|j	dk�rH|�
d||f�||fS)a�Get a reply from the server.

        Returns a tuple consisting of:

          - server response code (e.g. '250', or such, if all goes well)
            Note: returns -1 if it can't read response code.

          - server response string corresponding to response code (multiline
            responses are converted to a single, multiline string).

        Raises SMTPServerDisconnected if end-of-file is reached.
        N�rbrQz Connection unexpectedly closed: zConnection unexpectedly closedrzreply:i�zLine too long.�s 	
�����-�
zreply: retcode (%s); Msg: %a)rRrfZmakefile�readline�_MAXLINErcrDrrlrOrYrh�lenr�appendr+rarb�join)r�resp�line�erZerrcode�errmsgrrrrgzs>

�


z
SMTP.getreplycCs|�||�|��S)z-Send a command, and return its response code.�rurg)rrtrrrrrL�sz
SMTP.docmdcCs,|�d|p|j�|��\}}||_||fS)zwSMTP 'helo' command.
        Hostname to send for this command defaults to the FQDN of the local
        host.
        �helo)rurErg�	helo_resp)r�namerr rrrr��sz	SMTP.heloc
CsHi|_|�|j|p|j�|��\}}|dkrJt|�dkrJ|��td��||_|dkr`||fSd|_	t
|jt�s�tt
|j���|j�d��d�}|d=|D]�}t�|�}|r�|j�dd	�d
|�d�d|jd<q�t�d|�}|r�|�d���}|j|�d�d
���}	|dk�r4|j�|d	�d
|	|j|<q�|	|j|<q�||fS)zx SMTP 'ehlo' command.
        Hostname to send for this command defaults to the FQDN of the local
        host.
        ryrrj�rQzlatin-1rr�authr&rpz((?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*) ?�featureN)r?ru�ehlo_msgrErgr~rDr�	ehlo_resp�
does_esmtprk�bytes�AssertionErrorrh�decode�split�
OLDSTYLE_AUTH�match�get�groupsr2�group�lower�string�endr+)
rr�rr r��eachZ
auth_match�mr�Zparamsrrrr9�sD
��

��z	SMTP.ehlocCs|��|jkS)z7Does the server support a given SMTP service extension?)r�r?)r�optrrr�has_extn�sz
SMTP.has_extncCs|�d|�|��dS)z;SMTP 'help' command.
        Returns help text from server.�helprQr�rXrrrr��sz	SMTP.helpcCsd|_|�d�S)z&SMTP 'rset' command -- resets session.r:�rset)r@rLrIrrrr��sz	SMTP.rsetcCs&z|��Wntk
r YnXdS)aInternal 'rset' command which ignores any SMTPServerDisconnected error.

        Used internally in the library, since the server disconnected error
        should appear to the application when the *next* command is issued, if
        we are doing an internal "safety" reset.
        N)r�rrIrrr�_rset�sz
SMTP._rsetcCs
|�d�S)z-SMTP 'noop' command -- doesn't do anything :>�noop)rLrIrrrr�	sz	SMTP.nooprcCshd}|rH|jrHtdd�|D��r:|�d�r2d|_ntd��dd�|�}|�dd	t|�|f�|��S)
a8SMTP 'mail' command -- begins mail xfer session.

        This method may raise the following exceptions:

         SMTPNotSupportedError  The options parameter includes 'SMTPUTF8'
                                but the SMTPUTF8 extension is not supported by
                                the server.
        r&css|]}|��dkVqdS)�smtputf8N)r�)�.0�xrrr�	<genexpr>szSMTP.mail.<locals>.<genexpr>r�zutf-8z SMTPUTF8 not supported by serverrp�mailz	FROM:%s%s)	r��anyr�r@rr�rur
rg)rr#�options�
optionlistrrrr�
s	

�z	SMTP.mailcCs<d}|r|jrdd�|�}|�ddt|�|f�|��S)z;SMTP 'rcpt' command -- indicates 1 recipient for this mail.r&rp�rcptzTO:%s%s)r�r�rur
rg)rZrecipr�r�rrrr�"s

z	SMTP.rcptcCs�|�d�|��\}}|jdkr0|�d||f�|dkrDt||��n|t|t�r\t|��d�}t	|�}|dd�t
kr||t
}|dt
}|�|�|��\}}|jdkr�|�d||f�||fSdS)	a�SMTP 'DATA' command -- sends message data to server.

        Automatically quotes lines beginning with a period per rfc821.
        Raises SMTPDataError if there is an unexpected reply to the
        DATA command; the return value from this method is the final
        response code received when the all data is sent.  If msg
        is a string, lone '\r' and '\n' characters are converted to
        '\r\n' characters.  If msg is bytes, it is transmitted as is.
        r6rzdata:ibr:���N�.)rurgrOrYr	rkrlr8rmr7�bCRLFro)rr r�repl�qrrrr6*s"





z	SMTP.datacCs|�dt|��|��S)z5SMTP 'verify' command -- checks for address validity.�vrfy�rur/rg�rZaddressrrr�verifyGszSMTP.verifycCs|�dt|��|��S)z.SMTP 'expn' command -- expands a mailing list.�expnr�r�rrrr�Nsz	SMTP.expncCsb|jdkr^|jdkr^d|��dkr0dks^n|��\}}d|krRdks^nt||��dS)abCall self.ehlo() and/or self.helo() if needed.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
        N��ri+)r�r�r9r�r)rrr�rrr�ehlo_or_helo_if_neededUs
zSMTP.ehlo_or_helo_if_neededT��initial_response_okc	Cs�|��}|r|�nd}|dk	rPt|�d�dd�}|�d|d|�\}}d|_n|�d|�\}}d|_|d	kr�|jd7_t�|�}t||��d�dd�}|�|�\}}|jtkrftd
t	||f���qf|dkr�||fSt
||��dS)a�Authentication command - requires response processing.

        'mechanism' specifies which authentication mechanism is to
        be used - the valid values are those listed in the 'auth'
        element of 'esmtp_features'.

        'authobject' must be a callable object taking a single argument:

                data = authobject(challenge)

        It will be called to process the server's challenge response; the
        challenge argument it is passed will be a bytes.  It should return
        an ASCII string that will be base64 encoded and sent to the server.

        Keyword arguments:
            - initial_response_ok: Allow sending the RFC 4954 initial-response
              to the AUTH command, if the authentication methods supports it.
        Nr:r&)ZeolZAUTHrprQriNz4Server AUTH mechanism infinite loop. Last response: ���i�)�upper�
encode_base64rmrLrB�base64Zdecodebytes�
_MAXCHALLENGErrhr)	rZ	mechanismZ
authobjectr�Zinitial_responseZresponserr��	challengerrrr�fs2
�

��z	SMTP.authcCs0|dkrdS|jdt�|j�d�|d���S)zh Authobject to use with CRAM-MD5 authentication. Requires self.user
        and self.password to be set.Nrpr:Zmd5)�user�hmacZHMAC�passwordrmZ	hexdigest�rr�rrr�
auth_cram_md5�s
�zSMTP.auth_cram_md5cCsd|j|jfS)ze Authobject to use with PLAIN authentication. Requires self.user and
        self.password to be set.z%s%s)r�r�r�rrr�
auth_plain�szSMTP.auth_plaincCs"|dks|jdkr|jS|jSdS)ze Authobject to use with LOGIN authentication. Requires self.user and
        self.password to be set.N�)rBr�r�r�rrr�
auth_login�szSMTP.auth_logincs�|��|�d�std��|jd���dddg}�fdd�|D�}|sPtd��|||_|_|D]t}d	|���	d
d�}z4|j
|t||�|d�\}}	|d
kr�||	fWSWqbtk
r�}
z|
}W5d}
~
XYqbXqb|�dS)awLog in on an SMTP server that requires authentication.

        The arguments are:
            - user:         The user name to authenticate with.
            - password:     The password for the authentication.

        Keyword arguments:
            - initial_response_ok: Allow sending the RFC 4954 initial-response
              to the AUTH command, if the authentication methods supports it.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.

        This method will return normally if the authentication was successful.

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
         SMTPAuthenticationError  The server didn't accept the username/
                                  password combination.
         SMTPNotSupportedError    The AUTH command is not supported by the
                                  server.
         SMTPException            No suitable authentication method was
                                  found.
        r�z,SMTP AUTH extension not supported by server.zCRAM-MD5ZPLAINZLOGINcsg|]}|�kr|�qSrr)r�r��Zadvertised_authlistrr�
<listcomp>�s�zSMTP.login.<locals>.<listcomp>z(No suitable authentication method found.Zauth_�-�_r�r�N)
r�r�rr?r�rr�r�r�rsr��getattrr)rr�r�r�Zpreferred_authsZauthlistZ
authmethodZmethod_namerr�r�Zlast_exceptionrr�r�login�s0
�
�
z
SMTP.logincCs�|��|�d�std��|�d�\}}|dkr�ts<td��|dk	rT|dk	rTtd��|dk	rl|dk	rltd��|dk	s||dk	r�d	dl}|�d
t	d�|dkr�t
j||d�}|j|j
|jd
�|_
d|_d|_d|_i|_d	|_n
t||��||fS)a�Puts the connection to the SMTP server into TLS mode.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.

        If the server supports TLS, this will encrypt the rest of the SMTP
        session. If you provide the keyfile and certfile parameters,
        the identity of the SMTP server and client can be checked. This,
        however, depends on whether the socket module really checks the
        certificates.

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
        �starttlsz+STARTTLS extension not supported by server.ZSTARTTLSr;z&No SSL support included in this PythonN�4context and keyfile arguments are mutually exclusive�5context and certfile arguments are mutually exclusiver�Akeyfile and certfile are deprecated, use a custom context insteadr���certfile�keyfile�Zserver_hostname)r�r�rrL�	_have_ssl�RuntimeErrorrb�warnings�warn�DeprecationWarning�ssl�_create_stdlib_context�wrap_socketrfr=rRr�r�r?r�r)rr�r��contextr�Zreplyr�rrrr��sB
����
z
SMTP.starttlscCs^|��g}t|t�r$t|��d�}|jrZ|�d�rF|�dt|��|D]}|�|�qJ|�	||�\}}	|dkr�|dkr�|�
�n|��t||	|��i}
t|t�r�|g}|D]H}|�
||�\}}	|dkr�|dkr�||	f|
|<|dkr�|�
�t|
��q�t|
�t|�k�r|��t|
��|�|�\}}	|dk�rZ|dk�rH|�
�n|��t||	��|
S)a|This command performs an entire mail transaction.

        The arguments are:
            - from_addr    : The address sending this mail.
            - to_addrs     : A list of addresses to send this mail to.  A bare
                             string will be treated as a list with 1 address.
            - msg          : The message to send.
            - mail_options : List of ESMTP options (such as 8bitmime) for the
                             mail command.
            - rcpt_options : List of ESMTP options (such as DSN commands) for
                             all the rcpt commands.

        msg may be a string containing characters in the ASCII range, or a byte
        string.  A string is encoded to bytes using the ascii codec, and lone
        \r and \n characters are converted to \r\n characters.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.  If the server does ESMTP, message size
        and each of the specified options will be passed to it.  If EHLO
        fails, HELO will be tried and ESMTP options suppressed.

        This method will return normally if the mail is accepted for at least
        one recipient.  It returns a dictionary, with one entry for each
        recipient that was refused.  Each entry contains a tuple of the SMTP
        error code and the accompanying error message sent by the server.

        This method may raise the following exceptions:

         SMTPHeloError          The server didn't reply properly to
                                the helo greeting.
         SMTPRecipientsRefused  The server rejected ALL recipients
                                (no mail was sent).
         SMTPSenderRefused      The server didn't accept the from_addr.
         SMTPDataError          The server replied with an unexpected
                                error code (other than a refusal of
                                a recipient).
         SMTPNotSupportedError  The mail_options parameter includes 'SMTPUTF8'
                                but the SMTPUTF8 extension is not supported by
                                the server.

        Note: the connection will be open even after an exception is raised.

        Example:

         >>> import smtplib
         >>> s=smtplib.SMTP("localhost")
         >>> tolist=["one@one.org","two@two.org","three@three.org","four@four.org"]
         >>> msg = '''\
         ... From: Me@my.org
         ... Subject: testin'...
         ...
         ... This is a test '''
         >>> s.sendmail("me@my.org",tolist,msg)
         { "three@three.org" : ( 550 ,"User unknown" ) }
         >>> s.quit()

        In the above example, the message was accepted for delivery to three
        of the four addresses, and one was rejected, with the error code
        550.  If all addresses are accepted, then the method will return an
        empty dictionary.

        r:�sizezsize=%dr�i��)r�rkrlr8rmr�r�rr~r�rDr�rr�rr6r	)r�	from_addr�to_addrsr �mail_options�rcpt_optionsZ
esmtp_optsZoptionrr�Zsenderrsr�rrr�sendmail&sF@








z
SMTP.sendmailc	Cs�|��|�d�}|dkr d}nt|�dkr2d}ntd��|dkr||d|krZ||dn
||d}tj�|g�d	d}|dkr�d
d�||d||d
||dfD�}dd�tj�|�D�}t�|�}	|	d
=|	d=d}
zd�|f|���	d�Wn.t
k
�r(|�d��s td��d}
YnXt
���R}|
�r^tjj||jjdd�d�}|d�}ntj�|�}|j|	dd�|��}
W5QRX|�|||
||�S)a~Converts message to a bytestring and passes it to sendmail.

        The arguments are as for sendmail, except that msg is an
        email.message.Message object.  If from_addr is None or to_addrs is
        None, these arguments are taken from the headers of the Message as
        described in RFC 2822 (a ValueError is raised if there is more than
        one set of 'Resent-' headers).  Regardless of the values of from_addr and
        to_addr, any Bcc field (or Resent-Bcc field, when the Message is a
        resent) of the Message object won't be transmitted.  The Message
        object is then serialized using email.generator.BytesGenerator and
        sendmail is called to transmit the message.  If the sender or any of
        the recipient addresses contain non-ASCII and the server advertises the
        SMTPUTF8 capability, the policy is cloned with utf8 set to True for the
        serialization, and SMTPUTF8 and BODY=8BITMIME are asserted on the send.
        If the server does not support SMTPUTF8, an SMTPNotSupported error is
        raised.  Otherwise the generator is called without modifying the
        policy.

        zResent-DateNr&rQzResent-z0message has more than one 'Resent-' header blockZSender�FromrcSsg|]}|dk	r|�qSrr)r��frrrr��s�z%SMTP.send_message.<locals>.<listcomp>�ToZBccZCccSsg|]}|d�qS)rQr)r��arrrr��sz
Resent-BccFr:r�z�One or more source or delivery addresses require internationalized email support, but the server does not advertise the required SMTPUTF8 capabilityT)�utf8)�policy�SMTPUTF8�
BODY=8BITMIMEr)�linesep)r�r�)r�Zget_allr~rbr(r)Zgetaddresses�copyr�rm�UnicodeEncodeErrorr�r�io�BytesIO�	generatorZBytesGeneratorr�ZcloneZflatten�getvaluer�)rr r�r�r�r�ZresentZ
header_prefixZaddr_fieldsZmsg_copyZ
internationalZbytesmsg�gZflatmsgrrr�send_message�sX

�
�

�
�

�
�zSMTP.send_messagecCs<z|j}d|_|r|��W5|j}d|_|r6|��XdS)z(Close the connection to the SMTP server.N)rfrDrR)rrfrRrrrrD�sz
SMTP.closecCs.|�d�}d|_|_i|_d|_|��|S)zTerminate the SMTP session.�quitNF)rLr�r�r?r�rD)r�resrrrr��s
z	SMTP.quit)r\rN)r&)r&)r&)r&)r&)r)r)N)N)N)NNN)rr)NNrr)2rrrrrOrfrRr�r�r�r��	SMTP_PORTrdrF�_GLOBAL_DEFAULT_TIMEOUTr!rJrNrPrYr[rCrorurgrLr�r9r�r�r�r�r�r�r�r6r�r�r�r�r�r�r�r�r�r�r�r�rDr�rrrrr�sh�
0
	
!

1



3


0
	

B
8�
h�
M
c@s8eZdZdZeZdddddejddfdd�Zdd�Z	dS)	�SMTP_SSLa� This is a subclass derived from SMTP that connects over an SSL
        encrypted socket (to use this class you need a socket module that was
        compiled with SSL support). If host is not specified, '' (the local
        host) is used. If port is omitted, the standard SMTP-over-SSL port
        (465) is used.  local_hostname and source_address have the same meaning
        as they do in the SMTP class.  keyfile and certfile are also optional -
        they can contain a PEM formatted private key and certificate chain file
        for the SSL connection. context also optional, can contain a
        SSLContext, and is an alternative to keyfile and certfile; If it is
        specified both keyfile and certfile must be None.

        r&rNc	
Cs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}	|	�dtd�||_||_|dkrxtj||d�}||_t	�
||||||�dS)Nr�r�rr�r�r�)rbr�r�r�r�r�r�r�r�rr!)
rrGrHrEr�r�r>rAr�r�rrrr!s(���zSMTP_SSL.__init__cCsD|jdkr|�d||f�t�||f||j�}|jj||jd�}|S)Nrr^r�)rOrYrFrZrAr�r�r=)rrGrHr>Z
new_socketrrrr[s
��zSMTP_SSL._get_socket)
rrrr�
SMTP_SSL_PORTrdrFr�r!r[rrrrr��s
�
r�i�c@s0eZdZdZdZdeddfdd�Zdd	d
�ZdS)�LMTPa�LMTP - Local Mail Transfer Protocol

    The LMTP protocol, which is very similar to ESMTP, is heavily based
    on the standard SMTP client. It's common to use Unix sockets for
    LMTP, so our connect() method must support that as well as a regular
    host:port server.  local_hostname and source_address have the same
    meaning as they do in the SMTP class.  To specify a Unix socket,
    you must use an absolute path as the host, starting with a '/'.

    Authentication is supported, using the regular SMTP mechanism. When
    using a Unix socket, LMTP generally don't support or require any
    authentication, but your mileage might vary.Zlhlor&NcCstj|||||d�dS)zInitialize a new instance.)rErAN)rr!)rrGrHrErArrrr!;s�z
LMTP.__init__r\rcCs�|ddkrtj||||d�Sz(t�tjtj�|_d|_|j�|�WnBtk
r�|jdkrl|�	d|�|jr||j�
�d|_�YnX|��\}}|jdkr�|�	d|�||fS)z=Connect to the LMTP daemon, on either a Unix or a TCP socket.r�/)rANz
connect fail:r^)rrCrFZAF_UNIXZSOCK_STREAMrfrRrcrOrYrDrg)rrGrHrArr rrrrCAs"


zLMTP.connect)r\rN)rrrrr��	LMTP_PORTr!rCrrrrr�+s
�
r��__main__cCs(tj�|d�tj��tj����S)Nz: )rV�stdout�write�flush�stdinr|r+)�promptrrrr[s
rr�r��,zEnter message, end with ^D:r&zMessage length is %dr\rQ)ArrFr�r2Zemail.utilsr(Z
email.messageZemail.generatorr�r�r�rTrVZemail.base64mimerr��__all__r�r�r4r�r}r��compile�Ir�rcrrrrrrr	r
rrr
r/rr7r8r��ImportErrorr�rr�rrr�rrZfromaddrr�ZtoaddrsrSr rr|r�r~ZserverrPr�r�rrrr�<module>s�)�


	
:0
/


timeit.cpython-38.opt-1.pyc000064400000027003150335716500011435 0ustar00U

e5d�4�@s�dZddlZddlZddlZddlZddddgZdZdZd	Zej	Z
eZd
Z
dd�ZGd
d�d�Zdde
edfdd�Zdde
eedfdd�Zddd�dd�Zedkr�e�e��dS)a9Tool for measuring execution time of small code snippets.

This module avoids a number of common traps for measuring execution
times.  See also Tim Peters' introduction to the Algorithms chapter in
the Python Cookbook, published by O'Reilly.

Library usage: see the Timer class.

Command line usage:
    python timeit.py [-n N] [-r N] [-s S] [-p] [-h] [--] [statement]

Options:
  -n/--number N: how many times to execute 'statement' (default: see below)
  -r/--repeat N: how many times to repeat the timer (default 5)
  -s/--setup S: statement to be executed once initially (default 'pass').
                Execution time of this setup statement is NOT timed.
  -p/--process: use time.process_time() (default is time.perf_counter())
  -v/--verbose: print raw timing results; repeat for more digits precision
  -u/--unit: set the output time unit (nsec, usec, msec, or sec)
  -h/--help: print this usage message and exit
  --: separate options from statement, use when statement starts with -
  statement: statement to be timed (default 'pass')

A multi-line statement may be given by specifying each line as a
separate argument; indented lines are possible by enclosing an
argument in quotes and using leading spaces.  Multiple -s options are
treated similarly.

If -n is not given, a suitable number of loops is calculated by trying
increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the
total time is at least 0.2 seconds.

Note: there is a certain baseline overhead associated with executing a
pass statement.  It differs between versions.  The code here doesn't try
to hide it, but you should be aware of it.  The baseline overhead can be
measured by invoking the program without arguments.

Classes:

    Timer

Functions:

    timeit(string, string) -> float
    repeat(string, string) -> list
    default_timer() -> float

�N�Timer�timeit�repeat�
default_timerz<timeit-src>i@B�z�
def inner(_it, _timer{init}):
    {setup}
    _t0 = _timer()
    for _i in _it:
        {stmt}
    _t1 = _timer()
    return _t1 - _t0
cCs|�ddd|�S)z*Helper to reindent a multi-line statement.�
� )�replace)�src�indent�r�/usr/lib64/python3.8/timeit.py�reindentOsrc@sPeZdZdZddedfdd�Zddd�Zefdd	�Ze	efd
d�Z
ddd
�ZdS)ra�Class for timing execution speed of small code snippets.

    The constructor takes a statement to be timed, an additional
    statement used for setup, and a timer function.  Both statements
    default to 'pass'; the timer function is platform-dependent (see
    module doc string).  If 'globals' is specified, the code will be
    executed within that namespace (as opposed to inside timeit's
    namespace).

    To measure the execution time of the first statement, use the
    timeit() method.  The repeat() method is a convenience to call
    timeit() multiple times and return a list of results.

    The statements may contain newlines, as long as they don't contain
    multi-line string literals.
    �passNcCs�||_i}|dkrt�n|}d}t|t�rJt|td�|d}t|d�}n*t|�rl||d<|d7}d}d}ntd	��t|t�r�t||td�t|d
�}n&t|�r�||d<|d7}d
}ntd��t	j
|||d�}	|	|_t|	td�}
t|
||�|d|_
dS)z#Constructor.  See class doc string.N��execr��_setupz, _setup=_setupz_setup()z&setup is neither a string nor callable�Z_stmtz
, _stmt=_stmtz_stmt()z%stmt is neither a string nor callable)�stmt�setup�init�inner)�timer�_globals�
isinstance�str�compile�dummy_src_namer�callable�
ValueError�template�formatr
rr)�selfrrr�globalsZlocal_nsZ	global_nsrZ
stmtprefixr
�coderrr
�__init__es6

zTimer.__init__cCsJddl}ddl}|jdk	r:t|j�d|j�d�tf|jt<|j|d�dS)a�Helper to print a traceback from the timed code.

        Typical use:

            t = Timer(...)       # outside the try/except
            try:
                t.timeit(...)    # or t.repeat(...)
            except:
                t.print_exc()

        The advantage over the standard traceback is that source lines
        in the compiled template will be displayed.

        The optional file argument directs where the traceback is
        sent; it defaults to sys.stderr.
        rNr��file)�	linecache�	tracebackr
�len�splitr�cache�	print_exc)r#r(r)r*rrr
r.�s

�
zTimer.print_exccCsBt�d|�}t��}t��z|�||j�}W5|r<t��X|S)a�Time 'number' executions of the main statement.

        To be precise, this executes the setup statement once, and
        then returns the time it takes to execute the main statement
        a number of times, as a float measured in seconds.  The
        argument is the number of times through the loop, defaulting
        to one million.  The main statement, the setup statement and
        the timer function to be used are passed to the constructor.
        N)�	itertoolsr�gcZ	isenabledZdisableZenablerr)r#�number�itZgcoldZtimingrrr
r�s

zTimer.timeitcCs*g}t|�D]}|�|�}|�|�q|S)a�Call timeit() a few times.

        This is a convenience function that calls the timeit()
        repeatedly, returning a list of results.  The first argument
        specifies how many times to call timeit(), defaulting to 5;
        the second argument specifies the timer argument, defaulting
        to one million.

        Note: it's tempting to calculate mean and standard deviation
        from the result vector and report these.  However, this is not
        very useful.  In a typical case, the lowest value gives a
        lower bound for how fast your machine can run the given code
        snippet; higher values in the result vector are typically not
        caused by variability in Python's speed, but by other
        processes interfering with your timing accuracy.  So the min()
        of the result is probably the only number you should be
        interested in.  After that, you should look at the entire
        vector and apply common sense rather than statistics.
        )�ranger�append)r#rr1�r�i�trrr
r�s

zTimer.repeatcCsPd}dD]8}||}|�|�}|r,|||�|dkr||fSq|d9}qdS)a�Return the number of loops and time taken so that total time >= 0.2.

        Calls the timeit method with increasing numbers from the sequence
        1, 2, 5, 10, 20, 50, ... until the time taken is at least 0.2
        second.  Returns (number, time_taken).

        If *callback* is given and is not None, it will be called after
        each trial with two arguments: ``callback(number, time_taken)``.
        �)r8�rg�������?�
N)r)r#�callbackr6�jr1�
time_takenrrr
�	autorange�s


zTimer.autorange)N)N)�__name__�
__module__�__qualname__�__doc__rr&r.�default_numberr�default_repeatrr>rrrr
rSs�
#
rcCst||||��|�S)zCConvenience function to create Timer object and call timeit method.)rr)rrrr1r$rrr
r�scCst||||��||�S)zCConvenience function to create Timer object and call repeat method.)rr)rrrrr1r$rrr
r�s)�_wrap_timerc
s|dkrtjdd�}ddl}z(|�|dddddd	d
ddd
g	�\}}Wn:|jk
r�}zt|�td�WY�dSd}~XYnXt}d�|�p�d}d�g}t}d}	d�ddddd��d�|D]�\}
}|
dkr�t|��|
dkr�|�	|�|
dk�r|�k�r|�ntdtj
d�dS|
dk�r6t|�}|dk�r6d}|
dk�rFtj}|
dk�rf|	�r^�d7�|	d7}	|
d kr�tt
d!d"�dSq�d�|��p�d}ddl}tj�d|j�|dk	�r�||�}t|||�}
�dk�rd}|	�r�fd#d$�}z|
�|�\�}Wn|
��YdSX|	�rt�z|
�|��}Wn|
��YdSX���fd%d&�}|	�rztd'd(�t||���t��fd)d*�|D�}t|�}td+��dk�r�d,nd-|||�f�t|�}t|�}||d.k�rddl}|�d/||�||�ftd-d�dS)0a�Main program, used when run as a script.

    The optional 'args' argument specifies the command line to be parsed,
    defaulting to sys.argv[1:].

    The return value is an exit code to be passed to sys.exit(); it
    may be None to indicate success.

    When an exception happens during timing, a traceback is printed to
    stderr and the return value is 1.  Exceptions at other times
    (including the template compilation) are not caught.

    '_wrap_timer' is an internal interface used for unit testing.  If it
    is not None, it must be a callable that accepts a timer function
    and returns another timer function (used for unit testing).
    Nr8rz
n:u:s:r:tcpvhznumber=zsetup=zrepeat=�timeZclockZprocess�verbosezunit=�helpz#use -h/--help for command line helpr9rrg��&�.>g���ư>g����MbP?g�?)ZnsecZusecZmsecZsec�)z-nz--number)z-sz--setup)z-uz--unitz:Unrecognized unit. Please select nsec, usec, msec, or sec.r')z-rz--repeat)z-pz	--process)z-vz	--verbose)z-hz--helpr)�endcs.d}|dk}t|j||rdnd|�d��dS)Nz%{num} loop{s} -> {secs:.{prec}g} secsr8�sr)ZnumrKZsecsZprec)�printr")r1r=�msgZplural)�	precisionrr
r;?s�zmain.<locals>.callbackcs`�}|dk	r�|}n8dd����D�}|jdd�|D]\}}||kr8qNq8d�|||fS)NcSsg|]\}}||f�qSrr)�.0�unit�scalerrr
�
<listcomp>Ysz-main.<locals>.format_time.<locals>.<listcomp>T)�reversez%.*g %s)�items�sort)�dtrPrQZscales)rN�	time_unit�unitsrr
�format_timeSs
zmain.<locals>.format_timez
raw times: %sz, csg|]}|��qSrr)rOrV)r1rr
rRdszmain.<locals>.<listcomp>z"%d loop%s, best of %d: %s per looprKrrztThe test results are likely unreliable. The worst time (%s) was more than four times slower than the best time (%s).)�sys�argv�getopt�errorrLr�joinrD�intr4�stderrrF�process_timerB�os�path�insert�curdirrr>r.r�map�min�max�warnings�
warn_explicit�UserWarning)�argsrEr\Zopts�errrrrrrG�o�arbr7r;�_Zraw_timingsrYZtimingsZbestZworstrir)r1rNrWrXr
�main�s���


�





����rq�__main__)N)rBr0rZrFr/�__all__rrCrD�perf_counterrr$rr!rrrrrqr?�exitrrrr
�<module>s61
�
�
sre_constants.cpython-38.opt-2.pyc000064400000013460150335716500013032 0ustar00U

e5d��@s@dZddlmZmZGdd�de�ZGdd�de�Zeed�Zdd	�Zed
�Z	e	dd�=ed
�Z
ed�Zee
eeiZeeeeiZeeeeiZeeeeiZeeeeiZ ee!ee"iZ#e$e$e%e%e&e&e'e'e(e)e*e+e,e,e-e-iZ.e$e/e%e0e&e1e'e2e(e3e*e4e,e5e-e6iZ7dZ8dZ9dZ:dZ;dZ<dZ=dZ>dZ?dZ@dZAdZBdZCeDdk�r<dd�ZEeFdd���ZGeG�Hd�eG�Hde�eEeGe	d�eEeGe
d �eEeGed �eG�Hd!e8�eG�Hd"e9�eG�Hd#e:�eG�Hd$e;�eG�Hd%e<�eG�Hd&e=�eG�Hd'e>�eG�Hd(e?�eG�Hd)e@�eG�Hd*eA�eG�Hd+eB�eG�Hd,eC�W5QRXeId-�dS).i��3�)�	MAXREPEAT�	MAXGROUPScs"eZdZdZd�fdd�	Z�ZS)�error�reNcs�||_||_||_|dk	r�|dk	r�d||f}t|t�r>d}nd}|�|d|�d|_||�|d|�|_||kr�d||j|jf}nd|_|_t	��
|�dS)Nz%s at position %d�
�
r�z%s (line %d, column %d))�msg�pattern�pos�
isinstance�str�count�lineno�rfind�colno�super�__init__)�selfr	r
r�newline��	__class__��%/usr/lib64/python3.8/sre_constants.pyr%s
zerror.__init__)NN)�__name__�
__module__�__qualname__r�
__classcell__rrrrrsrcs$eZdZ�fdd�Zdd�Z�ZS)�_NamedIntConstantcstt|��||�}||_|S�N)rr�__new__�name)�cls�valuer!rrrrr 9sz_NamedIntConstant.__new__cCs|jSr�r!)rrrr�__repr__>sz_NamedIntConstant.__repr__)rrrr r%rrrrrr8srrcCs8|����}dd�t|�D�}t��dd�|D��|S)NcSsg|]\}}t||��qSr)r)�.0�ir!rrr�
<listcomp>Esz_makecodes.<locals>.<listcomp>cSsi|]}|j|�qSrr$)r&�itemrrr�
<dictcomp>Fsz_makecodes.<locals>.<dictcomp>)�strip�split�	enumerate�globals�update)�names�itemsrrr�
_makecodesCsr2az
    FAILURE SUCCESS

    ANY ANY_ALL
    ASSERT ASSERT_NOT
    AT
    BRANCH
    CALL
    CATEGORY
    CHARSET BIGCHARSET
    GROUPREF GROUPREF_EXISTS
    IN
    INFO
    JUMP
    LITERAL
    MARK
    MAX_UNTIL
    MIN_UNTIL
    NOT_LITERAL
    NEGATE
    RANGE
    REPEAT
    REPEAT_ONE
    SUBPATTERN
    MIN_REPEAT_ONE

    GROUPREF_IGNORE
    IN_IGNORE
    LITERAL_IGNORE
    NOT_LITERAL_IGNORE

    GROUPREF_LOC_IGNORE
    IN_LOC_IGNORE
    LITERAL_LOC_IGNORE
    NOT_LITERAL_LOC_IGNORE

    GROUPREF_UNI_IGNORE
    IN_UNI_IGNORE
    LITERAL_UNI_IGNORE
    NOT_LITERAL_UNI_IGNORE
    RANGE_UNI_IGNORE

    MIN_REPEAT MAX_REPEAT
���Nz�
    AT_BEGINNING AT_BEGINNING_LINE AT_BEGINNING_STRING
    AT_BOUNDARY AT_NON_BOUNDARY
    AT_END AT_END_LINE AT_END_STRING

    AT_LOC_BOUNDARY AT_LOC_NON_BOUNDARY

    AT_UNI_BOUNDARY AT_UNI_NON_BOUNDARY
a�
    CATEGORY_DIGIT CATEGORY_NOT_DIGIT
    CATEGORY_SPACE CATEGORY_NOT_SPACE
    CATEGORY_WORD CATEGORY_NOT_WORD
    CATEGORY_LINEBREAK CATEGORY_NOT_LINEBREAK

    CATEGORY_LOC_WORD CATEGORY_LOC_NOT_WORD

    CATEGORY_UNI_DIGIT CATEGORY_UNI_NOT_DIGIT
    CATEGORY_UNI_SPACE CATEGORY_UNI_NOT_SPACE
    CATEGORY_UNI_WORD CATEGORY_UNI_NOT_WORD
    CATEGORY_UNI_LINEBREAK CATEGORY_UNI_NOT_LINEBREAK
r����� �@���__main__cCs*t|�}|D]}|�d|||f�qdS)Nz#define %s_%s %d
)�sorted�write)�f�d�prefixr1r)rrr�dump�srBzsre_constants.h�wao/*
 * Secret Labs' Regular Expression Engine
 *
 * regular expression matching engine
 *
 * NOTE: This file is generated by sre_constants.py.  If you need
 * to change anything in here, edit sre_constants.py and run it.
 *
 * Copyright (c) 1997-2001 by Secret Labs AB.  All rights reserved.
 *
 * See the _sre.c file for information on usage and redistribution.
 */

z#define SRE_MAGIC %d
ZSRE_OPZSREz#define SRE_FLAG_TEMPLATE %d
z#define SRE_FLAG_IGNORECASE %d
z#define SRE_FLAG_LOCALE %d
z#define SRE_FLAG_MULTILINE %d
z#define SRE_FLAG_DOTALL %d
z#define SRE_FLAG_UNICODE %d
z#define SRE_FLAG_VERBOSE %d
z#define SRE_FLAG_DEBUG %d
z#define SRE_FLAG_ASCII %d
z#define SRE_INFO_PREFIX %d
z#define SRE_INFO_LITERAL %d
z#define SRE_INFO_CHARSET %d
Zdone)J�MAGIC�_srerr�	Exceptionr�intrr2�OPCODES�ATCODES�CHCODES�LITERAL�LITERAL_IGNORE�NOT_LITERAL�NOT_LITERAL_IGNORE�	OP_IGNORE�LITERAL_LOC_IGNORE�NOT_LITERAL_LOC_IGNORE�OP_LOCALE_IGNORE�LITERAL_UNI_IGNORE�NOT_LITERAL_UNI_IGNORE�OP_UNICODE_IGNORE�AT_BEGINNINGZAT_BEGINNING_LINE�AT_ENDZAT_END_LINE�AT_MULTILINEZAT_BOUNDARYZAT_LOC_BOUNDARYZAT_NON_BOUNDARYZAT_LOC_NON_BOUNDARY�	AT_LOCALEZAT_UNI_BOUNDARYZAT_UNI_NON_BOUNDARY�
AT_UNICODEZCATEGORY_DIGITZCATEGORY_NOT_DIGITZCATEGORY_SPACEZCATEGORY_NOT_SPACEZ
CATEGORY_WORDZCATEGORY_LOC_WORDZCATEGORY_NOT_WORDZCATEGORY_LOC_NOT_WORDZCATEGORY_LINEBREAKZCATEGORY_NOT_LINEBREAK�	CH_LOCALEZCATEGORY_UNI_DIGITZCATEGORY_UNI_NOT_DIGITZCATEGORY_UNI_SPACEZCATEGORY_UNI_NOT_SPACEZCATEGORY_UNI_WORDZCATEGORY_UNI_NOT_WORDZCATEGORY_UNI_LINEBREAKZCATEGORY_UNI_NOT_LINEBREAK�
CH_UNICODE�SRE_FLAG_TEMPLATE�SRE_FLAG_IGNORECASE�SRE_FLAG_LOCALE�SRE_FLAG_MULTILINE�SRE_FLAG_DOTALL�SRE_FLAG_UNICODE�SRE_FLAG_VERBOSE�SRE_FLAG_DEBUG�SRE_FLAG_ASCII�SRE_INFO_PREFIX�SRE_INFO_LITERAL�SRE_INFO_CHARSETrrB�openr?r>�printrrrr�<module>s�!	
,
��������

subprocess.cpython-38.pyc000064400000122341150335716500011374 0ustar00U

e5d�1�@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZdddddd	d
ddd
ddddgZ
zddlZddlZdZWn0ek
r�dZddlZddlZddlZYn�XddlmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&e
�'dddddddddddd d!d"d#d$d%d&d'g�Gd(d�de(�Z)Gd)d
�d
e)�Z*Gd*d�de)�Z+e�r�Gd+d�d�Z,Gd,d-�d-e-�Z.n&e/ed.d/�Z0e1ed0��r�ej2Z3nej4Z3e�r�dZ5d1d2�Z6ngZ5d3d2�Z6d4Z7d5Z8d6Z9d7d8�Z:d9d:�Z;dd;�d<d�Z<d=d�Z=dd;�d>d�Z>Gd?d�de?�Z@ddddd@�dAd�ZAdBdC�ZBdDd	�ZCdEd
�ZDdFdG�ZEeE�ZFGdHd�de?�ZGdS)Ia�Subprocesses with accessible I/O streams

This module allows you to spawn processes, connect to their
input/output/error pipes, and obtain their return codes.

For a complete description of this module see the Python documentation.

Main API
========
run(...): Runs a command, waits for it to complete, then returns a
          CompletedProcess instance.
Popen(...): A class for flexibly executing a command in a new process

Constants
---------
DEVNULL: Special value that indicates that os.devnull should be used
PIPE:    Special value that indicates a pipe should be created
STDOUT:  Special value that indicates that stderr should go to stdout


Older API
=========
call(...): Runs a command, waits for it to complete, then returns
    the return code.
check_call(...): Same as call() but raises CalledProcessError()
    if return code is not 0
check_output(...): Same as check_call() but returns the contents of
    stdout instead of a return code
getoutput(...): Runs a command in the shell, waits for it to complete,
    then returns the output
getstatusoutput(...): Runs a command in the shell, waits for it to complete,
    then returns a (exitcode, output) tuple
�N)�	monotonic�Popen�PIPE�STDOUT�call�
check_call�getstatusoutput�	getoutput�check_output�run�CalledProcessError�DEVNULL�SubprocessError�TimeoutExpired�CompletedProcessTF)�CREATE_NEW_CONSOLE�CREATE_NEW_PROCESS_GROUP�STD_INPUT_HANDLE�STD_OUTPUT_HANDLE�STD_ERROR_HANDLE�SW_HIDE�STARTF_USESTDHANDLES�STARTF_USESHOWWINDOW�ABOVE_NORMAL_PRIORITY_CLASS�BELOW_NORMAL_PRIORITY_CLASS�HIGH_PRIORITY_CLASS�IDLE_PRIORITY_CLASS�NORMAL_PRIORITY_CLASS�REALTIME_PRIORITY_CLASS�CREATE_NO_WINDOW�DETACHED_PROCESS�CREATE_DEFAULT_ERROR_MODE�CREATE_BREAKAWAY_FROM_JOBrrrrrrrr�STARTUPINFOrrrrrrrr r!r"c@seZdZdS)rN)�__name__�
__module__�__qualname__�r'r'�"/usr/lib64/python3.8/subprocess.pyr`sc@s<eZdZdZd
dd�Zdd�Zedd��Zejd	d��ZdS)rz�Raised when run() is called with check=True and the process
    returns a non-zero exit status.

    Attributes:
      cmd, returncode, stdout, stderr, output
    NcCs||_||_||_||_dS�N)�
returncode�cmd�output�stderr)�selfr*r+r,r-r'r'r(�__init__jszCalledProcessError.__init__cCsh|jrT|jdkrTzd|jt�|j�fWStk
rPd|j|jfYSXnd|j|jfSdS)NrzCommand '%s' died with %r.z)Command '%s' died with unknown signal %d.z.Command '%s' returned non-zero exit status %d.)r*r+�signalZSignals�
ValueError�r.r'r'r(�__str__ps���zCalledProcessError.__str__cCs|jS)z+Alias for output attribute, to match stderr�r,r2r'r'r(�stdout|szCalledProcessError.stdoutcCs
||_dSr)r4�r.�valuer'r'r(r5�s)NN�	r$r%r&�__doc__r/r3�propertyr5�setterr'r'r'r(rcs

c@s<eZdZdZd
dd�Zdd�Zedd��Zejd	d��ZdS)rz�This exception is raised when the timeout expires while waiting for a
    child process.

    Attributes:
        cmd, output, stdout, stderr, timeout
    NcCs||_||_||_||_dSr))r+�timeoutr,r-)r.r+r<r,r-r'r'r(r/�szTimeoutExpired.__init__cCsd|j|jfS)Nz'Command '%s' timed out after %s seconds)r+r<r2r'r'r(r3�s
�zTimeoutExpired.__str__cCs|jSr)r4r2r'r'r(r5�szTimeoutExpired.stdoutcCs
||_dSr)r4r6r'r'r(r5�s)NNr8r'r'r'r(r�s

c@s,eZdZddddddd�dd�Zdd�ZdS)r#rN��dwFlags�	hStdInput�
hStdOutput�	hStdError�wShowWindow�lpAttributeListcCs0||_||_||_||_||_|p(dgi|_dS)N�handle_listr=)r.r>r?r@rArBrCr'r'r(r/�szSTARTUPINFO.__init__cCs@|j��}d|kr"t|d�|d<t|j|j|j|j|j|d�S)NrDr=)	rC�copy�listr#r>r?r@rArB)r.Z	attr_listr'r'r(rE�s
�zSTARTUPINFO.copy)r$r%r&r/rEr'r'r'r(r#�s�	c@s2eZdZdZejfdd�Zdd�Zdd�ZeZ	dS)	�HandleFcCs|jsd|_||�dS)NT)�closed)r.�CloseHandler'r'r(�Close�szHandle.ClosecCs |jsd|_t|�Std��dS)NTzalready closed)rH�intr1r2r'r'r(�Detach�sz
Handle.DetachcCsd|jjt|�fS)Nz%s(%d))�	__class__r$rKr2r'r'r(�__repr__�szHandle.__repr__N)
r$r%r&rH�_winapirIrJrLrN�__del__r'r'r'r(rG�s
rGZPIPE_BUFi�PollSelectorcCsdSr)r'r'r'r'r(�_cleanup�srRc	Cs\tdkrdStdd�D]>}|jtjd�}|dk	rzt�|�Wqtk
rTYqXqdS)N��
_deadstate)�_active�_internal_poll�sys�maxsize�remover1)�inst�resr'r'r(rR�s���������cCs*g}tjj}|dkr&|�dd|�|S)zgReturn a list of command-line arguments reproducing the current
    optimization settings in sys.flags.r�-�O)rW�flags�optimize�append)�argsr7r'r'r(�"_optim_args_from_interpreter_flagss
recCsVddddddd�}t�}|��D].\}}ttj|�}|dkr |�d	||�q tjjrd|�d
�n$tjjrv|�d�tjjr�|�d�tj	d
d
�}tjj
}ttdi�}d|k}|dkr�|�d�n|r�|�d�|r�|�d�|D]}|�d|�q�|�r
|�d�dD]B}||k�r||}	|	dk�r4|}
nd||	f}
|�d|
f��q|S)z}Return a list of command-line arguments reproducing the current
    settings in sys.flags, sys.warnoptions and sys._xoptions.�d�B�S�v�b�q)�debug�dont_write_bytecode�no_site�verbose�
bytes_warning�quietrr_z-Iz-Ez-sN�	_xoptions�dev�zerror::BytesWarningzdefault::BytesWarning�defaultz-W)�-Xrs)Zfaulthandler�tracemallocZ
importtimeZshowalloccountZshowrefcount�utf8Tz%s=%srv)
re�items�getattrrWrarc�isolated�ignore_environment�no_user_site�warnoptionsrprY�extend)Zflag_opt_maprd�flag�optriZwarnoptsrpZxoptions�dev_moder7�argr'r'r(�_args_from_interpreter_flagssP�






r��r<c
OsLt||��8}z|j|d�WW5QR�S|���YnXW5QRXdS)z�Run command with arguments.  Wait for command to complete or
    timeout, then return the returncode attribute.

    The arguments are the same as for the Popen constructor.  Example:

    retcode = call(["ls", "-l"])
    r�N)r�wait�kill)r<�	popenargs�kwargs�pr'r'r(rLscOs6t||�}|r2|�d�}|dkr(|d}t||��dS)aORun command with arguments.  Wait for command to complete.  If
    the exit code was zero then return, otherwise raise
    CalledProcessError.  The CalledProcessError object will have the
    return code in the returncode attribute.

    The arguments are the same as for the call function.  Example:

    check_call(["ls", "-l"])
    rdNr)r�getr)r�r��retcoder+r'r'r(r]s



cOsbd|krtd��d|krJ|ddkrJ|�d�s8|�d�r>d}nd}||d<t|t|d	d
�|��jS)aRun command with arguments and return its output.

    If the exit code was non-zero it raises a CalledProcessError.  The
    CalledProcessError object will have the return code in the returncode
    attribute and output in the output attribute.

    The arguments are the same as for the Popen constructor.  Example:

    >>> check_output(["ls", "-l", "/dev/null"])
    b'crw-rw-rw- 1 root root 1, 3 Oct 18  2007 /dev/null\n'

    The stdout argument is not allowed as it is used internally.
    To capture standard error in the result, use stderr=STDOUT.

    >>> check_output(["/bin/sh", "-c",
    ...               "ls -l non_existent_file ; exit 0"],
    ...              stderr=STDOUT)
    b'ls: non_existent_file: No such file or directory\n'

    There is an additional optional argument, "input", allowing you to
    pass a string to the subprocess's stdin.  If you use this argument
    you may not also use the Popen constructor's "stdin" argument, as
    it too will be used internally.  Example:

    >>> check_output(["sed", "-e", "s/foo/bar/"],
    ...              input=b"when in the course of fooman events\n")
    b'when in the course of barman events\n'

    By default, all communication is in bytes, and therefore any "input"
    should be bytes, and the return value will be bytes.  If in text mode,
    any "input" should be a string, and the return value will be a string
    decoded according to locale encoding, or by "encoding" if set. Text mode
    is triggered by setting any of text, encoding, errors or universal_newlines.
    r5z3stdout argument not allowed, it will be overridden.�inputN�universal_newlines�text��T)r5r<�check)r1r�rrr5)r<r�r��emptyr'r'r(r
ps#�c@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
raEA process that has finished running.

    This is returned by run().

    Attributes:
      args: The list or str args passed to run().
      returncode: The exit code of the process, negative for signals.
      stdout: The standard output (None if not captured).
      stderr: The standard error (None if not captured).
    NcCs||_||_||_||_dSr))rdr*r5r-)r.rdr*r5r-r'r'r(r/�szCompletedProcess.__init__cCshd�|j�d�|j�g}|jdk	r4|�d�|j��|jdk	rP|�d�|j��d�t|�jd�|��S)Nz	args={!r}zreturncode={!r}zstdout={!r}zstderr={!r}z{}({})z, )	�formatrdr*r5rcr-�typer$�join)r.rdr'r'r(rN�s

�

zCompletedProcess.__repr__cCs |jrt|j|j|j|j��dS)z6Raise CalledProcessError if the exit code is non-zero.N)r*rrdr5r-r2r'r'r(�check_returncode�s�z!CompletedProcess.check_returncode)NN)r$r%r&r9r/rNr�r'r'r'r(r�s

	)r��capture_outputr<r�cOs |dk	r&|�d�dk	rtd��t|d<|r^|�d�dk	sF|�d�dk	rNtd��t|d<t|d<t||���}z|j||d�\}}Wn^tk
r�}	z,|��tr�|��\|	_|	_	n|�
��W5d}	~	XYn|���YnX|��}
|�r|
�rt|
|j
||d��W5QRXt|j
|
||�S)	aKRun command with arguments and return a CompletedProcess instance.

    The returned instance will have attributes args, returncode, stdout and
    stderr. By default, stdout and stderr are not captured, and those attributes
    will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them.

    If check is True and the exit code was non-zero, it raises a
    CalledProcessError. The CalledProcessError object will have the return code
    in the returncode attribute, and output & stderr attributes if those streams
    were captured.

    If timeout is given, and the process takes too long, a TimeoutExpired
    exception will be raised.

    There is an optional argument "input", allowing you to
    pass bytes or a string to the subprocess's stdin.  If you use this argument
    you may not also use the Popen constructor's "stdin" argument, as
    it will be used internally.

    By default, all communication is in bytes, and therefore any "input" should
    be bytes, and the stdout and stderr will be bytes. If in text mode, any
    "input" should be a string, and stdout and stderr will be strings decoded
    according to locale encoding, or by "encoding" if set. Text mode is
    triggered by setting any of text, encoding, errors or universal_newlines.

    The other arguments are the same as for the Popen constructor.
    N�stdinz/stdin and input arguments may not both be used.r5r-z@stdout and stderr arguments may not be used with capture_output.r��r,r-)r�r1rr�communicaterr��
_mswindowsr5r-r��pollrrdr)r�r�r<r�r�r�Zprocessr5r-�excr�r'r'r(r�s8�cCs�g}d}ttj|�D]�}g}|r*|�d�d|kp>d|kp>|}|rN|�d�|D]b}|dkrj|�|�qR|dkr�|�dt|�d�g}|�d�qR|r�|�|�g}|�|�qR|r�|�|�|r|�|�|�d�qd�|�S)	a�
    Translate a sequence of arguments into a command line
    string, using the same rules as the MS C runtime:

    1) Arguments are delimited by white space, which is either a
       space or a tab.

    2) A string surrounded by double quotation marks is
       interpreted as a single argument, regardless of white space
       contained within.  A quoted string can be embedded in an
       argument.

    3) A double quotation mark preceded by a backslash is
       interpreted as a literal double quotation mark.

    4) Backslashes are interpreted literally, unless they
       immediately precede a double quotation mark.

    5) If backslashes immediately precede a double quotation mark,
       every pair of backslashes is interpreted as a literal
       backslash.  If the number of backslashes is odd, the last
       backslash escapes the next double quotation mark as
       described in rule 3.
    F� �	�"�\�z\"r�)�map�os�fsdecoderc�lenrr�)�seq�resultZ	needquoter�Zbs_buf�cr'r'r(�list2cmdline	s4




r�c
Cslzt|ddtd�}d}Wn.tk
rF}z|j}|j}W5d}~XYnX|dd�dkrd|dd�}||fS)a�Return (exitcode, output) of executing cmd in a shell.

    Execute the string 'cmd' in a shell with 'check_output' and
    return a 2-tuple (status, output). The locale encoding is used
    to decode the output and process newlines.

    A trailing newline is stripped from the output.
    The exit status for the command can be interpreted
    according to the rules for the function 'wait'. Example:

    >>> import subprocess
    >>> subprocess.getstatusoutput('ls /bin/ls')
    (0, '/bin/ls')
    >>> subprocess.getstatusoutput('cat /bin/junk')
    (1, 'cat: /bin/junk: No such file or directory')
    >>> subprocess.getstatusoutput('/bin/junk')
    (127, 'sh: /bin/junk: not found')
    >>> subprocess.getstatusoutput('/bin/kill $$')
    (-15, '')
    T)�shellr�r-rNr\�
)r
rrr,r*)r+�dataZexitcodeZexr'r'r(rRscCst|�dS)a%Return output (stdout or stderr) of executing cmd in a shell.

    Like getstatusoutput(), except the exit status is ignored and the return
    value is a string containing the command's output.  Example:

    >>> import subprocess
    >>> subprocess.getoutput('ls /bin/ls')
    '/bin/ls'
    rt)r)r+r'r'r(r	qs
c
Cs�tsttd�sdStjdkr dSzjt�d�}|jdd�}t|�dkrHt�|d	}t	t
t|d�d
���}tjdkr�|dkr�|d
kr�WdSWnttt
fk
r�YnXdS)a�Check if posix_spawn() can be used for subprocess.

    subprocess requires a posix_spawn() implementation that properly reports
    errors to the parent process, & sets errno on the following failures:

    * Process attribute actions failed.
    * File actions failed.
    * exec() failed.

    Prefer an implementation which can use vfork() in some cases for best
    performance.
    �posix_spawnF�darwinT�CS_GNU_LIBC_VERSIONrt)�maxsplitr�r�.ZlinuxZglibc)r��)r��hasattrr�rW�platform�confstr�splitr�r1�tupler�rK�AttributeError�OSError)Zver�partsZlibc�versionr'r'r(�_use_posix_spawn~s 



r�c@s�eZdZdZdZdKdddd�d	d
�Zedd��Zejd
d��Zdd�Z	dd�Z
dd�Zej
ejfdd�Zdd�Zdd�ZdLdd�Zdd�Zdd�ZdMd d!�ZdNd"d#�Zd$d%�Ze�rd&d'�Zd(d)�Zd*d+�Zd,d-�Zdejej ej!fd.d/�Z"d0d1�Z#d2d3�Z$d4d5�Z%d6d7�Z&d8d9�Z'e'Z(n�d:d'�Zd;d<�Z)d=d-�Ze*j+e*j,e*j-e*j.e*j/e*j0fd>d?�Z1de*j2e*j3e4j5fd@d/�Z"dAdB�Z6dCd1�Z#dDd5�Z%dEdF�Z7dGd7�Z&dHd9�Z'dIdJ�Z(dS)Ora� Execute a child program in a new process.

    For a complete description of the arguments see the Python documentation.

    Arguments:
      args: A string, or a sequence of program arguments.

      bufsize: supplied as the buffering argument to the open() function when
          creating the stdin/stdout/stderr pipe file objects

      executable: A replacement program to execute.

      stdin, stdout and stderr: These specify the executed programs' standard
          input, standard output and standard error file handles, respectively.

      preexec_fn: (POSIX only) An object to be called in the child process
          just before the child is executed.

      close_fds: Controls closing or inheriting of file descriptors.

      shell: If true, the command will be executed through the shell.

      cwd: Sets the current directory before the child is executed.

      env: Defines the environment variables for the new process.

      text: If true, decode stdin, stdout and stderr using the given encoding
          (if set) or the system default otherwise.

      universal_newlines: Alias of text, provided for backwards compatibility.

      startupinfo and creationflags (Windows only)

      restore_signals (POSIX only)

      start_new_session (POSIX only)

      pass_fds (POSIX only)

      encoding and errors: Text mode encoding and error handling to use for
          file objects stdin, stdout and stderr.

    Attributes:
        stdin, stdout, stderr, pid, returncode
    Fr\NTrr')�encoding�errorsr�cCslt�t��|_d|_d|_|dkr(d}t|t�s:td��t	rP|dk	r�t
d��n8|rh|sht�dt
�d}|
dk	rxt
d��|d	kr�t
d
��||_d|_d|_d|_d|_d|_||_||_|dk	r�|dk	r�t|�t|�kr�td��|�|||�\}}}}}}t	�rN|dk�rt�|��d	�}|dk�r4t�|��d	�}|dk�rNt�|��d	�}|�pb|�pb|�pb||_d|_d|_|j�r�|d
k�r�d}d}nd}z�|dk�r�t� |d|�|_|j�r�tj!|jd|||d�|_|dk�rt� |d|�|_|j�rtj!|j||d�|_|dk�r:t� |d|�|_|j�r:tj!|j||d�|_|�"||||||
||
||	||||||||�Wn�t#d|j|j|jf�D]*}z|�$�Wnt%k
�r�YnX�q�|j�s`g}|t&k�r�|�'|�|t&k�r�|�'|�|t&k�r�|�'|�t(|d��r|�'|j)�|D]H}z*t	�r8t|t*��r8|�+�n
t,�$|�Wnt%k
�rZYnX�q�YnXdS)zCreate new Popen instance.NFr\zbufsize must be an integerz0preexec_fn is not supported on Windows platformszpass_fds overriding close_fds.Tz2startupinfo is only supported on Windows platformsrz4creationflags is only supported on Windows platformszlCannot disambiguate when both text and universal_newlines are supplied but different. Pass one or the other.g�?rt�wb)�
write_through�line_bufferingr�r��rb)r�r��_devnull)-rR�	threadingZLock�
_waitpid_lock�_input�_communication_started�
isinstancerK�	TypeErrorr�r1�warnings�warn�RuntimeWarningrdr�r5r-�pidr*r�r��boolr�_get_handles�msvcrtZopen_osfhandlerL�	text_mode�_sigint_wait_secs�_closed_child_pipe_fds�io�open�
TextIOWrapper�_execute_child�filter�closer�rrcr�r�rGrJr�)r.rd�bufsize�
executabler�r5r-�
preexec_fn�	close_fdsr��cwd�envr��startupinfo�
creationflags�restore_signals�start_new_session�pass_fdsr�r�r��p2cread�p2cwrite�c2pread�c2pwrite�errread�errwriter��fZto_close�fdr'r'r(r/�s�


��





�
�
��








zPopen.__init__cCs|jSr))r�r2r'r'r(r�~szPopen.universal_newlinescCst|�|_dSr))r�r�)r.r�r'r'r(r��scCs |�||�}|�dd��dd�S)Nz
r��
)�decode�replace)r.r�r�r�r'r'r(�_translate_newlines�szPopen._translate_newlinescCs|Sr)r'r2r'r'r(�	__enter__�szPopen.__enter__cCs�|jr|j��|jr |j��dz|jr4|j��W5|tkr�|jdkrrz|j|jd�Wntk
rpYnXd|_�dS|��XdS)Nrr�)	r5r�r-�KeyboardInterruptr��_waitrr�r�)r.�exc_typer7�	tracebackr'r'r(�__exit__�s 


zPopen.__exit__cCsT|js
dS|jdkr(|d|jt|d�|j|d�|jdkrPtdk	rPt�|�dS)Nzsubprocess %s is still running)�sourcerS)�_child_createdr*r��ResourceWarningrVrUrc)r.Z_maxsizeZ_warnr'r'r(rP�s

�z
Popen.__del__cCs"t|d�st�tjtj�|_|jS)Nr�)r�r�r��devnull�O_RDWRr�r2r'r'r(�_get_devnull�s
zPopen._get_devnullc
Cs�|rZz|j�|�WnDtk
r(Yn2tk
rX}z|jtjkrFn�W5d}~XYnXz|j��WnDtk
r|Yn2tk
r�}z|jtjkr�n�W5d}~XYnXdSr))r��write�BrokenPipeErrorr��errnoZEINVALr�)r.r�r�r'r'r(�_stdin_write�s"zPopen._stdin_writecCsT|jr|rtd��|dkr�|js�|j|j|jg�d�dkr�d}d}|jrT|�|�n6|jrp|j��}|j��n|jr�|j��}|j��|�	�n�|dk	r�t
�|}nd}z�z|�|||�\}}Wnhtk
�r,|dk	r�t
|j|�|��}n|j}d|_z|j|d�Wntk
�r$YnX�YnXW5d|_X|j	|�|�d�}||fS)a9Interact with process: Send data to stdin and close it.
        Read data from stdout and stderr, until end-of-file is
        reached.  Wait for process to terminate.

        The optional "input" argument should be data to be sent to the
        child process, or None, if no data should be sent to the child.
        communicate() returns a tuple (stdout, stderr).

        By default, all communication is in bytes, and therefore any
        "input" should be bytes, and the (stdout, stderr) will be bytes.
        If in text mode (indicated by self.text_mode), any "input" should
        be a string, and (stdout, stderr) will be strings decoded
        according to locale encoding, or by "encoding" if set. Text mode
        is triggered by setting any of text, encoding, errors or
        universal_newlines.
        z.Cannot send input after starting communicationNr�Trr�)r�r1r�r5r-�countr�readr�r��_time�_communicater��minr��_remaining_timer�r)r.r�r<r5r-�endtime�sigint_timeout�stsr'r'r(r��sH
�



�zPopen.communicatecCs|��S)zSCheck if child process has terminated. Set and return returncode
        attribute.)rVr2r'r'r(r�sz
Popen.pollcCs|dkrdS|t�SdS)z5Convenience for _communicate when computing timeouts.N)r)r.r	r'r'r(r"szPopen._remaining_timecCsL|dkrdS|st�|krHt|j||r0d�|�nd|r@d�|�ndd��dS)z2Convenience for checking if a timeout has expired.Nr�r�)rrrdr�)r.r	�orig_timeoutZ
stdout_seqZ
stderr_seq�skip_check_and_raiser'r'r(�_check_timeout*s�zPopen._check_timeoutcCs�|dk	rt�|}z|j|d�WStk
r�|dk	rLt|j|�|��}n|j}d|_z|j|d�Wntk
r|YnX�YnXdS)z=Wait for child process to terminate; returns self.returncode.Nr�r)rr�r�rr�rr)r.r<r	r
r'r'r(r�6s 
�z
Popen.waitc		Cs�t|dd�}t����}trX|dkr.|�|j�|dkrB|�|j�|dkr�|�|j�nr|dkr~|dkr~||kr~|�tj|�|dkr�|dkr�||kr�|�tj|�|dkr�|dkr�||kr�|�tj|�|dk	r�|�tj|�W5QRXd|_dS)Nr�r\T)	rz�
contextlib�	ExitStackr��callbackrJr�r�r�)	r.r�r�r�r�r�r�Z
devnull_fd�stackr'r'r(�_close_pipe_fdsMs$
zPopen._close_pipe_fdscCs~|dkr|dkr|dkrdSd\}}d\}}d\}}	|dkrtt�tj�}|dkr�t�dd�\}}
t|�}t�|
�nh|tkr�t�dd�\}}t|�t|�}}n<|tkr�t�	|�
��}n$t|t�r�t�	|�}nt�	|�
��}|�|�}|dk�r*t�tj�}|dk�r�t�dd�\}
}t|�}t�|
�nn|tk�rXt�dd�\}}t|�t|�}}n@|tk�rrt�	|�
��}n&t|t��r�t�	|�}nt�	|�
��}|�|�}|dk�r�t�tj�}	|	dk�rdt�dd�\}
}	t|	�}	t�|
�n~|tk�rt�dd�\}}	t|�t|	�}}	nP|tk�r$|}	n@|tk�r>t�	|�
��}	n&t|t��rVt�	|�}	nt�	|�
��}	|�|	�}	||||||	fS)�|Construct and return tuple with IO objects:
            p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
            N)r\r\r\r\r\r\�r\r\r)rOZGetStdHandlerZ
CreatePiperGrIrr
r�Z
get_osfhandler�r�rK�fileno�_make_inheritablerrr)r.r�r5r-r�r�r�r�r�r��_r'r'r(r�nst












�zPopen._get_handlescCs&t�t��|t��ddtj�}t|�S)z2Return a duplicate of handle, which is inheritablerrt)rOZDuplicateHandleZGetCurrentProcessZDUPLICATE_SAME_ACCESSrG)r.�handle�hr'r'r(r�s�zPopen._make_inheritablecCstdd�|D��S)z�Filter out console handles that can't be used
            in lpAttributeList["handle_list"] and make sure the list
            isn't empty. This also removes duplicate handles.cSs,h|]$}|d@dks$t�|�tjkr|�qS)�)rOZGetFileTypeZFILE_TYPE_CHAR)�.0rr'r'r(�	<setcomp>�s��z,Popen._filter_handle_list.<locals>.<setcomp>)rF)r.rDr'r'r(�_filter_handle_list�szPopen._filter_handle_listcCs�|rtd��t|t�rnNt|t�r:|
r.td��t|g�}n,t|tj�r^|
rRtd��t|g�}nt|�}|dk	rxt�|�}|dkr�t	�}n|�
�}d|||fk}|r�|jtj
O_||_||_||_|j}t|o�d|ko�|d�}|s�|�rl|�rl|dk�ri}|_t|�dg��}|d<|�r>|t|�t|�t|�g7}|�|�|dd�<|�rl|�sht�dt�d}|
�r�|jtjO_tj|_|�s�tj�d	�}|�s�tj�d
d�}tj�|dd
�}tj� |��s�t!d��tj� |��r�|}n|}d�"||�}|dk	�rt�|�}t#�$d||||�z,t�&||ddt|�|	|||�	\}}}}W5|�%|||
|||�Xd|_'t(|�|_)||_*t�+|�dS)z$Execute program (MS Windows version)z"pass_fds not supported on Windows.z$bytes args is not allowed on Windows�0path-like args is not allowed when shell is trueNr\rDz?startupinfo.lpAttributeList['handle_list'] overriding close_fdsFZComSpecZ
SystemRootr�ZSystem32zcmd.exez:shell not found: neither %ComSpec% nor %SystemRoot% is setz
{} /c "{}"�subprocess.PopenT),�AssertionErrorr��str�bytesr�r�r��PathLiker�r#rEr>rOrr?r@rArCr�rFr�rKrr�r�r�rrrB�environ�pathr��isabs�FileNotFoundErrorr�rW�auditrZ
CreateProcessr�rG�_handler�rI)r.rdr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Zunused_restore_signalsZunused_start_new_sessionZuse_std_handlesZattribute_listZhave_handle_listrDZcomspecZsystem_rootZhpZhtr��tidr'r'r(r��s�	


��

�
�

��
zPopen._execute_childcCs,|jdkr&||jd�|kr&||j�|_|jS)z�Check if child process has terminated.  Returns returncode
            attribute.

            This method is called by __del__, so it can only refer to objects
            in its local scope.

            Nr)r*r*)r.rTZ_WaitForSingleObjectZ_WAIT_OBJECT_0Z_GetExitCodeProcessr'r'r(rVHs
zPopen._internal_pollcCs^|dkrtj}nt|d�}|jdkrXt�|j|�}|tjkrJt|j|��t�	|j�|_|jS)z-Internal implementation of wait() on Windows.Ni�)
rOZINFINITErKr*�WaitForSingleObjectr*ZWAIT_TIMEOUTrrd�GetExitCodeProcess)r.r<Ztimeout_millisr�r'r'r(r�Ys
�
zPopen._waitcCs|�|���|��dSr))rcrr�)r.Zfh�bufferr'r'r(�
_readerthreadiszPopen._readerthreadcCs\|jrBt|d�sBg|_tj|j|j|jfd�|_d|j_|j��|j	r�t|d�s�g|_
tj|j|j	|j
fd�|_d|j_|j��|jr�|�
|�|jdk	r�|j�|�|��|j��r�t|j|��|j	dk	r�|j�|�|��|j��r�t|j|��d}d}|j�r|j}|j��|j	�r0|j
}|j	��|�r>|dnd}|�rP|dnd}||fS)N�_stdout_buff)�targetrdT�_stderr_buffr)r5r�r0r�ZThreadr/Z
stdout_threadZdaemon�startr-r2Z
stderr_threadr�rr�rZis_aliverrdr�)r.r�r	rr5r-r'r'r(rnsJ
��

��







zPopen._communicatecCsl|jdk	rdS|tjkr"|��nF|tjkr>t�|jtj�n*|tjkrZt�|jtj�nt	d�
|���dS)�Send a signal to the process.NzUnsupported signal: {})r*r0�SIGTERM�	terminateZCTRL_C_EVENTr�r�r�ZCTRL_BREAK_EVENTr1r��r.Zsigr'r'r(�send_signal�s




zPopen.send_signalcCsX|jdk	rdSzt�|jd�Wn2tk
rRt�|j�}|tjkrH�||_YnXdS)zTerminates the process.Nrt)r*rOZTerminateProcessr*�PermissionErrorr-ZSTILL_ACTIVE)r.Zrcr'r'r(r6�s

zPopen.terminatec
Cs,d\}}d\}}d\}}	|dkr"n@|tkr8t��\}}n*|tkrJ|��}nt|t�rZ|}n|��}|dkrln@|tkr�t��\}}n*|tkr�|��}nt|t�r�|}n|��}|dkr�nf|tkr�t��\}}	nP|tkr�|dkr�|}	n
t	j
��}	n.|tk�r|��}	nt|t��r|}	n|��}	||||||	fS)rrNr\)rr��piper
r�r�rKrrrW�
__stdout__)
r.r�r5r-r�r�r�r�r�r�r'r'r(r��sP





�cCs�|dkrtj}i}|rJg}dD]"}
tt|
d�}|dk	r|�|�q||d<g}|||	fD]}|dkrX|�tj|f�qX|df|df|
dffD]"\}}|dkr�|�tj||f�q�|r�||d<tj|||f|�|_d	|_	|�
|||||	|
�dS)
z'Execute program using os.posix_spawn().N)�SIGPIPEZSIGXFZ�SIGXFSZZ	setsigdefr\rrtr��file_actionsT)r�r%rzr0rc�POSIX_SPAWN_CLOSE�POSIX_SPAWN_DUP2r�r�r�r)r.rdr�r�r�r�r�r�r�r�r�r�ZsigsetZsignameZsignumr>r�Zfd2r'r'r(�_posix_spawn�s<��zPopen._posix_spawnc)s�t|ttf�r|g}n(t|tj�r6|
r.td��|g}nt|�}|
rlttd�rPdnd}|dg|}�rl�|d<�dkr||d�t�	d�|||�t
�rtj����r|dk�r|�s|�s|dk�r|d	ks�|d
k�r|d	ks�|d
k�r|d	ks�|d
k�r|�s|�
|�|||||
|||�
dS�}t��\}}g}|dk�rT|�|�t�|�}�q2|D]}t�|��qX�zJz�|dk	�r�g}|��D]>\}}t�|�}d|k�r�td
��|�|dt�|���q�nd}t����tj����r�f}nt�fdd�t�|�D��}t|�}|�|�t�|||tttt|���|||||
||||||||�|_d|_W5t�|�X|� |||
|||�t!�}t�"|d�}||7}|�r�t#|�dk�r��q��q�W5t�|�X|�r�z6t�$|jd�\} }!| |jk�r�|�%|!�ntj&|_'Wnt(k
�rYnXz|�)dd
�\}"}#}$|$�*�}$Wn,tk
�rbd}"d}#d�+t|��}$YnXt,t-|"�*d�t.�}%t/|%t0��r�|#�r�t|#d�}&|$dk}'|'�r�d}$|}(n|}(|&dk�r�t�1|&�}$|%|&|$|(��|%|$��dS)zExecute program (POSIX version)rZgetandroidapilevelz/system/bin/shz/bin/shz-crNr r\r�r�=z!illegal environment variable namec3s"|]}tj�t�|���VqdSr))r�r&r��fsencode)r�dir�r�r'r(�	<genexpr>rs�z'Popen._execute_child.<locals>.<genexpr>TiP��:sSubprocessError�0z#Bad exception data from child: {!r}�ascii�Znoexecr�)2r�r"r#r�r$r�rFr�rWr)�_USE_POSIX_SPAWNr&�dirnamerAr:rc�dupr�ryrCr1r��
get_exec_path�set�add�_posixsubprocessZ	fork_exec�sortedr�rKr�r�r�	bytearrayrr��waitpid�_handle_exitstatusrXr*�ChildProcessErrorr�r�r�rz�builtinsr�
issubclassr��strerror))r.rdr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Z
unix_shellZorig_executableZerrpipe_readZ
errpipe_writeZlow_fds_to_closeZlow_fdZenv_list�kriZexecutable_listZfds_to_keepZerrpipe_data�partr�rZexception_nameZ	hex_errno�err_msgZchild_exception_typeZ	errno_numZchild_exec_never_calledZerr_filenamer'rEr(r� s"	��
�����������	�
�





�
�
�
��
�


cCsL||�r||�|_n2||�r*||�|_n||�r@||�|_ntd��dS)�:All callers to this function MUST hold self._waitpid_lock.zUnknown child exit status!N)r*r)r.rZ_WIFSIGNALEDZ	_WTERMSIGZ
_WIFEXITEDZ_WEXITSTATUSZ_WIFSTOPPEDZ	_WSTOPSIGr'r'r(rU�szPopen._handle_exitstatusc
Cs�|jdkr�|j�d�sdSz�z>|jdk	r4|jWW�pS||j|�\}}||jkrX|�|�WnBtk
r�}z$|dk	r|||_n|j|kr�d|_W5d}~XYnXW5|j��X|jS)z�Check if child process has terminated.  Returns returncode
            attribute.

            This method is called by __del__, so it cannot reference anything
            outside of the local scope (nor can any methods it calls).

            NFr)r*r��acquire�releaser�rUr�r)r.rTZ_waitpidZ_WNOHANGZ_ECHILDr�r�er'r'r(rV�s 	



cCs>zt�|j|�\}}Wntk
r4|j}d}YnX||fS)r]r)r�rTr�rV)r.Z
wait_flagsr�rr'r'r(�	_try_wait�s
zPopen._try_waitc	Cs2|jdk	r|jS|dk	r�t�|}d}|j�d�r�zT|jdk	rDW�Fq�|�tj�\}}||jksj|dksjt	�||jkr�|�
|�W�q�W5|j��X|�|�}|dkr�t|j
|��t|d|d�}t�|�q&n\|jdk�r,|j�B|jdk	r�W5QR��q,|�d�\}}||jk�r |�
|�W5QRXq�|jS)z+Internal implementation of wait() on POSIX.Ng����Mb@?Frr�g�������?)r*rr�r^r_rar��WNOHANGr�r!rUrrrdr�time�sleep)r.r<r	Zdelayr�rZ	remainingr'r'r(r��s8







c
Cs"|jrX|jsXz|j��Wntk
r.YnX|sXz|j��Wntk
rVYnXd}d}|js�i|_|jr~g|j|j<|jr�g|j|j<|jr�|j|j}|jr�|j|j}|�|�|j	r�t
|j	�}t����}|jr�|r�|�|jt
j�|j�r|jj�s|�|jt
j�|j�r6|jj�s6|�|jt
j�|���r�|�|�}|dk	�rz|dk�rz|j||||dd�td��|�|�}	|�||||�|	D]�\}
}|
j|jk�r6||j|jt�}z|jt�|
j|�7_Wn,tk
�r
|�|
j�|
j��Yn*X|jt|j	�k�r�|�|
j�|
j��nP|
j|j|jfk�r�t�|
jd�}
|
�st|�|
j�|
j��|j|
j�|
��q��q6W5QRX|j |�|�d�|dk	�r�d�!|�}|dk	�r�d�!|�}|j"�r|dk	�r�|�#||jj$|jj%�}|dk	�r|�#||jj$|jj%�}||fS)NrT)r
zN_check_timeout(..., skip_check_and_raise=True) failed to raise TimeoutExpired.i�r�r�)&r�r��flushrr�Z_fileobj2outputr5r-�_save_inputr��
memoryview�_PopenSelector�register�	selectorsZEVENT_WRITErHZ
EVENT_READZget_maprr�RuntimeError�selectZfileobj�
_input_offset�	_PIPE_BUFr�r�r�Z
unregisterr�rrcr�r�r�r�r�r�)r.r�r	rr5r-Z
input_viewZselectorr<Zready�keyZevents�chunkr�r'r'r(r's�





��
�
$




�
�cCsF|jrB|jdkrBd|_||_|dk	rB|jrB|j�|jj|jj�|_dS)Nr)r�r�rmr��encoder�r�)r.r�r'r'r(rf�s�zPopen._save_inputcCs|jdkrt�|j|�dS)r4N)r*r�r�r�r7r'r'r(r8�s
cCs|�tj�dS)z/Terminate the process with SIGTERM
            N)r8r0r5r2r'r'r(r6�scCs|�tj�dS)z*Kill the process with SIGKILL
            N)r8r0�SIGKILLr2r'r'r(r��sz
Popen.kill)r\NNNNNTFNNNNrTFr')NN)F)N)8r$r%r&r9r�r/r:r�r;r�r�r�rWrXr�r�rPr�rr�r�rrr�rr�r�rrr�rOr,Z
WAIT_OBJECT_0r-rVr�r/rr8r6r�rAr��WIFSIGNALED�WTERMSIG�	WIFEXITED�WEXITSTATUS�
WIFSTOPPED�WSTOPSIGrUrTrbrZECHILDrarfr'r'r'r(r�s�-��


D	�

H	
|�
26'�
�
#
)f)Hr9rWrr�r�rcr0rWr�r�rrr�__all__r�rOr��ModuleNotFoundErrorrQrlrjrrrrrrrrrrrrrrrr r!r"r�	Exceptionrrrr#rKrGrzrnr�rQrhZSelectSelectorrUrRrrr
rer�rrr
�objectrrr�rr	r�rKrr'r'r'r(�<module>
s�"�P
�
%	


;3"�EI
/cProfile.cpython-38.opt-2.pyc000064400000011662150335716500011712 0ustar00U

e5db�@s~dddgZddlZddlZddlZddd�Zddd�Zejje_ejje_Gdd�dej�Z	d	d
�Z
dd�Zed
krze�dS)�run�runctx�Profile�N���cCst�t��|||�S�N)�
_pyprofile�_Utilsrr)�	statement�filename�sort�r� /usr/lib64/python3.8/cProfile.pyrscCst�t��|||||�Sr)rrrr)r	�globals�localsr
rrrr
rs�c@s\eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	de	_
dd�Zdd�ZdS)rrcCs$ddl}|�|����|���dS�Nr)�pstats�StatsZ
strip_dirsZ
sort_stats�print_stats)�selfrrrrr
r)szProfile.print_statsc	Cs8ddl}t|d��}|��|�|j|�W5QRXdS)Nr�wb)�marshal�open�create_stats�dump�stats)r�filer�frrr
�
dump_stats-szProfile.dump_statscCs|��|��dSr)�disable�snapshot_stats�rrrr
r3szProfile.create_statsc
Cs,|��}i|_i}|D]P}t|j�}|j}||j}|j}|j}i}	|	|t|j�<|||||	f|j|<q|D]�}|j	rlt|j�}|j	D]�}
z|t|
j�}	Wnt
k
r�Yq�YnX|
j}||
j}|
j}|
j}||	k�r|	|}||d7}||d7}||d7}||d7}||||f|	|<q�qldS)Nr���)Zgetstatsr�label�codeZ	callcountZreccallcountZ
inlinetimeZ	totaltime�idZcalls�KeyError)r�entriesZcallersdicts�entry�funcZncZccZttZctZcallersZsubentry�prevrrr
r7s>






zProfile.snapshot_statscCsddl}|j}|�|||�Sr)�__main__�__dict__r)r�cmdr,�dictrrr
r]szProfile.runcCs(|��zt|||�W5|��X|Sr)�enabler�exec)rr.rrrrr
rbs

zProfile.runctxcOs�t|�dkr|^}}}nV|s&td��nHd|krZ|�d�}|^}}ddl}|jdtdd�ntdt|�d��|��z|||�W�S|��XdS)	Nr"z:descriptor 'runcall' of 'Profile' object needs an argumentr*rz0Passing 'func' as keyword argument is deprecated)�
stacklevelz7runcall expected at least 1 positional argument, got %dr!)�len�	TypeError�pop�warnings�warn�DeprecationWarningr0r)�args�kwrr*r6rrr
�runcallks&

�
�zProfile.runcallz($self, func, /, *args, **kw)cCs|��|Sr)r0r rrr
�	__enter__�szProfile.__enter__cGs|��dSr)r)r�exc_inforrr
�__exit__�szProfile.__exit__N)r)
�__name__�
__module__�__qualname__rrrrrrr;�__text_signature__r<r>rrrr
rs
&	cCs(t|t�rdd|fS|j|j|jfSdS)N�~r)�
isinstance�str�co_filename�co_firstlineno�co_name)r%rrr
r$�s

r$c
Cs�ddl}ddl}ddl}ddl}ddlm}d}||d�}d|_|jdddd	dd
�|jddd
ddt|j	j
�d�|jdddddd�|jdd�s�|��|�
d�|��\}}||jdd�<|jdk	r�|j�|j�|_t|�dk�r�|j�rd}	|j|dd�}
nR|d}|j�d|j�|��t�|��}t|��|d�}	W5QRX|dddd�}
zt|	|
d|j|j�Wn6tk
�r�}
zd|_|�
|
j�W5d}
~
XYnXn|��|S)Nr)�OptionParserzNcProfile.py [-o output_file_path] [-s sort] [-m module | scriptfile] [arg] ...)�usageFz-oz	--outfile�outfilezSave stats to <outfile>)�dest�help�defaultz-sz--sortrz?Sort order when printing to stdout, based on pstats.Stats classr)rLrMrN�choicesz-m�module�
store_truezProfile a library module)rL�actionrMrNr!r"z(run_module(modname, run_name='__main__'))�
run_module�modnamer1r,)�__file__r?�__package__�
__cached__) �os�sys�runpyrZoptparserIZallow_interspersed_argsZ
add_option�sortedrZsort_arg_dict_default�argvZprint_usage�exit�
parse_argsrK�path�abspathr3rPrS�insert�dirname�io�	open_code�compile�readrr�BrokenPipeError�stdout�errno)rXrYrZrrIrJ�parserZoptionsr9r%ZglobsZprogname�fp�excrrr
�main�sd

�

�
�

�� rmr,)Nr)Nr)
�__all__Z_lsprofrcZprofilerrr�__doc__ZProfilerrr$rmr?rrrr
�<module>s




o;ntpath.cpython-38.pyc000064400000034503150335716500010504 0ustar00U

e5dVl�&@s(dZdZdZdZdZdZdZdZdZdd	l	Z	dd	l
Z
dd	lZdd	lZdd
lTddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0g&Z
d1d2�Zd3d�Zd4d�Zd5d
�Zd6d�Zd7d�Zd8d�Zejje_d9d�Zd:d�Zd;d�Zd<d�Zzdd=lmZWnek
�r(d	ZYnXd>d�Zd?d�Zd@d�ZdAd �Z dBdC�Z!zddDlm"Z"Wnek
�r|e!Z#Yn
XdEd!�Z#zddFlm$Z$m%Z&Wnek
�r�e#Z'YnXdGdH�Z(dIdJ�Z)dKd*�Z'e*e
dL��o�e
�+�dMdNkZ,dRdOd,�Z-dPd0�Z.zddQlm/Z0Wnek
�r"YnXd	S)Sz�Common pathname manipulations, WindowsNT/95 version.

Instead of importing this module directly, import os and refer to this
module as os.path.
�.�..�\�;�/z.;C:\binZnul�N)�*�normcase�isabs�join�
splitdrive�split�splitext�basename�dirname�commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�ismount�
expanduser�
expandvars�normpath�abspath�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenames�relpath�samefile�sameopenfile�samestat�
commonpathcCst|t�rdSdSdS)N�\/�\/)�
isinstance�bytes��path�r4�/usr/lib64/python3.8/ntpath.py�
_get_bothseps"s
r6cCs8t�|�}t|t�r$|�dd���S|�dd���SdS)zaNormalize case of pathname.

    Makes all characters lowercase and all slashes into backslashes.�/�\rrN)�os�fspathr0r1�replace�lower��sr4r4r5r,s

cCsjt�|�}t|t�r,|�dd��d�rBdSn|�dd��d�rBdSt|�d}t|�d	koh|d	t|�kS)
zTest whether a path is absoluter7r8�\\?\Trr�\\?\�r)	r9r:r0r1r;�
startswithr�lenr6r=r4r4r5r	=s

c

GsTt�|�}t|t�r"d}d}d}nd}d}d}z�|sD|dd�|t|�\}}ttj|�D]~}t|�\}}	|	r�|	d|kr�|s�|s�|}|	}q\n*|r�||kr�|��|��kr�|}|	}q\|}|r�|d|kr�||}||	}q\|�r|d|k�r|�r|dd�|k�r|||WS||WSttt	fk
�rNt
jd	|f|���YnXdS)
Nr8r.�:rr/�:r���r
)r9r:r0r1r�mapr<�	TypeError�AttributeError�BytesWarning�genericpath�_check_arg_types)
r3�pathsr!�seps�colonZresult_driveZresult_path�pZp_driveZp_pathr4r4r5r
MsL


��
cCst�|�}t|�dk�rt|t�r0d}d}d}nd}d}d}|�||�}|dd�|dkr�|dd	�|kr�|�|d�}|d
kr�|dd�|fS|�||d�}||dkr�|dd�|fS|d
kr�t|�}|d|�||d�fS|dd�|k�r|dd�|dd�fS|dd�|fS)
a�Split a pathname into drive/UNC sharepoint and relative path specifiers.
    Returns a 2-tuple (drive_or_unc, path); either part may be empty.

    If you assign
        result = splitdrive(p)
    It is always true that:
        result[0] + result[1] == p

    If the path contained a drive letter, drive_or_unc will contain everything
    up to and including the colon.  e.g. splitdrive("c:/dir") returns ("c:", "/dir")

    If the path contained a UNC path, the drive_or_unc will contain the host name
    and share up to but not including the fourth directory separator character.
    e.g. splitdrive("//host/computer/dir") returns ("//host/computer", "/dir")

    Paths cannot contain both a drive letter and a UNC path.

    �r8r7rDrrrEr�rFNrA)r9r:rCr0r1r;�find)rPr!r$rOZnormp�indexZindex2r4r4r5r|s.

$cCsxt�|�}t|�}t|�\}}t|�}|rD||d|krD|d8}q&|d|�||d�}}|�|�pj|}|||fS)z~Split a pathname.

    Return tuple (head, tail) where tail is everything after the final slash.
    Either part may be empty.rAN)r9r:r6rrC�rstrip)rPrN�d�i�head�tailr4r4r5r�s

cCs8t�|�}t|t�r$t�|ddd�St�|ddd�SdS)Nr8r7�.rrr)r9r:r0r1rK�	_splitext�rPr4r4r5r
�s

cCst|�dS)z)Returns the final component of a pathnamerA�rr\r4r4r5r�scCst|�dS)z-Returns the directory component of a pathnamerr]r\r4r4r5r�sc
Cs8zt�|�}Wntttfk
r*YdSXt�|j�S)zhTest whether a path is a symbolic link.
    This will always return false for Windows prior to 6.0.
    F)r9�lstat�OSError�
ValueErrorrI�stat�S_ISLNK�st_mode�r3�str4r4r5r�s
c	Cs.zt�|�}Wnttfk
r(YdSXdS)zCTest whether a path exists.  Returns True for broken symbolic linksFT)r9r^r_r`rdr4r4r5r�s
)�_getvolumepathnamecCstt�|�}t|�}t|�}t|�\}}|rD|d|krD|pB||kS||krPdStrl|�|�t|��|�kSdSdS)zaTest whether a path is a mount point (a drive root, the root of a
    share, or a mounted volume)rTFN)r9r:r6rrrfrU)r3rN�root�restr4r4r5rs
cCs�t�|�}t|t�rd}nd}|�|�s,|Sdt|�}}||kr\||t|�kr\|d7}q:dtjkrrtjd}nFdtjkr�|Sztjd}Wntk
r�d}YnXt	|tjd�}t|t�r�t�
|�}|dkr�t	t|�|d|��}|||d�S)	zLExpand ~ and ~user constructs.

    If user or $HOME is unknown, do nothing.�~�~rAZUSERPROFILEZHOMEPATHZ	HOMEDRIVE�N)r9r:r0r1rBrCr6�environ�KeyErrorr
�fsencoder)r3�tilderW�n�userhome�driver4r4r5r!s.








cCs2t�|�}t|t�rhd|kr(d|kr(|Sddl}t|j|jdd�}d}d}d}d	}d}ttd
d�}nFd|kr|d|kr||Sddl}|j|jd}d
}d}d}d}d}tj}|dd�}	d}
t	|�}|
|k�r.||
|
d�}||k�rX||
dd�}t	|�}z&|�
|�}
|	||d|
d�7}	Wn*tk
�rR|	||7}	|d}
YnX�n�||k�rJ||
d|
d�|k�r�|	|7}	|
d7}
n�||
dd�}t	|�}z|�
|�}
Wn*tk
�r�|	||7}	|d}
YnhX|d|
�}
z.|dk�rt�tjt�
|
��}n||
}Wn"tk
�r<||
|}YnX|	|7}	�n�||k�r||
d|
d�|k�r�|	|7}	|
d7}
�q$||
d|
d�|k�r^||
dd�}t	|�}z|�
|�}
Wn.tk
�r�|	|||7}	|d}
YnlX|d|
�}
z.|dk�r"t�tjt�
|
��}n||
}Wn&tk
�rR|||
|}YnX|	|7}	n�|dd�}
|
d7}
||
|
d�}|�r�||k�r�|
|7}
|
d7}
||
|
d�}�q�z.|dk�r�t�tjt�
|
��}n||
}Wntk
�r||
}YnX|	|7}	|�r$|
d8}
n|	|7}	|
d7}
q�|	S)zfExpand shell variables of the forms $var, ${var} and %var%.

    Unknown variables are left unchanged.�$�%rNz_-�ascii�'�{�}�environb�$�%�'�{�}rArQ)r9r:r0r1�stringZ
ascii_lettersZdigits�getattrrlrCrTr`rn�fsdecoderm)r3rZvarcharsZquoteZpercentZbraceZrbraceZdollarrl�resrTZpathlen�c�var�valuer4r4r5rQs�













c	CsPt�|�}t|t�r*d}d}d}d}d}nd}d}d}d	}d
}|�|�rL|S|�||�}t|�\}}|�|�r�||7}|�|�}|�|�}d}|t	|�k�r,||r�|||kr�||=q�|||k�r"|dkr�||d|kr�||d|d�=|d8}n&|dk�r|�
|��r||=n|d7}q�|d7}q�|�sB|�sB|�|�||�|�S)
z0Normalize path, eliminating double slashes, etc.r8r7rZ�..)s\\.\r?rrrr)z\\.\r@rrA)
r9r:r0r1rBr;r�lstriprrC�endswith�appendr
)	r3r!r$rr Zspecial_prefixes�prefix�compsrWr4r4r5r�sF









cCs@t�|�}t|�s8t|t�r&t��}nt��}t||�}t|�S)z�Return the absolute version of a path as a fallback function in case
    `nt._getfullpathname` is not available or raises OSError. See bpo-31047 for
    more.

    )	r9r:r	r0r1�getcwdb�getcwdr
r)r3�cwdr4r4r5�_abspath_fallback�s



r�)�_getfullpathnamec	Cs4ztt|��WSttfk
r.t|�YSXdS)z&Return the absolute version of a path.N)rr�r_r`r�r2r4r4r5rs)�_getfinalpathname�readlinkc
Cs�d}t�}t|�|kr�|�t|��z:|}t|�}t|�s\t|�sJ|}Wq�ttt|�|��}Wq
t	k
r�}z|j
|kr�WY�q��W5d}~XYq
tk
r�Yq�Yq
Xq
|S)N)rArQrR��� �2�C�Wi&i(i))�setr�add�_nt_readlinkr	rrr
rr_�winerrorr`)r3�allowed_winerror�seenZold_path�exr4r4r5�_readlink_deeps&
r�cCs�d}d}|r�zt|�}|r$t||�n|WStk
r�}z�|j|krF�z0t|�}||krt|rft||�n|WWY�TSWntk
r�YnXt|�\}}|r�|s�||WY�S|r�t||�n|}W5d}~XYqXq|S)N)rArQrRr�r�r�r�r�r��{i�i�rk)r�r
r_r�r�r)r3r�rYr��new_path�namer4r4r5�_getfinalpathname_nonstrictCs(
 &r�c	
Cs^t|�}t|t�rBd}d}d}t��}t|�tt�t��krjdSn(d}d}d}t��}t|�tt�krjdS|�	|�}|s�t
|�s�t||�}zt|�}d	}Wn0t
k
r�}z|j}t|�}W5d}~XYnX|�sZ|�	|��rZ|�	|�r�||t|�d�}n|t|�d�}zt|�|k�r"|}Wn4t
k
�rX}z|j|k�rH|}W5d}~XYnX|S)
Nr?s\\?\UNC\s\\s\\.\NULr@z\\?\UNC\z\\z\\.\NULr)rr0r1r9r�rrnr&r�rBr	r
r�r_r�r�rC)	r3r�Z
unc_prefixZnew_unc_prefixr�Z
had_prefixZinitial_winerrorr�Zspathr4r4r5r'qsD



�getwindowsversionrRrQcCsft�|�}t|t�r"d}d}d}nd}d}d}|dkr:|}|sFtd��t�|�}z�tt|��}tt|��}t|�\}}t|�\}	}
t|�t|	�kr�td	|	|f��d
d�|�	|�D�}dd�|
�	|�D�}d
}
t
||�D]$\}}t|�t|�kr�q�|
d7}
q�|gt|�|
||
d�}|�s(|WSt|�WSt
ttttfk
�r`t�d||��YnXdS)z#Return a relative version of a pathr8rZr�rrrNzno path specifiedz&path is on mount %r, start on mount %rcSsg|]}|r|�qSr4r4��.0�xr4r4r5�
<listcomp>�szrelpath.<locals>.<listcomp>cSsg|]}|r|�qSr4r4r�r4r4r5r��srrAr))r9r:r0r1r`rrrrr�ziprCr
rHrIrJ�DeprecationWarningrKrL)r3�startr!rr Z	start_absZpath_absZstart_driveZ
start_restZ
path_driveZ	path_rest�
start_list�	path_listrWZe1Ze2�rel_listr4r4r5r)�sJ


�

c	s�|std��tttj|��}t|dt�r8d�d�d�nd�d�d��z@��fd	d
�|D�}�fdd
�|D�}zt�fdd
�|D��\}Wntk
r�td�d�YnXttdd
�|D���dkr�td��t	|d�
����\}}|���}�fdd
�|D�}�fdd
�|D�}t|�}t
|�}t|�D]*\}	}
|
||	k�r*|d|	�}�qf�q*|dt|��}|�rt|�n|}|��|�WSttfk
�r�tjd|���YnXdS)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr8r7rZrrrcs g|]}t|��������qSr4)rr;r<)r�rP)r$r!r4r5r��szcommonpath.<locals>.<listcomp>csg|]\}}|����qSr4r]�r�rVrP�r!r4r5r��sc3s"|]\}}|dd��kVqdS)NrAr4r�r�r4r5�	<genexpr>�szcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathsNcss|]\}}|VqdS)Nr4r�r4r4r5r��srAzPaths don't have the same drivecsg|]}|r|�kr|�qSr4r4�r�r��rr4r5r��scsg|]}�fdd�|D��qS)csg|]}|r|�kr|�qSr4r4r�r�r4r5r�sz)commonpath.<locals>.<listcomp>.<listcomp>r4)r�r>r�r4r5r�sr-)r-)r`�tuplerGr9r:r0r1r�rCrr;r�min�max�	enumerater
rHrIrKrL)rMZdrivesplits�split_pathsr	rrr3�common�s1�s2rWr�r�r4)r$rr!r5r-�sF

)�_isdir)N)1�__doc__rr r%r!r"r$r#r&r9�sysrarK�__all__r6rr	r
rrr
r[rrrr�ntrf�ImportErrorrrrrr�r�rr�r�r�r'r�r��hasattrr�r(r)r-r�rr4r4r4r5�<module>s�	�
/8

0q2

*.2�
84cmd.cpython-38.opt-2.pyc000064400000016043150335716500010710 0ustar00U

e5d:�@s<ddlZddlZdgZdZejejdZGdd�d�ZdS)�N�Cmdz(Cmd) �_c@s�eZdZeZeZdZdZdZ	dZ
dZdZdZ
dZdZd/d
d�Zd0dd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Z d1d-d.�Z!dS)2r�=�Nz(Documented commands (type help <topic>):zMiscellaneous help topics:zUndocumented commands:z*** No help on %s��tabcCs@|dk	r||_ntj|_|dk	r(||_ntj|_g|_||_dS�N)�stdin�sys�stdout�cmdqueue�completekey)�selfr
r	r�r�/usr/lib64/python3.8/cmd.py�__init__LszCmd.__init__cCs�|��|jr\|jr\z2ddl}|��|_|�|j�|�|jd�Wnt	k
rZYnXz�|dk	rl||_
|j
r�|j�t
|j
�d�d}|�s4|jr�|j�d�}nl|jr�zt|j�}Wntk
r�d}YnXn<|j�|j�|j��|j��}t|��sd}n
|�d�}|�|�}|�|�}|�||�}q�|��W5|j�r�|j�r�zddl}|�|j�Wnt	k
�r~YnXXdS)Nrz
: complete�
�EOFz
)�preloop�use_rawinputr
�readlineZ
get_completerZ
old_completerZ
set_completer�complete�parse_and_bind�ImportError�intror�write�strr�pop�input�prompt�EOFError�flushr	�len�rstrip�precmd�onecmd�postcmd�postloop)rrr�stop�linerrr�cmdloopbsN






zCmd.cmdloopcCs|Srr�rr)rrrr$�sz
Cmd.precmdcCs|Srr)rr(r)rrrr&�szCmd.postcmdcCsdSrr�rrrrr�szCmd.preloopcCsdSrrr,rrrr'�szCmd.postloopcCs�|��}|sdd|fS|ddkr4d|dd�}n2|ddkrft|d�r\d|dd�}n
dd|fSdt|�}}||kr�|||jkr�|d}qt|d|�||d���}}|||fS)Nr�?zhelp r�!Zdo_shellzshell )�strip�hasattrr"�
identchars)rr)�i�n�cmd�argrrr�	parseline�s



z
Cmd.parselinecCs�|�|�\}}}|s|��S|dkr.|�|�S||_|dkrBd|_|dkrT|�|�Szt|d|�}Wntk
r�|�|�YSX||�SdS)Nrr�do_)r6�	emptyline�default�lastcmd�getattr�AttributeError)rr)r4r5�funcrrrr%�s


z
Cmd.onecmdcCs|jr|�|j�SdSr)r:r%r,rrrr8�sz
Cmd.emptylinecCs|j�d|�dS)Nz*** Unknown syntax: %s
)rrr+rrrr9�szCmd.defaultcGsgSrr)r�ignoredrrr�completedefault�szCmd.completedefaultcsd|��fdd�|��D�S)Nr7cs"g|]}|���r|dd��qS)�N��
startswith��.0�a�Zdotextrr�
<listcomp>�s
z%Cmd.completenames.<locals>.<listcomp>)�	get_names)r�textr>rrFr�
completenames�szCmd.completenamesc
Cs�|dkr�ddl}|��}|��}t|�t|�}|��|}|��|}|dkr�|�|�\}	}
}|	dkrp|j}q�zt|d|	�}Wq�t	k
r�|j}Yq�Xn|j
}|||||�|_z|j|WStk
r�YdSXdS)NrrZ	complete_)
rZget_line_buffer�lstripr"Z
get_begidxZ
get_endidxr6r?r;r<rJZcompletion_matches�
IndexError)
rrI�staterZorigliner)�strippedZbegidxZendidxr4�argsZfooZcompfuncrrrr�s*zCmd.completecCs
t|j�Sr)�dir�	__class__r,rrrrHsz
Cmd.get_namescs4t|j���}t�fdd�|��D��}t||B�S)Nc3s,|]$}|�d�d�r|dd�VqdS)�help_r�NrArC�rOrr�	<genexpr> s�z$Cmd.complete_help.<locals>.<genexpr>)�setrJrH�list)rrOZcommandsZtopicsrrTr�
complete_helpszCmd.complete_helpcCs�|r�zt|d|�}Wn|tk
r�z4t|d|�j}|rX|j�dt|��WYdSWntk
rnYnX|j�dt|j|f��YdSX|��n|��}g}g}i}|D]$}|dd�dkr�d||dd�<q�|��d}	|D]p}|dd�dkr�||	k�rq�|}	|dd�}
|
|k�r8|�	|
�||
=q�t||�j�rR|�	|
�q�|�	|
�q�|j�dt|j
��|�|j|dd	�|�|j
t|���dd	�|�|j|dd	�dS)
NrRr7�%s
rSrrr@��P)r;r<�__doc__rrr�nohelprH�sort�append�
doc_leader�print_topics�
doc_header�misc_headerrW�keys�undoc_header)rr5r=�doc�namesZcmds_docZ
cmds_undoc�help�nameZprevnamer4rrr�do_help$sN



zCmd.do_helpcCs\|rX|j�dt|��|jr<|j�dt|jt|���|�||d�|j�d�dS)NrYrr)rrr�rulerr"�	columnize)r�headerZcmdsZcmdlenZmaxcolrrrraRszCmd.print_topicsr[cs��s|j�d�dS�fdd�tt���D�}|rJtdd�tt|����t��}|dkrv|j�dt�d��dStdt���D]�}||d|}g}d	}t|�D]h}	d}
t|�D]2}|||	}||kr�q�|}
t|
t|
��}
q�|�	|
�||
d
7}||kr��qq�||kr��q4q�t��}d}dg}t|�D]�}g}t|�D]4}	|||	}||k�rld}
n�|}
|�	|
��qL|�r�|d�s�|d=�q�tt|��D]}	||	�
||	�||	<�q�|j�dtd
�|����q<dS)Nz<empty>
csg|]}t�|t�s|�qSr)�
isinstancer)rDr2�rWrrrGds�z!Cmd.columnize.<locals>.<listcomp>z list[i] not a string for i in %sz, rrYr����r���z  )rr�ranger"�	TypeError�join�mapr�maxr_�ljust)rrWZdisplaywidthZ
nonstrings�sizeZnrowsZncolsZ	colwidthsZtotwidth�colZcolwidth�rowr2�xZtextsrrorrlZs\�


z
Cmd.columnize)rNN)N)r[)"�__name__�
__module__�__qualname__�PROMPTr�
IDENTCHARSr1rkr:rr`rbrcrer]rrr*r$r&rr'r6r%r8r9r?rJrrHrXrjrarlrrrrr4s:

4
		.)�stringr
�__all__r�Z
ascii_lettersZdigitsr�rrrrr�<module>-senum.cpython-38.opt-2.pyc000064400000051062150335716500011111 0ustar00U

e5d���@s�ddlZddlmZmZddddddd	gZd
d�Zdd
�Zdd�Zdd�Ze	�Z
Gdd�d�ZGdd�de�Z
dZGdd�de�ZGdd�ded�ZGdd�dee�Zdd�ZGdd�de�ZGdd�dee�Zdd�Zdd	�Zd d!�Zd"d#�ZdS)$�N)�MappingProxyType�DynamicClassAttribute�EnumMeta�Enum�IntEnum�Flag�IntFlag�auto�uniquecCst|d�pt|d�pt|d�S)N�__get__�__set__�
__delete__)�hasattr)�obj�r�/usr/lib64/python3.8/enum.py�_is_descriptors

��rcCsLt|�dkoJ|dd�|dd�ko.dknoJ|ddkoJ|ddkS)N������__�_�����len��namerrr�
_is_dunders&�
�
�rcCsLt|�dkoJ|d|dko&dknoJ|dd�dkoJ|dd�dkS)Nrr���r�rrrrrr�
_is_sunder!s���r cCsdd�}||_d|_dS)NcSstd|��dS)Nz%r cannot be pickled)�	TypeError��self�protorrr�_break_on_call_reduce0sz6_make_class_unpicklable.<locals>._break_on_call_reducez	<unknown>)�
__reduce_ex__�
__module__)�clsr%rrr�_make_class_unpicklable,sr)c@seZdZeZdS)r	N)�__name__r'�__qualname__�
_auto_null�valuerrrrr	6scs(eZdZ�fdd�Z�fdd�Z�ZS)�	_EnumDictcs&t���g|_g|_g|_d|_dS)NF)�super�__init__�
_member_names�_last_values�_ignore�_auto_called�r#��	__class__rrr0Ds

z_EnumDict.__init__csdt|�r�|dkrtd��|dkr<|jr.td��t|d|�nV|dkr�t|t�r`|�dd���}nt	|�}||_
t|�t|j�@}|r�td	|f��n�t
|�r�|d
kr�d}n�||jkr�td|��n�||j
kr�n�t|��sR||kr�td
|||f��t|t��r:|jtk�r4|�|dt|j�|jdd��|_d|_|j}|j�|�|j�|�t��||�dS)N)�_order_�_create_pseudo_member_�_generate_next_value_�	_missing_�_ignore_z(_names_ are reserved for future Enum user:z4_generate_next_value_ must be defined before members�_generate_next_valuer<�,� z-_ignore_ cannot specify already set names: %r�	__order__r8zAttempted to reuse key: %rz%r already defined as: %rrT)r �
ValueErrorr4r!�setattr�
isinstance�str�replace�split�listr3�setr1rrr	r-r,r=rr2�appendr/�__setitem__)r#�keyr-�alreadyr6rrrJKsT	
��


�z_EnumDict.__setitem__)r*r'r+r0rJ�
__classcell__rrr6rr.=sr.cs�eZdZedd��Z�fdd�Zdd�Zd.ddddd	�d
d�Zdd
�Z�fdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zedd��Zdd�Zdd�Z�fd d!�Zddddd	�d"d#�Zd/d$d%�Zd&d'�Zed(d)��Zed*d+��Zed,d-��Z�ZS)0rcCs>|�||�t�}|�||�\}}|dk	r:t|dd�|d<|S)Nr:)�_check_for_existing_membersr.�_get_mixins_�getattr)�metaclsr(�bases�	enum_dict�member_type�
first_enumrrr�__prepare__�s�zEnumMeta.__prepare__c	s��dg��d��d}|D]}��|d�q|�||�\�}|���|�\}}}	�fdd��jD�}
�jD]
}�|=qn��dd�}t|
�ddh@}
|
r�td�d�	|
����d	�kr�d
�d	<t
��|||��}g|_i|_
�|_dd�|��D�}i|_d
�k�r2�tk	�r2d}t�fdd�|D���s2t|��jD�]*}|
|}t|t��sZ|f}n|}�tk�rn|f}|	�s�||�}t|d��s�||_n6||f|��}t|d��sƈtk�r�||_n
�|�|_|j}||_||_|j|�|j
��D]"\}}|j|jk�r�|}�q�q�|j�|�||k�r2t|||�||j
|<z||j|<Wntk
�r`YnX�q8dD]V}|�k�r|�qjt||�}t�|d�}t||d�}|dk	�rj||k�rjt|||��qjtdk	�r�|�r�||_ tj|_|dk	�rt|t!��r|�"dd��#�}||jk�rtd��|S)Nr<csi|]}|�|�qSrr)�.0�k)�	classdictrr�
<dictcomp>�sz$EnumMeta.__new__.<locals>.<dictcomp>r8�mro�zInvalid enum member name: {0}r>�__doc__zAn enumeration.cSs.h|]&}|j��D]\}}t|t�r|�qqSr)�__dict__�itemsrCr)rW�crX�vrrr�	<setcomp>�s

�z#EnumMeta.__new__.<locals>.<setcomp>r&)�__getnewargs_ex__�__getnewargs__r&�
__reduce__c3s|]}|�jkVqdS�N)r^�rW�m)rTrr�	<genexpr>�sz#EnumMeta.__new__.<locals>.<genexpr>�_value_)�__repr__�__str__�
__format__r&r?z#member order does not match _order_)$�
setdefaultrI�poprO�
_find_new_r1rHrA�format�joinr/�__new__�_member_names_�_member_map_�
_member_type_r[�_value2member_map_�object�anyr)rC�tuplerrj�_name_�__objclass__r0r_rBr!rPr�__new_member__rDrErF)rQr(rRrY�ignorerKrUrs�save_new�use_args�enum_membersrr8�
invalid_names�
enum_class�dynamic_attributes�methods�member_namer-�args�enum_member�canonical_member�class_method�
obj_method�enum_methodr6)rYrTrrs�s��

��













zEnumMeta.__new__cCsdS)NTrr5rrr�__bool__3szEnumMeta.__bool__Nr��module�qualname�type�startcCs*|dkr|�||�S|j||||||d�S)Nr�)rs�_create_)r(r-�namesr�r�r�r�rrr�__call__9s�zEnumMeta.__call__cCs:t|t�s$tdt|�j|jjf��t||�o8|j|jkS�Nz3unsupported operand type(s) for 'in': '%s' and '%s')rCrr!r�r+r7r{ru)r(�memberrrr�__contains__^s
��zEnumMeta.__contains__cs(||jkrtd|j��t��|�dS)Nz%s: cannot delete Enum member.)ru�AttributeErrorr*r/�__delattr__)r(�attrr6rrr�es
zEnumMeta.__delattr__cCsddddg|jS)Nr7r]�__members__r'�rtr5rrr�__dir__ls
��zEnumMeta.__dir__cCs@t|�rt|��z|j|WStk
r:t|�d�YnXdSrf)rr�ru�KeyError�r(rrrr�__getattr__rs	zEnumMeta.__getattr__cCs
|j|Srf�rur�rrr�__getitem__�szEnumMeta.__getitem__cs�fdd��jD�S)Nc3s|]}�j|VqdSrfr��rWr�r(rrri�sz$EnumMeta.__iter__.<locals>.<genexpr>r�r�rr�r�__iter__�szEnumMeta.__iter__cCs
t|j�Srf)rrtr�rrr�__len__�szEnumMeta.__len__cCs
t|j�Srf)rrur�rrrr��szEnumMeta.__members__cCs
d|jS)Nz	<enum %r>)r*r�rrrrk�szEnumMeta.__repr__cs�fdd�t�j�D�S)Nc3s|]}�j|VqdSrfr�r�r�rrri�sz(EnumMeta.__reversed__.<locals>.<genexpr>)�reversedrtr�rr�r�__reversed__�szEnumMeta.__reversed__cs0|j�di�}||krtd��t��||�dS)NruzCannot reassign members.)r^�getr�r/�__setattr__)r(rr-�
member_mapr6rrr��szEnumMeta.__setattr__c
Cs~|j}|dkr|fn||f}|�||�\}	}
|�||�}t|t�rR|�dd���}t|ttf�r�|r�t|dt�r�|g}}g}
t	|�D]8\}}|
�
||||
dd��}|
�|�|�||f�q�|D].}t|t�r�|||}}n|\}}|||<q�|�||||�}|dk�rPzt
�d�jd}Wn*tttfk
�rN}zW5d}~XYnX|dk�rdt|�n||_|dk	�rz||_|S)Nr>r?rrr*)r7rOrVrCrDrErFrzrG�	enumerater:rIrs�sys�	_getframe�	f_globalsr�rAr�r)r'r+)r(�
class_namer�r�r�r�r�rQrRrrUrY�original_names�last_values�countrr-�itemr��member_valuer��excrrrr��s<
 







zEnumMeta._create_cs�ttj|�}|rt|�}n|}�fdd�|��D�}z|jdd�d�Wn$tk
rn|jdd�d�YnX||||d�}t|_|�|j	�|||<|S)Ncs g|]\}}�|�r||f�qSrr)rWrr-��filterrr�
<listcomp>�s�z&EnumMeta._convert_.<locals>.<listcomp>cSs|d|dfS)Nrrr��trrr�<lambda>��z$EnumMeta._convert_.<locals>.<lambda>)rKcSs|dS�Nrrr�rrrr��r�)r�)
�varsr��modulesr_�sortr!�_reduce_ex_by_namer&�updater�)r(rr�r��source�module_globals�membersrr�r�	_convert_�s 	

�zEnumMeta._convert_cOs$ddl}|jdtdd�|j||�S)NrzI_convert is deprecated and will be removed in 3.9, use _convert_ instead.r)�
stacklevel)�warnings�warn�DeprecationWarningr�)r(r��kwargsr�rrr�_converts�zEnumMeta._convertcCs<|D]2}|jD]&}t|t�r|jrtd||jf��qqdS)Nz %s: cannot extend enumeration %r)�__mro__�
issubclassrrtr!r*)r�rR�chain�baserrrrN
s
��z$EnumMeta._check_for_existing_memberscsT|sttfS�fdd�}|d}t|t�s2td��||�p<t}|jrLtd��||fS)Ncs�g}|D]t}d}|jD]d}|tkr&qqt|t�rL|jtk	rz|�|j�qqd|jkrvt|t�rbq|�|pl|�qq|}qqt|�dkr�td�|f��n|r�|dSdSdS)Nrsrz%r: too many data types: %rr)	r�rxr�rrvrIr^rr!)rR�
data_typesr��	candidater��r�rr�_find_data_types*




z.EnumMeta._get_mixins_.<locals>._find_data_typerzZnew enumerations should be created as `EnumName([mixin_type, ...] [data_type,] enum_type)`zCannot extend enumerations)rxrr�r!rt)r�rRr�rUrTrr�rrOs
zEnumMeta._get_mixins_c	Cs�|�dd�}|dk	}|dkrpdD]H}||fD].}t||d�}|ddjtjtjhkr,|}q\q,|dk	r qpq tj}|tjkr�d}nd}|||fS)Nrs)r}rsFT)r�rPrsrxr)	rYrTrUrsr�method�possible�targetr�rrrrpCs*�
zEnumMeta._find_new_)N)N)r*r'r+�classmethodrVrsr�r�r�r�r�r�r�r�r��propertyr�rkr�r�r�r�r��staticmethodrNrOrprMrrr6rr�s6

%
	
5
!
	
.c@speZdZdd�Zdd�Zedd��Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Ze
dd��Ze
dd��ZdS)rc
Cst|�|kr|Sz|j|WStk
r0Yn:tk
rh|j��D]}|j|krH|YSqHYnXzd}|�|�}Wn*tk
r�}z|}d}W5d}~XYnXzdt	||�r�|W�TSt
d||jf�}|dkr�|dkr�|�n|dk�rtd|j|f�}||_|�W5d}d}XdS)N�%r is not a valid %szDerror in %s._missing_: returned %r instead of None or a valid member)
r�rwr�r!ru�valuesrjr;�	ExceptionrCrAr*�__context__)r(r-r�r��result�e�ve_excrrrrsws@


��zEnum.__new__c	Cs6t|�D](}z|dWStk
r.YqXq|S�Nr)r�r!)rr�r�r��
last_valuerrrr:�s	zEnum._generate_next_value_cCsdSrfr)r(r-rrrr;�szEnum._missing_cCsd|jj|j|jfS)N�<%s.%s: %r>)r7r*r{rjr5rrrrk�s
�z
Enum.__repr__cCsd|jj|jfS)N�%s.%s)r7r*r{r5rrrrl�szEnum.__str__cs6�fdd��j��D�dd��jD�}dddg|S)Ncs2g|]*}|jD]}|ddkr|�jkr|�qqS�rr)r^ru)rWr(rhr5rrr��s
�z Enum.__dir__.<locals>.<listcomp>cSsg|]}|ddkr|�qSr�rrgrrrr��sr7r]r')r7r[r^)r#�added_behaviorrr5rr��s
��zEnum.__dir__cCsJt|�jtjtjfk}|jtks$|r2t}t|�}n|j}|j}|�||�Srf)	r�rlrrrvrxrDrjrm)r#�format_spec�str_overriddenr(�valrrrrm�s	
zEnum.__format__cCs
t|j�Srf)�hashr{r5rrr�__hash__�sz
Enum.__hash__cCs|j|jffSrf�r7rjr"rrrr&�szEnum.__reduce_ex__cCs|jSrf)r{r5rrrr�sz	Enum.namecCs|jSrf�rjr5rrrr-�sz
Enum.valueN)r*r'r+rsr:r�r;rkrlr�rmr�r&rrr-rrrrrqs-


)�	metaclassc@seZdZdS)rN)r*r'r+rrrrr�scCs|jSrfrr"rrrr��sr�c@sleZdZdd�Zedd��Zedd��Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�ZdS)rc	Csd|s|dk	r|SdSt|�D]:}zt|�}WqXWqtk
rTtd|�d�YqXqd|dS)NrzInvalid Flag value: %rr)r��	_high_bitr�r!)rr�r�r�r��high_bitrrrr:s	
zFlag._generate_next_value_cCs.|}|dkr|}|�|�}|dkr*|}|Sr�)r9)r(r-�original_value�possible_memberrrrr;s
zFlag._missing_cCsb|j�|d�}|dkr^t||�\}}|r:td||jf��t�|�}d|_||_|j�	||�}|S�Nr�)
rwr��
_decomposerAr*rxrsr{rjrn)r(r-�
pseudo_memberr�extra_flagsrrrr9#s
zFlag._create_pseudo_member_cCs8t||j�s&tdt|�j|jjf��|j|j@|jkSr�)rCr7r!r�r+rj�r#�otherrrrr�7s��zFlag.__contains__cCsV|j}|jdk	r$d|j|j|jfSt||j�\}}d|jd�dd�|D��|jfS)Nr��|cSsg|]}t|jp|j��qSr�rDr{rjrgrrrr�Hsz!Flag.__repr__.<locals>.<listcomp>)r7r{r*rjr�rr�r#r(r��	uncoveredrrrrkAs
�z
Flag.__repr__cCs�|j}|jdk	r d|j|jfSt||j�\}}t|�dkr^|djdkr^d|j|djfSd|jd�dd�|D��fSdS)Nr�rrz%s.%rr�cSsg|]}t|jp|j��qSrr�rgrrrr�Vsz Flag.__str__.<locals>.<listcomp>)r7r{r*r�rjrrrr�rrrrlLs
�zFlag.__str__cCs
t|j�Srf)�boolrjr5rrrr�Ysz
Flag.__bool__cCs"t||j�stS|�|j|jB�Srf�rCr7�NotImplementedrjr�rrr�__or__\szFlag.__or__cCs"t||j�stS|�|j|j@�Srfrr�rrr�__and__aszFlag.__and__cCs"t||j�stS|�|j|jA�Srfrr�rrr�__xor__fszFlag.__xor__cCsNt|j|j�\}}|�d�}|jD] }||kr"|j|j@s"||B}q"|�|�Sr�)r�r7rj)r#r�r��invertedrhrrr�
__invert__ks


zFlag.__invert__N)r*r'r+r:r�r;r9r�rkrlr�rrrrrrrrr�s



c@sPeZdZedd��Zedd��Zdd�Zdd�Zd	d
�ZeZ	eZ
eZdd�Zd
S)rcCs*t|t�std||jf��|�|�}|Sr�)rC�intrAr*r9)r(r-�
new_memberrrrr;ys

zIntFlag._missing_cCs�|j�|d�}|dkr�|g}t||�\}}|rtt|�}d|}||jkrZ||krZ|�|�||krjd}q*||N}q*t|�D]*}t�||�}d|_||_	|j�
||�}q||S)Nrr)rwr�r�r�rIr�rrsr{rjrn)r(r-r��need_to_createrr��bit�
flag_valuerrrr9�s(
�


zIntFlag._create_pseudo_member_cCs0t||jtf�stS|�|j|�|�jB�}|Srf�rCr7rrrj)r#r�r�rrrr�szIntFlag.__or__cCs,t||jtf�stS|�|j|�|�j@�Srfr
r�rrrr�szIntFlag.__and__cCs,t||jtf�stS|�|j|�|�jA�Srfr
r�rrrr�szIntFlag.__xor__cCs|�|j�}|Srfr�)r#r�rrrr�szIntFlag.__invert__N)
r*r'r+r�r;r9rrr�__ror__�__rand__�__rxor__rrrrrrts
	
 cCs|��dSr�)�
bit_length�r-rrrr��sr�cCs^g}|j��D]"\}}||jkr|�||jf�q|rZd�dd�|D��}td||f��|S)Nz, cSsg|]\}}d||f�qS)z%s -> %sr)rW�aliasrrrrr��szunique.<locals>.<listcomp>z duplicate values found in %r: %s)r�r_rrIrrrA)�enumeration�
duplicatesrr��
alias_detailsrrrr
�s
��cCs�|}|dk}|r*dd�t|j���D�}ndd�t|j���D�}g}|D],\}}|rJ||@|krJ|�|�||M}qJ|s�||jkr�|�|j|�|jdd�dd�t|�d	kr�|dj|kr�|�d�||fS)
NrcSs"g|]\}}|jdk	r||f�qSrfr�rWrarhrrrr��s
�z_decompose.<locals>.<listcomp>cSs*g|]"\}}|jdk	st|�r||f�qSrf)r�
_power_of_tworrrrr��s
�cSs|jSrfr�)rhrrrr��r�z_decompose.<locals>.<lambda>T)rK�reverser)rGrwr_rIr�rr-ro)�flagr-�not_covered�negative�flags_to_checkr�r�r�rrrr��s(��

r�cCs|dkrdS|dt|�kS)NrFr)r�rrrrr�sr)r��typesrr�__all__rrr r)rxr,r	�dictr.rr�rrrr�rrr�r
r�rrrrr�<module>s>�
	LivI%bz2.cpython-38.pyc000064400000026267150335716500007713 0ustar00U

e5d1�@s�dZddddddgZdZdd	lmZdd
lZdd
lZdd
lZdd
l	Z	ddl
mZddlm
Z
mZdZd
ZdZe�ZGdd�de	j�Zddd�Zddd�Zdd�Zd
S)z�Interface to the libbzip2 compression library.

This module provides a file interface, classes for incremental
(de)compression, and functions for one-shot (de)compression.
�BZ2File�
BZ2Compressor�BZ2Decompressor�open�compress�
decompressz%Nadeem Vawda <nadeem.vawda@gmail.com>�)rN)�RLock)rr��c@s�eZdZdZdedfdd�Zdd�Zedd	��Zd
d�Z	dd
�Z
dd�Zdd�Zd)dd�Z
d*dd�Zd+dd�Zdd�Zd,dd�Zd-dd�Zd d!�Zd"d#�Zejfd$d%�Zd&d'�Zd(S).ra@A file object providing transparent bzip2 (de)compression.

    A BZ2File can act as a wrapper for an existing file object, or refer
    directly to a named file on disk.

    Note that BZ2File provides a *binary* file interface - data read is
    returned as bytes, and data to be written should be given as bytes.
    �r�	cCsTt�|_d|_d|_t|_|tk	r2tjdt	dd�d|krFdksPnt
d��|d	krbd
}t}nb|dkr~d}t}t
|�|_nF|d
kr�d}t}t
|�|_n*|dkr�d}t}t
|�|_nt
d|f��t|tttjf�r�t||�|_d|_||_n.t|d��st|d��r||_||_ntd��|jtk�rJtj|jttd�}t�|�|_nd|_dS)aOOpen a bzip2-compressed file.

        If filename is a str, bytes, or PathLike object, it gives the
        name of the file to be opened. Otherwise, it should be a file
        object, which will be used to read or write the compressed data.

        mode can be 'r' for reading (default), 'w' for (over)writing,
        'x' for creating exclusively, or 'a' for appending. These can
        equivalently be given as 'rb', 'wb', 'xb', and 'ab'.

        buffering is ignored since Python 3.0. Its use is deprecated.

        If mode is 'w', 'x' or 'a', compresslevel can be a number between 1
        and 9 specifying the level of compression: 1 produces the least
        compression, and 9 (default) produces the most compression.

        If mode is 'r', the input file may be the concatenation of
        multiple compressed streams.
        NFzGUse of 'buffering' argument is deprecated and ignored since Python 3.0.�)�
stacklevelr	rz%compresslevel must be between 1 and 9)�r�rbr)�w�wbr)�x�xbr)�a�abr�Invalid mode: %rT�read�writez6filename must be a str, bytes, file or PathLike object)Ztrailing_errorr)r�_lock�_fp�_closefp�_MODE_CLOSED�_mode�	_sentinel�warnings�warn�DeprecationWarning�
ValueError�
_MODE_READ�_MODE_WRITEr�_compressor�
isinstance�str�bytes�os�PathLike�
_builtin_open�hasattr�	TypeError�_compressionZDecompressReaderr�OSError�io�BufferedReader�_buffer�_pos)�self�filename�mode�	buffering�
compresslevelZ	mode_code�raw�r;�/usr/lib64/python3.8/bz2.py�__init__)sT��zBZ2File.__init__cCs�|j��|jtkr W5QR�dSz<|jtkr8|j��n"|jtkrZ|j�	|j
���d|_
W5z|jrp|j��W5d|_d|_t|_d|_XXW5QRXdS)z�Flush and close the file.

        May be called more than once without error. Once the file is
        closed, any other operation on it will raise a ValueError.
        NF)rrrrrr3�closer$r%rr&�flush�r5r;r;r<r>ps 



z
BZ2File.closecCs
|jtkS)zTrue if this file is closed.)rrr@r;r;r<�closed�szBZ2File.closedcCs|��|j��S)z3Return the file descriptor for the underlying file.)�_check_not_closedr�filenor@r;r;r<rC�szBZ2File.filenocCs|��o|j��S)z)Return whether the file supports seeking.)�readabler3�seekabler@r;r;r<rE�szBZ2File.seekablecCs|��|jtkS)z/Return whether the file was opened for reading.)rBrr$r@r;r;r<rD�szBZ2File.readablecCs|��|jtkS)z/Return whether the file was opened for writing.)rBrr%r@r;r;r<�writable�szBZ2File.writablerc
Cs2|j�"|��|j�|�W5QR�SQRXdS)z�Return buffered data without advancing the file position.

        Always returns at least one byte of data, unless at EOF.
        The exact number of bytes returned is unspecified.
        N)r�_check_can_readr3�peek)r5�nr;r;r<rH�szBZ2File.peek���c
Cs2|j�"|��|j�|�W5QR�SQRXdS)z�Read up to size uncompressed bytes from the file.

        If size is negative or omitted, read until EOF is reached.
        Returns b'' if the file is already at EOF.
        N)rrGr3r�r5�sizer;r;r<r�szBZ2File.readc
Cs@|j�0|��|dkrtj}|j�|�W5QR�SQRXdS)z�Read up to size uncompressed bytes, while trying to avoid
        making multiple reads from the underlying stream. Reads up to a
        buffer's worth of data if size is negative.

        Returns b'' if the file is at EOF.
        rN)rrGr1�DEFAULT_BUFFER_SIZEr3�read1rKr;r;r<rN�s
z
BZ2File.read1c
Cs2|j�"|��|j�|�W5QR�SQRXdS)zRRead bytes into b.

        Returns the number of bytes read (0 for EOF).
        N)rrGr3�readinto)r5�br;r;r<rO�szBZ2File.readintoc
CsVt|t�s$t|d�std��|��}|j�"|��|j�|�W5QR�SQRXdS)a
Read a line of uncompressed bytes from the file.

        The terminating newline (if present) is retained. If size is
        non-negative, no more than size bytes will be read (in which
        case the line may be incomplete). Returns b'' if already at EOF.
        �	__index__�Integer argument expectedN)	r'�intr-r.rQrrGr3�readlinerKr;r;r<rT�s

zBZ2File.readlinec
CsVt|t�s$t|d�std��|��}|j�"|��|j�|�W5QR�SQRXdS)z�Read a list of lines of uncompressed bytes from the file.

        size can be specified to control the number of lines read: no
        further lines will be read once the total size of the lines read
        so far equals or exceeds size.
        rQrRN)	r'rSr-r.rQrrGr3�	readlinesrKr;r;r<rU�s

zBZ2File.readlinesc
CsX|j�H|��|j�|�}|j�|�|jt|�7_t|�W5QR�SQRXdS)z�Write a byte string to the file.

        Returns the number of uncompressed bytes written, which is
        always len(data). Note that due to buffering, the file on disk
        may not reflect the data written until close() is called.
        N)rZ_check_can_writer&rrrr4�len)r5�dataZ
compressedr;r;r<r�sz
BZ2File.writec
Cs,|j�tj�||�W5QR�SQRXdS)z�Write a sequence of byte strings to the file.

        Returns the number of uncompressed bytes written.
        seq can be any iterable yielding byte strings.

        Line separators are not added between the written byte strings.
        N)rr/�
BaseStream�
writelines)r5�seqr;r;r<rY�szBZ2File.writelinesc
Cs4|j�$|��|j�||�W5QR�SQRXdS)a�Change the file position.

        The new position is specified by offset, relative to the
        position indicated by whence. Values for whence are:

            0: start of stream (default); offset must not be negative
            1: current stream position
            2: end of stream; offset must not be positive

        Returns the new file position.

        Note that seeking is emulated, so depending on the parameters,
        this operation may be extremely slow.
        N)rZ_check_can_seekr3�seek)r5�offset�whencer;r;r<r[szBZ2File.seekc
CsL|j�<|��|jtkr0|j��W5QR�S|jW5QR�SQRXdS)z!Return the current file position.N)rrBrr$r3�tellr4r@r;r;r<r^s

zBZ2File.tellN)r)rJ)rJ)rJ)rJ)�__name__�
__module__�__qualname__�__doc__rr=r>�propertyrArCrErDrFrHrrNrOrTrUrrYr1�SEEK_SETr[r^r;r;r;r<rs&	G





	

rrcCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|�dd�}t|||d	�}d|kr�t�||||�S|SdS)
aOpen a bzip2-compressed file in binary or text mode.

    The filename argument can be an actual filename (a str, bytes, or
    PathLike object), or an existing file object to read from or write
    to.

    The mode argument can be "r", "rb", "w", "wb", "x", "xb", "a" or
    "ab" for binary mode, or "rt", "wt", "xt" or "at" for text mode.
    The default mode is "rb", and the default compresslevel is 9.

    For binary mode, this function is equivalent to the BZ2File
    constructor: BZ2File(filename, mode, compresslevel). In this case,
    the encoding, errors and newline arguments must not be provided.

    For text mode, a BZ2File object is created, and wrapped in an
    io.TextIOWrapper instance with the specified encoding, error
    handling behavior, and line ending(s).

    �trPrNz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary moder)r9)r#�replacerr1�
TextIOWrapper)r6r7r9�encoding�errors�newlineZbz_modeZbinary_filer;r;r<r!scCst|�}|�|�|��S)z�Compress a block of data.

    compresslevel, if given, must be a number between 1 and 9.

    For incremental compression, use a BZ2Compressor object instead.
    )rrr?)rWr9�compr;r;r<rJscCshg}|r^t�}z|�|�}Wn tk
r<|r6Yq^n�YnX|�|�|jsVtd��|j}qd�|�S)zjDecompress a block of data.

    For incremental decompression, use a BZ2Decompressor object instead.
    zACompressed data ended before the end-of-stream marker was reached�)rrr0�append�eofr#Zunused_data�join)rWZresultsZdecomp�resr;r;r<rUs
)rrNNN)r)rb�__all__�
__author__�builtinsrr,r1r*r r/Z	threadingrZ_bz2rrrr$r%�objectrrXrrrr;r;r;r<�<module>s6��
)
getpass.cpython-38.opt-2.pyc000064400000005663150335716500011621 0ustar00U

e5dj�@s�ddlZddlZddlZddlZddlZdddgZGdd�de�Zddd�Zdd	d
�Z	ddd�Z
ddd�Zdd�Zzddl
Z
e
je
jfWnBeefk
r�zddlZWnek
r�e
ZYnXe	ZYnXeZdS)�N�getpass�getuser�GetPassWarningc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.8/getpass.pyrs�
Password: c
Cs�d}t�����}zJt�dtjtjB�}t�|d�}|�|�t�	|�}|�|�|sX|}Wnpt
k
r�}zR|��ztj
��}Wn&ttfk
r�d}t||�}YnXtj
}|s�tj}W5d}~XYnX|dk	�r�z�t�|�}|dd�}	|	dtjM<tj}
ttd��r|
tjO}
z t�||
|	�t|||d�}W5t�||
|�|��XWn@tjk
�r�|dk	�rz�||k	�r�|��t||�}YnX|�d�|W5QR�SQRXdS)Nz/dev/ttyzw+��TCSASOFT)�input�
)�
contextlib�	ExitStack�os�open�O_RDWR�O_NOCTTY�io�FileIO�
enter_context�
TextIOWrapper�OSError�close�sys�stdin�fileno�AttributeError�
ValueError�fallback_getpass�stderr�termios�	tcgetattrZECHOZ	TCSAFLUSH�hasattrr�	tcsetattr�flush�
_raw_input�error�write)�prompt�streamZpasswd�stack�fdZttyr
�e�old�newZtcsetattr_flagsrrr	�unix_getpasssR








r1cCs�tjtjk	rt||�S|D]}t�|�qd}t��}|dkst|dkrHqt|dkrTt�|dkrj|dd�}q.||}q.t�d�t�d�|S)N��
r�����)rr�	__stdin__r �msvcrtZputwchZgetwch�KeyboardInterrupt)r*r+�cZpwrrr	�win_getpassas 



r;cCs0tjdtdd�|stj}td|d�t||�S)Nz%Can not control echo on the terminal.�)�
stacklevelz&Warning: Password input may be echoed.)�file)�warnings�warnrrr!�printr')r*r+rrr	r xs�r r2cCs�|s
tj}|stj}t|�}|rpz|�|�Wn8tk
rf|�|jd�}|�|j�}|�|�YnX|�	�|�
�}|s�t�|ddkr�|dd�}|S)N�replacer6r)rr!r�strr)�UnicodeEncodeError�encode�encoding�decoder&�readline�EOFError)r*r+r
�linerrr	r'�s&r'cCs<dD]}tj�|�}|r|Sqddl}|�t���dS)N)ZLOGNAMEZUSERZLNAMEZUSERNAMEr)r�environ�get�pwd�getpwuid�getuid)�name�userrMrrr	r�s
)r
N)r
N)r
N)r2NN)rrrrr?�__all__�UserWarningrr1r;r r'rr"r#r%�ImportErrorrr8rrrrr	�<module>s*

D

	


secrets.cpython-38.opt-1.pyc000064400000004220150335716500011606 0ustar00U

e5d��@s�dZddddddddgZd	d
lZd	d
lZd	d
lZd	dlmZd	dlmZe�Z	e	j
Ze	jZd
d�Z
dZddd�Zddd�Zddd�Zd
S)z�Generate cryptographically strong pseudo-random numbers suitable for
managing secrets such as account authentication, tokens, and similar.

See PEP 506 for more information.
https://www.python.org/dev/peps/pep-0506/

�choice�	randbelow�randbits�SystemRandom�token_bytes�	token_hex�
token_urlsafe�compare_digest�N)r)rcCs|dkrtd��t�|�S)z(Return a random int in the range [0, n).r	zUpper bound must be positive.)�
ValueError�_sysrandZ
_randbelow)Zexclusive_upper_bound�r�/usr/lib64/python3.8/secrets.pyrs� cCs|dkrt}t�|�S)z�Return a random byte string containing *nbytes* bytes.

    If *nbytes* is ``None`` or not supplied, a reasonable
    default is used.

    >>> token_bytes(16)  #doctest:+SKIP
    b'\xebr\x17D*t\xae\xd4\xe3S\xb6\xe2\xebP1\x8b'

    N)�DEFAULT_ENTROPY�os�urandom��nbytesrrr
r#s
cCst�t|���d�S)a"Return a random text string, in hexadecimal.

    The string has *nbytes* random bytes, each byte converted to two
    hex digits.  If *nbytes* is ``None`` or not supplied, a reasonable
    default is used.

    >>> token_hex(16)  #doctest:+SKIP
    'f9bf78b9a18ce6d46a0cd2b0b86df9da'

    �ascii)�binasciiZhexlifyr�decoderrrr
r1scCst|�}t�|��d��d�S)z�Return a random URL-safe text string, in Base64 encoding.

    The string has *nbytes* random bytes.  If *nbytes* is ``None``
    or not supplied, a reasonable default is used.

    >>> token_urlsafe(16)  #doctest:+SKIP
    'Drmhze6EPcv0fN_81Bj-nA'

    �=r)r�base64Zurlsafe_b64encode�rstripr)r�tokrrr
r>s
)N)N)N)�__doc__�__all__rrrZhmacrZrandomrrZgetrandbitsrrrrrrrrrrr
�<module>s&�


pydoc.cpython-38.opt-2.pyc000064400000220241150335716500011260 0ustar00U

��.e̠�@s�dgZdZdZdZddlZddlZddlZddlZddl	Zddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZddlmZd	d
�Zdd�Zd
d�Zdd�Z dd�Z!dd�Z"dd�Z#e�$dej%�Z&dd�Z'dd�Z(dd�Z)dd�Z*dwd d!�Z+d"d#�Z,d$d%�Z-d&d'�Z.d(d)�Z/ifd*d+�Z0Gd,d-�d-e1�Z2d.d/�Z3difd0d1�Z4Gd2d3�d3�Z5Gd4d5�d5e�Z6Gd6d7�d7e5�Z7Gd8d9�d9e�Z8Gd:d;�d;e5�Z9Gd<d=�d=e9�Z:d>d?�a;d@dA�Z<dBdC�Z=dDdE�Z>dFdG�Z?dHdI�Z@dJdK�ZAdLdM�ZBdNdO�ZCdxdPdQ�ZDe9�ZEe:�ZFe7�ZGdydRdS�ZHdzdUdV�ZId{dWdX�ZJd|dYdZ�ZKd}d\d]�ZLGd^d_�d_�ZMeM�ZNGd`da�da�ZOdbdc�ZPddde�ZQd~dgdh�ZRddidjdk�dldm�ZSdndo�ZTdpdq�ZUdrds�ZVdtdu�ZWeXdvk�r�eW�dS)��helpzKa-Ping Yee <ping@lfw.org>z26 February 2001z�Guido van Rossum, for an excellent programming language.
Tommy Burnette, the original creator of manpy.
Paul Prescod, for all his work on onlinehelp.
Richard Chamberlain, for the first implementation of textdoc.
�N)�deque)�Repr)�format_exception_onlycCs\g}g}tjD]H}tj�|pd�}tj�|�}||krtj�|�r|�|�|�|�q|S�N�.)�sys�path�os�abspath�normcase�isdir�append)�dirsZnormdirs�dirZnormdir�r�/usr/lib64/python3.8/pydoc.py�pathdirsPs

rcCs.t�|�pt�|�}|r*t�dd|���p,dS)Nz^ *
�)�inspect�getdocZgetcomments�re�sub�rstrip)�object�resultrrrr\srcCsf|���d�}t|�dkr&|ddfSt|�dkrX|d��sX|dd�|dd��fSdd�|�fS)N�
�rr�)�strip�split�lenr�join)�doc�linesrrr�splitdocasr%cCs"|j}|j|kr|jd|}|Sr)�__name__�
__module__)r�modname�namerrr�	classnamejs
r*cCs>t�|�p:t�|�p:t�|�p:t�|�p:t�|�p:t�|�S�N)r�ismodule�isclass�	isroutineZisframeZistracebackZiscode�rrrr�isdataqs����r0cGs.|r*|d�|�|d��}|dd�}q|S)Nrrr)r"r )�textZpairsrrr�replacewsr2cCsXt|�|krTtd|dd�}td|d|�}|d|�d|t|�|d�S|S)Nr�r�...)r!�max)r1�maxlenZpreZpostrrr�cram~s
$r7z at 0x[0-9a-f]{6,16}(>+)$cCst�d|�S)Nz\1)�_re_stripidr�r1rrr�stripid�sr:cCs<t�|�rdSt�|�r8t|dd�}t�|�p4|dkSdS)NT�__self__F)r�ismethod�	isbuiltin�getattrr,)�fn�selfrrr�_is_bound_method�s

rAcCs^i}t�|tj�D]\}}d||<q|jD]}|�t|��q*|��D]}t||�||<qF|S�Nr)r�
getmembersr.�	__bases__�update�
allmethods�keysr>)�cl�methods�key�value�baserrrrF�s

rFcCs8g}g}|D]"}||�r$|�|�q|�|�q||fSr+�r)�s�	predicateZyesZno�xrrr�_split_list�srQcCs\|dkrdS|�d�r$|�d�r$dS|�d�r<t|d�r<dS|dk	rL||kS|�d�SdS)N>�	__slots__�__date__�__path__�__qualname__�__builtins__�__credits__�__doc__�
__author__�__version__�__file__r&�
__cached__r'�
__loader__�__spec__�__package__r�__r�_�_fieldsT)�
startswith�endswith�hasattr)r)�all�objrrr�visiblename�srhcCsXg}t�|�D]D\}}}}t�|�r@d}t|t�r@|jdkr@d}|�||||f�q|S)N�data descriptor�readonly property)r�classify_class_attrs�isdatadescriptor�
isinstance�property�fsetr)r�resultsr)�kind�clsrKrrrrk�s
rkcs\t|dg��z�fdd�t��D��Wntk
r>i�YnX�fdd�}|j|d�dS)Nrbcsi|]\}}||t���qSr)r!)�.0�ir))�fieldsrr�
<dictcomp>�sz#sort_attributes.<locals>.<dictcomp>cs��|dd�|dfS�Nr)�get)�attr)�field_orderrr�<lambda>��z!sort_attributes.<locals>.<lambda>�rJ)r>�	enumerate�	TypeError�sort)�attrsrZkeyfuncr)rzrur�sort_attributes�s
r�cCs:tj�|�r6dD]$}tj�tj�|d|��rdSqdS)N)z.pyz.pyc�__init__TF)r
r	r
�isfiler")r	�extrrr�	ispackage�s
r�cCs�|��}|dd�dks |��s0|��}|sq0q|��}|dd�dkrT|dd�}|dd�dkr�|dd�}|dd�dkr�|dd�}|��s�|��}|s�q�q�|�d�d	��}nd}|S)
Nr�#�zr"""r3�"""����\r)�readlinerr )�file�linerrrr�source_synopsis�s&r�c
	Cs t�|�j}|�|d�\}}|dks.||k�r|�ttjj��rJtjj	}n |�ttjj
��rftjj}nd}|dkr�zt�
|�}Wntk
r�YdSX|�t|�}W5QRXn^|d|�}tjjd||d�}ztj�|�}	WnYdSXtjd=|	j�r|	j��dnd}||f||<|S)N)NNZ__temp__��loaderr)r
�stat�st_mtimerxrd�tuple�	importlib�	machinery�BYTECODE_SUFFIXES�SourcelessFileLoader�EXTENSION_SUFFIXES�ExtensionFileLoader�tokenize�open�OSErrorr��util�spec_from_file_location�
_bootstrap�_loadr�modulesrX�
splitlines)
�filename�cache�mtimeZ
lastupdaterZ
loader_clsr�r��spec�modulerrr�synopsis�s6



�r�c@seZdZdd�Zdd�ZdS)�ErrorDuringImportcCs||_|\|_|_|_dSr+)r��excrK�tb)r@r��exc_inforrrr�#szErrorDuringImport.__init__cCs|jj}d|j||jfS)Nzproblem in %s - %s: %s)r�r&r�rK)r@r�rrr�__str__'szErrorDuringImport.__str__N)r&r'rUr�r�rrrrr�!sr�c		Cs�tjj}t|d��}||�t|��k}W5QRXtj�|�}tj�	|�\}}|r`tj
�||�}ntj
�||�}tjj
|||d�}ztj�|�WSt|t����YnXdS)N�rbr�)r�r��MAGIC_NUMBERr��readr!r
r	�basename�splitext�_bootstrap_externalr��SourceFileLoaderr�r�r�r�rr�)	r	�magicr�Zis_bytecoder�r)r�r�r�rrr�
importfile+sr�c	s z^|rT�tjkrT�tjkrT�fdd�tjD�}�g|D]}tj|||<tj|=q8t��}Wnzt��\}}}}	�tjkr�ttj�j|	��n>|tkr�t|j|	��n(t	|t
�r�|j�kr�YdSt�t����YnX��d�dd�D].}
zt
||
�}Wq�tk
�rYdSXq�|S)Ncsg|]}|��d�r|�qS)r)rc)rs�m�r	rr�
<listcomp>Qszsafeimport.<locals>.<listcomp>rr)rr��builtin_module_names�
__import__r�r�r[�SyntaxErrorr��
issubclass�ImportErrorr)r r>�AttributeError)r	�	forceloadr�ZsubsrJr�r�rKr��info�partrr�r�
safeimport=s.


r�c@sfeZdZej�ddejdd��Zddd�Z	d
dd�Z
e
ZZZ
ZZZe�d	�fd
d�ZdS)�Doc�
PYTHONDOCSz%https://docs.python.org/%d.%d/libraryNrcGs�||f|}zFt�|�r$|j|�WSt�|�r:|j|�WSt�|�rP|j|�WSWntk
rfYnXt�|�r||j	|�S|j
|�Sr+)rr,�	docmoduler-�docclassr.�
docroutiner�rl�docdata�docother)r@rr)�argsrrr�documentss




zDoc.documentcGs*d|odt|�t|�jf}t|��dS)Nz.don't know how to document object%s of type %s� )�repr�typer&r)r@rr)r��messagerrr�fail�s
�zDoc.failZstdlibcCs�zt�|�}Wntk
r&d}YnXtj�d|j�}tj�|�}t	|t
t��r�|jdksz|�|�r�|�tj�
|d��s�|jdkr�|�d�r�d|�d�|j��f}q�tj�
||j��d	�}nd}|S)
N�
(built-in)r�)
�errno�
exceptionsZgcZimp�marshal�posix�signalr�_threadZ	zipimportz
site-packages)z	xml.etreeztest.pydoc_mod)zhttp://zhttps://z%s/%s�/�.html)r�
getabsfilerr
�environrxr�r	rrmr�r&rcr"r�lower)r@rZbasedirr��doclocrrr�	getdocloc�s(
����
z
Doc.getdocloc)N)N)r&r'rUr
r�rxr�version_infor�r�r�r�r�r�r��docpropertyr��	sysconfigZget_pathr�rrrrr�ms��

r�c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZeZdd�Z	eZ
d
S)�HTMLReprcCs,t�|�d|_|_d|_d|_|_dS�N��
�d�rr��maxlist�maxtuple�maxdict�	maxstring�maxother�r@rrrr��s
zHTMLRepr.__init__cCst|dddddd�S)N�&z&amp;�<z&lt;�>z&gt;)r2�r@r1rrr�escape�szHTMLRepr.escapecCst�||�Sr+)rr��r@rrrrr��sz
HTMLRepr.reprcCsZtt|�d�r@dd�t|�j���}t||�r@t||�||�S|�ttt	|��|j
��S�Nr&�repr_ra)rer�r"r&r r>r�r7r:r�r��r@rP�levelZ
methodnamerrr�repr1�s

zHTMLRepr.repr1cCs^t||j�}t|�}d|krJdt|dd�krJd|d|�|�|dSt�dd|�|��S)Nr��\\r�rrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z<font color="#c040c0">\1</font>)r7r�r�r2r�rr�r@rPr�ZtestZtestreprrrr�repr_string�s�zHTMLRepr.repr_stringcCs@z|�ttt|��|j��WS|�d|jj�YSXdS�Nz
<%s instance>)r�r7r:r�r��	__class__r&�r@rPr�rrr�
repr_instance�szHTMLRepr.repr_instanceN)r&r'rUr�r�r�r�r��repr_strrZrepr_unicoderrrrr��sr�c@s�eZdZe�ZejZejZdd�Zd0dd�Zd1d	d
�Z	dd�Z
d
d�Zd2dd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdiiifdd�Zd3d d!�Zd4d"d#�Zddiifd$d%�Zd&d'�Zddiiidfd(d)�Zd5d*d+�ZeZd6d,d-�Zd7d.d/�ZdS)8�HTMLDoccCsd||fS)Nz�<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
%s
</body></html>r)r@�title�contentsrrr�page�s�zHTMLDoc.pagercCsd|||||pdfS)Na'
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="%s">
<td valign=bottom>&nbsp;<br>
<font color="%s" face="helvetica, arial">&nbsp;<br>%s</font></td
><td align=right valign=bottom
><font color="%s" face="helvetica, arial">%s</font></td></tr></table>
    �&nbsp;r)r@r�fgcol�bgcolZextrasrrr�heading�s�zHTMLDoc.heading�Nrc	
Cs^|dkrdd|d}d|||f}	|r@|	d||||f}	n|	d|||f}	|	d|S)Nz<tt>rz</tt>z�<p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="%s">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="%s" face="helvetica, arial">%s</font></td></tr>
    zR
<tr bgcolor="%s"><td rowspan=2>%s</td>
<td colspan=2>%s</td></tr>
<tr><td>%s</td>z(
<tr><td bgcolor="%s">%s</td><td>%s</td>z'
<td width="100%%">%s</td></tr></table>r)
r@rr	r
r�widthZpreludeZ
marginaliaZgaprrrr�section�s�
��zHTMLDoc.sectioncGsd|}|j|f|��S)Nz<big><strong>%s</strong></big>)r)r@rr�rrr�
bigsectionszHTMLDoc.bigsectionc
Cs&|�|���}t|dddddddd�	S)N�

z
 
r�rr�<br>
)r��
expandtabsr2r�rrr�	preformat
s�zHTMLDoc.preformatr�cCs�d}t|�|d|}t|�D]X}|dd|}t|||||�D]$}|t|�krJ||||�d}qJ|d}q d|S)Nrrz<td width="%d%%" valign=top>r�rz</td>z7<table width="100%%" summary="list"><tr>%s</tr></table>)r!�range)r@�list�formatZcolsr�rows�colrtrrr�multicolumns
zHTMLDoc.multicolumncCsd|S)Nz<font color="#909090">%s</font>rr�rrr�greyr|zHTMLDoc.greycGs*|D] }||krd|||fSq|S)N�<a href="%s">%s</a>r)r@r)Zdicts�dictrrr�namelinkszHTMLDoc.namelinkcCsN|jtj�|j�}}t||�rDt||�|krDd|j|t||�fSt||�S)Nz<a href="%s.html#%s">%s</a>)r&rr�rxr'rer>r*)r@rr(r)r�rrr�	classlink%s�zHTMLDoc.classlinkcCsd|j|jfS�Nz<a href="%s.html">%s</a>)r&r�rrr�
modulelink-szHTMLDoc.modulelinkcCsR|\}}}}|r|�|�S|r,d||f}nd|}|rBd|}n|}d||fS)Nz
%s.%s.htmlz%s.htmlz"<strong>%s</strong>&nbsp;(package)r)r)r@Z
modpkginfor)r	r��shadowed�urlr1rrr�
modpkglink1s

zHTMLDoc.modpkglinkcCsd||fS)Nz<a href="file:%s">%s</a>r)r@r"r	rrr�filelink@szHTMLDoc.filelinkcCs�|p|j}g}d}t�d�}|�||�}	|	s0�qh|	��\}
}|�||||
���|	��\}}
}}}}|
r�||��dd�}|�d||f�n�|r�dt|�}|�d|||�f�n�|r�dt|�}|�d|||�f�n�|�r"|||d�d	k�r|�d
|�	||��n|�d|�n@|||d�d	k�rP|�|�	||||��n|�|�	||��|}q|�|||d���d�
|�S)
NrzD\b((http|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?(\w+))�"z&quot;rz'http://www.rfc-editor.org/rfc/rfc%d.txtz(http://www.python.org/dev/peps/pep-%04d/r�(zself.zself.<strong>%s</strong>r)r�r�compile�search�spanr�groupsr2�intrr")r@r1r��funcs�classesrIrp�here�pattern�match�start�endrfZschemeZrfcZpepZselfdotr)r"rrr�markupDs:

zHTMLDoc.markupc
Cs�d}|D]�}t|�td�kr�|\}}|d}||�||�}|r�||fkr�g}|D]}	|�|�|	|��qR|dd�|�d}|d}qt|�tg�kr|d|�|||�}qd	|S)
Nrrz"<dt><font face="helvetica, arial">r&�, �)z
</font></dt>z
<dd>
%s</dd>
z
<dl>
%s</dl>
)r�rrr"�
formattree)
r@�treer(�parentr�entry�c�bases�parentsrLrrrr6os&
�
zHTMLDoc.formattreec#
s�|j}z
|j}Wntk
r(d}YnX|�d�}g}tt|�d�D],}|�dd�|d|d��||f�qHd�||dd��}	d|	}
z&t�	|�}t
j�|�}��
||�}
Wntk
r�d}
YnXg}t|d��r6t|j�}|dd�d	k�r"|dd�d
k�r"|dd���}|�d��|��t|d��rX|���t|j���|�rp|
d
d�|�}
��|�}|dk	�r�dt�}nd}��|
ddd|
|�}t�|tj�}gi}}t�|tj�D]Z\}}|dk	�s�t�|��p�||k�r�t|||��r�|�||f�d|||<||<�q�|D]�\}}|jD]n}|j|j}}tj �!|�}||k�r@|�r@t||��r@t"||�|k�r@||k�r@|d|||<||<�q@�q2gi}}t�|tj#�D]p\}}|dk	�s�t�$|��s�t�|�|k�r�t|||��r�|�||f�d|||<t�%|��r�||||<�q�g}t�|t&�D]&\}}t|||��rN|�||f��qN��'t(|��j)||�}|�o�d|}|d|}t|d��rg}t*�+|j,�D]\}}} |�||| df��q�|�-���.|�j/�}!|��0ddd|!�}n.|�r<��.|�fdd��}!|��0ddd|!�}|�r�d d!�|D�}"��1t�2|"d�|�g}!|D]"\}}|!���3|||||���qj|��0d"dd#d$�|!��}|�r�g}!|D]"\}}|!���3|||||���q�|��0d%dd&d$�|!��}|�r:g}!|D]\}}|!���3||���q|��0d'dd(d)�|!��}t|d*��rn��'t|j4��j)�}!|��0d+dd|!�}t|d,��r���'t|j5��j)�}!|��0d-dd|!�}|S).Nrrz5<a href="%s.html"><font color="#ffffff">%s</font></a>r��)<big><big><strong>%s</strong></big></big>r�rZ��$Revision: �$z
version %srSz (%s)r4z-<br><a href="%(docloc)s">Module Reference</a>r�#ffffff�#7799eez<a href=".">index</a><br>r�z.html#z#-z<tt>%s</tt>z
<p>%s</p>
rTrzPackage Contentsz#aa55cccs��|d�SrB)r ��tr�rrr{�r|z#HTMLDoc.docmodule.<locals>.<lambda>ZModulescSsg|]\}}|�qSrr�rsrJrKrrrr��sz%HTMLDoc.docmodule.<locals>.<listcomp>ZClasses�#ee77aar�Z	Functionsz#eeaa77ZDataz#55aa55rrYZAuthorrWZCredits)6r&�__all__r�r rr!rr"rr��urllib�parseZquoter$rre�strrZrr�rSr��localsrrCr,r-�	getmodulerhrDr'rr�rxr>r.r=�
isfunctionr0r3rr�pkgutil�iter_modulesrTr�rr#rr6�getclasstreer�rYrW)#r@rr)�mod�ignoredrf�partsZlinksrtZ
linkedname�headr	r"r$r��versionr�rr�r-ZcdictrJrKrLr(r�r,Zfdict�datar#�modpkgs�importer�ispkgr�	classlistrr�rr��s*


��


$


�

�

 

���
��������zHTMLDoc.docmodulec	s��j}|p|}�j}g}	|	j�G�fdd�d�}
|
��tt����}t|�dkr�����d�|D]}�d��|�j	��qd�d���������fdd�}
����fd	d
�}��������fdd�}�fd
d�t
��D�}i�|D]n\}}}}d|d|�|<}zt�|�}Wntk
�r4YnXz|�|<Wq�t
k
�rXYq�Xq�|�rj|�rr|���n|dd�t|�fdd��\}}�tjk	�r��tjk�r�|}�q\n"��k�r�d}nd����j	�}|d7}t|��|
d||dd��}|
d||dd��}|
d||dd��}|d||dd��}|d||d d��}|d!||d"d��}|}�q\d#�|	�}	||k�r�d$||f}nd%|||f}|�r�g}|D]}|���|�j	���q�|d&d'�|�}d#}zt���}Wntt
fk
�rd}YnX|�r8t|�}|�r8|d(k�r8|��|�d)}t��}|�rT||�pPd#}��|�j����}|�otd*|}��|d+d,|	d-|�S).Ncs eZdZdd�Z�fdd�ZdS)z(HTMLDoc.docclass.<locals>.HorizontalRulecSs
d|_dSrw�Zneedoner�rrrr�sz1HTMLDoc.docclass.<locals>.HorizontalRule.__init__cs|jr�d�d|_dS)Nz<hr>
rr[r���pushrr�maybe	sz.HTMLDoc.docclass.<locals>.HorizontalRule.maybeN�r&r'rUr�r^rr\rr�HorizontalRulesr`rz&<dl><dt>Method resolution order:</dt>
z<dd>%s</dd>
�</dl>
cs�t||�\}}|r�����|�|D]d\}}}}zt�|�}Wn&tk
rf���||���YnX���||��������d�q&|S)Nr�rQr^r>�	Exceptionr�r���msgr�rO�okr)rq�homeclsrK�r-r,�hr�mdictrQrr]r@rr�spills"�
zHTMLDoc.docclass.<locals>.spillcsJt||�\}}|rF����|�|D]\}}}}���||���q&|Sr+�rQr^r�rd�rirQr]r@rr�spilldescriptors+sz*HTMLDoc.docclass.<locals>.spilldescriptorsc
s�t||�\}}|r�����|�|D]�\}}}}��t�|�|��}t|�sXt�|�rft|dd�}	nd}	|	dkr��d|�n0��t|��j	����}	d|	}	�d||	f��d�q&|S)NrXz<dl><dt>%s</dl>
z<dd><tt>%s</tt>z<dl><dt>%s%s</dl>
r)
rQr^r�r>�callablerrlr3rr)
rer�rOrfr)rqrgrKrLr#rhrr�	spilldata4s(�
z#HTMLDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qS�)rg�rh�rsr)rqrrrKr/rrr�Is
�z$HTMLDoc.docclass.<locals>.<listcomp>r��-rcs|d�kS�NrrrC��	thisclassrrr{br|z"HTMLDoc.docclass.<locals>.<lambda>�defined here�inherited from %sz:<br>
z
Methods %scSs|ddkS�Nr�methodrrCrrrr{rr|zClass methods %scSs|ddkS�Nrzclass methodrrCrrrr{tr|zStatic methods %scSs|ddkS�Nrz
static methodrrCrrrr{vr|zReadonly properties %scSs|ddkS�NrrjrrCrrrr{xr|zData descriptors %scSs|ddkS�NrrirrCrrrr{zr|zData and other attributes %scSs|ddkS�NrrVrrCrrrr{|r|rz*<a name="%s">class <strong>%s</strong></a>z/<strong>%s</strong> = <a name="%s">class %s</a>�(%s)r4�()rz<tt>%s<br>&nbsp;</tt>z#000000z#ffc8d8r3)r&rDrrr�getmror!r^rr'rkr>rcr�popleftrQ�builtinsrr�r"�	signature�
ValueErrorrJr�rr3rr)r@rr)rQr,r-rR�realnamer;rr`�mrorLrkrnrpr�rJrqrgrK�anchor�	inherited�tagrr<�declr��argspecr#r)	r-r,rirjrQrr]r@rwrr��s�
�
	
�

�

�
�
�
�
�
�

��
zHTMLDoc.docclasscCs|�d|�|��S�N�=)rr�r�rrr�formatvalue�szHTMLDoc.formatvaluec	Cs�|j}|p|}|r|jpdd|}	d}
d}t|�r�|jj}|rZ||k	r�d|�||�}
n0|jdk	rzd|�|jj|�}
nd|�||�}
t�|�s�t�|�r�d}
nd}
||kr�d|	|f}nD|r�t�||g�|kr�d	|jd||f}d
}n|}d|	||f}d}t�	|��rlzt�
|�}Wnttfk
�r>d}YnX|�rlt
|�}|dk�rld
|}|d
d�}|�svd}|
||�|�|
�o�|�d|
�}|�r�d|S|�t|�|j|||�}|�o�d|}d||fSdS)Nrrtr� from � method of %s instance� unbound %s method�async z$<a name="%s"><strong>%s</strong></a>z<a href="#%s">%s</a>rz)<a name="%s"><strong>%s</strong></a> = %s�<lambda>z$<strong>%s</strong> <em>lambda</em> r��(...)z'<font face="helvetica, arial">%s</font>z<dl><dt>%s</dt></dl>
z<dd><tt>%s</tt></dd>z<dl><dt>%s</dt>%s</dl>
)r&rAr;rrr�iscoroutinefunction�isasyncgenfunction�getattr_staticr.r�r�rrJr�rr3rr)r@rr)rQr,r-rIrHr�r��note�skipdocs�imclass�asyncqualifierrZreallinkr�r�r�r#rrrr��s|
�
���

��zHTMLDoc.docroutinecCsNg}|j}|r|d|�|�t|�|j�}|r<|d|�|d�d�|�S)Nz!<dl><dt><strong>%s</strong></dt>
z<dd><tt>%s</tt></dd>
rar)rr3rrr"�r@rr)rQrHrpr]r#rrrr��szHTMLDoc.docdatacGs|rd|pd}||�|�S)Nz<strong>%s</strong> = r�r�)r@rr)rQrRZlhsrrrr��szHTMLDoc.docothercCs�g}|dkri}t�|g�D]<\}}}tdd�|D��r:q|�|d|||kf�d||<q|��|�||j�}|�|dd|�S)Ncss*|]"}dt|�kodknVqdS)i�i��N)�ord�rsZchrrr�	<genexpr>�sz HTMLDoc.index.<locals>.<genexpr>rrrArF)rNrO�anyrr�rr#r)r@rr!rWrXr)rYrrrr�index�s
z
HTMLDoc.index)r)rrNr)r�)N)NN)NNN)NN)N)r&r'rUr��_repr_instancer�r�rrrrrrrrrr r#r$r3r6r�r�r�r�r�r�r�r�rrrrr�sF

�

+

y&�
A

rc@s0eZdZdd�Zdd�Zdd�ZeZdd�Zd	S)
�TextReprcCs,t�|�d|_|_d|_d|_|_dSr�r�r�rrrr�
s
zTextRepr.__init__cCsTtt|�d�r@dd�t|�j���}t||�r@t||�||�Sttt|��|j	�Sr�)
rer�r"r&r r>r7r:r�r�r�rrrr�s

zTextRepr.repr1cCsHt||j�}t|�}d|krDdt|dd�krDd|d||dS|S)Nr�r�rr�r)r7r�r�r2r�rrrr�s
zTextRepr.repr_stringcCs4zttt|��|j�WSd|jjYSXdSr�)r7r:r�r�rr&rrrrr%szTextRepr.repr_instanceN)r&r'rUr�r�r�rrrrrrr�s
	r�c@szeZdZe�ZejZdd�Zddd�Zdd�Zdd
d�Z	ddd
�Z
ddd�Zdd�Zddd�Z
ddd�ZeZddd�ZdS)�TextDoccCsd�dd�|D��S)Nrcss|]}|d|VqdS)�Nrr�rrrr�5szTextDoc.bold.<locals>.<genexpr>)r"r�rrr�bold3szTextDoc.bold�    cs>|sdS�fdd�|�d�D�}|r4|d��|d<d�|�S)Nrcsg|]}�|�qSrr�rsr���prefixrrr�:sz"TextDoc.indent.<locals>.<listcomp>rr�)r rr")r@r1r�r$rr�r�indent7szTextDoc.indentcCs$|�|���}|�|�d|dS)Nrr)r�rr�)r@rrZclean_contentsrrrr>szTextDoc.sectionNrc
	s�d}|D]�}t|�td�krr|\}}||t|��}|rh||fkrh�fdd�|D�}	|dd�|	�}|d}qt|�tg�kr||�|�||d�}q|S)	Nrrc3s|]}t|��VqdSr+�r*)rsr:�r(rrr�Msz%TextDoc.formattree.<locals>.<genexpr>r�r4rr�)r�r*r"r6)
r@r7r(r8r�rr9r:r;r<rr�rr6Es"
�zTextDoc.formattreec	Cs$|j}tt|��\}}|�d||o(d|�}t|dd�}|�|�}|dk	r`||�d|d�}|rt||�d|�}g}	t�|tj�D]<\}
}|dk	s�t�	|�p�||kr�t
|
||�r�|	�|
|f�q�g}t�|tj�D]F\}
}|dk	�st�
|��st�	|�|kr�t
|
||�r�|�|
|f�q�g}
t�|t�D]&\}
}t
|
||��r.|
�|
|f��q.g}t�}t|d��r�t�|j�D]6\}}}|�|�|�r�|�|d�n
|�|��qx|��||�d	d
�|��}g}t�|tj�D]0\}
}|j�|d��r�|
|k�r�|�|
��q�|�r6|��||�dd
�|��}|	�r�d
d�|	D�}|�t�|d�|�g}|	D]\}
}|�|�||
|���qd||�dd
�|��}|�r�g}|D]\}
}|�|�||
|���q�||�dd
�|��}|
�r&g}|
D]"\}
}|�|j||
|dd���q�||�dd
�|��}t|d��r�t|j�}|dd�dk�rp|dd�dk�rp|dd���}||�d|�}t|d��r�||�dt|j ��}t|d��r�||�dt|j!��}t|d��r�||�d t|j"��}zt�#|�}Wnt$k
�rd!}YnX||�d"|�}|S)#N�NAME� - rGzMODULE REFERENCEa.

The following documentation is automatically generated from the Python
source files.  It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations.  When in doubt, consult the module reference at the
location listed above.
ZDESCRIPTIONrT�
 (package)zPACKAGE CONTENTSrrZ
SUBMODULEScSsg|]\}}|�qSrrrErrrr��sz%TextDoc.docmodule.<locals>.<listcomp>r�CLASSES�	FUNCTIONS�F)r6ZDATArZr>r?r�r@ZVERSIONrSZDATErYZAUTHORrWZCREDITSr�ZFILE)%r&r%rrr>r�rrCr-rLrhrr.r=r0�setrerNrOrT�addr�r"r,rcr6rPr�r�rJrZrrSrYrWr�r)r@rr)rQZsynop�descrrfr�r-rJrKr,rVrWZ
modpkgs_namesrXr(rYZ
submodulesrZrrUr�rrrr�Us�
	�
��
��
�
$
zTextDoc.docmodulec	sL�j}|p|}�j}�jfdd�}||kr:d��|�}n��|�d|}|rlt||�}	|dd�|	�}g}
|
j�zt���}Wnt	t
fk
r�d}YnX|r�t|�}|r�|dkrʈ||d�t��}
|
r�|
d�t
t����}t|�d	k�r*�d
�|D]}�d||���q
�d�td
d�t���D�tjd�}t|�}d}|�r��d�|d|�D]}�d|��qn||k�r��dt||�d��d�G�fdd�d�}|�������fdd�}����fdd�}�����fdd�}�fdd�t��D�}|�r|�r*|���n|dd	�t|�fdd ��\}}�tjk	�rn�tjk�rn|}�qn ��k�r~d!}nd"t��j�}t|��|d#||d$d ��}|d%||d&d ��}|d'||d(d ��}|d)||d*d ��}|d+||d,d ��}|d-||d.d ��}|}�qd�|
�}
|
�s0|dS|d��|
��d/�dS)0NcSs
t||�Sr+r�)r:r�rrr�makename�sz"TextDoc.docclass.<locals>.makename�class z	 = class r�r4r�rrzMethod resolution order:r�rcss.|]&}|j�d�s|jdkrt|j�VqdS)rar�N)r&rcr'rJ)rsrrrrrr��s
�z#TextDoc.docclass.<locals>.<genexpr>r}r�zBuilt-in subclasses:z    ... and z other subclassescs eZdZdd�Z�fdd�ZdS)z(TextDoc.docclass.<locals>.HorizontalRulecSs
d|_dSrwr[r�rrrr��sz1TextDoc.docclass.<locals>.HorizontalRule.__init__cs|jr�d�d|_dS)NzF----------------------------------------------------------------------rr[r�r\rrr^�sz.TextDoc.docclass.<locals>.HorizontalRule.maybeNr_rr\rrr`�sr`c
s�t||�\}}|r~����|�|D]V\}}}}zt�|�}Wn&tk
rf���||���Yq&X���||����q&|Sr+rbrd�rirQrr]r@rrrk�s�zTextDoc.docclass.<locals>.spillcsJt||�\}}|rF����|�|D]\}}}}���||���q&|Sr+rlrdrmrrrnsz*TextDoc.docclass.<locals>.spilldescriptorsc
	s�t||�\}}|r�����|�|D]v\}}}}t|�sDt�|�rNt|�}nd}zt�|�}	Wntk
r~|j|}	YnX��j	|	|�d|d�d�q&|S)Nr�)r6r#r)
rQr^rorrlrr>r��__dict__r�)
rer�rOrfr)rqrgrKr#rgr�rrrps 
�z#TextDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qSrqrrrsr/rrr�+s
�z$TextDoc.docclass.<locals>.<listcomp>rcs|d�kSrurrCrvrrr{4r|z"TextDoc.docclass.<locals>.<lambda>rxryzMethods %s:
cSs|ddkSrzrrCrrrr{Cr|zClass methods %s:
cSs|ddkSr|rrCrrrr{Er|zStatic methods %s:
cSs|ddkSr}rrCrrrr{Gr|zReadonly properties %s:
cSs|ddkSr~rrCrrrr{Ir|zData descriptors %s:
cSs|ddkSrrrCrrrr{Kr|zData and other attributes %s:
cSs|ddkSr�rrCrrrr{Mr|z |  )r&rDr'r��mapr"rrr�r�rrJrrr�r!�sortedr��__subclasses__r�rkr�rQr�rr*r�r�r)r@rr)rQrRr�r;r�rr<rr�r�r#r�rLZ
subclassesZno_of_subclassesZMAX_SUBCLASSES_TO_DISPLAYZsubclassnamer`rkrnrpr�r�r�r)rirQrr]r@rwrr��s�

�

��	
�

�

�
�
�
�
�
�
zTextDoc.docclasscCsd|�|�Sr�r�r�rrrr�WszTextDoc.formatvaluec	Cs�|j}|p|}d}d}t|�rn|jj}|rB||k	rndt||�}n,|jdk	r`dt|jj|�}ndt||�}t�|�s�t�|�r�d}	nd}	||kr�|�|�}
n,|r�t�	||g�|kr�d}|�|�d|}
d}t�
|��r<zt�|�}Wntt
fk
�rd}YnX|�r<t|�}|d	k�r<|�|�d
}
|dd�}|�sFd}|	|
||}
|�rd|
d
St|��ppd}|
d
|�o�|�|���d
SdS)Nrrr�r�r�r�r� = r�z lambda r�r�r)r&rAr;rr*rr�r�r�r�r.r�r�rrJrr�r)r@rr)rQrHr�r�r�r�r�rr�r�r�r#rrrr�[sV
�
�

zTextDoc.docroutinecCsTg}|j}|r$||�|��|d�t|�p.d}|rJ||�|��|d�d�|�S)Nrr)rr�rr�r"r�rrrr��szTextDoc.docdatac
Cs�|�|�}|rF|r|dpd|}|t|�}	|	dkrF|d|	�d}|rX|�|�dpZd|}|dk	r~|d|�t|��7}|S)Nr�rrr4r)r�r!r�r�rJ)
r@rr)rQr8r6r#r�r�Zchoprrrr��s
zTextDoc.docother)r�)Nr)NN)NN)NNN)NNN)NNNNN)r&r'rUr�r�r�r�r�rr6r�r�r�r�r�r�r�rrrrr�+s


e

7
r�c@seZdZdd�ZdS)�
_PlainTextDoccCs|Sr+rr�rrrr��sz_PlainTextDoc.boldN)r&r'rUr�rrrrr��sr�cCst�at|�dSr+)�getpager�pagerr9rrrr��sr�c	s@ttjd�stSttjd�s tStj��r4tj��s8tStj�d�pNtj�d���r�tj	dkrj�fdd�Stj�d�dkr��fd	d�S�fd
d�Stj�d�dkr�tStj	dkr�dd�Sttd�r�t�
d
�dkr�dd�Sddl}|��\}}t�
|�z8ttd��r$t�
d|�dk�r$dd�W�StW�SW5t�|�XdS)N�isattyZMANPAGERZPAGER�win32cstt|���Sr+��
tempfilepager�plainr9�Z	use_pagerrrr{�r|zgetpager.<locals>.<lambda>ZTERM)ZdumbZemacscstt|���Sr+)�	pipepagerr�r9r�rrr{�r|cs
t|��Sr+�r�r9r�rrr{�r|cSstt|�d�S)Nzmore <r�r9rrrr{�r|�systemz(less) 2>/dev/nullrcSs
t|d�S)NZlessr�r9rrrr{�r|z	more "%s"cSs
t|d�S)NZmorer�r9rrrr{�r|)rer�stdin�
plainpager�stdoutr�r
r�rx�platformr��tempfileZmkstemp�close�unlink�ttypager)r��fdr�rr�rr��s6


 r�cCst�dd|�S)Nz.r)rrr9rrrr��sr�c	Cs�ddl}|j|d|jd�}zDtj|jdd��*}z|�|�Wntk
rPYnXW5QRXWntk
rrYnXz|�	�Wq�Wqttk
r�YqtXqtdS)NrT)�shellr��backslashreplace)�errors)
�
subprocess�Popen�PIPE�io�
TextIOWrapperr��write�KeyboardInterruptr��wait)r1�cmdr��proc�piperrrr��sr�c
Cs~ddl}|���d}tj�|d�}t|ddtjdkr<t�d�ndd��}|�	|�W5QRXt�
|d|d�W5QRXdS)	Nrz	pydoc.out�wr�r�)r��encodingz "r%)r�ZTemporaryDirectoryr
r	r"r�rr��device_encodingr�r�)r1r�r�Ztempdirr�r�rrrr��s
��r�cCs$ttjdd�pd}|�|d��|�S)Nr��utf-8r�)r>rr��encode�decode)r1r�rrr�_escape_stdoutsr�c
Cs�tt|���d�}z2ddl}tj��}|�|�}|�|�dd�}Wn(t	t
tjfk
rld}dd�}YnX�z0zttj�dd��}Wntk
r�d}YnX|dkr�d}|d}}tj�d�|d|��d�||d��r�tj�d	�tj��|�}	|	d
k�rtj�d��q�n,|	dk�rJtj�d||d�|d}q�|	d
k�rn|||}|dk�rnd}tj�dd�||||��d�||}q�W5|�r�|�
||j|�XdS)NrrcSstj�d�SrB)rr�r�rrrrr{r|zttypager.<locals>.<lambda>cSstj��dd�dd�S)Nr�r)rr�r�rrrrr{r|ZLINESr�z
-- more --)�q�Qz
          
)�
r)�b�B�)r�r�r �ttyrr��filenoZ	tcgetattrZ	setcbreakr�r�r��UnsupportedOperationZ	tcsetattrZ	TCSAFLUSHr+r
r�rxr�r�r�r"�flush)
r1r$r�r��oldZgetchar�hr�Zincr:rrrr�	sL








&r�cCstj�tt|���dSr+)rr�r�r�r�r9rrrr�5sr�cCs�t�|�r>|jtjkr d|jSt|d�r4d|jSd|jSt�|�rRd|jSt�|�rtd|jj	|jj|jfSt�
|�r�d|jj	|jj|jfSt�|�r�d|jSt�|�r�d	|jSt�
|�r�d
|jSt|�jS)Nzbuilt-in module rTzpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%sr�z	function zmethod )rr,r&rr�rer=Zisgetsetdescriptor�__objclass__r'Zismemberdescriptorr-rMr<r�)�thingrrr�describe9s6







�
�





r�c	Cs�dd�|�d�D�}d\}}|t|�kr\td�|d|d��|�}|r\||d}}qq\q|rf|}nt}||d�D],}zt||�}Wqvtk
r�YdSXqv|S)NcSsg|]}|r|�qSrr)rsr�rrrr�Vszlocate.<locals>.<listcomp>rrwr)r r!r�r"r�r>r�)r	r�rSr��nZ
nextmodulerr�rrr�locateTs r�cCsVt|t�r0t||�}|dkr(td|��||fSt|dd�}|t|t�rL|ndfSdS)Nz~No Python documentation found for %r.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.r&)rmrJr�r�r>)r�r�rr)rrr�resolvems

�r�� Python Library Documentation: %scCs�|dkrt}t||�\}}t|�}t�|�}|rTd|krT|d|d|�d��7}n|rn||k	rn|d|j7}t�|�s�t�|�s�t�	|�s�t�
|�s�t|�}|d7}||d|�||�S)Nrz in z in module z objectr)
r1r�r�rrL�rfindr&r,r-r.rlr�r�)r�rr�Zrendererrr)r�r�rrr�
render_doc{s&

���rc
Csfz2|dkrtt|||��n|�t|||t��Wn.ttfk
r`}zt|�W5d}~XYnXdSr+)r�rr��	plaintextr�r��print)r�rr��outputrKrrrr#�sr#c
Cs�z`t||�\}}t�t|�t�||��}t|dddd��}|�|�W5QRXtd|d�Wn.tt	fk
r�}zt|�W5d}~XYnXdS)Nr�r�r�)r�Zwrote)
r��htmlrr�r�r�r�rr�r�)r�r�rr)rr�rKrrr�writedoc�srrcCs2|dkri}t�|g|�D]\}}}t|�qdSr+)rN�
walk_packagesr)r�pkgpathZdonerXr(rYrrr�	writedocs�s

r
cJ@s"eZdZddddddddddd	d
ddd
ddddddddddddddddddddd�#Zd d!�d"D�Zd�e�d'd(d)d*d+d,d-�Zd.d/d0d1d2d3d4d5d6d7d8d9d9d:d:d;�Ze��D]:\ZZ	e	D],Z
e�e
e�Zeekr�ed<eZeee
<q�q�d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdLdMdNdOdPdQddRdSdSdTdUdVdWdXdYdZd[d\d]d^d_d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{ddd|d}d~dd��IZd�d�d��Z
ed�d���Zed�d���Zd�d��Ze�Zefd�d��Zd�d��Zd�d��Zd�d��Zd�d��Zd�d�d��Zd�d��Zd�d��Zd�d��Zd�d�d��Zd�d�d��Zd�d��Zd�d�d��Z d�S)��Helperr�BOOLEAN�with)�assertr)�asyncr)�awaitr)�break�	while for)�classzCLASSES SPECIALMETHODS)�continuer)Zfunctionr)�del�BASICMETHODS�if)�elser�try)�forzbreak continue while�import)�globalznonlocal NAMESPACES)r�
TRUTHVALUE)r�MODULES)�in�SEQUENCEMETHODS�
COMPARISON)�lambdar�)�nonlocalzglobal NAMESPACES)�passr)�raise�
EXCEPTIONS)�returnr�)rr&)�whilezbreak continue if TRUTHVALUE)r
z CONTEXTMANAGERS EXCEPTIONS yield)�yieldr)#�False�None�True�and�asrrrrrr�defr�elifr�except�finallyr�fromrrrr�isr"r#�not�orr$r%r'rr(r
r)cCsg|]}dD]}||�qqS)��'r%r)rs�pr�rrrr��szHelper.<listcomp>)r��fr��ur8�'''r%r�)�+rt�*�**r�z//�%�<<�>>r��|�^�~r�r��<=�>=�==�!=�<>)r�r�rFrGrHrIrJ)rtrE)z+=z-=z*=z/=z%=z&=z|=z^=z<<=z>>=z**=z//=)rArBr�rCrDrE)�j�J)�STRINGS�	OPERATORSr!�UNARY�AUGMENTEDASSIGNMENT�BITWISE�COMPLEXzOPERATORS FORMATTING�POWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTS�ELLIPSISzSLICINGS DICTIONARYLITERALSz	def classrM�PRIVATENAMESzPRIVATENAMES SPECIALMETHODSZ
BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)r@r?�,rr4�:�@r�rar`�`r&r5�[�]r�)�typeszRSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect)�stringsz4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES)zstring-methodszSTRINGS FORMATTING)Z
formatstringsrN)r]z:encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPES)ZnumberszINTEGER FLOAT COMPLEX TYPES)Zintegersz	int range)Zfloatingz
float math)Z	imaginaryz
complex cmath)Ztypesseqz$STRINGMETHODS FORMATTING range LISTS�DICTIONARIES)Ztypesfunctionsz	def TYPES)Ztypesmethodszclass def CLASSES TYPES)zbltin-code-objectszcompile FUNCTIONS TYPES)zbltin-type-objectsztypes TYPES�TYPES)zbltin-null-objectr)zbltin-ellipsis-object�SLICINGS)Zspecialattrsr)r\z!class SPECIALMETHODS PRIVATENAMES)Ztypesmodulesr)zoperator-summaryz�lambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIES�EXPRESSIONS)Zobjectsr_)ZspecialnameszbBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES)Z
customizationzhash repr str SPECIALMETHODS)zattribute-accesszATTRIBUTES SPECIALMETHODS)zcallable-typeszCALLS SPECIALMETHODS)�sequence-typesz(SEQUENCES SEQUENCEMETHODS SPECIALMETHODS)rbzMAPPINGS SPECIALMETHODS)z
numeric-typesz*NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS)Z	execmodelz%NAMESPACES DYNAMICFEATURES EXCEPTIONS)Znamingz3global nonlocal ASSIGNMENT DELETION DYNAMICFEATURES)zdynamic-featuresr�
NAMESPACES)r�ztry except finally raise)Zconversionsr)Zidentifierszkeywords SPECIALIDENTIFIERS)z
id-classesr)zatom-identifiersr)z
atom-literalsz=STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS�	SEQUENCES)Z	exprlistszTUPLES LITERALS)ztypesseq-mutable�LISTLITERALS)ZlistszLISTS LITERALS)Ztypesmapping�DICTIONARYLITERALS)rzDICTIONARIES LITERALS)zattribute-referencesz(getattr hasattr setattr ATTRIBUTEMETHODS)Z
subscriptionsr )Zslicingsr )Zcallsra)Zpowerra)Zunaryra)Zbinaryra)Zshiftingra)Zbitwisera)ZcomparisonszEXPRESSIONS BASICMETHODS)ZbooleanszEXPRESSIONS TRUTHVALUEr)Z
assignmentrP)Z	augassign�
NUMBERMETHODSrr')Zcompoundzfor while break continue)�truthz if while and or not BASICMETHODS)ZdebuggerZpdb)zcontext-managersr
)Ir_rMZ
STRINGMETHODSZ
FORMATTING�UNICODEZNUMBERSZINTEGERZFLOATrRrdZMAPPINGSr�ZMETHODSZCODEOBJECTSZTYPEOBJECTSZFRAMEOBJECTSZ
TRACEBACKSZNONErTZSPECIALATTRIBUTESr�rZPACKAGESrarNZ
PRECEDENCEZOBJECTSZSPECIALMETHODSrZATTRIBUTEMETHODSZCALLABLEMETHODSr ZMAPPINGMETHODSrgZ	EXECUTIONrcZDYNAMICFEATURESZSCOPINGZFRAMESr&ZCONVERSIONSZIDENTIFIERSZSPECIALIDENTIFIERSrUZLITERALSZTUPLESZ
TUPLELITERALSZLISTSrer^rfZ
ATTRIBUTESZ
SUBSCRIPTSr`ZCALLSrSrOZBINARYZSHIFTINGrQr!rZ	ASSERTIONZ
ASSIGNMENTrPZDELETIONZ	RETURNINGZ	IMPORTINGZCONDITIONALZLOOPINGrZ	DEBUGGINGZCONTEXTMANAGERSNcCs||_||_dSr+)�_input�_output)r@�inputrrrrr�^szHelper.__init__cCs|jp
tjSr+)rjrr�r�rrrrlbszHelper.inputcCs|jp
tjSr+)rkrr�r�rrrrfsz
Helper.outputcCs2t��dddkr|�dSd|jj|jjfS)Nrr3�?rz<%s.%s instance>)r�stackrr'rUr�rrr�__repr__js�zHelper.__repr__cCs6||jk	r|�|�n|��|��|j�d�dS)Na
You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type "help(object)".  Executing "help('string')"
has the same effect as typing a particular string at the help> prompt.
)�_GoInteractiver�intro�interactrr��r@Zrequestrrr�__call__rs

zHelper.__call__c	Cs�|j�d�z|�d�}|s Wq�Wnttfk
r>Yq�YnX|��}t|�dkr�|d|dkrpdkr�nn |d|dd�kr�|dd�}|��dkr�q�|d	kr�|��q|�	|�qdS)
Nrzhelp> rrr�r7r)r��quitr)
rr��getliner��EOFErrorrr!r�rqrrsrrrrrs"

,�
zHelper.interactcCs8|jtjkrt|�S|j�|�|j��|j��SdSr+)rlrr�rr�r�r�)r@�promptrrrrv�s

zHelper.getlinecCs<t|�td�k�r|��}|dkr,|��n�|dkr>|��n�|dkrP|��n�|dkrb|��n�|dd�dkr�|�|��d�n�||jkr�|�|�nj|d	kr�t	t
|�d
�nR||jkr�|�|�n<||j
kr�|�|�n&|r�t	|d
|jd�nt	td
|jd�n$t|t��r|�nt	|d
|jd�|j�d�dS)
Nr�keywords�symbols�topicsr��zmodules r)r,r*r+zHelp on %s:)rr)r�r�listkeywords�listsymbols�
listtopics�listmodulesr rz�
showsymbolr#�evalry�	showtopicr{rkrJrmrrr�rsrrrr�s6






zHelper.helpcCs$|j�d�dtjdd���dS)Na�
Welcome to Python {0}'s help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/{0}/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".
z%d.%dr)rr�rrr�r�rrrrq�s
�zHelper.intror��Pc	
Cs�tt|��}||}t|�|d|}t|�D]v}t|�D]\}|||}|t|�kr<|j�||�||dkr<|j�dd|dt||��q<|j�d�q0dS)Nrr�r)rr�r!rrr�)	r@�items�columnsr
Zcolwr�rowrrtrrrr�s&zHelper.listcCs |j�d�|�|j���dS)NzN
Here is a list of the Python keywords.  Enter any keyword to get more help.

)rr�rryrGr�rrrr}�szHelper.listkeywordscCs |j�d�|�|j���dS)Nzx
Here is a list of the punctuation symbols which Python assigns special meaning
to. Enter any symbol to get more help.

)rr�rrzrGr�rrrr~�szHelper.listsymbolscCs |j�d�|�|j���dS)NzN
Here is a list of available topics.  Enter any topic name to get more help.

)rr�rr{rGr�rrrr�szHelper.listtopicscCs0zddl}Wn"tk
r.|j�d�YdSX|j�||j�|��}|sb|j�dt|��dSt|�td�kr~|�	||�S|\}}z|jj|}Wn*t
k
r�|j�dt|��YdSX|��d}|r�|p�dd|}|�r$ddl}dd�
|���d}	|�|	d	�}
|d
d�
|
�7}t|�dS)Nr�t
Sorry, topic and keyword documentation is not available because the
module "pydoc_data.topics" could not be found.
zno documentation found for %s
rrr��Related help topics: r4�Hz
%s
)�pydoc_data.topicsr�rr�r{rxryr�r�r��KeyErrorr�textwrapr"r Zwrapr�)r@�topic�
more_xrefs�
pydoc_data�target�label�xrefsr#r�r1Zwrapped_textrrrr��s4zHelper.showtopiccCs�zddl}Wntk
r"YdSX|j�||j�|��}|sFtd��t|t�r\|�||�S|\}}|jj|}|r�|pzdd|}||fS)Nr)r�rzcould not find topicrr�)	r�r�r{rxryr�rmrJ�	_gettopic)r@r�r�r�r�r�r�r#rrrr�s	
zHelper._gettopiccCs*|j|}|�d�\}}}|�||�dS)Nr�)rz�	partitionr�)r@�symbolr�r�rar�rrrr�!s
zHelper.showsymbolcsv|r |j�d�|��t|�nR|j�d�i}|fdd���fdd�}t�j�|d�|�|���|j�d�dS)	Nzy
Here is a list of modules whose name or summary contains '{}'.
If there are any, enter a module name to get more help.

zI
Please wait a moment while I gather a list of all available modules...

cSs>|r$|dd�dkr$|dd�d}|�d�dkr:d||<dS)N����	.__init__r�rrr)�find)r	r(r�r�rrr�callback4sz$Helper.listmodules.<locals>.callbackcs�d|d�dSr+rr��r�rr�onerror9sz#Helper.listmodules.<locals>.onerror�r�z�
Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".
)rr�r�apropos�
ModuleScanner�runrrG)r@rJr�r�rr�rr�&s
�
zHelper.listmodules)r8r<r%r�)NN)r�r�)r)r)r)!r&r'rUryZ_strprefixesZ_symbols_inverserzr�r�Zsymbols_r�rxr{r�rnrlrrorrprtrrrvrrqrr}r~rr�r�r�r�rrrrr�sB�'���W



	


 
rc@seZdZddd�ZdS)r�Nc	Cs
|r|��}d|_i}tjD]p}|dkrd||<|dkrF|d|d�qt|�jpRd}|�d�d}|d|}|���|�dkr|d||�qtj	|d�D�]\\}	}}
|jr��q�|dkr�|d|d�q�zt�
|	|�}Wntk
r�Yq�YnX|j}t
|d	��rnz|�|�}
Wn(tk
�r:|�r2||�Yq�YnXtt�|
���pNd}t
|d
��rh|�|�}nd}n`ztj�|�}Wn(tk
�r�|�r�||�Yq�YnX|j�r�|j��dnd}t|dd�}|d|}|���|�dkr�||||�q�|�r|�dS)NF�__main__rrrrr�r��
get_source�get_filenamer[)r�rurr�r�rXr r�rNr�	_get_specr�r�rer�rcr�r��StringIOr�r�r�r�r�r�r>)r@r�rJZ	completerr��seenr(r)r�rXrYr�r��sourcer	r�rrrr�Gs`



zModuleScanner.run)NNN)r&r'rUr�rrrrr�Dsr�c	CsDdd�}dd�}t���"t�d�t�j|||d�W5QRXdS)NcSs6|dd�dkr |dd�d}t||o.d|�dS�Nr�r�r�z- )r�r	r(r�rrrr��szapropos.<locals>.callbackcSsdSr+rr�rrrr��szapropos.<locals>.onerror�ignorer�)�warnings�catch_warnings�filterwarningsr�r�)rJr�r�rrrr��s


r�cs�ddl�ddl�ddl�ddl�Gdd�d�jj��G�fdd�d�jj��G�����fdd�d�j�}||||�}|��|j	s�|j
s�t�d�q~|S)	Nrc@seZdZdd�Zdd�ZdS)z!_start_server.<locals>.DocHandlercSsX|j�d�rd}nd}|�d�|�dd|�|��|j�|�|j|��d��dS)Nz.css�text/css�	text/html��zContent-Typez%s; charset=UTF-8r�)	r	rdZ
send_responseZsend_headerZend_headersZwfiler��
urlhandlerr�)r@�content_typerrr�do_GET�s

��z(_start_server.<locals>.DocHandler.do_GETcWsdSr+r)r@r�rrr�log_message�sz-_start_server.<locals>.DocHandler.log_messageN)r&r'rUr�r�rrrr�
DocHandler�sr�cs(eZdZdd�Z�fdd�Zdd�ZdS)z _start_server.<locals>.DocServercSs6||_|j|f|_||_|j�||j|j�d|_dS�NF)�hostZaddressr�rLr��handlerru)r@r��portr�rrrr��s
z)_start_server.<locals>.DocServer.__init__cs>|js2��|j��gggd�\}}}|r|��q|��dSrB)ru�selectZsocketr�Zhandle_requestZserver_close)r@ZrdZwrZex�r�rr�serve_until_quit�s

z1_start_server.<locals>.DocServer.serve_until_quitcSs |j�|�|jr|�|�dSr+)rL�server_activater�r�rrrr��sz0_start_server.<locals>.DocServer.server_activateN)r&r'rUr�r�r�rr�rr�	DocServer�sr�cs:eZdZ�fdd�Z����fdd�Zdd�Zdd�Zd	S)
z#_start_server.<locals>.ServerThreadcs2||_||_t|�|_�j�|�d|_d|_dSr�)r�r�r+r��Threadr��serving�error)r@r�r�r�)�	threadingrrr��s
z,_start_server.<locals>.ServerThread.__init__c
sxzJ�jj�_��_�jj�_t|j��_�|j	|j
|j�}||_|�
�Wn(tk
rr}z
||_W5d}~XYnXdSr+)�server�
HTTPServerrLr�r�ZMessageZMessageClass�staticmethodr�r�r��ready�	docserverr�rcr�)r@Zdocsvr�e)r�r��email�httprrr�	s

z'_start_server.<locals>.ServerThread.runcSs,d|_|j|_|j|_d|j|jf|_dS)NTz
http://%s:%d/)r�r�Zserver_portr�r")r@r�rrrr�	sz)_start_server.<locals>.ServerThread.readycSs&d|j_|��d|_d|_d|_dS)NTF)r�rur"r�r"r�rrr�stop	s
z(_start_server.<locals>.ServerThread.stopN)r&r'rUr�r�r�r�r)r�r�r�r�r�rr�ServerThread�s
r�g{�G�z�?)
Zhttp.serverZ
email.messager�r�r�ZBaseHTTPRequestHandlerr�r�r1r�r��time�sleep)r��hostnamer�r��threadr)r�r�r�r�r�r�r�
_start_server�s8'r�r�c
s(G�fdd�dt�}|���fdd���fdd���fdd���fd	d
���fdd���fd
d���fdd���fdd����������fdd�}|�d�r�|dd�}|dk�rtj�tj�t��}tj�||�}t|��}d�|�	��W5QR�SQRXn|dk�r||�St
d||f��dS)NcseZdZ�fdd�ZdS)z_url_handler.<locals>._HTMLDoccsd}d|}d||��|fS)Nzpydoc_data/_pydoc.cssz1<link rel="stylesheet" type="text/css" href="%s">a<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Pydoc: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
%s</head><body bgcolor="#f0f0f8">%s<div style="clear:both;padding-top:.5em;">%s</div>
</body></html>r)r@rr�css_pathZcss_link��html_navbarrrr2	s���z#_url_handler.<locals>._HTMLDoc.pageN)r&r'rUrrr�rr�_HTMLDoc0	sr�cs>��dt��t��dt��f�}d|��tjdd��fS)Nz%s [%s, %s]raZ
            <div style='float:left'>
                Python %s<br>%s
            </div>
            <div style='float:right'>
                <div style='text-align:center'>
                  <a href="index.html">Module Index</a>
                  : <a href="topics.html">Topics</a>
                  : <a href="keywords.html">Keywords</a>
                </div>
                <div>
                    <form action="get" style='display:inline;'>
                      <input type=text name=key size=15>
                      <input type=submit value="Get">
                    </form>&nbsp;
                    <form action="search" style='display:inline;'>
                      <input type=text name=key size=15>
                      <input type=submit value="Search">
                    </form>
                </div>
            </div>
            T)Zterse)r�r�Zpython_versionZpython_buildZpython_compiler)rU�rrrr�B	s
��z!_url_handler.<locals>.html_navbarcs�dd�}��ddd�}dd�tjD�}��||�}|d��d	dd
|�g}i}tjD]}|���||��qT|�d�dd
�|�fS)NcSsd||fSrr�r)rrr�	bltinlink`	sz3_url_handler.<locals>.html_index.<locals>.bltinlinkz7<big><big><strong>Index of Modules</strong></big></big>rArBcSsg|]}|dkr|�qS)r�r)rsr)rrrr�f	s�z4_url_handler.<locals>.html_index.<locals>.<listcomp>z<p>zBuilt-in ModulesrFz|<p align=right><font color="#909090" face="helvetica,arial"><strong>pydoc</strong> by Ka-Ping Yee&lt;ping@lfw.org&gt;</font>zIndex of Modulesr)	rrr�rrr	rr�r")r�r�namesrr�rr�rr�
html_index]	s*��
�z _url_handler.<locals>.html_indexc		s�g��fdd�}t���*t�d�dd�}t�j|||d�W5QRXdd�}g}��d	d
d�}�D]\}}|�||�|�qf|��d|d
d
d�|��}d|fS)Ncs:|dd�dkr |dd�d}��||o0d|f�dSr�rMr��Z
search_resultrrr�{	sz3_url_handler.<locals>.html_search.<locals>.callbackr�cSsdSr+rr�rrrr��	sz2_url_handler.<locals>.html_search.<locals>.onerrorr�cSsd||fSrrr�rrrr��	sz4_url_handler.<locals>.html_search.<locals>.bltinlinkz5<big><big><strong>Search Results</strong></big></big>rArBzkey = %srF�<br>zSearch Results)	r�r�r�r�r�rrrr")	rJr�r�r�rprr)r�rr�r�r�html_searchv	s,

��z!_url_handler.<locals>.html_searchcsLdd�}��ddd�}ttj���}��||�}|��ddd|�}d|fS)NcSsd||fS�Nz<a href="topic?key=%s">%s</a>rr�rrrr��	sz4_url_handler.<locals>.html_topics.<locals>.bltinlink�,<big><big><strong>INDEX</strong></big></big>rArBZTopicsrF)rr�rr{rGrr)r�rr�rr�rr�html_topics�	s��z!_url_handler.<locals>.html_topicscsL��ddd�}ttj���}dd�}��||�}|��ddd|�}d|fS)Nr�rArBcSsd||fSr�rr�rrrr��	sz6_url_handler.<locals>.html_keywords.<locals>.bltinlinkZKeywordsrF)rr�rryrGrr)rr�r�rr�rr�
html_keywords�	s��z#_url_handler.<locals>.html_keywordscs�t��}t||�}|�|�\}}||jkr0d}nd}��d|dd�}d��|�}��|dd|�}|r�t|�	��}dd	�}��
||�}��d
dd|�}d||fd�|||f�fS)
NZKEYWORDZTOPICr=rArBz
<pre>%s</pre>rFcSsd||fSr�rr�rrrr��	sz7_url_handler.<locals>.html_topicpage.<locals>.bltinlinkr�z%s %sr)
r�r�rr�ryrr3rr�r rrr")r�ZbufZhtmlhelprr�rrr�r�rr�html_topicpage�	s2

��
�z$_url_handler.<locals>.html_topicpagecs@t|dd�}|dkr$|dkr$td��t|�}��||�}||fS)Nr)r�r+zcould not find object)r�r�r�r�)r"rgr�contentr�rr�html_getobj�	sz!_url_handler.<locals>.html_getobjcsP��ddd�}d��fdd�tt|�|�D��}|��|dd|�}d||fS)	Nz,<big><big><strong>Error</strong></big></big>rArBr�c3s|]}��|�VqdSr+)r�r�r�rrr��	sz3_url_handler.<locals>.html_error.<locals>.<genexpr>z#bb0000z
Error - %s)rr"rr�r)r"r�rrr�rr�
html_error�	s���z _url_handler.<locals>.html_errorc
sr|}|�d�r|dd�}�z|dkr2��\}}n�|dkrF��\}}n�|dkrZ��\}}n�d|k�r$|�d�\}}}|dkr��|�\}}n�|dkr�z�|�\}}Wn tk
r��|�\}}YnXn\|d	k�r|dkr��\}}n4z�|�\}}Wn"tk
�r�|�\}}YnXntd
��n�|�\}}Wn2tk
�rd}z�||�\}}W5d}~XYnX��||�S)Nr����)rr�r{ryr�z
search?keyz	topic?keyzget?keyz
bad pydoc url)rdr�r�rcr)r"Zcomplete_urlrr��oprar�)rr�r�r�r�r�r�r�rr�
get_html_page�	s>



 z#_url_handler.<locals>.get_html_pager�rr�rr�z"unknown content type %r for url %s)rrcr
r	�dirname�realpathr[r"r��	readlinesr)r"r�r�r�Z	path_herer��fpr)	rr�r�r�r�r�r�r�r�r�_url_handler'	s*	
(


"
r�T�	localhost)�open_browserr�c	Cs�ddl}tt||�}|jr(t|j�dS|jr�d}|rB|�|j�z~zZtd|j�t|�|jr�t	d�}|�
�}|dkr|q�qZ|dkr�|�|j�qZt|�qZWnttfk
r�t�YnXW5|jr�|��td�XdS)Nrz"Server commands: [b]rowser, [q]uitzServer stoppedzServer ready atzserver> r�r�)
�
webbrowserr�r�r�rr�r�r"r�rlr�r�rw)r�r�r�r�ZserverthreadZserver_help_msgr�rrr�browse
s2
r�cCst|t�o|�tj�dkSrw)rmrJr�r
�sep)rPrrr�ispath9
sr�cCsvd|kstj|kst��|kr"dStj�t�}tj�|�}|��}||krbtj�||�sb|�|�|�	dt���|S)Nrr)
r
�curdir�getcwdr	r�r[�copy�samefile�remove�insert)Z
given_pathZargv0Z
stdlib_dirZ
script_dir�revised_pathrrr�_get_revised_path<
s

r�cCs,ttjtjd�}|dk	r(|tjdd�<dSrw)r�rr	�argv)r�rrr�_adjust_cli_sys_pathX
sr�cCs�ddl}Gdd�dt�}t��zv|�tjdd�d�\}}d}d}d}d}d}|D]\\}	}
|	dkrld	}d	}|	d
kr�t|
�WdS|	dkr�d	}|
}|	dkr�d	}|	d
krTd	}|
}qT|r�t|||d�WdS|s�|�|D]�}t|��rtj	�
|��std|��q�z`t|��r&tj	�|��r&t
|�}|�rXt|��rNtj	�|��rNt|�nt|�n
t�|�Wq�tk
�r�}zt|�W5d}~XYq�Xq�WnN|j|fk
�r�tj	�tj	�tjd��d}
tdj|
tjd��YnXdS)Nrc@seZdZdS)zcli.<locals>.BadUsageN)r&r'rUrrrr�BadUsagee
sr�rzbk:n:p:wFr�z-bTz-kz-pz-wz-n)r�r�zfile %r does not exista�pydoc - the Python documentation tool

{cmd} <name> ...
    Show text documentation on something.  <name> may be the name of a
    Python keyword, topic, function, module, or package, or a dotted
    reference to a class or function within a module or module in a
    package.  If <name> contains a '{sep}', it is used as the path to a
    Python source file to document. If name is 'keywords', 'topics',
    or 'modules', a listing of these things is displayed.

{cmd} -k <keyword>
    Search for a keyword in the synopsis lines of all available modules.

{cmd} -n <hostname>
    Start an HTTP server with the given hostname (default: localhost).

{cmd} -p <port>
    Start an HTTP server on the given port on the local machine.  Port
    number 0 can be used to get an arbitrary unused port.

{cmd} -b
    Start an HTTP server on an arbitrary unused port and open a Web browser
    to interactively browse documentation.  This option can be used in
    combination with -n and/or -p.

{cmd} -w <name> ...
    Write out the HTML documentation for a module to a file in the current
    directory.  If <name> contains a '{sep}', it is treated as a filename; if
    it names a directory, documentation is written for all the contents.
)r�r�)�getoptrcr�rr�r�r�r�r
r	�existsrr�r�r
r
rrr�r�r�r�rr�)r�r�Zoptsr�ZwritingZstart_serverr�r�r��opt�val�argrKr�rrr�clib
sd

 �rr�)NN)r)r)rrN)rrN)r)rN)r�)r)YrGrYrSrWr�Zimportlib._bootstrapr�Zimportlib._bootstrap_external�importlib.machinery�importlib.utilrr�r
rNr�rrr�r�r�Zurllib.parserHr��collectionsr�reprlibr�	tracebackrrrr%r*r0r2r7r'�
IGNORECASEr8r:rArFrQrhrkr�r�r�r�rcr�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r1rrr�rr#rr
rrr�r�r�r�r�r�r�r�rr&rrrr�<module>'s�
	


'
0:*> ",

�
�


=
n%
U
numbers.cpython-38.opt-1.pyc000064400000027654150335716500011631 0ustar00U

e5d(�@s�dZddlmZmZdddddgZGdd�ded	�ZGd
d�de�Ze�e�Gdd�de�Z	e	�e
�Gdd�de	�ZGd
d�de�Ze�e
�dS)z~Abstract Base Classes (ABCs) for numbers, according to PEP 3141.

TODO: Fill out more detailed documentation on the operators.�)�ABCMeta�abstractmethod�Number�Complex�Real�Rational�Integralc@seZdZdZdZdZdS)rz�All numbers inherit from this class.

    If you just want to check if an argument x is a number, without
    caring what kind, use isinstance(x, Number).
    �N)�__name__�
__module__�__qualname__�__doc__�	__slots__�__hash__r	r	r	�/usr/lib64/python3.8/numbers.pyrs)�	metaclassc@s�eZdZdZdZedd��Zdd�Zeedd���Z	eed	d
���Z
edd��Zed
d��Zedd��Z
edd��Zdd�Zdd�Zedd��Zedd��Zedd��Zedd��Zedd ��Zed!d"��Zed#d$��Zed%d&��Zed'd(��Zd)S)*rabComplex defines the operations that work on the builtin complex type.

    In short, those are: a conversion to complex, .real, .imag, +, -,
    *, /, abs(), .conjugate, ==, and !=.

    If it is given heterogeneous arguments, and doesn't have special
    knowledge about them, it should fall back to the builtin complex
    type as described below.
    r	cCsdS)z<Return a builtin complex instance. Called for complex(self).Nr	��selfr	r	r�__complex__-szComplex.__complex__cCs|dkS)z)True if self != 0. Called for bool(self).rr	rr	r	r�__bool__1szComplex.__bool__cCst�dS)zXRetrieve the real component of this number.

        This should subclass Real.
        N��NotImplementedErrorrr	r	r�real5szComplex.realcCst�dS)z]Retrieve the imaginary component of this number.

        This should subclass Real.
        Nrrr	r	r�imag>szComplex.imagcCst�dS)zself + otherNr�r�otherr	r	r�__add__GszComplex.__add__cCst�dS)zother + selfNrrr	r	r�__radd__LszComplex.__radd__cCst�dS)z-selfNrrr	r	r�__neg__QszComplex.__neg__cCst�dS)z+selfNrrr	r	r�__pos__VszComplex.__pos__cCs
||S)zself - otherr	rr	r	r�__sub__[szComplex.__sub__cCs
||S)zother - selfr	rr	r	r�__rsub___szComplex.__rsub__cCst�dS)zself * otherNrrr	r	r�__mul__cszComplex.__mul__cCst�dS)zother * selfNrrr	r	r�__rmul__hszComplex.__rmul__cCst�dS)z5self / other: Should promote to float when necessary.Nrrr	r	r�__truediv__mszComplex.__truediv__cCst�dS)zother / selfNrrr	r	r�__rtruediv__rszComplex.__rtruediv__cCst�dS)zBself**exponent; should promote to float or complex when necessary.Nr)r�exponentr	r	r�__pow__wszComplex.__pow__cCst�dS)zbase ** selfNr)r�baser	r	r�__rpow__|szComplex.__rpow__cCst�dS)z7Returns the Real distance from 0. Called for abs(self).Nrrr	r	r�__abs__�szComplex.__abs__cCst�dS)z$(x+y*i).conjugate() returns (x-y*i).Nrrr	r	r�	conjugate�szComplex.conjugatecCst�dS)z
self == otherNrrr	r	r�__eq__�szComplex.__eq__N)r
rrr
rrrr�propertyrrrrrrr r!r"r#r$r%r'r)r*r+r,r	r	r	rr sN













c@s�eZdZdZdZedd��Zedd��Zedd��Zed	d
��Z	ed&dd
��Z
dd�Zdd�Zedd��Z
edd��Zedd��Zedd��Zedd��Zedd��Zdd�Zed d!��Zed"d#��Zd$d%�ZdS)'rz�To Complex, Real adds the operations that work on real numbers.

    In short, those are: a conversion to float, trunc(), divmod,
    %, <, <=, >, and >=.

    Real also provides defaults for the derived operations.
    r	cCst�dS)zTAny Real can be converted to a native float object.

        Called for float(self).Nrrr	r	r�	__float__�szReal.__float__cCst�dS)aGtrunc(self): Truncates self to an Integral.

        Returns an Integral i such that:
          * i>0 iff self>0;
          * abs(i) <= abs(self);
          * for any Integral j satisfying the first two conditions,
            abs(i) >= abs(j) [i.e. i has "maximal" abs among those].
        i.e. "truncate towards 0".
        Nrrr	r	r�	__trunc__�szReal.__trunc__cCst�dS)z$Finds the greatest Integral <= self.Nrrr	r	r�	__floor__�szReal.__floor__cCst�dS)z!Finds the least Integral >= self.Nrrr	r	r�__ceil__�sz
Real.__ceil__NcCst�dS)z�Rounds self to ndigits decimal places, defaulting to 0.

        If ndigits is omitted or None, returns an Integral, otherwise
        returns a Real. Rounds half toward even.
        Nr)rZndigitsr	r	r�	__round__�szReal.__round__cCs||||fS)z�divmod(self, other): The pair (self // other, self % other).

        Sometimes this can be computed faster than the pair of
        operations.
        r	rr	r	r�
__divmod__�szReal.__divmod__cCs||||fS)z�divmod(other, self): The pair (self // other, self % other).

        Sometimes this can be computed faster than the pair of
        operations.
        r	rr	r	r�__rdivmod__�szReal.__rdivmod__cCst�dS)z)self // other: The floor() of self/other.Nrrr	r	r�__floordiv__�szReal.__floordiv__cCst�dS)z)other // self: The floor() of other/self.Nrrr	r	r�
__rfloordiv__�szReal.__rfloordiv__cCst�dS)zself % otherNrrr	r	r�__mod__�szReal.__mod__cCst�dS)zother % selfNrrr	r	r�__rmod__�sz
Real.__rmod__cCst�dS)zRself < other

        < on Reals defines a total ordering, except perhaps for NaN.Nrrr	r	r�__lt__�szReal.__lt__cCst�dS)z
self <= otherNrrr	r	r�__le__�szReal.__le__cCstt|��S)z(complex(self) == complex(float(self), 0))�complex�floatrr	r	rr�szReal.__complex__cCs|
S)z&Real numbers are their real component.r	rr	r	rr�sz	Real.realcCsdS)z)Real numbers have no imaginary component.rr	rr	r	rr�sz	Real.imagcCs|
S)zConjugate is a no-op for Reals.r	rr	r	rr+szReal.conjugate)N)r
rrr
rrr.r/r0r1r2r3r4r5r6r7r8r9r:rr-rrr+r	r	r	rr�s@











c@s<eZdZdZdZeedd���Zeedd���Zdd�Z	d	S)
rz6.numerator and .denominator should be in lowest terms.r	cCst�dS�Nrrr	r	r�	numeratorszRational.numeratorcCst�dSr=rrr	r	r�denominatorszRational.denominatorcCs|j|jS)afloat(self) = self.numerator / self.denominator

        It's important that this conversion use the integer's "true"
        division rather than casting one side to float before dividing
        so that ratios of huge integers convert without overflowing.

        )r>r?rr	r	rr.szRational.__float__N)
r
rrr
rr-rr>r?r.r	r	r	rrsc@s�eZdZdZdZedd��Zdd�Zed&dd	��Zed
d��Z	edd
��Z
edd��Zedd��Zedd��Z
edd��Zedd��Zedd��Zedd��Zedd��Zedd��Zd d!�Zed"d#��Zed$d%��ZdS)'rz@Integral adds a conversion to int and the bit-string operations.r	cCst�dS)z	int(self)Nrrr	r	r�__int__+szIntegral.__int__cCst|�S)z6Called whenever an index is needed, such as in slicing)�intrr	r	r�	__index__0szIntegral.__index__NcCst�dS)a4self ** exponent % modulus, but maybe faster.

        Accept the modulus argument if you want to support the
        3-argument version of pow(). Raise a TypeError if exponent < 0
        or any argument isn't Integral. Otherwise, just implement the
        2-argument version described in Complex.
        Nr)rr&�modulusr	r	rr'4s	zIntegral.__pow__cCst�dS)z
self << otherNrrr	r	r�
__lshift__?szIntegral.__lshift__cCst�dS)z
other << selfNrrr	r	r�__rlshift__DszIntegral.__rlshift__cCst�dS)z
self >> otherNrrr	r	r�
__rshift__IszIntegral.__rshift__cCst�dS)z
other >> selfNrrr	r	r�__rrshift__NszIntegral.__rrshift__cCst�dS)zself & otherNrrr	r	r�__and__SszIntegral.__and__cCst�dS)zother & selfNrrr	r	r�__rand__XszIntegral.__rand__cCst�dS)zself ^ otherNrrr	r	r�__xor__]szIntegral.__xor__cCst�dS)zother ^ selfNrrr	r	r�__rxor__bszIntegral.__rxor__cCst�dS)zself | otherNrrr	r	r�__or__gszIntegral.__or__cCst�dS)zother | selfNrrr	r	r�__ror__lszIntegral.__ror__cCst�dS)z~selfNrrr	r	r�
__invert__qszIntegral.__invert__cCstt|��S)zfloat(self) == float(int(self)))r<rArr	r	rr.wszIntegral.__float__cCs|
S)z"Integers are their own numerators.r	rr	r	rr>{szIntegral.numeratorcCsdS)z!Integers have a denominator of 1.�r	rr	r	rr?�szIntegral.denominator)N)r
rrr
rrr@rBr'rDrErFrGrHrIrJrKrLrMrNr.r-r>r?r	r	r	rr&sD













N)r
�abcrr�__all__rr�registerr;rr<rrrAr	r	r	r�<module>sp
u
_imp.cpython-38.opt-2.pyc000064400000016426150335716500010737 0ustar00U

e5d()�@s�ddlmZmZmZmZmZmZmZmZm	Z	zddlm
Z
Wnek
rTdZ
YnXddlm
Z
mZmZmZddlmZddlmZddlmZddlZddlZddlZddlZddlZddlZejded	d
�dZdZd	ZdZ d
Z!dZ"dZ#dZ$dZ%dZ&dd�Z'dd�Z(dd�Z)d7dd�Z*dd�Z+dd�Z,Gdd �d �Z-Gd!d"�d"�Z.Gd#d$�d$e.ej/�Z0d8d%d&�Z1Gd'd(�d(e.e�Z2d9d)d*�Z3d+d,�Z4d-d.�Z5d:d/d0�Z6d1d2�Z7d3d4�Z8e
�r�d;d5d6�Z9ndZ9dS)<�)	�	lock_held�acquire_lock�release_lock�get_frozen_object�is_frozen_package�init_frozen�
is_builtin�	is_frozen�_fix_co_filename)�create_dynamicN)�_ERR_MSG�_exec�_load�_builtin_from_name)�SourcelessFileLoader)�	machinery)�utilzhthe imp module is deprecated in favour of importlib; see the module's documentation for alternative uses�)�
stacklevel��������	cCs
t�|�S�N)�types�
ModuleType��name�r"�/usr/lib64/python3.8/imp.py�
new_module0sr$cCstjSr)r�MAGIC_NUMBERr"r"r"r#�	get_magic;sr&cCstjjSr)�sys�implementation�	cache_tagr"r"r"r#�get_tagCsr*c
Cs6t���$t�d�t�||�W5QR�SQRXdS)N�ignore)�warnings�catch_warnings�simplefilterr�cache_from_source)�path�debug_overrider"r"r#r/Hs

r/cCs
t�|�Sr)r�source_from_cache�r0r"r"r#r2[sr2cCs<dd�tjD�}dd�tjD�}dd�tjD�}|||S)NcSsg|]}|dtf�qS��rb)�C_EXTENSION��.0�sr"r"r#�
<listcomp>ksz get_suffixes.<locals>.<listcomp>cSsg|]}|dtf�qS)�r)�	PY_SOURCEr7r"r"r#r:lscSsg|]}|dtf�qSr4)�PY_COMPILEDr7r"r"r#r:ms)r�EXTENSION_SUFFIXES�SOURCE_SUFFIXES�BYTECODE_SUFFIXES)�
extensions�source�bytecoder"r"r#�get_suffixesisrDc@seZdZdd�Zdd�ZdS)�NullImportercCs2|dkrtddd��ntj�|�r.td|d��dS)N�zempty pathnamer3zexisting directory)�ImportError�osr0�isdir)�selfr0r"r"r#�__init__zszNullImporter.__init__cCsdSrr")rJ�fullnamer"r"r#�find_module�szNullImporter.find_moduleN)�__name__�
__module__�__qualname__rKrMr"r"r"r#rErsrEcs*eZdZd�fdd�	Z�fdd�Z�ZS)�_HackedGetDataNcst��||�||_dSr)�superrK�file)rJrLr0rS��	__class__r"r#rK�sz_HackedGetData.__init__c
s||jrl||jkrl|jjs0|j}d|jkr0|��|jjrJt|jd�|_}|�|��W5QR�SQRXnt��|�SdS)N�br5)	rSr0�closed�mode�close�open�readrR�get_data)rJr0rSrTr"r#r\�s
z_HackedGetData.get_data)N)rNrOrPrKr\�
__classcell__r"r"rTr#rQ�srQc@seZdZdS)�_LoadSourceCompatibilityN�rNrOrPr"r"r"r#r^�sr^cCs\t|||�}tj|||d�}|tjkr8t|tj|�}nt|�}t�||�|_	|j	|j
_|S�N)�loader)r^r�spec_from_file_locationr'�modulesr
rr�SourceFileLoader�
__loader__�__spec__ra�r!�pathnamerSra�spec�moduler"r"r#�load_source�s

rkc@seZdZdS)�_LoadCompiledCompatibilityNr_r"r"r"r#rl�srlcCsZt|||�}tj|||d�}|tjkr8t|tj|�}nt|�}t||�|_|j|j	_
|Sr`)rlrrbr'rcr
rrrerfrargr"r"r#�
load_compiled�s

rmcCs�tj�|�rftjdd�tjdd�}|D]*}tj�|d|�}tj�|�r,|}qfq,td�	|���t
j||gd�}|tj
kr�t|tj
|�St|�SdS)NrKz{!r} is not a package)�submodule_search_locations)rHr0rIrr?r@�join�exists�
ValueError�formatrrbr'rcr
r)r!r0rA�	extensionZ	init_pathrir"r"r#�load_package�s ��
rtc	
Cs$|\}}}|r0|�d�r d|kr0td�|���n�|dkrX|tthkrXd�|�}t|��n�|tkrlt|||�S|tkr�t|||�S|tkr�tdk	r�|dkr�t	|d��}t|||�W5QR�SQRXnt|||�SnN|t
kr�t||�S|tk�r�t
|�S|tk�rt|�Sd�||�}t||d��dS)N)r;�U�+zinvalid file open mode {!r}z.file object required for import (type code {})r5z*Don't know how to import {} (type code {})r )�
startswithrqrrr<r=rkrmr6�load_dynamicrZ�
PKG_DIRECTORYrt�	C_BUILTIN�init_builtin�	PY_FROZENrrG)	r!rS�filenameZdetails�suffixrX�type_�msgZopened_filer"r"r#�load_module�s.


 


r�c	Cs�t|t�std�t|����n$t|td�tf�sBtd�t|����|dkr�t|�rbddddtffSt	|�rzddddt
ffStj}|D]�}t
j�||�}dtjdfD]>}d|}t
j�||�}t
j�|�r�d|ddtffSq�t�D]2\}}}||}	t
j�||	�}t
j�|�r��q q�q��q:q�tt�|�|d��d}
d|k�rnt|d	��}t�|j�d}
W5QRXt|||
d
�}|||||ffS)Nz'name' must be a str, not {}z%'path' must be None or a list, not {}rFz.pyrrKr rVr5)�encoding)�
isinstance�str�	TypeErrorrr�type�list�RuntimeErrorrrzr	r|r'r0rHrorr@�isfileryrDrGrrZ�tokenize�detect_encoding�readline)r!r0�entryZpackage_directoryr~Zpackage_file_nameZ	file_pathrXr�	file_namer�rSr"r"r#rM�sB
�
rMcCs
t�|�Sr)�	importlib�reload)rjr"r"r#r�2sr�cCs&z
t|�WStk
r YdSXdSr)rrGr r"r"r#r{=s
r{cCs0ddl}|j�||�}|jj|||d�}t|�S)Nr)r!ra�origin)�importlib.machineryr�ExtensionFileLoader�
ModuleSpecr)r!r0rSr�rarir"r"r#rxJs�rx)N)N)N)N)N):�_imprrrrrrrr	r
rrGZimportlib._bootstraprr
rrZimportlib._bootstrap_externalrr�rrrHr'r�rr,�warn�DeprecationWarningZSEARCH_ERRORr<r=r6ZPY_RESOURCEryrzr|ZPY_CODERESOURCEZIMP_HOOKr$r&r*r/r2rDrErQrdr^rkrlrmrtr�rMr�r{rxr"r"r"r#�<module>	s`,
�
	

#
4fnmatch.cpython-38.opt-1.pyc000064400000006435150335716500011570 0ustar00U

e5d��@sjdZddlZddlZddlZddlZddddgZdd�Zejdd	d
�dd��Zd
d�Z	dd�Z
dd�ZdS)a�Filename matching with shell patterns.

fnmatch(FILENAME, PATTERN) matches according to the local convention.
fnmatchcase(FILENAME, PATTERN) always takes case in account.

The functions operate by translating the pattern into a regular
expression.  They cache the compiled regular expressions for speed.

The function translate(PATTERN) returns a regular expression
corresponding to PATTERN.  (It does not compile it.)
�N�filter�fnmatch�fnmatchcase�	translatecCs"tj�|�}tj�|�}t||�S)a�Test whether FILENAME matches PATTERN.

    Patterns are Unix shell style:

    *       matches everything
    ?       matches any single character
    [seq]   matches any character in seq
    [!seq]  matches any char not in seq

    An initial period in FILENAME is not special.
    Both FILENAME and PATTERN are first case-normalized
    if the operating system requires it.
    If you don't want this, use fnmatchcase(FILENAME, PATTERN).
    )�os�path�normcaser)�name�pat�r�/usr/lib64/python3.8/fnmatch.pyrs�T)�maxsize�typedcCs<t|t�r(t|d�}t|�}t|d�}nt|�}t�|�jS)Nz
ISO-8859-1)�
isinstance�bytes�strr�re�compile�match)r
Zpat_strZres_str�resrrr�_compile_pattern&s

rcCshg}tj�|�}t|�}tjtkr@|D]}||�r&|�|�q&n$|D]}|tj�|��rD|�|�qD|S)zJConstruct a list from those elements of the iterable NAMES that match PAT.)rrrr�	posixpath�append)�namesr
�resultrr	rrrr0s
cCst|�}||�dk	S)z�Test whether FILENAME matches PATTERN, including case.

    This is a version of fnmatch() which doesn't case-normalize
    its arguments.
    N)r)r	r
rrrrr@sc	Cs�dt|�}}d}||k�r�||}|d}|dkr>|d}q|dkrP|d}q|dk�r�|}||krz||d	krz|d}||kr�||d
kr�|d}||kr�||d
kr�|d}q�||kr�|d}�q�|||�}d|kr�|�d
d�}n�g}||d	k�r|dn|d}|�d||�}|dk�r(�qN|�|||��|d}|d}�q|�|||��d�dd�|D��}t�dd|�}|d}|dd	k�r�d|dd�}n|ddk�r�d
|}d||f}q|t�|�}qd|S)zfTranslate a shell PATTERN to a regular expression.

    There is no way to quote meta-characters.
    r���*z.*�?�.�[�!�]z\[z--�\�\\��-�css"|]}|�dd��dd�VqdS)r$r%r'z\-N)�replace)�.0�srrr�	<genexpr>ts�ztranslate.<locals>.<genexpr>z([&~|])z\\\1�^N)r-r!z%s[%s]z	(?s:%s)\Z)�lenr)�findr�joinr�sub�escape)	r
�i�nr�c�jZstuffZchunks�krrrrJsV






�)�__doc__rrr�	functools�__all__r�	lru_cacherrrrrrrr�<module>s
	
pdb.cpython-38.opt-1.pyc000064400000134105150335716500010711 0ustar00U

e5d��"@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZGdd�de�Zddddd	d
ddd
g	Zdd�Zdd�Zdd�ZGdd�de�ZdZGdd�dejej�Zedk	�rnd
ddddddddd d!d"d#d$d%d&d'd(dd)d*d+d,d-d.d/d0d1d2d3d4d5d6d7g"ZeD]"Zeeed8e�j��d97Z�q:eej j7Z[[dJd:d�Z!dKd;d�Z"d<d	�Z#d=d
�Z$dd>�d?d�Z%dLd@d�Z&dAd�Z'dBZ(dCdD�Z)dEd
�Z*dFZ+dGdH�Z,e-dIk�r�ddl.Z.e.�,�dS)Ma�	
The Python Debugger Pdb
=======================

To use the debugger in its simplest form:

        >>> import pdb
        >>> pdb.run('<a statement>')

The debugger's prompt is '(Pdb) '.  This will stop in the first
function call in <a statement>.

Alternatively, if a statement terminated with an unhandled exception,
you can use pdb's post-mortem facility to inspect the contents of the
traceback:

        >>> <a statement>
        <exception traceback>
        >>> import pdb
        >>> pdb.pm()

The commands recognized by the debugger are listed in the next
section.  Most can be abbreviated as indicated; e.g., h(elp) means
that 'help' can be typed as 'h' or 'help' (but not as 'he' or 'hel',
nor as 'H' or 'Help' or 'HELP').  Optional arguments are enclosed in
square brackets.  Alternatives in the command syntax are separated
by a vertical bar (|).

A blank line repeats the previous command literally, except for
'list', where it lists the next 11 lines.

Commands that the debugger doesn't recognize are assumed to be Python
statements and are executed in the context of the program being
debugged.  Python statements can also be prefixed with an exclamation
point ('!').  This is a powerful way to inspect the program being
debugged; it is even possible to change variables or call functions.
When an exception occurs in such a statement, the exception name is
printed but the debugger's state is not changed.

The debugger supports aliases, which can save typing.  And aliases can
have parameters (see the alias help entry) which allows one a certain
level of adaptability to the context under examination.

Multiple commands may be entered on a single line, separated by the
pair ';;'.  No intelligence is applied to separating the commands; the
input is split at the first ';;', even if it is in the middle of a
quoted string.

If a file ".pdbrc" exists in your home directory or in the current
directory, it is read in and executed as if it had been typed at the
debugger prompt.  This is particularly useful for aliases.  If both
files exist, the one in the home directory is read first and aliases
defined there can be overridden by the local file.  This behavior can be
disabled by passing the "readrc=False" argument to the Pdb constructor.

Aside from aliases, the debugger is not directly programmable; but it
is implemented as a class from which you can derive your own debugger
class, which you can make as fancy as you like.


Debugger commands
=================

�Nc@seZdZdZdS)�RestartzBCauses a debugger to be restarted for the debugged python program.N)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.8/pdb.pyrWsr�run�pm�Pdb�runeval�runctx�runcall�	set_trace�post_mortem�helpc
Cs�t�dt�|��}zt�|�}Wntk
r8YdSX|�@t|dd�D],\}}|�|�rL|||fW5QR�SqLW5QRXdS)Nzdef\s+%s\s*[(]�)�start)�re�compile�escape�tokenize�open�OSError�	enumerate�match)�funcname�filenameZcre�fp�lineno�linerrr�
find_function^s
&r!cCsXt�|�\}}t�|�r,|j|jkr,|dfSt�|�r>|dfSt�||d��|dfS)Nr)�inspectZ
findsourceZisframe�	f_globals�f_localsZismoduleZgetblock)�obj�linesrrrr�getsourcelinesks
r'cCs8tt�|��}|��|D]\}}||kr|SqdS�Nr)�list�disZfindlinestarts�reverse)�codeZlastiZ
linestarts�irrrr�lasti2linenots
r.c@seZdZdZdd�ZdS)�_rstrz#String that doesn't quote its repr.cCs|S�Nr��selfrrr�__repr__sz_rstr.__repr__N)rrrrr3rrrrr/}sr/z
-> c@seZdZdZd�dd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�ZeZd�d8d9�Zd:d;�ZeZ eZ!eZ"d<d=�Z#eZ$d>d?�Z%d@dA�Z&dBdC�Z'eZ(dDdE�Z)eZ*dFdG�Z+eZ,dHdI�Z-eZ.dJdK�Z/e/Z0eZ1eZ2dLdM�Z3e3Z4e3Z5dNdO�Z6dPdQ�Z7e7Z8dRdS�Z9e9Z:dTdU�Z;e;Z<dVdW�Z=e=Z>dXdY�Z?e?Z@dZd[�ZAeAZBd\d]�ZCeCZDd^d_�ZEeEZFZGd`da�ZHeHZIdbdc�ZJeZKddde�ZLeLZMeLZNdfdg�ZOdhdi�ZPePZQdjdk�ZReRZSdldm�ZTd�dndo�ZUdpdq�ZVdrds�ZWeZXeZYeZZdtdu�Z[e[Z\dvdw�Z]e]Z^dxdy�Z_eZ`d�d{d|�Zad}d~�ZbeZcdd��ZdeZed�d��Zfd�d��Zgd�d��Zhd�d��Zid�d��Zjd�d��Zkd�d�d�d�d�d�gZld�d��Zmenfd�d��Zod�d��ZpepZqd�d��Zrd�d��Zsd�d��Ztd�d��Zud�d��ZvdS)�rN�tabFTc		Cs>tjj||d�tj�||||�t�d�|r6d|_d|_i|_	i|_
d|_d|_i|_
zddl}|�d�Wntk
r�YnXd|_||_g|_|�rz,ttj�d���}|j�|�W5QRXWntk
r�YnXz$td	��}|j�|�W5QRXWntk
�rYnXi|_i|_i|_d|_d|_dS)
N)�skipzpdb.Pdbrz(Pdb) �Fz 	
`@#$%^&*()=+[{]}\|;:'",<>?z~/.pdbrcz.pdbrc)�bdb�Bdb�__init__�cmd�Cmd�sys�auditZuse_rawinput�prompt�aliases�
displaying�
mainpyfile�_wait_for_mainpyfile�	tb_lineno�readlineZset_completer_delims�ImportError�allow_kbdint�nosigint�rcLinesr�os�path�
expanduser�extendr�commands�commands_doprompt�commands_silent�commands_defining�
commands_bnum)	r2�completekey�stdin�stdoutr5rGZreadrcrDZrcFilerrrr9�sF

zPdb.__init__cCs*|jr
t�|�d�|��|�|�dS)Nz-
Program interrupted. (Use 'cont' to resume).)rF�KeyboardInterrupt�message�set_stepr)r2Zsignum�framerrr�sigint_handler�s

zPdb.sigint_handlercCstj�|�|��dSr0)r7r8�reset�forgetr1rrrrZ�sz	Pdb.resetcCs&d|_g|_d|_d|_|j��dSr()r�stack�curindex�curframerC�clearr1rrrr[�s
z
Pdb.forgetcCsh|��|�||�\|_|_|rDt|jj|j�}||j|j<|j	}q|j|jd|_
|j
j|_|�
�Sr()r[Z	get_stackr\r]r.�tb_frame�f_code�tb_lastirC�tb_nextr^r$�curframe_locals�execRcLines)r2�f�tbrrrr�setup�s
z	Pdb.setupcCsd|js
dS|j}|��g|_|r`|����}|r|ddkr|�|�r|jt|�7_dSqdS)Nr�#T)rHr+�pop�strip�onecmd�reversed)r2rHr rrrre�s
zPdb.execRcLinescCs.|jr
dS|�|�r*|�d�|�|d�dS)znThis method is called when there is the remote possibility
        that we ever need to stop in this function.Nz--Call--)rBZ	stop_hererV�interaction)r2rXZ
argument_listrrr�	user_call�s


z
Pdb.user_callcCsH|jr.|j|�|jj�ks$|jdkr(dSd|_|�|�rD|�|d�dS)z;This function is called when we stop or break at this line.rNF)rBrA�canonicra�co_filename�f_lineno�bp_commandsrn)r2rXrrr�	user_line�s�
z
Pdb.user_linecCs�t|dd�r�|j|jkr�|j}d|_|j}|�|d�|j|D]}|�|�q@||_|j|sr|�|j|j	�|j
|r�|��|��dSdS)z�Call every command that was set for the current active breakpoint
        (if there is one).

        Returns True if the normal interaction function must be called,
        False otherwise.�	currentbpFrNr)
�getattrrurM�lastcmdrhrlrO�print_stack_entryr\r]rN�_cmdloopr[)r2rXruZlastcmd_backr rrrrss"
�

zPdb.bp_commandscCs.|jr
dS||jd<|�d�|�|d�dS)z7This function is called when a return trap is set here.N�
__return__z
--Return--)rBr$rVrn)r2rXZreturn_valuerrr�user_return s


zPdb.user_returncCsh|jr
dS|\}}}||f|jd<|s2|tkr2dnd}|�d|t�||�d��f�|�||�dS)zoThis function is called if an exception occurs,
        but only if we are to stop at or just below this level.NZ
__exception__z	Internal r6z%s%s���)rBr$�
StopIterationrV�	traceback�format_exception_onlyrkrn)r2rX�exc_info�exc_type�	exc_value�
exc_traceback�prefixrrr�user_exception(s
���zPdb.user_exceptioncCsBzd|_|��d|_Wq>Wqtk
r:|�d�YqXqdS)NTFz--KeyboardInterrupt--)rF�cmdlooprUrVr1rrrry<szPdb._cmdloopcCs^|j�|j�}|rZ|��D]>\}}|�|�}||k	r||kr|||<|�d|||f�qdS)Nzdisplay %s: %r  [old: %r])r@�getr^�items�_getval_exceptrV)r2r@�exprZoldvalueZnewvaluerrr�preloopIs
�zPdb.preloopcCsttjr6zt�tjtj�Wntk
r.YnXdt_|�||�rN|��dS|�|j|j	�|�
�|��dSr0)r�_previous_sigint_handler�signal�SIGINT�
ValueErrorrhr[rxr\r]ry)r2rXr~rrrrnVszPdb.interactioncCs|dk	r|�t|��dS)z{Custom displayhook for the exec in default(), which prevents
        assignment of the _ variable in the builtins.
        N)rV�repr)r2r%rrr�displayhookhszPdb.displayhookc	Cs�|dd�dkr|dd�}|j}|jj}zdt|ddd�}tj}tj}tj}z(|jt_|jt_|jt_t|||�W5|t_|t_|t_XWn4t�	�dd�}|�
tj|�d�
��YnXdS)Nr�!�
z<stdin>Zsingle�r|)rdr^r#rr<rTrSr��execr��errorr~rrk)	r2r �locals�globalsr,Zsave_stdoutZ
save_stdinZsave_displayhookr�rrr�defaultps(zPdb.defaultcCs�|��s|S|��}|d|jkr�|j|d}d}|dd�D] }|�dt|�|�}|d7}q@|�dd�|dd���}|��}q|ddkr�|�d�}|dkr�||d	d���}|j�	|�|d|��
�}|S)
z*Handle alias expansion and ';;' separator.rrN�%z%*� �aliasz;;r�)rk�splitr?�replace�str�join�find�lstrip�cmdqueue�append�rstrip)r2r �argsZiiZtmpArgZmarker�nextrrr�precmd�s(�


z
Pdb.precmdcCs"|jstj�||�S|�|�SdS)z�Interpret the argument as though it had been typed in response
        to the prompt.

        Checks whether this line is typed at the normal prompt or in
        a breakpoint command list definition.
        N)rPr:r;rl�handle_command_def)r2r rrrrl�sz
Pdb.onecmdcCs�|�|�\}}}|sdS|dkr0d|j|j<dS|dkrBg|_dS|j|j}|rf|�|d|�n
|�|�zt|d|�}Wntk
r�|j}YnX|j	|j
kr�d|j|j<g|_dSdS)	z8Handles one command line during command list definition.NZsilentT�endrr��do_F)Z	parselinerOrQr�rMr�rv�AttributeErrorr�r�commands_resumingrN)r2r r:�argZcmdlist�funcrrrr��s,
zPdb.handle_command_defcCst||jd�dS)N��file��printrT�r2�msgrrrrV�szPdb.messagecCstd||jd�dS)Nz***r�r�r�rrrr��sz	Pdb.errorcCs�|���d�rgSz|�||||�}Wntk
r>g}YnXt�t�|�d�}|D]H}tj�|�rx|�	|d�qXtj�
|�rX|���d�rX|�	|d�qX|S)N)�:�,�*�/)�.pyz.pywr�)rk�endswith�_complete_expression�	Exception�globrrIrJ�isdirr��isfile�lower)r2�textr �begidx�endidxZret�globs�fnrrr�_complete_location�s
zPdb._complete_locationcs�fdd�ttjj�D�S)Ncs.g|]&\}}|dk	rt|����rt|��qSr0)r��
startswith)�.0r-�bp�r�rr�
<listcomp>�s�z*Pdb._complete_bpnumber.<locals>.<listcomp>)rr7�
Breakpoint�
bpbynumber�r2r�r r�r�rr�r�_complete_bpnumber�szPdb._complete_bpnumberc	s�|js
gS|jj|j�}d�kr���d��z,|�d}�dd�D]}t||�}qDWnttfk
rrgYSXd��dd��d���fdd�t|�D�S�fdd�|�	�D�SdS)N�.rrr|cs"g|]}|��d�r�|�qS)r|�r��r��n)�dottedr�rrr�sz,Pdb._complete_expression.<locals>.<listcomp>csg|]}|���r|�qSrr�r�r�rrr�s
)
r^r#rdr�rv�KeyErrorr�r��dir�keys)r2r�r r�r��nsr%�partr)r�r�r�rr��s

zPdb._complete_expressioncCs,|sttjj�d}n&zt|�}Wn|�d�YdSX||_||jkrj|j||j||j	|f}nd}g|j|<d|j|<d|j	|<|j
}d|_
d|_zzz|��Wnht
k
�r|r�|d|j|<|d|j|<|d|j	|<n|j|=|j|=|j	|=|�d	�YnXW5d|_||_
XdS)
a4commands [bpnumber]
        (com) ...
        (com) end
        (Pdb)

        Specify a list of commands for breakpoint number bpnumber.
        The commands themselves are entered on the following lines.
        Type a line containing just 'end' to terminate the commands.
        The commands are executed when the breakpoint is hit.

        To remove all commands from a breakpoint, type commands and
        follow it immediately with end; that is, give no commands.

        With no bpnumber argument, commands refers to the last
        breakpoint set.

        You can use breakpoint commands to start your program up
        again.  Simply use the continue command, or step, or any other
        command that resumes execution.

        Specifying any command resuming execution (currently continue,
        step, next, return, jump, quit and their abbreviations)
        terminates the command list (as if that command was
        immediately followed by end).  This is because any time you
        resume execution (even with a simple next or step), you may
        encounter another breakpoint -- which could have its own
        command list, leading to ambiguities about which list to
        execute.

        If you use the 'silent' command in the command list, the usual
        message about stopping at a breakpoint is not printed.  This
        may be desirable for breakpoints that are to print a specific
        message and then continue.  If none of the other commands
        print anything, you will see no sign that the breakpoint was
        reached.
        rz.Usage: commands [bnum]
        ...
        endNTFz(com) rr�z1command definition aborted, old commands restored)�lenr7r�r��intr�rQrMrNrOr>rPr�rU)r2r�ZbnumZold_command_defsZprompt_backrrr�do_commands	sB%

�


zPdb.do_commandsrc
CsB|s8|jr4|�d�tjjD]}|r|�|���qdSd}d}d}|�d�}|dkrz||dd���}|d|���}|�	d�}d}	|dk�r|d|���}|�
|�}
|
s�|�d|�dS|
}||dd���}zt|�}Wn&t
k
�r|�d|�YdSXn�zt|�}Wn�t
k
�r�zt||jj|j�}Wn|}YnXz.t|d	��rj|j}|j}|j}	|j}|j}WnD|�|�\}
}}|
�s�|�d
|�YYdS|
}	t|�}YnXYnX|�s�|��}|�||�}|�r>|�|||||	�}|�r|�|�n*|�||�d}|�d|j|j|jf�dS)
a�b(reak) [ ([filename:]lineno | function) [, condition] ]
        Without argument, list all breaks.

        With a line number argument, set a break at this line in the
        current file.  With a function name, set a break at the first
        executable line of that function.  If a second argument is
        present, it is a string specifying an expression which must
        evaluate to true before the breakpoint is honored.

        The line number may be prefixed with a filename and a colon,
        to specify a breakpoint in another file (probably one that
        hasn't been loaded yet).  The file is searched for on
        sys.path; the .py suffix may be omitted.
        z!Num Type         Disp Enb   WhereNr�rrr�z%r not found from sys.pathzBad lineno: %s�__func__zJThe specified object %r is not a function or was not found along sys.path.r|zBreakpoint %d at %s:%d) �breaksrVr7r�r�Zbpformatr�r�r��rfind�lookupmoduler�r�r��evalr^r#rd�hasattrr��__code__�co_name�co_firstlinenorq�lineinfo�defaultFile�	checklineZ	set_break�
get_breaks�numberr�r )r2r�Z	temporaryr�rr�condZcommaZcolonrrfr�r,�okZlnr �errrrr�do_breakXs�





�

��zPdb.do_breakcCs"|jjj}|dkr|jr|j}|S)zProduce a reasonable default.z<string>)r^rarqrA)r2rrrrr��s
zPdb.defaultFilecCs|�|d�dS)z�tbreak [ ([filename:]lineno | function) [, condition] ]
        Same arguments as break, but sets a temporary breakpoint: it
        is automatically deleted when first hit.
        rN)r��r2r�rrr�	do_tbreak�sz
Pdb.do_tbreakc
Cs�d}|�d�}t|�dkr(|d��}nt|�dkrB|d��}n|S|dkrR|S|�d�}|ddkr~|d=t|�dkr~|S|��}t|�dkr�|d}n|�|d�}|r�|}|d}t||�}	|	p�|S)	N)NNN�'rr�r6r�r2)r�r�rkr�r�r!)
r2Z
identifierZfailedZidstring�id�partsZfname�itemrfZanswerrrrr��s.



zPdb.lineinfocCs�t|d�r|jjnd}t�|||�}|s6|�d�dS|��}|rn|ddksn|dd�dksn|dd�dkr||�d	�dS|S)
z�Check whether specified line seems to be executable.

        Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank
        line or EOF). Warning: testing is not comprehensive.
        r^NzEnd of filerrir�z"""z'''zBlank or comment)r�r^r#�	linecache�getlinerVrkr�)r2rrr�r rrrr��s
��
z
Pdb.checklinecCsh|��}|D]V}z|�|�}Wn,tk
rJ}z|�|�W5d}~XYqX|��|�d|�qdS)z�enable bpnumber [bpnumber ...]
        Enables the breakpoints given as a space separated list of
        breakpoint numbers.
        Nz
Enabled %s)r��get_bpbynumberr�r��enablerV�r2r�r�r-r�r�rrr�	do_enablesz
Pdb.do_enablecCsh|��}|D]V}z|�|�}Wn,tk
rJ}z|�|�W5d}~XYqX|��|�d|�qdS)aNdisable bpnumber [bpnumber ...]
        Disables the breakpoints given as a space separated list of
        breakpoint numbers.  Disabling a breakpoint means it cannot
        cause the program to stop execution, but unlike clearing a
        breakpoint, it remains in the list of breakpoints and can be
        (re-)enabled.
        NzDisabled %s)r�r�r�r��disablerVr�rrr�
do_disableszPdb.do_disablec
Cs�|�dd�}z|d}Wntk
r0d}YnXz|�|d���}WnHtk
rf|�d�YnXtk
r�}z|�|�W5d}~XYn.X||_|s�|�d|j�n|�d|j�dS)a#condition bpnumber [condition]
        Set a new condition for the breakpoint, an expression which
        must evaluate to true before the breakpoint is honored.  If
        condition is absent, any existing condition is removed; i.e.,
        the breakpoint is made unconditional.
        r�rNr�Breakpoint number expectedz#Breakpoint %d is now unconditional.z$New condition set for breakpoint %d.)	r��
IndexErrorr�rkr�r�r�rVr�)r2r�r�r�r�r�rrr�do_condition%s
zPdb.do_conditionc
Cs�|��}zt|d���}Wnd}YnXz|�|d���}WnHtk
rb|�d�Ynvtk
r�}z|�|�W5d}~XYnLX||_|dkr�|dkr�d|}nd}|�d||j	f�n|�d|j	�dS)	a�ignore bpnumber [count]
        Set the ignore count for the given breakpoint number.  If
        count is omitted, the ignore count is set to 0.  A breakpoint
        becomes active when the ignore count is zero.  When non-zero,
        the count is decremented each time the breakpoint is reached
        and the breakpoint is not disabled and any associated
        condition evaluates to true.
        rrr�Nz%d crossingsz
1 crossingz%Will ignore next %s of breakpoint %d.z-Will stop next time breakpoint %d is reached.)
r�r�rkr�rr�r��ignorerVr�)r2r�r��countr�r�Zcountstrrrr�	do_ignore@s,	

��z
Pdb.do_ignorec
Cs�|stztd�}Wntk
r(d}YnX|����}|dkrpdd�tjjD�}|��|D]}|�d|�q\dSd|k�r|�	d�}|d|�}||d	d�}zt
|�}Wntk
r�d
|}YnX|�||�}|�
||�}|r�|�|�n|D]}|�d|�q�dS|��}	|	D]\}z|�|�}Wn.tk
�r^}z|�|�W5d}~XYnX|�|�|�d|��qdS)a=cl(ear) filename:lineno
cl(ear) [bpnumber [bpnumber...]]
        With a space separated list of breakpoint numbers, clear
        those breakpoints.  Without argument, clear all breaks (but
        first ask confirmation).  With a filename:lineno argument,
        clear all breaks at that line in that file.
        zClear all breaks? Zno)�yZyescSsg|]}|r|�qSrr)r�r�rrrr�qsz Pdb.do_clear.<locals>.<listcomp>z
Deleted %sNr�rzInvalid line number (%s))�input�EOFErrorrkr�r7r�r�Zclear_all_breaksrVr�r�r�r�Zclear_breakr�r�r�Zclear_bpbynumber)
r2r�ZreplyZbplistr�r-rrr�Z
numberlistrrr�do_clearcsF



zPdb.do_clearcCs|��dS)z�w(here)
        Print a stack trace, with the most recent frame at the bottom.
        An arrow indicates the "current frame", which determines the
        context of most commands.  'bt' is an alias for this command.
        N)�print_stack_tracer�rrr�do_where�szPdb.do_wherecCs>||_|j|jd|_|jj|_|�|j|j�d|_dSr()r]r\r^r$rdrxr)r2r�rrr�
_select_frame�s

zPdb._select_framecCsz|jdkr|�d�dSzt|p"d�}Wn$tk
rL|�d|�YdSX|dkr\d}ntd|j|�}|�|�dS)z�u(p) [count]
        Move the current frame count (default one) levels up in the
        stack trace (to an older frame).
        rzOldest frameNr�Invalid frame count (%s))r]r�r�r��maxr�r2r�rZnewframerrr�do_up�s

z	Pdb.do_upcCs�|jdt|j�kr"|�d�dSzt|p,d�}Wn$tk
rV|�d|�YdSX|dkrpt|j�d}ntt|j�d|j|�}|�|�dS)z�d(own) [count]
        Move the current frame count (default one) levels down in the
        stack trace (to a newer frame).
        rzNewest frameNrr)r]r�r\r�r�r��minrrrrr�do_down�s
zPdb.do_downcCsh|rRzt|�}Wn$tk
r4|�d|�YdSX||jjkrV|�d�dSnd}|�|j|�dS)aNunt(il) [lineno]
        Without argument, continue execution until the line with a
        number greater than the current one is reached.  With a line
        number, continue execution until a line with a number greater
        or equal to that is reached.  In both cases, also stop when
        the current frame returns.
        �Error in argument: %rNz7"until" line number is smaller than current line numberr)r�r�r�r^rrZ	set_until)r2r�rrrr�do_until�s
zPdb.do_untilcCs|��dS)z�s(tep)
        Execute the current line, stop at the first possible occasion
        (either in a function that is called or in the current
        function).
        r)rWr�rrr�do_step�szPdb.do_stepcCs|�|j�dS)zxn(ext)
        Continue execution until the next line in the current function
        is reached or it returns.
        r)Zset_nextr^r�rrr�do_next�szPdb.do_nextcCs<|r4ddl}tjdd�}|�|�t_|tjdd�<t�dS)arun [args...]
        Restart the debugged python program. If a string is supplied
        it is split with "shlex", and the result is used as the new
        sys.argv.  History, breakpoints, actions and debugger options
        are preserved.  "restart" is an alias for "run".
        rNr)�shlexr<�argvr�r)r2r�rZargv0rrr�do_run�sz
Pdb.do_runcCs|�|j�dS)zPr(eturn)
        Continue execution until the current function returns.
        r)Z
set_returnr^r�rrr�	do_returnsz
Pdb.do_returncCs>|js2zt�tj|j�t_Wntk
r0YnX|��dS)z]c(ont(inue))
        Continue execution, only stop when a breakpoint is encountered.
        r)rGr�r�rYrr�r�Zset_continuer�rrr�do_continues�zPdb.do_continuec
Cs�|jdt|j�kr"|�d�dSzt|�}Wntk
rL|�d�YnnXz:||j_|j|jd|f|j|j<|�|j|j�Wn0tk
r�}z|�d|�W5d}~XYnXdS)a�j(ump) lineno
        Set the next line that will be executed.  Only available in
        the bottom-most frame.  This lets you jump back and execute
        code again, or jump forward to skip code that you don't want
        to run.

        It should be noted that not all jumps are allowed -- for
        instance it is not possible to jump into the middle of a
        for loop or out of a finally clause.
        rz)You can only jump within the bottom frameNz)The 'jump' command requires a line numberrzJump failed: %s)	r]r�r\r�r�r�r^rrrx)r2r��errr�do_jump&s
zPdb.do_jumpcCs�t�d�|jj}|j}t|j|j|j�}d|j	�
�|_	|�d�zt�|j
|||f�Wn<tk
r�t��dd�}|�tj|�d�
��YnX|�d�t�|j�|j|_dS)z�debug code
        Enter a recursive debugger that steps through the code
        argument (which is an arbitrary expression or statement to be
        executed in the current environment).
        Nz(%s) zENTERING RECURSIVE DEBUGGERr�r|zLEAVING RECURSIVE DEBUGGER)r<�settracer^r#rdrrRrSrTr>rkrV�call_tracingr	r�r�r�r~rZtrace_dispatchrw)r2r�r�r��pr�rrr�do_debugCs


zPdb.do_debugcCsd|_|��dS)z[q(uit)
exit
        Quit from the debugger. The program being executed is aborted.
        Tr)�_user_requested_quit�set_quitr�rrr�do_quitZszPdb.do_quitcCs|�d�d|_|��dS)z=EOF
        Handles the receipt of EOF as a command.
        r6Tr)rVr!r"r�rrr�do_EOFes
z
Pdb.do_EOFcCs�|jj}|j}|j|j}|jtj@r.|d}|jtj@rB|d}t	|�D]>}|j
|}||krx|�d|||f�qJ|�d|f�qJdS)zHa(rgs)
        Print the argument list of the current function.
        rz%s = %rz%s = *** undefined ***N)r^rard�co_argcount�co_kwonlyargcount�co_flagsr"Z
CO_VARARGSZCO_VARKEYWORDS�range�co_varnamesrV)r2r��co�dictr�r-�namerrr�do_argsns
zPdb.do_argscCs.d|jkr |�t|jd��n
|�d�dS)zQretval
        Print the return value for the last return of a function.
        rzzNot yet returned!N)rdrVr�r�r�rrr�	do_retvals
z
Pdb.do_retvalcCsPzt||jj|j�WSt��dd�}|�tj|�d�	���YnXdS)Nr�r|)
r�r^r#rdr<r�r�r~rrk)r2r�r�rrr�_getval�szPdb._getvalcCsrz2|dkrt||jj|j�WSt||j|j�WSWn:t��dd�}tj|�d�	�}t
d|�YSXdS)Nr�r|z** raised %s **)r�r^r#rdr$r<r�r~rrkr/)r2r�rXr�r�rrrr��szPdb._getval_exceptcCs*z|�t|�|���WnYnXdS)z@p expression
        Print the value of the expression.
        N)rVr�r/r�rrr�do_p�szPdb.do_pcCs,z|�t�|�|���WnYnXdS)zHpp expression
        Pretty-print the value of the expression.
        N)rV�pprintZpformatr/r�rrr�do_pp�sz	Pdb.do_ppcCsfd|_d}|r�|dkr�z^d|krX|�d�\}}t|���}t|���}||krr||}nt|���}td|d�}Wq�tk
r�|�d|�YdSXn0|jdks�|dkr�td|jj	d�}n
|jd}|dkr�|d}|jj
j}|�|�}zZt
�||jj�}|�||d|�|||j�t|t|��|_t|�|k�rH|�d	�Wntk
�r`YnXdS)
a�l(ist) [first [,last] | .]

        List source code for the current file.  Without arguments,
        list 11 lines around the current line or continue the previous
        listing.  With . as argument, list 11 lines around the current
        line.  With one argument, list 11 lines starting at that line.
        With two arguments, list the given range; if the second
        argument is less than the first, it is a count.

        The current line in the current frame is indicated by "->".
        If an exception is being debugged, the line where the
        exception was originally raised or propagated is indicated by
        ">>", if it differs from the current line.
        r)Nr�r�r�r�
z[EOF])rwr�r�rkr
r�r�rr^rrrarq�get_file_breaksr��getlinesr#�_print_linesrr�rVrU)r2r�Zlast�firstr�	breaklistr&rrr�do_list�s@




�zPdb.do_listc
Csp|jjj}|�|�}zt|j�\}}Wn2tk
rX}z|�|�WY�dSd}~XYnX|�||||j�dS)z\longlist | ll
        List the whole source code for the current function or frame.
        N)r^rarqr5r'rr�r7)r2r�rr9r&rr�rrr�do_longlist�s


zPdb.do_longlistc
Csvz|�|�}WnYdSXzt|�\}}Wn6ttfk
rd}z|�|�WY�dSd}~XYnX|�||�dS)z^source expression
        Try to get source code for the given object and display it.
        N)r/r'r�	TypeErrorr�r7)r2r�r%r&rr�rrr�	do_source�s
z
Pdb.do_sourcerc
Cs�|r|j}|j�|d�}nd}}t||�D]|\}}t|��d�}	t|	�dkrV|	d7}	||krh|	d7}	n|	d7}	||kr�|	d7}	n||kr�|	d7}	|�|	d|���q,d	S)
zPrint a range of lines.r|r��r��Bz->z>>�	N)	rrrCr�rr��rjustr�rVr�)
r2r&rr�rXZcurrent_linenoZ
exc_linenorr �srrrr7s 

zPdb._print_linescCs�z|�|�}WnYdSXd}z|jj}Wntk
rBYnX|r\|�d|j�dSz
|j}Wntk
rzYnX|r�|�d|j�dS|jtkr�|�d|j|j	f�dS|�t|��dS)z;whatis arg
        Print the type of the argument.
        Nz	Method %szFunction %szClass %s.%s)
r/r�r�r�rVr��	__class__�typerr)r2r��valuer,rrr�	do_whatiss.

z
Pdb.do_whatiscCsl|s8|�d�|j�|ji���D]}|�d|�q"n0|�|�}||j�|ji�|<|�d||f�dS)z�display [expression]

        Display the value of the expression if it changed, each time execution
        stops in the current frame.

        Without expression, list all display expressions for the current frame.
        zCurrently displaying:z%s: %rzdisplay %s: %rN)rVr@r�r^r�r��
setdefault)r2r�r��valrrr�
do_display<s

zPdb.do_displaycCsT|r@z|j�|ji�|=WqPtk
r<|�d|�YqPXn|j�|jd�dS)z�undisplay [expression]

        Do not display the expression any more in the current frame.

        Without expression, clear all display expressions for the current frame.
        znot displaying %sN)r@r�r^r�r�rjr�rrr�do_undisplayOszPdb.do_undisplaycs�fdd�|j�|ji�D�S)Ncsg|]}|���r|�qSrr�)r�rr�rrr�_s
�z*Pdb.complete_undisplay.<locals>.<listcomp>)r@r�r^r�rr�r�complete_undisplay^szPdb.complete_undisplaycCs |jj|j�}tjd|d�dS)z�interact

        Start an interactive interpreter whose global namespace
        contains all the (global and local) names found in the current scope.
        z
*interactive*)ZlocalN)r^r#rdr,�interact)r2r�r�rrr�do_interactbszPdb.do_interactcCs�|��}t|�dkrHt|j���}|D]}|�d||j|f�q&dS|d|jkr�t|�dkr�|�d|d|j|df�nd�|dd��|j|d<dS)acalias [name [command [parameter parameter ...] ]]
        Create an alias called 'name' that executes 'command'.  The
        command must *not* be enclosed in quotes.  Replaceable
        parameters can be indicated by %1, %2, and so on, while %* is
        replaced by all the parameters.  If no command is given, the
        current alias for name is shown. If no name is given, all
        aliases are listed.

        Aliases may be nested and can contain anything that can be
        legally typed at the pdb prompt.  Note!  You *can* override
        internal pdb commands with aliases!  Those internal commands
        are then hidden until the alias is removed.  Aliasing is
        recursively applied to the first word of the command line; all
        other words in the line are left alone.

        As an example, here are two useful aliases (especially when
        placed in the .pdbrc file):

        # Print instance variables (usage "pi classInst")
        alias pi for k in %1.__dict__.keys(): print("%1.",k,"=",%1.__dict__[k])
        # Print instance variables in self
        alias ps pi self
        rz%s = %sNrr�)r�r��sortedr?r�rVr�)r2r�r�r�r�rrr�do_aliasks"zPdb.do_aliascCs6|��}t|�dkrdS|d|jkr2|j|d=dS)z9unalias name
        Delete the specified alias.
        rN)r�r�r?)r2r�r�rrr�
do_unalias�s
zPdb.do_unaliascs�fdd�|jD�S)Ncsg|]}|���r|�qSrr�)r��ar�rrr��s
z(Pdb.complete_unalias.<locals>.<listcomp>)r?r�rr�r�complete_unalias�szPdb.complete_unaliasrrrrr#rcCs4z|jD]}|�|�qWntk
r.YnXdSr0)r\rxrU)r2�frame_linenorrrr	�s

zPdb.print_stack_tracecCs6|\}}||jkrd}nd}|�||�||��dS)Nz> z  )r^rVZformat_stack_entry)r2rSZ
prompt_prefixrXrr�rrrrx�s

�zPdb.print_stack_entrycCs�|stj�||�Sz@zt|d|�}|�WWStk
rNt|d|�}YnXWn"tk
rt|�d|�Yn0Xtjjdkr�|�d|�dS|�	|j
���dS)z�h(elp)
        Without argument, print the list of available commands.
        With a command name as argument, print help about that command.
        "help pdb" shows the full pdb documentation.
        "help exec" gives help on the ! command.
        Zhelp_r�zNo help for %rr�zJNo help for %r; please do not run Python with -OO if you need command helpN)r:r;�do_helprvr�r�r<�flags�optimizerVrr�)r2r�ZtopicZcommandrrrrT�s 
�zPdb.do_helpcCs|�|jjpd���dS)a�(!) statement
        Execute the (one-line) statement in the context of the current
        stack frame.  The exclamation point can be omitted unless the
        first word of the statement resembles a debugger command.  To
        assign to a global variable you must always prefix the command
        with a 'global' command, e.g.:
        (Pdb) global list_options; list_options = ['-l']
        (Pdb)
        r6N)rV�	help_execrrkr1rrrrW�s
z
Pdb.help_execcCs
t�dSr0)rr1rrr�help_pdb�szPdb.help_pdbcCs�tj�|�rtj�|�r|Stj�tjd|�}tj�|�rP|�|�|jkrP|Stj�|�\}}|dkrp|d}tj�|�r�|StjD]>}tj�	|�r�t�
|�}q�tj�||�}tj�|�r�|Sq�dS)z�Helper function for break/clear parsing -- may be overridden.

        lookupmodule() translates (possibly incomplete) file or module name
        into an absolute file name.
        rr6r�N)rIrJ�isabs�existsr�r<rprA�splitext�islink�readlink)r2rrf�rootZext�dirname�fullnamerrrr��s"

zPdb.lookupmodulec	Csrd|_d|_ddl}|�|�\}}}|�|j�|_ddl}|j�	�|j�
d|j|j|j|t
d��|�|�dS)NTFr�__main__)r�__file__�__package__�
__loader__�__spec__�__builtins__)rBr!�runpyZ_get_module_detailsrprqrAra�__dict__r_�update�parent�loaderrfr	)r2Zmodule_namergZmod_nameZmod_specr,rarrr�
_runmodule�s 
�zPdb._runmodulec	Cstddl}|j��|j�d|td��d|_|�|�|_d|_t	�
|��}d|��|jf}W5QRX|�|�dS)Nrra)rrbrfTFzexec(compile(%r, %r, 'exec')))
rarhr_rirfrBrprAr!�io�	open_code�readr	)r2rrar�	statementrrr�
_runscript
s
�
�zPdb._runscript)r4NNNFT)r)N)rN)wrrrr�r9rYrZr[rhrerortrsr{r�ryr�rnr�r�r�rlr�rVr�r�r�r�r�Zcomplete_commandsr�r�Zdo_bZcomplete_breakZ
complete_br�Zcomplete_tbreakr�r�r�Zcomplete_enabler�Zcomplete_disablerZcomplete_conditionrZcomplete_ignorerZdo_clZcomplete_clearZcomplete_clr
Zdo_wZdo_btrrZdo_urZdo_drZdo_untrZdo_srZdo_nrZ
do_restartrZdo_rrZdo_cZdo_contrZdo_jr Zcomplete_debugr#Zdo_qZdo_exitr$r-Zdo_ar.Zdo_rvr/r�r0r2Zcomplete_printZ
complete_pZcomplete_ppr:Zdo_lr;Zdo_llr=Zcomplete_sourcer7rFZcomplete_whatisrIZcomplete_displayrJrKrMrOrPrRr�r	�line_prefixrxrTZdo_hrWrXr�rlrqrrrrr�s��
/	


M
]!!.	
		1
!	#	��whereZdownZup�breakZtbreakr_r�r�rZ	conditionrM�stepr�ZuntilZjump�returnZretval�continuer)Zlonglistr�rZppZwhatis�sourceZdisplayZ	undisplayrLr�Zunalias�debug�quitr�z

cCst��|||�dSr0)rr	�rpr�r�rrrr	<scCst��|||�Sr0)rr)Z
expressionr�r�rrrr?scCst|||�dSr0)r	r{rrrr
BscOst�j||�Sr0)rr)r��kwdsrrrrFs)�headercCs,t�}|dk	r|�|�|�t��j�dSr0)rrVrr<�	_getframe�f_back)r}�pdbrrrrIs
cCsB|dkrt��d}|dkr$td��t�}|��|�d|�dS)Nr�zAA valid traceback must be passed if no exception is being handled)r<r�r�rrZrn)�trrrrrQscCsttj�dSr0)rr<�last_tracebackrrrrr
_szimport x; x.main()cCstt�dSr0)r	�TESTCMDrrrr�testgsr�cCsddl}|�t�dSr()�pydocZpagerr)r�rrrrksausage: pdb.py [-c command] ... [-m module | pyfile] [arg] ...

Debug the Python program given by pyfile. Alternatively,
an executable module or package to debug can be specified using
the -m switch.

Initial commands are read from .pdbrc files in your home directory
and in the current directory, if they exist.  Commands supplied with
-c are executed after commands from .pdbrc files.

To let the script run until an exception occurs, use "-c continue".
To let the script run up to a given line X in the debugged file, use
"-c 'until X'".c

Csddl}|�tjdd�dddg�\}}|s>tt�t�d�g}d}|D]B\}}|dkrltt�t��qJ|d	kr�|�|�qJ|d
krJd}qJ|d}|s�tj�	|�s�td|d
�t�d�|tjdd�<|s�tj�
|�}tj�|�tjd<t�}|j
�|�z6|�r|�|�n
|�|�|j�r*W�qtd�Wq�tk
�rrtd|d�tdd�tjdd���Yq�tk
�r�tddd�tt��d�Yq�tk
�r�t��t�d�Yq�t��td�td�t��d}	|�d|	�td|d�Yq�Xq�dS)Nrrzmhc:rzcommand=r�F)z-hz--help)z-cz	--command)z-mTzError:zdoes not existz*The program finished and will be restartedZ
Restartingzwith arguments:r@r�z/The program exited via sys.exit(). Exit status:)r�z2Uncaught exception. Entering post mortem debuggingz1Running 'cont' or 'step' will restart the programz#Post mortem debugger finished. The z will be restarted)�getoptr<rr��_usage�exitr�rIrJrZ�realpathr_rrHrLrlrqr!rr��
SystemExitr��SyntaxErrorr~�	print_excrn)
r�Zoptsr�rMZ
run_as_module�optZoptargrAr�r�rrr�main~sd 



 �r�ra)NN)NN)N)/rrIrmrr<r:r7r*r,r�r1r�r"rr~r�r�r�__all__r!r'r.r�r/rrr8r;rZ_help_orderZ_commandrvrkrWr	rr
rrrr
r�r�rr�r�rr�rrrr�<module>s�C�
		*
� 


D
re.cpython-38.opt-2.pyc000064400000013706150335716500010556 0ustar00U

e5d�=�@s�ddlZddlZddlZddlZzddlZWnek
rDdZYnXdddddddd	d
ddd
dddddddddddddddddgZdZGd d!�d!ej�Z	e
��e	j�ej
Z
d?d"d�Zd@d#d�ZdAd$d�ZdBd%d�ZdCd&d�ZdDd'd�ZdEd(d�ZdFd)d	�ZdGd*d
�Zd+d�ZdHd,d�Zd-d.�d/D�Zd0d
�Zee�d1d��Zee�d1d��d1��ZiZd2Zd3d4�Z e�!e�d5d6��Z"d7d8�Z#d9d:�Z$ddl%Z%d;d<�Z&e%�'ee&e �Gd=d>�d>�Z(dS)I�N�match�	fullmatch�search�sub�subn�split�findall�finditer�compile�purge�template�escape�error�Pattern�Match�A�I�L�M�S�X�U�ASCII�
IGNORECASE�LOCALE�	MULTILINE�DOTALL�VERBOSE�UNICODEz2.2.1c@speZdZejZZejZZ	ej
ZZej
ZZejZZejZZejZZejZZejZdd�Zej Z dS)�	RegexFlagcCs�|jdk	rd|j��S|j}g}|dk}|r2|}|jD],}||j@r8||jM}|�d|j���q8|rx|�t|��d�|�}|r�t|�dkr�d|�d�}n
d|��}|S)Nzre.r�|�z~(�)�~)�_name_�_value_�	__class__�append�hex�join�len)�self�value�members�negative�m�res�r1�/usr/lib64/python3.8/re.py�__repr__�s&




zRegexFlag.__repr__N)!�__name__�
__module__�__qualname__�sre_compile�SRE_FLAG_ASCIIrr�SRE_FLAG_IGNORECASErr�SRE_FLAG_LOCALErr�SRE_FLAG_UNICODErr�SRE_FLAG_MULTILINErr�SRE_FLAG_DOTALLrr�SRE_FLAG_VERBOSErr�SRE_FLAG_TEMPLATE�TEMPLATE�T�SRE_FLAG_DEBUG�DEBUGr3�object�__str__r1r1r1r2r�s







rcCst||��|�S�N)�_compiler��pattern�string�flagsr1r1r2r�scCst||��|�SrF)rGrrHr1r1r2r�scCst||��|�SrF)rGrrHr1r1r2r�scCst||��|||�SrF)rGr�rI�replrJ�countrKr1r1r2r�scCst||��|||�SrF)rGrrLr1r1r2r�s	cCst||��||�SrF)rGr)rIrJ�maxsplitrKr1r1r2r�scCst||��|�SrF)rGrrHr1r1r2r�scCst||��|�SrF)rGr	rHr1r1r2r	�scCs
t||�SrF)rG�rIrKr1r1r2r
�scCst��t��dSrF)�_cache�clear�
_compile_repl�cache_clearr1r1r1r2r�scCst||tB�SrF)rGrArPr1r1r2rscCsi|]}|dt|��qS)�\)�chr)�.0�ir1r1r2�
<dictcomp>srYs()[]{}?*+-|^$\.&~# 	

cCs2t|t�r|�t�St|d�}|�t��d�SdS)N�latin1)�
isinstance�str�	translate�_special_chars_map�encode)rIr1r1r2r
s


�ic
Cs�t|t�r|j}ztt|�||fWStk
r8YnXt|t�rT|rPtd��|St�	|�sft
d��t�||�}|t@s�t
t�tkr�ztttt��=Wntttfk
r�YnX|tt|�||f<|S)Nz5cannot process flags argument with a compiled patternz1first argument must be string or compiled pattern)r[rr,rQ�type�KeyErrorr�
ValueErrorr7�isstring�	TypeErrorr
rCr*�	_MAXCACHE�next�iter�
StopIteration�RuntimeError)rIrK�pr1r1r2rG!s.

�
rGcCst�||�SrF)�	sre_parse�parse_template)rMrIr1r1r2rS;srScCst�||�}t�||�SrF)rlrm�expand_template)rIrrr1r1r2�_expand@srocCs>t||�}|ds.t|d�dkr.|ddS|fdd�}|S)Nrr!cSst�||�SrF)rlrn)rrr1r1r2�filterKsz_subx.<locals>.filter)rSr*)rIrrpr1r1r2�_subxEs

rqcCst|j|jffSrF)rGrIrK)rkr1r1r2�_pickleSsrrc@seZdZddd�Zdd�ZdS)�Scannerrc
Cs�ddlm}m}t|t�r |j}||_g}t��}||_	|D]H\}}|�
�}	|�t�|||	ddt�
||�ffg��|�|	|d�q<t�||d|ffg�}t�|�|_dS)Nr)�BRANCH�
SUBPATTERN���)�
sre_constantsrtrur[rr,�lexiconrl�StaterK�	opengroupr'�
SubPattern�parse�
closegroupr7r
�scanner)
r+rxrKrtrurk�s�phrase�action�gidr1r1r2�__init__\s

�zScanner.__init__c	Cs�g}|j}|j�|�j}d}|�}|s(q�|��}||kr:q�|j|jdd}t|�rj||_|||���}|dk	rz||�|}q|||d�fS)Nrr!)r'r~r�endrx�	lastindex�callable�group)	r+rJ�resultr'rrXr/�jr�r1r1r2�scanms$zScanner.scanN)r)r4r5r6r�r�r1r1r1r2rs[s
rs)r)r)r)rr)rr)rr)r)r)r)r))�enumr7rl�	functools�_locale�ImportError�__all__�__version__�IntFlagr�globals�update�__members__rrrrrrrrr	r
rrr^r
rarrrQrfrG�	lru_cacherSrorq�copyregrr�picklersr1r1r1r2�<module>|s�
�#



	







	

pty.cpython-38.opt-2.pyc000064400000006050150335716500010756 0ustar00U

e5d��@s�ddlmZddlZddlZddlZdddgZdZdZdZdZdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Zeefdd�Zeefdd�ZdS)�)�selectN�openpty�fork�spawn��c	Cs>z
t��WSttfk
r"YnXt�\}}t|�}||fS�N)�osr�AttributeError�OSError�_open_terminal�
slave_open)�	master_fd�
slave_name�slave_fd�r�/usr/lib64/python3.8/pty.pyrs

c	CsLzt��\}}Wnttfk
r(YnXt�|�}t�|�||fSt�Sr)r	rr
r�ttyname�closer)rrrrrr�master_open"s

rc
CsndD]\}dD]R}d||}zt�|tj�}Wntk
rFYqYnX|d||fSqtd��dS)NZpqrstuvwxyzPQRSTZ0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devices)r	�open�O_RDWRr)�x�yZpty_name�fdrrrr2s
rcCsrt�|tj�}zddlm}m}Wntk
r:|YSXz|||d�|||d�Wntk
rlYnX|S)Nr)�ioctl�I_PUSHZptemZldterm)r	rrZfcntlrr�ImportErrorr)Ztty_name�resultrrrrrr
>s
r
c	Cs�zt��\}}Wnttfk
r(Yn4X|tkrTzt��Wntk
rRYnX||fSt�\}}t��}|tkr�t��t�|�t�	|t
�t�	|t�t�	|t�|tkr�t�|�t�
t�t�tj�}t�|�n
t�|�||fSr)r	�forkptyr
r�CHILD�setsidrrr�dup2�STDIN_FILENO�
STDOUT_FILENO�
STDERR_FILENOrrr)�pidrrrZtmp_fdrrrrPs0



cCs"|rt�||�}||d�}qdSr)r	�write)r�data�nrrr�_writenxsr*cCst�|d�S)Ni)r	�read)rrrr�_read~sr,cCsv|tg}t|gg�\}}}||krF||�}|s:|�|�nt�t|�t|kr|t�}|sf|�t�qt||�qdSr)r#r�remover	r'r$r*)r�master_read�
stdin_readZfdsZrfdsZwfdsZxfdsr(rrr�_copy�sr0cCs�t|�td�kr|f}t�d|�t�\}}|tkrHtj|df|��zt�t	�}t�
t	�d}Wntjk
r~d}YnXzt|||�Wn(t
k
r�|r�t�t	tj|�YnXt�|�t�|d�dS)N�z	pty.spawnrr)�type�sys�auditrr r	�execlp�ttyZ	tcgetattrr#Zsetraw�errorr0rZ	tcsetattrZ	TCSAFLUSHr�waitpid)�argvr.r/r&r�modeZrestorerrrr�s&




)rr	r3r6�__all__r#r$r%r rrrr
rr*r,r0rrrrr�<module>	s"
(ipaddress.cpython-38.opt-2.pyc000064400000106453150335716500012130 0ustar00U

e5d��@s�dZddlZdZdZGdd�de�ZGdd�de�Zd	d
�Zd<dd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�ZGd"d#�d#�ZejGd$d%�d%e��ZejGd&d'�d'e��ZGd(d)�d)�ZGd*d+�d+ee�ZGd,d-�d-e�ZGd.d/�d/ee�ZGd0d1�d1�Zee_Gd2d3�d3�ZGd4d5�d5ee�ZGd6d7�d7e�ZGd8d9�d9ee�Z Gd:d;�d;�Z!e!e_dS)=z1.0�N� �c@seZdZdS)�AddressValueErrorN��__name__�
__module__�__qualname__�r	r	�!/usr/lib64/python3.8/ipaddress.pyrsrc@seZdZdS)�NetmaskValueErrorNrr	r	r	r
rsrc	CsXz
t|�WSttfk
r"YnXz
t|�WSttfk
rFYnXtd|��dS)Nz0%r does not appear to be an IPv4 or IPv6 address)�IPv4Addressrr�IPv6Address�
ValueError��addressr	r	r
�
ip_addresss

�rTc	Cs\zt||�WSttfk
r$YnXzt||�WSttfk
rJYnXtd|��dS)Nz0%r does not appear to be an IPv4 or IPv6 network)�IPv4Networkrr�IPv6Networkr)r�strictr	r	r
�
ip_network9s�rc	CsXz
t|�WSttfk
r"YnXz
t|�WSttfk
rFYnXtd|��dS)Nz2%r does not appear to be an IPv4 or IPv6 interface)�
IPv4Interfacerr�
IPv6Interfacerrr	r	r
�ip_interfaceWs

�rcCs0z|�dd�WStk
r*td��YnXdS)N��bigz&Address negative or too large for IPv4��to_bytes�
OverflowErrorrrr	r	r
�v4_int_to_packedzsrcCs0z|�dd�WStk
r*td��YnXdS)N�rz&Address negative or too large for IPv6rrr	r	r
�v6_int_to_packed�s
r cCs*t|��d�}t|�dkr&td|��|S)N�/�zOnly one '/' permitted in %r)�str�split�lenr)r�addrr	r	r
�_split_optional_netmask�sr'ccsNt|�}t|�}}|D]&}|j|jdkr:||fV|}|}q||fVdS�N�)�iter�next�_ip)�	addresses�it�first�last�ipr	r	r
�_find_address_range�s

r2cCs$|dkr|St|||d@���S)Nrr))�min�
bit_length)Znumber�bitsr	r	r
�_count_righthand_zero_bits�sr6ccs�t|t�rt|t�std��|j|jkr8td||f��||krHtd��|jdkrXt}n|jdkrht}ntd��|j}|j}|j}||kr�t	t
||�||d��d�}||||f�}|V|d|>7}|d|jkr�q�q�dS)Nz1first and last must be IP addresses, not networks�%%s and %s are not of the same versionz*last IP address must be greater than firstr�zunknown IP versionr))
�
isinstance�_BaseAddress�	TypeError�versionrrr�_max_prefixlenr,r3r6r4�	_ALL_ONES)r/r0r1Zip_bitsZ	first_intZlast_intZnbits�netr	r	r
�summarize_address_range�s8
��


�r@ccs�t|�}i}|rV|��}|��}|�|�}|dkr<|||<q||kr||=|�|�qd}t|���D]$}|dk	r�|j|jkr�qf|V|}qfdS�N)�list�pop�supernet�get�append�sorted�values�broadcast_address)r-Zto_merge�subnetsr?rDZexistingr0r	r	r
�_collapse_addresses_internals$

rKc	Cs0g}g}g}|D]�}t|t�rR|rF|dj|jkrFtd||df��|�|�q|j|jkr�|r�|dj|jkr�td||df��z|�|j�Wq�tk
r�|�|j	�Yq�Xq|r�|dj|jkr�td||df��|�|�qt
t|��}|�r$t|�D]\}}|�
t||���qt||�S)N���r7)r9r:�_versionr;rF�
_prefixlenr=r1�AttributeError�network_addressrG�setr2�extendr@rK)r-ZaddrsZipsZnetsr1r/r0r	r	r
�collapse_addresses2s@
���rScCs(t|t�r|��St|t�r$|��StSrA)r9�_BaseNetwork�_get_networks_keyr:�_get_address_key�NotImplemented)�objr	r	r
�get_mixed_type_keyhs


rYc@s�eZdZdZedd��Zedd��Zedd��Zedd	��Zd
d�Z	dd
�Z
edd��Zedd��Z
edd��Zedd��Zedd��Zedd��Zdd�ZdS)�_IPAddressBaser	cCs|��SrA)�_explode_shorthand_ip_string��selfr	r	r
�exploded�sz_IPAddressBase.explodedcCst|�SrA�r#r\r	r	r
�
compressed�sz_IPAddressBase.compressedcCs|��SrA)�_reverse_pointerr\r	r	r
�reverse_pointer�s	z_IPAddressBase.reverse_pointercCsdt|�f}t|��dS)Nz%200s has no version specified��type�NotImplementedError�r]�msgr	r	r
r<�sz_IPAddressBase.versioncCsF|dkrd}t|||jf��||jkrBd}t|||j|jf��dS)Nrz-%d (< 0) is not permitted as an IPv%d addressz2%d (>= 2**%d) is not permitted as an IPv%d address)rrMr>r=)r]rrgr	r	r
�_check_int_address�s

�z!_IPAddressBase._check_int_addresscCs.t|�}||kr*d}t|||||jf��dS)Nz6%r (len %d != %d) is not permitted as an IPv%d address)r%rrM)r]rZexpected_lenZaddress_lenrgr	r	r
�_check_packed_address�s�z$_IPAddressBase._check_packed_addresscCs|j|j|?ASrA)r>)�cls�	prefixlenr	r	r
�_ip_int_from_prefix�sz"_IPAddressBase._ip_int_from_prefixc	Cs\t||j�}|j|}||?}d|>d}||krX|jd}|�|d�}d}t||��|S)Nr)�rz&Netmask pattern %r mixes zeroes & ones)r6r=rr)	rj�ip_intZtrailing_zeroesrkZleading_onesZall_onesZbyteslenZdetailsrgr	r	r
�_prefix_from_ip_int�s
�

z"_IPAddressBase._prefix_from_ip_intcCsd|}t|�d�dS)Nz%r is not a valid netmask)r)rjZnetmask_strrgr	r	r
�_report_invalid_netmask�sz&_IPAddressBase._report_invalid_netmaskcCsl|��r|��s|�|�zt|�}Wntk
rD|�|�YnXd|kr\|jkshn|�|�|S�Nr)�isascii�isdigitrp�intrr=)rjZ
prefixlen_strrkr	r	r
�_prefix_from_prefix_string�s

z)_IPAddressBase._prefix_from_prefix_stringcCs�z|�|�}Wntk
r,|�|�YnXz|�|�WStk
rNYnX||jN}z|�|�WStk
r�|�|�YnXdSrA)�_ip_int_from_stringrrprorr>)rj�ip_strrnr	r	r
�_prefix_from_ip_string�s
z%_IPAddressBase._prefix_from_ip_stringcCsHt|ttf�r||jfSt|t�s*t|�}t|�dkr:|S|d|jfS)Nr)r)r9�bytesrtr=�tupler'r%)rjrr	r	r
�_split_addr_prefixs

z!_IPAddressBase._split_addr_prefixcCs|jt|�ffSrA)�	__class__r#r\r	r	r
�
__reduce__/sz_IPAddressBase.__reduce__N)rrr�	__slots__�propertyr^r`rbr<rhri�classmethodrlrorprurxr{r}r	r	r	r
rZ�s0




	




!
rZc@s`eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)r:r	cCs|jSrA�r,r\r	r	r
�__int__>sz_BaseAddress.__int__cCs8z|j|jko|j|jkWStk
r2tYSXdSrA)r,rMrOrW�r]�otherr	r	r
�__eq__As
�z_BaseAddress.__eq__cCsFt|t�stS|j|jkr*td||f��|j|jkrB|j|jkSdS�Nr7F)r9r:rWrMr;r,r�r	r	r
�__lt__Hs
�z_BaseAddress.__lt__cCs t|t�stS|�t|�|�SrA�r9rtrWr|r�r	r	r
�__add__Ts
z_BaseAddress.__add__cCs t|t�stS|�t|�|�SrAr�r�r	r	r
�__sub__Ys
z_BaseAddress.__sub__cCsd|jjt|�fS�Nz%s(%r)�r|rr#r\r	r	r
�__repr__^sz_BaseAddress.__repr__cCst|�|j��SrA)r#�_string_from_ip_intr,r\r	r	r
�__str__asz_BaseAddress.__str__cCsttt|j���SrA)�hash�hexrtr,r\r	r	r
�__hash__dsz_BaseAddress.__hash__cCs
|j|fSrA�rMr\r	r	r
rVgsz_BaseAddress._get_address_keycCs|j|jffSrA)r|r,r\r	r	r
r}jsz_BaseAddress.__reduce__N)rrrr~r�r�r�r�r�r�r�r�rVr}r	r	r	r
r:3s	r:c@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Ze
jdd��Ze
jdd��Zedd��Zedd��Zedd��Zedd ��Zed!d"��Zed#d$��Zd%d&�Zd'd(�Zd)d*�ZdEd-d.�ZdFd/d0�Zed1d2��Zed3d4��Zd5d6�Z d7d8�Z!ed9d:��Z"ed;d<��Z#ed=d>��Z$ed?d@��Z%edAdB��Z&edCdD��Z'd,S)GrTcCsd|jjt|�fSr�r�r\r	r	r
r�vsz_BaseNetwork.__repr__cCsd|j|jfS�N�%s/%d)rPrkr\r	r	r
r�ysz_BaseNetwork.__str__ccs8t|j�}t|j�}t|d|�D]}|�|�Vq"dSr(�rtrPrI�range�_address_class�r]�network�	broadcast�xr	r	r
�hosts|s

z_BaseNetwork.hostsccs8t|j�}t|j�}t||d�D]}|�|�Vq"dSr(r�r�r	r	r
�__iter__�s

z_BaseNetwork.__iter__cCslt|j�}t|j�}|dkr>|||kr0td��|�||�S|d7}|||krZtd��|�||�SdS)Nrzaddress out of ranger))rtrPrI�
IndexErrorr�)r]�nr�r�r	r	r
�__getitem__�s

z_BaseNetwork.__getitem__cCs^t|t�stS|j|jkr*td||f��|j|jkrB|j|jkS|j|jkrZ|j|jkSdSr�)r9rTrWrMr;rP�netmaskr�r	r	r
r��s
�z_BaseNetwork.__lt__cCsLz.|j|jko,|j|jko,t|j�t|j�kWStk
rFtYSXdSrA)rMrPrtr�rOrWr�r	r	r
r��s
��z_BaseNetwork.__eq__cCstt|j�t|j�A�SrA)r�rtrPr�r\r	r	r
r��sz_BaseNetwork.__hash__cCs8|j|jkrdSt|t�rdS|j|jj@|jjkSdS�NF)rMr9rTr,r�rPr�r	r	r
�__contains__�s

z_BaseNetwork.__contains__cCs(|j|kp&|j|kp&|j|kp&|j|kSrA)rPrIr�r	r	r
�overlaps�s



�z_BaseNetwork.overlapscCs|�t|j�t|j�B�SrA)r�rtrP�hostmaskr\r	r	r
rI�s�z_BaseNetwork.broadcast_addresscCs|�t|j�|jA�SrA)r�rtr�r>r\r	r	r
r��sz_BaseNetwork.hostmaskcCsd|j|jfSr�)rPrNr\r	r	r
�with_prefixlen�sz_BaseNetwork.with_prefixlencCsd|j|jfS�N�%s/%s)rPr�r\r	r	r
�with_netmask�sz_BaseNetwork.with_netmaskcCsd|j|jfSr�)rPr�r\r	r	r
�
with_hostmask�sz_BaseNetwork.with_hostmaskcCst|j�t|j�dSr()rtrIrPr\r	r	r
�
num_addresses�sz_BaseNetwork.num_addressescCsdt|�f}t|��dS)Nz%%200s has no associated address classrcrfr	r	r
r��sz_BaseNetwork._address_classcCs|jSrA)rNr\r	r	r
rk�sz_BaseNetwork.prefixlenccs|j|jkstd||f��t|t�s2td|��|�|�sLtd||f��||krXdS|�d|j|jf�}|�	�\}}||kr�||kr�|�|�r�|V|�	�\}}qz|�|�r�|V|�	�\}}qzt
d|||f��qz||kr�|Vn"||kr�|Vnt
d|||f��dS)Nr7z%s is not a network objectz%s not contained in %sr�z3Error performing exclusion: s1: %s s2: %s other: %s)rMr;r9rT�	subnet_ofrr|rPrkrJ�AssertionError)r]r��s1�s2r	r	r
�address_exclude�s@$�


�

��z_BaseNetwork.address_excludecCs`|j|jkrtd||f��|j|jkr,dS|j|jkr<dS|j|jkrLdS|j|jkr\dSdS)Nz"%s and %s are not of the same typerLr)r)rMr;rPr�r�r	r	r
�compare_networks6s!�z_BaseNetwork.compare_networkscCs|j|j|jfSrA)rMrPr�r\r	r	r
rUfsz_BaseNetwork._get_networks_keyr)Nc	cs�|j|jkr|VdS|dk	rJ||jkr0td��|dkr@td��||j}|dkrZtd��|j|}||jkr~td||f��t|j�}t|j�d}t|j�d|?}t|||�D]}|�||f�}|Vq�dS)Nznew prefix must be longerr)�(cannot set prefixlen_diff and new_prefixrzprefix length diff must be > 0z0prefix length diff %d is invalid for netblock %s)	rNr=rrtrPrIr�r�r|)	r]�prefixlen_diff�
new_prefix�
new_prefixlen�start�end�stepZnew_addrZcurrentr	r	r
rJps2



��
z_BaseNetwork.subnetscCs�|jdkr|S|dk	rB||jkr(td��|dkr8td��|j|}|j|}|dkrftd|j|f��|�t|j�t|j�|>@|f�S)Nrznew prefix must be shorterr)r�z;current prefixlen is %d, cannot have a prefixlen_diff of %d)rNrrkr|rtrPr�)r]r�r�r�r	r	r
rD�s&



���z_BaseNetwork.supernetcCs|jjo|jjSrA)rP�is_multicastrIr\r	r	r
r��s	�z_BaseNetwork.is_multicastcCshz:|j|jkr"t|�d|�d���|j|jko8|j|jkWStk
rbtd|�d|����YnXdS)Nz and z are not of the same versionz*Unable to test subnet containment between )rMr;rPrIrO)�a�br	r	r
�
_is_subnet_of�s
�z_BaseNetwork._is_subnet_ofcCs|�||�SrA�r�r�r	r	r
r��sz_BaseNetwork.subnet_ofcCs|�||�SrAr�r�r	r	r
�supernet_of�sz_BaseNetwork.supernet_ofcCs|jjo|jjSrA)rP�is_reservedrIr\r	r	r
r��s	�z_BaseNetwork.is_reservedcCs|jjo|jjSrA)rP�
is_link_localrIr\r	r	r
r��s�z_BaseNetwork.is_link_localcCs|jjo|jjSrA)rP�
is_privaterIr\r	r	r
r�s	�z_BaseNetwork.is_privatecCs|jSrA�r�r\r	r	r
�	is_globals	z_BaseNetwork.is_globalcCs|jjo|jjSrA)rP�is_unspecifiedrIr\r	r	r
r�s	�z_BaseNetwork.is_unspecifiedcCs|jjo|jjSrA)rP�is_loopbackrIr\r	r	r
r�(s	�z_BaseNetwork.is_loopback)r)N)r)N)(rrrr�r�r�r�r�r�r�r�r�r��	functools�cached_propertyrIr�rr�r�r�r�r�rkr�r�rUrJrDr��staticmethodr�r�r�r�r�r�r�r�r�r	r	r	r
rTnsb








K0

5
)








rTc@s�eZdZdZdZdedZeZiZdd�Z	e
dd��Ze
d	d
��Ze
dd��Z
e
d
d��Zdd�Zedd��Zedd��ZdS)�_BaseV4r	rr"r)cCst|�SrAr_r\r	r	r
r[Hsz$_BaseV4._explode_shorthand_ip_stringcCs�||jkr�t|t�r<|}d|kr.|jksjn|�|�n.z|�|�}Wntk
rh|�|�}YnXt|�	|��}||f|j|<|j|Srq)
�_netmask_cacher9rtr=rprurrxrrl�rj�argrkr�r	r	r
�
_make_netmaskKs	

z_BaseV4._make_netmaskc
Cs~|std��|�d�}t|�dkr.td|��zt�t|j|�d�WStk
rx}ztd||f�d�W5d}~XYnXdS)N�Address cannot be empty�.rzExpected 4 octets in %rr�%s in %r)rr$r%rt�
from_bytes�map�_parse_octetr)rjrwZoctets�excr	r	r
rves
z_BaseV4._ip_int_from_stringcCs�|std��|��r|��s,d}t||��t|�dkrHd}t||��|dkrl|ddkrld}t||��t|d�}|d	kr�td
|��|S)NzEmpty octet not permittedz#Only decimal digits permitted in %r�z$At most 3 characters permitted in %r�0rz%Leading zeros are not permitted in %r�
�zOctet %d (> 255) not permitted)rrrrsr%rt)rjZ	octet_strrgZ	octet_intr	r	r
r�s
z_BaseV4._parse_octetcCsd�tt|�dd���S)Nr�rr)�joinr�r#r)rjrnr	r	r
r��sz_BaseV4._string_from_ip_intcCs&t|��d�ddd�}d�|�dS)Nr�rLz
.in-addr.arpa)r#r$r�)r]Zreverse_octetsr	r	r
ra�sz_BaseV4._reverse_pointercCs|jSrA�r=r\r	r	r
�
max_prefixlen�sz_BaseV4.max_prefixlencCs|jSrAr�r\r	r	r
r<�sz_BaseV4.versionN)rrrr~rM�
IPV4LENGTHr>r=r�r[r�r�rvr�r�rarr�r<r	r	r	r
r�5s&	


#
	
r�c@s�eZdZdZdd�Zedd��Zedd��Zee�	�dd	���Z
ee�	�d
d���Zedd
��Zedd��Z
edd��Zedd��ZdS)r�r,�__weakref__cCsrt|t�r|�|�||_dSt|t�rF|�|d�t�|d�|_dSt|�}d|krbtd|��|�	|�|_dS)Nrrr!�Unexpected '/' in %r�
r9rtrhr,ryrir�r#rrv�r]rZaddr_strr	r	r
�__init__�s


zIPv4Address.__init__cCs
t|j�SrA)rr,r\r	r	r
�packed�szIPv4Address.packedcCs||jjkSrA)�
_constants�_reserved_networkr\r	r	r
r��s	zIPv4Address.is_reservedcst�fdd��jjD��S)Nc3s|]}�|kVqdSrAr	��.0r?r\r	r
�	<genexpr>sz)IPv4Address.is_private.<locals>.<genexpr>��anyr��_private_networksr\r	r\r
r��s
zIPv4Address.is_privatecCs||jjko|jSrA)r��_public_networkr�r\r	r	r
r�szIPv4Address.is_globalcCs||jjkSrA�r��_multicast_networkr\r	r	r
r�s	zIPv4Address.is_multicastcCs||jjkSrA)r��_unspecified_addressr\r	r	r
r�s	zIPv4Address.is_unspecifiedcCs||jjkSrA)r��_loopback_networkr\r	r	r
r�"szIPv4Address.is_loopbackcCs||jjkSrA�r��_linklocal_networkr\r	r	r
r�,szIPv4Address.is_link_localN)rrrr~r�rr�r�r��	lru_cacher�r�r�r�r�r�r	r	r	r
r�s(#








	rc@sxeZdZdd�Zejdd��Zdd�Zdd�Zd	d
�Z	dd�Z
ejZe
d
d��Ze
dd��Ze
dd��Ze
dd��ZdS)rcCsD|�|�\}}t�||�t||fdd�|_|jj|_|jj|_dS�NF)r)r{rr�rr�r�rN�r]rr&�maskr	r	r
r�9s

zIPv4Interface.__init__cCs|jjSrA�r�r�r\r	r	r
r�AszIPv4Interface.hostmaskcCsd|�|j�|jfSr��r�r,rNr\r	r	r
r�Es�zIPv4Interface.__str__cCsFt�||�}|r|tkr|Sz|j|jkWStk
r@YdSXdSr�)rr�rWr�rO�r]r�Z
address_equalr	r	r
r�IszIPv4Interface.__eq__cCsRt�||�}|tkrtSz|j|jkp4|j|jko4|WStk
rLYdSXdSr�)rr�rWr�rO�r]r�Zaddress_lessr	r	r
r�Us�zIPv4Interface.__lt__cCst|j|jt|jj�f�SrA�r�r,rNrtr�rPr\r	r	r
r�aszIPv4Interface.__hash__cCs
t|j�SrA)rr,r\r	r	r
r1fszIPv4Interface.ipcCsd|�|j�|jfSr�r�r\r	r	r
r�js�zIPv4Interface.with_prefixlencCsd|�|j�|jfSr��r�r,r�r\r	r	r
r�os�zIPv4Interface.with_netmaskcCsd|�|j�|jfSr��r�r,r�r\r	r	r
r�ts�zIPv4Interface.with_hostmaskN)rrrr�r�r�r�r�r�r�r�rZr}rr1r�r�r�r	r	r	r
r7s 



rc@s.eZdZeZddd�Zee��dd���Z	dS)rTcs�|�|�\�}t��|_|�|�\|_|_t|j�}|t|j�@|krl|rXtd|��nt|t|j�@�|_|j|jdkr�|j	|_
n|j|jkr��fdd�|_
dS)N�%s has host bits setr)cs
t��gSrA)rr	�r&r	r
�<lambda>��z&IPv4Network.__init__.<locals>.<lambda>)r{rrPr�r�rNrtrr=r�r��r]rrr�r�r	rr
r��s#

�
zIPv4Network.__init__cCs&|jtd�ko|jtd�ko$|jS)N�
100.64.0.0/10)rPrrIr�r\r	r	r
r��s

��zIPv4Network.is_globalN)T)
rrrrr�r�rr�r�r�r	r	r	r
rzs


4rc@s�eZdZed�Zed�Zed�Zed�Zed�ed�ed�ed�ed�ed�ed	�ed
�ed�ed�ed
�ed�ed�ed�gZed�Z	e
d�ZdS)�_IPv4Constantsz169.254.0.0/16z127.0.0.0/8z224.0.0.0/4rz	0.0.0.0/8z
10.0.0.0/8z
172.16.0.0/12z192.0.0.0/29z192.0.0.170/31z192.0.2.0/24z192.168.0.0/16z
198.18.0.0/15z198.51.100.0/24z203.0.113.0/24z240.0.0.0/4z255.255.255.255/32z0.0.0.0N)rrrrr�r�r�r�r�r�rr�r	r	r	r
r�s*�rc@s�eZdZdZdZdedZdZed�Z	eZ
iZedd��Z
ed	d
��Zedd��Zed
d��Zeddd��Zdd�Zdd�Zedd��Zedd��ZdS)�_BaseV6r	r8r"r)rmZ0123456789ABCDEFabcdefcCsl||jkrbt|t�r<|}d|kr.|jksFn|�|�n
|�|�}t|�|��}||f|j|<|j|Srq)r�r9rtr=rprur
rlr�r	r	r
r�s	


z_BaseV6._make_netmaskc
Cs�|std��|�d�}d}t|�|kr:d||f}t|��d|dkr�zt|���j}Wn4tk
r�}ztd||f�d�W5d}~XYnX|�d|d	?d
@�|�d|d
@�|jd}t|�|kr�d|d|f}t|��d}tdt|�d�D]*}	||	s�|dk	�r d
|}t|��|	}q�|dk	�r�|}
t|�|d}|d�sl|
d8}
|
�rld}t||��|d�s�|d8}|�r�d}t||��|j|
|}|dk�r2d}t||jd|f��njt|�|jk�r�d}t||j|f��|d�sd}t||��|d�s"d}t||��t|�}
d}d}znd}
t|
�D] }	|
d	K}
|
|�	||	�O}
�q@|
d	|K}
t|d�D] }	|
d	K}
|
|�	||	�O}
�qz|
WSt
k
�r�}ztd||f�d�W5d}~XYnXdS)Nr��:r�z At least %d parts expected in %rr�rLr��%xr�r)z!At most %d colons permitted in %rz At most one '::' permitted in %rrz0Leading ':' only permitted as part of '::' in %rz1Trailing ':' only permitted as part of '::' in %rz/Expected at most %d other parts with '::' in %rz,Exactly %d parts expected without '::' in %r)rr$r%rrCr,rF�
_HEXTET_COUNTr��
_parse_hextetr)rjrw�partsZ
_min_partsrgZipv4_intr�Z
_max_partsZ
skip_index�iZparts_hiZparts_loZ
parts_skippedrnr	r	r
rvs�
$







z_BaseV6._ip_int_from_stringcCs>|j�|�std|��t|�dkr4d}t||��t|d�S)NzOnly hex digits permitted in %rrz$At most 4 characters permitted in %rr)�_HEX_DIGITS�
issupersetrr%rt)rjZ
hextet_strrgr	r	r
r~sz_BaseV6._parse_hextetc	Cs�d}d}d}d}t|�D]>\}}|dkrN|d7}|dkr<|}||krV|}|}qd}d}q|dkr�||}|t|�kr~|dg7}dg|||�<|dkr�dg|}|S)NrLrr�r)�)�	enumerater%)	rj�hextetsZbest_doublecolon_startZbest_doublecolon_lenZdoublecolon_startZdoublecolon_len�indexZhextetZbest_doublecolon_endr	r	r
�_compress_hextets�s0�

z_BaseV6._compress_hextetsNcsZ|dkrt|j�}||jkr$td��d|��fdd�tddd�D�}|�|�}d�|�S)	NzIPv6 address is too large�%032xcs&g|]}dt�||d�d��qS)rrr)rt�r�r��Zhex_strr	r
�
<listcomp>�sz/_BaseV6._string_from_ip_int.<locals>.<listcomp>rrrr)rtr,r>rr�rr�)rjrnrr	rr
r��s


z_BaseV6._string_from_ip_intcs�t|t�rt|j�}nt|t�r,t|j�}nt|�}|�|�}d|��fdd�tddd�D�}t|ttf�r�dd�	|�|j
fSd�	|�S)	Nrcsg|]}�||d��qS)rr	rrr	r
r�sz8_BaseV6._explode_shorthand_ip_string.<locals>.<listcomp>rrrr�r)r9rr#rPrr1rvr�rTr�rN)r]rwrnrr	rr
r[�s



z$_BaseV6._explode_shorthand_ip_stringcCs&|jddd��dd�}d�|�dS)NrLrrr�z	.ip6.arpa)r^�replacer�)r]Z
reverse_charsr	r	r
ra�sz_BaseV6._reverse_pointercCs|jSrAr�r\r	r	r
r�sz_BaseV6.max_prefixlencCs|jSrAr�r\r	r	r
r<sz_BaseV6.version)N)rrrr~rM�
IPV6LENGTHr>r
�	frozensetrr=r�r�r�rvrrr�r[rarr�r<r	r	r	r
r�s.	

g

/	
rc@s�eZdZdZdd�Zedd��Zedd��Zedd	��Zed
d��Z	edd
��Z
ee��dd���Z
edd��Zedd��Zedd��Zedd��Zedd��Zedd��ZdS)r
r�cCsrt|t�r|�|�||_dSt|t�rF|�|d�t�|d�|_dSt|�}d|krbtd|��|�	|�|_dS)Nrrr!r�r�r�r	r	r
r�s


zIPv6Address.__init__cCs
t|j�SrA)r r,r\r	r	r
r�6szIPv6Address.packedcCs||jjkSrAr�r\r	r	r
r�;s	zIPv6Address.is_multicastcst�fdd��jjD��S)Nc3s|]}�|kVqdSrAr	rr\r	r
r�Osz*IPv6Address.is_reserved.<locals>.<genexpr>)r�r��_reserved_networksr\r	r\r
r�Fs	zIPv6Address.is_reservedcCs||jjkSrAr�r\r	r	r
r�QszIPv6Address.is_link_localcCs||jjkSrA)r��_sitelocal_networkr\r	r	r
�
is_site_local[szIPv6Address.is_site_localcst�fdd��jjD��S)Nc3s|]}�|kVqdSrAr	r�r\r	r
r�ssz)IPv6Address.is_private.<locals>.<genexpr>r�r\r	r\r
r�is
zIPv6Address.is_privatecCs|jSrAr�r\r	r	r
r�us	zIPv6Address.is_globalcCs
|jdkSrqr�r\r	r	r
r��s	zIPv6Address.is_unspecifiedcCs
|jdkSr(r�r\r	r	r
r��s	zIPv6Address.is_loopbackcCs |jd?dkrdSt|jd@�S)Nrr	����r,rr\r	r	r
�ipv4_mapped�s	zIPv6Address.ipv4_mappedcCs4|jd?dkrdSt|jd?d@�t|jd@�fS)N�`i �@rr r\r	r	r
�teredo�s

�zIPv6Address.teredocCs$|jd?dkrdSt|jd?d@�S)N�pi �Prr r\r	r	r
�	sixtofour�s	zIPv6Address.sixtofourN)rrrr~r�rr�r�r�r�rr�r�r�r�r�r�r!r$r'r	r	r	r
r
s6$





	










r
c@s�eZdZdd�Zejdd��Zdd�Zdd�Zd	d
�Z	dd�Z
ejZe
d
d��Ze
dd��Ze
dd��Ze
dd��Ze
dd��Ze
dd��ZdS)rcCsD|�|�\}}t�||�t||fdd�|_|jj|_|jj|_dSr�)r{r
r�rr�r�rNr�r	r	r
r��s

zIPv6Interface.__init__cCs|jjSrAr�r\r	r	r
r��szIPv6Interface.hostmaskcCsd|�|j�|jfSr�r�r\r	r	r
r��s�zIPv6Interface.__str__cCsFt�||�}|r|tkr|Sz|j|jkWStk
r@YdSXdSr�)r
r�rWr�rOr�r	r	r
r��szIPv6Interface.__eq__cCsRt�||�}|tkrtSz|j|jkp4|j|jko4|WStk
rLYdSXdSr�)r
r�rWr�rOr�r	r	r
r��s�zIPv6Interface.__lt__cCst|j|jt|jj�f�SrAr�r\r	r	r
r��szIPv6Interface.__hash__cCs
t|j�SrA)r
r,r\r	r	r
r1�szIPv6Interface.ipcCsd|�|j�|jfSr�r�r\r	r	r
r��s�zIPv6Interface.with_prefixlencCsd|�|j�|jfSr�r�r\r	r	r
r��s�zIPv6Interface.with_netmaskcCsd|�|j�|jfSr�r�r\r	r	r
r��s�zIPv6Interface.with_hostmaskcCs|jdko|jjSrq)r,r�r�r\r	r	r
r�szIPv6Interface.is_unspecifiedcCs|jdko|jjSr()r,r�r�r\r	r	r
r�szIPv6Interface.is_loopbackN)rrrr�r�r�r�r�r�r�r�rZr}rr1r�r�r�r�r�r	r	r	r
r�s(





rc@s.eZdZeZd	dd�Zdd�Zedd��ZdS)
rTcs�|�|�\�}t��|_|�|�\|_|_t|j�}|t|j�@|krl|rXtd|��nt|t|j�@�|_|j|jdkr�|j	|_
n|j|jkr��fdd�|_
dS)Nr�r)cs
t��gSrA)r
r	rr	r
rIrz&IPv6Network.__init__.<locals>.<lambda>)r{r
rPr�r�rNrtrr=r�r�rr	rr
r�s

�
zIPv6Network.__init__ccs<t|j�}t|j�}t|d|d�D]}|�|�Vq&dSr(r�r�r	r	r
r�Ks

zIPv6Network.hostscCs|jjo|jjSrA)rPrrIr\r	r	r
rWs�zIPv6Network.is_site_localN)T)	rrrr
r�r�r�rrr	r	r	r
rs

0rc@s�eZdZed�Zed�Zed�ed�ed�ed�ed�ed�ed	�ed
�ed�ed�g
Zed�ed
�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�ed�gZed�ZdS)�_IPv6Constantsz	fe80::/10zff00::/8z::1/128z::/128z
::ffff:0:0/96z100::/64z	2001::/23z2001:2::/48z
2001:db8::/32z2001:10::/28zfc00::/7z::/8z100::/8z200::/7z400::/6z800::/5z1000::/4z4000::/3z6000::/3z8000::/3zA000::/3zC000::/3zE000::/4zF000::/5zF800::/6zFE00::/9z	fec0::/10N)	rrrrr�r�r�rrr	r	r	r
r(gs<��r()T)"�__version__r�r�rrrrrrrrr r'r2r6r@rKrSrYrZ�total_orderingr:rTr�rrrrr�rr
rrr(r	r	r	r
�<module>sT
#7163:IuCR 5K\!rlcompleter.cpython-38.opt-1.pyc000064400000013175150335716500012477 0ustar00U

e5d��@s�dZddlZddlZddlZdgZGdd�d�Zdd�ZzddlZWnek
r\dZ	Yn"Xe�
e�j�e�dd	��d
Z	dS)a1Word completion for GNU readline.

The completer completes keywords, built-ins and globals in a selectable
namespace (which defaults to __main__); when completing NAME.NAME..., it
evaluates (!) the expression up to the last dot and completes its attributes.

It's very cool to do "import sys" type "sys.", hit the completion key (twice),
and see the list of names defined by the sys module!

Tip: to use the tab key as the completion key, call

    readline.parse_and_bind("tab: complete")

Notes:

- Exceptions raised by the completer function are *ignored* (and generally cause
  the completion to fail).  This is a feature -- since readline sets the tty
  device in raw (or cbreak) mode, printing a traceback wouldn't work well
  without some complicated hoopla to save, reset and restore the tty state.

- The evaluation of the NAME.NAME... form may cause arbitrary application
  defined code to be executed if an object with a __getattr__ hook is found.
  Since it is the responsibility of the application (or the user) to enable this
  feature, I consider this an acceptable risk.  More complicated expressions
  (e.g. function calls or indexing operations) are *not* evaluated.

- When the original stdin is not a tty device, GNU readline is never
  used, and this module (and the readline module) are silently inactive.

�N�	Completerc@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rNcCs6|rt|t�std��|dkr&d|_nd|_||_dS)a�Create a new completer for the command line.

        Completer([namespace]) -> completer instance.

        If unspecified, the default namespace where completions are performed
        is __main__ (technically, __main__.__dict__). Namespaces should be
        given as dictionaries.

        Completer instances should be used as the completion mechanism of
        readline via the set_completer() call:

        readline.set_completer(Completer(my_namespace).complete)
        znamespace must be a dictionaryN�r)�
isinstance�dict�	TypeError�use_main_ns�	namespace)�selfr�r
�#/usr/lib64/python3.8/rlcompleter.py�__init__'szCompleter.__init__cCs�|jrtj|_|��sB|dkr>tr8t�d�t��dSdSndS|dkrld|kr`|�	|�|_
n|�|�|_
z|j
|WStk
r�YdSXdS)z�Return the next possible completion for 'text'.

        This is called successively with state == 0, 1, 2, ... until it
        returns None.  The completion should begin with 'text'.

        r�	�N�.)
r�__main__�__dict__r�strip�_readline_available�readlineZinsert_textZ	redisplay�attr_matches�matches�global_matches�
IndexError)r	�text�stater
r
r�completeBs$
zCompleter.completecCst|�r|d}|S)N�()�callable)r	�val�wordr
r
r�_callable_postfixaszCompleter._callable_postfixc	Cs�ddl}g}dh}t|�}|jD]J}|d|�|kr |�|�|dkrP|d}n|dkr`|d}|�|�q |jtjfD]J}|��D]<\}}|d|�|kr�||kr�|�|�|�|�	||��q�qx|S)z�Compute matches when text is a simple name.

        Return a list of all keywords, built-in functions and names currently
        defined in self.namespace that match.

        rN�__builtins__>�try�finally�:>�break�None�pass�continue�False�True�else� )
�keyword�len�kwlist�add�appendr�builtinsr�itemsr )	r	rr-r�seen�nrZnspacerr
r
rrfs$



zCompleter.global_matchesc	Cshddl}|�d|�}|sgS|�dd�\}}zt||j�}Wntk
rTgYSXtt|��}|�d�t	|d�r�|�
d�|�t|j
��g}t|�}	|dkr�d	}
n|d	kr�d
}
nd}
|D]t}|d|	�|kr�|
r�|d|	d�|
ks�d||f}zt||�}
Wntk
�rYnX|�|
|�}|�|�q�|�s\|
�sF�q\|
d	k�rVd
}
q�d}
q�|��|S)a�Compute matches when text contains a dot.

        Assuming the text is of the form NAME.NAME....[NAME], and is
        evaluable in self.namespace, it will be evaluated and its attributes
        (as revealed by dir()) are used as possible completions.  (For class
        instances, class members are also considered.)

        WARNING: this can still invoke arbitrary C code, if an object
        with a __getattr__ hook is evaluated.

        rNz(\w+(\.\w+)*)\.(\w*)r�r!�	__class__r�_�__z%s.%s)�re�match�group�evalr�	Exception�set�dir�discard�hasattrr0�update�get_class_membersr7r.�getattrr r1�sort)r	rr:�m�expr�attrZ
thisobjectZwordsrr5Znoprefixrr;rr
r
rr�sR



��
zCompleter.attr_matches)N)�__name__�
__module__�__qualname__rrr rrr
r
r
rr&s

cCs.t|�}t|d�r*|jD]}|t|�}q|S)N�	__bases__)r@rBrMrD)�klassZret�baser
r
rrD�s


rDFcCs
t�d�S)N)r�
set_completerr
r
r
r�<lambda>��rQT)
�__doc__�atexitr2r�__all__rrDr�ImportErrorrrPr�registerr
r
r
r�<module>s
functools.cpython-38.pyc000064400000066377150335716500011240 0ustar00U

e5d��
@s�dZddddddddd	d
ddd
g
ZddlmZddlmZddlmZddlm	Z	dZ
dZe
efdd�Ze
efdd�Z
efdd�Zefdd�Zefdd�Zefdd�Zefdd �Zefd!d"�Zefd#d$�Zefd%d&�Zefd'd(�Zefd)d*�Zefd+d,�Zefd-d.�Zd/efd0efd1efgd1efd2efd/efgd2efd1efd0efgd0efd/efd2efgd3�Zd4d�Zd5d�Zzdd6lmZWnek
�r�YnXe �Z!e!fd7d�Z"zdd8lm"Z"Wnek
�r�YnXGd9d	�d	�Z#zdd:lm#Z#Wnek
�rYnXGd;d
�d
e �Z$d<d=�Z%ed>d?d@dAdBg�Z&GdCdD�dDe'�Z(e �fe)e*he+e,e-fdEdF�Z.dYdId�Z/dJdK�Z0zddLlm0Z0Wnek
�r�YnXdMdN�Z1dZdPdQ�Z2dRdS�Z3dTdU�Z4dVd�Z5GdWd�d�Z6e �Z7GdXd
�d
�Z8dOS)[zEfunctools.py - Tools for working with functions and callable objects
�update_wrapper�wraps�WRAPPER_ASSIGNMENTS�WRAPPER_UPDATES�total_ordering�
cmp_to_key�	lru_cache�reduce�partial�
partialmethod�singledispatch�singledispatchmethod�cached_property�)�get_cache_token)�
namedtuple)�recursive_repr)�RLock)�
__module__�__name__�__qualname__�__doc__�__annotations__)�__dict__c	Csf|D]4}zt||�}Wntk
r*YqXt|||�q|D]}t||��t||i��q>||_|S)aUpdate a wrapper function to look like the wrapped function

       wrapper is the function to be updated
       wrapped is the original function
       assigned is a tuple naming the attributes assigned directly
       from the wrapped function to the wrapper function (defaults to
       functools.WRAPPER_ASSIGNMENTS)
       updated is a tuple naming the attributes of the wrapper that
       are updated with the corresponding attribute from the wrapped
       function (defaults to functools.WRAPPER_UPDATES)
    )�getattr�AttributeError�setattr�update�__wrapped__)�wrapper�wrapped�assigned�updated�attr�value�r$�!/usr/lib64/python3.8/functools.pyr"scCstt|||d�S)a�Decorator factory to apply update_wrapper() to a wrapper function

       Returns a decorator that invokes update_wrapper() with the decorated
       function as the wrapper argument and the arguments to wraps() as the
       remaining arguments. Default arguments are as for update_wrapper().
       This is a convenience function to simplify applying partial() to
       update_wrapper().
    �rr r!)r	rr&r$r$r%r@s�cCs$|�|�}||kr|S|o"||kS)zIReturn a > b.  Computed by @total_ordering from (not a < b) and (a != b).��__lt__��self�other�NotImplemented�	op_resultr$r$r%�_gt_from_ltXs
r.cCs|�|�}|p||kS)zEReturn a <= b.  Computed by @total_ordering from (a < b) or (a == b).r'r)r$r$r%�_le_from_lt_s
r/cCs|�|�}||kr|S|S)z=Return a >= b.  Computed by @total_ordering from (not a < b).r'r)r$r$r%�_ge_from_ltds
r0cCs$|�|�}||kr|S|p"||kS)zJReturn a >= b.  Computed by @total_ordering from (not a <= b) or (a == b).��__le__r)r$r$r%�_ge_from_leks
r3cCs"|�|�}||kr|S|o ||kS)zFReturn a < b.  Computed by @total_ordering from (a <= b) and (a != b).r1r)r$r$r%�_lt_from_lers
r4cCs|�|�}||kr|S|S)z=Return a > b.  Computed by @total_ordering from (not a <= b).r1r)r$r$r%�_gt_from_leys
r5cCs$|�|�}||kr|S|o"||kS)zIReturn a < b.  Computed by @total_ordering from (not a > b) and (a != b).��__gt__r)r$r$r%�_lt_from_gt�s
r8cCs|�|�}|p||kS)zEReturn a >= b.  Computed by @total_ordering from (a > b) or (a == b).r6r)r$r$r%�_ge_from_gt�s
r9cCs|�|�}||kr|S|S)z=Return a <= b.  Computed by @total_ordering from (not a > b).r6r)r$r$r%�_le_from_gt�s
r:cCs$|�|�}||kr|S|p"||kS)zJReturn a <= b.  Computed by @total_ordering from (not a >= b) or (a == b).��__ge__r)r$r$r%�_le_from_ge�s
r=cCs"|�|�}||kr|S|o ||kS)zFReturn a > b.  Computed by @total_ordering from (a >= b) and (a != b).r;r)r$r$r%�_gt_from_ge�s
r>cCs|�|�}||kr|S|S)z=Return a < b.  Computed by @total_ordering from (not a >= b).r;r)r$r$r%�_lt_from_ge�s
r?r7r2r<r()r(r2r7r<csV�fdd�tD�}|std��t|�}t|D]"\}}||kr.||_t�||�q.�S)z6Class decorator that fills in missing ordering methodscs(h|] }t�|d�tt|d�k	r|�qS�N)r�object)�.0�op��clsr$r%�	<setcomp>�sz!total_ordering.<locals>.<setcomp>z6must define at least one ordering operation: < > <= >=)�_convert�
ValueError�maxrr)rE�roots�root�opname�opfuncr$rDr%r�scsG�fdd�dt�}|S)z,Convert a cmp= function into a key= functioncsZeZdZdgZdd�Z�fdd�Z�fdd�Z�fdd	�Z�fd
d�Z�fdd
�Z	dZ
dS)zcmp_to_key.<locals>.K�objcSs
||_dSr@�rN)r*rNr$r$r%�__init__�szcmp_to_key.<locals>.K.__init__cs�|j|j�dkS�NrrO�r*r+��mycmpr$r%r(�szcmp_to_key.<locals>.K.__lt__cs�|j|j�dkSrQrOrRrSr$r%r7�szcmp_to_key.<locals>.K.__gt__cs�|j|j�dkSrQrOrRrSr$r%�__eq__�szcmp_to_key.<locals>.K.__eq__cs�|j|j�dkSrQrOrRrSr$r%r2�szcmp_to_key.<locals>.K.__le__cs�|j|j�dkSrQrOrRrSr$r%r<�szcmp_to_key.<locals>.K.__ge__N)rrr�	__slots__rPr(r7rUr2r<�__hash__r$rSr$r%�K�srX)rA)rTrXr$rSr%r�s)rcCsZt|�}|tkr>zt|�}WqBtk
r:td�d�YqBXn|}|D]}|||�}qF|S)a�
    reduce(function, sequence[, initial]) -> value

    Apply a function of two arguments cumulatively to the items of a sequence,
    from left to right, so as to reduce the sequence to a single value.
    For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates
    ((((1+2)+3)+4)+5).  If initial is present, it is placed before the items
    of the sequence in the calculation, and serves as a default when the
    sequence is empty.
    z0reduce() of empty sequence with no initial valueN)�iter�_initial_missing�next�
StopIteration�	TypeError)ZfunctionZsequence�initial�itr#Zelementr$r$r%r�s)rcsJeZdZdZdZ�fdd�Zdd�Ze�dd��Zd	d
�Z	dd�Z
�ZS)
r	zSNew function with partial application of the given arguments
    and keywords.
    )�func�args�keywordsr�__weakref__csZt|�std��t|d�r4|j|}|j|�}|j}tt|��|�}||_||_||_|S)Nz#the first argument must be callabler`)	�callabler]�hasattrrarbr`�superr	�__new__)rEr`rarbr*��	__class__r$r%rgs


zpartial.__new__cOs|j|�}|j|j|�|�Sr@�rbr`ra)r*rarbr$r$r%�__call__%s
zpartial.__call__cCs�t|�j}t|j�g}|�dd�|jD��|�dd�|j��D��t|�jdkrld|�dd�	|��d�S|�dd�	|��d�S)	Ncss|]}t|�VqdSr@)�repr)rB�xr$r$r%�	<genexpr>-sz#partial.__repr__.<locals>.<genexpr>css |]\}}|�d|��VqdS)�=Nr$�rB�k�vr$r$r%rn.s�	functoolsz
functools.�(�, �))
�typerrlr`�extendrarb�itemsr�join)r*�qualnamerar$r$r%�__repr__)s
zpartial.__repr__cCs*t|�|jf|j|j|jpd|jp$dffSr@)rwr`rarbr�r*r$r$r%�
__reduce__3s�zpartial.__reduce__cCs�t|t�std��t|�dkr0tdt|�����|\}}}}t|�rrt|t�rr|dk	r`t|t�rr|dk	rzt|t�sztd��t|�}|dkr�i}nt|�tk	r�t|�}|dkr�i}||_||_||_	||_
dS)Nz(argument to __setstate__ must be a tuple�zexpected 4 items in state, got zinvalid partial state)�
isinstance�tupler]�lenrd�dictrwrr`rarb)r*�stater`ra�kwds�	namespacer$r$r%�__setstate__7s4
����zpartial.__setstate__)rrrrrVrgrkrr|r~r��
__classcell__r$r$rhr%r	s
	)r	c@sDeZdZdZdd�Zde_dd�Zdd�Zdd
d�Ze	dd
��Z
d	S)r
z�Method descriptor with partial application of the given arguments
    and keywords.

    Supports wrapping existing descriptors and handles non-descriptor
    callables as instance methods.
    cOs�t|�dkr|^}}}nV|s&td��nHd|krZ|�d�}|^}}ddl}|jdtdd�ntdt|�d��t|�}t|�s�t|d	�s�td
�	|���t
|t�r�|j|_|j
||_
|j|�|_n||_||_
||_dS)N�z8descriptor '__init__' of partialmethod needs an argumentr`rz0Passing 'func' as keyword argument is deprecated)�
stacklevelz8type 'partialmethod' takes at least one argument, got %d��__get__z${!r} is not callable or a descriptor)r�r]�pop�warnings�warn�DeprecationWarningr�rdre�formatr�r
r`rarb)rarbr*r`r�r$r$r%rP]s6

�
��
zpartialmethod.__init__z#($self, func, /, *args, **keywords)cCsNd�tt|j��}d�dd�|j��D��}d}|j|jj|jj	|j
||d�S)Nrucss|]\}}d�||�VqdS)z{}={!r}N)r�rpr$r$r%rn�s�z)partialmethod.__repr__.<locals>.<genexpr>z*{module}.{cls}({func}, {args}, {keywords}))�modulerEr`rarb)rz�maprlrarbryr�rirrr`)r*rarb�
format_stringr$r$r%r|�s
�
�zpartialmethod.__repr__cs�fdd�}�j|_�|_|S)Ncs �j|�}�j|f�j|�|�Sr@rj)�cls_or_selfrarbr}r$r%�_method�s
z3partialmethod._make_unbound_method.<locals>._method)�__isabstractmethod__�_partialmethod)r*r�r$r}r%�_make_unbound_method�sz"partialmethod._make_unbound_methodNcCs�t|jdd�}d}|dk	rd|||�}||jk	rdt|f|j�|j�}z|j|_Wntk
rbYnX|dkr||���||�}|S)Nr�)	rr`r	rarb�__self__rr�r�)r*rNrE�get�result�new_funcr$r$r%r��s

zpartialmethod.__get__cCst|jdd�S�Nr�F�rr`r}r$r$r%r��sz"partialmethod.__isabstractmethod__)N)rrrrrP�__text_signature__r|r�r��propertyr�r$r$r$r%r
Us"
cCst|t�r|j}q|Sr@)r�r	r`�r`r$r$r%�_unwrap_partial�s
r��	CacheInfo�hits�misses�maxsize�currsizec@s(eZdZdZdZefdd�Zdd�ZdS)�
_HashedSeqz� This class guarantees that hash() will be called no more than once
        per element.  This is important because the lru_cache() will hash
        the key multiple times on a cache miss.

    �	hashvaluecCs||dd�<||�|_dSr@�r�)r*�tup�hashr$r$r%rP�sz_HashedSeq.__init__cCs|jSr@r�r}r$r$r%rW�sz_HashedSeq.__hash__N)rrrrrVr�rPrWr$r$r$r%r��sr�c
s�|}|r&||7}|��D]}	||	7}q|rh||�fdd�|D��7}|r�||�fdd�|��D��7}n$||�dkr��|d�|kr�|dSt|�S)a�Make a cache key from optionally typed positional and keyword arguments

    The key is constructed in a way that is flat as possible rather than
    as a nested structure that would take more memory.

    If there is only a single argument and its data type is known to cache
    its hash value, then that argument is returned without a wrapper.  This
    saves space and improves lookup speed.

    c3s|]}�|�VqdSr@r$�rBrr�rwr$r%rn�sz_make_key.<locals>.<genexpr>c3s|]}�|�VqdSr@r$r�r�r$r%rn�sr�r)ry�valuesr�)
rar��typed�kwd_mark�	fasttypesr�rwr��key�itemr$r�r%�	_make_key�s
 r��Fcsnt�t�r�dkr\d�nDt��rLt�t�rL�d}�t|��t�}t||�S�dk	r\td����fdd�}|S)a�Least-recently-used cache decorator.

    If *maxsize* is set to None, the LRU features are disabled and the cache
    can grow without bound.

    If *typed* is True, arguments of different types will be cached separately.
    For example, f(3.0) and f(3) will be treated as distinct calls with
    distinct results.

    Arguments to the cached function must be hashable.

    View the cache statistics named tuple (hits, misses, maxsize, currsize)
    with f.cache_info().  Clear the cache and statistics with f.cache_clear().
    Access the underlying function with f.__wrapped__.

    See:  http://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)

    rr�Nz=Expected first argument to be an integer, a callable, or Nonecst|��t�}t||�Sr@)�_lru_cache_wrapper�
_CacheInfor)�
user_functionr�r�r�r$r%�decorating_function
sz&lru_cache.<locals>.decorating_function)r��intrd�boolr�r�rr])r�r�r�rr�r$r�r%r�s


�cs�t��t�d\����i�d�	�
d��j��j�t��
g���ddg�dd�<�dkrh�
�fdd�}nN�dkr����	��
���fdd�}n*���������	�
���
���fdd�}���	�
��
fdd	�}���	�
�
�fd
d�}||_||_|S)N)rr�r��rFcs�d7��||�}|S�Nr�r$)rar�r�)r�r�r$r%r$s
z#_lru_cache_wrapper.<locals>.wrappercsH�||��}�|��}|�k	r*�d7�|S�d7��||�}|�|<|Sr�r$)rar�r�r�)�cache�	cache_getr��make_keyr��sentinelr�r�r$r%r-s

c
s>�
||��}�	�z�|�}|dk	r~|\}}}}||�<||�<�
�}||�<�
�<||�<�
|�<�d7�|W5QR�S�d7�W5QRX�||�}�	��|�kr�n��r��
}	||	�<||	�<|	��
�
�}
�
�}d�
�<�
�<�|
=|	�|<n6�
�}|�
||g}||�<�
�<�|<���k�W5QRX|Sr�r$)rar�r��linkZ	link_prevZ	link_nextZ_keyr�ZlastZoldrootZoldkeyZ	oldresult)�KEY�NEXT�PREV�RESULTr�r��	cache_len�fullr��lockr�r�r�rKr�r�r$r%r<sB

c
s,���������W5QR�SQRXdS)zReport cache statisticsNr$r$)r�r�r�r�r�r�r$r%�
cache_infousz&_lru_cache_wrapper.<locals>.cache_infoc	s<��.�����ddg�dd�<d��d�W5QRXdS)z$Clear the cache and cache statisticsNrF)�clearr$)r�r�r�r�r�rKr$r%�cache_clearzs
z'_lru_cache_wrapper.<locals>.cache_clear)rAr�r��__len__rr�r�)r�r�r�r�rr�r�r$)r�r�r�r�r�r�r�r�r�r�r�r�r�r�rKr�r�r�r%r�s**9	r�)r�cCs�g}dd�|D�}|s|S|D]2}|d}|D]}||dd�kr.d}qq.qRq|dkrbtd��|�|�|D]}|d|krp|d=qpqdS)z�Merges MROs in *sequences* to a single MRO using the C3 algorithm.

    Adapted from http://www.python.org/download/releases/2.3/mro/.

    cSsg|]}|r|�qSr$r$�rB�sr$r$r%�
<listcomp>�sz_c3_merge.<locals>.<listcomp>rr�NzInconsistent hierarchy)�RuntimeError�append)�	sequencesr��s1�	candidate�s2�seqr$r$r%�	_c3_merge�s"
r�Nc
stt|j��D]$\}�t�d�rt|j�|}q8qd}�rDt��ng�t|jd|��}g}t|j|d��}�D]0�t|��rtt�fdd�|jD��st|���qt|D]���	��q��fdd�|D�}�fdd�|D�}�fd	d�|D�}	t
|gg|||	|g|g|g�S)
a�Computes the method resolution order using extended C3 linearization.

    If no *abcs* are given, the algorithm works exactly like the built-in C3
    linearization used for method resolution.

    If given, *abcs* is a list of abstract base classes that should be inserted
    into the resulting MRO. Unrelated ABCs are ignored and don't end up in the
    result. The algorithm inserts ABCs where their functionality is introduced,
    i.e. issubclass(cls, abc) returns True for the class itself but returns
    False for all its direct base classes. Implicit ABCs for a given class
    (either registered or inferred from the presence of a special method like
    __len__) are inserted directly after the last ABC explicitly listed in the
    MRO of said class. If two implicit ABCs end up next to each other in the
    resulting MRO, their ordering depends on the order of types in *abcs*.

    �__abstractmethods__rNc3s|]}t|��VqdSr@)�
issubclass)rB�b)�baser$r%rn�sz_c3_mro.<locals>.<genexpr>csg|]}t|�d��qS���abcs��_c3_mro�rBr�r�r$r%r��sz_c3_mro.<locals>.<listcomp>csg|]}t|�d��qSr�r�r�r�r$r%r��scsg|]}t|�d��qSr�r�r�r�r$r%r��s)�	enumerate�reversed�	__bases__rer��listr��anyr��remover�)
rEr��i�boundary�explicit_bases�abstract_bases�other_bases�explicit_c3_mros�abstract_c3_mros�
other_c3_mrosr$)r�r�r%r��sD
��������r�cs�t�j����fdd���fdd��D���fdd���fdd��D��t���g}�D]�}g}|��D]0}|�krht�|�rh|��fdd�|jD��qh|s�|�|�qX|jtd	d
�|D] }|D]}||kr�|�|�q�q�qXt�|d�S)z�Calculates the method resolution order for a given class *cls*.

    Includes relevant abstract base classes (with their respective bases) from
    the *types* iterable. Uses a modified C3 linearization algorithm.

    cs|�kot|d�ot�|�S)N�__mro__)rer�)�typ)�basesrEr$r%�
is_related�s�z _compose_mro.<locals>.is_relatedcsg|]}�|�r|�qSr$r$�rB�n)r�r$r%r��sz _compose_mro.<locals>.<listcomp>cs&�D]}||kr||jkrdSqdS)NTF)r�)r�r+)�typesr$r%�is_strict_base�sz$_compose_mro.<locals>.is_strict_basecsg|]}�|�s|�qSr$r$r�)r�r$r%r��scsg|]}|�kr|�qSr$r$r�)�type_setr$r%r��sT)r��reverser�)�setr��__subclasses__r�r��sortr�r�)rEr��mror��found�sub�subclsr$)r�rEr�r�r�r�r%�_compose_mro�s*

rcCstt||���}d}|D]R}|dk	r\||krX||jkrX||jkrXt||�sXtd�||���qj||kr|}q|�|�S)a^Returns the best matching implementation from *registry* for type *cls*.

    Where there is no registered implementation for a specific type, its method
    resolution order is used to find a more generic implementation.

    Note: if *registry* does not contain an implementation for the base
    *object* type, this function may return None.

    NzAmbiguous dispatch: {} or {})r�keysr�r�r�r�r�)rE�registryr�match�tr$r$r%�
_find_impls"
���r
cs�ddl}ddl}i�|���d����fdd��d����fdd�	���fdd�}t|d	d
��|�t<�|_�|_|���|_�j	|_
t||�|S)akSingle-dispatch generic function decorator.

    Transforms a function into a generic function, which can have different
    behaviours depending upon the type of its first argument. The decorated
    function acts as the default implementation, and additional
    implementations can be registered using the register() attribute of the
    generic function.
    rNcs|�dk	r"t�}�|kr"���|�z�|}WnHtk
rvz�|}Wntk
rht|��}YnX|�|<YnX|S)z�generic_func.dispatch(cls) -> <function implementation>

        Runs the dispatch algorithm to return the best available implementation
        for the given *cls* registered on *generic_func*.

        N)rr��KeyErrorr
)rE�
current_token�impl)�cache_token�dispatch_cacherr$r%�dispatch.sz singledispatch.<locals>.dispatchcs�|dkr�t�t�r ��fdd�St�di�}|s@td��d����}ddlm}tt||�����\}�t�t�s�td	|�d
��d���|��<�dkr�t	�d�r�t
�����|S)
z�generic_func.register(cls, func) -> func

        Registers a new implementation for the given *cls* on a *generic_func*.

        Ncs
��|�Sr@r$)�f)rE�registerr$r%�<lambda>N�z2singledispatch.<locals>.register.<locals>.<lambda>rz(Invalid first argument to `register()`: zS. Use either `@register(some_class)` or plain `@register` on an annotated function.r)�get_type_hintszInvalid annotation for z. z is not a class.r�)r�rwrr]�typingrr[rYryrerr�)rEr`�annr�argname)rrrrrDr%rEs(

�
�z singledispatch.<locals>.registercs&|st��d����|dj�||�S)Nz( requires at least 1 positional argumentr)r]ri)ra�kw)r�funcnamer$r%rfszsingledispatch.<locals>.wrapperrzsingledispatch function)N)r��weakref�WeakKeyDictionaryrrArr�MappingProxyTyperr��_clear_cacher)r`r�rrr$)rrrrrrr%rs!
c@s8eZdZdZdd�Zddd�Zddd�Zed	d
��ZdS)
rz�Single-dispatch generic method descriptor.

    Supports wrapping existing descriptors and handles non-descriptor
    callables as instance methods.
    cCs4t|�s t|d�s t|�d���t|�|_||_dS)Nr�z  is not callable or a descriptor)rdrer]r�
dispatcherr`�r*r`r$r$r%rPs
zsingledispatchmethod.__init__NcCs|jj||d�S)z�generic_method.register(cls, func) -> func

        Registers a new implementation for the given *cls* on a *generic_method*.
        r�)rr)r*rE�methodr$r$r%r�szsingledispatchmethod.registercs0���fdd�}�j|_�j|_t|�j�|S)Ncs$�j�|dj�}|����||�SrQ)rrrir�)ra�kwargsr!�rErNr*r$r%r��sz-singledispatchmethod.__get__.<locals>._method)r�rrr`)r*rNrEr�r$r#r%r��s
zsingledispatchmethod.__get__cCst|jdd�Sr�r�r}r$r$r%r��sz)singledispatchmethod.__isabstractmethod__)N)N)	rrrrrPrr�r�r�r$r$r$r%rxs


c@s&eZdZdd�Zdd�Zddd�ZdS)	r
cCs ||_d|_|j|_t�|_dSr@)r`�attrnamerrr�r r$r$r%rP�szcached_property.__init__cCs8|jdkr||_n"||jkr4td|j�d|�d���dS)Nz?Cannot assign the same cached_property to two different names (z and z).)r$r])r*�owner�namer$r$r%�__set_name__�s

�zcached_property.__set_name__Nc	Cs�|dkr|S|jdkrtd��z
|j}Wn8tk
r`dt|�j�d|j�d�}t|�d�YnX|�|jt�}|tkr�|j�n|�|jt�}|tkr�|�	|�}z|||j<Wn8tk
r�dt|�j�d|j�d�}t|�d�YnXW5QRX|S)NzGCannot use cached_property instance without calling __set_name__ on it.zNo '__dict__' attribute on z instance to cache z
 property.zThe '__dict__' attribute on z7 instance does not support item assignment for caching )
r$r]rrrwrr��
_NOT_FOUNDr�r`)r*�instancer%r��msg�valr$r$r%r��s2
�
�
�zcached_property.__get__)N)rrrrPr'r�r$r$r$r%r
�s	)r�F)N)9r�__all__�abcr�collectionsr�reprlibr�_threadrrrrrr,r.r/r0r3r4r5r8r9r:r=r>r?rGrr�
_functools�ImportErrorrArZrr	r
r�r�r�r�r��strr�rwr�r�rr�r�r�rr
rrr(r
r$r$r$r%�<module>s��
�
�
�����AX	�

,t
-)\(heapq.cpython-38.pyc000064400000033370150335716500010305 0ustar00U

e5d]Y�@sZdZdZdddddddd	gZd
d�Zdd�Zdd�Zd
d	�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zddd�d d�Zd)d!d�Zd*d"d�Zzd#d$lTWnek
r�YnXzd#d%lm	Z	Wnek
r�YnXzd#d&lm
Z
Wnek
�rYnXzd#d'lmZWnek
�r6YnXed(k�rVd#dlZee���dS)+a�Heap queue algorithm (a.k.a. priority queue).

Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0.  For the sake of comparison,
non-existing elements are considered to be infinite.  The interesting
property of a heap is that a[0] is always its smallest element.

Usage:

heap = []            # creates an empty heap
heappush(heap, item) # pushes a new item on the heap
item = heappop(heap) # pops the smallest item from the heap
item = heap[0]       # smallest item on the heap without popping it
heapify(x)           # transforms list into a heap, in-place, in linear time
item = heapreplace(heap, item) # pops and returns smallest item, and adds
                               # new item; the heap size is unchanged

Our API differs from textbook heap algorithms as follows:

- We use 0-based indexing.  This makes the relationship between the
  index for a node and the indexes for its children slightly less
  obvious, but is more suitable since Python uses 0-based indexing.

- Our heappop() method returns the smallest item, not the largest.

These two make it possible to view the heap as a regular Python list
without surprises: heap[0] is the smallest item, and heap.sort()
maintains the heap invariant!
uoHeap queues

[explanation by François Pinard]

Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0.  For the sake of comparison,
non-existing elements are considered to be infinite.  The interesting
property of a heap is that a[0] is always its smallest element.

The strange invariant above is meant to be an efficient memory
representation for a tournament.  The numbers below are `k', not a[k]:

                                   0

                  1                                 2

          3               4                5               6

      7       8       9       10      11      12      13      14

    15 16   17 18   19 20   21 22   23 24   25 26   27 28   29 30


In the tree above, each cell `k' is topping `2*k+1' and `2*k+2'.  In
a usual binary tournament we see in sports, each cell is the winner
over the two cells it tops, and we can trace the winner down the tree
to see all opponents s/he had.  However, in many computer applications
of such tournaments, we do not need to trace the history of a winner.
To be more memory efficient, when a winner is promoted, we try to
replace it by something else at a lower level, and the rule becomes
that a cell and the two cells it tops contain three different items,
but the top cell "wins" over the two topped cells.

If this heap invariant is protected at all time, index 0 is clearly
the overall winner.  The simplest algorithmic way to remove it and
find the "next" winner is to move some loser (let's say cell 30 in the
diagram above) into the 0 position, and then percolate this new 0 down
the tree, exchanging values, until the invariant is re-established.
This is clearly logarithmic on the total number of items in the tree.
By iterating over all items, you get an O(n ln n) sort.

A nice feature of this sort is that you can efficiently insert new
items while the sort is going on, provided that the inserted items are
not "better" than the last 0'th element you extracted.  This is
especially useful in simulation contexts, where the tree holds all
incoming events, and the "win" condition means the smallest scheduled
time.  When an event schedule other events for execution, they are
scheduled into the future, so they can easily go into the heap.  So, a
heap is a good structure for implementing schedulers (this is what I
used for my MIDI sequencer :-).

Various structures for implementing schedulers have been extensively
studied, and heaps are good for this, as they are reasonably speedy,
the speed is almost constant, and the worst case is not much different
than the average case.  However, there are other representations which
are more efficient overall, yet the worst cases might be terrible.

Heaps are also very useful in big disk sorts.  You most probably all
know that a big sort implies producing "runs" (which are pre-sorted
sequences, which size is usually related to the amount of CPU memory),
followed by a merging passes for these runs, which merging is often
very cleverly organised[1].  It is very important that the initial
sort produces the longest runs possible.  Tournaments are a good way
to that.  If, using all the memory available to hold a tournament, you
replace and percolate items that happen to fit the current run, you'll
produce runs which are twice the size of the memory for random input,
and much better for input fuzzily ordered.

Moreover, if you output the 0'th item on disk and get an input which
may not fit in the current tournament (because the value "wins" over
the last output value), it cannot fit in the heap, so the size of the
heap decreases.  The freed memory could be cleverly reused immediately
for progressively building a second heap, which grows at exactly the
same rate the first heap is melting.  When the first heap completely
vanishes, you switch heaps and start a new run.  Clever and quite
effective!

In a word, heaps are useful memory structures to know.  I use them in
a few applications, and I think it is good to keep a `heap' module
around. :-)

--------------------
[1] The disk balancing algorithms which are current, nowadays, are
more annoying than clever, and this is a consequence of the seeking
capabilities of the disks.  On devices which cannot seek, like big
tape drives, the story was quite different, and one had to be very
clever to ensure (far in advance) that each tape movement will be the
most effective possible (that is, will best participate at
"progressing" the merge).  Some tapes were even able to read
backwards, and this was also used to avoid the rewinding time.
Believe me, real good tape sorts were quite spectacular to watch!
From all times, sorting has always been a Great Art! :-)
�heappush�heappop�heapify�heapreplace�merge�nlargest�	nsmallest�heappushpopcCs"|�|�t|dt|�d�dS)z4Push item onto heap, maintaining the heap invariant.��N)�append�	_siftdown�len��heap�item�r�/usr/lib64/python3.8/heapq.pyr�s
cCs.|��}|r*|d}||d<t|d�|S|S)zCPop the smallest item off the heap, maintaining the heap invariant.r	)�pop�_siftup�rZlastelt�
returnitemrrrr�s
cCs|d}||d<t|d�|S)a�Pop and return the current smallest value, and add the new item.

    This is more efficient than heappop() followed by heappush(), and can be
    more appropriate when using a fixed-size heap.  Note that the value
    returned may be larger than item!  That constrains reasonable uses of
    this routine unless written as part of a conditional replacement:

        if item > heap[0]:
            item = heapreplace(heap, item)
    r	�r�rrrrrrr�s
cCs0|r,|d|kr,|d|}|d<t|d�|S)z1Fast version of a heappush followed by a heappop.r	rrrrrr�s
cCs,t|�}tt|d��D]}t||�qdS)z8Transform list into a heap, in-place, in O(len(x)) time.�N)r
�reversed�ranger��x�n�irrrr�scCs.|��}|r*|d}||d<t|d�|S|S)zMaxheap version of a heappop.r	)r�_siftup_maxrrrr�_heappop_max�s
r!cCs|d}||d<t|d�|S)z4Maxheap version of a heappop followed by a heappush.r	)r rrrr�_heapreplace_max�s
r"cCs,t|�}tt|d��D]}t||�qdS)z;Transform list into a maxheap, in-place, in O(len(x)) time.rN)r
rrr rrrr�_heapify_max�sr#cCsJ||}||kr>|dd?}||}||kr>|||<|}qq>q|||<dS)Nr
r�r�startpos�pos�newitem�	parentpos�parentrrrr�srcCs�t|�}|}||}d|d}||krj|d}||krL||||ksL|}||||<|}d|d}q |||<t|||�dS)Nrr
)r
r�rr&�endposr%r'�childpos�rightposrrrrsrcCsJ||}||kr>|dd?}||}||kr>|||<|}qq>q|||<dS)zMaxheap variant of _siftdownr
Nrr$rrr�
_siftdown_maxsr.cCs�t|�}|}||}d|d}||krj|d}||krL||||ksL|}||||<|}d|d}q |||<t|||�dS)zMaxheap variant of _siftuprr
N)r
r.r*rrrr %sr NF��key�reversec	gsg}|j}|r t}t}t}d}nt}t}t}d}|dk�rttt	|��D]<\}	}
z|
j
}||�|	||g�WqHtk
r�YqHXqH||�t|�dkr�z2|d\}}	}}
|V|�|
d<|||
�q�Wq�tk
r�||�Yq�Xq�|�r|d\}}	}|V|j
EdHdSttt	|��D]J\}	}
z(|
j
}|�}|||�|	|||g�Wntk
�rjYnX�q$||�t|�dk�r�zF|d\}}	}}}
|V|�}||�|
d<||
d<|||
��q�Wntk
�r�||�YnX�qx|�r|d\}}	}}|V|j
EdHdS)akMerge multiple sorted inputs into a single sorted output.

    Similar to sorted(itertools.chain(*iterables)) but returns a generator,
    does not pull the data into memory all at once, and assumes that each of
    the input streams is already sorted (smallest to largest).

    >>> list(merge([1,3,5,7], [0,2,4,8], [5,10,15,20], [], [25]))
    [0, 1, 2, 3, 4, 5, 5, 7, 8, 10, 15, 20, 25]

    If *key* is not None, applies a key function to each element to determine
    its sort order.

    >>> list(merge(['dog', 'horse'], ['cat', 'fish', 'kangaroo'], key=len))
    ['dog', 'cat', 'fish', 'horse', 'kangaroo']

    ���r
Nr	r)rr#r!r"rrr�	enumerate�map�iter�__next__�
StopIterationr
�__self__)r0r1�	iterables�h�h_append�_heapify�_heappop�_heapreplace�	direction�order�it�next�value�s�	key_valuerrrr:sl


c	s�|dkr6t|�}t�}t||�d�}||kr0gS|gSzt|�}Wnttfk
rZYnX||krxt|�d�d|�S�dk�rt|�}dd�tt|�|�D�}|s�|St	|�|dd}|}t
}	|D].}
|
|kr�|	||
|f�|d\}}|d7}q�|��dd�|D�St|�}�fd	d�tt|�|�D�}|�s>|St	|�|dd}|}t
}	|D]>}
�|
�}||k�r^|	||||
f�|d\}}}
|d7}�q^|��d
d�|D�S)zbFind the n smallest elements in a dataset.

    Equivalent to:  sorted(iterable, key=key)[:n]
    r
��defaultr0�r0NcSsg|]\}}||f�qSrr��.0r�elemrrr�
<listcomp>�sznsmallest.<locals>.<listcomp>r	cSsg|]\}}|�qSrr�rJrKr@rrrrL�scsg|]\}}�|�||f�qSrrrIrHrrrL�scSsg|]\}}}|�qSrr�rJ�kr@rKrrrrLs)r5�object�minr
�	TypeError�AttributeError�sorted�ziprr#r"�sort�r�iterabler0rA�sentinel�result�size�topr@r>rK�_orderrO�_elemrrHrr�sV


c	s�|dkr6t|�}t�}t||�d�}||kr0gS|gSzt|�}Wnttfk
rZYn X||krzt|�dd�d|�S�dk�rt|�}dd�ttd|d	�|�D�}|s�|St	|�|dd}|}t
}	|D].}
||
kr�|	||
|f�|d\}}|d8}q�|jdd
�dd�|D�St|�}�fdd�ttd|d	�|�D�}|�sR|St	|�|dd}|}t
}	|D]>}
�|
�}||k�rt|	||||
f�|d\}}}
|d8}�qt|jdd
�d
d�|D�S)zoFind the n largest elements in a dataset.

    Equivalent to:  sorted(iterable, key=key, reverse=True)[:n]
    r
rFTr/NcSsg|]\}}||f�qSrrrIrrrrL"sznlargest.<locals>.<listcomp>r	r2)r1cSsg|]\}}|�qSrrrMrrrrL/scsg|]\}}�|�||f�qSrrrIrHrrrL3scSsg|]\}}}|�qSrrrNrrrrLAs)r5rP�maxr
rRrSrTrUrrrrVrWrrHrr	sV

"
r	)�*)r")r#)r!�__main__)N)N)�__doc__�	__about__�__all__rrrrrr!r"r#rrr.r rrr�_heapq�ImportError�__name__Zdoctest�printZtestmodrrrr�<module>sR ^
�

	5
<
;
_pydecimal.cpython-38.opt-1.pyc000064400000471741150335716500012264 0ustar00U

e5d:}�%@s�dZddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%g%ZeZd&Zd'Zd(Zd)d*lZd)d*lZ	d)d*l
Z
zd)d+lmZ
e
dd,�ZWnek
r�d-d.�ZYnXdZdZdZdZdZdZdZdZd/Zd/Ze
jd0kr�d1Zd1Zd2Znd3Zd3Zd4Zeed5ZGd6d�de�Z Gd7d�de �Z!Gd8d	�d	e �Z"Gd9d�de"�Z#Gd:d
�d
e e$�Z%Gd;d�de"�Z&Gd<d�de"e$�Z'Gd=d�de �Z(Gd>d�de"�Z)Gd?d�de �Z*Gd@d
�d
e �Z+GdAd�de(e*�Z,GdBd�de(e*e+�Z-GdCd�de e.�Z/e!e%e(e,e*e-e"e+e/g	Z0e#e"e&e"e'e"e)e"iZ1eeeeeeeefZ2d)d*l3Z3e3�4dD�Z5dEd�Z6dFd�Z7[3d�dGd�Z8GdHd�de9�Z:d�dJdK�Z;e	j<�=e:�GdLdM�dMe9�Z>GdNd�de9�Z?GdOdP�dPe9�Z@d�dQdR�ZAeBjCZDdSdT�ZEdUdV�ZFdWdX�ZGdYdZ�ZHd�d\d]�ZId^d_�ZJd`da�ZKGdbdc�dce9�ZLeL�jMZNd�ddde�ZOdfdg�ZPdhdi�ZQdjdkdldmdndodpdqdrds�	fdtdu�ZRd�dvdw�ZSd�dxdy�ZTe?dzee%e,e"ggd{d|d5d)d}�ZUe?d~ee%e,e"e!e-ggd�ZVe?d~eggd�ZWd)d*lXZXeX�Yd�eXjZeXj[B�j\Z]eX�Yd��j\Z^eX�Yd��j\Z_eX�Yd�eXjZeXj`B�Za[Xzd)d*lbZcWnek
�rYnXd�d�d��Zdd�d��Zed�d��Zfd�d�d��Zgd�d��Zhd�d��Zie:d��Zje:d��Zke:d��Zle:d)�Zme:d5�Zne:d��ZoejekfZpe
jqjrZse
jqjtZue
jqjvZwexdqesd�es�Zy[
d*S)�a�	
This is an implementation of decimal floating point arithmetic based on
the General Decimal Arithmetic Specification:

    http://speleotrove.com/decimal/decarith.html

and IEEE standard 854-1987:

    http://en.wikipedia.org/wiki/IEEE_854-1987

Decimal floating point has finite precision with arbitrarily large bounds.

The purpose of this module is to support arithmetic using familiar
"schoolhouse" rules and to avoid some of the tricky representation
issues associated with binary floating point.  The package is especially
useful for financial applications or for contexts where users have
expectations that are at odds with binary floating point (for instance,
in binary floating point, 1.00 % 0.1 gives 0.09999999999999995 instead
of 0.0; Decimal('1.00') % Decimal('0.1') returns the expected
Decimal('0.00')).

Here are some examples of using the decimal module:

>>> from decimal import *
>>> setcontext(ExtendedContext)
>>> Decimal(0)
Decimal('0')
>>> Decimal('1')
Decimal('1')
>>> Decimal('-.0123')
Decimal('-0.0123')
>>> Decimal(123456)
Decimal('123456')
>>> Decimal('123.45e12345678')
Decimal('1.2345E+12345680')
>>> Decimal('1.33') + Decimal('1.27')
Decimal('2.60')
>>> Decimal('12.34') + Decimal('3.87') - Decimal('18.41')
Decimal('-2.20')
>>> dig = Decimal(1)
>>> print(dig / Decimal(3))
0.333333333
>>> getcontext().prec = 18
>>> print(dig / Decimal(3))
0.333333333333333333
>>> print(dig.sqrt())
1
>>> print(Decimal(3).sqrt())
1.73205080756887729
>>> print(Decimal(3) ** 123)
4.85192780976896427E+58
>>> inf = Decimal(1) / Decimal(0)
>>> print(inf)
Infinity
>>> neginf = Decimal(-1) / Decimal(0)
>>> print(neginf)
-Infinity
>>> print(neginf + inf)
NaN
>>> print(neginf * inf)
-Infinity
>>> print(dig / 0)
Infinity
>>> getcontext().traps[DivisionByZero] = 1
>>> print(dig / 0)
Traceback (most recent call last):
  ...
  ...
  ...
decimal.DivisionByZero: x / 0
>>> c = Context()
>>> c.traps[InvalidOperation] = 0
>>> print(c.flags[InvalidOperation])
0
>>> c.divide(Decimal(0), Decimal(0))
Decimal('NaN')
>>> c.traps[InvalidOperation] = 1
>>> print(c.flags[InvalidOperation])
1
>>> c.flags[InvalidOperation] = 0
>>> print(c.flags[InvalidOperation])
0
>>> print(c.divide(Decimal(0), Decimal(0)))
Traceback (most recent call last):
  ...
  ...
  ...
decimal.InvalidOperation: 0 / 0
>>> print(c.flags[InvalidOperation])
1
>>> c.flags[InvalidOperation] = 0
>>> c.traps[InvalidOperation] = 0
>>> print(c.divide(Decimal(0), Decimal(0)))
NaN
>>> print(c.flags[InvalidOperation])
1
>>>
�Decimal�Context�DecimalTuple�DefaultContext�BasicContext�ExtendedContext�DecimalException�Clamped�InvalidOperation�DivisionByZero�Inexact�Rounded�	Subnormal�Overflow�	Underflow�FloatOperation�DivisionImpossible�InvalidContext�ConversionSyntax�DivisionUndefined�
ROUND_DOWN�
ROUND_HALF_UP�ROUND_HALF_EVEN�
ROUND_CEILING�ROUND_FLOOR�ROUND_UP�ROUND_HALF_DOWN�
ROUND_05UP�
setcontext�
getcontext�localcontext�MAX_PREC�MAX_EMAX�MIN_EMIN�	MIN_ETINY�HAVE_THREADS�HAVE_CONTEXTVARZdecimalz1.70z2.4.2�N)�
namedtuplezsign digits exponentcGs|S�N�)�argsr)r)�"/usr/lib64/python3.8/_pydecimal.py�<lambda>��r,Tl����l��N�Zol������N�Zoi@�Ti����c@seZdZdZdd�ZdS)ra1Base exception class.

    Used exceptions derive from this.
    If an exception derives from another exception besides this (such as
    Underflow (Inexact, Rounded, Subnormal) that indicates that it is only
    called if the others are present.  This isn't actually used for
    anything, though.

    handle  -- Called when context._raise_error is called and the
               trap_enabler is not set.  First argument is self, second is the
               context.  More arguments can be given, those being after
               the explanation in _raise_error (For example,
               context._raise_error(NewError, '(-x)!', self._sign) would
               call NewError().handle(context, self._sign).)

    To define a new exception, it should be sufficient to have it derive
    from DecimalException.
    cGsdSr(r)��self�contextr*r)r)r+�handle�szDecimalException.handleN��__name__�
__module__�__qualname__�__doc__r2r)r)r)r+r�sc@seZdZdZdS)ra)Exponent of a 0 changed to fit bounds.

    This occurs and signals clamped if the exponent of a result has been
    altered in order to fit the constraints of a specific concrete
    representation.  This may occur when the exponent of a zero result would
    be outside the bounds of a representation, or when a large normal
    number would have an encoded exponent that cannot be represented.  In
    this latter case, the exponent is reduced to fit and the corresponding
    number of zero digits are appended to the coefficient ("fold-down").
    N�r4r5r6r7r)r)r)r+r�sc@seZdZdZdd�ZdS)r	a0An invalid operation was performed.

    Various bad things cause this:

    Something creates a signaling NaN
    -INF + INF
    0 * (+-)INF
    (+-)INF / (+-)INF
    x % 0
    (+-)INF % x
    x._rescale( non-integer )
    sqrt(-x) , x > 0
    0 ** 0
    x ** (non-integer)
    x ** (+-)INF
    An operand is invalid

    The result of the operation after these is a quiet positive NaN,
    except when the cause is a signaling NaN, in which case the result is
    also a quiet NaN, but with the original sign, and an optional
    diagnostic information.
    cGs,|r(t|dj|djdd�}|�|�StS)Nr&�nT)�_dec_from_triple�_sign�_int�_fix_nan�_NaN)r0r1r*�ansr)r)r+r2�s
zInvalidOperation.handleNr3r)r)r)r+r	�sc@seZdZdZdd�ZdS)rz�Trying to convert badly formed string.

    This occurs and signals invalid-operation if a string is being
    converted to a number and it does not conform to the numeric string
    syntax.  The result is [0,qNaN].
    cGstSr(�r>r/r)r)r+r2szConversionSyntax.handleNr3r)r)r)r+rsc@seZdZdZdd�ZdS)r
a�Division by 0.

    This occurs and signals division-by-zero if division of a finite number
    by zero was attempted (during a divide-integer or divide operation, or a
    power operation with negative right-hand operand), and the dividend was
    not zero.

    The result of the operation is [sign,inf], where sign is the exclusive
    or of the signs of the operands for divide, or is 1 for an odd power of
    -0, for power.
    cGst|Sr()�_SignedInfinity�r0r1�signr*r)r)r+r2szDivisionByZero.handleNr3r)r)r)r+r

sc@seZdZdZdd�ZdS)rz�Cannot perform the division adequately.

    This occurs and signals invalid-operation if the integer result of a
    divide-integer or remainder operation had too many digits (would be
    longer than precision).  The result is [0,qNaN].
    cGstSr(r@r/r)r)r+r2"szDivisionImpossible.handleNr3r)r)r)r+rsc@seZdZdZdd�ZdS)rz�Undefined result of division.

    This occurs and signals invalid-operation if division by zero was
    attempted (during a divide-integer, divide, or remainder operation), and
    the dividend is also zero.  The result is [0,qNaN].
    cGstSr(r@r/r)r)r+r2-szDivisionUndefined.handleNr3r)r)r)r+r%sc@seZdZdZdS)ra�Had to round, losing information.

    This occurs and signals inexact whenever the result of an operation is
    not exact (that is, it needed to be rounded and any discarded digits
    were non-zero), or if an overflow or underflow condition occurs.  The
    result in all cases is unchanged.

    The inexact signal may be tested (or trapped) to determine if a given
    operation (or sequence of operations) was inexact.
    Nr8r)r)r)r+r0sc@seZdZdZdd�ZdS)ra�Invalid context.  Unknown rounding, for example.

    This occurs and signals invalid-operation if an invalid context was
    detected during an operation.  This can occur if contexts are not checked
    on creation and either the precision exceeds the capability of the
    underlying concrete representation or an unknown or unsupported rounding
    was specified.  These aspects of the context need only be checked when
    the values are required to be used.  The result is [0,qNaN].
    cGstSr(r@r/r)r)r+r2GszInvalidContext.handleNr3r)r)r)r+r<s
c@seZdZdZdS)ra�Number got rounded (not  necessarily changed during rounding).

    This occurs and signals rounded whenever the result of an operation is
    rounded (that is, some zero or non-zero digits were discarded from the
    coefficient), or if an overflow or underflow condition occurs.  The
    result in all cases is unchanged.

    The rounded signal may be tested (or trapped) to determine if a given
    operation (or sequence of operations) caused a loss of precision.
    Nr8r)r)r)r+rJsc@seZdZdZdS)r
a�Exponent < Emin before rounding.

    This occurs and signals subnormal whenever the result of a conversion or
    operation is subnormal (that is, its adjusted exponent is less than
    Emin, before any rounding).  The result in all cases is unchanged.

    The subnormal signal may be tested (or trapped) to determine if a given
    or operation (or sequence of operations) yielded a subnormal result.
    Nr8r)r)r)r+r
Vsc@seZdZdZdd�ZdS)raNumerical overflow.

    This occurs and signals overflow if the adjusted exponent of a result
    (from a conversion or from an operation that is not an attempt to divide
    by zero), after rounding, would be greater than the largest value that
    can be handled by the implementation (the value Emax).

    The result depends on the rounding mode:

    For round-half-up and round-half-even (and for round-half-down and
    round-up, if implemented), the result of the operation is [sign,inf],
    where sign is the sign of the intermediate result.  For round-down, the
    result is the largest finite number that can be represented in the
    current precision, with the sign of the intermediate result.  For
    round-ceiling, the result is the same as for round-down if the sign of
    the intermediate result is 1, or is [0,inf] otherwise.  For round-floor,
    the result is the same as for round-down if the sign of the intermediate
    result is 0, or is [1,inf] otherwise.  In all cases, Inexact and Rounded
    will also be raised.
    cGs�|jttttfkrt|S|dkrR|jtkr4t|St|d|j|j	|jd�S|dkr�|jt
krlt|St|d|j|j	|jd�SdS)Nr&�9r.)�roundingrrrrrArr:�prec�EmaxrrBr)r)r+r2ws"�
�
�zOverflow.handleNr3r)r)r)r+rasc@seZdZdZdS)raxNumerical underflow with result rounded to 0.

    This occurs and signals underflow if a result is inexact and the
    adjusted exponent of the result would be smaller (more negative) than
    the smallest value that can be handled by the implementation (the value
    Emin).  That is, the result is both inexact and subnormal.

    The result after an underflow will be a subnormal number rounded, if
    necessary, so that its exponent is not less than Etiny.  This may result
    in 0 with the sign of the intermediate result and an exponent of Etiny.

    In all cases, Inexact, Rounded, and Subnormal will also be raised.
    Nr8r)r)r)r+r�sc@seZdZdZdS)ra�Enable stricter semantics for mixing floats and Decimals.

    If the signal is not trapped (default), mixing floats and Decimals is
    permitted in the Decimal() constructor, context.create_decimal() and
    all comparison operators. Both conversion and comparisons are exact.
    Any occurrence of a mixed operation is silently recorded by setting
    FloatOperation in the context flags.  Explicit conversions with
    Decimal.from_float() or context.create_decimal_from_float() do not
    set the flag.

    Otherwise (the signal is trapped), only equality comparisons and explicit
    conversions are silent. All other mixed operations raise FloatOperation.
    Nr8r)r)r)r+r�sZdecimal_contextcCs8z
t��WStk
r2t�}t�|�|YSXdS)z�Returns this thread's context.

    If this thread does not yet have a context, returns
    a new context and sets this thread's context.
    New contexts are copies of DefaultContext.
    N)�_current_context_var�get�LookupErrorr�set�r1r)r)r+r�s

cCs,|tttfkr|��}|��t�|�dS)z%Set this thread's context to context.N)rrr�copy�clear_flagsrHrKrLr)r)r+r�scCs|dkrt�}t|�S)abReturn a context manager for a copy of the supplied context

    Uses a copy of the current context if no context is specified
    The returned context manager creates a local decimal context
    in a with statement:
        def sin(x):
             with localcontext() as ctx:
                 ctx.prec += 2
                 # Rest of sin calculation algorithm
                 # uses a precision 2 greater than normal
             return +s  # Convert result to normal precision

         def sin(x):
             with localcontext(ExtendedContext):
                 # Rest of sin calculation algorithm
                 # uses the Extended Context from the
                 # General Decimal Arithmetic Specification
             return +s  # Convert result to normal context

    >>> setcontext(DefaultContext)
    >>> print(getcontext().prec)
    28
    >>> with localcontext():
    ...     ctx = getcontext()
    ...     ctx.prec += 2
    ...     print(ctx.prec)
    ...
    30
    >>> with localcontext(ExtendedContext):
    ...     print(getcontext().prec)
    ...
    9
    >>> print(getcontext().prec)
    28
    N)r�_ContextManager)Zctxr)r)r+r�s$c
@s�eZdZdZdZd�dd�Zedd��Zd	d
�Zdd�Z	d�d
d�Z
dd�Zdd�Zdd�Z
d�dd�Zd�dd�Zd�dd�Zd�dd�Zd�dd�Zd�dd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd�d*d+�Zd�d,d-�Zd�d.d/�Zd�d0d1�Zd�d3d4�Zd�d5d6�ZeZ�dd7d8�Z�dd9d:�Z �dd;d<�Z!e!Z"�dd=d>�Z#d?d@�Z$�ddAdB�Z%�ddCdD�Z&�ddEdF�Z'�ddGdH�Z(�ddIdJ�Z)�d	dKdL�Z*�d
dMdN�Z+�ddOdP�Z,dQdR�Z-dSdT�Z.e.Z/e0dUdV��Z1e0dWdX��Z2dYdZ�Z3d[d\�Z4d]d^�Z5d_d`�Z6dadb�Z7dcdd�Z8dedf�Z9dgdh�Z:didj�Z;dkdl�Z<dmdn�Z=dodp�Z>e?e7e8e9e:e;e<e=e>dq�Z@�ddrds�ZAdtdu�ZBdvdw�ZC�d
dxdy�ZD�ddzd{�ZEd|d}�ZF�dd~d�ZG�dd�d��ZH�dd�d��ZI�dd�d��ZJ�dd�d��ZKd�d��ZLd�d��ZM�dd�d��ZN�dd�d��ZOeOZP�dd�d��ZQ�dd�d��ZR�dd�d��ZSd�d��ZTd�d��ZUd�d��ZVd�d��ZW�dd�d��ZX�dd�d��ZY�dd�d��ZZd�d��Z[d�d��Z\�dd�d��Z]�dd�d��Z^d�d��Z_d�d��Z`d�d��Zad�d��Zb�dd�d��Zcd�d��Zdd�d��Zed�d��Zf�dd�d��Zgd�d��Zhd�d��Zi�d d�dÄZjd�dńZk�d!d�dDŽZl�d"d�dɄZmd�d˄Znd�d̈́Zo�d#d�dτZp�d$d�dфZq�d%d�dӄZr�d&d�dՄZs�d'd�dׄZt�d(d�dلZu�d)d�dۄZv�d*d�d݄Zw�d+d�d߄Zx�d,d�d�Zyd�d�Zz�d-d�d�Z{�d.d�d�Z|�d/d�d�Z}d�d�Z~d�d�Zd�d�Z��d0d�d�Z�dS(1rz,Floating point class for decimal arithmetic.)�_expr<r;�_is_special�0NcCs�t�|�}t|t��r$t|���dd��}|dkrP|dkr@t�}|�t	d|�S|�
d�dkrfd|_nd|_|�
d	�}|dk	r�|�
d
�p�d}t|�
d�p�d�}tt||��|_
|t|�|_d
|_nZ|�
d�}|dk	�rtt|p�d���d�|_
|�
d��rd|_nd|_nd|_
d|_d|_|St|t��rf|dk�rBd|_nd|_d|_tt|��|_
d
|_|St|t��r�|j|_|j|_|j
|_
|j|_|St|t��r�|j|_t|j�|_
t|j�|_d
|_|St|ttf��r"t|�dk�r�td��t|dt��r|ddk�std��|d|_|ddk�rHd|_
|d|_d|_n�g}	|dD]R}
t|
t��r�d|
k�r|dk�r�nn|	�s�|
dk�r�|	�|
�ntd���qT|ddk�r�d�tt|	��|_
|d|_d|_nDt|dt��rd�tt|	�p�dg��|_
|d|_d
|_ntd��|St|t��rx|dk�r>t�}|�td�t�|�}|j|_|j|_|j
|_
|j|_|St d|��dS)a�Create a decimal point instance.

        >>> Decimal('3.14')              # string input
        Decimal('3.14')
        >>> Decimal((0, (3, 1, 4), -2))  # tuple (sign, digit_tuple, exponent)
        Decimal('3.14')
        >>> Decimal(314)                 # int
        Decimal('314')
        >>> Decimal(Decimal(314))        # another decimal instance
        Decimal('314')
        >>> Decimal('  3.14  \n')        # leading and trailing whitespace okay
        Decimal('3.14')
        �_�NzInvalid literal for Decimal: %rrC�-r.r&�intZfrac�exprRF�diag�signal�Nr9�FT�ztInvalid tuple size in creation of Decimal from list or tuple.  The list or tuple should have exactly three elements.�r&r.z|Invalid sign.  The first value in the tuple should be an integer; either 0 for a positive number or 1 for a negative number.��	zTThe second value in the tuple must be composed of integers in the range 0 through 9.�r9rZzUThe third value in the tuple must be an integer, or one of the strings 'F', 'n', 'N'.�;strict semantics for mixing floats and Decimals are enabledzCannot convert %r to Decimal)!�object�__new__�
isinstance�str�_parser�strip�replacer�_raise_errorr�groupr;rVr<�lenrPrQ�lstrip�absr�_WorkReprCrW�list�tuple�
ValueError�append�join�map�floatr�
from_float�	TypeError)�cls�valuer1r0�m�intpart�fracpartrWrX�digitsZdigitr)r)r+rc
s�
�





(


�
zDecimal.__new__cCs�t|t�r,|dkrdnd}d}tt|��}nzt|t�r�t�|�sJt�|�rV|t|��St�	d|�dkrld}nd}t|��
�\}}|��d}t|d|�}ntd��t
|||�}|tkr�|S||�SdS)a.Converts a float to a decimal number, exactly.

        Note that Decimal.from_float(0.1) is not the same as Decimal('0.1').
        Since 0.1 is not exactly representable in binary floating point, the
        value is stored as the nearest representable value which is
        0x1.999999999999ap-4.  The exact equivalent of the value in decimal
        is 0.1000000000000000055511151231257827021181583404541015625.

        >>> Decimal.from_float(0.1)
        Decimal('0.1000000000000000055511151231257827021181583404541015625')
        >>> Decimal.from_float(float('nan'))
        Decimal('NaN')
        >>> Decimal.from_float(float('inf'))
        Decimal('Infinity')
        >>> Decimal.from_float(-float('inf'))
        Decimal('-Infinity')
        >>> Decimal.from_float(-0.0)
        Decimal('-0')

        r&r.g�?�zargument must be int or float.N)rdrVrermru�_mathZisinfZisnan�reprZcopysign�as_integer_ratio�
bit_lengthrwr:r)rx�frC�k�coeffr9�d�resultr)r)r+rv�s$

zDecimal.from_floatcCs(|jr$|j}|dkrdS|dkr$dSdS)zrReturns whether the number is not actually one.

        0 if a number
        1 if NaN
        2 if sNaN
        r9r.rZr^r&)rQrP)r0rWr)r)r+�_isnan�szDecimal._isnancCs|jdkr|jrdSdSdS)zyReturns whether the number is infinite

        0 if finite or not a number
        1 if +INF
        -1 if -INF
        r[���r.r&)rPr;�r0r)r)r+�_isinfinity�s

zDecimal._isinfinitycCs||��}|dkrd}n|��}|s&|rx|dkr4t�}|dkrJ|�td|�S|dkr`|�td|�S|rn|�|�S|�|�SdS)z�Returns whether the number is not actually one.

        if self, other are sNaN, signal
        if self, other are NaN return nan
        return 0

        Done before operations.
        NFr^�sNaNr&)r�rrir	r=)r0�otherr1�self_is_nan�other_is_nanr)r)r+�_check_nans�s&
��

zDecimal._check_nanscCsv|dkrt�}|js|jrr|��r0|�td|�S|��rF|�td|�S|��r\|�td|�S|��rr|�td|�SdS)aCVersion of _check_nans used for the signaling comparisons
        compare_signal, __le__, __lt__, __ge__, __gt__.

        Signal InvalidOperation if either self or other is a (quiet
        or signaling) NaN.  Signaling NaNs take precedence over quiet
        NaNs.

        Return 0 if neither operand is a NaN.

        Nzcomparison involving sNaNzcomparison involving NaNr&)rrQ�is_snanrir	�is_qnan�r0r�r1r)r)r+�_compare_check_nans	s0����zDecimal._compare_check_nanscCs|jp|jdkS)zuReturn True if self is nonzero; otherwise return False.

        NaNs and infinities are considered nonzero.
        rR�rQr<r�r)r)r+�__bool__*szDecimal.__bool__cCs|js|jr8|��}|��}||kr(dS||kr4dSdS|sP|sDdSd|jS|s^d|jS|j|jkrndS|j|jkr~dS|��}|��}||kr�|jd|j|j}|jd|j|j}||kr�dS||kr�d|jSd|jSn ||k�rd|jSd|jSdS)z�Compare the two non-NaN decimal instances self and other.

        Returns -1 if self < other, 0 if self == other and 1
        if self > other.  This routine is for internal use only.r&r�r.rRN)rQr�r;�adjustedr<rP)r0r�Zself_infZ	other_inf�
self_adjustedZother_adjusted�self_paddedZother_paddedr)r)r+�_cmp1s>


zDecimal._cmpcCs<t||dd�\}}|tkr|S|�||�r.dS|�|�dkS)NT)�equality_opFr&)�_convert_for_comparison�NotImplementedr�r�r�r)r)r+�__eq__qszDecimal.__eq__cCs<t||�\}}|tkr|S|�||�}|r.dS|�|�dkS�NFr&�r�r�r�r��r0r�r1r?r)r)r+�__lt__yszDecimal.__lt__cCs<t||�\}}|tkr|S|�||�}|r.dS|�|�dkSr�r�r�r)r)r+�__le__�szDecimal.__le__cCs<t||�\}}|tkr|S|�||�}|r.dS|�|�dkSr�r�r�r)r)r+�__gt__�szDecimal.__gt__cCs<t||�\}}|tkr|S|�||�}|r.dS|�|�dkSr�r�r�r)r)r+�__ge__�szDecimal.__ge__cCs>t|dd�}|js|r0|jr0|�||�}|r0|St|�|��S)z�Compare self to other.  Return a decimal value:

        a or b is a NaN ==> Decimal('NaN')
        a < b           ==> Decimal('-1')
        a == b          ==> Decimal('0')
        a > b           ==> Decimal('1')
        T��raiseit)�_convert_otherrQr�rr�r�r)r)r+�compare�szDecimal.comparecCs�|jr4|��rtd��n|��r$tS|jr0tStS|jdkrNtd|jt	�}ntt
|jt	�}t|j�|t	}|dkr||n|}|dkr�dS|S)zx.__hash__() <==> hash(x)z"Cannot hash a signaling NaN value.r&�
r����)
rQr�rw�is_nan�_PyHASH_NANr;�_PyHASH_INFrP�pow�_PyHASH_MODULUS�
_PyHASH_10INVrVr<)r0Zexp_hashZhash_r?r)r)r+�__hash__�s

zDecimal.__hash__cCst|jttt|j��|j�S)zeRepresents the number as a triple tuple.

        To show the internals exactly as they are.
        )rr;rprtrVr<rPr�r)r)r+�as_tuple�szDecimal.as_tuplecCs�|jr |��rtd��ntd��|s(dSt|j�}|jdkrR|d|jd}}nn|j}|dkr�|ddkr�|d}|d8}qZ|j}t||@��d|�}|r�||L}||8}d||>}|j	r�|}||fS)a�Express a finite Decimal instance in the form n / d.

        Returns a pair (n, d) of integers.  When called on an infinity
        or NaN, raises OverflowError or ValueError respectively.

        >>> Decimal('3.14').as_integer_ratio()
        (157, 50)
        >>> Decimal('-123e5').as_integer_ratio()
        (-12300000, 1)
        >>> Decimal('0.00').as_integer_ratio()
        (0, 1)

        z#cannot convert NaN to integer ratioz(cannot convert Infinity to integer ratior]r&r�r.r~)
rQr�rq�
OverflowErrorrVr<rP�minr�r;)r0r9r�Zd5Zd2Zshift2r)r)r+r��s,



zDecimal.as_integer_ratiocCsdt|�S)z0Represents the number as an instance of Decimal.z
Decimal('%s'))rer�r)r)r+�__repr__szDecimal.__repr__Fc	Csbddg|j}|jrL|jdkr&|dS|jdkr>|d|jS|d|jS|jt|j�}|jdkrt|d	krt|}n6|s~d
}n,|jdkr�|d
dd
}n|d
dd
}|dkr�d}d
d||j}nL|t|j�kr�|jd|t|j�}d}n |jd|�}d
|j|d�}||k�r(d}n*|dk�r8t�}ddg|jd||}||||S)z�Return string representation of the number in scientific notation.

        Captures all of the information in the underlying representation.
        rTrUr[ZInfinityr9�NaNr�r&���r.rRr\�.N�e�Ez%+d)r;rQrPr<rkr�capitals)	r0�engr1rC�
leftdigits�dotplacer{r|rWr)r)r+�__str__s:




zDecimal.__str__cCs|jd|d�S)a,Convert to a string, using engineering notation if an exponent is needed.

        Engineering notation has an exponent which is a multiple of 3.  This
        can leave up to 3 digits to the left of the decimal place and may
        require the addition of either one or two trailing zeros.
        T)r�r1)r��r0r1r)r)r+�
to_eng_string;szDecimal.to_eng_stringcCsR|jr|j|d�}|r|S|dkr(t�}|s@|jtkr@|��}n|��}|�|�S)zRReturns a copy with the sign switched.

        Rounds, if it has reason.
        rLN)rQr�rrEr�copy_abs�copy_negate�_fix�r0r1r?r)r)r+�__neg__Ds
zDecimal.__neg__cCsR|jr|j|d�}|r|S|dkr(t�}|s@|jtkr@|��}nt|�}|�|�S)zhReturns a copy, unless it is a sNaN.

        Rounds the number (if more than precision digits)
        rLN)rQr�rrErr�rr�r�r)r)r+�__pos__Zs
zDecimal.__pos__TcCsJ|s|��S|jr&|j|d�}|r&|S|jr:|j|d�}n|j|d�}|S)z�Returns the absolute value of self.

        If the keyword argument 'round' is false, do not round.  The
        expression self.__abs__(round=False) is equivalent to
        self.copy_abs().
        rL)r�rQr�r;r�r�)r0�roundr1r?r)r)r+�__abs__oszDecimal.__abs__c
Csht|�}|tkr|S|dkr"t�}|js.|jr�|�||�}|rB|S|��rr|j|jkrj|��rj|�td�St	|�S|��r�t	|�St
|j|j�}d}|jt
kr�|j|jkr�d}|s�|s�t
|j|j�}|r�d}t|d|�}|�|�}|S|�st||j|jd�}|�||j�}|�|�}|S|�sVt||j|jd�}|�||j�}|�|�}|St|�}t|�}t|||j�\}}t�}	|j|jk�r�|j|jk�r�t|d|�}|�|�}|S|j|jk�r�||}}|jdk�r�d|	_|j|j|_|_nd|	_n&|jdk�rd|	_d\|_|_nd|	_|jdk�r<|j|j|	_n|j|j|	_|j|	_t	|	�}|�|�}|S)zbReturns self + other.

        -INF + INF (or the reverse) cause InvalidOperation errors.
        Nz
-INF + INFr&r.rR)r&r&)r�r�rrQr�r�r;rir	rr�rPrErr:r��maxrF�_rescalern�
_normalizerCrVrW)
r0r�r1r?rWZnegativezerorC�op1�op2r�r)r)r+�__add__�s|





zDecimal.__add__cCsHt|�}|tkr|S|js |jr6|j||d�}|r6|S|j|��|d�S)zReturn self - otherrL)r�r�rQr�r�r�r�r)r)r+�__sub__�szDecimal.__sub__cCs"t|�}|tkr|S|j||d�S)zReturn other - selfrL)r�r�r�r�r)r)r+�__rsub__�szDecimal.__rsub__cCs@t|�}|tkr|S|dkr"t�}|j|jA}|js:|jr�|�||�}|rN|S|��rn|sf|�td�St	|S|��r�|s�|�td�St	|S|j
|j
}|r�|s�t|d|�}|�|�}|S|j
dkr�t||j
|�}|�|�}|S|j
dk�r
t||j
|�}|�|�}|St|�}t|�}t|t|j|j�|�}|�|�}|S)z\Return self * other.

        (+-) INF * 0 (or its reverse) raise InvalidOperation.
        Nz(+-)INF * 0z0 * (+-)INFrR�1)r�r�rr;rQr�r�rir	rArPr:r�r<rnrerV)r0r�r1Z
resultsignr?Z	resultexpr�r�r)r)r+�__mul__�sH




zDecimal.__mul__cCs�t|�}|tkrtS|dkr"t�}|j|jA}|js:|jr�|�||�}|rN|S|��rj|��rj|�td�S|��rzt	|S|��r�|�t
d�t|d|���S|s�|s�|�t
d�S|�td|�S|s�|j|j}d}n�t|j�t|j�|jd}|j|j|}t|�}t|�}	|dk�r:t|jd	||	j�\}}
nt|j|	jd	|�\}}
|
�rt|d
dk�r�|d7}n8|j|j}||k�r�|d	dk�r�|d	}|d7}�q�t|t|�|�}|�|�S)zReturn self / other.Nz(+-)INF/(+-)INFzDivision by infinityrRz0 / 0zx / 0r&r.r�r~)r�r�rr;rQr�r�rir	rArr:�Etinyrr
rPrkr<rFrn�divmodrVrer�)r0r�r1rCr?rWr��shiftr�r��	remainder�	ideal_expr)r)r+�__truediv__,sP

zDecimal.__truediv__cCs|j|jA}|��r|j}nt|j|j�}|��|��}|rN|��sN|dkrht|dd�|�||j�fS||jk�r
t	|�}t	|�}|j
|j
kr�|jd|j
|j
9_n|jd|j
|j
9_t|j|j�\}}	|d|jk�r
t|t
|�d�t|jt
|	�|�fS|�td�}
|
|
fS)z�Return (self // other, self % other), to context.prec precision.

        Assumes that neither self nor other is a NaN, that self is not
        infinite and that other is nonzero.
        r�rRr&r�z%quotient too large in //, % or divmod)r;r�rPr�r�r:r�rErFrnrWrVr�rerir)r0r�r1rCr��expdiffr�r��q�rr?r)r)r+�_dividegs0
���zDecimal._dividecCs"t|�}|tkr|S|j||d�S)z)Swaps self/other and returns __truediv__.rL)r�r�r�r�r)r)r+�__rtruediv__�szDecimal.__rtruediv__cCs�t|�}|tkr|S|dkr"t�}|�||�}|r:||fS|j|jA}|��r~|��rj|�td�}||fSt||�td�fS|s�|s�|�t	d�}||fS|�t
d|�|�td�fS|�||�\}}|�|�}||fS)z6
        Return (self // other, self % other)
        Nzdivmod(INF, INF)�INF % xzdivmod(0, 0)�x // 0�x % 0)
r�r�rr�r;r�rir	rArr
r�r�)r0r�r1r?rCZquotientr�r)r)r+�
__divmod__�s4
�
�
zDecimal.__divmod__cCs"t|�}|tkr|S|j||d�S)z(Swaps self/other and returns __divmod__.rL)r�r�r�r�r)r)r+�__rdivmod__�szDecimal.__rdivmod__cCs�t|�}|tkr|S|dkr"t�}|�||�}|r6|S|��rJ|�td�S|sj|r^|�td�S|�td�S|�||�d}|�	|�}|S)z
        self % other
        Nr�r�z0 % 0r.)
r�r�rr�r�rir	rr�r�)r0r�r1r?r�r)r)r+�__mod__�s"
zDecimal.__mod__cCs"t|�}|tkr|S|j||d�S)z%Swaps self/other and returns __mod__.rL)r�r�r�r�r)r)r+�__rmod__�szDecimal.__rmod__cCs�|dkrt�}t|dd�}|�||�}|r.|S|��rB|�td�S|sb|rV|�td�S|�td�S|��r|t|�}|�|�St	|j
|j
�}|s�t|jd|�}|�|�S|�
�|�
�}||jdkr�|�t�S|d	kr�|�||j�}|�|�St|�}t|�}|j|jk�r(|jd
|j|j9_n|jd
|j|j9_t|j|j�\}}	d|	|d@|jk�r~|	|j8}	|d7}|d
|jk�r�|�t�S|j}
|	dk�r�d|
}
|	}	t|
t|	�|�}|�|�S)
zI
        Remainder nearest to 0-  abs(remainder-near) <= other/2
        NTr�zremainder_near(infinity, x)zremainder_near(x, 0)zremainder_near(0, 0)rRr.r�r�r^r&)rr�r�r�rir	rrr�r�rPr:r;r�rFrr�rErnrWrVr�re)r0r�r1r?�ideal_exponentr�r�r�r�r�rCr)r)r+�remainder_near�s`���






zDecimal.remainder_nearcCs�t|�}|tkr|S|dkr"t�}|�||�}|r6|S|��rb|��rR|�td�St|j|jAS|s�|r�|�t	d|j|jA�S|�t
d�S|�||�dS)z
self // otherNz
INF // INFr�z0 // 0r&)r�r�rr�r�rir	rAr;r
rr�r�r)r)r+�__floordiv__'s&
�zDecimal.__floordiv__cCs"t|�}|tkr|S|j||d�S)z*Swaps self/other and returns __floordiv__.rL)r�r�r�r�r)r)r+�
__rfloordiv__CszDecimal.__rfloordiv__cCs8|��r(|��rtd��|jr"dnd}nt|�}t|�S)zFloat representation.z%Cannot convert signaling NaN to floatz-nan�nan)r�r�rqr;reru�r0�sr)r)r+�	__float__JszDecimal.__float__cCst|jr(|��rtd��n|��r(td��d|j}|jdkrT|t|j�d|jS|t|jd|j�pjd�SdS)z1Converts self to an int, truncating if necessary.zCannot convert NaN to integerz"Cannot convert infinity to integerr�r&r�NrR)	rQr�rqr�r�r;rPrVr<r�r)r)r+�__int__Ts


zDecimal.__int__cCs|Sr(r)r�r)r)r+�realcszDecimal.realcCstd�S)Nr&�rr�r)r)r+�imaggszDecimal.imagcCs|Sr(r)r�r)r)r+�	conjugatekszDecimal.conjugatecCstt|��Sr()�complexrur�r)r)r+�__complex__nszDecimal.__complex__cCsR|j}|j|j}t|�|krJ|t|�|d��d�}t|j||jd�St|�S)z2Decapitate the payload of a NaN to fit the contextNrRT)	r<rF�clamprkrlr:r;rPr)r0r1ZpayloadZmax_payload_lenr)r)r+r=qszDecimal._fix_nancCsX|jr |��r|�|�St|�S|��}|��}|s�|j|g|j}tt	|j
|�|�}||j
krx|�t�t
|jd|�St|�St|j�|j
|j}||kr�|�td|j�}|�t�|�t�|S||k}|r�|}|j
|k�r�t|j�|j
|}	|	dk�rt
|jd|d�}d}	|j|j}
|
||	�}|jd|	��p>d}|dk�r~tt|�d�}t|�|jk�r~|dd�}|d7}||k�r�|�td|j�}nt
|j||�}|�r�|�r�|�t�|�r�|�t�|�r�|�t�|�t�|�s�|�t�|S|�r|�t�|jdk�rP|j
|k�rP|�t�|jd|j
|}
t
|j|
|�St|�S)z�Round if it is necessary to keep self within prec precision.

        Rounds and fixes the exponent.  Does not raise on a sNaN.

        Arguments:
        self - Decimal instance
        context - context used.
        rR�
above Emaxr&r�r.Nr�)rQr�r=rr��EtoprGr�r�r�rPrirr:r;rkr<rFrrr�_pick_rounding_functionrErerVrr
)r0r1r�r��exp_maxZnew_expZexp_minr?Zself_is_subnormalr}Zrounding_method�changedr�r�r)r)r+r�}sn
















zDecimal._fixcCst|j|�rdSdSdS)z(Also known as round-towards-0, truncate.r&r�N)�
_all_zerosr<�r0rFr)r)r+�_round_down�szDecimal._round_downcCs|�|�S)zRounds away from 0.)r�r�r)r)r+�	_round_up�szDecimal._round_upcCs*|j|dkrdSt|j|�r"dSdSdS)zRounds 5 up (away from 0)Z56789r.r&r�N)r<r�r�r)r)r+�_round_half_up�s
zDecimal._round_half_upcCst|j|�rdS|�|�SdS)zRound 5 downr�N��_exact_halfr<rr�r)r)r+�_round_half_down�szDecimal._round_half_downcCs8t|j|�r*|dks&|j|ddkr*dS|�|�SdS)z!Round 5 to even, rest to nearest.r&r.�02468r�Nrr�r)r)r+�_round_half_even�s��zDecimal._round_half_evencCs |jr|�|�S|�|�SdS)z(Rounds up (not away from 0 if negative.)N�r;r�r�r)r)r+�_round_ceilings
zDecimal._round_ceilingcCs |js|�|�S|�|�SdS)z'Rounds down (not towards 0 if negative)Nrr�r)r)r+�_round_floor
s
zDecimal._round_floorcCs0|r |j|ddkr |�|�S|�|�SdS)z)Round down unless digit prec-1 is 0 or 5.r.Z05N)r<r�r�r)r)r+�_round_05ups
zDecimal._round_05up)rrrrrrrrcCsb|dk	r2t|t�std��tdd|�}|�|�S|jrR|��rJtd��ntd��t|�	dt
��S)a�Round self to the nearest integer, or to a given precision.

        If only one argument is supplied, round a finite Decimal
        instance self to the nearest integer.  If self is infinite or
        a NaN then a Python exception is raised.  If self is finite
        and lies exactly halfway between two integers then it is
        rounded to the integer with even last digit.

        >>> round(Decimal('123.456'))
        123
        >>> round(Decimal('-456.789'))
        -457
        >>> round(Decimal('-3.0'))
        -3
        >>> round(Decimal('2.5'))
        2
        >>> round(Decimal('3.5'))
        4
        >>> round(Decimal('Inf'))
        Traceback (most recent call last):
          ...
        OverflowError: cannot round an infinity
        >>> round(Decimal('NaN'))
        Traceback (most recent call last):
          ...
        ValueError: cannot round a NaN

        If a second argument n is supplied, self is rounded to n
        decimal places using the rounding mode for the current
        context.

        For an integer n, round(self, -n) is exactly equivalent to
        self.quantize(Decimal('1En')).

        >>> round(Decimal('123.456'), 0)
        Decimal('123')
        >>> round(Decimal('123.456'), 2)
        Decimal('123.46')
        >>> round(Decimal('123.456'), -2)
        Decimal('1E+2')
        >>> round(Decimal('-Infinity'), 37)
        Decimal('NaN')
        >>> round(Decimal('sNaN123'), 0)
        Decimal('NaN123')

        Nz+Second argument to round should be integralr&r��cannot round a NaN�cannot round an infinity)rdrVrwr:�quantizerQr�rqr�r�r)r0r9rWr)r)r+�	__round__&s/


zDecimal.__round__cCs0|jr |��rtd��ntd��t|�dt��S)z�Return the floor of self, as an integer.

        For a finite Decimal instance self, return the greatest
        integer n such that n <= self.  If self is infinite or a NaN
        then a Python exception is raised.

        r
rr&)rQr�rqr�rVr�rr�r)r)r+�	__floor__ds

zDecimal.__floor__cCs0|jr |��rtd��ntd��t|�dt��S)z�Return the ceiling of self, as an integer.

        For a finite Decimal instance self, return the least integer n
        such that n >= self.  If self is infinite or a NaN then a
        Python exception is raised.

        r
rr&)rQr�rqr�rVr�rr�r)r)r+�__ceil__ss

zDecimal.__ceil__cCst|dd�}t|dd�}|js$|jr�|dkr2t�}|jdkrJ|�td|�S|jdkrb|�td|�S|jdkrr|}nf|jdkr�|}nV|jdkr�|s�|�td�St|j|jA}n*|jdkr�|s�|�td	�St|j|jA}n0t|j|jAt	t
|j�t
|j��|j|j�}|�||�S)
a:Fused multiply-add.

        Returns self*other+third with no rounding of the intermediate
        product self*other.

        self and other are multiplied together, with no rounding of
        the result.  The third operand is then added to the result,
        and a single final rounding is performed.
        Tr�NrZr�r9r[zINF * 0 in fmaz0 * INF in fma)
r�rQrrPrir	rAr;r:rerVr<r�)r0r�Zthirdr1�productr)r)r+�fma�s<




�
�
�zDecimal.fmacCs�t|�}|tkr|St|�}|tkr(|S|dkr6t�}|��}|��}|��}|sZ|sZ|r�|dkrp|�td|�S|dkr�|�td|�S|dkr�|�td|�S|r�|�|�S|r�|�|�S|�|�S|��r�|��r�|��s�|�td�S|dkr�|�td�S|�s|�td�S|��|j	k�r(|�td�S|�s@|�s@|�td	�S|�
��rPd}n|j}tt
|��}t|���}t|���}	|j
|td
|j|�|}t|	j�D]}
t|d
|�}�q�t||	j
|�}t|t|�d�S)z!Three argument version of __pow__Nr^r�z@pow() 3rd argument not allowed unless all arguments are integersr&zApow() 2nd argument cannot be negative when 3rd argument specifiedzpow() 3rd argument cannot be 0zSinsufficient precision: pow() 3rd argument must not have more than precision digitszXat least one of pow() 1st argument and 2nd argument must be nonzero; 0**0 is not definedr�)r�r�rr�rir	r=�
_isintegerr�rF�_isevenr;rmrVrn�to_integral_valuer�rW�ranger:re)r0r��modulor1r�r�Z
modulo_is_nanrC�base�exponent�ir)r)r+�
_power_modulo�s����


�������
zDecimal._power_modulocCs�t|�}|j|j}}|ddkr4|d}|d7}qt|�}|j|j}}|ddkrh|d}|d7}qJ|dk�r||9}|ddkr�|d}|d7}qz|dkr�dS|d|}	|jdkr�|	}	|��r�|jdkr�|jt|�}
t|	|
|d�}nd}tddd||	|�S|jdk�r�|d}|dk�r�||@|k�rBdSt	|�d}
|dd	}|t
t|��k�rpdSt|
||�}
t|||�}|
dk�s�|dk�r�dS|
|k�r�dSd
|
}n�|d
k�r�t	|�dd	}
t
d
|
|�\}}|�r�dS|d
dk�r|d
}|
d8}
�q�|dd}|t
t|��k�r6dSt|
||�}
t|||�}|
dk�sf|dk�rjdS|
|k�rxdSd
|
}ndS|d|k�r�dS|
|}tdt|�|�S|dk�r�|d|d}}n�|dk�r�t
tt||���|k�r�dSt	|�}|dk�r,t
tt|�|��|k�r,dS|d|}}|d
|d
k�r\dk�rtnn|d
}|d
}�q<|d
|d
k�r�dk�r�nn|d
}|d
}�qt|dk�rX|dk�r�||k�r�dSt
||�\}}|dk�r�dSdt	|�|>}t
|||d�\}}||k�r$�q<n||d||}�q�||k�rP|dk�sTdS|}|dk�r|||dt|�k�r|dS||}||9}|d|k�r�dSt|�}|���r�|jdk�r�|jt|�}
t||
|t
|��}nd}td|d|||�S)ahAttempt to compute self**other exactly.

        Given Decimals self and other and an integer p, attempt to
        compute an exact result for the power self**other, with p
        digits of precision.  Return None if self**other is not
        exactly representable in p digits.

        Assumes that elimination of special cases has already been
        performed: self and other must both be nonspecial; self must
        be positive and not numerically equal to 1; other must be
        nonzero.  For efficiency, other._exp should not be too large,
        so that 10**abs(other._exp) is a feasible calculation.r�r&r.Nr�rR)r^����]�Ar~�r\r^�d)rnrVrWrCrr;rPr�r:�_nbitsrkre�_decimal_lshift_exactr�rm�	_log10_lb)r0r��p�x�xc�xe�y�yc�yerr�ZzerosZ
last_digitr�Zemaxr�rzr9Zxc_bits�rem�ar�r�Zstr_xcr)r)r+�_power_exacts�:












&&$$


 zDecimal._power_exactcCs4|dk	r|�|||�St|�}|tkr*|S|dkr8t�}|�||�}|rL|S|sd|s`|�td�StSd}|jdkr�|�	�r�|�
�s�d}n|r�|�td�S|��}|s�|jdkr�t|dd�St
|S|��r�|jdkr�t
|St|dd�S|tk�r�|�	��rZ|jdk�rd}n||jk�r"|j}nt|�}|j|}|d|jk�rxd|j}|�t�n|�t�|�t�d|j}t|dd||�S|��}|���r�|jdk|dkk�r�t|dd�St
|Sd}d}	|��|��}
|dk|jdkk�r|
tt|j��k�rHt|d|jd�}n,|��}|
tt|��k�rHt|d|d�}|dk�r�|�||jd�}|dk	�r�|dk�r�td|j|j�}d	}	|dk�r8|j}t|�}
|
j|
j}}t|�}|j|j}}|jdk�r�|}d
}t||||||�\}}|ddtt|��|d�r�q(|d
7}�q�t|t|�|�}|	�r&|�	��s&t|j�|jk�r�|jdt|j�}t|j|jd||j|�}|� �}|�!�t"D]}d|j#|<�q�|�$|�}|�t�|j%t&�r�|�t'�|j%t(�r�|�t(d
|j�t't&ttt)fD]}|j%|�r|�|��qn
|�$|�}|S)aHReturn self ** other [ % modulo].

        With two arguments, compute self**other.

        With three arguments, compute (self**other) % modulo.  For the
        three argument form, the following restrictions on the
        arguments hold:

         - all three arguments must be integral
         - other must be nonnegative
         - either self or other (or both) must be nonzero
         - modulo must be nonzero and must have at most p digits,
           where p is the context precision.

        If any of these restrictions is violated the InvalidOperation
        flag is raised.

        The result of pow(self, other, modulo) is identical to the
        result that would be obtained by computing (self**other) %
        modulo with unbounded precision, but is computed more
        efficiently.  It is always exact.
        Nz0 ** 0r&r.z+x ** y with x negative and y not an integerrRr�FTr\r~r�r�)*rr�r�rr�rir	�_Oner;rrr�r:rAr�rFrVrPrrr��_log10_exp_boundrkrerGr�r.r<rnrWrC�_dpowerrMrN�_signals�trapsr��flagsr
rrr)r0r�rr1r?Zresult_signZ
multiplierrWZself_adj�exactZboundr�r%r&r'r(r)r*r+�extrar�r�Z
newcontextZ	exceptionr)r)r+�__pow__�s�
�













"�



zDecimal.__pow__cCs"t|�}|tkr|S|j||d�S)z%Swaps self/other and returns __pow__.rL)r�r�r7r�r)r)r+�__rpow__�	szDecimal.__rpow__cCs�|dkrt�}|jr(|j|d�}|r(|S|�|�}|��r>|S|sPt|jdd�S|j|��g|j	}t
|j�}|j}|j|ddkr�||kr�|d7}|d8}qtt|j|jd|�|�S)z?Normalize- strip trailing 0s, change anything equal to 0 to 0e0NrLrRr&r.)
rrQr�r�r�r:r;rGr�r�rkr<rP)r0r1r?�dupr��endrWr)r)r+�	normalize�	s$


zDecimal.normalizecCs�t|dd�}|dkrt�}|dkr(|j}|js4|jr||�||�}|rH|S|��sX|��r||��rp|��rpt|�S|�td�S|�	�|j
kr�|jks�n|�td�S|s�t|j
d|j
�}|�|�S|��}||jkr�|�td�S||j
d|jk�r|�td	�S|�|j
|�}|��|jk�r.|�td�St|j�|jk�rL|�td	�S|�rl|��|jk�rl|�t�|j
|j
k�r�||k�r�|�t�|�t�|�|�}|S)
z�Quantize self so its exponent is the same as that of exp.

        Similar to self._rescale(exp._exp) but with error checking.
        Tr�Nzquantize with one INFz)target exponent out of bounds in quantizerRz9exponent of quantize result too large for current contextr.z7quantize result has too many digits for current context)r�rrErQr�r�rrir	r�rPrGr:r;r�r�rFr�rkr<�Eminr
rr)r0rWrEr1r?r�r)r)r+r�	s`��

����




zDecimal.quantizecCsDt|dd�}|js|jr8|��r(|��p6|��o6|��S|j|jkS)a=Return True if self and other have the same exponent; otherwise
        return False.

        If either operand is a special value, the following rules are used:
           * return True if both operands are infinities
           * return True if both operands are NaNs
           * otherwise, return False.
        Tr�)r�rQr��is_infiniterPr�r)r)r+�same_quantum%
s	�zDecimal.same_quantumcCs�|jrt|�S|s t|jd|�S|j|krHt|j|jd|j||�St|j�|j|}|dkrzt|jd|d�}d}|j|}|||�}|jd|�p�d}|dkr�tt	|�d�}t|j||�S)asRescale self so that the exponent is exp, either by padding with zeros
        or by truncating digits, using the given rounding mode.

        Specials are returned without change.  This operation is
        quiet: it raises no flags, and uses no information from the
        context.

        exp = exp to scale to (an integer)
        rounding = rounding mode
        rRr&r�r.N)
rQrr:r;rPr<rkr�rerV)r0rWrEr}Z
this_functionr�r�r)r)r+r�4
s&
�

zDecimal._rescalecCsf|dkrtd��|js|s"t|�S|�|��d||�}|��|��krb|�|��d||�}|S)a"Round a nonzero, nonspecial Decimal to a fixed number of
        significant figures, using the given rounding mode.

        Infinities, NaNs and zeros are returned unaltered.

        This operation is quiet: it raises no flags, and uses no
        information from the context.

        r&z'argument should be at least 1 in _roundr.)rqrQrr�r�)r0�placesrEr?r)r)r+�_roundV
s

zDecimal._roundcCs�|jr"|j|d�}|r|St|�S|jdkr4t|�S|sFt|jdd�S|dkrTt�}|dkrb|j}|�d|�}||kr�|�	t
�|�	t�|S)aVRounds to a nearby integer.

        If no rounding mode is specified, take the rounding mode from
        the context.  This method raises the Rounded and Inexact flags
        when appropriate.

        See also: to_integral_value, which does exactly the same as
        this method except that it doesn't raise Inexact or Rounded.
        rLr&rRN)rQr�rrPr:r;rrEr�rirr�r0rEr1r?r)r)r+�to_integral_exactm
s$



zDecimal.to_integral_exactcCs`|dkrt�}|dkr|j}|jr>|j|d�}|r6|St|�S|jdkrPt|�S|�d|�SdS)z@Rounds to the nearest integer, without raising inexact, rounded.NrLr&)rrErQr�rrPr�rAr)r)r+r�
s
zDecimal.to_integral_valuecCs�|dkrt�}|jrB|j|d�}|r(|S|��rB|jdkrBt|�S|sdt|jd|jd�}|�|�S|jdkrz|�	t
d�S|jd}t|�}|j
d?}|j
d@r�|jd}t|j�d?d}n|j}t|j�dd?}||}|dkr�|d	|9}d
}	nt|d	|�\}}
|
}	||8}d|}||}||k�r:�qJn||d?}�q"|	�oZ|||k}	|	�r�|dk�rz|d|}n|d|9}||7}n|ddk�r�|d7}tdt|�|�}|��}|�t�}
|�|�}|
|_|S)zReturn the square root of self.NrLr&rRr^r.zsqrt(-x), x > 0r�r!Tr~)rrQr�r�r;rr:rPr�rir	rFrnrWrVrkr<r�re�
_shallow_copy�
_set_roundingrrE)r0r1r?rF�opr��c�lr�r5r�r9r�rEr)r)r+�sqrt�
s^










zDecimal.sqrtcCs�t|dd�}|dkrt�}|js&|jr~|��}|��}|s>|r~|dkrX|dkrX|�|�S|dkrr|dkrr|�|�S|�||�S|�|�}|dkr�|�|�}|dkr�|}n|}|�|�S)z�Returns the larger value.

        Like max(self, other) except if one is not a number, returns
        NaN (and signals if one is sNaN).  Also rounds.
        Tr�Nr.r&r��r�rrQr�r�r�r��
compare_total�r0r�r1ZsnZonrFr?r)r)r+r�s&


	
zDecimal.maxcCs�t|dd�}|dkrt�}|js&|jr~|��}|��}|s>|r~|dkrX|dkrX|�|�S|dkrr|dkrr|�|�S|�||�S|�|�}|dkr�|�|�}|dkr�|}n|}|�|�S)z�Returns the smaller value.

        Like min(self, other) except if one is not a number, returns
        NaN (and signals if one is sNaN).  Also rounds.
        Tr�Nr.r&r�rIrKr)r)r+r�*s&



zDecimal.mincCs8|jr
dS|jdkrdS|j|jd�}|dt|�kS)z"Returns whether self is an integerFr&TNrR)rQrPr<rk)r0�restr)r)r+rLs
zDecimal._isintegercCs&|r|jdkrdS|jd|jdkS)z:Returns True if self is even.  Assumes self is an integer.r&Tr�r)rPr<r�r)r)r+rUszDecimal._isevencCs2z|jt|j�dWStk
r,YdSXdS)z$Return the adjusted exponent of selfr.r&N)rPrkr<rwr�r)r)r+r�[szDecimal.adjustedcCs|S)z�Returns the same Decimal object.

        As we do not have different encodings for the same number, the
        received object already is in its canonical form.
        r)r�r)r)r+�	canonicalcszDecimal.canonicalcCs.t|dd�}|�||�}|r |S|j||d�S)z�Compares self to the other operand numerically.

        It's pretty much like compare(), but all NaNs signal, with signaling
        NaNs taking precedence over quiet NaNs.
        Tr�rL)r�r�r�r�r)r)r+�compare_signalks
zDecimal.compare_signalcCs`t|dd�}|jr|jstS|js,|jr,tS|j}|��}|��}|sL|�r||kr�t|j�|jf}t|j�|jf}||kr�|r�tStS||kr�|r�tStStS|r�|dkr�tS|dkr�tS|dkr�tS|dkr�tSn2|dkr�tS|dkr�tS|dkr�tS|dk�rtS||k�rtS||k�r$tS|j|jk�r@|�r<tStS|j|jk�r\|�rXtStStS)z�Compares self to other using the abstract representations.

        This is not like the standard compare, which use their numerical
        value. Note that a total ordering is defined for all possible abstract
        representations.
        Tr�r.r^)	r�r;�_NegativeOner/r�rkr<�_ZerorP)r0r�r1rCZself_nanZ	other_nanZself_keyZ	other_keyr)r)r+rJwsf



zDecimal.compare_totalcCs&t|dd�}|��}|��}|�|�S)z�Compares self to other using abstract repr., ignoring sign.

        Like compare_total, but with operand's sign ignored and assumed to be 0.
        Tr�)r�r�rJ)r0r�r1r��or)r)r+�compare_total_mag�szDecimal.compare_total_magcCstd|j|j|j�S)z'Returns a copy with the sign set to 0. r&)r:r<rPrQr�r)r)r+r��szDecimal.copy_abscCs2|jrtd|j|j|j�Std|j|j|j�SdS)z&Returns a copy with the sign inverted.r&r.N)r;r:r<rPrQr�r)r)r+r��szDecimal.copy_negatecCs"t|dd�}t|j|j|j|j�S)z$Returns self with the sign of other.Tr�)r�r:r;r<rPrQr�r)r)r+�	copy_sign�s

�zDecimal.copy_signcCs�|dkrt�}|j|d�}|r"|S|��dkr2tS|s:tS|��dkrNt|�S|j}|��}|jdkr�|t	t
|jdd��kr�tdd|jd�}�n0|jdkr�|t	t
|�
�dd��kr�tdd|�
�d�}n�|jdk�r||k�rtddd|dd|�}n�|jdk�rD||dk�rDtdd	|d|d�}n�t|�}|j|j}}|jdk�rl|}d}t||||�\}	}
|	d
dt	t
|	��|d�r��q�|d7}�qptdt
|	�|
�}|��}|�t�}|�|�}||_|S)zReturns e ** self.NrLr�r.r&r\r�rRrDr~r�)rr�r�rPr/rrFr�r;rkrerGr:r�rnrVrWrC�_dexprCrDrr�rE)r0r1r?r%�adjrErFr�r6r�rWrEr)r)r+rW�sH$( "

zDecimal.expcCsdS)z�Return True if self is canonical; otherwise return False.

        Currently, the encoding of a Decimal instance is always
        canonical, so this method returns True for any Decimal.
        Tr)r�r)r)r+�is_canonical'szDecimal.is_canonicalcCs|jS)z�Return True if self is finite; otherwise return False.

        A Decimal instance is considered finite if it is neither
        infinite nor a NaN.
        )rQr�r)r)r+�	is_finite/szDecimal.is_finitecCs
|jdkS)z8Return True if self is infinite; otherwise return False.r[�rPr�r)r)r+r=7szDecimal.is_infinitecCs
|jdkS)z>Return True if self is a qNaN or sNaN; otherwise return False.r`rXr�r)r)r+r�;szDecimal.is_nancCs*|js
|sdS|dkrt�}|j|��kS)z?Return True if self is a normal number; otherwise return False.FN)rQrr<r�r�r)r)r+�	is_normal?s

zDecimal.is_normalcCs
|jdkS)z;Return True if self is a quiet NaN; otherwise return False.r9rXr�r)r)r+r�GszDecimal.is_qnancCs
|jdkS)z8Return True if self is negative; otherwise return False.r.)r;r�r)r)r+�	is_signedKszDecimal.is_signedcCs
|jdkS)z?Return True if self is a signaling NaN; otherwise return False.rZrXr�r)r)r+r�OszDecimal.is_snancCs*|js
|sdS|dkrt�}|��|jkS)z9Return True if self is subnormal; otherwise return False.FN)rQrr�r<r�r)r)r+�is_subnormalSs

zDecimal.is_subnormalcCs|jo|jdkS)z6Return True if self is a zero; otherwise return False.rRr�r�r)r)r+�is_zero[szDecimal.is_zerocCs�|jt|j�d}|dkr4tt|dd��dS|dkrXttd|dd��dSt|�}|j|j}}|dkr�t|d|�}t|�}t|�t|�||kS|ttd||��dS)z�Compute a lower bound for the adjusted exponent of self.ln().
        In other words, compute r such that self.ln() >= 10**r.  Assumes
        that self is finite and positive and that self != 1.
        r.�r�r�r�r&�rPrkr<rernrVrW�r0rUrErFr��numZdenr)r)r+�
_ln_exp_bound_szDecimal._ln_exp_boundc
Cs|dkrt�}|j|d�}|r"|S|s*tS|��dkr:tS|tkrFtS|jdkr\|�t	d�St
|�}|j|j}}|j
}||��d}t|||�}|ddttt|���|dr�q�|d7}q�tt|d	k�tt|��|�}|��}|�t�}	|�|�}|	|_|S)
z/Returns the natural (base e) logarithm of self.NrLr.zln of a negative valuer^r~r�r\r&)rr��_NegativeInfinityr��	_Infinityr/rPr;rir	rnrVrWrFra�_dlogrkrermr:rCrDrr�rE�
r0r1r?rErFr�r%r?r�rEr)r)r+�lnxs:
�$


z
Decimal.lncCs�|jt|j�d}|dkr,tt|��dS|dkrHttd|��dSt|�}|j|j}}|dkr�t|d|�}td|�}t|�t|�||kdStd||�}t|�||dkdS)	z�Compute a lower bound for the adjusted exponent of self.log10().
        In other words, find r such that self.log10() >= 10**r.
        Assumes that self is finite and positive and that self != 1.
        r.r�r�r&r���r^Z231r^r_r)r)r+r0�szDecimal._log10_exp_boundc
CsF|dkrt�}|j|d�}|r"|S|s*tS|��dkr:tS|jdkrP|�td�S|jddkr�|jdd�dt	|j�dkr�t
|jt	|j�d�}n�t|�}|j
|j}}|j}||��d}t|||�}|d	d
t	tt|���|dr��q|d7}q�tt
|dk�tt|��|�}|��}|�t�}	|�|�}|	|_|S)z&Returns the base 10 logarithm of self.NrLr.zlog10 of a negative valuer&r�rRr^r~r�r\)rr�rbr�rcr;rir	r<rkrrPrnrVrWrFr0�_dlog10rermr:rCrDrr�rErer)r)r+�log10�s:
�.$


z
Decimal.log10cCsV|j|d�}|r|S|dkr"t�}|��r.tS|s@|�tdd�St|���}|�|�S)aM Returns the exponent of the magnitude of self's MSD.

        The result is the integer which is the exponent of the magnitude
        of the most significant digit of self (as though it were truncated
        to a single digit while maintaining the value of that digit and
        without limiting the resulting exponent).
        rLNzlogb(0)r.)	r�rr�rcrir
rr�r�r�r)r)r+�logb�s	zDecimal.logbcCs6|jdks|jdkrdS|jD]}|dkrdSqdS)z�Return True if self is a logical operand.

        For being logical, it must be a finite number with a sign of 0,
        an exponent of 0, and a coefficient whose digits must all be
        either 0 or 1.
        r&FZ01T)r;rPr<)r0�digr)r)r+�
_islogical
s
zDecimal._islogicalcCs�|jt|�}|dkr$d||}n|dkr<||jd�}|jt|�}|dkr`d||}n|dkrx||jd�}||fS)Nr&rR)rFrk)r0r1�opa�opbZdifr)r)r+�
_fill_logical'
szDecimal._fill_logicalcCsz|dkrt�}t|dd�}|��r*|��s4|�t�S|�||j|j�\}}d�dd�t||�D��}t	d|�
d�ptdd�S)	z;Applies an 'and' operation between self and other's digits.NTr�rTcSs$g|]\}}tt|�t|�@��qSr)�rerV��.0r-�br)r)r+�
<listcomp>B
sz'Decimal.logical_and.<locals>.<listcomp>r&rR�rr�rlrir	ror<rs�zipr:rl�r0r�r1rmrnr�r)r)r+�logical_and4
s
zDecimal.logical_andcCs(|dkrt�}|�tdd|jd�|�S)zInvert all its digits.Nr&r�)r�logical_xorr:rFr�r)r)r+�logical_invertE
s
�zDecimal.logical_invertcCsz|dkrt�}t|dd�}|��r*|��s4|�t�S|�||j|j�\}}d�dd�t||�D��}t	d|�
d�ptdd�S)	z:Applies an 'or' operation between self and other's digits.NTr�rTcSs$g|]\}}tt|�t|�B��qSr)rprqr)r)r+rtZ
sz&Decimal.logical_or.<locals>.<listcomp>r&rRrurwr)r)r+�
logical_orL
s
zDecimal.logical_orcCsz|dkrt�}t|dd�}|��r*|��s4|�t�S|�||j|j�\}}d�dd�t||�D��}t	d|�
d�ptdd�S)	z;Applies an 'xor' operation between self and other's digits.NTr�rTcSs$g|]\}}tt|�t|�A��qSr)rprqr)r)r+rtk
sz'Decimal.logical_xor.<locals>.<listcomp>r&rRrurwr)r)r+ry]
s
zDecimal.logical_xorcCs�t|dd�}|dkrt�}|js&|jr~|��}|��}|s>|r~|dkrX|dkrX|�|�S|dkrr|dkrr|�|�S|�||�S|���|���}|dkr�|�|�}|dkr�|}n|}|�|�S�z8Compares the values numerically with their sign ignored.Tr�Nr.r&r��	r�rrQr�r�r�r�r�rJrKr)r)r+�max_magn
s&


zDecimal.max_magcCs�t|dd�}|dkrt�}|js&|jr~|��}|��}|s>|r~|dkrX|dkrX|�|�S|dkrr|dkrr|�|�S|�||�S|���|���}|dkr�|�|�}|dkr�|}n|}|�|�Sr|r}rKr)r)r+�min_mag�
s&


zDecimal.min_magcCs�|dkrt�}|j|d�}|r"|S|��dkr2tS|��dkrTtdd|j|���S|��}|�t	�|�
�|�|�}||kr�|S|�tdd|�
�d�|�S)z=Returns the largest representable number smaller than itself.NrLr�r.r&rDr�)rr�r�rbr:rFr�rMrDr�_ignore_all_flagsr�r�r��r0r1r?Znew_selfr)r)r+�
next_minus�
s$

�zDecimal.next_minuscCs�|dkrt�}|j|d�}|r"|S|��dkr2tS|��dkrTtdd|j|���S|��}|�t	�|�
�|�|�}||kr�|S|�tdd|�
�d�|�S)z=Returns the smallest representable number larger than itself.NrLr.r�rDr&r�)rr�r�rcr:rFr�rMrDrr�r�r�r�r�r)r)r+�	next_plus�
s$

�zDecimal.next_pluscCs�t|dd�}|dkrt�}|�||�}|r.|S|�|�}|dkrJ|�|�S|dkr^|�|�}n
|�|�}|��r�|�t	d|j
�|�t�|�t�nD|�
�|jkr�|�t�|�t�|�t�|�t�|s�|�t�|S)a�Returns the number closest to self, in the direction towards other.

        The result is the closest representable number to self
        (excluding self) that is in the direction towards other,
        unless both have the same value.  If the two operands are
        numerically equal, then the result is a copy of self with the
        sign set to be the same as the sign of other.
        Tr�Nr&r�z Infinite result from next_toward)r�rr�r�rSr�r�r�rirr;rrr�r<rr
r)r0r�r1r?Z
comparisonr)r)r+�next_toward�
s6	


�





zDecimal.next_towardcCs�|��rdS|��rdS|��}|dkr,dS|dkr8dS|��rN|jrJdSdS|d	kr\t�}|j|d
�rv|jrrdSdS|jr�d
SdSd	S)aReturns an indication of the class of self.

        The class is one of the following strings:
          sNaN
          NaN
          -Infinity
          -Normal
          -Subnormal
          -Zero
          +Zero
          +Subnormal
          +Normal
          +Infinity
        r�r�r.z	+Infinityr�z	-Infinityz-Zeroz+ZeroNrLz
-Subnormalz
+Subnormalz-Normalz+Normal)r�r�r�r\r;rr[)r0r1�infr)r)r+�number_classs,zDecimal.number_classcCstd�S)z'Just returns 10, as this is Decimal, :)r�r�r�r)r)r+�radix0sz
Decimal.radixcCs�|dkrt�}t|dd�}|�||�}|r.|S|jdkrB|�t�S|jt|�kr`|jksln|�t�S|��r|t	|�St|�}|j
}|jt|�}|dkr�d||}n|dkr�||d�}||d�|d|�}t|j
|�d�p�d|j�S)z5Returns a rotated copy of self, value-of-other times.NTr�r&rR�rr�r�rPrir	rFrVr�rr<rkr:r;rl)r0r�r1r?�torot�rotdig�topadZrotatedr)r)r+�rotate4s0

 
�zDecimal.rotatecCs�|dkrt�}t|dd�}|�||�}|r.|S|jdkrB|�t�Sd|j|j}d|j|j}|t|�krz|ks�n|�t�S|�	�r�t
|�St|j|j
|jt|��}|�|�}|S)z>Returns self operand after adding the second value to its exp.NTr�r&r�r^)rr�r�rPrir	rGrFrVr�rr:r;r<r�)r0r�r1r?ZliminfZlimsupr�r)r)r+�scalebUs"



zDecimal.scalebcCs|dkrt�}t|dd�}|�||�}|r.|S|jdkrB|�t�S|jt|�kr`|jksln|�t�S|��r|t	|�St|�}|j
}|jt|�}|dkr�d||}n|dkr�||d�}|dkr�|d|�}n|d|}||jd�}t|j
|�d��p
d|j�S)z5Returns a shifted copy of self, value-of-other times.NTr�r&rRr�)r0r�r1r?r�r�r�Zshiftedr)r)r+r�ns6

 
�z
Decimal.shiftcCs|jt|�ffSr()�	__class__rer�r)r)r+�
__reduce__�szDecimal.__reduce__cCst|�tkr|S|�t|��Sr(��typerr�rer�r)r)r+�__copy__�szDecimal.__copy__cCst|�tkr|S|�t|��Sr(r�)r0Zmemor)r)r+�__deepcopy__�szDecimal.__deepcopy__cCsJ|dkrt�}t||d�}|jrXt|j|�}t|���}|ddkrL|d7}t|||�S|ddkrvddg|j|d<|ddkr�t	|j|j
|jd�}|j}|d}|dk	�r|dd	kr�|�
|d
|�}nF|ddkr�|�||�}n*|ddk�rt|j
�|k�r|�
||�}|�s@|jd
k�r@|ddk�r@|�d
|�}|jt|j
�}	|dd	k�r~|�sx|dk	�rxd
|}
nd
}
nB|ddk�r�|	}
n.|ddk�r�|jd
k�r�|	dk�r�|	}
nd
}
|
d
k�r�d}d|
|j
}nP|
t|j
�k�r|j
d|
t|j
�}d}n"|j
d|
��p d}|j
|
d�}|	|
}
t|j|||
|�S)a|Format a Decimal instance according to the given specifier.

        The specifier should be a standard format specifier, with the
        form described in PEP 3101.  Formatting types 'e', 'E', 'f',
        'F', 'g', 'G', 'n' and '%' are supported.  If the formatting
        type is omitted it defaults to 'g' or 'G', depending on the
        value of context.capitals.
        N)�_localeconvr��%�g�Gr^�	precision�eEr.zfF%ZgGr&r�rRrT)r�_parse_format_specifierrQ�_format_signr;rer��
_format_alignr�r:r<rPrEr@r�rk�_format_number)r0Z	specifierr1r��specrC�bodyrEr�r�r�r{r|rWr)r)r+�
__format__�sZ
 

zDecimal.__format__)rRN)NN)N)N)N)N)N)N)FN)N)N)N)TN)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)NN)N)N)NN)N)NN)NN)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)NN)�r4r5r6r7�	__slots__rc�classmethodrvr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��__radd__r�r�r��__rmul__r�r�r�r�r�r�r�r�r�r�r�r��	__trunc__�propertyr�r�r�r�r=r�r�r�rrrrrr	�dictr�r
rrrrr.r7r8r;rr>r�r@rBr�to_integralrHr�r�rrr�rMrNrJrRr�r�rSrWrVrWr=r�rYr�rZr�r[r\rarfr0rirjrlrorxrzr{ryr~rr�r�r�r�r�r�r�r�r�r�r�r�r)r)r)r+rs

,
 !@

	
	
	
	
2
4
	



V7;!$K



f	�>,UnY="c*"	IK23
.*!'FcCs&t�t�}||_||_||_||_|S)z�Create a decimal instance directly, without any validation,
    normalization (e.g. removal of leading zeros) or argument
    conversion.

    This function is for *internal use only*.
    )rbrcrr;r<rPrQ)rCZcoefficientrZspecialr0r)r)r+r:�s
r:c@s(eZdZdZdd�Zdd�Zdd�ZdS)	rOz�Context manager class to support localcontext().

      Sets a copy of the supplied context in __enter__() and restores
      the previous decimal context in __exit__()
    cCs|��|_dSr()rM�new_context)r0r�r)r)r+�__init__sz_ContextManager.__init__cCst�|_t|j�|jSr()r�
saved_contextrr�r�r)r)r+�	__enter__s
z_ContextManager.__enter__cCst|j�dSr()rr�)r0�t�v�tbr)r)r+�__exit__sz_ContextManager.__exit__N)r4r5r6r7r�r�r�r)r)r)r+rOsrOc	@s�eZdZdZd�dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZeZd�dd�Zdd�Zdd�Zdd �ZdZd!d"�Zd#d$�Zd%d&�Zd�d(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Z d:d;�Z!d<d=�Z"d>d?�Z#d@dA�Z$dBdC�Z%dDdE�Z&dFdG�Z'dHdI�Z(dJdK�Z)dLdM�Z*dNdO�Z+dPdQ�Z,dRdS�Z-dTdU�Z.dVdW�Z/dXdY�Z0dZd[�Z1d\d]�Z2d^d_�Z3d`da�Z4dbdc�Z5ddde�Z6dfdg�Z7dhdi�Z8djdk�Z9dldm�Z:dndo�Z;dpdq�Z<drds�Z=dtdu�Z>dvdw�Z?dxdy�Z@dzd{�ZAd|d}�ZBd~d�ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGd�d�d��ZHd�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOd�d��ZPd�d��ZQd�d��ZRd�d��ZSd�d��ZTd�d��ZUd�d��ZVeVZWdS)�ra�Contains the context for a Decimal instance.

    Contains:
    prec - precision (for use in rounding, division, square roots..)
    rounding - rounding type (how you round)
    traps - If traps[exception] = 1, then the exception is
                    raised when it is caused.  Otherwise, a value is
                    substituted in.
    flags  - When an exception is caused, flags[exception] is set.
             (Whether or not the trap_enabler is set)
             Should be reset by user of Decimal instance.
    Emin -   Minimum exponent
    Emax -   Maximum exponent
    capitals -      If 1, 1*10^1 is printed as 1E+1.
                    If 0, printed as 1e1
    clamp -  If 1, change exponents if too high (Default 0)
    Nc
s>zt}
Wntk
rYnX|dk	r*|n|
j|_|dk	r>|n|
j|_|dk	rR|n|
j|_|dk	rf|n|
j|_|dk	rz|n|
j|_|dk	r�|n|
j|_|	dkr�g|_n|	|_�dkr�|
j	�
�|_	n.t�t�s�t�fdd�t
�D��|_	n�|_	�dk�r
t�t
d�|_n0t�t��s4t�fdd�t
�D��|_n�|_dS)Nc3s|]}|t|�k�fVqdSr(�rV�rrr��r3r)r+�	<genexpr>Isz#Context.__init__.<locals>.<genexpr>r&c3s|]}|t|�k�fVqdSr(r�r��r4r)r+r�Ps)r�	NameErrorrFrEr<rGr�r��_ignored_flagsr3rMrdr�r2�fromkeysr4)r0rFrEr<rGr�r�r4r3r�Zdcr))r4r3r+r�0s.

zContext.__init__cCs�t|t�std|��|dkr<||kr�td||||f��nJ|dkrb||kr�td||||f��n$||ksr||kr�td||||f��t�|||�S)Nz%s must be an integer�-infz%s must be in [%s, %d]. got: %sr�z%s must be in [%d, %s]. got: %sz%s must be in [%d, %d]. got %s)rdrVrwrqrb�__setattr__)r0�nameryZvminZvmaxr)r)r+�_set_integer_checkTs
zContext._set_integer_checkcCs`t|t�std|��|D]}|tkrtd|��qtD]}||kr8td|��q8t�|||�S)Nz%s must be a signal dictz%s is not a valid signal dict)rdr�rwr2�KeyErrorrbr�)r0r�r��keyr)r)r+�_set_signal_dictbs
zContext._set_signal_dictcCs�|dkr|�||dd�S|dkr0|�||dd�S|dkrH|�||dd�S|dkr`|�||dd�S|d	krx|�||dd�S|d
kr�|tkr�td|��t�|||�S|dks�|d
kr�|�||�S|dkr�t�|||�Std|��dS)NrFr.r�r<r�r&rGr�r�rEz%s: invalid rounding moder4r3r�z.'decimal.Context' object has no attribute '%s')r��_rounding_modesrwrbr�r��AttributeError)r0r�ryr)r)r+r�ms*�zContext.__setattr__cCstd|��dS)Nz%s cannot be deleted)r�)r0r�r)r)r+�__delattr__�szContext.__delattr__c	CsNdd�|j��D�}dd�|j��D�}|j|j|j|j|j|j|j	||ffS)NcSsg|]\}}|r|�qSr)r)�rrZsigr�r)r)r+rt�sz&Context.__reduce__.<locals>.<listcomp>cSsg|]\}}|r|�qSr)r)r�r)r)r+rt�s)
r4�itemsr3r�rFrEr<rGr�r�)r0r4r3r)r)r+r��s��zContext.__reduce__cCs|g}|�dt|��dd�|j��D�}|�dd�|�d�dd�|j��D�}|�dd�|�d�d�|�d	S)
zShow the current context.zrContext(prec=%(prec)d, rounding=%(rounding)s, Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d, clamp=%(clamp)dcSsg|]\}}|r|j�qSr)�r4)rrr�r�r)r)r+rt�sz$Context.__repr__.<locals>.<listcomp>zflags=[z, �]cSsg|]\}}|r|j�qSr)r�)rrr�r�r)r)r+rt�sztraps=[�))rr�varsr4r�rsr3)r0r��namesr)r)r+r��s�zContext.__repr__cCs|jD]}d|j|<qdS)zReset all flags to zeror&Nr��r0�flagr)r)r+rN�s
zContext.clear_flagscCs|jD]}d|j|<qdS)zReset all traps to zeror&Nr�r�r)r)r+�clear_traps�s
zContext.clear_trapsc
Cs.t|j|j|j|j|j|j|j|j|j	�	}|S)z!Returns a shallow copy from self.)
rrFrEr<rGr�r�r4r3r��r0Zncr)r)r+rC�s�zContext._shallow_copyc
Cs6t|j|j|j|j|j|j|j��|j	��|j
�	}|S)zReturns a deep copy from self.)rrFrEr<rGr�r�r4rMr3r�r�r)r)r+rM�s�zContext.copycGsZt�||�}||jkr(|�j|f|��Sd|j|<|j|sN|�j|f|��S||��dS)a#Handles an error

        If the flag is in _ignored_flags, returns the default response.
        Otherwise, it sets the flag, then, if the corresponding
        trap_enabler is set, it reraises the exception.  Otherwise, it returns
        the default value after setting the flag.
        r.N)�_condition_maprIr�r2r4r3)r0Z	conditionZexplanationr*�errorr)r)r+ri�s


zContext._raise_errorcCs
|jt�S)z$Ignore all flags, if they are raised)�
_ignore_flagsr2r�r)r)r+r��szContext._ignore_all_flagscGs|jt|�|_t|�S)z$Ignore the flags, if they are raised)r�ro)r0r4r)r)r+r��szContext._ignore_flagscGs8|rt|dttf�r|d}|D]}|j�|�q"dS)z+Stop ignoring the flags, if they are raisedr&N)rdrpror��remove)r0r4r�r)r)r+�
_regard_flags�szContext._regard_flagscCst|j|jd�S)z!Returns Etiny (= Emin - prec + 1)r.)rVr<rFr�r)r)r+r��sz
Context.EtinycCst|j|jd�S)z,Returns maximum exponent (= Emax - prec + 1)r.)rVrGrFr�r)r)r+r��szContext.EtopcCs|j}||_|S)a�Sets the rounding type.

        Sets the rounding type, and returns the current (previous)
        rounding type.  Often used like:

        context = context.copy()
        # so you don't change the calling context
        # if an error occurs in the middle.
        rounding = context._set_rounding(ROUND_UP)
        val = self.__sub__(other, context=context)
        context._set_rounding(rounding)

        This will make it round up for that operation.
        )rE)r0r�rEr)r)r+rD�szContext._set_roundingrRcCsjt|t�r*||��ksd|kr*|�td�St||d�}|��r`t|j�|j	|j
kr`|�td�S|�|�S)z�Creates a new Decimal instance but using self as context.

        This method implements the to-number operation of the
        IBM Decimal specification.rSzAtrailing or leading whitespace and underscores are not permitted.rLzdiagnostic info too long in NaN)rdrergrirrr�rkr<rFr�r�)r0r`r�r)r)r+�create_decimal�s��zContext.create_decimalcCst�|�}|�|�S)a�Creates a new Decimal instance from a float but rounding using self
        as the context.

        >>> context = Context(prec=5, rounding=ROUND_DOWN)
        >>> context.create_decimal_from_float(3.1415926535897932)
        Decimal('3.1415')
        >>> context = Context(prec=5, traps=[Inexact])
        >>> context.create_decimal_from_float(3.1415926535897932)
        Traceback (most recent call last):
            ...
        decimal.Inexact: None

        )rrvr�)r0r�r�r)r)r+�create_decimal_from_floats
z!Context.create_decimal_from_floatcCst|dd�}|j|d�S)a[Returns the absolute value of the operand.

        If the operand is negative, the result is the same as using the minus
        operation on the operand.  Otherwise, the result is the same as using
        the plus operation on the operand.

        >>> ExtendedContext.abs(Decimal('2.1'))
        Decimal('2.1')
        >>> ExtendedContext.abs(Decimal('-100'))
        Decimal('100')
        >>> ExtendedContext.abs(Decimal('101.5'))
        Decimal('101.5')
        >>> ExtendedContext.abs(Decimal('-101.5'))
        Decimal('101.5')
        >>> ExtendedContext.abs(-1)
        Decimal('1')
        Tr�rL)r�r��r0r-r)r)r+rm!szContext.abscCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a�Return the sum of the two operands.

        >>> ExtendedContext.add(Decimal('12'), Decimal('7.00'))
        Decimal('19.00')
        >>> ExtendedContext.add(Decimal('1E+2'), Decimal('1.01E+4'))
        Decimal('1.02E+4')
        >>> ExtendedContext.add(1, Decimal(2))
        Decimal('3')
        >>> ExtendedContext.add(Decimal(8), 5)
        Decimal('13')
        >>> ExtendedContext.add(5, 5)
        Decimal('10')
        Tr�rL�Unable to convert %s to DecimalN)r�r�r�rw�r0r-rsr�r)r)r+�add6s
zContext.addcCst|�|��Sr()rer�r�r)r)r+�_applyKszContext._applycCst|t�std��|��S)z�Returns the same Decimal object.

        As we do not have different encodings for the same number, the
        received object already is in its canonical form.

        >>> ExtendedContext.canonical(Decimal('2.50'))
        Decimal('2.50')
        z,canonical requires a Decimal as an argument.)rdrrwrMr�r)r)r+rMNs	
zContext.canonicalcCst|dd�}|j||d�S)a�Compares values numerically.

        If the signs of the operands differ, a value representing each operand
        ('-1' if the operand is less than zero, '0' if the operand is zero or
        negative zero, or '1' if the operand is greater than zero) is used in
        place of that operand for the comparison instead of the actual
        operand.

        The comparison is then effected by subtracting the second operand from
        the first and then returning a value according to the result of the
        subtraction: '-1' if the result is less than zero, '0' if the result is
        zero or negative zero, or '1' if the result is greater than zero.

        >>> ExtendedContext.compare(Decimal('2.1'), Decimal('3'))
        Decimal('-1')
        >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.1'))
        Decimal('0')
        >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.10'))
        Decimal('0')
        >>> ExtendedContext.compare(Decimal('3'), Decimal('2.1'))
        Decimal('1')
        >>> ExtendedContext.compare(Decimal('2.1'), Decimal('-3'))
        Decimal('1')
        >>> ExtendedContext.compare(Decimal('-3'), Decimal('2.1'))
        Decimal('-1')
        >>> ExtendedContext.compare(1, 2)
        Decimal('-1')
        >>> ExtendedContext.compare(Decimal(1), 2)
        Decimal('-1')
        >>> ExtendedContext.compare(1, Decimal(2))
        Decimal('-1')
        Tr�rL)r�r��r0r-rsr)r)r+r�[s!zContext.comparecCst|dd�}|j||d�S)aCompares the values of the two operands numerically.

        It's pretty much like compare(), but all NaNs signal, with signaling
        NaNs taking precedence over quiet NaNs.

        >>> c = ExtendedContext
        >>> c.compare_signal(Decimal('2.1'), Decimal('3'))
        Decimal('-1')
        >>> c.compare_signal(Decimal('2.1'), Decimal('2.1'))
        Decimal('0')
        >>> c.flags[InvalidOperation] = 0
        >>> print(c.flags[InvalidOperation])
        0
        >>> c.compare_signal(Decimal('NaN'), Decimal('2.1'))
        Decimal('NaN')
        >>> print(c.flags[InvalidOperation])
        1
        >>> c.flags[InvalidOperation] = 0
        >>> print(c.flags[InvalidOperation])
        0
        >>> c.compare_signal(Decimal('sNaN'), Decimal('2.1'))
        Decimal('NaN')
        >>> print(c.flags[InvalidOperation])
        1
        >>> c.compare_signal(-1, 2)
        Decimal('-1')
        >>> c.compare_signal(Decimal(-1), 2)
        Decimal('-1')
        >>> c.compare_signal(-1, Decimal(2))
        Decimal('-1')
        Tr�rL)r�rNr�r)r)r+rNs zContext.compare_signalcCst|dd�}|�|�S)a+Compares two operands using their abstract representation.

        This is not like the standard compare, which use their numerical
        value. Note that a total ordering is defined for all possible abstract
        representations.

        >>> ExtendedContext.compare_total(Decimal('12.73'), Decimal('127.9'))
        Decimal('-1')
        >>> ExtendedContext.compare_total(Decimal('-127'),  Decimal('12'))
        Decimal('-1')
        >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.3'))
        Decimal('-1')
        >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.30'))
        Decimal('0')
        >>> ExtendedContext.compare_total(Decimal('12.3'),  Decimal('12.300'))
        Decimal('1')
        >>> ExtendedContext.compare_total(Decimal('12.3'),  Decimal('NaN'))
        Decimal('-1')
        >>> ExtendedContext.compare_total(1, 2)
        Decimal('-1')
        >>> ExtendedContext.compare_total(Decimal(1), 2)
        Decimal('-1')
        >>> ExtendedContext.compare_total(1, Decimal(2))
        Decimal('-1')
        Tr�)r�rJr�r)r)r+rJ�szContext.compare_totalcCst|dd�}|�|�S)z�Compares two operands using their abstract representation ignoring sign.

        Like compare_total, but with operand's sign ignored and assumed to be 0.
        Tr�)r�rRr�r)r)r+rR�szContext.compare_total_magcCst|dd�}|��S)aReturns a copy of the operand with the sign set to 0.

        >>> ExtendedContext.copy_abs(Decimal('2.1'))
        Decimal('2.1')
        >>> ExtendedContext.copy_abs(Decimal('-100'))
        Decimal('100')
        >>> ExtendedContext.copy_abs(-1)
        Decimal('1')
        Tr�)r�r�r�r)r)r+r��s
zContext.copy_abscCst|dd�}t|�S)aReturns a copy of the decimal object.

        >>> ExtendedContext.copy_decimal(Decimal('2.1'))
        Decimal('2.1')
        >>> ExtendedContext.copy_decimal(Decimal('-1.00'))
        Decimal('-1.00')
        >>> ExtendedContext.copy_decimal(1)
        Decimal('1')
        Tr�)r�rr�r)r)r+�copy_decimal�s
zContext.copy_decimalcCst|dd�}|��S)a(Returns a copy of the operand with the sign inverted.

        >>> ExtendedContext.copy_negate(Decimal('101.5'))
        Decimal('-101.5')
        >>> ExtendedContext.copy_negate(Decimal('-101.5'))
        Decimal('101.5')
        >>> ExtendedContext.copy_negate(1)
        Decimal('-1')
        Tr�)r�r�r�r)r)r+r��s
zContext.copy_negatecCst|dd�}|�|�S)aCopies the second operand's sign to the first one.

        In detail, it returns a copy of the first operand with the sign
        equal to the sign of the second operand.

        >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('7.33'))
        Decimal('1.50')
        >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('7.33'))
        Decimal('1.50')
        >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('-7.33'))
        Decimal('-1.50')
        >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('-7.33'))
        Decimal('-1.50')
        >>> ExtendedContext.copy_sign(1, -2)
        Decimal('-1')
        >>> ExtendedContext.copy_sign(Decimal(1), -2)
        Decimal('-1')
        >>> ExtendedContext.copy_sign(1, Decimal(-2))
        Decimal('-1')
        Tr�)r�rSr�r)r)r+rS�szContext.copy_signcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a�Decimal division in a specified context.

        >>> ExtendedContext.divide(Decimal('1'), Decimal('3'))
        Decimal('0.333333333')
        >>> ExtendedContext.divide(Decimal('2'), Decimal('3'))
        Decimal('0.666666667')
        >>> ExtendedContext.divide(Decimal('5'), Decimal('2'))
        Decimal('2.5')
        >>> ExtendedContext.divide(Decimal('1'), Decimal('10'))
        Decimal('0.1')
        >>> ExtendedContext.divide(Decimal('12'), Decimal('12'))
        Decimal('1')
        >>> ExtendedContext.divide(Decimal('8.00'), Decimal('2'))
        Decimal('4.00')
        >>> ExtendedContext.divide(Decimal('2.400'), Decimal('2.0'))
        Decimal('1.20')
        >>> ExtendedContext.divide(Decimal('1000'), Decimal('100'))
        Decimal('10')
        >>> ExtendedContext.divide(Decimal('1000'), Decimal('1'))
        Decimal('1000')
        >>> ExtendedContext.divide(Decimal('2.40E+6'), Decimal('2'))
        Decimal('1.20E+6')
        >>> ExtendedContext.divide(5, 5)
        Decimal('1')
        >>> ExtendedContext.divide(Decimal(5), 5)
        Decimal('1')
        >>> ExtendedContext.divide(5, Decimal(5))
        Decimal('1')
        Tr�rLr�N)r�r�r�rwr�r)r)r+�divides
zContext.dividecCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a/Divides two numbers and returns the integer part of the result.

        >>> ExtendedContext.divide_int(Decimal('2'), Decimal('3'))
        Decimal('0')
        >>> ExtendedContext.divide_int(Decimal('10'), Decimal('3'))
        Decimal('3')
        >>> ExtendedContext.divide_int(Decimal('1'), Decimal('0.3'))
        Decimal('3')
        >>> ExtendedContext.divide_int(10, 3)
        Decimal('3')
        >>> ExtendedContext.divide_int(Decimal(10), 3)
        Decimal('3')
        >>> ExtendedContext.divide_int(10, Decimal(3))
        Decimal('3')
        Tr�rLr�N)r�r�r�rwr�r)r)r+�
divide_int+s
zContext.divide_intcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a�Return (a // b, a % b).

        >>> ExtendedContext.divmod(Decimal(8), Decimal(3))
        (Decimal('2'), Decimal('2'))
        >>> ExtendedContext.divmod(Decimal(8), Decimal(4))
        (Decimal('2'), Decimal('0'))
        >>> ExtendedContext.divmod(8, 4)
        (Decimal('2'), Decimal('0'))
        >>> ExtendedContext.divmod(Decimal(8), 4)
        (Decimal('2'), Decimal('0'))
        >>> ExtendedContext.divmod(8, Decimal(4))
        (Decimal('2'), Decimal('0'))
        Tr�rLr�N)r�r�r�rwr�r)r)r+r�Bs
zContext.divmodcCst|dd�}|j|d�S)a#Returns e ** a.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.exp(Decimal('-Infinity'))
        Decimal('0')
        >>> c.exp(Decimal('-1'))
        Decimal('0.367879441')
        >>> c.exp(Decimal('0'))
        Decimal('1')
        >>> c.exp(Decimal('1'))
        Decimal('2.71828183')
        >>> c.exp(Decimal('0.693147181'))
        Decimal('2.00000000')
        >>> c.exp(Decimal('+Infinity'))
        Decimal('Infinity')
        >>> c.exp(10)
        Decimal('22026.4658')
        Tr�rL)r�rWr�r)r)r+rWWszContext.expcCst|dd�}|j|||d�S)aReturns a multiplied by b, plus c.

        The first two operands are multiplied together, using multiply,
        the third operand is then added to the result of that
        multiplication, using add, all with only one final rounding.

        >>> ExtendedContext.fma(Decimal('3'), Decimal('5'), Decimal('7'))
        Decimal('22')
        >>> ExtendedContext.fma(Decimal('3'), Decimal('-5'), Decimal('7'))
        Decimal('-8')
        >>> ExtendedContext.fma(Decimal('888565290'), Decimal('1557.96930'), Decimal('-86087.7578'))
        Decimal('1.38435736E+12')
        >>> ExtendedContext.fma(1, 3, 4)
        Decimal('7')
        >>> ExtendedContext.fma(1, Decimal(3), 4)
        Decimal('7')
        >>> ExtendedContext.fma(1, 3, Decimal(4))
        Decimal('7')
        Tr�rL)r�r)r0r-rsrFr)r)r+roszContext.fmacCst|t�std��|��S)aReturn True if the operand is canonical; otherwise return False.

        Currently, the encoding of a Decimal instance is always
        canonical, so this method returns True for any Decimal.

        >>> ExtendedContext.is_canonical(Decimal('2.50'))
        True
        z/is_canonical requires a Decimal as an argument.)rdrrwrVr�r)r)r+rV�s	
zContext.is_canonicalcCst|dd�}|��S)a,Return True if the operand is finite; otherwise return False.

        A Decimal instance is considered finite if it is neither
        infinite nor a NaN.

        >>> ExtendedContext.is_finite(Decimal('2.50'))
        True
        >>> ExtendedContext.is_finite(Decimal('-0.3'))
        True
        >>> ExtendedContext.is_finite(Decimal('0'))
        True
        >>> ExtendedContext.is_finite(Decimal('Inf'))
        False
        >>> ExtendedContext.is_finite(Decimal('NaN'))
        False
        >>> ExtendedContext.is_finite(1)
        True
        Tr�)r�rWr�r)r)r+rW�szContext.is_finitecCst|dd�}|��S)aUReturn True if the operand is infinite; otherwise return False.

        >>> ExtendedContext.is_infinite(Decimal('2.50'))
        False
        >>> ExtendedContext.is_infinite(Decimal('-Inf'))
        True
        >>> ExtendedContext.is_infinite(Decimal('NaN'))
        False
        >>> ExtendedContext.is_infinite(1)
        False
        Tr�)r�r=r�r)r)r+r=�szContext.is_infinitecCst|dd�}|��S)aOReturn True if the operand is a qNaN or sNaN;
        otherwise return False.

        >>> ExtendedContext.is_nan(Decimal('2.50'))
        False
        >>> ExtendedContext.is_nan(Decimal('NaN'))
        True
        >>> ExtendedContext.is_nan(Decimal('-sNaN'))
        True
        >>> ExtendedContext.is_nan(1)
        False
        Tr�)r�r�r�r)r)r+r��s
zContext.is_nancCst|dd�}|j|d�S)a�Return True if the operand is a normal number;
        otherwise return False.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.is_normal(Decimal('2.50'))
        True
        >>> c.is_normal(Decimal('0.1E-999'))
        False
        >>> c.is_normal(Decimal('0.00'))
        False
        >>> c.is_normal(Decimal('-Inf'))
        False
        >>> c.is_normal(Decimal('NaN'))
        False
        >>> c.is_normal(1)
        True
        Tr�rL)r�rYr�r)r)r+rY�szContext.is_normalcCst|dd�}|��S)aHReturn True if the operand is a quiet NaN; otherwise return False.

        >>> ExtendedContext.is_qnan(Decimal('2.50'))
        False
        >>> ExtendedContext.is_qnan(Decimal('NaN'))
        True
        >>> ExtendedContext.is_qnan(Decimal('sNaN'))
        False
        >>> ExtendedContext.is_qnan(1)
        False
        Tr�)r�r�r�r)r)r+r��szContext.is_qnancCst|dd�}|��S)a�Return True if the operand is negative; otherwise return False.

        >>> ExtendedContext.is_signed(Decimal('2.50'))
        False
        >>> ExtendedContext.is_signed(Decimal('-12'))
        True
        >>> ExtendedContext.is_signed(Decimal('-0'))
        True
        >>> ExtendedContext.is_signed(8)
        False
        >>> ExtendedContext.is_signed(-8)
        True
        Tr�)r�rZr�r)r)r+rZ�szContext.is_signedcCst|dd�}|��S)aTReturn True if the operand is a signaling NaN;
        otherwise return False.

        >>> ExtendedContext.is_snan(Decimal('2.50'))
        False
        >>> ExtendedContext.is_snan(Decimal('NaN'))
        False
        >>> ExtendedContext.is_snan(Decimal('sNaN'))
        True
        >>> ExtendedContext.is_snan(1)
        False
        Tr�)r�r�r�r)r)r+r��s
zContext.is_snancCst|dd�}|j|d�S)a�Return True if the operand is subnormal; otherwise return False.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.is_subnormal(Decimal('2.50'))
        False
        >>> c.is_subnormal(Decimal('0.1E-999'))
        True
        >>> c.is_subnormal(Decimal('0.00'))
        False
        >>> c.is_subnormal(Decimal('-Inf'))
        False
        >>> c.is_subnormal(Decimal('NaN'))
        False
        >>> c.is_subnormal(1)
        False
        Tr�rL)r�r[r�r)r)r+r[szContext.is_subnormalcCst|dd�}|��S)auReturn True if the operand is a zero; otherwise return False.

        >>> ExtendedContext.is_zero(Decimal('0'))
        True
        >>> ExtendedContext.is_zero(Decimal('2.50'))
        False
        >>> ExtendedContext.is_zero(Decimal('-0E+2'))
        True
        >>> ExtendedContext.is_zero(1)
        False
        >>> ExtendedContext.is_zero(0)
        True
        Tr�)r�r\r�r)r)r+r\%szContext.is_zerocCst|dd�}|j|d�S)a�Returns the natural (base e) logarithm of the operand.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.ln(Decimal('0'))
        Decimal('-Infinity')
        >>> c.ln(Decimal('1.000'))
        Decimal('0')
        >>> c.ln(Decimal('2.71828183'))
        Decimal('1.00000000')
        >>> c.ln(Decimal('10'))
        Decimal('2.30258509')
        >>> c.ln(Decimal('+Infinity'))
        Decimal('Infinity')
        >>> c.ln(1)
        Decimal('0')
        Tr�rL)r�rfr�r)r)r+rf6sz
Context.lncCst|dd�}|j|d�S)a�Returns the base 10 logarithm of the operand.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.log10(Decimal('0'))
        Decimal('-Infinity')
        >>> c.log10(Decimal('0.001'))
        Decimal('-3')
        >>> c.log10(Decimal('1.000'))
        Decimal('0')
        >>> c.log10(Decimal('2'))
        Decimal('0.301029996')
        >>> c.log10(Decimal('10'))
        Decimal('1')
        >>> c.log10(Decimal('70'))
        Decimal('1.84509804')
        >>> c.log10(Decimal('+Infinity'))
        Decimal('Infinity')
        >>> c.log10(0)
        Decimal('-Infinity')
        >>> c.log10(1)
        Decimal('0')
        Tr�rL)r�rir�r)r)r+riLsz
Context.log10cCst|dd�}|j|d�S)a4 Returns the exponent of the magnitude of the operand's MSD.

        The result is the integer which is the exponent of the magnitude
        of the most significant digit of the operand (as though the
        operand were truncated to a single digit while maintaining the
        value of that digit and without limiting the resulting exponent).

        >>> ExtendedContext.logb(Decimal('250'))
        Decimal('2')
        >>> ExtendedContext.logb(Decimal('2.50'))
        Decimal('0')
        >>> ExtendedContext.logb(Decimal('0.03'))
        Decimal('-2')
        >>> ExtendedContext.logb(Decimal('0'))
        Decimal('-Infinity')
        >>> ExtendedContext.logb(1)
        Decimal('0')
        >>> ExtendedContext.logb(10)
        Decimal('1')
        >>> ExtendedContext.logb(100)
        Decimal('2')
        Tr�rL)r�rjr�r)r)r+rjhszContext.logbcCst|dd�}|j||d�S)a�Applies the logical operation 'and' between each operand's digits.

        The operands must be both logical numbers.

        >>> ExtendedContext.logical_and(Decimal('0'), Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.logical_and(Decimal('0'), Decimal('1'))
        Decimal('0')
        >>> ExtendedContext.logical_and(Decimal('1'), Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.logical_and(Decimal('1'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.logical_and(Decimal('1100'), Decimal('1010'))
        Decimal('1000')
        >>> ExtendedContext.logical_and(Decimal('1111'), Decimal('10'))
        Decimal('10')
        >>> ExtendedContext.logical_and(110, 1101)
        Decimal('100')
        >>> ExtendedContext.logical_and(Decimal(110), 1101)
        Decimal('100')
        >>> ExtendedContext.logical_and(110, Decimal(1101))
        Decimal('100')
        Tr�rL)r�rxr�r)r)r+rx�szContext.logical_andcCst|dd�}|j|d�S)aInvert all the digits in the operand.

        The operand must be a logical number.

        >>> ExtendedContext.logical_invert(Decimal('0'))
        Decimal('111111111')
        >>> ExtendedContext.logical_invert(Decimal('1'))
        Decimal('111111110')
        >>> ExtendedContext.logical_invert(Decimal('111111111'))
        Decimal('0')
        >>> ExtendedContext.logical_invert(Decimal('101010101'))
        Decimal('10101010')
        >>> ExtendedContext.logical_invert(1101)
        Decimal('111110010')
        Tr�rL)r�rzr�r)r)r+rz�szContext.logical_invertcCst|dd�}|j||d�S)a�Applies the logical operation 'or' between each operand's digits.

        The operands must be both logical numbers.

        >>> ExtendedContext.logical_or(Decimal('0'), Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.logical_or(Decimal('0'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.logical_or(Decimal('1'), Decimal('0'))
        Decimal('1')
        >>> ExtendedContext.logical_or(Decimal('1'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.logical_or(Decimal('1100'), Decimal('1010'))
        Decimal('1110')
        >>> ExtendedContext.logical_or(Decimal('1110'), Decimal('10'))
        Decimal('1110')
        >>> ExtendedContext.logical_or(110, 1101)
        Decimal('1111')
        >>> ExtendedContext.logical_or(Decimal(110), 1101)
        Decimal('1111')
        >>> ExtendedContext.logical_or(110, Decimal(1101))
        Decimal('1111')
        Tr�rL)r�r{r�r)r)r+r{�szContext.logical_orcCst|dd�}|j||d�S)a�Applies the logical operation 'xor' between each operand's digits.

        The operands must be both logical numbers.

        >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('0'))
        Decimal('1')
        >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('1'))
        Decimal('0')
        >>> ExtendedContext.logical_xor(Decimal('1100'), Decimal('1010'))
        Decimal('110')
        >>> ExtendedContext.logical_xor(Decimal('1111'), Decimal('10'))
        Decimal('1101')
        >>> ExtendedContext.logical_xor(110, 1101)
        Decimal('1011')
        >>> ExtendedContext.logical_xor(Decimal(110), 1101)
        Decimal('1011')
        >>> ExtendedContext.logical_xor(110, Decimal(1101))
        Decimal('1011')
        Tr�rL)r�ryr�r)r)r+ry�szContext.logical_xorcCst|dd�}|j||d�S)a�max compares two values numerically and returns the maximum.

        If either operand is a NaN then the general rules apply.
        Otherwise, the operands are compared as though by the compare
        operation.  If they are numerically equal then the left-hand operand
        is chosen as the result.  Otherwise the maximum (closer to positive
        infinity) of the two operands is chosen as the result.

        >>> ExtendedContext.max(Decimal('3'), Decimal('2'))
        Decimal('3')
        >>> ExtendedContext.max(Decimal('-10'), Decimal('3'))
        Decimal('3')
        >>> ExtendedContext.max(Decimal('1.0'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.max(Decimal('7'), Decimal('NaN'))
        Decimal('7')
        >>> ExtendedContext.max(1, 2)
        Decimal('2')
        >>> ExtendedContext.max(Decimal(1), 2)
        Decimal('2')
        >>> ExtendedContext.max(1, Decimal(2))
        Decimal('2')
        Tr�rL)r�r�r�r)r)r+r��szContext.maxcCst|dd�}|j||d�S)a�Compares the values numerically with their sign ignored.

        >>> ExtendedContext.max_mag(Decimal('7'), Decimal('NaN'))
        Decimal('7')
        >>> ExtendedContext.max_mag(Decimal('7'), Decimal('-10'))
        Decimal('-10')
        >>> ExtendedContext.max_mag(1, -2)
        Decimal('-2')
        >>> ExtendedContext.max_mag(Decimal(1), -2)
        Decimal('-2')
        >>> ExtendedContext.max_mag(1, Decimal(-2))
        Decimal('-2')
        Tr�rL)r�r~r�r)r)r+r~szContext.max_magcCst|dd�}|j||d�S)a�min compares two values numerically and returns the minimum.

        If either operand is a NaN then the general rules apply.
        Otherwise, the operands are compared as though by the compare
        operation.  If they are numerically equal then the left-hand operand
        is chosen as the result.  Otherwise the minimum (closer to negative
        infinity) of the two operands is chosen as the result.

        >>> ExtendedContext.min(Decimal('3'), Decimal('2'))
        Decimal('2')
        >>> ExtendedContext.min(Decimal('-10'), Decimal('3'))
        Decimal('-10')
        >>> ExtendedContext.min(Decimal('1.0'), Decimal('1'))
        Decimal('1.0')
        >>> ExtendedContext.min(Decimal('7'), Decimal('NaN'))
        Decimal('7')
        >>> ExtendedContext.min(1, 2)
        Decimal('1')
        >>> ExtendedContext.min(Decimal(1), 2)
        Decimal('1')
        >>> ExtendedContext.min(1, Decimal(29))
        Decimal('1')
        Tr�rL)r�r�r�r)r)r+r�szContext.mincCst|dd�}|j||d�S)a�Compares the values numerically with their sign ignored.

        >>> ExtendedContext.min_mag(Decimal('3'), Decimal('-2'))
        Decimal('-2')
        >>> ExtendedContext.min_mag(Decimal('-3'), Decimal('NaN'))
        Decimal('-3')
        >>> ExtendedContext.min_mag(1, -2)
        Decimal('1')
        >>> ExtendedContext.min_mag(Decimal(1), -2)
        Decimal('1')
        >>> ExtendedContext.min_mag(1, Decimal(-2))
        Decimal('1')
        Tr�rL)r�rr�r)r)r+r-szContext.min_magcCst|dd�}|j|d�S)a�Minus corresponds to unary prefix minus in Python.

        The operation is evaluated using the same rules as subtract; the
        operation minus(a) is calculated as subtract('0', a) where the '0'
        has the same exponent as the operand.

        >>> ExtendedContext.minus(Decimal('1.3'))
        Decimal('-1.3')
        >>> ExtendedContext.minus(Decimal('-1.3'))
        Decimal('1.3')
        >>> ExtendedContext.minus(1)
        Decimal('-1')
        Tr�rL)r�r�r�r)r)r+�minus>sz
Context.minuscCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a�multiply multiplies two operands.

        If either operand is a special value then the general rules apply.
        Otherwise, the operands are multiplied together
        ('long multiplication'), resulting in a number which may be as long as
        the sum of the lengths of the two operands.

        >>> ExtendedContext.multiply(Decimal('1.20'), Decimal('3'))
        Decimal('3.60')
        >>> ExtendedContext.multiply(Decimal('7'), Decimal('3'))
        Decimal('21')
        >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('0.8'))
        Decimal('0.72')
        >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('-0'))
        Decimal('-0.0')
        >>> ExtendedContext.multiply(Decimal('654321'), Decimal('654321'))
        Decimal('4.28135971E+11')
        >>> ExtendedContext.multiply(7, 7)
        Decimal('49')
        >>> ExtendedContext.multiply(Decimal(7), 7)
        Decimal('49')
        >>> ExtendedContext.multiply(7, Decimal(7))
        Decimal('49')
        Tr�rLr�N)r�r�r�rwr�r)r)r+�multiplyOs
zContext.multiplycCst|dd�}|j|d�S)a"Returns the largest representable number smaller than a.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> ExtendedContext.next_minus(Decimal('1'))
        Decimal('0.999999999')
        >>> c.next_minus(Decimal('1E-1007'))
        Decimal('0E-1007')
        >>> ExtendedContext.next_minus(Decimal('-1.00000003'))
        Decimal('-1.00000004')
        >>> c.next_minus(Decimal('Infinity'))
        Decimal('9.99999999E+999')
        >>> c.next_minus(1)
        Decimal('0.999999999')
        Tr�rL)r�r�r�r)r)r+r�oszContext.next_minuscCst|dd�}|j|d�S)aReturns the smallest representable number larger than a.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> ExtendedContext.next_plus(Decimal('1'))
        Decimal('1.00000001')
        >>> c.next_plus(Decimal('-1E-1007'))
        Decimal('-0E-1007')
        >>> ExtendedContext.next_plus(Decimal('-1.00000003'))
        Decimal('-1.00000002')
        >>> c.next_plus(Decimal('-Infinity'))
        Decimal('-9.99999999E+999')
        >>> c.next_plus(1)
        Decimal('1.00000001')
        Tr�rL)r�r�r�r)r)r+r��szContext.next_pluscCst|dd�}|j||d�S)a�Returns the number closest to a, in direction towards b.

        The result is the closest representable number from the first
        operand (but not the first operand) that is in the direction
        towards the second operand, unless the operands have the same
        value.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.next_toward(Decimal('1'), Decimal('2'))
        Decimal('1.00000001')
        >>> c.next_toward(Decimal('-1E-1007'), Decimal('1'))
        Decimal('-0E-1007')
        >>> c.next_toward(Decimal('-1.00000003'), Decimal('0'))
        Decimal('-1.00000002')
        >>> c.next_toward(Decimal('1'), Decimal('0'))
        Decimal('0.999999999')
        >>> c.next_toward(Decimal('1E-1007'), Decimal('-100'))
        Decimal('0E-1007')
        >>> c.next_toward(Decimal('-1.00000003'), Decimal('-10'))
        Decimal('-1.00000004')
        >>> c.next_toward(Decimal('0.00'), Decimal('-0.0000'))
        Decimal('-0.00')
        >>> c.next_toward(0, 1)
        Decimal('1E-1007')
        >>> c.next_toward(Decimal(0), 1)
        Decimal('1E-1007')
        >>> c.next_toward(0, Decimal(1))
        Decimal('1E-1007')
        Tr�rL)r�r�r�r)r)r+r��s zContext.next_towardcCst|dd�}|j|d�S)a�normalize reduces an operand to its simplest form.

        Essentially a plus operation with all trailing zeros removed from the
        result.

        >>> ExtendedContext.normalize(Decimal('2.1'))
        Decimal('2.1')
        >>> ExtendedContext.normalize(Decimal('-2.0'))
        Decimal('-2')
        >>> ExtendedContext.normalize(Decimal('1.200'))
        Decimal('1.2')
        >>> ExtendedContext.normalize(Decimal('-120'))
        Decimal('-1.2E+2')
        >>> ExtendedContext.normalize(Decimal('120.00'))
        Decimal('1.2E+2')
        >>> ExtendedContext.normalize(Decimal('0.00'))
        Decimal('0')
        >>> ExtendedContext.normalize(6)
        Decimal('6')
        Tr�rL)r�r;r�r)r)r+r;�szContext.normalizecCst|dd�}|j|d�S)a�Returns an indication of the class of the operand.

        The class is one of the following strings:
          -sNaN
          -NaN
          -Infinity
          -Normal
          -Subnormal
          -Zero
          +Zero
          +Subnormal
          +Normal
          +Infinity

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.number_class(Decimal('Infinity'))
        '+Infinity'
        >>> c.number_class(Decimal('1E-10'))
        '+Normal'
        >>> c.number_class(Decimal('2.50'))
        '+Normal'
        >>> c.number_class(Decimal('0.1E-999'))
        '+Subnormal'
        >>> c.number_class(Decimal('0'))
        '+Zero'
        >>> c.number_class(Decimal('-0'))
        '-Zero'
        >>> c.number_class(Decimal('-0.1E-999'))
        '-Subnormal'
        >>> c.number_class(Decimal('-1E-10'))
        '-Normal'
        >>> c.number_class(Decimal('-2.50'))
        '-Normal'
        >>> c.number_class(Decimal('-Infinity'))
        '-Infinity'
        >>> c.number_class(Decimal('NaN'))
        'NaN'
        >>> c.number_class(Decimal('-NaN'))
        'NaN'
        >>> c.number_class(Decimal('sNaN'))
        'sNaN'
        >>> c.number_class(123)
        '+Normal'
        Tr�rL)r�r�r�r)r)r+r��s/zContext.number_classcCst|dd�}|j|d�S)a�Plus corresponds to unary prefix plus in Python.

        The operation is evaluated using the same rules as add; the
        operation plus(a) is calculated as add('0', a) where the '0'
        has the same exponent as the operand.

        >>> ExtendedContext.plus(Decimal('1.3'))
        Decimal('1.3')
        >>> ExtendedContext.plus(Decimal('-1.3'))
        Decimal('-1.3')
        >>> ExtendedContext.plus(-1)
        Decimal('-1')
        Tr�rL)r�r�r�r)r)r+�plusszContext.pluscCs:t|dd�}|j|||d�}|tkr2td|��n|SdS)aRaises a to the power of b, to modulo if given.

        With two arguments, compute a**b.  If a is negative then b
        must be integral.  The result will be inexact unless b is
        integral and the result is finite and can be expressed exactly
        in 'precision' digits.

        With three arguments, compute (a**b) % modulo.  For the
        three argument form, the following restrictions on the
        arguments hold:

         - all three arguments must be integral
         - b must be nonnegative
         - at least one of a or b must be nonzero
         - modulo must be nonzero and have at most 'precision' digits

        The result of pow(a, b, modulo) is identical to the result
        that would be obtained by computing (a**b) % modulo with
        unbounded precision, but is computed more efficiently.  It is
        always exact.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.power(Decimal('2'), Decimal('3'))
        Decimal('8')
        >>> c.power(Decimal('-2'), Decimal('3'))
        Decimal('-8')
        >>> c.power(Decimal('2'), Decimal('-3'))
        Decimal('0.125')
        >>> c.power(Decimal('1.7'), Decimal('8'))
        Decimal('69.7575744')
        >>> c.power(Decimal('10'), Decimal('0.301029996'))
        Decimal('2.00000000')
        >>> c.power(Decimal('Infinity'), Decimal('-1'))
        Decimal('0')
        >>> c.power(Decimal('Infinity'), Decimal('0'))
        Decimal('1')
        >>> c.power(Decimal('Infinity'), Decimal('1'))
        Decimal('Infinity')
        >>> c.power(Decimal('-Infinity'), Decimal('-1'))
        Decimal('-0')
        >>> c.power(Decimal('-Infinity'), Decimal('0'))
        Decimal('1')
        >>> c.power(Decimal('-Infinity'), Decimal('1'))
        Decimal('-Infinity')
        >>> c.power(Decimal('-Infinity'), Decimal('2'))
        Decimal('Infinity')
        >>> c.power(Decimal('0'), Decimal('0'))
        Decimal('NaN')

        >>> c.power(Decimal('3'), Decimal('7'), Decimal('16'))
        Decimal('11')
        >>> c.power(Decimal('-3'), Decimal('7'), Decimal('16'))
        Decimal('-11')
        >>> c.power(Decimal('-3'), Decimal('8'), Decimal('16'))
        Decimal('1')
        >>> c.power(Decimal('3'), Decimal('7'), Decimal('-16'))
        Decimal('11')
        >>> c.power(Decimal('23E12345'), Decimal('67E189'), Decimal('123456789'))
        Decimal('11729830')
        >>> c.power(Decimal('-0'), Decimal('17'), Decimal('1729'))
        Decimal('-0')
        >>> c.power(Decimal('-23'), Decimal('0'), Decimal('65537'))
        Decimal('1')
        >>> ExtendedContext.power(7, 7)
        Decimal('823543')
        >>> ExtendedContext.power(Decimal(7), 7)
        Decimal('823543')
        >>> ExtendedContext.power(7, Decimal(7), 2)
        Decimal('1')
        Tr�rLr�N)r�r7r�rw)r0r-rsrr�r)r)r+�powers
Iz
Context.powercCst|dd�}|j||d�S)a
Returns a value equal to 'a' (rounded), having the exponent of 'b'.

        The coefficient of the result is derived from that of the left-hand
        operand.  It may be rounded using the current rounding setting (if the
        exponent is being increased), multiplied by a positive power of ten (if
        the exponent is being decreased), or is unchanged (if the exponent is
        already equal to that of the right-hand operand).

        Unlike other operations, if the length of the coefficient after the
        quantize operation would be greater than precision then an Invalid
        operation condition is raised.  This guarantees that, unless there is
        an error condition, the exponent of the result of a quantize is always
        equal to that of the right-hand operand.

        Also unlike other operations, quantize will never raise Underflow, even
        if the result is subnormal and inexact.

        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.001'))
        Decimal('2.170')
        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.01'))
        Decimal('2.17')
        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.1'))
        Decimal('2.2')
        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('1e+0'))
        Decimal('2')
        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('1e+1'))
        Decimal('0E+1')
        >>> ExtendedContext.quantize(Decimal('-Inf'), Decimal('Infinity'))
        Decimal('-Infinity')
        >>> ExtendedContext.quantize(Decimal('2'), Decimal('Infinity'))
        Decimal('NaN')
        >>> ExtendedContext.quantize(Decimal('-0.1'), Decimal('1'))
        Decimal('-0')
        >>> ExtendedContext.quantize(Decimal('-0'), Decimal('1e+5'))
        Decimal('-0E+5')
        >>> ExtendedContext.quantize(Decimal('+35236450.6'), Decimal('1e-2'))
        Decimal('NaN')
        >>> ExtendedContext.quantize(Decimal('-35236450.6'), Decimal('1e-2'))
        Decimal('NaN')
        >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e-1'))
        Decimal('217.0')
        >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e-0'))
        Decimal('217')
        >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e+1'))
        Decimal('2.2E+2')
        >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e+2'))
        Decimal('2E+2')
        >>> ExtendedContext.quantize(1, 2)
        Decimal('1')
        >>> ExtendedContext.quantize(Decimal(1), 2)
        Decimal('1')
        >>> ExtendedContext.quantize(1, Decimal(2))
        Decimal('1')
        Tr�rL)r�rr�r)r)r+res7zContext.quantizecCstd�S)zkJust returns 10, as this is Decimal, :)

        >>> ExtendedContext.radix()
        Decimal('10')
        r�r�r�r)r)r+r��sz
Context.radixcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)aReturns the remainder from integer division.

        The result is the residue of the dividend after the operation of
        calculating integer division as described for divide-integer, rounded
        to precision digits if necessary.  The sign of the result, if
        non-zero, is the same as that of the original dividend.

        This operation will fail under the same conditions as integer division
        (that is, if integer division on the same two operands would fail, the
        remainder cannot be calculated).

        >>> ExtendedContext.remainder(Decimal('2.1'), Decimal('3'))
        Decimal('2.1')
        >>> ExtendedContext.remainder(Decimal('10'), Decimal('3'))
        Decimal('1')
        >>> ExtendedContext.remainder(Decimal('-10'), Decimal('3'))
        Decimal('-1')
        >>> ExtendedContext.remainder(Decimal('10.2'), Decimal('1'))
        Decimal('0.2')
        >>> ExtendedContext.remainder(Decimal('10'), Decimal('0.3'))
        Decimal('0.1')
        >>> ExtendedContext.remainder(Decimal('3.6'), Decimal('1.3'))
        Decimal('1.0')
        >>> ExtendedContext.remainder(22, 6)
        Decimal('4')
        >>> ExtendedContext.remainder(Decimal(22), 6)
        Decimal('4')
        >>> ExtendedContext.remainder(22, Decimal(6))
        Decimal('4')
        Tr�rLr�N)r�r�r�rwr�r)r)r+r��s
zContext.remaindercCst|dd�}|j||d�S)aGReturns to be "a - b * n", where n is the integer nearest the exact
        value of "x / b" (if two integers are equally near then the even one
        is chosen).  If the result is equal to 0 then its sign will be the
        sign of a.

        This operation will fail under the same conditions as integer division
        (that is, if integer division on the same two operands would fail, the
        remainder cannot be calculated).

        >>> ExtendedContext.remainder_near(Decimal('2.1'), Decimal('3'))
        Decimal('-0.9')
        >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('6'))
        Decimal('-2')
        >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('3'))
        Decimal('1')
        >>> ExtendedContext.remainder_near(Decimal('-10'), Decimal('3'))
        Decimal('-1')
        >>> ExtendedContext.remainder_near(Decimal('10.2'), Decimal('1'))
        Decimal('0.2')
        >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('0.3'))
        Decimal('0.1')
        >>> ExtendedContext.remainder_near(Decimal('3.6'), Decimal('1.3'))
        Decimal('-0.3')
        >>> ExtendedContext.remainder_near(3, 11)
        Decimal('3')
        >>> ExtendedContext.remainder_near(Decimal(3), 11)
        Decimal('3')
        >>> ExtendedContext.remainder_near(3, Decimal(11))
        Decimal('3')
        Tr�rL)r�r�r�r)r)r+r��szContext.remainder_nearcCst|dd�}|j||d�S)aNReturns a rotated copy of a, b times.

        The coefficient of the result is a rotated copy of the digits in
        the coefficient of the first operand.  The number of places of
        rotation is taken from the absolute value of the second operand,
        with the rotation being to the left if the second operand is
        positive or to the right otherwise.

        >>> ExtendedContext.rotate(Decimal('34'), Decimal('8'))
        Decimal('400000003')
        >>> ExtendedContext.rotate(Decimal('12'), Decimal('9'))
        Decimal('12')
        >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('-2'))
        Decimal('891234567')
        >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('0'))
        Decimal('123456789')
        >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('+2'))
        Decimal('345678912')
        >>> ExtendedContext.rotate(1333333, 1)
        Decimal('13333330')
        >>> ExtendedContext.rotate(Decimal(1333333), 1)
        Decimal('13333330')
        >>> ExtendedContext.rotate(1333333, Decimal(1))
        Decimal('13333330')
        Tr�rL)r�r�r�r)r)r+r��szContext.rotatecCst|dd�}|�|�S)a�Returns True if the two operands have the same exponent.

        The result is never affected by either the sign or the coefficient of
        either operand.

        >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('0.001'))
        False
        >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('0.01'))
        True
        >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('1'))
        False
        >>> ExtendedContext.same_quantum(Decimal('Inf'), Decimal('-Inf'))
        True
        >>> ExtendedContext.same_quantum(10000, -1)
        True
        >>> ExtendedContext.same_quantum(Decimal(10000), -1)
        True
        >>> ExtendedContext.same_quantum(10000, Decimal(-1))
        True
        Tr�)r�r>r�r)r)r+r>szContext.same_quantumcCst|dd�}|j||d�S)a3Returns the first operand after adding the second value its exp.

        >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('-2'))
        Decimal('0.0750')
        >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('0'))
        Decimal('7.50')
        >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('3'))
        Decimal('7.50E+3')
        >>> ExtendedContext.scaleb(1, 4)
        Decimal('1E+4')
        >>> ExtendedContext.scaleb(Decimal(1), 4)
        Decimal('1E+4')
        >>> ExtendedContext.scaleb(1, Decimal(4))
        Decimal('1E+4')
        Tr�rL)r�r�r�r)r)r+r�$szContext.scalebcCst|dd�}|j||d�S)a{Returns a shifted copy of a, b times.

        The coefficient of the result is a shifted copy of the digits
        in the coefficient of the first operand.  The number of places
        to shift is taken from the absolute value of the second operand,
        with the shift being to the left if the second operand is
        positive or to the right otherwise.  Digits shifted into the
        coefficient are zeros.

        >>> ExtendedContext.shift(Decimal('34'), Decimal('8'))
        Decimal('400000000')
        >>> ExtendedContext.shift(Decimal('12'), Decimal('9'))
        Decimal('0')
        >>> ExtendedContext.shift(Decimal('123456789'), Decimal('-2'))
        Decimal('1234567')
        >>> ExtendedContext.shift(Decimal('123456789'), Decimal('0'))
        Decimal('123456789')
        >>> ExtendedContext.shift(Decimal('123456789'), Decimal('+2'))
        Decimal('345678900')
        >>> ExtendedContext.shift(88888888, 2)
        Decimal('888888800')
        >>> ExtendedContext.shift(Decimal(88888888), 2)
        Decimal('888888800')
        >>> ExtendedContext.shift(88888888, Decimal(2))
        Decimal('888888800')
        Tr�rL)r�r�r�r)r)r+r�7sz
Context.shiftcCst|dd�}|j|d�S)a�Square root of a non-negative number to context precision.

        If the result must be inexact, it is rounded using the round-half-even
        algorithm.

        >>> ExtendedContext.sqrt(Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.sqrt(Decimal('-0'))
        Decimal('-0')
        >>> ExtendedContext.sqrt(Decimal('0.39'))
        Decimal('0.624499800')
        >>> ExtendedContext.sqrt(Decimal('100'))
        Decimal('10')
        >>> ExtendedContext.sqrt(Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.sqrt(Decimal('1.0'))
        Decimal('1.0')
        >>> ExtendedContext.sqrt(Decimal('1.00'))
        Decimal('1.0')
        >>> ExtendedContext.sqrt(Decimal('7'))
        Decimal('2.64575131')
        >>> ExtendedContext.sqrt(Decimal('10'))
        Decimal('3.16227766')
        >>> ExtendedContext.sqrt(2)
        Decimal('1.41421356')
        >>> ExtendedContext.prec
        9
        Tr�rL)r�rHr�r)r)r+rHUszContext.sqrtcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)a&Return the difference between the two operands.

        >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('1.07'))
        Decimal('0.23')
        >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('1.30'))
        Decimal('0.00')
        >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('2.07'))
        Decimal('-0.77')
        >>> ExtendedContext.subtract(8, 5)
        Decimal('3')
        >>> ExtendedContext.subtract(Decimal(8), 5)
        Decimal('3')
        >>> ExtendedContext.subtract(8, Decimal(5))
        Decimal('3')
        Tr�rLr�N)r�r�r�rwr�r)r)r+�subtractus
zContext.subtractcCst|dd�}|j|d�S)a�Convert to a string, using engineering notation if an exponent is needed.

        Engineering notation has an exponent which is a multiple of 3.  This
        can leave up to 3 digits to the left of the decimal place and may
        require the addition of either one or two trailing zeros.

        The operation is not affected by the context.

        >>> ExtendedContext.to_eng_string(Decimal('123E+1'))
        '1.23E+3'
        >>> ExtendedContext.to_eng_string(Decimal('123E+3'))
        '123E+3'
        >>> ExtendedContext.to_eng_string(Decimal('123E-10'))
        '12.3E-9'
        >>> ExtendedContext.to_eng_string(Decimal('-123E-12'))
        '-123E-12'
        >>> ExtendedContext.to_eng_string(Decimal('7E-7'))
        '700E-9'
        >>> ExtendedContext.to_eng_string(Decimal('7E+1'))
        '70'
        >>> ExtendedContext.to_eng_string(Decimal('0E+1'))
        '0.00E+3'

        Tr�rL)r�r�r�r)r)r+r��szContext.to_eng_stringcCst|dd�}|j|d�S)zyConverts a number to a string, using scientific notation.

        The operation is not affected by the context.
        Tr�rL)r�r�r�r)r)r+�
to_sci_string�szContext.to_sci_stringcCst|dd�}|j|d�S)akRounds to an integer.

        When the operand has a negative exponent, the result is the same
        as using the quantize() operation using the given operand as the
        left-hand-operand, 1E+0 as the right-hand-operand, and the precision
        of the operand as the precision setting; Inexact and Rounded flags
        are allowed in this operation.  The rounding mode is taken from the
        context.

        >>> ExtendedContext.to_integral_exact(Decimal('2.1'))
        Decimal('2')
        >>> ExtendedContext.to_integral_exact(Decimal('100'))
        Decimal('100')
        >>> ExtendedContext.to_integral_exact(Decimal('100.0'))
        Decimal('100')
        >>> ExtendedContext.to_integral_exact(Decimal('101.5'))
        Decimal('102')
        >>> ExtendedContext.to_integral_exact(Decimal('-101.5'))
        Decimal('-102')
        >>> ExtendedContext.to_integral_exact(Decimal('10E+5'))
        Decimal('1.0E+6')
        >>> ExtendedContext.to_integral_exact(Decimal('7.89E+77'))
        Decimal('7.89E+77')
        >>> ExtendedContext.to_integral_exact(Decimal('-Inf'))
        Decimal('-Infinity')
        Tr�rL)r�rBr�r)r)r+rB�szContext.to_integral_exactcCst|dd�}|j|d�S)aLRounds to an integer.

        When the operand has a negative exponent, the result is the same
        as using the quantize() operation using the given operand as the
        left-hand-operand, 1E+0 as the right-hand-operand, and the precision
        of the operand as the precision setting, except that no flags will
        be set.  The rounding mode is taken from the context.

        >>> ExtendedContext.to_integral_value(Decimal('2.1'))
        Decimal('2')
        >>> ExtendedContext.to_integral_value(Decimal('100'))
        Decimal('100')
        >>> ExtendedContext.to_integral_value(Decimal('100.0'))
        Decimal('100')
        >>> ExtendedContext.to_integral_value(Decimal('101.5'))
        Decimal('102')
        >>> ExtendedContext.to_integral_value(Decimal('-101.5'))
        Decimal('-102')
        >>> ExtendedContext.to_integral_value(Decimal('10E+5'))
        Decimal('1.0E+6')
        >>> ExtendedContext.to_integral_value(Decimal('7.89E+77'))
        Decimal('7.89E+77')
        >>> ExtendedContext.to_integral_value(Decimal('-Inf'))
        Decimal('-Infinity')
        Tr�rL)r�rr�r)r)r+r�szContext.to_integral_value)	NNNNNNNNN)N)rR)N)Xr4r5r6r7r�r�r�r�r�r�r�rNr�rCrMr�rir�r�r�r�r�r�rDr�r�rmr�r�rMr�rNrJrRr�r�r�rSr�r�r�rWrrVrWr=r�rYr�rZr�r[r\rfrirjrxrzr{ryr�r~r�rr�r�r�r�r�r;r�r�r�rr�r�r�r�r>r�r�rHr�r�r�rBrr�r)r)r)r+rs��
$



$#


%
 #2
P:&" c@s"eZdZdZddd�Zdd�ZdS)rn�rCrVrWNcCsf|dkrd|_d|_d|_nFt|t�rD|j|_t|j�|_|j|_n|d|_|d|_|d|_dS)Nr&r.r^)rCrVrWrdrr;r<rP)r0ryr)r)r+r��s



z_WorkRep.__init__cCsd|j|j|jfS)Nz(%r, %r, %r)r�r�r)r)r+r�sz_WorkRep.__repr__)N)r4r5r6r�r�r�r)r)r)r+rn�s
rncCs�|j|jkr|}|}n|}|}tt|j��}tt|j��}|jtd||d�}||jd|krpd|_||_|jd|j|j9_|j|_||fS)zcNormalizes op1, op2 to have the same exp and length of coefficient.

    Done during addition.
    r�r^r.r�)rWrkrerVr�)r�r�rFZtmpr�Ztmp_lenZ	other_lenrWr)r)r+r�sr�cCsb|dkrdS|dkr |d|Stt|��}t|�t|�d��}||krPdS|d|SdS)a Given integers n and e, return n * 10**e if it's an integer, else None.

    The computation is designed to avoid computing large powers of 10
    unnecessarily.

    >>> _decimal_lshift_exact(3, 4)
    30000
    >>> _decimal_lshift_exact(300, -999999999)  # returns None

    r&r�rRN)rermrk�rstrip)r9r�Zstr_nZval_nr)r)r+r#(sr#cCsB|dks|dkrtd��d}||kr>||||d?}}q|S)z�Closest integer to the square root of the positive integer n.  a is
    an initial approximation to the square root.  Any positive integer
    will do for a, but the closer a is to the square root of n the
    faster convergence will be.

    r&z3Both arguments to _sqrt_nearest should be positive.r.)rq)r9r-rsr)r)r+�
_sqrt_nearest=sr�cCs2d|>||?}}|d||d@|d@|kS)z�Given an integer x and a nonnegative integer shift, return closest
    integer to x / 2**shift; use round-to-even in case of a tie.

    r.r^r))r&r�rsr�r)r)r+�_rshift_nearestLsr�cCs&t||�\}}|d||d@|kS)zaClosest integer to a/b, a and b positive integers; rounds to even
    in the case of a tie.

    r^r.)r�)r-rsr�r�r)r)r+�_div_nearestTsr�rc		Cs�||}d}||kr(t|�||>|ksD||krxt|�||?|krxt||d>|t||t||�|��}|d7}qtdtt|��d|�}t||�}t||�}t|ddd�D]}t||�t|||�}q�t|||�S)a�Integer approximation to M*log(x/M), with absolute error boundable
    in terms only of x/M.

    Given positive integers x and M, return an integer approximation to
    M * log(x/M).  For L = 8 and 0.1 <= x/M <= 10 the difference
    between the approximation and the exact result is at most 22.  For
    L = 8 and 1.0 <= x/M <= 10.0 the difference is at most 15.  In
    both cases these are upper bounds on the error; it will usually be
    much smaller.r&r.���r\r�)rmr�r�r�rVrkrer)	r&�M�Lr)�R�TZyshift�wr�r)r)r+�_ilog\s"���


r�c
Cs�|d7}tt|��}||||dk}|dkr�d|}|||}|dkrZ|d|9}nt|d|�}t||�}t|�}t|||�}||}	nd}t|d|�}	t|	|d�S)z�Given integers c, e and p with c > 0, p >= 0, compute an integer
    approximation to 10**p * log10(c*10**e), with an absolute error of
    at most 1.  Assumes that c*10**e is not exactly 1.r^r.r&r�r!)rkrer�r��
_log10_digits)
rFr�r%rGr�r�r��log_dZlog_10Zlog_tenpowerr)r)r+rh�s 

rhc	Cs�|d7}tt|��}||||dk}|dkrr|||}|dkrR|d|9}nt|d|�}t|d|�}nd}|r�ttt|���d}||dkr�t|t||�d|�}q�d}nd}t||d�S)z�Given integers c, e and p with c > 0, compute an integer
    approximation to 10**p * log(c*10**e), with an absolute error of
    at most 1.  Assumes that c*10**e is not exactly 1.r^r.r&r�r!)rkrer�r�rmr�)	rFr�r%rGr�r�r�r6Z	f_log_tenr)r)r+rd�s"rdc@s eZdZdZdd�Zdd�ZdS)�
_Log10Memoizez�Class to compute, store, and allow retrieval of, digits of the
    constant log(10) = 2.302585....  This constant is needed by
    Decimal.ln, Decimal.log10, Decimal.exp and Decimal.__pow__.cCs
d|_dS)NZ/23025850929940456840179914546843642076011014886)r}r�r)r)r+r��sz_Log10Memoize.__init__cCs�|dkrtd��|t|j�kr�d}d||d}tttd||�d��}||d�d|krbql|d7}q"|�d�dd	�|_t|jd|d
��S)ztGiven an integer p >= 0, return floor(10**p)*log(10).

        For example, self.getdigits(3) returns 2302.
        r&zp should be nonnegativer\r�r^r!NrRr�r.)rqrkr}rer�r�r�rV)r0r%r6r�r}r)r)r+�	getdigits�s	
z_Log10Memoize.getdigitsN)r4r5r6r7r�r�r)r)r)r+r��sr�c	Cs�t||>|�}tdtt|��d|�}t||�}||>}t|ddd�D]}t|||||�}qPt|ddd�D]"}||d>}t||||�}q|||S)z�Given integers x and M, M > 0, such that x/M is small in absolute
    value, compute an integer approximation to M*exp(x/M).  For 0 <=
    x/M <= 2.4, the absolute error in the result is bounded by 60 (and
    is usually much smaller).r�r\r.r&r�r^)r"rVrkrer�r)	r&r�r�r�r�r)ZMshiftrr�r)r)r+�_iexp�s
r�c	Cs�|d7}td|tt|��d�}||}||}|dkrH|d|}n|d|}t|t|��\}}t|d|�}tt|d|�d�||dfS)a�Compute an approximation to exp(c*10**e), with p decimal places of
    precision.

    Returns integers d, f such that:

      10**(p-1) <= d <= 10**p, and
      (d-1)*10**f < exp(c*10**e) < (d+1)*10**f

    In other words, d*10**f is an approximation to exp(c*10**e) with p
    digits of precision, and with an error in d of at most 1.  This is
    almost, but not quite, the same as the error being < 1ulp: when d
    = 10**(p-1) the error could be up to 10 ulp.r^r&r.r�i�r\)r�rkrer�r�r�r�)	rFr�r%r6r�r�ZcshiftZquotr,r)r)r+rT$srTcCs�ttt|���|}t||||d�}||}|dkrJ||d|}nt||d|�}|dkr�tt|��|dk|dkkr�d|ddd|}	}
q�d|d|}	}
n,t||d|d�\}	}
t|	d�}	|
d7}
|	|
fS)a5Given integers xc, xe, yc and ye representing Decimals x = xc*10**xe and
    y = yc*10**ye, compute x**y.  Returns a pair of integers (c, e) such that:

      10**(p-1) <= c <= 10**p, and
      (c-1)*10**e < x**y < (c+1)*10**e

    in other words, c*10**e is an approximation to x**y with p digits
    of precision, and with an error in c of at most 1.  (This is
    almost, but not quite, the same as the error being < 1ulp: when c
    == 10**(p-1) we can only guarantee error < 10ulp.)

    We assume that: x is positive and not equal to 1, and y is nonzero.
    r.r&r�)rkrermrdr�rT)r'r(r*r+r%rsZlxcr�Zpcr�rWr)r)r+r1Hs
r1r!�F�5�(�r]�r�r~)	r��2�3�4�5�6�7�8rDcCs0|dkrtd��t|�}dt|�||dS)z@Compute a lower bound for 100*log10(c) for a positive integer c.r&z0The argument to _log10_lb should be nonnegative.r!)rqrerk)rFZ
correctionZstr_cr)r)r+r$rsr$cCsLt|t�r|St|t�r t|�S|r8t|t�r8t�|�S|rHtd|��tS)z�Convert other to Decimal.

    Verifies that it's ok to use in an implicit construction.
    If allow_float is true, allow conversion from float;  this
    is used in the comparison methods (__eq__ and friends).

    r�)rdrrVrurvrwr�)r�r�Zallow_floatr)r)r+r�}s


r�cCs�t|t�r||fSt|tj�rR|jsDt|jtt|j	�|j
�|j�}|t|j�fS|rrt|tj
�rr|jdkrr|j}t|t�r�t�}|r�d|jt<n|�td�|t�|�fSttfS)z�Given a Decimal instance self and a Python object other, return
    a pair (s, o) of Decimal instances such that "s op o" is
    equivalent to "self op other" for any of the 6 comparison
    operators "op".

    r&r.ra)rdr�_numbersZRationalrQr:r;rerVr<�denominatorrP�	numeratorZComplexr�r�rurr4rrirvr�)r0r�r�r1r)r)r+r��s(
�
�r�r i?Bi���)rFrEr3r4rGr<r�r�r_)rFrEr3r4a�        # A numeric string consists of:
#    \s*
    (?P<sign>[-+])?              # an optional sign, followed by either...
    (
        (?=\d|\.\d)              # ...a number (with at least one digit)
        (?P<int>\d*)             # having a (possibly empty) integer part
        (\.(?P<frac>\d*))?       # followed by an optional fractional part
        (E(?P<exp>[-+]?\d+))?    # followed by an optional exponent, or...
    |
        Inf(inity)?              # ...an infinity, or...
    |
        (?P<signal>s)?           # ...an (optionally signaling)
        NaN                      # NaN
        (?P<diag>\d*)            # with (possibly empty) diagnostic info.
    )
#    \s*
    \Z
z0*$z50*$z�\A
(?:
   (?P<fill>.)?
   (?P<align>[<>=^])
)?
(?P<sign>[-+ ])?
(?P<alt>\#)?
(?P<zeropad>0)?
(?P<minimumwidth>(?!0)\d+)?
(?P<thousands_sep>,)?
(?:\.(?P<precision>0|(?!0)\d+))?
(?P<type>[eEfFgGn%])?
\Z
cCs�t�|�}|dkrtd|��|��}|d}|d}|ddk	|d<|drv|dk	rbtd|��|dk	rvtd|��|p|d|d<|p�d	|d<|d
dkr�d|d
<t|dp�d
�|d<|ddk	r�t|d�|d<|ddkr�|ddks�|ddkr�d|d<|ddk�rfd|d<|dk�r&t��}|ddk	�r@td|��|d|d<|d|d<|d|d<n*|ddk�r|d|d<ddg|d<d|d<|S)a�Parse and validate a format specifier.

    Turns a standard numeric format specifier into a dict, with the
    following entries:

      fill: fill character to pad field to minimum width
      align: alignment type, either '<', '>', '=' or '^'
      sign: either '+', '-' or ' '
      minimumwidth: nonnegative integer giving minimum width
      zeropad: boolean, indicating whether to pad with zeros
      thousands_sep: string to use as thousands separator, or ''
      grouping: grouping for thousands separators, in format
        used by localeconv
      decimal_point: string to use for decimal point
      precision: nonnegative integer giving precision, or None
      type: one of the characters 'eEfFgG%', or None

    NzInvalid format specifier: �fill�align�zeropadz7Fill character conflicts with '0' in format specifier: z2Alignment conflicts with '0' in format specifier: � �>rCrU�minimumwidthrRr�r&r�ZgGnr.r9r��
thousands_sepzJExplicit thousands separator conflicts with 'n' type in format specifier: �grouping�
decimal_pointrTr\r�)�_parse_format_specifier_regex�matchrq�	groupdictrV�_locale�
localeconv)�format_specr�rzZformat_dictrrr)r)r+r�sT
��
�r�c	Cs�|d}|d}||t|�t|�}|d}|dkrF|||}nj|dkr\|||}nT|dkrr|||}n>|dkr�t|�d}|d	|�||||d	�}ntd
��|S)z�Given an unpadded, non-aligned numeric string 'body' and sign
    string 'sign', add padding and alignment conforming to the given
    format specifier dictionary 'spec' (as produced by
    parse_format_specifier).

    r	rr�<r�=�^r^NzUnrecognised alignment field)rkrq)	rCr�r�r	rZpaddingrr�Zhalfr)r)r+r�ms"r�cCspddlm}m}|sgS|ddkrJt|�dkrJ||dd�||d��S|dtjkrd|dd�Std��dS)zyConvert a localeconv-style grouping into a (possibly infinite)
    iterable of integers representing group lengths.

    r&)�chain�repeatr�r^Nr�z unrecognised format for grouping)�	itertoolsrrrkr�CHAR_MAXrq)rrrr)r)r+�_group_lengths�s
rcCs�|d}|d}g}t|�D]�}|dkr0td��ttt|�|d�|�}|�d|t|�||d��|d|�}||8}|s�|dkr�q�|t|�8}qtt|�|d�}|�d|t|�||d��|�t|��S)anInsert thousands separators into a digit string.

    spec is a dictionary whose keys should include 'thousands_sep' and
    'grouping'; typically it's the result of parsing the format
    specifier using _parse_format_specifier.

    The min_width keyword argument gives the minimum length of the
    result, which will be padded on the left with zeros if necessary.

    If necessary, the zero padding adds an extra '0' on the left to
    avoid a leading thousands separator.  For example, inserting
    commas every three digits in '123456', with min_width=8, gives
    '0,123,456', even though that has length 9.

    r
rr&zgroup length should be positiver.rRN)rrqr�r�rkrrrs�reversed)r}r��	min_width�sepr�groupsrGr)r)r+�_insert_thousands_sep�s $$rcCs$|rdS|ddkr|dSdSdS)zDetermine sign character.rUrCz +rTNr))�is_negativer�r)r)r+r��s
r�cCs�t||�}|s|dr"|d|}|dks6|ddkr\ddddd�|d}|d	�||�7}|dd
krp|d
7}|dr�|dt|�t|�}nd}t|||�}t||||�S)
acFormat a number, given the following data:

    is_negative: true if the number is negative, else false
    intpart: string of digits that must appear before the decimal point
    fracpart: string of digits that must come after the point
    exp: exponent, as an integer
    spec: dictionary resulting from parsing the format specifier

    This function uses the information in spec to:
      insert separators (decimal separator and thousands separators)
      format the sign
      format the exponent
      add trailing '%' for the '%' type
      zero-pad if necessary
      fill and align if necessary
    Zaltrr&r�r�r�r�)r�r�r�r�z{0}{1:+}r�rr	)r��formatrkrr�)r r{r|rWr�rCZecharrr)r)r+r��s
r�ZInfz-Infr�r�r^)N)F)r&)r)r)FF)F)N)r.)zr7�__all__r4Z	__xname__�__version__Z__libmpdec_version__ZmathrZnumbersr�sys�collectionsr'Z_namedtupler�ImportErrorrrrrrrrrr$r%�maxsizer r!r"r#�ArithmeticErrorrrr	r�ZeroDivisionErrorr
rrrrrr
rrrwrr2r�r�ZcontextvarsZ
ContextVarrHrrrrbrr:�Number�registerrOrrnr�rVr�r"r#r�r�r�r�rhrdr�r�r�r�rTr1r$r�r�rrr�re�compile�VERBOSE�
IGNORECASErrfr�r�DOTALLr
Zlocalerr�r�rrr�r�rcrbr>rPr/rOrA�	hash_info�modulusr�r�r�r�r�r�r�r)r)r)r+�<module>s�e�#

&
���

.
^

0",#
%$+�

*���
�
�
P
%
)calendar.cpython-38.opt-2.pyc000064400000053712150335716500011722 0ustar00U

e5da�@s0ddlZddlZddlZddlmZddddddd	d
ddd
dddddddddddddgZeZGdd�de�Z	Gdd�de�Z
dZdZddd dd!dd!ddd!dd!dg
Z
Gd"d#�d#�ZGd$d%�d%�Zed&�Zed'�Zed(�Zed)�Zed*�\ZZZZZZZd+d�Zd,d�Zd-d	�Zd.d
�Zd/d0�Z d1d2�Z!d3d4�Z"Gd5d�de#�Z$Gd6d�de$�Z%Gd7d�de$�Z&Gd8d9�d9�Z'Gd:d�de%�Z(Gd;d�de&�Z)e%�Z*e*j+Z,d<d�Z-e*j.Z/e*j0Z0e*j1Z2e*j3Z4e*j5Z5e*j6Z7e*j8Z9e*j:Z;d=Z<d>Z=e<e=fd?d@�Z>e<e=fdAdB�Z?dCZ@e�Ae@dd��B�ZCdDd�ZDdEdF�ZEeFdGk�r,eEejG�dS)H�N)�repeat�IllegalMonthError�IllegalWeekdayError�setfirstweekday�firstweekday�isleap�leapdays�weekday�
monthrange�
monthcalendar�prmonth�month�prcal�calendar�timegm�
month_name�
month_abbr�day_name�day_abbr�Calendar�TextCalendar�HTMLCalendar�LocaleTextCalendar�LocaleHTMLCalendar�
weekheaderc@seZdZdd�Zdd�ZdS)rcCs
||_dS�N�r
)�selfr
�r� /usr/lib64/python3.8/calendar.py�__init__szIllegalMonthError.__init__cCs
d|jS)Nz!bad month number %r; must be 1-12r�rrrr�__str__szIllegalMonthError.__str__N��__name__�
__module__�__qualname__r r"rrrrrsc@seZdZdd�Zdd�ZdS)rcCs
||_dSr�r	)rr	rrrr  szIllegalWeekdayError.__init__cCs
d|jS)Nz7bad weekday number %r; must be 0 (Monday) to 6 (Sunday)r'r!rrrr""szIllegalWeekdayError.__str__Nr#rrrrrs�����c@sFeZdZdd�ed�D�Ze�ddd��dd�Zd	d
�Zdd�Zd
S)�_localized_monthcCs g|]}t�d|dd�j�qS�i�r(��datetime�date�strftime��.0�irrr�
<listcomp>4sz_localized_month.<listcomp>�rcCsdS)N�r)�xrrr�<lambda>5�z_localized_month.<lambda>cCs
||_dSr��format�rr=rrrr 7sz_localized_month.__init__cs4�j|}t|t�r&�fdd�|D�S|�j�SdS)Ncsg|]}|�j��qSrr<�r4�fr!rrr6=sz0_localized_month.__getitem__.<locals>.<listcomp>)�_months�
isinstance�slicer=�rr5Zfuncsrr!r�__getitem__:s

z_localized_month.__getitem__cCsdS)N�
rr!rrr�__len__Asz_localized_month.__len__N)	r$r%r&�rangerA�insertr rErGrrrrr-2s
r-c@s6eZdZdd�ed�D�Zdd�Zdd�Zdd	�Zd
S)�_localized_daycCs g|]}t�dd|d�j�qSr.r/r3rrrr6Hsz_localized_day.<listcomp>�cCs
||_dSrr<r>rrrr Jsz_localized_day.__init__cs4�j|}t|t�r&�fdd�|D�S|�j�SdS)Ncsg|]}|�j��qSrr<r?r!rrr6Psz._localized_day.__getitem__.<locals>.<listcomp>)�_daysrBrCr=rDrr!rrEMs

z_localized_day.__getitem__cCsdS�NrKrr!rrrrGTsz_localized_day.__len__N)r$r%r&rHrLr rErGrrrrrJEsrJz%Az%az%Bz%brKcCs$|ddko"|ddkp"|ddkS)N�r�d�r)�yearrrrrdscCs@|d8}|d8}|d|d|d|d|d|dS)Nr(rNrOrPr)Zy1Zy2rrrriscCs8tj|krtjks&nd|d}t�|||���S)Ni�rP)r0ZMINYEARZMAXYEARr1r	)rQr
�dayrrrr	qscCsJd|krdksnt|��t||d�}t||tko>t|�}||fS�Nr(r7)rr	�mdays�Februaryr)rQr
�day1�ndaysrrrr
xs
cCst||tkot|�Sr)rTrUr�rQr
rrr�	_monthlen�srYcCs$|dkr|ddfS||dfSdSrSrrXrrr�
_prevmonth�srZcCs$|dkr|ddfS||dfSdS)Nr7r(rrXrrr�
_nextmonth�sr[c@s�eZdZd"dd�Zdd�Zdd�Zeee�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd#dd�Zd$dd�Zd%dd �Zd!S)&rrcCs
||_dSr�r�rrrrrr �szCalendar.__init__cCs
|jdSrM�Z
_firstweekdayr!rrr�getfirstweekday�szCalendar.getfirstweekdaycCs
||_dSrr^r]rrrr�szCalendar.setfirstweekdayccs&t|j|jd�D]}|dVqdSrM)rHr)rr5rrr�iterweekdays�szCalendar.iterweekdaysccs,|�||�D]\}}}t�|||�VqdSr)�itermonthdays3r0r1)rrQr
�y�m�drrr�itermonthdates�szCalendar.itermonthdatesccsft||�\}}||jd}td|�EdHtd|d�EdH|j||d}td|�EdHdS)NrKrr()r
rrrH)rrQr
rVrW�days_before�
days_afterrrr�
itermonthdays�szCalendar.itermonthdaysccs0t|�||�|j�D]\}}||dfVqdSrM)�	enumeraterhr)rrQr
r5rdrrr�itermonthdays2�szCalendar.itermonthdays2ccs�t||�\}}||jd}|j||d}t||�\}}t||�d}	t|	||	�D]}
|||
fVqXtd|d�D]}
|||
fVqxt||�\}}td|d�D]}
|||
fVq�dS)NrKr()r
rrZrYrHr[)rrQr
rVrWrfrgrbrc�endrdrrrra�szCalendar.itermonthdays3ccs<t|�||��D]&\}\}}}||||j|dfVqdSrM)rirar)rrQr
r5rbrcrdrrr�itermonthdays4�szCalendar.itermonthdays4cs.t|�||����fdd�tdt��d�D�S)Ncsg|]}�||d��qS�rKrr3�Zdatesrrr6�sz/Calendar.monthdatescalendar.<locals>.<listcomp>rrK)�listrerH�len�rrQr
rrnr�monthdatescalendar�szCalendar.monthdatescalendarcs.t|�||����fdd�tdt��d�D�S)Ncsg|]}�||d��qSrmrr3��daysrrr6�sz/Calendar.monthdays2calendar.<locals>.<listcomp>rrK)rorjrHrprqrrsr�monthdays2calendar�szCalendar.monthdays2calendarcs.t|�||����fdd�tdt��d�D�S)Ncsg|]}�||d��qSrmrr3rsrrr6�sz.Calendar.monthdayscalendar.<locals>.<listcomp>rrK)rorhrHrprqrrsr�monthdayscalendar�szCalendar.monthdayscalendar�cs>��fdd�tttd�D����fdd�tdt����D�S)Ncsg|]}���|��qSr)rrr3�rrQrrr6s�z.Calendar.yeardatescalendar.<locals>.<listcomp>r7csg|]}�||���qSrrr3��months�widthrrr6	sr�rH�Januaryrp�rrQr{r�rzrr{rQr�yeardatescalendar�s�zCalendar.yeardatescalendarcs>��fdd�tttd�D����fdd�tdt����D�S)Ncsg|]}���|��qSr)rur3rxrrr6s�z.Calendar.yeardays2calendar.<locals>.<listcomp>r7csg|]}�||���qSrrr3ryrrr6srr|r~rrr�yeardays2calendars�zCalendar.yeardays2calendarcs>��fdd�tttd�D����fdd�tdt����D�S)Ncsg|]}���|��qSr)rvr3rxrrr6s�z-Calendar.yeardayscalendar.<locals>.<listcomp>r7csg|]}�||���qSrrr3ryrrr6"srr|r~rrr�yeardayscalendars�zCalendar.yeardayscalendarN)r)rw)rw)rw)r$r%r&r r_r�propertyrr`rerhrjrarlrrrurvr�r�r�rrrrr�s 

	



c@sfeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zddd
�Zddd�Z	ddd�Z
ddd�Zd dd�ZdS)!rcCst|�||�dd�dS�Nr8)rk)�print�
formatweek�r�theweekr{rrr�prweek+szTextCalendar.prweekcCs |dkrd}nd|}|�|�S)Nrr8z%2i��center)rrRr	r{�srrr�	formatday1szTextCalendar.formatdaycsd���fdd�|D��S)N� c3s |]\}}��||��VqdSr�r��r4rdZwd�rr{rr�	<genexpr>?sz*TextCalendar.formatweek.<locals>.<genexpr>��joinr�rr�rr�;szTextCalendar.formatweekcCs(|dkrt}nt}||d|��|�S�N�	)rrr�)rrRr{�namesrrr�
formatweekdayAszTextCalendar.formatweekdaycsd���fdd����D��S)Nr�c3s|]}��|��VqdSr�r�r3r�rrr�Osz0TextCalendar.formatweekheader.<locals>.<genexpr>�r�r`r�rr�r�formatweekheaderKszTextCalendar.formatweekheaderTcCs"t|}|rd||f}|�|�S�Nz%s %r)rr��r�theyear�themonthr{�withyearr�rrr�formatmonthnameQszTextCalendar.formatmonthnamercCst|�||||�dd�dSr�)r��formatmonth)rr�r��w�lrrrrZszTextCalendar.prmonthcCs�td|�}td|�}|�||d|dd�}|��}|d|7}||�|���7}|d|7}|�||�D]$}||�||���7}|d|7}ql|S)Nr)r(rK�
)�maxr��rstripr�rur�)rr�r�r�r�r��weekrrrr�`s

zTextCalendar.formatmonthr)r(�rwc	s�td|�}td|�}td|�}|ddd�g}|j}|t����|||d����|d|���|��t���|��D�]"\}}	t||dt	||ddd��}
|d|����fdd�|
D�}|t
|�|����|d|��fdd�|
D�}|t
|�|����|d|�td	d�|	D��}
t|
�D]f}g}|	D]6}|t|�k�rj|�d
�n|���|||���qL|t
|�|����|d|��q@q�d
�
|�S)Nr)r(rKr�rFc3s|]}���|�d�VqdS)FN)r��r4�k)�colwidthrr�rrr��s�z*TextCalendar.formatyear.<locals>.<genexpr>c3s|]
}�VqdSrrr�)�headerrrr��scss|]}t|�VqdSr)rp)r4�calrrrr��sr8)r��append�reprr�r�r�rir�rH�min�formatstringrpr�r�)rr�r�r��crc�v�ar5�rowrzr�ZheadersZheight�jZweeksr�r)r�r�rr�r�
formatyearps<


&
$�zTextCalendar.formatyearcCst|�|||||�dd�dSr�)r�r�)rr�r�r�r�rcrrr�pryear�szTextCalendar.pryearN)T)rr)rr)r)r(r�rw)rrr�rw)
r$r%r&r�r�r�r�r�r�rr�r�r�rrrrr%s


	


%c@s~eZdZdddddddgZeZdZd	Zd	Zd
Zd
Z	dd�Z
d
d�Zdd�Zdd�Z
ddd�Zd dd�Zd!dd�Zd"dd�ZdS)#rZmonZtueZwedZthuZfriZsatZsunZnodayr
rQcCs(|dkrd|jSd|j||fSdS)Nrz<td class="%s">&nbsp;</td>z<td class="%s">%d</td>)�cssclass_noday�
cssclasses)rrRr	rrrr��s
zHTMLCalendar.formatdaycs d��fdd�|D��}d|S)Nr8c3s|]\}}��||�VqdSrr�r�r!rrr��sz*HTMLCalendar.formatweek.<locals>.<genexpr>�<tr>%s</tr>r�)rr�r�rr!rr��szHTMLCalendar.formatweekcCsd|j|t|fS�Nz<th class="%s">%s</th>)�cssclasses_weekday_headr)rrRrrrr��s�zHTMLCalendar.formatweekdaycs$d��fdd����D��}d|S)Nr8c3s|]}��|�VqdSrr�r3r!rrr��sz0HTMLCalendar.formatweekheader.<locals>.<genexpr>r�r�)rr�rr!rr��szHTMLCalendar.formatweekheaderTcCs0|rdt||f}ndt|}d|j|fS)N�%s %sz%sz+<tr><th colspan="7" class="%s">%s</th></tr>)r�cssclass_month_head�rr�r�r�r�rrrr��s�zHTMLCalendar.formatmonthnamecCs�g}|j}|d|j�|d�||j|||d��|d�||���|d�|�||�D]}||�|��|d�q\|d�|d�d�|�S)N�=<table border="0" cellpadding="0" cellspacing="0" class="%s">r��r��</table>r8)r��cssclass_monthr�r�rur�r�)rr�r�r�r�r�r�rrrr��s �
zHTMLCalendar.formatmonthrwcCs�g}|j}t|d�}|d|j�|d�|d||j|f�tttd|�D]V}t|t||d��}|d�|D](}|d�||j||d	d
��|d�qr|d�qN|d
�d�|�S)Nr(r�r�z,<tr><th colspan="%d" class="%s">%s</th></tr>r7rFz<tr>z<td>Fr�z</td>z</tr>r�r8)	r�r��
cssclass_year�cssclass_year_headrHr}r�r�r�)rr�r{r�r�r5rzrcrrrr��s,
��

zHTMLCalendar.formatyear�calendar.cssNcCs�|dkrt��}g}|j}|d|�|d�|d�|d�|d|�|dk	r^|d|�|d|�|d�|d	�||�||��|d
�|d�d�|��|d
�S)Nz$<?xml version="1.0" encoding="%s"?>
zn<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
z<html>
z<head>
zC<meta http-equiv="Content-Type" content="text/html; charset=%s" />
z4<link rel="stylesheet" type="text/css" href="%s" />
z<title>Calendar for %d</title>
z</head>
z<body>
z</body>
z</html>
r8�xmlcharrefreplace)�sys�getdefaultencodingr�r�r��encode)rr�r{�css�encodingr�r�rrr�formatyearpage
s$zHTMLCalendar.formatyearpage)T)T)rw)rwr�N)r$r%r&r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�s



c@s$eZdZdd�Zdd�Zdd�ZdS)�different_localecCs
||_dSr��locale)rr�rrrr #szdifferent_locale.__init__cCs"t�tj�|_t�tj|j�dSr)�_localeZ	getlocale�LC_TIME�	oldlocale�	setlocaler�r!rrr�	__enter__&szdifferent_locale.__enter__cGst�tj|j�dSr)r�r�r�r�)r�argsrrr�__exit__*szdifferent_locale.__exit__N)r$r%r&r r�r�rrrrr�"sr�c@s(eZdZd
dd�Zdd�Zddd	�ZdS)rrNcCs&t�||�|dkrt��}||_dSr)rr r��getdefaultlocaler��rrr�rrrr 6szLocaleTextCalendar.__init__c
CsNt|j��:|dkrt}nt}||}|d|��|�W5QR�SQRXdSr�)r�r�rrr�)rrRr{r��namerrrr�<sz LocaleTextCalendar.formatweekdayTc
CsDt|j��0t|}|r$d||f}|�|�W5QR�SQRXdSr�)r�r�rr�r�rrrr�Es
z"LocaleTextCalendar.formatmonthname)rN)T�r$r%r&r r�r�rrrrr.s
	c@s(eZdZd
dd�Zdd�Zddd	�ZdS)rrNcCs&t�||�|dkrt��}||_dSr)rr r�r�r�r�rrrr TszLocaleHTMLCalendar.__init__c
Cs<t|j��(t|}d|j||fW5QR�SQRXdSr�)r�r�rr�)rrRr�rrrr�Zsz LocaleHTMLCalendar.formatweekdayTc
CsBt|j��.t|}|r$d||f}d|W5QR�SQRXdS)Nr�z.<tr><th colspan="7" class="month">%s</th></tr>)r�r�rr�rrrr�_s
z"LocaleHTMLCalendar.formatmonthname)rN)Tr�rrrrrMs
cCs(t|krtksnt|��|t_dSr)�MONDAY�SUNDAYrr�rr\rrrrls�r�cCstt|||��dSr)r�r��Zcolsr��spacingrrrr=�sr=cs |d9}|��fdd�|D��S)Nr�c3s|]}|���VqdSrr�)r4r��r�rrr��szformatstring.<locals>.<genexpr>r�r�rr�rr��sr�i�cCs^|dd�\}}}}}}t�||d���t|d}|d|}|d|}	|	d|}
|
S)Nr�r(��<)r0r1�	toordinal�
_EPOCH_ORD)�tuplerQr
rRZhourZminute�secondrtZhoursZminutesZsecondsrrrr�scCs�ddl}|��}|�d�}|�d�}|jddtddd�|jd	d
tddd�|jd
dtddd�|jddtddd�|jddddd�|jddddd�|jddddd�|jd d!d"d#d$d%�|jd&d'td(d)�|jd*d'td+d)�|�|dd��}|j�r|j�s|�d,�t	�
d�|j|jf}|jd-k�r�|j�rDt|d.�}nt
�}|j}|dk�rbt	��}t||jd/�}	t	jjj}
|jdk�r�|
|jtj��jf|	��n6|jdk�r�|
|j|jf|	��n|�d0�t	�
d�n�|j�r�t|d.�}nt�}t|j|jd1�}	|jdk�r$|j|	d2<|j|	d3<|jdk�rH|j tj��jf|	�}n2|jdk�rf|j |jf|	�}n|j!|j|jf|	�}t	jj}
|j�r�|�"|j�}t	jjj}
|
|�dS)4Nrztext only argumentszhtml only argumentsz-wz--widthr)z width of date column (default 2))�type�default�helpz-lz--linesr(z)number of lines for each week (default 1)z-sz	--spacingr�z"spacing between months (default 6)z-mz--monthsrwzmonths per row (default 3)z-cz--cssr�zCSS to use for page)r�r�z-Lz--localez.locale to be used from month and weekday namesz-ez
--encodingzencoding to use for outputz-tz--type�text)r��htmlzoutput type (text or html))r��choicesr�rQ�?zyear number (1-9999))�nargsr�r�r
zmonth number (1-12, text only)z/if --locale is specified --encoding is requiredr�r�)r�r�zincorrect number of arguments)r�r�r�rc)#�argparse�ArgumentParserZadd_argument_group�add_argument�int�
parse_argsr�r��errorr��exitr�rrr��dictr��stdout�buffer�writerQr�r0r1Ztodayr
rrr{�linesr�rzr�r�r�)r�r��parserZ	textgroupZ	htmlgroupZoptionsr�r�r�Zoptdictr��resultrrr�main�s�

����������







r�__main__)Hr�r0r�r��	itertoolsr�__all__�
ValueErrorr�rrr}rUrTr-rJrrrrrHr�ZTUESDAYZ	WEDNESDAYZTHURSDAYZFRIDAYZSATURDAYr�rrr	r
rYrZr[�objectrrrr�rrr�r_rrrvrr�r�r�r�rrr�r
r�rr�rZ	_colwidthZ_spacingr=r�ZEPOCHr1r�r�rrr$�argvrrrr�<module>s��
u	
h
mailcap.cpython-38.opt-2.pyc000064400000013007150335716500011550 0ustar00U

e5dk#�@s�ddlZddlZddlZddgZdd�Ze�d�jZGdd�de�Z	d	d�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zddgfdd�Zd"dd�Zgfdd�Zdd�Zdd�Zdd �Zed!kr�e�dS)#�N�getcaps�	findmatchcCsd|krd|dfSdSdS)N�linenor)�r�)�entryrr�/usr/lib64/python3.8/mailcap.py�lineno_sort_key
sr	z[^\xa1-\U0010FFFF\w@+=:,./-]c@seZdZdS)�UnsafeMailcapInputN)�__name__�
__module__�__qualname__rrrrr
sr
c
Cs�i}d}t�D]~}zt|d�}Wntk
r8YqYnX|�t||�\}}W5QRX|��D]*\}}||krz|||<q`|||||<q`q|S)Nr�r)�listmailcapfiles�open�OSError�_readmailcapfile�items)�capsrZmailcap�fpZmorecaps�key�valuerrrrs



cCsPdtjkr"tjd}|�tj�}n*dtjkr8tjd}nd}|ddddg}|S)NZMAILCAPS�HOME�.z	/.mailcapz/etc/mailcapz/usr/etc/mailcapz/usr/local/etc/mailcap)�os�environ�split�pathsep)ZpathstrZmailcaps�homerrrr3s


�rcCs t�dtd�t|d�\}}|S)Nz2readmailcapfile is deprecated, use getcaps instead�)�warnings�warn�DeprecationWarningr)rr�_rrr�readmailcapfileEs�r$c	Cs�i}|��}|sq�|ddks|��dkr,q|}|dd�dkrb|��}|sPd}|dd�|}q0t|�\}}|r|sxq|dk	r�||d<|d7}|�d	�}tt|��D]}||��||<q�d	�|���}||kr�||�|�q|g||<q||fS)
Nr�#����z\
�
rr�/)	�readline�strip�	parseliner�range�len�join�lower�append)	rrr�lineZnextliner�fields�types�jrrrrMs4	
rc
Cs�g}dt|�}}||kr>t|||�\}}|�|�|d}qt|�dkrNdS|d|d|dd�}}}d|i}|D]V}|�d�}|dkr�|}d}	n$|d|���}||dd���}	||kr�qz|	||<qz||fS)Nrrr�NN�view�=r&)r.�
parsefieldr1�findr+)
r2r3�i�n�fieldrr7�restZfkeyZfvaluerrrr,vs*

 

r,cCsP|}||kr<||}|dkr q<q|dkr2|d}q|d}q|||���|fS)N�;�\rr)r+)r2r;r<�start�crrrr9�s

r9r7z	/dev/nullc
Cs�t|�r"d|f}t�|t�dSt|||�}|D]`}d|krlt|d||�}|dkrXq2|rlt�|�dkrlq2t|||||�}	|	dk	r2|	|fSq2dS)NzHRefusing to use mailcap with filename %r. Use a safe temporary filename.r6�testr)�_find_unsafer r!r
�lookup�substr�system)
r�MIMEtyper�filename�plist�msg�entries�erC�commandrrrr�s 	
cslg}||kr|||}|�d�}|dd}||krB|||}�dk	r\�fdd�|D�}t|td�}|S)Nr)rz/*csg|]}�|kr|�qSrr)�.0rM�rrr�
<listcomp>�szlookup.<locals>.<listcomp>rP)r�sortedr	)rrHrrLZ	MIMEtypesrrPrrE�s
rEcCsRd}dt|�}}||k�rN||}|d}|dkr^|dkrT|||d�}|d}||}q||}|d}|dkr�||}q|dkr�||}q|dkr�t|�r�d|f}t�|t�dS||}q|d	k�r@|}	||kr�||d
kr�|d}q�||	|�}
|d}t|
|�}t|��r6d||
f}t�|t�dS||}q|d|}q|S)Nr&rr�%r@�s�tz9Refusing to substitute MIME type %r into a shell command.�{�}z=Refusing to substitute parameter %r (%s) into a shell command)r.rDr r!r
�	findparam)r=rHrIrJ�resr;r<rBrKrA�nameZparamrrrrF�sH










rFcCsF|��d}t|�}|D](}|d|���|kr||d�SqdS)Nr8r&)r0r.)rZrJr<�prrrrX�srXc	Cs�ddl}t�}|jdd�s(t|�dStdt|j�d�D]�}|j||d�}t|�dkrjtd�dS|d}|d}t||d|�\}}|s�tdt�q:td|�t	�
|�}|r:td|�q:dS)	Nrrrz"usage: mailcap [MIMEtype file] ...r7zNo viewer found forz
Executing:zExit status:)�sysr�argv�showr-r.�printr�typerrG)	r\rr;�argsrH�filerNrM�stsrrrrCs&

rCcCs�td�t�D]}td|�qt�|s0t�}td�t�t|�}|D]H}t|�||}|D].}t|�}|D]}td|||�qrt�qbqJdS)NzMailcap files:�	zMailcap entries:z  %-15s)r_rrrR)r�fnZckeysr`rLrM�keys�krrrr^s"
r^�__main__)N)rr �re�__all__r	�compile�searchrD�Warningr
rrr$rr,r9rrErFrXrCr^rrrrr�<module>s()

)modulefinder.cpython-38.opt-2.pyc000064400000035452150335716500012627 0ustar00U

e5dn_�@sddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ej
dZej
dZej
dZ
ej
dZe
efZejZdZdZdZdZd	Zd
ZdZiZdd
�ZiZdd�Zddd�ZGdd�d�ZGdd�d�Zdd�Ze dk�rz
e�Z!Wne"k
�re#d�YnXdS)�N�
LOAD_CONST�IMPORT_NAME�
STORE_NAME�STORE_GLOBAL������cCst�|g��|�dS�N)�packagePathMap�
setdefault�append)Zpackagename�path�r�$/usr/lib64/python3.8/modulefinder.py�AddPackagePath(srcCs|t|<dSr)�replacePackageMap)Zoldname�newnamerrr�ReplacePackage3srcCstjj��tjj�||�}|dkr8tdj|d�|d��|jtjjkrVddddt	ffS|jtjj
krtddddtffS|j}|j�
|�r�dtj�|�ddtffSt|jtjj�r�t}n<t|jtjj�r�t}n&t|jtjj�r�t}nddddtffSt�|�}tj�|�d}|||d|ffS)NzNo module named {name!r})�name�����rb)�	importlib�	machinery�
PathFinder�invalidate_caches�	find_spec�ImportError�format�loader�BuiltinImporter�
_C_BUILTIN�FrozenImporter�
_PY_FROZEN�origin�
is_package�osr�dirname�_PKG_DIRECTORY�
isinstance�SourceFileLoader�
_PY_SOURCE�ExtensionFileLoader�_C_EXTENSION�SourcelessFileLoader�_PY_COMPILED�
_SEARCH_ERROR�io�	open_code�splitext)rr�specZ	file_pathZkind�file�suffixrrr�_find_module7s*
r:c@seZdZddd�Zdd�ZdS)�ModuleNcCs(||_||_||_d|_i|_i|_dSr)�__name__�__file__�__path__�__code__�globalnames�starimports)�selfrr8rrrr�__init__fszModule.__init__cCsLd|jf}|jdk	r&|d|jf}|jdk	r@|d|jf}|d}|S)Nz	Module(%rz, %r�))r<r=r>)rB�srrr�__repr__ss

zModule.__repr__)NN)r<�
__module__�__qualname__rCrFrrrrr;ds

r;c@s�eZdZd6dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zd7dd�Z	d8dd�Z
dd�Zdd�Zd9dd�Z
dd�Zdd�Zdd�Zd d!�Zd:d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd;d,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)<�ModuleFinderNrcCsZ|dkrtj}||_i|_i|_||_d|_|dk	r8|ng|_|dk	rJ|ng|_g|_dS)Nr)	�sysr�modules�
badmodules�debug�indent�excludes�
replace_paths�processed_paths)rBrrMrOrPrrrrC~szModuleFinder.__init__cGsV||jkrRt|j�D]}tddd�qt|dd�|D]}tt|�dd�q6t�dS)N�   � ��end)rM�rangerN�print�repr)rB�level�str�args�i�argrrr�msg�s
zModuleFinder.msgcGs,|d}||jkr(|jd|_|j|�dS�Nrr�rMrNr^�rBr[rYrrr�msgin�s
zModuleFinder.msgincGs,|d}||jkr(|jd|_|j|�dSr_r`rarrr�msgout�s
zModuleFinder.msgoutc	CsB|�dd|�t�|�� }ddtf}|�d|||�W5QRXdS)Nr�
run_scriptrr�__main__)r^r4r5r.�load_module)rB�pathname�fp�stuffrrrrd�s
zModuleFinder.run_scriptc	CsTtj�|�\}}tj�|�\}}t�|�� }|dtf}|�||||�W5QRXdS)Nr)r)r�splitr6r4r5r.rf)rBrg�dirrZextrhrirrr�	load_file�s

zModuleFinder.load_filerc	Cs\|�dd||||�|j||d�}|�||�\}}|�||�}|sF|S|jrX|�||�dS)Nr�import_hook�rY)r^�determine_parent�find_head_package�	load_tailr>�ensure_fromlist)	rBr�caller�fromlistrY�parent�q�tail�mrrrrm�szModuleFinder.import_hookcCs&|�dd||�|r|dkr,|�dd�dS|j}|dkr�|jrH|d8}|dkrl|j|}|�dd|�|S|�d�|kr�td��d�|�d�d|��}|j|}|�dd|�|S|jr�|j|}|�dd|�|Sd|k�r|�	d�}|d|�}|j|}|�dd|�|S|�dd�dS)	N�rorzdetermine_parent -> Nonerzdetermine_parent ->�.zrelative importpath too deep)
rbrcr<r>rK�countr �joinrj�rfind)rBrsrYZpnamerur\rrrro�s<





zModuleFinder.determine_parentcCs�|�dd||�d|kr@|�d�}|d|�}||dd�}n|}d}|r\d|j|f}n|}|�|||�}|r�|�dd||f�||fS|r�|}d}|�|||�}|r�|�dd||f�||fS|�dd|�td	|��dS)
Nryrprzrr�%s.%szfind_head_package ->�"raise ImportError: No module named�No module named )rb�findr<�
import_modulercr )rBrurr\�headrwZqnamervrrrrp�s.
zModuleFinder.find_head_packagecCs�|�dd||�|}|r�|�d�}|dkr2t|�}|d|�||dd�}}d|j|f}|�|||�}|s|�dd|�td|��q|�dd	|�|S)
Nryrqrzrrr~rr�zload_tail ->)rbr��lenr<r�rcr )rBrvrwrxr\r�Zmnamerrrrq�s
zModuleFinder.load_tailcCs�|�dd|||�|D]d}|dkrD|sz|�|�}|rz|�||d�qt||�sd|j|f}|�|||�}|std|��qdS)Nryrr�*rr~r�)r^�find_all_submodulesrr�hasattrr<r�r )rBrxrt�	recursive�sub�all�subnameZsubmodrrrrrs

zModuleFinder.ensure_fromlistc
	Cs�|js
dSi}g}|tjjdd�7}|tjjdd�7}|tjjdd�7}|jD]�}zt�|�}Wn&tk
r�|�	dd|�YqTYnX|D]R}d}|D]0}t
|�}	||	d�|kr�|d|	�}q�q�|r�|dkr�|||<q�qT|��S)Nrzcan't list directoryrC)r>rr�EXTENSION_SUFFIXES�SOURCE_SUFFIXES�BYTECODE_SUFFIXESr)�listdir�OSErrorr^r��keys)
rBrxrK�suffixesrk�namesr�modZsuff�nrrrr�s.

z ModuleFinder.find_all_submodulescCs
|�dd|||�z|j|}Wntk
r4YnX|�dd|�|S||jkrb|�dd�dS|r�|jdkr�|�dd�dSz|�||o�|j|�\}}}Wn$tk
r�|�ddd�YdSXz|�	||||�}W5|r�|��X|r�t
|||�|�dd|�|S)Nrr�zimport_module ->zimport_module -> None)rbrK�KeyErrorrcrLr>�find_moduler �closerf�setattr)rBZpartname�fqnamerurxrhrgrirrrr�.s:
�
zModuleFinder.import_modulec
Cs(|\}}}|�dd||od|�|tkrF|�||�}|�dd|�|S|tkr`t|��|d�}	n||tkr�z|��}
tj	�
|
|i�Wn:tk
r�}z|�ddt|�|��W5d}~XYnXt
�t|
�dd��}	nd}	|�|�}||_|	�r|j�r|�|	�}	|	|_|�|	|�|�dd|�|S)Nrrfrhzload_module ->�execzraise ImportError: �)rbr+�load_packagercr.�compile�readr2r�_bootstrap_external�
_classify_pycr rZ�marshal�loads�
memoryview�
add_moduler=rP�replace_paths_in_coder?�	scan_code)rBr�rhrg�	file_infor9�mode�typerx�co�data�excrrrrfNs4


zModuleFinder.load_modulecCs<||jkri|j|<|r*d|j||j<nd|j|d<dS)Nr�-)rLr<)rBrrsrrr�_add_badmoduleks


zModuleFinder._add_badmodulecCsB||jkr|�||�dSz|j|||d�Wn~tk
rn}z"|�ddt|��|�||�W5d}~XYn�tk
r�}z"|�ddt|��|�||�W5d}~XYn�X|�r>|D]�}|d|}||jkr�|�||�q�z|j|||g|d�Wq�tk
�r:}z"|�ddt|��|�||�W5d}~XYq�Xq�dS)NrnrzImportError:zSyntaxError:rz)rLr�rmr r^rZ�SyntaxError)rBrrsrtrYr^r��fullnamerrr�_safe_import_hookss,

zModuleFinder._safe_import_hookccs�|j}|j}|j}dd�t�|�D�}t|�D]�\}\}}|tkrTd||ffVq.|tkr.|dkr.||dd||ddkr�tkr.nq.|||dd}	|||dd}
|	dkr�d|
||ffVq.d|	|
||ffVq.q.dS)	NcSs"g|]\}}}|tkr||f�qSr)�EXTENDED_ARG)�.0�_�opr]rrr�
<listcomp>�s�z-ModuleFinder.scan_opcodes.<locals>.<listcomp>�storerrr�absolute_import�relative_import)	�co_code�co_names�	co_consts�disZ_unpack_opargs�	enumerate�	STORE_OPSrr)rBr��coder��constsZopargsr\r�ZopargrYrtrrr�scan_opcodes�s(��
zModuleFinder.scan_opcodescCs�|j}|j}||�D�]F\}}|dkr8|\}d|j|<q|dk�r|\}}d}	|dk	rpd|krbd}	dd�|D�}|j|||dd�|	�r\d}
|jr�|j�|jd	|�}
|
dkr�|j�|�}
|
dk	r�|j�|
j�|j	�|
j	�|
j
dkr�d|j	|<n
d|j	|<q|d
k�rT|\}}}|�r0|j||||d�n"|j||d�}|j|jd|dd�qt|��q|j
D]"}
t|
t|���rd|�|
|��qddS)Nr�rr�rr�cSsg|]}|dkr|�qS)r�r)r��frrrr��sz*ModuleFinder.scan_code.<locals>.<listcomp>rnrzr�)r�r�r@r�r>rK�getr<�updaterAr?ro�RuntimeErrorr�r,r�r�)rBr�rxr��scannerZwhatr[rrtZ	have_starZmmrYru�crrrr��sH





zModuleFinder.scan_codecCs�|�dd||�t�|�}|r"|}|�|�}||_|g|_|jt�|g�|_|�d|j�\}}}z&|�	||||�|�
dd|�|W�S|r�|��XdS)Nrr�rCzload_package ->)rbrr�r�r=r>r
r�r�rfrc)rBr�rgrrxrhZbufrirrrr��s

zModuleFinder.load_packagecCs*||jkr|j|St|�|j|<}|Sr)rKr;)rBr�rxrrrr��s

zModuleFinder.add_modulecCsn|dk	r|jd|}n|}||jkr<|�dd|�t|��|dkrd|tjkr^ddddtffS|j}t||�S)Nrzrzfind_module -> Excludedr)	r<rOrcr rJ�builtin_module_namesr$rr:)rBrrrur�rrrr��s

zModuleFinder.find_modulecCst�tdd�tdd�t|j���}|D]B}|j|}|jrRtddd�ntddd�td||jpnd	�q0|��\}}|r�t�td
�|D]*}t|j|���}td|dd
�|��q�|�rt�tddd�td�|D]*}t|j|���}td|dd
�|��q�dS)Nz
  %-25s %s)�NameZFile)�----r��PrSrTrxz%-25srzMissing modules:�?z
imported fromz, z7Submodules that appear to be missing, but could also bez#global names in the parent package:)	rW�sortedrKr�r>r=�any_missing_mayberLr|)rBr��keyrx�missing�mayberZmodsrrr�reports0
zModuleFinder.reportcCs|��\}}||Sr)r�)rBr�r�rrr�any_missing"szModuleFinder.any_missingcCs�g}g}|jD]�}||jkrq|�d�}|dkr<|�|�q||dd�}|d|�}|j�|�}|dk	r�||j|kr�|�|�q�||jkr�q�|jr�|�|�q�|�|�q|�|�q|��|��||fS)Nrzrr)	rLrOr}rrKr�r@rA�sort)rBr�r�rr\r�ZpkgnameZpkgrrrr�*s0	




zModuleFinder.any_missing_maybecCs�tj�|j�}}|jD]*\}}|�|�r||t|�d�}qDq|jr�||jkr�||krr|�	dd||f�n|�	dd|f�|j�
|�t|j�}t
t|��D](}t||t|��r�|�||�||<q�|jt|�|d�S)Nrzco_filename %r changed to %rz co_filename %r remains unchanged)r��co_filename)r)r�normpathr�rP�
startswithr�rMrQrcr�listr�rVr,r�r��replace�tuple)rBr�Znew_filenameZoriginal_filenamer��rr�r\rrrr�Xs&
��
z"ModuleFinder.replace_paths_in_code)NrNN)NNr)r)r)r)N)r<rGrHrCr^rbrcrdrlrmrorprqrrr�r�rfr�r�r�r�r�r�r�r�r�r�r�rrrrrI|s2
	

#
 
1
".rIc
Cs�ddl}z|�tjdd�d�\}}Wn2|jk
rX}zt|�WY�dSd}~XYnXd}d}g}g}|D]Z\}}	|dkr�|d}|dkr�d}|dkr�||	�tj�}|dkr�d}|dkrn|�|	�qn|s�d	}
n|d}
tj	dd�}tj	�
|
�|d<||}|dk�r.td
�|D]}tdt|���qt|||�}
|dd�D]`}|dk�r\d}�qF|�r�|dd�d
k�r�|
�
|dd�ddg�n
|
�
|�n
|
�|��qF|
�|
�|
��|
S)Nrrzdmp:qx:z-dz-mz-pz-qz-xzhello.pyzpath:rR���z.*r�)�getoptrJ�argv�errorrWrjr)�pathseprrr*rXrIrmrlrdr�)r�Zoptsr[r^rMZdomodsZaddpathZexclude�o�aZscriptr�item�mfr]rrr�testpsX


r�rez
[interrupted])N)$r�Zimportlib._bootstrap_externalr�importlib.machineryr�r)r4rJ�types�warningsZopmaprrrrr�r�r3r.r2r0r+r$r&r
rrrr:r;rIr�r<r��KeyboardInterruptrWrrrr�<module>sJ




-w;

aifc.cpython-38.pyc000064400000061604150335716500010112 0ustar00U

e5d.��
@sBdZddlZddlZddlZdddgZGdd�de�ZdZdd	�Zd
d�Z	dd
�Z
dd�Zdd�ZdZ
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zdd!lmZdd"lmZed#d$�Zd%ej_d&ej_d'ej_d(ej_d)ej_d*ej_Gd+d,�d,�Z Gd-d.�d.�Z!dAd/d�Z"dBd0d�Z#e$d1k�r>ddl%Z%e%j&d2d��sNe%j&�'d3�e%j&d2Z(e"e(d4���Z)e*d5e(�e*d6e)�+��e*d7e)�,��e*d8e)�-��e*d9e)�.��e*d:e)�/��e*d;e)�0��e%j&d<d��r4e%j&d<Z1e*d=e1�e"e1d>��6Z2e2�3e)�4��e)�5d?�Z6e6�s�q"e2�7e6��qW5QRXe*d@�W5QRXdS)CaJStuff to parse AIFF-C and AIFF files.

Unless explicitly stated otherwise, the description below is true
both for AIFF-C files and AIFF files.

An AIFF-C file has the following structure.

  +-----------------+
  | FORM            |
  +-----------------+
  | <size>          |
  +----+------------+
  |    | AIFC       |
  |    +------------+
  |    | <chunks>   |
  |    |    .       |
  |    |    .       |
  |    |    .       |
  +----+------------+

An AIFF file has the string "AIFF" instead of "AIFC".

A chunk consists of an identifier (4 bytes) followed by a size (4 bytes,
big endian order), followed by the data.  The size field does not include
the size of the 8 byte header.

The following chunk types are recognized.

  FVER
      <version number of AIFF-C defining document> (AIFF-C only).
  MARK
      <# of markers> (2 bytes)
      list of markers:
          <marker ID> (2 bytes, must be > 0)
          <position> (4 bytes)
          <marker name> ("pstring")
  COMM
      <# of channels> (2 bytes)
      <# of sound frames> (4 bytes)
      <size of the samples> (2 bytes)
      <sampling frequency> (10 bytes, IEEE 80-bit extended
          floating point)
      in AIFF-C files only:
      <compression type> (4 bytes)
      <human-readable version of compression type> ("pstring")
  SSND
      <offset> (4 bytes, not used by this program)
      <blocksize> (4 bytes, not used by this program)
      <sound data>

A pstring consists of 1 byte length, a string of characters, and 0 or 1
byte pad to make the total length even.

Usage.

Reading AIFF files:
  f = aifc.open(file, 'r')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods read(), seek(), and close().
In some types of audio files, if the setpos() method is not used,
the seek() method is not necessary.

This returns an instance of a class with the following public methods:
  getnchannels()  -- returns number of audio channels (1 for
             mono, 2 for stereo)
  getsampwidth()  -- returns sample width in bytes
  getframerate()  -- returns sampling frequency
  getnframes()    -- returns number of audio frames
  getcomptype()   -- returns compression type ('NONE' for AIFF files)
  getcompname()   -- returns human-readable version of
             compression type ('not compressed' for AIFF files)
  getparams() -- returns a namedtuple consisting of all of the
             above in the above order
  getmarkers()    -- get the list of marks in the audio file or None
             if there are no marks
  getmark(id) -- get mark with the specified id (raises an error
             if the mark does not exist)
  readframes(n)   -- returns at most n frames of audio
  rewind()    -- rewind to the beginning of the audio stream
  setpos(pos) -- seek to the specified position
  tell()      -- return the current position
  close()     -- close the instance (make it unusable)
The position returned by tell(), the position given to setpos() and
the position of marks are all compatible and have nothing to do with
the actual position in the file.
The close() method is called automatically when the class instance
is destroyed.

Writing AIFF files:
  f = aifc.open(file, 'w')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods write(), tell(), seek(), and
close().

This returns an instance of a class with the following public methods:
  aiff()      -- create an AIFF file (AIFF-C default)
  aifc()      -- create an AIFF-C file
  setnchannels(n) -- set the number of channels
  setsampwidth(n) -- set the sample width
  setframerate(n) -- set the frame rate
  setnframes(n)   -- set the number of frames
  setcomptype(type, name)
          -- set the compression type and the
             human-readable compression type
  setparams(tuple)
          -- set all parameters at once
  setmark(id, pos, name)
          -- add specified mark to the list of marks
  tell()      -- return current position in output file (useful
             in combination with setmark())
  writeframesraw(data)
          -- write audio frames without pathing up the
             file header
  writeframes(data)
          -- write audio frames and patch up the file header
  close()     -- patch up the file header and close the
             output file
You should set the parameters before the first writeframesraw or
writeframes.  The total number of frames does not need to be set,
but when it is set to the correct value, the header does not have to
be patched up.
It is best to first set all parameters, perhaps possibly the
compression type, and then write audio frames using writeframesraw.
When all frames have been written, either call writeframes(b'') or
close() to patch up the sizes in the header.
Marks can be added anytime.  If there are any marks, you must call
close() after all frames have been written.
The close() method is called automatically when the class instance
is destroyed.

When a file is opened with the extension '.aiff', an AIFF file is
written, otherwise an AIFF-C file is written.  This default can be
changed by calling aiff() or aifc() before the first writeframes or
writeframesraw.
�N�Error�open�openfpc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.8/aifc.pyr�sl@QEcCs:zt�d|�d��dWStjk
r4td�YnXdS)N�>l�r��structZunpack�read�error�EOFError��filerrr	�
_read_long�srcCs:zt�d|�d��dWStjk
r4td�YnXdS)N�>Lrrrrrrr	�_read_ulong�srcCs:zt�d|�d��dWStjk
r4td�YnXdS)N�>h�rrrrrr	�_read_short�srcCs:zt�d|�d��dWStjk
r4td�YnXdS)N�>Hrrrrrrr	�_read_ushort�srcCs@t|�d��}|dkrd}n
|�|�}|d@dkr<|�d�}|S)N�r�)�ordr)r�length�data�dummyrrr	�_read_string�s

r!g�����cCs�t|�}d}|dkr d}|d}t|�}t|�}||krN|krNdkrXnnd}n0|dkrft}n"|d}|d|td	|d
�}||S)Nrr�����g�i�?lg@�?)rr�	_HUGE_VAL�pow)�f�expon�sign�himant�lomantrrr	�_read_float�s"r-cCs|�t�d|��dS)Nr��writer
�pack�r(�xrrr	�_write_short�sr3cCs|�t�d|��dS)Nrr.r1rrr	�
_write_ushort�sr4cCs|�t�d|��dS)Nr
r.r1rrr	�_write_long�sr5cCs|�t�d|��dS)Nrr.r1rrr	�_write_ulong�sr6cCsRt|�dkrtd��|�t�dt|���|�|�t|�d@dkrN|�d�dS)N�z%string exceeds maximum pstring length�Brr�)�len�
ValueErrorr/r
r0)r(�srrr	�
_write_string�s
r=c	Cs�ddl}|dkrd}|d}nd}|dkr8d}d}d}n�|�|�\}}|dks^|dks^||krp|dB}d}d}nh|d}|dkr�|�||�}d}||B}|�|d�}|�|�}t|�}|�||d�}|�|�}t|�}t||�t||�t||�dS)	Nrr#r"i@rr$i�?� )�mathZfrexpZldexpZfloor�intr4r6)	r(r2r?r*r)r+r,ZfmantZfsmantrrr	�_write_float�s8




rA)�Chunk)�
namedtuple�_aifc_paramsz7nchannels sampwidth framerate nframes comptype compnamez3Number of audio channels (1 for mono, 2 for stereo)zSample width in byteszSampling frequencyzNumber of audio framesz(Compression type ("NONE" for AIFF files)zRA human-readable version of the compression type
('not compressed' for AIFF files)c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�ZdS)2�	Aifc_readNcCs8d|_d|_g|_d|_||_t|�}|��dkr:td��|�d�}|dkrTd|_	n|dkrdd|_	ntd��d|_
d|_d|_zt|j�}Wnt
k
r�Y�qYnX|��}|d	kr�|�|�d|_
nH|d
kr�||_|�d�}d|_n(|dkr�t|�|_n|d
k�r|�|�|��qx|j
�r,|j�s4td��dS)Nr�FORMz file does not start with FORM idr�AIFF�AIFCrznot an AIFF or AIFF-C file�COMM�SSND��FVER�MARKz$COMM chunk and/or SSND chunk missing)�_version�_convert�_markers�	_soundpos�_filerBZgetnamerr�_aifcZ_comm_chunk_read�_ssnd_chunk�_ssnd_seek_neededr�_read_comm_chunkr�	_readmark�skip)�selfr�chunkZformdataZ	chunknamer rrr	�initfp4sH





zAifc_read.initfpcCsLt|t�r>t�|d�}z|�|�WqH|���YqHXn
|�|�dS)N�rb)�
isinstance�str�builtinsrr[�close�rYr(Zfile_objectrrr	�__init__\s

zAifc_read.__init__cCs|S�Nr�rYrrr	�	__enter__hszAifc_read.__enter__cGs|��dSrc�r`�rY�argsrrr	�__exit__kszAifc_read.__exit__cCs|jSrc)rRrdrrr	�getfpqszAifc_read.getfpcCsd|_d|_dS)Nrr)rUrQrdrrr	�rewindtszAifc_read.rewindcCs |j}|dk	rd|_|��dSrc)rRr`�rYrrrr	r`xszAifc_read.closecCs|jSrc)rQrdrrr	�tell~szAifc_read.tellcCs|jSrc)�
_nchannelsrdrrr	�getnchannels�szAifc_read.getnchannelscCs|jSrc)�_nframesrdrrr	�
getnframes�szAifc_read.getnframescCs|jSrc)�
_sampwidthrdrrr	�getsampwidth�szAifc_read.getsampwidthcCs|jSrc)�
_frameraterdrrr	�getframerate�szAifc_read.getframeratecCs|jSrc��	_comptyperdrrr	�getcomptype�szAifc_read.getcomptypecCs|jSrc��	_compnamerdrrr	�getcompname�szAifc_read.getcompnamecCs*t|��|��|��|��|��|���Src)rDrorsrurqrxr{rdrrr	�	getparams�s�zAifc_read.getparamscCst|j�dkrdS|jS�Nr�r:rPrdrrr	�
getmarkers�szAifc_read.getmarkerscCs2|jD]}||dkr|Sqtd�|���dS�Nrzmarker {0!r} does not exist�rPr�format�rY�id�markerrrr	�getmark�s

zAifc_read.getmarkcCs*|dks||jkrtd��||_d|_dS)Nrzposition not in ranger)rprrQrU)rY�posrrr	�setpos�szAifc_read.setposcCs�|jrD|j�d�|j�d�}|j|j}|r>|j�|d�d|_|dkrPdS|j�||j�}|jrv|rv|�|�}|jt|�|j|j	|_|S)NrrKr)
rUrT�seekrrQ�
_framesizerOr:rnrr)rY�nframesr r�rrrr	�
readframes�s 

�
zAifc_read.readframescCsddl}|�|d�S�Nrr)�audioopZalaw2lin�rYrr�rrr	�	_alaw2lin�szAifc_read._alaw2lincCsddl}|�|d�Sr�)r�Zulaw2linr�rrr	�	_ulaw2lin�szAifc_read._ulaw2lincCs2ddl}t|d�sd|_|�|d|j�\}|_|S�Nr�_adpcmstater)r��hasattrr�Z	adpcm2linr�rrr	�
_adpcm2lin�s

zAifc_read._adpcm2lincCsVt|�|_t|�|_t|�dd|_tt|��|_|jdkrFtd��|jdkrXtd��|j|j|_	|j
�rFd}|jdkr�d}t�
d�d	|_|�d
�|_|r�t|j�d��}|d@dkr�|d}|j||_|j�dd�t|�|_|jdk�rR|jd
k�r
|j|_n4|jdk�r |j|_n|jdk�r6|j|_ntd��d|_nd|_d|_dS)N�rKr�bad sample width�bad # of channels�rzWarning: bad COMM chunk size�rr"�NONE�G722��ulaw�ULAW��alaw�ALAW�unsupported compression typer�not compressed)rrnrrprrr@r-rtrr�rSZ	chunksize�warnings�warnrrwrrr�r!rzr�rOr�r�)rYrZZkludgerrrr	rV�sD









zAifc_read._read_comm_chunkcCs�t|�}zDt|�D]6}t|�}t|�}t|�}|s6|r|j�|||f�qWnDtk
r�dt|j�t|j�dkrxdnd|f}t�	|�YnXdS)Nz;Warning: MARK chunk contains only %s marker%s instead of %sr�r<)
r�rangerr!rP�appendrr:r�r�)rYrZZnmarkers�ir�r��name�wrrr	rW�s��zAifc_read._readmark)rrrrRr[rbrerirjrkr`rmrorqrsrurxr{r|rr�r�r�r�r�r�rVrWrrrr	rEs2$(*rEc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Z d<d=�Z!d>d?�Z"d@dA�Z#dBdC�Z$dDdE�Z%dFdG�Z&dHdI�Z'dS)J�
Aifc_writeNcCs\t|t�rNt�|d�}z|�|�Wn|���YnX|�d�rXd|_n
|�|�dS)N�wbz.aiffr)r]r^r_rr[r`�endswithrSrarrr	rb/s

zAifc_write.__init__cCs^||_t|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_g|_
d|_d|_dS)Nr�r�rr)rR�
_AIFC_versionrNrwrzrOrnrrrtrp�_nframeswritten�_datawritten�_datalengthrP�_marklengthrSrlrrr	r[?szAifc_write.initfpcCs|��dSrcrfrdrrr	�__del__PszAifc_write.__del__cCs|Srcrrdrrr	reSszAifc_write.__enter__cGs|��dSrcrfrgrrr	riVszAifc_write.__exit__cCs|jrtd��d|_dS)N�0cannot change parameters after starting to writer�r�rrSrdrrr	�aiff\szAifc_write.aiffcCs|jrtd��d|_dS)Nr�rr�rdrrr	�aifcaszAifc_write.aifccCs(|jrtd��|dkrtd��||_dS)Nr�rr�)r�rrn)rY�	nchannelsrrr	�setnchannelsfs
zAifc_write.setnchannelscCs|jstd��|jS)Nznumber of channels not set)rnrrdrrr	romszAifc_write.getnchannelscCs0|jrtd��|dks|dkr&td��||_dS)Nr�rrr�)r�rrr)rY�	sampwidthrrr	�setsampwidthrs
zAifc_write.setsampwidthcCs|jstd��|jS)Nzsample width not set)rrrrdrrr	rsyszAifc_write.getsampwidthcCs(|jrtd��|dkrtd��||_dS)Nr�rzbad frame rate)r�rrt)rY�	frameraterrr	�setframerate~s
zAifc_write.setframeratecCs|jstd��|jS)Nzframe rate not set)rtrrdrrr	ru�szAifc_write.getframeratecCs|jrtd��||_dS)Nr�)r�rrp)rYr�rrr	�
setnframes�szAifc_write.setnframescCs|jSrc�r�rdrrr	rq�szAifc_write.getnframescCs.|jrtd��|dkrtd��||_||_dS�Nr�)r�r�r�r�r�r�r�)r�rrwrz)rY�comptype�compnamerrr	�setcomptype�szAifc_write.setcomptypecCs|jSrcrvrdrrr	rx�szAifc_write.getcomptypecCs|jSrcryrdrrr	r{�szAifc_write.getcompnamecCsf|\}}}}}}|jrtd��|dkr.td��|�|�|�|�|�|�|�|�|�||�dSr�)r�rr�r�r�r�r�)rYZparamsr�r�r�r�r�r�rrr	�	setparams�s



zAifc_write.setparamscCs8|jr|jr|jstd��t|j|j|j|j|j|j�S)Nznot all parameters set)rnrrrtrrDrprwrzrdrrr	r|�s�zAifc_write.getparamscCs�|dkrtd��|dkr td��t|t�s2td��tt|j��D],}||j|dkr@|||f|j|<dSq@|j�|||f�dS)Nrzmarker ID must be > 0zmarker position must be >= 0zmarker name must be bytes)rr]�bytesr�r:rPr�)rYr�r�r�r�rrr	�setmark�s
zAifc_write.setmarkcCs2|jD]}||dkr|Sqtd�|���dSr�r�r�rrr	r��s

zAifc_write.getmarkcCst|j�dkrdS|jSr}r~rdrrr	r�szAifc_write.getmarkerscCs|jSrcr�rdrrr	rm�szAifc_write.tellcCszt|ttf�st|��d�}|�t|��t|�|j|j}|j	rN|�	|�}|j
�|�|j||_|j
t|�|_
dS)Nr8)r]r��	bytearray�
memoryview�cast�_ensure_header_writtenr:rrrnrOrRr/r�r�)rYrr�rrr	�writeframesraw�s
zAifc_write.writeframesrawcCs.|�|�|j|jks"|j|jkr*|��dSrc)r�r�rpr�r��_patchheader)rYrrrr	�writeframes�s


�zAifc_write.writeframescCs�|jdkrdSz^|�d�|jd@r<|j�d�|jd|_|��|j|jksb|j	|jksb|j
rj|��W5d|_|j}d|_|��XdS)Nrrr9)rRrOr`r�r�r/�
_writemarkersr�rpr�r�r�)rYr(rrr	r`�s$



��zAifc_write.closecCsddl}|�|d�Sr�)r�Zlin2alawr�rrr	�	_lin2alaw�szAifc_write._lin2alawcCsddl}|�|d�Sr�)r�Zlin2ulawr�rrr	�	_lin2ulawszAifc_write._lin2ulawcCs2ddl}t|d�sd|_|�|d|j�\}|_|Sr�)r�r�r�Z	lin2adpcmr�rrr	�
_lin2adpcms

zAifc_write._lin2adpcmcCsf|jsb|jdkr.|jsd|_|jdkr.td��|js<td��|jsJtd��|jsXtd��|�|�dS)N�r�r�r�r�r�rzRsample width must be 2 when compressing with ulaw/ULAW, alaw/ALAW or G7.22 (ADPCM)z# channels not specifiedzsample width not specifiedzsampling rate not specified)r�rwrrrrnrt�
_write_header)rYZdatasizerrr	r�
s

z!Aifc_write._ensure_header_writtencCs>|jdkr|j|_n&|jdkr(|j|_n|jdkr:|j|_dS)Nr�r�r�)rwr�rOr�r�rdrrr	�_init_compressions




zAifc_write._init_compressionc	CsJ|jr|jdkr|��|j�d�|js<||j|j|_|j|j|j|_|jd@rf|jd|_|jr�|jdkr�|jd|_|jd@r�|jd|_n0|jdkr�|jdd|_|jd@r�|jd|_z|j�	�|_
Wnttfk
r�d|_
YnX|�
|j�}|j�rB|j�d	�|j�d
�t|jd�t|j|j�n|j�d�|j�d�t|j|�t|j|j�|j
dk	�r�|j�	�|_t|j|j�|jd
k�r�t|jd�nt|j|jd�t|j|j�|j�r�|j�|j�t|j|j�|j�d�|j
dk	�r|j�	�|_t|j|jd�t|jd�t|jd�dS)Nr�rFr)r�r�r�r�rr��rrHrLrGrIr�rKrJr)rSrwr�rRr/rprnrrr�rm�_form_length_pos�AttributeError�OSError�_write_form_lengthr6rNr3�_nframes_posrArtr=rz�_ssnd_length_pos)rYZ
initlength�
commlengthrrr	r�%s^




zAifc_write._write_headercCs\|jr*dt|j�}|d@r$|d}d}nd}d}t|jd||jd|d|�|S)	Nr�r�r�rrrK�)rSr:rzr6rRr�)rY�
datalengthr�Z
verslengthrrr	r�Xs"����zAifc_write._write_form_lengthcCs�|j��}|jd@r,|jd}|j�d�n|j}||jkrd|j|jkrd|jdkrd|j�|d�dS|j�|j	d�|�
|�}|j�|jd�t|j|j�|j�|j
d�t|j|d�|j�|d�|j|_||_dS)Nrr9rrK)rRrmr�r/r�rpr�r�r�r�r�r�r6r�)rYZcurposr�r rrr	r�es*




��
zAifc_write._patchheadercCs�t|j�dkrdS|j�d�d}|jD]:}|\}}}|t|�dd}t|�d@dkr(|d}q(t|j|�|d|_t|jt|j��|jD]2}|\}}}t|j|�t|j|�t|j|�q�dS)NrrMrr�rK)r:rPrRr/r6r�r3r=)rYrr�r�r�r�rrr	r�{s"





zAifc_write._writemarkers)(rrrrRrbr[r�rerir�r�r�ror�rsr�rur�rqr�rxr{r�r|r�r�rrmr�r�r`r�r�r�r�r�r�r�r�r�rrrr	r�sJ	

3
r�cCsJ|dkrt|d�r|j}nd}|dkr.t|�S|dkr>t|�Std��dS)N�moder\)�rr\)r�r�z$mode must be 'r', 'rb', 'w', or 'wb')r�r�rEr�r�r(r�rrr	r�s
cCstjdtdd�t||d�S)NzBaifc.openfp is deprecated since Python 3.7. Use aifc.open instead.r)�
stacklevel)r�)r�r��DeprecationWarningrr�rrr	r�s
��__main__rz/usr/demos/data/audio/bach.aiffr�ZReadingznchannels =znframes   =zsampwidth =zframerate =zcomptype  =zcompname  =rZWritingr�izDone.)N)N)8�__doc__r
r_r��__all__�	Exceptionrr�rrrrr!r&r-r3r4r5r6r=rArZrB�collectionsrCrDr�r�r�r�r�r�rEr�rrr�sys�argvr��fnr(�printrorqrsrurxr{Zgn�gr�r|r�rr�rrrr	�<module>s~	

!�







operator.cpython-38.opt-2.pyc000064400000026074150335716500012005 0ustar00U

e5d�)�6@s$dddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5g6Zd6d7lmZd8d%�Zd9d"�Zd:d�Zd;d*�Zd<d
�Zd=d�Z	d>d,�Z
d?d4�Zd@d�ZdAd�Z
dBd�ZdCd�ZdDd�ZdEd	�ZdFd�ZdGd�ZeZdHd$�ZdId(�ZdJd)�ZdKd&�ZdLd+�ZdMd-�ZdNd.�ZdOd/�ZdPd0�ZdQd2�ZdRd3�ZdSd5�ZdTd�Z dUd�Z!dVd�Z"dWd�Z#dXd�Z$dYd�Z%dZd1�Z&dpd[d#�Z'Gd\d�d�Z(Gd]d�d�Z)Gd^d'�d'�Z*d_d
�Z+d`d�Z,dad�Z-dbd�Z.dcd�Z/ddd�Z0ded�Z1dfd�Z2dgd�Z3dhd�Z4did�Z5djd�Z6dkd �Z7dld!�Z8zd6dml9TWne:k
�r^YnXd6dnl9m;Z;eZ<eZ=eZ>eZ?eZ@e	ZAe
ZBeZCeZDeZEeZFeZGeZHeZIeZJeZKeZLeZMeZNeZOeZPeZQeZReZSeZTeZUe ZVe!ZWe#ZXe$ZYe&ZZe+Z[e,Z\e-Z]e.Z^e/Z_e0Z`e1Zae2Zbe3Zce4Zde5Zee6Zfe7Zge8ZhdoS)q�abs�add�and_�
attrgetter�concat�contains�countOf�delitem�eq�floordiv�ge�getitem�gt�iadd�iand�iconcat�	ifloordiv�ilshift�imatmul�imod�imul�index�indexOf�inv�invert�ior�ipow�irshift�is_�is_not�isub�
itemgetter�itruediv�ixor�le�length_hint�lshift�lt�matmul�methodcaller�mod�mul�ne�neg�not_�or_�pos�pow�rshift�setitem�sub�truediv�truth�xor�)rcCs||kS�N���a�br9r9� /usr/lib64/python3.8/operator.pyr&scCs||kSr8r9r:r9r9r=r#scCs||kSr8r9r:r9r9r=r	#scCs||kSr8r9r:r9r9r=r+'scCs||kSr8r9r:r9r9r=r+scCs||kSr8r9r:r9r9r=r
/scCs|Sr8r9�r;r9r9r=r-5scCs|rdSdS)NTFr9r>r9r9r=r59scCs||kSr8r9r:r9r9r=r=scCs||k	Sr8r9r:r9r9r=rAscCst|�Sr8)�_absr>r9r9r=rGscCs||Sr8r9r:r9r9r=rKscCs||@Sr8r9r:r9r9r=rOscCs||Sr8r9r:r9r9r=r
SscCs|��Sr8)�	__index__r>r9r9r=rWscCs|Sr8r9r>r9r9r=r[scCs||>Sr8r9r:r9r9r=r%`scCs||Sr8r9r:r9r9r=r)dscCs||Sr8r9r:r9r9r=r*hscCs||Sr8r9r:r9r9r=r'lscCs|Sr8r9r>r9r9r=r,pscCs||BSr8r9r:r9r9r=r.tscCs|
Sr8r9r>r9r9r=r/xscCs||Sr8r9r:r9r9r=r0|scCs||?Sr8r9r:r9r9r=r1�scCs||Sr8r9r:r9r9r=r3�scCs||Sr8r9r:r9r9r=r4�scCs||ASr8r9r:r9r9r=r6�scCs(t|d�s dt|�j}t|��||S�N�__getitem__z!'%s' object can't be concatenated��hasattr�type�__name__�	TypeError�r;r<�msgr9r9r=r�s
cCs||kSr8r9r:r9r9r=r�scCs"d}|D]}||kr|d7}q|S)Nr7�r9)r;r<�count�ir9r9r=r�s

cCs
||=dSr8r9r:r9r9r=r�scCs||Sr8r9r:r9r9r=r�scCs.t|�D]\}}||kr|Sqtd��dS)Nz$sequence.index(x): x not in sequence)�	enumerate�
ValueError)r;r<rL�jr9r9r=r�s
cCs|||<dSr8r9)r;r<�cr9r9r=r2�scCs�t|t�s dt|�j}t|��z
t|�WStk
r>YnXzt|�j}Wntk
rf|YSXz||�}Wntk
r�|YSX|tkr�|St|t�s�dt|�j}t|��|dkr�d}t	|��|S)Nz/'%s' object cannot be interpreted as an integerz'__length_hint__ must be integer, not %sr7z$__length_hint__() should return >= 0)
�
isinstance�intrErFrG�len�__length_hint__�AttributeError�NotImplementedrN)�obj�defaultrIZhint�valr9r9r=r$�s8	
�



�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r)�_attrs�_callcsn|s<t|t�std��|f|_|�d���fdd�}||_n.|f||_ttt|j����fdd�}||_dS)Nzattribute name must be a string�.cs�D]}t||�}q|Sr8)�getattr)rW�name)�namesr9r=�func�sz!attrgetter.__init__.<locals>.funccst�fdd��D��S)Nc3s|]}|��VqdSr8r9)�.0�getter�rWr9r=�	<genexpr>�sz4attrgetter.__init__.<locals>.func.<locals>.<genexpr>��tuplerc)�gettersrcr=r`�s)	rQ�strrGrZ�splitr[rf�mapr)�self�attr�attrsr`r9)rgr_r=�__init__�s

zattrgetter.__init__cCs
|�|�Sr8�r[�rkrWr9r9r=�__call__�szattrgetter.__call__cCs$d|jj|jjd�tt|j��fS�N�	%s.%s(%s)�, )�	__class__�
__module__�__qualname__�joinrj�reprrZ�rkr9r9r=�__repr__s�zattrgetter.__repr__cCs|j|jfSr8)rurZrzr9r9r=�
__reduce__szattrgetter.__reduce__N�rFrvrw�	__slots__rnrqr{r|r9r9r9r=r�s
c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r ��_itemsr[csF�s �f|_�fdd�}||_n"�f�|_��fdd�}||_dS)Ncs|�Sr8r9rc)�itemr9r=r`sz!itemgetter.__init__.<locals>.funccst�fdd��D��S)Nc3s|]}�|VqdSr8r9)rarLrcr9r=rdsz4itemgetter.__init__.<locals>.func.<locals>.<genexpr>rerc)�itemsrcr=r`sr)rkr�r�r`r9)r�r�r=rnszitemgetter.__init__cCs
|�|�Sr8rorpr9r9r=rqszitemgetter.__call__cCs$d|jj|jjd�tt|j��fSrr)rurvrFrxrjryr�rzr9r9r=r{ s�zitemgetter.__repr__cCs|j|jfSr8)rur�rzr9r9r=r|%szitemgetter.__reduce__Nr}r9r9r9r=r 	s
c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r()�_name�_args�_kwargscOs*||_t|jt�std��||_||_dS)Nzmethod name must be a string)r�rQrhrGr�r�)rkr^�args�kwargsr9r9r=rn1s
zmethodcaller.__init__cCst||j�|j|j�Sr8)r]r�r�r�rpr9r9r=rq8szmethodcaller.__call__cCsTt|j�g}|�tt|j��|�dd�|j��D��d|jj|jj	d�
|�fS)Ncss|]\}}d||fVqdS)z%s=%rNr9)ra�k�vr9r9r=rd>sz(methodcaller.__repr__.<locals>.<genexpr>rsrt)ryr��extendrjr�r�r�rurvrFrx)rkr�r9r9r=r{;s�zmethodcaller.__repr__cCsD|js|j|jf|jfSddlm}||j|jf|j�|jfSdS)Nr7)�partial)r�rur�r��	functoolsr�)rkr�r9r9r=r|Cszmethodcaller.__reduce__Nr}r9r9r9r=r((s
cCs||7}|Sr8r9r:r9r9r=rMscCs||M}|Sr8r9r:r9r9r=rRscCs,t|d�s dt|�j}t|��||7}|SrArCrHr9r9r=rWs

cCs||}|Sr8r9r:r9r9r=r_scCs||K}|Sr8r9r:r9r9r=rdscCs||;}|Sr8r9r:r9r9r=riscCs||9}|Sr8r9r:r9r9r=rnscCs||}|Sr8r9r:r9r9r=rsscCs||O}|Sr8r9r:r9r9r=rxscCs||C}|Sr8r9r:r9r9r=r}scCs||L}|Sr8r9r:r9r9r=r�scCs||8}|Sr8r9r:r9r9r=r�scCs||}|Sr8r9r:r9r9r=r!�scCs||N}|Sr8r9r:r9r9r=r"�s)�*)�__doc__N)r7)i�__all__�builtinsrr?r&r#r	r+rr
r-r5rrrrr
rrrr%r)r*r'r,r.r/r0r1r3r4r6rrrrrrr2r$rr r(rrrrrrrrrrrrr!r"�	_operator�ImportErrorr��__lt__�__le__�__eq__�__ne__�__ge__�__gt__�__not__�__abs__�__add__�__and__�__floordiv__r@�__inv__�
__invert__�
__lshift__�__mod__�__mul__�
__matmul__�__neg__�__or__�__pos__�__pow__�
__rshift__�__sub__�__truediv__�__xor__�
__concat__�__contains__�__delitem__rB�__setitem__�__iadd__�__iand__�__iconcat__�
__ifloordiv__�__ilshift__�__imod__�__imul__�__imatmul__�__ior__�__ipow__�__irshift__�__isub__�__itruediv__�__ixor__r9r9r9r=�<module>
s2�	
)'%calendar.cpython-38.opt-1.pyc000064400000064672150335716500011730 0ustar00U

e5da�@s4dZddlZddlZddlZddlmZdddddd	d
ddd
ddddddddddddddgZeZ	Gdd�de�Z
Gdd�de�ZdZdZ
dd d!d d"d d"d d d"d d"d g
ZGd#d$�d$�ZGd%d&�d&�Zed'�Zed(�Zed)�Zed*�Zed+�\ZZZZZZZd,d�Zd-d	�Zd.d
�Zd/d�Z d0d1�Z!d2d3�Z"d4d5�Z#Gd6d�de$�Z%Gd7d�de%�Z&Gd8d�de%�Z'Gd9d:�d:�Z(Gd;d�de&�Z)Gd<d�de'�Z*e&�Z+e+j,Z-d=d�Z.e+j/Z0e+j1Z1e+j2Z3e+j4Z5e+j6Z6e+j7Z8e+j9Z:e+j;Z<d>Z=d?Z>e=e>fd@dA�Z?e=e>fdBdC�Z@dDZAe�BeAdd��C�ZDdEd�ZEdFdG�ZFeGdHk�r0eFejH�dS)Ia$Calendar printing functions

Note when comparing these calendars to the ones printed by cal(1): By
default, these calendars have Monday as the first day of the week, and
Sunday as the last (the European convention). Use setfirstweekday() to
set the first day of the week (0=Monday, 6=Sunday).�N)�repeat�IllegalMonthError�IllegalWeekdayError�setfirstweekday�firstweekday�isleap�leapdays�weekday�
monthrange�
monthcalendar�prmonth�month�prcal�calendar�timegm�
month_name�
month_abbr�day_name�day_abbr�Calendar�TextCalendar�HTMLCalendar�LocaleTextCalendar�LocaleHTMLCalendar�
weekheaderc@seZdZdd�Zdd�ZdS)rcCs
||_dS�N�r
)�selfr
�r� /usr/lib64/python3.8/calendar.py�__init__szIllegalMonthError.__init__cCs
d|jS)Nz!bad month number %r; must be 1-12r�rrrr�__str__szIllegalMonthError.__str__N��__name__�
__module__�__qualname__r r"rrrrrsc@seZdZdd�Zdd�ZdS)rcCs
||_dSr�r	)rr	rrrr  szIllegalWeekdayError.__init__cCs
d|jS)Nz7bad weekday number %r; must be 0 (Monday) to 6 (Sunday)r'r!rrrr""szIllegalWeekdayError.__str__Nr#rrrrrs�����c@sFeZdZdd�ed�D�Ze�ddd��dd�Zd	d
�Zdd�Zd
S)�_localized_monthcCs g|]}t�d|dd�j�qS�i�r(��datetime�date�strftime��.0�irrr�
<listcomp>4sz_localized_month.<listcomp>�rcCsdS)N�r)�xrrr�<lambda>5�z_localized_month.<lambda>cCs
||_dSr��format�rr=rrrr 7sz_localized_month.__init__cs4�j|}t|t�r&�fdd�|D�S|�j�SdS)Ncsg|]}|�j��qSrr<�r4�fr!rrr6=sz0_localized_month.__getitem__.<locals>.<listcomp>)�_months�
isinstance�slicer=�rr5Zfuncsrr!r�__getitem__:s

z_localized_month.__getitem__cCsdS)N�
rr!rrr�__len__Asz_localized_month.__len__N)	r$r%r&�rangerA�insertr rErGrrrrr-2s
r-c@s6eZdZdd�ed�D�Zdd�Zdd�Zdd	�Zd
S)�_localized_daycCs g|]}t�dd|d�j�qSr.r/r3rrrr6Hsz_localized_day.<listcomp>�cCs
||_dSrr<r>rrrr Jsz_localized_day.__init__cs4�j|}t|t�r&�fdd�|D�S|�j�SdS)Ncsg|]}|�j��qSrr<r?r!rrr6Psz._localized_day.__getitem__.<locals>.<listcomp>)�_daysrBrCr=rDrr!rrEMs

z_localized_day.__getitem__cCsdS�NrKrr!rrrrGTsz_localized_day.__len__N)r$r%r&rHrLr rErGrrrrrJEsrJz%Az%az%Bz%brKcCs$|ddko"|ddkp"|ddkS)z5Return True for leap years, False for non-leap years.�r�d�r)�yearrrrrdscCs@|d8}|d8}|d|d|d|d|d|dS)zFReturn number of leap years in range [y1, y2).
       Assume y1 <= y2.r(rNrOrPr)Zy1Zy2rrrriscCs8tj|krtjks&nd|d}t�|||���S)zBReturn weekday (0-6 ~ Mon-Sun) for year, month (1-12), day (1-31).i�rP)r0ZMINYEARZMAXYEARr1r	)rQr
�dayrrrr	qscCsJd|krdksnt|��t||d�}t||tko>t|�}||fS)zQReturn weekday (0-6 ~ Mon-Sun) and number of days (28-31) for
       year, month.r(r7)rr	�mdays�Februaryr)rQr
�day1�ndaysrrrr
xs
cCst||tkot|�Sr)rSrTr�rQr
rrr�	_monthlen�srXcCs$|dkr|ddfS||dfSdS)Nr(r7rrWrrr�
_prevmonth�srYcCs$|dkr|ddfS||dfSdS)Nr7r(rrWrrr�
_nextmonth�srZc@s�eZdZdZd#dd�Zdd�Zdd�Zeee�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd$dd�Zd%dd�Zd&d d!�Zd"S)'rzo
    Base calendar class. This class doesn't do any formatting. It simply
    provides data to subclasses.
    rcCs
||_dSr�r�rrrrrr �szCalendar.__init__cCs
|jdSrM�Z
_firstweekdayr!rrr�getfirstweekday�szCalendar.getfirstweekdaycCs
||_dSrr]r\rrrr�szCalendar.setfirstweekdayccs&t|j|jd�D]}|dVqdS)zt
        Return an iterator for one week of weekday numbers starting with the
        configured first one.
        rKN)rHr)rr5rrr�iterweekdays�szCalendar.iterweekdaysccs,|�||�D]\}}}t�|||�VqdS)z�
        Return an iterator for one month. The iterator will yield datetime.date
        values and will always iterate through complete weeks, so it will yield
        dates outside the specified month.
        N)�itermonthdays3r0r1)rrQr
�y�m�drrr�itermonthdates�szCalendar.itermonthdatesccsft||�\}}||jd}td|�EdHtd|d�EdH|j||d}td|�EdHdS)z�
        Like itermonthdates(), but will yield day numbers. For days outside
        the specified month the day number is 0.
        rKrNr()r
rrrH)rrQr
rUrV�days_before�
days_afterrrr�
itermonthdays�szCalendar.itermonthdaysccs0t|�||�|j�D]\}}||dfVqdS)z�
        Like itermonthdates(), but will yield (day number, weekday number)
        tuples. For days outside the specified month the day number is 0.
        rKN)�	enumeratergr)rrQr
r5rcrrr�itermonthdays2�szCalendar.itermonthdays2ccs�t||�\}}||jd}|j||d}t||�\}}t||�d}	t|	||	�D]}
|||
fVqXtd|d�D]}
|||
fVqxt||�\}}td|d�D]}
|||
fVq�dS)z�
        Like itermonthdates(), but will yield (year, month, day) tuples.  Can be
        used for dates outside of datetime.date range.
        rKr(N)r
rrYrXrHrZ)rrQr
rUrVrerfrarb�endrcrrrr`�szCalendar.itermonthdays3ccs<t|�||��D]&\}\}}}||||j|dfVqdS)z�
        Like itermonthdates(), but will yield (year, month, day, day_of_week) tuples.
        Can be used for dates outside of datetime.date range.
        rKN)rhr`r)rrQr
r5rarbrcrrr�itermonthdays4�szCalendar.itermonthdays4cs.t|�||����fdd�tdt��d�D�S)z�
        Return a matrix (list of lists) representing a month's calendar.
        Each row represents a week; week entries are datetime.date values.
        csg|]}�||d��qS�rKrr3�Zdatesrrr6�sz/Calendar.monthdatescalendar.<locals>.<listcomp>rrK)�listrdrH�len�rrQr
rrmr�monthdatescalendar�szCalendar.monthdatescalendarcs.t|�||����fdd�tdt��d�D�S)z�
        Return a matrix representing a month's calendar.
        Each row represents a week; week entries are
        (day number, weekday number) tuples. Day numbers outside this month
        are zero.
        csg|]}�||d��qSrlrr3��daysrrr6�sz/Calendar.monthdays2calendar.<locals>.<listcomp>rrK)rnrirHrorprrrr�monthdays2calendar�szCalendar.monthdays2calendarcs.t|�||����fdd�tdt��d�D�S)z�
        Return a matrix representing a month's calendar.
        Each row represents a week; days outside this month are zero.
        csg|]}�||d��qSrlrr3rrrrr6�sz.Calendar.monthdayscalendar.<locals>.<listcomp>rrK)rnrgrHrorprrrr�monthdayscalendar�szCalendar.monthdayscalendar�cs>��fdd�tttd�D����fdd�tdt����D�S)a'
        Return the data for the specified year ready for formatting. The return
        value is a list of month rows. Each month row contains up to width months.
        Each month contains between 4 and 6 weeks and each week contains 1-7
        days. Days are datetime.date objects.
        csg|]}���|��qSr)rqr3�rrQrrr6s�z.Calendar.yeardatescalendar.<locals>.<listcomp>r7csg|]}�||���qSrrr3��months�widthrrr6	sr�rH�Januaryro�rrQrzr�ryrrzrQr�yeardatescalendar�s�zCalendar.yeardatescalendarcs>��fdd�tttd�D����fdd�tdt����D�S)z�
        Return the data for the specified year ready for formatting (similar to
        yeardatescalendar()). Entries in the week lists are
        (day number, weekday number) tuples. Day numbers outside this month are
        zero.
        csg|]}���|��qSr)rtr3rwrrr6s�z.Calendar.yeardays2calendar.<locals>.<listcomp>r7csg|]}�||���qSrrr3rxrrr6srr{r}rr~r�yeardays2calendars�zCalendar.yeardays2calendarcs>��fdd�tttd�D����fdd�tdt����D�S)z�
        Return the data for the specified year ready for formatting (similar to
        yeardatescalendar()). Entries in the week lists are day numbers.
        Day numbers outside this month are zero.
        csg|]}���|��qSr)rur3rwrrr6s�z-Calendar.yeardayscalendar.<locals>.<listcomp>r7csg|]}�||���qSrrr3rxrrr6"srr{r}rr~r�yeardayscalendars�zCalendar.yeardayscalendarN)r)rv)rv)rv)r$r%r&�__doc__r r^r�propertyrr_rdrgrir`rkrqrtrurr�r�rrrrr�s"

	



c@sjeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
d�Z	ddd�Z
ddd�Zd dd�Zd!dd�Z
dS)"rzr
    Subclass of Calendar that outputs a calendar as a simple plain text
    similar to the UNIX program cal.
    cCst|�||�dd�dS)z3
        Print a single week (no newline).
        r8�rjN)�print�
formatweek�r�theweekrzrrr�prweek+szTextCalendar.prweekcCs |dkrd}nd|}|�|�S)z*
        Returns a formatted day.
        rr8z%2i��center)rrRr	rz�srrr�	formatday1szTextCalendar.formatdaycsd���fdd�|D��S)zA
        Returns a single week in a string (no newline).
        � c3s |]\}}��||��VqdSr�r��r4rcZwd�rrzrr�	<genexpr>?sz*TextCalendar.formatweek.<locals>.<genexpr>��joinr�rr�rr�;szTextCalendar.formatweekcCs(|dkrt}nt}||d|��|�S)z4
        Returns a formatted week day name.
        �	N)rrr�)rrRrz�namesrrr�
formatweekdayAszTextCalendar.formatweekdaycsd���fdd����D��S)z-
        Return a header for a week.
        r�c3s|]}��|��VqdSr�r�r3r�rrr�Osz0TextCalendar.formatweekheader.<locals>.<genexpr>�r�r_r�rr�r�formatweekheaderKszTextCalendar.formatweekheaderTcCs"t|}|rd||f}|�|�S)z0
        Return a formatted month name.
        �%s %r)rr��r�theyear�themonthrz�withyearr�rrr�formatmonthnameQszTextCalendar.formatmonthnamercCst|�||||�dd�dS)z+
        Print a month's calendar.
        r8r�N)r��formatmonth)rr�r��w�lrrrrZszTextCalendar.prmonthcCs�td|�}td|�}|�||d|dd�}|��}|d|7}||�|���7}|d|7}|�||�D]$}||�||���7}|d|7}ql|S)z@
        Return a month's calendar string (multi-line).
        r)r(rK�
)�maxr��rstripr�rtr�)rr�r�r�r�r��weekrrrr�`s

zTextCalendar.formatmonthr)r(�rvc	s�td|�}td|�}td|�}|ddd�g}|j}|t����|||d����|d|���|��t���|��D�]"\}}	t||dt	||ddd��}
|d|����fdd�|
D�}|t
|�|����|d|��fdd�|
D�}|t
|�|����|d|�td	d�|	D��}
t|
�D]f}g}|	D]6}|t|�k�rj|�d
�n|���|||���qL|t
|�|����|d|��q@q�d
�
|�S)zC
        Returns a year's calendar as a multi-line string.
        r)r(rKr�rFc3s|]}���|�d�VqdS)FN)r��r4�k)�colwidthrr�rrr��s�z*TextCalendar.formatyear.<locals>.<genexpr>c3s|]
}�VqdSrrr�)�headerrrr��scss|]}t|�VqdSr)ro)r4�calrrrr��sr8)r��append�reprr�r�r�rhr�rH�min�formatstringror�r�)rr�r�r��crb�v�ar5�rowryr�ZheadersZheight�jZweeksr�r)r�r�rr�r�
formatyearps<


&
$�zTextCalendar.formatyearcCst|�|||||�dd�dS)zPrint a year's calendar.r8r�N)r�r�)rr�r�r�r�rbrrr�pryear�szTextCalendar.pryearN)T)rr)rr)r)r(r�rv)rrr�rv)r$r%r&r�r�r�r�r�r�r�rr�r�r�rrrrr%s


	


%c@s�eZdZdZdddddddgZeZd	Zd
Zd
ZdZ	dZ
dd
�Zdd�Zdd�Z
dd�Zd dd�Zd!dd�Zd"dd�Zd#dd�ZdS)$rz4
    This calendar returns complete HTML pages.
    ZmonZtueZwedZthuZfriZsatZsunZnodayr
rQcCs(|dkrd|jSd|j||fSdS)z/
        Return a day as a table cell.
        rz<td class="%s">&nbsp;</td>z<td class="%s">%d</td>N)�cssclass_noday�
cssclasses)rrRr	rrrr��s
zHTMLCalendar.formatdaycs d��fdd�|D��}d|S)z8
        Return a complete week as a table row.
        r8c3s|]\}}��||�VqdSrr�r�r!rrr��sz*HTMLCalendar.formatweek.<locals>.<genexpr>�<tr>%s</tr>r�)rr�r�rr!rr��szHTMLCalendar.formatweekcCsd|j|t|fS)z:
        Return a weekday name as a table header.
        �<th class="%s">%s</th>)�cssclasses_weekday_headr)rrRrrrr��s�zHTMLCalendar.formatweekdaycs$d��fdd����D��}d|S)z<
        Return a header for a week as a table row.
        r8c3s|]}��|�VqdSrr�r3r!rrr��sz0HTMLCalendar.formatweekheader.<locals>.<genexpr>r�r�)rr�rr!rr��szHTMLCalendar.formatweekheaderTcCs0|rdt||f}ndt|}d|j|fS)z5
        Return a month name as a table row.
        �%s %sz%sz+<tr><th colspan="7" class="%s">%s</th></tr>)r�cssclass_month_head�rr�r�r�r�rrrr��s�zHTMLCalendar.formatmonthnamecCs�g}|j}|d|j�|d�||j|||d��|d�||���|d�|�||�D]}||�|��|d�q\|d�|d�d�|�S)z6
        Return a formatted month as a table.
        �=<table border="0" cellpadding="0" cellspacing="0" class="%s">r��r��</table>r8)r��cssclass_monthr�r�rtr�r�)rr�r�r�r�r�r�rrrr��s �
zHTMLCalendar.formatmonthrvcCs�g}|j}t|d�}|d|j�|d�|d||j|f�tttd|�D]V}t|t||d��}|d�|D](}|d�||j||d	d
��|d�qr|d�qN|d
�d�|�S)z?
        Return a formatted year as a table of tables.
        r(r�r�z,<tr><th colspan="%d" class="%s">%s</th></tr>r7rFz<tr>z<td>Fr�z</td>z</tr>r�r8)	r�r��
cssclass_year�cssclass_year_headrHr|r�r�r�)rr�rzr�r�r5ryrbrrrr��s,
��

zHTMLCalendar.formatyear�calendar.cssNcCs�|dkrt��}g}|j}|d|�|d�|d�|d�|d|�|dk	r^|d|�|d|�|d	�|d
�||�||��|d�|d�d
�|��|d�S)zB
        Return a formatted year as a complete HTML page.
        Nz$<?xml version="1.0" encoding="%s"?>
zn<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
z<html>
z<head>
zC<meta http-equiv="Content-Type" content="text/html; charset=%s" />
z4<link rel="stylesheet" type="text/css" href="%s" />
z<title>Calendar for %d</title>
z</head>
z<body>
z</body>
z</html>
r8�xmlcharrefreplace)�sys�getdefaultencodingr�r�r��encode)rr�rz�css�encodingr�r�rrr�formatyearpage
s$zHTMLCalendar.formatyearpage)T)T)rv)rvr�N)r$r%r&r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�s 



c@s$eZdZdd�Zdd�Zdd�ZdS)�different_localecCs
||_dSr��locale)rr�rrrr #szdifferent_locale.__init__cCs"t�tj�|_t�tj|j�dSr)�_localeZ	getlocale�LC_TIME�	oldlocale�	setlocaler�r!rrr�	__enter__&szdifferent_locale.__enter__cGst�tj|j�dSr)r�r�r�r�)r�argsrrr�__exit__*szdifferent_locale.__exit__N)r$r%r&r r�r�rrrrr�"sr�c@s,eZdZdZddd�Zdd�Zdd	d
�ZdS)
r�
    This class can be passed a locale name in the constructor and will return
    month and weekday names in the specified locale. If this locale includes
    an encoding all strings containing month and weekday names will be returned
    as unicode.
    rNcCs&t�||�|dkrt��}||_dSr)rr r��getdefaultlocaler��rrr�rrrr 6szLocaleTextCalendar.__init__c
CsNt|j��:|dkrt}nt}||}|d|��|�W5QR�SQRXdS)Nr�)r�r�rrr�)rrRrzr��namerrrr�<sz LocaleTextCalendar.formatweekdayTc
CsDt|j��0t|}|r$d||f}|�|�W5QR�SQRXdS)Nr�)r�r�rr�r�rrrr�Es
z"LocaleTextCalendar.formatmonthname)rN)T�r$r%r&r�r r�r�rrrrr.s
	c@s,eZdZdZddd�Zdd�Zdd	d
�ZdS)
rr�rNcCs&t�||�|dkrt��}||_dSr)rr r�r�r�r�rrrr TszLocaleHTMLCalendar.__init__c
Cs<t|j��(t|}d|j||fW5QR�SQRXdS)Nr�)r�r�rr�)rrRr�rrrr�Zsz LocaleHTMLCalendar.formatweekdayTc
CsBt|j��.t|}|r$d||f}d|W5QR�SQRXdS)Nr�z.<tr><th colspan="7" class="month">%s</th></tr>)r�r�rr�rrrr�_s
z"LocaleHTMLCalendar.formatmonthname)rN)Tr�rrrrrMs
cCs(t|krtksnt|��|t_dSr)�MONDAY�SUNDAYrr�rr[rrrrls�r�cCstt|||��dS)z1Prints multi-column formatting for year calendarsN)r�r��Zcolsr��spacingrrrr=�sr=cs |d9}|��fdd�|D��S)zEReturns a string formatted from n strings, centered within n columns.r�c3s|]}|���VqdSrr�)r4r��r�rrr��szformatstring.<locals>.<genexpr>r�r�rr�rr��sr�i�cCs^|dd�\}}}}}}t�||d���t|d}|d|}|d|}	|	d|}
|
S)zBUnrelated but handy function to calculate Unix timestamp from GMT.Nr�r(��<)r0r1�	toordinal�
_EPOCH_ORD)�tuplerQr
rRZhourZminute�secondrsZhoursZminutesZsecondsrrrr�scCs�ddl}|��}|�d�}|�d�}|jddtddd�|jd	d
tddd�|jd
dtddd�|jddtddd�|jddddd�|jddddd�|jddddd�|jd d!d"d#d$d%�|jd&d'td(d)�|jd*d'td+d)�|�|dd��}|j�r|j�s|�d,�t	�
d�|j|jf}|jd-k�r�|j�rDt|d.�}nt
�}|j}|dk�rbt	��}t||jd/�}	t	jjj}
|jdk�r�|
|jtj��jf|	��n6|jdk�r�|
|j|jf|	��n|�d0�t	�
d�n�|j�r�t|d.�}nt�}t|j|jd1�}	|jdk�r$|j|	d2<|j|	d3<|jdk�rH|j tj��jf|	�}n2|jdk�rf|j |jf|	�}n|j!|j|jf|	�}t	jj}
|j�r�|�"|j�}t	jjj}
|
|�dS)4Nrztext only argumentszhtml only argumentsz-wz--widthr)z width of date column (default 2))�type�default�helpz-lz--linesr(z)number of lines for each week (default 1)z-sz	--spacingr�z"spacing between months (default 6)z-mz--monthsrvzmonths per row (default 3)z-cz--cssr�zCSS to use for page)r�r�z-Lz--localez.locale to be used from month and weekday namesz-ez
--encodingzencoding to use for outputz-tz--type�text)r��htmlzoutput type (text or html))r��choicesr�rQ�?zyear number (1-9999))�nargsr�r�r
zmonth number (1-12, text only)z/if --locale is specified --encoding is requiredr�r�)r�r�zincorrect number of arguments)r�r�r�rb)#�argparse�ArgumentParserZadd_argument_group�add_argument�int�
parse_argsr�r��errorr��exitr�rrr��dictr��stdout�buffer�writerQr�r0r1Ztodayr
rrrz�linesr�ryr�r�r�)r�r��parserZ	textgroupZ	htmlgroupZoptionsr�r�r�Zoptdictr��resultrrr�main�s�

����������







r�__main__)Ir�r�r0r�r��	itertoolsr�__all__�
ValueErrorr�rrr|rTrSr-rJrrrrrHr�ZTUESDAYZ	WEDNESDAYZTHURSDAYZFRIDAYZSATURDAYr�rrr	r
rXrYrZ�objectrrrr�rrr�r^rrrurr�r�r�r�rrr�r
r�rr�rZ	_colwidthZ_spacingr=r�ZEPOCHr1r�r�rrr$�argvrrrr�<module>s��
u	
h
bdb.cpython-38.pyc000064400000060533150335716500007737 0ustar00U

e5d8}�@s�dZddlZddlZddlZddlmZmZmZdddgZeeBeBZ	Gdd�de
�ZGdd�d�Zd	d
�Z
Gdd�d�Zdd
�Zdd�ZGdd�de�Zdd�Zdd�Zdd�ZdS)zDebugger basics�N)�CO_GENERATOR�CO_COROUTINE�CO_ASYNC_GENERATOR�BdbQuit�Bdb�
Breakpointc@seZdZdZdS)rz Exception to give up completely.N)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.8/bdb.pyr
sc@sveZdZdZd[dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd\d&d'�Zd]d(d)�Zd*d+�Zd,d-�Zd.d/�Zd^d0d1�Zd2d3�Zd4d5�Zd_d7d8�Zd9d:�Zd;d<�Zd=d>�Z d?d@�Z!dAdB�Z"dCdD�Z#dEdF�Z$dGdH�Z%dIdJ�Z&dKdL�Z'dMdN�Z(d`dPdQ�Z)dadRdS�Z*dbdTdU�Z+dVdW�Z,dXdY�Z-dZe-_.dS)craGeneric Python debugger base class.

    This class takes care of details of the trace facility;
    a derived class should implement user interaction.
    The standard debugger class (pdb.Pdb) is an example.

    The optional skip argument must be an iterable of glob-style
    module name patterns.  The debugger will not step into frames
    that originate in a module that matches one of these patterns.
    Whether a frame is considered to originate in a certain module
    is determined by the __name__ in the frame globals.
    NcCs(|rt|�nd|_i|_i|_d|_dS)N)�set�skip�breaks�fncache�frame_returning)�selfrrrr
�__init__szBdb.__init__cCsR|d|dd�dkr|S|j�|�}|sNtj�|�}tj�|�}||j|<|S)a%Return canonical form of filename.

        For real filenames, the canonical form is a case-normalized (on
        case insensitive filesystems) absolute path.  'Filenames' with
        angle brackets, such as "<stdin>", generated in interactive
        mode, are returned unchanged.
        �<�����>)r�get�os�path�abspath�normcase)r�filename�canonicrrr
r%s
zBdb.canoniccCs&ddl}|��d|_|�dd�dS)z5Set values of attributes as ready to start debugging.rN)�	linecache�
checkcache�botframe�
_set_stopinfo)rr rrr
�reset6sz	Bdb.resetcCs�|jr
dS|dkr|�|�S|dkr0|�||�S|dkrD|�||�S|dkrX|�||�S|dkrf|jS|dkrt|jS|dkr�|jStd	t|��|jS)
aODispatch a trace function for debugged frames based on the event.

        This function is installed as the trace function for debugged
        frames. Its return value is the new trace function, which is
        usually itself. The default implementation decides how to
        dispatch a frame, depending on the type of event (passed in as a
        string) that is about to be executed.

        The event can be one of the following:
            line: A new line of code is going to be executed.
            call: A function is about to be called or another code block
                  is entered.
            return: A function or other code block is about to return.
            exception: An exception has occurred.
            c_call: A C function is about to be called.
            c_return: A C function has returned.
            c_exception: A C function has raised an exception.

        For the Python events, specialized functions (see the dispatch_*()
        methods) are called.  For the C events, no action is taken.

        The arg parameter depends on the previous event.
        N�lineZcall�returnZ	exceptionZc_callZc_exceptionZc_returnz*bdb.Bdb.dispatch: unknown debugging event:)�quitting�
dispatch_line�
dispatch_call�dispatch_return�dispatch_exception�trace_dispatch�print�repr)r�frameZevent�argrrr
r,=s$
zBdb.trace_dispatchcCs.|�|�s|�|�r(|�|�|jr(t�|jS)a	Invoke user function and return trace function for line event.

        If the debugger stops on the current line, invoke
        self.user_line(). Raise BdbQuit if self.quitting is set.
        Return self.trace_dispatch to continue tracing in this scope.
        )�	stop_here�
break_here�	user_liner'rr,�rr/rrr
r(hs

zBdb.dispatch_linecCsd|jdkr|j|_|jS|�|�s0|�|�s0dS|jrH|jjt@rH|jS|�	||�|j
r^t�|jS)aInvoke user function and return trace function for call event.

        If the debugger stops on this function call, invoke
        self.user_call(). Raise BbdQuit if self.quitting is set.
        Return self.trace_dispatch to continue tracing in this scope.
        N)r"�f_backr,r1�break_anywhere�	stopframe�f_code�co_flags�GENERATOR_AND_COROUTINE_FLAGS�	user_callr'r�rr/r0rrr
r)ts
zBdb.dispatch_callcCs||�|�s||jkrv|jr,|jjt@r,|jSz||_|�||�W5d|_X|j	rVt
�|j|krv|jdkrv|�dd�|jS)aInvoke user function and return trace function for return event.

        If the debugger stops on this function return, invoke
        self.user_return(). Raise BdbQuit if self.quitting is set.
        Return self.trace_dispatch to continue tracing in this scope.
        Nr)
r1�returnframer7r8r9r:r,r�user_returnr'r�
stoplinenor#r<rrr
r*�szBdb.dispatch_returncCs�|�|�rF|jjt@r.|dtkr.|ddks�|�||�|jr�t�nD|jr�||jk	r�|jjjt@r�|dtt	fkr�|�||�|jr�t�|j
S)aInvoke user function and return trace function for exception event.

        If the debugger stops on this exception, invoke
        self.user_exception(). Raise BdbQuit if self.quitting is set.
        Return self.trace_dispatch to continue tracing in this scope.
        r�N)r1r8r9r:�
StopIteration�user_exceptionr'rr7�
GeneratorExitr,r<rrr
r+�s$

�
���zBdb.dispatch_exceptioncCs.|dkrdS|jD]}t�||�rdSqdS)z4Return True if module_name matches any skip pattern.NFT)r�fnmatch)rZmodule_name�patternrrr
�is_skipped_module�s
zBdb.is_skipped_modulecCsN|jr|�|j�d��rdS||jkr@|jdkr4dS|j|jkS|jsJdSdS)z>Return True if frame is below the starting frame in the stack.rFrT)rrF�	f_globalsrr7r?�f_linenor4rrr
r1�s�

z
Bdb.stop_herecCs�|�|jj�}||jkrdS|j}||j|krJ|jj}||j|krJdSt|||�\}}|r�|j|_|r�|j	r�|�
t|j��dSdSdS)z�Return True if there is an effective breakpoint for this line.

        Check for line or function breakpoint and if in effect.
        Delete temporary breakpoints if effective() says to.
        FTN)rr8�co_filenamerrH�co_firstlineno�	effective�numberZ	currentbp�	temporary�do_clear�str)rr/r�lineno�bp�flagrrr
r2�s

zBdb.break_herecCstd��dS)zlRemove temporary breakpoint.

        Must implement in derived classes or get NotImplementedError.
        z)subclass of bdb must implement do_clear()N)�NotImplementedError)rr0rrr
rN�szBdb.do_clearcCs|�|jj�|jkS)zEReturn True if there is any breakpoint for frame's filename.
        )rr8rIrr4rrr
r6�szBdb.break_anywherecCsdS)z&Called if we might stop in a function.Nr)rr/Z
argument_listrrr
r;sz
Bdb.user_callcCsdS)z'Called when we stop or break at a line.Nrr4rrr
r3sz
Bdb.user_linecCsdS)z&Called when a return trap is set here.Nr)rr/Zreturn_valuerrr
r>	szBdb.user_returncCsdS)z$Called when we stop on an exception.Nr)rr/�exc_inforrr
rB
szBdb.user_exceptionrcCs||_||_d|_||_dS)z�Set the attributes for stopping.

        If stoplineno is greater than or equal to 0, then stop at line
        greater than or equal to the stopline.  If stoplineno is -1, then
        don't stop at all.
        FN)r7r=r'r?)rr7r=r?rrr
r#szBdb._set_stopinfocCs$|dkr|jd}|�|||�dS)zxStop when the line with the lineno greater than the current one is
        reached or when returning from current frame.Nr)rHr#)rr/rPrrr
�	set_until"s
z
Bdb.set_untilcCs0|jr |jj}|r |js |j|_|�dd�dS)zStop after one line of code.N)rr5�f_tracer,r#)rZcaller_framerrr
�set_step*s

zBdb.set_stepcCs|�|d�dS)z2Stop on the next line in or below the given frame.N)r#r4rrr
�set_next6szBdb.set_nextcCs.|jjt@r|�|dd�n|�|j|�dS)z)Stop when returning from the given frame.Nr)r8r9r:r#r5r4rrr
�
set_return:szBdb.set_returncCsL|dkrt��j}|��|r4|j|_||_|j}q|��t�|j�dS)znStart debugging from frame.

        If frame is not specified, debugging starts from caller's frame.
        N)	�sys�	_getframer5r$r,rVr"rW�settracer4rrr
�	set_traceAs
z
Bdb.set_tracecCsH|�|jdd�|jsDt�d�t��j}|rD||jk	rD|`|j}q*dS)z�Stop only at breakpoints or when finished.

        If there are no breakpoints, set the system trace function to None.
        Nr)r#r"rrZr\r[r5rVr4rrr
�set_continuePs

zBdb.set_continuecCs"|j|_d|_d|_t�d�dS)zuSet quitting attribute to True.

        Raises BdbQuit exception in the next call to a dispatch_*() method.
        NT)r"r7r=r'rZr\�rrrr
�set_quit_szBdb.set_quitFc
Csb|�|�}ddl}|�||�}|s.d||fS|j�|g�}||krN|�|�t|||||�}	dS)z�Set a new breakpoint for filename:lineno.

        If lineno doesn't exist for the filename, return an error message.
        The filename should be in canonical form.
        rNzLine %s:%d does not exist)rr �getliner�
setdefault�appendr)
rrrPrM�cond�funcnamer r%�listrQrrr
�	set_breakps

z
Bdb.set_breakcCs4||ftjkr|j|�|�|j|s0|j|=dS)aPrune breakpoints for filename:lineno.

        A list of breakpoints is maintained in the Bdb instance and in
        the Breakpoint class.  If a breakpoint in the Bdb instance no
        longer exists in the Breakpoint class, then it's removed from the
        Bdb instance.
        N)r�bplistr�remove�rrrPrrr
�
_prune_breaks�s
zBdb._prune_breakscCsj|�|�}||jkrd|S||j|kr6d||fStj||fdd�D]}|��qL|�||�dS)znDelete breakpoints for filename:lineno.

        If no breakpoints were set, return an error message.
        �There are no breakpoints in %szThere is no breakpoint at %s:%dN)rrrrh�deleteMerk)rrrPrQrrr
�clear_break�s


zBdb.clear_breakc
CsZz|�|�}Wn.tk
r<}zt|�WY�Sd}~XYnX|��|�|j|j�dS)zxDelete a breakpoint by its index in Breakpoint.bpbynumber.

        If arg is invalid, return an error message.
        N)�get_bpbynumber�
ValueErrorrOrmrk�filer%)rr0rQ�errrrr
�clear_bpbynumber�szBdb.clear_bpbynumbercCsX|�|�}||jkrd|S|j|D]$}tj||f}|D]}|��q<q&|j|=dS)z`Delete all breakpoints in filename.

        If none were set, return an error message.
        rlN)rrrrhrm)rrr%ZblistrQrrr
�clear_all_file_breaks�s

zBdb.clear_all_file_breakscCs,|js
dStjD]}|r|��qi|_dS)z]Delete all existing breakpoints.

        If none were set, return an error message.
        zThere are no breakpointsN)rr�
bpbynumberrm)rrQrrr
�clear_all_breaks�s

zBdb.clear_all_breakscCs�|std��zt|�}Wn"tk
r:td|�d�YnXztj|}Wn"tk
rltd|�d�YnX|dkr�td|��|S)z�Return a breakpoint by its index in Breakpoint.bybpnumber.

        For invalid arg values or if the breakpoint doesn't exist,
        raise a ValueError.
        zBreakpoint number expectedz Non-numeric breakpoint number %sNz!Breakpoint number %d out of rangezBreakpoint %d already deleted)rp�intrru�
IndexError)rr0rLrQrrr
ro�szBdb.get_bpbynumbercCs"|�|�}||jko ||j|kS)z9Return True if there is a breakpoint for filename:lineno.�rrrjrrr
�	get_break�s

�z
Bdb.get_breakcCs4|�|�}||jkr0||j|kr0tj||fp2gS)znReturn all breakpoints for filename:lineno.

        If no breakpoints are set, return an empty list.
        )rrrrhrjrrr
�
get_breaks�s

���zBdb.get_breakscCs&|�|�}||jkr|j|SgSdS)zrReturn all lines with breakpoints for filename.

        If no breakpoints are set, return an empty list.
        Nry)rrrrr
�get_file_breaks�s


zBdb.get_file_breakscCs|jS)z$Return all breakpoints that are set.)rr_rrr
�get_all_breaks�szBdb.get_all_breakscCs�g}|r|j|kr|j}|dk	rD|�||jf�||jkr<qD|j}q|��tdt|�d�}|dk	r�|�|j|j	f�|j}q^|dkr�tdt|�d�}||fS)z�Return a list of (frame, lineno) in a stack trace and a size.

        List starts with original calling frame, if there is one.
        Size may be number of frames above or below f.
        Nrr)
�tb_frame�tb_nextrcrHr"r5�reverse�max�len�	tb_lineno)r�f�t�stack�irrr
�	get_stack�s 
z
Bdb.get_stack�: cCs�ddl}ddl}|\}}|�|jj�}d||f}|jjrH||jj7}n|d7}|d7}d|jkr�|jd}	|d7}||�|	�7}|�|||j	�}
|
r�|||
�
�7}|S)a:Return a string with information about a stack entry.

        The stack entry frame_lineno is a (frame, lineno) tuple.  The
        return string contains the canonical filename, the function name
        or '<lambda>', the input arguments, the return value, and the
        line of code (if it exists).

        rNz%s(%r)z<lambda>z()Z
__return__z->)r �reprlibrr8rI�co_name�f_localsr.rarG�strip)rZframe_linenoZlprefixr r�r/rPr�s�rvr%rrr
�format_stack_entrys 	

zBdb.format_stack_entryc	Cs�|dkrddl}|j}|dkr"|}|��t|t�r@t|dd�}t�|j�z*zt
|||�Wntk
rrYnXW5d|_	t�d�XdS)z�Debug a statement executed via the exec() function.

        globals defaults to __main__.dict; locals defaults to globals.
        Nrz<string>�execT)�__main__�__dict__r$�
isinstancerO�compilerZr\r,r'r�r)r�cmd�globals�localsr�rrr
�run5s

zBdb.runc	Csz|dkrddl}|j}|dkr"|}|��t�|j�z,zt|||�WW�Stk
r^YnXW5d|_t�d�XdS)z�Debug an expression executed via the eval() function.

        globals defaults to __main__.dict; locals defaults to globals.
        NrT)	r�r�r$rZr\r,r'�evalr)r�exprr�r�r�rrr
�runevalKs
zBdb.runevalcCs|�|||�dS)z.For backwards-compatibility.  Defers to run().N)r�)rr�r�r�rrr
�runctx_sz
Bdb.runctxc	Os�t|�dkr|^}}}nV|s&td��nHd|krZ|�d�}|^}}ddl}|jdtdd�ntdt|�d	��|��t�|j	�d}z(z|||�}Wntk
r�YnXW5d
|_
t�d�X|S)zWDebug a single function call.

        Return the result of the function call.
        r@z6descriptor 'runcall' of 'Bdb' object needs an argument�funcrNz0Passing 'func' as keyword argument is deprecated)�
stacklevelz7runcall expected at least 1 positional argument, got %drT)r��	TypeError�pop�warnings�warn�DeprecationWarningr$rZr\r,r'r)�args�kwdsrr�r��resrrr
�runcallfs2

�
�
zBdb.runcallz($self, func, /, *args, **kwds))N)r)N)N)FNN)r�)NN)NN)/rr	r
rrrr$r,r(r)r*r+rFr1r2rNr6r;r3r>rBr#rUrWrXrYr]r^r`rgrkrnrsrtrvrorzr{r|r}r�r�r�r�r�r��__text_signature__rrrr
rs\
+	


�







cCst���dS)z<Start debugging with a Bdb instance from the caller's frame.N)rr]rrrr
r]�sr]c@sZeZdZdZdZiZdgZddd�Zdd�Zd	d
�Z	dd�Z
dd
d�Zdd�Zdd�Z
dS)ra�Breakpoint class.

    Implements temporary breakpoints, ignore counts, disabling and
    (re)-enabling, and conditionals.

    Breakpoints are indexed by number through bpbynumber and by
    the (file, line) tuple using bplist.  The former points to a
    single instance of class Breakpoint.  The latter points to a
    list of such instances since there may be more than one
    breakpoint per line.

    When creating a breakpoint, its associated filename should be
    in canonical form.  If funcname is defined, a breakpoint hit will be
    counted when the first line of that function is executed.  A
    conditional breakpoint always counts a hit.
    rNFcCs�||_d|_||_||_||_||_d|_d|_d|_t	j
|_t	j
d7_
|j�
|�||f|jkr||j||f�
|�n|g|j||f<dS)NTrr)re�func_first_executable_linerqr%rMrd�enabled�ignore�hitsr�nextrLrurcrh)rrqr%rMrdrerrr
r�szBreakpoint.__init__cCs>|j|jf}d|j|j<|j|�|�|j|s:|j|=dS)z�Delete the breakpoint from the list associated to a file:line.

        If it is the last breakpoint in that position, it also deletes
        the entry for the file:line.
        N)rqr%rurLrhri)r�indexrrr
rm�s

zBreakpoint.deleteMecCs
d|_dS)zMark the breakpoint as enabled.TN�r�r_rrr
�enable�szBreakpoint.enablecCs
d|_dS)z Mark the breakpoint as disabled.FNr�r_rrr
�disable�szBreakpoint.disablecCs"|dkrtj}t|��|d�dS)z�Print the output of bpformat().

        The optional out argument directs where the output is sent
        and defaults to standard output.
        N)rq)rZ�stdoutr-�bpformat)r�outrrr
�bpprint�szBreakpoint.bpprintcCs�|jrd}nd}|jr |d}n|d}d|j||j|jf}|jrT|d|jf7}|jrj|d|jf7}|jr�|jdkr�d	}nd
}|d|j|f7}|S)z�Return a string with information about the breakpoint.

        The information includes the breakpoint number, temporary
        status, file:line position, break condition, number of times to
        ignore, and number of times hit.

        zdel  zkeep zyes  zno   z%-4dbreakpoint   %s at %s:%dz
	stop only if %sz
	ignore next %d hitsrr��z"
	breakpoint already hit %d time%s)rMr�rLrqr%rdr�r�)rZdispZretZssrrr
r��s(
�
zBreakpoint.bpformatcCsd|j|j|jfS)z1Return a condensed description of the breakpoint.zbreakpoint %s at %s:%s)rLrqr%r_rrr
�__str__�szBreakpoint.__str__)FNN)N)rr	r
rr�rhrurrmr�r�r�r�r�rrrr
r�s


cCsN|js|j|jkrdSdS|jj|jkr,dS|js:|j|_|j|jkrJdSdS)aVReturn True if break should happen here.

    Whether a break should happen depends on the way that b (the breakpoint)
    was set.  If it was set via line number, check if b.line is the same as
    the one in the frame.  If it was set via function name, check if this is
    the right function and if it is on the first executable line.
    FT)rer%rHr8r�r�)�br/rrr
�
checkfuncnamesr�cCs�tj||f}|D]�}|jsqt||�s*q|jd7_|jsh|jdkrZ|jd8_qq�|dfSqzBt|j|j|j	�}|r�|jdkr�|jd8_n|dfWSWq|dfYSXqdS)aEDetermine which breakpoint for this file:line is to be acted upon.

    Called only if we know there is a breakpoint at this location.  Return
    the breakpoint that was triggered and a boolean that indicates if it is
    ok to delete a temporary breakpoint.  Return (None, None) if there is no
    matching breakpoint.
    rrTF)NN)
rrhr�r�r�rdr�r�rGr�)rqr%r/Z	possiblesr��valrrr
rK#s*


rKc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TdbcCs |jj}|sd}td||�dS)N�???z+++ call)r8r�r-)rr/r��namerrr
r;Tsz
Tdb.user_callcCsTddl}|jj}|sd}|�|jj�}|�||j|j�}td||j|d|�	��dS)Nrr�z+++�:)
r r8r�rrIrarHrGr-r�)rr/r r��fnr%rrr
r3Xsz
Tdb.user_linecCstd|�dS)Nz
+++ return�r-)rr/Zretvalrrr
r>_szTdb.user_returncCstd|�|��dS)Nz
+++ exception)r-r^)rr/Z	exc_stuffrrr
rBas
zTdb.user_exceptionN)rr	r
r;r3r>rBrrrr
r�Ssr�cCs&td|d�t|d�}td|�dS)Nzfoo(�)�
zbar returned)r-�bar)�n�xrrr
�fooesr�cCstd|d�|dS)Nzbar(r�r@r�)�arrr
r�jsr�cCst�}|�d�dS)Nzimport bdb; bdb.foo(10))r�r�)r�rrr
�testnsr�)rrDrZr�inspectrrr�__all__r:�	Exceptionrrr]rr�rKr�r�r�r�rrrr
�<module>s(
{t"0mimetypes.cpython-38.opt-2.pyc000064400000023442150335716500012162 0ustar00U

e5d�T�
@s�ddlZddlZddlZddlZzddlZWnek
rDdZYnXdddddddd	d
ddd
dg
Zdddddddddg	Z	da
daGdd�d�Zd%dd�Z
d&dd�Zd'dd�Zd(dd�Zd)dd	�Zdd
�Zd d!�Ze�d"d#�Zed$kr�e�dS)*�N�
knownfiles�inited�	MimeTypes�
guess_type�guess_all_extensions�guess_extension�add_type�init�read_mime_types�
suffix_map�
encodings_map�	types_map�common_typesz/etc/mime.typesz/etc/httpd/mime.typesz/etc/httpd/conf/mime.typesz/etc/apache/mime.typesz/etc/apache2/mime.typesz$/usr/local/etc/httpd/conf/mime.typesz"/usr/local/lib/netscape/mime.typesz/usr/local/etc/mime.typesFc@s\eZdZddd�Zddd�Zddd�Zdd	d
�Zddd�Zdd
d�Zddd�Z	ddd�Z
dS)r�TcCs�ts
t�t��|_t��|_iif|_iif|_t	�
�D]\}}|�||d�q:t�
�D]\}}|�||d�qZ|D]}|�
||�qvdS�NTF)rr	�_encodings_map_default�copyr�_suffix_map_defaultrr
�
types_map_inv�_types_map_default�itemsr�_common_types_default�read)�self�	filenames�strict�ext�type�namerr�!/usr/lib64/python3.8/mimetypes.py�__init__Bs



zMimeTypes.__init__cCs6||j||<|j|�|g�}||kr2|�|�dS�N)r
r�
setdefault�append)rrrrZextsrrrrPszMimeTypes.add_typecCsrt�|�}tj�|�\}}|dkr�|�d�}|dkr8dS|�dd|�}|dkr\|d|�}n|d|�}d|ksxd|kr|d}|dfSt�|�\}}||jkr�t�||j|�\}}q�||j	kr�|j	|}	t�|�\}}nd}	|j
d	}
||
kr�|
||	fS|��|
k�r|
|��|	fS|�r(d|	fS|j
d
}
||
k�rH|
||	fS|��|
k�rf|
|��|	fSd|	fSdS)N�data�,r)NN�;�=�/�
text/plainTF)�os�fspath�urllib�parseZ
_splittype�find�	posixpath�splitextrrr
�lower)r�urlrZschemeZcommaZsemir�baser�encodingr
rrrrasB







zMimeTypes.guess_typecCsL|��}|jd�|g�}|sH|jd�|g�D]}||kr0|�|�q0|Sr)r1r�getr#)rrr�
extensionsrrrrr�szMimeTypes.guess_all_extensionscCs|�||�}|sdS|dS)Nr)r)rrrr6rrrr�s
zMimeTypes.guess_extensionc	Cs(t|dd��}|�||�W5QRXdS)N�utf-8�r4)�open�readfp)r�filenamer�fprrrr�szMimeTypes.readc	Cs�|��}|sq�|��}tt|��D]"}||ddkr"||d�=qFq"|sLq|d|dd�}}|D]}|�|d||�qfqdS)Nr�#��.)�readline�split�range�lenr)	rr<r�lineZwords�ir�suffixesZsuffrrrr:�s	
zMimeTypes.readfpcCs�tsdSdd�}t�tjd���}||�D]�}zjt�||��T}|�d�sTW5QR�Wq(t�|d�\}}|tjkr|W5QR�Wq(|�|||�W5QRXWq(tk
r�Yq(Yq(Xq(W5QRXdS)NcssJd}zt�||�}Wntk
r,YqFYnXd|kr<|V|d7}qdS)Nr�r>)�_winregZEnumKey�OSError)ZmimedbrEZctyperrr�
enum_types�s
z3MimeTypes.read_windows_registry.<locals>.enum_types�r?zContent Type)rH�OpenKeyZHKEY_CLASSES_ROOT�
startswithZQueryValueExZREG_SZrrI)rrrJZhkcrZ
subkeynameZsubkeyZmimetypeZdatatyperrr�read_windows_registry�s$

�
zMimeTypes.read_windows_registryN)rT)T)T)T)T)T)T)T)�__name__�
__module__�__qualname__r rrrrrr:rNrrrrr:s


?



TcCstdkrt�t�||�Sr!)�_dbr	r)r2rrrrrscCstdkrt�t�||�Sr!)rRr	r�rrrrrr's
cCstdkrt�t�||�Sr!)rRr	rrSrrrr8scCstdkrt�t�|||�Sr!)rRr	r)rrrrrrrHscCs�da|dkstdkrBt�}tr&|��|dkr4t}qFtt|�}nt}|D]}tj�	|�rJ|�
|�qJ|ja|ja|j
da
|j
da|adSr)rrRrrHrNr�listr*�path�isfilerrrr
r)�files�db�filerrrr	Ys"

c
Cs`zt|dd�}Wntk
r&YdSX|�*t�}|�|d�|jdW5QR�SQRXdS)Nr7r8T)r9rIrr:r
)rY�frXrrrr
usc�CsXddddddd�aadddd	d
�aadddd
ddddddddddddddddddddddddddddddddddd d!d!d"d"d#d$d$d%d&d'd(d)d*d+d,d-d-d.d.d.d/d0d1d2d3d4d4d4d4d5d6d6d7d7d8d8d8d9d:d;d<d=d>d>d>d?d@dAdAdBdCdDdEdFdGdHdIdJdKdLdMdMdMdMdNdOdPdPdQdQdQdQdQdQdRdSdTdUdVdVdWdXdYdZdZdZdZdZd[d[d\d]d^d_��aad`dadadbdcdcdcddde�aadS)fNz.svg.gzz.tar.gzz.tar.bz2z.tar.xz)z.svgzz.tgzz.tazz.tzz.tbz2z.txzZgzip�compressZbzip2Zxz)z.gzz.Zz.bz2z.xzzapplication/javascriptzapplication/jsonzapplication/manifest+jsonzapplication/mswordzapplication/octet-streamzapplication/odazapplication/pdfzapplication/pkcs7-mimezapplication/postscriptzapplication/vnd.apple.mpegurlzapplication/vnd.ms-excelzapplication/vnd.ms-powerpointzapplication/wasmzapplication/x-bcpiozapplication/x-cpiozapplication/x-cshzapplication/x-dvizapplication/x-gtarzapplication/x-hdfzapplication/x-hdf5zapplication/x-latexzapplication/x-mifzapplication/x-netcdfzapplication/x-pkcs12zapplication/x-pn-realaudiozapplication/x-python-codezapplication/x-shzapplication/x-sharzapplication/x-shockwave-flashzapplication/x-sv4cpiozapplication/x-sv4crczapplication/x-tarzapplication/x-tclzapplication/x-texzapplication/x-texinfozapplication/x-troffzapplication/x-troff-manzapplication/x-troff-mezapplication/x-troff-mszapplication/x-ustarzapplication/x-wais-sourcezapplication/xmlzapplication/zipzaudio/basicz
audio/mpegzaudio/x-aiffzaudio/x-pn-realaudiozaudio/x-wavz	image/bmpz	image/gifz	image/iefz
image/jpegz	image/pngz
image/svg+xmlz
image/tiffzimage/vnd.microsoft.iconzimage/x-cmu-rasterzimage/x-ms-bmpzimage/x-portable-anymapzimage/x-portable-bitmapzimage/x-portable-graymapzimage/x-portable-pixmapzimage/x-rgbzimage/x-xbitmapzimage/x-xpixmapzimage/x-xwindowdumpzmessage/rfc822ztext/cssztext/csvz	text/htmlr)z
text/richtextztext/tab-separated-valuesz
text/x-pythonz
text/x-setextztext/x-sgmlztext/x-vcardztext/xmlz	video/mp4z
video/mpegzvideo/quicktimez
video/webmzvideo/x-msvideozvideo/x-sgi-movie)�z.jsz.mjsz.jsonz.webmanifestz.docz.dotz.wizz.binz.az.dllz.exez.oz.objz.soz.odaz.pdfz.p7cz.psz.aiz.epsz.m3uz.m3u8z.xlsz.xlbz.pptz.potz.ppaz.ppsz.pwzz.wasmz.bcpioz.cpioz.cshz.dviz.gtarz.hdfz.h5z.latexz.mifz.cdfz.ncz.p12z.pfxz.ramz.pycz.pyoz.shz.sharz.swfz.sv4cpioz.sv4crcz.tarz.tclz.texz.texiz.texinfoz.roffz.tz.trz.manz.mez.msz.ustarz.srcz.xslz.rdfz.wsdlz.xpdlz.zipz.auz.sndz.mp3z.mp2z.aifz.aifcz.aiffz.raz.wav�.bmpz.gifz.ief�.jpgz.jpez.jpegz.pngz.svgz.tiffz.tifz.icoz.rasr\z.pnmz.pbmz.pgmz.ppmz.rgbz.xbmz.xpmz.xwdz.emlz.mhtz.mhtmlz.nwsz.cssz.csvz.htmlz.htmz.txtz.batz.cz.hz.kshz.plz.rtxz.tsvz.pyz.etxz.sgmz.sgmlz.vcfz.xmlz.mp4z.mpegz.m1vz.mpaz.mpez.mpgz.movz.qtz.webmz.aviz.moviezapplication/rtfz
audio/midiz	image/jpgz
image/pictztext/xul)z.rtfz.midiz.midr]z.pictz.pctz.picz.xul)rrrrr
rrrrrrr�_default_mime_types�s8�

�
��

�r^c
sddl}d�d�fdd�	}z&|�tjdd�ddd	d
g�\}}Wn.|jk
rn}z|d|�W5d}~XYnXd}d}|D]4\}}|dkr�|d�q||dkr�d}q||d
kr|d}q||D]Z}	|r�t|	|�}
|
s�td|	�nt|
�q�t|	|�\}
}|
�std|	�q�td|
d|�q�dS)Nra4Usage: mimetypes.py [options] type

Options:
    --help / -h       -- print this message and exit
    --lenient / -l    -- additionally search of some common, but non-standard
                         types.
    --extension / -e  -- guess extension instead of type

More than one type argument may be given.
rKcs"t��|rt|�t�|�dSr!)�print�sys�exit)�code�msg�ZUSAGErr�usageFsz_main.<locals>.usager>Zhle�helpZlenient�	extension)z-hz--help)z-lz	--lenient)z-ez--extensionz I don't know anything about typeztype:z	encoding:)rK)�getoptr`�argv�errorrr_r)rhreZopts�argsrcrrg�opt�argZgtypeZguessr4rrdr�_main7s8�


rn�__main__)T)T)T)T)N)r*r`r/Zurllib.parser,�winregrH�ImportError�__all__rrrRrrrrrr	r
r^rnrOrrrr�<module>s^
��W




5.hmac.cpython-38.opt-2.pyc000064400000011423150335716500011052 0ustar00U

&�.e��@s�ddlZddlmZzddlZWnek
r<dZdZYnXe	ej
�ZddlZddlZddl
Z
edd�ed�D��Zedd�ed�D��ZdZGdd�d�Zd	d
�ZGdd�de
j�Ze��r�eZddd�Zdd�ZdS)�N)�_compare_digestccs|]}|dAVqdS)�\N���.0�xrr�/usr/lib64/python3.8/hmac.py�	<genexpr>sr	�ccs|]}|dAVqdS)�6Nrrrrrr	sc@sNeZdZdZddd�Zedd��Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)�HMAC�@N�csVt��rtd��t|ttf�s0tdt|�j���s<td��t	��rL�|_
n,t�t�rhd�fdd�	|_
nd�fdd�	|_
|�
�|_|�
�|_
|j
j|_t|j
d�r�|j
j}|d	kr�t�d
||jftd�|j}nt�d|jtd�|j}||_t|�|k�r|�
|���}|�|d
�}|j�|�t��|j
�|�t��|dk	�rR|�|�dS)Nz9This class is not available in FIPS mode. Use hmac.new().�,key: expected bytes or bytearray, but got %rz'Missing required parameter 'digestmod'.�cst��|�S�N��_hashlib�new��d��	digestmodrr�<lambda>?rzHMAC.__init__.<locals>.<lambda>cs
��|�Sr�rrrrrrAr�
block_size�z:block_size of %d seems too small; using our default of %d.�z<No block_size attribute on given digest object; Assuming %d.�)r)r)�_hashlibopenssl�
get_fips_mode�
ValueError�
isinstance�bytes�	bytearray�	TypeError�type�__name__�callable�digest_cons�str�outer�inner�digest_size�hasattrr�	_warnings�warn�	blocksize�RuntimeWarning�len�digest�ljust�update�	translate�trans_5C�trans_36)�self�key�msgrr1rrr�__init__#sR
�



����
z
HMAC.__init__cCsd|jjS)Nzhmac-)r,�name)r:rrrr>asz	HMAC.namecCs t��rtd��|j�|�dS)Nz'hmac.HMAC is not available in FIPS mode)rr r!r,r6)r:r<rrrr6eszHMAC.updatecCs:|j�|j�}|j|_|j|_|j��|_|j��|_|Sr)�	__class__�__new__r)r-r,�copyr+)r:�otherrrrrAksz	HMAC.copycCs|j��}|�|j���|Sr)r+rAr6r,r4�r:�hrrr�_currentxs
z
HMAC._currentcCs|��}|��Sr)rEr4rCrrrr4�szHMAC.digestcCs|��}|��Sr)rE�	hexdigestrCrrrrF�szHMAC.hexdigest)Nr)r'�
__module__�__qualname__r1r=�propertyr>r6rArEr4rFrrrrrs
>

	
rcCsHt|t�r|��St|�r"|d�}t|tj�s6td��|j���dd�S)Nrz6Only OpenSSL hashlib hashes are accepted in FIPS mode.�_�-)	r"r*�lowerr(rZHASHr%r>�replacerrrr�_get_openssl_name�s
�rNc@seZdZddd�ZdS)�HMAC_opensslNcCsLt|ttf�s tdt|�j��t|�}tjj	|||d�}|rH|�
|�|S)Nrr)r"r#r$r%r&r'rN�_hmacopensslrr@r6)�clsr;r<rr>�resultrrrr@�s
zHMAC_openssl.__new__)NN)r'rGrHr@rrrrrO�srOrcCst|||�Sr)r)r;r<rrrrr�srcs�tdk	r(t�t�r(�tkr(t�||��St��r6�}n(t�t�rPd�fdd�	}nd	�fdd�	}|�}|�}t|dd�}t|�|kr�||���}|d|t|�}|�	|�
t��|�	|�
t��|�	|�|�	|���|��S)
Nrcst��|�Srrr�r4rrr�rzdigest.<locals>.<lambda>cs
��|�SrrrrSrrr�rrr
r)r)r)
�_hashopensslr"r*�_openssl_md_methsZhmac_digestr(�getattrr3r4r6r7r9r8)r;r<r4r)r,r+r1rrSrr4�s,	��

r4)Nr)�warningsr/�	_operatorrZcompare_digestrrT�ImportErrorrU�	frozensetZopenssl_md_meth_namesZhashlibrrPr#�ranger8r9r-rrNrOr rr4rrrr�<module>s(

u
smtpd.cpython-38.opt-2.pyc000064400000056445150335716500011306 0ustar00U

e5d���@sZddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZm
Z
dddddgZejdZd	ZGd
d�d�Ze�adZd
ZdZd$dd�ZGdd�dej�ZGdd�dej�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�d�Zdd�Z e!dk�rVe �Z"e"j#Z#de#k�rle#�$d�Z%e&e#de%�e'�e(�dg�Z)e#e%dd�Z#nddl*Z)e+e)e#�Z,e,e"j-e"j.fe"j/e"j0fe"j1e"j2d�Z3e"j4�r2zddl5Z5Wn.e6k
�r�e7dej8d �e�9d�YnXe5�:d!�d"Z;ze�4e;�Wn.e<k
�r0e7d#ej8d �e�9d�YnXze�=�Wne>k
�rTYnXdS)%�N)�warn)�
get_addr_spec�get_angle_addr�SMTPChannel�
SMTPServer�DebuggingServer�	PureProxy�MailmanProxyzPython SMTP proxy version 0.3c@seZdZdd�Zdd�ZdS)�DevnullcCsdS�N���self�msgrr�/usr/lib64/python3.8/smtpd.py�writef�z
Devnull.writecCsdSrr�rrrr�flushgrz
Devnull.flushN)�__name__�
__module__�__qualname__rrrrrrr
esr
�
z, i�cCs4ttt�tjd�|r&t|tjd�t�|�dS)N��file)�print�__doc__�globals�sys�stderr�exit)�coderrrr�usagepsr#c@s�eZdZdZdZdZe�efdd��Ze	dd��Z
edd	d	fd
d�Zdd
�Z
dd�Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd ��Zejd!d ��Ze	d"d#��Zejd$d#��Ze	d%d&��Zejd'd&��Ze	d(d)��Zejd*d)��Ze	d+d,��Zejd-d,��Ze	d.d/��Zejd0d/��Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dS)Srr�icCs|Srr)�xrrr�<lambda>|rzSMTPChannel.<lambda>cCs0zt|j���WStk
r*|jYSXdSr)�max�command_size_limits�values�
ValueError�command_size_limitrrrr�max_command_size_limit~sz"SMTPChannel.max_command_size_limitNFc	
Cs&tjj|||d�||_||_||_||_||_||_|rF|rFt	d��|rdd|_
d|_d|_t
|_nd|_
d|_td�|_d	|_|��d|_d
|_|j��t��|_z|��|_WnBtk
r�}z$|��|jdtjkr�WY�dSd}~XYnXtdt |j�t!d
�|�"d|jt#f�dS)N��map�Fdecode_data and enable_SMTPUTF8 cannot be set to True at the same timer�
�.r�
�.�
FrzPeer:rz	220 %s %s)$�asynchat�
async_chat�__init__�smtp_server�conn�addr�data_size_limit�enable_SMTPUTF8�_decode_datar*�_emptystring�_linesep�_dotsep�NEWLINE�_newline�ord�_set_rset_state�
seen_greeting�
extended_smtpr(�clear�socketZgetfqdn�fqdnZgetpeername�peer�OSError�close�args�errnoZENOTCONNr�repr�DEBUGSTREAM�push�__version__)	rZserverr9r:r;r.r<�decode_data�errrrrr7�s@


zSMTPChannel.__init__cCs.|j|_d|_g|_d|_d|_|�d�dS)NFrr2)�COMMAND�
smtp_state�mailfrom�rcpttos�require_SMTPUTF8�	num_bytes�set_terminatorrrrr�_set_post_data_state�sz SMTPChannel._set_post_data_statecCs|��d|_g|_dS�Nr)r\�
received_data�received_linesrrrrrD�szSMTPChannel._set_rset_statecCstdtd�|jS)NzTAccess to __server attribute on SMTPChannel is deprecated, use 'smtp_server' instead��r�DeprecationWarningr8rrrr�__server�s
�zSMTPChannel.__servercCstdtd�||_dS)NzRSetting __server attribute on SMTPChannel is deprecated, set 'smtp_server' insteadr`ra�r�valuerrrrc�s
�cCstdtd�|jS)NzUAccess to __line attribute on SMTPChannel is deprecated, use 'received_lines' insteadr`�rrbr_rrrr�__line�s
�zSMTPChannel.__linecCstdtd�||_dS)NzSSetting __line attribute on SMTPChannel is deprecated, set 'received_lines' insteadr`rfrdrrrrg�s
�cCstdtd�|jS)NzRAccess to __state attribute on SMTPChannel is deprecated, use 'smtp_state' insteadr`�rrbrVrrrr�__state�s
�zSMTPChannel.__statecCstdtd�||_dS)NzPSetting __state attribute on SMTPChannel is deprecated, set 'smtp_state' insteadr`rhrdrrrri�s
�cCstdtd�|jS)NzXAccess to __greeting attribute on SMTPChannel is deprecated, use 'seen_greeting' insteadr`�rrbrErrrr�
__greeting�s
�zSMTPChannel.__greetingcCstdtd�||_dS)NzVSetting __greeting attribute on SMTPChannel is deprecated, set 'seen_greeting' insteadr`rjrdrrrrk�s
�cCstdtd�|jS)NzSAccess to __mailfrom attribute on SMTPChannel is deprecated, use 'mailfrom' insteadr`�rrbrWrrrr�
__mailfrom�s
�zSMTPChannel.__mailfromcCstdtd�||_dS)NzQSetting __mailfrom attribute on SMTPChannel is deprecated, set 'mailfrom' insteadr`rlrdrrrrm�s
�cCstdtd�|jS)NzQAccess to __rcpttos attribute on SMTPChannel is deprecated, use 'rcpttos' insteadr`�rrbrXrrrr�	__rcpttos�s
�zSMTPChannel.__rcpttoscCstdtd�||_dS)NzOSetting __rcpttos attribute on SMTPChannel is deprecated, set 'rcpttos' insteadr`rnrdrrrro�s
�cCstdtd�|jS)NzTAccess to __data attribute on SMTPChannel is deprecated, use 'received_data' insteadr`�rrbr^rrrr�__data�s
�zSMTPChannel.__datacCstdtd�||_dS)NzRSetting __data attribute on SMTPChannel is deprecated, set 'received_data' insteadr`rprdrrrrqs
�cCstdtd�|jS)NzKAccess to __fqdn attribute on SMTPChannel is deprecated, use 'fqdn' insteadr`�rrbrIrrrr�__fqdn
s
�zSMTPChannel.__fqdncCstdtd�||_dS)NzISetting __fqdn attribute on SMTPChannel is deprecated, set 'fqdn' insteadr`rrrdrrrrss
�cCstdtd�|jS)NzKAccess to __peer attribute on SMTPChannel is deprecated, use 'peer' insteadr`�rrbrJrrrr�__peers
�zSMTPChannel.__peercCstdtd�||_dS)NzISetting __peer attribute on SMTPChannel is deprecated, set 'peer' insteadr`rtrdrrrrus
�cCstdtd�|jS)NzKAccess to __conn attribute on SMTPChannel is deprecated, use 'conn' insteadr`�rrbr9rrrr�__conn s
�zSMTPChannel.__conncCstdtd�||_dS)NzISetting __conn attribute on SMTPChannel is deprecated, set 'conn' insteadr`rvrdrrrrw%s
�cCstdtd�|jS)NzKAccess to __addr attribute on SMTPChannel is deprecated, use 'addr' insteadr`�rrbr:rrrr�__addr+s
�zSMTPChannel.__addrcCstdtd�||_dS)NzISetting __addr attribute on SMTPChannel is deprecated, set 'addr' insteadr`rxrdrrrry0s
�cCs&tj�|t|d|jrdnd��dS)Nr0�utf-8�ascii)r5r6rQ�bytesrYr
rrrrQ7s
�zSMTPChannel.pushcCs|d}|j|jkr|j}n|j|jkr*|j}|r<|j|kr<dS|rR|jt|�7_|jrl|j�	t
|d��n|j�	|�dS)Nrz)rVrUr,�DATAr;rZ�lenr=r_�append�str)r�data�limitrrr�collect_incoming_data<sz!SMTPChannel.collect_incoming_datac
Cs|j�|j�}tdt|�td�g|_|j|jk�r|jd}|_|sT|�	d�dS|j
sdt|d�}|�d�}|dkr�|�
�}d}n$|d|��
�}||dd���}|jr�|j|n|j}||kr�|�	d�dSt|d	|d�}|s�|�	d
|�dS||�dS|j|jk�r(|�	d�d|_dS|j�rR|j|jk�rR|�	d�d|_dSg}|�|j�D]:}	|	�r�|	d|jk�r�|�|	dd��n
|�|	��qb|j�|�|_|j|j|j|jf}
i}|j
�s�|j|jd
�}|j j!|
|�}|�"�|�s|�	d�n
|�	|�dS)NzData:rrz500 Error: bad syntaxrz� r$z500 Error: line too longZsmtp_z&500 Error: command "%s" not recognizedz451 Internal confusionz552 Error: Too much mail data)�mail_options�rcpt_options�250 OK)#r>�joinr_rrOrPrVrUrZrQr=r��find�upper�striprFr(r+�getattrr}r;�splitr?r@rrBr^rJrWrXr�r�r8�process_messager\)
r�lineZsz�i�command�argZmax_sz�methodr��textrM�kwargsZstatusrrr�found_terminatorLsl


��


�zSMTPChannel.found_terminatorcCsH|s|�d�dS|jr&|�d�dS|��||_|�d|j�dS)Nz501 Syntax: HELO hostname�503 Duplicate HELO/EHLOz250 %s)rQrErDrI�rr�rrr�	smtp_HELO�s

zSMTPChannel.smtp_HELOcCs�|s|�d�dS|jr&|�d�dS|��||_d|_|�d|j�|jrr|�d|j�|jdd7<|js�|�d�|jr�|�d	�|jdd
7<|�d�dS)Nz501 Syntax: EHLO hostnamer�Tz250-%sz250-SIZE %s�MAIL�z250-8BITMIMEz250-SMTPUTF8�
z250 HELP)	rQrErDrFrIr;r(r=r<r�rrr�	smtp_EHLO�s&



zSMTPChannel.smtp_EHLOcCs|r|�d�n
|�d�dS)Nz501 Syntax: NOOPr��rQr�rrr�	smtp_NOOP�szSMTPChannel.smtp_NOOPcCs|�d�|��dS)Nz221 Bye)rQZclose_when_doner�rrr�	smtp_QUIT�s
zSMTPChannel.smtp_QUITcCs0t|�}|d|���|kr,||d���SdSr])r~r�r�)r�keywordr�Zkeylenrrr�_strip_command_keyword�sz"SMTPChannel._strip_command_keywordcCsF|sdS|���d�r$t|�\}}nt|�\}}|s<||fS|j|fS)N)rr�<)�lstrip�
startswithrrZ	addr_spec)rr��address�restrrr�_getaddr�szSMTPChannel._getaddrcCsHi}|D]:}|�d�\}}}|��r,|r2|s2dS|r:|nd||<q|S)N�=T)�	partition�isalnum)r�params�resultZparam�eqrerrr�
_getparams�szSMTPChannel._getparamscCs|r�d}|��}|dkr$|�d�q�|dkr8|�d�q�|dkr^d}|jrR||7}|�|�q�|dkr�d	}|jrx||7}|�|�q�|d
kr�|�d�q�|dkr�|�d
�q�|dkr�|�d�q�|dkr�|�d�q�|dkr�|�d�q�|�d�n
|�d�dS)N� [SP <mail-parameters>]ZEHLOz250 Syntax: EHLO hostnameZHELOz250 Syntax: HELO hostnamer�z 250 Syntax: MAIL FROM: <address>ZRCPTz250 Syntax: RCPT TO: <address>r}z250 Syntax: DATAZRSETz250 Syntax: RSETZNOOPz250 Syntax: NOOPZQUITz250 Syntax: QUITZVRFYz250 Syntax: VRFY <address>zD501 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFYzD250 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFY)r�rQrF)rr�ZextendedZlc_argrrrr�	smtp_HELP�s:zSMTPChannel.smtp_HELPcCs@|r2|�|�\}}|r"|�d�q<|�d|�n
|�d�dS)NzB252 Cannot VRFY user, but will accept message and attempt deliveryz502 Could not VRFY %sz501 Syntax: VRFY <address>)r�rQ)rr�r�r�rrr�	smtp_VRFY�szSMTPChannel.smtp_VRFYcCs�|js|�d�dStd|td�d}|jr4|d7}|dkrJ|�|�dS|�d|�}|�|�\}}|sv|�|�dS|js�|r�|�|�dS|jr�|�d�dS|���	�|_
|�|j
�}|dkr�|�|�dS|js�|�
dd	�}|d
kr�|�d�dS|j�r8|�
dd
�}|dk�r d|_n|d
k	�r8|�d�dS|�
dd�}|�r�|���sb|�|�dS|j�r�t|�|jk�r�|�d�dSt|���dk�r�|�d�dS||_td|jtd�|�d�dS)N�503 Error: send HELO firstz	===> MAILrz 501 Syntax: MAIL FROM: <address>r�zFROM:z503 Error: nested MAIL commandZBODY�7BIT)r�Z8BITMIMEz1501 Error: BODY can only be one of 7BIT, 8BITMIMEZSMTPUTF8FTz&501 Error: SMTPUTF8 takes no argumentsZSIZEz:552 Error: message size exceeds fixed maximum message sizerz:555 MAIL FROM parameters not recognized or not implementedzsender:r�)rErQrrPrFr�r�rWr�r�r�r�r=�popr<rY�isdigitr;�intr~�keys)rr��	syntaxerrr�r�Zbody�smtputf8�sizerrr�	smtp_MAILsh














zSMTPChannel.smtp_MAILcCs|js|�d�dStd|td�|js6|�d�dSd}|jrH|d7}|dkr^|�|�dS|�d|�}|�|�\}}|s�|�|�dS|js�|r�|�|�dS|���	�|_
|�|j
�}|dkr�|�|�dSt|�
��dkr�|�d	�dS|j�|�td
|jtd�|�d�dS)Nr�z	===> RCPTrz503 Error: need MAIL commandz501 Syntax: RCPT TO: <address>r�zTO:rz8555 RCPT TO parameters not recognized or not implementedzrecips:r�)rErQrrPrWrFr�r�r�r�r�r�r~r�rXr)rr�r�r�r�rrr�	smtp_RCPT7s@







zSMTPChannel.smtp_RCPTcCs(|r|�d�dS|��|�d�dS)Nz501 Syntax: RSETr�)rQrDr�rrr�	smtp_RSETZs

zSMTPChannel.smtp_RSETcCsZ|js|�d�dS|js(|�d�dS|r:|�d�dS|j|_|�d�|�d�dS)Nr�z503 Error: need RCPT commandz501 Syntax: DATAs
.
z#354 End data with <CR><LF>.<CR><LF>)rErQrXr}rVr[r�rrr�	smtp_DATAas



zSMTPChannel.smtp_DATAcCs|�d�dS)Nz502 EXPN not implementedr�r�rrr�	smtp_EXPNpszSMTPChannel.smtp_EXPN),rrrrUr}r+�collections�defaultdictr(�propertyr,�DATA_SIZE_DEFAULTr7r\rDZ_SMTPChannel__server�setterZ_SMTPChannel__lineZ_SMTPChannel__stateZ_SMTPChannel__greetingZ_SMTPChannel__mailfromZ_SMTPChannel__rcpttosZ_SMTPChannel__dataZ_SMTPChannel__fqdnZ_SMTPChannel__peerZ_SMTPChannel__connZ_SMTPChannel__addrrQr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrws�
�
'	





















>#6#c@s2eZdZeZedddfdd�Zdd�Zdd�ZdS)	rNFcCs�||_||_||_||_||_|r.|r.td��tjj||d�zNt	j
|dt	ji�}|�|dd|dd�|�
�|�|�|�d�Wn|���Yn(Xtd|jjt�t���||ftd�dS)	Nr/r-�typerr$�z0%s started at %s
	Local addr: %s
	Remote addr:%sr)Z
_localaddr�_remoteaddrr;r<r=r*�asyncore�
dispatcherr7rHZgetaddrinfoZSOCK_STREAMZ
create_socketZset_reuse_addrZbindZlistenrLr�	__class__r�time�ctimerP)rZ	localaddrZ
remoteaddrr;r.r<rSZgai_resultsrrrr7xs6�
��zSMTPServer.__init__c	Cs6tdt|�td�|�||||j|j|j|j�}dS)NzIncoming connection from %sr)rrOrP�
channel_classr;�_mapr<r=)rr9r:Zchannelrrr�handle_accepted�s�zSMTPServer.handle_acceptedcKst�dSr)�NotImplementedError�rrJrWrXr�r�rrrr��szSMTPServer.process_message)	rrrrr�r�r7r�r�rrrrrts�
c@seZdZdd�Zdd�ZdS)rcCsld}|��}|D]V}|rL|sLd|d}t|t�s@t|�d��}t|�d}t|t�s^t|�}t|�qdS)Nr$zX-Peer: rrz)�
splitlines�
isinstancer�rO�encoder)rrJr�Z	inheaders�linesr�Z
peerheaderrrr�_print_message_content�s

z&DebuggingServer._print_message_contentcKsXtd�|r@|�d�r&td|d�|�d�r@td|d�|�||�td�dS)Nz%---------- MESSAGE FOLLOWS ----------r�zmail options: %sr�zrcpt options: %s
z%------------ END MESSAGE ------------)r�getr�r�rrrr��s

zDebuggingServer.process_messageN)rrrr�r�rrrrr�scs,eZdZ�fdd�Zdd�Zdd�Z�ZS)rcs.d|kr|drtd��tt|�j||�dS)Nr<z$PureProxy does not support SMTPUTF8.�r*�superrr7�rrMr��r�rrr7�szPureProxy.__init__c	Csf|�d�}d}|D]}|sq(|d7}q|�|d|d�t�|�}|�|||�}td|td�dS)Nrrr$z
X-Peer: %szwe got some refusals:r)r��insertrAr��_deliverrrP)	rrJrWrXr�r�r�r��refusedrrrr��s


zPureProxy.process_messagec
Cs�ddl}i}zB|��}|�|jd|jd�z|�|||�}W5|��XWn�|jk
r�}ztdtd�|j	}W5d}~XYnft
|jfk
r�}zBtd|jtd�t
|dd�}t
|dd	�}	|D]}
||	f||
<q�W5d}~XYnX|S)
Nrr$zgot SMTPRecipientsRefusedrZgotZ	smtp_code���Z
smtp_error�ignore)�smtplibZSMTPZconnectr��quitZsendmailZSMTPRecipientsRefusedrrPZ
recipientsrKZ
SMTPExceptionr�r�)rrWrXr�r�r��s�eZerrcode�errmsg�rrrrr��s$ zPureProxy._deliver)rrrr7r�r��
__classcell__rrr�rr�scs$eZdZ�fdd�Zdd�Z�ZS)r	cs.d|kr|drtd��tt|�j||�dS)Nr<z'MailmanProxy does not support SMTPUTF8.r�r�r�rrr7
szMailmanProxy.__init__cCs*ddlm}ddlm}ddlm}ddlm}g}	|D]t}
|
���d�d}|�d�}t|�dkrfq8|d}
t|�dkr�|d	}nd
}|�	|
�r8|dkr�q8|	�
|
|
|f�q8|	D]\}
}
}|�|
�q�tdd
�
|�td�|r�|�|||�}td|td�i}||�}|�|�}|�d��s&||d<|�d��sDt�t���|d<|	D]�\}
}
}td|
td�|�|
�}|�s�|j|
dd�}|||
<|d
k�r�|j|d	d�n�|dk�r�|j|d	d�nh|dk�r�|j|d	d�nN|dk�r�|j|d	d�n4|dk�rH|dk�rd|d <nd!|d <|j|d	d��qHdS)"Nr)�StringIO)�Utils)�Message)�MailList�@�-r`r$r)r�admin�owner�requestr��leavezforwarding recips:r�rzwe got refusals:�fromZFrom�dateZDatezsending message to)�lock)�tolistr�)Ztoadminr�)Ztoownerr�)Z	torequest)r�r�r�Z	subscribeZSubjectZunsubscribe)�ior�ZMailmanr�r�r��lowerr�r~Zlist_existsr�removerr�rPr�r�r�r�ZEnqueue)rrJrWrXr�r�r�r�r�Z	listnamesZrcptZlocal�partsZlistnamer�r�Zmlistsr�rZmlistrrrr�sb










zMailmanProxy.process_message)rrrr7r�r�rrr�rr	sc@seZdZdZdZdZdZdS)�OptionsTrNF)rrr�setuid�	classname�
size_limitr<rrrrr�_sr�c
Cspz.t�tjdd�dddddddd	g�\}}Wn.tjk
r\}ztd|�W5d}~XYnXt�}|D]�\}}|d
kr�td�qh|dkr�tt�t�d�qh|d
kr�d|_	qh|dkr�||_
qh|dkr�tjaqh|dkr�d|_
qh|dkrhzt|�}||_Wqhtd|tjd�t�d�YqhXqht|�dk�r<d}d}nPt|�dk�rX|d}d}n4t|�dk�rx|d}|d}ntddt�|��|�d�}	|	dk�r�tdd|�|d|	�|_zt||	dd��|_Wn$tk
�r�tdd|�YnX|�d�}	|	dk�rtdd|�|d|	�|_zt||	dd��|_Wn$tk
�rjtdd|�YnX|S) Nr$z	nVhc:s:duzclass=Znosetuid�version�helpzsize=�debugr�)z-hz--helpr)z-Vz	--version)z-nz
--nosetuidF)z-cz--class)z-dz--debug)z-uz
--smtputf8T)z-sz--sizezInvalid size: rzlocalhost:8025zlocalhost:25r`�zInvalid arguments: %s�:zBad local spec: %szBad local port: %szBad remote spec: %szBad remote port: %s)�getoptr�argv�errorr#r�rrRr!r�r�r rPr<r�r�r~�
COMMASPACEr�r��	localhost�	localportr*�
remotehost�
remoteport)
ZoptsrMr��options�optr�Zint_sizeZ	localspecZ
remotespecr�rrr�	parseargsfsv��






r�__main__r1r$)r<z7Cannot import module "pwd"; try running with -n option.r�nobodyr`z3Cannot setuid "nobody"; try running with -n option.)r)?r�osrNrr�rHr�r5r��warningsrZemail._header_value_parserrr�__all__rZprogramrRr
rPrArr�r#r6rr�rrrr	r�rrrr��rfindZlastdot�
__import__r�locals�modrr�Zclass_rr	r
rr�r<�proxyr��pwd�ImportErrorrr r!�getpwnamr�PermissionErrorZloop�KeyboardInterruptrrrr�<module>Ps��

M-SB




�traceback.cpython-38.opt-2.pyc000064400000025435150335716500012071 0ustar00U

e5d;\�@s6ddlZddlZddlZddlZdddddddd	d
ddd
dddddddgZd2dd�Zdd�Zd3dd�Zd4dd�Zd5dd�Z	dZ
dZd6dd�Zd7dd�Z
d d�Zd!d"�Zd#d$�Zd8d%d	�Zd9d&d
�Zd:d'd�Zd;d(d
�Zd<d)d�Zd=d*d�Zd+d�ZGd,d�d�Zd-d�Zd.d�Zd/ZGd0d�de�ZGd1d�d�ZdS)>�N�
extract_stack�
extract_tb�format_exception�format_exception_only�format_list�format_stack�	format_tb�	print_exc�
format_exc�print_exception�
print_last�print_stack�print_tb�clear_frames�FrameSummary�StackSummary�TracebackException�
walk_stack�walk_tbcCs4|dkrtj}t�|���D]}t||dd�qdS)N���file�end)�sys�stderrr�	from_list�format�print)�extracted_listr�item�r �!/usr/lib64/python3.8/traceback.py�
print_listsr"cCst�|���S�N)rrr)rr r r!rscCstt||d�|d�dS�N��limit)r)r"r)�tbr&rr r r!r-scCst||d���S�Nr%)rr�r'r&r r r!r7scCstjt|�|d�Sr()r�extractrr)r r r!r;s
zG
The above exception was the direct cause of the following exception:

zF
During handling of the above exception, another exception occurred:

TcCsB|dkrtj}tt|�|||d�j|d�D]}t||dd�q*dS)Nr%��chainrr)rrr�typerr)�etype�valuer'r&rr,�liner r r!rWs��
cCs ttt|�|||d�j|d��S)Nr%r+)�listrr-r)r.r/r'r&r,r r r!rls��cCstt||d����Sr#)r1rr)r.r/r r r!r|scCs.t|�}|dks|sd|}nd||f}|S)Nz%s
z%s: %s
)�	_some_str)r.r/�valuestrr0r r r!�_format_final_exc_line�s

r4cCs*z
t|�WSdt|�jYSXdS)Nz<unprintable %s object>)�strr-�__name__)r/r r r!r2�s
r2cCstt��|||d��dS)N�r&rr,)rr�exc_infor7r r r!r	�scCsd�tt��||d���S)Nr�r&r,)�joinrrr8r9r r r!r
�scCs.ttd�std��ttjtjtj|||�dS)N�	last_typezno last exception)�hasattrr�
ValueErrorrr;�
last_value�last_tracebackr7r r r!r�s
�cCs*|dkrt��j}tt||d�|d�dSr$)r�	_getframe�f_backr"r)�fr&rr r r!r
�s
cCs"|dkrt��j}tt||d��Sr()rr@rArr)rBr&r r r!r�s
cCs0|dkrt��j}tjt|�|d�}|��|Sr()rr@rArr*r�reverse)rBr&�stackr r r!r�s
	
cCs8|dk	r4z|j��Wntk
r*YnX|j}qdSr#)�tb_frame�clear�RuntimeError�tb_next�r'r r r!r�sc@sVeZdZdZdddd�dd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	e
dd��ZdS)r)�filename�lineno�name�_line�localsTN)�lookup_linerNr0cCsB||_||_||_||_|r"|j|r8dd�|��D�nd|_dS)NcSsi|]\}}|t|��qSr )�repr)�.0�k�vr r r!�
<dictcomp>sz)FrameSummary.__init__.<locals>.<dictcomp>)rJrKrLrMr0�itemsrN)�selfrJrKrLrOrNr0r r r!�__init__�szFrameSummary.__init__cCs`t|t�r:|j|jko8|j|jko8|j|jko8|j|jkSt|t�r\|j|j|j|jf|kStSr#)	�
isinstancerrJrKrLrN�tupler0�NotImplemented�rV�otherr r r!�__eq__s

�
�
�
zFrameSummary.__eq__cCs|j|j|j|jf|Sr#)rJrKrLr0)rV�posr r r!�__getitem__szFrameSummary.__getitem__cCst|j|j|j|jg�Sr#)�iterrJrKrLr0�rVr r r!�__iter__szFrameSummary.__iter__cCsdj|j|j|jd�S)Nz7<FrameSummary file {filename}, line {lineno} in {name}>)rJrKrL)rrJrKrLrar r r!�__repr__s
�zFrameSummary.__repr__cCsdS)N�r rar r r!�__len__szFrameSummary.__len__cCs&|jdkr t�|j|j���|_|jSr#)rM�	linecache�getlinerJrK�striprar r r!r0s
zFrameSummary.line)r6�
__module__�__qualname__�	__slots__rWr]r_rbrcre�propertyr0r r r r!r�s�
ccs4|dkrt��jj}|dk	r0||jfV|j}qdSr#)rr@rA�f_lineno)rBr r r!r$s
ccs"|dk	r|j|jfV|j}qdSr#)rE�	tb_linenorHrIr r r!r1s�c@s6eZdZedddd�dd��Zedd��Zd	d
�ZdS)rNTF�r&�lookup_lines�capture_localsc

Cs�|dkr(ttdd�}|dk	r(|dkr(d}|dk	rV|dkrFt�||�}ntj||d�}|�}t�}|D]Z\}}|j}	|	j}
|	j	}|�
|
�t�|
|j
�|r�|j}nd}|�t|
||d|d��qf|D]}
t�|
�q�|r�|D]
}|jq�|S)N�tracebacklimitr)�maxlenF)rOrN)�getattrr�	itertools�islice�collections�deque�set�f_code�co_filename�co_name�addrf�	lazycache�	f_globals�f_locals�appendr�
checkcacher0)
�klass�	frame_genr&rqrr�result�fnamesrBrK�corJrLr�r r r!r*As@
�
zStackSummary.extractc	CsLt�}|D]<}t|t�r$|�|�q
|\}}}}|�t||||d��q
|S)N)r0)rrXrr�)r��a_listr��framerJrKrLr0r r r!rqs

zStackSummary.from_listc
Csng}d}d}d}d}|D�]}|dksT||jksT|dksT||jksT|dksT||jkr�|tkr�|t8}|�d|�d|dkr|dnd�d��|j}|j}|j}d}|d7}|tkr�qg}|�d�|j|j|j��|jr�|�d	�|j����|j�r t	|j�
��D]\}}	|�d
j||	d���q|�d�|��q|tk�rj|t8}|�d|�d|dk�r^dnd�d��|S)Nrz  [Previous line repeated z
 more time��srz]
z  File "{}", line {}, in {}
�    {}
z    {name} = {value}
)rLr/)rJrKrL�_RECURSIVE_CUTOFFr�rr0rhrN�sortedrUr:)
rVr��	last_file�	last_line�	last_name�countr��rowrLr/r r r!r�sZ
������
�zStackSummary.format)r6rirj�classmethodr*rrr r r r!r>s�/
c@sZeZdZddddd�dd�Zedd��Zd	d
�Zdd�Zd
d�Zdd�Z	dd�dd�Z
dS)rNTF�r&rqrr�_seenc	CsJ|dkrt�}|�t|��|r\|jdk	r\t|j�|kr\tt|j�|j|jj|d||d�}nd}|r�|jdk	r�t|j�|kr�tt|j�|j|jj|d||d�}	nd}	||_|	|_|r�|jnd|_t	j
t|�|||d�|_||_
t|�|_|�r8t|t��r8|j|_|j}
|
dk	�rt|
�nd|_|j|_|j|_|j|_|�rF|��dS)NFr�rp)rzr~�id�	__cause__rr-�
__traceback__�__context__�__suppress_context__rr*rrD�exc_typer2�_str�
issubclass�SyntaxErrorrJrKr5�text�offset�msg�_load_lines)rVr��	exc_value�
exc_tracebackr&rqrrr��cause�context�lnor r r!rW�sd��	��	��
zTracebackException.__init__cOs|t|�||jf|�|�Sr#)r-r�)�cls�exc�args�kwargsr r r!�from_exceptionsz!TracebackException.from_exceptioncCs6|jD]
}|jq|jr"|j��|jr2|j��dSr#)rDr0r�r�r�)rVr�r r r!r�s

zTracebackException._load_linescCs|j|jkSr#)�__dict__r[r r r!r]szTracebackException.__eq__cCs|jSr#)r�rar r r!�__str__szTracebackException.__str__ccs6|jdkrtd|j�VdS|jj}|jj}|dkr@|d|}t|jt�s^t||j�VdSd}|jdk	r�d�|j	pxd|j�Vn|j	dk	r�d�|j	�}|j
}|j}|dk	�rd�|���V|dk	�r|�
d�}tt|�|�d	}|d|���}d
d�|D�}d�d�|��V|j�p d
}d�|||�VdS)N)�__main__�builtins�.rz  File "{}", line {}
z<string>z ({})r��
r�css|]}|��r|pdVqdS)� N)�isspace)rQ�cr r r!�	<genexpr>Msz;TracebackException.format_exception_only.<locals>.<genexpr>z    {}^
z<no detail available>z	{}: {}{}
)r�r4r�rjrir�r�rKrrJr�r�rh�rstrip�min�len�lstripr:r�)rV�stype�smod�filename_suffix�badliner��
caretspacer�r r r!r"s<

�



z(TracebackException.format_exception_onlyr+ccs�|rT|jdk	r*|jj|d�EdHtVn*|jdk	rT|jsT|jj|d�EdHtV|jrpdV|j��EdH|��EdHdS)Nr+z#Traceback (most recent call last):
)r�r�_cause_messager�r��_context_messagerDr)rVr,r r r!rRs

�zTracebackException.format)r6rirjrWr�r�r�r]r�rrr r r r!r�s�:
	0)N)NN)N)N)NNT)NT)NNT)NT)NNT)NNN)NN)NN)rxrvrfr�__all__r"rrrrr�r�rrrr4r2r	r
rr
rrrrrrr�r1rrr r r r!�<module>s`�




��







A
ztoken.cpython-38.opt-1.pyc000064400000004667150335716500011275 0ustar00U

e5d@	�0@s�dZddddgZdZdZdZdZd	Zd
ZdZdZ	d
Z
dZdZdZ
dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Zd"Zd#Z d$Z!d%Z"d&Z#d'Z$d(Z%d)Z&d*Z'd+Z(d,Z)d-Z*d.Z+d/Z,d0Z-d1Z.d2Z/d3Z0d4Z1d5Z2d6Z3d7Z4d8Z5d9Z6d:Z7d;Z8d<Z9d=Z:d>Z;d?Z<d@Z=dAZ>dBZ?dCZ@dDZAdEZBdFdG�eC��D�D�ZEe�FeE�G��eee*ee+e	e
ee%e0e(ee&eee'e5ee6ee1e2e)e
e7eee#e.eeeee e$e/e3e4eee"e-eee,ee!dH�/ZHdId�ZIdJd�ZJdKd�ZKdLS)MzToken constants.�tok_name�
ISTERMINAL�
ISNONTERMINAL�ISEOF����������	�
���
������������������� �!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�0�1�2�3�4�5�6�7�8�9�:�;�<�=�>�?�cCs*i|]"\}}t|t�r|�d�s||�qS)�_)�
isinstance�int�
startswith)�.0�name�value�rM�/usr/lib64/python3.8/token.py�
<dictcomp>Js


�rO)/z!=�%z%=�&z&=�(�)�*z**z**=z*=�+z+=�,�-z-=z->�.z...�/z//z//=z/=�:z:=�;�<z<<z<<=z<=�=z==�>z>=z>>z>>=�@z@=�[�]�^z^=�{�|z|=�}�~cCs|tkS�N��	NT_OFFSET��xrMrMrNr�scCs|tkSrgrhrjrMrMrNr�scCs|tkSrg)�	ENDMARKERrjrMrMrNr�sN)L�__doc__�__all__rl�NAME�NUMBER�STRING�NEWLINE�INDENT�DEDENT�LPAR�RPAR�LSQB�RSQB�COLON�COMMA�SEMI�PLUS�MINUS�STAR�SLASH�VBAR�AMPER�LESS�GREATER�EQUAL�DOT�PERCENT�LBRACE�RBRACE�EQEQUAL�NOTEQUAL�	LESSEQUAL�GREATEREQUAL�TILDE�
CIRCUMFLEX�	LEFTSHIFT�
RIGHTSHIFT�
DOUBLESTAR�	PLUSEQUAL�MINEQUAL�	STAREQUAL�
SLASHEQUAL�PERCENTEQUAL�
AMPEREQUAL�	VBAREQUAL�CIRCUMFLEXEQUAL�LEFTSHIFTEQUAL�RIGHTSHIFTEQUAL�DOUBLESTAREQUAL�DOUBLESLASH�DOUBLESLASHEQUAL�AT�ATEQUAL�RARROW�ELLIPSIS�
COLONEQUAL�OP�AWAIT�ASYNC�TYPE_IGNORE�TYPE_COMMENT�
ERRORTOKEN�COMMENT�NL�ENCODING�N_TOKENSri�globals�itemsr�extend�values�EXACT_TOKEN_TYPESrrrrMrMrMrN�<module>s���2token.cpython-38.opt-2.pyc000064400000004626150335716500011271 0ustar00U

e5d@	�0@s�ddddgZdZdZdZdZdZd	Zd
ZdZdZ	d
Z
dZdZdZ
dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Zd"Zd#Z d$Z!d%Z"d&Z#d'Z$d(Z%d)Z&d*Z'd+Z(d,Z)d-Z*d.Z+d/Z,d0Z-d1Z.d2Z/d3Z0d4Z1d5Z2d6Z3d7Z4d8Z5d9Z6d:Z7d;Z8d<Z9d=Z:d>Z;d?Z<d@Z=dAZ>dBZ?dCZ@dDZAdEdF�eB��C�D�ZDe�EeD�F��eee)ee*ee	ee$e/e'ee%e
ee&e4ee5ee0e1e(ee6eee"e-eeeeee#e.e2e3e
ee!e,eee+ee dG�/ZGdHd�ZHdId�ZIdJd�ZJdKS)L�tok_name�
ISTERMINAL�
ISNONTERMINAL�ISEOF����������	�
���
������������������� �!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�0�1�2�3�4�5�6�7�8�9�:�;�<�=�>�?�cCs*i|]"\}}t|t�r|�d�s||�qS)�_)�
isinstance�int�
startswith)�.0�name�value�rM�/usr/lib64/python3.8/token.py�
<dictcomp>Js


�rO)/z!=�%z%=�&z&=�(�)�*z**z**=z*=�+z+=�,�-z-=z->�.z...�/z//z//=z/=�:z:=�;�<z<<z<<=z<=�=z==�>z>=z>>z>>=�@z@=�[�]�^z^=�{�|z|=�}�~cCs|tkS�N��	NT_OFFSET��xrMrMrNr�scCs|tkSrgrhrjrMrMrNr�scCs|tkSrg)�	ENDMARKERrjrMrMrNr�sN)K�__all__rl�NAME�NUMBER�STRING�NEWLINE�INDENT�DEDENT�LPAR�RPAR�LSQB�RSQB�COLON�COMMA�SEMI�PLUS�MINUS�STAR�SLASH�VBAR�AMPER�LESS�GREATER�EQUAL�DOT�PERCENT�LBRACE�RBRACE�EQEQUAL�NOTEQUAL�	LESSEQUAL�GREATEREQUAL�TILDE�
CIRCUMFLEX�	LEFTSHIFT�
RIGHTSHIFT�
DOUBLESTAR�	PLUSEQUAL�MINEQUAL�	STAREQUAL�
SLASHEQUAL�PERCENTEQUAL�
AMPEREQUAL�	VBAREQUAL�CIRCUMFLEXEQUAL�LEFTSHIFTEQUAL�RIGHTSHIFTEQUAL�DOUBLESTAREQUAL�DOUBLESLASH�DOUBLESLASHEQUAL�AT�ATEQUAL�RARROW�ELLIPSIS�
COLONEQUAL�OP�AWAIT�ASYNC�TYPE_IGNORE�TYPE_COMMENT�
ERRORTOKEN�COMMENT�NL�ENCODING�N_TOKENSri�globals�itemsr�extend�values�EXACT_TOKEN_TYPESrrrrMrMrMrN�<module>s���2functools.cpython-38.opt-2.pyc000064400000051402150335716500012157 0ustar00U

e5d��
@s�dddddddddd	d
ddg
Zd
dlmZd
dlmZd
dlmZd
dlmZdZ	dZ
e	e
fdd�Ze	e
fdd�Ze
fdd�Ze
fdd�Ze
fdd�Ze
fdd�Ze
fdd�Ze
fd d!�Ze
fd"d#�Ze
fd$d%�Ze
fd&d'�Ze
fd(d)�Ze
fd*d+�Ze
fd,d-�Zd.efd/efd0efgd0efd1efd.efgd1efd0efd/efgd/efd.efd1efgd2�Zd3d�Zd4d�Zzd
d5lmZWnek
�r�YnXe�Z e fd6d�Z!zd
d7lm!Z!Wnek
�r�YnXGd8d�d�Z"zd
d9lm"Z"Wnek
�r�YnXGd:d	�d	e�Z#d;d<�Z$ed=d>d?d@dAg�Z%GdBdC�dCe&�Z'e�fe(e)he*e+e,fdDdE�Z-dXdHd�Z.dIdJ�Z/zd
dKlm/Z/Wnek
�r�YnXdLdM�Z0dYdOdP�Z1dQdR�Z2dSdT�Z3dUd
�Z4GdVd�d�Z5e�Z6GdWd�d�Z7dNS)Z�update_wrapper�wraps�WRAPPER_ASSIGNMENTS�WRAPPER_UPDATES�total_ordering�
cmp_to_key�	lru_cache�reduce�partial�
partialmethod�singledispatch�singledispatchmethod�cached_property�)�get_cache_token)�
namedtuple)�recursive_repr)�RLock)�
__module__�__name__�__qualname__�__doc__�__annotations__)�__dict__c	Csf|D]4}zt||�}Wntk
r*YqXt|||�q|D]}t||��t||i��q>||_|S�N)�getattr�AttributeError�setattr�update�__wrapped__)�wrapper�wrapped�assigned�updated�attr�value�r%�!/usr/lib64/python3.8/functools.pyr"scCstt|||d�S)N�r r!r")r	rr'r%r%r&r@s�cCs$|�|�}||kr|S|o"||kSr��__lt__��self�other�NotImplemented�	op_resultr%r%r&�_gt_from_ltXs
r/cCs|�|�}|p||kSrr(r*r%r%r&�_le_from_lt_s
r0cCs|�|�}||kr|S|Srr(r*r%r%r&�_ge_from_ltds
r1cCs$|�|�}||kr|S|p"||kSr��__le__r*r%r%r&�_ge_from_leks
r4cCs"|�|�}||kr|S|o ||kSrr2r*r%r%r&�_lt_from_lers
r5cCs|�|�}||kr|S|Srr2r*r%r%r&�_gt_from_leys
r6cCs$|�|�}||kr|S|o"||kSr��__gt__r*r%r%r&�_lt_from_gt�s
r9cCs|�|�}|p||kSrr7r*r%r%r&�_ge_from_gt�s
r:cCs|�|�}||kr|S|Srr7r*r%r%r&�_le_from_gt�s
r;cCs$|�|�}||kr|S|p"||kSr��__ge__r*r%r%r&�_le_from_ge�s
r>cCs"|�|�}||kr|S|o ||kSrr<r*r%r%r&�_gt_from_ge�s
r?cCs|�|�}||kr|S|Srr<r*r%r%r&�_lt_from_ge�s
r@r8r3r=r))r)r3r8r=csV�fdd�tD�}|std��t|�}t|D]"\}}||kr.||_t�||�q.�S)Ncs(h|] }t�|d�tt|d�k	r|�qSr)r�object)�.0�op��clsr%r&�	<setcomp>�sz!total_ordering.<locals>.<setcomp>z6must define at least one ordering operation: < > <= >=)�_convert�
ValueError�maxrr)rE�roots�root�opname�opfuncr%rDr&r�scsG�fdd�dt�}|S)NcsZeZdZdgZdd�Z�fdd�Z�fdd�Z�fdd	�Z�fd
d�Z�fdd
�Z	dZ
dS)zcmp_to_key.<locals>.K�objcSs
||_dSr�rN)r+rNr%r%r&�__init__�szcmp_to_key.<locals>.K.__init__cs�|j|j�dkS�NrrO�r+r,��mycmpr%r&r)�szcmp_to_key.<locals>.K.__lt__cs�|j|j�dkSrQrOrRrSr%r&r8�szcmp_to_key.<locals>.K.__gt__cs�|j|j�dkSrQrOrRrSr%r&�__eq__�szcmp_to_key.<locals>.K.__eq__cs�|j|j�dkSrQrOrRrSr%r&r3�szcmp_to_key.<locals>.K.__le__cs�|j|j�dkSrQrOrRrSr%r&r=�szcmp_to_key.<locals>.K.__ge__N)rrr�	__slots__rPr)r8rUr3r=�__hash__r%rSr%r&�K�srX)rA)rTrXr%rSr&r�s)rcCsZt|�}|tkr>zt|�}WqBtk
r:td�d�YqBXn|}|D]}|||�}qF|S)Nz0reduce() of empty sequence with no initial value)�iter�_initial_missing�next�
StopIteration�	TypeError)ZfunctionZsequence�initial�itr$Zelementr%r%r&r�s)rcsFeZdZdZ�fdd�Zdd�Ze�dd��Zdd	�Zd
d�Z	�Z
S)r	)�func�args�keywordsr�__weakref__csZt|�std��t|d�r4|j|}|j|�}|j}tt|��|�}||_||_||_|S)Nz#the first argument must be callabler`)	�callabler]�hasattrrarbr`�superr	�__new__)rEr`rarbr+��	__class__r%r&rgs


zpartial.__new__cOs|j|�}|j|j|�|�Sr�rbr`ra)r+rarbr%r%r&�__call__%s
zpartial.__call__cCs�t|�j}t|j�g}|�dd�|jD��|�dd�|j��D��t|�jdkrld|�dd�	|��d�S|�dd�	|��d�S)	Ncss|]}t|�VqdSr)�repr)rB�xr%r%r&�	<genexpr>-sz#partial.__repr__.<locals>.<genexpr>css |]\}}|�d|��VqdS)�=Nr%�rB�k�vr%r%r&rn.s�	functoolsz
functools.�(�, �))
�typerrlr`�extendrarb�itemsr�join)r+�qualnamerar%r%r&�__repr__)s
zpartial.__repr__cCs*t|�|jf|j|j|jpd|jp$dffSr)rwr`rarbr�r+r%r%r&�
__reduce__3s�zpartial.__reduce__cCs�t|t�std��t|�dkr0tdt|�����|\}}}}t|�rrt|t�rr|dk	r`t|t�rr|dk	rzt|t�sztd��t|�}|dkr�i}nt|�tk	r�t|�}|dkr�i}||_||_||_	||_
dS)Nz(argument to __setstate__ must be a tuple�zexpected 4 items in state, got zinvalid partial state)�
isinstance�tupler]�lenrd�dictrwrr`rarb)r+�stater`ra�kwds�	namespacer%r%r&�__setstate__7s4
����zpartial.__setstate__)rrrrVrgrkrr|r~r��
__classcell__r%r%rhr&r	s
	)r	c@s@eZdZdd�Zde_dd�Zdd�Zd
d	d
�Zedd��Z	dS)r
cOs�t|�dkr|^}}}nV|s&td��nHd|krZ|�d�}|^}}ddl}|jdtdd�ntdt|�d��t|�}t|�s�t|d	�s�td
�	|���t
|t�r�|j|_|j
||_
|j|�|_n||_||_
||_dS)N�z8descriptor '__init__' of partialmethod needs an argumentr`rz0Passing 'func' as keyword argument is deprecated)�
stacklevelz8type 'partialmethod' takes at least one argument, got %d��__get__z${!r} is not callable or a descriptor)r�r]�pop�warnings�warn�DeprecationWarningr�rdre�formatr�r
r`rarb)rarbr+r`r�r%r%r&rP]s6

�
��
zpartialmethod.__init__z#($self, func, /, *args, **keywords)cCsNd�tt|j��}d�dd�|j��D��}d}|j|jj|jj	|j
||d�S)Nrucss|]\}}d�||�VqdS)z{}={!r}N)r�rpr%r%r&rn�s�z)partialmethod.__repr__.<locals>.<genexpr>z*{module}.{cls}({func}, {args}, {keywords}))�modulerEr`rarb)rz�maprlrarbryr�rirrr`)r+rarb�
format_stringr%r%r&r|�s
�
�zpartialmethod.__repr__cs�fdd�}�j|_�|_|S)Ncs �j|�}�j|f�j|�|�Srrj)�cls_or_selfrarbr}r%r&�_method�s
z3partialmethod._make_unbound_method.<locals>._method)�__isabstractmethod__�_partialmethod)r+r�r%r}r&�_make_unbound_method�sz"partialmethod._make_unbound_methodNcCs�t|jdd�}d}|dk	rd|||�}||jk	rdt|f|j�|j�}z|j|_Wntk
rbYnX|dkr||���||�}|S)Nr�)	rr`r	rarb�__self__rr�r�)r+rNrE�get�result�new_funcr%r%r&r��s

zpartialmethod.__get__cCst|jdd�S�Nr�F�rr`r}r%r%r&r��sz"partialmethod.__isabstractmethod__)N)
rrrrP�__text_signature__r|r�r��propertyr�r%r%r%r&r
Us"
cCst|t�r|j}q|Sr)r�r	r`�r`r%r%r&�_unwrap_partial�s
r��	CacheInfo�hits�misses�maxsize�currsizec@s$eZdZdZefdd�Zdd�ZdS)�
_HashedSeq�	hashvaluecCs||dd�<||�|_dSr�r�)r+�tup�hashr%r%r&rP�sz_HashedSeq.__init__cCs|jSrr�r}r%r%r&rW�sz_HashedSeq.__hash__N)rrrrVr�rPrWr%r%r%r&r��sr�c
s�|}|r&||7}|��D]}	||	7}q|rh||�fdd�|D��7}|r�||�fdd�|��D��7}n$||�dkr��|d�|kr�|dSt|�S)Nc3s|]}�|�VqdSrr%�rBrr�rwr%r&rn�sz_make_key.<locals>.<genexpr>c3s|]}�|�VqdSrr%r�r�r%r&rn�sr�r)ry�valuesr�)
rar��typed�kwd_mark�	fasttypesr�rwr��key�itemr%r�r&�	_make_key�s
 r��Fcsnt�t�r�dkr\d�nDt��rLt�t�rL�d}�t|��t�}t||�S�dk	r\td����fdd�}|S)Nrr�z=Expected first argument to be an integer, a callable, or Nonecst|��t�}t||�Sr)�_lru_cache_wrapper�
_CacheInfor)�
user_functionr�r�r�r%r&�decorating_function
sz&lru_cache.<locals>.decorating_function)r��intrd�boolr�r�rr])r�r�r�rr�r%r�r&r�s


�cs�t��t�d\����i�d�	�
d��j��j�t��
g���ddg�dd�<�dkrh�
�fdd�}nN�dkr����	��
���fdd�}n*���������	�
���
���fdd�}���	�
��
fdd	�}���	�
�
�fd
d�}||_||_|S)N)rr�r��rFcs�d7��||�}|S�Nr�r%)rar�r�)r�r�r%r&r$s
z#_lru_cache_wrapper.<locals>.wrappercsH�||��}�|��}|�k	r*�d7�|S�d7��||�}|�|<|Sr�r%)rar�r�r�)�cache�	cache_getr��make_keyr��sentinelr�r�r%r&r-s

c
s>�
||��}�	�z�|�}|dk	r~|\}}}}||�<||�<�
�}||�<�
�<||�<�
|�<�d7�|W5QR�S�d7�W5QRX�||�}�	��|�kr�n��r��
}	||	�<||	�<|	��
�
�}
�
�}d�
�<�
�<�|
=|	�|<n6�
�}|�
||g}||�<�
�<�|<���k�W5QRX|Sr�r%)rar�r��linkZ	link_prevZ	link_nextZ_keyr�ZlastZoldrootZoldkeyZ	oldresult)�KEY�NEXT�PREV�RESULTr�r��	cache_len�fullr��lockr�r�r�rKr�r�r%r&r<sB

c
s,���������W5QR�SQRXdSrr%r%)r�r�r�r�r�r�r%r&�
cache_infousz&_lru_cache_wrapper.<locals>.cache_infoc	s<��.�����ddg�dd�<d��d�W5QRXdS)NrF)�clearr%)r�r�r�r�r�rKr%r&�cache_clearzs
z'_lru_cache_wrapper.<locals>.cache_clear)rAr�r��__len__rr�r�)r�r�r�r�rr�r�r%)r�r�r�r�r�r�r�r�r�r�r�r�r�r�rKr�r�r�r&r�s**9	r�)r�cCs�g}dd�|D�}|s|S|D]2}|d}|D]}||dd�kr.d}qq.qRq|dkrbtd��|�|�|D]}|d|krp|d=qpqdS)NcSsg|]}|r|�qSr%r%�rB�sr%r%r&�
<listcomp>�sz_c3_merge.<locals>.<listcomp>rr�zInconsistent hierarchy)�RuntimeError�append)�	sequencesr��s1�	candidate�s2�seqr%r%r&�	_c3_merge�s"
r�Nc
stt|j��D]$\}�t�d�rt|j�|}q8qd}�rDt��ng�t|jd|��}g}t|j|d��}�D]0�t|��rtt�fdd�|jD��st|���qt|D]���	��q��fdd�|D�}�fdd�|D�}�fdd�|D�}	t
|gg|||	|g|g|g�S)	N�__abstractmethods__rc3s|]}t|��VqdSr)�
issubclass)rB�b)�baser%r&rn�sz_c3_mro.<locals>.<genexpr>csg|]}t|�d��qS���abcs��_c3_mro�rBr�r�r%r&r��sz_c3_mro.<locals>.<listcomp>csg|]}t|�d��qSr�r�r�r�r%r&r��scsg|]}t|�d��qSr�r�r�r�r%r&r��s)�	enumerate�reversed�	__bases__rer��listr��anyr��remover�)
rEr��i�boundary�explicit_bases�abstract_bases�other_bases�explicit_c3_mros�abstract_c3_mros�
other_c3_mrosr%)r�r�r&r��sD
��������r�cs�t�j����fdd���fdd��D���fdd���fdd��D��t���g}�D]�}g}|��D]0}|�krht�|�rh|��fdd�|jD��qh|s�|�|�qX|jtd	d
�|D] }|D]}||kr�|�|�q�q�qXt�|d�S)Ncs|�kot|d�ot�|�S)N�__mro__)rer�)�typ)�basesrEr%r&�
is_related�s�z _compose_mro.<locals>.is_relatedcsg|]}�|�r|�qSr%r%�rB�n)r�r%r&r��sz _compose_mro.<locals>.<listcomp>cs&�D]}||kr||jkrdSqdS)NTF)r�)r�r,)�typesr%r&�is_strict_base�sz$_compose_mro.<locals>.is_strict_basecsg|]}�|�s|�qSr%r%r�)r�r%r&r��scsg|]}|�kr|�qSr%r%r�)�type_setr%r&r��sT)r��reverser�)�setr��__subclasses__r�r��sortr�r�)rEr��mror��found�sub�subclsr%)r�rEr�r�r�r�r&�_compose_mro�s*

rcCstt||���}d}|D]R}|dk	r\||krX||jkrX||jkrXt||�sXtd�||���qj||kr|}q|�|�S)NzAmbiguous dispatch: {} or {})r�keysr�r�r�r�r�)rE�registryr�match�tr%r%r&�
_find_impls"
���r
cs�ddl}ddl}i�|���d����fdd��d
����fdd�	���fdd�}t|dd	��|�t<�|_�|_|���|_�j	|_
t||�|S)Nrcs|�dk	r"t�}�|kr"���|�z�|}WnHtk
rvz�|}Wntk
rht|��}YnX|�|<YnX|Sr)rr��KeyErrorr
)rE�
current_token�impl)�cache_token�dispatch_cacherr%r&�dispatch.sz singledispatch.<locals>.dispatchcs�|dkr�t�t�r ��fdd�St�di�}|s@td��d����}ddlm}tt||�����\}�t�t�s�td|�d	��d
���|��<�dkr�t	�d�r�t
�����|S)Ncs
��|�Srr%)�f)rE�registerr%r&�<lambda>N�z2singledispatch.<locals>.register.<locals>.<lambda>rz(Invalid first argument to `register()`: zS. Use either `@register(some_class)` or plain `@register` on an annotated function.r)�get_type_hintszInvalid annotation for z. z is not a class.r�)r�rwrr]�typingrr[rYryrerr�)rEr`�annr�argname)rrrrrDr&rEs(

�
�z singledispatch.<locals>.registercs&|st��d����|dj�||�S)Nz( requires at least 1 positional argumentr)r]ri)ra�kw)r�funcnamer%r&rfszsingledispatch.<locals>.wrapperrzsingledispatch function)N)r��weakref�WeakKeyDictionaryrrArr�MappingProxyTyperr��_clear_cacher)r`r�rrr%)rrrrrrr&rs!
c@s4eZdZdd�Zd
dd�Zddd�Zedd	��ZdS)rcCs4t|�s t|d�s t|�d���t|�|_||_dS)Nr�z  is not callable or a descriptor)rdrer]r�
dispatcherr`�r+r`r%r%r&rPs
zsingledispatchmethod.__init__NcCs|jj||d�S)Nr�)rr)r+rE�methodr%r%r&r�szsingledispatchmethod.registercs0���fdd�}�j|_�j|_t|�j�|S)Ncs$�j�|dj�}|����||�SrQ)rrrir�)ra�kwargsr!�rErNr+r%r&r��sz-singledispatchmethod.__get__.<locals>._method)r�rrr`)r+rNrEr�r%r#r&r��s
zsingledispatchmethod.__get__cCst|jdd�Sr�r�r}r%r%r&r��sz)singledispatchmethod.__isabstractmethod__)N)N)rrrrPrr�r�r�r%r%r%r&rxs



c@s&eZdZdd�Zdd�Zddd�ZdS)	r
cCs ||_d|_|j|_t�|_dSr)r`�attrnamerrr�r r%r%r&rP�szcached_property.__init__cCs8|jdkr||_n"||jkr4td|j�d|�d���dS)Nz?Cannot assign the same cached_property to two different names (z and z).)r$r])r+�owner�namer%r%r&�__set_name__�s

�zcached_property.__set_name__Nc	Cs�|dkr|S|jdkrtd��z
|j}Wn8tk
r`dt|�j�d|j�d�}t|�d�YnX|�|jt�}|tkr�|j�n|�|jt�}|tkr�|�	|�}z|||j<Wn8tk
r�dt|�j�d|j�d�}t|�d�YnXW5QRX|S)NzGCannot use cached_property instance without calling __set_name__ on it.zNo '__dict__' attribute on z instance to cache z
 property.zThe '__dict__' attribute on z7 instance does not support item assignment for caching )
r$r]rrrwrr��
_NOT_FOUNDr�r`)r+�instancer%r��msg�valr%r%r&r��s2
�
�
�zcached_property.__get__)N)rrrrPr'r�r%r%r%r&r
�s	)r�F)N)8�__all__�abcr�collectionsr�reprlibr�_threadrrrrrr-r/r0r1r4r5r6r9r:r;r>r?r@rGrr�
_functools�ImportErrorrArZrr	r
r�r�r�r�r��strr�rwr�r�rr�r�r�rr
rrr(r
r%r%r%r&�<module>s��
�
�
�����AX	�

,t
-)\(keyword.cpython-38.opt-2.pyc000064400000001075150335716500011630 0ustar00U

e5d��#@s`ddgZdddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$g#Zee�jZd%S)&�	iskeyword�kwlist�False�None�True�and�as�assert�async�await�break�class�continue�def�del�elif�else�except�finally�for�from�global�if�import�in�is�lambda�nonlocal�not�or�pass�raise�return�try�while�with�yieldN)�__all__r�	frozenset�__contains__r�r)r)�/usr/lib64/python3.8/keyword.py�<module>sJ�&colorsys.cpython-38.opt-2.pyc000064400000005114150335716500012017 0ustar00U

e5d��@sXddddddgZdZdZdZd	d�Zd
d�Zdd�Zdd�Zd
d�Zdd�Z	dd�Z
dS)�
rgb_to_yiq�
yiq_to_rgb�
rgb_to_hls�
hls_to_rgb�
rgb_to_hsv�
hsv_to_rgbgUUUUUU�?gUUUUUU�?gUUUUUU�?cCsRd|d|d|}d||d||}d||d||}|||fS)Ng333333�?g�z�G��?g)\��(�?g�G�z��?gH�z�G�?g���Q��?g=
ףp=�?�)�r�g�b�y�i�qrr� /usr/lib64/python3.8/colorsys.pyr(scCs�|d|d|}|d|d|}|d|d|}|dkrHd}|dkrTd}|dkr`d}|dkrld}|dkrxd}|dkr�d}|||fS)	Ng2r��L�?g����,��?g:�����?g�nєW�?g6�޷���?gJ"�X�?���?r)rrr
rr	r
rrrr.s cCs�t|||�}t|||�}||d}||kr6d|dfS|dkrP||||}n||d||}||||}||||}||||}	||kr�|	|}
n"||kr�d||	}
nd||}
|
dd}
|
||fS)N�@r��?�@�@r��max�min)rr	r
�maxc�minc�l�s�rc�gc�bc�hrrrrKs$

cCsn|dkr|||fS|dkr(|d|}n||||}d||}t|||t�t|||�t|||t�fS)Nrrrr)�_v�	ONE_THIRD)rrr�m2�m1rrrrbs
cCsT|d}|tkr$||||dS|dkr0|S|tkrP|||t|dS|S)Nrrr)�	ONE_SIXTH�	TWO_THIRD)r#r"Zhuerrrr lsr cCs�t|||�}t|||�}|}||kr.dd|fS|||}||||}||||}||||}	||kr||	|}
n"||kr�d||	}
nd||}
|
dd}
|
||fS)Nrrrrrr)rr	r
rr�vrrrrrrrrr|s 

cCs�|dkr|||fSt|d�}|d|}|d|}|d||}|d|d|}|d}|dkrt|||fS|dkr�|||fS|dkr�|||fS|dkr�|||fS|d	kr�|||fS|d
kr�|||fSdS)Nrrr�������)�int)rrr&r�f�pr
�trrrr�s(





N)�__all__r!r$r%rrrrr rrrrrr�<module>s�	
gettext.cpython-38.opt-1.pyc000064400000042735150335716500011637 0ustar00U

e5dj�@s�dZddlZddlZddlZddlZddddddd	d
ddd
ddddddddddgZej�ejdd�Z	e�
dejejB�Z
dd�Zdd�ZdZd d!�eed"�D�Zd#d$d%d&�ZdGd(d)�Zd*d+�Zd,d-�Zd.d/�ZGd0d�d�ZGd1d�de�ZdHd3d�ZiZd4gZdddd2efd5d�Zdedfd6d�Ziaiad7a dId8d	�Z!dJd9d
�Z"dKd:d�Z#d;d�Z$d<d�Z%d=d
�Z&d>d�Z'd?d�Z(d@d�Z)dAd�Z*dBd�Z+dCd�Z,dDd�Z-dEd�Z.dFd�Z/eZ0dS)La�Internationalization and localization support.

This module provides internationalization (I18N) and localization (L10N)
support for your Python programs by providing an interface to the GNU gettext
message catalog library.

I18N refers to the operation by which a program is made aware of multiple
languages.  L10N refers to the adaptation of your program, once
internationalized, to the local language and cultural habits.

�N�NullTranslations�GNUTranslations�Catalog�find�translation�install�
textdomain�bindtextdomain�bind_textdomain_codeset�dgettext�	dngettext�gettext�lgettext�	ldgettext�
ldngettext�	lngettext�ngettext�pgettext�	dpgettext�	npgettext�
dnpgettextZshare�localea�
        (?P<WHITESPACES>[ \t]+)                    | # spaces and horizontal tabs
        (?P<NUMBER>[0-9]+\b)                       | # decimal integer
        (?P<NAME>n\b)                              | # only n is allowed
        (?P<PARENTHESIS>[()])                      |
        (?P<OPERATOR>[-*/%+?:]|[><!]=?|==|&&|\|\|) | # !, *, /, %, +, -, <, >,
                                                     # <=, >=, ==, !=, &&, ||,
                                                     # ? :
                                                     # unary and bitwise ops
                                                     # not allowed
        (?P<INVALID>\w+|.)                           # invalid token
    ccsPt�t|�D]8}|j}|dkr q|�|�}|dkr>td|��|VqdVdS)NZWHITESPACESZINVALIDz invalid token in plural form: %s�)�re�finditer�_token_pattern�	lastgroup�group�
ValueError)�pluralZmoZkind�value�r!�/usr/lib64/python3.8/gettext.py�	_tokenizeWs
r#cCs|rtd|�Std�SdS)Nz#unexpected token in plural form: %szunexpected end of plural form)r)r r!r!r"�_errorbsr$))�||)�&&)z==z!=)�<�>z<=z>=)�+�-)�*�/�%cCs i|]\}}|D]
}||�qqSr!r!)�.0�iZops�opr!r!r"�
<dictcomp>ps
r1��or�andz//)r%r&r,���cCs�d}t|�}|dkr&|d7}t|�}q|dkrXt|�\}}d||f}|dkr�td��nP|dkrnd	||f}n:zt|d
�}Wntk
r�t|�d�YnXd||f}t|�}d}|tk�rt|}||krҐq|d
kr�|d
kr�d|}t�||�}t||d�\}	}d|||	f}|}q�||k�r4dk�r@nnd|}|dk�r�|dk�r�t|d�\}
}|dk�rtt|��t|�\}}d|
||f}|dk�r�d|}||fS)Nr�!znot �(z%s(%s)�)z%unbalanced parenthesis in plural form�nz%s%s�
z%s%d�d)��z(%s)r2z%s %s %sr=�?r�:z%s if %s else %s)�next�_parser�intr$�_binary_ops�	_c2py_ops�get)�tokensZpriority�result�nexttok�subr �jr/r0�rightZif_trueZif_falser!r!r"rAssP




rAcCsZzt|�}Wn(tk
r4td|jjf�d�YnXddl}|�d|jjftd�|S)Nz'Plural value must be an integer, got %srr=)�round�	TypeError�	__class__�__name__�warnings�warn�DeprecationWarning)r9r/rPr!r!r"�_as_int�s ����rScCs�t|�dkrtd��z|tt|��\}}|r2t|��d}|D]6}|dkr`|d7}|dkrptd��q:|dkr:|d8}q:d	ti}td
||�|dWStk
r�td��YnXdS)
z�Gets a C expression as used in PO files for plural forms and returns a
    Python function that implements an equivalent expression.
    i�z"plural form expression is too longrr7r2�z%plural form expression is too complexr8rSz�if True:
            def func(n):
                if not isinstance(n, int):
                    n = _as_int(n)
                return int(%s)
            �funcN)�lenrrAr#r$rS�exec�RecursionError)rrGrHZdepth�c�nsr!r!r"�c2py�s.

��
r[c
Cs4t�|�}d}d}d}d}|�d�}|dkrN||d�}|d|�}||O}nd}|�d�}|dkr�||d�}|d|�}||O}nd}|�d�}|dkr�||d�}|d|�}||O}nd}|}	g}
t|d�D]P}||@s�|	}||@r�||7}||@�r
||7}||@�r||7}|
�|�q�|
��|
S)	Nr2�r=r�@r�.�_)rZ	normalizer�range�append�reverse)
ZlocZCOMPONENT_CODESETZCOMPONENT_TERRITORYZCOMPONENT_MODIFIER�mask�posZmodifier�codesetZ	territoryZlanguageZretr/�valr!r!r"�_expand_lang�sJ









rgc@s�eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zddd�ZdS) rNcCs.i|_d|_d|_d|_|dk	r*|�|�dS�N)�_info�_charset�_output_charset�	_fallbackrA��self�fpr!r!r"�__init__�szNullTranslations.__init__cCsdSrhr!rmr!r!r"rAszNullTranslations._parsecCs|jr|j�|�n||_dSrh)rl�add_fallback)rn�fallbackr!r!r"rq
szNullTranslations.add_fallbackcCs|jr|j�|�S|Srh)rlr
)rn�messager!r!r"r
szNullTranslations.gettextc
Csrddl}|�dtd�|jrR|���(|�ddt�|j�|�W5QR�SQRX|jrd|�|j�S|�t	�
��S)Nr�/lgettext() is deprecated, use gettext() insteadr\�ignore�.*\blgettext\b.*)rPrQrRrl�catch_warnings�filterwarningsrrk�encoder�getpreferredencoding)rnrsrPr!r!r"rs�
�zNullTranslations.lgettextcCs*|jr|j�|||�S|dkr"|S|SdS�Nr2)rlr)rn�msgid1�msgid2r9r!r!r"r"s
zNullTranslations.ngettextc
Cs�ddl}|�dtd�|jrV|���,|�ddt�|j�|||�W5QR�SQRX|dkrd|}n|}|jrz|�|j�S|�t	�
��S)Nr�1lngettext() is deprecated, use ngettext() insteadr\ru�.*\blngettext\b.*r2)rPrQrRrlrwrxrrkryrrz�rnr|r}r9rP�tmsgr!r!r"r*s"�
�"zNullTranslations.lngettextcCs|jr|j�||�S|Srh)rlr)rn�contextrsr!r!r"r;szNullTranslations.pgettextcCs,|jr|j�||||�S|dkr$|S|SdSr{)rlr)rnr�r|r}r9r!r!r"r@s
zNullTranslations.npgettextcCs|jSrh)ri�rnr!r!r"�infoHszNullTranslations.infocCs|jSrh)rjr�r!r!r"�charsetKszNullTranslations.charsetcCsddl}|�dtd�|jS)Nrzoutput_charset() is deprecatedr\�rPrQrRrk)rnrPr!r!r"�output_charsetNs�zNullTranslations.output_charsetcCs ddl}|�dtd�||_dS)Nrz"set_output_charset() is deprecatedr\r�)rnr�rPr!r!r"�set_output_charsetTs�z#NullTranslations.set_output_charsetcCsRddl}|j|jd<|dk	rNddddddh}|t|�@D]}t||�|j|<q8dS)	Nrr_r
rrrrr)�builtinsr
�__dict__�set�getattr)rn�namesr�Zallowed�namer!r!r"rZs�zNullTranslations.install)N)N)rO�
__module__�__qualname__rprArqr
rrrrrr�r�r�r�rr!r!r!r"r�s

c@s\eZdZdZdZdZdZdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�ZdS)rl�*l�$<z%s%s)rr2cCs|d?|d@fS)z/Returns a tuple of major version, minor version�i��r!)rn�versionr!r!r"�
_get_versionspszGNUTranslations._get_versionsc"Cs�ddlm}t|dd�}i|_}dd�|_|��}t|�}|d|dd	��d}||jkr||d
|d	d��\}}	}
}d}n6||jkr�|d
|d	d��\}}	}
}d}nt	dd|��|�
|�\}
}|
|jkr�t	ddt|
�|��t
d|	�D�]}||||
|
d��\}}||}|||||d��\}}||}||k�r`||k�r`|||�}|||�}nt	dd|��|dk�rld}|�d�D]�}|����}|�s��q�|�d��r�|�d��r��q�d}}d|k�r|�dd�\}}|����}|��}||j|<|}n|�r|j|d|7<|dk�r8|�d�d|_n0|dk�r�|�d�}|d�d�d}t|�|_�q�|j�pvd}d|k�r�|�d�\}} |�d�}t||�}t|�D]\}}!t|!|�|||f<�q�nt||�|t||�<|
d7}
|d7}q�dS)z8Override this method to support alternative .mo formats.r)�unpackr�rcSst|dk�Sr{)rB)r9r!r!r"�<lambda>}�z(GNUTranslations._parse.<locals>.<lambda>z<INr=z<4IrTz<IIz>4Iz>IIzBad magic numberzBad version number �zFile is corrupt�
z	#-#-#-#-#r?r2�
zcontent-typezcharset=zplural-forms�;zplural=�ascii�)Zstructr�r��_catalogr�readrV�LE_MAGIC�BE_MAGIC�OSErrorr��VERSIONS�strr`�split�decode�strip�
startswith�endswith�lowerrirjr[�	enumerate)"rnror��filenameZcatalogZbufZbuflen�magicr�ZmsgcountZ	masteridxZtransidxZiiZ
major_versionZ
minor_versionr/ZmlenZmoffZmendZtlenZtoffZtend�msgr�ZlastkZb_item�item�k�vrr�r|r}�xr!r!r"rAtsv














zGNUTranslations._parsecCshddl}|�dtd�t�}|j�||�}||krH|jrD|j�|�S|}|jrZ|�	|j�S|�	t
���S)Nrrtr\)rPrQrR�objectr�rErlrrkryrrz)rnrsrP�missingr�r!r!r"r�s�zGNUTranslations.lgettextcCs�ddl}|�dtd�z|j||�|�f}Wn@tk
rn|jrX|j�|||�YS|dkrf|}n|}YnX|jr�|�	|j�S|�	t
���S)Nrr~r\r2)rPrQrRr�r�KeyErrorrlrrkryrrzr�r!r!r"r�s �
zGNUTranslations.lngettextcCs6t�}|j�||�}||kr2|jr.|j�|�S|S|Srh)r�r�rErlr
)rnrsr�r�r!r!r"r
�szGNUTranslations.gettextcCs^z|j||�|�f}Wn@tk
rX|jrB|j�|||�YS|dkrP|}n|}YnX|Sr{)r�rr�rlr)rnr|r}r9r�r!r!r"r�s
zGNUTranslations.ngettextcCsF|j||f}t�}|j�||�}||krB|jr>|j�||�S|S|Srh)�CONTEXTr�r�rErlr)rnr�rs�ctxt_msg_idr�r�r!r!r"rszGNUTranslations.pgettextc	Csn|j||f}z|j||�|�f}WnBtk
rh|jrR|j�||||�YS|dkr`|}n|}YnX|Sr{)r�r�rr�rlr)rnr�r|r}r9r�r�r!r!r"rs
zGNUTranslations.npgettextN)rOr�r�r�r�r�r�r�rArrr
rrrr!r!r!r"rdsY	
FcCs�|dkrt}|dkrRg}dD]"}tj�|�}|r|�d�}q@qd|krR|�d�g}|D]$}t|�D]}||krf|�|�qfqZ|r�g}	nd}	|D]J}|dkr�q�tj�||dd|�}
tj�	|
�r�|r�|	�|
�q�|
Sq�|	S)N)ZLANGUAGE�LC_ALL�LC_MESSAGESZLANGr?�Cr�z%s.mo)
�_default_localedir�os�environrEr�rarg�path�join�exists)�domain�	localedir�	languages�allZenvarrfZnelangsZlangZnelangrG�mofiler!r!r"rs8


Zunspecifiedc
Cs|dkrt}t|||dd�}|sB|r*t�Sddlm}t|d|��d}|D]�}	|tj�|	�f}
t	�
|
�}|dkr�t|	d��}t	�|
||��}W5QRXddl
}
|
�
|�}|tk	r�ddl}|�dtd�|r�|���|�d	d
t�|�|�W5QRX|dk�r|}qJ|�|�qJ|S)NT)r�r)�ENOENTz$No translation file found for domain�rbzparameter codeset is deprecatedr\ruz.*\bset_output_charset\b.*)rrr�errnor��FileNotFoundErrorr�r��abspath�
_translationsrE�open�
setdefault�copy�_unspecifiedrPrQrRrwrxr�rq)r�r�r�Zclass_rrreZmofilesr�rGr��key�tror�rPr!r!r"rCsH�

�
�
cCst||d|d�}|�|�dS)NT)rrre)rr)r�r�rer�r�r!r!r"rnsZmessagescCs|dk	r|atSrh)�_current_domain)r�r!r!r"r|scCs|dk	r|t|<t�|t�Srh)�_localedirsrEr�)r�r�r!r!r"r	�scCs0ddl}|�dtd�|dk	r&|t|<t�|�S)Nrz'bind_textdomain_codeset() is deprecatedr\)rPrQrR�_localecodesetsrE)r�rerPr!r!r"r
�s�cCs:zt|t�|d��}Wntk
r.|YSX|�|�Srh)rr�rEr�r
)r�rsr�r!r!r"r�s

c
Cs�ddl}|�dtd�t�|�}z<|���*|�ddt�t|t�|d�|d�}W5QRXWn&t	k
r�|�
|pzt���YSX|���&|�ddt�|�
|�W5QR�SQRXdS)Nrz1ldgettext() is deprecated, use dgettext() insteadr\ru�.*\bparameter codeset\b.*�rerv)rPrQrRr�rErwrxrr�r�ryrrzr)r�rsrPrer�r!r!r"r�s&�

�$
�cCsRzt|t�|d��}Wn,tk
rB|dkr6|YS|YSYnX|�|||�Sr{)rr�rEr�r)r�r|r}r9r�r!r!r"r�sc
Cs�ddl}|�dtd�t�|�}z<|���*|�ddt�t|t�|d�|d�}W5QRXWn8t	k
r�|dkrz|}n|}|�
|p�t���YSX|���*|�ddt�|�
|||�W5QR�SQRXdS)	Nrz3ldngettext() is deprecated, use dngettext() insteadr\rur�r�r2r)rPrQrRr�rErwrxrr�r�ryrrzr)r�r|r}r9rPrer�r�r!r!r"r�s,�

�$
�cCs<zt|t�|d��}Wntk
r.|YSX|�||�Srh)rr�rEr�r)r�r�rsr�r!r!r"r�s

cCsTzt|t�|d��}Wn,tk
rB|dkr6|YS|YSYnX|�||||�Sr{)rr�rEr�r)r�r�r|r}r9r�r!r!r"r�scCs
tt|�Srh)rr�)rsr!r!r"r
�sc
CsNddl}|�dtd�|���&|�ddt�tt|�W5QR�SQRXdS)Nrrtr\ruz.*\bldgettext\b.*)rPrQrRrwrxrr�)rsrPr!r!r"r�s�
�cCstt|||�Srh)rr�)r|r}r9r!r!r"r�sc
CsRddl}|�dtd�|���*|�ddt�tt|||�W5QR�SQRXdS)Nrr~r\ruz.*\bldngettext\b.*)rPrQrRrwrxrr�)r|r}r9rPr!r!r"r�s�
�cCstt||�Srh)rr�)r�rsr!r!r"r�scCstt||||�Srh)rr�)r�r|r}r9r!r!r"r�s)r5)NNF)N)N)N)1�__doc__rr�r�sys�__all__r�r��base_prefixr��compile�VERBOSE�DOTALLrr#r$rCr�rDrArSr[rgrrrr�r�rrr�r�r�rr	r
rrrrrrr
rrrrrrr!r!r!r"�<module>s�0�
�

1$*f7
&�
+




	
traceback.cpython-38.opt-1.pyc000064400000046744150335716500012076 0ustar00U

e5d;\�@s:dZddlZddlZddlZddlZddddddd	d
ddd
ddddddddgZd3dd�Zdd�Zd4dd�Zd5dd	�Z	d6dd�Z
dZdZd7dd�Z
d8d d�Zd!d�Zd"d#�Zd$d%�Zd9d&d
�Zd:d'd�Zd;d(d
�Zd<d)d�Zd=d*d�Zd>d+d�Zd,d�ZGd-d�d�Zd.d�Zd/d�Zd0ZGd1d�de�ZGd2d�d�ZdS)?z@Extract, format and print information about Python stack traces.�N�
extract_stack�
extract_tb�format_exception�format_exception_only�format_list�format_stack�	format_tb�	print_exc�
format_exc�print_exception�
print_last�print_stack�print_tb�clear_frames�FrameSummary�StackSummary�TracebackException�
walk_stack�walk_tbcCs4|dkrtj}t�|���D]}t||dd�qdS)zyPrint the list of tuples as returned by extract_tb() or
    extract_stack() as a formatted stack trace to the given file.N���file�end)�sys�stderrr�	from_list�format�print)�extracted_listr�item�r �!/usr/lib64/python3.8/traceback.py�
print_listsr"cCst�|���S)a�Format a list of tuples or FrameSummary objects for printing.

    Given a list of tuples or FrameSummary objects as returned by
    extract_tb() or extract_stack(), return a list of strings ready
    for printing.

    Each string in the resulting list corresponds to the item with the
    same index in the argument list.  Each string ends in a newline;
    the strings may contain internal newlines as well, for those items
    whose source text line is not None.
    )rrr)rr r r!rscCstt||d�|d�dS)aPrint up to 'limit' stack trace entries from the traceback 'tb'.

    If 'limit' is omitted or None, all entries are printed.  If 'file'
    is omitted or None, the output goes to sys.stderr; otherwise
    'file' should be an open file or file-like object with a write()
    method.
    ��limit�rN)r"r)�tbr$rr r r!r-scCst||d���S)z5A shorthand for 'format_list(extract_tb(tb, limit))'.r#)rr�r&r$r r r!r7scCstjt|�|d�S)a#
    Return a StackSummary object representing a list of
    pre-processed entries from traceback.

    This is useful for alternate formatting of stack traces.  If
    'limit' is omitted or None, all entries are extracted.  A
    pre-processed stack trace entry is a FrameSummary object
    containing attributes filename, lineno, name, and line
    representing the information that is usually printed for a stack
    trace.  The line is a string with leading and trailing
    whitespace stripped; if the source is not available it is None.
    r#)r�extractrr'r r r!r;s
zG
The above exception was the direct cause of the following exception:

zF
During handling of the above exception, another exception occurred:

TcCsB|dkrtj}tt|�|||d�j|d�D]}t||dd�q*dS)a�Print exception up to 'limit' stack trace entries from 'tb' to 'file'.

    This differs from print_tb() in the following ways: (1) if
    traceback is not None, it prints a header "Traceback (most recent
    call last):"; (2) it prints the exception type and value after the
    stack trace; (3) if type is SyntaxError and value has the
    appropriate format, it prints the line where the syntax error
    occurred with a caret on the next line indicating the approximate
    position of the error.
    Nr#��chainrr)rrr�typerr)�etype�valuer&r$rr*�liner r r!rWs��
cCs ttt|�|||d�j|d��S)azFormat a stack trace and the exception information.

    The arguments have the same meaning as the corresponding arguments
    to print_exception().  The return value is a list of strings, each
    ending in a newline and some containing internal newlines.  When
    these lines are concatenated and printed, exactly the same text is
    printed as does print_exception().
    r#r))�listrr+r)r,r-r&r$r*r r r!rls��cCstt||d����S)aFormat the exception part of a traceback.

    The arguments are the exception type and value such as given by
    sys.last_type and sys.last_value. The return value is a list of
    strings, each ending in a newline.

    Normally, the list contains a single string; however, for
    SyntaxError exceptions, it contains several lines that (when
    printed) display detailed information about where the syntax
    error occurred.

    The message indicating which exception occurred is always the last
    string in the list.

    N)r/rr)r,r-r r r!r|scCs.t|�}|dks|sd|}nd||f}|S)Nz%s
z%s: %s
)�	_some_str)r,r-�valuestrr.r r r!�_format_final_exc_line�s

r2cCs*z
t|�WSdt|�jYSXdS)Nz<unprintable %s object>)�strr+�__name__)r-r r r!r0�s
r0cCstt��|||d��dS)z>Shorthand for 'print_exception(*sys.exc_info(), limit, file)'.�r$rr*N)rr�exc_infor5r r r!r	�scCsd�tt��||d���S)z%Like print_exc() but return a string.r�r$r*)�joinrrr6r7r r r!r
�scCs.ttd�std��ttjtjtj|||�dS)znThis is a shorthand for 'print_exception(sys.last_type,
    sys.last_value, sys.last_traceback, limit, file)'.�	last_typezno last exceptionN)�hasattrr�
ValueErrorrr9�
last_value�last_tracebackr5r r r!r�s
�cCs*|dkrt��j}tt||d�|d�dS)z�Print a stack trace from its invocation point.

    The optional 'f' argument can be used to specify an alternate
    stack frame at which to start. The optional 'limit' and 'file'
    arguments have the same meaning as for print_exception().
    Nr#r%)r�	_getframe�f_backr"r)�fr$rr r r!r
�s
cCs"|dkrt��j}tt||d��S)z5Shorthand for 'format_list(extract_stack(f, limit))'.Nr#)rr>r?rr)r@r$r r r!r�s
cCs0|dkrt��j}tjt|�|d�}|��|S)asExtract the raw traceback from the current stack frame.

    The return value has the same format as for extract_tb().  The
    optional 'f' and 'limit' arguments have the same meaning as for
    print_stack().  Each item in the list is a quadruple (filename,
    line number, function name, text), and the entries are in order
    from oldest to newest stack frame.
    Nr#)rr>r?rr(r�reverse)r@r$�stackr r r!r�s
	
cCs8|dk	r4z|j��Wntk
r*YnX|j}qdS)zEClear all references to local variables in the frames of a traceback.N)�tb_frame�clear�RuntimeError�tb_next�r&r r r!r�sc@sZeZdZdZdZdddd�dd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
edd��ZdS)ra,A single frame from a traceback.

    - :attr:`filename` The filename for the frame.
    - :attr:`lineno` The line within filename for the frame that was
      active when the frame was captured.
    - :attr:`name` The name of the function or method that was executing
      when the frame was captured.
    - :attr:`line` The text from the linecache module for the
      of code that was running when the frame was captured.
    - :attr:`locals` Either None if locals were not supplied, or a dict
      mapping the name to the repr() of the variable.
    )�filename�lineno�name�_line�localsTN)�lookup_linerLr.cCsB||_||_||_||_|r"|j|r8dd�|��D�nd|_dS)a�Construct a FrameSummary.

        :param lookup_line: If True, `linecache` is consulted for the source
            code line. Otherwise, the line will be looked up when first needed.
        :param locals: If supplied the frame locals, which will be captured as
            object representations.
        :param line: If provided, use this instead of looking up the line in
            the linecache.
        cSsi|]\}}|t|��qSr )�repr)�.0�k�vr r r!�
<dictcomp>sz)FrameSummary.__init__.<locals>.<dictcomp>N)rHrIrJrKr.�itemsrL)�selfrHrIrJrMrLr.r r r!�__init__�szFrameSummary.__init__cCs`t|t�r:|j|jko8|j|jko8|j|jko8|j|jkSt|t�r\|j|j|j|jf|kStS�N)	�
isinstancerrHrIrJrL�tupler.�NotImplemented�rT�otherr r r!�__eq__s

�
�
�
zFrameSummary.__eq__cCs|j|j|j|jf|SrV)rHrIrJr.)rT�posr r r!�__getitem__szFrameSummary.__getitem__cCst|j|j|j|jg�SrV)�iterrHrIrJr.�rTr r r!�__iter__szFrameSummary.__iter__cCsdj|j|j|jd�S)Nz7<FrameSummary file {filename}, line {lineno} in {name}>)rHrIrJ)rrHrIrJr`r r r!�__repr__s
�zFrameSummary.__repr__cCsdS)N�r r`r r r!�__len__szFrameSummary.__len__cCs&|jdkr t�|j|j���|_|jSrV)rK�	linecache�getlinerHrI�stripr`r r r!r.s
zFrameSummary.line)
r4�
__module__�__qualname__�__doc__�	__slots__rUr\r^rarbrd�propertyr.r r r r!r�s
�
ccs4|dkrt��jj}|dk	r0||jfV|j}qdS)z�Walk a stack yielding the frame and line number for each frame.

    This will follow f.f_back from the given frame. If no frame is given, the
    current stack is used. Usually used with StackSummary.extract.
    N)rr>r?�f_lineno)r@r r r!r$s
ccs"|dk	r|j|jfV|j}qdS)z�Walk a traceback yielding the frame and line number for each frame.

    This will follow tb.tb_next (and thus is in the opposite order to
    walk_stack). Usually used with StackSummary.extract.
    N)rC�	tb_linenorFrGr r r!r1s�c@s:eZdZdZedddd�dd��Zedd	��Zd
d�ZdS)rzA stack of frames.NTF�r$�lookup_lines�capture_localsc

Cs�|dkr(ttdd�}|dk	r(|dkr(d}|dk	rV|dkrFt�||�}ntj||d�}|�}t�}|D]Z\}}|j}	|	j}
|	j	}|�
|
�t�|
|j
�|r�|j}nd}|�t|
||d|d��qf|D]}
t�|
�q�|r�|D]
}|jq�|S)a?Create a StackSummary from a traceback or stack object.

        :param frame_gen: A generator that yields (frame, lineno) tuples to
            include in the stack.
        :param limit: None to include all frames or the number of frames to
            include.
        :param lookup_lines: If True, lookup lines for each frame immediately,
            otherwise lookup is deferred until the frame is rendered.
        :param capture_locals: If True, the local variables from each frame will
            be captured as object representations into the FrameSummary.
        N�tracebacklimitr)�maxlenF)rMrL)�getattrr�	itertools�islice�collections�deque�set�f_code�co_filename�co_name�addre�	lazycache�	f_globals�f_locals�appendr�
checkcacher.)
�klass�	frame_genr$rqrr�result�fnamesr@rI�corHrJr�r r r!r(As@
�
zStackSummary.extractc	CsLt�}|D]<}t|t�r$|�|�q
|\}}}}|�t||||d��q
|S)z�
        Create a StackSummary object from a supplied list of
        FrameSummary objects or old-style list of tuples.
        )r.)rrWrr�)r��a_listr��framerHrIrJr.r r r!rqs

zStackSummary.from_listc
Csng}d}d}d}d}|D�]}|dksT||jksT|dksT||jksT|dksT||jkr�|tkr�|t8}|�d|�d|dkr|dnd�d��|j}|j}|j}d}|d7}|tkr�qg}|�d	�|j|j|j��|jr�|�d
�|j����|j�r t	|j�
��D]\}}	|�dj||	d���q|�d�|��q|tk�rj|t8}|�d|�d|dk�r^dnd�d��|S)
aFormat the stack ready for printing.

        Returns a list of strings ready for printing.  Each string in the
        resulting list corresponds to a single frame from the stack.
        Each string ends in a newline; the strings may contain internal
        newlines as well, for those items with source text lines.

        For long sequences of the same frame and line, the first few
        repetitions are shown, followed by a summary line stating the exact
        number of further repetitions.
        Nrz  [Previous line repeated z
 more time��srz]
z  File "{}", line {}, in {}
�    {}
z    {name} = {value}
)rJr-)rHrIrJ�_RECURSIVE_CUTOFFr�rr.rgrL�sortedrSr8)
rTr��	last_file�	last_line�	last_name�countr��rowrJr-r r r!r�sZ
������
�zStackSummary.format)r4rhrirj�classmethodr(rrr r r r!r>s�/
c@s^eZdZdZddddd�dd�Zedd	��Zd
d�Zdd
�Zdd�Z	dd�Z
dd�dd�ZdS)ra�An exception ready for rendering.

    The traceback module captures enough attributes from the original exception
    to this intermediary form to ensure that no references are held, while
    still being able to fully print or format it.

    Use `from_exception` to create TracebackException instances from exception
    objects, or the constructor to create TracebackException instances from
    individual components.

    - :attr:`__cause__` A TracebackException of the original *__cause__*.
    - :attr:`__context__` A TracebackException of the original *__context__*.
    - :attr:`__suppress_context__` The *__suppress_context__* value from the
      original exception.
    - :attr:`stack` A `StackSummary` representing the traceback.
    - :attr:`exc_type` The class of the original traceback.
    - :attr:`filename` For syntax errors - the filename where the error
      occurred.
    - :attr:`lineno` For syntax errors - the linenumber where the error
      occurred.
    - :attr:`text` For syntax errors - the text where the error
      occurred.
    - :attr:`offset` For syntax errors - the offset into the text where the
      error occurred.
    - :attr:`msg` For syntax errors - the compiler error message.
    NTF�r$rqrr�_seenc	CsJ|dkrt�}|�t|��|r\|jdk	r\t|j�|kr\tt|j�|j|jj|d||d�}nd}|r�|jdk	r�t|j�|kr�tt|j�|j|jj|d||d�}	nd}	||_|	|_|r�|jnd|_t	j
t|�|||d�|_||_
t|�|_|�r8t|t��r8|j|_|j}
|
dk	�rt|
�nd|_|j|_|j|_|j|_|�rF|��dS)NFr�rp)rzr~�id�	__cause__rr+�
__traceback__�__context__�__suppress_context__rr(rrB�exc_typer0�_str�
issubclass�SyntaxErrorrHrIr3�text�offset�msg�_load_lines)rTr��	exc_value�
exc_tracebackr$rqrrr��cause�context�lnor r r!rU�sd��	��	��
zTracebackException.__init__cOs|t|�||jf|�|�S)z.Create a TracebackException from an exception.)r+r�)�cls�exc�args�kwargsr r r!�from_exceptionsz!TracebackException.from_exceptioncCs6|jD]
}|jq|jr"|j��|jr2|j��dS)z7Private API. force all lines in the stack to be loaded.N)rBr.r�r�r�)rTr�r r r!r�s

zTracebackException._load_linescCs|j|jkSrV)�__dict__rZr r r!r\szTracebackException.__eq__cCs|jSrV)r�r`r r r!�__str__szTracebackException.__str__ccs6|jdkrtd|j�VdS|jj}|jj}|dkr@|d|}t|jt�s^t||j�VdSd}|jdk	r�d�|j	pxd|j�Vn|j	dk	r�d�|j	�}|j
}|j}|dk	�rd�|���V|dk	�r|�
d	�}tt|�|�d
}|d|���}dd�|D�}d
�d�|��V|j�p d}d�|||�VdS)a�Format the exception part of the traceback.

        The return value is a generator of strings, each ending in a newline.

        Normally, the generator emits a single string; however, for
        SyntaxError exceptions, it emits several lines that (when
        printed) display detailed information about where the syntax
        error occurred.

        The message indicating which exception occurred is always the last
        string in the output.
        N)�__main__�builtins�.rz  File "{}", line {}
z<string>z ({})r��
r�css|]}|��r|pdVqdS)� N)�isspace)rO�cr r r!�	<genexpr>Msz;TracebackException.format_exception_only.<locals>.<genexpr>z    {}^
z<no detail available>z	{}: {}{}
)r�r2r�rirhr�r�rIrrHr�r�rg�rstrip�min�len�lstripr8r�)rT�stype�smod�filename_suffix�badliner��
caretspacer�r r r!r"s<

�



z(TracebackException.format_exception_onlyr)ccs�|rT|jdk	r*|jj|d�EdHtVn*|jdk	rT|jsT|jj|d�EdHtV|jrpdV|j��EdH|��EdHdS)a�Format the exception.

        If chain is not *True*, *__cause__* and *__context__* will not be formatted.

        The return value is a generator of strings, each ending in a newline and
        some containing internal newlines. `print_exception` is a wrapper around
        this method which just prints the lines to a file.

        The message indicating which exception occurred is always the last
        string in the output.
        Nr)z#Traceback (most recent call last):
)r�r�_cause_messager�r��_context_messagerBr)rTr*r r r!rRs

�zTracebackException.format)r4rhrirjrUr�r�r�r\r�rrr r r r!r�s�:
	0)N)NN)N)N)NNT)NT)NNT)NT)NNT)NNN)NN)NN) rjrxrvrer�__all__r"rrrrr�r�rrrr2r0r	r
rr
rrrrrrr�r/rrr r r r!�<module>sb�




��







A
zpathlib.cpython-38.opt-2.pyc000064400000105313150335716500011567 0ustar00U

e5d���@sjddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
mZmZddlmZddlmZmZmZmZmZmZmZddlmZdZejdkr�ddlZe� �dd	�d
kr�ddlm!Z!q�dZdZ!ndZd
dddddgZ"ee
eefZ#dZ$dd�Z%dd�Z&Gdd�de'�Z(Gdd�de(�Z)Gdd�de(�Z*e)�Z+e*�Z,Gdd�d�Z-Gd d!�d!e-�Z.e.�Z/d"d#�Z0e1ed$��r�e�2�e0�Z0Gd%d&�d&�Z3Gd'd(�d(�Z4Gd)d*�d*e3�Z5Gd+d,�d,e3�Z6Gd-d.�d.e3�Z7Gd/d0�d0e	�Z8Gd1d
�d
e'�Z9ej:�;e9�Gd2d�de9�Z<Gd3d�de9�Z=Gd4d�de9�Z>Gd5d�de>e<�Z?Gd6d�de>e=�Z@dS)7�N)�Sequence)�EINVAL�ENOENT�ENOTDIR�EBADF�ELOOP)�
attrgetter)�S_ISDIR�S_ISLNK�S_ISREG�S_ISSOCK�S_ISBLK�S_ISCHR�S_ISFIFO)�quote_from_bytesT�nt�)�r)�_getfinalpathnameF�PurePath�
PurePosixPath�PureWindowsPath�Path�	PosixPath�WindowsPath)��{i�cCs t|dd�tkpt|dd�tkS)N�errnoZwinerror)�getattr�_IGNORED_ERROS�_IGNORED_WINERRORS)Z	exception�r!�/usr/lib64/python3.8/pathlib.py�
_ignore_error.s�r#cCsd|kpd|kpd|kS)N�*�?�[r!)�patr!r!r"�_is_wildcard_pattern3sr(c@s$eZdZdd�Zdd�Zdd�ZdS)�_FlavourcCs|jj|_dS�N)�sep�join��selfr!r!r"�__init__=sz_Flavour.__init__cCsg}|j}|j}d}}t|�}|D]�}|s.q$|r>|�||�}|�|�\}}}	||	kr�t|	�|��D] }
|
rd|
dkrd|�t�|
��qdn|	r�|	dkr�|�t�|	��|s�|r$|s�|D]0}|s�q�|r�|�||�}|�|�d}|r�q�q�q�q$|s�|�r|�||�|�	�|||fS)N��.r)
r+�altsep�reversed�replace�	splitroot�split�append�sys�intern�reverse)r.�partsZparsedr+r2�drv�root�it�partZrel�xr!r!r"�parse_parts@s@
z_Flavour.parse_partscCsz|r*|sp|rp||||g|dd�fSnF|rb||ksJ|�|�|�|�krp||||dd�fSn||||fS|||fS�N�)�casefold)r.r<r=r;Zdrv2Zroot2Zparts2r!r!r"�join_parsed_partsfsz_Flavour.join_parsed_partsN)�__name__�
__module__�__qualname__r/rArEr!r!r!r"r)9s&r)c@s�eZdZdZdZdZeZej	dkZ
ed�ZdZ
ddd	d
hdd�ed
d�D�Bdd�ed
d�D�BZefdd�Zdd�Zdd�Zdd�Zd&dd�Ze
fdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%S)'�_WindowsFlavour�\�/TrZ4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZz\\?\ZCONZPRNZAUXZNULcCsh|]}d|�qS)zCOM%dr!��.0�ir!r!r"�	<setcomp>�sz_WindowsFlavour.<setcomp>rC�
cCsh|]}d|�qS)zLPT%dr!rLr!r!r"rO�scCs\|dd�}|dd�}||krP||krP|�|�\}}|dd�}|dd�}nd}|dd�}||kr�||kr�||kr�|�|d�}|dkr�|�||d�}||dkr�|dkr�t|�}|r�||d|�|||dd�fS|d|�|||dd�fSd}	}
|dk�r6||jk�r6|dd�}	|dd�}|}||k�rN|}
|�|�}||	|
|fS)NrrCrr0�����:)�_split_extended_path�find�len�
drive_letters�lstrip)r.r?r+�first�second�prefixZthird�indexZindex2r<r=r!r!r"r5�s6"

z_WindowsFlavour.splitrootcCs|��Sr*��lower�r.�sr!r!r"rD�sz_WindowsFlavour.casefoldcCsdd�|D�S)NcSsg|]}|���qSr!r])rM�pr!r!r"�
<listcomp>�sz2_WindowsFlavour.casefold_parts.<locals>.<listcomp>r!�r.r;r!r!r"�casefold_parts�sz_WindowsFlavour.casefold_partscCst�t�|�tj�jSr*)�re�compile�fnmatch�	translate�
IGNORECASE�	fullmatch�r.�patternr!r!r"�compile_pattern�sz_WindowsFlavour.compile_patternFcCs�t|�}|st��Sd}tdk	r�|r2|�t|��Sg}z|�t|��}WnBtk
r�|}tj�|�\}}|�|�||kr�|YSYq6Xtjj	|ft
|���Sq6dSr*)�str�os�getcwdr�_ext_to_normal�FileNotFoundError�pathr6r7r,r3)r.rs�strictr`Z
previous_sZ
tail_parts�tailr!r!r"�resolve�s$
z_WindowsFlavour.resolvecCsXd}|�|�rP|dd�}|dd�}|�d�rP||dd�7}d|dd�}||fS)Nr0�zUNC\rQrJ)�
startswith)r.r`Z
ext_prefixr[r!r!r"rT�s

z$_WindowsFlavour._split_extended_pathcCs|�|�dSrB)rTr_r!r!r"rq�sz_WindowsFlavour._ext_to_normalcCs6|sdS|d�d�rdS|d�d�d��|jkS)NFrz\\rRr1)rx�	partition�upper�reserved_namesrcr!r!r"�is_reserved�s
z_WindowsFlavour.is_reservedcCsd|j}t|�dkrJ|ddkrJ|��dd��d�}d|t|�d��fSdt|���d��SdS)NrrCrSrKz
file:///%s/%szutf-8zfile:)�driverV�as_posixrX�urlquote_from_bytes�encode)r.rsr}�restr!r!r"�make_uri�s�z_WindowsFlavour.make_uricCs�dtjkrtjd}nJdtjkrXztjd}Wntk
rFd}YnX|tjd}ntd��|r�tjd|kr�|�|f�\}}}|dtjdkr�td|��||d<|s�|r�|||�|d	d��}n
|�|�}|S)
NZUSERPROFILEZHOMEPATHZ	HOMEDRIVEr0zCan't determine home directoryZUSERNAMErR�%Can't determine home directory for %rrC)ro�environ�KeyError�RuntimeErrorrAr,)r.�username�userhomer<r=r;r!r!r"�
gethomedirs*


�
z_WindowsFlavour.gethomedirN)F)rFrGrHr+r2�has_drv�ntpath�pathmodro�name�is_supported�setrWZext_namespace_prefix�ranger{r5rDrdrmrvrTrqr|r�r�r!r!r!r"rIxs.

���'

rIc@sleZdZdZdZdZeZej	dkZ
efdd�Zdd�Zd	d
�Z
dd�Zdd
d�Zdd�Zdd�Zdd�ZdS)�
_PosixFlavourrKr0FrcCsV|rH|d|krH|�|�}t|�t|�dkr<d|d|fSd||fSn
dd|fSdS)Nrrr0)rXrV)r.r?r+Z
stripped_partr!r!r"r5%s
z_PosixFlavour.splitrootcCs|Sr*r!r_r!r!r"rD4sz_PosixFlavour.casefoldcCs|Sr*r!rcr!r!r"rd7sz_PosixFlavour.casefold_partscCst�t�|��jSr*)rerfrgrhrjrkr!r!r"rm:sz_PosixFlavour.compile_patterncsJ|j�|j�i������fdd��|��r0dnt��}�|t|��pH�S)Ncs�|���rd}|���D]�}|r|dkr*q|dkrD|���\}}}q|���rX||}n|�|}|�kr��|}|dk	r~qtd|��z��|�}Wn6tk
r�}z|jtkr��r��|}W5d}~XYqXd�|<�||�}|�|<q|S)Nr0r1�..zSymlink loop from %r)	rxr6�
rpartition�endswithr��readlink�OSErrorrr)rsr�r��_�newpath�target�e��_resolveZaccessor�seenr+rtr!r"r�As4




z'_PosixFlavour.resolve.<locals>._resolver0)r+�	_accessor�is_absoluterorprn)r.rsrt�baser!r�r"rv=s)z_PosixFlavour.resolvecCsdS�NFr!rcr!r!r"r|msz_PosixFlavour.is_reservedcCst|�}dt|�S)Nzfile://)�bytesr)r.rsZbpathr!r!r"r�psz_PosixFlavour.make_uricCs||s@ztjdWStk
r<ddl}|�t���jYSXn8ddl}z|�|�jWStk
rvtd|��YnXdS)N�HOMErr�)	ror�r��pwd�getpwuid�getuid�pw_dir�getpwnamr�)r.r�r�r!r!r"r�vs�z_PosixFlavour.gethomedirN)F)rFrGrHr+r2r��	posixpathr�ror�r�r5rDrdrmrvr|r�r�r!r!r!r"r�s

0r�c@seZdZdS)�	_AccessorN)rFrGrHr!r!r!r"r��sr�c@s�eZdZejZejZejZejZejZej	Z	e
ed�r>ejZndd�ZejZej
Z
e
ed�rdejZnedd��ZejZejZejZer�er�ejZq�dd�Zned	d��ZejZd
d�ZdS)
�_NormalAccessor�lchmodcCstd��dS)Nz%lchmod() not available on this system��NotImplementedError)r.Zpathobj�moder!r!r"r��sz_NormalAccessor.lchmod�linkcCstd��dS)Nz&os.link() not available on this systemr��r.r�r!r!r"�link_to�sz_NormalAccessor.link_tocCstd��dS)Nz&symlink() not available on this systemr���a�b�target_is_directoryr!r!r"�symlink�sz_NormalAccessor.symlinkcCst�||�Sr*)ror�r�r!r!r"r��scCs
t�|�Sr*)ror��r.rsr!r!r"r��sz_NormalAccessor.readlinkN)rFrGrHro�stat�lstat�open�listdir�scandir�chmod�hasattrr��mkdir�unlinkr�r��staticmethod�rmdir�renamer4r�supports_symlinksr��utimer�r!r!r!r"r��s4




r�cCsR|d}|dd�}|dkr"t}n$d|kr4td��nt|�rBt}nt}||||�S)NrrC�**z:Invalid pattern: '**' can only be an entire path component)�_RecursiveWildcardSelector�
ValueErrorr(�_WildcardSelector�_PreciseSelector)�
pattern_parts�flavourr'�child_parts�clsr!r!r"�_make_selector�s
r��	lru_cachec@seZdZdd�Zdd�ZdS)�	_SelectorcCs0||_|rt||�|_d|_nt�|_d|_dS)NTF)r�r��	successor�dironly�_TerminatingSelector)r.r�r�r!r!r"r/�sz_Selector.__init__cCs<t|�}|j}|j}|jj}||�s,tg�S|�||||�Sr*)�type�is_dir�existsr�r��iter�_select_from)r.�parent_pathZpath_clsr�r�r�r!r!r"�select_from�sz_Selector.select_fromN)rFrGrHr/r�r!r!r!r"r��s	r�c@seZdZdd�ZdS)r�ccs
|VdSr*r!)r.r�r�r�r�r!r!r"r��sz!_TerminatingSelector._select_fromN)rFrGrHr�r!r!r!r"r��sr�c@seZdZdd�Zdd�ZdS)r�cCs||_t�|||�dSr*)r�r�r/)r.r�r�r�r!r!r"r/sz_PreciseSelector.__init__ccs\z@|�|j�}|jr|n||�r>|j�||||�D]
}|Vq2Wntk
rVYdSXdSr*)�_make_child_relpathr�r�r�r��PermissionError)r.r�r�r�r�rsrar!r!r"r�sz_PreciseSelector._select_fromN�rFrGrHr/r�r!r!r!r"r��sr�c@seZdZdd�Zdd�ZdS)r�cCs|�|�|_t�|||�dSr*)rm�matchr�r/�r.r'r�r�r!r!r"r/sz_WildcardSelector.__init__ccs�z�||��}t|�}W5QRX|D]�}|jrrz|��s:Wq"Wn4tk
rp}zt|�sX�WY�q"W5d}~XYnX|j}	|�|	�r"|�|	�}
|j�	|
|||�D]
}|Vq�q"Wnt
k
r�YdSXdSr*)�listr�r�r�r#r�r�r�r�r�r�)r.r�r�r�r��
scandir_it�entries�entryr�r�rsrar!r!r"r�s&


z_WildcardSelector._select_fromNr�r!r!r!r"r�sr�c@s$eZdZdd�Zdd�Zdd�ZdS)r�cCst�|||�dSr*)r�r/r�r!r!r"r//sz#_RecursiveWildcardSelector.__init__ccs�|Vz�||��}t|�}W5QRX|D]t}d}z|��}Wn,tk
rh}zt|�sX�W5d}~XYnX|r(|��s(|�|j�}	|�|	||�D]
}
|
Vq�q(Wntk
r�YdSXdSr�)	r�r�r�r#�
is_symlinkr�r��_iterate_directoriesr�)r.r�r�r�r�r�r�Zentry_is_dirr�rsrar!r!r"r�2s"
z/_RecursiveWildcardSelector._iterate_directoriesc	cs~zbt�}zL|jj}|�|||�D]0}|||||�D]}||kr2|V|�|�q2q W5|��XWntk
rxYdSXdSr*)r��clearr�r�r��addr�)	r.r�r�r�r�ZyieldedZsuccessor_selectZstarting_pointrar!r!r"r�Esz'_RecursiveWildcardSelector._select_fromN)rFrGrHr/r�r�r!r!r!r"r�-sr�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_PathParents)�_pathcls�_drv�_root�_partscCs&t|�|_|j|_|j|_|j|_dSr*)r�r�r�r�r�r�r!r!r"r/^s
z_PathParents.__init__cCs(|js|jrt|j�dSt|j�SdSrB)r�r�rVr�r-r!r!r"�__len__esz_PathParents.__len__cCs@|dks|t|�krt|��|j�|j|j|jd|d��S)NrrC)rV�
IndexErrorr��_from_parsed_partsr�r�r�)r.�idxr!r!r"�__getitem__ks
�z_PathParents.__getitem__cCsd�|jj�S)Nz<{}.parents>)�formatr�rFr-r!r!r"�__repr__qsz_PathParents.__repr__N)rFrGrH�	__slots__r/r�r�r�r!r!r!r"r�Ys
r�c@s�eZdZdZdd�Zdd�Zedd��ZedUd	d
��ZedVdd��Z	ed
d��Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zedd ��Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zeed-�d.d/�Zeed0�d1d/�Zed2d3��Zed4d5��Zed6d7��Z ed8d9��Z!ed:d;��Z"d<d=�Z#d>d?�Z$d@dA�Z%edBdC��Z&dDdE�Z'dFdG�Z(dHdI�Z)edJdK��Z*edLdM��Z+dNdO�Z,dPdQ�Z-dRdS�Z.dTS)Wr)r�r�r��_str�_hash�_pparts�_cached_cpartscGs$|tkrtjdkrtnt}|�|�S)Nr)rror�rr�_from_parts)r��argsr!r!r"�__new__�szPurePath.__new__cCs|jt|j�fSr*)�	__class__�tupler�r-r!r!r"�
__reduce__�szPurePath.__reduce__cCsdg}|D]N}t|t�r"||j7}qt�|�}t|t�rF|�t|��qtdt|���q|j	�
|�S)NzNargument should be a str object or an os.PathLike object returning str, not %r)�
isinstancerr�ro�fspathrnr7�	TypeErrorr��_flavourrA)r�r�r;r�r!r!r"�_parse_args�s


��zPurePath._parse_argsTcCs<t�|�}|�|�\}}}||_||_||_|r8|��|Sr*)�objectr�rr�r�r��_init)r�r��initr.r<r=r;r!r!r"r��s
zPurePath._from_partscCs,t�|�}||_||_||_|r(|��|Sr*)rr�r�r�r�r)r�r<r=r;rr.r!r!r"r��s
zPurePath._from_parsed_partscCs4|s|r$|||j�|dd��S|j�|�SdSrB)rr,)r�r<r=r;r!r!r"�_format_parsed_parts�szPurePath._format_parsed_partscCsdSr*r!r-r!r!r"r�szPurePath._initcCs@|�|�\}}}|j�|j|j|j|||�\}}}|�|||�Sr*)rrrEr�r�r�r�)r.r�r<r=r;r!r!r"�_make_child�s�
zPurePath._make_childcCsBz|jWStk
r<|�|j|j|j�p.d|_|jYSXdS)Nr1)r��AttributeErrorr	r�r�r�r-r!r!r"�__str__�s��zPurePath.__str__cCst|�Sr*)rnr-r!r!r"�
__fspath__�szPurePath.__fspath__cCs|j}t|��|jd�S)NrK)rrnr4r+�r.�fr!r!r"r~�szPurePath.as_posixcCs
t�|�Sr*)ro�fsencoder-r!r!r"�	__bytes__�szPurePath.__bytes__cCsd�|jj|���S)Nz{}({!r}))r�r�rFr~r-r!r!r"r��szPurePath.__repr__cCs|��std��|j�|�S)Nz.relative path can't be expressed as a file URI)r�r�rr�r-r!r!r"�as_uri�szPurePath.as_uricCs8z|jWStk
r2|j�|j�|_|jYSXdSr*)r�rrrdr�r-r!r!r"�_cparts�s
zPurePath._cpartscCs&t|t�stS|j|jko$|j|jkSr*)rr�NotImplementedrr�r.�otherr!r!r"�__eq__�s
zPurePath.__eq__cCs8z|jWStk
r2tt|j��|_|jYSXdSr*)r�r�hashr�rr-r!r!r"�__hash__�s
zPurePath.__hash__cCs&t|t�r|j|jk	rtS|j|jkSr*�rrrrrrr!r!r"�__lt__szPurePath.__lt__cCs&t|t�r|j|jk	rtS|j|jkSr*rrr!r!r"�__le__	szPurePath.__le__cCs&t|t�r|j|jk	rtS|j|jkSr*rrr!r!r"�__gt__szPurePath.__gt__cCs&t|t�r|j|jk	rtS|j|jkSr*rrr!r!r"�__ge__szPurePath.__ge__r�z.The drive prefix (letter or UNC path), if any.)�docr�zThe root of the path, if any.cCs|j|j}|Sr*)r�r�)r.�anchorr!r!r"r szPurePath.anchorcCs.|j}t|�|js|jrdndkr&dS|dS)NrCrr0rR)r�rVr�r�rcr!r!r"r�$sz
PurePath.namecCsD|j}|�d�}d|kr,t|�dkr<nn||d�SdSdS)Nr1rrCr0�r��rfindrV�r.r�rNr!r!r"�suffix,s

 zPurePath.suffixcCs:|j}|�d�rgS|�d�}dd�|�d�dd�D�S)Nr1cSsg|]}d|�qS)r1r!)rMr$r!r!r"rbEsz%PurePath.suffixes.<locals>.<listcomp>rC)r�r�rXr6�r.r�r!r!r"�suffixes:s


zPurePath.suffixescCsD|j}|�d�}d|kr,t|�dkr<nn|d|�S|SdS)Nr1rrCr!r#r!r!r"�stemGs

 z
PurePath.stemcCs�|jstd|f��|j�|f�\}}}|rX|d|jj|jjfksX|sX|sXt|�dkrdtd|��|�|j|j	|j
dd�|g�S)N�%r has an empty namerRrCzInvalid name %r)r�r�rrAr+r2rVr�r�r�r�)r.r�r<r=r;r!r!r"�	with_nameQs��
��zPurePath.with_namecCs�|j}|j|ks |jr.|j|kr.td|f��|r<|�d�rD|dkrPtd|��|j}|shtd|f��|j}|s|||}n|dt|��|}|�|j	|j
|jdd�|g�S)NzInvalid suffix %rr1r(rR)rr+r2r�rxr�r$rVr�r�r�r�)r.r$rr�Z
old_suffixr!r!r"�with_suffix\s
�zPurePath.with_suffixc
Gs�|std��|j}|j}|j}|r8||g|dd�}n|}|�|�\}}}|rf||g|dd�}	n|}	t|	�}
|jj}|
dkr�|s�|r�n||d|
��||	�kr�|�|||�}t	d�
t|�t|����|�d|
dkr�|nd||
d��S)Nzneed at least one argumentrCrz{!r} does not start with {!r}r0)
rr�r�r�rrVrrdr	r�r�rnr�)
r.rr;r<r=Z	abs_partsZto_drvZto_rootZto_partsZto_abs_parts�n�cfZ	formattedr!r!r"�relative_toqs.	*�
�zPurePath.relative_tocCs4z|jWStk
r.t|j�|_|jYSXdSr*)r�rr�r�r-r!r!r"r;�s
zPurePath.partscGs
|�|�Sr*)r
)r.r�r!r!r"�joinpath�szPurePath.joinpathcCs,z|�|f�WStk
r&tYSXdSr*)r
rr�r.�keyr!r!r"�__truediv__�szPurePath.__truediv__cCs2z|�|g|j�WStk
r,tYSXdSr*)r�r�rrr/r!r!r"�__rtruediv__�szPurePath.__rtruediv__cCs@|j}|j}|j}t|�dkr*|s&|r*|S|�|||dd��S)NrCrR)r�r�r�rVr�)r.r<r=r;r!r!r"�parent�szPurePath.parentcCst|�Sr*)r�r-r!r!r"�parents�szPurePath.parentscCs|js
dS|jjpt|j�Sr�)r�rr��boolr�r-r!r!r"r��szPurePath.is_absolutecCs|j�|j�Sr*)rr|r�r-r!r!r"r|�szPurePath.is_reservedc	Cs�|jj}||�}|j�|f�\}}}|s0td��|rF|||j�krFdS|r\|||j�kr\dS|j}|sj|r�t|�t|�kr~dS|dd�}nt|�t|�kr�dStt	|�t	|��D]\}}t
�||�s�dSq�dS)Nz
empty patternFrCT)rrDrAr�r�r�rrV�zipr3rgZfnmatchcase)	r.Zpath_patternr,r<r=Z	pat_partsr;r?r'r!r!r"r��s(zPurePath.matchN)T)T)/rFrGrHr�r�r�classmethodrr�r�r	rr
rr
r~rr�r�propertyrrrrrrrrr}r=r r�r$r&r'r)r*r-r;r.r1r2r3r4r�r|r�r!r!r!r"rust	

	


��





	 

	
c@seZdZeZdZdS)rr!N)rFrGrH�_posix_flavourrr�r!r!r!r"r�sc@seZdZeZdZdS)rr!N)rFrGrH�_windows_flavourrr�r!r!r!r"r�sc@s�eZdZdZdd�Zdcdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dddd�Z
dedd�Zedd��Z
edd��Zdd�Zdd�Zdd�Zdd �Zd!d"�Zdfd$d%�Zd&d'�Zd(d)�Zd*d+�Zdgd.d/�Zd0d1�Zdhd2d3�Zd4d5�Zdid6d7�Zdjd9d:�Zdkd;d<�Zd=d>�Zd?d@�Z dldAdB�Z!dCdD�Z"dEdF�Z#dGdH�Z$dIdJ�Z%dmdKdL�Z&dMdN�Z'dOdP�Z(dQdR�Z)dSdT�Z*dUdV�Z+dWdX�Z,dYdZ�Z-d[d\�Z.d]d^�Z/d_d`�Z0dadb�Z1dS)nr)r��_closedcOsL|tkrtjdkrtnt}|j|dd�}|jjs@td|j	f��|�
�|S)NrF�rz$cannot instantiate %r on your system)rror�rrr�rr�r�rFr)r�r��kwargsr.r!r!r"r�s�zPath.__new__NcCs"d|_|dk	r|j|_nt|_dSr�)r;r��_normal_accessor)r.�templater!r!r"rs
z
Path._initcCs|j|g}|�|j|j|�Sr*)r�r�r�r�)r.r?r;r!r!r"r�#szPath._make_child_relpathcCs|jr|��|Sr*)r;�
_raise_closedr-r!r!r"�	__enter__)szPath.__enter__cCs
d|_dS)NT)r;)r.�t�v�tbr!r!r"�__exit__.sz
Path.__exit__cCstd��dS)NzI/O operation on closed path)r�r-r!r!r"r@1szPath._raise_closed�cCs|j�|||�Sr*)r�r�)r.r��flagsr�r!r!r"�_opener4szPath._opener�cCs|jr|��|j�|||�Sr*)r;r@r�r�)r.rGr�r!r!r"�	_raw_open8szPath._raw_opencCs|t���Sr*)rorp�r�r!r!r"�cwdCszPath.cwdcCs||�j�d��Sr*)rr�rKr!r!r"�homeJsz	Path.homecCsB|��}z|��}Wntk
r2t�|�}YnXtj�||�Sr*)r�rrors�samestat)r.Z
other_path�stZother_str!r!r"�samefileQsz
Path.samefileccsH|jr|��|j�|�D](}|dkr(q|�|�V|jr|��qdS)N>r1r�)r;r@r�r�r�r%r!r!r"�iterdir\szPath.iterdirccs`|std�|���|j�|f�\}}}|s.|r6td��tt|�|j�}|�|�D]
}|VqPdS)NzUnacceptable pattern: {!r}�%Non-relative patterns are unsupported)r�r�rrAr�r�r�r��r.rlr<r=r�Zselectorrar!r!r"�globjsz	Path.globccsR|j�|f�\}}}|s|r$td��tdt|�|j�}|�|�D]
}|VqBdS)NrR)r�)rrAr�r�r�r�rSr!r!r"�rglobwsz
Path.rglobcCsD|jr|��|��r|S|jt��g|jdd�}|j|d�|S)NFr<�r?)r;r@r�r�rorpr�r)r.�objr!r!r"�absolute�sz
Path.absoluteFcCsh|jr|��|jj||d�}|dkr:|��t|���}|jj�|�}|j	|fdd�}|j
|d�|S)N)rtFr<rV)r;r@rrvr�rnrXr��normpathr�r)r.rtr`ZnormedrWr!r!r"rv�szPath.resolvecCs|j�|�Sr*)r�r�r-r!r!r"r��sz	Path.statcCsddl}|�|��j�jS�Nr)r�r�r��st_uidZpw_name)r.r�r!r!r"�owner�sz
Path.ownercCsddl}|�|��j�jSrZ)�grpZgetgrgidr��st_gidZgr_name)r.r]r!r!r"�group�sz
Path.group�rrRc	Cs(|jr|��tj|||||||jd�S)N)Zopener)r;r@�ior�rH)r.r��	buffering�encoding�errors�newliner!r!r"r��s
�z	Path.openc
Cs,|jdd��}|��W5QR�SQRXdS)N�rb�r��r��readrr!r!r"�
read_bytes�szPath.read_bytesc
Cs0|jd||d��}|��W5QR�SQRXdS)Nr`�r�rcrdrh)r.rcrdrr!r!r"�	read_text�szPath.read_textc
Cs6t|�}|jdd��}|�|�W5QR�SQRXdS)N�wbrg)�
memoryviewr��write)r.�dataZviewrr!r!r"�write_bytes�szPath.write_bytesc
CsLt|t�std|jj��|jd||d��}|�|�W5QR�SQRXdS)Nzdata must be str, not %s�wrk)rrnrr�rFr�ro)r.rprcrdrr!r!r"�
write_text�s
�zPath.write_textTcCsr|jr|��|r>z|j�|d�Wntk
r8YnXdStjtjB}|sX|tjO}|�	||�}t�
|�dSr*)r;r@r�r�r�ro�O_CREAT�O_WRONLY�O_EXCLrJ�close)r.r��exist_okrG�fdr!r!r"�touch�s
z
Path.touchcCs�|jr|��z|j�||�Wndtk
rd|r>|j|kr@�|jjddd�|j|d|d�Yn"tk
r�|r~|��s��YnXdS)NT)r4rxF)r;r@r�r�rrr3r�r�)r.r�r4rxr!r!r"r�sz
Path.mkdircCs |jr|��|j�||�dSr*)r;r@r�r��r.r�r!r!r"r�sz
Path.chmodcCs |jr|��|j�||�dSr*)r;r@r�r�r{r!r!r"r�szPath.lchmodcCs>|jr|��z|j�|�Wntk
r8|s4�YnXdSr*)r;r@r�r�rr)r.Z
missing_okr!r!r"r�%szPath.unlinkcCs|jr|��|j�|�dSr*)r;r@r�r�r-r!r!r"r�2sz
Path.rmdircCs|jr|��|j�|�Sr*)r;r@r�r�r-r!r!r"r�:sz
Path.lstatcCs&|jr|��|j�||�|�|�Sr*)r;r@r�r�r�r�r!r!r"r�Cs
zPath.renamecCs&|jr|��|j�||�|�|�Sr*)r;r@r�r4r�r�r!r!r"r4Rs
zPath.replacecCs"|jr|��|j�|||�dSr*)r;r@r�r�)r.r�r�r!r!r"�
symlink_toaszPath.symlink_tocCs |jr|��|j�||�dSr*)r;r@r�r�r�r!r!r"r�js
zPath.link_toc
CsXz|��WnFtk
r>}zt|�s(�WY�dSd}~XYntk
rRYdSXdS�NFT)r�r�r#r��r.r�r!r!r"r�zszPath.existsc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdSr�)r	r��st_moder�r#r�r~r!r!r"r��szPath.is_dirc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdSr�)rr�rr�r#r�r~r!r!r"�is_file�szPath.is_filecCsv|��r|��sdSt|j�}z|��j}Wntk
rBYdSX|��j}||krZdS|��j}|��j}||kSr})r�r�rr3r��st_devr��st_ino)r.r3Z
parent_devZdevZinoZ
parent_inor!r!r"�is_mount�s



z
Path.is_mountc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdSr�)r
r�rr�r#r�r~r!r!r"r��szPath.is_symlinkc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdSr�)r
r�rr�r#r�r~r!r!r"�is_block_device�szPath.is_block_devicec
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdSr�)rr�rr�r#r�r~r!r!r"�is_char_device�szPath.is_char_devicec
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdSr�)rr�rr�r#r�r~r!r!r"�is_fifo�szPath.is_fifoc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdSr�)rr�rr�r#r�r~r!r!r"�	is_socket�szPath.is_socketcCs`|js\|js\|jr\|jddd�dkr\|j�|jddd��}|�|g|jdd��S|S)NrrC�~)r�r�r�rr�r�)r.Zhomedirr!r!r"�
expandusers��zPath.expanduser)N)rF)rI)F)r`rRNNN)NN)NN)rFT)rIFF)F)F)2rFrGrHr�r�rr�rArEr@rHrJr7rLrMrPrQrTrUrXrvr�r\r_r�rjrlrqrsrzr�r�r�r�r�r�r�r4r|r�r�r�r�r�r�r�r�r�r�r�r!r!r!r"rsh	�







�

	



	

	
	c@seZdZdZdS)rr!N)rFrGrHr�r!r!r!r"rsc@s(eZdZdZdd�Zdd�Zdd�ZdS)	rr!cCstd��dS)Nz*Path.owner() is unsupported on this systemr�r-r!r!r"r\(szWindowsPath.ownercCstd��dS)Nz*Path.group() is unsupported on this systemr�r-r!r!r"r_+szWindowsPath.groupcCstd��dS)Nz-Path.is_mount() is unsupported on this systemr�r-r!r!r"r�.szWindowsPath.is_mountN)rFrGrHr�r\r_r�r!r!r!r"r!s)Arg�	functoolsrar�ror�rer8�_collections_abcrrrrrrr�operatorrr�r	r
rrr
rrZurllib.parserrr�r�rZgetwindowsversionr�__all__rr r#r(rr)rIr�r:r9r�r�r>r�r�r�r�r�r�r�r�r�r�PathLike�registerrrrrrr!r!r!r"�<module>s|$
�
?&i8
,t

py_compile.cpython-38.opt-2.pyc000064400000007100150335716500012277 0ustar00U

&�.e �@s�ddlZddlZddlZddlZddlZddlZddlZddlZddddgZ	Gdd�de
�ZGdd�dej�Z
dd	�Zddd�Zdd
d�Zedkr�e�e��dS)�N�compile�main�PyCompileError�PycInvalidationModec@seZdZddd�Zdd�ZdS)r�cCst|j}|tkr2d�t�||��}|�dd|�}nd||f}t�||pJ||||�||_||_	||_
|pl||_dS)NrzFile "<string>"z	File "%s"z
Sorry: %s: %s)�__name__�SyntaxError�join�	traceback�format_exception_only�replace�	Exception�__init__�
exc_type_name�	exc_value�file�msg)�self�exc_typerrrr�tbtext�errmsg�r�"/usr/lib64/python3.8/py_compile.pyr.s�zPyCompileError.__init__cCs|jS)N)r)rrrr�__str__>szPyCompileError.__str__N)r)r�
__module__�__qualname__rrrrrrrs
c@seZdZdZdZdZdS)r���N)rrr�	TIMESTAMP�CHECKED_HASH�UNCHECKED_HASHrrrrrBscCs(tj�d�rtj�d�stjStjSdS)N�SOURCE_DATE_EPOCH�RPM_BUILD_ROOT)�os�environ�getrr rrrrr�_get_default_invalidation_modeHs

�r'F���c
Cs�|dkrt�}|dkrL|dkr@|dkr*|nd}tjj||d�}ntj�|�}tj�|�rld}t|�|���n*tj�	|�r�tj�
|�s�d}t|�|���tj�d|�}	|	�
|�}
z|	j|
|p�||d�}Wndtk
�r*}zDt|j||p�|�}
|d	k�r|�r|
�ntj�|
jd
�WY�dSd}~XYnXz tj�|�}|�rJt�|�Wntk
�rbYnX|tjk�r�|	�|�}tj�||d|d�}n"tj�|
�}tj�|||tjk�}tj� |�}tj�!|||�|S)
Nrrr)�optimizationzc{} is a symlink and will be changed into a regular file if import writes a byte-compiled file to itzk{} is a non-regular file and will be changed into a regular one if import writes a byte-compiled file to itz<py_compile>)�	_optimizer�
�mtime�size)"r'�	importlib�util�cache_from_sourcer$�path�islink�FileExistsError�format�exists�isfile�	machinery�SourceFileLoader�get_data�source_to_coder
r�	__class__�sys�stderr�writer�dirname�makedirsrr�
path_stats�_bootstrap_external�_code_to_timestamp_pyc�source_hash�_code_to_hash_pycr �
_calc_mode�
_write_atomic)r�cfile�dfile�doraise�optimize�invalidation_mode�quietr)r�loader�source_bytes�code�err�py_excr?�source_stats�bytecoderD�moderrrrPsd-�
�


��cCs|dkrtjdd�}d}|dgkr�tj��}|s4q�|�d�}zt|dd�Wq$tk
r�}zd}tj�d|j	�W5d}~XYq$t
k
r�}zd}tj�d|�W5d}~XYq$Xq$nV|D]P}zt|dd�Wq�tk
�r}zd}tj�d|j	�W5d}~XYq�Xq�|S)Nrr�-r+T)rJz%s
)r<�argv�stdin�readline�rstriprrr=r>r�OSError)�args�rv�filename�errorrrrr�s.


"&&�__main__)NNFr(Nr)N)�enumZimportlib._bootstrap_externalr.�importlib.machinery�importlib.utilr$Zos.pathr<r
�__all__r
r�Enumrr'rrr�exitrrrr�<module>s$0�
a
&types.cpython-38.opt-1.pyc000064400000021733150335716500011312 0ustar00U

e5d�%�@s�dZddlZdd�Zee�Zedd��Zeej�Zeej�Z	eej
�Zdd�Zee��Z
d	d
�Zee��Zdd�Ze�Zee�Ze��d
d�Ze�Zee�ZGdd�d�Zee�j�Zee�Zegj�Zeej�Zee�j�Z ee!j"�Z#ee$jd�Z%ee�Z&ze'�Wn:e'k
�rBe�(�dZ)ee)�Z*ee)j+�Z,dZ)[)YnXeej�Z-eej.�Z/[[[[[[d$dd�Z0dd�Z1d%dd�Z2dd�Z3Gdd�d�Z4Gdd�d�Z5d d!�Z6d"d#�e7�D�Z8dS)&zO
Define names for built-in types that aren't directly accessible as a builtin.
�NcCsdS�N�rrr�/usr/lib64/python3.8/types.py�_f�rcCsdSrrrrrr�<lambda>
rrcsd��fdd�}|jdS)N�csdSrrr��arr�fsz_cell_factory.<locals>.fr)�__closure__)rrr	r�
_cell_factorysr
ccs
dVdS)Nrrrrrr�_gsrc�sdSrrrrrr�_crrcCs
dVdSrrrrrr�_ag"src@seZdZdd�ZdS)�_CcCsdSrr��selfrrr�_m(rz_C._mN)�__name__�
__module__�__qualname__rrrrrr'sr�fromkeys�rcCsJt|�}t|||�\}}}|dk	r*||�||k	r:||d<||||f|�S)zBCreate a class object dynamically using the appropriate metaclass.N�__orig_bases__)�
resolve_bases�
prepare_class)�name�bases�kwds�	exec_body�resolved_bases�meta�nsrrr�	new_classEsr$cCs�t|�}d}d}t|�D]j\}}t|t�r,qt|d�s8q|�|�}d}t|t�sZtd��q||||||d�<|t|�d7}q|s�|St|�S)z8Resolve MRO entries dynamically as specified by PEP 560.Fr�__mro_entries__Tz#__mro_entries__ must return a tupler)	�list�	enumerate�
isinstance�type�hasattrr%�tuple�	TypeError�len)r�	new_bases�updated�shift�i�base�new_baserrrrOs"




rcCs~|dkri}nt|�}d|kr*|�d�}n|r<t|d�}nt}t|t�rTt||�}t|d�rp|j||f|�}ni}|||fS)azCall the __prepare__ method of the appropriate metaclass.

    Returns (metaclass, namespace, kwds) as a 3-tuple

    *metaclass* is the appropriate metaclass
    *namespace* is the prepared class namespace
    *kwds* is an updated copy of the passed in kwds argument with any
    'metaclass' entry removed. If no kwds argument is passed in, this will
    be an empty dict.
    N�	metaclassr�__prepare__)�dict�popr)r(�_calculate_metar*r5)rrrr"r#rrrrds


rcCs>|}|D]0}t|�}t||�r qt||�r0|}qtd��q|S)z%Calculate the most derived metaclass.zxmetaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases)r)�
issubclassr,)r"r�winnerr2�	base_metarrrr8�s


r8c@sLeZdZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�DynamicClassAttributeaRoute attribute access on a class to __getattr__.

    This is a descriptor, used to define attributes that act differently when
    accessed through an instance and through a class.  Instance access remains
    normal, but access to an attribute through a class will be routed to the
    class's __getattr__ method; this is done by raising AttributeError.

    This allows one to have properties active on an instance, and have virtual
    attributes on the class with the same name (see Enum for an example).

    NcCs>||_||_||_|p|j|_|dk|_tt|dd��|_dS)N�__isabstractmethod__F)�fget�fset�fdel�__doc__�
overwrite_doc�bool�getattrr=)rr>r?r@�docrrr�__init__�s
zDynamicClassAttribute.__init__cCs6|dkr|jr|St��n|jdkr,td��|�|�S)Nzunreadable attribute)r=�AttributeErrorr>)r�instance�
ownerclassrrr�__get__�s
zDynamicClassAttribute.__get__cCs"|jdkrtd��|�||�dS)Nzcan't set attribute)r?rG)rrH�valuerrr�__set__�s
zDynamicClassAttribute.__set__cCs |jdkrtd��|�|�dS)Nzcan't delete attribute)r@rG)rrHrrr�
__delete__�s
z DynamicClassAttribute.__delete__cCs8|jr|jnd}t|�||j|j|p(|j�}|j|_|Sr)rBrAr)r?r@)rr>�fdoc�resultrrr�getter�szDynamicClassAttribute.gettercCs$t|�|j||j|j�}|j|_|Sr)r)r>r@rArB)rr?rOrrr�setter�szDynamicClassAttribute.settercCs$t|�|j|j||j�}|j|_|Sr)r)r>r?rArB)rr@rOrrr�deleter�szDynamicClassAttribute.deleter)NNNN)N)rrrrArFrJrLrMrPrQrRrrrrr<�s


	r<c@s�eZdZdd�Zdd�Zdd�Zdd�Zed	d
��Zedd��Z	ed
d��Z
edd��ZeZe	Z
e
ZeZdd�Zdd�ZeZdS)�_GeneratorWrappercCs2||_|jtk|_t|dd�|_t|dd�|_dS)Nrr)�_GeneratorWrapper__wrapped�	__class__�
GeneratorType�_GeneratorWrapper__isgenrDrr)r�genrrrrF�sz_GeneratorWrapper.__init__cCs|j�|�Sr)rT�send)r�valrrrrY�sz_GeneratorWrapper.sendcGs|jj|f|��Sr)rT�throw)r�tp�restrrrr[�sz_GeneratorWrapper.throwcCs
|j��Sr)rT�closerrrrr^�sz_GeneratorWrapper.closecCs|jjSr)rT�gi_coderrrrr_�sz_GeneratorWrapper.gi_codecCs|jjSr)rT�gi_framerrrrr`�sz_GeneratorWrapper.gi_framecCs|jjSr)rT�
gi_runningrrrrra�sz_GeneratorWrapper.gi_runningcCs|jjSr)rT�gi_yieldfromrrrrrb�sz_GeneratorWrapper.gi_yieldfromcCs
t|j�Sr)�nextrTrrrr�__next__�sz_GeneratorWrapper.__next__cCs|jr|jS|Sr)rWrTrrrr�__iter__�sz_GeneratorWrapper.__iter__N)rrrrFrYr[r^�propertyr_r`rarb�cr_code�cr_frame�
cr_running�cr_awaitrdre�	__await__rrrrrS�s&



rScs�t��std���jtkrft�dd�jtkrf�jj}|d@r@�S|d@rf�j}|j|jdBd��_�Sddl	}ddl
�|�����fd	d
��}|S)z2Convert regular generator function to a coroutine.z$types.coroutine() expects a callable�__code__Ni�� �)�co_flagsrcsR�||�}|jtks*|jtkr.|jjd@r.|St|�j�rNt|�j�sNt|�S|S)Nrn)	rU�
CoroutineTyperVr_ror(�	Generator�	CoroutinerS)�args�kwargs�coro��_collections_abc�funcrr�wrappeds

�
�
�zcoroutine.<locals>.wrapped)�callabler,rU�FunctionTyperD�CodeTyperlro�replace�	functoolsrw�wraps)rxro�cor~ryrrvr�	coroutine�s"
�r�cCs g|]}|dd�dkr|�qS)Nr�_r)�.0�nrrr�
<listcomp>(sr�)rNN)rN)9rA�sysrr)r{�
LambdaTyperlr|�__dict__�MappingProxyType�implementation�SimpleNamespacer
�CellTyperrVrrpr^r�AsyncGeneratorTyperr�
MethodTyper-�BuiltinFunctionType�append�BuiltinMethodType�objectrF�WrapperDescriptorType�__str__�MethodWrapperType�str�join�MethodDescriptorTyper6�ClassMethodDescriptorType�
ModuleTyper,�exc_info�tb�
TracebackType�tb_frame�	FrameType�GetSetDescriptorType�__globals__�MemberDescriptorTyper$rrr8r<rSr��globals�__all__rrrr�<module>s\













 :%4heapq.cpython-38.opt-1.pyc000064400000033370150335716500011244 0ustar00U

e5d]Y�@sZdZdZdddddddd	gZd
d�Zdd�Zdd�Zd
d	�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zddd�d d�Zd)d!d�Zd*d"d�Zzd#d$lTWnek
r�YnXzd#d%lm	Z	Wnek
r�YnXzd#d&lm
Z
Wnek
�rYnXzd#d'lmZWnek
�r6YnXed(k�rVd#dlZee���dS)+a�Heap queue algorithm (a.k.a. priority queue).

Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0.  For the sake of comparison,
non-existing elements are considered to be infinite.  The interesting
property of a heap is that a[0] is always its smallest element.

Usage:

heap = []            # creates an empty heap
heappush(heap, item) # pushes a new item on the heap
item = heappop(heap) # pops the smallest item from the heap
item = heap[0]       # smallest item on the heap without popping it
heapify(x)           # transforms list into a heap, in-place, in linear time
item = heapreplace(heap, item) # pops and returns smallest item, and adds
                               # new item; the heap size is unchanged

Our API differs from textbook heap algorithms as follows:

- We use 0-based indexing.  This makes the relationship between the
  index for a node and the indexes for its children slightly less
  obvious, but is more suitable since Python uses 0-based indexing.

- Our heappop() method returns the smallest item, not the largest.

These two make it possible to view the heap as a regular Python list
without surprises: heap[0] is the smallest item, and heap.sort()
maintains the heap invariant!
uoHeap queues

[explanation by François Pinard]

Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0.  For the sake of comparison,
non-existing elements are considered to be infinite.  The interesting
property of a heap is that a[0] is always its smallest element.

The strange invariant above is meant to be an efficient memory
representation for a tournament.  The numbers below are `k', not a[k]:

                                   0

                  1                                 2

          3               4                5               6

      7       8       9       10      11      12      13      14

    15 16   17 18   19 20   21 22   23 24   25 26   27 28   29 30


In the tree above, each cell `k' is topping `2*k+1' and `2*k+2'.  In
a usual binary tournament we see in sports, each cell is the winner
over the two cells it tops, and we can trace the winner down the tree
to see all opponents s/he had.  However, in many computer applications
of such tournaments, we do not need to trace the history of a winner.
To be more memory efficient, when a winner is promoted, we try to
replace it by something else at a lower level, and the rule becomes
that a cell and the two cells it tops contain three different items,
but the top cell "wins" over the two topped cells.

If this heap invariant is protected at all time, index 0 is clearly
the overall winner.  The simplest algorithmic way to remove it and
find the "next" winner is to move some loser (let's say cell 30 in the
diagram above) into the 0 position, and then percolate this new 0 down
the tree, exchanging values, until the invariant is re-established.
This is clearly logarithmic on the total number of items in the tree.
By iterating over all items, you get an O(n ln n) sort.

A nice feature of this sort is that you can efficiently insert new
items while the sort is going on, provided that the inserted items are
not "better" than the last 0'th element you extracted.  This is
especially useful in simulation contexts, where the tree holds all
incoming events, and the "win" condition means the smallest scheduled
time.  When an event schedule other events for execution, they are
scheduled into the future, so they can easily go into the heap.  So, a
heap is a good structure for implementing schedulers (this is what I
used for my MIDI sequencer :-).

Various structures for implementing schedulers have been extensively
studied, and heaps are good for this, as they are reasonably speedy,
the speed is almost constant, and the worst case is not much different
than the average case.  However, there are other representations which
are more efficient overall, yet the worst cases might be terrible.

Heaps are also very useful in big disk sorts.  You most probably all
know that a big sort implies producing "runs" (which are pre-sorted
sequences, which size is usually related to the amount of CPU memory),
followed by a merging passes for these runs, which merging is often
very cleverly organised[1].  It is very important that the initial
sort produces the longest runs possible.  Tournaments are a good way
to that.  If, using all the memory available to hold a tournament, you
replace and percolate items that happen to fit the current run, you'll
produce runs which are twice the size of the memory for random input,
and much better for input fuzzily ordered.

Moreover, if you output the 0'th item on disk and get an input which
may not fit in the current tournament (because the value "wins" over
the last output value), it cannot fit in the heap, so the size of the
heap decreases.  The freed memory could be cleverly reused immediately
for progressively building a second heap, which grows at exactly the
same rate the first heap is melting.  When the first heap completely
vanishes, you switch heaps and start a new run.  Clever and quite
effective!

In a word, heaps are useful memory structures to know.  I use them in
a few applications, and I think it is good to keep a `heap' module
around. :-)

--------------------
[1] The disk balancing algorithms which are current, nowadays, are
more annoying than clever, and this is a consequence of the seeking
capabilities of the disks.  On devices which cannot seek, like big
tape drives, the story was quite different, and one had to be very
clever to ensure (far in advance) that each tape movement will be the
most effective possible (that is, will best participate at
"progressing" the merge).  Some tapes were even able to read
backwards, and this was also used to avoid the rewinding time.
Believe me, real good tape sorts were quite spectacular to watch!
From all times, sorting has always been a Great Art! :-)
�heappush�heappop�heapify�heapreplace�merge�nlargest�	nsmallest�heappushpopcCs"|�|�t|dt|�d�dS)z4Push item onto heap, maintaining the heap invariant.��N)�append�	_siftdown�len��heap�item�r�/usr/lib64/python3.8/heapq.pyr�s
cCs.|��}|r*|d}||d<t|d�|S|S)zCPop the smallest item off the heap, maintaining the heap invariant.r	)�pop�_siftup�rZlastelt�
returnitemrrrr�s
cCs|d}||d<t|d�|S)a�Pop and return the current smallest value, and add the new item.

    This is more efficient than heappop() followed by heappush(), and can be
    more appropriate when using a fixed-size heap.  Note that the value
    returned may be larger than item!  That constrains reasonable uses of
    this routine unless written as part of a conditional replacement:

        if item > heap[0]:
            item = heapreplace(heap, item)
    r	�r�rrrrrrr�s
cCs0|r,|d|kr,|d|}|d<t|d�|S)z1Fast version of a heappush followed by a heappop.r	rrrrrr�s
cCs,t|�}tt|d��D]}t||�qdS)z8Transform list into a heap, in-place, in O(len(x)) time.�N)r
�reversed�ranger��x�n�irrrr�scCs.|��}|r*|d}||d<t|d�|S|S)zMaxheap version of a heappop.r	)r�_siftup_maxrrrr�_heappop_max�s
r!cCs|d}||d<t|d�|S)z4Maxheap version of a heappop followed by a heappush.r	)r rrrr�_heapreplace_max�s
r"cCs,t|�}tt|d��D]}t||�qdS)z;Transform list into a maxheap, in-place, in O(len(x)) time.rN)r
rrr rrrr�_heapify_max�sr#cCsJ||}||kr>|dd?}||}||kr>|||<|}qq>q|||<dS)Nr
r�r�startpos�pos�newitem�	parentpos�parentrrrr�srcCs�t|�}|}||}d|d}||krj|d}||krL||||ksL|}||||<|}d|d}q |||<t|||�dS)Nrr
)r
r�rr&�endposr%r'�childpos�rightposrrrrsrcCsJ||}||kr>|dd?}||}||kr>|||<|}qq>q|||<dS)zMaxheap variant of _siftdownr
Nrr$rrr�
_siftdown_maxsr.cCs�t|�}|}||}d|d}||krj|d}||krL||||ksL|}||||<|}d|d}q |||<t|||�dS)zMaxheap variant of _siftuprr
N)r
r.r*rrrr %sr NF��key�reversec	gsg}|j}|r t}t}t}d}nt}t}t}d}|dk�rttt	|��D]<\}	}
z|
j
}||�|	||g�WqHtk
r�YqHXqH||�t|�dkr�z2|d\}}	}}
|V|�|
d<|||
�q�Wq�tk
r�||�Yq�Xq�|�r|d\}}	}|V|j
EdHdSttt	|��D]J\}	}
z(|
j
}|�}|||�|	|||g�Wntk
�rjYnX�q$||�t|�dk�r�zF|d\}}	}}}
|V|�}||�|
d<||
d<|||
��q�Wntk
�r�||�YnX�qx|�r|d\}}	}}|V|j
EdHdS)akMerge multiple sorted inputs into a single sorted output.

    Similar to sorted(itertools.chain(*iterables)) but returns a generator,
    does not pull the data into memory all at once, and assumes that each of
    the input streams is already sorted (smallest to largest).

    >>> list(merge([1,3,5,7], [0,2,4,8], [5,10,15,20], [], [25]))
    [0, 1, 2, 3, 4, 5, 5, 7, 8, 10, 15, 20, 25]

    If *key* is not None, applies a key function to each element to determine
    its sort order.

    >>> list(merge(['dog', 'horse'], ['cat', 'fish', 'kangaroo'], key=len))
    ['dog', 'cat', 'fish', 'horse', 'kangaroo']

    ���r
Nr	r)rr#r!r"rrr�	enumerate�map�iter�__next__�
StopIterationr
�__self__)r0r1�	iterables�h�h_append�_heapify�_heappop�_heapreplace�	direction�order�it�next�value�s�	key_valuerrrr:sl


c	s�|dkr6t|�}t�}t||�d�}||kr0gS|gSzt|�}Wnttfk
rZYnX||krxt|�d�d|�S�dk�rt|�}dd�tt|�|�D�}|s�|St	|�|dd}|}t
}	|D].}
|
|kr�|	||
|f�|d\}}|d7}q�|��dd�|D�St|�}�fd	d�tt|�|�D�}|�s>|St	|�|dd}|}t
}	|D]>}
�|
�}||k�r^|	||||
f�|d\}}}
|d7}�q^|��d
d�|D�S)zbFind the n smallest elements in a dataset.

    Equivalent to:  sorted(iterable, key=key)[:n]
    r
��defaultr0�r0NcSsg|]\}}||f�qSrr��.0r�elemrrr�
<listcomp>�sznsmallest.<locals>.<listcomp>r	cSsg|]\}}|�qSrr�rJrKr@rrrrL�scsg|]\}}�|�||f�qSrrrIrHrrrL�scSsg|]\}}}|�qSrr�rJ�kr@rKrrrrLs)r5�object�minr
�	TypeError�AttributeError�sorted�ziprr#r"�sort�r�iterabler0rA�sentinel�result�size�topr@r>rK�_orderrO�_elemrrHrr�sV


c	s�|dkr6t|�}t�}t||�d�}||kr0gS|gSzt|�}Wnttfk
rZYn X||krzt|�dd�d|�S�dk�rt|�}dd�ttd|d	�|�D�}|s�|St	|�|dd}|}t
}	|D].}
||
kr�|	||
|f�|d\}}|d8}q�|jdd
�dd�|D�St|�}�fdd�ttd|d	�|�D�}|�sR|St	|�|dd}|}t
}	|D]>}
�|
�}||k�rt|	||||
f�|d\}}}
|d8}�qt|jdd
�d
d�|D�S)zoFind the n largest elements in a dataset.

    Equivalent to:  sorted(iterable, key=key, reverse=True)[:n]
    r
rFTr/NcSsg|]\}}||f�qSrrrIrrrrL"sznlargest.<locals>.<listcomp>r	r2)r1cSsg|]\}}|�qSrrrMrrrrL/scsg|]\}}�|�||f�qSrrrIrHrrrL3scSsg|]\}}}|�qSrrrNrrrrLAs)r5rP�maxr
rRrSrTrUrrrrVrWrrHrr	sV

"
r	)�*)r")r#)r!�__main__)N)N)�__doc__�	__about__�__all__rrrrrr!r"r#rrr.r rrr�_heapq�ImportError�__name__Zdoctest�printZtestmodrrrr�<module>sR ^
�

	5
<
;
site.cpython-38.opt-1.pyc000064400000041121150335716500011103 0ustar00U

&�.eNU�@s&dZddlZddlZddlZddlZddlZejejgada	da
dadd�Zdd�Z
dd�Zd	d
�Zdd�Zd2d
d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd3dd�Zd4dd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Z d-d.�Z!ej"j#�s
e!�d/d0�Z$e%d1k�r"e$�dS)5a�Append module search paths for third-party packages to sys.path.

****************************************************************
* This module is automatically imported during initialization. *
****************************************************************

This will append site-specific paths to the module search path.  On
Unix (including Mac OSX), it starts with sys.prefix and
sys.exec_prefix (if different) and appends
lib/python<version>/site-packages.
On other platforms (such as Windows), it tries each of the
prefixes directly, as well as with lib/site-packages appended.  The
resulting directories, if they exist, are appended to sys.path, and
also inspected for path configuration files.

If a file named "pyvenv.cfg" exists one directory above sys.executable,
sys.prefix and sys.exec_prefix are set to that directory and
it is also checked for site-packages (sys.base_prefix and
sys.base_exec_prefix will always be the "real" prefixes of the Python
installation). If "pyvenv.cfg" (a bootstrap configuration file) contains
the key "include-system-site-packages" set to anything other than "false"
(case-insensitive), the system-level prefixes will still also be
searched for site-packages; otherwise they won't.

All of the resulting site-specific directories, if they exist, are
appended to sys.path, and also inspected for path configuration
files.

A path configuration file is a file whose name has the form
<package>.pth; its contents are additional directories (one per line)
to be added to sys.path.  Non-existing directories (or
non-directories) are never added to sys.path; no directory is added to
sys.path more than once.  Blank lines and lines beginning with
'#' are skipped. Lines starting with 'import' are executed.

For example, suppose sys.prefix and sys.exec_prefix are set to
/usr/local and there is a directory /usr/local/lib/python2.5/site-packages
with three subdirectories, foo, bar and spam, and two path
configuration files, foo.pth and bar.pth.  Assume foo.pth contains the
following:

  # foo package configuration
  foo
  bar
  bletch

and bar.pth contains:

  # bar package configuration
  bar

Then the following directories are added to sys.path, in this order:

  /usr/local/lib/python2.5/site-packages/bar
  /usr/local/lib/python2.5/site-packages/foo

Note that bletch is omitted because it doesn't exist; bar precedes foo
because bar.pth comes alphabetically before foo.pth; and spam is
omitted because it is not mentioned in either path configuration file.

The readline module is also automatically configured to enable
completion for systems that support it.  This can be overridden in
sitecustomize, usercustomize or PYTHONSTARTUP.  Starting Python in
isolated mode (-I) disables automatic readline configuration.

After these operations, an attempt is made to import a module
named sitecustomize, which can perform arbitrary additional
site-specific customizations.  If this import fails with an
ImportError exception, it is silently ignored.
�NcGsBtjj|�}ztj�|�}Wntk
r0YnX|tj�|�fS�N)�os�path�join�abspath�OSError�normcase)�paths�dir�r�/usr/lib64/python3.8/site.py�makepath[sr
cCs�ttj���D]~}tt|dd�dd�dkr,qztj�|j�|_Wnt	t
tfk
rZYnXztj�|j�|_Wqt	t
tfk
r�YqXqdS)zESet all module __file__ and __cached__ attributes to an absolute path�
__loader__N�
__module__)�_frozen_importlib�_frozen_importlib_external)
�set�sys�modules�values�getattrrrr�__file__�AttributeErrorr�	TypeError�
__cached__)�mrrr�	abs_pathsds�rcCsPg}t�}tjD],}t|�\}}||kr|�|�|�|�q|tjdd�<|S)zK Remove duplicate entries from sys.path along with making them
    absoluteN)rrrr
�append�add)�L�known_pathsr
�dircaserrr�removeduppathsts

r"c	CsVt�}tjD]D}z&tj�|�r4t|�\}}|�|�Wqtk
rNYqYqXq|S)zEReturn a set containing all existing file system items from sys.path.)rrrr�existsr
rr)�d�item�_�itemcaserrr�_init_pathinfo�s
r(cCsr|dkrt�}d}nd}tj�||�}zt�t�|��}Wntk
rPYdSX|��t|�D]�\}}|�	d�rvqbzZ|�	d�r�t
|�Wqb|��}t||�\}}	|	|kr�tj�
|�r�tj�|�|�|	�Wqbtk
�rVtd�|d|�tjd�d	dl}
|
jt���D](}|��D]}td
|tjd��q�qtdtjd�Y�qZYqbXqbW5QRX|�rnd}|S)z�Process a .pth file within the site-packages directory:
       For each line in the file, either combine it with sitedir to a path
       and add that to known_paths, or execute it if it starts with 'import '.
    NTF�#)zimport zimport	z"Error processing line {:d} of {}:
�)�filerz  z
Remainder of file ignored)r(rrr�io�
TextIOWrapper�	open_coder�	enumerate�
startswith�exec�rstripr
r#rrr�	Exception�print�format�stderr�	traceback�format_exception�exc_info�
splitlines)�sitedir�namer �reset�fullname�f�n�liner
r!r7�recordrrr�
addpackage�sF

�rCcCs�|dkrt�}d}nd}t|�\}}||krBtj�|�|�|�zt�|�}Wntk
rfYdSXdd�|D�}t	|�D]}t
|||�q~|r�d}|S)zTAdd 'sitedir' argument to sys.path if missing and handle .pth files in
    'sitedir'NTFcSsg|]}|�d�r|�qS)z.pth)�endswith)�.0r<rrr�
<listcomp>�s
zaddsitedir.<locals>.<listcomp>)r(r
rrrrr�listdirr�sortedrC)r;r r=�sitedircase�namesr<rrr�
addsitedir�s$
rKcCs`tjjrdSttd�r4ttd�r4t��t��kr4dSttd�r\ttd�r\t��t��kr\dSdS)a,Check if user site directory is safe for inclusion

    The function tests for the command line flag (including environment var),
    process uid/gid equal to effective uid/gid.

    None: Disabled for security reasons
    False: Disabled by user (command line option)
    True: Safe and enabled
    F�getuid�geteuidN�getgid�getegidT)	r�flags�no_user_site�hasattrrrMrLrOrNrrrr�check_enableusersite�s
rScCsztj�dd�}|r|Sdd�}tjdkrBtj�d�p6d}||d�Stjdkrptjrp|dd	tjd
tjdd��S|dd�S)
N�PYTHONUSERBASEcWstj�tjj|��Sr)rr�
expanduserr)�argsrrr�joinuser�sz_getuserbase.<locals>.joinuser�nt�APPDATA�~�Python�darwin�Libraryz%d.%d�z.local)r�environ�getr<r�platform�
_framework�version_info)�env_baserW�baserrr�_getuserbase�s


�rfcCsdtj}tjdkr,|�d|d�|d�d�StjdkrFtjrF|�d�S|�d|d�d	|d�d
�S)NrXz\Pythonrr*z\site-packagesr\z/lib/python/site-packagesz/lib/python�.z/site-packages)rrcrr<rarb)�userbase�versionrrr�	_get_path
s

rjcCstdkrt�atS)z�Returns the `user base` directory path.

    The `user base` directory can be used to store data. If the global
    variable ``USER_BASE`` is not initialized yet, this function will also set
    it.
    N)�	USER_BASErfrrrr�getuserbasesrlcCst�}tdkrt|�atS)z�Returns the user-specific site-packages directory path.

    If the global variable ``USER_SITE`` is not initialized yet, this
    function will also set it.
    N)rl�	USER_SITErj)rhrrr�getusersitepackages#srncCs$t�}tr tj�|�r t||�|S)z�Add a per user site-package to sys.path

    Each user has its own python directory with site-packages in the
    home directory.
    )rn�ENABLE_USER_SITErr�isdirrK)r �	user_siterrr�addusersitepackages1s
rrcCs�g}t�}|dkrt}|D]�}|r||kr,q|�|�tjdkr�|�tj�|ddtj	dd�d��|�tj�|ddtj
dd	�d��q|�|�|�tj�|dd��|�tj�|dd��q|S)
aReturns a list containing all global site-packages directories.

    For each directory present in ``prefixes`` (or the global ``PREFIXES``),
    this function will find its `site-packages` subdirectory depending on the
    system environment, and will return a list of full paths.
    N�/�lib64�python�z
site-packages�libzpython%d.%dr^)r�PREFIXESrr�seprrrrrirc)�prefixes�sitepackages�seen�prefixrrr�getsitepackages?s*

��
r~cCsBtrdtjkrt�dd�t|�D]}tj�|�r"t||�q"|S)z�Add site-packages to sys.path

    '/usr/local' is included in PREFIXES if RPM build is not detected
    to make packages installed into this location visible.

    �RPM_BUILD_ROOTrz
/usr/local)	rorr_rx�insertr~rrprK)r rzr;rrr�addsitepackages^sr�cCs4tjdkrd}nd}t�d|�t_t�d|�t_dS)z�Define new builtins 'quit' and 'exit'.

    These are objects which make the interpreter exit when called.
    The repr of each object contains a hint at how it works.

    �\zCtrl-Z plus ReturnzCtrl-D (i.e. EOF)�quit�exitN)rry�
_sitebuiltins�Quitter�builtinsr�r�)�eofrrr�setquitms

r�cCs�t�dtj�t_tjdd�dkr2t�dd�t_nt�dd�t_gg}}ttd�r�tj	�
tj�}|�d	d
g�|�tj	�
|tj�|tjg�t�dd||�t_dS)
z)Set 'copyright' and 'credits' in builtins�	copyrightN��java�creditsz?Jython is maintained by the Jython developers (www.jython.org).z�    Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
    for supporting Python development.  See www.python.org for more information.rzLICENSE.txt�LICENSE�licensez'See https://www.python.org/psf/license/)r��_Printerrr�r�rar�rRrr�dirnamer�extendr�pardir�curdirr�)�files�dirs�hererrr�setcopyright}s$�

�r�cCst��t_dSr)r��_Helperr��helprrrr�	sethelper�sr�cCsdd�}|t_dS)ajEnable default readline configuration on interactive prompts, by
    registering a sys.__interactivehook__.

    If the readline module can be imported, the hook will set the Tab key
    as completion key and register ~/.python_history as history file.
    This can be overridden in the sitecustomize or usercustomize module,
    or in a PYTHONSTARTUP file.
    cs�ddl}zddl�ddl}Wntk
r2YdSXt�dd�}|dk	r\d|kr\��d�n
��d�z���Wntk
r�YnX���dkr�t	j
�t	j
�d�d��z��
��Wntk
r�YnX��fd	d
�}|�|�dS)Nr�__doc__��libeditzbind ^I rl_completez
tab: completerZz.python_historycs(z����Wntk
r"YnXdSr)�write_history_filerr��history�readlinerr�
write_history�szCenablerlcompleter.<locals>.register_readline.<locals>.write_history)�atexitr��rlcompleter�ImportErrorr�parse_and_bind�read_init_filer�get_current_history_lengthrrrrU�read_history_file�register)r�r��readline_docr�rr�r�register_readline�s0
�z,enablerlcompleter.<locals>.register_readlineN)r�__interactivehook__)r�rrr�enablerlcompleter�s	0r�c	CsHtj}tjdkr*d|kr*tjd}t_ntj}tj�tj�|��\}}tj�	|�}dt_
d}dd�tj�||�tj�||�fD�}|�rD|d}d}	t|dd	��\}
|
D]P}d
|kr�|�
d
�\}}}
|����}|
��}
|dkr�|
��}	q�|dkr�|
t_
q�W5QRX|t_t_t|tjg�|	dk�r8t�dtj�ntjgad
a|S)Nr\�__PYVENV_LAUNCHER__z
pyvenv.cfgcSsg|]}tj�|�r|�qSr)rr�isfile)rE�conffilerrrrF�s�zvenv.<locals>.<listcomp>r�truezutf-8)�encoding�=zinclude-system-site-packages�homeF)rr_rra�_base_executable�
executabler�splitrr��_homer�open�	partition�strip�lowerr}�exec_prefixr�rxr�ro)r �envr��exe_dirr&�site_prefix�
conf_basename�candidate_confs�virtual_conf�system_siter?rA�key�valuerrr�venv�sB��

r�c
Cs�zBzddl}Wn0tk
r>}z|jdkr,n�W5d}~XYnXWnRtk
r�}z4tjjrltjt���ntj	�
d|jj|f�W5d}~XYnXdS)z,Run custom site specific code, if available.rN�
sitecustomizez@Error in sitecustomize; set PYTHONVERBOSE for traceback:
%s: %s
)
r�r�r<r3rrP�verbose�
excepthookr9r6�write�	__class__�__name__)r��exc�errrrr�execsitecustomizes

��r�c
Cs�zBzddl}Wn0tk
r>}z|jdkr,n�W5d}~XYnXWnRtk
r�}z4tjjrltjt���ntj	�
d|jj|f�W5d}~XYnXdS)z,Run custom user specific code, if available.rN�
usercustomizez@Error in usercustomize; set PYTHONVERBOSE for traceback:
%s: %s
)
r�r�r<r3rrPr�r�r9r6r�r�r�)r�r�r�rrr�execusercustomizes

��r�cCs~tjdd�}t�}|tjkr$t�t|�}tdkr:t�at|�}t|�}t	�t
�t�tjj
sjt�t�trzt�dS)z�Add standard site-specific directories to the module search path.

    This function is called automatically when this module is imported,
    unless the python interpreter was started with the -S flag.
    N)rrr"rr�rorSrrr�r�r�r�rP�isolatedr�r�r�)�	orig_pathr rrr�main/s"
r�cCs\d}tjdd�}|s�t�}t�}td�tjD]}td|f�q0td�td|tj�|�rbdndf�td	|tj�|�r�dndf�td
t�t�	d�g}d|kr�|�
t�d
|kr�|�
t�|�r(ttj
�|��tr�t�	d�n6tdk�rt�	d�n tdk�rt�	d�n
t�	d�n0ddl}t|�|tjdtj
f��t�	d�dS)Na�    %s [--user-base] [--user-site]

    Without arguments print some useful information
    With arguments print the value of USER_BASE and/or USER_SITE separated
    by '%s'.

    Exit codes with --user-base or --user-site:
      0 - user site directory is enabled
      1 - user site directory is disabled by user
      2 - uses site directory is disabled by super user
          or for security reasons
     >2 - unknown error
    r*zsys.path = [z    %r,�]zUSER_BASE: %r (%s)r#z
doesn't existzUSER_SITE: %r (%s)zENABLE_USER_SITE: %rrz--user-basez--user-siteFr^rv�
)r�argvrlrnr4rrrpror�rrkrm�pathsepr�textwrap�dedent)r�rV�	user_baserqr
�bufferr�rrr�_scriptQsD
��




r��__main__)N)N)N)&r�rrr�r�r,r}r�rxrormrkr
rr"r(rCrKrSrfrjrlrnrrr~r�r�r�r�r�r�r�r�r�rP�no_siter�r�rrrr�<module>sHG	
*
 


;4
3
dis.cpython-38.opt-2.pyc000064400000027343150335716500010731 0ustar00U

e5dZP�@sddlZddlZddlZddlZddlTddlmZdddddd	d
ddd
dgeZ[ejejej	e
eefZ
edZdedfedfedffZedZdZdd�ZdUddd�dd�ZdVdd�dd�Zddddd d!d"d#d$d%d&�
Zd'd(�Zd)d*�Zd+d�Zd,d-�Zdd�d.d�Ze�d/d0�Z d1e j!_"d2e j_"d3e j#_"d4e j$_"d5e j%_"d6e j&_"d7e j'_"d8e j(_"d9Z)d:Z*Gd;d
�d
e �Z+dd<�d=d�Z,d>d?�Z-d@dA�Z.dWdBdC�Z/dXdd�dEd�Z0ddd�dFdG�Z1dYdddH�dIdJ�Z2dKdL�Z3e0Z4dMdN�Z5dOd
�Z6dPd	�Z7GdQd�d�Z8dRdS�Z9e:dTk�re9�dS)Z�N)�*)�__all__�	code_info�dis�disassemble�distb�disco�findlinestarts�
findlabels�	show_code�get_instructions�Instruction�Bytecode�FORMAT_VALUE)N��str�repr�ascii�
MAKE_FUNCTION)�defaultsZ
kwdefaultsZannotationsZclosurecCs6zt||d�}Wn tk
r0t||d�}YnX|S)N�eval�exec)�compile�SyntaxError)�source�name�c�r�/usr/lib64/python3.8/dis.py�_try_compiles
r��file�depthcCsh|dkrt|d�dSt|d�r&|j}t|d�r8|j}n4t|d�rJ|j}n"t|d�r\|j}nt|d�rl|j}t|d�r�t|j�	��}|D]p\}}t
|t�r�td||d�zt
|||d	�Wn0tk
r�}ztd
||d�W5d}~XYnXt|d�q�nht|d��rt|||d	�nLt
|ttf��r6t||d�n.t
|t��rRt|||d	�ntdt|�j��dS)
N�r!�__func__�__code__�gi_code�ag_code�cr_code�__dict__zDisassembly of %s:r zSorry:�co_code�(don't know how to disassemble %s objects)r�hasattrr$r%r&r'r(�sortedr)�items�
isinstance�
_have_code�printr�	TypeError�_disassemble_recursive�bytes�	bytearray�_disassemble_bytesr�_disassemble_str�type�__name__)�xr!r"r.rZx1�msgrrrr+s@	







 �r#cCsX|dkr@z
tj}Wntk
r0td�d�YnX|jr@|j}q2t|jj|j|d�dS)Nz no last traceback to disassembler#)	�sys�last_traceback�AttributeError�RuntimeError�tb_nextr�tb_frame�f_code�tb_lasti)�tbr!rrrrXs
Z	OPTIMIZEDZ	NEWLOCALSZVARARGSZVARKEYWORDSZNESTEDZ	GENERATORZNOFREEZ	COROUTINEZITERABLE_COROUTINEZASYNC_GENERATOR)
������ �@��icCs`g}td�D]:}d|>}||@r|�t�|t|���||N}|sqVq|�t|��d�|�S)NrJrE�, )�range�append�COMPILER_FLAG_NAMES�get�hex�join)�flags�names�i�flagrrr�pretty_flagsrsrYcCs�t|d�r|j}t|d�r"|j}n4t|d�r4|j}n"t|d�rF|j}nt|d�rV|j}t|t�rjt|d�}t|d�rx|St	dt
|�j��dS)	Nr$r%r&r'r(z
<disassembly>r*r+)r,r$r%r&r'r(r/rrr2r8r9�r:rrr�_get_code_object�s"







�r[cCstt|��S�N)�_format_code_infor[rZrrrr�scCs�g}|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�|�dt|j	��|j
r�|�d	�t|j
�D]}|�d
|�q�|jr�|�d�t|j�D]}|�d|�q�|j
�r|�d
�t|j
�D]}|�d|��q|j�rH|�d�t|j�D]}|�d|��q2|j�rz|�d�t|j�D]}|�d|��qdd�|�S)NzName:              %szFilename:          %szArgument count:    %szPositional-only arguments: %szKw-only arguments: %szNumber of locals:  %szStack size:        %szFlags:             %sz
Constants:z%4d: %rzNames:z%4d: %szVariable names:zFree variables:zCell variables:�
)rP�co_name�co_filename�co_argcount�co_posonlyargcount�co_kwonlyargcount�
co_nlocals�co_stacksizerY�co_flags�	co_consts�	enumerate�co_names�co_varnames�co_freevars�co_cellvarsrT)�co�linesZi_cZi_nrrrr]�s<




r]cCstt|�|d�dS�Nr#)r1r)rmr!rrrr�s�_InstructionzBopname opcode arg argval argrepr offset starts_line is_jump_targetz!Human readable name for operationzNumeric code for operationz6Numeric argument to operation (if any), otherwise Nonez4Resolved arg value (if known), otherwise same as argz0Human readable description of operation argumentz1Start index of operation within bytecode sequencez4Line started by this opcode (if any), otherwise Nonez1True if other code jumps to here, otherwise False��c@seZdZddd�ZdS)r
�FrGcCs�g}|r:|jdk	r,d|}|�||j�n|�d|�|rJ|�d�n
|�d�|jrf|�d�n
|�d�|�t|j��|��|�|j�t��|j	dk	r�|�t|j	��t
��|jr�|�d|jd�d�|��
�S)	Nz%%%dd� z-->z   z>>z  �(�))�starts_linerP�is_jump_targetr�offset�rjust�opname�ljust�
_OPNAME_WIDTH�arg�_OPARG_WIDTH�argreprrT�rstrip)�self�lineno_widthZmark_as_current�offset_widthZfieldsZ
lineno_fmtrrr�_disassemble�s&



zInstruction._disassembleN)rsFrG)r9�
__module__�__qualname__r�rrrrr
�s)�
first_linecCsTt|�}|j|j}tt|��}|dk	r4||j}nd}t|j|j|j	|j
|||�S�Nr)r[rlrk�dictr	�co_firstlineno�_get_instructions_bytesr*rjrirg)r:r�rm�
cell_names�
linestarts�line_offsetrrrrs�cCs |}|dk	r||}|t|�fSr\�r)Zconst_indexZ
const_list�argvalrrr�_get_const_infosr�cCs*|}|dk	r||}|}nt|�}||fSr\r�)Z
name_indexZ	name_listr�r�rrr�_get_name_info'sr�c
#s�t|�}d}t|�D�]r\}	}
�|dk	rD|�|	d�}|dk	rD||7}|	|k}d}d}
�dk	�rl�}|
tkrzt�|�\}}
n�|
tkr�t�|�\}}
n�|
tkr�|	d�}dt|�}
n�|
t	kr�t�|�\}}
n�|
t
kr�t�}|}
n�|
tkr�t�|�\}}
nr|
t
k�rFt�d@\}}
|t�d@�f}|d�rl|
�r<|
d7}
|
d7}
n&|
tk�rld��fd	d
�tt�D��}
tt|
|
�||
|	||�VqdS)NrrFzto rsrGrErNzwith formatc3s"|]\}}�d|>@r|VqdS)rENr)�.0rW�s�r~rr�	<genexpr>gs�z*_get_instructions_bytes.<locals>.<genexpr>)r
�_unpack_opargsrRZhasconstr�Zhasnamer��hasjrelrZhaslocalZ
hascompareZcmp_opZhasfreer�FORMAT_VALUE_CONVERTERS�boolrrTrh�MAKE_FUNCTION_FLAGSr
r{)�code�varnamesrV�	constants�cellsr�r��labelsrwry�oprxr�r�rr�rr�7sV






�r����c
Cs<|j|j}tt|��}t|j||j|j|j|||d�dSro)	rlrkr�r	r6r*rjrirg)rm�lastir!r�r�rrrrms�cCspt||d�|dks|dkrl|dk	r,|d}|jD]8}t|d�r2t|d�td|f|d�t|||d�q2dS)Nr#rrEr*zDisassembly of %r:r )rrgr,r1r3)rmr!r"r:rrrr3ts


r3)r!r�c	Cs�|dk	}	|	r8t|���|}
|
dkr2tt|
��}q<d}nd}t|�d}|dkr^tt|��}
nd}
t|||||||d�D]J}|	o�|jdk	o�|jdk}|r�t|d�|j|k}t|�|||
�|d�qxdS)	Ni�rsrrFi'rG�r�r#)	�max�values�lenrr�rwryr1r�)r�r�r�rVr�r�r�r!r�Zshow_linenoZ	maxlinenor�Z	maxoffsetr�ZinstrZnew_source_lineZis_current_instrrrrr6s8�
��

�r6cKstt|d�f|�dS)Nz<dis>)r3r)r�kwargsrrrr7�sr7ccsdd}tdt|�d�D]J}||}|tkrN||d|B}|tkrH|d>nd}nd}|||fVqdS)NrrFrErH)rOr�Z
HAVE_ARGUMENTZEXTENDED_ARG)r�Zextended_argrWr�r~rrrr��sr�cCs\g}t|�D]J\}}}|dk	r|tkr4|d|}n|tkr|}nq||kr|�|�q|S)NrF)r�r�ZhasjabsrP)r�r�ryr�r~Zlabelrrrr
�sc	cs�|jddd�}|jddd�}t|j�}d}|j}d}t||�D]P\}}|rz||krd||fV|}||7}||krzdS|dkr�|d8}||7}qB||kr�||fVdS)NrrFrErLrM)�	co_lnotabr�r*r��zip)	r�Zbyte_incrementsZline_incrementsZbytecode_lenZ
lastlineno�linenoZaddrZ	byte_incrZ	line_incrrrrr	�s&


c@sHeZdZddd�dd�Zdd�Zdd�Zed	d
��Zdd�Zd
d�Z	dS)rN)r��current_offsetcCsdt|�|_}|dkr&|j|_d|_n||_||j|_|j|j|_tt	|��|_
||_||_dSr�)
r[�codeobjr�r��_line_offsetrlrk�_cell_namesr�r	�_linestarts�_original_objectr�)r�r:r�r�rmrrr�__init__�szBytecode.__init__c	Cs*|j}t|j|j|j|j|j|j|jd�S)Nr�)	r�r�r*rjrirgr�r�r�)r�rmrrr�__iter__�s�zBytecode.__iter__cCsd�|jj|j�S)Nz{}({!r}))�format�	__class__r9r��r�rrr�__repr__�s
�zBytecode.__repr__cCs |jr|j}q||jj|jd�S)N)r�)r@rArBrC)�clsrDrrr�from_traceback�szBytecode.from_tracebackcCs
t|j�Sr\)r]r�r�rrr�infosz
Bytecode.infocCsl|j}|jdk	r|j}nd}t���>}t|j|j|j|j|j	|j
|j||d�	|��W5QR�SQRXdS)Nr�)r�rVr�r�r�r�r!r�)
r�r��io�StringIOr6r*rjrirgr�r�r��getvalue)r�rmry�outputrrrr
s


�zBytecode.dis)
r9r�r�r�r�r��classmethodr�r�rrrrrr�s

c	Csfddl}|��}|jd|�d�ddd�|��}|j�}|��}W5QRXt||jjd�}t	|�dS)Nr�infile�rb�?�-)r8�nargs�defaultr)
�argparse�ArgumentParser�add_argumentZFileType�
parse_argsr��readrrr)r��parser�argsr�rr�rrr�_testsr��__main__)N)N)NNNNNr)r�)r�NNNNN);r<�types�collectionsr�ZopcoderZ_opcodes_all�
MethodType�FunctionType�CodeTyper��staticmethodr8r0Zopmaprrrrr�rr�rrrrQrYr[rr]r�
namedtuplerpr{�__doc__r~r�r�ryrwrxr}rr
rr�r�r�rr3r6r7rr�r
r	rr�r9rrrr�<module>s�
����
-�
 �4�
6��=
gzip.cpython-38.pyc000064400000043412150335716500010156 0ustar00U

e5d�S�@sdZddlZddlZddlZddlZddlZddlZddlZddlZdddddgZ	d\Z
ZZZ
Zd	\ZZd
ZdZdZd
edddfdd�Zdd�ZGdd�d�ZGdd�de�ZGdd�dej�ZGdd�dej�Zefdd�dd�Zdd�Zdd�Ze dk�re�dS)z�Functions that read and write gzipped files.

The user of the file doesn't have to worry about the compression,
but random access is not allowed.�N�BadGzipFile�GzipFile�open�compress�
decompress)�����)rrr��	�rbcCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|�dd�}t|tttjf�r|t|||�}n,t|d	�s�t|d
�r�td|||�}nt	d��d|kr�t
�||||�S|SdS)aOpen a gzip-compressed file in binary or text mode.

    The filename argument can be an actual filename (a str or bytes object), or
    an existing file object to read from or write to.

    The mode argument can be "r", "rb", "w", "wb", "x", "xb", "a" or "ab" for
    binary mode, or "rt", "wt", "xt" or "at" for text mode. The default mode is
    "rb", and the default compresslevel is 9.

    For binary mode, this function is equivalent to the GzipFile constructor:
    GzipFile(filename, mode, compresslevel). In this case, the encoding, errors
    and newline arguments must not be provided.

    For text mode, a GzipFile object is created, and wrapped in an
    io.TextIOWrapper instance with the specified encoding, error handling
    behavior, and line ending(s).

    �t�bzInvalid mode: %rNz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary mode��read�writez1filename must be a str or bytes object, or a file)�
ValueError�replace�
isinstance�str�bytes�os�PathLiker�hasattr�	TypeError�io�
TextIOWrapper)�filename�mode�
compresslevel�encoding�errors�newlineZgz_modeZbinary_file�r%�/usr/lib64/python3.8/gzip.pyrs$cCs|�t�d|��dS)Nz<L)r�structZpack)�output�valuer%r%r&�write32uEsr*c@s<eZdZdZddd�Zdd�Zddd�Zd	d
�Zdd�Zd
S)�_PaddedFilez�Minimal read-only file object that prepends a string to the contents
    of an actual file. Shouldn't be used outside of gzip.py, as it lacks
    essential functionality.�cCs ||_t|�|_||_d|_dS�Nr)�_buffer�len�_length�file�_read)�self�f�prependr%r%r&�__init__Os
z_PaddedFile.__init__cCs~|jdkr|j�|�S|j||jkrJ|j}|j|7_|j||j�S|j}d|_|j|d�|j�||j|�SdS�N)r2r1rr0r.)r3�sizerr%r%r&rUs
�z_PaddedFile.readcCs>|jdkr||_n|jt|�8_dSt|j�|_d|_dSr-)r2r.r/r0)r3r5r%r%r&r5bs
z_PaddedFile.prependcCsd|_d|_|j�|�Sr7)r2r.r1�seek)r3Zoffr%r%r&r9ksz_PaddedFile.seekcCsdS�NTr%�r3r%r%r&�seekablepsz_PaddedFile.seekableN)r,)r,)	�__name__�
__module__�__qualname__�__doc__r6rr5r9r<r%r%r%r&r+Js

	r+c@seZdZdZdS)rz6Exception raised in some cases for invalid gzip files.N)r=r>r?r@r%r%r%r&rtsc@s�eZdZdZdZddeddfdd�Zedd��Zedd��Z	d	d
�Z
dd�Zd
d�Zdd�Z
d,dd�Zd-dd�Zdd�Zedd��Zdd�Zejfdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zejfd(d)�Zd.d*d+�ZdS)/ra
The GzipFile class simulates most of the methods of a file object with
    the exception of the truncate() method.

    This class only supports opening files in binary mode. If you need to open a
    compressed file in text mode, use the gzip.open() function.

    NcCs4|r"d|ksd|kr"td�|���|r6d|kr6|d7}|dkrTt�||pJd�}|_|dkr|t|dd�}t|ttf�s�d}n
t	�
|�}|dkr�t|d	d�}|�d
�r�t|_
t|�}t�|�|_||_nN|�d��rt|_
|�|�t�|tjtjtjd�|_||_ntd�|���||_|j
tk�r0|�|�dS)
aGConstructor for the GzipFile class.

        At least one of fileobj and filename must be given a
        non-trivial value.

        The new class instance is based on fileobj, which can be a regular
        file, an io.BytesIO object, or any other object which simulates a file.
        It defaults to None, in which case filename is opened to provide
        a file object.

        When fileobj is not None, the filename argument is only used to be
        included in the gzip file header, which may include the original
        filename of the uncompressed file.  It defaults to the filename of
        fileobj, if discernible; otherwise, it defaults to the empty string,
        and in this case the original filename is not included in the header.

        The mode argument can be any of 'r', 'rb', 'a', 'ab', 'w', 'wb', 'x', or
        'xb' depending on whether the file will be read or written.  The default
        is the mode of fileobj if discernible; otherwise, the default is 'rb'.
        A mode of 'r' is equivalent to one of 'rb', and similarly for 'w' and
        'wb', 'a' and 'ab', and 'x' and 'xb'.

        The compresslevel argument is an integer from 0 to 9 controlling the
        level of compression; 1 is fastest and produces the least compression,
        and 9 is slowest and produces the most compression. 0 is no compression
        at all. The default is 9.

        The mtime argument is an optional numeric timestamp to be written
        to the last modification time field in the stream when compressing.
        If omitted or None, the current time is used.

        r�UzInvalid mode: {!r}rNr�namerr �r)�w�a�xr)r�format�builtinsr�	myfileobj�getattrrrrr�fspath�
startswith�READr �_GzipReaderr�BufferedReaderr.rB�WRITE�_init_write�zlibZcompressobjZDEFLATED�	MAX_WBITSZ
DEF_MEM_LEVELr�_write_mtime�fileobj�_write_gzip_header)r3rr r!rU�mtime�rawr%r%r&r6�s@#


�zGzipFile.__init__cCsBddl}|�dtd�|jtkr<|jdd�dkr<|jdS|jS)Nrzuse the name attributer����.gz)�warnings�warn�DeprecationWarningr rPrB)r3r[r%r%r&r�s

zGzipFile.filenamecCs
|jjjS)z0Last modification time read from stream, or None)r.rX�_last_mtimer;r%r%r&rW�szGzipFile.mtimecCs.t|j�}d|dd�dtt|��dS)Nz<gzip r���� �>)�reprrU�hex�id)r3�sr%r%r&�__repr__�s
zGzipFile.__repr__cCs.||_t�d�|_d|_g|_d|_d|_dS�Nr,r)rBrR�crc32�crcr8Zwritebuf�bufsize�offset)r3rr%r%r&rQ�szGzipFile._init_writecCs|j�d�|j�d�z<tj�|j�}t|t�s<|�d�}|�	d�rR|dd�}Wnt
k
rld}YnXd}|rzt}|j�t|��d��|j
}|dkr�t��}t|jt|��|tkr�d}n|tkr�d	}nd
}|j�|�|j�d�|�r|j�|d
�dS)N���zlatin-1s.gzrYr,r�����)rUrr�path�basenamerBrr�encode�endswith�UnicodeEncodeError�FNAME�chrrT�timer*�int�_COMPRESS_LEVEL_BEST�_COMPRESS_LEVEL_FAST)r3r!Zfname�flagsrWZxflr%r%r&rV�s6



zGzipFile._write_gzip_headercCs�|��|jtkr&ddl}t|jd��|jdkr8td��t|t	�rLt
|�}nt|�}|j}|dkr�|j�
|j�|��|j|7_t�||j�|_|j|7_|S)Nrz$write() on read-only GzipFile objectz!write() on closed GzipFile object)�_check_not_closedr rP�errno�OSError�EBADFrUrrrr/�
memoryview�nbytesrrr8rRrhrirk)r3�datarZlengthr%r%r&rs 



zGzipFile.writer_cCs2|��|jtkr&ddl}t|jd��|j�|�S)Nrz$read() on write-only GzipFile object)r~r rMrr�r�r.r�r3r8rr%r%r&rs

z
GzipFile.readcCs@|��|jtkr&ddl}t|jd��|dkr4tj}|j�	|�S)zdImplements BufferedIOBase.read1()

        Reads up to a buffer's worth of data if size is negative.rNz%read1() on write-only GzipFile object)
r~r rMrr�r�r�DEFAULT_BUFFER_SIZEr.�read1r�r%r%r&r�&s
zGzipFile.read1cCs2|��|jtkr&ddl}t|jd��|j�|�S)Nrz$peek() on write-only GzipFile object)r~r rMrr�r�r.�peek)r3�nrr%r%r&r�3s

z
GzipFile.peekcCs
|jdkSr7�rUr;r%r%r&�closed:szGzipFile.closedcCs�|j}|dkrdSd|_zP|jtkrR|�|j���t||j	�t||j
d@�n|jtkrf|j��W5|j}|r�d|_|��XdS)N���)
rUrI�closer rPrr�flushr*rir8rMr.)r3rUrIr%r%r&r�>s

zGzipFile.closecCs4|��|jtkr0|j�|j�|��|j��dSr7)r~r rPrUrrr�)r3Z	zlib_moder%r%r&r�Qs
zGzipFile.flushcCs
|j��S)z�Invoke the underlying file object's fileno() method.

        This will raise AttributeError if the underlying file object
        doesn't support fileno().
        )rU�filenor;r%r%r&r�XszGzipFile.filenocCs"|jtkrtd��|j�d�dS)z[Return the uncompressed stream file position indicator to the
        beginning of the filezCan't rewind in write moderN)r rMr�r.r9r;r%r%r&�rewind`s
zGzipFile.rewindcCs
|jtkSr7)r rMr;r%r%r&�readablegszGzipFile.readablecCs
|jtkSr7)r rPr;r%r%r&�writablejszGzipFile.writablecCsdSr:r%r;r%r%r&r<mszGzipFile.seekablecCs�|jtkr�|tjkr2|tjkr*|j|}ntd��||jkrDtd��||j}d}t|d�D]}|�	|�q^|�	d|d�n |jt
kr�|��|j�
||�S|jS)NzSeek from end not supportedzNegative seek in write modes�rp)r rPr�SEEK_SET�SEEK_CURrkrr��rangerrMr~r.r9)r3rk�whence�count�chunk�ir%r%r&r9ps 





z
GzipFile.seekcCs|��|j�|�Sr7)r~r.�readline)r3r8r%r%r&r��szGzipFile.readline)r_)r_)r_)r=r>r?r@rIr{r6�propertyrrWrfrQrVrrr�r�r�r�rRZZ_SYNC_FLUSHr�r�r�r�r�r<rr�r9r�r%r%r%r&rxs:
�
I

 



csZeZdZ�fdd�Zdd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Z	�fdd�Z
�ZS)rNcs,t�jt|�tjtjd�d|_d|_dS)N)ZwbitsT)�superr6r+rRZ
decompressobjrS�_new_memberr^)r3�fp��	__class__r%r&r6�s
�z_GzipReader.__init__cCst�d�|_d|_dSrg)rRrh�_crc�_stream_sizer;r%r%r&�
_init_read�sz_GzipReader._init_readcCsF|j�|�}t|�|krB|j�|t|��}|s8td��||7}q|S)z�Read exactly *n* bytes from `self._fp`

        This method is required because self._fp may be unbuffered,
        i.e. return short reads.
        �ACompressed file ended before the end-of-stream marker was reached)�_fprr/�EOFError)r3r�r�rr%r%r&�_read_exact�s
z_GzipReader._read_exactcCs�|j�d�}|dkrdS|dkr,td|��t�d|�d��\}}|_|dkrVtd��|t@r|t�d	|�d��\}|�|�|t@r�|j�d
�}|r�|dkr�q�q�|t	@r�|j�d
�}|r�|dkr�q�q�|t
@r�|�d�dS)
Nrr,FrlzNot a gzipped file (%r)z<BBIxxr
zUnknown compression methodz<HrrpT)r�rrr'�unpackr�r^�FEXTRArw�FCOMMENT�FHCRC)r3�magic�method�flagZ	extra_lenrer%r%r&�_read_gzip_header�s0�

z_GzipReader._read_gzip_headerr_cCs�|dkr|��S|sdS|jjr>|��d|_|jf|j�|_|jrf|��|��s`|j	|_
dSd|_|j�t
j�}|j�||�}|jjdkr�|j�|jj�n|jjdkr�|j�|jj�|dkr�q�|dkrtd��q|�|�|j	t|�7_	|S)Nrr,TFr�)�readallZ
_decompressor�eof�	_read_eofr�Z_decomp_factoryZ_decomp_argsr�r�Z_posZ_sizer�rrr�rZunconsumed_tailr5Zunused_datar��_add_read_datar/)r3r8�bufZ
uncompressr%r%r&r�s:�

z_GzipReader.readcCs$t�||j�|_|jt|�|_dSr7)rRrhr�r�r/)r3r�r%r%r&r��sz_GzipReader._add_read_datacCs�t�d|�d��\}}||jkr<tdt|�t|j�f��n||jd@krRtd��d}|dkrl|j�d�}qV|r||j�	|�dS)Nz<IIr
zCRC check failed %s != %sr�z!Incorrect length of data producedrpr)
r'r�r�r�rrcr�r�rr5)r3rhZisize�cr%r%r&r��s

�
z_GzipReader._read_eofcst���d|_dSr:)r��_rewindr�r;r�r%r&r�s
z_GzipReader._rewind)r_)r=r>r?r6r�r�r�rr�r�r��
__classcell__r%r%r�r&rN�s!
3rN)rWc	Cs6t��}t|d||d��}|�|�W5QRX|��S)z�Compress data in one shot and return the compressed string.
    Optional argument is the compression level, in range of 0-9.
    �wb)rUr r!rW)r�BytesIOrr�getvalue)r�r!rWr�r4r%r%r&rsc
Cs0tt�|�d��}|��W5QR�SQRXdS)zYDecompress a gzip compressed string in one shot.
    Return the decompressed string.
    r�N)rrr�r)r�r4r%r%r&rsc	Cs�ddlm}|dd�}|��}|jdddd�|jd	dd
d�|jdddd
d�|jdddgdd�|��}t}|jr|t}n
|jr�t	}|j
D]�}|jr�|dkr�tddt
jjd�}t
jj}n>|dd�dkr�t
�d|���t|d�}t�|dd�d�}nB|dk�r"t
jj}tddt
jj|d�}nt�|d�}t|dd�}|�d�}|�sP�q^|�|��q<|t
jjk	�rt|��|t
jjk	r�|��q�dS)Nr)�ArgumentParserzeA simple command line interface for the gzip module: act like gzip, but do not delete the input file.)Zdescriptionz--fast�
store_truezcompress faster)�action�helpz--bestzcompress betterz-dz--decompresszact like gunzip instead of gzip�args�*�-r1)�nargs�default�metavarrr)rr rUrYrZzfilename doesn't end in .gz: r�)rr rUr!r�)�argparser�Zadd_mutually_exclusive_group�add_argument�
parse_args�_COMPRESS_LEVEL_TRADEOFFZfastr|Zbestr{r�rr�sys�stdin�buffer�stdout�exitrrHrrr�)	r��parser�groupr�r!�argr4�gr�r%r%r&�main'sR�
�



�
r��__main__)!r@r'r�ryrrRrHrZ_compression�__all__ZFTEXTr�r�rwr�rMrPr|r�r{rr*r+r�rZ
BaseStreamrZDecompressReaderrNrrr�r=r%r%r%r&�<module>s: �
,*	0
decimal.cpython-38.opt-2.pyc000064400000000551150335716500011540 0ustar00U

e5d@�@svz0ddlTddlmZddlmZddlmZWn@ek
rpddlTddlmZddlmZddlmZYnXdS)�)�*)�__doc__)�__version__)�__libmpdec_version__N)Z_decimalrrr�ImportErrorZ
_pydecimal�rr�/usr/lib64/python3.8/decimal.py�<module>spickle.cpython-38.opt-1.pyc000064400000133311150335716500011411 0ustar00U

e5d��	@shdZddlmZddlmZddlmZmZmZddlm	Z	ddl
mZddlZddlm
Z
dd	lmZmZddlZddlZddlZddlZd
ddd
dddddg	ZzddlmZe�d�dZWnek
r�dZYnXeefZdZddddddddgZdZ d Z!Gd!d
�d
e"�Z#Gd"d�de#�Z$Gd#d�de#�Z%Gd$d%�d%e"�Z&zdd&l'm(Z(Wnek
�rldZ(YnXd'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/d.Z0d/Z1d0Z2d1Z3d2Z4d3Z5d4Z6d5Z7d6Z8d7Z9d8Z:d9Z;d:Z<d;Z=d<Z>d=Z?d>Z@d?ZAd@ZBdAZCdBZDdCZEdDZFdEZGdFZHdGZIdHZJdIZKdJZLdKZMdLZNdMZOdNZPdOZQdPZRdQZSdRZTdSZUdTZVdUZWdVZXdWZYdXZZdYZ[dZZ\d[Z]d\Z^d]Z_eOeYeZe[gZ`d^Zad_Zbd`ZcdaZddbZedcZfddZgdeZhdfZidgZjdhZkdiZldjZmdkZndlZoe�pdmdn�eq�D��Gdodp�dp�ZrGdqdr�dr�Zsdsdt�Ztdudv�Zudwdx�Zvdydz�ZwGd{d|�d|�ZxGd}d~�d~�Zyd�ddd�d�d��Zzd�ddd�d�d��Z{dd�d�dd��d�d��Z|dd�d�dd��d�d��Z}z0dd�lm#Z#m$Z$m%Z%m~Z~mZm�Z�m�Z�m�Z�m�Z�Wn4ek
�r�exeyZ~Zeze{e|e}f\Z�Z�Z�Z�YnXd�d��Z�e�d�k�rdddl�Z�e�j�d�d��Z�e�j�d�e���d��d�d�d��e�j�d�d�d�d�d��e�j�d�d�d�d��e����Z�e�j��r*e��n:e�j��s<e����n(ddl�Z�e�j�D]Z�e�e��Z�e���e���qJdS)�a�Create portable serialized representations of Python objects.

See module copyreg for a mechanism for registering custom picklers.
See module pickletools source for extensive comments.

Classes:

    Pickler
    Unpickler

Functions:

    dump(object, file)
    dumps(object) -> string
    load(file) -> object
    loads(string) -> object

Misc variables:

    __version__
    format_version
    compatible_formats

�)�FunctionType)�dispatch_table)�_extension_registry�_inverted_registry�_extension_cache)�islice)�partialN)�maxsize)�pack�unpack�PickleError�
PicklingError�UnpicklingError�Pickler�	Unpickler�dump�dumps�load�loads)�PickleBufferrTFz4.0z1.0z1.1z1.2z1.3z2.0z3.0z5.0��c@seZdZdZdS)rz6A common base class for the other pickling exceptions.N��__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.8/pickle.pyrIsc@seZdZdZdS)r
z]This exception is raised when an unpicklable object is passed to the
    dump() method.

    Nrrrrrr
Msc@seZdZdZdS)raThis exception is raised when there is a problem unpickling an object,
    such as a security violation.

    Note that other exceptions may also be raised during unpickling, including
    (but not necessarily limited to) AttributeError, EOFError, ImportError,
    and IndexError.

    NrrrrrrTsc@seZdZdd�ZdS)�_StopcCs
||_dS�N)�value��selfr!rrr�__init__bsz_Stop.__init__N)rrrr$rrrrrasr)�PyStringMap�(�.�0�1�2�F�I�J�K�L�M�N�P�Q�R�S�T�U�V�X�a�b�c�d�}�e�g�h�i�j�l�]�o�p�q�r�s�t�)�u�GsI01
sI00
�������������������������B�C��������������������������cCsg|]}t�d|�r|�qS)z[A-Z][A-Z0-9_]+$)�re�match)�.0�xrrr�
<listcomp>�srnc@sFeZdZdZdZdd�Zdd�Zdd�Zdd
d�Zdd
�Z	dd�Z
dS)�_FramerricCs||_d|_dSr )�
file_write�
current_frame)r#rprrrr$�sz_Framer.__init__cCst��|_dSr )�io�BytesIOrq�r#rrr�
start_framing�sz_Framer.start_framingcCs*|jr&|j��dkr&|jdd�d|_dS)NrT��force)rq�tell�commit_framertrrr�end_framing�sz_Framer.end_framingFcCsf|jrb|j}|��|jks|rb|��}|j}t|�|jkrP|ttdt|���||�t	�
�|_dS)N�<Q)rqrx�_FRAME_SIZE_TARGET�	getbufferrp�len�_FRAME_SIZE_MIN�FRAMEr
rrrs)r#rw�f�data�writerrrry�sz_Framer.commit_framecCs |jr|j�|�S|�|�SdSr )rqr�rp�r#r�rrrr��sz
_Framer.writecCs,|j}|jr|jdd�||�||�dS)NTrv)rprqry)r#�headerZpayloadr�rrr�write_large_bytes�s
z_Framer.write_large_bytesN)F)rrrrr|r$rurzryr�r�rrrrro�s
roc@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�	_UnframerNcCs||_||_d|_dSr )�	file_read�
file_readlinerq)r#r�r�Z	file_tellrrrr$	sz_Unframer.__init__cCs�|jrb|j�|�}|dkrJt|�dkrJd|_t|�}|�|�|dd�<|S|t|�kr^td��|St|�}|�|�|dd�<|SdS�Nr�$pickle exhausted before end of frame)rq�readintor~r�r)r#�buf�nrrrr�s�z_Unframer.readintocCsT|jrF|j�|�}|s.|dkr.d|_|�|�St|�|krBtd��|S|�|�SdSr�)rq�readr�r~r�r#r�r�rrrr�s
�z_Unframer.readcCsF|jr:|j��}|s"d|_|��S|ddkr6td��|S|��SdS)N����
r�)rq�readliner�rr�rrrr�,s
�z_Unframer.readlinecCs2|jr|j��dkrtd��t�|�|��|_dS)N�z4beginning of a new frame before end of current frame)rqr�rrrrsr��r#Z
frame_sizerrr�
load_frame9s
�z_Unframer.load_frame)N)rrrr$r�r�r�r�rrrrr�s



r�c	Csj|�d�D]V}|dkr&td�||���z|}t||�}Wq
tk
r^td�||��d�Yq
Xq
||fS)N�.z<locals>z&Can't get local attribute {!r} on {!r}z Can't get attribute {!r} on {!r})�split�AttributeError�format�getattr)�obj�nameZsubpath�parentrrr�
_getattributeBs"���
r�c	Cs�t|dd�}|dk	r|Stj����D]X\}}|dks&|dks&|dkrHq&z t||�d|krf|WSWq&tk
r|Yq&Xq&dS)z$Find the module an object belong to.rN�__main__Z__mp_main__r)r��sys�modules�copy�itemsr�r�)r�r��module_name�modulerrr�whichmoduleOs ��r�cCsh|dkrdS|��d?d}|j|ddd�}|dkrd|dkrd|dd	krd|d
d@dkrd|dd�}|S)
a�Encode a long to a two's complement little-endian binary string.
    Note that 0 is a special case, returning an empty string, to save a
    byte in the LONG1 pickling context.

    >>> encode_long(0)
    b''
    >>> encode_long(255)
    b'\xff\x00'
    >>> encode_long(32767)
    b'\xff\x7f'
    >>> encode_long(-256)
    b'\x00\xff'
    >>> encode_long(-32768)
    b'\x00\x80'
    >>> encode_long(-128)
    b'\x80'
    >>> encode_long(127)
    b'\x7f'
    >>>
    rr����littleT��	byteorderZsignedr������N)�
bit_length�to_bytes)rm�nbytes�resultrrr�encode_longbsr�cCstj|ddd�S)a\Decode a long from a two's complement little-endian binary string.

    >>> decode_long(b'')
    0
    >>> decode_long(b"\xff\x00")
    255
    >>> decode_long(b"\xff\x7f")
    32767
    >>> decode_long(b"\x00\xff")
    -256
    >>> decode_long(b"\x00\x80")
    -32768
    >>> decode_long(b"\x80")
    -128
    >>> decode_long(b"\x7f")
    127
    r�Tr�)�int�
from_bytes)r�rrr�decode_long�sr�c@s�eZdZd;ddd�dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Zd<dd�Z	dd�Z
dd�Zd=dd�ZiZ
dd�Zee
ed�<dd�Zee
e<dd�Zee
e<dd�Zee
e<d d!�Zee
e<d"d#�Zee
e<er�d$d%�Zee
e<d&d'�Zee
e<d(d)�Zee
e <d*d+�Z!e!e
e"<d,Z#d-d.�Z$d/d0�Z%e%e
e&<e'dk	�r@e%e
e'<d1d2�Z(d3d4�Z)e)e
e*<d5d6�Z+e+e
e,<d>d7d8�Z-d9d:�Z.e-e
e/<e.e
e<dS)?�_PicklerNT��fix_imports�buffer_callbackcCs�|dkrt}|dkrt}n"d|kr.tks<ntdt��|dk	rT|dkrTtd��||_z|j|_Wntk
r�td��YnXt|j�|_	|j	j|_|j	j
|_i|_t
|�|_|dk|_d|_|o�|dk|_dS)	a!This takes a binary file for writing a pickle data stream.

        The optional *protocol* argument tells the pickler to use the
        given protocol; supported protocols are 0, 1, 2, 3, 4 and 5.
        The default protocol is 4. It was introduced in Python 3.4, and
        is incompatible with previous versions.

        Specifying a negative protocol version selects the highest
        protocol version supported.  The higher the protocol used, the
        more recent the version of Python needed to read the pickle
        produced.

        The *file* argument must have a write() method that accepts a
        single bytes argument. It can thus be a file object opened for
        binary writing, an io.BytesIO instance, or any other custom
        object that meets this interface.

        If *fix_imports* is True and *protocol* is less than 3, pickle
        will try to map the new Python 3 names to the old module names
        used in Python 2, so that the pickle data stream is readable
        with Python 2.

        If *buffer_callback* is None (the default), buffer views are
        serialized into *file* as part of the pickle stream.

        If *buffer_callback* is not None, then it can be called any number
        of times with a buffer view.  If the callback returns a false value
        (such as None), the given buffer is out-of-band; otherwise the
        buffer is serialized in-band, i.e. inside the pickle stream.

        It is an error if *buffer_callback* is not None and *protocol*
        is None or smaller than 5.
        Nrzpickle protocol must be <= %drz#buffer_callback needs protocol >= 5z"file must have a 'write' attributer�r�)�DEFAULT_PROTOCOL�HIGHEST_PROTOCOL�
ValueError�_buffer_callbackr��_file_writer��	TypeErrorro�framerr��_write_large_bytes�memor��proto�bin�fastr�)r#�file�protocolr�r�rrrr$�s*#



z_Pickler.__init__cCs|j��dS)aClears the pickler's "memo".

        The memo is the data structure that remembers which objects the
        pickler has already seen, so that shared or recursive objects
        are pickled by reference and not by value.  This method is
        useful when re-using picklers.
        N)r��clearrtrrr�
clear_memo�sz_Pickler.clear_memocCsrt|d�std|jjf��|jdkr<|�ttd|j��|jdkrP|j�	�|�
|�|�t�|j��dS)z7Write a pickled representation of obj to the open file.r�z2Pickler.__init__() was not called by %s.__init__()��<BrN)
�hasattrr
�	__class__rr�r��PROTOr
r�ru�save�STOPrz�r#r�rrrr�s
�




z
_Pickler.dumpcCs:|jr
dSt|j�}|�|�|��||f|jt|�<dS)zStore an object in the memo.N)r�r~r�r��put�id)r#r��idxrrr�memoize�s

z_Pickler.memoizecCsT|jdkrtS|jr:|dkr*ttd|�Sttd|�Sntt|��d�dSdS)Nr�r��<I�ascii�
)	r��MEMOIZEr��BINPUTr
�LONG_BINPUT�PUT�repr�encode)r#r�rrrr�s
z_Pickler.putcCs@|jr*|dkrttd|�Sttd|�Stt|��d�dS)Nr�r�r�r�r�)r��BINGETr
�LONG_BINGET�GETr�r��r#�irrr�gets
z_Pickler.getc
Cs�|j��|�|�}|dk	r.|r.|�|�dS|j�t|��}|dk	r^|�|�|d��dSt}t	|dd�}|dk	r~||�}|tk�r@t
|�}|j�|�}|dk	r�|||�dSt	|dt��|�}|dk	r�||�}njt
|t
�r�|�|�dSt	|dd�}|dk	�r||j�}n0t	|dd�}|dk	�r.|�}ntd|j|f��t|t��r\|�||�dSt|t��sttd|��t|�}	d|	k�r�d	k�s�ntd
|��|j|d|i�dS)NrZreducer_overrider�
__reduce_ex__�
__reduce__zCan't pickle %r object: %rz%s must return string or tupler��z2Tuple returned by %s must have two to six elementsr�)r�ry�
persistent_id�	save_persr�r�r�r��NotImplementedr��type�dispatchr�
issubclass�save_globalr�r
r�
isinstance�str�tupler~�save_reduce)
r#r��save_persistent_id�pidrm�rv�reduce�tr��lrrrr�sZ









��z
_Pickler.savecCsdSr rr�rrrr�]sz_Pickler.persistent_idcCsb|jr |j|dd�|�t�n>z |�tt|��d�d�Wntk
r\td��YnXdS)NF)r�r�r��2persistent IDs in protocol 0 must be ASCII strings)	r�r�r��	BINPERSID�PERSIDr�r��UnicodeEncodeErrorr
�r#r�rrrr�as �z_Pickler.save_persc
Cs>t|t�std��t|�s"td��|j}|j}	t|dd�}
|jdkr�|
dkr�|\}}}t|d�sntd�	|
���|dk	r�||j
k	r�td	�	|
���|jd
kr�||�||�||�|	t�n,t|j
|f|�|�}||�|d�|	t�n�|jdk�r^|
dk�r^|d
}t|d��std��|dk	�r8||j
k	�r8td��|dd�}||�||�|	t�n||�||�|	t�|dk	�r�t|�|jk�r�|	t|�|jt|�d
��n
|�|�|dk	�r�|�|�|dk	�r�|�|�|dk	�r:|dk�r
||�|	t�n0||�||�||�|	t�|	t�|	t�dS)Nz'args from save_reduce() must be a tuplez(func from save_reduce() must be callabler�r��
__newobj_ex__�__new__z#args[0] from {} args has no __new__z(args[0] from {} args has the wrong classrr�
__newobj__rz+args[0] from __newobj__ args has no __new__z0args[0] from __newobj__ args has the wrong classr�)r�r�r
�callabler�r�r�r�r�r�r��	NEWOBJ_EXrr�REDUCE�NEWOBJr�r��POPr�r��_batch_appends�_batch_setitems�BUILD�TUPLE2)
r#�func�args�stateZ	listitemsZ	dictitemsZstate_setterr�r�r�Z	func_name�cls�kwargsrrrr�msz


��


��

"







z_Pickler.save_reducecCs|�t�dSr )r��NONEr�rrr�	save_none�sz_Pickler.save_nonecCs4|jdkr|�|rtnt�n|�|r*tnt�dS)Nr�)r�r��NEWTRUE�NEWFALSE�TRUE�FALSEr�rrr�	save_bool�s
z_Pickler.save_boolcCs.|jr~|dkrN|dkr.|�ttd|��dS|dkrN|�ttd|��dSd|krbdkr~nn|�ttd|��dS|jd	kr�t|�}t|�}|d
kr�|�t	td|�|�n|�t
td|�|�dSd|kr�dk�rnn|�tt|��
d�d�n|�tt|��
d�d
�dS)Nrr�r���<Hi�i����<ir�r�r�r�sL
)r�r��BININT1r
�BININT2�BININTr�r�r~�LONG1�LONG4�INTr�r��LONG�r#r�Zencodedr�rrr�	save_long�s*
z_Pickler.save_longcCs<|jr|�ttd|��n|�tt|��d�d�dS)N�>dr�r�)r�r��BINFLOATr
�FLOATr�r�r�rrr�
save_floatsz_Pickler.save_floatcCs�|jdkr@|s |jtd|d�n|jtjt|d�df|d�dSt|�}|dkrj|�tt	d|�|�nf|dkr�|jdkr�|�
tt	d	|�|�n<||jj
kr�|�
tt	d
|�|�n|�tt	d
|�|�|�|�dS)Nr�r�r��latin1r�r����rr{r�)r�r��bytes�codecsr�r�r~r��SHORT_BINBYTESr
r��	BINBYTES8r�r|�BINBYTESr��r#r�r�rrr�
save_bytess"
�z_Pickler.save_bytescCs�|jdkr:|s |jtd|d�n|jtt|�f|d�dSt|�}||jjkrf|�tt	d|�|�n|�
tt	d|�|�dS)Nrrr*r{)r�r��	bytearrayr-r~r�r|r��
BYTEARRAY8r
r�r2rrr�save_bytearray)s
z_Pickler.save_bytearrayc	Cs�|jdkrtd��|���t}|js*td��d}|jdk	rFt|�|��}|rp|jr`|�|���q�|�	|���n|�
t�|jr�|�
t�W5QRXdS)Nrz0PickleBuffer can only pickled with protocol >= 5zHPickleBuffer can not be pickled when pointing to a non-contiguous bufferT)
r�r
�raw�
contiguousr��bool�readonlyr3�tobytesr6r��NEXT_BUFFER�READONLY_BUFFER)r#r��mZin_bandrrr�save_picklebuffer8s



z_Pickler.save_picklebuffercCs|jr�|�dd�}t|�}|dkrF|jdkrF|�ttd|�|�nf|dkrp|jdkrp|�ttd|�|�n<||j	j
kr�|�ttd|�|�n|�ttd|�|�nT|�d	d
�}|�dd�}|�d
d�}|�dd�}|�dd�}|�t
|�d�d�|�|�dS)N�utf-8�
surrogatepassr�rr�r,r{r��\z\u005c�z\u0000�
z\u000a�
z\u000d�z\u001a�raw-unicode-escaper�)r�r�r~r�r��SHORT_BINUNICODEr
r��BINUNICODE8r�r|�
BINUNICODE�replace�UNICODEr�r$rrr�save_strRs&�z_Pickler.save_strcCs:|s(|jr|�t�n|�tt�dSt|�}|j}|j}|dkr�|jdkr�|D]}||�qRt	|�|kr�|�
|t	|�d�}|�t||�n|�t|�|�
|�dS|j}|t�|D]}||�q�t	|�|k�r$|�
|t	|�d�}|j�r|t|�n|t|d|�dS|t�|�
|�dS)Nr�r�rr�)r�r��EMPTY_TUPLE�MARK�TUPLEr~r�r�r�r�r�r	�_tuplesize2coder��POP_MARK)r#r�r�r�r�Zelementr�r�rrr�
save_tupleis:


z_Pickler.save_tuplecCs8|jr|�t�n|�tt�|�|�|�|�dSr )r�r��
EMPTY_LISTrO�LISTr�r
r�rrr�	save_list�s

z_Pickler.save_listi�cCs�|j}|j}|js0|D]}||�|t�qdSt|�}tt||j��}t|�}|dkr||t	�|D]}||�qd|t
�n|r�||d�|t�||jkr8dSq8dS�Nr�r)r�r�r��APPEND�iter�listr�
_BATCHSIZEr~rO�APPENDS)r#r�r�r�rm�it�tmpr�rrrr
�s(



z_Pickler._batch_appendscCs<|jr|�t�n|�tt�|�|�|�|���dSr )r�r��
EMPTY_DICTrO�DICTr�rr�r�rrr�	save_dict�s

z_Pickler.save_dictc	Cs�|j}|j}|js<|D] \}}||�||�|t�qdSt|�}tt||j��}t|�}|dkr�|t	�|D]\}}||�||�qp|t
�n(|r�|d\}}||�||�|t�||jkrDdSqDdSrW)r�r�r��SETITEMrYrZrr[r~rO�SETITEMS)	r#r�r�r��k�vr]r^r�rrrr�s0



z_Pickler._batch_setitemscCs�|j}|j}|jdkr0|jtt|�f|d�dS|t�|�|�t|�}tt	||j
��}t|�}|dkr�|t�|D]}||�qv|t
�||j
krJdSqJdS�Nrr*r)r�r�r�r��setrZ�	EMPTY_SETr�rYrr[r~rO�ADDITEMS)r#r�r�r�r]Zbatchr��itemrrr�save_set�s"



z_Pickler.save_setcCs�|j}|j}|jdkr0|jtt|�f|d�dS|t�|D]}||�q<t|�|jkr||t	|�
|jt|�d��dS|t�|�|�dSrf)
r�r�r�r��	frozensetrZrOr�r�rRr��	FROZENSETr�)r#r�r�r�rjrrr�save_frozensets

 z_Pickler.save_frozensetc

CsX|j}|j}|dkr t|dd�}|dkr.|j}t||�}z(t|dd�tj|}t||�\}}Wn.t	t
tfk
r�td|||f�d�YnX||k	r�td|||f��|j
dk�rt�||f�}	|	�r|	dkr�|ttd|	��n0|	d	k�r|ttd
|	��n|ttd|	��dS|�d�d}
||k�r6|
}|j
d
k�r`|�|�|�|�|t�n�||k	�r||�t||
f�n�|j
dk�r�|tt|d�dt|d�d�n�|j�r�tj}tj}||f|k�r�|||f\}}n||k�r�||}z(|tt|d�dt|d�d�Wn,tk
�rHtd|||j
f�d�YnX|�|�dS)Nrr��levelz(Can't pickle %r: it's not found as %s.%sz2Can't pickle %r: it's not the same object as %s.%sr�r�r�rrrr�rr�r@r�r�z?can't pickle global identifier '%s.%s' using pickle protocol %i) r�r�r�rr��
__import__r�r�r��ImportError�KeyErrorr�r
r�rr��EXT1r
�EXT2�EXT4�
rpartitionr��STACK_GLOBALr��GLOBALr-r��_compat_pickleZREVERSE_NAME_MAPPINGZREVERSE_IMPORT_MAPPINGr�r�)
r#r�r�r�r�r�r�Zobj2r��codeZlastnameZr_name_mappingZr_import_mappingrrrr�s�

�����





��
��

���z_Pickler.save_globalcCs`|td�kr|jtd|d�S|tt�kr:|jttf|d�S|td�krV|jtd|d�S|�|�S)Nr r*.).)r�r�r�r�r�rrr�	save_typeasz_Pickler.save_type)N)T)NNNNN)N)0rrrr$r�rr�r�r�r�r�r�r�r�rr�rr9r%r�r)�floatr3r-r6r4�_HAVE_PICKLE_BUFFERr?rrMr�rSr�rVrZr[r
ra�dictr%rrkrgrnrlr�r|rrrrrr��sj�9
	
F�
u1		

B	r�c@s�eZdZddddd�dd�Zdd	�Zd
d�Zdd
�ZiZdd�Zeee	d<dd�Z
e
eed<dd�Zeee
d<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd �Zeeed<d!d"�Zeeed<d#d$�Zeeed<d%d&�Zeeed<d'd(�Z e ee!d<d)d*�Z"e"ee#d<d+d,�Z$e$ee%d<d-d.�Z&e&ee'd<d/d0�Z(d1d2�Z)e)ee*d<d3d4�Z+e+ee,d<d5d6�Z-e-ee.d<d7d8�Z/e/ee0d<d9d:�Z1e1ee2d<d;d<�Z3e3ee4d<d=d>�Z5e5ee6d<d?d@�Z7e7ee8d<dAdB�Z9e9ee:d<dCdD�Z;e;ee<d<dEdF�Z=e=ee>d<dGdH�Z?e?ee@d<dIdJ�ZAeAeeBd<dKdL�ZCeCeeDd<dMdN�ZEeEeeFd<dOdP�ZGeGeeHd<dQdR�ZIeIeeJd<dSdT�ZKeKeeLd<dUdV�ZMeMeeNd<dWdX�ZOeOeePd<dYdZ�ZQeQeeRd<d[d\�ZSeSeeTd<d]d^�ZUeUeeVd<d_d`�ZWeWeeXd<dadb�ZYdcdd�ZZeZee[d<dedf�Z\e\ee]d<dgdh�Z^e^ee_d<didj�Z`e`eead<dkdl�Zbebeecd<dmdn�Zdedeeed<dodp�Zfefeegd<dqdr�Zheheeid<dsdt�Zjejeekd<dudv�Zldwdx�Zmdydz�Zneneeod<d{d|�Zpepeeqd<d}d~�Zrereesd<dd��Zteteeud<d�d��Zveveewd<d�d��Zxexeeyd<d�d��Zzezee{d<d�d��Z|e|ee}d<d�d��Z~e~eed<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<dS)��
_UnpicklerT�ASCII�strictN�r��encoding�errors�bufferscCsH|dk	rt|�nd|_|j|_|j|_i|_||_||_d|_	||_
dS)a�This takes a binary file for reading a pickle data stream.

        The protocol version of the pickle is detected automatically, so
        no proto argument is needed.

        The argument *file* must have two methods, a read() method that
        takes an integer argument, and a readline() method that requires
        no arguments.  Both methods should return bytes.  Thus *file*
        can be a binary file object opened for reading, an io.BytesIO
        object, or any other custom object that meets this interface.

        The file-like object must have two methods, a read() method
        that takes an integer argument, and a readline() method that
        requires no arguments.  Both methods should return bytes.
        Thus file-like object can be a binary file object opened for
        reading, a BytesIO object, or any other custom object that
        meets this interface.

        If *buffers* is not None, it should be an iterable of buffer-enabled
        objects that is consumed each time the pickle stream references
        an out-of-band buffer view.  Such buffers have been given in order
        to the *buffer_callback* of a Pickler object.

        If *buffers* is None (the default), then the buffers are taken
        from the pickle stream, assuming they are serialized there.
        It is an error for *buffers* to be None if the pickle stream
        was produced with a non-None *buffer_callback*.

        Other optional arguments are *fix_imports*, *encoding* and
        *errors*, which are used to control compatibility support for
        pickle stream generated by Python 2.  If *fix_imports* is True,
        pickle will try to map the old Python 2 names to the new names
        used in Python 3.  The *encoding* and *errors* tell pickle how
        to decode 8-bit string instances pickled by Python 2; these
        default to 'ASCII' and 'strict', respectively. *encoding* can be
        'bytes' to read theses 8-bit string instances as bytes objects.
        Nr)rY�_buffersr��_file_readliner��
_file_readr�r�r�r�r�)r#r�r�r�r�r�rrrr$rs'z_Unpickler.__init__c
Cs�t|d�std|jjf��t|j|j�|_|jj|_|jj	|_	|jj
|_
g|_g|_|jj
|_
d|_|j}|j}z&|d�}|s�t�||d|�qtWn,tk
r�}z|jWY�Sd}~XYnXdS)z�Read a pickled object representation from the open file.

        Return the reconstituted object hierarchy specified in the file.
        r�z4Unpickler.__init__() was not called by %s.__init__()rr�N)r�rr�rr�r�r��	_unframerr�r�r��	metastack�stack�appendr�r��EOFErrorrr!)r#r�r��keyZstopinstrrrr�s*
�



z_Unpickler.loadcCs |j}|j��|_|jj|_|Sr )r�r��popr��r#r�rrr�pop_mark�s
z_Unpickler.pop_markcCstd��dS)Nz%unsupported persistent id encountered)rrrrr�persistent_load�sz_Unpickler.persistent_loadcCs:|�d�d}d|kr"tks0ntd|��||_dS)Nr�rzunsupported pickle protocol: %d)r�r�r�r�)r#r�rrr�
load_proto�sz_Unpickler.load_protorcCs8td|�d��\}|tjkr(td|��|j�|�dS)Nr{�zframe size > sys.maxsize: %d)rr�r�r	r�r�r�r�rrrr��s
z_Unpickler.load_framecCsLz|��dd��d�}Wntk
r6td��YnX|�|�|��dS)Nr�r�r�)r��decode�UnicodeDecodeErrorrr�r�rrrr�load_persid�s�
z_Unpickler.load_persidcCs|j��}|�|�|��dSr )r�r�r�r�rrrr�load_binpersid�s
z_Unpickler.load_binpersidcCs|�d�dSr �r�rtrrr�	load_none�sz_Unpickler.load_nonecCs|�d�dS)NFr�rtrrr�
load_false�sz_Unpickler.load_falsecCs|�d�dS)NTr�rtrrr�	load_true�sz_Unpickler.load_truecCsL|��}|tdd�krd}n |tdd�kr4d}n
t|d�}|�|�dS)Nr�FTr)r�rrr�r�)r#r��valrrr�load_int�s
z_Unpickler.load_intcCs|�td|�d��d�dS)Nrrr�r�rr�rtrrr�load_binint�sz_Unpickler.load_binintcCs|�|�d�d�dSrW)r�r�rtrrr�load_binint1sz_Unpickler.load_binint1cCs|�td|�d��d�dS)Nrr�rr�rtrrr�load_binint2sz_Unpickler.load_binint2cCs@|��dd�}|r,|ddkr,|dd�}|�t|d��dS)Nr��Lr)r�r�r�)r#r�rrr�	load_longsz_Unpickler.load_longcCs*|�d�d}|�|�}|�t|��dSrW)r�r�r�r�rrr�
load_long1s
z_Unpickler.load_long1cCs>td|�d��\}|dkr"td��|�|�}|�t|��dS)Nrrrz#LONG pickle has negative byte count)rr�rr�r�r�rrr�
load_long4s

z_Unpickler.load_long4cCs|�t|��dd���dS�Nr�)r�r}r�rtrrr�
load_float!sz_Unpickler.load_floatcCs|�td|�d��d�dS)Nr&r�rr�rtrrr�
load_binfloat%sz_Unpickler.load_binfloatcCs"|jdkr|S|�|j|j�SdS)Nr-)r�r�r�r"rrr�_decode_string)s
z_Unpickler._decode_stringcCsl|��dd�}t|�dkrF|d|dkrF|ddkrF|dd�}ntd��|�|�t�|�d��dS)Nr�r�rs"'r�z)the STRING opcode argument must be quoted)r�r~rr�r�r.�
escape_decoder�rrr�load_string2s
(z_Unpickler.load_stringcCs@td|�d��\}|dkr"td��|�|�}|�|�|��dS)Nrrrz(BINSTRING pickle has negative byte count)rr�rr�r��r#r~r�rrr�load_binstring<s

z_Unpickler.load_binstringcCs:td|�d��\}|tkr&tdt��|�|�|��dS)Nr�rz2BINBYTES exceeds system's maximum size of %d bytes�rr�r	rr��r#r~rrr�
load_binbytesEs�z_Unpickler.load_binbytescCs |�t|��dd�d��dS)Nr�rG)r�r�r�rtrrr�load_unicodeMsz_Unpickler.load_unicodecCsBtd|�d��\}|tkr&tdt��|�t|�|�dd��dS)Nr�rz4BINUNICODE exceeds system's maximum size of %d bytesr@rA�rr�r	rr�r�r�rrr�load_binunicodeQs�z_Unpickler.load_binunicodecCsBtd|�d��\}|tkr&tdt��|�t|�|�dd��dS)Nr{r�z5BINUNICODE8 exceeds system's maximum size of %d bytesr@rAr�r�rrr�load_binunicode8Ys�z_Unpickler.load_binunicode8cCs:td|�d��\}|tkr&tdt��|�|�|��dS)Nr{r�z3BINBYTES8 exceeds system's maximum size of %d bytesr�r�rrr�load_binbytes8as�z_Unpickler.load_binbytes8cCsFtd|�d��\}|tkr&tdt��t|�}|�|�|�|�dS)Nr{r�z4BYTEARRAY8 exceeds system's maximum size of %d bytes)rr�r	rr4r�r�)r#r~�brrr�load_bytearray8is�
z_Unpickler.load_bytearray8cCsL|jdkrtd��zt|j�}Wntk
r<td��YnX|�|�dS)NzLpickle stream refers to out-of-band data but no *buffers* argument was givenznot enough out-of-band buffers)r�r�next�
StopIterationr�)r#r�rrr�load_next_bufferss
z_Unpickler.load_next_bufferc	Cs6|jd}t|��}|js(|��|jd<W5QRXdSr�)r��
memoryviewr:�
toreadonly)r#r�r>rrr�load_readonly_buffer~s

z_Unpickler.load_readonly_buffercCs,|�d�d}|�|�}|�|�|��dSrW)r�r�r�r�rrr�load_short_binstring�s
z_Unpickler.load_short_binstringcCs"|�d�d}|�|�|��dSrW)r�r�r�rrr�load_short_binbytes�sz_Unpickler.load_short_binbytescCs*|�d�d}|�t|�|�dd��dS)Nr�rr@rA)r�r�r�r�rrr�load_short_binunicode�sz _Unpickler.load_short_binunicodecCs|��}|�t|��dSr )r�r�r�r�rrr�
load_tuple�sz_Unpickler.load_tuplecCs|�d�dS)Nrr�rtrrr�load_empty_tuple�sz_Unpickler.load_empty_tuplecCs|jdf|jd<dSr��r�rtrrr�load_tuple1�sz_Unpickler.load_tuple1cCs$|jd|jdfg|jdd�<dS)Nr�r�r�rtrrr�load_tuple2�sz_Unpickler.load_tuple2cCs,|jd|jd|jdfg|jdd�<dS)N���r�r�r�rtrrr�load_tuple3�sz_Unpickler.load_tuple3cCs|�g�dSr r�rtrrr�load_empty_list�sz_Unpickler.load_empty_listcCs|�i�dSr r�rtrrr�load_empty_dictionary�sz _Unpickler.load_empty_dictionarycCs|�t��dSr )r�rgrtrrr�load_empty_set�sz_Unpickler.load_empty_setcCs|��}|�t|��dSr )r�r�rlr�rrr�load_frozenset�sz_Unpickler.load_frozensetcCs|��}|�|�dSr )r�r�r�rrr�	load_list�sz_Unpickler.load_listcs4|����fdd�tdt��d�D�}|�|�dS)Ncsi|]}�|�|d�qS)r�r)rlr��r�rr�
<dictcomp>�s�z(_Unpickler.load_dict.<locals>.<dictcomp>rr�)r��ranger~r�)r#�drr�r�	load_dict�s

�z_Unpickler.load_dictc
Cs�|st|t�rt|d�rjz||�}Wqttk
rf}z$td|jt|�ft��d��W5d}~XYqtXn
|�|�}|�	|�dS)NZ__getinitargs__zin constructor for %s: %sr�)
r�r�r�r�rr�r��exc_inforr�)r#�klassrr!�errrrr�_instantiate�s��
�
z_Unpickler._instantiatecCsL|��dd��d�}|��dd��d�}|�||�}|�||���dS)Nr�r�)r�r��
find_classr�r��r#r�r�r�rrr�	load_inst�sz_Unpickler.load_instcCs"|��}|�d�}|�||�dS�Nr)r�r�r�)r#rrrrr�load_obj�s
z_Unpickler.load_objcCs2|j��}|j��}|j|f|��}|�|�dSr �r�r�rr�)r#rrr�rrr�load_newobj�s

z_Unpickler.load_newobjcCs>|j��}|j��}|j��}|j|f|�|�}|�|�dSr r�)r#rrrr�rrr�load_newobj_ex�s



z_Unpickler.load_newobj_excCsF|��dd��d�}|��dd��d�}|�||�}|�|�dS)Nr�r@)r�r�r�r�r�rrr�load_global�sz_Unpickler.load_globalcCsJ|j��}|j��}t|�tk	s,t|�tk	r4td��|�|�||��dS)NzSTACK_GLOBAL requires str)r�r�r�r�rr�r�)r#r�r�rrr�load_stack_global�s


z_Unpickler.load_stack_globalcCs|�d�d}|�|�dSrW)r��
get_extension�r#r{rrr�	load_ext1sz_Unpickler.load_ext1cCs td|�d��\}|�|�dS)Nrr��rr�r�r�rrr�	load_ext2	sz_Unpickler.load_ext2cCs td|�d��\}|�|�dS)Nrrr�r�rrr�	load_ext4sz_Unpickler.load_ext4cCspg}t�||�}||k	r&|�|�dSt�|�}|sP|dkrDtd��td|��|j|�}|t|<|�|�dS)NrzEXT specifies code <= 0zunregistered extension code %d)rr�r�rrr�r�)r#r{Znilr�r�rrrr�s


z_Unpickler.get_extensioncCs�t�d||�|jdkrT|jrT||ftjkr@tj||f\}}n|tjkrTtj|}t|dd�|jdkr~ttj	||�dSt
tj	||�SdS)Nzpickle.find_classr�rror)r��auditr�r�rzZNAME_MAPPINGZIMPORT_MAPPINGrqr�r�r�)r#r�r�rrrr�#s


z_Unpickler.find_classcCs&|j}|��}|d}||�|d<dSr��r�r�)r#r�rrrrr�load_reduce1sz_Unpickler.load_reducecCs|jr|jd=n|��dSr�)r�r�rtrrr�load_pop8s
z_Unpickler.load_popcCs|��dSr )r�rtrrr�
load_pop_mark?sz_Unpickler.load_pop_markcCs|�|jd�dSr�)r�r�rtrrr�load_dupCsz_Unpickler.load_dupcCs(t|��dd��}|�|j|�dSr�)r�r�r�r�r�rrr�load_getGsz_Unpickler.load_getcCs"|�d�d}|�|j|�dSrW)r�r�r�r�rrr�load_bingetLsz_Unpickler.load_bingetcCs&td|�d��\}|�|j|�dS)Nr�r)rr�r�r�r�rrr�load_long_bingetQsz_Unpickler.load_long_bingetcCs8t|��dd��}|dkr$td��|jd|j|<dS)Nr�rznegative PUT argument)r�r�r�r�r�r�rrr�load_putVsz_Unpickler.load_putcCs2|�d�d}|dkrtd��|jd|j|<dS)Nr�rznegative BINPUT argumentr�)r�r�r�r�r�rrr�load_binput]sz_Unpickler.load_binputcCs6td|�d��\}|tkr"td��|jd|j|<dS)Nr�rznegative LONG_BINPUT argumentr�)rr�r	r�r�r�r�rrr�load_long_binputdsz_Unpickler.load_long_binputcCs|j}|jd|t|�<dSr�)r�r�r~)r#r�rrr�load_memoizeksz_Unpickler.load_memoizecCs$|j}|��}|d}|�|�dSr�)r�r�r�)r#r�r!rZrrr�load_appendpsz_Unpickler.load_appendcCsZ|��}|jd}z
|j}Wntk
r0YnX||�dS|j}|D]}||�qHdSr�)r�r��extendr�r�)r#r�Zlist_objr�r�rjrrr�load_appendsws

z_Unpickler.load_appendscCs*|j}|��}|��}|d}|||<dSr�r�)r#r�r!r�rrrr�load_setitem�s
z_Unpickler.load_setitemcCs@|��}|jd}tdt|�d�D]}||d|||<q"dS)Nr�rr�r�)r�r�r�r~)r#r�rr�rrr�
load_setitems�s
z_Unpickler.load_setitemscCsD|��}|jd}t|t�r(|�|�n|j}|D]}||�q2dSr�)r�r�r�rg�update�add)r#r�Zset_objr�rjrrr�
load_additems�s

z_Unpickler.load_additemsc
Cs�|j}|��}|d}t|dd�}|dk	r6||�dSd}t|t�rXt|�dkrX|\}}|r�|j}tj}|�	�D]*\}}	t
|�tkr�|	|||�<qp|	||<qp|r�|�	�D]\}}	t|||	�q�dS)Nr��__setstate__r�)
r�r�r�r�r�r~�__dict__r��internr�r�r��setattr)
r#r�r�inst�setstateZ	slotstateZ	inst_dictr�rdrerrr�
load_build�s(
z_Unpickler.load_buildcCs"|j�|j�g|_|jj|_dSr )r�r�r�rtrrr�	load_mark�sz_Unpickler.load_markcCs|j��}t|��dSr )r�r�rr"rrr�	load_stop�s
z_Unpickler.load_stop)�rrrr$rr�r�r�r�r�r�r�r�r�r�r�r�rr�rr�rr�r"r�rr�rr�rr�r#r�r r�r!r�r(r�r'r�r��STRINGr��	BINSTRINGr�r1r�rLr�rJr�rIr�r0r�r5r�r<r�r=r��SHORT_BINSTRINGr�r/r�rHr�rPr�rNr��TUPLE1r�r
r��TUPLE3r�rTr�r_r�rhr�rmr�rUr�r`r�r��INSTr��OBJr�rr�rr�ryr�rxr�rtr�rur�rvr�r�r�rr�r	r�rRr��DUPr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rXr�r\r�rbr�rcr�rirrrrOrr�rrrrr�ps*�0				r�r�cCst||||d��|�dS�Nr�)r�r)r�r�r�r�r�rrr�_dump�s
��rcCs*t��}t||||d��|�|��}|Sr)rrrsr�r�getvalue)r�r�r�r�r��resrrr�_dumps�s��rr�r�r�cCst|||||d���S)N�r�r�r�r�)r�r)r�r�r�r�r�rrr�_load�s�rcCs2t|t�rtd��t�|�}t|||||d���S)Nz%Can't load pickle from unicode stringr)r�r�r�rrrsr�r)�sr�r�r�r�r�rrr�_loads�s

�r)	rr
rrrrrrrcCsddl}|��Sr�)�doctestZtestmod)rrrr�_test�srr�z$display contents of the pickle files)Zdescription�pickle_file�br�*zthe pickle file)r��nargs�helpz-tz--test�
store_truezrun self-test suite)�actionrz-vz)run verbosely; only affects self-test run)N)N)�r�typesr�copyregrrrr�	itertoolsr�	functoolsrr�r	Zstructr
rrjrrr.rz�__all__�_picklerr�r~rrr-r4Zbytes_typesZformat_versionZcompatible_formatsr�r��	Exceptionrr
rrZorg.python.corer%rOr�r	rRr
r(r"rrr#rrr�r�rrrrrLrJrXrryr`r_r\r�r�rr�rUrTrr�r�r�rbrPrNrcr'rrr�rrtrurvr	r
r
rrr r!rQr1r/rHrIr0rhrirmrrxr�r�r5r<r=r��dirror�r�r�r�r�r�r�rrrrrrrrrrrr�argparse�ArgumentParser�parser�add_argumentZFileType�
parse_argsrZtestrZ
print_helpZpprintr�r�rrrr�<module>sh�

�

?;
^]��	0

����

_compat_pickle.cpython-38.pyc000064400000012577150335716500012166 0ustar00U

e5d-"�+@sdddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*�*Zd+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdL�!ZdMZzeWnek
r�Yn
XedN7ZeD]ZdefedOef<q�dPZeD]ZdQefedRef<q�edSdT�e��D��Z	e
e	�e
e�k�s0t�edUdT�e��D��Ze
e�e
e�k�s\t�e�
dVdWdddd"d"dXdXdXd(dYdYdZ�
�e	�
d[d(d\d]dVd^��e�
d/d_d6d`da��e�
dbdcdddedfdgdhdidjdkdldmdndo�
�dpZeD]Zdqedef<�q�drZeD]Zdsedef<�q�dtS)u�builtins�copyregZqueueZsocketserverZconfigparser�reprlib�tkinter.filedialog�tkinter.simpledialogztkinter.colorchooserztkinter.commondialogztkinter.dialogztkinter.dndztkinter.fontztkinter.messageboxztkinter.scrolledtextztkinter.constantsztkinter.tixztkinter.ttkZtkinterZ_markupbase�winreg�_threadZ
_dummy_threadzdbm.bsdzdbm.dumbzdbm.ndbmzdbm.gnuz
xmlrpc.client�
xmlrpc.serverzhttp.clientz
html.entitieszhtml.parserzhttp.cookieszhttp.cookiejar�http.serverztest.support�
subprocess�urllib.parsezurllib.robotparser�urllib.request�dbmzcollections.abc)*�__builtin__Zcopy_regZQueueZSocketServerZConfigParser�reprZtkFileDialogZtkSimpleDialogZtkColorChooserZtkCommonDialogZDialogZTkdndZtkFontZtkMessageBoxZScrolledTextZTkconstantsZTixZttkZTkinterZ
markupbase�_winreg�threadZdummy_threadZdbhashZdumbdbmr
�gdbmZ	xmlrpclibZSimpleXMLRPCServerZhttplibZhtmlentitydefsZ
HTMLParserZCookieZ	cookielibZBaseHTTPServerztest.test_supportZcommandsZurlparseZrobotparser�urllib2ZanydbmZ_abcoll)r�range)�	functools�reduce)�sys�intern)r�chr)r�str)r�int)r�zip)r�map)r�filter)�	itertools�filterfalse)r�zip_longest)�collections�UserDict)r"�UserList)r"�
UserString)r
�whichdb)�socket�fromfd)zmultiprocessing.connection�
Connection)�multiprocessing.context�Process)zmultiprocessing.popen_fork�Popen)�urllib.error�ContentTooShortError)r�
getproxies)r�pathname2url)r�
quote_plus)r�quote)r�unquote_plus)r�unquote)r�url2pathname)r�
urlcleanup)r�	urlencode)r�urlopen)r�urlretrieve)r-�	HTTPError)r-�URLError)!)rZxrange�rr)rr)rZunichr)rZunicode)rZlong)rZizip)rZimap)rZifilter)rZifilterfalse)rZizip_longest)r#ZIterableUserDict)r$r$)r%r%)r&r&)�_socketr()Z_multiprocessingr))zmultiprocessing.processr+)zmultiprocessing.forkingr,)�urllibr.)r>r/)r>r0)r>r1)r>r2)r>r3)r>r4)r>r5)r>r6)r>r7)r>r8)r>r9)rr:)rr;)/�ArithmeticError�AssertionError�AttributeError�
BaseException�BufferError�BytesWarning�DeprecationWarning�EOFError�EnvironmentError�	Exception�FloatingPointError�
FutureWarning�
GeneratorExit�IOError�ImportError�
ImportWarning�IndentationError�
IndexError�KeyError�KeyboardInterrupt�LookupError�MemoryError�	NameError�NotImplementedError�OSError�
OverflowError�PendingDeprecationWarning�ReferenceError�RuntimeError�RuntimeWarning�
StopIteration�SyntaxError�
SyntaxWarning�SystemError�
SystemExit�TabError�	TypeError�UnboundLocalError�UnicodeDecodeError�UnicodeEncodeError�UnicodeError�UnicodeTranslateError�UnicodeWarning�UserWarning�
ValueError�Warning�ZeroDivisionError)�WindowsError�
exceptions)ZAuthenticationErrorZBufferTooShortZProcessError�TimeoutErrorr*Zmultiprocessingccs|]\}}||fVqdS�N���.0�k�vrrrr�&/usr/lib64/python3.8/_compat_pickle.py�	<genexpr>�srxccs|]\}}||fVqdSrqrrrsrrrrrwrx�s�picklezxml.etree.ElementTreer"�io)
ZcPickleZ_elementtree�
FileDialog�SimpleDialog�DocXMLRPCServer�SimpleHTTPServer�
CGIHTTPServerr#r$r%r&�StringIOZ	cStringIO�bz2rr)Z_bz2Z_dbm�
_functoolsZ_gdbm�_pickle)rrH)r'Z
SocketType))rZ
basestring)roZ
StandardError)r#r#�r'Z
_socketobjectr<)r{r{)r{�LoadFileDialog)r{�SaveFileDialog)r|r|)r}�
ServerHTMLDoc)r}�XMLRPCDocGenerator)r}�DocXMLRPCRequestHandler)r}r})r}�DocCGIXMLRPCRequestHandler)r~�SimpleHTTPRequestHandler)r�CGIHTTPRequestHandlerr�)
)r�r)rr{)rr�)rr�)rr|)rr�)rr�)rr�)rr})rr�)r	r�)r	r�)r=r')�BrokenPipeError�ChildProcessError�ConnectionAbortedError�ConnectionError�ConnectionRefusedError�ConnectionResetError�FileExistsError�FileNotFoundError�InterruptedError�IsADirectoryError�NotADirectoryError�PermissionError�ProcessLookupErrorrp)rorW)�ModuleNotFoundError)rorMN)ZIMPORT_MAPPINGZNAME_MAPPINGZPYTHON2_EXCEPTIONSrnrUZexcnameZMULTIPROCESSING_EXCEPTIONS�dict�itemsZREVERSE_IMPORT_MAPPING�lenr@ZREVERSE_NAME_MAPPING�updateZPYTHON3_OSERROR_EXCEPTIONSZPYTHON3_IMPORTERROR_EXCEPTIONSrrrrrrrw�<module>	s�2�$3����imaplib.cpython-38.opt-1.pyc000064400000114371150335716500011564 0ustar00U

e5df��*@s�dZdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZmZm
Z
ddlmZzddlZdZWnek
r�dZYnXdd	d
ddd
gZdZdZdZdZdZdZdddddddddddddddddddddddddddddddddddddddddd�)Ze�d�Ze�d�Ze�d�Ze�dej�Z e�d�Z!e�d�Z"e�d�Z#e�d ej�Z$dZ%d Z&Gd!d�d�Z'e�r�Gd"d#�d#e'�Z(e�)d#�Gd$d	�d	e'�Z*Gd%d&�d&�Z+d'�,d(�Z-d)d*�e.e-d+d��D�Z/d,d
�Z0d-d�Z1d.d�Z2d/d
�Z3e4d0k�r�ddl5Z5ddl6Z6ze5�5ej7d+d�d1�\Z8Z9Wn.e5j:k
�rpZ;zd2\Z8Z9W5dZ;[;XYnXdZ<e8D]8\Z=Z;e=d3k�r�e>e;�Zne=d4k�rze;Z<e9�sze<fZ9�qze9�s�d5Z9e9dZ?e6�@�ZAe6�6d6eAe?�p�d7f�ZBd8eAd9d:�ZCd;eAeBffd<d=d>d?d@ddeCffdAdBdCdDdEdFdGdHdIfZDdJdKdLdMd?dddeCffdHdNfZEdOdP�ZF�ze<�rbe*e<�ZGne'e?�ZGeGjHdQk�r�eDd+d�ZDeG�IdReGjJ�eG�IdSeGjKf�eDD]\ZLZ9eFeLe9��q�eFdTdU�D]<ZMe�NdVeM�ZOeO�r�eO�Pd+�ZQneM�,�dWZQeFdXeQf��q�eED]T\ZLZ9eFeLe9�ZReLe9fdLk�r.�q
eRdW�,�ZSeS�sD�q
eFdYdZd[eSdWd\f��q
eTd]�Wn.eTd^�e�s�eTd_ej7d��YnXdS)`z�IMAP4 client.

Based on RFC 2060.

Public class:           IMAP4
Public variable:        Debug
Public functions:       Internaldate2tuple
                        Int2AP
                        ParseFlags
                        Time2Internaldate
z2.58�N)�datetime�timezone�	timedelta)�DEFAULT_BUFFER_SIZETF�IMAP4�IMAP4_stream�Internaldate2tuple�Int2AP�
ParseFlags�Time2Internaldate�
�i�)Z	IMAP4REV1ri@B)�AUTH�SELECTED)�NONAUTH)rrr�LOGOUT)r)r))�APPEND�AUTHENTICATE�
CAPABILITY�CHECK�CLOSE�COPY�CREATE�DELETE�	DELETEACL�ENABLE�EXAMINE�EXPUNGE�FETCH�GETACL�
GETANNOTATION�GETQUOTA�GETQUOTAROOT�MYRIGHTS�LIST�LOGINr�LSUBZMOVE�	NAMESPACE�NOOP�PARTIAL�	PROXYAUTH�RENAME�SEARCH�SELECT�SETACL�
SETANNOTATION�SETQUOTA�SORT�STARTTLS�STATUS�STORE�	SUBSCRIBE�THREAD�UID�UNSUBSCRIBEs\+( (?P<data>.*))?s.*FLAGS \((?P<flags>[^\)]*)\)s�.*INTERNALDATE "(?P<day>[ 0123][0-9])-(?P<mon>[A-Z][a-z][a-z])-(?P<year>[0-9][0-9][0-9][0-9]) (?P<hour>[0-9][0-9]):(?P<min>[0-9][0-9]):(?P<sec>[0-9][0-9]) (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])"s.*{(?P<size>\d+)}$s
\r\n|\r|\ns%\[(?P<type>[A-Z-]+)( (?P<data>.*))?\]s$\* (?P<type>[A-Z-]+)( (?P<data>.*))?s3\* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?c@s�eZdZdZGdd�de�ZGdd�de�ZGdd�de�Zdefd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdefdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Z d9d:�Z!d;d<�Z"d=d>�Z#d?d@�Z$dAdB�Z%dCdD�Z&dEdF�Z'dGdH�Z(d�dKdL�Z)dMdN�Z*dOdP�Z+dQdR�Z,dSdT�Z-d�dUdV�Z.dWdX�Z/dYdZ�Z0d[d\�Z1d]d^�Z2d_d`�Z3dadb�Z4dcdd�Z5d�dgdh�Z6didj�Z7dkdl�Z8dmdn�Z9dodp�Z:d�drds�Z;dtdu�Z<dvdw�Z=dxdy�Z>dzd{�Z?d|d}�Z@d~d�ZAd�d��ZBd�d��ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGd�d��ZHd�d�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOdqS)�ra�IMAP4 client class.

    Instantiate with: IMAP4([host[, port]])

            host - host's name (default: localhost);
            port - port number (default: standard IMAP4 port).

    All IMAP4rev1 commands are supported by methods of the same
    name (in lower-case).

    All arguments to commands are converted to strings, except for
    AUTHENTICATE, and the last argument to APPEND which is passed as
    an IMAP4 literal.  If necessary (the string contains any
    non-printing characters or white-space and isn't enclosed with
    either parentheses or double quotes) each string is quoted.
    However, the 'password' argument to the LOGIN command is always
    quoted.  If you want to avoid having an argument string quoted
    (eg: the 'flags' argument to STORE) then enclose the string in
    parentheses (eg: "(\Deleted)").

    Each command returns a tuple: (type, [data, ...]) where 'type'
    is usually 'OK' or 'NO', and 'data' is either the text from the
    tagged response, or untagged results from command. Each 'data'
    is either a string, or a tuple. If a tuple, then the first part
    is the header of the response, and the second part contains
    the data (ie: 'literal' value).

    Errors raise the exception class <instance>.error("<reason>").
    IMAP4 server errors raise <instance>.abort("<reason>"),
    which is a sub-class of 'error'. Mailbox status changes
    from READ-WRITE to READ-ONLY raise the exception class
    <instance>.readonly("<reason>"), which is a sub-class of 'abort'.

    "error" exceptions imply a program error.
    "abort" exceptions imply the connection should be reset, and
            the command re-tried.
    "readonly" exceptions imply the command should be re-tried.

    Note: to use this module, you must read the RFCs pertaining to the
    IMAP4 protocol, as the semantics of the arguments to each IMAP4
    command are left to the invoker, not to mention the results. Also,
    most IMAP servers implement a sub-set of the commands available here.
    c@seZdZdS)zIMAP4.errorN��__name__�
__module__�__qualname__�r=r=�/usr/lib64/python3.8/imaplib.py�error�sr?c@seZdZdS)zIMAP4.abortNr9r=r=r=r>�abort�sr@c@seZdZdS)zIMAP4.readonlyNr9r=r=r=r>�readonly�srA�cCs�t|_d|_d|_i|_i|_d|_d|_d|_d|_	|�
�|�||�z|��Wn8t
k
r�z|��Wntk
r�YnX�YnXdS)NrrBFr)�Debug�debug�state�literal�tagged_commands�untagged_responses�continuation_response�is_readonly�tagnum�_tls_established�_mode_ascii�open�_connect�	Exception�shutdown�OSError��self�host�portr=r=r>�__init__�s&zIMAP4.__init__cCs0d|_d|_t�ttj�|_t�ttj�|_dS)NF�ascii)	�utf8_enabled�	_encoding�re�compile�_Literal�ASCII�Literal�_Untagged_status�Untagged_status�rTr=r=r>rM�szIMAP4._mode_asciicCs(d|_d|_t�t�|_t�t�|_dS)NT�utf-8)rYrZr[r\r]r_r`rarbr=r=r>�
_mode_utf8�szIMAP4._mode_utf8cCs�tt�dd��|_t�d|jdtj�|_|�	�|_
d|jkrHd|_nd|jkrZd|_n|�
|j
��|��tD]}||jkr�qr||_dS|�
d	��dS)
Nii��s(?P<tag>s"\d+) (?P<type>[A-Z]+) (?P<data>.*)ZPREAUTHr�OKrzserver not IMAP4 compliant)r	�randomZrandint�tagprer[r\r^�tagre�__version__�
_get_responseZwelcomerHrEr?�_get_capabilities�AllowedVersions�capabilities�PROTOCOL_VERSION)rT�versionr=r=r>rO�s*���



zIMAP4._connectcCs&|tkrt||���Std|��dS)NzUnknown IMAP4 command: '%s')�Commands�getattr�lower�AttributeError)rT�attrr=r=r>�__getattr__	szIMAP4.__getattr__cCs|S�Nr=rbr=r=r>�	__enter__szIMAP4.__enter__cGs4|jdkrdSz|��Wntk
r.YnXdS)Nr)rE�logoutrR)rT�argsr=r=r>�__exit__s
zIMAP4.__exit__cCs4|js
dn|j}t�d||j|j�t�||jf�S)Nzimaplib.open)rU�sys�auditrV�socketZcreate_connection)rTrUr=r=r>�_create_socketszIMAP4._create_socketcCs(||_||_|��|_|j�d�|_dS)z�Setup connection to remote server on "host:port"
            (default: localhost:standard IMAP4 port).
        This connection will be used by the routines:
            read, readline, send, shutdown.
        �rbN)rUrVr~�sock�makefile�filerSr=r=r>rN's
z
IMAP4.opencCs|j�|�S�zRead 'size' bytes from remote.)r��read�rT�sizer=r=r>r�3sz
IMAP4.readcCs.|j�td�}t|�tkr*|�dt��|S)�Read line from remote.�zgot more than %d bytes)r��readline�_MAXLINE�lenr?�rT�liner=r=r>r�8szIMAP4.readlinecCst�d||�|j�|�dS)�Send data to remote.zimaplib.sendN)r{r|r�Zsendall�rT�datar=r=r>�send@sz
IMAP4.sendc
Cst|j��zXz|j�tj�Wn@tk
r^}z"|jtjkrNt	|dd�dkrN�W5d}~XYnXW5|j��XdS)� Close I/O established in "open".Zwinerrorri&'N)
r��closer�rQr}Z	SHUT_RDWRrR�errnoZENOTCONNrq)rT�excr=r=r>rQFs
�zIMAP4.shutdowncCs|jS)zfReturn socket instance used to connect to IMAP4 server.

        socket = <instance>.socket()
        )r�rbr=r=r>r}VszIMAP4.socketcCsBd}|�ddg|�\}}|dr(||fS|��\}}|�|||�S)aReturn most recent 'RECENT' responses if any exist,
        else prompt server for an update using the 'NOOP' command.

        (typ, [data]) = <instance>.recent()

        'data' is None if no new messages,
        else list of RECENT responses, most recent last.
        ZRECENTreN���)�_untagged_response�noop�rT�name�typ�datr=r=r>�recentbs	zIMAP4.recentcCs|�|dg|���S)z�Return data for response 'code' if received, or None.

        Old value for response 'code' is cleared.

        (code, [data]) = <instance>.response(code)
        N)r��upper)rT�coder=r=r>�responsesszIMAP4.responsecCsxd}|sd}|r.|d|dfdkr2d|}nd}|r@t|�}nd}t�t|�}|jrbd|d	}||_|�||||�S)
z�Append message to named mailbox.

        (typ, [data]) = <instance>.append(mailbox, flags, date_time, message)

                All args except `message' can be None.
        r�INBOXrr���(�)�(%s)NsUTF8 (�))r�MapCRLF�sub�CRLFrYrF�_simple_command)rT�mailbox�flags�	date_time�messager�rFr=r=r>�append�s

zIMAP4.appendcCsP|��}t|�j|_|�d|�\}}|dkrB|�|d�dd���d|_||fS)asAuthenticate command - requires response processing.

        'mechanism' specifies which authentication mechanism is to
        be used - it must appear in <instance>.capabilities in the
        form AUTH=<mechanism>.

        'authobject' must be a callable object:

                data = authobject(response)

        It will be called to process server continuation responses; the
        response argument it is passed will be a bytes.  It should return bytes
        data that will be base64 encoded and sent to the server.  It should
        return None if the client abort response '*' should be sent instead.
        rrer�rc�replacer)r��_Authenticator�processrFr�r?�decoderE)rTZ	mechanismZ
authobject�mechr�r�r=r=r>�authenticate�szIMAP4.authenticatecCs d}|�|�\}}|�|||�S)zT(typ, [data]) = <instance>.capability()
        Fetch capabilities list from server.r�r�r�r�r=r=r>�
capability�szIMAP4.capabilitycCs
|�d�S)zRCheckpoint mailbox on server.

        (typ, [data]) = <instance>.check()
        r�r�rbr=r=r>�check�szIMAP4.checkcCs$z|�d�\}}W5d|_X||fS)z�Close currently selected mailbox.

        Deleted messages are removed from writable mailbox.
        This is the recommended command before 'LOGOUT'.

        (typ, [data]) = <instance>.close()
        rr)rEr��rTr�r�r=r=r>r��szIMAP4.closecCs|�d||�S)z�Copy 'message_set' messages onto end of 'new_mailbox'.

        (typ, [data]) = <instance>.copy(message_set, new_mailbox)
        rr�)rT�message_setZnew_mailboxr=r=r>�copy�sz
IMAP4.copycCs|�d|�S)zPCreate new mailbox.

        (typ, [data]) = <instance>.create(mailbox)
        rr��rTr�r=r=r>�create�szIMAP4.createcCs|�d|�S)zPDelete old mailbox.

        (typ, [data]) = <instance>.delete(mailbox)
        rr�r�r=r=r>�delete�szIMAP4.deletecCs|�d||�S)z�Delete the ACLs (remove any rights) set for who on mailbox.

        (typ, [data]) = <instance>.deleteacl(mailbox, who)
        rr�)rTr��whor=r=r>�	deleteacl�szIMAP4.deleteaclcCsHd|jkrt�d��|�d|�\}}|dkr@d|��kr@|��||fS)zkSend an RFC5161 enable string to the server.

        (typ, [data]) = <intance>.enable(capability)
        rzServer does not support ENABLErezUTF8=ACCEPT)rmrr?r�r�rd)rTr�r�r�r=r=r>�enable�s

zIMAP4.enablecCs d}|�|�\}}|�|||�S)z�Permanently remove deleted items from selected mailbox.

        Generates 'EXPUNGE' response for each deleted message.

        (typ, [data]) = <instance>.expunge()

        'data' is list of 'EXPUNGE'd message numbers in order received.
        rr�r�r=r=r>�expunges	z
IMAP4.expungecCs$d}|�|||�\}}|�|||�S)a#Fetch (parts of) messages.

        (typ, [data, ...]) = <instance>.fetch(message_set, message_parts)

        'message_parts' should be a string of selected parts
        enclosed in parentheses, eg: "(UID BODY[TEXT])".

        'data' are tuples of message part envelope and data.
        rr�)rTr�Z
message_partsr�r�r�r=r=r>�fetchs
zIMAP4.fetchcCs|�d|�\}}|�||d�S)zXGet the ACLs for a mailbox.

        (typ, [data]) = <instance>.getacl(mailbox)
        rZACLr��rTr�r�r�r=r=r>�getaclszIMAP4.getaclcCs"|�d|||�\}}|�||d�S)za(typ, [data]) = <instance>.getannotation(mailbox, entry, attribute)
        Retrieve ANNOTATIONs.r �
ANNOTATIONr�)rTr��entryZ	attributer�r�r=r=r>�
getannotation(szIMAP4.getannotationcCs|�d|�\}}|�||d�S)z�Get the quota root's resource usage and limits.

        Part of the IMAP4 QUOTA extension defined in rfc2087.

        (typ, [data]) = <instance>.getquota(root)
        r!�QUOTAr�)rT�rootr�r�r=r=r>�getquota0szIMAP4.getquotacCs@|�d|�\}}|�||d�\}}|�||d�\}}|||gfS)z�Get the list of quota roots for the named mailbox.

        (typ, [[QUOTAROOT responses...], [QUOTA responses]]) = <instance>.getquotaroot(mailbox)
        r"r�Z	QUOTAROOTr�)rTr�r�r�ZquotaZ	quotarootr=r=r>�getquotaroot;szIMAP4.getquotaroot�""�*cCs$d}|�|||�\}}|�|||�S)z�List mailbox names in directory matching pattern.

        (typ, [data]) = <instance>.list(directory='""', pattern='*')

        'data' is list of LIST responses.
        r$r��rTZ	directory�patternr�r�r�r=r=r>�listFsz
IMAP4.listcCs<|�d||�|��\}}|dkr.|�|d��d|_||fS)z�Identify client using plaintext password.

        (typ, [data]) = <instance>.login(user, password)

        NB: 'password' will be quoted.
        r%rer�r)r��_quoter?rE)rT�user�passwordr�r�r=r=r>�loginRs
zIMAP4.logincCs|||_|_|�d|j�S)zr Force use of CRAM-MD5 authentication.

        (typ, [data]) = <instance>.login_cram_md5(user, password)
        zCRAM-MD5)r�r�r��_CRAM_MD5_AUTH)rTr�r�r=r=r>�login_cram_md5`szIMAP4.login_cram_md5cCsBddl}t|jt�r |j�d�n|j}|jd|�||d���S)z1 Authobject to use with CRAM-MD5 authentication. rNrc� Zmd5)�hmac�
isinstancer��str�encoder�ZHMACZ	hexdigest)rTZ	challenger��pwdr=r=r>r�is
�zIMAP4._CRAM_MD5_AUTHcCs$d|_|�d�\}}|��||fS)z|Shutdown connection to server.

        (typ, [data]) = <instance>.logout()

        Returns server 'BYE' response.
        r)rEr�rQr�r=r=r>rxqszIMAP4.logoutcCs$d}|�|||�\}}|�|||�S)z�List 'subscribed' mailbox names in directory matching pattern.

        (typ, [data, ...]) = <instance>.lsub(directory='""', pattern='*')

        'data' are tuples of message part envelope and data.
        r&r�r�r=r=r>�lsub~sz
IMAP4.lsubcCs|�d|�\}}|�||d�S)z�Show my ACLs for a mailbox (i.e. the rights that I have on mailbox).

        (typ, [data]) = <instance>.myrights(mailbox)
        r#r�r�r=r=r>�myrights�szIMAP4.myrightscCs d}|�|�\}}|�|||�S)zb Returns IMAP namespaces ala rfc2342

        (typ, [data, ...]) = <instance>.namespace()
        r'r�r�r=r=r>�	namespace�szIMAP4.namespacecCs
|�d�S)zFSend NOOP command.

        (typ, [data]) = <instance>.noop()
        r(r�rbr=r=r>r��sz
IMAP4.noopcCs(d}|�|||||�\}}|�||d�S)z�Fetch truncated part of a message.

        (typ, [data, ...]) = <instance>.partial(message_num, message_part, start, length)

        'data' is tuple of message part envelope and data.
        r)rr�)rTZmessage_numZmessage_part�startZlengthr�r�r�r=r=r>�partial�sz
IMAP4.partialcCsd}|�d|�S)z�Assume authentication as "user".

        Allows an authorised administrator to proxy into any user's
        mailbox.

        (typ, [data]) = <instance>.proxyauth(user)
        r*r�)rTr�r�r=r=r>�	proxyauth�s	zIMAP4.proxyauthcCs|�d||�S)zkRename old mailbox name to new.

        (typ, [data]) = <instance>.rename(oldmailbox, newmailbox)
        r+r�)rTZ
oldmailboxZ
newmailboxr=r=r>�rename�szIMAP4.renamecGsTd}|r2|jrt�d��|j|d|f|��\}}n|j|f|��\}}|�|||�S)z�Search mailbox for matching messages.

        (typ, [data]) = <instance>.search(charset, criterion, ...)

        'data' is space separated list of matching message numbers.
        If UTF8 is enabled, charset MUST be None.
        r,z'Non-None charset not valid in UTF8 mode�CHARSET)rYrr?r�r�)rT�charsetZcriteriar�r�r�r=r=r>�search�s
zIMAP4.searchr�FcCsvi|_||_|rd}nd}|�||�\}}|dkr@d|_||fSd|_d|jkrb|sb|�d|��||j�dd	g�fS)
atSelect a mailbox.

        Flush all untagged responses.

        (typ, [data]) = <instance>.select(mailbox='INBOX', readonly=False)

        'data' is count of messages in mailbox ('EXISTS' response).

        Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY'), so
        other responses should be obtained via <instance>.response('FLAGS') etc.
        rr-rerr�	READ-ONLYz%s is not writable�EXISTSN)rHrJr�rErA�get)rTr�rAr�r�r�r=r=r>�select�s
�zIMAP4.selectcCs|�d|||�S)zZSet a mailbox acl.

        (typ, [data]) = <instance>.setacl(mailbox, who, what)
        r.r�)rTr�r�Zwhatr=r=r>�setacl�szIMAP4.setaclcGs |jd|��\}}|�||d�S)z_(typ, [data]) = <instance>.setannotation(mailbox[, entry, attribute]+)
        Set ANNOTATIONs.r/r�)r/r�)rTryr�r�r=r=r>�
setannotationszIMAP4.setannotationcCs |�d||�\}}|�||d�S)ziSet the quota root's resource limits.

        (typ, [data]) = <instance>.setquota(root, limits)
        r0r�r�)rTr�Zlimitsr�r�r=r=r>�setquota	szIMAP4.setquotacGsFd}|d|dfdkr d|}|j|||f|��\}}|�|||�S)z�IMAP4rev1 extension SORT command.

        (typ, [data]) = <instance>.sort(sort_criteria, charset, search_criteria, ...)
        r1rr�r�r�r�)rTZ
sort_criteriar��search_criteriar�r�r�r=r=r>�sorts
z
IMAP4.sortNcCs�d}ts|�d��|jr"|�d��||jkr6|�d��|dkrFt��}|�|�\}}|dkr�|j|j	|j
d�|_	|j	�d�|_d|_|�
�n
|�d	��|�|||�S)
Nr2zSSL support missingzTLS session already establishedzTLS not supported by serverre�Zserver_hostnamerTzCouldn't establish TLS session)�HAVE_SSLr?rLr@rm�ssl�_create_stdlib_contextr��wrap_socketr�rUr�r�rkr�)rT�ssl_contextr�r�r�r=r=r>�starttls s&



�

zIMAP4.starttlscCs$d}|�|||�\}}|�|||�S)zpRequest named status conditions for mailbox.

        (typ, [data]) = <instance>.status(mailbox, names)
        r3r�)rTr��namesr�r�r�r=r=r>�status7szIMAP4.statuscCs>|d|dfdkrd|}|�d|||�\}}|�||d�S)z�Alters flag dispositions for messages in mailbox.

        (typ, [data]) = <instance>.store(message_set, command, flags)
        rr�r�r�r4rr�)rTr��commandr�r�r�r=r=r>�storeCszIMAP4.storecCs|�d|�S)zYSubscribe to new mailbox.

        (typ, [data]) = <instance>.subscribe(mailbox)
        r5r�r�r=r=r>�	subscribeNszIMAP4.subscribecGs*d}|j|||f|��\}}|�|||�S)z�IMAPrev1 extension THREAD command.

        (type, [data]) = <instance>.thread(threading_algorithm, charset, search_criteria, ...)
        r6r�)rTZthreading_algorithmr�r�r�r�r�r=r=r>�threadVszIMAP4.threadc	Gs�|��}|tkr|�d|��|jt|krL|�d||jd�t|�f��d}|j||f|��\}}|dkrt|}nd}|�|||�S)z�Execute "command arg ..." with messages identified by UID,
                rather than message number.

        (typ, [data]) = <instance>.uid(command, arg1, arg2, ...)

        Returns response appropriate to 'command'.
        zUnknown IMAP4 UID command: %s�9command %s illegal in state %s, only allowed in states %s�, r7)r,r1r6r)r�rpr?rE�joinr�r�)rTr�ryr�r�r�r=r=r>�uid`s��z	IMAP4.uidcCs|�d|�S)z_Unsubscribe from old mailbox.

        (typ, [data]) = <instance>.unsubscribe(mailbox)
        r8r�r�r=r=r>�unsubscribeyszIMAP4.unsubscribecGs,|��}|tkr|jft|<|j|f|��S)aAllow simple extension commands
                notified by server in CAPABILITY response.

        Assumes command is legal in current state.

        (typ, [data]) = <instance>.xatom(name, arg, ...)

        Returns response appropriate to extension command `name'.
        )r�rprEr��rTr�ryr=r=r>�xatom�s
zIMAP4.xatomcCs8|dkrd}|j}||kr*||�|�n
|g||<dS�N�)rHr�r�)rTr�r�Zurr=r=r>�_append_untagged�szIMAP4._append_untaggedcCs,|j�d�}|r(|�|d�|jd���dS)N�BYEr�r�)rHr�r@r�rZ)rT�byer=r=r>�
_check_bye�szIMAP4._check_byec

Gs�|jt|kr4d|_|�d||jd�t|�f��dD]}||jkr8|j|=q8d|jkrj|jsj|�d��|��}t	||j
�}|d|}|D]0}|dkr�q�t|t�r�t	||j
�}|d|}q�|j}|dk	�r
d|_t
|�t
|j�kr�|}nd}|t	dt|�|j
�}z|�|t�Wn2tk
�rN}	z|�d|	��W5d}	~	XYnX|dk�r^|S|���r||j|�r^|S�q^|�r�||j�}z|�|�|�t�Wn2tk
�r�}	z|�d|	��W5d}	~	XYnX|�s^�q�q^|S)	Nr�r�re�NO�BADr�z#mailbox status changed to READ-ONLY� z {%s}zsocket error: %s)rErprFr?rrHrJrA�_new_tag�bytesrZr�r��type�_commandr�r�r�rRr@rjrGrI)
rTr�ryr��tagr��argrFZ	literator�valr=r=r>r�sb��


�


 



 zIMAP4._commandc
Cs�|dk}|s|��z|j||d�\}}Wnj|jk
r`}z|�d||f��W5d}~XYn6|jk
r�}z|�d||f��W5d}~XYnX|s�|��|dkr�|�d|||f��||fS)Nr)�
expect_byezcommand: %s => %srz%s command error: %s %s)r�_get_tagged_responser@r?)rTr�rrxr�r�rr=r=r>�_command_complete�s"$zIMAP4._command_completecCsJ|��\}}|dgkr |�d��t|d|j�}|��}t|���|_dS)Nz"no CAPABILITY response from serverr�)r�r?r�rZr��tuple�splitrmr�r=r=r>rk
s

zIMAP4._get_capabilitiescCs�|��}|�|j|�rp|j�d�}||jkr:|�d|��|j�d�}t||j�}|j�d�}||gf|j|<n�d}|�t	|�s�|�|j
|�r�|j�d�}|jdkr�|�t|�r�|j�d�|_dS|�d|��|j�d�}t||j�}|j�d�}|dk�rd}|�r|d|}|�|j
|��rZt|j�d	��}|�|�}|�|||f�|��}�q|�||�|d
k�r�|�t|��r�|j�d�}t||j�}|�||j�d��|S)Nrzunexpected tagged response: %rrr�Zdata2zunexpected response: %rrrr�r)�	_get_line�_matchrh�mo�grouprGr@r�rZ�Untagged_responsera�ContinuationrIr_�intr�r�
Response_code)rT�resprr�r�Zdat2r�r�r=r=r>rjsH



zIMAP4._get_responsec
Cs�|j|}|dk	r|j|=|S|rDd}|j�|d�}|dk	rD||fS|��z|��Wq|jk
r~}z�W5d}~XYqXqdS)Nr	)rGrH�poprrjr@)rTrr�resultr�r
rr=r=r>rcs
zIMAP4._get_tagged_responsecCs>|��}|s|�d��|�d�s.|�d|��|dd�}|S)Nzsocket error: EOFrz#socket error: unterminated line: %r���)r�r@�endswithr�r=r=r>r�s

zIMAP4._get_linecCs|�|�|_|jdk	Srv)�matchr)rTZcre�sr=r=r>r�szIMAP4._matchcCs2|jtt|j�|j�}|jd|_d|j|<|S)Nr�)rgrr�rKrZrG)rTrr=r=r>r�s
zIMAP4._new_tagcCs$|�dd�}|�dd�}d|dS)N�\z\\�"z\")r�)rTrr=r=r>r��szIMAP4._quotecGs|�||j|f|���Srv)rrrr=r=r>r��szIMAP4._simple_commandcCs8|dkr||fS||jkr$|dgfS|j�|�}||fS)Nr
)rHr%)rTr�r�r�r�r=r=r>r��s

zIMAP4._untagged_response)r�r�)r�r�)r�F)N)F)Tr:r;r<�__doc__rPr?r@rA�
IMAP4_PORTrWrMrdrOrurwrzr~rNr�r�r�rQr}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rxr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrrkrjrrrrr�r�r��_mesgZ_dump_urZ_logZ	print_logr=r=r=r>r�s�,*
		
	



 	

M	P
!$c@s:eZdZdZdedddfdd�Zdd�Zdefdd	�ZdS)
�	IMAP4_SSLa3IMAP4 client class over SSL connection

        Instantiate with: IMAP4_SSL([host[, port[, keyfile[, certfile[, ssl_context]]]]])

                host - host's name (default: localhost);
                port - port number (default: standard IMAP4 SSL port);
                keyfile - PEM formatted file that contains your private key (default: None);
                certfile - PEM formatted certificate chain file (default: None);
                ssl_context - a SSLContext object that contains your certificate chain
                              and private key (default: None)
                Note: if ssl_context is provided, then parameters keyfile or
                certfile should not be set otherwise ValueError is raised.

        for more documentation see the docstring of the parent class IMAP4.
        rBNcCs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}|�dtd�||_||_|dkrxtj||d�}||_t	�
|||�dS)Nz8ssl_context and keyfile arguments are mutually exclusivez9ssl_context and certfile arguments are mutually exclusiverzEkeyfile and certfile are deprecated, use a custom ssl_context instead�)�certfile�keyfile)�
ValueError�warnings�warn�DeprecationWarningr3r2r�r�r�rrW)rTrUrVr3r2r�r5r=r=r>rW�s$��zIMAP4_SSL.__init__cCst�|�}|jj||jd�S)Nr�)rr~r�r�rU)rTr�r=r=r>r~s
�zIMAP4_SSL._create_socketcCst�|||�dS)z�Setup connection to remote server on "host:port".
                (default: localhost:standard IMAP4 SSL port).
            This connection will be used by the routines:
                read, readline, send, shutdown.
            N)rrNrSr=r=r>rNszIMAP4_SSL.open)r:r;r<r-�IMAP4_SSL_PORTrWr~rNr=r=r=r>r0�s�
r0c@sBeZdZdZdd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)rz�IMAP4 client class over a stream

    Instantiate with: IMAP4_stream(command)

            "command" - a string that can be passed to subprocess.Popen()

    for more documentation see the docstring of the parent class IMAP4.
    cCs||_t�|�dSrv)r�rrW)rTr�r=r=r>rW/szIMAP4_stream.__init__NcCsNd|_d|_d|_d|_tj|jttjtjddd�|_	|j	j
|_|j	j|_
dS)z�Setup a stream connection.
        This connection will be used by the routines:
            read, readline, send, shutdown.
        NT)�bufsize�stdin�stdout�shellZ	close_fds)rUrVr�r��
subprocess�Popenr�r�PIPEr�r:�	writefiler;�readfilerSr=r=r>rN4s�
zIMAP4_stream.opencCs|j�|�Sr�)rAr�r�r=r=r>r�DszIMAP4_stream.readcCs
|j��S)r�)rAr�rbr=r=r>r�IszIMAP4_stream.readlinecCs|j�|�|j��dS)r�N)r@�write�flushr�r=r=r>r�NszIMAP4_stream.sendcCs"|j��|j��|j��dS)r�N)rAr�r@r��waitrbr=r=r>rQTs

zIMAP4_stream.shutdown)NN)
r:r;r<r-rWrNr�r�r�rQr=r=r=r>r#s

c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r�zcPrivate class to provide en/decoding
            for base64-based authentication conversation.
    cCs
||_dSrv)r�)rTZmechinstr=r=r>rWbsz_Authenticator.__init__cCs&|�|�|��}|dkrdS|�|�S)N�*)r�r�r�)rTr�Zretr=r=r>r�esz_Authenticator.processcCsnd}t|t�r|�d�}|rjt|�dkrB|dd�}|dd�}n|}d}t�|�}|r||dd�}q|S)Nrrc�0r�)r�r�r�r��binasciiZ
b2a_base64)rT�inpZoup�t�er=r=r>r�ks	


z_Authenticator.encodecCs|sdSt�|�Sr)rGZ
a2b_base64)rTrHr=r=r>r��sz_Authenticator.decodeN)r:r;r<r-rWr�r�r�r=r=r=r>r�\s
r�z0 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Decr�cCsi|]\}}|��|d�qS)r�)r�)�.0�nr*r=r=r>�
<dictcomp>�srMr�c	Cs�t�|�}|sdSt|�d�}|�d�}t|�d��}t|�d��}t|�d��}t|�d��}t|�d��}t|�d	��}	t|�d
��}
|	d|
d}|dkr�|}||||||d
d
d
f	}t�|�|}
t�|
�S)z�Parse an IMAP4 INTERNALDATE string.

    Return corresponding local time.  The return value is a
    time.struct_time tuple or None if the string has wrong format.
    N�mon�zonen�day�year�hour�min�sec�zoneh�zonem�<�-r�)	�InternalDater)�Mon2numrr"�calendarZtimegm�time�	localtime)r$rrNrOrPrQrRrSrTrUrVZzoneZtt�utcr=r=r>r�s$

cCs@d}d}tt|��}|r<t|d�\}}|||d�|}q|S)z-Convert integer to A-P string representation.rsABCDEFGHIJKLMNOP�r�)r"�abs�divmod)ZnumrZAP�modr=r=r>r	�scCs$t�|�}|sdSt|�d����S)z-Convert IMAP4 flags response to python tuple.r=r�)�Flagsr)rrr)r$rr=r=r>r
�s
cCst|ttf�r"t�|tj���}n�t|t�r�z
|j	}WnZt
k
r�tjr�|d}|dkrpt�
t�|��d}tjtjf|}ntj}YnXt|d�}t|dd�dt|�i�}nLt|t�r�|jdkr�td��|}n*t|t�r�|d|dfd	kr�|Std
��d�t|j�}|�|�S)a�Convert date_time to IMAP4 INTERNALDATE representation.

    Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'.  The
    date_time argument can be a number (int or float) representing
    seconds since epoch (as returned by time.time()), a 9-tuple
    representing local time, an instance of time.struct_time (as
    returned by time.localtime()), an aware datetime instance or a
    double-quoted string.  In the last case, it is assumed to already
    be in the correct format.
    �r�)ZsecondsN��tzinfozdate_time must be awarer)r,r,zdate_time not of a known typez"%d-{}-%Y %H:%M:%S %z")r�r"�floatrZ
fromtimestamprr^Z
astimezoner�	tm_gmtoffrsr\�daylightr]�mktime�altzonerrfr4r��format�MonthsZmonth�strftime)r�ZdtZgmtoffZdstZdeltaZfmtr=r=r>r�s2�





�__main__zd:s:)r=r=z-dz-s)rBzIMAP password for %s on %s: Z	localhostzJFrom: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)s�
)r�Zlfr�)r�)�
/tmp/xxx 1)r�)rqz/tmp/yyy)r��
/tmp/yyz 2r�rs)r�)z/tmpzyy*)r�rr)r�)NZSUBJECTZtest)r�)�1z(FLAGS INTERNALDATE RFC822))r�)rt�FLAGSz
(\Deleted))r�r=)r�r=)r�r=)r�r=)r�r=)r�)ZUIDVALIDITY)r)r,ZALL)r�)r�)rxr=cCsLt�d||f�tt|�|�\}}t�d|||f�|dkrH|d�|S)Nz%s %sz%s => %s %sr
r)�Mr/rq)�cmdryr�r�r=r=r>�run'srxrzPROTOCOL_VERSION = %szCAPABILITIES = %rr�)z/tmp/zyy%z.*"([^"]+)"$r�r�rrz%sz:(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)z
All tests OK.z
Tests failed.z8
If you would like to see debugging output,
try: %s -d5
)Ur-rirGr�rfr[r}r=r{r\r[rrr�iorr�r��ImportError�__all__r�rCr.r8rlr�rpr\r!rcrYr^r_r�r#r rar]r`rr0r�rr�rrm�	enumeraterZrr	r
rr:ZgetoptZgetpass�argvZoptlistryr?rZstream_command�optr"rUZgetuserZUSERZPASSWDZ	test_mesgZ	test_seq1Z	test_seq2rxrvrEr/rnrmrwZmlr)rr�pathr�r�printr=r=r=r>�<module>sZH
�	�/



	

�l4
9,
#
)





��


�
�textwrap.cpython-38.opt-2.pyc000064400000014136150335716500012024 0ustar00U

e5d�K�@s�ddlZddddddgZdZGd	d�d�Zddd�Zddd�Zd
d�Ze�dej�Z	e�dej�Z
dd�Zddd�Ze
dkr�eed��dS)�N�TextWrapper�wrap�fill�dedent�indent�shortenz	

 c
@s�eZdZiZed�ZeD]Zeeee�<qdZdZ	de
�e�Zdedd�Z
e
�dee	ee
d	�e
j�Z[[	[
e
�d
e�Z[e
�d�Zd%ddd�dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�ZdS)&r� z[\w!"\'&.,?]z[^\d\W]z[%s]z[^�Na�
        ( # any whitespace
          %(ws)s+
        | # em-dash between words
          (?<=%(wp)s) -{2,} (?=\w)
        | # word, possibly hyphenated
          %(nws)s+? (?:
            # hyphenated word
              -(?: (?<=%(lt)s{2}-) | (?<=%(lt)s-%(lt)s-))
              (?= %(lt)s -? %(lt)s)
            | # end of word
              (?=%(ws)s|\Z)
            | # em-dash
              (?<=%(wp)s) (?=-{2,}\w)
            )
        ))Zwp�ltZwsZnwsz(%s+)z[a-z][\.\!\?][\"\']?\Z�F�TF�z [...])�	max_lines�placeholderc
CsL||_||_||_||_||_||_||_||_|	|_|
|_	||_
||_dS�N)�width�initial_indent�subsequent_indent�expand_tabs�replace_whitespace�fix_sentence_endings�break_long_words�drop_whitespace�break_on_hyphens�tabsizerr)
�selfrrrrrrrrrrrr�r� /usr/lib64/python3.8/textwrap.py�__init__sszTextWrapper.__init__cCs(|jr|�|j�}|jr$|�|j�}|Sr)r�
expandtabsrr�	translate�unicode_whitespace_trans�r�textrrr�_munge_whitespace�s
zTextWrapper._munge_whitespacecCs6|jdkr|j�|�}n|j�|�}dd�|D�}|S)NTcSsg|]}|r|�qSrr)�.0�crrr�
<listcomp>�sz&TextWrapper._split.<locals>.<listcomp>)r�
wordsep_re�split�wordsep_simple_re�rr#�chunksrrr�_split�s

zTextWrapper._splitcCs\d}|jj}|t|�dkrX||ddkrN|||�rNd||d<|d7}q|d7}qdS)Nrr	rz  �)�sentence_end_re�search�len)rr,�iZ	patsearchrrr�_fix_sentence_endings�s	
z!TextWrapper._fix_sentence_endingscCs^|dkrd}n||}|jrH|�|dd|��|d|d�|d<n|sZ|�|���dS)Nr	���)r�append�pop)rZreversed_chunks�cur_line�cur_lenrZ
space_leftrrr�_handle_long_word�s
zTextWrapper._handle_long_wordc	Cs�g}|jdkrtd|j��|jdk	rb|jdkr8|j}n|j}t|�t|j���|jkrbtd��|��|�r�g}d}|r�|j}n|j}|jt|�}|j	r�|d�
�dkr�|r�|d=|r�t|d�}|||kr�|�|���||7}q�q�q�|�r&t|d�|k�r&|�
||||�ttt|��}|j	�r\|�r\|d�
�dk�r\|t|d�8}|d=|rj|jdk�s�t|�d|jk�s�|�r�|j	�r�t|�dk�r�|d�
��s�||k�r�|�|d�|��qj|�r0|d�
��r|t|j�|k�r|�|j�|�|d�|���q�|t|d�8}|d=�q�|�rn|d��}t|�t|j�|jk�rn||j|d<�q�|�||j����q�qj|S)Nrzinvalid width %r (must be > 0)r	z#placeholder too large for max widthr4r)r�
ValueErrorrrrr1r�lstrip�reverser�stripr5r6r9�sum�map�join�rstrip)	rr,�linesrr7r8r�lZ	prev_linerrr�_wrap_chunks�s�




 ���
�
���
�zTextWrapper._wrap_chunkscCs|�|�}|�|�Sr)r$r-r"rrr�
_split_chunksPs
zTextWrapper._split_chunkscCs$|�|�}|jr|�|�|�|�Sr)rErr3rDr+rrrrVs	

zTextWrapper.wrapcCsd�|�|��S)N�
)r@rr"rrrrdszTextWrapper.fill)
rrrTTFTTTr
)�__name__�
__module__�__qualname__r!�ordZuspace�_whitespace�xZ
word_punctZletter�re�escapeZ
whitespaceZnowhitespace�compile�VERBOSEr(r*r/rr$r-r3r9rDrErrrrrrrsT1���
��!grcKstfd|i|��}|�|�S�Nr)rr�r#r�kwargs�wrrrrps
cKstfd|i|��}|�|�SrQ)rrrRrrrr}s	cKs,tf|dd�|��}|�d�|������S)Nr	)rrr)rrr@r=r)rRrrrr�sz^[ 	]+$z(^[ 	]*)(?:[^ 	
])cCs�d}t�d|�}t�|�}|D]b}|dkr0|}q|�|�r<q|�|�rL|}qtt||��D]$\}\}}||krZ|d|�}qqZqdr�|r�|�d�D]}q�|r�t�d|d|�}|S)NrrrFz(?m)^)	�_whitespace_only_re�sub�_leading_whitespace_re�findall�
startswith�	enumerate�zipr)rM)r#Zmargin�indentsrr2rL�y�linerrrr�s(


cs,�dkrdd�����fdd�}d�|��S)NcSs|��Sr)r=�r^rrr�	predicate�szindent.<locals>.predicatec3s*��d�D]}�|�r�|n|Vq
dS)NT)�
splitlinesr_�r`�prefixr#rr�prefixed_lines�szindent.<locals>.prefixed_linesr)r@)r#rcr`rdrrbrr�s�__main__z Hello there.
  This is indented.)r)r)N)rM�__all__rKrrrrrO�	MULTILINErUrWrrrG�printrrrr�<module>sa

3
_pydecimal.cpython-38.opt-2.pyc000064400000232420150335716500012252 0ustar00U

e5d:}�%@s�dddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$g%ZeZd%Zd&Zd'Zd(d)lZd(d)lZd(d)l	Z	zd(d*l
mZedd+�Z
Wnek
r�d,d-�Z
YnXdZdZdZdZdZdZdZdZd.Zd.Ze	jd/kr�d0Zd0Zd1Znd2Zd2Zd3Zeed4ZGd5d�de�ZGd6d�de�Z Gd7d�de�Z!Gd8d�de!�Z"Gd9d	�d	ee#�Z$Gd:d�de!�Z%Gd;d�de!e#�Z&Gd<d
�d
e�Z'Gd=d�de!�Z(Gd>d�de�Z)Gd?d�de�Z*Gd@d
�d
e'e)�Z+GdAd�de'e)e*�Z,GdBd�dee-�Z.e e$e'e+e)e,e!e*e.g	Z/e"e!e%e!e&e!e(e!iZ0eeeeeeeefZ1d(d)l2Z2e2�3dC�Z4dDd�Z5dEd�Z6[2d�dFd�Z7GdGd�de8�Z9d�dIdJ�Z:ej;�<e9�GdKdL�dLe8�Z=GdMd�de8�Z>GdNdO�dOe8�Z?d�dPdQ�Z@eAjBZCdRdS�ZDdTdU�ZEdVdW�ZFdXdY�ZGd�d[d\�ZHd]d^�ZId_d`�ZJGdadb�dbe8�ZKeK�jLZMd�dcdd�ZNdedf�ZOdgdh�ZPdidjdkdldmdndodpdqdr�	fdsdt�ZQd�dudv�ZRd�dwdx�ZSe>dyee$e+e!ggdzd{d4d(d|�ZTe>d}ee$e+e!e e,ggd~�ZUe>d}eggd~�ZVd(d)lWZWeW�XdeWjYeWjZB�j[Z\eW�Xd��j[Z]eW�Xd��j[Z^eW�Xd�eWjYeWj_B�Z`[Wzd(d)laZbWnek
�rYnXd�d�d��Zcd�d��Zdd�d��Zed�d�d��Zfd�d��Zgd�d��Zhe9d��Zie9d��Zje9d��Zke9d(�Zle9d4�Zme9d��ZneiejfZoe	jpjqZre	jpjsZte	jpjuZvewdperd�er�Zx[	d)S)��Decimal�Context�DecimalTuple�DefaultContext�BasicContext�ExtendedContext�DecimalException�Clamped�InvalidOperation�DivisionByZero�Inexact�Rounded�	Subnormal�Overflow�	Underflow�FloatOperation�DivisionImpossible�InvalidContext�ConversionSyntax�DivisionUndefined�
ROUND_DOWN�
ROUND_HALF_UP�ROUND_HALF_EVEN�
ROUND_CEILING�ROUND_FLOOR�ROUND_UP�ROUND_HALF_DOWN�
ROUND_05UP�
setcontext�
getcontext�localcontext�MAX_PREC�MAX_EMAX�MIN_EMIN�	MIN_ETINY�HAVE_THREADS�HAVE_CONTEXTVARZdecimalz1.70z2.4.2�N)�
namedtuplezsign digits exponentcGs|S�N�)�argsr)r)�"/usr/lib64/python3.8/_pydecimal.py�<lambda>��r,Tl����l��N�Zol������N�Zoi@�Ti����c@seZdZdd�ZdS)rcGsdSr(r)��self�contextr*r)r)r+�handle�szDecimalException.handleN��__name__�
__module__�__qualname__r2r)r)r)r+r�sc@seZdZdS)rN�r4r5r6r)r)r)r+r�sc@seZdZdd�ZdS)r	cGs,|r(t|dj|djdd�}|�|�StS)Nr&�nT)�_dec_from_triple�_sign�_int�_fix_nan�_NaN)r0r1r*�ansr)r)r+r2�s
zInvalidOperation.handleNr3r)r)r)r+r	�sc@seZdZdd�ZdS)rcGstSr(�r=r/r)r)r+r2szConversionSyntax.handleNr3r)r)r)r+rsc@seZdZdd�ZdS)r
cGst|Sr()�_SignedInfinity�r0r1�signr*r)r)r+r2szDivisionByZero.handleNr3r)r)r)r+r

s
c@seZdZdd�ZdS)rcGstSr(r?r/r)r)r+r2"szDivisionImpossible.handleNr3r)r)r)r+rsc@seZdZdd�ZdS)rcGstSr(r?r/r)r)r+r2-szDivisionUndefined.handleNr3r)r)r)r+r%sc@seZdZdS)rNr7r)r)r)r+r0sc@seZdZdd�ZdS)rcGstSr(r?r/r)r)r+r2GszInvalidContext.handleNr3r)r)r)r+r<sc@seZdZdS)rNr7r)r)r)r+rJsc@seZdZdS)r
Nr7r)r)r)r+r
Vsc@seZdZdd�ZdS)rcGs�|jttttfkrt|S|dkrR|jtkr4t|St|d|j|j	|jd�S|dkr�|jt
krlt|St|d|j|j	|jd�SdS)Nr&�9r.)�roundingrrrrr@rr9�prec�EmaxrrAr)r)r+r2ws"�
�
�zOverflow.handleNr3r)r)r)r+rasc@seZdZdS)rNr7r)r)r)r+r�sc@seZdZdS)rNr7r)r)r)r+r�sZdecimal_contextcCs8z
t��WStk
r2t�}t�|�|YSXdSr()�_current_context_var�get�LookupErrorr�set�r1r)r)r+r�s

cCs,|tttfkr|��}|��t�|�dSr()rrr�copy�clear_flagsrGrJrKr)r)r+r�scCs|dkrt�}t|�Sr()r�_ContextManager)Zctxr)r)r+r�s$c
@s�eZdZdZd�dd�Zedd��Zdd	�Zd
d�Zd�dd
�Z	dd�Z
dd�Zdd�Zd�dd�Z
d�dd�Zd�dd�Zd�dd�Zd�dd�Zd�dd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd�d)d*�Zd�d+d,�Zd�d-d.�Zd�d/d0�Zd�d2d3�Zd�d4d5�ZeZd�d6d7�Z�dd8d9�Z�dd:d;�Z e Z!�dd<d=�Z"d>d?�Z#�dd@dA�Z$�ddBdC�Z%�ddDdE�Z&�ddFdG�Z'�ddHdI�Z(�ddJdK�Z)�d	dLdM�Z*�d
dNdO�Z+dPdQ�Z,dRdS�Z-e-Z.e/dTdU��Z0e/dVdW��Z1dXdY�Z2dZd[�Z3d\d]�Z4d^d_�Z5d`da�Z6dbdc�Z7ddde�Z8dfdg�Z9dhdi�Z:djdk�Z;dldm�Z<dndo�Z=e>e6e7e8e9e:e;e<e=dp�Z?�ddqdr�Z@dsdt�ZAdudv�ZB�ddwdx�ZC�d
dydz�ZDd{d|�ZE�dd}d~�ZF�ddd��ZG�dd�d��ZH�dd�d��ZI�dd�d��ZJd�d��ZKd�d��ZL�dd�d��ZM�dd�d��ZNeNZO�dd�d��ZP�dd�d��ZQ�dd�d��ZRd�d��ZSd�d��ZTd�d��ZUd�d��ZV�dd�d��ZW�dd�d��ZX�dd�d��ZYd�d��ZZd�d��Z[�dd�d��Z\�dd�d��Z]d�d��Z^d�d��Z_d�d��Z`d�d��Za�dd�d��Zbd�d��Zcd�d��Zdd�d��Ze�dd�d��Zfd�d��Zgd�d��Zh�dd�d„Zid�dĄZj�d d�dƄZk�d!d�dȄZld�dʄZmd�d̄Zn�d"d�d΄Zo�d#d�dЄZp�d$d�d҄Zq�d%d�dԄZr�d&d�dքZs�d'd�d؄Zt�d(d�dڄZu�d)d�d܄Zv�d*d�dބZw�d+d�d�Zxd�d�Zy�d,d�d�Zz�d-d�d�Z{�d.d�d�Z|d�d�Z}d�d�Z~d�d�Z�d/d�d�Z�dS(0r)�_expr;r:�_is_special�0NcCs�t�|�}t|t��r$t|���dd��}|dkrP|dkr@t�}|�t	d|�S|�
d�dkrfd|_nd|_|�
d�}|dk	r�|�
d	�p�d}t|�
d
�p�d�}tt||��|_
|t|�|_d|_nZ|�
d
�}|dk	�rtt|p�d���d�|_
|�
d��rd|_nd|_nd|_
d|_d|_|St|t��rf|dk�rBd|_nd|_d|_tt|��|_
d|_|St|t��r�|j|_|j|_|j
|_
|j|_|St|t��r�|j|_t|j�|_
t|j�|_d|_|St|ttf��r"t|�dk�r�td��t|dt��r|ddk�std��|d|_|ddk�rHd|_
|d|_d|_n�g}	|dD]R}
t|
t��r�d|
k�r|dk�r�nn|	�s�|
dk�r�|	�|
�ntd���qT|ddk�r�d�tt|	��|_
|d|_d|_nDt|dt��rd�tt|	�p�dg��|_
|d|_d|_ntd��|St|t��rx|dk�r>t�}|�td�t�|�}|j|_|j|_|j
|_
|j|_|St d|��dS)N�_�zInvalid literal for Decimal: %rrB�-r.r&�intZfrac�exprQF�diag�signal�Nr8�FT�ztInvalid tuple size in creation of Decimal from list or tuple.  The list or tuple should have exactly three elements.�r&r.z|Invalid sign.  The first value in the tuple should be an integer; either 0 for a positive number or 1 for a negative number.��	zTThe second value in the tuple must be composed of integers in the range 0 through 9.�r8rYzUThe third value in the tuple must be an integer, or one of the strings 'F', 'n', 'N'.�;strict semantics for mixing floats and Decimals are enabledzCannot convert %r to Decimal)!�object�__new__�
isinstance�str�_parser�strip�replacer�_raise_errorr�groupr:rUr;�lenrOrP�lstrip�absr�_WorkReprBrV�list�tuple�
ValueError�append�join�map�floatr�
from_float�	TypeError)�cls�valuer1r0�m�intpart�fracpartrVrW�digitsZdigitr)r)r+rb
s�
�





(


�
zDecimal.__new__cCs�t|t�r,|dkrdnd}d}tt|��}nzt|t�r�t�|�sJt�|�rV|t|��St�	d|�dkrld}nd}t|��
�\}}|��d}t|d|�}ntd��t
|||�}|tkr�|S||�SdS)Nr&r.g�?�zargument must be int or float.)rcrUrdrlrt�_mathZisinfZisnan�reprZcopysign�as_integer_ratio�
bit_lengthrvr9r)rw�frB�k�coeffr8�d�resultr)r)r+ru�s$

zDecimal.from_floatcCs(|jr$|j}|dkrdS|dkr$dSdS)Nr8r.rYr]r&)rPrO)r0rVr)r)r+�_isnan�szDecimal._isnancCs|jdkr|jrdSdSdS)NrZ���r.r&)rOr:�r0r)r)r+�_isinfinity�s

zDecimal._isinfinitycCs||��}|dkrd}n|��}|s&|rx|dkr4t�}|dkrJ|�td|�S|dkr`|�td|�S|rn|�|�S|�|�SdS)NFr]�sNaNr&)r�rrhr	r<)r0�otherr1�self_is_nan�other_is_nanr)r)r+�_check_nans�s&
��

zDecimal._check_nanscCsv|dkrt�}|js|jrr|��r0|�td|�S|��rF|�td|�S|��r\|�td|�S|��rr|�td|�SdS)Nzcomparison involving sNaNzcomparison involving NaNr&)rrP�is_snanrhr	�is_qnan�r0r�r1r)r)r+�_compare_check_nans	s0����zDecimal._compare_check_nanscCs|jp|jdkS�NrQ�rPr;r�r)r)r+�__bool__*szDecimal.__bool__cCs|js|jr8|��}|��}||kr(dS||kr4dSdS|sP|sDdSd|jS|s^d|jS|j|jkrndS|j|jkr~dS|��}|��}||kr�|jd|j|j}|jd|j|j}||kr�dS||kr�d|jSd|jSn ||k�rd|jSd|jSdS)Nr&r�r.rQ)rPr�r:�adjustedr;rO)r0r�Zself_infZ	other_inf�
self_adjustedZother_adjusted�self_paddedZother_paddedr)r)r+�_cmp1s>


zDecimal._cmpcCs<t||dd�\}}|tkr|S|�||�r.dS|�|�dkS)NT)�equality_opFr&)�_convert_for_comparison�NotImplementedr�r�r�r)r)r+�__eq__qszDecimal.__eq__cCs<t||�\}}|tkr|S|�||�}|r.dS|�|�dkS�NFr&�r�r�r�r��r0r�r1r>r)r)r+�__lt__yszDecimal.__lt__cCs<t||�\}}|tkr|S|�||�}|r.dS|�|�dkSr�r�r�r)r)r+�__le__�szDecimal.__le__cCs<t||�\}}|tkr|S|�||�}|r.dS|�|�dkSr�r�r�r)r)r+�__gt__�szDecimal.__gt__cCs<t||�\}}|tkr|S|�||�}|r.dS|�|�dkSr�r�r�r)r)r+�__ge__�szDecimal.__ge__cCs>t|dd�}|js|r0|jr0|�||�}|r0|St|�|��S�NT��raiseit)�_convert_otherrPr�rr�r�r)r)r+�compare�szDecimal.comparecCs�|jr4|��rtd��n|��r$tS|jr0tStS|jdkrNtd|jt	�}ntt
|jt	�}t|j�|t	}|dkr||n|}|dkr�dS|S)Nz"Cannot hash a signaling NaN value.r&�
r����)
rPr�rv�is_nan�_PyHASH_NANr:�_PyHASH_INFrO�pow�_PyHASH_MODULUS�
_PyHASH_10INVrUr;)r0Zexp_hashZhash_r>r)r)r+�__hash__�s

zDecimal.__hash__cCst|jttt|j��|j�Sr()rr:rorsrUr;rOr�r)r)r+�as_tuple�szDecimal.as_tuplecCs�|jr |��rtd��ntd��|s(dSt|j�}|jdkrR|d|jd}}nn|j}|dkr�|ddkr�|d}|d8}qZ|j}t||@��d|�}|r�||L}||8}d||>}|j	r�|}||fS)Nz#cannot convert NaN to integer ratioz(cannot convert Infinity to integer ratior\r&r�r.r})
rPr�rp�
OverflowErrorrUr;rO�minr�r:)r0r8r�Zd5Zd2Zshift2r)r)r+r��s,



zDecimal.as_integer_ratiocCsdt|�S)Nz
Decimal('%s'))rdr�r)r)r+�__repr__szDecimal.__repr__Fc	Csbddg|j}|jrL|jdkr&|dS|jdkr>|d|jS|d|jS|jt|j�}|jdkrt|d	krt|}n6|s~d
}n,|jdkr�|d
dd
}n|d
dd
}|dkr�d}d
d||j}nL|t|j�kr�|jd|t|j�}d}n |jd|�}d
|j|d�}||k�r(d}n*|dk�r8t�}ddg|jd||}||||S)NrSrTrZZInfinityr8�NaNr�r&���r.rQr[�.�e�Ez%+d)r:rPrOr;rjr�capitals)	r0�engr1rB�
leftdigits�dotplacerzr{rVr)r)r+�__str__s:




zDecimal.__str__cCs|jd|d�S)NT)r�r1)r��r0r1r)r)r+�
to_eng_string;szDecimal.to_eng_stringcCsR|jr|j|d�}|r|S|dkr(t�}|s@|jtkr@|��}n|��}|�|�S�NrK)rPr�rrDr�copy_abs�copy_negate�_fix�r0r1r>r)r)r+�__neg__Ds
zDecimal.__neg__cCsR|jr|j|d�}|r|S|dkr(t�}|s@|jtkr@|��}nt|�}|�|�Sr�)rPr�rrDrr�rr�r�r)r)r+�__pos__Zs
zDecimal.__pos__TcCsJ|s|��S|jr&|j|d�}|r&|S|jr:|j|d�}n|j|d�}|Sr�)r�rPr�r:r�r�)r0�roundr1r>r)r)r+�__abs__oszDecimal.__abs__c
Csht|�}|tkr|S|dkr"t�}|js.|jr�|�||�}|rB|S|��rr|j|jkrj|��rj|�td�St	|�S|��r�t	|�St
|j|j�}d}|jt
kr�|j|jkr�d}|s�|s�t
|j|j�}|r�d}t|d|�}|�|�}|S|�st||j|jd�}|�||j�}|�|�}|S|�sVt||j|jd�}|�||j�}|�|�}|St|�}t|�}t|||j�\}}t�}	|j|jk�r�|j|jk�r�t|d|�}|�|�}|S|j|jk�r�||}}|jdk�r�d|	_|j|j|_|_nd|	_n&|jdk�rd|	_d\|_|_nd|	_|jdk�r<|j|j|	_n|j|j|	_|j|	_t	|	�}|�|�}|S)Nz
-INF + INFr&r.rQ)r&r&)r�r�rrPr�r�r:rhr	rr�rOrDrr9r��maxrE�_rescalerm�
_normalizerBrUrV)
r0r�r1r>rVZnegativezerorB�op1�op2r�r)r)r+�__add__�s|





zDecimal.__add__cCsHt|�}|tkr|S|js |jr6|j||d�}|r6|S|j|��|d�Sr�)r�r�rPr�r�r�r�r)r)r+�__sub__�szDecimal.__sub__cCs"t|�}|tkr|S|j||d�Sr�)r�r�r�r�r)r)r+�__rsub__�szDecimal.__rsub__cCs@t|�}|tkr|S|dkr"t�}|j|jA}|js:|jr�|�||�}|rN|S|��rn|sf|�td�St	|S|��r�|s�|�td�St	|S|j
|j
}|r�|s�t|d|�}|�|�}|S|j
dkr�t||j
|�}|�|�}|S|j
dk�r
t||j
|�}|�|�}|St|�}t|�}t|t|j|j�|�}|�|�}|S)Nz(+-)INF * 0z0 * (+-)INFrQ�1)r�r�rr:rPr�r�rhr	r@rOr9r�r;rmrdrU)r0r�r1Z
resultsignr>Z	resultexpr�r�r)r)r+�__mul__�sH




zDecimal.__mul__cCs�t|�}|tkrtS|dkr"t�}|j|jA}|js:|jr�|�||�}|rN|S|��rj|��rj|�td�S|��rzt	|S|��r�|�t
d�t|d|���S|s�|s�|�t
d�S|�td|�S|s�|j|j}d}n�t|j�t|j�|jd}|j|j|}t|�}t|�}	|dk�r:t|jd||	j�\}}
nt|j|	jd|�\}}
|
�rt|d	dk�r�|d7}n8|j|j}||k�r�|ddk�r�|d}|d7}�q�t|t|�|�}|�|�S)
Nz(+-)INF/(+-)INFzDivision by infinityrQz0 / 0zx / 0r&r.r�r})r�r�rr:rPr�r�rhr	r@rr9�Etinyrr
rOrjr;rErm�divmodrUrdr�)r0r�r1rBr>rVr��shiftr�r��	remainder�	ideal_expr)r)r+�__truediv__,sP

zDecimal.__truediv__cCs|j|jA}|��r|j}nt|j|j�}|��|��}|rN|��sN|dkrht|dd�|�||j�fS||jk�r
t	|�}t	|�}|j
|j
kr�|jd|j
|j
9_n|jd|j
|j
9_t|j|j�\}}	|d|jk�r
t|t
|�d�t|jt
|	�|�fS|�td�}
|
|
fS)Nr�rQr&r�z%quotient too large in //, % or divmod)r:r�rOr�r�r9r�rDrErmrVrUr�rdrhr)r0r�r1rBr��expdiffr�r��q�rr>r)r)r+�_dividegs0
���zDecimal._dividecCs"t|�}|tkr|S|j||d�Sr�)r�r�r�r�r)r)r+�__rtruediv__�szDecimal.__rtruediv__cCs�t|�}|tkr|S|dkr"t�}|�||�}|r:||fS|j|jA}|��r~|��rj|�td�}||fSt||�td�fS|s�|s�|�t	d�}||fS|�t
d|�|�td�fS|�||�\}}|�|�}||fS)Nzdivmod(INF, INF)�INF % xzdivmod(0, 0)�x // 0�x % 0)
r�r�rr�r:r�rhr	r@rr
r�r�)r0r�r1r>rBZquotientr�r)r)r+�
__divmod__�s4
�
�
zDecimal.__divmod__cCs"t|�}|tkr|S|j||d�Sr�)r�r�r�r�r)r)r+�__rdivmod__�szDecimal.__rdivmod__cCs�t|�}|tkr|S|dkr"t�}|�||�}|r6|S|��rJ|�td�S|sj|r^|�td�S|�td�S|�||�d}|�	|�}|S)Nr�r�z0 % 0r.)
r�r�rr�r�rhr	rr�r�)r0r�r1r>r�r)r)r+�__mod__�s"
zDecimal.__mod__cCs"t|�}|tkr|S|j||d�Sr�)r�r�r�r�r)r)r+�__rmod__�szDecimal.__rmod__cCs�|dkrt�}t|dd�}|�||�}|r.|S|��rB|�td�S|sb|rV|�td�S|�td�S|��r|t|�}|�|�St	|j
|j
�}|s�t|jd|�}|�|�S|�
�|�
�}||jdkr�|�t�S|dkr�|�||j�}|�|�St|�}t|�}|j|jk�r(|jd	|j|j9_n|jd	|j|j9_t|j|j�\}}	d
|	|d@|jk�r~|	|j8}	|d7}|d	|jk�r�|�t�S|j}
|	dk�r�d|
}
|	}	t|
t|	�|�}|�|�S)NTr�zremainder_near(infinity, x)zremainder_near(x, 0)zremainder_near(0, 0)rQr.r�r�r]r&)rr�r�r�rhr	rrr�r�rOr9r:r�rErr�rDrmrVrUr�rd)r0r�r1r>�ideal_exponentr�r�r�r�r�rBr)r)r+�remainder_near�s`���






zDecimal.remainder_nearcCs�t|�}|tkr|S|dkr"t�}|�||�}|r6|S|��rb|��rR|�td�St|j|jAS|s�|r�|�t	d|j|jA�S|�t
d�S|�||�dS)Nz
INF // INFr�z0 // 0r&)r�r�rr�r�rhr	r@r:r
rr�r�r)r)r+�__floordiv__'s&
�zDecimal.__floordiv__cCs"t|�}|tkr|S|j||d�Sr�)r�r�r�r�r)r)r+�
__rfloordiv__CszDecimal.__rfloordiv__cCs8|��r(|��rtd��|jr"dnd}nt|�}t|�S)Nz%Cannot convert signaling NaN to floatz-nan�nan)r�r�rpr:rdrt�r0�sr)r)r+�	__float__JszDecimal.__float__cCst|jr(|��rtd��n|��r(td��d|j}|jdkrT|t|j�d|jS|t|jd|j�pjd�SdS)NzCannot convert NaN to integerz"Cannot convert infinity to integerr�r&r�rQ)	rPr�rpr�r�r:rOrUr;r�r)r)r+�__int__Ts


zDecimal.__int__cCs|Sr(r)r�r)r)r+�realcszDecimal.realcCstd�S�Nr&�rr�r)r)r+�imaggszDecimal.imagcCs|Sr(r)r�r)r)r+�	conjugatekszDecimal.conjugatecCstt|��Sr()�complexrtr�r)r)r+�__complex__nszDecimal.__complex__cCsR|j}|j|j}t|�|krJ|t|�|d��d�}t|j||jd�St|�S)NrQT)	r;rE�clamprjrkr9r:rOr)r0r1ZpayloadZmax_payload_lenr)r)r+r<qszDecimal._fix_nancCsX|jr |��r|�|�St|�S|��}|��}|s�|j|g|j}tt	|j
|�|�}||j
krx|�t�t
|jd|�St|�St|j�|j
|j}||kr�|�td|j�}|�t�|�t�|S||k}|r�|}|j
|k�r�t|j�|j
|}	|	dk�rt
|jd|d�}d}	|j|j}
|
||	�}|jd|	��p>d}|dk�r~tt|�d�}t|�|jk�r~|dd�}|d7}||k�r�|�td|j�}nt
|j||�}|�r�|�r�|�t�|�r�|�t�|�r�|�t�|�t�|�s�|�t�|S|�r|�t�|jdk�rP|j
|k�rP|�t�|jd|j
|}
t
|j|
|�St|�S)NrQ�
above Emaxr&r�r.r�)rPr�r<rr��EtoprFr�r�r�rOrhrr9r:rjr;rErrr�_pick_rounding_functionrDrdrUrr
)r0r1r�r��exp_maxZnew_expZexp_minr>Zself_is_subnormalr|Zrounding_method�changedr�r�r)r)r+r�}sn
















zDecimal._fixcCst|j|�rdSdSdS)Nr&r�)�
_all_zerosr;�r0rEr)r)r+�_round_down�szDecimal._round_downcCs|�|�Sr()rrr)r)r+�	_round_up�szDecimal._round_upcCs*|j|dkrdSt|j|�r"dSdSdS)NZ56789r.r&r�)r;r�rr)r)r+�_round_half_up�s
zDecimal._round_half_upcCst|j|�rdS|�|�SdS)Nr���_exact_halfr;rrr)r)r+�_round_half_down�szDecimal._round_half_downcCs8t|j|�r*|dks&|j|ddkr*dS|�|�SdS)Nr&r.�02468r�rrr)r)r+�_round_half_even�s��zDecimal._round_half_evencCs |jr|�|�S|�|�SdSr(�r:rrr)r)r+�_round_ceilings
zDecimal._round_ceilingcCs |js|�|�S|�|�SdSr(r	rr)r)r+�_round_floor
s
zDecimal._round_floorcCs0|r |j|ddkr |�|�S|�|�SdS)Nr.Z05)r;rrr)r)r+�_round_05ups
zDecimal._round_05up)rrrrrrrrcCsb|dk	r2t|t�std��tdd|�}|�|�S|jrR|��rJtd��ntd��t|�	dt
��S)Nz+Second argument to round should be integralr&r��cannot round a NaN�cannot round an infinity)rcrUrvr9�quantizerPr�rpr�r�r)r0r8rVr)r)r+�	__round__&s/


zDecimal.__round__cCs0|jr |��rtd��ntd��t|�dt��S�Nr
rr&)rPr�rpr�rUr�rr�r)r)r+�	__floor__ds

zDecimal.__floor__cCs0|jr |��rtd��ntd��t|�dt��Sr)rPr�rpr�rUr�rr�r)r)r+�__ceil__ss

zDecimal.__ceil__cCst|dd�}t|dd�}|js$|jr�|dkr2t�}|jdkrJ|�td|�S|jdkrb|�td|�S|jdkrr|}nf|jdkr�|}nV|jdkr�|s�|�td�St|j|jA}n*|jdkr�|s�|�td�St|j|jA}n0t|j|jAt	t
|j�t
|j��|j|j�}|�||�S)	NTr�rYr�r8rZzINF * 0 in fmaz0 * INF in fma)
r�rPrrOrhr	r@r:r9rdrUr;r�)r0r�Zthirdr1�productr)r)r+�fma�s<




�
�
�zDecimal.fmacCs�t|�}|tkr|St|�}|tkr(|S|dkr6t�}|��}|��}|��}|sZ|sZ|r�|dkrp|�td|�S|dkr�|�td|�S|dkr�|�td|�S|r�|�|�S|r�|�|�S|�|�S|��r�|��r�|��s�|�td�S|dkr�|�td�S|�s|�td�S|��|j	k�r(|�td�S|�s@|�s@|�td�S|�
��rPd}n|j}tt
|��}t|���}t|���}	|j
|td	|j|�|}t|	j�D]}
t|d	|�}�q�t||	j
|�}t|t|�d�S)
Nr]r�z@pow() 3rd argument not allowed unless all arguments are integersr&zApow() 2nd argument cannot be negative when 3rd argument specifiedzpow() 3rd argument cannot be 0zSinsufficient precision: pow() 3rd argument must not have more than precision digitszXat least one of pow() 1st argument and 2nd argument must be nonzero; 0**0 is not definedr�)r�r�rr�rhr	r<�
_isintegerr�rE�_isevenr:rlrUrm�to_integral_valuer�rV�ranger9rd)r0r��modulor1r�r�Z
modulo_is_nanrB�base�exponent�ir)r)r+�
_power_modulo�s����


�������
zDecimal._power_modulocCs�t|�}|j|j}}|ddkr4|d}|d7}qt|�}|j|j}}|ddkrh|d}|d7}qJ|dk�r||9}|ddkr�|d}|d7}qz|dkr�dS|d|}	|jdkr�|	}	|��r�|jdkr�|jt|�}
t|	|
|d�}nd}tddd||	|�S|jdk�r�|d}|dk�r�||@|k�rBdSt	|�d}
|dd}|t
t|��k�rpdSt|
||�}
t|||�}|
dk�s�|dk�r�dS|
|k�r�dSd	|
}n�|d	k�r�t	|�d
d}
t
d	|
|�\}}|�r�dS|d	dk�r|d	}|
d8}
�q�|dd}|t
t|��k�r6dSt|
||�}
t|||�}|
dk�sf|dk�rjdS|
|k�rxdSd|
}ndS|d|k�r�dS|
|}tdt|�|�S|dk�r�|d|d}}n�|dk�r�t
tt||���|k�r�dSt	|�}|dk�r,t
tt|�|��|k�r,dS|d|}}|d|dk�r\dk�rtnn|d}|d}�q<|d	|d	k�r�dk�r�nn|d	}|d	}�qt|dk�rX|dk�r�||k�r�dSt
||�\}}|dk�r�dSdt	|�|>}t
|||d�\}}||k�r$�q<n||d||}�q�||k�rP|dk�sTdS|}|dk�r|||d
t|�k�r|dS||}||9}|d|k�r�dSt|�}|���r�|jdk�r�|jt|�}
t||
|t
|��}nd}td|d|||�S)Nr�r&r.r�rQ)r]����]�Ar}�r[r]�d)rmrUrVrBrr:rOr�r9�_nbitsrjrd�_decimal_lshift_exactr�rl�	_log10_lb)r0r��p�x�xc�xe�y�yc�yerr�ZzerosZ
last_digitr�Zemaxr�ryr8Zxc_bits�rem�ar�r�Zstr_xcr)r)r+�_power_exacts�:












&&$$


 zDecimal._power_exactcCs4|dk	r|�|||�St|�}|tkr*|S|dkr8t�}|�||�}|rL|S|sd|s`|�td�StSd}|jdkr�|�	�r�|�
�s�d}n|r�|�td�S|��}|s�|jdkr�t|dd�St
|S|��r�|jdkr�t
|St|dd�S|tk�r�|�	��rZ|jdk�rd}n||jk�r"|j}nt|�}|j|}|d|jk�rxd|j}|�t�n|�t�|�t�d|j}t|dd||�S|��}|���r�|jdk|dkk�r�t|dd�St
|Sd}d}	|��|��}
|dk|jdkk�r|
tt|j��k�rHt|d|jd�}n,|��}|
tt|��k�rHt|d|d�}|dk�r�|�||jd�}|dk	�r�|dk�r�td|j|j�}d}	|dk�r8|j}t|�}
|
j|
j}}t|�}|j|j}}|jdk�r�|}d	}t||||||�\}}|d
dtt|��|d�r�q(|d	7}�q�t|t|�|�}|	�r&|�	��s&t|j�|jk�r�|jdt|j�}t|j|jd||j|�}|� �}|�!�t"D]}d|j#|<�q�|�$|�}|�t�|j%t&�r�|�t'�|j%t(�r�|�t(d|j�t't&ttt)fD]}|j%|�r|�|��qn
|�$|�}|S)
Nz0 ** 0r&r.z+x ** y with x negative and y not an integerrQr�FTr[r}r�r�)*rr�r�rr�rhr	�_Oner:rrr�r9r@r�rErUrOrrr��_log10_exp_boundrjrdrFr�r2r;rmrVrB�_dpowerrLrM�_signals�trapsr��flagsr
rrr)r0r�rr1r>Zresult_signZ
multiplierrVZself_adj�exactZboundr�r)r*r+r,r-r.r/�extrar�r�Z
newcontextZ	exceptionr)r)r+�__pow__�s�
�













"�



zDecimal.__pow__cCs"t|�}|tkr|S|j||d�Sr�)r�r�r;r�r)r)r+�__rpow__�	szDecimal.__rpow__cCs�|dkrt�}|jr(|j|d�}|r(|S|�|�}|��r>|S|sPt|jdd�S|j|��g|j	}t
|j�}|j}|j|ddkr�||kr�|d7}|d8}qtt|j|jd|�|�S)NrKrQr&r.)
rrPr�r�r�r9r:rFr�r�rjr;rO)r0r1r>�dupr��endrVr)r)r+�	normalize�	s$


zDecimal.normalizecCs�t|dd�}|dkrt�}|dkr(|j}|js4|jr||�||�}|rH|S|��sX|��r||��rp|��rpt|�S|�td�S|�	�|j
kr�|jks�n|�td�S|s�t|j
d|j
�}|�|�S|��}||jkr�|�td�S||j
d|jk�r|�td�S|�|j
|�}|��|jk�r.|�td�St|j�|jk�rL|�td�S|�rl|��|jk�rl|�t�|j
|j
k�r�||k�r�|�t�|�t�|�|�}|S)	NTr�zquantize with one INFz)target exponent out of bounds in quantizerQz9exponent of quantize result too large for current contextr.z7quantize result has too many digits for current context)r�rrDrPr�r�rrhr	r�rOrFr9r:r�r�rEr�rjr;�Eminr
rr)r0rVrDr1r>r�r)r)r+r�	s`��

����




zDecimal.quantizecCsDt|dd�}|js|jr8|��r(|��p6|��o6|��S|j|jkSr�)r�rPr��is_infiniterOr�r)r)r+�same_quantum%
s	�zDecimal.same_quantumcCs�|jrt|�S|s t|jd|�S|j|krHt|j|jd|j||�St|j�|j|}|dkrzt|jd|d�}d}|j|}|||�}|jd|�p�d}|dkr�tt	|�d�}t|j||�S)NrQr&r�r.)
rPrr9r:rOr;rjr�rdrU)r0rVrDr|Z
this_functionr�r�r)r)r+r�4
s&
�

zDecimal._rescalecCsf|dkrtd��|js|s"t|�S|�|��d||�}|��|��krb|�|��d||�}|S)Nr&z'argument should be at least 1 in _roundr.)rprPrr�r�)r0�placesrDr>r)r)r+�_roundV
s

zDecimal._roundcCs�|jr"|j|d�}|r|St|�S|jdkr4t|�S|sFt|jdd�S|dkrTt�}|dkrb|j}|�d|�}||kr�|�	t
�|�	t�|S)NrKr&rQ)rPr�rrOr9r:rrDr�rhrr�r0rDr1r>r)r)r+�to_integral_exactm
s$



zDecimal.to_integral_exactcCs`|dkrt�}|dkr|j}|jr>|j|d�}|r6|St|�S|jdkrPt|�S|�d|�SdS)NrKr&)rrDrPr�rrOr�rEr)r)r+r�
s
zDecimal.to_integral_valuecCs�|dkrt�}|jrB|j|d�}|r(|S|��rB|jdkrBt|�S|sdt|jd|jd�}|�|�S|jdkrz|�	t
d�S|jd}t|�}|j
d?}|j
d@r�|jd}t|j�d?d}n|j}t|j�dd?}||}|dkr�|d|9}d	}	nt|d|�\}}
|
}	||8}d|}||}||k�r:�qJn||d?}�q"|	�oZ|||k}	|	�r�|dk�rz|d|}n|d|9}||7}n|d
dk�r�|d7}tdt|�|�}|��}|�t�}
|�|�}|
|_|S)NrKr&rQr]r.zsqrt(-x), x > 0r�r%Tr})rrPr�r�r:rr9rOr�rhr	rErmrVrUrjr;r�rd�
_shallow_copy�
_set_roundingrrD)r0r1r>rE�opr��c�lr�r9r�r8r�rDr)r)r+�sqrt�
s^










zDecimal.sqrtcCs�t|dd�}|dkrt�}|js&|jr~|��}|��}|s>|r~|dkrX|dkrX|�|�S|dkrr|dkrr|�|�S|�||�S|�|�}|dkr�|�|�}|dkr�|}n|}|�|�S�NTr�r.r&r��r�rrPr�r�r�r��
compare_total�r0r�r1ZsnZonrJr>r)r)r+r�s&


	
zDecimal.maxcCs�t|dd�}|dkrt�}|js&|jr~|��}|��}|s>|r~|dkrX|dkrX|�|�S|dkrr|dkrr|�|�S|�||�S|�|�}|dkr�|�|�}|dkr�|}n|}|�|�SrMrNrPr)r)r+r�*s&



zDecimal.mincCs8|jr
dS|jdkrdS|j|jd�}|dt|�kS)NFr&TrQ)rPrOr;rj)r0�restr)r)r+rLs
zDecimal._isintegercCs&|r|jdkrdS|jd|jdkS)Nr&Tr�r)rOr;r�r)r)r+rUszDecimal._isevencCs2z|jt|j�dWStk
r,YdSXdS)Nr.r&)rOrjr;rvr�r)r)r+r�[szDecimal.adjustedcCs|Sr(r)r�r)r)r+�	canonicalcszDecimal.canonicalcCs.t|dd�}|�||�}|r |S|j||d�S�NTr�rK)r�r�r�r�r)r)r+�compare_signalks
zDecimal.compare_signalcCs`t|dd�}|jr|jstS|js,|jr,tS|j}|��}|��}|sL|�r||kr�t|j�|jf}t|j�|jf}||kr�|r�tStS||kr�|r�tStStS|r�|dkr�tS|dkr�tS|dkr�tS|dkr�tSn2|dkr�tS|dkr�tS|dkr�tS|dk�rtS||k�rtS||k�r$tS|j|jk�r@|�r<tStS|j|jk�r\|�rXtStStS)NTr�r.r])	r�r:�_NegativeOner3r�rjr;�_ZerorO)r0r�r1rBZself_nanZ	other_nanZself_keyZ	other_keyr)r)r+rOwsf



zDecimal.compare_totalcCs&t|dd�}|��}|��}|�|�Sr�)r�r�rO)r0r�r1r��or)r)r+�compare_total_mag�szDecimal.compare_total_magcCstd|j|j|j�Sr�)r9r;rOrPr�r)r)r+r��szDecimal.copy_abscCs2|jrtd|j|j|j�Std|j|j|j�SdS)Nr&r.)r:r9r;rOrPr�r)r)r+r��szDecimal.copy_negatecCs"t|dd�}t|j|j|j|j�Sr�)r�r9r:r;rOrPr�r)r)r+�	copy_sign�s

�zDecimal.copy_signcCs�|dkrt�}|j|d�}|r"|S|��dkr2tS|s:tS|��dkrNt|�S|j}|��}|jdkr�|t	t
|jdd��kr�tdd|jd�}�n0|jdkr�|t	t
|�
�dd��kr�tdd|�
�d�}n�|jdk�r||k�rtddd|dd|�}n�|jdk�rD||dk�rDtdd|d|d�}n�t|�}|j|j}}|jdk�rl|}d}t||||�\}	}
|	d	d
t	t
|	��|d�r��q�|d7}�qptdt
|	�|
�}|��}|�t�}|�|�}||_|S)NrKr�r.r&r[r�rQrCr}r�)rr�r�rVr3rrEr�r:rjrdrFr9r�rmrUrVrB�_dexprGrHrr�rD)r0r1r>r)�adjrIrJr�r:r�rVrDr)r)r+rV�sH$( "

zDecimal.expcCsdS)NTr)r�r)r)r+�is_canonical'szDecimal.is_canonicalcCs|jSr()rPr�r)r)r+�	is_finite/szDecimal.is_finitecCs
|jdkS)NrZ�rOr�r)r)r+rA7szDecimal.is_infinitecCs
|jdkS)Nr_r^r�r)r)r+r�;szDecimal.is_nancCs*|js
|sdS|dkrt�}|j|��kS�NF)rPrr@r�r�r)r)r+�	is_normal?s

zDecimal.is_normalcCs
|jdkS)Nr8r^r�r)r)r+r�GszDecimal.is_qnancCs
|jdkS�Nr.)r:r�r)r)r+�	is_signedKszDecimal.is_signedcCs
|jdkS)NrYr^r�r)r)r+r�OszDecimal.is_snancCs*|js
|sdS|dkrt�}|��|jkSr_)rPrr�r@r�r)r)r+�is_subnormalSs

zDecimal.is_subnormalcCs|jo|jdkSr�r�r�r)r)r+�is_zero[szDecimal.is_zerocCs�|jt|j�d}|dkr4tt|dd��dS|dkrXttd|dd��dSt|�}|j|j}}|dkr�t|d|�}t|�}t|�t|�||kS|ttd||��dS)Nr.�r�r�r�r&�rOrjr;rdrmrUrV�r0r[rIrJr��numZdenr)r)r+�
_ln_exp_bound_szDecimal._ln_exp_boundc
Cs|dkrt�}|j|d�}|r"|S|s*tS|��dkr:tS|tkrFtS|jdkr\|�t	d�St
|�}|j|j}}|j
}||��d}t|||�}|ddttt|���|dr�q�|d7}q�tt|dk�tt|��|�}|��}|�t�}	|�|�}|	|_|S)	NrKr.zln of a negative valuer]r}r�r[r&)rr��_NegativeInfinityr��	_Infinityr3rVr:rhr	rmrUrVrEri�_dlogrjrdrlr9rGrHrr�rD�
r0r1r>rIrJr�r)rCr�rDr)r)r+�lnxs:
�$


z
Decimal.lncCs�|jt|j�d}|dkr,tt|��dS|dkrHttd|��dSt|�}|j|j}}|dkr�t|d|�}td|�}t|�t|�||kdStd||�}t|�||dkdS)	Nr.r�r�r&r���r]Z231rfrgr)r)r+r4�szDecimal._log10_exp_boundc
CsF|dkrt�}|j|d�}|r"|S|s*tS|��dkr:tS|jdkrP|�td�S|jddkr�|jdd�dt	|j�dkr�t
|jt	|j�d�}n�t|�}|j
|j}}|j}||��d}t|||�}|dd	t	tt|���|dr��q|d
7}q�tt
|dk�tt|��|�}|��}|�t�}	|�|�}|	|_|S)NrKr.zlog10 of a negative valuer&r�rQr]r}r�r[)rr�rjr�rkr:rhr	r;rjrrOrmrUrVrEr4�_dlog10rdrlr9rGrHrr�rDrmr)r)r+�log10�s:
�.$


z
Decimal.log10cCsV|j|d�}|r|S|dkr"t�}|��r.tS|s@|�tdd�St|���}|�|�S)NrKzlogb(0)r.)	r�rr�rkrhr
rr�r�r�r)r)r+�logb�s	zDecimal.logbcCs6|jdks|jdkrdS|jD]}|dkrdSqdS)Nr&FZ01T)r:rOr;)r0�digr)r)r+�
_islogical
s
zDecimal._islogicalcCs�|jt|�}|dkr$d||}n|dkr<||jd�}|jt|�}|dkr`d||}n|dkrx||jd�}||fS)Nr&rQ)rErj)r0r1�opa�opbZdifr)r)r+�
_fill_logical'
szDecimal._fill_logicalcCsz|dkrt�}t|dd�}|��r*|��s4|�t�S|�||j|j�\}}d�dd�t||�D��}t	d|�
d�ptdd�S)NTr�rScSs$g|]\}}tt|�t|�@��qSr)�rdrU��.0r1�br)r)r+�
<listcomp>B
sz'Decimal.logical_and.<locals>.<listcomp>r&rQ�rr�rtrhr	rwr;rr�zipr9rk�r0r�r1rurvr�r)r)r+�logical_and4
s
zDecimal.logical_andcCs(|dkrt�}|�tdd|jd�|�S)Nr&r�)r�logical_xorr9rEr�r)r)r+�logical_invertE
s
�zDecimal.logical_invertcCsz|dkrt�}t|dd�}|��r*|��s4|�t�S|�||j|j�\}}d�dd�t||�D��}t	d|�
d�ptdd�S)NTr�rScSs$g|]\}}tt|�t|�B��qSr)rxryr)r)r+r|Z
sz&Decimal.logical_or.<locals>.<listcomp>r&rQr}rr)r)r+�
logical_orL
s
zDecimal.logical_orcCsz|dkrt�}t|dd�}|��r*|��s4|�t�S|�||j|j�\}}d�dd�t||�D��}t	d|�
d�ptdd�S)NTr�rScSs$g|]\}}tt|�t|�A��qSr)rxryr)r)r+r|k
sz'Decimal.logical_xor.<locals>.<listcomp>r&rQr}rr)r)r+r�]
s
zDecimal.logical_xorcCs�t|dd�}|dkrt�}|js&|jr~|��}|��}|s>|r~|dkrX|dkrX|�|�S|dkrr|dkrr|�|�S|�||�S|���|���}|dkr�|�|�}|dkr�|}n|}|�|�SrM�	r�rrPr�r�r�r�r�rOrPr)r)r+�max_magn
s&


zDecimal.max_magcCs�t|dd�}|dkrt�}|js&|jr~|��}|��}|s>|r~|dkrX|dkrX|�|�S|dkrr|dkrr|�|�S|�||�S|���|���}|dkr�|�|�}|dkr�|}n|}|�|�SrMr�rPr)r)r+�min_mag�
s&


zDecimal.min_magcCs�|dkrt�}|j|d�}|r"|S|��dkr2tS|��dkrTtdd|j|���S|��}|�t	�|�
�|�|�}||kr�|S|�tdd|�
�d�|�S)NrKr�r.r&rCr�)rr�r�rjr9rEr�rLrHr�_ignore_all_flagsr�r�r��r0r1r>Znew_selfr)r)r+�
next_minus�
s$

�zDecimal.next_minuscCs�|dkrt�}|j|d�}|r"|S|��dkr2tS|��dkrTtdd|j|���S|��}|�t	�|�
�|�|�}||kr�|S|�tdd|�
�d�|�S)NrKr.r�rCr&r�)rr�r�rkr9rEr�rLrHrr�r�r�r�r�r)r)r+�	next_plus�
s$

�zDecimal.next_pluscCs�t|dd�}|dkrt�}|�||�}|r.|S|�|�}|dkrJ|�|�S|dkr^|�|�}n
|�|�}|��r�|�t	d|j
�|�t�|�t�nD|�
�|jkr�|�t�|�t�|�t�|�t�|s�|�t�|S)NTr�r&r�z Infinite result from next_toward)r�rr�r�rYr�r�r�rhrr:rrr�r@rr
r)r0r�r1r>Z
comparisonr)r)r+�next_toward�
s6	


�





zDecimal.next_towardcCs�|��rdS|��rdS|��}|dkr,dS|dkr8dS|��rN|jrJdSdS|dkr\t�}|j|d	�rv|jrrd
SdS|jr�dSd
SdS)Nr�r�r.z	+Infinityr�z	-Infinityz-Zeroz+ZerorKz
-Subnormalz
+Subnormalz-Normalz+Normal)r�r�r�rdr:rrc)r0r1�infr)r)r+�number_classs,zDecimal.number_classcCstd�S�Nr�r�r�r)r)r+�radix0sz
Decimal.radixcCs�|dkrt�}t|dd�}|�||�}|r.|S|jdkrB|�t�S|jt|�kr`|jksln|�t�S|��r|t	|�St|�}|j
}|jt|�}|dkr�d||}n|dkr�||d�}||d�|d|�}t|j
|�d�p�d|j�S�NTr�r&rQ�rr�r�rOrhr	rErUr�rr;rjr9r:rk)r0r�r1r>�torot�rotdig�topadZrotatedr)r)r+�rotate4s0

 
�zDecimal.rotatecCs�|dkrt�}t|dd�}|�||�}|r.|S|jdkrB|�t�Sd|j|j}d|j|j}|t|�krz|ks�n|�t�S|�	�r�t
|�St|j|j
|jt|��}|�|�}|S)NTr�r&r�r])rr�r�rOrhr	rFrErUr�rr9r:r;r�)r0r�r1r>ZliminfZlimsupr�r)r)r+�scalebUs"



zDecimal.scalebcCs|dkrt�}t|dd�}|�||�}|r.|S|jdkrB|�t�S|jt|�kr`|jksln|�t�S|��r|t	|�St|�}|j
}|jt|�}|dkr�d||}n|dkr�||d�}|dkr�|d|�}n|d|}||jd�}t|j
|�d��p
d|j�Sr�r�)r0r�r1r>r�r�r�Zshiftedr)r)r+r�ns6

 
�z
Decimal.shiftcCs|jt|�ffSr()�	__class__rdr�r)r)r+�
__reduce__�szDecimal.__reduce__cCst|�tkr|S|�t|��Sr(��typerr�rdr�r)r)r+�__copy__�szDecimal.__copy__cCst|�tkr|S|�t|��Sr(r�)r0Zmemor)r)r+�__deepcopy__�szDecimal.__deepcopy__cCsJ|dkrt�}t||d�}|jrXt|j|�}t|���}|ddkrL|d7}t|||�S|ddkrvddg|j|d<|ddkr�t	|j|j
|jd�}|j}|d}|dk	�r|ddkr�|�
|d	|�}nF|dd
kr�|�||�}n*|ddk�rt|j
�|k�r|�
||�}|�s@|jdk�r@|dd
k�r@|�d|�}|jt|j
�}	|ddk�r~|�sx|dk	�rxd	|}
nd	}
nB|dd
k�r�|	}
n.|ddk�r�|jdk�r�|	d
k�r�|	}
nd	}
|
dk�r�d}d|
|j
}nP|
t|j
�k�r|j
d|
t|j
�}d}n"|j
d|
��p d}|j
|
d�}|	|
}
t|j|||
|�S)N)�_localeconvr��%�g�Gr]�	precision�eEr.zfF%ZgGr&r�rQrS)r�_parse_format_specifierrP�_format_signr:rdr��
_format_alignr�r9r;rOrDrDr�rj�_format_number)r0Z	specifierr1r��specrB�bodyrDr�r�r�rzr{rVr)r)r+�
__format__�sZ
 

zDecimal.__format__)rQN)NN)N)N)N)N)N)N)FN)N)N)N)TN)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)NN)N)N)NN)N)NN)NN)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)NN)�r4r5r6�	__slots__rb�classmethodrur�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��__radd__r�r�r��__rmul__r�r�r�r�r�r�r�r�r�r�r�r��	__trunc__�propertyr�r�r�r�r<r�rrrrrr
rr�dictr�rrrrrr2r;r<r?rrBr�rDrFr�to_integralrLr�r�rrr�rRrTrOrXr�r�rYrVr\r]rAr�r`r�rbr�rcrdrirnr4rqrrrtrwr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r)r)r)r+rs

,
 !@

	
	
	
	
2
4
	



V
7;!$K



f	�>,UnY="c*"	IK23
.*!'FcCs&t�t�}||_||_||_||_|Sr()rarbrr:r;rOrP)rBZcoefficientrZspecialr0r)r)r+r9�s
r9c@s$eZdZdd�Zdd�Zdd�ZdS)rNcCs|��|_dSr()rL�new_context)r0r�r)r)r+�__init__sz_ContextManager.__init__cCst�|_t|j�|jSr()r�
saved_contextrr�r�r)r)r+�	__enter__s
z_ContextManager.__enter__cCst|j�dSr()rr�)r0�t�v�tbr)r)r+�__exit__sz_ContextManager.__exit__N)r4r5r6r�r�r�r)r)r)r+rNsrNc	@s�eZdZd�dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
e
Zd�dd�Zdd�Zdd�Zdd�ZdZd d!�Zd"d#�Zd$d%�Zd�d'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Z d;d<�Z!d=d>�Z"d?d@�Z#dAdB�Z$dCdD�Z%dEdF�Z&dGdH�Z'dIdJ�Z(dKdL�Z)dMdN�Z*dOdP�Z+dQdR�Z,dSdT�Z-dUdV�Z.dWdX�Z/dYdZ�Z0d[d\�Z1d]d^�Z2d_d`�Z3dadb�Z4dcdd�Z5dedf�Z6dgdh�Z7didj�Z8dkdl�Z9dmdn�Z:dodp�Z;dqdr�Z<dsdt�Z=dudv�Z>dwdx�Z?dydz�Z@d{d|�ZAd}d~�ZBdd��ZCd�d��ZDd�d��ZEd�d��ZFd�d�d��ZGd�d��ZHd�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOd�d��ZPd�d��ZQd�d��ZRd�d��ZSd�d��ZTd�d��ZUeUZVdS)�rNc
s>zt}
Wntk
rYnX|dk	r*|n|
j|_|dk	r>|n|
j|_|dk	rR|n|
j|_|dk	rf|n|
j|_|dk	rz|n|
j|_|dk	r�|n|
j|_|	dkr�g|_n|	|_�dkr�|
j	�
�|_	n.t�t�s�t�fdd�t
�D��|_	n�|_	�dk�r
t�t
d�|_n0t�t��s4t�fdd�t
�D��|_n�|_dS)Nc3s|]}|t|�k�fVqdSr(�rU�rzr��r7r)r+�	<genexpr>Isz#Context.__init__.<locals>.<genexpr>r&c3s|]}|t|�k�fVqdSr(r�r��r8r)r+r�Ps)r�	NameErrorrErDr@rFr�r��_ignored_flagsr7rLrcr�r6�fromkeysr8)r0rErDr@rFr�r�r8r7r�Zdcr))r8r7r+r�0s.

zContext.__init__cCs�t|t�std|��|dkr<||kr�td||||f��nJ|dkrb||kr�td||||f��n$||ksr||kr�td||||f��t�|||�S)Nz%s must be an integer�-infz%s must be in [%s, %d]. got: %sr�z%s must be in [%d, %s]. got: %sz%s must be in [%d, %d]. got %s)rcrUrvrpra�__setattr__)r0�namerxZvminZvmaxr)r)r+�_set_integer_checkTs
zContext._set_integer_checkcCs`t|t�std|��|D]}|tkrtd|��qtD]}||kr8td|��q8t�|||�S)Nz%s must be a signal dictz%s is not a valid signal dict)rcr�rvr6�KeyErrorrar�)r0r�r��keyr)r)r+�_set_signal_dictbs
zContext._set_signal_dictcCs�|dkr|�||dd�S|dkr0|�||dd�S|dkrH|�||dd�S|dkr`|�||dd�S|d	krx|�||dd�S|d
kr�|tkr�td|��t�|||�S|dks�|d
kr�|�||�S|dkr�t�|||�Std|��dS)NrEr.r�r@r�r&rFr�r�rDz%s: invalid rounding moder8r7r�z.'decimal.Context' object has no attribute '%s')r��_rounding_modesrvrar�r��AttributeError)r0r�rxr)r)r+r�ms*�zContext.__setattr__cCstd|��dS)Nz%s cannot be deleted)r�)r0r�r)r)r+�__delattr__�szContext.__delattr__c	CsNdd�|j��D�}dd�|j��D�}|j|j|j|j|j|j|j	||ffS)NcSsg|]\}}|r|�qSr)r)�rzZsigr�r)r)r+r|�sz&Context.__reduce__.<locals>.<listcomp>cSsg|]\}}|r|�qSr)r)r�r)r)r+r|�s)
r8�itemsr7r�rErDr@rFr�r�)r0r8r7r)r)r+r��s��zContext.__reduce__cCs|g}|�dt|��dd�|j��D�}|�dd�|�d�dd�|j��D�}|�dd�|�d�d�|�d	S)
NzrContext(prec=%(prec)d, rounding=%(rounding)s, Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d, clamp=%(clamp)dcSsg|]\}}|r|j�qSr)�r4)rzr�r�r)r)r+r|�sz$Context.__repr__.<locals>.<listcomp>zflags=[z, �]cSsg|]\}}|r|j�qSr)r�)rzr�r�r)r)r+r|�sztraps=[�))rq�varsr8r�rrr7)r0r��namesr)r)r+r��s�zContext.__repr__cCs|jD]}d|j|<qdSr�r��r0�flagr)r)r+rM�s
zContext.clear_flagscCs|jD]}d|j|<qdSr�r�r�r)r)r+�clear_traps�s
zContext.clear_trapsc
Cs.t|j|j|j|j|j|j|j|j|j	�	}|Sr()
rrErDr@rFr�r�r8r7r��r0Zncr)r)r+rG�s�zContext._shallow_copyc
Cs6t|j|j|j|j|j|j|j��|j	��|j
�	}|Sr()rrErDr@rFr�r�r8rLr7r�r�r)r)r+rL�s�zContext.copycGsZt�||�}||jkr(|�j|f|��Sd|j|<|j|sN|�j|f|��S||��dSra)�_condition_maprHr�r2r8r7)r0Z	conditionZexplanationr*�errorr)r)r+rh�s


zContext._raise_errorcCs
|jt�Sr()�
_ignore_flagsr6r�r)r)r+r��szContext._ignore_all_flagscGs|jt|�|_t|�Sr()r�rn)r0r8r)r)r+r��szContext._ignore_flagscGs8|rt|dttf�r|d}|D]}|j�|�q"dSr�)rcrornr��remove)r0r8r�r)r)r+�
_regard_flags�szContext._regard_flagscCst|j|jd�Sra)rUr@rEr�r)r)r+r��sz
Context.EtinycCst|j|jd�Sra)rUrFrEr�r)r)r+r��szContext.EtopcCs|j}||_|Sr()rD)r0r�rDr)r)r+rH�szContext._set_roundingrQcCsjt|t�r*||��ksd|kr*|�td�St||d�}|��r`t|j�|j	|j
kr`|�td�S|�|�S)NrRzAtrailing or leading whitespace and underscores are not permitted.rKzdiagnostic info too long in NaN)rcrdrfrhrrr�rjr;rEr�r�)r0rhr�r)r)r+�create_decimal�s��zContext.create_decimalcCst�|�}|�|�Sr()rrur�)r0r�r�r)r)r+�create_decimal_from_floats
z!Context.create_decimal_from_floatcCst|dd�}|j|d�SrS)r�r��r0r1r)r)r+rl!szContext.abscCs8t|dd�}|j||d�}|tkr0td|��n|SdS�NTr�rK�Unable to convert %s to Decimal)r�r�r�rv�r0r1r{r�r)r)r+�add6s
zContext.addcCst|�|��Sr()rdr�r�r)r)r+�_applyKszContext._applycCst|t�std��|��S)Nz,canonical requires a Decimal as an argument.)rcrrvrRr�r)r)r+rRNs	
zContext.canonicalcCst|dd�}|j||d�SrS)r�r��r0r1r{r)r)r+r�[s!zContext.comparecCst|dd�}|j||d�SrS)r�rTr�r)r)r+rTs zContext.compare_signalcCst|dd�}|�|�Sr�)r�rOr�r)r)r+rO�szContext.compare_totalcCst|dd�}|�|�Sr�)r�rXr�r)r)r+rX�szContext.compare_total_magcCst|dd�}|��Sr�)r�r�r�r)r)r+r��s
zContext.copy_abscCst|dd�}t|�Sr�)r�rr�r)r)r+�copy_decimal�s
zContext.copy_decimalcCst|dd�}|��Sr�)r�r�r�r)r)r+r��s
zContext.copy_negatecCst|dd�}|�|�Sr�)r�rYr�r)r)r+rY�szContext.copy_signcCs8t|dd�}|j||d�}|tkr0td|��n|SdSr�)r�r�r�rvr�r)r)r+�divides
zContext.dividecCs8t|dd�}|j||d�}|tkr0td|��n|SdSr�)r�r�r�rvr�r)r)r+�
divide_int+s
zContext.divide_intcCs8t|dd�}|j||d�}|tkr0td|��n|SdSr�)r�r�r�rvr�r)r)r+r�Bs
zContext.divmodcCst|dd�}|j|d�SrS)r�rVr�r)r)r+rVWszContext.expcCst|dd�}|j|||d�SrS)r�r)r0r1r{rJr)r)r+roszContext.fmacCst|t�std��|��S)Nz/is_canonical requires a Decimal as an argument.)rcrrvr\r�r)r)r+r\�s	
zContext.is_canonicalcCst|dd�}|��Sr�)r�r]r�r)r)r+r]�szContext.is_finitecCst|dd�}|��Sr�)r�rAr�r)r)r+rA�szContext.is_infinitecCst|dd�}|��Sr�)r�r�r�r)r)r+r��s
zContext.is_nancCst|dd�}|j|d�SrS)r�r`r�r)r)r+r`�szContext.is_normalcCst|dd�}|��Sr�)r�r�r�r)r)r+r��szContext.is_qnancCst|dd�}|��Sr�)r�rbr�r)r)r+rb�szContext.is_signedcCst|dd�}|��Sr�)r�r�r�r)r)r+r��s
zContext.is_snancCst|dd�}|j|d�SrS)r�rcr�r)r)r+rcszContext.is_subnormalcCst|dd�}|��Sr�)r�rdr�r)r)r+rd%szContext.is_zerocCst|dd�}|j|d�SrS)r�rnr�r)r)r+rn6sz
Context.lncCst|dd�}|j|d�SrS)r�rqr�r)r)r+rqLsz
Context.log10cCst|dd�}|j|d�SrS)r�rrr�r)r)r+rrhszContext.logbcCst|dd�}|j||d�SrS)r�r�r�r)r)r+r��szContext.logical_andcCst|dd�}|j|d�SrS)r�r�r�r)r)r+r��szContext.logical_invertcCst|dd�}|j||d�SrS)r�r�r�r)r)r+r��szContext.logical_orcCst|dd�}|j||d�SrS)r�r�r�r)r)r+r��szContext.logical_xorcCst|dd�}|j||d�SrS)r�r�r�r)r)r+r��szContext.maxcCst|dd�}|j||d�SrS)r�r�r�r)r)r+r�szContext.max_magcCst|dd�}|j||d�SrS)r�r�r�r)r)r+r�szContext.mincCst|dd�}|j||d�SrS)r�r�r�r)r)r+r�-szContext.min_magcCst|dd�}|j|d�SrS)r�r�r�r)r)r+�minus>sz
Context.minuscCs8t|dd�}|j||d�}|tkr0td|��n|SdSr�)r�r�r�rvr�r)r)r+�multiplyOs
zContext.multiplycCst|dd�}|j|d�SrS)r�r�r�r)r)r+r�oszContext.next_minuscCst|dd�}|j|d�SrS)r�r�r�r)r)r+r��szContext.next_pluscCst|dd�}|j||d�SrS)r�r�r�r)r)r+r��s zContext.next_towardcCst|dd�}|j|d�SrS)r�r?r�r)r)r+r?�szContext.normalizecCst|dd�}|j|d�SrS)r�r�r�r)r)r+r��s/zContext.number_classcCst|dd�}|j|d�SrS)r�r�r�r)r)r+�plusszContext.pluscCs:t|dd�}|j|||d�}|tkr2td|��n|SdSr�)r�r;r�rv)r0r1r{rr�r)r)r+�powers
Iz
Context.powercCst|dd�}|j||d�SrS)r�rr�r)r)r+res7zContext.quantizecCstd�Sr�r�r�r)r)r+r��sz
Context.radixcCs8t|dd�}|j||d�}|tkr0td|��n|SdSr�)r�r�r�rvr�r)r)r+r��s
zContext.remaindercCst|dd�}|j||d�SrS)r�r�r�r)r)r+r��szContext.remainder_nearcCst|dd�}|j||d�SrS)r�r�r�r)r)r+r��szContext.rotatecCst|dd�}|�|�Sr�)r�rBr�r)r)r+rBszContext.same_quantumcCst|dd�}|j||d�SrS)r�r�r�r)r)r+r�$szContext.scalebcCst|dd�}|j||d�SrS)r�r�r�r)r)r+r�7sz
Context.shiftcCst|dd�}|j|d�SrS)r�rLr�r)r)r+rLUszContext.sqrtcCs8t|dd�}|j||d�}|tkr0td|��n|SdSr�)r�r�r�rvr�r)r)r+�subtractus
zContext.subtractcCst|dd�}|j|d�SrS)r�r�r�r)r)r+r��szContext.to_eng_stringcCst|dd�}|j|d�SrS)r�r�r�r)r)r+�
to_sci_string�szContext.to_sci_stringcCst|dd�}|j|d�SrS)r�rFr�r)r)r+rF�szContext.to_integral_exactcCst|dd�}|j|d�SrS)r�rr�r)r)r+r�szContext.to_integral_value)	NNNNNNNNN)N)rQ)N)Wr4r5r6r�r�r�r�r�r�r�rMr�rGrLr�rhr�r�r�r�r�r�rHr�r�rlr�r�rRr�rTrOrXr�r�r�rYr�r�r�rVrr\r]rAr�r`r�rbr�rcrdrnrqrrr�r�r�r�r�r�r�r�r�r�r�r�r�r?r�r�r�rr�r�r�r�rBr�r�rLr�r�r�rFrr�r)r)r)r+rs��
$



$#


%
 #2
P:&" c@s"eZdZdZddd�Zdd�ZdS)rm�rBrUrVNcCsf|dkrd|_d|_d|_nFt|t�rD|j|_t|j�|_|j|_n|d|_|d|_|d|_dS)Nr&r.r])rBrUrVrcrr:r;rO)r0rxr)r)r+r��s



z_WorkRep.__init__cCsd|j|j|jfS)Nz(%r, %r, %r)r�r�r)r)r+r�sz_WorkRep.__repr__)N)r4r5r6r�r�r�r)r)r)r+rm�s
rmcCs�|j|jkr|}|}n|}|}tt|j��}tt|j��}|jtd||d�}||jd|krpd|_||_|jd|j|j9_|j|_||fS)Nr�r]r.r�)rVrjrdrUr�)r�r�rEZtmpr�Ztmp_lenZ	other_lenrVr)r)r+r�sr�cCsb|dkrdS|dkr |d|Stt|��}t|�t|�d��}||krPdS|d|SdS)Nr&r�rQ)rdrlrj�rstrip)r8r�Zstr_nZval_nr)r)r+r'(sr'cCsB|dks|dkrtd��d}||kr>||||d?}}q|S)Nr&z3Both arguments to _sqrt_nearest should be positive.r.)rp)r8r1r{r)r)r+�
_sqrt_nearest=sr�cCs2d|>||?}}|d||d@|d@|kS)Nr.r]r))r*r�r{r�r)r)r+�_rshift_nearestLsr�cCs&t||�\}}|d||d@|kS)Nr]r.)r�)r1r{r�r�r)r)r+�_div_nearestTsr�r!c		Cs�||}d}||kr(t|�||>|ksD||krxt|�||?|krxt||d>|t||t||�|��}|d7}qtdtt|��d|�}t||�}t||�}t|ddd�D]}t||�t|||�}q�t|||�S)Nr&r.���r[r�)rlr�r�r�rUrjrdr)	r*�M�Lr-�R�TZyshift�wr�r)r)r+�_ilog\s"���


r�c
Cs�|d7}tt|��}||||dk}|dkr�d|}|||}|dkrZ|d|9}nt|d|�}t||�}t|�}t|||�}||}	nd}t|d|�}	t|	|d�S�Nr]r.r&r�r%)rjrdr�r��
_log10_digits)
rJr�r)rKr�r�r��log_dZlog_10Zlog_tenpowerr)r)r+rp�s 

rpc	Cs�|d7}tt|��}||||dk}|dkrr|||}|dkrR|d|9}nt|d|�}t|d|�}nd}|r�ttt|���d}||dkr�t|t||�d|�}q�d}nd}t||d�Sr�)rjrdr�r�rlr�)	rJr�r)rKr�r�r�r:Z	f_log_tenr)r)r+rl�s"rlc@seZdZdd�Zdd�ZdS)�
_Log10MemoizecCs
d|_dS)NZ/23025850929940456840179914546843642076011014886)r|r�r)r)r+r��sz_Log10Memoize.__init__cCs�|dkrtd��|t|j�kr�d}d||d}tttd||�d��}||d�d|krbql|d7}q"|�d�dd�|_t|jd|d	��S)
Nr&zp should be nonnegativer[r�r]r%rQr�r.)rprjr|rdr�r�r�rU)r0r)r:r�r|r)r)r+�	getdigits�s	
z_Log10Memoize.getdigitsN)r4r5r6r�r�r)r)r)r+r��sr�c	Cs�t||>|�}tdtt|��d|�}t||�}||>}t|ddd�D]}t|||||�}qPt|ddd�D]"}||d>}t||||�}q|||S)Nr�r[r.r&r�r])r&rUrjrdr�r)	r*r�r�r�r�r-ZMshiftrr�r)r)r+�_iexp�s
r�c	Cs�|d7}td|tt|��d�}||}||}|dkrH|d|}n|d|}t|t|��\}}t|d|�}tt|d|�d�||dfS)Nr]r&r.r�i�r[)r�rjrdr�r�r�r�)	rJr�r)r:r�r�ZcshiftZquotr0r)r)r+rZ$srZcCs�ttt|���|}t||||d�}||}|dkrJ||d|}nt||d|�}|dkr�tt|��|dk|dkkr�d|ddd|}	}
q�d|d|}	}
n,t||d|d�\}	}
t|	d�}	|
d7}
|	|
fS)Nr.r&r�)rjrdrlrlr�rZ)r+r,r.r/r)r{Zlxcr�Zpcr�rVr)r)r+r5Hs
r5r%�F�5�(�re�r�r})	r��2�3�4�5�6�7�8rCcCs0|dkrtd��t|�}dt|�||dS)Nr&z0The argument to _log10_lb should be nonnegative.r%)rprdrj)rJZ
correctionZstr_cr)r)r+r(rsr(cCsLt|t�r|St|t�r t|�S|r8t|t�r8t�|�S|rHtd|��tS)Nr�)rcrrUrtrurvr�)r�r�Zallow_floatr)r)r+r�}s


r�cCs�t|t�r||fSt|tj�rR|jsDt|jtt|j	�|j
�|j�}|t|j�fS|rrt|tj
�rr|jdkrr|j}t|t�r�t�}|r�d|jt<n|�td�|t�|�fSttfS)Nr&r.r`)rcr�_numbersZRationalrPr9r:rdrUr;�denominatorrO�	numeratorZComplexr�r�rtrr8rrhrur�)r0r�r�r1r)r)r+r��s(
�
�r�r$i?Bi���)rErDr7r8rFr@r�r�r^)rErDr7r8a�        # A numeric string consists of:
#    \s*
    (?P<sign>[-+])?              # an optional sign, followed by either...
    (
        (?=\d|\.\d)              # ...a number (with at least one digit)
        (?P<int>\d*)             # having a (possibly empty) integer part
        (\.(?P<frac>\d*))?       # followed by an optional fractional part
        (E(?P<exp>[-+]?\d+))?    # followed by an optional exponent, or...
    |
        Inf(inity)?              # ...an infinity, or...
    |
        (?P<signal>s)?           # ...an (optionally signaling)
        NaN                      # NaN
        (?P<diag>\d*)            # with (possibly empty) diagnostic info.
    )
#    \s*
    \Z
z0*$z50*$z�\A
(?:
   (?P<fill>.)?
   (?P<align>[<>=^])
)?
(?P<sign>[-+ ])?
(?P<alt>\#)?
(?P<zeropad>0)?
(?P<minimumwidth>(?!0)\d+)?
(?P<thousands_sep>,)?
(?:\.(?P<precision>0|(?!0)\d+))?
(?P<type>[eEfFgGn%])?
\Z
cCs�t�|�}|dkrtd|��|��}|d}|d}|ddk	|d<|drv|dk	rbtd|��|dk	rvtd|��|p|d|d<|p�d|d<|d	dkr�d
|d	<t|dp�d�|d<|d
dk	r�t|d
�|d
<|d
dkr�|ddks�|ddkr�d|d
<|ddk�rfd|d<|dk�r&t��}|ddk	�r@td|��|d|d<|d|d<|d|d<n*|ddk�r|d|d<ddg|d<d|d<|S)NzInvalid format specifier: �fill�align�zeropadz7Fill character conflicts with '0' in format specifier: z2Alignment conflicts with '0' in format specifier: � �>rBrT�minimumwidthrQr�r&r�ZgGnr.r8r��
thousands_sepzJExplicit thousands separator conflicts with 'n' type in format specifier: �grouping�
decimal_pointrSr[r�)�_parse_format_specifier_regex�matchrp�	groupdictrU�_locale�
localeconv)�format_specr�ryZformat_dictrrr)r)r+r�sT
��
�r�c	Cs�|d}|d}||t|�t|�}|d}|dkrF|||}nj|dkr\|||}nT|dkrr|||}n>|dkr�t|�d}|d|�||||d�}ntd	��|S)
Nrrr�<r�=�^r]zUnrecognised alignment field)rjrp)	rBr�r�rrZpaddingrr�Zhalfr)r)r+r�ms"r�cCspddlm}m}|sgS|ddkrJt|�dkrJ||dd�||d��S|dtjkrd|dd�Std��dS)Nr&)�chain�repeatr�r]r�z unrecognised format for grouping)�	itertoolsr!r"rjr�CHAR_MAXrp)rr!r"r)r)r+�_group_lengths�s
r%cCs�|d}|d}g}t|�D]�}|dkr0td��ttt|�|d�|�}|�d|t|�||d��|d|�}||8}|s�|dkr�q�|t|�8}qtt|�|d�}|�d|t|�||d��|�t|��S)Nrrr&zgroup length should be positiver.rQ)r%rpr�r�rjrqrr�reversed)r|r��	min_width�sepr�groupsrKr)r)r+�_insert_thousands_sep�s $$r*cCs$|rdS|ddkr|dSdSdS)NrTrBz +rSr))�is_negativer�r)r)r+r��s
r�cCs�t||�}|s|dr"|d|}|dks6|ddkr\ddddd�|d}|d	�||�7}|dd
krp|d
7}|dr�|dt|�t|�}nd}t|||�}t||||�S)
NZaltrr&r�r�r�r�)r�r�r�r�z{0}{1:+}r�rr)r��formatrjr*r�)r+rzr{rVr�rBZecharr'r)r)r+r��s
r�ZInfz-Infr�r�r])N)F)r&)r!)r!)FF)F)N)r.)y�__all__r4Z	__xname__�__version__Z__libmpdec_version__Zmathr~Znumbersr�sys�collectionsr'Z_namedtupler�ImportErrorrrrrrrrrr$r%�maxsizer r!r"r#�ArithmeticErrorrrr	r�ZeroDivisionErrorr
rrrrrr
rrrvrr6r�r�ZcontextvarsZ
ContextVarrGrrrrarr9�Number�registerrNrrmr�rUr�r&r'r�r�r�r�rprlr�r�r�r�rZr5r(r�r�rrr�re�compile�VERBOSE�
IGNORECASErrer�r�DOTALLrZlocalerr�r�r%r*r�r�rkrjr=rVr3rUr@�	hash_info�modulusr�r�r�r�r�r�r�r)r)r)r+�<module>us��#

&
���

.
^

0",#
%$+�

*���
�
�
P
%
)_osx_support.cpython-38.opt-1.pyc000064400000026513150335716500012713 0ustar00U

e5dU�@s�dZddlZddlZddlZddddgZdZdZd	Zd-d
d�Zd.d
d�Z	dd�Z
dadd�Zda
dd�Zdd�Zdd�Zdadd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d�Zd*d�Zd+d�Zd,d�ZdS)/zShared OS X support functions.�N�compiler_fixup�customize_config_vars�customize_compiler�get_platform_osx)
�CFLAGSZLDFLAGSZCPPFLAGSZ
BASECFLAGS�	BLDSHARED�LDSHARED�CC�CXXZ	PY_CFLAGSZ
PY_LDFLAGSZPY_CPPFLAGSZPY_CORE_CFLAGSZPY_CORE_LDFLAGS)rrr	r
Z_OSX_SUPPORT_INITIAL_cCs�|dkrtjd}|�tj�}tj�|�\}}tjdkrH|dkrH|d}tj�|�s�|D]&}tj�	||�}tj�|�rX|SqXdS|SdS)z�Tries to find 'executable' in the directories listed in 'path'.

    A string listing directories separated by 'os.pathsep'; defaults to
    os.environ['PATH'].  Returns the complete filename or None if not found.
    N�PATHZwin32z.exe)
�os�environ�split�pathsep�path�splitext�sys�platform�isfile�join)�
executabler�paths�baseZext�p�f�r�$/usr/lib64/python3.8/_osx_support.py�_find_executables

rFc
Cs�ddl}zddl}|��}Wn(tk
rDtdt��fd�}YnX|�|��P}|rfd||jf}nd||jf}t�	|�s�|�
��d���ndW5QR�SQRXdS)z0Output from successful command execution or NonerNz/tmp/_osx_support.%szw+bz
%s >'%s' 2>&1z%s 2>/dev/null >'%s'zutf-8)
�
contextlib�tempfileZNamedTemporaryFile�ImportError�openr�getpid�closing�name�system�read�decode�strip)Z
commandstringZcapture_stderrrr�fp�cmdrrr�_read_output7s��
r+cCst|�ptd|f�pdS)z0Find a build tool on current path or using xcrunz/usr/bin/xcrun -find %s�)rr+)Ztoolnamerrr�_find_build_toolMs
��r-cCsxtdkrtdaztd�}Wntk
r,YnHXzt�d|���}W5|��X|dk	rtd�|�d��	d�dd��atS)z*Return the OS X system version as a stringNr,z0/System/Library/CoreServices/SystemVersion.plistz=<key>ProductUserVisibleVersion</key>\s*<string>(.*?)</string>�.��)
�_SYSTEM_VERSIONr!�OSError�close�re�searchr&r�groupr)r�mrrr�_get_system_versionVs
�
r8cCsLtdkrHt�}|rHztdd�|�d�D��aWntk
rFdaYnXtS)z}
    Return the macOS system version as a tuple

    The return value is safe to use to compare
    two version numbers.
    Ncss|]}t|�VqdS�N��int��.0�irrr�	<genexpr>�sz,_get_system_version_tuple.<locals>.<genexpr>r.r)�_SYSTEM_VERSION_TUPLEr8�tupler�
ValueError�Zosx_versionrrr�_get_system_version_tupleus
rDcCs"t|�D]}|�t�r||=qdS)z-Remove original unmodified values for testingN)�list�
startswith�_INITPRE)�_config_vars�krrr�_remove_original_values�s
rJcCs8|�|d�}||kr,t||kr,||t|<|||<dS)z@Save modified and original unmodified value of configuration varr,N)�getrG)rH�cvZnewvalueZoldvaluerrr�_save_modified_value�srMcCs�tdk	rtStd|fd�}d}|��D]T}|�d�r<d}q(|�d�rLd}q(|r(|��}|dkrfdaq(|�d	�r(|dd
�aq(tdkr�datS)z= Returns the root of the default SDK for this system, or '/' Nz%s -c -E -v - </dev/nullTFz#include <...>zEnd of search listz/usr/include�/z.sdk/usr/includei�)�_cache_default_sysrootr+�
splitlinesrFr(�endswith)�cc�contentsZ
in_incdirs�linerrr�_default_sysroot�s$


rUcCst�}|rt|dk�SdS)z=Returns True if universal builds are supported on this system��
�F)rD�boolrCrrr�_supports_universal_builds�srZcCst�}|r|dkSdS)z9Returns True if arm64 builds are supported on this system)�rF)rDrCrrr�_supports_arm64_builds�sr\cCs�dtjkr|S|d��d}}t|�s4td�}n<tj�|��d�rptd|�	dd�f�}|rpd|krptd�}|s|t
d	��||kr�tD]L}||kr�|tjkr�||��}|d
kr�|n|d|d<t||d�
|��q�|S)
z7Find appropriate C compiler for extension module buildsr	rZclangZgccz'%s' --version�'�'"'"'zllvm-gcczCannot locate working compilerr
z++� )rr
rrr-r�basenamerFr+�replace�SystemError�_COMPILER_CONFIG_VARSrMr)rHrRZoldcc�datarLZcv_splitrrr�_find_appropriate_compiler�s,

��recCsVtD]L}||kr|tjkr||}tjdd|tjd�}t�dd|�}t|||�q|S)z5Remove all universal build arguments from config vars�
-arch\s+\w+\sr_)�flagsz-isysroot\s*\S+)�_UNIVERSAL_CONFIG_VARSrr
r4�sub�ASCIIrM)rHrLrgrrr�_remove_universal_flagssrkcCs�dtjkr|St�d|d�dk	r�t�d|d�dd�f�}|r�tD]8}||krF|tjkrF||}t�dd	|�}t|||�qF|S)
z-Remove any unsupported archs from config varsr	z-arch\s+ppcrNzNecho 'int main{};' | '%s' -c -arch ppc -x c -o /dev/null /dev/null 2>/dev/nullr]r^z-arch\s+ppc\w*\sr_)	rr
r4r5r%rarhrirM)rHZstatusrLrgrrr�_remove_unsupported_archss
��	rlcCsddtjkr`tjd}tD]F}||krd||kr||}t�dd|�}|d|}t|||�q|S)z2Allow override of all archs with ARCHFLAGS env var�	ARCHFLAGS�-archrfr_)rr
rhr4rirM)rHZarchrLrgrrr�_override_all_archs:s

rocCsx|�dd�}t�d|�}|dk	rt|�d�}tj�|�sttD]8}||kr:|tjkr:||}t�	dd|�}t
|||�q:|S)z+Remove references to any SDKs not availablerr,z-isysroot\s*(\S+)Nr/z-isysroot\s*\S+(?:\s|$)r_)rKr4r5r6rr�existsrhr
rirM)rH�cflagsr7ZsdkrLrgrrr�_check_for_unavailable_sdkKs
rrc
Cs�d}}t|�}t�s d}}nd|k}tdd�|D��}|sHdtjkr�z|�d�}|||d�=WqHtk
r|Yq�YqHXqHnFt�s�tt	t
|���D].}||dkr�||dd	kr�|||d�=q�dtjkr�|s�|tjd��}|�r@d
d�t|�D�}|�s
�q@|d}||d
k�r0|||d�=q�|||d�=q�d}|}dd�t|�D�}|�sv|}dd�t|�D�}|D]B}||d
k�r�||d}�q�n||t
d
�d�}�q��qz|�r�tj
�|��s�ddlm}	|	�d|�|	�d�|S)ae
    This function will strip '-isysroot PATH' and '-arch ARCH' from the
    compile flags if the user has specified one them in extra_compile_flags.

    This is needed because '-arch ARCH' adds another architecture to the
    build, without a way to remove an architecture. Furthermore GCC will
    barf if multiple '-isysroot' arguments are present.
    FTrncss|]}|�d�r|VqdS)�	-isysrootN�rF)r=�argrrrr?ys
z!compiler_fixup.<locals>.<genexpr>rmr0r/�arm64cSsg|]\}}|�d�r|�qS�rsrt�r=r>�xrrr�
<listcomp>�s
z"compiler_fixup.<locals>.<listcomp>rrsNcSsg|]\}}|�d�r|�qSrwrtrxrrrrz�s
cSsg|]\}}|�d�r|�qSrwrtrxrrrrz�s
)�logz4Compiling with an SDK that doesn't seem to exist: %sz$Please check your Xcode installation)rErZ�anyrr
�indexrBr\�reversed�range�lenr�	enumerater�isdirZ	distutilsr{�warn)
Zcompiler_soZcc_argsZ	stripArchZstripSysrootr}�idx�indicesZsysrootZargvarr{rrrrfsZ	


�
cCs"t�st|�t|�t|�|S)a�Customize Python build configuration variables.

    Called internally from sysconfig with a mutable mapping
    containing name/value pairs parsed from the configured
    makefile used to build this interpreter.  Returns
    the mapping updated as needed to reflect the environment
    in which the interpreter is running; in the case of
    a Python from a binary installer, the installed
    environment may be very different from the build
    environment, i.e. different OS levels, different
    built tools, different available CPU architectures.

    This customization is performed whenever
    distutils.sysconfig.get_config_vars() is first
    called.  It may be used in environments where no
    compilers are present, i.e. when installing pure
    Python dists.  Customization of compiler paths
    and detection of unavailable archs is deferred
    until the first extension module build is
    requested (in distutils.sysconfig.customize_compiler).

    Currently called from distutils.sysconfig
    )rZrkrorr�rHrrrr�s
cCst|�t|�t|�|S)z�Customize compiler path and configuration variables.

    This customization is performed when the first
    extension module build is requested
    in distutils.sysconfig.customize_compiler).
    )rerlror�rrrr�s	cCs�|�dd�}t�p|}|p|}|�r�|}d}|�td|�dd��}|r�z$tdd�|�d�dd	�D��}Wq�tk
r�d
}Yq�Xnd
}|dk�rFd|��k�rFd
}t�d|�}tt	t
|���}t|�dkr�|d}nj|dkr�d}n\|dkr�d
}nN|dk�rd}n>|dk�rd}n.|dk�r&d}n|dk�r6d}ntd|f��n<|dk�rbtj
dk�r�d}n |dk�r�tj
dk�r~d }nd!}|||fS)"z Filter values for get_platform()ZMACOSX_DEPLOYMENT_TARGETr,Zmacosxrcss|]}t|�VqdSr9r:r<rrrr?sz#get_platform_osx.<locals>.<genexpr>r.rr0)rWrrVrnZfatz
-arch\s+(\S+)r/)rv�x86_64Z
universal2)�i386�ppc)r�r�Zintel)r�r�r�Zfat3)�ppc64r�Zfat64)r�r�r�r�Z	universalz%Don't know machine value for archs=%rr�lr�)ZPowerPCZPower_Macintoshr�r�)rKr8rGrArrBr(r4�findall�sorted�setr�r�maxsize)rHZosname�release�machineZmacverZ
macreleaserqZarchsrrrr�sX



�$




�

)N)F)�__doc__rr4r�__all__rhrcrGrr+r-r1r8r@rDrJrMrOrUrZr\rerkrlrorrrrrrrrrr�<module>sB�


	

>(Q)uu.cpython-38.opt-1.pyc000064400000007314150335716500010576 0ustar00U

��.em�@sjdZddlZddlZddlZdddgZGdd�de�Zddd�d	d�Zdd
d�Zdd�Z	e
d
krfe	�dS)z�Implementation of the UUencode and UUdecode functions.

encode(in_file, out_file [,name, mode], *, backtick=False)
decode(in_file [, out_file, mode, quiet])
�N�Error�encode�decodec@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.8/uu.pyr&sF��backtickc	Csjg}�zH|dkrtjj}n`t|t�rz|dkr8tj�|�}|dkrfzt�	|�j
}Wntk
rdYnXt|d�}|�
|�|dkr�tjj}nt|t�r�t|d�}|�
|�|dkr�d}|dkr�d}|�dd�}|�dd	�}|�d
|d@|f�d��|�d
�}t|�dk�r0|�tj||d��|�d
�}�q|�rB|�d�n
|�d�W5|D]}|���qTXdS)z
Uuencode file�-N�rb�wbi��
z\n�
z\rzbegin %o %s
i��ascii�-rr
s`
end
s 
end
)�close�sys�stdin�buffer�
isinstance�str�os�path�basename�stat�st_mode�AttributeError�open�append�stdout�replace�writer�read�len�binasciiZb2a_uu)�in_file�out_file�name�moder�opened_files�f�datarrr	r)sF








c

Cspg}|dkrtjj}nt|t�r4t|d�}|�|��z|��}|sLt	d��|�
d�sXq8|�dd�}t|�dkr8|ddkr8zt
|d	d
�Wq�Wq8tk
r�Yq8Xq8|dk�r:|d�d��d
�}tj�|�r�t	d|����|�
tj��s*dtj��|k�s*tj�r:|�
tj��s*dtj��|k�r:t	d|�d���|dk�rRt
|d	d
�}|dk�rftjj}n0t|t��r�t|d�}t�||�|}|�|�|��}	|	�rD|	�d�dk�rDzt�|	�}
Wnjtj	k
�r,}zH|	ddd@ddd}t�|	d|��}
|�stj�d|�W5d}~XYnX|�|
�|��}	�q�|	�sRt	d��W5|D]}|���qZXdS)zDecode uuencoded filerr
z'No valid begin line found in input filesbegin� ��r��Ns 	
rz Cannot overwrite existing file: z..zRefusing to write to z due to directory traversalrsend� �?��zWarning: %s
zTruncated input file)rrrrrrr r�readliner�
startswith�splitr%�int�
ValueError�rstriprrr�exists�sep�altsepr!�chmod�stripr&Za2b_uu�stderrr#)
r'r(r*�quietr+r,ZhdrZ	hdrfields�fp�sr-�v�nbytesrrr	rcsr





��
��




"
cCs4ddl}|jdd�}|jddddd	d
d�|jdd
ddd	d
d�|��\}}t|�dkrl|�d�t�d�tjj	}tj
j	}t|�dkr�|d}t|�dkr�|d}|jr�|jr�t
|t�r�t|d�}nttjdd�t�d�t||�nD|j�r&t
|t��rt|d�}nttjdd�t�d�t||�dS)zuuencode/uudecode main programrNz'usage: %prog [-d] [-t] [input [output]])Zusagez-dz--decoderzDecode (instead of encode)?F�
store_true)�dest�help�default�actionz-tz--text�textz2data is text, encoded format unix-compatible text?r/zincorrect number of argumentsr1rz: cannot do -t to stdoutr
z: cannot do -t from stdin)�optparseZOptionParserZ
add_option�
parse_argsr%�errorr�exitrrr!rrMrrr�print�argvr)rN�parserZoptions�args�input�outputrrr	�test�s6




rX�__main__)NN)NNF)�__doc__r&rr�__all__�	ExceptionrrrrXrrrrr	�<module>s
:
J&sre_constants.cpython-38.pyc000064400000014331150335716500012070 0ustar00U

e5d��@sDdZdZddlmZmZGdd�de�ZGdd�de�Zeed�Zd	d
�Z	e	d�Z
e
dd
�=e	d�Ze	d�Ze
eeeiZe
eeeiZe
eeeiZeeeeiZeeee iZ!ee"ee#iZ$e%e%e&e&e'e'e(e(e)e*e+e,e-e-e.e.iZ/e%e0e&e1e'e2e(e3e)e4e+e5e-e6e.e7iZ8dZ9dZ:dZ;dZ<dZ=dZ>dZ?dZ@dZAdZBdZCdZDeEdk�r@dd�ZFeGdd���ZHeH�Id�eH�Ide�eFeHe
d �eFeHed!�eFeHed!�eH�Id"e9�eH�Id#e:�eH�Id$e;�eH�Id%e<�eH�Id&e=�eH�Id'e>�eH�Id(e?�eH�Id)e@�eH�Id*eA�eH�Id+eB�eH�Id,eC�eH�Id-eD�W5QRXeJd.�d
S)/zInternal support module for srei��3�)�	MAXREPEAT�	MAXGROUPScs&eZdZdZdZd�fdd�	Z�ZS)�erroraiException raised for invalid regular expressions.

    Attributes:

        msg: The unformatted error message
        pattern: The regular expression pattern
        pos: The index in the pattern where compilation failed (may be None)
        lineno: The line corresponding to pos (may be None)
        colno: The column corresponding to pos (may be None)
    �reNcs�||_||_||_|dk	r�|dk	r�d||f}t|t�r>d}nd}|�|d|�d|_||�|d|�|_||kr�d||j|jf}nd|_|_t	��
|�dS)Nz%s at position %d�
�
r�z%s (line %d, column %d))�msg�pattern�pos�
isinstance�str�count�lineno�rfind�colno�super�__init__)�selfr	r
r�newline��	__class__��%/usr/lib64/python3.8/sre_constants.pyr%s
zerror.__init__)NN)�__name__�
__module__�__qualname__�__doc__r�
__classcell__rrrrrsrcs$eZdZ�fdd�Zdd�Z�ZS)�_NamedIntConstantcstt|��||�}||_|S�N)rr�__new__�name)�cls�valuer"rrrrr!9sz_NamedIntConstant.__new__cCs|jSr �r")rrrr�__repr__>sz_NamedIntConstant.__repr__)rrrr!r&rrrrrr8srrcCs8|����}dd�t|�D�}t��dd�|D��|S)NcSsg|]\}}t||��qSr)r)�.0�ir"rrr�
<listcomp>Esz_makecodes.<locals>.<listcomp>cSsi|]}|j|�qSrr%)r'�itemrrr�
<dictcomp>Fsz_makecodes.<locals>.<dictcomp>)�strip�split�	enumerate�globals�update)�names�itemsrrr�
_makecodesCsr3az
    FAILURE SUCCESS

    ANY ANY_ALL
    ASSERT ASSERT_NOT
    AT
    BRANCH
    CALL
    CATEGORY
    CHARSET BIGCHARSET
    GROUPREF GROUPREF_EXISTS
    IN
    INFO
    JUMP
    LITERAL
    MARK
    MAX_UNTIL
    MIN_UNTIL
    NOT_LITERAL
    NEGATE
    RANGE
    REPEAT
    REPEAT_ONE
    SUBPATTERN
    MIN_REPEAT_ONE

    GROUPREF_IGNORE
    IN_IGNORE
    LITERAL_IGNORE
    NOT_LITERAL_IGNORE

    GROUPREF_LOC_IGNORE
    IN_LOC_IGNORE
    LITERAL_LOC_IGNORE
    NOT_LITERAL_LOC_IGNORE

    GROUPREF_UNI_IGNORE
    IN_UNI_IGNORE
    LITERAL_UNI_IGNORE
    NOT_LITERAL_UNI_IGNORE
    RANGE_UNI_IGNORE

    MIN_REPEAT MAX_REPEAT
���Nz�
    AT_BEGINNING AT_BEGINNING_LINE AT_BEGINNING_STRING
    AT_BOUNDARY AT_NON_BOUNDARY
    AT_END AT_END_LINE AT_END_STRING

    AT_LOC_BOUNDARY AT_LOC_NON_BOUNDARY

    AT_UNI_BOUNDARY AT_UNI_NON_BOUNDARY
a�
    CATEGORY_DIGIT CATEGORY_NOT_DIGIT
    CATEGORY_SPACE CATEGORY_NOT_SPACE
    CATEGORY_WORD CATEGORY_NOT_WORD
    CATEGORY_LINEBREAK CATEGORY_NOT_LINEBREAK

    CATEGORY_LOC_WORD CATEGORY_LOC_NOT_WORD

    CATEGORY_UNI_DIGIT CATEGORY_UNI_NOT_DIGIT
    CATEGORY_UNI_SPACE CATEGORY_UNI_NOT_SPACE
    CATEGORY_UNI_WORD CATEGORY_UNI_NOT_WORD
    CATEGORY_UNI_LINEBREAK CATEGORY_UNI_NOT_LINEBREAK
r����� �@���__main__cCs*t|�}|D]}|�d|||f�qdS)Nz#define %s_%s %d
)�sorted�write)�f�d�prefixr2r*rrr�dump�srCzsre_constants.h�wao/*
 * Secret Labs' Regular Expression Engine
 *
 * regular expression matching engine
 *
 * NOTE: This file is generated by sre_constants.py.  If you need
 * to change anything in here, edit sre_constants.py and run it.
 *
 * Copyright (c) 1997-2001 by Secret Labs AB.  All rights reserved.
 *
 * See the _sre.c file for information on usage and redistribution.
 */

z#define SRE_MAGIC %d
ZSRE_OPZSREz#define SRE_FLAG_TEMPLATE %d
z#define SRE_FLAG_IGNORECASE %d
z#define SRE_FLAG_LOCALE %d
z#define SRE_FLAG_MULTILINE %d
z#define SRE_FLAG_DOTALL %d
z#define SRE_FLAG_UNICODE %d
z#define SRE_FLAG_VERBOSE %d
z#define SRE_FLAG_DEBUG %d
z#define SRE_FLAG_ASCII %d
z#define SRE_INFO_PREFIX %d
z#define SRE_INFO_LITERAL %d
z#define SRE_INFO_CHARSET %d
Zdone)Kr�MAGIC�_srerr�	Exceptionr�intrr3�OPCODES�ATCODES�CHCODES�LITERAL�LITERAL_IGNORE�NOT_LITERAL�NOT_LITERAL_IGNORE�	OP_IGNORE�LITERAL_LOC_IGNORE�NOT_LITERAL_LOC_IGNORE�OP_LOCALE_IGNORE�LITERAL_UNI_IGNORE�NOT_LITERAL_UNI_IGNORE�OP_UNICODE_IGNORE�AT_BEGINNINGZAT_BEGINNING_LINE�AT_ENDZAT_END_LINE�AT_MULTILINEZAT_BOUNDARYZAT_LOC_BOUNDARYZAT_NON_BOUNDARYZAT_LOC_NON_BOUNDARY�	AT_LOCALEZAT_UNI_BOUNDARYZAT_UNI_NON_BOUNDARY�
AT_UNICODEZCATEGORY_DIGITZCATEGORY_NOT_DIGITZCATEGORY_SPACEZCATEGORY_NOT_SPACEZ
CATEGORY_WORDZCATEGORY_LOC_WORDZCATEGORY_NOT_WORDZCATEGORY_LOC_NOT_WORDZCATEGORY_LINEBREAKZCATEGORY_NOT_LINEBREAK�	CH_LOCALEZCATEGORY_UNI_DIGITZCATEGORY_UNI_NOT_DIGITZCATEGORY_UNI_SPACEZCATEGORY_UNI_NOT_SPACEZCATEGORY_UNI_WORDZCATEGORY_UNI_NOT_WORDZCATEGORY_UNI_LINEBREAKZCATEGORY_UNI_NOT_LINEBREAK�
CH_UNICODE�SRE_FLAG_TEMPLATE�SRE_FLAG_IGNORECASE�SRE_FLAG_LOCALE�SRE_FLAG_MULTILINE�SRE_FLAG_DOTALL�SRE_FLAG_UNICODE�SRE_FLAG_VERBOSE�SRE_FLAG_DEBUG�SRE_FLAG_ASCII�SRE_INFO_PREFIX�SRE_INFO_LITERAL�SRE_INFO_CHARSETrrC�openr@r?�printrrrr�<module>s�!	
,
��������

tokenize.cpython-38.pyc000064400000041412150335716500011033 0ustar00U

e5d�d�@sHdZdZdZddlmZddlmZmZddl	Z	ddl
mZddlZ
ddlZddlZddlTdd	lmZe�d
ej�Ze�dej�ZddlZejdd
dddgZ[Gdd�de	�dd��Zdd�Zdd�Zdd�ZdZdZeede�ee�ZdZdZ dZ!dZ"d Z#ee e!e"e#�Z$d!Z%ed"d#�ee%�Z&d$e%Z'ee&e'�Z(ed%e(d&�Z)ee)e(e$�Z*d'd(�Z+d)d*�Z,ee+��Z-d+Z.d,Z/d-Z0d.Z1ee-d/e-d0�Z2ee-d1e-d2�Z3ee4ej5e6ed3d4���Z7ed5e7�Z8ee*e8e3e�Z9ee9Z:ee-d6ed7d�e-d8ed9d��Z;ed:ee2�Z<eee<e*e8e;e�Z=iZ>e+�D]6Z?e.e>e?d7<e/e>e?d9<e0e>e?d/<e1e>e?d0<�q,e@�ZAe@�ZBe+�D]JZCeCd9eCd7fD]ZDeA�EeD��q�eCd0eCd/fD]ZDeB�EeD��q��qvd;ZFGd<d=�d=eG�ZHGd>d?�d?eG�ZIGd@dA�dA�ZJdBd�ZKdCdD�ZLdEd�ZMdFdG�ZdHd�ZNdIdJ�ZOdKd
�ZPdLdM�ZQeRdNk�rDeQ�dS)OaoTokenization help for Python programs.

tokenize(readline) is a generator that breaks a stream of bytes into
Python tokens.  It decodes the bytes according to PEP-0263 for
determining source file encoding.

It accepts a readline-like method which is called repeatedly to get the
next line of input (or b"" for EOF).  It generates 5-tuples with these
members:

    the token type (see token.py)
    the token (a string)
    the starting (row, column) indices of the token (a 2-tuple of ints)
    the ending (row, column) indices of the token (a 2-tuple of ints)
    the original line (string)

It is designed to match the working of the Python tokenizer exactly, except
that it produces COMMENT tokens for comments and gives type OP for all
operators.  Additionally, all token lists start with an ENCODING token
which tells you which encoding was used to decode the bytes stream.
zKa-Ping Yee <ping@lfw.org>zpGvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip Montanaro, Raymond Hettinger, Trent Nelson, Michael Foord�)�open)�lookup�BOM_UTF8N)�
TextIOWrapper)�*)�EXACT_TOKEN_TYPESz&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)�tokenize�generate_tokens�detect_encoding�
untokenize�	TokenInfoc@s eZdZdd�Zedd��ZdS)rcCs$d|jt|jf}d|j|d�S)Nz%d (%s)z8TokenInfo(type=%s, string=%r, start=%r, end=%r, line=%r))�type)r
�tok_name�_replace)�self�annotated_type�r� /usr/lib64/python3.8/tokenize.py�__repr__.s
�zTokenInfo.__repr__cCs(|jtkr|jtkrt|jS|jSdS�N)r
�OP�stringr�rrrr�
exact_type3s
zTokenInfo.exact_typeN)�__name__�
__module__�__qualname__r�propertyrrrrrr-sztype string start end linecGsdd�|�dS)N�(�|�))�join��choicesrrr�group:�r$cGst|�dS)Nr�r$r"rrr�any;r%r'cGst|�dS)N�?r&r"rrr�maybe<r%r)z[ \f\t]*z	#[^\r\n]*z\\\r?\nz\w+z0[xX](?:_?[0-9a-fA-F])+z0[bB](?:_?[01])+z0[oO](?:_?[0-7])+z(?:0(?:_?0)*|[1-9](?:_?[0-9])*)z[eE][-+]?[0-9](?:_?[0-9])*z)[0-9](?:_?[0-9])*\.(?:[0-9](?:_?[0-9])*)?z\.[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*[jJ]z[jJ]cCs^ddddddg}dh}|D]>}t�|�D].}tjdd	�|D��D]}|�d�|��q@q(q|S)
N�b�r�u�f�br�fr�cSsg|]}||��f�qSr)�upper)�.0�crrr�
<listcomp>^sz(_all_string_prefixes.<locals>.<listcomp>)�
_itertools�permutations�product�addr!)�_valid_string_prefixes�result�prefix�tr,rrr�_all_string_prefixesSsr=cCst�|tj�Sr)�re�compile�UNICODE)�exprrrr�_compilebsrBz[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z'''z"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"T)�reversez\r?\nz'[^\n'\\]*(?:\\.[^\n'\\]*)*�'z"[^\n"\\]*(?:\\.[^\n"\\]*)*�"z
\\\r?\n|\Z�c@seZdZdS)�
TokenErrorN�rrrrrrrrG�srGc@seZdZdS)�StopTokenizingNrHrrrrrI�srIc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�UntokenizercCsg|_d|_d|_d|_dS)N�r)�tokens�prev_row�prev_col�encodingrrrr�__init__�szUntokenizer.__init__cCs�|\}}||jks&||jkr>||jkr>td�|||j|j���||j}|rb|j�d|�d|_||j}|r�|j�d|�dS)Nz+start ({},{}) precedes previous end ({},{})�\
r� )rMrN�
ValueError�formatrL�append)r�start�row�col�
row_offset�
col_offsetrrr�add_whitespace�s�

zUntokenizer.add_whitespacecCs6t|�}g}d}|D�]}t|�dkr8|�||��q*|\}}}}	}
|tkrV||_q|tkrd�q*|tkrz|�|�qnl|tkr�|�	�|	\|_
|_qnL|tt
fkr�d}n:|r�|r�|d}|dt|�kr�|j�|�t|�|_d}|�|�|j�|�|	\|_
|_|tt
fkr|j
d7_
d|_qd�|j�S)NF�T���rKrr0)�iter�len�compat�ENCODINGrO�	ENDMARKER�INDENTrU�DEDENT�poprMrN�NEWLINE�NLrLr[r!)r�iterable�it�indents�	startliner<�tok_type�tokenrV�end�line�indentrrrr�sF



zUntokenizer.untokenizec
Cs�g}|jj}|dttfk}d}t�|g|�D]�}|dd�\}}	|tkrR|	|_q.|tt	fkrf|	d7}	|t
kr�|rzd|	}	d}nd}|tkr�|�|	�q.n>|tkr�|�
�q.n*|ttfkr�d}n|r�|r�||d�d}||	�q.dS)NrFr\rRTr])rLrUrfrgr5�chainrarO�NAME�NUMBER�STRINGrcrdre)
rrmrhrj�toks_appendrk�
prevstring�tok�toknum�tokvalrrrr`�s8
zUntokenizer.compatN)rrrrPr[rr`rrrrrJ�s
%rJcCs*t�}|�|�}|jdk	r&|�|j�}|S)aTransform tokens back into Python source code.
    It returns a bytes object, encoded using the ENCODING
    token, which is the first token sequence output by tokenize.

    Each element returned by the iterable must be a token sequence
    with at least two elements, a token number and token value.  If
    only two tokens are passed, the resulting output is poor.

    Round-trip invariant for full input:
        Untokenized source will match input source exactly

    Round-trip invariant for limited input:
        # Output bytes will tokenize back to the input
        t1 = [tok[:2] for tok in tokenize(f.readline)]
        newcode = untokenize(t1)
        readline = BytesIO(newcode).readline
        t2 = [tok[:2] for tok in tokenize(readline)]
        assert t1 == t2
    N)rJrrO�encode)rh�ut�outrrrrs


cCsH|dd����dd�}|dks*|�d�r.dS|dks@|�d�rDd	S|S)
z(Imitates get_normal_name in tokenizer.c.N��_�-�utf-8zutf-8-)zlatin-1�
iso-8859-1ziso-latin-1)zlatin-1-ziso-8859-1-ziso-latin-1-r�)�lower�replace�
startswith)�orig_enc�encrrr�_get_normal_names�r�cs�z�jj�Wntk
r$d�YnXd�d}d}�fdd�}��fdd�}|�}|�t�rpd�|d	d�}d
}|s||gfS||�}|r�||gfSt�|�s�||gfS|�}|s�||gfS||�}|r�|||gfS|||gfS)a
    The detect_encoding() function is used to detect the encoding that should
    be used to decode a Python source file.  It requires one argument, readline,
    in the same way as the tokenize() generator.

    It will call readline a maximum of twice, and return the encoding used
    (as a string) and a list of any lines (left as bytes) it has read in.

    It detects the encoding from the presence of a utf-8 bom or an encoding
    cookie as specified in pep-0263.  If both a bom and a cookie are present,
    but disagree, a SyntaxError will be raised.  If the encoding cookie is an
    invalid charset, raise a SyntaxError.  Note that if a utf-8 bom is found,
    'utf-8-sig' is returned.

    If no encoding is specified, then the default of 'utf-8' will be returned.
    NFr�cs$z��WStk
rYdSXdS)Nr%)�
StopIterationr��readlinerr�read_or_stop?sz%detect_encoding.<locals>.read_or_stopcs�z|�d�}Wn4tk
rBd}�dk	r6d�|��}t|��YnXt�|�}|sVdSt|�d��}zt|�}Wn:t	k
r��dkr�d|}nd��|�}t|��YnX�r�|dkr؈dkr�d}n
d���}t|��|d	7}|S)
Nr�z'invalid or missing encoding declarationz{} for {!r}rKzunknown encoding: zunknown encoding for {!r}: {}zencoding problem: utf-8z encoding problem for {!r}: utf-8z-sig)
�decode�UnicodeDecodeErrorrT�SyntaxError�	cookie_re�matchr�r$r�LookupError)ro�line_string�msgr�rO�codec)�	bom_found�filenamerr�find_cookieEs8

�
z$detect_encoding.<locals>.find_cookieT��	utf-8-sig)�__self__�name�AttributeErrorr�r�blank_rer�)r�rO�defaultr�r��first�secondr)r�r�r�rr
's8
&




cCsXt|d�}z2t|j�\}}|�d�t||dd�}d|_|WS|���YnXdS)zXOpen a file in read only mode using the encoding detected by
    detect_encoding().
    �rbrT)�line_bufferingr+N)�
_builtin_openr
r��seekr�mode�close)r��bufferrO�lines�textrrrr�s

rcCs6t|�\}}t�d�}t�|t|d�|�}t|j|�S)a�
    The tokenize() generator requires one argument, readline, which
    must be a callable object which provides the same interface as the
    readline() method of built-in file objects.  Each call to the function
    should return one line of input as bytes.  Alternatively, readline
    can be a callable function terminating with StopIteration:
        readline = open(myfile, 'rb').__next__  # Example of alternate readline

    The generator produces 5-tuples with these members: the token type; the
    token string; a 2-tuple (srow, scol) of ints specifying the row and
    column where the token begins in the source; a 2-tuple (erow, ecol) of
    ints specifying the row and column where the token ends in the source;
    and the line on which the token was found.  The line passed is the
    physical line.

    The first token sequence will always be an ENCODING token
    which tells you which encoding was used to decode the bytes stream.
    r%)r
r5�repeatrqr^�	_tokenize�__next__)r�rO�consumed�empty�rl_genrrrr�s
ccs|d}}}d}d\}}d}dg}	|dk	rH|dkr6d}tt|ddd�Vd}
d}z|}
|�}Wntk
rvd}YnX|dk	r�|�|�}|d	7}dt|�}}
|�rp|s�td
|��|�|�}|�r|�d�}}tt||d|�|||f||�Vd\}}d}nf|�rZ|dd�dk�rZ|d
d�dk�rZtt	||||t|�f|�Vd}d}qPn||}||}qP�n�|dk�r|�s|�s��q�d}||
k�r�||dk�r�|d	7}n8||dk�r�|t
d	t
}n||dk�r�d}n�q�|d	7}�q�||
k�r�q�||dk�r�||dk�r^||d��d�}tt|||f||t|�f|�V|t|�7}tt
||d�||f|t|�f|�VqP||	dk�r�|	�|�tt|d|�|df||f|�V||	dk�r.||	k�r�tdd|||f��|	dd�}	ttd||f||f|�V�q�n|�s*td|df��d}||
krPtt��||�}|�r�|�d	�\}}||f||f|}}}||k�r��q.|||�||}}||k�s�|dk�r�|dk�r�|dk�r�tt||||�V�q�|dk�r|dk�r�tt
||||�Vntt||||�V�q�|dk�rB|�d��r,t�tt||||�V�q�|tk�r�tt|�}|�||�}|�r�|�d�}|||�}tt||||f|�Vn||f}||d�}|}qP�q�|tk�s�|dd�tk�s�|dd�tk�rV|ddk�rB||f}tt�|��p$t�|d	��p$t�|d��}||d�d	}}|}qPntt||||�Vnf|���rttt||||�VnH|dk�r�d	}n8|dk�r�|d	7}n|d k�r�|d	8}tt||||�Vn*tt	||||f||d	f|�V|d	7}�q.qP|
�r0|
ddk�r0ttd|d	t|
�f|d	t|
�d	fd�V|	d	d�D] }ttd|df|dfd�V�q<tt d|df|dfd�VdS)!Nr�
0123456789)r0rr�r�)rrr0r%rKzEOF in multi-line string���rQ���z\
rR�	�z#
�#z
r]z3unindent does not match any outer indentation levelz
<tokenize>zEOF in multi-line statement�.z...�
r\r��\z([{z)]})!rrar�r�r_rGr�rnrt�
ERRORTOKEN�tabsize�rstrip�COMMENTrgrUrc�IndentationErrorrdrB�PseudoToken�spanrsrf�endswith�AssertionError�
triple_quoted�endpats�
single_quoted�get�isidentifierrrrrb)r�rO�lnum�parenlev�	continued�numchars�contstr�needcont�contlinerj�	last_linero�pos�max�strstart�endprog�endmatchrn�column�
comment_token�pseudomatchrV�spos�eposrm�initialrprrrr��s>




�*

�


�
�
"

� 

���





����






�.r�cCs
t|d�S)z�Tokenize a source reading Python code as unicode strings.

    This has the same API as tokenize(), except that it expects the *readline*
    callable to return str objects instead of bytes.
    N)r�r�rrrr	dsc

s$ddl}dd��d�fdd�	}|jdd�}|jdd	d
dd�|jd
ddddd�|��}z�|jr�|j}t|d��}tt|j��}W5QRXnd}t	t
jjd�}|D]>}|j}|j
r�|j}d|j|j}	td|	t||jf�q�W�n8tk
�r6}
z0|
jddd�\}}||
jd|||f�W5d}
~
XYn�tk
�r|}
z(|
jd\}}||
jd|||f�W5d}
~
XYn�tk
�r�}
z||
|�W5d}
~
XYnxtk
�r�}
z||
�W5d}
~
XYnNtk
�r�td�Yn2tk
�r}
z�d|
��W5d}
~
XYnXdS)NrcSstj�|�tj�d�dS)Nr�)�sys�stderr�write)�messagerrr�perrorpszmain.<locals>.perrorcsR|r"|f||f}�d|�n"|r8�d||f�n�d|�t�d�dS)Nz%s:%d:%d: error: %sz
%s: error: %sz	error: %srK)r��exit)r�r��location�args�r�rr�errortszmain.<locals>.errorzpython -m tokenize)�progr�r(zfilename.pyz'the file to tokenize; defaults to stdin)�dest�nargs�metavar�helpz-ez--exact�exact�
store_truez(display token names using the exact type)r��actionr�r�z<stdin>z%d,%d-%d,%d:z%-20s%-15s%-15rrKr�zinterrupted
zunexpected error: %s)NN)�argparse�ArgumentParser�add_argument�
parse_argsr�r��listrr�r�r��stdinr
r�rrVrn�printrrr�r�rGr��OSError�KeyboardInterrupt�	Exception)
r�r��parserr�r�r-rLrm�
token_type�token_range�errror�rr�r�mainlsT���&&r��__main__)S�__doc__�
__author__�__credits__�builtinsrr��codecsrr�collections�ior�	itertoolsr5r>r�rmrr?�ASCIIr�r��__all__�
namedtuplerr$r'r)�
Whitespace�Comment�Ignore�Name�	Hexnumber�	Binnumber�	Octnumber�	Decnumber�	Intnumber�Exponent�
Pointfloat�Expfloat�Floatnumber�
Imagnumber�Numberr=rB�StringPrefix�Single�Double�Single3�Double3�Triple�String�map�escape�sorted�Special�Funny�
PlainToken�Token�ContStr�PseudoExtrasr�r��_prefix�setr�r�r<r,r8r�r�rGrIrJrr�r
rr�r	r�rrrrr�<module>s�
�
��

�
���

_]8=
dataclasses.cpython-38.opt-1.pyc000064400000056147150335716500012444 0ustar00U

e5d5��@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZdddddddd	d
ddd
gZ	Gdd�de
�ZGdd�d�Ze�Z
Gdd�d�Ze�Ze�i�ZGdd�d�Zed�Zed�Zed�ZdZdZdZe�d�ZGdd�de�ZGdd�ded�ZGd d�d�ZGd!d"�d"�Zeed#d#dd#dd$�d%d�Z d&d'�Z!d(d)�Z"dded*�d+d,�Z#d-d.�Z$d/d0�Z%d1d2�Z&d3d4�Z'd5d6�Z(d7d8�Z)d9d:�Z*d;d<�Z+d=d>�Z,d?d@�Z-dAdB�Z.dCdD�Z/dEdF�Z0dGdH�Z1dIdJ�Z2dKdL�Z3dddde1de2de2e3e2e3e2e3e2e3dM�Z4dNdO�Z5ddd#d#d#dPdPdPdQ�dRd�Z6dSd�Z7dTdU�Z8dVd
�Z9e:dW�dXd	�Z;dYdZ�Z<e=d[�d\d
�Z>d]d^�Z?d_dd#d#d#dPdPdPd`�dad�Z@dbd�ZAdceA_BdS)e�N�	dataclass�field�Field�FrozenInstanceError�InitVar�MISSING�fields�asdict�astuple�make_dataclass�replace�is_dataclassc@seZdZdS)rN��__name__�
__module__�__qualname__�rr�#/usr/lib64/python3.8/dataclasses.pyr�sc@seZdZdd�ZdS)�_HAS_DEFAULT_FACTORY_CLASScCsdS)Nz	<factory>r��selfrrr�__repr__�sz#_HAS_DEFAULT_FACTORY_CLASS.__repr__N)rrrrrrrrr�src@seZdZdS)�
_MISSING_TYPENrrrrrr�src@seZdZdd�Zdd�ZdS)�_FIELD_BASEcCs
||_dS�N��name�rrrrr�__init__�sz_FIELD_BASE.__init__cCs|jSrrrrrrr�sz_FIELD_BASE.__repr__N)rrrrrrrrrr�sr�_FIELD�_FIELD_CLASSVAR�_FIELD_INITVARZ__dataclass_fields__Z__dataclass_params__Z
__post_init__z^(?:\s*(\w+)\s*\.)?\s*(\w+)c@seZdZdd�ZdS)�_InitVarMetacCst|�Sr)r)rZparamsrrr�__getitem__�sz_InitVarMeta.__getitem__N)rrrr#rrrrr"�sr"c@s eZdZdZdd�Zdd�ZdS)r��typecCs
||_dSrr$)rr%rrrr�szInitVar.__init__cCs,t|jt�r|jj}n
t|j�}d|�d�S)Nzdataclasses.InitVar[�])�
isinstancer%r�repr)rZ	type_namerrrr�s

zInitVar.__repr__N�rrr�	__slots__rrrrrrr�s)�	metaclassc@s(eZdZdZdd�Zdd�Zdd�ZdS)	r)
rr%�default�default_factoryr(�hash�init�compare�metadata�_field_typecCsRd|_d|_||_||_||_||_||_||_|dkr<tnt	�
|�|_d|_dSr)
rr%r,r-r/r(r.r0�_EMPTY_METADATA�types�MappingProxyTyper1r2)rr,r-r/r(r.r0r1rrrr�s��zField.__init__cCsVd|j�d|j�d|j�d|j�d|j�d|j�d|j�d|j�d	|j�d
|j	�d�S)NzField(name=z,type=z	,default=z,default_factory=z,init=�,repr=z,hash=z	,compare=z
,metadata=z
,_field_type=�))
rr%r,r-r/r(r.r0r1r2rrrrrszField.__repr__cCs(tt|j�dd�}|r$||j||�dS)N�__set_name__)�getattrr%r,)r�ownerr�funcrrrr8szField.__set_name__N)rrrr*rrr8rrrrr�sc@s eZdZdZdd�Zdd�ZdS)�_DataclassParams�r/r(�eq�order�unsafe_hash�frozencCs(||_||_||_||_||_||_dSrr=)rr/r(r>r?r@rArrrr*sz_DataclassParams.__init__c
Cs6d|j�d|j�d|j�d|j�d|j�d|j�d�
S)Nz_DataclassParams(init=r6z,eq=z,order=z
,unsafe_hash=z,frozen=r7r=rrrrr2sz_DataclassParams.__repr__Nr)rrrrr<!sr<T�r,r-r/r(r.r0r1cCs,|tk	r|tk	rtd��t|||||||�S)a�Return an object to identify dataclass fields.

    default is the default value of the field.  default_factory is a
    0-argument function called to initialize a field's value.  If init
    is True, the field will be a parameter to the class's __init__()
    function.  If repr is True, the field will be included in the
    object's repr().  If hash is True, the field will be included in
    the object's hash().  If compare is True, the field will be used
    in comparison functions.  metadata, if specified, must be a
    mapping which is stored but not otherwise examined by dataclass.

    It is an error to specify both default and default_factory.
    z/cannot specify both default and default_factory)r�
ValueErrorrrBrrrr@s
�cs(|sdSdd��fdd�|D���d�S)N�()�(�,csg|]}��d|j���qS)�.r��.0�f��obj_namerr�
<listcomp>_sz_tuple_str.<locals>.<listcomp>�,))�join)rLrrrKr�
_tuple_strVsrPcs"t��t�����fdd��}|S)Nc	sDt|�t��f}|�krdS��|�z�|�}W5��|�X|S)Nz...)�id�_thread�	get_ident�add�discard)r�key�result��repr_running�
user_functionrr�wrapperis
z _recursive_repr.<locals>.wrapper)�set�	functools�wraps)rZr[rrXr�_recursive_reprds
r_)�globals�locals�return_typec
Cs�|dkri}d|krt|d<d}|tk	r4||d<d}d�|�}d�dd�|D��}d	|�d
|�d|�d|��}d
�|���}d|�d|�d|��}i}	t|||	�|	df|�S)NZBUILTINS�Z_return_typez->_return_typerF�
css|]}d|��VqdS)z  Nr)rI�brrr�	<genexpr>�sz_create_fn.<locals>.<genexpr>z def rEr7z:
�, zdef __create_fn__(z):
z	
 return Z
__create_fn__)�builtinsrrO�keys�exec)
r�argsZbodyr`rarbZreturn_annotationZtxtZ
local_vars�nsrrr�
_create_fnws 
rmcCs0|rd|�d|�d|�d�S|�d|�d|��S)NzBUILTINS.object.__setattr__(rFr7rG�=r)rAr�value�	self_namerrr�
_field_assign�srqcCs�d|j��}|jtk	rV|jr@|j||<|�d|j�d|j��}q�|j||<|�d�}n8|jr�|jtkrn|j}q�|jtk	r�|j||<|j}ndS|jtkr�dSt||j||�S)NZ_dflt_z() if z is _HAS_DEFAULT_FACTORY else rD)rr-rr/r,r2r!rq)rJrAr`rpZdefault_namerorrr�_field_init�s"






rrcCsV|jtkr|jtkrd}n&|jtk	r2d|j��}n|jtk	r@d}|j�d|j�|��S)Nrcz=_dflt_z=_HAS_DEFAULT_FACTORYz:_type_)r,rr-r)rJr,rrr�_init_param�s

rscCs�d}|D]:}|jr|jtkr&|jtks,d}q|rtd|j�d���qdd�|D�}|�ttd��g}|D] }t||||�}	|	rj|�	|	�qj|r�d�
d	d
�|D��}
|�	|�dt�d|
�d
��|s�dg}td|gdd�|D�|||dd�S)NFTznon-default argument z follows default argumentcSsi|]}d|j��|j�qS)Z_type_)rr%rHrrr�
<dictcomp>�s
z_init_fn.<locals>.<dictcomp>)r�_HAS_DEFAULT_FACTORYrFcss|]}|jtkr|jVqdSr)r2r!rrHrrrrf	s
�z_init_fn.<locals>.<genexpr>rGrEr7�passrcSsg|]}|jrt|��qSr)r/rsrHrrrrMsz_init_fn.<locals>.<listcomp>)rar`rb)
r/r,rr-�	TypeErrorr�updaterurr�appendrO�_POST_INIT_NAMErm)rrA�
has_post_initrpr`Zseen_defaultrJraZ
body_lines�lineZ
params_strrrr�_init_fn�s:��r}cCs2tdddd�dd�|D��dg|d�}t|�S)	Nrrz(return self.__class__.__qualname__ + f"(rgcSs g|]}|j�d|j�d��qS)z={self.z!r}rrHrrrrMs�z_repr_fn.<locals>.<listcomp>z)"�r`)rmrOr_)rr`�fnrrr�_repr_fns
����r�cCsp|td�}|r,dd�dd�|D��d}nd}tdd	d
|�d�dd
f||d�tddd
|�d�ddf||d�fS)N)�clsrrErFcss|]}t|j�VqdSr)r(rrHrrrrf(sz'_frozen_get_del_attr.<locals>.<genexpr>rNrD�__setattr__)rrroz if type(self) is cls or name in �:z> raise FrozenInstanceError(f"cannot assign to field {name!r}")z)super(cls, self).__setattr__(name, value))rar`�__delattr__rz; raise FrozenInstanceError(f"cannot delete field {name!r}")z"super(cls, self).__delattr__(name))rrOrm)r�rr`raZ
fields_strrrr�_frozen_get_del_attr$s2�
��
���r�cCs$t|ddd|�|�|��dg|d�S)N)r�otherz%if other.__class__ is self.__class__:z return zreturn NotImplementedr~)rm)r�op�
self_tuple�other_tupler`rrr�_cmp_fn=s��r�cCs$td|�}tddd|�d�g|d�S)Nr�__hash__rzreturn hash(r7r~)rPrm)rr`r�rrr�_hash_fnKs
�r�cCs$||jkp"t|�|jko"|j|jkSr)�ClassVarr%Z
_GenericAliasZ
__origin__)�a_type�typingrrr�_is_classvarSs

�r�cCs||jkpt|�|jkSr)rr%)r��dataclassesrrr�_is_initvar[s
�r�c	Cs�t�|�}|r�d}|�d�}|s2tj�|j�j}n2tj�|j�}|rd|j�|�|krdtj�|j�j}|r�||�|�d��|�r�dSdS)N��TF)�_MODULE_IDENTIFIER_RE�match�group�sys�modules�getr�__dict__)	Z
annotationr�Za_moduler�Zis_type_predicater�rlZmodule_name�modulerrr�_is_typebs)

r�cCs8t||t�}t|t�r|}nt|tj�r,t}t|d�}||_||_t	|_
tj�
d�}|r�t||�s�t|jt�r�t|j|||jt�r�t|_
|j
t	kr�tjt}t||�s�t|jt�r�t|j|||jt�r�t|_
|j
ttfkr�|jtk	r�td|j�d���|j
t	k�r4t|jtttf��r4tdt|j��d|j�d���|S)N)r,r��field z cannot have a default factoryzmutable default z for field z$ is not allowed: use default_factory)r9rr'rr4�MemberDescriptorTyperrr%rr2r�r�r�r��strr�r�r rr�rr!r-rwr,�list�dictr\rC)r�Za_namer�r,rJr�r�rrr�
_get_field�sF



���



���
	 r�cCs||jkrdSt|||�dS)NTF)r��setattr)r�rrorrr�_set_new_attribute�s
r�cCsdSrr�r�rr`rrr�_hash_set_none�sr�cCsdd�|D�}t||�S)NcSs(g|] }|jdkr|jrn|jr|�qSr)r.r0rHrrrrMs

z_hash_add.<locals>.<listcomp>)r�)r�rr`�fldsrrr�	_hash_addsr�cCstd|j����dS)Nz-Cannot overwrite attribute __hash__ in class )rwrr�rrr�_hash_exceptionsr�))FFFF)FFFT)FFTF)FFTT)FTFF)FTFT)FTTF)FTTT)TFFF)TFFT)TFTF)TFTT)TTFF)TTFT)TTTF)TTTTcs�i}�jtjkr tj�jj}ni}t�tt||||||��d}	d}
�jddd�D]D}t|t	d�}|dk	rVd}
|�
�D]}
|
||
j<qzt|t�jrVd}	qV�j�
di�}�fdd�|��D�}|D]L}
|
||
j<tt�|
jd�t�r�|
jtk�rt�|
j�q�t�|
j|
j�qĈj��D].\}}t|t��r||k�rt|�d����q|
�rz|	�rf|�sftd	��|	�sz|�rztd
��t�t	|��j�
dt�}|tk�p�|dk�o�d�jk}|�r�|�s�td
��|�rt�t�}dd�|�
�D�}t�dt|||d|k�rdnd|��dd�|�
�D�}|�rHdd�|D�}t�dt||��|�r�dd�|D�}td|�}td|�}t�dtdd|||d��|�r�dd�|D�}td|�}td|�}dD]>\}}t�|t|||||d���r�td|�d�j�d����q�|�r8t�||�D].}t�|j|��rtd|j�d�j�����qtt |�t |�t |�|f}|�rh|�||��_!t�d��s��jt"t#�$����%dd ��_&�S)!NF���rT�__annotations__csg|]\}}t�||��qSr)r�)rIrr%�r�rrrM]s�z"_process_class.<locals>.<listcomp>z& is a field but has no type annotationz5cannot inherit non-frozen dataclass from a frozen onez5cannot inherit frozen dataclass from a non-frozen oner��__eq__z eq must be true if order is truecSsg|]}|jttfkr|�qSr)r2rr!rHrrrrM�s�rrZ__dataclass_self__cSsg|]}|jtkr|�qSr�r2rrHrrrrM�s
cSsg|]}|jr|�qSr)r(rHrrrrM�srcSsg|]}|jr|�qSr�r0rHrrrrM�sr�z==r~cSsg|]}|jr|�qSrr�rHrrrrM�s))�__lt__�<)�__le__z<=)�__gt__�>)�__ge__z>=zCannot overwrite attribute z
 in class z). Consider using functools.total_ordering�__doc__z -> Nonerc)'rr�r�r�r��_PARAMSr<�__mro__r9�_FIELDS�valuesrrAr��itemsr'rr,r�delattrrwrC�hasattrrzr�r}r�rPr�rr��_hash_action�boolr�r��inspectZ	signaturerr�)r�r/r(r>r?r@rArr`Zany_frozen_baseZhas_dataclass_basesreZbase_fieldsrJZcls_annotationsZ
cls_fieldsrroZ
class_hashZhas_explicit_hashr{r�Z
field_listr�r�r�rZhash_actionrr�r�_process_class's��
�

�
��

��


����r�Fr=cs*������fdd�}|dkr"|S||�S)a�Returns the same class as was passed in, with dunder methods
    added based on the fields defined in the class.

    Examines PEP 526 __annotations__ to determine fields.

    If init is true, an __init__() method is added to the class. If
    repr is true, a __repr__() method is added. If order is true, rich
    comparison dunder methods are added. If unsafe_hash is true, a
    __hash__() method function is added. If frozen is true, fields may
    not be assigned to after instance creation.
    cst|�������Sr)r�r��r>rAr/r?r(r@rr�wrap�szdataclass.<locals>.wrapNr)r�r/r(r>r?r@rAr�rr�rr�scCsBzt|t�}Wntk
r*td��YnXtdd�|��D��S)z�Return a tuple describing the fields of this dataclass.

    Accepts a dataclass or an instance of one. Tuple elements are of
    type Field.
    z0must be called with a dataclass type or instancecss|]}|jtkr|VqdSrr�rHrrrrf
s
zfields.<locals>.<genexpr>)r9r��AttributeErrorrw�tupler�)Zclass_or_instancerrrrr�s
cCstt|�t�S)z2Returns True if obj is an instance of a dataclass.)r�r%r�)�objrrr�_is_dataclass_instancesr�cCs t|t�r|nt|�}t|t�S)zEReturns True if obj is a dataclass or an instance of a
    dataclass.)r'r%r�r�)r�r�rrrr
s��dict_factorycCst|�std��t||�S)a�Return the fields of a dataclass instance as a new dictionary mapping
    field names to field values.

    Example usage:

      @dataclass
      class C:
          x: int
          y: int

      c = C(1, 2)
      assert asdict(c) == {'x': 1, 'y': 2}

    If given, 'dict_factory' will be used instead of built-in dict.
    The function applies recursively to field values that are
    dataclass instances. This will also look into built-in containers:
    tuples, lists, and dicts.
    z0asdict() should be called on dataclass instances)r�rw�
_asdict_inner)r�r�rrrr	scs�t|�rDg}t|�D]&}tt||j���}|�|j|f�q�|�St|t�rrt|d�rrt	|��fdd�|D��St|t
tf�r�t	|��fdd�|D��St|t�r�t	|��fdd�|��D��St
�|�SdS)N�_fieldscsg|]}t|���qSr�r��rI�vr�rrrMOsz!_asdict_inner.<locals>.<listcomp>c3s|]}t|��VqdSrr�r�r�rrrfTsz _asdict_inner.<locals>.<genexpr>c3s&|]\}}t|��t|��fVqdSrr��rI�kr�r�rrrfVs��)r�rr�r9rryr'r�r�r%r�r�r��copy�deepcopy)r�r�rWrJrorr�rr�4s
�r���
tuple_factorycCst|�std��t||�S)a�Return the fields of a dataclass instance as a new tuple of field values.

    Example usage::

      @dataclass
      class C:
          x: int
          y: int

    c = C(1, 2)
    assert astuple(c) == (1, 2)

    If given, 'tuple_factory' will be used instead of built-in tuple.
    The function applies recursively to field values that are
    dataclass instances. This will also look into built-in containers:
    tuples, lists, and dicts.
    z1astuple() should be called on dataclass instances)r�rw�_astuple_inner)r�r�rrrr
]scs�t|�r>g}t|�D] }tt||j���}|�|�q�|�St|t�rlt|d�rlt	|��fdd�|D��St|t
tf�r�t	|��fdd�|D��St|t�r�t	|��fdd�|��D��St
�|�SdS)Nr�csg|]}t|���qSr�r�r�r�rrrM�sz"_astuple_inner.<locals>.<listcomp>c3s|]}t|��VqdSrr�r�r�rrrf�sz!_astuple_inner.<locals>.<genexpr>c3s&|]\}}t|��t|��fVqdSrr�r�r�rrrf�s�)r�rr�r9rryr'r�r�r%r�r�r�r�r�)r�r�rWrJrorr�rr�us
�r�r)�bases�	namespacer/r(r>r?r@rAc	s�dkri�n����t�}
i}|D]�}t|t�r<|}
d}nDt|�dkrR|\}
}n.t|�dkrr|\}
}}|�|
<ntd|����t|
t�r�|
��s�td|
����t�|
�r�td|
����|
|
kr�td|
����|
�	|
�|||
<q$|�d	<t
�||i�fd
d��}t|||||||	d�S)
a�Return a new dynamically created dataclass.

    The dataclass name will be 'cls_name'.  'fields' is an iterable
    of either (name), (name, type) or (name, type, Field) objects. If type is
    omitted, use the string 'typing.Any'.  Field objects are created by
    the equivalent of calling 'field(name, type [, Field-info])'.

      C = make_dataclass('C', ['x', ('y', int), ('z', int, field(init=False))], bases=(Base,))

    is equivalent to:

      @dataclass
      class C(Base):
          x: 'typing.Any'
          y: int
          z: int = field(init=False)

    For the bases and namespace parameters, see the builtin type() function.

    The parameters init, repr, eq, order, unsafe_hash, and frozen are passed to
    dataclass().
    Nz
typing.Anyr��zInvalid field: z'Field names must be valid identifiers: z"Field names must not be keywords: zField name duplicated: r�cs
|���Sr)rx)rl�r�rr�<lambda>��z make_dataclass.<locals>.<lambda>r=)
r�r\r'r��lenrw�isidentifier�keyword�	iskeywordrTr4�	new_classr)Zcls_namerr�r�r/r(r>r?r@rA�seenZanns�itemr�tp�specr�rr�rr�s:






�cOst|�dkr tdt|��d���|r,|\}n4d|krX|�d�}ddl}|jdtdd	�ntd
��t|�sptd��t|t��	�D]v}|j
tkr�q~|js�|j
|kr~td|j
�d
���q~|j
|kr~|j
tkr�|jtkr�td|j
�d���t||j
�||j
<q~|jf|�S)a,Return a new object replacing specified fields with new values.

    This is especially useful for frozen classes.  Example usage:

      @dataclass(frozen=True)
      class C:
          x: int
          y: int

      c = C(1, 2)
      c1 = replace(c, x=3)
      assert c1.x == 3 and c1.y == 2
      r�z*replace() takes 1 positional argument but z were givenr�rNz/Passing 'obj' as keyword argument is deprecatedr�)�
stacklevelz7replace() missing 1 required positional argument: 'obj'z1replace() should be called on dataclass instancesr�zC is declared with init=False, it cannot be specified with replace()zInitVar z! must be specified with replace())r�rw�pop�warnings�warn�DeprecationWarningr�r9r�r�r2r r/rrCr!r,r�	__class__)rkZchangesr�r�rJrrrr�s4
�


z(obj, /, **kwargs))N)C�rer�r�r4r�r�rhr]rR�__all__r�rrrurrr5r3rrr r!r�r�rz�compiler�r%r"rrr<rrPr_rmrqrrrsr}r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr�r
r�r	r�r�r
r�rr�__text_signature__rrrr�<module>s��

:��62;R�>
�)�B<binhex.cpython-38.opt-1.pyc000064400000027550150335716500011426 0ustar00U

e5d�6�@s�dZddlZddlZddlZddlZdddgZGdd�de�ZdZdZ	dZ
d	Zd
ZGdd�d�Z
d
d�ZGdd�d�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�ZdS)z�Macintosh binhex compression/decompression.

easy interface:
binhex(inputfilename, outputfilename)
hexbin(inputfilename, outputfilename)
�N�binhex�hexbin�Errorc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.8/binhex.pyrs�i��@��c@seZdZdd�ZdS)�FInfocCsd|_d|_d|_dS)Nz????r)�Type�Creator�Flags��selfrrr	�__init__0szFInfo.__init__N)rrrrrrrr	r
/sr
c	Cstt�}t�|d��2}|�d�}d|kr,d|_|�dd�|��}W5QRXtj�	|�\}}|�
ddd�}|||dfS)	N�rbirZTEXT��:�-r
)r
�io�open�readr�seek�tell�os�path�split�replace)�name�finfo�fp�dataZdsize�dir�filerrr	�getfileinfo5s
r'c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�openrsrccGsdS�Nr�r�argsrrr	rCszopenrsrc.__init__cGsdS�N�rr*rrr	rFsz
openrsrc.readcGsdSr)rr*rrr	�writeIszopenrsrc.writecCsdSr)rrrrr	�closeLszopenrsrc.closeN)rrrrrr.r/rrrr	r(Bsr(c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_Hqxcoderenginez(Write data to the coder in 3-byte chunkscCs ||_d|_d|_td|_dS)Nr-r
)�ofpr$�hqxdata�LINELEN�linelen�rr1rrr	rRsz_Hqxcoderengine.__init__cCsh|j||_t|j�}|dd}|jd|�}|j|d�|_|sHdS|jt�|�|_|�d�dS)N�r)r$�lenr2�binascii�b2a_hqx�_flush)rr$ZdatalenZtodorrr	r.Xs
z_Hqxcoderengine.writecCsrd}|t|j�|jkrH||j}|j�|j||�d�t|_|}q|j|d�|_|rn|j�|jd�dS)Nr�
s:
)r7r2r4r1r.r3)rZforce�firstZlastrrr	r:cs
z_Hqxcoderengine._flushcCs6|jr|jt�|j�|_|�d�|j��|`dS)Nr
)r$r2r8r9r:r1r/rrrr	r/ns


z_Hqxcoderengine.closeN)rrr�__doc__rr.r:r/rrrr	r0Os
r0c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_Rlecoderenginez4Write data to the RLE-coder in suitably large chunkscCs||_d|_dSr,)r1r$r5rrr	rxsz_Rlecoderengine.__init__cCs@|j||_t|j�tkrdSt�|j�}|j�|�d|_dSr,)r$r7�REASONABLY_LARGEr8�rlecode_hqxr1r.)rr$�rledatarrr	r.|sz_Rlecoderengine.writecCs0|jrt�|j�}|j�|�|j��|`dSr))r$r8r@r1r.r/)rrArrr	r/�s

z_Rlecoderengine.closeN)rrrr=rr.r/rrrr	r>usr>c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�BinHexc
Cs�|\}}}}d}t|t�r.|}t�|d�}d}zR|�d�t|�}	t|	�|_d|_|dkr`t	�}||_
||_|�||�t
|_Wn|r�|���YnXdS)NF�wbTs0(This file must be converted with BinHex 4.0)

:r)�
isinstance�strrrr.r0r>r1�crcr
�dlen�rlen�
_writeinfo�_DID_HEADER�stater/)
rZname_finfo_dlen_rlenr1r!r"rGrHZclose_on_errorZofnameZhqxerrrr	r�s*



zBinHex.__init__cCs�t|�}|dkrtd��t|g�|�d�d}|j|j}}t|t�rR|�d�}t|t�rf|�d�}||}t�	d|j
�}t�	d|j|j�}	||||	}
|�
|
�|��dS)N�?zFilename too longzlatin-1��>hz>ii)r7r�bytes�encoderrrDrE�struct�packrrGrH�_write�	_writecrc)rr!r"�nl�d�tpZcrZd2Zd3Zd4�inforrr	rI�s




zBinHex._writeinfocCs t�||j�|_|j�|�dSr))r8�crc_hqxrFr1r.�rr$rrr	rS�sz
BinHex._writecCs4|jdkrd}nd}|j�t�||j��d|_dS)NrrNz>H)rFr1r.rQrR)rZfmtrrr	rT�s

zBinHex._writecrccCs0|jtkrtd��|jt|�|_|�|�dS)NzWriting data at the wrong time)rKrJrrGr7rSrZrrr	r.�s
zBinHex.writecCs,|jdkrtd|jf��|��t|_dS)NrzIncorrect data size, diff=%r)rGrrHrT�	_DID_DATArKrrrr	�
close_data�s
zBinHex.close_datacCsB|jtkr|��|jtkr$td��|jt|�|_|�|�dS)Nz'Writing resource data at the wrong time)rKr[r\rrHr7rSrZrrr	�
write_rsrc�s

zBinHex.write_rsrccCsx|jdkrdSzJ|jtkr"|��|jtkr4td��|jdkrNtd|jf��|��W5d|_|j}|`|��XdS)NzClose at the wrong timerz$Incorrect resource-datasize, diff=%r)rKr1r/r[r\rrHrTr5rrr	r/�s



zBinHex.closeN)rrrrrIrSrTr.r\r]r/rrrr	rB�s
rBc	Cs�t|�}t||�}t�|d��*}|�d�}|s0q<|�|�q |��W5QRXt|d�}|�d�}|shqt|�|�qX|�	�|�	�dS)zEbinhex(infilename, outfilename): create binhex-encoded copy of a filer��N)
r'rBrrrr.r\r(r]r/)�inp�outr"r1�ifprVrrr	r�s



c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_Hqxdecoderenginez*Read data via the decoder in 4-byte chunkscCs||_d|_dS)Nr)ra�eof�rrarrr	rsz_Hqxdecoderengine.__init__cCs�d}|}|dkr�|jr|S|ddd}|j�|�}zt�|�\}|_Wq�Wntjk
rdYnX|j�d�}|s~td��||}q6||}|t|�}|s|jstd��q|S)z&Read at least wtd bytes (or until EOF)r-rrr6�r
zPremature EOF on binhex file)rcrarr8Za2b_hqxZ
Incompleterr7)rZtotalwtdZdecdata�wtdr$Z
decdatacur�newdatarrr	rs*


z_Hqxdecoderengine.readcCs|j��dSr)�rar/rrrr	r/%sz_Hqxdecoderengine.closeN)rrrr=rrr/rrrr	rb�s rbc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_RledecoderenginezRead data via the RLE-codercCs||_d|_d|_d|_dS)Nr-r)ra�
pre_buffer�post_bufferrcrdrrr	r+sz_Rledecoderengine.__init__cCsD|t|j�kr"|�|t|j��|jd|�}|j|d�|_|Sr))r7rk�_fill)rrf�rvrrr	r1s
z_Rledecoderengine.readcCs�|j|j�|d�|_|jjr>|jt�|j�|_d|_dSt|j�}|jdd�tdtkrl|d}nX|jdd�tkr�|d}n<|jdd�tdkr�|d}n|jdd�tkr�n|d	}|jt�|jd|��|_|j|d�|_dS)
Nrer-���rMr6���r���r
)	rjrarrcrkr8Z
rledecode_hqxr7�RUNCHAR)rrfZmarkrrr	rl8s*
�



�z_Rledecoderengine._fillcCs|j��dSr)rhrrrr	r/[sz_Rledecoderengine.closeN)rrrr=rrrlr/rrrr	ri(s
#ric@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�HexBincCsft|t�rt�|d�}|�d�}|s,td��|dkr6q|dkrqBqt|�}t|�|_d|_	|�
�dS)Nrr
zNo binhex data foundr;�:r)rDrErrrrrbrirarF�_readheader)rraZchZhqxifprrr	r_s


zHexBin.__init__cCs |j�|�}t�||j�|_|Sr))rarr8rYrF)rr7r$rrr	�_readuszHexBin._readcCsNt�d|j�d��dd@}|jd@|_||jkrDtd|j|f��d|_dS)NrNrri��zCRC error, computed %x, read %x)rQ�unpackrarrFr)rZfilecrcrrr	�	_checkcrczs
�zHexBin._checkcrccCs�|�d�}|�t|��}|�d�}|��|dd�}|dd�}t�d|dd��d}t�d|dd	��d|_t�d|d	d��d|_||_t�|_||j_	||j_
||j_t|_
dS)
Nr
���	rN�rz>l�)ru�ordrwrQrvrGrH�FNamer
rrrrJrK)rr7Zfname�rest�typeZcreator�flagsrrr	rt�s

zHexBin._readheadercGsj|jtkrtd��|r,|d}t||j�}n|j}d}t|�|krZ||�|t|��}q6|j||_|S)NzRead data at wrong timerr-)rKrJr�minrGr7ru)r�nrmrrr	r�s
zHexBin.readcCs6|jtkrtd��|jr$|�|j�}|��t|_dS)Nzclose_data at wrong time)rKrJrrGrurwr[�rZdummyrrr	r\�s
zHexBin.close_datacGsZ|jtkr|��|jtkr$td��|r>|d}t||j�}n|j}|j||_|�|�S)Nz Read resource data at wrong timer)rKrJr\r[rr�rHru)rr�rrr	�	read_rsrc�s

zHexBin.read_rsrccCsD|jdkrdSz|jr"|�|j�}|��W5d|_|j��XdSr))rKrar/rHr�rwr�rrr	r/�s
zHexBin.closeN)rrrrrurwrtrr\r�r/rrrr	rr^s

rrc	Cs�t|�}|j}|s|j}t�|d��"}|�d�}|s6qB|�|�q&W5QRX|��|�d�}|r�t	|d�}|�|�|�d�}|s�q�|�|�qv|�
�|�
�dS)z6hexbin(infilename, outfilename) - Decode binhexed filerCr^N)rrr
r~rrrr.r\r�r(r/)r_r`rar"r1rVrrr	r�s(




)r=rrrQr8�__all__�	ExceptionrrJr[r?r3rqr
r'r(r0r>rBrrbrirrrrrrr	�<module>s,


&^*6hcgitb.cpython-38.opt-1.pyc000064400000023650150335716500011236 0ustar00U

e5d@/�@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
dd�ZgZdd�Z
dd�Zd	d
�Zdd�Zd
d�Zddd�Zddd�ZGdd�d�Ze�jZddd�ZdS)a�More comprehensive traceback formatting for Python scripts.

To enable this module, do:

    import cgitb; cgitb.enable()

at the top of your script.  The optional arguments to enable() are:

    display     - if true, tracebacks are displayed in the web browser
    logdir      - if set, tracebacks are written to files in this directory
    context     - number of lines of source code to show for each stack frame
    format      - 'text' or 'html' controls the output format

By default, tracebacks are displayed but not saved, the context is 5 lines
and the output format is 'html' (for backwards compatibility with the
original use of this module)

Alternatively, if you have caught an exception and want cgitb to display it
for you, call cgitb.handler().  The optional argument to handler() is a
3-item tuple (etype, evalue, etb) just like the value of sys.exc_info().
The default handler displays output as HTML.

�NcCsdS)zAReturn a string that resets the CGI and browser to a known state.a'<!--: spam
Content-Type: text/html

<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> -->
<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> -->
</font> </font> </font> </script> </object> </blockquote> </pre>
</table> </table> </table> </table> </table> </font> </font> </font>�rrr�/usr/lib64/python3.8/cgitb.py�reset#srcCs|rd|dSdSdS)Nz<small>z</small>�r��textrrr�small.srcCs|rd|dSdSdS)Nz<strong>z	</strong>rrrrrr�strong4sr	cCs|rd|dSdSdS)Nz<font color="#909090">z</font>rrrrrr�grey:sr
cCs�||krd||fS||jkr,d|j|fSd|jkr~|jd}t|�ti�krf||kr~d||fSnt||�r~dt||�fSdtfS)z9Find the value for a given name in the given environment.�local�global�__builtins__�builtinN)�	f_globals�type�hasattr�getattr�	__UNDEF__)�name�frame�locals�builtinsrrr�lookup@s



rcCs�gdddtf\}}}}}t�|�D]�\}}	}
}}|tjkr>q�|tjkr�|	tjkr�|dkr�|tk	r�t||	t�}|�||	||f�q�t	|	||�\}
}|�|	|
|f�n"|	dkr�||d7}|}nd\}}|	}q"|S)zEScan one logical line of Python and look up values of variables used.Nr�.)Nr)
r�tokenize�generate_tokens�NEWLINE�NAME�keyword�kwlistr�appendr)�readerrr�varsZ	lasttoken�parent�prefix�valueZttype�token�start�end�line�whererrr�scanvarsPs"
r+�c"s�|\}}}t|t�r|j}dtj��ddtj}t�t���}dt	j
�dtt	j
�
t|���dd|d|�d	}d
td�d}g}	t�||�}
|
D�]F\}�}}
}}�r�tj����d
�t	j
�
��f}nd�}t�|�\}}}}d}|
dk�r8dtt	j
�
|
��}|
dk�r8|tj||||dd�d�7}i�|gf��fdd�	}t|||�}dd||fg}|dk	�r
||}|D]�}tddtt|��t|��d}|�k�r�d|t	j
�|�f}|�d|�n&d|t	j
�|�f}|�dt|��|d 7}�q�ig}}|D]�\}}} ||k�r0�qd ||<| tk	�r�|d!k�r^d"|t|�}n*|d#k�rrt|�}n|t|�d$�d%�}|�d&|t	j
�| �f�n|�|d'��q|�dttd(�|����|	�d)d*�|��q�d+tt	j
�
t|���t	j
�
t|��fg}!t|�D]B}|dd �d,k�r4�qt	j
�t ||��} |!�d-||| f��q|d�|	�d�|!�d.t	j
�
d�t!�"|||���S)/z9Return a nice HTML document describing a given traceback.�Python r�: z<body bgcolor="#f0f0f8">z<big><big>%s</big></big>z#ffffffz#6622aaz<br>z�
<p>A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.</p>z<tt>z&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;z&nbsp;</tt>z<a href="file://%s">%s</a>�?r�in �<module>cSsdtj�|�S�N�=)�pydoc�html�repr�r%rrr�<lambda>��zhtml.<locals>.<lambda>�Zformatvaluec
s8d�|d<zt��|d�W�S|dd7<XdS�N�r��	linecache�getline��lnum��fileZ	highlightrrr!�szhtml.<locals>.readerz+<tr><td bgcolor="#d8bbff">%s%s %s</td></tr>z<big>&nbsp;</big>Nz&nbsp;r,z<tt>=&gt;%s%s</tt>z&<tr><td bgcolor="#ffccee">%s</td></tr>z<tt>&nbsp;&nbsp;%s%s</tt>z<tr><td>%s</td></tr>r<)rrz<em>%s</em> rr���z%s&nbsp;= %sz <em>undefined</em>z, zF
<table width="100%%" cellspacing=0 cellpadding=0 border=0>
%s</table>�
z	<p>%s: %s�_z
<br>%s%s&nbsp;=
%sz�


<!-- The above is a description of an error in a Python program, formatted
     for a Web browser because the 'cgitb' module was enabled.  In case you
     are not reading this in a Web browser, here is the original traceback:

%s
-->
)#�
isinstancer�__name__�sys�version�split�
executable�time�ctimer4r5Zheadingr	�escape�strr�inspect�getinnerframes�os�path�abspath�getargvalues�formatargvaluesr+�lenZ	preformatr r
rr6�join�dirr�	traceback�format_exception)"�einfo�context�etype�evalue�etb�pyver�date�head�indent�frames�recordsrrA�func�lines�index�link�args�varargs�varkwr�callr!r"�rows�ir)�num�done�dumprr*r%�	exceptionrrBrr5es�

�
��

��
$






��	��r5c 	s�|\}}}t|t�r|j}dtj��ddtj}t�t���}dt	|�||fd}g}t
�||�}	|	D�]�\}
�}}}
}�r�tj
���p�d�t
�|
�\}}}}d}|dkr�d|}|d	kr�|t
j||||d
d�d�7}i�|gf��fd
d�	}t||
|�}d�|fg}|dk	�rP||}|
D](}d|}|�||���|d7}�q&ig}}|D]�\}}}||k�rv�q^d||<|tk	�r�|dk�r�d|}n|dk�r�||�d�d}|�d|tj�|�f�n|�|d��q^|�d�|��|�dd�|��qndt	|�t	|�fg}t|�D],}tj�t||��}|�dd||f��q*|d�|�d�|�dd�t�|||��S) z:Return a plain text document describing a given traceback.r-rr.z	%s
%s
%s
z�
A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.
r/rr0r1cSsdtj�|�Sr2)r4rr6r7rrrr8�r9ztext.<locals>.<lambda>r:c
s8d�|d<zt��|d�W�S|dd7<XdSr;r=r@rBrrr!�sztext.<locals>.readerz %s %sNz%5d r<rzglobal rrrDz%s = %sz
 undefinedrEz
%s
z%s: %sz

%s%s = %sz    zc

The above is a description of an error in a Python program.  Here is
the original traceback:

%s
)rGrrHrIrJrKrLrMrNrPrQrRrSrTrUrVrWr+r �rstriprr4rr6rYrZrr[r\) r]r^r_r`rarbrcrdrfrgrrArhrirjrlrmrnrror!r"rprqr)rrrsrtrr*r%rurrBrr�sb

�






�rc@s,eZdZdZddd�Zdd	�Zd
d
d�ZdS)�Hookz?A hook to replace sys.excepthook that shows tracebacks in HTML.r<Nr,r5cCs(||_||_||_|ptj|_||_dS�N)�display�logdirr^rI�stdoutrC�format)�selfryrzr^rCr|rrr�__init__s
z
Hook.__init__cCs|�|||f�dSrx)�handle)r}r_r`rarrr�__call__
sz
Hook.__call__c
	Csz|p
t��}|jdkr$|j�t��|jdkr2tp4t}d}z|||j�}Wn d�	t
j|��}d}YnX|jr�|r�t
j�|�}|j�d|d�q�|j�|d�n|j�d�|jdk	�rZd	d
g|jdk}tj||jd�\}}z.t�|d��}|�|�W5QRXd
|}	Wnd|}	YnX|jdk�rJ|j�d|	�n|j�|	d�z|j��WnYnXdS)Nr5FrTz<pre>z</pre>
rEz*<p>A problem occurred in a Python script.
z.txtz.html)�suffixrZ�wz*%s contains the description of this error.z*Tried to save traceback to %s, but failed.z
<p>%s</p>
)rI�exc_infor|rC�writerr5rr^rYr[r\ryr4rOrz�tempfileZmkstemprS�fdopen�flush)
r}�infoZ	formatterZplain�docr��fdrTrC�msgrrrrs@

zHook.handle)r<Nr,Nr5)N)rH�
__module__�__qualname__�__doc__r~r�rrrrrrws�
rwr<cCst||||d�t_dS)aInstall an exception handler that formats tracebacks as HTML.

    The optional argument 'display' can be set to 0 to suppress sending the
    traceback to the browser, and 'logdir' can be set to a directory to cause
    tracebacks to be written to files there.�ryrzr^r|N)rwrI�
excepthookr�rrr�enable:s�r�)r,)r,)r<Nr,r5)r�rQrr>rSr4rIr�rMrr[rrrr	r
rr+r5rrwrZhandlerr�rrrr�<module>s,

[
B7struct.cpython-38.opt-1.pyc000064400000000514150335716500011464 0ustar00U

e5d�@s8ddddddddgZdd	lTdd
lmZddlmZdS)
ZcalcsizeZpackZ	pack_intoZunpackZunpack_fromZiter_unpackZStruct�error�)�*)�_clearcache)�__doc__N)�__all__Z_structrr�rr�/usr/lib64/python3.8/struct.py�<module>s�opcode.cpython-38.opt-2.pyc000064400000012242150335716500011413 0ustar00U

e5d��
@s�dddddddddd	d
ddg
Zzd
dlmZe�d�Wnek
rLYnXdZgZgZgZgZ	gZ
gZgZgZ
iZdd�ed�D�Zdd�Zdd�Zdd�Zdd�Zedd�edd�ed d!�ed"d#�ed$d%�ed&d'�ed(d)�ed*d+�ed,d-�ed.d/�ed0d1�ed2d3�ed4d5�ed6d7�ed8d9�ed:d;�ed<d=�ed>d?�ed@dA�edBdC�edDdE�edFdG�edHdI�edJdK�edLdM�edNdO�edPdQ�edRdS�edTdU�edVdW�edXdY�edZd[�ed\d]�ed^d_�ed`da�edbdc�eddde�edfdg�edhdi�edjdk�edldm�edndo�edpdq�edrds�edtdu�edvdw�edxdy�edzd{�ed|d}�ed~d�ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��d�Zed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��e�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��e�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�dÃed�dŃed�dǃed�dɃed�d˃e
�dˡed�d̓e
�d͡ed�dσe
�dϡed�dуed�dӃed�dՃed�d׃ed�dكe�d١ed�dۃe�dۡed�d݃e�dݡed�d߃e�dߡed�d�ed�d�ed�d�ed�d�ed�d�ed�d�ed�d�e�d�edd�d�Zed�d�ed�d�ed�d�ed�d��ed�d��ed�d��ed�d��ed�d��ed��d�e�d�d�e�d�d�e�d�d�e�d�d�e�d	�d
�[[[[�dS(�cmp_op�hasconst�hasname�hasjrel�hasjabs�haslocal�
hascompare�hasfree�opname�opmap�
HAVE_ARGUMENT�EXTENDED_ARG�hasnargs�)�stack_effectr)�<z<=z==z!=�>z>=�inznot in�iszis notzexception matchZBADcCsg|]}d|f�qS)z<%r>�)�.0�oprr�/usr/lib64/python3.8/opcode.py�
<listcomp>%sr�cCs|t|<|t|<dS�N)r	r
��namerrrr�def_op'srcCst||�t�|�dSr)rr�appendrrrr�name_op+s
rcCst||�t�|�dSr)rrrrrrr�jrel_op/s
r cCst||�t�|�dSr)rrrrrrr�jabs_op3s
r!ZPOP_TOP�ZROT_TWO�Z	ROT_THREE�ZDUP_TOP�ZDUP_TOP_TWO�ZROT_FOUR�ZNOP�	ZUNARY_POSITIVE�
ZUNARY_NEGATIVE�Z	UNARY_NOT�ZUNARY_INVERT�ZBINARY_MATRIX_MULTIPLY�ZINPLACE_MATRIX_MULTIPLY�ZBINARY_POWER�ZBINARY_MULTIPLY�Z
BINARY_MODULO�Z
BINARY_ADD�ZBINARY_SUBTRACT�Z
BINARY_SUBSCR�ZBINARY_FLOOR_DIVIDE�ZBINARY_TRUE_DIVIDE�ZINPLACE_FLOOR_DIVIDE�ZINPLACE_TRUE_DIVIDE�Z	GET_AITER�2Z	GET_ANEXT�3ZBEFORE_ASYNC_WITH�4Z
BEGIN_FINALLY�5Z
END_ASYNC_FOR�6ZINPLACE_ADD�7ZINPLACE_SUBTRACT�8ZINPLACE_MULTIPLY�9ZINPLACE_MODULO�;ZSTORE_SUBSCR�<Z
DELETE_SUBSCR�=Z
BINARY_LSHIFT�>Z
BINARY_RSHIFT�?Z
BINARY_AND�@Z
BINARY_XOR�AZ	BINARY_OR�BZ
INPLACE_POWER�CZGET_ITER�DZGET_YIELD_FROM_ITER�EZ
PRINT_EXPR�FZLOAD_BUILD_CLASS�GZ
YIELD_FROM�HZ
GET_AWAITABLE�IZINPLACE_LSHIFT�KZINPLACE_RSHIFT�LZINPLACE_AND�MZINPLACE_XOR�NZ
INPLACE_OR�OZWITH_CLEANUP_START�QZWITH_CLEANUP_FINISH�RZRETURN_VALUE�SZIMPORT_STAR�TZSETUP_ANNOTATIONS�UZYIELD_VALUE�VZ	POP_BLOCK�WZEND_FINALLY�XZ
POP_EXCEPT�Y�ZZ
STORE_NAMEZDELETE_NAME�[ZUNPACK_SEQUENCE�\ZFOR_ITER�]Z	UNPACK_EX�^Z
STORE_ATTR�_ZDELETE_ATTR�`ZSTORE_GLOBAL�aZ
DELETE_GLOBAL�bZ
LOAD_CONST�dZ	LOAD_NAME�eZBUILD_TUPLE�fZ
BUILD_LIST�gZ	BUILD_SET�hZ	BUILD_MAP�iZ	LOAD_ATTR�jZ
COMPARE_OP�kZIMPORT_NAME�lZIMPORT_FROM�mZJUMP_FORWARD�nZJUMP_IF_FALSE_OR_POP�oZJUMP_IF_TRUE_OR_POP�pZ
JUMP_ABSOLUTE�qZPOP_JUMP_IF_FALSE�rZPOP_JUMP_IF_TRUE�sZLOAD_GLOBAL�tZ
SETUP_FINALLY�zZ	LOAD_FAST�|Z
STORE_FAST�}ZDELETE_FAST�~Z
RAISE_VARARGS�Z
CALL_FUNCTION�Z
MAKE_FUNCTION�ZBUILD_SLICE�ZLOAD_CLOSURE�Z
LOAD_DEREF�ZSTORE_DEREF�ZDELETE_DEREF�ZCALL_FUNCTION_KW�ZCALL_FUNCTION_EX�Z
SETUP_WITH�ZLIST_APPEND�ZSET_ADD�ZMAP_ADD�ZLOAD_CLASSDEREF��ZBUILD_LIST_UNPACK�ZBUILD_MAP_UNPACK�ZBUILD_MAP_UNPACK_WITH_CALL�ZBUILD_TUPLE_UNPACK�ZBUILD_SET_UNPACK�ZSETUP_ASYNC_WITH�ZFORMAT_VALUE�ZBUILD_CONST_KEY_MAP�ZBUILD_STRING�ZBUILD_TUPLE_UNPACK_WITH_CALL�ZLOAD_METHOD�ZCALL_METHOD�ZCALL_FINALLY�ZPOP_FINALLY�N)�__all__Z_opcoderr�ImportErrorrrrrrrrrr
r
�ranger	rrr r!rrrrrr�<module>sD
�



























































































































symbol.cpython-38.pyc000064400000004546150335716500010517 0ustar00U

��.e=�@s�dZdZdZdZdZdZdZdZdZd	Z	d
Z
dZdZd
Z
dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;d<Z<d=Z=d>Z>d?Z?d@Z@dAZAdBZBdCZCdDZDdEZEdFZFdGZGdHZHdIZIdJZJdKZKdLZLdMZMdNZNdOZOdPZPdQZQdRZRdSZSdTZTdUZUdVZVdWZWdXZXdYZYdZZZd[Z[d\Z\iZ]e^e_��`��D]$\ZaZbeceb�ecd]�k�r�eae]eb<�q�[a[bd^S)_z;Non-terminal symbols of Python grammar (from "graminit.h").�iiiiiiiii	i
iii
iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUiViWiXiYiZi[�N)d�__doc__Zsingle_inputZ
file_inputZ
eval_inputZ	decoratorZ
decoratorsZ	decoratedZ
async_funcdefZfuncdefZ
parametersZ
typedargslistZtfpdefZvarargslistZvfpdefZstmtZsimple_stmtZ
small_stmtZ	expr_stmtZ	annassignZtestlist_star_exprZ	augassignZdel_stmtZ	pass_stmtZ	flow_stmtZ
break_stmtZ
continue_stmtZreturn_stmtZ
yield_stmtZ
raise_stmtZimport_stmtZimport_nameZimport_fromZimport_as_nameZdotted_as_nameZimport_as_namesZdotted_as_namesZdotted_nameZglobal_stmtZ
nonlocal_stmtZassert_stmtZ
compound_stmtZ
async_stmtZif_stmtZ
while_stmtZfor_stmtZtry_stmtZ	with_stmtZ	with_itemZ
except_clauseZsuiteZnamedexpr_testZtestZtest_nocondZlambdefZlambdef_nocondZor_testZand_testZnot_testZ
comparisonZcomp_opZ	star_expr�exprZxor_exprZand_exprZ
shift_exprZ
arith_exprZtermZfactorZpowerZ	atom_exprZatomZ
testlist_compZtrailerZ
subscriptlistZ	subscriptZsliceopZexprlistZtestlistZdictorsetmakerZclassdefZarglistZargumentZ	comp_iterZ
sync_comp_forZcomp_forZcomp_ifZ
encoding_declZ
yield_exprZ	yield_argZfunc_body_suiteZfunc_type_inputZ	func_typeZtypelistZsym_name�list�globals�items�_nameZ_value�type�r
r
�/usr/lib64/python3.8/symbol.py�<module>s�tokenize.cpython-38.opt-1.pyc000064400000041336150335716500011777 0ustar00U

e5d�d�@sHdZdZdZddlmZddlmZmZddl	Z	ddl
mZddlZ
ddlZddlZddlTdd	lmZe�d
ej�Ze�dej�ZddlZejdd
dddgZ[Gdd�de	�dd��Zdd�Zdd�Zdd�ZdZdZeede�ee�ZdZdZ dZ!dZ"d Z#ee e!e"e#�Z$d!Z%ed"d#�ee%�Z&d$e%Z'ee&e'�Z(ed%e(d&�Z)ee)e(e$�Z*d'd(�Z+d)d*�Z,ee+��Z-d+Z.d,Z/d-Z0d.Z1ee-d/e-d0�Z2ee-d1e-d2�Z3ee4ej5e6ed3d4���Z7ed5e7�Z8ee*e8e3e�Z9ee9Z:ee-d6ed7d�e-d8ed9d��Z;ed:ee2�Z<eee<e*e8e;e�Z=iZ>e+�D]6Z?e.e>e?d7<e/e>e?d9<e0e>e?d/<e1e>e?d0<�q,e@�ZAe@�ZBe+�D]JZCeCd9eCd7fD]ZDeA�EeD��q�eCd0eCd/fD]ZDeB�EeD��q��qvd;ZFGd<d=�d=eG�ZHGd>d?�d?eG�ZIGd@dA�dA�ZJdBd�ZKdCdD�ZLdEd�ZMdFdG�ZdHd�ZNdIdJ�ZOdKd
�ZPdLdM�ZQeRdNk�rDeQ�dS)OaoTokenization help for Python programs.

tokenize(readline) is a generator that breaks a stream of bytes into
Python tokens.  It decodes the bytes according to PEP-0263 for
determining source file encoding.

It accepts a readline-like method which is called repeatedly to get the
next line of input (or b"" for EOF).  It generates 5-tuples with these
members:

    the token type (see token.py)
    the token (a string)
    the starting (row, column) indices of the token (a 2-tuple of ints)
    the ending (row, column) indices of the token (a 2-tuple of ints)
    the original line (string)

It is designed to match the working of the Python tokenizer exactly, except
that it produces COMMENT tokens for comments and gives type OP for all
operators.  Additionally, all token lists start with an ENCODING token
which tells you which encoding was used to decode the bytes stream.
zKa-Ping Yee <ping@lfw.org>zpGvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip Montanaro, Raymond Hettinger, Trent Nelson, Michael Foord�)�open)�lookup�BOM_UTF8N)�
TextIOWrapper)�*)�EXACT_TOKEN_TYPESz&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)�tokenize�generate_tokens�detect_encoding�
untokenize�	TokenInfoc@s eZdZdd�Zedd��ZdS)rcCs$d|jt|jf}d|j|d�S)Nz%d (%s)z8TokenInfo(type=%s, string=%r, start=%r, end=%r, line=%r))�type)r
�tok_name�_replace)�self�annotated_type�r� /usr/lib64/python3.8/tokenize.py�__repr__.s
�zTokenInfo.__repr__cCs(|jtkr|jtkrt|jS|jSdS�N)r
�OP�stringr�rrrr�
exact_type3s
zTokenInfo.exact_typeN)�__name__�
__module__�__qualname__r�propertyrrrrrr-sztype string start end linecGsdd�|�dS)N�(�|�))�join��choicesrrr�group:�r$cGst|�dS)Nr�r$r"rrr�any;r%r'cGst|�dS)N�?r&r"rrr�maybe<r%r)z[ \f\t]*z	#[^\r\n]*z\\\r?\nz\w+z0[xX](?:_?[0-9a-fA-F])+z0[bB](?:_?[01])+z0[oO](?:_?[0-7])+z(?:0(?:_?0)*|[1-9](?:_?[0-9])*)z[eE][-+]?[0-9](?:_?[0-9])*z)[0-9](?:_?[0-9])*\.(?:[0-9](?:_?[0-9])*)?z\.[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*[jJ]z[jJ]cCs^ddddddg}dh}|D]>}t�|�D].}tjdd	�|D��D]}|�d�|��q@q(q|S)
N�b�r�u�f�br�fr�cSsg|]}||��f�qSr)�upper)�.0�crrr�
<listcomp>^sz(_all_string_prefixes.<locals>.<listcomp>)�
_itertools�permutations�product�addr!)�_valid_string_prefixes�result�prefix�tr,rrr�_all_string_prefixesSsr=cCst�|tj�Sr)�re�compile�UNICODE)�exprrrr�_compilebsrBz[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z'''z"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"T)�reversez\r?\nz'[^\n'\\]*(?:\\.[^\n'\\]*)*�'z"[^\n"\\]*(?:\\.[^\n"\\]*)*�"z
\\\r?\n|\Z�c@seZdZdS)�
TokenErrorN�rrrrrrrrG�srGc@seZdZdS)�StopTokenizingNrHrrrrrI�srIc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�UntokenizercCsg|_d|_d|_d|_dS)N�r)�tokens�prev_row�prev_col�encodingrrrr�__init__�szUntokenizer.__init__cCs�|\}}||jks&||jkr>||jkr>td�|||j|j���||j}|rb|j�d|�d|_||j}|r�|j�d|�dS)Nz+start ({},{}) precedes previous end ({},{})�\
r� )rMrN�
ValueError�formatrL�append)r�start�row�col�
row_offset�
col_offsetrrr�add_whitespace�s�

zUntokenizer.add_whitespacecCs6t|�}g}d}|D�]}t|�dkr8|�||��q*|\}}}}	}
|tkrV||_q|tkrd�q*|tkrz|�|�qnl|tkr�|�	�|	\|_
|_qnL|tt
fkr�d}n:|r�|r�|d}|dt|�kr�|j�|�t|�|_d}|�|�|j�|�|	\|_
|_|tt
fkr|j
d7_
d|_qd�|j�S)NF�T���rKrr0)�iter�len�compat�ENCODINGrO�	ENDMARKER�INDENTrU�DEDENT�poprMrN�NEWLINE�NLrLr[r!)r�iterable�it�indents�	startliner<�tok_type�tokenrV�end�line�indentrrrr�sF



zUntokenizer.untokenizec
Cs�g}|jj}|dttfk}d}t�|g|�D]�}|dd�\}}	|tkrR|	|_q.|tt	fkrf|	d7}	|t
kr�|rzd|	}	d}nd}|tkr�|�|	�q.n>|tkr�|�
�q.n*|ttfkr�d}n|r�|r�||d�d}||	�q.dS)NrFr\rRTr])rLrUrfrgr5�chainrarO�NAME�NUMBER�STRINGrcrdre)
rrmrhrj�toks_appendrk�
prevstring�tok�toknum�tokvalrrrr`�s8
zUntokenizer.compatN)rrrrPr[rr`rrrrrJ�s
%rJcCs*t�}|�|�}|jdk	r&|�|j�}|S)aTransform tokens back into Python source code.
    It returns a bytes object, encoded using the ENCODING
    token, which is the first token sequence output by tokenize.

    Each element returned by the iterable must be a token sequence
    with at least two elements, a token number and token value.  If
    only two tokens are passed, the resulting output is poor.

    Round-trip invariant for full input:
        Untokenized source will match input source exactly

    Round-trip invariant for limited input:
        # Output bytes will tokenize back to the input
        t1 = [tok[:2] for tok in tokenize(f.readline)]
        newcode = untokenize(t1)
        readline = BytesIO(newcode).readline
        t2 = [tok[:2] for tok in tokenize(readline)]
        assert t1 == t2
    N)rJrrO�encode)rh�ut�outrrrrs


cCsH|dd����dd�}|dks*|�d�r.dS|dks@|�d�rDd	S|S)
z(Imitates get_normal_name in tokenizer.c.N��_�-�utf-8zutf-8-)zlatin-1�
iso-8859-1ziso-latin-1)zlatin-1-ziso-8859-1-ziso-latin-1-r�)�lower�replace�
startswith)�orig_enc�encrrr�_get_normal_names�r�cs�z�jj�Wntk
r$d�YnXd�d}d}�fdd�}��fdd�}|�}|�t�rpd�|d	d�}d
}|s||gfS||�}|r�||gfSt�|�s�||gfS|�}|s�||gfS||�}|r�|||gfS|||gfS)a
    The detect_encoding() function is used to detect the encoding that should
    be used to decode a Python source file.  It requires one argument, readline,
    in the same way as the tokenize() generator.

    It will call readline a maximum of twice, and return the encoding used
    (as a string) and a list of any lines (left as bytes) it has read in.

    It detects the encoding from the presence of a utf-8 bom or an encoding
    cookie as specified in pep-0263.  If both a bom and a cookie are present,
    but disagree, a SyntaxError will be raised.  If the encoding cookie is an
    invalid charset, raise a SyntaxError.  Note that if a utf-8 bom is found,
    'utf-8-sig' is returned.

    If no encoding is specified, then the default of 'utf-8' will be returned.
    NFr�cs$z��WStk
rYdSXdS)Nr%)�
StopIterationr��readlinerr�read_or_stop?sz%detect_encoding.<locals>.read_or_stopcs�z|�d�}Wn4tk
rBd}�dk	r6d�|��}t|��YnXt�|�}|sVdSt|�d��}zt|�}Wn:t	k
r��dkr�d|}nd��|�}t|��YnX�r�|dkr؈dkr�d}n
d���}t|��|d	7}|S)
Nr�z'invalid or missing encoding declarationz{} for {!r}rKzunknown encoding: zunknown encoding for {!r}: {}zencoding problem: utf-8z encoding problem for {!r}: utf-8z-sig)
�decode�UnicodeDecodeErrorrT�SyntaxError�	cookie_re�matchr�r$r�LookupError)ro�line_string�msgr�rO�codec)�	bom_found�filenamerr�find_cookieEs8

�
z$detect_encoding.<locals>.find_cookieT��	utf-8-sig)�__self__�name�AttributeErrorr�r�blank_rer�)r�rO�defaultr�r��first�secondr)r�r�r�rr
's8
&




cCsXt|d�}z2t|j�\}}|�d�t||dd�}d|_|WS|���YnXdS)zXOpen a file in read only mode using the encoding detected by
    detect_encoding().
    �rbrT)�line_bufferingr+N)�
_builtin_openr
r��seekr�mode�close)r��bufferrO�lines�textrrrr�s

rcCs6t|�\}}t�d�}t�|t|d�|�}t|j|�S)a�
    The tokenize() generator requires one argument, readline, which
    must be a callable object which provides the same interface as the
    readline() method of built-in file objects.  Each call to the function
    should return one line of input as bytes.  Alternatively, readline
    can be a callable function terminating with StopIteration:
        readline = open(myfile, 'rb').__next__  # Example of alternate readline

    The generator produces 5-tuples with these members: the token type; the
    token string; a 2-tuple (srow, scol) of ints specifying the row and
    column where the token begins in the source; a 2-tuple (erow, ecol) of
    ints specifying the row and column where the token ends in the source;
    and the line on which the token was found.  The line passed is the
    physical line.

    The first token sequence will always be an ENCODING token
    which tells you which encoding was used to decode the bytes stream.
    r%)r
r5�repeatrqr^�	_tokenize�__next__)r�rO�consumed�empty�rl_genrrrr�s
ccsld}}}d}d\}}d}dg}	|dk	rH|dkr6d}tt|ddd�Vd}
d}z|}
|�}Wntk
rvd}YnX|dk	r�|�|�}|d	7}dt|�}}
|�rp|s�td
|��|�|�}|�r|�d�}}tt||d|�|||f||�Vd\}}d}nf|�rZ|dd�dk�rZ|d
d�dk�rZtt	||||t|�f|�Vd}d}qPn||}||}qP�n�|dk�r|�s|�s��q�d}||
k�r�||dk�r�|d	7}n8||dk�r�|t
d	t
}n||dk�r�d}n�q�|d	7}�q�||
k�r�q�||dk�r�||dk�r^||d��d�}tt|||f||t|�f|�V|t|�7}tt
||d�||f|t|�f|�VqP||	dk�r�|	�|�tt|d|�|df||f|�V||	dk�r.||	k�r�tdd|||f��|	dd�}	ttd||f||f|�V�q�n|�s*td|df��d}||
krPtt��||�}|�r�|�d	�\}}||f||f|}}}||k�r��q.|||�||}}||k�s�|dk�r�|dk�r�|dk�r�tt||||�V�q�|dk�r|dk�r�tt
||||�Vntt||||�V�q�|dk�r2tt||||�V�q�|tk�r�tt|�}|�||�}|�r�|�d�}|||�}tt||||f|�Vn||f}||d�}|}qP�q�|tk�s�|dd�tk�s�|dd�tk�rF|ddk�r2||f}tt�|��pt�|d	��pt�|d��}||d�d	}}|}qPntt||||�Vnf|���rdtt||||�VnH|dk�rtd	}n8|dk�r�|d	7}n|d k�r�|d	8}tt||||�Vn*tt	||||f||d	f|�V|d	7}�q.qP|
�r |
ddk�r ttd|d	t|
�f|d	t|
�d	fd�V|	d	d�D] }ttd|df|dfd�V�q,ttd|df|dfd�VdS)!Nr�
0123456789)r0rr�r�)rrr0r%rKzEOF in multi-line string���rQ���z\
rR�	�z#
�#z
r]z3unindent does not match any outer indentation levelz
<tokenize>zEOF in multi-line statement�.z...r\r��
�\z([{z)]})rrar�r�r_rGr�rnrt�
ERRORTOKEN�tabsize�rstrip�COMMENTrgrUrc�IndentationErrorrdrB�PseudoToken�spanrsrf�
triple_quoted�endpats�
single_quoted�get�isidentifierrrrrb)r�rO�lnum�parenlev�	continued�numchars�contstr�needcont�contlinerj�	last_linero�pos�max�strstart�endprog�endmatchrn�column�
comment_token�pseudomatchrV�spos�eposrm�initialrprrrr��s<




�*

�


�
�
"

� 

���





����






�.r�cCs
t|d�S)z�Tokenize a source reading Python code as unicode strings.

    This has the same API as tokenize(), except that it expects the *readline*
    callable to return str objects instead of bytes.
    N)r�r�rrrr	dsc

s$ddl}dd��d�fdd�	}|jdd�}|jdd	d
dd�|jd
ddddd�|��}z�|jr�|j}t|d��}tt|j��}W5QRXnd}t	t
jjd�}|D]>}|j}|j
r�|j}d|j|j}	td|	t||jf�q�W�n8tk
�r6}
z0|
jddd�\}}||
jd|||f�W5d}
~
XYn�tk
�r|}
z(|
jd\}}||
jd|||f�W5d}
~
XYn�tk
�r�}
z||
|�W5d}
~
XYnxtk
�r�}
z||
�W5d}
~
XYnNtk
�r�td�Yn2tk
�r}
z�d|
��W5d}
~
XYnXdS)NrcSstj�|�tj�d�dS)Nr�)�sys�stderr�write)�messagerrr�perrorpszmain.<locals>.perrorcsR|r"|f||f}�d|�n"|r8�d||f�n�d|�t�d�dS)Nz%s:%d:%d: error: %sz
%s: error: %sz	error: %srK)r��exit)r�r��location�args�r�rr�errortszmain.<locals>.errorzpython -m tokenize)�progr�r(zfilename.pyz'the file to tokenize; defaults to stdin)�dest�nargs�metavar�helpz-ez--exact�exact�
store_truez(display token names using the exact type)r��actionr�r�z<stdin>z%d,%d-%d,%d:z%-20s%-15s%-15rrKr�zinterrupted
zunexpected error: %s)NN)�argparse�ArgumentParser�add_argument�
parse_argsr�r��listrr�r�r��stdinr
r�rrVrn�printrrr�r�rGr��OSError�KeyboardInterrupt�	Exception)
r�r��parserr�r�r-rLrm�
token_type�token_range�errror�rr�r�mainlsT���&&r��__main__)S�__doc__�
__author__�__credits__�builtinsrr��codecsrr�collections�ior�	itertoolsr5r>r�rmrr?�ASCIIr�r��__all__�
namedtuplerr$r'r)�
Whitespace�Comment�Ignore�Name�	Hexnumber�	Binnumber�	Octnumber�	Decnumber�	Intnumber�Exponent�
Pointfloat�Expfloat�Floatnumber�
Imagnumber�Numberr=rB�StringPrefix�Single�Double�Single3�Double3�Triple�String�map�escape�sorted�Special�Funny�
PlainToken�Token�ContStr�PseudoExtrasr�r��_prefix�setr�r�r<r,r8r�r�rGrIrJrr�r
rr�r	r�rrrrr�<module>s�
�
��

�
���

_]8=
pprint.cpython-38.opt-1.pyc000064400000037552150335716500011470 0ustar00U

e5d�S�
@sdZddlZddlZddlZddlZddlm	Z
dddddd	d
gZd%d
dd�dd�Zd&d
dd�dd�Z
d
d�dd
�Zdd�Zdd�Zdd�ZGdd�d�Zdd�ZGdd	�d	�Zdd�Zeeeeeeeeed�h�Zdd�Z d'd d!�Z!d"d#�Z"e#d$k�r�e!�dS)(a/Support to pretty-print lists, tuples, & dictionaries recursively.

Very simple, but useful, especially in debugging data structures.

Classes
-------

PrettyPrinter()
    Handle pretty-printing operations onto a stream using a configured
    set of formatting parameters.

Functions
---------

pformat()
    Format a Python object into a pretty-printed representation.

pprint()
    Pretty-print a Python object to a stream [default is sys.stdout].

saferepr()
    Generate a 'standard' repr()-like value, but protect against recursive
    data structures.

�N)�StringIO�pprint�pformat�
isreadable�isrecursive�saferepr�
PrettyPrinter�pp��PFT��compact�
sort_dictscCs"t||||||d�}|�|�dS)zAPretty-print a Python object to a stream [default is sys.stdout].)�stream�indent�width�depthr
rN)rr)�objectrrrrr
rZprinter�r�/usr/lib64/python3.8/pprint.pyr/s�cCst|||||d��|�S)z<Format a Python object into a pretty-printed representation.)rrrr
r)rr)rrrrr
rrrrr7s��)rcOst|f|�d|i|��dS)zPretty-print a Python objectrN)r)rr�args�kwargsrrrr	=scCst|iddd�dS)z=Version of repr() which can handle recursive data structures.NrT��
_safe_repr�rrrrrAscCst|iddd�dS)z4Determine if saferepr(object) is readable by eval().NrTr
rrrrrrEscCst|iddd�dS)z8Determine if object requires a recursive representation.NrT�rrrrrrIsc@s&eZdZdZdgZdd�Zdd�ZdS)�	_safe_keyaUHelper function for key functions when sorting unorderable objects.

    The wrapped-object will fallback to a Py2.x style comparison for
    unorderable types (sorting first comparing the type name and then by
    the obj ids).  Does not work recursively, so dict.items() must have
    _safe_key applied to both the key and the value.

    �objcCs
||_dS�N)r)�selfrrrr�__init__Ysz_safe_key.__init__cCsXz|j|jkWStk
rRtt|j��t|j�ftt|j��t|j�fkYSXdSr)r�	TypeError�str�type�id)r�otherrrr�__lt__\s�z_safe_key.__lt__N)�__name__�
__module__�__qualname__�__doc__�	__slots__r r&rrrrrMs	rcCst|d�t|d�fS)z&Helper function for comparing 2-tuplesrr
)r)�trrr�_safe_tuplecsr-c@s�eZdZd;ddd�dd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�ZiZ	dd�Z
e
e	ej<dd�Z
e
e	ejj<dd�Zee	ej<dd�Zee	ej<dd�Zee	ej<ee	ej<dd�Zee	ej<dd �Zee	ej<d!d"�Zee	ej<d#d$�Zee	ejj<d%d&�Z d'd(�Z!d)d*�Z"d+d,�Z#d-d.�Z$e$e	ej%j<d/d0�Z&e&e	ej'j<d1d2�Z(e(e	ej)j<d3d4�Z*e*e	ej+j<d5d6�Z,e,e	ej-j<d7d8�Z.e.e	ej/j<d9d:�Z0e0e	ej1j<dS)<rr
rNFTrcCs�t|�}t|�}|dkr td��|dk	r8|dkr8td��|sDtd��||_||_||_|dk	rf||_ntj|_t|�|_	||_
dS)a�Handle pretty printing operations onto a stream using a set of
        configured parameters.

        indent
            Number of spaces to indent for each level of nesting.

        width
            Attempted maximum number of columns in the output.

        depth
            The maximum depth to print out nested structures.

        stream
            The desired output stream.  If omitted (or false), the standard
            output stream available at construction will be used.

        compact
            If true, several items will be combined in one line.

        sort_dicts
            If true, dict keys are sorted.

        rzindent must be >= 0Nzdepth must be > 0zwidth must be != 0)�int�
ValueError�_depth�_indent_per_level�_width�_stream�_sys�stdout�bool�_compact�_sort_dicts)rrrrrr
rrrrr hs 
zPrettyPrinter.__init__cCs&|�||jddid�|j�d�dS)Nr�
)�_formatr3�write�rrrrrr�szPrettyPrinter.pprintcCs"t�}|�||ddid�|��S�Nr)�	_StringIOr:�getvalue)rrZsiorrrr�szPrettyPrinter.pformatcCs|�|idd�dS)Nrr��formatr<rrrr�szPrettyPrinter.isrecursivecCs |�|idd�\}}}|o|Sr=r@)rr�s�readable�	recursiverrrr�szPrettyPrinter.isreadablec	Cs�t|�}||kr.|�t|��d|_d|_dS|�|||�}|j||}	t|�|	kr�|j�	t
|�jd�}
|
dk	r�d||<|
|||||||d�||=dSt|t
�r�d||<|�||||||d�||=dS|�|�dS)NTFr
)r$r;�
_recursion�
_recursive�	_readable�_reprr2�len�	_dispatch�getr#�__repr__�
isinstance�dict�_pprint_dict)rrrr�	allowance�context�level�objid�rep�	max_width�prrrr:�s0
�zPrettyPrinter._formatc
Csz|j}|d�|jdkr*||jdd�t|�}|rn|jrNt|��td�}	n|��}	|�|	|||d||�|d�dS)N�{r
� ��key�})r;r1rIr8�sorted�itemsr-�_format_dict_items)
rrrrrPrQrRr;Zlengthr]rrrrO�s
�zPrettyPrinter._pprint_dictcCslt|�s|�t|��dS|j}|�|jd�|�t|���||t|j�d|d||�|�d�dS)N�(r
�))rIr;�repr�	__class__r'r:�listr])rrrrrPrQrR�clsrrr�_pprint_ordered_dict�s�z"PrettyPrinter._pprint_ordered_dictcCs0|�d�|�||||d||�|�d�dS)N�[r
�])r;�
_format_items�rrrrrPrQrRrrr�_pprint_list�s
�zPrettyPrinter._pprint_listcCsH|�d�t|�dkrdnd}|�||||t|�||�|�|�dS)Nr_r
z,)r`)r;rIrh)rrrrrPrQrR�endcharrrr�
_pprint_tuple�s
�zPrettyPrinter._pprint_tuplec	Cs�t|�s|�t|��dS|j}|tkr8|�d�d}n&|�|jd�d}|t|j�d7}t|td�}|�||||t|�||�|�|�dS)NrWr[�({�})r
rY)	rIr;rarb�setr'r\rrh)	rrrrrPrQrR�typrkrrr�_pprint_set�s 
�zPrettyPrinter._pprint_setcCs�|j}t|�s|t|��dSg}|�d�}	|dkrD|d7}|d7}|j|}
}t|	�D]�\}}
t|
�}|t|	�dkr�|
|8}
t|�|
kr�|�|�qZt�d|
�}|�	�|}d}t|�D]h\}}||}|t|�dkr�|t|	�dkr�||8}tt|��|k�r"|�r|�t|��|}q�|}q�|rZ|�t|��qZt|�dk�rV||�dS|dk�rh|d�t|�D],\}}|dk�r�|dd|�||��qp|dk�r�|d	�dS)
NTr
z\S*\s*�r_rr9rXr`)
r;rIra�
splitlinesr2�	enumerate�append�re�findall�pop)rrrrrPrQrRr;Zchunks�linesZ
max_width1rU�i�linerT�partsZ
max_width2�current�j�part�	candidaterrr�_pprint_strsT
 


zPrettyPrinter._pprint_strcCs�|j}t|�dkr"|t|��dS|dk}|rF|d7}|d7}|d�d}	t||j||�D]$}
||	�||
�|	s\dd|}	q\|r�|d�dS)N�r
r_rrr9rXr`)r;rIra�_wrap_bytes_reprr2)rrrrrPrQrRr;Zparens�delimrTrrr�
_pprint_bytes3s"zPrettyPrinter._pprint_bytesc	Cs>|j}|d�|�t|�||d|d||d�|d�dS)Nz
bytearray(�
r
r`)r;r��bytes)rrrrrPrQrRr;rrr�_pprint_bytearrayHs�zPrettyPrinter._pprint_bytearraycCs8|�d�|�|��||d|d||�|�d�dS)Nz
mappingproxy(�
r
r`)r;r:�copyrirrr�_pprint_mappingproxyQs
�z"PrettyPrinter._pprint_mappingproxyc	Cs�|j}||j7}dd|}t|�d}	t|�D]f\}
\}}|
|	k}
|�|||�}||�|d�|�|||t|�d|
r�|nd||�|
s0||�q0dS)N�,
rXr
z: r)r;r1rIrtrHr:)rr]rrrPrQrRr;�delimnlZ
last_indexrzrZ�ent�lastrTrrrr^Ys 

�z PrettyPrinter._format_dict_itemscCsL|j}||j7}|jdkr,||jdd�dd|}d}	|j|d}
}t|�}zt|�}
Wntk
rxYdSXd}|�sH|
}zt|�}
Wn(tk
r�d}||8}|
|8}
YnX|j�r|�|||�}t|�d}|
|kr�|}
|	r�|}	|
|k�r|
|8}
||	�d}	||�q~||	�|}	|�	||||�r<|nd||�q~dS)	Nr
rXr�rrFTr�, )
r;r1r2�iter�next�
StopIterationr7rHrIr:)rr]rrrPrQrRr;r�r�rrU�itZnext_entr�r�rT�wrrrrhjsR



�zPrettyPrinter._format_itemscCs4|�||��|j|�\}}}|s&d|_|r0d|_|S)NFT)rAr�r0rGrF)rrrQrRrarCrDrrrrH�s�
zPrettyPrinter._reprcCst|||||j�S)z�Format object for a specific context, returning a string
        and flags indicating whether the representation is 'readable'
        and whether the object represents a recursive construct.
        )rr8)rrrQ�	maxlevelsrRrrrrA�szPrettyPrinter.formatc	Cs�t|�s|�t|��dS|�|j||�}|j}|t|j�d7}|�d|j|d|f�|�||||d||�|�d�dS)Nr
z	%s(%s,
%srXr`)rIr;rarH�default_factoryrbr'rO)	rrrrrPrQrRZrdfrdrrr�_pprint_default_dict�sz"PrettyPrinter._pprint_default_dictc	Cs�t|�s|�t|��dS|j}|�|jd�|jdkrN|�|jdd�|��}|�|||t|j�d|d||�|�d�dS)Nrmr
rXrrn)rIr;rarbr'r1�most_commonr^)	rrrrrPrQrRrdr]rrr�_pprint_counter�s
�zPrettyPrinter._pprint_counterc
	Cs�t|j�s|�t|��dS|j}|�|jd�|t|j�d7}t|j�D]d\}}	|t|j�dkr�|�|	|||d||�|�d�qN|�|	||d||�|�dd|�qNdS)Nr_r
r`r�rX)rI�mapsr;rarbr'rtr:)
rrrrrPrQrRrdrz�mrrr�_pprint_chain_map�s
zPrettyPrinter._pprint_chain_mapc	Cs�t|�s|�t|��dS|j}|�|jd�|t|j�d7}|�d�|jdkrz|�||||d||�|�d�n:|�|||d||�|�|j||�}|�dd||f�dS)Nr_r
rfrz])z],
%smaxlen=%s)rX)rIr;rarbr'�maxlenrhrH)	rrrrrPrQrRrdZrmlrrr�
_pprint_deque�s&

��zPrettyPrinter._pprint_dequec	Cs|�|j|||||d�dS�Nr
�r:�datarirrr�_pprint_user_dict�szPrettyPrinter._pprint_user_dictc	Cs|�|j|||||d�dSr�r�rirrr�_pprint_user_list�szPrettyPrinter._pprint_user_listc	Cs|�|j|||||d�dSr�r�rirrr�_pprint_user_string�sz!PrettyPrinter._pprint_user_string)r
rNN)2r'r(r)r rrrrr:rJrOrNrLre�_collections�OrderedDictrjrcrl�tuplerqro�	frozensetr�r"r�r�r��	bytearrayr��_types�MappingProxyTyper^rhrHrAr��defaultdictr��Counterr��ChainMapr��dequer��UserDictr��UserListr��
UserStringrrrrrgs^�+




1


)	cCs�t|�}|tkrt|�ddfSt|dd�}t|t��rD|tjk�rD|sJdSt|�}|rl||krldd||kfS||kr�t|�ddfSd||<d}d}	g}
|
j	}|d7}|r�t
|��td�}n|��}|D]b\}
}t
|
||||�\}}}t
|||||�\}}}|d||f�|�o|�o|}|�s$|r�d}	q�||=d	d
�|
�||	fSt|t��r\|tjk�stt|t��rn|tjk�rnt|t��r�|�s�dSd}n"t|�dk�r�d
}n|�s�dSd}t|�}|�r�||k�r�|dd||kfS||k�r�t|�ddfSd||<d}d}	g}
|
j	}|d7}|D]8}t
|||||�\}}}||�|�sFd}|�rd}	�q||=|d
�|
�||	fSt|�}||�o�|�d�dfS)NTFrL)z{}TFz{...}r
rYz%s: %sz{%s}r�)z[]TFz[%s]z(%s,))z()TFz(%s)z...�<)r#�_builtin_scalarsra�getattr�
issubclassrNrLr$rErur\r]r-r�joinrcr�rI�
startswith)rrQr�rRrrp�rrSrCrDZ
componentsrur]�k�vZkreprZ	kreadableZkrecurZvreprZ	vreadableZvrecurrA�oZoreprZ	oreadableZorecurrTrrrr�s�
��
rcCsdt|�jt|�fS)Nz<Recursion on %s with id=%s>)r#r'r$rrrrrE?s�rEcCs�ddl}|dkr,ddddgddd�fgd	}t�}|��}t|iddd
�|��}|�|�|��}td||�td||�dS)
Nr�string)r
r�r���)��i��Tz_safe_repr:zpformat:)�timer�perf_counterrr�print)rr�rV�t1�t2Zt3rrr�
_perfcheckDs
r�ccs�d}t|�dd}tdt|�d�D]T}|||d�}||}||krP||8}tt|��|krt|rnt|�V|}q$|}q$|r�t|�VdS)N�r�r)rI�rangera)rrrPr}r�rzrr�rrrr�Qs
r��__main__)Nr
rN)r
rN)N)$r*�collectionsr�rv�sysr4�typesr��iorr>�__all__rrr	rrrrr-rrr�r"r�r�r.�float�complexr6r#r�rEr�r�r'rrrr�<module>sJ
���F�


configparser.cpython-38.opt-1.pyc000064400000131230150335716500012622 0ustar00U

e5df��@s�dZddlmZddlmZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddddd	d
ddd
ddddddddddddgZ
eZdZdZGdd�de�ZGdd�de�ZGdd�de�ZGd d�de�ZGd!d�de�ZGd"d	�d	e�ZGd#d�de�ZGd$d�de�ZGd%d
�d
e�ZGd&d
�d
e�ZGd'd�de�Ze�ZGd(d�d�Z Gd)d�de �Z!Gd*d�de �Z"Gd+d�de �Z#Gd,d�de�Z$Gd-d�de$�Z%Gd.d�de%�Z&Gd/d�de�Z'Gd0d�de�Z(dS)1a�Configuration file parser.

A configuration file consists of sections, lead by a "[section]" header,
and followed by "name: value" entries, with continuations and such in
the style of RFC 822.

Intrinsic defaults can be specified by passing them into the
ConfigParser constructor as a dictionary.

class:

ConfigParser -- responsible for parsing a list of
                    configuration files, and managing the parsed database.

    methods:

    __init__(defaults=None, dict_type=_default_dict, allow_no_value=False,
             delimiters=('=', ':'), comment_prefixes=('#', ';'),
             inline_comment_prefixes=None, strict=True,
             empty_lines_in_values=True, default_section='DEFAULT',
             interpolation=<unset>, converters=<unset>):
        Create the parser. When `defaults' is given, it is initialized into the
        dictionary or intrinsic defaults. The keys must be strings, the values
        must be appropriate for %()s string interpolation.

        When `dict_type' is given, it will be used to create the dictionary
        objects for the list of sections, for the options within a section, and
        for the default values.

        When `delimiters' is given, it will be used as the set of substrings
        that divide keys from values.

        When `comment_prefixes' is given, it will be used as the set of
        substrings that prefix comments in empty lines. Comments can be
        indented.

        When `inline_comment_prefixes' is given, it will be used as the set of
        substrings that prefix comments in non-empty lines.

        When `strict` is True, the parser won't allow for any section or option
        duplicates while reading from a single source (file, string or
        dictionary). Default is True.

        When `empty_lines_in_values' is False (default: True), each empty line
        marks the end of an option. Otherwise, internal empty lines of
        a multiline option are kept as part of the value.

        When `allow_no_value' is True (default: False), options without
        values are accepted; the value presented for these is None.

        When `default_section' is given, the name of the special section is
        named accordingly. By default it is called ``"DEFAULT"`` but this can
        be customized to point to any other valid section name. Its current
        value can be retrieved using the ``parser_instance.default_section``
        attribute and may be modified at runtime.

        When `interpolation` is given, it should be an Interpolation subclass
        instance. It will be used as the handler for option value
        pre-processing when using getters. RawConfigParser objects don't do
        any sort of interpolation, whereas ConfigParser uses an instance of
        BasicInterpolation. The library also provides a ``zc.buildbot``
        inspired ExtendedInterpolation implementation.

        When `converters` is given, it should be a dictionary where each key
        represents the name of a type converter and each value is a callable
        implementing the conversion from string to the desired datatype. Every
        converter gets its corresponding get*() method on the parser object and
        section proxies.

    sections()
        Return all the configuration section names, sans DEFAULT.

    has_section(section)
        Return whether the given section exists.

    has_option(section, option)
        Return whether the given option exists in the given section.

    options(section)
        Return list of configuration options for the named section.

    read(filenames, encoding=None)
        Read and parse the iterable of named configuration files, given by
        name.  A single filename is also allowed.  Non-existing files
        are ignored.  Return list of successfully read files.

    read_file(f, filename=None)
        Read and parse one configuration file, given as a file object.
        The filename defaults to f.name; it is only used in error
        messages (if f has no `name' attribute, the string `<???>' is used).

    read_string(string)
        Read configuration from a given string.

    read_dict(dictionary)
        Read configuration from a dictionary. Keys are section names,
        values are dictionaries with keys and values that should be present
        in the section. If the used dictionary type preserves order, sections
        and their keys will be added in order. Values are automatically
        converted to strings.

    get(section, option, raw=False, vars=None, fallback=_UNSET)
        Return a string value for the named option.  All % interpolations are
        expanded in the return values, based on the defaults passed into the
        constructor and the DEFAULT section.  Additional substitutions may be
        provided using the `vars' argument, which must be a dictionary whose
        contents override any pre-existing defaults. If `option' is a key in
        `vars', the value from `vars' is used.

    getint(section, options, raw=False, vars=None, fallback=_UNSET)
        Like get(), but convert value to an integer.

    getfloat(section, options, raw=False, vars=None, fallback=_UNSET)
        Like get(), but convert value to a float.

    getboolean(section, options, raw=False, vars=None, fallback=_UNSET)
        Like get(), but convert value to a boolean (currently case
        insensitively defined as 0, false, no, off for False, and 1, true,
        yes, on for True).  Returns False or True.

    items(section=_UNSET, raw=False, vars=None)
        If section is given, return a list of tuples with (name, value) for
        each option in the section. Otherwise, return a list of tuples with
        (section_name, section_proxy) for each section, including DEFAULTSECT.

    remove_section(section)
        Remove the given file section and all its options.

    remove_option(section, option)
        Remove the given option from the given section.

    set(section, option, value)
        Set the given option.

    write(fp, space_around_delimiters=True)
        Write the configuration state in .ini format. If
        `space_around_delimiters' is True (the default), delimiters
        between keys and values are surrounded by spaces.
�)�MutableMapping)�ChainMapN�NoSectionError�DuplicateOptionError�DuplicateSectionError�
NoOptionError�InterpolationError�InterpolationDepthError�InterpolationMissingOptionError�InterpolationSyntaxError�ParsingError�MissingSectionHeaderError�ConfigParser�SafeConfigParser�RawConfigParser�
Interpolation�BasicInterpolation�ExtendedInterpolation�LegacyInterpolation�SectionProxy�ConverterMapping�DEFAULTSECT�MAX_INTERPOLATION_DEPTHZDEFAULT�
c@s&eZdZdZddd�Zdd�ZeZdS)	�Errorz'Base class for ConfigParser exceptions.�cCs||_t�||�dS�N)�message�	Exception�__init__)�self�msg�r"�$/usr/lib64/python3.8/configparser.pyr�szError.__init__cCs|jSr)r�r r"r"r#�__repr__�szError.__repr__N)r)�__name__�
__module__�__qualname__�__doc__rr%�__str__r"r"r"r#r�s
rc@seZdZdZdd�ZdS)rz2Raised when no section matches a requested option.cCs$t�|d|f�||_|f|_dS)NzNo section: %r)rr�section�args�r r+r"r"r#r�szNoSectionError.__init__N�r&r'r(r)rr"r"r"r#r�sc@seZdZdZddd�ZdS)raRaised when a section is repeated in an input source.

    Possible repetitions that raise this exception are: multiple creation
    using the API or in strict parsers when a section is found more than once
    in a single input file, string or dictionary.
    NcCs�t|�dg}|dk	rRdt|�g}|dk	r8|�d�|��|�d�|�|�|}n|�dd�t�|d�|��||_||_	||_
|||f|_dS)N� already exists�While reading from � [line {0:2d}]z
: section rzSection r)�repr�append�format�extend�insertrr�joinr+�source�linenor,)r r+r8r9r!rr"r"r#r�s

zDuplicateSectionError.__init__)NNr.r"r"r"r#r�sc@seZdZdZddd�ZdS)rz�Raised by strict parsers when an option is repeated in an input source.

    Current implementation raises this exception only when an option is found
    more than once in a single file, string or dictionary.
    NcCs�t|�dt|�dg}|dk	rZdt|�g}|dk	r@|�d�|��|�d�|�|�|}n|�dd�t�|d�|��||_||_	||_
||_||||f|_dS)	Nz in section r/r0r1z	: option rzOption r)
r2r3r4r5r6rrr7r+�optionr8r9r,)r r+r:r8r9r!rr"r"r#r�s"�

zDuplicateOptionError.__init__)NNr.r"r"r"r#r�sc@seZdZdZdd�ZdS)rz!A requested option was not found.cCs.t�|d||f�||_||_||f|_dS)NzNo option %r in section: %r�rrr:r+r,)r r:r+r"r"r#r�s�zNoOptionError.__init__Nr.r"r"r"r#r�sc@seZdZdZdd�ZdS)rz0Base class for interpolation-related exceptions.cCs(t�||�||_||_|||f|_dSrr;)r r:r+r!r"r"r#rszInterpolationError.__init__Nr.r"r"r"r#r�sc@seZdZdZdd�ZdS)r
zAA string substitution required a setting which was not available.cCs8d�||||�}t�||||�||_||||f|_dS)Nz�Bad value substitution: option {!r} in section {!r} contains an interpolation key {!r} which is not a valid option name. Raw value: {!r})r4rr�	referencer,)r r:r+�rawvalr<r!r"r"r#rs�z(InterpolationMissingOptionError.__init__Nr.r"r"r"r#r
sc@seZdZdZdS)rz�Raised when the source text contains invalid syntax.

    Current implementation raises this exception when the source text into
    which substitutions are made does not conform to the required syntax.
    N)r&r'r(r)r"r"r"r#rsc@seZdZdZdd�ZdS)r	z0Raised when substitutions are nested too deeply.cCs0d�||t|�}t�||||�|||f|_dS)Nz�Recursion limit exceeded in value substitution: option {!r} in section {!r} contains an interpolation key which cannot be substituted in {} steps. Raw value: {!r})r4rrrr,)r r:r+r=r!r"r"r#rs�z InterpolationDepthError.__init__Nr.r"r"r"r#r	sc@s<eZdZdZd
dd�Zedd��Zejdd��Zdd	�ZdS)rz>Raised when a configuration file does not follow legal syntax.NcCsT|r|rtd��n|s$|s$td��n|r,|}t�|d|�||_g|_|f|_dS)Nz:Cannot specify both `filename' and `source'. Use `source'.z%Required argument `source' not given.z"Source contains parsing errors: %r)�
ValueErrorrrr8�errorsr,)r r8�filenamer"r"r#r,s

zParsingError.__init__cCstjdtdd�|jS)zDeprecated, use `source'.�SThe 'filename' attribute will be removed in future versions.  Use 'source' instead.���
stacklevel��warnings�warn�DeprecationWarningr8r$r"r"r#r@;s�zParsingError.filenamecCstjdtdd�||_dS)zDeprecated, user `source'.rArBrCNrE�r �valuer"r"r#r@Es�cCs*|j�||f�|jd||f7_dS)Nz
	[line %2d]: %s)r?r3r)r r9�liner"r"r#r3OszParsingError.append)NN)	r&r'r(r)r�propertyr@�setterr3r"r"r"r#r)s

	
	c@seZdZdZdd�ZdS)r
z@Raised when a key-value pair is found before any section header.cCs8t�|d|||f�||_||_||_|||f|_dS)Nz7File contains no section headers.
file: %r, line: %d
%r)rrr8r9rKr,)r r@r9rKr"r"r#rWs��z"MissingSectionHeaderError.__init__Nr.r"r"r"r#r
Tsc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)rzBDummy interpolation that passes the value through with no changes.cCs|Srr")r �parserr+r:rJ�defaultsr"r"r#�
before_getkszInterpolation.before_getcCs|Srr"�r rNr+r:rJr"r"r#�
before_setnszInterpolation.before_setcCs|Srr"rQr"r"r#�before_readqszInterpolation.before_readcCs|Srr"rQr"r"r#�before_writetszInterpolation.before_writeN)r&r'r(r)rPrRrSrTr"r"r"r#rhs
c@s2eZdZdZe�d�Zdd�Zdd�Zdd�Z	d	S)
ra!Interpolation as implemented in the classic ConfigParser.

    The option values can contain format strings which refer to other values in
    the same section, or values in the special default section.

    For example:

        something: %(dir)s/whatever

    would resolve the "%(dir)s" to the value of dir.  All reference
    expansions are done late, on demand. If a user needs to use a bare % in
    a configuration file, she can escape it by writing %%. Other % usage
    is considered a user error and raises `InterpolationSyntaxError'.z
%\(([^)]+)\)sc	Cs$g}|�||||||d�d�|�S�N�r��_interpolate_somer7�r rNr+r:rJrO�Lr"r"r#rP�szBasicInterpolation.before_getcCs<|�dd�}|j�d|�}d|kr8td||�d�f��|S)Nz%%r�%�1invalid interpolation syntax in %r at position %d��replace�_KEYCRE�subr>�find�r rNr+r:rJZ	tmp_valuer"r"r#rR�s�zBasicInterpolation.before_setc
Csj|j||d|d�}|tkr&t|||��|�rf|�d�}	|	dkrL|�|�dS|	dkrr|�|d|	��||	d�}|dd�}
|
dkr�|�d�|dd�}q&|
dk�rR|j�|�}|dkr�t||d|��|�|�	d��}||�
�d�}z||}
Wn&tk
�rt||||�d�YnXd|
k�rF|�
||||
|||d�n
|�|
�q&t||d	|f��q&dS)
NT��raw�fallbackr[rrVrB�(�'bad interpolation variable reference %rz/'%%' must be followed by '%%' or '(', found: %r)�getrr	rar3r_�matchr�optionxform�group�end�KeyErrorr
rX)r rNr:�accum�restr+�map�depthr=�p�c�m�var�vr"r"r#rX�s`



���
���z$BasicInterpolation._interpolate_someN�
r&r'r(r)�re�compiler_rPrRrXr"r"r"r#rxs

c@s2eZdZdZe�d�Zdd�Zdd�Zdd�Z	d	S)
rzyAdvanced variant of interpolation, supports the syntax used by
    `zc.buildout'. Enables interpolation between sections.z
\$\{([^}]+)\}c	Cs$g}|�||||||d�d�|�SrUrWrYr"r"r#rP�sz ExtendedInterpolation.before_getcCs<|�dd�}|j�d|�}d|kr8td||�d�f��|S)Nz$$r�$r\r]rbr"r"r#rR�s�z ExtendedInterpolation.before_setcCs�|j||d|d�}|tkr&t|||��|�r�|�d�}	|	dkrL|�|�dS|	dkrr|�|d|	��||	d�}|dd�}
|
dkr�|�d�|dd�}q&|
dk�r�|j�|�}|dkr�t||d|��|�d��	d	�}||�
�d�}|}
|}zrt|�dk�r|�|d�}||}nHt|�dk�rR|d}
|�|d�}|j|
|dd
�}nt||d|f��Wn2t
ttfk
�r�t|||d	�|��d�YnXd|k�r�|�|||||
t|j|
dd
��|d�n
|�|�q&t||d|f��q&dS)
NTrcrzrrVrB�{rg�:)rdzMore than one ':' found: %rz-'$' must be followed by '$' or '{', found: %r)rhrr	rar3r_rirrk�splitrl�lenrjrmrrr
r7rX�dict�items)r rNr:rnror+rprqr=rrrsrt�pathZsect�optrvr"r"r#rX�sx



�
���
���z'ExtendedInterpolation._interpolate_someNrwr"r"r"r#r�s

c@s6eZdZdZe�d�Zdd�Zdd�Ze	dd��Z
d	S)
rz{Deprecated interpolation used in old versions of ConfigParser.
    Use BasicInterpolation or ExtendedInterpolation instead.z%\(([^)]*)\)s|.c

Cs�|}t}|r�|d8}|r�d|kr�tj|j|d�}|j�||�}z||}Wq�tk
r�}	zt||||	jd�d�W5d}	~	XYq�Xqq�q|r�d|kr�t	|||��|S)NrVz%()rNr)
r�	functools�partial�_interpolation_replacer_r`rmr
r,r	)
r rNr+r:rJ�varsr=rqr^�er"r"r#rPs0���zLegacyInterpolation.before_getcCs|Srr"rQr"r"r#rR$szLegacyInterpolation.before_setcCs,|�d�}|dkr|��Sd|�|�SdS)NrVz%%(%s)s)rkrj)rirN�sr"r"r#r�'s
z*LegacyInterpolation._interpolation_replaceN)r&r'r(r)rxryr_rPrR�staticmethodr�r"r"r"r#r
s
c
s6eZdZdZdZdZdZe�Ze	�
ee	j�Ze	�
ej
dd�e	j�Ze	�
ej
dd�e	j�Ze	�
d�Zddddd	d	d	d	d
�Zded	fdd
dddeeed�dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdddd�Zdedd�Zdfd d!�Zdgd#d$�Zdhd%d&�Zd	ded'�d(d)�Z d*d+�Z!d	ded'�d,d-�Z"d	ded'�d.d/�Z#d	ded'�d0d1�Z$d	ded'�d2d3�Z%ed	df�fd4d5�	Z&d6d7�Z'd8d9�Z(d:d;�Z)did<d=�Z*djd>d?�Z+d@dA�Z,dBdC�Z-dDdE�Z.dFdG�Z/dHdI�Z0dJdK�Z1dLdM�Z2dNdO�Z3dPdQ�Z4dRdS�Z5dTdU�Z6dVdW�Z7dXdY�Z8dZd[�Z9d\d]�Z:d^d^d^d_�d`da�Z;e<dbdc��Z=�Z>S)krz,ConfigParser that does not do interpolation.z�
        \[                                 # [
        (?P<header>[^]]+)                  # very permissive!
        \]                                 # ]
        a�
        (?P<option>.*?)                    # very permissive!
        \s*(?P<vi>{delim})\s*              # any number of space/tab,
                                           # followed by any of the
                                           # allowed delimiters,
                                           # followed by any space/tab
        (?P<value>.*)$                     # everything up to eol
        a�
        (?P<option>.*?)                    # very permissive!
        \s*(?:                             # any number of space/tab,
        (?P<vi>{delim})\s*                 # optionally followed by
                                           # any of the allowed
                                           # delimiters, followed by any
                                           # space/tab
        (?P<value>.*))?$                   # everything up to eol
        z=|:�Zdelimz\STF)�1Zyes�trueZon�0ZnoZfalseZoffN��=r|)�#�;)�
delimiters�comment_prefixes�inline_comment_prefixes�strict�empty_lines_in_values�default_section�
interpolation�
convertersc
Cs<||_|��|_|��|_t|�|_|��|_t||	�|j|	<t|�|_|dkrd|rZ|j	n|j
|_nNd�dd�|D��}|r�t
�|jj|d�t
j�|_nt
�|jj|d�t
j�|_t|p�d�|_t|p�d�|_||_||_||_|	|_|
|_|jtkr�|j|_|jdk�rt�|_|tk	�r(|j�|�|�r8|�|�dS)Nr��|css|]}t�|�VqdSr)rx�escape)�.0�dr"r"r#�	<genexpr>jsz+RawConfigParser.__init__.<locals>.<genexpr>r�r")�_dict�	_sections�	_defaultsr�_converters�_proxiesr�tuple�_delimiters�	OPTCRE_NV�OPTCRE�_optcrer7rxry�_OPT_NV_TMPLr4�VERBOSE�	_OPT_TMPL�_comment_prefixes�_inline_comment_prefixes�_strict�_allow_no_value�_empty_lines_in_valuesr��_interpolation�_UNSET�_DEFAULT_INTERPOLATIONr�update�_read_defaults)
r rOZ	dict_typeZallow_no_valuer�r�r�r�r�r�r�r�r�r"r"r#rYs@




��

zRawConfigParser.__init__cCs|jSr)r�r$r"r"r#rO�szRawConfigParser.defaultscCst|j���S)z3Return a list of section names, excluding [DEFAULT])�listr��keysr$r"r"r#�sections�szRawConfigParser.sectionscCsJ||jkrtd|��||jkr(t|��|��|j|<t||�|j|<dS)z�Create a new section in the configuration.

        Raise DuplicateSectionError if a section by the specified name
        already exists. Raise ValueError if name is DEFAULT.
        zInvalid section name: %rN)r�r>r�rr�rr�r-r"r"r#�add_section�s

zRawConfigParser.add_sectioncCs
||jkS)z~Indicate whether the named section is present in the configuration.

        The DEFAULT section is not acknowledged.
        )r�r-r"r"r#�has_section�szRawConfigParser.has_sectioncCsJz|j|��}Wntk
r0t|�d�YnX|�|j�t|���S)z9Return a list of option names for the given section name.N)r��copyrmrr�r�r�r�)r r+Zoptsr"r"r#�options�szRawConfigParser.optionsc
Cs�t|tttjf�r|g}g}|D]f}z(t||d��}|�||�W5QRXWntk
rdYq YnXt|tj�r|t�|�}|�	|�q |S)a�Read and parse a filename or an iterable of filenames.

        Files that cannot be opened are silently ignored; this is
        designed so that you can specify an iterable of potential
        configuration file locations (e.g. current directory, user's
        home directory, systemwide directory), and all existing
        configuration files in the iterable will be read.  A single
        filename may also be given.

        Return list of successfully read files.
        )�encoding)
�
isinstance�str�bytes�os�PathLike�open�_read�OSError�fspathr3)r �	filenamesr�Zread_okr@�fpr"r"r#�read�s

zRawConfigParser.readcCs<|dkr,z
|j}Wntk
r*d}YnX|�||�dS)aPLike read() but the argument must be a file-like object.

        The `f' argument must be iterable, returning one line at a time.
        Optional second argument is the `source' specifying the name of the
        file being read. If not given, it is taken from f.name. If `f' has no
        `name' attribute, `<???>' is used.
        Nz<???>)�name�AttributeErrorr�)r �fr8r"r"r#�	read_file�s

zRawConfigParser.read_file�<string>cCst�|�}|�||�dS)z'Read configuration from a given string.N)�io�StringIOr�)r �stringr8Zsfiler"r"r#�read_string�s
zRawConfigParser.read_string�<dict>c
Cs�t�}|��D]�\}}t|�}z|�|�Wn(ttfk
rT|jrP||krP�YnX|�|�|��D]`\}}|�t|��}|dk	r�t|�}|jr�||f|kr�t	|||��|�||f�|�|||�qhqdS)aRead configuration from a dictionary.

        Keys are section names, values are dictionaries with keys and values
        that should be present in the section. If the used dictionary type
        preserves order, sections and their keys will be added in order.

        All types held in the dictionary are converted to strings during
        reading, including section names, option names and keys.

        Optional second argument is the `source' specifying the name of the
        dictionary being read.
        N)
�setr�r�r�rr>r��addrjr)r Z
dictionaryr8�elements_addedr+r��keyrJr"r"r#�	read_dict�s"

zRawConfigParser.read_dictcCs"tjdtdd�|j||d�dS)z"Deprecated, use read_file instead.zRThis method will be removed in future versions.  Use 'parser.read_file()' instead.rBrC)r8N)rFrGrHr�)r r�r@r"r"r#�readfp�s�zRawConfigParser.readfp�rdr�recCs�z|�||�}Wn(tk
r8|tkr,�n|YSYnX|�|�}z||}Wn0tk
r�|tkrtt||��n|YSYnX|s�|dkr�|S|j�|||||�SdS)a]Get an option value for a given section.

        If `vars' is provided, it must be a dictionary. The option is looked up
        in `vars' (if provided), `section', and in `DEFAULTSECT' in that order.
        If the key is not found and `fallback' is provided, it is used as
        a fallback value. `None' can be provided as a `fallback' value.

        If interpolation is enabled and the optional argument `raw' is False,
        all interpolations are expanded in the return values.

        Arguments `raw', `vars', and `fallback' are keyword only.

        The section DEFAULT is special.
        N)�
_unify_valuesrr�rjrmrr�rP)r r+r:rdr�rer�rJr"r"r#rh�s$
�zRawConfigParser.getcKs||j||f|��Sr)rh)r r+�convr:�kwargsr"r"r#�_get"szRawConfigParser._getc	KsJz|j|||f||d�|��WSttfk
rD|tkr<�|YSXdS)N)rdr�)r�rrr�)r r+r:r�rdr�rer�r"r"r#�	_get_conv%s�zRawConfigParser._get_convcKs|j||tf|||d�|��S�Nr�)r��int�r r+r:rdr�rer�r"r"r#�getint0s
��zRawConfigParser.getintcKs|j||tf|||d�|��Sr�)r��floatr�r"r"r#�getfloat5s
��zRawConfigParser.getfloatcKs |j|||jf|||d�|��Sr�)r��_convert_to_booleanr�r"r"r#�
getboolean:s��zRawConfigParser.getbooleancs��tkrt���S�j���z���j��Wn&tk
rV��jkrRt	���YnXt
����}|r�|��D]\}}|���|�<qp���fdd��|r��fdd���fdd�|D�S)a�Return a list of (name, value) tuples for each option in a section.

        All % interpolations are expanded in the return values, based on the
        defaults passed into the constructor, unless the optional argument
        `raw' is true.  Additional substitutions may be provided using the
        `vars' argument, which must be a dictionary whose contents overrides
        any pre-existing defaults.

        The section DEFAULT is special.
        cs�j���|�|��Sr)r�rP�r:)r�r+r r"r#�<lambda>Ws
�z'RawConfigParser.items.<locals>.<lambda>cs�|Srr"r�)r�r"r#r�Z�csg|]}|�|�f�qSr"r")r�r:)�value_getterr"r#�
<listcomp>[sz)RawConfigParser.items.<locals>.<listcomp>)
r��superr�r�r�r�r�rmr�rr�r�rj)r r+rdr�Z	orig_keysr�rJ��	__class__)r�r+r r�r#r�?s 


zRawConfigParser.itemscCs.|��D]}||}||=||fSt�dS)z�Remove a section from the parser and return it as
        a (section_name, section_proxy) tuple. If no section is present, raise
        KeyError.

        The section DEFAULT is never returned because it cannot be removed.
        N)r�rm�r r�rJr"r"r#�popitem]s
zRawConfigParser.popitemcCs|��Sr)�lower)r Z	optionstrr"r"r#rjjszRawConfigParser.optionxformcCsV|r||jkr"|�|�}||jkS||jkr0dS|�|�}||j|kpP||jkSdS)z�Check for the existence of a given option in a given section.
        If the specified `section' is None or an empty string, DEFAULT is
        assumed. If the specified `section' does not exist, returns False.FN)r�rjr�r�)r r+r:r"r"r#�
has_optionms



�zRawConfigParser.has_optioncCsl|r|j�||||�}|r$||jkr,|j}n.z|j|}Wntk
rXt|�d�YnX|||�|�<dS)zSet an option.N)r�rRr�r�r�rmrrj)r r+r:rJ�sectdictr"r"r#r�{s�zRawConfigParser.setcCsh|rd�|jd�}n
|jd}|jr>|�||j|j��|�|jD]}|�|||j|��|�qDdS)z�Write an .ini-format representation of the configuration state.

        If `space_around_delimiters' is True (the default), delimiters
        between keys and values are surrounded by spaces.
        z {} rN)r4r�r��_write_sectionr�r�r�)r r�Zspace_around_delimitersr�r+r"r"r#�write�s

�
�zRawConfigParser.writecCsx|�d�|��|D]T\}}|j�||||�}|dk	s<|jsR|t|��dd�}nd}|�d�||��q|�d�dS)z-Write a single section to the specified `fp'.z[{}]
N�
z
	rz{}{}
)r�r4r�rTr�r�r^)r r�Zsection_nameZ
section_itemsZ	delimiterr�rJr"r"r#r��s�zRawConfigParser._write_sectioncCsd|r||jkr|j}n.z|j|}Wntk
rBt|�d�YnX|�|�}||k}|r`||=|S)zRemove an option.N)r�r�r�rmrrj)r r+r:r��existedr"r"r#�
remove_option�s
zRawConfigParser.remove_optioncCs"||jk}|r|j|=|j|=|S)zRemove a file section.)r�r�)r r+r�r"r"r#�remove_section�s

zRawConfigParser.remove_sectioncCs&||jkr|�|�st|��|j|Sr)r�r�rmr��r r�r"r"r#�__getitem__�szRawConfigParser.__getitem__cCsX||kr|||krdS||jkr.|j��n||jkrF|j|��|�||i�dSr)r�r��clearr�r�r�r"r"r#�__setitem__�s

zRawConfigParser.__setitem__cCs2||jkrtd��|�|�s$t|��|�|�dS)Nz"Cannot remove the default section.)r�r>r�rmr�r�r"r"r#�__delitem__�s


zRawConfigParser.__delitem__cCs||jkp|�|�Sr)r�r�r�r"r"r#�__contains__�szRawConfigParser.__contains__cCst|j�dS)NrV)r~r�r$r"r"r#�__len__�szRawConfigParser.__len__cCst�|jf|j���Sr)�	itertools�chainr�r�r�r$r"r"r#�__iter__�szRawConfigParser.__iter__cCs t�}d}d}d}d}d}d}	t|dd�D�]�\}}
tj}dd�|jD�}|tjkr�|r�i}
|��D]T\}}|
�||d�}|dkr�qd||
|<|dks�|dkrd|
|d��rdt||�}qd|
}qJ|j	D]}|
�
��|�r�d}q�q�|tjkr�d}|
d|��
�}|�sN|j�rF|dk�rL|dk	�rL|�rL||dk	�rL||�
d�q*tj}q*|j�|
�}|�rh|��nd}|dk	�r�|�r�||k�r�||�
|�q*|}|j�|�}|�r<|�d	�}||jk�r�|j�r�||k�r�t|||��|j|}|�|�n@||jk�r
|j}n,|��}||j|<t||�|j|<|�|�d}q*|dk�rTt|||
��q*|j�|�}|�r�|�d
dd�\}}}|�s�|�|	|||
�}	|� |�!��}|j�r�||f|k�r�t"||||��|�||f�|dk	�r�|�
�}|g||<nd||<q*|�|	|||
�}	q*|�#�|	�r|	�dS)
aParse a sectioned configuration file.

        Each section in a configuration file contains a header, indicated by
        a name in square brackets (`[]'), plus key/value options, indicated by
        `name' and `value' delimited with a specific substring (`=' or `:' by
        default).

        Values can span multiple lines, as long as they are indented deeper
        than the first line of the value. Depending on the parser's mode, blank
        lines may be treated as parts of multiline values or ignored.

        Configuration files may include comments, prefixed by specific
        characters (`#' and `;' by default). Comments may appear on their own
        in an otherwise empty line or may be entered in lines holding values or
        section names.
        NrrV)�startcSsi|]
}|d�qS)���r")r�rrr"r"r#�
<dictcomp>�sz)RawConfigParser._read.<locals>.<dictcomp>rr�headerr:�virJ)$r��	enumerate�sys�maxsizer�r�ra�isspace�minr��strip�
startswithr�r3�NONSPACECRE�searchr�SECTCRErirkr�r�rr�r�r�r�rr�r
r��
_handle_errorrj�rstripr�_join_multiline_values)r r��fpnamer�ZcursectZsectnameZoptnamer9Zindent_levelr�rKZ
comment_startZinline_prefixesZ
next_prefixes�prefix�indexrJZfirst_nonspaceZcur_indent_levelZmor	Zoptvalr"r"r#r��s� 


��
��
�




��

zRawConfigParser._readcCsr|j|jf}t�|f|j���}|D]H\}}|��D]6\}}t|t�rTd�|��	�}|j
�||||�||<q4q$dS)Nr�)r�r�rrr�r�r�r�r7rr�rS)r rOZall_sectionsr+r�r��valr"r"r#r[s�
�z&RawConfigParser._join_multiline_valuescCs&|��D]\}}||j|�|�<qdS)zTRead the defaults passed in the initializer.
        Note: values can be non-string.N)r�r�rj)r rOr�rJr"r"r#r�gszRawConfigParser._read_defaultscCs |st|�}|�|t|��|Sr)rr3r2)r �excrr9rKr"r"r#rmszRawConfigParser._handle_errorcCs�i}z|j|}Wn(tk
r:||jkr6t|�d�YnXi}|rt|��D]&\}}|dk	rdt|�}|||�|�<qLt|||j�S)z�Create a sequence of lookups with 'vars' taking priority over
        the 'section' which takes priority over the DEFAULTSECT.

        N)	r�rmr�rr�r�rj�	_ChainMapr�)r r+r�ZsectiondictZvardictr�rJr"r"r#r�ss
zRawConfigParser._unify_valuescCs(|��|jkrtd|��|j|��S)zJReturn a boolean value translating from other types if necessary.
        zNot a boolean: %s)r��BOOLEAN_STATESr>rIr"r"r#r��sz#RawConfigParser._convert_to_booleanr)r+r:rJcCsDt|t�std��t|t�s$td��|jr.|r@t|t�s@td��dS)a�Raises a TypeError for non-string values.

        The only legal non-string value if we allow valueless
        options is None, so we need to check if the value is a
        string if:
        - we do not allow valueless options, or
        - we allow valueless options but the value is not None

        For compatibility reasons this method is not used in classic set()
        for RawConfigParsers. It is invoked in every case for mapping protocol
        access and in ConfigParser.set().
        zsection names must be stringszoption keys must be stringszoption values must be stringsN)r�r��	TypeErrorr��r r+r:rJr"r"r#�_validate_value_types�s



z%RawConfigParser._validate_value_typescCs|jSr)r�r$r"r"r#r��szRawConfigParser.converters)N)N)r�)r�)N)N)T)?r&r'r(r)Z
_SECT_TMPLr�r�rr�rxryr�rr4r�r�rr�
_default_dictrr�rrOr�r�r�r�r�r�r�r�r�rhr�r�r�r�r�r�r�rjr�r�r�r�r�r�r�r�r�rrrr�rr�rr�r�r rLr��
__classcell__r"r"r�r#r0s�

���(	




	%����




zcs<eZdZdZe�Zd	�fdd�	Z�fdd�Zdd�Z�Z	S)
rz(ConfigParser implementing interpolation.Ncs"|j||d�t��|||�dS)zmSet an option.  Extends RawConfigParser.set by validating type and
        interpolation syntax on the value.�r:rJN)r r�r�rr�r"r#r��szConfigParser.setcs|j|d�t��|�dS)z�Create a new section in the configuration.  Extends
        RawConfigParser.add_section by validating if the section name is
        a string.)r+N)r r�r�r-r�r"r#r��szConfigParser.add_sectioncCs0z"|j}t�|_|�|j|i�W5||_XdS)z�Reads the defaults passed in the initializer, implicitly converting
        values to strings like the rest of the API.

        Does not perform interpolation for backwards compatibility.
        N)r�rr�r�)r rOZhold_interpolationr"r"r#r��s
zConfigParser._read_defaults)N)
r&r'r(r)rr�r�r�r�r"r"r"r�r#r�s
cs eZdZdZ�fdd�Z�ZS)rz8ConfigParser alias for backwards compatibility purposes.cs"t�j||�tjdtdd�dS)Nz�The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.rBrC)r�rrFrGrH)r r,r�r�r"r#r�s�zSafeConfigParser.__init__)r&r'r(r)rr"r"r"r�r#r�sc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Ze
dd��Ze
dd��Zddddd�dd�ZdS)rz+A proxy for a single section from a parser.cCsF||_||_|jD].}d|}tj|jt||�d�}t|||�qdS)z@Creates a view on a section of the specified `name` in `parser`.rh��_implN)�_parser�_namer�r�r�rh�getattr�setattr)r rNr�r�r��getterr"r"r#r�s
zSectionProxy.__init__cCsd�|j�S)Nz
<Section: {}>)r4r'r$r"r"r#r%�szSectionProxy.__repr__cCs(|j�|j|�st|��|j�|j|�Sr)r&r�r'rmrhr�r"r"r#r��szSectionProxy.__getitem__cCs"|jj||d�|j�|j||�S)Nr#)r&r r�r'r�r"r"r#r��szSectionProxy.__setitem__cCs,|j�|j|�r |j�|j|�s(t|��dSr)r&r�r'r�rmr�r"r"r#r��s�zSectionProxy.__delitem__cCs|j�|j|�Sr)r&r�r'r�r"r"r#r�szSectionProxy.__contains__cCst|���Sr)r~�_optionsr$r"r"r#r�szSectionProxy.__len__cCs|����Sr)r+rr$r"r"r#r�szSectionProxy.__iter__cCs*|j|jjkr|j�|j�S|j��SdSr)r'r&r�r�rOr$r"r"r#r+�szSectionProxy._optionscCs|jSr)r&r$r"r"r#rNszSectionProxy.parsercCs|jSr)r'r$r"r"r#r�szSectionProxy.nameNF)rdr�r%cKs(|s|jj}||j|f|||d�|��S)z�Get an option value.

        Unless `fallback` is provided, `None` will be returned if the option
        is not found.

        r�)r&rhr')r r:rerdr�r%r�r"r"r#rhs
��zSectionProxy.get)N)r&r'r(r)rr%r�r�r�rrrr+rLrNr�rhr"r"r"r#r�s"	

�c@sJeZdZdZe�d�Zdd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�ZdS)ra/Enables reuse of get*() methods between the parser and section proxies.

    If a parser class implements a getter directly, the value for the given
    key will be ``None``. The presence of the converter name here enables
    section proxies to find and use the implementation on the parser class.
    z^get(?P<name>.+)$cCsR||_i|_t|j�D]6}|j�|�}|rtt|j|��s<qd|j|�d�<qdS)Nr�)r&�_data�dir�	GETTERCREri�callabler(rk)r rNr*rtr"r"r#r%szConverterMapping.__init__cCs
|j|Sr)r,r�r"r"r#r�.szConverterMapping.__getitem__c	Cs�zd|}Wn(tk
r4td�|t|����YnX|dkrFtd��||j|<tj|jj|d�}||_	t
|j||�|j��D] }tj|j|d�}t
|||�q�dS)NrhzIncompatible key: {} (type: {})z)Incompatible key: cannot use "" as a name)r�r$)
rr>r4�typer,r�r�r&r�Z	converterr)�valuesrh)r r�rJ�k�func�proxyr*r"r"r#r�1s �
zConverterMapping.__setitem__c	Cs~zd|p
d}Wntk
r,t|��YnX|j|=t�|jf|j���D],}zt||�WqLtk
rvYqLYqLXqLdS)Nrh)	rrmr,rrr&r1�delattrr�)r r�r2�instr"r"r#r�AszConverterMapping.__delitem__cCs
t|j�Sr)�iterr,r$r"r"r#rOszConverterMapping.__iter__cCs
t|j�Sr)r~r,r$r"r"r#rRszConverterMapping.__len__N)
r&r'r(r)rxryr.rr�r�r�rrr"r"r"r#rs
	))r)Zcollections.abcr�collectionsrrr�r�rr�rxrrF�__all__rr!rrrrrrrrrr
rr	rr
�objectr�rrrrrrrrrr"r"r"r#�<module>st
�	
	

+HJ&| 
Fpickletools.cpython-38.opt-1.pyc000064400000201414150335716500012472 0ustar00U

e5d.m�L@s�
dZddlZddlZddlZddlZddlZdddgZejZdZdZ	dZ
d	Zd
ZGdd�de
�Zdd
lmZdd�Zeddedd�Zdd�Zeddedd�Zdd�Zeddedd�Zdd�Zed ded!d�Zd"d#�Zed$d%ed&d�Z�d�d(d)�Zed*eed+d�Zd,d-�Zed.eed/d�Zd0d1�Z ed2ee d3d�Z!d4d5�Z"ed6e	e"d7d�Z#d8d9�Z$ed:e
e$d;d�Z%d<d=�Z&ed>e	e&d?d�Z'd@dA�Z(edBee(dCd�Z)dDdE�Z*edFee*dGd�Z+dHdI�Z,edJee,dKd�Z-dLdM�Z.edNee.dOd�Z/dPdQ�Z0edRe	e0dSd�Z1dTdU�Z2edVee2dWd�Z3dXdY�Z4edZee4d[d�Z5d\d]�Z6d^d_�Z7ed`ee6dad�Z8edbee7dcd�Z9ddde�Z:edfee:dgd�Z;dhdi�Z<edjd%e<dkd�Z=ddllm>Z>dmdn�Z?edoe	e?dpd�Z@dqdr�ZAedse
eAdtd�ZBGdudv�dve
�ZCeCdweDdxdy�ZEZFeCdzeDeGfd{dy�ZHeCd|eGd}dy�ZIeCd~eJddy�ZKeCd�eLeMfd�dy�ZNZOeCd�eLd�dy�ZPeCd�eQd�dy�ZReCd�eMd�dy�ZSeCd�eTd�d�dy�ZUeCd�eVd�dy�ZWeCd�eXd�dy�ZYeCd�eZd�dy�Z[eCd�e\d�dy�Z]eCd�e\d�dy�Z^eCd�e
d�dy�Z_eCd�e
d�dy�Z`eCd�eCd�dy�ZaeCd�eCd�dy�ZbGd�d��d�e
�ZcecZdedd�d�e8geHgdd�d��edd�d�egeEgdd�d��edd�d�egeEgdd�d��edd�d�egeEgdd�d��edd�d�e9geEgdd�d��edd�d�e@geEgdd�d��edd�d�eBgeEgdd�d��edd�d�egeNgdd�d��edd�d�e%geNgdd�d��edd�d�e#geNgdd�d��edd�d�e)gePgd�d�d��edd�d�e'gePgd�d�d��edd�d�e+gePgdd�d��edd�d�e-geRgd�d�d��edd�d�dge_gd�d�d��edd�d�de_ge_gd�d�d��edd�d�dgeUgdd�d��edd�d�dgeIgdd�d��edd�d�dgeIgdd�d��edd�d�e/geSgdd�d��edd�d�e1geSgdd�d��edd�d�e3geSgdd�d��edd�d�e5geSgdd�d��edd�d�e;geKgdd�d��edd�d�e=geKgdd�d��edd�d�dgeYgdd�d��edd�d�deYe`geYgdd�d��edd�d�deYeaebgeYgdd�d��edd�d�deaebgeYgdd�d��edd�d�dgeWgdd�d��edd�d�deaebgeWgdd�d��edd�d�de`geWgd�dd��ed�d�dde`e`geWgd�dd��ed�d�dde`e`e`geWgd�dd��ed�d�ddge[gd�d	d��ed�d
�ddeaebge[gd�dd��ed�d
�dde[e`e`ge[gd�dd��ed�d�dde[eaebge[gd�dd��ed�d�ddge]gd�dd��ed�d�dde]eaebge]gd�dd��ed�d�ddeaebge^gd�dd��ed�d�dde`ggd�dd��ed�d�d de`ge`e`gd�d!d��ed�d"�d#dgeagd�d$d��ed�d%�d&deaebggd�d'd��ed�d(�d)e8ge`gd�d*d��ed�d+�d,ege`gd�d-d��ed�d.�d/ege`gd�d0d��ed�d1�d2e8ggd�d3d��ed�d4�d5eggd�d6d��ed�d7�d8eggd�d9d��ed�d:�d;de`ge`gd�d<d��ed�d=�d>ege`gd�d?d��ed�d@�dAege`gd�dBd��ed�dC�dDege`gd�dEd��ed�dF�dGe!ge`gd�dHd��ed�dI�dJdeSeSge`gd�dKd��ed�dL�dMde`e`ge`gd�dNd��ed�dO�dPde`e`ge`gd�dQd��ed�dR�dSe!eaebge`gd�dTd��ed�dU�dVdeae`ebge`gd�dWd��ed�dX�dYde`e`ge`gd�dZd��ed�d[�d\de`e`e`ge`gd�d]d��ed�d^�d_eggd�d`d��ed�da�dbde`ggd�dcd��ed�dd�deeggd�dfd��ed�dg�dhege`gd�did��ed�dj�dkde`ge`gd�dld��gDZe[diZfiZgehee�D]n\ZiZjejjkefk�rBel�dmejjkefejjkeif��ejjmegk�rjel�dnejjmegejjmeif��eiefejjk<eiegejjm<�q[f[g[i[jiZneeD]Zjejenejjm<�q�[j�d��dp�dq�Zoeo�[o�d��dr�ds�Zp�dtd�Zq�dud�Zr�d��dvd�ZsG�dw�dx��dx�Zt�dyZu�dzZveuev�d{�Zw�d|�d}�Zxey�d~k�
r�ddlzZzezj{�d�d��Z|e|j}�d�ez�~�d���d��d��d��e|j}�d��d�ejez�~�d���d��d��e|j}�d��d��d��d��d��e|j}�d��d�deD�d��d��e|j}�d��d��d��d��d��e|j}�d��d��d��d��d��e|j}�d��d��d��d��d��e|j}�d��d��d��d��e|���Z�e�j��
rPex�n�e�j��
r^�d�ndZ�e�j��
ste|���n�e�e�j��dk�
r�ese�j�de�j�de�j�e��nVe�j��
r�indZ�e�j�D]>Z�e�j�j�e�jk�d��Z�e�j���e��d��ese�e�j�e�e�j�e���
q�dS(�ar"Executable documentation" for the pickle module.

Extensive comments about the pickle protocols and pickle-machine opcodes
can be found here.  Some functions meant for external use:

genops(pickle)
   Generate all the opcodes in a pickle, as (opcode, arg, position) triples.

dis(pickle, out=None, memo=None, indentlevel=4)
   Print a symbolic disassembly of a pickle.
�N�dis�genops�optimize���������������c@seZdZdZdd�ZdS)�ArgumentDescriptor��name�n�reader�doccCs||_||_||_||_dS�Nr)�selfrr
rr�r�#/usr/lib64/python3.8/pickletools.py�__init__�szArgumentDescriptor.__init__N��__name__�
__module__�__qualname__�	__slots__rrrrrr
�sr
)�unpackcCs"|�d�}|r|dStd��dS)zG
    >>> import io
    >>> read_uint1(io.BytesIO(b'\xff'))
    255
    �rz'not enough data in stream to read uint1N)�read�
ValueError��f�datarrr�
read_uint1�s
r!�uint1rzOne-byte unsigned integer.rcCs0|�d�}t|�dkr$td|�dStd��dS)z�
    >>> import io
    >>> read_uint2(io.BytesIO(b'\xff\x00'))
    255
    >>> read_uint2(io.BytesIO(b'\xff\xff'))
    65535
    �z<Hrz'not enough data in stream to read uint2N�r�len�_unpackrrrrr�
read_uint2�s	
r'�uint2r#z)Two-byte unsigned integer, little-endian.cCs0|�d�}t|�dkr$td|�dStd��dS)z�
    >>> import io
    >>> read_int4(io.BytesIO(b'\xff\x00\x00\x00'))
    255
    >>> read_int4(io.BytesIO(b'\x00\x00\x00\x80')) == -(2**31)
    True
    �z<irz&not enough data in stream to read int4Nr$rrrr�	read_int4�s	
r*�int4r)z8Four-byte signed integer, little-endian, 2's complement.cCs0|�d�}t|�dkr$td|�dStd��dS)z�
    >>> import io
    >>> read_uint4(io.BytesIO(b'\xff\x00\x00\x00'))
    255
    >>> read_uint4(io.BytesIO(b'\x00\x00\x00\x80')) == 2**31
    True
    r)z<Irz'not enough data in stream to read uint4Nr$rrrr�
read_uint4s	
r,�uint4z*Four-byte unsigned integer, little-endian.cCs0|�d�}t|�dkr$td|�dStd��dS)z�
    >>> import io
    >>> read_uint8(io.BytesIO(b'\xff\x00\x00\x00\x00\x00\x00\x00'))
    255
    >>> read_uint8(io.BytesIO(b'\xff' * 8)) == 2**64-1
    True
    �z<Qrz'not enough data in stream to read uint8Nr$rrrr�
read_uint8&s	
r/�uint8r.z+Eight-byte unsigned integer, little-endian.TcCs�|��}|�d�std��|dd�}|rtdD]8}|�|�r.|�|�sVtd||f��|dd�}qtq.td|��|r�t�|�d	�d
�}|S)au
    >>> import io
    >>> read_stringnl(io.BytesIO(b"'abcd'\nefg\n"))
    'abcd'

    >>> read_stringnl(io.BytesIO(b"\n"))
    Traceback (most recent call last):
    ...
    ValueError: no string quotes around b''

    >>> read_stringnl(io.BytesIO(b"\n"), stripquotes=False)
    ''

    >>> read_stringnl(io.BytesIO(b"''\n"))
    ''

    >>> read_stringnl(io.BytesIO(b'"abcd"'))
    Traceback (most recent call last):
    ...
    ValueError: no newline found when trying to read stringnl

    Embedded escapes are undone in the result.
    >>> read_stringnl(io.BytesIO(br"'a\n\\b\x00c\td'" + b"\n'e'"))
    'a\n\\b\x00c\td'
    �
z-no newline found when trying to read stringnlNr)�"�'z,strinq quote %r not found at both ends of %rrzno string quotes around %rr�ascii)�readline�endswithr�
startswith�codecs�
escape_decode�decode)rr:�stripquotesr �qrrr�
read_stringnl;s"


�r=�stringnlz�A newline-terminated string.

                   This is a repr-style string, with embedded escapes, and
                   bracketing quotes.
                   cCst|dd�S)NF)r;)r=�rrrr�read_stringnl_noescapetsr@�stringnl_noescapeaA newline-terminated string.

                        This is a str-style string, without embedded escapes,
                        or bracketing quotes.  It should consist solely of
                        printable ASCII characters.
                        cCsdt|�t|�fS)zp
    >>> import io
    >>> read_stringnl_noescape_pair(io.BytesIO(b"Queue\nEmpty\njunk"))
    'Queue Empty'
    z%s %s)r@r?rrr�read_stringnl_noescape_pair�srB�stringnl_noescape_paira�A pair of newline-terminated strings.

                             These are str-style strings, without embedded
                             escapes, or bracketing quotes.  They should
                             consist solely of printable ASCII characters.
                             The pair is returned as a single string, with
                             a single blank separating the two strings.
                             cCs@t|�}|�|�}t|�|kr(|�d�Std|t|�f��dS)z�
    >>> import io
    >>> read_string1(io.BytesIO(b"\x00"))
    ''
    >>> read_string1(io.BytesIO(b"\x03abcdef"))
    'abc'
    �latin-1z2expected %d bytes in a string1, but only %d remainN)r!rr%r:r�rr
r rrr�read_string1�s	


�rF�string1z�A counted string.

              The first argument is a 1-byte unsigned int giving the number
              of bytes in the string, and the second argument is that many
              bytes.
              cCsTt|�}|dkrtd|��|�|�}t|�|kr<|�d�Std|t|�f��dS)aP
    >>> import io
    >>> read_string4(io.BytesIO(b"\x00\x00\x00\x00abc"))
    ''
    >>> read_string4(io.BytesIO(b"\x03\x00\x00\x00abcdef"))
    'abc'
    >>> read_string4(io.BytesIO(b"\x00\x00\x00\x03abcdef"))
    Traceback (most recent call last):
    ...
    ValueError: expected 50331648 bytes in a string4, but only 6 remain
    rzstring4 byte count < 0: %drDz2expected %d bytes in a string4, but only %d remainN)r*rrr%r:rErrr�read_string4�s



�rH�string4z�A counted string.

              The first argument is a 4-byte little-endian signed int giving
              the number of bytes in the string, and the second argument is
              that many bytes.
              cCs:t|�}|�|�}t|�|kr"|Std|t|�f��dS)z�
    >>> import io
    >>> read_bytes1(io.BytesIO(b"\x00"))
    b''
    >>> read_bytes1(io.BytesIO(b"\x03abcdef"))
    b'abc'
    z1expected %d bytes in a bytes1, but only %d remainN)r!rr%rrErrr�read_bytes1�s	

�rJ�bytes1z�A counted bytes string.

              The first argument is a 1-byte unsigned int giving the number
              of bytes, and the second argument is that many bytes.
              cCsPt|�}|tjkrtd|��|�|�}t|�|kr8|Std|t|�f��dS)aN
    >>> import io
    >>> read_bytes4(io.BytesIO(b"\x00\x00\x00\x00abc"))
    b''
    >>> read_bytes4(io.BytesIO(b"\x03\x00\x00\x00abcdef"))
    b'abc'
    >>> read_bytes4(io.BytesIO(b"\x00\x00\x00\x03abcdef"))
    Traceback (most recent call last):
    ...
    ValueError: expected 50331648 bytes in a bytes4, but only 6 remain
    z#bytes4 byte count > sys.maxsize: %dz1expected %d bytes in a bytes4, but only %d remainN)r,�sys�maxsizerrr%rErrr�read_bytes4�s



�rN�bytes4z�A counted bytes string.

              The first argument is a 4-byte little-endian unsigned int giving
              the number of bytes, and the second argument is that many bytes.
              cCsPt|�}|tjkrtd|��|�|�}t|�|kr8|Std|t|�f��dS)a�
    >>> import io, struct, sys
    >>> read_bytes8(io.BytesIO(b"\x00\x00\x00\x00\x00\x00\x00\x00abc"))
    b''
    >>> read_bytes8(io.BytesIO(b"\x03\x00\x00\x00\x00\x00\x00\x00abcdef"))
    b'abc'
    >>> bigsize8 = struct.pack("<Q", sys.maxsize//3)
    >>> read_bytes8(io.BytesIO(bigsize8 + b"abcdef"))  #doctest: +ELLIPSIS
    Traceback (most recent call last):
    ...
    ValueError: expected ... bytes in a bytes8, but only 6 remain
    z#bytes8 byte count > sys.maxsize: %dz1expected %d bytes in a bytes8, but only %d remainN)r/rLrMrrr%rErrr�read_bytes8s


�rP�bytes8z�A counted bytes string.

              The first argument is an 8-byte little-endian unsigned int giving
              the number of bytes, and the second argument is that many bytes.
              cCsTt|�}|tjkrtd|��|�|�}t|�|kr<t|�Std|t|�f��dS)a�
    >>> import io, struct, sys
    >>> read_bytearray8(io.BytesIO(b"\x00\x00\x00\x00\x00\x00\x00\x00abc"))
    bytearray(b'')
    >>> read_bytearray8(io.BytesIO(b"\x03\x00\x00\x00\x00\x00\x00\x00abcdef"))
    bytearray(b'abc')
    >>> bigsize8 = struct.pack("<Q", sys.maxsize//3)
    >>> read_bytearray8(io.BytesIO(bigsize8 + b"abcdef"))  #doctest: +ELLIPSIS
    Traceback (most recent call last):
    ...
    ValueError: expected ... bytes in a bytearray8, but only 6 remain
    z'bytearray8 byte count > sys.maxsize: %dz5expected %d bytes in a bytearray8, but only %d remainN)r/rLrMrrr%�	bytearrayrErrr�read_bytearray89s


�rS�
bytearray8z�A counted bytearray.

              The first argument is an 8-byte little-endian unsigned int giving
              the number of bytes, and the second argument is that many bytes.
              cCs0|��}|�d�std��|dd�}t|d�S)zm
    >>> import io
    >>> read_unicodestringnl(io.BytesIO(b"abc\\uabcd\njunk")) == 'abc\uabcd'
    True
    r1z4no newline found when trying to read unicodestringnlNrzraw-unicode-escape)r5r6r�strrrrr�read_unicodestringnl[s

rV�unicodestringnlz�A newline-terminated Unicode string.

                      This is raw-unicode-escape encoded, so consists of
                      printable ASCII characters, and may contain embedded
                      escape sequences.
                      cCsBt|�}|�|�}t|�|kr*t|dd�Std|t|�f��dS)a�
    >>> import io
    >>> s = 'abcd\uabcd'
    >>> enc = s.encode('utf-8')
    >>> enc
    b'abcd\xea\xaf\x8d'
    >>> n = bytes([len(enc)])  # little-endian 1-byte length
    >>> t = read_unicodestring1(io.BytesIO(n + enc + b'junk'))
    >>> s == t
    True

    >>> read_unicodestring1(io.BytesIO(n + enc[:-1]))
    Traceback (most recent call last):
    ...
    ValueError: expected 7 bytes in a unicodestring1, but only 6 remain
    �utf-8�
surrogatepassz9expected %d bytes in a unicodestring1, but only %d remainN)r!rr%rUrrErrr�read_unicodestring1us

�rZ�unicodestring1aAA counted Unicode string.

                    The first argument is a 1-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    cCsXt|�}|tjkrtd|��|�|�}t|�|kr@t|dd�Std|t|�f��dS)a�
    >>> import io
    >>> s = 'abcd\uabcd'
    >>> enc = s.encode('utf-8')
    >>> enc
    b'abcd\xea\xaf\x8d'
    >>> n = bytes([len(enc), 0, 0, 0])  # little-endian 4-byte length
    >>> t = read_unicodestring4(io.BytesIO(n + enc + b'junk'))
    >>> s == t
    True

    >>> read_unicodestring4(io.BytesIO(n + enc[:-1]))
    Traceback (most recent call last):
    ...
    ValueError: expected 7 bytes in a unicodestring4, but only 6 remain
    z+unicodestring4 byte count > sys.maxsize: %drXrYz9expected %d bytes in a unicodestring4, but only %d remainN)r,rLrMrrr%rUrErrr�read_unicodestring4�s


�r\�unicodestring4aAA counted Unicode string.

                    The first argument is a 4-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    cCsXt|�}|tjkrtd|��|�|�}t|�|kr@t|dd�Std|t|�f��dS)a�
    >>> import io
    >>> s = 'abcd\uabcd'
    >>> enc = s.encode('utf-8')
    >>> enc
    b'abcd\xea\xaf\x8d'
    >>> n = bytes([len(enc)]) + b'\0' * 7  # little-endian 8-byte length
    >>> t = read_unicodestring8(io.BytesIO(n + enc + b'junk'))
    >>> s == t
    True

    >>> read_unicodestring8(io.BytesIO(n + enc[:-1]))
    Traceback (most recent call last):
    ...
    ValueError: expected 7 bytes in a unicodestring8, but only 6 remain
    z+unicodestring8 byte count > sys.maxsize: %drXrYz9expected %d bytes in a unicodestring8, but only %d remainN)r/rLrMrrr%rUrErrr�read_unicodestring8�s


�r^�unicodestring8aBA counted Unicode string.

                    The first argument is an 8-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    cCs.t|ddd�}|dkrdS|dkr&dSt|�S)z�
    >>> import io
    >>> read_decimalnl_short(io.BytesIO(b"1234\n56"))
    1234

    >>> read_decimalnl_short(io.BytesIO(b"1234L\n56"))
    Traceback (most recent call last):
    ...
    ValueError: invalid literal for int() with base 10: b'1234L'
    F�r:r;s00s01T�r=�int�r�srrr�read_decimalnl_short�srecCs2t|ddd�}|dd�dkr*|dd�}t|�S)z�
    >>> import io

    >>> read_decimalnl_long(io.BytesIO(b"1234L\n56"))
    1234

    >>> read_decimalnl_long(io.BytesIO(b"123456789012345678901234L\n6"))
    123456789012345678901234
    Fr`rN�Lrarcrrr�read_decimalnl_longsrg�decimalnl_shorta�A newline-terminated decimal integer literal.

                          This never has a trailing 'L', and the integer fit
                          in a short Python int on the box where the pickle
                          was written -- but there's no guarantee it will fit
                          in a short Python int on the box where the pickle
                          is read.
                          �decimalnl_longz�A newline-terminated decimal integer literal.

                         This has a trailing 'L', and can represent integers
                         of any size.
                         cCst|ddd�}t|�S)zO
    >>> import io
    >>> read_floatnl(io.BytesIO(b"-1.25\n6"))
    -1.25
    Fr`)r=�floatrcrrr�read_floatnl-srk�floatnla�A newline-terminated decimal floating literal.

              In general this requires 17 significant digits for roundtrip
              identity, and pickling then unpickling infinities, NaNs, and
              minus zero doesn't work across boxes, or on some boxes even
              on itself (e.g., Windows can't read the strings it produces
              for infinities or NaNs).
              cCs0|�d�}t|�dkr$td|�dStd��dS)z�
    >>> import io, struct
    >>> raw = struct.pack(">d", -1.25)
    >>> raw
    b'\xbf\xf4\x00\x00\x00\x00\x00\x00'
    >>> read_float8(io.BytesIO(raw + b"\n"))
    -1.25
    r.z>drz(not enough data in stream to read float8Nr$rrrr�read_float8Cs

rm�float8aAn 8-byte binary representation of a float, big-endian.

             The format is unique to Python, and shared with the struct
             module (format string '>d') "in theory" (the struct and pickle
             implementations don't share the code -- they should).  It's
             strongly related to the IEEE-754 double format, and, in normal
             cases, is in fact identical to the big-endian 754 double format.
             On other boxes the dynamic range is limited to that of a 754
             double, and "add a half and chop" rounding is used to reduce
             the precision to 53 bits.  However, even on a 754 box,
             infinities, NaNs, and minus zero may not be handled correctly
             (may not survive roundtrip pickling intact).
             )�decode_longcCs.t|�}|�|�}t|�|kr&td��t|�S)a+
    >>> import io
    >>> read_long1(io.BytesIO(b"\x00"))
    0
    >>> read_long1(io.BytesIO(b"\x02\xff\x00"))
    255
    >>> read_long1(io.BytesIO(b"\x02\xff\x7f"))
    32767
    >>> read_long1(io.BytesIO(b"\x02\x00\xff"))
    -256
    >>> read_long1(io.BytesIO(b"\x02\x00\x80"))
    -32768
    z'not enough data in stream to read long1)r!rr%rrorErrr�
read_long1is

rp�long1aA binary long, little-endian, using 1-byte size.

    This first reads one byte as an unsigned size, then reads that
    many bytes and interprets them as a little-endian 2's-complement long.
    If the size is 0, that's taken as a shortcut for the long 0L.
    cCsBt|�}|dkrtd|��|�|�}t|�|kr:td��t|�S)ag
    >>> import io
    >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\xff\x00"))
    255
    >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\xff\x7f"))
    32767
    >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\x00\xff"))
    -256
    >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\x00\x80"))
    -32768
    >>> read_long1(io.BytesIO(b"\x00\x00\x00\x00"))
    0
    rzlong4 byte count < 0: %dz'not enough data in stream to read long4)r*rrr%rorErrr�
read_long4�s
rr�long4a�A binary representation of a long, little-endian.

    This first reads four bytes as a signed size (but requires the
    size to be >= 0), then reads that many bytes and interprets them
    as a little-endian 2's-complement long.  If the size is 0, that's taken
    as a shortcut for the int 0, although LONG1 should really be used
    then instead (and in any case where # of bytes < 256).
    c@s eZdZdZdd�Zdd�ZdS)�StackObject�r�obtypercCs*||_t|t�r|D]}q||_||_dSr)r�
isinstance�tuplervr)rrrvrZ	containedrrrr�s
zStackObject.__init__cCs|jSr�r)rrrr�__repr__�szStackObject.__repr__N)rrrrrrzrrrrrt�s
rtrbzA Python integer object.ruZint_or_boolz#A Python integer or boolean object.�boolzA Python boolean object.rjzA Python float object.Zbytes_or_strz*A Python bytes or (Unicode) string object.�byteszA Python bytes object.rRzA Python bytearray object.rUz!A Python (Unicode) string object.�NonezThe Python None object.rxzA Python tuple object.�listzA Python list object.�dictzA Python dict object.�setzA Python set object.�	frozensetzA Python frozenset object.�bufferzA Python buffer-like object.�anyzAny kind of object whatsoever.Zmarkaz'The mark' is a unique object.

Opcodes that operate on a variable number of objects
generally don't embed the count of objects in the opcode,
or pull it off the stack.  Instead the MARK opcode is used
to push a special marker object on the stack, and then
some other opcodes grab all the objects from the top of
the stack down to (but not including) the topmost marker
object.
�
stackslicea�An object representing a contiguous slice of the stack.

This is used in conjunction with markobject, to represent all
of the stack following the topmost markobject.  For example,
the POP_MARK opcode changes the stack from

    [..., markobject, stackslice]
to
    [...]

No matter how many object are on the stack after the topmost
markobject, POP_MARK gets rid of all of them (including the
topmost markobject too).
c@seZdZdZdd�ZdS)�
OpcodeInfo�r�code�arg�stack_before�stack_after�protorc	CsB||_||_||_|D]}q||_|D]}q&||_||_||_dSrr�)	rrr�r�r�r�r�r�xrrrrdszOpcodeInfo.__init__Nrrrrrr�Esr�ZINT�Ia�Push an integer or bool.

      The argument is a newline-terminated decimal literal string.

      The intent may have been that this always fit in a short Python int,
      but INT can be generated in pickles written on a 64-bit box that
      require a Python long on a 32-bit box.  The difference between this
      and LONG then is that INT skips a trailing 'L', and produces a short
      int whenever possible.

      Another difference is due to that, when bool was introduced as a
      distinct type in 2.3, builtin names True and False were also added to
      2.2.2, mapping to ints 1 and 0.  For compatibility in both directions,
      True gets pickled as INT + "I01\n", and False as INT + "I00\n".
      Leading zeroes are never produced for a genuine integer.  The 2.3
      (and later) unpicklers special-case these and return bool instead;
      earlier unpicklers ignore the leading "0" and return the int.
      r�ZBININT�Ja1Push a four-byte signed integer.

      This handles the full range of Python (short) integers on a 32-bit
      box, directly as binary bytes (1 for the opcode and 4 for the integer).
      If the integer is non-negative and fits in 1 or 2 bytes, pickling via
      BININT1 or BININT2 saves space.
      ZBININT1�Kz�Push a one-byte unsigned integer.

      This is a space optimization for pickling very small non-negative ints,
      in range(256).
      ZBININT2�Mz�Push a two-byte unsigned integer.

      This is a space optimization for pickling small positive ints, in
      range(256, 2**16).  Integers in range(256) can also be pickled via
      BININT2, but BININT1 instead saves a byte.
      ZLONG�La�Push a long integer.

      The same as INT, except that the literal ends with 'L', and always
      unpickles to a Python long.  There doesn't seem a real purpose to the
      trailing 'L'.

      Note that LONG takes time quadratic in the number of digits when
      unpickling (this is simply due to the nature of decimal->binary
      conversion).  Proto 2 added linear-time (in C; still quadratic-time
      in Python) LONG1 and LONG4 opcodes.
      ZLONG1�Šz|Long integer using one-byte length.

      A more efficient encoding of a Python long; the long1 encoding
      says it all.ZLONG4�‹z~Long integer using found-byte length.

      A more efficient encoding of a Python long; the long4 encoding
      says it all.�STRING�Sa�Push a Python string object.

      The argument is a repr-style string, with bracketing quote characters,
      and perhaps embedded escapes.  The argument extends until the next
      newline character.  These are usually decoded into a str instance
      using the encoding given to the Unpickler constructor. or the default,
      'ASCII'.  If the encoding given was 'bytes' however, they will be
      decoded as bytes object instead.
      Z	BINSTRING�Ta�Push a Python string object.

      There are two arguments: the first is a 4-byte little-endian
      signed int giving the number of bytes in the string, and the
      second is that many bytes, which are taken literally as the string
      content.  These are usually decoded into a str instance using the
      encoding given to the Unpickler constructor. or the default,
      'ASCII'.  If the encoding given was 'bytes' however, they will be
      decoded as bytes object instead.
      ZSHORT_BINSTRING�Ua�Push a Python string object.

      There are two arguments: the first is a 1-byte unsigned int giving
      the number of bytes in the string, and the second is that many
      bytes, which are taken literally as the string content.  These are
      usually decoded into a str instance using the encoding given to
      the Unpickler constructor. or the default, 'ASCII'.  If the
      encoding given was 'bytes' however, they will be decoded as bytes
      object instead.
      ZBINBYTES�B�z�Push a Python bytes object.

      There are two arguments:  the first is a 4-byte little-endian unsigned int
      giving the number of bytes, and the second is that many bytes, which are
      taken literally as the bytes content.
      ZSHORT_BINBYTES�Cz�Push a Python bytes object.

      There are two arguments:  the first is a 1-byte unsigned int giving
      the number of bytes, and the second is that many bytes, which are taken
      literally as the string content.
      Z	BINBYTES8�Žz�Push a Python bytes object.

      There are two arguments:  the first is an 8-byte unsigned int giving
      the number of bytes in the string, and the second is that many bytes,
      which are taken literally as the string content.
      Z
BYTEARRAY8�–�z�Push a Python bytearray object.

      There are two arguments:  the first is an 8-byte unsigned int giving
      the number of bytes in the bytearray, and the second is that many bytes,
      which are taken literally as the bytearray content.
      ZNEXT_BUFFER�—z"Push an out-of-band buffer object.ZREADONLY_BUFFER�˜z,Make an out-of-band buffer object read-only.ZNONE�NzPush None on the stack.ZNEWTRUE�ˆzPush True onto the stack.ZNEWFALSE�‰zPush False onto the stack.�UNICODE�Vz�Push a Python Unicode string object.

      The argument is a raw-unicode-escape encoding of a Unicode string,
      and so may contain embedded escape sequences.  The argument extends
      until the next newline character.
      ZSHORT_BINUNICODE�ŒaPush a Python Unicode string object.

      There are two arguments:  the first is a 1-byte little-endian signed int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      Z
BINUNICODE�XaPush a Python Unicode string object.

      There are two arguments:  the first is a 4-byte little-endian unsigned int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      ZBINUNICODE8�aPush a Python Unicode string object.

      There are two arguments:  the first is an 8-byte little-endian signed int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      ZFLOAT�Fa�Newline-terminated decimal float literal.

      The argument is repr(a_float), and in general requires 17 significant
      digits for roundtrip conversion to be an identity (this is so for
      IEEE-754 double precision values, which is what Python float maps to
      on most boxes).

      In general, FLOAT cannot be used to transport infinities, NaNs, or
      minus zero across boxes (or even on a single box, if the platform C
      library can't read the strings it produces for such things -- Windows
      is like that), but may do less damage than BINFLOAT on boxes with
      greater precision or dynamic range than IEEE-754 double.
      ZBINFLOAT�Ga�Float stored in binary form, with 8 bytes of data.

      This generally requires less than half the space of FLOAT encoding.
      In general, BINFLOAT cannot be used to transport infinities, NaNs, or
      minus zero, raises an exception if the exponent exceeds the range of
      an IEEE-754 double, and retains no more than 53 bits of precision (if
      there are more than that, "add a half and chop" rounding is used to
      cut it back to 53 significant bits).
      Z
EMPTY_LIST�]zPush an empty list.ZAPPEND�az�Append an object to a list.

      Stack before:  ... pylist anyobject
      Stack after:   ... pylist+[anyobject]

      although pylist is really extended in-place.
      ZAPPENDS�ez�Extend a list by a slice of stack objects.

      Stack before:  ... pylist markobject stackslice
      Stack after:   ... pylist+stackslice

      although pylist is really extended in-place.
      ZLIST�lasBuild a list out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python list, which single list object replaces all of the
      stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... [1, 2, 3, 'abc']
      ZEMPTY_TUPLE�)zPush an empty tuple.ZTUPLE�tavBuild a tuple out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python tuple, which single tuple object replaces all of the
      stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... (1, 2, 3, 'abc')
      ZTUPLE1�…z�Build a one-tuple out of the topmost item on the stack.

      This code pops one value off the stack and pushes a tuple of
      length 1 whose one item is that value back onto it.  In other
      words:

          stack[-1] = tuple(stack[-1:])
      ZTUPLE2�†aBuild a two-tuple out of the top two items on the stack.

      This code pops two values off the stack and pushes a tuple of
      length 2 whose items are those values back onto it.  In other
      words:

          stack[-2:] = [tuple(stack[-2:])]
      ZTUPLE3�‡aBuild a three-tuple out of the top three items on the stack.

      This code pops three values off the stack and pushes a tuple of
      length 3 whose items are those values back onto it.  In other
      words:

          stack[-3:] = [tuple(stack[-3:])]
      Z
EMPTY_DICT�}zPush an empty dict.ZDICT�da�Build a dict out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python dict, which single dict object replaces all of the
      stack from the topmost markobject onward.  The stack slice alternates
      key, value, key, value, ....  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... {1: 2, 3: 'abc'}
      ZSETITEMrdz�Add a key+value pair to an existing dict.

      Stack before:  ... pydict key value
      Stack after:   ... pydict

      where pydict has been modified via pydict[key] = value.
      ZSETITEMS�ua\Add an arbitrary number of key+value pairs to an existing dict.

      The slice of the stack following the topmost markobject is taken as
      an alternating sequence of keys and values, added to the dict
      immediately under the topmost markobject.  Everything at and after the
      topmost markobject is popped, leaving the mutated dict at the top
      of the stack.

      Stack before:  ... pydict markobject key_1 value_1 ... key_n value_n
      Stack after:   ... pydict

      where pydict has been modified via pydict[key_i] = value_i for i in
      1, 2, ..., n, and in that order.
      Z	EMPTY_SET�zPush an empty set.ZADDITEMS�a$Add an arbitrary number of items to an existing set.

      The slice of the stack following the topmost markobject is taken as
      a sequence of items, added to the set immediately under the topmost
      markobject.  Everything at and after the topmost markobject is popped,
      leaving the mutated set at the top of the stack.

      Stack before:  ... pyset markobject item_1 ... item_n
      Stack after:   ... pyset

      where pyset has been modified via pyset.add(item_i) = item_i for i in
      1, 2, ..., n, and in that order.
      Z	FROZENSET�‘azBuild a frozenset out of the topmost slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python frozenset, which single frozenset object replaces all
      of the stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3
      Stack after:  ... frozenset({1, 2, 3})
      �POP�0z<Discard the top stack item, shrinking the stack by one item.ZDUP�2z=Push the top stack item onto the stack again, duplicating it.�MARK�(z�Push markobject onto the stack.

      markobject is a unique object, used by other opcodes to identify a
      region of the stack containing a variable number of objects for them
      to work on.  See markobject.doc for more detail.
      ZPOP_MARK�1aPop all the stack objects at and above the topmost markobject.

      When an opcode using a variable number of stack objects is done,
      POP_MARK is used to remove those objects, and to remove the markobject
      that delimited their starting position on the stack.
      �GET�gz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the newline-terminated
      decimal string following.  BINGET and LONG_BINGET are space-optimized
      versions.
      �BINGET�hz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the 1-byte unsigned
      integer following.
      �LONG_BINGET�jz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the 4-byte unsigned
      little-endian integer following.
      �PUT�pz�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the newline-
      terminated decimal string following.  BINPUT and LONG_BINPUT are
      space-optimized versions.
      �BINPUTr<z�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the 1-byte
      unsigned integer following.
      �LONG_BINPUT�rz�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the 4-byte
      unsigned little-endian integer following.
      �MEMOIZE�”z�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write is the number of
      elements currently present in the memo.
      ZEXT1�‚a�Extension code.

      This code and the similar EXT2 and EXT4 allow using a registry
      of popular objects that are pickled by name, typically classes.
      It is envisioned that through a global negotiation and
      registration process, third parties can set up a mapping between
      ints and object names.

      In order to guarantee pickle interchangeability, the extension
      code registry ought to be global, although a range of codes may
      be reserved for private use.

      EXT1 has a 1-byte integer argument.  This is used to index into the
      extension registry, and the object at that index is pushed on the stack.
      ZEXT2�ƒzNExtension code.

      See EXT1.  EXT2 has a two-byte integer argument.
      ZEXT4�„zOExtension code.

      See EXT1.  EXT4 has a four-byte integer argument.
      ZGLOBAL�ca�Push a global object (module.attr) on the stack.

      Two newline-terminated strings follow the GLOBAL opcode.  The first is
      taken as a module name, and the second as a class name.  The class
      object module.class is pushed on the stack.  More accurately, the
      object returned by self.find_class(module, class) is pushed on the
      stack, so unpickling subclasses can override this form of lookup.
      ZSTACK_GLOBAL�“z7Push a global object (module.attr) on the stack.
      ZREDUCE�RaLPush an object built from a callable and an argument tuple.

      The opcode is named to remind of the __reduce__() method.

      Stack before: ... callable pytuple
      Stack after:  ... callable(*pytuple)

      The callable and the argument tuple are the first two items returned
      by a __reduce__ method.  Applying the callable to the argtuple is
      supposed to reproduce the original object, or at least get it started.
      If the __reduce__ method returns a 3-tuple, the last component is an
      argument to be passed to the object's __setstate__, and then the REDUCE
      opcode is followed by code to create setstate's argument, and then a
      BUILD opcode to apply  __setstate__ to that argument.

      If not isinstance(callable, type), REDUCE complains unless the
      callable has been registered with the copyreg module's
      safe_constructors dict, or the callable has a magic
      '__safe_for_unpickling__' attribute with a true value.  I'm not sure
      why it does this, but I've sure seen this complaint often enough when
      I didn't want to <wink>.
      ZBUILD�ba�Finish building an object, via __setstate__ or dict update.

      Stack before: ... anyobject argument
      Stack after:  ... anyobject

      where anyobject may have been mutated, as follows:

      If the object has a __setstate__ method,

          anyobject.__setstate__(argument)

      is called.

      Else the argument must be a dict, the object must have a __dict__, and
      the object is updated via

          anyobject.__dict__.update(argument)
      ZINST�iaqBuild a class instance.

      This is the protocol 0 version of protocol 1's OBJ opcode.
      INST is followed by two newline-terminated strings, giving a
      module and class name, just as for the GLOBAL opcode (and see
      GLOBAL for more details about that).  self.find_class(module, name)
      is used to get a class object.

      In addition, all the objects on the stack following the topmost
      markobject are gathered into a tuple and popped (along with the
      topmost markobject), just as for the TUPLE opcode.

      Now it gets complicated.  If all of these are true:

        + The argtuple is empty (markobject was at the top of the stack
          at the start).

        + The class object does not have a __getinitargs__ attribute.

      then we want to create an old-style class instance without invoking
      its __init__() method (pickle has waffled on this over the years; not
      calling __init__() is current wisdom).  In this case, an instance of
      an old-style dummy class is created, and then we try to rebind its
      __class__ attribute to the desired class object.  If this succeeds,
      the new instance object is pushed on the stack, and we're done.

      Else (the argtuple is not empty, it's not an old-style class object,
      or the class object does have a __getinitargs__ attribute), the code
      first insists that the class object have a __safe_for_unpickling__
      attribute.  Unlike as for the __safe_for_unpickling__ check in REDUCE,
      it doesn't matter whether this attribute has a true or false value, it
      only matters whether it exists (XXX this is a bug).  If
      __safe_for_unpickling__ doesn't exist, UnpicklingError is raised.

      Else (the class object does have a __safe_for_unpickling__ attr),
      the class object obtained from INST's arguments is applied to the
      argtuple obtained from the stack, and the resulting instance object
      is pushed on the stack.

      NOTE:  checks for __safe_for_unpickling__ went away in Python 2.3.
      NOTE:  the distinction between old-style and new-style classes does
             not make sense in Python 3.
      ZOBJ�oa�Build a class instance.

      This is the protocol 1 version of protocol 0's INST opcode, and is
      very much like it.  The major difference is that the class object
      is taken off the stack, allowing it to be retrieved from the memo
      repeatedly if several instances of the same class are created.  This
      can be much more efficient (in both time and space) than repeatedly
      embedding the module and class names in INST opcodes.

      Unlike INST, OBJ takes no arguments from the opcode stream.  Instead
      the class object is taken off the stack, immediately above the
      topmost markobject:

      Stack before: ... markobject classobject stackslice
      Stack after:  ... new_instance_object

      As for INST, the remainder of the stack above the markobject is
      gathered into an argument tuple, and then the logic seems identical,
      except that no __safe_for_unpickling__ check is done (XXX this is
      a bug).  See INST for the gory details.

      NOTE:  In Python 2.3, INST and OBJ are identical except for how they
      get the class object.  That was always the intent; the implementations
      had diverged for accidental reasons.
      ZNEWOBJ�aLBuild an object instance.

      The stack before should be thought of as containing a class
      object followed by an argument tuple (the tuple being the stack
      top).  Call these cls and args.  They are popped off the stack,
      and the value returned by cls.__new__(cls, *args) is pushed back
      onto the stack.
      Z	NEWOBJ_EX�’auBuild an object instance.

      The stack before should be thought of as containing a class
      object followed by an argument tuple and by a keyword argument dict
      (the dict being the stack top).  Call these cls and args.  They are
      popped off the stack, and the value returned by
      cls.__new__(cls, *args, *kwargs) is  pushed back  onto the stack.
      �PROTO�€z�Protocol version indicator.

      For protocol 2 and above, a pickle must start with this opcode.
      The argument is the protocol version, an int in range(2, 256).
      ZSTOP�.z�Stop the unpickling machine.

      Every pickle ends with this opcode.  The object at the top of the stack
      is popped, and that's the result of unpickling.  The stack should be
      empty then.
      �FRAME�•z�Indicate the beginning of a new frame.

      The unpickler may use this opcode to safely prefetch data from its
      underlying stream.
      ZPERSID�PaPush an object identified by a persistent ID.

      The pickle module doesn't define what a persistent ID means.  PERSID's
      argument is a newline-terminated str-style (no embedded escapes, no
      bracketing quote characters) string, which *is* "the persistent ID".
      The unpickler passes this string to self.persistent_load().  Whatever
      object that returns is pushed on the stack.  There is no implementation
      of persistent_load() in Python's unpickler:  it must be supplied by an
      unpickler subclass.
      Z	BINPERSID�QaXPush an object identified by a persistent ID.

      Like PERSID, except the persistent ID is popped off the stack (instead
      of being a string embedded in the opcode bytestream).  The persistent
      ID is passed to self.persistent_load(), and whatever object that
      returns is pushed on the stack.  See PERSID for more detail.
      z%repeated name %r at indices %d and %dz%repeated code %r at indices %d and %dFcCst��}tjD]�}t�d|�s0|rtd|�qtt|�}t|t	�rPt
|�dkrf|rtd||f�q|�d�}||kr�|r�td||f�||}|j|kr�t
d|||jf��||=qt
d||f��q|�rd	g}|��D]\}}|�d
|j|f�q�t
d�|���dS)Nz[A-Z][A-Z0-9_]+$z0skipping %r: it doesn't look like an opcode namerz5skipping %r: value %r doesn't look like a pickle coderDz+checking name %r w/ code %r for consistencyzBfor pickle code %r, pickle.py uses name %r but we're using name %rzPpickle.py appears to have a pickle opcode with name %r and code %r, but we don'tz=we appear to have pickle opcodes that pickle.py doesn't have:z    name %r with code %r�
)�code2op�copy�pickle�__all__�re�match�print�getattrrwr|r%r:rr�items�append�join)�verboser�rZ
picklecoder��msgr�rrr�assure_pickle_consistency�sJ

�
�
���r�ccs�t|t�rt�|�}t|d�r&|j}ndd�}|�}|�d�}t�|�	d��}|dkr�|dkrht
d��nt
d|dkrxd	n||f��|jdkr�d}n|j�|�}|r�||||�fVn|||fV|d
kr.q�q.dS)N�tellcSsdSrrrrrr�<lambda>��z_genops.<locals>.<lambda>rrDr�z#pickle exhausted before seeing STOPz!at position %s, opcode %r unknownz	<unknown>�.)
rw�bytes_types�io�BytesIO�hasattrr�rr��getr:rr�r)r �
yield_end_posZgetpos�posr��opcoder�rrr�_genops�s.




�
r�cCst|�S)axGenerate all the opcodes in a pickle.

    'pickle' is a file-like object, or string, containing the pickle.

    Each opcode in the pickle is generated, from the current pickle position,
    stopping after a STOP opcode is delivered.  A triple is generated for
    each opcode:

        opcode, arg, pos

    opcode is an OpcodeInfo record, describing the current opcode.

    If the opcode has an argument embedded in the pickle, arg is its decoded
    value, as a Python object.  If the opcode doesn't have an argument, arg
    is None.

    If the pickle has a tell() method, pos was the value of pickle.tell()
    before reading the current opcode.  If the pickle is a bytes object,
    it's wrapped in a BytesIO object, and the latter's tell() result is
    used.  Else (the pickle doesn't have a tell(), and it's not obvious how
    to query its current position) pos is None.
    )r�)r�rrrr�scCsd}d}t�}i}g}d}d}t|dd�D]�\}}	}
}d|jkrZ|�|	�|�||	f�q*|jdkr�t|�}|�|�|�||f�q*d|jkr�q*d|jkr�|j|kr�|j}d	||	<|�||	f�q*|jd
k�r|	|kr�|	}|
dkr�||
|�}n|�|
|f�q*|�|
|f�q*~t��}
|
�	|�t
�|
|�}|dk�rF|j�
�d}|D]�\}}	d}||k�r�|	|k�rr�qN|�|�}|||	<|d
7}n6||k�r�|�||	�}n|||	�}t|�|jjk}|jj|d�|�r�|j�|�n
|�	|��qN|j��|
��S)z7Optimize a pickle string by removing unused PUT opcodesr�r�rr�T)r�r�r�Nr�r)Fr)Zforce)r�r�r�addr�r%r�r�r��writer�Z_PicklerZframerZ
start_framing�putr�Z_FRAME_SIZE_TARGETZcommit_frameZ
file_writeZend_framing�getvalue)r�r�r�ZoldidsZnewids�opcodesr�Zprotoheaderr�r�r�Zend_pos�idx�outZpickler�opZ	framelessr rrrr	sl















c	Csg}|dkri}d}g}d|}d}	|}
t|�D�]�\}}}
|
dk	rVtd|
d|d�dt|j�dd�|t|�|jf}t||j�}|j}|j	}t|�}d}t
|ks�|jdk�r@|�r@|dt
k�r@|�r8|��}|dkr�d	}nd
|}|dt
k	�r|��q�|��z|�t
�}Wnt
k
�r4d}YnXnd}	}|jd
k�r�|jdk�rjt|�}d|}n|}||k�r�d|}	n,|�s�d}	n |dt
k�r�d}	n|d||<n*|jdk�r�||k�r�||g}nd|}	|dk	�s�|�r,|ddt|j�7}|dk	�r|dt|�7}|�r,|d|7}|�rv|d|
t|�7}t|�}
|
dk�r\|}
|d|j�dd�d7}t||d�|	�r�t
|	��t|�|k�r�t
d|t|�f��|�r�||d�=t
|k�r�|�|
�|�|�q0td||d�|�rt
d|��dS)aKProduce a symbolic disassembly of a pickle.

    'pickle' is a file-like object, or string, containing a (at least one)
    pickle.  The pickle is disassembled from the current position, through
    the first STOP opcode encountered.

    Optional arg 'out' is a file-like object to which the disassembly is
    printed.  It defaults to sys.stdout.

    Optional arg 'memo' is a Python dict, used as the pickle's memo.  It
    may be mutated by dis(), if the pickle contains PUT or BINPUT opcodes.
    Passing the same memo object to another dis() call then allows disassembly
    to proceed across multiple pickles that were all created by the same
    pickler with the same memo.  Ordinarily you don't need to worry about this.

    Optional arg 'indentlevel' is the number of blanks by which to indent
    a new MARK level.  It defaults to 4.

    Optional arg 'annotate' if nonzero instructs dis() to add short
    description of the opcode on each line of disassembled output.
    The value given to 'annotate' must be an integer and is used as a
    hint for the column where annotation should start.  The default
    value is 0, meaning no annotations.

    In addition to printing the disassembly, some sanity checks are made:

    + All embedded opcode arguments "make sense".

    + Explicit and implicit pop operations have enough items on the stack.

    + When an opcode implicitly refers to a markobject, a markobject is
      actually on the stack.

    + A memo entry isn't referenced before it's defined.

    + The markobject isn't stored in the memo.

    + A memo entry isn't redefined.
    Nr� z%5d:)�end�filez	%-4s %s%srr�z(MARK at unknown opcode offset)z(MARK at %d)rzno MARK exists on stack)r�r�r�r�r�z(as %d)zmemo key %r already definedz'stack is empty -- can't store into memoz"can't store markobject in the memo)r�r�r�z&memo key %r has never been stored into�
�2r�)rz3tries to pop %d items from stack with only %d itemsz highest protocol among opcodes =zstack not empty after STOP: %r)rr��reprr�r%r�maxr�r�r��
markobject�pop�indexrr�splitr��extend)r�r�memo�indentlevel�annotate�stackZmaxprotoZ	markstackZindentchunkZerrormsgZannocolr�r�r��lineZbeforeZafterZnumtopopZmarkmsgZmarkposZmemo_idxrrrr[	s�-
��
�







�

c@seZdZdd�ZdS)�_ExamplecCs
||_dSr)�value)rrrrrr�	sz_Example.__init__N)rrrrrrrrr�	sra�
>>> import pickle
>>> x = [1, 2, (3, 4), {b'abc': "def"}]
>>> pkl0 = pickle.dumps(x, 0)
>>> dis(pkl0)
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: I    INT        1
    8: a    APPEND
    9: I    INT        2
   12: a    APPEND
   13: (    MARK
   14: I        INT        3
   17: I        INT        4
   20: t        TUPLE      (MARK at 13)
   21: p    PUT        1
   24: a    APPEND
   25: (    MARK
   26: d        DICT       (MARK at 25)
   27: p    PUT        2
   30: c    GLOBAL     '_codecs encode'
   46: p    PUT        3
   49: (    MARK
   50: V        UNICODE    'abc'
   55: p        PUT        4
   58: V        UNICODE    'latin1'
   66: p        PUT        5
   69: t        TUPLE      (MARK at 49)
   70: p    PUT        6
   73: R    REDUCE
   74: p    PUT        7
   77: V    UNICODE    'def'
   82: p    PUT        8
   85: s    SETITEM
   86: a    APPEND
   87: .    STOP
highest protocol among opcodes = 0

Try again with a "binary" pickle.

>>> pkl1 = pickle.dumps(x, 1)
>>> dis(pkl1)
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: K        BININT1    1
    6: K        BININT1    2
    8: (        MARK
    9: K            BININT1    3
   11: K            BININT1    4
   13: t            TUPLE      (MARK at 8)
   14: q        BINPUT     1
   16: }        EMPTY_DICT
   17: q        BINPUT     2
   19: c        GLOBAL     '_codecs encode'
   35: q        BINPUT     3
   37: (        MARK
   38: X            BINUNICODE 'abc'
   46: q            BINPUT     4
   48: X            BINUNICODE 'latin1'
   59: q            BINPUT     5
   61: t            TUPLE      (MARK at 37)
   62: q        BINPUT     6
   64: R        REDUCE
   65: q        BINPUT     7
   67: X        BINUNICODE 'def'
   75: q        BINPUT     8
   77: s        SETITEM
   78: e        APPENDS    (MARK at 3)
   79: .    STOP
highest protocol among opcodes = 1

Exercise the INST/OBJ/BUILD family.

>>> import pickletools
>>> dis(pickle.dumps(pickletools.dis, 0))
    0: c    GLOBAL     'pickletools dis'
   17: p    PUT        0
   20: .    STOP
highest protocol among opcodes = 0

>>> from pickletools import _Example
>>> x = [_Example(42)] * 2
>>> dis(pickle.dumps(x, 0))
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: c    GLOBAL     'copy_reg _reconstructor'
   30: p    PUT        1
   33: (    MARK
   34: c        GLOBAL     'pickletools _Example'
   56: p        PUT        2
   59: c        GLOBAL     '__builtin__ object'
   79: p        PUT        3
   82: N        NONE
   83: t        TUPLE      (MARK at 33)
   84: p    PUT        4
   87: R    REDUCE
   88: p    PUT        5
   91: (    MARK
   92: d        DICT       (MARK at 91)
   93: p    PUT        6
   96: V    UNICODE    'value'
  103: p    PUT        7
  106: I    INT        42
  110: s    SETITEM
  111: b    BUILD
  112: a    APPEND
  113: g    GET        5
  116: a    APPEND
  117: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(x, 1))
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: c        GLOBAL     'copy_reg _reconstructor'
   29: q        BINPUT     1
   31: (        MARK
   32: c            GLOBAL     'pickletools _Example'
   54: q            BINPUT     2
   56: c            GLOBAL     '__builtin__ object'
   76: q            BINPUT     3
   78: N            NONE
   79: t            TUPLE      (MARK at 31)
   80: q        BINPUT     4
   82: R        REDUCE
   83: q        BINPUT     5
   85: }        EMPTY_DICT
   86: q        BINPUT     6
   88: X        BINUNICODE 'value'
   98: q        BINPUT     7
  100: K        BININT1    42
  102: s        SETITEM
  103: b        BUILD
  104: h        BINGET     5
  106: e        APPENDS    (MARK at 3)
  107: .    STOP
highest protocol among opcodes = 1

Try "the canonical" recursive-object test.

>>> L = []
>>> T = L,
>>> L.append(T)
>>> L[0] is T
True
>>> T[0] is L
True
>>> L[0][0] is L
True
>>> T[0][0] is T
True
>>> dis(pickle.dumps(L, 0))
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: (    MARK
    6: g        GET        0
    9: t        TUPLE      (MARK at 5)
   10: p    PUT        1
   13: a    APPEND
   14: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(L, 1))
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: h        BINGET     0
    6: t        TUPLE      (MARK at 3)
    7: q    BINPUT     1
    9: a    APPEND
   10: .    STOP
highest protocol among opcodes = 1

Note that, in the protocol 0 pickle of the recursive tuple, the disassembler
has to emulate the stack in order to realize that the POP opcode at 16 gets
rid of the MARK at 0.

>>> dis(pickle.dumps(T, 0))
    0: (    MARK
    1: (        MARK
    2: l            LIST       (MARK at 1)
    3: p        PUT        0
    6: (        MARK
    7: g            GET        0
   10: t            TUPLE      (MARK at 6)
   11: p        PUT        1
   14: a        APPEND
   15: 0        POP
   16: 0        POP        (MARK at 0)
   17: g    GET        1
   20: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(T, 1))
    0: (    MARK
    1: ]        EMPTY_LIST
    2: q        BINPUT     0
    4: (        MARK
    5: h            BINGET     0
    7: t            TUPLE      (MARK at 4)
    8: q        BINPUT     1
   10: a        APPEND
   11: 1        POP_MARK   (MARK at 0)
   12: h    BINGET     1
   14: .    STOP
highest protocol among opcodes = 1

Try protocol 2.

>>> dis(pickle.dumps(L, 2))
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: h    BINGET     0
    7: \x85 TUPLE1
    8: q    BINPUT     1
   10: a    APPEND
   11: .    STOP
highest protocol among opcodes = 2

>>> dis(pickle.dumps(T, 2))
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: h    BINGET     0
    7: \x85 TUPLE1
    8: q    BINPUT     1
   10: a    APPEND
   11: 0    POP
   12: h    BINGET     1
   14: .    STOP
highest protocol among opcodes = 2

Try protocol 3 with annotations:

>>> dis(pickle.dumps(T, 3), annotate=1)
    0: \x80 PROTO      3 Protocol version indicator.
    2: ]    EMPTY_LIST   Push an empty list.
    3: q    BINPUT     0 Store the stack top into the memo.  The stack is not popped.
    5: h    BINGET     0 Read an object from the memo and push it on the stack.
    7: \x85 TUPLE1       Build a one-tuple out of the topmost item on the stack.
    8: q    BINPUT     1 Store the stack top into the memo.  The stack is not popped.
   10: a    APPEND       Append an object to a list.
   11: 0    POP          Discard the top stack item, shrinking the stack by one item.
   12: h    BINGET     1 Read an object from the memo and push it on the stack.
   14: .    STOP         Stop the unpickling machine.
highest protocol among opcodes = 2

a=
>>> import pickle
>>> import io
>>> f = io.BytesIO()
>>> p = pickle.Pickler(f, 2)
>>> x = [1, 2, 3]
>>> p.dump(x)
>>> p.dump(x)
>>> f.seek(0)
0
>>> memo = {}
>>> dis(f, memo=memo)
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: (    MARK
    6: K        BININT1    1
    8: K        BININT1    2
   10: K        BININT1    3
   12: e        APPENDS    (MARK at 5)
   13: .    STOP
highest protocol among opcodes = 2
>>> dis(f, memo=memo)
   14: \x80 PROTO      2
   16: h    BINGET     0
   18: .    STOP
highest protocol among opcodes = 2
)Zdisassembler_testZdisassembler_memo_testcCsddl}|��S)Nr)�doctestZtestmod)rrrr�_testsr�__main__z$disassemble one or more pickle files)Zdescription�pickle_file�br�*zthe pickle file)�type�nargs�helpz-oz--output�wz+the file where the output should be written)�defaultrrz-mz--memo�
store_truez#preserve memo between disassemblies)�actionrz-lz
--indentlevelz8the number of blanks by which to indent a new MARK levelz-az
--annotatez2annotate each line with a short opcode descriptionz-pz
--preamblez==> {name} <==zMif more than one pickle file is specified, print this before each disassembly)rrz-tz--testzrun self-test suitez-vz)run verbosely; only affects self-test run�ryr�)TT)F)F)NNr)r)��__doc__r8r�r�r�rLr�r�Z
UP_TO_NEWLINEZTAKEN_FROM_ARGUMENT1ZTAKEN_FROM_ARGUMENT4ZTAKEN_FROM_ARGUMENT4UZTAKEN_FROM_ARGUMENT8U�objectr
Zstructrr&r!r"r'r(r*r+r,r-r/r0r=r>r@rArBrCrFrGrHrIrJrKrNrOrPrQrSrTrVrWrZr[r\r]r^r_rergrhrirkrlrmrnrorprqrrrsrtrbZpyintZpylongr{Zpyinteger_or_boolZpyboolrjZpyfloatr|rUZpybytes_or_strZpystringZpybytesrRZpybytearrayZ	pyunicoderZpynonerxZpytupler~ZpylistrZpydictr�ZpysetZpyfrozensetZpybufferZ	anyobjectr	r�r�r�r�Zname2iZcode2i�	enumerater�r�rrr�r�r�r�rrrrZ	_dis_testZ
_memo_testZ__test__rr�argparse�ArgumentParser�parser�add_argumentZFileType�stdout�
parse_args�argsZtestrrZ
print_helpr%�outputrrrZpreamble�formatr�rrrr�<module>s`
$�����/�
�	�������
��
�
�
�
�	�
����
����
�������������;����
���
����
�
����
���
�
�
�
����������������������
��
���
�����������2� ������������������
& 

C��
�
�������
�
sunau.cpython-38.opt-2.pyc000064400000030314150335716500011275 0ustar00U

e5d�G�@s�ddlmZddlZedd�ZdZdZdZdZd	Zd
Z	dZ
dZd
ZdZ
dZdZdZdZeeeee	egZGdd�de�Zdd�Zdd�ZGdd�d�ZGdd�d�Zd!dd�Zd"dd �ZdS)#�)�
namedtupleN�
_sunau_paramsz7nchannels sampwidth framerate nframes comptype compnameidns.������������l��c@seZdZdS)�ErrorN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.8/sunau.pyr�srcCs8d}td�D]&}|�d�}|s"t�|dt|�}q|S)Nrrr�)�range�read�EOFError�ord)�file�x�iZbyterrr�	_read_u32�s
rcCsFg}td�D]&}t|d�\}}|�dt|��|}q|�t|��dS)Nrrr)r�divmod�insert�int�write�bytes)rr�datar�d�mrrr�
_write_u32�sr'c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)S)*�Au_readcCs@t|�td�kr,ddl}|�|d�}d|_nd|_|�|�dS)N�r�rbTF��type�builtins�open�_opened�initfp��self�fr-rrr�__init__�szAu_read.__init__cCs|jr|��dS�N��_file�close�r2rrr�__del__�szAu_read.__del__cCs|Sr5rr9rrr�	__enter__�szAu_read.__enter__cGs|��dSr5�r8�r2�argsrrr�__exit__�szAu_read.__exit__c	Cs�||_d|_tt|��}|tkr(td��tt|��|_|jdkrHtd��|jdkrZtd��t|�|_|jtkrzt|j�|_tt|��|_	|j	t
kr�td��|j	ttfkr�d|_
d	|_nj|j	tkr�d	|_|_
nR|j	tkr�d|_|_
n:|j	tkr�d
|_|_
n"|j	tk�rd|_|_
ntd��tt|��|_tt|��|_|j�sLtd
��|j|j|_|jdk�r�|�|jd�|_|j�d�\|_}}nd|_z|��|_Wn ttfk
�r�d|_YnXdS)Nrzbad magic numberrzheader size too small�dzheader size ridiculously largezencoding not (yet) supportedrrrrzunknown encodingzbad # of channels��)r7�	_soundposr!r�AUDIO_FILE_MAGICrZ	_hdr_size�
_data_size�AUDIO_UNKNOWN_SIZE�	_encoding�_simple_encodings�AUDIO_FILE_ENCODING_MULAW_8�AUDIO_FILE_ENCODING_ALAW_8�
_sampwidth�
_framesize�AUDIO_FILE_ENCODING_LINEAR_8�AUDIO_FILE_ENCODING_LINEAR_16�AUDIO_FILE_ENCODING_LINEAR_24�AUDIO_FILE_ENCODING_LINEAR_32�
_framerate�
_nchannelsr�_info�	partition�tell�	_data_pos�AttributeError�OSError)r2r�magic�_rrrr0�sV




�


zAu_read.initfpcCs|jSr5)r7r9rrr�getfp�sz
Au_read.getfpcCs|jSr5)rRr9rrr�getnchannels�szAu_read.getnchannelscCs|jSr5)rKr9rrr�getsampwidth�szAu_read.getsampwidthcCs|jSr5)rQr9rrr�getframerate�szAu_read.getframeratecCs(|jtkrtS|jtkr$|j|jSdS�Nr)rErFrGrHrLr9rrr�
getnframes�s


zAu_read.getnframescCs$|jtkrdS|jtkrdSdSdS)N�ULAW�ALAW�NONE�rGrIrJr9rrr�getcomptype�s


zAu_read.getcomptypecCs$|jtkrdS|jtkrdSdSdS)N�CCITT G.711 u-law�CCITT G.711 A-law�not compressedrdr9rrr�getcompname�s


zAu_read.getcompnamecCs*t|��|��|��|��|��|���Sr5�rr\r]r^r`rerir9rrr�	getparamss�zAu_read.getparamscCsdSr5rr9rrr�
getmarkersszAu_read.getmarkerscCstd��dS)Nzno marks)r)r2�idrrr�getmarkszAu_read.getmarkcCsp|jtkrl|tkr|j��}n|j�||j�}|jt|�|j7_|jtkrhddl	}|�
||j�}|SdSr_)rGrHrFr7rrLrC�lenrI�audioopZulaw2linrK)r2�nframesr$rprrr�
readframess

zAu_read.readframescCs*|jdkrtd��|j�|j�d|_dS)N�cannot seekr)rVrXr7�seekrCr9rrr�rewinds
zAu_read.rewindcCs|jSr5)rCr9rrrrU!szAu_read.tellcCsP|dks||��krtd��|jdkr.td��|j�|j||j�||_dS)Nrzposition not in rangers)r`rrVrXr7rtrLrC)r2�posrrr�setpos$s
zAu_read.setposcCs"|j}|rd|_|jr|��dSr5)r7r/r8�r2rrrrr8,s
z
Au_read.closeN)rrrr4r:r;r?r0r[r\r]r^r`rerirkrlrnrrrurUrwr8rrrrr(�s(	.
r(c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3S)4�Au_writecCs@t|�td�kr,ddl}|�|d�}d|_nd|_|�|�dS)Nr)r�wbTFr+r1rrrr45szAu_write.__init__cCs|jr|��d|_dSr5r6r9rrrr:>szAu_write.__del__cCs|Sr5rr9rrrr;CszAu_write.__enter__cGs|��dSr5r<r=rrrr?FszAu_write.__exit__cCsF||_d|_d|_d|_d|_t|_d|_d|_d|_	d|_
d|_dS)NrrBra)r7rQrRrKrLrF�_nframes�_nframeswritten�_datawritten�_datalengthrS�	_comptyperxrrrr0IszAu_write.initfpcCs(|jrtd��|dkrtd��||_dS)N�0cannot change parameters after starting to write)rrrz"only 1, 2, or 4 channels supported)r|rrR)r2�	nchannelsrrr�setnchannelsVs
zAu_write.setnchannelscCs|jstd��|jS)Nznumber of channels not set)rRrr9rrrr\]szAu_write.getnchannelscCs(|jrtd��|dkrtd��||_dS)Nr�)rrrrzbad sample width)r|rrK)r2�	sampwidthrrr�setsampwidthbs
zAu_write.setsampwidthcCs|jstd��|jS)N�sample width not specified)rQrrKr9rrrr]iszAu_write.getsampwidthcCs|jrtd��||_dS)Nr�)r|rrQ)r2�	frameraterrr�setframeratenszAu_write.setframeratecCs|jstd��|jS)Nzframe rate not set)rQrr9rrrr^sszAu_write.getframeratecCs(|jrtd��|dkrtd��||_dS)Nr�rz# of frames cannot be negative)r|rr{)r2rqrrr�
setnframesxs
zAu_write.setnframescCs|jSr5�r|r9rrrr`szAu_write.getnframescCs|dkr||_ntd��dS)N)rcrazunknown compression type)rr)r2r,�namerrr�setcomptype�szAu_write.setcomptypecCs|jSr5�rr9rrrre�szAu_write.getcomptypecCs$|jdkrdS|jdkrdSdSdS)Nrarfrbrgrhr�r9rrrri�s


zAu_write.getcompnamecCsH|\}}}}}}|�|�|�|�|�|�|�|�|�||�dSr5)r�r�r�r�r�)r2Zparamsr�r�r�rqZcomptypeZcompnamerrr�	setparams�s



zAu_write.setparamscCs*t|��|��|��|��|��|���Sr5rjr9rrrrk�s�zAu_write.getparamscCs|jSr5r�r9rrrrU�sz
Au_write.tellcCs~t|ttf�st|��d�}|��|jdkrDddl}|�||j	�}t
|�|j}|j�
|�|j||_|jt
|�|_dS)N�Brar)�
isinstancer#�	bytearray�
memoryview�cast�_ensure_header_writtenrrpZlin2ulawrKrorLr7r"r|r})r2r$rprqrrr�writeframesraw�s
zAu_write.writeframesrawcCs.|�|�|j|jks"|j|jkr*|��dSr5)r�r|r{r~r}�_patchheader)r2r$rrr�writeframes�s


�zAu_write.writeframescCs^|jrZz6|��|j|jks(|j|jkr0|��|j�	�W5|j}d|_|jrX|��XdSr5)
r7r/r8r�r|r{r~r}r��flushrxrrrr8�s
�zAu_write.closecCs<|js8|jstd��|js"td��|js0td��|��dS)Nz# of channels not specifiedr�zframe rate not specified)r|rRrrKrQ�
_write_headerr9rrrr��szAu_write._ensure_header_writtenc	Cs�|jdkrl|jdkr t}d|_q�|jdkr6t}d|_q�|jdkrLt}d|_q�|jdkrbt}d|_q�td��n|jdkr�t}d|_ntd��|j|j	|_t
|jt�dt
|j�}|d	d
@}t
|j|�|jtkr�t}n|j|j}z|j��|_Wn ttfk
�rd|_YnXt
|j|�||_t
|j|�t
|j|j�t
|j|j	�|j�|j�|j�d|t
|j�d�dS)
Nrcrrrrzinternal errorrar
r
i����rAr)rrKrMrLrNrOrPrrIrRr'r7rDrorSr{rFrU�_form_length_posrWrXr~rQr")r2�encoding�header_sizeZlengthrrrr��sJ







zAu_write._write_headercCsH|jdkrtd��|j�|j�t|j|j�|j|_|j�dd�dS)Nrsrr)r�rXr7rtr'r}r~r9rrrr��s
zAu_write._patchheaderN)rrrr4r:r;r?r0r�r\r�r]r�r^r�r`r�rerir�rkrUr�r�r8r�r�r�rrrrry3s2	

*rycCsJ|dkrt|d�r|j}nd}|dkr.t|�S|dkr>t|�Std��dS)N�moder*)�rr*)�wrzz$mode must be 'r', 'rb', 'w', or 'wb')�hasattrr�r(ryr�r3r�rrrr.s
r.cCstjdtdd�t||d�S)NzDsunau.openfp is deprecated since Python 3.7. Use sunau.open instead.r)�
stacklevel)r�)�warnings�warn�DeprecationWarningr.r�rrr�openfps
�r�)N)N)�collectionsrr�rrDrIrMrNrOrPZAUDIO_FILE_ENCODING_FLOATZAUDIO_FILE_ENCODING_DOUBLEZAUDIO_FILE_ENCODING_ADPCM_G721ZAUDIO_FILE_ENCODING_ADPCM_G722Z AUDIO_FILE_ENCODING_ADPCM_G723_3Z AUDIO_FILE_ENCODING_ADPCM_G723_5rJrFrH�	Exceptionrrr'r(ryr.r�rrrr�<module>jsD��	Q

statistics.cpython-38.pyc000064400000101567150335716500011405 0ustar00U

e5d
��@s�dZddddddddd	d
ddd
ddddgZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZm
Z
ddlmZmZmZmZmZmZmZmZddlmZddlmZGdd�de�Zdedd�Zdd�Zd d!�Zd"d#�Zd$d%�Z d&d'�Z!d(d)�Z"dfd+d,�Z#d-d�Z$d.d�Z%d/d�Z&d0d�Z'd1d�Z(d2d
�Z)d3d	�Z*dgd5d�Z+d6d�Z,d7d�Z-d8d9d:�d;d�Z.dhd<d=�Z/did>d�Z0djd?d�Z1dkd@d�Z2dldAd
�Z3dBdC�Z4GdDd�d�Z5zddEl6m4Z4Wne7k
�r�YnXe8dFk�r�ddGlm9Z9ddHlm:Z:m;Z;m<Z<m=Z=ddIl	m>Z>ddl?Z?e5dJdK�Z@e5dLdM�ZAe@dNdNj$e@j$k�sLtB�e@dNdNj2e@j2k�sftB�dOZCe@�DeC�ZEeA�DeC�ZFe:e;fD]<ZGeHdPeGj8�dQ��eHeGe@eA��eHe5�IeJeGeEeF����q�dRZKe:e;e<e=fD]@ZGeHdPeGj8�dS��eHeGe@eK��eHe5�IeJeGeEe>eK�����q�dTZKe:e;e<fD]@ZGeHdUeGj8�dV��eHeGeKe@��eHe5�IeJeGe>eK�eE����q$dWdX�ZLe5dYdZ�ZMe5d[d\�ZNd]ZOdOZCe5�Id^d_�eM�DeC�D��ZPeLeMeOeP�e5�Id`d_�eM�DeC�D��ZPeLeMeOeP�e5�Idad_�eM�DeC�D��ZPeLeMeOeP�e5�Idbd_�eM�DeC�D��ZPeLeMeOeP�e5�Idcd_�eQeM�DeC�eN�DeC��D��ZPeLeMeNeP�e5�Iddd_�eQeM�DeC�eN�DeC��D��ZPeLeMeNeP�eHe?�R��dS)mam

Basic statistics module.

This module provides functions for calculating statistics of data, including
averages, variance, and standard deviation.

Calculating averages
--------------------

==================  ==================================================
Function            Description
==================  ==================================================
mean                Arithmetic mean (average) of data.
fmean               Fast, floating point arithmetic mean.
geometric_mean      Geometric mean of data.
harmonic_mean       Harmonic mean of data.
median              Median (middle value) of data.
median_low          Low median of data.
median_high         High median of data.
median_grouped      Median, or 50th percentile, of grouped data.
mode                Mode (most common value) of data.
multimode           List of modes (most common values of data).
quantiles           Divide data into intervals with equal probability.
==================  ==================================================

Calculate the arithmetic mean ("the average") of data:

>>> mean([-1.0, 2.5, 3.25, 5.75])
2.625


Calculate the standard median of discrete data:

>>> median([2, 3, 4, 5])
3.5


Calculate the median, or 50th percentile, of data grouped into class intervals
centred on the data values provided. E.g. if your data points are rounded to
the nearest whole number:

>>> median_grouped([2, 2, 3, 3, 3, 4])  #doctest: +ELLIPSIS
2.8333333333...

This should be interpreted in this way: you have two data points in the class
interval 1.5-2.5, three data points in the class interval 2.5-3.5, and one in
the class interval 3.5-4.5. The median of these data points is 2.8333...


Calculating variability or spread
---------------------------------

==================  =============================================
Function            Description
==================  =============================================
pvariance           Population variance of data.
variance            Sample variance of data.
pstdev              Population standard deviation of data.
stdev               Sample standard deviation of data.
==================  =============================================

Calculate the standard deviation of sample data:

>>> stdev([2.5, 3.25, 5.5, 11.25, 11.75])  #doctest: +ELLIPSIS
4.38961843444...

If you have previously calculated the mean, you can pass it as the optional
second argument to the four "spread" functions to avoid recalculating it:

>>> data = [1, 2, 2, 4, 4, 4, 5, 6]
>>> mu = mean(data)
>>> pvariance(data, mu)
2.5


Exceptions
----------

A single exception is defined: StatisticsError is a subclass of ValueError.

�
NormalDist�StatisticsError�fmean�geometric_mean�
harmonic_mean�mean�median�median_grouped�median_high�
median_low�mode�	multimode�pstdev�	pvariance�	quantiles�stdev�variance�N��Fraction)�Decimal)�groupby)�bisect_left�bisect_right)�hypot�sqrt�fabs�exp�erf�tau�log�fsum)�
itemgetter)�Counterc@seZdZdS)rN)�__name__�
__module__�__qualname__�r&r&�"/usr/lib64/python3.8/statistics.pyruscCs�d}t|�\}}||i}|j}ttt|��}t|t�D]@\}}	t||�}tt|	�D]"\}}|d7}||d�|||<qRq6d|kr�|d}
t|
�r�t�nt	dd�t
|���D��}
||
|fS)aC_sum(data [, start]) -> (type, sum, count)

    Return a high-precision sum of the given numeric data as a fraction,
    together with the type to be converted to and the count of items.

    If optional argument ``start`` is given, it is added to the total.
    If ``data`` is empty, ``start`` (defaulting to 0) is returned.


    Examples
    --------

    >>> _sum([3, 2.25, 4.5, -0.5, 1.0], 0.75)
    (<class 'float'>, Fraction(11, 1), 5)

    Some sources of round-off error will be avoided:

    # Built-in sum returns zero.
    >>> _sum([1e50, 1, -1e50] * 1000)
    (<class 'float'>, Fraction(1000, 1), 3000)

    Fractions and Decimals are also supported:

    >>> from fractions import Fraction as F
    >>> _sum([F(2, 3), F(7, 5), F(1, 4), F(5, 6)])
    (<class 'fractions.Fraction'>, Fraction(63, 20), 4)

    >>> from decimal import Decimal as D
    >>> data = [D("0.1375"), D("0.2108"), D("0.3061"), D("0.0419")]
    >>> _sum(data)
    (<class 'decimal.Decimal'>, Fraction(6963, 10000), 4)

    Mixed types are currently treated as an error, except that int is
    allowed.
    r�Ncss|]\}}t||�VqdS�Nr)�.0�d�nr&r&r'�	<genexpr>�sz_sum.<locals>.<genexpr>)�_exact_ratio�get�_coerce�int�typer�map�	_isfinite�AssertionError�sum�sorted�items)�data�start�countr,r+ZpartialsZpartials_get�T�typ�values�totalr&r&r'�_sum{s$
r@cCs.z
|��WStk
r(t�|�YSXdSr))Z	is_finite�AttributeError�mathZisfinite)�xr&r&r'r4�s
r4cCs�|tk	std��||kr|S|tks,|tkr0|S|tkr<|St||�rJ|St||�rX|St|t�rf|St|t�rt|St|t�r�t|t�r�|St|t�r�t|t�r�|Sd}t||j|jf��dS)z�Coerce types T and S to a common type, or raise TypeError.

    Coercion rules are currently an implementation detail. See the CoerceTest
    test class in test_statistics for details.
    zinitial type T is boolz"don't know how to coerce %s and %sN)�boolr5r1�
issubclassr�float�	TypeErrorr#)r<�S�msgr&r&r'r0�s*



r0cCs�zrt|�tkst|�tkr$|��WSz|j|jfWWStk
rnz|��WYWStk
rhYnXYnXWn,ttfk
r�t	|�r�t
�|dfYSXd}t|�t|�j
���dS)z�Return Real number x to exact (numerator, denominator) pair.

    >>> _exact_ratio(0.25)
    (1, 4)

    x is expected to be an int, Fraction, Decimal or float.
    Nz0can't convert type '{}' to numerator/denominator)r2rFr�as_integer_ratio�	numerator�denominatorrA�
OverflowError�
ValueErrorr4r5rG�formatr#)rCrIr&r&r'r.�s
r.cCspt|�|kr|St|t�r(|jdkr(t}z
||�WStk
rjt|t�rd||j�||j�YS�YnXdS)z&Convert value to given numeric type T.r(N)r2rEr1rLrFrGrrK)�valuer<r&r&r'�_convert�s

rQcCs.t||�}|t|�kr&|||kr&|St�dS)z,Locate the leftmost value exactly equal to xN)r�lenrN)�arC�ir&r&r'�
_find_lteq
s
rUcCs>t|||d�}|t|�dkr6||d|kr6|dSt�dS)z-Locate the rightmost value exactly equal to x)�lor(N)rrRrN)rS�lrCrTr&r&r'�
_find_rteqs rX�negative valueccs$|D]}|dkrt|��|VqdS)z7Iterate over values, failing if any are less than zero.rN)r)r>�errmsgrCr&r&r'�	_fail_negsr[cCsTt|�|krt|�}t|�}|dkr,td��t|�\}}}||ksFt�t|||�S)a�Return the sample arithmetic mean of data.

    >>> mean([1, 2, 3, 4, 4])
    2.8

    >>> from fractions import Fraction as F
    >>> mean([F(3, 7), F(1, 21), F(5, 3), F(1, 3)])
    Fraction(13, 21)

    >>> from decimal import Decimal as D
    >>> mean([D("0.5"), D("0.75"), D("0.625"), D("0.375")])
    Decimal('0.5625')

    If ``data`` is empty, StatisticsError will be raised.
    r(z%mean requires at least one data point)�iter�listrRrr@r5rQ)r9r,r<r?r;r&r&r'r'scstzt|��Wn0tk
r<d��fdd�}t||��}Yn
Xt|�}z
|�WStk
rntd�d�YnXdS)z�Convert data to floats and compute the arithmetic mean.

    This runs faster than the mean() function and it always returns a float.
    If the input dataset is empty, it raises a StatisticsError.

    >>> fmean([3.5, 4.0, 5.25])
    4.25
    rc3s t|dd�D]\�}|VqdS)Nr()r:)�	enumerate)�iterablerC�r,r&r'r;Oszfmean.<locals>.countz&fmean requires at least one data pointN)rRrGr �ZeroDivisionErrorr)r9r;r?r&r`r'rAs	
cCs8ztttt|���WStk
r2td�d�YnXdS)aYConvert data to floats and compute the geometric mean.

    Raises a StatisticsError if the input dataset is empty,
    if it contains a zero, or if it contains a negative value.

    No special efforts are made to achieve exact results.
    (However, this may change in the future.)

    >>> round(geometric_mean([54, 24, 36]), 9)
    36.0
    zHgeometric mean requires a non-empty dataset  containing positive numbersN)rrr3rrNr)r9r&r&r'r\s�cCs�t|�|krt|�}d}t|�}|dkr2td��n<|dkrn|d}t|tjtf�rf|dkrbt|��|Std��z"t	dd�t
||�D��\}}}Wntk
r�YdSX||ks�t�t
|||�S)aReturn the harmonic mean of data.

    The harmonic mean, sometimes called the subcontrary mean, is the
    reciprocal of the arithmetic mean of the reciprocals of the data,
    and is often appropriate when averaging quantities which are rates
    or ratios, for example speeds. Example:

    Suppose an investor purchases an equal value of shares in each of
    three companies, with P/E (price/earning) ratios of 2.5, 3 and 10.
    What is the average P/E ratio for the investor's portfolio?

    >>> harmonic_mean([2.5, 3, 10])  # For an equal investment portfolio.
    3.6

    Using the arithmetic mean would give an average of about 5.167, which
    is too high.

    If ``data`` is empty, or any element is less than zero,
    ``harmonic_mean`` will raise ``StatisticsError``.
    z.harmonic mean does not support negative valuesr(z.harmonic_mean requires at least one data pointrzunsupported typecss|]}d|VqdS)r(Nr&�r*rCr&r&r'r-�sz harmonic_mean.<locals>.<genexpr>)r\r]rRr�
isinstance�numbersZRealrrGr@r[rar5rQ)r9rZr,rCr<r?r;r&r&r'ros&
"cCs\t|�}t|�}|dkr td��|ddkr8||dS|d}||d||dSdS)aBReturn the median (middle value) of numeric data.

    When the number of data points is odd, return the middle data point.
    When the number of data points is even, the median is interpolated by
    taking the average of the two middle values:

    >>> median([1, 3, 5])
    3
    >>> median([1, 3, 5, 7])
    4.0

    r�no median for empty data�r(N�r7rRr)r9r,rTr&r&r'r�s
cCsLt|�}t|�}|dkr td��|ddkr8||dS||ddSdS)a	Return the low median of numeric data.

    When the number of data points is odd, the middle value is returned.
    When it is even, the smaller of the two middle values is returned.

    >>> median_low([1, 3, 5])
    3
    >>> median_low([1, 3, 5, 7])
    3

    rrerfr(Nrg�r9r,r&r&r'r
�scCs,t|�}t|�}|dkr td��||dS)aReturn the high median of data.

    When the number of data points is odd, the middle value is returned.
    When it is even, the larger of the two middle values is returned.

    >>> median_high([1, 3, 5])
    3
    >>> median_high([1, 3, 5, 7])
    5

    rrerfrgrhr&r&r'r	�s
r(c
Cs�t|�}t|�}|dkr"td��n|dkr2|dS||d}||fD]}t|ttf�rFtd|��qFz||d}Wn(tk
r�t|�t|�d}YnXt||�}t	|||�}|}||d}	|||d||	S)a�Return the 50th percentile (median) of grouped continuous data.

    >>> median_grouped([1, 2, 2, 3, 4, 4, 4, 4, 4, 5])
    3.7
    >>> median_grouped([52, 52, 53, 54])
    52.5

    This calculates the median as the 50th percentile, and should be
    used when your data is continuous and grouped. In the above example,
    the values 1, 2, 3, etc. actually represent the midpoint of classes
    0.5-1.5, 1.5-2.5, 2.5-3.5, etc. The middle value falls somewhere in
    class 3.5-4.5, and interpolation is used to estimate it.

    Optional argument ``interval`` represents the class interval, and
    defaults to 1. Changing the class interval naturally will change the
    interpolated 50th percentile value:

    >>> median_grouped([1, 3, 3, 5, 7], interval=1)
    3.25
    >>> median_grouped([1, 3, 3, 5, 7], interval=2)
    3.5

    This function does not check whether the data points are at least
    ``interval`` apart.
    rrer(rfzexpected number but got %r)
r7rRrrc�str�bytesrGrFrUrX)
r9Zintervalr,rC�obj�L�l1�l2Zcf�fr&r&r'r�s&

cCsHt|�}t|��d�}z|ddWStk
rBtd�d�YnXdS)axReturn the most common data point from discrete or nominal data.

    ``mode`` assumes discrete data, and returns a single value. This is the
    standard treatment of the mode as commonly taught in schools:

        >>> mode([1, 1, 2, 3, 3, 3, 3, 4])
        3

    This also works with nominal (non-numeric) data:

        >>> mode(["red", "blue", "blue", "red", "green", "red", "red"])
        'red'

    If there are multiple modes with same frequency, return the first one
    encountered:

        >>> mode(['red', 'red', 'green', 'blue', 'blue'])
        'red'

    If *data* is empty, ``mode``, raises StatisticsError.

    r(rzno mode for empty dataN)r\r"�most_common�
IndexErrorr)r9Zpairsr&r&r'rscCs@tt|����}tt|td�d�dgf�\}}tttd�|��S)a.Return a list of the most frequently occurring values.

    Will return more than one result if there are multiple modes
    or an empty list if *data* is empty.

    >>> multimode('aabbbbbbbbcc')
    ['b']
    >>> multimode('aabbbbccddddeeffffgg')
    ['b', 'd', 'f']
    >>> multimode('')
    []
    r()�keyr)r"r\rp�nextrr!r]r3)r9ZcountsZmaxcountZ
mode_itemsr&r&r'r5s
��	exclusive)r,�methodc
CsL|dkrtd��t|�}t|�}|dkr0td��|dkr�|d}g}td|�D]N}|||}||||}||||||d||}	|�|	�qN|S|dk�r:|d}g}td|�D]r}|||}|dkr�dn||dkr�|dn|}||||}||d||||||}	|�|	�q�|Std|����dS)	a�Divide *data* into *n* continuous intervals with equal probability.

    Returns a list of (n - 1) cut points separating the intervals.

    Set *n* to 4 for quartiles (the default).  Set *n* to 10 for deciles.
    Set *n* to 100 for percentiles which gives the 99 cuts points that
    separate *data* in to 100 equal sized groups.

    The *data* can be any iterable containing sample.
    The cut points are linearly interpolated between data points.

    If *method* is set to *inclusive*, *data* is treated as population
    data.  The minimum value is treated as the 0th percentile and the
    maximum value is treated as the 100th percentile.
    r(zn must be at least 1rfz"must have at least two data pointsZ	inclusiveruzUnknown method: N)rr7rR�range�appendrN)
r9r,rvZld�m�resultrT�jZdeltaZinterpolatedr&r&r'rls4$
$$cs��dk	r,t�fdd�|D��\}}}||fSt|��t�fdd�|D��\}}}t�fdd�|D��\}}}||kr|||ks�t�||dt|�8}|dkr�td|��||fS)	a;Return sum of square deviations of sequence data.

    If ``c`` is None, the mean is calculated in one pass, and the deviations
    from the mean are calculated in a second pass. Otherwise, deviations are
    calculated from ``c`` as given. Use the second case with care, as it can
    lead to garbage results.
    Nc3s|]}|�dVqdS�rfNr&rb��cr&r'r-�sz_ss.<locals>.<genexpr>c3s|]}|�dVqdSr|r&rbr}r&r'r-�sc3s|]}|�VqdSr)r&rbr}r&r'r-�srfrz%negative sum of square deviations: %f)r@rr5rR)r9r~r<r?r;�UZtotal2Zcount2r&r}r'�_ss�sr�cCsLt|�|krt|�}t|�}|dkr,td��t||�\}}t||d|�S)a�Return the sample variance of data.

    data should be an iterable of Real-valued numbers, with at least two
    values. The optional argument xbar, if given, should be the mean of
    the data. If it is missing or None, the mean is automatically calculated.

    Use this function when your data is a sample from a population. To
    calculate the variance from the entire population, see ``pvariance``.

    Examples:

    >>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]
    >>> variance(data)
    1.3720238095238095

    If you have already calculated the mean of your data, you can pass it as
    the optional second argument ``xbar`` to avoid recalculating it:

    >>> m = mean(data)
    >>> variance(data, m)
    1.3720238095238095

    This function does not check that ``xbar`` is actually the mean of
    ``data``. Giving arbitrary values for ``xbar`` may lead to invalid or
    impossible results.

    Decimals and Fractions are supported:

    >>> from decimal import Decimal as D
    >>> variance([D("27.5"), D("30.25"), D("30.25"), D("34.5"), D("41.75")])
    Decimal('31.01875')

    >>> from fractions import Fraction as F
    >>> variance([F(1, 6), F(1, 2), F(5, 3)])
    Fraction(67, 108)

    rfz*variance requires at least two data pointsr(�r\r]rRrr�rQ)r9�xbarr,r<�ssr&r&r'r�s&cCsHt|�|krt|�}t|�}|dkr,td��t||�\}}t|||�S)a,Return the population variance of ``data``.

    data should be a sequence or iterable of Real-valued numbers, with at least one
    value. The optional argument mu, if given, should be the mean of
    the data. If it is missing or None, the mean is automatically calculated.

    Use this function to calculate the variance from the entire population.
    To estimate the variance from a sample, the ``variance`` function is
    usually a better choice.

    Examples:

    >>> data = [0.0, 0.25, 0.25, 1.25, 1.5, 1.75, 2.75, 3.25]
    >>> pvariance(data)
    1.25

    If you have already calculated the mean of the data, you can pass it as
    the optional second argument to avoid recalculating it:

    >>> mu = mean(data)
    >>> pvariance(data, mu)
    1.25

    Decimals and Fractions are supported:

    >>> from decimal import Decimal as D
    >>> pvariance([D("27.5"), D("30.25"), D("30.25"), D("34.5"), D("41.75")])
    Decimal('24.815')

    >>> from fractions import Fraction as F
    >>> pvariance([F(1, 4), F(5, 4), F(1, 2)])
    Fraction(13, 72)

    r(z*pvariance requires at least one data pointr�)r9�mur,r<r�r&r&r'r�s#cCs8t||�}z
|��WStk
r2t�|�YSXdS)z�Return the square root of the sample variance.

    See ``variance`` for arguments and other details.

    >>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])
    1.0810874155219827

    N)rrrArB)r9r��varr&r&r'rs
	

cCs8t||�}z
|��WStk
r2t�|�YSXdS)z�Return the square root of the population variance.

    See ``pvariance`` for arguments and other details.

    >>> pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])
    0.986893273527251

    N)rrrArB)r9r�r�r&r&r'r
&s
	

cCs|d}t|�dkr�d||}d|d|d|d|d|d	|d
|d|}d|d
|d|d|d|d|d|d}||}|||S|dkr�|nd|}tt|��}|dk�r^|d}d|d|d|d|d|d|d|d}d|d |d!|d"|d#|d$|d%|d}n�|d}d&|d'|d(|d)|d*|d+|d,|d-}d.|d/|d0|d1|d2|d3|d4|d}||}|dk�r�|}|||S)5N��?g333333�?g��Q��?g^�}o)��@g�E.k�R�@g ��Ul�@g*u��>l�@g�N����@g�"]Ξ@gnC���`@gu��@giK��~j�@gv��|E�@g��d�|1�@gfR��r��@g��u.2�@g���~y�@g�n8(E@��?�g@g�������?g鬷�ZaI?gg�El�D�?g7\�����?g�uS�S�?g�=�.
@gj%b�@g���Hw�@gjR�e�?g�9dh?
>g('߿��A?g��~z �?g@�3��?gɅ3��?g3fR�x�?gI�F��l@g����t��>g*�Y��n�>gESB\T?g�N;A+�?g�UR1��?gE�F���?gP�n��@g&�>���@g����i�<g�@�F�>g�tcI,\�>g�ŝ���I?g*F2�v�?g�C4�?g��O�1�?)rrr)�pr��sigma�q�rZnumZdenrCr&r&r'�_normal_dist_inv_cdf9sd���������������������������
��������������������������	��������������������������
r�c@s�eZdZdZddd�Zd8dd�Zed	d
��Zdd�d
d�Zdd�Z	dd�Z
dd�Zd9dd�Zdd�Z
edd��Zedd��Zedd��Zed d!��Zed"d#��Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�ZeZd0d1�ZeZd2d3�Zd4d5�Zd6d7�ZdS):rz(Normal distribution of a random variablez(Arithmetic mean of a normal distributionz+Standard deviation of a normal distribution)�_mu�_sigmar�r�cCs(|dkrtd��t|�|_t|�|_dS)zDNormalDist where mu is the mean and sigma is the standard deviation.r�zsigma must be non-negativeN)rrFr�r�)�selfr�r�r&r&r'�__init__�s
zNormalDist.__init__cCs.t|ttf�st|�}t|�}||t||��S)z5Make a normal distribution instance from sample data.)rcr]�tuplerr)�clsr9r�r&r&r'�from_samples�szNormalDist.from_samplesN)�seedcsB|dkrtjn
t�|�j�|j|j�����fdd�t|�D�S)z=Generate *n* samples for a given mean and standard deviation.Ncsg|]}�����qSr&r&�r*rT��gaussr�r�r&r'�
<listcomp>�sz&NormalDist.samples.<locals>.<listcomp>)�randomr�ZRandomr�r�rw)r�r,r�r&r�r'�samples�szNormalDist.samplescCs<|jd}|std��t||jdd|�tt|�S)z4Probability density function.  P(x <= X < x+dx) / dx�@z$pdf() not defined when sigma is zerog�)r�rrr�rr)r�rCrr&r&r'�pdf�s
zNormalDist.pdfcCs2|jstd��ddt||j|jtd��S)z,Cumulative distribution function.  P(X <= x)z$cdf() not defined when sigma is zeror�r�r�)r�rrr�r)r�rCr&r&r'�cdf�szNormalDist.cdfcCs:|dks|dkrtd��|jdkr*td��t||j|j�S)aSInverse cumulative distribution function.  x : P(X <= x) = p

        Finds the value of the random variable such that the probability of
        the variable being less than or equal to that value equals the given
        probability.

        This function is also called the percent point function or quantile
        function.
        r�r�z$p must be in the range 0.0 < p < 1.0z-cdf() not defined when sigma at or below zero)rr�r�r�)r�r�r&r&r'�inv_cdf�s


zNormalDist.inv_cdfrtcs��fdd�td��D�S)anDivide into *n* continuous intervals with equal probability.

        Returns a list of (n - 1) cut points separating the intervals.

        Set *n* to 4 for quartiles (the default).  Set *n* to 10 for deciles.
        Set *n* to 100 for percentiles which gives the 99 cuts points that
        separate the normal distribution in to 100 equal sized groups.
        csg|]}��|���qSr&)r�r��r,r�r&r'r��sz(NormalDist.quantiles.<locals>.<listcomp>r()rw)r�r,r&r�r'r�s	zNormalDist.quantilescCst|t�std��||}}|j|jf|j|jfkr>||}}|j|j}}|rT|s\td��||}t|j|j�}|s�dt|d|jt	d��S|j||j|}|j|jt	|d|t
||��}	||	|}
||	|}dt|�|
�|�|
��t|�|�|�|��S)a�Compute the overlapping coefficient (OVL) between two normal distributions.

        Measures the agreement between two normal probability distributions.
        Returns a value between 0.0 and 1.0 giving the overlapping area in
        the two underlying probability density functions.

            >>> N1 = NormalDist(2.4, 1.6)
            >>> N2 = NormalDist(3.2, 2.0)
            >>> N1.overlap(N2)
            0.8035050657330205
        z$Expected another NormalDist instancez(overlap() not defined when sigma is zeror�r�)rcrrGr�r�rrrrrrr�)r��other�X�YZX_varZY_varZdvZdmrS�b�x1�x2r&r&r'�overlap�s"


(zNormalDist.overlapcCs|jS)z+Arithmetic mean of the normal distribution.�r��r�r&r&r'r�szNormalDist.meancCs|jS)z,Return the median of the normal distributionr�r�r&r&r'r�szNormalDist.mediancCs|jS)z�Return the mode of the normal distribution

        The mode is the value x where which the probability density
        function (pdf) takes its maximum value.
        r�r�r&r&r'r�szNormalDist.modecCs|jS)z.Standard deviation of the normal distribution.�r�r�r&r&r'r�szNormalDist.stdevcCs
|jdS)z!Square of the standard deviation.r�r�r�r&r&r'rszNormalDist.variancecCs8t|t�r&t|j|jt|j|j��St|j||j�S)ajAdd a constant or another NormalDist instance.

        If *other* is a constant, translate mu by the constant,
        leaving sigma unchanged.

        If *other* is a NormalDist, add both the means and the variances.
        Mathematically, this works only if the two distributions are
        independent or if they are jointly normally distributed.
        �rcrr�rr��r�r�r&r&r'�__add__	s

zNormalDist.__add__cCs8t|t�r&t|j|jt|j|j��St|j||j�S)asSubtract a constant or another NormalDist instance.

        If *other* is a constant, translate by the constant mu,
        leaving sigma unchanged.

        If *other* is a NormalDist, subtract the means and add the variances.
        Mathematically, this works only if the two distributions are
        independent or if they are jointly normally distributed.
        r�r�r&r&r'�__sub__s

zNormalDist.__sub__cCst|j||jt|��S)z�Multiply both mu and sigma by a constant.

        Used for rescaling, perhaps to change measurement units.
        Sigma is scaled with the absolute value of the constant.
        �rr�r�rr�r&r&r'�__mul__%szNormalDist.__mul__cCst|j||jt|��S)z�Divide both mu and sigma by a constant.

        Used for rescaling, perhaps to change measurement units.
        Sigma is scaled with the absolute value of the constant.
        r�r�r&r&r'�__truediv__-szNormalDist.__truediv__cCst|j|j�S)zReturn a copy of the instance.�rr�r��r�r&r&r'�__pos__5szNormalDist.__pos__cCst|j|j�S)z(Negates mu while keeping sigma the same.r�r�r&r&r'�__neg__9szNormalDist.__neg__cCs
||S)z<Subtract a NormalDist from a constant or another NormalDist.r&r�r&r&r'�__rsub__?szNormalDist.__rsub__cCs&t|t�stS|j|jko$|j|jkS)zFTwo NormalDist objects are equal if their mu and sigma are both equal.)rcr�NotImplementedr�r�r�r&r&r'�__eq__Es
zNormalDist.__eq__cCst|j|jf�S)zCNormalDist objects hash equal if their mu and sigma are both equal.)�hashr�r�r�r&r&r'�__hash__KszNormalDist.__hash__cCs t|�j�d|j�d|j�d�S)Nz(mu=z, sigma=�))r2r#r�r�r�r&r&r'�__repr__OszNormalDist.__repr__)r�r�)rt) r#r$r%�__doc__�	__slots__r��classmethodr�r�r�r�r�rr��propertyrrrrrr�r�r�r�r�r��__radd__r��__rmul__r�r�r�r&r&r&r'r�sF�


"




)r��__main__)�isclose)�add�sub�mul�truediv)�repeat�
������i��z
Test z with another NormalDist:�z with a constant:�z
Test constant with �:cCs@t|j|jdd�st||f��t|j|jdd�s<t||f��dS)Ng{�G�z�?)Zrel_tol)r�rr5r)�G1�G2r&r&r'�assert_closesr�i�����I��/g`@@cCsg|]}|t�qSr&��srbr&r&r'r��sr�cCsg|]}|t�qSr&r�rbr&r&r'r��scCsg|]}|t�qSr&r�rbr&r&r'r��scCsg|]}|t�qSr&r�rbr&r&r'r��scCsg|]\}}||�qSr&r&�r*rC�yr&r&r'r��scCsg|]\}}||�qSr&r&r�r&r&r'r��s)r)rY)r()N)N)N)N)N)Sr��__all__rBrdr�Z	fractionsrZdecimalr�	itertoolsrZbisectrrrrrrrrrr �operatorr!�collectionsr"rNrr@r4r0r.rQrUrXr[rrrrrr
r	rrrrr�rrrr
r�rZ_statistics�ImportErrorr#r�r�r�r�r�r�ZdoctestZg1Zg2r5r,r�r�r��func�printr�r3Zconstr�r�r�r�rH�zipZtestmodr&r&r&r'�<module>s�S�(
: 

/
779

/
,

JQ






�
�
shutil.cpython-38.pyc000064400000111044150335716500010512 0ustar00U

e5d1��@s�dZddlZddlZddlZddlZddlZddlZzddlZ[dZWne	k
r^dZYnXzddl
Z
[
dZWne	k
r�dZYnXzddlZ[dZ
Wne	k
r�dZ
YnXzddlmZWne	k
r�dZYnXzddlmZWne	k
�rdZYnXejdkZdZZejdk�r6ddlZne�rDddlZe�rNd	nd
Zeed��ohej�d�ae�oxeed
�ZdZdddddddddddddddddd d!d"d#d$d%d&d'gZGd(d�de�ZGd)d'�d'e�Z Gd*d�de�Z!Gd+d�de�Z"Gd,d-�d-e�Z#Gd.d/�d/e$�Z%Gd0d1�d1e$�Z&d2d3�Z'd4d5�Z(efd6d7�Z)d�d8d�Z*d9d:�Z+d;d<�Z,d=d>�Z-dd?�d@d�Z.dd?�dAd�Z/eedB��r�dd?�dCdD�Z0ndEdD�Z0dd?�dFd�Z1dd?�dGd�Z2dd?�dHd�Z3dId#�Z4d�dJdK�Z5dde3ddfdLd�Z6eej7dM��rdNdO�Z8dPdQ�Z9ndRdO�Z8dSdQ�Z9dTdU�Z:dVdW�Z;ej<ejej=ej>hej?k�ofej@ejAk�ofejejBkZCd�dXd�ZDeCeD_EdYdZ�ZFe3fd[d�ZGd\d]�ZHd^d_�ZId`da�ZJdbdc�ZKd�dedf�ZLd�dgdh�ZMdieLdjgdkfiZNe�r�eLdlgdmfeNdn<eMgdofeNdp<e�r
eLdqgdrfeNds<e
�r eLdtgdufeNdv<dwd�ZOd�dyd�ZPdzd�ZQd�d{d�ZRd|d�ZSd}d~�ZTd�dd �ZUd�d!�ZVd�d��ZWd�d��ZXdd��d�d��ZYd�geYgdkfd�geXgdofd��ZZe�r�d�d�geYgdmfeZdn<e�r�d�d�geYgdrfeZds<e
�r�d�d�geYgdufeZdv<d�d��Z[d�dd��d�d"�Z\eed���rLe�]d��e�^d�d��Z_d�e_j`_d�e_ja_d�e_jb_d�d��Zcn$e�rpe�]d��e�^d�d��Z_d�d��Zcd�d�d$�Zdd�d�d&�Zed�d��ZfejgejhBdfd�d%�ZidS)�z�Utility functions for copying and archiving files and directory trees.

XXX The functions here don't copy the resource fork or other metadata on Mac.

�NTF)�getpwnam)�getgrnam�nt�posixii�sendfileZlinux�
_fcopyfilez%.COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS;.MSC�copyfileobj�copyfile�copymode�copystat�copy�copy2�copytree�move�rmtree�Error�SpecialFileError�	ExecError�make_archive�get_archive_formats�register_archive_format�unregister_archive_format�get_unpack_formats�register_unpack_format�unregister_unpack_format�unpack_archive�ignore_patterns�chown�which�get_terminal_size�
SameFileErrorc@seZdZdS)rN)�__name__�
__module__�__qualname__�r$r$�/usr/lib64/python3.8/shutil.pyrEsc@seZdZdZdS)r z5Raised when source and destination are the same file.N�r!r"r#�__doc__r$r$r$r%r Hsc@seZdZdZdS)rz|Raised when trying to do a kind of operation (e.g. copying) which is
    not supported on a special file (e.g. a named pipe)Nr&r$r$r$r%rKsc@seZdZdZdS)rz+Raised when a command could not be executedNr&r$r$r$r%rOsc@seZdZdZdS)�	ReadErrorz%Raised when an archive cannot be readNr&r$r$r$r%r(Rsr(c@seZdZdZdS)�
RegistryErrorzVRaised when a registry operation with the archiving
    and unpacking registries failsNr&r$r$r$r%r)Usr)c@seZdZdZdS)�_GiveupOnFastCopyzuRaised as a signal to fallback on using raw read()/write()
    file copy when fast-copy functions fail to do so.
    Nr&r$r$r$r%r*Ysr*c
Cs�z|��}|��}Wn*tk
r>}zt|��W5d}~XYnXzt�|||�WnTtk
r�}z6|j|_|j|_|j	t	j
t	jhkr�t|��n|d�W5d}~XYnXdS)zhCopy a regular file content or metadata by using high-performance
    fcopyfile(3) syscall (macOS).
    N)�fileno�	Exceptionr*rr�OSError�name�filename�	filename2�errno�EINVAL�ENOTSUP)�fsrc�fdst�flags�infd�outfd�errr$r$r%�_fastcopy_fcopyfile^s
r:c
CsDz|��}|��}Wn*tk
r>}zt|��W5d}~XYnXztt�|�jd�}Wntk
rnd}YnXtj	dkr�t
|d�}d}zt�||||�}Wn�tk
�r&}zj|j|_
|j|_|jtjkr�dat|��|jtjkr�|d�|dk�rt�|dtj�dk�rt|��|�W5d}~XYq�X|dk�r6�q@||7}q�dS)z�Copy data from one regular mmap-like fd to another by using
    high-performance sendfile(2) syscall.
    This should work on Linux >= 2.6.33 only.
    Ni�ili@rF)r+r,r*�max�os�fstat�st_sizer-�sys�maxsize�minrr.r/r0r1ZENOTSOCK�_USE_CP_SENDFILEZENOSPC�lseek�SEEK_CUR)r4r5r7r8r9Z	blocksize�offsetZsentr$r$r%�_fastcopy_sendfilers8


 
rFc
Csn|j}|j}tt|���L}||�}|s*q`q||krV|d|��}|�|�W5QRXq||�qW5QRXdS)z�readinto()/memoryview() based variant of copyfileobj().
    *fsrc* must support readinto() method and both files must be
    open in binary mode.
    N)�readinto�write�
memoryview�	bytearray)r4r5�lengthZ
fsrc_readinto�
fdst_writeZmv�nZsmvr$r$r%�_copyfileobj_readinto�srNcCs0|st}|j}|j}||�}|s"q,||�qdS)z=copy data from file-like object fsrc to file-like object fdstN)�COPY_BUFSIZE�readrH)r4r5rKZ	fsrc_readrLZbufr$r$r%r�scCs�t|tj�rJttjd�rJztj�|��t�|��WStk
rHYdSXttjd�r~ztj�||�WStk
r|YdSXtj�	tj�
|��tj�	tj�
|��kS)N�samestatF�samefile)�
isinstancer<�DirEntry�hasattr�pathrQ�statr-rR�normcase�abspath��src�dstr$r$r%�	_samefile�s�r]cCst|tj�r|��St�|�S�N)rSr<rTrW��fnr$r$r%�_stat�sracCs t|tj�r|��Stj�|�Sr^)rSr<rT�
is_symlinkrV�islinkr_r$r$r%�_islink�srd��follow_symlinksc	Cs�t�d||�t||�r(td�||���d}t||g�D]j\}}zt|�}Wntk
r`Yq8Xt�	|j
�r�t|tj
�r�|jn|}td|��tr8|dkr8|j}q8|s�t|�r�t�t�|�|��n
t|d����}t|d���}t�r,z,t||tj�|WW5QR�W5QR�Stk
�r(YnXn�t�rtz(t||�|WW5QR�W5QR�Stk
�rpYnXn>t�r�|dk�r�t||t|t��|W5QR�W5QR�St ||�W5QRXW5QRX|S)z�Copy data from src to dst in the most efficient way possible.

    If follow_symlinks is not set and src is a symbolic link, a new
    symlink will be created instead of copying the file it points to.

    zshutil.copyfilez{!r} and {!r} are the same filerz`%s` is a named pipe�rb�wb)!r?�auditr]r �format�	enumeraterar-rW�S_ISFIFO�st_moderSr<rTrVr�_WINDOWSr>rd�symlink�readlink�open�_HAS_FCOPYFILEr:rZ_COPYFILE_DATAr*rBrFrNrArOr)	r[r\rf�	file_size�ir`�str4r5r$r$r%r	�sD

cCspt�d||�|sFt|�rFtj�|�rFttd�r@tjtj}}qRdSnt	tj
}}||�}||t�|j
��dS)z�Copy mode bits from src to dst.

    If follow_symlinks is not set, symlinks aren't followed if and only
    if both `src` and `dst` are symlinks.  If `lchmod` isn't available
    (e.g. Linux) this method does nothing.

    zshutil.copymode�lchmodN)r?rirdr<rVrcrU�lstatrvra�chmodrW�S_IMODErm)r[r\rfZ	stat_funcZ
chmod_funcrur$r$r%r
!s
�	listxattrcCs�ztj||d�}Wn@tk
rR}z"|jtjtjtjfkr<�WY�dSd}~XYnX|D]j}z&tj|||d�}tj||||d�WqXtk
r�}z |jtj	tjtjtjfkr��W5d}~XYqXXqXdS)z�Copy extended filesystem attributes from `src` to `dst`.

        Overwrite existing attributes.

        If `follow_symlinks` is false, symlinks won't be followed.

        reN)
r<rzr-r1r3ZENODATAr2�getxattr�setxattrZEPERM)r[r\rf�names�er.�valuer$r$r%�
_copyxattr7s	�r�cOsdSr^r$)�args�kwargsr$r$r%r�Osc	
s`t�d||�ddd�dd��|p6t|�o4tj�|�}|rJ�fdd�}n�fdd�}t|tj�rp|j|d	�}n|d
�||d	�}t�	|j
�}|d�||j|jf|d�t
|||d	�z|d�|||d	�Wntk
r�YnXt|d
��r\z|d�||j|d	�WnVtk
�rZ}z6dD]*}tt|��r|jtt|�k�r�qJ�q�W5d}~XYnXdS)a�Copy file metadata

    Copy the permission bits, last access time, last modification time, and
    flags from `src` to `dst`. On Linux, copystat() also copies the "extended
    attributes" where possible. The file contents, owner, and group are
    unaffected. `src` and `dst` are path-like objects or path names given as
    strings.

    If the optional flag `follow_symlinks` is not set, symlinks aren't
    followed if and only if both `src` and `dst` are symlinks.
    zshutil.copystatN)�nsrfcWsdSr^r$)r�rfr�r$r$r%�_nop`szcopystat.<locals>._nopcstt|��Sr^)�getattrr<�r.�r�r$r%�lookupgszcopystat.<locals>.lookupcstt|��}|tjkr|S�Sr^)r�r<�supports_follow_symlinks)r.r`r�r$r%r�ls
rerW�utimerx�st_flagsZchflags)Z
EOPNOTSUPPr3)r?rirdr<rVrcrSrTrWryrm�st_atime_ns�st_mtime_nsr��NotImplementedErrorrUr�r-r1r�)	r[r\rfZfollowr�ru�mode�whyr9r$r�r%rRs4�
cCsBtj�|�r"tj�|tj�|��}t|||d�t|||d�|S)a3Copy data and mode bits ("cp src dst"). Return the file's destination.

    The destination may be a directory.

    If follow_symlinks is false, symlinks won't be followed. This
    resembles GNU's "cp -P src dst".

    If source and destination are the same file, a SameFileError will be
    raised.

    re)r<rV�isdir�join�basenamer	r
�r[r\rfr$r$r%r�s
cCsBtj�|�r"tj�|tj�|��}t|||d�t|||d�|S)a0Copy data and metadata. Return the file's destination.

    Metadata is copied with copystat(). Please see the copystat function
    for more information.

    The destination may be a directory.

    If follow_symlinks is false, symlinks won't be followed. This
    resembles GNU's "cp -P src dst".
    re)r<rVr�r�r�r	rr�r$r$r%r
�s
cs�fdd�}|S)z�Function that can be used as copytree() ignore parameter.

    Patterns is a sequence of glob-style patterns
    that are used to exclude filescs(g}�D]}|�t�||��qt|�Sr^)�extend�fnmatch�filter�set)rVr}�
ignored_names�pattern��patternsr$r%�_ignore_patterns�sz)ignore_patterns.<locals>._ignore_patternsr$)r�r�r$r�r%r�scCs>|dk	r$|t�|�dd�|D��}nt�}tj||d�g}	|tkpJ|tk}
|D�]~}|j|krbqPtj�||j�}tj�||j�}
|
r�|n|}z�|�	�}|r�tjdkr�|j
dd�}|jt
jkr�d}|�r8t�
|�}|r�t�||
�t||
|d�nBtj�|��s|�rWqP|���r,t||
||||d�n
|||
�n*|���rXt||
||||d�n
|||
�WqPtk
�r�}z|	�|jd�W5d}~XYqPtk
�r�}z|	�||
t|�f�W5d}~XYqPXqPzt||�WnJtk
�r*}z*t|d	d�dk�r|	�||t|�f�W5d}~XYnX|	�r:t|	��|S)
NcSsg|]
}|j�qSr$r�)�.0�xr$r$r%�
<listcomp>�sz_copytree.<locals>.<listcomp>)�exist_okrFre)�
dirs_exist_okrZwinerror)r<�fspathr��makedirsr
rr.rVr�rbrW�st_reparse_tag�IO_REPARSE_TAG_MOUNT_POINTrpror�exists�is_dirrrr�r�r-�append�strr�)�entriesr[r\�symlinks�ignore�
copy_function�ignore_dangling_symlinksr�r��errorsZuse_srcentryZsrcentryZsrcnameZdstnameZsrcobjrbrw�linktor9r�r$r$r%�	_copytree�s`




�
� (&r�c	
CsDt�d||�t�|��}t|�}W5QRXt||||||||d�S)aeRecursively copy a directory tree and return the destination directory.

    dirs_exist_ok dictates whether to raise an exception in case dst or any
    missing parent directory already exists.

    If exception(s) occur, an Error is raised with a list of reasons.

    If the optional symlinks flag is true, symbolic links in the
    source tree result in symbolic links in the destination tree; if
    it is false, the contents of the files pointed to by symbolic
    links are copied. If the file pointed by the symlink doesn't
    exist, an exception will be added in the list of errors raised in
    an Error exception at the end of the copy process.

    You can set the optional ignore_dangling_symlinks flag to true if you
    want to silence this exception. Notice that this has no effect on
    platforms that don't support os.symlink.

    The optional ignore argument is a callable. If given, it
    is called with the `src` parameter, which is the directory
    being visited by copytree(), and `names` which is the list of
    `src` contents, as returned by os.listdir():

        callable(src, names) -> ignored_names

    Since copytree() is called recursively, the callable will be
    called once for each directory that is copied. It returns a
    list of names relative to the `src` directory that should
    not be copied.

    The optional copy_function argument is a callable that will be used
    to copy each file. It will be called with the source path and the
    destination path as arguments. By default, copy2() is used, but any
    function that supports the same signature (like copy()) can be used.

    zshutil.copytree)r�r[r\r�r�r�r�r�)r?rir<�scandir�listr�)	r[r\r�r�r�r�r�Zitrr�r$r$r%rs&
��st_file_attributescCsPz4|jdd�}t�|j�o2|jtj@o0|jtjkWStk
rJYdSXdS�NFre)rW�S_ISDIRrmr��FILE_ATTRIBUTE_REPARSE_POINTr�r�r-)�entryrur$r$r%�
_rmtree_isdir6s
�r�cCsLz0t�|�}t�|j�p.|jtj@o.|jtjkWSt	k
rFYdSXdS)NF)
r<rwrW�S_ISLNKrmr�r�r�r�r-)rVrur$r$r%�_rmtree_islink?s

�r�cCs*z|jdd�WStk
r$YdSXdSr�)r�r-)r�r$r$r%r�HscCstj�|�Sr^)r<rVrc)rVr$r$r%r�Nsc	Cs&z"t�|��}t|�}W5QRXWn*tk
rL|tj|t���g}YnX|D]�}|j}t|�r�z|��rvtd��Wn,tk
r�|tjj	|t���YqRYnXt
||�qRzt�|�WqRtk
r�|tj|t���YqRXqRzt�|�Wn(tk
�r |tj|t���YnXdS)N�%Cannot call rmtree on a symbolic link)
r<r�r�r-r?�exc_inforVr�rbrc�_rmtree_unsafe�unlink�rmdir)rV�onerror�
scandir_itr�r��fullnamer$r$r%r�Rs0

r�c
Cs.z"t�|��}t|�}W5QRXWn@tk
rb}z"||_|tj|t���WY�dSd}~XYnX|D�]�}tj�||j	�}z|j
dd�}Wntk
r�d}YnNX|r�z|jdd�}	t�|	j
�}Wn*tk
r�|tj|t���YqhYnX|�r�ztj|j	tj|d�}
Wn(tk
�r:|tj|t���Yn�Xz�tj�|	t�|
���r�t|
||�ztj|j	|d�Wn(tk
�r�|tj|t���YnXn8ztd��Wn*tk
�r�|tjj|t���YnXW5t�|
�Xqhztj|j	|d�Wqhtk
�r&|tj|t���YqhXqhdS)NFre)�dir_fdr�)r<r�r�r-r/r?r�rVr�r.r�rWr�rmrwrq�O_RDONLY�closerQr=�_rmtree_safe_fdr�rcr�)�topfdrVr�r�r�r9r�r�r��orig_st�dirfdr$r$r%r�qsR


r�c	Cs�t�d|�|rdd�}n|dkr*dd�}t�r`t|t�rDt�|�}zt�|�}Wn(tk
rz|tj|t�	��YdSXzt�
|tj�}Wn(tk
r�|tj
|t�	��YdSXz�tj
�|t�|���rt|||�zt�|�Wn(tk
�r|tj|t�	��YnXn8ztd��Wn*tk
�rL|tj
j|t�	��YnXW5t�|�XnNzt|��rttd��Wn,tk
�r�|tj
j|t�	��YdSXt||�SdS)a�Recursively delete a directory tree.

    If ignore_errors is set, errors are ignored; otherwise, if onerror
    is set, it is called to handle the error with arguments (func,
    path, exc_info) where func is platform and implementation dependent;
    path is the argument to that function that caused it to fail; and
    exc_info is a tuple returned by sys.exc_info().  If ignore_errors
    is false and onerror is None, an exception is raised.

    z
shutil.rmtreecWsdSr^r$�r�r$r$r%r��szrmtree.<locals>.onerrorNcWs�dSr^r$r�r$r$r%r��sr�)r?ri�_use_fd_functionsrS�bytesr<�fsdecoderwr,r�rqr�r�rVrQr=r�r�r-rcr�r�)rV�
ignore_errorsr�r��fdr$r$r%r�sJ



cCs&tjjtjjpd}tj�|�|��S)N�)r<rV�sep�altsepr��rstrip)rVr�r$r$r%�	_basename�sr�c	CsTt�d||�|}tj�|�rbt||�r8t�||�dStj�|t|��}tj�	|�rbt
d|��zt�||�Wn�tk
�rNtj�|�r�t�
|�}t�||�t�|�n�tj�|��r6t||�r�t
d||f��t|��st�|tj��st�|��rtjdk�rtd||f��t|||dd�t|�n|||�t�|�YnX|S)	a+Recursively move a file or directory to another location. This is
    similar to the Unix "mv" command. Return the file or directory's
    destination.

    If the destination is a directory or a symlink to a directory, the source
    is moved inside the directory. The destination path must not already
    exist.

    If the destination already exists but is not a directory, it may be
    overwritten depending on os.rename() semantics.

    If the destination is on our current filesystem, then rename() is used.
    Otherwise, src is copied to the destination and then removed. Symlinks are
    recreated under the new name if os.rename() fails because of cross
    filesystem renames.

    The optional `copy_function` argument is a callable that will be used
    to copy the source or it will be delegated to `copytree`.
    By default, copy2() is used, but any function that supports the same
    signature (like copy()) can be used.

    A lot more could be done here...  A look at a mv.c shows a lot of
    the issues this implementation glosses over.

    zshutil.moveNz$Destination path '%s' already existsz.Cannot move a directory '%s' into itself '%s'.�darwinzKCannot move the non-empty directory '%s': Lacking write permission to '%s'.T)r�r�)r?rir<rVr�r]�renamer�r�r�rr-rcrpror��
_destinsrc�
_is_immutable�access�W_OK�listdir�platform�PermissionErrorrr)r[r\r�Zreal_dstr�r$r$r%r�sL


�
�����

cCsVtj�|�}tj�|�}|�tjj�s2|tjj7}|�tjj�sL|tjj7}|�|�Sr^)r<rVrY�endswithr��
startswithrZr$r$r%r�/sr�cCs(t|�}tjtjg}t|d�o&|j|kS)Nr�)rarW�UF_IMMUTABLE�SF_IMMUTABLErUr�)r[ruZimmutable_statesr$r$r%r�8sr�cCsNtdks|dkrdSzt|�}Wntk
r8d}YnX|dk	rJ|dSdS)z"Returns a gid, given a group name.N�)r�KeyError�r.�resultr$r$r%�_get_gid=s
r�cCsNtdks|dkrdSzt|�}Wntk
r8d}YnX|dk	rJ|dSdS)z"Returns an uid, given a user name.Nr�)rr�r�r$r$r%�_get_uidIs
r��gzipcs |dkrd}nDtr |dkr d}n2tr2|dkr2d}n trD|dkrDd}ntd�|���d	dl}	|rfd
|nd}
|d|
}tj�|�}|r�tj�	|�s�|dk	r�|�
d|�|s�t�|�|dk	r�|�
d
�t���t
�������fdd�}
|�s|	�|d|�}z|j||
d�W5|��X|S)a�Create a (possibly compressed) tar file from all the files under
    'base_dir'.

    'compress' must be "gzip" (the default), "bzip2", "xz", or None.

    'owner' and 'group' can be used to define an owner and a group for the
    archive that is being built. If not provided, the current owner and group
    will be used.

    The output tar file will be named 'base_name' +  ".tar", possibly plus
    the appropriate compression extension (".gz", ".bz2", or ".xz").

    Returns the output filename.
    Nr�r�Zgz�bzip2�bz2�xzzCbad value for 'compress', or compression format not supported : {0}r�.�.tar�creating %szCreating tar archivecs,�dk	r�|_�|_�dk	r(�|_�|_|Sr^)�gidZgname�uid�uname)Ztarinfo�r��group�ownerr�r$r%�_set_uid_gid�sz#_make_tarball.<locals>._set_uid_gidzw|%s�r�)�_ZLIB_SUPPORTED�_BZ2_SUPPORTED�_LZMA_SUPPORTED�
ValueErrorrj�tarfiler<rV�dirnamer��infor�r�r�rqr��add)�	base_name�base_dir�compress�verbose�dry_runr�r��loggerZtar_compressionr�Zcompress_extZarchive_name�archive_dirr��tarr$r�r%�
_make_tarballUs>�

	
r	c	Csnddl}|d}tj�|�}|rNtj�|�sN|dk	r@|�d|�|sNt�|�|dk	rd|�d||�|�sj|j|d|jd���}tj�	|�}	|	tj
kr�|�|	|	�|dk	r�|�d|	�t�|�D]�\}
}}t
|�D]:}
tj�	tj�|
|
��}	|�|	|	�|dk	r�|�d|	�q�|D]L}
tj�	tj�|
|
��}	tj�|	��r|�|	|	�|dk	�r|�d|	��qq�W5QRX|S)	z�Create a zip file from all the files under 'base_dir'.

    The output zip file will be named 'base_name' + ".zip".  Returns the
    name of the output zip file.
    rN�.zipr�z#creating '%s' and adding '%s' to it�w)Zcompressionzadding '%s')�zipfiler<rVr�r�r�r��ZipFileZZIP_DEFLATED�normpath�curdirrH�walk�sortedr��isfile)rrrrrrZzip_filenamerZzfrV�dirpathZdirnames�	filenamesr.r$r$r%�
_make_zipfile�sH
��

rr)rNzuncompressed tar file)rr�zgzip'ed tar-fileZgztarzZIP file�zip)rr�zbzip2'ed tar-fileZbztar)rr�zxz'ed tar-fileZxztarcCsdd�t��D�}|��|S)z�Returns a list of supported formats for archiving and unarchiving.

    Each element of the returned sequence is a tuple (name, description)
    cSsg|]\}}||df�qS)r�r$)r�r.�registryr$r$r%r��sz'get_archive_formats.<locals>.<listcomp>)�_ARCHIVE_FORMATS�items�sort�Zformatsr$r$r%r�s
�r�cCst|dkrg}t|�s td|��t|ttf�s6td��|D]&}t|ttf�rXt|�dkr:td��q:|||ft|<dS)auRegisters an archive format.

    name is the name of the format. function is the callable that will be
    used to create archives. If provided, extra_args is a sequence of
    (name, value) tuples that will be passed as arguments to the callable.
    description can be provided to describe the format, and will be returned
    by the get_archive_formats() function.
    NzThe %s object is not callablez!extra_args needs to be a sequencer�z+extra_args elements are : (arg_name, value))�callable�	TypeErrorrS�tupler��lenr)r.�function�
extra_args�descriptionZelementr$r$r%r�s	
cCs
t|=dSr^)rr�r$r$r%r�sc	
Cst�d||||�t��}	|dk	rP|dk	r6|�d|�tj�|�}|sPt�|�|dkr^tj}||d�}
zt	|}Wn"t
k
r�td|�d�YnX|d}|dD]\}
}||
|
<q�|dkr�||
d	<||
d
<z|||f|
�}W5|dk	�r|dk	�r|�d|	�t�|	�X|S)aCreate an archive file (eg. zip or tar).

    'base_name' is the name of the file to create, minus any format-specific
    extension; 'format' is the archive format: one of "zip", "tar", "gztar",
    "bztar", or "xztar".  Or any other registered format.

    'root_dir' is a directory that will be the root directory of the
    archive; ie. we typically chdir into 'root_dir' before creating the
    archive.  'base_dir' is the directory where we start archiving from;
    ie. 'base_dir' will be the common prefix of all files and
    directories in the archive.  'root_dir' and 'base_dir' both default
    to the current directory.  Returns the name of the archive file.

    'owner' and 'group' are used when creating a tar archive. By default,
    uses the current owner and group.
    zshutil.make_archiveNzchanging into '%s')rrzunknown archive format '%s'r�rr�r�zchanging back to '%s')r?rir<�getcwd�debugrVrY�chdirrrr�r�)rrjZroot_dirrrrr�r�rZsave_cwdr��format_info�func�arg�valr/r$r$r%r�s8




cCsdd�t��D�}|��|S)z�Returns a list of supported formats for unpacking.

    Each element of the returned sequence is a tuple
    (name, extensions, description)
    cSs"g|]\}}||d|df�qS)r�r$)r�r.r�r$r$r%r�3sz&get_unpack_formats.<locals>.<listcomp>)�_UNPACK_FORMATSrrrr$r$r%r-s
�c	Csji}t��D]\}}|dD]}|||<qq|D]$}||kr0d}t||||f��q0t|�sftd��dS)z+Checks what gets registered as an unpacker.rz!%s is already registered for "%s"z*The registered function must be a callableN)r,rr)rr)	�
extensionsr r!Zexisting_extensionsr.r��ext�	extension�msgr$r$r%�_check_unpack_options8s�
r1cCs,|dkrg}t|||�||||ft|<dS)aMRegisters an unpack format.

    `name` is the name of the format. `extensions` is a list of extensions
    corresponding to the format.

    `function` is the callable that will be
    used to unpack archives. The callable will receive archives to unpack.
    If it's unable to handle an archive, it needs to raise a ReadError
    exception.

    If provided, `extra_args` is a sequence of
    (name, value) tuples that will be passed as arguments to the callable.
    description can be provided to describe the format, and will be returned
    by the get_unpack_formats() function.
    N)r1r,)r.r-r r!r"r$r$r%rJscCs
t|=dS)z*Removes the pack format from the registry.N)r,r�r$r$r%r`scCs&tj�|�}tj�|�s"t�|�dS)z1Ensure that the parent directory of `path` existsN)r<rVr�r�r�)rVr�r$r$r%�_ensure_directorydsr2c		Cs�ddl}|�|�std|��|�|�}z�|��D]�}|j}|�d�s2d|krPq2tj	j
|f|�d���}|snq2t|�|�
d�s2|�|j�}t|d�}z|�|�W5|��~Xq2W5|��XdS)z+Unpack zip `filename` to `extract_dir`
    rNz%s is not a zip file�/z..rh)rZ
is_zipfiler(r
r�Zinfolistr/r�r<rVr��splitr2r�rPrqrH)	r/�extract_dirrrr�r.�target�data�fr$r$r%�_unpack_zipfilejs*




r9r�cCs\ddl}z|�|�}Wn"|jk
r8td|��YnXz|j||d�W5|��XdS)zAUnpack tar/tar.gz/tar.bz2/tar.xz `filename` to `extract_dir`
    rNz/%s is not a compressed or uncompressed tar filer�)r�rqZTarErrorr(r�Z
extractall)r/r5r�r�Ztarobjr$r$r%�_unpack_tarfile�s�
r:r�r
)rrz.tar.gzz.tgzz.tar.bz2z.tbz2z.tar.xzz.txzcCs:t��D],\}}|dD]}|�|�r|SqqdS)Nr)r,rr�)r/r.r�r/r$r$r%�_find_unpack_format�s

r;cCs�t�d|||�|dkr t��}t�|�}t�|�}|dkrBi}nd|i}|dk	r�zt|}Wn$tk
r�td�|��d�YnX|d}|||ft	|d�|��nRt
|�}|dkr�td�|���t|d}t	t|d�}|�|�|||f|�dS)a]Unpack an archive.

    `filename` is the name of the archive.

    `extract_dir` is the name of the target directory, where the archive
    is unpacked. If not provided, the current working directory is used.

    `format` is the archive format: one of "zip", "tar", "gztar", "bztar",
    or "xztar".  Or any other registered format.  If not provided,
    unpack_archive will use the filename extension and see if an unpacker
    was registered for that extension.

    In case none is found, a ValueError is raised.

    If `filter` is given, it is passed to the underlying
    extraction function.
    zshutil.unpack_archiveNr�zUnknown unpack format '{0}'r#r�zUnknown archive format '{0}')
r?rir<r$r�r,r�r�rj�dictr;r(�update)r/r5rjr�Z
filter_kwargsr'r(r�r$r$r%r�s,


�statvfs�
disk_usageZusageztotal used freezTotal space in byteszUsed space in byteszFree space in bytescCs@t�|�}|j|j}|j|j}|j|j|j}t|||�S)z�Return disk usage statistics about the given path.

        Returned value is a named tuple with attributes 'total', 'used' and
        'free', which are the amount of total, used and free space, in bytes.
        )r<r>�f_bavail�f_frsize�f_blocks�f_bfree�_ntuple_diskusage)rVru�free�total�usedr$r$r%r?�s

cCs"t�|�\}}||}t|||�S)z�Return disk usage statistics about the given path.

        Returned values is a named tuple with attributes 'total', 'used' and
        'free', which are the amount of total, used and free space, in bytes.
        )rZ
_getdiskusagerD)rVrFrErGr$r$r%r?�scCs�t�d|||�|dkr(|dkr(td��|}|}|dkr>d}n(t|t�rft|�}|dkrftd�|���|dkrtd}n(t|t�s�t	|�}|dkr�td�|���t
�|||�dS)z�Change owner user and group of the given path.

    user and group can be the uid/gid or the user/group names, and in that case,
    they are converted to their respective uid/gid.
    zshutil.chownNzuser and/or group must be set���zno such user: {!r}zno such group: {!r})r?rir�rSr�r��LookupErrorrj�intr�r<r)rV�userr�Z_userZ_groupr$r$r%rs$

��P�c
Cs�zttjd�}Wnttfk
r.d}YnXzttjd�}Wnttfk
r^d}YnX|dksp|dkr�zt�tj���}Wn$t	tt
fk
r�t�|�}YnX|dkr�|j}|dkr�|j
}t�||f�S)aGet the size of the terminal window.

    For each of the two dimensions, the environment variable, COLUMNS
    and LINES respectively, is checked. If the variable is defined and
    the value is a positive integer, it is used.

    When COLUMNS or LINES is not defined, which is the common case,
    the terminal connected to sys.__stdout__ is queried
    by invoking os.get_terminal_size.

    If the terminal size cannot be successfully queried, either because
    the system doesn't support querying, or because we are not
    connected to a terminal, the value given in fallback parameter
    is used. Fallback defaults to (80, 24) which is the default
    size used by many terminal emulators.

    The value returned is a named tuple of type os.terminal_size.
    ZCOLUMNSrZLINES)rJr<�environr�r�rr?�
__stdout__r+�AttributeErrorr-�
terminal_size�columns�lines)ZfallbackrSrT�sizer$r$r%r(s$

cCs&tj�|�o$t�||�o$tj�|�Sr^)r<rVr�r�r�)r`r�r$r$r%�
_access_checkYs�rVc
	s�tj���rt�|�r�SdSt�t�}|dkrttj�dd�}|dkrtzt�d�}Wnt	t
fk
rrtj}YnX|s|dS|r�t�|�}|�
t�tj��}nt�|�}|�
tj�}tjdk�rTtj}|r�t�|�}||kr�|�d|�t�d�p�t}dd�|�
tj�D�}|�r d	d�|D�}t�fd
d�|D���r@�g}n�fdd�|D�}n�g}t�}|D]X}	tj�|	�}
|
|k�rd|�|
�|D],}tj�|	|�}t||��r�|S�q��qddS)
a3Given a command, mode, and a PATH string, return the path which
    conforms to the given mode on the PATH, or None if there is no such
    file.

    `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
    of os.environ.get("PATH"), or can be overridden with a custom search
    path.

    N�PATH�CS_PATHZwin32rZPATHEXTcSsg|]}|r|�qSr$r$�r�r.r$r$r%r��szwhich.<locals>.<listcomp>cSsg|]}t�|��qSr$)r<�fsencoderYr$r$r%r��sc3s |]}����|���VqdSr^)�lowerr�rY��cmdr$r%�	<genexpr>�szwhich.<locals>.<genexpr>csg|]}�|�qSr$r$rYr\r$r%r��s)r<rVr�rVrSr�rO�get�confstrrQr��defpathrZr4�pathsepr�r?r�r�insert�getenv�_WIN_DEFAULT_PATHEXT�anyr�rXrr�)
r]r�rVZ	use_bytesrZpathext_sourceZpathext�files�seen�dirZnormdirZthefiler.r$r\r%r^sV







)r)F)FN)r�rrNNN)rrN)Nr�)NNrrNNN)Nr�)NN)NN)rL)jr'r<r?rWr��collectionsr1�zlibr��ImportErrorr�r�Zlzmar��pwdrZgrprr.rnrrrOrUr�r�rBrrre�__all__r-rr rrr(r,r)r*r:rFrNrr]rardr	r
r�rrr
rr�r�stat_resultr�r�r�r�rqr�r��supports_dir_fdr��supports_fdr�r�rZavoids_symlink_attacksr�rr�r�r�r�r	rrrrrrrr1rrr2r9r:r,r;rr��
namedtuplerDrFrGrEr?rrrV�F_OK�X_OKrr$r$r$r%�<module>st






�
@

7B
�
A�
.	
	4�
�
�
>?	�
A
-
����

�
8�
"�
�
�
�2



 
1__future__.cpython-38.pyc000064400000010100150335716500011277 0ustar00U

e5d�
@s�dZddddddddd	d
g
ZdgeZdZd
ZdZdZdZdZdZ	dZ
dZdZGdd�d�Z
e
dde�Ze
dde�Ze
dde�Ze
dde�Ze
dde�Ze
d de�Ze
d de	�Ze
d!d"e
�Ze
d#d$e�Ze
d%d&e�Zd'S)(afRecord of phased-in incompatible language changes.

Each line is of the form:

    FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease ","
                              CompilerFlag ")"

where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples
of the same form as sys.version_info:

    (PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int
     PY_MINOR_VERSION, # the 1; an int
     PY_MICRO_VERSION, # the 0; an int
     PY_RELEASE_LEVEL, # "alpha", "beta", "candidate" or "final"; string
     PY_RELEASE_SERIAL # the 3; an int
    )

OptionalRelease records the first release in which

    from __future__ import FeatureName

was accepted.

In the case of MandatoryReleases that have not yet occurred,
MandatoryRelease predicts the release in which the feature will become part
of the language.

Else MandatoryRelease records when the feature became part of the language;
in releases at or after that, modules no longer need

    from __future__ import FeatureName

to use the feature in question, but may continue to use such imports.

MandatoryRelease may also be None, meaning that a planned feature got
dropped.

Instances of class _Feature have two corresponding methods,
.getOptionalRelease() and .getMandatoryRelease().

CompilerFlag is the (bitfield) flag that should be passed in the fourth
argument to the builtin function compile() to enable the feature in
dynamically compiled code.  This flag is stored in the .compiler_flag
attribute on _Future instances.  These values must match the appropriate
#defines of CO_xxx flags in Include/compile.h.

No feature line is ever to be deleted from this file.
�
nested_scopes�
generators�division�absolute_import�with_statement�print_function�unicode_literals�barry_as_FLUFL�generator_stop�annotations�all_feature_names��iiiii i@i�ic@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_FeaturecCs||_||_||_dS)N)�optional�	mandatory�
compiler_flag)�selfZoptionalReleaseZmandatoryReleaser�r�"/usr/lib64/python3.8/__future__.py�__init__Ssz_Feature.__init__cCs|jS)z�Return first release in which this feature was recognized.

        This is a 5-tuple, of the same form as sys.version_info.
        )r�rrrr�getOptionalReleaseXsz_Feature.getOptionalReleasecCs|jS)z�Return release in which this feature will become mandatory.

        This is a 5-tuple, of the same form as sys.version_info, or, if
        the feature was dropped, is None.
        )rrrrr�getMandatoryRelease_sz_Feature.getMandatoryReleasecCsdt|j|j|jf�S)Nr)�reprrrrrrrr�__repr__gs�z_Feature.__repr__N)�__name__�
__module__�__qualname__rrrrrrrrrQsr)��r
�betar)rrr
�alphar
)rrr
r!r)r�r
�finalr
)rrr
r!r)r"r
r
r!r
)r�r
r!r)r�r
r!r
)rr%r
r!r)r"rr
r!r)�r
r
r!r
)r"r$r
r r)r"�r
r!r
)r"r'r
r r)r"�
r
r!r
N)�__doc__r�__all__Z	CO_NESTEDZCO_GENERATOR_ALLOWEDZCO_FUTURE_DIVISIONZCO_FUTURE_ABSOLUTE_IMPORTZCO_FUTURE_WITH_STATEMENTZCO_FUTURE_PRINT_FUNCTIONZCO_FUTURE_UNICODE_LITERALSZCO_FUTURE_BARRY_AS_BDFLZCO_FUTURE_GENERATOR_STOPZCO_FUTURE_ANNOTATIONSrrrrrrrrrr	r
rrrr�<module>s~2�
����������optparse.cpython-38.opt-1.pyc000064400000135550150335716500012006 0ustar00U

e5d���@s�dZdZdddddddd	d
ddd
dddddgZdZddlZddlZddlZdd�ZzddlmZm	Z	Wn$e
k
r�dd�Zdd�Z	YnXeZGdd
�d
e�Z
Gdd�de
�ZGdd�de�ZGd d�de
�ZGd!d�de
�ZGd"d#�d#e�ZGd$d
�d
�ZGd%d�de�ZGd&d�de�Zd'd(�Zd)d*�Zeed+�feed+�feed,�feed-�fd.�Zd/d0�Zd1d�Zd2ZGd3d�d�Zd4Zd5Z Gd6d�d�Z!Gd7d�d�Z"Gd8d�de"�Z#Gd9d	�d	e"�Z$d:d;�Z%eZ&dS)<a�A powerful, extensible, and easy-to-use option parser.

By Greg Ward <gward@python.net>

Originally distributed as Optik.

For support, use the optik-users@lists.sourceforge.net mailing list
(http://lists.sourceforge.net/lists/listinfo/optik-users).

Simple usage example:

   from optparse import OptionParser

   parser = OptionParser()
   parser.add_option("-f", "--file", dest="filename",
                     help="write report to FILE", metavar="FILE")
   parser.add_option("-q", "--quiet",
                     action="store_false", dest="verbose", default=True,
                     help="don't print status messages to stdout")

   (options, args) = parser.parse_args()
z1.5.3�Option�make_option�
SUPPRESS_HELP�SUPPRESS_USAGE�Values�OptionContainer�OptionGroup�OptionParser�
HelpFormatter�IndentedHelpFormatter�TitledHelpFormatter�
OptParseError�OptionError�OptionConflictError�OptionValueError�BadOptionError�check_choicea"
Copyright (c) 2001-2006 Gregory P. Ward.  All rights reserved.
Copyright (c) 2002-2006 Python Software Foundation.  All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

  * Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.

  * Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.

  * Neither the name of the author nor the names of its
    contributors may be used to endorse or promote products derived from
    this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
�NcCsd|jjt|�|fS)Nz<%s at 0x%x: %s>)�	__class__�__name__�id��self�r� /usr/lib64/python3.8/optparse.py�_reprOsr)�gettext�ngettextcCs|S�Nr)�messagerrrr\srcCs|dkr|S|S�N�r)ZsingularZplural�nrrrr_src@seZdZdd�Zdd�ZdS)rcCs
||_dSr��msg�rr#rrr�__init__hszOptParseError.__init__cCs|jSrr"rrrr�__str__kszOptParseError.__str__N)r�
__module__�__qualname__r%r&rrrrrgsc@s eZdZdZdd�Zdd�ZdS)r
z]
    Raised if an Option instance is created with invalid or
    inconsistent arguments.
    cCs||_t|�|_dSr)r#�str�	option_id)rr#�optionrrrr%uszOptionError.__init__cCs |jrd|j|jfS|jSdS)Nz
option %s: %s)r*r#rrrrr&yszOptionError.__str__N�rr'r(�__doc__r%r&rrrrr
osc@seZdZdZdS)rzE
    Raised if conflicting options are added to an OptionParser.
    N�rr'r(r-rrrrrsc@seZdZdZdS)rzS
    Raised if an invalid option value is encountered on the command
    line.
    Nr.rrrrr�sc@s eZdZdZdd�Zdd�ZdS)rzB
    Raised if an invalid option is seen on the command line.
    cCs
||_dSr)�opt_str�rr/rrrr%�szBadOptionError.__init__cCstd�|jS)Nzno such option: %s)�_r/rrrrr&�szBadOptionError.__str__Nr,rrrrr�sc@s eZdZdZdd�Zdd�ZdS)�AmbiguousOptionErrorzD
    Raised if an ambiguous option is seen on the command line.
    cCst�||�||_dSr)rr%�
possibilities)rr/r3rrrr%�szAmbiguousOptionError.__init__cCstd�|jd�|j�fS)Nzambiguous option: %s (%s?)�, )r1r/�joinr3rrrrr&�s�zAmbiguousOptionError.__str__Nr,rrrrr2�sr2c@s�eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!S)"r	a�
    Abstract base class for formatting option help.  OptionParser
    instances should use one of the HelpFormatter subclasses for
    formatting help; by default IndentedHelpFormatter is used.

    Instance attributes:
      parser : OptionParser
        the controlling OptionParser instance
      indent_increment : int
        the number of columns to indent per nesting level
      max_help_position : int
        the maximum starting column for option help text
      help_position : int
        the calculated starting column for option help text;
        initially the same as the maximum
      width : int
        total number of columns for output (pass None to constructor for
        this value to be taken from the $COLUMNS environment variable)
      level : int
        current indentation level
      current_indent : int
        current indentation level (in columns)
      help_width : int
        number of columns available for option help text (calculated)
      default_tag : str
        text to replace with each option's default value, "%default"
        by default.  Set to false value to disable default value expansion.
      option_strings : { Option : str }
        maps Option instances to the snippet of help text explaining
        the syntax of that option, e.g. "-h, --help" or
        "-fFILE, --file=FILE"
      _short_opt_fmt : str
        format string controlling how short options with values are
        printed in help text.  Must be either "%s%s" ("-fFILE") or
        "%s %s" ("-f FILE"), because those are the two syntaxes that
        Optik supports.
      _long_opt_fmt : str
        similar but for long options; must be either "%s %s" ("--file FILE")
        or "%s=%s" ("--file=FILE").
    Znonec	Cs�d|_||_|dkrLzttjd�}Wnttfk
rBd}YnX|d8}||_t|t	|d|d��|_
|_d|_d|_
d|_||_d|_i|_d|_d|_dS)	NZCOLUMNS�P��rz%defaultz%s %sz%s=%s)�parser�indent_increment�int�os�environ�KeyError�
ValueError�width�min�max�
help_position�max_help_position�current_indent�level�
help_width�short_first�default_tag�option_strings�_short_opt_fmt�
_long_opt_fmt�rr:rDr@rHrrrr%�s&
�
zHelpFormatter.__init__cCs
||_dSr)r9�rr9rrr�
set_parser�szHelpFormatter.set_parsercCs&|dkrtd|��d|d|_dS)N)�� z/invalid metavar delimiter for short options: %r�%s)r?rK�rZdelimrrr�set_short_opt_delimiter�s
�z%HelpFormatter.set_short_opt_delimitercCs&|dkrtd|��d|d|_dS)N)�=rQz.invalid metavar delimiter for long options: %rrR)r?rLrSrrr�set_long_opt_delimiter�s
�z$HelpFormatter.set_long_opt_delimitercCs"|j|j7_|jd7_dSr�rEr:rFrrrr�indent�szHelpFormatter.indentcCs"|j|j8_|jd8_dSrrWrrrr�dedent�szHelpFormatter.dedentcCstd��dS�Nzsubclasses must implement��NotImplementedError�r�usagerrr�format_usage�szHelpFormatter.format_usagecCstd��dSrZr[�rZheadingrrr�format_headingszHelpFormatter.format_headingcCs.t|j|jd�}d|j}tj||||d�S)z�
        Format a paragraph of free-form text for inclusion in the
        help output at the current indentation level.
        �rQ)Zinitial_indentZsubsequent_indent)rBr@rE�textwrapZfill)r�textZ
text_widthrXrrr�_format_texts
�zHelpFormatter._format_textcCs|r|�|�dSdSdS�N�
rP�re�r�descriptionrrr�format_descriptionsz HelpFormatter.format_descriptioncCs|rd|�|�dSdSdSrfrh)r�epilogrrr�
format_epilogszHelpFormatter.format_epilogcCsP|jdks|js|jS|jj�|j�}|tks6|dkr<|j}|j�|jt	|��Sr)
r9rI�help�defaults�get�dest�
NO_DEFAULT�NO_DEFAULT_VALUE�replacer))rr+Z
default_valuerrr�expand_defaultszHelpFormatter.expand_defaultcs�g}�j|}�j�jd}t|�|krBd�jd|f}�j}nd�jd||f}d}|�|�|jr���|�}t�|�j	�}|�d|d|df�|�
�fdd�|dd�D��n|d	d
kr�|�d
�d�|�S)Nr7�%*s%s
rPz	%*s%-*s  rcsg|]}d�jd|f�qS)rvrP)rC)�.0�linerrr�
<listcomp>Es�z/HelpFormatter.format_option.<locals>.<listcomp>r ���rg)rJrCrE�len�appendrnrurcZwraprG�extendr5)rr+�result�optsZ	opt_widthZindent_firstZ	help_textZ
help_linesrrr�
format_option(s&



�

zHelpFormatter.format_optioncCs�|��d}|jD],}|�|�}||j|<t|t|�|j�}q|��|jD]8}|jD],}|�|�}||j|<t|t|�|j�}qXqN|��|��t	|d|j
�|_t|j|jd�|_
dS)Nrr7rb)rX�option_list�format_option_stringsrJrBr{rE�
option_groupsrYrArDrCr@rG)rr9Zmax_len�optZstrings�grouprrr�store_option_stringsKs 






z"HelpFormatter.store_option_stringscst|��rF|jp|j�����fdd�|jD�}��fdd�|jD�}n|j}|j}�jrb||}n||}d�|�S)z@Return a comma-separated list of option strings & metavariables.csg|]}�j|�f�qSr)rK)rwZsopt��metavarrrrryas�z7HelpFormatter.format_option_strings.<locals>.<listcomp>csg|]}�j|�f�qSr)rL)rwZloptr�rrrycs�r4)�takes_valuer�rq�upper�_short_opts�
_long_optsrHr5)rr+Z
short_optsZ	long_optsrrr�rr�]s��
z#HelpFormatter.format_option_stringsN)rr'r(r-rsr%rOrTrVrXrYr_rarerkrmrur�r�r�rrrrr	�s")
#c@s*eZdZdZddd�Zdd	�Zd
d�ZdS)
r
z.Format help with indented section bodies.
    r7�Nr cCst�|||||�dSr�r	r%rMrrrr%ts�zIndentedHelpFormatter.__init__cCstd�|S)Nz
Usage: %s
)r1r]rrrr_|sz"IndentedHelpFormatter.format_usagecCsd|jd|fS)Nz%*s%s:
rP)rEr`rrrrasz$IndentedHelpFormatter.format_heading)r7r�Nr �rr'r(r-r%r_rarrrrr
ps�
c@s*eZdZdZddd�Zdd�Zd	d
�ZdS)rz1Format help with underlined section headers.
    rr�NcCst�|||||�dSrr�rMrrrr%�s�zTitledHelpFormatter.__init__cCsd|�td��|fS)Nz%s  %s
ZUsage)rar1r]rrrr_�sz TitledHelpFormatter.format_usagecCsd|d|jt|�fS)Nz%s
%s
z=-)rFr{r`rrrra�sz"TitledHelpFormatter.format_heading)rr�Nrr�rrrrr�s�
cCsh|dd���dkrd}nD|dd���dkrDd}|dd�p@d}n|dd�dkrZd}nd}|||�S)	Nr7Z0x�Z0b�0r ��
)�lower)�val�type�radixrrr�
_parse_num�sr�cCs
t|t�Sr)r�r;)r�rrr�
_parse_int�sr�Zintegerzfloating-point�complex)r;�long�floatr�cCsHt|j\}}z
||�WStk
rBttd�|||f��YnXdS)Nzoption %s: invalid %s value: %r)�_builtin_cvtr�r?rr1)r+r��valueZcvtZwhatrrr�
check_builtin�s
�r�cCs:||jkr|Sd�tt|j��}ttd�|||f��dS)Nr4z.option %s: invalid choice: %r (choose from %s))�choicesr5�map�reprrr1)r+r�r�r�rrrr�s
��)ZNOZDEFAULTc@s�eZdZdZdddddddd	d
ddd
gZdZdZdZdZdZ	dZ
eeeeed�Z
dZdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�ZeeeeeeegZd,d-�ZeZd.d/�Zd0d1�Zd2d3�Zd4d5�Z d6d7�Z!d8d9�Z"dS):rar
    Instance attributes:
      _short_opts : [string]
      _long_opts : [string]

      action : string
      type : string
      dest : string
      default : any
      nargs : int
      const : any
      choices : [string]
      callback : function
      callback_args : (any*)
      callback_kwargs : { string : any }
      help : string
      metavar : string
    �actionr�rq�default�nargs�constr��callback�
callback_args�callback_kwargsrnr�)
�store�store_const�
store_true�store_falser|�append_const�countr�rn�version)r�r�r�r�r|r�r�)r�r|r�)r�r|)r�r�)�stringr;r�r�r��choice)r;r�r�r�r�NcOsBg|_g|_|�|�}|�|�|�|�|jD]}||�q0dSr)r�r��_check_opt_strings�_set_opt_strings�
_set_attrs�
CHECK_METHODS)rr�attrs�checkerrrrr%4s



zOption.__init__cCsdd�|D�}|std��|S)NcSsg|]}|r|�qSrr)rwr�rrrryKsz-Option._check_opt_strings.<locals>.<listcomp>z+at least one option string must be supplied)�	TypeError)rrrrrr�GszOption._check_opt_stringscCs�|D]�}t|�dkr$td||��qt|�dkrd|ddkrH|ddksVtd||��|j�|�q|dd�dkr�|ddks�td||��|j�|�qdS)	Nr7z>invalid option string %r: must be at least two characters longr�-r zMinvalid short option string %r: must be of the form -x, (x any non-dash char)�--zGinvalid long option string %r: must start with --, followed by non-dash)r{r
r�r|r�)rrr�rrrr�Ps2������zOption._set_opt_stringscCsv|jD]F}||kr*t||||�||=q|dkr@t||t�qt||d�q|rrt|���}tdd�|�|��dS)Nr�zinvalid keyword arguments: %sr4)�ATTRS�setattrrr�sorted�keysr
r5)rr��attrrrrr�es
�zOption._set_attrscCs2|jdkrd|_n|j|jkr.td|j|��dS)Nr�zinvalid action: %r)r��ACTIONSr
rrrr�
_check_actionxs
zOption._check_actioncCs�|jdkr0|j|jkr�|jdk	r(d|_q�d|_n^t|jt�rF|jj|_|jdkrVd|_|j|jkrrtd|j|��|j|jkr�td|j|��dS)Nr�r�r)zinvalid option type: %rz$must not supply a type for action %r)	r�r��ALWAYS_TYPED_ACTIONSr��
isinstancer�TYPESr
�
TYPED_ACTIONSrrrr�_check_type~s 



�zOption._check_typecCsr|jdkrT|jdkr td|��qnt|jttf�sntdtt|j���d�d|��n|jdk	rntd|j|��dS)Nr�z/must supply a list of choices for type 'choice'z1choices must be a list of strings ('%s' supplied)�'r z#must not supply choices for type %r)r�r�r
r��tuple�listr)�splitrrrr�
_check_choice�s$

���
�zOption._check_choicecCs\|j|jkp|jdk	}|jdkrX|rX|jrH|jddd��dd�|_n|jdd|_dS)Nrr7r�r1r )r��
STORE_ACTIONSr�rqr�rtr�)rr�rrr�_check_dest�s�zOption._check_destcCs*|j|jkr&|jdk	r&td|j|��dS)Nz*'const' must not be supplied for action %r)r��
CONST_ACTIONSr�r
rrrr�_check_const�s
�zOption._check_constcCs<|j|jkr|jdkr8d|_n|jdk	r8td|j|��dS)Nr z*'nargs' must not be supplied for action %r)r�r�r�r
rrrr�_check_nargs�s

�zOption._check_nargscCs�|jdkrrt|j�s$td|j|��|jdk	rJt|jt�sJtd|j|��|jdk	r�t|jt�s�td|j|��nB|jdk	r�td|j|��|jdk	r�td|��|jdk	r�td|��dS)Nr�zcallback not callable: %rz3callback_args, if supplied, must be a tuple: not %rz4callback_kwargs, if supplied, must be a dict: not %rz.callback supplied (%r) for non-callback optionz.callback_args supplied for non-callback optionz0callback_kwargs supplied for non-callback option)	r��callabler�r
r�r�r�r��dictrrrr�_check_callback�sR

�

���

���
��
�
�zOption._check_callbackcCsd�|j|j�S)N�/)r5r�r�rrrrr&�szOption.__str__cCs
|jdk	Sr)r�rrrrr��szOption.takes_valuecCs|jr|jdS|jdSdS�Nr)r�r�rrrr�get_opt_string�s
zOption.get_opt_stringcCs*|j�|j�}|dkr|S||||�SdSr)�TYPE_CHECKERrpr�)rr�r�r�rrr�check_value�szOption.check_valuecs:|dk	r6�jdkr���|�St��fdd�|D��SdS)Nr csg|]}���|��qSr)r�)rw�v�r�rrrrysz(Option.convert_value.<locals>.<listcomp>)r�r�r�)rr�r�rr�r�
convert_values
zOption.convert_valuecCs$|�||�}|�|j|j||||�Sr)r��take_actionr�rq)rr�r��valuesr9rrr�processs�zOption.processc	Cs:|dkrt|||��n|dkr2t|||j��n|dkrHt||d�n�|dkr^t||d�n�|dkrz|�|g��|�n�|dkr�|�|g��|j�n�|d	kr�t|||�|d
�d�n||dkr�|jp�d
}|jp�i}|j||||f|�|�nF|dk�r|��|��n*|dk�r(|�	�|��nt
d|j��dS)Nr�r�r�Tr�Fr|r�r�rr r�rrnr�zunknown action %r)r�r��ensure_valuer|r�r�r��
print_help�exit�
print_versionr?r�)	rr�rqr�r�r�r9�args�kwargsrrrr�s4





zOption.take_action)#rr'r(r-r�r�r�r�r�r�r�r�rr�r�r%r�r�r�r�r�r�r�r�r�r�r&r�__repr__r�r�r�r�r�r�rrrrr�sl�
�	
	�	ZSUPPRESSHELPZ
SUPPRESSUSAGEc@s^eZdZddd�Zdd�ZeZdd�Zdd	�Zd
d�Z	dd
�Z
ddd�Zddd�Zdd�Z
dS)rNcCs&|r"|��D]\}}t|||�qdSr)�itemsr�)rror�r�rrrr%9szValues.__init__cCs
t|j�Sr)r)�__dict__rrrrr&>szValues.__str__cCs2t|t�r|j|jkSt|t�r*|j|kStSdSr)r�rr�r��NotImplemented)r�otherrrr�__eq__Cs



z
Values.__eq__cCs6t|�D](}||kr||}|dk	rt|||�qdS)z�
        Update the option values from an arbitrary dictionary, but only
        use keys from dict that already have a corresponding attribute
        in self.  Any keys in dict without a corresponding attribute
        are silently ignored.
        N)�dirr�)rr�r�Zdvalrrr�_update_carefulKs
zValues._update_carefulcCs|j�|�dS)z�
        Update the option values from an arbitrary dictionary,
        using all keys from the dictionary regardless of whether
        they have a corresponding attribute in self or not.
        N)r��update)rr�rrr�
_update_looseXszValues._update_loosecCs8|dkr|�|�n |dkr(|�|�ntd|��dS)N�carefulZloosezinvalid update mode: %r)r�r�r?)rr��moderrr�_update`s
zValues._updater�cCs&t|�tj|}|�t|�|�dSr)�
__import__�sys�modulesr��vars)r�modnamer��modrrr�read_modulehs
zValues.read_modulecCs&i}tt|���|�|�||�dSr)�exec�open�readr�)r�filenamer�r�rrr�	read_filemszValues.read_filecCs.t||�rt||�dkr$t|||�t||�Sr)�hasattr�getattrr�)rr�r�rrrr�rszValues.ensure_value)N)r�)r�)rr'r(r%r&rr�r�r�r�r�r�r�r�rrrrr7s



c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"S)#ra�
    Abstract base class.

    Class attributes:
      standard_option_list : [Option]
        list of standard options that will be accepted by all instances
        of this parser class (intended to be overridden by subclasses).

    Instance attributes:
      option_list : [Option]
        the list of Option objects contained by this OptionContainer
      _short_opt : { string : Option }
        dictionary mapping short option strings, eg. "-f" or "-X",
        to the Option instances that implement them.  If an Option
        has multiple short option strings, it will appear in this
        dictionary multiple times. [1]
      _long_opt : { string : Option }
        dictionary mapping long option strings, eg. "--file" or
        "--exclude", to the Option instances that implement them.
        Again, a given Option can occur multiple times in this
        dictionary. [1]
      defaults : { string : any }
        dictionary mapping option destination names to default
        values for each destination [1]

    [1] These mappings are common to (shared by) all components of the
        controlling OptionParser, where they are initially created.

    cCs&|��||_|�|�|�|�dSr)�_create_option_list�option_class�set_conflict_handler�set_description)rr�conflict_handlerrjrrrr%�s
zOptionContainer.__init__cCsi|_i|_i|_dSr��
_short_opt�	_long_optrorrrr�_create_option_mappings�sz'OptionContainer._create_option_mappingscCs|j|_|j|_|j|_dSrrrNrrr�_share_option_mappings�sz&OptionContainer._share_option_mappingscCs|dkrtd|��||_dS)N)�error�resolvez$invalid conflict_resolution value %r)r?r)r�handlerrrrr�sz$OptionContainer.set_conflict_handlercCs
||_dSr�rjrirrrr�szOptionContainer.set_descriptioncCs|jSrrrrrr�get_description�szOptionContainer.get_descriptioncCs|`|`|`dS�zsee OptionParser.destroy().Nrrrrr�destroy�szOptionContainer.destroycCs�g}|jD]"}||jkr
|�||j|f�q
|jD]"}||jkr4|�||j|f�q4|r�|j}|dkr�tdd�dd�|D��|��nd|dkr�|D]V\}}|�d�r�|j�	|�|j|=n|j�	|�|j|=|js�|js�|j
j�	|�q�dS)Nrz conflicting option string(s): %sr4cSsg|]}|d�qS)rr)rw�corrrry�sz3OptionContainer._check_conflict.<locals>.<listcomp>rr�)r�rr|r�rrrr5�
startswith�remove�	containerr�)rr+Z
conflict_optsr�r
Zc_optionrrr�_check_conflict�s2



��

zOptionContainer._check_conflictcOs�t|dt�r|j||�}n8t|�dkrL|sL|d}t|t�sTtd|��ntd��|�|�|j�|�||_	|j
D]}||j|<qv|jD]}||j
|<q�|jdk	r�|jtk	r�|j|j|j<n|j|jkr�d|j|j<|S)zOadd_option(Option)
           add_option(opt_str, ..., kwarg=val, ...)
        rr znot an Option instance: %r�invalid argumentsN)r�r)rr{rr�rr�r|rr�rr�rrqr�rrro)rr�r�r+r�rrr�
add_option�s(





zOptionContainer.add_optioncCs|D]}|�|�qdSr)r)rr�r+rrr�add_optionsszOptionContainer.add_optionscCs|j�|�p|j�|�Sr)rrprr0rrr�
get_options
�zOptionContainer.get_optioncCs||jkp||jkSr)rrr0rrr�
has_options
�zOptionContainer.has_optioncCsn|j�|�}|dkr |j�|�}|dkr4td|��|jD]}|j|=q:|jD]}|j|=qN|jj�|�dS)Nzno such option %r)	rrprr?r�r�rr�r)rr/r+r�rrr�
remove_options



zOptionContainer.remove_optioncCs>|js
dSg}|jD]}|jtk	r|�|�|��qd�|�S�NrP)r�rnrr|r�r5)r�	formatterr~r+rrr�format_option_helps

z"OptionContainer.format_option_helpcCs|�|���Sr)rkr�rrrrrrk(sz"OptionContainer.format_descriptioncCs:g}|jr|�|�|��|jr0|�|�|��d�|�S)Nrg)rjr|rkr�rr5�rrr~rrr�format_help+szOptionContainer.format_helpN)rr'r(r-r%r	r
rrrrrrrrrrrrkr"rrrrrxs"			c@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rNcCs$||_t�||j|j|�||_dSr)r9rr%rr�title)rr9r#rjrrrr%6s�zOptionGroup.__init__cCsg|_|�|j�dSr)r�r
r9rrrrr<szOptionGroup._create_option_listcCs
||_dSr)r#)rr#rrr�	set_title@szOptionGroup.set_titlecCst�|�|`dSr)rrr�rrrrrCs
zOptionGroup.destroycCs0|�|j�}|��|t�||�7}|��|Sr)rar#rXrr"rYr!rrrr"Js
zOptionGroup.format_help)N)rr'r(r%rr$rr"rrrrr4s

c
@sbeZdZdZgZddedddddddf
dd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dPdd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�ZdQd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Z dRd<d=�Z!d>d?�Z"d@dA�Z#dSdBdC�Z$dDdE�Z%dTdFdG�Z&dUdHdI�Z'dJdK�Z(dVdLdM�Z)dWdNdO�Z*dS)Xra$
    Class attributes:
      standard_option_list : [Option]
        list of standard options that will be accepted by all instances
        of this parser class (intended to be overridden by subclasses).

    Instance attributes:
      usage : string
        a usage string for your program.  Before it is displayed
        to the user, "%prog" will be expanded to the name of
        your program (self.prog or os.path.basename(sys.argv[0])).
      prog : string
        the name of the current program (to override
        os.path.basename(sys.argv[0])).
      description : string
        A paragraph of text giving a brief overview of your program.
        optparse reformats this paragraph to fit the current terminal
        width and prints it when the user requests help (after usage,
        but before the list of options).
      epilog : string
        paragraph of help text to print after option help

      option_groups : [OptionGroup]
        list of option groups in this parser (option groups are
        irrelevant for parsing the command-line, but very useful
        for generating help)

      allow_interspersed_args : bool = true
        if true, positional arguments may be interspersed with options.
        Assuming -a and -b each take a single argument, the command-line
          -ablah foo bar -bboo baz
        will be interpreted the same as
          -ablah -bboo -- foo bar baz
        If this flag were false, that command line would be interpreted as
          -ablah -- foo bar -bboo baz
        -- ie. we stop processing options as soon as we see the first
        non-option argument.  (This is the tradition followed by
        Python's getopt module, Perl's Getopt::Std, and other argument-
        parsing libraries, but it is generally annoying to users.)

      process_default_values : bool = true
        if true, option default values are processed similarly to option
        values from the command line: that is, they are passed to the
        type-checking function for the option's type (as long as the
        default value is a string).  (This really only matters if you
        have defined custom types; see SF bug #955889.)  Set it to false
        to restore the behaviour of Optik 1.4.1 and earlier.

      rargs : [string]
        the argument list currently being parsed.  Only set when
        parse_args() is active, and continually trimmed down as
        we consume arguments.  Mainly there for the benefit of
        callback options.
      largs : [string]
        the list of leftover arguments that we have skipped while
        parsing options.  If allow_interspersed_args is false, this
        list is always empty.
      values : Values
        the set of option values currently being accumulated.  Only
        set when parse_args() is active.  Also mainly for callbacks.

    Because of the 'rargs', 'largs', and 'values' attributes,
    OptionParser is not thread-safe.  If, for some perverse reason, you
    need to parse command-line arguments simultaneously in different
    threads, use different OptionParser instances.

    NrTcCsrt�||||�|�|�|	|_||_d|_d|_|dkr@t�}||_|j�	|�|
|_
|j||d�|��dS)NT)�add_help)
rr%�	set_usage�progr��allow_interspersed_args�process_default_valuesr
rrOrl�_populate_option_list�_init_parsing_state)rr^r�rr�rrjrZadd_help_optionr'rlrrrr%�s(�
�zOptionParser.__init__cCs.t�|�|jD]}|��q|`|`|`dS)a
        Declare that you are done with this OptionParser.  This cleans up
        reference cycles so the OptionParser (and all objects referenced by
        it) can be garbage-collected promptly.  After calling destroy(), the
        OptionParser is unusable.
        N)rrr�r�r)rr�rrrr�s


zOptionParser.destroycCsg|_g|_|��dSr)r�r�r	rrrrr�sz OptionParser._create_option_listcCs|jdddtd�d�dS)Nz-hz--helprnzshow this help message and exit�r�rn�rr1rrrr�_add_help_option�s�zOptionParser._add_help_optioncCs|jddtd�d�dS)Nz	--versionr�z&show program's version number and exitr,r-rrrr�_add_version_option�s�z OptionParser._add_version_optioncCs>|jr|�|j�|r |�|�|jr.|��|r:|��dSr)�standard_option_listrr�r/r.)rr�r%rrrr*�s
z"OptionParser._populate_option_listcCsd|_d|_d|_dSr)�rargs�largsr�rrrrr+�sz OptionParser._init_parsing_statecCsL|dkrtd�|_n4|tkr$d|_n$|���d�rB|dd�|_n||_dS)Nz%prog [options]zusage: �)r1r^rr�rr]rrrr&�szOptionParser.set_usagecCs
d|_dS)aSet parsing to not stop on the first non-option, allowing
        interspersing switches with command arguments. This is the
        default behavior. See also disable_interspersed_args() and the
        class documentation description of the attribute
        allow_interspersed_args.TN�r(rrrr�enable_interspersed_args�sz%OptionParser.enable_interspersed_argscCs
d|_dS)z�Set parsing to stop on the first non-option. Use this if
        you have a command processor which runs another command that
        has options of its own and you want to make sure these options
        don't get confused.
        FNr4rrrr�disable_interspersed_argssz&OptionParser.disable_interspersed_argscCs
||_dSr)r))rr�rrr�set_process_default_valuessz'OptionParser.set_process_default_valuescCs||j|<dSr)ro)rrqr�rrr�set_defaultszOptionParser.set_defaultcKs|j�|�dSr)ror�)rr�rrr�set_defaultsszOptionParser.set_defaultscCs*|jdd�}|jD]}|�|j�q|Sr)r�r�r})rZoptionsr�rrr�_get_all_optionss
zOptionParser._get_all_optionscCs`|jst|j�S|j��}|��D]4}|�|j�}t|t�r"|�	�}|�
||�||j<q"t|�Sr)r)rro�copyr:rprqr�r)r�r�)rror+r�r/rrr�get_default_valuess


zOptionParser.get_default_valuescOszt|dt�r t|f|�|�}nJt|�dkrb|sb|d}t|t�sNtd|��|j|k	rjtd��ntd��|j�|�|S)Nrr znot an OptionGroup instance: %rz"invalid OptionGroup (wrong parser)r)	r�r)rr{r�r9r?r�r|)rr�r�r�rrr�add_option_group+s


zOptionParser.add_option_groupcCs0|j�|�p|j�|�}|r,|j|k	r,|jSdSr)rrprr)rr/r+rrr�get_option_group;s
�zOptionParser.get_option_groupcCs&|dkrtjdd�S|dd�SdSr)r��argv)rr�rrr�	_get_argsEszOptionParser._get_argsc
Cs�|�|�}|dkr|��}||_g|_}||_z|�|||�}Wn4ttfk
rv}z|�t	|��W5d}~XYnX||}|�
||�S)aR
        parse_args(args : [string] = sys.argv[1:],
                   values : Values = None)
        -> (values : Values, args : [string])

        Parse the command-line options found in 'args' (default:
        sys.argv[1:]).  Any errors result in a call to 'error()', which
        by default prints the usage message to stderr and calls
        sys.exit() with an error message.  On success returns a pair
        (values, args) where 'values' is a Values instance (with all
        your option values) and 'args' is the list of arguments left
        over after parsing options.
        N)r@r<r1r2r��
_process_argsrrrr)�check_values)rr�r�r1r2�stop�errrrr�
parse_argsKs

 zOptionParser.parse_argscCs||fS)a�
        check_values(values : Values, args : [string])
        -> (values : Values, args : [string])

        Check that the supplied option values and leftover arguments are
        valid.  Returns the option values and leftover arguments
        (possibly adjusted, possibly completely new -- whatever you
        like).  Default implementation just returns the passed-in
        values; subclasses may override as desired.
        r)rr�r�rrrrBrszOptionParser.check_valuescCs�|r�|d}|dkr|d=dS|dd�dkr<|�||�q|dd�dkrft|�dkrf|�||�q|jr~|�|�|d=qdSqdS)a�_process_args(largs : [string],
                         rargs : [string],
                         values : Values)

        Process command-line arguments and populate 'values', consuming
        options and arguments from 'rargs'.  If 'allow_interspersed_args' is
        false, stop at the first non-option argument.  If true, accumulate any
        interspersed non-option arguments in 'largs'.
        rr�Nr7r r�)�_process_long_optr{�_process_short_optsr(r|)rr2r1r��argrrrrAs

zOptionParser._process_argscCst||j�S)a_match_long_opt(opt : string) -> string

        Determine which long option string 'opt' matches, ie. which one
        it is an unambiguous abbreviation for.  Raises BadOptionError if
        'opt' doesn't unambiguously match any long option string.
        )�
_match_abbrevr)rr�rrr�_match_long_opt�szOptionParser._match_long_optc
Cs�|�d�}d|kr4|�dd�\}}|�d|�d}n|}d}|�|�}|j|}|��r�|j}t|�|kr�|�t	dd|�||d��q�|dkr�|�d�}	q�t
|d|��}	|d|�=n|r�|�td	�|�nd}	|�||	||�dS)
NrrUr TF�.%(option)s option requires %(number)d argument�/%(option)s option requires %(number)d arguments�r+Znumberz%s option does not take a value)
�popr��insertrJrr�r�r{rrr�r1r�)
rr1r�rHr�Znext_argZhad_explicit_valuer+r�r�rrrrF�s6


��zOptionParser._process_long_optcCs�|�d�}d}d}|dd�D]�}d|}|j�|�}|d7}|sJt|��|��r�|t|�krv|�d||d��d}|j}	t|�|	kr�|�t	dd|	�||	d��q�|	dkr�|�d�}
q�t
|d|	��}
|d|	�=nd}
|�||
||�|rq�qdS)	NrFr r�TrKrLrM)rNrrprr�r{rOr�rrr�r�)rr1r�rHrC�iZchr�r+r�r�rrrrG�s<
��z OptionParser._process_short_optscCs&|jdkrtj�tjd�S|jSdSr�)r'r<�path�basenamer�r?rrrr�
get_prog_names
zOptionParser.get_prog_namecCs|�d|���S)Nz%prog)rtrS)r�srrr�expand_prog_nameszOptionParser.expand_prog_namecCs|�|j�Sr)rUrjrrrrrszOptionParser.get_descriptionrcCs|rtj�|�t�|�dSr)r��stderr�writer�)rZstatusr#rrrr�szOptionParser.exitcCs(|�tj�|�dd|��|f�dS)z�error(msg : string)

        Print a usage message incorporating 'msg' to stderr and exit.
        If you override this in a subclass, it should not return -- it
        should either exit or raise an exception.
        r7z%s: error: %s
N)�print_usager�rVr�rSr$rrrrszOptionParser.errorcCs"|jr|j�|�|j��SdSdSr)r^rr_rUrrrr�	get_usage#s

�zOptionParser.get_usagecCs|jrt|��|d�dS)aaprint_usage(file : file = stdout)

        Print the usage message for the current program (self.usage) to
        'file' (default stdout).  Any occurrence of the string "%prog" in
        self.usage is replaced with the name of the current program
        (basename of sys.argv[0]).  Does nothing if self.usage is empty
        or not defined.
        ��fileN)r^�printrY�rr[rrrrX*s	zOptionParser.print_usagecCs|jr|�|j�SdSdSr)r�rUrrrr�get_version6szOptionParser.get_versioncCs|jrt|��|d�dS)aEprint_version(file : file = stdout)

        Print the version message for this program (self.version) to
        'file' (default stdout).  As with print_usage(), any occurrence
        of "%prog" in self.version is replaced by the current program's
        name.  Does nothing if self.version is empty or undefined.
        rZN)r�r\r^r]rrrr�<szOptionParser.print_versioncCs�|dkr|j}|�|�g}|�|�td���|��|jrZ|�t�||��|�d�|j	D]}|�|�
|��|�d�q`|��d�|dd��S)NZOptionsrgrPrz)
rr�r|rar1rXr�rrr�r"rYr5)rrr~r�rrrrGs


zOptionParser.format_option_helpcCs|�|j�Sr)rmrlr rrrrmXszOptionParser.format_epilogcCsn|dkr|j}g}|jr*|�|��d�|jrD|�|�|�d�|�|�|��|�|�|��d�|�Srf)	rr^r|rYrjrkrrmr5r!rrrr"[szOptionParser.format_helpcCs |dkrtj}|�|���dS)z�print_help(file : file = stdout)

        Print an extended help message, listing all options and any
        help text provided with them, to 'file' (default stdout).
        N)r��stdoutrWr"r]rrrr�gszOptionParser.print_help)T)NN)rN)N)N)N)N)N)+rr'r(r-r0rr%rrr.r/r*r+r&r5r6r7r8r9r:r<r=r>r@rErBrArJrFrGrSrUrr�rrYrXr^r�rrmr"r�rrrrrRsbD�
"

	

'
3	$)





csZ�|kr�S�fdd�|��D�}t|�dkr6|dS|sDt���n|��t�|��dS)z�_match_abbrev(s : string, wordmap : {string : Option}) -> string

    Return the string key in 'wordmap' for which 's' is an unambiguous
    abbreviation.  If 's' is found to be ambiguous or doesn't match any of
    'words', raise BadOptionError.
    csg|]}|���r|�qSr)r)rwZword�rTrrry�s
�z!_match_abbrev.<locals>.<listcomp>r rN)r�r{r�sortr2)rTZwordmapr3rr`rrIts
rI)'r-�__version__�__all__Z
__copyright__r�r<rcrrr�ImportErrorr1�	Exceptionrr
rrrr2r	r
rr�r�r�r�r�r�rrrrrrrrrrrIrrrrr�<module>s�� 


P




�uA=&struct.cpython-38.opt-2.pyc000064400000000514150335716500011465 0ustar00U

e5d�@s8ddddddddgZdd	lTdd
lmZddlmZdS)
ZcalcsizeZpackZ	pack_intoZunpackZunpack_fromZiter_unpackZStruct�error�)�*)�_clearcache)�__doc__N)�__all__Z_structrr�rr�/usr/lib64/python3.8/struct.py�<module>s�_sysconfigdata_d_linux_x86_64-linux-gnu.cpython-38.opt-2.pyc000064400000070505150335716500017631 0ustar00U

��.e]���@s`dddddddddddd	d
dddd
ddddddddddddddddddddddd	dd dd!d"d#d$d%dddd&d'dd(d)d*d&d+dd!dd,d-dddddddd.d&d&d&d&dd&dd&d&d&d&d&dddddddddd&dd&d&d&d&d&d&d&d&dd&d&d&d&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&dd&dd&dd&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&d&d&dd&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&ddd&d&dd&dddd&d&d&ddd&d&dddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&d&d&dd&d&dd&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&d&d&d&d&d&ddd&d&d&dd&d&ddd&d&d&d&d&d&d&dddddd&dd&d&dddddd&ddd&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&ddd&d&d&ddd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&dd
d/ddd0d1d0d0d2d3d4dd5d6d7ddd8dd	d9dd:d;dd<d=dd>ddd?d@dAdBddd+ddCdDddEdd	dddd&dFdGdHdIdddJddKdLd&dMddddNdOdddddddddPdQdRdddSd&d&dddddTddddUdVdddWddXd&dYdZdd[d6d\d]dd^d&d&ddd_d`dadbdcd9dddded?dfd&dddgdhdidhdgdidgdgdhdhdgd]dgdgdgdgdhd&djdkdld&dmdnddod:d&dddddpddqdrdd&ddddsd&dtdud&d&d&d&dddd&d&ddvdwdudxdydydudz���Zd{S)|�d�z"cpython-38-x86_64-linux-gnu"ZarZrcsz!-Wno-unused-result -Wsign-comparez-IObjects -IInclude -IPython�z/usr/binz/usr/lib64/python3.8z-L. -lpython3.8dzOgcc -pthread -shared -Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g�pythonzx86_64-redhat-linux-gnu�\zgcc -pthreadz-fPICa{-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -Ogz?configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.ina-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvaK-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declarationz-Wl,-z,relro  -Wl,-z,now  -gz�-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -ga�'--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-ipv6' '--enable-shared' '--with-computed-gotos=yes' '--with-dbmliborder=gdbm:ndbm:bdb' '--with-system-expat' '--with-system-ffi' '--enable-loadable-sqlite-extensions' '--with-dtrace' '--with-lto' '--with-ssl-default-suites=openssl' '--with-valgrind' '--without-ensurepip' '--with-pydebug' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS= -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv ' 'LDFLAGS= -Wl,-z,relro  -Wl,-z,now  -g ' 'CPPFLAGS=' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'z/usr/includez/usr/include/python3.8dz=/builddir/build/BUILD/Python-3.8.17/build/debug/coverage.infoz;/builddir/build/BUILD/Python-3.8.17/build/debug/lcov-reportz2--no-branch-coverage --title "CPython lcov report"zN-IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Includezg++ -pthreadzE/usr /usr/lib64 /usr/lib64/python3.8 /usr/lib64/python3.8/lib-dynloadz /usr/lib64/python3.8/lib-dynloadi�zoREADME.rst ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Ext-dummyzInclude Lib Misc Ext-dummyzTREADME.rst ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in�.�z/usr/bin/dtracezInclude/pydtrace_probes.hzPython/pydtrace.ozdynload_shlib.oZnoz .cpython-38d-x86_64-linux-gnu.soi�ZyeszI/usr/include /usr/include /usr/include/python3.8d /usr/include/python3.8dz/usr/bin/install -cz/usr/bin/install -c -m 644z/usr/bin/install -c -m 755zlibpython3.8d.so.1.0zModules/_io/_iomodule.hzg++ -pthread -sharedz:-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -gzlibpython3.8d.soz3.8dz
/usr/lib64z-lmzPython/z/usr/lib64/pkgconfigz1/usr/lib64/python3.8/config-3.8d-x86_64-linux-gnuzlibpython3.8d.az"-lcrypt -lpthread -ldl  -lutil -lmz0tkinter tkinter/test tkinter/test/test_tkinter \Zgccz-Xlinker -export-dynamic�trueZlnZlinuxz5/builddir/build/BUILD/Python-3.8.17/Modules/makesetupz/usr/share/manz/usr/bin/mkdir -pz�posix  errno  pwd  _sre  _codecs  _weakref  _functools  _operator  _collections  _abc  itertools  atexit  _signal  _stat  time  _thread  _locale  _io  faulthandler  _tracemalloc  _symtable  xxsubtypeavModules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/_abc.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_threadmodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  Modules/symtablemodule.o  Modules/xxsubtype.ozx86_64-linux-gnuz -DMULTIARCH=\"x86_64-linux-gnu\"z-Wl,--no-as-neededz-lssl -lcryptoa1-DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz:\ Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.oz-fprofile-generatez"-fprofile-use -fprofile-correctionz
-m test --pgozno-frameworkz./python -Ez	python3.8a�-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -Og -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Og -I/builddir/build/BUILD/Python-3.8.17/Include/internal -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Include -fPIC -DPy_BUILD_CORE_BUILTINa-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Og -I/builddir/build/BUILD/Python-3.8.17/Include/internala�-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -Og -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Og -I/builddir/build/BUILD/Python-3.8.17/Include/internal -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Include -fPIC -DPy_BUILD_COREaT-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g -lcryptoz"z"a-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g�a�-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -Og -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Og -I/builddir/build/BUILD/Python-3.8.17/Include/internal -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Include -fPICz)-x test_subprocess test_io test_lib2to3 \ZreadelfzMac/Resources/frameworkZvoidz?LD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.8.17/build/debugz	@SGI_ABI@z/bin/shz.so���zcpython-38d-x86_64-linux-gnuz2Parser Objects Python Modules Modules/_io Programsz:/builddir/build/BUILD/Python-3.8.17/Tools/gdb/libpython.pyz"/* Don't use ncurses extensions */z-szInclude Lib MisczHLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.8.17/build/debug ./pythonz�LD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.8.17/build/debug ./python /builddir/build/BUILD/Python-3.8.17/Tools/scripts/run_tests.pyi�zJpython3.8 /builddir/build/BUILD/Python-3.8.17/Tools/scripts/update_file.pyz3.8z#/builddir/build/BUILD/Python-3.8.17z)xml xml/dom xml/etree xml/parsers xml/saxz//builddir/build/BUILD/Python-3.8.17/build/debugz
/usr/sharez/usr(�ZABIFLAGSZAC_APPLE_UNIVERSAL_BUILDZAIX_GENUINE_CPLUSPLUSZ	ALT_SOABIZANDROID_API_LEVELZARZARFLAGSZ
BASECFLAGSZBASECPPFLAGSZBASEMODLIBSZBINDIRZ
BINLIBDESTZ
BLDLIBRARYZ	BLDSHAREDZBUILDEXEZBUILDPYTHONZBUILD_GNU_TYPEZBYTESTR_DEPSZCCZCCSHAREDZCFLAGSZCFLAGSFORSHAREDZCFLAGS_ALIASINGZCONFIGFILESZCONFIGURE_CFLAGSZCONFIGURE_CFLAGS_NODISTZCONFIGURE_CPPFLAGSZCONFIGURE_LDFLAGSZCONFIGURE_LDFLAGS_NODISTZCONFIG_ARGSZCONFINCLUDEDIRZ
CONFINCLUDEPYZCOREPYTHONPATHZ
COVERAGE_INFOZCOVERAGE_REPORTZCOVERAGE_REPORT_OPTIONSZCPPFLAGSZCXXZDESTDIRSZDESTLIBZDESTPATHZ
DESTSHAREDZDFLAGSZDIRMODEZDISTZDISTDIRSZ	DISTFILESZ	DLINCLDIRZ
DLLLIBRARYZ"DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754ZDOUBLE_IS_BIG_ENDIAN_IEEE754ZDOUBLE_IS_LITTLE_ENDIAN_IEEE754ZDTRACEZDTRACE_DEPSZDTRACE_HEADERSZDTRACE_OBJSZDYNLOADFILEZENABLE_IPV6Z	ENSUREPIPZEXEZEXEMODEZ
EXTRATESTOPTSZ
EXT_SUFFIXZFILEMODEZFLOAT_WORDS_BIGENDIANZFLOCK_NEEDS_LIBBSDZGETPGRP_HAVE_ARGZGETTIMEOFDAY_NO_TZZ	GITBRANCHZGITTAGZ
GITVERSIONZGNULDZHAVE_ACCEPT4Z
HAVE_ACOSHZ
HAVE_ADDRINFOZ
HAVE_ALARMZHAVE_ALIGNED_REQUIREDZ
HAVE_ALLOCA_HZHAVE_ALTZONEZ
HAVE_ASINHZHAVE_ASM_TYPES_HZ
HAVE_ATANHZHAVE_BIND_TEXTDOMAIN_CODESETZHAVE_BLUETOOTH_BLUETOOTH_HZHAVE_BLUETOOTH_HZHAVE_BROKEN_MBSTOWCSZHAVE_BROKEN_NICEZHAVE_BROKEN_PIPE_BUFZHAVE_BROKEN_POLLZHAVE_BROKEN_POSIX_SEMAPHORESZHAVE_BROKEN_PTHREAD_SIGMASKZHAVE_BROKEN_SEM_GETVALUEZHAVE_BROKEN_UNSETENVZHAVE_BUILTIN_ATOMICZHAVE_CHFLAGSZ
HAVE_CHOWNZHAVE_CHROOTZ
HAVE_CLOCKZHAVE_CLOCK_GETRESZHAVE_CLOCK_GETTIMEZHAVE_CLOCK_SETTIMEZHAVE_COMPUTED_GOTOSZHAVE_CONFSTRZHAVE_CONIO_HZ
HAVE_COPYSIGNZHAVE_COPY_FILE_RANGEZHAVE_CRYPT_HZHAVE_CRYPT_RZHAVE_CTERMIDZHAVE_CTERMID_RZHAVE_CURSES_FILTERZ
HAVE_CURSES_HZHAVE_CURSES_HAS_KEYZHAVE_CURSES_IMMEDOKZHAVE_CURSES_IS_PADZHAVE_CURSES_IS_TERM_RESIZEDZHAVE_CURSES_RESIZETERMZHAVE_CURSES_RESIZE_TERMZHAVE_CURSES_SYNCOKZHAVE_CURSES_TYPEAHEADZHAVE_CURSES_USE_ENVZHAVE_CURSES_WCHGATZHAVE_DECL_ISFINITEZHAVE_DECL_ISINFZHAVE_DECL_ISNANZHAVE_DECL_RTLD_DEEPBINDZHAVE_DECL_RTLD_GLOBALZHAVE_DECL_RTLD_LAZYZHAVE_DECL_RTLD_LOCALZHAVE_DECL_RTLD_MEMBERZHAVE_DECL_RTLD_NODELETEZHAVE_DECL_RTLD_NOLOADZHAVE_DECL_RTLD_NOWZHAVE_DECL_TZNAMEZHAVE_DEVICE_MACROSZHAVE_DEV_PTCZ
HAVE_DEV_PTMXZ
HAVE_DIRECT_HZHAVE_DIRENT_D_TYPEZ
HAVE_DIRENT_HZ
HAVE_DIRFDZHAVE_DLFCN_HZHAVE_DLOPENZ	HAVE_DUP2Z	HAVE_DUP3Z$HAVE_DYLD_SHARED_CACHE_CONTAINS_PATHZHAVE_DYNAMIC_LOADINGZ
HAVE_ENDIAN_HZ
HAVE_EPOLLZHAVE_EPOLL_CREATE1ZHAVE_ERFZ	HAVE_ERFCZHAVE_ERRNO_HZ
HAVE_EXECVZHAVE_EXPLICIT_BZEROZHAVE_EXPLICIT_MEMSETZ
HAVE_EXPM1ZHAVE_FACCESSATZHAVE_FCHDIRZHAVE_FCHMODZ
HAVE_FCHMODATZHAVE_FCHOWNZ
HAVE_FCHOWNATZHAVE_FCNTL_HZHAVE_FDATASYNCZHAVE_FDOPENDIRZHAVE_FDWALKZHAVE_FEXECVEZHAVE_FINITEZ
HAVE_FLOCKZ	HAVE_FORKZHAVE_FORKPTYZHAVE_FPATHCONFZHAVE_FSEEK64ZHAVE_FSEEKOZHAVE_FSTATATZ
HAVE_FSTATVFSZ
HAVE_FSYNCZHAVE_FTELL64ZHAVE_FTELLOZ
HAVE_FTIMEZHAVE_FTRUNCATEZ
HAVE_FUTIMENSZHAVE_FUTIMESZHAVE_FUTIMESATZHAVE_GAI_STRERRORZ
HAVE_GAMMAZHAVE_GCC_ASM_FOR_MC68881ZHAVE_GCC_ASM_FOR_X64ZHAVE_GCC_ASM_FOR_X87ZHAVE_GCC_UINT128_TZHAVE_GETADDRINFOZHAVE_GETC_UNLOCKEDZHAVE_GETENTROPYZHAVE_GETGRGID_RZHAVE_GETGRNAM_RZHAVE_GETGROUPLISTZHAVE_GETGROUPSZHAVE_GETHOSTBYNAMEZHAVE_GETHOSTBYNAME_RZHAVE_GETHOSTBYNAME_R_3_ARGZHAVE_GETHOSTBYNAME_R_5_ARGZHAVE_GETHOSTBYNAME_R_6_ARGZHAVE_GETITIMERZHAVE_GETLOADAVGZ
HAVE_GETLOGINZHAVE_GETNAMEINFOZHAVE_GETPAGESIZEZHAVE_GETPEERNAMEZHAVE_GETPGIDZHAVE_GETPGRPZHAVE_GETPIDZHAVE_GETPRIORITYZ
HAVE_GETPWENTZHAVE_GETPWNAM_RZHAVE_GETPWUID_RZHAVE_GETRANDOMZHAVE_GETRANDOM_SYSCALLZHAVE_GETRESGIDZHAVE_GETRESUIDZHAVE_GETSIDZ
HAVE_GETSPENTZ
HAVE_GETSPNAMZHAVE_GETTIMEOFDAYZ
HAVE_GETWDZHAVE_GLIBC_MEMMOVE_BUGZ
HAVE_GRP_HZHAVE_HSTRERRORZHAVE_HTOLE64Z
HAVE_HYPOTZ
HAVE_IEEEFP_HZHAVE_IF_NAMEINDEXZHAVE_INET_ATONZHAVE_INET_PTONZHAVE_INITGROUPSZHAVE_INTTYPES_HZ	HAVE_IO_HZHAVE_IPA_PURE_CONST_BUGZ	HAVE_KILLZHAVE_KILLPGZHAVE_KQUEUEZHAVE_LANGINFO_HZHAVE_LARGEFILE_SUPPORTZ
HAVE_LCHFLAGSZHAVE_LCHMODZHAVE_LCHOWNZHAVE_LGAMMAZ
HAVE_LIBDLZHAVE_LIBDLDZHAVE_LIBIEEEZHAVE_LIBINTL_HZHAVE_LIBREADLINEZHAVE_LIBRESOLVZHAVE_LIBSENDFILEZHAVE_LIBUTIL_HZ	HAVE_LINKZHAVE_LINKATZHAVE_LINUX_CAN_BCM_HZHAVE_LINUX_CAN_HZHAVE_LINUX_CAN_RAW_FD_FRAMESZHAVE_LINUX_CAN_RAW_HZHAVE_LINUX_MEMFD_HZHAVE_LINUX_NETLINK_HZHAVE_LINUX_QRTR_HZHAVE_LINUX_RANDOM_HZHAVE_LINUX_TIPC_HZHAVE_LINUX_VM_SOCKETS_HZ
HAVE_LOCKFZ
HAVE_LOG1PZ	HAVE_LOG2ZHAVE_LONG_DOUBLEZ
HAVE_LSTATZHAVE_LUTIMESZHAVE_MADVISEZHAVE_MAKEDEVZHAVE_MBRTOWCZHAVE_MEMFD_CREATEZ
HAVE_MEMORY_HZHAVE_MEMRCHRZHAVE_MKDIRATZHAVE_MKFIFOZ
HAVE_MKFIFOATZ
HAVE_MKNODZHAVE_MKNODATZHAVE_MKTIMEZ	HAVE_MMAPZHAVE_MREMAPZHAVE_NCURSES_HZHAVE_NDIR_HZHAVE_NETPACKET_PACKET_HZ
HAVE_NET_IF_HZ	HAVE_NICEZHAVE_OPENATZHAVE_OPENPTYZ
HAVE_PATHCONFZ
HAVE_PAUSEZ
HAVE_PIPE2Z
HAVE_PLOCKZ	HAVE_POLLZHAVE_POLL_HZHAVE_POSIX_FADVISEZHAVE_POSIX_FALLOCATEZHAVE_POSIX_SPAWNZHAVE_POSIX_SPAWNPZ
HAVE_PREADZHAVE_PREADVZHAVE_PREADV2ZHAVE_PRLIMITZHAVE_PROCESS_HZHAVE_PROTOTYPESZHAVE_PTHREAD_CONDATTR_SETCLOCKZHAVE_PTHREAD_DESTRUCTORZHAVE_PTHREAD_GETCPUCLOCKIDZHAVE_PTHREAD_HZHAVE_PTHREAD_INITZHAVE_PTHREAD_KILLZHAVE_PTHREAD_SIGMASKZ
HAVE_PTY_HZHAVE_PUTENVZHAVE_PWRITEZHAVE_PWRITEVZ
HAVE_PWRITEV2Z
HAVE_READLINKZHAVE_READLINKATZ
HAVE_READVZ
HAVE_REALPATHZ
HAVE_RENAMEATZHAVE_RL_APPEND_HISTORYZHAVE_RL_CATCH_SIGNALZ#HAVE_RL_COMPLETION_APPEND_CHARACTERZ'HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOKZHAVE_RL_COMPLETION_MATCHESZ"HAVE_RL_COMPLETION_SUPPRESS_APPENDZHAVE_RL_PRE_INPUT_HOOKZHAVE_RL_RESIZE_TERMINALZ
HAVE_ROUNDZ
HAVE_RTPSPAWNZHAVE_SCHED_GET_PRIORITY_MAXZHAVE_SCHED_HZHAVE_SCHED_RR_GET_INTERVALZHAVE_SCHED_SETAFFINITYZHAVE_SCHED_SETPARAMZHAVE_SCHED_SETSCHEDULERZHAVE_SEM_GETVALUEZ
HAVE_SEM_OPENZHAVE_SEM_TIMEDWAITZHAVE_SEM_UNLINKZ
HAVE_SENDFILEZHAVE_SETEGIDZHAVE_SETEUIDZHAVE_SETGIDZHAVE_SETGROUPSZHAVE_SETHOSTNAMEZHAVE_SETITIMERZHAVE_SETLOCALEZHAVE_SETPGIDZHAVE_SETPGRPZHAVE_SETPRIORITYZ
HAVE_SETREGIDZHAVE_SETRESGIDZHAVE_SETRESUIDZ
HAVE_SETREUIDZHAVE_SETSIDZHAVE_SETUIDZHAVE_SETVBUFZ
HAVE_SHADOW_HZ
HAVE_SHM_OPENZHAVE_SHM_UNLINKZHAVE_SIGACTIONZHAVE_SIGALTSTACKZHAVE_SIGFILLSETZHAVE_SIGINFO_T_SI_BANDZHAVE_SIGINTERRUPTZ
HAVE_SIGNAL_HZHAVE_SIGPENDINGZ
HAVE_SIGRELSEZHAVE_SIGTIMEDWAITZHAVE_SIGWAITZHAVE_SIGWAITINFOZ
HAVE_SNPRINTFZHAVE_SOCKADDR_ALGZHAVE_SOCKADDR_SA_LENZHAVE_SOCKADDR_STORAGEZHAVE_SOCKETPAIRZHAVE_SPAWN_HZHAVE_SSIZE_TZHAVE_STATVFSZHAVE_STAT_TV_NSECZHAVE_STAT_TV_NSEC2ZHAVE_STDARG_PROTOTYPESZ
HAVE_STDINT_HZ
HAVE_STDLIB_HZHAVE_STD_ATOMICZHAVE_STRDUPZ
HAVE_STRFTIMEZHAVE_STRINGS_HZ
HAVE_STRING_HZHAVE_STRLCPYZHAVE_STROPTS_HZHAVE_STRSIGNALZHAVE_STRUCT_PASSWD_PW_GECOSZHAVE_STRUCT_PASSWD_PW_PASSWDZHAVE_STRUCT_STAT_ST_BIRTHTIMEZHAVE_STRUCT_STAT_ST_BLKSIZEZHAVE_STRUCT_STAT_ST_BLOCKSZHAVE_STRUCT_STAT_ST_FLAGSZHAVE_STRUCT_STAT_ST_GENZHAVE_STRUCT_STAT_ST_RDEVZHAVE_STRUCT_TM_TM_ZONEZHAVE_SYMLINKZHAVE_SYMLINKATZ	HAVE_SYNCZHAVE_SYSCONFZHAVE_SYSEXITS_HZHAVE_SYS_AUDIOIO_HZHAVE_SYS_BSDTTY_HZHAVE_SYS_DEVPOLL_HZHAVE_SYS_DIR_HZHAVE_SYS_ENDIAN_HZHAVE_SYS_EPOLL_HZHAVE_SYS_EVENT_HZHAVE_SYS_FILE_HZHAVE_SYS_IOCTL_HZHAVE_SYS_KERN_CONTROL_HZHAVE_SYS_LOADAVG_HZHAVE_SYS_LOCK_HZHAVE_SYS_MEMFD_HZHAVE_SYS_MKDEV_HZHAVE_SYS_MMAN_HZHAVE_SYS_MODEM_HZHAVE_SYS_NDIR_HZHAVE_SYS_PARAM_HZHAVE_SYS_POLL_HZHAVE_SYS_RANDOM_HZHAVE_SYS_RESOURCE_HZHAVE_SYS_SELECT_HZHAVE_SYS_SENDFILE_HZHAVE_SYS_SOCKET_HZHAVE_SYS_STATVFS_HZHAVE_SYS_STAT_HZHAVE_SYS_SYSCALL_HZHAVE_SYS_SYSMACROS_HZHAVE_SYS_SYS_DOMAIN_HZHAVE_SYS_TERMIO_HZHAVE_SYS_TIMES_HZHAVE_SYS_TIME_HZHAVE_SYS_TYPES_HZHAVE_SYS_UIO_HZ
HAVE_SYS_UN_HZHAVE_SYS_UTSNAME_HZHAVE_SYS_WAIT_HZHAVE_SYS_XATTR_HZHAVE_TCGETPGRPZHAVE_TCSETPGRPZHAVE_TEMPNAMZHAVE_TERMIOS_HZHAVE_TERM_HZHAVE_TGAMMAZHAVE_TIMEGMZ
HAVE_TIMESZHAVE_TMPFILEZHAVE_TMPNAMZ
HAVE_TMPNAM_RZHAVE_TM_ZONEZ
HAVE_TRUNCATEZHAVE_TZNAMEZ
HAVE_UCS4_TCLZ
HAVE_UNAMEZ
HAVE_UNISTD_HZ
HAVE_UNLINKATZ
HAVE_UNSETENVZHAVE_USABLE_WCHAR_TZHAVE_UTIL_HZHAVE_UTIMENSATZHAVE_UTIMESZHAVE_UTIME_HZHAVE_UUID_CREATEZHAVE_UUID_ENC_BEZHAVE_UUID_GENERATE_TIME_SAFEZHAVE_UUID_HZHAVE_UUID_UUID_HZ
HAVE_WAIT3Z
HAVE_WAIT4ZHAVE_WAITIDZHAVE_WAITPIDZHAVE_WCHAR_HZHAVE_WCSCOLLZ
HAVE_WCSFTIMEZHAVE_WCSXFRMZHAVE_WMEMCMPZHAVE_WORKING_TZSETZHAVE_WRITEVZ HAVE_X509_VERIFY_PARAM_SET1_HOSTZHAVE_ZLIB_COPYZHAVE__GETPTYZ
HOST_GNU_TYPEZINCLDIRSTOMAKEZ
INCLUDEDIRZ	INCLUDEPYZINSTALLZINSTALL_DATAZINSTALL_PROGRAMZINSTALL_SCRIPTZINSTALL_SHAREDZ
INSTSONAMEZIO_HZIO_OBJSZLDCXXSHAREDZLDFLAGSZ	LDLIBRARYZLDLIBRARYDIRZLDSHAREDZ	LDVERSIONZLIBCZLIBDESTZLIBDIRZLIBFFI_INCLUDEDIRZLIBMZ	LIBOBJDIRZLIBOBJSZLIBPCZLIBPLZ	LIBPYTHONZLIBRARYZLIBRARY_OBJSZLIBRARY_OBJS_OMIT_FROZENZLIBSZ
LIBSUBDIRSZLINKCCZ
LINKFORSHAREDZLIPO_32BIT_FLAGSZLIPO_INTEL64_FLAGSZ
LLVM_PROF_ERRZLLVM_PROF_FILEZLLVM_PROF_MERGERZLNZLOCALMODLIBSZMACHDEPZMACHDEP_OBJSZMACHDESTLIBZMACOSX_DEPLOYMENT_TARGETZMAINCCZMAJOR_IN_MKDEVZMAJOR_IN_SYSMACROSZ	MAKESETUPZMANDIRZMKDIR_PZMODBUILT_NAMESZMODDISABLED_NAMESZMODLIBSZMODOBJSZMODULE_OBJSZ	MULTIARCHZMULTIARCH_CPPFLAGSZMVWDELCH_IS_EXPRESSIONZNO_AS_NEEDEDZOBJECT_OBJSZOPENSSL_INCLUDESZOPENSSL_LDFLAGSZOPENSSL_LIBSZOPTZOTHER_LIBTOOL_OPTZPACKAGE_BUGREPORTZPACKAGE_NAMEZPACKAGE_STRINGZPACKAGE_TARNAMEZPACKAGE_URLZPACKAGE_VERSIONZPARSER_HEADERSZPARSER_OBJSZPGO_PROF_GEN_FLAGZPGO_PROF_USE_FLAGZPOBJSZPOSIX_SEMAPHORES_NOT_ENABLEDZPROFILE_TASKZ$PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INTZPTHREAD_SYSTEM_SCHED_SUPPORTEDZ
PY3LIBRARYZPYLONG_BITS_IN_DIGITZPYTHONZPYTHONFRAMEWORKZPYTHONFRAMEWORKDIRZPYTHONFRAMEWORKINSTALLDIRZPYTHONFRAMEWORKPREFIXZ
PYTHONPATHZPYTHON_FOR_BUILDZPYTHON_FOR_REGENZPYTHON_HEADERSZPYTHON_OBJSZPY_BUILTIN_MODULE_CFLAGSZ	PY_CFLAGSZPY_CFLAGS_NODISTZPY_COERCE_C_LOCALEZPY_CORE_CFLAGSZPY_CORE_LDFLAGSZPY_CPPFLAGSZPY_FORMAT_SIZE_TZ
PY_LDFLAGSZPY_LDFLAGS_NODISTZPY_SSL_DEFAULT_CIPHERSZPY_SSL_DEFAULT_CIPHER_STRINGZPY_STDMODULE_CFLAGSZPy_DEBUGZPy_ENABLE_SHAREDZPy_HASH_ALGORITHMZ
Py_TRACE_REFSZ
QUICKTESTOPTSZREADELFZ	RESSRCDIRZ
RETSIGTYPEZ	RUNSHAREDZ	SCRIPTDIRZSETPGRP_HAVE_ARGZSGI_ABIZSHELLZSHLIBSZSHLIB_SUFFIXZSHM_NEEDS_LIBRTZSIGNED_RIGHT_SHIFT_ZERO_FILLSZSITEPATHZ
SIZEOF_DOUBLEZSIZEOF_FLOATZ
SIZEOF_FPOS_TZ
SIZEOF_INTZSIZEOF_LONGZSIZEOF_LONG_DOUBLEZSIZEOF_LONG_LONGZSIZEOF_OFF_TZSIZEOF_PID_TZSIZEOF_PTHREAD_KEY_TZSIZEOF_PTHREAD_TZSIZEOF_SHORTZ
SIZEOF_SIZE_TZ
SIZEOF_TIME_TZSIZEOF_UINTPTR_TZ
SIZEOF_VOID_PZSIZEOF_WCHAR_TZSIZEOF__BOOLZSOABIZSRCDIRSZ
SRC_GDB_HOOKSZSTDC_HEADERSZSTRICT_SYSV_CURSESZ	STRIPFLAGZSUBDIRSZ
SUBDIRSTOOZSYSLIBSZSYS_SELECT_WITH_SYS_TIMEZTCLTK_INCLUDESZ
TCLTK_LIBSZTESTOPTSZTESTPATHZ
TESTPYTHONZTESTPYTHONOPTSZ
TESTRUNNERZTESTTIMEOUTZTIMEMODULE_LIBZTIME_WITH_SYS_TIMEZTM_IN_SYS_TIMEZUNICODE_DEPSZUNIVERSALSDKZUPDATE_FILEZUSE_COMPUTED_GOTOSZVERSIONZVPATHZWINDOW_HAS_FLAGSZWITH_DECIMAL_CONTEXTVARZWITH_DOC_STRINGSZWITH_DTRACEZ	WITH_DYLDZWITH_LIBINTLZWITH_NEXT_FRAMEWORKZ
WITH_PYMALLOCZ
WITH_VALGRINDZX87_DOUBLE_ROUNDINGZ
XMLLIBSUBDIRSZabs_builddirZ
abs_srcdirZdatarootdir�exec_prefix�prefixZsrcdirN)Zbuild_time_vars�rr�?/usr/lib64/python3.8/_sysconfigdata_d_linux_x86_64-linux-gnu.py�<module>sb2+-��������formatter.cpython-38.pyc000064400000042213150335716500011206 0ustar00U

e5d';�@s�dZddlZddlZejdedd�dZGdd�d�ZGdd	�d	�ZGd
d�d�ZGdd
�d
e�Z	Gdd�de�Z
ddd�Zedkr�e�dS)aGeneric output formatting.

Formatter objects transform an abstract flow of formatting events into
specific output events on writer objects. Formatters manage several stack
structures to allow various properties of a writer object to be changed and
restored; writers need not be able to handle relative changes nor any sort
of ``change back'' operation. Specific writer properties which may be
controlled via formatter objects are horizontal alignment, font, and left
margin indentations. A mechanism is provided which supports providing
arbitrary, non-exclusive style settings to a writer as well. Additional
interfaces facilitate formatting events which are not reversible, such as
paragraph separation.

Writer objects encapsulate device interfaces. Abstract devices, such as
file formats, are supported as well as physical devices. The provided
implementations all work with abstract devices. The interface makes
available mechanisms for setting the properties which formatter objects
manage and inserting data into the output.
�Nz"the formatter module is deprecated�)�
stacklevelc@s�eZdZdZd(dd�Zdd�Zdd�Zd	d
�Zd)dd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd*d$d%�Zd+d&d'�ZdS),�
NullFormattera=A formatter which does nothing.

    If the writer parameter is omitted, a NullWriter instance is created.
    No methods of the writer are called by NullFormatter instances.

    Implementations should inherit from this class if implementing a writer
    interface but don't need to inherit any implementation.

    NcCs|dkrt�}||_dS�N)�
NullWriter�writer��selfr�r
�!/usr/lib64/python3.8/formatter.py�__init__)szNullFormatter.__init__cCsdSrr
�r	�	blankliner
r
r�
end_paragraph-�zNullFormatter.end_paragraphcCsdSrr
�r	r
r
r�add_line_break.rzNullFormatter.add_line_breakcOsdSrr
�r	�args�kwr
r
r�add_hor_rule/rzNullFormatter.add_hor_rulecCsdSrr
�r	�format�counterrr
r
r�add_label_data0rzNullFormatter.add_label_datacCsdSrr
�r	�datar
r
r�add_flowing_data1rzNullFormatter.add_flowing_datacCsdSrr
rr
r
r�add_literal_data2rzNullFormatter.add_literal_datacCsdSrr
rr
r
r�flush_softspace3rzNullFormatter.flush_softspacecCsdSrr
�r	�alignr
r
r�push_alignment4rzNullFormatter.push_alignmentcCsdSrr
rr
r
r�
pop_alignment5rzNullFormatter.pop_alignmentcCsdSrr
)r	�xr
r
r�	push_font6rzNullFormatter.push_fontcCsdSrr
rr
r
r�pop_font7rzNullFormatter.pop_fontcCsdSrr
)r	�marginr
r
r�push_margin8rzNullFormatter.push_margincCsdSrr
rr
r
r�
pop_margin9rzNullFormatter.pop_margincCsdSrr
�r	�spacingr
r
r�set_spacing:rzNullFormatter.set_spacingcGsdSrr
�r	�stylesr
r
r�
push_style;rzNullFormatter.push_style�cCsdSrr
�r	�nr
r
r�	pop_style<rzNullFormatter.pop_stylecCsdSrr
�r	�flagr
r
r�assert_line_data=rzNullFormatter.assert_line_data)N)N)r0)r0)�__name__�
__module__�__qualname__�__doc__rrrrrrrrr"r#r%r&r(r)r,r/r3r6r
r
r
rrs&



rc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd.dd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd/d*d+�Zd0d,d-�Zd
S)1�AbstractFormatterz�The standard formatter.

    This implementation has demonstrated wide applicability to many writers,
    and may be used directly in most circumstances.  It has been used to
    implement a full-featured World Wide Web browser.

    cCsR||_d|_g|_g|_g|_d|_g|_d|_d|_d|_	d|_
d|_d|_dS�Nr0r)
rr!�align_stack�
font_stack�margin_stackr+�style_stack�nospace�	softspace�para_end�parskip�
hard_break�
have_labelrr
r
rrNszAbstractFormatter.__init__cCs`|js|j��d|_|j|krD|jsD|j�||j�||_d|_d|_|_|_d|_dS�Nrr0)	rEr�send_line_breakrFrD�send_paragraphrArCrBr
r
r
rr]s
zAbstractFormatter.end_paragraphcCs8|js"|js"|j��d|_|_d|_|_d|_dSrG)rErCrrHrFrDrArBrr
r
rrhs

z AbstractFormatter.add_line_breakcOsF|js|j��|jj||�d|_|_d|_|_|_|_dSr<)	rErrH�
send_hor_rulerArFrCrBrDrr
r
rros

zAbstractFormatter.add_hor_ruleNcCs�|js|js|j��|js0|j�|r*dp,d�t|t�rP|j�|�	||��n|j�|�d|_
|_|_|_d|_|_dSr<)
rFrErrHrCrI�
isinstance�str�send_label_data�format_counterrArBrDrr
r
rrvs

z AbstractFormatter.add_label_datacCstd}|D]f}|dkr"|d|}q|dkrD|dkrn||�||�}q|dkrf|dkrn||�||�}q||}q|S)N��1z%dZaArZiI)�
format_letter�format_roman)r	rr�label�cr
r
rrN�s
z AbstractFormatter.format_countercCs<d}|dkr8t|dd�\}}tt|�|�}||}q|S)NrOrr0�)�divmod�chr�ord)r	�caserrSr$�sr
r
rrQ�s
zAbstractFormatter.format_letterc	Cs�ddddg}dddg}d\}}|d	kr�t|d
�\}}|dkrV||||d|}nT|d
krt|||||}n6|dkr�||}|d}nd}||||}||}|d}q|dkr�|��S|S)N�ir$rT�m�v�l�d)rOrr�
�	r0��rO�I)rV�upper)	r	rYrZonesZfivesrS�indexr$rZr
r
rrR�s&


zAbstractFormatter.format_romancCs�|sdS|dd���}|dd���}d�|���}|jrD|sDdS|sN|jrv|sh|jsdd|_d|_dS|jsvd|}d|_|_|_|_|_||_|j	�
|�dS)Nr0���� r)�isspace�join�splitrArBrDrErCrFr�send_flowing_data)r	rZprespaceZ	postspacer
r
rr�s*

�z"AbstractFormatter.add_flowing_datacCsZ|sdS|jr|j�d�|dd�dk|_d|_|_|_|_|_|j�|�dS)Nrhrg�
r)	rBrrlrErArCrDrF�send_literal_datarr
r
rr�s�z"AbstractFormatter.add_literal_datacCs:|jr6d|_|_|_|_|_d|_|j�d�dS�Nrr0rh)rBrErCrDrFrArrlrr
r
rr�s�z!AbstractFormatter.flush_softspacecCs@|r.||jkr.|j�|�||_|j�|�n|j�|j�dSr)r!r�
new_alignmentr=�appendr r
r
rr"�s
z AbstractFormatter.push_alignmentcCsH|jr|jd=|jr2|jd|_}|j�|�nd|_|j�d�dS�Nrg)r=r!rrpr r
r
rr#�szAbstractFormatter.pop_alignmentc
Cs�|\}}}}|jr6d|_|_|_d|_|j�d�|jr~|jd\}}}}	|tkrZ|}|tkrf|}|tkrr|}|tkr~|	}||||f}|j�|�|j�	|�dS)Nrr0rhrg)
rBrErCrArrlr>�AS_ISrq�new_font)
r	�font�sizer[�bZttZcsizeZci�cbZcttr
r
rr%�s$zAbstractFormatter.push_fontcCs4|jr|jd=|jr |jd}nd}|j�|�dSrr)r>rrt�r	rur
r
rr&�szAbstractFormatter.pop_fontcCsB|j�|�dd�|jD�}|s,|r,|d}|j�|t|��dS)NcSsg|]}|r|�qSr
r
��.0r\r
r
r�
<listcomp>sz1AbstractFormatter.push_margin.<locals>.<listcomp>rg)r?rqr�
new_margin�len)r	r'�fstackr
r
rr(s
zAbstractFormatter.push_margincCsF|jr|jd=dd�|jD�}|r,|d}nd}|j�|t|��dS)NrgcSsg|]}|r|�qSr
r
rzr
r
rr|
sz0AbstractFormatter.pop_margin.<locals>.<listcomp>)r?rr}r~)r	rr'r
r
rr)
s
zAbstractFormatter.pop_margincCs||_|j�|�dSr)r+r�new_spacingr*r
r
rr,szAbstractFormatter.set_spacingcGsV|jr*d|_|_|_d|_|j�d�|D]}|j�|�q.|j�t	|j��dSro)
rBrErCrArrlr@rq�
new_styles�tuple)r	r.Zstyler
r
rr/szAbstractFormatter.push_styler0cCs$|j|d�=|j�t|j��dSr)r@rr�r�r1r
r
rr3!szAbstractFormatter.pop_stylecCs$||_|_d|_|_|_dS�Nr)rArErCrDrFr4r
r
rr6%sz"AbstractFormatter.assert_line_data)N)r0)r0)r7r8r9r:rrrrrrNrQrRrrrr"r#r%r&r(r)r,r/r3r6r
r
r
rr;@s,

	
	
	
r;c@sxeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)raMinimal writer interface to use in testing & inheritance.

    A writer which only provides the interface definition; no actions are
    taken on any methods.  This should be the base class for all writers
    which do not need to inherit any implementation methods.

    cCsdSrr
rr
r
rr2rzNullWriter.__init__cCsdSrr
rr
r
r�flush3rzNullWriter.flushcCsdSrr
r r
r
rrp4rzNullWriter.new_alignmentcCsdSrr
ryr
r
rrt5rzNullWriter.new_fontcCsdSrr
�r	r'�levelr
r
rr}6rzNullWriter.new_margincCsdSrr
r*r
r
rr�7rzNullWriter.new_spacingcCsdSrr
r-r
r
rr�8rzNullWriter.new_stylescCsdSrr
r
r
r
rrI9rzNullWriter.send_paragraphcCsdSrr
rr
r
rrH:rzNullWriter.send_line_breakcOsdSrr
rr
r
rrJ;rzNullWriter.send_hor_rulecCsdSrr
rr
r
rrM<rzNullWriter.send_label_datacCsdSrr
rr
r
rrl=rzNullWriter.send_flowing_datacCsdSrr
rr
r
rrn>rzNullWriter.send_literal_dataN)r7r8r9r:rr�rprtr}r�r�rIrHrJrMrlrnr
r
r
rr*src@sheZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�AbstractWriterz�A writer which can be used in debugging formatters, but not much else.

    Each method simply announces itself by printing its name and
    arguments on standard output.

    cCstd|f�dS)Nznew_alignment(%r)��printr r
r
rrpIszAbstractWriter.new_alignmentcCstd|f�dS)Nznew_font(%r)r�ryr
r
rrtLszAbstractWriter.new_fontcCstd||f�dS)Nznew_margin(%r, %d)r�r�r
r
rr}OszAbstractWriter.new_margincCstd|f�dS)Nznew_spacing(%r)r�r*r
r
rr�RszAbstractWriter.new_spacingcCstd|f�dS)Nznew_styles(%r)r�r-r
r
rr�UszAbstractWriter.new_stylescCstd|f�dS)Nzsend_paragraph(%r)r�r
r
r
rrIXszAbstractWriter.send_paragraphcCstd�dS)Nzsend_line_break()r�rr
r
rrH[szAbstractWriter.send_line_breakcOstd�dS)Nzsend_hor_rule()r�rr
r
rrJ^szAbstractWriter.send_hor_rulecCstd|f�dS)Nzsend_label_data(%r)r�rr
r
rrMaszAbstractWriter.send_label_datacCstd|f�dS)Nzsend_flowing_data(%r)r�rr
r
rrldsz AbstractWriter.send_flowing_datacCstd|f�dS)Nzsend_literal_data(%r)r�rr
r
rrngsz AbstractWriter.send_literal_dataN)r7r8r9r:rprtr}r�r�rIrHrJrMrlrnr
r
r
rr�Asr�c@sJeZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dS)�
DumbWritera;Simple writer class which writes output on the file object passed in
    as the file parameter or, if file is omitted, on standard output.  The
    output is simply word-wrapped to the number of columns specified by
    the maxcol parameter.  This class is suitable for reflowing a sequence
    of paragraphs.

    N�HcCs(|ptj|_||_t�|�|��dSr)�sys�stdout�file�maxcolrr�reset)r	r�r�r
r
rrts
zDumbWriter.__init__cCsd|_d|_dSr�)�col�atbreakrr
r
rr�zszDumbWriter.resetcCs |j�d|�d|_d|_dS�Nrmr�r��writer�r�r
r
r
rrI~szDumbWriter.send_paragraphcCs|j�d�d|_d|_dSr�r�rr
r
rrH�szDumbWriter.send_line_breakcOs:|j�d�|j�d|j�|j�d�d|_d|_dS)Nrm�-r)r�r�r�r�r�rr
r
rrJ�s
zDumbWriter.send_hor_rulecCsV|j�|�|�d�}|dkr4d|_||dd�}|��}|jt|�|_d|_dS)Nrmrr0)r�r��rfindr��
expandtabsr~r�)r	rr[r
r
rrn�s
zDumbWriter.send_literal_datacCs�|sdS|jp|d��}|j}|j}|jj}|��D]N}|rl|t|�|kr\|d�d}n|d�|d}||�|t|�}d}q6||_|d��|_dS)Nrrmrhr0rg)r�rir�r�r�r�rkr~)r	rr�r�r�r�Zwordr
r
rrl�s$zDumbWriter.send_flowing_data)Nr�)r7r8r9r:rr�rIrHrJrnrlr
r
r
rr�ks

r�cCs�t�}t|�}|dk	r t|�}n$tjdd�r>ttjd�}ntj}z,|D]"}|dkrb|�d�qJ|�|�qJW5|tjk	r�|��X|�d�dS)Nr0rmr)	r�r;�openr��argv�stdin�closerr)r��w�f�fp�liner
r
r�test�s


r��__main__)N)
r:r��warnings�warn�DeprecationWarningrsrr;rr�r�r�r7r
r
r
r�<module>s�"k*C
posixpath.cpython-38.opt-1.pyc000064400000024276150335716500012172 0ustar00U

e5d=�&@s^dZdZdZdZdZdZdZdZdZddl	Z	ddl
Z
ddlZddlZdd	lTd
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/g&Z
d0d1�Zd2d
�Zd3d�Zd4d�Zd5d�Zd6d�Zejje_d7d
�Zd8d�Zd9d�Zd:d�Zd;d�Zd<d�Zd=d�Zdadad>d�Zd?d�Zd@d �Z dAd,�Z!dBdC�Z"e
j#dDkZ$dGdEd.�Z%dFd/�Z&dS)Ha�Common operations on Posix pathnames.

Instead of importing this module directly, import os and refer to
this module as os.path.  The "os.path" name is an alias for this
module on Posix systems; on other systems (e.g. Windows),
os.path provides the same operations in a manner specific to that
platform, and is an alias to another module (e.g. ntpath).

Some of this can actually be useful on non-Posix systems too, e.g.
for manipulation of the pathname component of URLs.
�.�..�/�:z
/bin:/usr/binNz	/dev/null�)�*�normcase�isabs�join�
splitdrive�split�splitext�basename�dirname�commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�ismount�
expanduser�
expandvars�normpath�abspath�samefile�sameopenfile�samestat�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenames�relpath�
commonpathcCst|t�rdSdSdS)N�/r)�
isinstance�bytes��path�r2�!/usr/lib64/python3.8/posixpath.py�_get_sep)s
r4cCs
t�|�S)z6Normalize case of pathname.  Has no effect under Posix��os�fspath)�sr2r2r3r4scCst�|�}t|�}|�|�S)zTest whether a path is absolute)r6r7r4�
startswith)r8r#r2r2r3r<s
c
Gs�t�|�}t|�}|}z^|s,|dd�|ttj|�D]8}|�|�rL|}q8|rZ|�|�rd||7}q8|||7}q8Wn.tttfk
r�t	j
d|f|���YnX|S)z�Join two or more pathname components, inserting '/' as needed.
    If any component is an absolute path, all previous path components
    will be discarded.  An empty last part will result in a path that
    ends with a separator.Nrr	)r6r7r4�mapr9�endswith�	TypeError�AttributeError�BytesWarning�genericpath�_check_arg_types)�a�pr#r1�br2r2r3r	Gs 


cCs`t�|�}t|�}|�|�d}|d|�||d�}}|rX||t|�krX|�|�}||fS)z�Split a pathname.  Returns tuple "(head, tail)" where "tail" is
    everything after the final slash.  Either part may be empty.�N�r6r7r4�rfind�len�rstrip)rBr#�i�head�tailr2r2r3rds

cCs6t�|�}t|t�rd}d}nd}d}t�||d|�S)Nr-�.rr)r6r7r.r/r?�	_splitext)rBr#r'r2r2r3rus

cCst�|�}|dd�|fS)zJSplit a pathname into drive and path. On Posix, drive is always
    empty.Nrr5)rBr2r2r3r
�s
cCs,t�|�}t|�}|�|�d}||d�S)z)Returns the final component of a pathnamerDN)r6r7r4rF)rBr#rIr2r2r3r
�s
cCsNt�|�}t|�}|�|�d}|d|�}|rJ||t|�krJ|�|�}|S)z-Returns the directory component of a pathnamerDNrE)rBr#rIrJr2r2r3r�s

c
Cs8zt�|�}Wntttfk
r*YdSXt�|j�S)z&Test whether a path is a symbolic linkF)r6�lstat�OSError�
ValueErrorr=�stat�S_ISLNK�st_mode)r1�str2r2r3r�s
c	Cs.zt�|�Wnttfk
r(YdSXdS)zCTest whether a path exists.  Returns True for broken symbolic linksFT)r6rNrOrPr0r2r2r3r�s
c	Cs�zt�|�}Wnttfk
r(YdSXt�|j�r:dSt|t�rPt	|d�}n
t	|d�}t
|�}zt�|�}Wnttfk
r�YdSX|j}|j}||kr�dS|j}|j}||kr�dSdS)z$Test whether a path is a mount pointF�..rT)
r6rNrOrPrQrRrSr.r/r	r)�st_dev�st_ino)r1�s1�parent�s2�dev1�dev2�ino1�ino2r2r2r3r�s.

c	Cs<t�|�}t|t�rd}nd}|�|�s,|St|�}|�|d�}|dkrPt|�}|dkr�dtjkr�ddl	}z|�
t���j}Wq�t
k
r�|YSXn
tjd}nVddl	}|d|�}t|t�r�t|d�}z|�|�}Wnt
k
r�|YSX|j}t|t��rt�|�}d}nd	}|�|�}|||d��p:|S)
zOExpand ~ and ~user constructions.  If user or $HOME is unknown,
    do nothing.�~�~rDr�HOMEN�ASCIIr-r)r6r7r.r/r9r4�findrG�environ�pwd�getpwuid�getuid�pw_dir�KeyError�str�getpwnam�fsencoderH)	r1�tilder#rIre�userhome�name�pwent�rootr2r2r3r�sB








cCsZt�|�}t|t�rVd|kr |Sts:ddl}|�d|j�atj}d}d}t	tdd�}n:d|krb|St
s|ddl}|�d	|j�a
t
j}d
}d}tj}d}|||�}|s��qV|�d�\}}|�
d�}	|	�|�r�|	�|�r�|	dd
�}	z.|dk�rt�tjt�|	��}
n||	}
Wntk
�r&|}Yq�X||d�}|d|�|
}t|�}||7}q�|S)zZExpand shell variables of form $var and ${var}.  Unknown variables
    are left unchanged.�$rNs\$(\w+|\{[^}]*\})�{�}�environb�$z\$(\w+|\{[^}]*\})�{�}rD���)r6r7r.r/�	_varprogb�re�compilerb�search�getattr�_varprogrd�span�groupr9r;rl�fsdecoderirG)r1r{r}�start�endrdrI�m�jro�valuerKr2r2r3rsN






c	Cs�t�|�}t|t�r&d}d}d}d}nd}d}d}d}||krB|S|�|�}|rp|�|d	�rp|�|d
�spd	}|�|�}g}|D]J}|||fkr�q�||ks�|s�|r�|r�|d|kr�|�|�q�|r�|��q�|}|�|�}|r�|||}|p�|S)z0Normalize path, eliminating double slashes, etc.r-�rLrUr�rr��ry)	r6r7r.r/r9r�append�popr	)	r1r#�empty�dot�dotdot�initial_slashes�comps�	new_comps�compr2r2r3rNsJ


��
�
�

cCs@t�|�}t|�s8t|t�r&t��}nt��}t||�}t|�S)zReturn an absolute path.)	r6r7rr.r/�getcwdb�getcwdr	r)r1�cwdr2r2r3rts



cCs*t�|�}t|dd�|i�\}}t|�S)zlReturn the canonical path of the specified filename, eliminating any
symbolic links encountered in the path.Nr)r6r7�
_joinrealpathr)�filenamer1�okr2r2r3r)�s
c
Cst|t�rd}d}d}nd}d}d}t|�r<|dd�}|}|�r|�|�\}}}|r<||kr`q<||kr�|r�t|�\}}||kr�t|||�}q<|}q<t||�}t|�s�|}q<||kr�||}|dk	r�q<t||�dfSd||<t|t�	|�|�\}}	|	�st||�dfS|||<q<|d	fS)
Nr-rLrUrrrrDFT)
r.r/r�	partitionrr	rr�r6�readlink)
r1�rest�seenr#r!r"ro�_�newpathr�r2r2r3r��sH


r��darwinc	Cs�|std��t�|�}t|t�r.d}d}d}nd}d}d}|dkrH|}n
t�|�}zrd	d
�t|��|�D�}dd
�t|��|�D�}tt||g��}|gt|�|||d�}|s�|WSt	|�WSt
ttt
fk
r�t�d||��YnXdS)
z#Return a relative version of a pathzno path specifiedrLr-rUrrrNcSsg|]}|r|�qSr2r2��.0�xr2r2r3�
<listcomp>�szrelpath.<locals>.<listcomp>cSsg|]}|r|�qSr2r2r�r2r2r3r��sr+)rPr6r7r.r/rrrGrr	r<r=r>�DeprecationWarningr?r@)	r1r�r!r#r"�
start_list�	path_listrI�rel_listr2r2r3r+�s0



c		s2|std��tttj|��}t|dt�r4d�d�nd�d�zƇfdd�|D�}zt�fd	d
�|D��\}Wntk
r�td�d�YnX�fd
d�|D�}t|�}t	|�}|}t
|�D]$\}}|||kr�|d|�}q�q�|r�n
�dd�}|��|�WStt
fk
�r,tjd|���YnXdS)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr-rLrrcsg|]}|����qSr2)r)r�r1�r#r2r3r��szcommonpath.<locals>.<listcomp>c3s|]}|dd��kVqdS)NrDr2)r�rBr�r2r3�	<genexpr>�szcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathsNcsg|]}�fdd�|D��qS)csg|]}|r|�kr|�qSr2r2)r��c�r!r2r3r�sz)commonpath.<locals>.<listcomp>.<listcomp>r2)r�r8r�r2r3r�sr,)r,)rP�tupler:r6r7r.r/�set�min�max�	enumerater	r<r=r?r@)	�paths�split_pathsrrXrZ�commonrIr��prefixr2)r!r#r3r,�s6)N)'�__doc__r!r"r'r#r$r%r&r(r6�sysrQr?�__all__r4rrr	rrrMr
r
rrrrrrrzrrrr)r��platformr*r+r,r2r2r2r3�<module>s��
	
	

*25&	3

)sched.cpython-38.opt-1.pyc000064400000014606150335716500011235 0ustar00U

e5d*�@s�dZddlZddlZddlmZddlZddlmZdgZGdd�dedd��Z	d	e	j_d
e	j
_de	j_de	j_d
e	j
_e�ZGdd�d�ZdS)a�A generally useful event scheduler class.

Each instance of this class manages its own queue.
No multi-threading is implied; you are supposed to hack that
yourself, or use a single instance per application.

Each instance is parametrized with two functions, one that is
supposed to return the current time, one that is supposed to
implement a delay.  You can implement real-time scheduling by
substituting time and sleep from built-in module time, or you can
implement simulated time by writing your own functions.  This can
also be used to integrate scheduling with STDWIN events; the delay
function is allowed to modify the queue.  Time can be expressed as
integers or floating point numbers, as long as it is consistent.

Events are specified by tuples (time, priority, action, argument, kwargs).
As in UNIX, lower priority numbers mean higher priority; in this
way the queue can be maintained as a priority queue.  Execution of the
event means calling the action function, passing it the argument
sequence in "argument" (remember that in Python, multiple function
arguments are be packed in a sequence) and keyword parameters in "kwargs".
The action function may be an instance method so it
has another way to reference private data (besides global variables).
�N)�
namedtuple)�	monotonic�	schedulerc@s8eZdZgZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�EventcCs|j|jf|j|jfkS�N��time�priority��s�o�r
�/usr/lib64/python3.8/sched.py�__eq__$�zEvent.__eq__cCs|j|jf|j|jfkSrrr
r
r
r�__lt__%rzEvent.__lt__cCs|j|jf|j|jfkSrrr
r
r
r�__le__&rzEvent.__le__cCs|j|jf|j|jfkSrrr
r
r
r�__gt__'rzEvent.__gt__cCs|j|jf|j|jfkSrrr
r
r
r�__ge__(rzEvent.__ge__N)	�__name__�
__module__�__qualname__�	__slots__rrrrrr
r
r
rr"srz(time, priority, action, argument, kwargszaNumeric type compatible with the return value of the
timefunc function passed to the constructor.zSEvents scheduled for the same time will be executed
in the order of their priority.z?Executing the event means executing
action(*argument, **kwargs)zGargument is a sequence holding the positional
arguments for the action.zDkwargs is a dictionary holding the keyword
arguments for the action.c@s^eZdZeejfdd�Zdefdd�Zdefdd�Z	dd	�Z
d
d�Zdd
d�Ze
dd��ZdS)rcCs g|_t��|_||_||_dS)zGInitialize a new instance, passing the time and delay
        functionsN)�_queue�	threading�RLock�_lock�timefunc�	delayfunc)�selfrrr
r
r�__init__9s
zscheduler.__init__r
c	Cs@|tkri}t|||||�}|j�t�|j|�W5QRX|S)z�Enter a new event in the queue at an absolute time.

        Returns an ID for the event which can be used to remove it,
        if necessary.

        )�	_sentinelrr�heapq�heappushr)rrr	�action�argument�kwargs�eventr
r
r�enterabsAszscheduler.enterabscCs|��|}|�|||||�S)z{A variant that specifies the time as a relative time.

        This is actually the more commonly used interface.

        )rr()r�delayr	r$r%r&rr
r
r�enterOszscheduler.enterc	Cs.|j�|j�|�t�|j�W5QRXdS)z�Remove an event from the queue.

        This must be presented the ID as returned by enter().
        If the event is not in the queue, this raises ValueError.

        N)rr�remover"�heapify)rr'r
r
r�cancelXszscheduler.cancelc
Cs&|j�|jW5QR�SQRXdS)z!Check whether the queue is empty.N)rr)rr
r
r�emptycszscheduler.emptyTc	Cs�|j}|j}|j}|j}tj}|�H|s4W5QR�q�|d\}}}	}
}|�}||krZd}
nd}
||�W5QRX|
r�|s�||S|||�q|	|
|�|d�qdS)aExecute events until the queue is empty.
        If blocking is False executes the scheduled events due to
        expire soonest (if any) and then return the deadline of the
        next scheduled call in the scheduler.

        When there is a positive delay until the first event, the
        delay function is called and the event is left in the queue;
        otherwise, the event is removed from the queue and executed
        (its action function is called, passing it the argument).  If
        the delay function returns prematurely, it is simply
        restarted.

        It is legal for both the delay function and the action
        function to modify the queue or to raise an exception;
        exceptions are not caught but the scheduler's state remains
        well-defined so run() may be called again.

        A questionable hack is added to allow other threads to run:
        just after an event is executed, a delay of 0 is executed, to
        avoid monopolizing the CPU when other threads are also
        runnable.

        rTFN)rrrrr"�heappop)rZblocking�lock�qrr�poprr	r$r%r&Znowr)r
r
r�runhs(
z
scheduler.runc	Cs:|j�|jdd�}W5QRXtttj|gt|���S)z�An ordered list of upcoming events.

        Events are named tuples with fields for:
            time, priority, action, arguments, kwargs

        N)rr�list�mapr"r/�len)rZeventsr
r
r�queue�szscheduler.queueN)T)rrr�_timer�sleepr r!r(r*r-r.r3�propertyr7r
r
r
rr7s	
2)�__doc__rr"�collectionsrrrr8�__all__rr	r$r%r&�objectr!rr
r
r
r�<module>sshutil.cpython-38.opt-1.pyc000064400000111044150335716500011451 0ustar00U

e5d1��@s�dZddlZddlZddlZddlZddlZddlZzddlZ[dZWne	k
r^dZYnXzddl
Z
[
dZWne	k
r�dZYnXzddlZ[dZ
Wne	k
r�dZ
YnXzddlmZWne	k
r�dZYnXzddlmZWne	k
�rdZYnXejdkZdZZejdk�r6ddlZne�rDddlZe�rNd	nd
Zeed��ohej�d�ae�oxeed
�ZdZdddddddddddddddddd d!d"d#d$d%d&d'gZGd(d�de�ZGd)d'�d'e�Z Gd*d�de�Z!Gd+d�de�Z"Gd,d-�d-e�Z#Gd.d/�d/e$�Z%Gd0d1�d1e$�Z&d2d3�Z'd4d5�Z(efd6d7�Z)d�d8d�Z*d9d:�Z+d;d<�Z,d=d>�Z-dd?�d@d�Z.dd?�dAd�Z/eedB��r�dd?�dCdD�Z0ndEdD�Z0dd?�dFd�Z1dd?�dGd�Z2dd?�dHd�Z3dId#�Z4d�dJdK�Z5dde3ddfdLd�Z6eej7dM��rdNdO�Z8dPdQ�Z9ndRdO�Z8dSdQ�Z9dTdU�Z:dVdW�Z;ej<ejej=ej>hej?k�ofej@ejAk�ofejejBkZCd�dXd�ZDeCeD_EdYdZ�ZFe3fd[d�ZGd\d]�ZHd^d_�ZId`da�ZJdbdc�ZKd�dedf�ZLd�dgdh�ZMdieLdjgdkfiZNe�r�eLdlgdmfeNdn<eMgdofeNdp<e�r
eLdqgdrfeNds<e
�r eLdtgdufeNdv<dwd�ZOd�dyd�ZPdzd�ZQd�d{d�ZRd|d�ZSd}d~�ZTd�dd �ZUd�d!�ZVd�d��ZWd�d��ZXdd��d�d��ZYd�geYgdkfd�geXgdofd��ZZe�r�d�d�geYgdmfeZdn<e�r�d�d�geYgdrfeZds<e
�r�d�d�geYgdufeZdv<d�d��Z[d�dd��d�d"�Z\eed���rLe�]d��e�^d�d��Z_d�e_j`_d�e_ja_d�e_jb_d�d��Zcn$e�rpe�]d��e�^d�d��Z_d�d��Zcd�d�d$�Zdd�d�d&�Zed�d��ZfejgejhBdfd�d%�ZidS)�z�Utility functions for copying and archiving files and directory trees.

XXX The functions here don't copy the resource fork or other metadata on Mac.

�NTF)�getpwnam)�getgrnam�nt�posixii�sendfileZlinux�
_fcopyfilez%.COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS;.MSC�copyfileobj�copyfile�copymode�copystat�copy�copy2�copytree�move�rmtree�Error�SpecialFileError�	ExecError�make_archive�get_archive_formats�register_archive_format�unregister_archive_format�get_unpack_formats�register_unpack_format�unregister_unpack_format�unpack_archive�ignore_patterns�chown�which�get_terminal_size�
SameFileErrorc@seZdZdS)rN)�__name__�
__module__�__qualname__�r$r$�/usr/lib64/python3.8/shutil.pyrEsc@seZdZdZdS)r z5Raised when source and destination are the same file.N�r!r"r#�__doc__r$r$r$r%r Hsc@seZdZdZdS)rz|Raised when trying to do a kind of operation (e.g. copying) which is
    not supported on a special file (e.g. a named pipe)Nr&r$r$r$r%rKsc@seZdZdZdS)rz+Raised when a command could not be executedNr&r$r$r$r%rOsc@seZdZdZdS)�	ReadErrorz%Raised when an archive cannot be readNr&r$r$r$r%r(Rsr(c@seZdZdZdS)�
RegistryErrorzVRaised when a registry operation with the archiving
    and unpacking registries failsNr&r$r$r$r%r)Usr)c@seZdZdZdS)�_GiveupOnFastCopyzuRaised as a signal to fallback on using raw read()/write()
    file copy when fast-copy functions fail to do so.
    Nr&r$r$r$r%r*Ysr*c
Cs�z|��}|��}Wn*tk
r>}zt|��W5d}~XYnXzt�|||�WnTtk
r�}z6|j|_|j|_|j	t	j
t	jhkr�t|��n|d�W5d}~XYnXdS)zhCopy a regular file content or metadata by using high-performance
    fcopyfile(3) syscall (macOS).
    N)�fileno�	Exceptionr*rr�OSError�name�filename�	filename2�errno�EINVAL�ENOTSUP)�fsrc�fdst�flags�infd�outfd�errr$r$r%�_fastcopy_fcopyfile^s
r:c
CsDz|��}|��}Wn*tk
r>}zt|��W5d}~XYnXztt�|�jd�}Wntk
rnd}YnXtj	dkr�t
|d�}d}zt�||||�}Wn�tk
�r&}zj|j|_
|j|_|jtjkr�dat|��|jtjkr�|d�|dk�rt�|dtj�dk�rt|��|�W5d}~XYq�X|dk�r6�q@||7}q�dS)z�Copy data from one regular mmap-like fd to another by using
    high-performance sendfile(2) syscall.
    This should work on Linux >= 2.6.33 only.
    Ni�ili@rF)r+r,r*�max�os�fstat�st_sizer-�sys�maxsize�minrr.r/r0r1ZENOTSOCK�_USE_CP_SENDFILEZENOSPC�lseek�SEEK_CUR)r4r5r7r8r9Z	blocksize�offsetZsentr$r$r%�_fastcopy_sendfilers8


 
rFc
Csn|j}|j}tt|���L}||�}|s*q`q||krV|d|��}|�|�W5QRXq||�qW5QRXdS)z�readinto()/memoryview() based variant of copyfileobj().
    *fsrc* must support readinto() method and both files must be
    open in binary mode.
    N)�readinto�write�
memoryview�	bytearray)r4r5�lengthZ
fsrc_readinto�
fdst_writeZmv�nZsmvr$r$r%�_copyfileobj_readinto�srNcCs0|st}|j}|j}||�}|s"q,||�qdS)z=copy data from file-like object fsrc to file-like object fdstN)�COPY_BUFSIZE�readrH)r4r5rKZ	fsrc_readrLZbufr$r$r%r�scCs�t|tj�rJttjd�rJztj�|��t�|��WStk
rHYdSXttjd�r~ztj�||�WStk
r|YdSXtj�	tj�
|��tj�	tj�
|��kS)N�samestatF�samefile)�
isinstancer<�DirEntry�hasattr�pathrQ�statr-rR�normcase�abspath��src�dstr$r$r%�	_samefile�s�r]cCst|tj�r|��St�|�S�N)rSr<rTrW��fnr$r$r%�_stat�sracCs t|tj�r|��Stj�|�Sr^)rSr<rT�
is_symlinkrV�islinkr_r$r$r%�_islink�srd��follow_symlinksc	Cs�t�d||�t||�r(td�||���d}t||g�D]j\}}zt|�}Wntk
r`Yq8Xt�	|j
�r�t|tj
�r�|jn|}td|��tr8|dkr8|j}q8|s�t|�r�t�t�|�|��n
t|d����}t|d���}t�r,z,t||tj�|WW5QR�W5QR�Stk
�r(YnXn�t�rtz(t||�|WW5QR�W5QR�Stk
�rpYnXn>t�r�|dk�r�t||t|t��|W5QR�W5QR�St ||�W5QRXW5QRX|S)z�Copy data from src to dst in the most efficient way possible.

    If follow_symlinks is not set and src is a symbolic link, a new
    symlink will be created instead of copying the file it points to.

    zshutil.copyfilez{!r} and {!r} are the same filerz`%s` is a named pipe�rb�wb)!r?�auditr]r �format�	enumeraterar-rW�S_ISFIFO�st_moderSr<rTrVr�_WINDOWSr>rd�symlink�readlink�open�_HAS_FCOPYFILEr:rZ_COPYFILE_DATAr*rBrFrNrArOr)	r[r\rf�	file_size�ir`�str4r5r$r$r%r	�sD

cCspt�d||�|sFt|�rFtj�|�rFttd�r@tjtj}}qRdSnt	tj
}}||�}||t�|j
��dS)z�Copy mode bits from src to dst.

    If follow_symlinks is not set, symlinks aren't followed if and only
    if both `src` and `dst` are symlinks.  If `lchmod` isn't available
    (e.g. Linux) this method does nothing.

    zshutil.copymode�lchmodN)r?rirdr<rVrcrU�lstatrvra�chmodrW�S_IMODErm)r[r\rfZ	stat_funcZ
chmod_funcrur$r$r%r
!s
�	listxattrcCs�ztj||d�}Wn@tk
rR}z"|jtjtjtjfkr<�WY�dSd}~XYnX|D]j}z&tj|||d�}tj||||d�WqXtk
r�}z |jtj	tjtjtjfkr��W5d}~XYqXXqXdS)z�Copy extended filesystem attributes from `src` to `dst`.

        Overwrite existing attributes.

        If `follow_symlinks` is false, symlinks won't be followed.

        reN)
r<rzr-r1r3ZENODATAr2�getxattr�setxattrZEPERM)r[r\rf�names�er.�valuer$r$r%�
_copyxattr7s	�r�cOsdSr^r$)�args�kwargsr$r$r%r�Osc	
s`t�d||�ddd�dd��|p6t|�o4tj�|�}|rJ�fdd�}n�fdd�}t|tj�rp|j|d	�}n|d
�||d	�}t�	|j
�}|d�||j|jf|d�t
|||d	�z|d�|||d	�Wntk
r�YnXt|d
��r\z|d�||j|d	�WnVtk
�rZ}z6dD]*}tt|��r|jtt|�k�r�qJ�q�W5d}~XYnXdS)a�Copy file metadata

    Copy the permission bits, last access time, last modification time, and
    flags from `src` to `dst`. On Linux, copystat() also copies the "extended
    attributes" where possible. The file contents, owner, and group are
    unaffected. `src` and `dst` are path-like objects or path names given as
    strings.

    If the optional flag `follow_symlinks` is not set, symlinks aren't
    followed if and only if both `src` and `dst` are symlinks.
    zshutil.copystatN)�nsrfcWsdSr^r$)r�rfr�r$r$r%�_nop`szcopystat.<locals>._nopcstt|��Sr^)�getattrr<�r.�r�r$r%�lookupgszcopystat.<locals>.lookupcstt|��}|tjkr|S�Sr^)r�r<�supports_follow_symlinks)r.r`r�r$r%r�ls
rerW�utimerx�st_flagsZchflags)Z
EOPNOTSUPPr3)r?rirdr<rVrcrSrTrWryrm�st_atime_ns�st_mtime_nsr��NotImplementedErrorrUr�r-r1r�)	r[r\rfZfollowr�ru�mode�whyr9r$r�r%rRs4�
cCsBtj�|�r"tj�|tj�|��}t|||d�t|||d�|S)a3Copy data and mode bits ("cp src dst"). Return the file's destination.

    The destination may be a directory.

    If follow_symlinks is false, symlinks won't be followed. This
    resembles GNU's "cp -P src dst".

    If source and destination are the same file, a SameFileError will be
    raised.

    re)r<rV�isdir�join�basenamer	r
�r[r\rfr$r$r%r�s
cCsBtj�|�r"tj�|tj�|��}t|||d�t|||d�|S)a0Copy data and metadata. Return the file's destination.

    Metadata is copied with copystat(). Please see the copystat function
    for more information.

    The destination may be a directory.

    If follow_symlinks is false, symlinks won't be followed. This
    resembles GNU's "cp -P src dst".
    re)r<rVr�r�r�r	rr�r$r$r%r
�s
cs�fdd�}|S)z�Function that can be used as copytree() ignore parameter.

    Patterns is a sequence of glob-style patterns
    that are used to exclude filescs(g}�D]}|�t�||��qt|�Sr^)�extend�fnmatch�filter�set)rVr}�
ignored_names�pattern��patternsr$r%�_ignore_patterns�sz)ignore_patterns.<locals>._ignore_patternsr$)r�r�r$r�r%r�scCs>|dk	r$|t�|�dd�|D��}nt�}tj||d�g}	|tkpJ|tk}
|D�]~}|j|krbqPtj�||j�}tj�||j�}
|
r�|n|}z�|�	�}|r�tjdkr�|j
dd�}|jt
jkr�d}|�r8t�
|�}|r�t�||
�t||
|d�nBtj�|��s|�rWqP|���r,t||
||||d�n
|||
�n*|���rXt||
||||d�n
|||
�WqPtk
�r�}z|	�|jd�W5d}~XYqPtk
�r�}z|	�||
t|�f�W5d}~XYqPXqPzt||�WnJtk
�r*}z*t|d	d�dk�r|	�||t|�f�W5d}~XYnX|	�r:t|	��|S)
NcSsg|]
}|j�qSr$r�)�.0�xr$r$r%�
<listcomp>�sz_copytree.<locals>.<listcomp>)�exist_okrFre)�
dirs_exist_okrZwinerror)r<�fspathr��makedirsr
rr.rVr�rbrW�st_reparse_tag�IO_REPARSE_TAG_MOUNT_POINTrpror�exists�is_dirrrr�r�r-�append�strr�)�entriesr[r\�symlinks�ignore�
copy_function�ignore_dangling_symlinksr�r��errorsZuse_srcentryZsrcentryZsrcnameZdstnameZsrcobjrbrw�linktor9r�r$r$r%�	_copytree�s`




�
� (&r�c	
CsDt�d||�t�|��}t|�}W5QRXt||||||||d�S)aeRecursively copy a directory tree and return the destination directory.

    dirs_exist_ok dictates whether to raise an exception in case dst or any
    missing parent directory already exists.

    If exception(s) occur, an Error is raised with a list of reasons.

    If the optional symlinks flag is true, symbolic links in the
    source tree result in symbolic links in the destination tree; if
    it is false, the contents of the files pointed to by symbolic
    links are copied. If the file pointed by the symlink doesn't
    exist, an exception will be added in the list of errors raised in
    an Error exception at the end of the copy process.

    You can set the optional ignore_dangling_symlinks flag to true if you
    want to silence this exception. Notice that this has no effect on
    platforms that don't support os.symlink.

    The optional ignore argument is a callable. If given, it
    is called with the `src` parameter, which is the directory
    being visited by copytree(), and `names` which is the list of
    `src` contents, as returned by os.listdir():

        callable(src, names) -> ignored_names

    Since copytree() is called recursively, the callable will be
    called once for each directory that is copied. It returns a
    list of names relative to the `src` directory that should
    not be copied.

    The optional copy_function argument is a callable that will be used
    to copy each file. It will be called with the source path and the
    destination path as arguments. By default, copy2() is used, but any
    function that supports the same signature (like copy()) can be used.

    zshutil.copytree)r�r[r\r�r�r�r�r�)r?rir<�scandir�listr�)	r[r\r�r�r�r�r�Zitrr�r$r$r%rs&
��st_file_attributescCsPz4|jdd�}t�|j�o2|jtj@o0|jtjkWStk
rJYdSXdS�NFre)rW�S_ISDIRrmr��FILE_ATTRIBUTE_REPARSE_POINTr�r�r-)�entryrur$r$r%�
_rmtree_isdir6s
�r�cCsLz0t�|�}t�|j�p.|jtj@o.|jtjkWSt	k
rFYdSXdS)NF)
r<rwrW�S_ISLNKrmr�r�r�r�r-)rVrur$r$r%�_rmtree_islink?s

�r�cCs*z|jdd�WStk
r$YdSXdSr�)r�r-)r�r$r$r%r�HscCstj�|�Sr^)r<rVrc)rVr$r$r%r�Nsc	Cs&z"t�|��}t|�}W5QRXWn*tk
rL|tj|t���g}YnX|D]�}|j}t|�r�z|��rvtd��Wn,tk
r�|tjj	|t���YqRYnXt
||�qRzt�|�WqRtk
r�|tj|t���YqRXqRzt�|�Wn(tk
�r |tj|t���YnXdS)N�%Cannot call rmtree on a symbolic link)
r<r�r�r-r?�exc_inforVr�rbrc�_rmtree_unsafe�unlink�rmdir)rV�onerror�
scandir_itr�r��fullnamer$r$r%r�Rs0

r�c
Cs.z"t�|��}t|�}W5QRXWn@tk
rb}z"||_|tj|t���WY�dSd}~XYnX|D�]�}tj�||j	�}z|j
dd�}Wntk
r�d}YnNX|r�z|jdd�}	t�|	j
�}Wn*tk
r�|tj|t���YqhYnX|�r�ztj|j	tj|d�}
Wn(tk
�r:|tj|t���Yn�Xz�tj�|	t�|
���r�t|
||�ztj|j	|d�Wn(tk
�r�|tj|t���YnXn8ztd��Wn*tk
�r�|tjj|t���YnXW5t�|
�Xqhztj|j	|d�Wqhtk
�r&|tj|t���YqhXqhdS)NFre)�dir_fdr�)r<r�r�r-r/r?r�rVr�r.r�rWr�rmrwrq�O_RDONLY�closerQr=�_rmtree_safe_fdr�rcr�)�topfdrVr�r�r�r9r�r�r��orig_st�dirfdr$r$r%r�qsR


r�c	Cs�t�d|�|rdd�}n|dkr*dd�}t�r`t|t�rDt�|�}zt�|�}Wn(tk
rz|tj|t�	��YdSXzt�
|tj�}Wn(tk
r�|tj
|t�	��YdSXz�tj
�|t�|���rt|||�zt�|�Wn(tk
�r|tj|t�	��YnXn8ztd��Wn*tk
�rL|tj
j|t�	��YnXW5t�|�XnNzt|��rttd��Wn,tk
�r�|tj
j|t�	��YdSXt||�SdS)a�Recursively delete a directory tree.

    If ignore_errors is set, errors are ignored; otherwise, if onerror
    is set, it is called to handle the error with arguments (func,
    path, exc_info) where func is platform and implementation dependent;
    path is the argument to that function that caused it to fail; and
    exc_info is a tuple returned by sys.exc_info().  If ignore_errors
    is false and onerror is None, an exception is raised.

    z
shutil.rmtreecWsdSr^r$�r�r$r$r%r��szrmtree.<locals>.onerrorNcWs�dSr^r$r�r$r$r%r��sr�)r?ri�_use_fd_functionsrS�bytesr<�fsdecoderwr,r�rqr�r�rVrQr=r�r�r-rcr�r�)rV�
ignore_errorsr�r��fdr$r$r%r�sJ



cCs&tjjtjjpd}tj�|�|��S)N�)r<rV�sep�altsepr��rstrip)rVr�r$r$r%�	_basename�sr�c	CsTt�d||�|}tj�|�rbt||�r8t�||�dStj�|t|��}tj�	|�rbt
d|��zt�||�Wn�tk
�rNtj�|�r�t�
|�}t�||�t�|�n�tj�|��r6t||�r�t
d||f��t|��st�|tj��st�|��rtjdk�rtd||f��t|||dd�t|�n|||�t�|�YnX|S)	a+Recursively move a file or directory to another location. This is
    similar to the Unix "mv" command. Return the file or directory's
    destination.

    If the destination is a directory or a symlink to a directory, the source
    is moved inside the directory. The destination path must not already
    exist.

    If the destination already exists but is not a directory, it may be
    overwritten depending on os.rename() semantics.

    If the destination is on our current filesystem, then rename() is used.
    Otherwise, src is copied to the destination and then removed. Symlinks are
    recreated under the new name if os.rename() fails because of cross
    filesystem renames.

    The optional `copy_function` argument is a callable that will be used
    to copy the source or it will be delegated to `copytree`.
    By default, copy2() is used, but any function that supports the same
    signature (like copy()) can be used.

    A lot more could be done here...  A look at a mv.c shows a lot of
    the issues this implementation glosses over.

    zshutil.moveNz$Destination path '%s' already existsz.Cannot move a directory '%s' into itself '%s'.�darwinzKCannot move the non-empty directory '%s': Lacking write permission to '%s'.T)r�r�)r?rir<rVr�r]�renamer�r�r�rr-rcrpror��
_destinsrc�
_is_immutable�access�W_OK�listdir�platform�PermissionErrorrr)r[r\r�Zreal_dstr�r$r$r%r�sL


�
�����

cCsVtj�|�}tj�|�}|�tjj�s2|tjj7}|�tjj�sL|tjj7}|�|�Sr^)r<rVrY�endswithr��
startswithrZr$r$r%r�/sr�cCs(t|�}tjtjg}t|d�o&|j|kS)Nr�)rarW�UF_IMMUTABLE�SF_IMMUTABLErUr�)r[ruZimmutable_statesr$r$r%r�8sr�cCsNtdks|dkrdSzt|�}Wntk
r8d}YnX|dk	rJ|dSdS)z"Returns a gid, given a group name.N�)r�KeyError�r.�resultr$r$r%�_get_gid=s
r�cCsNtdks|dkrdSzt|�}Wntk
r8d}YnX|dk	rJ|dSdS)z"Returns an uid, given a user name.Nr�)rr�r�r$r$r%�_get_uidIs
r��gzipcs |dkrd}nDtr |dkr d}n2tr2|dkr2d}n trD|dkrDd}ntd�|���d	dl}	|rfd
|nd}
|d|
}tj�|�}|r�tj�	|�s�|dk	r�|�
d|�|s�t�|�|dk	r�|�
d
�t���t
�������fdd�}
|�s|	�|d|�}z|j||
d�W5|��X|S)a�Create a (possibly compressed) tar file from all the files under
    'base_dir'.

    'compress' must be "gzip" (the default), "bzip2", "xz", or None.

    'owner' and 'group' can be used to define an owner and a group for the
    archive that is being built. If not provided, the current owner and group
    will be used.

    The output tar file will be named 'base_name' +  ".tar", possibly plus
    the appropriate compression extension (".gz", ".bz2", or ".xz").

    Returns the output filename.
    Nr�r�Zgz�bzip2�bz2�xzzCbad value for 'compress', or compression format not supported : {0}r�.�.tar�creating %szCreating tar archivecs,�dk	r�|_�|_�dk	r(�|_�|_|Sr^)�gidZgname�uid�uname)Ztarinfo�r��group�ownerr�r$r%�_set_uid_gid�sz#_make_tarball.<locals>._set_uid_gidzw|%s�r�)�_ZLIB_SUPPORTED�_BZ2_SUPPORTED�_LZMA_SUPPORTED�
ValueErrorrj�tarfiler<rV�dirnamer��infor�r�r�rqr��add)�	base_name�base_dir�compress�verbose�dry_runr�r��loggerZtar_compressionr�Zcompress_extZarchive_name�archive_dirr��tarr$r�r%�
_make_tarballUs>�

	
r	c	Csnddl}|d}tj�|�}|rNtj�|�sN|dk	r@|�d|�|sNt�|�|dk	rd|�d||�|�sj|j|d|jd���}tj�	|�}	|	tj
kr�|�|	|	�|dk	r�|�d|	�t�|�D]�\}
}}t
|�D]:}
tj�	tj�|
|
��}	|�|	|	�|dk	r�|�d|	�q�|D]L}
tj�	tj�|
|
��}	tj�|	��r|�|	|	�|dk	�r|�d|	��qq�W5QRX|S)	z�Create a zip file from all the files under 'base_dir'.

    The output zip file will be named 'base_name' + ".zip".  Returns the
    name of the output zip file.
    rN�.zipr�z#creating '%s' and adding '%s' to it�w)Zcompressionzadding '%s')�zipfiler<rVr�r�r�r��ZipFileZZIP_DEFLATED�normpath�curdirrH�walk�sortedr��isfile)rrrrrrZzip_filenamerZzfrV�dirpathZdirnames�	filenamesr.r$r$r%�
_make_zipfile�sH
��

rr)rNzuncompressed tar file)rr�zgzip'ed tar-fileZgztarzZIP file�zip)rr�zbzip2'ed tar-fileZbztar)rr�zxz'ed tar-fileZxztarcCsdd�t��D�}|��|S)z�Returns a list of supported formats for archiving and unarchiving.

    Each element of the returned sequence is a tuple (name, description)
    cSsg|]\}}||df�qS)r�r$)r�r.�registryr$r$r%r��sz'get_archive_formats.<locals>.<listcomp>)�_ARCHIVE_FORMATS�items�sort�Zformatsr$r$r%r�s
�r�cCst|dkrg}t|�s td|��t|ttf�s6td��|D]&}t|ttf�rXt|�dkr:td��q:|||ft|<dS)auRegisters an archive format.

    name is the name of the format. function is the callable that will be
    used to create archives. If provided, extra_args is a sequence of
    (name, value) tuples that will be passed as arguments to the callable.
    description can be provided to describe the format, and will be returned
    by the get_archive_formats() function.
    NzThe %s object is not callablez!extra_args needs to be a sequencer�z+extra_args elements are : (arg_name, value))�callable�	TypeErrorrS�tupler��lenr)r.�function�
extra_args�descriptionZelementr$r$r%r�s	
cCs
t|=dSr^)rr�r$r$r%r�sc	
Cst�d||||�t��}	|dk	rP|dk	r6|�d|�tj�|�}|sPt�|�|dkr^tj}||d�}
zt	|}Wn"t
k
r�td|�d�YnX|d}|dD]\}
}||
|
<q�|dkr�||
d	<||
d
<z|||f|
�}W5|dk	�r|dk	�r|�d|	�t�|	�X|S)aCreate an archive file (eg. zip or tar).

    'base_name' is the name of the file to create, minus any format-specific
    extension; 'format' is the archive format: one of "zip", "tar", "gztar",
    "bztar", or "xztar".  Or any other registered format.

    'root_dir' is a directory that will be the root directory of the
    archive; ie. we typically chdir into 'root_dir' before creating the
    archive.  'base_dir' is the directory where we start archiving from;
    ie. 'base_dir' will be the common prefix of all files and
    directories in the archive.  'root_dir' and 'base_dir' both default
    to the current directory.  Returns the name of the archive file.

    'owner' and 'group' are used when creating a tar archive. By default,
    uses the current owner and group.
    zshutil.make_archiveNzchanging into '%s')rrzunknown archive format '%s'r�rr�r�zchanging back to '%s')r?rir<�getcwd�debugrVrY�chdirrrr�r�)rrjZroot_dirrrrr�r�rZsave_cwdr��format_info�func�arg�valr/r$r$r%r�s8




cCsdd�t��D�}|��|S)z�Returns a list of supported formats for unpacking.

    Each element of the returned sequence is a tuple
    (name, extensions, description)
    cSs"g|]\}}||d|df�qS)r�r$)r�r.r�r$r$r%r�3sz&get_unpack_formats.<locals>.<listcomp>)�_UNPACK_FORMATSrrrr$r$r%r-s
�c	Csji}t��D]\}}|dD]}|||<qq|D]$}||kr0d}t||||f��q0t|�sftd��dS)z+Checks what gets registered as an unpacker.rz!%s is already registered for "%s"z*The registered function must be a callableN)r,rr)rr)	�
extensionsr r!Zexisting_extensionsr.r��ext�	extension�msgr$r$r%�_check_unpack_options8s�
r1cCs,|dkrg}t|||�||||ft|<dS)aMRegisters an unpack format.

    `name` is the name of the format. `extensions` is a list of extensions
    corresponding to the format.

    `function` is the callable that will be
    used to unpack archives. The callable will receive archives to unpack.
    If it's unable to handle an archive, it needs to raise a ReadError
    exception.

    If provided, `extra_args` is a sequence of
    (name, value) tuples that will be passed as arguments to the callable.
    description can be provided to describe the format, and will be returned
    by the get_unpack_formats() function.
    N)r1r,)r.r-r r!r"r$r$r%rJscCs
t|=dS)z*Removes the pack format from the registry.N)r,r�r$r$r%r`scCs&tj�|�}tj�|�s"t�|�dS)z1Ensure that the parent directory of `path` existsN)r<rVr�r�r�)rVr�r$r$r%�_ensure_directorydsr2c		Cs�ddl}|�|�std|��|�|�}z�|��D]�}|j}|�d�s2d|krPq2tj	j
|f|�d���}|snq2t|�|�
d�s2|�|j�}t|d�}z|�|�W5|��~Xq2W5|��XdS)z+Unpack zip `filename` to `extract_dir`
    rNz%s is not a zip file�/z..rh)rZ
is_zipfiler(r
r�Zinfolistr/r�r<rVr��splitr2r�rPrqrH)	r/�extract_dirrrr�r.�target�data�fr$r$r%�_unpack_zipfilejs*




r9r�cCs\ddl}z|�|�}Wn"|jk
r8td|��YnXz|j||d�W5|��XdS)zAUnpack tar/tar.gz/tar.bz2/tar.xz `filename` to `extract_dir`
    rNz/%s is not a compressed or uncompressed tar filer�)r�rqZTarErrorr(r�Z
extractall)r/r5r�r�Ztarobjr$r$r%�_unpack_tarfile�s�
r:r�r
)rrz.tar.gzz.tgzz.tar.bz2z.tbz2z.tar.xzz.txzcCs:t��D],\}}|dD]}|�|�r|SqqdS)Nr)r,rr�)r/r.r�r/r$r$r%�_find_unpack_format�s

r;cCs�t�d|||�|dkr t��}t�|�}t�|�}|dkrBi}nd|i}|dk	r�zt|}Wn$tk
r�td�|��d�YnX|d}|||ft	|d�|��nRt
|�}|dkr�td�|���t|d}t	t|d�}|�|�|||f|�dS)a]Unpack an archive.

    `filename` is the name of the archive.

    `extract_dir` is the name of the target directory, where the archive
    is unpacked. If not provided, the current working directory is used.

    `format` is the archive format: one of "zip", "tar", "gztar", "bztar",
    or "xztar".  Or any other registered format.  If not provided,
    unpack_archive will use the filename extension and see if an unpacker
    was registered for that extension.

    In case none is found, a ValueError is raised.

    If `filter` is given, it is passed to the underlying
    extraction function.
    zshutil.unpack_archiveNr�zUnknown unpack format '{0}'r#r�zUnknown archive format '{0}')
r?rir<r$r�r,r�r�rj�dictr;r(�update)r/r5rjr�Z
filter_kwargsr'r(r�r$r$r%r�s,


�statvfs�
disk_usageZusageztotal used freezTotal space in byteszUsed space in byteszFree space in bytescCs@t�|�}|j|j}|j|j}|j|j|j}t|||�S)z�Return disk usage statistics about the given path.

        Returned value is a named tuple with attributes 'total', 'used' and
        'free', which are the amount of total, used and free space, in bytes.
        )r<r>�f_bavail�f_frsize�f_blocks�f_bfree�_ntuple_diskusage)rVru�free�total�usedr$r$r%r?�s

cCs"t�|�\}}||}t|||�S)z�Return disk usage statistics about the given path.

        Returned values is a named tuple with attributes 'total', 'used' and
        'free', which are the amount of total, used and free space, in bytes.
        )rZ
_getdiskusagerD)rVrFrErGr$r$r%r?�scCs�t�d|||�|dkr(|dkr(td��|}|}|dkr>d}n(t|t�rft|�}|dkrftd�|���|dkrtd}n(t|t�s�t	|�}|dkr�td�|���t
�|||�dS)z�Change owner user and group of the given path.

    user and group can be the uid/gid or the user/group names, and in that case,
    they are converted to their respective uid/gid.
    zshutil.chownNzuser and/or group must be set���zno such user: {!r}zno such group: {!r})r?rir�rSr�r��LookupErrorrj�intr�r<r)rV�userr�Z_userZ_groupr$r$r%rs$

��P�c
Cs�zttjd�}Wnttfk
r.d}YnXzttjd�}Wnttfk
r^d}YnX|dksp|dkr�zt�tj���}Wn$t	tt
fk
r�t�|�}YnX|dkr�|j}|dkr�|j
}t�||f�S)aGet the size of the terminal window.

    For each of the two dimensions, the environment variable, COLUMNS
    and LINES respectively, is checked. If the variable is defined and
    the value is a positive integer, it is used.

    When COLUMNS or LINES is not defined, which is the common case,
    the terminal connected to sys.__stdout__ is queried
    by invoking os.get_terminal_size.

    If the terminal size cannot be successfully queried, either because
    the system doesn't support querying, or because we are not
    connected to a terminal, the value given in fallback parameter
    is used. Fallback defaults to (80, 24) which is the default
    size used by many terminal emulators.

    The value returned is a named tuple of type os.terminal_size.
    ZCOLUMNSrZLINES)rJr<�environr�r�rr?�
__stdout__r+�AttributeErrorr-�
terminal_size�columns�lines)ZfallbackrSrT�sizer$r$r%r(s$

cCs&tj�|�o$t�||�o$tj�|�Sr^)r<rVr�r�r�)r`r�r$r$r%�
_access_checkYs�rVc
	s�tj���rt�|�r�SdSt�t�}|dkrttj�dd�}|dkrtzt�d�}Wnt	t
fk
rrtj}YnX|s|dS|r�t�|�}|�
t�tj��}nt�|�}|�
tj�}tjdk�rTtj}|r�t�|�}||kr�|�d|�t�d�p�t}dd�|�
tj�D�}|�r d	d�|D�}t�fd
d�|D���r@�g}n�fdd�|D�}n�g}t�}|D]X}	tj�|	�}
|
|k�rd|�|
�|D],}tj�|	|�}t||��r�|S�q��qddS)
a3Given a command, mode, and a PATH string, return the path which
    conforms to the given mode on the PATH, or None if there is no such
    file.

    `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
    of os.environ.get("PATH"), or can be overridden with a custom search
    path.

    N�PATH�CS_PATHZwin32rZPATHEXTcSsg|]}|r|�qSr$r$�r�r.r$r$r%r��szwhich.<locals>.<listcomp>cSsg|]}t�|��qSr$)r<�fsencoderYr$r$r%r��sc3s |]}����|���VqdSr^)�lowerr�rY��cmdr$r%�	<genexpr>�szwhich.<locals>.<genexpr>csg|]}�|�qSr$r$rYr\r$r%r��s)r<rVr�rVrSr�rO�get�confstrrQr��defpathrZr4�pathsepr�r?r�r�insert�getenv�_WIN_DEFAULT_PATHEXT�anyr�rXrr�)
r]r�rVZ	use_bytesrZpathext_sourceZpathext�files�seen�dirZnormdirZthefiler.r$r\r%r^sV







)r)F)FN)r�rrNNN)rrN)Nr�)NNrrNNN)Nr�)NN)NN)rL)jr'r<r?rWr��collectionsr1�zlibr��ImportErrorr�r�Zlzmar��pwdrZgrprr.rnrrrOrUr�r�rBrrre�__all__r-rr rrr(r,r)r*r:rFrNrr]rardr	r
r�rrr
rr�r�stat_resultr�r�r�r�rqr�r��supports_dir_fdr��supports_fdr�r�rZavoids_symlink_attacksr�rr�r�r�r�r	rrrrrrrr1rrr2r9r:r,r;rr��
namedtuplerDrFrGrEr?rrrV�F_OK�X_OKrr$r$r$r%�<module>st






�
@

7B
�
A�
.	
	4�
�
�
>?	�
A
-
����

�
8�
"�
�
�
�2



 
1textwrap.cpython-38.pyc000064400000032321150335716500011060 0ustar00U

e5d�K�@s�dZddlZddddddgZd	ZGd
d�d�Zddd�Zdd
d�Zdd�Ze�dej	�Z
e�dej	�Zdd�Zddd�Z
edkr�eed��dS)zText wrapping and filling.
�N�TextWrapper�wrap�fill�dedent�indent�shortenz	

 c
@s�eZdZdZiZed�ZeD]Zeeee�<qdZ	dZ
de�e�Z
de
dd�Ze�d	e	e
e
ed
�ej�Z[	[
[e�de
�Z[
e�d�Zd&ddd�dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdS)'ra	
    Object for wrapping/filling text.  The public interface consists of
    the wrap() and fill() methods; the other methods are just there for
    subclasses to override in order to tweak the default behaviour.
    If you want to completely replace the main wrapping algorithm,
    you'll probably have to override _wrap_chunks().

    Several instance attributes control various aspects of wrapping:
      width (default: 70)
        the maximum width of wrapped lines (unless break_long_words
        is false)
      initial_indent (default: "")
        string that will be prepended to the first line of wrapped
        output.  Counts towards the line's width.
      subsequent_indent (default: "")
        string that will be prepended to all lines save the first
        of wrapped output; also counts towards each line's width.
      expand_tabs (default: true)
        Expand tabs in input text to spaces before further processing.
        Each tab will become 0 .. 'tabsize' spaces, depending on its position
        in its line.  If false, each tab is treated as a single character.
      tabsize (default: 8)
        Expand tabs in input text to 0 .. 'tabsize' spaces, unless
        'expand_tabs' is false.
      replace_whitespace (default: true)
        Replace all whitespace characters in the input text by spaces
        after tab expansion.  Note that if expand_tabs is false and
        replace_whitespace is true, every tab will be converted to a
        single space!
      fix_sentence_endings (default: false)
        Ensure that sentence-ending punctuation is always followed
        by two spaces.  Off by default because the algorithm is
        (unavoidably) imperfect.
      break_long_words (default: true)
        Break words longer than 'width'.  If false, those words will not
        be broken, and some lines might be longer than 'width'.
      break_on_hyphens (default: true)
        Allow breaking hyphenated words. If true, wrapping will occur
        preferably on whitespaces and right after hyphens part of
        compound words.
      drop_whitespace (default: true)
        Drop leading and trailing whitespace from lines.
      max_lines (default: None)
        Truncate wrapped lines.
      placeholder (default: ' [...]')
        Append to the last line of truncated text.
    � z[\w!"\'&.,?]z[^\d\W]z[%s]z[^�Na�
        ( # any whitespace
          %(ws)s+
        | # em-dash between words
          (?<=%(wp)s) -{2,} (?=\w)
        | # word, possibly hyphenated
          %(nws)s+? (?:
            # hyphenated word
              -(?: (?<=%(lt)s{2}-) | (?<=%(lt)s-%(lt)s-))
              (?= %(lt)s -? %(lt)s)
            | # end of word
              (?=%(ws)s|\Z)
            | # em-dash
              (?<=%(wp)s) (?=-{2,}\w)
            )
        ))Zwp�ltZwsZnwsz(%s+)z[a-z][\.\!\?][\"\']?\Z�F�TF�z [...])�	max_lines�placeholderc
CsL||_||_||_||_||_||_||_||_|	|_|
|_	||_
||_dS�N)�width�initial_indent�subsequent_indent�expand_tabs�replace_whitespace�fix_sentence_endings�break_long_words�drop_whitespace�break_on_hyphens�tabsizerr)
�selfrrrrrrrrrrrr�r� /usr/lib64/python3.8/textwrap.py�__init__sszTextWrapper.__init__cCs(|jr|�|j�}|jr$|�|j�}|S)z�_munge_whitespace(text : string) -> string

        Munge whitespace in text: expand tabs and convert all other
        whitespace characters to spaces.  Eg. " foo\tbar\n\nbaz"
        becomes " foo    bar  baz".
        )r�
expandtabsrr�	translate�unicode_whitespace_trans�r�textrrr�_munge_whitespace�s
zTextWrapper._munge_whitespacecCs6|jdkr|j�|�}n|j�|�}dd�|D�}|S)aN_split(text : string) -> [string]

        Split the text to wrap into indivisible chunks.  Chunks are
        not quite the same as words; see _wrap_chunks() for full
        details.  As an example, the text
          Look, goof-ball -- use the -b option!
        breaks into the following chunks:
          'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ',
          'use', ' ', 'the', ' ', '-b', ' ', 'option!'
        if break_on_hyphens is True, or in:
          'Look,', ' ', 'goof-ball', ' ', '--', ' ',
          'use', ' ', 'the', ' ', '-b', ' ', option!'
        otherwise.
        TcSsg|]}|r|�qSrr)�.0�crrr�
<listcomp>�sz&TextWrapper._split.<locals>.<listcomp>)r�
wordsep_re�split�wordsep_simple_re�rr#�chunksrrr�_split�s

zTextWrapper._splitcCs\d}|jj}|t|�dkrX||ddkrN|||�rNd||d<|d7}q|d7}qdS)ag_fix_sentence_endings(chunks : [string])

        Correct for sentence endings buried in 'chunks'.  Eg. when the
        original text contains "... foo.\nBar ...", munge_whitespace()
        and split() will convert that to [..., "foo.", " ", "Bar", ...]
        which has one too few spaces; this method simply changes the one
        space to two.
        rr	rz  �N)�sentence_end_re�search�len)rr,�iZ	patsearchrrr�_fix_sentence_endings�s	
z!TextWrapper._fix_sentence_endingscCs^|dkrd}n||}|jrH|�|dd|��|d|d�|d<n|sZ|�|���dS)a
_handle_long_word(chunks : [string],
                             cur_line : [string],
                             cur_len : int, width : int)

        Handle a chunk of text (most likely a word, not whitespace) that
        is too long to fit in any line.
        r	���N)r�append�pop)rZreversed_chunks�cur_line�cur_lenrZ
space_leftrrr�_handle_long_word�s
zTextWrapper._handle_long_wordc	Cs�g}|jdkrtd|j��|jdk	rb|jdkr8|j}n|j}t|�t|j���|jkrbtd��|��|�r�g}d}|r�|j}n|j}|jt|�}|j	r�|d�
�dkr�|r�|d=|r�t|d�}|||kr�|�|���||7}q�q�q�|�r&t|d�|k�r&|�
||||�ttt|��}|j	�r\|�r\|d�
�dk�r\|t|d�8}|d=|rj|jdk�s�t|�d|jk�s�|�r�|j	�r�t|�dk�r�|d�
��s�||k�r�|�|d�|��qj|�r0|d�
��r|t|j�|k�r|�|j�|�|d�|���q�|t|d�8}|d=�q�|�rn|d��}t|�t|j�|jk�rn||j|d<�q�|�||j����q�qj|S)a�_wrap_chunks(chunks : [string]) -> [string]

        Wrap a sequence of text chunks and return a list of lines of
        length 'self.width' or less.  (If 'break_long_words' is false,
        some lines may be longer than this.)  Chunks correspond roughly
        to words and the whitespace between them: each chunk is
        indivisible (modulo 'break_long_words'), but a line break can
        come between any two chunks.  Chunks should not have internal
        whitespace; ie. a chunk is either all whitespace or a "word".
        Whitespace chunks will be removed from the beginning and end of
        lines, but apart from that whitespace is preserved.
        rzinvalid width %r (must be > 0)Nr	z#placeholder too large for max widthr4r)r�
ValueErrorrrrr1r�lstrip�reverser�stripr5r6r9�sum�map�join�rstrip)	rr,�linesrr7r8r�lZ	prev_linerrr�_wrap_chunks�s�




 ���
�
���
�zTextWrapper._wrap_chunkscCs|�|�}|�|�Sr)r$r-r"rrr�
_split_chunksPs
zTextWrapper._split_chunkscCs$|�|�}|jr|�|�|�|�S)a^wrap(text : string) -> [string]

        Reformat the single paragraph in 'text' so it fits in lines of
        no more than 'self.width' columns, and return a list of wrapped
        lines.  Tabs in 'text' are expanded with string.expandtabs(),
        and all other whitespace characters (including newline) are
        converted to space.
        )rErr3rDr+rrrrVs	

zTextWrapper.wrapcCsd�|�|��S)z�fill(text : string) -> string

        Reformat the single paragraph in 'text' to fit in lines of no
        more than 'self.width' columns, and return a new string
        containing the entire wrapped paragraph.
        �
)r@rr"rrrrdszTextWrapper.fill)
rrrTTFTTTr
)�__name__�
__module__�__qualname__�__doc__r!�ordZuspace�_whitespace�xZ
word_punctZletter�re�escapeZ
whitespaceZnowhitespace�compile�VERBOSEr(r*r/rr$r-r3r9rDrErrrrrrrsV0���
��!grcKstfd|i|��}|�|�S)a�Wrap a single paragraph of text, returning a list of wrapped lines.

    Reformat the single paragraph in 'text' so it fits in lines of no
    more than 'width' columns, and return a list of wrapped lines.  By
    default, tabs in 'text' are expanded with string.expandtabs(), and
    all other whitespace characters (including newline) are converted to
    space.  See TextWrapper class for available keyword args to customize
    wrapping behaviour.
    r)rr�r#r�kwargs�wrrrrps
cKstfd|i|��}|�|�S)a�Fill a single paragraph of text, returning a new string.

    Reformat the single paragraph in 'text' to fit in lines of no more
    than 'width' columns, and return a new string containing the entire
    wrapped paragraph.  As with wrap(), tabs are expanded and other
    whitespace characters converted to space.  See TextWrapper class for
    available keyword args to customize wrapping behaviour.
    r)rrrRrrrr}s	cKs,tf|dd�|��}|�d�|������S)a�Collapse and truncate the given text to fit in the given width.

    The text first has its whitespace collapsed.  If it then fits in
    the *width*, it is returned as is.  Otherwise, as many words
    as possible are joined and then the placeholder is appended::

        >>> textwrap.shorten("Hello  world!", width=12)
        'Hello world!'
        >>> textwrap.shorten("Hello  world!", width=11)
        'Hello [...]'
    r	)rrr)rrr@r=r)rRrrrr�sz^[ 	]+$z(^[ 	]*)(?:[^ 	
])cCs�d}t�d|�}t�|�}|D]b}|dkr0|}q|�|�r<q|�|�rL|}qtt||��D]$\}\}}||krZ|d|�}qqZqdr�|r�|�d�D]"}|r�|�|�s�td||f��q�|r�t	�d|d|�}|S)a�Remove any common leading whitespace from every line in `text`.

    This can be used to make triple-quoted strings line up with the left
    edge of the display, while still presenting them in the source code
    in indented form.

    Note that tabs and spaces are both treated as whitespace, but they
    are not equal: the lines "  hello" and "\thello" are
    considered to have no common leading whitespace.

    Entirely blank lines are normalized to a newline character.
    NrrrFzline = %r, margin = %rz(?m)^)
�_whitespace_only_re�sub�_leading_whitespace_re�findall�
startswith�	enumerate�zipr)�AssertionErrorrN)r#Zmargin�indentsrr2rM�y�linerrrr�s,



�cs,�dkrdd�����fdd�}d�|��S)aFAdds 'prefix' to the beginning of selected lines in 'text'.

    If 'predicate' is provided, 'prefix' will only be added to the lines
    where 'predicate(line)' is True. If 'predicate' is not provided,
    it will default to adding 'prefix' to all non-empty lines that do not
    consist solely of whitespace characters.
    NcSs|��Sr)r=�r_rrr�	predicate�szindent.<locals>.predicatec3s*��d�D]}�|�r�|n|Vq
dS)NT)�
splitlinesr`�ra�prefixr#rr�prefixed_lines�szindent.<locals>.prefixed_linesr)r@)r#rdrarerrcrr�s�__main__z Hello there.
  This is indented.)r)r)N)rJrN�__all__rLrrrrrP�	MULTILINErUrWrrrG�printrrrr�<module>sa

3
platform.cpython-38.opt-1.pyc000064400000057410150335716500011773 0ustar00U

e5d��@sldZdZdZddlZddlZddlZddlZddddddd	d	d
d
d�
Ze�d�Z	d
d�Z
e�dej�Zdwdd�Z
dxdd�Ze�d�Zdydd�Zddddddd d!d"d#d$d%�Zdd&d'd(d)d*d+�Zd,d-�Zd.d/�Zdzd0d1�Zd2d3�Zd{d5d6�Zd7d8�Zd|d9d:�Zd;d<�Zd=d>�Zd}d?d@�ZdAdB�Zd~dCdD�ZddEdF�ZdGdHdId�Z ej!ddfdJdK�Z"e�#dLdM�Z$da%dNdO�Z&dPdQ�Z'dRdS�Z(dTdU�Z)dVdW�Z*dXdY�Z+dZd[�Z,e�d\ej�Z-e�d]ej�Z.e�d^�Z/e�d_�Z0iZ1d�d`da�Z2dbdc�Z3ddde�Z4dfdg�Z5dhdi�Z6djdk�Z7dldm�Z8dndo�Z9iZ:d�dpdq�Z;e<drk�rhdsej=k�p8dtej=kZ>duej=k�oNdvej=kZ?e@e;e?e>��e�Ad�dS)�a8 This module tries to retrieve as much platform-identifying data as
    possible. It makes this information available via function APIs.

    If called from the command line, it prints the platform
    information concatenated as single string to stdout. The output
    format is useable as part of a filename.

a
    Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
    Copyright (c) 2000-2010, eGenix.com Software GmbH; mailto:info@egenix.com

    Permission to use, copy, modify, and distribute this software and its
    documentation for any purpose and without fee or royalty is hereby granted,
    provided that the above copyright notice appear in all copies and that
    both that copyright notice and this permission notice appear in
    supporting documentation or portions thereof, including modifications,
    that you make.

    EGENIX.COM SOFTWARE GMBH DISCLAIMS ALL WARRANTIES WITH REGARD TO
    THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
    FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
    INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
    FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
    NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
    WITH THE USE OR PERFORMANCE OF THIS SOFTWARE !

z1.0.8�N�
���(�2��)
ZdevZalpha�aZbeta�b�cZRCZrc�pl�pz([0-9]+|[._+-])c	Csbg}t�|�D]N}|dkrzt|d�}d}Wn tk
rLt�|d�}YnX|�||f�q|S)Nz._+-r�dr)�
_component_re�split�int�
ValueError�_ver_stages�get�extend)�version�result�v�t�r� /usr/lib64/python3.8/platform.py�_comparable_version�s
rsC(__libc_init)|(GLIBC_([0-9.]+))|(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)��@c
Cs�|dkrZz0t�d�}|jdd�}t|�dkr6t|�WSWntttfk
rRYnXtj	}t
}ttjd�rvtj�
|�}t|d���`}|�|�}d}	|	t|�k�r�d	|ks�d
|kr�t�||	�}
nd}
|
r�|
��t|�k�r|�|�}|�r|t|	t|�d�d�|}d}	q�|
�s�q�dd
�|
��D�\}}
}}}}|�rF|�sFd}n�|
�rx|dk�r`d}|}n||�||�k�r�|}n\|�r�|dk�r�d}|�r�|�r�||�||�k�r�|}|�r�|t|�d�|k�r�||}|
��}	q�W5QRX||fS)a Tries to determine the libc version that the file executable
        (which defaults to the Python interpreter) is linked against.

        Returns a tuple of strings (lib,version) which default to the
        given parameters in case the lookup fails.

        Note that the function has intimate knowledge of how different
        libc versions add symbols to the executable and thus is probably
        only useable for executables compiled using gcc.

        The file is read and scanned in chunks of chunksize bytes.

    N�CS_GNU_LIBC_VERSION�)�maxsplit��realpath�rbrslibcsGLIBCi�cSs"g|]}|dk	r|�d�n|�qS)N�latin1)�decode)�.0�srrr�
<listcomp>�s�zlibc_ver.<locals>.<listcomp>Zlibc�glibc)�os�confstrr�len�tuple�AttributeErrorr�OSError�sys�
executabler�hasattr�pathr"�open�read�_libc_search�search�end�max�groups)r1�librZ	chunksize�ver�parts�V�fZbinary�pos�m�chunkZlibcinitr)ZglibcversionZsoZthreadsZ	soversionrrr�libc_ver�s^


�

rCcCs`|�d�}|r|�|�zttttt|���}Wntk
rH|}YnXd�|dd��}|S)z� Normalize the version and build strings and return a single
        version string using the format major.minor.build (or patchlevel).
    �.N�)r�append�list�map�strrr�join)r�build�lZstringsrrr�
_norm_version�s


rMz'(?:([\w ]+) ([\w.]+) .*\[.* ([\d.]+)\])��win32�win16�dosc	Cs�tj|kr|||fSddl}dD]R}z|j||jddd�}Wn0t|jfk
rl}zWY�q W5d}~XYq Xq~q |||fS|��}t�	|�}|dk	r�|�
�\}}}|ddkr�|dd�}|ddkr�|dd�}t|�}|||fS)a+ Tries to figure out the OS version used and returns
        a tuple (system, release, version).

        It uses the "ver" shell command for this which is known
        to exists on Windows, DOS. XXX Others too ?

        In case this fails, the given parameters are used as
        defaults.

    rN)r<zcommand /c verz
cmd /c verT)�stderr�text�shell���rD)r0�platform�
subprocess�check_output�DEVNULLr/�CalledProcessError�strip�_ver_output�matchr:rM)	�system�releaserZsupported_platformsrW�cmd�infoZwhyrArrr�_syscmd_vers0

�


rbZ2000ZXPZ
2003ServerZpost2003�Vista�7�8z8.1zpost8.1Z10Zpost10))�r)rfr�rfr!)rfN��r�rir�rir!�rirE�riN)rr)rNZ
2008ServerZ2008ServerR2Z
2012ServerZ2012ServerR2Zpost2012ServerR2)rgrhrjrkrlrmcCs
t�dkS)N)ZIoTUAPZ
NanoServerZWindowsCoreHeadlessZ	IoTEdgeOS)�
win32_editionrrrr�win32_is_iotOsroc
Cs�z.zddl}Wntk
r*ddl}YnXWntk
rBYnTXz<d}|�|j|�� }|�|d�dW5QR�WSQRXWntk
r�YnXdS)Nr�,SOFTWARE\Microsoft\Windows NT\CurrentVersionZ	EditionId)�winreg�ImportError�_winreg�	OpenKeyEx�HKEY_LOCAL_MACHINE�QueryValueExr/)rq�cvkey�keyrrrrnRs(rnc	Cs�zddlm}Wn tk
r0||||fYSX|�}z ttt�d�d��\}}}Wn,tk
r�|jpx|dd�\}}}YnXd�	|||�}t
�||f�p�t
�|df�p�|}|dd�||fk�rzd�	|j�}Wn8t
k
�r|dd�d	k�rd
|dd�}YnXt|dd�dk�rJt�||f��pHt�|df��pH|}z0zddl}	Wntk
�rvddl}	YnXWntk
�r�YnLXz2d}
|	�|	j|
��}|	�|d
�d}W5QRXWntk
�r�YnX||||fS)Nr)�getwindowsversionr!rDrEz{0}.{1}.{2}zSP{}�
z
Service Pack ZSPZproduct_typerpZCurrentType)r0ryrrrHrrbrrZplatform_version�format�_WIN32_CLIENT_RELEASESrZservice_pack_majorr.�getattr�_WIN32_SERVER_RELEASESrqrsrtrurvr/)r_r�csd�ptyperyZwinver�major�minorrKrqrwrxrrr�	win32_verdsR ����r�c	Cs�d}tj�|�sdSzddl}Wntk
r6YdSXt|d��}|�|�}W5QRX|d}d}t��j}|dkrzd}|||fS)Nz0/System/Library/CoreServices/SystemVersion.plistrr#ZProductVersion�rrr)ZppczPower MacintoshZPowerPC)	r*r3�exists�plistlibrrr4�load�uname�machine)�fnr�r?rr_�versioninfor�rrr�_mac_ver_xml�s
r�r�cCst�}|dk	r|S|||fS)a< Get macOS version information and return it as tuple (release,
        versioninfo, machine) with versioninfo being a tuple (version,
        dev_stage, non_release_version).

        Entries which cannot be determined are set to the parameter values
        which default to ''. All tuple entries are strings.
    N)r�)r_r�r�rarrr�mac_ver�sr�cCsHddlm}z|�|�}|dkr&|WS|WStk
rB|YSXdS)Nr)�System)�	java.langr�ZgetPropertyr.)�name�defaultr��valuerrr�
_java_getprop�s
r�cCs�zddl}Wn tk
r,||||fYSXtd|�}td|�}|\}}}td|�}td|�}td|�}|||f}|\}}	}
td|
�}
td	|�}td
|	�}	||	|
f}||||fS)a] Version interface for Jython.

        Returns a tuple (release, vendor, vminfo, osinfo) with vminfo being
        a tuple (vm_name, vm_release, vm_vendor) and osinfo being a
        tuple (os_name, os_version, os_arch).

        Values which cannot be determined are set to the defaults
        given as parameters (which all default to '').

    rNzjava.vendorzjava.versionzjava.vm.namezjava.vm.vendorzjava.vm.versionzjava.os.archzjava.os.namezjava.os.version)r�rrr�)r_�vendor�vminfo�osinfo�javaZvm_nameZ
vm_releaseZ	vm_vendor�os_name�
os_version�os_archrrr�java_ver�s"












r�cCs�|dkr�|dkr|||fS|�d�}|rlzt|d�}Wntk
rLYn X|d}t|�|d<d�|�}|dkrzd}q�d}n,|dkr�d	}|r�|d
}q�d}n|dkr�d
}|||fS)z� Returns (system, release, version) aliased to common
        marketing names used for some systems.

        It also does some reordering of the information in some cases
        where it would otherwise cause confusion.

    ZSunOS�5rDrrE�6ZSolarisZIRIX64ZIRIXz (64bit)�64bit�rOrP�Windows)rrrrIrJ)r^r_rrLr�rrr�system_alias�s.	



r�cGs�d�dd�tt|�D��}|�dd�}|�dd�}|�dd�}|�dd�}|�d	d�}|�d
d�}|�dd�}|�dd�}|�d
d�}|�dd�}||kr�q�|}q�|ddkr�|dd�}q�|S)zq Helper to format the platform string in a filename
        compatible format e.g. "system-version-machine".
    �-css|]}|��VqdS)N)r[)r&�xrrr�	<genexpr>(sz_platform.<locals>.<genexpr>� �_�/�\�:�;�"�(�)�unknownrz--rUN)rJ�filterr,�replace)�argsrVZcleanedrrr�	_platform"s"r�cCsNzddl}Wntk
r$|YSXz
|��WStk
rH|YSXdS)z8 Helper to determine the node name of this machine.
    rN)�socketrrZgethostnamer/)r�r�rrr�_nodeBs

r�cCsBtj�|�}tj�|�r>tj�tj�tj�|�t�|���}q|S)zT In case filepath is a symlink, follow it until a
        real file is reached.
    )r*r3�abspath�islink�normpathrJ�dirname�readlink)�filepathrrr�_follow_symlinksQs�r�c	Cs\tjdkr|Sddl}z|jd|f|jdd�}Wnt|jfk
rN|YSX|��pZ|S)z. Interface to the system's uname command.
    �rQrOrPrNr�T)rRrS)r0rVrWrXrYr/rZr[)Zoptionr�rW�outputrrr�
_syscmd_uname\s

�

r�c	Csztjdkr|Sddl}t|�}ttjdd�}z|jdd|g|j|d�}Wnt	|j
fk
rf|YSX|sp|S|�d	�S)
z� Interface to the system's file command.

        The function uses the -b option of the file command to have it
        omit the filename in its output. Follow the symlinks. It returns
        default in case the command should fail.

    r�rN�C)�LC_ALL�filez-b)rR�envzlatin-1)r0rVrWr��dictr*�environrXrYr/rZr%)�targetr�rWr�r�rrr�_syscmd_filems	
�

r�)r�	WindowsPE)rr�)r�MSDOScCs|s&ddl}|�d�}t|d�d}|r6t|d�}nd}|sx|tjkrxtjtkrpttj\}}|rh|}|rp|}||fSd|kr�d|kr�||fSd	|kr�d
}nd|kr�d}nd
|kr�d}d|kr�d}n8d|kr�d|kr�d}q�d}nd|kr�d}nd|kr�d}n||fS)a� Queries the given executable (defaults to the Python interpreter
        binary) for various architecture information.

        Returns a tuple (bits, linkage) which contains information about
        the bit architecture and the linkage format used for the
        executable. Both values are returned as strings.

        Values that cannot be determined are returned as given by the
        parameter presets. If bits is given as '', the sizeof(pointer)
        (or sizeof(long) on Python version < 1.5.2) is used as
        indicator for the supported pointer size.

        The function relies on the system's "file" command to do the
        actual work. This is available on most if not all Unix
        platforms. On some non-Unix platforms where the "file" command
        does not exist and the executable is set to the Python interpreter
        binary defaults from _default_architecture are used.

    rN�P��bitrr1z
shared objectz32-bit�32bitZN32Zn32bitz64-bitr�ZELFZPEr�r�ZCOFFzMS-DOSr�)�structZcalcsizerIr�r0r1rV�_default_architecture)r1�bits�linkager��sizeZfileoutr	rLrrr�architecture�sH
�
r��uname_resultz-system node release version machine processorcCs�d}tdk	rtSd}zt��\}}}}}Wntk
rBd}YnX|sbttd|||||f���s�|r~tj}d}d}t�}d}d}|dkr�t	�\}}}}	|r�|r�d}|s�dtj
kr�tj
�dd�}ntj
�dd�}|s�tj
�d|�}|�r:t|�\}}}|d	k�rd
}n4|dk�r:|d
k�r:d
}d|dd
�k�r6d}nd}|dk�rd|�s^|dk�rZd}nd}d
}n8|dd�dk�r�t
�\}}
}}d}d�|�}|�s�|
}|dk�r|�r�|dk�r�|}d}zddl}
Wntk
�r�Yn&X|
�dd�\}}|dk�rd}nd}|�stdd�}|dk�r$d}|dk�r2d}|dk�r@d}|dk�rNd}|dk�r\d}|dk�rjd}|dk�r�|d
k�r�d
}d}t||||||�atS)an Fairly portable uname interface. Returns a tuple
        of strings (system, node, release, version, machine, processor)
        identifying the underlying platform.

        Note that unlike the os.uname function this also returns
        possible processor information as an additional tuple entry.

        Entries which cannot be determined are set to ''.

    rNrrrOZPROCESSOR_ARCHITEW6432ZPROCESSOR_ARCHITECTUREZPROCESSOR_IDENTIFIERzMicrosoft Windowsr�Z	Microsoftz6.0rErcr�r�Z16bit�r��Javaz, ZOpenVMS�0zSYI$_CPU�ZAlphaZVAXz-pr�)�_uname_cacher*r�r.rGr�r0rVr�r�r�rrbr�rJ�vms_librrZgetsyir�r�)Zno_os_uname�	processorr^�noder_rr�Zuse_syscmd_verrr�r�r�r�r�ZcsidZ
cpu_numberrrrr��s�
















�r�cCst�jS)z� Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'.

        An empty string is returned if the value cannot be determined.

    )r�r^rrrrr^usr^cCst�jS)z� Returns the computer's network name (which may not be fully
        qualified)

        An empty string is returned if the value cannot be determined.

    )r�r�rrrrr�~sr�cCst�jS)z� Returns the system's release, e.g. '2.2.0' or 'NT'

        An empty string is returned if the value cannot be determined.

    )r�r_rrrrr_�sr_cCst�jS)z� Returns the system's release version, e.g. '#3 on degas'

        An empty string is returned if the value cannot be determined.

    )r�rrrrrr�srcCst�jS)zt Returns the machine type, e.g. 'i386'

        An empty string is returned if the value cannot be determined.

    )r�r�rrrrr��sr�cCst�jS)a Returns the (true) processor name, e.g. 'amdk6'

        An empty string is returned if the value cannot be
        determined. Note that many platforms do not provide this
        information or simply return the same value as for machine(),
        e.g.  NetBSD does this.

    )r�r�rrrrr��s
r�zL([\w.+]+)\s*\(#?([^,]+)(?:,\s*([\w ]*)(?:,\s*([\w :]*))?)?\)\s*\[([^\]]+)\]?z;IronPython\s*([\d\.]+)(?: \(([\d\.]+)\))? on (.NET [\d\.]+)zU([\d.]+)\s*\(IronPython\s*[\d.]+\s*\(([\d.]+)\) on ([\w.]+ [\d.]+(?: \(\d+-bit\))?)\)zE([\w.+]+)\s*\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*\[PyPy [^\]]+\]?cCs|dkrtj}t�|d�}|dk	r&|Sd|kr�d}|�d�rHt�|�}n
t�|�}|dkrjtdt	|���|�
�\}}}d}d}n�tj�d�r�d}t�|�}|dkr�tdt	|���|�
�\}}}}	}
|dkr�d}tj}n�d|k�r"d}t
�|�}|dk�rtd	t	|���|�
�\}}}}	d}n\t�|�}|dk�rFtd
t	|���|�
�\}}}}	}d}|dk�rld}n|	�r~|d|	}ttd
��r�tj\}
}}n"ttd��r�tj\}
}}nd}d}|�d�}
t|
�dk�r�|
�d�d�|
�}|||||||f}|t|<|S)a� Returns a parsed version of Python's sys.version as tuple
        (name, version, branch, revision, buildno, builddate, compiler)
        referring to the Python implementation name, version, branch,
        revision, build number, build date/time as string and the compiler
        identification string.

        Note that unlike the Python sys.version, the returned value
        for the Python version will always include the patchlevel (it
        defaults to '.0').

        The function returns empty strings for tuple entries that
        cannot be determined.

        sys_version may be given to parse an alternative version
        string, e.g. if the version was read from a different Python
        interpreter.

    NZ
IronPythonz*failed to parse IronPython sys.version: %srr�ZJythonz&failed to parse Jython sys.version: %sZPyPyz$failed to parse PyPy sys.version: %sz'failed to parse CPython sys.version: %sZCPythonr��_git�
_mercurialrDr!r�)r0r�_sys_version_cacher�
startswith�_ironpython_sys_version_parserr]� _ironpython26_sys_version_parserr�reprr:rV�_sys_version_parser�_pypy_sys_version_parserr2r�r�rr,rFrJ)�sys_versionrr�r]rZalt_versionZcompilerZbuildnoZ	builddateZ	buildtimer��branchZrevisionrLrrr�_sys_version�s�

��
��


�

���



r�cCs
t�dS)aR Returns a string identifying the Python implementation.

        Currently, the following implementations are identified:
          'CPython' (C implementation of Python),
          'IronPython' (.NET implementation of Python),
          'Jython' (Java implementation of Python),
          'PyPy' (Python implementation of Python).

    r�r�rrrr�python_implementation5sr�cCs
t�dS)z� Returns the Python version as string 'major.minor.patchlevel'

        Note that unlike the Python sys.version, the returned value
        will always include the patchlevel (it defaults to 0).

    rr�rrrr�python_versionBsr�cCstt�d�d��S)z� Returns the Python version as tuple (major, minor, patchlevel)
        of strings.

        Note that unlike the Python sys.version, the returned value
        will always include the patchlevel (it defaults to 0).

    rrD)r-r�rrrrr�python_version_tupleLs	r�cCs
t�dS)z� Returns a string identifying the Python implementation
        branch.

        For CPython this is the SCM branch from which the
        Python binary was built.

        If not available, an empty string is returned.

    r!r�rrrr�
python_branchWsr�cCs
t�dS)z� Returns a string identifying the Python implementation
        revision.

        For CPython this is the SCM revision from which the
        Python binary was built.

        If not available, an empty string is returned.

    rEr�rrrr�python_revisionesr�cCst�dd�S)zh Returns a tuple (buildno, builddate) stating the Python
        build number and date as strings.

    r�rir�rrrr�python_buildrsr�cCs
t�dS)zS Returns a string identifying the compiler used for compiling
        Python.

    rir�rrrr�python_compilerzsr�cCsbt�||fd�}|dk	r|St�\}}}}}}||kr:d}|rPt|||�\}}}|dkrnt�d}	|	rnd}|	}|dkr�t|�\}
}}}
|r�t||�}nt||||�}n�|dkr�ttj	�\}}t||||d||�}n~|d	k�r t
�\}}}\}}}|s�|�s
t|||�}nt|||d
|||�}n2|�r2t||�}n ttj	�\}}t||||||�}|t||f<|S)a� Returns a single string identifying the underlying platform
        with as much useful information as possible (but no more :).

        The output is intended to be human readable rather than
        machine parseable. It may look different on different
        platforms and this is intended.

        If "aliased" is true, the function will use aliases for
        various platforms that report system names which differ from
        their common names, e.g. SunOS will be reported as
        Solaris. The system_alias() function is used to implement
        this.

        Setting terse to true causes the function to return only the
        absolute minimum information needed to identify the platform.

    NrZDarwinrZmacOSr�)ZLinux�withr�Zon)�_platform_cacherr�r�r�r�r�rCr0r1r�r�)�aliased�terserr^r�r_rr�r�Z
macos_releaseZrelZversrr�rVZlibcnameZlibcversion�rrr�r�r�r�r�r�rrrrV�sX

�

��rV�__main__r�z--terseZ
nonaliasedz--nonaliased)Nrrr)r)rrrrN)rrrr)rr�r)rrr�r�)r)r)r)N)rr)B�__doc__Z
__copyright__�__version__�collectionsr*�rer0r�compilerr�ASCIIr6rCrMr\rbr|r~rornr�r�r�r�r�r�r�r�r�r�r�r�r1r��
namedtupler�r�r�r^r�r_rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rV�__name__�argvr�r��print�exitrrrr�<module>s�Y
�
�
G


�
1��

3

#4 


$�P�	
			����
h




L
dataclasses.cpython-38.opt-2.pyc000064400000047367150335716500012451 0ustar00U

e5d5��@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZdddddddd	d
ddd
gZ	Gdd�de
�ZGdd�d�Ze�Z
Gdd�d�Ze�Ze�i�ZGdd�d�Zed�Zed�Zed�ZdZdZdZe�d�ZGdd�de�ZGdd�ded�ZGd d�d�ZGd!d"�d"�Zeed#d#dd#dd$�d%d�Z d&d'�Z!d(d)�Z"dded*�d+d,�Z#d-d.�Z$d/d0�Z%d1d2�Z&d3d4�Z'd5d6�Z(d7d8�Z)d9d:�Z*d;d<�Z+d=d>�Z,d?d@�Z-dAdB�Z.dCdD�Z/dEdF�Z0dGdH�Z1dIdJ�Z2dKdL�Z3dddde1de2de2e3e2e3e2e3e2e3dM�Z4dNdO�Z5ddd#d#d#dPdPdPdQ�dRd�Z6dSd�Z7dTdU�Z8dVd
�Z9e:dW�dXd	�Z;dYdZ�Z<e=d[�d\d
�Z>d]d^�Z?d_dd#d#d#dPdPdPd`�dad�Z@dbd�ZAdceA_BdS)e�N�	dataclass�field�Field�FrozenInstanceError�InitVar�MISSING�fields�asdict�astuple�make_dataclass�replace�is_dataclassc@seZdZdS)rN��__name__�
__module__�__qualname__�rr�#/usr/lib64/python3.8/dataclasses.pyr�sc@seZdZdd�ZdS)�_HAS_DEFAULT_FACTORY_CLASScCsdS)Nz	<factory>r��selfrrr�__repr__�sz#_HAS_DEFAULT_FACTORY_CLASS.__repr__N)rrrrrrrrr�src@seZdZdS)�
_MISSING_TYPENrrrrrr�src@seZdZdd�Zdd�ZdS)�_FIELD_BASEcCs
||_dS�N��name�rrrrr�__init__�sz_FIELD_BASE.__init__cCs|jSrrrrrrr�sz_FIELD_BASE.__repr__N)rrrrrrrrrr�sr�_FIELD�_FIELD_CLASSVAR�_FIELD_INITVARZ__dataclass_fields__Z__dataclass_params__Z
__post_init__z^(?:\s*(\w+)\s*\.)?\s*(\w+)c@seZdZdd�ZdS)�_InitVarMetacCst|�Sr)r)rZparamsrrr�__getitem__�sz_InitVarMeta.__getitem__N)rrrr#rrrrr"�sr"c@s eZdZdZdd�Zdd�ZdS)r��typecCs
||_dSrr$)rr%rrrr�szInitVar.__init__cCs,t|jt�r|jj}n
t|j�}d|�d�S)Nzdataclasses.InitVar[�])�
isinstancer%r�repr)rZ	type_namerrrr�s

zInitVar.__repr__N�rrr�	__slots__rrrrrrr�s)�	metaclassc@s(eZdZdZdd�Zdd�Zdd�ZdS)	r)
rr%�default�default_factoryr(�hash�init�compare�metadata�_field_typecCsRd|_d|_||_||_||_||_||_||_|dkr<tnt	�
|�|_d|_dSr)
rr%r,r-r/r(r.r0�_EMPTY_METADATA�types�MappingProxyTyper1r2)rr,r-r/r(r.r0r1rrrr�s��zField.__init__cCsVd|j�d|j�d|j�d|j�d|j�d|j�d|j�d|j�d	|j�d
|j	�d�S)NzField(name=z,type=z	,default=z,default_factory=z,init=�,repr=z,hash=z	,compare=z
,metadata=z
,_field_type=�))
rr%r,r-r/r(r.r0r1r2rrrrrszField.__repr__cCs(tt|j�dd�}|r$||j||�dS)N�__set_name__)�getattrr%r,)r�ownerr�funcrrrr8szField.__set_name__N)rrrr*rrr8rrrrr�sc@s eZdZdZdd�Zdd�ZdS)�_DataclassParams�r/r(�eq�order�unsafe_hash�frozencCs(||_||_||_||_||_||_dSrr=)rr/r(r>r?r@rArrrr*sz_DataclassParams.__init__c
Cs6d|j�d|j�d|j�d|j�d|j�d|j�d�
S)Nz_DataclassParams(init=r6z,eq=z,order=z
,unsafe_hash=z,frozen=r7r=rrrrr2sz_DataclassParams.__repr__Nr)rrrrr<!sr<T�r,r-r/r(r.r0r1cCs,|tk	r|tk	rtd��t|||||||�S)Nz/cannot specify both default and default_factory)r�
ValueErrorrrBrrrr@s
�cs(|sdSdd��fdd�|D���d�S)N�()�(�,csg|]}��d|j���qS)�.r��.0�f��obj_namerr�
<listcomp>_sz_tuple_str.<locals>.<listcomp>�,))�join)rLrrrKr�
_tuple_strVsrPcs"t��t�����fdd��}|S)Nc	sDt|�t��f}|�krdS��|�z�|�}W5��|�X|S)Nz...)�id�_thread�	get_ident�add�discard)r�key�result��repr_running�
user_functionrr�wrapperis
z _recursive_repr.<locals>.wrapper)�set�	functools�wraps)rZr[rrXr�_recursive_reprds
r_)�globals�locals�return_typec
Cs�|dkri}d|krt|d<d}|tk	r4||d<d}d�|�}d�dd�|D��}d	|�d
|�d|�d|��}d
�|���}d|�d|�d|��}i}	t|||	�|	df|�S)NZBUILTINS�Z_return_typez->_return_typerF�
css|]}d|��VqdS)z  Nr)rI�brrr�	<genexpr>�sz_create_fn.<locals>.<genexpr>z def rEr7z:
�, zdef __create_fn__(z):
z	
 return Z
__create_fn__)�builtinsrrO�keys�exec)
r�argsZbodyr`rarbZreturn_annotationZtxtZ
local_vars�nsrrr�
_create_fnws 
rmcCs0|rd|�d|�d|�d�S|�d|�d|��S)NzBUILTINS.object.__setattr__(rFr7rG�=r)rAr�value�	self_namerrr�
_field_assign�srqcCs�d|j��}|jtk	rV|jr@|j||<|�d|j�d|j��}q�|j||<|�d�}n8|jr�|jtkrn|j}q�|jtk	r�|j||<|j}ndS|jtkr�dSt||j||�S)NZ_dflt_z() if z is _HAS_DEFAULT_FACTORY else rD)rr-rr/r,r2r!rq)rJrAr`rpZdefault_namerorrr�_field_init�s"






rrcCsV|jtkr|jtkrd}n&|jtk	r2d|j��}n|jtk	r@d}|j�d|j�|��S)Nrcz=_dflt_z=_HAS_DEFAULT_FACTORYz:_type_)r,rr-r)rJr,rrr�_init_param�s

rscCs�d}|D]:}|jr|jtkr&|jtks,d}q|rtd|j�d���qdd�|D�}|�ttd��g}|D] }t||||�}	|	rj|�	|	�qj|r�d�
d	d
�|D��}
|�	|�dt�d|
�d
��|s�dg}td|gdd�|D�|||dd�S)NFTznon-default argument z follows default argumentcSsi|]}d|j��|j�qS)Z_type_)rr%rHrrr�
<dictcomp>�s
z_init_fn.<locals>.<dictcomp>)r�_HAS_DEFAULT_FACTORYrFcss|]}|jtkr|jVqdSr)r2r!rrHrrrrf	s
�z_init_fn.<locals>.<genexpr>rGrEr7�passrcSsg|]}|jrt|��qSr)r/rsrHrrrrMsz_init_fn.<locals>.<listcomp>)rar`rb)
r/r,rr-�	TypeErrorr�updaterurr�appendrO�_POST_INIT_NAMErm)rrA�
has_post_initrpr`Zseen_defaultrJraZ
body_lines�lineZ
params_strrrr�_init_fn�s:��r}cCs2tdddd�dd�|D��dg|d�}t|�S)	Nrrz(return self.__class__.__qualname__ + f"(rgcSs g|]}|j�d|j�d��qS)z={self.z!r}rrHrrrrMs�z_repr_fn.<locals>.<listcomp>z)"�r`)rmrOr_)rr`�fnrrr�_repr_fns
����r�cCsp|td�}|r,dd�dd�|D��d}nd}tdd	d
|�d�dd
f||d�tddd
|�d�ddf||d�fS)N)�clsrrErFcss|]}t|j�VqdSr)r(rrHrrrrf(sz'_frozen_get_del_attr.<locals>.<genexpr>rNrD�__setattr__)rrroz if type(self) is cls or name in �:z> raise FrozenInstanceError(f"cannot assign to field {name!r}")z)super(cls, self).__setattr__(name, value))rar`�__delattr__rz; raise FrozenInstanceError(f"cannot delete field {name!r}")z"super(cls, self).__delattr__(name))rrOrm)r�rr`raZ
fields_strrrr�_frozen_get_del_attr$s2�
��
���r�cCs$t|ddd|�|�|��dg|d�S)N)r�otherz%if other.__class__ is self.__class__:z return zreturn NotImplementedr~)rm)r�op�
self_tuple�other_tupler`rrr�_cmp_fn=s��r�cCs$td|�}tddd|�d�g|d�S)Nr�__hash__rzreturn hash(r7r~)rPrm)rr`r�rrr�_hash_fnKs
�r�cCs$||jkp"t|�|jko"|j|jkSr)�ClassVarr%Z
_GenericAliasZ
__origin__)�a_type�typingrrr�_is_classvarSs

�r�cCs||jkpt|�|jkSr)rr%)r��dataclassesrrr�_is_initvar[s
�r�c	Cs�t�|�}|r�d}|�d�}|s2tj�|j�j}n2tj�|j�}|rd|j�|�|krdtj�|j�j}|r�||�|�d��|�r�dSdS)N��TF)�_MODULE_IDENTIFIER_RE�match�group�sys�modules�getr�__dict__)	Z
annotationr�Za_moduler�Zis_type_predicater�rlZmodule_name�modulerrr�_is_typebs)

r�cCs8t||t�}t|t�r|}nt|tj�r,t}t|d�}||_||_t	|_
tj�
d�}|r�t||�s�t|jt�r�t|j|||jt�r�t|_
|j
t	kr�tjt}t||�s�t|jt�r�t|j|||jt�r�t|_
|j
ttfkr�|jtk	r�td|j�d���|j
t	k�r4t|jtttf��r4tdt|j��d|j�d���|S)N)r,r��field z cannot have a default factoryzmutable default z for field z$ is not allowed: use default_factory)r9rr'rr4�MemberDescriptorTyperrr%rr2r�r�r�r��strr�r�r rr�rr!r-rwr,�list�dictr\rC)r�Za_namer�r,rJr�r�rrr�
_get_field�sF



���



���
	 r�cCs||jkrdSt|||�dS)NTF)r��setattr)r�rrorrr�_set_new_attribute�s
r�cCsdSrr�r�rr`rrr�_hash_set_none�sr�cCsdd�|D�}t||�S)NcSs(g|] }|jdkr|jrn|jr|�qSr)r.r0rHrrrrMs

z_hash_add.<locals>.<listcomp>)r�)r�rr`�fldsrrr�	_hash_addsr�cCstd|j����dS)Nz-Cannot overwrite attribute __hash__ in class )rwrr�rrr�_hash_exceptionsr�))FFFF)FFFT)FFTF)FFTT)FTFF)FTFT)FTTF)FTTT)TFFF)TFFT)TFTF)TFTT)TTFF)TTFT)TTTF)TTTTcs�i}�jtjkr tj�jj}ni}t�tt||||||��d}	d}
�jddd�D]D}t|t	d�}|dk	rVd}
|�
�D]}
|
||
j<qzt|t�jrVd}	qV�j�
di�}�fdd�|��D�}|D]L}
|
||
j<tt�|
jd�t�r�|
jtk�rt�|
j�q�t�|
j|
j�qĈj��D].\}}t|t��r||k�rt|�d����q|
�rz|	�rf|�sftd	��|	�sz|�rztd
��t�t	|��j�
dt�}|tk�p�|dk�o�d�jk}|�r�|�s�td
��|�rt�t�}dd�|�
�D�}t�dt|||d|k�rdnd|��dd�|�
�D�}|�rHdd�|D�}t�dt||��|�r�dd�|D�}td|�}td|�}t�dtdd|||d��|�r�dd�|D�}td|�}td|�}dD]>\}}t�|t|||||d���r�td|�d�j�d����q�|�r8t�||�D].}t�|j|��rtd|j�d�j�����qtt |�t |�t |�|f}|�rh|�||��_!t�d��s��jt"t#�$����%dd ��_&�S)!NF���rT�__annotations__csg|]\}}t�||��qSr)r�)rIrr%�r�rrrM]s�z"_process_class.<locals>.<listcomp>z& is a field but has no type annotationz5cannot inherit non-frozen dataclass from a frozen onez5cannot inherit frozen dataclass from a non-frozen oner��__eq__z eq must be true if order is truecSsg|]}|jttfkr|�qSr)r2rr!rHrrrrM�s�rrZ__dataclass_self__cSsg|]}|jtkr|�qSr�r2rrHrrrrM�s
cSsg|]}|jr|�qSr)r(rHrrrrM�srcSsg|]}|jr|�qSr�r0rHrrrrM�sr�z==r~cSsg|]}|jr|�qSrr�rHrrrrM�s))�__lt__�<)�__le__z<=)�__gt__�>)�__ge__z>=zCannot overwrite attribute z
 in class z). Consider using functools.total_ordering�__doc__z -> Nonerc)'rr�r�r�r��_PARAMSr<�__mro__r9�_FIELDS�valuesrrAr��itemsr'rr,r�delattrrwrC�hasattrrzr�r}r�rPr�rr��_hash_action�boolr�r��inspectZ	signaturerr�)r�r/r(r>r?r@rArr`Zany_frozen_baseZhas_dataclass_basesreZbase_fieldsrJZcls_annotationsZ
cls_fieldsrroZ
class_hashZhas_explicit_hashr{r�Z
field_listr�r�r�rZhash_actionrr�r�_process_class's��
�

�
��

��


����r�Fr=cs*������fdd�}|dkr"|S||�S)Ncst|�������Sr)r�r��r>rAr/r?r(r@rr�wrap�szdataclass.<locals>.wrapr)r�r/r(r>r?r@rAr�rr�rr�scCsBzt|t�}Wntk
r*td��YnXtdd�|��D��S)Nz0must be called with a dataclass type or instancecss|]}|jtkr|VqdSrr�rHrrrrf
s
zfields.<locals>.<genexpr>)r9r��AttributeErrorrw�tupler�)Zclass_or_instancerrrrr�s
cCstt|�t�Sr)r�r%r�)�objrrr�_is_dataclass_instancesr�cCs t|t�r|nt|�}t|t�Sr)r'r%r�r�)r�r�rrrr
s��dict_factorycCst|�std��t||�S)Nz0asdict() should be called on dataclass instances)r�rw�
_asdict_inner)r�r�rrrr	scs�t|�rDg}t|�D]&}tt||j���}|�|j|f�q�|�St|t�rrt|d�rrt	|��fdd�|D��St|t
tf�r�t	|��fdd�|D��St|t�r�t	|��fdd�|��D��St
�|�SdS)N�_fieldscsg|]}t|���qSr�r��rI�vr�rrrMOsz!_asdict_inner.<locals>.<listcomp>c3s|]}t|��VqdSrr�r�r�rrrfTsz _asdict_inner.<locals>.<genexpr>c3s&|]\}}t|��t|��fVqdSrr��rI�kr�r�rrrfVs��)r�rr�r9rryr'r�r�r%r�r�r��copy�deepcopy)r�r�rWrJrorr�rr�4s
�r���
tuple_factorycCst|�std��t||�S)Nz1astuple() should be called on dataclass instances)r�rw�_astuple_inner)r�r�rrrr
]scs�t|�r>g}t|�D] }tt||j���}|�|�q�|�St|t�rlt|d�rlt	|��fdd�|D��St|t
tf�r�t	|��fdd�|D��St|t�r�t	|��fdd�|��D��St
�|�SdS)Nr�csg|]}t|���qSr�r�r�r�rrrM�sz"_astuple_inner.<locals>.<listcomp>c3s|]}t|��VqdSrr�r�r�rrrf�sz!_astuple_inner.<locals>.<genexpr>c3s&|]\}}t|��t|��fVqdSrr�r�r�rrrf�s�)r�rr�r9rryr'r�r�r%r�r�r�r�r�)r�r�rWrJrorr�rr�us
�r�r)�bases�	namespacer/r(r>r?r@rAc	s�dkri�n����t�}
i}|D]�}t|t�r<|}
d}nDt|�dkrR|\}
}n.t|�dkrr|\}
}}|�|
<ntd|����t|
t�r�|
��s�td|
����t�|
�r�td|
����|
|
kr�td|
����|
�	|
�|||
<q$|�d<t
�||i�fd	d
��}t|||||||	d�S)Nz
typing.Anyr��zInvalid field: z'Field names must be valid identifiers: z"Field names must not be keywords: zField name duplicated: r�cs
|���Sr)rx)rl�r�rr�<lambda>��z make_dataclass.<locals>.<lambda>r=)
r�r\r'r��lenrw�isidentifier�keyword�	iskeywordrTr4�	new_classr)Zcls_namerr�r�r/r(r>r?r@rA�seenZanns�itemr�tp�specr�rr�rr�s:






�cOst|�dkr tdt|��d���|r,|\}n4d|krX|�d�}ddl}|jdtdd�ntd	��t|�sptd
��t|t��	�D]v}|j
tkr�q~|js�|j
|kr~td|j
�d���q~|j
|kr~|j
tkr�|jtkr�td
|j
�d���t||j
�||j
<q~|jf|�S)Nr�z*replace() takes 1 positional argument but z were givenr�rz/Passing 'obj' as keyword argument is deprecatedr�)�
stacklevelz7replace() missing 1 required positional argument: 'obj'z1replace() should be called on dataclass instancesr�zC is declared with init=False, it cannot be specified with replace()zInitVar z! must be specified with replace())r�rw�pop�warnings�warn�DeprecationWarningr�r9r�r�r2r r/rrCr!r,r�	__class__)rkZchangesr�r�rJrrrr�s4
�


z(obj, /, **kwargs))N)C�rer�r�r4r�r�rhr]rR�__all__r�rrrurrr5r3rrr r!r�r�rz�compiler�r%r"rrr<rrPr_rmrqrrrsr}r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr�r
r�r	r�r�r
r�rr�__text_signature__rrrr�<module>s��

:��62;R�>
�)�B<dis.cpython-38.pyc000064400000036702150335716500007770 0ustar00U

e5dZP�@sdZddlZddlZddlZddlZddlTddlmZddddd	d
ddd
ddgeZ[ejej	ej
eee
fZedZdedfedfedffZedZdZdd�ZdVddd�dd�ZdWdd�dd�Zdddd d!d"d#d$d%d&d'�
Zd(d)�Zd*d+�Zd,d�Zd-d.�Zdd�d/d�Ze� d0d1�Z!d2e!j"_d3e!j_d4e!j#_d5e!j$_d6e!j%_d7e!j&_d8e!j'_d9e!j(_d:Z)d;Z*Gd<d�de!�Z+dd=�d>d
�Z,d?d@�Z-dAdB�Z.dXdCdD�Z/dYdd�dFd�Z0ddd�dGdH�Z1dZdddI�dJdK�Z2dLdM�Z3e0Z4dNdO�Z5dPd�Z6dQd
�Z7GdRd�d�Z8dSdT�Z9e:dUk�re9�dS)[z0Disassembler of Python byte code into mnemonics.�N)�*)�__all__�	code_info�dis�disassemble�distb�disco�findlinestarts�
findlabels�	show_code�get_instructions�Instruction�Bytecode�FORMAT_VALUE)N��str�repr�ascii�
MAKE_FUNCTION)�defaultsZ
kwdefaultsZannotationsZclosurecCs6zt||d�}Wn tk
r0t||d�}YnX|S)z�Attempts to compile the given source, first as an expression and
       then as a statement if the first approach fails.

       Utility function to accept strings in functions that otherwise
       expect code objects
    �eval�exec)�compile�SyntaxError)�source�name�c�r�/usr/lib64/python3.8/dis.py�_try_compiles
r��file�depthcCsh|dkrt|d�dSt|d�r&|j}t|d�r8|j}n4t|d�rJ|j}n"t|d�r\|j}nt|d�rl|j}t|d�r�t|j�	��}|D]p\}}t
|t�r�td	||d�zt
|||d
�Wn0tk
r�}ztd||d�W5d}~XYnXt|d�q�nht|d��rt|||d
�nLt
|ttf��r6t||d�n.t
|t��rRt|||d
�ntd
t|�j��dS)a0Disassemble classes, methods, functions, and other compiled objects.

    With no argument, disassemble the last traceback.

    Compiled objects currently include generator objects, async generator
    objects, and coroutine objects, all of which store their code object
    in a special attribute.
    N�r!�__func__�__code__�gi_code�ag_code�cr_code�__dict__zDisassembly of %s:r zSorry:�co_code�(don't know how to disassemble %s objects)r�hasattrr$r%r&r'r(�sortedr)�items�
isinstance�
_have_code�printr�	TypeError�_disassemble_recursive�bytes�	bytearray�_disassemble_bytesr�_disassemble_str�type�__name__)�xr!r"r.rZx1�msgrrrr+s@	







 �r#cCsX|dkr@z
tj}Wntk
r0td�d�YnX|jr@|j}q2t|jj|j|d�dS)z2Disassemble a traceback (default: last traceback).Nz no last traceback to disassembler#)	�sys�last_traceback�AttributeError�RuntimeError�tb_nextr�tb_frame�f_code�tb_lasti)�tbr!rrrrXs
Z	OPTIMIZEDZ	NEWLOCALSZVARARGSZVARKEYWORDSZNESTEDZ	GENERATORZNOFREEZ	COROUTINEZITERABLE_COROUTINEZASYNC_GENERATOR)
������ �@��icCs`g}td�D]:}d|>}||@r|�t�|t|���||N}|sqVq|�t|��d�|�S)z+Return pretty representation of code flags.rJrE�, )�range�append�COMPILER_FLAG_NAMES�get�hex�join)�flags�names�i�flagrrr�pretty_flagsrsrYcCs�t|d�r|j}t|d�r"|j}n4t|d�r4|j}n"t|d�rF|j}nt|d�rV|j}t|t�rjt|d�}t|d�rx|St	dt
|�j��d	S)
zDHelper to handle methods, compiled or raw code objects, and strings.r$r%r&r'r(z
<disassembly>r*r+N)r,r$r%r&r'r(r/rrr2r8r9�r:rrr�_get_code_object�s"







�r[cCstt|��S)z1Formatted details of methods, functions, or code.)�_format_code_infor[rZrrrr�scCs�g}|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�|�dt|j	��|j
r�|�d	�t|j
�D]}|�d
|�q�|jr�|�d�t|j�D]}|�d|�q�|j
�r|�d
�t|j
�D]}|�d|��q|j�rH|�d�t|j�D]}|�d|��q2|j�rz|�d�t|j�D]}|�d|��qdd�|�S)NzName:              %szFilename:          %szArgument count:    %szPositional-only arguments: %szKw-only arguments: %szNumber of locals:  %szStack size:        %szFlags:             %sz
Constants:z%4d: %rzNames:z%4d: %szVariable names:zFree variables:zCell variables:�
)rP�co_name�co_filename�co_argcount�co_posonlyargcount�co_kwonlyargcount�
co_nlocals�co_stacksizerY�co_flags�	co_consts�	enumerate�co_names�co_varnames�co_freevars�co_cellvarsrT)�co�linesZi_cZi_nrrrr\�s<




r\cCstt|�|d�dS)z}Print details of methods, functions, or code to *file*.

    If *file* is not provided, the output is printed on stdout.
    r#N)r1r)rlr!rrrr�s�_InstructionzBopname opcode arg argval argrepr offset starts_line is_jump_targetz!Human readable name for operationzNumeric code for operationz6Numeric argument to operation (if any), otherwise Nonez4Resolved arg value (if known), otherwise same as argz0Human readable description of operation argumentz1Start index of operation within bytecode sequencez4Line started by this opcode (if any), otherwise Nonez1True if other code jumps to here, otherwise False��c@seZdZdZddd�ZdS)	r
aKDetails for a bytecode operation

       Defined fields:
         opname - human readable name for operation
         opcode - numeric code for operation
         arg - numeric argument to operation (if any), otherwise None
         argval - resolved arg value (if known), otherwise same as arg
         argrepr - human readable description of operation argument
         offset - start index of operation within bytecode sequence
         starts_line - line started by this opcode (if any), otherwise None
         is_jump_target - True if other code jumps to here, otherwise False
    �FrGcCs�g}|r:|jdk	r,d|}|�||j�n|�d|�|rJ|�d�n
|�d�|jrf|�d�n
|�d�|�t|j��|��|�|j�t��|j	dk	r�|�t|j	��t
��|jr�|�d|jd	�d�|��
�S)
a%Format instruction details for inclusion in disassembly output

        *lineno_width* sets the width of the line number field (0 omits it)
        *mark_as_current* inserts a '-->' marker arrow as part of the line
        *offset_width* sets the width of the instruction offset field
        Nz%%%dd� z-->z   z>>z  �(�))�starts_linerP�is_jump_targetr�offset�rjust�opname�ljust�
_OPNAME_WIDTH�arg�_OPARG_WIDTH�argreprrT�rstrip)�self�lineno_widthZmark_as_current�offset_widthZfieldsZ
lineno_fmtrrr�_disassemble�s&



zInstruction._disassembleN)rqFrG)r9�
__module__�__qualname__�__doc__r�rrrrr
�s
)�
first_linecCsTt|�}|j|j}tt|��}|dk	r4||j}nd}t|j|j|j	|j
|||�S)a�Iterator for the opcodes in methods, functions or code

    Generates a series of Instruction named tuples giving the details of
    each operations in the supplied code.

    If *first_line* is not None, it indicates the line number that should
    be reported for the first source line in the disassembled code.
    Otherwise, the source line information (if any) is taken directly from
    the disassembled code object.
    Nr)r[rkrj�dictr	�co_firstlineno�_get_instructions_bytesr*rirhrf)r:r�rl�
cell_names�
linestarts�line_offsetrrrrs�cCs |}|dk	r||}|t|�fS)z�Helper to get optional details about const references

       Returns the dereferenced constant and its repr if the constant
       list is defined.
       Otherwise returns the constant index and its repr().
    N�r)Zconst_indexZ
const_list�argvalrrr�_get_const_infosr�cCs*|}|dk	r||}|}nt|�}||fS)z�Helper to get optional details about named references

       Returns the dereferenced name as both value and repr if the name
       list is defined.
       Otherwise returns the name index and its repr().
    Nr�)Z
name_indexZ	name_listr�r~rrr�_get_name_info'sr�c
#s�t|�}d}t|�D�]r\}	}
�|dk	rD|�|	d�}|dk	rD||7}|	|k}d}d}
�dk	�rl�}|
tkrzt�|�\}}
n�|
tkr�t�|�\}}
n�|
tkr�|	d�}dt|�}
n�|
t	kr�t�|�\}}
n�|
t
kr�t�}|}
n�|
tkr�t�|�\}}
nr|
t
k�rFt�d@\}}
|t�d@�f}|d�rl|
�r<|
d7}
|
d	7}
n&|
tk�rld��fd
d�tt�D��}
tt|
|
�||
|	||�VqdS)a&Iterate over the instructions in a bytecode string.

    Generates a sequence of Instruction namedtuples giving the details of each
    opcode.  Additional information about the code's runtime environment
    (e.g. variable names, constants) can be specified using optional
    arguments.

    NrrFzto rqrGrErNzwith formatc3s"|]\}}�d|>@r|VqdS)rENr)�.0rW�s�r|rr�	<genexpr>gs�z*_get_instructions_bytes.<locals>.<genexpr>)r
�_unpack_opargsrRZhasconstr�Zhasnamer��hasjrelrZhaslocalZ
hascompareZcmp_opZhasfreer�FORMAT_VALUE_CONVERTERS�boolrrTrg�MAKE_FUNCTION_FLAGSr
ry)�code�varnamesrV�	constants�cellsr�r��labelsrurw�oprvr�r~rr�rr�7sV






�r����c
Cs<|j|j}tt|��}t|j||j|j|j|||d�dS)zDisassemble a code object.r#N)	rkrjr�r	r6r*rirhrf)rl�lastir!r�r�rrrrms�cCspt||d�|dks|dkrl|dk	r,|d}|jD]8}t|d�r2t|d�td|f|d�t|||d�q2dS)Nr#rrEr*zDisassembly of %r:r )rrfr,r1r3)rlr!r"r:rrrr3ts


r3)r!r�c	Cs�|dk	}	|	r8t|���|}
|
dkr2tt|
��}q<d}nd}t|�d}|dkr^tt|��}
nd}
t|||||||d�D]J}|	o�|jdk	o�|jdk}|r�t|d�|j|k}t|�|||
�|d�qxdS)	Ni�rqrrFi'rG�r�r#)	�max�values�lenrr�rurwr1r�)r�r�r�rVr�r�r�r!r�Zshow_linenoZ	maxlinenor�Z	maxoffsetr�ZinstrZnew_source_lineZis_current_instrrrrr6s8�
��

�r6cKstt|d�f|�dS)z<Compile the source string, then disassemble the code object.z<dis>N)r3r)r�kwargsrrrr7�sr7ccsdd}tdt|�d�D]J}||}|tkrN||d|B}|tkrH|d>nd}nd}|||fVqdS)NrrFrErH)rOr�Z
HAVE_ARGUMENTZEXTENDED_ARG)r�Zextended_argrWr�r|rrrr��sr�cCs\g}t|�D]J\}}}|dk	r|tkr4|d|}n|tkr|}nq||kr|�|�q|S)z`Detect all offsets in a byte code which are jump targets.

    Return the list of offsets.

    NrF)r�r�ZhasjabsrP)r�r�rwr�r|Zlabelrrrr
�sc	cs�|jddd�}|jddd�}t|j�}d}|j}d}t||�D]P\}}|rz||krd||fV|}||7}||krzdS|dkr�|d8}||7}qB||kr�||fVdS)z�Find the offsets in a byte code which are start of lines in the source.

    Generate pairs (offset, lineno) as described in Python/compile.c.

    rNrFrErLrM)�	co_lnotabr�r*r��zip)	r�Zbyte_incrementsZline_incrementsZbytecode_lenZ
lastlineno�linenoZaddrZ	byte_incrZ	line_incrrrrr	�s&


c@sLeZdZdZddd�dd�Zdd�Zdd	�Zed
d��Zdd
�Z	dd�Z
dS)raThe bytecode operations of a piece of code

    Instantiate this with a function, method, other compiled object, string of
    code, or a code object (as returned by compile()).

    Iterating over this yields the bytecode operations as Instruction instances.
    N)r��current_offsetcCsdt|�|_}|dkr&|j|_d|_n||_||j|_|j|j|_tt	|��|_
||_||_dS)Nr)
r[�codeobjr�r��_line_offsetrkrj�_cell_namesr�r	�_linestarts�_original_objectr�)r�r:r�r�rlrrr�__init__�szBytecode.__init__c	Cs*|j}t|j|j|j|j|j|j|jd�S)Nr�)	r�r�r*rirhrfr�r�r�)r�rlrrr�__iter__�s�zBytecode.__iter__cCsd�|jj|j�S)Nz{}({!r}))�format�	__class__r9r��r�rrr�__repr__�s
�zBytecode.__repr__cCs |jr|j}q||jj|jd�S)z/ Construct a Bytecode from the given traceback )r�)r@rArBrC)�clsrDrrr�from_traceback�szBytecode.from_tracebackcCs
t|j�S)z3Return formatted information about the code object.)r\r�r�rrr�infosz
Bytecode.infocCsl|j}|jdk	r|j}nd}t���>}t|j|j|j|j|j	|j
|j||d�	|��W5QR�SQRXdS)z3Return a formatted view of the bytecode operations.Nr�)r�rVr�r�r�r�r!r�)
r�r��io�StringIOr6r*rirhrfr�r�r��getvalue)r�rlrw�outputrrrr
s


�zBytecode.dis)r9r�r�r�r�r�r��classmethodr�r�rrrrrr�s

c	Csfddl}|��}|jd|�d�ddd�|��}|j�}|��}W5QRXt||jjd�}t	|�dS)	z*Simple test program to disassemble a file.rN�infile�rb�?�-)r8�nargs�defaultr)
�argparse�ArgumentParser�add_argumentZFileType�
parse_argsr��readrrr)r��parser�argsr�rr�rrr�_testsr��__main__)N)N)NNNNNr)r�)r�NNNNN);r�r<�types�collectionsr�ZopcoderZ_opcodes_all�
MethodType�FunctionType�CodeTyper��staticmethodr8r0Zopmaprrrrr�rr�rrrrQrYr[rr\r�
namedtuplernryr|r�r~rwrurvr{r}r
rr�r�r�rr3r6r7rr�r
r	rr�r9rrrr�<module>s�
����
-�
 �4�
6��=
tracemalloc.cpython-38.pyc000064400000041725150335716500011500 0ustar00U

e5d�B�@sddlmZmZddlmZddlZddlZddlZddl	Z	ddl
Tddl
mZmZdd�Z
Gdd	�d	�ZGd
d�d�Zdd
�ZeGdd�d��ZeGdd�de��Zdd�ZGdd�d�ZGdd�de�Zdd�ZGdd�d�ZGdd�de�ZGdd�de�ZGd d!�d!�Zd"d#�ZdS)$�)�Sequence�Iterable)�total_orderingN)�*)�_get_object_traceback�_get_tracescCs�dD]|}t|�dkr@|dkr@|r0d||fSd||fSt|�dksT|dkrx|rhd||fSd	||fS|d
}qdS)N)�BZKiBZMiBZGiB�TiB�drz%+.1f %sz%.1f %si(r	z%+.0f %sz%.0f %si)�abs)�sizeZsignZunit�r
�#/usr/lib64/python3.8/tracemalloc.py�_format_size
src@sDeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dS)�	StatisticzS
    Statistic difference on memory allocations between two Snapshot instance.
    ��	tracebackr�countcCs||_||_||_dS�Nr)�selfrrrr
r
r�__init__%szStatistic.__init__cCst|j|j|jf�Sr)�hashrrr�rr
r
r�__hash__*szStatistic.__hash__cCs$|j|jko"|j|jko"|j|jkSrr�r�otherr
r
r�__eq__-s

�
�zStatistic.__eq__cCsBd|jt|jd�|jf}|jr>|j|j}|dt|d�7}|S)Nz%s: size=%s, count=%iF�, average=%s)rrrr�r�textZaverager
r
r�__str__2s
��zStatistic.__str__cCsd|j|j|jfS)Nz)<Statistic traceback=%r size=%i count=%i>rrr
r
r�__repr__<s�zStatistic.__repr__cCs|j|j|jfSr)rrrrr
r
r�	_sort_key@szStatistic._sort_keyN��__name__�
__module__�__qualname__�__doc__�	__slots__rrrr r!r"r
r
r
rrs
rc@sDeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dS)�
StatisticDiffzd
    Statistic difference on memory allocations between an old and a new
    Snapshot instance.
    �rr�	size_diffr�
count_diffcCs"||_||_||_||_||_dSrr*)rrrr+rr,r
r
rrKs
zStatisticDiff.__init__cCst|j|j|j|j|jf�Sr)rrrr+rr,rr
r
rrRs�zStatisticDiff.__hash__cCs<|j|jko:|j|jko:|j|jko:|j|jko:|j|jkSrr*rr
r
rrVs
�
�
�
�zStatisticDiff.__eq__cCsPd|jt|jd�t|jd�|j|jf}|jrL|j|j}|dt|d�7}|S)Nz %s: size=%s (%s), count=%i (%+i)FTr)rrrr+rr,rr
r
rr ]s

��zStatisticDiff.__str__cCsd|j|j|j|j|jfS)Nz9<StatisticDiff traceback=%r size=%i (%+i) count=%i (%+i)>r*rr
r
rr!is��zStatisticDiff.__repr__cCs t|j�|jt|j�|j|jfSr)rr+rr,rrrr
r
rr"ns
�zStatisticDiff._sort_keyNr#r
r
r
rr)Dsr)cCs�g}|��D]d\}}|�|d�}|dk	rNt||j|j|j|j|j|j�}nt||j|j|j|j�}|�|�q|��D]*\}}t|d|jd|j�}|�|�qz|S�Nr)�items�popr)rr�append)�	old_group�	new_group�
statisticsr�statZpreviousr
r
r�_compare_grouped_statsts*

��r5c@s\eZdZdZdZdd�Zedd��Zedd��Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dS)�Framez
    Frame of a traceback.
    ��_framecCs
||_dSrr7�r�framer
r
rr�szFrame.__init__cCs
|jdSr-r7rr
r
r�filename�szFrame.filenamecCs
|jdS�N�r7rr
r
r�lineno�szFrame.linenocCs|j|jkSrr7rr
r
rr�szFrame.__eq__cCs|j|jkSrr7rr
r
r�__lt__�szFrame.__lt__cCs
t|j�Sr)rr8rr
r
rr�szFrame.__hash__cCsd|j|jfS)Nz%s:%s�r;r>rr
r
rr �sz
Frame.__str__cCsd|j|jfS)Nz<Frame filename=%r lineno=%r>r@rr
r
rr!�szFrame.__repr__N)r$r%r&r'r(r�propertyr;r>rr?rr r!r
r
r
rr6�s

r6c@sfeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
ddd�ZdS)�	Tracebackz`
    Sequence of Frame instances sorted from the oldest frame
    to the most recent frame.
    ��_framescCst�|�tt|��|_dSr)rr�tuple�reversedrD)r�framesr
r
rr�s
zTraceback.__init__cCs
t|j�Sr)�lenrDrr
r
r�__len__�szTraceback.__len__cCs4t|t�r"tdd�|j|D��St|j|�SdS)Ncss|]}t|�VqdSr)r6��.0�tracer
r
r�	<genexpr>�sz(Traceback.__getitem__.<locals>.<genexpr>)�
isinstance�slicerErDr6�r�indexr
r
r�__getitem__�s
zTraceback.__getitem__cCs|j|jkSr)r8rDr9r
r
r�__contains__�szTraceback.__contains__cCs
t|j�Sr)rrDrr
r
rr�szTraceback.__hash__cCs|j|jkSrrCrr
r
rr�szTraceback.__eq__cCs|j|jkSrrCrr
r
rr?�szTraceback.__lt__cCst|d�Sr-)�strrr
r
rr �szTraceback.__str__cCsdt|�fS)Nz<Traceback %r>)rErr
r
rr!�szTraceback.__repr__NFcCs�g}|dk	r2|dkr$||d�}q6|d|�}n|}|rBt|�}|D]@}|�d|j|jf�t�|j|j���}|rF|�d|�qF|S)Nrz  File "%s", line %sz    %s)rFr0r;r>�	linecache�getline�strip)r�limitZmost_recent_first�linesZframe_slicer:�liner
r
r�format�s 
�zTraceback.format)NF)r$r%r&r'r(rrIrRrSrrr?r r!r[r
r
r
rrB�srBcCs t|�}|dk	rt|�SdSdS)z�
    Get the traceback where the Python object *obj* was allocated.
    Return a Traceback instance.

    Return None if the tracemalloc module is not tracing memory allocations or
    did not trace the allocation of the object.
    N)rrB)�objrGr
r
r�get_object_traceback�sr]c@s`eZdZdZdZdd�Zedd��Zedd��Zed	d
��Z	dd�Z
d
d�Zdd�Zdd�Z
dS)�Tracez"
    Trace of a memory block.
    ��_tracecCs
||_dSrr_�rrLr
r
rrszTrace.__init__cCs
|jdSr-r_rr
r
r�domainszTrace.domaincCs
|jdSr<r_rr
r
rr	sz
Trace.sizecCst|jd�S)N�)rBr`rr
r
rr
szTrace.tracebackcCs|j|jkSrr_rr
r
rrszTrace.__eq__cCs
t|j�Sr)rr`rr
r
rrszTrace.__hash__cCsd|jt|jd�fS)Nz%s: %sF)rrrrr
r
rr sz
Trace.__str__cCsd|jt|jd�|jfS)Nz'<Trace domain=%s size=%s, traceback=%r>F)rbrrrrr
r
rr!s�zTrace.__repr__N)r$r%r&r'r(rrArbrrrrr r!r
r
r
rr^�s


r^c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�_TracescCst�|�||_dSr)rr�_traces)r�tracesr
r
rr s
z_Traces.__init__cCs
t|j�Sr)rHrerr
r
rrI%sz_Traces.__len__cCs4t|t�r"tdd�|j|D��St|j|�SdS)Ncss|]}t|�VqdSr)r^rJr
r
rrM*sz&_Traces.__getitem__.<locals>.<genexpr>)rNrOrErer^rPr
r
rrR(s
z_Traces.__getitem__cCs|j|jkSr)r`rerar
r
rrS.sz_Traces.__contains__cCs|j|jkSr)rerr
r
rr1sz_Traces.__eq__cCsdt|�S)Nz<Traces len=%s>)rHrr
r
rr!4sz_Traces.__repr__N)	r$r%r&rrIrRrSrr!r
r
r
rrdsrdcCs&tj�|�}|�d�r"|dd�}|S)Nz.pyc���)�os�path�normcase�endswith)r;r
r
r�_normalize_filename8s
rlc@seZdZdd�Zdd�ZdS)�
BaseFiltercCs
||_dSr)�	inclusive)rrnr
r
rr@szBaseFilter.__init__cCst�dSr)�NotImplementedErrorrar
r
r�_matchCszBaseFilter._matchN)r$r%r&rrpr
r
r
rrm?srmcsJeZdZd�fdd�	Zedd��Zdd�Zd	d
�Zdd�Zd
d�Z	�Z
S)�FilterNFcs2t��|�||_t|�|_||_||_||_dSr)�superrrnrl�_filename_patternr>�
all_framesrb)rrn�filename_patternr>rtrb��	__class__r
rrHs
zFilter.__init__cCs|jSr)rsrr
r
rruQszFilter.filename_patterncCs6t|�}t�||j�sdS|jdkr(dS||jkSdS)NFT)rl�fnmatchrsr>�rr;r>r
r
r�_match_frame_implUs
zFilter._match_frame_implcCs|�||�|jASr)rzrnryr
r
r�_match_frame^szFilter._match_framecsH�jr,t�fdd�|D��r"�jS�jSn|d\}}��||�SdS)Nc3s|]\}}��||�VqdSr)rz)rKr;r>rr
rrMcs�z*Filter._match_traceback.<locals>.<genexpr>r)rt�anyrnr{)rrr;r>r
rr�_match_tracebackas�
zFilter._match_tracebackcCsD|\}}}|�|�}|jdk	r@|jr2|o0||jkS|p>||jkS|Sr)r}rbrn)rrLrbrr�resr
r
rrpls


z
Filter._match)NFN)r$r%r&rrArurzr{r}rp�
__classcell__r
r
rvrrqGs�	
	rqcs0eZdZ�fdd�Zedd��Zdd�Z�ZS)�DomainFiltercst��|�||_dSr)rrr�_domain)rrnrbrvr
rrxszDomainFilter.__init__cCs|jSr)r�rr
r
rrb|szDomainFilter.domaincCs|\}}}||jk|jASr)rbrn)rrLrbrrr
r
rrp�s
zDomainFilter._match)r$r%r&rrArbrprr
r
rvrr�ws
r�c@sXeZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z	dd
�Z
ddd�Zddd�ZdS)�SnapshotzB
    Snapshot of traces of memory blocks allocated by Python.
    cCst|�|_||_dSr)rdrf�traceback_limit)rrfr�r
r
rr�s
zSnapshot.__init__c	Cs*t|d��}t�||tj�W5QRXdS)z1
        Write the snapshot into a file.
        �wbN)�open�pickle�dumpZHIGHEST_PROTOCOL)rr;�fpr
r
rr��sz
Snapshot.dumpc
Cs,t|d��}t�|�W5QR�SQRXdS)z.
        Load a snapshot from a file.
        �rbN)r�r��load)r;r�r
r
rr��sz
Snapshot.loadcs@|rt�fdd�|D��sdS|r<t�fdd�|D��r<dSdS)Nc3s|]}|���VqdSr�rp�rK�trace_filter�rLr
rrM�s�z)Snapshot._filter_trace.<locals>.<genexpr>Fc3s|]}|���VqdSrr�r�r�r
rrM�s�T)r|)r�include_filters�exclude_filtersrLr
r�r�
_filter_trace�s��zSnapshot._filter_tracecs�t|t�stdt|�j��|rjg�g�|D] }|jrB��|�q,��|�q,���fdd��jjD�}n�jj�	�}t
|�j�S)z�
        Create a new Snapshot instance with a filtered traces sequence, filters
        is a list of Filter or DomainFilter instances.  If filters is an empty
        list, return a new Snapshot instance with a copy of the traces.
        z)filters must be a list of filters, not %scsg|]}����|�r|�qSr
)r�rJ�r�r�rr
r�
<listcomp>�s��z*Snapshot.filter_traces.<locals>.<listcomp>)rNr�	TypeError�typer$rnr0rfre�copyr�r�)r�filtersr�Z
new_tracesr
r�r�
filter_traces�s
�zSnapshot.filter_tracesc

Cs�|dkrtd|f��|r.|dkr.td|��i}i}|�s|jjD]�}|\}}}z||}	WnZtk
r�|dkr||}
n(|dkr�|dd�}
n|dddff}
t|
�}	|	||<YnXz(||	}|j|7_|jd7_WqDtk
�rt|	|d�||	<YqDXqDn�|jjD]�}|\}}}|D]�}z||}	WnFtk
�r~|dk�r\|f}
n|ddff}
t|
�}	|	||<YnXz(||	}|j|7_|jd7_Wn&tk
�r�t|	|d�||	<YnX�q(�q|S)	N)rr;r>zunknown key_type: %r)r>r;z/cumulative mode cannot by used with key type %rrr>r=r)�
ValueErrorrfre�KeyErrorrBrrr)
r�key_type�
cumulativeZstatsZ
tracebacksrLrbrZtrace_tracebackrrGr4r:r
r
r�	_group_by�sZ�


zSnapshot._group_byFcCs,|�||�}t|���}|jdtjd�|S)zd
        Group statistics by key_type. Return a sorted list of Statistic
        instances.
        T��reverse�key)r��list�values�sortrr")rr�r�Zgroupedr3r
r
rr3�szSnapshot.statisticscCs6|�||�}|�||�}t||�}|jdtjd�|S)z�
        Compute the differences with an old snapshot old_snapshot. Get
        statistics as a sorted list of StatisticDiff instances, grouped by
        group_by.
        Tr�)r�r5r�r)r")rZold_snapshotr�r�r2r1r3r
r
r�
compare_tos

zSnapshot.compare_toN)F)F)
r$r%r&r'rr��staticmethodr�r�r�r�r3r�r
r
r
rr��s
3

r�cCs$t�std��t�}t�}t||�S)zI
    Take a snapshot of traces of memory blocks allocated by Python.
    zLthe tracemalloc module must be tracing memory allocations to take a snapshot)�
is_tracing�RuntimeErrorrZget_traceback_limitr�)rfr�r
r
r�
take_snapshot
s
r�)Zcollections.abcrr�	functoolsrrxrUZos.pathrhr�Z_tracemallocrrrrr)r5r6rBr]r^rdrlrmrqr�r�r�r
r
r
r�<module>s2&0"?%0	pickletools.cpython-38.opt-2.pyc000064400000157607150335716500012511 0ustar00U

e5d.m�L@s�
ddlZddlZddlZddlZddlZdddgZejZdZdZdZ	dZ
d	ZGd
d�de�Z
ddlmZd
d�Ze
ddedd�Zdd�Ze
ddedd�Zdd�Ze
ddedd�Zdd�Ze
dded d�Zd!d"�Ze
d#d$ed%d�Z�d�d'd(�Ze
d)eed*d�Zd+d,�Ze
d-eed.d�Zd/d0�Ze
d1eed2d�Z d3d4�Z!e
d5ee!d6d�Z"d7d8�Z#e
d9e	e#d:d�Z$d;d<�Z%e
d=ee%d>d�Z&d?d@�Z'e
dAe
e'dBd�Z(dCdD�Z)e
dEee)dFd�Z*dGdH�Z+e
dIee+dJd�Z,dKdL�Z-e
dMee-dNd�Z.dOdP�Z/e
dQee/dRd�Z0dSdT�Z1e
dUe
e1dVd�Z2dWdX�Z3e
dYee3dZd�Z4d[d\�Z5d]d^�Z6e
d_ee5d`d�Z7e
daee6dbd�Z8dcdd�Z9e
deee9dfd�Z:dgdh�Z;e
did$e;djd�Z<ddklm=Z=dldm�Z>e
dnee>dod�Z?dpdq�Z@e
dre	e@dsd�ZAGdtdu�due�ZBeBdveCdwdx�ZDZEeBdyeCeFfdzdx�ZGeBd{eFd|dx�ZHeBd}eId~dx�ZJeBdeKeLfd�dx�ZMZNeBd�eKd�dx�ZOeBd�ePd�dx�ZQeBd�eLd�dx�ZReBd�eSd�d�dx�ZTeBd�eUd�dx�ZVeBd�eWd�dx�ZXeBd�eYd�dx�ZZeBd�e[d�dx�Z\eBd�e[d�dx�Z]eBd�ed�dx�Z^eBd�ed�dx�Z_eBd�eBd�dx�Z`eBd�eBd�dx�ZaGd�d��d�e�ZbebZcecd�d�e7geGgdd�d��ecd�d�egeDgdd�d��ecd�d�egeDgdd�d��ecd�d�egeDgdd�d��ecd�d�e8geDgdd�d��ecd�d�e?geDgdd�d��ecd�d�eAgeDgdd�d��ecd�d�egeMgdd�d��ecd�d�e$geMgdd�d��ecd�d�e"geMgdd�d��ecd�d�e(geOgd�d�d��ecd�d�e&geOgd�d�d��ecd�d�e*geOgdd�d��ecd�d�e,geQgd�d�d��ecd�d�dge^gd�d�d��ecd�d�de^ge^gd�d�d��ecd�d�dgeTgdd�d��ecd�d�dgeHgdd�d��ecd�d�dgeHgdd�d��ecd�d�e.geRgdd�d��ecd�d�e0geRgdd�d��ecd�d�e2geRgdd�d��ecd�d�e4geRgdd�d��ecd�d�e:geJgdd�d��ecd�d�e<geJgdd�d��ecd�d�dgeXgdd�d��ecd�d�deXe_geXgdd�d��ecd�d�deXe`eageXgdd�d��ecd�d�de`eageXgdd�d��ecd�d�dgeVgdd�d��ecd�d�de`eageVgdd�d��ecd�d�de_geVgdd�d��ec�d�dde_e_geVgd�dd��ec�d�dde_e_e_geVgd�dd��ec�d�ddgeZgd�dd��ec�d	�d
de`eageZgd�dd��ec�d�d
deZe_e_geZgd�dd��ec�d�ddeZe`eageZgd�dd��ec�d�ddge\gd�dd��ec�d�dde\e`eage\gd�dd��ec�d�dde`eage]gd�dd��ec�d�dde_ggd�dd��ec�d�dde_ge_e_gd�d d��ec�d!�d"dge`gd�d#d��ec�d$�d%de`eaggd�d&d��ec�d'�d(e7ge_gd�d)d��ec�d*�d+ege_gd�d,d��ec�d-�d.ege_gd�d/d��ec�d0�d1e7ggd�d2d��ec�d3�d4eggd�d5d��ec�d6�d7eggd�d8d��ec�d9�d:de_ge_gd�d;d��ec�d<�d=ege_gd�d>d��ec�d?�d@ege_gd�dAd��ec�dB�dCege_gd�dDd��ec�dE�dFe ge_gd�dGd��ec�dH�dIdeReRge_gd�dJd��ec�dK�dLde_e_ge_gd�dMd��ec�dN�dOde_e_ge_gd�dPd��ec�dQ�dRe e`eage_gd�dSd��ec�dT�dUde`e_eage_gd�dVd��ec�dW�dXde_e_ge_gd�dYd��ec�dZ�d[de_e_e_ge_gd�d\d��ec�d]�d^eggd�d_d��ec�d`�dade_ggd�dbd��ec�dc�ddeggd�ded��ec�df�dgege_gd�dhd��ec�di�djde_ge_gd�dkd��gDZd[ciZeiZfeged�D]n\ZhZieijjeek�r<ek�dleijjeeeijjehf��eijlefk�rdek�dmeijlefeijlehf��eheeeijj<ehefeijl<�q[e[f[h[iiZmedD]Zieiemeijl<�q�[i�d��do�dp�Znen�[n�d��dq�dr�Zo�dsd�Zp�dtd�Zq�d��dud�ZrG�dv�dw��dw�Zs�dxZt�dyZueteu�dz�Zv�d{�d|�Zwex�d}k�
r�ddlyZyeyjz�d~�d�Z{e{j|�d�ey�}�d���d��d��d��e{j|�d��d�ej~ey�}�d���d��d��e{j|�d��d��d��d��d��e{j|�d��d�deC�d��d��e{j|�d��d��d��d��d��e{j|�d��d��d��d��d��e{j|�d��d��d��d��d��e{j|�d��d��d��d��e{��Z�e�j��
rJew�n�e�j��
rX�d�ndZ�e�j��
sne{���n�e�e�j��dk�
r�ere�j�de�j�de�j�e��nVe�j��
r�indZ�e�j�D]>Z�e�j�j�e�jj�d��Z�e�j���e��d��ere�e�j�e�e�j�e���
q�dS(��N�dis�genops�optimize���������������c@seZdZdZdd�ZdS)�ArgumentDescriptor��name�n�reader�doccCs||_||_||_||_dS�Nr)�selfrr
rr�r�#/usr/lib64/python3.8/pickletools.py�__init__�szArgumentDescriptor.__init__N��__name__�
__module__�__qualname__�	__slots__rrrrrr
�sr
)�unpackcCs"|�d�}|r|dStd��dS)N�rz'not enough data in stream to read uint1)�read�
ValueError��f�datarrr�
read_uint1�s
r!�uint1rzOne-byte unsigned integer.rcCs0|�d�}t|�dkr$td|�dStd��dS)N�z<Hrz'not enough data in stream to read uint2�r�len�_unpackrrrrr�
read_uint2�s	
r'�uint2r#z)Two-byte unsigned integer, little-endian.cCs0|�d�}t|�dkr$td|�dStd��dS)N�z<irz&not enough data in stream to read int4r$rrrr�	read_int4�s	
r*�int4r)z8Four-byte signed integer, little-endian, 2's complement.cCs0|�d�}t|�dkr$td|�dStd��dS)Nr)z<Irz'not enough data in stream to read uint4r$rrrr�
read_uint4s	
r,�uint4z*Four-byte unsigned integer, little-endian.cCs0|�d�}t|�dkr$td|�dStd��dS)N�z<Qrz'not enough data in stream to read uint8r$rrrr�
read_uint8&s	
r/�uint8r.z+Eight-byte unsigned integer, little-endian.TcCs�|��}|�d�std��|dd�}|rtdD]8}|�|�r.|�|�sVtd||f��|dd�}qtq.td|��|r�t�|�d�d	�}|S)
N�
z-no newline found when trying to read stringnlr)�"�'z,strinq quote %r not found at both ends of %rrzno string quotes around %rr�ascii)�readline�endswithr�
startswith�codecs�
escape_decode�decode)rr:�stripquotesr �qrrr�
read_stringnl;s"


�r=�stringnlz�A newline-terminated string.

                   This is a repr-style string, with embedded escapes, and
                   bracketing quotes.
                   cCst|dd�S)NF)r;)r=�rrrr�read_stringnl_noescapetsr@�stringnl_noescapeaA newline-terminated string.

                        This is a str-style string, without embedded escapes,
                        or bracketing quotes.  It should consist solely of
                        printable ASCII characters.
                        cCsdt|�t|�fS)Nz%s %s)r@r?rrr�read_stringnl_noescape_pair�srB�stringnl_noescape_paira�A pair of newline-terminated strings.

                             These are str-style strings, without embedded
                             escapes, or bracketing quotes.  They should
                             consist solely of printable ASCII characters.
                             The pair is returned as a single string, with
                             a single blank separating the two strings.
                             cCs@t|�}|�|�}t|�|kr(|�d�Std|t|�f��dS)N�latin-1z2expected %d bytes in a string1, but only %d remain)r!rr%r:r�rr
r rrr�read_string1�s	


�rF�string1z�A counted string.

              The first argument is a 1-byte unsigned int giving the number
              of bytes in the string, and the second argument is that many
              bytes.
              cCsTt|�}|dkrtd|��|�|�}t|�|kr<|�d�Std|t|�f��dS)Nrzstring4 byte count < 0: %drDz2expected %d bytes in a string4, but only %d remain)r*rrr%r:rErrr�read_string4�s



�rH�string4z�A counted string.

              The first argument is a 4-byte little-endian signed int giving
              the number of bytes in the string, and the second argument is
              that many bytes.
              cCs:t|�}|�|�}t|�|kr"|Std|t|�f��dS)Nz1expected %d bytes in a bytes1, but only %d remain)r!rr%rrErrr�read_bytes1�s	

�rJ�bytes1z�A counted bytes string.

              The first argument is a 1-byte unsigned int giving the number
              of bytes, and the second argument is that many bytes.
              cCsPt|�}|tjkrtd|��|�|�}t|�|kr8|Std|t|�f��dS)Nz#bytes4 byte count > sys.maxsize: %dz1expected %d bytes in a bytes4, but only %d remain)r,�sys�maxsizerrr%rErrr�read_bytes4�s



�rN�bytes4z�A counted bytes string.

              The first argument is a 4-byte little-endian unsigned int giving
              the number of bytes, and the second argument is that many bytes.
              cCsPt|�}|tjkrtd|��|�|�}t|�|kr8|Std|t|�f��dS)Nz#bytes8 byte count > sys.maxsize: %dz1expected %d bytes in a bytes8, but only %d remain)r/rLrMrrr%rErrr�read_bytes8s


�rP�bytes8z�A counted bytes string.

              The first argument is an 8-byte little-endian unsigned int giving
              the number of bytes, and the second argument is that many bytes.
              cCsTt|�}|tjkrtd|��|�|�}t|�|kr<t|�Std|t|�f��dS)Nz'bytearray8 byte count > sys.maxsize: %dz5expected %d bytes in a bytearray8, but only %d remain)r/rLrMrrr%�	bytearrayrErrr�read_bytearray89s


�rS�
bytearray8z�A counted bytearray.

              The first argument is an 8-byte little-endian unsigned int giving
              the number of bytes, and the second argument is that many bytes.
              cCs0|��}|�d�std��|dd�}t|d�S)Nr1z4no newline found when trying to read unicodestringnlrzraw-unicode-escape)r5r6r�strrrrr�read_unicodestringnl[s

rV�unicodestringnlz�A newline-terminated Unicode string.

                      This is raw-unicode-escape encoded, so consists of
                      printable ASCII characters, and may contain embedded
                      escape sequences.
                      cCsBt|�}|�|�}t|�|kr*t|dd�Std|t|�f��dS)N�utf-8�
surrogatepassz9expected %d bytes in a unicodestring1, but only %d remain)r!rr%rUrrErrr�read_unicodestring1us

�rZ�unicodestring1aAA counted Unicode string.

                    The first argument is a 1-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    cCsXt|�}|tjkrtd|��|�|�}t|�|kr@t|dd�Std|t|�f��dS)Nz+unicodestring4 byte count > sys.maxsize: %drXrYz9expected %d bytes in a unicodestring4, but only %d remain)r,rLrMrrr%rUrErrr�read_unicodestring4�s


�r\�unicodestring4aAA counted Unicode string.

                    The first argument is a 4-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    cCsXt|�}|tjkrtd|��|�|�}t|�|kr@t|dd�Std|t|�f��dS)Nz+unicodestring8 byte count > sys.maxsize: %drXrYz9expected %d bytes in a unicodestring8, but only %d remain)r/rLrMrrr%rUrErrr�read_unicodestring8�s


�r^�unicodestring8aBA counted Unicode string.

                    The first argument is an 8-byte little-endian signed int
                    giving the number of bytes in the string, and the second
                    argument-- the UTF-8 encoding of the Unicode string --
                    contains that many bytes.
                    cCs.t|ddd�}|dkrdS|dkr&dSt|�S)NF�r:r;s00s01T�r=�int�r�srrr�read_decimalnl_short�srecCs2t|ddd�}|dd�dkr*|dd�}t|�S)NFr`r�Lrarcrrr�read_decimalnl_longsrg�decimalnl_shorta�A newline-terminated decimal integer literal.

                          This never has a trailing 'L', and the integer fit
                          in a short Python int on the box where the pickle
                          was written -- but there's no guarantee it will fit
                          in a short Python int on the box where the pickle
                          is read.
                          �decimalnl_longz�A newline-terminated decimal integer literal.

                         This has a trailing 'L', and can represent integers
                         of any size.
                         cCst|ddd�}t|�S)NFr`)r=�floatrcrrr�read_floatnl-srk�floatnla�A newline-terminated decimal floating literal.

              In general this requires 17 significant digits for roundtrip
              identity, and pickling then unpickling infinities, NaNs, and
              minus zero doesn't work across boxes, or on some boxes even
              on itself (e.g., Windows can't read the strings it produces
              for infinities or NaNs).
              cCs0|�d�}t|�dkr$td|�dStd��dS)Nr.z>drz(not enough data in stream to read float8r$rrrr�read_float8Cs

rm�float8aAn 8-byte binary representation of a float, big-endian.

             The format is unique to Python, and shared with the struct
             module (format string '>d') "in theory" (the struct and pickle
             implementations don't share the code -- they should).  It's
             strongly related to the IEEE-754 double format, and, in normal
             cases, is in fact identical to the big-endian 754 double format.
             On other boxes the dynamic range is limited to that of a 754
             double, and "add a half and chop" rounding is used to reduce
             the precision to 53 bits.  However, even on a 754 box,
             infinities, NaNs, and minus zero may not be handled correctly
             (may not survive roundtrip pickling intact).
             )�decode_longcCs.t|�}|�|�}t|�|kr&td��t|�S)Nz'not enough data in stream to read long1)r!rr%rrorErrr�
read_long1is

rp�long1aA binary long, little-endian, using 1-byte size.

    This first reads one byte as an unsigned size, then reads that
    many bytes and interprets them as a little-endian 2's-complement long.
    If the size is 0, that's taken as a shortcut for the long 0L.
    cCsBt|�}|dkrtd|��|�|�}t|�|kr:td��t|�S)Nrzlong4 byte count < 0: %dz'not enough data in stream to read long4)r*rrr%rorErrr�
read_long4�s
rr�long4a�A binary representation of a long, little-endian.

    This first reads four bytes as a signed size (but requires the
    size to be >= 0), then reads that many bytes and interprets them
    as a little-endian 2's-complement long.  If the size is 0, that's taken
    as a shortcut for the int 0, although LONG1 should really be used
    then instead (and in any case where # of bytes < 256).
    c@s eZdZdZdd�Zdd�ZdS)�StackObject�r�obtypercCs*||_t|t�r|D]}q||_||_dSr)r�
isinstance�tuplervr)rrrvrZ	containedrrrr�s
zStackObject.__init__cCs|jSr�r)rrrr�__repr__�szStackObject.__repr__N)rrrrrrzrrrrrt�s
rtrbzA Python integer object.ruZint_or_boolz#A Python integer or boolean object.�boolzA Python boolean object.rjzA Python float object.Zbytes_or_strz*A Python bytes or (Unicode) string object.�byteszA Python bytes object.rRzA Python bytearray object.rUz!A Python (Unicode) string object.�NonezThe Python None object.rxzA Python tuple object.�listzA Python list object.�dictzA Python dict object.�setzA Python set object.�	frozensetzA Python frozenset object.�bufferzA Python buffer-like object.�anyzAny kind of object whatsoever.Zmarkaz'The mark' is a unique object.

Opcodes that operate on a variable number of objects
generally don't embed the count of objects in the opcode,
or pull it off the stack.  Instead the MARK opcode is used
to push a special marker object on the stack, and then
some other opcodes grab all the objects from the top of
the stack down to (but not including) the topmost marker
object.
�
stackslicea�An object representing a contiguous slice of the stack.

This is used in conjunction with markobject, to represent all
of the stack following the topmost markobject.  For example,
the POP_MARK opcode changes the stack from

    [..., markobject, stackslice]
to
    [...]

No matter how many object are on the stack after the topmost
markobject, POP_MARK gets rid of all of them (including the
topmost markobject too).
c@seZdZdZdd�ZdS)�
OpcodeInfo�r�code�arg�stack_before�stack_after�protorc	CsB||_||_||_|D]}q||_|D]}q&||_||_||_dSrr�)	rrr�r�r�r�r�r�xrrrrdszOpcodeInfo.__init__Nrrrrrr�Esr�ZINT�Ia�Push an integer or bool.

      The argument is a newline-terminated decimal literal string.

      The intent may have been that this always fit in a short Python int,
      but INT can be generated in pickles written on a 64-bit box that
      require a Python long on a 32-bit box.  The difference between this
      and LONG then is that INT skips a trailing 'L', and produces a short
      int whenever possible.

      Another difference is due to that, when bool was introduced as a
      distinct type in 2.3, builtin names True and False were also added to
      2.2.2, mapping to ints 1 and 0.  For compatibility in both directions,
      True gets pickled as INT + "I01\n", and False as INT + "I00\n".
      Leading zeroes are never produced for a genuine integer.  The 2.3
      (and later) unpicklers special-case these and return bool instead;
      earlier unpicklers ignore the leading "0" and return the int.
      r�ZBININT�Ja1Push a four-byte signed integer.

      This handles the full range of Python (short) integers on a 32-bit
      box, directly as binary bytes (1 for the opcode and 4 for the integer).
      If the integer is non-negative and fits in 1 or 2 bytes, pickling via
      BININT1 or BININT2 saves space.
      ZBININT1�Kz�Push a one-byte unsigned integer.

      This is a space optimization for pickling very small non-negative ints,
      in range(256).
      ZBININT2�Mz�Push a two-byte unsigned integer.

      This is a space optimization for pickling small positive ints, in
      range(256, 2**16).  Integers in range(256) can also be pickled via
      BININT2, but BININT1 instead saves a byte.
      ZLONG�La�Push a long integer.

      The same as INT, except that the literal ends with 'L', and always
      unpickles to a Python long.  There doesn't seem a real purpose to the
      trailing 'L'.

      Note that LONG takes time quadratic in the number of digits when
      unpickling (this is simply due to the nature of decimal->binary
      conversion).  Proto 2 added linear-time (in C; still quadratic-time
      in Python) LONG1 and LONG4 opcodes.
      ZLONG1�Šz|Long integer using one-byte length.

      A more efficient encoding of a Python long; the long1 encoding
      says it all.ZLONG4�‹z~Long integer using found-byte length.

      A more efficient encoding of a Python long; the long4 encoding
      says it all.�STRING�Sa�Push a Python string object.

      The argument is a repr-style string, with bracketing quote characters,
      and perhaps embedded escapes.  The argument extends until the next
      newline character.  These are usually decoded into a str instance
      using the encoding given to the Unpickler constructor. or the default,
      'ASCII'.  If the encoding given was 'bytes' however, they will be
      decoded as bytes object instead.
      Z	BINSTRING�Ta�Push a Python string object.

      There are two arguments: the first is a 4-byte little-endian
      signed int giving the number of bytes in the string, and the
      second is that many bytes, which are taken literally as the string
      content.  These are usually decoded into a str instance using the
      encoding given to the Unpickler constructor. or the default,
      'ASCII'.  If the encoding given was 'bytes' however, they will be
      decoded as bytes object instead.
      ZSHORT_BINSTRING�Ua�Push a Python string object.

      There are two arguments: the first is a 1-byte unsigned int giving
      the number of bytes in the string, and the second is that many
      bytes, which are taken literally as the string content.  These are
      usually decoded into a str instance using the encoding given to
      the Unpickler constructor. or the default, 'ASCII'.  If the
      encoding given was 'bytes' however, they will be decoded as bytes
      object instead.
      ZBINBYTES�B�z�Push a Python bytes object.

      There are two arguments:  the first is a 4-byte little-endian unsigned int
      giving the number of bytes, and the second is that many bytes, which are
      taken literally as the bytes content.
      ZSHORT_BINBYTES�Cz�Push a Python bytes object.

      There are two arguments:  the first is a 1-byte unsigned int giving
      the number of bytes, and the second is that many bytes, which are taken
      literally as the string content.
      Z	BINBYTES8�Žz�Push a Python bytes object.

      There are two arguments:  the first is an 8-byte unsigned int giving
      the number of bytes in the string, and the second is that many bytes,
      which are taken literally as the string content.
      Z
BYTEARRAY8�–�z�Push a Python bytearray object.

      There are two arguments:  the first is an 8-byte unsigned int giving
      the number of bytes in the bytearray, and the second is that many bytes,
      which are taken literally as the bytearray content.
      ZNEXT_BUFFER�—z"Push an out-of-band buffer object.ZREADONLY_BUFFER�˜z,Make an out-of-band buffer object read-only.ZNONE�NzPush None on the stack.ZNEWTRUE�ˆzPush True onto the stack.ZNEWFALSE�‰zPush False onto the stack.�UNICODE�Vz�Push a Python Unicode string object.

      The argument is a raw-unicode-escape encoding of a Unicode string,
      and so may contain embedded escape sequences.  The argument extends
      until the next newline character.
      ZSHORT_BINUNICODE�ŒaPush a Python Unicode string object.

      There are two arguments:  the first is a 1-byte little-endian signed int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      Z
BINUNICODE�XaPush a Python Unicode string object.

      There are two arguments:  the first is a 4-byte little-endian unsigned int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      ZBINUNICODE8�aPush a Python Unicode string object.

      There are two arguments:  the first is an 8-byte little-endian signed int
      giving the number of bytes in the string.  The second is that many
      bytes, and is the UTF-8 encoding of the Unicode string.
      ZFLOAT�Fa�Newline-terminated decimal float literal.

      The argument is repr(a_float), and in general requires 17 significant
      digits for roundtrip conversion to be an identity (this is so for
      IEEE-754 double precision values, which is what Python float maps to
      on most boxes).

      In general, FLOAT cannot be used to transport infinities, NaNs, or
      minus zero across boxes (or even on a single box, if the platform C
      library can't read the strings it produces for such things -- Windows
      is like that), but may do less damage than BINFLOAT on boxes with
      greater precision or dynamic range than IEEE-754 double.
      ZBINFLOAT�Ga�Float stored in binary form, with 8 bytes of data.

      This generally requires less than half the space of FLOAT encoding.
      In general, BINFLOAT cannot be used to transport infinities, NaNs, or
      minus zero, raises an exception if the exponent exceeds the range of
      an IEEE-754 double, and retains no more than 53 bits of precision (if
      there are more than that, "add a half and chop" rounding is used to
      cut it back to 53 significant bits).
      Z
EMPTY_LIST�]zPush an empty list.ZAPPEND�az�Append an object to a list.

      Stack before:  ... pylist anyobject
      Stack after:   ... pylist+[anyobject]

      although pylist is really extended in-place.
      ZAPPENDS�ez�Extend a list by a slice of stack objects.

      Stack before:  ... pylist markobject stackslice
      Stack after:   ... pylist+stackslice

      although pylist is really extended in-place.
      ZLIST�lasBuild a list out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python list, which single list object replaces all of the
      stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... [1, 2, 3, 'abc']
      ZEMPTY_TUPLE�)zPush an empty tuple.ZTUPLE�tavBuild a tuple out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python tuple, which single tuple object replaces all of the
      stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... (1, 2, 3, 'abc')
      ZTUPLE1�…z�Build a one-tuple out of the topmost item on the stack.

      This code pops one value off the stack and pushes a tuple of
      length 1 whose one item is that value back onto it.  In other
      words:

          stack[-1] = tuple(stack[-1:])
      ZTUPLE2�†aBuild a two-tuple out of the top two items on the stack.

      This code pops two values off the stack and pushes a tuple of
      length 2 whose items are those values back onto it.  In other
      words:

          stack[-2:] = [tuple(stack[-2:])]
      ZTUPLE3�‡aBuild a three-tuple out of the top three items on the stack.

      This code pops three values off the stack and pushes a tuple of
      length 3 whose items are those values back onto it.  In other
      words:

          stack[-3:] = [tuple(stack[-3:])]
      Z
EMPTY_DICT�}zPush an empty dict.ZDICT�da�Build a dict out of the topmost stack slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python dict, which single dict object replaces all of the
      stack from the topmost markobject onward.  The stack slice alternates
      key, value, key, value, ....  For example,

      Stack before: ... markobject 1 2 3 'abc'
      Stack after:  ... {1: 2, 3: 'abc'}
      ZSETITEMrdz�Add a key+value pair to an existing dict.

      Stack before:  ... pydict key value
      Stack after:   ... pydict

      where pydict has been modified via pydict[key] = value.
      ZSETITEMS�ua\Add an arbitrary number of key+value pairs to an existing dict.

      The slice of the stack following the topmost markobject is taken as
      an alternating sequence of keys and values, added to the dict
      immediately under the topmost markobject.  Everything at and after the
      topmost markobject is popped, leaving the mutated dict at the top
      of the stack.

      Stack before:  ... pydict markobject key_1 value_1 ... key_n value_n
      Stack after:   ... pydict

      where pydict has been modified via pydict[key_i] = value_i for i in
      1, 2, ..., n, and in that order.
      Z	EMPTY_SET�zPush an empty set.ZADDITEMS�a$Add an arbitrary number of items to an existing set.

      The slice of the stack following the topmost markobject is taken as
      a sequence of items, added to the set immediately under the topmost
      markobject.  Everything at and after the topmost markobject is popped,
      leaving the mutated set at the top of the stack.

      Stack before:  ... pyset markobject item_1 ... item_n
      Stack after:   ... pyset

      where pyset has been modified via pyset.add(item_i) = item_i for i in
      1, 2, ..., n, and in that order.
      Z	FROZENSET�‘azBuild a frozenset out of the topmost slice, after markobject.

      All the stack entries following the topmost markobject are placed into
      a single Python frozenset, which single frozenset object replaces all
      of the stack from the topmost markobject onward.  For example,

      Stack before: ... markobject 1 2 3
      Stack after:  ... frozenset({1, 2, 3})
      �POP�0z<Discard the top stack item, shrinking the stack by one item.ZDUP�2z=Push the top stack item onto the stack again, duplicating it.�MARK�(z�Push markobject onto the stack.

      markobject is a unique object, used by other opcodes to identify a
      region of the stack containing a variable number of objects for them
      to work on.  See markobject.doc for more detail.
      ZPOP_MARK�1aPop all the stack objects at and above the topmost markobject.

      When an opcode using a variable number of stack objects is done,
      POP_MARK is used to remove those objects, and to remove the markobject
      that delimited their starting position on the stack.
      �GET�gz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the newline-terminated
      decimal string following.  BINGET and LONG_BINGET are space-optimized
      versions.
      �BINGET�hz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the 1-byte unsigned
      integer following.
      �LONG_BINGET�jz�Read an object from the memo and push it on the stack.

      The index of the memo object to push is given by the 4-byte unsigned
      little-endian integer following.
      �PUT�pz�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the newline-
      terminated decimal string following.  BINPUT and LONG_BINPUT are
      space-optimized versions.
      �BINPUTr<z�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the 1-byte
      unsigned integer following.
      �LONG_BINPUT�rz�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write into is given by the 4-byte
      unsigned little-endian integer following.
      �MEMOIZE�”z�Store the stack top into the memo.  The stack is not popped.

      The index of the memo location to write is the number of
      elements currently present in the memo.
      ZEXT1�‚a�Extension code.

      This code and the similar EXT2 and EXT4 allow using a registry
      of popular objects that are pickled by name, typically classes.
      It is envisioned that through a global negotiation and
      registration process, third parties can set up a mapping between
      ints and object names.

      In order to guarantee pickle interchangeability, the extension
      code registry ought to be global, although a range of codes may
      be reserved for private use.

      EXT1 has a 1-byte integer argument.  This is used to index into the
      extension registry, and the object at that index is pushed on the stack.
      ZEXT2�ƒzNExtension code.

      See EXT1.  EXT2 has a two-byte integer argument.
      ZEXT4�„zOExtension code.

      See EXT1.  EXT4 has a four-byte integer argument.
      ZGLOBAL�ca�Push a global object (module.attr) on the stack.

      Two newline-terminated strings follow the GLOBAL opcode.  The first is
      taken as a module name, and the second as a class name.  The class
      object module.class is pushed on the stack.  More accurately, the
      object returned by self.find_class(module, class) is pushed on the
      stack, so unpickling subclasses can override this form of lookup.
      ZSTACK_GLOBAL�“z7Push a global object (module.attr) on the stack.
      ZREDUCE�RaLPush an object built from a callable and an argument tuple.

      The opcode is named to remind of the __reduce__() method.

      Stack before: ... callable pytuple
      Stack after:  ... callable(*pytuple)

      The callable and the argument tuple are the first two items returned
      by a __reduce__ method.  Applying the callable to the argtuple is
      supposed to reproduce the original object, or at least get it started.
      If the __reduce__ method returns a 3-tuple, the last component is an
      argument to be passed to the object's __setstate__, and then the REDUCE
      opcode is followed by code to create setstate's argument, and then a
      BUILD opcode to apply  __setstate__ to that argument.

      If not isinstance(callable, type), REDUCE complains unless the
      callable has been registered with the copyreg module's
      safe_constructors dict, or the callable has a magic
      '__safe_for_unpickling__' attribute with a true value.  I'm not sure
      why it does this, but I've sure seen this complaint often enough when
      I didn't want to <wink>.
      ZBUILD�ba�Finish building an object, via __setstate__ or dict update.

      Stack before: ... anyobject argument
      Stack after:  ... anyobject

      where anyobject may have been mutated, as follows:

      If the object has a __setstate__ method,

          anyobject.__setstate__(argument)

      is called.

      Else the argument must be a dict, the object must have a __dict__, and
      the object is updated via

          anyobject.__dict__.update(argument)
      ZINST�iaqBuild a class instance.

      This is the protocol 0 version of protocol 1's OBJ opcode.
      INST is followed by two newline-terminated strings, giving a
      module and class name, just as for the GLOBAL opcode (and see
      GLOBAL for more details about that).  self.find_class(module, name)
      is used to get a class object.

      In addition, all the objects on the stack following the topmost
      markobject are gathered into a tuple and popped (along with the
      topmost markobject), just as for the TUPLE opcode.

      Now it gets complicated.  If all of these are true:

        + The argtuple is empty (markobject was at the top of the stack
          at the start).

        + The class object does not have a __getinitargs__ attribute.

      then we want to create an old-style class instance without invoking
      its __init__() method (pickle has waffled on this over the years; not
      calling __init__() is current wisdom).  In this case, an instance of
      an old-style dummy class is created, and then we try to rebind its
      __class__ attribute to the desired class object.  If this succeeds,
      the new instance object is pushed on the stack, and we're done.

      Else (the argtuple is not empty, it's not an old-style class object,
      or the class object does have a __getinitargs__ attribute), the code
      first insists that the class object have a __safe_for_unpickling__
      attribute.  Unlike as for the __safe_for_unpickling__ check in REDUCE,
      it doesn't matter whether this attribute has a true or false value, it
      only matters whether it exists (XXX this is a bug).  If
      __safe_for_unpickling__ doesn't exist, UnpicklingError is raised.

      Else (the class object does have a __safe_for_unpickling__ attr),
      the class object obtained from INST's arguments is applied to the
      argtuple obtained from the stack, and the resulting instance object
      is pushed on the stack.

      NOTE:  checks for __safe_for_unpickling__ went away in Python 2.3.
      NOTE:  the distinction between old-style and new-style classes does
             not make sense in Python 3.
      ZOBJ�oa�Build a class instance.

      This is the protocol 1 version of protocol 0's INST opcode, and is
      very much like it.  The major difference is that the class object
      is taken off the stack, allowing it to be retrieved from the memo
      repeatedly if several instances of the same class are created.  This
      can be much more efficient (in both time and space) than repeatedly
      embedding the module and class names in INST opcodes.

      Unlike INST, OBJ takes no arguments from the opcode stream.  Instead
      the class object is taken off the stack, immediately above the
      topmost markobject:

      Stack before: ... markobject classobject stackslice
      Stack after:  ... new_instance_object

      As for INST, the remainder of the stack above the markobject is
      gathered into an argument tuple, and then the logic seems identical,
      except that no __safe_for_unpickling__ check is done (XXX this is
      a bug).  See INST for the gory details.

      NOTE:  In Python 2.3, INST and OBJ are identical except for how they
      get the class object.  That was always the intent; the implementations
      had diverged for accidental reasons.
      ZNEWOBJ�aLBuild an object instance.

      The stack before should be thought of as containing a class
      object followed by an argument tuple (the tuple being the stack
      top).  Call these cls and args.  They are popped off the stack,
      and the value returned by cls.__new__(cls, *args) is pushed back
      onto the stack.
      Z	NEWOBJ_EX�’auBuild an object instance.

      The stack before should be thought of as containing a class
      object followed by an argument tuple and by a keyword argument dict
      (the dict being the stack top).  Call these cls and args.  They are
      popped off the stack, and the value returned by
      cls.__new__(cls, *args, *kwargs) is  pushed back  onto the stack.
      �PROTO�€z�Protocol version indicator.

      For protocol 2 and above, a pickle must start with this opcode.
      The argument is the protocol version, an int in range(2, 256).
      ZSTOP�.z�Stop the unpickling machine.

      Every pickle ends with this opcode.  The object at the top of the stack
      is popped, and that's the result of unpickling.  The stack should be
      empty then.
      �FRAME�•z�Indicate the beginning of a new frame.

      The unpickler may use this opcode to safely prefetch data from its
      underlying stream.
      ZPERSID�PaPush an object identified by a persistent ID.

      The pickle module doesn't define what a persistent ID means.  PERSID's
      argument is a newline-terminated str-style (no embedded escapes, no
      bracketing quote characters) string, which *is* "the persistent ID".
      The unpickler passes this string to self.persistent_load().  Whatever
      object that returns is pushed on the stack.  There is no implementation
      of persistent_load() in Python's unpickler:  it must be supplied by an
      unpickler subclass.
      Z	BINPERSID�QaXPush an object identified by a persistent ID.

      Like PERSID, except the persistent ID is popped off the stack (instead
      of being a string embedded in the opcode bytestream).  The persistent
      ID is passed to self.persistent_load(), and whatever object that
      returns is pushed on the stack.  See PERSID for more detail.
      z%repeated name %r at indices %d and %dz%repeated code %r at indices %d and %dFcCst��}tjD]�}t�d|�s0|rtd|�qtt|�}t|t	�rPt
|�dkrf|rtd||f�q|�d�}||kr�|r�td||f�||}|j|kr�t
d|||jf��||=qt
d||f��q|�rd	g}|��D]\}}|�d
|j|f�q�t
d�|���dS)Nz[A-Z][A-Z0-9_]+$z0skipping %r: it doesn't look like an opcode namerz5skipping %r: value %r doesn't look like a pickle coderDz+checking name %r w/ code %r for consistencyzBfor pickle code %r, pickle.py uses name %r but we're using name %rzPpickle.py appears to have a pickle opcode with name %r and code %r, but we don'tz=we appear to have pickle opcodes that pickle.py doesn't have:z    name %r with code %r�
)�code2op�copy�pickle�__all__�re�match�print�getattrrwr|r%r:rr�items�append�join)�verboser�rZ
picklecoder��msgr�rrr�assure_pickle_consistency�sJ

�
�
���r�ccs�t|t�rt�|�}t|d�r&|j}ndd�}|�}|�d�}t�|�	d��}|dkr�|dkrht
d��nt
d|dkrxd	n||f��|jdkr�d}n|j�|�}|r�||||�fVn|||fV|d
kr.q�q.dS)N�tellcSsdSrrrrrr�<lambda>��z_genops.<locals>.<lambda>rrDr�z#pickle exhausted before seeing STOPz!at position %s, opcode %r unknownz	<unknown>�.)
rw�bytes_types�io�BytesIO�hasattrr�rr��getr:rr�r)r �
yield_end_posZgetpos�posr��opcoder�rrr�_genops�s.




�
r�cCst|�Sr)r�)r�rrrr�scCsd}d}t�}i}g}d}d}t|dd�D]�\}}	}
}d|jkrZ|�|	�|�||	f�q*|jdkr�t|�}|�|�|�||f�q*d|jkr�q*d|jkr�|j|kr�|j}d||	<|�||	f�q*|jd	k�r|	|kr�|	}|
dkr�||
|�}n|�|
|f�q*|�|
|f�q*~t��}
|
�	|�t
�|
|�}|d
k�rF|j�
�d}|D]�\}}	d}||k�r�|	|k�rr�qN|�|�}|||	<|d7}n6||k�r�|�||	�}n|||	�}t|�|jjk}|jj|d
�|�r�|j�|�n
|�	|��qN|j��|
��S)Nr�r�rr�T)r�r�r�r�r)Fr)Zforce)r�r�r�addr�r%r�r�r��writer�Z_PicklerZframerZ
start_framing�putr�Z_FRAME_SIZE_TARGETZcommit_frameZ
file_writeZend_framing�getvalue)r�r�r�ZoldidsZnewids�opcodesr�Zprotoheaderr�r�r�Zend_pos�idx�outZpickler�opZ	framelessr rrrr	sl















c	Csg}|dkri}d}g}d|}d}	|}
t|�D�]�\}}}
|
dk	rVtd|
d|d�dt|j�dd�|t|�|jf}t||j�}|j}|j	}t|�}d}t
|ks�|jdk�r@|�r@|dt
k�r@|�r8|��}|dkr�d}nd	|}|dt
k	�r|��q�|��z|�t
�}Wnt
k
�r4d
}YnXnd}	}|jdk�r�|jd
k�rjt|�}d|}n|}||k�r�d|}	n,|�s�d}	n |dt
k�r�d}	n|d||<n*|jdk�r�||k�r�||g}nd|}	|dk	�s�|�r,|ddt|j�7}|dk	�r|dt|�7}|�r,|d|7}|�rv|d|
t|�7}t|�}
|
dk�r\|}
|d|j�dd�d
7}t||d�|	�r�t
|	��t|�|k�r�t
d|t|�f��|�r�||d�=t
|k�r�|�|
�|�|�q0td||d�|�rt
d|��dS)Nr� z%5d:)�end�filez	%-4s %s%srr�z(MARK at unknown opcode offset)z(MARK at %d)rzno MARK exists on stack)r�r�r�r�r�z(as %d)zmemo key %r already definedz'stack is empty -- can't store into memoz"can't store markobject in the memo)r�r�r�z&memo key %r has never been stored into�
�2r�)rz3tries to pop %d items from stack with only %d itemsz highest protocol among opcodes =zstack not empty after STOP: %r)rr��reprr�r%r�maxr�r�r��
markobject�pop�indexrr�splitr��extend)r�r�memo�indentlevel�annotate�stackZmaxprotoZ	markstackZindentchunkZerrormsgZannocolr�r�r��lineZbeforeZafterZnumtopopZmarkmsgZmarkposZmemo_idxrrrr[	s�-
��
�







�

c@seZdZdd�ZdS)�_ExamplecCs
||_dSr)�value)rrrrrr�	sz_Example.__init__N)rrrrrrrrr�	sra�
>>> import pickle
>>> x = [1, 2, (3, 4), {b'abc': "def"}]
>>> pkl0 = pickle.dumps(x, 0)
>>> dis(pkl0)
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: I    INT        1
    8: a    APPEND
    9: I    INT        2
   12: a    APPEND
   13: (    MARK
   14: I        INT        3
   17: I        INT        4
   20: t        TUPLE      (MARK at 13)
   21: p    PUT        1
   24: a    APPEND
   25: (    MARK
   26: d        DICT       (MARK at 25)
   27: p    PUT        2
   30: c    GLOBAL     '_codecs encode'
   46: p    PUT        3
   49: (    MARK
   50: V        UNICODE    'abc'
   55: p        PUT        4
   58: V        UNICODE    'latin1'
   66: p        PUT        5
   69: t        TUPLE      (MARK at 49)
   70: p    PUT        6
   73: R    REDUCE
   74: p    PUT        7
   77: V    UNICODE    'def'
   82: p    PUT        8
   85: s    SETITEM
   86: a    APPEND
   87: .    STOP
highest protocol among opcodes = 0

Try again with a "binary" pickle.

>>> pkl1 = pickle.dumps(x, 1)
>>> dis(pkl1)
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: K        BININT1    1
    6: K        BININT1    2
    8: (        MARK
    9: K            BININT1    3
   11: K            BININT1    4
   13: t            TUPLE      (MARK at 8)
   14: q        BINPUT     1
   16: }        EMPTY_DICT
   17: q        BINPUT     2
   19: c        GLOBAL     '_codecs encode'
   35: q        BINPUT     3
   37: (        MARK
   38: X            BINUNICODE 'abc'
   46: q            BINPUT     4
   48: X            BINUNICODE 'latin1'
   59: q            BINPUT     5
   61: t            TUPLE      (MARK at 37)
   62: q        BINPUT     6
   64: R        REDUCE
   65: q        BINPUT     7
   67: X        BINUNICODE 'def'
   75: q        BINPUT     8
   77: s        SETITEM
   78: e        APPENDS    (MARK at 3)
   79: .    STOP
highest protocol among opcodes = 1

Exercise the INST/OBJ/BUILD family.

>>> import pickletools
>>> dis(pickle.dumps(pickletools.dis, 0))
    0: c    GLOBAL     'pickletools dis'
   17: p    PUT        0
   20: .    STOP
highest protocol among opcodes = 0

>>> from pickletools import _Example
>>> x = [_Example(42)] * 2
>>> dis(pickle.dumps(x, 0))
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: c    GLOBAL     'copy_reg _reconstructor'
   30: p    PUT        1
   33: (    MARK
   34: c        GLOBAL     'pickletools _Example'
   56: p        PUT        2
   59: c        GLOBAL     '__builtin__ object'
   79: p        PUT        3
   82: N        NONE
   83: t        TUPLE      (MARK at 33)
   84: p    PUT        4
   87: R    REDUCE
   88: p    PUT        5
   91: (    MARK
   92: d        DICT       (MARK at 91)
   93: p    PUT        6
   96: V    UNICODE    'value'
  103: p    PUT        7
  106: I    INT        42
  110: s    SETITEM
  111: b    BUILD
  112: a    APPEND
  113: g    GET        5
  116: a    APPEND
  117: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(x, 1))
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: c        GLOBAL     'copy_reg _reconstructor'
   29: q        BINPUT     1
   31: (        MARK
   32: c            GLOBAL     'pickletools _Example'
   54: q            BINPUT     2
   56: c            GLOBAL     '__builtin__ object'
   76: q            BINPUT     3
   78: N            NONE
   79: t            TUPLE      (MARK at 31)
   80: q        BINPUT     4
   82: R        REDUCE
   83: q        BINPUT     5
   85: }        EMPTY_DICT
   86: q        BINPUT     6
   88: X        BINUNICODE 'value'
   98: q        BINPUT     7
  100: K        BININT1    42
  102: s        SETITEM
  103: b        BUILD
  104: h        BINGET     5
  106: e        APPENDS    (MARK at 3)
  107: .    STOP
highest protocol among opcodes = 1

Try "the canonical" recursive-object test.

>>> L = []
>>> T = L,
>>> L.append(T)
>>> L[0] is T
True
>>> T[0] is L
True
>>> L[0][0] is L
True
>>> T[0][0] is T
True
>>> dis(pickle.dumps(L, 0))
    0: (    MARK
    1: l        LIST       (MARK at 0)
    2: p    PUT        0
    5: (    MARK
    6: g        GET        0
    9: t        TUPLE      (MARK at 5)
   10: p    PUT        1
   13: a    APPEND
   14: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(L, 1))
    0: ]    EMPTY_LIST
    1: q    BINPUT     0
    3: (    MARK
    4: h        BINGET     0
    6: t        TUPLE      (MARK at 3)
    7: q    BINPUT     1
    9: a    APPEND
   10: .    STOP
highest protocol among opcodes = 1

Note that, in the protocol 0 pickle of the recursive tuple, the disassembler
has to emulate the stack in order to realize that the POP opcode at 16 gets
rid of the MARK at 0.

>>> dis(pickle.dumps(T, 0))
    0: (    MARK
    1: (        MARK
    2: l            LIST       (MARK at 1)
    3: p        PUT        0
    6: (        MARK
    7: g            GET        0
   10: t            TUPLE      (MARK at 6)
   11: p        PUT        1
   14: a        APPEND
   15: 0        POP
   16: 0        POP        (MARK at 0)
   17: g    GET        1
   20: .    STOP
highest protocol among opcodes = 0

>>> dis(pickle.dumps(T, 1))
    0: (    MARK
    1: ]        EMPTY_LIST
    2: q        BINPUT     0
    4: (        MARK
    5: h            BINGET     0
    7: t            TUPLE      (MARK at 4)
    8: q        BINPUT     1
   10: a        APPEND
   11: 1        POP_MARK   (MARK at 0)
   12: h    BINGET     1
   14: .    STOP
highest protocol among opcodes = 1

Try protocol 2.

>>> dis(pickle.dumps(L, 2))
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: h    BINGET     0
    7: \x85 TUPLE1
    8: q    BINPUT     1
   10: a    APPEND
   11: .    STOP
highest protocol among opcodes = 2

>>> dis(pickle.dumps(T, 2))
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: h    BINGET     0
    7: \x85 TUPLE1
    8: q    BINPUT     1
   10: a    APPEND
   11: 0    POP
   12: h    BINGET     1
   14: .    STOP
highest protocol among opcodes = 2

Try protocol 3 with annotations:

>>> dis(pickle.dumps(T, 3), annotate=1)
    0: \x80 PROTO      3 Protocol version indicator.
    2: ]    EMPTY_LIST   Push an empty list.
    3: q    BINPUT     0 Store the stack top into the memo.  The stack is not popped.
    5: h    BINGET     0 Read an object from the memo and push it on the stack.
    7: \x85 TUPLE1       Build a one-tuple out of the topmost item on the stack.
    8: q    BINPUT     1 Store the stack top into the memo.  The stack is not popped.
   10: a    APPEND       Append an object to a list.
   11: 0    POP          Discard the top stack item, shrinking the stack by one item.
   12: h    BINGET     1 Read an object from the memo and push it on the stack.
   14: .    STOP         Stop the unpickling machine.
highest protocol among opcodes = 2

a=
>>> import pickle
>>> import io
>>> f = io.BytesIO()
>>> p = pickle.Pickler(f, 2)
>>> x = [1, 2, 3]
>>> p.dump(x)
>>> p.dump(x)
>>> f.seek(0)
0
>>> memo = {}
>>> dis(f, memo=memo)
    0: \x80 PROTO      2
    2: ]    EMPTY_LIST
    3: q    BINPUT     0
    5: (    MARK
    6: K        BININT1    1
    8: K        BININT1    2
   10: K        BININT1    3
   12: e        APPENDS    (MARK at 5)
   13: .    STOP
highest protocol among opcodes = 2
>>> dis(f, memo=memo)
   14: \x80 PROTO      2
   16: h    BINGET     0
   18: .    STOP
highest protocol among opcodes = 2
)Zdisassembler_testZdisassembler_memo_testcCsddl}|��S)Nr)�doctestZtestmod)rrrr�_testsr�__main__z$disassemble one or more pickle files)Zdescription�pickle_file�br�*zthe pickle file)�type�nargs�helpz-oz--output�wz+the file where the output should be written)�defaultrrz-mz--memo�
store_truez#preserve memo between disassemblies)�actionrz-lz
--indentlevelz8the number of blanks by which to indent a new MARK levelz-az
--annotatez2annotate each line with a short opcode descriptionz-pz
--preamblez==> {name} <==zMif more than one pickle file is specified, print this before each disassembly)rrz-tz--testzrun self-test suitez-vz)run verbosely; only affects self-test run�ryr�)TT)F)F)NNr)r)�r8r�r�r�rLr�r�Z
UP_TO_NEWLINEZTAKEN_FROM_ARGUMENT1ZTAKEN_FROM_ARGUMENT4ZTAKEN_FROM_ARGUMENT4UZTAKEN_FROM_ARGUMENT8U�objectr
Zstructrr&r!r"r'r(r*r+r,r-r/r0r=r>r@rArBrCrFrGrHrIrJrKrNrOrPrQrSrTrVrWrZr[r\r]r^r_rergrhrirkrlrmrnrorprqrrrsrtrbZpyintZpylongr{Zpyinteger_or_boolZpyboolrjZpyfloatr|rUZpybytes_or_strZpystringZpybytesrRZpybytearrayZ	pyunicoderZpynonerxZpytupler~ZpylistrZpydictr�ZpysetZpyfrozensetZpybufferZ	anyobjectr	r�r�r�r�Zname2iZcode2i�	enumerater�r�rrr�r�r�r�rrrrZ	_dis_testZ
_memo_testZ__test__rr�argparse�ArgumentParser�parser�add_argumentZFileType�stdout�
parse_args�argsZtestrrZ
print_helpr%�outputrrrZpreamble�formatr�rrrr�<module>
s^
$�����/�
�	�������
��
�
�
�
�	�
����
����
�������������;����
���
����
�
����
���
�
�
�
����������������������
��
���
�����������2� ������������������
& 

C��
�
�������
�
copyreg.cpython-38.pyc000064400000010340150335716500010647 0ustar00U

e5d��@s�dZdddddgZiZddd�Zdd�ZzeWnek
rDYnXd	d
�Zeeee�dd�Zd
Z	dd�Z
dd�Zdd�Zdd�Z
iZiZiZdd�Zdd�Zdd�ZdS)z�Helper to provide extensibility for pickle.

This is only useful to add pickle support for extension types defined in
C, not for instances of user-defined classes.
�pickle�constructor�
add_extension�remove_extension�clear_extension_cacheNcCs,t|�std��|t|<|dk	r(t|�dS)Nz$reduction functions must be callable)�callable�	TypeError�dispatch_tabler)�ob_type�pickle_function�constructor_ob�r�/usr/lib64/python3.8/copyreg.pyrs
cCst|�std��dS)Nzconstructors must be callable)rr)�objectrrr
rscCst|j|jffS�N)�complex�real�imag)�crrr
�pickle_complex"srcCs<|tkrt�|�}n$|�||�}|jtjkr8|�||�|Sr)r�__new__�__init__)�cls�base�state�objrrr
�_reconstructor)sricCs�|dkst�|j}|jD]}t|d�r|jt@sq:qt}|tkrHd}n"||krbtd|j�d���||�}|||f}z
|j	}Wn\t
k
r�t|dd�r�td|j�d|���d�z
|j}Wnt
k
r�d}YnXYnX|�}|r�t
||fSt
|fSdS)N��	__flags__zcannot pickle z object�	__slots__zf object: a class that defines __slots__ without defining __getstate__ cannot be pickled with protocol )�AssertionError�	__class__�__mro__�hasattrr�	_HEAPTYPErr�__name__�__getstate__�AttributeError�getattr�__dict__r)�self�protorrr�args�getstate�dictrrr
�
_reduce_ex6s6


�

r.cGs|j|f|��Sr�r)rr+rrr
�
__newobj__Zsr0cCs|j|f|�|�S)zUsed by pickle protocol 4, instead of __newobj__ to allow classes with
    keyword-only arguments to be pickled correctly.
    r/)rr+�kwargsrrr
�
__newobj_ex__]sr2cCs�|j�d�}|dk	r|Sg}t|d�s(n�|jD]�}d|jkr.|jd}t|t�rV|f}|D]^}|dkrjqZqZ|�d�r�|�d�s�|j�	d�}|r�|�
d||f�q�|�
|�qZ|�
|�qZq.z
||_WnYnX|S)a�Return a list of slot names for a given class.

    This needs to find slots defined by the class and its bases, so we
    can't simply return the __slots__ attribute.  We must walk down
    the Method Resolution Order and concatenate the __slots__ of each
    class found there.  (This assumes classes don't modify their
    __slots__ attribute to misrepresent their slots after the class is
    defined.)
    �
__slotnames__Nr)r(�__weakref__�__�_z_%s%s)r(�getr"r!�
isinstance�str�
startswith�endswithr$�lstrip�appendr3)r�namesr�slots�name�strippedrrr
�
_slotnamescs2





rBcCs�t|�}d|krdks&ntd��||f}t�|�|krNt�|�|krNdS|tkrjtd|t|f��|tkr�td|t|f��|t|<|t|<dS)zRegister an extension code.�i���zcode out of rangeNz)key %s is already registered with code %sz$code %s is already in use for key %s)�int�
ValueError�_extension_registryr7�_inverted_registry��moduler@�code�keyrrr
r�s$�
�
�cCsR||f}t�|�|ks$t�|�|kr4td||f��t|=t|=|tkrNt|=dS)z0Unregister an extension code.  For testing only.z%key %s is not registered with code %sN)rFr7rGrE�_extension_cacherHrrr
r�s��cCst��dSr)rL�clearrrrr
r�s)N)�__doc__�__all__rrrr�	NameErrorrrr#r.r0r2rBrFrGrLrrrrrrr
�<module>s4�

	$<queue.cpython-38.opt-1.pyc000064400000024604150335716500011272 0ustar00U

e5d\,�@sdZddlZddlmZddlmZmZddlmZzddl	m
Z
Wnek
r\dZ
YnXddd	d
ddgZzdd
l	m
Z
Wn$ek
r�Gdd�de�Z
YnXGdd�de�ZGdd	�d	�ZGdd
�d
e�ZGdd�de�ZGdd�d�Ze
dkr�eZ
dS)z'A multi-producer, multi-consumer queue.�N)�deque)�heappush�heappop)�	monotonic)�SimpleQueue�Empty�Full�Queue�
PriorityQueue�	LifoQueuer)rc@seZdZdZdS)rz4Exception raised by Queue.get(block=0)/get_nowait().N��__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.8/queue.pyrsc@seZdZdZdS)rz4Exception raised by Queue.put(block=0)/put_nowait().Nrrrrrrsc@s�eZdZdZd!dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	d"dd�Z
d#dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �ZdS)$r	zjCreate a queue object with a given maximum size.

    If maxsize is <= 0, the queue size is infinite.
    rcCsN||_|�|�t��|_t�|j�|_t�|j�|_t�|j�|_d|_	dS�Nr)
�maxsize�_init�	threadingZLock�mutexZ	Condition�	not_empty�not_full�all_tasks_done�unfinished_tasks��selfrrrr�__init__!s

zQueue.__init__c	CsH|j�8|jd}|dkr4|dkr*td��|j��||_W5QRXdS)a.Indicate that a formerly enqueued task is complete.

        Used by Queue consumer threads.  For each get() used to fetch a task,
        a subsequent call to task_done() tells the queue that the processing
        on the task is complete.

        If a join() is currently blocking, it will resume when all items
        have been processed (meaning that a task_done() call was received
        for every item that had been put() into the queue).

        Raises a ValueError if called more times than there were items
        placed in the queue.
        �rz!task_done() called too many timesN)rr�
ValueErrorZ
notify_all)rZ
unfinishedrrr�	task_done8s

zQueue.task_donec	Cs(|j�|jr|j��qW5QRXdS)a�Blocks until all items in the Queue have been gotten and processed.

        The count of unfinished tasks goes up whenever an item is added to the
        queue. The count goes down whenever a consumer thread calls task_done()
        to indicate the item was retrieved and all work on it is complete.

        When the count of unfinished tasks drops to zero, join() unblocks.
        N)rr�wait�rrrr�joinNs	z
Queue.joinc
Cs&|j�|��W5QR�SQRXdS)�9Return the approximate size of the queue (not reliable!).N�r�_qsizer#rrr�qsize[szQueue.qsizec
Cs(|j�|��W5QR�SQRXdS)a�Return True if the queue is empty, False otherwise (not reliable!).

        This method is likely to be removed at some point.  Use qsize() == 0
        as a direct substitute, but be aware that either approach risks a race
        condition where a queue can grow before the result of empty() or
        qsize() can be used.

        To create code that needs to wait for all queued tasks to be
        completed, the preferred technique is to use the join() method.
        Nr&r#rrr�empty`szQueue.emptyc
Cs<|j�,d|jko |��knW5QR�SQRXdS)aOReturn True if the queue is full, False otherwise (not reliable!).

        This method is likely to be removed at some point.  Use qsize() >= n
        as a direct substitute, but be aware that either approach risks a race
        condition where a queue can shrink before the result of full() or
        qsize() can be used.
        rN)rrr'r#rrr�fullnsz
Queue.fullTNc	Cs�|j��|jdkr�|s*|��|jkr�t�nr|dkrN|��|jkr�|j��q2nN|dkr`td��n<t�|}|��|jkr�|t�}|dkr�t�|j�|�qj|�|�|jd7_|j	�
�W5QRXdS)aPut an item into the queue.

        If optional args 'block' is true and 'timeout' is None (the default),
        block if necessary until a free slot is available. If 'timeout' is
        a non-negative number, it blocks at most 'timeout' seconds and raises
        the Full exception if no free slot was available within that time.
        Otherwise ('block' is false), put an item on the queue if a free slot
        is immediately available, else raise the Full exception ('timeout'
        is ignored in that case).
        rN�''timeout' must be a non-negative number�r)rrr'rr"r �time�_putrr�notify)r�item�block�timeout�endtime�	remainingrrr�putys&




z	Queue.putc
Cs�|j��|s|��s�t�nf|dkr8|��s�|j��q"nH|dkrJtd��n6t�|}|��s�|t�}|dkrrt�|j�|�qT|��}|j��|W5QR�SQRXdS)�Remove and return an item from the queue.

        If optional args 'block' is true and 'timeout' is None (the default),
        block if necessary until an item is available. If 'timeout' is
        a non-negative number, it blocks at most 'timeout' seconds and raises
        the Empty exception if no item was available within that time.
        Otherwise ('block' is false), return an item if one is immediately
        available, else raise the Empty exception ('timeout' is ignored
        in that case).
        Nrr+r,)	rr'rr"r r-�_getrr/)rr1r2r3r4r0rrr�get�s$



z	Queue.getcCs|j|dd�S)z�Put an item into the queue without blocking.

        Only enqueue the item if a free slot is immediately available.
        Otherwise raise the Full exception.
        F�r1�r5�rr0rrr�
put_nowait�szQueue.put_nowaitcCs|jdd�S�z�Remove and return an item from the queue without blocking.

        Only get an item if one is immediately available. Otherwise
        raise the Empty exception.
        Fr9�r8r#rrr�
get_nowait�szQueue.get_nowaitcCst�|_dS�N)r�queuerrrrr�szQueue._initcCs
t|j�Sr@��lenrAr#rrrr'�szQueue._qsizecCs|j�|�dSr@�rA�appendr;rrrr.�sz
Queue._putcCs
|j��Sr@)rA�popleftr#rrrr7�sz
Queue._get)r)TN)TN)r
rrrrr!r$r(r)r*r5r8r<r?rr'r.r7rrrrr	s


 

c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r
z�Variant of Queue that retrieves open entries in priority order (lowest first).

    Entries are typically tuples of the form:  (priority number, data).
    cCs
g|_dSr@�rArrrrr�szPriorityQueue._initcCs
t|j�Sr@rBr#rrrr'�szPriorityQueue._qsizecCst|j|�dSr@)rrAr;rrrr.�szPriorityQueue._putcCs
t|j�Sr@)rrAr#rrrr7�szPriorityQueue._getN�r
rrrrr'r.r7rrrrr
�s
c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)rzBVariant of Queue that retrieves most recently added entries first.cCs
g|_dSr@rGrrrrr�szLifoQueue._initcCs
t|j�Sr@rBr#rrrr'�szLifoQueue._qsizecCs|j�|�dSr@rDr;rrrr.�szLifoQueue._putcCs
|j��Sr@)rA�popr#rrrr7�szLifoQueue._getNrHrrrrr�s
c@sLeZdZdZdd�Zddd�Zddd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dS)�_PySimpleQueuezYSimple, unbounded FIFO queue.

    This pure Python implementation is not reentrant.
    cCst�|_t�d�|_dSr)r�_queuerZ	Semaphore�_countr#rrrr	sz_PySimpleQueue.__init__TNcCs|j�|�|j��dS)z�Put the item on the queue.

        The optional 'block' and 'timeout' arguments are ignored, as this method
        never blocks.  They are provided for compatibility with the Queue class.
        N)rKrErL�release)rr0r1r2rrrr5
sz_PySimpleQueue.putcCs4|dk	r|dkrtd��|j�||�s*t�|j��S)r6Nrr+)r rL�acquirerrKrF)rr1r2rrrr8s
z_PySimpleQueue.getcCs|j|dd�S)z�Put an item into the queue without blocking.

        This is exactly equivalent to `put(item)` and is only provided
        for compatibility with the Queue class.
        Fr9r:r;rrrr<'sz_PySimpleQueue.put_nowaitcCs|jdd�Sr=r>r#rrrr?/sz_PySimpleQueue.get_nowaitcCst|j�dkS)zCReturn True if the queue is empty, False otherwise (not reliable!).r�rCrKr#rrrr)7sz_PySimpleQueue.emptycCs
t|j�S)r%rOr#rrrr(;sz_PySimpleQueue.qsize)TN)TN)r
rrrrr5r8r<r?r)r(rrrrrJ�s	
	
rJ)rr�collectionsr�heapqrrr-rrKr�ImportError�__all__r�	Exceptionrr	r
rrJrrrr�<module>s*
BAdoctest.cpython-38.opt-2.pyc000064400000116753150335716500011623 0ustar00U

e5d_��!@spdZddddddddd	d
ddd
ddddddddddddddddddd d!g!Zd"d#lZd"d#lZd"d#lZd"d#lZd"d#lZd"d#lZd"d#lZd"d#l	Z	d"d#l
Z
d"d#lZd"d$lm
Z
d"d%lmZed&d'�ZiZd(d�Zed�Zed�Zed�Zed�Zed�Zed�ZeeBeBeBeBeBZed	�Zed
�Zed�Zed�Zed�ZeeBeBeBeBZd)Z d*Z!d+d,�Z"drd.d/�Z#d0d1�Z$d2d3�Z%dsd5d6�Z&d7d8�Z'Gd9d:�d:e
�Z(d;d<�Z)d=d>�Z*d?d@�Z+GdAdB�dBej,�Z-dCdD�Z.GdEd�d�Z/GdFd�d�Z0GdGd�d�Z1GdHd�d�Z2GdId�d�Z3GdJd�d�Z4GdKd�de5�Z6GdLd�de5�Z7GdMd�de3�Z8d#a9dtdPd�Z:dNd#d#d#d#dNd"d#dOe1�d#fdQd�Z;dudSd�Z<d"a=dTd�Z>GdUdV�dVej?�Z@GdWdX�dXe@�ZAGdYdZ�dZejB�ZCdvd[d�ZDGd\d]�d]e@�ZEdNd#d#e1�d#fd^d_�ZFd`d�ZGdad�ZHdbd�ZIdwdcd �ZJdxddde�ZKdydfd!�ZLGdgdh�dh�ZMeMdidjdkdldmdn�ZNdodp�ZOePdqk�rle	�QeO��d#S)zzreStructuredText en�register_optionflag�DONT_ACCEPT_TRUE_FOR_1�DONT_ACCEPT_BLANKLINE�NORMALIZE_WHITESPACE�ELLIPSIS�SKIP�IGNORE_EXCEPTION_DETAIL�COMPARISON_FLAGS�REPORT_UDIFF�REPORT_CDIFF�REPORT_NDIFF�REPORT_ONLY_FIRST_FAILURE�REPORTING_FLAGS�	FAIL_FAST�Example�DocTest�
DocTestParser�
DocTestFinder�
DocTestRunner�
OutputChecker�DocTestFailure�UnexpectedException�DebugRunner�testmod�testfile�run_docstring_examples�DocTestSuite�DocFileSuite�set_unittest_reportflags�script_from_examples�
testsource�	debug_src�debug�N)�StringIO)�
namedtuple�TestResultszfailed attemptedcCst�|dtt�>�S)N�)�OPTIONFLAGS_BY_NAME�
setdefault�len��name�r,�/usr/lib64/python3.8/doctest.pyr�sz<BLANKLINE>z...cCs8d}tjD](}|�|d�}|tt|�kr
||jO}q
|S)Nr")�
__future__Zall_feature_names�get�getattrZ
compiler_flag)�globs�flagsZfnameZfeaturer,r,r-�_extract_future_flags�s
r3�cCsVt�|�r|St|t�r,t|t�t�dg�S|dkrJtjt�	|�j
dStd��dS)N�*�__name__z"Expected a module, string, or None)�inspect�ismodule�
isinstance�str�
__import__�globals�locals�sys�modules�	_getframe�	f_globals�	TypeError)�moduleZdepthr,r,r-�_normalize_module�s


rDcCsdD]}|�|d�}q|S)N)z
�
�
)�replace)�data�newliner,r,r-�_newline_convert�srJc
Cs�|rVt|d�}t||�}t|dd�dk	rVt|jd�rV|j�|�}|�|�}t|�|fSt||d��}|�	�|fW5QR�SQRXdS)N��
__loader__�get_data)�encoding)
rD�_module_relative_pathr0�hasattrrLrM�decoderJ�open�read)�filename�package�module_relativerNZ
file_contents�fr,r,r-�_load_testfile�s


rX�cCst�d|d|�S)Nz
(?m)^(?!$)� )�re�sub)�s�indentr,r,r-�_indent�sr_cCs*t�}|\}}}tj||||d�|��S)N)�file)r#�	traceback�print_exception�getvalue)�exc_infoZexcout�exc_typeZexc_valZexc_tbr,r,r-�_exception_traceback�s
rfc@seZdZdd�Zddd�ZdS)�	_SpoofOutcCs$t�|�}|r |�d�s |d7}|S�NrF)r#rc�endswith)�self�resultr,r,r-rcs
z_SpoofOut.getvalueNcCs|�|�t�|�dS�N)�seekr#�truncate)rj�sizer,r,r-rn	s
z_SpoofOut.truncate)N)r6�
__module__�__qualname__rcrnr,r,r,r-rg�s	rgcCs�t|kr||kS|�t�}dt|�}}|d}|rR|�|�rNt|�}|d=ndS|d}|r�|�|�r||t|�8}|d=ndS||kr�dS|D],}|�|||�}|dkr�dS|t|�7}q�dS)Nr"F���T)�ELLIPSIS_MARKER�splitr)�
startswithri�find)�want�gotZws�startpos�endpos�wr,r,r-�_ellipsis_matchs0


r|cCs|��}|rd|SdSdS)Nz# �#)�rstrip)�liner,r,r-�
_comment_line?sr�cCshdt|�}}|�d�}|dkr$|}|�dd|�}|dkr>|}|�dd|�}|dkr\|d}|||�S)Nr"rF�:�.r&)r)rv�rfind)�msg�start�end�ir,r,r-�_strip_exception_detailsGs
r�c@s.eZdZdd�Zd
dd�Zdd�Zdd	�ZdS)�_OutputRedirectingPdbcCs(||_d|_tjj||dd�d|_dS)NFT)�stdout�nosigintr&)�_OutputRedirectingPdb__out�$_OutputRedirectingPdb__debugger_used�pdb�Pdb�__init__Zuse_rawinput)rj�outr,r,r-r�gsz_OutputRedirectingPdb.__init__NcCs*d|_|dkrt��j}tj�||�dS)NT)r�r>r@�f_backr�r��	set_trace)rj�framer,r,r-r�os
z_OutputRedirectingPdb.set_tracecCs|jrtj�|�dSrl)r�r�r��set_continue�rjr,r,r-r�usz"_OutputRedirectingPdb.set_continuecGs2tj}|jt_ztjj|f|��W�S|t_XdSrl)r>r�r�r�r��trace_dispatch)rj�args�save_stdoutr,r,r-r�{s
z$_OutputRedirectingPdb.trace_dispatch)N)r6rprqr�r�r�r�r,r,r,r-r�as
r�cCs�t�|�std|��|�d�r(td��tjj|�d��}t	|d�rXtj�|j
�d}n�|jdkr�tt
j�dkr�t
jddkr�tj�t
jd�d}q�tj}nFt	|d�r�|jD]&}tj�||�}tj�|�r�|Sq�td	|j��tj�||�S)
NzExpected a module: %r�/z1Module-relative files may not have absolute paths�__file__r"�__main__��__path__zBCan't resolve paths relative to the module %r (it has no __file__))r7r8rBru�
ValueError�os�path�joinrtrPr�r6r)r>�argv�curdirr��exists)rCZ	test_pathZbasedirZ	directory�fullpathr,r,r-rO�s(






�rOc@s&eZdZd	dd�Zdd�Zdd�ZdS)
rNr"cCsv|�d�s|d7}|r(|�d�s(|d7}|dk	rB|�d�sB|d7}||_||_||_||_|dkrfi}||_||_dSrh)ri�sourcerw�linenor^�options�exc_msg)rjr�rwr�r�r^r�r,r,r-r��s
zExample.__init__cCs\t|�t|�k	rtS|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkSrl)�type�NotImplementedr�rwr�r^r�r��rj�otherr,r,r-�__eq__�s
�
�
�
�
�zExample.__eq__cCst|j|j|j|j|jf�Srl)�hashr�rwr�r^r�r�r,r,r-�__hash__�s�zExample.__hash__)Nr"r"N)r6rprqr�r�r�r,r,r,r-r�s
#�
c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)rcCs,||_||_|��|_||_||_||_dSrl)�examples�	docstring�copyr1r+rTr�)rjr�r1r+rTr�r�r,r,r-r�s
zDocTest.__init__cCsRt|j�dkrd}n"t|j�dkr(d}ndt|j�}d|jj|j|j|j|fS)Nr"zno examplesr&z	1 examplez%d examplesz<%s %s from %s:%s (%s)>)r)r��	__class__r6r+rTr�)rjr�r,r,r-�__repr__s��zDocTest.__repr__cCs\t|�t|�k	rtS|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkSrl)r�r�r�r�r1r+rTr�r�r,r,r-r�)s
�
�
�
�
�zDocTest.__eq__cCst|j|j|j|jf�Srl)r�r�r+rTr�r�r,r,r-r�4szDocTest.__hash__cCs:t|t�stS|j|j|jt|�f|j|j|jt|�fkSrl)r9rr�r+rTr��idr�r,r,r-�__lt__8s

�zDocTest.__lt__N)r6rprqr�r�r�r�r�r,r,r,r-r�s
c@s�eZdZe�dejejB�Ze�dejejBejB�Z	e�d�j
Zddd�Zdd�Z
dd	d
�Zdd�Ze�d
ej�Zdd�Ze�dej�Zdd�Zdd�Zdd�ZdS)ra�
        # Source consists of a PS1 line followed by zero or more PS2 lines.
        (?P<source>
            (?:^(?P<indent> [ ]*) >>>    .*)    # PS1 line
            (?:\n           [ ]*  \.\.\. .*)*)  # PS2 lines
        \n?
        # Want consists of any non-blank lines that do not start with PS1.
        (?P<want> (?:(?![ ]*$)    # Not a blank line
                     (?![ ]*>>>)  # Not a line starting with PS1
                     .+$\n?       # But any other line
                  )*)
        a�
        # Grab the traceback header.  Different versions of Python have
        # said different things on the first traceback line.
        ^(?P<hdr> Traceback\ \(
            (?: most\ recent\ call\ last
            |   innermost\ last
            ) \) :
        )
        \s* $                # toss trailing whitespace on the header.
        (?P<stack> .*?)      # don't blink: absorb stuff until...
        ^ (?P<msg> \w+ .*)   #     a line *starts* with alphanum.
        z^[ ]*(#.*)?$�<string>c
s|��}|�|���dkr8d��fdd�|�d�D��}g}d\}}|j�|�D]�}|�|||����||�d||���7}|�	|||�\}}}	}
|�
|�s�|�t||	|
|�t|�
d��|d��||�d|��|���7}|��}qP|�||d��|S)Nr"rFcsg|]}|�d��qSrlr,��.0�l�Z
min_indentr,r-�
<listcomp>sz'DocTestParser.parse.<locals>.<listcomp>�r"r"r^)r�r^r�)�
expandtabs�_min_indentr�rt�_EXAMPLE_RE�finditer�appendr��count�_parse_example�_IS_BLANK_OR_COMMENTrr)�groupr�)rj�stringr+�outputZcharnor��mr�r�rwr�r,r�r-�parsess*
�

�
zDocTestParser.parsecCst|�||�|||||�Srl)r�get_examples)rjr�r1r+rTr�r,r,r-�get_doctest�s	�zDocTestParser.get_doctestcCsdd�|�||�D�S)NcSsg|]}t|t�r|�qSr,)r9r)r��xr,r,r-r��s
�z.DocTestParser.get_examples.<locals>.<listcomp>)r�)rjr�r+r,r,r-r��szDocTestParser.get_examplesc
s
t|�d���|�d��d�}|�|�||�|�|dd�d�d||�d��fdd�|D��}|�d	�}|�d�}t|�dkr�t�d
|d�r�|d=|�|d�||t|��d��fdd�|D��}|j�|�}|r�|�d
�}nd}|�	|||�}	||	||fS)Nr^r�rFr&rZr�csg|]}|�dd��qS)rYNr,)r�Zsl�r^r,r-r��sz0DocTestParser._parse_example.<locals>.<listcomp>rwz *$rrcsg|]}|�d��qSrlr,)r�Zwlr�r,r-r��sr�)
r)r�rt�_check_prompt_blank�
_check_prefixr�r[�match�
_EXCEPTION_RE�
_find_options)
rjr�r+r��source_linesr�rw�
want_linesr�r�r,r�r-r��s& 


�zDocTestParser._parse_examplez#\s*doctest:\s*([^\n\'"]*)$c	Cs�i}|j�|�D]v}|�d��dd���}|D]V}|ddksN|dd�tkrdtd|d||f��t|dd�}|ddk||<q.q|r�|�|�r�td|||f��|S)	Nr&�,rZr"z+-z7line %r of the doctest for %s has an invalid option: %r�+zSline %r of the doctest for %s has an option directive on a line with no example: %r)�_OPTION_DIRECTIVE_REr�r�rGrtr'r�r�)	rjr�r+r�r�r�Zoption_strings�option�flagr,r,r-r��s"���zDocTestParser._find_optionsz
^([ ]*)(?=\S)cCs2dd�|j�|�D�}t|�dkr*t|�SdSdS)NcSsg|]}t|��qSr,)r))r�r^r,r,r-r�
sz-DocTestParser._min_indent.<locals>.<listcomp>r")�
_INDENT_RE�findallr)�min)rjr]�indentsr,r,r-r�szDocTestParser._min_indentc	Cs^t|�D]P\}}t|�|dkr||ddkrtd||d||||d�|f��qdS)NrYrKrZz8line %r of the docstring for %s lacks blank after %s: %rr&)�	enumerater)r�)rj�linesr^r+r�r�rr,r,r-r�s ��z!DocTestParser._check_prompt_blankcCs>t|�D]0\}}|r|�|�std||d||f��qdS)NzGline %r of the docstring for %s has inconsistent leading whitespace: %rr&)r�rur�)rjr��prefixr+r�r�rr,r,r-r�s
�zDocTestParser._check_prefixN)r�)r�)r6rprqr[�compile�	MULTILINE�VERBOSEr��DOTALLr�r�r�r�r�r�r�r�r�r�r�r�r�r,r,r,r-rCs&	
��
'
3�c@sJeZdZde�ddfdd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)rFTcCs||_||_||_||_dSrl)�_parser�_verbose�_recurse�_exclude_empty)rj�verbose�parser�recurse�
exclude_emptyr,r,r-r�7szDocTestFinder.__init__Nc		CsN|dkr.t|dd�}|dkr.tdt|�f��|dkr<d}n|dkrNt�|�}zt�|�}Wntk
rtd}YndX|s�t�|�}|d|dd�dks�d}|dkr�d}n*|dk	r�t�	||j
�}n
t�	|�}|s�d}|dkr�|dkr�i}n
|j
��}n|��}|dk	�r|�|�d|k�r(d|d<g}|�
||||||i�|��|S)Nr6zJDocTestFinder.find: name must be given when obj.__name__ doesn't exist: %rFr"���z<]>r�)r0r�r�r7�	getmoduleZ
getsourcefilerBZgetfile�	linecache�getlines�__dict__r��update�_find�sort)	rj�objr+rCr1�
extraglobsr`r��testsr,r,r-rvMsL$�






zDocTestFinder.findcCs�|dkrdSt�|�dk	r(|t�|�kSt�|�r>|j|jkSt�|�r|t|d�r\|jj}nt|d�rn|j}ndS|j	|kSt�
|�r�|j	|jkSt|d�r�|j	|jkSt|t�r�dSt
d��dS)NT�__objclass__rpz"object must be a class or function)r7r��
isfunctionr��__globals__ZismethoddescriptorrPr�rpr6�isclassr9�propertyr�)rjrC�objectZobj_modr,r,r-�_from_module�s(








zDocTestFinder._from_modulec
Cs|jrtd|�t|�|kr"dSd|t|�<|�|||||�}|dk	rR|�|�t�|�r�|jr�|j�	�D]P\}	}
d||	f}	t�
t�|
��s�t�|
�rl|�
||
�rl|�||
|	||||�qlt�|��rn|j�rnt|di��	�D]�\}	}
t|	t��stdt|	�f��t�
|
��sJt�|
��sJt�|
��sJt|
t��sJtdt|
�f��d||	f}	|�||
|	||||�q�t�|��r|j�r|j�	�D]�\}	}
t|
t��r�t||	�}
t|
t��r�t||	�j}
t�
|
��s�t�|
��s�t|
t��r�|�
||
��r�d||	f}	|�||
|	||||��q�dS)NzFinding tests in %sr&z%s.%s�__test__z5DocTestFinder.find: __test__ keys must be strings: %rz`DocTestFinder.find: __test__ values must be strings, functions, methods, classes, or modules: %rz%s.__test__.%s)r��printr��	_get_testr�r7r8r�r��itemsZ	isroutineZunwrapr�rr�r0r9r:r�r��staticmethod�classmethod�__func__r�)rjr�r�r+rCr�r1�seen�testZvalname�valr,r,r-r��sn
�
�������
�
��zDocTestFinder._findc		Cs�t|t�r|}nJz,|jdkr"d}n|j}t|t�s:t|�}Wnttfk
rXd}YnX|�||�}|jrt|stdS|dkr�d}n.t|dd�p�|j}|dd�dkr�|dd�}|j	�
|||||�S)Nr�r�����.pycrr)r9r:�__doc__rB�AttributeError�_find_linenor�r0r6r�r�)	rjr�r+rCr1r�r�r�rTr,r,r-rs,




�zDocTestFinder._get_testcCsd}t�|�rd}t�|�rb|dkr(dSt�dt|dd��}t|�D]\}}|�|�rF|}qbqFt�|�rr|j	}t�
|�r�|j}t�|�r�|j
}t�|�r�|j}t�|�r�t|dd�d}|dk	�r
|dkr�|dSt�d�}t|t|��D]}|�||�r�|Sq�dS)Nr"z^\s*class\s*%s\br6�-�co_firstlinenor&z(^|.*:)\s*\w*("|\'))r7r8r�r[r�r0r�r�Zismethodrr��__code__Zistraceback�tb_frameZisframe�f_codeZiscode�ranger))rjr�r�r�Zpatr�rr,r,r-r4s>


�








zDocTestFinder._find_lineno)NNNN)
r6rprqrr�rvrr�rrr,r,r,r-r.s	�

f?&c@s�eZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Ze�
d�Zddd�Zd dd�Zd!dd�Zdd�ZdS)"rzF**********************************************************************Nr"cCsN|pt�|_|dkrdtjk}||_||_||_d|_d|_i|_	t
�|_dS)N�-vr")r�_checkerr>r�r��optionflags�original_optionflags�tries�failures�_name2ftrg�_fakeout)rj�checkerr�rr,r,r-r��s
zDocTestRunner.__init__cCsH|jrD|jr.|dt|j�dt|j��n|dt|j�d�dS)NzTrying:
zExpecting:
zExpecting nothing
)r�rwr_r�)rjr�r
�exampler,r,r-�report_start�s���zDocTestRunner.report_startcCs|jr|d�dS)Nzok
)r��rjr�r
r rxr,r,r-�report_success�szDocTestRunner.report_successcCs&||�||�|j�|||j��dSrl)�_failure_headerr�output_differencerr"r,r,r-�report_failure�s�zDocTestRunner.report_failurecCs$||�||�dtt|���dS)NzException raised:
)r$r_rf�rjr�r
r rdr,r,r-�report_unexpected_exception�s
�
�z)DocTestRunner.report_unexpected_exceptioncCs�|jg}|jrR|jdk	r4|jdk	r4|j|jd}nd}|�d|j||jf�n|�d|jd|jf�|�d�|j}|�t|��d�|�S)Nr&�?zFile "%s", line %s, in %szLine %s, in %szFailed example:rF)�DIVIDERrTr�r�r+r�r_r�)rjr
r r�r�r�r,r,r-r$�s�
zDocTestRunner._failure_headerc	Cs�d}}|j}td�\}}}	|jj}
t|j�D�]6\}}|jt@oH|dk}
||_|jr�|j��D],\}}|r||j|O_q`|j|M_q`|jt	@r�q.|d7}|
s�|�
|||�d|j|f}z,tt
|j|d|d�|j�|j��d}Wn4tk
�r�Ynt��}|j��YnX|j��}|j�d�|}|dk�r`|
|j||j��r�|}n|tj|dd��d}|
�s�|t|�7}|jdk�r�|	}nB|
|j||j��r�|}n*|jt@�r�|
t|j�t|�|j��r�|}||k�r�|
�sR|�||||�nT||k�r(|
�s|� ||||�|d7}n*||	k�rR|
�sH|�!||||�|d7}n|r.|jt"@r.�qhq.||_|�#|||�t$||�S)Nr"rKr&z<doctest %s[%d]>Zsingler4rr)%rrr�check_outputr�r�rr�rrr!r+�execr�r�r1�debuggerr��KeyboardInterruptr>rdrrcrnrwra�format_exception_onlyrfr�rr�r#r&r(r�_DocTestRunner__record_outcomer%)rjr
�compileflagsr�rrr�SUCCESS�FAILUREZBOOMZcheck�
examplenumr �quietZ
optionflagrrTZ	exceptionrxZoutcomer�r,r,r-Z__run�s�
�
��



�




�
zDocTestRunner.__runcCsL|j�|jd�\}}||||f|j|j<|j|7_|j|7_dS)Nr�)rr/r+rr)rjr
rW�t�f2�t2r,r,r-Z__record_outcome|szDocTestRunner.__record_outcomez.<doctest (?P<name>.+)\[(?P<examplenum>\d+)\]>$cCsV|j�|�}|rF|�d�|jjkrF|jjt|�d��}|jjdd�S|�	||�SdS)Nr+r4T��keepends)
�%_DocTestRunner__LINECACHE_FILENAME_REr�r�r
r+r��intr��
splitlines�save_linecache_getlines)rjrT�module_globalsr�r r,r,r-Z__patched_linecache_getlines�s
z*DocTestRunner.__patched_linecache_getlinesTc		s||_|dkrt|j�}tj�|dkrV�j��dks@���dkrH�j}n��fdd�}|jt_t�	�}t
j}t��|_
|j
��|j
jt
_tj|_|jt_tj}tjt_z|�|||�W�S�t_|t
_t�|�|jt_|t_|�r�|j��ddl}d|_XdS)N�utf-8cs t|��d���}��|�dS)N�backslashreplace)r:�encode�write)r]�rNr�r,r-r��szDocTestRunner.run.<locals>.outr")r
r3r1r>r�rN�lowerrCr�gettracer�r�r�r-�resetr�r�r>�*_DocTestRunner__patched_linecache_getlines�displayhook�__displayhook__�settrace�clear�builtins�_�_DocTestRunner__run)	rjr
r1r��clear_globsZ
save_traceZsave_set_traceZsave_displayhookrMr,rDr-�run�s<





zDocTestRunner.runc
Cs�|dkr|j}g}g}g}d}}|j��D]V}|\}\}	}
||
7}||	7}|
dkr`|�|�q,|	dkrx|�||
f�q,|�|�q,|r�|r�tt|�d�|��|D]}td|�q�|r�tt|�d�|��|D]\}}td||f�q�|�r:t|j�tt|�d�|��|D] \}\}	}
td|	|
|f��q|�rft|dt|j�d	�t||d
|d�|�rztd|d
�n|�r�td�t||�S)Nr"zitems had no tests:z   zitems passed all tests:z %3d tests in %szitems had failures:z %3d of %3d in %sztests inzitems.z
passed andzfailed.z***Test Failed***z	failures.zTest passed.)	r�rrr�rr)r�r*r%)
rjr�ZnotestsZpassedZfailedZtotaltZtotalfr�r+rWr6�thingr�r,r,r-�	summarize�sP
zDocTestRunner.summarizecCsR|j}|j��D]<\}\}}||kr@||\}}||}||}||f||<qdSrl)rr)rjr��dr+rWr6r7r8r,r,r-�mergeszDocTestRunner.merge)NNr")N)NNT)N)r6rprqr*r�r!r#r&r(r$rOr0r[r�r;rHrQrSrUr,r,r,r-rhs:
$
}



I
9c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rcCst|�dd�d�S)N�ASCIIrA)r:rB)rjr]r,r,r-�_toAscii(szOutputChecker._toAsciicCs�|�|�}|�|�}||kr dS|t@sH||fdkr8dS||fdkrHdS|t@s�t�dt�t�d|�}t�dd|�}||kr�dS|t@r�d�|�	��}d�|�	��}||kr�dS|t
@r�t||�r�dSdS)	NT)zTrue
z1
)zFalse
z0
z(?m)^%s\s*?$r�z(?m)^[^\S\n]+$rZF)rWrrr[r\�escape�BLANKLINE_MARKERrr�rtrr|�rjrwrxrr,r,r-r+.s4

�
zOutputChecker.check_outputcCs<|ttBtB@sdS|t@r dS|�d�dko:|�d�dkS)NFTrFr4)r	r
rr�rZr,r,r-�_do_a_fancy_diffms��zOutputChecker._do_a_fancy_diffc
Cs(|j}|t@st�dt|�}|�|||�r�|jdd�}|jdd�}|t@rptj	||dd�}t
|�dd�}d}nZ|t@r�tj||dd�}t
|�dd�}d}n,|t
@r�tjtjd�}	t
|	�||��}d	}nd
|td�|��S|r�|r�dt|�t|�fS|�rd
t|�S|�r dt|�SdSdS)Nz(?m)^[ ]*(?=
)Tr9r4)�nz#unified diff with -expected +actualz-context diff with expected followed by actual)Zcharjunkzndiff with -expected +actualzDifferences (%s):
r�zExpected:
%sGot:
%szExpected:
%sGot nothing
zExpected nothing
Got:
%szExpected nothing
Got nothing
)rwrr[r\rYr[r=r	�difflibZunified_diff�listr
Zcontext_diffrZDifferZIS_CHARACTER_JUNKZcomparer_r�)
rjr rxrrwr�Z	got_linesZdiffZkindZenginer,r,r-r%�s4zOutputChecker.output_differenceN)r6rprqrWr+r[r%r,r,r,r-r s?c@seZdZdd�Zdd�ZdS)rcCs||_||_||_dSrl)r
r rx)rjr
r rxr,r,r-r��szDocTestFailure.__init__cCs
t|j�Srl�r:r
r�r,r,r-�__str__�szDocTestFailure.__str__N�r6rprqr�r`r,r,r,r-r�sc@seZdZdd�Zdd�ZdS)rcCs||_||_||_dSrl)r
r rd)rjr
r rdr,r,r-r��szUnexpectedException.__init__cCs
t|j�Srlr_r�r,r,r-r`�szUnexpectedException.__str__Nrar,r,r,r-r�sc@s&eZdZd	dd�Zdd�Zdd�ZdS)
rNTcCs$t�||||d�}|r |j��|S)NF)rrQr1rL)rjr
r1r�rP�rr,r,r-rQ3s
zDebugRunner.runcCst|||��dSrl)rr'r,r,r-r(9sz'DebugRunner.report_unexpected_exceptioncCst|||��dSrl)rr"r,r,r-r&<szDebugRunner.report_failure)NNT)r6rprqrQr(r&r,r,r,r-r�s[
TFc	Cs�|dkrtj�d�}t�|�s,td|f��|dkr:|j}t|d�}	|rVt||d�}
nt	||d�}
|	j
||||d�D]}|
�|�qt|r�|
��t
dkr�|
a
n
t
�|
�t|
j|
j�S)Nr�ztestmod: module required; %r)r��r�r�r1r�)r>r?r/r7r8rBr6rrrrvrQrS�masterrUr%rr)r�r+r1r��reportrr��raise_on_errorr��finder�runnerr
r,r,r-rHs$E


cCs�|r|std��t||||pd�\}}|dkr:tj�|�}|dkrHi}n|��}|dk	rb|�|�d|krrd|d<|	r�t||d�}
nt||d�}
|
�	||||d�}|
�
|�|r�|
��tdkr�|
an
t�
|
�t|
j|
j�S)N�8Package may only be specified for module-relative paths.r@r6r�rcr")r�rXr�r��basenamer�r�rrr�rQrSrerUr%rr)rTrVr+rUr1r�rfrr�rgr�rN�textrir
r,r,r-r�s2R�


�NoNamec	Cs@t|dd�}t||d�}|j|||d�D]}|j||d�q(dS)NF)r�r�rc)r1)r1)rrrvrQ)	rWr1r�r+r1rrhrir
r,r,r-r+scCs"|t@|krtd|��t}|a|S)NzOnly reporting flags allowed)r
r��_unittest_reportflags)r2�oldr,r,r-rHs

c@sleZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Ze
jZdd�ZdS)�DocTestCaser"NcCs.tj�|�||_||_||_||_||_dSrl)�unittest�TestCaser��_dt_optionflags�_dt_checker�_dt_test�	_dt_setUp�_dt_tearDown)rjr
r�setUp�tearDownrr,r,r-r�nszDocTestCase.__init__cCs|j}|jdk	r|�|�dSrl)rurv�rjr
r,r,r-rxxs
zDocTestCase.setUpcCs(|j}|jdk	r|�|�|j��dSrl)rurwr1rLrzr,r,r-ry~s

zDocTestCase.tearDowncCs~|j}tj}t�}|j}|t@s(|tO}t||jdd�}z d|_	|j
||jdd�\}}W5|t_X|rz|�|�
|�����dS)NF�rrr�zF----------------------------------------------------------------------)r�rP)rur>r�r#rsr
rnrrtr*rQrCZfailureException�format_failurerc)rjr
ro�newrrirrr,r,r-�runTest�s(��zDocTestCase.runTestcCsP|j}|jdkrd}n
d|j}d�|j�d�dd��}d|j|j|||fS)Nzunknown line numberz%sr�rrz:Failed doctest test for %s
  File "%s", line %s, in %s

%s)rur�r�r+rtrT)rj�errr
r�Zlnamer,r,r-r|�s

�zDocTestCase.format_failurecCs6|��t|j|jdd�}|j|jdd�|��dS)NFr{)rP)rxrrsrtrQrury)rjrir,r,r-r!�sB�zDocTestCase.debugcCs|jjSrl�rur+r�r,r,r-r��szDocTestCase.idcCsPt|�t|�k	rtS|j|jkoN|j|jkoN|j|jkoN|j|jkoN|j|jkSrl)r�r�rursrvrwrtr�r,r,r-r��s
�
�
�
�zDocTestCase.__eq__cCst|j|j|j|jf�Srl)r�rsrvrwrtr�r,r,r-r��s�zDocTestCase.__hash__cCs,|jj�d�}d|dd�|dd��fS)Nr�z%s (%s)rr)rur+rtr�)rjr+r,r,r-r�	szDocTestCase.__repr__cCsd|jjS)Nz	Doctest: r�r�r,r,r-�shortDescription		szDocTestCase.shortDescription)r"NNN)r6rprqr�rxryr~r|r!r�r�r�r�rr`r�r,r,r,r-rpls�

H
rpc@s0eZdZdd�Zdd�Zdd�Zdd�ZeZd	S)
�SkipDocTestCasecCs||_t�|d�dSrl)rCrpr�)rjrCr,r,r-r�
	szSkipDocTestCase.__init__cCs|�d�dS)Nz-DocTestSuite will not work with -O2 and above)ZskipTestr�r,r,r-rx	szSkipDocTestCase.setUpcCsdSrlr,r�r,r,r-�	test_skip	szSkipDocTestCase.test_skipcCsd|jjS)NzSkipping tests from %s)rCr6r�r,r,r-r�	sz SkipDocTestCase.shortDescriptionN)r6rprqr�rxr�r�r`r,r,r,r-r�	s
r�c@seZdZdd�ZdS)�
_DocTestSuitecCsdSrlr,)rj�indexr,r,r-�_removeTestAtIndex	sz _DocTestSuite._removeTestAtIndexN)r6rprqr�r,r,r,r-r�	sr�c	Ks�|dkrt�}t|�}|j|||d�}|sNtjjdkrNt�}|�t|��|S|�	�t�}|D]T}t
|j�dkrtq`|js�|j
}|dd�dkr�|dd�}||_|�t|f|��q`|S)Nrdr4r"rr
rr)rrDrvr>r2�optimizer��addTestr�r�r)r�rTr�rp)	rCr1r�Ztest_finderr�r��suiter
rTr,r,r-r#	s(%c@s$eZdZdd�Zdd�Zdd�ZdS)�DocFileCasecCsd�|jj�d��S)NrNr�)r�rur+rtr�r,r,r-r�e	szDocFileCase.idcCs|jjSrl)rurTr�r,r,r-r�h	szDocFileCase.__repr__cCsd|jj|jj|fS)Nz2Failed doctest test for %s
  File "%s", line 0

%s)rur+rT)rjrr,r,r-r|k	s�zDocFileCase.format_failureN)r6rprqr�r�r|r,r,r,r-r�c	sr�c
Ksv|dkri}n|��}|r&|s&td��t||||p4d�\}}d|krL||d<tj�|�}|�||||d�}	t|	f|�S)Nrjr@r�r")r�r�rXr�r�rkr�r�)
r�rVrUr1r�rNr��docr+r
r,r,r-�DocFileTestp	s�r�cOsDt�}|�dd�r$t|�d��|d<|D]}|�t|f|��q(|S)NrVTrU)r�r/rDr�r�)�paths�kwr�r�r,r,r-r�	s8cCs�g}t��|�D]x}t|t�rh|�|jdd��|j}|r�|�d�|dd�|�d�dd�D�7}q|dd�|�d�dd�D�7}q|r�|ddkr�|��q�|r�|ddkr�|�d�q�d�	|�dS)	Nrrz# Expected:cSsg|]}d|�qS)z## r,r�r,r,r-r�
sz(script_from_examples.<locals>.<listcomp>rFcSsg|]}t|��qSr,)r�r�r,r,r-r�
s�r}r")
rr�r9rr�r�rwrt�popr�)r]r�Zpiecerwr,r,r-r�	s :

"�

csJt|�}t��|�}�fdd�|D�}|s4t�d��|d}t|j�}|S)Ncsg|]}|j�kr|�qSr,r*)r�r6r*r,r-r�.
s
ztestsource.<locals>.<listcomp>znot found in testsr")rDrrvr�rr�)rCr+r�r
�testsrcr,r*r-r%
s

cCst|�}t|||�dSrl)r�debug_script)�src�pmr1r�r,r,r-r 5
scCs�ddl}|r|��}ni}|rvzt|||�Wq�tt��d�|jdd�}|��|�dt��d�Yq�Xn|jdd��	d|||�dS)Nr"r&T)r�r4zexec(%r))
r�r�r,rr>rdr�rGZinteractionrQ)r�r�r1r��pr,r,r-r�:
s
r�cCs$t|�}t||�}t|||j�dSrl)rDrr�r�)rCr+r�r�r,r,r-r!N
s
c@s$eZdZdd�Zdd�Zdd�ZdS)�
_TestClasscCs
||_dSrl�r)rjrr,r,r-r�j
sz_TestClass.__init__cCs|jd|_|S)Nr4r�r�r,r,r-�squaret
sz_TestClass.squarecCs|jSrlr�r�r,r,r-r/~
sz_TestClass.getN)r6rprqr�r�r/r,r,r,r-r�\
s

r�z�
                      Example of a string object, searched as-is.
                      >>> x = 1; y = 2
                      >>> x + y, x * y
                      (3, 2)
                      a�
                                    In 2.2, boolean expressions displayed
                                    0 or 1.  By default, we still accept
                                    them.  This can be disabled by passing
                                    DONT_ACCEPT_TRUE_FOR_1 to the new
                                    optionflags argument.
                                    >>> 4 == 4
                                    1
                                    >>> 4 == 4
                                    True
                                    >>> 4 > 4
                                    0
                                    >>> 4 > 4
                                    False
                                    z�
                Blank lines can be marked with <BLANKLINE>:
                    >>> print('foo\n\nbar\n')
                    foo
                    <BLANKLINE>
                    bar
                    <BLANKLINE>
            z�
                If the ellipsis flag is used, then '...' can be used to
                elide substrings in the desired output:
                    >>> print(list(range(1000))) #doctest: +ELLIPSIS
                    [0, 1, 2, ..., 999]
            a�
                If the whitespace normalization flag is used, then
                differences in whitespace are ignored.
                    >>> print(list(range(30))) #doctest: +NORMALIZE_WHITESPACE
                    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
                     15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
                     27, 28, 29]
            )r�r�zbool-int equivalencezblank linesZellipsiszwhitespace normalizationcCs"ddl}|jdd�}|jdddddd	�|jd
ddt��gd
d�|jddddd�|jdddd�|��}|j}|j}d}|jD]}|t|O}q�|j	r�|t
O}|D]v}|�d�r�tj
�|�\}}tj
�d|�t|dd��}	tj
d=t|	||d�\}
}nt|d||d�\}
}|
r�dSq�dS)Nr"zdoctest runner)Zdescriptionrz	--verbose�
store_trueFz'print very verbose output for all tests)�action�default�helpz-oz--optionr�zqspecify a doctest option flag to apply to the test run; may be specified more than once to apply multiple options)r��choicesr�r�z-fz--fail-fastzystop running tests after first failure (this is a shorthand for -o FAIL_FAST, and is in addition to any other -o options))r�r�r`r�z file containing the tests to run)�nargsr�z.py���rc)rVr�rr&)�argparse�ArgumentParser�add_argumentr'�keys�
parse_argsr`r�r�Z	fail_fastrrir�r�rtr>�insertr;rr)r�r�r�Z	testfilesr�r�r�rT�dirnamer�rrNr,r,r-�_test�
sL�
�
��

�
r�r�)r4)rY)	NNNNTr"NFF)FrmNr")NNNN)FN)FN)F)RZ
__docformat__�__all__r.r]r7r�r�r�r[r>rarq�ior#�collectionsr$r%r'rrrrrrrrr	r
rrrr
rYrsr3rDrJrXr_rfrgr|r�r�r�r�rOrrrrrr�	Exceptionrrrrerrrrnrrrrpr�Z	TestSuiter�rr�r�rrrr r�r!r�rr�r6�exitr,r,r,r-�<module>0sD�-
���������

1%.DKl<;n�
h�
{�
$!
@
�
IR


,	�3-
sndhdr.cpython-38.pyc000064400000015517150335716500010474 0ustar00U

e5d��@s2dZddgZddlmZedd�Zdej_dej_d	ej_d
ej_dej	_dd�Z
d
d�ZgZdd�Z
e�e
�dd�Ze�e�dd�Ze�e�dd�Ze�e�dd�Ze�e�dd�Ze�e�dd�Ze�e�dd�Ze�e�dd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zed*k�r.e�d+S),a�Routines to help recognizing sound files.

Function whathdr() recognizes various types of sound file headers.
It understands almost all headers that SOX can decode.

The return tuple contains the following items, in this order:
- file type (as SOX understands it)
- sampling rate (0 if unknown or hard to decode)
- number of channels (0 if unknown or hard to decode)
- number of frames in the file (-1 if unknown or hard to decode)
- number of bits/sample, or 'U' for U-LAW, or 'A' for A-LAW

If the file doesn't have a recognizable type, it returns None.
If the file can't be opened, OSError is raised.

To compute the total time, divide the number of frames by the
sampling rate (a frame contains a sample for each channel).

Function what() calls whathdr().  (It used to also use some
heuristics for raw data, but this doesn't work very well.)

Finally, the function test() is a simple main program that calls
what() for all files mentioned on the argument list.  For directory
arguments it calls what() for all files in that directory.  Default
argument is "." (testing all files in the current directory).  The
option -r tells it to recurse down directories found inside
explicitly given directories.
�what�whathdr�)�
namedtuple�
SndHeadersz.filetype framerate nchannels nframes sampwidthz�The value for type indicates the data type
and will be one of the strings 'aifc', 'aiff', 'au','hcom',
'sndr', 'sndt', 'voc', 'wav', '8svx', 'sb', 'ub', or 'ul'.zYThe sampling_rate will be either the actual
value or 0 if unknown or difficult to decode.z^The number of channels or 0 if it cannot be
determined or if the value is difficult to decode.z?The value for frames will be either the number
of frames or -1.zAEither the sample size in bits or
'A' for A-LAW or 'U' for u-LAW.cCst|�}|S)zGuess the type of a sound file.)r)�filename�res�r�/usr/lib64/python3.8/sndhdr.pyr4sc
Cs^t|d��J}|�d�}tD]*}|||�}|rt|�W5QR�SqW5QR�dSQRXdS)zRecognize sound headers.�rbiN)�open�read�testsr)r�f�hZtfrrrr	r:s

c	Cs�ddl}|�d�sdS|dd�dkr,d}n|dd�dkrBd}ndS|�d�z|�|d	�}Wnt|jfk
r|YdSX||��|��|��d|�	�fS)
Nr�FORM��sAIFC�aifcsAIFFZaiff�r)
r�
startswith�seekr�EOFError�Error�getframerate�getnchannels�
getnframes�getsampwidth)rrrZfmt�arrr	�	test_aifcKs"


�rc
Cs�|�d�rt}n|dd�dkr&t}ndSd}||dd��}||dd��}||dd��}||dd��}||dd	��}d
}	|d
kr�d}
n$|dkr�d}
n|d
kr�d}
d}	nd}
|	|}|r�||}nd}|||||
fS)Ns.snd�)sds.sdns.Zaurr�����U���?���)r�get_long_be�get_long_le)
rr�func�filetypeZhdr_size�	data_size�encoding�rate�	nchannelsZsample_sizeZsample_bitsZ
frame_sizeZnframerrr	�test_au`s2

r1cCsT|dd�dks |dd�dkr$dSt|dd��}|rBd	|}nd
}d|dd
dfS)N�A�EsFSSD��sHCOM��i"VrZhcomr#r(r)r))rrZdivisorr/rrr	�	test_hcom�s 
r8cCst|�d�sdSt|dd��}d}d|kr6dkrfnn,||dkrfd||d}|rftd	|�}d
|dddfS)
NsCreative Voice Filer!�ri�r#�rg��.AZvocr(r)r�get_short_le�int)rrZsbseekr/Zratecoderrr	�test_voc�s
$r=c	Cs�ddl}|�d�r2|dd�dks2|dd�dkr6dS|�d�z|�|d�}Wnt|jfk
rlYdSXd	|��|��|��d|�	�fS)
NrsRIFFrrsWAVEr sfmt rZwav)
�waverrrrrrrrr)rrr>�wrrr	�test_wav�s*

�r@cCs"|�d�r|dd�dkrdSdS)Nrrrs8SVX)Z8svxrr#rr)r)rrrrr	�	test_8svx�srAcCs<|�d�r8t|dd��}t|dd��}d|d|dfSdS)NsSOUNDrrr!r9Zsndtr#)rr*r;)rrZnsamplesr/rrr	�	test_sndt�s
rBcCsD|�d�r@t|dd��}d|kr.dkr@nnd|ddd	fSdS)
Nsr%ri�i�aZsndrr#r(r)rr;)rrr/rrr	�	test_sndr�s
rCcCs,|dd>|dd>B|dd>B|dBS)Nrr"r#r r%rr&r��brrr	r)�sr)cCs,|dd>|dd>B|dd>B|dBS)Nr&r"r%r r#rrrrDrrr	r*�sr*cCs|dd>|dBS)Nrrr#rrDrrr	�get_short_be�srFcCs|dd>|dBS)Nr#rrrrDrrr	r;�sr;cCs�ddl}d}|jdd�r8|jddkr8|jdd�=d}z8|jdd�r`t|jdd�|d�ntdg|d�Wn*tk
r�|j�d�|�d�YnXdS)Nrr#z-rr%�.z
[Interrupted]
)�sys�argv�testall�KeyboardInterrupt�stderr�write�exit)rH�	recursiverrr	�test�srPc	Cs�ddl}ddl}|D]�}|j�|�r~t|ddd�|s<|rttd�ddl}|�|j�|�|�d��}t||d�q�td�qt|ddd�|j	�
�ztt|��Wqtk
r�td	�YqXqdS)
Nrz/:� )�endzrecursing down:�*z*** directory (use -r) ***�:z*** not found ***)
rH�os�path�isdir�print�glob�join�escaperJ�stdout�flushr�OSError)�listrOZtoplevelrHrUrrY�namesrrr	rJ�s"

rJ�__main__N)�__doc__�__all__�collectionsrrr,Z	framerater0ZnframesZ	sampwidthrrr
r�appendr1r8r=r@rArBrCr)r*rFr;rPrJ�__name__rrrr	�<module>sJ �









typing.cpython-38.opt-1.pyc000064400000171645150335716500011470 0ustar00U

e5db
�G@s�dZddlmZmZddlZddlZddlZddlZddlZddl	Z
ddlZddlZddlm
Z
mZmZddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKgGZd�dMdN�ZdOdP�ZdQdR�ZdSdT�ZdUdV�ZdWdX�ZgZdYdZ�Zd[d\�ZGd]d^�d^�ZGd_d`�d`�ZGdadb�dbeedLdc�Zedddde�ZedGdfde�Zeddgde�Zeddhde�Z eddide�Z!eddjde�Z"eddkde�Z#Gdld	�d	edLdc�Z$Gdmd�deedLdc�Z%d7dd5d9d:d4d6dddn�	Z&dodp�Z'Gdqdr�dredLdc�Z(Gdsdt�dte(dLdc�Z)Gdud
�d
�Z*Gdvdw�dw�Z+Gdxdy�dy�Z,dzd{d|d}d~gZ-dd�d�d�d�d�d�d�d�d�g
Z.e-e.d�gZ/d�d��Z0d�d��Z1d�d��Z2d�d��Z3dd#ddd%dd!dd'd*g
d�d�gd��Z4Gd�d��d�e�Z5Gd�d
�d
e*e5d��Z6d�dI�Z7d�d?�Z8d�d��Z9ej:ej;ej<ej=e
eefZ>d�d�dC�Z?d�dB�Z@d�dA�ZAd�dE�ZBd�dF�ZCd�d��ZDd�dH�ZEd�d@�ZFe%d��ZGe%d��ZHe%d��ZIe%d�dLd��ZJe%d�dLd��ZKe%d�dLd��ZLe%d�dLd��ZMe%d�dLeNd��ZOe%d>ePeQ�ZRd�d�d��ZSeSejjTd��ZTeSejjUeJ�ZUeSejjVeJeMeKf�ZVeSejjWeJ�ZWeSejjXeJ�ZXeSejjYeJ�ZYeSejjZeJ�ZZeSejj[eJ�Z[eSejj\d��Z\eSejj]eJ�Z]eSejj^eJ�Z^e)ejj_d�dLd��Z_d�e__eSejj`eJ�ZaeSejjbeG�ZbeSejjceHeLf�ZceSejjdeHeIf�ZdeSejjeeJ�ZeeSejjfeG�ZfeSejjgd��Zge)ehd�d�dLd��Zid�ei_eSejeGd�d��ZkeSejleG�ZmeSeneGd�d��Z`eSeoeJd�d��ZpeSejjqeJ�ZqeSejjreH�ZreSejjseHeLf�ZseSejjteL�ZteSejueJ�ZveSejweJ�ZxeSeyeHeIfd�d��ZzeSej{eHeIf�Z|eSej}eHeIf�Z}eSej~eG�Z~eSejeHeIf�ZeSejj�eJeMeKf�Z�eSejj�eJeMf�Z�eSeNeOd�d��Z�d�e�_e7Gd�d0�d0e6��Z�e7Gd�d.�d.e6��Z�e7Gd�d-�d-e6��Z�e7Gd�d,�d,e6��Z�e7Gd�d/�d/e6��Z�e7Gd�d+�d+e6eJ��Z�e7Gd�d1�d1e6eJ��Z�d�dÄZ�d�Z�d�Z�Gd�dDŽd�eN�Z�Gd�d;�d;e�d��Z�d�dʄZ�d�dLd˜d�d̈́Z�d�dτZ�Gd�dфd�eN�Z�Gd�d<�d<eye�d��Z�d�dD�Z�eQZ�d�Z�Gd�dՄd�e*eR�Z�Gd�dׄd�e�eP�Z�Gd�dلd�e�eQ�Z�Gd�dۄdۃZ�e�d�e�_�e�ej�e�j�<eSe
j�eR�Z�eSe
j�eR�Z�Gd�dބdރZ	e�d�e	_�e	ej�e	j�<dS)�a=
The typing module: Support for gradual typing as defined by PEP 484.

At large scale, the structure of the module is following:
* Imports and exports, all public names should be explicitly added to __all__.
* Internal helper functions: these should never be used in code outside this module.
* _SpecialForm and its instances (special forms): Any, NoReturn, ClassVar, Union, Optional
* Two classes whose instances can be type arguments in addition to types: ForwardRef and TypeVar
* The core of internal generics API: _GenericAlias and _VariadicGenericAlias, the latter is
  currently only used by Tuple and Callable. All subscripted types like X[int], Union[int, str],
  etc., are instances of either of these classes.
* The public counterpart of the generics API consists of two classes: Generic and Protocol.
* Public helper functions: get_type_hints, overload, cast, no_type_check,
  no_type_check_decorator.
* Generic aliases for collections.abc ABCs and few additional protocols.
* Special types: NewType, NamedTuple, TypedDict.
* Wrapper submodules for re and io related types.
�)�abstractmethod�ABCMetaN)�WrapperDescriptorType�MethodWrapperType�MethodDescriptorType�Any�Callable�ClassVar�Final�
ForwardRef�Generic�Literal�Optional�Protocol�Tuple�Type�TypeVar�Union�AbstractSet�
ByteString�	Container�ContextManager�Hashable�	ItemsView�Iterable�Iterator�KeysView�Mapping�MappingView�MutableMapping�MutableSequence�
MutableSet�Sequence�Sized�
ValuesView�	Awaitable�
AsyncIterator�
AsyncIterable�	Coroutine�
Collection�AsyncGenerator�AsyncContextManager�
Reversible�SupportsAbs�
SupportsBytes�SupportsComplex�
SupportsFloat�
SupportsIndex�SupportsInt�
SupportsRound�ChainMap�Counter�Deque�Dict�DefaultDict�List�OrderedDict�Set�	FrozenSet�
NamedTuple�	TypedDict�	Generator�AnyStr�cast�final�get_args�
get_origin�get_type_hints�NewType�
no_type_check�no_type_check_decorator�NoReturn�overload�runtime_checkable�Text�
TYPE_CHECKINGTcCs�ttf}|r|ttf}|dkr(td�St|t�r:t|�St|t�r\|j	|kr\t
|�d���t|t�rr|tt
fks~|ttfkr�t
d|�d���t|tttf�r�|St|�s�t
|�d|d�d���|S)a�Check that the argument is a type, and return it (internal helper).

    As a special case, accept None and return type(None) instead. Also wrap strings
    into ForwardRef instances. Consider several corner cases, for example plain
    special forms like Union are not valid, while Union[int, str] is OK, etc.
    The msg argument is a human-readable error message, e.g::

        "Union[arg, ...]: arg should be a type."

    We append the repr() of the actual value (truncated to 100 chars).
    Nz is not valid as type argumentzPlain z Got z.100�.)rrr	r
�type�
isinstance�strr�
_GenericAlias�
__origin__�	TypeError�_SpecialFormrrIr�callable)�arg�msg�is_argumentZinvalid_generic_forms�rZ�/usr/lib64/python3.8/typing.py�_type_checkxs(

�
�r\cCsRt|t�r,|jdkr|jS|j�d|j��S|dkr8dSt|tj�rJ|jSt|�S)a;Return the repr() of an object, special-casing types (internal helper).

    If obj is a type, we return a shorter version than the default
    type.__repr__, based on the module and qualified name, which is
    typically enough to uniquely identify a type.  For everything
    else, we fall back on repr(obj).
    �builtinsrN.z...)rPrO�
__module__�__qualname__�types�FunctionType�__name__�repr)�objrZrZr[�
_type_repr�s

recs\g�|D]J}t|t�r(|�kr(��|�t|t�r|js���fdd�|jD��qt��S)z�Collect all type variable contained in types in order of
    first appearance (lexicographic order). For example::

        _collect_type_vars((T, List[S, T])) == (T, S)
    csg|]}|�kr|�qSrZrZ��.0�t��tvarsrZr[�
<listcomp>�sz&_collect_type_vars.<locals>.<listcomp>)rPr�appendrR�_special�extend�__parameters__�tuple)r`rhrZrir[�_collect_type_vars�s
rqcCs�t|t�s|St|j�}t|j�D]J\}}t|t�r\t|�D]\}}||kr<||||<q<q"t|||�||<q"|jtkr�tt	|�S|�
t	|��S)zjSubstitute type variables 'tvars' with substitutions 'subs'.
    These two must have the same length.
    )rPrR�list�__args__�	enumerater�_subs_tvarsrSrrp�	copy_with)�tprjZsubsZnew_args�arW�iZtvarrZrZr[ru�s



ruc	Cs^|jst|�d���t|�}t|j�}||krZtd||kr>dnd�d|�d|�d|����dS)	z�Check correct count for parameters of a generic cls (internal helper).
    This gives a nice error message in case of count mismatch.
    z is not a generic classzToo ZmanyZfewz parameters for z	; actual z, expected N)rorT�len)�cls�
parametersZalenZelenrZrZr[�_check_generic�s
r}cCs�g}|D]f}t|t�r.|jtkr.|�|j�qt|t�rdt|�dkrd|dtkrd|�|dd��q|�|�qt	|�}t|�t|�kr�g}|D] }||kr�|�|�|�
|�q�|}t|�S)zyAn internal helper for Union creation and substitution: flatten Unions
    among parameters, then remove duplicates.
    r�N)rPrRrSrrnrsrprzrl�set�remove)r|�params�pZ
all_paramsZ
new_paramsrhrZrZr[�_remove_dups_flatten�s "
r�cs4t�����t��j�t�����fdd��}|S)zInternal wrapper caching __getitem__ of generic types with a fallback to
    original function for non-hashable arguments.
    cs,z�||�WStk
r YnX�||�S�N�rT��args�kwds��cached�funcrZr[�inner�s
z_tp_cache.<locals>.inner)�	functools�	lru_cache�	_cleanupsrl�cache_clear�wraps)r�r�rZr�r[�	_tp_cache�s
r�csbt|t�r|����St|t�r^t��fdd�|jD��}||jkrH|S|�|�}|j|_|S|S)z�Evaluate all forward references in the given type t.
    For use of globalns and localns see the docstring for get_type_hints().
    c3s|]}t|���VqdSr�)�
_eval_type�rgrx��globalns�localnsrZr[�	<genexpr>sz_eval_type.<locals>.<genexpr>)rPr�	_evaluaterRrprsrvrm)rhr�r�Zev_args�resrZr�r[r�	s



r�c@seZdZdZdZdd�ZdS)�_FinalzMixin to prohibit subclassing)�__weakref__cOsd|krtd��dS)N�_rootz&Cannot subclass special typing classesr���selfr�r�rZrZr[�__init_subclass__sz_Final.__init_subclass__N)rbr^r_�__doc__�	__slots__r�rZrZrZr[r�sr�c@s eZdZdZdd�Zdd�ZdS)�
_Immutablez3Mixin to indicate that object should not be copied.cCs|Sr�rZ�r�rZrZr[�__copy__%sz_Immutable.__copy__cCs|Sr�rZ)r�ZmemorZrZr[�__deepcopy__(sz_Immutable.__deepcopy__N)rbr^r_r�r�r�rZrZrZr[r�"sr�cspeZdZdZdZ�fdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
edd��Z�ZS)rUzhInternal indicator of special typing constructs.
    See _doc instance attribute for specific docs.
    ��_nameZ_doccsBt|�dkr6t|dt�r6t|dt�r6td|����t��|�S)z�Constructor.

        This only exists to give a better error message in case
        someone tries to subclass a special typing object (not a good idea).
        �rr~zCannot subclass )rzrPrQrprT�super�__new__)r{r�r���	__class__rZr[r�3s��z_SpecialForm.__new__cCs||_||_dSr�r�)r��name�docrZrZr[�__init__@sz_SpecialForm.__init__cCst|t�stS|j|jkSr�)rPrU�NotImplementedr��r��otherrZrZr[�__eq__Ds
z_SpecialForm.__eq__cCst|jf�Sr�)�hashr�r�rZrZr[�__hash__Isz_SpecialForm.__hash__cCs
d|jS)N�typing.�r�r�rZrZr[�__repr__Lsz_SpecialForm.__repr__cCs|jSr�r�r�rZrZr[�
__reduce__Osz_SpecialForm.__reduce__cOstd|����dS)NzCannot instantiate r�r�rZrZr[�__call__Rsz_SpecialForm.__call__cCst|�d���dS)Nz! cannot be used with isinstance()r��r�rdrZrZr[�__instancecheck__Usz_SpecialForm.__instancecheck__cCst|�d���dS)Nz! cannot be used with issubclass()r��r�r{rZrZr[�__subclasscheck__Xsz_SpecialForm.__subclasscheck__cs�|jdkr(t||j�d��}t||f�S|jdkr�|dkrBtd��t|t�sR|f}d�t�fdd�|D��}t|�}t|�d	kr�|d
St||�S|jdkr�t|d�}t|t	d�fS|jd
kr�t||�St|�d���dS)N)r	r
z accepts only single type.rrZz Cannot take a Union of no types.z)Union[arg, ...]: each arg must be a type.c3s|]}t|��VqdSr��r\�rgr��rXrZr[r�fsz+_SpecialForm.__getitem__.<locals>.<genexpr>r~rrz#Optional[t] requires a single type.r
z is not subscriptable)
r�r\rRrTrPrpr�rzrrO)r�r|�itemrWrZr�r[�__getitem__[s(







z_SpecialForm.__getitem__)rbr^r_r�r�r�r�r�r�r�r�r�r�r�r�r��
__classcell__rZrZr�r[rU,s
rU)r�a`Special type indicating an unconstrained type.

    - Any is compatible with every type.
    - Any assumed to have all methods.
    - All values assumed to be instances of Any.

    Note that all the above statements are true from the point of view of
    static type checkers. At runtime, Any should not be used with instance
    or class checks.
    )r�aSpecial type indicating functions that never return.
    Example::

      from typing import NoReturn

      def stop() -> NoReturn:
          raise Exception('no way')

    This type is invalid in other positions, e.g., ``List[NoReturn]``
    will fail in static type checkers.
    a3Special type construct to mark class variables.

    An annotation wrapped in ClassVar indicates that a given
    attribute is intended to be used as a class variable and
    should not be set on instances of that class. Usage::

      class Starship:
          stats: ClassVar[Dict[str, int]] = {} # class variable
          damage: int = 10                     # instance variable

    ClassVar accepts only types and cannot be further subscribed.

    Note that ClassVar is not a class itself, and should not
    be used with isinstance() or issubclass().
    a�Special typing construct to indicate final names to type checkers.

    A final name cannot be re-assigned or overridden in a subclass.
    For example:

      MAX_SIZE: Final = 9000
      MAX_SIZE += 1  # Error reported by type checker

      class Connection:
          TIMEOUT: Final[int] = 10

      class FastConnector(Connection):
          TIMEOUT = 1  # Error reported by type checker

    There is no runtime checking of these properties.
    a'Union type; Union[X, Y] means either X or Y.

    To define a union, use e.g. Union[int, str].  Details:
    - The arguments must be types and there must be at least one.
    - None as an argument is a special case and is replaced by
      type(None).
    - Unions of unions are flattened, e.g.::

        Union[Union[int, str], float] == Union[int, str, float]

    - Unions of a single argument vanish, e.g.::

        Union[int] == int  # The constructor actually returns int

    - Redundant arguments are skipped, e.g.::

        Union[int, str, int] == Union[int, str]

    - When comparing unions, the argument order is ignored, e.g.::

        Union[int, str] == Union[str, int]

    - You cannot subclass or instantiate a union.
    - You can use Optional[X] as a shorthand for Union[X, None].
    zEOptional type.

    Optional[X] is equivalent to Union[X, None].
    a�Special typing form to define literal types (a.k.a. value types).

    This form can be used to indicate to type checkers that the corresponding
    variable or function parameter has a value equivalent to the provided
    literal (or one of several literals):

      def validate_simple(data: Any) -> Literal[True]:  # always returns True
          ...

      MODE = Literal['r', 'rb', 'w', 'wb']
      def open_helper(file: str, mode: MODE) -> str:
          ...

      open_helper('/some/path', 'r')  # Passes type check
      open_helper('/other/path', 'typo')  # Error in type checker

   Literal[...] cannot be subclassed. At runtime, an arbitrary value
   is allowed as type argument to Literal[...], but type checkers may
   impose restrictions.
    c@s>eZdZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)rz-Internal wrapper to hold a forward reference.)�__forward_arg__�__forward_code__�__forward_evaluated__�__forward_value__�__forward_is_argument__TcCsnt|t�std|����zt|dd�}Wn"tk
rJtd|����YnX||_||_d|_d|_||_	dS)Nz*Forward reference must be a string -- got z<string>�evalz/Forward reference must be an expression -- got F)
rPrQrT�compile�SyntaxErrorr�r�r�r�r�)r�rWrY�coderZrZr[r��s
zForwardRef.__init__cCsj|jr||k	rd|dkr(|dkr(i}}n|dkr6|}n|dkrB|}tt|j||�d|jd�|_d|_|jS)Nz*Forward references must evaluate to types.�rYT)r�r\r�r�r�r�)r�r�r�rZrZr[r��s
�zForwardRef._evaluatecCs>t|t�stS|jr2|jr2|j|jko0|j|jkS|j|jkSr�)rPrr�r�r�r�r�rZrZr[r�s

�zForwardRef.__eq__cCs
t|j�Sr�)r�r�r�rZrZr[r�szForwardRef.__hash__cCsd|j�d�S)NzForwardRef(�))r�r�rZrZr[r�szForwardRef.__repr__N)T)
rbr^r_r�r�r�r�r�r�r�rZrZrZr[r�s

c@s6eZdZdZdZdddd�dd�Zdd	�Zd
d�ZdS)ra�Type variable.

    Usage::

      T = TypeVar('T')  # Can be anything
      A = TypeVar('A', str, bytes)  # Must be str or bytes

    Type variables exist primarily for the benefit of static type
    checkers.  They serve as the parameters for generic types as well
    as for generic function definitions.  See class Generic for more
    information on generic types.  Generic functions work as follows:

      def repeat(x: T, n: int) -> List[T]:
          '''Return a list containing n references to x.'''
          return [x]*n

      def longest(x: A, y: A) -> A:
          '''Return the longest of two strings.'''
          return x if len(x) >= len(y) else y

    The latter example's signature is essentially the overloading
    of (str, str) -> str and (bytes, bytes) -> bytes.  Also note
    that if the arguments are instances of some subclass of str,
    the return type is still plain str.

    At runtime, isinstance(x, T) and issubclass(C, T) will raise TypeError.

    Type variables defined with covariant=True or contravariant=True
    can be used to declare covariant or contravariant generic types.
    See PEP 484 for more details. By default generic types are invariant
    in all type variables.

    Type variables can be introspected. e.g.:

      T.__name__ == 'T'
      T.__constraints__ == ()
      T.__covariant__ == False
      T.__contravariant__ = False
      A.__constraints__ == (str, bytes)

    Note that only type variables defined in global scope can be pickled.
    )rb�	__bound__�__constraints__�
__covariant__�__contravariant__NF)�bound�	covariant�
contravariantc	s�||_|r|rtd��t|�|_t|�|_|r>|dk	r>td��|rVt|�dkrVtd��d�t�fdd�|D��|_|r�t	|d�|_
nd|_
zt�d�j
�d	d
�}Wnttfk
r�d}YnX|dkr�||_dS)Nz"Bivariant types are not supported.z-Constraints cannot be combined with bound=...r~z"A single constraint is not allowedz:TypeVar(name, constraint, ...): constraints must be types.c3s|]}t|��VqdSr�r�rfr�rZr[r�Vsz#TypeVar.__init__.<locals>.<genexpr>zBound must be a type.rb�__main__�typing)rb�
ValueError�boolr�r�rTrzrpr�r\r��sys�	_getframe�	f_globals�get�AttributeErrorr^)r�r�r�r�r�ZconstraintsZdef_modrZr�r[r�Js(


zTypeVar.__init__cCs&|jrd}n|jrd}nd}||jS)N�+�-�~)r�r�rb)r��prefixrZrZr[r�bszTypeVar.__repr__cCs|jSr�)rbr�rZrZr[r�kszTypeVar.__reduce__)rbr^r_r�r�r�r�r�rZrZrZr[rs+�	)	rrrp�dictr�	frozenset�deque�defaultdictrOr;cCs|�d�o|�d�S)N�__)�
startswith�endswith)�attrrZrZr[�
_is_dunder�sr�cs�eZdZdZdddd�dd�Zedd	��Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
�fdd�Zdd�Zdd�Zdd�Z�ZS) rRa�The central part of internal API.

    This represents a generic version of type 'origin' with type arguments 'params'.
    There are two kind of these aliases: user defined and special. The special ones
    are wrappers around builtin collections and ABCs in collections.abc. These must
    have 'name' always set. If 'inst' is False, then the alias can't be instantiated,
    this is used by e.g. typing.List and typing.Dict.
    TFN)�inst�specialr�cCsz||_||_|r*|dkr*|j}t�||�}||_t|t�s@|f}||_tdd�|D��|_	t
|�|_d|_|sv|j
|_
dS)Ncss*|]"}|tkrdn|tkrdn|VqdS).rZN)�_TypingEllipsis�_TypingEmptyr�rZrZr[r��s�z)_GenericAlias.__init__.<locals>.<genexpr>)�_instrmrb�_normalize_aliasr�r�rPrprSrsrqror�r^)r��originr�r�r�r�Z	orig_namerZrZr[r��s 
�

z_GenericAlias.__init__cs^|jttfkrtd|����t|t�s,|f}d�t�fdd�|D��}t||�t||j|�S)Nz%Cannot subscript already-subscripted �*Parameters to generic types must be types.c3s|]}t|��VqdSr�r�r�r�rZr[r��sz,_GenericAlias.__getitem__.<locals>.<genexpr>)	rSrrrTrPrpr}ruro�r�r�rZr�r[r��s

z_GenericAlias.__getitem__cCst|j||j|jd�S)N)r�r�)rRrSr�r�r�rZrZr[rv�sz_GenericAlias.copy_withcCs�|jdks&t|j�dkrx|jdtkrx|jr8d|j}n
t|j�}|jshdd�dd�|jD���d	�}nd
}|�|��S|jr�dSdd�d
d�|jdd�D���dt|jd��d	�S)Nr�rr��[�, cSsg|]}t|��qSrZ�rer�rZrZr[rk�sz*_GenericAlias.__repr__.<locals>.<listcomp>�]�ztyping.Callableztyping.Callable[[cSsg|]}t|��qSrZr�r�rZrZr[rk�s���z], )r�rzrs�EllipsisrerSrm�join)r�r�r�rZrZr[r��s
��
 z_GenericAlias.__repr__cCsRt|t�stS|j|jkrdS|jtkrF|jtkrFt|j�t|j�kS|j|jkS)NF)rPrRr�rSrr�rsr�rZrZr[r��s
z_GenericAlias.__eq__cCs,|jtkrttt|j�f�St|j|jf�Sr�)rSrr�r�rsr�rZrZr[r��s
z_GenericAlias.__hash__cOsT|js$td|j�d|j���d���|j||�}z
||_Wntk
rNYnX|S)N�Type z cannot be instantiated; use z
() instead)r�rTr��lowerrS�__orig_class__r�)r�r��kwargs�resultrZrZr[r��s
z_GenericAlias.__call__cCs�|jrZg}|j|kr |�|j�|�|�}tdd�||dd�D��sR|�t�t|�S|jtkr�t|krpdS|�|�}||dd�D]}t|t	�r�||k	r�dSq�|jfS)Ncss"|]}t|t�pt|t�VqdSr�)rPrR�
issubclassr�rg�brZrZr[r��s�z0_GenericAlias.__mro_entries__.<locals>.<genexpr>r~rZ)
r�rSrl�index�anyrrprrPrR)r��basesr�ryrrZrZr[�__mro_entries__�s$

�


z_GenericAlias.__mro_entries__cCs*d|jkrt|�st|j|�St|��dS)NrS)�__dict__r��getattrrSr�)r�r�rZrZr[�__getattr__�sz_GenericAlias.__getattr__cs2t|�s|dkr t��||�nt|j||�dS)N)r�r�rm)r�r��__setattr__�setattrrS)r�r��valr�rZr[r�sz_GenericAlias.__setattr__cCs|�t|��Sr�)r�rOr�rZrZr[r�sz_GenericAlias.__instancecheck__cCs<|jr0t|t�st||j�S|jr0t|j|j�Std��dS)NzBSubscripted generics cannot be used with class and instance checks)rmrPrRrrSrTr�rZrZr[r�s
z_GenericAlias.__subclasscheck__cCs�|jr|jS|jr t�|j}n|j}|tkrht|j�dkrJ|jdtksht|jdd��|jdf}n*t	|j�}t|�dkr�t
|dt	�s�|\}tj||ffS)Nr�rr�r~)
rmr��globalsrSrrzrsr�rrrprP�operator�getitem)r�r�r�rZrZr[r�s��
z_GenericAlias.__reduce__)rbr^r_r�r�r�r�rvr�r�r�r�rrrr�r�r�r�rZrZr�r[rR�s
		rRcs,eZdZdZdd�Ze�fdd��Z�ZS)�_VariadicGenericAliasz�Same as _GenericAlias above but for variadic aliases. Currently,
    this is used only by special internal aliases: Tuple and Callable.
    cCs�|jdks|js|�|�St|t�r0t|�dkr8td��|\}}|tkrRt|f}n$t|t�sjtd|����t|�|f}|�|�S)Nrr�z6Callable must be used as Callable[[arg, ...], result].z1Callable[args, result]: args must be a list. Got )	r�rm�__getitem_inner__rPrprzrTr�rr)r�r�r�rrZrZr[r�"s


z!_VariadicGenericAlias.__getitem__cs
|jtkr�|jr�|dkr$|�tf�St|t�s4|f}t|�dkrl|ddkrld�t|d��}|�|tf�Sd�t�fdd	�|D��}|�|�S|jt	j
jkr�|jr�|\}}d
�t|��}|tkr�|�t|f�Sd�t�fdd	�|D��}||f}|�|�St
��|�S)
NrZr�r~.z Tuple[t, ...]: t must be a type.rz*Tuple[t0, t1, ...]: each t must be a type.c3s|]}t|��VqdSr�r�r�r�rZr[r�>sz:_VariadicGenericAlias.__getitem_inner__.<locals>.<genexpr>z.Callable[args, result]: result must be a type.z6Callable[[arg, ...], result]: each arg must be a type.c3s|]}t|��VqdSr�r�)rgrWr�rZr[r�Gs)rSrprmrvr�rPrzr\r��collections�abcrr�r�r�)r�r�r�r�rr�r�r[r2s.




z'_VariadicGenericAlias.__getitem_inner__)rbr^r_r�r�r�rr�rZrZr�r[rsrcs@eZdZdZdZdZ�fdd�Zedd��Z�fdd	�Z	�Z
S)
raCAbstract base class for generic types.

    A generic type is typically declared by inheriting from
    this class parameterized with one or more type variables.
    For example, a generic mapping type might be defined as::

      class Mapping(Generic[KT, VT]):
          def __getitem__(self, key: KT) -> VT:
              ...
          # Etc.

    This class can then be used as follows::

      def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
          try:
              return mapping[key]
          except KeyError:
              return default
    rZFcs^|ttfkrtd|j�d���t�jtjkrF|jtjk	rFt��|�}nt�j|f|�|�}|S)Nrz< cannot be instantiated; it can be used only as a base class)rrrTrbr�r��objectr�)r{r�r�rdr�rZr[r�dszGeneric.__new__cs�t|t�s|f}|s.|tk	r.td|j�d���d�t�fdd�|D��}|ttfkr�tdd�|D��sxtd|j�d���t	t
|��t	|�kr�td|j�d	���n
t||�t||�S)
NzParameter list to z[...] cannot be emptyr�c3s|]}t|��VqdSr�r�r�r�rZr[r�vsz,Generic.__class_getitem__.<locals>.<genexpr>css|]}t|t�VqdSr�)rPrr�rZrZr[r�yszParameters to z [...] must all be type variablesz[...] must all be unique)
rPrprrTr_rr�allrbrzrr}rR)r{r�rZr�r[�__class_getitem__ns&
���
zGeneric.__class_getitem__c
s
t�j||�g}d|jkr(t|jk}nt|jko:|jdk}|rHtd��d|jkr�t|j�}d}|jD].}t	|t
�rf|jtkrf|dk	r�td��|j}qf|dk	r�t
|�}t
|��|�ks�d��fdd�|D��}d�dd�|D��}	td	|�d
|	�d���|}t|�|_dS)N�__orig_bases__rz!Cannot inherit from plain Genericz0Cannot inherit from Generic[...] multiple types.r�c3s|]}|�krt|�VqdSr��rQrf�ZgvarsetrZr[r��sz,Generic.__init_subclass__.<locals>.<genexpr>css|]}t|�VqdSr�r)rg�grZrZr[r��szSome type variables (z) are not listed in Generic[r�)r�r�rrr�	__bases__rbrTrqrPrRrSrorr�rp)
r{r�rrj�errorZgvars�baseZtvarsetZs_varsZs_argsr�rr[r��s8




��zGeneric.__init_subclass__)rbr^r_r�r��_is_protocolr�r�rr�r�rZrZr�r[rMs

c@seZdZdZdS)r�z�Internal placeholder for () or []. Used by TupleMeta and CallableMeta
    to allow empty list/tuple in specific places, without allowing them
    to sneak in where prohibited.
    N�rbr^r_r�rZrZrZr[r��sr�c@seZdZdZdS)r�z(Internal placeholder for ... (ellipsis).Nr$rZrZrZr[r��sr�rorrr#�_is_runtime_protocol�__abstractmethods__�__annotations__rr�r�r^r�r��__subclasshook__r��_MutableMapping__markercCsrt�}|jdd�D]X}|jdkr$qt|di�}t|j���t|���D] }|�d�sJ|tkrJ|�	|�qJq|S)z�Collect protocol members from a protocol class objects.

    This includes names actually defined in the class dictionary, as well
    as names that appear in annotations. Special names (above) are skipped.
    Nr�)rrr'Z_abc_)
r�__mro__rbr
rrr�keysr��EXCLUDED_ATTRIBUTES�add)r{�attrsr"�annotationsr�rZrZr[�_get_protocol_attrs�s
r0cst�fdd�t��D��S)Nc3s|]}tt�|d��VqdSr�)rVr
�rgr��r{rZr[r��sz,_is_callable_members_only.<locals>.<genexpr>)rr0r2rZr2r[�_is_callable_members_only�sr3cOst|�jrtd��dS)Nz Protocols cannot be instantiated)rOr#rT)r�r�rrZrZr[�_no_init�s
r4c	Cs6zt�d�jddkWSttfk
r0YdSXdS)z�Allow instnance and class checks for special stdlib modules.

    The abc and functools modules indiscriminately call isinstance() and
    issubclass() on the whole MRO of a user class, which may contain protocols.
    r�rb)rr�TN)r�r�r�r�r�rZrZrZr[�_allow_reckless_class_cheks�sr5�AbstractContextManager�AbstractAsyncContextManager)zcollections.abc�
contextlibcseZdZ�fdd�Z�ZS)�
_ProtocolMetacsVt�dd�rt��r$t�j��r$dS�jrJt��fdd�t��D��rJdSt����S)Nr#FTc3s8|]0}t�|�o.tt�|d��p.t�|�dk	VqdSr�)�hasattrrVr
r1�r{�instancerZr[r��s�
z2_ProtocolMeta.__instancecheck__.<locals>.<genexpr>)	r
r3rr�r#rr0r�r�r;r�r;r[r��s�
��z_ProtocolMeta.__instancecheck__)rbr^r_r�r�rZrZr�r[r9�sr9cs,eZdZdZdZdZdZ�fdd�Z�ZS)raZBase class for protocol classes.

    Protocol classes are defined as::

        class Proto(Protocol):
            def meth(self) -> int:
                ...

    Such classes are primarily used with static type checkers that recognize
    structural subtyping (static duck-typing), for example::

        class C:
            def meth(self) -> int:
                return 0

        def func(x: Proto) -> int:
            return x.meth()

        func(C())  # Passes static type check

    See PEP 544 for details. Protocol classes decorated with
    @typing.runtime_checkable act as simple-minded runtime protocols that check
    only the presence of given attributes, ignoring their type signatures.
    Protocol classes can be generic, they are defined as::

        class GenProto(Protocol[T]):
            def meth(self) -> T:
                ...
    rZTFcs�t�j||��j�dd�s2tdd��jD���_�fdd�}d�jkrN|�_�jsXdS�jD]F}|tt	fks^|j
tkr�|jt|j
ks^t
|t	�r�|js^td|��q^t�_dS)	Nr#Fcss|]}|tkVqdSr�)rrrZrZr[r�)sz-Protocol.__init_subclass__.<locals>.<genexpr>cs��j�dd�stSt�dd�s0t�r(tStd��t��sJt�rBtStd��t|t�s\td��t	��D]v}|j
D]b}||jkr�|j|dkr�tSqdt|di�}t|tjj
�rn||krnt|t�rn|jrnqdqntSqddS)	Nr#Fr%zLInstance and class checks can only be used with @runtime_checkable protocolsz<Protocols with non-method members don't support issubclass()z"issubclass() arg 1 must be a classr'T)rr�r�r
r5rTr3rPrOr0r*rrrrrr#)r�r�r"r/r2rZr[�_proto_hook,s:


���
z/Protocol.__init_subclass__.<locals>._proto_hookr(z7Protocols can only inherit from other protocols, got %r)r�r�rr�r	r r#r(rrr^�_PROTO_WHITELISTrbrrTr4r�)r{r�rr=r"r�r2r[r�$s,&

�����zProtocol.__init_subclass__)	rbr^r_r�r�r#r%r�r�rZrZr�r[rs
)�	metaclasscCs&t|t�r|jstd|��d|_|S)a9Mark a protocol class as a runtime protocol.

    Such protocol can be used with isinstance() and issubclass().
    Raise TypeError if applied to a non-protocol class.
    This allows a simple-minded structural check very similar to
    one trick ponies in collections.abc such as Iterable.
    For example::

        @runtime_checkable
        class Closable(Protocol):
            def close(self): ...

        assert isinstance(open('/some/file'), Closable)

    Warning: this will check only the presence of the required methods,
    not their type signatures!
    zB@runtime_checkable can be only applied to protocol classes, got %rT)rrr#rTr%r2rZrZr[rKds�cCs|S)z�Cast a value to a type.

    This returns the value unchanged.  To the type checker this
    signals that the return value has the designated type, but at
    runtime we intentionally don't check anything (we want this
    to be as fast as possible).
    rZ)�typrrZrZr[rA}sc
Cs�z
|j}Wntk
r"iYSX|j}|j}|d|�}|jpDd}|j}|rXt|�ni}|t|�}t||d�|�D]\}}	|	||<qz|S)z:Internal helper to extract the default arguments, by name.NrZ)	�__code__r��co_argcount�co_varnames�__defaults__�__kwdefaults__r�rz�zip)
r�r�Z	pos_countZ	arg_names�defaultsZ
kwdefaultsr�Z
pos_offsetr��valuerZrZr[�
_get_defaults�s



rIcCs�t|dd�riSt|t�r�i}t|j�D]z}|dkrDtj|jj}n|}|j�	di�}|�
�D]B\}}|dkrvtd�}t|t�r�t|dd�}t
|||�}|||<q^q(|S|dkr�t|tj�r�|j}n"|}	t|	d�r�|	j}	q�t|	di�}|dkr�|}n|dk�r|}t|dd�}|dk�r6t|t��r(iStd�|���t|�}
t|�}|�
�D]d\}}|dk�rhtd�}t|t��r|t|�}t
|||�}||
k�r�|
|dk�r�t|}|||<�qN|S)	a�Return type hints for an object.

    This is often the same as obj.__annotations__, but it handles
    forward references encoded as string literals, and if necessary
    adds Optional[t] if a default value equal to None is set.

    The argument may be a module, class, method, or function. The annotations
    are returned as a dictionary. For classes, annotations include also
    inherited members.

    TypeError is raised if the argument is not of a type that can contain
    annotations, and an empty dictionary is returned if no annotations are
    present.

    BEWARE -- the behavior of globalns and localns is counterintuitive
    (unless you are familiar with how eval() and exec() work).  The
    search order is locals first, then globals.

    - If no dict arguments are passed, an attempt is made to use the
      globals from obj (or the respective module's globals for classes),
      and these are also used as the locals.  If the object does not appear
      to have globals, an empty dictionary is used.

    - If one dict argument is passed, it is used for both globals and
      locals.

    - If two dict arguments are passed, they specify globals and
      locals, respectively.
    �__no_type_check__Nr'Fr��__wrapped__�__globals__z1{!r} is not a module, class, method, or function.)r
rPrO�reversedr*r��modulesr^rr��itemsrQrr�r`�
ModuleTyper:rK�_allowed_typesrT�formatrIr�r)rdr�r�Zhintsr"Zbase_globals�annr�rHZnsobjrGrZrZr[rE�s^




�
cCs t|t�r|jS|tkrtSdS)a�Get the unsubscripted version of a type.

    This supports generic types, Callable, Tuple, Union, Literal, Final and ClassVar.
    Return None for unsupported types. Examples::

        get_origin(Literal[42]) is Literal
        get_origin(int) is None
        get_origin(ClassVar[int]) is ClassVar
        get_origin(Generic) is Generic
        get_origin(Generic[T]) is Generic
        get_origin(Union[T, int]) is Union
        get_origin(List[Tuple[T, T]][int]) == list
    N)rPrRrSr)rwrZrZr[rD�s

cCsRt|t�rN|jsN|j}t|�tjjkrJ|dtk	rJt	|dd��|df}|SdS)a�Get type arguments with all substitutions performed.

    For unions, basic simplifications used by Union constructor are performed.
    Examples::
        get_args(Dict[str, int]) == (str, int)
        get_args(int) == ()
        get_args(Union[int, Union[T, int], str][int]) == (int, str)
        get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, int])
        get_args(Callable[[], T][int]) == ([], int)
    rNr�rZ)
rPrRrmrsrDrrrr�rr)rwr�rZrZr[rCscCs�t|t�rt|j��}|j��D]"\}}||j|fkr|�|�q|��D](}t|tj	�r`d|_
t|t�rJt|�qJz
d|_
Wntk
r�YnX|S)aIDecorator to indicate that annotations are not type hints.

    The argument must be a class or function; if it is a class, it
    applies recursively to all methods and classes defined in that class
    (but not to methods defined in its superclasses or subclasses).

    This mutates the function(s) or class(es) in place.
    T)
rPrOr�copyrOr �pop�valuesr`rarJrGrT)rWZ	arg_attrsr�rrdrZrZr[rGs	




cst����fdd��}|S)z�Decorator to give another decorator the @no_type_check effect.

    This wraps the decorator with something that wraps the decorated
    function in @no_type_check.
    cs�||�}t|�}|Sr�)rG)r�r�r���	decoratorrZr[�wrapped_decorator@s
z2no_type_check_decorator.<locals>.wrapped_decorator)r�r�)rXrYrZrWr[rH9scOstd��dS)z*Helper for @overload to raise when called.z�You should not call an overloaded function. A series of @overload-decorated functions outside a stub module should always be followed by an implementation that is not @overload-ed.N)�NotImplementedErrorr�rZrZr[�_overload_dummyIs�r[cCstS)a
Decorator for overloaded functions/methods.

    In a stub file, place two or more stub definitions for the same
    function in a row, each decorated with @overload.  For example:

      @overload
      def utf8(value: None) -> None: ...
      @overload
      def utf8(value: bytes) -> bytes: ...
      @overload
      def utf8(value: str) -> bytes: ...

    In a non-stub file (i.e. a regular .py file), do the same but
    follow it with an implementation.  The implementation should *not*
    be decorated with @overload.  For example:

      @overload
      def utf8(value: None) -> None: ...
      @overload
      def utf8(value: bytes) -> bytes: ...
      @overload
      def utf8(value: str) -> bytes: ...
      def utf8(value):
          # implementation goes here
    )r[)r�rZrZr[rJRscCs|S)aVA decorator to indicate final methods and final classes.

    Use this decorator to indicate to type checkers that the decorated
    method cannot be overridden, and decorated class cannot be subclassed.
    For example:

      class Base:
          @final
          def done(self) -> None:
              ...
      class Sub(Base):
          def done(self) -> None:  # Error reported by type checker
                ...

      @final
      class Leaf:
          ...
      class Other(Leaf):  # Error reported by type checker
          ...

    There is no runtime checking of these properties.
    rZ)�frZrZr[rBos�T�KT�VT�T_co)r��V_co�VT_co�T_contra)r��CT_co)r�r�cCst||d|d�S)NT)r�r�)rR)r�r�r�rZrZr[�_alias�srerZ)r�a�Callable type; Callable[[int], str] is a function of (int) -> str.

    The subscription syntax must always be used with exactly two
    values: the argument list and the return type.  The argument list
    must be a list of types or ellipsis; the return type must be a single type.

    There is no syntax to indicate optional or keyword arguments,
    such function types are rarely used as callback types.
    F)r�r�a@Tuple type; Tuple[X, Y] is the cross-product type of X and Y.

    Example: Tuple[T1, T2] is a tuple of two elements corresponding
    to type variables T1 and T2.  Tuple[int, float, str] is a tuple
    of an int, a float and a string.

    To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
    )r�a�A special construct usable to annotate class objects.

    For example, suppose we have the following classes::

      class User: ...  # Abstract base for User classes
      class BasicUser(User): ...
      class ProUser(User): ...
      class TeamUser(User): ...

    And a function that takes a class argument that's a subclass of
    User and returns an instance of the corresponding class::

      U = TypeVar('U', bound=User)
      def new_user(user_class: Type[U]) -> U:
          user = user_class()
          # (Here we could write the user object to a database)
          return user

      joe = new_user(BasicUser)

    At this point the type checker knows that joe has type BasicUser.
    c@s&eZdZdZdZeed�dd��ZdS)r2z(An ABC with one abstract method __int__.rZ��returncCsdSr�rZr�rZrZr[�__int__�szSupportsInt.__int__N)rbr^r_r�r�r�intrhrZrZrZr[r2�sc@s&eZdZdZdZeed�dd��ZdS)r0z*An ABC with one abstract method __float__.rZrfcCsdSr�rZr�rZrZr[�	__float__szSupportsFloat.__float__N)rbr^r_r�r�r�floatrjrZrZrZr[r0�sc@s&eZdZdZdZeed�dd��ZdS)r/z,An ABC with one abstract method __complex__.rZrfcCsdSr�rZr�rZrZr[�__complex__
szSupportsComplex.__complex__N)rbr^r_r�r�r�complexrlrZrZrZr[r/sc@s&eZdZdZdZeed�dd��ZdS)r.z*An ABC with one abstract method __bytes__.rZrfcCsdSr�rZr�rZrZr[�	__bytes__szSupportsBytes.__bytes__N)rbr^r_r�r�r�bytesrnrZrZrZr[r.sc@s&eZdZdZdZeed�dd��ZdS)r1z*An ABC with one abstract method __index__.rZrfcCsdSr�rZr�rZrZr[�	__index__szSupportsIndex.__index__N)rbr^r_r�r�rrirprZrZrZr[r1sc@s&eZdZdZdZeed�dd��ZdS)r-zMAn ABC with one abstract method __abs__ that is covariant in its return type.rZrfcCsdSr�rZr�rZrZr[�__abs__(szSupportsAbs.__abs__N)rbr^r_r�r�rr`rqrZrZrZr[r-#sc@s*eZdZdZdZedeed�dd��ZdS)	r3zOAn ABC with one abstract method __round__ that is covariant in its return type.rZr)�ndigitsrgcCsdSr�rZ)r�rrrZrZr[�	__round__2szSupportsRound.__round__N)r)	rbr^r_r�r�rrir`rsrZrZrZr[r3-sc	std��fdd�|D�}t�|dd�|D��}t|�|_|_zt�d�j�dd�|_	Wnt
tfk
rnYnX|S)NzDNamedTuple('Name', [(f0, t0), (f1, t1), ...]); each t must be a typecsg|]\}}|t|��f�qSrZr��rg�nrhr�rZr[rk9sz!_make_nmtuple.<locals>.<listcomp>cSsg|]\}}|�qSrZrZrtrZrZr[rk:sr�rbr�)r�
namedtupler�r'�_field_typesr�r�r�r�r^r�r�)r�r`�nm_tplrZr�r[�
_make_nmtuple7sry)r�r�r��__getnewargs__�_fields�_field_defaultsrw�_make�_replace�_asdictZ_source)r^rbr'cseZdZ�fdd�Z�ZS)�NamedTupleMetacs�|�dd�rt��||||�S|�di�}t||���}g}i}|D]H}||krl||}	|�|	�|	||<qD|rDtdj|d�|�	��d���qDt
|�|j_t|�|j_
||_|D]<}
|
tkr�td|
��q�|
tkr�|
|jkr�t||
||
�q�|S)Nr�Fr'zXNon-default namedtuple field {field_name} cannot follow default field(s) {default_names}r�)�
field_nameZ
default_namesz&Cannot overwrite NamedTuple attribute )r�r�r�ryrOrlrTrRr�r+r�r'rprDr|�_prohibitedr�rmr{r)r{�typenamer
�nsr`rxrGZ
defaults_dictr�Z
default_value�keyr�rZr[r�Os2

�
zNamedTupleMeta.__new__)rbr^r_r�r�rZrZr�r[r�Msr�c@s"eZdZdZdZdd�Zde_dS)r=a�Typed version of namedtuple.

    Usage in Python versions >= 3.6::

        class Employee(NamedTuple):
            name: str
            id: int

    This is equivalent to::

        Employee = collections.namedtuple('Employee', ['name', 'id'])

    The resulting class has an extra __annotations__ attribute, giving a
    dict that maps field names to types.  (The field names are also in
    the _fields attribute, which is part of the namedtuple API.)
    Alternative equivalent keyword syntax is also accepted::

        Employee = NamedTuple('Employee', name=str, id=int)

    In Python versions <= 3.5 use::

        Employee = NamedTuple('Employee', [('name', str), ('id', int)])
    TcOs�|std��|^}}|r"|^}}n4d|krN|�d�}ddl}|jdtdd�ntd��|r�z
|\}Wq�tk
r�tdt|�d�d	��d�Yq�Xn<d
|kr�t|�dkr�|�d
�}ddl}|jdtdd�nd}|dkr�|��}n|r�td
��t||�S)Nz*NamedTuple.__new__(): not enough argumentsr�rz4Passing 'typename' as keyword argument is deprecatedr�)�
stacklevelzGNamedTuple.__new__() missing 1 required positional argument: 'typename'z@NamedTuple.__new__() takes from 2 to 3 positional arguments but z were given�fieldsr~z2Passing 'fields' as keyword argument is deprecatedzIEither list of fields or keywords can be provided to NamedTuple, not both)	rTrU�warnings�warn�DeprecationWarningr�rzrOry)r�rr{r�r�r�rZrZr[r��sB

�
�

�
zNamedTuple.__new__z*($cls, typename, fields=None, /, **kwargs)N)rbr^r_r�r�r��__text_signature__rZrZrZr[r=ls#cOs
t||�Sr�)r�)r{r�rrZrZr[�	_dict_new�sr�)�totalc	Ksj|dkr|}n|rtd��t|�|d�}zt�d�j�dd�|d<Wnttfk
r\YnXt|d|�S)Nz@TypedDict takes either a dict or keyword arguments, but not both)r'�	__total__r~rbr�r^rZ)	rTr�r�r�r�r�r�r��_TypedDictMeta)r{r�r�r�rr�rZrZr[�_typeddict_new�sr�cCstd��dS)Nz4TypedDict does not support instance and class checksr�)r{r�rZrZr[�_check_fails�sr�cs&eZdZd�fdd�	ZeZZ�ZS)r�Tcs�|dkrtnt|d<tt|��||tf|�}|�di�}d��fdd�|��D�}|D]}|�|j	�di��qV||_
t|d�s�||_|S)agCreate new typed dict class object.

        This method is called directly when TypedDict is subclassed,
        or via _typeddict_new when TypedDict is instantiated. This way
        TypedDict supports all three syntax forms described in its docstring.
        Subclasses and instances of TypedDict return actual dictionaries
        via _dict_new.
        r>r�r'z?TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a typecsi|]\}}|t|���qSrZr�)rgrurwr�rZr[�
<dictcomp>�sz*_TypedDictMeta.__new__.<locals>.<dictcomp>r�)
r�r�r�r�r�r�r�rO�updaterr'r:r�)r{r�r
r�r�Ztp_dictZannsr"r�r�r[r��s	
z_TypedDictMeta.__new__)T)rbr^r_r�r�r�r�r�rZrZr�r[r��sr�c@seZdZdZdS)r>a�A simple typed namespace. At runtime it is equivalent to a plain dict.

    TypedDict creates a dictionary type that expects all of its
    instances to have a certain set of keys, where each key is
    associated with a value of a consistent type. This expectation
    is not checked at runtime but is only enforced by type checkers.
    Usage::

        class Point2D(TypedDict):
            x: int
            y: int
            label: str

        a: Point2D = {'x': 1, 'y': 2, 'label': 'good'}  # OK
        b: Point2D = {'z': 3, 'label': 'bad'}           # Fails type check

        assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')

    The type info can be accessed via Point2D.__annotations__. TypedDict
    supports two additional equivalent forms::

        Point2D = TypedDict('Point2D', x=int, y=int, label=str)
        Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})

    By default, all keys must be present in a TypedDict. It is possible
    to override this by specifying totality.
    Usage::

        class point2D(TypedDict, total=False):
            x: int
            y: int

    This means that a point2D TypedDict can have any of the keys omitted.A type
    checker is only expected to support a literal False or True as the value of
    the total argument. True is the default, and makes all items defined in the
    class body be required.

    The class syntax is only supported in Python 3.6+, while two other
    syntax forms work for Python 2.7 and 3.2+
    Nr$rZrZrZr[r>�scCsdd�}||_||_|S)a%NewType creates simple unique types with almost zero
    runtime overhead. NewType(name, tp) is considered a subtype of tp
    by static type checkers. At runtime, NewType(name, tp) returns
    a dummy function that simply returns its argument. Usage::

        UserId = NewType('UserId', int)

        def name_by_id(user_id: UserId) -> str:
            ...

        UserId('user')          # Fails type check

        name_by_id(42)          # Fails type check
        name_by_id(UserId(42))  # OK

        num = UserId(5) + 1     # type: int
    cSs|Sr�rZ)�xrZrZr[�new_typeszNewType.<locals>.new_type)rbZ
__supertype__)r�rwr�rZrZr[rFsc@s�eZdZdZdZeeed�dd���Zeeed�dd���Z	edd�d	d
��Z
eeed�dd���Zee
d�d
d��Zedd�dd��Zeed�dd��Zed7e
ed�dd��Zeed�dd��Zed8e
ed�dd��Zed9e
eed�dd��Zed:e
e
e
d �d!d"��Zeed�d#d$��Zee
d�d%d&��Zed;e
e
d'�d(d)��Zeed�d*d+��Zeee
d,�d-d.��Zeeedd/�d0d1��Zed2d�d3d4��Zedd�d5d6��ZdS)<�IOa�Generic base class for TextIO and BinaryIO.

    This is an abstract, generic version of the return of open().

    NOTE: This does not distinguish between the different possible
    classes (text vs. binary, read vs. write vs. read/write,
    append-only, unbuffered).  The TextIO and BinaryIO subclasses
    below capture the distinctions between text vs. binary, which is
    pervasive in the interface; however we currently do not offer a
    way to track the other distinctions in the type system.
    rZrfcCsdSr�rZr�rZrZr[�mode=szIO.modecCsdSr�rZr�rZrZr[r�BszIO.nameNcCsdSr�rZr�rZrZr[�closeGszIO.closecCsdSr�rZr�rZrZr[�closedKsz	IO.closedcCsdSr�rZr�rZrZr[�filenoPsz	IO.filenocCsdSr�rZr�rZrZr[�flushTszIO.flushcCsdSr�rZr�rZrZr[�isattyXsz	IO.isattyr�)rurgcCsdSr�rZ)r�rurZrZr[�read\szIO.readcCsdSr�rZr�rZrZr[�readable`szIO.readable)�limitrgcCsdSr�rZ)r�r�rZrZr[�readlinedszIO.readline)�hintrgcCsdSr�rZ)r�r�rZrZr[�	readlineshszIO.readlinesr)�offset�whencergcCsdSr�rZ)r�r�r�rZrZr[�seeklszIO.seekcCsdSr�rZr�rZrZr[�seekablepszIO.seekablecCsdSr�rZr�rZrZr[�telltszIO.tell)�sizergcCsdSr�rZ)r�r�rZrZr[�truncatexszIO.truncatecCsdSr�rZr�rZrZr[�writable|szIO.writable��srgcCsdSr�rZ�r�r�rZrZr[�write�szIO.write)�linesrgcCsdSr�rZ)r�r�rZrZr[�
writelines�sz
IO.writelinesz
IO[AnyStr]cCsdSr�rZr�rZrZr[�	__enter__�szIO.__enter__cCsdSr�rZ)r�rOrH�	tracebackrZrZr[�__exit__�szIO.__exit__)r�)r�)r�)r)N) rbr^r_r�r��propertyrrQr�r�r�r�r�rir�r�r�r@r�r�r�r9r�r�r�r�r�r�r�r�r�r�rZrZrZr[r�.sZr�c@sBeZdZdZdZeeeefe	d�dd��Z
edd�dd��Zd	S)
�BinaryIOz5Typed version of the return of open() in binary mode.rZr�cCsdSr�rZr�rZrZr[r��szBinaryIO.writerfcCsdSr�rZr�rZrZr[r��szBinaryIO.__enter__N)rbr^r_r�r�rrro�	bytearrayrir�r�rZrZrZr[r��sr�c@s�eZdZdZdZeeed�dd���Zeee	d�dd���Z
eeee	d�dd	���Zeee
d�d
d���Zeeed�dd
���Zedd�dd��ZdS)�TextIOz3Typed version of the return of open() in text mode.rZrfcCsdSr�rZr�rZrZr[�buffer�sz
TextIO.buffercCsdSr�rZr�rZrZr[�encoding�szTextIO.encodingcCsdSr�rZr�rZrZr[�errors�sz
TextIO.errorscCsdSr�rZr�rZrZr[�line_buffering�szTextIO.line_bufferingcCsdSr�rZr�rZrZr[�newlines�szTextIO.newlinescCsdSr�rZr�rZrZr[r��szTextIO.__enter__N)rbr^r_r�r�r�rr�r�rQr�rr�r�r�rr�r�rZrZrZr[r��s&r�c@s&eZdZdZdddgZeZeZeZdS)�ioz)Wrapper namespace for IO generic classes.r�r�r�N)rbr^r_r��__all__r�r�r�rZrZrZr[r��s

r�z.ioc@s eZdZdZddgZeZeZdS)�rez&Wrapper namespace for re type aliases.�Pattern�MatchN)rbr^r_r�r�r�r�rZrZrZr[r��sr�z.re)T)NN)T)N)�r�rrrrZcollections.abcr8r�rr�Z	stdlib_rer�r`rrrr�r\rerqrur}r�r�r�r�r�r�rUrrIr	r
rrr
rrr�r�rRrrr�r�Z_TYPING_INTERNALSZ_SPECIAL_NAMESr,r0r3r4r5r>r9rrKrArIra�BuiltinFunctionType�
MethodTyperPrQrErDrCrGrHr[rJrBr]r^r_r`rarbrcrOrdrorQr@rerr%r(r'r&rrr,r#rr)rr;rr!rrr"r rrprrrr9r�r6rr�r<rrrr$r6rr7r+r�r7r�r8r:r5r4r?r*rr2r0r/r.r1r-r3ryr�rmr�r=r�r�r�r�r>rFrLrMr�r�r�r�rbrNr�r�rZrZrZr[�<module>s(�X
!
	
I��
�����2a�
/[����	b�
V	
�
�	�							@+c#	

os.cpython-38.opt-2.pyc000064400000045350150335716500010571 0ustar00U

e5dS��@s�ddlZddlZddlZddlmZejZddddddd	d
ddd
ddddddddgZdd�Z	dd�Z
dekr�dZdZddl
Tzddl
mZe�d�Wnek
r�YnXddlZzddl
mZWnek
r�YnXddl
Z
e�e
e
��[
n�d ek�r�d Zd!ZddlTzddlmZe�d�Wnek
�r>YnXddlZddlZe�e
e��[zddlmZWnek
�r�YnXned"��eejd#<dd$lmZmZmZmZmZmZmZm Z [e	d%��r�e!�Z"d&d'�Z#e$�Z%e#d(d)�e#d*d+�e#d,d-�e#d.d/�e#d0d1�e#d2d3�e#d4d5�e#d6d7�e#d8d9�e#d:d;�e#d<d=�e#d>d?�e#d@dA�e#dBdC�e#dBdD�e#dEd1�e%Z&e$�Z%e#d(d)�e%Z'e$�Z%e#dFdG�e#dHd+�e#dId-�e#dJdK�e#dJdL�e#dMdN�e%�(e�e#dOdP�e#dQd1�e#dRd1�e#dSdT�e	dU��r.e	dV��r.e#dWdU�e%Z)e$�Z%e#d(d)�e#d,d-�e#d.d/�e#dXdY�e#dZd+�e	d[��r~e#d\d-�e#d2d3�e#d]d1�e#d^d/�e#d.d/�e#dEd1�e#d_d/�e%Z*[%[["[#dZ+d`Z,daZ-d�ddde�Z.dfdg�Z/dhdi�Z0e�dedgdig�d�dkdl�Z1e�dl�e2ehe&k�rPe3ehe)k�rPd�dcddn�dodp�Z4dqdr�Z5e�dp�dsdt�Z6dudv�Z7dwdx�Z8dydz�Z9d{d|�Z:d}d~�Z;e�dtdvdxdzd|d~g�d�dd��Z<d�d�d�Z=dd�lm>Z>Gd�d��d�e>�Z?ze@ZAWneBk
�r�d�d��ZAYnXd�ek�re�d��zeCZDWneBk
�r(d�d��ZDYnXd�ek�r>e�d��d�d��ZEeE�ZF[Ed�d�d��ZGed kZHe�d��eH�r�d�d��ZIe?eFjJeIeKeIeKeAeD�ZL[Id�d�d��ZMe�d��d�d��ZNeN�\ZOZP[Ne	d���r,e	d���s,e	d���r,dZQd`ZRZSe�d�d�d�g�d�d��ZTd�d��ZUd�d��ZVd�d��ZWd�d��ZXe�d�d�d�d�g�e	d���rTd�d��ZYd�d��ZZe�d�d�g�e	d���r|d�d��Z[d�d��Z\e�d�d�g�d�d�d�Z]Gd�d��d��Z^d�d�Z_d�d��Z`e	d���s�e`Zad�ea_bGd�d��d�ejc�Zded k�r�Gd�d��d��Zed�d��ZfdS)��N)�_check_methods�altsep�curdir�pardir�sep�pathsep�linesep�defpath�name�path�devnull�SEEK_SET�SEEK_CUR�SEEK_END�fsencode�fsdecode�
get_exec_path�fdopen�popen�extsepcCs
|t�kS�N)�globals)r
�r�/usr/lib64/python3.8/os.py�_exists'srcCs8zt|j�WStk
r2dd�t|�D�YSXdS)NcSsg|]}|ddkr|�qS)r�_r)�.0�nrrr�
<listcomp>.sz%_get_exports_list.<locals>.<listcomp>)�list�__all__�AttributeError�dir)�modulerrr�_get_exports_list*sr$�posix�
)�*)�_exitr()�_have_functions�ntz
zno os specific module foundzos.path)rrrrr	rrrr)cCs"|tkr|tkrt�t|�dSr)�_globalsr)�_set�add)�str�fnrrr�_addfsr0ZHAVE_FACCESSAT�accessZ
HAVE_FCHMODAT�chmodZ
HAVE_FCHOWNAT�chownZHAVE_FSTATAT�statZHAVE_FUTIMESAT�utimeZHAVE_LINKAT�linkZHAVE_MKDIRAT�mkdirZ
HAVE_MKFIFOAT�mkfifoZHAVE_MKNODAT�mknodZHAVE_OPENAT�openZHAVE_READLINKAT�readlinkZ
HAVE_RENAMEAT�renameZHAVE_SYMLINKAT�symlinkZ
HAVE_UNLINKAT�unlink�rmdirZHAVE_UTIMENSATZHAVE_FCHDIR�chdirZHAVE_FCHMODZHAVE_FCHOWNZHAVE_FDOPENDIR�listdir�scandirZHAVE_FEXECVE�execveZHAVE_FTRUNCATE�truncateZ
HAVE_FUTIMENSZHAVE_FUTIMESZHAVE_FPATHCONF�pathconf�statvfs�fstatvfsZ
HAVE_FSTATVFSZ
HAVE_LCHFLAGSZchflagsZHAVE_LCHMOD�lchownZHAVE_LCHOWNZHAVE_LUTIMESZ
HAVE_LSTATZ
MS_WINDOWS���FcCs�t�|�\}}|s t�|�\}}|r||r|t�|�s|zt||d�Wntk
rVYnXt}t|t�rpttd�}||kr|dSzt||�Wn$t	k
r�|r�t�
|�s��YnXdS)N)�exist_ok�ASCII)r�split�exists�makedirs�FileExistsErrorr�
isinstance�bytesr7�OSError�isdir)r
�moderL�head�tail�cdirrrrrP�s$


rPcCsjt|�t�|�\}}|s(t�|�\}}|rf|rfzt|�Wntk
rTYqfYnXt�|�\}}q(dSr)r?rrNrT)r
rWrXrrr�
removedirs�s
rZcCsnt�|�\}}|r(|r(t�|�s(t|�t||�t�|�\}}|rj|rjzt|�Wntk
rhYnXdSr)rrNrOrPr<rZrT)�old�newrWrXrrr�renames�s
r]Tccst|�}g}g}g}zt|�}Wn8tk
rX}z|dk	rB||�WY�dSd}~XYnX|��z.zt|�}	Wntk
r�YW�qpYnXWnBtk
r�}z$|dk	r�||�WY�W5QR�dSd}~XYnXz|	��}
Wntk
�r�d}
YnX|
�r|�|	j�n|�|	j�|sb|
rb|�r0d}n.z|	��}Wntk
�rVd}YnX|}|rb|�|	j	�qbW5QRX|�r�|||fVt	j
t	j}
}|D]4}|||�}|�s�|
|��s�t||||�EdH�q�n,|D]}t||||�EdH�q�|||fVdS)NFT)
�fspathrBrT�next�
StopIteration�is_dir�appendr
�
is_symlinkr�islink�join�walk)�top�topdown�onerror�followlinks�dirs�nondirs�	walk_dirs�
scandir_it�error�entryra�	walk_intorcrdre�dirname�new_pathrrrrfs^;"


rf�.��follow_symlinks�dir_fdccs�t|t�rt|d�st|�}|s.t|d|d�}t|t|d�}zB|s^t�	|j
�r|t�|t|��r|t
||t|t�|||�EdHW5t|�XdS)N�	__index__Fru�rw)rR�int�hasattrr^r4r:�O_RDONLY�close�st�S_ISDIR�st_moder�samestat�_fwalkrS)rgrhrirvrw�orig_st�topfdrrr�fwalk�s!��r�ccs�t|�}g}g}|s|rdng}	|D]�}
|
j}|r:t|�}z4|
��rb|�|�|	dk	rl|	�|
�n
|�|�Wq$tk
r�z|
��r�|�|�Wntk
r�YnXYq$Xq$|r�||||fV|	dkr�|nt||	�D]�}z@|�s|r�t||dd�}n|\}}
|
jdd�}t	|t
|d�}
Wn>tk
�r\}z|dk	�rD||�WY�q�W5d}~XYnXz@|�sxt�
|t|
���r�t�||�}t|
|||||�EdHW5t|
�Xq�|�s�||||fVdS)NF)rwrv)rvry)rBr
rrarbrTrc�zipr4r:r|r}rr�rer�)r��toppath�isbytesrhrirvrnrkrl�entriesrpr
r��dirfd�err�dirpathrrrr��sZ

�r�cGst||�dSr)�execv��file�argsrrr�execlsr�cGs |d}t||dd�|�dS�N���)rC�r�r��envrrr�execlesr�cGst||�dSr)�execvpr�rrr�execlp"sr�cGs |d}t||dd�|�dSr�)�execvper�rrr�execlpe)sr�cCst||�dSr��_execvper�rrrr�2sr�cCst|||�dSrr�r�rrrr�:sr�cCs�|dk	rt}||f}nt}|f}t}t�|�r@||f|��dSd}t|�}tdkrft|�}tt|�}|D]~}t�	||�}z||f|��Wqjt
tfk
r�}	z|	}
W5d}	~	XYqjtk
r�}	z|	}
|dkr�|	}W5d}	~	XYqjXqj|dk	r�|�|
�dS)Nr*)
rCr��environrrrrr
r�mapre�FileNotFoundError�NotADirectoryErrorrT)r�r�r��	exec_func�argrest�	saved_exc�	path_listr"�fullname�e�last_excrrrr�Es6


r�c
Cs�ddl}|dkrt}|����|�dt�z|�d�}Wntk
rPd}YnXtr�z|d}Wnttfk
rzYnX|dk	r�t	d��|}|dk	r�t
|t�r�t|�}W5QRX|dkr�t
}|�t�S)Nr�ignore�PATHsPATHz*env cannot contain 'PATH' and b'PATH' keys)�warningsr��catch_warnings�simplefilter�BytesWarning�get�	TypeError�supports_bytes_environ�KeyError�
ValueErrorrRrSrr	rNr)r�r�r��
path_listbrrrres0


�)�MutableMappingc@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�_EnvironcCs.||_||_||_||_||_||_||_dSr)�	encodekey�	decodekey�encodevalue�decodevalue�putenv�unsetenv�_data)�self�datar�r�r�r�r�r�rrr�__init__�sz_Environ.__init__cCs>z|j|�|�}Wntk
r2t|�d�YnX|�|�Sr)r�r�r�r��r��key�valuerrr�__getitem__�s
z_Environ.__getitem__cCs.|�|�}|�|�}|�||�||j|<dSr)r�r�r�r�r�rrr�__setitem__�s

z_Environ.__setitem__cCsD|�|�}|�|�z|j|=Wntk
r>t|�d�YnXdSr)r�r�r�r�)r�r��
encodedkeyrrr�__delitem__�s

z_Environ.__delitem__ccs$t|j�}|D]}|�|�VqdSr)rr�r�)r��keysr�rrr�__iter__�s
z_Environ.__iter__cCs
t|j�Sr)�lenr��r�rrr�__len__�sz_Environ.__len__cs$d�d��fdd��j��D���S)Nzenviron({{{}}})z, c3s*|]"\}}d���|���|��VqdS)z
{!r}: {!r}N)�formatr�r�)rr�r�r�rr�	<genexpr>�s�z$_Environ.__repr__.<locals>.<genexpr>)r�rer��itemsr�rr�r�__repr__�s

��z_Environ.__repr__cCst|�Sr)�dictr�rrr�copy�sz
_Environ.copycCs||kr|||<||Srrr�rrr�
setdefault�sz_Environ.setdefaultN)�__name__�
__module__�__qualname__r�r�r�r�r�r�r�r�r�rrrrr��s		r�cCsdSrr)r�r�rrr�<lambda>��r�r�cCs
t|d�S)N�)�_putenv�r�rrrr��r�r�cs�tdkrHdd�}|�t}�fdd�}i}t��D]\}}||||�<q0n(t����fdd���fdd	�}�}t}t|||�|tt�S)
Nr*cSs t|t�stdt|�j��|S)N�str expected, not %s)rRr.r��typer��r�rrr�	check_str�s
z!_createenviron.<locals>.check_strcs�|���Sr)�upperr�)�encoderrr��sz!_createenviron.<locals>.encodekeycs(t|t�stdt|�j��|��d�S)Nr��surrogateescape)rRr.r�r�r�r�r���encodingrrr��s
z_createenviron.<locals>.encodecs|��d�S)Nr�)�decoder�r�rrr��sz_createenviron.<locals>.decode)	r
r.r�r��sys�getfilesystemencodingr�r��	_unsetenv)r�r�r�r�r�r�r)r�r�r�_createenviron�s*�r�cCst�||�Sr)r�r��r��defaultrrr�getenv�sr�)r�r�cCs t|t�stdt|�j��|S)Nzbytes expected, not %s)rRrSr�r�r�r�rrr�_check_bytess
r�cCst�||�Sr)�environbr�r�rrr�getenvbsr�)r�r�cs4t���t�����fdd�}��fdd�}||fS)Ncs&t|�}t|t�r|����S|SdSr)r^rRr.r���filename�r��errorsrrr s
z_fscodec.<locals>.fsencodecs&t|�}t|t�r|����S|SdSr)r^rRrSr�r�r�rrr,s
z_fscodec.<locals>.fsdecode)r�r��getfilesystemencodeerrors)rrrr�r�_fscodecs
r��fork�spawnvr��P_WAIT�P_NOWAIT�	P_NOWAITOcCs�t|ttf�std��|r"|ds*td��t�}|spz$|dkrJ|||�n||||�Wq�td�Yq�XnR|tkr||St|d�\}}t	|�r�q|q|t
|�r�t|�St|�r�t
|�Std��q|dS)Nzargv must be a tuple or a listrz"argv first element cannot be empty�z"Not stopped, signaled or exited???)rR�tuplerr�r�r�r(r��waitpid�
WIFSTOPPED�WIFSIGNALED�WTERMSIG�	WIFEXITED�WEXITSTATUSrT)rVr�r�r��func�pid�wpid�stsrrr�	_spawnvefIs,
rcCst|||dt�Sr)rr��rVr�r�rrrr�hscCst||||t�Sr)rrC�rVr�r�r�rrr�spawnveqsr	cCst|||dt�Sr)rr�rrrr�spawnvp}sr
cCst||||t�Sr)rr�rrrr�spawnvpe�srcGst|||�Sr)r�rrrr�spawnl�srcGs|d}t|||dd�|�Sr�)r	rrrr�spawnle�sr
cGst|||�Sr)r
rrrr�spawnlp�srcGs|d}t|||dd�|�Sr�)rrrrr�spawnlpe�sr�rr�cCs�t|t�stdt|���|dkr.td|��|dks>|dkrFtd��ddl}ddl}|dkr�|j|d|j|d�}t	|�
|j�|�S|j|d|j|d	�}t	|�
|j�|�SdS)
Nz&invalid cmd type (%s, expected string))r�wzinvalid mode %rrz+popen() does not support unbuffered streamsrT)�shell�stdout�bufsize)r�stdinr)
rRr.r�r�r��
subprocess�io�Popen�PIPE�_wrap_close�
TextIOWrapperrr)�cmdrV�	bufferingrr�procrrrr�s(
��c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)rcCs||_||_dSr)�_stream�_proc)r��streamrrrrr��sz_wrap_close.__init__cCs8|j��|j��}|dkr dStdkr,|S|d>SdS)Nrr*�)rr}r �waitr
)r��
returncoderrrr}�s

z_wrap_close.closecCs|Srrr�rrr�	__enter__�sz_wrap_close.__enter__cGs|��dSr�r}�r�r�rrr�__exit__�sz_wrap_close.__exit__cCst|j|�Sr)�getattrr)r�r
rrr�__getattr__�sz_wrap_close.__getattr__cCs
t|j�Sr)�iterrr�rrrr��sz_wrap_close.__iter__N)	r�r�r�r�r}r%r(r*r�rrrrr�s	rcOs4t|t�stdt|���ddl}|j|f|�|�S)Nz&invalid fd type (%s, expected integer)r)rRrzr�r�rr:)�fdr��kwargsrrrrr�s
cCs�t|ttf�r|St|�}z|�|�}Wn0tk
rXt|d�rF�ntd|j��YnXt|ttf�rl|Std�	|jt|�j���dS)N�
__fspath__z/expected str, bytes or os.PathLike object, not z7expected {}.__fspath__() to return str or bytes, not {})
rRr.rSr�r.r!r{r�r�r�)r�	path_type�	path_reprrrr�_fspaths"
��r1r^c@s&eZdZejdd��Zedd��ZdS)�PathLikecCst�dSr)�NotImplementedErrorr�rrrr.,szPathLike.__fspath__cCs|tkrt|d�StS)Nr.)r2r�NotImplemented)�cls�subclassrrr�__subclasshook__1s
zPathLike.__subclasshook__N)r�r�r��abc�abstractmethodr.�classmethodr7rrrrr2(s
r2c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�_AddedDllDirectorycCs||_||_||_dSr)r�_cookie�_remove_dll_directory)r�r�cookieZremove_dll_directoryrrrr�:sz_AddedDllDirectory.__init__cCs|�|j�d|_dSr)r=r<rr�rrrr}>sz_AddedDllDirectory.closecCs|Srrr�rrrr%Asz_AddedDllDirectory.__enter__cGs|��dSrr&r'rrrr(Csz_AddedDllDirectory.__exit__cCs|jrd�|j�SdS)Nz<AddedDllDirectory({!r})>z<AddedDllDirectory()>)rr�r�rrrr�Esz_AddedDllDirectory.__repr__N)r�r�r�r�r}r%r(r�rrrrr;9s
r;cCs ddl}|�|�}t|||j�S)Nr)r*Z_add_dll_directoryr;r=)rr*r>rrr�add_dll_directoryJs

�r?)rKF)TNF)rtTN)N)N)N)N)rr�)gr8r�r4r~�_collections_abcr�builtin_module_namesZ_namesr rr$r
rr%r(rb�ImportError�	posixpathrr)�extendr*Zntpath�modulesZos.pathrrrrr	rrrrr+r0�setr,�supports_dir_fd�supports_effective_idsr-�supports_fd�supports_follow_symlinksr
rrrPrZr]rfr:rBr�r�r�r�r�r�r�r�r�rr�r�r�r��	NameErrorr�r�r�r�r�r�r�r�rSr�r�r�rrr�r�r�rr�r	r
rrr
rrrrrr1r^r��ABCr2r;r?rrrr�<module>s��

(











































 

08
		
 
-7





�


	

	


	

this.cpython-38.opt-2.pyc000064400000002357150335716500011117 0ustar00U

e5d��@s\dZiZdD]2Zed�D]$Zeedde�eeee�<qqed�dd�eD���dS)aXGur Mra bs Clguba, ol Gvz Crgref

Ornhgvshy vf orggre guna htyl.
Rkcyvpvg vf orggre guna vzcyvpvg.
Fvzcyr vf orggre guna pbzcyrk.
Pbzcyrk vf orggre guna pbzcyvpngrq.
Syng vf orggre guna arfgrq.
Fcnefr vf orggre guna qrafr.
Ernqnovyvgl pbhagf.
Fcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf.
Nygubhtu cenpgvpnyvgl orngf chevgl.
Reebef fubhyq arire cnff fvyragyl.
Hayrff rkcyvpvgyl fvyraprq.
Va gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff.
Gurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg.
Nygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh'er Qhgpu.
Abj vf orggre guna arire.
Nygubhtu arire vf bsgra orggre guna *evtug* abj.
Vs gur vzcyrzragngvba vf uneq gb rkcynva, vg'f n onq vqrn.
Vs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn.
Anzrfcnprf ner bar ubaxvat terng vqrn -- yrg'f qb zber bs gubfr!)�A�a��
�cCsg|]}t�||��qS�)�d�get)�.0�crr�/usr/lib64/python3.8/this.py�
<listcomp>srN)�srr
�range�i�chr�print�joinrrrr�<module>s
$colorsys.cpython-38.pyc000064400000006252150335716500011063 0ustar00U

e5d��@s\dZddddddgZdZdZd	Zd
d�Zdd�Zdd�Zd
d�Zdd�Z	dd�Z
dd�ZdS)aJConversion functions between RGB and other color systems.

This modules provides two functions for each color system ABC:

  rgb_to_abc(r, g, b) --> a, b, c
  abc_to_rgb(a, b, c) --> r, g, b

All inputs and outputs are triples of floats in the range [0.0...1.0]
(with the exception of I and Q, which covers a slightly larger range).
Inputs outside the valid range may cause exceptions or invalid outputs.

Supported color systems:
RGB: Red, Green, Blue components
YIQ: Luminance, Chrominance (used by composite video signals)
HLS: Hue, Luminance, Saturation
HSV: Hue, Saturation, Value
�
rgb_to_yiq�
yiq_to_rgb�
rgb_to_hls�
hls_to_rgb�
rgb_to_hsv�
hsv_to_rgbgUUUUUU�?gUUUUUU�?gUUUUUU�?cCsRd|d|d|}d||d||}d||d||}|||fS)Ng333333�?g�z�G��?g)\��(�?g�G�z��?gH�z�G�?g���Q��?g=
ףp=�?�)�r�g�b�y�i�qrr� /usr/lib64/python3.8/colorsys.pyr(scCs�|d|d|}|d|d|}|d|d|}|dkrHd}|dkrTd}|dkr`d}|dkrld}|dkrxd}|dkr�d}|||fS)	Ng2r��L�?g����,��?g:�����?g�nєW�?g6�޷���?gJ"�X�?���?r)rrr
rr	r
rrrr.s cCs�t|||�}t|||�}||d}||kr6d|dfS|dkrP||||}n||d||}||||}||||}||||}	||kr�|	|}
n"||kr�d||	}
nd||}
|
dd}
|
||fS)N�@r��?�@�@r��max�min)rr	r
�maxc�minc�l�s�rc�gc�bc�hrrrrKs$

cCsn|dkr|||fS|dkr(|d|}n||||}d||}t|||t�t|||�t|||t�fS)Nrrrr)�_v�	ONE_THIRD)rrr�m2�m1rrrrbs
cCsT|d}|tkr$||||dS|dkr0|S|tkrP|||t|dS|S)Nrrr)�	ONE_SIXTH�	TWO_THIRD)r#r"Zhuerrrr lsr cCs�t|||�}t|||�}|}||kr.dd|fS|||}||||}||||}||||}	||kr||	|}
n"||kr�d||	}
nd||}
|
dd}
|
||fS)Nrrrrrr)rr	r
rr�vrrrrrrrrr|s 

cCs�|dkr|||fSt|d�}|d|}|d|}|d||}|d|d|}|d}|dkrt|||fS|dkr�|||fS|dkr�|||fS|dkr�|||fS|d	kr�|||fS|d
kr�|||fSdS)Nrrr�������)�int)rrr&r�f�pr
�trrrr�s(





N)�__doc__�__all__r!r$r%rrrrr rrrrrr�<module>s�	
socketserver.cpython-38.opt-1.pyc000064400000061423150335716500012665 0ustar00U

e5d�j�	@sdZdZddlZddlZddlZddlZddlZddlmZddl	m
Z	dddd	d
ddd
dg	Zeed�rxe�
dddg�eed�r�e�
ddddg�eed�r�ejZnejZGdd�d�ZGdd�de�ZGdd�de�Zeed�r�Gdd�d�ZGdd�de�ZGdd �d �ZGd!d�d�Zeed��rNGd"d�dee�ZGd#d�dee�ZGd$d	�d	ee�ZGd%d
�d
ee�Zeed��r�Gd&d�de�ZGd'd�de�ZGd(d�dee�ZGd)d�dee�Z Gd*d�d�Z!Gd+d�de!�Z"Gd,d-�d-e�Z#Gd.d
�d
e!�Z$dS)/aqGeneric socket server classes.

This module tries to capture the various aspects of defining a server:

For socket-based servers:

- address family:
        - AF_INET{,6}: IP (Internet Protocol) sockets (default)
        - AF_UNIX: Unix domain sockets
        - others, e.g. AF_DECNET are conceivable (see <socket.h>
- socket type:
        - SOCK_STREAM (reliable stream, e.g. TCP)
        - SOCK_DGRAM (datagrams, e.g. UDP)

For request-based servers (including socket-based):

- client address verification before further looking at the request
        (This is actually a hook for any processing that needs to look
         at the request before anything else, e.g. logging)
- how to handle multiple requests:
        - synchronous (one request is handled at a time)
        - forking (each request is handled by a new process)
        - threading (each request is handled by a new thread)

The classes in this module favor the server type that is simplest to
write: a synchronous TCP/IP server.  This is bad class design, but
saves some typing.  (There's also the issue that a deep class hierarchy
slows down method lookups.)

There are five classes in an inheritance diagram, four of which represent
synchronous servers of four types:

        +------------+
        | BaseServer |
        +------------+
              |
              v
        +-----------+        +------------------+
        | TCPServer |------->| UnixStreamServer |
        +-----------+        +------------------+
              |
              v
        +-----------+        +--------------------+
        | UDPServer |------->| UnixDatagramServer |
        +-----------+        +--------------------+

Note that UnixDatagramServer derives from UDPServer, not from
UnixStreamServer -- the only difference between an IP and a Unix
stream server is the address family, which is simply repeated in both
unix server classes.

Forking and threading versions of each type of server can be created
using the ForkingMixIn and ThreadingMixIn mix-in classes.  For
instance, a threading UDP server class is created as follows:

        class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass

The Mix-in class must come first, since it overrides a method defined
in UDPServer! Setting the various member variables also changes
the behavior of the underlying server mechanism.

To implement a service, you must derive a class from
BaseRequestHandler and redefine its handle() method.  You can then run
various versions of the service by combining one of the server classes
with your request handler class.

The request handler class must be different for datagram or stream
services.  This can be hidden by using the request handler
subclasses StreamRequestHandler or DatagramRequestHandler.

Of course, you still have to use your head!

For instance, it makes no sense to use a forking server if the service
contains state in memory that can be modified by requests (since the
modifications in the child process would never reach the initial state
kept in the parent process and passed to each child).  In this case,
you can use a threading server, but you will probably have to use
locks to avoid two requests that come in nearly simultaneous to apply
conflicting changes to the server state.

On the other hand, if you are building e.g. an HTTP server, where all
data is stored externally (e.g. in the file system), a synchronous
class will essentially render the service "deaf" while one request is
being handled -- which may be for a very long time if a client is slow
to read all the data it has requested.  Here a threading or forking
server is appropriate.

In some cases, it may be appropriate to process part of a request
synchronously, but to finish processing in a forked child depending on
the request data.  This can be implemented by using a synchronous
server and doing an explicit fork in the request handler class
handle() method.

Another approach to handling multiple simultaneous requests in an
environment that supports neither threads nor fork (or where these are
too expensive or inappropriate for the service) is to maintain an
explicit table of partially finished requests and to use a selector to
decide which request to work on next (or whether to handle a new
incoming request).  This is particularly important for stream services
where each client can potentially be connected for a long time (if
threads or subprocesses cannot be used).

Future work:
- Standard classes for Sun RPC (which uses either UDP or TCP)
- Standard mix-in classes to implement various authentication
  and encryption schemes

XXX Open problems:
- What to do with out-of-band data?

BaseServer:
- split generic "request" functionality out into BaseServer class.
  Copyright (C) 2000  Luke Kenneth Casson Leighton <lkcl@samba.org>

  example: read entries from a SQL database (requires overriding
  get_request() to return a table entry from the database).
  entry is processed by a RequestHandlerClass.

z0.4�N)�BufferedIOBase)�	monotonic�
BaseServer�	TCPServer�	UDPServer�ThreadingUDPServer�ThreadingTCPServer�BaseRequestHandler�StreamRequestHandler�DatagramRequestHandler�ThreadingMixIn�fork�ForkingUDPServer�ForkingTCPServer�ForkingMixIn�AF_UNIX�UnixStreamServer�UnixDatagramServer�ThreadingUnixStreamServer�ThreadingUnixDatagramServer�PollSelectorc@s�eZdZdZdZdd�Zdd�Zd&dd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdS)'ra�Base class for server classes.

    Methods for the caller:

    - __init__(server_address, RequestHandlerClass)
    - serve_forever(poll_interval=0.5)
    - shutdown()
    - handle_request()  # if you do not use serve_forever()
    - fileno() -> int   # for selector

    Methods that may be overridden:

    - server_bind()
    - server_activate()
    - get_request() -> request, client_address
    - handle_timeout()
    - verify_request(request, client_address)
    - server_close()
    - process_request(request, client_address)
    - shutdown_request(request)
    - close_request(request)
    - service_actions()
    - handle_error()

    Methods for derived classes:

    - finish_request(request, client_address)

    Class variables that may be overridden by derived classes or
    instances:

    - timeout
    - address_family
    - socket_type
    - allow_reuse_address

    Instance variables:

    - RequestHandlerClass
    - socket

    NcCs ||_||_t��|_d|_dS)�/Constructor.  May be extended, do not override.FN)�server_address�RequestHandlerClass�	threadingZEvent�_BaseServer__is_shut_down�_BaseServer__shutdown_request)�selfrr�r�$/usr/lib64/python3.8/socketserver.py�__init__�s
zBaseServer.__init__cCsdS�zSCalled by constructor to activate the server.

        May be overridden.

        Nr�rrrr�server_activate�szBaseServer.server_activate��?c	Cst|j��zRt��B}|�|tj�|jsP|�|�}|jr:qP|rF|�	�|�
�q"W5QRXW5d|_|j��XdS)z�Handle one request at a time until shutdown.

        Polls for shutdown every poll_interval seconds. Ignores
        self.timeout. If you need to do periodic tasks, do them in
        another thread.
        FN)r�clearr�set�_ServerSelector�register�	selectors�
EVENT_READ�select�_handle_request_noblock�service_actions)rZ
poll_interval�selector�readyrrr�
serve_forever�s

zBaseServer.serve_forevercCsd|_|j��dS)z�Stops the serve_forever loop.

        Blocks until the loop has finished. This must be called while
        serve_forever() is running in another thread, or it will
        deadlock.
        TN)rr�waitr"rrr�shutdown�szBaseServer.shutdowncCsdS)z�Called by the serve_forever() loop.

        May be overridden by a subclass / Mixin to implement any code that
        needs to be run during the loop.
        Nrr"rrrr-�szBaseServer.service_actionsc
Cs�|j��}|dkr|j}n|jdk	r0t||j�}|dk	rBt�|}t��f}|�|tj�|�	|�}|rz|�
�W5QR�S|dk	rX|t�}|dkrX|��W5QR�SqXW5QRXdS)zOHandle one request, possibly blocking.

        Respects self.timeout.
        Nr)�socketZ
gettimeout�timeout�min�timer'r(r)r*r+r,�handle_timeout)rr4Zdeadliner.r/rrr�handle_requests 




zBaseServer.handle_requestcCs�z|��\}}Wntk
r&YdSX|�||�r�z|�||�Wq�tk
rn|�||�|�|�Yq�|�|��Yq�Xn
|�|�dS)z�Handle one request, without blocking.

        I assume that selector.select() has returned that the socket is
        readable before this function was called, so there should be no risk of
        blocking in get_request().
        N)�get_request�OSError�verify_request�process_request�	Exception�handle_error�shutdown_request�r�request�client_addressrrrr,/s

z"BaseServer._handle_request_noblockcCsdS)zcCalled if no new request arrives within self.timeout.

        Overridden by ForkingMixIn.
        Nrr"rrrr7FszBaseServer.handle_timeoutcCsdS)znVerify the request.  May be overridden.

        Return True if we should proceed with this request.

        Trr@rrrr;MszBaseServer.verify_requestcCs|�||�|�|�dS)zVCall finish_request.

        Overridden by ForkingMixIn and ThreadingMixIn.

        N)�finish_requestr?r@rrrr<UszBaseServer.process_requestcCsdS�zDCalled to clean-up the server.

        May be overridden.

        Nrr"rrr�server_close^szBaseServer.server_closecCs|�|||�dS)z8Finish one request by instantiating RequestHandlerClass.N)rr@rrrrCfszBaseServer.finish_requestcCs|�|�dS�z3Called to shutdown and close an individual request.N��
close_request�rrArrrr?jszBaseServer.shutdown_requestcCsdS�z)Called to clean up an individual request.NrrIrrrrHnszBaseServer.close_requestcCs@tdtjd�td|tjd�ddl}|��tdtjd�dS)ztHandle an error gracefully.  May be overridden.

        The default is to print a traceback and continue.

        z(----------------------------------------)�filez4Exception happened during processing of request fromrN)�print�sys�stderr�	traceback�	print_exc)rrArBrOrrrr>rs�zBaseServer.handle_errorcCs|S�Nrr"rrr�	__enter__szBaseServer.__enter__cGs|��dSrQ)rE)r�argsrrr�__exit__�szBaseServer.__exit__)r$)�__name__�
__module__�__qualname__�__doc__r4r r#r0r2r-r8r,r7r;r<rErCr?rHr>rRrTrrrrr�s&+

	
c@sfeZdZdZejZejZdZ	dZ
ddd�Zdd�Zd	d
�Z
dd�Zd
d�Zdd�Zdd�Zdd�ZdS)ra3Base class for various socket-based server classes.

    Defaults to synchronous IP stream (i.e., TCP).

    Methods for the caller:

    - __init__(server_address, RequestHandlerClass, bind_and_activate=True)
    - serve_forever(poll_interval=0.5)
    - shutdown()
    - handle_request()  # if you don't use serve_forever()
    - fileno() -> int   # for selector

    Methods that may be overridden:

    - server_bind()
    - server_activate()
    - get_request() -> request, client_address
    - handle_timeout()
    - verify_request(request, client_address)
    - process_request(request, client_address)
    - shutdown_request(request)
    - close_request(request)
    - handle_error()

    Methods for derived classes:

    - finish_request(request, client_address)

    Class variables that may be overridden by derived classes or
    instances:

    - timeout
    - address_family
    - socket_type
    - request_queue_size (only for stream sockets)
    - allow_reuse_address

    Instance variables:

    - server_address
    - RequestHandlerClass
    - socket

    �FTcCsTt�|||�t�|j|j�|_|rPz|��|��Wn|���YnXdS)rN)rr r3�address_family�socket_type�server_bindr#rE)rrrZbind_and_activaterrrr �s�zTCPServer.__init__cCs8|jr|j�tjtjd�|j�|j�|j��|_dS)zOCalled by constructor to bind the socket.

        May be overridden.

        �N)�allow_reuse_addressr3�
setsockoptZ
SOL_SOCKETZSO_REUSEADDRZbindrZgetsocknamer"rrrr\�szTCPServer.server_bindcCs|j�|j�dSr!)r3Zlisten�request_queue_sizer"rrrr#�szTCPServer.server_activatecCs|j��dSrD)r3�closer"rrrrE�szTCPServer.server_closecCs
|j��S)zMReturn socket file number.

        Interface required by selector.

        )r3�filenor"rrrrb�szTCPServer.filenocCs
|j��S)zYGet the request and client address from the socket.

        May be overridden.

        )r3Zacceptr"rrrr9�szTCPServer.get_requestcCs4z|�tj�Wntk
r$YnX|�|�dSrF)r2r3ZSHUT_WRr:rHrIrrrr?�s
zTCPServer.shutdown_requestcCs|��dSrJ)rarIrrrrH�szTCPServer.close_requestN)T)rUrVrWrXr3ZAF_INETrZZSOCK_STREAMr[r`r^r r\r#rErbr9r?rHrrrrr�s-


c@s>eZdZdZdZejZdZdd�Z	dd�Z
dd	�Zd
d�ZdS)
rzUDP server class.Fi cCs |j�|j�\}}||jf|fSrQ)r3Zrecvfrom�max_packet_size)r�dataZclient_addrrrrr9szUDPServer.get_requestcCsdSrQrr"rrrr#szUDPServer.server_activatecCs|�|�dSrQrGrIrrrr?szUDPServer.shutdown_requestcCsdSrQrrIrrrrHszUDPServer.close_requestN)
rUrVrWrXr^r3Z
SOCK_DGRAMr[rcr9r#r?rHrrrrrscsVeZdZdZdZdZdZdZdd�dd	�Zd
d�Z	dd
�Z
dd�Z�fdd�Z�Z
S)rz5Mix-in class to handle each request in a new process.i,N�(TF��blockingc	Cs�|jdkrdSt|j�|jkrvz t�dd�\}}|j�|�Wqtk
r\|j��Yqtk
rrYqvYqXq|j�	�D]f}z.|r�dntj
}t�||�\}}|j�|�Wq�tk
r�|j�|�Yq�tk
r�Yq�Xq�dS)z7Internal routine to wait for children that have exited.N���r)�active_children�len�max_children�os�waitpid�discard�ChildProcessErrorr%r:�copy�WNOHANG)rrg�pid�_�flagsrrr�collect_children(s&
zForkingMixIn.collect_childrencCs|��dS)zvWait for zombies after self.timeout seconds of inactivity.

            May be extended, do not override.
            N�rur"rrrr7KszForkingMixIn.handle_timeoutcCs|��dS)z�Collect the zombie child processes regularly in the ForkingMixIn.

            service_actions is called in the BaseServer's serve_forever loop.
            Nrvr"rrrr-RszForkingMixIn.service_actionscCs�t��}|r8|jdkrt�|_|j�|�|�|�dSd}z:z|�||�d}Wn t	k
rr|�
||�YnXW5z|�|�W5t�|�XXdS)z-Fork a new subprocess to process the request.Nr]r)rlr
rir&�addrH�_exitr?rCr=r>)rrArBrrZstatusrrrr<Ys 

zForkingMixIn.process_requestcst���|j|jd�dS)Nrf)�superrEru�block_on_closer"��	__class__rrrErs
zForkingMixIn.server_close)rUrVrWrXr4rirkrzrur7r-r<rE�
__classcell__rrr{rrs#cs8eZdZdZ�fdd�Zdd�Zdd�Zdd	�Z�ZS)
�_Threadsz2
    Joinable list of all non-daemon threads.
    cs"|��|jrdSt��|�dSrQ)�reap�daemonry�append�r�threadr{rrr�{sz_Threads.appendcCsg|dd�|dd�<}|SrQr)r�resultrrr�pop_all�sz_Threads.pop_allcCs|��D]}|��qdSrQ)r��joinr�rrrr��sz
_Threads.joincCsdd�|D�|dd�<dS)Ncss|]}|��r|VqdSrQ)Zis_alive)�.0r�rrr�	<genexpr>�sz _Threads.reap.<locals>.<genexpr>rr"rrrr�sz
_Threads.reap)	rUrVrWrXr�r�r�rr}rrr{rr~ws
r~c@s eZdZdZdd�Zdd�ZdS)�
_NoThreadsz)
    Degenerate version of _Threads.
    cCsdSrQrr�rrrr��sz_NoThreads.appendcCsdSrQrr"rrrr��sz_NoThreads.joinN)rUrVrWrXr�r�rrrrr��sr�cs>eZdZdZdZdZe�Zdd�Zdd�Z	�fdd	�Z
�ZS)
rz4Mix-in class to handle each request in a new thread.FTc	CsHz6z|�||�Wn tk
r2|�||�YnXW5|�|�XdS)zgSame as in BaseServer but as a thread.

        In addition, exception handling is done here.

        N)r?rCr=r>r@rrr�process_request_thread�s
z%ThreadingMixIn.process_request_threadcCsL|jrt|��dt��tj|j||fd�}|j|_|j	�
|�|��dS)z*Start a new thread to process the request.�_threads)�targetrSN)rz�vars�
setdefaultr~rZThreadr��daemon_threadsr�r�r��start)rrArB�trrrr<�s�zThreadingMixIn.process_requestcst���|j��dSrQ)ryrEr�r�r"r{rrrE�s
zThreadingMixIn.server_close)rUrVrWrXr�rzr�r�r�r<rEr}rrr{rr�s

c@seZdZdS)rN�rUrVrWrrrrr�sc@seZdZdS)rNr�rrrrr�sc@seZdZdS)rNr�rrrrr�sc@seZdZdS)rNr�rrrrr�sc@seZdZejZdS)rN�rUrVrWr3rrZrrrrr�sc@seZdZejZdS)rNr�rrrrr�sc@seZdZdS)rNr�rrrrr�sc@seZdZdS)rNr�rrrrr�sc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r	a�Base class for request handler classes.

    This class is instantiated for each request to be handled.  The
    constructor sets the instance variables request, client_address
    and server, and then calls the handle() method.  To implement a
    specific service, all you need to do is to derive a class which
    defines a handle() method.

    The handle() method can find the request as self.request, the
    client address as self.client_address, and the server (in case it
    needs access to per-server information) as self.server.  Since a
    separate instance is created for each request, the handle() method
    can define other arbitrary instance variables.

    cCs6||_||_||_|��z|��W5|��XdSrQ)rArB�server�setup�finish�handle)rrArBr�rrrr �szBaseRequestHandler.__init__cCsdSrQrr"rrrr��szBaseRequestHandler.setupcCsdSrQrr"rrrr��szBaseRequestHandler.handlecCsdSrQrr"rrrr��szBaseRequestHandler.finishN)rUrVrWrXr r�r�r�rrrrr	�s

c@s0eZdZdZdZdZdZdZdd�Zdd	�Z	dS)
r
z4Define self.rfile and self.wfile for stream sockets.rhrNFcCsz|j|_|jdk	r |j�|j�|jr:|j�tjtjd�|j�	d|j
�|_|jdkrdt
|j�|_n|j�	d|j�|_dS)NT�rbr�wb)rAZ
connectionr4Z
settimeout�disable_nagle_algorithmr_r3ZIPPROTO_TCPZTCP_NODELAYZmakefile�rbufsize�rfile�wbufsize�
_SocketWriter�wfiler"rrrr�s

�
zStreamRequestHandler.setupcCsF|jjs.z|j��Wntjk
r,YnX|j��|j��dSrQ)r��closed�flushr3�errorrar�r"rrrr�#s
zStreamRequestHandler.finish)
rUrVrWrXr�r�r4r�r�r�rrrrr
s	
c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r�z�Simple writable BufferedIOBase implementation for a socket

    Does not hold data in a buffer, avoiding any need to call flush().cCs
||_dSrQ)�_sock)rZsockrrrr 3sz_SocketWriter.__init__cCsdS)NTrr"rrr�writable6sz_SocketWriter.writablec
Cs2|j�|�t|��}|jW5QR�SQRXdSrQ)r�Zsendall�
memoryview�nbytes)r�bZviewrrr�write9s
z_SocketWriter.writecCs
|j��SrQ)r�rbr"rrrrb>sz_SocketWriter.filenoN)rUrVrWrXr r�r�rbrrrrr�.s
r�c@s eZdZdZdd�Zdd�ZdS)rz6Define self.rfile and self.wfile for datagram sockets.cCs2ddlm}|j\|_|_||j�|_|�|_dS)Nr)�BytesIO)�ior�rAZpacketr3r�r�)rr�rrrr�EszDatagramRequestHandler.setupcCs|j�|j��|j�dSrQ)r3Zsendtor��getvaluerBr"rrrr�KszDatagramRequestHandler.finishN)rUrVrWrXr�r�rrrrrAs)%rX�__version__r3r)rlrMrr�rr6r�__all__�hasattr�extendrr'ZSelectSelectorrrrr�listr~r�rrrrrrrrrr	r
r�rrrrr�<module>sbz�

�
n~
X(.-zipfile.cpython-38.pyc000064400000162224150335716500010652 0ustar00U

e5d�V�@sdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZzddlZejZWnek
r�dZejZYnXzddlZWnek
r�dZYnXzddlZWnek
r�dZYnXddddddd	d
ddd
ddg
ZGdd�de�ZGdd�de�ZeZZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(e�)e'�Z*dZ+dZ,dZ-dZ.d Z/d!Z0d"Z1d#Z2dZ3d$Z4d%Z5d&Z6e�)e5�Z7dZ8dZ9dZ:dZ;d Z<d!Z=d"Z>d#Z?dZ@d$ZAd'ZBd(ZCdZDd)ZEdZFd*ZGd+ZHd,ZId-ZJd.ZKd/ZLe�)eK�ZMdZNdZOdZPdZQd ZRd!ZSd"ZTd#ZUdZVd$ZWd'ZXd(ZYd0ZZd1Z[e�)eZ�Z\d2Z]d3Z^e�)e]�Z_dZ`dZadZbdZcd Zdd!Zed"Zfd#ZgdZhd$Zid4Zje�kd5�Zld6d7�Zmd8d9�Znd:d
�Zod;d<�Zpd=d>�ZqGd?d�der�Zsdatd@dA�ZudBdC�ZvGdDdE�dE�ZwGdFdG�dG�ZxdHdIdJdJdJdJdKdLdMdNdKdOdPdQdRdSdTdU�ZydVdW�ZzdtdXdY�Z{dZd[�Z|Gd\d]�d]�Z}Gd^d_�d_�Z~Gd`da�daej�Z�Gdbdc�dcej�Z�Gddd�d�Z�Gded
�d
e��Z�dfdg�Z�dhdi�Z�e�j�Z�djdk�Z�Gdldm�dme��Z�Gdndo�doe��Z�Gdpd�d�Z�dudqdr�Z�e�dsk�r
e��dS)vzP
Read and write ZIP files.

XXX references to utf-8 need further investigation.
�N�
BadZipFile�
BadZipfile�error�
ZIP_STORED�ZIP_DEFLATED�	ZIP_BZIP2�ZIP_LZMA�
is_zipfile�ZipInfo�ZipFile�	PyZipFile�LargeZipFile�Pathc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.8/zipfile.pyr+sc@seZdZdZdS)r
zu
    Raised when writing a zipfile, the zipfile requires ZIP64 extensions
    and those extensions are disabled.
    N)rrr�__doc__rrrrr
/si���������-�.�?s<4s4H2LHsPK��������	z<4s4B4HL2L5H2LsPK�
��
����z<4s2B4HL2L2HsPKz<4sLQLsPKz
<4sQ2H2L4QsPKiPK�<HHc
Cs�tj}d}g}d}}|dt|�krz||||d��\}}|d|}	||krt||krl|�|||��|	}d}|	}q|s�|Sd�|�S)NFrr T�)�_EXTRA_FIELD_STRUCT�unpack�len�append�join)
�extraZxidsr/Zmodified�buffer�start�iZxidZxlen�jrrr�_strip_extra�s r8cCs,zt|�rWdSWntk
r&YnXdS)NTF)�_EndRecData�OSError��fprrr�_check_zipfile�s
r=c	CsVd}z8t|d�rt|d�}nt|d��}t|�}W5QRXWntk
rPYnX|S)z�Quickly see if a file is a ZIP file by checking the magic number.

    The filename argument may be a file or file-like object too.
    F�readr;�rb)�hasattrr=�openr:)�filename�resultr<rrrr	�s
c
Csz|�|td�Wntk
r,|YSX|�t�}t|�tkrH|St�t|�\}}}}|tkrh|S|dksx|dkr�t	d��|�|tt
d�|�t
�}t|�t
kr�|St�t|�\
}}}	}
}}}
}}}|tkr�|S||t
<||t<||t<|
|t<||t<||t<||t<|S)zM
    Read the ZIP64 end-of-archive records and use that to update endrec
    rrrz3zipfiles that span multiple disks are not supported)�seek�sizeEndCentDir64Locatorr:r>r0�structr/�structEndArchive64Locator�stringEndArchive64Locatorr�sizeEndCentDir64�structEndArchive64�stringEndArchive64�_ECD_SIGNATURE�_ECD_DISK_NUMBER�_ECD_DISK_START�_ECD_ENTRIES_THIS_DISK�_ECD_ENTRIES_TOTAL�	_ECD_SIZE�_ECD_OFFSET)�fpin�offset�endrec�dataZsigZdisknoZreloffZdisksZsz�create_versionZread_versionZdisk_numZdisk_dirZdircountZ	dircount2ZdirsizeZ	diroffsetrrr�
_EndRecData64�s@



�rXc	Csh|�dd�|��}z|�td�Wntk
r<YdSX|��}t|�tkr�|dd�tkr�|dd�dkr�t�t	|�}t
|�}|�d�|�|t�t|t|�St
|dtd�}|�|d�|��}|�t�}|dk�rd|||t�}t|�tk�rdSt
t�t	|��}|t}||t|t|�}|�|�|�||�t|||||�SdS)	z�Return data from the "End of Central Directory" record, or None.

    The data is a list of the nine items in the ZIP "End of central dir"
    record followed by a tenth item, the file seek offset of this record.rrNr ���sr-i)rD�tell�sizeEndCentDirr:r>r0�stringEndArchiverFr/�structEndArchive�listr1rX�max�rfind�_ECD_COMMENT_SIZE)	rSZfilesizerVrUZmaxCommentStartr5ZrecDataZcommentSize�commentrrrr9sD��



�r9c@s\eZdZdZdZddd�Zdd�Zdd
d�Zdd
�Zdd�Z	e
ddd�dd��Zdd�Zd	S)r
z>Class with attributes describing each file in the ZIP archive.)�
orig_filenamerB�	date_time�
compress_type�_compresslevelrbr3�
create_systemrW�extract_version�reserved�	flag_bits�volume�
internal_attr�
external_attr�
header_offset�CRC�
compress_size�	file_size�	_raw_time�NoName��rrrrrcCs�||_|�td��}|dkr(|d|�}tjdkrJtj|krJ|�tjd�}||_||_|ddkrjtd��t	|_
d|_d|_d|_
tjdkr�d|_nd|_t|_t|_d|_d|_d|_d|_d|_dS)Nr�/ruz+ZIP does not support timestamps before 1980r-Zwin32r)rc�find�chr�os�sep�replacerBrd�
ValueErrorrrerfrbr3�sys�platformrg�DEFAULT_VERSIONrWrhrirjrkrlrm)�selfrBrdZ	null_byterrr�__init__Xs0
zZipInfo.__init__cCs�d|jj|jfg}|jtkr8|�dt�|j|j��|jd?}|jd@}|rd|�dt	�
|��|rv|�d|�|��}|r�|jr�|�d|j�|r�|j
r�|jtks�|j|j
kr�|�d|j
�|�d	�d
�|�S)Nz<%s filename=%r� compress_type=%sr)rz filemode=%rz external_attr=%#xz
 file_size=%rz compress_size=%r�>�)�	__class__rrBrerr1�compressor_names�getrm�stat�filemode�is_dirrqrpr2)r�rC�hi�lo�isdirrrr�__repr__�s0
��



�
�
zZipInfo.__repr__NcCs||j}|ddd>|dd>B|dB}|dd>|d	d>B|ddB}|jd
@rfd}}}n|j}|j}|j}|j}d}	|dkr�|tkp�|tk}|r�d}
|t�|
dt�	|
�d	||�}|tks�|tkr�|s�t
d
��d}d}t}	|jt
k�rtt|	�}	n|jtk�rtt|	�}	t|	|j�|_t|	|j�|_|��\}}t�tt|j|j||j|||||t|�t|��
}
|
||S)z-Return the per-file header as a bytes object.rrur$rr!rrr&r rNz<HHQQz'Filesize would require ZIP64 extensions���)rdrjrorprqr3�ZIP64_LIMITrF�pack�calcsizer
�
ZIP64_VERSIONrerr_�
BZIP2_VERSIONr�LZMA_VERSIONrhrW�_encodeFilenameFlags�structFileHeader�stringFileHeaderrir0)r��zip64�dt�dosdate�dostimerorprqr3�min_version�fmtrBrj�headerrrr�
FileHeader�s^$$
�
�zZipInfo.FileHeadercCsDz|j�d�|jfWStk
r>|j�d�|jdBfYSXdS)N�ascii�utf-8�)rB�encoderj�UnicodeEncodeError�r�rrrr��szZipInfo._encodeFilenameFlagscCs�|j}tj}t|�dk�r�|d|dd��\}}|dt|�krPtd||f��|dk�rp|dkrv|d|dd��}nV|dkr�|d	|dd
��}n:|dkr�|d|dd
��}n|dkr�d}ntd||f��d}|jdk�rt|�|kr�td��|||_|d7}|jdk�r6t|�|k�r$td��|||_|d7}|jdk�rpt|�|k�rXtd��|j}|||_|d7}||dd�}qdS)Nr r,z"Corrupt extra field %04x (size=%d)r�z<QQQ�r)z<QQrrz<Qrrr)l����r�z/Corrupt zip64 extra field. File size not found.r�z3Corrupt zip64 extra field. Compress size not found.z3Corrupt zip64 extra field. Header offset not found.)r3rFr/r0rrqrprn)r�r3r/�tpZlnZcounts�idx�oldrrr�_decodeExtra�sP
�
�
�
zZipInfo._decodeExtraT��strict_timestampsc	Cst|tj�rt�|�}t�|�}t�|j�}t�|j	�}|dd�}|sZ|ddkrZd}n|sn|ddkrnd}|dkrz|}tj
�tj
�|�d�}|dtj
tjfkr�|dd�}q�|r�|d	7}|||�}|jd
@d>|_|r�d|_|jdO_n|j|_|S)a_Construct an appropriate ZipInfo for a file on the filesystem.

        filename should be the path to a file or directory on the filesystem.

        arcname is the name which it will have within the archive (by default,
        this will be the same as filename, but without a drive letter and with
        leading path separators removed).
        rr"rurt�;)r�r���;r�Nrrvrr))�
isinstancery�PathLike�fspathr��S_ISDIR�st_mode�time�	localtime�st_mtime�path�normpath�
splitdriverz�altseprmrq�st_size)	�clsrB�arcnamer��str��mtimerd�zinforrr�	from_file�s0



zZipInfo.from_filecCs|jddkS)z2Return True if this archive member is a directory.���rv�rBr�rrrr�%szZipInfo.is_dir)rsrt)N)N)
rrrr�	__slots__r�r�r�r�r��classmethodr�r�rrrrr
>s
+
.2%cCs0td�D]"}|d@r"|d?dA}q|dL}q|S)Nrrl q[)�range)�crcr7rrr�_gen_crc/s

r�csld�d�d�tdkr&ttttd���at��fdd������fdd��|D]}�|�qL��fd	d
�}|S)NixV4i�gE#i�xV4�cs|d?�||Ad@AS)z(Compute the CRC32 primitive on one byte.r�r)Zchr�)�crctablerr�crc32Isz_ZipDecrypter.<locals>.crc32cs<�|�����d@d@��ddd@���d?���dS)Nr�r�i�rr�r)�c)r��key0�key1�key2rr�update_keysMs
z"_ZipDecrypter.<locals>.update_keyscsNt�}|j}|D]4}�dB}|||dAd?d@N}�|�||�qt|�S)zDecrypt a bytes object.rrrr�)�	bytearrayr1�bytes)rVrCr1r��k)r�r�rr�	decrypterWs
z _ZipDecrypter.<locals>.decrypter)�	_crctabler^�mapr�r�)�pwd�pr�r)r�r�r�r�r�r�r�
_ZipDecrypter?s
r�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�LZMACompressorcCs
d|_dS�N)�_compr�rrrr�gszLZMACompressor.__init__cCsFt�dtji�}tjtjt�tj|�gd�|_t�dddt	|��|S)N�id��filtersz<BBHr$r )
�lzmaZ_encode_filter_properties�FILTER_LZMA1r��
FORMAT_RAW�_decode_filter_propertiesr�rFr�r0)r�Zpropsrrr�_initjs
�
zLZMACompressor._initcCs*|jdkr|��|j�|�S|j�|�Sr�)r�r��compress)r�rVrrrr�qs
zLZMACompressor.compresscCs&|jdkr|��|j��S|j��Sr�)r�r��flushr�rrrr�vs
zLZMACompressor.flushN)rrrr�r�r�r�rrrrr�esr�c@seZdZdd�Zdd�ZdS)�LZMADecompressorcCsd|_d|_d|_dS)Nr-F)�_decomp�_unconsumed�eofr�rrrr�~szLZMADecompressor.__init__c	Cs�|jdkr�|j|7_t|j�dkr*dSt�d|jdd��\}t|j�d|krXdStjtjt�tj	|jdd|��gd�|_|jd|d�}|`|j�
|�}|jj|_|S)Nr r-z<Hrr�)r�r�r0rFr/r�r�r�r�r��
decompressr�)r�rVZpsizerCrrrr��s"
��

zLZMADecompressor.decompressN)rrrr�r�rrrrr�|sr�ZstoreZshrink�reduceZimplode�tokenizeZdeflateZ	deflate64Zbzip2r�ZterseZlz77ZwavpackZppmd)rrrrr r!r"r#rr$r%rrr+��a�bcCsX|tkr
nJ|tkr tsTtd��n4|tkr6tsTtd��n|tkrLtsTtd��ntd��dS)Nz.Compression requires the (missing) zlib modulez-Compression requires the (missing) bz2 modulez.Compression requires the (missing) lzma modulez(That compression method is not supported)	rr�zlib�RuntimeErrorr�bz2rr��NotImplementedError)�compressionrrr�_check_compression�s$���r�cCsj|tkr2|dk	r t�|tjd�St�tjtjd�S|tkrT|dk	rLt�|�St��S|tkrbt	�SdSdS)N��)
rr�ZcompressobjZDEFLATEDZZ_DEFAULT_COMPRESSIONrr�Z
BZ2Compressorrr�)re�
compresslevelrrr�_get_compressor�s
r�cCsvt|�|tkrdS|tkr&t�d�S|tkr6t��S|tkrDt	�St
�|�}|rdtd||f��ntd|f��dS)Nr�zcompression type %d (%s)zcompression type %d)
r�rrr�Z
decompressobjrr�ZBZ2Decompressorrr�r�r�r�)reZdescrrrr�_get_decompressor�s

r�c@s0eZdZdd�Zddd�Zd
dd�Zd	d
�ZdS)�_SharedFilecCs2||_||_||_||_||_|j|_|j|_dSr�)�_file�_pos�_close�_lock�_writing�seekablerZ)r��file�pos�close�lockZwritingrrrr��sz_SharedFile.__init__rc
CsN|j�>|��rtd��|j�||�|j��|_|jW5QR�SQRXdS)Nz}Can't reposition in the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.)rrr|rrDrZr)r�rT�whencerrrrD�sz_SharedFile.seekr�c
CsX|j�H|��rtd��|j�|j�|j�|�}|j��|_|W5QR�SQRXdS)N�yCan't read from the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.)rrr|rrDrr>rZ�r��nrVrrrr>�sz_SharedFile.readcCs$|jdk	r |j}d|_|�|�dSr�)rr)r��fileobjrrrr	s
z_SharedFile.closeN)r)r�)rrrr�rDr>r	rrrrr�s	


rc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�	_TellablecCs||_d|_dS�Nr)r<rT�r�r<rrrr�sz_Tellable.__init__cCs|j�|�}|j|7_|Sr�)r<�writerT)r�rVrrrrrsz_Tellable.writecCs|jSr�)rTr�rrrrZsz_Tellable.tellcCs|j��dSr�)r<r�r�rrrr�sz_Tellable.flushcCs|j��dSr�)r<r	r�rrrr	sz_Tellable.closeN)rrrr�rrZr�r	rrrrrs
rcs�eZdZdZdZdZdZd(dd�Zd	d
�Zdd�Z	d)dd�Z
d*dd�Zdd�Zd+dd�Z
dd�Zdd�Zdd�Zdd�Z�fdd �Zd!d"�Zd,d$d%�Zd&d'�Z�ZS)-�
ZipExtFilezZFile-like object for reading an archive member.
       Is returned by ZipFile.open().
    i@iiNFcCs(||_||_||_|j|_|j|_|j|_t	|j�|_
d|_d|_d|_
d|_||_|j|_t|d�rz|j|_td�|_nd|_d|_z4|��r�|��|_|j|_|j|_|j|_d|_Wntk
r�YnXd|_|�r$|j d@r�|j!d?d@}n|jd?d@}|�"�}||k�r$t#d	|j$��dS)
NFr-rroTrr�r�zBad password for file %r)%�_fileobj�_pwd�_close_fileobjre�_compress_typerp�_compress_leftrq�_leftr��
_decompressor�_eof�_readbuffer�_offset�newlines�moderB�namer@ro�
_expected_crcr��_running_crc�	_seekablerrZ�_orig_compress_start�_orig_compress_size�_orig_file_size�_orig_start_crc�AttributeError�
_decrypterrjrr�_init_decrypterr�rc)r�rr �zipinfor�Z
close_fileobjZ
check_byte�hrrrr�)sF




zZipExtFile.__init__cCs4t|j�|_|j�d�}|jd8_|�|�dS)Nrr&)r�rr*rr>r)r�r�rrrr+\szZipExtFile._init_decryptercCsvd|jj|jjfg}|jsX|�d|j|jf�|jtkrb|�dt	�
|j|j��n
|�d�|�d�d�|�S)N�<%s.%sz name=%r mode=%rr��	 [closed]r�r�)r�rr�closedr1r!r rrr�r�r2�r�rCrrrr�gs�
��

zZipExtFile.__repr__r�cCsL|dkr>|j�d|j�d}|dkr>|j|j|�}||_|Stj�||�S)zrRead and return a line from the stream.

        If limit is specified, at most limit bytes will be read.
        r�
r)rrwr�io�BufferedIOBase�readline)r��limitr6�linerrrr5uszZipExtFile.readlinercCsr|t|j�|jkr\|�|�}t|�|jkrJ||j|jd�|_d|_n|jt|�8_|j|j|jd�S)z6Returns buffered bytes without advancing the position.Nri)r0rrr>)r�r�chunkrrr�peek�s
zZipExtFile.peekcCsdS�NTrr�rrr�readable�szZipExtFile.readablecCs|dks|dkrH|j|jd�}d|_d|_|jsD||�|j�7}q,|S||j}|t|j�krz|j|j|�}||_|S|t|j�}|j|jd�}d|_d|_|dkr�|js�|�|�}|t|�kr�||_||_||d|�7}q�||7}|t|�8}q�|S)z�Read and return up to n bytes.
        If the argument is omitted, None, or negative, data is read and returned until EOF is reached.
        Nrr-�rrr�_read1�MAX_Nr0)r�r�buf�endrVrrrr>�s4

zZipExtFile.readcCs@|jdkrdSt||j�|_|jr<|j|jkr<td|j��dS)NzBad CRC-32 for file %r)r"r�r#rrr!)r��newdatarrr�_update_crc�s

zZipExtFile._update_crccCs|dks|dkrR|j|jd�}d|_d|_|jsN|�|j�}|r,||7}qNq,|S||j}|t|j�kr�|j|j|�}||_|S|t|j�}|j|jd�}d|_d|_|dk�r|j�s|�|�}|t|�kr�||_||_||d|�7}�q|r�||7}�qq�|S)z7Read up to n bytes with at most one read() system call.Nrr-r<)r�rr?rVr@rrr�read1�s>


zZipExtFile.read1cCs"|js|dkrdS|jtkrH|jj}|t|�krR||�|t|��7}n
|�|�}|jtkrj|jdk|_nx|jtkr�t	||j
�}|j�||�}|jjp�|jdko�|jj|_|jr�||j�
�7}n |j�|�}|jjp�|jdk|_|d|j�}|jt|�8_|jdk�rd|_|�|�|S)Nrr-T)rrrrZunconsumed_tailr0�_read2rrr_�
MIN_READ_SIZEr�r�r�rrBr
rrrr=�s4




�
zZipExtFile._read1cCsd|jdkrdSt||j�}t||j�}|j�|�}|jt|�8_|sLt�|jdk	r`|�|�}|S)Nrr-)	rr_rE�minrr>r0�EOFErrorr*r
rrrrD	s


zZipExtFile._read2cs&z|jr|j��W5t���XdSr�)�superr	rrr��r�rrr	szZipExtFile.closecCs|jSr�)r$r�rrrr szZipExtFile.seekablercCs>|jst�d��|��}|dkr&|}n.|dkr8||}n|dkrL|j|}ntd��||jkrd|j}|dkrpd}||}||j}|dkr�|t|j�kr�||_d}nf|dk�r
|j	�
|j�|j|_
|j|_|j|_d|_d|_t|j�|_d|_|}|jdk	�r
|��|dk�r6t|j|�}|�|�||8}�q
|��S)N�!underlying stream is not seekablerrrzCwhence must be os.SEEK_SET (0), os.SEEK_CUR (1), or os.SEEK_END (2)r-F)r$r3�UnsupportedOperationrZr'r|rr0rrrDr%r(r#r&rrr�rrrr*r+rF�
MAX_SEEK_READr>)r�rTrZcurr_posZnew_posZread_offsetZbuff_offsetZread_lenrrrrD#sH






zZipExtFile.seekcCs0|jst�d��|j|jt|j�|j}|S)NrJ)r$r3rKr'rr0rr)r�ZfileposrrrrZSs
zZipExtFile.tell)NF)r�)r)r�)r)rrrrr>rErLr�r+r�r5r9r;r>rBrCr=rDr	rrDrZ�
__classcell__rrrIrrs*�
3



!
%$
0rcs@eZdZdd�Zedd��Zdd�Zdd�Z�fd	d
�Z�Z	S)�
_ZipWriteFilecCs8||_||_||_t|j|j�|_d|_d|_d|_	dSr)
�_zinfo�_zip64�_zipfiler�rerf�_compressor�
_file_size�_compress_size�_crc)r��zfr�r�rrrr�[s�z_ZipWriteFile.__init__cCs|jjSr�)rQr<r�rrrresz_ZipWriteFile._fileobjcCsdSr:rr�rrr�writableisz_ZipWriteFile.writablecCsf|jrtd��t|�}|j|7_t||j�|_|jrV|j�|�}|jt|�7_|j	�
|�|S)NzI/O operation on closed file.)r0r|r0rSr�rUrRr�rTrr)r�rV�nbytesrrrrlsz_ZipWriteFile.writec	sb|jr
dS�zFt���|jrR|j��}|jt|�7_|j	�
|�|j|j_n
|j
|j_|j|j_|j
|j_|jjd@r�|jr�dnd}|j	�
t�|t|jj|jj|jj��|j	��|j_nn|js�|j
tkr�td��|jtkr�td��|j	��|j_|j	�|jj�|j	�
|j�|j��|j	�|jj�|jj�|j�|j|jj|jj <W5d|j_XdS)NFrz<LLQQz<LLLLz+File size unexpectedly exceeded ZIP64 limitz1Compressed size unexpectedly exceeded ZIP64 limit)!r0rQrrHr	rRr�rTr0rrrOrprSrUrorqrjrPrFr��
_DD_SIGNATURErZ�	start_dirr�r�rDrnr��filelistr1�
NameToInforB)r�r?r�rIrrr	xsF




�
�
�z_ZipWriteFile.close)
rrrr��propertyrrWrr	rMrrrIrrNZs

rNc@s$eZdZdZdZdZdeddfdd�dd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
d=dd�Zdd�Zdd�Zdd�Zedd��Zejdd��Zd>dd �Zd?d!d"�d#d$�Zd@d%d&�ZdAd'd(�ZdBd)d*�Zed+d,��Zd-d.�Zd/d0�ZdCd1d2�ZdDd3d4�Zd5d6�Z d7d8�Z!d9d:�Z"d;d<�Z#dS)Erai Class with methods to open, read, write, close, list zip files.

    z = ZipFile(file, mode="r", compression=ZIP_STORED, allowZip64=True,
                compresslevel=None)

    file: Either the path to the file, or a file-like object.
          If it is a path, the file will be opened and closed by ZipFile.
    mode: The mode can be either read 'r', write 'w', exclusive create 'x',
          or append 'a'.
    compression: ZIP_STORED (no compression), ZIP_DEFLATED (requires zlib),
                 ZIP_BZIP2 (requires bz2) or ZIP_LZMA (requires lzma).
    allowZip64: if True ZipFile will create files with ZIP64 extensions when
                needed, otherwise it will raise an exception when this would
                be necessary.
    compresslevel: None (default for the given compression type) or an integer
                   specifying the level to pass to the compressor.
                   When using ZIP_STORED or ZIP_LZMA this keyword has no effect.
                   When using ZIP_DEFLATED integers 0 through 9 are accepted.
                   When using ZIP_BZIP2 integers 1 through 9 are accepted.

    N�rTr�c
	CsP|dkrtd��t|�||_d|_d|_i|_g|_||_||_||_	d|_
d|_||_t
|tj�rpt�|�}t
|t�r�d|_||_ddd	d
dddd
�}||}zt�||�|_Wq�tk
r�||kr�||}Yq��Yq�Xq�q�nd|_||_t|dd�|_d|_t��|_d|_d|_�z|dk�r4|��n�|dk�r�d|_z|j� �|_!Wn2t"tfk
�r�t#|j�|_d|_!d|_Yn6Xz|j�$|j!�Wn t"tfk
�r�d|_YnXnf|dk�rz|��|j�$|j!�Wn6t%k
�r|j�$dd�d|_|j� �|_!YnXntd��Wn$|j}	d|_|�&|	��YnXdS)z]Open the ZIP file with mode read 'r', write 'w', exclusive create 'x',
        or append 'a'.)r^�w�x�az+ZipFile requires mode 'r', 'w', 'x', or 'a'FrNr-r?�w+b�x+b�r+b�wbZxb)r^r_r`rardrbrcrr!Tr^)r_r`rarz"Mode must be 'r', 'w', 'x', or 'a')'r|r��_allowZip64�
_didModify�debugr\r[r�r�r r��_comment�_strict_timestampsr�ryr�r��str�_filePassedrBr3rAr<r:�getattr�_fileRefCnt�	threading�RLockrr$r�_RealGetContentsrZrZr)rrDr�_fpclose)
r�rr r��
allowZip64r�r�ZmodeDictr�r<rrrr��s�

�





zZipFile.__init__cCs|Sr�rr�rrr�	__enter__szZipFile.__enter__cCs|��dSr��r	)r��type�value�	tracebackrrr�__exit__szZipFile.__exit__cCs�d|jj|jjfg}|jdk	rd|jr8|�d|j�n|jdk	rR|�d|j�|�d|j�n
|�d�|�d�d�|�S)Nr.z file=%rz filename=%rz mode=%rr/r�r�)	r�rrr<rlr1rBr r2r1rrrr�"s�



zZipFile.__repr__cCs�|j}zt|�}Wntk
r.td��YnX|s<td��|jdkrNt|�|t}|t}|t|_	|t
||}|ttkr�|t
t8}|jdkr�||}td|||�|||_|�|jd�|�|�}t�|�}d}||k�r�|�t�}	t|	�tk�r
td��t�t|	�}	|	ttk�r,td��|jdk�r@t|	�|�|	t�}
|	d}|d	@�rl|
�d
�}
n
|
�d�}
t|
�}|�|	t�|_|�|	t �|_!|	t"|_#|	dd�\|_$|_%|_&|_'|_(|_)}
}|_*|_+|_,|j&t-k�r�t.d
|j&d��|	dd�\|_/|_0|_1|
|_2|d?d|d?d@|d@|
d?|
d?d@|
d@df|_3|�4�|j#||_#|j5�6|�||j7|j8<|t|	t|	t|	t }|jdkr�td|�q�dS)z/Read in the table of contents for the ZIP file.zFile is not a zip filerrzgiven, inferred, offsetrzTruncated central directoryz&Bad magic number for central directoryr!r�r��cp437rzzip file version %.1fr%r(r+r$rur�r&r�totalN)9r<r9r:rrh�printrQrR�_ECD_COMMENTri�
_ECD_LOCATIONrLrKrIrErZrDr>r3�BytesIO�sizeCentralDirr0rFr/�structCentralDir�
_CD_SIGNATURE�stringCentralDir�_CD_FILENAME_LENGTH�decoder
�_CD_EXTRA_FIELD_LENGTHr3�_CD_COMMENT_LENGTHrb�_CD_LOCAL_HEADER_OFFSETrnrWrgrhrirjrerorprq�MAX_EXTRACT_VERSIONr�rkrlrmrrrdr�r[r1r\rB)r�r<rUZsize_cdZ	offset_cd�concatZinferredrVr{�centdirrB�flagsr`�t�drrrrq0s�











��

���
zZipFile._RealGetContentscCsdd�|jD�S)z+Return a list of file names in the archive.cSsg|]
}|j�qSrr�)�.0rVrrr�
<listcomp>�sz$ZipFile.namelist.<locals>.<listcomp>�r[r�rrr�namelist~szZipFile.namelistcCs|jS)zJReturn a list of class ZipInfo instances for files in the
        archive.r�r�rrr�infolist�szZipFile.infolistcCsLtdd|d�|jD]0}d|jdd�}td|j||jf|d�qdS)z+Print a table of contents for the zip file.z%-46s %19s %12s)z	File NamezModified    ZSize�rz%d-%02d-%02d %02d:%02d:%02dNr"z
%-46s %s %12d)r|r[rdrBrq)r�rr��daterrr�printdir�s�
�zZipFile.printdirc
Cs^d}|jD]N}z*|�|jd��}|�|�r,q W5QRXWq
tk
rV|jYSXq
dS)z%Read all the files and check the CRC.ir^N)r[rArBr>r)r�Z
chunk_sizer��frrr�testzip�s

zZipFile.testzipcCs$|j�|�}|dkr td|��|S)z,Return the instance of ZipInfo given 'name'.Nz(There is no item named %r in the archive)r\r��KeyError)r�r!�inforrr�getinfo�s�zZipFile.getinfocCs6|r t|t�s tdt|�j��|r,||_nd|_dS)z)Set default password for encrypted files.�pwd: expected bytes, got %sN)r�r��	TypeErrorrvrr�)r�r�rrr�setpassword�s
zZipFile.setpasswordcCs|jS)z.The comment text associated with the ZIP file.)rir�rrrrb�szZipFile.commentcCs^t|t�stdt|�j��t|�tkrNddl}|jdtdd�|dt�}||_	d|_
dS)Nzcomment: expected bytes, got %srz3Archive comment is too long; truncating to %d bytesr��
stacklevelT)r�r�r�rvrr0�ZIP_MAX_COMMENT�warnings�warnrirg)r�rbr�rrrrb�s
��c
Cs.|�|d|��}|��W5QR�SQRXdS)zReturn file bytes for name.r^N�rAr>)r�r!r�r<rrrr>�szZipFile.readF��force_zip64cs|dkrtd��|r0t|t�s0tdt|�j��|rD|dkrDtd���jsRtd��t|t�rb|}n,|dkr�t|�}�j|_	�j
|_n
��|�}|dkr��j
||d�S�jr�td���jd	7_t�j|j�j�j�fd
d��}�z|�t�}t|�tk�rtd��t�t|�}|ttk�r&td
��|�|t�}|t�rL|�|t�|jd@�r`t d��|jd@�rtt d��|t!d@�r�|�"d�}	n
|�"d�}	|	|j#k�r�td|j#|f��|jd	@}
|
�r�|�s҈j$}|�s�t%d|��nd}t&||||d�WS|�'��YnXdS)auReturn file-like object for 'name'.

        name is a string for the file name within the ZIP file, or a ZipInfo
        object.

        mode should be 'r' to read a file already in the ZIP file, or 'w' to
        write to a file newly added to the archive.

        pwd is the password to decrypt files (only used for reading).

        When writing, if the file size is not known in advance but may exceed
        2 GiB, pass force_zip64 to use the ZIP64 format, which can handle large
        files.  If the size is known in advance, it is best to pass a ZipInfo
        instance for name, with zinfo.file_size set.
        >r_r^zopen() requires mode "r" or "w"r�r_z'pwd is only supported for reading filesz2Attempt to use ZIP archive that was already closedr�rrcs�jSr�)rrr�rr�<lambda>�r-zZipFile.open.<locals>.<lambda>zTruncated file headerz Bad magic number for file header� z$compressed patched data (flag bit 5)�@zstrong encryption (flag bit 6)r�r�rzz/File name in directory %r and header %r differ.z6File %r is encrypted, password required for extractionNT)(r|r�r�r�rvrr<r
r�rer�rfr��_open_to_writerrnrrnrrrr>�sizeFileHeaderr0rrFr/r��
_FH_SIGNATUREr��_FH_FILENAME_LENGTH�_FH_EXTRA_FIELD_LENGTHrjr��_FH_GENERAL_PURPOSE_FLAG_BITSr�rcr�r�rr	)r�r!r r�r�r�Zzef_fileZfheader�fnameZ	fname_strZis_encryptedrr�rrA�s~�




�


��
�zZipFile.opencCs�|r|jstd��|jr td��t|d�s0d|_d|_d|_d|_|jt	krZ|jdO_|j
sn|jdO_|jszd|_|jo�|p�|jdtk}|j
r�|j
�|j�|j
��|_|�|�d	|_|j
�|�|��d	|_t|||�S)
NzHforce_zip64 is True, but allowZip64 was False when opening the ZIP file.zzCan't write to the ZIP file while there is another write handle open on it. Close the first handle before opening another.rqrrr��g�������?T)rfr|rr@rqrprorjrerr$rmr�r<rDrZrZrn�_writecheckrgrr�rN)r�r�r�r�rrrr�(s8
�

�
zZipFile._open_to_writecCs*|dkrt��}n
t�|�}|�|||�S)a#Extract a member from the archive to the current working directory,
           using its full name. Its file information is extracted as accurately
           as possible. `member' may be a filename or a ZipInfo object. You can
           specify a different directory using `path'.
        N)ry�getcwdr��_extract_member)r��memberr�r�rrr�extractSs

zZipFile.extractcCsH|dkr|��}|dkr"t��}n
t�|�}|D]}|�|||�q0dS)z�Extract all members from the archive to the current working
           directory. `path' specifies a different directory to extract to.
           `members' is optional and must be a subset of the list returned
           by namelist().
        N)r�ryr�r�r�)r�r��membersr�r,rrr�
extractall`s

zZipFile.extractallcCs^|j}|s(d}t�|dt|��}||_|�|�}dd�|�|�D�}|�dd�|D��}|S)z;Replace bad characters and remove trailing dots from parts.z:<>|"?*�_css|]}|�d�VqdS)�.N)�rstrip�r�r`rrr�	<genexpr>{sz1ZipFile._sanitize_windows_name.<locals>.<genexpr>css|]}|r|VqdSr�rr�rrrr�}s)�!_windows_illegal_name_trans_tablerk�	maketransr0�	translate�splitr2)r�r��pathsep�tableZillegalrrr�_sanitize_windows_nameqs
zZipFile._sanitize_windows_namec
sLt|t�s|�|�}|j�dtjj�}tjjrB|�tjjtjj�}tj�	|�d}dtjj
tjjf�tjj��fdd�|�
tjj�D��}tjjdkr�|�|tjj�}tj�||�}tj�|�}tj�|�}|r�tj�|�s�t�|�|���rtj�|��st�|�|S|j||d��(}t|d��}t�||�W5QRXW5QRX|S)	zbExtract the ZipInfo object 'member' to a physical
           file on the path targetpath.
        rvrr�c3s|]}|�kr|VqdSr�rr��Zinvalid_path_partsrrr��s�z*ZipFile._extract_member.<locals>.<genexpr>�\)r�re)r�r
r�rBr{ryr�rzr�r��curdir�pardirr2r�r�r��dirname�exists�makedirsr�r��mkdirrA�shutil�copyfileobj)r�r�Z
targetpathr�r�Z	upperdirs�source�targetrr�rr��s2

&


� zZipFile._extract_membercCs�|j|jkr(ddl}|jd|jdd�|jdkr:td��|jsHtd��t|j�|j	s�d}t
|j�tkrpd	}n|j
tkr�d
}n|jtkr�d}|r�t|d��dS)
z6Check for errors before writing a file to the archive.rNzDuplicate name: %rrr��r_r`raz&write() requires mode 'w', 'x', or 'a'z4Attempt to write ZIP archive that was already closed�Files countZFilesizezZipfile size� would require ZIP64 extensions)rBr\r�r�r r|r<r�rerfr0r[�ZIP_FILECOUNT_LIMITrqr�rnr
)r�r�r��requires_zip64rrrr��s,
�


�zZipFile._writecheckc
CsP|jstd��|jrtd��tj|||jd�}|��rDd|_d|_n0|dk	rT||_	n|j
|_	|dk	rl||_n|j|_|���r|j
��|jr�|j�|j�|j��|_|j	tkr�|jdO_|�|�d|_|j�|�||j|j<|j�|�d��|j��|_W5QRXn<t|d	��,}|�|d
��}t�||d�W5QRXW5QRXdS)zLPut the bytes from filename into the archive under the name
        arcname.�7Attempt to write to ZIP archive that was already closedz>Can't write to ZIP archive while an open writing handle existsr�rNrTFr?r_i ) r<r|rr
r�rjr�rprorer�rfr�rr$rDrZrZrnrrjr�rgr[r1r\rBrr�rAr�r�)r�rBr�rer�r��src�destrrrr�sF���


z
ZipFile.writec
Cs�t|t�r|�d�}t|t�sxt|t�t���dd�d�}|j|_|j|_	|j
ddkrpd|_|jdO_q|d	|_n|}|js�t
d
��|jr�t
d��|dk	r�||_|dk	r�||_	t|�|_|j�*|j|dd
��}|�|�W5QRXW5QRXdS)aWrite a file into the archive.  The contents is 'data', which
        may be either a 'str' or a 'bytes' instance; if it is a 'str',
        it is encoded as UTF-8 first.
        'zinfo_or_arcname' is either a ZipInfo instance or
        the name of the file in the archive.r�Nr")rBrdr�rvi�Ar)r�r�z?Can't write to ZIP archive while an open writing handle exists.r_)r )r�rkr�r
r�r�r�rer�rfrBrmr<r|rr0rqrrAr)r�Zzinfo_or_arcnamerVrer�r�r�rrr�writestr�s:


���
zZipFile.writestrcCs|��dS)z2Call the "close()" method in case the user forgot.Nrur�rrr�__del__szZipFile.__del__c	Cs||jdkrdS|jrtd��zB|jdkr\|jr\|j�"|jrJ|j�|j	�|�
�W5QRXW5|j}d|_|�|�XdS)zOClose the file, and for mode 'w', 'x' and 'a' write the ending
        records.NzvCan't close the ZIP file while there is an open writing handle on it. Close the writing handle before closing the zip.r�)r<rr|rrr rgrr$rDrZ�_write_end_recordrrrrr	s
z
ZipFile.closecCs�|jD�]D}|j}|ddd>|dd>B|dB}|dd>|d	d>B|ddB}g}|jtksr|jtkr�|�|j�|�|j�d
}d
}n|j}|j}|jtkr�|�|j�d
}n|j}|j}	d}
|�rt|	d�}	t	j
dd
t|�ddt|�f|��|	}	t}
|j
tk�r$tt|
�}
n|j
tk�r:tt|
�}
t|
|j�}t|
|j�}zZ|��\}
}t	�
tt||j||j||j
|||j||t|
�t|	�t|j�d|j|j|�}Wnltk
�rttt||j||j|j |j
|||j||t|j!�t|	�t|j�d|j|j|ft"j#d��YnX|j$�%|�|j$�%|
�|j$�%|	�|j$�%|j�q|j$�&�}t|j�}||j'}|j'}d}|t(k�r�d}n|tk�r�d}n|tk�r�d}|�r$|j)�s�t*|d��t	�
t+t,ddddd||||�}|j$�%|�t	�
t-t.d|d�}|j$�%|�t/|d�}t/|d
�}t/|d
�}t	�
t0t1dd||||t|j2��	}|j$�%|�|j$�%|j2�|j3dk�rt|j$�4�|j$�5�dS)Nrrur$rr!rrr&r r�)rr,�Qrr�r�zCentral directory offsetzCentral directory sizer��,rrra)6r[rdrqr�rpr1rnr3r8rFr�r0r�rerr_r�rr�rhrWr�r�r�rgrirorbrlrm�DeprecationWarningr|rjrBr}�stderrr<rrZrZr�rfr
rJrKrGrHrFr]r\rir �truncater�)r�r�r�r�r�r3rqrprnZ
extra_datar�rhrWrBrjr�Zpos2ZcentDirCountZcentDirSizeZ
centDirOffsetr�Zzip64endrecZzip64locrecrUrrrr�5s$$
�


���
���





���


�
zZipFile._write_end_recordcCs4|jdkst�|jd8_|js0|js0|��dS)Nrr)rn�AssertionErrorrlr	rrrrrr�szZipFile._fpclose)N)N)r^N)F)NN)NNN)NNN)NN)$rrrrr<r�rr�rtryr�rqr�r�r�r�r�r�r]rb�setterr>rAr�r�r�r�r�r�r�rr�r�r	r�rrrrrrr�sT��ZN
	
		


b
+


*�
2�
)hc@s4eZdZdZdeddfdd�Zd
d	d
�Zdd�ZdS)rzDClass to create ZIP archives with Python library files and packages.r^Tr�cCstj|||||d�||_dS)N)r r�rs)rr��	_optimize)r�rr r�rs�optimizerrrr��s�zPyZipFile.__init__r�NcCs�t�|�}|rD||�sD|jr@tj�|�r,dnd}td||f�dStj�|�\}}tj�|��rhtj�|d�}tj�|��r�|r�d||f}n|}|jr�td|d|�|�	|d	d
�|�\}}	|jr�td|	�|�
||	�tt�|��}
|
�
d�|
D]�}tj�||�}tj�|�\}
}tj�|��rRtj�tj�|d���r�|j|||d�q�|d
kr�|�r~||��s~|jr�td|�q�|�	|d	d
�|�\}}	|j�r�td|	�|�
||	�q�n�|j�r�td|�tt�|��D]�}tj�||�}tj�|�\}
}|d
k�r�|�r,||��s,|j�r�td|��q�|�	|d	d
�|�\}}	|j�rVtd|	�|�
||	��q�nP|d
d�d
k�r�td��|�	|d	d
�|�\}}	|j�r�td|	�|�
||	�dS)a�Add all files from "pathname" to the ZIP archive.

        If pathname is a package directory, search the directory and
        all package subdirectories recursively for all *.py and enter
        the modules into the archive.  If pathname is a plain
        directory, listdir *.py and enter all modules.  Else, pathname
        must be a Python *.py file and the module will be put into the
        archive.  Added modules are always module.pyc.
        This method will compile the module.py into module.pyc if
        necessary.
        If filterfunc(pathname) is given, it is called with every argument.
        When it is False, the file or directory is skipped.
        r�rz%s %r skipped by filterfuncNz__init__.py�%s/%szAdding package in�asr���ZAdding)�
filterfunc�.pyzfile %r skipped by filterfunczAdding files from directoryz.Files added with writepy() must end with ".py"zAdding file)ryr�rhr�r�r|r�r2�isfile�
_get_codenamer�sorted�listdir�remove�splitext�writepyr�)r��pathname�basenamer�Zlabel�dirr!Zinitnamer�r�ZdirlistrBr��rootZextrrrr��s�


��


�
�
zPyZipFile.writepyc
sd�fdd�	}|d}|d}tjj|dd�}tjj|dd�}tjj|d	d�}�jdk�r\tj�|�r�t�|�jt�|�jkr�|}	}
n�tj�|�r�t�|�jt�|�jkr�|}
|}	n�tj�|�r�t�|�jt�|�jkr�|}
|}	nvtj�|��rt�|�jt�|�jk�r|}
|}	nD||��rRt	j
jd
k�r4|}
nt	j
jdk�rH|}
n|}
|}	n|}
}	n��jd
k�rr|}
|}	n<|}	�jdk�r�|}
n&�jd	k�r�|}
nd��j�}t
|��tj�|
��r�t�|
�jt�|�jk�s�||�jd��s�|}
}	tj�|	�d}|�rd
||f}|
|fS)aReturn (filename, archivename) for the path.

        Given a module name path, return the correct file path and
        archive name, compiling if necessary.  For example, given
        /python/lib/string, return (/python/lib/string.pyc, string).
        r�c
sfddl}�jrtd|�z|j|d|d�Wn4|jk
r`}zt|j�WY�dSd}~XYnXdS)NrZ	CompilingT)�doraiser�F)�
py_compilerhr|�compile�PyCompileError�msg)rr�r��errr�rr�_compiles

z)PyZipFile._get_codename.<locals>._compiler�z.pycr�)�optimizationrrrz"invalid value for 'optimize': {!r})r�r�)r�)�	importlib�util�cache_from_sourcer�ryr�r�r�r�r}r�r��formatr|r�)
r�r�r�r�Zfile_pyZfile_pycZpycache_opt0Zpycache_opt1Zpycache_opt2r�r�r�Zarchivenamerr�rr��sj�
���

�zPyZipFile._get_codename)r�N)rrrrrr�r�r�rrrrr�s�

RcCst�t|�dd�S)a2
    Given a path with elements separated by
    posixpath.sep, generate all parents of that path.

    >>> list(_parents('b/d'))
    ['b']
    >>> list(_parents('/b/d/'))
    ['/b']
    >>> list(_parents('b/d/f/'))
    ['b/d', 'b']
    >>> list(_parents('b'))
    []
    >>> list(_parents(''))
    []
    rN)�	itertools�islice�	_ancestry)r�rrr�_parentsRsrccs4|�tj�}|r0|tjkr0|Vt�|�\}}qdS)aR
    Given a path with elements separated by
    posixpath.sep, generate all elements of that path

    >>> list(_ancestry('b/d'))
    ['b/d', 'b']
    >>> list(_ancestry('/b/d/'))
    ['/b/d', '/b']
    >>> list(_ancestry('b/d/f/'))
    ['b/d/f', 'b/d', 'b']
    >>> list(_ancestry('b'))
    ['b']
    >>> list(_ancestry(''))
    []
    N)r��	posixpathrzr�)r��tailrrrresrcCst�t|�j|�S)zZ
    Return items in minuend not in subtrahend, retaining order
    with O(1) lookup.
    )r�filterfalse�set�__contains__)ZminuendZ
subtrahendrrr�_differencesr
csHeZdZdZedd��Z�fdd�Zdd�Zdd	�Ze	d
d��Z
�ZS)�CompleteDirszk
    A ZipFile subclass that ensures that implied directories
    are always included in the namelist.
    cCs.tj�tt|��}dd�|D�}tt||��S)Ncss|]}|tjVqdSr�)rrz)r�r�rrrr��sz-CompleteDirs._implied_dirs.<locals>.<genexpr>)r�chain�
from_iterabler�r�_deduper
)�names�parentsZas_dirsrrr�
_implied_dirs�szCompleteDirs._implied_dirscs tt|���}|t|�|��Sr�)rHrr�r^r)r�rrIrrr��szCompleteDirs.namelistcCst|���Sr�)rr�r�rrr�	_name_set�szCompleteDirs._name_setcCs,|��}|d}||ko||k}|r(|S|S)zx
        If the name represents a directory, return that name
        as a directory (with the trailing slash).
        rv)r)r�r!rr�Z	dir_matchrrr�resolve_dir�szCompleteDirs.resolve_dircCsNt|t�r|St|t�s ||�Sd|jkr.t}|�|�}t|��t|��|S)zl
        Given a source (filename or zipfile), return an
        appropriate CompleteDirs subclass.
        r^)r�rrr �__new__�vars�update)r�r��resrrr�make�s



zCompleteDirs.make)rrrr�staticmethodrr�rrr�rrMrrrIrr�s

rcs,eZdZdZ�fdd�Z�fdd�Z�ZS)�
FastLookupzV
    ZipFile subclass to ensure implicit
    dirs exist and are resolved rapidly.
    c
s:t�t��|jW5QR�SQRXtt|���|_|jSr�)�
contextlib�suppressr)Z_FastLookup__namesrHrr�r�rIrrr��szFastLookup.namelistc
s:t�t��|jW5QR�SQRXtt|���|_|jSr�)rrr)Z_FastLookup__lookuprHrrr�rIrrr�szFastLookup._name_set)rrrrr�rrMrrrIrr�src@s�eZdZdZdZd#dd�Zedd��Zedd	��Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�ZeZed d!��Zd"S)$ru�
    A pathlib-compatible interface for zip files.

    Consider a zip file with this structure::

        .
        ├── a.txt
        └── b
            ├── c.txt
            └── d
                └── e.txt

    >>> data = io.BytesIO()
    >>> zf = ZipFile(data, 'w')
    >>> zf.writestr('a.txt', 'content of a')
    >>> zf.writestr('b/c.txt', 'content of c')
    >>> zf.writestr('b/d/e.txt', 'content of e')
    >>> zf.filename = 'abcde.zip'

    Path accepts the zipfile object itself or a filename

    >>> root = Path(zf)

    From there, several path operations are available.

    Directory iteration (including the zip file itself):

    >>> a, b = root.iterdir()
    >>> a
    Path('abcde.zip', 'a.txt')
    >>> b
    Path('abcde.zip', 'b/')

    name property:

    >>> b.name
    'b'

    join with divide operator:

    >>> c = b / 'c.txt'
    >>> c
    Path('abcde.zip', 'b/c.txt')
    >>> c.name
    'c.txt'

    Read text:

    >>> c.read_text()
    'content of c'

    existence:

    >>> c.exists()
    True
    >>> (b / 'missing.txt').exists()
    False

    Coercion to string:

    >>> str(c)
    'abcde.zip/b/c.txt'
    z>{self.__class__.__name__}({self.root.filename!r}, {self.at!r})r�cCst�|�|_||_dSr�)rrr��at)r�r�rrrrr�	sz
Path.__init__cCst�|jj|j�Sr�)�	functools�partialr�rArr�rrrrA	sz	Path.opencCst�|j�d��S�Nrv)rr�rr�r�rrrr!	sz	Path.namec
Os6|���$}tj|f|�|���W5QR�SQRXdSr�)rAr3�
TextIOWrapperr>)r��args�kwargs�strmrrr�	read_text	s
zPath.read_textc
Cs(|���}|��W5QR�SQRXdSr�r�)r�r$rrr�
read_bytes	s
zPath.read_bytescCst�|j�d��|j�d�kSr )rr�rr�)r�r�rrr�	_is_child"	szPath._is_childcCst|j|�Sr�)rr�)r�rrrr�_next%	sz
Path._nextcCs|jp|j�d�Sr )r�endswithr�rrrr�(	szPath.is_dircCs
|��Sr�)r�r�rrr�is_file+	szPath.is_filecCs|j|j��kSr�)rr�rr�rrrr�.	szPath.existscCs.|��std��t|j|j���}t|j|�S)NzCan't listdir a file)r�r|r�r(r�r��filterr')r�Zsubsrrr�iterdir1	szPath.iterdircCst�|jj|j�Sr�)rr2r�rBrr�rrr�__str__7	szPath.__str__cCs|jj|d�S)Nr�)�_Path__reprrr�rrrr�:	sz
Path.__repr__cCs t�|j|�}|�|j�|��Sr�)rr2rr(r�r)r��add�nextrrr�joinpath=	sz
Path.joinpathcCs(t�|j�d��}|r|d7}|�|�Sr )rr�rr�r()r�Z	parent_atrrr�parentC	szPath.parentN)r�)rrrrr.r�r]rAr!r%r&r'r(r�r*r�r,r-r�r1�__truediv__r2rrrrr�s*@


c
	s�ddl}d}|j|d�}|jdd�}|jdddd	d
�|jddd
ddd�|jdddddd�|jddddd
�|�|�}|jdk	r�|j}t|d��}|��}W5QRX|r�td�	|��td�n�|j
dk	r�|j
}t|d��}|��W5QRXn�|jdk	�r,|j\}}t|d��}|�
|�W5QRXn�|jdk	�r�|j�d�}	|j}
�fdd��t|	d��\}|
D]P}tj�|�}|�s�tj�tj�|��}|dtjtjfk�r�d}�|||��qfW5QRXdS) Nrz3A simple command-line interface for zipfile module.)�descriptionT)Zrequiredz-lz--list�	<zipfile>zShow listing of a zipfile)�metavar�helpz-ez	--extractr)r5z<output_dir>zExtract zipfile into target dir)�nargsr6r7z-cz--create�+)z<name>z<file>zCreate zipfile from sourcesz-tz--testzTest if a zipfile is validr^z.The following enclosed file is corrupted: {!r}zDone testingcsptj�|�r|�||t�nPtj�|�rl|r8|�||�tt�|��D]$}�|tj�||�tj�||��qFdSr�)	ryr�r�rrr�r�r�r2)rVr��zippathZnm��addToZiprrr<s	s�zmain.<locals>.addToZipr_r�)�argparse�ArgumentParserZadd_mutually_exclusive_group�add_argument�
parse_argsZtestrr�r|rr^r�r�r�Zcreate�popryr�r�r�r�r�)
r"r=r4�parser�groupr�rVZbadfiler�Zzip_name�filesr�r:rr;r�mainK	s\
�
�
�
�




rE�__main__)N)N)�rZbinasciir�importlib.utilr�r3rryrr�r�rFr}ror�rr�r��ImportErrorr�r��__all__�	Exceptionrr
rrr�r�r�rrrrrr�r�r�r�r]r\r�r[rLrMrNrOrPrQrRrar}r~r�r�r�r�Z_CD_CREATE_VERSIONZ_CD_CREATE_SYSTEMZ_CD_EXTRACT_VERSIONZ_CD_EXTRACT_SYSTEMZ
_CD_FLAG_BITSZ_CD_COMPRESS_TYPEZ_CD_TIMEZ_CD_DATEZ_CD_CRCZ_CD_COMPRESSED_SIZEZ_CD_UNCOMPRESSED_SIZEr�r�r�Z_CD_DISK_NUMBER_STARTZ_CD_INTERNAL_FILE_ATTRIBUTESZ_CD_EXTERNAL_FILE_ATTRIBUTESr�r�r�r�r�Z_FH_EXTRACT_VERSIONZ_FH_EXTRACT_SYSTEMr�Z_FH_COMPRESSION_METHODZ_FH_LAST_MOD_TIMEZ_FH_LAST_MOD_DATEZ_FH_CRCZ_FH_COMPRESSED_SIZEZ_FH_UNCOMPRESSED_SIZEr�r�rGrHrErJrKrIZ_CD64_SIGNATUREZ_CD64_DIRECTORY_RECSIZEZ_CD64_CREATE_VERSIONZ_CD64_EXTRACT_VERSIONZ_CD64_DISK_NUMBERZ_CD64_DISK_NUMBER_STARTZ_CD64_NUMBER_ENTRIES_THIS_DISKZ_CD64_NUMBER_ENTRIES_TOTALZ_CD64_DIRECTORY_SIZEZ_CD64_OFFSET_START_CENTDIRrYZStructr.r8r=r	rXr9�objectr
r�r�r�r�r�r�r�r�r�rrr4rrNrrrr�dict�fromkeysrr
rrrrErrrrr�<module>sl


�






+=q&�
&AN/2
=
sched.cpython-38.opt-2.pyc000064400000006663150335716500011242 0ustar00U

e5d*�@s�ddlZddlZddlmZddlZddlmZdgZGdd�dedd��Zdej_	d	ej
_	d
ej_	dej_	dej
_	e�ZGd
d�d�ZdS)�N)�
namedtuple)�	monotonic�	schedulerc@s8eZdZgZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�EventcCs|j|jf|j|jfkS�N��time�priority��s�o�r
�/usr/lib64/python3.8/sched.py�__eq__$�zEvent.__eq__cCs|j|jf|j|jfkSrrr
r
r
r�__lt__%rzEvent.__lt__cCs|j|jf|j|jfkSrrr
r
r
r�__le__&rzEvent.__le__cCs|j|jf|j|jfkSrrr
r
r
r�__gt__'rzEvent.__gt__cCs|j|jf|j|jfkSrrr
r
r
r�__ge__(rzEvent.__ge__N)	�__name__�
__module__�__qualname__�	__slots__rrrrrr
r
r
rr"srz(time, priority, action, argument, kwargszaNumeric type compatible with the return value of the
timefunc function passed to the constructor.zSEvents scheduled for the same time will be executed
in the order of their priority.z?Executing the event means executing
action(*argument, **kwargs)zGargument is a sequence holding the positional
arguments for the action.zDkwargs is a dictionary holding the keyword
arguments for the action.c@s^eZdZeejfdd�Zdefdd�Zdefdd�Z	dd	�Z
d
d�Zdd
d�Ze
dd��ZdS)rcCs g|_t��|_||_||_dSr)�_queue�	threading�RLock�_lock�timefunc�	delayfunc)�selfrrr
r
r�__init__9s
zscheduler.__init__r
c	Cs@|tkri}t|||||�}|j�t�|j|�W5QRX|Sr)�	_sentinelrr�heapq�heappushr)rrr	�action�argument�kwargs�eventr
r
r�enterabsAszscheduler.enterabscCs|��|}|�|||||�Sr)rr()r�delayr	r$r%r&rr
r
r�enterOszscheduler.enterc	Cs.|j�|j�|�t�|j�W5QRXdSr)rr�remover"�heapify)rr'r
r
r�cancelXszscheduler.cancelc
Cs&|j�|jW5QR�SQRXdSr)rr)rr
r
r�emptycszscheduler.emptyTc	Cs�|j}|j}|j}|j}tj}|�H|s4W5QR�q�|d\}}}	}
}|�}||krZd}
nd}
||�W5QRX|
r�|s�||S|||�q|	|
|�|d�qdS)NrTF)rrrrr"�heappop)rZblocking�lock�qrr�poprr	r$r%r&Znowr)r
r
r�runhs(
z
scheduler.runc	Cs:|j�|jdd�}W5QRXtttj|gt|���Sr)rr�list�mapr"r/�len)rZeventsr
r
r�queue�szscheduler.queueN)T)rrr�_timer�sleepr r!r(r*r-r.r3�propertyr7r
r
r
rr7s	
2)rr"�collectionsrrrr8�__all__r�__doc__r	r$r%r&�objectr!rr
r
r
r�<module>ssre_parse.cpython-38.opt-1.pyc000064400000052142150335716500012127 0ustar00U

e5d&��@s�dZddlTdZdZed�Zed�Zed�Zed�Zed	�Z	ee
eh�Zee
eeeeeh�Zeed
�feed�feed�feed
�feed�feed�feed�feed�fd�Zeefeefeefeeefgfeeefgfeeefgfeeefgfeeefgfeeefgfee fd�
Z!e"e#e$e%e&e'e(e)d�Z*e'e#Be)BZ+e,e(BZ-Gdd�de.�Z/Gdd�d�Z0Gdd�d�Z1Gdd�d�Z2dd�Z3dd �Z4d!d"�Z5d#d$�Z6d3d&d'�Z7d(d)�Z8d*d+�Z9d4d-d.�Z:d/d0�Z;d1d2�Z<d,S)5zInternal support module for sre�)�*z.\[{()*+?^$|z*+?{�
0123456789Z01234567Z0123456789abcdefABCDEFZ4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZz 	

����
�
�	��\)z\a�\bz\fz\nz\rz\tz\vz\\)
z\Arz\Bz\dz\Dz\sz\Sz\wz\Wz\Z)�i�L�m�s�x�a�t�uc@seZdZdS)�VerboseN)�__name__�
__module__�__qualname__�rr�!/usr/lib64/python3.8/sre_parse.pyrGsrc@sBeZdZdd�Zedd��Zddd�Zdd	�Zd
d�Zdd
�Z	dS)�StatecCsd|_i|_dg|_d|_dS)Nr)�flags�	groupdict�groupwidths�lookbehindgroups��selfrrr�__init__LszState.__init__cCs
t|j�S�N)�lenrr rrr�groupsQszState.groupsNcCsb|j}|j�d�|jtkr$td��|dk	r^|j�|d�}|dk	rTtd|||f��||j|<|S)Nztoo many groupsz7redefinition of group name %r as group %d; was group %d)r%r�append�	MAXGROUPS�errorr�get)r!�name�gid�ogidrrr�	opengroupTs
�
zState.opengroupcCs|��|j|<dSr#)�getwidthr)r!r+�prrr�
closegroup`szState.closegroupcCs||jko|j|dk	Sr#)r%r)r!r+rrr�
checkgroupbszState.checkgroupcCs6|jdk	r2|�|�s|�d��||jkr2|�d��dS)N�cannot refer to an open groupz?cannot refer to group defined in the same lookbehind subpattern)rr1r()r!r+�sourcerrr�checklookbehindgroupes




zState.checklookbehindgroup)N)
rrrr"�propertyr%r-r0r1r4rrrrrJs

rc@s`eZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�ZdS)�
SubPatternNcCs"||_|dkrg}||_d|_dSr#)�state�data�width)r!r7r8rrrr"os
zSubPattern.__init__rcCs�d}ttf}|jD�]t\}}t|dt|�dd�|tkrlt�|D]"\}}t|ddt|�|�qFq|tkr�t�t|d�D]*\}}|r�t|dd�|�|d�q�q|t	k�r|\}}	}
td|�|	�|d�|
�r�t|dd�|
�|d�qt
||��r~d}|D]T}t
|t��rJ|�s6t�|�|d�d}n"|�s\td	dd�t|dd�d}�q|�s�t�qtd|�qdS)
NTz  �)�end��OR�ELSEF� )�tuple�listr8�print�str�IN�BRANCH�	enumerate�dump�GROUPREF_EXISTS�
isinstancer6)r!�level�nl�seqtypes�op�avrr
�	condgroup�item_yes�item_norrrrGvsH


zSubPattern.dumpcCs
t|j�Sr#)�reprr8r rrr�__repr__�szSubPattern.__repr__cCs
t|j�Sr#)r$r8r rrr�__len__�szSubPattern.__len__cCs|j|=dSr#�r8�r!�indexrrr�__delitem__�szSubPattern.__delitem__cCs&t|t�rt|j|j|�S|j|Sr#)rI�slicer6r7r8rVrrr�__getitem__�s
zSubPattern.__getitem__cCs||j|<dSr#rU�r!rW�coderrr�__setitem__�szSubPattern.__setitem__cCs|j�||�dSr#)r8�insertr[rrrr^�szSubPattern.insertcCs|j�|�dSr#)r8r&)r!r\rrrr&�szSubPattern.appendc	Cs�|jdk	r|jSd}}|jD�]�\}}|tkr|td}d}|dD]$}|��\}}t||�}t||�}qD||}||}q|tkr�|��\}}||}||}q|tkr�|d��\}}||}||}q|t	k�r|d��\}}|||d}|||d}q|t
k�r$|d}|d}q|tk�rP|jj
|\}}||}||}q|tk�r�|d��\}}|ddk	�r�|d��\}}t||�}t||�}nd}||}||}q|tkr�q�qt|td�t|t�f|_|jS)Nrr<����)r9r8rE�	MAXREPEATr.�min�max�CALL�
SUBPATTERN�_REPEATCODES�
_UNITCODES�GROUPREFr7rrH�SUCCESS)	r!�lo�hirMrNr
�j�l�hrrrr.�sZ












zSubPattern.getwidth)N)r)
rrrr"rGrSrTrXrZr]r^r&r.rrrrr6ms

(r6c@sbeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Ze	d
d��Z
dd�Zdd�Zddd�Z
dS)�	TokenizercCs@t|t�|_||_|js"t|d�}||_d|_d|_|��dS)N�latin1r)rIrC�istext�string�decoded_stringrW�next�_Tokenizer__next)r!rrrrrr"�s
zTokenizer.__init__cCs�|j}z|j|}Wntk
r0d|_YdSX|dkr�|d7}z||j|7}Wn.tk
r�td|jt|j�d�d�YnX|d|_||_dS)Nrr<zbad escape (end of pattern))rWrs�
IndexErrorrtr(rrr$)r!rW�charrrr�__next�s&��
zTokenizer.__nextcCs||jkr|��dSdS)NTF�rtru)r!rwrrr�match�s
zTokenizer.matchcCs|j}|��|Sr#ry)r!�thisrrrr)�sz
Tokenizer.getcCs8d}t|�D]&}|j}||kr"q4||7}|��q|S�Nr:)�rangertru)r!�n�charset�result�_�crrr�getwhiles
zTokenizer.getwhilecCsld}|j}|��|dkr@|s,|�d|��|�d|t|���||kr^|sh|�d|d��qh||7}q|S)Nr:zmissing zmissing %s, unterminated namer<)rtrur(r$)r!�
terminatorr*r�r�rrr�getuntils
�
zTokenizer.getuntilcCs|jt|jpd�Sr|�rWr$rtr rrr�possz
Tokenizer.poscCs|jt|jpd�Sr|r�r rrr�tellszTokenizer.tellcCs||_|��dSr#)rWrurVrrr�seek szTokenizer.seekrcCst||j|��|�Sr#)r(rrr�)r!�msg�offsetrrrr($szTokenizer.errorN)r)rrrr"rurzr)r�r�r5r�r�r�r(rrrrro�s		
roc	Cs�t�|�}|r|St�|�}|r0|dtkr0|S�zJ|dd�}|dkr�||�dt�7}t|�dkrx|�d|t|���tt	|dd�d�fWS|dkr�|j
r�||�dt�7}t|�d	kr�|�d|t|���tt	|dd�d�fWS|d
k�rN|j
�rN||�dt�7}t|�dk�r*|�d|t|���t	|dd�d�}t|�t|fWS|d
k�r�|j
�r�ddl}|�
d��s~|�d��|�dd�}zt|�|��}Wn2tk
�r�|�d|t|�td���YnXt|fWS|tk�r.||�dt�7}t	|dd�d�}|dk�r$|�d|t|���t|fWS|tk�r<t�t|�dk�rz|tk�rh|�d|t|���tt|d�fWSWntk
�r�YnX|�d|t|���dS)Nrr<r`r��incomplete escape %s�r��U��
�N�{�	missing {�}�character name�undefined character name %r�\N{}��.octal escape value %s outside of range 0-0o377�
bad escape %s)�ESCAPESr)�
CATEGORIESrDr��	HEXDIGITSr$r(�LITERAL�intrq�chr�unicodedatarzr��ord�lookup�KeyError�	OCTDIGITS�DIGITS�
ValueError�ASCIILETTERS)r3�escaper\r�r��charnamerrr�
_class_escape'sp




�



��


r�c	Csft�|�}|r|St�|�}|r$|S�z|dd�}|dkr�||�dt�7}t|�dkrl|�d|t|���tt|dd�d�fWS|dkr�|j	r�||�dt�7}t|�dkr�|�d|t|���tt|dd�d�fWS|d	k�rB|j	�rB||�d
t�7}t|�dk�r|�d|t|���t|dd�d�}t
|�t|fWS|dk�r�|j	�r�d
dl}|�d��sr|�d��|�
dd�}zt|�|��}Wn2tk
�r�|�d|t|�td���YnXt|fWS|dk�r||�dt�7}tt|dd�d
�fWS|tk�r�|jtk�r�||��7}|dtk�r�|dtk�r�|jtk�r�||��7}t|dd�d
�}|dk�r�|�d|t|���t|fWSt|dd��}||jk�r�|�|��s�|�dt|���|�||�t|fWS|�d|t|�d��t|�dk�r4|tk�r"|�d|t|���tt|d�fWSWntk
�rLYnX|�d|t|���dS)Nr<r`rr�r�r�rr�r�r�r�r�rr�r�r�r�r�r��0r�r�r2�invalid group reference %dr�)r�r)r�r�r�r$r(r�r�rqr�r�rzr�r�r�r�r�r�rtr%r1r4rhr�r�)r3r�r7r\r�r�r��grouprrr�_escapecs�




�



�
��
�

r�cCstt�|��Sr#)rA�dict�fromkeys)�itemsrrr�_uniq�sr�cCsVg}|j}|j}|��}|t||||d|o2|��|d�sqDqt|�dkrX|dSt|�}d}	|D].}
|
stq�|	dkr�|
d}	qh|
d|	krhq�qh|D]
}
|
d=q�|�|	�q`q�q`g}|D]h}
t|
�dkr��q@|
d\}}
|tkr�|�||
f�q�|tk�r"|
ddtk	�r"|�	|
�q��q@q�|�tt
|�f�|S|�td|ff�|S)Nr<�|r)r&rzr��_parser$r6r�rD�NEGATE�extendr�rE)r3r7�verbose�nestedr��itemsappend�sourcematch�start�
subpattern�prefix�item�setrMrNrrr�
_parse_sub�sN
�

r�Fc/
Cs�t|�}|j}|j}|j}t}	t}
|j}|dkr4�q*|dkr@�q*|�|rx|tkrTq"|dkrx|�}|dksv|dkr\q"q\q"|ddkr�t|||�}||�q"|t	kr�|t
|
|�f�q"|dk�r�|��d}
g}|j}|jdk�rddl}|j
d|��t|d	d
�|d�}|�}|dk�r0|�d|��|
��|d
k�rF|�rF�qbn�|ddk�r`t||�}n~|�r�|dk�r�|j|k�r�ddl}|j
d|dk�r�dn|dk�r�dn|dk�r�dnd|��dft|d	d
�t
|
|�f}|d��r<|�}|dk�r|�d|��|
��|d
k�rL|dtk�r0|dd}||�|t
|
d�f��qb|ddk�rft||�}n>|dk�r�ddl}|j
d|��dt|d	d
�t
|
|�f}|dt
k�s�|dt
k�r�d||f}|�|t|�dt|���|d}|d}||k�r*d||f}|�|t|�dt|���|t||ff�n"|dtk�rV|dd}||��qt|�}|	|�dk�r�|ddt
k�r�|�r�|t|ddf�n||d�n"|�r�|�dtdf�|t|f�q"|tk�r.|��}
|dk�rd\}}�nB|dk�rdt}}�n*|dk�r0dt}}�n|dk�r4|jdk�rX|t
|
|�f�q"dt}}d }}|jtk�r�||�7}�qj|d!��r�|jtk�r�||�7}�q�n|}|d��s�|t
|
|�f�|�|
�q"|�r�t|�}|tk�r�td"��|�rBt|�}|tk�rtd"��||k�rB|�d#|��|
��ntd$|f��|�rV|d%d�}nd}|�rr|ddtk�r�|�d&|��|
t|���|ddtk�r�|�d'|��|
t|���|ddt k�r�|dd\}}}}|dk�r�|�s�|�s�|}|d��rt!|||ff|d%<nt"|||ff|d%<q"|d(k�rF|t#df�q"|d)k�r�|��d} d*}d}!d}d}|d��r|�}|dk�r�|�d+��|d,k�r�|d-��r�|�$d.d/�}!|!�%��s�d0|!}|�|t|!�d��n�|d1��r�|�$d2d/�}!|!�%��sd0|!}|�|t|!�d��|j&�|!�}"|"dk�rFd3|!}|�|t|!�d��|�'|"��sf|�d4t|!�d��|�(|"|�|t)|"f�q"n2|�}|dk�r�|�d+��|�d5|t|�d���nd|d6k�r�d}�nR|dk�r|jdk�r�|�d7|��| ��|�d2k�r�q"�q�q"�n|d8k�r�d}#|d-k�r||�}|dk�r>|�d+��|d9k�r`|�d:|t|�d��d%}#|j*}$|$dk�r||j+|_*t,||||d�}|#dk�r�|$dk�r�d|_*|d2��s�|�d;|��| ��|d1k�r�|t-|#|ff�q"|t.|#|ff�q"�n$|d)k�
rj|�$d2d/�}%|%�%��	rL|j&�|%�}&|&dk�	r�d3|%}|�|t|%�d��n�zt|%�}&|&dk�	rdt/�Wn4t/k
�	r�d0|%}|�|t|%�d�d�YnX|&�	s�|�d<t|%�d��|&t0k�	r�d=|&}|�|t|%�d��|�(|&|�t1||||d�}'|�d>��
r0t1||||d�}(|jd>k�
r4|�d?��nd}(|�d2��
sT|�d;|��| ��|t2|&|'|(ff�q"n�|t3k�
s~|dk�rt4|||�})|)dk�
r�|�
r�|�
r�ddl}|j
d@|j5ddA�t|j5�dAk�
r�dBnd ft6|d	d
�|j7t8@r"|s"t9�q"|)\}}d}n|�dC|t|�d��|dk	�rrz|�:|!�}Wn<tk
�rp}*z|�|*j;t|!�d�d�W5d}*~*XYnX|�s�|t8@�o�|t8@}+t,|||+|d�}|�d2��s�|�d;|��| ��|dk	�r�|�<||�|t ||||ff�q"|dk�r|tt=f�q"|dDk�r|tt>f�q"tdE|f��q"t?t|��ddd%�D]N},||,\}-}.|-t k�r@|.\}}}}|dk�r@|�s@|�s@|||,|,d�<�q@|S)FNz|)�#rrr�[r<z"Possible nested set at position %dr�)�
stacklevel�^zunterminated character set�]z-&~|zPossible set %s at position %d�-�
difference�&�intersection�~zsymmetric difference�unionz&Possible set difference at position %dr`zbad character range %s-%s�?)rr<r�+r�r�r:�,z"the repetition number is too largez"min repeat greater than max repeatzunsupported quantifier %rr_znothing to repeatzmultiple repeat�.�(Tzunexpected end of pattern�P�<�>�
group name�bad character in group name %r�=�)�unknown group name %rr2zunknown extension ?P�:zmissing ), unterminated commentz=!<z=!zunknown extension ?<z"missing ), unterminated subpatternzbad group numberr�r�z/conditional backref with more than two branchesz-Flags not at the start of the expression %r%s�z (truncated)zunknown extension ?�$z unsupported special character %r)@r6r&r)rzr$r�rt�
WHITESPACEr��
SPECIAL_CHARSr�r��warnings�warn�
FutureWarningr(r�rD�RANGEr��NOT_LITERALr^r��REPEAT_CHARSrar�r�r��
OverflowError�AssertionError�ATrfre�
MIN_REPEAT�
MAX_REPEAT�ANYr��isidentifierrr1r4rhrr%r��ASSERT�
ASSERT_NOTr�r'r�rH�FLAGS�_parse_flagsrr�DeprecationWarningr�SRE_FLAG_VERBOSErr-r�r0�AT_BEGINNING�AT_ENDr})/r3r7r�r��firstr��subpatternappend�	sourcegetr��_len�_ordr{r\�herer��	setappendr��negate�code1�that�code2r�rjrkrbrcrwr�r��	add_flags�	del_flagsr/r�r*r+�dirr�condnamerOrPrQr�err�sub_verboser
rMrNrrrr��s|


�

�
��	


�


��
 












���












�



�


�






�




�





�

�
��

�
*�
�



r�cCs�|j}d}d}|dkr�t|}|jr<|dkrRd}|�|��n|dkrRd}|�|��||O}|t@r||t@|kr|d}|�|��|�}|dkr�|�d��|d	kr�q�|tkr|��r�d
nd}|�|t|���q|dkr�|j|O_dS|t@r�|�dd
��|dk�r�|�}|dk�r|�d��|tk�rF|���r2d
nd}|�|t|���t|}|t@�rfd}|�|��||O}|�}|dk�r�|�d��|dk�r��q�|tk�rF|���r�d
nd}|�|t|����qF|t@�r�|�dd
��||@�r�|�dd
��||fS)Nrr�rz8bad inline flags: cannot use 'L' flag with a str patternrz:bad inline flags: cannot use 'u' flag with a bytes patternz9bad inline flags: flags 'a', 'u' and 'L' are incompatiblezmissing -, : or )z)-:zunknown flagr�z,bad inline flags: cannot turn on global flagr<zmissing flagz8bad inline flags: cannot turn off flags 'a', 'u' and 'L'z	missing :r�z-bad inline flags: cannot turn off global flagz(bad inline flags: flag turned on and off)	r)r�rqr(�
TYPE_FLAGS�isalphar$r�GLOBAL_FLAGS)r3r7rwr�rr�flagr�rrrr�]sl














r�cCsjt|t�r>|t@rtd��|t@s,|tO}qf|t@rftd��n(|t@rNtd��|t@rf|t@rftd��|S)Nz)cannot use LOCALE flag with a str patternz(ASCII and UNICODE flags are incompatiblez,cannot use UNICODE flag with a bytes patternz'ASCII and LOCALE flags are incompatible)rIrC�SRE_FLAG_LOCALEr��SRE_FLAG_ASCII�SRE_FLAG_UNICODE)�srcrrrr�	fix_flags�s


rNcCs�t|�}|dkrt�}||_||_zt|||t@d�}WnBtk
rzt�}|tB|_||_|�d�t||dd�}YnXt||j	j�|j	_|j
dk	r�|�d��|t@r�|�
�|S)NrTzunbalanced parenthesis)rorrrCr�r�rr�rr7rtr(�SRE_FLAG_DEBUGrG)rCrr7r3r/rrr�parse�s&



rcs�t|���j}g�g�g��j}�����fdd�}�j}|�}|dkrL�q�|ddk�r�|d}|dk�rJd}��d�s���d	����d
d�}|��r�z||}	Wn tk
r�t	d|��YnXnlzt
|�}	|	dkr�t�Wn0tk
�r��d
|t|�d�d�YnX|	t
k�r4��d|	t|�d��||	t|�d��q�|dk�r��jtk�r�||�7}�jtk�r�||�7}|tt
|dd�d�d@���q�|tk�rZd}
�jtk�r4||�7}|tk�r4|dtk�r4�jtk�r4||�7}d}
t
|dd�d�}|dk�r(��d|t|���|t|��|
�s�|t
|dd��t|�d�nRztt|d�}Wn4tk
�r�|tk�r���d|t|���YnX||�q:||�q:��rΈ�d����t|t��s�dd��D����fS)NcsX|�jkr��d||���r8��d�����dd�=��t��|f���d�dS)Nr�r:)r%r(r&�joinr$)rWr��r%�literal�literalsrr7rr�addgroup�s

z parse_template.<locals>.addgrouprrr<�gr:r�z	missing <r�r�r�r�r�r�r�r�Fr`Tr�r�cSs"g|]}|dkrdn|�d��qS)Nzlatin-1)�encode)�.0rrrr�
<listcomp>sz"parse_template.<locals>.<listcomp>)ror)r&�
groupindexrzr(r�r�r�rvr�r�r$r'rtr�r�r�r�r�rrIrC)r3r7�sget�lappendrrr{r�r*rW�isoctalrrr�parse_template�s�




��


�


"

�

�� 


rcCsv|j}|jdd�}|\}}|dd�}z"|D]\}}||�p@|||<q.Wn tk
rjtd|��YnX|�|�S)Nrr�)r�rrrvr(r)�templaterzr�emptyr%rrWr�rrr�expand_templatesr")F)rN)=�__doc__�
sre_constantsr�r��	frozensetr�r�r�r�r�r�r�rfr�r�rDr�r��CATEGORYrgr�r�r�ZAT_BEGINNING_STRINGZAT_BOUNDARYZAT_NON_BOUNDARYZCATEGORY_DIGITZCATEGORY_NOT_DIGITZCATEGORY_SPACEZCATEGORY_NOT_SPACEZ
CATEGORY_WORDZCATEGORY_NOT_WORDZ
AT_END_STRINGr��SRE_FLAG_IGNORECASEr�SRE_FLAG_MULTILINE�SRE_FLAG_DOTALLr�r�SRE_FLAG_TEMPLATEr
r�rrr	�	Exceptionrrr6ror�r�r�r�r�r�rrrr"rrrr�<module>sr







���
#rH<M:
r<
 Ubz2.cpython-38.opt-2.pyc000064400000014365150335716500010647 0ustar00U

e5d1�@s�ddddddgZdZddlmZdd	lZdd	lZdd	lZdd	lZdd
l	m
Z
ddlmZm
Z
dZdZd
Ze�ZGdd�dej�Zddd�Zddd�Zdd�Zd	S)�BZ2File�
BZ2Compressor�BZ2Decompressor�open�compress�
decompressz%Nadeem Vawda <nadeem.vawda@gmail.com>�)rN)�RLock)rr��c@s�eZdZdedfdd�Zdd�Zedd��Zd	d
�Zdd�Z	d
d�Z
dd�Zd(dd�Zd)dd�Z
d*dd�Zdd�Zd+dd�Zd,dd�Zdd �Zd!d"�Zejfd#d$�Zd%d&�Zd'S)-r�r�	cCsTt�|_d|_d|_t|_|tk	r2tjdt	dd�d|krFdksPnt
d��|dkrbd	}t}nb|d
kr~d}t}t
|�|_nF|dkr�d
}t}t
|�|_n*|dkr�d}t}t
|�|_nt
d|f��t|tttjf�r�t||�|_d|_||_n.t|d��st|d��r||_||_ntd��|jtk�rJtj|jttd�}t�|�|_nd|_dS)NFzGUse of 'buffering' argument is deprecated and ignored since Python 3.0.�)�
stacklevelr	rz%compresslevel must be between 1 and 9)�r�rbr)�w�wbr)�x�xbr)�a�abr�Invalid mode: %rT�read�writez6filename must be a str, bytes, file or PathLike object)Ztrailing_errorr)r�_lock�_fp�_closefp�_MODE_CLOSED�_mode�	_sentinel�warnings�warn�DeprecationWarning�
ValueError�
_MODE_READ�_MODE_WRITEr�_compressor�
isinstance�str�bytes�os�PathLike�
_builtin_open�hasattr�	TypeError�_compressionZDecompressReaderr�OSError�io�BufferedReader�_buffer�_pos)�self�filename�mode�	buffering�
compresslevelZ	mode_code�raw�r;�/usr/lib64/python3.8/bz2.py�__init__)sT��zBZ2File.__init__cCs�|j��|jtkr W5QR�dSz<|jtkr8|j��n"|jtkrZ|j�	|j
���d|_
W5z|jrp|j��W5d|_d|_t|_d|_XXW5QRXdS)NF)rrrrrr3�closer$r%rr&�flush�r5r;r;r<r>ps 



z
BZ2File.closecCs
|jtkS�N)rrr@r;r;r<�closed�szBZ2File.closedcCs|��|j��SrA)�_check_not_closedr�filenor@r;r;r<rD�szBZ2File.filenocCs|��o|j��SrA)�readabler3�seekabler@r;r;r<rF�szBZ2File.seekablecCs|��|jtkSrA)rCrr$r@r;r;r<rE�szBZ2File.readablecCs|��|jtkSrA)rCrr%r@r;r;r<�writable�szBZ2File.writablerc
Cs2|j�"|��|j�|�W5QR�SQRXdSrA)r�_check_can_readr3�peek)r5�nr;r;r<rI�szBZ2File.peek���c
Cs2|j�"|��|j�|�W5QR�SQRXdSrA)rrHr3r�r5�sizer;r;r<r�szBZ2File.readc
Cs@|j�0|��|dkrtj}|j�|�W5QR�SQRXdS)Nr)rrHr1�DEFAULT_BUFFER_SIZEr3�read1rLr;r;r<rO�s
z
BZ2File.read1c
Cs2|j�"|��|j�|�W5QR�SQRXdSrA)rrHr3�readinto)r5�br;r;r<rP�szBZ2File.readintoc
CsVt|t�s$t|d�std��|��}|j�"|��|j�|�W5QR�SQRXdS�N�	__index__zInteger argument expected)	r'�intr-r.rSrrHr3�readlinerLr;r;r<rU�s

zBZ2File.readlinec
CsVt|t�s$t|d�std��|��}|j�"|��|j�|�W5QR�SQRXdSrR)	r'rTr-r.rSrrHr3�	readlinesrLr;r;r<rV�s

zBZ2File.readlinesc
CsX|j�H|��|j�|�}|j�|�|jt|�7_t|�W5QR�SQRXdSrA)rZ_check_can_writer&rrrr4�len)r5�dataZ
compressedr;r;r<r�sz
BZ2File.writec
Cs,|j�tj�||�W5QR�SQRXdSrA)rr/�
BaseStream�
writelines)r5�seqr;r;r<rZ�szBZ2File.writelinesc
Cs4|j�$|��|j�||�W5QR�SQRXdSrA)rZ_check_can_seekr3�seek)r5�offset�whencer;r;r<r\szBZ2File.seekc
CsL|j�<|��|jtkr0|j��W5QR�S|jW5QR�SQRXdSrA)rrCrr$r3�tellr4r@r;r;r<r_s

zBZ2File.tellN)r)rK)rK)rK)rK)�__name__�
__module__�__qualname__rr=r>�propertyrBrDrFrErGrIrrOrPrUrVrrZr1�SEEK_SETr\r_r;r;r;r<rs$G





	

rrcCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|�dd�}t|||d�}d|kr�t�||||�S|SdS)	N�trQrz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary moder)r9)r#�replacerr1�
TextIOWrapper)r6r7r9�encoding�errors�newlineZbz_modeZbinary_filer;r;r<r!scCst|�}|�|�|��SrA)rrr?)rXr9�compr;r;r<rJscCshg}|r^t�}z|�|�}Wn tk
r<|r6Yq^n�YnX|�|�|jsVtd��|j}qd�|�S)NzACompressed data ended before the end-of-stream marker was reached�)rrr0�append�eofr#Zunused_data�join)rXZresultsZdecomp�resr;r;r<rUs
)rrNNN)r)�__all__�
__author__�builtinsrr,r1r*r r/Z	threadingrZ_bz2rrrr$r%�objectrrYrrrr;r;r;r<�<module>s4��
)
sysconfig.cpython-38.pyc000064400000036751150335716500011221 0ustar00U

��.e@a�
@sdZddlZddlZddlmZmZdddddd	d
ddd
dgZdhZddddddddd�ddddddddd�ddddddd dd�d!d!d"d"d#d$d%d&�d'd'd(d)d*d+d%d&�d,d,d-d-d.d+d%d&�d/�Zd&Z	ej
��dZd0ej
dd1�Zd2ej
dd1�Zej�ej�Zej�ej�Zej�ej�Zej�ej�ZdadZd3d4�Zej�rVej�eej��Znee� ��Zej!d5k�r�e�"��#d6��r�eej�$eee��Zd7ej%k�r�eej%d7�Zd8d9�Z&e'ed:d�Z(ej!d5k�r�d;d<�Z)e)e�Ze)e(�Z(djd>d?�Z*e*d@�Z+e+�r dAD]Z,dBee,dC<dDee,dE<�qdFdG�Z-dHdI�Z.dJdK�Z/dLdM�Z0dNdO�Z1dkdPdQ�Z2dRd�Z3dSdT�Z4dUdV�Z5dWdX�Z6dYdZ�Z7dld[d�Z8d\d�Z9d]d
�Z:d^d	�Z;e0�dd@fd_d
�Z<e0�dd@fd`d�Z=dad�Z>dbd�Z?dcd�Z@ddd�ZAdedf�ZBdgdh�ZCeDdik�reC�dS)mz-Access to Python's configuration information.�N)�pardir�realpath�get_config_h_filename�get_config_var�get_config_vars�get_makefile_filename�get_path�get_path_names�	get_paths�get_platform�get_python_version�get_scheme_names�parse_config_hZMACOSX_DEPLOYMENT_TARGETz/{installed_base}/lib64/python{py_version_short}z){platbase}/lib64/python{py_version_short}z1{base}/lib/python{py_version_short}/site-packagesz7{platbase}/lib64/python{py_version_short}/site-packagesz;{installed_base}/include/python{py_version_short}{abiflags}z?{installed_platbase}/include/python{py_version_short}{abiflags}z
{base}/binz{base})�stdlib�
platstdlib�purelib�platlib�include�platinclude�scripts�dataz{installed_base}/lib/pythonz{base}/lib/pythonz{installed_base}/include/pythonz{installed_base}/Libz
{base}/Libz{base}/Lib/site-packagesz{installed_base}/Includez{base}/Scriptsz#{userbase}/Python{py_version_nodot}z1{userbase}/Python{py_version_nodot}/site-packagesz+{userbase}/Python{py_version_nodot}/Includez+{userbase}/Python{py_version_nodot}/Scriptsz
{userbase})rrrrrrrz){userbase}/lib64/python{py_version_short}z5{userbase}/lib/python{py_version_short}/site-packagesz7{userbase}/lib64/python{py_version_short}/site-packagesz+{userbase}/include/python{py_version_short}z{userbase}/binz{userbase}/lib/pythonz#{userbase}/lib/python/site-packagesz{userbase}/include)�posix_prefix�
posix_home�ntZnt_userZ
posix_userZosx_framework_user�%d.%d�z%d%dcCs(z
t|�WStk
r"|YSXdS�N)r�OSError)�path�r�!/usr/lib64/python3.8/sysconfig.py�_safe_realpathis
r!r)z\pcbuild\win32z\pcbuild\amd64Z_PYTHON_PROJECT_BASEcCs,dD]"}tj�tj�|d|��rdSqdS)N)ZSetupzSetup.localZModulesTF)�osr�isfile�join)�d�fnrrr �_is_python_source_dir~sr'�_homecCs0|r,tj�|��tj�tj�td���r,tS|S)NZPCbuild)r"r�normcase�
startswithr$�_PREFIX)r%rrr �_fix_pcbuild�s
�r,FcCs|rtrtt�Stt�Sr)�	_sys_homer'�
_PROJECT_BASE)Z
check_homerrr �is_python_build�sr/T)rrz{srcdir}/Includerz{projectbase}/.rc
Csnz|jf|�WStk
rhz|jftj�WYStk
rb}ztd|�d�W5d}~XYnXYnXdS)Nz{%s})�format�KeyErrorr"�environ�AttributeError)�sZ
local_vars�varrrr �_subst_vars�sr6cCs0|��}|��D]\}}||kr"q|||<qdSr)�keys�items)Ztarget_dictZ
other_dictZtarget_keys�key�valuerrr �_extend_dict�s
r;cCsbi}|dkri}t|t��t|��D]4\}}tjdkrFtj�|�}tj�t	||��||<q(|S)N)�posixr)
r;r�_INSTALL_SCHEMESr8r"�namer�
expanduser�normpathr6)�scheme�vars�resr9r:rrr �_expand_vars�s
rDcCstjdkrdStjS)Nr<r)r"r>rrrr �_get_default_scheme�s
rEcCsztj�dd�}|r|Sdd�}tjdkrBtj�d�p6d}||d�Stjdkrptjrp|dd	tjd
tjdd��S|dd�S)
N�PYTHONUSERBASEcWstj�tjj|��Sr)r"rr?r$)�argsrrr �joinuser�sz_getuserbase.<locals>.joinuserr�APPDATA�~�Python�darwin�Libraryrrz.local)r"r2�getr>�sys�platform�
_framework�version_info)�env_baserH�baserrr �_getuserbase�s


�rUc	Cs`ddl}|�d�}|�d�}|�d�}|dkr2i}i}i}t|dd��}|��}	W5QRX|	D]�}
|
�d�s^|
��d	krzq^|�|
�}|r^|�d
d�\}}
|
��}
|
�dd	�}d
|kr�|
||<q^z|t	kr�t
�t|
�}
Wn$t
k
r�|
�dd
�||<Yq^X|
||<q^t|�
��}d}t|�dk�r&t|�D�]�}||}|�|�}|�|�}|�rv|�rv|��|��k�rp|n|}n|�r�|n|}|dk	�r|�d
�}d}||k�r�t||�}n�||k�r�d}nx|tjk�r�tj|}n`||k�r0|�d��r
|dd�|k�r
d	}n$d||k�rd}nt|d|�}nd	||<}|�r||��d�}|d|���||}d
|k�r~|||<n�z|t	k�r�t
�t|�}Wn"t
k
�r�|��||<Yn
X|||<|�|�|�d��r|dd�|k�r|dd�}||k�r|||<n|||<|�|��q,�q|��D]"\}}
t|
t��r.|
��||<�q.|�|�|S)z�Parse a Makefile-style file.

    A dictionary containing name/value pairs is returned.  If an
    optional dictionary is passed in as the second argument, it is
    used instead of a new dictionary.
    rNz"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)z\$\(([A-Za-z][A-Za-z0-9_]*)\)z\${([A-Za-z][A-Za-z0-9_]*)}�surrogateescape)�errors�#��rz$$�$)ZCFLAGSZLDFLAGSZCPPFLAGSTFZPY_�)�re�compile�open�	readlinesr*�strip�match�group�replace�_ALWAYS_STR�
ValueError�int�listr7�len�tuple�search�start�strr"r2�end�remover8�
isinstance�update)�filenamerBr]Z_variable_rxZ_findvar1_rxZ_findvar2_rxZdoneZnotdone�f�lines�line�m�n�vZtmpvZ	variablesZrenamed_variablesr>r:Zm1Zm2�found�itemZafter�krrr �_parse_makefile�s�	












�



�


r|cCsdtrtj�tptd�Sttd�r0dttj	f}nd}ttj
d�rP|dtj
j7}tj�td�|d�S)z Return the path of the Makefile.ZMakefile�abiflagszconfig-%s%sZconfig�
_multiarchz-%sr)
�
_PYTHON_BUILDr"rr$r-r.�hasattrrO�_PY_VERSION_SHORTr}�implementationr~r)Zconfig_dir_namerrr rWs
c
Cs(tj�ddjtjtjttjdd�d��S)NZ_PYTHON_SYSCONFIGDATA_NAMEz+_sysconfigdata_{abi}_{platform}_{multiarch}r~rY)ZabirPZ	multiarch)	r"r2rNr0rOr}rP�getattrr�rrrr �_get_sysconfigdata_nameds��r�c
Cs�ddl}i}t�}zt||�WnJtk
rj}z,d|}t|d�rR|d|j}t|��W5d}~XYnXt�}z"t|��}t||�W5QRXWnJtk
r�}z,d|}t|d�r�|d|j}t|��W5d}~XYnXt	r�|d|d<t
�}dtjk�r$ddl
}|�|�}	||	_|	tj|<d	t�tf}
ttd
��rF|
d7}
tj|
dd
�tj�|
|d�}t|ddd��(}|�d�|�d�|j||d�W5QRXtdddd��}|�|
�W5QRXdS)z;Generate the Python module containing build-time variables.rNz.invalid Python installation: unable to open %s�strerrorz (%s)ZLDSHAREDZ	BLDSHAREDrLzbuild/lib.%s-%sZgettotalrefcountz-pydebugT)�exist_okz.py�w�utf8)�encodingzB# system configuration generated and used by the sysconfig module
zbuild_time_vars = )�streamzpybuilddir.txt)�pprintrr|rr�r�rr_rrr�rOrP�types�
ModuleType�build_time_vars�modulesrr�r"�makedirsrr$�write)r�rBZmakefile�e�msgZconfig_hrsr>r��moduleZ
pybuilddirZdestfilerrr �_generate_posix_varsmsL







r�cCs0t�}t|t�t�dgd�}|j}|�|�dS)z7Initialize the module as appropriate for POSIX systems.r�rN)r��
__import__�globals�localsr�rq)rBr>Z_tempr�rrr �_init_posix�sr�cCsfddl}td�|d<td�|d<td�|d<|��d|d	<d
|d<t|d<tj�ttj	��|d
<dS)z+Initialize the module as appropriate for NTrNrZLIBDESTrZ
BINLIBDESTrZ	INCLUDEPY�
EXT_SUFFIXz.exeZEXEZVERSIONZBINDIR)
�_impr�extension_suffixes�_PY_VERSION_SHORT_NO_DOTr"r�dirnamer!rO�
executable)rBr�rrr �_init_non_posix�sr�c	Cs�|dkri}ddl}|�d�}|�d�}|��}|s6q�|�|�}|r�|�dd�\}}z|tkrbt�t|�}Wntk
r�YnX|||<q(|�|�}|r(d||�d�<q(|S)z�Parse a config.h-style file.

    A dictionary containing name/value pairs is returned.  If an
    optional dictionary is passed in as the second argument, it is
    used instead of a new dictionary.
    Nrz"#define ([A-Z][A-Za-z0-9_]+) (.*)
z&/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/
rZr)r]r^�readlinerbrcrerfrg)	�fprBr]Z	define_rxZundef_rxrurvrwrxrrr r�s,




cCsBtr,tjdkr"tj�tptd�}q4tp(t}ntd�}tj�|d�S)zReturn the path of pyconfig.h.rZPCrz
pyconfig-64.h)rr"r>rr$r-r.r)Zinc_dirrrr r�s

cCsttt��S)z,Return a tuple containing the schemes names.)rj�sortedr=rrrr r
�scCstS)z*Return a tuple containing the paths names.)�_SCHEME_KEYSrrrr r	�scCs|rt||�St|SdS)z�Return a mapping containing an install scheme.

    ``scheme`` is the install scheme name. If not provided, it will
    return the default scheme for the current platform.
    N)rDr=)rArB�expandrrr r
�s
cCst|||�|S)z[Return a path corresponding to the scheme.

    ``scheme`` is the install scheme name.
    )r
)r>rArBr�rrr r	scGsxtdk�rFiattd<ttd<ttd<ttd<ttd<ttd<ttd<ttd	<ttd
<ttd<zt	j
td<Wntk
r�d
td<YnXtj
dkr�tt�tj
dkr�tt�t�d�}|dk	r�|td<t�td<t�dt�}tj
dk�rt�rtj�t��}tj�||�}ntj�t��}t|�td<t	jdk�rFddl}|�t�|�rpg}|D]}|�t�|���qT|StSdS)anWith no arguments, return a dictionary of all configuration
    variables relevant for the current platform.

    On Unix, this means every variable defined in Python's installed Makefile;
    On Windows it's a much smaller set.

    With arguments, return a list of values that result from looking up
    each argument in the configuration variable dictionary.
    N�prefix�exec_prefixZ
py_versionZpy_version_shortZpy_version_nodotZinstalled_baserTZinstalled_platbaseZplatbaseZprojectbaser}rYrr<r��SO�userbase�srcdirrLr)�_CONFIG_VARSr+�_EXEC_PREFIX�_PY_VERSIONr�r��_BASE_PREFIX�_BASE_EXEC_PREFIXr.rOr}r3r"r>r�r�rNrUrrr�rr$r!rP�_osx_supportZcustomize_config_vars�append)rGr�r�rTr�Zvalsr>rrr rsP





cCs*|dkrddl}|�dtd�t��|�S)z�Return the value of a single variable using the dictionary returned by
    'get_config_vars()'.

    Equivalent to get_config_vars().get(name)
    r�rNz SO is deprecated, use EXT_SUFFIXr)�warnings�warn�DeprecationWarningrrN)r>r�rrr r^sc
Cs�tjdkrFdtj��krdSdtj��kr.dSdtj��kr@dStjStjdksZttd	�s`tjSd
tjkrttjd
St��\}}}}}|���	dd�}|�	d
d�}|�	dd�}|dd�dkr�d||fS|dd�dk�r,|ddk�r�d}dt
|d�d|dd�f}ddd�}|d|tj7}n�|dd�dk�rLd |||fS|dd!�d"k�r�d"}ddl}|�
d#�}|�|�}|�r�|��}n2|dd!�d$k�r�ddl}	|	�t�|||�\}}}d%|||fS)&a�Return a string that identifies the current platform.

    This is used mainly to distinguish platform-specific build directories and
    platform-specific built distributions.  Typically includes the OS name and
    version and the architecture (as supplied by 'os.uname()'), although the
    exact information included depends on the OS; on Linux, the kernel version
    isn't particularly important.

    Examples of returned values:
       linux-i586
       linux-alpha (?)
       solaris-2.6-sun4u

    Windows will return one of:
       win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)
       win32 (all others - specifically, sys.platform is returned)

    For other non-POSIX platforms, currently just returns 'sys.platform'.

    rZamd64z	win-amd64z(arm)z	win-arm32z(arm64)z	win-arm64r<�unameZ_PYTHON_HOST_PLATFORM�/rY� �_�-N�Zlinuxz%s-%sZsunosr�5Zsolarisz%d.%sr\rZ32bitZ64bit)i���l����z.%sZaixz%s-%s.%s��cygwinz[\d.]+rLz%s-%s-%s)r"r>rO�version�lowerrPr�r2r�rdrg�maxsizer]r^rbrcr�Zget_platform_osxr)
ZosnameZhost�releaser��machineZbitnessr]Zrel_rervr�rrr rjsT


 



�
cCstSr)r�rrrr r�scCsFtt|����D]0\}\}}|dkr0td|�td||f�qdS)Nrz%s: z
	%s = "%s")�	enumerater�r8�print)�titler�indexr9r:rrr �_print_dict�sr�cCsfdtjkrt�dStdt��tdt��tdt��t�tdt��t�tdt	��dS)z*Display all information sysconfig detains.z--generate-posix-varsNzPlatform: "%s"zPython version: "%s"z!Current installation scheme: "%s"ZPathsZ	Variables)
rO�argvr�r�rrrEr�r
rrrrr �_main�s
r��__main__)F)N)N)E�__doc__r"rOZos.pathrr�__all__rer=r�r��splitr�rRr�r�rr@r�r+�base_prefixr�r�r��base_exec_prefixr�r�Z
_USER_BASEr!r�r�r.�getcwdr>r��endswithr$r2r'r�r-r,r/rrAr6r;rDrErUr|rr�r�r�r�rrr
r	r
rrrrrr�r��__name__rrrr �<module>s����
���
�
��?�
	
	

	?
"MP
binhex.cpython-38.opt-2.pyc000064400000026523150335716500011426 0ustar00U

e5d�6�@s�ddlZddlZddlZddlZdddgZGdd�de�ZdZdZdZ	dZ
d	ZGd
d�d�Zdd
�Z
Gdd�d�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�ZGdd�d�ZGdd�d�ZGdd�d�Zdd�ZdS)�N�binhex�hexbin�Errorc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.8/binhex.pyrs�i��@��c@seZdZdd�ZdS)�FInfocCsd|_d|_d|_dS)Nz????r)�Type�Creator�Flags��selfrrr	�__init__0szFInfo.__init__N)rrrrrrrr	r
/sr
c	Cstt�}t�|d��2}|�d�}d|kr,d|_|�dd�|��}W5QRXtj�	|�\}}|�
ddd�}|||dfS)	N�rbirZTEXT��:�-r
)r
�io�open�readr�seek�tell�os�path�split�replace)�name�finfo�fp�dataZdsize�dir�filerrr	�getfileinfo5s
r'c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�openrsrccGsdS�Nr�r�argsrrr	rCszopenrsrc.__init__cGsdS�N�rr*rrr	rFsz
openrsrc.readcGsdSr)rr*rrr	�writeIszopenrsrc.writecCsdSr)rrrrr	�closeLszopenrsrc.closeN)rrrrrr.r/rrrr	r(Bsr(c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_HqxcoderenginecCs ||_d|_d|_td|_dS)Nr-r
)�ofpr$�hqxdata�LINELEN�linelen�rr1rrr	rRsz_Hqxcoderengine.__init__cCsh|j||_t|j�}|dd}|jd|�}|j|d�|_|sHdS|jt�|�|_|�d�dS)N�r)r$�lenr2�binascii�b2a_hqx�_flush)rr$ZdatalenZtodorrr	r.Xs
z_Hqxcoderengine.writecCsrd}|t|j�|jkrH||j}|j�|j||�d�t|_|}q|j|d�|_|rn|j�|jd�dS)Nr�
s:
)r7r2r4r1r.r3)rZforce�firstZlastrrr	r:cs
z_Hqxcoderengine._flushcCs6|jr|jt�|j�|_|�d�|j��|`dS)Nr
)r$r2r8r9r:r1r/rrrr	r/ns


z_Hqxcoderengine.closeN)rrrrr.r:r/rrrr	r0Osr0c@s$eZdZdd�Zdd�Zdd�ZdS)�_RlecoderenginecCs||_d|_dSr,)r1r$r5rrr	rxsz_Rlecoderengine.__init__cCs@|j||_t|j�tkrdSt�|j�}|j�|�d|_dSr,)r$r7�REASONABLY_LARGEr8�rlecode_hqxr1r.)rr$�rledatarrr	r.|sz_Rlecoderengine.writecCs0|jrt�|j�}|j�|�|j��|`dSr))r$r8r?r1r.r/)rr@rrr	r/�s

z_Rlecoderengine.closeN)rrrrr.r/rrrr	r=usr=c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�BinHexc
Cs�|\}}}}d}t|t�r.|}t�|d�}d}zR|�d�t|�}	t|	�|_d|_|dkr`t	�}||_
||_|�||�t
|_Wn|r�|���YnXdS)NF�wbTs0(This file must be converted with BinHex 4.0)

:r)�
isinstance�strrrr.r0r=r1�crcr
�dlen�rlen�
_writeinfo�_DID_HEADER�stater/)
rZname_finfo_dlen_rlenr1r!r"rFrGZclose_on_errorZofnameZhqxerrrr	r�s*



zBinHex.__init__cCs�t|�}|dkrtd��t|g�|�d�d}|j|j}}t|t�rR|�d�}t|t�rf|�d�}||}t�	d|j
�}t�	d|j|j�}	||||	}
|�
|
�|��dS)N�?zFilename too longzlatin-1��>hz>ii)r7r�bytes�encoderrrCrD�struct�packrrFrG�_write�	_writecrc)rr!r"�nl�d�tpZcrZd2Zd3Zd4�inforrr	rH�s




zBinHex._writeinfocCs t�||j�|_|j�|�dSr))r8�crc_hqxrEr1r.�rr$rrr	rR�sz
BinHex._writecCs4|jdkrd}nd}|j�t�||j��d|_dS)NrrMz>H)rEr1r.rPrQ)rZfmtrrr	rS�s

zBinHex._writecrccCs0|jtkrtd��|jt|�|_|�|�dS)NzWriting data at the wrong time)rJrIrrFr7rRrYrrr	r.�s
zBinHex.writecCs,|jdkrtd|jf��|��t|_dS)NrzIncorrect data size, diff=%r)rFrrGrS�	_DID_DATArJrrrr	�
close_data�s
zBinHex.close_datacCsB|jtkr|��|jtkr$td��|jt|�|_|�|�dS)Nz'Writing resource data at the wrong time)rJrZr[rrGr7rRrYrrr	�
write_rsrc�s

zBinHex.write_rsrccCsx|jdkrdSzJ|jtkr"|��|jtkr4td��|jdkrNtd|jf��|��W5d|_|j}|`|��XdS)NzClose at the wrong timerz$Incorrect resource-datasize, diff=%r)rJr1r/rZr[rrGrSr5rrr	r/�s



zBinHex.closeN)rrrrrHrRrSr.r[r\r/rrrr	rA�s
rAc	Cs�t|�}t||�}t�|d��*}|�d�}|s0q<|�|�q |��W5QRXt|d�}|�d�}|shqt|�|�qX|�	�|�	�dS)Nr��)
r'rArrrr.r[r(r\r/)�inp�outr"r1�ifprUrrr	r�s



c@s$eZdZdd�Zdd�Zdd�ZdS)�_HqxdecoderenginecCs||_d|_dS)Nr)r`�eof�rr`rrr	rsz_Hqxdecoderengine.__init__cCs�d}|}|dkr�|jr|S|ddd}|j�|�}zt�|�\}|_Wq�Wntjk
rdYnX|j�d�}|s~td��||}q6||}|t|�}|s|jstd��q|S)Nr-rrr6�r
zPremature EOF on binhex file)rbr`rr8Za2b_hqxZ
Incompleterr7)rZtotalwtdZdecdata�wtdr$Z
decdatacur�newdatarrr	rs*


z_Hqxdecoderengine.readcCs|j��dSr)�r`r/rrrr	r/%sz_Hqxdecoderengine.closeN)rrrrrr/rrrr	ra�s rac@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_RledecoderenginecCs||_d|_d|_d|_dS)Nr-r)r`�
pre_buffer�post_bufferrbrcrrr	r+sz_Rledecoderengine.__init__cCsD|t|j�kr"|�|t|j��|jd|�}|j|d�|_|Sr))r7rj�_fill)rre�rvrrr	r1s
z_Rledecoderengine.readcCs�|j|j�|d�|_|jjr>|jt�|j�|_d|_dSt|j�}|jdd�tdtkrl|d}nX|jdd�tkr�|d}n<|jdd�tdkr�|d}n|jdd�tkr�n|d	}|jt�|jd|��|_|j|d�|_dS)
Nrdr-���rLr6���r���r
)	rir`rrbrjr8Z
rledecode_hqxr7�RUNCHAR)rreZmarkrrr	rk8s*
�



�z_Rledecoderengine._fillcCs|j��dSr)rgrrrr	r/[sz_Rledecoderengine.closeN)rrrrrrkr/rrrr	rh(s#rhc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�HexBincCsft|t�rt�|d�}|�d�}|s,td��|dkr6q|dkrqBqt|�}t|�|_d|_	|�
�dS)Nrr
zNo binhex data foundr;�:r)rCrDrrrrrarhr`rE�_readheader)rr`ZchZhqxifprrr	r_s


zHexBin.__init__cCs |j�|�}t�||j�|_|Sr))r`rr8rXrE)rr7r$rrr	�_readuszHexBin._readcCsNt�d|j�d��dd@}|jd@|_||jkrDtd|j|f��d|_dS)NrMrri��zCRC error, computed %x, read %x)rP�unpackr`rrEr)rZfilecrcrrr	�	_checkcrczs
�zHexBin._checkcrccCs�|�d�}|�t|��}|�d�}|��|dd�}|dd�}t�d|dd��d}t�d|dd	��d|_t�d|d	d��d|_||_t�|_||j_	||j_
||j_t|_
dS)
Nr
���	rM�rz>l�)rt�ordrvrPrurFrG�FNamer
rrrrIrJ)rr7Zfname�rest�typeZcreator�flagsrrr	rs�s

zHexBin._readheadercGsj|jtkrtd��|r,|d}t||j�}n|j}d}t|�|krZ||�|t|��}q6|j||_|S)NzRead data at wrong timerr-)rJrIr�minrFr7rt)r�nrlrrr	r�s
zHexBin.readcCs6|jtkrtd��|jr$|�|j�}|��t|_dS)Nzclose_data at wrong time)rJrIrrFrtrvrZ�rZdummyrrr	r[�s
zHexBin.close_datacGsZ|jtkr|��|jtkr$td��|r>|d}t||j�}n|j}|j||_|�|�S)Nz Read resource data at wrong timer)rJrIr[rZrr�rGrt)rr�rrr	�	read_rsrc�s

zHexBin.read_rsrccCsD|jdkrdSz|jr"|�|j�}|��W5d|_|j��XdSr))rJr`r/rGr�rvr�rrr	r/�s
zHexBin.closeN)rrrrrtrvrsrr[r�r/rrrr	rq^s

rqc	Cs�t|�}|j}|s|j}t�|d��"}|�d�}|s6qB|�|�q&W5QRX|��|�d�}|r�t	|d�}|�|�|�d�}|s�q�|�|�qv|�
�|�
�dS)NrBr])rqr
r}rrrr.r[r�r(r/)r^r_r`r"r1rUrrr	r�s(




)rrrPr8�__all__�	ExceptionrrIrZr>r3rpr
r'r(r0r=rArrarhrqrrrrr	�<module>s*


&^*6hfnmatch.cpython-38.opt-2.pyc000064400000004145150335716500011565 0ustar00U

e5d��@sfddlZddlZddlZddlZddddgZdd�Zejddd	�d
d��Zdd�Zd
d�Z	dd�Z
dS)�N�filter�fnmatch�fnmatchcase�	translatecCs"tj�|�}tj�|�}t||�S�N)�os�path�normcaser)�name�pat�r�/usr/lib64/python3.8/fnmatch.pyrs�T)�maxsize�typedcCs<t|t�r(t|d�}t|�}t|d�}nt|�}t�|�jS)Nz
ISO-8859-1)�
isinstance�bytes�strr�re�compile�match)rZpat_strZres_str�resrrr
�_compile_pattern&s

rcCshg}tj�|�}t|�}tjtkr@|D]}||�r&|�|�q&n$|D]}|tj�|��rD|�|�qD|Sr)rrr	r�	posixpath�append)�namesr�resultrr
rrr
r0s
cCst|�}||�dk	Sr)r)r
rrrrr
r@sc	Cs�dt|�}}d}||k�r�||}|d}|dkr>|d}q|dkrP|d}q|dk�r�|}||krz||d	krz|d}||kr�||d
kr�|d}||kr�||d
kr�|d}q�||kr�|d}�q�|||�}d|kr�|�d
d�}n�g}||d	k�r|dn|d}|�d||�}|dk�r(�qN|�|||��|d}|d}�q|�|||��d�dd�|D��}t�dd|�}|d}|dd	k�r�d|dd�}n|ddk�r�d
|}d||f}q|t�|�}qd|S)Nr���*z.*�?�.�[�!�]z\[z--�\�\\��-�css"|]}|�dd��dd�VqdS)r%r&r(z\-N)�replace)�.0�srrr
�	<genexpr>ts�ztranslate.<locals>.<genexpr>z([&~|])z\\\1�^)r.r"z%s[%s]z	(?s:%s)\Z)�lenr*�findr�joinr�sub�escape)	r�i�nr�c�jZstuffZchunks�krrr
rJsV






�)rrr�	functools�__all__r�	lru_cacherrrrrrrr
�<module>s
	
socket.cpython-38.opt-1.pyc000064400000066145150335716500011444 0ustar00U

e5d���@sdZddlZddlTddlZddlZddlZddlZddlmZmZzddl	Z	Wne
k
rhdZ	YnXee	dd�Zee	dd�Z
ee	d	d�Zd
ddd
dddgZe�e�e��e�dedd��e�dedd��e�dedd��e�dedd��dZdZdd�ZeZej���d��r$iZded<ded <d!ed"<d#ed$<d%ed&<d'ed(<d)ed*<d+ed,<d-ed.<d/ed0<d1ed2<d3ed4<d5ed6<d7ed8<d9ed:<d;ed<<d=ed><d?ed@<dAedB<dCedD<dEedF<dGedH<dIedJ<dKedL<dMedN<dOedP<dQedR<dSedT<dUedV<dWedX<dYedZ<d[ed\<d]ed^<d_ed`<daedb<dcedd<deedf<dgedh<diedj<dkedl<dmedn<doedp<dqedr<dsedt<duedv<dwedx<dyedz<d{ed|<d}ed~<ded�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<e�d١Gd�dۄd�e�ZGd�d݄d�ej�Zd�d�d
�Z e!ejd߃�rpd�d�Z"e�d�e!ed��r�de#dfd�d�Z$ne%e#dfd�d�Z$e�d�d�e$_e
ehZ&Gd�d�d�ej'�Z(d�d�d�Z)e*�Z+e+dfd�d�Z,d�d�Z-e%dd�d�d�d�d
�Z.d�d�d�Z/dS)�a0This module provides socket operations and some related functions.
On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
On other systems, it only supports IP. Functions specific for a
socket are available as methods of the socket object.

Functions:

socket() -- create a new socket object
socketpair() -- create a pair of new socket objects [*]
fromfd() -- create a socket object from an open file descriptor [*]
fromshare() -- create a socket object from data received from socket.share() [*]
gethostname() -- return the current hostname
gethostbyname() -- map a hostname to its IP number
gethostbyaddr() -- map an IP number or hostname to DNS info
getservbyname() -- map a service name and a protocol name to a port number
getprotobyname() -- map a protocol name (e.g. 'tcp') to a number
ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order
htons(), htonl() -- convert 16, 32 bit int from host to network byte order
inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format
inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89)
socket.getdefaulttimeout() -- get the default timeout value
socket.setdefaulttimeout() -- set the default timeout value
create_connection() -- connects to an address, with an optional timeout and
                       optional source address.

 [*] not available on all platforms!

Special objects:

SocketType -- type object for socket objects
error -- exception raised for I/O errors
has_ipv6 -- boolean value indicating if IPv6 is supported

IntEnum constants:

AF_INET, AF_UNIX -- socket domains (first argument to socket() call)
SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument)

Integer constants:

Many other constants may be defined; these may be used in calls to
the setsockopt() and getsockopt() methods.
�N)�*)�IntEnum�IntFlag�EBADF�	�EAGAIN��EWOULDBLOCK�fromfd�getfqdn�create_connection�
create_server�has_dualstack_ipv6�
AddressFamily�
SocketKindcCs|��o|�d�S)NZAF_��isupper�
startswith��C�r�/usr/lib64/python3.8/socket.py�<lambda>L�rcCs|��o|�d�S)NZSOCK_rrrrrrQrZMsgFlagcCs|��o|�d�S)NZMSG_rrrrrrVrZAddressInfocCs|��o|�d�S)NZAI_rrrrrr[rz	127.0.0.1z::1cCs(z
||�WStk
r"|YSXdS)z{Convert a numeric family value to an IntEnum member.

    If it's not a known member, return the numeric value itself.
    N)�
ValueError)�valueZ
enum_klassrrr�_intenum_converteras
r�winz)Specified event object handle is invalid.�zInsufficient memory available.�z#One or more parameters are invalid.�WzOverlapped operation aborted.i�z2Overlapped I/O event object not in signaled state.i�z)Overlapped operation will complete later.i�zThe operation was interrupted.i'zA bad file handle was passed.i'zPermission denied.i'z!A fault occurred on the network??i'z#An invalid operation was attempted.i&'zToo many open files.i('z The socket operation would blocki3'z,A blocking operation is already in progress.i4'zOperation already in progress.i5'zSocket operation on nonsocket.i6'zDestination address required.i7'zMessage too long.i8'zProtocol wrong type for socket.i9'zBad protocol option.i:'zProtocol not supported.i;'zSocket type not supported.i<'zOperation not supported.i='zProtocol family not supported.i>'z0Address family not supported by protocol family.i?'zThe network address is in use.i@'z Cannot assign requested address.iA'zNetwork is down.iB'zNetwork is unreachable.iC'z$Network dropped connection on reset.iD'z!Software caused connection abort.iE'zThe connection has been reset.iF'zNo buffer space available.iG'zSocket is already connected.iH'zSocket is not connected.iI'zThe network has been shut down.iJ'zToo many references.iK'zThe operation timed out.iL'zConnection refused.iM'zCannot translate name.iN'zThe name is too long.iO'zThe host is down.iP'zThe host is unreachable.iQ'zDirectory not empty.iR'zToo many processes.iS'zUser quota exceeded.iT'zDisk quota exceeded.iU'zStale file handle reference.iV'zItem is remote.iW'z!Network subsystem is unavailable.ik'z!Winsock.dll version out of range.il'z(Successful WSAStartup not yet performed.im'zGraceful shutdown in progress.iu'z*No more results from WSALookupServiceNext.iv'zCall has been canceled.iw'z Procedure call table is invalid.ix'zService provider is invalid.iy'z&Service provider failed to initialize.iz'zSystem call failure.i{'zService not found.i|'zClass type not found.i}'i~'zCall was canceled.i'zDatabase query was refused.i�'zHost not found.i�*z Nonauthoritative host not found.i�*zThis is a nonrecoverable error.i�*z*Valid name, no data record requested type.i�*zQoS receivers.i�*zQoS senders.i�*zNo QoS senders.i�*zQoS no receivers.i+zQoS request confirmed.i+zQoS admission error.i+zQoS policy failure.i+zQoS bad style.i+zQoS bad object.i+zQoS traffic control error.i+zQoS generic error.i+zQoS service type error.i+zQoS flowspec error.i	+zInvalid QoS provider buffer.i
+zInvalid QoS filter style.i+i+zIncorrect QoS filter count.i
+zInvalid QoS object length.i+zIncorrect QoS flow count.i+zUnrecognized QoS object.i+zInvalid QoS policy object.i+zInvalid QoS flow descriptor.i+z'Invalid QoS provider-specific flowspec.i+z)Invalid QoS provider-specific filterspec.i+z&Invalid QoS shape discard mode object.i+z Invalid QoS shaping rate object.i+z!Reserved policy QoS element type.i+�errorTabc@seZdZdS)�_GiveupOnSendfileN)�__name__�
__module__�__qualname__rrrrr"�sr"cs,eZdZdZdddgZd9dd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zd:dddd�dd�Ze
ed�rzd;dd�Zn
d<dd�Zd=dd�Zd d!�Zd>d"d#�Zd$d%�Zejfd&d'�Zd(d)�Z�fd*d+�Ze�fd,d-��Ze�fd.d/��Zejd0k�rd1d2�Zd3d4�Znd5d2�Zd6d4�Zd7e_d8e_�ZS)?�socketz:A subclass of _socket.socket adding the makefile() method.�__weakref__�_io_refs�_closed���NcCsP|dkr,|dkrt}|dkr t}|dkr,d}tj�|||||�d|_d|_dS)Nr*rF)�AF_INET�SOCK_STREAM�_socketr&�__init__r(r))�self�family�type�proto�filenorrrr.�szsocket.__init__cCs|S�Nr�r/rrr�	__enter__�szsocket.__enter__cGs|js|��dSr4)r)�close)r/�argsrrr�__exit__�szsocket.__exit__cCs�t|dd�}d|jj|jj|r"dnd|��|j|j|jf}|s�z |��}|r^|dt	|�7}Wnt
k
rtYnXz |��}|r�|dt	|�7}Wnt
k
r�YnX|d7}|S)	zVWrap __repr__() to reveal the real class name and socket
        address(es).
        r)Fz,<%s.%s%s fd=%i, family=%s, type=%s, proto=%iz	 [closed]�z
, laddr=%sz
, raddr=%s�>)�getattr�	__class__r$r%r3r0r1r2�getsockname�str�errorZgetpeername)r/�closed�sZladdrZraddrrrr�__repr__�s4
��zsocket.__repr__cCstd|jj�d���dS)Nzcannot pickle z object)�	TypeErrorr=r#r5rrr�__getstate__szsocket.__getstate__cCs6t|���}|j|j|j|j|d�}|�|���|S)z�dup() -> socket object

        Duplicate the socket. Return a new socket object connected to the same
        system resource. The new socket is non-inheritable.
        �r3)�dupr3r=r0r1r2�
settimeout�
gettimeout)r/�fd�sockrrrrGsz
socket.dupcCsF|��\}}t|j|j|j|d�}t�dkr>|��r>|�d�||fS)z�accept() -> (socket object, address info)

        Wait for an incoming connection.  Return a new socket
        representing the connection, and the address of the client.
        For IP sockets, the address info is a pair (hostaddr, port).
        rFNT)Z_acceptr&r0r1r2ZgetdefaulttimeoutrI�setblocking)r/rJ�addrrKrrr�accepts

z
socket.accept�r)�encoding�errors�newlinec
Cs�t|�dddhks td|f��d|k}d|kp4|}d|k}d}	|rN|	d7}	|rZ|	d7}	t||	�}
|jd7_|dkr~d}|d	kr�tj}|d	kr�|s�td
��|
S|r�|r�t�|
|
|�}n|r�t�|
|�}nt�|
|�}|r�|St�	||||�}||_
|S)z�makefile(...) -> an I/O stream connected to the socket

        The arguments are as for io.open() after the filename, except the only
        supported mode values are 'r' (default), 'w' and 'b'.
        rO�w�bz&invalid mode %r (only r, w, b allowed)r:�Nr*rz!unbuffered streams must be binary)�setr�SocketIOr(�io�DEFAULT_BUFFER_SIZE�BufferedRWPair�BufferedReader�BufferedWriter�
TextIOWrapper�mode)
r/r^�	bufferingrPrQrRZwritingZreadingZbinaryZrawmode�raw�buffer�textrrr�makefile-s<
zsocket.makefile�sendfilerc
Cs�|�|||�|��}z|��}Wn0ttjfk
rR}zt|��W5d}~XYnXzt�|�j}Wn*t	k
r�}zt|��W5d}~XYnX|s�dSt
|p�|d�}|��}	|	dkr�td��t
td�r�t��}
nt��}
|
�|tj�d}|
j}tj}
z�|	�r||	��st�d��|�r0||}|dk�r0�q�z|
||||�}Wn`tk
�rh|	�s`|�Yq�Yq�t	k
�r�}z|dk�r�t|��|d�W5d}~XYq�X|dk�r��q�||7}||7}q�|W�S|dk�r�t
|d��r�|�|�XdS)Nri@�&non-blocking sockets are not supported�PollSelector�seekz	timed out)�_check_sendfile_paramsr3�AttributeErrorrX�UnsupportedOperationr"�os�fstat�st_size�OSError�minrIr�hasattr�	selectorsrfZSelectSelector�registerZEVENT_WRITEZselectrdrgr-�timeout�BlockingIOError)r/�file�offset�countZsocknor3�errZfsize�	blocksizersZselector�
total_sentZselector_selectZos_sendfile�sentrrr�_sendfile_use_sendfileYs^






zsocket._sendfile_use_sendfilecCstd��dS)Nz,os.sendfile() not available on this platform)r"�r/rurvrwrrrr|�s�c

Cs�|�|||�|��dkr"td��|r0|�|�|r>t|d�nd}d}|j}|j}z�|rpt|||�}|dkrpq�t||��}|s�q�z||�}	Wnt	k
r�Yq�Yq�X||	7}|	t
|�kr�||	d�}q�qTq�qT|W�S|dkr�t|d�r�|�||�XdS)Nrrei rg)rhrIrrgro�read�sendrp�
memoryviewrt�len)
r/rurvrwryrzZ	file_readZ	sock_send�datar{rrr�_sendfile_use_send�s8

zsocket._sendfile_use_sendcCsddt|dd�krtd��|jt@s*td��|dk	r`t|t�sJtd�|���|dkr`td�|���dS)NrTr^z$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})r)r<rr1r,�
isinstance�intrD�formatr}rrrrh�s

��zsocket._check_sendfile_paramscCs8z|�|||�WStk
r2|�|||�YSXdS)a_sendfile(file[, offset[, count]]) -> sent

        Send a file until EOF is reached by using high-performance
        os.sendfile() and return the total number of bytes which
        were sent.
        *file* must be a regular file object opened in binary mode.
        If os.sendfile() is not available (e.g. Windows) or file is
        not a regular file socket.send() will be used instead.
        *offset* tells from where to start reading the file.
        If specified, *count* is the total number of bytes to transmit
        as opposed to sending the file until EOF is reached.
        File position is updated on return or also in case of error in
        which case file.tell() can be used to figure out the number of
        bytes which were sent.
        The socket must be of SOCK_STREAM type.
        Non-blocking sockets are not supported.
        N)r|r"r�r}rrrrd�szsocket.sendfilecCs*|jdkr|jd8_|jr&|��dS)NrrU)r(r)r7r5rrr�_decref_socketios�s
zsocket._decref_socketioscCs|�|�dSr4)r7)r/Z_ssrrr�_real_close�szsocket._real_closecCsd|_|jdkr|��dS)NTr)r)r(r�r5rrrr7�s
zsocket.closecsd|_t���S)adetach() -> file descriptor

        Close the socket object without closing the underlying file descriptor.
        The object cannot be used after this call, but the file descriptor
        can be reused for other purposes.  The file descriptor is returned.
        T)r)�super�detachr5�r=rrr��sz
socket.detachcstt�jt�S)z@Read-only access to the address family for this socket.
        )rr�r0rr5r�rrr0sz
socket.familycstt�jt�S)z-Read-only access to the socket type.
        )rr�r1rr5r�rrr1szsocket.type�ntcCst�|���Sr4)rkZget_handle_inheritabler3r5rrr�get_inheritable
szsocket.get_inheritablecCst�|��|�dSr4)rkZset_handle_inheritabler3�r/Zinheritablerrr�set_inheritableszsocket.set_inheritablecCst�|���Sr4)rkr�r3r5rrrr�scCst�|��|�dSr4)rkr�r3r�rrrr�sz&Get the inheritable flag of the socketz&Set the inheritable flag of the socket)r*r*r*N)rON)rN)rN)rN)rN) r#r$r%�__doc__�	__slots__r.r6r9rCrErGrNrcrprkr|r�rhrdr�r-r&r�r7r��propertyr0r1�namer�r��
__classcell__rrr�rr&�sF

�*
A

$


r&cCst|�}t||||�S)z� fromfd(fd, family, type[, proto]) -> socket object

    Create a socket object from a duplicate of the given file
    descriptor.  The remaining arguments are the same as for socket().
    )rGr&)rJr0r1r2Znfdrrrr
sZsharecCstddd|�S)z� fromshare(info) -> socket object

        Create a socket object from the bytes object returned by
        socket.share(pid).
        r)r&)�inforrr�	fromshare#sr��
socketpaircCsh|dkr*zt}Wntk
r(t}YnXt�|||�\}}t||||���}t||||���}||fS)aasocketpair([family[, type[, proto]]]) -> (socket object, socket object)

        Create a pair of socket objects from the sockets returned by the platform
        socketpair() function.
        The arguments are the same as for socket() except the default family is
        AF_UNIX if defined on the platform; otherwise, the default is AF_INET.
        N)ZAF_UNIX�	NameErrorr+r-r�r&r�)r0r1r2�arTrrrr�.s
c
	Cs|tkrt}n|tkrt}ntd��|tkr4td��|dkrDtd��t|||�}z�|�|df�|�	�|�
�dd�\}}t|||�}zP|�d�z|�||f�Wnt
tfk
r�YnX|�d�|��\}}	Wn|���YnXW5|��X||fS)Nz?Only AF_INET and AF_INET6 socket address families are supportedz)Only SOCK_STREAM socket type is supportedrzOnly protocol zero is supported�FT)r+�
_LOCALHOST�AF_INET6�
_LOCALHOST_V6rr,r&r7�bind�listenr>rL�connectrt�InterruptedErrorrN)
r0r1r2�hostZlsockrM�portZcsockZssock�_rrrr�Cs8


a8socketpair([family[, type[, proto]]]) -> (socket object, socket object)
Create a pair of socket objects from the sockets returned by the platform
socketpair() function.
The arguments are the same as for socket() except the default family is AF_UNIX
if defined on the platform; otherwise, the default is AF_INET.
cspeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Z�fdd
�Z	dd�Z
edd��Zedd��Z
dd�Z�ZS)rWz�Raw I/O implementation for stream sockets.

    This class supports the makefile() method on sockets.  It provides
    the raw I/O interface on top of a socket object.
    cCsZ|dkrtd|��tj�|�||_d|kr6|d7}||_d|k|_d|k|_d|_dS)N)rOrSZrw�rb�wbZrwbzinvalid mode: %rrTrOrSF)	rrX�	RawIOBaser.�_sock�_mode�_reading�_writing�_timeout_occurred)r/rKr^rrrr.�s

zSocketIO.__init__c
Cs�|��|��|jrtd��z|j�|�WStk
rHd|_�Yqtk
r�}z|jdt	krpWY�
dS�W5d}~XYqXqdS)a3Read up to len(b) bytes into the writable buffer *b* and return
        the number of bytes read.  If the socket is non-blocking and no bytes
        are available, None is returned.

        If *b* is non-empty, a 0 return value indicates that the connection
        was shutdown at the other end.
        z!cannot read from timed out objectTrN)
�_checkClosed�_checkReadabler�rnr�Z	recv_intorsr@r8�_blocking_errnos�r/rT�errr�readinto�s
zSocketIO.readintoc
Cs`|��|��z|j�|�WStk
rZ}z|jdtkrHWY�
dS�W5d}~XYnXdS)aWrite the given bytes or bytearray object *b* to the socket
        and return the number of bytes written.  This can be less than
        len(b) if not all data could be written.  If the socket is
        non-blocking and no bytes could be written None is returned.
        rN)r��_checkWritabler�rr@r8r�r�rrr�write�s
zSocketIO.writecCs|jrtd��|jS)z2True if the SocketIO is open for reading.
        �I/O operation on closed socket.)rArr�r5rrr�readable�szSocketIO.readablecCs|jrtd��|jS)z2True if the SocketIO is open for writing.
        r�)rArr�r5rrr�writable�szSocketIO.writablecs|jrtd��t���S)z2True if the SocketIO is open for seeking.
        r�)rArr��seekabler5r�rrr��szSocketIO.seekablecCs|��|j��S)z=Return the file descriptor of the underlying socket.
        )r�r�r3r5rrrr3�szSocketIO.filenocCs|js|��SdSdS)Nr*)rAr3r5rrrr��sz
SocketIO.namecCs|jSr4)r�r5rrrr^�sz
SocketIO.modecCs*|jr
dStj�|�|j��d|_dS)z�Close the SocketIO object.  This doesn't close the underlying
        socket, except if all references to it have disappeared.
        N)rArXr�r7r�r�r5rrrr7�s

zSocketIO.close)r#r$r%r�r.r�r�r�r�r�r3r�r�r^r7r�rrr�rrWrs

rWr:cCsl|��}|r|dkrt�}zt|�\}}}Wntk
r@Yn(X|�d|�|D]}d|krRqhqR|}|S)aGet fully qualified domain name from name.

    An empty argument is interpreted as meaning the local host.

    First the hostname returned by gethostbyaddr() is checked, then
    possibly existing aliases. In case no FQDN is available, hostname
    from gethostname() is returned.
    z0.0.0.0r�.)�stripZgethostnameZ
gethostbyaddrr@�insert)r�Zhostname�aliasesZipaddrsrrrr�s	cCs�|\}}d}t||dt�D]�}|\}}}	}
}d}zDt|||	�}|tk	rP|�|�|r^|�|�|�|�d}|WStk
r�}
z|
}|dk	r�|��W5d}
~
XYqXq|dk	r�z|�W5d}Xntd��dS)acConnect to *address* and return the socket object.

    Convenience function.  Connect to *address* (a 2-tuple ``(host,
    port)``) and return the socket object.  Passing the optional
    *timeout* parameter will set the timeout on the socket instance
    before attempting to connect.  If no *timeout* is supplied, the
    global default timeout setting returned by :func:`getdefaulttimeout`
    is used.  If *source_address* is set it must be a tuple of (host, port)
    for the socket to bind as a source address before making the connection.
    A host of '' or port 0 tells the OS to use the default.
    Nrz!getaddrinfo returns an empty list)	�getaddrinfor,r&�_GLOBAL_DEFAULT_TIMEOUTrHr�r�r@r7)�addressrsZsource_addressr�r�rx�res�af�socktyper2�	canonname�sarKr�rrrrs.



c	Csltrttd�rttd�sdSz4ttt�� }|�ttd�W5QR�WdSQRXWnt	k
rfYdSXdS)z�Return True if the platform supports creating a SOCK_STREAM socket
    which can handle both AF_INET and AF_INET6 (IPv4 / IPv6) connections.
    �IPPROTO_IPV6�IPV6_V6ONLYFrTN)
�has_ipv6rpr-r&r�r,�
setsockoptr�r�r@)rKrrrr0s��F)r0�backlog�
reuse_port�dualstack_ipv6c
Csn|rttd�std��|r8t�s(td��|tkr8td��t|t�}�ztjdkr�ttd�r�z|�	t
td�Wntk
r�YnX|r�|�	t
t
d�tr�|tkr�|r�|�	ttd�n"ttd	�r�ttd
�r�|�	ttd�z|�|�Wn@tk
�r$}z d|j|f}t|j|�d�W5d}~XYnX|dk�r:|��n
|�|�|WStk
�rh|���YnXdS)
a�Convenience function which creates a SOCK_STREAM type socket
    bound to *address* (a 2-tuple (host, port)) and return the socket
    object.

    *family* should be either AF_INET or AF_INET6.
    *backlog* is the queue size passed to socket.listen().
    *reuse_port* dictates whether to use the SO_REUSEPORT socket option.
    *dualstack_ipv6*: if true and the platform supports it, it will
    create an AF_INET6 socket able to accept both IPv4 or IPv6
    connections. When false it will explicitly disable this option on
    platforms that enable it by default (e.g. Linux).

    >>> with create_server(('', 8000)) as server:
    ...     while True:
    ...         conn, addr = server.accept()
    ...         # handle new connection
    �SO_REUSEPORTz+SO_REUSEPORT not supported on this platformz-dualstack_ipv6 not supported on this platformz'dualstack_ipv6 requires AF_INET6 family)r��cygwin�SO_REUSEADDRrUrr�r�z+%s (while attempting to bind on address %r)N)rpr-rrr�r&r,rkr�r�Z
SOL_SOCKETr�r@r�r�r�r�r��strerror�errnor�r7)r�r0r�r�r�rKrx�msgrrrr
@sN


�
�� 


cCsPg}t�||||||�D]2}|\}}	}}
}|�t|t�t|	t�||
|f�q|S)a�Resolve host and port into list of address info entries.

    Translate the host/port argument into a sequence of 5-tuples that contain
    all the necessary arguments for creating a socket connected to that service.
    host is a domain name, a string representation of an IPv4/v6 address or
    None. port is a string service name such as 'http', a numeric port number or
    None. By passing None as the value of host and port, you can pass NULL to
    the underlying C API.

    The family, type and proto arguments can be optionally specified in order to
    narrow the list of addresses returned. Passing zero as a value for each of
    these arguments selects the full range of results.
    )r-r��appendrrr)r�r�r0r1r2�flagsZaddrlistr�r�r�r�r�rrrr��s�r�)r)r:)rrrr)0r�r-rk�sysrXrq�enumrrr��ImportErrorr<rrr	�__all__�extend�_get_exports_list�	_convert_r#r�r�rr&Z_realsocket�platform�lowerrr!r��	Exceptionr"r
rpr�r,r�r+r�r�rWr�objectr�rrr
r�rrrr�<module>sH- 
�����

F
	
$
u
�
-�Ezipimport.cpython-38.opt-2.pyc000064400000032527150335716500012207 0ustar00U

e5d-x�@sNddlZddlmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddgZejZej
dd�ZGdd�de�ZiZee	�ZdZdZd	ZGd
d�d�Zedddfed
ddfddfZdd�Zdd�Zdd�Zdd�ZdZdadd�Zdd�Z dd�Z!d d!�Z"ee"j#�Z$d"d#�Z%d$d%�Z&d&d'�Z'd(d)�Z(d*d+�Z)d,d-�Z*Gd.d/�d/�Z+dS)0�N)�_unpack_uint16�_unpack_uint32�ZipImportError�zipimporter�c@seZdZdS)rN)�__name__�
__module__�__qualname__�r
r
�!/usr/lib64/python3.8/zipimport.pyr!s�sPKi��c@sheZdZdd�Zddd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dS)rc	Cs$t|t�sddl}|�|�}|s,td|d��tr<|�tt�}g}zt�	|�}WnHt
tfk
r�t�|�\}}||kr�td|d��|}|�
|�Yq@X|jd@dkr�td|d��q�q@zt|}Wn$tk
r�t|�}|t|<YnX||_||_tj|ddd��|_|j�r |jt7_dS)Nrzarchive path is empty��pathznot a Zip filei�i����)�
isinstance�str�os�fsdecoder�alt_path_sep�replace�path_sep�_bootstrap_external�
_path_stat�OSError�
ValueError�_path_split�append�st_mode�_zip_directory_cache�KeyError�_read_directory�_files�archive�
_path_join�prefix)�selfrrr$�st�dirname�basename�filesr
r
r�__init__?s:

zzipimporter.__init__NcCsNt||�}|dk	r|gfSt||�}t||�rFd|j�t�|��gfSdgfS�N)�_get_module_info�_get_module_path�_is_dirr"r)r%�fullnamer�mi�modpathr
r
r�find_loaderms



zzipimporter.find_loadercCs|�||�dS)Nr)r2)r%r/rr
r
r�find_module�s	zzipimporter.find_modulecCst||�\}}}|Sr+��_get_module_code�r%r/�code�	ispackager1r
r
r�get_code�szzipimporter.get_codecCsvtr|�tt�}|}|�|jt�r:|t|jt�d�}z|j|}Wn tk
rhtdd|��YnXt	|j|�S)Nr�)
rrr�
startswithr"�lenr!rr�	_get_data)r%�pathname�key�	toc_entryr
r
r�get_data�szzipimporter.get_datacCst||�\}}}|Sr+r4r6r
r
r�get_filename�szzipimporter.get_filenamecCs�t||�}|dkr$td|��|d��t||�}|r@t�|d�}n
|�d�}z|j|}Wntk
rnYdSXt|j|��	�S)N�can't find module ��name�__init__.py�.py)
r,rr-rr#r!rr=r"�decode)r%r/r0r�fullpathr@r
r
r�
get_source�s


zzipimporter.get_sourcecCs(t||�}|dkr$td|��|d��|S)NrCrD)r,r)r%r/r0r
r
r�
is_package�s
zzipimporter.is_packagecCs�t||�\}}}tj�|�}|dks.t|t�s@t|�}|tj|<||_zT|rlt||�}t�	|j
|�}|g|_t|d�s|t
|_
t�|j||�t||j�Wntj|=�YnXztj|}Wn$tk
r�td|�d���YnXt�d||�|S)N�__builtins__zLoaded module z not found in sys.moduleszimport {} # loaded from Zip {})r5�sys�modules�getr�_module_type�
__loader__r-rr#r"�__path__�hasattrrL�_fix_up_module�__dict__�execr�ImportError�
_bootstrap�_verbose_message)r%r/r7r8r1�modrrIr
r
r�load_module�s0


zzipimporter.load_modulecCsXz|�|�sWdSWntk
r*YdSXtjsNddlm}|�t�dt_t||�S)Nr)�ResourceReaderT)rKr�_ZipImportResourceReader�_registered�
importlib.abcr\�register)r%r/r\r
r
r�get_resource_readers


zzipimporter.get_resource_readercCsd|j�t�|j�d�S)Nz<zipimporter object "z">)r"rr$)r%r
r
r�__repr__"szzipimporter.__repr__)N)N)rrr	r*r2r3r9rArBrJrKr[rarbr
r
r
rr-s.
 


&z__init__.pycTrFF)z.pycTF)rGFFcCs|j|�d�dS)N�.�)r$�
rpartition)r%r/r
r
rr-4sr-cCs|t}||jkSr+)rr!)r%r�dirpathr
r
rr.8sr.cCs8t||�}tD]$\}}}||}||jkr|SqdSr+)r-�_zip_searchorderr!)r%r/r�suffix�
isbytecoder8rIr
r
rr,As


r,c	Cs�zt�|�}Wn&tk
r4td|��|d��YnX|���z$|�td�|��}|�t�}Wn&tk
r�td|��|d��YnXt|�tkr�td|��|d��|dd�t	k�r�z|�dd�|��}Wn&tk
r�td|��|d��YnXt
|ttd�}z|�|�|��}Wn(tk
�rJtd|��|d��YnX|�t	�}|dk�rrtd|��|d��|||t�}t|�tk�r�td|��|d��|t|�|}t
|d	d
��}t
|d
d��}	||k�r�td|��|d��||	k�r
td
|��|d��||8}||	}
|
dk�r6td|��|d��i}d}z|�|�Wn(tk
�rttd|��|d��YnX|�d�}t|�dk�r�td��|dd�dk�r��q�t|�dk�r�td��t|dd��}
t|dd	��}t|d	d��}t|dd
��}t
|d
d��}t
|dd��}t
|dd��}t|dd��}t|dd��}t|dd��}t
|dd��}|||}||	k�r�td|��|d��||
7}z|�|�}Wn(tk
�r�td|��|d��YnXt|�|k�r�td|��|d��z2t|�||��||k�r*td|��|d��Wn(tk
�rTtd|��|d��YnX|
d@�rj|��}n6z|�d�}Wn&tk
�r�|�d��t�}YnX|�dt�}t�||�}||||||||f}|||<|d 7}�qvW5QRXt�d!||�|S)"Nzcan't open Zip file: r
rd�can't read Zip file: �rznot a Zip file: zcorrupt Zip file: ���zbad central directory size: zbad central directory offset: z&bad central directory size or offset: �.�EOF read where not expectedsPK��
����� �"�*zbad local header offset: i�ascii�latin1�/rz!zipimport: found {} names in {!r})�_io�	open_coderr�seek�END_CENTRAL_DIR_SIZE�tell�readr<�STRING_END_ARCHIVE�max�MAX_COMMENT_LEN�rfindr�EOFErrorrrH�UnicodeDecodeError�	translate�cp437_tablerrrr#rXrY)r"�fp�header_position�buffer�	file_size�max_comment_start�data�pos�header_size�
header_offset�
arc_offsetr)�count�flags�compress�time�date�crc�	data_size�	name_size�
extra_size�comment_size�file_offsetrEr�tr
r
rr `s�
���

�


�
�






r u�	

 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ cCsltrt�d�td��daz<zddlm}Wn&tk
rRt�d�td��YnXW5daXt�d�|S)Nzzipimport: zlib UNAVAILABLE�)can't decompress data; zlib not availableTFr��
decompresszzipimport: zlib available)�_importing_zlibrXrYr�zlibr��	Exceptionr�r
r
r�_get_decompress_func�s


r�c	Cs�|\}}}}}}}}	|dkr$td��t�|���}
z|
�|�Wn&tk
rftd|��|d��YnX|
�d�}t|�dkr�td��|dd�dkr�td	|��|d��t|d
d��}t|dd��}
d||
}||7}z|
�|�Wn(tk
�rtd|��|d��YnX|
�|�}t|�|k�r4td��W5QRX|dk�rL|Sz
t	�}Wnt
k
�rttd
��YnX||d�S)Nrznegative data sizerjr
rvrprksPKzbad local file header: �ruzzipimport: can't read datar�i�)rr}r~rrr�r<r�rr�r�)r"r@�datapathr�r�r�r�r�r�r�r�r�r�r�r��raw_datar�r
r
rr=s>



r=cCst||�dkS)Nr)�abs)�t1�t2r
r
r�	_eq_mtimeAsr�cCs<||d�}zt�|||�}Wntk
r2YdSX|d@dk}|r�|d@dk}tjdkr�|shtjdkr�t||�}	|	dk	r�t�tj|	�}
zt�||
||�Wntk
r�YdSXnTt	||�\}}|�r
t
t|dd��|�r�t|dd	��|k�r
t�
d
|���dSt�|d	d��}
t|
t��s8td|�d���|
S)
N)rErrrrd�never�alwaysrqrlrmzbytecode is stale for zcompiled module z is not a code object)r�
_classify_pycrW�_imp�check_hash_based_pycs�_get_pyc_source�source_hash�_RAW_MAGIC_NUMBER�_validate_hash_pyc�_get_mtime_and_size_of_sourcer�rrXrY�marshal�loadsr�
_code_type�	TypeError)r%r>rIr/r��exc_detailsr��
hash_based�check_source�source_bytesr��source_mtime�source_sizer7r
r
r�_unmarshal_codeKsX�
��
��
���r�cCs|�dd�}|�dd�}|S)Ns
�
�
)r)�sourcer
r
r�_normalize_line_endings~sr�cCst|�}t||ddd�S)NrVT)�dont_inherit)r��compile)r>r�r
r
r�_compile_source�sr�cCsDt�|d?d|d?d@|d@|d?|d?d@|d@dd	d	d	f	�S)
N�	i������?rdr)r��mktime)�dr�r
r
r�_parse_dostime�s



�r�c
Cs`z>|dd�}|j|}|d}|d}|d}t||�|fWStttfk
rZYdSXdS)Nrr���)rr)r!r�r�
IndexErrorr�)r%rr@r�r��uncompressed_sizer
r
rr��s
r�cCsB|dd�}z|j|}Wntk
r0YdSXt|j|�SdS)Nr)r!rr=r")r%rr@r
r
rr��sr�c	Cs�t||�}tD]�\}}}||}tjd|jt|dd�z|j|}Wntk
rXYqX|d}t|j|�}	|r�t	|||||	�}
n
t
||	�}
|
dkr�q|d}|
||fSqtd|��|d��dS)Nz
trying {}{}{}rd)�	verbosityrrCrD)r-rgrXrYr"rr!rr=r�r�r)r%r/rrhrir8rIr@r1r�r7r
r
rr5�s$

r5c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
r]FcCs||_||_dSr+)rr/)r%rr/r
r
rr*�sz!_ZipImportResourceReader.__init__cCs\|j�dd�}|�d|��}ddlm}z||j�|��WStk
rVt|��YnXdS)Nrcr|r)�BytesIO)r/r�ior�rrAr�FileNotFoundError)r%�resource�fullname_as_pathrr�r
r
r�
open_resource�sz&_ZipImportResourceReader.open_resourcecCst�dSr+)r�)r%r�r
r
r�
resource_path�sz&_ZipImportResourceReader.resource_pathcCsH|j�dd�}|�d|��}z|j�|�Wntk
rBYdSXdS)Nrcr|FT)r/rrrAr)r%rEr�rr
r
r�is_resource�sz$_ZipImportResourceReader.is_resourcec		cs�ddlm}||j�|j��}|�|jj�}|j}t�}|jj	D]f}z||��|�}Wnt
k
rnYq@YnX|jj}t|�dkr�|jVq@||kr@|�
|�|Vq@dS)Nr)�Path)�pathlibr�rrBr/�relative_tor"�parent�setr!rrEr<�add)	r%r��
fullname_path�
relative_path�package_path�subdirs_seen�filename�relative�parent_namer
r
r�contents�s 


z!_ZipImportResourceReader.contentsN)	rrr	r^r*r�r�r�r�r
r
r
rr]�s	r]),�_frozen_importlib_externalrrr�_frozen_importlibrXr�r}r�rMr��__all__r�path_separatorsrrWrr�typerPr�r�r�rrgr-r.r,r r�r�r�r=r�r��__code__r�r�r�r�r�r�r5r]r
r
r
r�<module>sV�		~�.
.

shlex.cpython-38.opt-1.pyc000064400000016562150335716500011275 0ustar00U

e5d
4�	@s�dZddlZddlZddlZddlmZddlmZddddgZGd	d�d�Z	ddd�Z
d
d�Ze�dej
�jZdd�Zdd�Zedkr�eej�dkr�ee	��n,ejdZee��Zee	ee��W5QRXdS)�8A lexical analyzer class for simple shell-like syntaxes.�N)�deque)�StringIO�shlex�split�quote�joinc@sreZdZdZddd�Zedd��Zdd	�Zdd
d�Zdd
�Z	dd�Z
dd�Zdd�Zddd�Z
dd�Zdd�ZdS)rrNFcCst|t�rt|�}|dk	r(||_||_ntj|_d|_||_|rHd|_nd|_d|_	d|_
|jrn|j
d7_
d|_d|_d|_
d|_d	|_d
|_t�|_d|_d|_d|_t�|_d|_|s�d}n|d
kr�d}||_|�rt�|_|j
d7_
|j
�t�|��}|j
�|�|_
dS)N��#Z?abcdfeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_u|ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞz 	
Fz'"�\�"� �rTz();<>|&z~-./*?=)�
isinstance�strr�instream�infile�sys�stdin�posix�eof�
commenters�	wordchars�
whitespace�whitespace_split�quotes�escape�
escapedquotes�stater�pushback�lineno�debug�token�	filestack�source�_punctuation_chars�_pushback_chars�	maketrans�dict�fromkeys�	translate)�selfrrr�punctuation_chars�t�r.�/usr/lib64/python3.8/shlex.py�__init__sJ
zshlex.__init__cCs|jS�N)r%�r+r.r.r/r,Dszshlex.punctuation_charscCs*|jdkrtdt|��|j�|�dS)z:Push a token onto the stack popped by the get_token methodrzshlex: pushing token N)r!�print�reprr�
appendleft)r+�tokr.r.r/�
push_tokenHs
zshlex.push_tokencCspt|t�rt|�}|j�|j|j|jf�||_||_d|_|jrl|dk	r\t	d|jf�nt	d|jf�dS)z9Push an input source onto the lexer's input source stack.rNzshlex: pushing to file %szshlex: pushing to stream %s)
rrrr#r5rrr r!r3)r+�	newstream�newfiler.r.r/�push_sourceNs
zshlex.push_sourcecCsD|j��|j��\|_|_|_|jr:td|j|jf�d|_dS)zPop the input source stack.zshlex: popping to %s, line %dr
N)	r�closer#�popleftrr r!r3rr2r.r.r/�
pop_source\s

�zshlex.pop_sourcecCs�|jr.|j��}|jdkr*tdt|��|S|��}|jdk	rz||jkrz|�|���}|rp|\}}|�||�|�	�}q@||j
kr�|js�|j
S|��|�	�}qz|jdkr�||j
kr�tdt|��ntd�|S)zBGet a token from the input stream (or from stack if it's nonempty)rzshlex: popping token Nz
shlex: token=zshlex: token=EOF)
rr<r!r3r4�
read_tokenr$�
sourcehookr:�	get_tokenrr#r=)r+r6�raw�specr9r8r.r.r/r@es.








zshlex.get_tokencCs�d}d}|jr |jr |j��}n|j�d�}|dkrB|jd7_|jdkr^td|j|f�|jdkrtd|_	�q�q|jdk�r�|s�d|_�q��q�||j
kr�|jdkr�td	�|j	s�|jr|r�q�nqn�||jkr�|j�
�|jd7_n�|j�r||jk�rd
}||_n�||jk�r&||_	d
|_nr||jk�r@||_	d|_nX||jk�rb|j�sZ||_	||_n6|j�rx||_	d
|_n ||_	|j	�s�|jr|r�q�nqq|j|jk�rDd}|�s�|jdk�r�td
�td��||jk�r|j�s�|j	|7_	d|_�q�nd
|_n>|j�r4||jk�r4|j|jk�r4|j}||_n|j	|7_	q|j|jk�r�|�st|jdk�rltd�td��||jk�r�||jk�r�||k�r�|j	|j7_	|j	|7_	||_q|jdkr|�s�d|_�q�q||j
k�r|jdk�r�td�d|_|j	�s�|jr|r�q�nqq||jk�rh|j�
�|jd7_|j�r�d|_|j	�s�|jr|r�q�nqq|jdk�r�||jk�r�|j	|7_	n"||j
k�r�|j�|�d|_�q�q|j�r�||jk�r�||_q|j�r�||jk�r�d
}||_q||jk�s||jk�s|j�r,||jk�r,|j	|7_	q|j�rB|j�|�n|j�|�|jdk�rbtd�d|_|j	�s�|jr|r�q�qqq|j	}d|_	|j�r�|�s�|dk�r�d}|jdk�r�|�r�tdt|��ntd�|S)NFr
r�
�z&shlex: in state %r I see character: %rr	�z+shlex: I see whitespace in whitespace state�a�cTz shlex: I see EOF in quotes statezNo closing quotationz shlex: I see EOF in escape statezNo escaped character)rFrGz%shlex: I see whitespace in word statez&shlex: I see punctuation in word statezshlex: raw token=zshlex: raw token=EOF)r,r&�popr�readr r!r3rr"rrr�readlinerrrr�
ValueErrorr�appendrr5r4)r+ZquotedZescapedstateZnextchar�resultr.r.r/r>�s

�




���

��zshlex.read_tokencCsV|ddkr|dd�}t|jt�rHtj�|�sHtj�tj�|j�|�}|t|d�fS)z(Hook called on a filename to be sourced.rrr����r)	rrr�os�path�isabsr�dirname�open)r+r9r.r.r/r?s
zshlex.sourcehookcCs(|dkr|j}|dkr|j}d||fS)z<Emit a C-compiler-like, Emacs-friendly error-message leader.Nz"%s", line %d: )rr )r+rr r.r.r/�error_leader s
zshlex.error_leadercCs|Sr1r.r2r.r.r/�__iter__(szshlex.__iter__cCs|��}||jkrt�|Sr1)r@r�
StopIteration)r+r"r.r.r/�__next__+s
zshlex.__next__)NNFF)N)NN)�__name__�
__module__�__qualname__�__doc__r0�propertyr,r7r:r=r@r>r?rUrVrXr.r.r.r/rs �
/

	 	
FTcCs$t||d�}d|_|sd|_t|�S)z-Split the string *s* using shell-like syntax.)rTr	)rrr�list)�sZcommentsrZlexr.r.r/r1s
cCsd�dd�|D��S)z3Return a shell-escaped string from *split_command*.r
css|]}t|�VqdSr1)r)�.0�argr.r.r/�	<genexpr><szjoin.<locals>.<genexpr>)r)Z
split_commandr.r.r/r:sz[^\w@%+=:,./-]cCs,|sdSt|�dkr|Sd|�dd�dS)z1Return a shell-escaped version of the string *s*.z''N�'z'"'"')�_find_unsafe�replace)r_r.r.r/rAs
cCs$|��}|sq tdt|��qdS)NzToken: )r@r3r4)ZlexerZttr.r.r/�
_print_tokensMsrf�__main__r)FT)r\rP�rer�collectionsr�ior�__all__rrr�compile�ASCII�searchrdrrfrY�len�argv�fnrT�fr.r.r.r/�<module>s(	 
	

asyncore.cpython-38.opt-1.pyc000064400000037236150335716500011776 0ustar00U

e5d~N�@shdZddlZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZeee
eeeeh�ZzeWnek
r�iZYnXdd�ZGdd�de�ZeeefZdd	�Zd
d�Z dd
�Z!dd�Z"d&dd�Z#d'dd�Z$e$Z%d(dd�Z&Gdd�d�Z'Gdd�de'�Z(dd�Z)d)dd �Z*ej+d!k�rdGd"d#�d#�Z,Gd$d%�d%e'�Z-dS)*a�Basic infrastructure for asynchronous socket service clients and servers.

There are only two ways to have a program on a single processor do "more
than one thing at a time".  Multi-threaded programming is the simplest and
most popular way to do it, but there is another very different technique,
that lets you have nearly all the advantages of multi-threading, without
actually using multiple threads. it's really only practical if your program
is largely I/O bound. If your program is CPU bound, then pre-emptive
scheduled threads are probably what you really need. Network servers are
rarely CPU-bound, however.

If your operating system supports the select() system call in its I/O
library (and nearly all do), then you can use it to juggle multiple
communication channels at once; doing other work while your I/O is taking
place in the "background."  Although this strategy can seem strange and
complex, especially at first, it is in many ways easier to understand and
control than multi-threaded programming. The module documented here solves
many of the difficult problems for you, making the task of building
sophisticated high-performance network servers and clients a snap.
�N)
�EALREADY�EINPROGRESS�EWOULDBLOCK�
ECONNRESET�EINVAL�ENOTCONN�	ESHUTDOWN�EISCONN�EBADF�ECONNABORTED�EPIPE�EAGAIN�	errorcodec
CsHzt�|�WStttfk
rB|tkr6t|YSd|YSXdS)NzUnknown error %s)�os�strerror�
ValueError�
OverflowError�	NameErrorr)�err�r� /usr/lib64/python3.8/asyncore.py�	_strerrorDsrc@seZdZdS)�ExitNowN)�__name__�
__module__�__qualname__rrrrrLsrcCs:z|��Wn(tk
r"�Yn|��YnXdS�N)�handle_read_event�_reraised_exceptions�handle_error��objrrr�readQsr"cCs:z|��Wn(tk
r"�Yn|��YnXdSr)�handle_write_eventrrr rrr�writeYsr$cCs:z|��Wn(tk
r"�Yn|��YnXdSr)�handle_expt_eventrrr rrr�
_exceptionasr&c
Cs�zX|tj@r|��|tj@r&|��|tj@r8|��|tjtjBtj	B@rV|�
�Wnhtk
r�}z$|jdt
kr�|��n|�
�W5d}~XYn(tk
r��Yn|��YnXdS�Nr)�select�POLLINr�POLLOUTr#�POLLPRIr%ZPOLLHUPZPOLLERRZPOLLNVAL�handle_close�OSError�args�
_DISCONNECTEDrr)r!�flags�errr�	readwriteis"



r2�c	Cs<|dkrt}|�r8g}g}g}t|���D]L\}}|��}|��}|rP|�|�|rd|jsd|�|�|sl|r*|�|�q*g|kr�|kr�|kr�nnt�|�dSt	�	||||�\}}}|D] }|�
|�}|dkr�q�t|�q�|D]"}|�
|�}|dk�rq�t|�q�|D]&}|�
|�}|dk�r,�qt
|��qdSr)�
socket_map�list�items�readable�writable�append�	accepting�time�sleepr(�getr"r$r&)	�timeout�map�r�wr1�fdr!Zis_rZis_wrrr�poll}sD


"







rCcCs�|dkrt}|dk	r t|d�}t��}|r�t|���D]L\}}d}|��r\|tjtjBO}|�	�rt|j
st|tjO}|r8|�||�q8|�|�}|D]&\}}|�
|�}|dkr�q�t||�q�dS)Ni�r)r4�intr(rCr5r6r7r)r+r8r:r*�registerr=r2)r>r?ZpollsterrBr!r0r@rrr�poll2�s(


rF�>@FcCsb|dkrt}|r ttd�r t}nt}|dkr>|r^|||�q,n |r^|dkr^|||�|d}q>dS)NrCr�)r4�hasattrr(rFrC)r>Zuse_pollr?�countZpoll_funrrr�loop�s
rKc@s2eZdZdZdZdZdZdZdZe	dh�Z
dAdd�Zdd�ZdBdd	�Z
dCd
d�Zejejfdd
�ZdDdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdEd'd(�Zd)d*�Z d+d,�Z!d-d.�Z"d/d0�Z#d1d2�Z$d3d4�Z%d5d6�Z&d7d8�Z'd9d:�Z(d;d<�Z)d=d>�Z*d?d@�Z+dS)F�
dispatcherFN�warningc
Cs�|dkrt|_n||_d|_|r�|�d�|�||�d|_z|��|_Wq�tk
r�}z*|j	dt
tfkrvd|_n|�|��W5d}~XYq�Xnd|_
dS�NrTF)r4�_map�_fileno�setblocking�
set_socket�	connectedZgetpeername�addrr-r.rr�del_channel�socket)�self�sockr?rrrr�__init__�s 

zdispatcher.__init__cCs�|jjd|jjg}|jr.|jr.|�d�n|jr>|�d�|jdk	r�z|�d|j�Wn$tk
r�|�t|j��YnXdd�	|�t
|�fS)N�.Z	listeningrSz%s:%dz<%s at %#x>� )�	__class__rrr:rTr9rS�	TypeError�repr�join�id)rWZstatusrrr�__repr__�s

zdispatcher.__repr__cCs|dkr|j}|||j<dSr)rOrP)rWr?rrr�add_channel	szdispatcher.add_channelcCs,|j}|dkr|j}||kr"||=d|_dSr)rPrO)rWr?rBrrrrUszdispatcher.del_channelcCs.||f|_t�||�}|�d�|�|�dSr')Zfamily_and_typerVrQrR)rWZfamily�typerXrrr�
create_sockets

zdispatcher.create_socketcCs||_|��|_|�|�dSr)rV�filenorPrb�rWrXr?rrrrRs
zdispatcher.set_socketcCsDz*|j�tjtj|j�tjtj�dB�Wntk
r>YnXdS)NrH)rVZ
setsockopt�
SOL_SOCKETZSO_REUSEADDR�
getsockoptr-�rWrrr�set_reuse_addr#s
���zdispatcher.set_reuse_addrcCsdS�NTrrirrrr74szdispatcher.readablecCsdSrkrrirrrr87szdispatcher.writablecCs(d|_tjdkr|dkrd}|j�|�S)NT�nt�)r:r�namerV�listen)rWZnumrrrro>szdispatcher.listencCs||_|j�|�Sr)rTrV�bind)rWrTrrrrpDszdispatcher.bindcCspd|_d|_|j�|�}|tttfks8|tkrBtj	dkrB||_
dS|dtfkr^||_
|��nt
|t|��dS)NFTrlr)rS�
connectingrVZ
connect_exrrrrrrnrTr	�handle_connect_eventr-r)rWZaddressrrrr�connectHs��
zdispatcher.connectc
Csvz|j��\}}WnVtk
r(YdStk
rh}z$|jdtttfkrVWY�
dS�W5d}~XYn
X||fSdSr')rV�acceptr]r-r.rrr
)rWZconnrT�whyrrrrtVs
zdispatcher.acceptc
Cstz|j�|�}|WStk
rn}z>|jdtkr<WY�*dS|jdtkr\|��WY�
dS�W5d}~XYnXdSr')rV�sendr-r.rr/r,)rW�data�resultrurrrrvds

zdispatcher.sendc
Csrz(|j�|�}|s |��WdS|WSWnDtk
rl}z&|jdtkrZ|��WY�
dS�W5d}~XYnXdS)N�r)rV�recvr,r-r.r/)rWZbuffer_sizerwrurrrrzqs

zdispatcher.recvc
Csnd|_d|_d|_|��|jdk	rjz|j��Wn6tk
rh}z|jdtt	fkrX�W5d}~XYnXdS)NFr)
rSr:rqrUrV�closer-r.rr
)rWrurrrr{�s
zdispatcher.closecCstj�dt|��dS)Nzlog: %s
)�sys�stderrr$�str)rW�messagerrr�log�szdispatcher.log�infocCs||jkrtd||f�dS)Nz%s: %s)�ignore_log_types�print)rWrrcrrr�log_info�s
zdispatcher.log_infocCs:|jr|��n&|js.|jr$|��|��n|��dSr)r:�
handle_acceptrSrqrr�handle_readrirrrr�s

zdispatcher.handle_read_eventcCs@|j�tjtj�}|dkr(t|t|���|��d|_d|_dSrN)	rVrhrg�SO_ERRORr-r�handle_connectrSrq�rWrrrrrr�szdispatcher.handle_connect_eventcCs*|jr
dS|js|jr|��|��dSr)r:rSrqrr�handle_writerirrrr#�szdispatcher.handle_write_eventcCs0|j�tjtj�}|dkr$|��n|��dSr')rVrhrgr�r,�handle_exptr�rrrr%�s
zdispatcher.handle_expt_eventcCsXt�\}}}}zt|�}Wndt|�}YnX|�d||||fd�|��dS)Nz)<__repr__(self) failed for object at %0x>z:uncaptured python exception, closing channel %s (%s:%s %s)�error)�compact_tracebackr^r`r�r,)rWZnil�t�v�tbinfoZ	self_reprrrrr�s��	zdispatcher.handle_errorcCs|�dd�dS)Nz!unhandled incoming priority eventrM�r�rirrrr��szdispatcher.handle_exptcCs|�dd�dS)Nzunhandled read eventrMr�rirrrr��szdispatcher.handle_readcCs|�dd�dS)Nzunhandled write eventrMr�rirrrr��szdispatcher.handle_writecCs|�dd�dS)Nzunhandled connect eventrMr�rirrrr��szdispatcher.handle_connectcCs|��}|dk	r|j|�dSr)rt�handle_accepted)rWZpairrrrr��szdispatcher.handle_acceptcCs|��|�dd�dS)Nzunhandled accepted eventrM)r{r�)rWrXrTrrrr��szdispatcher.handle_acceptedcCs|�dd�|��dS)Nzunhandled close eventrM)r�r{rirrrr,�szdispatcher.handle_close)NN)N)N)N)r�),rrr�debugrSr:rq�closingrT�	frozensetr�rYrarbrUrVZAF_INETZSOCK_STREAMrdrRrjr7r8rorprsrtrvrzr{r�r�rrrr#r%rr�r�r�r�r�r�r,rrrrrL�sJ

 

	


rLc@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�dispatcher_with_sendNcCst�|||�d|_dS)Nry)rLrY�
out_bufferrfrrrrY�szdispatcher_with_send.__init__cCs.d}t�||jdd��}|j|d�|_dS)Nri)rLrvr�)rWZnum_sentrrr�
initiate_sendsz"dispatcher_with_send.initiate_sendcCs|��dSr)r�rirrrr�sz!dispatcher_with_send.handle_writecCs|jpt|j�Sr)rS�lenr�rirrrr8szdispatcher_with_send.writablecCs0|jr|�dt|��|j||_|��dS)Nz
sending %s)r�r�r^r�r�)rWrwrrrrvszdispatcher_with_send.send)NN)rrrrYr�r�r8rvrrrrr��s

r�cCs�t��\}}}g}|std��|rL|�|jjj|jjjt|j	�f�|j
}q~|d\}}}d�dd�|D��}|||f|||fS)Nztraceback does not exist���r[cSsg|]}d|�qS)z
[%s|%s|%s]r)�.0�xrrr�
<listcomp>&sz%compact_traceback.<locals>.<listcomp>)r|�exc_info�AssertionErrorr9�tb_frame�f_code�co_filename�co_namer~�	tb_lineno�tb_nextr_)r�r��tbr��fileZfunction�liner�rrrr�s�r�cCs�|dkrt}t|���D]n}z|��Wqtk
r`}z|jdtkrJn|sP�W5d}~XYqtk
rt�Yq|s��YqXq|��dSr')	r4r5�valuesr{r-r.r
r�clear)r?Z
ignore_allr�rrr�	close_all)s 
r��posixc@sNeZdZdd�Zdd�Zdd�Zdd�Zdd
d�ZeZeZ	dd
�Z
dd�Zd	S)�file_wrappercCst�|�|_dSr)r�duprB�rWrBrrrrYNszfile_wrapper.__init__cCs*|jdkrtjd|t|d�|��dS)Nrzunclosed file %r)�source)rB�warnings�warn�ResourceWarningr{rirrr�__del__Qs

�zfile_wrapper.__del__cGstj|jf|��Sr)rr"rB�rWr.rrrrzWszfile_wrapper.recvcGstj|jf|��Sr)rr$rBr�rrrrvZszfile_wrapper.sendNcCs(|tjkr|tjkr|sdStd��dS)Nrz-Only asyncore specific behaviour implemented.)rVrgr��NotImplementedError)rW�levelZoptnameZbuflenrrrrh]s
��zfile_wrapper.getsockoptcCs(|jdkrdS|j}d|_t�|�dS)Nrr�)rBrr{r�rrrr{hs

zfile_wrapper.closecCs|jSr)rBrirrrreoszfile_wrapper.fileno)N)rrrrYr�rzrvrhr"r$r{rerrrrr�Is
r�c@seZdZddd�Zdd�ZdS)�file_dispatcherNcCsPt�|d|�d|_z|��}Wntk
r4YnX|�|�t�|d�dS)NTF)rLrYrSre�AttributeError�set_filer�set_blocking)rWrBr?rrrrYts
zfile_dispatcher.__init__cCs"t|�|_|j��|_|��dSr)r�rVrerPrbr�rrrr�s
zfile_dispatcher.set_file)N)rrrrYr�rrrrr�rs
r�)r3N)r3N)rGFNN)NF).�__doc__r(rVr|r;r�r�errnorrrrrrrr	r
rrr
rr�r/r4rr�	Exceptionr�KeyboardInterrupt�
SystemExitrr"r$r&r2rCrFZpoll3rKrLr�r�r�rnr�r�rrrr�<module>sD<�


'

*
)fileinput.cpython-38.opt-1.pyc000064400000032077150335716500012150 0ustar00U

e5du9�@s�dZddlZddlZddddddd	d
ddd
dgZdad"ddd�dd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd	�Zdd
�Zdd�Z
Gdd�d�Zdd
�Zd#dd�Zdd �Zed!kr�e�dS)$a
Helper class to quickly write a loop over all standard input files.

Typical use is:

    import fileinput
    for line in fileinput.input():
        process(line)

This iterates over the lines of all files listed in sys.argv[1:],
defaulting to sys.stdin if the list is empty.  If a filename is '-' it
is also replaced by sys.stdin and the optional arguments mode and
openhook are ignored.  To specify an alternative list of filenames,
pass it as the argument to input().  A single file name is also allowed.

Functions filename(), lineno() return the filename and cumulative line
number of the line that has just been read; filelineno() returns its
line number in the current file; isfirstline() returns true iff the
line just read is the first line of its file; isstdin() returns true
iff the line was read from sys.stdin.  Function nextfile() closes the
current file so that the next iteration will read the first line from
the next file (if any); lines not read from the file will not count
towards the cumulative line count; the filename is not changed until
after the first line of the next file has been read.  Function close()
closes the sequence.

Before any lines have been read, filename() returns None and both line
numbers are zero; nextfile() has no effect.  After all lines have been
read, filename() and the line number functions return the values
pertaining to the last line read; nextfile() has no effect.

All files are opened in text mode by default, you can override this by
setting the mode parameter to input() or FileInput.__init__().
If an I/O error occurs during opening or reading a file, the OSError
exception is raised.

If sys.stdin is used more than once, the second and further use will
return no lines, except perhaps for interactive use, or if it has been
explicitly reset (e.g. using sys.stdin.seek(0)).

Empty files are opened and immediately closed; the only time their
presence in the list of filenames is noticeable at all is when the
last file opened is empty.

It is possible that the last line of a file doesn't end in a newline
character; otherwise lines are returned including the trailing
newline.

Class FileInput is the implementation; its methods filename(),
lineno(), fileline(), isfirstline(), isstdin(), nextfile() and close()
correspond to the functions in the module.  In addition it has a
readline() method which returns the next input line, and a
__getitem__() method which implements the sequence behavior.  The
sequence must be accessed in strictly sequential order; sequence
access and readline() cannot be mixed.

Optional in-place filtering: if the keyword argument inplace=1 is
passed to input() or to the FileInput constructor, the file is moved
to a backup file and standard output is directed to the input file.
This makes it possible to write a filter that rewrites its input file
in place.  If the keyword argument backup=".<some extension>" is also
given, it specifies the extension for the backup file, and the backup
file remains around; by default, the extension is ".bak" and it is
deleted when the output file is closed.  In-place filtering is
disabled when standard input is read.  XXX The current implementation
does not work for MS-DOS 8+3 filesystems.

XXX Possible additions:

- optional getopt argument processing
- isatty()
- read(), read(size), even readlines()

�N�input�close�nextfile�filename�lineno�
filelineno�fileno�isfirstline�isstdin�	FileInput�hook_compressed�hook_encodedF��r��mode�openhookcCs(trtjrtd��t|||||d�atS)aReturn an instance of the FileInput class, which can be iterated.

    The parameters are passed to the constructor of the FileInput class.
    The returned instance, in addition to being an iterator,
    keeps global state for the functions of this module,.
    zinput() already activer)�_state�_file�RuntimeErrorr)�files�inplace�backuprr�r�!/usr/lib64/python3.8/fileinput.pyrSs
cCst}da|r|��dS)zClose the sequence.N)rr)�staterrrr`scCststd��t��S)a�
    Close the current file so that the next iteration will read the first
    line from the next file (if any); lines not read from the file will
    not count towards the cumulative line count. The filename is not
    changed until after the first line of the next file has been read.
    Before the first line has been read, this function has no effect;
    it cannot be used to skip the first file. After the last line of the
    last file has been read, this function has no effect.
    �no active input())rrrrrrrrhs
cCststd��t��S)zr
    Return the name of the file currently being read.
    Before the first line has been read, returns None.
    r)rrrrrrrrvscCststd��t��S)z�
    Return the cumulative line number of the line that has just been read.
    Before the first line has been read, returns 0. After the last line
    of the last file has been read, returns the line number of that line.
    r)rrrrrrrrscCststd��t��S)z�
    Return the line number in the current file. Before the first line
    has been read, returns 0. After the last line of the last file has
    been read, returns the line number of that line within the file.
    r)rrrrrrrr�scCststd��t��S)zg
    Return the file number of the current file. When no file is currently
    opened, returns -1.
    r)rrrrrrrr�scCststd��t��S)ze
    Returns true the line just read is the first line of its file,
    otherwise returns false.
    r)rrr	rrrrr	�scCststd��t��S)z]
    Returns true if the last line was read from sys.stdin,
    otherwise returns false.
    r)rrr
rrrrr
�sc@s�eZdZdZd)ddd�dd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�ZdS)*ra;FileInput([files[, inplace[, backup]]], *, mode=None, openhook=None)

    Class FileInput is the implementation of the module; its methods
    filename(), lineno(), fileline(), isfirstline(), isstdin(), fileno(),
    nextfile() and close() correspond to the functions of the same name
    in the module.
    In addition it has a readline() method which returns the next
    input line, and a __getitem__() method which implements the
    sequence behavior. The sequence must be accessed in strictly
    sequential order; random access and readline() cannot be mixed.
    NFrrrcCst|t�r|f}nBt|tj�r,t�|�f}n(|dkrBtjdd�}|sLd}nt|�}||_||_	||_
d|_d|_d|_
d|_d|_d|_d|_d|_|dkr�td��d|kr�ddl}|�dtd	�||_d|kr�|�d
d�nd|_|�r|r�td��t|��std
��||_dS)N�)�-rF)rZrU�U�rbz=FileInput opening mode must be one of 'r', 'rU', 'U' and 'rb'rz'U' mode is deprecated�r�wz4FileInput cannot use an opening hook in inplace modez#FileInput openhook must be callable)�
isinstance�str�os�PathLike�fspath�sys�argv�tuple�_files�_inplace�_backup�_savestdout�_output�	_filename�_startlineno�_filelinenor�_isstdin�_backupfilename�
ValueError�warnings�warn�DeprecationWarning�_mode�replace�_write_mode�callable�	_openhook)�selfrrrrrr6rrr�__init__�sH
�
zFileInput.__init__cCs|��dS�N�r�r>rrr�__del__�szFileInput.__del__cCsz|��W5d|_XdS)Nr)r+rrBrrrr�szFileInput.closecCs|Sr@rrBrrr�	__enter__�szFileInput.__enter__cCs|��dSr@rA)r>�type�value�	tracebackrrr�__exit__�szFileInput.__exit__cCs|Sr@rrBrrr�__iter__�szFileInput.__iter__cCs6|��}|r|jd7_|S|js(t�|��qdS�Nr)�	_readliner2r�
StopIterationr�r>�linerrr�__next__�szFileInput.__next__cCsXddl}|jdtdd�||��kr,td��z
|��WStk
rRtd��YnXdS)NrzTSupport for indexing FileInput objects is deprecated. Use iterator protocol instead.r!)�
stacklevelzaccessing lines out of orderzend of input reached)r6r7r8rrrOrL�
IndexError)r>�ir6rrr�__getitem__s�
zFileInput.__getitem__cCs�|j}d|_|r|t_|j}d|_z|r0|�
�W5|j}d|_z|`Wntk
r\YnXz|rr|jsr|�
�W5|j}d|_|r�|js�zt	�
|�Wntk
r�YnXd|_XXdS)NF)r.r(�stdoutr/rrK�AttributeErrorr4r-r%�unlink�OSErrorr3r)r>Z
savestdout�output�fileZbackupfilenamerrrrs4

zFileInput.nextfilecCs6|��}|r|jd7_|S|js(|S|��qdSrJ)rKr2rrrMrrr�readline.szFileInput.readlinecCs�|jsd|jkrdSdS|jd|_|jdd�|_|��|_d|_d|_d|_d|_|jdkr�d|_d|jkr�t	t
jd	t
j�|_nt
j|_d
|_�nT|j�r�t
�|j�|jp�d|_zt
�|j�Wntk
r�YnXt
�|j|j�t|j|j�|_zt
�|j���j}Wn&tk
�r8t|j|j�|_YntXt
jt
jBt
jB}tt
d��rb|t
jO}t
�|j||�}t
�||j�|_zt
�|j|�Wntk
�r�YnXt
j |_!|jt
_ n,|j"�r�|�"|j|j�|_nt|j|j�|_|jj#|_$|�$�S)
N�b�rrrFrz<stdin>�bufferTz.bak�O_BINARY)%r+r9r0rr1r2rr3r4�getattrr(�stdinr,r%r'r-rVrW�rename�open�fstatr�st_moder;r/�O_CREAT�O_WRONLY�O_TRUNC�hasattrr^�fdopen�chmodrTr.r=rZrK)r>Zpermr�fdrrrrK9s\




�


zFileInput._readlinecCs|jSr@)r0rBrrrrrszFileInput.filenamecCs|j|jSr@)r1r2rBrrrruszFileInput.linenocCs|jSr@�r2rBrrrrxszFileInput.filelinenocCs4|jr,z|j��WStk
r(YdSXndSdS)N���)rrr5rBrrrr{s
zFileInput.filenocCs
|jdkSrJrlrBrrrr	�szFileInput.isfirstlinecCs|jSr@)r3rBrrrr
�szFileInput.isstdin)NFr)�__name__�
__module__�__qualname__�__doc__r?rCrrDrHrIrOrSrrZrKrrrrr	r
rrrrr�s*�)9	cCsVtj�|�d}|dkr,ddl}|�||�S|dkrHddl}|�||�St||�SdS)Nrz.gzrz.bz2)r%�path�splitext�gziprb�bz2ZBZ2File)rrZextrtrurrrr�scs��fdd�}|S)Ncst||��d�S)N��encoding�errors)rb)rrrvrrr�szhook_encoded.<locals>.openhookr)rwrxrrrvrr
�scCs�ddl}d}d}|�tjdd�d�\}}|D] \}}|dkrBd}|dkr.|}q.t|||d�D]b}|d	d�d
kr~|dd	�}|d	d�dkr�|dd	�}tdt�t�t�t�r�d
p�d|f�q^tdt�t�t�f�dS)NrFrzib:z-iTz-b)rrrm�
�
z%d: %s[%d]%s %s�*rz
%d: %s[%d])	�getoptr(r)r�printrrrr	)r|rrZopts�args�o�arNrrr�_test�s&�
r��__main__)NFr)N)rqr(r%�__all__rrrrrrrrr	r
rrr
r�rnrrrr�<module>s4J�
	

			^
reprlib.cpython-38.opt-2.pyc000064400000012035150335716500011601 0ustar00U

e5d��@sZdddgZddlZddlmZddlmZddd�ZGd	d�d�Zd
d�Ze�Z	e	j
Z
dS)
�Repr�repr�recursive_repr�N)�islice)�	get_ident�...cs�fdd�}|S)NcsXt�����fdd�}t�d�|_t�d�|_t�d�|_t�d�|_t�di�|_|S)Nc	sBt|�t�f}|�kr�S��|�z�|�}W5��|�X|S�N)�idr�add�discard)�self�key�result)�	fillvalue�repr_running�
user_function��/usr/lib64/python3.8/reprlib.py�wrappers
z<recursive_repr.<locals>.decorating_function.<locals>.wrapper�
__module__�__doc__�__name__�__qualname__�__annotations__)�set�getattrrrrrr)rr�r)rrr�decorating_functionsz+recursive_repr.<locals>.decorating_functionr)rrrrrr	sc@s~eZdZdd�Zdd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS) rcCsFd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
dS)N�����()�maxlevel�maxtuple�maxlist�maxarray�maxdict�maxset�maxfrozenset�maxdeque�	maxstring�maxlong�maxother)rrrr�__init__&sz
Repr.__init__cCs|�||j�Sr)�repr1r#)r�xrrrr3sz	Repr.reprcCsVt|�j}d|kr$|��}d�|�}t|d|�rFt|d|�||�S|�||�SdS)N� �_�repr_)�typer�split�join�hasattrr�
repr_instance)rr0�level�typename�partsrrrr/6s

z
Repr.repr1�c
s�t|�}|dkr|rd}nX|d�|j���fdd�t||�D�}	||krT|	�d�d�|	�}|dkrr|rr||}d|||fS)Nrr�csg|]}�|���qSrr)�.0�elem��newlevelr/rr�
<listcomp>Gsz'Repr._repr_iterable.<locals>.<listcomp>�, z%s%s%s)�lenr/r�appendr6)
rr0r9�left�right�maxiter�trail�n�s�piecesrr@r�_repr_iterable@s

zRepr._repr_iterablecCs|�||dd|jd�S)N�(�)�,)rMr$�rr0r9rrr�
repr_tupleMszRepr.repr_tuplecCs|�||dd|j�S)N�[�])rMr%rQrrr�	repr_listPszRepr.repr_listcCs,|sd|jSd|j}|�|||d|j�S)Nzarray('%s')z
array('%s', [�]))�typecoderMr&)rr0r9�headerrrr�
repr_arraySs

zRepr.repr_arraycCs$|sdSt|�}|�||dd|j�S)Nzset()�{�})�_possibly_sortedrMr(rQrrr�repr_setYsz
Repr.repr_setcCs$|sdSt|�}|�||dd|j�S)Nzfrozenset()zfrozenset({z}))r\rMr)rQrrr�repr_frozenset_s�zRepr.repr_frozensetcCs|�||dd|j�S)Nzdeque([rV)rMr*rQrrr�
repr_dequefszRepr.repr_dequecCs�t|�}|dkrdS|dkr dS|d}|j}g}tt|�|j�D].}|||�}||||�}	|�d||	f�qB||jkr�|�d�d�|�}
d|
fS)	Nrz{}z{...}r=z%s: %srrCz{%s})rDr/rr\r'rEr6)rr0r9rJrAr/rLr
�keyrepr�valreprrKrrr�	repr_dictis 



zRepr.repr_dictcCs�t�|d|j��}t|�|jkr�td|jdd�}td|jd|�}t�|d|�|t|�|d��}|d|�d|t|�|d�}|S�Nr��r)�builtinsrr+rD�max�rr0r9rK�i�jrrr�repr_strxs&$z
Repr.repr_strcCsht�|�}t|�|jkrdtd|jdd�}td|jd|�}|d|�d|t|�|d�}|Src)rfrrDr,rgrhrrr�repr_int�s
$z
Repr.repr_intcCs�zt�|�}Wn(tk
r6d|jjt|�fYSXt|�|jkr�td|jdd�}td|jd|�}|d|�d|t|�|d�}|S)Nz<%s instance at %#x>rrdrer)	rfr�	Exception�	__class__rr	rDr-rgrhrrrr8�s$zRepr.repr_instanceN)r<)rrrr.rr/rMrRrUrYr]r^r_rbrkrlr8rrrrr$s



	cCs,z
t|�WStk
r&t|�YSXdSr)�sortedrm�list)r0rrrr\�s
r\)r)�__all__rf�	itertoolsr�_threadrrrr\�aReprrrrrr�<module>s

s	contextvars.cpython-38.pyc000064400000000365150335716500011565 0ustar00U

e5d��@s ddlmZmZmZmZdZdS)�)�Context�
ContextVar�Token�copy_contextN)Z_contextvarsrrrr�__all__�rr�#/usr/lib64/python3.8/contextvars.py�<module>sturtle.cpython-38.opt-1.pyc000064400000375750150335716500011500 0ustar00U

e5dd1�O@s6dZdZddlZddlZddlZddlZddlZddlZddl	m
Z
mZmZddl
mZddlmZddd	d
ddd
ddg	Zddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.gZd/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}gOZd~dgZeeeed�gZdd0d3d@dMdQdUd[d]dbdcdedfdqdvdydzgZd�d�d�d�ddd�d�d�d�d�d�d�d�d�d�d�d�d�d�d��Zd�d��Zd�d��Zzee�Wnek
�r
ed��YnXGd�d�de�Zd�d��Zd�d��Zd�Zd�d�d��Z Gd�d�dej!�Z"e e"ej#d��Gd�d��d�ej$�Z%ej#Z#Gd�d��d�e&�Z'Gd�d��d�e�Z(Gd�d��d�e�Z)Gd�d�de&�Z*Gd�d��d�e&�Z+Gd�d�de'�Z,Gd�d��d�e&�Z-Gd�d��d�e&�Z.Gd�d��d�e&�Z/Gd�d
�d
e.e-�Z0e0Z1d�d	�Z2Gd�d��d�e,�Z3Gd�d�de0�Z4e4Z5d�d�d~�Z6d�d��Z7ed�Z8ze8d�k�rre7e8�Wn@e9k
�r�ed�e8�Yn"ek
�r�ed�e8�YnXd�d��Z:d�dÄZ;d�dńZ<d�Z=d�dȄZ>e>ee3d�d�e<�e>ee4d�d�e;�e?Z@eAd�k�r2d�dτZBd�dфZCd�dӄZDeC�eD�eE�dS)�a�

Turtle graphics is a popular way for introducing programming to
kids. It was part of the original Logo programming language developed
by Wally Feurzig and Seymour Papert in 1966.

Imagine a robotic turtle starting at (0, 0) in the x-y plane. After an ``import turtle``, give it
the command turtle.forward(15), and it moves (on-screen!) 15 pixels in
the direction it is facing, drawing a line as it moves. Give it the
command turtle.right(25), and it rotates in-place 25 degrees clockwise.

By combining together these and similar commands, intricate shapes and
pictures can easily be drawn.

----- turtle.py

This module is an extended reimplementation of turtle.py from the
Python standard distribution up to Python 2.5. (See: http://www.python.org)

It tries to keep the merits of turtle.py and to be (nearly) 100%
compatible with it. This means in the first place to enable the
learning programmer to use all the commands, classes and methods
interactively when using the module from within IDLE run with
the -n switch.

Roughly it has the following features added:

- Better animation of the turtle movements, especially of turning the
  turtle. So the turtles can more easily be used as a visual feedback
  instrument by the (beginning) programmer.

- Different turtle shapes, gif-images as turtle shapes, user defined
  and user controllable turtle shapes, among them compound
  (multicolored) shapes. Turtle shapes can be stretched and tilted, which
  makes turtles very versatile geometrical objects.

- Fine control over turtle movement and screen updates via delay(),
  and enhanced tracer() and speed() methods.

- Aliases for the most commonly used commands, like fd for forward etc.,
  following the early Logo traditions. This reduces the boring work of
  typing long sequences of commands, which often occur in a natural way
  when kids try to program fancy pictures on their first encounter with
  turtle graphics.

- Turtles now have an undo()-method with configurable undo-buffer.

- Some simple commands/methods for creating event driven programs
  (mouse-, key-, timer-events). Especially useful for programming games.

- A scrollable Canvas class. The default scrollable Canvas can be
  extended interactively as needed while playing around with the turtle(s).

- A TurtleScreen class with methods controlling background color or
  background image, window and canvas size and other properties of the
  TurtleScreen.

- There is a method, setworldcoordinates(), to install a user defined
  coordinate-system for the TurtleScreen.

- The implementation uses a 2-vector class named Vec2D, derived from tuple.
  This class is public, so it can be imported by the application programmer,
  which makes certain types of computations very natural and compact.

- Appearance of the TurtleScreen and the Turtles at startup/import can be
  configured by means of a turtle.cfg configuration file.
  The default configuration mimics the appearance of the old turtle module.

- If configured appropriately the module reads in docstrings from a docstring
  dictionary in some different language, supplied separately  and replaces
  the English ones by those read in. There is a utility function
  write_docstringdict() to write a dictionary with the original (English)
  docstrings to disc, so it can serve as a template for translations.

Behind the scenes there are some features included with possible
extensions in mind. These will be commented and documented elsewhere.

z-turtle 1.1b- - for Python 3.1   -  4. 5. 2009�N)�isfile�split�join)�deepcopy)�simpledialog�ScrolledCanvas�TurtleScreen�Screen�	RawTurtle�Turtle�RawPen�Pen�Shape�Vec2D�addshape�bgcolor�bgpic�bye�clearscreen�	colormode�delay�exitonclick�	getcanvas�	getshapes�listen�mainloop�mode�numinput�onkey�
onkeypress�onkeyrelease�
onscreenclick�ontimer�register_shape�resetscreen�
screensize�setup�setworldcoordinates�	textinput�title�tracer�turtles�update�
window_height�window_width�back�backward�
begin_fill�
begin_poly�bk�circle�clear�
clearstamp�clearstamps�clone�color�degrees�distance�dot�down�end_fill�end_poly�fd�	fillcolor�filling�forward�get_poly�getpen�	getscreen�
get_shapepoly�	getturtle�goto�heading�
hideturtle�home�ht�isdown�	isvisible�left�lt�onclick�ondrag�	onrelease�pd�pen�pencolor�pendown�pensize�penup�pos�position�pu�radians�right�reset�
resizemode�rt�seth�
setheading�setpos�setposition�settiltangle�
setundobuffer�setx�sety�shape�	shapesize�shapetransform�shearfactor�
showturtle�speed�st�stamp�tilt�	tiltangle�towards�
turtlesize�undo�undobufferentries�up�width�write�xcor�ycor�write_docstringdict�done�
Terminator��?g�?i�i,�standard��?�
i��classic�black�noresizeTZenglish�turtle�screenzPython Turtle GraphicsF)rz�height�	canvwidth�
canvheight�	leftright�	topbottomrrr�undobuffersizerkrWrAra�visible�language�
exampleturtle�
examplescreenr)�
using_IDLEc	Cs�t|d��}|��}W5QRXi}|D]�}|��}|r&|�d�rBq&z|�d�\}}Wn(tk
r|td||f�Yq&YnX|��}|��}|dkr�t|�}n4zd|kr�t|�}nt	|�}Wntk
r�YnX|||<q&|S)z/Convert content of config-file into dictionary.�r�#�=zBad line in config-file %s:
%s)�True�False�Nonez''z""�.)
�open�	readlines�strip�
startswithr�
ValueError�print�eval�float�int)�filename�fZcfglines�cfgdict�line�key�value�r��/usr/lib64/python3.8/turtle.py�config_dict�s0



r�cCs�d}i}i}t|�rt|�}d|kr0d|d}ztt�\}}t||�}Wntk
rbd}YnXt|�rtt|�}t�|�t�|�dS)a@Read config-files, change configuration-dict accordingly.

    If there is a turtle.cfg file in the current working directory,
    read it from there. If this contains an importconfig-value,
    say 'myway', construct filename turtle_mayway.cfg else use
    turtle.cfg and read it from the import-directory, where
    turtle.py is located.
    Update configuration dictionary first according to config-file,
    in the import directory, then according to config-file in the
    current working directory.
    If no config-file is found, the default configuration is used.
    z
turtle.cfgZimportconfigz
turtle_%s.cfg�N)rr�r�__file__r�	Exception�_CFGr,)r�Zdefault_cfgZcfgdict1Zcfgdict2�head�tailZ	cfg_file2r�r�r��
readconfig�s 


r�z"No configfile read, reason unknownc@s`eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)ra�A 2 dimensional vector class, used as a helper class
    for implementing turtle graphics.
    May be useful for turtle graphics programs also.
    Derived from tuple, so a vector is a tuple!

    Provides (for a, b vectors, k number):
       a+b vector addition
       a-b vector subtraction
       a*b inner product
       k*a and a*k multiplication with scalar
       |a| absolute value of a
       a.rotate(angle) rotation
    cCst�|||f�S�N)�tuple�__new__)�cls�x�yr�r�r�r��sz
Vec2D.__new__cCs"t|d|d|d|d�S�Nr��r��self�otherr�r�r��__add__�sz
Vec2D.__add__cCsDt|t�r*|d|d|d|dSt|d||d|�Sr�)�
isinstancerr�r�r�r��__mul__�s
 z
Vec2D.__mul__cCs2t|t�st|t�r.t|d||d|�StSr�)r�r�r�r�NotImplementedr�r�r�r��__rmul__szVec2D.__rmul__cCs"t|d|d|d|d�Sr�r�r�r�r�r��__sub__sz
Vec2D.__sub__cCst|d|d�Sr�r��r�r�r�r��__neg__sz
Vec2D.__neg__cCs|dd|dddS)Nr�r�r�r�r�r�r�r��__abs__
sz
Vec2D.__abs__cCsjt|d|d�}|tjd}t�|�t�|�}}t|d||d||d||d|�S)z.rotate self counterclockwise by angle
        r�r��f@)r�math�pi�cos�sin)r��angleZperp�c�sr�r�r��rotateszVec2D.rotatecCs|d|dfSr�r�r�r�r�r��__getnewargs__szVec2D.__getnewargs__cCsd|S)Nz(%.2f,%.2f)r�r�r�r�r��__repr__szVec2D.__repr__N)�__name__�
__module__�__qualname__�__doc__r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�s
cCsTt|j�}|��|D]}t||�q|j��D]\}}t|�tjkr0|||<q0dS)�#helper function for Scrolled CanvasN)	�list�	__bases__�reverse�__methodDict�__dict__�items�type�types�FunctionType)r��_dictZbaseListZ_superr�r�r�r�r�r�!s
r�cCsi}t||�|��S)r�)r��keys)r�r�r�r�r��	__methods+s
r�zTdef %(method)s(self, *args, **kw): return self.%(attribute)s.%(method)s(*args, **kw)r�cCs�i}t||�i}t|�}|��D]B}|dd�dksd|dd�dksd||ksd||krXq"||||<q"|��D]D\}}	||	d�}
t|t�r�t||d�}t||
�t|||
|�qndS)Nr��_���)�method�func)r�Z	attribute)	r�r�r�r�r��str�__stringBody�exec�setattr)Z	fromClassZtoClassZtoPartZexcludeZ_dict_1r�ZmfcZexr�r��dZ
execStringr�r�r��__forwardmethods5s
0

�
r�c@sdeZdZdZddd�Zddd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dS)rz�Modeled after the scrolled canvas class from Grayons's Tkinter book.

    Used as the default canvas, which pops up automatically when
    using turtle graphics functions or the Turtle class.
    ���^�Xc
Cs0tjj||||d�|��|_|||_|_|||_|_d|_	tj
||||j	tjdd�|_tj
||jjtjd�|_tj
||jjd�|_|jj|jj|jjd�|jdd	dd
�|jdd	dd
�|jjd	|d	ddd	d	dd�|jjd	|d	dd	d	d	dd�|jjd	|d	d	dd	d	dd�|��|j�d
|j�dS)N)rzr��whiter�)rzr��bgZreliefZborderwidth)�commandZorient)r�)ZxscrollcommandZyscrollcommandrr�)ZweightZminsize�news�ZpadxZin_Zpady�row�columnZrowspanZ
columnspanZstickyz<Configure>)�TK�Frame�__init__�winfo_toplevelZ_rootwindowrzr�r�r�r��CanvasZSUNKEN�_canvasZ	ScrollbarZxviewZ
HORIZONTAL�hscrollZyview�vscrollZ	configure�setZrowconfigureZcolumnconfigure�gridr`�bind�onResize)r��masterrzr�r�r�r�r�r�r�PsN

������zScrolledCanvas.__init__NcCs�|r
||_|r||_|r||_|jj||jd|jd|jd|jdfd�|j�d|j|jd|j�|j�d|j|jd|j�|�	�dS)z<Adjust canvas and scrollbars according to given canvas size.r�)r��scrollregionr��N)
r�r�r�r�config�xview_movetorz�yview_movetor��
adjustScrolls�r�r�r�r�r�r�r�r`is&����zScrolledCanvas.resetc
Cs�|j��}|j��}|j�d|j||j�|j�d|j||j�||jks`||jkr�|jjd|ddddddd�|j	jd|ddddddd�n|j�
�|j	�
�dS)zA Adjust scrollbars according to window- and canvas-size.
        r�r�rr�r�N)r�winfo_width�winfo_heightrr�rr�rrrZgrid_forget)r��cwidth�cheightr�r�r�r
{s&

��
zScrolledCanvas.adjustScrollscCs|��dS)zself-explanatoryN)r
)r��eventr�r�r�r�szScrolledCanvas.onResizecGs|jj|�S��@ 'forward' method, which canvas itself has inherited...
        )r�bbox�r��argsr�r�r�r�szScrolledCanvas.bboxcOs|jj||�Sr)r�cget�r�r�kwargsr�r�r�r�szScrolledCanvas.cgetcOs|jj||�dS�rN)rr
rr�r�r�r
�szScrolledCanvas.configcOs|jj||�dSr)rrrr�r�r�r�szScrolledCanvas.bindcOs|jj||�dSr)r�unbindrr�r�r�r�szScrolledCanvas.unbindcCs|j��dSr)r�focus_forcer�r�r�r�r�szScrolledCanvas.focus_force)r�r�r�r�)NNN)r�r�r�r�r�r`r
rrrr
rrrr�r�r�r�rJs�

rc@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�_Rootz'Root class for Screen based on Tkinter.cCstj�|�dSr�)r��Tkr�r�r�r�r�r��sz_Root.__init__cCs&t|||||�|_|jjddd�dS)Nr�Zboth)�expand�fill)rrZpack)r�rzr�rrr�r�r��setupcanvas�sz_Root.setupcanvascCs|jSr�)rr�r�r�r��
_getcanvas�sz_Root._getcanvascCs|�d||||f�dS)Nz%dx%d%+d%+d)Zgeometry)r�rzr��startx�startyr�r�r��set_geometry�sz_Root.set_geometrycCs|�d|�dS)NZWM_DELETE_WINDOW)Zwm_protocol)r��destroyr�r�r��	ondestroy�sz_Root.ondestroycCs|��Sr�)Zwinfo_screenwidthr�r�r�r��	win_width�sz_Root.win_widthcCs|��Sr�)Zwinfo_screenheightr�r�r�r��
win_height�sz_Root.win_heightN)r�r�r�r�r�r#r$r'r)r*r+r�r�r�r�r�src@s,eZdZdZdd�Zdd�Zdd�Zdd	�ZdGdd
�Zdd�Z	dHdd�Z
dd�Zdd�Zdd�Z
dd�ZdIdd�Zdd�ZdJdd �ZdKd!d"�ZdLd#d$�ZdMd%d&�Zd'd(�ZdNd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�ZdOd=d>�Z d?d@�Z!dAdB�Z"dCdD�Z#dPdEdF�Z$d
S)Q�TurtleScreenBasez�Provide the basic graphics functionality.
       Interface between Tkinter and turtle.py.

       To port turtle.py to some different graphics toolkit
       a corresponding TurtleScreenBase class has to be implemented.
    cCstjdd|jd�}|��|S)z$return a blank image object
        r�)rzr�r)r��
PhotoImage�cv�blank)r�Zimgr�r�r��_blankimage�szTurtleScreenBase._blankimagecCstj||jd�S)z`return an image object containing the
        imagedata from a gif-file named filename.
        )�filer)r�r-r.)r�r�r�r�r��_image�szTurtleScreenBase._imagecCs�||_t|t�r"|jj}|jj}nJt|j�d��}t|j�d��}|jj|d|d|d|dfd�||_||_d|_|_	dS)Nrzr�r��rr�)
r.r�rr�r�r�rr
�xscale�yscale)r�r.�w�hr�r�r�r��s

*zTurtleScreenBase.__init__cCs|jjdddd�S)z<Create an invisible polygon item on canvas self.cv)
        )rrrrrrr��r"�outline)r.Zcreate_polygonr�r�r�r��_createpoly�szTurtleScreenBase._createpolyNFc
Cs�g}|D]*\}}	|�||j�|�|	|j�q|jj|f|��|dk	r^|jj||d�|dk	rv|jj||d�|dk	r�|jj||d�|r�|j�|�dS)a`Configure polygonitem polyitem according to provided
        arguments:
        coordlist is sequence of coordinates
        fill is filling color
        outline is outline color
        top is a boolean value, which specifies if polyitem
        will be put on top of the canvas' displaylist so it
        will not be covered by other items.
        N�r")r9�rz��appendr4r5r.�coordsZ
itemconfigureZ	tag_raise)
r�Zpolyitem�	coordlistr"r9rz�top�clr�r�r�r�r��	_drawpoly�szTurtleScreenBase._drawpolyc	Cs|jjddddddtjd�S)z9Create an invisible line item on canvas self.cv)
        rr�r�)r"rzZcapstyle)r.Zcreate_liner�ZROUNDr�r�r�r��_createlines�zTurtleScreenBase._createlinec	Cs�|dk	rNg}|D]*\}}|�||j�|�||j�q|jj|f|��|dk	rf|jj||d�|dk	r~|jj||d�|r�|j�|�dS)aQConfigure lineitem according to provided arguments:
        coordlist is sequence of coordinates
        fill is drawing color
        width is width of drawn line.
        top is a boolean value, which specifies if polyitem
        will be put on top of the canvas' displaylist so it
        will not be covered by other items.
        Nr;r<r=)	r�Zlineitemr@r"rzrArBr�r�r�r�r��	_drawlines
zTurtleScreenBase._drawlinecCs|j�|�dS)z]Delete graphics item from canvas.
        If item is"all" delete all graphics items.
        N)r.�delete�r��itemr�r�r��_delete(szTurtleScreenBase._deletecCs|j��dS)z(Redraw graphics items on canvas
        N)r.r,r�r�r�r��_update.szTurtleScreenBase._updatecCs|j�|�dS)z-Delay subsequent canvas actions for delay ms.N)r.�after�r�rr�r�r��_delay3szTurtleScreenBase._delaycCs4z|j�|�}d}Wntjk
r.d}YnX|S)zCCheck if the string color is a legal Tkinter color string.
        TF)r.Z	winfo_rgbr�ZTclError)r�r9Zrgb�okr�r�r��_iscolorstring7s
zTurtleScreenBase._iscolorstringcCs0|dk	r |jj|d�|��n|j�d�SdS)zVSet canvas' backgroundcolor if color is not None,
        else return backgroundcolor.N)r�r�)r.r
rJr)r�r9r�r�r��_bgcolorAs
zTurtleScreenBase._bgcolorcCst|\}}||j}||j}dddd�}|jj|d||||||d�}	|j�|	�\}
}}}
|j��|	|dfS)z�Write txt at pos in canvas with specified font
        and color.
        Return text item and x-coord of right bottom corner
        of text's bounding box.�swr�Zse)rP�centerr_r�)�text�anchorr"�font)r4r5r.Zcreate_textrr,)r�r[�txt�alignrUrWr�r�rTrHZx0Zy0Zx1Zy1r�r�r��_writeJs

�
zTurtleScreenBase._writer�csD�dkr�j�|d|�n$��fdd�}�j�|d|||�dS)z�Bind fun to mouse-click event on turtle.
        fun must be a function with two arguments, the coordinates
        of the clicked point on the canvas.
        num, the number of the mouse-button defaults to 1
        N�<Button-%s>cs:�j�|j��j�j�|j��j}}�||�dSr��r.�canvasxr�r4�canvasyr�r5�rr�r���funr�r�r��eventfunes�z+TurtleScreenBase._onclick.<locals>.eventfun�r.Z
tag_unbindZtag_bind�r�rHr_�num�addr`r�r^r��_onclick\szTurtleScreenBase._onclickcsD�dkr�j�|d|�n$��fdd�}�j�|d|||�dS)agBind fun to mouse-button-release event on turtle.
        fun must be a function with two arguments, the coordinates
        of the point on the canvas where mouse button is released.
        num, the number of the mouse-button defaults to 1

        If a turtle is clicked, first _onclick-event will be performed,
        then _onscreensclick-event.
        Nz<Button%s-ButtonRelease>cs:�j�|j��j�j�|j��j}}�||�dSr�rZr]r^r�r�r`ws�z-TurtleScreenBase._onrelease.<locals>.eventfunrarbr�r^r��
_onreleaseks	�zTurtleScreenBase._onreleasecsD�dkr�j�|d|�n$��fdd�}�j�|d|||�dS)aqBind fun to mouse-move-event (with pressed mouse button) on turtle.
        fun must be a function with two arguments, the coordinates of the
        actual mouse position on the canvas.
        num, the number of the mouse-button defaults to 1

        Every sequence of mouse-move-events on a turtle is preceded by a
        mouse-click event on that turtle.
        Nz<Button%s-Motion>csTz:�j�|j��j�j�|j��j}}�||�Wntk
rNYnXdSr�)r.r[r�r4r\r�r5r�r]r^r�r�r`�s�z*TurtleScreenBase._ondrag.<locals>.eventfunrarbr�r^r��_ondrag~s	zTurtleScreenBase._ondragcs@�dkr�j�d|�n"��fdd�}�j�d|||�dS)aGBind fun to mouse-click event on canvas.
        fun must be a function with two arguments, the coordinates
        of the clicked point on the canvas.
        num, the number of the mouse-button defaults to 1

        If a turtle is clicked, first _onclick-event will be performed,
        then _onscreensclick-event.
        NrYcs:�j�|j��j�j�|j��j}}�||�dSr�rZr]r^r�r�r`�s�z1TurtleScreenBase._onscreenclick.<locals>.eventfun�r.rr)r�r_rcrdr`r�r^r��_onscreenclick�s	zTurtleScreenBase._onscreenclickcs>�dkr|j�d|d�n�fdd�}|j�d||�dS)z`Bind fun to key-release event of key.
        Canvas must have focus. See method listen
        Nz<KeyRelease-%s>cs
��dSr�r��r�r_r�r�r`�sz0TurtleScreenBase._onkeyrelease.<locals>.eventfunrh�r�r_r�r`r�rkr��
_onkeyrelease�szTurtleScreenBase._onkeyreleasecsn�dkr4|dkr |j�dd�qj|j�d|d�n6�fdd�}|dkrX|j�d|�n|j�d||�dS)z�If key is given, bind fun to key-press event of key.
        Otherwise bind fun to any key-press.
        Canvas must have focus. See method listen.
        Nz
<KeyPress>z
<KeyPress-%s>cs
��dSr�r�rjrkr�r�r`�sz.TurtleScreenBase._onkeypress.<locals>.eventfunrhrlr�rkr��_onkeypress�szTurtleScreenBase._onkeypresscCs|j��dS)z=Set focus on canvas (in order to collect key-events)
        N)r.rr�r�r�r��_listen�szTurtleScreenBase._listencCs(|dkr|j�|�n|j�||�dS)z?Install a timer, which calls fun after t milliseconds.
        rN)r.Z
after_idlerK�r�r_�tr�r�r��_ontimer�szTurtleScreenBase._ontimercCs|jjdd|d�S)z0Create and return image item on canvas.
        r��image)r.Zcreate_image)r�rtr�r�r��_createimage�szTurtleScreenBase._createimagecCs<|\}}|j�|||j||jf�|jj||d�dS)zZConfigure image item as to draw image object
        at position (x,y) on canvas)
        rsN)r.r?r4r5�
itemconfig)r�rHr[rtr�r�r�r�r��
_drawimage�s zTurtleScreenBase._drawimagecCs |jj||d�|j�|�dS)z�Configure image item as to draw image object
        at center of canvas. Set item to the first item
        in the displaylist, so it will be drawn below
        any other item .rsN)r.rvZ	tag_lower)r�rHrtr�r�r��	_setbgpic�szTurtleScreenBase._setbgpiccCs|j�|�S)zQReturn 'line' or 'polygon' or 'image' depending on
        type of item.
        )r.r�rGr�r�r��_type�szTurtleScreenBase._typecs.|j�|���fdd�tdt��d�D�}|S)a returns list of coordinate-pairs of points of item
        Example (for insiders):
        >>> from turtle import *
        >>> getscreen()._pointlist(getturtle().turtle._item)
        [(0.0, 9.9999999999999982), (0.0, -9.9999999999999982),
        (9.9999999999999982, 0.0)]
        >>> cs"g|]}�|�|df�qS)r�r���.0�i�rBr�r��
<listcomp>�sz/TurtleScreenBase._pointlist.<locals>.<listcomp>rr�)r.r?�range�len)r�rH�plr�r}r��
_pointlist�szTurtleScreenBase._pointlistcCs|jj||||fd�dS)Nr3)r.r
)r��srx1�sry1�srx2�sry2r�r�r��_setscrollregion�sz!TurtleScreenBase._setscrollregionc	Cs||j��}|D]h}t|j�|��}g}|rd|dd�\}}|�||�|�||�|dd�}q&|jj|f|��qdS)Nr�)r.Zfind_allr�r?r>)	r�ZxscalefactorZyscalefactorr�rHZcoordinatesZnewcoordlistr�r�r�r�r��_rescale�s
zTurtleScreenBase._rescalecCszt|jt�s|j|jfS||kr6|kr6dkrJnn|jj|jjfS|dk	rX||_|dk	rf||_|j�|||�dS)zaResize the canvas the turtles are drawing on. Does
        not alter the drawing window.
        N)r�r.rr�r�r`rr�r�r��_resizes"zTurtleScreenBase._resizecCs@|j��}|dkr|jd}|j��}|dkr8|jd}||fS)z; Return the width and height of the turtle window.
        r�rzr�)r.rr)r�rzr�r�r�r��_window_sizes



zTurtleScreenBase._window_sizecCs|jj��dS)a{Starts event loop - calling Tkinter's mainloop function.

        No argument.

        Must be last statement in a turtle graphics program.
        Must NOT be used if a script is run from within IDLE in -n mode
        (No subprocess) - for interactive use of turtle graphics.

        Example (for a TurtleScreen instance named screen):
        >>> screen.mainloop()

        N)r.Ztkrr�r�r�r�rs
zTurtleScreenBase.mainloopcCstj|||jd�S)a�Pop up a dialog window for input of a string.

        Arguments: title is the title of the dialog window,
        prompt is a text mostly describing what information to input.

        Return the string input
        If the dialog is canceled, return None.

        Example (for a TurtleScreen instance named screen):
        >>> screen.textinput("NIM", "Name of first player:")

        )�parent)rZ	askstringr.)r�r)�promptr�r�r�r(.s
zTurtleScreenBase.textinputcCstj||||||jd�S)a�Pop up a dialog window for input of a number.

        Arguments: title is the title of the dialog window,
        prompt is a text mostly describing what numerical information to input.
        default: default value
        minval: minimum value for input
        maxval: maximum value for input

        The number input must be in the range minval .. maxval if these are
        given. If not, a hint is issued and the dialog remains open for
        correction. Return the number input.
        If the dialog is canceled,  return None.

        Example (for a TurtleScreen instance named screen):
        >>> screen.numinput("Poker", "Your stakes:", 1000, minval=10, maxval=10000)

        )ZinitialvalueZminvalueZmaxvaluer�)rZaskfloatr.)r�r)r��defaultZminvalZmaxvalr�r�r�r=s

�zTurtleScreenBase.numinput)NNNF)NNNF)N)r�N)r�N)r�N)r�N)N)NNN)NNN)%r�r�r�r�r0r2r�r:rCrDrErIrJrMrOrPrXrerfrgrirmrnrorrrurwrxryr�r�r�r�r�rr(rr�r�r�r�r,�sT
�
�


	





r,c@seZdZdZdS)r�z�Will be raised in TurtleScreen.update, if _RUNNING becomes False.

    This stops execution of a turtle graphics script.
    Main purpose: use in the Demo-Viewer turtle.Demo.py.
    N�r�r�r�r�r�r�r�r�r�Ysc@seZdZdZdS)�TurtleGraphicsErrorzSome TurtleGraphics Error
    Nr�r�r�r�r�r�bsr�c@s$eZdZdZddd�Zddd�ZdS)	rz�Data structure modeling shapes.

    attribute _type is one of "polygon", "image", "compound"
    attribute _data is - depending on _type a poygon-tuple,
    an image or a list constructed using the addcomponent method.
    NcCsz||_|dkr"t|t�rpt|�}nN|dkrVt|t�rp|���d�rpt|�rpt�	|�}n|dkrdg}nt
d|��||_dS)N�polygonrt�.gif�compoundzThere is no shape type %s)ryr�r�r�r��lower�endswithrrr2r��_data)r�Ztype_�datar�r�r�r�ns


zShape.__init__cCs:|jdkrtd|j��|dkr$|}|j�|||g�dS)a-Add component to a shape of type compound.

        Arguments: poly is a polygon, i. e. a tuple of number pairs.
        fill is the fillcolor of the component,
        outline is the outline color of the component.

        call (for a Shapeobject namend s):
        --   s.addcomponent(((0,0), (10,10), (-10,10)), "red", "blue")

        Example:
        >>> poly = ((0,0),(10,-5),(0,10),(-10,-5))
        >>> s = Shape("compound")
        >>> s.addcomponent(poly, "red", "blue")
        >>> # .. add more components and then use register_shape()
        r�z Cannot add component to %s ShapeN)ryr�r�r>)r��polyr"r9r�r�r��addcomponent~s
�zShape.addcomponent)N)N)r�r�r�r�r�r�r�r�r�r�rgs
c@sDeZdZdZddd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�Tbufferz5Ring buffer used as undobuffer for RawTurtle objects.r�cCs$||_dgg||_d|_d|_dS)Nr�F)�bufsize�buffer�ptr�cumulate)r�r�r�r�r�r��szTbuffer.__init__NcCsD|dkr&t|j�D]}dg|j|<qn||_dgg||_d|_dS)Nr�)rr�r�r�)r�r�r|r�r�r�r`�sz
Tbuffer.resetcCsF|jdkrB|js0|jd|j|_||j|j<n|j|j�|�dSr�)r�r�r�r�r>rGr�r�r��push�s

zTbuffer.pushcCsJ|jdkrF|j|j}|dkr"dSdg|j|j<|jd|j|_|SdSr�)r�r�r�rGr�r�r��pop�s
zTbuffer.popcCs|j|j�dg�Sr�)r�r��countr�r�r�r��nr_of_items�szTbuffer.nr_of_itemscCst|j�dt|j�S)N� )r�r�r�r�r�r�r�r��szTbuffer.__repr__)r�)N)
r�r�r�r�r�r`r�r�r�r�r�r�r�r�r��s

	r�c@s"eZdZdZdZedededfdd�Zdd	�Zd=dd�Zd
d�Z	d>dd�Z
dd�Zdd�Zd?dd�Z
dd�Zdd�Zdd�Zd@dd�ZdAdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�ZdBd.d/�Zd0d1�ZdCd2d3�ZdDd4d5�ZdEd7d8�ZdFd9d:�ZdGd;d<�ZeZ eZ!eZ"e
Z#eZ$d
S)Hrz�Provides screen oriented methods like setbg etc.

    Only relies upon the methods of TurtleScreenBase and NOT
    upon components of the underlying graphics toolkit -
    which is Tkinter in this case.
    Trrrc
Cs�t�||�tdd�tdd�tdd�tdd�tdd�tdd�td|���d	�|_d
di|_||_||_td|_	g|_
|��tj
d
kr�|��}|�ddddd�|�ddddd�dS)Nr�)����r�r�r�rr�))r�)����)r�r�)����)����	)����)����)r�r�)������)���r�)r�r�)r�r��rr�)�r�)�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�)��Q�#@���Q�@)�G�z. @��Q��@)r�r�)r�r�r�)���Q��r�)��Q���r�)�G�z. �r�)��Q�#�r�r�)r�r�)r�r�)r�r�)r�r�)g�g$�)r�r�)r�r�)r�r�)r�r�))r�r�)r�r�)r�r�)r�r�))r���G�z�)rg�����'@)r�r�)�rr)r�r�r�)r�r�rt)Zarrowr�r4ZsquareZtriangler�r/�nopicr�r�darwinZwmZ
attributesr�z-topmost�1�0)r,r�rr0�_shapes�_bgpics�_mode�_delayvaluer��
_colormode�_keysr5�sys�platformr�Zcall)r�r.rrrZ
rootwindowr�r�r�r��s&�


zTurtleScreen.__init__cCs�td|_td|_|�d�|�d�|_d|_d|_d|_g|_	|�
d�d	D]}|�d
|�qP|�d
�|j
d
d
�D]}|�d
|�|�d
|�qzd
t_d
S)aqDelete all drawings and all turtles from the TurtleScreen.

        No argument.

        Reset empty TurtleScreen to its initial state: white background,
        no backgroundimage, no eventbindings and tracing on.

        Example (for a TurtleScreen instance named screen):
        >>> screen.clear()

        Note: this method is not available as function.
        rr�allr�r�r�rr�)r�r��N)r�r�r�rIru�_bgpic�
_bgpicname�_tracing�_updatecounter�_turtlesrrRrr�rr�_pen)r��btnr�r�r�r�r5�s 




zTurtleScreen.clearNcCs||dkr|jS|��}|dkr*td|��||_|dkrp|�|jd|jd|jd|jd�d|_|_|��dS)ahSet turtle-mode ('standard', 'logo' or 'world') and perform reset.

        Optional argument:
        mode -- one of the strings 'standard', 'logo' or 'world'

        Mode 'standard' is compatible with turtle.py.
        Mode 'logo' is compatible with most Logo-Turtle-Graphics.
        Mode 'world' uses userdefined 'worldcoordinates'. *Attention*: in
        this mode angles appear distorted if x/y unit-ratio doesn't equal 1.
        If mode is not given, return the current mode.

             Mode      Initial turtle heading     positive angles
         ------------|-------------------------|-------------------
          'standard'    to the right (east)       counterclockwise
            'logo'        upward    (north)         clockwise

        Examples:
        >>> mode('logo')   # resets turtle heading to north
        >>> mode()
        'logo'
        N�r��logo�worldzNo turtle-graphics-mode %s)r�r�r�r�)	r�r�r�r�r�r�r4r5r`�r�rr�r�r�rs�zTurtleScreen.modecCs�|��dkr|�d�t||�}t||�}|��\}}|�|d|d�|j|j}	}
|j||_|j||_||j}||j}|j|}
|j|}|�|||
|�|�	|j|	|j|
�|�
�dS)asSet up a user defined coordinate-system.

        Arguments:
        llx -- a number, x-coordinate of lower left corner of canvas
        lly -- a number, y-coordinate of lower left corner of canvas
        urx -- a number, x-coordinate of upper right corner of canvas
        ury -- a number, y-coordinate of upper right corner of canvas

        Set up user coodinat-system and switch to mode 'world' if necessary.
        This performs a screen.reset. If mode 'world' is already active,
        all drawings are redrawn according to the new coordinates.

        But ATTENTION: in user-defined coordinatesystems angles may appear
        distorted. (see Screen.mode())

        Example (for a TurtleScreen instance named screen):
        >>> screen.setworldcoordinates(-10,-0.5,50,1.5)
        >>> for _ in range(36):
        ...     left(10)
        ...     forward(0.5)
        r��N)rr�r�r%r4r5r�r�r�r�r,)r�ZllxZllyZurxZuryZxspanZyspanZwxZwyZ	oldxscaleZ	oldyscaler�r�r�r�r�r�r�r'-s 



z TurtleScreen.setworldcoordinatescCsT|dkr2|���d�r(td|�|��}qFtd��nt|t�rFtd|�}||j|<dS)a�Adds a turtle shape to TurtleScreen's shapelist.

        Arguments:
        (1) name is the name of a gif-file and shape is None.
            Installs the corresponding image shape.
            !! Image-shapes DO NOT rotate when turning the turtle,
            !! so they do not display the heading of the turtle!
        (2) name is an arbitrary string and shape is a tuple
            of pairs of coordinates. Installs the corresponding
            polygon shape
        (3) name is an arbitrary string and shape is a
            (compound) Shape object. Installs the corresponding
            compound shape.
        To use a shape, you have to issue the command shape(shapename).

        call: register_shape("turtle.gif")
        --or: register_shape("tri", ((0,0), (10,10), (-10,10)))

        Example (for a TurtleScreen instance named screen):
        >>> screen.register_shape("triangle", ((5,-3),(0,5),(-5,-3)))

        Nr�rtz;Bad arguments for register_shape.
Use  help(register_shape)r�)r�r�rr2r�r�r�r�)r��namerkr�r�r�r#Ts


zTurtleScreen.register_shapec	Cst|�dkr|d}t|t�rD|�|�s0|dkr4|Stdt|���z|\}}}Wn(ttfk
rztdt|���YnX|jdkr�dd�|||fD�\}}}d|kr�d	kr�nn.d|kr�d	kr�nnd|kr�d	ks�ntd
t|���d|||fS)aReturn color string corresponding to args.

        Argument may be a string or a tuple of three
        numbers corresponding to actual colormode,
        i.e. in the range 0<=n<=colormode.

        If the argument doesn't represent a color,
        an error is raised.
        r�rr�zbad color string: %s�bad color arguments: %sr�cSsg|]}td|��qS�g�o@��round�r{r�r�r�r�r~�sz*TurtleScreen._colorstr.<locals>.<listcomp>��bad color sequence: %s�
#%02x%02x%02x)r�r�r�rOr��	TypeErrorr�r�)r�r9r��g�br�r�r��	_colorstrws


FzTurtleScreen._colorstrcsx��d�s�St��dkr.�fdd�dD�}n4t��dkrV�fdd��dd�D�}ntd	���t�fd
d�|D��S)Nr�r�cs"g|]}t�||d�d��qS)r�r��r�rz��cstrr�r�r~�sz'TurtleScreen._color.<locals>.<listcomp>)r�r�r�r�csg|]}dt�|d��qS)r�r�)r{r7r�r�r�r~�sr�zbad colorstring: %sc3s|]}|�jdVqdS)r�N)r�)r{r�r�r�r��	<genexpr>�sz&TurtleScreen._color.<locals>.<genexpr>)r�r�r�r�)r�r�rBr�)r�r�r��_color�s
zTurtleScreen._colorcCs8|dkr|jS|dkr"t|�|_n|dkr4t|�|_dS)aqReturn the colormode or set it to 1.0 or 255.

        Optional argument:
        cmode -- one of the values 1.0 or 255

        r, g, b values of colortriples have to be in range 0..cmode.

        Example (for a TurtleScreen instance named screen):
        >>> screen.colormode()
        1.0
        >>> screen.colormode(255)
        >>> pencolor(240,160,80)
        Nr�r�)r�r�r�)r�Zcmoder�r�r�r�szTurtleScreen.colormodecCs$|jD]}|�|j�|��qdS)z�Reset all Turtles on the Screen to their initial state.

        No argument.

        Example (for a TurtleScreen instance named screen):
        >>> screen.reset()
        N)r��_setmoder�r`)r�r�r�r�r�r`�s
zTurtleScreen.resetcCs|jS)z�Return the list of turtles on the screen.

        Example (for a TurtleScreen instance named screen):
        >>> screen.turtles()
        [<turtle.Turtle object at 0x00E11FB0>]
        )r�r�r�r�r�r+�szTurtleScreen.turtlescGs4|r|�|�}nd}|�|�}|dk	r0|�|�}|S)a�Set or return backgroundcolor of the TurtleScreen.

        Arguments (if given): a color string or three numbers
        in the range 0..colormode or a 3-tuple of such numbers.

        Example (for a TurtleScreen instance named screen):
        >>> screen.bgcolor("orange")
        >>> screen.bgcolor()
        'orange'
        >>> screen.bgcolor(0.5,0,0.5)
        >>> screen.bgcolor()
        '#800080'
        N)r�rPr��r�rr9r�r�r�r�s

zTurtleScreen.bgcolorcCsB|dkr|jSt|�|_d|_|dk	r0t|�|_|jr>|��dS)aeTurns turtle animation on/off and set delay for update drawings.

        Optional arguments:
        n -- nonnegative  integer
        delay -- nonnegative  integer

        If n is given, only each n-th regular screen update is really performed.
        (Can be used to accelerate the drawing of complex graphics.)
        Second arguments sets delay value (see RawTurtle.delay())

        Example (for a TurtleScreen instance named screen):
        >>> screen.tracer(8, 25)
        >>> dist = 2
        >>> for i in range(200):
        ...     fd(dist)
        ...     rt(90)
        ...     dist += 2
        Nr)r�r�r�r�r,)r��nrr�r�r�r*�s

zTurtleScreen.tracercCs|dkr|jSt|�|_dS)z� Return or set the drawing delay in milliseconds.

        Optional argument:
        delay -- positive integer

        Example (for a TurtleScreen instance named screen):
        >>> screen.delay(15)
        >>> screen.delay()
        15
        N)r�r�rLr�r�r�r�szTurtleScreen.delaycCs<tjsdt_t�|jdkr8|jd7_|j|j;_dS)zIncrement update counter.Trr�N)r�_RUNNINGr�r�r�r�r�r�r��
_incrementudc	s
zTurtleScreen._incrementudccCs<|j}d|_|��D]}|��|��q||_|��dS)z'Perform a TurtleScreen update.
        TN)r�r+�_update_data�_drawturtlerJ)r��tracingrqr�r�r�r,s
zTurtleScreen.updatecCs|��dS)z� Return the width of the turtle window.

        Example (for a TurtleScreen instance named screen):
        >>> screen.window_width()
        640
        r�r�r�r�r�r�r.szTurtleScreen.window_widthcCs|��dS)z� Return the height of the turtle window.

        Example (for a TurtleScreen instance named screen):
        >>> screen.window_height()
        480
        r�r�r�r�r�r�r-&szTurtleScreen.window_heightcCs|jS)z�Return the Canvas of this TurtleScreen.

        No argument.

        Example (for a Screen instance named screen):
        >>> cv = screen.getcanvas()
        >>> cv
        <turtle.ScrolledCanvas instance at 0x010742D8>
        )r.r�r�r�r�r/s
zTurtleScreen.getcanvascCst|j���S)z�Return a list of names of all currently available turtle shapes.

        No argument.

        Example (for a TurtleScreen instance named screen):
        >>> screen.getshapes()
        ['arrow', 'blank', 'circle', ... , 'turtle']
        )�sortedr�r�r�r�r�r�r;s	zTurtleScreen.getshapesr�cCs|�|||�dS)a�Bind fun to mouse-click event on canvas.

        Arguments:
        fun -- a function with two arguments, the coordinates of the
               clicked point on the canvas.
        btn -- the number of the mouse-button, defaults to 1

        Example (for a TurtleScreen instance named screen)

        >>> screen.onclick(goto)
        >>> # Subsequently clicking into the TurtleScreen will
        >>> # make the turtle move to the clicked point.
        >>> screen.onclick(None)
        N)ri�r�r_r�rdr�r�r�rRFszTurtleScreen.onclickcCsF|dkr ||jkr6|j�|�n||jkr6|j�|�|�||�dS)amBind fun to key-release event of key.

        Arguments:
        fun -- a function with no arguments
        key -- a string: key (e.g. "a") or key-symbol (e.g. "space")

        In order to be able to register key-events, TurtleScreen
        must have focus. (See method listen.)

        Example (for a TurtleScreen instance named screen):

        >>> def f():
        ...     fd(50)
        ...     lt(60)
        ...
        >>> screen.onkey(f, "Up")
        >>> screen.listen()

        Subsequently the turtle can be moved by repeatedly pressing
        the up-arrow key, consequently drawing a hexagon

        N)r��remover>rm�r�r_r�r�r�r�rWs

zTurtleScreen.onkeycCsN|dkr ||jkr>|j�|�n|dk	r>||jkr>|j�|�|�||�dS)aBind fun to key-press event of key if key is given,
        or to any key-press-event if no key is given.

        Arguments:
        fun -- a function with no arguments
        key -- a string: key (e.g. "a") or key-symbol (e.g. "space")

        In order to be able to register key-events, TurtleScreen
        must have focus. (See method listen.)

        Example (for a TurtleScreen instance named screen
        and a Turtle instance named turtle):

        >>> def f():
        ...     fd(50)
        ...     lt(60)
        ...
        >>> screen.onkeypress(f, "Up")
        >>> screen.listen()

        Subsequently the turtle can be moved by repeatedly pressing
        the up-arrow key, or by keeping pressed the up-arrow key.
        consequently drawing a hexagon.
        N)r�r�r>rnr�r�r�r�rus
zTurtleScreen.onkeypresscCs|��dS)aSet focus on TurtleScreen (in order to collect key-events)

        No arguments.
        Dummy arguments are provided in order
        to be able to pass listen to the onclick method.

        Example (for a TurtleScreen instance named screen):
        >>> screen.listen()
        N)ro)r��xdummy�ydummyr�r�r�r�s
zTurtleScreen.listenrcCs|�||�dS)a�Install a timer, which calls fun after t milliseconds.

        Arguments:
        fun -- a function with no arguments.
        t -- a number >= 0

        Example (for a TurtleScreen instance named screen):

        >>> running = True
        >>> def f():
        ...     if running:
        ...             fd(50)
        ...             lt(60)
        ...             screen.ontimer(f, 250)
        ...
        >>> f()   # makes the turtle marching around
        >>> running = False
        N)rrrpr�r�r�r"�szTurtleScreen.ontimercCsF|dkr|jS||jkr(|�|�|j|<|�|j|j|�||_dS)aFSet background image or return name of current backgroundimage.

        Optional argument:
        picname -- a string, name of a gif-file or "nopic".

        If picname is a filename, set the corresponding image as background.
        If picname is "nopic", delete backgroundimage, if present.
        If picname is None, return the filename of the current backgroundimage.

        Example (for a TurtleScreen instance named screen):
        >>> screen.bgpic()
        'nopic'
        >>> screen.bgpic("landscape.gif")
        >>> screen.bgpic()
        'landscape.gif'
        N)r�r�r2rxr�)r�Zpicnamer�r�r�r�s
zTurtleScreen.bgpiccCs|�|||�S)a�Resize the canvas the turtles are drawing on.

        Optional arguments:
        canvwidth -- positive integer, new width of canvas in pixels
        canvheight --  positive integer, new height of canvas in pixels
        bg -- colorstring or color-tuple, new backgroundcolor
        If no arguments are given, return current (canvaswidth, canvasheight)

        Do not alter the drawing window. To observe hidden parts of
        the canvas use the scrollbars. (Can make visible those parts
        of a drawing, which were outside the canvas before!)

        Example (for a Turtle instance named turtle):
        >>> turtle.screensize(2000,1500)
        >>> # e.g. to search for an erroneously escaped turtle ;-)
        )r�rr�r�r�r%�szTurtleScreen.screensize)N)N)N)NN)N)r�N)N)NN)r)N)NNN)%r�r�r�r�r�r�r�r5rr'r#r�r�rr`r+rr*rr�r,r.r-rrrRrrrr"rr%r!r$rrr r�r�r�r�r�sH�
(
"'
#
	

			

 



c@sTeZdZdZedd�edd�edd�d�ZdZdZdZefdd	�Z	d
d�Z
dBd
d�Zdd�ZdCdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�ZdDd*d+�Zd,d-�Zd.d/�Zd0d1�ZdEd2d3�ZdFd4d5�Zd6d7�Zd8d9�Z dGd:d;�Z!dHd<d=�Z"dId>d?�Z#dJd@dA�Z$eZ%eZ&eZ'eZ(eZ)eZ*eZ+eZ,e Z-dS)K�
TNavigatorzRNavigation part of the RawTurtle.
    Implements methods for turtle movement.
    r��)r�r�r�r�rr�cCsB|j|_|j|_||_d|_|��d|_|�|�t�	|�dSr�)
�DEFAULT_ANGLEOFFSET�_angleOffset�DEFAULT_ANGLEORIENT�_angleOrientr��
undobufferr:r�r�r`r�r�r�r�r��s
zTNavigator.__init__cCstdd�|_tj|j|_dS)zXreset turtle to its initial values

        Will be overwritten by parent class
        r�N)r�	_positionr��START_ORIENTATIONr��_orientr�r�r�r�r`�szTNavigator.resetNcCsL|dkr|jS|dkrdS||_|dkr6d|_d|_n|jd|_d|_dS)z:Set turtle-mode to 'standard', 'world' or 'logo'.
        Nr�)r�r�rr��@r�)r�rr�_fullcircler�r�r�r�r�szTNavigator._setmodecCs0||_d||_|jdkr"d|_n
|d|_dS)z+Helper function for degrees() and radians()ihr�rrN)r�
_degreesPerAUr�r�r�Z
fullcircler�r�r��_setDegreesPerAUs


zTNavigator._setDegreesPerAU��v@cCs|�|�dS)a> Set angle measurement units to degrees.

        Optional argument:
        fullcircle -  a number

        Set angle measurement units, i. e. set number
        of 'degrees' for a full circle. Default value is
        360 degrees.

        Example (for a Turtle instance named turtle):
        >>> turtle.left(90)
        >>> turtle.heading()
        90

        Change angle measurement unit to grad (also known as gon,
        grade, or gradian and equals 1/100-th of the right angle.)
        >>> turtle.degrees(400.0)
        >>> turtle.heading()
        100

        N)rr
r�r�r�r:szTNavigator.degreescCs|�dtj�dS)a Set the angle measurement units to radians.

        No arguments.

        Example (for a Turtle instance named turtle):
        >>> turtle.heading()
        90
        >>> turtle.radians()
        >>> turtle.heading()
        1.5707963267948966
        r�N)rr�r�r�r�r�r�r^5szTNavigator.radianscCs|j|j|}|�|�dS)z)move turtle forward by specified distanceN)rr�_goto)r�r;Zender�r�r��_goCszTNavigator._gocCs||j9}|j�|�|_dS)z=Turn turtle counterclockwise by specified angle if angle > 0.N)r	rr��r�r�r�r�r��_rotateHs
zTNavigator._rotatecCs
||_dS)zmove turtle to position end.N�r)r��endr�r�r�r
MszTNavigator._gotocCs|�|�dS)aMove the turtle forward by the specified distance.

        Aliases: forward | fd

        Argument:
        distance -- a number (integer or float)

        Move the turtle forward by the specified distance, in the direction
        the turtle is headed.

        Example (for a Turtle instance named turtle):
        >>> turtle.position()
        (0.00, 0.00)
        >>> turtle.forward(25)
        >>> turtle.position()
        (25.00,0.00)
        >>> turtle.forward(-75)
        >>> turtle.position()
        (-50.00,0.00)
        N�r�r�r;r�r�r�rCQszTNavigator.forwardcCs|�|�dS)a�Move the turtle backward by distance.

        Aliases: back | backward | bk

        Argument:
        distance -- a number

        Move the turtle backward by distance, opposite to the direction the
        turtle is headed. Do not change the turtle's heading.

        Example (for a Turtle instance named turtle):
        >>> turtle.position()
        (0.00, 0.00)
        >>> turtle.backward(30)
        >>> turtle.position()
        (-30.00, 0.00)
        Nrrr�r�r�r/hszTNavigator.backcCs|�|�dS)a�Turn turtle right by angle units.

        Aliases: right | rt

        Argument:
        angle -- a number (integer or float)

        Turn turtle right by angle units. (Units are by default degrees,
        but can be set via the degrees() and radians() functions.)
        Angle orientation depends on mode. (See this.)

        Example (for a Turtle instance named turtle):
        >>> turtle.heading()
        22.0
        >>> turtle.right(45)
        >>> turtle.heading()
        337.0
        N�rrr�r�r�r_|szTNavigator.rightcCs|�|�dS)a�Turn turtle left by angle units.

        Aliases: left | lt

        Argument:
        angle -- a number (integer or float)

        Turn turtle left by angle units. (Units are by default degrees,
        but can be set via the degrees() and radians() functions.)
        Angle orientation depends on mode. (See this.)

        Example (for a Turtle instance named turtle):
        >>> turtle.heading()
        22.0
        >>> turtle.left(45)
        >>> turtle.heading()
        67.0
        Nrrr�r�r�rP�szTNavigator.leftcCs|jS)z�Return the turtle's current location (x,y), as a Vec2D-vector.

        Aliases: pos | position

        No arguments.

        Example (for a Turtle instance named turtle):
        >>> turtle.pos()
        (0.00, 240.00)
        rr�r�r�r�r[�szTNavigator.poscCs
|jdS)z� Return the turtle's x coordinate.

        No arguments.

        Example (for a Turtle instance named turtle):
        >>> reset()
        >>> turtle.left(60)
        >>> turtle.forward(100)
        >>> print turtle.xcor()
        50.0
        rrr�r�r�r�r|�szTNavigator.xcorcCs
|jdS)a	 Return the turtle's y coordinate
        ---
        No arguments.

        Example (for a Turtle instance named turtle):
        >>> reset()
        >>> turtle.left(60)
        >>> turtle.forward(100)
        >>> print turtle.ycor()
        86.6025403784
        r�rr�r�r�r�r}�szTNavigator.ycorcCs,|dkr|�t|��n|�t||��dS)atMove turtle to an absolute position.

        Aliases: setpos | setposition | goto:

        Arguments:
        x -- a number      or     a pair/vector of numbers
        y -- a number             None

        call: goto(x, y)         # two coordinates
        --or: goto((x, y))       # a pair (tuple) of coordinates
        --or: goto(vec)          # e.g. as returned by pos()

        Move turtle to an absolute position. If the pen is down,
        a line will be drawn. The turtle's orientation does not change.

        Example (for a Turtle instance named turtle):
        >>> tp = turtle.pos()
        >>> tp
        (0.00, 0.00)
        >>> turtle.setpos(60,30)
        >>> turtle.pos()
        (60.00,30.00)
        >>> turtle.setpos((20,80))
        >>> turtle.pos()
        (20.00,80.00)
        >>> turtle.setpos(tp)
        >>> turtle.pos()
        (0.00,0.00)
        N)r
r)r�r�r�r�r�r�rI�szTNavigator.gotocCs|�dd�|�d�dS)a$Move turtle to the origin - coordinates (0,0).

        No arguments.

        Move turtle to the origin - coordinates (0,0) and set its
        heading to its start-orientation (which depends on mode).

        Example (for a Turtle instance named turtle):
        >>> turtle.home()
        rN)rIrdr�r�r�r�rL�szTNavigator.homecCs|�t||jd��dS)a�Set the turtle's first coordinate to x

        Argument:
        x -- a number (integer or float)

        Set the turtle's first coordinate to x, leave second coordinate
        unchanged.

        Example (for a Turtle instance named turtle):
        >>> turtle.position()
        (0.00, 240.00)
        >>> turtle.setx(10)
        >>> turtle.position()
        (10.00, 240.00)
        r�N�r
rr)r�r�r�r�r�riszTNavigator.setxcCs|�t|jd|��dS)a�Set the turtle's second coordinate to y

        Argument:
        y -- a number (integer or float)

        Set the turtle's first coordinate to x, second coordinate remains
        unchanged.

        Example (for a Turtle instance named turtle):
        >>> turtle.position()
        (0.00, 40.00)
        >>> turtle.sety(-10)
        >>> turtle.position()
        (0.00, -10.00)
        rNr)r�r�r�r�r�rjszTNavigator.setycCsT|dk	rt||�}t|t�r"|}n$t|t�r6t|�}nt|t�rF|j}t||j�S)a�Return the distance from the turtle to (x,y) in turtle step units.

        Arguments:
        x -- a number   or  a pair/vector of numbers   or   a turtle instance
        y -- a number       None                            None

        call: distance(x, y)         # two coordinates
        --or: distance((x, y))       # a pair (tuple) of coordinates
        --or: distance(vec)          # e.g. as returned by pos()
        --or: distance(mypen)        # where mypen is another turtle

        Example (for a Turtle instance named turtle):
        >>> turtle.pos()
        (0.00, 0.00)
        >>> turtle.distance(30,40)
        50.0
        >>> pen = Turtle()
        >>> pen.forward(77)
        >>> turtle.distance(pen)
        77.0
        N)rr�r�r�r�abs)r�r�r�r[r�r�r�r;%s




zTNavigator.distancecCs�|dk	rt||�}t|t�r"|}n$t|t�r6t|�}nt|t�rF|j}||j\}}tt�||�dtjd�d}||j	}|j
|j||jS)aCReturn the angle of the line from the turtle's position to (x, y).

        Arguments:
        x -- a number   or  a pair/vector of numbers   or   a turtle instance
        y -- a number       None                            None

        call: distance(x, y)         # two coordinates
        --or: distance((x, y))       # a pair (tuple) of coordinates
        --or: distance(vec)          # e.g. as returned by pos()
        --or: distance(mypen)        # where mypen is another turtle

        Return the angle, between the line from turtle-position to position
        specified by x, y and the turtle's start orientation. (Depends on
        modes - "standard" or "logo")

        Example (for a Turtle instance named turtle):
        >>> turtle.pos()
        (10.00, 10.00)
        >>> turtle.towards(0,0)
        225.0
        Nr�r�r)
rr�r�r�rr�r��atan2r�r	rrr)r�r�r�r[�resultr�r�r�ruEs




 
zTNavigator.towardscCsJ|j\}}tt�||�dtjd�d}||j}|j|j||jS)z� Return the turtle's current heading.

        No arguments.

        Example (for a Turtle instance named turtle):
        >>> turtle.left(67)
        >>> turtle.heading()
        67.0
        r�r�r)	rr�r�rr�r	rrr)r�r�r�rr�r�r�rJhs

 
zTNavigator.headingcCs>||��|j}|j}||d||d}|�|�dS)a�Set the orientation of the turtle to to_angle.

        Aliases:  setheading | seth

        Argument:
        to_angle -- a number (integer or float)

        Set the orientation of the turtle to to_angle.
        Here are some common directions in degrees:

         standard - mode:          logo-mode:
        -------------------|--------------------
           0 - east                0 - north
          90 - north              90 - east
         180 - west              180 - south
         270 - south             270 - west

        Example (for a Turtle instance named turtle):
        >>> turtle.setheading(90)
        >>> turtle.heading()
        90
        �@N)rJrrr)r�Zto_angler�Zfullr�r�r�rdwszTNavigator.setheadingcCsp|jr|j�dg�d|j_|��}|dkr2|j}|dkrjt|�|j}dttdt|�dd�|�}d||}d	|}d
|t�	|tj
d|j�}|dkr�|||}}}|��}	|�
�}
|dkr�|�dd�n
|�d�|�|�t|�D].}|�|�|�|�|�d�|�|��q|�|�|dk�rR|�|	|
�|�|�|j�rld
|j_dS)a� Draw a circle with given radius.

        Arguments:
        radius -- a number
        extent (optional) -- a number
        steps (optional) -- an integer

        Draw a circle with given radius. The center is radius units left
        of the turtle; extent - an angle - determines which part of the
        circle is drawn. If extent is not given, draw the entire circle.
        If extent is not a full circle, one endpoint of the arc is the
        current pen position. Draw the arc in counterclockwise direction
        if radius is positive, otherwise in clockwise direction. Finally
        the direction of the turtle is changed by the amount of extent.

        As the circle is approximated by an inscribed regular polygon,
        steps determines the number of steps to use. If not given,
        it will be calculated automatically. Maybe used to draw regular
        polygons.

        call: circle(radius)                  # full circle
        --or: circle(radius, extent)          # arc
        --or: circle(radius, extent, steps)
        --or: circle(radius, steps=6)         # 6-sided polygon

        Example (for a Turtle instance named turtle):
        >>> turtle.circle(50)
        >>> turtle.circle(120, 180)  # semicircle
        �seqTNr��g@g�M@r�r�rr�rF)rr�r�rprrr��minr�r�r�r	�_tracerrMrrr)r��radiusZextent�stepsrpZfracr6Zw2�lZtrZdlr|r�r�r�r4�s>""






zTNavigator.circlecCsdS�z/dummy method - to be overwritten by child classNr�)r�r�r�r�r�rp�szTNavigator.speedcCsdSr"r�)r��ar�r�r�r�r�szTNavigator._tracercCsdSr"r�)r�r�r�r�r�rM�szTNavigator._delay)N)r)N)N)N)NN)r)NN)N).r�r�r�r�rrZDEFAULT_MODEr�rr�r`r�rr:r^rrr
rCr/r_rPr[r|r}rIrLrirjr;rurJrdr4rprrMr@r3r0rbrQr\rerfrcr�r�r�r�r��sZ�

	


#
 
#
A


r�c@s�eZdZdZedfdd�Zededfdd�Zd.d
d�Zd/dd
�Zdd�Z	dd�Z
dd�Zd0dd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd1d"d#�Zd2d%d&�Zd3d(d)�Zd*d+�Zd,d-�ZeZe	Ze	Ze
Ze
ZeZeZd	S)4�TPenzFDrawing part of the RawTurtle.
    Implements drawing properties.
    racCs||_d|_t�|�dSr�)�_resizemoderr$�_reset)r�rar�r�r�r��sz
TPen.__init__rWrAcCsFd|_d|_||_||_d|_d|_d|_d|_d|_d|_	d|_
dS)Nr�Tr�)r�r�r�)r�r�r�r�)�_pensize�_shown�	_pencolor�
_fillcolor�_drawing�_speed�_stretchfactor�_shearfactor�_tilt�_shapetrafo�
_outlinewidth)r�rWrAr�r�r�r&�szTPen._resetNcCs.|dkr|jS|��}|dkr*|j|d�dS)azSet resizemode to one of the values: "auto", "user", "noresize".

        (Optional) Argument:
        rmode -- one of the strings "auto", "user", "noresize"

        Different resizemodes have the following effects:
          - "auto" adapts the appearance of the turtle
                   corresponding to the value of pensize.
          - "user" adapts the appearance of the turtle according to the
                   values of stretchfactor and outlinewidth (outline),
                   which are set by shapesize()
          - "noresize" no adaption of the turtle's appearance takes place.
        If no argument is given, return current resizemode.
        resizemode("user") is called by a call of shapesize with arguments.


        Examples (for a Turtle instance named turtle):
        >>> turtle.resizemode("noresize")
        >>> turtle.resizemode()
        'noresize'
        N)�auto�userr��ra)r%r�rV)r�Zrmoder�r�r�ra�s
zTPen.resizemodecCs|dkr|jS|j|d�dS)a!Set or return the line thickness.

        Aliases:  pensize | width

        Argument:
        width -- positive number

        Set the line thickness to width or return it. If resizemode is set
        to "auto" and turtleshape is a polygon, that polygon is drawn with
        the same line thickness. If no argument is given, current pensize
        is returned.

        Example (for a Turtle instance named turtle):
        >>> turtle.pensize()
        1
        >>> turtle.pensize(10)   # from here on lines of width 10 are drawn
        N)rY)r'rV)r�rzr�r�r�rYszTPen.pensizecCs|js
dS|jdd�dS)z�Pull the pen up -- no drawing when moving.

        Aliases: penup | pu | up

        No argument

        Example (for a Turtle instance named turtle):
        >>> turtle.penup()
        NF�rX�r+rVr�r�r�r�rZ0s
z
TPen.penupcCs|jr
dS|jdd�dS)z�Pull the pen down -- drawing when moving.

        Aliases: pendown | pd | down

        No argument.

        Example (for a Turtle instance named turtle):
        >>> turtle.pendown()
        NTr5r6r�r�r�r�rX>s
zTPen.pendowncCs|jS)aReturn True if pen is down, False if it's up.

        No argument.

        Example (for a Turtle instance named turtle):
        >>> turtle.penup()
        >>> turtle.isdown()
        False
        >>> turtle.pendown()
        >>> turtle.isdown()
        True
        )r+r�r�r�r�rNLs
zTPen.isdowncCsjdddddd�}|dkr|jS||kr0||}n*d|krDd	krVnntt|��}nd}|j|d
�dS)a� Return or set the turtle's speed.

        Optional argument:
        speed -- an integer in the range 0..10 or a speedstring (see below)

        Set the turtle's speed to an integer value in the range 0 .. 10.
        If no argument is given: return current speed.

        If input is a number greater than 10 or smaller than 0.5,
        speed is set to 0.
        Speedstrings  are mapped to speedvalues in the following way:
            'fastest' :  0
            'fast'    :  10
            'normal'  :  6
            'slow'    :  3
            'slowest' :  1
        speeds from 1 to 10 enforce increasingly faster animation of
        line drawing and turtle turning.

        Attention:
        speed = 0 : *no* animation takes place. forward/back makes turtle jump
        and likewise left/right make the turtle turn instantly.

        Example (for a Turtle instance named turtle):
        >>> turtle.speed(3)
        rr�r�r�r�)ZfastestZfast�normalZslowZslowestNr�g%@)rp)r,r�r�rV)r�rpZspeedsr�r�r�rp[s
z
TPen.speedcGs�|rht|�}|dkr"|d}}n"|dkr4|\}}n|dkrD|}}|�|�}|�|�}|j||d�n|�|j�|�|j�fSdS)a�Return or set the pencolor and fillcolor.

        Arguments:
        Several input formats are allowed.
        They use 0, 1, 2, or 3 arguments as follows:

        color()
            Return the current pencolor and the current fillcolor
            as a pair of color specification strings as are returned
            by pencolor and fillcolor.
        color(colorstring), color((r,g,b)), color(r,g,b)
            inputs as in pencolor, set both, fillcolor and pencolor,
            to the given value.
        color(colorstring1, colorstring2),
        color((r1,g1,b1), (r2,g2,b2))
            equivalent to pencolor(colorstring1) and fillcolor(colorstring2)
            and analogously, if the other input format is used.

        If turtleshape is a polygon, outline and interior of that polygon
        is drawn with the newly set colors.
        For more info see: pencolor, fillcolor

        Example (for a Turtle instance named turtle):
        >>> turtle.color('red', 'green')
        >>> turtle.color()
        ('red', 'green')
        >>> colormode(255)
        >>> color((40, 80, 120), (160, 200, 240))
        >>> color()
        ('#285078', '#a0c8f0')
        r�rr�r�)rWrAN)r�r�rVr�r)r*)r�rr!ZpcolorZfcolorr�r�r�r9�s 


z
TPen.colorcGs:|r*|�|�}||jkrdS|j|d�n|�|j�SdS)aZ Return or set the pencolor.

        Arguments:
        Four input formats are allowed:
          - pencolor()
            Return the current pencolor as color specification string,
            possibly in hex-number format (see example).
            May be used as input to another color/pencolor/fillcolor call.
          - pencolor(colorstring)
            s is a Tk color specification string, such as "red" or "yellow"
          - pencolor((r, g, b))
            *a tuple* of r, g, and b, which represent, an RGB color,
            and each of r, g, and b are in the range 0..colormode,
            where colormode is either 1.0 or 255
          - pencolor(r, g, b)
            r, g, and b represent an RGB color, and each of r, g, and b
            are in the range 0..colormode

        If turtleshape is a polygon, the outline of that polygon is drawn
        with the newly set pencolor.

        Example (for a Turtle instance named turtle):
        >>> turtle.pencolor('brown')
        >>> tup = (0.2, 0.8, 0.55)
        >>> turtle.pencolor(tup)
        >>> turtle.pencolor()
        '#33cc8c'
        N)rW)r�r)rVr�r�r�r�r�rW�s

z
TPen.pencolorcGs:|r*|�|�}||jkrdS|j|d�n|�|j�SdS)a] Return or set the fillcolor.

        Arguments:
        Four input formats are allowed:
          - fillcolor()
            Return the current fillcolor as color specification string,
            possibly in hex-number format (see example).
            May be used as input to another color/pencolor/fillcolor call.
          - fillcolor(colorstring)
            s is a Tk color specification string, such as "red" or "yellow"
          - fillcolor((r, g, b))
            *a tuple* of r, g, and b, which represent, an RGB color,
            and each of r, g, and b are in the range 0..colormode,
            where colormode is either 1.0 or 255
          - fillcolor(r, g, b)
            r, g, and b represent an RGB color, and each of r, g, and b
            are in the range 0..colormode

        If turtleshape is a polygon, the interior of that polygon is drawn
        with the newly set fillcolor.

        Example (for a Turtle instance named turtle):
        >>> turtle.fillcolor('violet')
        >>> col = turtle.pencolor()
        >>> turtle.fillcolor(col)
        >>> turtle.fillcolor(0, .5, 0)
        N)rA)r�r*rVr�r�r�r�r�rA�s

zTPen.fillcolorcCs|jdd�dS)z�Makes the turtle visible.

        Aliases: showturtle | st

        No argument.

        Example (for a Turtle instance named turtle):
        >>> turtle.hideturtle()
        >>> turtle.showturtle()
        T��shownN�rVr�r�r�r�ro�szTPen.showturtlecCs|jdd�dS)aYMakes the turtle invisible.

        Aliases: hideturtle | ht

        No argument.

        It's a good idea to do this while you're in the
        middle of a complicated drawing, because hiding
        the turtle speeds up the drawing observably.

        Example (for a Turtle instance named turtle):
        >>> turtle.hideturtle()
        Fr8Nr:r�r�r�r�rK	szTPen.hideturtlecCs|jS)z�Return True if the Turtle is shown, False if it's hidden.

        No argument.

        Example (for a Turtle instance named turtle):
        >>> turtle.hideturtle()
        >>> print turtle.isvisible():
        False
        )r(r�r�r�r�rO	s
zTPen.isvisiblecKs�|j|j|j|j|j|j|j|j|j|j	|j
d�}|s>|s>|St|t�rN|}ni}|�
|�i}|D]}||||<qd|jr�|j�d|f�d}d|kr�|j|dkr�d}d|kr�t|dt�r�|�|df�|d<|j|dkr�d}d|k�r|j|dk�rd}|�r|��d|k�r&|d|_d|k�r:|d|_d|k�rN|d|_d|k�r�t|dt��r||�|df�|d<|d|_d	|k�r�|d	|_d
|k�r�|d
|_d|k�r�|d}t|ttf��r�||f}||_d|k�r�|d|_d
|k�r|d
|_	d|k�r|d|_d|k�r.|d|_
d|k�sLd|k�sLd|k�r�|j\}	}
|j}t�|j
�t�|j
�}}
|	|
|
||
||	||
|
||f|_|��dS)aLReturn or set the pen's attributes.

        Arguments:
            pen -- a dictionary with some or all of the below listed keys.
            **pendict -- one or more keyword-arguments with the below
                         listed keys as keywords.

        Return or set the pen's attributes in a 'pen-dictionary'
        with the following key/value pairs:
           "shown"      :   True/False
           "pendown"    :   True/False
           "pencolor"   :   color-string or color-tuple
           "fillcolor"  :   color-string or color-tuple
           "pensize"    :   positive number
           "speed"      :   number in range 0..10
           "resizemode" :   "auto" or "user" or "noresize"
           "stretchfactor": (positive number, positive number)
           "shearfactor":   number
           "outline"    :   positive number
           "tilt"       :   number

        This dictionary can be used as argument for a subsequent
        pen()-call to restore the former pen-state. Moreover one
        or more of these attributes can be provided as keyword-arguments.
        This can be used to set several pen attributes in one statement.


        Examples (for a Turtle instance named turtle):
        >>> turtle.pen(fillcolor="black", pencolor="red", pensize=10)
        >>> turtle.pen()
        {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
        'pencolor': 'red', 'pendown': True, 'fillcolor': 'black',
        'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}
        >>> penstate=turtle.pen()
        >>> turtle.color("yellow","")
        >>> turtle.penup()
        >>> turtle.pen()
        {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
        'pencolor': 'yellow', 'pendown': False, 'fillcolor': '',
        'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}
        >>> p.pen(penstate, fillcolor="green")
        >>> p.pen()
        {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
        'pencolor': 'red', 'pendown': True, 'fillcolor': 'green',
        'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}
        )r9rXrWrArYrpra�
stretchfactorrnr9rsrVFrXTrWrYrArprar;rnr9r9rsN)r(r+r)r*r'r,r%r-r.r1r/r��dictr,rr�r�r��_newLiner�r�r�r�r�r0rJ)r�rVZpendictZ_pd�pZ_p_bufr�ZnewLineZsfZscxZscyZshf�sa�car�r�r�rV!	s�/�

























�zTPen.penTcCsdSr"r��r�ZusePosr�r�r�r=�	sz
TPen._newLineFcCsdSr"r�)r�r�Zforcedr�r�r�rJ�	szTPen._updatecCsdSr"r�rr�r�r�r��	szTPen._colorcCsdSr"r�rr�r�r�r��	szTPen._colorstr)N)N)N)N)T)TF)r�r�r�r�r�r�r&rarYrZrXrNrpr9rWrArorKrOrVr=rJr�r�rzryr]rUr=rqrMr�r�r�r�r$�s:�



&.%$



r$c@s eZdZdZdd�Zdd�ZdS)�_TurtleImagez6Helper class: Datatype to store Turtle attributes
    cCs||_d|_|�|�dSr�)r�ry�	_setshape)r�r��
shapeIndexr�r�r�r��	sz_TurtleImage.__init__cs�|j�||_|jdkr*�j|jkr2nndS|jdkrP�j|jkrXnndS|jdkrp��|j�n |jdkr�|jD]}��|�q��j|j|_|jdkr����|_nF|jdkrԈ��jdj�|_n&|jdkr��fdd��j|jD�|_dS)Nr�rt)rtr�r�r/csg|]}����qSr��r:�r{rH�r�r�r�r~�	sz*_TurtleImage._setshape.<locals>.<listcomp>)	r�rDryr�rI�_itemr:rur�)r�rDrHr�rGr�rC�	s(""







�z_TurtleImage._setshapeN)r�r�r�r�r�rCr�r�r�r�rB�	srBc@s�eZdZdZgZdedededfdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dmdd�Zdd�Zdd�Zdd�Zdd�Zdnd d!�Zdod"d#�Zdpd$d%�Zd&d'�Zdqd(d)�Zd*d+�Zdrd,d-�Zd.d/�Zd0d1�Zdsd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z dtd=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dudFdG�Z%dHdI�Z&dJdK�Z'dLdM�Z(dvdNdO�Z)dPdQ�Z*dwdTdU�Z+dVdW�Z,dXdY�Z-dZd[�Z.d\d]�Z/d^d_�Z0e0Z1dxd`da�Z2dydcdd�Z3dzdedf�Z4d{dgdh�Z5didj�Z6dkdl�Z7eZ8dS)|r
zvAnimation part of the RawTurtle.
    Puts RawTurtle upon a TurtleScreen and provides tools for
    its animation.
    Nrkr�r�cCs4t|t�r||_n|t|t�r:|tjkr2tj�|�||_nTt|ttf�r�tjD]}|j	|krN||_q�qNt|�|_tj�|j�nt
d|��|j}t�||�
��t�|�|j�|�|��|_t||�|_d|_d|_d|_|_||_d|_|��|_|jg|_|jg|_g|_||_t |�|_!|�"�dS)Nzbad canvas argument %sF)#r��_Screenr�rr
�screensr>rr�r.r�r�r�rr$r�rD�drawingLineItemrBr��_poly�
_creatingPoly�	_fillitem�	_fillpathr(�_hidden_from_screen�currentLineItemr�currentLiner��
stampItems�_undobuffersizer�rrJ)r�Zcanvasrkr�r�r�r�r�r�r��	s@











zRawTurtle.__init__cCs0t�|�t�|�|��|��|��dS)a�Delete the turtle's drawings and restore its default values.

        No argument.

        Delete the turtle's drawings from the screen, re-center the turtle
        and set variables to the default values.

        Example (for a Turtle instance named turtle):
        >>> turtle.position()
        (0.00,-22.00)
        >>> turtle.heading()
        100.0
        >>> turtle.reset()
        >>> turtle.position()
        (0.00,0.00)
        >>> turtle.heading()
        0.0
        N)r�r`r$r&�_clearr�rJr�r�r�r�r`
s


zRawTurtle.resetcCs&|dks|dkrd|_n
t|�|_dS)a�Set or disable undobuffer.

        Argument:
        size -- an integer or None

        If size is an integer an empty undobuffer of given size is installed.
        Size gives the maximum number of turtle-actions that can be undone
        by the undo() function.
        If size is None, no undobuffer is present.

        Example (for a Turtle instance named turtle):
        >>> turtle.setundobuffer(42)
        Nr)rr�)r��sizer�r�r�rh
szRawTurtle.setundobuffercCs|jdkrdS|j��S)z�Return count of entries in the undobuffer.

        No argument.

        Example (for a Turtle instance named turtle):
        >>> while undobufferentries():
        ...     undo()
        Nr)rr�r�r�r�r�rx,
s	
zRawTurtle.undobufferentriescCsld|_|_|jD]}|j�|�q|j��|_g|_|jrJ|j�	|j
�|jg|_|��|�|j
�dS)zDelete all of pen's drawingsN)rNrOr�r�rIrDrQrRr+r>rr7rhrTrGr�r�r�rU9
s

zRawTurtle._clearcCs|��|��dS)agDelete the turtle's drawings from the screen. Do not move turtle.

        No arguments.

        Delete the turtle's drawings from the screen. Do not move turtle.
        State and position of the turtle as well as drawings of other
        turtles are not affected.

        Examples (for a Turtle instance named turtle):
        >>> turtle.clear()
        N)rUrJr�r�r�r�r5G
szRawTurtle.clearcCsF|j��|jjdkrdSt|j�dkrB|j�|j|j|j|j�dSr�)	r�r�r�r�rRrErQr)r'r�r�r�r�r�V
s
�zRawTurtle._update_datacCsx|j}|jdkrdS|jdkrD|��|��|��|�|j�n0|��|jdkrt|��D]}|��q^|��dS)z&Perform a Turtle-data update.
        rNr�)	r�r�r�r�rJrMr�r�r+)r�r�rqr�r�r�rJ^
s



zRawTurtle._updatecCs|j�||�S)amTurns turtle animation on/off and set delay for update drawings.

        Optional arguments:
        n -- nonnegative  integer
        delay -- nonnegative  integer

        If n is given, only each n-th regular screen update is really performed.
        (Can be used to accelerate the drawing of complex graphics.)
        Second arguments sets delay value (see RawTurtle.delay())

        Example (for a Turtle instance named turtle):
        >>> turtle.tracer(8, 25)
        >>> dist = 2
        >>> for i in range(200):
        ...     turtle.fd(dist)
        ...     turtle.rt(90)
        ...     dist += 2
        )r�r*)r��flagrr�r�r�rp
szRawTurtle._tracercCs|j�|�Sr�)r�r�rr�r�r�r��
szRawTurtle._colorcCs|j�|�Sr�)r�r�rr�r�r�r��
szRawTurtle._colorstrc	Cs�t|t�r|Sz|\}}}Wn(ttfk
rDtdt|���YnX|jjdkrldd�|||fD�\}}}d|kr�dkr�nn.d|kr�dkr�nnd|kr�dks�ntdt|���d|||fS)	z,Convert colortriples to hexstrings.
        r�r�cSsg|]}td|��qSr�r�r�r�r�r�r~�
sz!RawTurtle._cc.<locals>.<listcomp>rr�r�r�)r�r�r�r�r�r�r�)r�rr�r�r�r�r�r��_cc�
s
Fz
RawTurtle._cccs�|j�|�|j�|j}d|_d|_t|�}�|_||_�|_t�|jj�|_�j�|��j	|jjj
}|dkr����|j_nJ|dkr���
�j	dj�|j_n*|dkrʇfdd��j	|jjjD�|j_���|_|��|S)aCreate and return a clone of the turtle.

        No argument.

        Create and return a clone of the turtle with same position, heading
        and turtle properties.

        Example (for a Turtle instance named mick):
        mick = Turtle()
        joe = mick.clone()
        Nr�rtr/r�csg|]}����qSr�rErFrGr�r�r~�
sz#RawTurtle.clone.<locals>.<listcomp>)r�r=r+r�rrBrDr�r>r�ryr:rHrur�rDrQrJ)r�r��q�ttyper�rGr�r8�
s.
�

zRawTurtle.clonecCsB|dkr|jjS||j��kr*td|��|j�|�|��dS)a�Set turtle shape to shape with given name / return current shapename.

        Optional argument:
        name -- a string, which is a valid shapename

        Set turtle shape to shape with given name or, if name is not given,
        return name of current shape.
        Shape with name must exist in the TurtleScreen's shape dictionary.
        Initially there are the following polygon shapes:
        'arrow', 'turtle', 'circle', 'square', 'triangle', 'classic'.
        To learn about how to deal with shapes see Screen-method register_shape.

        Example (for a Turtle instance named turtle):
        >>> turtle.shape()
        'arrow'
        >>> turtle.shape("turtle")
        >>> turtle.shape()
        'turtle'
        NzThere is no shape named %s)r�rDr�rr�rCrJ)r�r�r�r�r�rk�
szRawTurtle.shapecCs�||kr|krdkr8nn|j\}}|||jfS|dksH|dkrPtd��|dk	rt|dkrj||f}q�||f}n|dk	r�|jd|f}n|j}|dkr�|j}|jd||d�dS)aOSet/return turtle's stretchfactors/outline. Set resizemode to "user".

        Optional arguments:
           stretch_wid : positive number
           stretch_len : positive number
           outline  : positive number

        Return or set the pen's attributes x/y-stretchfactors and/or outline.
        Set resizemode to "user".
        If and only if resizemode is set to "user", the turtle will be displayed
        stretched according to its stretchfactors:
        stretch_wid is stretchfactor perpendicular to orientation
        stretch_len is stretchfactor in direction of turtles orientation.
        outline determines the width of the shapes's outline.

        Examples (for a Turtle instance named turtle):
        >>> turtle.resizemode("user")
        >>> turtle.shapesize(5, 5, 12)
        >>> turtle.shapesize(outline=8)
        Nrz(stretch_wid/stretch_len must not be zeror3)rar;r9)r-r1r�rV)r�Zstretch_widZstretch_lenr9r;r�r�r�rl�
s$"


�zRawTurtle.shapesizecCs |dkr|jS|jd|d�dS)a�Set or return the current shearfactor.

        Optional argument: shear -- number, tangent of the shear angle

        Shear the turtleshape according to the given shearfactor shear,
        which is the tangent of the shear angle. DO NOT change the
        turtle's heading (direction of movement).
        If shear is not given: return the current shearfactor, i. e. the
        tangent of the shear angle, by which lines parallel to the
        heading of the turtle are sheared.

        Examples (for a Turtle instance named turtle):
        >>> turtle.shape("circle")
        >>> turtle.shapesize(5,2)
        >>> turtle.shearfactor(0.5)
        >>> turtle.shearfactor()
        >>> 0.5
        Nr3)rarn)r.rV)r�Zshearr�r�r�rnszRawTurtle.shearfactorcCs<||j|j}|tjddtj}|jd|d�dS)aIRotate the turtleshape to point in the specified direction

        Argument: angle -- number

        Rotate the turtleshape to point in the direction specified by angle,
        regardless of its current tilt-angle. DO NOT change the turtle's
        heading (direction of movement).


        Examples (for a Turtle instance named turtle):
        >>> turtle.shape("circle")
        >>> turtle.shapesize(5,2)
        >>> turtle.settiltangle(45)
        >>> stamp()
        >>> turtle.fd(50)
        >>> turtle.settiltangle(-45)
        >>> stamp()
        >>> turtle.fd(50)
        r�r�r3)rarsN)r	rr�r�rV�r�r�rsr�r�r�rgszRawTurtle.settiltanglecCs>|dkr0|jdtj|j}||j|jS|�|�dS)a�Set or return the current tilt-angle.

        Optional argument: angle -- number

        Rotate the turtleshape to point in the direction specified by angle,
        regardless of its current tilt-angle. DO NOT change the turtle's
        heading (direction of movement).
        If angle is not given: return the current tilt-angle, i. e. the angle
        between the orientation of the turtleshape and the heading of the
        turtle (its direction of movement).

        Deprecated since Python 3.1

        Examples (for a Turtle instance named turtle):
        >>> turtle.shape("circle")
        >>> turtle.shapesize(5,2)
        >>> turtle.tilt(45)
        >>> turtle.tiltangle()
        Nr�)r/r�r�rr	rrgr[r�r�r�rt4szRawTurtle.tiltanglecCs|�||���dS)a�Rotate the turtleshape by angle.

        Argument:
        angle - a number

        Rotate the turtleshape by angle from its current tilt-angle,
        but do NOT change the turtle's heading (direction of movement).

        Examples (for a Turtle instance named turtle):
        >>> turtle.shape("circle")
        >>> turtle.shapesize(5,2)
        >>> turtle.tilt(30)
        >>> turtle.fd(50)
        >>> turtle.tilt(30)
        >>> turtle.fd(50)
        N)rgrtrr�r�r�rsNszRawTurtle.tiltcCs6||kr(|kr(|kr(dkr2nn|jS|j\}}}}|dk	rL|}|dk	rX|}|dk	rd|}|dk	rp|}||||dkr�td��||||f|_t�||�dtj}	t�|	�t�|	�}
}|||
||||
||
||||
|||f\}}
}}||f|_|
||_|	|_	|j
dd�dS)a�Set or return the current transformation matrix of the turtle shape.

        Optional arguments: t11, t12, t21, t22 -- numbers.

        If none of the matrix elements are given, return the transformation
        matrix.
        Otherwise set the given elements and transform the turtleshape
        according to the matrix consisting of first row t11, t12 and
        second row t21, 22.
        Modify stretchfactor, shearfactor and tiltangle according to the
        given matrix.

        Examples (for a Turtle instance named turtle):
        >>> turtle.shape("square")
        >>> turtle.shapesize(4,2)
        >>> turtle.shearfactor(-0.5)
        >>> turtle.shapetransform()
        (4.0, -1.0, -0.0, 2.0)
        Nrz0Bad shape transform matrix: must not be singularr�r3r4)r0r�r�rr�r�r�r-r.r/rV)r��t11�t12�t21�t22Zm11Zm12Zm21Zm22Zalfar?r@Za11Za12Za21Za22r�r�r�rmas0,�

zRawTurtle.shapetransformcs^|j�|j\��|j\��t���j�j�}dt|�|\�������fdd�|D�S)zlComputes transformed polygon shapes from a shape
        according to current position and heading.
        r�csFg|]>\}}��|�|�j��|�|�jf�qSr�)r4r5�r{r�r��Ze0Ze1Zp0Zp1r�r�r�r~�s�z(RawTurtle._polytrafo.<locals>.<listcomp>)r�rrrr5r4r)r�r��er�rar��
_polytrafo�s

�zRawTurtle._polytrafocCs2|jj|jj}|jdkr.|�|j|jdk�SdS)a@Return the current shape polygon as tuple of coordinate pairs.

        No argument.

        Examples (for a Turtle instance named turtle):
        >>> turtle.shape("square")
        >>> turtle.shapetransform(4, -1, 0, 2)
        >>> turtle.get_shapepoly()
        ((50, -20), (30, 20), (-50, 20), (-30, -20))

        r�r�N)r�r�r�rDry�
_getshapepolyr�)r�rkr�r�r�rG�s
zRawTurtle.get_shapepolyFcsx|jdks|r|j\����n>|jdkrNtd|jd�}|dd|f\����n|jdkr\|St����fdd�|D��S)	z`Calculate transformed shape polygon according to resizemode
        and shapetransform.
        r3r2r�g@rr�c3s2|]*\}}�|�|�|�|fVqdSr�r�r`�r\r]r^r_r�r�r��sz*RawTurtle._getshapepoly.<locals>.<genexpr>)r%r0�maxr'r�)r�r�r�r!r�rer�rd�s

zRawTurtle._getshapepolyc	Cs�|j}|j|jj}|j}|jj}|j�r*|jdk�r*|jdk�r*d|_	|j
}|dkr�|jdkrfd}n|jdkrx|j}n|j
}|�|�|��}|j|j}}|j|||||dd�nt|d	kr�|�||j|�nZ|d
k�r�t||�D]D\}	\}
}}|�|�|
d��}
|j|	|
|�|�|�|�|j
dd�q�nx|j	�r6dS|dk�rR|�|dd
d
�nJ|d	k�rv|�||j|jdj
�n&|d
k�r�|D]}	|�|	dd
d
��q�d|_	dS)zpManages the correct rendering of the turtle with respect to
        its shape, resizemode, stretch and tilt etc.rFr�r�r�r2T�r"r9rzrArtr�N�r�r�r�r�r/)r�r�r�rDryrHr(r�r�rPr�r%r'r1rcrdr*r)rCrwr�ziprX)r�r�rkrZZtitem�tshaper6�fc�ocrHr�r�r�r�r��sR 

�
�




�
zRawTurtle._drawturtlec	CsT|j}|j|jj}|j}|j}|dkr�|��}|jdkr@d}n|jdkrR|j}n|j	}|�
|�|��}|j|j
}}|j|||||dd�n�|dkr�|�d�}|�||j|�n�|d	k�r4g}|D]}	|��}
|�|
�q�t|�}t||�D]D\}
\}}}|�
|�|d��}|j|
||�|�|�|�|j	dd�q�|j�|�|j�d
|f�|S)a�Stamp a copy of the turtleshape onto the canvas and return its id.

        No argument.

        Stamp a copy of the turtle shape onto the canvas at the current
        turtle position. Return a stamp_id for that stamp, which can be
        used to delete it by calling clearstamp(stamp_id).

        Example (for a Turtle instance named turtle):
        >>> turtle.color("blue")
        >>> turtle.stamp()
        13
        >>> turtle.fd(50)
        r�r�r�r2Trgrtr�r�rr)r�r�r�rDryr�r:r%r'r1rcrdr*r)rCrurwrr>r�rirXrSrr�)r�r�rkrZrj�stitemr6rkrlZelementrHr�r�r�r�rr�sH

�

�zRawTurtle.stampcCs�||jkrDt|t�r,|D]}|j�|�qn|j�|�|j�|�d|f}|j}||jkr`dS|j�|�}|j�|�||j	kr�|j	d|j
|_	|j�|j	d|j
dg�dS)z9does the work for clearstamp() and clearstamps()
        rrNr�)rSr�r�r�rIr�rr��indexr�r��insert)r��stampidZsubitemrHZbufrnr�r�r��_clearstamps



zRawTurtle._clearstampcCs|�|�|��dS)aDDelete stamp with given stampid

        Argument:
        stampid - an integer, must be return value of previous stamp() call.

        Example (for a Turtle instance named turtle):
        >>> turtle.color("blue")
        >>> astamp = turtle.stamp()
        >>> turtle.fd(50)
        >>> turtle.clearstamp(astamp)
        N)rqrJ)r�rpr�r�r�r6s
zRawTurtle.clearstampcCs^|dkr|jdd�}n&|dkr0|jd|�}n|j|d�}|D]}|�|�qB|��dS)a�Delete all or first/last n of turtle's stamps.

        Optional argument:
        n -- an integer

        If n is None, delete all of pen's stamps,
        else if n > 0 delete first n stamps
        else if n < 0 delete last n stamps.

        Example (for a Turtle instance named turtle):
        >>> for i in range(8):
        ...     turtle.stamp(); turtle.fd(30)
        ...
        >>> turtle.clearstamps(2)
        >>> turtle.clearstamps(-2)
        >>> turtle.clearstamps()
        Nr)rSrqrJ)r�r�ZtoDeleterHr�r�r�r7-szRawTurtle.clearstampsc
Cs�|j|j|jt|jt�f}|j}d|j|||j|j	dd�|�
|j�|jdd�ff}|jrh|j�
|�|j}|j�rZ|jdk�rZ||}|d|jd|d|jd}dt|ddd|j|j�}|d	|}	td|�D]R}
|
dkr�d
}nd}||	|
|_|j�r2|�|j||jf|j|j|�|��q�|j�rZ|j|jdd
|jd�|j�rn|j	�|�t|jt��r�|j�|�||_|j�r�|j�|�t|j	�dk�r�|��|��dS)z�Move the pen to the point end, thereby drawing a line
        if pen is down. All other methods for turtle movement depend
        on this one.
        �goNr�rr�r�r�皙�����?r�TF�r�r�r��r"rz�*)r+r)r'r�rOr�r�rrQrRr�r�rr�r,r�r4r5r�rrErKrJr>rMrLr�r=)r�r�go_modesr�Z
undo_entry�start�diff�diffsq�nhops�deltar�rAr�r�r�r
Isb
�

��$$�

�zRawTurtle._gotocs|\}}}}|\}}}}	|\}
}}�|j�t|j|�dkrDtd�|
|_||_|ddgkrbd}
n|}
�j|
||
|d���fdd�|jD�}|D]}��|�|j�	|�q�|}|j
�r��jdk�r�||}|d	�jd
|d�j
d
}dt|ddd|j
|j
�}|d
|}td|�D]P}|dk�r@d}nd}||||_|�rr��|j||jf|||�|���q,|�r��j|jdd|d�||_|j�r�t|j�d	k�r�|j��|jgk�r�d|_d|_|	�r|jgk�r�d|_td�n|jdk	�r|j��|��dS)z)Reverse a _goto. Used for undo()
        r�z$undogoto: HALLO-DA-STIMMT-WAS-NICHT!r�r�rucs&g|]}|�kr��|�dkr|�qS)r�)ryrz�r�r�r�r�r~�s�z'RawTurtle._undogoto.<locals>.<listcomp>r�rr�r�rsr�TFrtNzUnwahrscheinlich in _undogoto!)r�rrr�rQrRrEr�rIr�r,r�r4r5r�rrKrJrMr�rLr�rO)r��entry�old�newrwZcoodataZdrawingZpcZpsrBZcLIZcLr�ZusepcZtodeleter|rxryrzr{r|r�rAr�r}r��	_undogoto~sl
$$
�
�


zRawTurtle._undogotocCs�|jr|j�d||jf�||j9}|j�|�}|jj}|dkr�|jdkr�d|j}dtt	|�|�}d||}t
|�D]}|j�|�|_|��q|||_|��dS)z&Turns pen clockwise by angle.
        �rotr�rg@r�N)rr�r	rr�r�r�r,r�rrrJ)r�r�Z	neworientr�Zanglevelr r|r�r�r�r�r�s


zRawTurtle._rotateTcCsnt|j�dkrD|j�|j|j|j|j�|j��|_|j�	|j�n|jj|jdd�g|_|rj|j
g|_dS)z�Closes current line item and starts a new one.
           Remark: if current line became too long, animation
           performance (via _drawline) slowed down considerably.
        r�T)rAN)r�rRr�rErQr)r'rDr�r>rrAr�r�r�r=�s�zRawTurtle._newLinecCst|jt�S)aReturn fillstate (True if filling, False else).

        No argument.

        Example (for a Turtle instance named turtle):
        >>> turtle.begin_fill()
        >>> if turtle.filling():
        ...     turtle.pensize(5)
        ... else:
        ...     turtle.pensize(3)
        )r�rOr�r�r�r�r�rB�szRawTurtle.fillingcCsX|��s"|j��|_|j�|j�|jg|_|��|j	rL|j	�
d|jf�|��dS)aCalled just before drawing a shape to be filled.

        No argument.

        Example (for a Turtle instance named turtle):
        >>> turtle.color("black", "red")
        >>> turtle.begin_fill()
        >>> turtle.circle(60)
        >>> turtle.end_fill()
        �	beginfillN)rBr�r:rNr�r>rrOr=rr�rJr�r�r�r�r1�s
zRawTurtle.begin_fillcCs^|��rZt|j�dkrF|jj|j|j|jd�|jrF|j�d|jf�d|_|_|�	�dS)aFill the shape drawn after the call begin_fill().

        No argument.

        Example (for a Turtle instance named turtle):
        >>> turtle.color("black", "red")
        >>> turtle.begin_fill()
        >>> turtle.circle(60)
        >>> turtle.end_fill()
        r�r;�dofillN)
rBr�rOr�rCrNr*rr�rJr�r�r�r�r>
s�zRawTurtle.end_fillc	Gs8|sNt|ttf�r0|�|�}|jt|jd�}qr|j}|sr|jt|jd�}n$|dkrh|jt|jd�}|�|�}t|jd�r�|j�	|j
||�}|j�|�|j
r�|j
�d|f�n�|��}|j
r�|j
�dg�d|j
_z>|��dkr�|��|��|�|�|�|�|�d�W5|�|�X|j
�r4d	|j
_dS)
a�Draw a dot with diameter size, using color.

        Optional arguments:
        size -- an integer >= 1 (if given)
        color -- a colorstring or a numeric color tuple

        Draw a circular dot with diameter size, using color.
        If size is not given, the maximum of pensize+4 and 2*pensize is used.

        Example (for a Turtle instance named turtle):
        >>> turtle.dot()
        >>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50)
        r�N�_dotr<rTr2rF)r�r�r�r�r'rfr)�hasattrr�r�rr�r>rr�rVr�rarMrXrYrWrC)r�rVr9rHrVr�r�r�r<
s:



z
RawTurtle.dotcCsB|j�|j||||j�\}}|j�|�|jr>|j�d|f�|S)z)Performs the writing for write()
        �wri)r�rXrr)r�r>rr�)r�rVrWrUrHrr�r�r�rXH
s�zRawTurtle._writerP��Arialr�r7cCs`|jr|j�dg�d|j_|�t|�|��|�}|rN|��\}}|�||�|jr\d|j_dS)a�Write text at the current turtle position.

        Arguments:
        arg -- info, which is to be written to the TurtleScreen
        move (optional) -- True/False
        align (optional) -- one of the strings "left", "center" or right"
        font (optional) -- a triple (fontname, fontsize, fonttype)

        Write text - the string representation of arg - at the current
        turtle position according to align ("left", "center" or right")
        and with the given font.
        If move is True, the pen is moved to the bottom-right corner
        of the text. By default, move is False.

        Example (for a Turtle instance named turtle):
        >>> turtle.write('Home = ', True, align="center")
        >>> turtle.write((0,0), True)
        rTFN)rr�r�rXr�r�r[re)r��argZmoverWrUrr�r�r�r�r�r{R
szRawTurtle.writecCs|jg|_d|_dS)aStart recording the vertices of a polygon.

        No argument.

        Start recording the vertices of a polygon. Current turtle position
        is first point of polygon.

        Example (for a Turtle instance named turtle):
        >>> turtle.begin_poly()
        TN)rrLrMr�r�r�r�r2o
s
zRawTurtle.begin_polycCs
d|_dS)a7Stop recording the vertices of a polygon.

        No argument.

        Stop recording the vertices of a polygon. Current turtle position is
        last point of polygon. This will be connected with the first point.

        Example (for a Turtle instance named turtle):
        >>> turtle.end_poly()
        FN)rMr�r�r�r�r?}
szRawTurtle.end_polycCs|jdk	rt|j�SdS)z�Return the lastly recorded polygon.

        No argument.

        Example (for a Turtle instance named turtle):
        >>> p = turtle.get_poly()
        >>> turtle.register_shape("myFavouriteShape", p)
        N)rLr�r�r�r�r�rD�
s

zRawTurtle.get_polycCs|jS)a�Return the TurtleScreen object, the turtle is drawing  on.

        No argument.

        Return the TurtleScreen object, the turtle is drawing  on.
        So TurtleScreen-methods can be called for that object.

        Example (for a Turtle instance named turtle):
        >>> ts = turtle.getscreen()
        >>> ts
        <turtle.TurtleScreen object at 0x0106B770>
        >>> ts.bgcolor("pink")
        rGr�r�r�r�rF�
szRawTurtle.getscreencCs|S)aUReturn the Turtleobject itself.

        No argument.

        Only reasonable use: as a function to return the 'anonymous turtle':

        Example:
        >>> pet = getturtle()
        >>> pet.fd(50)
        >>> pet
        <turtle.Turtle object at 0x0187D810>
        >>> turtles()
        [<turtle.Turtle object at 0x0187D810>]
        r�r�r�r�r�rH�
szRawTurtle.getturtlecCs|j�|�S)zDSet delay value which determines speed of turtle animation.
        )r�rrLr�r�r�rM�
szRawTurtle._delayr�cCs"|j�|jj|||�|��dS)a�Bind fun to mouse-click event on this turtle on canvas.

        Arguments:
        fun --  a function with two arguments, to which will be assigned
                the coordinates of the clicked point on the canvas.
        btn --  number of the mouse-button defaults to 1 (left mouse button).
        add --  True or False. If True, new binding will be added, otherwise
                it will replace a former binding.

        Example for the anonymous turtle, i. e. the procedural way:

        >>> def turn(x, y):
        ...     left(360)
        ...
        >>> onclick(turn)  # Now clicking into the turtle will turn it.
        >>> onclick(None)  # event-binding will be removed
        N)r�rer�rHrJr�r�r�r�rR�
szRawTurtle.onclickcCs"|j�|jj|||�|��dS)a�Bind fun to mouse-button-release event on this turtle on canvas.

        Arguments:
        fun -- a function with two arguments, to which will be assigned
                the coordinates of the clicked point on the canvas.
        btn --  number of the mouse-button defaults to 1 (left mouse button).

        Example (for a MyTurtle instance named joe):
        >>> class MyTurtle(Turtle):
        ...     def glow(self,x,y):
        ...             self.fillcolor("red")
        ...     def unglow(self,x,y):
        ...             self.fillcolor("")
        ...
        >>> joe = MyTurtle()
        >>> joe.onclick(joe.glow)
        >>> joe.onrelease(joe.unglow)

        Clicking on joe turns fillcolor red, unclicking turns it to
        transparent.
        N)r�rfr�rHrJr�r�r�r�rT�
szRawTurtle.onreleasecCs|j�|jj|||�dS)a�Bind fun to mouse-move event on this turtle on canvas.

        Arguments:
        fun -- a function with two arguments, to which will be assigned
               the coordinates of the clicked point on the canvas.
        btn -- number of the mouse-button defaults to 1 (left mouse button).

        Every sequence of mouse-move-events on a turtle is preceded by a
        mouse-click event on that turtle.

        Example (for a Turtle instance named turtle):
        >>> turtle.ondrag(turtle.goto)

        Subsequently clicking and dragging a Turtle will move it
        across the screen thereby producing handdrawings (if pen is
        down).
        N)r�rgr�rHr�r�r�r�rS�
szRawTurtle.ondragcCs,|jdkrdS|dkr@|\}}|�|||j�|j��}n�|dkr\|d}|�|�n�|dkrp|�|�n�|dkr�|d}|j�|�|j�	|�n�|dkr�|d}|jj
|dd	d	d
�nh|dk�r|d}d|_|_||jk�r(|j�|�|j�	|�n$|dk�r(t
�||d�|j��dS)
z2Does the main part of the work for undo()
        Nr�rrrrr)r�r<r�rhr�r8r�rV)rrr	r�r6r�r�rIr�r�rCrNrOr$rV)r��actionr�r�ZdegPAUZdummyrmrHr�r�r��_undos<

�

zRawTurtle._undocCsl|jdkrdS|j��}|d}|dd�}|dkr\|rh|��}|�|d|dd��q4n|�||�dS)a�undo (repeatedly) the last turtle action.

        No argument.

        undo (repeatedly) the last turtle action.
        Number of available undo actions is determined by the size of
        the undobuffer.

        Example (for a Turtle instance named turtle):
        >>> for i in range(4):
        ...     turtle.fd(50); turtle.lt(80)
        ...
        >>> for i in range(8):
        ...     turtle.undo()
        ...
        Nrr�r)rr�r�)r�rHr�r�r�r�r�rw's

zRawTurtle.undo)NN)N)NNN)N)N)NNNN)F)N)T)N)FrPr�)N)r�N)r�N)r�N)9r�r�r�r�rJr�r�r`rhrxrUr5r�rJrr�r�rXr8rkrlrnrgrtrsrmrcrGrdr�rrrqr6r7r
r�rr=rBr1r>r<rXr{r2r?rDrFrHrErMrRrTrSr�rwrvr�r�r�r�r
�	sr�
(

(

(


(

(-
5A

0







 cCstjdkrt�t_tjS)z�Return the singleton screen object.
    If none exists at the moment, create a new one and return it,
    else return the existing one.N)r�_screenrIr�r�r�r�r	Js
c@sfeZdZdZdZedZdd�Zededededfd	d
�Zdd�Z	d
d�Z
dd�Zdd�ZdS)rINr)cCs�tjdkr4t�t_|_|j�tj�|j�|j�tjdkr�td}td}td}td}td}td}|j�	||||�|j�
�t_t�|tj�|�
||||�dS)Nrzr�r�r�r�r�)rI�_rootrr)�_titler)�_destroyrr�r#r$rr�r&)r�rzr�r�r�r�r�r�r�r�r�Xs

z_Screen.__init__rzr�r�r�cCs�t|jd�sdS|j��}|j��}t|t�rNd|krBdkrNnn||}|dkrb||d}t|t�r�d|kr�dkr�nn||}|dkr�||d}|j�||||�|��dS)a Set the size and position of the main window.

        Arguments:
        width: as integer a size in pixels, as float a fraction of the screen.
          Default is 50% of screen.
        height: as integer the height in pixels, as float a fraction of the
          screen. Default is 75% of screen.
        startx: if positive, starting position in pixels from the left
          edge of the screen, if negative from the right edge
          Default, startx=None is to center window horizontally.
        starty: if positive, starting position in pixels from the top
          edge of the screen, if negative from the bottom edge
          Default, starty=None is to center window vertically.

        Examples (for a Screen instance named screen):
        >>> screen.setup (width=200, height=200, startx=0, starty=0)

        sets window to 200x200 pixels, in upper left of screen

        >>> screen.setup(width=.75, height=0.5, startx=None, starty=None)

        sets window to 75% of screen by 50% of screen and centers
        r'Nrr�r�)r�r�r*r+r�r�r'r,)r�rzr�r%r&rQZshr�r�r�r&ns

""z
_Screen.setupcCs tjdk	rtj�|�|t_dS)aqSet title of turtle-window

        Argument:
        titlestring -- a string, to appear in the titlebar of the
                       turtle graphics window.

        This is a method of Screen-class. Not available for TurtleScreen-
        objects.

        Example (for a Screen instance named screen):
        >>> screen.title("Welcome to the turtle-zoo!")
        N)rIr�r)r�)r�Ztitlestringr�r�r�r)�s
z
_Screen.titlecCs:|j}|tjkr(dt_dt_dt_dt_dt_|��dS)NF)	r�rIrr�r�rrr�r()r��rootr�r�r�r��s
z_Screen._destroycCs|��dS)z~Shut the turtlegraphics window.

        Example (for a TurtleScreen instance named screen):
        >>> screen.bye()
        N)r�r�r�r�r�r�sz_Screen.byecsN�fdd�}��|�tdr"dSz
t�Wntk
rHtd�YnXdS)alGo into mainloop until the mouse is clicked.

        No arguments.

        Bind bye() method to mouseclick on TurtleScreen.
        If "using_IDLE" - value in configuration dictionary is False
        (default value), enter mainloop.
        If IDLE with -n switch (no subprocess) is used, this value should be
        set to True in turtle.cfg. In this case IDLE's mainloop
        is active also for the client script.

        This is a method of the Screen-class and not available for
        TurtleScreen instances.

        Example (for a Screen instance named screen):
        >>> screen.exitonclick()

        cs���dS)z&Screen.bye() with two dummy-parametersN)r)r�r�r�r�r��exitGracefully�sz+_Screen.exitonclick.<locals>.exitGracefullyr�Nr)rRr�r�AttributeError�exit)r�r�r�r�r�r�s

z_Screen.exitonclick)
r�r�r�r�rr�r�r�r&r)r�rrr�r�r�r�rIRs�
(
rIc@s4eZdZdZdZdZedededfdd�ZdS)rz�RawTurtle auto-creating (scrolled) canvas.

    When a Turtle object is created or a function derived from some
    Turtle method is called a TurtleScreen object is automatically created.
    Nrkr�r�cCs,tjdkrt�t_tj|tj|||d�dS)N)rkr�r�)rr�r	r
r�)r�rkr�r�r�r�r�r��s

�zTurtle.__init__)r�r�r�r�r�r�r�r�r�r�r�r�r�s��turtle_docstringdictc	Cs�i}tD]}d|}t|�j||<qtD]}d|}t|�j||<q(td|d���}tdd�|D��}|�d�|dd	�D](}|�d
t|��|�d||�q||d	}|�d
t|��|�d||�|�d
�|��W5QRXdS)a�Create and write docstring-dictionary to file.

    Optional argument:
    filename -- a string, used as filename
                default value is turtle_docstringdict

    Has to be called explicitly, (not used by the turtle-graphics classes)
    The docstring dictionary will be written to the Python script <filname>.py
    It is intended to serve as a template for translation of the docstrings
    into different languages.
    z_Screen.zTurtle.z%s.pyr6css$|]}|�d�dtkr|VqdS)r�r�N)r�_alias_listr�r�r�r�r�s�z&write_docstringdict.<locals>.<genexpr>zdocsdict = {

Nr�z%s :
z        """%s
""",

z        """%s
"""

z}
)	�_tg_screen_functionsr�r��_tg_turtle_functionsr�r�r{�repr�close)r��docsdict�
methodnamer�r�r�r�r�r�r~�s$

c	Cs`dd|��i}t|�}|j}|D]8}z||t|�_Wq"tk
rXtd|�Yq"Xq"dS)z�Read in docstrings from lang-specific docstring dictionary.

    Transfer docstrings, translated to lang, from a dictionary-file
    to the methods of classes Screen and Turtle and - in revised form -
    to the corresponding functions.
    z!turtle_docstringdict_%(language)sr�zBad docstring-entry: %sN)r��
__import__r�r�r�r�r�)Zlang�modname�moduler�r�r�r�r��read_docstringssr�r�zCannot find docsdict forz;Unknown Error when trying to import %s-docstring-dictionaryc
Cs�d}}t�|j�\}}}|dd�}|dd�}|jp:g}dd�|D�}dgt|�t|�|}dd�t||�D�}	|dk	r�|	�d|�|�d|�|dk	r�|	�d|�|�d|�d	�|	�}d
|}d	�|�}d
|}||fS)a?Get strings describing the arguments for the given object

    Returns a pair of strings representing function parameter lists
    including parenthesis.  The first string is suitable for use in
    function definition and the second is suitable for use in function
    call.  The "self" parameter is not included.
    r�r�NcSsg|]}d|f�qS)z=%rr�)r{r�r�r�r�r~<sz"getmethparlist.<locals>.<listcomp>cSsg|]\}}||�qSr�r�)r{r�Zdfltr�r�r�r~>s�*z**z, z(%s))�inspectZgetargs�__code__�__defaults__r�rir>r)
ZobZdefTextZcallTextrZvarargsZvarkwZitems2ZrealArgs�defaultsZitems1r�r�r��getmethparlist,s&


r�cCsJddl}|dkrdStd}|�d|d�}|�d|�}|�d|�}|S)z<To reduce docstrings from RawTurtle class for functions
    rNr��%s.r�� \(.+ %s\):�:��rer��replace�compile�sub)�docstrr�Z
turtlename�	newdocstr�parexpr�r�r��_turtle_docreviseKsr�cCsJddl}|dkrdStd}|�d|d�}|�d|�}|�d|�}|S)z?To reduce docstrings from TurtleScreen class for functions
    rNr�r�r�r�r�r�)r�r�Z
screennamer�r�r�r�r��_screen_docreviseWsr�ardef {name}{paramslist}:
    if {obj} is None:
        if not TurtleScreen._RUNNING:
            TurtleScreen._RUNNING = True
            raise Terminator
        {obj} = {init}
    try:
        return {obj}.{name}{argslist}
    except TK.TclError:
        if not TurtleScreen._RUNNING:
            TurtleScreen._RUNNING = True
            raise Terminator
        raise
c
Csl|D]b}t||�}t|�\}}|dkr4td||�qtj|||||d�}	t|	t��||j�t�|_qdS)Nr�z>>>>>>)�obj�initr�Z
paramslistZargslist)�getattrr�r��__func_body�formatr��globalsr�)
Z	functionsr�r�r�Z	docreviser�r�Zpl1Zpl2Zdefstrr�r�r��_make_global_funcsws

�r�zTurtle._screenzScreen()zTurtle._penzTurtle()�__main__cCst�rt�nt�dSr�)rNr]rUr�r�r�r��	switchpen�sr�cCslt�td�t�td�t�td�td�D]Z}|dkrDt�td�D]}td�t	d�qL|dkrxt
d�t�t�td	�t�q2td
�t
d�td�t�td�td�td�td�td
�t�t
dd
�t
dd
�t
d�td�D]$}td�t	d�td�td�q�td�t�td�D]&}td�t	d�td�td��q:t�dS)zDemo of old turtle.py - moduleT�dr�r�r�r��ZZmaroonr	r�r�F�Z
startstartrx�redr�N)r`r*ryr0r=rzrr1rCrPr9r>r_r{)r|r�r�r�r��demo1�sX



r�cCsBtd�t�td�ttdd��tdd�d}td�td�D]}t�t	|d�qBt
d�t�rnt�q`t
�td�td	�d}td
�td�td�tdd
�D]p}|dkr�t�td	d|dd|�td�D]}t|�td�q�t�|d7}td�tt�dd�q�td�t�td�td�t�tdd�td�t�td�D](}t	dd�td�td�td��q`t�td�t�td�t�td�t�}|�d�t�}|�d�|�d�|�
�|�d�|�d�|��|�dd�|�d�|��|�d�|�dd�|�d�|�d�tt|��d}|�|�dk�r�|�d�|�d �|�|�|��|�d�|d!dk�r�|� �|� �t�|d7}�qZ|j
d"d#d$d%�|�d&�|�d�d'd(�}t!�"d�t��r|��|���q�|�d�|j
d)d*d+�|�#|d�d,S)-zDemo of some new features.r�r�rrr��r�zwait a moment...r�Zgreenr�r�r���x��Fr	r�Zyellowr��2r�r2i�(r�ZblueZoranger�g@g333333�?r�zCAUGHT! )r�r��boldr_)rUrWr�cSst�t�dSr�)rr)r�r�r�r�r��babaszdemo2.<locals>.babaz  Click me!)ZCourierr�r�)rUN)$rprqrYrdrur;rbrr�r4r{rxrwr`rQrrWr1rAr@r>r]rUr9rkrHrarrPryrIr=rr�time�sleeprR)rr�Zlaenger|Ztrir�r�r�r�r�r��demo2�s�


















r�)r�)r�)Fr�Z_verZtkinterr�r�r�r�r�r�Zos.pathrrr�copyrrZ_tg_classesr�r�Z
_tg_utilities�__all__r�r�r�r�r�r�r�rr�r�r�r�r�rr�r r�objectr,r�r�rr�rr�r$rBr
rr	rIrr
r~r�Z	_LANGUAGE�ImportErrorr�r�r�r�r�rrr�r�r�r�rr�r�r�r��<module>s�N��
�

����5
�
c	/&/O}
"
���
5cposixpath.cpython-38.opt-2.pyc000064400000021013150335716500012155 0ustar00U

e5d=�&@sZdZdZdZdZdZdZdZdZddlZddl	Z	ddl
Z
ddlZddlTd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.g&Zd/d0�Z
d1d	�Zd2d
�Zd3d�Zd4d
�Zd5d�Zejje_d6d�Zd7d�Zd8d�Zd9d�Zd:d�Zd;d�Zd<d�Zdadad=d�Zd>d�Zd?d�Z d@d+�Z!dAdB�Z"e	j#dCkZ$dFdDd-�Z%dEd.�Z&dS)G�.�..�/�:z
/bin:/usr/binNz	/dev/null�)�*�normcase�isabs�join�
splitdrive�split�splitext�basename�dirname�commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�ismount�
expanduser�
expandvars�normpath�abspath�samefile�sameopenfile�samestat�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenames�relpath�
commonpathcCst|t�rdSdSdS)N�/r)�
isinstance�bytes��path�r2�!/usr/lib64/python3.8/posixpath.py�_get_sep)s
r4cCs
t�|�S�N��os�fspath)�sr2r2r3r4scCst�|�}t|�}|�|�Sr5)r7r8r4�
startswith)r9r#r2r2r3r<s
c
Gs�t�|�}t|�}|}z^|s,|dd�|ttj|�D]8}|�|�rL|}q8|rZ|�|�rd||7}q8|||7}q8Wn.tttfk
r�t	j
d|f|���YnX|S)Nrr	)r7r8r4�mapr:�endswith�	TypeError�AttributeError�BytesWarning�genericpath�_check_arg_types)�a�pr#r1�br2r2r3r	Gs 


cCs`t�|�}t|�}|�|�d}|d|�||d�}}|rX||t|�krX|�|�}||fS�N��r7r8r4�rfind�len�rstrip)rCr#�i�head�tailr2r2r3rds

cCs6t�|�}t|t�rd}d}nd}d}t�||d|�S)Nr-�.rr)r7r8r.r/r@�	_splitext)rCr#r'r2r2r3rus

cCst�|�}|dd�|fS�Nrr6)rCr2r2r3r
�s
cCs,t�|�}t|�}|�|�d}||d�SrE)r7r8r4rH)rCr#rKr2r2r3r
�s
cCsNt�|�}t|�}|�|�d}|d|�}|rJ||t|�krJ|�|�}|SrErG)rCr#rKrLr2r2r3r�s

c
Cs8zt�|�}Wntttfk
r*YdSXt�|j�S)NF)r7�lstat�OSError�
ValueErrorr>�stat�S_ISLNK�st_mode)r1�str2r2r3r�s
c	Cs.zt�|�Wnttfk
r(YdSXdS)NFT)r7rQrRrSr0r2r2r3r�s
c	Cs�zt�|�}Wnttfk
r(YdSXt�|j�r:dSt|t�rPt	|d�}n
t	|d�}t
|�}zt�|�}Wnttfk
r�YdSX|j}|j}||kr�dS|j}|j}||kr�dSdS)NF�..rT)
r7rQrRrSrTrUrVr.r/r	r)�st_dev�st_ino)r1�s1�parent�s2�dev1�dev2�ino1�ino2r2r2r3r�s.

c	Cs<t�|�}t|t�rd}nd}|�|�s,|St|�}|�|d�}|dkrPt|�}|dkr�dtjkr�ddl	}z|�
t���j}Wq�t
k
r�|YSXn
tjd}nVddl	}|d|�}t|t�r�t|d�}z|�|�}Wnt
k
r�|YSX|j}t|t��rt�|�}d}nd}|�|�}|||d��p:|S)	N�~�~rFr�HOME�ASCIIr-r)r7r8r.r/r:r4�findrI�environ�pwd�getpwuid�getuid�pw_dir�KeyError�str�getpwnam�fsencoderJ)	r1�tilder#rKrh�userhome�name�pwent�rootr2r2r3r�sB








cCsZt�|�}t|t�rVd|kr |Sts:ddl}|�d|j�atj}d}d}t	tdd�}n:d|krb|St
s|ddl}|�d|j�a
t
j}d	}d
}tj}d}|||�}|s��qV|�d�\}}|�
d�}	|	�|�r�|	�|�r�|	dd�}	z.|dk�rt�tjt�|	��}
n||	}
Wntk
�r&|}Yq�X||d�}|d|�|
}t|�}||7}q�|S)
N�$rs\$(\w+|\{[^}]*\})�{�}�environb�$z\$(\w+|\{[^}]*\})�{�}rF���)r7r8r.r/�	_varprogb�re�compilere�search�getattr�_varprogrg�span�groupr:r<ro�fsdecoderlrI)r1r~r��start�endrgrK�m�jrr�valuerMr2r2r3rsN






c	Cs�t�|�}t|t�r&d}d}d}d}nd}d}d}d}||krB|S|�|�}|rp|�|d	�rp|�|d
�spd	}|�|�}g}|D]J}|||fkr�q�||ks�|s�|r�|r�|d|kr�|�|�q�|r�|��q�|}|�|�}|r�|||}|p�|S)Nr-�rNrXr�rr��r|)	r7r8r.r/r:r�append�popr	)	r1r#�empty�dot�dotdot�initial_slashes�comps�	new_comps�compr2r2r3rNsJ


��
�
�

cCs@t�|�}t|�s8t|t�r&t��}nt��}t||�}t|�Sr5)	r7r8rr.r/�getcwdb�getcwdr	r)r1�cwdr2r2r3rts



cCs*t�|�}t|dd�|i�\}}t|�SrP)r7r8�
_joinrealpathr)�filenamer1�okr2r2r3r)�s
c
Cst|t�rd}d}d}nd}d}d}t|�r<|dd�}|}|�r|�|�\}}}|r<||kr`q<||kr�|r�t|�\}}||kr�t|||�}q<|}q<t||�}t|�s�|}q<||kr�||}|dk	r�q<t||�dfSd||<t|t�	|�|�\}}	|	�st||�dfS|||<q<|d	fS)
Nr-rNrXrrrrFFT)
r.r/r�	partitionrr	rr�r7�readlink)
r1�rest�seenr#r!r"rr�_�newpathr�r2r2r3r��sH


r��darwinc	Cs�|std��t�|�}t|t�r.d}d}d}nd}d}d}|dkrH|}n
t�|�}zrdd	�t|��|�D�}d
d	�t|��|�D�}tt||g��}|gt|�|||d�}|s�|WSt	|�WSt
ttt
fk
r�t�d||��YnXdS)Nzno path specifiedrNr-rXrrrcSsg|]}|r|�qSr2r2��.0�xr2r2r3�
<listcomp>�szrelpath.<locals>.<listcomp>cSsg|]}|r|�qSr2r2r�r2r2r3r��sr+)rSr7r8r.r/rrrIrr	r=r>r?�DeprecationWarningr@rA)	r1r�r!r#r"�
start_list�	path_listrK�rel_listr2r2r3r+�s0



c		s2|std��tttj|��}t|dt�r4d�d�nd�d�zƇfdd�|D�}zt�fd	d
�|D��\}Wntk
r�td�d�YnX�fdd�|D�}t|�}t	|�}|}t
|�D]$\}}|||kr�|d|�}q�q�|r�n
�dd�}|��|�WStt
fk
�r,tjd|���YnXdS)Nz%commonpath() arg is an empty sequencerr-rNrrcsg|]}|����qSr2)r)r�r1�r#r2r3r��szcommonpath.<locals>.<listcomp>c3s|]}|dd��kVqdSrEr2)r�rCr�r2r3�	<genexpr>�szcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathscsg|]}�fdd�|D��qS)csg|]}|r|�kr|�qSr2r2)r��c�r!r2r3r�sz)commonpath.<locals>.<listcomp>.<listcomp>r2)r�r9r�r2r3r�sr,)r,)rS�tupler;r7r8r.r/�set�min�max�	enumerater	r=r>r@rA)	�paths�split_pathsrr[r]�commonrKr��prefixr2)r!r#r3r,�s6)N)'r!r"r'r#r$r%r&r(r7�sysrTr@�__all__r4rrr	rrrO�__doc__r
r
rrrrrr�r}rrrr)r��platformr*r+r,r2r2r2r3�<module>s��
	
	

*25&	3

)queue.cpython-38.opt-2.pyc000064400000014223150335716500011267 0ustar00U

e5d\,�@s�ddlZddlmZddlmZmZddlmZzddlm	Z	Wne
k
rXdZ	YnXdddd	d
dgZzddlmZWn$e
k
r�Gd
d�de
�ZYnXGdd�de
�ZGdd�d�ZGdd	�d	e�ZGdd
�d
e�ZGdd�d�Ze	dkr�eZ	dS)�N)�deque)�heappush�heappop)�	monotonic)�SimpleQueue�Empty�Full�Queue�
PriorityQueue�	LifoQueuer)rc@seZdZdS)rN��__name__�
__module__�__qualname__�rr�/usr/lib64/python3.8/queue.pyrsc@seZdZdS)rNrrrrrrsc@s�eZdZd dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zd!dd�Z	d"dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)#r	rcCsN||_|�|�t��|_t�|j�|_t�|j�|_t�|j�|_d|_	dS�Nr)
�maxsize�_init�	threadingZLock�mutexZ	Condition�	not_empty�not_full�all_tasks_done�unfinished_tasks��selfrrrr�__init__!s

zQueue.__init__c	CsH|j�8|jd}|dkr4|dkr*td��|j��||_W5QRXdS)N�rz!task_done() called too many times)rr�
ValueErrorZ
notify_all)rZ
unfinishedrrr�	task_done8s

zQueue.task_donec	Cs(|j�|jr|j��qW5QRXdS�N)rr�wait�rrrr�joinNs	z
Queue.joinc
Cs&|j�|��W5QR�SQRXdSr!�r�_qsizer#rrr�qsize[szQueue.qsizec
Cs(|j�|��W5QR�SQRXdSr!r%r#rrr�empty`szQueue.emptyc
Cs<|j�,d|jko |��knW5QR�SQRXdSr)rrr&r#rrr�fullnsz
Queue.fullTNc	Cs�|j��|jdkr�|s*|��|jkr�t�nr|dkrN|��|jkr�|j��q2nN|dkr`td��n<t�|}|��|jkr�|t�}|dkr�t�|j�|�qj|�|�|jd7_|j	�
�W5QRXdS)Nr�''timeout' must be a non-negative number�r)rrr&rr"r�time�_putrr�notify)r�item�block�timeout�endtime�	remainingrrr�putys&




z	Queue.putc
Cs�|j��|s|��s�t�nf|dkr8|��s�|j��q"nH|dkrJtd��n6t�|}|��s�|t�}|dkrrt�|j�|�qT|��}|j��|W5QR�SQRXdS)Nrr*r+)	rr&rr"rr,�_getrr.)rr0r1r2r3r/rrr�get�s$



z	Queue.getcCs|j|dd�S�NF)r0�r4�rr/rrr�
put_nowait�szQueue.put_nowaitcCs|jdd�Sr7�r6r#rrr�
get_nowait�szQueue.get_nowaitcCst�|_dSr!)r�queuerrrrr�szQueue._initcCs
t|j�Sr!��lenr=r#rrrr&�szQueue._qsizecCs|j�|�dSr!�r=�appendr9rrrr-�sz
Queue._putcCs
|j��Sr!)r=�popleftr#rrrr5�sz
Queue._get)r)TN)TN)r
rrrr r$r'r(r)r4r6r:r<rr&r-r5rrrrr	s


 

c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
r
cCs
g|_dSr!�r=rrrrr�szPriorityQueue._initcCs
t|j�Sr!r>r#rrrr&�szPriorityQueue._qsizecCst|j|�dSr!)rr=r9rrrr-�szPriorityQueue._putcCs
t|j�Sr!)rr=r#rrrr5�szPriorityQueue._getN�r
rrrr&r-r5rrrrr
�sc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rcCs
g|_dSr!rCrrrrr�szLifoQueue._initcCs
t|j�Sr!r>r#rrrr&�szLifoQueue._qsizecCs|j�|�dSr!r@r9rrrr-�szLifoQueue._putcCs
|j��Sr!)r=�popr#rrrr5�szLifoQueue._getNrDrrrrr�sc@sHeZdZdd�Zddd�Zddd�Zd	d
�Zdd�Zd
d�Zdd�Z	dS)�_PySimpleQueuecCst�|_t�d�|_dSr)r�_queuerZ	Semaphore�_countr#rrrr	sz_PySimpleQueue.__init__TNcCs|j�|�|j��dSr!)rGrArH�release)rr/r0r1rrrr4
sz_PySimpleQueue.putcCs4|dk	r|dkrtd��|j�||�s*t�|j��S)Nrr*)rrH�acquirerrGrB)rr0r1rrrr6s
z_PySimpleQueue.getcCs|j|dd�Sr7r8r9rrrr:'sz_PySimpleQueue.put_nowaitcCs|jdd�Sr7r;r#rrrr</sz_PySimpleQueue.get_nowaitcCst|j�dkSr�r?rGr#rrrr(7sz_PySimpleQueue.emptycCs
t|j�Sr!rKr#rrrr';sz_PySimpleQueue.qsize)TN)TN)
r
rrrr4r6r:r<r(r'rrrrrF�s

	
rF)r�collectionsr�heapqrrr,rrGr�ImportError�__all__r�	Exceptionrr	r
rrFrrrr�<module>s(
BAstringprep.cpython-38.opt-2.pyc000064400000024765150335716500012354 0ustar00U

e5du2��@s�ddlmZdd�Zedddddd	d
ddd
dgeedd���Zdd�Zdddddddddddddd d!d"d#d$d%d&dd'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBd;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdCdDdEdFdGdHdIdJdKdLdMdNdOdLddPdQdRdSdTdQdUddVdWdXddYdZd[d\d]d^d_d`d]dadbdcdddedfdfdfdgdgdhdidjdkdldmdmdmdndodpdqdqdrdbdsdtdudvd$dwdxdydzd{d|d}d~dd�d�d�d�d�d�d�d�d�d�d�d{d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�dbdwd�d�d�did�dkdldd�d�d�d�d�d�dqd�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�drdwdsdtd�d�d�dhdudid�dkdldd�d�d�d�d�d�d�drdwdsdtd�dgd�d�dhdud�dd�d�d�d�d�d�d�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�drdbdwdsdtd�dfdgd�d�dhdudid�dkdldmdd�d�d�d�d�d�dqd�ddvd�d'd�d�ddd%d�dd�d�d�d$d&ddd�d d#d�d�d�dd�ddvd�d'd�d�ddd%d�dd�d�d�d$d&ddd�d d#d�d�d�dd�ddvd�d'd�d�ddd%d�dd�d�d�d$d&ddd�d d#d�d�d�dd�ddvd�d'd�d�ddd%d�dd�d�d�d$d&ddd�d d#d�d�d�dd�ddvd�d'd�d�ddd%d�dd�d�d�d$d&ddd�d d#d�d�d�ddɐ��Zd�d˄Z	d�d̈́Z
d�dτZd�dфZd�dӄZ
d�dՄZed�d�d�ddd�d�dgeed
dۃ�eed�d݃�eed�d߃�eed�d���Zd�d�Zd�d�Zd�d�Zd�d�Zd�d�Zeed�d��Zd�d�Zeed�d��Zd�d�Zed�d�d�d�geed�d���eed�d݃��Zd�d��Zed�geed�d����Zd�d��Z�d�d�Z�d�d�Z�dS(�)�	ucd_3_2_0cCsBt�|�dkrdSt|�}d|kr.dkr6nndS|d@dkS)NZCnF�������r)�unicodedata�category�ord��code�c�r�"/usr/lib64/python3.8/stringprep.py�in_table_a1sr�iOiiii
i i i
 i` i��i�i�cCst|�tkS�N)r
�b1_set�rrrr�in_table_b1sruμZssui̇uʼn�suǰuιu ιuΐuΰuσuβuθuυuύuϋuφuπuκuρuεuեւuẖuẗuẘuẙuaʾuṡuὐuὒuὔuὖuἀιuἁιuἂιuἃιuἄιuἅιuἆιuἇιuἠιuἡιuἢιuἣιuἤιuἥιuἦιuἧιuὠιuὡιuὢιuὣιuὤιuὥιuὦιuὧιuὰιuαιuάιuᾶuᾶιuὴιuηιuήιuῆuῆιuῒuῖuῗuῢuῤuῦuῧuὼιuωιuώιuῶuῶιZrsr
u°cuɛu°f�h�i�l�nZno�p�q�rZsmZtelZtm�z�b�e�f�muγ�dZhpaZauZovZpaZnauμaZmaZkaZkbZmbZgbZpfZnfuμf�hzZkhzZmhzZghzZthzZkpaZmpaZgpaZpvZnvuμvZmvZkvZpwZnwuμwZmw�kwukωumωZbquc∕kgzco.ZdbZgyZhpZkkZkmZphZppmZprZsv�wbZffZfiZflZffiZffl�stuմնuմեuմիuվնuմխ�a�g�j�k�o�t�u�v�w�x�yuαuδuζuηuλuνuξuοuτuχuψuω(����i0iIii�iEizi�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�iPiRiTiVi�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i� i!i!i!i	!i!i!i
!i!i!i!i!i!i!i!i!i!i!i !i!!i"!i$!i(!i,!i-!i0!i1!i3!i>!i?!iE!iq3is3iu3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i	�i
�i�i�i
�i�i�i�i�i�i�i�i�i�i�i�i�i4�i5�i6�i7�i8�i9�i:�i;�i<�i=�i>�i?�i@�iA�iB�iC�iD�iE�iF�iG�iH�iI�iJ�iK�iL�iM�ih�ii�ij�ik�il�im�in�io�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i�i�i�i�i	�i
�i
�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i8�i9�i;�i<�i=�i>�i@�iA�iB�iC�iD�iF�iJ�iK�iL�iM�iN�iO�iP�il�im�in�io�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i�i	�i
�i�i�i
�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i �i!�i<�i=�i>�i?�i@�iA�iB�iC�iD�iE�iF�iG�iH�iI�iJ�iK�iL�iM�iN�iO�iP�iQ�iR�iS�iT�iU�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i
�i�i�i�i�i �i!�i"�i#�i$�i%�i&�i'�i(�i)�i*�i+�i,�i-�i.�i/�i0�i1�i2�i3�i4�iG�iV�iW�iX�iY�iZ�i[�i\�i]�i^�i_�i`�ia�ib�ic�id�ie�if�ig�ih�ii�ij�ik�il�im�in�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��cCs"t�t|��}|dk	r|S|��Sr)�
b3_exceptions�getr
�lower)rrrrr�map_table_b3�sr8cCsHt|�}t�d|�}d�dd�|D��}t�d|�}||kr@|S|SdS)NZNFKC�cSsg|]}t|��qSr)r8)�.0Zchrrr�
<listcomp>�sz map_table_b2.<locals>.<listcomp>)r8rZ	normalize�join)r(ZalrZblr
rrr�map_table_b2�sr=cCs|dkS)N� rrrrr�in_table_c11�sr?cCst�|�dko|dkS)N�Zsr>�rr	rrrr�in_table_c12�srBcCst�|�dkS)Nr@rArrrr�in_table_c11_c12�srCcCst|�dkot�|�dkS)N��Cc)r
rr	rrrr�in_table_c21�srFi�iii( i) id ij ip i��i��is�i{�cCs.t|�}|dkrdSt�|�dkr&dS|tkS)NrDFrET)r
rr	�c22_specialsrrrr�in_table_c22�srHcCst�|�dkpt|�tkS)NrE)rr	r
rGrrrr�in_table_c21_c22�s
�rIcCst�|�dkS)NZCorArrrr�in_table_c3�srJcCs0t|�}|dkrdS|dkr dSt|�d@dkS)NrFrTrr)r
rrrr�in_table_c4�srKcCst�|�dkS)NZCsrArrrr�in_table_c5�srLrcCst|�tkSr)r
�c6_setrrrr�in_table_c6�srNi�/i�/cCst|�tkSr)r
�c7_setrrrr�in_table_c7�srPi@iAi i i* i/ cCst|�tkSr)r
�c8_setrrrr�in_table_c8srRii i�cCst|�tkSr)r
�c9_setrrrr�in_table_c9srTcCst�|�dkS)N)�RZAL�rZ
bidirectionalrrrr�in_table_d1srWcCst�|�dkS)N�LrVrrrr�in_table_d2srYN)rrr�set�list�rangerrr5r8r=r?rBrCrFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrWrYrrrr�<module>sL,��&P,chunk.cpython-38.pyc000064400000011351150335716500010312 0ustar00U

e5d;�@sdZGdd�d�ZdS)aSimple class to read IFF chunks.

An IFF chunk (used in formats such as AIFF, TIFF, RMFF (RealMedia File
Format)) has the following structure:

+----------------+
| ID (4 bytes)   |
+----------------+
| size (4 bytes) |
+----------------+
| data           |
| ...            |
+----------------+

The ID is a 4-byte string which identifies the type of chunk.

The size field (a 32-bit value, encoded using big-endian byte order)
gives the size of the whole chunk, including the 8-byte header.

Usually an IFF-type file consists of one or more chunks.  The proposed
usage of the Chunk class defined here is to instantiate an instance at
the start of each chunk and read from the instance until it reaches
the end, after which a new instance can be instantiated.  At the end
of the file, creating a new instance will fail with an EOFError
exception.

Usage:
while True:
    try:
        chunk = Chunk(file)
    except EOFError:
        break
    chunktype = chunk.getname()
    while True:
        data = chunk.read(nbytes)
        if not data:
            pass
        # do something with data

The interface is file-like.  The implemented methods are:
read, close, seek, tell, isatty.
Extra methods are: skip() (called by close, skips to the end of the chunk),
getname() (returns the name (ID) of the chunk)

The __init__ method has one required argument, a file-like object
(including a chunk instance), and one optional argument, a flag which
specifies whether or not chunks are aligned on 2-byte boundaries.  The
default is 1, i.e. aligned.
c@sZeZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zddd�Zdd�Z	ddd�Z
dd�ZdS)�ChunkTFc	Cs�ddl}d|_||_|rd}nd}||_|�d�|_t|j�dkrFt�z |�|d|�d��d|_	Wn|j
k
r�td�YnX|r�|j	d|_	d|_z|j��|_
Wnttfk
r�d|_YnXd|_dS)	N�F�>�<��L�T)�struct�closed�align�file�read�	chunkname�len�EOFErrorZunpack_from�	chunksize�error�	size_read�tell�offset�AttributeError�OSError�seekable)�selfrr
Z	bigendianZ
inclheaderrZstrflag�r�/usr/lib64/python3.8/chunk.py�__init__4s, zChunk.__init__cCs|jS)z*Return the name (ID) of the current chunk.)r
�rrrr�getnameNsz
Chunk.getnamecCs|jS)z%Return the size of the current chunk.)rrrrr�getsizeRsz
Chunk.getsizecCs |jsz|��W5d|_XdS)NT)r	�skiprrrr�closeVszChunk.closecCs|jrtd��dS)N�I/O operation on closed fileF)r	�
ValueErrorrrrr�isatty]szChunk.isattyrcCsv|jrtd��|jstd��|dkr0||j}n|dkrB||j}|dksT||jkrXt�|j�|j	|d�||_dS)z�Seek to specified position into the chunk.
        Default position is 0 (start of chunk).
        If the file is not seekable, this will result in an error.
        r!zcannot seek��rN)
r	r"rrrr�RuntimeErrorr�seekr)r�pos�whencerrrr'bs
z
Chunk.seekcCs|jrtd��|jS)Nr!)r	r"rrrrrrusz
Chunk.tell���cCs�|jrtd��|j|jkrdS|dkr2|j|j}||j|jkrN|j|j}|j�|�}|jt|�|_|j|jkr�|jr�|jd@r�|j�d�}|jt|�|_|S)z�Read at most size bytes from the chunk.
        If size is omitted or negative, read until the end
        of the chunk.
        r!�rr$)r	r"rrrrrr
)r�size�data�dummyrrrrzs$��z
Chunk.readcCs�|jrtd��|jrnzD|j|j}|jr:|jd@r:|d}|j�|d�|j||_WdStk
rlYnX|j|jkr�t	d|j|j�}|�
|�}|snt�qndS)z�Skip the rest of the chunk.
        If you are not interested in the contents of the chunk,
        this method should be called so that the file points to
        the start of the next chunk.
        r!r$Ni )r	r"rrrr
rr'r�minrr)r�nr.rrrr�s"
z
Chunk.skipN)TTF)r)r*)�__name__�
__module__�__qualname__rrrr r#r'rrrrrrrr3s


rN)�__doc__rrrrr�<module>s2tokenize.cpython-38.opt-2.pyc000064400000032052150335716500011773 0ustar00U

e5d�d�@sDdZdZddlmZddlmZmZddlZddl	m
Z
ddlZddl
Z
ddlZddlTddlmZe
�d	e
j�Ze
�d
e
j�ZddlZejddd
ddgZ[Gdd�de�dd��Zdd�Zdd�Zdd�ZdZdZeede�ee�ZdZdZdZ dZ!dZ"eee e!e"�Z#d Z$ed!d"�ee$�Z%d#e$Z&ee%e&�Z'ed$e'd%�Z(ee(e'e#�Z)d&d'�Z*d(d)�Z+ee*��Z,d*Z-d+Z.d,Z/d-Z0ee,d.e,d/�Z1ee,d0e,d1�Z2ee3e
j4e5ed2d3���Z6ed4e6�Z7ee)e7e2e�Z8ee8Z9ee,d5ed6d�e,d7ed8d��Z:ed9ee1�Z;eee;e)e7e:e�Z<iZ=e*�D]6Z>e-e=e>d6<e.e=e>d8<e/e=e>d.<e0e=e>d/<�q(e?�Z@e?�ZAe*�D]JZBeBd8eBd6fD]ZCe@�DeC��q�eBd/eBd.fD]ZCeA�DeC��q��qrd:ZEGd;d<�d<eF�ZGGd=d>�d>eF�ZHGd?d@�d@�ZIdAd�ZJdBdC�ZKdDd
�ZLdEdF�ZdGd�ZMdHdI�ZNdJd�ZOdKdL�ZPeQdMk�r@eP�dS)NzKa-Ping Yee <ping@lfw.org>zpGvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip Montanaro, Raymond Hettinger, Trent Nelson, Michael Foord�)�open)�lookup�BOM_UTF8N)�
TextIOWrapper)�*)�EXACT_TOKEN_TYPESz&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)�tokenize�generate_tokens�detect_encoding�
untokenize�	TokenInfoc@s eZdZdd�Zedd��ZdS)rcCs$d|jt|jf}d|j|d�S)Nz%d (%s)z8TokenInfo(type=%s, string=%r, start=%r, end=%r, line=%r))�type)r
�tok_name�_replace)�self�annotated_type�r� /usr/lib64/python3.8/tokenize.py�__repr__.s
�zTokenInfo.__repr__cCs(|jtkr|jtkrt|jS|jSdS�N)r
�OP�stringr�rrrr�
exact_type3s
zTokenInfo.exact_typeN)�__name__�
__module__�__qualname__r�propertyrrrrrr-sztype string start end linecGsdd�|�dS)N�(�|�))�join��choicesrrr�group:�r$cGst|�dS)Nr�r$r"rrr�any;r%r'cGst|�dS)N�?r&r"rrr�maybe<r%r)z[ \f\t]*z	#[^\r\n]*z\\\r?\nz\w+z0[xX](?:_?[0-9a-fA-F])+z0[bB](?:_?[01])+z0[oO](?:_?[0-7])+z(?:0(?:_?0)*|[1-9](?:_?[0-9])*)z[eE][-+]?[0-9](?:_?[0-9])*z)[0-9](?:_?[0-9])*\.(?:[0-9](?:_?[0-9])*)?z\.[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*[jJ]z[jJ]cCs^ddddddg}dh}|D]>}t�|�D].}tjdd	�|D��D]}|�d�|��q@q(q|S)
N�b�r�u�f�br�fr�cSsg|]}||��f�qSr)�upper)�.0�crrr�
<listcomp>^sz(_all_string_prefixes.<locals>.<listcomp>)�
_itertools�permutations�product�addr!)�_valid_string_prefixes�result�prefix�tr,rrr�_all_string_prefixesSsr=cCst�|tj�Sr)�re�compile�UNICODE)�exprrrr�_compilebsrBz[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z'''z"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"T)�reversez\r?\nz'[^\n'\\]*(?:\\.[^\n'\\]*)*�'z"[^\n"\\]*(?:\\.[^\n"\\]*)*�"z
\\\r?\n|\Z�c@seZdZdS)�
TokenErrorN�rrrrrrrrG�srGc@seZdZdS)�StopTokenizingNrHrrrrrI�srIc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�UntokenizercCsg|_d|_d|_d|_dS)N�r)�tokens�prev_row�prev_col�encodingrrrr�__init__�szUntokenizer.__init__cCs�|\}}||jks&||jkr>||jkr>td�|||j|j���||j}|rb|j�d|�d|_||j}|r�|j�d|�dS)Nz+start ({},{}) precedes previous end ({},{})�\
r� )rMrN�
ValueError�formatrL�append)r�start�row�col�
row_offset�
col_offsetrrr�add_whitespace�s�

zUntokenizer.add_whitespacecCs6t|�}g}d}|D�]}t|�dkr8|�||��q*|\}}}}	}
|tkrV||_q|tkrd�q*|tkrz|�|�qnl|tkr�|�	�|	\|_
|_qnL|tt
fkr�d}n:|r�|r�|d}|dt|�kr�|j�|�t|�|_d}|�|�|j�|�|	\|_
|_|tt
fkr|j
d7_
d|_qd�|j�S)NF�T���rKrr0)�iter�len�compat�ENCODINGrO�	ENDMARKER�INDENTrU�DEDENT�poprMrN�NEWLINE�NLrLr[r!)r�iterable�it�indents�	startliner<�tok_type�tokenrV�end�line�indentrrrr�sF



zUntokenizer.untokenizec
Cs�g}|jj}|dttfk}d}t�|g|�D]�}|dd�\}}	|tkrR|	|_q.|tt	fkrf|	d7}	|t
kr�|rzd|	}	d}nd}|tkr�|�|	�q.n>|tkr�|�
�q.n*|ttfkr�d}n|r�|r�||d�d}||	�q.dS)NrFr\rRTr])rLrUrfrgr5�chainrarO�NAME�NUMBER�STRINGrcrdre)
rrmrhrj�toks_appendrk�
prevstring�tok�toknum�tokvalrrrr`�s8
zUntokenizer.compatN)rrrrPr[rr`rrrrrJ�s
%rJcCs*t�}|�|�}|jdk	r&|�|j�}|Sr)rJrrO�encode)rh�ut�outrrrrs


cCsH|dd����dd�}|dks*|�d�r.dS|dks@|�d�rDdS|S)	N��_�-�utf-8zutf-8-)zlatin-1�
iso-8859-1ziso-latin-1)zlatin-1-ziso-8859-1-ziso-latin-1-r�)�lower�replace�
startswith)�orig_enc�encrrr�_get_normal_names�r�cs�z�jj�Wntk
r$d�YnXd�d}d}�fdd�}��fdd�}|�}|�t�rpd�|dd�}d	}|s||gfS||�}|r�||gfSt�|�s�||gfS|�}|s�||gfS||�}|r�|||gfS|||gfS)
NFr�cs$z��WStk
rYdSXdS�Nr%)�
StopIterationr��readlinerr�read_or_stop?sz%detect_encoding.<locals>.read_or_stopcs�z|�d�}Wn4tk
rBd}�dk	r6d�|��}t|��YnXt�|�}|sVdSt|�d��}zt|�}Wn:t	k
r��dkr�d|}nd��|�}t|��YnX�r�|dkr؈dkr�d}n
d���}t|��|d	7}|S)
Nr�z'invalid or missing encoding declarationz{} for {!r}rKzunknown encoding: zunknown encoding for {!r}: {}zencoding problem: utf-8z encoding problem for {!r}: utf-8z-sig)
�decode�UnicodeDecodeErrorrT�SyntaxError�	cookie_re�matchr�r$r�LookupError)ro�line_string�msgr�rO�codec)�	bom_found�filenamerr�find_cookieEs8

�
z$detect_encoding.<locals>.find_cookieT��	utf-8-sig)�__self__�name�AttributeErrorr�r�blank_rer�)r�rO�defaultr�r��first�secondr)r�r�r�rr
's8
&




cCsXt|d�}z2t|j�\}}|�d�t||dd�}d|_|WS|���YnXdS)N�rbrT)�line_bufferingr+)�
_builtin_openr
r��seekr�mode�close)r��bufferrO�lines�textrrrr�s

rcCs6t|�\}}t�d�}t�|t|d�|�}t|j|�Sr�)r
r5�repeatrqr^�	_tokenize�__next__)r�rO�consumed�empty�rl_genrrrr�s
ccsld}}}d}d\}}d}dg}	|dk	rH|dkr6d}tt|ddd�Vd}
d}z|}
|�}Wntk
rvd}YnX|dk	r�|�|�}|d	7}dt|�}}
|�rp|s�td
|��|�|�}|�r|�d�}}tt||d|�|||f||�Vd\}}d}nf|�rZ|dd�dk�rZ|d
d�dk�rZtt	||||t|�f|�Vd}d}qPn||}||}qP�n�|dk�r|�s|�s��q�d}||
k�r�||dk�r�|d	7}n8||dk�r�|t
d	t
}n||dk�r�d}n�q�|d	7}�q�||
k�r�q�||dk�r�||dk�r^||d��d�}tt|||f||t|�f|�V|t|�7}tt
||d�||f|t|�f|�VqP||	dk�r�|	�|�tt|d|�|df||f|�V||	dk�r.||	k�r�tdd|||f��|	dd�}	ttd||f||f|�V�q�n|�s*td|df��d}||
krPtt��||�}|�r�|�d	�\}}||f||f|}}}||k�r��q.|||�||}}||k�s�|dk�r�|dk�r�|dk�r�tt||||�V�q�|dk�r|dk�r�tt
||||�Vntt||||�V�q�|dk�r2tt||||�V�q�|tk�r�tt|�}|�||�}|�r�|�d�}|||�}tt||||f|�Vn||f}||d�}|}qP�q�|tk�s�|dd�tk�s�|dd�tk�rF|ddk�r2||f}tt�|��pt�|d	��pt�|d��}||d�d	}}|}qPntt||||�Vnf|���rdtt||||�VnH|dk�rtd	}n8|dk�r�|d	7}n|d k�r�|d	8}tt||||�Vn*tt	||||f||d	f|�V|d	7}�q.qP|
�r |
ddk�r ttd|d	t|
�f|d	t|
�d	fd�V|	d	d�D] }ttd|df|dfd�V�q,ttd|df|dfd�VdS)!Nr�
0123456789)r0rr�r�)rrr0r%rKzEOF in multi-line string���rQ���z\
rR�	�z#
�#z
r]z3unindent does not match any outer indentation levelz
<tokenize>zEOF in multi-line statement�.z...r\r��
�\z([{z)]})rrar�r�r_rGr�rnrt�
ERRORTOKEN�tabsize�rstrip�COMMENTrgrUrc�IndentationErrorrdrB�PseudoToken�spanrsrf�
triple_quoted�endpats�
single_quoted�get�isidentifierrrrrb)r�rO�lnum�parenlev�	continued�numchars�contstr�needcont�contlinerj�	last_linero�pos�max�strstart�endprog�endmatchrn�column�
comment_token�pseudomatchrV�spos�eposrm�initialrprrrr��s<




�*

�


�
�
"

� 

���





����






�.r�cCs
t|d�Sr)r�r�rrrr	dsc

s$ddl}dd��d�fdd�	}|jdd�}|jdd	d
dd�|jd
ddddd�|��}z�|jr�|j}t|d��}tt|j��}W5QRXnd}t	t
jjd�}|D]>}|j}|j
r�|j}d|j|j}	td|	t||jf�q�W�n8tk
�r6}
z0|
jddd�\}}||
jd|||f�W5d}
~
XYn�tk
�r|}
z(|
jd\}}||
jd|||f�W5d}
~
XYn�tk
�r�}
z||
|�W5d}
~
XYnxtk
�r�}
z||
�W5d}
~
XYnNtk
�r�td�Yn2tk
�r}
z�d|
��W5d}
~
XYnXdS)NrcSstj�|�tj�d�dS)Nr�)�sys�stderr�write)�messagerrr�perrorpszmain.<locals>.perrorcsR|r"|f||f}�d|�n"|r8�d||f�n�d|�t�d�dS)Nz%s:%d:%d: error: %sz
%s: error: %sz	error: %srK)r��exit)r�r��location�args�r�rr�errortszmain.<locals>.errorzpython -m tokenize)�progr�r(zfilename.pyz'the file to tokenize; defaults to stdin)�dest�nargs�metavar�helpz-ez--exact�exact�
store_truez(display token names using the exact type)r��actionr�r�z<stdin>z%d,%d-%d,%d:z%-20s%-15s%-15rrKr�zinterrupted
zunexpected error: %s)NN)�argparse�ArgumentParser�add_argument�
parse_argsr�r��listrr�r�r��stdinr
r�rrVrn�printrrr�r�rGr��OSError�KeyboardInterrupt�	Exception)
r�r��parserr�r�r-rLrm�
token_type�token_range�errror�rr�r�mainlsT���&&r��__main__)R�
__author__�__credits__�builtinsrr��codecsrr�collections�ior�	itertoolsr5r>r�rmrr?�ASCIIr�r��__all__�
namedtuplerr$r'r)�
Whitespace�Comment�Ignore�Name�	Hexnumber�	Binnumber�	Octnumber�	Decnumber�	Intnumber�Exponent�
Pointfloat�Expfloat�Floatnumber�
Imagnumber�Numberr=rB�StringPrefix�Single�Double�Single3�Double3�Triple�String�map�escape�sorted�Special�Funny�
PlainToken�Token�ContStr�PseudoExtrasr�r��_prefix�setr�r�r<r,r8r�r�rGrIrJrr�r
rr�r	r�rrrrr�<module>s�
�
��

�
���

_]8=
zipimport.cpython-38.opt-1.pyc000064400000041425150335716500012203 0ustar00U

e5d-x�@sRdZddlZddlmZmZddlZddlZddlZddl	Z	ddl
Z
ddlZddgZej
Z
ejdd�ZGdd�de�ZiZee
�ZdZd	Zd
ZGdd�d�Ze
dd
d
fe
ddd
fddfZdd�Zdd�Zdd�Zdd�ZdZdadd�Z dd�Z!dd �Z"d!d"�Z#ee#j$�Z%d#d$�Z&d%d&�Z'd'd(�Z(d)d*�Z)d+d,�Z*d-d.�Z+Gd/d0�d0�Z,dS)1aPzipimport provides support for importing Python modules from Zip archives.

This module exports three objects:
- zipimporter: a class; its constructor takes a path to a Zip archive.
- ZipImportError: exception raised by zipimporter objects. It's a
  subclass of ImportError, so it can be caught as ImportError, too.
- _zip_directory_cache: a dict, mapping archive paths to zip directory
  info dicts, as used in zipimporter._files.

It is usually not needed to use the zipimport module explicitly; it is
used by the builtin import mechanism for sys.path items that are paths
to Zip archives.
�N)�_unpack_uint16�_unpack_uint32�ZipImportError�zipimporter�c@seZdZdS)rN)�__name__�
__module__�__qualname__�r
r
�!/usr/lib64/python3.8/zipimport.pyr!s�sPKi��c@sleZdZdZdd�Zddd�Zddd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)ra�zipimporter(archivepath) -> zipimporter object

    Create a new zipimporter instance. 'archivepath' must be a path to
    a zipfile, or to a specific path inside a zipfile. For example, it can be
    '/tmp/myimport.zip', or '/tmp/myimport.zip/mydirectory', if mydirectory is a
    valid directory inside the archive.

    'ZipImportError is raised if 'archivepath' doesn't point to a valid Zip
    archive.

    The 'archive' attribute of zipimporter objects contains the name of the
    zipfile targeted.
    c	Cs$t|t�sddl}|�|�}|s,td|d��tr<|�tt�}g}zt�	|�}WnHt
tfk
r�t�|�\}}||kr�td|d��|}|�
|�Yq@X|jd@dkr�td|d��q�q@zt|}Wn$tk
r�t|�}|t|<YnX||_||_tj|ddd��|_|j�r |jt7_dS)Nrzarchive path is empty��pathznot a Zip filei�i����)�
isinstance�str�os�fsdecoder�alt_path_sep�replace�path_sep�_bootstrap_external�
_path_stat�OSError�
ValueError�_path_split�append�st_mode�_zip_directory_cache�KeyError�_read_directory�_files�archive�
_path_join�prefix)�selfrrr$�st�dirname�basename�filesr
r
r�__init__?s:

zzipimporter.__init__NcCsNt||�}|dk	r|gfSt||�}t||�rFd|j�t�|��gfSdgfS)a�find_loader(fullname, path=None) -> self, str or None.

        Search for a module specified by 'fullname'. 'fullname' must be the
        fully qualified (dotted) module name. It returns the zipimporter
        instance itself if the module was found, a string containing the
        full path name if it's possibly a portion of a namespace package,
        or None otherwise. The optional 'path' argument is ignored -- it's
        there for compatibility with the importer protocol.
        N)�_get_module_info�_get_module_path�_is_dirr"r)r%�fullnamer�mi�modpathr
r
r�find_loaderms



zzipimporter.find_loadercCs|�||�dS)a�find_module(fullname, path=None) -> self or None.

        Search for a module specified by 'fullname'. 'fullname' must be the
        fully qualified (dotted) module name. It returns the zipimporter
        instance itself if the module was found, or None if it wasn't.
        The optional 'path' argument is ignored -- it's there for compatibility
        with the importer protocol.
        r)r1)r%r.rr
r
r�find_module�s	zzipimporter.find_modulecCst||�\}}}|S)z�get_code(fullname) -> code object.

        Return the code object for the specified module. Raise ZipImportError
        if the module couldn't be found.
        ��_get_module_code�r%r.�code�	ispackager0r
r
r�get_code�szzipimporter.get_codecCsvtr|�tt�}|}|�|jt�r:|t|jt�d�}z|j|}Wn tk
rhtdd|��YnXt	|j|�S)z�get_data(pathname) -> string with file data.

        Return the data associated with 'pathname'. Raise OSError if
        the file wasn't found.
        Nr�)
rrr�
startswithr"�lenr!rr�	_get_data)r%�pathname�key�	toc_entryr
r
r�get_data�szzipimporter.get_datacCst||�\}}}|S)zjget_filename(fullname) -> filename string.

        Return the filename for the specified module.
        r3r5r
r
r�get_filename�szzipimporter.get_filenamecCs�t||�}|dkr$td|��|d��t||�}|r@t�|d�}n
|�d�}z|j|}Wntk
rnYdSXt|j|��	�S)z�get_source(fullname) -> source string.

        Return the source code for the specified module. Raise ZipImportError
        if the module couldn't be found, return None if the archive does
        contain the module, but has no source for it.
        N�can't find module ��name�__init__.py�.py)
r+rr,rr#r!rr<r"�decode)r%r.r/r�fullpathr?r
r
r�
get_source�s


zzipimporter.get_sourcecCs(t||�}|dkr$td|��|d��|S)z�is_package(fullname) -> bool.

        Return True if the module specified by fullname is a package.
        Raise ZipImportError if the module couldn't be found.
        NrBrC)r+r)r%r.r/r
r
r�
is_package�s
zzipimporter.is_packagecCs�t||�\}}}tj�|�}|dks.t|t�s@t|�}|tj|<||_zT|rlt||�}t�	|j
|�}|g|_t|d�s|t
|_
t�|j||�t||j�Wntj|=�YnXztj|}Wn$tk
r�td|�d���YnXt�d||�|S)z�load_module(fullname) -> module.

        Load the module specified by 'fullname'. 'fullname' must be the
        fully qualified (dotted) module name. It returns the imported
        module, or raises ZipImportError if it wasn't found.
        N�__builtins__zLoaded module z not found in sys.moduleszimport {} # loaded from Zip {})r4�sys�modules�getr�_module_type�
__loader__r,rr#r"�__path__�hasattrrK�_fix_up_module�__dict__�execr�ImportError�
_bootstrap�_verbose_message)r%r.r6r7r0�modrrHr
r
r�load_module�s0


zzipimporter.load_modulecCsXz|�|�sWdSWntk
r*YdSXtjsNddlm}|�t�dt_t||�S)z�Return the ResourceReader for a package in a zip file.

        If 'fullname' is a package within the zip file, return the
        'ResourceReader' object for the package.  Otherwise return None.
        Nr)�ResourceReaderT)rJr�_ZipImportResourceReader�_registered�
importlib.abcr[�register)r%r.r[r
r
r�get_resource_readers


zzipimporter.get_resource_readercCsd|j�t�|j�d�S)Nz<zipimporter object "z">)r"rr$)r%r
r
r�__repr__"szzipimporter.__repr__)N)N)rrr	�__doc__r*r1r2r8r@rArIrJrZr`rar
r
r
rr-s.
 


&z__init__.pycTrEF)z.pycTF)rFFFcCs|j|�d�dS)N�.�)r$�
rpartition)r%r.r
r
rr,4sr,cCs|t}||jkS�N)rr!)r%r�dirpathr
r
rr-8sr-cCs8t||�}tD]$\}}}||}||jkr|SqdSrf)r,�_zip_searchorderr!)r%r.r�suffix�
isbytecoder7rHr
r
rr+As


r+c	Cs�zt�|�}Wn&tk
r4td|��|d��YnX|���z$|�td�|��}|�t�}Wn&tk
r�td|��|d��YnXt|�tkr�td|��|d��|dd�t	k�r�z|�dd�|��}Wn&tk
r�td|��|d��YnXt
|ttd�}z|�|�|��}Wn(tk
�rJtd|��|d��YnX|�t	�}|dk�rrtd|��|d��|||t�}t|�tk�r�td|��|d��|t|�|}t
|d	d
��}t
|d
d��}	||k�r�td|��|d��||	k�r
td
|��|d��||8}||	}
|
dk�r6td|��|d��i}d}z|�|�Wn(tk
�rttd|��|d��YnX|�d�}t|�dk�r�td��|dd�dk�r��q�t|�dk�r�td��t|dd��}
t|dd	��}t|d	d��}t|dd
��}t
|d
d��}t
|dd��}t
|dd��}t|dd��}t|dd��}t|dd��}t
|dd��}|||}||	k�r�td|��|d��||
7}z|�|�}Wn(tk
�r�td|��|d��YnXt|�|k�r�td|��|d��z2t|�||��||k�r*td|��|d��Wn(tk
�rTtd|��|d��YnX|
d@�rj|��}n6z|�d�}Wn&tk
�r�|�d��t�}YnX|�dt�}t�||�}||||||||f}|||<|d 7}�qvW5QRXt�d!||�|S)"Nzcan't open Zip file: r
rd�can't read Zip file: �rznot a Zip file: zcorrupt Zip file: ���zbad central directory size: zbad central directory offset: z&bad central directory size or offset: �.�EOF read where not expectedsPK��
����� �"�*zbad local header offset: i�ascii�latin1�/rz!zipimport: found {} names in {!r})�_io�	open_coderr�seek�END_CENTRAL_DIR_SIZE�tell�readr;�STRING_END_ARCHIVE�max�MAX_COMMENT_LEN�rfindr�EOFErrorrrG�UnicodeDecodeError�	translate�cp437_tablerrrr#rWrX)r"�fp�header_position�buffer�	file_size�max_comment_start�data�pos�header_size�
header_offset�
arc_offsetr)�count�flags�compress�time�date�crc�	data_size�	name_size�
extra_size�comment_size�file_offsetrDr�tr
r
rr `s�
���

�


�
�






r u�	

 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ cCsltrt�d�td��daz<zddlm}Wn&tk
rRt�d�td��YnXW5daXt�d�|S)Nzzipimport: zlib UNAVAILABLE�)can't decompress data; zlib not availableTFr��
decompresszzipimport: zlib available)�_importing_zlibrWrXr�zlibr��	Exceptionr�r
r
r�_get_decompress_func�s


r�c	Cs�|\}}}}}}}}	|dkr$td��t�|���}
z|
�|�Wn&tk
rftd|��|d��YnX|
�d�}t|�dkr�td��|dd�dkr�td	|��|d��t|d
d��}t|dd��}
d||
}||7}z|
�|�Wn(tk
�rtd|��|d��YnX|
�|�}t|�|k�r4td��W5QRX|dk�rL|Sz
t	�}Wnt
k
�rttd
��YnX||d�S)Nrznegative data sizerkr
rwrqrlsPKzbad local file header: �rvzzipimport: can't read datar�i�)rr~rr�rr�r;r�rr�r�)r"r?�datapathr�r�r�r�r�r�r�r�r�r�r�r��raw_datar�r
r
rr<s>



r<cCst||�dkS)Nr)�abs)�t1�t2r
r
r�	_eq_mtimeAsr�cCs<||d�}zt�|||�}Wntk
r2YdSX|d@dk}|r�|d@dk}tjdkr�|shtjdkr�t||�}	|	dk	r�t�tj|	�}
zt�||
||�Wntk
r�YdSXnTt	||�\}}|�r
t
t|dd��|�r�t|dd	��|k�r
t�
d
|���dSt�|d	d��}
t|
t��s8td|�d���|
S)
N)rDrrrrd�never�alwaysrrrmrnzbytecode is stale for zcompiled module z is not a code object)r�
_classify_pycrV�_imp�check_hash_based_pycs�_get_pyc_source�source_hash�_RAW_MAGIC_NUMBER�_validate_hash_pyc�_get_mtime_and_size_of_sourcer�rrWrX�marshal�loadsr�
_code_type�	TypeError)r%r=rHr.r��exc_detailsr��
hash_based�check_source�source_bytesr��source_mtime�source_sizer6r
r
r�_unmarshal_codeKsX�
��
��
���r�cCs|�dd�}|�dd�}|S)Ns
�
�
)r)�sourcer
r
r�_normalize_line_endings~sr�cCst|�}t||ddd�S)NrUT)�dont_inherit)r��compile)r=r�r
r
r�_compile_source�sr�cCsDt�|d?d|d?d@|d@|d?|d?d@|d@dd	d	d	f	�S)
N�	i������?rdr)r��mktime)�dr�r
r
r�_parse_dostime�s



�r�c
Cs`z>|dd�}|j|}|d}|d}|d}t||�|fWStttfk
rZYdSXdS)Nrr���)rr)r!r�r�
IndexErrorr�)r%rr?r�r��uncompressed_sizer
r
rr��s
r�cCsB|dd�}z|j|}Wntk
r0YdSXt|j|�SdS)Nr)r!rr<r")r%rr?r
r
rr��sr�c	Cs�t||�}tD]�\}}}||}tjd|jt|dd�z|j|}Wntk
rXYqX|d}t|j|�}	|r�t	|||||	�}
n
t
||	�}
|
dkr�q|d}|
||fSqtd|��|d��dS)Nz
trying {}{}{}rd)�	verbosityrrBrC)r,rhrWrXr"rr!rr<r�r�r)r%r.rrirjr7rHr?r0r�r6r
r
rr4�s$

r4c@s<eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
S)r\z�Private class used to support ZipImport.get_resource_reader().

    This class is allowed to reference all the innards and private parts of
    the zipimporter.
    FcCs||_||_dSrf)rr.)r%rr.r
r
rr*�sz!_ZipImportResourceReader.__init__cCs\|j�dd�}|�d|��}ddlm}z||j�|��WStk
rVt|��YnXdS)Nrcr}r)�BytesIO)r.r�ior�rr@r�FileNotFoundError)r%�resource�fullname_as_pathrr�r
r
r�
open_resource�sz&_ZipImportResourceReader.open_resourcecCst�dSrf)r�)r%r�r
r
r�
resource_path�sz&_ZipImportResourceReader.resource_pathcCsH|j�dd�}|�d|��}z|j�|�Wntk
rBYdSXdS)Nrcr}FT)r.rrr@r)r%rDr�rr
r
r�is_resource�sz$_ZipImportResourceReader.is_resourcec		cs�ddlm}||j�|j��}|�|jj�}|j}t�}|jj	D]f}z||��|�}Wnt
k
rnYq@YnX|jj}t|�dkr�|jVq@||kr@|�
|�|Vq@dS)Nr)�Path)�pathlibr�rrAr.�relative_tor"�parent�setr!rrDr;�add)	r%r��
fullname_path�
relative_path�package_path�subdirs_seen�filename�relative�parent_namer
r
r�contents�s 


z!_ZipImportResourceReader.contentsN)
rrr	rbr]r*r�r�r�r�r
r
r
rr\�s	r\)-rb�_frozen_importlib_externalrrr�_frozen_importlibrWr�r~r�rLr��__all__r�path_separatorsrrVrr�typerOr�r�r�rrhr,r-r+r r�r�r�r<r�r��__code__r�r�r�r�r�r�r4r\r
r
r
r�<module>sX�		~�.
.

ast.cpython-38.pyc000064400000040575150335716500010003 0ustar00U

e5d"K�@s�dZddlTd=ddd�dd	�Zd
d�Zd>d
d�Zdd�Zdd�Zd?dd�Zdd�Zdd�Z	d@dd�Z
dd�Zdd�Zdd �d!d"�Z
d#d$�ZGd%d&�d&e�ZGd'd(�d(e�Zd)d*�Zd+d,�Zeee�e_eee�e_Gd-d.�d.e�Zd/d0�ZGd1d2�d2eed3�ZGd4d5�d5eed3�ZGd6d7�d7eed3�ZGd8d9�d9eed3�ZGd:d;�d;eed3�Zee e!e"fee#fee$feed�e%feed<�fiZ&ee%fiZ'e%d9ed�d9e d2e!d2e"d2e#d5e$d7ed<�d;iZ(dS)AaH
    ast
    ~~~

    The `ast` module helps Python applications to process trees of the Python
    abstract syntax grammar.  The abstract syntax itself might change with
    each Python release; this module helps to find out programmatically what
    the current grammar looks like and allows modifications of it.

    An abstract syntax tree can be generated by passing `ast.PyCF_ONLY_AST` as
    a flag to the `compile()` builtin function or by using the `parse()`
    function from this module.  The result will be a tree of objects whose
    classes all inherit from `ast.AST`.

    A modified abstract syntax tree can be compiled into a Python code object
    using the built-in `compile()` function.

    Additionally various helper functions are provided that make working with
    the trees simpler.  The main intention of the helper functions and this
    module in general is to provide an easy to use interface for libraries
    that work tightly with the python syntax (template engines for example).


    :copyright: Copyright 2008 by Armin Ronacher.
    :license: Python License.
�)�*�	<unknown>�execFN)�
type_comments�feature_versioncCsRt}|r|tO}t|t�r4|\}}|dks.t�|}n|dkr@d}t|||||d�S)z�
    Parse the source into an AST node.
    Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
    Pass type_comments=True to get back type comments where the syntax allows.
    �N���)�_feature_version)Z
PyCF_ONLY_ASTZPyCF_TYPE_COMMENTS�
isinstance�tuple�AssertionError�compile)�source�filename�moderr�flags�major�minor�r�/usr/lib64/python3.8/ast.py�parses

�rcs`t|t�rt|dd�}t|t�r&|j}dd���fdd���fdd������fd	d
���|�S)a
    Safely evaluate an expression node or a string containing a Python
    expression.  The string or node provided may only consist of the following
    Python literal structures: strings, bytes, numbers, tuples, lists, dicts,
    sets, booleans, and None.
    �eval)rcSstd|����dS)Nzmalformed node or string: )�
ValueError��noderrr�_raise_malformed_node>sz+literal_eval.<locals>._raise_malformed_nodecs,t|t�rt|j�tttfkr&�|�|jS�N)r
�Constant�type�value�int�float�complexr)rrr�_convert_num@sz"literal_eval.<locals>._convert_numcsDt|t�r<t|jttf�r<�|j�}t|jt�r6|
S|S�|�Sr)r
ZUnaryOp�opZUAddZUSub�operand)rr%)r#rr�_convert_signed_numDs
z)literal_eval.<locals>._convert_signed_numcst|t�r|jSt|t�r*tt�|j��St|t�rDtt�|j��St|t	�r^t
t�|j��St|t�r�t|j
�t|j�kr��|�ttt�|j
�t�|j���St|t��rt|jttf��r�|j�}�|j�}t|ttf��rt|t��rt|jt��r||S||S�|�Sr)r
rrZTupler�mapZeltsZList�list�Set�setZDict�len�keys�values�dict�zipZBinOpr$ZAddZSub�left�rightr r!r")rr0r1��_convertr#r&rrrr3Ls,





�

zliteral_eval.<locals>._convert)r
�strrZ
Expression�body)Znode_or_stringrr2r�literal_eval3s

r6Tcs2���fdd��t|t�s*td|jj���|�S)a�
    Return a formatted dump of the tree in node.  This is mainly useful for
    debugging purposes.  If annotate_fields is true (by default),
    the returned string will show the names and the values for fields.
    If annotate_fields is false, the result string will be more compact by
    omitting unambiguous field names.  Attributes such as line
    numbers and column offsets are not dumped by default.  If this is wanted,
    include_attributes can be set to true.
    c	st|t�r�g}�}|jD]V}zt||�}Wntk
rBd}YqX|r`|�d|�|�f�q|��|��q�r�|jr�|jD]:}z |�d|�t||��f�Wq�tk
r�Yq�Xq�d|jjd�	|�fSt|t
�r�dd�	�fdd�|D��St|�S)NTz%s=%sz%s(%s)z, z[%s]c3s|]}�|�VqdSrr)�.0�x)�_formatrr�	<genexpr>�sz(dump.<locals>._format.<locals>.<genexpr>)r
�AST�_fields�getattr�AttributeError�append�_attributes�	__class__�__name__�joinr(�repr)r�args�keywords�fieldr�a�r9�annotate_fields�include_attributesrrr9ps*




 
zdump.<locals>._formatzexpected AST, got %r)r
r;�	TypeErrorrArB)rrJrKrrIr�dumpfs

rMcCsVdD]L}||jkr||jkrt||d�}|dk	sDt||�r|�d�rt|||�q|S)z�
    Copy source location (`lineno`, `col_offset`, `end_lineno`, and `end_col_offset`
    attributes) from *old_node* to *new_node* if possible, and return *new_node*.
    )�lineno�
col_offset�
end_lineno�end_col_offsetNZend_)r@r=�hasattr�
startswith�setattr)�new_nodeZold_node�attrrrrr�
copy_location�s��rWcs �fdd���|dddd�|S)a{
    When you compile a node tree with compile(), the compiler expects lineno and
    col_offset attributes for every node that supports them.  This is rather
    tedious to fill in for generated nodes, so this helper adds these attributes
    recursively where not already set, by setting them to the values of the
    parent node.  It works recursively starting at *node*.
    cs�d|jkr"t|d�s||_n|j}d|jkrDt|d�s>||_n|j}d|jkrft|d�s`||_n|j}d|jkr�t|d�s�||_n|j}t|�D]}�|||||�q�dS)NrNrPrOrQ)r@rRrNrPrOrQ�iter_child_nodes)rrNrOrPrQ�child��_fixrrr[�s$







z#fix_missing_locations.<locals>._fix�rrrrrZr�fix_missing_locations�sr]r\cCsVt|�D]H}d|jkr(t|dd�||_d|jkrt|dd�}dk	r|||_q|S)z�
    Increment the line number and end line number of each node in the tree
    starting at *node* by *n*. This is useful to "move code" to a different
    location in a file.
    rNrrPN)�walkr@r=rNrP)r�nrYrPrrr�increment_lineno�s
��r`c	cs:|jD].}z|t||�fVWqtk
r2YqXqdS)zs
    Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
    that is present on *node*.
    N)r<r=r>)rrGrrr�iter_fields�s

raccsLt|�D]>\}}t|t�r"|Vqt|t�r|D]}t|t�r0|Vq0qdS)z�
    Yield all direct child nodes of *node*, that is, all fields that are nodes
    and all items of fields that are lists of nodes.
    N)rar
r;r()r�namerG�itemrrrrX�s


rXcCs�t|ttttf�s"td|jj��|jr8t|jdt	�s<dS|jdj
}t|t�rZ|j}n"t|t
�rxt|j
t�rx|j
}ndS|r�ddl}|�|�}|S)aC
    Return the docstring for the given node or None if no docstring can
    be found.  If the node provided does not have docstrings a TypeError
    will be raised.

    If *clean* is `True`, all tabs are expanded to spaces and any whitespace
    that can be uniformly removed from the second line onwards is removed.
    z%r can't have docstringsrN)r
ZAsyncFunctionDefZFunctionDefZClassDefZModulerLrArBr5ZExprr�Str�srr4�inspectZcleandoc)rZclean�textrfrrr�
get_docstring�s	

rhcCs�d}g}d}|t|�krx||}||7}|d7}|dkr`|t|�kr`||dkr`|d7}|d7}|dkr|�|�d}q|r�|�|�|S)z}Split a string into lines ignoring form feed and other chars.

    This mimics how the Python parser splits source code.
    r�r\�
�
z
)r+r?)r�idx�linesZ	next_line�crrr�_splitlines_no_ffs  

rocCs,d}|D]}|dkr||7}q|d7}q|S)z6Replace all chars except '\f\t' in a line with spaces.riz	� r)r�resultrnrrr�_pad_whitespaces

rr)�paddedcCs�z$|jd}|jd}|j}|j}Wntk
r:YdSXt|�}||krd||��||���S|r�t||��d|����}nd}|||��|d���}	||��d|���}
||d|�}|�	d|	�|�
|
�d�|�S)aBGet source code segment of the *source* that generated *node*.

    If some location information (`lineno`, `end_lineno`, `col_offset`,
    or `end_col_offset`) is missing, return None.

    If *padded* is `True`, the first line of a multi-line statement will
    be padded with spaces to match its original position.
    r\Nrir)rNrPrOrQr>ro�encode�decoderr�insertr?rC)rrrsrNrPrOrQrmZpadding�firstZlastrrr�get_source_segment*s&	



rxccs<ddlm}||g�}|r8|��}|�t|��|VqdS)z�
    Recursively yield all descendant nodes in the tree starting at *node*
    (including *node* itself), in no specified order.  This is useful if you
    only want to modify nodes in place and don't care about the context.
    r)�dequeN)�collectionsry�popleft�extendrX)rryZtodorrrr^Ms
r^c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�NodeVisitora<
    A node visitor base class that walks the abstract syntax tree and calls a
    visitor function for every node found.  This function may return a value
    which is forwarded by the `visit` method.

    This class is meant to be subclassed, with the subclass adding visitor
    methods.

    Per default the visitor functions for the nodes are ``'visit_'`` +
    class name of the node.  So a `TryFinally` node visit function would
    be `visit_TryFinally`.  This behavior can be changed by overriding
    the `visit` method.  If no visitor function exists for a node
    (return value `None`) the `generic_visit` visitor is used instead.

    Don't use the `NodeVisitor` if you want to apply changes to nodes during
    traversing.  For this a special visitor exists (`NodeTransformer`) that
    allows modifications.
    cCs"d|jj}t|||j�}||�S)z
Visit a node.�visit_)rArBr=�
generic_visit)�selfr�method�visitorrrr�visitoszNodeVisitor.visitcCsTt|�D]F\}}t|t�r:|D]}t|t�r|�|�qqt|t�r|�|�qdS)z9Called if no explicit visitor function exists for a node.N)rar
r(r;r�)r�rrGrrcrrrrus


zNodeVisitor.generic_visitc	Cs�|j}t�t|��}|dkr@t��D]\}}t||�r$|}q@q$|dk	r�d|}zt||�}Wntk
rrYn&Xddl}|�	|�d�t
d�||�S|�|�S)Nr~rz" is deprecated; add visit_Constant�)r�_const_node_type_names�getr�itemsr
r=r>�warnings�warn�PendingDeprecationWarningr)	r�rrZ	type_name�clsrbr�r�r�rrr�visit_Constants(
�zNodeVisitor.visit_ConstantN)rB�
__module__�__qualname__�__doc__r�rr�rrrrr}[s
r}c@seZdZdZdd�ZdS)�NodeTransformeraG
    A :class:`NodeVisitor` subclass that walks the abstract syntax tree and
    allows modification of nodes.

    The `NodeTransformer` will walk the AST and use the return value of the
    visitor methods to replace or remove the old node.  If the return value of
    the visitor method is ``None``, the node will be removed from its location,
    otherwise it is replaced with the return value.  The return value may be the
    original node in which case no replacement takes place.

    Here is an example transformer that rewrites all occurrences of name lookups
    (``foo``) to ``data['foo']``::

       class RewriteName(NodeTransformer):

           def visit_Name(self, node):
               return Subscript(
                   value=Name(id='data', ctx=Load()),
                   slice=Index(value=Str(s=node.id)),
                   ctx=node.ctx
               )

    Keep in mind that if the node you're operating on has child nodes you must
    either transform the child nodes yourself or call the :meth:`generic_visit`
    method for the node first.

    For nodes that were part of a collection of statements (that applies to all
    statement nodes), the visitor may also return a list of nodes rather than
    just a single node.

    Usually you use the transformer like this::

       node = YourTransformer().visit(node)
    cCs�t|�D]�\}}t|t�rvg}|D]D}t|t�r\|�|�}|dkrFq"nt|t�s\|�|�q"|�|�q"||dd�<qt|t�r|�|�}|dkr�t||�qt|||�q|Sr)	rar
r(r;r�r|r?�delattrrT)r�rrG�	old_valueZ
new_valuesrrUrrrr�s&






zNodeTransformer.generic_visitN)rBr�r�r�rrrrrr��s#r�cCs|jSr�r)r�rrr�_getter�sr�cCs
||_dSrr�)r�rrrr�_setter�sr�c@seZdZdd�ZdS)�_ABCcCsft|t�sdS|tkrZz
|j}Wntk
r6YdSXt|t|�oXt|t�|d��St�||�S)NFr)	r
r�_const_typesrr>�_const_types_notr�r�__instancecheck__)r��instrrrrr��s

�z_ABC.__instancecheck__N)rBr�r�r�rrrrr��sr�cOsf|D]<}||jkrq|j�|�}|t|�krt|j�d|����q|tkrTt||�Stj|f|�|�S)Nz" got multiple values for argument )r<�indexr+rLrBr�r�__new__)r�rE�kwargs�key�posrrr�_new�s

r�c@seZdZdZeZdS)�Num)r_N�rBr�r�r<r�r�rrrrr��sr�)�	metaclassc@seZdZdZeZdS)rd�reNr�rrrrrd�srdc@seZdZdZeZdS)�Bytesr�Nr�rrrrr�sr�c@seZdZeZdS)�NameConstantN)rBr�r�r�r�rrrrr�sr�c@seZdZdZdd�ZdS)�EllipsisrcOs(|tkrtd|�|�Stj|f|�|�S)N.).)r�rr�)r�rEr�rrrr�szEllipsis.__new__N)rBr�r�r<r�rrrrr�sr�.)rr)TF)r\)T))r��_astrr6rMrWr]r`rarXrhrorrrxr^�objectr}r�r�r��propertyrr_rerr�r�r�rdr�r�r�r r!r"r4�bytes�boolr�r�r�rrrr�<module>sz�3
'#

#:>	
���lzma.cpython-38.opt-1.pyc000064400000027364150335716500011117 0ustar00U

e5d�2�$@s�dZddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$g$Zd%d&lZd%d&lZd%d&lZd%d'lTd%d(lmZmZd%d&lZd%Z	d)Z
d*ZGd+d�dej�Z
d2d&d-d&d&d&d&d&d.�d/d!�Zed-d&d&fd0d"�Zed&d&fd1d#�Zd&S)3aSInterface to the liblzma compression library.

This module provides a class for reading and writing compressed files,
classes for incremental (de)compression, and convenience functions for
one-shot (de)compression.

These classes and functions support both the XZ and legacy LZMA
container formats, as well as raw compressed data streams.
Z
CHECK_NONEZCHECK_CRC32ZCHECK_CRC64ZCHECK_SHA256ZCHECK_ID_MAXZ
CHECK_UNKNOWNZFILTER_LZMA1ZFILTER_LZMA2ZFILTER_DELTAZ
FILTER_X86ZFILTER_IA64Z
FILTER_ARMZFILTER_ARMTHUMBZFILTER_POWERPCZFILTER_SPARC�FORMAT_AUTO�	FORMAT_XZZFORMAT_ALONEZ
FORMAT_RAWZMF_HC3ZMF_HC4ZMF_BT2ZMF_BT3ZMF_BT4Z	MODE_FASTZMODE_NORMALZPRESET_DEFAULTZPRESET_EXTREME�LZMACompressor�LZMADecompressor�LZMAFile�	LZMAError�open�compress�
decompressZis_check_supported�N)�*)�_encode_filter_properties�_decode_filter_properties��c@s�eZdZdZd"ddddd�dd�Zdd	�Zed
d��Zdd
�Zdd�Z	dd�Z
dd�Zd#dd�Zd$dd�Z
d%dd�Zd&dd�Zdd�Zejfdd�Zd d!�ZdS)'ra@A file object providing transparent LZMA (de)compression.

    An LZMAFile can act as a wrapper for an existing file object, or
    refer directly to a named file on disk.

    Note that LZMAFile provides a *binary* file interface - data read
    is returned as bytes, and data to be written must be given as bytes.
    N�r�����format�check�preset�filtersc	Cs&d|_d|_t|_|dkrL|dkr*td��|dk	r:td��|dkrFt}t}n@|dkr~|dkr`t}t}t	||||d�|_
d	|_ntd
�|���t
|tttjf�r�d|kr�|d7}t�||�|_d|_||_n*t|d
�s�t|d�r�||_||_ntd��|jtk�r"tj|jtt||d�}t�|�|_dS)a�Open an LZMA-compressed file in binary mode.

        filename can be either an actual file name (given as a str,
        bytes, or PathLike object), in which case the named file is
        opened, or it can be an existing file object to read from or
        write to.

        mode can be "r" for reading (default), "w" for (over)writing,
        "x" for creating exclusively, or "a" for appending. These can
        equivalently be given as "rb", "wb", "xb" and "ab" respectively.

        format specifies the container format to use for the file.
        If mode is "r", this defaults to FORMAT_AUTO. Otherwise, the
        default is FORMAT_XZ.

        check specifies the integrity check to use. This argument can
        only be used when opening a file for writing. For FORMAT_XZ,
        the default is CHECK_CRC64. FORMAT_ALONE and FORMAT_RAW do not
        support integrity checks - for these formats, check must be
        omitted, or be CHECK_NONE.

        When opening a file for reading, the *preset* argument is not
        meaningful, and should be omitted. The *filters* argument should
        also be omitted, except when format is FORMAT_RAW (in which case
        it is required).

        When opening a file for writing, the settings used by the
        compressor can be specified either as a preset compression
        level (with the *preset* argument), or in detail as a custom
        filter chain (with the *filters* argument). For FORMAT_XZ and
        FORMAT_ALONE, the default is to use the PRESET_DEFAULT preset
        level. For FORMAT_RAW, the caller must always specify a filter
        chain; the raw compressor does not support preset compression
        levels.

        preset (if provided) should be an integer in the range 0-9,
        optionally OR-ed with the constant PRESET_EXTREME.

        filters (if provided) should be a sequence of dicts. Each dict
        should have an entry for "id" indicating ID of the filter, plus
        additional entries for options to the filter.
        NF)r�rbrzACannot specify an integrity check when opening a file for readingzICannot specify a preset compression level when opening a file for reading)�w�wb�aZab�xZxbrr
zInvalid mode: {!r}�bT�read�writez6filename must be a str, bytes, file or PathLike object)Ztrailing_errorrr)�_fp�_closefp�_MODE_CLOSED�_mode�
ValueErrorr�
_MODE_READr�_MODE_WRITEr�_compressor�_posr�
isinstance�str�bytes�os�PathLike�builtinsr�hasattr�	TypeError�_compressionZDecompressReaderrr�io�BufferedReader�_buffer)	�self�filename�moderrrrZ	mode_code�raw�r8�/usr/lib64/python3.8/lzma.py�__init__1sL,�
�zLZMAFile.__init__cCs�|jtkrdSzB|jtkr,|j��d|_n"|jtkrN|j�|j	�
��d|_	W5z|jrd|j��W5d|_d|_t|_XXdS)z�Flush and close the file.

        May be called more than once without error. Once the file is
        closed, any other operation on it will raise a ValueError.
        NF)r"r!rr �closer$r3r%rr&�flush�r4r8r8r9r;�s




zLZMAFile.closecCs
|jtkS)zTrue if this file is closed.)r"r!r=r8r8r9�closed�szLZMAFile.closedcCs|��|j��S)z3Return the file descriptor for the underlying file.)�_check_not_closedr�filenor=r8r8r9r@�szLZMAFile.filenocCs|��o|j��S)z)Return whether the file supports seeking.)�readabler3�seekabler=r8r8r9rB�szLZMAFile.seekablecCs|��|jtkS)z/Return whether the file was opened for reading.)r?r"r$r=r8r8r9rA�szLZMAFile.readablecCs|��|jtkS)z/Return whether the file was opened for writing.)r?r"r%r=r8r8r9�writable�szLZMAFile.writablecCs|��|j�|�S)z�Return buffered data without advancing the file position.

        Always returns at least one byte of data, unless at EOF.
        The exact number of bytes returned is unspecified.
        )�_check_can_readr3�peek�r4�sizer8r8r9rE�sz
LZMAFile.peekcCs|��|j�|�S)z�Read up to size uncompressed bytes from the file.

        If size is negative or omitted, read until EOF is reached.
        Returns b"" if the file is already at EOF.
        )rDr3rrFr8r8r9r�sz
LZMAFile.readcCs"|��|dkrtj}|j�|�S)z�Read up to size uncompressed bytes, while trying to avoid
        making multiple reads from the underlying stream. Reads up to a
        buffer's worth of data if size is negative.

        Returns b"" if the file is at EOF.
        r
)rDr1�DEFAULT_BUFFER_SIZEr3�read1rFr8r8r9rI�szLZMAFile.read1cCs|��|j�|�S)a
Read a line of uncompressed bytes from the file.

        The terminating newline (if present) is retained. If size is
        non-negative, no more than size bytes will be read (in which
        case the line may be incomplete). Returns b'' if already at EOF.
        )rDr3�readlinerFr8r8r9rJ�szLZMAFile.readlinecCs:|��|j�|�}|j�|�|jt|�7_t|�S)z�Write a bytes object to the file.

        Returns the number of uncompressed bytes written, which is
        always len(data). Note that due to buffering, the file on disk
        may not reflect the data written until close() is called.
        )Z_check_can_writer&rrrr'�len)r4�dataZ
compressedr8r8r9r�s
zLZMAFile.writecCs|��|j�||�S)a�Change the file position.

        The new position is specified by offset, relative to the
        position indicated by whence. Possible values for whence are:

            0: start of stream (default): offset must not be negative
            1: current stream position
            2: end of stream; offset must not be positive

        Returns the new file position.

        Note that seeking is emulated, so depending on the parameters,
        this operation may be extremely slow.
        )Z_check_can_seekr3�seek)r4�offset�whencer8r8r9rM�sz
LZMAFile.seekcCs"|��|jtkr|j��S|jS)z!Return the current file position.)r?r"r$r3�tellr'r=r8r8r9rP�s

z
LZMAFile.tell)Nr)r)r)r)r)�__name__�
__module__�__qualname__�__doc__r:r;�propertyr>r@rBrArCrErrIrJrr1�SEEK_SETrMrPr8r8r8r9r&s*	�U


	



rr)rrrr�encoding�errors�newlinecCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|�dd�}	t||	||||d	�}
d|kr�t�|
|||�S|
SdS)
a�Open an LZMA-compressed file in binary or text mode.

    filename can be either an actual file name (given as a str, bytes,
    or PathLike object), in which case the named file is opened, or it
    can be an existing file object to read from or write to.

    The mode argument can be "r", "rb" (default), "w", "wb", "x", "xb",
    "a", or "ab" for binary mode, or "rt", "wt", "xt", or "at" for text
    mode.

    The format, check, preset and filters arguments specify the
    compression settings, as for LZMACompressor, LZMADecompressor and
    LZMAFile.

    For binary mode, this function is equivalent to the LZMAFile
    constructor: LZMAFile(filename, mode, ...). In this case, the
    encoding, errors and newline arguments must not be provided.

    For text mode, an LZMAFile object is created, and wrapped in an
    io.TextIOWrapper instance with the specified encoding, error
    handling behavior, and line ending(s).

    �trzInvalid mode: %rNz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary mode�r)r#�replacerr1�
TextIOWrapper)r5r6rrrrrWrXrYZlz_modeZbinary_filer8r8r9rs"
�cCs t||||�}|�|�|��S)z�Compress a block of data.

    Refer to LZMACompressor's docstring for a description of the
    optional arguments *format*, *check*, *preset* and *filters*.

    For incremental compression, use an LZMACompressor instead.
    )rrr<)rLrrrr�compr8r8r9r6scCspg}t|||�}z|�|�}Wn tk
r>|r8Yqfn�YnX|�|�|jsXtd��|j}|sqfqd�|�S)z�Decompress a block of data.

    Refer to LZMADecompressor's docstring for a description of the
    optional arguments *format*, *check* and *filters*.

    For incremental decompression, use an LZMADecompressor instead.
    zACompressed data ended before the end-of-stream marker was reached�)rr	r�append�eofZunused_data�join)rLrZmemlimitrZresultsZdecomp�resr8r8r9r	Bs
)r)rT�__all__r-r1r+Z_lzmarr
r0r!r$r%Z
BaseStreamrrrrrr	r8r8r8r9�<module>sv�
b�/shelve.cpython-38.pyc000064400000022424150335716500010473 0ustar00U

e5dO!�@s�dZddlmZmZddlmZddlZddddgZGd	d
�d
ej	j
�ZGdd�dej	j
�ZGdd�de�Z
Gd
d�de�Zddd�ZdS)a�
Manage shelves of pickled objects.

A "shelf" is a persistent, dictionary-like object.  The difference
with dbm databases is that the values (not the keys!) in a shelf can
be essentially arbitrary Python objects -- anything that the "pickle"
module can handle.  This includes most class instances, recursive data
types, and objects containing lots of shared sub-objects.  The keys
are ordinary strings.

To summarize the interface (key is a string, data is an arbitrary
object):

        import shelve
        d = shelve.open(filename) # open, with (g)dbm filename -- no suffix

        d[key] = data   # store data at key (overwrites old data if
                        # using an existing key)
        data = d[key]   # retrieve a COPY of the data at key (raise
                        # KeyError if no such key) -- NOTE that this
                        # access returns a *copy* of the entry!
        del d[key]      # delete data stored at key (raises KeyError
                        # if no such key)
        flag = key in d # true if the key exists
        list = d.keys() # a list of all existing keys (slow!)

        d.close()       # close it

Dependent on the implementation, closing a persistent dictionary may
or may not be necessary to flush changes to disk.

Normally, d[key] returns a COPY of the entry.  This needs care when
mutable entries are mutated: for example, if d[key] is a list,
        d[key].append(anitem)
does NOT modify the entry d[key] itself, as stored in the persistent
mapping -- it only modifies the copy, which is then immediately
discarded, so that the append has NO effect whatsoever.  To append an
item to d[key] in a way that will affect the persistent mapping, use:
        data = d[key]
        data.append(anitem)
        d[key] = data

To avoid the problem with mutable entries, you may pass the keyword
argument writeback=True in the call to shelve.open.  When you use:
        d = shelve.open(filename, writeback=True)
then d keeps a cache of all entries you access, and writes them all back
to the persistent mapping when you call d.close().  This ensures that
such usage as d[key].append(anitem) works as intended.

However, using keyword argument writeback=True may consume vast amount
of memory for the cache, and it may make d.close() very slow, if you
access many of d's entries after opening it in this way: d has no way to
check which of the entries you access are mutable and/or which ones you
actually mutate, so it must cache, and write back at close, all of the
entries that you access.  You can call d.sync() to write back all the
entries in the cache, and empty the cache (d.sync() also synchronizes
the persistent dictionary on disk, if feasible).
�)�Pickler�	Unpickler)�BytesION�Shelf�
BsdDbShelf�DbfilenameShelf�openc@s8eZdZdZdd�ZeZZZZZ	Z
dd�ZdS)�_ClosedDictz>Marker for a closed dict.  Access attempts raise a ValueError.cGstd��dS)Nz!invalid operation on closed shelf)�
ValueError)�self�args�r
�/usr/lib64/python3.8/shelve.py�closedEsz_ClosedDict.closedcCsdS)Nz<Closed Dictionary>r
�rr
r
r�__repr__Isz_ClosedDict.__repr__N)�__name__�
__module__�__qualname__�__doc__r�__iter__�__len__�__getitem__�__setitem__�__delitem__�keysrr
r
r
rr	Bsr	c@s|eZdZdZddd�Zdd�Zd	d
�Zdd�Zd d
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)!rz�Base class for shelf implementations.

    This is initialized with a dictionary-like object.
    See the module's __doc__ string for an overview of the interface.
    NF�utf-8cCs.||_|dkrd}||_||_i|_||_dS)N�)�dict�	_protocol�	writeback�cache�keyencoding�rr�protocolr r"r
r
r�__init__TszShelf.__init__ccs"|j��D]}|�|j�Vq
dS�N)rr�decoder")r�kr
r
rr^szShelf.__iter__cCs
t|j�Sr&)�lenrrr
r
rrbsz
Shelf.__len__cCs|�|j�|jkSr&��encoder"r�r�keyr
r
r�__contains__eszShelf.__contains__cCs|�|j�|jkr||S|Sr&r*)rr-�defaultr
r
r�gethsz	Shelf.getcCsZz|j|}WnFtk
rTt|j|�|j��}t|���}|jrP||j|<YnX|Sr&)	r!�KeyErrorrrr+r"r�loadr �rr-�value�fr
r
rrmszShelf.__getitem__cCsF|jr||j|<t�}t||j�}|�|�|��|j|�|j	�<dSr&)
r r!rrr�dump�getvaluerr+r")rr-r4r5�pr
r
rrws

zShelf.__setitem__cCs6|j|�|j�=z|j|=Wntk
r0YnXdSr&)rr+r"r!r1r,r
r
rrs
zShelf.__delitem__cCs|Sr&r
rr
r
r�	__enter__�szShelf.__enter__cCs|��dSr&)�close)r�typer4�	tracebackr
r
r�__exit__�szShelf.__exit__cCsf|jdkrdSz0|��z|j��Wntk
r:YnXW5zt�|_Wnd|_YnXXdSr&)rr	�syncr:�AttributeErrorrr
r
rr:�s

zShelf.closecCst|d�sdS|��dS)Nr )�hasattrr:rr
r
r�__del__�s
z
Shelf.__del__cCsT|jr:|jr:d|_|j��D]\}}|||<qd|_i|_t|jd�rP|j��dS)NFTr>)r r!�itemsr@rr>)rr-�entryr
r
rr>�s
z
Shelf.sync)NFr)N)rrrrr%rrr.r0rrrr9r=r:rAr>r
r
r
rrMs �



c@sBeZdZdZddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dS)ra�Shelf implementation using the "BSD" db interface.

    This adds methods first(), next(), previous(), last() and
    set_location() that have no counterpart in [g]dbm databases.

    The actual database must be opened using one of the "bsddb"
    modules "open" routines (i.e. bsddb.hashopen, bsddb.btopen or
    bsddb.rnopen) and passed to the constructor.

    See the module's __doc__ string for an overview of the interface.
    NFrcCst�|||||�dSr&)rr%r#r
r
rr%�szBsdDbShelf.__init__cCs0|j�|�\}}t|�}|�|j�t|���fSr&)r�set_locationrr'r"rr2r3r
r
rrD�szBsdDbShelf.set_locationcCs.t|j�\}}t|�}|�|j�t|���fSr&)�nextrrr'r"rr2r3r
r
rrE�szBsdDbShelf.nextcCs.|j��\}}t|�}|�|j�t|���fSr&)r�previousrr'r"rr2r3r
r
rrF�szBsdDbShelf.previouscCs.|j��\}}t|�}|�|j�t|���fSr&)r�firstrr'r"rr2r3r
r
rrG�szBsdDbShelf.firstcCs.|j��\}}t|�}|�|j�t|���fSr&)r�lastrr'r"rr2r3r
r
rrH�szBsdDbShelf.last)NFr)
rrrrr%rDrErFrGrHr
r
r
rr�s�
c@seZdZdZddd�ZdS)rz�Shelf implementation using the "dbm" generic dbm interface.

    This is initialized with the filename for the dbm database.
    See the module's __doc__ string for an overview of the interface.
    �cNFcCs$ddl}t�||�||�||�dS)Nr)�dbmrr%r)r�filename�flagr$r rJr
r
rr%�szDbfilenameShelf.__init__)rINF)rrrrr%r
r
r
rr�srIFcCst||||�S)a�Open a persistent dictionary for reading and writing.

    The filename parameter is the base filename for the underlying
    database.  As a side-effect, an extension may be added to the
    filename and more than one file may be created.  The optional flag
    parameter has the same interpretation as the flag parameter of
    dbm.open(). The optional protocol parameter specifies the
    version of the pickle protocol.

    See the module's __doc__ string for an overview of the interface.
    )r)rKrLr$r r
r
rr�s
)rINF)r�picklerr�iorZcollections.abc�collections�__all__�abc�MutableMappingr	rrrrr
r
r
r�<module>s:b+dis.cpython-38.opt-1.pyc000064400000036702150335716500010727 0ustar00U

e5dZP�@sdZddlZddlZddlZddlZddlTddlmZddddd	d
ddd
ddgeZ[ejej	ej
eee
fZedZdedfedfedffZedZdZdd�ZdVddd�dd�ZdWdd�dd�Zdddd d!d"d#d$d%d&d'�
Zd(d)�Zd*d+�Zd,d�Zd-d.�Zdd�d/d�Ze� d0d1�Z!d2e!j"_d3e!j_d4e!j#_d5e!j$_d6e!j%_d7e!j&_d8e!j'_d9e!j(_d:Z)d;Z*Gd<d�de!�Z+dd=�d>d
�Z,d?d@�Z-dAdB�Z.dXdCdD�Z/dYdd�dFd�Z0ddd�dGdH�Z1dZdddI�dJdK�Z2dLdM�Z3e0Z4dNdO�Z5dPd�Z6dQd
�Z7GdRd�d�Z8dSdT�Z9e:dUk�re9�dS)[z0Disassembler of Python byte code into mnemonics.�N)�*)�__all__�	code_info�dis�disassemble�distb�disco�findlinestarts�
findlabels�	show_code�get_instructions�Instruction�Bytecode�FORMAT_VALUE)N��str�repr�ascii�
MAKE_FUNCTION)�defaultsZ
kwdefaultsZannotationsZclosurecCs6zt||d�}Wn tk
r0t||d�}YnX|S)z�Attempts to compile the given source, first as an expression and
       then as a statement if the first approach fails.

       Utility function to accept strings in functions that otherwise
       expect code objects
    �eval�exec)�compile�SyntaxError)�source�name�c�r�/usr/lib64/python3.8/dis.py�_try_compiles
r��file�depthcCsh|dkrt|d�dSt|d�r&|j}t|d�r8|j}n4t|d�rJ|j}n"t|d�r\|j}nt|d�rl|j}t|d�r�t|j�	��}|D]p\}}t
|t�r�td	||d�zt
|||d
�Wn0tk
r�}ztd||d�W5d}~XYnXt|d�q�nht|d��rt|||d
�nLt
|ttf��r6t||d�n.t
|t��rRt|||d
�ntd
t|�j��dS)a0Disassemble classes, methods, functions, and other compiled objects.

    With no argument, disassemble the last traceback.

    Compiled objects currently include generator objects, async generator
    objects, and coroutine objects, all of which store their code object
    in a special attribute.
    N�r!�__func__�__code__�gi_code�ag_code�cr_code�__dict__zDisassembly of %s:r zSorry:�co_code�(don't know how to disassemble %s objects)r�hasattrr$r%r&r'r(�sortedr)�items�
isinstance�
_have_code�printr�	TypeError�_disassemble_recursive�bytes�	bytearray�_disassemble_bytesr�_disassemble_str�type�__name__)�xr!r"r.rZx1�msgrrrr+s@	







 �r#cCsX|dkr@z
tj}Wntk
r0td�d�YnX|jr@|j}q2t|jj|j|d�dS)z2Disassemble a traceback (default: last traceback).Nz no last traceback to disassembler#)	�sys�last_traceback�AttributeError�RuntimeError�tb_nextr�tb_frame�f_code�tb_lasti)�tbr!rrrrXs
Z	OPTIMIZEDZ	NEWLOCALSZVARARGSZVARKEYWORDSZNESTEDZ	GENERATORZNOFREEZ	COROUTINEZITERABLE_COROUTINEZASYNC_GENERATOR)
������ �@��icCs`g}td�D]:}d|>}||@r|�t�|t|���||N}|sqVq|�t|��d�|�S)z+Return pretty representation of code flags.rJrE�, )�range�append�COMPILER_FLAG_NAMES�get�hex�join)�flags�names�i�flagrrr�pretty_flagsrsrYcCs�t|d�r|j}t|d�r"|j}n4t|d�r4|j}n"t|d�rF|j}nt|d�rV|j}t|t�rjt|d�}t|d�rx|St	dt
|�j��d	S)
zDHelper to handle methods, compiled or raw code objects, and strings.r$r%r&r'r(z
<disassembly>r*r+N)r,r$r%r&r'r(r/rrr2r8r9�r:rrr�_get_code_object�s"







�r[cCstt|��S)z1Formatted details of methods, functions, or code.)�_format_code_infor[rZrrrr�scCs�g}|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�|�d|j�|�dt|j	��|j
r�|�d	�t|j
�D]}|�d
|�q�|jr�|�d�t|j�D]}|�d|�q�|j
�r|�d
�t|j
�D]}|�d|��q|j�rH|�d�t|j�D]}|�d|��q2|j�rz|�d�t|j�D]}|�d|��qdd�|�S)NzName:              %szFilename:          %szArgument count:    %szPositional-only arguments: %szKw-only arguments: %szNumber of locals:  %szStack size:        %szFlags:             %sz
Constants:z%4d: %rzNames:z%4d: %szVariable names:zFree variables:zCell variables:�
)rP�co_name�co_filename�co_argcount�co_posonlyargcount�co_kwonlyargcount�
co_nlocals�co_stacksizerY�co_flags�	co_consts�	enumerate�co_names�co_varnames�co_freevars�co_cellvarsrT)�co�linesZi_cZi_nrrrr\�s<




r\cCstt|�|d�dS)z}Print details of methods, functions, or code to *file*.

    If *file* is not provided, the output is printed on stdout.
    r#N)r1r)rlr!rrrr�s�_InstructionzBopname opcode arg argval argrepr offset starts_line is_jump_targetz!Human readable name for operationzNumeric code for operationz6Numeric argument to operation (if any), otherwise Nonez4Resolved arg value (if known), otherwise same as argz0Human readable description of operation argumentz1Start index of operation within bytecode sequencez4Line started by this opcode (if any), otherwise Nonez1True if other code jumps to here, otherwise False��c@seZdZdZddd�ZdS)	r
aKDetails for a bytecode operation

       Defined fields:
         opname - human readable name for operation
         opcode - numeric code for operation
         arg - numeric argument to operation (if any), otherwise None
         argval - resolved arg value (if known), otherwise same as arg
         argrepr - human readable description of operation argument
         offset - start index of operation within bytecode sequence
         starts_line - line started by this opcode (if any), otherwise None
         is_jump_target - True if other code jumps to here, otherwise False
    �FrGcCs�g}|r:|jdk	r,d|}|�||j�n|�d|�|rJ|�d�n
|�d�|jrf|�d�n
|�d�|�t|j��|��|�|j�t��|j	dk	r�|�t|j	��t
��|jr�|�d|jd	�d�|��
�S)
a%Format instruction details for inclusion in disassembly output

        *lineno_width* sets the width of the line number field (0 omits it)
        *mark_as_current* inserts a '-->' marker arrow as part of the line
        *offset_width* sets the width of the instruction offset field
        Nz%%%dd� z-->z   z>>z  �(�))�starts_linerP�is_jump_targetr�offset�rjust�opname�ljust�
_OPNAME_WIDTH�arg�_OPARG_WIDTH�argreprrT�rstrip)�self�lineno_widthZmark_as_current�offset_widthZfieldsZ
lineno_fmtrrr�_disassemble�s&



zInstruction._disassembleN)rqFrG)r9�
__module__�__qualname__�__doc__r�rrrrr
�s
)�
first_linecCsTt|�}|j|j}tt|��}|dk	r4||j}nd}t|j|j|j	|j
|||�S)a�Iterator for the opcodes in methods, functions or code

    Generates a series of Instruction named tuples giving the details of
    each operations in the supplied code.

    If *first_line* is not None, it indicates the line number that should
    be reported for the first source line in the disassembled code.
    Otherwise, the source line information (if any) is taken directly from
    the disassembled code object.
    Nr)r[rkrj�dictr	�co_firstlineno�_get_instructions_bytesr*rirhrf)r:r�rl�
cell_names�
linestarts�line_offsetrrrrs�cCs |}|dk	r||}|t|�fS)z�Helper to get optional details about const references

       Returns the dereferenced constant and its repr if the constant
       list is defined.
       Otherwise returns the constant index and its repr().
    N�r)Zconst_indexZ
const_list�argvalrrr�_get_const_infosr�cCs*|}|dk	r||}|}nt|�}||fS)z�Helper to get optional details about named references

       Returns the dereferenced name as both value and repr if the name
       list is defined.
       Otherwise returns the name index and its repr().
    Nr�)Z
name_indexZ	name_listr�r~rrr�_get_name_info'sr�c
#s�t|�}d}t|�D�]r\}	}
�|dk	rD|�|	d�}|dk	rD||7}|	|k}d}d}
�dk	�rl�}|
tkrzt�|�\}}
n�|
tkr�t�|�\}}
n�|
tkr�|	d�}dt|�}
n�|
t	kr�t�|�\}}
n�|
t
kr�t�}|}
n�|
tkr�t�|�\}}
nr|
t
k�rFt�d@\}}
|t�d@�f}|d�rl|
�r<|
d7}
|
d	7}
n&|
tk�rld��fd
d�tt�D��}
tt|
|
�||
|	||�VqdS)a&Iterate over the instructions in a bytecode string.

    Generates a sequence of Instruction namedtuples giving the details of each
    opcode.  Additional information about the code's runtime environment
    (e.g. variable names, constants) can be specified using optional
    arguments.

    NrrFzto rqrGrErNzwith formatc3s"|]\}}�d|>@r|VqdS)rENr)�.0rW�s�r|rr�	<genexpr>gs�z*_get_instructions_bytes.<locals>.<genexpr>)r
�_unpack_opargsrRZhasconstr�Zhasnamer��hasjrelrZhaslocalZ
hascompareZcmp_opZhasfreer�FORMAT_VALUE_CONVERTERS�boolrrTrg�MAKE_FUNCTION_FLAGSr
ry)�code�varnamesrV�	constants�cellsr�r��labelsrurw�oprvr�r~rr�rr�7sV






�r����c
Cs<|j|j}tt|��}t|j||j|j|j|||d�dS)zDisassemble a code object.r#N)	rkrjr�r	r6r*rirhrf)rl�lastir!r�r�rrrrms�cCspt||d�|dks|dkrl|dk	r,|d}|jD]8}t|d�r2t|d�td|f|d�t|||d�q2dS)Nr#rrEr*zDisassembly of %r:r )rrfr,r1r3)rlr!r"r:rrrr3ts


r3)r!r�c	Cs�|dk	}	|	r8t|���|}
|
dkr2tt|
��}q<d}nd}t|�d}|dkr^tt|��}
nd}
t|||||||d�D]J}|	o�|jdk	o�|jdk}|r�t|d�|j|k}t|�|||
�|d�qxdS)	Ni�rqrrFi'rG�r�r#)	�max�values�lenrr�rurwr1r�)r�r�r�rVr�r�r�r!r�Zshow_linenoZ	maxlinenor�Z	maxoffsetr�ZinstrZnew_source_lineZis_current_instrrrrr6s8�
��

�r6cKstt|d�f|�dS)z<Compile the source string, then disassemble the code object.z<dis>N)r3r)r�kwargsrrrr7�sr7ccsdd}tdt|�d�D]J}||}|tkrN||d|B}|tkrH|d>nd}nd}|||fVqdS)NrrFrErH)rOr�Z
HAVE_ARGUMENTZEXTENDED_ARG)r�Zextended_argrWr�r|rrrr��sr�cCs\g}t|�D]J\}}}|dk	r|tkr4|d|}n|tkr|}nq||kr|�|�q|S)z`Detect all offsets in a byte code which are jump targets.

    Return the list of offsets.

    NrF)r�r�ZhasjabsrP)r�r�rwr�r|Zlabelrrrr
�sc	cs�|jddd�}|jddd�}t|j�}d}|j}d}t||�D]P\}}|rz||krd||fV|}||7}||krzdS|dkr�|d8}||7}qB||kr�||fVdS)z�Find the offsets in a byte code which are start of lines in the source.

    Generate pairs (offset, lineno) as described in Python/compile.c.

    rNrFrErLrM)�	co_lnotabr�r*r��zip)	r�Zbyte_incrementsZline_incrementsZbytecode_lenZ
lastlineno�linenoZaddrZ	byte_incrZ	line_incrrrrr	�s&


c@sLeZdZdZddd�dd�Zdd�Zdd	�Zed
d��Zdd
�Z	dd�Z
dS)raThe bytecode operations of a piece of code

    Instantiate this with a function, method, other compiled object, string of
    code, or a code object (as returned by compile()).

    Iterating over this yields the bytecode operations as Instruction instances.
    N)r��current_offsetcCsdt|�|_}|dkr&|j|_d|_n||_||j|_|j|j|_tt	|��|_
||_||_dS)Nr)
r[�codeobjr�r��_line_offsetrkrj�_cell_namesr�r	�_linestarts�_original_objectr�)r�r:r�r�rlrrr�__init__�szBytecode.__init__c	Cs*|j}t|j|j|j|j|j|j|jd�S)Nr�)	r�r�r*rirhrfr�r�r�)r�rlrrr�__iter__�s�zBytecode.__iter__cCsd�|jj|j�S)Nz{}({!r}))�format�	__class__r9r��r�rrr�__repr__�s
�zBytecode.__repr__cCs |jr|j}q||jj|jd�S)z/ Construct a Bytecode from the given traceback )r�)r@rArBrC)�clsrDrrr�from_traceback�szBytecode.from_tracebackcCs
t|j�S)z3Return formatted information about the code object.)r\r�r�rrr�infosz
Bytecode.infocCsl|j}|jdk	r|j}nd}t���>}t|j|j|j|j|j	|j
|j||d�	|��W5QR�SQRXdS)z3Return a formatted view of the bytecode operations.Nr�)r�rVr�r�r�r�r!r�)
r�r��io�StringIOr6r*rirhrfr�r�r��getvalue)r�rlrw�outputrrrr
s


�zBytecode.dis)r9r�r�r�r�r�r��classmethodr�r�rrrrrr�s

c	Csfddl}|��}|jd|�d�ddd�|��}|j�}|��}W5QRXt||jjd�}t	|�dS)	z*Simple test program to disassemble a file.rN�infile�rb�?�-)r8�nargs�defaultr)
�argparse�ArgumentParser�add_argumentZFileType�
parse_argsr��readrrr)r��parser�argsr�rr�rrr�_testsr��__main__)N)N)NNNNNr)r�)r�NNNNN);r�r<�types�collectionsr�ZopcoderZ_opcodes_all�
MethodType�FunctionType�CodeTyper��staticmethodr8r0Zopmaprrrrr�rr�rrrrQrYr[rr\r�
namedtuplernryr|r�r~rwrurvr{r}r
rr�r�r�rr3r6r7rr�r
r	rr�r9rrrr�<module>s�
����
-�
 �4�
6��=
netrc.cpython-38.opt-1.pyc000064400000007303150335716500011256 0ustar00U

e5d��@sXdZddlZddlZddlZddgZGdd�de�ZGdd�d�ZedkrTe	e��dS)z-An object-oriented interface to .netrc files.�N�netrc�NetrcParseErrorc@s"eZdZdZddd�Zdd�ZdS)rz5Exception raised on syntax errors in the .netrc file.NcCs"||_||_||_t�||�dS)N)�filename�lineno�msg�	Exception�__init__)�selfrrr�r
�/usr/lib64/python3.8/netrc.pyrszNetrcParseError.__init__cCsd|j|j|jfS)Nz%s (%s, line %s))rrr)r	r
r
r�__str__szNetrcParseError.__str__)NN)�__name__�
__module__�__qualname__�__doc__rrr
r
r
rr
s
c@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)rNc	CsX|dk}|dkr&tj�tj�d�d�}i|_i|_t|��}|�|||�W5QRXdS)N�~z.netrc)�os�path�join�
expanduser�hosts�macros�open�_parse)r	�file�
default_netrc�fpr
r
rrs
znetrc.__init__cCs�t�|�}|jd7_|j�dd�|_|j}|��}}|sD�q�n�|ddkrt|j|kr(t|�dkr(|j��q(n�|dkr�|��}nt|dkr�d}nf|dkr�|��}g|j	|<d	|_
|j��}	|	r�|	d
kr�d|_
q(|j	|�|	�q�q(ntd|||j��d}
d}}i|j
|<|��}|�d��s.|d
k�rr|�rR|
||f|j
|<|�|�q(ntd||t|�f||j���q|dk�s�|dk�r�|��}
�q|dk�r�|��}�q|dk�r�tjdk�r�|�r�t�|���}
|
jt��k�rpddl}z|�|
j�d}Wn tk
�rd|
j}YnXz|�t���d}Wn"tk
�rXdt��}YnXtd||f||j��|
jtjtjB@�r�td||j��|��}ntd|||j���qq(dS)Nz !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~�#�r��machine�default�macdefz 	�
z 	
zbad toplevel token %r>rr"r!r z&malformed %s entry %s terminated by %s�login�user�account�password�posixzuid %sz9~/.netrc file owner (%s) does not match current user (%s)zY~/.netrc access too permissive: access permissions must restrict access to only the ownerzbad follower token %r)�shlexZ	wordcharsZ
commenters�replacerZ	get_token�lenZinstream�readlinerZ
whitespace�appendrr�
startswithZ
push_token�reprr�name�fstat�fileno�st_uid�getuid�pwd�getpwuid�KeyError�st_mode�stat�S_IRWXG�S_IRWXO)r	rrrZlexerZsaved_linenoZtoplevelZttZ	entryname�liner$r&r'Zpropr5Zfownerr%r
r
rr s�




�
�
��

���
�znetrc._parsecCs0||jkr|j|Sd|jkr(|jdSdSdS)z8Return a (user, account, password) tuple for given host.r!N)r)r	�hostr
r
r�authenticatorsqs




znetrc.authenticatorscCs�d}|j��D]X}|j|}|d|�d|d�d�7}|drR|d|d�d�7}|d|d	�d�7}q|j��D]4}|d
|�d�7}|j|D]}||7}q�|d7}qr|S)z3Dump the class data in the format of a .netrc file.rzmachine z
	login rr#rz		account z
	password �zmacdef )r�keysr)r	Zrepr=�attrsZmacror<r
r
r�__repr__zs


znetrc.__repr__)N)r
rrrrr>rBr
r
r
rrs
	Q	�__main__)
rrr)r9�__all__rrrr
�printr
r
r
r�<module>stwarnings.cpython-38.pyc000064400000032526150335716500011041 0ustar00U

e5d�L�@s�dZddlZddddddd	d
gZd<dd�Zd=dd�Zd
d�Zdd�ZeZdd�ZeZ	dd�Z
dedddfdd�Zeddfdd�Z
dd�Zdd	�ZGdd�de�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd>d+d�Zd?d,d�ZGd-d.�d.e�ZGd/d
�d
e�Zd0d1�Zz0dd2lmZm Z m!Z!mZmZm"Z"e Z#e!Z$d3Z%Wn2e&k
�rngZd4Z#iZ$d*a'd5d6�Z"dZ%YnXeej(�e%�s�e)ed7��s�ed4e*d8d*d9�e
d:e*d*d;�e
d:e+d*d;�e
d:e,d*d;�e
d:e-d*d;�[%dS)@z&Python part of the warnings subsystem.�N�warn�
warn_explicit�showwarning�
formatwarning�filterwarnings�simplefilter�
resetwarnings�catch_warningscCst||||||�}t|�dS)�7Hook to write a warning to a file; replace if you like.N)�WarningMessage�_showwarnmsg_impl)�message�category�filename�lineno�file�line�msg�r� /usr/lib64/python3.8/warnings.pyr
scCst||||d|�}t|�S)�.Function to format a warning the standard way.N)r�_formatwarnmsg_impl)r
rrrrrrrrrscCsP|j}|dkr tj}|dkr dSt|�}z|�|�Wntk
rJYnXdS�N)r�sys�stderr�_formatwarnmsg�write�OSError)rr�textrrrrsrc		Cs�|jj}|j�d|j�d|�d|j�d�}|jdkrpzddl}|�|j|j�}Wqvtk
rld}d}YqvXn|j}|r�|�	�}|d|7}|j
dk	�r�zddl}Wntk
r�d}d}Yn4X|��}z|�
|j
�}Wntk
r�d}YnX|dk	�r�|d7}|D]t}|d|j|jf7}z$|dk	�rB|�|j|j�}nd}Wntk
�rbd}YnX|�r|�	�}|d	|7}�qn|�s�||�d
�7}|S)N�:z: �
rz  %s
Tz-Object allocated at (most recent call last):
z  File "%s", lineno %s
z    %s
z<: Enable tracemalloc to get the object allocation traceback
)r�__name__rrr
r�	linecache�getline�	Exception�strip�source�tracemalloc�
is_tracing�get_object_traceback)	rr�sr"rr'�tracing�tb�framerrrr#sT"




�

rcCsdzt}Wntk
rYn<X|tk	rXt|�s6td��||j|j|j|j|j	|j
�dSt|�dS)r
z:warnings.showwarning() must be set to a function or methodN)r�	NameError�_showwarning_orig�callable�	TypeErrorr
rrrrrr)r�swrrr�_showwarnmsg`s�r3cCsHzt}Wntk
rYn$X|tk	r@||j|j|j|j|j�St|�S)r)	rr.�_formatwarning_origr
rrrrr)r�fwrrrrus
�r�FcCs�|dkstd|f��t|t�s(td��t|t�s:td��t|t�sLtd��t|t�s^td��t|t�rp|dksxtd��|s�|r�dd	l}|r�|�||j	�}nd	}|r�|�|�}nd	}t
||||||d
�d	S)a�Insert an entry into the list of warnings filters (at the front).

    'action' -- one of "error", "ignore", "always", "default", "module",
                or "once"
    'message' -- a regex that the warning message must match
    'category' -- a class that the warning must be a subclass of
    'module' -- a regex that the module name must match
    'lineno' -- an integer line number, 0 matches all warnings
    'append' -- if true, append to the list of filters
    ��error�ignore�always�default�module�once�invalid action: %rzmessage must be a stringzcategory must be a classz#category must be a Warning subclasszmodule must be a stringr�lineno must be an int >= 0N��append)�AssertionError�
isinstance�str�type�
issubclass�Warning�int�re�compile�I�_add_filter)�actionr
rr<rrArIrrrr�s&
��cCsH|dkstd|f��t|t�r(|dks0td��t|d|d||d�dS)a�Insert a simple entry into the list of warnings filters (at the front).

    A simple filter matches all modules and messages.
    'action' -- one of "error", "ignore", "always", "default", "module",
                or "once"
    'category' -- a class that the warning must be a subclass of
    'lineno' -- an integer line number, 0 matches all warnings
    'append' -- if true, append to the list of filters
    r7r>rr?Nr@)rBrCrHrL)rMrrrArrrr�s

��cGsR|s6zt�|�Wntk
r&YnXt�d|�n|tkrHt�|�t�dS)Nr)�filters�remove�
ValueError�insertrA�_filters_mutated)rA�itemrrrrL�s
rLcCsgtdd�<t�dS)zAClear the list of warning filters, so that no filters are active.N)rNrRrrrrr�sc@seZdZdZdS)�_OptionErrorz,Exception used by option processing helpers.N)r!�
__module__�__qualname__�__doc__rrrrrT�srTcCsN|D]D}zt|�Wqtk
rF}ztd|tjd�W5d}~XYqXqdS)NzInvalid -W option ignored:)r)�
_setoptionrT�printrr)�args�argrrrr�_processoptions�s
r\c	Cs�|�d�}t|�dkr$td|f��t|�dkr<|�d�q$dd�|D�\}}}}}t|�}t|�}|sl|rtddl}|r�|�|�}|r�|�|�d}|r�zt|�}|dkr�t	�Wq�t	t
fk
r�td	|f�d�Yq�Xnd}t|||||�dS)
Nr�ztoo many fields (max 5): %rr6cSsg|]}|���qSr)r%)�.0r*rrr�
<listcomp>�s�z_setoption.<locals>.<listcomp>rz\Zzinvalid lineno %r)�split�lenrTrA�
_getaction�_getcategoryrI�escaperHrP�
OverflowErrorr)r[�partsrMr
rr<rrIrrrrX�s2
�
rXcCsB|sdS|dkrdSdD]}|�|�r|Sqtd|f��dS)Nr;�allr:)r;r:r9r<r=r8r>)�
startswithrT)rM�arrrrb�s

rbcCs�|stSd|krddl}|}nJ|�d�\}}}zt|dd|g�}Wn$tk
rftd|f�d�YnXzt||�}Wn$tk
r�td|f�d�YnXt|t�s�td|f��|S)N�.rzinvalid module name: %rzunknown warning category: %rzinvalid warning category: %r)	rG�builtins�
rpartition�
__import__�ImportErrorrT�getattr�AttributeErrorrF)r�m�klassr<�_�catrrrrc�s"
rccCs|jj}d|kod|kS)zFSignal whether the frame is an internal CPython implementation detail.�	importlib�
_bootstrap)�f_code�co_filename)r-rrrr�_is_internal_framesrycCs"|j}|dk	rt|�r|j}q|S)z;Find the next frame that doesn't involve CPython internals.N)�f_backry)r-rrr�_next_external_framesr{�c	Cst|t�r|j}|dkrt}t|t�r0t|t�sDtd�t|�j���zV|dks\t	t
�d��rht
�|�}n0t
�d�}t|d�D]}t
|�}|dkr~t�q~Wn"tk
r�t
j}d}d}YnX|j}|jj}|j}d|kr�|d}	nd}	|�di�}
t|||||	|
||�dS)z:Issue a warning, or maybe ignore it or raise an exception.Nz/category must be a Warning subclass, not '{:s}'r|rr!z<string>Z__warningregistry__)rCrG�	__class__�UserWarningrErFr1�formatr!ryr�	_getframe�ranger{rP�__dict__�	f_globalsrwrx�f_lineno�
setdefaultr)r
r�
stacklevelr&r-�x�globalsrrr<�registryrrrrs>
�



�cCs�t|�}|dkr8|pd}|dd���dkr8|dd�}|dkrDi}|�dd�tkrd|��t|d<t|t�r~t|�}|j}n|}||�}|||f}	|�|	�r�dSt	D]V}
|
\}}}
}}|dks�|�
|�r�t||
�r�|dks�|�
|�r�|dks�||kr��qq�t}|dk�rdSddl
}|�||�|dk�r2|�|dk�rfd	||	<||f}t�|��r\dSd	t|<nf|d
k�rrnZ|dk�r�d	||	<||df}|�|��r�dSd	||<n$|dk�r�d	||	<ntd
||
f��t|||||�}t|�dS)Nz	<unknown>���z.py�versionrr9r8r=r|r:r<r;z1Unrecognized action (%r) in warnings.filters:
 %s)rH�lower�get�_filters_version�clearrCrGrDr}rN�matchrF�
defaultactionr"�getlines�onceregistry�RuntimeErrorrr3)r
rrrr<r��module_globalsr&r�keyrSrMrrt�modZlnr"ZoncekeyZaltkeyrrrrGs|


�����









��c@s"eZdZdZddd�Zdd�ZdS)r)r
rrrrrr&NcCs>||_||_||_||_||_||_||_|r4|jnd|_dSr)	r
rrrrrr&r!�_category_name)�selfr
rrrrrr&rrr�__init__�szWarningMessage.__init__cCsd|j|j|j|j|jfS)NzD{message : %r, category : %r, filename : %r, lineno : %s, line : %r})r
r�rrr)r�rrr�__str__�s��zWarningMessage.__str__)NNN)r!rUrV�_WARNING_DETAILSr�r�rrrrr�s�
rc@s8eZdZdZddd�dd�Zdd�Zd	d
�Zdd�ZdS)
r	a�A context manager that copies and restores the warnings filter upon
    exiting the context.

    The 'record' argument specifies whether warnings should be captured by a
    custom implementation of warnings.showwarning() and be appended to a list
    returned by the context manager. Otherwise None is returned by the context
    manager. The objects appended to the list are arguments whose attributes
    mirror the arguments to showwarning().

    The 'module' argument is to specify an alternative module to the module
    named 'warnings' and imported under that name. This argument is only useful
    when testing the warnings module itself.

    FN)�recordr<cCs(||_|dkrtjdn||_d|_dS)z�Specify whether to record warnings and if an alternative module
        should be used other than sys.modules['warnings'].

        For compatibility with Python 3.0, please consider all arguments to be
        keyword-only.

        N�warningsF)�_recordr�modules�_module�_entered)r�r�r<rrrr��szcatch_warnings.__init__cCsPg}|jr|�d�|jtjdk	r4|�d|j�t|�j}d|d�|�fS)Nzrecord=Truer�z	module=%rz%s(%s)z, )r�rAr�rr�rEr!�join)r�rZ�namerrr�__repr__�s

zcatch_warnings.__repr__cCs~|jrtd|��d|_|jj|_|jdd�|j_|j��|jj|_|jj|_|j	rvg}|j
|j_|jj|j_|SdSdS)NzCannot enter %r twiceT)r�r�r�rN�_filtersrRr�_showwarningrr�rAr/)r��logrrr�	__enter__�s




zcatch_warnings.__enter__cGs>|jstd|��|j|j_|j��|j|j_|j|j_dS)Nz%Cannot exit %r without entering first)	r�r�r�r�rNrRr�rr)r��exc_inforrr�__exit__�s


zcatch_warnings.__exit__)r!rUrVrWr�r�r�r�rrrrr	�s
	cszd�j�d�g}�jdk	rVddl�ddl}��fdd�}|�d�||�t|���7}d�|��d�}t	|t
d	�d
�dS)Nzcoroutine 'z' was never awaited
rc3s4t�j�D]$\}}}��||�}||||fVq
dSr)�reversed�	cr_originr#)rr�funcnamer��coror"rr�extract�sz*_warn_unawaited_coroutine.<locals>.extractz-Coroutine created at (most recent call last)
r6r �)rr�r&)rVr�r"�	tracebackrA�format_list�listr��rstripr�RuntimeWarning)r��	msg_linesr�r�rrr�r�_warn_unawaited_coroutine�s�

r�)rN�_defaultaction�
_onceregistryrrrRTr;cCstd7adS)Nr|)r�rrrrrRsrRZgettotalrefcount�__main__)rr<rAr9)rrA)NN)N)Nr|N)NNNN).rWr�__all__rrrrr/r3r4rrGrrrLrr$rTr\rXrbrcryr{rr�objectrr	r��	_warningsrNr�r�rRr�r�Z_warnings_defaultsrnr��warnoptions�hasattr�DeprecationWarning�PendingDeprecationWarning�
ImportWarning�ResourceWarningrrrr�<module>s|�

;
�
#
	
)�
GC 

�code.cpython-38.opt-2.pyc000064400000011044150335716500011053 0ustar00U

e5d~)�@s�ddlZddlZddlmZmZddddgZGdd�d�ZGdd�de�Zdd	d�Ze	d
kr�ddl
Z
e
��Zej
ddd
d�e��Zejs�ejjr�dZndZee�dS)�N)�CommandCompiler�compile_command�InteractiveInterpreter�InteractiveConsole�interactrc@sBeZdZddd�Zddd�Zdd	�Zdd
d�Zdd
�Zdd�ZdS)rNcCs$|dkrddd�}||_t�|_dS)NZ__console__)�__name__�__doc__)�localsr�compile)�selfr	�r�/usr/lib64/python3.8/code.py�__init__s	
zInteractiveInterpreter.__init__�<input>�singlec
CsTz|�|||�}Wn&tttfk
r8|�|�YdSX|dkrFdS|�|�dS)NFT)r
�
OverflowError�SyntaxError�
ValueError�showsyntaxerror�runcode)r�source�filenameZsymbol�coderrr
�	runsource&s

z InteractiveInterpreter.runsourcecCs>zt||j�Wn(tk
r&�Yn|��YnXdS�N)�execr	�
SystemExit�
showtraceback)rrrrr
rMszInteractiveInterpreter.runcodecCs�t��\}}}|t_|t_|t_|rp|tkrpz|j\}\}}}}	Wntk
rVYnXt|||||	f�}|t_tjtj	kr�t
�||�}
|�d�
|
��nt�|||�dS)N�)�sys�exc_info�	last_type�
last_value�last_tracebackr�argsr�
excepthook�__excepthook__�	traceback�format_exception_only�write�join)rr�type�value�tb�msgZdummy_filename�lineno�offset�line�linesrrr
r`sz&InteractiveInterpreter.showsyntaxerrorcCs|t��\t_t_}}|t_zPt�|d|d|j�}tjtj	krT|�
d�|��nt�|d|d|�W5d}}XdS)Nr�r)rr r!r"r#r'�format_exception�tb_nextr%r&r)r*)rZlast_tbZeir2rrr
r�sz$InteractiveInterpreter.showtracebackcCstj�|�dSr)r�stderrr))r�datarrr
r)�szInteractiveInterpreter.write)N)rr)N)	r�
__module__�__qualname__rrrrrr)rrrr
rs	

'
#c@s:eZdZddd�Zdd�Zddd�Zd	d
�Zddd
�ZdS)rN�	<console>cCst�||�||_|��dSr)rrr�resetbuffer)rr	rrrr
r�s
zInteractiveConsole.__init__cCs
g|_dSr)�buffer)rrrr
r;�szInteractiveConsole.resetbuffercCsRz
tjWntk
r$dt_YnXz
tjWntk
rJdt_YnXd}|dkrx|�dtjtj||jjf�n|r�|�dt	|��d}zV|r�tj}ntj}z|�
|�}Wn&tk
r�|�d�YW�qYnX|�|�}Wq�t
k
�r|�d�|��d}Yq�Xq�|dk�r6|�d	|jj�n|d
k�rN|�d|�dS)Nz>>> z... zFType "help", "copyright", "credits" or "license" for more information.zPython %s on %s
%s
(%s)
z%s
r�
z
KeyboardInterrupt
znow exiting %s...
r)rZps1�AttributeErrorZps2r)�version�platform�	__class__r�str�	raw_input�EOFError�push�KeyboardInterruptr;)r�banner�exitmsgZcprt�more�promptr1rrr
r�sH


��



zInteractiveConsole.interactcCs6|j�|�d�|j�}|�||j�}|s2|��|S)Nr=)r<�appendr*rrr;)rr1rrIrrr
rE�szInteractiveConsole.pushrcCst|�Sr)�input)rrJrrr
rCszInteractiveConsole.raw_input)Nr:)NN)r)rr8r9rr;rrErCrrrr
r�s


6cCsJt|�}|dk	r||_n"zddl}Wntk
r8YnX|�||�dS)Nr)rrC�readline�ImportErrorr)rGZreadfuncZlocalrHZconsolerMrrr
rs�__main__z-q�
store_truez*don't print version and copyright messages)�action�helpr)NNNN)rr'Zcodeoprr�__all__rrrr�argparse�ArgumentParser�parser�add_argument�
parse_argsr$�q�flags�quietrGrrrr
�<module>s(�t
�stringprep.cpython-38.pyc000064400000025413150335716500011403 0ustar00U

e5du2��@s�dZddlmZejdkst�dd�Zedddd	d
ddd
dddgeedd���Z	dd�Z
dddddddddddd d!d"d#d$d%d&d'd(dd)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDd=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdEdFdGdHdIdJdKdLdMdNdOdPdQdNddRdSdTdUdVdSdWddXdYdZdd[d\d]d^d_d`dadbd_dcdddedfdgdhdhdhdididjdkdldmdndodododpdqdrdsdsdtdddudvdwdxd&dydzd{d|d}d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d}d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dddyd�d�d�dkd�dmdndd�d�d�d�d�d�dsd�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dtdydudvd�d�d�djdwdkd�dmdndd�d�d�d�d�d�d�dtdydudvd�did�d�djdwd�dd�d�d�d�d�d�d�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�dtdddydudvd�dhdid�d�djdwdkd�dmdndodd�d�d�d�d�d�dsd�d dxd�d)d�d�d!dd'd�dd�d�d�d&d(d!dd�d"d%d�d�d�dd�d dxd�d)d�d�d!dd'd�dd�d�d�d&d(d!dd�d"d%d�d�d�dd�d dxd�d)d�d�d!dd'd�dd�d�d�d&d(d!dd�d"d%d�d�d�dd�d dxd�d)d�d�d!dd'd�dd�d�d�d&d(d!dd�d"d%d�d�d�dd�d dxd�d)d�d�d!dd'd�dd�d�d�d&d(d!dd�d"d%d�d�d�ddː��Zd�d̈́Zd�dτZ
d�dфZd�dӄZd�dՄZd�dׄZed�d�d�d
dd�d�dgeedd݃�eed�d߃�eed�d��eed�d���Zd�d�Zd�d�Zd�d�Zd�d�Zd�d�Zeed�d��Zd�d�Zeed�d��Zd�d�Zed�d�d�d�geed�d���eed�d߃��Zd�d��Zed�geed�d����Z�d�d�Z�d�d�Z �d�d�Z!�dS(z�Library that exposes various tables found in the StringPrep RFC 3454.

There are two kinds of tables: sets, for which a member test is provided,
and mappings, for which a mapping function is provided.
�)�	ucd_3_2_0z3.2.0cCsBt�|�dkrdSt|�}d|kr.dkr6nndS|d@dkS)NZCnF�������r)�unicodedata�category�ord��code�c�r�"/usr/lib64/python3.8/stringprep.py�in_table_a1sr�iOiiii
i i i
 i` i��i�i�cCst|�tkS�N)r
�b1_set�rrrr�in_table_b1sruμZssui̇uʼn�suǰuιu ιuΐuΰuσuβuθuυuύuϋuφuπuκuρuεuեւuẖuẗuẘuẙuaʾuṡuὐuὒuὔuὖuἀιuἁιuἂιuἃιuἄιuἅιuἆιuἇιuἠιuἡιuἢιuἣιuἤιuἥιuἦιuἧιuὠιuὡιuὢιuὣιuὤιuὥιuὦιuὧιuὰιuαιuάιuᾶuᾶιuὴιuηιuήιuῆuῆιuῒuῖuῗuῢuῤuῦuῧuὼιuωιuώιuῶuῶιZrsr
u°cuɛu°f�h�i�l�nZno�p�q�rZsmZtelZtm�z�b�e�f�muγ�dZhpaZauZovZpaZnauμaZmaZkaZkbZmbZgbZpfZnfuμf�hzZkhzZmhzZghzZthzZkpaZmpaZgpaZpvZnvuμvZmvZkvZpwZnwuμwZmw�kwukωumωZbquc∕kgzco.ZdbZgyZhpZkkZkmZphZppmZprZsv�wbZffZfiZflZffiZffl�stuմնuմեuմիuվնuմխ�a�g�j�k�o�t�u�v�w�x�yuαuδuζuηuλuνuξuοuτuχuψuω(����i0iIii�iEizi�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�iPiRiTiVi�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i� i!i!i!i	!i!i!i
!i!i!i!i!i!i!i!i!i!i!i !i!!i"!i$!i(!i,!i-!i0!i1!i3!i>!i?!iE!iq3is3iu3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�3i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i	�i
�i�i�i
�i�i�i�i�i�i�i�i�i�i�i�i�i4�i5�i6�i7�i8�i9�i:�i;�i<�i=�i>�i?�i@�iA�iB�iC�iD�iE�iF�iG�iH�iI�iJ�iK�iL�iM�ih�ii�ij�ik�il�im�in�io�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i�i�i�i�i	�i
�i
�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i8�i9�i;�i<�i=�i>�i@�iA�iB�iC�iD�iF�iJ�iK�iL�iM�iN�iO�iP�il�im�in�io�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i�i	�i
�i�i�i
�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i �i!�i<�i=�i>�i?�i@�iA�iB�iC�iD�iE�iF�iG�iH�iI�iJ�iK�iL�iM�iN�iO�iP�iQ�iR�iS�iT�iU�ip�iq�ir�is�it�iu�iv�iw�ix�iy�iz�i{�i|�i}�i~�i�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i
�i�i�i�i�i �i!�i"�i#�i$�i%�i&�i'�i(�i)�i*�i+�i,�i-�i.�i/�i0�i1�i2�i3�i4�iG�iV�iW�iX�iY�iZ�i[�i\�i]�i^�i_�i`�ia�ib�ic�id�ie�if�ig�ih�ii�ij�ik�il�im�in�i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��i��cCs"t�t|��}|dk	r|S|��Sr)�
b3_exceptions�getr
�lower)rrrrr�map_table_b3�sr8cCsHt|�}t�d|�}d�dd�|D��}t�d|�}||kr@|S|SdS)NZNFKC�cSsg|]}t|��qSr)r8)�.0Zchrrr�
<listcomp>�sz map_table_b2.<locals>.<listcomp>)r8rZ	normalize�join)r(ZalrZblr
rrr�map_table_b2�sr=cCs|dkS)N� rrrrr�in_table_c11�sr?cCst�|�dko|dkS)N�Zsr>�rr	rrrr�in_table_c12�srBcCst�|�dkS)Nr@rArrrr�in_table_c11_c12�srCcCst|�dkot�|�dkS)N��Cc)r
rr	rrrr�in_table_c21�srFi�iii( i) id ij ip i��i��is�i{�cCs.t|�}|dkrdSt�|�dkr&dS|tkS)NrDFrET)r
rr	�c22_specialsrrrr�in_table_c22�srHcCst�|�dkpt|�tkS)NrE)rr	r
rGrrrr�in_table_c21_c22�s
�rIcCst�|�dkS)NZCorArrrr�in_table_c3�srJcCs0t|�}|dkrdS|dkr dSt|�d@dkS)NrFrTrr)r
rrrr�in_table_c4�srKcCst�|�dkS)NZCsrArrrr�in_table_c5�srLrcCst|�tkSr)r
�c6_setrrrr�in_table_c6�srNi�/i�/cCst|�tkSr)r
�c7_setrrrr�in_table_c7�srPi@iAi i i* i/ cCst|�tkSr)r
�c8_setrrrr�in_table_c8srRii i�cCst|�tkSr)r
�c9_setrrrr�in_table_c9srTcCst�|�dkS)N)�RZAL�rZ
bidirectionalrrrr�in_table_d1srWcCst�|�dkS)N�LrVrrrr�in_table_d2srYN)"�__doc__rrZunidata_version�AssertionErrorr�set�list�rangerrr5r8r=r?rBrCrFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrWrYrrrr�<module>sP,��&P,xdrlib.cpython-38.opt-2.pyc000064400000017072150335716500011434 0ustar00U

e5d�@stddlZddlmZddlmZddddgZGdd�de�ZGd	d�de�Zd
d�Z	Gdd�d�Z
Gd
d�d�ZdS)�N)�BytesIO��wraps�Error�Packer�Unpacker�ConversionErrorc@s$eZdZdd�Zdd�Zdd�ZdS)rcCs
||_dS�N)�msg)�selfr
�r�/usr/lib64/python3.8/xdrlib.py�__init__szError.__init__cCs
t|j�Sr	)�reprr
�rrrr
�__repr__szError.__repr__cCs
t|j�Sr	)�strr
rrrr
�__str__sz
Error.__str__N)�__name__�
__module__�__qualname__rrrrrrr
rs
c@seZdZdS)rN)rrrrrrr
r scst���fdd��}|S)Nc
sFz�||�WStjk
r@}zt|jd�d�W5d}~XYnXdS�Nr)�struct�errorr�args)r�value�e��functionrr
�result&sz&raise_conversion_error.<locals>.resultr)rrrrr
�raise_conversion_error#sr c@s�eZdZdd�Zdd�Zdd�ZeZedd��Zed	d
��Z	e	Z
dd�Zd
d�ZeZ
edd��Zedd��Zdd�ZeZdd�ZeZeZdd�Zdd�Zdd�ZdS)rcCs|��dSr	��resetrrrr
r2szPacker.__init__cCst�|_dSr	)r�_Packer__bufrrrr
r"5szPacker.resetcCs
|j��Sr	)r#�getvaluerrrr
�
get_buffer8szPacker.get_buffercCs|j�t�d|��dS)N�>L�r#�writerZpack�r�xrrr
�	pack_uint=szPacker.pack_uintcCs|j�t�d|��dS)N�>lr'r)rrr
�pack_intAszPacker.pack_intcCs"|r|j�d�n|j�d�dS)Nss)r#r(r)rrr
�	pack_boolGszPacker.pack_boolc
Cs�z|�|d?d@�Wn8ttjfk
rN}zt|jd�d�W5d}~XYnXz|�|d@�Wn8ttjfk
r�}zt|jd�d�W5d}~XYnXdS)N� l��r)r+�	TypeErrorrrrr)rr*rrrr
�pack_uhyperKs"zPacker.pack_uhypercCs|j�t�d|��dS)N�>fr'r)rrr
�
pack_floatWszPacker.pack_floatcCs|j�t�d|��dS)N�>dr'r)rrr
�pack_double[szPacker.pack_doublecCsP|dkrtd��|d|�}|ddd}||t|�d}|j�|�dS)Nr� fstring size must be nonnegative���)�
ValueError�lenr#r()r�n�s�datarrr
�pack_fstring_szPacker.pack_fstringcCs"t|�}|�|�|�||�dSr	)r;r+r?)rr=r<rrr
�pack_stringis
zPacker.pack_stringcCs*|D]}|�d�||�q|�d�dS)N�r)r+)r�list�	pack_item�itemrrr
�	pack_listqs

zPacker.pack_listcCs*t|�|krtd��|D]}||�qdS)Nzwrong array size)r;r:)rr<rBrCrDrrr
�pack_farraywszPacker.pack_farraycCs$t|�}|�|�|�|||�dSr	)r;r+rF)rrBrCr<rrr
�
pack_array}s
zPacker.pack_arrayN)rrrrr"r%Zget_bufr r+r-Z	pack_enumr.r1Z
pack_hyperr3r5r?Zpack_fopaquer@Zpack_opaqueZ
pack_bytesrErFrGrrrr
r/s0




c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
e
Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZeZdd�ZeZeZdd �Zd!d"�Zd#d$�Zd%S)&rcCs|�|�dSr	r!�rr>rrr
r�szUnpacker.__init__cCs||_d|_dSr)�_Unpacker__buf�_Unpacker__posrHrrr
r"�szUnpacker.resetcCs|jSr	�rJrrrr
�get_position�szUnpacker.get_positioncCs
||_dSr	rK)rZpositionrrr
�set_position�szUnpacker.set_positioncCs|jSr	)rIrrrr
r%�szUnpacker.get_buffercCs|jt|j�krtd��dS)Nzunextracted data remains)rJr;rIrrrrr
�done�sz
Unpacker.donecCsB|j}|d|_}|j||�}t|�dkr2t�t�d|�dS)Nr8r&r�rJrIr;�EOFErrorrZunpack�r�i�jr>rrr
�unpack_uint�szUnpacker.unpack_uintcCsB|j}|d|_}|j||�}t|�dkr2t�t�d|�dS)Nr8r,rrOrQrrr
�
unpack_int�szUnpacker.unpack_intcCst|���Sr	)�boolrUrrrr
�unpack_bool�szUnpacker.unpack_boolcCs |��}|��}t|�d>|BS)Nr/)rT�int)r�hi�lorrr
�
unpack_uhyper�szUnpacker.unpack_uhypercCs|��}|dkr|d}|S)Nll)r[r)rrr
�unpack_hyper�szUnpacker.unpack_hypercCsB|j}|d|_}|j||�}t|�dkr2t�t�d|�dS)Nr8r2rrOrQrrr
�unpack_float�szUnpacker.unpack_floatcCsB|j}|d|_}|j||�}t|�dkr2t�t�d|�dS)N�r4rrOrQrrr
�
unpack_double�szUnpacker.unpack_doublecCsT|dkrtd��|j}||ddd}|t|j�kr<t�||_|j|||�S)Nrr6r7r8)r:rJr;rIrP)rr<rRrSrrr
�unpack_fstring�szUnpacker.unpack_fstringcCs|��}|�|�Sr	)rTr`)rr<rrr
�
unpack_string�szUnpacker.unpack_stringcCsBg}|��}|dkrq>|dkr,td|f��|�}|�|�q|S)NrrAz0 or 1 expected, got %r)rTr�append)r�unpack_itemrBr*rDrrr
�unpack_list�szUnpacker.unpack_listcCs"g}t|�D]}|�|��q|Sr	)�rangerb)rr<rcrBrRrrr
�
unpack_farray�szUnpacker.unpack_farraycCs|��}|�||�Sr	)rTrf)rrcr<rrr
�unpack_array�szUnpacker.unpack_arrayN)rrrrr"rLrMr%rNrTrUZunpack_enumrWr[r\r]r_r`Zunpack_fopaqueraZ
unpack_opaqueZunpack_bytesrdrfrgrrrr
r�s,
)r�ior�	functoolsr�__all__�	Exceptionrrr rrrrrr
�<module>sUtraceback.cpython-38.pyc000064400000046744150335716500011137 0ustar00U

e5d;\�@s:dZddlZddlZddlZddlZddddddd	d
ddd
ddddddddgZd3dd�Zdd�Zd4dd�Zd5dd	�Z	d6dd�Z
dZdZd7dd�Z
d8d d�Zd!d�Zd"d#�Zd$d%�Zd9d&d
�Zd:d'd�Zd;d(d
�Zd<d)d�Zd=d*d�Zd>d+d�Zd,d�ZGd-d�d�Zd.d�Zd/d�Zd0ZGd1d�de�ZGd2d�d�ZdS)?z@Extract, format and print information about Python stack traces.�N�
extract_stack�
extract_tb�format_exception�format_exception_only�format_list�format_stack�	format_tb�	print_exc�
format_exc�print_exception�
print_last�print_stack�print_tb�clear_frames�FrameSummary�StackSummary�TracebackException�
walk_stack�walk_tbcCs4|dkrtj}t�|���D]}t||dd�qdS)zyPrint the list of tuples as returned by extract_tb() or
    extract_stack() as a formatted stack trace to the given file.N���file�end)�sys�stderrr�	from_list�format�print)�extracted_listr�item�r �!/usr/lib64/python3.8/traceback.py�
print_listsr"cCst�|���S)a�Format a list of tuples or FrameSummary objects for printing.

    Given a list of tuples or FrameSummary objects as returned by
    extract_tb() or extract_stack(), return a list of strings ready
    for printing.

    Each string in the resulting list corresponds to the item with the
    same index in the argument list.  Each string ends in a newline;
    the strings may contain internal newlines as well, for those items
    whose source text line is not None.
    )rrr)rr r r!rscCstt||d�|d�dS)aPrint up to 'limit' stack trace entries from the traceback 'tb'.

    If 'limit' is omitted or None, all entries are printed.  If 'file'
    is omitted or None, the output goes to sys.stderr; otherwise
    'file' should be an open file or file-like object with a write()
    method.
    ��limit�rN)r"r)�tbr$rr r r!r-scCst||d���S)z5A shorthand for 'format_list(extract_tb(tb, limit))'.r#)rr�r&r$r r r!r7scCstjt|�|d�S)a#
    Return a StackSummary object representing a list of
    pre-processed entries from traceback.

    This is useful for alternate formatting of stack traces.  If
    'limit' is omitted or None, all entries are extracted.  A
    pre-processed stack trace entry is a FrameSummary object
    containing attributes filename, lineno, name, and line
    representing the information that is usually printed for a stack
    trace.  The line is a string with leading and trailing
    whitespace stripped; if the source is not available it is None.
    r#)r�extractrr'r r r!r;s
zG
The above exception was the direct cause of the following exception:

zF
During handling of the above exception, another exception occurred:

TcCsB|dkrtj}tt|�|||d�j|d�D]}t||dd�q*dS)a�Print exception up to 'limit' stack trace entries from 'tb' to 'file'.

    This differs from print_tb() in the following ways: (1) if
    traceback is not None, it prints a header "Traceback (most recent
    call last):"; (2) it prints the exception type and value after the
    stack trace; (3) if type is SyntaxError and value has the
    appropriate format, it prints the line where the syntax error
    occurred with a caret on the next line indicating the approximate
    position of the error.
    Nr#��chainrr)rrr�typerr)�etype�valuer&r$rr*�liner r r!rWs��
cCs ttt|�|||d�j|d��S)azFormat a stack trace and the exception information.

    The arguments have the same meaning as the corresponding arguments
    to print_exception().  The return value is a list of strings, each
    ending in a newline and some containing internal newlines.  When
    these lines are concatenated and printed, exactly the same text is
    printed as does print_exception().
    r#r))�listrr+r)r,r-r&r$r*r r r!rls��cCstt||d����S)aFormat the exception part of a traceback.

    The arguments are the exception type and value such as given by
    sys.last_type and sys.last_value. The return value is a list of
    strings, each ending in a newline.

    Normally, the list contains a single string; however, for
    SyntaxError exceptions, it contains several lines that (when
    printed) display detailed information about where the syntax
    error occurred.

    The message indicating which exception occurred is always the last
    string in the list.

    N)r/rr)r,r-r r r!r|scCs.t|�}|dks|sd|}nd||f}|S)Nz%s
z%s: %s
)�	_some_str)r,r-�valuestrr.r r r!�_format_final_exc_line�s

r2cCs*z
t|�WSdt|�jYSXdS)Nz<unprintable %s object>)�strr+�__name__)r-r r r!r0�s
r0cCstt��|||d��dS)z>Shorthand for 'print_exception(*sys.exc_info(), limit, file)'.�r$rr*N)rr�exc_infor5r r r!r	�scCsd�tt��||d���S)z%Like print_exc() but return a string.r�r$r*)�joinrrr6r7r r r!r
�scCs.ttd�std��ttjtjtj|||�dS)znThis is a shorthand for 'print_exception(sys.last_type,
    sys.last_value, sys.last_traceback, limit, file)'.�	last_typezno last exceptionN)�hasattrr�
ValueErrorrr9�
last_value�last_tracebackr5r r r!r�s
�cCs*|dkrt��j}tt||d�|d�dS)z�Print a stack trace from its invocation point.

    The optional 'f' argument can be used to specify an alternate
    stack frame at which to start. The optional 'limit' and 'file'
    arguments have the same meaning as for print_exception().
    Nr#r%)r�	_getframe�f_backr"r)�fr$rr r r!r
�s
cCs"|dkrt��j}tt||d��S)z5Shorthand for 'format_list(extract_stack(f, limit))'.Nr#)rr>r?rr)r@r$r r r!r�s
cCs0|dkrt��j}tjt|�|d�}|��|S)asExtract the raw traceback from the current stack frame.

    The return value has the same format as for extract_tb().  The
    optional 'f' and 'limit' arguments have the same meaning as for
    print_stack().  Each item in the list is a quadruple (filename,
    line number, function name, text), and the entries are in order
    from oldest to newest stack frame.
    Nr#)rr>r?rr(r�reverse)r@r$�stackr r r!r�s
	
cCs8|dk	r4z|j��Wntk
r*YnX|j}qdS)zEClear all references to local variables in the frames of a traceback.N)�tb_frame�clear�RuntimeError�tb_next�r&r r r!r�sc@sZeZdZdZdZdddd�dd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
edd��ZdS)ra,A single frame from a traceback.

    - :attr:`filename` The filename for the frame.
    - :attr:`lineno` The line within filename for the frame that was
      active when the frame was captured.
    - :attr:`name` The name of the function or method that was executing
      when the frame was captured.
    - :attr:`line` The text from the linecache module for the
      of code that was running when the frame was captured.
    - :attr:`locals` Either None if locals were not supplied, or a dict
      mapping the name to the repr() of the variable.
    )�filename�lineno�name�_line�localsTN)�lookup_linerLr.cCsB||_||_||_||_|r"|j|r8dd�|��D�nd|_dS)a�Construct a FrameSummary.

        :param lookup_line: If True, `linecache` is consulted for the source
            code line. Otherwise, the line will be looked up when first needed.
        :param locals: If supplied the frame locals, which will be captured as
            object representations.
        :param line: If provided, use this instead of looking up the line in
            the linecache.
        cSsi|]\}}|t|��qSr )�repr)�.0�k�vr r r!�
<dictcomp>sz)FrameSummary.__init__.<locals>.<dictcomp>N)rHrIrJrKr.�itemsrL)�selfrHrIrJrMrLr.r r r!�__init__�szFrameSummary.__init__cCs`t|t�r:|j|jko8|j|jko8|j|jko8|j|jkSt|t�r\|j|j|j|jf|kStS�N)	�
isinstancerrHrIrJrL�tupler.�NotImplemented�rT�otherr r r!�__eq__s

�
�
�
zFrameSummary.__eq__cCs|j|j|j|jf|SrV)rHrIrJr.)rT�posr r r!�__getitem__szFrameSummary.__getitem__cCst|j|j|j|jg�SrV)�iterrHrIrJr.�rTr r r!�__iter__szFrameSummary.__iter__cCsdj|j|j|jd�S)Nz7<FrameSummary file {filename}, line {lineno} in {name}>)rHrIrJ)rrHrIrJr`r r r!�__repr__s
�zFrameSummary.__repr__cCsdS)N�r r`r r r!�__len__szFrameSummary.__len__cCs&|jdkr t�|j|j���|_|jSrV)rK�	linecache�getlinerHrI�stripr`r r r!r.s
zFrameSummary.line)
r4�
__module__�__qualname__�__doc__�	__slots__rUr\r^rarbrd�propertyr.r r r r!r�s
�
ccs4|dkrt��jj}|dk	r0||jfV|j}qdS)z�Walk a stack yielding the frame and line number for each frame.

    This will follow f.f_back from the given frame. If no frame is given, the
    current stack is used. Usually used with StackSummary.extract.
    N)rr>r?�f_lineno)r@r r r!r$s
ccs"|dk	r|j|jfV|j}qdS)z�Walk a traceback yielding the frame and line number for each frame.

    This will follow tb.tb_next (and thus is in the opposite order to
    walk_stack). Usually used with StackSummary.extract.
    N)rC�	tb_linenorFrGr r r!r1s�c@s:eZdZdZedddd�dd��Zedd	��Zd
d�ZdS)rzA stack of frames.NTF�r$�lookup_lines�capture_localsc

Cs�|dkr(ttdd�}|dk	r(|dkr(d}|dk	rV|dkrFt�||�}ntj||d�}|�}t�}|D]Z\}}|j}	|	j}
|	j	}|�
|
�t�|
|j
�|r�|j}nd}|�t|
||d|d��qf|D]}
t�|
�q�|r�|D]
}|jq�|S)a?Create a StackSummary from a traceback or stack object.

        :param frame_gen: A generator that yields (frame, lineno) tuples to
            include in the stack.
        :param limit: None to include all frames or the number of frames to
            include.
        :param lookup_lines: If True, lookup lines for each frame immediately,
            otherwise lookup is deferred until the frame is rendered.
        :param capture_locals: If True, the local variables from each frame will
            be captured as object representations into the FrameSummary.
        N�tracebacklimitr)�maxlenF)rMrL)�getattrr�	itertools�islice�collections�deque�set�f_code�co_filename�co_name�addre�	lazycache�	f_globals�f_locals�appendr�
checkcacher.)
�klass�	frame_genr$rqrr�result�fnamesr@rI�corHrJr�r r r!r(As@
�
zStackSummary.extractc	CsLt�}|D]<}t|t�r$|�|�q
|\}}}}|�t||||d��q
|S)z�
        Create a StackSummary object from a supplied list of
        FrameSummary objects or old-style list of tuples.
        )r.)rrWrr�)r��a_listr��framerHrIrJr.r r r!rqs

zStackSummary.from_listc
Csng}d}d}d}d}|D�]}|dksT||jksT|dksT||jksT|dksT||jkr�|tkr�|t8}|�d|�d|dkr|dnd�d��|j}|j}|j}d}|d7}|tkr�qg}|�d	�|j|j|j��|jr�|�d
�|j����|j�r t	|j�
��D]\}}	|�dj||	d���q|�d�|��q|tk�rj|t8}|�d|�d|dk�r^dnd�d��|S)
aFormat the stack ready for printing.

        Returns a list of strings ready for printing.  Each string in the
        resulting list corresponds to a single frame from the stack.
        Each string ends in a newline; the strings may contain internal
        newlines as well, for those items with source text lines.

        For long sequences of the same frame and line, the first few
        repetitions are shown, followed by a summary line stating the exact
        number of further repetitions.
        Nrz  [Previous line repeated z
 more time��srz]
z  File "{}", line {}, in {}
�    {}
z    {name} = {value}
)rJr-)rHrIrJ�_RECURSIVE_CUTOFFr�rr.rgrL�sortedrSr8)
rTr��	last_file�	last_line�	last_name�countr��rowrJr-r r r!r�sZ
������
�zStackSummary.format)r4rhrirj�classmethodr(rrr r r r!r>s�/
c@s^eZdZdZddddd�dd�Zedd	��Zd
d�Zdd
�Zdd�Z	dd�Z
dd�dd�ZdS)ra�An exception ready for rendering.

    The traceback module captures enough attributes from the original exception
    to this intermediary form to ensure that no references are held, while
    still being able to fully print or format it.

    Use `from_exception` to create TracebackException instances from exception
    objects, or the constructor to create TracebackException instances from
    individual components.

    - :attr:`__cause__` A TracebackException of the original *__cause__*.
    - :attr:`__context__` A TracebackException of the original *__context__*.
    - :attr:`__suppress_context__` The *__suppress_context__* value from the
      original exception.
    - :attr:`stack` A `StackSummary` representing the traceback.
    - :attr:`exc_type` The class of the original traceback.
    - :attr:`filename` For syntax errors - the filename where the error
      occurred.
    - :attr:`lineno` For syntax errors - the linenumber where the error
      occurred.
    - :attr:`text` For syntax errors - the text where the error
      occurred.
    - :attr:`offset` For syntax errors - the offset into the text where the
      error occurred.
    - :attr:`msg` For syntax errors - the compiler error message.
    NTF�r$rqrr�_seenc	CsJ|dkrt�}|�t|��|r\|jdk	r\t|j�|kr\tt|j�|j|jj|d||d�}nd}|r�|jdk	r�t|j�|kr�tt|j�|j|jj|d||d�}	nd}	||_|	|_|r�|jnd|_t	j
t|�|||d�|_||_
t|�|_|�r8t|t��r8|j|_|j}
|
dk	�rt|
�nd|_|j|_|j|_|j|_|�rF|��dS)NFr�rp)rzr~�id�	__cause__rr+�
__traceback__�__context__�__suppress_context__rr(rrB�exc_typer0�_str�
issubclass�SyntaxErrorrHrIr3�text�offset�msg�_load_lines)rTr��	exc_value�
exc_tracebackr$rqrrr��cause�context�lnor r r!rU�sd��	��	��
zTracebackException.__init__cOs|t|�||jf|�|�S)z.Create a TracebackException from an exception.)r+r�)�cls�exc�args�kwargsr r r!�from_exceptionsz!TracebackException.from_exceptioncCs6|jD]
}|jq|jr"|j��|jr2|j��dS)z7Private API. force all lines in the stack to be loaded.N)rBr.r�r�r�)rTr�r r r!r�s

zTracebackException._load_linescCs|j|jkSrV)�__dict__rZr r r!r\szTracebackException.__eq__cCs|jSrV)r�r`r r r!�__str__szTracebackException.__str__ccs6|jdkrtd|j�VdS|jj}|jj}|dkr@|d|}t|jt�s^t||j�VdSd}|jdk	r�d�|j	pxd|j�Vn|j	dk	r�d�|j	�}|j
}|j}|dk	�rd�|���V|dk	�r|�
d	�}tt|�|�d
}|d|���}dd�|D�}d
�d�|��V|j�p d}d�|||�VdS)a�Format the exception part of the traceback.

        The return value is a generator of strings, each ending in a newline.

        Normally, the generator emits a single string; however, for
        SyntaxError exceptions, it emits several lines that (when
        printed) display detailed information about where the syntax
        error occurred.

        The message indicating which exception occurred is always the last
        string in the output.
        N)�__main__�builtins�.rz  File "{}", line {}
z<string>z ({})r��
r�css|]}|��r|pdVqdS)� N)�isspace)rO�cr r r!�	<genexpr>Msz;TracebackException.format_exception_only.<locals>.<genexpr>z    {}^
z<no detail available>z	{}: {}{}
)r�r2r�rirhr�r�rIrrHr�r�rg�rstrip�min�len�lstripr8r�)rT�stype�smod�filename_suffix�badliner��
caretspacer�r r r!r"s<

�



z(TracebackException.format_exception_onlyr)ccs�|rT|jdk	r*|jj|d�EdHtVn*|jdk	rT|jsT|jj|d�EdHtV|jrpdV|j��EdH|��EdHdS)a�Format the exception.

        If chain is not *True*, *__cause__* and *__context__* will not be formatted.

        The return value is a generator of strings, each ending in a newline and
        some containing internal newlines. `print_exception` is a wrapper around
        this method which just prints the lines to a file.

        The message indicating which exception occurred is always the last
        string in the output.
        Nr)z#Traceback (most recent call last):
)r�r�_cause_messager�r��_context_messagerBr)rTr*r r r!rRs

�zTracebackException.format)r4rhrirjrUr�r�r�r\r�rrr r r r!r�s�:
	0)N)NN)N)N)NNT)NT)NNT)NT)NNT)NNN)NN)NN) rjrxrvrer�__all__r"rrrrr�r�rrrr2r0r	r
rr
rrrrrrr�r/rrr r r r!�<module>sb�




��







A
zquopri.cpython-38.opt-1.pyc000064400000012707150335716500011466 0ustar00U

e5dT�@s�dZddddgZdZdZdZdZzd	d
lmZmZWne	k
rPdZdZYnXdd
�Z
dd�Zddd�Zddd�Z
ddd�Zddd�Zdd�Zdd�Zdd�Zedkr�e�dS) zHConversions to/from quoted-printable transport encoding as per RFC 1521.�encode�decode�encodestring�decodestring�=�Ls0123456789ABCDEF��)�a2b_qp�b2a_qpNcCs:|dkr|S|dkr|S|tkp8d|ko2dknS)z�Decide whether a particular byte ordinal needs to be quoted.

    The 'quotetabs' flag indicates whether embedded tabs and spaces should be
    quoted.  Note that line-ending tabs and spaces are always encoded, as per
    RFC 1521.
    � 	�_� �~)�ESCAPE)�c�	quotetabs�header�r�/usr/lib64/python3.8/quopri.py�needsquotings
rcCs(t|�}ttt|dt|df�S)zQuote a single character.�)�ordr�bytes�HEX�rrrr�quote$srFc
Cs2tdk	r,|��}t|||d�}|�|�dS|dfdd�}d}|��}|sN�qg}	d}
|dd�dkrv|dd�}d}
|D]D}t|f�}t|||�r�t|�}|r�|dkr�|	�d	�qz|	�|�qz|dk	r�||�t�	|	�}t
|�tk�r||dtd
�dd�|td
d�}q�|}q>|dk	�r.|||
d�dS)
avRead 'input', apply quoted-printable encoding, and write to 'output'.

    'input' and 'output' are binary file objects. The 'quotetabs' flag
    indicates whether embedded tabs and spaces should be quoted. Note that
    line-ending tabs and spaces are always encoded, as per RFC 1521.
    The 'header' flag indicates whether we are encoding spaces as _ as per RFC
    1522.N�rr�
cSsj|r<|dd�dkr<|�|dd�t|dd��|�n*|dkrX|�t|�|�n|�||�dS)N���r�.)�writer)�s�output�lineEndrrrr ;s
(zencode.<locals>.writerrr
r�s=
)r#)r
�readr �readlinerrr�append�EMPTYSTRING�join�len�MAXLINESIZE)
�inputr"rr�data�odatar Zprevline�lineZoutline�strippedrZthislinerrrr,s>	




cCsFtdk	rt|||d�Sddlm}||�}|�}t||||�|��S)Nrr��BytesIO)r
�ior2r�getvalue)r!rrr2�infp�outfprrrrjscCs�tdk	r*|��}t||d�}|�|�dSd}|��}|s>�q�dt|�}}|dkr�||d|�dkr�d}	|d}|dkr�||d|�dkr�|d}qtnd}	||k�r�|||d�}
|
dkr�|r�|d	}|d}q�|
tkr�||
}|d}q�|d|k�r|	�sd}	�q�q�|d|k�rJ||d|d
�tk�rJ|t}|d
}q�|d
|k�r�t||d|d
���r�t||d
|d���r�|tt||d|d��f�}|d}q�||
}|d}q�|	s.|�|d�d}q.|�r�|�|�dS)z�Read 'input', apply quoted-printable decoding, and write to 'output'.
    'input' and 'output' are binary file objects.
    If 'header' is true, decode underscore as space (per RFC 1522).N�rrrr$rs 	
rr
��)	r	r%r r&r*r�ishexr�unhex)r,r"rr-r.�newr/�i�n�partialrrrrrusP



(
B"

cCsDtdk	rt||d�Sddlm}||�}|�}t|||d�|��S)Nr7rr1)r	r3r2rr4)r!rr2r5r6rrrr�scCsHd|kodknpFd|ko*dknpFd|koBdkSS)zDReturn true if the byte ordinal 'c' is a hexadecimal digit in ASCII.�0�9�a�f�A�Frrrrrr:�sr:cCs�d}|D]�}t|f�}d|kr*dkr8nn
td�}nLd|krLdkr^nntd�d}n&d	|krrd
kr�nntd	�d}n|dt|�|}q|S)z.Get the integer value of a hexadecimal number.rr@rA�0rBrC�a�
rDrEr)rr)r!�bitsrr=rrrr;�s

r;cCs�ddl}ddl}z|�|jdd�d�\}}WnV|jk
r�}z6|j|_t|�td�td�td�|�d�W5d}~XYnXd}d}|D] \}}|dkr�d}|d	kr�d}q�|r�|r�|j|_td
�|�d�|s�dg}d}	|D]�}
|
dkr�|jj	}nTzt
|
d�}WnDtk
�rP}z$|j�d
|
|f�d}	WY�q�W5d}~XYnXz*|�rjt||jj	�nt||jj	|�W5|
dk�r�|�
�Xq�|	�r�|�|	�dS)Nrr$Ztdz"usage: quopri [-t | -d] [file] ...z-t: quote tabsz-d: decode; default encoder8z-tz-dz -t and -d are mutually exclusive�-�rbz%s: can't open (%s)
)�sys�getopt�argv�error�stderr�stdout�print�exit�stdin�buffer�open�OSErrorr �closerr)rLrMZopts�args�msgZdecoZtabs�orG�sts�file�fprrr�main�sT


r_�__main__)F)FF)F)F)�__doc__�__all__rr+rr(Zbinasciir	r
�ImportErrorrrrrrrr:r;r_�__name__rrrr�<module>s*

>

+
.modulefinder.cpython-38.opt-1.pyc000064400000037267150335716500012634 0ustar00U

e5dn_�@sdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ejdZejdZ
ejdZejdZeefZejZdZdZdZd	Zd
ZdZdZiZd
d�ZiZdd�Zddd�ZGdd�d�ZGdd�d�Zdd�Z e!dk�rz
e �Z"Wne#k
�re$d�YnXdS)z3Find modules used by a script, using introspection.�N�
LOAD_CONST�IMPORT_NAME�
STORE_NAME�STORE_GLOBAL������cCst�|g��|�dS�N)�packagePathMap�
setdefault�append)Zpackagename�path�r�$/usr/lib64/python3.8/modulefinder.py�AddPackagePath(srcCs|t|<dSr)�replacePackageMap)Zoldname�newnamerrr�ReplacePackage3srcCstjj��tjj�||�}|dkr8tdj|d�|d��|jtjjkrVddddt	ffS|jtjj
krtddddtffS|j}|j�
|�r�dtj�|�ddtffSt|jtjj�r�t}n<t|jtjj�r�t}n&t|jtjj�r�t}nddddtffSt�|�}tj�|�d}|||d|ffS)zDAn importlib reimplementation of imp.find_module (for our purposes).NzNo module named {name!r})�name�����rb)�	importlib�	machinery�
PathFinder�invalidate_caches�	find_spec�ImportError�format�loader�BuiltinImporter�
_C_BUILTIN�FrozenImporter�
_PY_FROZEN�origin�
is_package�osr�dirname�_PKG_DIRECTORY�
isinstance�SourceFileLoader�
_PY_SOURCE�ExtensionFileLoader�_C_EXTENSION�SourcelessFileLoader�_PY_COMPILED�
_SEARCH_ERROR�io�	open_code�splitext)rr�specZ	file_pathZkind�file�suffixrrr�_find_module7s*
r:c@seZdZddd�Zdd�ZdS)�ModuleNcCs(||_||_||_d|_i|_i|_dSr)�__name__�__file__�__path__�__code__�globalnames�starimports)�selfrr8rrrr�__init__fszModule.__init__cCsLd|jf}|jdk	r&|d|jf}|jdk	r@|d|jf}|d}|S)Nz	Module(%rz, %r�))r<r=r>)rB�srrr�__repr__ss

zModule.__repr__)NN)r<�
__module__�__qualname__rCrFrrrrr;ds

r;c@s�eZdZd6dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zd7dd�Z	d8dd�Z
dd�Zdd�Zd9dd�Z
dd�Zdd�Zdd�Zd d!�Zd:d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd;d,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)<�ModuleFinderNrcCsZ|dkrtj}||_i|_i|_||_d|_|dk	r8|ng|_|dk	rJ|ng|_g|_dS)Nr)	�sysr�modules�
badmodules�debug�indent�excludes�
replace_paths�processed_paths)rBrrMrOrPrrrrC~szModuleFinder.__init__cGsV||jkrRt|j�D]}tddd�qt|dd�|D]}tt|�dd�q6t�dS)N�   � ��end)rM�rangerN�print�repr)rB�level�str�args�i�argrrr�msg�s
zModuleFinder.msgcGs,|d}||jkr(|jd|_|j|�dS�Nrr�rMrNr^�rBr[rYrrr�msgin�s
zModuleFinder.msgincGs,|d}||jkr(|jd|_|j|�dSr_r`rarrr�msgout�s
zModuleFinder.msgoutc	CsB|�dd|�t�|�� }ddtf}|�d|||�W5QRXdS)Nr�
run_scriptrr�__main__)r^r4r5r.�load_module)rB�pathname�fp�stuffrrrrd�s
zModuleFinder.run_scriptc	CsTtj�|�\}}tj�|�\}}t�|�� }|dtf}|�||||�W5QRXdS)Nr)r)r�splitr6r4r5r.rf)rBrg�dirrZextrhrirrr�	load_file�s

zModuleFinder.load_filerc	Cs\|�dd||||�|j||d�}|�||�\}}|�||�}|sF|S|jrX|�||�dS)Nr�import_hook�rY)r^�determine_parent�find_head_package�	load_tailr>�ensure_fromlist)	rBr�caller�fromlistrY�parent�q�tail�mrrrrm�szModuleFinder.import_hookcCs&|�dd||�|r|dkr,|�dd�dS|j}|dkr�|jrH|d8}|dkrl|j|}|�dd|�|S|�d�|kr�td��d�|�d�d|��}|j|}|�dd|�|S|jr�|j|}|�dd|�|Sd|k�r|�	d�}|d|�}|j|}|�dd|�|S|�dd�dS)	N�rorzdetermine_parent -> Nonerzdetermine_parent ->�.zrelative importpath too deep)
rbrcr<r>rK�countr �joinrj�rfind)rBrsrYZpnamerur\rrrro�s<





zModuleFinder.determine_parentcCs�|�dd||�d|kr@|�d�}|d|�}||dd�}n|}d}|r\d|j|f}n|}|�|||�}|r�|�dd||f�||fS|r�|}d}|�|||�}|r�|�dd||f�||fS|�dd|�td	|��dS)
Nryrprzrr�%s.%szfind_head_package ->�"raise ImportError: No module named�No module named )rb�findr<�
import_modulercr )rBrurr\�headrwZqnamervrrrrp�s.
zModuleFinder.find_head_packagecCs�|�dd||�|}|r�|�d�}|dkr2t|�}|d|�||dd�}}d|j|f}|�|||�}|s|�dd|�td|��q|�dd	|�|S)
Nryrqrzrrr~rr�zload_tail ->)rbr��lenr<r�rcr )rBrvrwrxr\r�Zmnamerrrrq�s
zModuleFinder.load_tailcCs�|�dd|||�|D]d}|dkrD|sz|�|�}|rz|�||d�qt||�sd|j|f}|�|||�}|std|��qdS)Nryrr�*rr~r�)r^�find_all_submodulesrr�hasattrr<r�r )rBrxrt�	recursive�sub�all�subnameZsubmodrrrrrs

zModuleFinder.ensure_fromlistc
	Cs�|js
dSi}g}|tjjdd�7}|tjjdd�7}|tjjdd�7}|jD]�}zt�|�}Wn&tk
r�|�	dd|�YqTYnX|D]R}d}|D]0}t
|�}	||	d�|kr�|d|	�}q�q�|r�|dkr�|||<q�qT|��S)Nrzcan't list directoryrC)r>rr�EXTENSION_SUFFIXES�SOURCE_SUFFIXES�BYTECODE_SUFFIXESr)�listdir�OSErrorr^r��keys)
rBrxrK�suffixesrk�namesr�modZsuff�nrrrr�s.

z ModuleFinder.find_all_submodulescCs
|�dd|||�z|j|}Wntk
r4YnX|�dd|�|S||jkrb|�dd�dS|r�|jdkr�|�dd�dSz|�||o�|j|�\}}}Wn$tk
r�|�ddd�YdSXz|�	||||�}W5|r�|��X|r�t
|||�|�dd|�|S)Nrr�zimport_module ->zimport_module -> None)rbrK�KeyErrorrcrLr>�find_moduler �closerf�setattr)rBZpartname�fqnamerurxrhrgrirrrr�.s:
�
zModuleFinder.import_modulec
Cs(|\}}}|�dd||od|�|tkrF|�||�}|�dd|�|S|tkr`t|��|d�}	n||tkr�z|��}
tj	�
|
|i�Wn:tk
r�}z|�ddt|�|��W5d}~XYnXt
�t|
�dd��}	nd}	|�|�}||_|	�r|j�r|�|	�}	|	|_|�|	|�|�dd|�|S)Nrrfrhzload_module ->�execzraise ImportError: �)rbr+�load_packagercr.�compile�readr2r�_bootstrap_external�
_classify_pycr rZ�marshal�loads�
memoryview�
add_moduler=rP�replace_paths_in_coder?�	scan_code)rBr�rhrg�	file_infor9�mode�typerx�co�data�excrrrrfNs4


zModuleFinder.load_modulecCs<||jkri|j|<|r*d|j||j<nd|j|d<dS)Nr�-)rLr<)rBrrsrrr�_add_badmoduleks


zModuleFinder._add_badmodulecCsB||jkr|�||�dSz|j|||d�Wn~tk
rn}z"|�ddt|��|�||�W5d}~XYn�tk
r�}z"|�ddt|��|�||�W5d}~XYn�X|�r>|D]�}|d|}||jkr�|�||�q�z|j|||g|d�Wq�tk
�r:}z"|�ddt|��|�||�W5d}~XYq�Xq�dS)NrnrzImportError:zSyntaxError:rz)rLr�rmr r^rZ�SyntaxError)rBrrsrtrYr^r��fullnamerrr�_safe_import_hookss,

zModuleFinder._safe_import_hookccs�|j}|j}|j}dd�t�|�D�}t|�D]�\}\}}|tkrTd||ffVq.|tkr.|dkr.||dd||ddkr�tkr.nq.|||dd}	|||dd}
|	dkr�d|
||ffVq.d|	|
||ffVq.q.dS)	NcSs"g|]\}}}|tkr||f�qSr)�EXTENDED_ARG)�.0�_�opr]rrr�
<listcomp>�s�z-ModuleFinder.scan_opcodes.<locals>.<listcomp>�storerrr�absolute_import�relative_import)	�co_code�co_names�	co_consts�disZ_unpack_opargs�	enumerate�	STORE_OPSrr)rBr��coder��constsZopargsr\r�ZopargrYrtrrr�scan_opcodes�s(��
zModuleFinder.scan_opcodescCs�|j}|j}||�D�]F\}}|dkr8|\}d|j|<q|dk�r|\}}d}	|dk	rpd|krbd}	dd�|D�}|j|||dd�|	�r\d}
|jr�|j�|jd	|�}
|
dkr�|j�|�}
|
dk	r�|j�|
j�|j	�|
j	�|
j
dkr�d|j	|<n
d|j	|<q|d
k�rT|\}}}|�r0|j||||d�n"|j||d�}|j|jd|dd�qt|��q|j
D]"}
t|
t|���rd|�|
|��qddS)Nr�rr�rr�cSsg|]}|dkr|�qS)r�r)r��frrrr��sz*ModuleFinder.scan_code.<locals>.<listcomp>rnrzr�)r�r�r@r�r>rK�getr<�updaterAr?ro�RuntimeErrorr�r,r�r�)rBr�rxr��scannerZwhatr[rrtZ	have_starZmmrYru�crrrr��sH





zModuleFinder.scan_codecCs�|�dd||�t�|�}|r"|}|�|�}||_|g|_|jt�|g�|_|�d|j�\}}}z&|�	||||�|�
dd|�|W�S|r�|��XdS)Nrr�rCzload_package ->)rbrr�r�r=r>r
r�r�rfrc)rBr�rgrrxrhZbufrirrrr��s

zModuleFinder.load_packagecCs*||jkr|j|St|�|j|<}|Sr)rKr;)rBr�rxrrrr��s

zModuleFinder.add_modulecCsn|dk	r|jd|}n|}||jkr<|�dd|�t|��|dkrd|tjkr^ddddtffS|j}t||�S)Nrzrzfind_module -> Excludedr)	r<rOrcr rJ�builtin_module_namesr$rr:)rBrrrur�rrrr��s

zModuleFinder.find_modulecCst�tdd�tdd�t|j���}|D]B}|j|}|jrRtddd�ntddd�td||jpnd	�q0|��\}}|r�t�td
�|D]*}t|j|���}td|dd
�|��q�|�rt�tddd�td�|D]*}t|j|���}td|dd
�|��q�dS)z�Print a report to stdout, listing the found modules with their
        paths, as well as modules that are missing, or seem to be missing.
        z
  %-25s %s)�NameZFile)�----r��PrSrTrxz%-25srzMissing modules:�?z
imported fromz, z7Submodules that appear to be missing, but could also bez#global names in the parent package:N)	rW�sortedrKr�r>r=�any_missing_mayberLr|)rBr��keyrx�missing�mayberZmodsrrr�reports0
zModuleFinder.reportcCs|��\}}||S)z�Return a list of modules that appear to be missing. Use
        any_missing_maybe() if you want to know which modules are
        certain to be missing, and which *may* be missing.
        )r�)rBr�r�rrr�any_missing"szModuleFinder.any_missingcCs�g}g}|jD]�}||jkrq|�d�}|dkr<|�|�q||dd�}|d|�}|j�|�}|dk	r�||j|kr�|�|�q�||jkr�q�|jr�|�|�q�|�|�q|�|�q|��|��||fS)a�Return two lists, one with modules that are certainly missing
        and one with modules that *may* be missing. The latter names could
        either be submodules *or* just global names in the package.

        The reason it can't always be determined is that it's impossible to
        tell which names are imported when "from module import *" is done
        with an extension module, short of actually importing it.
        rzrrN)	rLrOr}rrKr�r@rA�sort)rBr�r�rr\r�ZpkgnameZpkgrrrr�*s0	




zModuleFinder.any_missing_maybecCs�tj�|j�}}|jD]*\}}|�|�r||t|�d�}qDq|jr�||jkr�||krr|�	dd||f�n|�	dd|f�|j�
|�t|j�}t
t|��D](}t||t|��r�|�||�||<q�|jt|�|d�S)Nrzco_filename %r changed to %rz co_filename %r remains unchanged)r��co_filename)r)r�normpathr�rP�
startswithr�rMrQrcr�listr�rVr,r�r��replace�tuple)rBr�Znew_filenameZoriginal_filenamer��rr�r\rrrr�Xs&
��
z"ModuleFinder.replace_paths_in_code)NrNN)NNr)r)r)r)N)r<rGrHrCr^rbrcrdrlrmrorprqrrr�r�rfr�r�r�r�r�r�r�r�r�r�r�rrrrrI|s2
	

#
 
1
".rIc
Cs�ddl}z|�tjdd�d�\}}Wn2|jk
rX}zt|�WY�dSd}~XYnXd}d}g}g}|D]Z\}}	|dkr�|d}|dkr�d}|dkr�||	�tj�}|dkr�d}|dkrn|�|	�qn|s�d	}
n|d}
tj	dd�}tj	�
|
�|d<||}|dk�r.td
�|D]}tdt|���qt|||�}
|dd�D]`}|dk�r\d}�qF|�r�|dd�d
k�r�|
�
|dd�ddg�n
|
�
|�n
|
�|��qF|
�|
�|
��|
S)Nrrzdmp:qx:z-dz-mz-pz-qz-xzhello.pyzpath:rR���z.*r�)�getoptrJ�argv�errorrWrjr)�pathseprrr*rXrIrmrlrdr�)r�Zoptsr[r^rMZdomodsZaddpathZexclude�o�aZscriptr�item�mfr]rrr�testpsX


r�rez
[interrupted])N)%�__doc__r�Zimportlib._bootstrap_externalr�importlib.machineryr�r)r4rJ�types�warningsZopmaprrrrr�r�r3r.r2r0r+r$r&r
rrrr:r;rIr�r<r��KeyboardInterruptrWrrrr�<module>sL




-w;

gettext.cpython-38.pyc000064400000042735150335716500010700 0ustar00U

e5dj�@s�dZddlZddlZddlZddlZddddddd	d
ddd
ddddddddddgZej�ejdd�Z	e�
dejejB�Z
dd�Zdd�ZdZd d!�eed"�D�Zd#d$d%d&�ZdGd(d)�Zd*d+�Zd,d-�Zd.d/�ZGd0d�d�ZGd1d�de�ZdHd3d�ZiZd4gZdddd2efd5d�Zdedfd6d�Ziaiad7a dId8d	�Z!dJd9d
�Z"dKd:d�Z#d;d�Z$d<d�Z%d=d
�Z&d>d�Z'd?d�Z(d@d�Z)dAd�Z*dBd�Z+dCd�Z,dDd�Z-dEd�Z.dFd�Z/eZ0dS)La�Internationalization and localization support.

This module provides internationalization (I18N) and localization (L10N)
support for your Python programs by providing an interface to the GNU gettext
message catalog library.

I18N refers to the operation by which a program is made aware of multiple
languages.  L10N refers to the adaptation of your program, once
internationalized, to the local language and cultural habits.

�N�NullTranslations�GNUTranslations�Catalog�find�translation�install�
textdomain�bindtextdomain�bind_textdomain_codeset�dgettext�	dngettext�gettext�lgettext�	ldgettext�
ldngettext�	lngettext�ngettext�pgettext�	dpgettext�	npgettext�
dnpgettextZshare�localea�
        (?P<WHITESPACES>[ \t]+)                    | # spaces and horizontal tabs
        (?P<NUMBER>[0-9]+\b)                       | # decimal integer
        (?P<NAME>n\b)                              | # only n is allowed
        (?P<PARENTHESIS>[()])                      |
        (?P<OPERATOR>[-*/%+?:]|[><!]=?|==|&&|\|\|) | # !, *, /, %, +, -, <, >,
                                                     # <=, >=, ==, !=, &&, ||,
                                                     # ? :
                                                     # unary and bitwise ops
                                                     # not allowed
        (?P<INVALID>\w+|.)                           # invalid token
    ccsPt�t|�D]8}|j}|dkr q|�|�}|dkr>td|��|VqdVdS)NZWHITESPACESZINVALIDz invalid token in plural form: %s�)�re�finditer�_token_pattern�	lastgroup�group�
ValueError)�pluralZmoZkind�value�r!�/usr/lib64/python3.8/gettext.py�	_tokenizeWs
r#cCs|rtd|�Std�SdS)Nz#unexpected token in plural form: %szunexpected end of plural form)r)r r!r!r"�_errorbsr$))�||)�&&)z==z!=)�<�>z<=z>=)�+�-)�*�/�%cCs i|]\}}|D]
}||�qqSr!r!)�.0�iZops�opr!r!r"�
<dictcomp>ps
r1��or�andz//)r%r&r,���cCs�d}t|�}|dkr&|d7}t|�}q|dkrXt|�\}}d||f}|dkr�td��nP|dkrnd	||f}n:zt|d
�}Wntk
r�t|�d�YnXd||f}t|�}d}|tk�rt|}||krҐq|d
kr�|d
kr�d|}t�||�}t||d�\}	}d|||	f}|}q�||k�r4dk�r@nnd|}|dk�r�|dk�r�t|d�\}
}|dk�rtt|��t|�\}}d|
||f}|dk�r�d|}||fS)Nr�!znot �(z%s(%s)�)z%unbalanced parenthesis in plural form�nz%s%s�
z%s%d�d)��z(%s)r2z%s %s %sr=�?r�:z%s if %s else %s)�next�_parser�intr$�_binary_ops�	_c2py_ops�get)�tokensZpriority�result�nexttok�subr �jr/r0�rightZif_trueZif_falser!r!r"rAssP




rAcCsZzt|�}Wn(tk
r4td|jjf�d�YnXddl}|�d|jjftd�|S)Nz'Plural value must be an integer, got %srr=)�round�	TypeError�	__class__�__name__�warnings�warn�DeprecationWarning)r9r/rPr!r!r"�_as_int�s ����rScCs�t|�dkrtd��z|tt|��\}}|r2t|��d}|D]6}|dkr`|d7}|dkrptd��q:|dkr:|d8}q:d	ti}td
||�|dWStk
r�td��YnXdS)
z�Gets a C expression as used in PO files for plural forms and returns a
    Python function that implements an equivalent expression.
    i�z"plural form expression is too longrr7r2�z%plural form expression is too complexr8rSz�if True:
            def func(n):
                if not isinstance(n, int):
                    n = _as_int(n)
                return int(%s)
            �funcN)�lenrrAr#r$rS�exec�RecursionError)rrGrHZdepth�c�nsr!r!r"�c2py�s.

��
r[c
Cs4t�|�}d}d}d}d}|�d�}|dkrN||d�}|d|�}||O}nd}|�d�}|dkr�||d�}|d|�}||O}nd}|�d�}|dkr�||d�}|d|�}||O}nd}|}	g}
t|d�D]P}||@s�|	}||@r�||7}||@�r
||7}||@�r||7}|
�|�q�|
��|
S)	Nr2�r=r�@r�.�_)rZ	normalizer�range�append�reverse)
ZlocZCOMPONENT_CODESETZCOMPONENT_TERRITORYZCOMPONENT_MODIFIER�mask�posZmodifier�codesetZ	territoryZlanguageZretr/�valr!r!r"�_expand_lang�sJ









rgc@s�eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zddd�ZdS) rNcCs.i|_d|_d|_d|_|dk	r*|�|�dS�N)�_info�_charset�_output_charset�	_fallbackrA��self�fpr!r!r"�__init__�szNullTranslations.__init__cCsdSrhr!rmr!r!r"rAszNullTranslations._parsecCs|jr|j�|�n||_dSrh)rl�add_fallback)rn�fallbackr!r!r"rq
szNullTranslations.add_fallbackcCs|jr|j�|�S|Srh)rlr
)rn�messager!r!r"r
szNullTranslations.gettextc
Csrddl}|�dtd�|jrR|���(|�ddt�|j�|�W5QR�SQRX|jrd|�|j�S|�t	�
��S)Nr�/lgettext() is deprecated, use gettext() insteadr\�ignore�.*\blgettext\b.*)rPrQrRrl�catch_warnings�filterwarningsrrk�encoder�getpreferredencoding)rnrsrPr!r!r"rs�
�zNullTranslations.lgettextcCs*|jr|j�|||�S|dkr"|S|SdS�Nr2)rlr)rn�msgid1�msgid2r9r!r!r"r"s
zNullTranslations.ngettextc
Cs�ddl}|�dtd�|jrV|���,|�ddt�|j�|||�W5QR�SQRX|dkrd|}n|}|jrz|�|j�S|�t	�
��S)Nr�1lngettext() is deprecated, use ngettext() insteadr\ru�.*\blngettext\b.*r2)rPrQrRrlrwrxrrkryrrz�rnr|r}r9rP�tmsgr!r!r"r*s"�
�"zNullTranslations.lngettextcCs|jr|j�||�S|Srh)rlr)rn�contextrsr!r!r"r;szNullTranslations.pgettextcCs,|jr|j�||||�S|dkr$|S|SdSr{)rlr)rnr�r|r}r9r!r!r"r@s
zNullTranslations.npgettextcCs|jSrh)ri�rnr!r!r"�infoHszNullTranslations.infocCs|jSrh)rjr�r!r!r"�charsetKszNullTranslations.charsetcCsddl}|�dtd�|jS)Nrzoutput_charset() is deprecatedr\�rPrQrRrk)rnrPr!r!r"�output_charsetNs�zNullTranslations.output_charsetcCs ddl}|�dtd�||_dS)Nrz"set_output_charset() is deprecatedr\r�)rnr�rPr!r!r"�set_output_charsetTs�z#NullTranslations.set_output_charsetcCsRddl}|j|jd<|dk	rNddddddh}|t|�@D]}t||�|j|<q8dS)	Nrr_r
rrrrr)�builtinsr
�__dict__�set�getattr)rn�namesr�Zallowed�namer!r!r"rZs�zNullTranslations.install)N)N)rO�
__module__�__qualname__rprArqr
rrrrrr�r�r�r�rr!r!r!r"r�s

c@s\eZdZdZdZdZdZdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�ZdS)rl�*l�$<z%s%s)rr2cCs|d?|d@fS)z/Returns a tuple of major version, minor version�i��r!)rn�versionr!r!r"�
_get_versionspszGNUTranslations._get_versionsc"Cs�ddlm}t|dd�}i|_}dd�|_|��}t|�}|d|dd	��d}||jkr||d
|d	d��\}}	}
}d}n6||jkr�|d
|d	d��\}}	}
}d}nt	dd|��|�
|�\}
}|
|jkr�t	ddt|
�|��t
d|	�D�]}||||
|
d��\}}||}|||||d��\}}||}||k�r`||k�r`|||�}|||�}nt	dd|��|dk�rld}|�d�D]�}|����}|�s��q�|�d��r�|�d��r��q�d}}d|k�r|�dd�\}}|����}|��}||j|<|}n|�r|j|d|7<|dk�r8|�d�d|_n0|dk�r�|�d�}|d�d�d}t|�|_�q�|j�pvd}d|k�r�|�d�\}} |�d�}t||�}t|�D]\}}!t|!|�|||f<�q�nt||�|t||�<|
d7}
|d7}q�dS)z8Override this method to support alternative .mo formats.r)�unpackr�rcSst|dk�Sr{)rB)r9r!r!r"�<lambda>}�z(GNUTranslations._parse.<locals>.<lambda>z<INr=z<4IrTz<IIz>4Iz>IIzBad magic numberzBad version number �zFile is corrupt�
z	#-#-#-#-#r?r2�
zcontent-typezcharset=zplural-forms�;zplural=�ascii�)Zstructr�r��_catalogr�readrV�LE_MAGIC�BE_MAGIC�OSErrorr��VERSIONS�strr`�split�decode�strip�
startswith�endswith�lowerrirjr[�	enumerate)"rnror��filenameZcatalogZbufZbuflen�magicr�ZmsgcountZ	masteridxZtransidxZiiZ
major_versionZ
minor_versionr/ZmlenZmoffZmendZtlenZtoffZtend�msgr�ZlastkZb_item�item�k�vrr�r|r}�xr!r!r"rAtsv














zGNUTranslations._parsecCshddl}|�dtd�t�}|j�||�}||krH|jrD|j�|�S|}|jrZ|�	|j�S|�	t
���S)Nrrtr\)rPrQrR�objectr�rErlrrkryrrz)rnrsrP�missingr�r!r!r"r�s�zGNUTranslations.lgettextcCs�ddl}|�dtd�z|j||�|�f}Wn@tk
rn|jrX|j�|||�YS|dkrf|}n|}YnX|jr�|�	|j�S|�	t
���S)Nrr~r\r2)rPrQrRr�r�KeyErrorrlrrkryrrzr�r!r!r"r�s �
zGNUTranslations.lngettextcCs6t�}|j�||�}||kr2|jr.|j�|�S|S|Srh)r�r�rErlr
)rnrsr�r�r!r!r"r
�szGNUTranslations.gettextcCs^z|j||�|�f}Wn@tk
rX|jrB|j�|||�YS|dkrP|}n|}YnX|Sr{)r�rr�rlr)rnr|r}r9r�r!r!r"r�s
zGNUTranslations.ngettextcCsF|j||f}t�}|j�||�}||krB|jr>|j�||�S|S|Srh)�CONTEXTr�r�rErlr)rnr�rs�ctxt_msg_idr�r�r!r!r"rszGNUTranslations.pgettextc	Csn|j||f}z|j||�|�f}WnBtk
rh|jrR|j�||||�YS|dkr`|}n|}YnX|Sr{)r�r�rr�rlr)rnr�r|r}r9r�r�r!r!r"rs
zGNUTranslations.npgettextN)rOr�r�r�r�r�r�r�rArrr
rrrr!r!r!r"rdsY	
FcCs�|dkrt}|dkrRg}dD]"}tj�|�}|r|�d�}q@qd|krR|�d�g}|D]$}t|�D]}||krf|�|�qfqZ|r�g}	nd}	|D]J}|dkr�q�tj�||dd|�}
tj�	|
�r�|r�|	�|
�q�|
Sq�|	S)N)ZLANGUAGE�LC_ALL�LC_MESSAGESZLANGr?�Cr�z%s.mo)
�_default_localedir�os�environrEr�rarg�path�join�exists)�domain�	localedir�	languages�allZenvarrfZnelangsZlangZnelangrG�mofiler!r!r"rs8


Zunspecifiedc
Cs|dkrt}t|||dd�}|sB|r*t�Sddlm}t|d|��d}|D]�}	|tj�|	�f}
t	�
|
�}|dkr�t|	d��}t	�|
||��}W5QRXddl
}
|
�
|�}|tk	r�ddl}|�dtd�|r�|���|�d	d
t�|�|�W5QRX|dk�r|}qJ|�|�qJ|S)NT)r�r)�ENOENTz$No translation file found for domain�rbzparameter codeset is deprecatedr\ruz.*\bset_output_charset\b.*)rrr�errnor��FileNotFoundErrorr�r��abspath�
_translationsrE�open�
setdefault�copy�_unspecifiedrPrQrRrwrxr�rq)r�r�r�Zclass_rrreZmofilesr�rGr��key�tror�rPr!r!r"rCsH�

�
�
cCst||d|d�}|�|�dS)NT)rrre)rr)r�r�rer�r�r!r!r"rnsZmessagescCs|dk	r|atSrh)�_current_domain)r�r!r!r"r|scCs|dk	r|t|<t�|t�Srh)�_localedirsrEr�)r�r�r!r!r"r	�scCs0ddl}|�dtd�|dk	r&|t|<t�|�S)Nrz'bind_textdomain_codeset() is deprecatedr\)rPrQrR�_localecodesetsrE)r�rerPr!r!r"r
�s�cCs:zt|t�|d��}Wntk
r.|YSX|�|�Srh)rr�rEr�r
)r�rsr�r!r!r"r�s

c
Cs�ddl}|�dtd�t�|�}z<|���*|�ddt�t|t�|d�|d�}W5QRXWn&t	k
r�|�
|pzt���YSX|���&|�ddt�|�
|�W5QR�SQRXdS)Nrz1ldgettext() is deprecated, use dgettext() insteadr\ru�.*\bparameter codeset\b.*�rerv)rPrQrRr�rErwrxrr�r�ryrrzr)r�rsrPrer�r!r!r"r�s&�

�$
�cCsRzt|t�|d��}Wn,tk
rB|dkr6|YS|YSYnX|�|||�Sr{)rr�rEr�r)r�r|r}r9r�r!r!r"r�sc
Cs�ddl}|�dtd�t�|�}z<|���*|�ddt�t|t�|d�|d�}W5QRXWn8t	k
r�|dkrz|}n|}|�
|p�t���YSX|���*|�ddt�|�
|||�W5QR�SQRXdS)	Nrz3ldngettext() is deprecated, use dngettext() insteadr\rur�r�r2r)rPrQrRr�rErwrxrr�r�ryrrzr)r�r|r}r9rPrer�r�r!r!r"r�s,�

�$
�cCs<zt|t�|d��}Wntk
r.|YSX|�||�Srh)rr�rEr�r)r�r�rsr�r!r!r"r�s

cCsTzt|t�|d��}Wn,tk
rB|dkr6|YS|YSYnX|�||||�Sr{)rr�rEr�r)r�r�r|r}r9r�r!r!r"r�scCs
tt|�Srh)rr�)rsr!r!r"r
�sc
CsNddl}|�dtd�|���&|�ddt�tt|�W5QR�SQRXdS)Nrrtr\ruz.*\bldgettext\b.*)rPrQrRrwrxrr�)rsrPr!r!r"r�s�
�cCstt|||�Srh)rr�)r|r}r9r!r!r"r�sc
CsRddl}|�dtd�|���*|�ddt�tt|||�W5QR�SQRXdS)Nrr~r\ruz.*\bldngettext\b.*)rPrQrRrwrxrr�)r|r}r9rPr!r!r"r�s�
�cCstt||�Srh)rr�)r�rsr!r!r"r�scCstt||||�Srh)rr�)r�r|r}r9r!r!r"r�s)r5)NNF)N)N)N)1�__doc__rr�r�sys�__all__r�r��base_prefixr��compile�VERBOSE�DOTALLrr#r$rCr�rDrArSr[rgrrrr�r�rrr�r�r�rr	r
rrrrrrr
rrrrrrr!r!r!r"�<module>s�0�
�

1$*f7
&�
+




	
pydoc.cpython-38.opt-1.pyc000064400000242752150335716500011272 0ustar00U

��.e̠�@s�dZdgZdZdZdZddlZddlZddlZddl	Zddl
ZddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZdd	lmZd
d�Zdd
�Zdd�Z dd�Z!dd�Z"dd�Z#dd�Z$e�%dej&�Z'dd�Z(dd�Z)dd�Z*dd �Z+dxd!d"�Z,d#d$�Z-d%d&�Z.d'd(�Z/d)d*�Z0ifd+d,�Z1Gd-d.�d.e2�Z3d/d0�Z4difd1d2�Z5Gd3d4�d4�Z6Gd5d6�d6e�Z7Gd7d8�d8e6�Z8Gd9d:�d:e�Z9Gd;d<�d<e6�Z:Gd=d>�d>e:�Z;d?d@�a<dAdB�Z=dCdD�Z>dEdF�Z?dGdH�Z@dIdJ�ZAdKdL�ZBdMdN�ZCdOdP�ZDdydQdR�ZEe:�ZFe;�ZGe8�ZHdzdSdT�ZId{dVdW�ZJd|dXdY�ZKd}dZd[�ZLd~d]d^�ZMGd_d`�d`�ZNeN�ZOGdadb�db�ZPdcdd�ZQdedf�ZRddhdi�ZSd�djdkdl�dmdn�ZTdodp�ZUdqdr�ZVdsdt�ZWdudv�ZXeYdwk�r�eX�dS)�aGenerate Python documentation in HTML or text for interactive use.

At the Python interactive prompt, calling help(thing) on a Python object
documents the object, and calling help() starts up an interactive
help session.

Or, at the shell command line outside of Python:

Run "pydoc <name>" to show documentation on something.  <name> may be
the name of a function, module, package, or a dotted reference to a
class or function within a module or module in a package.  If the
argument contains a path segment delimiter (e.g. slash on Unix,
backslash on Windows) it is treated as the path to a Python source file.

Run "pydoc -k <keyword>" to search for a keyword in the synopsis lines
of all available modules.

Run "pydoc -n <hostname>" to start an HTTP server with the given
hostname (default: localhost) on the local machine.

Run "pydoc -p <port>" to start an HTTP server on the given port on the
local machine.  Port number 0 can be used to get an arbitrary unused port.

Run "pydoc -b" to start an HTTP server on an arbitrary unused port and
open a Web browser to interactively browse documentation.  Combine with
the -n and -p options to control the hostname and port used.

Run "pydoc -w <name>" to write out the HTML documentation for a module
to a file named "<name>.html".

Module docs for core modules are assumed to be in

    https://docs.python.org/X.Y/library/

This can be overridden by setting the PYTHONDOCS environment variable
to a different URL or to a local directory containing the Library
Reference Manual pages.
�helpzKa-Ping Yee <ping@lfw.org>z26 February 2001z�Guido van Rossum, for an excellent programming language.
Tommy Burnette, the original creator of manpy.
Paul Prescod, for all his work on onlinehelp.
Richard Chamberlain, for the first implementation of textdoc.
�N)�deque)�Repr)�format_exception_onlycCs\g}g}tjD]H}tj�|pd�}tj�|�}||krtj�|�r|�|�|�|�q|S)zAConvert sys.path into a list of absolute, existing, unique paths.�.)�sys�path�os�abspath�normcase�isdir�append)�dirsZnormdirs�dirZnormdir�r�/usr/lib64/python3.8/pydoc.py�pathdirsPs

rcCs.t�|�pt�|�}|r*t�dd|���p,dS)z-Get the doc string or comments for an object.z^ *
�)�inspect�getdocZgetcomments�re�sub�rstrip)�object�resultrrrr\srcCsf|���d�}t|�dkr&|ddfSt|�dkrX|d��sX|dd�|dd��fSdd�|�fS)z>Split a doc string into a synopsis line (if any) and the rest.�
�rr�N)�strip�split�lenr�join)�doc�linesrrr�splitdocasr$cCs"|j}|j|kr|jd|}|S)z@Get a class name and qualify it with a module name if necessary.r)�__name__�
__module__)r�modname�namerrr�	classnamejs
r)cCs>t�|�p:t�|�p:t�|�p:t�|�p:t�|�p:t�|�S)z>Check if an object is of a type that probably means it's data.)r�ismodule�isclass�	isroutineZisframeZistracebackZiscode�rrrr�isdataqs����r.cGs.|r*|d�|�|d��}|dd�}q|S)z/Do a series of global replacements on a string.rrrN)r!r)�textZpairsrrr�replacewsr0cCsXt|�|krTtd|dd�}td|d|�}|d|�d|t|�|d�S|S)zCOmit part of a string if needed to make it fit in a maximum length.r�rN�...)r �max)r/�maxlenZpreZpostrrr�cram~s
$r5z at 0x[0-9a-f]{6,16}(>+)$cCst�d|�S)z>Remove the hexadecimal id from a Python object representation.z\1)�_re_stripidr�r/rrr�stripid�sr8cCs<t�|�rdSt�|�r8t|dd�}t�|�p4|dkSdS)zo
    Returns True if fn is a bound method, regardless of whether
    fn was implemented in Python or in C.
    T�__self__NF)r�ismethod�	isbuiltin�getattrr*)�fn�selfrrr�_is_bound_method�s

r?cCs^i}t�|tj�D]\}}d||<q|jD]}|�t|��q*|��D]}t||�||<qF|S�Nr)r�
getmembersr,�	__bases__�update�
allmethods�keysr<)�cl�methods�key�value�baserrrrD�s

rDcCs8g}g}|D]"}||�r$|�|�q|�|�q||fS)z�Split sequence s via predicate, and return pair ([true], [false]).

    The return value is a 2-tuple of lists,
        ([x for x in s if predicate(x)],
         [x for x in s if not predicate(x)])
    �r
)�s�	predicateZyesZno�xrrr�_split_list�srOcCs\|dkrdS|�d�r$|�d�r$dS|�d�r<t|d�r<dS|dk	rL||kS|�d�SdS)	z3Decide whether to show documentation on a variable.>�	__slots__�__date__�__path__�__qualname__�__builtins__�__credits__�__doc__�
__author__�__version__�__file__r%�
__cached__r&�
__loader__�__spec__�__package__r�__r�_�_fieldsTN)�
startswith�endswith�hasattr)r(�all�objrrr�visiblename�srfcCsXg}t�|�D]D\}}}}t�|�r@d}t|t�r@|jdkr@d}|�||||f�q|S)zCWrap inspect.classify_class_attrs, with fixup for data descriptors.�data descriptorN�readonly property)r�classify_class_attrs�isdatadescriptor�
isinstance�property�fsetr
)r�resultsr(�kind�clsrIrrrri�s
rics\t|dg��z�fdd�t��D��Wntk
r>i�YnX�fdd�}|j|d�dS)zGSort the attrs list in-place by _fields and then alphabetically by namer`csi|]\}}||t���qSr)r )�.0�ir()�fieldsrr�
<dictcomp>�sz#sort_attributes.<locals>.<dictcomp>cs��|dd�|dfS�Nr)�get)�attr)�field_orderrr�<lambda>��z!sort_attributes.<locals>.<lambda>�rHN)r<�	enumerate�	TypeError�sort)�attrsrZkeyfuncr)rxrsr�sort_attributes�s
r�cCs:tj�|�r6dD]$}tj�tj�|d|��rdSqdS)z3Guess whether a path refers to a package directory.)z.pyz.pyc�__init__TF)r	rr�isfiler!)r�extrrr�	ispackage�s
r�cCs�|��}|dd�dks |��s0|��}|sq0q|��}|dd�dkrT|dd�}|dd�dkr�|dd�}|dd�dkr�|dd�}|��s�|��}|s�q�q�|�d�d	��}nd}|S)
Nr�#�zr"""r1�"""����\r)�readlinerr)�file�linerrrr�source_synopsis�s&r�c
	Cs t�|�j}|�|d�\}}|dks.||k�r|�ttjj��rJtjj	}n |�ttjj
��rftjj}nd}|dkr�zt�
|�}Wntk
r�YdSX|�t|�}W5QRXn^|d|�}tjjd||d�}ztj�|�}	WnYdSXtjd=|	j�r|	j��dnd}||f||<|S)z.Get the one-line summary out of a module file.)NNNZ__temp__��loaderr)r	�stat�st_mtimervrb�tuple�	importlib�	machinery�BYTECODE_SUFFIXES�SourcelessFileLoader�EXTENSION_SUFFIXES�ExtensionFileLoader�tokenize�open�OSErrorr��util�spec_from_file_location�
_bootstrap�_loadr�modulesrV�
splitlines)
�filename�cache�mtimeZ
lastupdaterZ
loader_clsr�r��spec�modulerrr�synopsis�s6



�r�c@s eZdZdZdd�Zdd�ZdS)�ErrorDuringImportzEErrors that occurred while trying to import something to document it.cCs||_|\|_|_|_dS�N)r��excrI�tb)r>r��exc_inforrrr�#szErrorDuringImport.__init__cCs|jj}d|j||jfS)Nzproblem in %s - %s: %s)r�r%r�rI)r>r�rrr�__str__'szErrorDuringImport.__str__N)r%r&rSrVr�r�rrrrr�!sr�c		Cs�tjj}t|d��}||�t|��k}W5QRXtj�|�}tj�	|�\}}|r`tj
�||�}ntj
�||�}tjj
|||d�}ztj�|�WSt|t����YnXdS)z<Import a Python source file or compiled file given its path.�rbr�N)r�r��MAGIC_NUMBERr��readr r	r�basename�splitext�_bootstrap_externalr��SourceFileLoaderr�r�r�r�rr�)	r�magicr�Zis_bytecoder�r(r�r�r�rrr�
importfile+sr�c	s z^|rT�tjkrT�tjkrT�fdd�tjD�}�g|D]}tj|||<tj|=q8t��}Wnzt��\}}}}	�tjkr�ttj�j|	��n>|tkr�t|j|	��n(t	|t
�r�|j�kr�YdSt�t����YnX��d�dd�D].}
zt
||
�}Wq�tk
�rYdSXq�|S)a�Import a module; handle errors; return None if the module isn't found.

    If the module *is* found but an exception occurs, it's wrapped in an
    ErrorDuringImport exception and reraised.  Unlike __import__, if a
    package path is specified, the module at the end of the path is returned,
    not the package at the beginning.  If the optional 'forceload' argument
    is 1, we reload the module from disk (unless it's a dynamic extension).csg|]}|��d�r|�qS)r)ra)rq�m�rrr�
<listcomp>Qszsafeimport.<locals>.<listcomp>Nrr)rr��builtin_module_names�
__import__r�r�rY�SyntaxErrorr��
issubclass�ImportErrorr(rr<�AttributeError)r�	forceloadr�ZsubsrHr�r�rIr��info�partrr�r�
safeimport=s.


r�c@sfeZdZej�ddejdd��Zddd�Z	d
dd�Z
e
ZZZ
ZZZe�d	�fd
d�ZdS)�Doc�
PYTHONDOCSz%https://docs.python.org/%d.%d/libraryNrcGs�||f|}zFt�|�r$|j|�WSt�|�r:|j|�WSt�|�rP|j|�WSWntk
rfYnXt�|�r||j	|�S|j
|�S)z%Generate documentation for an object.)rr*�	docmoduler+�docclassr,�
docroutiner�rj�docdata�docother)r>rr(�argsrrr�documentss




zDoc.documentcGs*d|odt|�t|�jf}t|��dS)z+Raise an exception for unimplemented types.z.don't know how to document object%s of type %s� N)�repr�typer%r})r>rr(r��messagerrr�fail�s
�zDoc.failZstdlibcCs�zt�|�}Wntk
r&d}YnXtj�d|j�}tj�|�}t	|t
t��r�|jdksz|�|�r�|�tj�
|d��s�|jdkr�|�d�r�d|�d�|j��f}q�tj�
||j��d	�}nd
}|S)z*Return the location of module docs or None�
(built-in)r�)
�errno�
exceptionsZgcZimp�marshal�posix�signalr�_threadZ	zipimportz
site-packages)z	xml.etreeztest.pydoc_mod)zhttp://zhttps://z%s/%s�/�.htmlN)r�
getabsfiler}r	�environrvr�rrrkr�r%rar!r�lower)r>rZbasedirr��doclocrrr�	getdocloc�s(
����
z
Doc.getdocloc)N)N)r%r&rSr	r�rvr�version_infor�r�r�r�r�r�r��docpropertyr��	sysconfigZget_pathr�rrrrr�ms��

r�c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZeZ	dd
�Z
eZdS)�HTMLReprzBClass for safely making an HTML representation of a Python object.cCs,t�|�d|_|_d|_d|_|_dS�N��
�d�rr��maxlist�maxtuple�maxdict�	maxstring�maxother�r>rrrr��s
zHTMLRepr.__init__cCst|dddddd�S)N�&z&amp;�<z&lt;�>z&gt;)r0�r>r/rrr�escape�szHTMLRepr.escapecCst�||�Sr�)rr��r>rrrrr��sz
HTMLRepr.reprcCsZtt|�d�r@dd�t|�j���}t||�r@t||�||�S|�ttt	|��|j
��S�Nr%�repr_r_)rcr�r!r%rr<r�r5r8r�r��r>rN�levelZ
methodnamerrr�repr1�s

zHTMLRepr.repr1cCs^t||j�}t|�}d|krJdt|dd�krJd|d|�|�|dSt�dd|�|��S)Nr��\\r�rrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z<font color="#c040c0">\1</font>)r5r�r�r0r�rr�r>rNr�ZtestZtestreprrrr�repr_string�s�zHTMLRepr.repr_stringcCs@z|�ttt|��|j��WS|�d|jj�YSXdS�Nz
<%s instance>)r�r5r8r�r��	__class__r%�r>rNr�rrr�
repr_instance�szHTMLRepr.repr_instanceN)r%r&rSrVr�r�r�r�r��repr_strrZrepr_unicoderrrrr��sr�c@seZdZdZe�ZejZejZdd�Zd1dd�Z	d2d
d�Z
dd
�Zdd�Zd3dd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdiiifdd �Zd4d!d"�Zd5d#d$�Zddiifd%d&�Zd'd(�Zddiiidfd)d*�Zd6d+d,�ZeZd7d-d.�Zd8d/d0�ZdS)9�HTMLDocz'Formatter class for HTML documentation.cCsd||fS)�Format an HTML page.z�<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
%s
</body></html>r)r>�title�contentsrrr�page�s�zHTMLDoc.pagercCsd|||||pdfS)zFormat a page heading.a'
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="%s">
<td valign=bottom>&nbsp;<br>
<font color="%s" face="helvetica, arial">&nbsp;<br>%s</font></td
><td align=right valign=bottom
><font color="%s" face="helvetica, arial">%s</font></td></tr></table>
    �&nbsp;r)r>r�fgcol�bgcolZextrasrrr�heading�s�zHTMLDoc.heading�Nrc	
Cs^|dkrdd|d}d|||f}	|r@|	d||||f}	n|	d|||f}	|	d|S)	z Format a section with a heading.Nz<tt>rz</tt>z�<p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="%s">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="%s" face="helvetica, arial">%s</font></td></tr>
    zR
<tr bgcolor="%s"><td rowspan=2>%s</td>
<td colspan=2>%s</td></tr>
<tr><td>%s</td>z(
<tr><td bgcolor="%s">%s</td><td>%s</td>z'
<td width="100%%">%s</td></tr></table>r)
r>rr	r
r�widthZpreludeZ
marginaliaZgaprrrr�section�s�
��zHTMLDoc.sectioncGsd|}|j|f|��S)z$Format a section with a big heading.z<big><strong>%s</strong></big>)r)r>rr�rrr�
bigsectionszHTMLDoc.bigsectionc
Cs&|�|���}t|dddddddd�	S)z!Format literal preformatted text.�

z
 
r�rr�<br>
)r��
expandtabsr0r�rrr�	preformat
s�zHTMLDoc.preformatr�cCs�d}t|�|d|}t|�D]X}|dd|}t|||||�D]$}|t|�krJ||||�d}qJ|d}q d|S)z0Format a list of items into a multi-column list.rrz<td width="%d%%" valign=top>r�rz</td>z7<table width="100%%" summary="list"><tr>%s</tr></table>)r �range)r>�list�formatZcolsr�rows�colrrrrr�multicolumns
zHTMLDoc.multicolumncCsd|S)Nz<font color="#909090">%s</font>rr�rrr�greyrzzHTMLDoc.greycGs*|D] }||krd|||fSq|S)z:Make a link for an identifier, given name-to-URL mappings.�<a href="%s">%s</a>r)r>r(Zdicts�dictrrr�namelinkszHTMLDoc.namelinkcCsN|jtj�|j�}}t||�rDt||�|krDd|j|t||�fSt||�S)zMake a link for a class.z<a href="%s.html#%s">%s</a>)r%rr�rvr&rcr<r))r>rr'r(r�rrr�	classlink%s�zHTMLDoc.classlinkcCsd|j|jfS)zMake a link for a module.�<a href="%s.html">%s</a>)r%r�rrr�
modulelink-szHTMLDoc.modulelinkcCsR|\}}}}|r|�|�S|r,d||f}nd|}|rBd|}n|}d||fS)z;Make a link for a module or package to display in an index.z
%s.%s.htmlz%s.htmlz"<strong>%s</strong>&nbsp;(package)r)r)r>Z
modpkginfor(rr��shadowed�urlr/rrr�
modpkglink1s

zHTMLDoc.modpkglinkcCsd||fS)zMake a link to source file.z<a href="file:%s">%s</a>r)r>r"rrrr�filelink@szHTMLDoc.filelinkcCs�|p|j}g}d}t�d�}|�||�}	|	s0�qh|	��\}
}|�||||
���|	��\}}
}}}}|
r�||��dd�}|�d||f�n�|r�dt|�}|�d|||�f�n�|r�dt|�}|�d|||�f�n�|�r"|||d�d	k�r|�d
|�	||��n|�d|�n@|||d�d	k�rP|�|�	||||��n|�|�	||��|}q|�|||d���d
�
|�S)z�Mark up some plain text, given a context of symbols to look for.
        Each context dictionary maps object names to anchor names.rzD\b((http|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?(\w+))�"z&quot;rz'http://www.rfc-editor.org/rfc/rfc%d.txtz(http://www.python.org/dev/peps/pep-%04d/r�(zself.zself.<strong>%s</strong>Nr)r�r�compile�search�spanr
�groupsr0�intrr!)r>r/r��funcs�classesrGrn�here�pattern�match�start�endrdZschemeZrfcZpepZselfdotr(r"rrr�markupDs:

zHTMLDoc.markupc
Cs�d}|D]�}t|�td�kr�|\}}|d}||�||�}|r�||fkr�g}|D]}	|�|�|	|��qR|dd�|�d}|d}qt|�tg�kr|d|�|||�}qd	|S)
zAProduce HTML for a class tree as given by inspect.getclasstree().rrz"<dt><font face="helvetica, arial">r&�, �)z
</font></dt>z
<dd>
%s</dd>
z
<dl>
%s</dl>
)r�rr
r!�
formattree)
r>�treer'�parentr�entry�c�bases�parentsrJrrrr6os&
�
zHTMLDoc.formattreec#
s�|j}z
|j}Wntk
r(d}YnX|�d�}g}tt|�d�D],}|�dd�|d|d��||f�qHd�||dd��}	d|	}
z&t�	|�}t
j�|�}��
||�}
Wntk
r�d}
YnXg}t|d��r6t|j�}|dd	�d
k�r"|dd�dk�r"|d	d���}|�d��|��t|d
��rX|���t|j���|�rp|
dd�|�}
��|�}|dk	�r�dt�}nd}��|
ddd|
|�}t�|tj�}gi}}t�|tj�D]Z\}}|dk	�s�t�|��p�||k�r�t|||��r�|�||f�d|||<||<�q�|D]�\}}|jD]n}|j|j}}tj �!|�}||k�r@|�r@t||��r@t"||�|k�r@||k�r@|d|||<||<�q@�q2gi}}t�|tj#�D]p\}}|dk	�s�t�$|��s�t�|�|k�r�t|||��r�|�||f�d|||<t�%|��r�||||<�q�g}t�|t&�D]&\}}t|||��rN|�||f��qN��'t(|��j)||�}|�o�d|}|d|}t|d��rg}t*�+|j,�D]\}}} |�||| df��q�|�-���.|�j/�}!|��0ddd|!�}n.|�r<��.|�fdd��}!|��0d dd|!�}|�r�d!d"�|D�}"��1t�2|"d�|�g}!|D]"\}}|!���3|||||���qj|��0d#dd$d%�|!��}|�r�g}!|D]"\}}|!���3|||||���q�|��0d&dd'd%�|!��}|�r:g}!|D]\}}|!���3||���q|��0d(dd)d*�|!��}t|d+��rn��'t|j4��j)�}!|��0d,dd|!�}t|d-��r���'t|j5��j)�}!|��0d.dd|!�}|S)/z/Produce HTML documentation for a module object.Nrrz5<a href="%s.html"><font color="#ffffff">%s</font></a>r��)<big><big><strong>%s</strong></big></big>r�rX��$Revision: �$z
version %srQz (%s)r4z-<br><a href="%(docloc)s">Module Reference</a>r�#ffffff�#7799eez<a href=".">index</a><br>r�z.html#z#-z<tt>%s</tt>z
<p>%s</p>
rRrzPackage Contentsz#aa55cccs��|d�Sr@)r ��tr�rrry�rzz#HTMLDoc.docmodule.<locals>.<lambda>ZModulescSsg|]\}}|�qSrr�rqrHrIrrrr��sz%HTMLDoc.docmodule.<locals>.<listcomp>ZClasses�#ee77aar�Z	Functionsz#eeaa77ZDataz#55aa55rrWZAuthorrUZCredits)6r%�__all__r�rrr r
r!rr��urllib�parseZquoter$r}rc�strrXrr�rQr��localsrrAr*r+�	getmodulerfrBr&rr�rvr<r,r;�
isfunctionr.r3rr�pkgutil�iter_modulesrRr~rr#rr6�getclasstreer�rWrU)#r>rr(�mod�ignoredrd�partsZlinksrrZ
linkedname�headrr"r$r��versionr�rr�r-ZcdictrHrIrJr'r�r,Zfdict�datar"�modpkgs�importer�ispkgr�	classlistrr�rr��s*


��


$


�

�

 

���
��������zHTMLDoc.docmodulec	s��j}|p|}�j}g}	|	j�G�fdd�d�}
|
��tt����}t|�dkr�����d�|D]}�d��|�j	��qd�d���������fdd�}
����fd	d
�}��������fdd�}�fd
d�t
��D�}i�|D]n\}}}}d|d|�|<}zt�|�}Wntk
�r4YnXz|�|<Wq�t
k
�rXYq�Xq�|�rj|�rr|���n|dd�t|�fdd��\}}�tjk	�r��tjk�r�|}�q\n"��k�r�d}nd����j	�}|d7}t|��|
d||dd��}|
d||dd��}|
d||dd��}|d||dd��}|d||d d��}|d!||d"d��}|}�q\d#�|	�}	||k�r�d$||f}nd%|||f}|�r�g}|D]}|���|�j	���q�|d&d'�|�}d#}zt���}Wntt
fk
�rd(}YnX|�r8t|�}|�r8|d)k�r8|��|�d*}t��}|�rT||�pPd#}��|�j����}|�otd+|}��|d,d-|	d.|�S)/z.Produce HTML documentation for a class object.cs eZdZdd�Z�fdd�ZdS)z(HTMLDoc.docclass.<locals>.HorizontalRulecSs
d|_dSru�Zneedoner�rrrr�sz1HTMLDoc.docclass.<locals>.HorizontalRule.__init__cs|jr�d�d|_dS)Nz<hr>
rr[r���pushrr�maybe	sz.HTMLDoc.docclass.<locals>.HorizontalRule.maybeN�r%r&rSr�r^rr\rr�HorizontalRulesr`rz&<dl><dt>Method resolution order:</dt>
z<dd>%s</dd>
�</dl>
cs�t||�\}}|r�����|�|D]d\}}}}zt�|�}Wn&tk
rf���||���YnX���||��������d�q&|S)Nr�rOr^r<�	Exceptionr�r���msgrrM�okr(ro�homeclsrI�r-r,�hr�mdictrQrr]r>rr�spills"�
zHTMLDoc.docclass.<locals>.spillcsJt||�\}}|rF����|�|D]\}}}}���||���q&|Sr��rOr^r�rd�rirQr]r>rr�spilldescriptors+sz*HTMLDoc.docclass.<locals>.spilldescriptorsc
s�t||�\}}|r�����|�|D]�\}}}}��t�|�|��}t|�sXt�|�rft|dd�}	nd}	|	dkr��d|�n0��t|��j	����}	d|	}	�d||	f��d�q&|S)NrVz<dl><dt>%s</dl>
z<dd><tt>%s</tt>z<dl><dt>%s%s</dl>
r)
rOr^r�r<�callablerrjr3rr)
rerrMrfr(rorgrIrJr"rhrr�	spilldata4s(�
z#HTMLDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qS�)re�rf�rqr(rorprIr-rrr�Is
�z$HTMLDoc.docclass.<locals>.<listcomp>r��-rcs|d�kS�NrrrC��	thisclassrrrybrzz"HTMLDoc.docclass.<locals>.<lambda>�defined here�inherited from %sz:<br>
z
Methods %scSs|ddkS�Nr�methodrrCrrrryrrzzClass methods %scSs|ddkS�Nrzclass methodrrCrrrrytrzzStatic methods %scSs|ddkS�Nrz
static methodrrCrrrryvrzzReadonly properties %scSs|ddkS�NrrhrrCrrrryxrzzData descriptors %scSs|ddkS�NrrgrrCrrrryzrzzData and other attributes %scSs|ddkS�NrrVrrCrrrry|rzrz*<a name="%s">class <strong>%s</strong></a>z/<strong>%s</strong> = <a name="%s">class %s</a>�(%s)r4N�()rz<tt>%s<br>&nbsp;</tt>z#000000z#ffc8d8r1)r%rBr
rr�getmror r^rr&rir<rcr}�popleftrO�builtinsrr�r!�	signature�
ValueErrorrJr�rr3rr)r>rr(rQr,r-rR�realnamer;rr`�mrorJrkrnrprrHrorgrI�anchor�	inherited�tagrr<�declr��argspecr"r)	r-r,rirjrQrr]r>rwrr��s�
�
	
�

�

�
�
�
�
�
�

��
zHTMLDoc.docclasscCs|�d|�|��S�z)Format an argument default value as text.�=)rr�r�rrr�formatvalue�szHTMLDoc.formatvaluec	Cs�|j}|p|}|r|jpdd|}	d}
d}t|�r�|jj}|rZ||k	r�d|�||�}
n0|jdk	rzd|�|jj|�}
nd|�||�}
t�|�s�t�|�r�d}
nd}
||kr�d	|	|f}nD|r�t�||g�|kr�d
|jd||f}d}n|}d|	||f}d}t�	|��rlzt�
|�}Wnttfk
�r>d}YnX|�rlt
|�}|d
k�rld|}|dd�}|�svd}|
||�|�|
�o�|�d|
�}|�r�d|S|�t|�|j|||�}|�o�d|}d||fSdS)z;Produce HTML documentation for a function or method object.rrtr� from N� method of %s instance� unbound %s method�async z$<a name="%s"><strong>%s</strong></a>z<a href="#%s">%s</a>rz)<a name="%s"><strong>%s</strong></a> = %s�<lambda>z$<strong>%s</strong> <em>lambda</em> r��(...)z'<font face="helvetica, arial">%s</font>z<dl><dt>%s</dt></dl>
z<dd><tt>%s</tt></dd>z<dl><dt>%s</dt>%s</dl>
)r%r?r9r�rr�iscoroutinefunction�isasyncgenfunction�getattr_staticr,r�r�r}rJr�rr3rr)r>rr(rQr,r-rGrFr�r��note�skipdocs�imclass�asyncqualifierrZreallinkr�r�r�r"rrrr��s|
�
���

��zHTMLDoc.docroutinecCsNg}|j}|r|d|�|�t|�|j�}|r<|d|�|d�d�|�S)z1Produce html documentation for a data descriptor.z!<dl><dt><strong>%s</strong></dt>
z<dd><tt>%s</tt></dd>
rar)r
r3rrr!�r>rr(rQrFrnr]r"rrrr��szHTMLDoc.docdatacGs|rd|pd}||�|�S)z-Produce HTML documentation for a data object.z<strong>%s</strong> = r�r�)r>rr(rQrRZlhsrrrr��szHTMLDoc.docothercCs�g}|dkri}t�|g�D]<\}}}tdd�|D��r:q|�|d|||kf�d||<q|��|�||j�}|�|dd|�S)z2Generate an HTML index for a directory of modules.Ncss*|]"}dt|�kodknVqdS)i�i��N)�ord�rqZchrrr�	<genexpr>�sz HTMLDoc.index.<locals>.<genexpr>rrrArF)rNrO�anyr
r~rr#r)r>rr!rWrXr(rYrrrr�index�s
z
HTMLDoc.index)r)rrNr)r�)N)NN)NNN)NN)N)r%r&rSrVr��_repr_instancer�r�rrrrrrrrrr r#r$r3r6r�r�r�r�r�r�r�r�rrrrr�sH

�

+

y&�
A

rc@s4eZdZdZdd�Zdd�Zdd�ZeZdd	�Zd
S)�TextReprzAClass for safely making a text representation of a Python object.cCs,t�|�d|_|_d|_d|_|_dSr�r�r�rrrr�
s
zTextRepr.__init__cCsTtt|�d�r@dd�t|�j���}t||�r@t||�||�Sttt|��|j	�Sr�)
rcr�r!r%rr<r5r8r�r�r�rrrr�s

zTextRepr.repr1cCsHt||j�}t|�}d|krDdt|dd�krDd|d||dS|S)Nr�r�rr�r)r5r�r�r0r�rrrr�s
zTextRepr.repr_stringcCs4zttt|��|j�WSd|jjYSXdSr�)r5r8r�r�r�r%rrrrr%szTextRepr.repr_instanceN)	r%r&rSrVr�r�r�rrrrrrr�s	r�c@s~eZdZdZe�ZejZdd�Zddd�Zdd�Z	ddd�Z
dd
d�Zddd�Zdd�Z
ddd�Zddd�ZeZddd�Zd	S) �TextDocz'Formatter class for text documentation.cCsd�dd�|D��S)z(Format a string in bold by overstriking.rcss|]}|d|VqdS)�Nrr�rrrr�5szTextDoc.bold.<locals>.<genexpr>)r!r�rrr�bold3szTextDoc.bold�    cs>|sdS�fdd�|�d�D�}|r4|d��|d<d�|�S)z6Indent text by prepending a given prefix to each line.rcsg|]}�|�qSrr�rqr���prefixrrr�:sz"TextDoc.indent.<locals>.<listcomp>rr�)rrr!)r>r/r�r#rr�r�indent7szTextDoc.indentcCs$|�|���}|�|�d|dS)z&Format a section with a given heading.rr)r�rr�)r>rrZclean_contentsrrrr>szTextDoc.sectionNrc
	s�d}|D]�}t|�td�krr|\}}||t|��}|rh||fkrh�fdd�|D�}	|dd�|	�}|d}qt|�tg�kr||�|�||d�}q|S)	zBRender in text a class tree as returned by inspect.getclasstree().rrc3s|]}t|��VqdSr��r))rqr:�r'rrr�Msz%TextDoc.formattree.<locals>.<genexpr>r�r4rr�)r�r)r!r6)
r>r7r'r8r�rr9r:r;r<rr�rr6Es"
�zTextDoc.formattreec	Cs$|j}tt|��\}}|�d||o(d|�}t|dd�}|�|�}|dk	r`||�d|d�}|rt||�d|�}g}	t�|tj�D]<\}
}|dk	s�t�	|�p�||kr�t
|
||�r�|	�|
|f�q�g}t�|tj�D]F\}
}|dk	�st�
|��st�	|�|kr�t
|
||�r�|�|
|f�q�g}
t�|t�D]&\}
}t
|
||��r.|
�|
|f��q.g}t�}t|d��r�t�|j�D]6\}}}|�|�|�r�|�|d	�n
|�|��qx|��||�d
d�|��}g}t�|tj�D]0\}
}|j�|d��r�|
|k�r�|�|
��q�|�r6|��||�d
d�|��}|	�r�dd�|	D�}|�t�|d�|�g}|	D]\}
}|�|�||
|���qd||�dd�|��}|�r�g}|D]\}
}|�|�||
|���q�||�dd�|��}|
�r&g}|
D]"\}
}|�|j||
|dd���q�||�dd�|��}t|d��r�t|j�}|dd�dk�rp|dd�dk�rp|dd���}||�d|�}t|d��r�||�dt|j ��}t|d��r�||�dt|j!��}t|d ��r�||�d!t|j"��}zt�#|�}Wnt$k
�rd"}YnX||�d#|�}|S)$z5Produce text documentation for a given module object.�NAME� - rGNzMODULE REFERENCEa.

The following documentation is automatically generated from the Python
source files.  It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations.  When in doubt, consult the module reference at the
location listed above.
ZDESCRIPTIONrR�
 (package)zPACKAGE CONTENTSrrZ
SUBMODULEScSsg|]\}}|�qSrrrErrrr��sz%TextDoc.docmodule.<locals>.<listcomp>r�CLASSES�	FUNCTIONS�F)r4ZDATArXr>r?r�r@ZVERSIONrQZDATErWZAUTHORrUZCREDITSr�ZFILE)%r%r$rrr<r�rrAr+rLrfr
r,r;r.�setrcrNrOrR�addr~r!r*rar6rPr�r�rJrXrrQrWrUr�r})r>rr(rQZsynop�descrrdr�r-rHrIr,rVrWZ
modpkgs_namesrXr'rYZ
submodulesrZrrUr�rrrr�Us�
	�
��
��
�
$
zTextDoc.docmodulec	sL�j}|p|}�j}�jfdd�}||kr:d��|�}n��|�d|}|rlt||�}	|dd�|	�}g}
|
j�zt���}Wnt	t
fk
r�d}YnX|r�t|�}|r�|dkrʈ||d	�t��}
|
r�|
d	�t
t����}t|�d
k�r*�d�|D]}�d||���q
�d
�tdd�t���D�tjd�}t|�}d}|�r��d�|d|�D]}�d|��qn||k�r��dt||�d��d
�G�fdd�d�}|�������fdd�}����fdd�}�����fdd�}�fdd�t��D�}|�r|�r*|���n|dd
�t|�fd d!��\}}�tjk	�rn�tjk�rn|}�qn ��k�r~d"}nd#t��j�}t|��|d$||d%d!��}|d&||d'd!��}|d(||d)d!��}|d*||d+d!��}|d,||d-d!��}|d.||d/d!��}|}�qd	�|
�}
|
�s0|d	S|d	��|
��d0�d	S)1z4Produce text documentation for a given class object.cSs
t||�Sr�r�)r:r�rrr�makename�sz"TextDoc.docclass.<locals>.makename�class z	 = class r�r4Nr�rrzMethod resolution order:r�rcss.|]&}|j�d�s|jdkrt|j�VqdS)r_r�N)r%rar&rJ)rqrprrrr��s
�z#TextDoc.docclass.<locals>.<genexpr>r{r�zBuilt-in subclasses:z    ... and z other subclassescs eZdZdd�Z�fdd�ZdS)z(TextDoc.docclass.<locals>.HorizontalRulecSs
d|_dSrur[r�rrrr��sz1TextDoc.docclass.<locals>.HorizontalRule.__init__cs|jr�d�d|_dS)NzF----------------------------------------------------------------------rr[r�r\rrr^�sz.TextDoc.docclass.<locals>.HorizontalRule.maybeNr_rr\rrr`�sr`c
s�t||�\}}|r~����|�|D]V\}}}}zt�|�}Wn&tk
rf���||���Yq&X���||����q&|Sr�rbrd�rirQrr]r>rrrk�s�zTextDoc.docclass.<locals>.spillcsJt||�\}}|rF����|�|D]\}}}}���||���q&|Sr�rlrdrmrrrnsz*TextDoc.docclass.<locals>.spilldescriptorsc
	s�t||�\}}|r�����|�|D]v\}}}}t|�sDt�|�rNt|�}nd}zt�|�}	Wntk
r~|j|}	YnX��j	|	|�d|d�d�q&|S)Nr�)r4r"r)
rOr^rorrjrr<r��__dict__r�)
rerrMrfr(rorgrIr"rer�rrrps 
�z#TextDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qSrqrrrsr-rrr�+s
�z$TextDoc.docclass.<locals>.<listcomp>rcs|d�kSrurrCrvrrry4rzz"TextDoc.docclass.<locals>.<lambda>rxryzMethods %s:
cSs|ddkSrzrrCrrrryCrzzClass methods %s:
cSs|ddkSr|rrCrrrryErzzStatic methods %s:
cSs|ddkSr}rrCrrrryGrzzReadonly properties %s:
cSs|ddkSr~rrCrrrryIrzzData descriptors %s:
cSs|ddkSrrrCrrrryKrzzData and other attributes %s:
cSs|ddkSr�rrCrrrryMrzz |  )r%rBr&r��mapr!r
rr�r�r}rJrrr�r �sortedr��__subclasses__r�rir�rOr�rr)r�r�r)r>rr(rQrRr�r;r�rr<rr�r�r"r�rJZ
subclassesZno_of_subclassesZMAX_SUBCLASSES_TO_DISPLAYZsubclassnamer`rkrnrprr�r�r)rirQrr]r>rwrr��s�

�

��	
�

�

�
�
�
�
�
�
zTextDoc.docclasscCsd|�|�Sr�r�r�rrrr�WszTextDoc.formatvaluec	Cs�|j}|p|}d}d}t|�rn|jj}|rB||k	rndt||�}n,|jdk	r`dt|jj|�}ndt||�}t�|�s�t�|�r�d}	nd}	||kr�|�|�}
n,|r�t�	||g�|kr�d}|�|�d	|}
d}t�
|��r<zt�|�}Wntt
fk
�rd}YnX|�r<t|�}|d
k�r<|�|�d}
|dd�}|�sFd
}|	|
||}
|�rd|
dSt|��ppd}|
d|�o�|�|���dSdS)z;Produce text documentation for a function or method object.rrr�Nr�r�r�r� = r�z lambda r�r�r)r%r?r9r�r)rr�r�r�r�r,r�r�r}rJrr�r)r>rr(rQrFr�r�r�r�r�rr�r�r�r"rrrr�[sV
�
�

zTextDoc.docroutinecCsTg}|j}|r$||�|��|d�t|�p.d}|rJ||�|��|d�d�|�S)z1Produce text documentation for a data descriptor.rr)r
r�rr�r!r�rrrr��szTextDoc.docdatac
Cs�|�|�}|rF|r|dpd|}|t|�}	|	dkrF|d|	�d}|rX|�|�dpZd|}|dk	r~|d|�t|��7}|S)z-Produce text documentation for a data object.r�rrNr2r)r�r r�r�rJ)
r>rr(rQr8r4r"r�r�Zchoprrrr��s
zTextDoc.docother)r�)Nr)NN)NN)NNN)NNN)NNNNN)r%r&rSrVr�r�r�r�r�rr6r�r�r�r�r�r�r�rrrrr�+s


e

7
r�c@seZdZdZdd�ZdS)�
_PlainTextDocz2Subclass of TextDoc which overrides string stylingcCs|Sr�rr�rrrr��sz_PlainTextDoc.boldN)r%r&rSrVr�rrrrr��sr�cCst�at|�dS)zCThe first time this is called, determine what kind of pager to use.N)�getpager�pagerr7rrrr��sr�c	s@ttjd�stSttjd�s tStj��r4tj��s8tStj�d�pNtj�d���r�tj	dkrj�fdd�Stj�d�dkr��fd	d�S�fd
d�Stj�d�dkr�tStj	dkr�dd�Sttd�r�t�
d
�dkr�dd�Sddl}|��\}}t�
|�z8ttd��r$t�
d|�dk�r$dd�W�StW�SW5t�|�XdS)z2Decide what method to use for paging through text.�isattyZMANPAGERZPAGER�win32cstt|���Sr���
tempfilepager�plainr7�Z	use_pagerrrry�rzzgetpager.<locals>.<lambda>ZTERM)ZdumbZemacscstt|���Sr�)�	pipepagerr�r7r�rrry�rzcs
t|��Sr��r�r7r�rrry�rzcSstt|�d�S)Nzmore <r�r7rrrry�rz�systemz(less) 2>/dev/nullrcSs
t|d�S)NZlessr�r7rrrry�rzNz	more "%s"cSs
t|d�S)NZmorer�r7rrrry�rz)rcr�stdin�
plainpager�stdoutr�r	r�rv�platformr��tempfileZmkstemp�close�unlink�ttypager)r��fdr�rr�rr��s6


 r�cCst�dd|�S)z%Remove boldface formatting from text.z.r)rrr7rrrr��sr�c	Cs�ddl}|j|d|jd�}zDtj|jdd��*}z|�|�Wntk
rPYnXW5QRXWntk
rrYnXz|�	�Wq�Wqttk
r�YqtXqtdS)z3Page through text by feeding it to another program.rNT)�shellr��backslashreplace)�errors)
�
subprocess�Popen�PIPE�io�
TextIOWrapperr��write�KeyboardInterruptr��wait)r/�cmdr��proc�piperrrr��sr�c
Cs~ddl}|���d}tj�|d�}t|ddtjdkr<t�d�ndd��}|�	|�W5QRXt�
|d|d	�W5QRXdS)
z<Page through text by invoking a program on a temporary file.rNz	pydoc.out�wr�r�)r��encodingz "r%)r�ZTemporaryDirectoryr	rr!r�rr��device_encodingr�r�)r/r�r�Ztempdirr�r�rrrr��s
��r�cCs$ttjdd�pd}|�|d��|�S)Nr��utf-8r�)r<rr��encode�decode)r/r�rrr�_escape_stdoutsr�c
Cs�tt|���d�}z2ddl}tj��}|�|�}|�|�dd�}Wn(t	t
tjfk
rld}dd�}YnX�z0zttj�dd��}Wntk
r�d}YnX|dkr�d	}|d}}tj�d�|d|��d�||d��r�tj�d
�tj��|�}	|	dk�rtj�d��q�n,|	d
k�rJtj�d||d�|d}q�|	dk�rn|||}|dk�rnd}tj�dd�||||��d�||}q�W5|�r�|�
||j|�XdS)z%Page through text on a text terminal.rrNcSstj�d�Sr@)rr�r�rrrrryrzzttypager.<locals>.<lambda>cSstj��dd�dd�S)Nr�r)rr�r�rrrrryrzZLINESr�z
-- more --)�q�Qz
          
)�
r)�b�B�)r�r�r�ttyrr��filenoZ	tcgetattrZ	setcbreakr�r�r��UnsupportedOperationZ	tcsetattrZ	TCSAFLUSHr+r	r�rvr�r�r�r!�flush)
r/r#r�r��oldZgetchar�hr�Zincr:rrrr�	sL








&r�cCstj�tt|���dS)z>Simply print unformatted text.  This is the ultimate fallback.N)rr�r�r�r�r7rrrr�5sr�cCs�t�|�r>|jtjkr d|jSt|d�r4d|jSd|jSt�|�rRd|jSt�|�rtd|jj	|jj|jfSt�
|�r�d|jj	|jj|jfSt�|�r�d|jSt�|�r�d	|jSt�
|�r�d
|jSt|�jS)z/Produce a short description of the given thing.zbuilt-in module rRzpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%sr�z	function zmethod )rr*r%rr�rcr;Zisgetsetdescriptor�__objclass__r&Zismemberdescriptorr+rMr:r�)�thingrrr�describe9s6







�
�





r�c	Cs�dd�|�d�D�}d\}}|t|�kr\td�|d|d��|�}|r\||d}}qq\q|rf|}nt}||d�D],}zt||�}Wqvtk
r�YdSXqv|S)z@Locate an object by name or dotted path, importing as necessary.cSsg|]}|r|�qSrr)rqr�rrrr�Vszlocate.<locals>.<listcomp>rruNr)rr r�r!r�r<r�)rr�rSr��nZ
nextmodulerr�rrr�locateTs r�cCsVt|t�r0t||�}|dkr(td|��||fSt|dd�}|t|t�rL|ndfSdS)zDGiven an object or a path to an object, get the object and its name.Nz~No Python documentation found for %r.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.r%)rkrJr�r�r<)r�r�rr(rrr�resolvems

�r�� Python Library Documentation: %scCs�|dkrt}t||�\}}t|�}t�|�}|rTd|krT|d|d|�d��7}n|rn||k	rn|d|j7}t�|�s�t�|�s�t�	|�s�t�
|�s�t|�}|d7}||d|�||�S)zBRender text documentation, given an object or a path to an object.Nrz in z in module z objectr)
r/r�r�rrL�rfindr%r*r+r,rjr�r�)r�rr�Zrendererrr(r�r�rrr�
render_doc{s&

���rc
Csfz2|dkrtt|||��n|�t|||t��Wn.ttfk
r`}zt|�W5d}~XYnXdS)zCDisplay text documentation, given an object or a path to an object.N)r�rr��	plaintextr�r��print)r�rr��outputrIrrrr"�sr"c
Cs�z`t||�\}}t�t|�t�||��}t|dddd��}|�|�W5QRXtd|d�Wn.tt	fk
r�}zt|�W5d}~XYnXdS)z<Write HTML documentation to a file in the current directory.r�r�r�)r�ZwroteN)
r��htmlrr�r�r�r�rr�r�)r�r�rr(rr�rIrrr�writedoc�srrcCs2|dkri}t�|g|�D]\}}}t|�qdS)zAWrite out HTML documentation for all modules in a directory tree.N)rN�
walk_packagesr)r�pkgpathZdonerXr'rYrrr�	writedocs�s

r
cJ@s"eZdZddddddddddd	d
ddd
ddddddddddddddddddddd�#Zd d!�d"D�Zd�e�d'd(d)d*d+d,d-�Zd.d/d0d1d2d3d4d5d6d7d8d9d9d:d:d;�Ze��D]:\ZZ	e	D],Z
e�e
e�Zeekr�ed<eZeee
<q�q�d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdLdMdNdOdPdQddRdSdSdTdUdVdWdXdYdZd[d\d]d^d_d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{ddd|d}d~dd��IZd�d�d��Z
ed�d���Zed�d���Zd�d��Ze�Zefd�d��Zd�d��Zd�d��Zd�d��Zd�d��Zd�d�d��Zd�d��Zd�d��Zd�d��Zd�d�d��Zd�d�d��Zd�d��Zd�d�d��Z d�S)��Helperr�BOOLEAN�with)�assertr)�asyncr)�awaitr)�break�	while for)�classzCLASSES SPECIALMETHODS)�continuer)Zfunctionr)�del�BASICMETHODS�if)�elser�try)�forzbreak continue while�import)�globalznonlocal NAMESPACES)r�
TRUTHVALUE)r�MODULES)�in�SEQUENCEMETHODS�
COMPARISON)�lambdar�)�nonlocalzglobal NAMESPACES)�passr)�raise�
EXCEPTIONS)�returnr�)rr&)�whilezbreak continue if TRUTHVALUE)r
z CONTEXTMANAGERS EXCEPTIONS yield)�yieldr)#�False�None�True�and�asrrrrrr�defr�elifr�except�finallyr�fromrrrr�isr"r#�not�orr$r%r'rr(r
r)cCsg|]}dD]}||�qqS)��'r%r)rq�pr�rrrr��szHelper.<listcomp>)r��fr��ur8�'''r%r�)�+rt�*�**r�z//�%�<<�>>r��|�^�~r�r��<=�>=�==�!=�<>)r�r�rFrGrHrIrJ)rtrE)z+=z-=z*=z/=z%=z&=z|=z^=z<<=z>>=z**=z//=)rArBr�rCrDrE)�j�J)�STRINGS�	OPERATORSr!�UNARY�AUGMENTEDASSIGNMENT�BITWISE�COMPLEXzOPERATORS FORMATTING�POWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTS�ELLIPSISzSLICINGS DICTIONARYLITERALSz	def classrM�PRIVATENAMESzPRIVATENAMES SPECIALMETHODSZ
BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)r@r?�,rr2�:�@r�r_r^�`r&r5�[�]r�)�typeszRSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect)�stringsz4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES)zstring-methodszSTRINGS FORMATTING)Z
formatstringsrN)r]z:encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPES)ZnumberszINTEGER FLOAT COMPLEX TYPES)Zintegersz	int range)Zfloatingz
float math)Z	imaginaryz
complex cmath)Ztypesseqz$STRINGMETHODS FORMATTING range LISTS�DICTIONARIES)Ztypesfunctionsz	def TYPES)Ztypesmethodszclass def CLASSES TYPES)zbltin-code-objectszcompile FUNCTIONS TYPES)zbltin-type-objectsztypes TYPES�TYPES)zbltin-null-objectr)zbltin-ellipsis-object�SLICINGS)Zspecialattrsr)r\z!class SPECIALMETHODS PRIVATENAMES)Ztypesmodulesr)zoperator-summaryz�lambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIES�EXPRESSIONS)Zobjectsr_)ZspecialnameszbBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES)Z
customizationzhash repr str SPECIALMETHODS)zattribute-accesszATTRIBUTES SPECIALMETHODS)zcallable-typeszCALLS SPECIALMETHODS)�sequence-typesz(SEQUENCES SEQUENCEMETHODS SPECIALMETHODS)rbzMAPPINGS SPECIALMETHODS)z
numeric-typesz*NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS)Z	execmodelz%NAMESPACES DYNAMICFEATURES EXCEPTIONS)Znamingz3global nonlocal ASSIGNMENT DELETION DYNAMICFEATURES)zdynamic-featuresr�
NAMESPACES)r�ztry except finally raise)Zconversionsr)Zidentifierszkeywords SPECIALIDENTIFIERS)z
id-classesr)zatom-identifiersr)z
atom-literalsz=STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS�	SEQUENCES)Z	exprlistszTUPLES LITERALS)ztypesseq-mutable�LISTLITERALS)ZlistszLISTS LITERALS)Ztypesmapping�DICTIONARYLITERALS)rzDICTIONARIES LITERALS)zattribute-referencesz(getattr hasattr setattr ATTRIBUTEMETHODS)Z
subscriptionsr )Zslicingsr )Zcallsra)Zpowerra)Zunaryra)Zbinaryra)Zshiftingra)Zbitwisera)ZcomparisonszEXPRESSIONS BASICMETHODS)ZbooleanszEXPRESSIONS TRUTHVALUEr)Z
assignmentrP)Z	augassign�
NUMBERMETHODSrr')Zcompoundzfor while break continue)�truthz if while and or not BASICMETHODS)ZdebuggerZpdb)zcontext-managersr
)Ir_rMZ
STRINGMETHODSZ
FORMATTING�UNICODEZNUMBERSZINTEGERZFLOATrRrdZMAPPINGSr�ZMETHODSZCODEOBJECTSZTYPEOBJECTSZFRAMEOBJECTSZ
TRACEBACKSZNONErTZSPECIALATTRIBUTESr�rZPACKAGESrarNZ
PRECEDENCEZOBJECTSZSPECIALMETHODSrZATTRIBUTEMETHODSZCALLABLEMETHODSr ZMAPPINGMETHODSrgZ	EXECUTIONrcZDYNAMICFEATURESZSCOPINGZFRAMESr&ZCONVERSIONSZIDENTIFIERSZSPECIALIDENTIFIERSrUZLITERALSZTUPLESZ
TUPLELITERALSZLISTSrer^rfZ
ATTRIBUTESZ
SUBSCRIPTSr`ZCALLSrSrOZBINARYZSHIFTINGrQr!rZ	ASSERTIONZ
ASSIGNMENTrPZDELETIONZ	RETURNINGZ	IMPORTINGZCONDITIONALZLOOPINGrZ	DEBUGGINGZCONTEXTMANAGERSNcCs||_||_dSr�)�_input�_output)r>�inputrrrrr�^szHelper.__init__cCs|jp
tjSr�)rjrr�r�rrrrlbszHelper.inputcCs|jp
tjSr�)rkrr�r�rrrrfsz
Helper.outputcCs2t��dddkr|�dSd|jj|jjfS)Nrr1�?rz<%s.%s instance>)r�stackr�r&rSr�rrr�__repr__js�zHelper.__repr__cCs6||jk	r|�|�n|��|��|j�d�dS)Na
You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type "help(object)".  Executing "help('string')"
has the same effect as typing a particular string at the help> prompt.
)�_GoInteractiver�intro�interactrr��r>Zrequestrrr�__call__rs

zHelper.__call__c	Cs�|j�d�z|�d�}|s Wq�Wnttfk
r>Yq�YnX|��}t|�dkr�|d|dkrpdkr�nn |d|dd�kr�|dd�}|��dkr�q�|d	kr�|��q|�	|�qdS)
Nrzhelp> rrr�r7r)r��quitr)
rr��getliner��EOFErrorrr r�rqrrsrrrrrs"

,�
zHelper.interactcCs8|jtjkrt|�S|j�|�|j��|j��SdS)z.Read one line, using input() when appropriate.N)rlrr�rr�r�r�)r>�promptrrrrv�s

zHelper.getlinecCs<t|�td�k�r|��}|dkr,|��n�|dkr>|��n�|dkrP|��n�|dkrb|��n�|dd�dkr�|�|��d�n�||jkr�|�|�nj|d	kr�t	t
|�d
�nR||jkr�|�|�n<||j
kr�|�|�n&|r�t	|d
|jd�nt	td
|jd�n$t|t��r|�nt	|d
|jd�|j�d�dS)
Nr�keywords�symbols�topicsr��zmodules r)r,r*r+zHelp on %s:)rr)r�r�listkeywords�listsymbols�
listtopics�listmodulesrrz�
showsymbolr"�evalry�	showtopicr{rkrJrkrrr�rsrrrr�s6






zHelper.helpcCs$|j�d�dtjdd���dS)Na�
Welcome to Python {0}'s help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/{0}/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".
z%d.%dr)rr�rrr�r�rrrrq�s
�zHelper.intror��Pc	
Cs�tt|��}||}t|�|d|}t|�D]v}t|�D]\}|||}|t|�kr<|j�||�||dkr<|j�dd|dt||��q<|j�d�q0dS)Nrr�r)rr�r rrr�)	r>�items�columnsr
Zcolwr�rowrrrrrrr�s&zHelper.listcCs |j�d�|�|j���dS)NzN
Here is a list of the Python keywords.  Enter any keyword to get more help.

)rr�rryrEr�rrrr}�szHelper.listkeywordscCs |j�d�|�|j���dS)Nzx
Here is a list of the punctuation symbols which Python assigns special meaning
to. Enter any symbol to get more help.

)rr�rrzrEr�rrrr~�szHelper.listsymbolscCs |j�d�|�|j���dS)NzN
Here is a list of available topics.  Enter any topic name to get more help.

)rr�rr{rEr�rrrr�szHelper.listtopicscCs0zddl}Wn"tk
r.|j�d�YdSX|j�||j�|��}|sb|j�dt|��dSt|�td�kr~|�	||�S|\}}z|jj|}Wn*t
k
r�|j�dt|��YdSX|��d}|r�|p�dd|}|�r$ddl}dd�
|���d}	|�|	d	�}
|d
d�
|
�7}t|�dS)Nr�t
Sorry, topic and keyword documentation is not available because the
module "pydoc_data.topics" could not be found.
zno documentation found for %s
rrr��Related help topics: r4�Hz
%s
)�pydoc_data.topicsr�rr�r{rvryr�r�r��KeyErrorr�textwrapr!rZwrapr�)r>�topic�
more_xrefs�
pydoc_data�target�label�xrefsr"r�r/Zwrapped_textrrrr��s4zHelper.showtopiccCs�zddl}Wntk
r"YdSX|j�||j�|��}|sFtd��t|t�r\|�||�S|\}}|jj|}|r�|pzdd|}||fS)a*Return unbuffered tuple of (topic, xrefs).

        If an error occurs here, the exception is caught and displayed by
        the url handler.

        This function duplicates the showtopic method but returns its
        result directly so it can be formatted for display in an html page.
        rN)r�rzcould not find topicrr�)	r�r�r{rvryr�rkrJ�	_gettopic)r>r�r�r�r�r�r�r"rrrr�s	
zHelper._gettopiccCs*|j|}|�d�\}}}|�||�dS)Nr�)rz�	partitionr�)r>�symbolr�r�r_r�rrrr�!s
zHelper.showsymbolcsv|r |j�d�|��t|�nR|j�d�i}|fdd���fdd�}t�j�|d�|�|���|j�d�dS)	Nzy
Here is a list of modules whose name or summary contains '{}'.
If there are any, enter a module name to get more help.

zI
Please wait a moment while I gather a list of all available modules...

cSs>|r$|dd�dkr$|dd�d}|�d�dkr:d||<dS)N����	.__init__r�rrr)�find)rr'r�r�rrr�callback4sz$Helper.listmodules.<locals>.callbackcs�d|d�dSr�rr��r�rr�onerror9sz#Helper.listmodules.<locals>.onerror�r�z�
Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".
)rr�r�apropos�
ModuleScanner�runrrE)r>rHr�r�rr�rr�&s
�
zHelper.listmodules)r8r<r%r�)NN)r�r�)r)r)r)!r%r&rSryZ_strprefixesZ_symbols_inverserzr�r�Zsymbols_r�rvr{r�rlrlrrorrprtrrrvrrqrr}r~rr�r�r�r�rrrrr�sB�'���W



	


 
rc@seZdZdZddd�ZdS)r�z7An interruptible scanner that searches module synopses.Nc	Cs
|r|��}d|_i}tjD]p}|dkrd||<|dkrF|d|d�qt|�jpRd}|�d�d}|d|}|���|�dkr|d||�qtj	|d�D�]\\}	}}
|jr��q�|dkr�|d|d�q�zt�
|	|�}Wntk
r�Yq�YnX|j}t
|d	��rnz|�|�}
Wn(tk
�r:|�r2||�Yq�YnXtt�|
���pNd}t
|d
��rh|�|�}nd}n`ztj�|�}Wn(tk
�r�|�r�||�Yq�YnX|j�r�|j��dnd}t|dd�}|d|}|���|�dkr�||||�q�|�r|�dS)NF�__main__rrrrr�r��
get_source�get_filenamerY)r�rurr�r�rVrr�rNr�	_get_specr�r�rcr�rcr�r��StringIOr�r�r�r�r�r�r<)r>r�rHZ	completerr��seenr'r(r�rXrYr�r��sourcerr�rrrr�Gs`



zModuleScanner.run)NNN)r%r&rSrVr�rrrrr�Dsr�c	CsDdd�}dd�}t���"t�d�t�j|||d�W5QRXdS)zAPrint all the one-line module summaries that contain a substring.cSs6|dd�dkr |dd�d}t||o.d|�dS�Nr�r�r�z- )r�rr'r�rrrr��szapropos.<locals>.callbackcSsdSr�rr�rrrr��szapropos.<locals>.onerror�ignorer�N)�warnings�catch_warnings�filterwarningsr�r�)rHr�r�rrrr��s


r�cs�ddl�ddl�ddl�ddl�Gdd�d�jj��G�fdd�d�jj��G�����fdd�d�j�}||||�}|��|j	s�|j
s�t�d	�q~|S)
aAStart an HTTP server thread on a specific port.

    Start an HTML/text server thread, so HTML or text documents can be
    browsed dynamically and interactively with a Web browser.  Example use:

        >>> import time
        >>> import pydoc

        Define a URL handler.  To determine what the client is asking
        for, check the URL and content_type.

        Then get or generate some text or HTML code and return it.

        >>> def my_url_handler(url, content_type):
        ...     text = 'the URL sent was: (%s, %s)' % (url, content_type)
        ...     return text

        Start server thread on port 0.
        If you use port 0, the server will pick a random port number.
        You can then use serverthread.port to get the port number.

        >>> port = 0
        >>> serverthread = pydoc._start_server(my_url_handler, port)

        Check that the server is really started.  If it is, open browser
        and get first page.  Use serverthread.url as the starting page.

        >>> if serverthread.serving:
        ...    import webbrowser

        The next two lines are commented out so a browser doesn't open if
        doctest is run on this module.

        #...    webbrowser.open(serverthread.url)
        #True

        Let the server do its thing. We just need to monitor its status.
        Use time.sleep so the loop doesn't hog the CPU.

        >>> starttime = time.monotonic()
        >>> timeout = 1                    #seconds

        This is a short timeout for testing purposes.

        >>> while serverthread.serving:
        ...     time.sleep(.01)
        ...     if serverthread.serving and time.monotonic() - starttime > timeout:
        ...          serverthread.stop()
        ...          break

        Print any errors that may have occurred.

        >>> print(serverthread.error)
        None
   rNc@seZdZdd�Zdd�ZdS)z!_start_server.<locals>.DocHandlercSsX|j�d�rd}nd}|�d�|�dd|�|��|j�|�|j|��d��dS)	z�Process a request from an HTML browser.

            The URL received is in self.path.
            Get an HTML page from self.urlhandler and send it.
            z.css�text/css�	text/html��zContent-Typez%s; charset=UTF-8r�N)	rrbZ
send_responseZsend_headerZend_headersZwfiler��
urlhandlerr�)r>�content_typerrr�do_GET�s

��z(_start_server.<locals>.DocHandler.do_GETcWsdSr�r)r>r�rrr�log_message�sz-_start_server.<locals>.DocHandler.log_messageN)r%r&rSr�r�rrrr�
DocHandler�sr�cs(eZdZdd�Z�fdd�Zdd�ZdS)z _start_server.<locals>.DocServercSs6||_|j|f|_||_|j�||j|j�d|_dS�NF)�hostZaddressr�rJr��handlerru)r>r��portr�rrrr��s
z)_start_server.<locals>.DocServer.__init__cs>|js2��|j��gggd�\}}}|r|��q|��dSr@)ru�selectZsocketr�Zhandle_requestZserver_close)r>ZrdZwrZex�r�rr�serve_until_quit�s

z1_start_server.<locals>.DocServer.serve_until_quitcSs |j�|�|jr|�|�dSr�)rJ�server_activater�r�rrrr��sz0_start_server.<locals>.DocServer.server_activateN)r%r&rSr�r�r�rr�rr�	DocServer�sr�cs:eZdZ�fdd�Z����fdd�Zdd�Zdd�Zd	S)
z#_start_server.<locals>.ServerThreadcs2||_||_t|�|_�j�|�d|_d|_dSr�)r�r�r+r��Threadr��serving�error)r>r�r�r�)�	threadingrrr��s
z,_start_server.<locals>.ServerThread.__init__c
sxzJ�jj�_��_�jj�_t|j��_�|j	|j
|j�}||_|�
�Wn(tk
rr}z
||_W5d}~XYnXdS)zStart the server.N)�server�
HTTPServerrJr�r�ZMessageZMessageClass�staticmethodr�r�r��ready�	docserverr�rcr�)r>Zdocsvr�e)r�r��email�httprrr�	s

z'_start_server.<locals>.ServerThread.runcSs,d|_|j|_|j|_d|j|jf|_dS)NTz
http://%s:%d/)r�r�Zserver_portr�r")r>r�rrrr�	sz)_start_server.<locals>.ServerThread.readycSs&d|j_|��d|_d|_d|_dS)z&Stop the server and this thread nicelyTNF)r�rur!r�r"r�rrr�stop	s
z(_start_server.<locals>.ServerThread.stopN)r%r&rSr�r�r�r�r)r�r�r�r�r�rr�ServerThread�s
r�g{�G�z�?)
Zhttp.serverZ
email.messager�r�r�ZBaseHTTPRequestHandlerr�r�r1r�r��time�sleep)r��hostnamer�r��threadr)r�r�r�r�r�r�r�
_start_server�s8'r�r�c
s(G�fdd�dt�}|���fdd���fdd���fdd���fd	d
���fdd���fd
d���fdd���fdd����������fdd�}|�d�r�|dd�}|dk�rtj�tj�t��}tj�||�}t|��}d�|�	��W5QR�SQRXn|dk�r||�St
d||f��dS)aThe pydoc url handler for use with the pydoc server.

    If the content_type is 'text/css', the _pydoc.css style
    sheet is read and returned if it exits.

    If the content_type is 'text/html', then the result of
    get_html_page(url) is returned.
    cseZdZ�fdd�ZdS)z_url_handler.<locals>._HTMLDoccsd}d|}d||��|fS)rzpydoc_data/_pydoc.cssz1<link rel="stylesheet" type="text/css" href="%s">a<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Pydoc: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
%s</head><body bgcolor="#f0f0f8">%s<div style="clear:both;padding-top:.5em;">%s</div>
</body></html>r)r>rr�css_pathZcss_link��html_navbarrrr2	s���z#_url_handler.<locals>._HTMLDoc.pageN)r%r&rSrrr�rr�_HTMLDoc0	sr�cs>��dt��t��dt��f�}d|��tjdd��fS)Nz%s [%s, %s]raZ
            <div style='float:left'>
                Python %s<br>%s
            </div>
            <div style='float:right'>
                <div style='text-align:center'>
                  <a href="index.html">Module Index</a>
                  : <a href="topics.html">Topics</a>
                  : <a href="keywords.html">Keywords</a>
                </div>
                <div>
                    <form action="get" style='display:inline;'>
                      <input type=text name=key size=15>
                      <input type=submit value="Get">
                    </form>&nbsp;
                    <form action="search" style='display:inline;'>
                      <input type=text name=key size=15>
                      <input type=submit value="Search">
                    </form>
                </div>
            </div>
            T)Zterse)r�r�Zpython_versionZpython_buildZpython_compiler)rU�rrrr�B	s
��z!_url_handler.<locals>.html_navbarcs�dd�}��ddd�}dd�tjD�}��||�}|d��d	dd
|�g}i}tjD]}|���||��qT|�d�dd
�|�fS)zModule Index page.cSsd||fS�Nrr�r(rrr�	bltinlink`	sz3_url_handler.<locals>.html_index.<locals>.bltinlinkz7<big><big><strong>Index of Modules</strong></big></big>rArBcSsg|]}|dkr|�qS)r�r)rqr(rrrr�f	s�z4_url_handler.<locals>.html_index.<locals>.<listcomp>z<p>zBuilt-in ModulesrFz|<p align=right><font color="#909090" face="helvetica,arial"><strong>pydoc</strong> by Ka-Ping Yee&lt;ping@lfw.org&gt;</font>zIndex of Modulesr)	rrr�rrrr
r�r!)r�r�namesrr�rr�rr�
html_index]	s*��
�z _url_handler.<locals>.html_indexc		s�g��fdd�}t���*t�d�dd�}t�j|||d�W5QRXdd�}g}��d	d
d�}�D]\}}|�||�|�qf|��d|d
d
d�|��}d|fS)zSearch results page.cs:|dd�dkr |dd�d}��||o0d|f�dSr�rKr��Z
search_resultrrr�{	sz3_url_handler.<locals>.html_search.<locals>.callbackr�cSsdSr�rr�rrrr��	sz2_url_handler.<locals>.html_search.<locals>.onerrorr�cSsd||fSr�rr�rrrr��	sz4_url_handler.<locals>.html_search.<locals>.bltinlinkz5<big><big><strong>Search Results</strong></big></big>rArBzkey = %srF�<br>zSearch Results)	r�r�r�r�r�rr
rr!)	rHr�r�r�rnrr(r�rr�r�r�html_searchv	s,

��z!_url_handler.<locals>.html_searchcsLdd�}��ddd�}ttj���}��||�}|��ddd|�}d|fS)zIndex of topic texts available.cSsd||fS�Nz<a href="topic?key=%s">%s</a>rr�rrrr��	sz4_url_handler.<locals>.html_topics.<locals>.bltinlink�,<big><big><strong>INDEX</strong></big></big>rArBZTopicsrF)rr�rr{rErr)r�rr�rr�rr�html_topics�	s��z!_url_handler.<locals>.html_topicscsL��ddd�}ttj���}dd�}��||�}|��ddd|�}d|fS)zIndex of keywords.r�rArBcSsd||fSr�rr�rrrr��	sz6_url_handler.<locals>.html_keywords.<locals>.bltinlinkZKeywordsrF)rr�rryrErr)rr�r�rr�rr�
html_keywords�	s��z#_url_handler.<locals>.html_keywordscs�t��}t||�}|�|�\}}||jkr0d}nd}��d|dd�}d��|�}��|dd|�}|r�t|�	��}dd	�}��
||�}��d
dd|�}d||fd�|||f�fS)
zTopic or keyword help page.ZKEYWORDZTOPICr=rArBz
<pre>%s</pre>rFcSsd||fSr�rr�rrrr��	sz7_url_handler.<locals>.html_topicpage.<locals>.bltinlinkr�z%s %sr)
r�r�rr�ryrr3rr�rrrr!)r�ZbufZhtmlhelprr�rrr�r�rr�html_topicpage�	s2

��
�z$_url_handler.<locals>.html_topicpagecs@t|dd�}|dkr$|dkr$td��t|�}��||�}||fS)Nr)r�r+zcould not find object)r�r�r�r�)r"rer�contentr�rr�html_getobj�	sz!_url_handler.<locals>.html_getobjcsP��ddd�}d��fdd�tt|�|�D��}|��|dd|�}d||fS)	Nz,<big><big><strong>Error</strong></big></big>rArBr�c3s|]}��|�VqdSr�)r�r�r�rrr��	sz3_url_handler.<locals>.html_error.<locals>.<genexpr>z#bb0000z
Error - %s)rr!rr�r)r"r�rrr�rr�
html_error�	s���z _url_handler.<locals>.html_errorc
sr|}|�d�r|dd�}�z|dkr2��\}}n�|dkrF��\}}n�|dkrZ��\}}n�d|k�r$|�d�\}}}|dkr��|�\}}n�|d	kr�z�|�\}}Wn tk
r��|�\}}YnXn\|d
k�r|dkr��\}}n4z�|�\}}Wn"tk
�r�|�\}}YnXntd��n�|�\}}Wn2tk
�rd}z�||�\}}W5d}~XYnX��||�S)zGenerate an HTML page for url.r�N���)rr�r{ryr�z
search?keyz	topic?keyzget?keyz
bad pydoc url)rbr�r�rcr)r"Zcomplete_urlrr��opr_r�)rr�r�r�r�r�r�r�rr�
get_html_page�	s>



 z#_url_handler.<locals>.get_html_pager�rNr�rr�z"unknown content type %r for url %s)rrar	r�dirname�realpathrYr!r��	readlinesr})r"r�r�r�Z	path_herer��fpr)	rr�r�r�r�r�r�r�r�r�_url_handler'	s*	
(


"
r�T�	localhost)�open_browserr�c	Cs�ddl}tt||�}|jr(t|j�dS|jr�d}|rB|�|j�z~zZtd|j�t|�|jr�t	d�}|�
�}|dkr|q�qZ|dkr�|�|j�qZt|�qZWnttfk
r�t�YnXW5|jr�|��td�XdS)	z�Start the enhanced pydoc Web server and open a Web browser.

    Use port '0' to start the server on an arbitrary port.
    Set open_browser to False to suppress opening a browser.
    rNz"Server commands: [b]rowser, [q]uitzServer stoppedzServer ready atzserver> r�r�)
�
webbrowserr�r�r�rr�r�r"r�rlr�r�rw)r�r�r�r�ZserverthreadZserver_help_msgr�rrr�browse
s2
r�cCst|t�o|�tj�dkSru)rkrJr�r	�sep)rNrrr�ispath9
sr�cCsvd|kstj|kst��|kr"dStj�t�}tj�|�}|��}||krbtj�||�sb|�|�|�	dt���|S)z�Ensures current directory is on returned path, and argv0 directory is not

    Exception: argv0 dir is left alone if it's also pydoc's directory.

    Returns a new path entry list, or None if no adjustment is needed.
    rNr)
r	�curdir�getcwdrr�rY�copy�samefile�remove�insert)Z
given_pathZargv0Z
stdlib_dirZ
script_dir�revised_pathrrr�_get_revised_path<
s

r�cCs,ttjtjd�}|dk	r(|tjdd�<dS)z�Ensures current directory is on sys.path, and __main__ directory is not.

    Exception: __main__ dir is left alone if it's also pydoc's directory.
    rN)r�rr�argv)r�rrr�_adjust_cli_sys_pathX
sr�cCs�ddl}Gdd�dt�}t��zv|�tjdd�d�\}}d}d}d}d}d}|D]\\}	}
|	d	krld
}d
}|	dkr�t|
�WdS|	dkr�d
}|
}|	d
kr�d
}|	dkrTd
}|
}qT|r�t|||d�WdS|s�|�|D]�}t|��rtj	�
|��std|��q�z`t|��r&tj	�|��r&t
|�}|�rXt|��rNtj	�|��rNt|�nt|�n
t�|�Wq�tk
�r�}zt|�W5d}~XYq�Xq�WnN|j|fk
�r�tj	�tj	�tjd��d}
tdj|
tjd��YnXdS)z@Command-line interface (looks at sys.argv to decide what to do).rNc@seZdZdS)zcli.<locals>.BadUsageN)r%r&rSrrrr�BadUsagee
sr�rzbk:n:p:wFr�z-bTz-kz-pz-wz-n)r�r�zfile %r does not exista�pydoc - the Python documentation tool

{cmd} <name> ...
    Show text documentation on something.  <name> may be the name of a
    Python keyword, topic, function, module, or package, or a dotted
    reference to a class or function within a module or module in a
    package.  If <name> contains a '{sep}', it is used as the path to a
    Python source file to document. If name is 'keywords', 'topics',
    or 'modules', a listing of these things is displayed.

{cmd} -k <keyword>
    Search for a keyword in the synopsis lines of all available modules.

{cmd} -n <hostname>
    Start an HTTP server with the given hostname (default: localhost).

{cmd} -p <port>
    Start an HTTP server on the given port on the local machine.  Port
    number 0 can be used to get an arbitrary unused port.

{cmd} -b
    Start an HTTP server on an arbitrary unused port and open a Web browser
    to interactively browse documentation.  This option can be used in
    combination with -n and/or -p.

{cmd} -w <name> ...
    Write out the HTML documentation for a module to a file in the current
    directory.  If <name> contains a '{sep}', it is treated as a filename; if
    it names a directory, documentation is written for all the contents.
)r�r�)�getoptrcr�rr�r�r�r�r	r�existsrr�r�rr
rrr�r�r�r�rr�)rr�Zoptsr�ZwritingZstart_serverr�r�r��opt�val�argrIr�rrr�clib
sd

 �rr�)NN)r)r)rrN)rrN)r)rN)r�)r)ZrVrGrWrQrUr�Zimportlib._bootstrapr�Zimportlib._bootstrap_external�importlib.machinery�importlib.utilrr�r	rNr�rrr�r�r�Zurllib.parserHr��collectionsr�reprlibr�	tracebackrrrr$r)r.r0r5r'�
IGNORECASEr6r8r?rDrOrfrir�r�r�r�rcr�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r/rrr�rr"rr
rrr�r�r�r�r�r�r�r�rr%rrrr�<module>s�&
	


'
0:*> ",

�
�


=
n%
U
_weakrefset.cpython-38.opt-1.pyc000064400000016662150335716500012452 0ustar00U

e5dg�@s2ddlmZdgZGdd�d�ZGdd�d�ZdS)���ref�WeakSetc@s$eZdZdd�Zdd�Zdd�ZdS)�_IterationGuardcCst|�|_dS�N)r�
weakcontainer)�selfr�r	�#/usr/lib64/python3.8/_weakrefset.py�__init__sz_IterationGuard.__init__cCs |��}|dk	r|j�|�|Sr)r�
_iterating�add)r�wr	r	r
�	__enter__sz_IterationGuard.__enter__cCs0|��}|dk	r,|j}|�|�|s,|��dSr)rr�remove�_commit_removals)r�e�t�br�sr	r	r
�__exit__s
z_IterationGuard.__exit__N)�__name__�
__module__�__qualname__rrrr	r	r	r
r
src@seZdZd@dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZeZd d!�Zd"d#�Zd$d%�ZeZd&d'�Zd(d)�Zd*d+�ZeZd,d-�Zd.d/�ZeZd0d1�Zd2d3�Zd4d5�Z e Z!d6d7�Z"d8d9�Z#d:d;�Z$e$Z%d<d=�Z&d>d?�Z'dS)ArNcCsBt�|_t|�fdd�}||_g|_t�|_|dk	r>|�|�dS)NcSs2|�}|dk	r.|jr"|j�|�n|j�|�dSr)r�_pending_removals�append�data�discard)�itemZselfrefrr	r	r
�_remove&s
z!WeakSet.__init__.<locals>._remove)�setrrrrr�update)rrrr	r	r
r$szWeakSet.__init__cCs$|j}|jj}|r ||���qdSr)rrr�pop)r�lrr	r	r
r4szWeakSet._commit_removalsc	cs8t|��&|jD]}|�}|dk	r|VqW5QRXdSr)rr�rZitemrefrr	r	r
�__iter__:s


zWeakSet.__iter__cCst|j�t|j�Sr)�lenrr�rr	r	r
�__len__CszWeakSet.__len__cCs.zt|�}Wntk
r"YdSX||jkS)NF)r�	TypeErrorr)rrZwrr	r	r
�__contains__Fs
zWeakSet.__contains__cCs|jt|�ft|dd�fS)N�__dict__)�	__class__�list�getattrr'r	r	r
�
__reduce__Ms
�zWeakSet.__reduce__cCs&|jr|��|j�t||j��dSr)rrrr
rr�rrr	r	r
r
QszWeakSet.addcCs|jr|��|j��dSr)rrr�clearr'r	r	r
r1Vsz
WeakSet.clearcCs
|�|�Sr�r,r'r	r	r
�copy[szWeakSet.copycCsT|jr|��z|j��}Wntk
r:td�d�YnX|�}|dk	r|SqdS)Nzpop from empty WeakSet)rrrr"�KeyErrorr$r	r	r
r"^szWeakSet.popcCs"|jr|��|j�t|��dSr)rrrrrr0r	r	r
rjszWeakSet.removecCs"|jr|��|j�t|��dSr)rrrrrr0r	r	r
roszWeakSet.discardcCs&|jr|��|D]}|�|�qdSr)rrr
)r�otherZelementr	r	r
r!tszWeakSet.updatecCs|�|�|Sr)r!�rr5r	r	r
�__ior__zs
zWeakSet.__ior__cCs|��}|�|�|Sr)r3�difference_update�rr5Znewsetr	r	r
�
difference~s
zWeakSet.differencecCs|�|�dSr)�__isub__r6r	r	r
r8�szWeakSet.difference_updatecCs<|jr|��||kr"|j��n|j�dd�|D��|S)Ncss|]}t|�VqdSrr��.0rr	r	r
�	<genexpr>�sz#WeakSet.__isub__.<locals>.<genexpr>)rrrr1r8r6r	r	r
r;�szWeakSet.__isub__cs���fdd�|D��S)Nc3s|]}|�kr|VqdSrr	r<r'r	r
r>�sz'WeakSet.intersection.<locals>.<genexpr>r2r6r	r'r
�intersection�szWeakSet.intersectioncCs|�|�dSr)�__iand__r6r	r	r
�intersection_update�szWeakSet.intersection_updatecCs(|jr|��|j�dd�|D��|S)Ncss|]}t|�VqdSrrr<r	r	r
r>�sz#WeakSet.__iand__.<locals>.<genexpr>)rrrrAr6r	r	r
r@�szWeakSet.__iand__cCs|j�dd�|D��S)Ncss|]}t|�VqdSrrr<r	r	r
r>�sz#WeakSet.issubset.<locals>.<genexpr>)r�issubsetr6r	r	r
rB�szWeakSet.issubsetcCs|jttt|��kSr�rr �maprr6r	r	r
�__lt__�szWeakSet.__lt__cCs|j�dd�|D��S)Ncss|]}t|�VqdSrrr<r	r	r
r>�sz%WeakSet.issuperset.<locals>.<genexpr>)r�
issupersetr6r	r	r
rF�szWeakSet.issupersetcCs|jttt|��kSrrCr6r	r	r
�__gt__�szWeakSet.__gt__cCs$t||j�stS|jttt|��kSr)�
isinstancer,�NotImplementedrr rDrr6r	r	r
�__eq__�szWeakSet.__eq__cCs|��}|�|�|Sr)r3�symmetric_difference_updater9r	r	r
�symmetric_difference�s
zWeakSet.symmetric_differencecCs|�|�dSr)�__ixor__r6r	r	r
rK�sz#WeakSet.symmetric_difference_updatecs@�jr����|kr"�j��n�j��fdd�|D���S)Nc3s|]}t|�j�VqdSr)rrr<r'r	r
r>�sz#WeakSet.__ixor__.<locals>.<genexpr>)rrrr1rKr6r	r'r
rM�szWeakSet.__ixor__cCs|�dd�||fD��S)Ncss|]}|D]
}|Vq
qdSrr	)r=rrr	r	r
r>�sz WeakSet.union.<locals>.<genexpr>r2r6r	r	r
�union�sz
WeakSet.unioncCst|�|��dkS)Nr)r&r?r6r	r	r
�
isdisjoint�szWeakSet.isdisjointcCs
t|j�Sr)�reprrr'r	r	r
�__repr__�szWeakSet.__repr__)N)(rrrrrr%r(r*r/r
r1r3r"rrr!r7r:�__sub__r8r;r?�__and__rAr@rB�__le__rErF�__ge__rGrJrL�__xor__rKrMrN�__or__rOrQr	r	r	r
r#sJ
			N)�_weakrefr�__all__rrr	r	r	r
�<module>ssymtable.cpython-38.opt-1.pyc000064400000025736150335716500011775 0ustar00U

e5dU�	@sJdZddlZddlmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZddlZdddddgZd	d�ZGd
d�d�Ze�ZGdd�d�ZGd
d�de�ZGdd�de�ZGdd�d�Zedk�rFddlZddlZeejd��Ze� �Z!W5QRXee!ej"�#ejd�dd�Z$e$�%�D]$Z&e$�'e&�Z(e)e(e(�*�e(�+���q dS)z2Interface to the compiler's internal symbol tables�N)�USE�
DEF_GLOBAL�DEF_NONLOCAL�	DEF_LOCAL�	DEF_PARAM�
DEF_IMPORT�	DEF_BOUND�	DEF_ANNOT�	SCOPE_OFF�
SCOPE_MASK�FREE�LOCAL�GLOBAL_IMPLICIT�GLOBAL_EXPLICIT�CELL�symtable�SymbolTable�Class�Function�SymbolcCst�|||�}t||�S�N)�	_symtabler�_newSymbolTable)�code�filenameZcompile_type�top�r� /usr/lib64/python3.8/symtable.pyrsc@s$eZdZdd�Zdd�Zdd�ZdS)�SymbolTableFactorycCst��|_dSr)�weakrefZWeakValueDictionary�_SymbolTableFactory__memo��selfrrr�__init__szSymbolTableFactory.__init__cCs6|jtjkrt||�S|jtjkr,t||�St||�Sr)�typer�
TYPE_FUNCTIONr�
TYPE_CLASSrr)r"�tablerrrr�news


zSymbolTableFactory.newcCs8||f}|j�|d�}|dkr4|�||�}|j|<|Sr)r �getr()r"r'r�key�objrrr�__call__s
zSymbolTableFactory.__call__N)�__name__�
__module__�__qualname__r#r(r,rrrrrsrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS) rcCs||_||_i|_dSr)�_table�	_filename�_symbols)r"Z	raw_tablerrrrr#'szSymbolTable.__init__cCsN|jtkrd}nd|jj}|jjdkr6d�||j�Sd�||jj|j�SdS)N�z%s rz<{0}SymbolTable for module {1}>z<{0}SymbolTable for {1} in {2}>)�	__class__rr-r0�name�formatr1)r"Zkindrrr�__repr__,s
�zSymbolTable.__repr__cCs:|jjtjkrdS|jjtjkr$dS|jjtjkr6dSdS)N�moduleZfunction�class)r0r$rZTYPE_MODULEr%r&r!rrr�get_type9szSymbolTable.get_typecCs|jjSr)r0�idr!rrr�get_idCszSymbolTable.get_idcCs|jjSr)r0r5r!rrr�get_nameFszSymbolTable.get_namecCs|jjSr)r0�linenor!rrr�
get_linenoIszSymbolTable.get_linenocCst|jjtjk�Sr)�boolr0r$rr%r!rrr�is_optimizedLszSymbolTable.is_optimizedcCst|jj�Sr)r@r0�nestedr!rrr�	is_nestedOszSymbolTable.is_nestedcCst|jj�Sr)r@r0�childrenr!rrr�has_childrenRszSymbolTable.has_childrencCsdS)z7Return true if the scope uses exec.  Deprecated method.Frr!rrr�has_execUszSymbolTable.has_execcCs|jj��Sr)r0�symbols�keysr!rrr�get_identifiersYszSymbolTable.get_identifierscCsT|j�|�}|dkrP|jj|}|�|�}|jjdk}t||||d�}|j|<|S)Nr��module_scope)r2r)r0rG�_SymbolTable__check_childrenr5r)r"r5Zsym�flags�
namespacesrKrrr�lookup\s
�zSymbolTable.lookupcs�fdd����D�S)Ncsg|]}��|��qSr)rO��.0�identr!rr�
<listcomp>gsz+SymbolTable.get_symbols.<locals>.<listcomp>)rIr!rr!r�get_symbolsfszSymbolTable.get_symbolscs��fdd��jjD�S)Ncs"g|]}|j�krt|�j��qSr)r5rr1�rQ�st�r5r"rrrSjs
�z0SymbolTable.__check_children.<locals>.<listcomp>�r0rD)r"r5rrWrZ__check_childrenis�zSymbolTable.__check_childrencs�fdd��jjD�S)Ncsg|]}t|�j��qSr)rr1rUr!rrrSos�z,SymbolTable.get_children.<locals>.<listcomp>rXr!rr!r�get_childrenns
�zSymbolTable.get_childrenN)r-r.r/r#r7r:r<r=r?rArCrErFrIrOrTrLrYrrrrr%s


c@sPeZdZdZdZdZdZdZdd�Zdd�Z	dd�Z
dd	�Zd
d�Zdd
�Z
dS)rNcst��fdd����D��S)Nc3s"|]}��jj|�r|VqdSr)r0rGrP�r"Z	test_funcrr�	<genexpr>}s�z-Function.__idents_matching.<locals>.<genexpr>)�tuplerIrZrrZrZ__idents_matching|szFunction.__idents_matchingcCs |jdkr|�dd��|_|jS)NcSs|t@Sr)r��xrrr�<lambda>��z)Function.get_parameters.<locals>.<lambda>)�_Function__params�_Function__idents_matchingr!rrr�get_parameters�s
zFunction.get_parameterscs0|jdkr*ttf��fdd�}|�|�|_|jS)Ncs|t?t@�kSr�r
rr]�Zlocsrrr_�r`z%Function.get_locals.<locals>.<lambda>)�_Function__localsr
rrb�r"Ztestrrer�
get_locals�s

zFunction.get_localscs0|jdkr*ttf��fdd�}|�|�|_|jS)Ncs|t?t@�kSrrdr]�Zglobrrr_�r`z&Function.get_globals.<locals>.<lambda>)�_Function__globalsrrrbrgrrir�get_globals�s

zFunction.get_globalscCs |jdkr|�dd��|_|jS)NcSs|t@Sr)rr]rrrr_�r`z(Function.get_nonlocals.<locals>.<lambda>)�_Function__nonlocalsrbr!rrr�
get_nonlocals�s
zFunction.get_nonlocalscCs$|jdkrdd�}|�|�|_|jS)NcSs|t?t@tkSr)r
rrr]rrrr_�r`z$Function.get_frees.<locals>.<lambda>)�_Function__freesrb)r"�is_freerrr�	get_frees�s
zFunction.get_frees)r-r.r/rarfrnrjrlrbrcrhrkrmrprrrrrssc@seZdZdZdd�ZdS)rNcCs6|jdkr0i}|jjD]}d||j<qt|�|_|jS)N�)�_Class__methodsr0rDr5r\)r"�drVrrr�get_methods�s

zClass.get_methods)r-r.r/rrrtrrrrr�sc@s�eZdZd$dd�dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zd"d#�ZdS)%rNFrJcCs.||_||_|t?t@|_|p d|_||_dS)Nr)�
_Symbol__name�_Symbol__flagsr
r�_Symbol__scope�_Symbol__namespaces�_Symbol__module_scope)r"r5rMrNrKrrrr#�s

zSymbol.__init__cCsd�|j�S)Nz<symbol {0!r}>)r6rur!rrrr7�szSymbol.__repr__cCs|jSr)rur!rrrr=�szSymbol.get_namecCst|jtj@�Sr)r@rvrrr!rrr�
is_referenced�szSymbol.is_referencedcCst|jt@�Sr)r@rvrr!rrr�is_parameter�szSymbol.is_parametercCs"t|jttfkp|jo|jt@�S)z0Return *True* if the sysmbol is global.
        )r@rwrrryrvrr!rrr�	is_global�s�zSymbol.is_globalcCst|jt@�Sr)r@rvrr!rrr�is_nonlocal�szSymbol.is_nonlocalcCst|jtk�Sr)r@rwrr!rrr�is_declared_global�szSymbol.is_declared_globalcCs"t|jttfkp|jo|jt@�S)z.Return *True* if the symbol is local.
        )r@rwr
rryrvrr!rrr�is_local�s�zSymbol.is_localcCst|jt@�Sr)r@rvr	r!rrr�is_annotated�szSymbol.is_annotatedcCst|jtk�Sr)r@rwrr!rrrro�szSymbol.is_freecCst|jt@�Sr)r@rvrr!rrr�is_imported�szSymbol.is_importedcCst|jt@�Sr)r@rvrr!rrr�is_assigned�szSymbol.is_assignedcCs
t|j�S)a�Returns true if name binding introduces new namespace.

        If the name is used as the target of a function or class
        statement, this will be true.

        Note that a single name can be bound to multiple objects.  If
        is_namespace() is true, the name may also be bound to other
        objects, like an int or list, that does not introduce a new
        namespace.
        )r@rxr!rrr�is_namespace�szSymbol.is_namespacecCs|jS)z.Return a list of namespaces bound to this name)rxr!rrr�get_namespaces�szSymbol.get_namespacescCs t|j�dkrtd��|jdS)z�Returns the single namespace bound to this name.

        Raises ValueError if the name is bound to multiple namespaces.
        rqz$name is bound to multiple namespacesr)�lenrx�
ValueErrorr!rrr�
get_namespace�szSymbol.get_namespace)N)r-r.r/r#r7r=rzr{r|r}r~rr�ror�r�r�r�r�rrrrr�s 
�__main__rq�exec),�__doc__rrrrrrrrr	r
rrr
rrrr�__all__rrrrrrrr-�os�sys�open�argv�f�read�src�path�split�modrIrRrO�info�printrr�rrrr�<module>s&DN,
M

sysconfig.cpython-38.opt-2.pyc000064400000032237150335716500012154 0ustar00U

��.e@a�
@sddlZddlZddlmZmZddddddd	d
ddd
gZdhZddddddddd�ddddddddd�ddddddddd�d d d!d!d"d#d$d%�d&d&d'd(d)d*d$d%�d+d+d,d,d-d*d$d%�d.�Zd%Zej	�
�dZd/ejdd0�Z
d1ejdd0�Zej�ej�Zej�ej�Zej�ej�Zej�ej�ZdadZd2d3�Zej�rRej�eej��Znee���Zej d4k�r�e�!��"d5��r�eej�#eee��Zd6ej$k�r�eej$d6�Zd7d8�Z%e&ed9d�Z'ej d4k�r�d:d;�Z(e(e�Ze(e'�Z'did=d>�Z)e)d?�Z*e*�rd@D]Z+dAee+dB<dCee+dD<�q�dEdF�Z,dGdH�Z-dIdJ�Z.dKdL�Z/dMdN�Z0djdOdP�Z1dQd�Z2dRdS�Z3dTdU�Z4dVdW�Z5dXdY�Z6dkdZd
�Z7d[d�Z8d\d�Z9d]d�Z:e/�dd?fd^d	�Z;e/�dd?fd_d�Z<d`d�Z=dad�Z>dbd
�Z?dcd�Z@ddde�ZAdfdg�ZBeCdhk�r�eB�dS)l�N)�pardir�realpath�get_config_h_filename�get_config_var�get_config_vars�get_makefile_filename�get_path�get_path_names�	get_paths�get_platform�get_python_version�get_scheme_names�parse_config_hZMACOSX_DEPLOYMENT_TARGETz/{installed_base}/lib64/python{py_version_short}z){platbase}/lib64/python{py_version_short}z1{base}/lib/python{py_version_short}/site-packagesz7{platbase}/lib64/python{py_version_short}/site-packagesz;{installed_base}/include/python{py_version_short}{abiflags}z?{installed_platbase}/include/python{py_version_short}{abiflags}z
{base}/binz{base})�stdlib�
platstdlib�purelib�platlib�include�platinclude�scripts�dataz{installed_base}/lib/pythonz{base}/lib/pythonz{installed_base}/include/pythonz{installed_base}/Libz
{base}/Libz{base}/Lib/site-packagesz{installed_base}/Includez{base}/Scriptsz#{userbase}/Python{py_version_nodot}z1{userbase}/Python{py_version_nodot}/site-packagesz+{userbase}/Python{py_version_nodot}/Includez+{userbase}/Python{py_version_nodot}/Scriptsz
{userbase})rrrrrrrz){userbase}/lib64/python{py_version_short}z5{userbase}/lib/python{py_version_short}/site-packagesz7{userbase}/lib64/python{py_version_short}/site-packagesz+{userbase}/include/python{py_version_short}z{userbase}/binz{userbase}/lib/pythonz#{userbase}/lib/python/site-packagesz{userbase}/include)�posix_prefix�
posix_home�ntZnt_userZ
posix_userZosx_framework_user�%d.%d�z%d%dcCs(z
t|�WStk
r"|YSXdS�N)r�OSError)�path�r�!/usr/lib64/python3.8/sysconfig.py�_safe_realpathis
r!r)z\pcbuild\win32z\pcbuild\amd64Z_PYTHON_PROJECT_BASEcCs,dD]"}tj�tj�|d|��rdSqdS)N)ZSetupzSetup.localZModulesTF)�osr�isfile�join)�d�fnrrr �_is_python_source_dir~sr'�_homecCs0|r,tj�|��tj�tj�td���r,tS|S)NZPCbuild)r"r�normcase�
startswithr$�_PREFIX)r%rrr �_fix_pcbuild�s
�r,FcCs|rtrtt�Stt�Sr)�	_sys_homer'�
_PROJECT_BASE)Z
check_homerrr �is_python_build�sr/T)rrz{srcdir}/Includerz{projectbase}/.rc
Csnz|jf|�WStk
rhz|jftj�WYStk
rb}ztd|�d�W5d}~XYnXYnXdS)Nz{%s})�format�KeyErrorr"�environ�AttributeError)�sZ
local_vars�varrrr �_subst_vars�sr6cCs0|��}|��D]\}}||kr"q|||<qdSr)�keys�items)Ztarget_dictZ
other_dictZtarget_keys�key�valuerrr �_extend_dict�s
r;cCsbi}|dkri}t|t��t|��D]4\}}tjdkrFtj�|�}tj�t	||��||<q(|S)N)�posixr)
r;r�_INSTALL_SCHEMESr8r"�namer�
expanduser�normpathr6)�scheme�vars�resr9r:rrr �_expand_vars�s
rDcCstjdkrdStjS)Nr<r)r"r>rrrr �_get_default_scheme�s
rEcCsztj�dd�}|r|Sdd�}tjdkrBtj�d�p6d}||d�Stjdkrptjrp|dd	tjd
tjdd��S|dd�S)
N�PYTHONUSERBASEcWstj�tjj|��Sr)r"rr?r$)�argsrrr �joinuser�sz_getuserbase.<locals>.joinuserr�APPDATA�~�Python�darwin�Libraryrrz.local)r"r2�getr>�sys�platform�
_framework�version_info)�env_baserH�baserrr �_getuserbase�s


�rUc	Cs`ddl}|�d�}|�d�}|�d�}|dkr2i}i}i}t|dd��}|��}	W5QRX|	D]�}
|
�d�s^|
��dkrzq^|�|
�}|r^|�d	d
�\}}
|
��}
|
�dd�}d|kr�|
||<q^z|t	kr�t
�t|
�}
Wn$t
k
r�|
�dd�||<Yq^X|
||<q^t|�
��}d
}t|�dk�r&t|�D�]�}||}|�|�}|�|�}|�rv|�rv|��|��k�rp|n|}n|�r�|n|}|dk	�r|�d	�}d}||k�r�t||�}n�||k�r�d}nx|tjk�r�tj|}n`||k�r0|�d��r
|dd�|k�r
d}n$d||k�rd}nt|d|�}nd||<}|�r||��d�}|d|���||}d|k�r~|||<n�z|t	k�r�t
�t|�}Wn"t
k
�r�|��||<Yn
X|||<|�|�|�d��r|dd�|k�r|dd�}||k�r|||<n|||<|�|��q,�q|��D]"\}}
t|
t��r.|
��||<�q.|�|�|S)Nrz"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)z\$\(([A-Za-z][A-Za-z0-9_]*)\)z\${([A-Za-z][A-Za-z0-9_]*)}�surrogateescape)�errors�#��rz$$�$)ZCFLAGSZLDFLAGSZCPPFLAGSTFZPY_�)�re�compile�open�	readlinesr*�strip�match�group�replace�_ALWAYS_STR�
ValueError�int�listr7�len�tuple�search�start�strr"r2�end�remover8�
isinstance�update)�filenamerBr]Z_variable_rxZ_findvar1_rxZ_findvar2_rxZdoneZnotdone�f�lines�line�m�n�vZtmpvZ	variablesZrenamed_variablesr>r:Zm1Zm2�found�itemZafter�krrr �_parse_makefile�s�	












�



�


r|cCsdtrtj�tptd�Sttd�r0dttj	f}nd}ttj
d�rP|dtj
j7}tj�td�|d�S)NZMakefile�abiflagszconfig-%s%sZconfig�
_multiarchz-%sr)
�
_PYTHON_BUILDr"rr$r-r.�hasattrrO�_PY_VERSION_SHORTr}�implementationr~r)Zconfig_dir_namerrr rWs
c
Cs(tj�ddjtjtjttjdd�d��S)NZ_PYTHON_SYSCONFIGDATA_NAMEz+_sysconfigdata_{abi}_{platform}_{multiarch}r~rY)ZabirPZ	multiarch)	r"r2rNr0rOr}rP�getattrr�rrrr �_get_sysconfigdata_nameds��r�c
Cs�ddl}i}t�}zt||�WnJtk
rj}z,d|}t|d�rR|d|j}t|��W5d}~XYnXt�}z"t|��}t||�W5QRXWnJtk
r�}z,d|}t|d�r�|d|j}t|��W5d}~XYnXt	r�|d|d<t
�}dtjk�r$ddl
}|�|�}	||	_|	tj|<dt�tf}
ttd	��rF|
d
7}
tj|
dd�tj�|
|d
�}t|ddd��(}|�d�|�d�|j||d�W5QRXtdddd��}|�|
�W5QRXdS)Nrz.invalid Python installation: unable to open %s�strerrorz (%s)ZLDSHAREDZ	BLDSHAREDrLzbuild/lib.%s-%sZgettotalrefcountz-pydebugT)�exist_okz.py�w�utf8)�encodingzB# system configuration generated and used by the sysconfig module
zbuild_time_vars = )�streamzpybuilddir.txt)�pprintrr|rr�r�rr_rrr�rOrP�types�
ModuleType�build_time_vars�modulesrr�r"�makedirsrr$�write)r�rBZmakefile�e�msgZconfig_hrsr>r��moduleZ
pybuilddirZdestfilerrr �_generate_posix_varsmsL







r�cCs0t�}t|t�t�dgd�}|j}|�|�dS)Nr�r)r��
__import__�globals�localsr�rq)rBr>Z_tempr�rrr �_init_posix�sr�cCsfddl}td�|d<td�|d<td�|d<|��d|d<d	|d
<t|d<tj�ttj	��|d<dS)
NrrZLIBDESTrZ
BINLIBDESTrZ	INCLUDEPY�
EXT_SUFFIXz.exeZEXEZVERSIONZBINDIR)
�_impr�extension_suffixes�_PY_VERSION_SHORT_NO_DOTr"r�dirnamer!rO�
executable)rBr�rrr �_init_non_posix�sr�c	Cs�|dkri}ddl}|�d�}|�d�}|��}|s6q�|�|�}|r�|�dd�\}}z|tkrbt�t|�}Wntk
r�YnX|||<q(|�|�}|r(d||�d�<q(|S)Nrz"#define ([A-Z][A-Za-z0-9_]+) (.*)
z&/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/
rZr)r]r^�readlinerbrcrerfrg)	�fprBr]Z	define_rxZundef_rxrurvrwrxrrr r�s,




cCsBtr,tjdkr"tj�tptd�}q4tp(t}ntd�}tj�|d�S)NrZPCrz
pyconfig-64.h)rr"r>rr$r-r.r)Zinc_dirrrr r�s

cCsttt��Sr)rj�sortedr=rrrr r
�scCstSr)�_SCHEME_KEYSrrrr r	�scCs|rt||�St|SdSr)rDr=)rArB�expandrrr r
�s
cCst|||�|Sr)r
)r>rArBr�rrr r	scGsxtdk�rFiattd<ttd<ttd<ttd<ttd<ttd<ttd<ttd<ttd	<ttd
<zt	j
td<Wntk
r�dtd<YnXtj
d
kr�tt�tj
dkr�tt�t�d�}|dk	r�|td<t�td<t�dt�}tj
dk�rt�rtj�t��}tj�||�}ntj�t��}t|�td<t	jdk�rFddl}|�t�|�rpg}|D]}|�t�|���qT|StSdS)N�prefix�exec_prefixZ
py_versionZpy_version_shortZpy_version_nodotZinstalled_baserTZinstalled_platbaseZplatbaseZprojectbaser}rYrr<r��SO�userbase�srcdirrLr)�_CONFIG_VARSr+�_EXEC_PREFIX�_PY_VERSIONr�r��_BASE_PREFIX�_BASE_EXEC_PREFIXr.rOr}r3r"r>r�r�rNrUrrr�rr$r!rP�_osx_supportZcustomize_config_vars�append)rGr�r�rTr�Zvalsr>rrr rsP





cCs*|dkrddl}|�dtd�t��|�S)Nr�rz SO is deprecated, use EXT_SUFFIXr)�warnings�warn�DeprecationWarningrrN)r>r�rrr r^sc
Cs�tjdkrFdtj��krdSdtj��kr.dSdtj��kr@dStjStjdksZttd	�s`tjSd
tjkrttjd
St��\}}}}}|���	dd�}|�	d
d�}|�	dd�}|dd�dkr�d||fS|dd�dk�r,|ddk�r�d}dt
|d�d|dd�f}ddd�}|d|tj7}n�|dd�dk�rLd|||fS|dd �d!k�r�d!}ddl}|�
d"�}|�|�}|�r�|��}n2|dd �d#k�r�ddl}	|	�t�|||�\}}}d$|||fS)%NrZamd64z	win-amd64z(arm)z	win-arm32z(arm64)z	win-arm64r<�unameZ_PYTHON_HOST_PLATFORM�/rY� �_�-�Zlinuxz%s-%sZsunosr�5Zsolarisz%d.%sr\rZ32bitZ64bit)i���l����z.%sZaixz%s-%s.%s��cygwinz[\d.]+rLz%s-%s-%s)r"r>rO�version�lowerrPr�r2r�rdrg�maxsizer]r^rbrcr�Zget_platform_osxr)
ZosnameZhost�releaser��machineZbitnessr]Zrel_rervr�rrr rjsT


 



�
cCstSr)r�rrrr r�scCsFtt|����D]0\}\}}|dkr0td|�td||f�qdS)Nrz%s: z
	%s = "%s")�	enumerater�r8�print)�titler�indexr9r:rrr �_print_dict�sr�cCsfdtjkrt�dStdt��tdt��tdt��t�tdt��t�tdt	��dS)Nz--generate-posix-varszPlatform: "%s"zPython version: "%s"z!Current installation scheme: "%s"ZPathsZ	Variables)
rO�argvr�r�rrrEr�r
rrrrr �_main�s
r��__main__)F)N)N)Dr"rOZos.pathrr�__all__rer=r�r��splitr�rRr�r�rr@r�r+�base_prefixr�r�r��base_exec_prefixr�r�Z
_USER_BASEr!r�r�r.�getcwdr>r��endswithr$r2r'r�r-r,r/rrAr6r;rDrErUr|rr�r�r�r�rrr
r	r
rrrrrr�r��__name__rrrr �<module>s����
���
�
��?�
	
	

	?
"MP
sre_compile.cpython-38.opt-2.pyc000064400000034250150335716500012446 0ustar00U

e5dGh�@sddlZddlZddlTeehZeeehZ	e
ehZe
ehZeeehBZdZdd�eD�Zejfdd�Zdd	�Zd
d�Zd+dd
�ZejdZde>dZdZeefdd�Zdd�Z dd�Z!dd�Z"dd�Z#dd�Z$dd�Z%dd �Z&d!d"�Z'd#d$�Z(d%d&�Z)d'd(�Z*d,d)d*�Z+dS)-�N)�*))�ii1)�si)�i�)iEi�i�)i�i�)i�i�)i�i�)i�i�)i�i�)i�i�)i�i�)i�i�)i�i�)i�i�)iai�)i�i�cs.i|]&}|D]��t�fdd�|D���qqS)c3s|]}�|kr|VqdS�N�)�.0�j��ir�#/usr/lib64/python3.8/sre_compile.py�	<genexpr>>sz<dictcomp>.<genexpr>)�tuple)r�trr
r�
<dictcomp>>s
�rcCs ||@r||M}||B|@Srr)�flags�	add_flags�	del_flags�
TYPE_FLAGSrrr�_combine_flagsAs
rcCs�|j}t}t}t}t}t}d}	d}
d}|t@r\|t@s\|t@rPt	j
}	t	j}
t}nt	j
}	t	j}
|D�]|\}}
||k�rr|t@s�||�||
�n�|t@r�|t|�||
�n�|	|
�s�||�||
�n�|
|
�}|s�|t|�||�n�||k�r|t|�||�nh|t�||�}|d�|tk�r2|t�|f||D]}|t�||��q@|t�||�|||<q`|tk�rt|
|	|
|�\}}|t@�r�|t@�r�|t�n(|�s�|t�n|�s�|t�n|t�||�}|d�t|||�||�|||<q`|tk�r*|t@�r |t�n|t�q`||k�r6|t@�rLt d|f��t!|
d��r�|t"k�rn|t#�n|t$�||�}|d�||
d�||
d�t%||
d|�|t&�||�|||<nl|t'�||�}|d�||
d�||
d�t%||
d|�||�|||<|t"k�r,|t(�n|t)�q`|t*k�r�|
\}}}}|�rj|t+�||dd�t%||t,|||��|�r�|t+�||ddd�q`||k�r�||�q`||k�rD||�||�}|d�|
ddk�r�|d�n*|
d�-�\}}||k�rt d��||�t%||
d|�|t&�||�|||<q`|t.k�r�||�||�}|d�t%||
|�|t&�||�|||<q`|t/k�r�||�|t0@�r�t1�2|
|
�}
|t@�r�t3�2|
|
�}
n|t@�r�t4�2|
|
�}
||
�q`|t5k�r�||�g}|j}|
dD]N}
||�}|d�t%||
|�|t6�|||��|d�||�|||<�q|t�|D]}||�|||<�qlq`|t7k�r�||�|t@�r�t8|
}
n|t@�r�t9|
}
||
�q`|t:k�r |t@�s�||�n,|t@�r�|t;�n|�s
|t<�n|t=�||
d�q`|t>k�r�||�||
dd�||�}|d�t%||
d|�|
d�r�|t6�||�}|d�||�|d||<t%||
d|�||�|||<n||�|d||<q`t d|f��q`dS)Nrz*internal: unsupported template operator %r��z(look-behind requires fixed-width patternz%internal: unsupported operand type %r)?�append�len�_LITERAL_CODES�_REPEATING_CODES�_SUCCESS_CODES�
_ASSERT_CODES�SRE_FLAG_IGNORECASE�SRE_FLAG_LOCALE�SRE_FLAG_UNICODE�_sre�unicode_iscased�unicode_tolower�_ignorecase_fixes�
ascii_iscased�
ascii_tolower�OP_LOCALE_IGNORE�	OP_IGNORE�OP_UNICODE_IGNORE�
IN_UNI_IGNORE�NOT_LITERAL�NEGATE�LITERAL�FAILURE�IN�_optimize_charset�
IN_LOC_IGNORE�	IN_IGNORE�_compile_charset�ANY�SRE_FLAG_DOTALL�ANY_ALL�SRE_FLAG_TEMPLATE�error�_simple�
MAX_REPEAT�
REPEAT_ONE�MIN_REPEAT_ONE�_compile�SUCCESS�REPEAT�	MAX_UNTIL�	MIN_UNTIL�
SUBPATTERN�MARKr�getwidth�CALL�AT�SRE_FLAG_MULTILINE�AT_MULTILINE�get�	AT_LOCALE�
AT_UNICODE�BRANCH�JUMP�CATEGORY�	CH_LOCALE�
CH_UNICODE�GROUPREF�GROUPREF_LOC_IGNORE�GROUPREF_IGNORE�GROUPREF_UNI_IGNORE�GROUPREF_EXISTS)�code�patternr�emit�_len�
LITERAL_CODES�REPEATING_CODES�
SUCCESS_CODES�ASSERT_CODES�iscased�tolower�fixes�op�av�lo�skip�k�charset�hascased�grouprr�p�hi�tail�
tailappend�skipyes�skipnorrrr=GsV
















































r=cCs�|j}|D]�\}}||�|tkr$q
|tkr6||�q
|tksF|tkr`||d�||d�q
|tkrt|�|�q
|tkr�|�|�q
|tkr�|t	@r�|t
|�q�|t@r�|t|�q�||�q
t
d|f��q
|t�dS)Nrrz%internal: unsupported set operator %r)rr,r-�RANGE�RANGE_UNI_IGNORE�CHARSET�extend�
BIGCHARSETrNrrOr rPr8r.)rfrrVrXrarbrrrr3�s,

r3c	Cs�g}g}td�}d}|D�]�\}}	�z,|tkr�|rv||	�}
d||
<|rd|
|krd||
D]}d||<qV|s~||	�r~d}nd||	<n�|tk�r&t|	d|	dd�}|�r|r�t||�D]*}
d||
<|
|kr�||
D]}d||<q�q�nt||�D]}
d||
<q�|�s$tt||��}n|D]}
d||
<�qn(|tk�r@|�||	f�n|�||	f�WnZtk
�r�t	|�dk�r�|dd7}Yq"|�r�d}|tk�r�t
}|�||	f�YnXqq"qg}d}|�d|�}|dk�rԐq(t	|�dk�r�d}�q(|�d|�}|dk�r|�|t	|�f��q(|�||f��q�|dk	�r�|D]>\}}||dk�r\|�t|f�n|�t||dff��q6||7}|�s�t	|�t	|�k�r�||fS||fSt	|�dk�r�t|�}|�t
|f�||7}||fSt|�}i}td�}d}t�}tdd	d�D]V}
||
|
d�}||k�r4||||
d<n$|||
d<||<|d7}||7}�qt|�}|gt|�|dd�<|�t|f�||7}||fS)
N�FrTr�i�ri)�	bytearrayr-ro�range�map�anyr,r�
IndexErrorrrp�find�
_mk_bitmaprq�bytes�_bytes_to_codesrs)rfr^�fixupr`�outrk�charmaprgrarbrcre�rr�runs�qri�data�comps�mapping�block�chunkrrrr0s�









r0�rs0111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111cs8|�t�ddd�����fdd�tt��d��D�S)N���cs"g|]}��|�|�d��qS)rr)rr��	_CODEBITS�_int�srr�
<listcomp>�s�z_mk_bitmap.<locals>.<listcomp>r)�	translate�_BITS_TRANSrwr)�bitsr�r�rr�rr|�s�r|cCst|��d�}|��S)N�I)�
memoryview�cast�tolist)�b�arrrr~�sr~cCsDt|�dkrdS|d\}}|tkr<|ddko:t|d�S|tkS)NrFrr�)rrBr9�_UNIT_CODES)rirarbrrrr9�sr9cCsndgt|�}tdt|��D]L}||d}||||kr\|dkrNd||<q||d}q,|d||<q|S)Nrr)rrw)�prefix�tabler�idxrrr�_generate_overlap_table�s	r�cCs$|t@sdS|t@rtjStjSdSr)rr r!r"r%)rrrr�_get_iscased�s
r�cCs�g}|j}d}t|�}|jD]�\}}|tkrF|r<||�r<q�||�q|tkr�|\}}	}
}t||	|
�}|t@rz|t@rzq�t||�\}
}}|dkr�|dk	r�t	|�}n|dk	r�t	|�|}|�
|
�|s�q�qq�q||dfS||dfS)NTF)rr�r�r-rBrrr�_get_literal_prefixrrr)rWrr��prefixappend�prefix_skipr^rarbrhrrri�flags1�prefix1�prefix_skip1�got_allrrrr��s4



r�cCsd|js
dS|jd\}}|tk	r"qP|\}}}}t|||�}|t@r|t@rdSqt|�}|tkrz|rp||�rpdS||fgS|tkr�g}|j}	|dD]B}
|
s�dS|
d\}}|tkr�|r�||�s�|	||f�q�dSq�|S|t	k�r`|}|�r\|D]f\}}|tk�r||��rZdSq�|t
kr�|ddk�r4dStt|t
|d|dd���r�dSq�|SdS)Nrri��)r�rBrrrr�r-rLrr/roryrxrw)rWrrarbrhrrr^rf�
charsetappendrirrr�_get_charset_prefix�sN



 r�c
Csr|��\}}|tkrt}|dkr8|�tdd||g�dSg}d}g}|t@rT|t@srt||�\}}}|srt||�}|j}	|	t�t	|�}
|	d�d}|r�t
}|dkr�|r�|tB}n|r�|tB}|	|�|tkr�|	|�n|	t�|dt�}|	t
|t��|�r@|	t	|��|dk�rt	|�}|	|�|�|�|�t|��n|�r^t|�\}}t|||�t	|�|
||
<dS)Nr�)rD�MAXCODErr�INFOrrr�r�rr�SRE_INFO_PREFIX�SRE_INFO_LITERAL�SRE_INFO_CHARSET�minr�r0r3)
rVrWrrcrjr�r�rfr�rXrd�maskrgrrr�
_compile_infosR




r�cCst|ttf�Sr)�
isinstance�strr})�objrrr�isstringSsr�cCs8|jj|B}g}t|||�t||j|�|�t�|Sr)�staterr�r=r�rr>)rirrVrrr�_codeVs
r�cCsdd�dd�|D��S)N�[%s]�, css$|]}dtjdd|fVqdS)z%#0*xrN)r!�CODESIZE�r�xrrrr
fsz_hex_code.<locals>.<genexpr>)�join�rVrrr�	_hex_codeesr�csNddl�t��d�ttt��d���������fdd���dt���dS)Nrrc	s�dd�����fdd�
}��fdd�}�d7��}||k�r�|��|}|d7}t|}|tttttttfkrx||�q2|tt	t
ttt
ttfkr��|}|d7}||d|t|�f�q2|tkr�|}|d7}tt|�}|||dd��q2|tk�r*�|}|d7}tt|�}|||d	d��q2|ttttfk�rr�|}|||||d��|d||�||7}q2|ttfk�r��||d
�\}}	|d
7}||d||	t|�t|	�f�q2|tk�r�||t�||dt���|dt7}q2|tk�r��|}|d7}t d
�!�fdd��||dt"j#�D���}
||||
�|dt"j#7}�d7�t$|�D].}|t�||dt���|dt7}�qd�d8�q2|t%t&t't(t)fk�rΈ|}|d7}|||�q2|t*k�r��|}|||||d�|d7}q2|t+k�r|�|}|||||d�|�rr�|d||�||7}|��|}|�rf|d|||d�n|t��q |d7}q2|t,t-t.fk�r�||d�\}}}
|
t/k�r�d}
|||||
||d��|d||�||7}q2|t0k�r�||d
�\}}||||||d�|d
7}q2|t1t2fk�rp�||d
�\}}||||||d��|d
||�||7}q2|t3k�r��||d�\}}}}
|
t/k�r�d}
|||t4|�||
||d�|d�|t5@�r^�|d|d�\}}|d|�|d����|�}|ddd�!dd�|D��dd�!t6t|����|7�|d���|���|7�|t7@�r��d7�|d���||��d8�||7}q2t8|��q2�d8�dS)N)�tocsX|dk	r"��|�|d|ff7}td����kr6dndfd�dd�t|�dS)Nz(to %d)z%*d%s �:�.z  r��end)�add�print)r��args)�labels�level�offset_width�startrr�print_ps

�z!dis.<locals>.dis_.<locals>.print_cs"td�d�d�t|�dS)N� rr�)r�)r�)r�r�rr�print_2xsz"dis.<locals>.dis_.<locals>.print_2rz
%#02x (%r)��	rz%#02x %#02x (%r-%r)rt�c3s|]}|�tj�j�VqdSr)�to_bytesr!r��	byteorderr�)�sysrrr
�s�z$dis.<locals>.dis_.<locals>.<genexpr>�branch�	MAXREPEATr��z
  prefix_skipz  prefixr�r�css|]}d|VqdS)z%#02xNrr�rrrr
�sz(%r)�z	  overlap�in)9�OPCODESr>r.r4r6r@rAr,r-r+�LITERAL_IGNORE�NOT_LITERAL_IGNORE�LITERAL_UNI_IGNORE�NOT_LITERAL_UNI_IGNORE�LITERAL_LOC_IGNORE�NOT_LITERAL_LOC_IGNORE�chrrFr��ATCODESrN�CHCODESr/r2r*r1rorprqr�r�rs�listr�r!r�rwrCrQrSrTrRrMrLr?r;r<r�rU�ASSERT�
ASSERT_NOTr��binr�rxr��
ValueError)r�r�r�r�rra�argrdrcrjr�r	r��maxr�
prefix_lenr�r��rV�dis_r�r�r�r�)r�rr�os�

�
�

 

�


�












�


zdis.<locals>.dis_)r��setrr�r�rr�r�dishsr�c	Cs�t|�r|}t�||�}nd}t||�}|t@r>t�t|�|jj}dg|jj	}|�
�D]\}}|||<q\t�|||jj
B||jj	d|t|��S)Nr)r��	sre_parse�parser��SRE_FLAG_DEBUGr�r�r��	groupdict�groups�itemsr!�compilerr)rirrWrV�
groupindex�
indexgrouprerrrrr��s(



�r�)NNN)r),r!r��
sre_constantsr-r+rr?�
MIN_REPEATr:rr>r.rr�r�rr4r/r��
_equivalencesr$rrr=r3r0r�r�r�r��intr|r~r9r�r�r�r�r�r�r�r�r�r�rrrr�<module>
sF
$��
3

	,;ssl.cpython-38.pyc000064400000127066150335716500010016 0ustar00U

e5dH��
@s�dZddlZddlZddlmZddlmZmZ	m
ZddlZddlm
Z
mZmZddlmZmZmZddlmZmZmZmZmZmZmZddlmZmZdd	lmZmZm Z m!Z!zdd
lm"Z"Wne#k
r�YnXddlm$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-ddlm.Z.m/Z/e	j0d
e1dd�ed�ej0de1dd�ed�e	j0de1dd�ed�e	j0de1dd�ed�ej0de1dd�ed�e	j0de1dd�ed�e2j3Z4e2_4dd�e2j5�6�D�Z7e8e2dd�Z9Gdd�de	�Z:Gd d!�d!e	�Z;Gd"d#�d#e	�Z<Gd$d%�d%e	�Z=ej>d&k�r"dd'lm?Z?m@Z@dd(lAmAZAmBZBmCZCmDZDdd)lAmEZEmFZFddlAZGddlHZHddlIZIddlJZJeKZLd*gZMeNed+�ZOe.ZPeZQd,d-�ZRd.d/�ZSd0d1�ZTd2d3�ZUed4d5�ZVd6d7�ZWGd8d9�d9ed9d:��ZXGd;d<�d<eXe�ZYGd=d>�d>e�ZZeYj[fdddd?�d@dA�Z\e3fe]dBeYj[ddddddC�dDdE�Z^e\Z_e^Z`GdFdG�dG�ZadHdI�ZbGdJdK�dKeA�ZceceZ_deaeZ_edddBe]e3ddLdLdf	dMdN�ZfdOdP�ZgdQZhdRZidSdT�ZjdUdV�Zke3dfdWdX�ZldYdZ�ZmdS)[a�
This module provides some more Pythonic support for SSL.

Object types:

  SSLSocket -- subtype of socket.socket which does SSL over the socket

Exceptions:

  SSLError -- exception raised for I/O errors

Functions:

  cert_time_to_seconds -- convert time string used for certificate
                          notBefore and notAfter functions to integer
                          seconds past the Epoch (the time values
                          returned from time.time())

  fetch_server_certificate (HOST, PORT) -- fetch the certificate provided
                          by the server running on HOST at port PORT.  No
                          validation of the certificate is performed.

Integer constants:

SSL_ERROR_ZERO_RETURN
SSL_ERROR_WANT_READ
SSL_ERROR_WANT_WRITE
SSL_ERROR_WANT_X509_LOOKUP
SSL_ERROR_SYSCALL
SSL_ERROR_SSL
SSL_ERROR_WANT_CONNECT

SSL_ERROR_EOF
SSL_ERROR_INVALID_ERROR_CODE

The following group define certificate requirements that one side is
allowing/requiring from the other side:

CERT_NONE - no certificates from the other side are required (or will
            be looked at if provided)
CERT_OPTIONAL - certificates are not required, but if provided will be
                validated, and if validation fails, the connection will
                also fail
CERT_REQUIRED - certificates are required, and will be validated, and
                if validation fails, the connection will also fail

The following constants identify various SSL protocol variants:

PROTOCOL_SSLv2
PROTOCOL_SSLv3
PROTOCOL_SSLv23
PROTOCOL_TLS
PROTOCOL_TLS_CLIENT
PROTOCOL_TLS_SERVER
PROTOCOL_TLSv1
PROTOCOL_TLSv1_1
PROTOCOL_TLSv1_2

The following constants identify various SSL alert message descriptions as per
http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-6

ALERT_DESCRIPTION_CLOSE_NOTIFY
ALERT_DESCRIPTION_UNEXPECTED_MESSAGE
ALERT_DESCRIPTION_BAD_RECORD_MAC
ALERT_DESCRIPTION_RECORD_OVERFLOW
ALERT_DESCRIPTION_DECOMPRESSION_FAILURE
ALERT_DESCRIPTION_HANDSHAKE_FAILURE
ALERT_DESCRIPTION_BAD_CERTIFICATE
ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE
ALERT_DESCRIPTION_CERTIFICATE_REVOKED
ALERT_DESCRIPTION_CERTIFICATE_EXPIRED
ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN
ALERT_DESCRIPTION_ILLEGAL_PARAMETER
ALERT_DESCRIPTION_UNKNOWN_CA
ALERT_DESCRIPTION_ACCESS_DENIED
ALERT_DESCRIPTION_DECODE_ERROR
ALERT_DESCRIPTION_DECRYPT_ERROR
ALERT_DESCRIPTION_PROTOCOL_VERSION
ALERT_DESCRIPTION_INSUFFICIENT_SECURITY
ALERT_DESCRIPTION_INTERNAL_ERROR
ALERT_DESCRIPTION_USER_CANCELLED
ALERT_DESCRIPTION_NO_RENEGOTIATION
ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION
ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
ALERT_DESCRIPTION_UNRECOGNIZED_NAME
ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE
ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE
ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY
�N)�
namedtuple)�Enum�IntEnum�IntFlag)�OPENSSL_VERSION_NUMBER�OPENSSL_VERSION_INFO�OPENSSL_VERSION)�_SSLContext�	MemoryBIO�
SSLSession)�SSLError�SSLZeroReturnError�SSLWantReadError�SSLWantWriteError�SSLSyscallError�SSLEOFError�SSLCertVerificationError)�txt2obj�nid2obj)�RAND_status�RAND_add�
RAND_bytes�RAND_pseudo_bytes)�RAND_egd)
�HAS_SNI�HAS_ECDH�HAS_NPN�HAS_ALPN�	HAS_SSLv2�	HAS_SSLv3�	HAS_TLSv1�HAS_TLSv1_1�HAS_TLSv1_2�HAS_TLSv1_3)�_DEFAULT_CIPHERS�_OPENSSL_API_VERSION�
_SSLMethodcCs|�d�o|dkS)NZ	PROTOCOL_�PROTOCOL_SSLv23��
startswith��name�r,�/usr/lib64/python3.8/ssl.py�<lambda>|�r.)�source�OptionscCs
|�d�S)NZOP_r(r*r,r,r-r.�r/ZAlertDescriptioncCs
|�d�S)NZALERT_DESCRIPTION_r(r*r,r,r-r.�r/ZSSLErrorNumbercCs
|�d�S)NZ
SSL_ERROR_r(r*r,r,r-r.�r/�VerifyFlagscCs
|�d�S)NZVERIFY_r(r*r,r,r-r.�r/�
VerifyModecCs
|�d�S)NZCERT_r(r*r,r,r-r.�r/cCsi|]\}}||�qSr,r,)�.0r+�valuer,r,r-�
<dictcomp>�sr6ZPROTOCOL_SSLv2c@s6eZdZejZejZejZ	ej
ZejZ
ejZejZdS)�
TLSVersionN)�__name__�
__module__�__qualname__�_sslZPROTO_MINIMUM_SUPPORTEDZMINIMUM_SUPPORTEDZPROTO_SSLv3�SSLv3ZPROTO_TLSv1ZTLSv1Z
PROTO_TLSv1_1ZTLSv1_1Z
PROTO_TLSv1_2ZTLSv1_2Z
PROTO_TLSv1_3ZTLSv1_3ZPROTO_MAXIMUM_SUPPORTEDZMAXIMUM_SUPPORTEDr,r,r,r-r7�sr7c@s(eZdZdZdZdZdZdZdZdZ	dS)	�_TLSContentTypez@Content types (record layer)

    See RFC 8446, section B.1
    ������N)
r8r9r:�__doc__�CHANGE_CIPHER_SPEC�ALERTZ	HANDSHAKEZAPPLICATION_DATA�HEADERZINNER_CONTENT_TYPEr,r,r,r-r=�sr=c@s�eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$S)%�
_TLSAlertTypezQAlert types for TLSContentType.ALERT messages

    See RFC 8466, section B.2
    r�
r>r?r@��(�)�*�+�,�-�.�/�0�1�2�3�<�F�G�P�V�Z�d�m�n�o�p�q�r�s�t�xN)&r8r9r:rDZCLOSE_NOTIFYZUNEXPECTED_MESSAGEZBAD_RECORD_MACZDECRYPTION_FAILEDZRECORD_OVERFLOWZDECOMPRESSION_FAILUREZHANDSHAKE_FAILUREZNO_CERTIFICATEZBAD_CERTIFICATEZUNSUPPORTED_CERTIFICATEZCERTIFICATE_REVOKEDZCERTIFICATE_EXPIREDZCERTIFICATE_UNKNOWNZILLEGAL_PARAMETERZ
UNKNOWN_CAZ
ACCESS_DENIEDZDECODE_ERRORZ
DECRYPT_ERRORZEXPORT_RESTRICTIONZPROTOCOL_VERSIONZINSUFFICIENT_SECURITYZINTERNAL_ERRORZINAPPROPRIATE_FALLBACKZ
USER_CANCELEDZNO_RENEGOTIATIONZMISSING_EXTENSIONZUNSUPPORTED_EXTENSIONZCERTIFICATE_UNOBTAINABLEZUNRECOGNIZED_NAMEZBAD_CERTIFICATE_STATUS_RESPONSEZBAD_CERTIFICATE_HASH_VALUEZUNKNOWN_PSK_IDENTITYZCERTIFICATE_REQUIREDZNO_APPLICATION_PROTOCOLr,r,r,r-rH�sFrHc@sheZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdS)�_TLSMessageTypezFMessage types (handshake protocol)

    See RFC 8446, section B.3
    r����������
���r>r?r@rA��C�rCN)r8r9r:rDZ
HELLO_REQUESTZCLIENT_HELLOZSERVER_HELLOZHELLO_VERIFY_REQUESTZNEWSESSION_TICKETZEND_OF_EARLY_DATAZHELLO_RETRY_REQUESTZENCRYPTED_EXTENSIONSZCERTIFICATEZSERVER_KEY_EXCHANGEZCERTIFICATE_REQUESTZSERVER_DONEZCERTIFICATE_VERIFYZCLIENT_KEY_EXCHANGEZFINISHEDZCERTIFICATE_URLZCERTIFICATE_STATUSZSUPPLEMENTAL_DATAZ
KEY_UPDATEZ
NEXT_PROTOZMESSAGE_HASHrEr,r,r,r-rg�s.rg�win32)�enum_certificates�	enum_crls)�socket�AF_INET�SOCK_STREAM�create_connection)�
SOL_SOCKET�SO_TYPE�
tls-unique�HOSTFLAG_NEVER_CHECK_SUBJECTcCs�|sdS|�d�}|s&|��|��kS|dkr<td�|���|�d�\}}}d|krbtd�|���|sttd�|���|dkr�td�|���|�d�\}}}|r�|s�dS|��|��kS)	a�Matching according to RFC 6125, section 6.4.3

    - Hostnames are compared lower case.
    - For IDNA, both dn and hostname must be encoded as IDN A-label (ACE).
    - Partial wildcards like 'www*.example.org', multiple wildcards, sole
      wildcard or wildcards in labels other then the left-most label are not
      supported and a CertificateError is raised.
    - A wildcard must match at least one character.
    F�*rhz1too many wildcards in certificate DNS name: {!r}.�.z9wildcard can only be present in the leftmost label: {!r}.z>sole wildcard without additional labels are not support: {!r}.z<partial wildcards in leftmost label are not supported: {!r}.)�count�lower�CertificateError�format�	partition)Zdn�hostnameZ	wildcardsZdn_leftmost�sepZdn_remainderZhostname_leftmostZhostname_remainderr,r,r-�_dnsname_matchs@

�������r�cCs�zt�|�}Wntk
r"Yn"Xt�|�|kr6|Std�|���zt�tj|�WStk
rvtd�|���Yntk
r�YnXtd�|���dS)z�Try to convert an IP address to packed binary form

    Supports IPv4 addresses on all platforms and IPv6 on platforms with IPv6
    support.
    z'{!r} is not a quad-dotted IPv4 address.z+{!r} is neither an IPv4 nor an IP6 address.z{!r} is not an IPv4 address.N)	�_socketZ	inet_aton�OSErrorZ	inet_ntoa�
ValueErrorr�Z	inet_ptonZAF_INET6�AttributeError)Zipname�addrr,r,r-�_inet_patonDs$��
r�cCst|���}||kS)z�Exact matching of IP addresses.

    RFC 6125 explicitly doesn't define an algorithm for this
    (section 1.7.2 - "Out of Scope").
    )r��rstrip)Zcert_ipaddress�host_ipZipr,r,r-�_ipaddress_matchgsr�cCsJ|std��zt|�}Wntk
r0d}YnXg}|�dd�}|D]^\}}|dkrz|dkrnt||�rndS|�|�qF|dkrF|dk	r�t||�r�dS|�|�qF|s�|�dd�D]6}|D],\}}|dkr�t||�r�dS|�|�q�q�t|�d	k�rtd
|d�t	t
|��f��n,t|�d	k�r>td||d
f��ntd��dS)a�Verify that *cert* (in decoded format as returned by
    SSLSocket.getpeercert()) matches the *hostname*.  RFC 2818 and RFC 6125
    rules are followed.

    The function matches IP addresses rather than dNSNames if hostname is a
    valid ipaddress string. IPv4 addresses are supported on all platforms.
    IPv6 addresses are supported on platforms with IPv6 support (AF_INET6
    and inet_pton).

    CertificateError is raised on failure. On success, the function
    returns nothing.
    ztempty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIREDNZsubjectAltNamer,ZDNSz
IP AddressZsubjectZ
commonNamerhz&hostname %r doesn't match either of %sz, zhostname %r doesn't match %rrz=no appropriate commonName or subjectAltName fields were found)r�r��getr��appendr��lenr��join�map�repr)�certr�r�ZdnsnamesZsan�keyr5�subr,r,r-�match_hostnamessB


�
�r��DefaultVerifyPathszQcafile capath openssl_cafile_env openssl_cafile openssl_capath_env openssl_capathcCsdt��}tj�|d|d�}tj�|d|d�}ttj�|�rF|ndtj�|�rX|ndf|��S)z/Return paths to default cafile and capath.
    rrhrirjN)	r;�get_default_verify_paths�os�environr�r��path�isfile�isdir)�parts�cafile�capathr,r,r-r��s��r�csDeZdZdZdZ�fdd�Ze�fdd��Ze�fdd��Z�Z	S)	�_ASN1Objectz#ASN.1 object identifier lookup
    r,cst�j|ft|dd���S)NFr*��super�__new__�_txt2obj)�cls�oid��	__class__r,r-r��sz_ASN1Object.__new__cst�j|ft|���S)z3Create _ASN1Object from OpenSSL numeric ID
        )r�r��_nid2obj)r�Znidr�r,r-�fromnid�sz_ASN1Object.fromnidcst�j|ft|dd���S)z=Create _ASN1Object from short name, long name or OID
        Tr*r�)r�r+r�r,r-�fromname�sz_ASN1Object.fromname)
r8r9r:rD�	__slots__r��classmethodr�r��
__classcell__r,r,r�r-r��sr�znid shortname longname oidc@seZdZdZdZdZdS)�PurposezDSSLContext purpose flags with X509v3 Extended Key Usage objects
    z1.3.6.1.5.5.7.3.1z1.3.6.1.5.5.7.3.2N)r8r9r:rD�SERVER_AUTHZCLIENT_AUTHr,r,r,r-r��sr�cs�eZdZdZdZdZdZefdd�Zdd�Z	d2d
d�Z
d3dd
�Zdd�Zdd�Z
dd�Zdd�Zejfdd�Zeed�r�e�fdd��Zej�fdd��Ze�fdd��Zej�fdd��Ze�fdd ��Zej�fd!d ��Zeed"��red#d$��Zejd%d$��Zned&d$��Ze�fd'd(��Zej�fd)d(��Ze�fd*d+��Ze�fd,d-��Zej�fd.d-��Ze�fd/d0��Zej�fd1d0��Z�Z S)4�
SSLContextz|An SSLContext holds various SSL-related configuration options and
    data, such as certificates and possibly a private key.)ZCAZROOTNcOst�||�}|S�N)r	r�)r��protocol�args�kwargs�selfr,r,r-r��szSSLContext.__new__cCs4|dkrdSt|t�r&|�d��d�S|�d�SdS)NZidna�ascii)�
isinstance�str�encode�decode)r�r�r,r,r-�_encode_hostname�s

zSSLContext._encode_hostnameFTc	Cs|jj|||||||d�S)N)�sock�server_side�do_handshake_on_connect�suppress_ragged_eofs�server_hostname�context�session)�sslsocket_class�_create)r�r�r�r�r�r�r�r,r,r-�wrap_socket�s�zSSLContext.wrap_socketcCs|jj||||�|�||d�S)N)r�r�r�r�)�sslobject_classr�r�)r��incoming�outgoingr�r�r�r,r,r-�wrap_bio�s�zSSLContext.wrap_biocCs`t�}|D]F}t|d�}t|�dks0t|�dkr8td��|�t|��|�|�q
|�|�dS)Nr�r�z(NPN protocols must be 1 to 255 in length)�	bytearray�bytesr�rr��extendZ_set_npn_protocols)r�Z
npn_protocols�protosr��br,r,r-�set_npn_protocolss
zSSLContext.set_npn_protocolscs8�dkrd�_n$t��s td����fdd�}|�_dS)Nznot a callable objectcs��|�}�|||�Sr�)r�)�sslobjZ
servernameZsslctx�r��server_name_callbackr,r-�shim_cbs
z3SSLContext.set_servername_callback.<locals>.shim_cb)Zsni_callback�callable�	TypeError)r�r�r�r,r�r-�set_servername_callbacksz"SSLContext.set_servername_callbackcCs`t�}|D]F}t|d�}t|�dks0t|�dkr8td��|�t|��|�|�q
|�|�dS)Nr�rr�z)ALPN protocols must be 1 to 255 in length)r�r�r�rr�r�Z_set_alpn_protocols)r�Zalpn_protocolsr�r�r�r,r,r-�set_alpn_protocols s
zSSLContext.set_alpn_protocolscCsvt�}z<t|�D].\}}}|dkr|dks4|j|kr|�|�qWntk
r`t�d�YnX|rr|j|d�|S)NZx509_asnTz-unable to enumerate Windows certificate store)�cadata)r�ryr�r��PermissionError�warnings�warn�load_verify_locations)r��	storename�purposeZcertsr��encodingZtrustr,r,r-�_load_windows_store_certs+sz$SSLContext._load_windows_store_certscCs@t|t�st|��tjdkr4|jD]}|�||�q"|��dS)Nrx)r�r�r��sys�platform�_windows_cert_storesr�Zset_default_verify_paths)r�r�r�r,r,r-�load_default_certs9s


zSSLContext.load_default_certs�minimum_versioncstt�j�Sr�)r7r�r��r�r�r,r-r�BszSSLContext.minimum_versioncs4|tjkr|jtjM_ttt�j�||�dSr�)	r7r<�optionsr1ZOP_NO_SSLv3r�r�r��__set__�r�r5r�r,r-r�Fs
cstt�j�Sr�)r7r��maximum_versionr�r�r,r-r�LszSSLContext.maximum_versioncsttt�j�||�dSr�)r�r�r�r�r�r�r,r-r�Pscstt�j�Sr�)r1r�r�r�r�r,r-r�TszSSLContext.optionscsttt�j�||�dSr�)r�r�r�r�r�r�r,r-r�Xsr�cCs|jtj@}|tjkSr��Z_host_flagsr;r�)r�Zncsr,r,r-�hostname_checks_common_name]sz&SSLContext.hostname_checks_common_namecCs,|r|jtjM_n|jtjO_dSr�r�r�r,r,r-r�bscCsdS)NTr,r�r,r,r-r�iscst�j}|dk	r|jSdSdS)a9TLS message callback

        The message callback provides a debugging hook to analyze TLS
        connections. The callback is called for any TLS protocol message
        (header, handshake, alert, and more), but not for application data.
        Due to technical  limitations, the callback can't be used to filter
        traffic or to abort a connection. Any exception raised in the
        callback is delayed until the handshake, read, or write operation
        has been performed.

        def msg_cb(conn, direction, version, content_type, msg_type, data):
            pass

        conn
            :class:`SSLSocket` or :class:`SSLObject` instance
        direction
            ``read`` or ``write``
        version
            :class:`TLSVersion` enum member or int for unknown version. For a
            frame header, it's the header version.
        content_type
            :class:`_TLSContentType` enum member or int for unsupported
            content type.
        msg_type
            Either a :class:`_TLSContentType` enum number for a header
            message, a :class:`_TLSAlertType` enum member for an alert
            message, a :class:`_TLSMessageType` enum member for other
            messages, or int for unsupported message types.
        data
            Raw, decrypted message content as bytes
        N)r��
_msg_callback�
user_function)r��innerr�r,r-r�ms!zSSLContext._msg_callbackcsb�dkr ttt�j�|d�dSt�d�s8t��d����fdd�}�|_ttt�j�||�dS)N�__call__z is not callable.cs�zt|�}Wntk
r YnXzt|�}Wntk
rBYnX|tjkrTt}n|tjkrdt}nt}z||�}Wntk
r�YnX�||||||�Sr�)r7r�r=rGrFrHrg)Zconn�	direction�versionZcontent_typeZmsg_type�dataZmsg_enum��callbackr,r-r��s,

�z'SSLContext._msg_callback.<locals>.inner)r�r�r�r��hasattrr�r�)r�rr�r�rr-r��s
cstt�j�Sr�)r&r�r�r�r�r,r-r��szSSLContext.protocolcstt�j�Sr�)r2r��verify_flagsr�r�r,r-r�szSSLContext.verify_flagscsttt�j�||�dSr�)r�r�rr�r�r�r,r-r�scs0t�j}z
t|�WStk
r*|YSXdSr�)r��verify_moder3r�r�r�r,r-r�s

zSSLContext.verify_modecsttt�j�||�dSr�)r�r�rr�r�r�r,r-r�s)FTTNN)FNN)!r8r9r:rDr�r�r��PROTOCOL_TLSr�r�r�r�r�r�r�r�r�r�r�rr	�propertyr��setterr�r�r;r�r�r�rrr�r,r,r�r-r��sn�
�





&%r�)r�r�r�cCs�t|t�st|��tt�}|tjkr0t|_d|_	|s<|s<|rL|�
|||�n|jtkr`|�|�t
|d�r�tj�d�}|r�tjjs�||_|S)z�Create a SSLContext object with default settings.

    NOTE: The protocol and settings may change anytime without prior
          deprecation. The values represent a fair balance between maximum
          compatibility and security.
    T�keylog_filename�
SSLKEYLOGFILE)r�r�r�r�rr�r��
CERT_REQUIREDr�check_hostnamer��	CERT_NONEr�rr�r�r�r��flags�ignore_environmentr)r�r�r�r�r��
keylogfiler,r,r-�create_default_context�s




rF)�	cert_reqsrr��certfile�keyfiler�r�r�cCs�t|t�st|��t|�}	|s$d|	_|dk	r2||	_|r<d|	_|rL|sLtd��|sT|r`|	�||�|sl|sl|r||	�|||�n|	jt	kr�|	�
|�t|	d�r�tj
�d�}
|
r�tjjs�|
|	_|	S)a/Create a SSLContext object for Python stdlib modules

    All Python stdlib modules shall use this function to create SSLContext
    objects in order to keep common settings in one place. The configuration
    is less restrict than create_default_context()'s to increase backward
    compatibility.
    FNT�certfile must be specifiedrr	)r�r�r�r�rrr��load_cert_chainr�rr�rr�r�r�r�r
rr)r�rrr�rrr�r�r�r�rr,r,r-�_create_unverified_context�s,



rc@s�eZdZdZdd�Zed2dd��Zedd	��Zej	d
d	��Zedd��Z
e
j	d
d��Z
edd��Zedd��Zedd��Z
d3dd�Zdd�Zd4dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd5d,d-�Zd.d/�Zd0d1�ZdS)6�	SSLObjectaThis class implements an interface on top of a low-level SSL object as
    implemented by OpenSSL. This object captures the state of an SSL connection
    but does not provide any network IO itself. IO needs to be performed
    through separate "BIO" objects which are OpenSSL's IO abstraction layer.

    This class does not have a public constructor. Instances are returned by
    ``SSLContext.wrap_bio``. This class is typically used by framework authors
    that want to implement asynchronous IO for SSL through memory buffers.

    When compared to ``SSLSocket``, this object lacks the following features:

     * Any form of network IO, including methods such as ``recv`` and ``send``.
     * The ``do_handshake_on_connect`` and ``suppress_ragged_eofs`` machinery.
    cOst|jj�d���dS)NzU does not have a public constructor. Instances are returned by SSLContext.wrap_bio().�r�r�r8�r�r�r�r,r,r-�__init__;s�zSSLObject.__init__FNc	Cs*|�|�}|j||||||d�}||_|S)N)r�r��ownerr�)r�Z	_wrap_bio�_sslobj)	r�r�r�r�r�r�r�r�r�r,r,r-r�As
�zSSLObject._createcCs|jjS)z(The SSLContext that is currently in use.�rr�r�r,r,r-r�MszSSLObject.contextcCs||j_dSr�r�r�Zctxr,r,r-r�RscCs|jjS)z!The SSLSession for client socket.�rr�r�r,r,r-r�VszSSLObject.sessioncCs||j_dSr�r�r�r�r,r,r-r�[scCs|jjS)z.Was the client session reused during handshake�r�session_reusedr�r,r,r-r"_szSSLObject.session_reusedcCs|jjS)z%Whether this is a server-side socket.)rr�r�r,r,r-r�dszSSLObject.server_sidecCs|jjS)z^The currently set server hostname (for SNI), or ``None`` if no
        server hostname is set.)rr�r�r,r,r-r�iszSSLObject.server_hostname�cCs(|dk	r|j�||�}n|j�|�}|S)z�Read up to 'len' bytes from the SSL object and return them.

        If 'buffer' is provided, read into this buffer and return the number of
        bytes read.
        N)r�read)r�r��buffer�vr,r,r-r$oszSSLObject.readcCs|j�|�S)z�Write 'data' to the SSL object and return the number of bytes
        written.

        The 'data' argument must support the buffer interface.
        )r�write�r�r�r,r,r-r'{szSSLObject.writecCs|j�|�S)z�Returns a formatted version of the data in the certificate provided
        by the other end of the SSL channel.

        Return None if no certificate was provided, {} if a certificate was
        provided, but not validated.
        )r�getpeercert�r�Zbinary_formr,r,r-r)�szSSLObject.getpeercertcCstjr|j��SdS)z�Return the currently selected NPN protocol as a string, or ``None``
        if a next protocol was not negotiated or if NPN is not supported by one
        of the peers.N)r;rr�selected_npn_protocolr�r,r,r-r+�szSSLObject.selected_npn_protocolcCstjr|j��SdS)z�Return the currently selected ALPN protocol as a string, or ``None``
        if a next protocol was not negotiated or if ALPN is not supported by one
        of the peers.N)r;rr�selected_alpn_protocolr�r,r,r-r,�sz SSLObject.selected_alpn_protocolcCs
|j��S)z_Return the currently selected cipher as a 3-tuple ``(name,
        ssl_version, secret_bits)``.)r�cipherr�r,r,r-r-�szSSLObject.ciphercCs
|j��S)z�Return a list of ciphers shared by the client during the handshake or
        None if this is not a valid server connection.
        )r�shared_ciphersr�r,r,r-r.�szSSLObject.shared_cipherscCs
|j��S)z�Return the current compression algorithm in use, or ``None`` if
        compression was not negotiated or not supported by one of the peers.)r�compressionr�r,r,r-r/�szSSLObject.compressioncCs
|j��S)z8Return the number of bytes that can be read immediately.)r�pendingr�r,r,r-r0�szSSLObject.pendingcCs|j��dS)zStart the SSL/TLS handshake.N)r�do_handshaker�r,r,r-r1�szSSLObject.do_handshakecCs
|j��S)z!Start the SSL shutdown handshake.)r�shutdownr�r,r,r-�unwrap�szSSLObject.unwrapr�cCs|j�|�S)z�Get channel binding data for current connection.  Raise ValueError
        if the requested `cb_type` is not supported.  Return bytes of the data
        or None if the data is not available (e.g. before the handshake).)r�get_channel_binding�r�Zcb_typer,r,r-r4�szSSLObject.get_channel_bindingcCs
|j��S)zZReturn a string identifying the protocol version used by the
        current SSL channel. �rr�r�r,r,r-r��szSSLObject.versioncCs
|j��Sr�)r�verify_client_post_handshaker�r,r,r-r7�sz&SSLObject.verify_client_post_handshake)FNNN)r#N)F)r�)r8r9r:rDrr�r�rr�rr�r"r�r�r$r'r)r+r,r-r.r/r0r1r3r4r�r7r,r,r,r-r,sH�








	
rcCstt|j�j|_|S)z*Copy docstring from SSLObject to SSLSocket)�getattrrr8rD)�funcr,r,r-�_sslcopydoc�sr:cseZdZdZdd�ZedX�fdd�	�Zeed	d
���Z	e	j
dd
��Z	eedd
���Zej
dd
��Zeedd���Zdd�Z
dYdd�Zdd�ZdZdd�Zdd�Zed[dd��Zedd��Zed d!��Zed"d#��Zed$d%��Zed&d'��Zd\�fd)d*�	Zd]�fd+d,�	Zd-d.�Zd^�fd/d0�	Zd_�fd1d2�	Zd`�fd3d4�	Zda�fd5d6�	Zdb�fd7d8�	Zdc�fd9d:�	Z d;d<�Z!d=d>�Z"ed?d@��Z#�fdAdB�Z$edCdD��Z%edEdF��Z&�fdGdH�Z'edddIdJ��Z(�fdKdL�Z)dMdN�Z*dOdP�Z+�fdQdR�Z,ededTdU��Z-edVdW��Z.�Z/S)f�	SSLSocketz�This class implements a subtype of socket.socket that wraps
    the underlying OS socket in an SSL context when necessary, and
    provides read and write methods over that channel. cOst|jj�d���dS)NzX does not have a public constructor. Instances are returned by SSLContext.wrap_socket().rrr,r,r-r�s�zSSLSocket.__init__FTNc

s�|�tt�tkrtd��|r8|r(td��|dk	r8td��|jrJ|sJtd��t|j|j	|j
|��d�}|j|f|�}	t
t|	�jf|�|	�|���|��||	_||	_d|	_d|	_||	_|�|�|	_||	_||	_z|	��Wn6tk
�r}
z|
jtjkr��d}W5d}
~
XYnXd}||	_ |�r�zH|	jj!|	||	j|	|	jd�|	_|�rj|	��}|d	k�rbtd
��|	�"�Wn$ttfk
�r�|	�#��YnX|	S)Nz!only stream sockets are supportedz4server_hostname can only be specified in client modez,session can only be specified in client modez'check_hostname requires server_hostname)�family�type�proto�filenoFT�rr��zHdo_handshake_on_connect should not be specified for non-blocking sockets)$Z
getsockoptrr�r}�NotImplementedErrorr�r�dictr<r=r>r?r�r�r;r�
settimeout�
gettimeout�detach�_context�_sessionZ_closedrr�r�r�r�r��getpeernamer��errnoZENOTCONN�
_connected�_wrap_socketr1�close)
r�r�r�r�r�r�r�r�r�r��eZ	connected�timeoutr�r,r-r��sj
��
zSSLSocket._createcCs|jSr�)rGr�r,r,r-r�szSSLSocket.contextcCs||_||j_dSr�)rGrr�rr,r,r-r�scCs|jdk	r|jjSdSr�rr�r,r,r-r� s
zSSLSocket.sessioncCs||_|jdk	r||j_dSr�)rHrr�r r,r,r-r�&s
cCs|jdk	r|jjSdSr�r!r�r,r,r-r",s
zSSLSocket.session_reusedcCstd|jj��dS)NzCan't dup() %s instances)rBr�r8r�r,r,r-�dup2s�z
SSLSocket.dupcCsdSr�r,)r��msgr,r,r-�_checkClosed6szSSLSocket._checkClosedcCs|js|��dSr�)rKrIr�r,r,r-�_check_connected:szSSLSocket._check_connectedr#c
Cs�|��|jdkrtd��z*|dk	r4|j�||�WS|j�|�WSWnVtk
r�}z8|jdtkr�|jr�|dk	r|WY�dSWY�dSn�W5d}~XYnXdS)zORead up to LEN bytes and return them.
        Return zero-length string on EOF.Nz'Read on closed or unwrapped SSL socket.rr/)rRrr�r$rr�Z
SSL_ERROR_EOFr�)r�r�r%�xr,r,r-r$Bs

zSSLSocket.readcCs&|��|jdkrtd��|j�|�S)zhWrite DATA to the underlying SSL channel.  Returns
        number of bytes of DATA actually transmitted.Nz(Write on closed or unwrapped SSL socket.)rRrr�r'r(r,r,r-r'Ws
zSSLSocket.writecCs|��|��|j�|�Sr�)rRrSrr)r*r,r,r-r)`szSSLSocket.getpeercertcCs*|��|jdkstjsdS|j��SdSr�)rRrr;rr+r�r,r,r-r+fszSSLSocket.selected_npn_protocolcCs*|��|jdkstjsdS|j��SdSr�)rRrr;rr,r�r,r,r-r,nsz SSLSocket.selected_alpn_protocolcCs$|��|jdkrdS|j��SdSr�)rRrr-r�r,r,r-r-vs
zSSLSocket.ciphercCs$|��|jdkrdS|j��SdSr�)rRrr.r�r,r,r-r.~s
zSSLSocket.shared_cipherscCs$|��|jdkrdS|j��SdSr�)rRrr/r�r,r,r-r/�s
zSSLSocket.compressionrcsF|��|jdk	r4|dkr(td|j��|j�|�St��||�SdS)Nrz3non-zero flags not allowed in calls to send() on %s)rRrr�r�r'r��send)r�r�r
r�r,r-rU�s
��zSSLSocket.sendcsL|��|jdk	r"td|j��n&|dkr8t��||�St��|||�SdS)Nz%sendto not allowed on instances of %s)rRrr�r�r��sendto)r�r�Z
flags_or_addrr�r�r,r-rV�s
�zSSLSocket.sendtocOstd|j��dS)Nz&sendmsg not allowed on instances of %s�rBr�rr,r,r-�sendmsg�s�zSSLSocket.sendmsgc
s�|��|jdk	r�|dkr(td|j��d}t|��H}|�d��2}t|�}||krn|�||d��}||7}qJW5QRXW5QRXnt��	||�SdS)Nrz6non-zero flags not allowed in calls to sendall() on %s�B)
rRrr�r��
memoryview�castr�rUr��sendall)r�r�r
r�ZviewZ	byte_viewZamountr&r�r,r-r\�s
�� zSSLSocket.sendallcs,|jdk	r|�|||�St��|||�SdS)z�Send a file, possibly by using os.sendfile() if this is a
        clear-text socket.  Return the total number of bytes sent.
        N)rZ_sendfile_use_sendr��sendfile)r��file�offsetr�r�r,r-r]�s
zSSLSocket.sendfilecsD|��|jdk	r2|dkr(td|j��|�|�St��||�SdS)Nrz3non-zero flags not allowed in calls to recv() on %s)rRrr�r�r$r��recv�r�Zbuflenr
r�r,r-r`�s
��
zSSLSocket.recvcsj|��|r|dkrt|�}n|dkr*d}|jdk	rV|dkrJtd|j��|�||�St��|||�SdS)Nr#rz8non-zero flags not allowed in calls to recv_into() on %s)rRr�rr�r�r$r��	recv_into�r�r%�nbytesr
r�r,r-rb�s

��zSSLSocket.recv_intocs4|��|jdk	r"td|j��nt��||�SdS)Nz'recvfrom not allowed on instances of %s)rRrr�r�r��recvfromrar�r,r-re�s
�zSSLSocket.recvfromcs6|��|jdk	r"td|j��nt��|||�SdS)Nz,recvfrom_into not allowed on instances of %s)rRrr�r�r��
recvfrom_intorcr�r,r-rf�s
�zSSLSocket.recvfrom_intocOstd|j��dS)Nz&recvmsg not allowed on instances of %srWrr,r,r-�recvmsg�s�zSSLSocket.recvmsgcOstd|j��dS)Nz+recvmsg_into not allowed on instances of %srWrr,r,r-�recvmsg_into�s�zSSLSocket.recvmsg_intocCs$|��|jdk	r|j��SdSdS)Nr)rRrr0r�r,r,r-r0�s

zSSLSocket.pendingcs|��d|_t��|�dSr�)rRrr�r2)r�Zhowr�r,r-r2�szSSLSocket.shutdowncCs.|jr|j��}d|_|Stdt|���dS�NzNo SSL wrapper around )rr2r�r�)r��sr,r,r-r3s

zSSLSocket.unwrapcCs$|jr|j��Stdt|���dSri)rr7r�r�r�r,r,r-r7s
z&SSLSocket.verify_client_post_handshakecsd|_t���dSr�)rr��_real_closer�r�r,r-rkszSSLSocket._real_closec	CsF|��|��}z$|dkr(|r(|�d�|j��W5|�|�XdS)NrA)rSrErDrr1)r��blockrOr,r,r-r1s
zSSLSocket.do_handshakec	s�|jrtd��|js|jdk	r&td��|jj|d|j||jd�|_z@|rVt��	|�}nd}t��
|�|s~d|_|jr~|��|WSt
tfk
r�d|_�YnXdS)Nz!can't connect in server-side modez/attempt to connect already-connected SSLSocket!Fr@T)r�r�rKrr�rLr�rHr��
connect_ex�connectr�r1r�)r�r�rmZrcr�r,r-�
_real_connect!s0�zSSLSocket._real_connectcCs|�|d�dS)�QConnects to remote ADDR, and then wraps the connection in
        an SSL channel.FN�ro�r�r�r,r,r-rn;szSSLSocket.connectcCs|�|d�S)rpTrqrrr,r,r-rm@szSSLSocket.connect_excs.t���\}}|jj||j|jdd�}||fS)z�Accepts a new connection from a remote client, and returns
        a tuple containing that new connection wrapped with a server-side
        SSL channel, and the address of the remote client.T)r�r�r�)r��acceptr�r�r�r�)r�Znewsockr�r�r,r-rsEs�zSSLSocket.acceptr�cCs4|jdk	r|j�|�S|tkr,td�|���dSdS)Nz({0} channel binding type not implemented)rr4�CHANNEL_BINDING_TYPESr�r�r5r,r,r-r4Qs
�zSSLSocket.get_channel_bindingcCs|jdk	r|j��SdSdSr�r6r�r,r,r-r�\s

zSSLSocket.version)FTTNNN)N)r#N)F)r)N)r)rN)r#r)Nr)r#r)Nr)F)r�)0r8r9r:rDrr�r�rr:r�rr�r"rPrRrSr$r'r)r+r,r-r.r/rUrVrXr\r]r`rbrerfrgrhr0r2r3r7rkr1rornrmrsr4r�r�r,r,r�r-r;�s��>



	











r;Tc
Csl|r|std��|r |s td��t|�}
||
_|r<|
�|�|rL|
�||�|	rZ|
�|	�|
j||||d�S)Nz5certfile must be specified for server-side operationsr)r�r�r�r�)r�r�rr�rZset_ciphersr�)r�rrr�r�ssl_version�ca_certsr�r�Zciphersr�r,r,r-r�is$

�r�cCs�ddlm}ddlm}d}d}z|�|dd����d}Wn$tk
rbtd	||f��Yn0X||dd�|�}||d|f|d
d��SdS)a�Return the time in seconds since the Epoch, given the timestring
    representing the "notBefore" or "notAfter" date from a certificate
    in ``"%b %d %H:%M:%S %Y %Z"`` strptime format (C locale).

    "notBefore" or "notAfter" dates must use UTC (RFC 5280).

    Month is one of: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
    UTC should be specified as GMT (see ASN1_TIME_print())
    r)�strptime)�timegm)ZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecz %d %H:%M:%S %Y GMTNrjrhz*time data %r does not match format "%%b%s"rirm)�timerwZcalendarrx�index�titler�)Z	cert_timerwrxZmonthsZtime_formatZmonth_numberZttr,r,r-�cert_time_to_seconds�s
�r|z-----BEGIN CERTIFICATE-----z-----END CERTIFICATE-----csRtt�|�dd��tg}|�fdd�tdt��d�D�7}|�td�d�|�S)z[Takes a certificate in binary DER format and returns the
    PEM version of it as a string.�ASCII�strictcsg|]}�||d��qS)�@r,)r4�i��fr,r-�
<listcomp>�sz(DER_cert_to_PEM_cert.<locals>.<listcomp>rr�
)	r��base64Zstandard_b64encode�
PEM_HEADER�ranger�r��
PEM_FOOTERr�)Zder_cert_bytesZssr,r�r-�DER_cert_to_PEM_cert�s
"r�cCs\|�t�stdt��|���t�s0tdt��|��tt�tt��}t�|�	dd��S)zhTakes a certificate in ASCII PEM format and returns the
    DER-encoded version of it as a byte sequencez(Invalid PEM encoding; must start with %sz&Invalid PEM encoding; must end with %sr}r~)
r)r�r��strip�endswithr�r�r�Zdecodebytesr�)Zpem_cert_string�dr,r,r-�PEM_cert_to_DER_cert�s
��r�c

Csd|\}}|dk	rt}nt}t|||d�}t|��&}|�|��}|�d�}	W5QRXW5QRXt|	�S)z�Retrieve the certificate from the server at the specified address,
    and return it as a PEM-encoded string.
    If 'ca_certs' is specified, validate the server cert against it.
    If 'ssl_version' is specified, use it in the connection attempt.N)rr�T)r
r�_create_stdlib_contextr~r�r)r�)
r�rurvZhostZportrr�r�ZsslsockZdercertr,r,r-�get_server_certificate�s�
r�cCst�|d�S)Nz	<unknown>)�_PROTOCOL_NAMESr�)Z
protocol_coder,r,r-�get_protocol_name�sr�)nrDr�r��collectionsr�enumrZ_EnumrZ_IntEnumrZ_IntFlagr;rrrr	r
rrr
rrrrrrr�rr�rrrrr�ImportErrorrrrrrrr r!r"r#r$r%�	_convert_r8r&rr'�__members__�itemsr�r8Z_SSLv2_IF_EXISTSr7r=rHrgr�ryrzr{r|r}r~rr�r�r�rJr�r�Zsocket_errorrtrZHAS_NEVER_CHECK_COMMON_NAMEZ_RESTRICTED_SERVER_CIPHERSr�r�r�r�r�r�r�r�r�r�r�rrrZ_create_default_https_contextr�rr:r;r�r�r�r|r�r�r�r�r�r�r,r,r,r-�<module>s�Y$0������
)
1#9�z�#�/�


poplib.cpython-38.pyc000064400000032225150335716500010472 0ustar00U

e5d�:�@sldZddlZddlZddlZddlZzddlZdZWnek
rLdZYnXddgZGdd�de	�Z
dZd	Zd
Z
dZe
eZdZGd
d�d�Zer�Gdd�de�Ze�d�edk�rhddlZeejd�Zee���e�ejd�e�ejd�e��e��\ZZeded�D]BZ e�!e �\Z"Z#Z$ede �e#D]Z%ede%��q@ed��qe�&�dS)z@A POP3 client class.

Based on the J. Myers POP3 draft, Jan. 96
�NTF�POP3�error_protoc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.8/poplib.pyrs�ni��
�
ic@seZdZdZdZeejfdd�Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd=d d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Ze�d0�Z d1d2�Z!d3d4�Z"d>d5d6�Z#d7d8�Z$d9d:�Z%d?d;d<�Z&dS)@raPThis class supports both the minimal and optional command sets.
    Arguments can be strings or integers (where appropriate)
    (e.g.: retr(1) and retr('1') both work equally well.

    Minimal Command Set:
            USER name               user(name)
            PASS string             pass_(string)
            STAT                    stat()
            LIST [msg]              list(msg = None)
            RETR msg                retr(msg)
            DELE msg                dele(msg)
            NOOP                    noop()
            RSET                    rset()
            QUIT                    quit()

    Optional Commands (some servers support these):
            RPOP name               rpop(name)
            APOP name digest        apop(name, digest)
            TOP msg n               top(msg, n)
            UIDL [msg]              uidl(msg = None)
            CAPA                    capa()
            STLS                    stls()
            UTF8                    utf8()

    Raises one exception: 'error_proto'.

    Instantiate with:
            POP3(hostname, port=110)

    NB:     the POP protocol locks the mailbox from user
            authorization until QUIT, so be sure to get in, suck
            the messages, and quit, each time you access the
            mailbox.

            POP is a line-based protocol, which means large mail
            messages consume lots of python cycles reading them
            line-by-line.

            If it's available on your mail server, use IMAP4
            instead, it doesn't suffer from the two problems
            above.
    zUTF-8cCsP||_||_d|_t�d|||�|�|�|_|j�d�|_d|_	|�
�|_dS)NFzpoplib.connect�rbr)�host�port�_tls_established�sys�audit�_create_socket�sock�makefile�file�
_debugging�_getresp�welcome)�selfr
r�timeoutrrr�__init__bsz
POP3.__init__cCst�|j|jf|�S�N)�socketZcreate_connectionr
r)rrrrrrmszPOP3._create_socketcCs:|jdkrtdt|��t�d||�|j�|t�dS)N�z*put*zpoplib.putline)r�print�reprrrrZsendall�CRLF�r�linerrr�_putlineps
z
POP3._putlinecCs.|jrtdt|��t||j�}|�|�dS)Nz*cmd*)rrr �bytes�encodingr$r"rrr�_putcmdxszPOP3._putcmdcCs�|j�td�}t|�tkr$td��|jdkr<tdt|��|sHtd��t|�}|dd�tkrp|dd�|fS|dd�t	kr�|dd�|fS|dd�|fS)Nrz
line too longz*get*z-ERR EOF������)
r�readline�_MAXLINE�lenrrrr r!�CR)rr#�octetsrrr�_getline�s
z
POP3._getlinecCs:|��\}}|jdkr$tdt|��|�d�s6t|��|S)Nrz*resp*�+)r/rrr �
startswithr)r�resp�orrrr�s

z
POP3._getrespcCsl|��}g}d}|��\}}|dkrb|�d�rB|d}|dd�}||}|�|�|��\}}q|||fS)Nr�.s..r)rr/r1�append)rr2�listr.r#r3rrr�_getlongresp�s

zPOP3._getlongrespcCs|�|�|��Sr)r'rr"rrr�	_shortcmd�s
zPOP3._shortcmdcCs|�|�|��Sr)r'r7r"rrr�_longcmd�s
z
POP3._longcmdcCs|jSr)r�rrrr�
getwelcome�szPOP3.getwelcomecCs
||_dSr)r)r�levelrrr�set_debuglevel�szPOP3.set_debuglevelcCs|�d|�S)zVSend user name, return response

        (should indicate password required).
        zUSER %s�r8�r�userrrrr@�sz	POP3.usercCs|�d|�S)z�Send password, return response

        (response includes message count, mailbox size).

        NB: mailbox is locked by server from here to 'quit()'
        zPASS %sr>)rZpswdrrr�pass_�sz
POP3.pass_cCsF|�d�}|��}|jr&tdt|��t|d�}t|d�}||fS)z]Get mailbox status.

        Result is tuple of 2 ints (message count, mailbox size)
        ZSTATz*stat*r�)r8�splitrrr �int)rZretvalZretsZnumMessagesZsizeMessagesrrr�stat�s
z	POP3.statNcCs |dk	r|�d|�S|�d�S)aRequest listing, return result.

        Result without a message number argument is in form
        ['response', ['mesg_num octets', ...], octets].

        Result when a message number argument is given is a
        single response: the "scan listing" for that message.
        NzLIST %sZLIST�r8r9�r�whichrrrr6�s	z	POP3.listcCs|�d|�S)zoRetrieve whole message number 'which'.

        Result is in form ['response', ['line', ...], octets].
        zRETR %s�r9rGrrr�retr�sz	POP3.retrcCs|�d|�S)zFDelete message number 'which'.

        Result is 'response'.
        zDELE %sr>rGrrr�dele�sz	POP3.delecCs
|�d�S)zXDoes nothing.

        One supposes the response indicates the server is alive.
        ZNOOPr>r:rrr�noopsz	POP3.noopcCs
|�d�S)z(Unmark all messages marked for deletion.ZRSETr>r:rrr�rsetsz	POP3.rsetcCs|�d�}|��|S)zDSignoff: commit changes on server, unlock mailbox, close connection.ZQUIT)r8�close)rr2rrr�quits
z	POP3.quitcCs�z |j	}d|_	|dk	r|��W5|j}d|_|dk	r�zVz|�tj�Wn@tk
r�}z"|jtjkrxt|dd�dkrx�W5d}~XYnXW5|��XXdS)z8Close the connection without assuming anything about it.NZwinerrorri&')
rrNZshutdownrZ	SHUT_RDWR�OSError�errnoZENOTCONN�getattrr)rr�excrrrrrNs �z
POP3.closecCs|�d|�S)zNot sure what this does.zRPOP %sr>r?rrr�rpop5sz	POP3.rpops\+OK.[^<]*(<.*>)cCs\t||j�}|j�|j�}|s&td��ddl}|�d�|}|�|��	�}|�
d||f�S)aAuthorisation

        - only possible if server has supplied a timestamp in initial greeting.

        Args:
                user     - mailbox user;
                password - mailbox password.

        NB: mailbox is locked by server from here to 'quit()'
        z!-ERR APOP not supported by serverrNrz
APOP %s %s)r%r&�	timestamp�matchrr�hashlib�groupZmd5Z	hexdigestr8)rr@ZpasswordZsecret�mrWZdigestrrr�apop<sz	POP3.apopcCs|�d||f�S)z�Retrieve message header of message number 'which'
        and first 'howmuch' lines of message body.

        Result is in form ['response', ['line', ...], octets].
        z	TOP %s %srI)rrHZhowmuchrrr�topQszPOP3.topcCs |dk	r|�d|�S|�d�S)z�Return message digest (unique id) list.

        If 'which', result contains unique id for that message
        in the form 'response mesgnum uid', otherwise result is
        the list ['response', ['mesgnum uid', ...], octets]
        NzUIDL %sZUIDLrFrGrrr�uidlZsz	POP3.uidlcCs
|�d�S)zITry to enter UTF-8 mode (see RFC 6856). Returns server response.
        ZUTF8r>r:rrr�utf8fsz	POP3.utf8c	
Cspdd�}i}z4|�d�}|d}|D]}||�\}}|||<q$Wn*tk
rj}ztd��W5d}~XYnX|S)aReturn server capabilities (RFC 2449) as a dictionary
        >>> c=poplib.POP3('localhost')
        >>> c.capa()
        {'IMPLEMENTATION': ['Cyrus', 'POP3', 'server', 'v2.2.12'],
         'TOP': [], 'LOGIN-DELAY': ['0'], 'AUTH-RESP-CODE': [],
         'EXPIRE': ['NEVER'], 'USER': [], 'STLS': [], 'PIPELINING': [],
         'UIDL': [], 'RESP-CODES': []}
        >>>

        Really, according to RFC 2449, the cyrus folks should avoid
        having the implementation split into multiple arguments...
        cSs"|�d���}|d|dd�fS)N�asciirr)�decoderC)r#Zlstrrr�	_parsecapyszPOP3.capa.<locals>._parsecapZCAPArz!-ERR CAPA not supported by serverN)r9r)	rr`�capsr2ZrawcapsZcaplineZcapnmZcapargsZ_errrrr�capals

z	POP3.capacCsxtstd��|jrtd��|��}d|kr2td��|dkrBt��}|�d�}|j|j|j	d�|_|j�
d�|_d|_|S)	z{Start a TLS session on the active connection as specified in RFC 2595.

                context - a ssl.SSLContext
        z-ERR TLS support missing�$-ERR TLS session already establishedZSTLSz!-ERR STLS not supported by serverN�Zserver_hostnamerT)�HAVE_SSLrrrb�ssl�_create_stdlib_contextr8�wrap_socketrr
rr)r�contextrar2rrr�stls�s 
�z	POP3.stls)N)N)N)'rrr�__doc__r&�	POP3_PORTr�_GLOBAL_DEFAULT_TIMEOUTrrr$r'r/rr7r8r9r;r=r@rArEr6rJrKrLrMrOrNrT�re�compilerUrZr[r\r]rbrjrrrrr3sB+�





	
c@s8eZdZdZeddejdfdd�Zdd�Zd	dd�Z	dS)
�POP3_SSLaPOP3 client class over SSL connection

        Instantiate with: POP3_SSL(hostname, port=995, keyfile=None, certfile=None,
                                   context=None)

               hostname - the hostname of the pop3 over ssl server
               port - port number
               keyfile - PEM formatted file that contains your private key
               certfile - PEM formatted certificate chain file
               context - a ssl.SSLContext

        See the methods of the parent class POP3 for more documentation.
        NcCs�|dk	r|dk	rtd��|dk	r0|dk	r0td��|dk	s@|dk	rVddl}|�dtd�||_||_|dkrxtj||d�}||_t	�
||||�dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadrB)�certfile�keyfile)�
ValueError�warnings�warn�DeprecationWarningrrrqrfrgrirr)rr
rrrrqrrirtrrrr�s$��zPOP3_SSL.__init__cCs"t�||�}|jj||jd�}|S)Nrd)rrrirhr
)rrrrrrr�s
�zPOP3_SSL._create_socketcCstd��dS)z�The method unconditionally raises an exception since the
            STLS command doesn't make any sense on an already established
            SSL/TLS session.
            rcN)r)rrrrqrirrrrj�sz
POP3_SSL.stls)NNN)
rrrrk�
POP3_SSL_PORTrrmrrrjrrrrrp�s�
rp�__main__rrB�zMessage %d:z   z-----------------------)'rkrQrnrrrfre�ImportError�__all__�	Exceptionrrlrwr-ZLFr!r+rrpr5r�argv�arr;r@rAr6rEZnumMsgsZ	totalSize�range�irJ�header�msgr.r#rOrrrr�<module>sL
n0

csv.cpython-38.opt-1.pyc000064400000027210150335716500010735 0ustar00U

e5d?�@s@dZddlZddlmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZddlmZddlmZdddd	d
ddd
dddddddddddddgZGdd�d�ZGdd
�d
e�Zed
e�Gdd�de�Zede�Gdd�de�Zed e�Gd!d�d�ZGd"d�d�ZzeWnek
�r,eZYnXGd#d�d�ZdS)$z+
csv.py - read/write/investigate CSV files
�N)�Error�__version__�writer�reader�register_dialect�unregister_dialect�get_dialect�
list_dialects�field_size_limit�
QUOTE_MINIMAL�	QUOTE_ALL�QUOTE_NONNUMERIC�
QUOTE_NONE�__doc__)�Dialect)�StringIOrrr
rrrr�excel�	excel_tabr
rrrrr	�Snifferrr�
DictReader�
DictWriter�unix_dialectc@sDeZdZdZdZdZdZdZdZdZ	dZ
dZdZdd�Z
dd�ZdS)	rz�Describe a CSV dialect.

    This must be subclassed (see csv.excel).  Valid attributes are:
    delimiter, quotechar, escapechar, doublequote, skipinitialspace,
    lineterminator, quoting.

    �FNcCs|jtkrd|_|��dS)NT)�	__class__r�_valid�	_validate��self�r�/usr/lib64/python3.8/csv.py�__init__*s
zDialect.__init__c
Cs@zt|�Wn.tk
r:}ztt|���W5d}~XYnXdS�N)�_Dialect�	TypeErrorr�str)r�errrr/szDialect._validate)�__name__�
__module__�__qualname__r�_namer�	delimiter�	quotecharZ
escapechar�doublequote�skipinitialspace�lineterminator�quotingr rrrrrrsc@s(eZdZdZdZdZdZdZdZe	Z
dS)rz;Describe the usual properties of Excel-generated CSV files.�,�"TF�
N)r&r'r(rr*r+r,r-r.rr/rrrrr6sc@seZdZdZdZdS)rzEDescribe the usual properties of Excel-generated TAB-delimited files.�	N)r&r'r(rr*rrrrr@sz	excel-tabc@s(eZdZdZdZdZdZdZdZe	Z
dS)rz:Describe the usual properties of Unix-generated CSV files.r0r1TF�
N)r&r'r(rr*r+r,r-r.rr/rrrrrEsZunixc@s@eZdZddd�Zdd�Zedd��Zejd	d��Zd
d�ZdS)
rNrcOs6||_||_||_t||f|�|�|_||_d|_dS�Nr)�_fieldnames�restkey�restvalr�dialect�line_num)r�f�
fieldnamesr7r8r9�args�kwdsrrrr QszDictReader.__init__cCs|Sr!rrrrr�__iter__ZszDictReader.__iter__cCs@|jdkr0zt|j�|_Wntk
r.YnX|jj|_|jSr!)r6�nextr�
StopIterationr:rrrrr<]s

zDictReader.fieldnamescCs
||_dSr!)r6)r�valuerrrr<gscCs�|jdkr|jt|j�}|jj|_|gkr8t|j�}q$tt|j|��}t|j�}t|�}||krv||d�||j<n&||kr�|j|d�D]}|j||<q�|Sr5)	r:r<r@r�dict�zip�lenr7r8)r�row�dZlfZlr�keyrrr�__next__ks



zDictReader.__next__)NNNr)	r&r'r(r r?�propertyr<�setterrIrrrrrPs�
	
	
c@s6eZdZddd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)rr�raisercOsB||_||_|��dkr$td|��||_t||f|�|�|_dS)N)rL�ignorez-extrasaction (%s) must be 'raise' or 'ignore')r<r8�lower�
ValueError�extrasactionr)rr;r<r8rPr9r=r>rrrr �s�zDictWriter.__init__cCstt|j|j��}|�|�Sr!)rCrDr<�writerow)r�headerrrr�writeheader�szDictWriter.writeheadercsN�jdkr8����j}|r8tdd�dd�|D������fdd��jD�S)NrLz(dict contains fields not in fieldnames: z, cSsg|]}t|��qSr)�repr)�.0�xrrr�
<listcomp>�sz,DictWriter._dict_to_list.<locals>.<listcomp>c3s|]}��|�j�VqdSr!)�getr8)rUrH��rowdictrrr�	<genexpr>�sz+DictWriter._dict_to_list.<locals>.<genexpr>)rP�keysr<rO�join)rrZZwrong_fieldsrrYr�
_dict_to_list�s
�zDictWriter._dict_to_listcCs|j�|�|��Sr!)rrQr^)rrZrrrrQ�szDictWriter.writerowcCs|j�t|j|��Sr!)r�	writerows�mapr^)rZrowdictsrrrr_�szDictWriter.writerowsN)rrLr)r&r'r(r rSr^rQr_rrrrr�s�

c@s:eZdZdZdd�Zd
dd�Zdd�Zd	d
�Zdd�ZdS)rze
    "Sniffs" the format of a CSV file (i.e. delimiter, quotechar)
    Returns a Dialect object.
    cCsdddddg|_dS)Nr0r3�;� �:)�	preferredrrrrr �szSniffer.__init__NcCsd|�||�\}}}}|s(|�||�\}}|s4td��Gdd�dt�}||_||_|pVd|_||_|S)zI
        Returns a dialect (or None) corresponding to the sample
        zCould not determine delimiterc@seZdZdZdZeZdS)zSniffer.sniff.<locals>.dialectZsniffedr2N)r&r'r(r)r.rr/rrrrr9�sr9r1)�_guess_quote_and_delimiter�_guess_delimiterrrr,r*r+r-)r�sample�
delimitersr+r,r*r-r9rrr�sniff�s
�
�
z
Sniffer.sniffc	Cs�g}dD]*}t�|tjtjB�}|�|�}|rq4q|s<dSi}i}d}|j}	|D]�}
|	dd}|
|}|r�|�|d�d||<z|	dd}|
|}Wntk
r�YqRYnX|r�|dks�||kr�|�|d�d||<z|	dd}Wntk
�rYqRYnX|
|rR|d7}qRt||jd	�}
|�rXt||jd	�}|||k}|d
k�r`d}nd}d}t�dt�	|�|
d
�tj�}|�
|��r�d}nd}|
|||fS)a�
        Looks for text enclosed between two identical quotes
        (the probable quotechar) which are preceded and followed
        by the same character (the probable delimiter).
        For example:
                         ,'some text',
        The quote with the most wins, same with the delimiter.
        If there is no quotechar the delimiter can't be determined
        this way.
        )zI(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)zG(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)zG(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\n)z-(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?:$|\n))rFNrr�quote��delimNZspace�rHr4rz]((%(delim)s)|^)\W*%(quote)s[^%(delim)s\n]*%(quote)s[^%(delim)s\n]*%(quote)s\W*((%(delim)s)|$))rlrjTF)�re�compile�DOTALL�	MULTILINE�findall�
groupindexrX�KeyError�max�escape�search)r�datarhZmatchesZrestrZregexpZquotes�delimsZspacesrs�m�nrHr+rlr-Z	dq_regexpr,rrrre�s`




��z"Sniffer._guess_quote_and_delimitercCsttd|�d���}dd�td�D�}tdt|��}d}i}i}i}d|}	}
|	t|�k�rR|d7}||	|
�D]@}|D]6}|�|i�}
|�|�}|
�|d�d|
|<|
||<qxqp|��D]�}t||�	��}t|�dkr�|dddkr�q�t|�dk�rLt
|d	d
�d�||<|�||�||d||dtdd
�|D��f||<q�|d||<q�|�	�}t
t||t|���}d}d}t|�dk�r�||k�r�|D]T\}}|ddk�r�|ddk�r�|d||k�r�|dk�s�||k�r�|||<�q�|d8}�q�t|�dk�rDt|���d}|d�|�|d�d|�k}||fS|
}	|
|7}
qN|�s\dSt|�dk�r�|jD]@}||��k�rp|d�|�|d�d|�k}||fS�qpdd�|�	�D�}|��|dd}|d�|�|d�d|�k}||fS)a�
        The delimiter /should/ occur the same number of times on
        each row. However, due to malformed data, it may not. We don't want
        an all or nothing approach, so we allow for small variations in this
        number.
          1) build a table of the frequency of each character on every line.
          2) build a table of frequencies of this frequency (meta-frequency?),
             e.g.  'x occurred 5 times in 10 rows, 6 times in 1000 rows,
             7 times in 2 rows'
          3) use the mode of the meta-frequency to determine the /expected/
             frequency for that character
          4) find out how often the character actually meets that goal
          5) the character that best meets its goal is the delimiter
        For performance reasons, the data is evaluated in chunks, so it can
        try and evaluate the smallest portion of the data possible, evaluating
        additional chunks as necessary.
        Nr4cSsg|]}t|��qSr)�chr)rU�crrrrW-sz,Sniffer._guess_delimiter.<locals>.<listcomp>��
rrkcSs|dS)Nrkr)rVrrr�<lambda>G�z*Sniffer._guess_delimiter.<locals>.<lambda>rmcss|]}|dVqdS)rkNr)rU�itemrrrr[Lsz+Sniffer._guess_delimiter.<locals>.<genexpr>g�?g�������?g{�G�z�?z%c )rrcSsg|]\}}||f�qSrr)rU�k�vrrrrWvs���)�list�filter�split�range�minrErX�countr\�itemsru�remove�sum�floatrd�sort)rrxrh�asciiZchunkLengthZ	iterationZ
charFrequencyZmodesry�start�end�line�charZ
metaFrequencyZfreqr�ZmodeListZtotalZconsistencyZ	thresholdr�r�rlr-rGrrrrfs�

����

��zSniffer._guess_delimiterc
Cs�tt|�|�|��}t|�}t|�}i}t|�D]}d||<q0d}|D]�}|dkrVq�|d7}t|�|krlqFt|���D]x}	tt	t
fD]4}
z|
||	�Wq�Wq�ttfk
r�Yq�Xq�t||	�}
|
||	krx||	dkr�|
||	<qx||	=qxqFd}|�
�D]~\}	}t|�td�k�r@t||	�|k�r6|d7}n|d8}n<z|||	�Wn"ttfk
�rr|d7}Yn
X|d8}�q|dkS)Nr�rk)rrrir@rEr�r�r\�intr��complexrO�
OverflowErrorr��typer#)
rrgZrdrrR�columnsZcolumnTypes�i�checkedrF�colZthisTypeZ	hasHeaderZcolTyperrr�
has_headersJ






zSniffer.has_header)N)	r&r'r(rr rirerfr�rrrrr�s
Lg)rrnZ_csvrrrrrrrr	r
rrr
rrr"�ior�__all__rrrrrr��	NameErrorr�rrrrr�<module>sJ@�


2
pdb.cpython-38.pyc000064400000134174150335716500007760 0ustar00U

e5d��"@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZGdd�de�Zddddd	d
ddd
g	Zdd�Zdd�Zdd�ZGdd�de�ZdZGdd�dejej�Zedk	�rnd
ddddddddd d!d"d#d$d%d&d'd(dd)d*d+d,d-d.d/d0d1d2d3d4d5d6d7g"ZeD]"Zeeed8e�j��d97Z�q:eej j7Z[[dJd:d�Z!dKd;d�Z"d<d	�Z#d=d
�Z$dd>�d?d�Z%dLd@d�Z&dAd�Z'dBZ(dCdD�Z)dEd
�Z*dFZ+dGdH�Z,e-dIk�r�ddl.Z.e.�,�dS)Ma�	
The Python Debugger Pdb
=======================

To use the debugger in its simplest form:

        >>> import pdb
        >>> pdb.run('<a statement>')

The debugger's prompt is '(Pdb) '.  This will stop in the first
function call in <a statement>.

Alternatively, if a statement terminated with an unhandled exception,
you can use pdb's post-mortem facility to inspect the contents of the
traceback:

        >>> <a statement>
        <exception traceback>
        >>> import pdb
        >>> pdb.pm()

The commands recognized by the debugger are listed in the next
section.  Most can be abbreviated as indicated; e.g., h(elp) means
that 'help' can be typed as 'h' or 'help' (but not as 'he' or 'hel',
nor as 'H' or 'Help' or 'HELP').  Optional arguments are enclosed in
square brackets.  Alternatives in the command syntax are separated
by a vertical bar (|).

A blank line repeats the previous command literally, except for
'list', where it lists the next 11 lines.

Commands that the debugger doesn't recognize are assumed to be Python
statements and are executed in the context of the program being
debugged.  Python statements can also be prefixed with an exclamation
point ('!').  This is a powerful way to inspect the program being
debugged; it is even possible to change variables or call functions.
When an exception occurs in such a statement, the exception name is
printed but the debugger's state is not changed.

The debugger supports aliases, which can save typing.  And aliases can
have parameters (see the alias help entry) which allows one a certain
level of adaptability to the context under examination.

Multiple commands may be entered on a single line, separated by the
pair ';;'.  No intelligence is applied to separating the commands; the
input is split at the first ';;', even if it is in the middle of a
quoted string.

If a file ".pdbrc" exists in your home directory or in the current
directory, it is read in and executed as if it had been typed at the
debugger prompt.  This is particularly useful for aliases.  If both
files exist, the one in the home directory is read first and aliases
defined there can be overridden by the local file.  This behavior can be
disabled by passing the "readrc=False" argument to the Pdb constructor.

Aside from aliases, the debugger is not directly programmable; but it
is implemented as a class from which you can derive your own debugger
class, which you can make as fancy as you like.


Debugger commands
=================

�Nc@seZdZdZdS)�RestartzBCauses a debugger to be restarted for the debugged python program.N)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.8/pdb.pyrWsr�run�pm�Pdb�runeval�runctx�runcall�	set_trace�post_mortem�helpc
Cs�t�dt�|��}zt�|�}Wntk
r8YdSX|�@t|dd�D],\}}|�|�rL|||fW5QR�SqLW5QRXdS)Nzdef\s+%s\s*[(]�)�start)�re�compile�escape�tokenize�open�OSError�	enumerate�match)�funcname�filenameZcre�fp�lineno�linerrr�
find_function^s
&r!cCsXt�|�\}}t�|�r,|j|jkr,|dfSt�|�r>|dfSt�||d��|dfS)Nr)�inspectZ
findsourceZisframe�	f_globals�f_localsZismoduleZgetblock)�obj�linesrrrr�getsourcelinesks
r'cCs8tt�|��}|��|D]\}}||kr|SqdS�Nr)�list�disZfindlinestarts�reverse)�codeZlastiZ
linestarts�irrrr�lasti2linenots
r.c@seZdZdZdd�ZdS)�_rstrz#String that doesn't quote its repr.cCs|S�Nr��selfrrr�__repr__sz_rstr.__repr__N)rrrrr3rrrrr/}sr/z
-> c@seZdZdZd�dd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�ZeZd�d8d9�Zd:d;�ZeZ eZ!eZ"d<d=�Z#eZ$d>d?�Z%d@dA�Z&dBdC�Z'eZ(dDdE�Z)eZ*dFdG�Z+eZ,dHdI�Z-eZ.dJdK�Z/e/Z0eZ1eZ2dLdM�Z3e3Z4e3Z5dNdO�Z6dPdQ�Z7e7Z8dRdS�Z9e9Z:dTdU�Z;e;Z<dVdW�Z=e=Z>dXdY�Z?e?Z@dZd[�ZAeAZBd\d]�ZCeCZDd^d_�ZEeEZFZGd`da�ZHeHZIdbdc�ZJeZKddde�ZLeLZMeLZNdfdg�ZOdhdi�ZPePZQdjdk�ZReRZSdldm�ZTd�dndo�ZUdpdq�ZVdrds�ZWeZXeZYeZZdtdu�Z[e[Z\dvdw�Z]e]Z^dxdy�Z_eZ`d�d{d|�Zad}d~�ZbeZcdd��ZdeZed�d��Zfd�d��Zgd�d��Zhd�d��Zid�d��Zjd�d��Zkd�d�d�d�d�d�gZld�d��Zmenfd�d��Zod�d��ZpepZqd�d��Zrd�d��Zsd�d��Ztd�d��Zud�d��ZvdS)�rN�tabFTc		Cs>tjj||d�tj�||||�t�d�|r6d|_d|_i|_	i|_
d|_d|_i|_
zddl}|�d�Wntk
r�YnXd|_||_g|_|�rz,ttj�d���}|j�|�W5QRXWntk
r�YnXz$td	��}|j�|�W5QRXWntk
�rYnXi|_i|_i|_d|_d|_dS)
N)�skipzpdb.Pdbrz(Pdb) �Fz 	
`@#$%^&*()=+[{]}\|;:'",<>?z~/.pdbrcz.pdbrc)�bdb�Bdb�__init__�cmd�Cmd�sys�auditZuse_rawinput�prompt�aliases�
displaying�
mainpyfile�_wait_for_mainpyfile�	tb_lineno�readlineZset_completer_delims�ImportError�allow_kbdint�nosigint�rcLinesr�os�path�
expanduser�extendr�commands�commands_doprompt�commands_silent�commands_defining�
commands_bnum)	r2�completekey�stdin�stdoutr5rGZreadrcrDZrcFilerrrr9�sF

zPdb.__init__cCs*|jr
t�|�d�|��|�|�dS)Nz-
Program interrupted. (Use 'cont' to resume).)rF�KeyboardInterrupt�message�set_stepr)r2Zsignum�framerrr�sigint_handler�s

zPdb.sigint_handlercCstj�|�|��dSr0)r7r8�reset�forgetr1rrrrZ�sz	Pdb.resetcCs&d|_g|_d|_d|_|j��dSr()r�stack�curindex�curframerC�clearr1rrrr[�s
z
Pdb.forgetcCsh|��|�||�\|_|_|rDt|jj|j�}||j|j<|j	}q|j|jd|_
|j
j|_|�
�Sr()r[Z	get_stackr\r]r.�tb_frame�f_code�tb_lastirC�tb_nextr^r$�curframe_locals�execRcLines)r2�f�tbrrrr�setup�s
z	Pdb.setupcCsd|js
dS|j}|��g|_|r`|����}|r|ddkr|�|�r|jt|�7_dSqdS)Nr�#T)rHr+�pop�strip�onecmd�reversed)r2rHr rrrre�s
zPdb.execRcLinescCs.|jr
dS|�|�r*|�d�|�|d�dS)znThis method is called when there is the remote possibility
        that we ever need to stop in this function.Nz--Call--)rBZ	stop_hererV�interaction)r2rXZ
argument_listrrr�	user_call�s


z
Pdb.user_callcCsH|jr.|j|�|jj�ks$|jdkr(dSd|_|�|�rD|�|d�dS)z;This function is called when we stop or break at this line.rNF)rBrA�canonicra�co_filename�f_lineno�bp_commandsrn)r2rXrrr�	user_line�s�
z
Pdb.user_linecCs�t|dd�r�|j|jkr�|j}d|_|j}|�|d�|j|D]}|�|�q@||_|j|sr|�|j|j	�|j
|r�|��|��dSdS)z�Call every command that was set for the current active breakpoint
        (if there is one).

        Returns True if the normal interaction function must be called,
        False otherwise.�	currentbpFrNr)
�getattrrurM�lastcmdrhrlrO�print_stack_entryr\r]rN�_cmdloopr[)r2rXruZlastcmd_backr rrrrss"
�

zPdb.bp_commandscCs.|jr
dS||jd<|�d�|�|d�dS)z7This function is called when a return trap is set here.N�
__return__z
--Return--)rBr$rVrn)r2rXZreturn_valuerrr�user_return s


zPdb.user_returncCsh|jr
dS|\}}}||f|jd<|s2|tkr2dnd}|�d|t�||�d��f�|�||�dS)zoThis function is called if an exception occurs,
        but only if we are to stop at or just below this level.NZ
__exception__z	Internal r6z%s%s���)rBr$�
StopIterationrV�	traceback�format_exception_onlyrkrn)r2rX�exc_info�exc_type�	exc_value�
exc_traceback�prefixrrr�user_exception(s
���zPdb.user_exceptioncCsBzd|_|��d|_Wq>Wqtk
r:|�d�YqXqdS)NTFz--KeyboardInterrupt--)rF�cmdlooprUrVr1rrrry<szPdb._cmdloopcCs^|j�|j�}|rZ|��D]>\}}|�|�}||k	r||kr|||<|�d|||f�qdS)Nzdisplay %s: %r  [old: %r])r@�getr^�items�_getval_exceptrV)r2r@�exprZoldvalueZnewvaluerrr�preloopIs
�zPdb.preloopcCsttjr6zt�tjtj�Wntk
r.YnXdt_|�||�rN|��dS|�|j|j	�|�
�|��dSr0)r�_previous_sigint_handler�signal�SIGINT�
ValueErrorrhr[rxr\r]ry)r2rXr~rrrrnVszPdb.interactioncCs|dk	r|�t|��dS)z{Custom displayhook for the exec in default(), which prevents
        assignment of the _ variable in the builtins.
        N)rV�repr)r2r%rrr�displayhookhszPdb.displayhookc	Cs�|dd�dkr|dd�}|j}|jj}zdt|ddd�}tj}tj}tj}z(|jt_|jt_|jt_t|||�W5|t_|t_|t_XWn4t�	�dd�}|�
tj|�d�
��YnXdS)Nr�!�
z<stdin>Zsingle�r|)rdr^r#rr<rTrSr��execr��errorr~rrk)	r2r �locals�globalsr,Zsave_stdoutZ
save_stdinZsave_displayhookr�rrr�defaultps(zPdb.defaultcCs�|��s|S|��}|d|jkr�|j|d}d}|dd�D] }|�dt|�|�}|d7}q@|�dd�|dd���}|��}q|ddkr�|�d�}|dkr�||d	d���}|j�	|�|d|��
�}|S)
z*Handle alias expansion and ';;' separator.rrN�%z%*� �aliasz;;r�)rk�splitr?�replace�str�join�find�lstrip�cmdqueue�append�rstrip)r2r �argsZiiZtmpArgZmarker�nextrrr�precmd�s(�


z
Pdb.precmdcCs"|jstj�||�S|�|�SdS)z�Interpret the argument as though it had been typed in response
        to the prompt.

        Checks whether this line is typed at the normal prompt or in
        a breakpoint command list definition.
        N)rPr:r;rl�handle_command_def)r2r rrrrl�sz
Pdb.onecmdcCs�|�|�\}}}|sdS|dkr0d|j|j<dS|dkrBg|_dS|j|j}|rf|�|d|�n
|�|�zt|d|�}Wntk
r�|j}YnX|j	|j
kr�d|j|j<g|_dSdS)	z8Handles one command line during command list definition.NZsilentT�endrr��do_F)Z	parselinerOrQr�rMr�rv�AttributeErrorr�r�commands_resumingrN)r2r r:�argZcmdlist�funcrrrr��s,
zPdb.handle_command_defcCst||jd�dS)N��file��printrT�r2�msgrrrrV�szPdb.messagecCstd||jd�dS)Nz***r�r�r�rrrr��sz	Pdb.errorcCs�|���d�rgSz|�||||�}Wntk
r>g}YnXt�t�|�d�}|D]H}tj�|�rx|�	|d�qXtj�
|�rX|���d�rX|�	|d�qX|S)N)�:�,�*�/)�.pyz.pywr�)rk�endswith�_complete_expression�	Exception�globrrIrJ�isdirr��isfile�lower)r2�textr �begidx�endidxZret�globs�fnrrr�_complete_location�s
zPdb._complete_locationcs�fdd�ttjj�D�S)Ncs.g|]&\}}|dk	rt|����rt|��qSr0)r��
startswith)�.0r-�bp�r�rr�
<listcomp>�s�z*Pdb._complete_bpnumber.<locals>.<listcomp>)rr7�
Breakpoint�
bpbynumber�r2r�r r�r�rr�r�_complete_bpnumber�szPdb._complete_bpnumberc	s�|js
gS|jj|j�}d�kr���d��z,|�d}�dd�D]}t||�}qDWnttfk
rrgYSXd��dd��d���fdd�t|�D�S�fdd�|�	�D�SdS)N�.rrr|cs"g|]}|��d�r�|�qS)r|�r��r��n)�dottedr�rrr�sz,Pdb._complete_expression.<locals>.<listcomp>csg|]}|���r|�qSrr�r�r�rrr�s
)
r^r#rdr�rv�KeyErrorr�r��dir�keys)r2r�r r�r��nsr%�partr)r�r�r�rr��s

zPdb._complete_expressioncCs,|sttjj�d}n&zt|�}Wn|�d�YdSX||_||jkrj|j||j||j	|f}nd}g|j|<d|j|<d|j	|<|j
}d|_
d|_zzz|��Wnht
k
�r|r�|d|j|<|d|j|<|d|j	|<n|j|=|j|=|j	|=|�d	�YnXW5d|_||_
XdS)
a4commands [bpnumber]
        (com) ...
        (com) end
        (Pdb)

        Specify a list of commands for breakpoint number bpnumber.
        The commands themselves are entered on the following lines.
        Type a line containing just 'end' to terminate the commands.
        The commands are executed when the breakpoint is hit.

        To remove all commands from a breakpoint, type commands and
        follow it immediately with end; that is, give no commands.

        With no bpnumber argument, commands refers to the last
        breakpoint set.

        You can use breakpoint commands to start your program up
        again.  Simply use the continue command, or step, or any other
        command that resumes execution.

        Specifying any command resuming execution (currently continue,
        step, next, return, jump, quit and their abbreviations)
        terminates the command list (as if that command was
        immediately followed by end).  This is because any time you
        resume execution (even with a simple next or step), you may
        encounter another breakpoint -- which could have its own
        command list, leading to ambiguities about which list to
        execute.

        If you use the 'silent' command in the command list, the usual
        message about stopping at a breakpoint is not printed.  This
        may be desirable for breakpoints that are to print a specific
        message and then continue.  If none of the other commands
        print anything, you will see no sign that the breakpoint was
        reached.
        rz.Usage: commands [bnum]
        ...
        endNTFz(com) rr�z1command definition aborted, old commands restored)�lenr7r�r��intr�rQrMrNrOr>rPr�rU)r2r�ZbnumZold_command_defsZprompt_backrrr�do_commands	sB%

�


zPdb.do_commandsrc
CsB|s8|jr4|�d�tjjD]}|r|�|���qdSd}d}d}|�d�}|dkrz||dd���}|d|���}|�	d�}d}	|dk�r|d|���}|�
|�}
|
s�|�d|�dS|
}||dd���}zt|�}Wn&t
k
�r|�d|�YdSXn�zt|�}Wn�t
k
�r�zt||jj|j�}Wn|}YnXz.t|d	��rj|j}|j}|j}	|j}|j}WnD|�|�\}
}}|
�s�|�d
|�YYdS|
}	t|�}YnXYnX|�s�|��}|�||�}|�r>|�|||||	�}|�r|�|�n*|�||�d}|�d|j|j|jf�dS)
a�b(reak) [ ([filename:]lineno | function) [, condition] ]
        Without argument, list all breaks.

        With a line number argument, set a break at this line in the
        current file.  With a function name, set a break at the first
        executable line of that function.  If a second argument is
        present, it is a string specifying an expression which must
        evaluate to true before the breakpoint is honored.

        The line number may be prefixed with a filename and a colon,
        to specify a breakpoint in another file (probably one that
        hasn't been loaded yet).  The file is searched for on
        sys.path; the .py suffix may be omitted.
        z!Num Type         Disp Enb   WhereNr�rrr�z%r not found from sys.pathzBad lineno: %s�__func__zJThe specified object %r is not a function or was not found along sys.path.r|zBreakpoint %d at %s:%d) �breaksrVr7r�r�Zbpformatr�r�r��rfind�lookupmoduler�r�r��evalr^r#rd�hasattrr��__code__�co_name�co_firstlinenorq�lineinfo�defaultFile�	checklineZ	set_break�
get_breaks�numberr�r )r2r�Z	temporaryr�rr�condZcommaZcolonrrfr�r,�okZlnr �errrrr�do_breakXs�





�

��zPdb.do_breakcCs"|jjj}|dkr|jr|j}|S)zProduce a reasonable default.z<string>)r^rarqrA)r2rrrrr��s
zPdb.defaultFilecCs|�|d�dS)z�tbreak [ ([filename:]lineno | function) [, condition] ]
        Same arguments as break, but sets a temporary breakpoint: it
        is automatically deleted when first hit.
        rN)r��r2r�rrr�	do_tbreak�sz
Pdb.do_tbreakc
Cs�d}|�d�}t|�dkr(|d��}nt|�dkrB|d��}n|S|dkrR|S|�d�}|ddkr~|d=t|�dkr~|S|��}t|�dkr�|d}n|�|d�}|r�|}|d}t||�}	|	p�|S)	N)NNN�'rr�r6r�r2)r�r�rkr�r�r!)
r2Z
identifierZfailedZidstring�id�partsZfname�itemrfZanswerrrrr��s.



zPdb.lineinfocCs�t|d�r|jjnd}t�|||�}|s6|�d�dS|��}|rn|ddksn|dd�dksn|dd�dkr||�d	�dS|S)
z�Check whether specified line seems to be executable.

        Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank
        line or EOF). Warning: testing is not comprehensive.
        r^NzEnd of filerrir�z"""z'''zBlank or comment)r�r^r#�	linecache�getlinerVrkr�)r2rrr�r rrrr��s
��
z
Pdb.checklinecCsh|��}|D]V}z|�|�}Wn,tk
rJ}z|�|�W5d}~XYqX|��|�d|�qdS)z�enable bpnumber [bpnumber ...]
        Enables the breakpoints given as a space separated list of
        breakpoint numbers.
        Nz
Enabled %s)r��get_bpbynumberr�r��enablerV�r2r�r�r-r�r�rrr�	do_enablesz
Pdb.do_enablecCsh|��}|D]V}z|�|�}Wn,tk
rJ}z|�|�W5d}~XYqX|��|�d|�qdS)aNdisable bpnumber [bpnumber ...]
        Disables the breakpoints given as a space separated list of
        breakpoint numbers.  Disabling a breakpoint means it cannot
        cause the program to stop execution, but unlike clearing a
        breakpoint, it remains in the list of breakpoints and can be
        (re-)enabled.
        NzDisabled %s)r�r�r�r��disablerVr�rrr�
do_disableszPdb.do_disablec
Cs�|�dd�}z|d}Wntk
r0d}YnXz|�|d���}WnHtk
rf|�d�YnXtk
r�}z|�|�W5d}~XYn.X||_|s�|�d|j�n|�d|j�dS)a#condition bpnumber [condition]
        Set a new condition for the breakpoint, an expression which
        must evaluate to true before the breakpoint is honored.  If
        condition is absent, any existing condition is removed; i.e.,
        the breakpoint is made unconditional.
        r�rNr�Breakpoint number expectedz#Breakpoint %d is now unconditional.z$New condition set for breakpoint %d.)	r��
IndexErrorr�rkr�r�r�rVr�)r2r�r�r�r�r�rrr�do_condition%s
zPdb.do_conditionc
Cs�|��}zt|d���}Wnd}YnXz|�|d���}WnHtk
rb|�d�Ynvtk
r�}z|�|�W5d}~XYnLX||_|dkr�|dkr�d|}nd}|�d||j	f�n|�d|j	�dS)	a�ignore bpnumber [count]
        Set the ignore count for the given breakpoint number.  If
        count is omitted, the ignore count is set to 0.  A breakpoint
        becomes active when the ignore count is zero.  When non-zero,
        the count is decremented each time the breakpoint is reached
        and the breakpoint is not disabled and any associated
        condition evaluates to true.
        rrr�Nz%d crossingsz
1 crossingz%Will ignore next %s of breakpoint %d.z-Will stop next time breakpoint %d is reached.)
r�r�rkr�rr�r��ignorerVr�)r2r�r��countr�r�Zcountstrrrr�	do_ignore@s,	

��z
Pdb.do_ignorec
Cs�|stztd�}Wntk
r(d}YnX|����}|dkrpdd�tjjD�}|��|D]}|�d|�q\dSd|k�r|�	d�}|d|�}||d	d�}zt
|�}Wntk
r�d
|}YnX|�||�}|�
||�}|r�|�|�n|D]}|�d|�q�dS|��}	|	D]\}z|�|�}Wn.tk
�r^}z|�|�W5d}~XYnX|�|�|�d|��qdS)a=cl(ear) filename:lineno
cl(ear) [bpnumber [bpnumber...]]
        With a space separated list of breakpoint numbers, clear
        those breakpoints.  Without argument, clear all breaks (but
        first ask confirmation).  With a filename:lineno argument,
        clear all breaks at that line in that file.
        zClear all breaks? Zno)�yZyescSsg|]}|r|�qSrr)r�r�rrrr�qsz Pdb.do_clear.<locals>.<listcomp>z
Deleted %sNr�rzInvalid line number (%s))�input�EOFErrorrkr�r7r�r�Zclear_all_breaksrVr�r�r�r�Zclear_breakr�r�r�Zclear_bpbynumber)
r2r�ZreplyZbplistr�r-rrr�Z
numberlistrrr�do_clearcsF



zPdb.do_clearcCs|��dS)z�w(here)
        Print a stack trace, with the most recent frame at the bottom.
        An arrow indicates the "current frame", which determines the
        context of most commands.  'bt' is an alias for this command.
        N)�print_stack_tracer�rrr�do_where�szPdb.do_wherecCs^d|krt|j�ks nt�||_|j|jd|_|jj|_|�|j|j�d|_dSr()	r�r\�AssertionErrorr]r^r$rdrxr)r2r�rrr�
_select_frame�s 
zPdb._select_framecCsz|jdkr|�d�dSzt|p"d�}Wn$tk
rL|�d|�YdSX|dkr\d}ntd|j|�}|�|�dS)z�u(p) [count]
        Move the current frame count (default one) levels up in the
        stack trace (to an older frame).
        rzOldest frameNr�Invalid frame count (%s))r]r�r�r��maxr�r2r�rZnewframerrr�do_up�s

z	Pdb.do_upcCs�|jdt|j�kr"|�d�dSzt|p,d�}Wn$tk
rV|�d|�YdSX|dkrpt|j�d}ntt|j�d|j|�}|�|�dS)z�d(own) [count]
        Move the current frame count (default one) levels down in the
        stack trace (to a newer frame).
        rzNewest frameNr
r)r]r�r\r�r�r��minrrrrr�do_down�s
zPdb.do_downcCsh|rRzt|�}Wn$tk
r4|�d|�YdSX||jjkrV|�d�dSnd}|�|j|�dS)aNunt(il) [lineno]
        Without argument, continue execution until the line with a
        number greater than the current one is reached.  With a line
        number, continue execution until a line with a number greater
        or equal to that is reached.  In both cases, also stop when
        the current frame returns.
        �Error in argument: %rNz7"until" line number is smaller than current line numberr)r�r�r�r^rrZ	set_until)r2r�rrrr�do_until�s
zPdb.do_untilcCs|��dS)z�s(tep)
        Execute the current line, stop at the first possible occasion
        (either in a function that is called or in the current
        function).
        r)rWr�rrr�do_step�szPdb.do_stepcCs|�|j�dS)zxn(ext)
        Continue execution until the next line in the current function
        is reached or it returns.
        r)Zset_nextr^r�rrr�do_next�szPdb.do_nextcCs<|r4ddl}tjdd�}|�|�t_|tjdd�<t�dS)arun [args...]
        Restart the debugged python program. If a string is supplied
        it is split with "shlex", and the result is used as the new
        sys.argv.  History, breakpoints, actions and debugger options
        are preserved.  "restart" is an alias for "run".
        rNr)�shlexr<�argvr�r)r2r�rZargv0rrr�do_run�sz
Pdb.do_runcCs|�|j�dS)zPr(eturn)
        Continue execution until the current function returns.
        r)Z
set_returnr^r�rrr�	do_returnsz
Pdb.do_returncCs>|js2zt�tj|j�t_Wntk
r0YnX|��dS)z]c(ont(inue))
        Continue execution, only stop when a breakpoint is encountered.
        r)rGr�r�rYrr�r�Zset_continuer�rrr�do_continues�zPdb.do_continuec
Cs�|jdt|j�kr"|�d�dSzt|�}Wntk
rL|�d�YnnXz:||j_|j|jd|f|j|j<|�|j|j�Wn0tk
r�}z|�d|�W5d}~XYnXdS)a�j(ump) lineno
        Set the next line that will be executed.  Only available in
        the bottom-most frame.  This lets you jump back and execute
        code again, or jump forward to skip code that you don't want
        to run.

        It should be noted that not all jumps are allowed -- for
        instance it is not possible to jump into the middle of a
        for loop or out of a finally clause.
        rz)You can only jump within the bottom frameNz)The 'jump' command requires a line numberrzJump failed: %s)	r]r�r\r�r�r�r^rrrx)r2r��errr�do_jump&s
zPdb.do_jumpcCs�t�d�|jj}|j}t|j|j|j�}d|j	�
�|_	|�d�zt�|j
|||f�Wn<tk
r�t��dd�}|�tj|�d�
��YnX|�d�t�|j�|j|_dS)z�debug code
        Enter a recursive debugger that steps through the code
        argument (which is an arbitrary expression or statement to be
        executed in the current environment).
        Nz(%s) zENTERING RECURSIVE DEBUGGERr�r|zLEAVING RECURSIVE DEBUGGER)r<�settracer^r#rdrrRrSrTr>rkrV�call_tracingr	r�r�r�r~rZtrace_dispatchrw)r2r�r�r��pr�rrr�do_debugCs


zPdb.do_debugcCsd|_|��dS)z[q(uit)
exit
        Quit from the debugger. The program being executed is aborted.
        Tr)�_user_requested_quit�set_quitr�rrr�do_quitZszPdb.do_quitcCs|�d�d|_|��dS)z=EOF
        Handles the receipt of EOF as a command.
        r6Tr)rVr"r#r�rrr�do_EOFes
z
Pdb.do_EOFcCs�|jj}|j}|j|j}|jtj@r.|d}|jtj@rB|d}t	|�D]>}|j
|}||krx|�d|||f�qJ|�d|f�qJdS)zHa(rgs)
        Print the argument list of the current function.
        rz%s = %rz%s = *** undefined ***N)r^rard�co_argcount�co_kwonlyargcount�co_flagsr"Z
CO_VARARGSZCO_VARKEYWORDS�range�co_varnamesrV)r2r��co�dictr�r-�namerrr�do_argsns
zPdb.do_argscCs.d|jkr |�t|jd��n
|�d�dS)zQretval
        Print the return value for the last return of a function.
        rzzNot yet returned!N)rdrVr�r�r�rrr�	do_retvals
z
Pdb.do_retvalcCsPzt||jj|j�WSt��dd�}|�tj|�d�	���YnXdS)Nr�r|)
r�r^r#rdr<r�r�r~rrk)r2r�r�rrr�_getval�szPdb._getvalcCsrz2|dkrt||jj|j�WSt||j|j�WSWn:t��dd�}tj|�d�	�}t
d|�YSXdS)Nr�r|z** raised %s **)r�r^r#rdr$r<r�r~rrkr/)r2r�rXr�r�rrrr��szPdb._getval_exceptcCs*z|�t|�|���WnYnXdS)z@p expression
        Print the value of the expression.
        N)rVr�r0r�rrr�do_p�szPdb.do_pcCs,z|�t�|�|���WnYnXdS)zHpp expression
        Pretty-print the value of the expression.
        N)rV�pprintZpformatr0r�rrr�do_pp�sz	Pdb.do_ppcCsfd|_d}|r�|dkr�z^d|krX|�d�\}}t|���}t|���}||krr||}nt|���}td|d�}Wq�tk
r�|�d|�YdSXn0|jdks�|dkr�td|jj	d�}n
|jd}|dkr�|d}|jj
j}|�|�}zZt
�||jj�}|�||d|�|||j�t|t|��|_t|�|k�rH|�d	�Wntk
�r`YnXdS)
a�l(ist) [first [,last] | .]

        List source code for the current file.  Without arguments,
        list 11 lines around the current line or continue the previous
        listing.  With . as argument, list 11 lines around the current
        line.  With one argument, list 11 lines starting at that line.
        With two arguments, list the given range; if the second
        argument is less than the first, it is a count.

        The current line in the current frame is indicated by "->".
        If an exception is being debugged, the line where the
        exception was originally raised or propagated is indicated by
        ">>", if it differs from the current line.
        r)Nr�r�r�r�
z[EOF])rwr�r�rkrr�r�rr^rrrarq�get_file_breaksr��getlinesr#�_print_linesrr�rVrU)r2r�Zlast�firstr�	breaklistr&rrr�do_list�s@




�zPdb.do_listc
Csp|jjj}|�|�}zt|j�\}}Wn2tk
rX}z|�|�WY�dSd}~XYnX|�||||j�dS)z\longlist | ll
        List the whole source code for the current function or frame.
        N)r^rarqr6r'rr�r8)r2r�rr:r&rr�rrr�do_longlist�s


zPdb.do_longlistc
Csvz|�|�}WnYdSXzt|�\}}Wn6ttfk
rd}z|�|�WY�dSd}~XYnX|�||�dS)z^source expression
        Try to get source code for the given object and display it.
        N)r0r'r�	TypeErrorr�r8)r2r�r%r&rr�rrr�	do_source�s
z
Pdb.do_sourcerc
Cs�|r|j}|j�|d�}nd}}t||�D]|\}}t|��d�}	t|	�dkrV|	d7}	||krh|	d7}	n|	d7}	||kr�|	d7}	n||kr�|	d7}	|�|	d|���q,d	S)
zPrint a range of lines.r|r��r��Bz->z>>�	N)	rrrCr�rr��rjustr�rVr�)
r2r&rr�rXZcurrent_linenoZ
exc_linenorr �srrrr8s 

zPdb._print_linescCs�z|�|�}WnYdSXd}z|jj}Wntk
rBYnX|r\|�d|j�dSz
|j}Wntk
rzYnX|r�|�d|j�dS|jtkr�|�d|j|j	f�dS|�t|��dS)z;whatis arg
        Print the type of the argument.
        Nz	Method %szFunction %szClass %s.%s)
r0r�r�r�rVr��	__class__�typerr)r2r��valuer,rrr�	do_whatiss.

z
Pdb.do_whatiscCsl|s8|�d�|j�|ji���D]}|�d|�q"n0|�|�}||j�|ji�|<|�d||f�dS)z�display [expression]

        Display the value of the expression if it changed, each time execution
        stops in the current frame.

        Without expression, list all display expressions for the current frame.
        zCurrently displaying:z%s: %rzdisplay %s: %rN)rVr@r�r^r�r��
setdefault)r2r�r��valrrr�
do_display<s

zPdb.do_displaycCsT|r@z|j�|ji�|=WqPtk
r<|�d|�YqPXn|j�|jd�dS)z�undisplay [expression]

        Do not display the expression any more in the current frame.

        Without expression, clear all display expressions for the current frame.
        znot displaying %sN)r@r�r^r�r�rjr�rrr�do_undisplayOszPdb.do_undisplaycs�fdd�|j�|ji�D�S)Ncsg|]}|���r|�qSrr�)r�rr�rrr�_s
�z*Pdb.complete_undisplay.<locals>.<listcomp>)r@r�r^r�rr�r�complete_undisplay^szPdb.complete_undisplaycCs |jj|j�}tjd|d�dS)z�interact

        Start an interactive interpreter whose global namespace
        contains all the (global and local) names found in the current scope.
        z
*interactive*)ZlocalN)r^r#rdr,�interact)r2r�r�rrr�do_interactbszPdb.do_interactcCs�|��}t|�dkrHt|j���}|D]}|�d||j|f�q&dS|d|jkr�t|�dkr�|�d|d|j|df�nd�|dd��|j|d<dS)acalias [name [command [parameter parameter ...] ]]
        Create an alias called 'name' that executes 'command'.  The
        command must *not* be enclosed in quotes.  Replaceable
        parameters can be indicated by %1, %2, and so on, while %* is
        replaced by all the parameters.  If no command is given, the
        current alias for name is shown. If no name is given, all
        aliases are listed.

        Aliases may be nested and can contain anything that can be
        legally typed at the pdb prompt.  Note!  You *can* override
        internal pdb commands with aliases!  Those internal commands
        are then hidden until the alias is removed.  Aliasing is
        recursively applied to the first word of the command line; all
        other words in the line are left alone.

        As an example, here are two useful aliases (especially when
        placed in the .pdbrc file):

        # Print instance variables (usage "pi classInst")
        alias pi for k in %1.__dict__.keys(): print("%1.",k,"=",%1.__dict__[k])
        # Print instance variables in self
        alias ps pi self
        rz%s = %sNrr�)r�r��sortedr?r�rVr�)r2r�r�r�r�rrr�do_aliasks"zPdb.do_aliascCs6|��}t|�dkrdS|d|jkr2|j|d=dS)z9unalias name
        Delete the specified alias.
        rN)r�r�r?)r2r�r�rrr�
do_unalias�s
zPdb.do_unaliascs�fdd�|jD�S)Ncsg|]}|���r|�qSrr�)r��ar�rrr��s
z(Pdb.complete_unalias.<locals>.<listcomp>)r?r�rr�r�complete_unalias�szPdb.complete_unaliasrrrrr$rcCs4z|jD]}|�|�qWntk
r.YnXdSr0)r\rxrU)r2�frame_linenorrrr	�s

zPdb.print_stack_tracecCs6|\}}||jkrd}nd}|�||�||��dS)Nz> z  )r^rVZformat_stack_entry)r2rTZ
prompt_prefixrXrr�rrrrx�s

�zPdb.print_stack_entrycCs�|stj�||�Sz@zt|d|�}|�WWStk
rNt|d|�}YnXWn"tk
rt|�d|�Yn0Xtjjdkr�|�d|�dS|�	|j
���dS)z�h(elp)
        Without argument, print the list of available commands.
        With a command name as argument, print help about that command.
        "help pdb" shows the full pdb documentation.
        "help exec" gives help on the ! command.
        Zhelp_r�zNo help for %rr�zJNo help for %r; please do not run Python with -OO if you need command helpN)r:r;�do_helprvr�r�r<�flags�optimizerVrr�)r2r�ZtopicZcommandrrrrU�s 
�zPdb.do_helpcCs|�|jjpd���dS)a�(!) statement
        Execute the (one-line) statement in the context of the current
        stack frame.  The exclamation point can be omitted unless the
        first word of the statement resembles a debugger command.  To
        assign to a global variable you must always prefix the command
        with a 'global' command, e.g.:
        (Pdb) global list_options; list_options = ['-l']
        (Pdb)
        r6N)rV�	help_execrrkr1rrrrX�s
z
Pdb.help_execcCs
t�dSr0)rr1rrr�help_pdb�szPdb.help_pdbcCs�tj�|�rtj�|�r|Stj�tjd|�}tj�|�rP|�|�|jkrP|Stj�|�\}}|dkrp|d}tj�|�r�|StjD]>}tj�	|�r�t�
|�}q�tj�||�}tj�|�r�|Sq�dS)z�Helper function for break/clear parsing -- may be overridden.

        lookupmodule() translates (possibly incomplete) file or module name
        into an absolute file name.
        rr6r�N)rIrJ�isabs�existsr�r<rprA�splitext�islink�readlink)r2rrf�rootZext�dirname�fullnamerrrr��s"

zPdb.lookupmodulec	Csrd|_d|_ddl}|�|�\}}}|�|j�|_ddl}|j�	�|j�
d|j|j|j|t
d��|�|�dS)NTFr�__main__)r�__file__�__package__�
__loader__�__spec__�__builtins__)rBr"�runpyZ_get_module_detailsrprqrArb�__dict__r_�update�parent�loaderrgr	)r2Zmodule_namerhZmod_nameZmod_specr,rbrrr�
_runmodule�s 
�zPdb._runmodulec	Cstddl}|j��|j�d|td��d|_|�|�|_d|_t	�
|��}d|��|jf}W5QRX|�|�dS)Nrrb)rrcrgTFzexec(compile(%r, %r, 'exec')))
rbrir_rjrgrBrprAr"�io�	open_code�readr	)r2rrbr�	statementrrr�
_runscript
s
�
�zPdb._runscript)r4NNNFT)r)N)rN)wrrrr�r9rYrZr[rhrerortrsr{r�ryr�rnr�r�r�rlr�rVr�r�r�r�r�Zcomplete_commandsr�r�Zdo_bZcomplete_breakZ
complete_br�Zcomplete_tbreakr�r�r�Zcomplete_enabler�Zcomplete_disablerZcomplete_conditionrZcomplete_ignorerZdo_clZcomplete_clearZcomplete_clr
Zdo_wZdo_btrrZdo_urZdo_drZdo_untrZdo_srZdo_nrZ
do_restartrZdo_rrZdo_cZdo_contrZdo_jr!Zcomplete_debugr$Zdo_qZdo_exitr%r.Zdo_ar/Zdo_rvr0r�r1r3Zcomplete_printZ
complete_pZcomplete_ppr;Zdo_lr<Zdo_llr>Zcomplete_sourcer8rGZcomplete_whatisrJZcomplete_displayrKrLrNrPrQrSr�r	�line_prefixrxrUZdo_hrXrYr�rmrrrrrrr�s��
/	


M
]!!.	
		1
!	#	��whereZdownZup�breakZtbreakr_r�r�rZ	conditionrM�stepr�ZuntilZjump�returnZretval�continuer)Zlonglistr�r ZppZwhatis�sourceZdisplayZ	undisplayrMr�Zunalias�debug�quitr�z

cCst��|||�dSr0)rr	�rqr�r�rrrr	<scCst��|||�Sr0)rr)Z
expressionr�r�rrrr?scCst|||�dSr0)r	r|rrrr
BscOst�j||�Sr0)rr)r��kwdsrrrrFs)�headercCs,t�}|dk	r|�|�|�t��j�dSr0)rrVrr<�	_getframe�f_back)r~�pdbrrrrIs
cCsB|dkrt��d}|dkr$td��t�}|��|�d|�dS)Nr�zAA valid traceback must be passed if no exception is being handled)r<r�r�rrZrn)�tr rrrrQscCsttj�dSr0)rr<�last_tracebackrrrrr
_szimport x; x.main()cCstt�dSr0)r	�TESTCMDrrrr�testgsr�cCsddl}|�t�dSr()�pydocZpagerr)r�rrrrksausage: pdb.py [-c command] ... [-m module | pyfile] [arg] ...

Debug the Python program given by pyfile. Alternatively,
an executable module or package to debug can be specified using
the -m switch.

Initial commands are read from .pdbrc files in your home directory
and in the current directory, if they exist.  Commands supplied with
-c are executed after commands from .pdbrc files.

To let the script run until an exception occurs, use "-c continue".
To let the script run up to a given line X in the debugged file, use
"-c 'until X'".c

Csddl}|�tjdd�dddg�\}}|s>tt�t�d�g}d}|D]B\}}|dkrltt�t��qJ|d	kr�|�|�qJ|d
krJd}qJ|d}|s�tj�	|�s�td|d
�t�d�|tjdd�<|s�tj�
|�}tj�|�tjd<t�}|j
�|�z6|�r|�|�n
|�|�|j�r*W�qtd�Wq�tk
�rrtd|d�tdd�tjdd���Yq�tk
�r�tddd�tt��d�Yq�tk
�r�t��t�d�Yq�t��td�td�t��d}	|�d|	�td|d�Yq�Xq�dS)Nrrzmhc:rzcommand=r�F)z-hz--help)z-cz	--command)z-mTzError:zdoes not existz*The program finished and will be restartedZ
Restartingzwith arguments:rAr�z/The program exited via sys.exit(). Exit status:)r�z2Uncaught exception. Entering post mortem debuggingz1Running 'cont' or 'step' will restart the programz#Post mortem debugger finished. The z will be restarted)�getoptr<rr��_usage�exitr�rIrJr[�realpathr`rrHrLrmrrr"rr��
SystemExitr��SyntaxErrorr~�	print_excrn)
r�Zoptsr�rMZ
run_as_module�optZoptargrAr�r�rrr�main~sd 



 �r�rb)NN)NN)N)/rrIrnrr<r:r7r*r,r�r2r�r"rr~r�r�r�__all__r!r'r.r�r/rsr8r;rZ_help_orderZ_commandrvrkrXr	rr
rrrr
r�r�rr�r�rr�rrrr�<module>s�C�
		*
� 


D
io.cpython-38.opt-2.pyc000064400000003657150335716500010563 0ustar00U

e5d�
�@sfdZddddddddd	d
ddd
ddddddgZddlZddlZddlmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZejZde_dZdZdZGdd�dejejd�ZGdd�deje�ZGdd	�d	eje�ZGdd�deje�Ze� e	�e
ee
eefD]Z!e� e!��qeefD]Z!e� e!��q[!zddlm"Z"Wne#k
�rVYnXe� e"�dS) z�Guido van Rossum <guido@python.org>, Mike Verdone <mike.verdone@gmail.com>, Mark Russell <mark.russell@zen.co.uk>, Antoine Pitrou <solipsis@pitrou.net>, Amaury Forgeot d'Arc <amauryfa@gmail.com>, Benjamin Peterson <benjamin@python.org>�BlockingIOError�open�	open_code�IOBase�	RawIOBase�FileIO�BytesIO�StringIO�BufferedIOBase�BufferedReader�BufferedWriter�BufferedRWPair�BufferedRandom�
TextIOBase�
TextIOWrapper�UnsupportedOperation�SEEK_SET�SEEK_CUR�SEEK_END�N)�DEFAULT_BUFFER_SIZErrrrrrrr
rrr
�IncrementalNewlineDecoderr�io��c@seZdZejjZdS)rN)�__name__�
__module__�__qualname__�_io�_IOBase�__doc__�r r �/usr/lib64/python3.8/io.pyrHs)�	metaclassc@seZdZejjZdS)rN)rrrr�
_RawIOBaserr r r r!rKsc@seZdZejjZdS)r	N)rrrr�_BufferedIOBaserr r r r!r	Nsc@seZdZejjZdS)rN)rrrr�_TextIOBaserr r r r!rQs)�_WindowsConsoleIO)$�
__author__�__all__r�abcrrrrrrrrr
rrr
rr�OpenWrapperrrrrr�ABCMetarr#rr$r	r%r�register�klassr&�ImportErrorr r r r!�<module>%sR
�@
�typing.cpython-38.opt-2.pyc000064400000131071150335716500011456 0ustar00U

e5db
�G@s�ddlmZmZddlZddlZddlZddlZddlZddlZ	ddl
Z
ddlZddlmZm
Z
mZdddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJgGZd�dLdM�ZdNdO�ZdPdQ�ZdRdS�ZdTdU�ZdVdW�ZgZdXdY�ZdZd[�ZGd\d]�d]�ZGd^d_�d_�ZGd`da�daeedKdb�Zeddcdd�ZedFdedd�Zeddfdd�Zeddgdd�Zeddhdd�Z eddidd�Z!ed
djdd�Z"Gdkd�dedKdb�Z#Gdld�deedKdb�Z$d6d
d4d8d9d3d5dddm�	Z%dndo�Z&Gdpdq�dqedKdb�Z'Gdrds�dse'dKdb�Z(Gdtd	�d	�Z)Gdudv�dv�Z*Gdwdx�dx�Z+dydzd{d|d}gZ,d~dd�d�d�d�d�d�d�d�g
Z-e,e-d�gZ.d�d��Z/d�d��Z0d�d��Z1d�d��Z2dd"ddd$dd dd&d)g
d�d�gd��Z3Gd�d��d�e�Z4Gd�d�de)e4d��Z5d�dH�Z6d�d>�Z7d�d��Z8ej9ej:ej;ej<ee
efZ=d�d�dB�Z>d�dA�Z?d�d@�Z@d�dD�ZAd�dE�ZBd�d��ZCd�dG�ZDd�d?�ZEe$d��ZFe$d��ZGe$d��ZHe$d�dKd��ZIe$d�dKd��ZJe$d�dKd��ZKe$d�dKd��ZLe$d�dKeMd��ZNe$d=eOeP�ZQd�d�d��ZReRejjSd��ZSeRejjTeI�ZTeRejjUeIeLeJf�ZUeRejjVeI�ZVeRejjWeI�ZWeRejjXeI�ZXeRejjYeI�ZYeRejjZeI�ZZeRejj[d��Z[eRejj\eI�Z\eRejj]eI�Z]e(ejj^d�dKd��Z^d�e^__eRejj`eI�ZaeRejjbeF�ZbeRejjceGeKf�ZceRejjdeGeHf�ZdeRejjeeI�ZeeRejjfeF�ZfeRejjgd��Zge(ehd�d�dKd��Zid�ei__eRejeFd�d��ZkeRejleF�ZmeReneFd�d��Z`eReoeId�d��ZpeRejjqeI�ZqeRejjreG�ZreRejjseGeKf�ZseRejjteK�ZteRejueI�ZveRejweI�ZxeReyeGeHfd�d��ZzeRej{eGeHf�Z|eRej}eGeHf�Z}eRej~eF�Z~eRejeGeHf�ZeRejj�eIeLeJf�Z�eRejj�eIeLf�Z�eReMeNd�d��Z�d�e�__e6Gd�d/�d/e5��Z�e6Gd�d-�d-e5��Z�e6Gd�d,�d,e5��Z�e6Gd�d+�d+e5��Z�e6Gd�d.�d.e5��Z�e6Gd�d*�d*e5eI��Z�e6Gd�d0�d0e5eI��Z�d�d„Z�d�Z�d�Z�Gd�dƄd�eM�Z�Gd�d:�d:e�d��Z�d�dɄZ�d�dKdʜd�d̄Z�d�d΄Z�Gd�dЄd�eM�Z�Gd�d;�d;eye�d��Z�d�dC�Z�ePZ�d�Z�Gd�dԄd�e)eQ�Z�Gd�dքd�e�eO�Z�Gd�d؄d�e�eP�Z�Gd�dڄdڃZ�e�d�e�_�e�e
j�e�j�<eRe	j�eQ�Z�eRe	j�eQ�Z�Gd�d݄d݃Ze�d�e_�ee
j�ej�<dS)��)�abstractmethod�ABCMetaN)�WrapperDescriptorType�MethodWrapperType�MethodDescriptorType�Any�Callable�ClassVar�Final�
ForwardRef�Generic�Literal�Optional�Protocol�Tuple�Type�TypeVar�Union�AbstractSet�
ByteString�	Container�ContextManager�Hashable�	ItemsView�Iterable�Iterator�KeysView�Mapping�MappingView�MutableMapping�MutableSequence�
MutableSet�Sequence�Sized�
ValuesView�	Awaitable�
AsyncIterator�
AsyncIterable�	Coroutine�
Collection�AsyncGenerator�AsyncContextManager�
Reversible�SupportsAbs�
SupportsBytes�SupportsComplex�
SupportsFloat�
SupportsIndex�SupportsInt�
SupportsRound�ChainMap�Counter�Deque�Dict�DefaultDict�List�OrderedDict�Set�	FrozenSet�
NamedTuple�	TypedDict�	Generator�AnyStr�cast�final�get_args�
get_origin�get_type_hints�NewType�
no_type_check�no_type_check_decorator�NoReturn�overload�runtime_checkable�Text�
TYPE_CHECKINGTcCs�ttf}|r|ttf}|dkr(td�St|t�r:t|�St|t�r\|j	|kr\t
|�d���t|t�rr|tt
fks~|ttfkr�t
d|�d���t|tttf�r�|St|�s�t
|�d|d�d���|S)Nz is not valid as type argumentzPlain z Got z.100�.)rrr	r
�type�
isinstance�strr�
_GenericAlias�
__origin__�	TypeError�_SpecialFormrrIr�callable)�arg�msg�is_argumentZinvalid_generic_forms�rZ�/usr/lib64/python3.8/typing.py�_type_checkxs(

�
�r\cCsRt|t�r,|jdkr|jS|j�d|j��S|dkr8dSt|tj�rJ|jSt|�S)N�builtinsrN.z...)rPrO�
__module__�__qualname__�types�FunctionType�__name__�repr)�objrZrZr[�
_type_repr�s

recs\g�|D]J}t|t�r(|�kr(��|�t|t�r|js���fdd�|jD��qt��S)Ncsg|]}|�kr|�qSrZrZ��.0�t��tvarsrZr[�
<listcomp>�sz&_collect_type_vars.<locals>.<listcomp>)rPr�appendrR�_special�extend�__parameters__�tuple)r`rhrZrir[�_collect_type_vars�s
rqcCs�t|t�s|St|j�}t|j�D]J\}}t|t�r\t|�D]\}}||kr<||||<q<q"t|||�||<q"|jtkr�tt	|�S|�
t	|��S�N)rPrR�list�__args__�	enumerater�_subs_tvarsrSrrp�	copy_with)�tprjZsubsZnew_args�arW�iZtvarrZrZr[rv�s



rvc	Cs^|jst|�d���t|�}t|j�}||krZtd||kr>dnd�d|�d|�d|����dS)Nz is not a generic classzToo ZmanyZfewz parameters for z	; actual z, expected )rorT�len)�cls�
parametersZalenZelenrZrZr[�_check_generic�s
r~cCs�g}|D]f}t|t�r.|jtkr.|�|j�qt|t�rdt|�dkrd|dtkrd|�|dd��q|�|�qt	|�}t|�t|�kr�g}|D] }||kr�|�|�|�
|�q�|}t|�S)Nr�)rPrRrSrrnrtrpr{rl�set�remove)r}�params�pZ
all_paramsZ
new_paramsrhrZrZr[�_remove_dups_flatten�s "
r�cs4t�����t��j�t�����fdd��}|S)Ncs,z�||�WStk
r YnX�||�Srr�rT��args�kwds��cached�funcrZr[�inner�s
z_tp_cache.<locals>.inner)�	functools�	lru_cache�	_cleanupsrl�cache_clear�wraps)r�r�rZr�r[�	_tp_cache�s
r�csbt|t�r|����St|t�r^t��fdd�|jD��}||jkrH|S|�|�}|j|_|S|S)Nc3s|]}t|���VqdSrr)�
_eval_type�rgry��globalns�localnsrZr[�	<genexpr>sz_eval_type.<locals>.<genexpr>)rPr�	_evaluaterRrprtrwrm)rhr�r�Zev_args�resrZr�r[r�	s



r�c@seZdZdZdd�ZdS)�_Final)�__weakref__cOsd|krtd��dS)N�_rootz&Cannot subclass special typing classesr���selfr�r�rZrZr[�__init_subclass__sz_Final.__init_subclass__N)rbr^r_�	__slots__r�rZrZrZr[r�sr�c@seZdZdd�Zdd�ZdS)�
_ImmutablecCs|SrrrZ�r�rZrZr[�__copy__%sz_Immutable.__copy__cCs|SrrrZ)r�ZmemorZrZr[�__deepcopy__(sz_Immutable.__deepcopy__N)rbr^r_r�r�rZrZrZr[r�"sr�csleZdZdZ�fdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Ze
dd��Z�ZS)rU��_nameZ_doccsBt|�dkr6t|dt�r6t|dt�r6td|����t��|�S)N�rrzCannot subclass )r{rPrQrprT�super�__new__)r|r�r���	__class__rZr[r�3s��z_SpecialForm.__new__cCs||_||_dSrrr�)r��name�docrZrZr[�__init__@sz_SpecialForm.__init__cCst|t�stS|j|jkSrr)rPrU�NotImplementedr��r��otherrZrZr[�__eq__Ds
z_SpecialForm.__eq__cCst|jf�Srr)�hashr�r�rZrZr[�__hash__Isz_SpecialForm.__hash__cCs
d|jS)N�typing.�r�r�rZrZr[�__repr__Lsz_SpecialForm.__repr__cCs|jSrrr�r�rZrZr[�
__reduce__Osz_SpecialForm.__reduce__cOstd|����dS)NzCannot instantiate r�r�rZrZr[�__call__Rsz_SpecialForm.__call__cCst|�d���dS)Nz! cannot be used with isinstance()r��r�rdrZrZr[�__instancecheck__Usz_SpecialForm.__instancecheck__cCst|�d���dS)Nz! cannot be used with issubclass()r��r�r|rZrZr[�__subclasscheck__Xsz_SpecialForm.__subclasscheck__cs�|jdkr(t||j�d��}t||f�S|jdkr�|dkrBtd��t|t�sR|f}d�t�fdd�|D��}t|�}t|�d	kr�|d
St||�S|jdkr�t|d�}t|t	d�fS|jd
kr�t||�St|�d���dS)N)r	r
z accepts only single type.rrZz Cannot take a Union of no types.z)Union[arg, ...]: each arg must be a type.c3s|]}t|��VqdSrr�r\�rgr��rXrZr[r�fsz+_SpecialForm.__getitem__.<locals>.<genexpr>rrrz#Optional[t] requires a single type.r
z is not subscriptable)
r�r\rRrTrPrpr�r{rrO)r�r}�itemrWrZr�r[�__getitem__[s(







z_SpecialForm.__getitem__)rbr^r_r�r�r�r�r�r�r�r�r�r�r�r��
__classcell__rZrZr�r[rU,s
rU)r�a`Special type indicating an unconstrained type.

    - Any is compatible with every type.
    - Any assumed to have all methods.
    - All values assumed to be instances of Any.

    Note that all the above statements are true from the point of view of
    static type checkers. At runtime, Any should not be used with instance
    or class checks.
    )r�aSpecial type indicating functions that never return.
    Example::

      from typing import NoReturn

      def stop() -> NoReturn:
          raise Exception('no way')

    This type is invalid in other positions, e.g., ``List[NoReturn]``
    will fail in static type checkers.
    a3Special type construct to mark class variables.

    An annotation wrapped in ClassVar indicates that a given
    attribute is intended to be used as a class variable and
    should not be set on instances of that class. Usage::

      class Starship:
          stats: ClassVar[Dict[str, int]] = {} # class variable
          damage: int = 10                     # instance variable

    ClassVar accepts only types and cannot be further subscribed.

    Note that ClassVar is not a class itself, and should not
    be used with isinstance() or issubclass().
    a�Special typing construct to indicate final names to type checkers.

    A final name cannot be re-assigned or overridden in a subclass.
    For example:

      MAX_SIZE: Final = 9000
      MAX_SIZE += 1  # Error reported by type checker

      class Connection:
          TIMEOUT: Final[int] = 10

      class FastConnector(Connection):
          TIMEOUT = 1  # Error reported by type checker

    There is no runtime checking of these properties.
    a'Union type; Union[X, Y] means either X or Y.

    To define a union, use e.g. Union[int, str].  Details:
    - The arguments must be types and there must be at least one.
    - None as an argument is a special case and is replaced by
      type(None).
    - Unions of unions are flattened, e.g.::

        Union[Union[int, str], float] == Union[int, str, float]

    - Unions of a single argument vanish, e.g.::

        Union[int] == int  # The constructor actually returns int

    - Redundant arguments are skipped, e.g.::

        Union[int, str, int] == Union[int, str]

    - When comparing unions, the argument order is ignored, e.g.::

        Union[int, str] == Union[str, int]

    - You cannot subclass or instantiate a union.
    - You can use Optional[X] as a shorthand for Union[X, None].
    zEOptional type.

    Optional[X] is equivalent to Union[X, None].
    a�Special typing form to define literal types (a.k.a. value types).

    This form can be used to indicate to type checkers that the corresponding
    variable or function parameter has a value equivalent to the provided
    literal (or one of several literals):

      def validate_simple(data: Any) -> Literal[True]:  # always returns True
          ...

      MODE = Literal['r', 'rb', 'w', 'wb']
      def open_helper(file: str, mode: MODE) -> str:
          ...

      open_helper('/some/path', 'r')  # Passes type check
      open_helper('/other/path', 'typo')  # Error in type checker

   Literal[...] cannot be subclassed. At runtime, an arbitrary value
   is allowed as type argument to Literal[...], but type checkers may
   impose restrictions.
    c@s:eZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)r)�__forward_arg__�__forward_code__�__forward_evaluated__�__forward_value__�__forward_is_argument__TcCsnt|t�std|����zt|dd�}Wn"tk
rJtd|����YnX||_||_d|_d|_||_	dS)Nz*Forward reference must be a string -- got z<string>�evalz/Forward reference must be an expression -- got F)
rPrQrT�compile�SyntaxErrorr�r�r�r�r�)r�rWrY�coderZrZr[r��s
zForwardRef.__init__cCsj|jr||k	rd|dkr(|dkr(i}}n|dkr6|}n|dkrB|}tt|j||�d|jd�|_d|_|jS)Nz*Forward references must evaluate to types.�rYT)r�r\r�r�r�r�)r�r�r�rZrZr[r��s
�zForwardRef._evaluatecCs>t|t�stS|jr2|jr2|j|jko0|j|jkS|j|jkSrr)rPrr�r�r�r�r�rZrZr[r�s

�zForwardRef.__eq__cCs
t|j�Srr)r�r�r�rZrZr[r�szForwardRef.__hash__cCsd|j�d�S)NzForwardRef(�))r�r�rZrZr[r�szForwardRef.__repr__N)T)	rbr^r_r�r�r�r�r�r�rZrZrZr[r�s

c@s2eZdZdZdddd�dd�Zdd�Zd	d
�ZdS)r)rb�	__bound__�__constraints__�
__covariant__�__contravariant__NF)�bound�	covariant�
contravariantc	s�||_|r|rtd��t|�|_t|�|_|r>|dk	r>td��|rVt|�dkrVtd��d�t�fdd�|D��|_|r�t	|d�|_
nd|_
zt�d�j
�d	d
�}Wnttfk
r�d}YnX|dkr�||_dS)Nz"Bivariant types are not supported.z-Constraints cannot be combined with bound=...rz"A single constraint is not allowedz:TypeVar(name, constraint, ...): constraints must be types.c3s|]}t|��VqdSrrr�rfr�rZr[r�Vsz#TypeVar.__init__.<locals>.<genexpr>zBound must be a type.rb�__main__�typing)rb�
ValueError�boolr�r�rTr{rpr�r\r��sys�	_getframe�	f_globals�get�AttributeErrorr^)r�r�r�r�r�ZconstraintsZdef_modrZr�r[r�Js(


zTypeVar.__init__cCs&|jrd}n|jrd}nd}||jS)N�+�-�~)r�r�rb)r��prefixrZrZr[r�bszTypeVar.__repr__cCs|jSrr)rbr�rZrZr[r�kszTypeVar.__reduce__)rbr^r_r�r�r�r�rZrZrZr[rs,�	)	rsrp�dictr��	frozenset�deque�defaultdictrOr;cCs|�d�o|�d�S)N�__)�
startswith�endswith)�attrrZrZr[�
_is_dunder�sr�cs�eZdZdddd�dd�Zedd��Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Z�fdd�Z
dd�Zdd�Zdd�Z�ZS)rRTFN)�inst�specialr�cCsz||_||_|r*|dkr*|j}t�||�}||_t|t�s@|f}||_tdd�|D��|_	t
|�|_d|_|sv|j
|_
dS)Ncss*|]"}|tkrdn|tkrdn|VqdS).rZN)�_TypingEllipsis�_TypingEmptyr�rZrZr[r��s�z)_GenericAlias.__init__.<locals>.<genexpr>)�_instrmrb�_normalize_aliasr�r�rPrprSrtrqror�r^)r��originr�r�r�r�Z	orig_namerZrZr[r��s 
�

z_GenericAlias.__init__cs^|jttfkrtd|����t|t�s,|f}d�t�fdd�|D��}t||�t||j|�S)Nz%Cannot subscript already-subscripted �*Parameters to generic types must be types.c3s|]}t|��VqdSrrr�r�r�rZr[r��sz,_GenericAlias.__getitem__.<locals>.<genexpr>)	rSrrrTrPrpr~rvro�r�r�rZr�r[r��s

z_GenericAlias.__getitem__cCst|j||j|jd�S)N)r�r�)rRrSr�r�r�rZrZr[rw�sz_GenericAlias.copy_withcCs�|jdks&t|j�dkrx|jdtkrx|jr8d|j}n
t|j�}|jshdd�dd�|jD���d	�}nd
}|�|��S|jr�dSdd�d
d�|jdd�D���dt|jd��d	�S)Nr�rr��[�, cSsg|]}t|��qSrZ�rer�rZrZr[rk�sz*_GenericAlias.__repr__.<locals>.<listcomp>�]�ztyping.Callableztyping.Callable[[cSsg|]}t|��qSrZr�r�rZrZr[rk�s���z], )r�r{rt�EllipsisrerSrm�join)r�r�r�rZrZr[r��s
��
 z_GenericAlias.__repr__cCsRt|t�stS|j|jkrdS|jtkrF|jtkrFt|j�t|j�kS|j|jkS)NF)rPrRr�rSrr�rtr�rZrZr[r��s
z_GenericAlias.__eq__cCs,|jtkrttt|j�f�St|j|jf�Srr)rSrr�r�rtr�rZrZr[r��s
z_GenericAlias.__hash__cOsT|js$td|j�d|j���d���|j||�}z
||_Wntk
rNYnX|S)N�Type z cannot be instantiated; use z
() instead)r�rTr��lowerrS�__orig_class__r�)r�r��kwargs�resultrZrZr[r��s
z_GenericAlias.__call__cCs�|jrZg}|j|kr |�|j�|�|�}tdd�||dd�D��sR|�t�t|�S|jtkr�t|krpdS|�|�}||dd�D]}t|t	�r�||k	r�dSq�|jfS)Ncss"|]}t|t�pt|t�VqdSrr)rPrR�
issubclassr�rg�brZrZr[r��s�z0_GenericAlias.__mro_entries__.<locals>.<genexpr>rrZ)
r�rSrl�index�anyrrprrPrR)r��basesr�rzrrZrZr[�__mro_entries__�s$

�


z_GenericAlias.__mro_entries__cCs*d|jkrt|�st|j|�St|��dS)NrS)�__dict__r��getattrrSr�)r�r�rZrZr[�__getattr__�sz_GenericAlias.__getattr__cs2t|�s|dkr t��||�nt|j||�dS)N)r�r�rm)r�r��__setattr__�setattrrS)r�r��valr�rZr[r�sz_GenericAlias.__setattr__cCs|�t|��Srr)r�rOr�rZrZr[r�sz_GenericAlias.__instancecheck__cCs<|jr0t|t�st||j�S|jr0t|j|j�Std��dS)NzBSubscripted generics cannot be used with class and instance checks)rmrPrRrrSrTr�rZrZr[r�s
z_GenericAlias.__subclasscheck__cCs�|jr|jS|jr t�|j}n|j}|tkrht|j�dkrJ|jdtksht|jdd��|jdf}n*t	|j�}t|�dkr�t
|dt	�s�|\}tj||ffS)Nr�rr�r)
rmr��globalsrSrr{rtr�rsrprP�operator�getitem)r�r�r�rZrZr[r�s��
z_GenericAlias.__reduce__)rbr^r_r�r�r�rwr�r�r�r�r
r
rr�r�r�r�rZrZr�r[rR�s	
		rRcs(eZdZdd�Ze�fdd��Z�ZS)�_VariadicGenericAliascCs�|jdks|js|�|�St|t�r0t|�dkr8td��|\}}|tkrRt|f}n$t|t�sjtd|����t|�|f}|�|�S)Nrr�z6Callable must be used as Callable[[arg, ...], result].z1Callable[args, result]: args must be a list. Got )	r�rm�__getitem_inner__rPrpr{rTr�rs)r�r�r�rrZrZr[r�"s


z!_VariadicGenericAlias.__getitem__cs
|jtkr�|jr�|dkr$|�tf�St|t�s4|f}t|�dkrl|ddkrld�t|d��}|�|tf�Sd�t�fdd	�|D��}|�|�S|jt	j
jkr�|jr�|\}}d
�t|��}|tkr�|�t|f�Sd�t�fdd	�|D��}||f}|�|�St
��|�S)
NrZr�r.z Tuple[t, ...]: t must be a type.rz*Tuple[t0, t1, ...]: each t must be a type.c3s|]}t|��VqdSrrr�r�r�rZr[r�>sz:_VariadicGenericAlias.__getitem_inner__.<locals>.<genexpr>z.Callable[args, result]: result must be a type.z6Callable[[arg, ...], result]: each arg must be a type.c3s|]}t|��VqdSrrr�)rgrWr�rZr[r�Gs)rSrprmrwr�rPr{r\r��collections�abcrr�r�r�)r�r�r�r�rr�r�r[r2s.




z'_VariadicGenericAlias.__getitem_inner__)rbr^r_r�r�rr�rZrZr�r[rsrcs<eZdZdZdZ�fdd�Zedd��Z�fdd�Z�Z	S)	rrZFcs^|ttfkrtd|j�d���t�jtjkrF|jtjk	rFt��|�}nt�j|f|�|�}|S)Nr�z< cannot be instantiated; it can be used only as a base class)rrrTrbr�r��objectr�)r|r�r�rdr�rZr[r�dszGeneric.__new__cs�t|t�s|f}|s.|tk	r.td|j�d���d�t�fdd�|D��}|ttfkr�tdd�|D��sxtd|j�d���t	t
|��t	|�kr�td|j�d	���n
t||�t||�S)
NzParameter list to z[...] cannot be emptyr�c3s|]}t|��VqdSrrr�r�r�rZr[r�vsz,Generic.__class_getitem__.<locals>.<genexpr>css|]}t|t�VqdSrr)rPrr�rZrZr[r�yszParameters to z [...] must all be type variablesz[...] must all be unique)
rPrprrTr_rr�allrbr{r�r~rR)r|r�rZr�r[�__class_getitem__ns&
���
zGeneric.__class_getitem__c
s
t�j||�g}d|jkr(t|jk}nt|jko:|jdk}|rHtd��d|jkr�t|j�}d}|jD].}t	|t
�rf|jtkrf|dk	r�td��|j}qf|dk	r�t
|�}t
|��|�ks�d��fdd�|D��}d�dd�|D��}	td	|�d
|	�d���|}t|�|_dS)N�__orig_bases__rz!Cannot inherit from plain Genericz0Cannot inherit from Generic[...] multiple types.r�c3s|]}|�krt|�VqdSrr�rQrf�ZgvarsetrZr[r��sz,Generic.__init_subclass__.<locals>.<genexpr>css|]}t|�VqdSrrr)rg�grZrZr[r��szSome type variables (z) are not listed in Generic[r�)r�r�rrr�	__bases__rbrTrqrPrRrSror�r�rp)
r|r�rrj�errorZgvars�baseZtvarsetZs_varsZs_argsr�rr[r��s8




��zGeneric.__init_subclass__)
rbr^r_r��_is_protocolr�r�rr�r�rZrZr�r[rMs

c@seZdZdS)r�N�rbr^r_rZrZrZr[r��sr�c@seZdZdS)r�Nr#rZrZrZr[r��sr�rorrr"�_is_runtime_protocol�__abstractmethods__�__annotations__r�__doc__r�r^r�r��__subclasshook__r��_MutableMapping__markercCsrt�}|jdd�D]X}|jdkr$qt|di�}t|j���t|���D] }|�d�sJ|tkrJ|�	|�qJq|S)Nr�)rrr&Z_abc_)
r��__mro__rbrrsr�keysr��EXCLUDED_ATTRIBUTES�add)r|�attrsr!�annotationsr�rZrZr[�_get_protocol_attrs�s
r0cst�fdd�t��D��S)Nc3s|]}tt�|d��VqdSrr)rVr�rgr��r|rZr[r��sz,_is_callable_members_only.<locals>.<genexpr>)rr0r2rZr2r[�_is_callable_members_only�sr3cOst|�jrtd��dS)Nz Protocols cannot be instantiated)rOr"rT)r�r�rrZrZr[�_no_init�s
r4c	Cs6zt�d�jddkWSttfk
r0YdSXdS)Nr�rb)rr�T)r�r�r�r�r�rZrZrZr[�_allow_reckless_class_cheks�sr5�AbstractContextManager�AbstractAsyncContextManager)zcollections.abc�
contextlibcseZdZ�fdd�Z�ZS)�
_ProtocolMetacsVt�dd�rt��r$t�j��r$dS�jrJt��fdd�t��D��rJdSt����S)Nr"FTc3s8|]0}t�|�o.tt�|d��p.t�|�dk	VqdSrr)�hasattrrVrr1�r|�instancerZr[r��s�
z2_ProtocolMeta.__instancecheck__.<locals>.<genexpr>)	rr3rr�r"rr0r�r�r;r�r;r[r��s�
��z_ProtocolMeta.__instancecheck__)rbr^r_r�r�rZrZr�r[r9�sr9cs(eZdZdZdZdZ�fdd�Z�ZS)rrZTFcs�t�j||��j�dd�s2tdd��jD���_�fdd�}d�jkrN|�_�jsXdS�jD]F}|tt	fks^|j
tkr�|jt|j
ks^t
|t	�r�|js^td|��q^t�_dS)	Nr"Fcss|]}|tkVqdSrr)rrrZrZr[r�)sz-Protocol.__init_subclass__.<locals>.<genexpr>cs��j�dd�stSt�dd�s0t�r(tStd��t��sJt�rBtStd��t|t�s\td��t	��D]v}|j
D]b}||jkr�|j|dkr�tSqdt|di�}t|tjj
�rn||krnt|t�rn|jrnqdqntSqddS)	Nr"Fr$zLInstance and class checks can only be used with @runtime_checkable protocolsz<Protocols with non-method members don't support issubclass()z"issubclass() arg 1 must be a classr&T)rr�r�rr5rTr3rPrOr0r*rrrrrr")r�r�r!r/r2rZr[�_proto_hook,s:


���
z/Protocol.__init_subclass__.<locals>._proto_hookr(z7Protocols can only inherit from other protocols, got %r)r�r�rr�rrr"r(rrr^�_PROTO_WHITELISTrbrrTr4r�)r|r�rr=r!r�r2r[r�$s,&

�����zProtocol.__init_subclass__)rbr^r_r�r"r$r�r�rZrZr�r[rs)�	metaclasscCs&t|t�r|jstd|��d|_|S)NzB@runtime_checkable can be only applied to protocol classes, got %rT)rrr"rTr$r2rZrZr[rKds�cCs|SrrrZ)�typrrZrZr[rA}sc
Cs�z
|j}Wntk
r"iYSX|j}|j}|d|�}|jpDd}|j}|rXt|�ni}|t|�}t||d�|�D]\}}	|	||<qz|S)NrZ)	�__code__r��co_argcount�co_varnames�__defaults__�__kwdefaults__r�r{�zip)
r�r�Z	pos_countZ	arg_names�defaultsZ
kwdefaultsr�Z
pos_offsetr��valuerZrZr[�
_get_defaults�s



rIcCs�t|dd�riSt|t�r�i}t|j�D]z}|dkrDtj|jj}n|}|j�	di�}|�
�D]B\}}|dkrvtd�}t|t�r�t|dd�}t
|||�}|||<q^q(|S|dkr�t|tj�r�|j}n"|}	t|	d�r�|	j}	q�t|	di�}|dkr�|}n|dk�r|}t|dd�}|dk�r6t|t��r(iStd�|���t|�}
t|�}|�
�D]d\}}|dk�rhtd�}t|t��r|t|�}t
|||�}||
k�r�|
|dk�r�t|}|||<�qN|S)N�__no_type_check__r&Fr��__wrapped__�__globals__z1{!r} is not a module, class, method, or function.)rrPrO�reversedr*r��modulesr^rr��itemsrQrr�r`�
ModuleTyper:rK�_allowed_typesrT�formatrIr�r)rdr�r�Zhintsr!Zbase_globals�annr�rHZnsobjrGrZrZr[rE�s^




�
cCs t|t�r|jS|tkrtSdSrr)rPrRrSr)rxrZrZr[rD�s

cCsRt|t�rN|jsN|j}t|�tjjkrJ|dtk	rJt	|dd��|df}|SdS)Nrr�rZ)
rPrRrmrtrDrrrr�rs)rxr�rZrZr[rCscCs�t|t�rt|j��}|j��D]"\}}||j|fkr|�|�q|��D](}t|tj	�r`d|_
t|t�rJt|�qJz
d|_
Wntk
r�YnX|S)NT)
rPrOr�copyrOr�pop�valuesr`rarJrGrT)rWZ	arg_attrsr�rrdrZrZr[rGs	




cst����fdd��}|S)Ncs�||�}t|�}|Srr)rG)r�r�r���	decoratorrZr[�wrapped_decorator@s
z2no_type_check_decorator.<locals>.wrapped_decorator)r�r�)rXrYrZrWr[rH9scOstd��dS)Nz�You should not call an overloaded function. A series of @overload-decorated functions outside a stub module should always be followed by an implementation that is not @overload-ed.)�NotImplementedErrorr�rZrZr[�_overload_dummyIs�r[cCstSrr)r[)r�rZrZr[rJRscCs|SrrrZ)�frZrZr[rBos�T�KT�VT�T_co)r��V_co�VT_co�T_contra)r��CT_co)r�r�cCst||d|d�S)NT)r�r�)rR)r�r�r�rZrZr[�_alias�srerZ)r�a�Callable type; Callable[[int], str] is a function of (int) -> str.

    The subscription syntax must always be used with exactly two
    values: the argument list and the return type.  The argument list
    must be a list of types or ellipsis; the return type must be a single type.

    There is no syntax to indicate optional or keyword arguments,
    such function types are rarely used as callback types.
    F)r�r�a@Tuple type; Tuple[X, Y] is the cross-product type of X and Y.

    Example: Tuple[T1, T2] is a tuple of two elements corresponding
    to type variables T1 and T2.  Tuple[int, float, str] is a tuple
    of an int, a float and a string.

    To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
    )r�a�A special construct usable to annotate class objects.

    For example, suppose we have the following classes::

      class User: ...  # Abstract base for User classes
      class BasicUser(User): ...
      class ProUser(User): ...
      class TeamUser(User): ...

    And a function that takes a class argument that's a subclass of
    User and returns an instance of the corresponding class::

      U = TypeVar('U', bound=User)
      def new_user(user_class: Type[U]) -> U:
          user = user_class()
          # (Here we could write the user object to a database)
          return user

      joe = new_user(BasicUser)

    At this point the type checker knows that joe has type BasicUser.
    c@s"eZdZdZeed�dd��ZdS)r2rZ��returncCsdSrrrZr�rZrZr[�__int__�szSupportsInt.__int__N)rbr^r_r�r�intrhrZrZrZr[r2�sc@s"eZdZdZeed�dd��ZdS)r0rZrfcCsdSrrrZr�rZrZr[�	__float__szSupportsFloat.__float__N)rbr^r_r�r�floatrjrZrZrZr[r0�sc@s"eZdZdZeed�dd��ZdS)r/rZrfcCsdSrrrZr�rZrZr[�__complex__
szSupportsComplex.__complex__N)rbr^r_r�r�complexrlrZrZrZr[r/sc@s"eZdZdZeed�dd��ZdS)r.rZrfcCsdSrrrZr�rZrZr[�	__bytes__szSupportsBytes.__bytes__N)rbr^r_r�r�bytesrnrZrZrZr[r.sc@s"eZdZdZeed�dd��ZdS)r1rZrfcCsdSrrrZr�rZrZr[�	__index__szSupportsIndex.__index__N)rbr^r_r�rrirprZrZrZr[r1sc@s"eZdZdZeed�dd��ZdS)r-rZrfcCsdSrrrZr�rZrZr[�__abs__(szSupportsAbs.__abs__N)rbr^r_r�rr`rqrZrZrZr[r-#sc@s&eZdZdZedeed�dd��ZdS)r3rZr)�ndigitsrgcCsdSrrrZ)r�rrrZrZr[�	__round__2szSupportsRound.__round__N)r)rbr^r_r�rrir`rsrZrZrZr[r3-sc	std��fdd�|D�}t�|dd�|D��}t|�|_|_zt�d�j�dd�|_	Wnt
tfk
rnYnX|S)NzDNamedTuple('Name', [(f0, t0), (f1, t1), ...]); each t must be a typecsg|]\}}|t|��f�qSrZr��rg�nrhr�rZr[rk9sz!_make_nmtuple.<locals>.<listcomp>cSsg|]\}}|�qSrZrZrtrZrZr[rk:sr�rbr�)r�
namedtupler�r&�_field_typesr�r�r�r�r^r�r�)r�r`�nm_tplrZr�r[�
_make_nmtuple7sry)r�r�r��__getnewargs__�_fields�_field_defaultsrw�_make�_replace�_asdictZ_source)r^rbr&cseZdZ�fdd�Z�ZS)�NamedTupleMetacs�|�dd�rt��||||�S|�di�}t||���}g}i}|D]H}||krl||}	|�|	�|	||<qD|rDtdj|d�|�	��d���qDt
|�|j_t|�|j_
||_|D]<}
|
tkr�td|
��q�|
tkr�|
|jkr�t||
||
�q�|S)Nr�Fr&zXNon-default namedtuple field {field_name} cannot follow default field(s) {default_names}r�)�
field_nameZ
default_namesz&Cannot overwrite NamedTuple attribute )r�r�r�ryrOrlrTrRr�r+r�r&rprDr|�_prohibitedr�rmr{r)r|�typenamer	�nsr`rxrGZ
defaults_dictr�Z
default_value�keyr�rZr[r�Os2

�
zNamedTupleMeta.__new__)rbr^r_r�r�rZrZr�r[r�Msr�c@seZdZdZdd�Zde_dS)r=TcOs�|std��|^}}|r"|^}}n4d|krN|�d�}ddl}|jdtdd�ntd��|r�z
|\}Wq�tk
r�tdt|�d�d	��d�Yq�Xn<d
|kr�t|�dkr�|�d
�}ddl}|jdtdd�nd}|dkr�|��}n|r�td
��t||�S)Nz*NamedTuple.__new__(): not enough argumentsr�rz4Passing 'typename' as keyword argument is deprecatedr�)�
stacklevelzGNamedTuple.__new__() missing 1 required positional argument: 'typename'z@NamedTuple.__new__() takes from 2 to 3 positional arguments but z were given�fieldsrz2Passing 'fields' as keyword argument is deprecatedzIEither list of fields or keywords can be provided to NamedTuple, not both)	rTrU�warnings�warn�DeprecationWarningr�r{rOry)r�rr|r�r�r�rZrZr[r��sB

�
�

�
zNamedTuple.__new__z*($cls, typename, fields=None, /, **kwargs)N)rbr^r_r�r��__text_signature__rZrZrZr[r=ls#cOs
t||�Srr)r�)r|r�rrZrZr[�	_dict_new�sr�)�totalc	Ksj|dkr|}n|rtd��t|�|d�}zt�d�j�dd�|d<Wnttfk
r\YnXt|d|�S)Nz@TypedDict takes either a dict or keyword arguments, but not both)r&�	__total__rrbr�r^rZ)	rTr�r�r�r�r�r�r��_TypedDictMeta)r|r�r�r�rr�rZrZr[�_typeddict_new�sr�cCstd��dS)Nz4TypedDict does not support instance and class checksr�)r|r�rZrZr[�_check_fails�sr�cs&eZdZd�fdd�	ZeZZ�ZS)r�Tcs�|dkrtnt|d<tt|��||tf|�}|�di�}d��fdd�|��D�}|D]}|�|j	�di��qV||_
t|d�s�||_|S)Nr>r�r&z?TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a typecsi|]\}}|t|���qSrZr�)rgrurxr�rZr[�
<dictcomp>�sz*_TypedDictMeta.__new__.<locals>.<dictcomp>r�)
r�r�r�r�r�r�r�rO�updaterr&r:r�)r|r�r	r�r�Ztp_dictZannsr!r�r�r[r��s	
z_TypedDictMeta.__new__)T)rbr^r_r�r�r�r�r�rZrZr�r[r��sr�c@seZdZdS)r>Nr#rZrZrZr[r>�scCsdd�}||_||_|S)NcSs|SrrrZ)�xrZrZr[�new_typeszNewType.<locals>.new_type)rbZ
__supertype__)r�rxr�rZrZr[rFsc@s�eZdZdZeeed�dd���Zeeed�dd���Zedd�dd	��Z	eee
d�d
d���Zeed�dd
��Z
edd�dd��Zee
d�dd��Zed6eed�dd��Zee
d�dd��Zed7eed�dd��Zed8eeed�dd��Zed9eeed�d d!��Zee
d�d"d#��Zeed�d$d%��Zed:eed&�d'd(��Zee
d�d)d*��Zeeed+�d,d-��Zeeedd.�d/d0��Zed1d�d2d3��Zedd�d4d5��ZdS);�IOrZrfcCsdSrrrZr�rZrZr[�mode=szIO.modecCsdSrrrZr�rZrZr[r�BszIO.nameNcCsdSrrrZr�rZrZr[�closeGszIO.closecCsdSrrrZr�rZrZr[�closedKsz	IO.closedcCsdSrrrZr�rZrZr[�filenoPsz	IO.filenocCsdSrrrZr�rZrZr[�flushTszIO.flushcCsdSrrrZr�rZrZr[�isattyXsz	IO.isattyr�)rurgcCsdSrrrZ)r�rurZrZr[�read\szIO.readcCsdSrrrZr�rZrZr[�readable`szIO.readable)�limitrgcCsdSrrrZ)r�r�rZrZr[�readlinedszIO.readline)�hintrgcCsdSrrrZ)r�r�rZrZr[�	readlineshszIO.readlinesr)�offset�whencergcCsdSrrrZ)r�r�r�rZrZr[�seeklszIO.seekcCsdSrrrZr�rZrZr[�seekablepszIO.seekablecCsdSrrrZr�rZrZr[�telltszIO.tell)�sizergcCsdSrrrZ)r�r�rZrZr[�truncatexszIO.truncatecCsdSrrrZr�rZrZr[�writable|szIO.writable��srgcCsdSrrrZ�r�r�rZrZr[�write�szIO.write)�linesrgcCsdSrrrZ)r�r�rZrZr[�
writelines�sz
IO.writelinesz
IO[AnyStr]cCsdSrrrZr�rZrZr[�	__enter__�szIO.__enter__cCsdSrrrZ)r�rOrH�	tracebackrZrZr[�__exit__�szIO.__exit__)r�)r�)r�)r)N)rbr^r_r��propertyrrQr�r�r�r�r�rir�r�r�r@r�r�r�r9r�r�r�r�r�r�r�r�r�r�rZrZrZr[r�.sX
r�c@s>eZdZdZeeeefed�dd��Z	edd�dd��Z
dS)	�BinaryIOrZr�cCsdSrrrZr�rZrZr[r��szBinaryIO.writerfcCsdSrrrZr�rZrZr[r��szBinaryIO.__enter__N)rbr^r_r�rrro�	bytearrayrir�r�rZrZrZr[r��s
r�c@s�eZdZdZeeed�dd���Zeeed�dd���Z	eee
ed�dd���Zeeed�d	d
���Z
eeed�dd���Zedd�d
d��ZdS)�TextIOrZrfcCsdSrrrZr�rZrZr[�buffer�sz
TextIO.buffercCsdSrrrZr�rZrZr[�encoding�szTextIO.encodingcCsdSrrrZr�rZrZr[�errors�sz
TextIO.errorscCsdSrrrZr�rZrZr[�line_buffering�szTextIO.line_bufferingcCsdSrrrZr�rZrZr[�newlines�szTextIO.newlinescCsdSrrrZr�rZrZr[r��szTextIO.__enter__N)rbr^r_r�r�rr�r�rQr�rr�r�r�rr�r�rZrZrZr[r��s$r�c@s"eZdZdddgZeZeZeZdS)�ior�r�r�N)rbr^r_�__all__r�r�r�rZrZrZr[r��s
r�z.ioc@seZdZddgZeZeZdS)�re�Pattern�MatchN)rbr^r_r�r�r�rZrZrZr[r��sr�z.re)T)NN)T)N)�rrrrZcollections.abcr8r�rr�Z	stdlib_rer�r`rrrr�r\rerqrvr~r�r�r�r�r�r�rUrrIr	r
rrr
rrr�r�rRrrr�r�Z_TYPING_INTERNALSZ_SPECIAL_NAMESr,r0r3r4r5r>r9rrKrArIra�BuiltinFunctionType�
MethodTyperPrQrErDrCrGrHr[rJrBr]r^r_r`rarbrcrOrdrorQr@rerr%r(r'r&rrr,r#rr)rr'r;rr!rrr"r rrprrsr9r�r6r�r�r<rrrr$r6rr7r+r�r7r�r8r:r5r4r?r*rr2r0r/r.r1r-r3ryr�rmr�r=r�r�r�r�r>rFrLrMr�r�r�r�rbrNr�r�rZrZrZr[�<module>s&�X
!
	
I��
�����2a�
/[����	b�
V	
�
�	�							@+c#	

ast.cpython-38.opt-2.pyc000064400000024137150335716500010737 0ustar00U

e5d"K�@s�ddlTd<ddd�dd�Zd	d
�Zd=dd
�Zdd�Zdd�Zd>dd�Zdd�Zdd�Zd?dd�Z	dd�Z
dd�Zdd�d d!�Zd"d#�Z
Gd$d%�d%e�ZGd&d'�d'e�Zd(d)�Zd*d+�Zeee�e_eee�e_Gd,d-�d-e�Zd.d/�ZGd0d1�d1eed2�ZGd3d4�d4eed2�ZGd5d6�d6eed2�ZGd7d8�d8eed2�ZGd9d:�d:eed2�Zeee e!fee"fee#feed�e$feed;�fiZ%ee$fiZ&e$d8ed�d8ed1e d1e!d1e"d4e#d6ed;�d:iZ'dS)@�)�*�	<unknown>�execFN)�
type_comments�feature_versioncCsFt}|r|tO}t|t�r(|\}}|}n|dkr4d}t|||||d�S)N���)�_feature_version)Z
PyCF_ONLY_ASTZPyCF_TYPE_COMMENTS�
isinstance�tuple�compile)�source�filename�moderr�flags�major�minor�r�/usr/lib64/python3.8/ast.py�parses

�rcs`t|t�rt|dd�}t|t�r&|j}dd���fdd���fdd������fd	d
���|�S)N�eval)rcSstd|����dS)Nzmalformed node or string: )�
ValueError��noderrr�_raise_malformed_node>sz+literal_eval.<locals>._raise_malformed_nodecs,t|t�rt|j�tttfkr&�|�|jS�N)r	�Constant�type�value�int�float�complexr)rrr�_convert_num@sz"literal_eval.<locals>._convert_numcsDt|t�r<t|jttf�r<�|j�}t|jt�r6|
S|S�|�Sr)r	ZUnaryOp�opZUAddZUSub�operand)rr#)r!rr�_convert_signed_numDs
z)literal_eval.<locals>._convert_signed_numcst|t�r|jSt|t�r*tt�|j��St|t�rDtt�|j��St|t	�r^t
t�|j��St|t�r�t|j
�t|j�kr��|�ttt�|j
�t�|j���St|t��rt|jttf��r�|j�}�|j�}t|ttf��rt|t��rt|jt��r||S||S�|�Sr)r	rrZTupler
�mapZeltsZList�list�Set�setZDict�len�keys�values�dict�zipZBinOpr"ZAddZSub�left�rightrrr )rr.r/��_convertr!r$rrrr1Ls,





�

zliteral_eval.<locals>._convert)r	�strrZ
Expression�body)Znode_or_stringrr0r�literal_eval3s

r4Tcs2���fdd��t|t�s*td|jj���|�S)Nc	st|t�r�g}�}|jD]V}zt||�}Wntk
rBd}YqX|r`|�d|�|�f�q|��|��q�r�|jr�|jD]:}z |�d|�t||��f�Wq�tk
r�Yq�Xq�d|jjd�	|�fSt|t
�r�dd�	�fdd�|D��St|�S)NTz%s=%sz%s(%s)z, z[%s]c3s|]}�|�VqdSrr)�.0�x)�_formatrr�	<genexpr>�sz(dump.<locals>._format.<locals>.<genexpr>)r	�AST�_fields�getattr�AttributeError�append�_attributes�	__class__�__name__�joinr&�repr)r�args�keywords�fieldr�a�r7�annotate_fields�include_attributesrrr7ps*




 
zdump.<locals>._formatzexpected AST, got %r)r	r9�	TypeErrorr?r@)rrHrIrrGr�dumpfs

rKcCsVdD]L}||jkr||jkrt||d�}|dk	sDt||�r|�d�rt|||�q|S)N)�lineno�
col_offset�
end_lineno�end_col_offsetZend_)r>r;�hasattr�
startswith�setattr)�new_nodeZold_node�attrrrrr�
copy_location�s��rUcs �fdd���|dddd�|S)Ncs�d|jkr"t|d�s||_n|j}d|jkrDt|d�s>||_n|j}d|jkrft|d�s`||_n|j}d|jkr�t|d�s�||_n|j}t|�D]}�|||||�q�dS)NrLrNrMrO)r>rPrLrNrMrO�iter_child_nodes)rrLrMrNrO�child��_fixrrrY�s$







z#fix_missing_locations.<locals>._fix�rrrrrXr�fix_missing_locations�sr[rZcCsVt|�D]H}d|jkr(t|dd�||_d|jkrt|dd�}dk	r|||_q|S)NrLrrN)�walkr>r;rLrN)r�nrWrNrrr�increment_lineno�s
��r^c	cs:|jD].}z|t||�fVWqtk
r2YqXqdSr)r:r;r<)rrErrr�iter_fields�s

r_ccsLt|�D]>\}}t|t�r"|Vqt|t�r|D]}t|t�r0|Vq0qdSr)r_r	r9r&)r�namerE�itemrrrrV�s


rVcCs�t|ttttf�s"td|jj��|jr8t|jdt	�s<dS|jdj
}t|t�rZ|j}n"t|t
�rxt|j
t�rx|j
}ndS|r�ddl}|�|�}|S)Nz%r can't have docstringsr)r	ZAsyncFunctionDefZFunctionDefZClassDefZModulerJr?r@r3ZExprr�Str�srr2�inspectZcleandoc)rZclean�textrdrrr�
get_docstring�s	

rfcCs�d}g}d}|t|�krx||}||7}|d7}|dkr`|t|�kr`||dkr`|d7}|d7}|dkr|�|�d}q|r�|�|�|S)Nr�rZ�
�
z
)r)r=)r�idx�linesZ	next_line�crrr�_splitlines_no_ffs  

rmcCs,d}|D]}|dkr||7}q|d7}q|S)Nrgz	� r)r�resultrlrrr�_pad_whitespaces

rp)�paddedcCs�z$|jd}|jd}|j}|j}Wntk
r:YdSXt|�}||krd||��||���S|r�t||��d|����}nd}|||��|d���}	||��d|���}
||d|�}|�	d|	�|�
|
�d�|�S)NrZrgr)rLrNrMrOr<rm�encode�decoderp�insertr=rA)rrrqrLrNrMrOrkZpadding�firstZlastrrr�get_source_segment*s&	



rvccs<ddlm}||g�}|r8|��}|�t|��|VqdS)Nr)�deque)�collectionsrw�popleft�extendrV)rrwZtodorrrr\Ms
r\c@s$eZdZdd�Zdd�Zdd�ZdS)�NodeVisitorcCs"d|jj}t|||j�}||�S)N�visit_)r?r@r;�
generic_visit)�selfr�method�visitorrrr�visitoszNodeVisitor.visitcCsTt|�D]F\}}t|t�r:|D]}t|t�r|�|�qqt|t�r|�|�qdSr)r_r	r&r9r�)r~rrErrarrrr}us


zNodeVisitor.generic_visitc	Cs�|j}t�t|��}|dkr@t��D]\}}t||�r$|}q@q$|dk	r�d|}zt||�}Wntk
rrYn&Xddl}|�	|�d�t
d�||�S|�|�S)Nr|rz" is deprecated; add visit_Constant�)r�_const_node_type_names�getr�itemsr	r;r<�warnings�warn�PendingDeprecationWarningr})	r~rrZ	type_name�clsr`rr�r�rrr�visit_Constants(
�zNodeVisitor.visit_ConstantN)r@�
__module__�__qualname__r�r}r�rrrrr{[s
r{c@seZdZdd�ZdS)�NodeTransformercCs�t|�D]�\}}t|t�rvg}|D]D}t|t�r\|�|�}|dkrFq"nt|t�s\|�|�q"|�|�q"||dd�<qt|t�r|�|�}|dkr�t||�qt|||�q|Sr)	r_r	r&r9r�rzr=�delattrrR)r~rrE�	old_valueZ
new_valuesrrSrrrr}�s&






zNodeTransformer.generic_visitN)r@r�r�r}rrrrr��s$r�cCs|jSr�r)r~rrr�_getter�sr�cCs
||_dSrr�)r~rrrr�_setter�sr�c@seZdZdd�ZdS)�_ABCcCsft|t�sdS|tkrZz
|j}Wntk
r6YdSXt|t|�oXt|t�|d��St�||�S)NFr)	r	r�_const_typesrr<�_const_types_notr�r�__instancecheck__)r��instrrrrr��s

�z_ABC.__instancecheck__N)r@r�r�r�rrrrr��sr�cOsf|D]<}||jkrq|j�|�}|t|�krt|j�d|����q|tkrTt||�Stj|f|�|�S)Nz" got multiple values for argument )r:�indexr)rJr@r�r�__new__)r�rC�kwargs�key�posrrr�_new�s

r�c@seZdZdZeZdS)�Num)r]N�r@r�r�r:r�r�rrrrr��sr�)�	metaclassc@seZdZdZeZdS)rb�rcNr�rrrrrb�srbc@seZdZdZeZdS)�Bytesr�Nr�rrrrr�sr�c@seZdZeZdS)�NameConstantN)r@r�r�r�r�rrrrr�sr�c@seZdZdZdd�ZdS)�EllipsisrcOs(|tkrtd|�|�Stj|f|�|�S)N.).)r�rr�)r�rCr�rrrr�szEllipsis.__new__N)r@r�r�r:r�rrrrr�sr�.)rr)TF)rZ)T)(�_astrr4rKrUr[r^r_rVrfrmrprvr\�objectr{r�r�r��propertyrr]rcrr�r�r�rbr�r�r�rrr r2�bytes�boolr�r�r�rrrr�<module>sx�3
'#

#:>	
���sndhdr.cpython-38.opt-2.pyc000064400000013124150335716500011424 0ustar00U

e5d��@s.ddgZddlmZedd�Zdej_dej_dej_d	ej_d
ej	_dd�Z
dd�ZgZd
d�Z
e�e
�dd�Ze�e�dd�Ze�e�dd�Ze�e�dd�Ze�e�dd�Ze�e�dd�Ze�e�dd�Ze�e�dd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zed)k�r*e�d*S)+�what�whathdr�)�
namedtuple�
SndHeadersz.filetype framerate nchannels nframes sampwidthz�The value for type indicates the data type
and will be one of the strings 'aifc', 'aiff', 'au','hcom',
'sndr', 'sndt', 'voc', 'wav', '8svx', 'sb', 'ub', or 'ul'.zYThe sampling_rate will be either the actual
value or 0 if unknown or difficult to decode.z^The number of channels or 0 if it cannot be
determined or if the value is difficult to decode.z?The value for frames will be either the number
of frames or -1.zAEither the sample size in bits or
'A' for A-LAW or 'U' for u-LAW.cCst|�}|S)N)r)�filename�res�r�/usr/lib64/python3.8/sndhdr.pyr4sc
Cs^t|d��J}|�d�}tD]*}|||�}|rt|�W5QR�SqW5QR�dSQRXdS)N�rbi)�open�read�testsr)r�f�hZtfrrrr	r:s

c	Cs�ddl}|�d�sdS|dd�dkr,d}n|dd�dkrBd}ndS|�d�z|�|d	�}Wnt|jfk
r|YdSX||��|��|��d|�	�fS)
Nr�FORM��sAIFC�aifcsAIFFZaiff�r)
r�
startswith�seekr�EOFError�Error�getframerate�getnchannels�
getnframes�getsampwidth)rrrZfmt�arrr	�	test_aifcKs"


�rc
Cs�|�d�rt}n|dd�dkr&t}ndSd}||dd��}||dd��}||dd��}||dd��}||dd	��}d
}	|d
kr�d}
n$|dkr�d}
n|d
kr�d}
d}	nd}
|	|}|r�||}nd}|||||
fS)Ns.snd�)sds.sdns.Zaurr�����U���?���)r�get_long_be�get_long_le)
rr�func�filetypeZhdr_size�	data_size�encoding�rate�	nchannelsZsample_sizeZsample_bitsZ
frame_sizeZnframerrr	�test_au`s2

r1cCsT|dd�dks |dd�dkr$dSt|dd��}|rBd	|}nd
}d|dd
dfS)N�A�EsFSSD��sHCOM��i"VrZhcomr#r(r)r))rrZdivisorr/rrr	�	test_hcom�s 
r8cCst|�d�sdSt|dd��}d}d|kr6dkrfnn,||dkrfd||d}|rftd	|�}d
|dddfS)
NsCreative Voice Filer!�ri�r#�rg��.AZvocr(r)r�get_short_le�int)rrZsbseekr/Zratecoderrr	�test_voc�s
$r=c	Cs�ddl}|�d�r2|dd�dks2|dd�dkr6dS|�d�z|�|d�}Wnt|jfk
rlYdSXd	|��|��|��d|�	�fS)
NrsRIFFrrsWAVEr sfmt rZwav)
�waverrrrrrrrr)rrr>�wrrr	�test_wav�s*

�r@cCs"|�d�r|dd�dkrdSdS)Nrrrs8SVX)Z8svxrr#rr)r)rrrrr	�	test_8svx�srAcCs<|�d�r8t|dd��}t|dd��}d|d|dfSdS)NsSOUNDrrr!r9Zsndtr#)rr*r;)rrZnsamplesr/rrr	�	test_sndt�s
rBcCsD|�d�r@t|dd��}d|kr.dkr@nnd|ddd	fSdS)
Nsr%ri�i�aZsndrr#r(r)rr;)rrr/rrr	�	test_sndr�s
rCcCs,|dd>|dd>B|dd>B|dBS)Nrr"r#r r%rr&r��brrr	r)�sr)cCs,|dd>|dd>B|dd>B|dBS)Nr&r"r%r r#rrrrDrrr	r*�sr*cCs|dd>|dBS)Nrrr#rrDrrr	�get_short_be�srFcCs|dd>|dBS)Nr#rrrrDrrr	r;�sr;cCs�ddl}d}|jdd�r8|jddkr8|jdd�=d}z8|jdd�r`t|jdd�|d�ntdg|d�Wn*tk
r�|j�d�|�d�YnXdS)Nrr#z-rr%�.z
[Interrupted]
)�sys�argv�testall�KeyboardInterrupt�stderr�write�exit)rH�	recursiverrr	�test�srPc	Cs�ddl}ddl}|D]�}|j�|�r~t|ddd�|s<|rttd�ddl}|�|j�|�|�d��}t||d�q�td�qt|ddd�|j	�
�ztt|��Wqtk
r�td	�YqXqdS)
Nrz/:� )�endzrecursing down:�*z*** directory (use -r) ***�:z*** not found ***)
rH�os�path�isdir�print�glob�join�escaperJ�stdout�flushr�OSError)�listrOZtoplevelrHrUrrY�namesrrr	rJ�s"

rJ�__main__N)�__all__�collectionsrrr,�__doc__Z	framerater0ZnframesZ	sampwidthrrr
r�appendr1r8r=r@rArBrCr)r*rFr;rPrJ�__name__rrrr	�<module>!sH�









doctest.cpython-38.opt-1.pyc000064400000223725150335716500011620 0ustar00U

e5d_��!@stdZdZdddddddd	d
ddd
ddddddddddddddddddd d!d"g!Zd#d$lZd#d$lZd#d$lZd#d$lZd#d$lZd#d$lZd#d$l	Z	d#d$l
Z
d#d$lZd#d$lZd#d%l
mZd#d&lmZed'd(�ZiZd)d�Zed�Zed�Zed�Zed�Zed�Zed�ZeeBeBeBeBeBZed
�Zed�Zed�Zed
�Zed�ZeeBeBeBeBZ d*Z!d+Z"d,d-�Z#dsd/d0�Z$d1d2�Z%d3d4�Z&dtd6d7�Z'd8d9�Z(Gd:d;�d;e�Z)d<d=�Z*d>d?�Z+d@dA�Z,GdBdC�dCej-�Z.dDdE�Z/GdFd�d�Z0GdGd�d�Z1GdHd�d�Z2GdId�d�Z3GdJd�d�Z4GdKd�d�Z5GdLd�de6�Z7GdMd�de6�Z8GdNd�de4�Z9d$a:dudQd�Z;dOd$d$d$d$dOd#d$dPe2�d$fdRd�Z<dvdTd�Z=d#a>dUd�Z?GdVdW�dWej@�ZAGdXdY�dYeA�ZBGdZd[�d[ejC�ZDdwd\d�ZEGd]d^�d^eA�ZFdOd$d$e2�d$fd_d`�ZGdad�ZHdbd�ZIdcd �ZJdxddd!�ZKdydedf�ZLdzdgd"�ZMGdhdi�di�ZNeNdjdkdldmdndo�ZOdpdq�ZPeQdrk�rpe
�ReP��d$S){a�Module doctest -- a framework for running examples in docstrings.

In simplest use, end each module M to be tested with:

def _test():
    import doctest
    doctest.testmod()

if __name__ == "__main__":
    _test()

Then running the module as a script will cause the examples in the
docstrings to get executed and verified:

python M.py

This won't display anything unless an example fails, in which case the
failing example(s) and the cause(s) of the failure(s) are printed to stdout
(why not stderr? because stderr is a lame hack <0.2 wink>), and the final
line of output is "Test failed.".

Run it with the -v switch instead:

python M.py -v

and a detailed report of all examples tried is printed to stdout, along
with assorted summaries at the end.

You can force verbose mode by passing "verbose=True" to testmod, or prohibit
it by passing "verbose=False".  In either of those cases, sys.argv is not
examined by testmod.

There are a variety of other ways to run doctests, including integration
with the unittest framework, and support for running non-Python text
files containing doctests.  There are also many ways to override parts
of doctest's default behaviors.  See the Library Reference Manual for
details.
zreStructuredText en�register_optionflag�DONT_ACCEPT_TRUE_FOR_1�DONT_ACCEPT_BLANKLINE�NORMALIZE_WHITESPACE�ELLIPSIS�SKIP�IGNORE_EXCEPTION_DETAIL�COMPARISON_FLAGS�REPORT_UDIFF�REPORT_CDIFF�REPORT_NDIFF�REPORT_ONLY_FIRST_FAILURE�REPORTING_FLAGS�	FAIL_FAST�Example�DocTest�
DocTestParser�
DocTestFinder�
DocTestRunner�
OutputChecker�DocTestFailure�UnexpectedException�DebugRunner�testmod�testfile�run_docstring_examples�DocTestSuite�DocFileSuite�set_unittest_reportflags�script_from_examples�
testsource�	debug_src�debug�N)�StringIO)�
namedtuple�TestResultszfailed attemptedcCst�|dtt�>�S)N�)�OPTIONFLAGS_BY_NAME�
setdefault�len��name�r,�/usr/lib64/python3.8/doctest.pyr�sz<BLANKLINE>z...cCs8d}tjD](}|�|d�}|tt|�kr
||jO}q
|S)z�
    Return the compiler-flags associated with the future features that
    have been imported into the given namespace (globs).
    r"N)�
__future__Zall_feature_names�get�getattrZ
compiler_flag)�globs�flagsZfnameZfeaturer,r,r-�_extract_future_flags�s
r3�cCsVt�|�r|St|t�r,t|t�t�dg�S|dkrJtjt�	|�j
dStd��dS)a�
    Return the module specified by `module`.  In particular:
      - If `module` is a module, then return module.
      - If `module` is a string, then import and return the
        module with that name.
      - If `module` is None, then return the calling module.
        The calling module is assumed to be the module of
        the stack frame at the given depth in the call stack.
    �*N�__name__z"Expected a module, string, or None)�inspect�ismodule�
isinstance�str�
__import__�globals�locals�sys�modules�	_getframe�	f_globals�	TypeError)�moduleZdepthr,r,r-�_normalize_module�s


rDcCsdD]}|�|d�}q|S)N)z
�
�
)�replace)�data�newliner,r,r-�_newline_convert�srJc
Cs�|rVt|d�}t||�}t|dd�dk	rVt|jd�rV|j�|�}|�|�}t|�|fSt||d��}|�	�|fW5QR�SQRXdS)N��
__loader__�get_data)�encoding)
rD�_module_relative_pathr0�hasattrrLrM�decoderJ�open�read)�filename�package�module_relativerNZ
file_contents�fr,r,r-�_load_testfile�s


rX�cCst�d|d|�S)z~
    Add the given number of space characters to the beginning of
    every non-blank line in `s`, and return the result.
    z
(?m)^(?!$)� )�re�sub)�s�indentr,r,r-�_indent�sr_cCs*t�}|\}}}tj||||d�|��S)zz
    Return a string containing a traceback message for the given
    exc_info tuple (as returned by sys.exc_info()).
    )�file)r#�	traceback�print_exception�getvalue)�exc_infoZexcout�exc_typeZexc_valZexc_tbr,r,r-�_exception_traceback�s
rfc@seZdZdd�Zddd�ZdS)�	_SpoofOutcCs$t�|�}|r |�d�s |d7}|S�NrF)r#rc�endswith)�self�resultr,r,r-rcs
z_SpoofOut.getvalueNcCs|�|�t�|�dS�N)�seekr#�truncate)rj�sizer,r,r-rn	s
z_SpoofOut.truncate)N)r6�
__module__�__qualname__rcrnr,r,r,r-rg�s	rgcCs�t|kr||kS|�t�}dt|�}}|d}|rR|�|�rNt|�}|d=ndS|d}|r�|�|�r||t|�8}|d=ndS||kr�dS|D],}|�|||�}|dkr�dS|t|�7}q�dS)z_
    Essentially the only subtle case:
    >>> _ellipsis_match('aa...aa', 'aaa')
    False
    r"F���T)�ELLIPSIS_MARKER�splitr)�
startswithri�find)�want�gotZws�startpos�endpos�wr,r,r-�_ellipsis_matchs0


r|cCs|��}|rd|SdSdS)z)Return a commented form of the given linez# �#N)�rstrip)�liner,r,r-�
_comment_line?sr�cCshdt|�}}|�d�}|dkr$|}|�dd|�}|dkr>|}|�dd|�}|dkr\|d}|||�S)Nr"rF�:�.r&)r)rv�rfind)�msg�start�end�ir,r,r-�_strip_exception_detailsGs
r�c@s2eZdZdZdd�Zddd�Zdd�Zd	d
�ZdS)�_OutputRedirectingPdbz�
    A specialized version of the python debugger that redirects stdout
    to a given stream when interacting with the user.  Stdout is *not*
    redirected when traced code is executed.
    cCs(||_d|_tjj||dd�d|_dS)NFT)�stdout�nosigintr&)�_OutputRedirectingPdb__out�$_OutputRedirectingPdb__debugger_used�pdb�Pdb�__init__Zuse_rawinput)rj�outr,r,r-r�gsz_OutputRedirectingPdb.__init__NcCs*d|_|dkrt��j}tj�||�dS)NT)r�r>r@�f_backr�r��	set_trace)rj�framer,r,r-r�os
z_OutputRedirectingPdb.set_tracecCs|jrtj�|�dSrl)r�r�r��set_continue�rjr,r,r-r�usz"_OutputRedirectingPdb.set_continuecGs2tj}|jt_ztjj|f|��W�S|t_XdSrl)r>r�r�r�r��trace_dispatch)rj�args�save_stdoutr,r,r-r�{s
z$_OutputRedirectingPdb.trace_dispatch)N)r6rprq�__doc__r�r�r�r�r,r,r,r-r�as

r�cCs�t�|�std|��|�d�r(td��tjj|�d��}t	|d�rXtj�|j
�d}n�|jdkr�tt
j�dkr�t
jddkr�tj�t
jd�d}q�tj}nFt	|d�r�|jD]&}tj�||�}tj�|�r�|Sq�td	|j��tj�||�S)
NzExpected a module: %r�/z1Module-relative files may not have absolute paths�__file__r"�__main__��__path__zBCan't resolve paths relative to the module %r (it has no __file__))r7r8rBru�
ValueError�os�path�joinrtrPr�r6r)r>�argv�curdirr��exists)rCZ	test_pathZbasedirZ	directory�fullpathr,r,r-rO�s(






�rOc@s*eZdZdZd
dd�Zdd�Zdd	�ZdS)ran
    A single doctest example, consisting of source code and expected
    output.  `Example` defines the following attributes:

      - source: A single Python statement, always ending with a newline.
        The constructor adds a newline if needed.

      - want: The expected output from running the source code (either
        from stdout, or a traceback in case of exception).  `want` ends
        with a newline unless it's empty, in which case it's an empty
        string.  The constructor adds a newline if needed.

      - exc_msg: The exception message generated by the example, if
        the example is expected to generate an exception; or `None` if
        it is not expected to generate an exception.  This exception
        message is compared against the return value of
        `traceback.format_exception_only()`.  `exc_msg` ends with a
        newline unless it's `None`.  The constructor adds a newline
        if needed.

      - lineno: The line number within the DocTest string containing
        this Example where the Example begins.  This line number is
        zero-based, with respect to the beginning of the DocTest.

      - indent: The example's indentation in the DocTest string.
        I.e., the number of space characters that precede the
        example's first prompt.

      - options: A dictionary mapping from option flags to True or
        False, which is used to override default options for this
        example.  Any option flags not contained in this dictionary
        are left at their default value (as specified by the
        DocTestRunner's optionflags).  By default, no options are set.
    Nr"cCsv|�d�s|d7}|r(|�d�s(|d7}|dk	rB|�d�sB|d7}||_||_||_||_|dkrfi}||_||_dSrh)ri�sourcerw�linenor^�options�exc_msg)rjr�rwr�r�r^r�r,r,r-r��s
zExample.__init__cCs\t|�t|�k	rtS|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkSrl)�type�NotImplementedr�rwr�r^r�r��rj�otherr,r,r-�__eq__�s
�
�
�
�
�zExample.__eq__cCst|j|j|j|j|jf�Srl)�hashr�rwr�r^r�r�r,r,r-�__hash__�s�zExample.__hash__)Nr"r"N)r6rprqr�r�r�r�r,r,r,r-r�s"�
c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rae
    A collection of doctest examples that should be run in a single
    namespace.  Each `DocTest` defines the following attributes:

      - examples: the list of examples.

      - globs: The namespace (aka globals) that the examples should
        be run in.

      - name: A name identifying the DocTest (typically, the name of
        the object whose docstring this DocTest was extracted from).

      - filename: The name of the file that this DocTest was extracted
        from, or `None` if the filename is unknown.

      - lineno: The line number within filename where this DocTest
        begins, or `None` if the line number is unavailable.  This
        line number is zero-based, with respect to the beginning of
        the file.

      - docstring: The string that the examples were extracted from,
        or `None` if the string is unavailable.
    cCs,||_||_|��|_||_||_||_dS)z�
        Create a new DocTest containing the given examples.  The
        DocTest's globals are initialized with a copy of `globs`.
        N)�examples�	docstring�copyr1r+rTr�)rjr�r1r+rTr�r�r,r,r-r�s
zDocTest.__init__cCsRt|j�dkrd}n"t|j�dkr(d}ndt|j�}d|jj|j|j|j|fS)Nr"zno examplesr&z	1 examplez%d examplesz<%s %s from %s:%s (%s)>)r)r��	__class__r6r+rTr�)rjr�r,r,r-�__repr__s��zDocTest.__repr__cCs\t|�t|�k	rtS|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkSrl)r�r�r�r�r1r+rTr�r�r,r,r-r�)s
�
�
�
�
�zDocTest.__eq__cCst|j|j|j|jf�Srl)r�r�r+rTr�r�r,r,r-r�4szDocTest.__hash__cCs:t|t�stS|j|j|jt|�f|j|j|jt|�fkSrl)r9rr�r+rTr��idr�r,r,r-�__lt__8s

�zDocTest.__lt__N)	r6rprqr�r�r�r�r�r�r,r,r,r-r�sc@s�eZdZdZe�dejejB�Ze�dejejBej	B�Z
e�d�jZddd�Z
dd	�Zdd
d�Zdd
�Ze�dej�Zdd�Ze�dej�Zdd�Zdd�Zdd�ZdS)rzD
    A class used to parse strings containing doctest examples.
    a�
        # Source consists of a PS1 line followed by zero or more PS2 lines.
        (?P<source>
            (?:^(?P<indent> [ ]*) >>>    .*)    # PS1 line
            (?:\n           [ ]*  \.\.\. .*)*)  # PS2 lines
        \n?
        # Want consists of any non-blank lines that do not start with PS1.
        (?P<want> (?:(?![ ]*$)    # Not a blank line
                     (?![ ]*>>>)  # Not a line starting with PS1
                     .+$\n?       # But any other line
                  )*)
        a�
        # Grab the traceback header.  Different versions of Python have
        # said different things on the first traceback line.
        ^(?P<hdr> Traceback\ \(
            (?: most\ recent\ call\ last
            |   innermost\ last
            ) \) :
        )
        \s* $                # toss trailing whitespace on the header.
        (?P<stack> .*?)      # don't blink: absorb stuff until...
        ^ (?P<msg> \w+ .*)   #     a line *starts* with alphanum.
        z^[ ]*(#.*)?$�<string>c
s|��}|�|���dkr8d��fdd�|�d�D��}g}d\}}|j�|�D]�}|�|||����||�d||���7}|�	|||�\}}}	}
|�
|�s�|�t||	|
|�t|�
d��|d��||�d|��|���7}|��}qP|�||d��|S)	a=
        Divide the given string into examples and intervening text,
        and return them as a list of alternating Examples and strings.
        Line numbers for the Examples are 0-based.  The optional
        argument `name` is a name identifying this string, and is only
        used for error messages.
        r"rFcsg|]}|�d��qSrlr,��.0�l�Z
min_indentr,r-�
<listcomp>sz'DocTestParser.parse.<locals>.<listcomp>�r"r"r^)r�r^r�N)�
expandtabs�_min_indentr�rt�_EXAMPLE_RE�finditer�appendr��count�_parse_example�_IS_BLANK_OR_COMMENTrr)�groupr�)rj�stringr+�outputZcharnor��mr�r�rwr�r,r�r-�parsess*
�

�
zDocTestParser.parsecCst|�||�|||||�S)a"
        Extract all doctest examples from the given string, and
        collect them into a `DocTest` object.

        `globs`, `name`, `filename`, and `lineno` are attributes for
        the new `DocTest` object.  See the documentation for `DocTest`
        for more information.
        )r�get_examples)rjr�r1r+rTr�r,r,r-�get_doctest�s	�zDocTestParser.get_doctestcCsdd�|�||�D�S)a�
        Extract all doctest examples from the given string, and return
        them as a list of `Example` objects.  Line numbers are
        0-based, because it's most common in doctests that nothing
        interesting appears on the same line as opening triple-quote,
        and so the first interesting line is called "line 1" then.

        The optional argument `name` is a name identifying this
        string, and is only used for error messages.
        cSsg|]}t|t�r|�qSr,)r9r)r��xr,r,r-r��s
�z.DocTestParser.get_examples.<locals>.<listcomp>)r�)rjr�r+r,r,r-r��szDocTestParser.get_examplesc
s
t|�d���|�d��d�}|�|�||�|�|dd�d�d||�d��fdd	�|D��}|�d
�}|�d�}t|�dkr�t�d|d�r�|d=|�|d�||t|��d��fd
d	�|D��}|j�|�}|r�|�d�}nd}|�	|||�}	||	||fS)a�
        Given a regular expression match from `_EXAMPLE_RE` (`m`),
        return a pair `(source, want)`, where `source` is the matched
        example's source code (with prompts and indentation stripped);
        and `want` is the example's expected output (with indentation
        stripped).

        `name` is the string's name, and `lineno` is the line number
        where the example starts; both are used for error messages.
        r^r�rFr&NrZr�csg|]}|�dd��qS)rYNr,)r�Zsl�r^r,r-r��sz0DocTestParser._parse_example.<locals>.<listcomp>rwz *$rrcsg|]}|�d��qSrlr,)r�Zwlr�r,r-r��sr�)
r)r�rt�_check_prompt_blank�
_check_prefixr�r[�match�
_EXCEPTION_RE�
_find_options)
rjr�r+r��source_linesr�rw�
want_linesr�r�r,r�r-r��s& 


�zDocTestParser._parse_examplez#\s*doctest:\s*([^\n\'"]*)$c	Cs�i}|j�|�D]v}|�d��dd���}|D]V}|ddksN|dd�tkrdtd|d||f��t|dd�}|ddk||<q.q|r�|�|�r�td	|||f��|S)
a
        Return a dictionary containing option overrides extracted from
        option directives in the given source string.

        `name` is the string's name, and `lineno` is the line number
        where the example starts; both are used for error messages.
        r&�,rZr"z+-Nz7line %r of the doctest for %s has an invalid option: %r�+zSline %r of the doctest for %s has an option directive on a line with no example: %r)�_OPTION_DIRECTIVE_REr�r�rGrtr'r�r�)	rjr�r+r�r�r�Zoption_strings�option�flagr,r,r-r��s"���zDocTestParser._find_optionsz
^([ ]*)(?=\S)cCs2dd�|j�|�D�}t|�dkr*t|�SdSdS)z;Return the minimum indentation of any non-blank line in `s`cSsg|]}t|��qSr,)r))r�r^r,r,r-r�
sz-DocTestParser._min_indent.<locals>.<listcomp>r"N)�
_INDENT_RE�findallr)�min)rjr]�indentsr,r,r-r�szDocTestParser._min_indentc	Cs^t|�D]P\}}t|�|dkr||ddkrtd||d||||d�|f��qdS)a

        Given the lines of a source string (including prompts and
        leading indentation), check to make sure that every prompt is
        followed by a space character.  If any line is not followed by
        a space character, then raise ValueError.
        rYrKrZz8line %r of the docstring for %s lacks blank after %s: %rr&N)�	enumerater)r�)rj�linesr^r+r�r�rr,r,r-r�s ��z!DocTestParser._check_prompt_blankcCs>t|�D]0\}}|r|�|�std||d||f��qdS)z�
        Check that every line in the given list starts with the given
        prefix; if any line does not, then raise a ValueError.
        zGline %r of the docstring for %s has inconsistent leading whitespace: %rr&N)r�rur�)rjr��prefixr+r�r�rr,r,r-r�s
�zDocTestParser._check_prefixN)r�)r�)r6rprqr�r[�compile�	MULTILINE�VERBOSEr��DOTALLr�r�r�r�r�r�r�r�r�r�r�r�r�r,r,r,r-rCs(
��
'
3�c@sNeZdZdZde�ddfdd�Zddd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)ra<
    A class used to extract the DocTests that are relevant to a given
    object, from its docstring and the docstrings of its contained
    objects.  Doctests can currently be extracted from the following
    object types: modules, functions, classes, methods, staticmethods,
    classmethods, and properties.
    FTcCs||_||_||_||_dS)at
        Create a new doctest finder.

        The optional argument `parser` specifies a class or
        function that should be used to create new DocTest objects (or
        objects that implement the same interface as DocTest).  The
        signature for this factory function should match the signature
        of the DocTest constructor.

        If the optional argument `recurse` is false, then `find` will
        only examine the given object, and not any contained objects.

        If the optional argument `exclude_empty` is false, then `find`
        will include tests for objects with empty docstrings.
        N)�_parser�_verbose�_recurse�_exclude_empty)rj�verbose�parser�recurse�
exclude_emptyr,r,r-r�7szDocTestFinder.__init__Nc		CsN|dkr.t|dd�}|dkr.tdt|�f��|dkr<d}n|dkrNt�|�}zt�|�}Wntk
rtd}YndX|s�t�|�}|d|dd�dks�d}|dkr�d}n*|dk	r�t�	||j
�}n
t�	|�}|s�d}|dkr�|dkr�i}n
|j
��}n|��}|dk	�r|�|�d|k�r(d|d<g}|�
||||||i�|��|S)	aj
        Return a list of the DocTests that are defined by the given
        object's docstring, or by any of its contained objects'
        docstrings.

        The optional parameter `module` is the module that contains
        the given object.  If the module is not specified or is None, then
        the test finder will attempt to automatically determine the
        correct module.  The object's module is used:

            - As a default namespace, if `globs` is not specified.
            - To prevent the DocTestFinder from extracting DocTests
              from objects that are imported from other modules.
            - To find the name of the file containing the object.
            - To help find the line number of the object within its
              file.

        Contained objects whose module does not match `module` are ignored.

        If `module` is False, no attempt to find the module will be made.
        This is obscure, of use mostly in tests:  if `module` is False, or
        is None but cannot be found automatically, then all objects are
        considered to belong to the (non-existent) module, so all contained
        objects will (recursively) be searched for doctests.

        The globals for each DocTest is formed by combining `globs`
        and `extraglobs` (bindings in `extraglobs` override bindings
        in `globs`).  A new copy of the globals dictionary is created
        for each DocTest.  If `globs` is not specified, then it
        defaults to the module's `__dict__`, if specified, or {}
        otherwise.  If `extraglobs` is not specified, then it defaults
        to {}.

        Nr6zJDocTestFinder.find: name must be given when obj.__name__ doesn't exist: %rFr"���z<]>r�)r0r�r�r7�	getmoduleZ
getsourcefilerBZgetfile�	linecache�getlines�__dict__r��update�_find�sort)	rj�objr+rCr1�
extraglobsr`r��testsr,r,r-rvMsL$�






zDocTestFinder.findcCs�|dkrdSt�|�dk	r(|t�|�kSt�|�r>|j|jkSt�|�r|t|d�r\|jj}nt|d�rn|j}ndS|j	|kSt�
|�r�|j	|jkSt|d�r�|j	|jkSt|t�r�dSt
d��dS)zY
        Return true if the given object is defined in the given
        module.
        NT�__objclass__rpz"object must be a class or function)r7r��
isfunctionr��__globals__ZismethoddescriptorrPr�rpr6�isclassr9�propertyr�)rjrC�objectZobj_modr,r,r-�_from_module�s(








zDocTestFinder._from_modulec
Cs|jrtd|�t|�|kr"dSd|t|�<|�|||||�}|dk	rR|�|�t�|�r�|jr�|j�	�D]P\}	}
d||	f}	t�
t�|
��s�t�|
�rl|�
||
�rl|�||
|	||||�qlt�|��rn|j�rnt|di��	�D]�\}	}
t|	t��stdt|	�f��t�
|
��sJt�|
��sJt�|
��sJt|
t��sJtdt|
�f��d||	f}	|�||
|	||||�q�t�|��r|j�r|j�	�D]�\}	}
t|
t��r�t||	�}
t|
t��r�t||	�j}
t�
|
��s�t�|
��s�t|
t��r�|�
||
��r�d||	f}	|�||
|	||||��q�dS)	zm
        Find tests for the given object and any contained objects, and
        add them to `tests`.
        zFinding tests in %sNr&z%s.%s�__test__z5DocTestFinder.find: __test__ keys must be strings: %rz`DocTestFinder.find: __test__ values must be strings, functions, methods, classes, or modules: %rz%s.__test__.%s)r��printr��	_get_testr�r7r8r�r��itemsZ	isroutineZunwrapr�rr�r0r9r:r�r��staticmethod�classmethod�__func__r)rjr�r�r+rCr�r1�seen�testZvalname�valr,r,r-r��sn
�
�������
�
��zDocTestFinder._findc		Cs�t|t�r|}nJz,|jdkr"d}n|j}t|t�s:t|�}Wnttfk
rXd}YnX|�||�}|jrt|stdS|dkr�d}n.t|dd�p�|j}|dd�dkr�|dd�}|j	�
|||||�S)zs
        Return a DocTest for the given object, if it defines a docstring;
        otherwise, return None.
        Nr�r�����.pycrr)r9r:r�rB�AttributeError�_find_linenor�r0r6r�r�)	rjr�r+rCr1r�r�r�rTr,r,r-rs,




�zDocTestFinder._get_testcCsd}t�|�rd}t�|�rb|dkr(dSt�dt|dd��}t|�D]\}}|�|�rF|}qbqFt�|�rr|j	}t�
|�r�|j}t�|�r�|j
}t�|�r�|j}t�|�r�t|dd�d}|dk	�r
|dkr�|dSt�d�}t|t|��D]}|�||�r�|Sq�dS)	z�
        Return a line number of the given object's docstring.  Note:
        this method assumes that the object has a docstring.
        Nr"z^\s*class\s*%s\br6�-�co_firstlinenor&z(^|.*:)\s*\w*("|\'))r7r8r�r[r�r0r�r�Zismethodr	r��__code__Zistraceback�tb_frameZisframe�f_codeZiscode�ranger))rjr�r�r�Zpatr�rr,r,r-r4s>


�








zDocTestFinder._find_lineno)NNNN)r6rprqr�rr�rvrr�rrr,r,r,r-r.s�

f?&c@s�eZdZdZdZddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Ze
�d�Zd dd�Zd!dd�Zd"dd�Zdd�ZdS)#ra3	
    A class used to run DocTest test cases, and accumulate statistics.
    The `run` method is used to process a single DocTest case.  It
    returns a tuple `(f, t)`, where `t` is the number of test cases
    tried, and `f` is the number of test cases that failed.

        >>> tests = DocTestFinder().find(_TestClass)
        >>> runner = DocTestRunner(verbose=False)
        >>> tests.sort(key = lambda test: test.name)
        >>> for test in tests:
        ...     print(test.name, '->', runner.run(test))
        _TestClass -> TestResults(failed=0, attempted=2)
        _TestClass.__init__ -> TestResults(failed=0, attempted=2)
        _TestClass.get -> TestResults(failed=0, attempted=2)
        _TestClass.square -> TestResults(failed=0, attempted=1)

    The `summarize` method prints a summary of all the test cases that
    have been run by the runner, and returns an aggregated `(f, t)`
    tuple:

        >>> runner.summarize(verbose=1)
        4 items passed all tests:
           2 tests in _TestClass
           2 tests in _TestClass.__init__
           2 tests in _TestClass.get
           1 tests in _TestClass.square
        7 tests in 4 items.
        7 passed and 0 failed.
        Test passed.
        TestResults(failed=0, attempted=7)

    The aggregated number of tried examples and failed examples is
    also available via the `tries` and `failures` attributes:

        >>> runner.tries
        7
        >>> runner.failures
        0

    The comparison between expected outputs and actual outputs is done
    by an `OutputChecker`.  This comparison may be customized with a
    number of option flags; see the documentation for `testmod` for
    more information.  If the option flags are insufficient, then the
    comparison may also be customized by passing a subclass of
    `OutputChecker` to the constructor.

    The test runner's display output can be controlled in two ways.
    First, an output function (`out) can be passed to
    `TestRunner.run`; this function will be called with strings that
    should be displayed.  It defaults to `sys.stdout.write`.  If
    capturing the output is not sufficient, then the display output
    can be also customized by subclassing DocTestRunner, and
    overriding the methods `report_start`, `report_success`,
    `report_unexpected_exception`, and `report_failure`.
    zF**********************************************************************Nr"cCsN|pt�|_|dkrdtjk}||_||_||_d|_d|_i|_	t
�|_dS)ac
        Create a new test runner.

        Optional keyword arg `checker` is the `OutputChecker` that
        should be used to compare the expected outputs and actual
        outputs of doctest examples.

        Optional keyword arg 'verbose' prints lots of stuff if true,
        only failures if false; by default, it's true iff '-v' is in
        sys.argv.

        Optional argument `optionflags` can be used to control how the
        test runner compares expected output to actual output, and how
        it displays failures.  See the documentation for `testmod` for
        more information.
        N�-vr")r�_checkerr>r�r��optionflags�original_optionflags�tries�failures�_name2ftrg�_fakeout)rj�checkerr�rr,r,r-r��s
zDocTestRunner.__init__cCsH|jrD|jr.|dt|j�dt|j��n|dt|j�d�dS)z�
        Report that the test runner is about to process the given
        example.  (Only displays a message if verbose=True)
        zTrying:
zExpecting:
zExpecting nothing
N)r�rwr_r�)rjr�r�exampler,r,r-�report_start�s���zDocTestRunner.report_startcCs|jr|d�dS)zt
        Report that the given example ran successfully.  (Only
        displays a message if verbose=True)
        zok
N)r��rjr�rr rxr,r,r-�report_success�szDocTestRunner.report_successcCs&||�||�|j�|||j��dS)z7
        Report that the given example failed.
        N)�_failure_headerr�output_differencerr"r,r,r-�report_failure�s�zDocTestRunner.report_failurecCs$||�||�dtt|���dS)zO
        Report that the given example raised an unexpected exception.
        zException raised:
N)r$r_rf�rjr�rr rdr,r,r-�report_unexpected_exception�s
�
�z)DocTestRunner.report_unexpected_exceptioncCs�|jg}|jrR|jdk	r4|jdk	r4|j|jd}nd}|�d|j||jf�n|�d|jd|jf�|�d�|j}|�t|��d�|�S)Nr&�?zFile "%s", line %s, in %szLine %s, in %szFailed example:rF)�DIVIDERrTr�r�r+r�r_r�)rjrr r�r�r�r,r,r-r$�s�
zDocTestRunner._failure_headerc	Cs�d}}|j}td�\}}}	|jj}
t|j�D�]6\}}|jt@oH|dk}
||_|jr�|j��D],\}}|r||j|O_q`|j|M_q`|jt	@r�q.|d7}|
s�|�
|||�d|j|f}z,tt
|j|d|d�|j�|j��d}Wn4tk
�r�Ynt��}|j��YnX|j��}|j�d�|}|dk�r`|
|j||j��r�|}n|tj|dd��d}|
�s�|t|�7}|jdk�r�|	}nB|
|j||j��r�|}n*|jt@�r�|
t|j�t|�|j��r�|}||k�r�|
�sR|�||||�nT||k�r(|
�s|� ||||�|d7}n*||	k�rR|
�sH|�!||||�|d7}n|r.|jt"@r.�qhq.||_|�#|||�t$||�S)	a�
        Run the examples in `test`.  Write the outcome of each example
        with one of the `DocTestRunner.report_*` methods, using the
        writer function `out`.  `compileflags` is the set of compiler
        flags that should be used to execute examples.  Return a tuple
        `(f, t)`, where `t` is the number of examples tried, and `f`
        is the number of examples that failed.  The examples are run
        in the namespace `test.globs`.
        r"rKr&z<doctest %s[%d]>ZsingleNr4rr)%rrr�check_outputr�r�rr�rrr!r+�execr�r�r1�debuggerr��KeyboardInterruptr>rdrrcrnrwra�format_exception_onlyrfr�rr�r#r&r(r�_DocTestRunner__record_outcomer%)rjr�compileflagsr�rrr�SUCCESS�FAILUREZBOOMZcheck�
examplenumr �quietZ
optionflagrrTZ	exceptionrxZoutcomer�r,r,r-Z__run�s�
�
��



�




�
zDocTestRunner.__runcCsL|j�|jd�\}}||||f|j|j<|j|7_|j|7_dS)z{
        Record the fact that the given DocTest (`test`) generated `f`
        failures out of `t` tried examples.
        r�N)rr/r+rr)rjrrW�t�f2�t2r,r,r-Z__record_outcome|szDocTestRunner.__record_outcomez.<doctest (?P<name>.+)\[(?P<examplenum>\d+)\]>$cCsV|j�|�}|rF|�d�|jjkrF|jjt|�d��}|jjdd�S|�	||�SdS)Nr+r4T��keepends)
�%_DocTestRunner__LINECACHE_FILENAME_REr�r�rr+r��intr��
splitlines�save_linecache_getlines)rjrT�module_globalsr�r r,r,r-Z__patched_linecache_getlines�s
z*DocTestRunner.__patched_linecache_getlinesTc		s||_|dkrt|j�}tj�|dkrV�j��dks@���dkrH�j}n��fdd�}|jt_t�	�}t
j}t��|_
|j
��|j
jt
_tj|_|jt_tj}tjt_z|�|||�W�S�t_|t
_t�|�|jt_|t_|�r�|j��ddl}d|_XdS)aJ
        Run the examples in `test`, and display the results using the
        writer function `out`.

        The examples are run in the namespace `test.globs`.  If
        `clear_globs` is true (the default), then this namespace will
        be cleared after the test runs, to help with garbage
        collection.  If you would like to examine the namespace after
        the test completes, then use `clear_globs=False`.

        `compileflags` gives the set of flags that should be used by
        the Python compiler when running the examples.  If not
        specified, then it will default to the set of future-import
        flags that apply to `globs`.

        The output of each example is checked using
        `DocTestRunner.check_output`, and the results are formatted by
        the `DocTestRunner.report_*` methods.
        N�utf-8cs t|��d���}��|�dS)N�backslashreplace)r:�encode�write)r]�rNr�r,r-r��szDocTestRunner.run.<locals>.outr")rr3r1r>r�rN�lowerrCr�gettracer�r�r�r-�resetr�r�r>�*_DocTestRunner__patched_linecache_getlines�displayhook�__displayhook__�settrace�clear�builtins�_�_DocTestRunner__run)	rjrr1r��clear_globsZ
save_traceZsave_set_traceZsave_displayhookrMr,rDr-�run�s<





zDocTestRunner.runc
Cs�|dkr|j}g}g}g}d}}|j��D]V}|\}\}	}
||
7}||	7}|
dkr`|�|�q,|	dkrx|�||
f�q,|�|�q,|r�|r�tt|�d�|��|D]}td|�q�|r�tt|�d�|��|D]\}}td||f�q�|�r:t|j�tt|�d�|��|D] \}\}	}
td|	|
|f��q|�rft|d	t|j�d
�t||d|d�|�rztd
|d�n|�r�td�t||�S)a�
        Print a summary of all the test cases that have been run by
        this DocTestRunner, and return a tuple `(f, t)`, where `f` is
        the total number of failed examples, and `t` is the total
        number of tried examples.

        The optional `verbose` argument controls how detailed the
        summary is.  If the verbosity is not specified, then the
        DocTestRunner's verbosity is used.
        Nr"zitems had no tests:z   zitems passed all tests:z %3d tests in %szitems had failures:z %3d of %3d in %sztests inzitems.z
passed andzfailed.z***Test Failed***z	failures.zTest passed.)	r�rrr�rr)r�r*r%)
rjr�ZnotestsZpassedZfailedZtotaltZtotalfr�r+rWr6�thingr�r,r,r-�	summarize�sP
zDocTestRunner.summarizecCsR|j}|j��D]<\}\}}||kr@||\}}||}||}||f||<qdSrl)rr)rjr��dr+rWr6r7r8r,r,r-�mergeszDocTestRunner.merge)NNr")N)NNT)N)r6rprqr�r*r�r!r#r&r(r$rOr0r[r�r;rHrQrSrUr,r,r,r-rhs9
$
}



I
9c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)ra_
    A class used to check the whether the actual output from a doctest
    example matches the expected output.  `OutputChecker` defines two
    methods: `check_output`, which compares a given pair of outputs,
    and returns true if they match; and `output_difference`, which
    returns a string describing the differences between two outputs.
    cCst|�dd�d�S)z=
        Convert string to hex-escaped ASCII string.
        �ASCIIrA)r:rB)rjr]r,r,r-�_toAscii(szOutputChecker._toAsciicCs�|�|�}|�|�}||kr dS|t@sH||fdkr8dS||fdkrHdS|t@s�t�dt�t�d|�}t�dd|�}||kr�dS|t@r�d�|�	��}d�|�	��}||kr�dS|t
@r�t||�r�dSdS)	a�
        Return True iff the actual output from an example (`got`)
        matches the expected output (`want`).  These strings are
        always considered to match if they are identical; but
        depending on what option flags the test runner is using,
        several non-exact match types are also possible.  See the
        documentation for `TestRunner` for more information about
        option flags.
        T)zTrue
z1
)zFalse
z0
z(?m)^%s\s*?$r�z(?m)^[^\S\n]+$rZF)rWrrr[r\�escape�BLANKLINE_MARKERrr�rtrr|�rjrwrxrr,r,r-r+.s4

�
zOutputChecker.check_outputcCs<|ttBtB@sdS|t@r dS|�d�dko:|�d�dkS)NFTrFr4)r	r
rr�rZr,r,r-�_do_a_fancy_diffms��zOutputChecker._do_a_fancy_diffc
Cs(|j}|t@st�dt|�}|�|||�r�|jdd�}|jdd�}|t@rptj	||dd�}t
|�dd�}d}nZ|t@r�tj||dd�}t
|�dd�}d}n,|t
@r�tjtjd	�}	t
|	�||��}d
}nd|td�|��S|r�|r�d
t|�t|�fS|�rdt|�S|�r dt|�SdSdS)z�
        Return a string describing the differences between the
        expected output for a given example (`example`) and the actual
        output (`got`).  `optionflags` is the set of option flags used
        to compare `want` and `got`.
        z(?m)^[ ]*(?=
)Tr9r4)�nNz#unified diff with -expected +actualz-context diff with expected followed by actual)Zcharjunkzndiff with -expected +actualzDifferences (%s):
r�zExpected:
%sGot:
%szExpected:
%sGot nothing
zExpected nothing
Got:
%szExpected nothing
Got nothing
)rwrr[r\rYr[r=r	�difflibZunified_diff�listr
Zcontext_diffrZDifferZIS_CHARACTER_JUNKZcomparer_r�)
rjr rxrrwr�Z	got_linesZdiffZkindZenginer,r,r-r%�s4zOutputChecker.output_differenceN)r6rprqr�rWr+r[r%r,r,r,r-r s
?c@s eZdZdZdd�Zdd�ZdS)rz�A DocTest example has failed in debugging mode.

    The exception instance has variables:

    - test: the DocTest object being run

    - example: the Example object that failed

    - got: the actual output
    cCs||_||_||_dSrl)rr rx)rjrr rxr,r,r-r��szDocTestFailure.__init__cCs
t|j�Srl�r:rr�r,r,r-�__str__�szDocTestFailure.__str__N�r6rprqr�r�r`r,r,r,r-r�s
c@s eZdZdZdd�Zdd�ZdS)rz�A DocTest example has encountered an unexpected exception

    The exception instance has variables:

    - test: the DocTest object being run

    - example: the Example object that failed

    - exc_info: the exception info
    cCs||_||_||_dSrl)rr rd)rjrr rdr,r,r-r��szUnexpectedException.__init__cCs
t|j�Srlr_r�r,r,r-r`�szUnexpectedException.__str__Nrar,r,r,r-r�s
c@s*eZdZdZd
dd�Zdd�Zdd	�ZdS)ra�	Run doc tests but raise an exception as soon as there is a failure.

       If an unexpected exception occurs, an UnexpectedException is raised.
       It contains the test, the example, and the original exception:

         >>> runner = DebugRunner(verbose=False)
         >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42',
         ...                                    {}, 'foo', 'foo.py', 0)
         >>> try:
         ...     runner.run(test)
         ... except UnexpectedException as f:
         ...     failure = f

         >>> failure.test is test
         True

         >>> failure.example.want
         '42\n'

         >>> exc_info = failure.exc_info
         >>> raise exc_info[1] # Already has the traceback
         Traceback (most recent call last):
         ...
         KeyError

       We wrap the original exception to give the calling application
       access to the test and example information.

       If the output doesn't match, then a DocTestFailure is raised:

         >>> test = DocTestParser().get_doctest('''
         ...      >>> x = 1
         ...      >>> x
         ...      2
         ...      ''', {}, 'foo', 'foo.py', 0)

         >>> try:
         ...    runner.run(test)
         ... except DocTestFailure as f:
         ...    failure = f

       DocTestFailure objects provide access to the test:

         >>> failure.test is test
         True

       As well as to the example:

         >>> failure.example.want
         '2\n'

       and the actual output:

         >>> failure.got
         '1\n'

       If a failure or error occurs, the globals are left intact:

         >>> del test.globs['__builtins__']
         >>> test.globs
         {'x': 1}

         >>> test = DocTestParser().get_doctest('''
         ...      >>> x = 2
         ...      >>> raise KeyError
         ...      ''', {}, 'foo', 'foo.py', 0)

         >>> runner.run(test)
         Traceback (most recent call last):
         ...
         doctest.UnexpectedException: <DocTest foo from foo.py:0 (2 examples)>

         >>> del test.globs['__builtins__']
         >>> test.globs
         {'x': 2}

       But the globals are cleared if there is no error:

         >>> test = DocTestParser().get_doctest('''
         ...      >>> x = 2
         ...      ''', {}, 'foo', 'foo.py', 0)

         >>> runner.run(test)
         TestResults(failed=0, attempted=1)

         >>> test.globs
         {}

       NTcCs$t�||||d�}|r |j��|S)NF)rrQr1rL)rjrr1r�rP�rr,r,r-rQ3s
zDebugRunner.runcCst|||��dSrl)rr'r,r,r-r(9sz'DebugRunner.report_unexpected_exceptioncCst|||��dSrl)rr"r,r,r-r&<szDebugRunner.report_failure)NNT)r6rprqr�rQr(r&r,r,r,r-r�sZ
TFc	Cs�|dkrtj�d�}t�|�s,td|f��|dkr:|j}t|d�}	|rVt||d�}
nt	||d�}
|	j
||||d�D]}|
�|�qt|r�|
��t
dkr�|
a
n
t
�|
�t|
j|
j�S)a*
m=None, name=None, globs=None, verbose=None, report=True,
       optionflags=0, extraglobs=None, raise_on_error=False,
       exclude_empty=False

    Test examples in docstrings in functions and classes reachable
    from module m (or the current module if m is not supplied), starting
    with m.__doc__.

    Also test examples reachable from dict m.__test__ if it exists and is
    not None.  m.__test__ maps names to functions, classes and strings;
    function and class docstrings are tested even if the name is private;
    strings are tested directly, as if they were docstrings.

    Return (#failures, #tests).

    See help(doctest) for an overview.

    Optional keyword arg "name" gives the name of the module; by default
    use m.__name__.

    Optional keyword arg "globs" gives a dict to be used as the globals
    when executing examples; by default, use m.__dict__.  A copy of this
    dict is actually used for each docstring, so that each docstring's
    examples start with a clean slate.

    Optional keyword arg "extraglobs" gives a dictionary that should be
    merged into the globals that are used to execute examples.  By
    default, no extra globals are used.  This is new in 2.4.

    Optional keyword arg "verbose" prints lots of stuff if true, prints
    only failures if false; by default, it's true iff "-v" is in sys.argv.

    Optional keyword arg "report" prints a summary at the end when true,
    else prints nothing at the end.  In verbose mode, the summary is
    detailed, else very brief (in fact, empty if all tests passed).

    Optional keyword arg "optionflags" or's together module constants,
    and defaults to 0.  This is new in 2.3.  Possible values (see the
    docs for details):

        DONT_ACCEPT_TRUE_FOR_1
        DONT_ACCEPT_BLANKLINE
        NORMALIZE_WHITESPACE
        ELLIPSIS
        SKIP
        IGNORE_EXCEPTION_DETAIL
        REPORT_UDIFF
        REPORT_CDIFF
        REPORT_NDIFF
        REPORT_ONLY_FIRST_FAILURE

    Optional keyword arg "raise_on_error" raises an exception on the
    first unexpected exception or failure. This allows failures to be
    post-mortem debugged.

    Advanced tomfoolery:  testmod runs methods of a local instance of
    class doctest.Tester, then merges the results into (or creates)
    global Tester instance doctest.master.  Methods of doctest.master
    can be called directly too, if you want to do something unusual.
    Passing report=0 to testmod is especially useful then, to delay
    displaying a summary.  Invoke doctest.master.summarize(verbose)
    when you're done fiddling.
    Nr�ztestmod: module required; %r)r��r�r�r1r�)r>r?r/r7r8rBr6rrrrvrQrS�masterrUr%rr)r�r+r1r��reportrr��raise_on_errorr��finder�runnerrr,r,r-rHs$E


cCs�|r|std��t||||pd�\}}|dkr:tj�|�}|dkrHi}n|��}|dk	rb|�|�d|krrd|d<|	r�t||d�}
nt||d�}
|
�	||||d�}|
�
|�|r�|
��tdkr�|
an
t�
|
�t|
j|
j�S)a


    Test examples in the given file.  Return (#failures, #tests).

    Optional keyword arg "module_relative" specifies how filenames
    should be interpreted:

      - If "module_relative" is True (the default), then "filename"
         specifies a module-relative path.  By default, this path is
         relative to the calling module's directory; but if the
         "package" argument is specified, then it is relative to that
         package.  To ensure os-independence, "filename" should use
         "/" characters to separate path segments, and should not
         be an absolute path (i.e., it may not begin with "/").

      - If "module_relative" is False, then "filename" specifies an
        os-specific path.  The path may be absolute or relative (to
        the current working directory).

    Optional keyword arg "name" gives the name of the test; by default
    use the file's basename.

    Optional keyword argument "package" is a Python package or the
    name of a Python package whose directory should be used as the
    base directory for a module relative filename.  If no package is
    specified, then the calling module's directory is used as the base
    directory for module relative filenames.  It is an error to
    specify "package" if "module_relative" is False.

    Optional keyword arg "globs" gives a dict to be used as the globals
    when executing examples; by default, use {}.  A copy of this dict
    is actually used for each docstring, so that each docstring's
    examples start with a clean slate.

    Optional keyword arg "extraglobs" gives a dictionary that should be
    merged into the globals that are used to execute examples.  By
    default, no extra globals are used.

    Optional keyword arg "verbose" prints lots of stuff if true, prints
    only failures if false; by default, it's true iff "-v" is in sys.argv.

    Optional keyword arg "report" prints a summary at the end when true,
    else prints nothing at the end.  In verbose mode, the summary is
    detailed, else very brief (in fact, empty if all tests passed).

    Optional keyword arg "optionflags" or's together module constants,
    and defaults to 0.  Possible values (see the docs for details):

        DONT_ACCEPT_TRUE_FOR_1
        DONT_ACCEPT_BLANKLINE
        NORMALIZE_WHITESPACE
        ELLIPSIS
        SKIP
        IGNORE_EXCEPTION_DETAIL
        REPORT_UDIFF
        REPORT_CDIFF
        REPORT_NDIFF
        REPORT_ONLY_FIRST_FAILURE

    Optional keyword arg "raise_on_error" raises an exception on the
    first unexpected exception or failure. This allows failures to be
    post-mortem debugged.

    Optional keyword arg "parser" specifies a DocTestParser (or
    subclass) that should be used to extract tests from the files.

    Optional keyword arg "encoding" specifies an encoding that should
    be used to convert the file to unicode.

    Advanced tomfoolery:  testmod runs methods of a local instance of
    class doctest.Tester, then merges the results into (or creates)
    global Tester instance doctest.master.  Methods of doctest.master
    can be called directly too, if you want to do something unusual.
    Passing report=0 to testmod is especially useful then, to delay
    displaying a summary.  Invoke doctest.master.summarize(verbose)
    when you're done fiddling.
    �8Package may only be specified for module-relative paths.r@Nr6r�rcr")r�rXr�r��basenamer�r�rrr�rQrSrerUr%rr)rTrVr+rUr1r�rfrr�rgr�rN�textrirr,r,r-r�s2R�


�NoNamec	Cs@t|dd�}t||d�}|j|||d�D]}|j||d�q(dS)ar
    Test examples in the given object's docstring (`f`), using `globs`
    as globals.  Optional argument `name` is used in failure messages.
    If the optional argument `verbose` is true, then generate output
    even if there are no failures.

    `compileflags` gives the set of flags that should be used by the
    Python compiler when running the examples.  If not specified, then
    it will default to the set of future-import flags that apply to
    `globs`.

    Optional keyword arg `optionflags` specifies options for the
    testing and output.  See the documentation for `testmod` for more
    information.
    F)r�r�rc)r1)r1N)rrrvrQ)	rWr1r�r+r1rrhrirr,r,r-r+scCs"|t@|krtd|��t}|a|S)a?Sets the unittest option flags.

    The old flag is returned so that a runner could restore the old
    value if it wished to:

      >>> import doctest
      >>> old = doctest._unittest_reportflags
      >>> doctest.set_unittest_reportflags(REPORT_NDIFF |
      ...                          REPORT_ONLY_FIRST_FAILURE) == old
      True

      >>> doctest._unittest_reportflags == (REPORT_NDIFF |
      ...                                   REPORT_ONLY_FIRST_FAILURE)
      True

    Only reporting flags can be set:

      >>> doctest.set_unittest_reportflags(ELLIPSIS)
      Traceback (most recent call last):
      ...
      ValueError: ('Only reporting flags allowed', 8)

      >>> doctest.set_unittest_reportflags(old) == (REPORT_NDIFF |
      ...                                   REPORT_ONLY_FIRST_FAILURE)
      True
    zOnly reporting flags allowed)r
r��_unittest_reportflags)r2�oldr,r,r-rHs

c@sleZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Ze
jZdd�ZdS)�DocTestCaser"NcCs.tj�|�||_||_||_||_||_dSrl)�unittest�TestCaser��_dt_optionflags�_dt_checker�_dt_test�	_dt_setUp�_dt_tearDown)rjrr�setUp�tearDownrr,r,r-r�nszDocTestCase.__init__cCs|j}|jdk	r|�|�dSrl)rurv�rjrr,r,r-rxxs
zDocTestCase.setUpcCs(|j}|jdk	r|�|�|j��dSrl)rurwr1rLrzr,r,r-ry~s

zDocTestCase.tearDowncCs~|j}tj}t�}|j}|t@s(|tO}t||jdd�}z d|_	|j
||jdd�\}}W5|t_X|rz|�|�
|�����dS)NF�rrr�zF----------------------------------------------------------------------)r�rP)rur>r�r#rsr
rnrrtr*rQrCZfailureException�format_failurerc)rjrro�newrrirrr,r,r-�runTest�s(��zDocTestCase.runTestcCsP|j}|jdkrd}n
d|j}d�|j�d�dd��}d|j|j|||fS)Nzunknown line numberz%sr�rrz:Failed doctest test for %s
  File "%s", line %s, in %s

%s)rur�r�r+rtrT)rj�errrr�Zlnamer,r,r-r|�s

�zDocTestCase.format_failurecCs6|��t|j|jdd�}|j|jdd�|��dS)a�Run the test case without results and without catching exceptions

           The unit test framework includes a debug method on test cases
           and test suites to support post-mortem debugging.  The test code
           is run in such a way that errors are not caught.  This way a
           caller can catch the errors and initiate post-mortem debugging.

           The DocTestCase provides a debug method that raises
           UnexpectedException errors if there is an unexpected
           exception:

             >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42',
             ...                {}, 'foo', 'foo.py', 0)
             >>> case = DocTestCase(test)
             >>> try:
             ...     case.debug()
             ... except UnexpectedException as f:
             ...     failure = f

           The UnexpectedException contains the test, the example, and
           the original exception:

             >>> failure.test is test
             True

             >>> failure.example.want
             '42\n'

             >>> exc_info = failure.exc_info
             >>> raise exc_info[1] # Already has the traceback
             Traceback (most recent call last):
             ...
             KeyError

           If the output doesn't match, then a DocTestFailure is raised:

             >>> test = DocTestParser().get_doctest('''
             ...      >>> x = 1
             ...      >>> x
             ...      2
             ...      ''', {}, 'foo', 'foo.py', 0)
             >>> case = DocTestCase(test)

             >>> try:
             ...    case.debug()
             ... except DocTestFailure as f:
             ...    failure = f

           DocTestFailure objects provide access to the test:

             >>> failure.test is test
             True

           As well as to the example:

             >>> failure.example.want
             '2\n'

           and the actual output:

             >>> failure.got
             '1\n'

           Fr{)rPN)rxrrsrtrQrury)rjrir,r,r-r!�sB�zDocTestCase.debugcCs|jjSrl�rur+r�r,r,r-r��szDocTestCase.idcCsPt|�t|�k	rtS|j|jkoN|j|jkoN|j|jkoN|j|jkoN|j|jkSrl)r�r�rursrvrwrtr�r,r,r-r��s
�
�
�
�zDocTestCase.__eq__cCst|j|j|j|jf�Srl)r�rsrvrwrtr�r,r,r-r��s�zDocTestCase.__hash__cCs,|jj�d�}d|dd�|dd��fS)Nr�z%s (%s)rr)rur+rtr�)rjr+r,r,r-r�	szDocTestCase.__repr__cCsd|jjS)Nz	Doctest: r�r�r,r,r-�shortDescription		szDocTestCase.shortDescription)r"NNN)r6rprqr�rxryr~r|r!r�r�r�r�rr`r�r,r,r,r-rpls�

H
rpc@s0eZdZdd�Zdd�Zdd�Zdd�ZeZd	S)
�SkipDocTestCasecCs||_t�|d�dSrl)rCrpr�)rjrCr,r,r-r�
	szSkipDocTestCase.__init__cCs|�d�dS)Nz-DocTestSuite will not work with -O2 and above)ZskipTestr�r,r,r-rx	szSkipDocTestCase.setUpcCsdSrlr,r�r,r,r-�	test_skip	szSkipDocTestCase.test_skipcCsd|jjS)NzSkipping tests from %s)rCr6r�r,r,r-r�	sz SkipDocTestCase.shortDescriptionN)r6rprqr�rxr�r�r`r,r,r,r-r�	s
r�c@seZdZdd�ZdS)�
_DocTestSuitecCsdSrlr,)rj�indexr,r,r-�_removeTestAtIndex	sz _DocTestSuite._removeTestAtIndexN)r6rprqr�r,r,r,r-r�	sr�c	Ks�|dkrt�}t|�}|j|||d�}|sNtjjdkrNt�}|�t|��|S|�	�t�}|D]T}t
|j�dkrtq`|js�|j
}|dd�dkr�|dd�}||_|�t|f|��q`|S)a
    Convert doctest tests for a module to a unittest test suite.

    This converts each documentation string in a module that
    contains doctest tests to a unittest test case.  If any of the
    tests in a doc string fail, then the test case fails.  An exception
    is raised showing the name of the file containing the test and a
    (sometimes approximate) line number.

    The `module` argument provides the module to be tested.  The argument
    can be either a module or a module name.

    If no argument is given, the calling module is used.

    A number of options may be provided as keyword arguments:

    setUp
      A set-up function.  This is called before running the
      tests in each file. The setUp function will be passed a DocTest
      object.  The setUp function can access the test globals as the
      globs attribute of the test passed.

    tearDown
      A tear-down function.  This is called after running the
      tests in each file.  The tearDown function will be passed a DocTest
      object.  The tearDown function can access the test globals as the
      globs attribute of the test passed.

    globs
      A dictionary containing initial global variables for the tests.

    optionflags
       A set of doctest option flags expressed as an integer.
    Nrdr4r"r
rrr)rrDrvr>r2�optimizer��addTestr�r�r)r�rTr�rp)	rCr1r�Ztest_finderr�r��suiterrTr,r,r-r#	s(%c@s$eZdZdd�Zdd�Zdd�ZdS)�DocFileCasecCsd�|jj�d��S)NrNr�)r�rur+rtr�r,r,r-r�e	szDocFileCase.idcCs|jjSrl)rurTr�r,r,r-r�h	szDocFileCase.__repr__cCsd|jj|jj|fS)Nz2Failed doctest test for %s
  File "%s", line 0

%s)rur+rT)rjrr,r,r-r|k	s�zDocFileCase.format_failureN)r6rprqr�r�r|r,r,r,r-r�c	sr�c
Ksv|dkri}n|��}|r&|s&td��t||||p4d�\}}d|krL||d<tj�|�}|�||||d�}	t|	f|�S)Nrjr@r�r")r�r�rXr�r�rkr�r�)
r�rVrUr1r�rNr��docr+rr,r,r-�DocFileTestp	s�r�cOsDt�}|�dd�r$t|�d��|d<|D]}|�t|f|��q(|S)a�A unittest suite for one or more doctest files.

    The path to each doctest file is given as a string; the
    interpretation of that string depends on the keyword argument
    "module_relative".

    A number of options may be provided as keyword arguments:

    module_relative
      If "module_relative" is True, then the given file paths are
      interpreted as os-independent module-relative paths.  By
      default, these paths are relative to the calling module's
      directory; but if the "package" argument is specified, then
      they are relative to that package.  To ensure os-independence,
      "filename" should use "/" characters to separate path
      segments, and may not be an absolute path (i.e., it may not
      begin with "/").

      If "module_relative" is False, then the given file paths are
      interpreted as os-specific paths.  These paths may be absolute
      or relative (to the current working directory).

    package
      A Python package or the name of a Python package whose directory
      should be used as the base directory for module relative paths.
      If "package" is not specified, then the calling module's
      directory is used as the base directory for module relative
      filenames.  It is an error to specify "package" if
      "module_relative" is False.

    setUp
      A set-up function.  This is called before running the
      tests in each file. The setUp function will be passed a DocTest
      object.  The setUp function can access the test globals as the
      globs attribute of the test passed.

    tearDown
      A tear-down function.  This is called after running the
      tests in each file.  The tearDown function will be passed a DocTest
      object.  The tearDown function can access the test globals as the
      globs attribute of the test passed.

    globs
      A dictionary containing initial global variables for the tests.

    optionflags
      A set of doctest option flags expressed as an integer.

    parser
      A DocTestParser (or subclass) that should be used to extract
      tests from the files.

    encoding
      An encoding that will be used to convert the files to unicode.
    rVTrU)r�r/rDr�r�)�paths�kwr�r�r,r,r-r�	s8cCs�g}t��|�D]x}t|t�rh|�|jdd��|j}|r�|�d�|dd�|�d�dd�D�7}q|dd�|�d�dd�D�7}q|r�|ddkr�|��q�|r�|d	dkr�|�d	�q�d�	|�dS)
awExtract script from text with examples.

       Converts text with examples to a Python script.  Example input is
       converted to regular code.  Example output and all other words
       are converted to comments:

       >>> text = '''
       ...       Here are examples of simple math.
       ...
       ...           Python has super accurate integer addition
       ...
       ...           >>> 2 + 2
       ...           5
       ...
       ...           And very friendly error messages:
       ...
       ...           >>> 1/0
       ...           To Infinity
       ...           And
       ...           Beyond
       ...
       ...           You can use logic if you want:
       ...
       ...           >>> if 0:
       ...           ...    blah
       ...           ...    blah
       ...           ...
       ...
       ...           Ho hum
       ...           '''

       >>> print(script_from_examples(text))
       # Here are examples of simple math.
       #
       #     Python has super accurate integer addition
       #
       2 + 2
       # Expected:
       ## 5
       #
       #     And very friendly error messages:
       #
       1/0
       # Expected:
       ## To Infinity
       ## And
       ## Beyond
       #
       #     You can use logic if you want:
       #
       if 0:
          blah
          blah
       #
       #     Ho hum
       <BLANKLINE>
       Nrrz# Expected:cSsg|]}d|�qS)z## r,r�r,r,r-r�
sz(script_from_examples.<locals>.<listcomp>rFcSsg|]}t|��qSr,)r�r�r,r,r-r�
s�r}r")
rr�r9rr�r�rwrt�popr�)r]r�Zpiecerwr,r,r-r�	s :

"�

csJt|�}t��|�}�fdd�|D�}|s4t�d��|d}t|j�}|S)aExtract the test sources from a doctest docstring as a script.

    Provide the module (or dotted name of the module) containing the
    test to be debugged and the name (within the module) of the object
    with the doc string with tests to be debugged.
    csg|]}|j�kr|�qSr,r*)r�r6r*r,r-r�.
s
ztestsource.<locals>.<listcomp>znot found in testsr")rDrrvr�rr�)rCr+r�r�testsrcr,r*r-r%
s

cCst|�}t|||�dS)z4Debug a single doctest docstring, in argument `src`'N)r�debug_script)�src�pmr1r�r,r,r-r 5
scCs�ddl}|r|��}ni}|rvzt|||�Wq�tt��d�|jdd�}|��|�dt��d�Yq�Xn|jdd��	d|||�dS)z7Debug a test script.  `src` is the script, as a string.r"Nr&T)r�r4zexec(%r))
r�r�r,rr>rdr�rGZinteractionrQ)r�r�r1r��pr,r,r-r�:
s
r�cCs$t|�}t||�}t|||j�dS)z�Debug a single doctest docstring.

    Provide the module (or dotted name of the module) containing the
    test to be debugged and the name (within the module) of the object
    with the docstring with tests to be debugged.
    N)rDrr�r�)rCr+r�r�r,r,r-r!N
s
c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
_TestClassz�
    A pointless class, for sanity-checking of docstring testing.

    Methods:
        square()
        get()

    >>> _TestClass(13).get() + _TestClass(-12).get()
    1
    >>> hex(_TestClass(13).square().get())
    '0xa9'
    cCs
||_dS)z�val -> _TestClass object with associated value val.

        >>> t = _TestClass(123)
        >>> print(t.get())
        123
        N�r)rjrr,r,r-r�j
sz_TestClass.__init__cCs|jd|_|S)zosquare() -> square TestClass's associated value

        >>> _TestClass(13).square().get()
        169
        r4r�r�r,r,r-�squaret
sz_TestClass.squarecCs|jS)z~get() -> return TestClass's associated value.

        >>> x = _TestClass(-42)
        >>> print(x.get())
        -42
        r�r�r,r,r-r/~
sz_TestClass.getN)r6rprqr�r�r�r/r,r,r,r-r�\
s


r�z�
                      Example of a string object, searched as-is.
                      >>> x = 1; y = 2
                      >>> x + y, x * y
                      (3, 2)
                      a�
                                    In 2.2, boolean expressions displayed
                                    0 or 1.  By default, we still accept
                                    them.  This can be disabled by passing
                                    DONT_ACCEPT_TRUE_FOR_1 to the new
                                    optionflags argument.
                                    >>> 4 == 4
                                    1
                                    >>> 4 == 4
                                    True
                                    >>> 4 > 4
                                    0
                                    >>> 4 > 4
                                    False
                                    z�
                Blank lines can be marked with <BLANKLINE>:
                    >>> print('foo\n\nbar\n')
                    foo
                    <BLANKLINE>
                    bar
                    <BLANKLINE>
            z�
                If the ellipsis flag is used, then '...' can be used to
                elide substrings in the desired output:
                    >>> print(list(range(1000))) #doctest: +ELLIPSIS
                    [0, 1, 2, ..., 999]
            a�
                If the whitespace normalization flag is used, then
                differences in whitespace are ignored.
                    >>> print(list(range(30))) #doctest: +NORMALIZE_WHITESPACE
                    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
                     15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
                     27, 28, 29]
            )r�r�zbool-int equivalencezblank linesZellipsiszwhitespace normalizationcCs"ddl}|jdd�}|jdddddd	�|jd
ddt��gd
d�|jddddd�|jdddd�|��}|j}|j}d}|jD]}|t|O}q�|j	r�|t
O}|D]v}|�d�r�tj
�|�\}}tj
�d|�t|dd��}	tj
d=t|	||d�\}
}nt|d||d�\}
}|
r�dSq�dS)Nr"zdoctest runner)Zdescriptionrz	--verbose�
store_trueFz'print very verbose output for all tests)�action�default�helpz-oz--optionr�zqspecify a doctest option flag to apply to the test run; may be specified more than once to apply multiple options)r��choicesr�r�z-fz--fail-fastzystop running tests after first failure (this is a shorthand for -o FAIL_FAST, and is in addition to any other -o options))r�r�r`r�z file containing the tests to run)�nargsr�z.py���rc)rVr�rr&)�argparse�ArgumentParser�add_argumentr'�keys�
parse_argsr`r�r�Z	fail_fastrrir�r�rtr>�insertr;rr)r�r�r�Z	testfilesr�r�r�rT�dirnamer�rrNr,r,r-�_test�
sL�
�
��

�
r�r�)r4)rY)	NNNNTr"NFF)FrmNr")NNNN)FN)FN)F)Sr�Z
__docformat__�__all__r.r]r7r�r�r�r[r>rarq�ior#�collectionsr$r%r'rrrrrrrrr	r
rrrr
rYrsr3rDrJrXr_rfrgr|r�r�r�r�rOrrrrrr�	Exceptionrrrrerrrrnrrrrpr�Z	TestSuiter�rr�r�rrrr r�r!r�rr�r6�exitr,r,r,r-�<module>	sF'�-
���������

1%.DKl<;n�
h�
{�
$!
@
�
IR


,	�3-
pyclbr.cpython-38.pyc000064400000024325150335716500010502 0ustar00U

e5d�;�@s�dZddlZddlZddlZddlZddlmZmZm	Z	ddddgZ
iZGdd	�d	�ZGd
d�de�Z
Gdd�de�Zdd
�Zddd�Zddd�Zddd�Zd dd�Zdd�Zdd�Zdd�Zdd�Zedkr�e�dS)!aParse a Python module and describe its classes and functions.

Parse enough of a Python file to recognize imports and class and
function definitions, and to find out the superclasses of a class.

The interface consists of a single function:
    readmodule_ex(module, path=None)
where module is the name of a Python module, and path is an optional
list of directories where the module is to be searched.  If present,
path is prepended to the system search path sys.path.  The return value
is a dictionary.  The keys of the dictionary are the names of the
classes and functions defined in the module (including classes that are
defined via the from XXX import YYY construct).  The values are
instances of classes Class and Function.  One special key/value pair is
present for packages: the key '__path__' has a list as its value which
contains the package search path.

Classes and Functions have a common superclass: _Object.  Every instance
has the following attributes:
    module  -- name of the module;
    name    -- name of the object;
    file    -- file in which the object is defined;
    lineno  -- line in the file where the object's definition starts;
    parent  -- parent of this object, if any;
    children -- nested objects contained in this object.
The 'children' attribute is a dictionary mapping names to objects.

Instances of Function describe functions with the attributes from _Object.

Instances of Class describe classes with the attributes from _Object,
plus the following:
    super   -- list of super classes (Class instances if possible);
    methods -- mapping of method names to beginning line numbers.
If the name of a super class is not recognized, the corresponding
entry in the list of super classes is not a class instance but a
string giving the name of the super class.  Since import statements
are recognized and imported modules are scanned as well, this
shouldn't happen often.
�N)�NAME�DEDENT�OP�
readmodule�
readmodule_ex�Class�Functionc@s eZdZdZdd�Zdd�ZdS)�_Objectz+Information about Python class or function.cCs(||_||_||_||_||_i|_dS�N)�module�name�file�lineno�parent�children��selfrrr
rr�r�/usr/lib64/python3.8/pyclbr.py�__init__6sz_Object.__init__cCs||j|<dSr
)r)rr�objrrr�	_addchild>sz_Object._addchildN)�__name__�
__module__�__qualname__�__doc__rrrrrrr	4sr	c@seZdZdZddd�ZdS)rz7Information about a Python function, including methods.NcCst�||||||�dSr
)r	rrrrrrDszFunction.__init__)N)rrrrrrrrrrBscs*eZdZdZd�fdd�	Zdd�Z�ZS)rz!Information about a Python class.Ncs0t�||||||�|dkr gn||_i|_dSr
)r	r�super�methods)rrrrr
rr��	__class__rrrJszClass.__init__cCs||j|<dSr
)r)rrrrrr�
_addmethodOszClass._addmethod)N)rrrrrr �
__classcell__rrrrrHscCs:t|j||j||�}|�||�t|t�r6|�||�|S)z*Return a Function after nesting within ob.)rrr
r�
isinstancerr )�ob�	func_namerZnewfuncrrr�_nest_functionSs

r%cCs&t|j|||j||�}|�||�|S)z'Return a Class after nesting within ob.)rrr
r)r#�
class_namerrZnewclassrrr�_nest_class[sr'cCs6i}t||pg���D]\}}t|t�r|||<q|S)z�Return Class objects for the top-level classes in module.

    This is the original interface, before Functions were added.
    )�_readmodule�itemsr"r)r�path�res�key�valuerrrras


cCst||p
g�S)z�Return a dictionary with all functions and classes in module.

    Search for module in PATH + sys.path.
    If possible, include imported superclasses.
    Do this by reading source, without importing (and executing) it.
    )r()rr*rrrrmsc	Cs�|dk	rd||f}n|}|tkr*t|Si}|tjkrL|dkrL|t|<|S|�d�}|dkr�|d|�}||dd�}t|||�}|dk	r�d||f}d|kr�td�|���t||d|�Sd}	|dk	r�|}
n
|tj}
tj	�
||
�}|dk�rtd|��|d	��|t|<|jdk	�r$|j|d<z|j
�|�}Wnttfk
�rR|YSX|dk�rb|S|j
�|�}
t|||
|||�S)
a.Do the hard work for readmodule[_ex].

    If inpackage is given, it must be the dotted name of the package in
    which we are searching for a submodule, and then PATH must be the
    package search path; otherwise, we are searching for a top-level
    module, and path is combined with sys.path.
    Nz%s.%s�.r��__path__zNo package named {}zno module named )r)�_modules�sys�builtin_module_names�rfindr(�ImportError�formatr*�	importlib�util�_find_spec_from_path�ModuleNotFoundError�submodule_search_locations�loader�
get_source�AttributeError�get_filename�_create_tree)rr*�	inpackage�
fullmodule�tree�i�packageZ	submoduler�fZsearch_path�spec�source�fnamerrrr(vsJ	





r(c!
CsHt�|�}g}t�|j�}�z|D�]�\}	}
}}}
|	tkr`|\}}|r^|dd|kr^|d=qBq"|
dkr�|\}}|r�|dd|kr�|d=qpt|�dd�\}	}}|	tkr�q"d}|r�|dd}t|||�}nt	||||�}|||<|�
||f�q"|
dk�r�|\}}|�r(|dd|k�r(|d=�qt|�dd�\}	}}|	tk�rJq"t|�dd�\}	}
}d}|
dk�r�g}d}g}t|�dd�\}	}
}|
d	k�r|dk�rd
�|�}||k�r�||}nL|�d�}t
|�dk�r|d}|d}|tk�rt|}||k�r||}|�
|�g}|
dk�r0|d7}nZ|
d
k�rR|d8}|dk�r��q�n8|
dk�rh|dk�rhn"|	ttfk�rz|dk�rz|�
|
��qz|}|�r�|dd}t||||�}nt|||||�}|||<|�
||f�q"|
dk�rh|ddk�rht|�}|D]d\}}zL|dk�r t||�n2zt|||�Wn tk
�rPt|g�YnXWnYnX�qq"|
dkr"|ddkr"t|�\}}
|r"|
dk�r�q"t|�}zt|||�}WnYq"YnX|D]X\}} ||k�r�|||| �p�|<n0|dk�r�|D] }|ddk�r�||||<�q��q�q"Wntk
�r:YnX|��|S)a�Return the tree for a particular module.

    fullmodule (full module name), inpackage+module, becomes o.module.
    path is passed to recursive calls of _readmodule.
    fname becomes o.file.
    source is tokenized.  Imports cause recursive calls to _readmodule.
    tree is {} or {'__path__': <submodule search locations>}.
    inpackage, None or string, is passed to recursive calls of _readmodule.

    The effect of recursive calls is mutation of global _modules.
    ���r/�defr�N�class�()�)�,�r.���rOrP�import�from�*�_)�io�StringIO�tokenize�generate_tokens�readliner�nextrr%r�append�join�split�lenr1rr'r�_getnamelistr(r5�_getname�
StopIteration�close)!rBr*rIrHrCrArF�stack�g�	tokentype�token�startZ_end�_linerZ
thisindentr$Zcur_funcZcur_objr&Zinherit�names�levelr�n�c�m�dZ	cur_class�modules�modZ_mod2Zn2rrrr@�s�
















��



r@cCslg}t|�\}}|sqh|dkr,t|�\}}nd}|�||f�|dkr\d|kr\t|�d}q>|dkrqhq|S)z�Return list of (dotted-name, as-name or None) tuples for token source g.

    An as-name is the name that follows 'as' in an as clause.
    �asNrP�
r/)rbr]r\)rfrkrrhZname2rrrraEsracCs�g}t|�dd�\}}|tkr0|dkr0d|fS|�|�t|�dd�\}}|dkrXq�t|�dd�\}}|tkrvq�|�|�q:d�|�|fS)zBReturn (dotted-name or None, next-token) tuple for token source g.r�rUNr.)r\rr]r^)rf�partsrgrhrrrrb[s
rbc
CsXddl}ztjd}Wnt}YnX|j�|�rj|j�|�g}|j�|�}|���	d�rn|dd�}ng}t
||�}dd�}t|��|dd	�}d
}|�rT|�
�}t|t�r�q�t|d�s�d|_t|t�r�t|j��|dd	�}|D]}	|j||	_q�|�|�t|t��r,td�d
|j|j|j|j��q�t|t�r�td�d
|j|j|j��q�dS)z?Print module output (default this file) for quick visual check.rNr/z.py���cSst|dd�S)Nrr)�getattr)�arrr�<lambda>|�z_main.<locals>.<lambda>T)r,�reverseru�indentz{}class {} {} {}� z{}def {} {})�osr2�argv�__file__r*�exists�dirname�basename�lower�endswithr�sorted�values�popr"�list�hasattrr}r	r�extendr�printr6rrrr)
rrrr*rCZ
lineno_keyZobjsZindent_levelrZnew_objsr#rrr�_mainmsL





�
�
r��__main__)N)N)N)N)rrWr2�importlib.utilr7rYrhrrr�__all__r1r	rrr%r'rrr(r@rarbr�rrrrr�<module>s,(


	
@&platform.cpython-38.opt-2.pyc000064400000040104150335716500011764 0ustar00U

e5d��@shdZdZddlZddlZddlZddlZddddddddd	d	d
�
Ze�d�Zdd
�Z	e�dej
�Zdvdd�Zdwdd�Z
e�d�Zdxdd�Zdddddddd d!d"d#d$�Zdd%d&d'd(d)d*�Zd+d,�Zd-d.�Zdyd/d0�Zd1d2�Zdzd4d5�Zd6d7�Zd{d8d9�Zd:d;�Zd<d=�Zd|d>d?�Zd@dA�Zd}dBdC�Zd~dDdE�ZdFdGdHd�Zej ddfdIdJ�Z!e�"dKdL�Z#da$dMdN�Z%dOdP�Z&dQdR�Z'dSdT�Z(dUdV�Z)dWdX�Z*dYdZ�Z+e�d[ej
�Z,e�d\ej
�Z-e�d]�Z.e�d^�Z/iZ0dd_d`�Z1dadb�Z2dcdd�Z3dedf�Z4dgdh�Z5didj�Z6dkdl�Z7dmdn�Z8iZ9d�dodp�Z:e;dqk�rddrej<k�p4dsej<kZ=dtej<k�oJduej<kZ>e?e:e>e=��e�@d�dS)�a
    Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
    Copyright (c) 2000-2010, eGenix.com Software GmbH; mailto:info@egenix.com

    Permission to use, copy, modify, and distribute this software and its
    documentation for any purpose and without fee or royalty is hereby granted,
    provided that the above copyright notice appear in all copies and that
    both that copyright notice and this permission notice appear in
    supporting documentation or portions thereof, including modifications,
    that you make.

    EGENIX.COM SOFTWARE GMBH DISCLAIMS ALL WARRANTIES WITH REGARD TO
    THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
    FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
    INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
    FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
    NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
    WITH THE USE OR PERFORMANCE OF THIS SOFTWARE !

z1.0.8�N�
���(�2��)
ZdevZalpha�aZbeta�b�cZRCZrc�pl�pz([0-9]+|[._+-])c	Csbg}t�|�D]N}|dkrzt|d�}d}Wn tk
rLt�|d�}YnX|�||f�q|S)Nz._+-r�dr)�
_component_re�split�int�
ValueError�_ver_stages�get�extend)�version�result�v�t�r� /usr/lib64/python3.8/platform.py�_comparable_version�s
rsC(__libc_init)|(GLIBC_([0-9.]+))|(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)��@c
Cs�|dkrZz0t�d�}|jdd�}t|�dkr6t|�WSWntttfk
rRYnXtj	}t
}ttjd�rvtj�
|�}t|d���`}|�|�}d}	|	t|�k�r�d|ks�d	|kr�t�||	�}
nd}
|
r�|
��t|�k�r|�|�}|�r|t|	t|�d
�d�|}d}	q�|
�s�q�dd�|
��D�\}}
}}}}|�rF|�sFd
}n�|
�rx|dk�r`d}|}n||�||�k�r�|}n\|�r�|dk�r�d
}|�r�|�r�||�||�k�r�|}|�r�|t|�d�|k�r�||}|
��}	q�W5QRX||fS)N�CS_GNU_LIBC_VERSION�)�maxsplit��realpath�rbrslibcsGLIBCi�cSs"g|]}|dk	r|�d�n|�qS)N�latin1)�decode)�.0�srrr�
<listcomp>�s�zlibc_ver.<locals>.<listcomp>Zlibc�glibc)�os�confstrr�len�tuple�AttributeErrorr�OSError�sys�
executabler�hasattr�pathr"�open�read�_libc_search�search�end�max�groups)r1�librZ	chunksize�ver�parts�V�fZbinary�pos�m�chunkZlibcinitr)ZglibcversionZsoZthreadsZ	soversionrrr�libc_ver�s^


�

rCcCs`|�d�}|r|�|�zttttt|���}Wntk
rH|}YnXd�|dd��}|S)N�.�)r�append�list�map�strrr�join)r�build�lZstringsrrr�
_norm_version�s


rMz'(?:([\w ]+) ([\w.]+) .*\[.* ([\d.]+)\])��win32�win16�dosc	Cs�tj|kr|||fSddl}dD]R}z|j||jddd�}Wn0t|jfk
rl}zWY�q W5d}~XYq Xq~q |||fS|��}t�	|�}|dk	r�|�
�\}}}|ddkr�|dd�}|ddkr�|dd�}t|�}|||fS)Nr)r<zcommand /c verz
cmd /c verT)�stderr�text�shell���rD)r0�platform�
subprocess�check_output�DEVNULLr/�CalledProcessError�strip�_ver_output�matchr:rM)	�system�releaserZsupported_platformsrW�cmd�infoZwhyrArrr�_syscmd_vers0

�


rbZ2000ZXPZ
2003ServerZpost2003�Vista�7�8z8.1zpost8.1Z10Zpost10))�r)rfr�rfr!)rfN��r�rir�rir!�rirE�riN)rr)rNZ
2008ServerZ2008ServerR2Z
2012ServerZ2012ServerR2Zpost2012ServerR2)rgrhrjrkrlrmcCs
t�dkS)N)ZIoTUAPZ
NanoServerZWindowsCoreHeadlessZ	IoTEdgeOS)�
win32_editionrrrr�win32_is_iotOsroc
Cs�z.zddl}Wntk
r*ddl}YnXWntk
rBYnTXz<d}|�|j|�� }|�|d�dW5QR�WSQRXWntk
r�YnXdS)Nr�,SOFTWARE\Microsoft\Windows NT\CurrentVersionZ	EditionId)�winreg�ImportError�_winreg�	OpenKeyEx�HKEY_LOCAL_MACHINE�QueryValueExr/)rq�cvkey�keyrrrrnRs(rnc	Cs�zddlm}Wn tk
r0||||fYSX|�}z ttt�d�d��\}}}Wn,tk
r�|jpx|dd�\}}}YnXd�	|||�}t
�||f�p�t
�|df�p�|}|dd�||fk�rzd�	|j�}Wn8t
k
�r|dd�d	k�rd
|dd�}YnXt|dd�dk�rJt�||f��pHt�|df��pH|}z0zddl}	Wntk
�rvddl}	YnXWntk
�r�YnLXz2d}
|	�|	j|
��}|	�|d
�d}W5QRXWntk
�r�YnX||||fS)Nr)�getwindowsversionr!rDrEz{0}.{1}.{2}zSP{}�
z
Service Pack ZSPZproduct_typerpZCurrentType)r0ryrrrHrrbrrZplatform_version�format�_WIN32_CLIENT_RELEASESrZservice_pack_majorr.�getattr�_WIN32_SERVER_RELEASESrqrsrtrurvr/)r_r�csd�ptyperyZwinver�major�minorrKrqrwrxrrr�	win32_verdsR ����r�c	Cs�d}tj�|�sdSzddl}Wntk
r6YdSXt|d��}|�|�}W5QRX|d}d}t��j}|dkrzd}|||fS)Nz0/System/Library/CoreServices/SystemVersion.plistrr#ZProductVersion�rrr)ZppczPower MacintoshZPowerPC)	r*r3�exists�plistlibrrr4�load�uname�machine)�fnr�r?rr_�versioninfor�rrr�_mac_ver_xml�s
r�r�cCst�}|dk	r|S|||fS�N)r�)r_r�r�rarrr�mac_ver�sr�cCsHddlm}z|�|�}|dkr&|WS|WStk
rB|YSXdS)Nr)�System)�	java.langr�ZgetPropertyr.)�name�defaultr��valuerrr�
_java_getprop�s
r�cCs�zddl}Wn tk
r,||||fYSXtd|�}td|�}|\}}}td|�}td|�}td|�}|||f}|\}}	}
td|
�}
td|�}td	|	�}	||	|
f}||||fS)
Nrzjava.vendorzjava.versionzjava.vm.namezjava.vm.vendorzjava.vm.versionzjava.os.archzjava.os.namezjava.os.version)r�rrr�)r_�vendor�vminfo�osinfo�javaZvm_nameZ
vm_releaseZ	vm_vendor�os_name�
os_version�os_archrrr�java_ver�s"












r�cCs�|dkr�|dkr|||fS|�d�}|rlzt|d�}Wntk
rLYn X|d}t|�|d<d�|�}|dkrzd}q�d}n,|dkr�d	}|r�|d
}q�d}n|dkr�d
}|||fS)NZSunOS�5rDrrE�6ZSolarisZIRIX64ZIRIXz (64bit)�64bit�rOrP�Windows)rrrrIrJ)r^r_rrLr�rrr�system_alias�s.	



r�cGs�d�dd�tt|�D��}|�dd�}|�dd�}|�dd�}|�dd�}|�d	d�}|�d
d�}|�dd�}|�dd�}|�d
d�}|�dd�}||kr�q�|}q�|ddkr�|dd�}q�|S)N�-css|]}|��VqdSr�)r[)r&�xrrr�	<genexpr>(sz_platform.<locals>.<genexpr>� �_�/�\�:�;�"�(�)�unknownrz--rU)rJ�filterr,�replace)�argsrVZcleanedrrr�	_platform"s"r�cCsNzddl}Wntk
r$|YSXz
|��WStk
rH|YSXdS�Nr)�socketrrZgethostnamer/)r�r�rrr�_nodeBs

r�cCsBtj�|�}tj�|�r>tj�tj�tj�|�t�|���}q|Sr�)r*r3�abspath�islink�normpathrJ�dirname�readlink)�filepathrrr�_follow_symlinksQs�r�c	Cs\tjdkr|Sddl}z|jd|f|jdd�}Wnt|jfk
rN|YSX|��pZ|S)N�rQrOrPrr�T)rRrS)r0rVrWrXrYr/rZr[)Zoptionr�rW�outputrrr�
_syscmd_uname\s

�

r�c	Csztjdkr|Sddl}t|�}ttjdd�}z|jdd|g|j|d�}Wnt	|j
fk
rf|YSX|sp|S|�d�S)	Nr�r�C)�LC_ALL�filez-b)rR�envzlatin-1)r0rVrWr��dictr*�environrXrYr/rZr%)�targetr�rWr�r�rrr�_syscmd_filems	
�

r�)r�	WindowsPE)rr�)r�MSDOScCs|s&ddl}|�d�}t|d�d}|r6t|d�}nd}|sx|tjkrxtjtkrpttj\}}|rh|}|rp|}||fSd|kr�d|kr�||fSd|kr�d	}nd
|kr�d}nd|kr�d
}d|kr�d}n8d|kr�d|kr�d}q�d}nd|kr�d}nd|kr�d}n||fS)Nr�P��bitrr1z
shared objectz32-bit�32bitZN32Zn32bitz64-bitr�ZELFZPEr�r�ZCOFFzMS-DOSr�)�structZcalcsizerIr�r0r1rV�_default_architecture)r1�bits�linkager��sizeZfileoutr	rLrrr�architecture�sH
�
r��uname_resultz-system node release version machine processorcCs�d}tdk	rtSd}zt��\}}}}}Wntk
rBd}YnX|sbttd|||||f���s�|r~tj}d}d}t�}d}d}|dkr�t	�\}}}}	|r�|r�d}|s�dtj
kr�tj
�dd�}ntj
�dd�}|s�tj
�d|�}|�r:t|�\}}}|dk�rd	}n4|d
k�r:|d	k�r:d	}d|dd�k�r6d
}nd}|dk�rd|�s^|dk�rZd}nd}d	}n8|dd�dk�r�t
�\}}
}}d}d�|�}|�s�|
}|dk�r|�r�|dk�r�|}d}zddl}
Wntk
�r�Yn&X|
�dd�\}}|dk�rd}nd}|�stdd�}|dk�r$d}|dk�r2d}|dk�r@d}|dk�rNd}|dk�r\d}|dk�rjd}|d
k�r�|d	k�r�d	}d
}t||||||�atS)NrrrrOZPROCESSOR_ARCHITEW6432ZPROCESSOR_ARCHITECTUREZPROCESSOR_IDENTIFIERzMicrosoft Windowsr�Z	Microsoftz6.0rErcr�r�Z16bit�r��Javaz, ZOpenVMS�0zSYI$_CPU�ZAlphaZVAXz-pr�)�_uname_cacher*r�r.rGr�r0rVr�r�r�rrbr�rJ�vms_librrZgetsyir�r�)Zno_os_uname�	processorr^�noder_rr�Zuse_syscmd_verrr�r�r�r�r�ZcsidZ
cpu_numberrrrr��s�
















�r�cCst�jSr�)r�r^rrrrr^usr^cCst�jSr�)r�r�rrrrr�~sr�cCst�jSr�)r�r_rrrrr_�sr_cCst�jSr�)r�rrrrrr�srcCst�jSr�)r�r�rrrrr��sr�cCst�jSr�)r�r�rrrrr��s
r�zL([\w.+]+)\s*\(#?([^,]+)(?:,\s*([\w ]*)(?:,\s*([\w :]*))?)?\)\s*\[([^\]]+)\]?z;IronPython\s*([\d\.]+)(?: \(([\d\.]+)\))? on (.NET [\d\.]+)zU([\d.]+)\s*\(IronPython\s*[\d.]+\s*\(([\d.]+)\) on ([\w.]+ [\d.]+(?: \(\d+-bit\))?)\)zE([\w.+]+)\s*\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*\[PyPy [^\]]+\]?cCs|dkrtj}t�|d�}|dk	r&|Sd|kr�d}|�d�rHt�|�}n
t�|�}|dkrjtdt	|���|�
�\}}}d}d}n�tj�d�r�d}t�|�}|dkr�tdt	|���|�
�\}}}}	}
|dkr�d}tj}n�d|k�r"d}t
�|�}|dk�rtdt	|���|�
�\}}}}	d}n\t�|�}|dk�rFtd	t	|���|�
�\}}}}	}d
}|dk�rld}n|	�r~|d|	}ttd��r�tj\}
}}n"ttd
��r�tj\}
}}nd}d}|�d�}
t|
�dk�r�|
�d�d�|
�}|||||||f}|t|<|S)NZ
IronPythonz*failed to parse IronPython sys.version: %srr�ZJythonz&failed to parse Jython sys.version: %sZPyPyz$failed to parse PyPy sys.version: %sz'failed to parse CPython sys.version: %sZCPythonr��_git�
_mercurialrDr!r�)r0r�_sys_version_cacher�
startswith�_ironpython_sys_version_parserr]� _ironpython26_sys_version_parserr�reprr:rV�_sys_version_parser�_pypy_sys_version_parserr2r�r�rr,rFrJ)�sys_versionrr�r]rZalt_versionZcompilerZbuildnoZ	builddateZ	buildtimer��branchZrevisionrLrrr�_sys_version�s�

��
��


�

���



r�cCs
t�dSr��r�rrrr�python_implementation5sr�cCs
t�dS)Nrr�rrrr�python_versionBsr�cCstt�d�d��S)NrrD)r-r�rrrrr�python_version_tupleLs	r�cCs
t�dS)Nr!r�rrrr�
python_branchWsr�cCs
t�dS)NrEr�rrrr�python_revisionesr�cCst�dd�S)Nr�rir�rrrr�python_buildrsr�cCs
t�dS)Nrir�rrrr�python_compilerzsr�cCsbt�||fd�}|dk	r|St�\}}}}}}||kr:d}|rPt|||�\}}}|dkrnt�d}	|	rnd}|	}|dkr�t|�\}
}}}
|r�t||�}nt||||�}n�|dkr�ttj	�\}}t||||d||�}n~|dk�r t
�\}}}\}}}|s�|�s
t|||�}nt|||d	|||�}n2|�r2t||�}n ttj	�\}}t||||||�}|t||f<|S)
NrZDarwinrZmacOSr�)ZLinux�withr�Zon)�_platform_cacherr�r�r�r�r�rCr0r1r�r�)�aliased�terserr^r�r_rr�r�Z
macos_releaseZrelZversrr�rVZlibcnameZlibcversion�rrr�r�r�r�r�r�rrrrV�sX

�

��rV�__main__r�z--terseZ
nonaliasedz--nonaliased)Nrrr)r)rrrrN)rrrr)rr�r)rrr�r�)r)r)r)N)rr)AZ
__copyright__�__version__�collectionsr*�rer0r�compilerr�ASCIIr6rCrMr\rbr|r~rornr�r�r�r�r�r�r�r�r�r�r�r�r1r��
namedtupler�r�r�r^r�r_rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rV�__name__�argvr�r��print�exitrrrr�<module>\s�
�
�
G


�
1��

3

#4 


$�P�	
			����
h




L
string.cpython-38.opt-2.pyc000064400000014064150335716500011454 0ustar00U

e5d')�@s�dddddddddd	d
dgZdd
lZdZdZdZeeZdZeddZdZdZ	eee	eZ
ddd�Zdd
lZ
ddlmZiZGdd�de�ZGdd�ded�ZGdd
�d
�Zd
S)�
ascii_letters�ascii_lowercase�ascii_uppercase�capwords�digits�	hexdigits�	octdigits�	printable�punctuation�
whitespace�	Formatter�Template�Nz 	

ZabcdefghijklmnopqrstuvwxyzZABCDEFGHIJKLMNOPQRSTUVWXYZ�
0123456789ZabcdefZABCDEFZ01234567z !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~cCs|pd�dd�|�|�D��S)N� css|]}|��VqdS�N)�
capitalize)�.0�x�r�/usr/lib64/python3.8/string.py�	<genexpr>0szcapwords.<locals>.<genexpr>)�join�split)�s�seprrrr%s)�ChainMapcs eZdZdZ�fdd�Z�ZS)�_TemplateMetaclassa/
    %(delim)s(?:
      (?P<escaped>%(delim)s) |   # Escape sequence of two delimiters
      (?P<named>%(id)s)      |   # delimiter and a Python identifier
      {(?P<braced>%(bid)s)}  |   # delimiter and a braced identifier
      (?P<invalid>)              # Other ill-formed delimiter exprs
    )
    csbtt|��|||�d|kr$|j}n$tjt�|j�|j|jp@|jd�}t�	||j
tjB�|_dS)N�pattern)Zdelim�idZbid)�superr�__init__r�_re�escape�	delimiter�	idpattern�braceidpattern�compile�flags�VERBOSE)�cls�name�basesZdctr��	__class__rrr Cs

�z_TemplateMetaclass.__init__)�__name__�
__module__�__qualname__rr �
__classcell__rrr,rr9s	rc@sFeZdZdZdZdZejZdd�Z	dd�Z
efdd	�Zefd
d�Z
dS)r�$z(?a:[_a-z][_a-z0-9]*)NcCs
||_dSr)�template)�selfr3rrrr \szTemplate.__init__cCsd|�d�}|jd|�jdd�}|s.d}d}n"|td�|dd���}t|�}td||f��dS)N�invalidT)�keepends�����z.Invalid placeholder in string: line %d, col %d)�startr3�
splitlines�lenr�
ValueError)r4�mo�i�lines�colno�linenorrr�_invalidas
�zTemplate._invalidcs:�tkr|�n|rt|�����fdd�}�j�|�j�S)Ncsd|�d�p|�d�}|dk	r(t�|�S|�d�dk	r<�jS|�d�dk	rT��|�td�j��dS�N�namedZbracedZescapedr5z#Unrecognized named group in pattern)�group�strr#rCr=r�r>rE��mappingr4rr�convertss
�z$Template.substitute.<locals>.convert��_sentinel_dict�	_ChainMapr�subr3�r4rJZkwsrKrrIr�
substitutems
zTemplate.substitutecs:�tkr|�n|rt|�����fdd�}�j�|�j�S)Ncs�|�d�p|�d�}|dk	rHzt�|�WStk
rF|��YSX|�d�dk	r\�jS|�d�dk	rr|��Std�j��dSrD)rFrG�KeyErrorr#r=rrHrIrrrK�s�z)Template.safe_substitute.<locals>.convertrLrPrrIr�safe_substitute�s

zTemplate.safe_substitute)r.r/r0r#r$r%r!�
IGNORECASEr'r rCrMrQrSrrrrrPs)�	metaclassc@sVeZdZdd�Zdd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)rcOs|�|||�Sr)�vformat)r4�
format_string�args�kwargsrrr�format�szFormatter.formatcCs.t�}|�||||d�\}}|�|||�|S)N�)�set�_vformat�check_unused_args)r4rWrXrY�	used_args�result�_rrrrV�szFormatter.vformatr
c	Cs�|dkrtd��g}|�|�D]�\}}	}
}|r8|�|�|	dk	r|	dkrj|dkrXtd��t|�}	|d7}n|	��r�|r~td��d}|�|	||�\}}
|�|
�|�||�}|j|
||||d|d�\}
}|�|�	||
��qd�
|�|fS)Nr
zMax string recursion exceededr8FzJcannot switch from manual field specification to automatic field numberingr7)�auto_arg_index)r=�parse�appendrG�isdigit�	get_field�add�
convert_fieldr]�format_fieldr)r4rWrXrYr_Zrecursion_depthrbr`Zliteral_text�
field_name�format_spec�
conversion�objZarg_usedrrrr]�s<�


�
zFormatter._vformatcCst|t�r||S||SdSr)�
isinstance�int)r4�keyrXrYrrr�	get_value�s
zFormatter.get_valuecCsdSrr)r4r_rXrYrrrr^�szFormatter.check_unused_argscCs
t||�Sr)rZ)r4�valuerkrrrri�szFormatter.format_fieldcCsN|dkr|S|dkrt|�S|dkr,t|�S|dkr<t|�Std�|���dS)Nr�r�az"Unknown conversion specifier {0!s})rG�repr�asciir=rZ)r4rrrlrrrrh�szFormatter.convert_fieldcCs
t�|�Sr)�_stringZformatter_parser)r4rWrrrrcszFormatter.parsec	CsJt�|�\}}|�|||�}|D] \}}|r8t||�}q ||}q ||fSr)rwZformatter_field_name_splitrq�getattr)	r4rjrXrY�first�restrmZis_attrr?rrrrf
s
zFormatter.get_fieldN)r
)r.r/r0rZrVr]rqr^rirhrcrfrrrrr�s�
6	)N)�__all__rwr
rrrrrrr	rr�rer!�collectionsrrNrM�typerrrrrrr�<module>s4�
Qcolorsys.cpython-38.opt-1.pyc000064400000006252150335716500012022 0ustar00U

e5d��@s\dZddddddgZdZdZd	Zd
d�Zdd�Zdd�Zd
d�Zdd�Z	dd�Z
dd�ZdS)aJConversion functions between RGB and other color systems.

This modules provides two functions for each color system ABC:

  rgb_to_abc(r, g, b) --> a, b, c
  abc_to_rgb(a, b, c) --> r, g, b

All inputs and outputs are triples of floats in the range [0.0...1.0]
(with the exception of I and Q, which covers a slightly larger range).
Inputs outside the valid range may cause exceptions or invalid outputs.

Supported color systems:
RGB: Red, Green, Blue components
YIQ: Luminance, Chrominance (used by composite video signals)
HLS: Hue, Luminance, Saturation
HSV: Hue, Saturation, Value
�
rgb_to_yiq�
yiq_to_rgb�
rgb_to_hls�
hls_to_rgb�
rgb_to_hsv�
hsv_to_rgbgUUUUUU�?gUUUUUU�?gUUUUUU�?cCsRd|d|d|}d||d||}d||d||}|||fS)Ng333333�?g�z�G��?g)\��(�?g�G�z��?gH�z�G�?g���Q��?g=
ףp=�?�)�r�g�b�y�i�qrr� /usr/lib64/python3.8/colorsys.pyr(scCs�|d|d|}|d|d|}|d|d|}|dkrHd}|dkrTd}|dkr`d}|dkrld}|dkrxd}|dkr�d}|||fS)	Ng2r��L�?g����,��?g:�����?g�nєW�?g6�޷���?gJ"�X�?���?r)rrr
rr	r
rrrr.s cCs�t|||�}t|||�}||d}||kr6d|dfS|dkrP||||}n||d||}||||}||||}||||}	||kr�|	|}
n"||kr�d||	}
nd||}
|
dd}
|
||fS)N�@r��?�@�@r��max�min)rr	r
�maxc�minc�l�s�rc�gc�bc�hrrrrKs$

cCsn|dkr|||fS|dkr(|d|}n||||}d||}t|||t�t|||�t|||t�fS)Nrrrr)�_v�	ONE_THIRD)rrr�m2�m1rrrrbs
cCsT|d}|tkr$||||dS|dkr0|S|tkrP|||t|dS|S)Nrrr)�	ONE_SIXTH�	TWO_THIRD)r#r"Zhuerrrr lsr cCs�t|||�}t|||�}|}||kr.dd|fS|||}||||}||||}||||}	||kr||	|}
n"||kr�d||	}
nd||}
|
dd}
|
||fS)Nrrrrrr)rr	r
rr�vrrrrrrrrr|s 

cCs�|dkr|||fSt|d�}|d|}|d|}|d||}|d|d|}|d}|dkrt|||fS|dkr�|||fS|dkr�|||fS|dkr�|||fS|d	kr�|||fS|d
kr�|||fSdS)Nrrr�������)�int)rrr&r�f�pr
�trrrr�s(





N)�__doc__�__all__r!r$r%rrrrr rrrrrr�<module>s�	
runpy.cpython-38.opt-2.pyc000064400000014731150335716500011324 0ustar00U

e5d/�@sddlZddlZddlZddlZddlZddlZddlmZm	Z	ddgZ
Gdd�de�ZGdd�de�Z
dd	d
�Zd dd�Zefd
d�ZGdd�de�Zd!dd�Zd"dd�Zefdd�Zdd�Zd#dd�Zedk�r
eej�dk�r�edejd�nejd=eejd�dS)$�N)�	read_code�get_importer�
run_module�run_pathc@s$eZdZdd�Zdd�Zdd�ZdS)�_TempModulecCs||_t�|�|_g|_dS�N)�mod_name�types�
ModuleType�module�
_saved_module��selfr�r�/usr/lib64/python3.8/runpy.py�__init__sz_TempModule.__init__cCsB|j}z|j�tj|�Wntk
r0YnX|jtj|<|Sr)rr�append�sys�modules�KeyErrorrr
rrr�	__enter__ sz_TempModule.__enter__cGs.|jr|jdtj|j<n
tj|j=g|_dS�Nr)rrrr�r�argsrrr�__exit__)s
z_TempModule.__exit__N��__name__�
__module__�__qualname__rrrrrrrrs	rc@s$eZdZdd�Zdd�Zdd�ZdS)�_ModifiedArgv0cCs||_t�|_|_dSr)�value�object�_saved_value�	_sentinel)rr rrrr1sz_ModifiedArgv0.__init__cCs0|j|jk	rtd��tjd|_|jtjd<dS)NzAlready preserving saved valuer)r"r#�RuntimeErrorr�argvr )rrrrr5sz_ModifiedArgv0.__enter__cGs|j|_|jtjd<dSr)r#r r"rr%rrrrr;sz_ModifiedArgv0.__exit__Nrrrrrr0src
	Csn|dk	r|�|�|dkr(d}|}d}	n |j}|j}|j}	|dkrH|j}|j|||	d|||d�t||�|S)N)r�__file__�
__cached__�__doc__�
__loader__�__package__�__spec__)�update�loader�origin�cached�parent�exec)
�codeZrun_globals�init_globalsr�mod_spec�pkg_name�script_namer-�fnamer/rrr�	_run_code@s*
�
r8c	
Cs^|dkr|n|j}t|��6}t|��"|jj}t|||||||�W5QRXW5QRX|��Sr)r.rrr�__dict__r8�copy)	r2r3rr4r5r6r7�temp_module�mod_globalsrrr�_run_module_codeZs�r=c
Cs2|�d�r|d��|�d�\}}}|r�zt|�WnHtk
rz}z*|jdksh|j|krj|�|jd�sj�W5d}~XYnXtj�|�}|dk	r�t|d�s�ddl	m
}dj||d�}|t|��zt
j�|�}WnJttttfk
�r}	z"d}||�|t|	�j|	��|	�W5d}	~	XYnX|dk�r2|d	|��|jdk	�r�|d
k�sT|�d��r\|d��z|d}
t|
|�WS|k
�r�}z"|tjk�r��|d
||f��W5d}~XYnX|j}|dk�r�|d|��z|�|�}Wn2tk
�r}z|t|��|�W5d}~XYnX|dk�r(|d|��|||fS)N�.z#Relative module names not supported�__path__r)�warnz�{mod_name!r} found in sys.modules after import of package {pkg_name!r}, but prior to execution of {mod_name!r}; this may result in unpredictable behaviour)rr5z:Error while finding module specification for {!r} ({}: {})zNo module named %s�__main__z	.__main__z%Cannot use package as __main__ modulez3%s; %r is a package and cannot be directly executedz0%r is a namespace package and cannot be executedzNo code object available for %s)�
startswith�
rpartition�
__import__�ImportError�namerr�get�hasattr�warningsr@�format�RuntimeWarning�	importlib�util�	find_spec�AttributeError�	TypeError�
ValueError�typer�submodule_search_locations�endswith�_get_module_detailsr-�get_code)
r�errorr5�_�eZexistingr@�msg�specZexZ
pkg_main_namer-r2rrrrUhsd
��,
�
� 
rUc@seZdZdS)�_ErrorN)rrrrrrrr\�sr\Tc
Cs�z0|s|dkr t|t�\}}}ntt�\}}}Wn:tk
rj}zdtj|f}t�|�W5d}~XYnXtjdj}|r�|jtj	d<t
||dd|�S)NrAz%s: %sr)rUr\�_get_main_module_detailsr�
executable�exitrr9r.r%r8)rZ
alter_argvr4r2�excrZZmain_globalsrrr�_run_module_as_main�s�raFcCs@t|�\}}}|dkr|}|r,t||||�St|i|||�SdSr)rUr=r8)rr3�run_nameZ	alter_sysr4r2rrrr�sc
Cs�d}tj|}tj|=z\zt|�WW�NStk
rn}z*|t|�kr\|d|tjdf�|��W5d}~XYnXW5|tj|<XdS)NrAzcan't find %r module in %rr)rrrUrE�str�path)rWZ	main_nameZ
saved_mainr`rrrr]�s
��r]c	Csftj�t�|��}t�|��}t|�}W5QRX|dkr^t�|��}t|��|d�}W5QRX||fS)Nr1)	�osrd�abspath�fsdecode�io�	open_coder�compile�read)rbr7Zdecoded_path�fr2rrr�_get_code_from_file�srmcCs$|dkrd}|�d�d}t|�}d}t|�jdkrFt|�jdkrFd}t|td��sX|rxt||�\}}t|||||d�Stj	�
d|�znt
�\}}	}t|��P}
t|��<|
jj}t|||||	|���W5QR�W5QR�W�SQRXW5QRXW5ztj	�|�Wntk
�rYnXXdS)	Nz
<run_path>r>rFZimpZNullImporterT)r5r6)rCrrRrr�
isinstancermr=rrd�insert�removerQr]rrrr9r8r:)Z	path_namer3rbr5ZimporterZis_NullImporterr2r7rr4r;r<rrrr�s<
�
��8rA�z!No module specified for execution)�file)NNNNN)NNNNN)T)NNF)NN)r�importlib.machineryrL�importlib.utilrhr	reZpkgutilrr�__all__r!rrr8r=rErU�	Exceptionr\rarr]rmrr�lenr%�print�stderrrrrr�<module>
sL��
�
:
�

1
trace.cpython-38.opt-2.pyc000064400000041212150335716500011237 0ustar00U

e5d�t�@s�ddgZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
ZddlZdZGdd�d�Zdd	�Zd
d�ZGdd�d�Zd
d�Zdd�Zddd�Zdd�ZGdd�d�Zdd�Zedkr�e�dS)�Trace�CoverageResults�N)�	monotonicz#pragma NO COVERc@seZdZddd�Zdd�ZdS)�_IgnoreNcCs:|s
t�nt|�|_|sgndd�|D�|_ddi|_dS)NcSsg|]}tj�|��qS�)�os�path�normpath��.0�drr�/usr/lib64/python3.8/trace.py�
<listcomp>Hs�z$_Ignore.__init__.<locals>.<listcomp>z<string>�)�set�_mods�_dirs�_ignore)�self�modules�dirsrrr
�__init__Fs
�z_Ignore.__init__cCs�||jkr|j|S||jkr,d|j|<dS|jD]"}|�|d�r2d|j|<dSq2|dkrld|j|<dS|jD]$}|�|tj�rrd|j|<dSqrd|j|<dS)Nr�.r)rr�
startswithrr�sep)r�filename�
modulename�modrrrr
�namesLs$









z
_Ignore.names)NN)�__name__�
__module__�__qualname__rrrrrr
rEs
rcCs tj�|�}tj�|�\}}|S�N)rr�basename�splitext)r�baser�extrrr
�_modnamewsr'cCs�tj�|�}d}tjD]@}tj�|�}|�|�r|t|�tjkrt|�t|�kr|}q|rr|t|�dd�}n|}tj�|�\}}|�tjd�}tj	r�|�tj	d�}tj�
|�\}}|�d�S)N�rr)rr�normcase�sysr�lenr�
splitdrive�replace�altsepr$�lstrip)rZcomparepathZlongest�dirr%Zdriverr&rrr
�_fullmodname~s 
r1c@s:eZdZddd�Zdd�Zdd�Zdd
d�Zddd
�ZdS)rNc
Cs�||_|jdkri|_|j��|_||_|jdkr8i|_|j��|_||_|jdkrZi|_|j��|_||_||_|jr�z@t|jd��}t�	|�\}}}W5QRX|�
|�|||��Wn@tt
tfk
r�}ztd|j|ftjd�W5d}~XYnXdS)N�rbzSkipping counts file %r: %s��file)�counts�copyZcounter�calledfuncs�callers�infile�outfile�open�pickle�load�update�	__class__�OSError�EOFError�
ValueError�printr*�stderr)rr5r7r9r8r:�f�errrrr
r�s2


��zCoverageResults.__init__cCs|�d�o|�d�S)N�<�>)r�endswith)rrrrr
�is_ignored_filename�sz#CoverageResults.is_ignored_filenamec	Csn|j}|j}|j}|j}|j}|j}|D]}|�|d�||||<q(|D]}d||<qJ|D]}d||<q\dS�Nrr)r5r7r8�get)	r�otherr5r7r8Zother_countsZother_calledfuncsZ
other_callers�keyrrr
r>�s
zCoverageResults.updateTFc"
Cs�|jr@t�td�|j}t|�D]\}}}td|||f�q"|jr�t�td�d}}	t|j�D]h\\}
}}\}
}}|
|kr�t�td|
d�|
}d}	|
|
kr�|	|
kr�td|
�|
}	td||||f�qfi}|jD].\}}|�|i�}||<|j||f||<q�i}|��D�]\}}|�|��r0�q|�d��rH|dd	�}|dk�rpt	j
�t	j
�|��}t
|�}n$|}t	j
�|��s�t	�|�t|�}|�r�t|�}ni}t�|�}t	j
�||d
�}t|d��}t�|j�\}}W5QRX|�|||||�\}}|�r|�rtd||�}||||f||<�q|�rt|�rttd
�t|�D]&}||\}}}}td||��qL|j�r�z6t|jd�� } t�|j|j|jf| d�W5QRXWn6tk
�r�}!ztd|!tj d�W5d}!~!XYnXdS)Nzfunctions called:z*filename: %s, modulename: %s, funcname: %szcalling relationships:r(z***z  -->z    %s.%s -> %s.%sz.pyc���z.coverr2�dzlines   cov%   module   (path)z%5d   %3d%%   %s   (%s)�wbrz"Can't save counts files because %sr3)!r7rC�sortedr8r5rL�itemsrJrIrr�dirname�abspathr'�exists�makedirsr1�_find_executable_linenos�	linecache�getlines�joinr;�tokenize�detect_encoding�readline�write_results_file�intr:r<�dumpr@r*rD)"rZshow_missing�summary�coverdirZcallsrr�funcnameZlastfileZ	lastcfileZpfileZpmodZpfunc�cfileZcmodZcfuncZper_file�lineno�	lines_hitZsums�countr0�lnotab�sourceZ	coverpath�fp�encoding�_�n_hits�n_linesZpercent�mrErFrrr
�
write_results�s�
��





��zCoverageResults.write_resultsc
Cs�zt|d|d�}Wn>tk
rP}z td||ftjd�WY�dSd}~XYnXd}d}	|��t|d�D]r\}
}|
|kr�|�d||
�|	d7}	|d7}n.|
|kr�t|kr�|�d	�|d7}n
|�d
�|�|�d��qjW5QRX|	|fS)N�w�rlz3trace: Could not open %r for writing: %s - skippingr3)rrrrz%5d: z>>>>>> z       �)	r;r@rCr*rD�	enumerate�write�PRAGMA_NOCOVER�
expandtabs)rr�linesrirgrlr:rFrornrf�linerrr
r_)s.��



z"CoverageResults.write_results_file)NNNNN)TFN)N)rr r!rrJr>rqr_rrrr
r�s�

\cCs,i}t�|�D]\}}||krd||<q|S)Nr)�disZfindlinestarts)�code�strs�linenosrmrfrrr
�_find_lines_from_codeIs

rcCs4t||�}|jD]}t�|�r|�t||��q|Sr")r�	co_consts�inspectZiscoder>�_find_lines)r|r}r~�crrr
r�Ss



r�c	Cs�i}tj}t||d��j}t�|j�}|D]R\}}}}	}
|tjkrv|tjkrv|\}}|	\}
}t||
d�D]}d||<qh|}q(W5QRX|S)Nrsr)�token�INDENTr;r\�generate_tokensr^�STRING�range)rrlrZ
prev_ttyperE�tokZttypeZtstr�start�endrzZslineZscolZelineZecol�irrr
�
_find_strings_s


r�c
Cs�z(t�|��}|��}|j}W5QRXWn@tk
rh}z"td||ftjd�iWY�Sd}~XYnXt||d�}t	||�}t
||�S)Nz%Not printing coverage data for %r: %sr3�exec)r\r;�readrlr@rCr*rD�compiler�r�)rrE�progrlrFr|r}rrr
rXvs��
rXc	@sveZdZddd�Zdd	�Zd d
d�Zdd
�Zde_dd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)!rrrrNFc

Cs�||_||_t||�|_i|_i|_d|_||_i|_i|_	i|_
d|_|	rTt�|_|rb|j
|_nZ|rp|j|_nL|r�|r�|j|_|j|_n2|r�|j|_|j|_n|r�|j|_|j|_nd|_dSrK)r9r:r�ignorer5Zpathtobasename�	donothing�trace�_calledfuncs�_callers�
_caller_cache�
start_time�_time�globaltrace_trackcallers�globaltrace�globaltrace_countfuncs�globaltrace_lt�localtrace_trace_and_count�
localtrace�localtrace_trace�localtrace_count)
rrhr��
countfuncs�countcallers�
ignoremods�
ignoredirsr9r:�timingrrr
r�s6




zTrace.__init__cCs ddl}|j}|�|||�dS)Nr)�__main__�__dict__�runctx)r�cmdr��dictrrr
�run�sz	Trace.runc	Csh|dkri}|dkri}|js6t�|j�t�|j�zt|||�W5|jsbt�d�t�d�XdSr")r��	threading�settracer�r*r�)rr��globals�localsrrr
r��s
zTrace.runctxc	Os�t|�dkr|^}}}nV|s&td��nHd|krZ|�d�}|^}}ddl}|jdtdd�ntdt|�d��d}|js�t�|j	�z|||�}W5|js�t�d�X|S)	N�z8descriptor 'runfunc' of 'Trace' object needs an argument�funcrz0Passing 'func' as keyword argument is deprecated)�
stacklevelz7runfunc expected at least 1 positional argument, got %dr)
r+�	TypeError�pop�warnings�warn�DeprecationWarningr�r*r�r�)�args�kwrr�r��resultrrr
�runfunc�s.

�
�z
Trace.runfuncz($self, func, /, *args, **kw)c
Cs�|j}|j}|rt|�}nd}|j}d}||jkrL|j|dk	r�|j|}n�d|j|<dd�t�|�D�}t|�dkr�dd�t�|d�D�}t|�dkr�dd�t�|d�D�}	t|	�dkr�|	dj}||j|<|dk	r�d||f}|||fS)NcSsg|]}t�|�r|�qSr)r�Z
isfunction)rrErrr
r�s
�z1Trace.file_module_function_of.<locals>.<listcomp>rcSsg|]}t|t�r|�qSr)�
isinstancer�r
rrr
r�s
�rcSsg|]}t|d�r|�qS)�	__bases__)�hasattr)rr�rrr
r�s
�z%s.%s)	�f_code�co_filenamer'�co_namer��gcZ
get_referrersr+r)
r�framer|rrrdZclsnameZfuncsZdicts�classesrrr
�file_module_function_of�s,




zTrace.file_module_function_ofcCs0|dkr,|�|�}|�|j�}d|j||f<dS�N�callr)r��f_backr�)rr��why�arg�	this_funcZparent_funcrrr
r�
s
zTrace.globaltrace_trackcallerscCs |dkr|�|�}d|j|<dSr�)r�r�)rr�r�r�r�rrr
r�s
zTrace.globaltrace_countfuncscCsj|dkrf|j}|j�dd�}|rbt|�}|dk	rf|j�||�}|sf|jrZtd||jf�|j	SndSdS)Nr��__file__z! --- modulename: %s, funcname: %s)
r��	f_globalsrLr'r�rr�rCr�r�)rr�r�r�r|rrZ	ignore_itrrr
r�!s�zTrace.globaltrace_ltcCs�|dkr~|jj}|j}||f}|j�|d�d|j|<|jrTtdt�|jdd�tj	�
|�}td||t�||�fdd�|j
S)	Nrzrr�%.2f� �r��
%s(%d): %sr()r�r��f_linenor5rLr�rCr�rrr#rY�getliner�)rr�r�r�rrfrN�bnamerrr
r�8s
��z Trace.localtrace_trace_and_countcCsd|dkr^|jj}|j}|jr4tdt�|jdd�tj�|�}td||t	�
||�fdd�|jS)Nrzr�r�r�r�r()r�r�r�r�rCr�rrr#rYr�r�)rr�r�r�rrfr�rrr
r�Gs
��zTrace.localtrace_tracecCs<|dkr6|jj}|j}||f}|j�|d�d|j|<|jS)Nrzrr)r�r�r�r5rLr�)rr�r�r�rrfrNrrr
r�TszTrace.localtrace_countcCst|j|j|j|j|jd�S)N)r9r:r7r8)rr5r9r:r�r�)rrrr
�results\s

�z
Trace.results)	rrrrrrNNF)NN)rr r!rr�r�r��__text_signature__r�r�r�r�r�r�r�r�rrrr
r�s&�
2

)	
cs�ddl}|��}|jdddd�|�dd�}|jdd	d
dd�|jd
dd
dd�|jddd
dd�|jddd
dd�|�d�}|��}|jddd
dd�|jddd
dd�|jdddd �|jd!d"d#d �|jd$d%d
d&d�|jd'd(d
d)d�|jd*d+d
d,d�|�d-d.�}|jd/d0gd1d2�|jd3d0gd4d2�|jd5d
d6d7d2�|jd8d9d:d;�|jd<|jd=d;�|��}|j�r�t�	d>��t�	d?����fd@dA��dBdC�|j
D�|_
�fdDdC�|jD�|_|j�r�|j�s�|�
dE�t|j|jdF�}|�|j|j|j�St|j|j|j|jg��s |�
dG�|j�rB|j�s8|j�rB|�
dH�|j�r\|j�s\|�
dI�|jdk�rr|�
dJ�t|j|j|j|j|j
|j|j|j|jdK�	}z�|j�r�ddl}|j}|�|�\}	}
}|jf|j�t _!dL|j|
j"|
j#|
ddM�}n^|jf|j�t _!t$j%�&|j�t j%d<t'�(|j��}
t)|
�*�|jdN�}W5QRX|jdLdddO�}|�+|||�WnPt,k
�r�}zt �-dPt j!d|f�W5d}~XYnt.k
�r�YnX|�/�}|j0�s�|�|j|j|j�dS)QNrz	--version�versionz	trace 2.0)�actionr�zMain optionsz(One of these (or --report) must be givenz-cz--count�
store_truez�Count the number of times each line is executed and write the counts to <module>.cover for each module executed, in the module's directory. See also --coverdir, --file, --no-report below.)r��helpz-tz--tracez3Print each line to sys.stdout before it is executedz-lz--listfuncsz�Keep track of which functions are executed at least once and write the results to sys.stdout after the program exits. Cannot be specified alongside --trace or --count.z-Tz--trackcallsz^Keep track of caller/called pairs and write the results to sys.stdout after the program exits.Z	Modifiersz-rz--reportz�Generate a report from a counts file; does not execute any code. --file must specify the results file to read, which must have been created in a previous run with --count --file=FILEz-Rz--no-reportz^Do not generate the coverage report files. Useful if you want to accumulate over several runs.z-fz--filez+File to accumulate counts over several runs)r�z-Cz
--coverdirz�Directory where the report files go. The coverage report for <package>.<module> will be written to file <dir>/<package>/<module>.coverz-mz	--missingz?Annotate executable lines that were not executed with ">>>>>> "z-sz	--summaryz\Write a brief summary for each file to sys.stdout. Can only be used with --count or --reportz-gz--timingzQPrefix each line with the time since the program started. Only used while tracingZFilterszCan be specified multiple timesz--ignore-module�appendzqIgnore the given module(s) and its submodules (if it is a package). Accepts comma separated list of module names.)r��defaultr�z--ignore-dirzWIgnore files in the given directory (multiple directories can be joined by os.pathsep).z--moduleFzTrace a module. �progname�?zfile to run as main program)�nargsr��	argumentszarguments to the programZstdlibZ
platstdlibcs4tj�tj�|��}|�d���d��}tj�|�S)Nz$prefixz$exec_prefix)rr�
expanduser�
expandvarsr-r	)�s)�_exec_prefix�_prefixrr
�parse_ignore_dir�szmain.<locals>.parse_ignore_dircSs$g|]}|�d�D]}|���qqS)�,)�split�strip)rr�rrrr
r�s�zmain.<locals>.<listcomp>cs&g|]}|�tj�D]}�|��qqSr)r�r�pathsep)rr�r�)r�rr
r�s�z-r/--report requires -f/--file)r9r:zLmust specify one of --trace, --count, --report, --listfuncs, or --trackcallsz8cannot specify both --listfuncs and (--trace or --count)z3--summary can only be used with --count or --reportz3progname is missing: required with the main options)r�r�r�r�r9r:r�r�)rr��__package__�
__loader__�__spec__�
__cached__r�)r�rr�r�zCannot run file %r because: %s)1�argparse�ArgumentParser�add_argumentZadd_argument_groupZadd_mutually_exclusive_groupZ	REMAINDER�
parse_argsZ
ignore_dir�	sysconfigZget_pathZ
ignore_moduleZreportr4�errorrrqZmissingrbrc�anyr�rhZ	listfuncsZ
trackcallsr�rr��module�runpyZ_get_module_detailsr�r�r*�argv�parent�loaderrrrT�io�	open_coder�r�r�r@�exit�
SystemExitr�Z	no_report)r��parserZgrpZ_grpZoptsr��tr�Zmodule_nameZmod_nameZmod_specr|ZglobsrkrFr)r�r�r�r
�mainbs��
�
�
�
�

�
���
�
�
��
�
�
��
�

�
�




��	�(rr�)N)�__all__r�rYrr*r�r�r\r�r�r{r<�timerr�r�rwrr'r1rrr�r�rXrrrrrrr
�<module>2s:20

_crypt.cpython-38.pyc000064400000006475150335716500010356 0ustar00U

e5d�@s0dZddlZzddlZWn0ek
rHejdkr<ed��ned��YnXddlZddl	m
Zddlm
ZejejdZe�ZGd	d
�d
ed
d��Zd&dd�d
d�Zd'dd�ZgZdd�dd�Zedddd�edddd�dD](Zeddeddee�dd�r��qq�edd d!d"�ed#dd$d%�[[dS)(zEWrapper to the POSIX crypt library call and associated functionality.�NZwin32z,The crypt module is not supported on Windowsz;The required _crypt module was not built as part of CPython)�SystemRandom)�
namedtuplez./c@seZdZdZdd�ZdS)�_MethodziClass representing a salt method per the Modular Crypt Format or the
    legacy 2-character crypt method.cCsd�|j�S)Nz<crypt.METHOD_{}>)�format�name)�self�r�/usr/lib64/python3.8/crypt.py�__repr__sz_Method.__repr__N)�__name__�
__module__�__qualname__�__doc__r
rrrr	rsrz name ident salt_chars total_size��roundscCsB|dkrtd}|dk	r4t|t�s4t|jj�d���|js@d}nd|j�d�}|jr�|jddkr�|dkrpd}n@t�|d�}|d|>kr�td	��d
|kr�dks�ntd��||d
�d�7}n^|jdk�r|dk	�r d|kr�dks�ntd��|d|�d�7}n|dk	�r t|�d���|d�	dd�t
|j�D��7}|S)zsGenerate a salt for the specified method.

    If not specified, the strongest available method will be used.

    Nrz+ object cannot be interpreted as an integer��$�2��zrounds must be a power of 2��z%rounds out of the range 2**4 to 2**31Z02d)�5�6i�i�ɚ;z+rounds out of the range 1000 to 999_999_999zrounds=z$ doesn't support the rounds argumentcss|]}t�t�VqdS)N)�_srZchoice�
_saltchars)�.0�charrrr	�	<genexpr>Aszmksalt.<locals>.<genexpr>)�methods�
isinstance�int�	TypeError�	__class__rZident�
bit_length�
ValueError�join�rangeZ
salt_chars)�methodr�sZ
log_roundsrrr	�mksalts2

r*cCs&|dkst|t�rt|�}t�||�S)aRReturn a string representing the one-way hash of a password, with a salt
    prepended.

    If ``salt`` is not specified or is ``None``, the strongest
    available method will be selected and a salt generated.  Otherwise,
    ``salt`` may be one of the ``crypt.METHOD_*`` values, or a string as
    returned by ``crypt.mksalt()``.

    N)r rr*�_crypt�crypt)Zword�saltrrr	r,Es
r,cGsVt|f|��}|t�d|<t||d�}td|�}|rRt|�|jkrRt�|�dSdS)NZMETHOD_rrTF)r�globalsr*r,�lenZ
total_sizer�append)rr�argsr(r-�resultrrr	�_add_methodWs

r3ZSHA512r��jZSHA256r�?)�b�y�arZBLOWFISHr��;ZMD5�1��"ZCRYPT��
)N)N)r�sys�_sysr+�ModuleNotFoundError�platform�ImportError�stringZ_stringZrandomrZ
_SystemRandom�collectionsrZ_namedtupleZ
ascii_lettersZdigitsrrrr*r,rr3Z_vr/rrrr	�<module>s2

	&

copyreg.cpython-38.opt-1.pyc000064400000010275150335716500011615 0ustar00U

e5d��@s�dZdddddgZiZddd�Zdd�ZzeWnek
rDYnXd	d
�Zeeee�dd�Zd
Z	dd�Z
dd�Zdd�Zdd�Z
iZiZiZdd�Zdd�Zdd�ZdS)z�Helper to provide extensibility for pickle.

This is only useful to add pickle support for extension types defined in
C, not for instances of user-defined classes.
�pickle�constructor�
add_extension�remove_extension�clear_extension_cacheNcCs,t|�std��|t|<|dk	r(t|�dS)Nz$reduction functions must be callable)�callable�	TypeError�dispatch_tabler)�ob_type�pickle_function�constructor_ob�r�/usr/lib64/python3.8/copyreg.pyrs
cCst|�std��dS)Nzconstructors must be callable)rr)�objectrrr
rscCst|j|jffS�N)�complex�real�imag)�crrr
�pickle_complex"srcCs<|tkrt�|�}n$|�||�}|jtjkr8|�||�|Sr)r�__new__�__init__)�cls�base�state�objrrr
�_reconstructor)sricCs�|j}|jD]}t|d�r|jt@sq.qt}|tkr<d}n"||krVtd|j�d���||�}|||f}z
|j}Wn\t	k
r�t
|dd�r�td|j�d|���d�z
|j}Wnt	k
r�d}YnXYnX|�}|r�t||fSt|fSdS)N�	__flags__zcannot pickle z object�	__slots__zf object: a class that defines __slots__ without defining __getstate__ cannot be pickled with protocol )
�	__class__�__mro__�hasattrr�	_HEAPTYPErr�__name__�__getstate__�AttributeError�getattr�__dict__r)�self�protorrr�args�getstate�dictrrr
�
_reduce_ex6s4


�

r,cGs|j|f|��Sr�r)rr)rrr
�
__newobj__Zsr.cCs|j|f|�|�S)zUsed by pickle protocol 4, instead of __newobj__ to allow classes with
    keyword-only arguments to be pickled correctly.
    r-)rr)�kwargsrrr
�
__newobj_ex__]sr0cCs�|j�d�}|dk	r|Sg}t|d�s(n�|jD]�}d|jkr.|jd}t|t�rV|f}|D]^}|dkrjqZqZ|�d�r�|�d�s�|j�	d�}|r�|�
d||f�q�|�
|�qZ|�
|�qZq.z
||_WnYnX|S)a�Return a list of slot names for a given class.

    This needs to find slots defined by the class and its bases, so we
    can't simply return the __slots__ attribute.  We must walk down
    the Method Resolution Order and concatenate the __slots__ of each
    class found there.  (This assumes classes don't modify their
    __slots__ attribute to misrepresent their slots after the class is
    defined.)
    �
__slotnames__Nr)r&�__weakref__�__�_z_%s%s)r&�getr r�
isinstance�str�
startswith�endswithr"�lstrip�appendr1)r�namesr�slots�name�strippedrrr
�
_slotnamescs2





r@cCs�t|�}d|krdks&ntd��||f}t�|�|krNt�|�|krNdS|tkrjtd|t|f��|tkr�td|t|f��|t|<|t|<dS)zRegister an extension code.�i���zcode out of rangeNz)key %s is already registered with code %sz$code %s is already in use for key %s)�int�
ValueError�_extension_registryr5�_inverted_registry��moduler>�code�keyrrr
r�s$�
�
�cCsR||f}t�|�|ks$t�|�|kr4td||f��t|=t|=|tkrNt|=dS)z0Unregister an extension code.  For testing only.z%key %s is not registered with code %sN)rDr5rErC�_extension_cacherFrrr
r�s��cCst��dSr)rJ�clearrrrr
r�s)N)�__doc__�__all__rrrr�	NameErrorrrr!r,r.r0r@rDrErJrrrrrrr
�<module>s4�

	$<cgitb.cpython-38.opt-2.pyc000064400000020551150335716500011234 0ustar00U

e5d@/�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	dd�Z
gZdd�Zdd�Z
dd	�Zd
d�Zdd
�Zddd�Zddd�ZGdd�d�Ze�jZddd�ZdS)�NcCsdS)Na'<!--: spam
Content-Type: text/html

<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> -->
<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> -->
</font> </font> </font> </script> </object> </blockquote> </pre>
</table> </table> </table> </table> </table> </font> </font> </font>�rrr�/usr/lib64/python3.8/cgitb.py�reset#srcCs|rd|dSdSdS)Nz<small>z</small>�r��textrrr�small.srcCs|rd|dSdSdS)Nz<strong>z	</strong>rrrrrr�strong4sr	cCs|rd|dSdSdS)Nz<font color="#909090">z</font>rrrrrr�grey:sr
cCs�||krd||fS||jkr,d|j|fSd|jkr~|jd}t|�ti�krf||kr~d||fSnt||�r~dt||�fSdtfS)N�local�global�__builtins__�builtin)�	f_globals�type�hasattr�getattr�	__UNDEF__)�name�frame�locals�builtinsrrr�lookup@s



rcCs�gdddtf\}}}}}t�|�D]�\}}	}
}}|tjkr>q�|tjkr�|	tjkr�|dkr�|tk	r�t||	t�}|�||	||f�q�t	|	||�\}
}|�|	|
|f�n"|	dkr�||d7}|}nd\}}|	}q"|S)Nr�.)Nr)
r�tokenize�generate_tokens�NEWLINE�NAME�keyword�kwlistr�appendr)�readerrr�varsZ	lasttoken�parent�prefix�valueZttype�token�start�end�line�whererrr�scanvarsPs"
r+�c"s�|\}}}t|t�r|j}dtj��ddtj}t�t���}dt	j
�dtt	j
�
t|���dd|d|�d	}d
td�d}g}	t�||�}
|
D�]F\}�}}
}}�r�tj����d
�t	j
�
��f}nd�}t�|�\}}}}d}|
dk�r8dtt	j
�
|
��}|
dk�r8|tj||||dd�d�7}i�|gf��fdd�	}t|||�}dd||fg}|dk	�r
||}|D]�}tddtt|��t|��d}|�k�r�d|t	j
�|�f}|�d|�n&d|t	j
�|�f}|�dt|��|d7}�q�ig}}|D]�\}}} ||k�r0�qd||<| tk	�r�|d k�r^d!|t|�}n*|d"k�rrt|�}n|t|�d#�d$�}|�d%|t	j
�| �f�n|�|d&��q|�dttd'�|����|	�d(d)�|��q�d*tt	j
�
t|���t	j
�
t|��fg}!t|�D]B}|dd�d+k�r4�qt	j
�t ||��} |!�d,||| f��q|d�|	�d�|!�d-t	j
�
d�t!�"|||���S).N�Python r�: z<body bgcolor="#f0f0f8">z<big><big>%s</big></big>z#ffffffz#6622aaz<br>z�
<p>A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.</p>z<tt>z&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;z&nbsp;</tt>z<a href="file://%s">%s</a>�?r�in �<module>cSsdtj�|�S�N�=)�pydoc�html�repr�r%rrr�<lambda>��zhtml.<locals>.<lambda>�Zformatvaluec
s8d�|d<zt��|d�W�S|dd7<XdS�N�r��	linecache�getline��lnum��fileZ	highlightrrr!�szhtml.<locals>.readerz+<tr><td bgcolor="#d8bbff">%s%s %s</td></tr>z<big>&nbsp;</big>z&nbsp;r,z<tt>=&gt;%s%s</tt>z&<tr><td bgcolor="#ffccee">%s</td></tr>z<tt>&nbsp;&nbsp;%s%s</tt>z<tr><td>%s</td></tr>r<)rrz<em>%s</em> rr���z%s&nbsp;= %sz <em>undefined</em>z, zF
<table width="100%%" cellspacing=0 cellpadding=0 border=0>
%s</table>�
z	<p>%s: %s�_z
<br>%s%s&nbsp;=
%sz�


<!-- The above is a description of an error in a Python program, formatted
     for a Web browser because the 'cgitb' module was enabled.  In case you
     are not reading this in a Web browser, here is the original traceback:

%s
-->
)#�
isinstancer�__name__�sys�version�split�
executable�time�ctimer4r5Zheadingr	�escape�strr�inspect�getinnerframes�os�path�abspath�getargvalues�formatargvaluesr+�lenZ	preformatr r
rr6�join�dirr�	traceback�format_exception)"�einfo�context�etype�evalue�etb�pyver�date�head�indent�frames�recordsrrA�func�lines�index�link�args�varargs�varkwr�callr!r"�rows�ir)�num�done�dumprr*r%�	exceptionrrBrr5es�

�
��

��
$






��	��r5c 	s�|\}}}t|t�r|j}dtj��ddtj}t�t���}dt	|�||fd}g}t
�||�}	|	D�]�\}
�}}}
}�r�tj
���p�d�t
�|
�\}}}}d}|dkr�d|}|d	kr�|t
j||||d
d�d�7}i�|gf��fd
d�	}t||
|�}d�|fg}|dk	�rP||}|
D](}d|}|�||���|d7}�q&ig}}|D]�\}}}||k�rv�q^d||<|tk	�r�|dk�r�d|}n|dk�r�||�d�d}|�d|tj�|�f�n|�|d��q^|�d�|��|�dd�|��qndt	|�t	|�fg}t|�D],}tj�t||��}|�dd||f��q*|d�|�d�|�dd�t�|||��S)Nr-rr.z	%s
%s
%s
z�
A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.
r/rr0r1cSsdtj�|�Sr2)r4rr6r7rrrr8�r9ztext.<locals>.<lambda>r:c
s8d�|d<zt��|d�W�S|dd7<XdSr;r=r@rBrrr!�sztext.<locals>.readerz %s %sz%5d r<rzglobal rrrDz%s = %sz
 undefinedrEz
%s
z%s: %sz

%s%s = %sz    zc

The above is a description of an error in a Python program.  Here is
the original traceback:

%s
)rGrrHrIrJrKrLrMrNrPrQrRrSrTrUrVrWr+r �rstriprr4rr6rYrZrr[r\) r]r^r_r`rarbrcrdrfrgrrArhrirjrlrmrnrror!r"rprqr)rrrsrtrr*r%rurrBrr�sb

�






�rc@s(eZdZddd�Zdd�Zdd	d
�ZdS)
�Hookr<Nr,r5cCs(||_||_||_|ptj|_||_dS�N)�display�logdirr^rI�stdoutrC�format)�selfryrzr^rCr|rrr�__init__s
z
Hook.__init__cCs|�|||f�dSrx)�handle)r}r_r`rarrr�__call__
sz
Hook.__call__c
	Csz|p
t��}|jdkr$|j�t��|jdkr2tp4t}d}z|||j�}Wn d�	t
j|��}d}YnX|jr�|r�t
j�|�}|j�d|d�q�|j�|d�n|j�d�|jdk	�rZd	d
g|jdk}tj||jd�\}}z.t�|d��}|�|�W5QRXd
|}	Wnd|}	YnX|jdk�rJ|j�d|	�n|j�|	d�z|j��WnYnXdS)Nr5FrTz<pre>z</pre>
rEz*<p>A problem occurred in a Python script.
z.txtz.html)�suffixrZ�wz*%s contains the description of this error.z*Tried to save traceback to %s, but failed.z
<p>%s</p>
)rI�exc_infor|rC�writerr5rr^rYr[r\ryr4rOrz�tempfileZmkstemprS�fdopen�flush)
r}�infoZ	formatterZplain�docr��fdrTrC�msgrrrrs@

zHook.handle)r<Nr,Nr5)N)rH�
__module__�__qualname__r~r�rrrrrrws
�
rwr<cCst||||d�t_dS)N�ryrzr^r|)rwrI�
excepthookr�rrr�enable:s�r�)r,)r,)r<Nr,r5)rQrr>rSr4rIr�rMrr[rrrr	r
rr+r5rrwrZhandlerr�rrrr�<module>s*

[
B7threading.cpython-38.opt-2.pyc000064400000054502150335716500012114 0ustar00U

e5d���@s.ddlZddlZddlZddlmZddlm	Z	ddl
mZm
ZzddlmZWn ek
rpddlmZYnXdddd	d
ddd
dddddddddddddddgZejZejZejZejZzejZdZe�d�Wnek
r�dZYnXejZ z
ej!Z"Wnek
�rdZ"YnXej#Z#[da$da%d d�Z&d!d�Z'eZ(d"d�Z!Gd#d$�d$�Z)e)Z*Gd%d�d�Z+Gd&d�d�Z,Gd'd�de,�Z-Gd(d
�d
�Z.Gd)d�d�Z/Gd*d�de0�Z1e�j2Z3e3�dKd,d-�Z4e�a5iZ6iZ7e	�Z8e�a9e:�a;Gd.d�d�Z<zdd/lm=a>m?Z@WnHek
�rRdd0lAmBZCdd1lmDZDeDdd2�Z?d3d�Z@d4d�a>YnXd5d6�ZEGd7d�de<�ZFGd8d9�d9e<�ZGGd:d;�d;e<�ZHd<d	�ZIeIZJd=d�ZKeKZLd>d?�ZMd@d
�ZNddAlmOZOeG�aPdBdC�ZQdDd�ZRzddElmSZTWn"ek
�rddFlUmTZTYnXdGdH�ZVeWedI��r*ejXeVdJ�dS)L�N)�	monotonic)�WeakSet)�islice�count)�deque�	get_ident�active_count�	Condition�current_thread�	enumerate�main_thread�TIMEOUT_MAX�Event�Lock�RLock�	Semaphore�BoundedSemaphore�Thread�Barrier�BrokenBarrierError�Timer�ThreadError�
setprofile�settrace�local�
stack_size�
excepthook�ExceptHookArgsT�
get_native_idFcCs|adS�N)�
_profile_hook��func�r#�!/usr/lib64/python3.8/threading.pyr9scCs|adSr)�_trace_hookr!r#r#r$rCscOstdkrt||�St||�Sr)�_CRLock�_PyRLock)�args�kwargsr#r#r$rQs	
c@sReZdZdd�Zdd�Zddd�ZeZd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�_RLockcCst�|_d|_d|_dS�Nr)�_allocate_lock�_block�_owner�_count��selfr#r#r$�__init__hsz_RLock.__init__c	Cs^|j}zt|j}Wntk
r(YnXd|j��r:dnd|jj|jj||j	t
t|��fS)Nz)<%s %s.%s object owner=%r count=%d at %s>�lockedZunlocked)r.�_active�name�KeyErrorr-r3�	__class__�
__module__�__qualname__r/�hex�id)r1�ownerr#r#r$�__repr__ms
�z_RLock.__repr__T���cCsDt�}|j|kr"|jd7_dS|j�||�}|r@||_d|_|S�N�)rr.r/r-�acquire)r1�blocking�timeout�me�rcr#r#r$rA|s
z_RLock.acquirecCs<|jt�krtd��|jd|_}|s8d|_|j��dS)N�cannot release un-acquired lockr@)r.r�RuntimeErrorr/r-�release)r1rr#r#r$rH�sz_RLock.releasecCs|��dSr�rH�r1�t�v�tbr#r#r$�__exit__�sz_RLock.__exit__cCs|j��|\|_|_dSr)r-rAr/r.)r1�stater#r#r$�_acquire_restore�s
z_RLock._acquire_restorecCs<|jdkrtd��|j}d|_|j}d|_|j��||fS)NrrF)r/rGr.r-rH)r1rr<r#r#r$�
_release_save�s

z_RLock._release_savecCs|jt�kSr)r.rr0r#r#r$�	_is_owned�sz_RLock._is_ownedN)Tr>)�__name__r8r9r2r=rA�	__enter__rHrNrPrQrRr#r#r#r$r*^s

$
r*c@speZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	ddd�Z
ddd�Zddd�Zdd�Z
e
ZdS)r	NcCs�|dkrt�}||_|j|_|j|_z|j|_Wntk
rDYnXz|j|_Wntk
rfYnXz|j|_Wntk
r�YnXt�|_	dSr)
r�_lockrArHrQ�AttributeErrorrPrR�_deque�_waiters�r1�lockr#r#r$r2�s$zCondition.__init__cCs
|j��Sr)rUrTr0r#r#r$rT�szCondition.__enter__cGs|jj|�Sr)rUrN)r1r(r#r#r$rN�szCondition.__exit__cCsd|jt|j�fS)Nz<Condition(%s, %d)>)rU�lenrXr0r#r#r$r=�szCondition.__repr__cCs|j��dSr)rUrHr0r#r#r$rQ�szCondition._release_savecCs|j��dSr)rUrA)r1�xr#r#r$rPszCondition._acquire_restorecCs"|j�d�r|j��dSdSdS)NrFT)rUrArHr0r#r#r$rRs
zCondition._is_ownedcCs�|��std��t�}|��|j�|�|��}d}z>|dkrN|��d}n |dkrd|�d|�}n
|�d�}|W�S|�|�|s�z|j�|�Wnt	k
r�YnXXdS)Nzcannot wait on un-acquired lockFTr)
rRrGr,rArX�appendrQrP�remove�
ValueError)r1rC�waiterZsaved_stateZgotitr#r#r$�waits*

zCondition.waitcCsXd}|}|�}|sT|dk	rB|dkr.t�|}n|t�}|dkrBqT|�|�|�}q|Sr+)�_timera)r1Z	predicaterC�endtimeZwaittime�resultr#r#r$�wait_for>s

zCondition.wait_forr@c	Csf|��std��|j}tt||��}|s,dS|D]0}|��z|�|�Wq0tk
r^Yq0Xq0dS)Nz!cannot notify on un-acquired lock)rRrGrXrW�_islicerHr^r_)r1�nZall_waitersZwaiters_to_notifyr`r#r#r$�notifyUs
zCondition.notifycCs|�t|j��dSr)rhr[rXr0r#r#r$�
notify_alllszCondition.notify_all)N)N)N)r@)rSr8r9r2rTrNr=rQrPrRrarerhriZ	notifyAllr#r#r#r$r	�s
	
0

	c@s4eZdZddd�Zd
dd�ZeZdd	�Zd
d�ZdS)rr@cCs&|dkrtd��tt��|_||_dS)Nrz$semaphore initial value must be >= 0)r_r	r�_cond�_value�r1�valuer#r#r$r2�szSemaphore.__init__TNc	Cs�|s|dk	rtd��d}d}|j�f|jdkrr|s4q�|dk	rd|dkrPt�|}n|t�}|dkrdq�|j�|�q$|jd8_d}W5QRX|S)Nz.can't specify timeout for non-blocking acquireFrr@T)r_rjrkrbra)r1rBrCrErcr#r#r$rA�s$

zSemaphore.acquirec	Cs.|j�|jd7_|j��W5QRXdSr?)rjrkrhr0r#r#r$rH�szSemaphore.releasecCs|��dSrrIrJr#r#r$rN�szSemaphore.__exit__)r@)TN)rSr8r9r2rArTrHrNr#r#r#r$rxs


-c@seZdZddd�Zdd�ZdS)rr@cCst�||�||_dSr)rr2�_initial_valuerlr#r#r$r2�szBoundedSemaphore.__init__c	CsB|j�2|j|jkrtd��|jd7_|j��W5QRXdS)Nz!Semaphore released too many timesr@)rjrkrnr_rhr0r#r#r$rH�s

zBoundedSemaphore.releaseN)r@)rSr8r9r2rHr#r#r#r$r�s
c@sBeZdZdd�Zdd�Zdd�ZeZdd�Zd	d
�Zddd
�Z	dS)rcCstt��|_d|_dS�NF)r	rrj�_flagr0r#r#r$r2�szEvent.__init__cCs|j�t��dSr)rjr2rr0r#r#r$�_reset_internal_locks�szEvent._reset_internal_lockscCs|jSr)rpr0r#r#r$�is_setszEvent.is_setc	Cs&|j�d|_|j��W5QRXdS�NT)rjrprir0r#r#r$�setsz	Event.setc	Cs|j�d|_W5QRXdSro)rjrpr0r#r#r$�clearszEvent.clearNc
Cs8|j�(|j}|s|j�|�}|W5QR�SQRXdSr)rjrpra)r1rCZsignaledr#r#r$ras
z
Event.wait)N)
rSr8r9r2rqrrZisSetrtrurar#r#r#r$r�s
c@s|eZdZddd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zedd��Z
edd��Zedd��ZdS)rNcCs.tt��|_||_||_||_d|_d|_dSr+)r	rrj�_action�_timeout�_parties�_stater/)r1�parties�actionrCr#r#r$r2Fs	zBarrier.__init__c
Cs�|dkr|j}|j�r|��|j}|jd7_z6|d|jkrL|��n
|�|�|W�W5QR�S|jd8_|��XW5QRXdSr?)rwrj�_enterr/�_exitrx�_release�_wait)r1rC�indexr#r#r$raVs	

zBarrier.waitcCs(|jdkr|j��q|jdkr$t�dS)N�r>r@r)ryrjrarr0r#r#r$r|ts


zBarrier._entercCs>z"|jr|��d|_|j��Wn|���YnXdSr?)rvryrjri�_breakr0r#r#r$r~szBarrier._releasecs4�j��fdd�|�s"���t��jdkr0t�dS)Ncs
�jdkSr+�ryr#r0r#r$�<lambda>��zBarrier._wait.<locals>.<lambda>r)rjrer�rry�r1rCr#r0r$r�s
z
Barrier._waitcCs(|jdkr$|jdkr$d|_|j��dS)Nrr�)r/ryrjrir0r#r#r$r}�s

z
Barrier._exitc	CsT|j�D|jdkr6|jdkr$d|_q<|jdkr<d|_nd|_|j��W5QRXdS)Nrr>���)rjr/ryrir0r#r#r$�reset�s


z
Barrier.resetc	Cs|j�|��W5QRXdSr)rjr�r0r#r#r$�abort�sz
Barrier.abortcCsd|_|j��dS�Nr�)ryrjrir0r#r#r$r��szBarrier._breakcCs|jSr)rxr0r#r#r$rz�szBarrier.partiescCs|jdkr|jSdSr+)ryr/r0r#r#r$�	n_waiting�s
zBarrier.n_waitingcCs
|jdkSr�r�r0r#r#r$�broken�szBarrier.broken)NN)N)rSr8r9r2rar|r~rr}r�r�r��propertyrzr�r�r#r#r#r$r=s	




c@seZdZdS)rN)rSr8r9r#r#r#r$r�s�	Thread-%dcCs
|t�Sr)�_counter)�templater#r#r$�_newname�sr�c@seZdZdZd9dd�dd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
erXdd�Zdd�Z
dd�Zdd�Zdd�Zd:dd�Zd;d!d"�Zed#d$��Zejd%d$��Zed&d'��Zer�ed(d)��Zd*d+�Zd,d-�Zed.d/��Zejd0d/��Zd1d2�Zd3d4�Zd5d6�Zd7d8�ZdS)<rFNr#��daemoncCs�|dkri}||_t|pt��|_||_||_|dk	r>||_n
t�j|_d|_	t
rXd|_d|_t
�|_d|_d|_tj|_t�|_t�|�dS)NFT)�_target�strr��_name�_args�_kwargs�	_daemonicr
r��_ident�_HAVE_THREAD_NATIVE_ID�
_native_id�_tstate_lockr�_started�_is_stopped�_initialized�_sys�stderr�_stderr�_make_invoke_excepthook�_invoke_excepthook�	_dangling�add)r1�group�targetr5r(r)r�r#r#r$r2�s&
zThread.__init__cCs(|j��|r|��nd|_d|_dSrs)r�rq�_set_tstate_lockr�r�)r1�is_aliver#r#r$rq(s


zThread._reset_internal_lockscCs^d}|j��rd}|��|jr$d}|jr2|d7}|jdk	rJ|d|j7}d|jj|j|fS)N�initialZstartedZstoppedz daemonz %sz<%s(%s, %s)>)	r�rrr�r�r�r�r7rSr�)r1Zstatusr#r#r$r=4s

zThread.__repr__cCs�|jstd��|j��r td��t�|t|<W5QRXzt|jd�Wn,tk
rtt�t|=W5QRX�YnX|j�	�dS)Nzthread.__init__() not calledz threads can only be started oncer#)
r�rGr�rr�_active_limbo_lock�_limbo�_start_new_thread�
_bootstrap�	Exceptionrar0r#r#r$�startBs

zThread.startcCs.z|jr|j|j|j�W5|`|`|`XdSr)r�r�r�r0r#r#r$�run[s	z
Thread.runcCs4z|��Wn"|jr(tdkr(YdS�YnXdSr)�_bootstrap_innerr�r�r0r#r#r$r�ls
zThread._bootstrapcCst�|_dSr)rr�r0r#r#r$�
_set_ident�szThread._set_identcCst�|_dSr)rr�r0r#r#r$�_set_native_id�szThread._set_native_idc	Cs8t�|_|j��|js4t�t�|j�W5QRXdSr)�
_set_sentinelr�rAr��_shutdown_locks_lock�_shutdown_locksr�r0r#r#r$r��s

zThread._set_tstate_lockcCs�z�|��|��tr|��|j��t�|t|j	<t
|=W5QRXtrVt�
t�trdt�t�z|��Wn|�|�YnXW5t� ztt�=WnYnXW5QRXXdSr)r�r4rr�r�r�r�r�rtr�r�r%r�rr rr�r�r0r#r#r$r��s,



zThread._bootstrap_innerc	Cs>|j}|dk	rd|_d|_|js:t�t�|�W5QRXdSrs)r�r�r�r�r��discardrYr#r#r$�_stop�szThread._stopc	Cst�tt�=W5QRXdSr)r�r4rr0r#r#r$�_delete�szThread._deletecCsZ|jstd��|j��s td��|t�kr2td��|dkrD|��n|jt|d�d�dS)N�Thread.__init__() not calledz'cannot join thread before it is startedzcannot join current threadr)rC)r�rGr�rrr
�_wait_for_tstate_lock�maxr�r#r#r$�join�s


zThread.joinTr>cCs0|j}|dkrn|�||�r,|��|��dSr)r�rArHr�)r1�blockrCrZr#r#r$r��szThread._wait_for_tstate_lockcCs|jSr)r�r0r#r#r$r5s	zThread.namecCst|�|_dSr)r�r��r1r5r#r#r$r5scCs|jSr)r�r0r#r#r$�idents
zThread.identcCs|jSr)r�r0r#r#r$�	native_id$s	zThread.native_idcCs&|js|j��sdS|�d�|jSro)r�r�rrr�r0r#r#r$r�/s	
zThread.is_alivecCs ddl}|jdtdd�|��S)Nrz/isAlive() is deprecated, use is_alive() instead�)�
stacklevel)�warnings�warn�DeprecationWarningr�)r1r�r#r#r$�isAlive=s�zThread.isAlivecCs|jSr)r�r0r#r#r$r�Gs
z
Thread.daemoncCs*|jstd��|j��r td��||_dS)Nr�z)cannot set daemon status of active thread)r�rGr�rrr��r1Zdaemonicr#r#r$r�Vs

cCs|jSrr�r0r#r#r$�isDaemon^szThread.isDaemoncCs
||_dSrr�r�r#r#r$�	setDaemonaszThread.setDaemoncCs|jSr�r5r0r#r#r$�getNamedszThread.getNamecCs
||_dSrr�r�r#r#r$�setNamegszThread.setName)NNNr#N)N)Tr>)rSr8r9r�r2rqr=r�r�r�r�r�r�r�r�r�r�r�r�r�r5�setterr�r�r�r�r�r�r�r�r�r#r#r#r$r�sP	��/	
&









)�_excepthook�_ExceptHookArgs)�print_exception)�
namedtuplez'exc_type exc_value exc_traceback threadcCst|�Sr)r�)r(r#r#r$rwscCs�|jtkrdStdk	r(tjdk	r(tj}n$|jdk	rH|jj}|dkrLdSndS|jdk	r`|jj}nt�}td|�d�|dd�t	|j|j
|j|d�|��dS)NzException in thread �:T��file�flush)r�)
�exc_type�
SystemExitr�r��threadr�r5r�print�_print_exception�	exc_value�
exc_tracebackr�)r(r�r5r#r#r$rzs(



��csPt�tj��dkrtd���dkr*td��tj�t�t������fdd�}|S)Nzthreading.excepthook is Nonezsys.excepthook is Nonec
s�z�z,t}|dkr�}t��|f��}||�Wn�tk
r�}zbd|_~�dk	rb�jdk	rb�j}n|j}�d|dd��dk	r��jdk	r��j}n�}|���W5d}~XYnXW5d}XdS)NTz"Exception in threading.excepthook:r�)rrr��__suppress_context__r�r�)r�r(�hook�excr�Zsys_excepthook�Zlocal_printZ	local_sysZold_excepthookZold_sys_excepthookZsys_exc_infor#r$�invoke_excepthook�s*� z2_make_invoke_excepthook.<locals>.invoke_excepthook)rr�rG�exc_infor�)r�r#r�r$r��s r�c@s&eZdZddd�Zdd�Zdd�ZdS)	rNcCsFt�|�||_||_|dk	r"|ng|_|dk	r4|ni|_t�|_dSr)rr2�interval�functionr(r)r�finished)r1r�r�r(r)r#r#r$r2�s
zTimer.__init__cCs|j��dSr)r�rtr0r#r#r$�cancel�szTimer.cancelcCs6|j�|j�|j��s(|j|j|j�|j��dSr)r�rar�rrr�r(r)rtr0r#r#r$r��s
z	Timer.run)NN)rSr8r9r2r�r�r#r#r#r$r�s	
c@seZdZdd�ZdS)�_MainThreadc	CsTtj|ddd�|��|j��|��tr6|��t�|t	|j
<W5QRXdS)NZ
MainThreadF�r5r�)rr2r�r�rtr�r�r�r�r4r�r0r#r#r$r2�s
z_MainThread.__init__N)rSr8r9r2r#r#r#r$r��sr�c@s.eZdZdd�Zdd�Zdd�Zd
dd	�ZdS)�_DummyThreadc	CsPtj|td�dd�|j��|��tr2|��t�|t	|j
<W5QRXdS)NzDummy-%dTr�)rr2r�r�rtr�r�r�r�r4r�r0r#r#r$r2s
z_DummyThread.__init__cCsdSrr#r0r#r#r$r�
sz_DummyThread._stopcCsdSrsr#r0r#r#r$r�sz_DummyThread.is_aliveNcCsdSrr#r�r#r#r$r�sz_DummyThread.join)N)rSr8r9r2r�r�r�r#r#r#r$r�s
r�cCs,ztt�WStk
r&t�YSXdSr)r4rr6r�r#r#r#r$r
sc
Cs,t�tt�tt�W5QR�SQRXdSr)r�r[r4r�r#r#r#r$r(scCstt���tt���Sr)�listr4�valuesr�r#r#r#r$�
_enumerate4sr�c
Cs4t�&tt���tt���W5QR�SQRXdSr)r�r�r4r�r�r#r#r#r$r8s)rc	Csftjr
dStj}|��t��t�tt�}t��W5QRX|sFqb|D]}|�	�|��qJq dSr)
�_main_threadr�r�rHr�r�r�r�rurA)ZtlockZlocksrZr#r#r$�	_shutdownKs	r�cCstSr)r�r#r#r#r$rss)�_local)rc	Cs�t�ai}ztt�}Wntk
r2t�}YnX|at�at�a	t�xtt
��}|�t�|D]>}||kr�|�
d�t�}||_|||<qb|�
d�|��qbt��t��t�|�W5QRXdS)NTF)r,r�r4rr6r�r�r�rtr�r��updater�rqr�r�r�ru)Z
new_activeZcurrentZthreadsr�r�r#r#r$�_after_fork�s0






r��register_at_fork)Zafter_in_child)r�)Y�os�_os�sysr��_thread�timerrbZ_weakrefsetr�	itertoolsrrfrr/�_collectionsrrW�ImportError�collections�__all__�start_new_threadr��
allocate_lockr,r�rrr�r]rV�errorrrr&r
r r%rrrr*r'r	rrrrrGr�__next__r�r�r�r4r�r�r�rtr�rr�rr�r�	tracebackr�r�r�r�rr�r�r
Z
currentThreadrZactiveCountr�rrr�r�rr�rZ_threading_localr��hasattrr�r#r#r#r$�<module>s��




q'P&O
�5
(5_sitebuiltins.cpython-38.opt-1.pyc000064400000006633150335716500013025 0ustar00U

e5d+�@s@dZddlZGdd�de�ZGdd�de�ZGdd�de�ZdS)	z=
The objects used by the site module to add custom builtins.
�Nc@s&eZdZdd�Zdd�Zddd�ZdS)	�QuittercCs||_||_dS�N��name�eof)�selfrr�r�%/usr/lib64/python3.8/_sitebuiltins.py�__init__szQuitter.__init__cCsd|j|jfS)NzUse %s() or %s to exitr�rrrr	�__repr__szQuitter.__repr__NcCs(ztj��WnYnXt|��dSr)�sys�stdin�close�
SystemExit)r�coderrr	�__call__s
zQuitter.__call__)N)�__name__�
__module__�__qualname__r
rrrrrr	r
src@s6eZdZdZdZd
dd�Zdd�Zdd	�Zd
d�ZdS)�_Printerzninteractive prompt objects for printing the license text, a list of
    contributors and the copyright notice.�rcs4ddl�||_||_d|_��fdd�|D�|_dS)Nrcs$g|]}�D]}�j�||��qqSr)�path�join)�.0�dir�filename��files�osrr	�
<listcomp>(s�z%_Printer.__init__.<locals>.<listcomp>)r�_Printer__name�_Printer__data�_Printer__lines�_Printer__filenames)rr�datar�dirsrrr	r
#s�z_Printer.__init__c
Cs~|jr
dSd}|jD]B}z(t|d��}|��}W5QRXWqXWqtk
rTYqXq|sb|j}|�d�|_t|j�|_dS)N�r�
)	r#r$�open�read�OSErrorr"�split�len�_Printer__linecnt)rr%r�fprrr	�__setup,s

z_Printer.__setupcCs8|��t|j�|jkr$d�|j�Sd|jfdSdS)Nr(z!Type %s() to see the full %s text�)�_Printer__setupr-r#�MAXLINESrr!rrrr	r<sz_Printer.__repr__cCs�|��d}d}z(t|||j�D]}t|j|�q"Wntk
rPYq�YqX||j7}d}|dkr~t|�}|dkr`d}q`|dkrq�qdS)Nz0Hit Return for more, or q (and Return) to quit: r)��qr5)r2�ranger3�printr#�
IndexError�input)r�prompt�lineno�i�keyrrr	rCs 

z_Printer.__call__N)rr)	rrr�__doc__r3r
r2rrrrrr	rs
	rc@s eZdZdZdd�Zdd�ZdS)�_Helpera3Define the builtin 'help'.

    This is a wrapper around pydoc.help that provides a helpful message
    when 'help' is typed at the Python interactive prompt.

    Calling help() at the Python prompt starts an interactive help session.
    Calling help(thing) prints help for the python object 'thing'.
    cCsdS)NzHType help() for interactive help, or help(object) for help about object.rrrrr	rbsz_Helper.__repr__cOsddl}|j||�S)Nr)�pydoc�help)r�args�kwdsr@rrr	resz_Helper.__call__N)rrrr>rrrrrr	r?Xs	r?)r>r
�objectrrr?rrrr	�<module>s
;nturl2path.cpython-38.opt-1.pyc000064400000003322150335716500012243 0ustar00U

e5dG�@sdZdd�Zdd�ZdS)z�Convert a NT pathname to a file URL and vice versa.

This module only exists to provide OS-specific code
for urllib.requests, thus do not use directly.
cCs�ddl}ddl}|�dd�}d|kr\|dd�dkr@|dd�}|�d�}|j�d	�|��S|�d�}t|�dks�|dd
|jkr�d|}t	|��|dd
�
�}|d�d�}|d}|D]}|r�|d	|j�|�}q�|�d�r�|�d�r�|d	7}|S)
z{OS-specific conversion from a relative URL of the 'file' scheme
    to a file system path; not recommended for general use.�N�:�|�z////��/�\���z	Bad URL: �)�string�urllib.parse�replace�split�parseZunquote�join�lenZ
ascii_letters�OSError�upper�endswith)Zurlr
�urllib�
components�comp�error�drive�path�r�"/usr/lib64/python3.8/nturl2path.py�url2pathnames(	

rcCs4ddl}|dd�dkrf|dd�}|dd���dkrJd|dd�}n|dd�d	krftd
|��d	|kr�|dd�dkr�d|}|�d�}|j�d�|��S|jd	dd
�}t|�dks�t|d�dkr�d
|}t|��|j�|d���}|d�d�}d|d	}|D] }|�r|d|j�|�}�q|S)z{OS-specific conversion from a file system path to a relative URL
    of the 'file' scheme; not recommended for general use.rNrz\\?\zUNC\rr	rrz
Bad path: z\\r)�maxsplitz///)rrrr
rZquoterr)�prrrrrrrrr�pathname2url-s.
rN)�__doc__rrrrrr�<module>s%telnetlib.cpython-38.pyc000064400000043477150335716500011202 0ustar00U

e5d�Z�@sJdZddlZddlZddlZddlmZdgZdZdZ	e
dg�Ze
dg�Ze
dg�Z
e
d	g�Ze
d
g�Ze
dg�Ze
dg�Ze
dg�Ze
d
g�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Z e
dg�Z!e
dg�Z"e
dg�Z#e
dg�Z$e
dg�Z%e
dg�Z&e
d g�Z'e
d!g�Z(e
d"g�Z)e
d#g�Z*e
d$g�Z+e
d%g�Z,e
d&g�Z-e
d'g�Z.e
d(g�Z/e
d)g�Z0e
d*g�Z1e
d+g�Z2e
dg�Z3e
d,g�Z4e
d-g�Z5e
d.g�Z6e
d/g�Z7e
d0g�Z8e
d1g�Z9e
d2g�Z:e
d3g�Z;e
d4g�Z<e
d5g�Z=e
d6g�Z>e
d7g�Z?e
d8g�Z@e
d9g�ZAe
d:g�ZBe
d;g�ZCe
d<g�ZDe
d=g�ZEe
d>g�ZFe
d?g�ZGe
d@g�ZHe
dAg�ZIe
dBg�ZJe
dCg�ZKe
dDg�ZLe
dEg�ZMe
dFg�ZNe
dGg�ZOe
dHg�ZPe
dg�ZQe
dg�ZReSedI��rejTZUnejVZUGdJd�d�ZWdKdL�ZXeYdMk�rFeX�dS)NaQTELNET client class.

Based on RFC 854: TELNET Protocol Specification, by J. Postel and
J. Reynolds

Example:

>>> from telnetlib import Telnet
>>> tn = Telnet('www.python.org', 79)   # connect to finger port
>>> tn.write(b'guido\r\n')
>>> print(tn.read_all())
Login       Name               TTY         Idle    When    Where
guido    Guido van Rossum      pts/2        <Dec  2 11:10> snag.cnri.reston..

>>>

Note that read_all() won't read until eof -- it just reads some data
-- but it guarantees to read at least one byte unless EOF is hit.

It is possible to pass a Telnet object to a selector in order to wait until
more data is available.  Note that in this case, read_eager() may return b''
even if there was data on the socket, because the protocol negotiation may have
eaten the data.  This is why EOFError is needed in some cases to distinguish
between "no data" and "connection closed" (since the socket also appears ready
for reading when it is closed).

To do:
- option negotiation
- timeout should be intrinsic to the connection object instead of an
  option on one of the read calls only

�N)�	monotonic�Telnet�������������������������������	�
���
������������������ �!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�0�1����PollSelectorc@seZdZdZddejfdd�Zdejfdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zd<dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd=d6d7�Zd8d9�Z d:d;�Z!dS)>ra�Telnet interface class.

    An instance of this class represents a connection to a telnet
    server.  The instance is initially not connected; the open()
    method must be used to establish a connection.  Alternatively, the
    host name and optional port number can be passed to the
    constructor, too.

    Don't try to reopen an already connected instance.

    This class has many read_*() methods.  Note that some of them
    raise EOFError when the end of the connection is read, because
    they can return an empty string for other reasons.  See the
    individual doc strings.

    read_until(expected, [timeout])
        Read until the expected string has been seen, or a timeout is
        hit (default is no timeout); may block.

    read_all()
        Read all data until EOF; may block.

    read_some()
        Read at least one byte or EOF; may block.

    read_very_eager()
        Read all data available already queued or on the socket,
        without blocking.

    read_eager()
        Read either data already queued or some data available on the
        socket, without blocking.

    read_lazy()
        Read all data in the raw queue (processing it first), without
        doing any socket I/O.

    read_very_lazy()
        Reads all data in the cooked queue, without doing any socket
        I/O.

    read_sb_data()
        Reads available data between SB ... SE sequence. Don't block.

    set_option_negotiation_callback(callback)
        Each time a telnet option is read on the input flow, this callback
        (if set) is called with the following parameters :
        callback(telnet socket, command, option)
            option will be chr(0) when there is no option.
        No other action is done afterwards by telnetlib.

    NrcCsht|_||_||_||_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
|dk	rd|�|||�dS)z�Constructor.

        When called without arguments, create an unconnected instance.
        With a hostname argument, it connects the instance; port number
        and timeout are optional.
        N�r)�
DEBUGLEVEL�
debuglevel�host�port�timeout�sock�rawq�irawq�cookedq�eof�iacseq�sb�sbdataq�option_callback�open��selfrLrMrN�r[�!/usr/lib64/python3.8/telnetlib.py�__init__�szTelnet.__init__cCsFd|_|st}||_||_||_t�d|||�t�||f|�|_	dS)z�Connect to a host.

        The optional second argument is the port number, which
        defaults to the standard telnet port (23).

        Don't try to reopen an already connected instance.
        rztelnetlib.Telnet.openN)
rS�TELNET_PORTrLrMrN�sys�audit�socketZcreate_connectionrOrYr[r[r\rX�szTelnet.opencCs|��dS)z#Destructor -- close the connection.N��close�rZr[r[r\�__del__�szTelnet.__del__cGs@|jdkr<td|j|jfdd�|r4t||�nt|�dS)z�Print a debug message, when the debug level is > 0.

        If extra arguments are present, they are substituted in the
        message using the standard string formatting operator.

        rzTelnet(%s,%s):� )�endN)rK�printrLrM)rZ�msg�argsr[r[r\ri�s

z
Telnet.msgcCs
||_dS)zhSet the debug level.

        The higher it is, the more debug output you get (on sys.stdout).

        N)rK)rZrKr[r[r\�set_debuglevel�szTelnet.set_debuglevelcCs.|j}d|_d|_d|_d|_|r*|��dS)zClose the connection.NTrIr)rOrSrTrUrc)rZrOr[r[r\rcszTelnet.closecCs|jS)z)Return the socket object used internally.)rOrdr[r[r\�
get_socketszTelnet.get_socketcCs
|j��S)z9Return the fileno() of the socket object used internally.)rO�filenordr[r[r\rmsz
Telnet.filenocCsBt|kr|�ttt�}t�d||�|�d|�|j�|�dS)z�Write a string to the socket, doubling any IAC characters.

        Can block if the connection is blocked.  May raise
        OSError if the connection is closed.

        ztelnetlib.Telnet.writezsend %rN)�IAC�replacer_r`rirO�sendall)rZ�bufferr[r[r\�writes
zTelnet.writec
Cs*t|�}|��|j�|�}|dkrN||}|jd|�}|j|d�|_|S|dk	r`t�|}t���}|�|tj�|j	�s|�
|�r�tdt|j�|�}|��|��|j�||�}|dkr�||}|jd|�}|j|d�|_|W5QR�S|dk	rv|t�}|dkrv�qqvW5QRX|�
�S)aRead until a given string is encountered or until timeout.

        When no match is found, return whatever is available instead,
        possibly the empty string.  Raise EOFError if the connection
        is closed and no cooked data is available.

        rN)�len�process_rawqrR�find�_time�_TelnetSelector�register�	selectors�
EVENT_READrS�select�max�	fill_rawq�read_very_lazy)rZ�matchrN�n�i�buf�deadline�selectorr[r[r\�
read_until&s8


zTelnet.read_untilcCs0|��|js |��|��q|j}d|_|S)z7Read all data until EOF; block until connection closed.rI)rtrSr}rR�rZr�r[r[r\�read_allKs
zTelnet.read_allcCs6|��|js&|js&|��|��q|j}d|_|S)z�Read at least one byte of cooked data unless EOF is hit.

        Return b'' if EOF is hit.  Block if no data is immediately
        available.

        rI)rtrRrSr}r�r[r[r\�	read_someUs
zTelnet.read_somecCs0|��|js(|��r(|��|��q|��S)aRead everything that's possible without blocking in I/O (eager).

        Raise EOFError if connection closed and no cooked data
        available.  Return b'' if no cooked data available otherwise.
        Don't block unless in the midst of an IAC sequence.

        )rtrS�
sock_availr}r~rdr[r[r\�read_very_eagerds

zTelnet.read_very_eagercCs6|��|js.|js.|��r.|��|��q|��S)z�Read readily available data.

        Raise EOFError if connection closed and no cooked data
        available.  Return b'' if no cooked data available otherwise.
        Don't block unless in the midst of an IAC sequence.

        )rtrRrSr�r}r~rdr[r[r\�
read_eagerrs

zTelnet.read_eagercCs|��|��S)aProcess and return data that's already in the queues (lazy).

        Raise EOFError if connection closed and no data available.
        Return b'' if no cooked data available otherwise.  Don't block
        unless in the midst of an IAC sequence.

        )rtr~rdr[r[r\�	read_lazy�szTelnet.read_lazycCs(|j}d|_|s$|jr$|js$td��|S)z�Return any data available in the cooked queue (very lazy).

        Raise EOFError if connection closed and no data available.
        Return b'' if no cooked data available otherwise.  Don't block.

        rIztelnet connection closed)rRrSrP�EOFErrorr�r[r[r\r~�s
zTelnet.read_very_lazycCs|j}d|_|S)aReturn any data available in the SB ... SE queue.

        Return b'' if no SB ... SE available. Should only be called
        after seeing a SB or SE command. When a new SB command is
        found, old unread SB data will be discarded. Don't block.

        rI)rVr�r[r[r\�read_sb_data�szTelnet.read_sb_datacCs
||_dS)zIProvide a callback function called after each receipt of a telnet option.N)rW)rZ�callbackr[r[r\�set_option_negotiation_callback�sz&Telnet.set_option_negotiation_callbackcCsRddg}�z|j�r|��}|jsf|tkr,q|dkr6q|tkrV||j|||j<qn|j|7_qt|j�dk�r$|ttt	t
fkr�|j|7_qd|_|tkr�||j|||j<nh|tkr�d|_d|_n&|t
kr�d|_|j|d|_d|d<|j�r|�|j|t�n|�dt|��qt|j�dkr|jdd�}d|_|}|ttfk�r�|�d|tk�rnd�ppd	t|��|j�r�|�|j||�n|j�tt
|�q|t	t
fkr|�d|t	k�r�d
�p�dt|��|j�r�|�|j||�q|j�tt|�qWn"tk
�r,d|_d|_YnX|j|d|_|j|d|_dS)
z�Transfer from raw queue to cooked queue.

        Set self.eof when connection is closed.  Don't block unless in
        the midst of an IAC sequence.

        rI�rrzIAC %d not recognizedrz	IAC %s %d�DO�DONT�WILL�WONTN)rP�rawq_getcharrT�theNULLrnrUrsr�r�r�r��SBrV�SErWrO�NOOPTri�ordrpr�rR)rZr��c�cmd�optr[r[r\rt�sp��zTelnet.process_rawqcCsZ|js|��|jrt�|j|j|jd�}|jd|_|jt|j�krVd|_d|_|S)z�Get next char from raw queue.

        Block if no data is immediately available.  Raise EOFError
        when connection is closed.

        rrIr)rPr}rSr�rQrs)rZr�r[r[r\r��szTelnet.rawq_getcharcCsL|jt|j�krd|_d|_|j�d�}|�d|�||_|j||_dS)z�Fill raw queue from exactly one recv() system call.

        Block if no data is immediately available.  Set self.eof when
        connection is closed.

        rIr�2zrecv %rN)rQrsrPrOZrecvrirSr�r[r[r\r}szTelnet.fill_rawqc
Cs:t��*}|�|tj�t|�d��W5QR�SQRXdS)z-Test whether data is available on the socket.rN)rwrxryrz�boolr{)rZr�r[r[r\r�szTelnet.sock_availc
Cs�tjdkr|��dSt���}|�|tj�|�tjtj�|��D]�\}}|j	|kr�z|�
�}Wn*tk
r�td�YW5QR�dSX|r�tj
�|�d��tj
��qD|j	tjkrDtj���d�}|s�W5QR�dS|�|�qDq<W5QRXdS)z9Interaction function, emulates a very dumb telnet client.Zwin32N�(*** Connection closed by remote host ***�ascii)r_�platform�mt_interactrwrxryrz�stdinr{Zfileobjr�r�rh�stdoutrr�decode�flush�readline�encode)rZr��keyZevents�text�liner[r[r\�interacts*

zTelnet.interactcCs<ddl}|�|jd�tj��}|s&q8|�|�d��qdS)z$Multithreaded version of interact().rNr[r�)�_thread�start_new_thread�listenerr_r�r�rrr�)rZr�r�r[r[r\r�3s
zTelnet.mt_interactcCsTz|��}Wntk
r*td�YdSX|rDtj�|�d��qtj��qdS)z>Helper for mt_interact() -- this executes in the other thread.r�Nr�)r�r�rhr_r�rrr�r�)rZ�datar[r[r\r�=szTelnet.listenerc
CsTd}|dd�}tt|��}|D]0}t||d�s |s>ddl}|�||�||<q |dk	rdt�|}t���}|�|tj	�|j
�s&|��|D]X}||�|j
�}|r�|��}	|j
d|	�}
|j
|	d�|_
|||
fW5QR�Sq�|dk	�r|�|�}|t�}|�s|dkrz�q&nqz|��qzW5QRX|��}
|
�sJ|j
�rJt�dd|
fS)a�Read until one from a list of a regular expressions matches.

        The first argument is a list of regular expressions, either
        compiled (re.Pattern instances) or uncompiled (strings).
        The optional second argument is a timeout, in seconds; default
        is no timeout.

        Return a tuple of three items: the index in the list of the
        first regular expression that matches; the re.Match object
        returned; and the text read up till and including the match.

        If EOF is read and no text was read, raise EOFError.
        Otherwise, when nothing matches, return (-1, None, text) where
        text is the text received so far (may be the empty string if a
        timeout happened).

        If a regular expression ends with a greedy match (e.g. '.*')
        or if more than one expression can match the same input, the
        results are undeterministic, and may depend on the I/O timing.

        N�searchr���)�rangers�hasattr�re�compilervrwrxryrzrSrtr�rRrgr{r}r~r�)rZ�listrNr��indicesr�r�r��m�er�Zreadyr[r[r\�expectJsB



z
Telnet.expectcCs|S�Nr[rdr[r[r\�	__enter__�szTelnet.__enter__cCs|��dSr�rb)rZ�type�value�	tracebackr[r[r\�__exit__�szTelnet.__exit__)N)N)"�__name__�
__module__�__qualname__�__doc__raZ_GLOBAL_DEFAULT_TIMEOUTr]rXrerirkrcrlrmrrr�r�r�r�r�r�r~r�r�rtr�r}r�r�r�r�r�r�r�r[r[r[r\r�s>5�


%

H

8c	Cs�d}tjdd�r2tjddkr2|d}tjd=qd}tjdd�rNtjd}d}tjdd�r�tjd}zt|�}Wn tk
r�t�|d�}YnXt��(}|�|�|j||dd	�|�	�W5QRXdS)
z�Test program for telnetlib.

    Usage: python telnetlib.py [-d] ... [host [port]]

    Default host is localhost; default port is 23.

    rrNz-dZ	localhostrZtcpg�?)rN)
r_�argv�int�
ValueErrorraZ
getservbynamerrkrXr�)rKrLrMZportstrZtnr[r[r\�test�s$



r��__main__)Zr�r_rary�timerrv�__all__rJr^�bytesrnr�r�r�r�r�r�ZNOPZDMZBRKZIPZAOZAYTZECZELZGAr�ZBINARYZECHOZRCPZSGAZNAMSZSTATUSZTMZRCTEZNAOLZNAOPZNAOCRDZNAOHTSZNAOHTDZNAOFFDZNAOVTSZNAOVTDZNAOLFDZXASCIIZLOGOUTZBMZDETZSUPDUPZSUPDUPOUTPUTZSNDLOCZTTYPEZEORZTUIDZOUTMRKZTTYLOCZVT3270REGIMEZX3PADZNAWSZTSPEEDZLFLOWZLINEMODEZXDISPLOCZOLD_ENVIRONZAUTHENTICATIONZENCRYPTZNEW_ENVIRONZTN3270EZXAUTH�CHARSETZRSPZCOM_PORT_OPTIONZSUPPRESS_LOCAL_ECHOZTLSZKERMITZSEND_URLZ	FORWARD_XZPRAGMA_LOGONZ
SSPI_LOGONZPRAGMA_HEARTBEATZEXOPLr�r�rHrwZSelectSelectorrr�r�r[r[r[r\�<module>s�#








































































_bootlocale.cpython-38.opt-1.pyc000064400000002303150335716500012420 0ustar00U

e5d	�@szdZddlZddlZej�d�r,ddd�ZnJz
ejWn4ek
rjeed�r\ddd�Zn
d
d	d�ZYnXdd
d�ZdS)z�A minimal subset of the locale module used at interpreter startup
(imported by the _io module), in order to reduce startup time.

Don't import directly from third-party code; use the `locale` module instead!
�N�winTcCstjjrdSt��dS)N�UTF-8�)�sys�flags�	utf8_mode�_localeZ_getdefaultlocale��do_setlocale�r�#/usr/lib64/python3.8/_bootlocale.py�getpreferredencodingsr
ZgetandroidapilevelcCsdS)Nrrr	rrrr
scCstjjrdSddl}|�|�S)Nrr)rrr�localer
)r
rrrrr
scCs.tjjrdSt�tj�}|s*tjdkr*d}|S)Nr�darwin)rrrr�nl_langinfo�CODESET�platform)r
�resultrrrr
!s)T)T)T)T)	�__doc__rrr�
startswithr
r�AttributeError�hasattrrrrr�<module>s

pickle.cpython-38.pyc000064400000133476150335716500010466 0ustar00U

e5d��	@shdZddlmZddlmZddlmZmZmZddlm	Z	ddl
mZddlZddlm
Z
dd	lmZmZddlZddlZddlZddlZd
ddd
dddddg	ZzddlmZe�d�dZWnek
r�dZYnXeefZdZddddddddgZdZ d Z!Gd!d
�d
e"�Z#Gd"d�de#�Z$Gd#d�de#�Z%Gd$d%�d%e"�Z&zdd&l'm(Z(Wnek
�rldZ(YnXd'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/d.Z0d/Z1d0Z2d1Z3d2Z4d3Z5d4Z6d5Z7d6Z8d7Z9d8Z:d9Z;d:Z<d;Z=d<Z>d=Z?d>Z@d?ZAd@ZBdAZCdBZDdCZEdDZFdEZGdFZHdGZIdHZJdIZKdJZLdKZMdLZNdMZOdNZPdOZQdPZRdQZSdRZTdSZUdTZVdUZWdVZXdWZYdXZZdYZ[dZZ\d[Z]d\Z^d]Z_eOeYeZe[gZ`d^Zad_Zbd`ZcdaZddbZedcZfddZgdeZhdfZidgZjdhZkdiZldjZmdkZndlZoe�pdmdn�eq�D��Gdodp�dp�ZrGdqdr�dr�Zsdsdt�Ztdudv�Zudwdx�Zvdydz�ZwGd{d|�d|�ZxGd}d~�d~�Zyd�ddd�d�d��Zzd�ddd�d�d��Z{dd�d�dd��d�d��Z|dd�d�dd��d�d��Z}z0dd�lm#Z#m$Z$m%Z%m~Z~mZm�Z�m�Z�m�Z�m�Z�Wn4ek
�r�exeyZ~Zeze{e|e}f\Z�Z�Z�Z�YnXd�d��Z�e�d�k�rdddl�Z�e�j�d�d��Z�e�j�d�e���d��d�d�d��e�j�d�d�d�d�d��e�j�d�d�d�d��e����Z�e�j��r*e��n:e�j��s<e����n(ddl�Z�e�j�D]Z�e�e��Z�e���e���qJdS)�a�Create portable serialized representations of Python objects.

See module copyreg for a mechanism for registering custom picklers.
See module pickletools source for extensive comments.

Classes:

    Pickler
    Unpickler

Functions:

    dump(object, file)
    dumps(object) -> string
    load(file) -> object
    loads(string) -> object

Misc variables:

    __version__
    format_version
    compatible_formats

�)�FunctionType)�dispatch_table)�_extension_registry�_inverted_registry�_extension_cache)�islice)�partialN)�maxsize)�pack�unpack�PickleError�
PicklingError�UnpicklingError�Pickler�	Unpickler�dump�dumps�load�loads)�PickleBufferrTFz4.0z1.0z1.1z1.2z1.3z2.0z3.0z5.0��c@seZdZdZdS)rz6A common base class for the other pickling exceptions.N��__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.8/pickle.pyrIsc@seZdZdZdS)r
z]This exception is raised when an unpicklable object is passed to the
    dump() method.

    Nrrrrrr
Msc@seZdZdZdS)raThis exception is raised when there is a problem unpickling an object,
    such as a security violation.

    Note that other exceptions may also be raised during unpickling, including
    (but not necessarily limited to) AttributeError, EOFError, ImportError,
    and IndexError.

    NrrrrrrTsc@seZdZdd�ZdS)�_StopcCs
||_dS�N)�value��selfr!rrr�__init__bsz_Stop.__init__N)rrrr$rrrrrasr)�PyStringMap�(�.�0�1�2�F�I�J�K�L�M�N�P�Q�R�S�T�U�V�X�a�b�c�d�}�e�g�h�i�j�l�]�o�p�q�r�s�t�)�u�GsI01
sI00
�������������������������B�C��������������������������cCsg|]}t�d|�r|�qS)z[A-Z][A-Z0-9_]+$)�re�match)�.0�xrrr�
<listcomp>�srnc@sFeZdZdZdZdd�Zdd�Zdd�Zdd
d�Zdd
�Z	dd�Z
dS)�_FramerricCs||_d|_dSr )�
file_write�
current_frame)r#rprrrr$�sz_Framer.__init__cCst��|_dSr )�io�BytesIOrq�r#rrr�
start_framing�sz_Framer.start_framingcCs*|jr&|j��dkr&|jdd�d|_dS)NrT��force)rq�tell�commit_framertrrr�end_framing�sz_Framer.end_framingFcCsf|jrb|j}|��|jks|rb|��}|j}t|�|jkrP|ttdt|���||�t	�
�|_dS)N�<Q)rqrx�_FRAME_SIZE_TARGET�	getbufferrp�len�_FRAME_SIZE_MIN�FRAMEr
rrrs)r#rw�f�data�writerrrry�sz_Framer.commit_framecCs |jr|j�|�S|�|�SdSr )rqr�rp�r#r�rrrr��sz
_Framer.writecCs,|j}|jr|jdd�||�||�dS)NTrv)rprqry)r#�headerZpayloadr�rrr�write_large_bytes�s
z_Framer.write_large_bytesN)F)rrrrr|r$rurzryr�r�rrrrro�s
roc@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�	_UnframerNcCs||_||_d|_dSr )�	file_read�
file_readlinerq)r#r�r�Z	file_tellrrrr$	sz_Unframer.__init__cCs�|jrb|j�|�}|dkrJt|�dkrJd|_t|�}|�|�|dd�<|S|t|�kr^td��|St|�}|�|�|dd�<|SdS�Nr�$pickle exhausted before end of frame)rq�readintor~r�r)r#�buf�nrrrr�s�z_Unframer.readintocCsT|jrF|j�|�}|s.|dkr.d|_|�|�St|�|krBtd��|S|�|�SdSr�)rq�readr�r~r�r#r�r�rrrr�s
�z_Unframer.readcCsF|jr:|j��}|s"d|_|��S|ddkr6td��|S|��SdS)N����
r�)rq�readliner�rr�rrrr�,s
�z_Unframer.readlinecCs2|jr|j��dkrtd��t�|�|��|_dS)N�z4beginning of a new frame before end of current frame)rqr�rrrrsr��r#Z
frame_sizerrr�
load_frame9s
�z_Unframer.load_frame)N)rrrr$r�r�r�r�rrrrr�s



r�c	Csj|�d�D]V}|dkr&td�||���z|}t||�}Wq
tk
r^td�||��d�Yq
Xq
||fS)N�.z<locals>z&Can't get local attribute {!r} on {!r}z Can't get attribute {!r} on {!r})�split�AttributeError�format�getattr)�obj�nameZsubpath�parentrrr�
_getattributeBs"���
r�c	Cs�t|dd�}|dk	r|Stj����D]X\}}|dks&|dks&|dkrHq&z t||�d|krf|WSWq&tk
r|Yq&Xq&dS)z$Find the module an object belong to.rN�__main__Z__mp_main__r)r��sys�modules�copy�itemsr�r�)r�r��module_name�modulerrr�whichmoduleOs ��r�cCsh|dkrdS|��d?d}|j|ddd�}|dkrd|dkrd|dd	krd|d
d@dkrd|dd�}|S)
a�Encode a long to a two's complement little-endian binary string.
    Note that 0 is a special case, returning an empty string, to save a
    byte in the LONG1 pickling context.

    >>> encode_long(0)
    b''
    >>> encode_long(255)
    b'\xff\x00'
    >>> encode_long(32767)
    b'\xff\x7f'
    >>> encode_long(-256)
    b'\x00\xff'
    >>> encode_long(-32768)
    b'\x00\x80'
    >>> encode_long(-128)
    b'\x80'
    >>> encode_long(127)
    b'\x7f'
    >>>
    rr����littleT��	byteorderZsignedr������N)�
bit_length�to_bytes)rm�nbytes�resultrrr�encode_longbsr�cCstj|ddd�S)a\Decode a long from a two's complement little-endian binary string.

    >>> decode_long(b'')
    0
    >>> decode_long(b"\xff\x00")
    255
    >>> decode_long(b"\xff\x7f")
    32767
    >>> decode_long(b"\x00\xff")
    -256
    >>> decode_long(b"\x00\x80")
    -32768
    >>> decode_long(b"\x80")
    -128
    >>> decode_long(b"\x7f")
    127
    r�Tr�)�int�
from_bytes)r�rrr�decode_long�sr�c@s�eZdZd;ddd�dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Zd<dd�Z	dd�Z
dd�Zd=dd�ZiZ
dd�Zee
ed�<dd�Zee
e<dd�Zee
e<dd�Zee
e<d d!�Zee
e<d"d#�Zee
e<er�d$d%�Zee
e<d&d'�Zee
e<d(d)�Zee
e <d*d+�Z!e!e
e"<d,Z#d-d.�Z$d/d0�Z%e%e
e&<e'dk	�r@e%e
e'<d1d2�Z(d3d4�Z)e)e
e*<d5d6�Z+e+e
e,<d>d7d8�Z-d9d:�Z.e-e
e/<e.e
e<dS)?�_PicklerNT��fix_imports�buffer_callbackcCs�|dkrt}|dkrt}n"d|kr.tks<ntdt��|dk	rT|dkrTtd��||_z|j|_Wntk
r�td��YnXt|j�|_	|j	j|_|j	j
|_i|_t
|�|_|dk|_d|_|o�|dk|_dS)	a!This takes a binary file for writing a pickle data stream.

        The optional *protocol* argument tells the pickler to use the
        given protocol; supported protocols are 0, 1, 2, 3, 4 and 5.
        The default protocol is 4. It was introduced in Python 3.4, and
        is incompatible with previous versions.

        Specifying a negative protocol version selects the highest
        protocol version supported.  The higher the protocol used, the
        more recent the version of Python needed to read the pickle
        produced.

        The *file* argument must have a write() method that accepts a
        single bytes argument. It can thus be a file object opened for
        binary writing, an io.BytesIO instance, or any other custom
        object that meets this interface.

        If *fix_imports* is True and *protocol* is less than 3, pickle
        will try to map the new Python 3 names to the old module names
        used in Python 2, so that the pickle data stream is readable
        with Python 2.

        If *buffer_callback* is None (the default), buffer views are
        serialized into *file* as part of the pickle stream.

        If *buffer_callback* is not None, then it can be called any number
        of times with a buffer view.  If the callback returns a false value
        (such as None), the given buffer is out-of-band; otherwise the
        buffer is serialized in-band, i.e. inside the pickle stream.

        It is an error if *buffer_callback* is not None and *protocol*
        is None or smaller than 5.
        Nrzpickle protocol must be <= %drz#buffer_callback needs protocol >= 5z"file must have a 'write' attributer�r�)�DEFAULT_PROTOCOL�HIGHEST_PROTOCOL�
ValueError�_buffer_callbackr��_file_writer��	TypeErrorro�framerr��_write_large_bytes�memor��proto�bin�fastr�)r#�file�protocolr�r�rrrr$�s*#



z_Pickler.__init__cCs|j��dS)aClears the pickler's "memo".

        The memo is the data structure that remembers which objects the
        pickler has already seen, so that shared or recursive objects
        are pickled by reference and not by value.  This method is
        useful when re-using picklers.
        N)r��clearrtrrr�
clear_memo�sz_Pickler.clear_memocCsrt|d�std|jjf��|jdkr<|�ttd|j��|jdkrP|j�	�|�
|�|�t�|j��dS)z7Write a pickled representation of obj to the open file.r�z2Pickler.__init__() was not called by %s.__init__()��<BrN)
�hasattrr
�	__class__rr�r��PROTOr
r�ru�save�STOPrz�r#r�rrrr�s
�




z
_Pickler.dumpcCsL|jr
dSt|�|jkst�t|j�}|�|�|��||f|jt|�<dS)zStore an object in the memo.N)r��idr��AssertionErrorr~r��put)r#r��idxrrr�memoize�s
z_Pickler.memoizecCsT|jdkrtS|jr:|dkr*ttd|�Sttd|�Sntt|��d�dSdS)Nr�r��<I�ascii�
)	r��MEMOIZEr��BINPUTr
�LONG_BINPUT�PUT�repr�encode)r#r�rrrr�s
z_Pickler.putcCs@|jr*|dkrttd|�Sttd|�Stt|��d�dS)Nr�r�r�r�r�)r��BINGETr
�LONG_BINGET�GETr�r��r#�irrr�gets
z_Pickler.getc
Cs�|j��|�|�}|dk	r.|r.|�|�dS|j�t|��}|dk	r^|�|�|d��dSt}t	|dd�}|dk	r~||�}|tk�r@t
|�}|j�|�}|dk	r�|||�dSt	|dt��|�}|dk	r�||�}njt
|t
�r�|�|�dSt	|dd�}|dk	�r||j�}n0t	|dd�}|dk	�r.|�}ntd|j|f��t|t��r\|�||�dSt|t��sttd|��t|�}	d|	k�r�d	k�s�ntd
|��|j|d|i�dS)NrZreducer_overrider�
__reduce_ex__�
__reduce__zCan't pickle %r object: %rz%s must return string or tupler��z2Tuple returned by %s must have two to six elementsr�)r�ry�
persistent_id�	save_persr�r�r�r��NotImplementedr��type�dispatchr�
issubclass�save_globalr�r
r�
isinstance�str�tupler~�save_reduce)
r#r��save_persistent_id�pidrm�rv�reduce�tr��lrrrr�sZ









��z
_Pickler.savecCsdSr rr�rrrr�]sz_Pickler.persistent_idcCsb|jr |j|dd�|�t�n>z |�tt|��d�d�Wntk
r\td��YnXdS)NF)r�r�r��2persistent IDs in protocol 0 must be ASCII strings)	r�r�r��	BINPERSID�PERSIDr�r��UnicodeEncodeErrorr
�r#r�rrrr�as �z_Pickler.save_persc
Cs>t|t�std��t|�s"td��|j}|j}	t|dd�}
|jdkr�|
dkr�|\}}}t|d�sntd�	|
���|dk	r�||j
k	r�td	�	|
���|jd
kr�||�||�||�|	t�n,t|j
|f|�|�}||�|d�|	t�n�|jdk�r^|
dk�r^|d
}t|d��std��|dk	�r8||j
k	�r8td��|dd�}||�||�|	t�n||�||�|	t�|dk	�r�t|�|jk�r�|	t|�|jt|�d
��n
|�|�|dk	�r�|�|�|dk	�r�|�|�|dk	�r:|dk�r
||�|	t�n0||�||�||�|	t�|	t�|	t�dS)Nz'args from save_reduce() must be a tuplez(func from save_reduce() must be callabler�r��
__newobj_ex__�__new__z#args[0] from {} args has no __new__z(args[0] from {} args has the wrong classrr�
__newobj__rz+args[0] from __newobj__ args has no __new__z0args[0] from __newobj__ args has the wrong classr�)r�r�r
�callabler�r�r�r�r�r�r��	NEWOBJ_EXrr�REDUCE�NEWOBJr�r��POPr�r��_batch_appends�_batch_setitems�BUILD�TUPLE2)
r#�func�args�stateZ	listitemsZ	dictitemsZstate_setterr�r�r�Z	func_name�cls�kwargsrrrr�msz


��


��

"







z_Pickler.save_reducecCs|�t�dSr )r��NONEr�rrr�	save_none�sz_Pickler.save_nonecCs4|jdkr|�|rtnt�n|�|r*tnt�dS)Nr�)r�r��NEWTRUE�NEWFALSE�TRUE�FALSEr�rrr�	save_bool�s
z_Pickler.save_boolcCs.|jr~|dkrN|dkr.|�ttd|��dS|dkrN|�ttd|��dSd|krbdkr~nn|�ttd|��dS|jd	kr�t|�}t|�}|d
kr�|�t	td|�|�n|�t
td|�|�dSd|kr�dk�rnn|�tt|��
d�d�n|�tt|��
d�d
�dS)Nrr�r���<Hi�i����<ir�r�r�r�sL
)r�r��BININT1r
�BININT2�BININTr�r�r~�LONG1�LONG4�INTr�r��LONG�r#r�Zencodedr�rrr�	save_long�s*
z_Pickler.save_longcCs<|jr|�ttd|��n|�tt|��d�d�dS)N�>dr�r�)r�r��BINFLOATr
�FLOATr�r�r�rrr�
save_floatsz_Pickler.save_floatcCs�|jdkr@|s |jtd|d�n|jtjt|d�df|d�dSt|�}|dkrj|�tt	d|�|�nf|dkr�|jdkr�|�
tt	d	|�|�n<||jj
kr�|�
tt	d
|�|�n|�tt	d
|�|�|�|�dS)Nr�r�r��latin1r�r����rr{r�)r�r��bytes�codecsr�r�r~r��SHORT_BINBYTESr
r��	BINBYTES8r�r|�BINBYTESr��r#r�r�rrr�
save_bytess"
�z_Pickler.save_bytescCs�|jdkr:|s |jtd|d�n|jtt|�f|d�dSt|�}||jjkrf|�tt	d|�|�n|�
tt	d|�|�dS)Nrrr+r{)r�r��	bytearrayr.r~r�r|r��
BYTEARRAY8r
r�r3rrr�save_bytearray)s
z_Pickler.save_bytearrayc	Cs�|jdkrtd��|���t}|js*td��d}|jdk	rFt|�|��}|rp|jr`|�|���q�|�	|���n|�
t�|jr�|�
t�W5QRXdS)Nrz0PickleBuffer can only pickled with protocol >= 5zHPickleBuffer can not be pickled when pointing to a non-contiguous bufferT)
r�r
�raw�
contiguousr��bool�readonlyr4�tobytesr7r��NEXT_BUFFER�READONLY_BUFFER)r#r��mZin_bandrrr�save_picklebuffer8s



z_Pickler.save_picklebuffercCs|jr�|�dd�}t|�}|dkrF|jdkrF|�ttd|�|�nf|dkrp|jdkrp|�ttd|�|�n<||j	j
kr�|�ttd|�|�n|�ttd|�|�nT|�d	d
�}|�dd�}|�d
d�}|�dd�}|�dd�}|�t
|�d�d�|�|�dS)N�utf-8�
surrogatepassr�rr�r-r{r��\z\u005c�z\u0000�
z\u000a�
z\u000d�z\u001a�raw-unicode-escaper�)r�r�r~r�r��SHORT_BINUNICODEr
r��BINUNICODE8r�r|�
BINUNICODE�replace�UNICODEr�r%rrr�save_strRs&�z_Pickler.save_strcCs:|s(|jr|�t�n|�tt�dSt|�}|j}|j}|dkr�|jdkr�|D]}||�qRt	|�|kr�|�
|t	|�d�}|�t||�n|�t|�|�
|�dS|j}|t�|D]}||�q�t	|�|k�r$|�
|t	|�d�}|j�r|t|�n|t|d|�dS|t�|�
|�dS)Nr�r�rr�)r�r��EMPTY_TUPLE�MARK�TUPLEr~r�r�r�r�r�r
�_tuplesize2coder��POP_MARK)r#r�r�r�r�Zelementr�r�rrr�
save_tupleis:


z_Pickler.save_tuplecCs8|jr|�t�n|�tt�|�|�|�|�dSr )r�r��
EMPTY_LISTrP�LISTr�rr�rrr�	save_list�s

z_Pickler.save_listi�cCs�|j}|j}|js0|D]}||�|t�qdSt|�}tt||j��}t|�}|dkr||t	�|D]}||�qd|t
�n|r�||d�|t�||jkr8dSq8dS�Nr�r)r�r�r��APPEND�iter�listr�
_BATCHSIZEr~rP�APPENDS)r#r�r�r�rm�it�tmpr�rrrr�s(



z_Pickler._batch_appendscCs<|jr|�t�n|�tt�|�|�|�|���dSr )r�r��
EMPTY_DICTrP�DICTr�rr�r�rrr�	save_dict�s

z_Pickler.save_dictc	Cs�|j}|j}|js<|D] \}}||�||�|t�qdSt|�}tt||j��}t|�}|dkr�|t	�|D]\}}||�||�qp|t
�n(|r�|d\}}||�||�|t�||jkrDdSqDdSrX)r�r�r��SETITEMrZr[rr\r~rP�SETITEMS)	r#r�r�r��k�vr^r_r�rrrr�s0



z_Pickler._batch_setitemscCs�|j}|j}|jdkr0|jtt|�f|d�dS|t�|�|�t|�}tt	||j
��}t|�}|dkr�|t�|D]}||�qv|t
�||j
krJdSqJdS�Nrr+r)r�r�r�r��setr[�	EMPTY_SETr�rZrr\r~rP�ADDITEMS)r#r�r�r�r^Zbatchr��itemrrr�save_set�s"



z_Pickler.save_setcCs�|j}|j}|jdkr0|jtt|�f|d�dS|t�|D]}||�q<t|�|jkr||t	|�
|jt|�d��dS|t�|�|�dSrg)
r�r�r�r��	frozensetr[rPr�r�rSr��	FROZENSETr�)r#r�r�r�rkrrr�save_frozensets

 z_Pickler.save_frozensetc

Csd|j}|j}|dkr t|dd�}|dkr.|j}t||�}z(t|dd�tj|}t||�\}}Wn.t	t
tfk
r�td|||f�d�YnX||k	r�td|||f��|j
dk�r&t�||f�}	|	�r&|	dks�t�|	dkr�|ttd|	��n0|	d	k�r|ttd
|	��n|ttd|	��dS|�d�d}
||k�rB|
}|j
d
k�rl|�|�|�|�|t�n�||k	�r�|�t||
f�n�|j
dk�r�|tt|d�dt|d�d�n�|j�rtj}tj}||f|k�r�|||f\}}n||k�r||}z(|tt|d�dt|d�d�Wn,tk
�rTtd|||j
f�d�YnX|� |�dS)Nrr��levelz(Can't pickle %r: it's not found as %s.%sz2Can't pickle %r: it's not the same object as %s.%sr�r�r�rrrr�rr�rAr�r�z?can't pickle global identifier '%s.%s' using pickle protocol %i)!r�r�r�rr��
__import__r�r�r��ImportError�KeyErrorr�r
r�rr�r��EXT1r
�EXT2�EXT4�
rpartitionr��STACK_GLOBALr��GLOBALr.r��_compat_pickleZREVERSE_NAME_MAPPINGZREVERSE_IMPORT_MAPPINGrr�)
r#r�r�r�r�r�r�Zobj2r��codeZlastnameZr_name_mappingZr_import_mappingrrrr�s�

�����





��
��

���z_Pickler.save_globalcCs`|td�kr|jtd|d�S|tt�kr:|jttf|d�S|td�krV|jtd|d�S|�|�S)Nr r+.).)r�r�r�r�r�rrr�	save_typeasz_Pickler.save_type)N)T)NNNNN)N)0rrrr$r�rr�r�r�r�r�r�r�r�rr�rr:r&r�r*�floatr4r.r7r5�_HAVE_PICKLE_BUFFERr@rrNr�rTr�rWr[r\rrb�dictr%rrlrhrormr�r}rrrrrr��sj�9
	
F�
u1		

B	r�c@s�eZdZddddd�dd�Zdd	�Zd
d�Zdd
�ZiZdd�Zeee	d<dd�Z
e
eed<dd�Zeee
d<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd�Zeeed<dd �Zeeed<d!d"�Zeeed<d#d$�Zeeed<d%d&�Zeeed<d'd(�Z e ee!d<d)d*�Z"e"ee#d<d+d,�Z$e$ee%d<d-d.�Z&e&ee'd<d/d0�Z(d1d2�Z)e)ee*d<d3d4�Z+e+ee,d<d5d6�Z-e-ee.d<d7d8�Z/e/ee0d<d9d:�Z1e1ee2d<d;d<�Z3e3ee4d<d=d>�Z5e5ee6d<d?d@�Z7e7ee8d<dAdB�Z9e9ee:d<dCdD�Z;e;ee<d<dEdF�Z=e=ee>d<dGdH�Z?e?ee@d<dIdJ�ZAeAeeBd<dKdL�ZCeCeeDd<dMdN�ZEeEeeFd<dOdP�ZGeGeeHd<dQdR�ZIeIeeJd<dSdT�ZKeKeeLd<dUdV�ZMeMeeNd<dWdX�ZOeOeePd<dYdZ�ZQeQeeRd<d[d\�ZSeSeeTd<d]d^�ZUeUeeVd<d_d`�ZWeWeeXd<dadb�ZYdcdd�ZZeZee[d<dedf�Z\e\ee]d<dgdh�Z^e^ee_d<didj�Z`e`eead<dkdl�Zbebeecd<dmdn�Zdedeeed<dodp�Zfefeegd<dqdr�Zheheeid<dsdt�Zjejeekd<dudv�Zldwdx�Zmdydz�Zneneeod<d{d|�Zpepeeqd<d}d~�Zrereesd<dd��Zteteeud<d�d��Zveveewd<d�d��Zxexeeyd<d�d��Zzezee{d<d�d��Z|e|ee}d<d�d��Z~e~eed<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<d�d��Z�e�ee�d<dS)��
_UnpicklerT�ASCII�strictN�r��encoding�errors�bufferscCsH|dk	rt|�nd|_|j|_|j|_i|_||_||_d|_	||_
dS)a�This takes a binary file for reading a pickle data stream.

        The protocol version of the pickle is detected automatically, so
        no proto argument is needed.

        The argument *file* must have two methods, a read() method that
        takes an integer argument, and a readline() method that requires
        no arguments.  Both methods should return bytes.  Thus *file*
        can be a binary file object opened for reading, an io.BytesIO
        object, or any other custom object that meets this interface.

        The file-like object must have two methods, a read() method
        that takes an integer argument, and a readline() method that
        requires no arguments.  Both methods should return bytes.
        Thus file-like object can be a binary file object opened for
        reading, a BytesIO object, or any other custom object that
        meets this interface.

        If *buffers* is not None, it should be an iterable of buffer-enabled
        objects that is consumed each time the pickle stream references
        an out-of-band buffer view.  Such buffers have been given in order
        to the *buffer_callback* of a Pickler object.

        If *buffers* is None (the default), then the buffers are taken
        from the pickle stream, assuming they are serialized there.
        It is an error for *buffers* to be None if the pickle stream
        was produced with a non-None *buffer_callback*.

        Other optional arguments are *fix_imports*, *encoding* and
        *errors*, which are used to control compatibility support for
        pickle stream generated by Python 2.  If *fix_imports* is True,
        pickle will try to map the old Python 2 names to the new names
        used in Python 3.  The *encoding* and *errors* tell pickle how
        to decode 8-bit string instances pickled by Python 2; these
        default to 'ASCII' and 'strict', respectively. *encoding* can be
        'bytes' to read theses 8-bit string instances as bytes objects.
        Nr)rZ�_buffersr��_file_readliner��
_file_readr�r�r�r�r�)r#r�r�r�r�r�rrrr$rs'z_Unpickler.__init__c
Cs�t|d�std|jjf��t|j|j�|_|jj|_|jj	|_	|jj
|_
g|_g|_|jj
|_
d|_|j}|j}z4|d�}|s�t�t|t�s�t�||d|�qtWn,tk
r�}z|jWY�Sd}~XYnXdS)z�Read a pickled object representation from the open file.

        Return the reconstituted object hierarchy specified in the file.
        r�z4Unpickler.__init__() was not called by %s.__init__()rr�N)r�rr�rr�r�r��	_unframerr�r�r��	metastack�stack�appendr�r��EOFErrorr��bytes_typesr�rr!)r#r�r��keyZstopinstrrrr�s,
�



z_Unpickler.loadcCs |j}|j��|_|jj|_|Sr )r�r��popr��r#r�rrr�pop_mark�s
z_Unpickler.pop_markcCstd��dS)Nz%unsupported persistent id encountered)rrrrr�persistent_load�sz_Unpickler.persistent_loadcCs:|�d�d}d|kr"tks0ntd|��||_dS)Nr�rzunsupported pickle protocol: %d)r�r�r�r�)r#r�rrr�
load_proto�sz_Unpickler.load_protorcCs8td|�d��\}|tjkr(td|��|j�|�dS)Nr{�zframe size > sys.maxsize: %d)rr�r�r	r�r�r�r�rrrr��s
z_Unpickler.load_framecCsLz|��dd��d�}Wntk
r6td��YnX|�|�|��dS)Nr�r�r�)r��decode�UnicodeDecodeErrorrr�r�rrrr�load_persid�s�
z_Unpickler.load_persidcCs|j��}|�|�|��dSr )r�r�r�r�rrrr�load_binpersid�s
z_Unpickler.load_binpersidcCs|�d�dSr �r�rtrrr�	load_none�sz_Unpickler.load_nonecCs|�d�dS)NFr�rtrrr�
load_false�sz_Unpickler.load_falsecCs|�d�dS)NTr�rtrrr�	load_true�sz_Unpickler.load_truecCsL|��}|tdd�krd}n |tdd�kr4d}n
t|d�}|�|�dS)Nr�FTr)r�rrr�r�)r#r��valrrr�load_int�s
z_Unpickler.load_intcCs|�td|�d��d�dS)Nrrr�r�rr�rtrrr�load_binint�sz_Unpickler.load_binintcCs|�|�d�d�dSrX)r�r�rtrrr�load_binint1sz_Unpickler.load_binint1cCs|�td|�d��d�dS)Nrr�rr�rtrrr�load_binint2sz_Unpickler.load_binint2cCs@|��dd�}|r,|ddkr,|dd�}|�t|d��dS)Nr��Lr)r�r�r�)r#r�rrr�	load_longsz_Unpickler.load_longcCs*|�d�d}|�|�}|�t|��dSrX)r�r�r�r�rrr�
load_long1s
z_Unpickler.load_long1cCs>td|�d��\}|dkr"td��|�|�}|�t|��dS)Nrrrz#LONG pickle has negative byte count)rr�rr�r�r�rrr�
load_long4s

z_Unpickler.load_long4cCs|�t|��dd���dS�Nr�)r�r~r�rtrrr�
load_float!sz_Unpickler.load_floatcCs|�td|�d��d�dS)Nr'r�rr�rtrrr�
load_binfloat%sz_Unpickler.load_binfloatcCs"|jdkr|S|�|j|j�SdS)Nr.)r�r�r�r"rrr�_decode_string)s
z_Unpickler._decode_stringcCsl|��dd�}t|�dkrF|d|dkrF|ddkrF|dd�}ntd��|�|�t�|�d��dS)Nr�r�rs"'r�z)the STRING opcode argument must be quoted)r�r~rr�r�r/�
escape_decoder�rrr�load_string2s
(z_Unpickler.load_stringcCs@td|�d��\}|dkr"td��|�|�}|�|�|��dS)Nrrrz(BINSTRING pickle has negative byte count)rr�rr�r��r#r~r�rrr�load_binstring<s

z_Unpickler.load_binstringcCs:td|�d��\}|tkr&tdt��|�|�|��dS)Nr�rz2BINBYTES exceeds system's maximum size of %d bytes�rr�r	rr��r#r~rrr�
load_binbytesEs�z_Unpickler.load_binbytescCs |�t|��dd�d��dS)Nr�rH)r�r�r�rtrrr�load_unicodeMsz_Unpickler.load_unicodecCsBtd|�d��\}|tkr&tdt��|�t|�|�dd��dS)Nr�rz4BINUNICODE exceeds system's maximum size of %d bytesrArB�rr�r	rr�r�r�rrr�load_binunicodeQs�z_Unpickler.load_binunicodecCsBtd|�d��\}|tkr&tdt��|�t|�|�dd��dS)Nr{r�z5BINUNICODE8 exceeds system's maximum size of %d bytesrArBr�r�rrr�load_binunicode8Ys�z_Unpickler.load_binunicode8cCs:td|�d��\}|tkr&tdt��|�|�|��dS)Nr{r�z3BINBYTES8 exceeds system's maximum size of %d bytesr�r�rrr�load_binbytes8as�z_Unpickler.load_binbytes8cCsFtd|�d��\}|tkr&tdt��t|�}|�|�|�|�dS)Nr{r�z4BYTEARRAY8 exceeds system's maximum size of %d bytes)rr�r	rr5r�r�)r#r~�brrr�load_bytearray8is�
z_Unpickler.load_bytearray8cCsL|jdkrtd��zt|j�}Wntk
r<td��YnX|�|�dS)NzLpickle stream refers to out-of-band data but no *buffers* argument was givenznot enough out-of-band buffers)r�r�next�
StopIterationr�)r#r�rrr�load_next_bufferss
z_Unpickler.load_next_bufferc	Cs6|jd}t|��}|js(|��|jd<W5QRXdSr�)r��
memoryviewr;�
toreadonly)r#r�r?rrr�load_readonly_buffer~s

z_Unpickler.load_readonly_buffercCs,|�d�d}|�|�}|�|�|��dSrX)r�r�r�r�rrr�load_short_binstring�s
z_Unpickler.load_short_binstringcCs"|�d�d}|�|�|��dSrX)r�r�r�rrr�load_short_binbytes�sz_Unpickler.load_short_binbytescCs*|�d�d}|�t|�|�dd��dS)Nr�rrArB)r�r�r�r�rrr�load_short_binunicode�sz _Unpickler.load_short_binunicodecCs|��}|�t|��dSr )r�r�r�r�rrr�
load_tuple�sz_Unpickler.load_tuplecCs|�d�dS)Nrr�rtrrr�load_empty_tuple�sz_Unpickler.load_empty_tuplecCs|jdf|jd<dSr��r�rtrrr�load_tuple1�sz_Unpickler.load_tuple1cCs$|jd|jdfg|jdd�<dS)Nr�r�r�rtrrr�load_tuple2�sz_Unpickler.load_tuple2cCs,|jd|jd|jdfg|jdd�<dS)N���r�r�r�rtrrr�load_tuple3�sz_Unpickler.load_tuple3cCs|�g�dSr r�rtrrr�load_empty_list�sz_Unpickler.load_empty_listcCs|�i�dSr r�rtrrr�load_empty_dictionary�sz _Unpickler.load_empty_dictionarycCs|�t��dSr )r�rhrtrrr�load_empty_set�sz_Unpickler.load_empty_setcCs|��}|�t|��dSr )r�r�rmr�rrr�load_frozenset�sz_Unpickler.load_frozensetcCs|��}|�|�dSr )r�r�r�rrr�	load_list�sz_Unpickler.load_listcs4|����fdd�tdt��d�D�}|�|�dS)Ncsi|]}�|�|d�qS)r�r)rlr��r�rr�
<dictcomp>�s�z(_Unpickler.load_dict.<locals>.<dictcomp>rr�)r��ranger~r�)r#�drr�r�	load_dict�s

�z_Unpickler.load_dictc
Cs�|st|t�rt|d�rjz||�}Wqttk
rf}z$td|jt|�ft��d��W5d}~XYqtXn
|�|�}|�	|�dS)NZ__getinitargs__zin constructor for %s: %sr�)
r�r�r�r�rr�r��exc_inforr�)r#�klassrr!�errrrr�_instantiate�s��
�
z_Unpickler._instantiatecCsL|��dd��d�}|��dd��d�}|�||�}|�||���dS)Nr�r�)r�r��
find_classr�r��r#r�r�r�rrr�	load_inst�sz_Unpickler.load_instcCs"|��}|�d�}|�||�dS�Nr)r�r�r�)r#rrrrr�load_obj�s
z_Unpickler.load_objcCs2|j��}|j��}|j|f|��}|�|�dSr �r�r�rr�)r#rrr�rrr�load_newobj�s

z_Unpickler.load_newobjcCs>|j��}|j��}|j��}|j|f|�|�}|�|�dSr r�)r#rrrr�rrr�load_newobj_ex�s



z_Unpickler.load_newobj_excCsF|��dd��d�}|��dd��d�}|�||�}|�|�dS)Nr�rA)r�r�r�r�r�rrr�load_global�sz_Unpickler.load_globalcCsJ|j��}|j��}t|�tk	s,t|�tk	r4td��|�|�||��dS)NzSTACK_GLOBAL requires str)r�r�r�r�rr�r�)r#r�r�rrr�load_stack_global�s


z_Unpickler.load_stack_globalcCs|�d�d}|�|�dSrX)r��
get_extension�r#r|rrr�	load_ext1sz_Unpickler.load_ext1cCs td|�d��\}|�|�dS)Nrr��rr�r�r�rrr�	load_ext2	sz_Unpickler.load_ext2cCs td|�d��\}|�|�dS)Nrrr�r�rrr�	load_ext4sz_Unpickler.load_ext4cCspg}t�||�}||k	r&|�|�dSt�|�}|sP|dkrDtd��td|��|j|�}|t|<|�|�dS)NrzEXT specifies code <= 0zunregistered extension code %d)rr�r�rrr�r�)r#r|Znilr�r�rrrr�s


z_Unpickler.get_extensioncCs�t�d||�|jdkrT|jrT||ftjkr@tj||f\}}n|tjkrTtj|}t|dd�|jdkr~ttj	||�dSt
tj	||�SdS)Nzpickle.find_classr�rrpr)r��auditr�r�r{ZNAME_MAPPINGZIMPORT_MAPPINGrrr�r�r�)r#r�r�rrrr�#s


z_Unpickler.find_classcCs&|j}|��}|d}||�|d<dSr��r�r�)r#r�rrrrr�load_reduce1sz_Unpickler.load_reducecCs|jr|jd=n|��dSr�)r�r�rtrrr�load_pop8s
z_Unpickler.load_popcCs|��dSr )r�rtrrr�
load_pop_mark?sz_Unpickler.load_pop_markcCs|�|jd�dSr�)r�r�rtrrr�load_dupCsz_Unpickler.load_dupcCs(t|��dd��}|�|j|�dSr�)r�r�r�r�r�rrr�load_getGsz_Unpickler.load_getcCs"|�d�d}|�|j|�dSrX)r�r�r�r�rrr�load_bingetLsz_Unpickler.load_bingetcCs&td|�d��\}|�|j|�dS)Nr�r)rr�r�r�r�rrr�load_long_bingetQsz_Unpickler.load_long_bingetcCs8t|��dd��}|dkr$td��|jd|j|<dS)Nr�rznegative PUT argument)r�r�r�r�r�r�rrr�load_putVsz_Unpickler.load_putcCs2|�d�d}|dkrtd��|jd|j|<dS)Nr�rznegative BINPUT argumentr�)r�r�r�r�r�rrr�load_binput]sz_Unpickler.load_binputcCs6td|�d��\}|tkr"td��|jd|j|<dS)Nr�rznegative LONG_BINPUT argumentr�)rr�r	r�r�r�r�rrr�load_long_binputdsz_Unpickler.load_long_binputcCs|j}|jd|t|�<dSr�)r�r�r~)r#r�rrr�load_memoizeksz_Unpickler.load_memoizecCs$|j}|��}|d}|�|�dSr�)r�r�r�)r#r�r!r[rrr�load_appendpsz_Unpickler.load_appendcCsZ|��}|jd}z
|j}Wntk
r0YnX||�dS|j}|D]}||�qHdSr�)r�r��extendr�r�)r#r�Zlist_objr�r�rkrrr�load_appendsws

z_Unpickler.load_appendscCs*|j}|��}|��}|d}|||<dSr�r�)r#r�r!r�r�rrr�load_setitem�s
z_Unpickler.load_setitemcCs@|��}|jd}tdt|�d�D]}||d|||<q"dS)Nr�rr�r�)r�r�r�r~)r#r�r�r�rrr�
load_setitems�s
z_Unpickler.load_setitemscCsD|��}|jd}t|t�r(|�|�n|j}|D]}||�q2dSr�)r�r�r�rh�update�add)r#r�Zset_objr�rkrrr�
load_additems�s

z_Unpickler.load_additemsc
Cs�|j}|��}|d}t|dd�}|dk	r6||�dSd}t|t�rXt|�dkrX|\}}|r�|j}tj}|�	�D]*\}}	t
|�tkr�|	|||�<qp|	||<qp|r�|�	�D]\}}	t|||	�q�dS)Nr��__setstate__r�)
r�r�r�r�r�r~�__dict__r��internr�r�r��setattr)
r#r�r�inst�setstateZ	slotstateZ	inst_dictrrerfrrr�
load_build�s(
z_Unpickler.load_buildcCs"|j�|j�g|_|jj|_dSr )r�r�r�rtrrr�	load_mark�sz_Unpickler.load_markcCs|j��}t|��dSr )r�r�rr"rrr�	load_stop�s
z_Unpickler.load_stop)�rrrr$rr�r�r�r�r�r�r�r�r�r�r�r�rr�rr�rr�r#r�r r�rr�rr�r$r�r!r�r"r�r)r�r(r�r��STRINGr��	BINSTRINGr�r2r�rMr�rKr�rJr�r1r�r6r�r=r�r>r��SHORT_BINSTRINGr�r0r�rIr�rQr�rOr��TUPLE1r�rr��TUPLE3r�rUr�r`r�rir�rnr�rVr�rar�r��INSTr��OBJr�r	r�rr�rzr�ryr�rur�rvr�rwr�r�r�rr�r
r�rSr��DUPr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rYr�r]r�rcr�rdr�rjrr
rrPrr�rrrrr�ps*�0				r�r�cCst||||d��|�dS�Nr�)r�r)r�r�r�r�r�rrr�_dump�s
��rcCs8t��}t||||d��|�|��}t|t�s4t�|Sr)rrrsr�r�getvaluer�r�r�)r�r�r�r�r��resrrr�_dumps�s��rr�r�r�cCst|||||d���S)N�r�r�r�r�)r�r)r�r�r�r�r�rrr�_load�s�rcCs2t|t�rtd��t�|�}t|||||d���S)Nz%Can't load pickle from unicode stringr)r�r�r�rrrsr�r)�sr�r�r�r�r�rrr�_loads�s

�r)	rr
rrrrrrrcCsddl}|��Sr�)�doctestZtestmod)rrrr�_test�srr�z$display contents of the pickle files)Zdescription�pickle_file�br�*zthe pickle file)r��nargs�helpz-tz--test�
store_truezrun self-test suite)�actionrz-vz)run verbosely; only affects self-test run)N)N)�r�typesr�copyregrrrr�	itertoolsr�	functoolsrr�r	Zstructr
rrjrrr/r{�__all__�_picklerr�rrsr.r5r�Zformat_versionZcompatible_formatsr�r��	Exceptionrr
rrZorg.python.corer%rPr�r
rSrr)r#r rr$rrr�r�rrr	r
rMrKrYr
rzrar`r]r�r�r
r�rVrUrr�r�r�rcrQrOrdr(rrr�r	rurvrwrrrrrr!r"rRr2r0rIrJr1rirjrnrryr�r�r6r=r>r��dirror�r�r�r�r�r�r�rrrrrrrrrrrr�argparse�ArgumentParser�parser�add_argumentZFileType�
parse_argsrZtestrZ
print_helpZpprintr�r�rrrr�<module>sh�

�

?;
^]��	0

����

contextlib.cpython-38.pyc000064400000047407150335716500011370 0ustar00U

e5d�a�@sjdZddlZddlZddlZddlmZddlmZddlm	Z	dddd	d
ddd
ddddgZ
Gdd
�d
ej�ZGdd�dej�Z
Gdd
�d
e�ZGdd�d�ZGdd�deee�ZGdd�dee
�Zdd�Zdd�ZGdd�de�ZGdd�de�ZGd d�de�ZGd!d�de�ZGd"d�de�ZGd#d$�d$�ZGd%d�dee�ZGd&d�dee
�ZGd'd	�d	e�ZdS)(z4Utilities for with-statement contexts.  See PEP 343.�N)�deque��wraps��
MethodType�asynccontextmanager�contextmanager�closing�nullcontext�AbstractContextManager�AbstractAsyncContextManager�AsyncExitStack�ContextDecorator�	ExitStack�redirect_stdout�redirect_stderr�suppressc@s2eZdZdZdd�Zejdd��Zedd��Z	dS)	rz,An abstract base class for context managers.cCs|S�z0Return `self` upon entering the runtime context.���selfrr�"/usr/lib64/python3.8/contextlib.py�	__enter__sz AbstractContextManager.__enter__cCsdS�z9Raise any exception triggered within the runtime context.Nr�r�exc_type�	exc_value�	tracebackrrr�__exit__szAbstractContextManager.__exit__cCs|tkrt�|dd�StS)Nrr)r�_collections_abc�_check_methods�NotImplemented��cls�Crrr�__subclasshook__sz'AbstractContextManager.__subclasshook__N)
�__name__�
__module__�__qualname__�__doc__r�abc�abstractmethodr�classmethodr%rrrrrs
c@s2eZdZdZdd�Zejdd��Zedd��Z	dS)	rz9An abstract base class for asynchronous context managers.c�s|Srrrrrr�
__aenter__'sz&AbstractAsyncContextManager.__aenter__c�sdSrrrrrr�	__aexit__+sz%AbstractAsyncContextManager.__aexit__cCs|tkrt�|dd�StS)Nr-r.)rrr r!r"rrrr%0s
�z,AbstractAsyncContextManager.__subclasshook__N)
r&r'r(r)r-r*r+r.r,r%rrrrr#s
c@s eZdZdZdd�Zdd�ZdS)rzJA base class or mixin that enables context managers to work as decorators.cCs|S)a6Return a recreated instance of self.

        Allows an otherwise one-shot context manager like
        _GeneratorContextManager to support use as
        a decorator via implicit recreation.

        This is a private interface just for _GeneratorContextManager.
        See issue #11647 for details.
        rrrrr�_recreate_cm;s
zContextDecorator._recreate_cmcst����fdd��}|S)Nc
s*�����||�W5QR�SQRXdS�N)r/��args�kwds��funcrrr�innerHs
z(ContextDecorator.__call__.<locals>.innerr)rr5r6rr4r�__call__GszContextDecorator.__call__N)r&r'r(r)r/r7rrrrr8sc@seZdZdZdd�ZdS)�_GeneratorContextManagerBasezBShared functionality for @contextmanager and @asynccontextmanager.cCsJ|||�|_||||_|_|_t|dd�}|dkr@t|�j}||_dS)Nr))�genr5r2r3�getattr�typer))rr5r2r3�docrrr�__init__Rs
z%_GeneratorContextManagerBase.__init__N)r&r'r(r)r=rrrrr8Osr8c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_GeneratorContextManagerz%Helper for @contextmanager decorator.cCs|�|j|j|j�Sr0)�	__class__r5r2r3rrrrr/fsz%_GeneratorContextManager._recreate_cmcCs<|`|`|`zt|j�WStk
r6td�d�YnXdS�Nzgenerator didn't yield)r2r3r5�nextr9�
StopIteration�RuntimeErrorrrrrrls
z"_GeneratorContextManager.__enter__c
Cs|dkr8zt|j�Wntk
r,YdSXtd��n�|dkrF|�}z|j�|||�Wn�tk
r�}z||k	WY�Sd}~XYnttk
r�}z4||kr�WY�&dS|tkr�|j|kr�WY�
dS�W5d}~XYn$t��d|kr�YdS�YnXtd��dS)NF�generator didn't stop�z#generator didn't stop after throw())rAr9rBrC�throw�	__cause__�sys�exc_info)rr;�valuer�excrrrrus.


z!_GeneratorContextManager.__exit__N)r&r'r(r)r/rrrrrrr>as	r>c@s eZdZdZdd�Zdd�ZdS)�_AsyncGeneratorContextManagerz Helper for @asynccontextmanager.c�s6z|j��IdHWStk
r0td�d�YnXdSr@)r9�	__anext__�StopAsyncIterationrCrrrrr-�sz(_AsyncGeneratorContextManager.__aenter__c
�s&|dkr>z|j��IdHWntk
r2YdSXtd��n�|dkrL|�}z"|j�|||�IdHtd��Wn�tk
r�}z||k	WY�Sd}~XYn�tk
r�}z:||kr�WY�,dSt|ttf�r�|j|kr�WY�
dS�W5d}~XYn0tk
�r }z||k	�r�W5d}~XYnXdS)NrDz$generator didn't stop after athrow()F)	r9rMrNrC�athrow�
isinstancerBrG�
BaseException)r�typrJrrKrrrr.�s.




z'_AsyncGeneratorContextManager.__aexit__N)r&r'r(r)r-r.rrrrrL�srLcst���fdd��}|S)a�@contextmanager decorator.

    Typical usage:

        @contextmanager
        def some_generator(<arguments>):
            <setup>
            try:
                yield <value>
            finally:
                <cleanup>

    This makes this:

        with some_generator(<arguments>) as <variable>:
            <body>

    equivalent to this:

        <setup>
        try:
            <variable> = <value>
            <body>
        finally:
            <cleanup>
    cst�||�Sr0)r>r1�r5rr�helper�szcontextmanager.<locals>.helperr�r5rTrrSrr�scst���fdd��}|S)a�@asynccontextmanager decorator.

    Typical usage:

        @asynccontextmanager
        async def some_async_generator(<arguments>):
            <setup>
            try:
                yield <value>
            finally:
                <cleanup>

    This makes this:

        async with some_async_generator(<arguments>) as <variable>:
            <body>

    equivalent to this:

        <setup>
        try:
            <variable> = <value>
            <body>
        finally:
            <cleanup>
    cst�||�Sr0)rLr1rSrrrTsz#asynccontextmanager.<locals>.helperrrUrrSrr�sc@s(eZdZdZdd�Zdd�Zdd�ZdS)	r	a2Context to automatically close something at the end of a block.

    Code like this:

        with closing(<module>.open(<arguments>)) as f:
            <block>

    is equivalent to this:

        f = <module>.open(<arguments>)
        try:
            <block>
        finally:
            f.close()

    cCs
||_dSr0��thing)rrWrrrr=&szclosing.__init__cCs|jSr0rVrrrrr(szclosing.__enter__cGs|j��dSr0)rW�close)rrIrrrr*szclosing.__exit__N�r&r'r(r)r=rrrrrrr	sc@s(eZdZdZdd�Zdd�Zdd�ZdS)�_RedirectStreamNcCs||_g|_dSr0)�_new_target�_old_targets)r�
new_targetrrrr=2sz_RedirectStream.__init__cCs*|j�tt|j��tt|j|j�|jSr0)r\�appendr:rH�_stream�setattrr[rrrrr7sz_RedirectStream.__enter__cCstt|j|j���dSr0)r`rHr_r\�pop�r�exctype�excinst�exctbrrrr<sz_RedirectStream.__exit__)r&r'r(r_r=rrrrrrrZ.srZc@seZdZdZdZdS)raAContext manager for temporarily redirecting stdout to another file.

        # How to send help() to stderr
        with redirect_stdout(sys.stderr):
            help(dir)

        # How to write help() to a file
        with open('help.txt', 'w') as f:
            with redirect_stdout(f):
                help(pow)
    �stdoutN�r&r'r(r)r_rrrrr@sc@seZdZdZdZdS)rzCContext manager for temporarily redirecting stderr to another file.�stderrNrgrrrrrPsc@s(eZdZdZdd�Zdd�Zdd�ZdS)	ra?Context manager to suppress specified exceptions

    After the exception is suppressed, execution proceeds with the next
    statement following the with statement.

         with suppress(FileNotFoundError):
             os.remove(somefile)
         # Execution still resumes here if the file was already removed
    cGs
||_dSr0)�_exceptions)r�
exceptionsrrrr=aszsuppress.__init__cCsdSr0rrrrrrdszsuppress.__enter__cCs|dk	ot||j�Sr0)�
issubclassrirbrrrrgs
zsuppress.__exit__NrYrrrrrVs
c@sheZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zde_dd�Z
ddd�ZdS)�_BaseExitStackz.A base class for ExitStack and AsyncExitStack.cCs
t||�Sr0r��cm�cm_exitrrr�_create_exit_wrapperwsz#_BaseExitStack._create_exit_wrappercs���fdd�}|S)Ncs����dSr0r�rrK�tb�r2�callbackr3rr�
_exit_wrapper}sz8_BaseExitStack._create_cb_wrapper.<locals>._exit_wrapperr�rtr2r3rurrsr�_create_cb_wrapper{sz!_BaseExitStack._create_cb_wrappercCst�|_dSr0)r�_exit_callbacksrrrrr=�sz_BaseExitStack.__init__cCst|��}|j|_t�|_|S)z@Preserve the context stack by transferring it to a new instance.)r;rxr)r�	new_stackrrr�pop_all�s
z_BaseExitStack.pop_allcCsBt|�}z
|j}Wntk
r0|�|�YnX|�||�|S)aRegisters a callback with the standard __exit__ method signature.

        Can suppress exceptions the same way __exit__ method can.
        Also accepts any object with an __exit__ method (registering a call
        to the method instead of the object itself).
        )r;r�AttributeError�_push_exit_callback�
_push_cm_exit�r�exit�_cb_type�exit_methodrrr�push�s	
z_BaseExitStack.pushcCs(t|�}|j}|�|�}|�||�|S)z�Enters the supplied context manager.

        If successful, also pushes its __exit__ method as a callback and
        returns the result of the __enter__ method.
        )r;rrr}�rrn�_cm_type�_exit�resultrrr�
enter_context�s

z_BaseExitStack.enter_contextcOs�t|�dkr|^}}}nV|s&td��nHd|krZ|�d�}|^}}ddl}|jdtdd�ntdt|�d	��|j|f|�|�}||_|�|�|S)
z\Registers an arbitrary callback and arguments.

        Cannot suppress exceptions.
        �zBdescriptor 'callback' of '_BaseExitStack' object needs an argumentrtrN�4Passing 'callback' as keyword argument is deprecated��
stacklevelz8callback expected at least 1 positional argument, got %drE)	�len�	TypeErrorra�warnings�warn�DeprecationWarningrw�__wrapped__r|�r2r3rrtr�rurrrrt�s&

�
�
z_BaseExitStack.callback�#($self, callback, /, *args, **kwds)cCs|�||�}|�|d�dS)z;Helper to correctly register callbacks to __exit__ methods.TN)rpr|�rrnrorurrrr}�sz_BaseExitStack._push_cm_exitTcCs|j�||f�dSr0)rxr^)rrt�is_syncrrrr|�sz"_BaseExitStack._push_exit_callbackN)T)r&r'r(r)�staticmethodrprwr=rzr�r�rt�__text_signature__r}r|rrrrrlts

rlc@s(eZdZdZdd�Zdd�Zdd�ZdS)	ra�Context manager for dynamic management of a stack of exit callbacks.

    For example:
        with ExitStack() as stack:
            files = [stack.enter_context(open(fname)) for fname in filenames]
            # All opened files will automatically be closed at the end of
            # the with statement, even if attempts to open files later
            # in the list raise an exception.
    cCs|Sr0rrrrrr�szExitStack.__enter__c
s�|ddk	}t��d��fdd�}d}d}|jr�|j��\}}|sHt�z||�r^d}d}d}Wq,t��}||d|d�d}|}Yq,Xq,|r�z|dj}	|d�Wn tk
r�|	|d_�YnX|o�|S)NrrEcs4|j}||krdS|dks*|�kr$q*|}q||_dSr0��__context__��new_exc�old_exc�exc_context��	frame_excrr�_fix_exception_context�sz2ExitStack.__exit__.<locals>._fix_exception_contextFT�NNN)rHrIrxra�AssertionErrorr�rQ)
r�exc_details�received_excr��suppressed_exc�
pending_raiser��cb�new_exc_details�	fixed_ctxrr�rr�s4

zExitStack.__exit__cCs|�ddd�dS�z%Immediately unwind the context stack.N)rrrrrrXszExitStack.closeN)r&r'r(r)rrrXrrrrr�s
1c@sfeZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	de	_
d
d�Zdd�Zdd�Z
dd�ZdS)r
a�Async context manager for dynamic management of a stack of exit
    callbacks.

    For example:
        async with AsyncExitStack() as stack:
            connections = [await stack.enter_async_context(get_connection())
                for i in range(5)]
            # All opened connections will automatically be released at the
            # end of the async with statement, even if attempts to open a
            # connection later in the list raise an exception.
    cCs
t||�Sr0rrmrrr�_create_async_exit_wrapper&sz)AsyncExitStack._create_async_exit_wrappercs���fdd�}|S)Nc�s����IdHdSr0rrqrsrrru,sz>AsyncExitStack._create_async_cb_wrapper.<locals>._exit_wrapperrrvrrsr�_create_async_cb_wrapper*sz'AsyncExitStack._create_async_cb_wrapperc�s.t|�}|j}|�|�IdH}|�||�|S)z�Enters the supplied async context manager.

        If successful, also pushes its __aexit__ method as a callback and
        returns the result of the __aenter__ method.
        N)r;r.r-�_push_async_cm_exitr�rrr�enter_async_context0s
z"AsyncExitStack.enter_async_contextcCsDt|�}z
|j}Wn tk
r2|�|d�YnX|�||�|S)a#Registers a coroutine function with the standard __aexit__ method
        signature.

        Can suppress exceptions the same way __aexit__ method can.
        Also accepts any object with an __aexit__ method (registering a call
        to the method instead of the object itself).
        F)r;r.r{r|r�r~rrr�push_async_exit<s
zAsyncExitStack.push_async_exitcOs�t|�dkr|^}}}nV|s&td��nHd|krZ|�d�}|^}}ddl}|jdtdd�ntdt|�d	��|j|f|�|�}||_|�|d
�|S)zfRegisters an arbitrary coroutine function and arguments.

        Cannot suppress exceptions.
        r�zMdescriptor 'push_async_callback' of 'AsyncExitStack' object needs an argumentrtrNr�r�zCpush_async_callback expected at least 1 positional argument, got %drEF)	r�r�rar�r�r�r�r�r|r�rrr�push_async_callbackNs&

�
�z"AsyncExitStack.push_async_callbackr�c�s|�ddd�IdHdSr�)r.rrrr�aclosekszAsyncExitStack.aclosecCs|�||�}|�|d�dS)zLHelper to correctly register coroutine function to __aexit__
        method.FN)r�r|r�rrrr�osz"AsyncExitStack._push_async_cm_exitc�s|Sr0rrrrrr-uszAsyncExitStack.__aenter__c�s�|ddk	}t��d��fdd�}d}d}|jr�|j��\}}z0|rP||�}n||�IdH}|rnd}d}d}Wq,t��}	||	d|d�d}|	}Yq,Xq,|r�z|dj}
|d�Wn tk
r�|
|d_�YnX|o�|S)NrrEcs4|j}||krdS|dks*|�kr$q*|}q||_dSr0r�r�r�rrr�~sz8AsyncExitStack.__aexit__.<locals>._fix_exception_contextFTr�)rHrIrxrar�rQ)rr�r�r�r�r�r�r��cb_suppressr�r�rr�rr.xs8


zAsyncExitStack.__aexit__N)r&r'r(r)r�r�r�r�r�r�r�r�r�r-r.rrrrr
s

c@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
r
aOContext manager that does no additional processing.

    Used as a stand-in for a normal context manager, when a particular
    block of code is only sometimes used with a normal context manager:

    cm = optional_cm if condition else nullcontext()
    with cm:
        # Perform operation, using optional_cm if condition is True
    NcCs
||_dSr0��enter_result)rr�rrrr=�sznullcontext.__init__cCs|jSr0r�rrrrr�sznullcontext.__enter__cGsdSr0r)r�excinforrrr�sznullcontext.__exit__)NrYrrrrr
�s

)r)r*rHr�collectionsr�	functoolsr�typesr�__all__�ABCrr�objectrr8r>rLrrr	rZrrrrlrr
r
rrrr�<module>sN��D�.!!`Eargparse.cpython-38.opt-1.pyc000064400000171262150335716500011755 0ustar00U

e5dw�@s0dZdZdddddddd	d
ddd
dddddgZddlZddlZddlZddl	Z
ddlmZm
Z
dZdZdZdZdZdZdZGdd�de�Zdd �ZGd!d�de�ZGd"d�de�ZGd#d	�d	e�ZGd$d�de�ZGd%d
�d
e�Zd&d'�ZGd(d�de�ZGd)d�de�Z Gd*d�de�Z!Gd+d,�d,e!�Z"Gd-d.�d.e!�Z#Gd/d0�d0e#�Z$Gd1d2�d2e#�Z%Gd3d4�d4e!�Z&Gd5d6�d6e!�Z'Gd7d8�d8e!�Z(Gd9d:�d:e!�Z)Gd;d<�d<e!�Z*Gd=d>�d>e!�Z+Gd?d@�d@e&�Z,GdAd�de�Z-GdBd�de�Z.GdCdD�dDe�Z/GdEdF�dFe/�Z0GdGdH�dHe0�Z1GdId�dee/�Z2dS)Ja�
Command-line parsing library

This module is an optparse-inspired command-line parsing library that:

    - handles both optional and positional arguments
    - produces highly informative usage messages
    - supports parsers that dispatch to sub-parsers

The following is a simple usage example that sums integers from the
command-line and writes the result to a file::

    parser = argparse.ArgumentParser(
        description='sum the integers at the command line')
    parser.add_argument(
        'integers', metavar='int', nargs='+', type=int,
        help='an integer to be summed')
    parser.add_argument(
        '--log', default=sys.stdout, type=argparse.FileType('w'),
        help='the file where the sum should be written')
    args = parser.parse_args()
    args.log.write('%s' % sum(args.integers))
    args.log.close()

The module contains the following public classes:

    - ArgumentParser -- The main entry point for command-line parsing. As the
        example above shows, the add_argument() method is used to populate
        the parser with actions for optional and positional arguments. Then
        the parse_args() method is invoked to convert the args at the
        command-line into an object with attributes.

    - ArgumentError -- The exception raised by ArgumentParser objects when
        there are errors with the parser's actions. Errors raised while
        parsing the command-line are caught by ArgumentParser and emitted
        as command-line messages.

    - FileType -- A factory for defining types of files to be created. As the
        example above shows, instances of FileType are typically passed as
        the type= argument of add_argument() calls.

    - Action -- The base class for parser actions. Typically actions are
        selected by passing strings like 'store_true' or 'append_const' to
        the action= argument of add_argument(). However, for greater
        customization of ArgumentParser actions, subclasses of Action may
        be defined and passed as the action= argument.

    - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter,
        ArgumentDefaultsHelpFormatter -- Formatter classes which
        may be passed as the formatter_class= argument to the
        ArgumentParser constructor. HelpFormatter is the default,
        RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser
        not to change the formatting for help text, and
        ArgumentDefaultsHelpFormatter adds information about argument defaults
        to the help.

All other classes in this module are considered implementation details.
(Also note that HelpFormatter and RawDescriptionHelpFormatter are only
considered public as object names -- the API of the formatter objects is
still considered an implementation detail.)
z1.1�ArgumentParser�
ArgumentError�ArgumentTypeError�FileType�
HelpFormatter�ArgumentDefaultsHelpFormatter�RawDescriptionHelpFormatter�RawTextHelpFormatter�MetavarTypeHelpFormatter�	Namespace�Action�ONE_OR_MORE�OPTIONAL�PARSER�	REMAINDER�SUPPRESS�ZERO_OR_MORE�N)�gettext�ngettextz==SUPPRESS==�?�*�+zA...�...Z_unrecognized_argsc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_AttributeHolderaAbstract base class that provides __repr__.

    The __repr__ method returns a string in the format::
        ClassName(attr=name, attr=name, ...)
    The attributes are determined either by a class-level attribute,
    '_kwarg_names', or by inspecting the instance __dict__.
    cCs�t|�j}g}i}|��D]}|�t|��q|��D],\}}|��rZ|�d||f�q6|||<q6|rz|�dt|��d|d�|�fS)N�%s=%rz**%s�%s(%s)�, )�type�__name__�	_get_args�append�repr�_get_kwargs�isidentifier�join)�selfZ	type_name�arg_stringsZ	star_args�arg�name�value�r*� /usr/lib64/python3.8/argparse.py�__repr__ts

z_AttributeHolder.__repr__cCst|j���S�N)�sorted�__dict__�items�r%r*r*r+r"�sz_AttributeHolder._get_kwargscCsgSr-r*r1r*r*r+r�sz_AttributeHolder._get_argsN)r�
__module__�__qualname__�__doc__r,r"rr*r*r*r+rksrcCs6|dkrgSt|�tkr$|dd�Sddl}|�|�S)Nr)r�list�copy)r0r6r*r*r+�_copy_items�sr7c@s�eZdZdZd;dd�Zdd�Zd	d
�ZGdd�de�Zd
d�Z	dd�Z
dd�Zdd�Zd<dd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�ZdS)=rz�Formatter for generating usage messages and argument help strings.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    ��NcCs�|dkrt��j}|d8}||_||_t|t|d|d��|_||_d|_	d|_
d|_|�|d�|_
|j
|_t�dtj�|_t�d�|_dS)Nr8�rz\s+z\n\n\n+)�_shutil�get_terminal_size�columns�_prog�_indent_increment�min�max�_max_help_position�_width�_current_indent�_level�_action_max_length�_Section�
_root_section�_current_section�_re�compile�ASCII�_whitespace_matcher�_long_break_matcher)r%�progZindent_incrementZmax_help_position�widthr*r*r+�__init__�s 
�zHelpFormatter.__init__cCs"|j|j7_|jd7_dS�N��rDr?rEr1r*r*r+�_indent�szHelpFormatter._indentcCs"|j|j8_|jd8_dSrRrTr1r*r*r+�_dedent�szHelpFormatter._dedentc@seZdZddd�Zdd�ZdS)zHelpFormatter._SectionNcCs||_||_||_g|_dSr-)�	formatter�parent�headingr0)r%rWrXrYr*r*r+rQ�szHelpFormatter._Section.__init__cCs�|jdk	r|j��|jj}|dd�|jD��}|jdk	rD|j��|sLdS|jtk	rz|jdk	rz|jj}d|d|jf}nd}|d||dg�S)NcSsg|]\}}||��qSr*r*)�.0�func�argsr*r*r+�
<listcomp>�sz6HelpFormatter._Section.format_help.<locals>.<listcomp>�z%*s%s:
�
)	rXrWrU�_join_partsr0rVrYrrD)r%r$Z	item_helpZcurrent_indentrYr*r*r+�format_help�s



z"HelpFormatter._Section.format_help)N)rr2r3rQrar*r*r*r+rG�s
rGcCs|jj�||f�dSr-)rIr0r )r%r[r\r*r*r+�	_add_item�szHelpFormatter._add_itemcCs0|��|�||j|�}|�|jg�||_dSr-)rUrGrIrbra)r%rYZsectionr*r*r+�
start_section�szHelpFormatter.start_sectioncCs|jj|_|��dSr-)rIrXrVr1r*r*r+�end_section�s
zHelpFormatter.end_sectioncCs$|tk	r |dk	r |�|j|g�dSr-)rrb�_format_text)r%�textr*r*r+�add_text�szHelpFormatter.add_textcCs&|tk	r"||||f}|�|j|�dSr-)rrb�
_format_usage)r%�usage�actions�groups�prefixr\r*r*r+�	add_usage�szHelpFormatter.add_usagecCsv|jtk	rr|j}||�g}|�|�D]}|�||��q$tdd�|D��}||j}t|j|�|_|�|j	|g�dS)NcSsg|]}t|��qSr*��len�rZ�sr*r*r+r]
sz.HelpFormatter.add_argument.<locals>.<listcomp>)
�helpr�_format_action_invocation�_iter_indented_subactionsr rArDrFrb�_format_action)r%�actionZget_invocationZinvocations�	subactionZinvocation_lengthZ
action_lengthr*r*r+�add_arguments


�zHelpFormatter.add_argumentcCs|D]}|�|�qdSr-)rx)r%rjrvr*r*r+�
add_argumentsszHelpFormatter.add_argumentscCs.|j��}|r*|j�d|�}|�d�d}|S)N�

r_)rHrarN�sub�strip)r%rrr*r*r+ras

zHelpFormatter.format_helpcCsd�dd�|D��S)Nr^cSsg|]}|r|tk	r|�qSr*)r)rZ�partr*r*r+r]!s�z-HelpFormatter._join_parts.<locals>.<listcomp>)r$)r%Zpart_stringsr*r*r+r` s
�zHelpFormatter._join_partscs|dkrtd�}|dk	r,|t|jd�}�n�|dkrL|sLdt|jd�}�n�|dk�rdt|jd�}g}g}|D] }|jr�|�|�qr|�|�qr|j}	|	|||�}
d�dd�||
fD��}|j|j�t	|�t	|��k�rd}|	||�}|	||�}
t
�||�}t
�||
�}d�fdd	�	}t	|�t	|�d
�k�r�dt	|�t	|�d}|�r|||g|||�}|�|||��n |�r�||g|||�}n|g}nZdt	|�}||}|||�}t	|�dk�r�g}|�|||��|�|||��|g|}d�|�}d
||fS)Nzusage: �rOz%(prog)s� cSsg|]}|r|�qSr*r*rpr*r*r+r]Asz/HelpFormatter._format_usage.<locals>.<listcomp>z%\(.*?\)+(?=\s|$)|\[.*?\]+(?=\s|$)|\S+cs�g}g}|dk	rt|�d}nt|�d}|D]Z}|dt|��krn|rn|�|d�|��g}t|�d}|�|�|t|�d7}q.|r�|�|d�|��|dk	r�|dt|�d�|d<|S)NrSrr)ror r$)�parts�indentrl�lines�lineZline_lenr}��
text_widthr*r+�	get_linesUs"
z.HelpFormatter._format_usage.<locals>.get_linesg�?rSr_z%s%s

)N)
�_�dictr>�option_stringsr �_format_actions_usager$rCrDrorJ�findall�extend)r%rirjrkrlrO�	optionals�positionalsrv�formatZaction_usageZpart_regexpZ	opt_usageZ	pos_usageZ	opt_partsZ	pos_partsr�r�r�r�r*r�r+rh%sX
�




zHelpFormatter._format_usagec	Cs�t�}i}|D�]}z|�|jd�}Wntk
r@YqYqX|t|j�}|||�|jkr|jD]}|�|�qh|js�||kr�||d7<nd||<||kr�||d7<nd||<nF||kr�||d7<nd||<||k�r||d7<nd||<t|d|�D]}	d	||	<�qqg}
t|�D�]"\}	}|j	t
k�r�|
�d�|�|	�d	k�rr|�
|	�n"|�|	d�d	k�rX|�
|	d�n�|j�s�|�|�}|�||�}||k�r�|ddk�r�|d
dk�r�|dd
�}|
�|�nf|jd}
|jdk�rd|
}n"|�|�}|�||�}d|
|f}|j�sN||k�rNd
|}|
�|��q6t|dd�D]}	||	g|
|	|	�<�qhd�dd�|
D��}d}d}t�d|d|�}t�d|d|�}t�d||fd|�}t�dd|�}|��}|S)Nrz [�[�]z (�(�)rS�|����%s�%s %s�[%s]T)�reversercSsg|]}|dk	r|�qSr-r*)rZ�itemr*r*r+r]�sz7HelpFormatter._format_actions_usage.<locals>.<listcomp>z[\[(]z[\])]z(%s) z\1� (%s)z%s *%sr^z\(([^|]*)\))�set�index�_group_actions�
ValueErrorro�add�required�range�	enumeraterrrr �get�popr��#_get_default_metavar_for_positional�_format_args�nargs�!_get_default_metavar_for_optionalr.r$rJr{r|)r%rjrk�
group_actionsZinserts�group�start�endrv�ir��defaultr}�
option_string�args_stringrf�open�closer*r*r+r��sz










z#HelpFormatter._format_actions_usagecCsFd|kr|t|jd�}t|j|jd�}d|j}|�|||�dS)Nz%(prog)r~�rrz)r�r>rArCrD�
_fill_text)r%rfr�r�r*r*r+re�s

zHelpFormatter._format_textc
Cs:t|jd|j�}t|j|d�}||jd}|�|�}|jsV|jd|f}d|}n@t|�|kr~|jd||f}d|}d}n|jd|f}d|}|}|g}|jr�|�	|�}	|�
|	|�}
|�d|d|
df�|
dd�D]}|�d|d|f�q�n|�d��s|�d�|�
|�D]}|�|�|���q|�|�S)	Nr8r�r^z%*s%s
z	%*s%-*s  rrSr_)r@rFrBrArCrDrsrrro�_expand_help�_split_linesr �endswithrtrur`)
r%rvZ
help_positionZ
help_widthZaction_widthZ
action_header�tupZindent_firstr�Z	help_textZ
help_linesr�rwr*r*r+ru�s8
�



zHelpFormatter._format_actioncCs�|js&|�|�}|�||�d�\}|Sg}|jdkrB|�|j�n4|�|�}|�||�}|jD]}|�d||f�q^d�|�SdS)NrSrr�r)	r�r��_metavar_formatterr�r�r�r�r r$)r%rvr��metavarr�r�r�r*r*r+rs"s



z'HelpFormatter._format_action_invocationcsP|jdk	r|j�n.|jdk	r<dd�|jD�}dd�|��n|��fdd�}|S)NcSsg|]}t|��qSr*��str)rZZchoicer*r*r+r]>sz4HelpFormatter._metavar_formatter.<locals>.<listcomp>z{%s}�,cst�t�r�S�f|SdSr-)�
isinstance�tuple)Z
tuple_size��resultr*r+r�Cs
z0HelpFormatter._metavar_formatter.<locals>.format)r��choicesr$)r%rv�default_metavarZchoice_strsr�r*r�r+r�:s

z HelpFormatter._metavar_formattercCs�|�||�}|jdkr$d|d�}n�|jtkr<d|d�}n�|jtkrTd|d�}n�|jtkrld|d�}n�|jtkr|d}nt|jtkr�d|d�}n\|jtkr�d	}nLzd
d�t|j�D�}Wnt	k
r�t
d�d�YnXd
�|�||j�}|S)Nr�rSr�z
[%s [%s ...]]r8z%s [%s ...]rz%s ...r^cSsg|]}d�qS)r�r*)rZr�r*r*r+r]\sz.HelpFormatter._format_args.<locals>.<listcomp>zinvalid nargs valuer)r�r�r
rrrrrr��	TypeErrorr�r$)r%rvr�Zget_metavarr�Zformatsr*r*r+r�Js*






zHelpFormatter._format_argscCs�tt|�|jd�}t|�D]}||tkr||=qt|�D] }t||d�r:||j||<q:|�d�dk	r�d�dd�|dD��}||d<|�	|�|S)Nr~rr�rcSsg|]}t|��qSr*r�)rZ�cr*r*r+r]ksz.HelpFormatter._expand_help.<locals>.<listcomp>)
r��varsr>r5r�hasattrrr�r$�_get_help_string)r%rvZparamsr(Zchoices_strr*r*r+r�bszHelpFormatter._expand_helpccs@z
|j}Wntk
rYnX|��|�EdH|��dSr-)�_get_subactions�AttributeErrorrUrV)r%rvZget_subactionsr*r*r+rtos
z'HelpFormatter._iter_indented_subactionscCs&|j�d|���}ddl}|�||�S)Nrr)rMr{r|�textwrapZwrap)r%rfrPr�r*r*r+r�yszHelpFormatter._split_linescCs,|j�d|���}ddl}|j||||d�S)Nrr)Zinitial_indentZsubsequent_indent)rMr{r|r�Zfill)r%rfrPr�r�r*r*r+r��s�zHelpFormatter._fill_textcCs|jSr-)rr�r%rvr*r*r+r��szHelpFormatter._get_help_stringcCs
|j��Sr-)�dest�upperr�r*r*r+r��sz/HelpFormatter._get_default_metavar_for_optionalcCs|jSr-)r�r�r*r*r+r��sz1HelpFormatter._get_default_metavar_for_positional)r8r9N)N) rr2r3r4rQrUrV�objectrGrbrcrdrgrmrxryrar`rhr�rerursr�r�r�rtr�r�r�r�r�r*r*r*r+r�s>�

`g/

c@seZdZdZdd�ZdS)rz�Help message formatter which retains any formatting in descriptions.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cs d��fdd�|jdd�D��S)Nr^c3s|]}�|VqdSr-r*)rZr��r�r*r+�	<genexpr>�sz9RawDescriptionHelpFormatter._fill_text.<locals>.<genexpr>T)�keepends)r$�
splitlines)r%rfrPr�r*r�r+r��sz&RawDescriptionHelpFormatter._fill_textN)rr2r3r4r�r*r*r*r+r�sc@seZdZdZdd�ZdS)rz�Help message formatter which retains formatting of all help text.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCs|��Sr-)r�)r%rfrPr*r*r+r��sz!RawTextHelpFormatter._split_linesN)rr2r3r4r�r*r*r*r+r�sc@seZdZdZdd�ZdS)rz�Help message formatter which adds default values to argument help.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCs>|j}d|jkr:|jtk	r:ttg}|js2|j|kr:|d7}|S)Nz
%(default)z (default: %(default)s))rrr�rr
rr�r�)r%rvrrZdefaulting_nargsr*r*r+r��s

z.ArgumentDefaultsHelpFormatter._get_help_stringN)rr2r3r4r�r*r*r*r+r�sc@s eZdZdZdd�Zdd�ZdS)r	aHelp message formatter which uses the argument 'type' as the default
    metavar value (instead of the argument 'dest')

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCs|jjSr-�rrr�r*r*r+r��sz:MetavarTypeHelpFormatter._get_default_metavar_for_optionalcCs|jjSr-r�r�r*r*r+r��sz<MetavarTypeHelpFormatter._get_default_metavar_for_positionalN)rr2r3r4r�r�r*r*r*r+r	�scCsN|dkrdS|jrd�|j�S|jdtfkr2|jS|jdtfkrF|jSdSdS)N�/)r�r$r�rr�)�argumentr*r*r+�_get_action_name�sr�c@s eZdZdZdd�Zdd�ZdS)rz�An error from creating or using an argument (optional or positional).

    The string value of this exception is the message, augmented with
    information about the argument that caused it.
    cCst|�|_||_dSr-)r��
argument_name�message)r%r�r�r*r*r+rQ�s
zArgumentError.__init__cCs(|jdkrd}nd}|t|j|jd�S)Nz%(message)sz'argument %(argument_name)s: %(message)s)r�r�)r�r�r�)r%r�r*r*r+�__str__�s
�zArgumentError.__str__N)rr2r3r4rQr�r*r*r*r+r�sc@seZdZdZdS)rz@An error from trying to convert a command line string to a type.N)rr2r3r4r*r*r*r+r�sc@s,eZdZdZd
dd�Zdd�Zddd	�ZdS)ra\	Information about how to convert command line strings to Python objects.

    Action objects are used by an ArgumentParser to represent the information
    needed to parse a single argument from one or more strings from the
    command line. The keyword arguments to the Action constructor are also
    all attributes of Action instances.

    Keyword Arguments:

        - option_strings -- A list of command-line option strings which
            should be associated with this action.

        - dest -- The name of the attribute to hold the created object(s)

        - nargs -- The number of command-line arguments that should be
            consumed. By default, one argument will be consumed and a single
            value will be produced.  Other values include:
                - N (an integer) consumes N arguments (and produces a list)
                - '?' consumes zero or one arguments
                - '*' consumes zero or more arguments (and produces a list)
                - '+' consumes one or more arguments (and produces a list)
            Note that the difference between the default and nargs=1 is that
            with the default, a single value will be produced, while with
            nargs=1, a list containing a single value will be produced.

        - const -- The value to be produced if the option is specified and the
            option uses an action that takes no values.

        - default -- The value to be produced if the option is not specified.

        - type -- A callable that accepts a single string argument, and
            returns the converted value.  The standard Python types str, int,
            float, and complex are useful examples of such callables.  If None,
            str is used.

        - choices -- A container of values that should be allowed. If not None,
            after a command-line argument has been converted to the appropriate
            type, an exception will be raised if it is not a member of this
            collection.

        - required -- True if the action must always be specified at the
            command line. This is only meaningful for optional command-line
            arguments.

        - help -- The help string describing the argument.

        - metavar -- The name to be used for the option's argument with the
            help string. If None, the 'dest' value will be used as the name.
    NFcCs@||_||_||_||_||_||_||_||_|	|_|
|_	dSr-�
r�r�r��constr�rr�r�rrr��r%r�r�r�r�r�rr�r�rrr�r*r*r+rQ)szAction.__init__c	s(ddddddddd	g	}�fd
d�|D�S)Nr�r�r�r�r�rr�rrr�csg|]}|t�|�f�qSr*��getattr�rZr(r1r*r+r]Ksz&Action._get_kwargs.<locals>.<listcomp>r*�r%�namesr*r1r+r"?s�zAction._get_kwargscCsttd���dS)Nz.__call__() not defined)�NotImplementedErrorr��r%�parser�	namespace�valuesr�r*r*r+�__call__MszAction.__call__)NNNNNFNN)N)rr2r3r4rQr"r�r*r*r*r+r�s5�
cs(eZdZd�fdd�	Zddd�Z�ZS)	�_StoreActionNFcsT|dkrtd��|dk	r,|tkr,tdt��tt|�j|||||||||	|
d�
dS)Nrz�nargs for store actions must be != 0; if you have nothing to store, actions such as store true or store const may be more appropriate� nargs must be %r to supply constr�)r�r
�superr�rQr���	__class__r*r+rQSs 
�z_StoreAction.__init__cCst||j|�dSr-)�setattrr�r�r*r*r+r�psz_StoreAction.__call__)NNNNNFNN)N�rr2r3rQr��
__classcell__r*r*r�r+r�Qs�r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_StoreConstActionNFc	s"tt|�j||d||||d�dS)Nr)r�r�r�r�r�r�rr)r�r�rQ�r%r�r�r�r�r�rrr�r�r*r+rQvs
�z_StoreConstAction.__init__cCst||j|j�dSr-)r�r�r�r�r*r*r+r��sz_StoreConstAction.__call__)NFNN)Nr�r*r*r�r+r�ts�r�cseZdZd�fdd�	Z�ZS)�_StoreTrueActionFNcs tt|�j||d|||d�dS)NT�r�r�r�r�r�rr)r�r�rQ�r%r�r�r�r�rrr�r*r+rQ�s
�z_StoreTrueAction.__init__)FFN�rr2r3rQr�r*r*r�r+r��s�r�cseZdZd�fdd�	Z�ZS)�_StoreFalseActionTFNcs tt|�j||d|||d�dS)NFr�)r�r�rQr�r�r*r+rQ�s
�z_StoreFalseAction.__init__)TFNr�r*r*r�r+r��s�r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�
_AppendActionNFcsT|dkrtd��|dk	r,|tkr,tdt��tt|�j|||||||||	|
d�
dS)Nrz�nargs for append actions must be != 0; if arg strings are not supplying the value to append, the append const action may be more appropriater�r�)r�r
r�r�rQr�r�r*r+rQ�s 
�z_AppendAction.__init__cCs2t||jd�}t|�}|�|�t||j|�dSr-)r�r�r7r r��r%r�r�r�r�r0r*r*r+r��s
z_AppendAction.__call__)NNNNNFNN)Nr�r*r*r�r+r��s�r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_AppendConstActionNFc
s$tt|�j||d|||||d�dS)Nr)r�r�r�r�r�r�rrr�)r�r�rQr�r�r*r+rQ�s
�z_AppendConstAction.__init__cCs4t||jd�}t|�}|�|j�t||j|�dSr-)r�r�r7r r�r�r�r*r*r+r��sz_AppendConstAction.__call__)NFNN)Nr�r*r*r�r+r��s�r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_CountActionNFcs tt|�j||d|||d�dS)Nr)r�r�r�r�r�rr)r�r�rQr�r�r*r+rQ�s
�z_CountAction.__init__cCs0t||jd�}|dkrd}t||j|d�dS�NrrS)r�r�r�)r%r�r�r�r��countr*r*r+r��sz_CountAction.__call__)NFN)Nr�r*r*r�r+r��s
�r�cs.eZdZeedf�fdd�	Zddd�Z�ZS)�_HelpActionNcstt|�j|||d|d�dS�Nr)r�r�r�r�rr)r�r�rQ)r%r�r�r�rrr�r*r+rQs
�z_HelpAction.__init__cCs|��|��dSr-)�
print_help�exitr�r*r*r+r�sz_HelpAction.__call__)N�rr2r3rrQr�r�r*r*r�r+r�s
�r�cs0eZdZdeedf�fdd�	Zddd�Z�ZS)�_VersionActionNz&show program's version number and exitcs$tt|�j|||d|d�||_dSr)r�rrQ�version)r%r�rr�r�rrr�r*r+rQs
�z_VersionAction.__init__cCsD|j}|dkr|j}|��}|�|�|�|��tj�|��dSr-)r�_get_formatterrg�_print_messagera�_sys�stdoutr)r%r�r�r�r�rrWr*r*r+r�(s
z_VersionAction.__call__)Nrr*r*r�r+rs�rcsPeZdZGdd�de�Zedddf�fdd�	Zdd�Zd	d
�Zd
dd�Z	�Z
S)�_SubParsersActioncseZdZ�fdd�Z�ZS)z&_SubParsersAction._ChoicesPseudoActioncs@|}}|r|dd�|�7}ttj|�}|jg|||d�dS)Nr�r)r�r�rrr�)r$r�r
�_ChoicesPseudoActionrQ)r%r(�aliasesrrr�r�Zsupr�r*r+rQ6s
�z/_SubParsersAction._ChoicesPseudoAction.__init__r�r*r*r�r+r4srFNc	s<||_||_i|_g|_tt|�j||t|j|||d�dS)N)r�r�r�r�r�rrr�)�_prog_prefix�
_parser_class�_name_parser_map�_choices_actionsr�r
rQr)r%r�rO�parser_classr�r�rrr�r�r*r+rQ>s	
�z_SubParsersAction.__init__cKs�|�d�dkr d|j|f|d<|�dd�}d|krX|�d�}|�|||�}|j�|�|jf|�}||j|<|D]}||j|<qr|S)NrOr�rr*rr)r�r
r�rrr rr)r%r(�kwargsrrrZ
choice_actionr��aliasr*r*r+�
add_parserUs

z_SubParsersAction.add_parsercCs|jSr-)rr1r*r*r+r�lsz!_SubParsersAction._get_subactionscCs�|d}|dd�}|jtk	r,t||j|�z|j|}Wn<tk
rv|d�|j�d�}td�|}t||��YnX|�|d�\}	}t	|	��
�D]\}
}t||
|�q�|r�t	|��tg�t
|t��|�dS)NrrSr)�parser_namer�z5unknown parser %(parser_name)r (choices: %(choices)s))r�rr�r�KeyErrorr$r�r�parse_known_argsr�r0�
setdefault�_UNRECOGNIZED_ARGS_ATTRr�r�)r%r�r�r�r�rr&r\�msgZsubnamespace�keyr)r*r*r+r�os$

�	z_SubParsersAction.__call__)N)rr2r3rrrrQrr�r�r�r*r*r�r+r
2s�r
c@seZdZddd�ZdS)�
_ExtendActionNcCs2t||jd�}t|�}|�|�t||j|�dSr-)r�r�r7r�r�r�r*r*r+r��s
z_ExtendAction.__call__)N)rr2r3r�r*r*r*r+r�src@s*eZdZdZddd�Zdd�Zd	d
�ZdS)ra�Factory for creating file object types

    Instances of FileType are typically passed as type= arguments to the
    ArgumentParser add_argument() method.

    Keyword Arguments:
        - mode -- A string indicating how the file is to be opened. Accepts the
            same values as the builtin open() function.
        - bufsize -- The file's desired buffer size. Accepts the same values as
            the builtin open() function.
        - encoding -- The file's encoding. Accepts the same values as the
            builtin open() function.
        - errors -- A string indicating how encoding and decoding errors are to
            be handled. Accepts the same value as the builtin open() function.
    �rr�NcCs||_||_||_||_dSr-)�_mode�_bufsize�	_encoding�_errors)r%�mode�bufsize�encoding�errorsr*r*r+rQ�szFileType.__init__c
Cs�|dkr>d|jkrtjSd|jkr(tjStd�|j}t|��zt||j|j|j|j	�WSt
k
r�}z"||d�}td�}t||��W5d}~XYnXdS)N�-r�wzargument "-" with mode %r)�filename�errorz$can't open '%(filename)s': %(error)s)rr�stdinr	r�r�r�rr r!�OSErrorr)r%�stringr�er\r�r*r*r+r��s

�
zFileType.__call__cCsT|j|jf}d|jfd|jfg}d�dd�|D�dd�|D��}dt|�j|fS)Nr$r%rcSsg|]}|dkrt|��qS)r�)r!)rZr'r*r*r+r]�sz%FileType.__repr__.<locals>.<listcomp>cSs$g|]\}}|dk	rd||f�qS)Nrr*)rZ�kwr'r*r*r+r]�s�r)rrr r!r$rr)r%r\rZargs_strr*r*r+r,�s�zFileType.__repr__)rr�NN)rr2r3r4rQr�r,r*r*r*r+r�s
c@s(eZdZdZdd�Zdd�Zdd�ZdS)	r
z�Simple object for storing attributes.

    Implements equality by attribute names and values, and provides a simple
    string representation.
    cKs|D]}t||||�qdSr-)r�)r%rr(r*r*r+rQ�szNamespace.__init__cCst|t�stSt|�t|�kSr-)r�r
�NotImplementedr�)r%�otherr*r*r+�__eq__�s
zNamespace.__eq__cCs
||jkSr-)r/)r%rr*r*r+�__contains__�szNamespace.__contains__N)rr2r3r4rQr1r2r*r*r*r+r
�scs�eZdZ�fdd�Zdd�Zd&dd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd'dd�Zdd�Zd d!�Zd"d#�Zd$d%�Z�ZS)(�_ActionsContainercstt|���||_||_||_||_i|_|�ddt	�|�ddt	�|�ddt
�|�ddt�|�ddt�|�ddt
�|�ddt�|�ddt�|�dd	t�|�dd
t�|�ddt�|�ddt�|��g|_i|_g|_g|_i|_t�d
�|_g|_dS)NrvZstoreZstore_const�
store_trueZstore_falser Zappend_constr�rrr�parsersr�z^-\d+$|^-\d*\.\d+$)r�r3rQ�description�argument_default�prefix_chars�conflict_handler�_registries�registerr�r�r�r�r�r�r�r�rr
r�_get_handler�_actions�_option_string_actions�_action_groups�_mutually_exclusive_groups�	_defaultsrJrK�_negative_number_matcher�_has_negative_number_optionals)r%r6r8r7r9r�r*r+rQ�s4z_ActionsContainer.__init__cCs|j�|i�}|||<dSr-)r:r)r%�
registry_namer)r��registryr*r*r+r;sz_ActionsContainer.registerNcCs|j|�||�Sr-)r:r�)r%rDr)r�r*r*r+�
_registry_get sz_ActionsContainer._registry_getcKs2|j�|�|jD]}|j|kr||j|_qdSr-)rA�updater=r�r�)r%rrvr*r*r+�set_defaults&s

z_ActionsContainer.set_defaultscCs8|jD]"}|j|kr|jdk	r|jSq|j�|d�Sr-)r=r�r�rAr�)r%r�rvr*r*r+�get_default/s
z_ActionsContainer.get_defaultcOsD|j}|r&t|�dkrH|dd|krH|r:d|kr:td��|j||�}n|j||�}d|kr�|d}||jkr~|j||d<n|jdk	r�|j|d<|�|�}t|�s�td|f��|f|�}|�	d|j
|j
�}t|�s�td	|f��|tkr�td
|f��t|d��r:z|�
��|d�Wntk
�r8td��YnX|�|�S)
z�
        add_argument(dest, ..., name=value, ...)
        add_argument(option_string, option_string, ..., name=value, ...)
        rSrr�z+dest supplied twice for positional argumentr�Nzunknown action "%s"r�%r is not callablez<%r is a FileType class object, instance of it must be passedrz,length of metavar tuple does not match nargs)r8ror��_get_positional_kwargs�_get_optional_kwargsrAr7�_pop_action_class�callablerFrrr�rr�r��_add_action)r%r\r�charsr�Zaction_classrv�	type_funcr*r*r+rx9s:	 




�z_ActionsContainer.add_argumentcOs t|f|�|�}|j�|�|Sr-)�_ArgumentGroupr?r )r%r\rr�r*r*r+�add_argument_grouplsz$_ActionsContainer.add_argument_groupcKst|f|�}|j�|�|Sr-)�_MutuallyExclusiveGroupr@r )r%rr�r*r*r+�add_mutually_exclusive_groupqsz._ActionsContainer.add_mutually_exclusive_groupcCs`|�|�|j�|�||_|jD]}||j|<q"|jD]"}|j�|�r8|js8|j�d�q8|S)NT)	�_check_conflictr=r �	containerr�r>rB�matchrC)r%rvr�r*r*r+rOvs


z_ActionsContainer._add_actioncCs|j�|�dSr-)r=�remover�r*r*r+�_remove_action�sz _ActionsContainer._remove_actioncCs�i}|jD].}|j|kr.td�}t||j��|||j<q
i}|jD]D}|j|krn|j|j|j|jd�||j<|jD]}||j||<qtqD|jD]&}|j	|j
d�}|jD]}|||<q�q�|jD]}|�||��
|�q�dS)Nz.cannot merge actions - two groups are named %r)�titler6r9)r�)r?r[r�r�rSr6r9r�r@rUr�r=r�rO)r%rWZtitle_group_mapr�rZ	group_maprv�mutex_groupr*r*r+�_add_container_actions�s0



�

�

z(_ActionsContainer._add_container_actionscKs^d|krtd�}t|��|�d�ttfkr2d|d<|�d�tkrPd|krPd|d<t||gd�S)Nr�z1'required' is an invalid argument for positionalsr�Tr��r�r�)r�r�r�r
rr�)r%r�rrr*r*r+rK�sz(_ActionsContainer._get_positional_kwargsc	Os�g}g}|D]n}|d|jkr>||jd�}td�}t||��|�|�|d|jkrt|�dkr|d|jkr|�|�q|�dd�}|dkr�|r�|d}n|d}|�|j�}|s�td�}t||��|�dd�}t|||d	�S)
Nr)�optionr8zNinvalid option string %(option)r: must start with a character %(prefix_chars)rrSr�z%dest= is required for options like %rr&r�r^)	r8r�r�r ror��lstrip�replacer�)	r%r\rr�Zlong_option_stringsr�rr�Zdest_option_stringr*r*r+rL�s2�

z&_ActionsContainer._get_optional_kwargscCs|�d|�}|�d||�S)Nrv)r�rF)r%rr�rvr*r*r+rM�sz#_ActionsContainer._pop_action_classcCsFd|j}zt||�WStk
r@td�}t||j��YnXdS)Nz_handle_conflict_%sz%invalid conflict_resolution value: %r)r9r�r�r�r�)r%Zhandler_func_namerr*r*r+r<�s
z_ActionsContainer._get_handlercCsLg}|jD]&}||jkr
|j|}|�||f�q
|rH|��}|||�dSr-)r�r>r r<)r%rvZconfl_optionalsr�Zconfl_optionalr9r*r*r+rV�s


z!_ActionsContainer._check_conflictcCs6tddt|��}d�dd�|D��}t|||��dS)Nzconflicting option string: %szconflicting option strings: %srcSsg|]\}}|�qSr*r*)rZr�rvr*r*r+r]	s�z<_ActionsContainer._handle_conflict_error.<locals>.<listcomp>)rror$r)r%rv�conflicting_actionsr�Zconflict_stringr*r*r+�_handle_conflict_errors�
�z(_ActionsContainer._handle_conflict_errorcCs>|D]4\}}|j�|�|j�|d�|js|j�|�qdSr-)r�rYr>r�rWrZ)r%rvrbr�r*r*r+�_handle_conflict_resolves
z*_ActionsContainer._handle_conflict_resolve)N)N)rr2r3rQr;rFrHrIrxrSrUrOrZr]rKrLrMr<rVrcrdr�r*r*r�r+r3�s$5
	
3($
		r3cs6eZdZd�fdd�	Z�fdd�Z�fdd�Z�ZS)	rRNcs�|j}|d|j�|d|j�|d|j�tt|�j}|fd|i|��||_g|_|j	|_	|j
|_
|j|_|j|_|j
|_
|j|_dS)Nr9r8r7r6)rr9r8r7r�rRrQr[r�r:r=r>rArCr@)r%rWr[r6rrGZ
super_initr�r*r+rQs�z_ArgumentGroup.__init__cs tt|��|�}|j�|�|Sr-)r�rRrOr�r r�r�r*r+rO5sz_ArgumentGroup._add_actioncs tt|��|�|j�|�dSr-)r�rRrZr�rYr�r�r*r+rZ:sz_ArgumentGroup._remove_action)NN�rr2r3rQrOrZr�r*r*r�r+rRsrRcs.eZdZd�fdd�	Zdd�Zdd�Z�ZS)	rTFcs tt|��|�||_||_dSr-)r�rTrQr��
_container)r%rWr�r�r*r+rQAsz _MutuallyExclusiveGroup.__init__cCs2|jrtd�}t|��|j�|�}|j�|�|S)Nz-mutually exclusive arguments must be optional)r�r�r�rfrOr�r )r%rvrr*r*r+rOFsz#_MutuallyExclusiveGroup._add_actioncCs|j�|�|j�|�dSr-)rfrZr�rYr�r*r*r+rZNsz&_MutuallyExclusiveGroup._remove_action)Frer*r*r�r+rT?srTcs*eZdZdZddddgeddddddf�fdd�	Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dAdd�ZdBdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdCd&d'�ZdDd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdEd6d7�ZdFd8d9�ZdGd:d;�ZdHd=d>�Z d?d@�Z!�Z"S)Ira�Object for parsing command line strings into Python objects.

    Keyword Arguments:
        - prog -- The name of the program (default: sys.argv[0])
        - usage -- A usage message (default: auto-generated from arguments)
        - description -- A description of what the program does
        - epilog -- Text following the argument descriptions
        - parents -- Parsers whose arguments should be copied into this one
        - formatter_class -- HelpFormatter class for printing help messages
        - prefix_chars -- Characters that prefix optional arguments
        - fromfile_prefix_chars -- Characters that prefix files containing
            additional arguments
        - argument_default -- The default value for all arguments
        - conflict_handler -- String indicating how to handle conflicts
        - add_help -- Add a -h/-help option
        - allow_abbrev -- Allow long options to be abbreviated unambiguously
    Nr&r)Tc
	s"tt|�j}
|
|||	|
d�|dkr6tj�tjd�}||_||_	||_
||_||_||_
||_|j}|td��|_|td��|_d|_dd�}|�dd|�d|kr�dn|d}|j
r�|j|d	|d
ddttd�d
�|D]<}|�|�z
|j}Wntk
�rYq�X|j�|�q�dS)N)r6r8r7r9rzpositional argumentszoptional argumentscSs|Sr-r*)r,r*r*r+�identity�sz)ArgumentParser.__init__.<locals>.identityrr&�hr8rrzshow this help message and exit)rvr�rr)r�rrQ�_os�path�basenamer�argvrOri�epilog�formatter_class�fromfile_prefix_chars�add_help�allow_abbrevrSr��_positionals�
_optionals�_subparsersr;rxrr]rAr�rG)r%rOrir6rm�parentsrnr8ror7r9rprqZ	superinitZ	add_grouprgZdefault_prefixrX�defaultsr�r*r+rQfsJ�
�

zArgumentParser.__init__cs"ddddddg}�fdd�|D�S)	NrOrir6rnr9rpcsg|]}|t�|�f�qSr*r�r�r1r*r+r]�sz.ArgumentParser._get_kwargs.<locals>.<listcomp>r*r�r*r1r+r"�s�zArgumentParser._get_kwargsc	Ks�|jdk	r|�td��|�dt|��d|ks8d|krht|�dd��}t|�dd��}|�||�|_n|j|_|�d�dkr�|�	�}|�
�}|j}|�|j
||d�|����|d<|�|d�}|fd	gi|��}|j�|�|S)
Nz(cannot have multiple subparser argumentsrr[r6ZsubcommandsrOr^r5r�)rtr)r�rrr�rSrrr�r�_get_positional_actionsr@rmrirar|rMrO)	r%rr[r6rWr�rkZ
parsers_classrvr*r*r+�add_subparsers�s$
zArgumentParser.add_subparserscCs$|jr|j�|�n|j�|�|Sr-)r�rsrOrrr�r*r*r+rO�szArgumentParser._add_actioncCsdd�|jD�S)NcSsg|]}|jr|�qSr*�r��rZrvr*r*r+r]�s�z8ArgumentParser._get_optional_actions.<locals>.<listcomp>�r=r1r*r*r+�_get_optional_actions�s�z$ArgumentParser._get_optional_actionscCsdd�|jD�S)NcSsg|]}|js|�qSr*ryrzr*r*r+r]�s�z:ArgumentParser._get_positional_actions.<locals>.<listcomp>r{r1r*r*r+rw�s�z&ArgumentParser._get_positional_actionscCs4|�||�\}}|r0td�}|�|d�|��|S�Nzunrecognized arguments: %sr)rr�r)r$�r%r\r�rlrr*r*r+�
parse_args�s
zArgumentParser.parse_argscCs|dkrtjdd�}nt|�}|dkr.t�}|jD]4}|jtk	r4t||j�s4|jtk	r4t	||j|j�q4|j
D] }t||�spt	|||j
|�qpz>|�||�\}}t|t�r�|�
t|t��t|t�||fWStk
�rt��d}|�t|��YnXdSrR)rrlr5r
r=r�rr�r�r�rA�_parse_known_argsrr�r��delattrr�exc_infor)r�)r%r\r�rvr��errr*r*r+r�s,







zArgumentParser.parse_known_argscs�	jdk	r�	����i��	jD]R}|j}t|j�D]<\}}��|g�}|�|d|��|�||dd��q2qi�g}t��}	t|	�D]^\}}
|
dkr�|�d�|	D]}
|�d�q�q��	�	|
�}|dkr�d}n|�|<d}|�|�q�d�
|��t��t��d�����	fdd�	������	�fd	d
�}
�	�������	�fdd�}g�d
�
��r`t
��}nd}�
|k�r�t�
fdd��D��}�
|k�r�|�
�}|�
k�r�|�
�qdn|�
�
�k�r҈�
|�}��|�|�
|
�
��
�qd|�
�}���|d��g}�	jD]|}|�k�r|j�r(|�t|��nT|jdk	�rt|jt��rt�|j��r|jt�|j�k�rt�|j�	�||j���q|�r��	�td�d�
|���	jD]X}|j�r�|jD]}|�k�r��q��q�dd�|jD�}td�}�	�|d�
|���q���fS)NrS�--r&�A�Or^cs|��|���||�}||jk	rb��|���|g�D]*}|�kr6td�}t|�}t|||��q6|tk	rx|��||�dS)Nznot allowed with argument %s)r��_get_valuesr�r�r�r�rr)rvZargument_stringsr�Zargument_valuesZconflict_actionrZaction_name)�action_conflictsr��seen_actions�seen_non_default_actionsr%r*r+�take_action@s


z5ArgumentParser._parse_known_args.<locals>.take_actioncs~�|}|\}}}�j}g}|dkr:���|�|dS|dk	�r||d�}�j}|dkr�|d|kr�|�|g|f�|d}	|	|d}|dd�p�d}
�j}||kr�||}|
}ntd�}t|||��nB|dkr�|d}
|g}|�|||f��q\ntd�}t|||��q|d}�|d�}|||�}||}
�||
�}|�|||f��q\q|D]\}}}�|||��q`|
S)NrSr�rzignored explicit argument %r)�_match_argumentr r8r>r�r)�start_index�option_tuplervr��explicit_argZmatch_argumentZ
action_tuples�	arg_countrP�charZnew_explicit_argZ
optionals_mapr�stopr\r�Zselected_patterns)r&�arg_strings_pattern�extras�option_string_indicesr%r�r*r+�consume_optionalUsL



z:ArgumentParser._parse_known_args.<locals>.consume_optionalcsn�j}�|d�}|�|�}t�|�D]*\}}�|||�}||7}�||�q&�t|�d��dd�<|Sr-)�_match_arguments_partial�zipro)r�Z
match_partialZselected_patternZ
arg_countsrvr�r\)r&r�r�r%r�r*r+�consume_positionals�s
z=ArgumentParser._parse_known_args.<locals>.consume_positionalsrr�csg|]}|�kr|�qSr*r*)rZr�)r�r*r+r]�s�z4ArgumentParser._parse_known_args.<locals>.<listcomp>z(the following arguments are required: %srcSsg|]}|jtk	rt|��qSr*)rrrr�rzr*r*r+r]�s
�z#one of the arguments %s is requiredr)N)ro�_read_args_from_filesr@r�r�rr��iterr �_parse_optionalr$r�rwrAr@r=r�r�r�r�r�r�r�r�r��
_get_valuer)r�)r%r&r�r\r�r�Zmutex_actionZ	conflictsZarg_string_pattern_partsZarg_strings_iter�
arg_stringr��patternr�r�Zmax_option_string_indexZnext_option_string_indexZpositionals_end_indexZstringsZ
stop_indexZrequired_actionsrvr�r�rr*)r�r&r�r�r�r�r�r�r�r%r�r�r+r�s�





J

�






�
���
�



�z ArgumentParser._parse_known_argsc
Cs�g}|D]�}|r|d|jkr*|�|�qzdt|dd���J}g}|����D]}|�|�D]}|�|�q\qN|�|�}|�|�W5QRXWqtk
r�t	�
�d}|�t|��YqXq|Sr�)
ror r��readr��convert_arg_line_to_argsr�r�r+rr�r)r�)r%r&Znew_arg_stringsr�Z	args_file�arg_liner'r�r*r*r+r�s 
z$ArgumentParser._read_args_from_filescCs|gSr-r*)r%r�r*r*r+r�!sz'ArgumentParser.convert_arg_line_to_argscCsz|�|�}t�||�}|dkrldtd�ttd�ttd�i}|�|j�}|dkrbtdd|j�|j}t	||��t
|�d��S)Nzexpected one argumentzexpected at most one argumentzexpected at least one argumentzexpected %s argumentzexpected %s argumentsrS)�_get_nargs_patternrJrXr�r
rr�r�rrror�)r%rvr��
nargs_patternrXZnargs_errorsrr*r*r+r�$s(
���
zArgumentParser._match_argumentcsrg}tt|�dd�D]X}|d|�}d��fdd�|D��}t�||�}|dk	r|�dd�|��D��qnq|S)Nrr�r^csg|]}��|��qSr*)r�rzr1r*r+r]@s�z;ArgumentParser._match_arguments_partial.<locals>.<listcomp>cSsg|]}t|��qSr*rn)rZr,r*r*r+r]Ds)r�ror$rJrXr�rk)r%rjr�r�r�Z
actions_slicer�rXr*r1r+r�:s�z'ArgumentParser._match_arguments_partialc
Cs|sdS|d|jkrdS||jkr8|j|}||dfSt|�dkrHdSd|kr~|�dd�\}}||jkr~|j|}|||fS|�|�}t|�dkr�d�dd�|D��}||d�}td�}|�||�nt|�dkr�|\}	|	S|j�	|�r�|j
s�dSd	|k�rdSd|dfS)
NrrS�=rcSsg|]\}}}|�qSr*r*)rZrvr�r�r*r*r+r]is�z2ArgumentParser._parse_optional.<locals>.<listcomp>)r_Zmatchesz4ambiguous option: %(option)s could match %(matches)sr)r8r>ro�split�_get_option_tuplesr$r�r)rBrXrC)
r%r�rvr�r�Z
option_tuplesZoptionsr\rr�r*r*r+r�Js>







�

zArgumentParser._parse_optionalc
Cs0g}|j}|d|kr�|d|kr�|jr~d|krB|�dd�\}}n|}d}|jD],}|�|�rP|j|}|||f}|�|�qPn�|d|k�r|d|k�r|}d}|dd�}|dd�}	|jD]T}||kr�|j|}|||	f}|�|�q�|�|�r�|j|}|||f}|�|�q�n|�td�|�|S)NrrSr�r8zunexpected option string: %s)r8rqr�r>�
startswithr r)r�)
r%r�r�rPZ
option_prefixr�rvr�Zshort_option_prefixZshort_explicit_argr*r*r+r��s:









z!ArgumentParser._get_option_tuplescCs�|j}|dkrd}nf|tkr"d}nX|tkr0d}nJ|tkr>d}n<|tkrLd}n.|tkrZd}n |tkrhd}ndd	�d
|�}|jr�|�	d	d�}|�	dd�}|S)
Nz(-*A-*)z(-*A?-*)z	(-*[A-]*)z
(-*A[A-]*)z([-AO]*)z(-*A[-AO]*)z(-*-*)z(-*%s-*)z-*r�r^r&)
r�r
rrrrrr$r�ra)r%rvr�r�r*r*r+r��s(z!ArgumentParser._get_nargs_patterncCs4|�||�\}}|r0td�}|�|d�|��|Sr})�parse_known_intermixed_argsr�r)r$r~r*r*r+�parse_intermixed_args�s
z$ArgumentParser.parse_intermixed_argsc	s�|���dd��D�}|r,td|dj���fdd�|jD�rHtd���zN|j}z�|jdkrp|��dd�|_�D] }|j|_t	|_|j|_t	|_qt|�
||�\}}�D]J}t||j�r�t
||j�gkr�ddlm}|d	|j|f�t||j�q�W5�D]}|j|_|j|_q�X|��}zJ|D]}|j|_d
|_�q$|jD]}	|	j|	_d
|	_�q@|�
||�\}}
W5|D]}|j|_�qn|jD]}	|	j|	_�q�XW5||_X||
fS)NcSsg|]}|jttfkr|�qSr*)r�rrrzr*r*r+r]�s�z>ArgumentParser.parse_known_intermixed_args.<locals>.<listcomp>z3parse_intermixed_args: positional arg with nargs=%srcs&g|]}|jD]}|�kr|j�qqSr*)r�r�)rZr�rv�r�r*r+r]�s
�z;parse_intermixed_args: positional in mutuallyExclusiveGroup�)�warnzDo not expect %s in %sF)rwr�r�r@riZ
save_nargsZsave_defaultr��format_usagerrr�r�r��warningsr�r�r|Z
save_requiredr�)r%r\r��aZ
save_usagervZremaining_argsr�r�r�r�r*r�r+r��s`
�
��


�
z*ArgumentParser.parse_known_intermixed_argscs��jttfkr2z|�d�Wntk
r0YnX|sz�jtkrz�jrN�j}n�j}t	|t
�rv���|�}���|��n|s��jt
kr��js��jdk	r��j}n|}���|�n�t|�dkr�jdtfkr�|\}���|�}���|�n��jtk�r��fdd�|D�}np�jtk�r@��fdd�|D�}���|d�n>�jtk�rRt}n,��fdd�|D�}|D]}���|��qj|S)Nr�rScsg|]}���|��qSr*�r��rZ�v�rvr%r*r+r]Z	sz.ArgumentParser._get_values.<locals>.<listcomp>csg|]}���|��qSr*r�r�r�r*r+r]^	srcsg|]}���|��qSr*r�r�r�r*r+r]g	s)r�rrrYr�r
r�r�r�r�r�r��_check_valuerror)r%rvr&r)r�r�r*r�r+r�6	sD
�
zArgumentParser._get_valuesc	Cs�|�d|j|j�}t|�s0td�}t|||��z||�}Wn�tk
r~t|jdt|j��}tt	�
�d�}t||��YnLttfk
r�t|jdt|j��}||d�}td�}t|||��YnX|S)NrrJrrS)rr)z!invalid %(type)s value: %(value)r)
rFrrNr�rrr�r!r�rr�r�r�)r%rvr�rQrr�r(r\r*r*r+r�n	s 
zArgumentParser._get_valuecCsF|jdk	rB||jkrB|d�tt|j��d�}td�}t|||��dS)Nr)r)r�z3invalid choice: %(value)r (choose from %(choices)s))r�r$�mapr!r�r)r%rvr)r\rr*r*r+r��	s�zArgumentParser._check_valuecCs$|��}|�|j|j|j�|��Sr-)rrmrir=r@ra)r%rWr*r*r+r��	s
�zArgumentParser.format_usagecCst|��}|�|j|j|j�|�|j�|jD]0}|�|j	�|�|j�|�
|j�|��q.|�|j
�|��Sr-)rrmrir=r@rgr6r?rcr[ryr�rdrmra)r%rWZaction_groupr*r*r+ra�	s�

zArgumentParser.format_helpcCs|j|jd�S)Nr~)rnrOr1r*r*r+r�	szArgumentParser._get_formattercCs"|dkrtj}|�|��|�dSr-)rr	rr��r%�filer*r*r+�print_usage�	szArgumentParser.print_usagecCs"|dkrtj}|�|��|�dSr-)rr	rrar�r*r*r+r�	szArgumentParser.print_helpcCs |r|dkrtj}|�|�dSr-)r�stderr�write)r%r�r�r*r*r+r�	szArgumentParser._print_messagercCs |r|�|tj�t�|�dSr-)rrr�r)r%Zstatusr�r*r*r+r�	szArgumentParser.exitcCs0|�tj�|j|d�}|�dtd�|�dS)z�error(message: string)

        Prints a usage message incorporating the message to stderr and
        exits.

        If you override this in a subclass, it should not return -- it
        should either exit or raise an exception.
        )rOr�r8z%(prog)s: error: %(message)s
N)r�rr�rOrr�)r%r�r\r*r*r+r)�	s	zArgumentParser.error)NN)NN)NN)NN)N)N)N)rN)#rr2r3r4rrQr"rxrOr|rwrrr�r�r�r�r�r�r�r�r�r�r�r�r�r�rarr�rrrr)r�r*r*r�r+rSsV�@

#w:-1

M8


	
)3r4�__version__�__all__�osri�rerJZshutilr;�sysrrr�rrr
rrrrrr�rr7rrrrr	r��	Exceptionrrrr�r�r�r�r�r�r�r�rr
rrr
r3rRrTrr*r*r*r+�<module>s�=�z
	[#&]7:"inspect.cpython-38.opt-2.pyc000064400000153635150335716500011623 0ustar00U

e5d��@s�dZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlmZddlmZmZe�Zej��D]\ZZeede<q�dZdd�Zd	d
�Zdd�Z d
d�Z!dd�Z"e#ed��rdd�Z$ndd�Z$e#ed��r&dd�Z%ndd�Z%dd�Z&dd�Z'dd�Z(dd �Z)d!d"�Z*d#d$�Z+d%d&�Z,d'd(�Z-d)d*�Z.d+d,�Z/d-d.�Z0d/d0�Z1d1d2�Z2d3d4�Z3d5d6�Z4d�d7d8�Z5ed9d:�Z6d;d<�Z7d=d>�Z8dd?�d@dA�Z9dBdC�Z:dDdE�Z;dFdG�Z<dHdI�Z=dJdK�Z>dLdM�Z?dNdO�Z@dPdQ�ZAd�dRdS�ZBiZCiZDd�dTdU�ZEdVdW�ZFdXdY�ZGGdZd[�d[eH�ZIGd\d]�d]�ZJd^d_�ZKd`da�ZLdbdc�ZMddde�ZNd�dgdh�ZOedidj�ZPdkdl�ZQedmdn�ZRdodp�ZSedqdr�ZTdsdt�ZUedudv�ZVdwdx�ZWd�dydz�ZXd{d|�ZYdddd}iieZd~d�d�d�d�d�d�d�eXfd�d��Z[eZd�d�d�d�d�d�fd�d��Z\d�d��Z]d�d��Z^d�d��Z_ed�d��Z`d�d��Zaed�d��Zbd�d�d��Zcd�d��Zded�d�ebje�Zfd�d�d��Zgd�d�d��Zhd�d��Zid�d�d��Zjd�d�d��Zkel�Zmd�d��Znd�d��Zod�d��Zpd�d��Zqd�d��Zremfd�d��Zsd�Ztd�Zud�Zvd�Zwd�d��Zxd�d��Zyd�Zzd�Z{d�Z|d�Z}d�d��Z~d�d„Ze�e�j��Z�e�e�j��Z�e�e�j�d��Z�e�e�e�ej�fZ�d�dńZ�d�d�dDŽZ�d�dɄZ�d�d˄Z�d�d̈́Z�d�dτZ�d�dфZ�d�d�dԄZ�d�d�dքZ��dd�d؄Z�d�d�dٜd�dۄZ�Gd�d݄d݃Z�Gd�d߄d߃Z�Gd�d�d�ej��Z�e�j�Z�e�j�Z�e�j�Z�e�j�Z�e�j�Z�e�d�e�d�e�d�e�d�e�d�iZ�Gd�d�d�Z�Gd�d�d�Z�Gd�d�d�Z�d�d�d�d�Z�d�d�Z�e�d�k�r�e��dS()zKa-Ping Yee <ping@lfw.org>z'Yury Selivanov <yselivanov@sprymix.com>�N)�
attrgetter)�
namedtuple�OrderedDictZCO_icCst|tj�S�N)�
isinstance�types�
ModuleType��object�r�/usr/lib64/python3.8/inspect.py�ismodule?sr
cCs
t|t�Sr)r�typer	rrr�isclassHsrcCst|tj�Sr)rr�
MethodTyper	rrr�ismethodPsrcCs:t|�st|�st|�rdSt|�}t|d�o8t|d�S)NF�__get__�__set__�rr�
isfunctionr�hasattr�r
�tprrr�ismethoddescriptorZsrcCs8t|�st|�st|�rdSt|�}t|d�p6t|d�S)NFr�
__delete__rrrrr�isdatadescriptornsr�MemberDescriptorTypecCst|tj�Sr)rrrr	rrr�ismemberdescriptor~srcCsdS�NFrr	rrrr�s�GetSetDescriptorTypecCst|tj�Sr)rrrr	rrr�isgetsetdescriptor�sr cCsdSrrr	rrrr �scCst|tj�Sr)rr�FunctionTyper	rrrr�srcCs6t|�r|j}qt�|�}t|�s&dSt|jj|@�Sr)r�__func__�	functools�_unwrap_partialr�bool�__code__�co_flags)�f�flagrrr�_has_code_flag�s
r*cCs
t|t�Sr)r*ZCO_GENERATOR��objrrr�isgeneratorfunction�sr-cCs
t|t�Sr)r*ZCO_COROUTINEr+rrr�iscoroutinefunction�sr.cCs
t|t�Sr)r*ZCO_ASYNC_GENERATORr+rrr�isasyncgenfunction�sr/cCst|tj�Sr)rr�AsyncGeneratorTyper	rrr�
isasyncgen�sr1cCst|tj�Sr)rr�
GeneratorTyper	rrr�isgenerator�sr3cCst|tj�Sr)rr�
CoroutineTyper	rrr�iscoroutine�sr5cCs6t|tj�p4t|tj�r(t|jjt@�p4t|tj	j
�Sr)rrr4r2r%�gi_coder'ZCO_ITERABLE_COROUTINE�collections�abc�	Awaitabler	rrr�isawaitable�s��r:cCst|tj�Sr)rr�
TracebackTyper	rrr�istraceback�sr<cCst|tj�Sr)rr�	FrameTyper	rrr�isframe�sr>cCst|tj�Sr)rr�CodeTyper	rrr�iscodesr@cCst|tj�Sr)rr�BuiltinFunctionTyper	rrr�	isbuiltinsrBcCs t|�pt|�pt|�pt|�Sr)rBrrrr	rrr�	isroutine&s���rCcCs�t|t�sdS|jt@rdStt|�tj�s0dSt|d�r>dS|j�	�D]\}}t
|dd�rHdSqH|jD]6}t
|dd�D]$}t
||d�}t
|dd�rzdSqzqjdS)NFT�__abstractmethods__�__isabstractmethod__r)rr�	__flags__�TPFLAGS_IS_ABSTRACT�
issubclassr8�ABCMetar�__dict__�items�getattr�	__bases__)r
�name�value�baserrr�
isabstract-s"



rQc	Cst|�r|ft|�}nd}g}t�}t|�}z:|jD].}|j��D]\}}t|tj	�rD|�
|�qDq6Wntk
r|YnX|D]~}	zt||	�}
|	|kr�t�Wn:tk
r�|D]}|	|jkr�|j|	}
q�q�Yq�YnX|r�||
�r�|�
|	|
f�|�
|	�q�|jdd�d�|S)NrcSs|dS)Nrr)Zpairrrr�<lambda>n�zgetmembers.<locals>.<lambda>��key)r�getmro�set�dirrMrJrKrr�DynamicClassAttribute�append�AttributeErrorrL�add�sort)r
Z	predicate�mro�results�	processed�namesrP�k�vrUrOrrr�
getmembersEs:




rd�	Attributezname kind defining_class objectcCsTt|�}tt|��}tdd�|D��}|f|}||}t|�}|D].}|j��D]\}}t|tj�rR|�	|�qRqDg}	t
�}
|D�]�}d}d}
d}||
k�rzz|dkr�td��t||�}
Wn"tk
r�}zW5d}~XYn�Xt|
d|�}||k�rzd}d}|D] }t||d�}||
k�r|}�q|D]B}z|�
||�}Wntk
�rXY�q(YnX||
k�r(|}�q(|dk	�rz|}|D]0}||jk�r~|j|}||k�r�|}�q��q~|dk�r�q�|
dk	�r�|
n|}t|ttjf��r�d}|}nFt|ttjf��rd}|}n*t|t��rd}|}nt|��r,d	}nd
}|	�	t||||��|
�|�q�|	S)Ncss|]}|ttfkr|VqdSr)rr
)�.0�clsrrr�	<genexpr>�sz'classify_class_attrs.<locals>.<genexpr>rJz)__dict__ is special, don't want the proxy�__objclass__z
static methodzclass method�property�method�data)rVr�tuplerXrJrKrrrYrZrW�	ExceptionrL�__getattr__r[�staticmethod�BuiltinMethodType�classmethod�ClassMethodDescriptorTyperjrCrer\)rgr^ZmetamroZclass_basesZ	all_basesrarPrbrc�resultr`rNZhomeclsZget_objZdict_obj�excZlast_clsZsrch_clsZsrch_objr,�kindrrr�classify_class_attrsss�












rwcCs|jSr)�__mro__)rgrrrrV�srV��stopcs|�dkrdd�}n�fdd�}|}t|�|i}t��}||�rx|j}t|�}||ks`t|�|krntd�|���|||<q6|S)NcSs
t|d�S�N�__wrapped__�r�r(rrr�_is_wrapper�szunwrap.<locals>._is_wrappercst|d�o�|�Sr{r}r~ryrrrsz!wrapper loop when unwrapping {!r})�id�sys�getrecursionlimitr|�len�
ValueError�format)�funcrzrr(ZmemoZrecursion_limitZid_funcrryr�unwrap�s

r�cCs|��}t|�t|���Sr)�
expandtabsr��lstrip)�lineZexplinerrr�
indentsizesr�cCsNtj�|j�}|dkrdS|j�d�dd�D]}t||�}q.t|�sJdS|S)N�.���)r��modules�get�
__module__�__qualname__�splitrLr)r�rgrNrrr�
_findclasssr�c	Cst|�rT|jD]@}|tk	rz
|j}Wntk
r<YqYnX|dk	r|SqdSt|�r�|jj}|j}t|�r�t	t	||d�d�|jkr�|}n|j
}�n$t|�r�|j}t|�}|dks�t	||�|k	r�dSn�t
|��r|j}|j}t|��r|jd||jk�r|}n|j
}n�t|t��rP|j}|j}t|�}|dk�sJt	||�|k	�r�dSnnt|��sdt|��r�|j}|j}t	||�|k	�r�dSt|��r�t	|dd�}t|t��r�||k�r�||SndS|jD]F}zt	||�j}Wntk
�r�Y�q�YnX|dk	�r�|S�q�dS)Nr"r��	__slots__)rrxr
�__doc__r[rr"�__name__�__self__rL�	__class__rr�rBr�rrj�fgetrrrir�dict)r,rP�docrN�selfrgr��slotsrrr�_finddoc sn



�


�



r�c	Cshz
|j}Wntk
r YdSX|dkrRzt|�}Wnttfk
rPYdSXt|t�s`dSt|�Sr)r�r[r��	TypeErrorr�str�cleandoc)r
r�rrr�getdoc^s

r�cCs�z|���d�}Wntk
r(YdSXtj}|dd�D]*}t|���}|r<t|�|}t||�}q<|r||d��|d<|tjkr�tdt|��D]}|||d�||<q�|r�|ds�|�	�q�|r�|ds�|�	d�q�d�
|�SdS)N�
�rr�)r�r��UnicodeErrorr��maxsizer�r��min�range�pop�join)r��linesZmarginr�Zcontent�indent�irrrr�qs(

r�cCs�t|�r(t|dd�r|jStd�|���t|�rht|d�rZtj�	|j
�}t|dd�rZ|jStd�|���t|�rv|j}t
|�r�|j}t|�r�|j}t|�r�|j}t|�r�|jStd�t|�j���dS)N�__file__z{!r} is a built-in moduler�z{!r} is a built-in classzVmodule, class, method, function, traceback, frame, or code object was expected, got {})r
rLr�r�r�rrr�r�r�r�rr"rr&r<�tb_framer>�f_coder@�co_filenamerr�)r
�modulerrr�getfile�s.
�r�cCsTtj�|�}dd�tj��D�}|��|D]"\}}|�|�r,|d|�Sq,dS)NcSsg|]}t|�|f�qSr)r�)rf�suffixrrr�
<listcomp>�s�z!getmodulename.<locals>.<listcomp>)�os�path�basename�	importlib�	machinery�all_suffixesr]�endswith)r�Zfname�suffixesZneglenr�rrr�
getmodulename�s�
r�cs�t|��tjjdd�}|tjjdd�7}t�fdd�|D��r`tj���dtjj	d�nt�fdd�tjj
D��r~dStj���r��Stt
|��dd�dk	r��S�tjkr��SdS)Nc3s|]}��|�VqdSr�r��rf�s��filenamerrrh�sz getsourcefile.<locals>.<genexpr>rc3s|]}��|�VqdSrr�r�r�rrrh�s�
__loader__)r�r�r��DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXES�anyr�r��splitext�SOURCE_SUFFIXES�EXTENSION_SUFFIXES�existsrL�	getmodule�	linecache�cache)r
Zall_bytecode_suffixesrr�r�
getsourcefile�s"
��
r�cCs,|dkrt|�pt|�}tj�tj�|��Sr)r�r�r�r��normcase�abspath)r
�	_filenamerrr�
getabsfile�sr�c
Cs�t|�r|St|d�r$tj�|j�S|dk	rD|tkrDtj�t|�Szt||�}Wntk
rhYdSX|tkr�tj�t|�Stj�	��
�D]\\}}t|�r�t|d�r�|j}|t�|d�kr�q�|t|<t|�}|j
t|<ttj�|�<q�|tk�rtj�t|�Stjd}t|d��s"dSt||j
��rJt||j
�}||k�rJ|Stjd}t||j
��r|t||j
�}	|	|k�r||SdS)Nr�r��__main__r��builtins)r
rr�r�r�r��
modulesbyfiler�r��copyrKr��_filesbymodnamer�r�r��realpathrL)
r
r��file�modnamer�r(�mainZ
mainobjectZbuiltinZ
builtinobjectrrrr��sJ
�

�




r�cCs�t|�}|rt�|�n$t|�}|�d�r4|�d�s<td��t||�}|rZt�||j	�}n
t�|�}|sptd��t
|�r�|dfSt|��r |j}t
�d|d�}g}tt|��D]F}|�||�}|r�||ddkr�||fS|�|�d	�|f�q�|�r|��||dd	fStd
��t|��r0|j}t|��r@|j}t|��rP|j}t|��r`|j}t|��r�t|d��s~td��|jd	}	t
�d
�}|	dk�r�z||	}
Wnt k
�r�td��YnX|�|
��rؐq�|	d	}	�q�||	fStd��dS)N�<�>zsource code not availablezcould not get source coderz^(\s*)class\s*z\b�cr�zcould not find class definition�co_firstlinenoz"could not find function definitionz>^(\s*def\s)|(\s*async\s+def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)zlineno is out of boundszcould not find code object)!r�r��
checkcacher��
startswithr��OSErrorr��getlinesrJr
rr��re�compiler�r��matchrZ�groupr]rr"rr&r<r�r>r�r@rr��
IndexError)r
r�r�r�rNZpatZ
candidatesr�r��lnumr�rrr�
findsourcesf










r�c	Cs.zt|�\}}Wnttfk
r*YdSXt|�r�d}|rT|ddd�dkrTd}|t|�krz||��dkrz|d}qT|t|�kr�||dd�dkr�g}|}|t|�kr�||dd�dkr�|�||���|d}q�d�|�S�n>|dk�r*t	||�}|d}|dk�r*||�
�dd�dk�r*t	||�|k�r*||���
�g}|dk�r�|d}||���
�}|dd�dk�r�t	||�|k�r�|g|dd�<|d}|dk�r��q�||���
�}�qt|�r�|d��dk�r�g|dd�<�q�|�r |d��dk�r g|dd�<�q�d�|�SdS)	Nr�z#!r�)��#r�r�r�)r�r�r�r
r��striprZr�r�r�r�)r
r�r��startZcomments�endr�Zcommentrrr�getcommentsRsL
  

$�
$
r�c@seZdZdS)�
EndOfBlockN�r�r�r�rrrrr�sr�c@seZdZdd�Zdd�ZdS)�BlockFindercCs4d|_d|_d|_d|_d|_d|_d|_d|_dS)NrFr�)r��islambda�started�passline�indecorator�decoratorhasargs�last�	body_col0�r�rrr�__init__�szBlockFinder.__init__cCsr|jsB|jsB|dkrd|_n|dkr8|dkr2d|_d|_d|_�n,|dkrZ|jrVd|_�n|dkrv|jrtd|_d|_n�|tjkr�d|_|d|_|jr�t�|jr�|js�d|_n�|jr�n�|tj	kr�|j
dkr�|jr�|d	|_
|jd	|_d|_n�|tjk�r|jd	|_|jdk�rnt�nV|tj
k�rL|j
dk	�rn|d	|j
k�rn|d|_n"|jdk�rn|tj
tjfk�rnt�dS)
N�@T)�def�class�lambdar�(�)Frr�)r�r�r�r�r��tokenize�NEWLINEr�r��INDENTr�r��DEDENT�COMMENT�NL)r�r�tokenZsrowcolZerowcolr�rrr�
tokeneater�sL





zBlockFinder.tokeneaterN)r�r�r�r�rrrrrr��s
r�c	CsVt�}z(t�t|�j�}|D]}|j|�qWnttfk
rFYnX|d|j�Sr)	r�r�generate_tokens�iter�__next__rr��IndentationErrorr�)r�Zblockfinder�tokensZ_tokenrrr�getblock�srcCsbt|�}t|�\}}t|�r"|j}t|�s>t|�rF|jjdkrF|dfSt||d��|dfSdS)Nz<module>rr�)	r�r�r<r�r
r>r��co_namer�r
r�r�rrr�getsourcelines�s�
�rcCst|�\}}d�|�S)Nr�)rr�rrrr�	getsource�srcCsRg}|jtdd�d�|D]2}|�||jf�||kr|�t||||��q|S)Nr�r�rT)r]rrZrM�walktree)�classes�children�parentr_r�rrrr�srFcCs�i}g}|D]d}|jr^|jD]>}||kr0g||<|||krJ||�|�|r||krqpqq||kr|�|�q|D]}||krv|�|�qvt||d�Sr)rMrZr)r�uniquer�rootsr�rrrr�getclasstree�s"	
r�	Argumentszargs, varargs, varkwc	Cs�t|�std�|���|j}|j}|j}t|d|��}t||||��}d}||7}d}|jt@rx|j|}|d}d}|jt	@r�|j|}t
||||�S)Nz{!r} is not a code objectrr�)r@r�r��co_varnames�co_argcount�co_kwonlyargcount�listr'�
CO_VARARGS�CO_VARKEYWORDSr)	�cora�nargsZnkwargs�args�
kwonlyargs�step�varargs�varkwrrr�getargss"



r,�ArgSpeczargs varargs keywords defaultscCsDtjdtdd�t|�\}}}}}}}|s.|r6td��t||||�S)Nzhinspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()r���
stacklevelzgFunction has keyword-only parameters or annotations, use inspect.signature() API which can support them)�warnings�warn�DeprecationWarning�getfullargspecr�r-)r�r'r*r+�defaultsr(�kwonlydefaults�annrrr�
getargspec-s��r7�FullArgSpeczGargs, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotationsc
Cs|zt|ddtd�}Wn,tk
r@}ztd�|�W5d}~XYnXg}d}d}g}g}d}i}	d}i}
|j|jk	r||j|	d<|j��D]�}|j}|j	}
|t
kr�|�|
�|j|jk	r�||jf7}nv|t
kr�|�|
�|j|jk	r�||jf7}nJ|tkr�|
}n<|tk�r*|�|
�|j|jk	�r8|j|
|
<n|tk�r8|
}|j|jk	r�|j|	|
<q�|
�sZd}
|�sdd}t|||||||
|	�S)NF��follow_wrapper_chains�skip_bound_arg�sigclszunsupported callabler�return)�_signature_from_callable�	Signaturernr��return_annotation�empty�
parameters�valuesrvrN�_POSITIONAL_ONLYrZ�default�_POSITIONAL_OR_KEYWORD�_VAR_POSITIONAL�
_KEYWORD_ONLY�_VAR_KEYWORD�
annotationr8)r��sig�exr'r*r+Zposonlyargsr(r4�annotations�
kwdefaults�paramrvrNrrrr3Nsb�






�r3�ArgInfozargs varargs keywords localscCs t|j�\}}}t||||j�Sr)r,r�rP�f_locals)�framer'r*r+rrr�getargvalues�srScCsVt|dd�dkr t|��dd�St|t�rN|jd|fkr>|jS|jd|jSt|�S)Nr��typingztyping.r�r�r�)rL�repr�replacerrr�r�)rJZbase_modulerrr�formatannotation�s
rWcst|dd���fdd�}|S)Nr�cs
t|��Sr)rW)rJ�r�rr�_formatannotation�sz5formatannotationrelativeto.<locals>._formatannotation)rL)r
rYrrXr�formatannotationrelativeto�srZrcCsd|S�N�*r�rNrrrrR�rSrRcCsd|S�N�**rr]rrrrR�rScCsdt|�S�N�=�rU�rOrrrrR�rScCsd|S)Nz -> r)�textrrrrR�rSc
s<ddlm}
|
dtdd����fdd�}g}|rBt|�t|�}t|�D]:\}}||�}|rz||krz||
|||�}|�|�qJ|dk	r�|�|||���n|r�|�d�|r�|D]2}||�}|r�||kr�||
||�7}|�|�q�|dk	�r|�|	||���d	d
�|�d}d�k�r8||��d��7}|S)
Nr)r1zc`formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directlyr�r.cs(�|�}|�kr$|d��|�7}|S)Nz: r)�argrt�rMrW�	formatargrr�formatargandannotation�sz-formatargspec.<locals>.formatargandannotationr\r�, rr=)r0r1r2r��	enumeraterZr�)r'r*r+r4r(r5rMrg�
formatvarargs�formatvarkw�formatvalueZ
formatreturnsrWr1rh�specsZfirstdefaultr�re�specZ	kwonlyargrtrrfr�
formatargspec�s<�


rpcCsd|Sr[rr]rrrrRrScCsd|Sr^rr]rrrrRrScCsdt|�Sr`rbrcrrrrRrScCs�|||fdd�}g}	tt|��D]}
|	�|||
��q |rV|	�||�|||��|rt|	�||�|||��dd�|	�dS)NcSs||�|||�Srr)rN�localsrgrmrrr�convertsz formatargvalues.<locals>.convertrrir)r�r�rZr�)r'r*r+rqrgrkrlrmrrrnr�rrr�formatargvaluess�
rscs��fdd�|D�}t|�}|dkr,|d}n>|dkr@dj|�}n*dj|dd��}|dd�=d	�|�|}td
|||rzdnd|dkr�d
nd|f��dS)Ncsg|]}|�krt|��qSrrb)rfrN�rCrrr�sz&_missing_arguments.<locals>.<listcomp>r�rr�z	{} and {}z, {} and {}���riz*%s() missing %i required %s argument%s: %s�
positional�keyword-onlyr�r�)r�r�r�r�)�f_nameZargnames�posrCra�missingr��tailrrtr�_missing_argumentss 


��r|c
	s�t|�|}t�fdd�|D��}|r:|dk}	d|f}
n2|rTd}	d|t|�f}
nt|�dk}	tt|��}
d}|r�d}||dkr�d	nd||dkr�d	ndf}td
||
|	r�d	nd|||dkr�|s�dndf��dS)
Ncsg|]}|�kr|�qSrr)rfrertrrr�)sz_too_many.<locals>.<listcomp>r�zat least %dTz
from %d to %dr�z7 positional argument%s (and %d keyword-only argument%s)r�z5%s() takes %s positional argument%s but %d%s %s givenZwasZwere)r�r�r�)
rxr'Zkwonlyr*ZdefcountZgivenrCZatleastZkwonly_givenZpluralrKZ
kwonly_sig�msgrrtr�	_too_many's*���r~cOst|�}|\}}}}}}	}
|j}i}t|�rB|jdk	rB|jf|}t|�}
t|�}|r^t|�nd}t|
|�}t|�D]}|||||<qt|r�t||d��||<t||�}|r�i||<|�	�D]T\}}||kr�|s�t
d||f��||||<q�||k�rt
d||f��|||<q�|
|k�r<|�s<t||||||
|�|
|k�r�|d||�}|D]}||k�rZt||d|��qZt
|||d��D] \}}||k�r�||||<�q�d}|D]6}||k�r�|	�r�||	k�r�|	|||<n|d7}�q�|�rt||d|�|S)Nrz*%s() got an unexpected keyword argument %rz(%s() got multiple values for argument %rTr�F)r3r�rr�r�r�r�rmrWrKr�r~r|rj)r�rvZnamedror'r*r+r4r(r5r6rxZ	arg2valueZnum_posZnum_argsZnum_defaults�nr�Zpossible_kwargs�kwrOZreqrerz�kwargrrr�getcallargs<sh
�
�
�



r��ClosureVarsz"nonlocals globals builtins unboundc	Cs�t|�r|j}t|�s$td�|���|j}|jdkr:i}ndd�t|j|j�D�}|j	}|�
dtj�}t
|�rt|j}i}i}t�}|jD]d}|dkr�q�z||||<Wq�tk
r�z||||<Wntk
r�|�|�YnXYq�Xq�t||||�S)N�{!r} is not a Python functioncSsi|]\}}||j�qSr)�
cell_contents)rf�varZcellrrr�
<dictcomp>�s�z"getclosurevars.<locals>.<dictcomp>�__builtins__)�None�True�False)rr"rr�r�r&�__closure__�zip�co_freevars�__globals__r�r�rJr
rW�co_names�KeyErrorr\r�)	r��codeZ
nonlocal_varsZ	global_nsZ
builtin_nsZglobal_varsZbuiltin_varsZ
unbound_namesrNrrr�getclosurevarszs>	
�
�r��	Tracebackz+filename lineno function code_context indexr�cCs�t|�r|j}|j}n|j}t|�s2td�|���t|�p@t|�}|dkr�|d|d}zt	|�\}}Wnt
k
r�d}}Yq�Xtdt|t
|�|��}||||�}|d|}nd}}t|||jj||�S)Nz'{!r} is not a frame or traceback objectrr�r�)r<�	tb_linenor��f_linenor>r�r�r�r�r�r��maxr�r�r�r�r)rR�context�linenor�r�r�r��indexrrr�getframeinfo�s$r�cCs|jSr)r��rRrrr�	getlineno�sr��	FrameInfor�cCs2g}|r.|ft||�}|�t|��|j}q|Sr)r�rZr��f_back)rRr��	framelist�	frameinforrr�getouterframes�sr�cCs4g}|r0|jft||�}|�t|��|j}q|Sr)r�r�rZr��tb_next)�tbr�r�r�rrr�getinnerframes�sr�cCsttd�rt�d�SdS)N�	_getframer�)rr�r�rrrr�currentframe�sr�cCstt�d�|�S)Nr�)r�r�r��r�rrr�stack�sr�cCstt��d|�S)Nr�)r�r��exc_infor�rrr�trace�sr�cCstjd�|�S)Nrx)rrJr)�klassrrr�_static_getmrosr�cCs8i}zt�|d�}Wntk
r(YnXt�||t�S�NrJ)r
�__getattribute__r[r�r��	_sentinel)r,�attrZ
instance_dictrrr�_check_instancesr�c	CsHt|�D]:}tt|��tkrz|j|WStk
r@YqXqtSr)r��_shadowed_dictrr�rJr�)r�r��entryrrr�_check_class
sr�cCs(zt|�Wntk
r"YdSXdS�NFT)r�r�r+rrr�_is_types
r�c	Csntjd}t|�D]V}z|�|�d}Wntk
r<YqXt|�tjkr`|jdkr`|j|ks|Sqt	Sr�)
rrJr�rr�rrr�rir�)r��	dict_attrr�Z
class_dictrrrr�s
��
r�c	Cst}t|�s>t|�}t|�}|tks2t|�tjkrBt||�}n|}t||�}|tk	r�|tk	r�tt|�d�tk	r�tt|�d�tk	r�|S|tk	r�|S|tk	r�|S||kr�tt|��D]:}tt|��tkr�z|j	|WSt
k
r�Yq�Xq�|tk	r�|St|��dS)Nrr)r�r�rr�rrr�r�r�rJr�r[)r,r�rEZinstance_resultr�r�Zklass_resultr�rrr�getattr_static+s:�
�r��GEN_CREATED�GEN_RUNNING�
GEN_SUSPENDED�
GEN_CLOSEDcCs,|jr
tS|jdkrtS|jjdkr(tStS�Nr�)�
gi_runningr��gi_framer��f_lastir�r�)�	generatorrrr�getgeneratorstate`s	
r�cCs:t|�std�|���t|dd�}|dk	r2|jjSiSdS)Nz{!r} is not a Python generatorr�)r3r�r�rLr�rQ)r�rRrrr�getgeneratorlocalsrsr��CORO_CREATED�CORO_RUNNING�CORO_SUSPENDED�CORO_CLOSEDcCs,|jr
tS|jdkrtS|jjdkr(tStSr�)�
cr_runningr��cr_framer�r�r�r�)�	coroutinerrr�getcoroutinestate�s	
r�cCs"t|dd�}|dk	r|jSiSdS)Nr�)rLrQ)r�rRrrr�getcoroutinelocals�sr��
from_bytescCs8zt||�}Wntk
r$YdSXt|t�s4|SdSr)rLr[r�_NonUserDefinedCallables)rgZmethod_nameZmethrrr�"_signature_get_user_defined_method�s
r�c
Cs�|j}t|���}|jpd}|jp$i}|r2||}z|j||�}Wn6tk
rx}zd�|�}	t|	�|�W5d}~XYnXd}
|��D]�\}}z|j	|}
Wnt
k
r�YnjX|jtkr�|�
|�q�|jtkr�||kr�d}
|j|
d�||<n|�
|j�q�|jtk�r|j|
d�||<|
r�|jtk�rN||jtd�}|||<|�|�q�|jttfk�rj|�|�q�|jtkr�|�
|j�q�|j|��d�S)Nrz+partial object {!r} has incorrect argumentsFT)rE�rv�rB)rBrrKr'�keywords�bind_partialr�r�r��	argumentsr�rvrDr�rFrVrNrH�move_to_endrIrGrC)�wrapped_sig�partialZ
extra_argsZ
old_params�
new_paramsZpartial_argsZpartial_keywordsZbarLr}Ztransform_to_kwonly�
param_namerOZ	arg_valueZ	new_paramrrr�_signature_get_partial�sL







r�cCslt|j���}|r$|djttfkr,td��|dj}|ttfkrP|dd�}n|t	k	r`td��|j
|d�S)Nrzinvalid method signaturer�zinvalid argument typer�)rmrBrCrvrIrHr�rFrDrGrV)rK�paramsrvrrr�_signature_bound_methods
r�cCs&t|�p$t|�p$t|t�p$|ttfkSr)rBrrr�rr
r+rrr�_signature_is_builtin.s��
�r�cCs�t|�rt|�rdSt|dd�}t|dd�}t|dt�}t|dt�}t|dd�}t|tj�o�t|t�o�|dksxt|t�o�|dks�t|t	�o�t|t	�S)NFr�r&�__defaults__�__kwdefaults__�__annotations__)
�callablerrL�_voidrrr?r�rmr�)r,rNr�r4rNrMrrr�_signature_is_functionlike:s ����r�cCs<|�d�}|dkr|�d�}|�d�}|�d�}|d|�S)N�,r�r�:rar�)�find)roryZcposrrr�_signature_get_bound_paramSs




r�cCs |s|ddfSd}d}dd�|�d�D�}t|�j}t�|�}d}d}g}|j}	d}
tj}tj}t|�}
|D]�}
|
j	|
j
}}||kr�|dkr�|r�d}qld}|
d7}
ql|d	kr�d}|
d}ql||kr�|d
kr�|
}ql|r�d}||kr�|dks�|	d�|	|�|dkrl|	d
�qld�|�}|||fS)NcSsg|]}|�d��qS)�ascii)�encode)rf�lrrrr�}sz6_signature_strip_non_python_syntax.<locals>.<listcomp>r�Frr�Tr��/�$rri� r�)r�rrrrZr�OP�
ERRORTOKEN�nextr�stringr�)�	signature�self_parameter�last_positional_onlyr�r�Ztoken_streamZ
delayed_commaZskip_next_commardr\Zcurrent_parameterr�r��trr��clean_signaturerrr�"_signature_strip_non_python_syntaxjsP





r�Tc	s`ddl�|j�t|�\}}}d|d}z��|�}Wntk
rNd}YnXt|�j�sjtd�|���|j	d}	g��j
�t��d}i�t|dd�}
|
r�t
j�|
d�}|r�|j�t
j���	�fdd�����	fdd	��
G��
fd
d�d�j���f��������fdd
�	}t|	jj�}t|	jj�}
tj||
dd�}|dk	�rJ�j�n�j�ttt|���D](\}\}}|||�||k�r`�j��q`|	jj�r��j�||	jj���j�t|	jj |	jj!�D]\}}|||��q�|	jj"�r�j#�||	jj"��|dk	�rRt|dd�}|dk	}t$|�}|�r8|�s,|�r8��%d�n�dj&�jd�}|�d<|�|j
d�S)Nrzdef fooz: passz"{!r} builtin has invalid signaturer�cs|jdk	rtd��|jS)Nz'Annotations are not currently supported)rJr�re)�node)�astrr�
parse_name�s
z&_signature_fromstr.<locals>.parse_namecs|zt|��}Wn>tk
rLzt|��}Wntk
rFt��YnXYnXt|tttttt	d�f�rr��
|�St��dSr)�eval�	NameError�RuntimeErrorrr��int�float�bytesr%rZConstant)r�rO)r��module_dict�sys_module_dictrr�
wrap_value�s
z&_signature_fromstr.<locals>.wrap_valuecs(eZdZ��fdd�Z��fdd�ZdS)z,_signature_fromstr.<locals>.RewriteSymbolicscs\g}|}t|�j�r(|�|j�|j}qt|�j�s:t��|�|j�d�t	|��}�|�S)Nr�)
rrerZr�rO�Namer�r�r��reversed)r�r��arrO�r�rrr�visit_Attribute�sz<_signature_fromstr.<locals>.RewriteSymbolics.visit_Attributecst|j�j�st���|j�Sr)rZctxZLoadr�r�)r�r�rrr�
visit_Name�sz7_signature_fromstr.<locals>.RewriteSymbolics.visit_NameN)r�r�r�r	r
rrrr�RewriteSymbolics�srcs��|�}|�krdS|rp|tk	rpz���|�}��|�}Wntk
rR�}YnX|�kr`dS|�k	rl|n|}���|�|�d��dS�N�rErJ)�_emptyZvisitZliteral_evalr�rZ)Z	name_nodeZdefault_noderErN�o)�	Parameterrr�rA�invalidrvrBr�rr�p�s
z_signature_fromstr.<locals>.p)�	fillvaluer�r��r@)'r��_parameter_clsr��parse�SyntaxErrorrZModuler�r�ZbodyrAr
rLr�r�r�rJr�ZNodeTransformerrr'r4�	itertools�zip_longest�POSITIONAL_ONLY�POSITIONAL_OR_KEYWORDrjr"Zvararg�VAR_POSITIONAL�KEYWORD_ONLYr�r(Zkw_defaultsr��VAR_KEYWORDr
r�rV)rgr,r�r;r�r�r�Zprogramr�r(Zmodule_namerr'r4rr�rNrEZ_selfZself_isboundZ
self_ismoduler)rrr�rArrvrrBr�rrr�_signature_fromstr�sn�










rcCsBt|�std�|���t|dd�}|s4td�|���t||||�S)Nz%{!r} is not a Python builtin function�__text_signature__z#no signature found for builtin {!r})r�r�r�rLr�r)rgr�r;r�rrr�_signature_from_builtin<s�r!c	CsHd}t|�s(t|�rd}ntd�|���t|dd�}|rFt||||�S|j}|j}|j}|j	}|j
}	|d|�}
|j}||||�}|j}
|j
}|j}|r�t|�}nd}g}||}|	}|
d|�D]<}|r�tnt}|
�|t�}|�||||d��|r�|d8}q�t|
|d��D]L\}}|�r&tnt}|
�|t�}|�||||||d��|�r|d8}�q|jt@�r�|||}|
�|t�}|�|||td��|D]B}t}|dk	�r�|�|t�}|
�|t�}|�|||t|d���q�|jt@�r2||}|jt@�r
|d7}||}|
�|t�}|�|||td��|||
�d	t�|d
�S)NFTr�r r)rJrvr�)rJrvrEr=�r@�__validate_parameters__)rr�r�r�rLrrr&r r�co_posonlyargcountr!r�r�r�r�rDrFr�rrZrjr'r#rGrHr$rI)rgr�r;Zis_duck_functionr�rZ	func_codeZ	pos_countZ	arg_namesZ
posonly_countrvZkeyword_only_countZkeyword_onlyrMr4rNZpos_default_countrBZnon_default_countZposonly_leftrNrvrJ�offsetrEr�rrr�_signature_from_functionLs�

�

�
�

�
�
�r&)r:r;c
Cs�t|�std�|���t|tj�rDt|j|||d�}|r@t|�S|S|rtt	|dd�d�}t|tj�rtt||||d�Sz
|j
}Wntk
r�Yn&X|dk	r�t|t�s�td�|���|Sz
|j
}Wntk
r�YnvXt|tj��rLt|j|||d�}t||d�}t|j���d}|jtjk�r(|St|j���}|f|}	|j|	d	�St|��s`t|��rnt|||d
�St|��r�t|||d
�St|tj��r�t|j|||d�}t||�Sd}t|t��r�t t|�d�}
|
dk	�r�t|
|||d�}nJt |d�}|dk	�rt||||d�}n$t |d
�}|dk	�r4t||||d�}|dk�r@|j!dd�D]>}
z
|
j"}Wntk
�rpYnX|�rLt#|||�S�qLt|j!k�r@|j$t%j$k�r�|j&t%j&k�r�|�'t%�St(d�|���nrt|t)��s@t t|�d�}
|
dk	�r@zt|
|||d�}Wn8t(k
�r>}zd�|�}t(|�|�W5d}~XYnX|dk	�r\|�rXt|�S|St|tj*��r|d�|�}t(|��t(d�|���dS)Nz{!r} is not a callable objectr9cSs
t|d�S)N�
__signature__r}r~rrrrR�rSz*_signature_from_callable.<locals>.<lambda>ryz1unexpected object {!r} in __signature__ attributerrr�)r;�__call__�__new__r�r�z(no signature found for builtin type {!r}zno signature found for {!r}z,no signature found for builtin function {!r}z+callable {!r} is not supported by signature)+r�r�r�rrrr>r"r�r�r'r[r?�_partialmethodr#�
partialmethodr�r�rmrBrCrvrrrVrr�r&r�r!r�rr�rxr rr�r
r)�
from_callabler�r�rA)r,r:r;r<rKr+r�Zfirst_wrapped_paramZ
sig_paramsr�Zcall�newZinitrPZtext_sigrLr}rrrr>�s	��

��
�
�
��

�

�

�


�
�
�



r>c@seZdZdS)r�Nr�rrrrr�t	sr�c@seZdZdS)rNr�rrrrrx	src@s4eZdZdZdZdZdZdZdd�Ze	dd	��Z
d
S)�_ParameterKindrr�r���cCs|jSr)�_name_r�rrr�__str__�	sz_ParameterKind.__str__cCst|Sr)�_PARAM_NAME_MAPPINGr�rrr�description�	sz_ParameterKind.descriptionN)r�r�r�rrrrrr2rjr4rrrrr.|	sr.zpositional-onlyzpositional or keywordzvariadic positionalrwzvariadic keywordc@s�eZdZdZeZeZeZ	e
ZeZ
eZeed�dd�Zdd�Zdd�Zed	d
��Zedd��Zed
d��Zedd��Zeeeed�dd�Zdd�Zdd�Zdd�Zdd�ZdS)r)�_name�_kind�_default�_annotationr
cCszt|�|_Wn$tk
r2td|�d���YnX|tk	rd|jttfkrdd}|�|jj�}t|��||_||_	|tkr�td��t
|t�s�d�t|�j
�}t|��|ddkr�|dd���r�|jtkr�d	}|�|jj�}t|��t|_d
�|dd��}|���std�|���||_dS)Nzvalue z is not a valid Parameter.kindz({} parameters cannot have default valuesz*name is a required attribute for Parameterzname must be a str, not a {}rr�r�zLimplicit arguments must be passed as positional or keyword arguments, not {}z
implicit{}z"{!r} is not a valid parameter name)r.r6r�rrGrIr�r4r7r8rr�rr�r��isdigitrFrD�isidentifierr5)r�rNrvrErJr}rrrr��	s6

�
zParameter.__init__cCs t|�|j|jf|j|jd�fS)N�r7r8)rr5r6r7r8r�rrr�
__reduce__�	s
��zParameter.__reduce__cCs|d|_|d|_dS)Nr7r8r;�r��staterrr�__setstate__�	s
zParameter.__setstate__cCs|jSr)r5r�rrrrN�	szParameter.namecCs|jSr)r7r�rrrrE�	szParameter.defaultcCs|jSr)r8r�rrrrJ�	szParameter.annotationcCs|jSr)r6r�rrrrv�	szParameter.kind)rNrvrJrEcCsL|tkr|j}|tkr|j}|tkr*|j}|tkr8|j}t|�||||d�Sr)r�r5r6r8r7r)r�rNrvrJrErrrrV�	szParameter.replacecCs�|j}|j}|jtk	r(d�|t|j��}|jtk	rb|jtk	rPd�|t|j��}nd�|t|j��}|tkrtd|}n|t	kr�d|}|S)Nz{}: {}z{} = {}z{}={}r\r_)
rvr5r8rr�rWr7rUrGrI)r�rv�	formattedrrrr2
s
�


zParameter.__str__cCsd�|jj|�S)Nz	<{} "{}">�r�r�r�r�rrr�__repr__#
szParameter.__repr__cCst|j|j|j|jf�Sr)�hashrNrvrJrEr�rrr�__hash__&
szParameter.__hash__cCsJ||krdSt|t�stS|j|jkoH|j|jkoH|j|jkoH|j|jkS�NT)rr�NotImplementedr5r6r7r8�r��otherrrr�__eq__)
s

�
�
�zParameter.__eq__N)r�r�r�r�rDrrFrrGrrHrrIrrrAr�r<r?rjrNrErJrvr�rVr2rBrDrIrrrrr�	s4(



�rc@sdeZdZdZdd�Zedd��Zedd��Zedd	��Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dS)�BoundArguments)r��
_signature�__weakref__cCs||_||_dSr)r�rK)r�r�r�rrrr�G
szBoundArguments.__init__cCs|jSr)rKr�rrrr�K
szBoundArguments.signaturec	Cs~g}|jj��D]d\}}|jttfkr*qvz|j|}Wntk
rRYqvYqX|jtkrj|�	|�q|�
|�qt|�Sr)rKrBrKrvrIrHr�r�rG�extendrZrm)r�r'r�rOrerrrr'O
s
zBoundArguments.argsc	Cs�i}d}|jj��D]x\}}|sD|jttfkr4d}n||jkrDd}q|sJqz|j|}Wntk
rlYqX|jtkr�|�|�q|||<q|Sr�)	rKrBrKrvrIrHr�r��update)r��kwargsZkwargs_startedr�rOrerrrrOf
s&


zBoundArguments.kwargsc	Cs�|j}g}|jj��D]x\}}z|�|||f�Wqtk
r�|jtk	rV|j}n$|jt	krfd}n|jt
krvi}nYq|�||f�YqXqt|�|_dS)Nr)r�rKrBrKrZr�rErrvrGrIr)r�r�Z
new_argumentsrNrO�valrrr�apply_defaults�
s	


zBoundArguments.apply_defaultscCs2||krdSt|t�stS|j|jko0|j|jkSrE)rrJrFr�r�rGrrrrI�
s

�zBoundArguments.__eq__cCs|d|_|d|_dS)NrKr��rKr�r=rrrr?�
s
zBoundArguments.__setstate__cCs|j|jd�S)NrRrRr�rrr�__getstate__�
szBoundArguments.__getstate__cCs@g}|j��D]\}}|�d�||��qd�|jjd�|��S)Nz{}={!r}z	<{} ({})>ri)r�rKrZr�r�r�r�)r�r'rerOrrrrB�
szBoundArguments.__repr__N)r�r�r�r�r�rjr�r'rOrQrIr?rSrBrrrrrJ4
s


rJc@s�eZdZdZeZeZeZ	d+edd�dd�Z
edd��Zed	d
��Z
edd�dd
��Zedd��Zedd��Zeed�dd�Zdd�Zdd�Zdd�Zdd�dd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�ZdS),r?)�_return_annotation�_parametersNTr"cCs�|dkrt�}n�|r�t�}t}d}t|�D]�\}}|j}	|j}
|	|krdd}|�|j|	j�}t|��n|	|krtd}|	}|	ttfkr�|j	t
kr�|r�d}t|��nd}|
|kr�d�|
�}t|��|||
<q*ntdd�|D��}t�|�|_
||_dS)NFz7wrong parameter order: {} parameter before {} parameterz-non-default argument follows default argumentTzduplicate parameter name: {!r}css|]}|j|fVqdSrr]�rfrOrrrrhs�z%Signature.__init__.<locals>.<genexpr>)rrDrjrvrNr�r4r�rFrErr�MappingProxyTyperUrT)r�rBr@r#r�Ztop_kindZ
kind_defaults�idxrOrvrNr}rrrr��
sD��



�zSignature.__init__cCstjdtdd�t||�S)Nz_inspect.Signature.from_function() is deprecated since Python 3.5, use Signature.from_callable()r�r.)r0r1r2r&�rgr�rrr�
from_functions
�zSignature.from_functioncCstjdtdd�t||�S)Nz^inspect.Signature.from_builtin() is deprecated since Python 3.5, use Signature.from_callable()r�r.)r0r1r2r!rYrrr�from_builtins
�zSignature.from_builtin��follow_wrappedcCst|||d�S)N)r<r:)r>)rgr,r]rrrr,#s�zSignature.from_callablecCs|jSr)rUr�rrrrB)szSignature.parameterscCs|jSr�rTr�rrrr@-szSignature.return_annotation)rBr@cCs0|tkr|j��}|tkr |j}t|�||d�S)Nr)r�rBrCrTr)r�rBr@rrrrV1s
�zSignature.replacecCs8tdd�|j��D��}dd�|j��D�}|||jfS)Ncss|]}|jtkr|VqdSr)rvrHrVrrrrhAs
�z(Signature._hash_basis.<locals>.<genexpr>cSsi|]}|jtkr|j|�qSr)rvrHrNrVrrrr�Ds
�z)Signature._hash_basis.<locals>.<dictcomp>)rmrBrCr@)r�r��
kwo_paramsrrr�_hash_basis@szSignature._hash_basiscCs(|��\}}}t|���}t|||f�Sr)r`�	frozensetrCrC)r�r�r_r@rrrrDIszSignature.__hash__cCs*||krdSt|t�stS|��|��kSrE)rr?rFr`rGrrrrINs

zSignature.__eq__F�r�cCs�t�}t|j���}d}t|�}zt|�}Wn�tk
�rzt|�}	Wntk
rfYY�q�Yn�X|	jtkrzY�q�n�|	j|kr�|	jt	kr�d}
|
j
|	jd�}
t|
�d�|	f}Y�q�nP|	jtks�|	j
tk	r�|	f}Y�q�n.|r�|	f}Y�q�nd}
|
j
|	jd�}
t|
�d�Yq Xzt|�}	Wn tk
�r:td�d�Yq X|	jttfk�rVtd�d�|	jtk�r�|g}|�|�t|�||	j<�q�|	j|k�r�|	jt	k�r�tdj
|	jd��d�|||	j<q d}t�||�D]�}	|	jtk�r�|	}�q�|	jtk�r�q�|	j}
z|�|
�}WnFtk
�rN|�sJ|	jtk�rJ|	j
tk�rJtdj
|
d��d�Yn(X|	jt	k�rntdj
|	jd���|||
<�q�|�r�|dk	�r�|||j<ntdj
tt|��d���|�||�S)NrzA{arg!r} parameter is positional only, but was passed as a keyword)rez$missing a required argument: {arg!r}ztoo many positional argumentsz$multiple values for argument {arg!r}z*got an unexpected keyword argument {arg!r})rrrBrCr��
StopIterationrvrGrNrDr�r�rIrErrHrMrmr�chainr�r��_bound_arguments_cls)r�r'rOr�r�rBZ
parameters_exZarg_valsZarg_valrOr}rCZkwargs_paramr�rrr�_bindUs�




���
�������

��zSignature._bindcOs|�||�Sr�rf�r�r'rOrrr�bind�szSignature.bindcOs|j||dd�S)NTrbrgrhrrrr��szSignature.bind_partialcCs t|�t|j���fd|jifS�NrT)rrmrUrCrTr�rrrr<�s�zSignature.__reduce__cCs|d|_dSrjr^r=rrrr?�szSignature.__setstate__cCsd�|jj|�S)Nz<{} {}>rAr�rrrrB�szSignature.__repr__c	Cs�g}d}d}|j��D]d}t|�}|j}|tkr6d}n|rH|�d�d}|tkrVd}n|tkrp|rp|�d�d}|�|�q|r�|�d�d�d�	|��}|j
tk	r�t|j
�}|d�|�7}|S)NFTr�r\z({})riz -> {})
rBrCr�rvrDrZrGrHr�r�r@rrW)	r�rtZrender_pos_only_separatorZrender_kw_only_separatorrOr@rvZrenderedZannorrrr2�s0




zSignature.__str__)N)r�r�r�r�rrrJrerrAr�rrrZr[r,rjrBr@r�rVr`rDrIrfrir�r<r?rBr2rrrrr?�
s:�7



	r?r\cCstj||d�S)Nr\)r?r,)r,r]rrrr�sr�c
Cs�ddl}ddl}|��}|jddd�|jddddd	�|��}|j}|�d
�\}}}z|�|�}}	WnNtk
r�}
z0d�	|t
|
�j|
�}t|t
jd�t
�d
�W5d}
~
XYnX|r�|�d�}|	}|D]}
t||
�}q�|	jt
jk�rtdt
jd�t
�d�|j�r�td�	|��td�	t|	���td�	|	j��||	k�rxtd�	t|	j���t|	d��r�td�	|	j��n6zt|�\}}Wntk
�r�YnXtd�	|��td�ntt|��dS)Nrr
zCThe object to be analysed. It supports the 'module:qualname' syntax)�helpz-dz	--details�
store_truez9Display info about the module rather than its source code)�actionrkr�zFailed to import {} ({}: {}))r�r�r�z#Can't get info for builtin modules.r�z
Target: {}z
Origin: {}z
Cached: {}z
Loader: {}�__path__zSubmodule search path: {}zLine: {}r�)�argparser��ArgumentParser�add_argument�
parse_argsr
�	partition�
import_modulernr�rr��printr��stderr�exitr�rL�builtin_module_namesZdetailsr��
__cached__rUr�rrnr�r)ror��parserr'�targetZmod_nameZ	has_attrs�attrsr,r�rur}�parts�part�__r�rrr�_main$s`���



r�r�)N)N)N)F)N)r�)r�)r�)r�)r�)r)T)T)T)��
__author__r8�disZcollections.abcr7�enum�importlib.machineryr�rr�r�r�r�rrrr0r#r��operatorrrr�globalsZmod_dictZCOMPILER_FLAG_NAMESrKrbrcrGr
rrrrrrr rr*r-r.r/r1r3r5r:r<r>r@rBrCrQrdrerwrVr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rnr�r�rrrrrrr,r-r7r8r3rPrSrWrZr�rprsr|r~r�r�r�r�r�r��_fieldsr�r�r�r�r�r�r
r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr(Z_WrapperDescriptor�allZ_MethodWrapperr�rJZ_ClassMethodWrapperrAr�r�r�r�r�r�r�r�rr!r&r>r�r�IntEnumr.rrDrrFrrGrrHrrIr3rrJr?r�r�r�rrrr�<module>sx	




	
,
t$
>
	
.N->




�]


	�
;�
<
5

 



		0

�
LH

_�K�	k:
linecache.cpython-38.opt-2.pyc000064400000005314150335716500012057 0ustar00U

e5d��@sjddlZddlZddlZddlZdddgZddd�Ziadd�Zddd�Zdd	d�Z	dd
d�Z
dd
�ZdS)�N�getline�
clearcache�
checkcachecCs:t||�}d|kr"t|�kr2nn||dSdSdS)N��)�getlines�len)�filename�lineno�module_globals�lines�r
�!/usr/lib64/python3.8/linecache.pyrs
cCsiadS)N)�cacher
r
r
rrscCsX|tkr(t|}t|�dkr(t|dSzt||�WStk
rRt�gYSXdS)Nr�)rr�updatecache�MemoryErrorr)r	r�entryr
r
rr%src	Cs�|dkrtt���}n|tkr&|g}ndS|D]�}t|}t|�dkrHq.|\}}}}|dkr^q.zt�|�}Wn$tk
r�t�|d�Yq.YnX||jks�||j	kr.t�|d�q.dS)Nr)
�listr�keysr�os�stat�OSError�pop�st_size�st_mtime)r	�	filenamesr�size�mtimer�fullnamerr
r
rr5s&
c
Cs�|tkr$tt|�dkr$t�|d�|r<|�d�r@|�d�r@gS|}zt�|�}W�ntk
�rn|}t||�r�zt|d�}Wnt	tfk
r�YnDX|dkr�gYSt|�ddd�|�
�D�|ft|<t|dYStj�|�r�gYSt
jD]d}ztj�||�}Wnttfk
�r0Yq�YnXzt�|�}W�qjWq�tk
�r^Yq�Xq�gYSYnXz"t�|��}|��}W5QRXWntk
�r�gYSX|�r�|d�d	��s�|dd	7<|j|j}	}
|	|
||ft|<|S)
Nr�<�>rcSsg|]}|d�qS)�
r
)�.0�liner
r
r�
<listcomp>qszupdatecache.<locals>.<listcomp>r���r")rrr�
startswith�endswithrrr�	lazycache�ImportError�
splitlines�path�isabs�sys�join�	TypeError�AttributeError�tokenize�open�	readlinesrr)r	rrr�basename�data�dirname�fprrrr
r
rrRs\
�



rcCs�|tkr tt|�dkrdSdS|r8|�d�r<|�d�r<dS|r�d|kr�|�d�}|d}t|dd�}|r�|r�t�||�}|ft|<dSdS)	NrTFr r!�
__loader__�__name__�
get_source)rrr'r(�get�getattr�	functools�partial)r	r�name�loaderr;�	get_linesr
r
rr)�s


r))N)N)N)N)r>r.rr2�__all__rrrrrrr)r
r
r
r�<module>s




Asmtpd.cpython-38.opt-1.pyc000064400000063541150335716500011300 0ustar00U

e5d���@s^dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
mZddddd	gZejdZd
ZGdd�d�Ze�ad
ZdZdZd%dd�ZGdd�dej�ZGdd�dej�ZGdd�de�ZGdd�de�ZGdd	�d	e�ZGdd�d�Z dd�Z!e"dk�rZe!�Z#e#j$Z$de$k�rpe$�%d�Z&e'e$de&�e(�e)�dg�Z*e$e&dd�Z$nddl+Z*e,e*e$�Z-e-e#j.e#j/fe#j0e#j1fe#j2e#j3d�Z4e#j5�r6zddl6Z6Wn.e7k
�r�e8d ej9d!�e�:d�YnXe6�;d"�d#Z<ze�5e<�Wn.e=k
�r4e8d$ej9d!�e�:d�YnXze�>�Wne?k
�rXYnXdS)&a�An RFC 5321 smtp proxy with optional RFC 1870 and RFC 6531 extensions.

Usage: %(program)s [options] [localhost:localport [remotehost:remoteport]]

Options:

    --nosetuid
    -n
        This program generally tries to setuid `nobody', unless this flag is
        set.  The setuid call will fail if this program is not run as root (in
        which case, use this flag).

    --version
    -V
        Print the version number and exit.

    --class classname
    -c classname
        Use `classname' as the concrete SMTP proxy class.  Uses `PureProxy' by
        default.

    --size limit
    -s limit
        Restrict the total size of the incoming message to "limit" number of
        bytes via the RFC 1870 SIZE extension.  Defaults to 33554432 bytes.

    --smtputf8
    -u
        Enable the SMTPUTF8 extension and behave as an RFC 6531 smtp proxy.

    --debug
    -d
        Turn on debugging prints.

    --help
    -h
        Print this message and exit.

Version: %(__version__)s

If localhost is not given then `localhost' is used, and if localport is not
given then 8025 is used.  If remotehost is not given then `localhost' is used,
and if remoteport is not given, then 25 is used.
�N)�warn)�
get_addr_spec�get_angle_addr�SMTPChannel�
SMTPServer�DebuggingServer�	PureProxy�MailmanProxyzPython SMTP proxy version 0.3c@seZdZdd�Zdd�ZdS)�DevnullcCsdS�N���self�msgrr�/usr/lib64/python3.8/smtpd.py�writef�z
Devnull.writecCsdSrr�rrrr�flushgrz
Devnull.flushN)�__name__�
__module__�__qualname__rrrrrrr
esr
�
z, i�cCs4ttt�tjd�|r&t|tjd�t�|�dS)N��file)�print�__doc__�globals�sys�stderr�exit)�coderrrr�usagepsr#c@s�eZdZdZdZdZe�efdd��Ze	dd��Z
edd	d	fd
d�Zdd
�Z
dd�Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd��Zejdd��Ze	dd ��Zejd!d ��Ze	d"d#��Zejd$d#��Ze	d%d&��Zejd'd&��Ze	d(d)��Zejd*d)��Ze	d+d,��Zejd-d,��Ze	d.d/��Zejd0d/��Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dS)Srr�icCs|Srr)�xrrr�<lambda>|rzSMTPChannel.<lambda>cCs0zt|j���WStk
r*|jYSXdSr)�max�command_size_limits�values�
ValueError�command_size_limitrrrr�max_command_size_limit~sz"SMTPChannel.max_command_size_limitNFc	
Cs&tjj|||d�||_||_||_||_||_||_|rF|rFt	d��|rdd|_
d|_d|_t
|_nd|_
d|_td�|_d	|_|��d|_d
|_|j��t��|_z|��|_WnBtk
r�}z$|��|jdtjkr�WY�dSd}~XYnXtdt |j�t!d
�|�"d|jt#f�dS)N��map�Fdecode_data and enable_SMTPUTF8 cannot be set to True at the same timer�
�.r�
�.�
FrzPeer:rz	220 %s %s)$�asynchat�
async_chat�__init__�smtp_server�conn�addr�data_size_limit�enable_SMTPUTF8�_decode_datar*�_emptystring�_linesep�_dotsep�NEWLINE�_newline�ord�_set_rset_state�
seen_greeting�
extended_smtpr(�clear�socketZgetfqdn�fqdnZgetpeername�peer�OSError�close�args�errnoZENOTCONNr�repr�DEBUGSTREAM�push�__version__)	rZserverr9r:r;r.r<�decode_data�errrrrr7�s@


zSMTPChannel.__init__cCs.|j|_d|_g|_d|_d|_|�d�dS)z/Reset state variables to their post-DATA state.NFrr2)�COMMAND�
smtp_state�mailfrom�rcpttos�require_SMTPUTF8�	num_bytes�set_terminatorrrrr�_set_post_data_state�sz SMTPChannel._set_post_data_statecCs|��d|_g|_dS)z.Reset all state variables except the greeting.rN)r\�
received_data�received_linesrrrrrD�szSMTPChannel._set_rset_statecCstdtd�|jS)NzTAccess to __server attribute on SMTPChannel is deprecated, use 'smtp_server' instead��r�DeprecationWarningr8rrrr�__server�s
�zSMTPChannel.__servercCstdtd�||_dS)NzRSetting __server attribute on SMTPChannel is deprecated, set 'smtp_server' insteadr_r`�r�valuerrrrb�s
�cCstdtd�|jS)NzUAccess to __line attribute on SMTPChannel is deprecated, use 'received_lines' insteadr_�rrar^rrrr�__line�s
�zSMTPChannel.__linecCstdtd�||_dS)NzSSetting __line attribute on SMTPChannel is deprecated, set 'received_lines' insteadr_rercrrrrf�s
�cCstdtd�|jS)NzRAccess to __state attribute on SMTPChannel is deprecated, use 'smtp_state' insteadr_�rrarVrrrr�__state�s
�zSMTPChannel.__statecCstdtd�||_dS)NzPSetting __state attribute on SMTPChannel is deprecated, set 'smtp_state' insteadr_rgrcrrrrh�s
�cCstdtd�|jS)NzXAccess to __greeting attribute on SMTPChannel is deprecated, use 'seen_greeting' insteadr_�rrarErrrr�
__greeting�s
�zSMTPChannel.__greetingcCstdtd�||_dS)NzVSetting __greeting attribute on SMTPChannel is deprecated, set 'seen_greeting' insteadr_rircrrrrj�s
�cCstdtd�|jS)NzSAccess to __mailfrom attribute on SMTPChannel is deprecated, use 'mailfrom' insteadr_�rrarWrrrr�
__mailfrom�s
�zSMTPChannel.__mailfromcCstdtd�||_dS)NzQSetting __mailfrom attribute on SMTPChannel is deprecated, set 'mailfrom' insteadr_rkrcrrrrl�s
�cCstdtd�|jS)NzQAccess to __rcpttos attribute on SMTPChannel is deprecated, use 'rcpttos' insteadr_�rrarXrrrr�	__rcpttos�s
�zSMTPChannel.__rcpttoscCstdtd�||_dS)NzOSetting __rcpttos attribute on SMTPChannel is deprecated, set 'rcpttos' insteadr_rmrcrrrrn�s
�cCstdtd�|jS)NzTAccess to __data attribute on SMTPChannel is deprecated, use 'received_data' insteadr_�rrar]rrrr�__data�s
�zSMTPChannel.__datacCstdtd�||_dS)NzRSetting __data attribute on SMTPChannel is deprecated, set 'received_data' insteadr_rorcrrrrps
�cCstdtd�|jS)NzKAccess to __fqdn attribute on SMTPChannel is deprecated, use 'fqdn' insteadr_�rrarIrrrr�__fqdn
s
�zSMTPChannel.__fqdncCstdtd�||_dS)NzISetting __fqdn attribute on SMTPChannel is deprecated, set 'fqdn' insteadr_rqrcrrrrrs
�cCstdtd�|jS)NzKAccess to __peer attribute on SMTPChannel is deprecated, use 'peer' insteadr_�rrarJrrrr�__peers
�zSMTPChannel.__peercCstdtd�||_dS)NzISetting __peer attribute on SMTPChannel is deprecated, set 'peer' insteadr_rsrcrrrrts
�cCstdtd�|jS)NzKAccess to __conn attribute on SMTPChannel is deprecated, use 'conn' insteadr_�rrar9rrrr�__conn s
�zSMTPChannel.__conncCstdtd�||_dS)NzISetting __conn attribute on SMTPChannel is deprecated, set 'conn' insteadr_rurcrrrrv%s
�cCstdtd�|jS)NzKAccess to __addr attribute on SMTPChannel is deprecated, use 'addr' insteadr_�rrar:rrrr�__addr+s
�zSMTPChannel.__addrcCstdtd�||_dS)NzISetting __addr attribute on SMTPChannel is deprecated, set 'addr' insteadr_rwrcrrrrx0s
�cCs&tj�|t|d|jrdnd��dS)Nr0�utf-8�ascii)r5r6rQ�bytesrYr
rrrrQ7s
�zSMTPChannel.pushcCs|d}|j|jkr|j}n|j|jkr*|j}|r<|j|kr<dS|rR|jt|�7_|jrl|j�	t
|d��n|j�	|�dS)Nry)rVrUr,�DATAr;rZ�lenr=r^�append�str)r�data�limitrrr�collect_incoming_data<sz!SMTPChannel.collect_incoming_datac
Cs|j�|j�}tdt|�td�g|_|j|jk�r|jd}|_|sT|�	d�dS|j
sdt|d�}|�d�}|dkr�|�
�}d}n$|d|��
�}||dd���}|jr�|j|n|j}||kr�|�	d�dSt|d	|d�}|s�|�	d
|�dS||�dS|j|jk�r(|�	d�d|_dS|j�rR|j|jk�rR|�	d�d|_dSg}|�|j�D]:}	|	�r�|	d|jk�r�|�|	dd��n
|�|	��qb|j�|�|_|j|j|j|jf}
i}|j
�s�|j|jd
�}|j j!|
|�}|�"�|�s|�	d�n
|�	|�dS)NzData:rrz500 Error: bad syntaxry� r$z500 Error: line too longZsmtp_z&500 Error: command "%s" not recognizedz451 Internal confusionz552 Error: Too much mail data)�mail_options�rcpt_options�250 OK)#r>�joinr^rrOrPrVrUrZrQr=r�find�upper�striprFr(r+�getattrr|r;�splitr?r@r~rBr]rJrWrXr�r�r8�process_messager\)
r�lineZsz�i�command�argZmax_sz�methodr��textrM�kwargsZstatusrrr�found_terminatorLsl


��


�zSMTPChannel.found_terminatorcCsH|s|�d�dS|jr&|�d�dS|��||_|�d|j�dS)Nz501 Syntax: HELO hostname�503 Duplicate HELO/EHLOz250 %s)rQrErDrI�rr�rrr�	smtp_HELO�s

zSMTPChannel.smtp_HELOcCs�|s|�d�dS|jr&|�d�dS|��||_d|_|�d|j�|jrr|�d|j�|jdd7<|js�|�d�|jr�|�d	�|jdd
7<|�d�dS)Nz501 Syntax: EHLO hostnamer�Tz250-%sz250-SIZE %s�MAIL�z250-8BITMIMEz250-SMTPUTF8�
z250 HELP)	rQrErDrFrIr;r(r=r<r�rrr�	smtp_EHLO�s&



zSMTPChannel.smtp_EHLOcCs|r|�d�n
|�d�dS)Nz501 Syntax: NOOPr��rQr�rrr�	smtp_NOOP�szSMTPChannel.smtp_NOOPcCs|�d�|��dS)Nz221 Bye)rQZclose_when_doner�rrr�	smtp_QUIT�s
zSMTPChannel.smtp_QUITcCs0t|�}|d|���|kr,||d���SdS)Nr)r}r�r�)r�keywordr�Zkeylenrrr�_strip_command_keyword�sz"SMTPChannel._strip_command_keywordcCsF|sdS|���d�r$t|�\}}nt|�\}}|s<||fS|j|fS)N)rr�<)�lstrip�
startswithrrZ	addr_spec)rr��address�restrrr�_getaddr�szSMTPChannel._getaddrcCsHi}|D]:}|�d�\}}}|��r,|r2|s2dS|r:|nd||<q|S)N�=T)�	partition�isalnum)r�params�resultZparam�eqrdrrr�
_getparams�szSMTPChannel._getparamscCs|r�d}|��}|dkr$|�d�q�|dkr8|�d�q�|dkr^d}|jrR||7}|�|�q�|dkr�d	}|jrx||7}|�|�q�|d
kr�|�d�q�|dkr�|�d
�q�|dkr�|�d�q�|dkr�|�d�q�|dkr�|�d�q�|�d�n
|�d�dS)N� [SP <mail-parameters>]ZEHLOz250 Syntax: EHLO hostnameZHELOz250 Syntax: HELO hostnamer�z 250 Syntax: MAIL FROM: <address>ZRCPTz250 Syntax: RCPT TO: <address>r|z250 Syntax: DATAZRSETz250 Syntax: RSETZNOOPz250 Syntax: NOOPZQUITz250 Syntax: QUITZVRFYz250 Syntax: VRFY <address>zD501 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFYzD250 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFY)r�rQrF)rr�ZextendedZlc_argrrrr�	smtp_HELP�s:zSMTPChannel.smtp_HELPcCs@|r2|�|�\}}|r"|�d�q<|�d|�n
|�d�dS)NzB252 Cannot VRFY user, but will accept message and attempt deliveryz502 Could not VRFY %sz501 Syntax: VRFY <address>)r�rQ)rr�r�r�rrr�	smtp_VRFY�szSMTPChannel.smtp_VRFYcCs�|js|�d�dStd|td�d}|jr4|d7}|dkrJ|�|�dS|�d|�}|�|�\}}|sv|�|�dS|js�|r�|�|�dS|jr�|�d�dS|���	�|_
|�|j
�}|dkr�|�|�dS|js�|�
dd	�}|d
kr�|�d�dS|j�r8|�
dd
�}|dk�r d|_n|d
k	�r8|�d�dS|�
dd�}|�r�|���sb|�|�dS|j�r�t|�|jk�r�|�d�dSt|���dk�r�|�d�dS||_td|jtd�|�d�dS)N�503 Error: send HELO firstz	===> MAILrz 501 Syntax: MAIL FROM: <address>r�zFROM:z503 Error: nested MAIL commandZBODY�7BIT)r�Z8BITMIMEz1501 Error: BODY can only be one of 7BIT, 8BITMIMEZSMTPUTF8FTz&501 Error: SMTPUTF8 takes no argumentsZSIZEz:552 Error: message size exceeds fixed maximum message sizerz:555 MAIL FROM parameters not recognized or not implementedzsender:r�)rErQrrPrFr�r�rWr�r�r�r�r=�popr<rY�isdigitr;�intr}�keys)rr��	syntaxerrr�r�Zbody�smtputf8�sizerrr�	smtp_MAILsh














zSMTPChannel.smtp_MAILcCs|js|�d�dStd|td�|js6|�d�dSd}|jrH|d7}|dkr^|�|�dS|�d|�}|�|�\}}|s�|�|�dS|js�|r�|�|�dS|���	�|_
|�|j
�}|dkr�|�|�dSt|�
��dkr�|�d	�dS|j�|�td
|jtd�|�d�dS)Nr�z	===> RCPTrz503 Error: need MAIL commandz501 Syntax: RCPT TO: <address>r�zTO:rz8555 RCPT TO parameters not recognized or not implementedzrecips:r�)rErQrrPrWrFr�r�r�r�r�r�r}r�rXr~)rr�r�r�r�rrr�	smtp_RCPT7s@







zSMTPChannel.smtp_RCPTcCs(|r|�d�dS|��|�d�dS)Nz501 Syntax: RSETr�)rQrDr�rrr�	smtp_RSETZs

zSMTPChannel.smtp_RSETcCsZ|js|�d�dS|js(|�d�dS|r:|�d�dS|j|_|�d�|�d�dS)Nr�z503 Error: need RCPT commandz501 Syntax: DATAs
.
z#354 End data with <CR><LF>.<CR><LF>)rErQrXr|rVr[r�rrr�	smtp_DATAas



zSMTPChannel.smtp_DATAcCs|�d�dS)Nz502 EXPN not implementedr�r�rrr�	smtp_EXPNpszSMTPChannel.smtp_EXPN),rrrrUr|r+�collections�defaultdictr(�propertyr,�DATA_SIZE_DEFAULTr7r\rDZ_SMTPChannel__server�setterZ_SMTPChannel__lineZ_SMTPChannel__stateZ_SMTPChannel__greetingZ_SMTPChannel__mailfromZ_SMTPChannel__rcpttosZ_SMTPChannel__dataZ_SMTPChannel__fqdnZ_SMTPChannel__peerZ_SMTPChannel__connZ_SMTPChannel__addrrQr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrws�
�
'	





















>#6#c@s2eZdZeZedddfdd�Zdd�Zdd�ZdS)	rNFcCs�||_||_||_||_||_|r.|r.td��tjj||d�zNt	j
|dt	ji�}|�|dd|dd�|�
�|�|�|�d�Wn|���Yn(Xtd|jjt�t���||ftd�dS)	Nr/r-�typerr$�z0%s started at %s
	Local addr: %s
	Remote addr:%sr)Z
_localaddr�_remoteaddrr;r<r=r*�asyncore�
dispatcherr7rHZgetaddrinfoZSOCK_STREAMZ
create_socketZset_reuse_addrZbindZlistenrLr�	__class__r�time�ctimerP)rZ	localaddrZ
remoteaddrr;r.r<rSZgai_resultsrrrr7xs6�
��zSMTPServer.__init__c	Cs6tdt|�td�|�||||j|j|j|j�}dS)NzIncoming connection from %sr)rrOrP�
channel_classr;�_mapr<r=)rr9r:Zchannelrrr�handle_accepted�s�zSMTPServer.handle_acceptedcKst�dS)aOverride this abstract method to handle messages from the client.

        peer is a tuple containing (ipaddr, port) of the client that made the
        socket connection to our smtp port.

        mailfrom is the raw address the client claims the message is coming
        from.

        rcpttos is a list of raw addresses the client wishes to deliver the
        message to.

        data is a string containing the entire full text of the message,
        headers (if supplied) and all.  It has been `de-transparencied'
        according to RFC 821, Section 4.5.2.  In other words, a line
        containing a `.' followed by other text has had the leading dot
        removed.

        kwargs is a dictionary containing additional information.  It is
        empty if decode_data=True was given as init parameter, otherwise
        it will contain the following keys:
            'mail_options': list of parameters to the mail command.  All
                            elements are uppercase strings.  Example:
                            ['BODY=8BITMIME', 'SMTPUTF8'].
            'rcpt_options': same, for the rcpt command.

        This function should return None for a normal `250 Ok' response;
        otherwise, it should return the desired response string in RFC 821
        format.

        N)�NotImplementedError�rrJrWrXr�r�rrrr��szSMTPServer.process_message)	rrrrr�r�r7r�r�rrrrrts�
c@seZdZdd�Zdd�ZdS)rcCsld}|��}|D]V}|rL|sLd|d}t|t�s@t|�d��}t|�d}t|t�s^t|�}t|�qdS)Nr$zX-Peer: rry)�
splitlines�
isinstancerrO�encoder)rrJr�Z	inheaders�linesr�Z
peerheaderrrr�_print_message_content�s

z&DebuggingServer._print_message_contentcKsXtd�|r@|�d�r&td|d�|�d�r@td|d�|�||�td�dS)Nz%---------- MESSAGE FOLLOWS ----------r�zmail options: %sr�zrcpt options: %s
z%------------ END MESSAGE ------------)r�getr�r�rrrr��s

zDebuggingServer.process_messageN)rrrr�r�rrrrr�scs,eZdZ�fdd�Zdd�Zdd�Z�ZS)rcs.d|kr|drtd��tt|�j||�dS)Nr<z$PureProxy does not support SMTPUTF8.�r*�superrr7�rrMr��r�rrr7�szPureProxy.__init__c	Csf|�d�}d}|D]}|sq(|d7}q|�|d|d�t�|�}|�|||�}td|td�dS)Nrrr$z
X-Peer: %szwe got some refusals:r)r��insertrAr��_deliverrrP)	rrJrWrXr�r�r�r��refusedrrrr��s


zPureProxy.process_messagec
Cs�ddl}i}zB|��}|�|jd|jd�z|�|||�}W5|��XWn�|jk
r�}ztdtd�|j	}W5d}~XYnft
|jfk
r�}zBtd|jtd�t
|dd�}t
|dd	�}	|D]}
||	f||
<q�W5d}~XYnX|S)
Nrr$zgot SMTPRecipientsRefusedrZgotZ	smtp_code���Z
smtp_error�ignore)�smtplibZSMTPZconnectr��quitZsendmailZSMTPRecipientsRefusedrrPZ
recipientsrKZ
SMTPExceptionr�r�)rrWrXr�r�r��s�eZerrcode�errmsg�rrrrr��s$ zPureProxy._deliver)rrrr7r�r��
__classcell__rrr�rr�scs$eZdZ�fdd�Zdd�Z�ZS)r	cs.d|kr|drtd��tt|�j||�dS)Nr<z'MailmanProxy does not support SMTPUTF8.r�r�r�rrr7
szMailmanProxy.__init__cCs*ddlm}ddlm}ddlm}ddlm}g}	|D]t}
|
���d�d}|�d�}t|�dkrfq8|d}
t|�dkr�|d	}nd
}|�	|
�r8|dkr�q8|	�
|
|
|f�q8|	D]\}
}
}|�|
�q�tdd
�
|�td�|r�|�|||�}td|td�i}||�}|�|�}|�d��s&||d<|�d��sDt�t���|d<|	D]�\}
}
}td|
td�|�|
�}|�s�|j|
dd�}|||
<|d
k�r�|j|d	d�n�|dk�r�|j|d	d�nh|dk�r�|j|d	d�nN|dk�r�|j|d	d�n4|dk�rH|dk�rd|d <nd!|d <|j|d	d��qHdS)"Nr)�StringIO)�Utils)�Message)�MailList�@�-r_r$r)r�admin�owner�requestr��leavezforwarding recips:r�rzwe got refusals:�fromZFrom�dateZDatezsending message to)�lock)�tolistr�)Ztoadminr�)Ztoownerr�)Z	torequest)r�r�r�Z	subscribeZSubjectZunsubscribe)�ior�ZMailmanr�r�r��lowerr�r}Zlist_existsr~�removerr�rPr�r�r�r�ZEnqueue)rrJrWrXr�r�r�r�r�Z	listnamesZrcptZlocal�partsZlistnamer�r�Zmlistsr�rZmlistrrrr�sb










zMailmanProxy.process_message)rrrr7r�r�rrr�rr	sc@seZdZdZdZdZdZdS)�OptionsTrNF)rrr�setuid�	classname�
size_limitr<rrrrr�_sr�c
Cspz.t�tjdd�dddddddd	g�\}}Wn.tjk
r\}ztd|�W5d}~XYnXt�}|D]�\}}|d
kr�td�qh|dkr�tt�t�d�qh|d
kr�d|_	qh|dkr�||_
qh|dkr�tjaqh|dkr�d|_
qh|dkrhzt|�}||_Wqhtd|tjd�t�d�YqhXqht|�dk�r<d}d}nPt|�dk�rX|d}d}n4t|�dk�rx|d}|d}ntddt�|��|�d�}	|	dk�r�tdd|�|d|	�|_zt||	dd��|_Wn$tk
�r�tdd|�YnX|�d�}	|	dk�rtdd|�|d|	�|_zt||	dd��|_Wn$tk
�rjtdd|�YnX|S) Nr$z	nVhc:s:duzclass=Znosetuid�version�helpzsize=�debugr�)z-hz--helpr)z-Vz	--version)z-nz
--nosetuidF)z-cz--class)z-dz--debug)z-uz
--smtputf8T)z-sz--sizezInvalid size: rzlocalhost:8025zlocalhost:25r_�zInvalid arguments: %s�:zBad local spec: %szBad local port: %szBad remote spec: %szBad remote port: %s)�getoptr�argv�errorr#r�rrRr!r�r�r rPr<r�r�r}�
COMMASPACEr�r��	localhost�	localportr*�
remotehost�
remoteport)
ZoptsrMr��options�optr�Zint_sizeZ	localspecZ
remotespecr�rrr�	parseargsfsv��






r
�__main__r1r$)r<z7Cannot import module "pwd"; try running with -n option.r�nobodyr_z3Cannot setuid "nobody"; try running with -n option.)r)@rr�osrNrr�rHr�r5r��warningsrZemail._header_value_parserrr�__all__rZprogramrRr
rPrArr�r#r6rr�rrrr	r�r
rrr��rfindZlastdot�
__import__r�locals�modrr�Zclass_rrr	r
r�r<�proxyr��pwd�ImportErrorrr r!�getpwnamr�PermissionErrorZloop�KeyboardInterruptrrrr�<module>s�N�

M-SB




�trace.cpython-38.pyc000064400000047120150335716500010303 0ustar00U

e5d�t�@s�dZddgZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZddlZdZGdd�d�Zd	d
�Zdd�ZGd
d�d�Zdd�Zdd�Zddd�Zdd�ZGdd�d�Zdd�Zedkr�e�dS)a�program/module to trace Python program or function execution

Sample use, command line:
  trace.py -c -f counts --ignore-dir '$prefix' spam.py eggs
  trace.py -t --ignore-dir '$prefix' spam.py eggs
  trace.py --trackcalls spam.py eggs

Sample use, programmatically
  import sys

  # create a Trace object, telling it what to ignore, and whether to
  # do tracing or line-counting or both.
  tracer = trace.Trace(ignoredirs=[sys.base_prefix, sys.base_exec_prefix,],
                       trace=0, count=1)
  # run the new command using the given tracer
  tracer.run('main()')
  # make a report, placing output in /tmp
  r = tracer.results()
  r.write_results(show_missing=True, coverdir="/tmp")
�Trace�CoverageResults�N)�	monotonicz#pragma NO COVERc@seZdZddd�Zdd�ZdS)�_IgnoreNcCs:|s
t�nt|�|_|sgndd�|D�|_ddi|_dS)NcSsg|]}tj�|��qS�)�os�path�normpath��.0�drr�/usr/lib64/python3.8/trace.py�
<listcomp>Hs�z$_Ignore.__init__.<locals>.<listcomp>z<string>�)�set�_mods�_dirs�_ignore)�self�modules�dirsrrr
�__init__Fs
�z_Ignore.__init__cCs�||jkr|j|S||jkr,d|j|<dS|jD]"}|�|d�r2d|j|<dSq2|dkrld|j|<dS|jD]$}|�|tj�rrd|j|<dSqrd|j|<dS)Nr�.r)rr�
startswithrr�sep)r�filename�
modulename�modrrrr
�namesLs$









z
_Ignore.names)NN)�__name__�
__module__�__qualname__rrrrrr
rEs
rcCs tj�|�}tj�|�\}}|S)z-Return a plausible module name for the patch.)rr�basename�splitext)r�baser�extrrr
�_modnamewsr&cCs�tj�|�}d}tjD]@}tj�|�}|�|�r|t|�tjkrt|�t|�kr|}q|rr|t|�dd�}n|}tj�|�\}}|�tjd�}tj	r�|�tj	d�}tj�
|�\}}|�d�S)z,Return a plausible module name for the path.�rNr)rr�normcase�sysr�lenr�
splitdrive�replace�altsepr#�lstrip)rZcomparepathZlongest�dirr$Zdriverr%rrr
�_fullmodname~s 
r0c@s:eZdZddd�Zdd�Zdd�Zdd
d�Zddd
�ZdS)rNc
Cs�||_|jdkri|_|j��|_||_|jdkr8i|_|j��|_||_|jdkrZi|_|j��|_||_||_|jr�z@t|jd��}t�	|�\}}}W5QRX|�
|�|||��Wn@tt
tfk
r�}ztd|j|ftjd�W5d}~XYnXdS)N�rbzSkipping counts file %r: %s��file)�counts�copyZcounter�calledfuncs�callers�infile�outfile�open�pickle�load�update�	__class__�OSError�EOFError�
ValueError�printr)�stderr)rr4r6r8r7r9�f�errrrr
r�s2


��zCoverageResults.__init__cCs|�d�o|�d�S)z_Return True if the filename does not refer to a file
        we want to have reported.
        �<�>)r�endswith)rrrrr
�is_ignored_filename�sz#CoverageResults.is_ignored_filenamec	Csn|j}|j}|j}|j}|j}|j}|D]}|�|d�||||<q(|D]}d||<qJ|D]}d||<q\dS)z.Merge in the data from another CoverageResultsrrN)r4r6r7�get)	r�otherr4r6r7Zother_countsZother_calledfuncsZ
other_callers�keyrrr
r=�s
zCoverageResults.updateTFc"
Cs�|jr@t�td�|j}t|�D]\}}}td|||f�q"|jr�t�td�d}}	t|j�D]h\\}
}}\}
}}|
|kr�t�td|
d�|
}d}	|
|
kr�|	|
kr�td|
�|
}	td||||f�qfi}|jD].\}}|�|i�}||<|j||f||<q�i}|��D�]\}}|�|��r0�q|�d��rH|d	d
�}|d	k�rpt	j
�t	j
�|��}t
|�}n$|}t	j
�|��s�t	�|�t|�}|�r�t|�}ni}t�|�}t	j
�||d�}t|d��}t�|j�\}}W5QRX|�|||||�\}}|�r|�rtd
||�}||||f||<�q|�rt|�rttd�t|�D]&}||\}}}}td||��qL|j�r�z6t|jd�� } t�|j|j|jf| d�W5QRXWn6tk
�r�}!ztd|!tj d�W5d	}!~!XYnXd	S)af
        Write the coverage results.

        :param show_missing: Show lines that had no hits.
        :param summary: Include coverage summary per module.
        :param coverdir: If None, the results of each module are placed in its
                         directory, otherwise it is included in the directory
                         specified.
        zfunctions called:z*filename: %s, modulename: %s, funcname: %szcalling relationships:r'z***z  -->z    %s.%s -> %s.%sz.pycN���z.coverr1�dzlines   cov%   module   (path)z%5d   %3d%%   %s   (%s)�wbrz"Can't save counts files because %sr2)!r6rB�sortedr7r4rJ�itemsrIrHrr�dirname�abspathr&�exists�makedirsr0�_find_executable_linenos�	linecache�getlines�joinr:�tokenize�detect_encoding�readline�write_results_file�intr9r;�dumpr?r)rC)"rZshow_missing�summary�coverdirZcallsrr�funcnameZlastfileZ	lastcfileZpfileZpmodZpfunc�cfileZcmodZcfuncZper_file�lineno�	lines_hitZsums�countr/�lnotab�sourceZ	coverpath�fp�encoding�_�n_hits�n_linesZpercent�mrDrErrr
�
write_results�s�
��





��zCoverageResults.write_resultsc
Cs�zt|d|d�}Wn>tk
rP}z td||ftjd�WY�dSd}~XYnXd}d}	|��t|d�D]r\}
}|
|kr�|�d	||
�|	d7}	|d7}n.|
|kr�t|kr�|�d
�|d7}n
|�d�|�|�d��qjW5QRX|	|fS)
z'Return a coverage results file in path.�w�rjz3trace: Could not open %r for writing: %s - skippingr2)rrNrrz%5d: z>>>>>> z       �)	r:r?rBr)rC�	enumerate�write�PRAGMA_NOCOVER�
expandtabs)rr�linesrgrerjr9rErmrlrd�linerrr
r])s.��



z"CoverageResults.write_results_file)NNNNN)TFN)N)rr r!rrIr=ror]rrrr
r�s�

\cCs,i}t�|�D]\}}||krd||<q|S)z:Return dict where keys are lines in the line number table.r)�disZfindlinestarts)�code�strs�linenosrkrdrrr
�_find_lines_from_codeIs

r}cCs4t||�}|jD]}t�|�r|�t||��q|S)z<Return lineno dict for all code objects reachable from code.)r}�	co_consts�inspectZiscoder=�_find_lines)rzr{r|�crrr
r�Ss



r�c	Cs�i}tj}t||d��j}t�|j�}|D]R\}}}}	}
|tjkrv|tjkrv|\}}|	\}
}t||
d�D]}d||<qh|}q(W5QRX|S)z�Return a dict of possible docstring positions.

    The dict maps line numbers to strings.  There is an entry for
    line that contains only a string or a part of a triple-quoted
    string.
    rqr)�token�INDENTr:rZ�generate_tokensr\�STRING�range)rrjrZ
prev_ttyperD�tokZttypeZtstr�start�endrxZslineZscolZelineZecol�irrr
�
_find_strings_s


r�c
Cs�z(t�|��}|��}|j}W5QRXWn@tk
rh}z"td||ftjd�iWY�Sd}~XYnXt||d�}t	||�}t
||�S)zAReturn dict where keys are line numbers in the line number table.z%Not printing coverage data for %r: %sr2N�exec)rZr:�readrjr?rBr)rC�compiler�r�)rrD�progrjrErzr{rrr
rVvs��
rVc	@sveZdZddd�Zdd	�Zd d
d�Zdd
�Zde_dd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)!rrrrNFc

Cs�||_||_t||�|_i|_i|_d|_||_i|_i|_	i|_
d|_|	rTt�|_|rb|j
|_nZ|rp|j|_nL|r�|r�|j|_|j|_n2|r�|j|_|j|_n|r�|j|_|j|_nd|_dS)ax
        @param count true iff it should count number of times each
                     line is executed
        @param trace true iff it should print out each line that is
                     being counted
        @param countfuncs true iff it should just output a list of
                     (filename, modulename, funcname,) for functions
                     that were called at least once;  This overrides
                     `count' and `trace'
        @param ignoremods a list of the names of modules to ignore
        @param ignoredirs a list of the names of directories to ignore
                     all of the (recursive) contents of
        @param infile file from which to read stored counts to be
                     added into the results
        @param outfile file in which to write the results
        @param timing true iff timing information be displayed
        rNr)r8r9r�ignorer4Zpathtobasename�	donothing�trace�_calledfuncs�_callers�
_caller_cache�
start_time�_time�globaltrace_trackcallers�globaltrace�globaltrace_countfuncs�globaltrace_lt�localtrace_trace_and_count�
localtrace�localtrace_trace�localtrace_count)
rrfr��
countfuncs�countcallers�
ignoremods�
ignoredirsr8r9�timingrrr
r�s6




zTrace.__init__cCs ddl}|j}|�|||�dS)Nr)�__main__�__dict__�runctx)r�cmdr��dictrrr
�run�sz	Trace.runc	Csh|dkri}|dkri}|js6t�|j�t�|j�zt|||�W5|jsbt�d�t�d�XdS)N)r��	threading�settracer�r)r�)rr��globals�localsrrr
r��s
zTrace.runctxc	Os�t|�dkr|^}}}nV|s&td��nHd|krZ|�d�}|^}}ddl}|jdtdd�ntdt|�d��d}|js�t�|j	�z|||�}W5|js�t�d�X|S)	N�z8descriptor 'runfunc' of 'Trace' object needs an argument�funcrz0Passing 'func' as keyword argument is deprecated)�
stacklevelz7runfunc expected at least 1 positional argument, got %dr)
r*�	TypeError�pop�warnings�warn�DeprecationWarningr�r)r�r�)�args�kwrr�r��resultrrr
�runfunc�s.

�
�z
Trace.runfuncz($self, func, /, *args, **kw)c
Cs�|j}|j}|rt|�}nd}|j}d}||jkrL|j|dk	r�|j|}n�d|j|<dd�t�|�D�}t|�dkr�dd�t�|d�D�}t|�dkr�dd�t�|d�D�}	t|	�dkr�|	dj}||j|<|dk	r�d||f}|||fS)NcSsg|]}t�|�r|�qSr)rZ
isfunction)rrDrrr
r�s
�z1Trace.file_module_function_of.<locals>.<listcomp>rcSsg|]}t|t�r|�qSr)�
isinstancer�r
rrr
r�s
�rcSsg|]}t|d�r|�qS)�	__bases__)�hasattr)rr�rrr
r�s
�z%s.%s)	�f_code�co_filenamer&�co_namer��gcZ
get_referrersr*r)
r�framerzrrrbZclsnameZfuncsZdicts�classesrrr
�file_module_function_of�s,




zTrace.file_module_function_ofcCs0|dkr,|�|�}|�|j�}d|j||f<dS)zkHandler for call events.

        Adds information about who called who to the self._callers dict.
        �callrN)r��f_backr�)rr��why�arg�	this_funcZparent_funcrrr
r�
s
zTrace.globaltrace_trackcallerscCs |dkr|�|�}d|j|<dS)zoHandler for call events.

        Adds (filename, modulename, funcname) to the self._calledfuncs dict.
        r�rN)r�r�)rr�r�r�r�rrr
r�s
zTrace.globaltrace_countfuncscCsj|dkrf|j}|j�dd�}|rbt|�}|dk	rf|j�||�}|sf|jrZtd||jf�|j	SndSdS)z�Handler for call events.

        If the code block being entered is to be ignored, returns `None',
        else returns self.localtrace.
        r��__file__Nz! --- modulename: %s, funcname: %s)
r��	f_globalsrJr&r�rr�rBr�r�)rr�r�r�rzrrZ	ignore_itrrr
r�!s�zTrace.globaltrace_ltcCs�|dkr~|jj}|j}||f}|j�|d�d|j|<|jrTtdt�|jdd�tj	�
|�}td||t�||�fdd�|j
S)	Nrxrr�%.2f� �r��
%s(%d): %sr')r�r��f_linenor4rJr�rBr�rrr"rW�getliner�)rr�r�r�rrdrL�bnamerrr
r�8s
��z Trace.localtrace_trace_and_countcCsd|dkr^|jj}|j}|jr4tdt�|jdd�tj�|�}td||t	�
||�fdd�|jS)Nrxr�r�r�r�r')r�r�r�r�rBr�rrr"rWr�r�)rr�r�r�rrdr�rrr
r�Gs
��zTrace.localtrace_tracecCs<|dkr6|jj}|j}||f}|j�|d�d|j|<|jS)Nrxrr)r�r�r�r4rJr�)rr�r�r�rrdrLrrr
r�TszTrace.localtrace_countcCst|j|j|j|j|jd�S)N)r8r9r6r7)rr4r8r9r�r�)rrrr
�results\s

�z
Trace.results)	rrrrrrNNF)NN)rr r!rr�r�r��__text_signature__r�r�r�r�r�r�r�r�rrrr
r�s&�
2

)	
cs�ddl}|��}|jdddd�|�dd�}|jdd	d
dd�|jd
dd
dd�|jddd
dd�|jddd
dd�|�d�}|��}|jddd
dd�|jddd
dd�|jdddd �|jd!d"d#d �|jd$d%d
d&d�|jd'd(d
d)d�|jd*d+d
d,d�|�d-d.�}|jd/d0gd1d2�|jd3d0gd4d2�|jd5d
d6d7d2�|jd8d9d:d;�|jd<|jd=d;�|��}|j�r�t�	d>��t�	d?����fd@dA��dBdC�|j
D�|_
�fdDdC�|jD�|_|j�r�|j�s�|�
dE�t|j|jdF�}|�|j|j|j�St|j|j|j|jg��s |�
dG�|j�rB|j�s8|j�rB|�
dH�|j�r\|j�s\|�
dI�|jdk�rr|�
dJ�t|j|j|j|j|j
|j|j|j|jdK�	}z�|j�r�ddl}|j}|�|�\}	}
}|jf|j�t _!dL|j|
j"|
j#|
ddM�}n^|jf|j�t _!t$j%�&|j�t j%d<t'�(|j��}
t)|
�*�|jdN�}W5QRX|jdLdddO�}|�+|||�WnPt,k
�r�}zt �-dPt j!d|f�W5d}~XYnt.k
�r�YnX|�/�}|j0�s�|�|j|j|j�dS)QNrz	--version�versionz	trace 2.0)�actionr�zMain optionsz(One of these (or --report) must be givenz-cz--count�
store_truez�Count the number of times each line is executed and write the counts to <module>.cover for each module executed, in the module's directory. See also --coverdir, --file, --no-report below.)r��helpz-tz--tracez3Print each line to sys.stdout before it is executedz-lz--listfuncsz�Keep track of which functions are executed at least once and write the results to sys.stdout after the program exits. Cannot be specified alongside --trace or --count.z-Tz--trackcallsz^Keep track of caller/called pairs and write the results to sys.stdout after the program exits.Z	Modifiersz-rz--reportz�Generate a report from a counts file; does not execute any code. --file must specify the results file to read, which must have been created in a previous run with --count --file=FILEz-Rz--no-reportz^Do not generate the coverage report files. Useful if you want to accumulate over several runs.z-fz--filez+File to accumulate counts over several runs)r�z-Cz
--coverdirz�Directory where the report files go. The coverage report for <package>.<module> will be written to file <dir>/<package>/<module>.coverz-mz	--missingz?Annotate executable lines that were not executed with ">>>>>> "z-sz	--summaryz\Write a brief summary for each file to sys.stdout. Can only be used with --count or --reportz-gz--timingzQPrefix each line with the time since the program started. Only used while tracingZFilterszCan be specified multiple timesz--ignore-module�appendzqIgnore the given module(s) and its submodules (if it is a package). Accepts comma separated list of module names.)r��defaultr�z--ignore-dirzWIgnore files in the given directory (multiple directories can be joined by os.pathsep).z--moduleFzTrace a module. �progname�?zfile to run as main program)�nargsr��	argumentszarguments to the programZstdlibZ
platstdlibcs4tj�tj�|��}|�d���d��}tj�|�S)Nz$prefixz$exec_prefix)rr�
expanduser�
expandvarsr,r	)�s)�_exec_prefix�_prefixrr
�parse_ignore_dir�szmain.<locals>.parse_ignore_dircSs$g|]}|�d�D]}|���qqS)�,)�split�strip)rr�rrrr
r�s�zmain.<locals>.<listcomp>cs&g|]}|�tj�D]}�|��qqSr)r�r�pathsep)rr�r�)r�rr
r�s�z-r/--report requires -f/--file)r8r9zLmust specify one of --trace, --count, --report, --listfuncs, or --trackcallsz8cannot specify both --listfuncs and (--trace or --count)z3--summary can only be used with --count or --reportz3progname is missing: required with the main options)r�r�r�r�r8r9r�r�)rr��__package__�
__loader__�__spec__�
__cached__r�)r�rr�r�zCannot run file %r because: %s)1�argparse�ArgumentParser�add_argumentZadd_argument_groupZadd_mutually_exclusive_groupZ	REMAINDER�
parse_argsZ
ignore_dir�	sysconfigZget_pathZ
ignore_moduleZreportr3�errorrroZmissingr`ra�anyr�rfZ	listfuncsZ
trackcallsr�rr��module�runpyZ_get_module_detailsr�r�r)�argv�parent�loaderrrrR�io�	open_coder�r�r�r?�exit�
SystemExitr�Z	no_report)r��parserZgrpZ_grpZoptsr��tr�Zmodule_nameZmod_nameZmod_specrzZglobsrirEr)r�r�r�r
�mainbs��
�
�
�
�

�
���
�
�
��
�
�
��
�

�
�




��	�(r�r�)N)�__doc__�__all__r�rWrr)r�r�rZrr�ryr;�timerr�r�rurr&r0rr}r�r�rVrr�rrrrr
�<module>s<20

_copy.cpython-38.pyc000064400000015515150335716500010162 0ustar00U

e5d�!�@sTdZddlZddlZddlmZGdd�de�ZeZzddlm	Z	Wne
k
r\dZ	YnXdddgZd	d�ZiZ
Zd
d�Zed�eeeeeeeeeeeeejee�ee�ejej fD]Z!eee!<q�e"edd�Z!e!dk	r�eee!<e#jee#<e$jee$<e%jee%<e&jee&<e	dk	�r e	jee	<[[!dgfd
d�Z'iZ(Zdd�Z)e)eed�<e)eee�<e)eee�<e)ee<e)ee<e)ee<e)ee<e)ee<e)ee<e)eej*<e)ee<e)eej<e)eej<e)eej <e)ee<e'fdd�Z+e+ee#<e'fdd�Z,e,ee<e'fdd�Z-e-ee$<e	dk	�re-ee	<dd�Z.e.eej/<[dd�Z0ddde'fdd�Z1[[[	dS)a�Generic (shallow and deep) copying operations.

Interface summary:

        import copy

        x = copy.copy(y)        # make a shallow copy of y
        x = copy.deepcopy(y)    # make a deep copy of y

For module specific errors, copy.Error is raised.

The difference between shallow and deep copying is only relevant for
compound objects (objects that contain other objects, like lists or
class instances).

- A shallow copy constructs a new compound object and then (to the
  extent possible) inserts *the same objects* into it that the
  original contains.

- A deep copy constructs a new compound object and then, recursively,
  inserts *copies* into it of the objects found in the original.

Two problems often exist with deep copy operations that don't exist
with shallow copy operations:

 a) recursive objects (compound objects that, directly or indirectly,
    contain a reference to themselves) may cause a recursive loop

 b) because deep copy copies *everything* it may copy too much, e.g.
    administrative data structures that should be shared even between
    copies

Python's deep copy operation avoids these problems by:

 a) keeping a table of objects already copied during the current
    copying pass

 b) letting user-defined classes override the copying operation or the
    set of components copied

This version does not copy types like module, class, function, method,
nor stack trace, stack frame, nor file, socket, window, nor array, nor
any similar types.

Classes can use the same interfaces to control copying that they use
to control pickling: they can define methods called __getinitargs__(),
__getstate__() and __setstate__().  See the documentation for module
"pickle" for information on these methods.
�N)�dispatch_tablec@seZdZdS)�ErrorN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.8/copy.pyr7sr)�PyStringMap�copy�deepcopycCs�t|�}t�|�}|r||�St|t�r0t|�St|dd�}|dk	rL||�St�|�}|dk	rh||�}nBt|dd�}|dk	r�|d�}n$t|dd�}|r�|�}ntd|��t|t	�r�|St
|df|��S)zlShallow copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    �__copy__N�
__reduce_ex__��
__reduce__z%un(shallow)copyable object of type %s)�type�_copy_dispatch�get�
issubclass�_copy_immutable�getattrrr�
isinstance�str�_reconstruct)�x�cls�copier�reductor�rvrrrr
Bs,





cCs|S�Nr)rrrrrksr�CodeTypec	Cs |dkri}t|�}|�||�}||k	r,|St|�}t�|�}|dk	rR|||�}n�t|t�rht||�}n�t|dd�}|dk	r�||�}nzt�|�}|r�||�}nBt|dd�}|dk	r�|d�}n$t|dd�}|r�|�}ntd|��t	|t
�r�|}nt||f|��}||k	�r|||<t||�|S)ziDeep copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    N�__deepcopy__r
rrz"un(deep)copyable object of type %s)
�idrr�_deepcopy_dispatchr�_deepcopy_atomicrrrrrr�_keep_alive)	r�memoZ_nil�d�yrrrrrrrr�sD





�


cCs|Srr�rr%rrrr#�sr#cCs2g}||t|�<|j}|D]}||||��q|Sr)r!�append)rr%rr'r)�arrr�_deepcopy_list�sr+csh��fdd�|D�}z�t|�WStk
r6YnXt||�D]\}}||k	rBt|�}qdqB|}|S)Ncsg|]}�|���qSrr)�.0r*�rr%rr�
<listcomp>�sz#_deepcopy_tuple.<locals>.<listcomp>)r!�KeyError�zip�tuple)rr%rr'�k�jrr-r�_deepcopy_tuple�sr4cCs:i}||t|�<|��D]\}}|||�||||�<q|Sr)r!�items)rr%rr'�key�valuerrr�_deepcopy_dict�s
r8cCst|�|jt|j|��Sr)r�__func__r�__self__r(rrr�_deepcopy_method�sr;cCs>z|t|��|�Wn"tk
r8|g|t|�<YnXdS)aMKeeps a reference to the object x in the memo.

    Because we remember objects by their id, we have
    to assure that possibly temporary objects are kept
    alive by referencing them.
    We store a reference at the id of the memo, which should
    normally not be used unless someone tries to deepcopy
    the memo itself...
    N)r!r)r/r(rrrr$�s
r$csb�dk	}|r$|r$��fdd�|D�}||�}	|r<|	�t|�<|dk	r�|rR�|��}t|	d�rh|	�|�n^t|t�r�t|�dkr�|\}}
nd}
|dk	r�|	j�|�|
dk	r�|
��D]\}}t	|	||�q�|dk	�r|r�|D]}
�|
��}
|	�
|
�q�n|D]}
|	�
|
�q�|dk	�r^|�rF|D]&\}}�|��}�|��}||	|<�qn|D]\}}||	|<�qJ|	S)Nc3s|]}�|��VqdSrr)r,�argr-rr�	<genexpr>sz_reconstruct.<locals>.<genexpr>�__setstate__�)r!�hasattrr>rr1�len�__dict__�updater5�setattrr))rr%�func�args�stateZlistiterZdictiterrZdeepr'Z	slotstater6r7�itemrr-rrsF







r)2�__doc__�types�weakref�copyregr�	Exceptionr�errorZorg.python.corer	�ImportError�__all__r
rr&rr�int�float�bool�complexrr1�bytes�	frozenset�range�slice�property�BuiltinFunctionType�Ellipsis�NotImplemented�FunctionType�ref�tr�list�dict�set�	bytearrayrr"r#rr+r4r8r;�
MethodTyper$rrrrr�<module>s�2

'�






4





�
-_sysconfigdata_d_linux_x86_64-linux-gnu.cpython-38.opt-1.pyc000064400000070505150335716500017630 0ustar00U

��.e]���@s`dddddddddddd	d
dddd
ddddddddddddddddddddddd	dd dd!d"d#d$d%dddd&d'dd(d)d*d&d+dd!dd,d-dddddddd.d&d&d&d&dd&dd&d&d&d&d&dddddddddd&dd&d&d&d&d&d&d&d&dd&d&d&d&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&dd&dd&dd&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&d&d&dd&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&ddd&d&dd&dddd&d&d&ddd&d&dddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&d&d&dd&d&dd&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&d&d&d&d&d&ddd&d&d&dd&d&ddd&d&d&d&d&d&d&dddddd&dd&d&dddddd&ddd&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&ddd&d&d&ddd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&dd
d/ddd0d1d0d0d2d3d4dd5d6d7ddd8dd	d9dd:d;dd<d=dd>ddd?d@dAdBddd+ddCdDddEdd	dddd&dFdGdHdIdddJddKdLd&dMddddNdOdddddddddPdQdRdddSd&d&dddddTddddUdVdddWddXd&dYdZdd[d6d\d]dd^d&d&ddd_d`dadbdcd9dddded?dfd&dddgdhdidhdgdidgdgdhdhdgd]dgdgdgdgdhd&djdkdld&dmdnddod:d&dddddpddqdrdd&ddddsd&dtdud&d&d&d&dddd&d&ddvdwdudxdydydudz���Zd{S)|�d�z"cpython-38-x86_64-linux-gnu"ZarZrcsz!-Wno-unused-result -Wsign-comparez-IObjects -IInclude -IPython�z/usr/binz/usr/lib64/python3.8z-L. -lpython3.8dzOgcc -pthread -shared -Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g�pythonzx86_64-redhat-linux-gnu�\zgcc -pthreadz-fPICa{-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -Ogz?configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.ina-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvaK-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declarationz-Wl,-z,relro  -Wl,-z,now  -gz�-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -ga�'--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-ipv6' '--enable-shared' '--with-computed-gotos=yes' '--with-dbmliborder=gdbm:ndbm:bdb' '--with-system-expat' '--with-system-ffi' '--enable-loadable-sqlite-extensions' '--with-dtrace' '--with-lto' '--with-ssl-default-suites=openssl' '--with-valgrind' '--without-ensurepip' '--with-pydebug' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS= -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv ' 'LDFLAGS= -Wl,-z,relro  -Wl,-z,now  -g ' 'CPPFLAGS=' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'z/usr/includez/usr/include/python3.8dz=/builddir/build/BUILD/Python-3.8.17/build/debug/coverage.infoz;/builddir/build/BUILD/Python-3.8.17/build/debug/lcov-reportz2--no-branch-coverage --title "CPython lcov report"zN-IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Includezg++ -pthreadzE/usr /usr/lib64 /usr/lib64/python3.8 /usr/lib64/python3.8/lib-dynloadz /usr/lib64/python3.8/lib-dynloadi�zoREADME.rst ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Ext-dummyzInclude Lib Misc Ext-dummyzTREADME.rst ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in�.�z/usr/bin/dtracezInclude/pydtrace_probes.hzPython/pydtrace.ozdynload_shlib.oZnoz .cpython-38d-x86_64-linux-gnu.soi�ZyeszI/usr/include /usr/include /usr/include/python3.8d /usr/include/python3.8dz/usr/bin/install -cz/usr/bin/install -c -m 644z/usr/bin/install -c -m 755zlibpython3.8d.so.1.0zModules/_io/_iomodule.hzg++ -pthread -sharedz:-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -gzlibpython3.8d.soz3.8dz
/usr/lib64z-lmzPython/z/usr/lib64/pkgconfigz1/usr/lib64/python3.8/config-3.8d-x86_64-linux-gnuzlibpython3.8d.az"-lcrypt -lpthread -ldl  -lutil -lmz0tkinter tkinter/test tkinter/test/test_tkinter \Zgccz-Xlinker -export-dynamic�trueZlnZlinuxz5/builddir/build/BUILD/Python-3.8.17/Modules/makesetupz/usr/share/manz/usr/bin/mkdir -pz�posix  errno  pwd  _sre  _codecs  _weakref  _functools  _operator  _collections  _abc  itertools  atexit  _signal  _stat  time  _thread  _locale  _io  faulthandler  _tracemalloc  _symtable  xxsubtypeavModules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/_abc.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_threadmodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  Modules/symtablemodule.o  Modules/xxsubtype.ozx86_64-linux-gnuz -DMULTIARCH=\"x86_64-linux-gnu\"z-Wl,--no-as-neededz-lssl -lcryptoa1-DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz:\ Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.oz-fprofile-generatez"-fprofile-use -fprofile-correctionz
-m test --pgozno-frameworkz./python -Ez	python3.8a�-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -Og -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Og -I/builddir/build/BUILD/Python-3.8.17/Include/internal -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Include -fPIC -DPy_BUILD_CORE_BUILTINa-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Og -I/builddir/build/BUILD/Python-3.8.17/Include/internala�-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -Og -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Og -I/builddir/build/BUILD/Python-3.8.17/Include/internal -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Include -fPIC -DPy_BUILD_COREaT-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g -lcryptoz"z"a-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g�a�-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -Og -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -Og -I/builddir/build/BUILD/Python-3.8.17/Include/internal -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Include -fPICz)-x test_subprocess test_io test_lib2to3 \ZreadelfzMac/Resources/frameworkZvoidz?LD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.8.17/build/debugz	@SGI_ABI@z/bin/shz.so���zcpython-38d-x86_64-linux-gnuz2Parser Objects Python Modules Modules/_io Programsz:/builddir/build/BUILD/Python-3.8.17/Tools/gdb/libpython.pyz"/* Don't use ncurses extensions */z-szInclude Lib MisczHLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.8.17/build/debug ./pythonz�LD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.8.17/build/debug ./python /builddir/build/BUILD/Python-3.8.17/Tools/scripts/run_tests.pyi�zJpython3.8 /builddir/build/BUILD/Python-3.8.17/Tools/scripts/update_file.pyz3.8z#/builddir/build/BUILD/Python-3.8.17z)xml xml/dom xml/etree xml/parsers xml/saxz//builddir/build/BUILD/Python-3.8.17/build/debugz
/usr/sharez/usr(�ZABIFLAGSZAC_APPLE_UNIVERSAL_BUILDZAIX_GENUINE_CPLUSPLUSZ	ALT_SOABIZANDROID_API_LEVELZARZARFLAGSZ
BASECFLAGSZBASECPPFLAGSZBASEMODLIBSZBINDIRZ
BINLIBDESTZ
BLDLIBRARYZ	BLDSHAREDZBUILDEXEZBUILDPYTHONZBUILD_GNU_TYPEZBYTESTR_DEPSZCCZCCSHAREDZCFLAGSZCFLAGSFORSHAREDZCFLAGS_ALIASINGZCONFIGFILESZCONFIGURE_CFLAGSZCONFIGURE_CFLAGS_NODISTZCONFIGURE_CPPFLAGSZCONFIGURE_LDFLAGSZCONFIGURE_LDFLAGS_NODISTZCONFIG_ARGSZCONFINCLUDEDIRZ
CONFINCLUDEPYZCOREPYTHONPATHZ
COVERAGE_INFOZCOVERAGE_REPORTZCOVERAGE_REPORT_OPTIONSZCPPFLAGSZCXXZDESTDIRSZDESTLIBZDESTPATHZ
DESTSHAREDZDFLAGSZDIRMODEZDISTZDISTDIRSZ	DISTFILESZ	DLINCLDIRZ
DLLLIBRARYZ"DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754ZDOUBLE_IS_BIG_ENDIAN_IEEE754ZDOUBLE_IS_LITTLE_ENDIAN_IEEE754ZDTRACEZDTRACE_DEPSZDTRACE_HEADERSZDTRACE_OBJSZDYNLOADFILEZENABLE_IPV6Z	ENSUREPIPZEXEZEXEMODEZ
EXTRATESTOPTSZ
EXT_SUFFIXZFILEMODEZFLOAT_WORDS_BIGENDIANZFLOCK_NEEDS_LIBBSDZGETPGRP_HAVE_ARGZGETTIMEOFDAY_NO_TZZ	GITBRANCHZGITTAGZ
GITVERSIONZGNULDZHAVE_ACCEPT4Z
HAVE_ACOSHZ
HAVE_ADDRINFOZ
HAVE_ALARMZHAVE_ALIGNED_REQUIREDZ
HAVE_ALLOCA_HZHAVE_ALTZONEZ
HAVE_ASINHZHAVE_ASM_TYPES_HZ
HAVE_ATANHZHAVE_BIND_TEXTDOMAIN_CODESETZHAVE_BLUETOOTH_BLUETOOTH_HZHAVE_BLUETOOTH_HZHAVE_BROKEN_MBSTOWCSZHAVE_BROKEN_NICEZHAVE_BROKEN_PIPE_BUFZHAVE_BROKEN_POLLZHAVE_BROKEN_POSIX_SEMAPHORESZHAVE_BROKEN_PTHREAD_SIGMASKZHAVE_BROKEN_SEM_GETVALUEZHAVE_BROKEN_UNSETENVZHAVE_BUILTIN_ATOMICZHAVE_CHFLAGSZ
HAVE_CHOWNZHAVE_CHROOTZ
HAVE_CLOCKZHAVE_CLOCK_GETRESZHAVE_CLOCK_GETTIMEZHAVE_CLOCK_SETTIMEZHAVE_COMPUTED_GOTOSZHAVE_CONFSTRZHAVE_CONIO_HZ
HAVE_COPYSIGNZHAVE_COPY_FILE_RANGEZHAVE_CRYPT_HZHAVE_CRYPT_RZHAVE_CTERMIDZHAVE_CTERMID_RZHAVE_CURSES_FILTERZ
HAVE_CURSES_HZHAVE_CURSES_HAS_KEYZHAVE_CURSES_IMMEDOKZHAVE_CURSES_IS_PADZHAVE_CURSES_IS_TERM_RESIZEDZHAVE_CURSES_RESIZETERMZHAVE_CURSES_RESIZE_TERMZHAVE_CURSES_SYNCOKZHAVE_CURSES_TYPEAHEADZHAVE_CURSES_USE_ENVZHAVE_CURSES_WCHGATZHAVE_DECL_ISFINITEZHAVE_DECL_ISINFZHAVE_DECL_ISNANZHAVE_DECL_RTLD_DEEPBINDZHAVE_DECL_RTLD_GLOBALZHAVE_DECL_RTLD_LAZYZHAVE_DECL_RTLD_LOCALZHAVE_DECL_RTLD_MEMBERZHAVE_DECL_RTLD_NODELETEZHAVE_DECL_RTLD_NOLOADZHAVE_DECL_RTLD_NOWZHAVE_DECL_TZNAMEZHAVE_DEVICE_MACROSZHAVE_DEV_PTCZ
HAVE_DEV_PTMXZ
HAVE_DIRECT_HZHAVE_DIRENT_D_TYPEZ
HAVE_DIRENT_HZ
HAVE_DIRFDZHAVE_DLFCN_HZHAVE_DLOPENZ	HAVE_DUP2Z	HAVE_DUP3Z$HAVE_DYLD_SHARED_CACHE_CONTAINS_PATHZHAVE_DYNAMIC_LOADINGZ
HAVE_ENDIAN_HZ
HAVE_EPOLLZHAVE_EPOLL_CREATE1ZHAVE_ERFZ	HAVE_ERFCZHAVE_ERRNO_HZ
HAVE_EXECVZHAVE_EXPLICIT_BZEROZHAVE_EXPLICIT_MEMSETZ
HAVE_EXPM1ZHAVE_FACCESSATZHAVE_FCHDIRZHAVE_FCHMODZ
HAVE_FCHMODATZHAVE_FCHOWNZ
HAVE_FCHOWNATZHAVE_FCNTL_HZHAVE_FDATASYNCZHAVE_FDOPENDIRZHAVE_FDWALKZHAVE_FEXECVEZHAVE_FINITEZ
HAVE_FLOCKZ	HAVE_FORKZHAVE_FORKPTYZHAVE_FPATHCONFZHAVE_FSEEK64ZHAVE_FSEEKOZHAVE_FSTATATZ
HAVE_FSTATVFSZ
HAVE_FSYNCZHAVE_FTELL64ZHAVE_FTELLOZ
HAVE_FTIMEZHAVE_FTRUNCATEZ
HAVE_FUTIMENSZHAVE_FUTIMESZHAVE_FUTIMESATZHAVE_GAI_STRERRORZ
HAVE_GAMMAZHAVE_GCC_ASM_FOR_MC68881ZHAVE_GCC_ASM_FOR_X64ZHAVE_GCC_ASM_FOR_X87ZHAVE_GCC_UINT128_TZHAVE_GETADDRINFOZHAVE_GETC_UNLOCKEDZHAVE_GETENTROPYZHAVE_GETGRGID_RZHAVE_GETGRNAM_RZHAVE_GETGROUPLISTZHAVE_GETGROUPSZHAVE_GETHOSTBYNAMEZHAVE_GETHOSTBYNAME_RZHAVE_GETHOSTBYNAME_R_3_ARGZHAVE_GETHOSTBYNAME_R_5_ARGZHAVE_GETHOSTBYNAME_R_6_ARGZHAVE_GETITIMERZHAVE_GETLOADAVGZ
HAVE_GETLOGINZHAVE_GETNAMEINFOZHAVE_GETPAGESIZEZHAVE_GETPEERNAMEZHAVE_GETPGIDZHAVE_GETPGRPZHAVE_GETPIDZHAVE_GETPRIORITYZ
HAVE_GETPWENTZHAVE_GETPWNAM_RZHAVE_GETPWUID_RZHAVE_GETRANDOMZHAVE_GETRANDOM_SYSCALLZHAVE_GETRESGIDZHAVE_GETRESUIDZHAVE_GETSIDZ
HAVE_GETSPENTZ
HAVE_GETSPNAMZHAVE_GETTIMEOFDAYZ
HAVE_GETWDZHAVE_GLIBC_MEMMOVE_BUGZ
HAVE_GRP_HZHAVE_HSTRERRORZHAVE_HTOLE64Z
HAVE_HYPOTZ
HAVE_IEEEFP_HZHAVE_IF_NAMEINDEXZHAVE_INET_ATONZHAVE_INET_PTONZHAVE_INITGROUPSZHAVE_INTTYPES_HZ	HAVE_IO_HZHAVE_IPA_PURE_CONST_BUGZ	HAVE_KILLZHAVE_KILLPGZHAVE_KQUEUEZHAVE_LANGINFO_HZHAVE_LARGEFILE_SUPPORTZ
HAVE_LCHFLAGSZHAVE_LCHMODZHAVE_LCHOWNZHAVE_LGAMMAZ
HAVE_LIBDLZHAVE_LIBDLDZHAVE_LIBIEEEZHAVE_LIBINTL_HZHAVE_LIBREADLINEZHAVE_LIBRESOLVZHAVE_LIBSENDFILEZHAVE_LIBUTIL_HZ	HAVE_LINKZHAVE_LINKATZHAVE_LINUX_CAN_BCM_HZHAVE_LINUX_CAN_HZHAVE_LINUX_CAN_RAW_FD_FRAMESZHAVE_LINUX_CAN_RAW_HZHAVE_LINUX_MEMFD_HZHAVE_LINUX_NETLINK_HZHAVE_LINUX_QRTR_HZHAVE_LINUX_RANDOM_HZHAVE_LINUX_TIPC_HZHAVE_LINUX_VM_SOCKETS_HZ
HAVE_LOCKFZ
HAVE_LOG1PZ	HAVE_LOG2ZHAVE_LONG_DOUBLEZ
HAVE_LSTATZHAVE_LUTIMESZHAVE_MADVISEZHAVE_MAKEDEVZHAVE_MBRTOWCZHAVE_MEMFD_CREATEZ
HAVE_MEMORY_HZHAVE_MEMRCHRZHAVE_MKDIRATZHAVE_MKFIFOZ
HAVE_MKFIFOATZ
HAVE_MKNODZHAVE_MKNODATZHAVE_MKTIMEZ	HAVE_MMAPZHAVE_MREMAPZHAVE_NCURSES_HZHAVE_NDIR_HZHAVE_NETPACKET_PACKET_HZ
HAVE_NET_IF_HZ	HAVE_NICEZHAVE_OPENATZHAVE_OPENPTYZ
HAVE_PATHCONFZ
HAVE_PAUSEZ
HAVE_PIPE2Z
HAVE_PLOCKZ	HAVE_POLLZHAVE_POLL_HZHAVE_POSIX_FADVISEZHAVE_POSIX_FALLOCATEZHAVE_POSIX_SPAWNZHAVE_POSIX_SPAWNPZ
HAVE_PREADZHAVE_PREADVZHAVE_PREADV2ZHAVE_PRLIMITZHAVE_PROCESS_HZHAVE_PROTOTYPESZHAVE_PTHREAD_CONDATTR_SETCLOCKZHAVE_PTHREAD_DESTRUCTORZHAVE_PTHREAD_GETCPUCLOCKIDZHAVE_PTHREAD_HZHAVE_PTHREAD_INITZHAVE_PTHREAD_KILLZHAVE_PTHREAD_SIGMASKZ
HAVE_PTY_HZHAVE_PUTENVZHAVE_PWRITEZHAVE_PWRITEVZ
HAVE_PWRITEV2Z
HAVE_READLINKZHAVE_READLINKATZ
HAVE_READVZ
HAVE_REALPATHZ
HAVE_RENAMEATZHAVE_RL_APPEND_HISTORYZHAVE_RL_CATCH_SIGNALZ#HAVE_RL_COMPLETION_APPEND_CHARACTERZ'HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOKZHAVE_RL_COMPLETION_MATCHESZ"HAVE_RL_COMPLETION_SUPPRESS_APPENDZHAVE_RL_PRE_INPUT_HOOKZHAVE_RL_RESIZE_TERMINALZ
HAVE_ROUNDZ
HAVE_RTPSPAWNZHAVE_SCHED_GET_PRIORITY_MAXZHAVE_SCHED_HZHAVE_SCHED_RR_GET_INTERVALZHAVE_SCHED_SETAFFINITYZHAVE_SCHED_SETPARAMZHAVE_SCHED_SETSCHEDULERZHAVE_SEM_GETVALUEZ
HAVE_SEM_OPENZHAVE_SEM_TIMEDWAITZHAVE_SEM_UNLINKZ
HAVE_SENDFILEZHAVE_SETEGIDZHAVE_SETEUIDZHAVE_SETGIDZHAVE_SETGROUPSZHAVE_SETHOSTNAMEZHAVE_SETITIMERZHAVE_SETLOCALEZHAVE_SETPGIDZHAVE_SETPGRPZHAVE_SETPRIORITYZ
HAVE_SETREGIDZHAVE_SETRESGIDZHAVE_SETRESUIDZ
HAVE_SETREUIDZHAVE_SETSIDZHAVE_SETUIDZHAVE_SETVBUFZ
HAVE_SHADOW_HZ
HAVE_SHM_OPENZHAVE_SHM_UNLINKZHAVE_SIGACTIONZHAVE_SIGALTSTACKZHAVE_SIGFILLSETZHAVE_SIGINFO_T_SI_BANDZHAVE_SIGINTERRUPTZ
HAVE_SIGNAL_HZHAVE_SIGPENDINGZ
HAVE_SIGRELSEZHAVE_SIGTIMEDWAITZHAVE_SIGWAITZHAVE_SIGWAITINFOZ
HAVE_SNPRINTFZHAVE_SOCKADDR_ALGZHAVE_SOCKADDR_SA_LENZHAVE_SOCKADDR_STORAGEZHAVE_SOCKETPAIRZHAVE_SPAWN_HZHAVE_SSIZE_TZHAVE_STATVFSZHAVE_STAT_TV_NSECZHAVE_STAT_TV_NSEC2ZHAVE_STDARG_PROTOTYPESZ
HAVE_STDINT_HZ
HAVE_STDLIB_HZHAVE_STD_ATOMICZHAVE_STRDUPZ
HAVE_STRFTIMEZHAVE_STRINGS_HZ
HAVE_STRING_HZHAVE_STRLCPYZHAVE_STROPTS_HZHAVE_STRSIGNALZHAVE_STRUCT_PASSWD_PW_GECOSZHAVE_STRUCT_PASSWD_PW_PASSWDZHAVE_STRUCT_STAT_ST_BIRTHTIMEZHAVE_STRUCT_STAT_ST_BLKSIZEZHAVE_STRUCT_STAT_ST_BLOCKSZHAVE_STRUCT_STAT_ST_FLAGSZHAVE_STRUCT_STAT_ST_GENZHAVE_STRUCT_STAT_ST_RDEVZHAVE_STRUCT_TM_TM_ZONEZHAVE_SYMLINKZHAVE_SYMLINKATZ	HAVE_SYNCZHAVE_SYSCONFZHAVE_SYSEXITS_HZHAVE_SYS_AUDIOIO_HZHAVE_SYS_BSDTTY_HZHAVE_SYS_DEVPOLL_HZHAVE_SYS_DIR_HZHAVE_SYS_ENDIAN_HZHAVE_SYS_EPOLL_HZHAVE_SYS_EVENT_HZHAVE_SYS_FILE_HZHAVE_SYS_IOCTL_HZHAVE_SYS_KERN_CONTROL_HZHAVE_SYS_LOADAVG_HZHAVE_SYS_LOCK_HZHAVE_SYS_MEMFD_HZHAVE_SYS_MKDEV_HZHAVE_SYS_MMAN_HZHAVE_SYS_MODEM_HZHAVE_SYS_NDIR_HZHAVE_SYS_PARAM_HZHAVE_SYS_POLL_HZHAVE_SYS_RANDOM_HZHAVE_SYS_RESOURCE_HZHAVE_SYS_SELECT_HZHAVE_SYS_SENDFILE_HZHAVE_SYS_SOCKET_HZHAVE_SYS_STATVFS_HZHAVE_SYS_STAT_HZHAVE_SYS_SYSCALL_HZHAVE_SYS_SYSMACROS_HZHAVE_SYS_SYS_DOMAIN_HZHAVE_SYS_TERMIO_HZHAVE_SYS_TIMES_HZHAVE_SYS_TIME_HZHAVE_SYS_TYPES_HZHAVE_SYS_UIO_HZ
HAVE_SYS_UN_HZHAVE_SYS_UTSNAME_HZHAVE_SYS_WAIT_HZHAVE_SYS_XATTR_HZHAVE_TCGETPGRPZHAVE_TCSETPGRPZHAVE_TEMPNAMZHAVE_TERMIOS_HZHAVE_TERM_HZHAVE_TGAMMAZHAVE_TIMEGMZ
HAVE_TIMESZHAVE_TMPFILEZHAVE_TMPNAMZ
HAVE_TMPNAM_RZHAVE_TM_ZONEZ
HAVE_TRUNCATEZHAVE_TZNAMEZ
HAVE_UCS4_TCLZ
HAVE_UNAMEZ
HAVE_UNISTD_HZ
HAVE_UNLINKATZ
HAVE_UNSETENVZHAVE_USABLE_WCHAR_TZHAVE_UTIL_HZHAVE_UTIMENSATZHAVE_UTIMESZHAVE_UTIME_HZHAVE_UUID_CREATEZHAVE_UUID_ENC_BEZHAVE_UUID_GENERATE_TIME_SAFEZHAVE_UUID_HZHAVE_UUID_UUID_HZ
HAVE_WAIT3Z
HAVE_WAIT4ZHAVE_WAITIDZHAVE_WAITPIDZHAVE_WCHAR_HZHAVE_WCSCOLLZ
HAVE_WCSFTIMEZHAVE_WCSXFRMZHAVE_WMEMCMPZHAVE_WORKING_TZSETZHAVE_WRITEVZ HAVE_X509_VERIFY_PARAM_SET1_HOSTZHAVE_ZLIB_COPYZHAVE__GETPTYZ
HOST_GNU_TYPEZINCLDIRSTOMAKEZ
INCLUDEDIRZ	INCLUDEPYZINSTALLZINSTALL_DATAZINSTALL_PROGRAMZINSTALL_SCRIPTZINSTALL_SHAREDZ
INSTSONAMEZIO_HZIO_OBJSZLDCXXSHAREDZLDFLAGSZ	LDLIBRARYZLDLIBRARYDIRZLDSHAREDZ	LDVERSIONZLIBCZLIBDESTZLIBDIRZLIBFFI_INCLUDEDIRZLIBMZ	LIBOBJDIRZLIBOBJSZLIBPCZLIBPLZ	LIBPYTHONZLIBRARYZLIBRARY_OBJSZLIBRARY_OBJS_OMIT_FROZENZLIBSZ
LIBSUBDIRSZLINKCCZ
LINKFORSHAREDZLIPO_32BIT_FLAGSZLIPO_INTEL64_FLAGSZ
LLVM_PROF_ERRZLLVM_PROF_FILEZLLVM_PROF_MERGERZLNZLOCALMODLIBSZMACHDEPZMACHDEP_OBJSZMACHDESTLIBZMACOSX_DEPLOYMENT_TARGETZMAINCCZMAJOR_IN_MKDEVZMAJOR_IN_SYSMACROSZ	MAKESETUPZMANDIRZMKDIR_PZMODBUILT_NAMESZMODDISABLED_NAMESZMODLIBSZMODOBJSZMODULE_OBJSZ	MULTIARCHZMULTIARCH_CPPFLAGSZMVWDELCH_IS_EXPRESSIONZNO_AS_NEEDEDZOBJECT_OBJSZOPENSSL_INCLUDESZOPENSSL_LDFLAGSZOPENSSL_LIBSZOPTZOTHER_LIBTOOL_OPTZPACKAGE_BUGREPORTZPACKAGE_NAMEZPACKAGE_STRINGZPACKAGE_TARNAMEZPACKAGE_URLZPACKAGE_VERSIONZPARSER_HEADERSZPARSER_OBJSZPGO_PROF_GEN_FLAGZPGO_PROF_USE_FLAGZPOBJSZPOSIX_SEMAPHORES_NOT_ENABLEDZPROFILE_TASKZ$PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INTZPTHREAD_SYSTEM_SCHED_SUPPORTEDZ
PY3LIBRARYZPYLONG_BITS_IN_DIGITZPYTHONZPYTHONFRAMEWORKZPYTHONFRAMEWORKDIRZPYTHONFRAMEWORKINSTALLDIRZPYTHONFRAMEWORKPREFIXZ
PYTHONPATHZPYTHON_FOR_BUILDZPYTHON_FOR_REGENZPYTHON_HEADERSZPYTHON_OBJSZPY_BUILTIN_MODULE_CFLAGSZ	PY_CFLAGSZPY_CFLAGS_NODISTZPY_COERCE_C_LOCALEZPY_CORE_CFLAGSZPY_CORE_LDFLAGSZPY_CPPFLAGSZPY_FORMAT_SIZE_TZ
PY_LDFLAGSZPY_LDFLAGS_NODISTZPY_SSL_DEFAULT_CIPHERSZPY_SSL_DEFAULT_CIPHER_STRINGZPY_STDMODULE_CFLAGSZPy_DEBUGZPy_ENABLE_SHAREDZPy_HASH_ALGORITHMZ
Py_TRACE_REFSZ
QUICKTESTOPTSZREADELFZ	RESSRCDIRZ
RETSIGTYPEZ	RUNSHAREDZ	SCRIPTDIRZSETPGRP_HAVE_ARGZSGI_ABIZSHELLZSHLIBSZSHLIB_SUFFIXZSHM_NEEDS_LIBRTZSIGNED_RIGHT_SHIFT_ZERO_FILLSZSITEPATHZ
SIZEOF_DOUBLEZSIZEOF_FLOATZ
SIZEOF_FPOS_TZ
SIZEOF_INTZSIZEOF_LONGZSIZEOF_LONG_DOUBLEZSIZEOF_LONG_LONGZSIZEOF_OFF_TZSIZEOF_PID_TZSIZEOF_PTHREAD_KEY_TZSIZEOF_PTHREAD_TZSIZEOF_SHORTZ
SIZEOF_SIZE_TZ
SIZEOF_TIME_TZSIZEOF_UINTPTR_TZ
SIZEOF_VOID_PZSIZEOF_WCHAR_TZSIZEOF__BOOLZSOABIZSRCDIRSZ
SRC_GDB_HOOKSZSTDC_HEADERSZSTRICT_SYSV_CURSESZ	STRIPFLAGZSUBDIRSZ
SUBDIRSTOOZSYSLIBSZSYS_SELECT_WITH_SYS_TIMEZTCLTK_INCLUDESZ
TCLTK_LIBSZTESTOPTSZTESTPATHZ
TESTPYTHONZTESTPYTHONOPTSZ
TESTRUNNERZTESTTIMEOUTZTIMEMODULE_LIBZTIME_WITH_SYS_TIMEZTM_IN_SYS_TIMEZUNICODE_DEPSZUNIVERSALSDKZUPDATE_FILEZUSE_COMPUTED_GOTOSZVERSIONZVPATHZWINDOW_HAS_FLAGSZWITH_DECIMAL_CONTEXTVARZWITH_DOC_STRINGSZWITH_DTRACEZ	WITH_DYLDZWITH_LIBINTLZWITH_NEXT_FRAMEWORKZ
WITH_PYMALLOCZ
WITH_VALGRINDZX87_DOUBLE_ROUNDINGZ
XMLLIBSUBDIRSZabs_builddirZ
abs_srcdirZdatarootdir�exec_prefix�prefixZsrcdirN)Zbuild_time_vars�rr�?/usr/lib64/python3.8/_sysconfigdata_d_linux_x86_64-linux-gnu.py�<module>sb2+-��������__future__.cpython-38.opt-2.pyc000064400000004214150335716500012250 0ustar00U

e5d�
@s�dddddddddd	g
Zd
geZdZdZd
ZdZdZdZdZdZ	dZ
dZGdd�d�Zedde�Z
edde�Zedde�Zedde�Zedde�Zedde�Zedde�Zed d!e	�Zed"d#e
�Zed$d%e�Zd&S)'�
nested_scopes�
generators�division�absolute_import�with_statement�print_function�unicode_literals�barry_as_FLUFL�generator_stop�annotations�all_feature_names��iiiii i@i�ic@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_FeaturecCs||_||_||_dS�N)�optional�	mandatory�
compiler_flag)�selfZoptionalReleaseZmandatoryReleaser�r�"/usr/lib64/python3.8/__future__.py�__init__Ssz_Feature.__init__cCs|jSr)r�rrrr�getOptionalReleaseXsz_Feature.getOptionalReleasecCs|jSr)rrrrr�getMandatoryRelease_sz_Feature.getMandatoryReleasecCsdt|j|j|jf�S)Nr)�reprrrrrrrr�__repr__gs�z_Feature.__repr__N)�__name__�
__module__�__qualname__rrrrrrrrrQsr)��r
�betar )rrr
�alphar
)rrr
r"r )r�r
�finalr
)rrr
r"r)r#r
r
r"r
)r�r
r"r )r�r
r"r
)rr&r
r"r)r#r r
r"r)�r
r
r"r
)r#r%r
r!r )r#�r
r"r
)r#r(r
r!r )r#�
r
r"r
N)r�__all__Z	CO_NESTEDZCO_GENERATOR_ALLOWEDZCO_FUTURE_DIVISIONZCO_FUTURE_ABSOLUTE_IMPORTZCO_FUTURE_WITH_STATEMENTZCO_FUTURE_PRINT_FUNCTIONZCO_FUTURE_UNICODE_LITERALSZCO_FUTURE_BARRY_AS_BDFLZCO_FUTURE_GENERATOR_STOPZCO_FUTURE_ANNOTATIONSrrrrrrrrrr	r
rrrr�<module>3s|�
����������rlcompleter.cpython-38.pyc000064400000013175150335716500011540 0ustar00U

e5d��@s�dZddlZddlZddlZdgZGdd�d�Zdd�ZzddlZWnek
r\dZ	Yn"Xe�
e�j�e�dd	��d
Z	dS)a1Word completion for GNU readline.

The completer completes keywords, built-ins and globals in a selectable
namespace (which defaults to __main__); when completing NAME.NAME..., it
evaluates (!) the expression up to the last dot and completes its attributes.

It's very cool to do "import sys" type "sys.", hit the completion key (twice),
and see the list of names defined by the sys module!

Tip: to use the tab key as the completion key, call

    readline.parse_and_bind("tab: complete")

Notes:

- Exceptions raised by the completer function are *ignored* (and generally cause
  the completion to fail).  This is a feature -- since readline sets the tty
  device in raw (or cbreak) mode, printing a traceback wouldn't work well
  without some complicated hoopla to save, reset and restore the tty state.

- The evaluation of the NAME.NAME... form may cause arbitrary application
  defined code to be executed if an object with a __getattr__ hook is found.
  Since it is the responsibility of the application (or the user) to enable this
  feature, I consider this an acceptable risk.  More complicated expressions
  (e.g. function calls or indexing operations) are *not* evaluated.

- When the original stdin is not a tty device, GNU readline is never
  used, and this module (and the readline module) are silently inactive.

�N�	Completerc@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rNcCs6|rt|t�std��|dkr&d|_nd|_||_dS)a�Create a new completer for the command line.

        Completer([namespace]) -> completer instance.

        If unspecified, the default namespace where completions are performed
        is __main__ (technically, __main__.__dict__). Namespaces should be
        given as dictionaries.

        Completer instances should be used as the completion mechanism of
        readline via the set_completer() call:

        readline.set_completer(Completer(my_namespace).complete)
        znamespace must be a dictionaryN�r)�
isinstance�dict�	TypeError�use_main_ns�	namespace)�selfr�r
�#/usr/lib64/python3.8/rlcompleter.py�__init__'szCompleter.__init__cCs�|jrtj|_|��sB|dkr>tr8t�d�t��dSdSndS|dkrld|kr`|�	|�|_
n|�|�|_
z|j
|WStk
r�YdSXdS)z�Return the next possible completion for 'text'.

        This is called successively with state == 0, 1, 2, ... until it
        returns None.  The completion should begin with 'text'.

        r�	�N�.)
r�__main__�__dict__r�strip�_readline_available�readlineZinsert_textZ	redisplay�attr_matches�matches�global_matches�
IndexError)r	�text�stater
r
r�completeBs$
zCompleter.completecCst|�r|d}|S)N�()�callable)r	�val�wordr
r
r�_callable_postfixaszCompleter._callable_postfixc	Cs�ddl}g}dh}t|�}|jD]J}|d|�|kr |�|�|dkrP|d}n|dkr`|d}|�|�q |jtjfD]J}|��D]<\}}|d|�|kr�||kr�|�|�|�|�	||��q�qx|S)z�Compute matches when text is a simple name.

        Return a list of all keywords, built-in functions and names currently
        defined in self.namespace that match.

        rN�__builtins__>�try�finally�:>�break�None�pass�continue�False�True�else� )
�keyword�len�kwlist�add�appendr�builtinsr�itemsr )	r	rr-r�seen�nrZnspacerr
r
rrfs$



zCompleter.global_matchesc	Cshddl}|�d|�}|sgS|�dd�\}}zt||j�}Wntk
rTgYSXtt|��}|�d�t	|d�r�|�
d�|�t|j
��g}t|�}	|dkr�d	}
n|d	kr�d
}
nd}
|D]t}|d|	�|kr�|
r�|d|	d�|
ks�d||f}zt||�}
Wntk
�rYnX|�|
|�}|�|�q�|�s\|
�sF�q\|
d	k�rVd
}
q�d}
q�|��|S)a�Compute matches when text contains a dot.

        Assuming the text is of the form NAME.NAME....[NAME], and is
        evaluable in self.namespace, it will be evaluated and its attributes
        (as revealed by dir()) are used as possible completions.  (For class
        instances, class members are also considered.)

        WARNING: this can still invoke arbitrary C code, if an object
        with a __getattr__ hook is evaluated.

        rNz(\w+(\.\w+)*)\.(\w*)r�r!�	__class__r�_�__z%s.%s)�re�match�group�evalr�	Exception�set�dir�discard�hasattrr0�update�get_class_membersr7r.�getattrr r1�sort)r	rr:�m�expr�attrZ
thisobjectZwordsrr5Znoprefixrr;rr
r
rr�sR



��
zCompleter.attr_matches)N)�__name__�
__module__�__qualname__rrr rrr
r
r
rr&s

cCs.t|�}t|d�r*|jD]}|t|�}q|S)N�	__bases__)r@rBrMrD)�klassZret�baser
r
rrD�s


rDFcCs
t�d�S)N)r�
set_completerr
r
r
r�<lambda>��rQT)
�__doc__�atexitr2r�__all__rrDr�ImportErrorrrPr�registerr
r
r
r�<module>s
warnings.cpython-38.opt-2.pyc000064400000025247150335716500012003 0ustar00U

e5d�L�@s�ddlZdddddddd	gZd;d
d�Zd<dd�Zdd
�Zdd�ZeZdd�ZeZdd�Z	de
dddfdd�Ze
ddfdd�Zdd�Z
dd�ZGdd�de�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd=d*d�Zd>d+d�ZGd,d-�d-e�ZGd.d	�d	e�Zd/d0�Zz0dd1lmZmZm Z mZmZm!Z!eZ"e Z#d2Z$Wn2e%k
�rjgZd3Z"iZ#d)a&d4d5�Z!dZ$YnXeej'�e$�s�e(ed6��s�ed3e)d7d)d8�ed9e)d)d:�ed9e*d)d:�ed9e+d)d:�ed9e,d)d:�[$dS)?�N�warn�
warn_explicit�showwarning�
formatwarning�filterwarnings�simplefilter�
resetwarnings�catch_warningscCst||||||�}t|�dS�N)�WarningMessage�_showwarnmsg_impl)�message�category�filename�lineno�file�line�msg�r� /usr/lib64/python3.8/warnings.pyr
scCst||||d|�}t|�Sr
)r�_formatwarnmsg_impl)r
rrrrrrrrrscCsP|j}|dkr tj}|dkr dSt|�}z|�|�Wntk
rJYnXdSr
)r�sys�stderr�_formatwarnmsg�write�OSError)rr�textrrrrsrc		Cs�|jj}|j�d|j�d|�d|j�d�}|jdkrpzddl}|�|j|j�}Wqvtk
rld}d}YqvXn|j}|r�|�	�}|d|7}|j
dk	�r�zddl}Wntk
r�d}d}Yn4X|��}z|�
|j
�}Wntk
r�d}YnX|dk	�r�|d7}|D]t}|d|j|jf7}z$|dk	�rB|�|j|j�}nd}Wntk
�rbd}YnX|�r|�	�}|d	|7}�qn|�s�||�d
�7}|S)N�:z: �
rz  %s
Tz-Object allocated at (most recent call last):
z  File "%s", lineno %s
z    %s
z<: Enable tracemalloc to get the object allocation traceback
)r�__name__rrr
r�	linecache�getline�	Exception�strip�source�tracemalloc�
is_tracing�get_object_traceback)	rr�sr rr%�tracing�tb�framerrrr#sT"




�

rcCsdzt}Wntk
rYn<X|tk	rXt|�s6td��||j|j|j|j|j	|j
�dSt|�dS)Nz:warnings.showwarning() must be set to a function or method)r�	NameError�_showwarning_orig�callable�	TypeErrorr
rrrrrr)r�swrrr�_showwarnmsg`s�r1cCsHzt}Wntk
rYn$X|tk	r@||j|j|j|j|j�St|�Sr
)	rr,�_formatwarning_origr
rrrrr)r�fwrrrrus
�r�FcCsT|s|rddl}|r$|�||j�}nd}|r8|�|�}nd}t||||||d�dS)Nr��append)�re�compile�I�_add_filter)�actionr
r�modulerr6r7rrrr�scCst|d|d||d�dS)Nr5)r:)r;rrr6rrrr�scGsR|s6zt�|�Wntk
r&YnXt�d|�n|tkrHt�|�t�dS)Nr)�filters�remove�
ValueError�insertr6�_filters_mutated)r6�itemrrrr:�s
r:cCsgtdd�<t�dSr
)r=rArrrrr�sc@seZdZdS)�_OptionErrorN)r�
__module__�__qualname__rrrrrC�srCcCsN|D]D}zt|�Wqtk
rF}ztd|tjd�W5d}~XYqXqdS)NzInvalid -W option ignored:)r)�
_setoptionrC�printrr)�args�argrrrr�_processoptions�s
rJc	Cs�|�d�}t|�dkr$td|f��t|�dkr<|�d�q$dd�|D�\}}}}}t|�}t|�}|sl|rtddl}|r�|�|�}|r�|�|�d}|r�zt|�}|dkr�t	�Wq�t	t
fk
r�td	|f�d�Yq�Xnd}t|||||�dS)
Nr�ztoo many fields (max 5): %rr4cSsg|]}|���qSr)r#)�.0r(rrr�
<listcomp>�s�z_setoption.<locals>.<listcomp>rz\Zzinvalid lineno %r)�split�lenrCr6�
_getaction�_getcategoryr7�escape�intr?�
OverflowErrorr)rI�partsr;r
rr<rr7rrrrF�s2
�
rFcCsB|sdS|dkrdSdD]}|�|�r|Sqtd|f��dS)N�default�all�always)rVrX�ignorer<�once�errorzinvalid action: %r)�
startswithrC)r;�arrrrP�s

rPcCs�|stSd|krddl}|}nJ|�d�\}}}zt|dd|g�}Wn$tk
rftd|f�d�YnXzt||�}Wn$tk
r�td|f�d�YnXt|t�s�td|f��|S)N�.rzinvalid module name: %rzunknown warning category: %rzinvalid warning category: %r)	�Warning�builtins�
rpartition�
__import__�ImportErrorrC�getattr�AttributeError�
issubclass)r�m�klassr<�_�catrrrrQ�s"
rQcCs|jj}d|kod|kS)N�	importlib�
_bootstrap)�f_code�co_filename)r+rrrr�_is_internal_framesrocCs"|j}|dk	rt|�r|j}q|Sr
)�f_backro)r+rrr�_next_external_framesrq�c	Cst|t�r|j}|dkrt}t|t�r0t|t�sDtd�t|�j���zV|dks\t	t
�d��rht
�|�}n0t
�d�}t|d�D]}t
|�}|dkr~t�q~Wn"tk
r�t
j}d}d}YnX|j}|jj}|j}d|kr�|d}	nd}	|�di�}
t|||||	|
||�dS)Nz/category must be a Warning subclass, not '{:s}'rrrrz<string>Z__warningregistry__)�
isinstancer_�	__class__�UserWarning�typerfr/�formatrror�	_getframe�rangerqr?�__dict__�	f_globalsrmrn�f_lineno�
setdefaultr)r
r�
stacklevelr$r+�x�globalsrrr<�registryrrrrs>
�



�cCs�t|�}|dkr8|pd}|dd���dkr8|dd�}|dkrDi}|�dd�tkrd|��t|d<t|t�r~t|�}|j}n|}||�}|||f}	|�|	�r�dSt	D]V}
|
\}}}
}}|dks�|�
|�r�t||
�r�|dks�|�
|�r�|dks�||kr��qq�t}|dk�rdSddl
}|�||�|dk�r2|�|dk�rfd	||	<||f}t�|��r\dSd	t|<nf|d
k�rrnZ|dk�r�d	||	<||df}|�|��r�dSd	||<n$|dk�r�d	||	<ntd
||
f��t|||||�}t|�dS)Nz	<unknown>���z.py�versionrrYr[rZrrrXr<rVz1Unrecognized action (%r) in warnings.filters:
 %s)rS�lower�get�_filters_version�clearrsr_�strrtr=�matchrf�
defaultactionr �getlines�onceregistry�RuntimeErrorrr1)r
rrrr<r��module_globalsr$r�keyrBr;rrj�modZlnr ZoncekeyZaltkeyrrrrGs|


�����









��c@s"eZdZdZddd�Zdd�ZdS)r)r
rrrrrr$NcCs>||_||_||_||_||_||_||_|r4|jnd|_dSr
)	r
rrrrrr$r�_category_name)�selfr
rrrrrr$rrr�__init__�szWarningMessage.__init__cCsd|j|j|j|j|jfS)NzD{message : %r, category : %r, filename : %r, lineno : %s, line : %r})r
r�rrr)r�rrr�__str__�s��zWarningMessage.__str__)NNN)rrDrE�_WARNING_DETAILSr�r�rrrrr�s�
rc@s4eZdZddd�dd�Zdd�Zdd	�Zd
d�ZdS)r	FN)�recordr<cCs(||_|dkrtjdn||_d|_dS)N�warningsF)�_recordr�modules�_module�_entered)r�r�r<rrrr��szcatch_warnings.__init__cCsPg}|jr|�d�|jtjdk	r4|�d|j�t|�j}d|d�|�fS)Nzrecord=Truer�z	module=%rz%s(%s)z, )r�r6r�rr�rvr�join)r�rH�namerrr�__repr__�s

zcatch_warnings.__repr__cCs~|jrtd|��d|_|jj|_|jdd�|j_|j��|jj|_|jj|_|j	rvg}|j
|j_|jj|j_|SdSdS)NzCannot enter %r twiceT)r�r�r�r=�_filtersrAr�_showwarningrr�r6r-)r��logrrr�	__enter__�s




zcatch_warnings.__enter__cGs>|jstd|��|j|j_|j��|j|j_|j|j_dS)Nz%Cannot exit %r without entering first)	r�r�r�r�r=rAr�rr)r��exc_inforrr�__exit__�s


zcatch_warnings.__exit__)rrDrEr�r�r�r�rrrrr	�s	cszd�j�d�g}�jdk	rVddl�ddl}��fdd�}|�d�||�t|���7}d�|��d�}t	|t
d	�d
�dS)Nzcoroutine 'z' was never awaited
rc3s4t�j�D]$\}}}��||�}||||fVq
dSr
)�reversed�	cr_originr!)rr�funcnamer��coror rr�extract�sz*_warn_unawaited_coroutine.<locals>.extractz-Coroutine created at (most recent call last)
r4r�)rr~r$)rEr�r �	tracebackr6�format_list�listr��rstripr�RuntimeWarning)r��	msg_linesr�r�rrr�r�_warn_unawaited_coroutine�s�

r�)r=�_defaultaction�
_onceregistryrrrATrVcCstd7adS)Nrr)r�rrrrrAsrAZgettotalrefcount�__main__)rr<r6rY)rr6)NN)N)NrrN)NNNN)-r�__all__rrrrr-r1r2rr_rrr:rr"rCrJrFrPrQrorqrr�objectrr	r��	_warningsr=r�r�rAr�r�Z_warnings_defaultsrcr��warnoptions�hasattr�DeprecationWarning�PendingDeprecationWarning�
ImportWarning�ResourceWarningrrrr�<module>sz�

;
�
#
	
)�
GC 

�bisect.cpython-38.opt-1.pyc000064400000004464150335716500011421 0ustar00U

e5d��@sZdZddd�Zd
dd�Zddd�Zdd	d
�ZzddlTWnek
rLYnXeZeZdS)zBisection algorithms.�NcCst||||�}|�||�dS)z�Insert item x in list a, and keep it sorted assuming a is sorted.

    If x is already in a, insert it to the right of the rightmost x.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    N)�bisect_right�insert��a�x�lo�hi�r	�/usr/lib64/python3.8/bisect.py�insort_rights	rcCsT|dkrtd��|dkr t|�}||krP||d}|||krF|}q |d}q |S)a�Return the index where to insert item x in list a, assuming a is sorted.

    The return value i is such that all e in a[:i] have e <= x, and all e in
    a[i:] have e > x.  So if x already appears in the list, a.insert(x) will
    insert just after the rightmost x already there.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    r�lo must be non-negativeN����
ValueError�len�rrrrZmidr	r	r
rs
rcCst||||�}|�||�dS)z�Insert item x in list a, and keep it sorted assuming a is sorted.

    If x is already in a, insert it to the left of the leftmost x.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    N)�bisect_leftrrr	r	r
�insort_left$s	rcCsT|dkrtd��|dkr t|�}||krP||d}|||krJ|d}q |}q |S)a�Return the index where to insert item x in list a, assuming a is sorted.

    The return value i is such that all e in a[:i] have e < x, and all e in
    a[i:] have e >= x.  So if x already appears in the list, a.insert(x) will
    insert just before the leftmost x already there.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    rrNr
rrrr	r	r
r1s
r)�*)rN)rN)rN)rN)	�__doc__rrrrZ_bisect�ImportErrorZbisectZinsortr	r	r	r
�<module>s



linecache.cpython-38.opt-1.pyc000064400000007435150335716500012064 0ustar00U

e5d��@sndZddlZddlZddlZddlZdddgZddd�Ziadd�Zddd	�Z	dd
d�Z
ddd�Zd
d�ZdS)z�Cache lines from Python source files.

This is intended to read lines from modules imported -- hence if a filename
is not found, it will look down the module search path for a file by
that name.
�N�getline�
clearcache�
checkcachecCs:t||�}d|kr"t|�kr2nn||dSdSdS)N��)�getlines�len)�filename�lineno�module_globals�lines�r
�!/usr/lib64/python3.8/linecache.pyrs
cCsiadS)zClear the cache entirely.N)�cacher
r
r
rrscCsX|tkr(t|}t|�dkr(t|dSzt||�WStk
rRt�gYSXdS)z�Get the lines for a Python source file from the cache.
    Update the cache if it doesn't contain an entry for this file already.r�N)rr�updatecache�MemoryErrorr)r	r�entryr
r
rr%src	Cs�|dkrtt���}n|tkr&|g}ndS|D]�}t|}t|�dkrHq.|\}}}}|dkr^q.zt�|�}Wn$tk
r�t�|d�Yq.YnX||jks�||j	kr.t�|d�q.dS)zUDiscard cache entries that are out of date.
    (This is not checked upon each call!)Nr)
�listr�keysr�os�stat�OSError�pop�st_size�st_mtime)r	�	filenamesr�size�mtimer�fullnamerr
r
rr5s&
c
Cs�|tkr$tt|�dkr$t�|d�|r<|�d�r@|�d�r@gS|}zt�|�}W�ntk
�rn|}t||�r�zt|d�}Wnt	tfk
r�YnDX|dkr�gYSt|�ddd�|�
�D�|ft|<t|dYStj�|�r�gYSt
jD]d}ztj�||�}Wnttfk
�r0Yq�YnXzt�|�}W�qjWq�tk
�r^Yq�Xq�gYSYnXz"t�|��}|��}W5QRXWntk
�r�gYSX|�r�|d	�d
��s�|d	d
7<|j|j}	}
|	|
||ft|<|S)z�Update a cache entry and return its list of lines.
    If something's wrong, print a message, discard the cache entry,
    and return an empty list.rN�<�>rcSsg|]}|d�qS)�
r
)�.0�liner
r
r�
<listcomp>qszupdatecache.<locals>.<listcomp>r���r")rrr�
startswith�endswithrrr�	lazycache�ImportError�
splitlines�path�isabs�sys�join�	TypeError�AttributeError�tokenize�open�	readlinesrr)r	rrr�basename�data�dirname�fprrrr
r
rrRs\
�



rcCs�|tkr tt|�dkrdSdS|r8|�d�r<|�d�r<dS|r�d|kr�|�d�}|d}t|dd	�}|r�|r�t�||�}|ft|<dSdS)
a�Seed the cache for filename with module_globals.

    The module loader will be asked for the source only when getlines is
    called, not immediately.

    If there is an entry in the cache already, it is not altered.

    :return: True if a lazy load is registered in the cache,
        otherwise False. To register such a load a module loader with a
        get_source method must be found, the filename must be a cachable
        filename, and the filename must not be already cached.
    rTFr r!�
__loader__�__name__�
get_sourceN)rrr'r(�get�getattr�	functools�partial)r	r�name�loaderr;�	get_linesr
r
rr)�s


r))N)N)N)N)
�__doc__r>r.rr2�__all__rrrrrrr)r
r
r
r�<module>s




Asignal.cpython-38.opt-2.pyc000064400000005075150335716500011425 0ustar00U

e5d��@s&ddlZddlTddlmZddlmZe�Ze�	de
dd��e�	de
d	d��d
ekrle�	de
dd��d
d�Zdd�Zeej
�dd��Z
eej�dd��Zd
ekr�eej�dd
��Zejje_dekr�eej�dd��Zdek�reej�dd��Zeje_dek�reej�dd��Z[[dS)�N)�*)�wraps)�IntEnum�SignalscCs(|��r|�d�r|�d�p&|�d�S)NZSIGZSIG_ZCTRL_)�isupper�
startswith��name�r
�/usr/lib64/python3.8/signal.py�<lambda>
s�r�HandlerscCs|dkS)N)�SIG_DFL�SIG_IGNr
rr
r
rr��pthread_sigmaskZSigmaskscCs|dkS)N)�	SIG_BLOCK�SIG_UNBLOCK�SIG_SETMASKr
rr
r
rrrcCs(z
||�WStk
r"|YSXdS�N)�
ValueError)�valueZ
enum_klassr
r
r�_int_to_enums
rc	Cs,z
t|�WSttfk
r&|YSXdSr)�intr�	TypeError)rr
r
r�_enum_to_int#s
rcCst�t|�t|��}t|t�Sr)�_signal�signalrrr
�Z	signalnumZhandlerr
r
rr-srcCst�|�}t|t�Sr)r�	getsignalrr
rr
r
rr3s
rcCst�||�}tdd�|D��S)Ncss|]}t|t�VqdSr�rr��.0�xr
r
r�	<genexpr>=sz"pthread_sigmask.<locals>.<genexpr>)rr�set)Zhow�maskZsigs_setr
r
rr:s�
sigpendingcCsdd�t��D�S)NcSsh|]}t|t��qSr
r r!r
r
r�	<setcomp>Dszsigpending.<locals>.<setcomp>)rr'r
r
r
rr'Bs�sigwaitcCst�|�}t|t�Sr)rr)rr)ZsigsetZretsigr
r
rr)Hs
�
valid_signalscCsdd�t��D�S)NcSsh|]}t|t��qSr
r r!r
r
rr(Rsz valid_signals.<locals>.<setcomp>)rr*r
r
r
rr*Ps)r�	functoolsrZ_wraps�enumrZ_IntEnum�globalsZ_globals�	_convert_�__name__rrrrr�__doc__r'r)r*r
r
r
r�<module>sR���










_osx_support.cpython-38.opt-2.pyc000064400000021310150335716500012702 0ustar00U

e5dU�@s�ddlZddlZddlZddddgZdZdZdZd,d	d
�Zd-dd
�Zdd�Z	da
dd�Zdadd�Z
dd�Zdd�Zdadd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d�Zd)d�Zd*d�Zd+d�ZdS).�N�compiler_fixup�customize_config_vars�customize_compiler�get_platform_osx)
�CFLAGSZLDFLAGSZCPPFLAGSZ
BASECFLAGS�	BLDSHARED�LDSHARED�CC�CXXZ	PY_CFLAGSZ
PY_LDFLAGSZPY_CPPFLAGSZPY_CORE_CFLAGSZPY_CORE_LDFLAGS)rrr	r
Z_OSX_SUPPORT_INITIAL_cCs�|dkrtjd}|�tj�}tj�|�\}}tjdkrH|dkrH|d}tj�|�s�|D]&}tj�	||�}tj�|�rX|SqXdS|SdS)N�PATHZwin32z.exe)
�os�environ�split�pathsep�path�splitext�sys�platform�isfile�join)�
executabler�paths�baseZext�p�f�r�$/usr/lib64/python3.8/_osx_support.py�_find_executables

rFc
Cs�ddl}zddl}|��}Wn(tk
rDtdt��fd�}YnX|�|��P}|rfd||jf}nd||jf}t�	|�s�|�
��d���ndW5QR�SQRXdS)Nrz/tmp/_osx_support.%szw+bz
%s >'%s' 2>&1z%s 2>/dev/null >'%s'zutf-8)
�
contextlib�tempfileZNamedTemporaryFile�ImportError�openr�getpid�closing�name�system�read�decode�strip)Z
commandstringZcapture_stderrrr�fp�cmdrrr�_read_output7s��
r+cCst|�ptd|f�pdS)Nz/usr/bin/xcrun -find %s�)rr+)Ztoolnamerrr�_find_build_toolMs
��r-cCsxtdkrtdaztd�}Wntk
r,YnHXzt�d|���}W5|��X|dk	rtd�|�d��	d�dd��atS)Nr,z0/System/Library/CoreServices/SystemVersion.plistz=<key>ProductUserVisibleVersion</key>\s*<string>(.*?)</string>�.��)
�_SYSTEM_VERSIONr!�OSError�close�re�searchr&r�groupr)r�mrrr�_get_system_versionVs
�
r8cCsLtdkrHt�}|rHztdd�|�d�D��aWntk
rFdaYnXtS)Ncss|]}t|�VqdS�N��int��.0�irrr�	<genexpr>�sz,_get_system_version_tuple.<locals>.<genexpr>r.r)�_SYSTEM_VERSION_TUPLEr8�tupler�
ValueError�Zosx_versionrrr�_get_system_version_tupleus
rDcCs"t|�D]}|�t�r||=qdSr9)�list�
startswith�_INITPRE)�_config_vars�krrr�_remove_original_values�s
rJcCs8|�|d�}||kr,t||kr,||t|<|||<dS)Nr,)�getrG)rH�cvZnewvalueZoldvaluerrr�_save_modified_value�srMcCs�tdk	rtStd|fd�}d}|��D]T}|�d�r<d}q(|�d�rLd}q(|r(|��}|dkrfdaq(|�d�r(|dd	�aq(tdkr�datS)
Nz%s -c -E -v - </dev/nullTFz#include <...>zEnd of search listz/usr/include�/z.sdk/usr/includei�)�_cache_default_sysrootr+�
splitlinesrFr(�endswith)�cc�contentsZ
in_incdirs�linerrr�_default_sysroot�s$


rUcCst�}|rt|dk�SdS)N��
�F)rD�boolrCrrr�_supports_universal_builds�srZcCst�}|r|dkSdS)N)�rF)rDrCrrr�_supports_arm64_builds�sr\cCs�dtjkr|S|d��d}}t|�s4td�}n<tj�|��d�rptd|�	dd�f�}|rpd|krptd�}|s|t
d	��||kr�tD]L}||kr�|tjkr�||��}|d
kr�|n|d|d<t||d�
|��q�|S)
Nr	rZclangZgccz'%s' --version�'�'"'"'zllvm-gcczCannot locate working compilerr
z++� )rr
rrr-r�basenamerFr+�replace�SystemError�_COMPILER_CONFIG_VARSrMr)rHrRZoldcc�datarLZcv_splitrrr�_find_appropriate_compiler�s,

��recCsVtD]L}||kr|tjkr||}tjdd|tjd�}t�dd|�}t|||�q|S)N�
-arch\s+\w+\sr_)�flagsz-isysroot\s*\S+)�_UNIVERSAL_CONFIG_VARSrr
r4�sub�ASCIIrM)rHrLrgrrr�_remove_universal_flagssrkcCs�dtjkr|St�d|d�dk	r�t�d|d�dd�f�}|r�tD]8}||krF|tjkrF||}t�dd|�}t|||�qF|S)	Nr	z-arch\s+ppcrzNecho 'int main{};' | '%s' -c -arch ppc -x c -o /dev/null /dev/null 2>/dev/nullr]r^z-arch\s+ppc\w*\sr_)	rr
r4r5r%rarhrirM)rHZstatusrLrgrrr�_remove_unsupported_archss
��	rlcCsddtjkr`tjd}tD]F}||krd||kr||}t�dd|�}|d|}t|||�q|S)N�	ARCHFLAGS�-archrfr_)rr
rhr4rirM)rHZarchrLrgrrr�_override_all_archs:s

rocCsx|�dd�}t�d|�}|dk	rt|�d�}tj�|�sttD]8}||kr:|tjkr:||}t�	dd|�}t
|||�q:|S)Nrr,z-isysroot\s*(\S+)r/z-isysroot\s*\S+(?:\s|$)r_)rKr4r5r6rr�existsrhr
rirM)rH�cflagsr7ZsdkrLrgrrr�_check_for_unavailable_sdkKs
rrc
Cs�d}}t|�}t�s d}}nd|k}tdd�|D��}|sHdtjkr�z|�d�}|||d�=WqHtk
r|Yq�YqHXqHnFt�s�tt	t
|���D].}||dkr�||dd	kr�|||d�=q�dtjkr�|s�|tjd��}|�r@d
d�t|�D�}|�s
�q@|d}||d
k�r0|||d�=q�|||d�=q�d}|}dd�t|�D�}|�sv|}dd�t|�D�}|D]B}||d
k�r�||d}�q�n||t
d
�d�}�q��qz|�r�tj
�|��s�ddlm}	|	�d|�|	�d�|S)NFTrncss|]}|�d�r|VqdS)�	-isysrootN�rF)r=�argrrrr?ys
z!compiler_fixup.<locals>.<genexpr>rmr0r/�arm64cSsg|]\}}|�d�r|�qS�rsrt�r=r>�xrrr�
<listcomp>�s
z"compiler_fixup.<locals>.<listcomp>rrscSsg|]\}}|�d�r|�qSrwrtrxrrrrz�s
cSsg|]\}}|�d�r|�qSrwrtrxrrrrz�s
)�logz4Compiling with an SDK that doesn't seem to exist: %sz$Please check your Xcode installation)rErZ�anyrr
�indexrBr\�reversed�range�lenr�	enumerater�isdirZ	distutilsr{�warn)
Zcompiler_soZcc_argsZ	stripArchZstripSysrootr}�idx�indicesZsysrootZargvarr{rrrrfsZ	


�
cCs"t�st|�t|�t|�|Sr9)rZrkrorr�rHrrrr�s
cCst|�t|�t|�|Sr9)rerlror�rrrr�s	cCs�|�dd�}t�p|}|p|}|�r�|}d}|�td|�dd��}|r�z$tdd�|�d�dd	�D��}Wq�tk
r�d
}Yq�Xnd
}|dk�rFd|��k�rFd
}t�d|�}tt	t
|���}t|�dkr�|d}nj|dkr�d}n\|dkr�d
}nN|dk�rd}n>|dk�rd}n.|dk�r&d}n|dk�r6d}ntd|f��n<|dk�rbtj
dk�r�d}n |dk�r�tj
dk�r~d }nd!}|||fS)"NZMACOSX_DEPLOYMENT_TARGETr,Zmacosxrcss|]}t|�VqdSr9r:r<rrrr?sz#get_platform_osx.<locals>.<genexpr>r.rr0)rWrrVrnZfatz
-arch\s+(\S+)r/)rv�x86_64Z
universal2)�i386�ppc)r�r�Zintel)r�r�r�Zfat3)�ppc64r�Zfat64)r�r�r�r�Z	universalz%Don't know machine value for archs=%rr�lr�)ZPowerPCZPower_Macintoshr�r�)rKr8rGrArrBr(r4�findall�sorted�setr�r�maxsize)rHZosname�release�machineZmacverZ
macreleaserqZarchsrrrr�sX



�$




�

)N)F)rr4r�__all__rhrcrGrr+r-r1r8r@rDrJrMrOrUrZr\rerkrlrorrrrrrrrrr�<module>s@�


	

>(Q)sched.cpython-38.pyc000064400000014606150335716500010276 0ustar00U

e5d*�@s�dZddlZddlZddlmZddlZddlmZdgZGdd�dedd��Z	d	e	j_d
e	j
_de	j_de	j_d
e	j
_e�ZGdd�d�ZdS)a�A generally useful event scheduler class.

Each instance of this class manages its own queue.
No multi-threading is implied; you are supposed to hack that
yourself, or use a single instance per application.

Each instance is parametrized with two functions, one that is
supposed to return the current time, one that is supposed to
implement a delay.  You can implement real-time scheduling by
substituting time and sleep from built-in module time, or you can
implement simulated time by writing your own functions.  This can
also be used to integrate scheduling with STDWIN events; the delay
function is allowed to modify the queue.  Time can be expressed as
integers or floating point numbers, as long as it is consistent.

Events are specified by tuples (time, priority, action, argument, kwargs).
As in UNIX, lower priority numbers mean higher priority; in this
way the queue can be maintained as a priority queue.  Execution of the
event means calling the action function, passing it the argument
sequence in "argument" (remember that in Python, multiple function
arguments are be packed in a sequence) and keyword parameters in "kwargs".
The action function may be an instance method so it
has another way to reference private data (besides global variables).
�N)�
namedtuple)�	monotonic�	schedulerc@s8eZdZgZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�EventcCs|j|jf|j|jfkS�N��time�priority��s�o�r
�/usr/lib64/python3.8/sched.py�__eq__$�zEvent.__eq__cCs|j|jf|j|jfkSrrr
r
r
r�__lt__%rzEvent.__lt__cCs|j|jf|j|jfkSrrr
r
r
r�__le__&rzEvent.__le__cCs|j|jf|j|jfkSrrr
r
r
r�__gt__'rzEvent.__gt__cCs|j|jf|j|jfkSrrr
r
r
r�__ge__(rzEvent.__ge__N)	�__name__�
__module__�__qualname__�	__slots__rrrrrr
r
r
rr"srz(time, priority, action, argument, kwargszaNumeric type compatible with the return value of the
timefunc function passed to the constructor.zSEvents scheduled for the same time will be executed
in the order of their priority.z?Executing the event means executing
action(*argument, **kwargs)zGargument is a sequence holding the positional
arguments for the action.zDkwargs is a dictionary holding the keyword
arguments for the action.c@s^eZdZeejfdd�Zdefdd�Zdefdd�Z	dd	�Z
d
d�Zdd
d�Ze
dd��ZdS)rcCs g|_t��|_||_||_dS)zGInitialize a new instance, passing the time and delay
        functionsN)�_queue�	threading�RLock�_lock�timefunc�	delayfunc)�selfrrr
r
r�__init__9s
zscheduler.__init__r
c	Cs@|tkri}t|||||�}|j�t�|j|�W5QRX|S)z�Enter a new event in the queue at an absolute time.

        Returns an ID for the event which can be used to remove it,
        if necessary.

        )�	_sentinelrr�heapq�heappushr)rrr	�action�argument�kwargs�eventr
r
r�enterabsAszscheduler.enterabscCs|��|}|�|||||�S)z{A variant that specifies the time as a relative time.

        This is actually the more commonly used interface.

        )rr()r�delayr	r$r%r&rr
r
r�enterOszscheduler.enterc	Cs.|j�|j�|�t�|j�W5QRXdS)z�Remove an event from the queue.

        This must be presented the ID as returned by enter().
        If the event is not in the queue, this raises ValueError.

        N)rr�remover"�heapify)rr'r
r
r�cancelXszscheduler.cancelc
Cs&|j�|jW5QR�SQRXdS)z!Check whether the queue is empty.N)rr)rr
r
r�emptycszscheduler.emptyTc	Cs�|j}|j}|j}|j}tj}|�H|s4W5QR�q�|d\}}}	}
}|�}||krZd}
nd}
||�W5QRX|
r�|s�||S|||�q|	|
|�|d�qdS)aExecute events until the queue is empty.
        If blocking is False executes the scheduled events due to
        expire soonest (if any) and then return the deadline of the
        next scheduled call in the scheduler.

        When there is a positive delay until the first event, the
        delay function is called and the event is left in the queue;
        otherwise, the event is removed from the queue and executed
        (its action function is called, passing it the argument).  If
        the delay function returns prematurely, it is simply
        restarted.

        It is legal for both the delay function and the action
        function to modify the queue or to raise an exception;
        exceptions are not caught but the scheduler's state remains
        well-defined so run() may be called again.

        A questionable hack is added to allow other threads to run:
        just after an event is executed, a delay of 0 is executed, to
        avoid monopolizing the CPU when other threads are also
        runnable.

        rTFN)rrrrr"�heappop)rZblocking�lock�qrr�poprr	r$r%r&Znowr)r
r
r�runhs(
z
scheduler.runc	Cs:|j�|jdd�}W5QRXtttj|gt|���S)z�An ordered list of upcoming events.

        Events are named tuples with fields for:
            time, priority, action, arguments, kwargs

        N)rr�list�mapr"r/�len)rZeventsr
r
r�queue�szscheduler.queueN)T)rrr�_timer�sleepr r!r(r*r-r.r3�propertyr7r
r
r
rr7s	
2)�__doc__rr"�collectionsrrrr8�__all__rr	r$r%r&�objectr!rr
r
r
r�<module>splistlib.cpython-38.opt-2.pyc000064400000056763150335716500012004 0ustar00U

e5d�}�
@s:dddddddddd	d
ddg
Zd
dlZd
dlZd
dlZd
dlZd
dlZd
dlmZd
dlZd
dl	Z	d
dl
Z
d
dlZd
dlm
Z
d
dlmZejdded�Ze��ej�ejdd��Zdd�Zdd�Zdd�Zdd�ZGdd�d�ZGdd�d�ZdZe
�d�Z dKd d!�Z!d"d#�Z"e
�d$e
j#�Z$d%d&�Z%d'd(�Z&d)d*�Z'Gd+d,�d,�Z(Gd-d.�d.�Z)Gd/d0�d0e)�Z*d1d2�Z+Gd3d�de,�Z-d4d5d6d7d8�Z.e/�Z0Gd9d:�d:�Z1d;d<�Z2e3e4e5eje6fZ7Gd=d>�d>e/�Z8d?d@�Z9e:e;e+e(e*dA�e<e;e9e1e8dA�iZ=ddBe;dC�dDd�Z>ddBe;dC�dEd
�Z?e:dBdFdG�dHd	�Z@e:dFdBdI�dJd�ZAdS)L�	readPlist�
writePlist�readPlistFromBytes�writePlistToBytes�Data�InvalidFileException�FMT_XML�
FMT_BINARY�load�dump�loads�dumps�UID�N)�BytesIO)�warn)�ParserCreate�PlistFormatzFMT_XML FMT_BINARY)�modulec	cs2t|t�r(t||��}|VW5QRXn|VdS�N)�
isinstance�str�open)�
pathOrFile�mode�fp�r� /usr/lib64/python3.8/plistlib.py�_maybe_openOs
rc
Cs<tdtd�t|d��}t|ddd�W5QR�SQRXdS)Nz8The readPlist function is deprecated, use load() instead��rbF��fmt�use_builtin_types)r�DeprecationWarningrr	)rrrrrrYs�c	Cs8tdtd�t|d��}t||tddd�W5QRXdS)Nz9The writePlist function is deprecated, use dump() insteadr�wbTF�r!�	sort_keys�skipkeys)rr#rr
r)�valuerrrrrrfs�cCstdtd�tt|�ddd�S)NzBThe readPlistFromBytes function is deprecated, use loads() insteadrFr )rr#r	r��datarrrrss
�cCs,tdtd�t�}t||tddd�|��S)NzAThe writePlistToBytes function is deprecated, use dumps() insteadrTFr%)rr#rr
r�getvalue)r(�frrrr~s�c@s:eZdZdd�Zedd��Zd
dd�Zdd	�Zd
d�ZdS)rcCst|t�std��||_dS)Nzdata must be as bytes)r�bytes�	TypeErrorr*��selfr*rrr�__init__�s
z
Data.__init__cCs|t|��Sr)�_decode_base64)�clsr*rrr�
fromBase64�szData.fromBase64�LcCst|j|�Sr)�_encode_base64r*)r0�
maxlinelengthrrr�asBase64�sz
Data.asBase64cCs4t||j�r|j|jkSt|t�r,|j|kStSdSr)r�	__class__r*r-�NotImplemented�r0�otherrrr�__eq__�s


zData.__eq__cCsd|jjt|j�fS�Nz%s(%s)�r9�__name__�reprr*�r0rrr�__repr__�sz
Data.__repr__N)r5)	r@�
__module__�__qualname__r1�classmethodr4r8r=rCrrrrr�s

c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)r
cCs<t|t�std��|dkr"td��|dkr2td��||_dS)Nzdata must be an int�zUIDs cannot be >= 2**64r�UIDs must be positive)r�intr.�
ValueErrorr*r/rrrr1�s
zUID.__init__cCs|jSrr)rBrrr�	__index__�sz
UID.__index__cCsd|jjt|j�fSr>r?rBrrrrC�szUID.__repr__cCs|j|jffSr)r9r*rBrrr�
__reduce__�szUID.__reduce__cCst|t�stS|j|jkSr)rr
r:r*r;rrrr=�s
z
UID.__eq__cCs
t|j�Sr)�hashr*rBrrr�__hash__�szUID.__hash__N)	r@rDrEr1rKrCrLr=rNrrrrr
�s	s�<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
zv[\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]r5cCsP|dd}g}tdt|�|�D]$}||||�}|�t�|��q d�|�S)N��r�)�range�len�append�binasciiZ
b2a_base64�join)�sr7Z
maxbinsize�pieces�i�chunkrrrr6�sr6cCs(t|t�rt�|�d��St�|�SdS)N�utf-8)rrrUZ
a2b_base64�encode)rWrrrr2�s
r2z{(?P<year>\d\d\d\d)(?:-(?P<month>\d\d)(?:-(?P<day>\d\d)(?:T(?P<hour>\d\d)(?::(?P<minute>\d\d)(?::(?P<second>\d\d))?)?)?)?)?ZcCsLd}t�|���}g}|D]&}||}|dkr2qB|�t|��qtj|�S)N�ZyearZmonthZdayZhourZminute�second)�_dateParser�match�	groupdictrTrI�datetime)rW�orderZgdZlst�key�valrrr�_date_from_string�srfcCs d|j|j|j|j|j|jfS)Nz%04d-%02d-%02dT%02d:%02d:%02dZr])�drrr�_date_to_strings�rhcCsZt�|�}|dk	rtd��|�dd�}|�dd�}|�dd�}|�dd�}|�d	d
�}|S)Nz<strings can't contains control characters; use bytes insteadz
�
�
�&z&amp;�<z&lt;�>z&gt;)�_controlCharPat�searchrJ�replace)�text�mrrr�_escapes
rsc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)S)*�_PlistParsercCs"g|_d|_d|_||_||_dSr)�stack�current_key�root�_use_builtin_types�
_dict_type�r0r"�	dict_typerrrr1s
z_PlistParser.__init__cCsBt�|_|j|j_|j|j_|j|j_|j|j_	|j�
|�|jSr)r�parser�handle_begin_elementZStartElementHandler�handle_end_elementZEndElementHandler�handle_dataZCharacterDataHandler�handle_entity_declZEntityDeclHandlerZ	ParseFilerw)r0Zfileobjrrr�parses



z_PlistParser.parsecCstd��dS)Nz8XML entity declarations are not supported in plist files)r)r0Zentity_nameZis_parameter_entityr(�baseZ	system_idZ	public_idZ
notation_namerrrr�$sz_PlistParser.handle_entity_declcCs*g|_t|d|d�}|dk	r&||�dS)NZbegin_)r*�getattr)r0�element�attrs�handlerrrrr}*sz!_PlistParser.handle_begin_elementcCs"t|d|d�}|dk	r|�dS)NZend_)r�)r0r�r�rrrr~0sz_PlistParser.handle_end_elementcCs|j�|�dSr)r*rTr/rrrr5sz_PlistParser.handle_datacCs�|jdk	rFt|jdti��s.td|jj��||jd|j<d|_nB|jsT||_n4t|jdtg��sxtd|jj��|jd�|�dS)N���zunexpected element at line %d)	rvrru�typerJr|�CurrentLineNumberrwrT�r0r(rrr�
add_object8s
��z_PlistParser.add_objectcCsd�|j�}g|_|S)N�)rVr*r/rrr�get_dataHsz_PlistParser.get_datacCs"|��}|�|�|j�|�dSr)ryr�rurT)r0r�rgrrr�
begin_dictOs
z_PlistParser.begin_dictcCs*|jrtd|j|jjf��|j��dS)Nz%missing value for key '%s' at line %d)rvrJr|r�ru�poprBrrr�end_dictTs
�z_PlistParser.end_dictcCs8|jst|jdti��s*td|jj��|��|_dS)Nr�zunexpected key at line %d)rvrrur�rJr|r�r�rBrrr�end_keyZs
�z_PlistParser.end_keycCsg}|�|�|j�|�dSr)r�rurT)r0r��arrr�begin_array`s
z_PlistParser.begin_arraycCs|j��dSr)rur�rBrrr�	end_arrayesz_PlistParser.end_arraycCs|�d�dS)NT�r�rBrrr�end_truehsz_PlistParser.end_truecCs|�d�dS)NFr�rBrrr�	end_falseksz_PlistParser.end_falsecCs@|��}|�d�s|�d�r.|�t|d��n|�t|��dS)NZ0xZ0X�)r��
startswithr�rI)r0�rawrrr�end_integernsz_PlistParser.end_integercCs|�t|����dSr)r��floatr�rBrrr�end_realusz_PlistParser.end_realcCs|�|���dSr)r�r�rBrrr�
end_stringxsz_PlistParser.end_stringcCs2|jr|�t|����n|�t�|����dSr)rxr�r2r�rr4rBrrr�end_data{sz_PlistParser.end_datacCs|�t|����dSr)r�rfr�rBrrr�end_date�sz_PlistParser.end_dateN)r@rDrEr1r�r�r}r~rr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrts(	rtc@s8eZdZddd�Zdd�Zdd�Zdd
d�Zdd
�Zd	S)�_DumbXMLWriterr�	cCs||_g|_||_||_dSr)�fileru�
_indent_level�indent)r0r��indent_levelr�rrrr1�sz_DumbXMLWriter.__init__cCs,|j�|�|�d|�|jd7_dS)Nz<%s>�)rurT�writelnr��r0r�rrr�
begin_element�sz_DumbXMLWriter.begin_elementcCs |jd8_|�d|�dS)Nr�z</%s>)r�r�r�rrr�end_element�sz_DumbXMLWriter.end_elementNcCs8|dk	r&t|�}|�d|||f�n|�d|�dS)Nz<%s>%s</%s>z<%s/>)rsr�)r0r�r(rrr�simple_element�sz_DumbXMLWriter.simple_elementcCsH|r8t|t�r|�d�}|j�|j|j�|j�|�|j�d�dS)Nr[�
)rrr\r��writer�r�)r0�linerrrr��s

z_DumbXMLWriter.writeln)rr�)N)r@rDrEr1r�r�r�r�rrrrr��s


r�c@sFeZdZddd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Z	dS)�_PlistWriterr�	r�TFcCs.|r|�t�t�||||�||_||_dSr)r��PLISTHEADERr�r1�
_sort_keys�	_skipkeys)r0r�r�r�ZwriteHeaderr&r'rrrr1�s

z_PlistWriter.__init__cCs"|�d�|�|�|�d�dS)Nz<plist version="1.0">z</plist>)r��write_valuer�rrrr��s

z_PlistWriter.writecCs4t|t�r|�d|��n|dkr0|�d��n|dkrD|�d�n�t|t�r�d|krbdkrxnn|�dd	|�nt|��n�t|t�r�|�d
t|��n�t|t�r�|�|�n|t|t	�r�|�
|�nft|ttf�r�|�
|�nLt|tj��r|�dt|��n,t|ttf��r |�|�ntdt|���dS)
N�stringT�trueFZfalsel����rGZintegerz%d�real�datezunsupported type: %s)rrr�rI�
OverflowErrorr�rA�dict�
write_dictr�
write_datar-�	bytearray�write_bytesrbrh�tuple�list�write_arrayr.r�r�rrrr��s.





z_PlistWriter.write_valuecCs|�|j�dSr)r�r*r/rrrr��sz_PlistWriter.write_datacCsz|�d�|jd8_tddt|j�dd�|j��}t||��d�D]}|rJ|�|�qJ|jd7_|�	d�dS)Nr*r�r�r5r�s        r�)
r�r��maxrSr�rpr6�splitr�r�)r0r*r7r�rrrr��s
�z_PlistWriter.write_bytescCs�|rt|�d�|jr"t|���}n|��}|D]8\}}t|t�sP|jrHq.td��|�d|�|�	|�q.|�
d�n
|�d�dS)Nr��keys must be stringsrd)r�r��sorted�itemsrrr�r.r�r�r�)r0rgr�rdr(rrrr��s

z_PlistWriter.write_dictcCs<|r.|�d�|D]}|�|�q|�d�n
|�d�dS)N�array)r�r�r�r�)r0r�r(rrrr�s
z_PlistWriter.write_arrayN)rr�r�TF)
r@rDrEr1r�r�r�r�r�r�rrrrr��s�

%
r�cCs�d}|D]}|�|�rdSqtjdftjdftjdffD]N\}}|�|�sNq:|D]4}||�d��|�}|dt|��|krRdSqRq:dS)N)s<?xmls<plistTr[z	utf-16-bez	utf-16-le�asciiF)r��codecs�BOM_UTF8�BOM_UTF16_BE�BOM_UTF16_LE�decoder\rS)�header�prefixesZpfxZbom�encoding�start�prefixrrr�_is_fmt_xmls
�
r�c@seZdZddd�ZdS)r�Invalid filecCst�||�dSr)rJr1)r0�messagerrrr12szInvalidFileException.__init__N)r�)r@rDrEr1rrrrr1s�B�H�L�Q)r�rrO�c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�_BinaryPlistParsercCs||_||_dSr)rxryrzrrrr1Asz_BinaryPlistParser.__init__cCs�z~||_|j�dtj�|j�d�}t|�dkr6t��t�d|�\}|_	}}}|j�|�|�
||�|_tg||_
|�|�WStttjttfk
r�t��YnXdS)Ni��� z>6xBBQQQ)�_fp�seek�os�SEEK_END�readrSr�struct�unpack�	_ref_size�
_read_ints�_object_offsets�
_undefined�_objects�_read_object�OSError�
IndexError�errorr�rJ)r0r�trailer�offset_size�num_objects�
top_object�offset_table_offsetrrrr�Es*
��z_BinaryPlistParser.parsecCsL|dkrH|j�d�dd@}d|>}dt|}t�||j�|��dS|S)N�r�rrPrm)r�r��_BINARY_FORMATr�r�)r0�tokenLrrrWr,rrr�	_get_size^sz_BinaryPlistParser._get_sizecst|j��|���tkr2t�d|�t�����S�rFt���|krLt��t��fdd�td�|��D��SdS)Nrmc3s&|]}t��||��d�VqdS)�bigN)rI�
from_bytes)�.0rY�r*�sizerr�	<genexpr>os�z0_BinaryPlistParser._read_ints.<locals>.<genexpr>r)	r�r�r�r�r�rSrr�rR)r0�nr�rr�rr�hs�z_BinaryPlistParser._read_intscCs|�||j�Sr)r�r�)r0r�rrr�
_read_refsrsz_BinaryPlistParser._read_refscs�j|}|tk	r|S�j|}�j�|��j�d�d}|d@|d@}}|dkr^d}�n�|dkrnd}�n�|dkr~d}�n�|dkr�d	}�n�|d
kr�tj�j�d|>�d|dkd
�}�nT|dkr�t�	d�j�d��d}�n0|dk�rt�	d�j�d��d}�n
|dk�rDt�	d�j�d��d}t
�
ddd�t
j|d�}�n�|dk�r���|�}�j�|�}t
|�|k�rxt���j�st|�}�n�|dk�rΈ�|�}�j�|�}	t
|	�|k�r�t��|	�d�}�n@|dk�r��|�d}�j�|�}	t
|	�|k�rt��|	�d�}n�|dk�r:tt��j�d|�d��}n�|dk�r���|�}��|�}
g}|�j|<|��fdd�|
D��n�|d k�r��|�}��|�}��|�}
���}|�j|<z.t||
�D]\}}
��|
�|��|�<�q�Wntk
�rt��YnXnt��|�j|<|S)!Nr�r��r�r�F�	TrQr�r�rP�Zsigned�"z>frO�#z>d�3��)Zseconds�@�Pr��`r�utf-16be��c3s|]}��|�VqdSr)r�)r��xrBrrr��sz2_BinaryPlistParser._read_object.<locals>.<genexpr>��)r�r�r�r�r�r�rIr�r�r�rbZ	timedeltar�rSrrxrr�r
r��extendry�zipr�r.)r0�ref�result�offset�tokenZtokenHr�r,rWr*Zobj_refsZkey_refs�k�orrBrr�us�

�



�















z_BinaryPlistParser._read_objectN)	r@rDrEr1r�r�r�r�r�rrrrr�9s

r�cCs,|dkrdS|dkrdS|dkr$dSdSdS)N�r��r�rOr�r)�countrrr�_count_to_size�src@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�_BinaryPlistWritercCs||_||_||_dSr)r�r�r�)r0rr&r'rrrr1�sz_BinaryPlistWriter.__init__c
Cs�g|_i|_i|_|�|�t|j�}dg||_t|�|_t|j|_	|j
�d�|jD]}|�|�qZ|�
|�}|j
��}t|�}dt||}|j
�tj|f|j���d}|||j|||f}	|j
�tjd|	���dS)Nr�bplist00rm�	>5xBBBQQQ)r)�_objlist�	_objtable�_objidtable�_flattenrSr�rr�r��_ref_formatr�r��
_write_object�
_getrefnum�tellr��pack)
r0r(r��objr�r�r�Z
offset_formatZsort_versionr�rrrr��s2





�z_BinaryPlistWriter.writec	Csrt|t�r"t|�|f|jkrZdSn8t|t�rHt|j�|jf|jkrZdSnt|�|jkrZdSt|j	�}|j	�
|�t|t�r�||jt|�|f<n0t|t�r�||jt|j�|jf<n||jt|�<t|t��rHg}g}|��}|j
r�t|�}|D]:\}}t|t��s|j�r
q�td��|�
|�|�
|�q�t�||�D]}|�|��q4n&t|ttf��rn|D]}|�|��q\dS)Nr�)r�_scalarsr�rrr*�idr rSrrTr�r�r�r�rr�r.�	itertools�chainr!r�r�)	r0r(Zrefnum�keys�valuesr�r�vrrrrr!sB





z_BinaryPlistWriter._flattencCsNt|t�r|jt|�|fSt|t�r<|jt|j�|jfS|jt|�SdSr)rr(rr�rr*r r)r�rrrr$Ns


z_BinaryPlistWriter._getrefnumcCs�|dkr"|j�t�d||B��n�|dkrH|j�t�d|dBd|��nh|dkrn|j�t�d|dBd|��nB|d	kr�|j�t�d
|dBd|��n|j�t�d|dBd
|��dS)Nr�z>Brz>BBBr�rz>BBH�rz>BBL�z>BBQ�)r�r�r�r&)r0rr�rrr�_write_sizeVsz_BinaryPlistWriter._write_sizecs���|�}�j���j|<|dkr2�j�d��nl|dkrJ�j�d��nT|dkrb�j�d��n<t|t��rl|dkr�z�j�t�dd|��Wn tj	k
r�t
|�d�YnXn�|d	krԈj�t�d
d|��n�|dkr�j�t�d
d|��nt|dk�r�j�t�dd|��nR|dk�r8�j�t�dd|��n0|dk�r`�j�d|jdddd��nt
|���n2t|t��r��j�t�dd|���nt|t
j
��r�|t
�
ddd���}�j�t�dd|���n�t|t��r��dt|j���j�|j��n�t|ttf��r0��dt|���j�|��nnt|t��r�z|�d�}��dt|��Wn4tk
�r�|�d �}��d!t|�d"�YnX�j�|��n�t|t��r^|jdk�r�td#��n�|jd	k�r�j�t�d
d$|��nt|jdk�r
�j�t�d
d%|��nP|jdk�r.�j�t�dd&|��n,|jdk�rR�j�t�dd'|��nt
|���n@t|ttf��r��fd(d)�|D�}t|�}��d*|��j�tjd+�j|f|���n�t|t��r�gg}}�j�r�t|� ��}	n|� �}	|	D]J\}
}t|
t��s�j!�r�q�t"d,��|�#��|
��|�#��|���q�t|�}��d-|��j�tjd+�j|f|����j�tjd+�j|f|���nt"|��dS).N�F�Tr�rz>Bqr1rz>BBr�rz>BHr/rz>BLr0lz>BQrG�r�rz>Bdrrr�rrr�rr	rrrHr
���csg|]}��|��qSr)r$)r�rrBrr�
<listcomp>�sz4_BinaryPlistWriter._write_object.<locals>.<listcomp>rrmr�r
)$r$r�r%r�r�rrIr�r&r�r��to_bytesr�rbZ
total_secondsrr2rSr*r-r�rr\�UnicodeEncodeErrorr
rJr�r�r"r�r�r�r�r�r.rT)r0r(rr,�tZrefsrWZkeyRefsZvalRefsZ	rootItemsrr.rrBrr#fs�






$
"$z _BinaryPlistWriter._write_objectN)	r@rDrEr1r�r!r$r2r#rrrrr�s-0rcCs|dd�dkS)Nr�rr)r�rrr�_is_fmt_binary�sr=)�detectr|�writerT�r!r"r{cCsl|dkrJ|�d�}|�d�t��D]}|d|�r$|d}qVq$t��nt|d}|||d�}|�|�S)Nr�rr>r|)r"r{)r�r��_FORMATSr-rr�)rr!r"r{r��info�P�prrrr	�s

cCst|�}t||||d�S)Nr@)rr	)r(r!r"r{rrrrr�s�Fr%cCs:|tkrtd|f��t|d|||d�}|�|�dS)NzUnsupported format: %rr?)r&r')rArJr�)r(rr!r&r'r?rrrr
s�r!r'r&cCs t�}t|||||d�|��S)NrE)rr
r+)r(r!r'r&rrrrrs)r5)B�__all__rUr��
contextlibrb�enum�iorr*r��rer��warningsrZxml.parsers.expatr�Enumr@r�globals�update�__members__�contextmanagerrrrrrrr
r��compilernr6r2�ASCIIr_rfrhrsrtr�r�r�rJrr��objectr�r�rrrIr�r-r(rr=rr�rrAr	rr
rrrrr�<module>1s��

	


'"�
	
s&d!$
a	���	_compat_pickle.cpython-38.opt-1.pyc000064400000012505150335716500013114 0ustar00U

e5d-"�+@s�dddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*�*Zd+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdL�!ZdMZzeWnek
r�Yn
XedN7ZeD]ZdefedOef<q�dPZeD]ZdQefedRef<q�edSdT�e��D��Z	edUdT�e��D��Z
e�dVdWdddd"d"dXdXdXd(dYdYdZ�
�e	�d[d(d\d]dVd^��e�d/d_d6d`da��e
�dbdcdddedfdgdhdidjdkdldmdndo�
�dpZeD]Zdqe
def<�q�drZ
e
D]Zdse
def<�q�dtS)u�builtins�copyregZqueueZsocketserverZconfigparser�reprlib�tkinter.filedialog�tkinter.simpledialogztkinter.colorchooserztkinter.commondialogztkinter.dialogztkinter.dndztkinter.fontztkinter.messageboxztkinter.scrolledtextztkinter.constantsztkinter.tixztkinter.ttkZtkinterZ_markupbase�winreg�_threadZ
_dummy_threadzdbm.bsdzdbm.dumbzdbm.ndbmzdbm.gnuz
xmlrpc.client�
xmlrpc.serverzhttp.clientz
html.entitieszhtml.parserzhttp.cookieszhttp.cookiejar�http.serverztest.support�
subprocess�urllib.parsezurllib.robotparser�urllib.request�dbmzcollections.abc)*�__builtin__Zcopy_regZQueueZSocketServerZConfigParser�reprZtkFileDialogZtkSimpleDialogZtkColorChooserZtkCommonDialogZDialogZTkdndZtkFontZtkMessageBoxZScrolledTextZTkconstantsZTixZttkZTkinterZ
markupbase�_winreg�threadZdummy_threadZdbhashZdumbdbmr
�gdbmZ	xmlrpclibZSimpleXMLRPCServerZhttplibZhtmlentitydefsZ
HTMLParserZCookieZ	cookielibZBaseHTTPServerztest.test_supportZcommandsZurlparseZrobotparser�urllib2ZanydbmZ_abcoll)r�range)�	functools�reduce)�sys�intern)r�chr)r�str)r�int)r�zip)r�map)r�filter)�	itertools�filterfalse)r�zip_longest)�collections�UserDict)r"�UserList)r"�
UserString)r
�whichdb)�socket�fromfd)zmultiprocessing.connection�
Connection)�multiprocessing.context�Process)zmultiprocessing.popen_fork�Popen)�urllib.error�ContentTooShortError)r�
getproxies)r�pathname2url)r�
quote_plus)r�quote)r�unquote_plus)r�unquote)r�url2pathname)r�
urlcleanup)r�	urlencode)r�urlopen)r�urlretrieve)r-�	HTTPError)r-�URLError)!)rZxrange�rr)rr)rZunichr)rZunicode)rZlong)rZizip)rZimap)rZifilter)rZifilterfalse)rZizip_longest)r#ZIterableUserDict)r$r$)r%r%)r&r&)�_socketr()Z_multiprocessingr))zmultiprocessing.processr+)zmultiprocessing.forkingr,)�urllibr.)r>r/)r>r0)r>r1)r>r2)r>r3)r>r4)r>r5)r>r6)r>r7)r>r8)r>r9)rr:)rr;)/�ArithmeticError�AssertionError�AttributeError�
BaseException�BufferError�BytesWarning�DeprecationWarning�EOFError�EnvironmentError�	Exception�FloatingPointError�
FutureWarning�
GeneratorExit�IOError�ImportError�
ImportWarning�IndentationError�
IndexError�KeyError�KeyboardInterrupt�LookupError�MemoryError�	NameError�NotImplementedError�OSError�
OverflowError�PendingDeprecationWarning�ReferenceError�RuntimeError�RuntimeWarning�
StopIteration�SyntaxError�
SyntaxWarning�SystemError�
SystemExit�TabError�	TypeError�UnboundLocalError�UnicodeDecodeError�UnicodeEncodeError�UnicodeError�UnicodeTranslateError�UnicodeWarning�UserWarning�
ValueError�Warning�ZeroDivisionError)�WindowsError�
exceptions)ZAuthenticationErrorZBufferTooShortZProcessError�TimeoutErrorr*Zmultiprocessingccs|]\}}||fVqdS�N���.0�k�vrrrr�&/usr/lib64/python3.8/_compat_pickle.py�	<genexpr>�srxccs|]\}}||fVqdSrqrrrsrrrrrwrx�s�picklezxml.etree.ElementTreer"�io)
ZcPickleZ_elementtree�
FileDialog�SimpleDialog�DocXMLRPCServer�SimpleHTTPServer�
CGIHTTPServerr#r$r%r&�StringIOZ	cStringIO�bz2rr)Z_bz2Z_dbm�
_functoolsZ_gdbm�_pickle)rrH)r'Z
SocketType))rZ
basestring)roZ
StandardError)r#r#�r'Z
_socketobjectr<)r{r{)r{�LoadFileDialog)r{�SaveFileDialog)r|r|)r}�
ServerHTMLDoc)r}�XMLRPCDocGenerator)r}�DocXMLRPCRequestHandler)r}r})r}�DocCGIXMLRPCRequestHandler)r~�SimpleHTTPRequestHandler)r�CGIHTTPRequestHandlerr�)
)r�r)rr{)rr�)rr�)rr|)rr�)rr�)rr�)rr})rr�)r	r�)r	r�)r=r')�BrokenPipeError�ChildProcessError�ConnectionAbortedError�ConnectionError�ConnectionRefusedError�ConnectionResetError�FileExistsError�FileNotFoundError�InterruptedError�IsADirectoryError�NotADirectoryError�PermissionError�ProcessLookupErrorrp)rorW)�ModuleNotFoundError)rorMN)ZIMPORT_MAPPINGZNAME_MAPPINGZPYTHON2_EXCEPTIONSrnrUZexcnameZMULTIPROCESSING_EXCEPTIONS�dict�itemsZREVERSE_IMPORT_MAPPINGZREVERSE_NAME_MAPPING�updateZPYTHON3_OSERROR_EXCEPTIONSZPYTHON3_IMPORTERROR_EXCEPTIONSrrrrrrrw�<module>	s�2�$3����hashlib.cpython-38.opt-1.pyc000064400000012457150335716500011563 0ustar00U

&�.e� �	@svdZdZee�Zee�ZedZddddddd	d
hZzddlmZ	Wne
k
r`d
d�Z	YnXe	�stiZdd�Zdd�Z
e	�s�ddd�Zddd�Zz ddlZeZe
Ze�ej�ZWn$e
k
r�e	�r΂eZeZYnXddlmZzddlmZWne
k
�rYnXeD]DZzee�e�e<Wn*ek
�rTddlZe�de�YnX�q[[[[[
e���sp[[	dS)a3hashlib module - A common interface to many hash functions.

new(name, data=b'', **kwargs) - returns a new hash object implementing the
                                given hash function; initializing the hash
                                using the given binary data.

Named constructor functions are also available, these are faster
than using new(name):

md5(), sha1(), sha224(), sha256(), sha384(), sha512(), blake2b(), blake2s(),
sha3_224, sha3_256, sha3_384, sha3_512, shake_128, and shake_256.

More algorithms may be available on your platform but the above are guaranteed
to exist.  See the algorithms_guaranteed and algorithms_available attributes
to find out what algorithm names can be passed to new().

NOTE: If you want the adler32 or crc32 hash functions they are available in
the zlib module.

Choose your hash function wisely.  Some have known collision weaknesses.
sha384 and sha512 will be slow on 32 bit platforms.

Hash objects have these methods:
 - update(data): Update the hash object with the bytes in data. Repeated calls
                 are equivalent to a single call with the concatenation of all
                 the arguments.
 - digest():     Return the digest of the bytes passed to the update() method
                 so far as a bytes object.
 - hexdigest():  Like digest() except the digest is returned as a string
                 of double length, containing only hexadecimal digits.
 - copy():       Return a copy (clone) of the hash object. This can be used to
                 efficiently compute the digests of datas that share a common
                 initial substring.

For example, to obtain the digest of the byte string 'Nobody inspects the
spammish repetition':

    >>> import hashlib
    >>> m = hashlib.md5()
    >>> m.update(b"Nobody inspects")
    >>> m.update(b" the spammish repetition")
    >>> m.digest()
    b'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9'

More condensed:

    >>> hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest()
    'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2'

)�md5�sha1�sha224�sha256�sha384�sha512�blake2b�blake2s�sha3_224�sha3_256�sha3_384�sha3_512�	shake_128�	shake_256)�new�algorithms_guaranteed�algorithms_available�pbkdf2_hmacr	r
rrr
rrr�)�
get_fips_modecCsdS)Nr�rrr�/usr/lib64/python3.8/hashlib.py�_hashlib_get_fips_modeQsrc	Cs�t}|�|�}|dk	r|S�zB|dkrDddl}|j|d<|d<�n|dkrhddl}|j|d<|d<n�|dkr�ddl}|j|d	<|d
<|j|d<|d<n�|d
kr�ddl	}|j
|d<|d<|j|d<|d<n�|dkr�ddl}|j
|d<|j|d<nb|dk�r6ddl}|j|d<|j|d<|j|d<|j|d<n&|dk�r\ddl}|j|d<|j|d<Wntk
�rtYnX|�|�}|dk	�r�|Std|��dS)N>r�SHA1rrr>�MD5rrr>r�SHA224r�SHA256rrrr>r�SHA512�SHA384rrrrr>rrrr>rr	rr
r	r
rr>r
rr
rzunsupported hash type )�__builtin_constructor_cache�get�_sha1r�_md5r�_sha256rr�_sha512rr�_blake2rr�_sha3r	r
rrr
r�ImportError�
ValueError)	�name�cache�constructorr r!r"r#r$r%rrr�__get_builtin_constructorWsN









r+c	Cs^t�s|tkrt|�Sz"ttd|�}t��s4|�|WSttfk
rXt|�YSXdS)NZopenssl_)r�__block_openssl_constructorr+�getattr�_hashlibr�AttributeErrorr')r(�frrr�__get_openssl_constructor�sr1�cKst|�|f|�S)z�new(name, data=b'', **kwargs) - Return a new hashing object using the
        named algorithm; optionally initialized with data (which must be
        a bytes-like object).
        )r+�r(�data�kwargsrrr�__py_new�sr6cKsft��s |tkr t|�|f|�Sztj||f|�WStk
r`t��rL�t|�|f|�YSXdS)z�new(name, data=b'') - Return a new hashing object using the named algorithm;
    optionally initialized with data (which must be a bytes-like object).
    N)r.rr,r+rr'r3rrr�
__hash_new�sr7N)r)�scryptzcode for hash %s was not found.)r2)r2)�__doc__Z__always_supported�setrr�__all__r,r.rrr&rr+r1r6r7rZ
__get_hash�unionZopenssl_md_meth_namesrr8Z__func_name�globalsr'ZloggingZ	exceptionrrrr�<module>sh5�,

�

token.cpython-38.pyc000064400000004667150335716500010336 0ustar00U

e5d@	�0@s�dZddddgZdZdZdZdZd	Zd
ZdZdZ	d
Z
dZdZdZ
dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Zd"Zd#Z d$Z!d%Z"d&Z#d'Z$d(Z%d)Z&d*Z'd+Z(d,Z)d-Z*d.Z+d/Z,d0Z-d1Z.d2Z/d3Z0d4Z1d5Z2d6Z3d7Z4d8Z5d9Z6d:Z7d;Z8d<Z9d=Z:d>Z;d?Z<d@Z=dAZ>dBZ?dCZ@dDZAdEZBdFdG�eC��D�D�ZEe�FeE�G��eee*ee+e	e
ee%e0e(ee&eee'e5ee6ee1e2e)e
e7eee#e.eeeee e$e/e3e4eee"e-eee,ee!dH�/ZHdId�ZIdJd�ZJdKd�ZKdLS)MzToken constants.�tok_name�
ISTERMINAL�
ISNONTERMINAL�ISEOF����������	�
���
������������������� �!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�0�1�2�3�4�5�6�7�8�9�:�;�<�=�>�?�cCs*i|]"\}}t|t�r|�d�s||�qS)�_)�
isinstance�int�
startswith)�.0�name�value�rM�/usr/lib64/python3.8/token.py�
<dictcomp>Js


�rO)/z!=�%z%=�&z&=�(�)�*z**z**=z*=�+z+=�,�-z-=z->�.z...�/z//z//=z/=�:z:=�;�<z<<z<<=z<=�=z==�>z>=z>>z>>=�@z@=�[�]�^z^=�{�|z|=�}�~cCs|tkS�N��	NT_OFFSET��xrMrMrNr�scCs|tkSrgrhrjrMrMrNr�scCs|tkSrg)�	ENDMARKERrjrMrMrNr�sN)L�__doc__�__all__rl�NAME�NUMBER�STRING�NEWLINE�INDENT�DEDENT�LPAR�RPAR�LSQB�RSQB�COLON�COMMA�SEMI�PLUS�MINUS�STAR�SLASH�VBAR�AMPER�LESS�GREATER�EQUAL�DOT�PERCENT�LBRACE�RBRACE�EQEQUAL�NOTEQUAL�	LESSEQUAL�GREATEREQUAL�TILDE�
CIRCUMFLEX�	LEFTSHIFT�
RIGHTSHIFT�
DOUBLESTAR�	PLUSEQUAL�MINEQUAL�	STAREQUAL�
SLASHEQUAL�PERCENTEQUAL�
AMPEREQUAL�	VBAREQUAL�CIRCUMFLEXEQUAL�LEFTSHIFTEQUAL�RIGHTSHIFTEQUAL�DOUBLESTAREQUAL�DOUBLESLASH�DOUBLESLASHEQUAL�AT�ATEQUAL�RARROW�ELLIPSIS�
COLONEQUAL�OP�AWAIT�ASYNC�TYPE_IGNORE�TYPE_COMMENT�
ERRORTOKEN�COMMENT�NL�ENCODING�N_TOKENSri�globals�itemsr�extend�values�EXACT_TOKEN_TYPESrrrrMrMrMrN�<module>s���2base64.cpython-38.pyc000064400000041261150335716500010271 0ustar00U

e5d�O�@s�dZddlZddlZddlZddddddd	d
ddd
dddddddgZeefZdd�ZdCdd�Z	dDdd�Z
dd�Zdd�Ze�
dd�Ze�
dd�Zdd�Zdd�Zd Zdadad!d	�ZdEd"d
�Zd#d�ZdFd$d�Zdadad%Zd&ZdGd'd(�Zddddd)�d*d�Zddd+d,�d-d�Zd.Z da!da"da#dHd/d
�Z$d0d�Z%d1Z&e&d2d3Z'd4d�Z(d5d�Z)d6d7�Z*d8d�Z+d9d:�Z,d;d�Z-d<d=�Z.d>d?�Z/d@dA�Z0e1dBk�r�e/�dS)IzDBase16, Base32, Base64 (RFC 3548), Base85 and Ascii85 data encodings�N�encode�decode�encodebytes�decodebytes�	b64encode�	b64decode�	b32encode�	b32decode�	b16encode�	b16decode�	b85encode�	b85decode�	a85encode�	a85decode�standard_b64encode�standard_b64decode�urlsafe_b64encode�urlsafe_b64decodecCs|t|t�r4z|�d�WStk
r2td��YnXt|t�rB|Szt|���WStk
rvtd|j	j
�d�YnXdS)N�asciiz4string argument should contain only ASCII charactersz>argument should be a bytes-like object or ASCII string, not %r)�
isinstance�strr�UnicodeEncodeError�
ValueError�bytes_types�
memoryview�tobytes�	TypeError�	__class__�__name__��s�r!�/usr/lib64/python3.8/base64.py�_bytes_from_decode_data"s

��r#cCsDtj|dd�}|dk	r@t|�dks.tt|���|�t�d|��S|S)a*Encode the bytes-like object s using Base64 and return a bytes object.

    Optional altchars should be a byte string of length 2 which specifies an
    alternative alphabet for the '+' and '/' characters.  This allows an
    application to e.g. generate url or filesystem safe Base64 strings.
    F)�newlineN��+/)�binascii�
b2a_base64�len�AssertionError�repr�	translate�bytes�	maketrans)r �altchars�encodedr!r!r"r3s
FcCsft|�}|dk	rBt|�}t|�dks0tt|���|�t�|d��}|r\t�d|�s\t	�
d��t	�|�S)anDecode the Base64 encoded bytes-like object or ASCII string s.

    Optional altchars must be a bytes-like object or ASCII string of length 2
    which specifies the alternative alphabet used instead of the '+' and '/'
    characters.

    The result is returned as a bytes object.  A binascii.Error is raised if
    s is incorrectly padded.

    If validate is False (the default), characters that are neither in the
    normal base-64 alphabet nor the alternative alphabet are discarded prior
    to the padding check.  If validate is True, these non-alphabet characters
    in the input result in a binascii.Error.
    Nr%r&s[A-Za-z0-9+/]*={0,2}zNon-base64 digit found)r#r)r*r+r,r-r.�re�	fullmatchr'�Error�
a2b_base64)r r/Zvalidater!r!r"rAs
cCst|�S)zrEncode bytes-like object s using the standard Base64 alphabet.

    The result is returned as a bytes object.
    )rrr!r!r"rZscCst|�S)aQDecode bytes encoded with the standard Base64 alphabet.

    Argument s is a bytes-like object or ASCII string to decode.  The result
    is returned as a bytes object.  A binascii.Error is raised if the input
    is incorrectly padded.  Characters that are not in the standard alphabet
    are discarded prior to the padding check.
    )rrr!r!r"rasr&s-_cCst|��t�S)z�Encode bytes using the URL- and filesystem-safe Base64 alphabet.

    Argument s is a bytes-like object to encode.  The result is returned as a
    bytes object.  The alphabet uses '-' instead of '+' and '_' instead of
    '/'.
    )rr,�_urlsafe_encode_translationrr!r!r"roscCst|�}|�t�}t|�S)a�Decode bytes using the URL- and filesystem-safe Base64 alphabet.

    Argument s is a bytes-like object or ASCII string to decode.  The result
    is returned as a bytes object.  A binascii.Error is raised if the input
    is incorrectly padded.  Characters that are not in the URL-safe base-64
    alphabet, and are not a plus '+' or slash '/', are discarded prior to the
    padding check.

    The alphabet uses '-' instead of '+' and '_' instead of '/'.
    )r#r,�_urlsafe_decode_translationrrr!r!r"rxs
s ABCDEFGHIJKLMNOPQRSTUVWXYZ234567cs>tdkr,dd�tD���fdd��D�ad�t|t�sBt|���}t|�d}|rb|dd|}t�}tj	}t}t
dt|�d�D]V}||||d�d�}|||d	?||d
?d@||d?d@||d@7}q�|d
kr�d|dd�<nF|dk�rd|dd�<n.|dk�r d|dd�<n|dk�r6d|dd�<t|�S)zKEncode the bytes-like object s using Base32 and return a bytes object.
    NcSsg|]}t|f��qSr!�r-��.0�ir!r!r"�
<listcomp>�szb32encode.<locals>.<listcomp>csg|]}�D]}||�qqSr!r!�r9�a�b�Zb32tabr!r"r;�s��r�big��i��
�s======i����r%s====����s===�����=���)�_b32tab2�_b32alphabetrrrrr)�	bytearray�int�
from_bytes�ranger-)r �leftoverr0rQZb32tab2r:�cr!r?r"r�s<
��
�


c
	Cs�tdkrdd�tt�D�at|�}t|�dr8t�d��|dk	rvt|�}t|�dks`tt|���|�	t
�dd|��}|r�|��}t|�}|�
d	�}|t|�}t�}t}td
t|�d�D]j}|||d�}d
}	z|D]}
|	d>||
}	q�Wn"tk
�rt�d�d�YnX||	�dd
�7}q�|d�s:|dk�rDt�d��|�r�|�r�|	d|K}	|	�dd
�}dd|d}|d|�|dd�<t
|�S)aZDecode the Base32 encoded bytes-like object or ASCII string s.

    Optional casefold is a flag specifying whether a lowercase alphabet is
    acceptable as input.  For security purposes, the default is False.

    RFC 3548 allows for optional mapping of the digit 0 (zero) to the
    letter O (oh), and for optional mapping of the digit 1 (one) to
    either the letter I (eye) or letter L (el).  The optional argument
    map01 when not None, specifies which letter the digit 1 should be
    mapped to (when map01 is not None, the digit 0 is always mapped to
    the letter O).  For security purposes the default is None, so that
    0 and 1 are not allowed in the input.

    The result is returned as a bytes object.  A binascii.Error is raised if
    the input is incorrectly padded or if there are non-alphabet
    characters present in the input.
    NcSsi|]\}}||�qSr!r!)r9�k�vr!r!r"�
<dictcomp>�szb32decode.<locals>.<dictcomp>�zIncorrect paddingrFs01�OrKrr@zNon-base32 digit foundrB>rrFrHrJ��+���)�_b32rev�	enumeraterNr#r)r'r3r*r+r,r-r.�upper�rstriprOrR�KeyError�to_bytes)
r �casefoldZmap01�lZpadchars�decodedZb32revr:Zquanta�accrTZlastrSr!r!r"r	�sB


cCst�|���S)zKEncode the bytes-like object s using Base16 and return a bytes object.
    )r'Zhexlifyr_rr!r!r"r
�scCs4t|�}|r|��}t�d|�r*t�d��t�|�S)a�Decode the Base16 encoded bytes-like object or ASCII string s.

    Optional casefold is a flag specifying whether a lowercase alphabet is
    acceptable as input.  For security purposes, the default is False.

    The result is returned as a bytes object.  A binascii.Error is raised if
    s is incorrectly padded or if there are non-alphabet characters present
    in the input.
    s	[^0-9A-F]zNon-base16 digit found)r#r_r1�searchr'r3Z	unhexlify)r rcr!r!r"r�s

s<~s~>c	s�t|t�st|���}t|�d}|r4|d|}t�dt|�d��|�}����fdd�|D�}|r�|s�|ddkr��dd	|d<|dd|�|d<d
�|�S)NrJrAz!%dIcsPg|]H}�r|sdn6�r$|dkr$dn&�|d�|dd�|d�qS)�zi    �yi�^	�Ui9r!)r9Zword��chars�chars2�foldnuls�
foldspacesr!r"r;!s�
�
�z_85encode.<locals>.<listcomp>rLrhrr@�)	rrrrr)�struct�StructZunpack�join)	r>rlrm�padrnro�paddingZwords�chunksr!rkr"�	_85encodes
�rw)ro�wrapcolrt�adobecs�tdkr*dd�tdd�D�add�tD�at|tt|d|��|rHt���r�t|rVdnd	�����fd
d�tdt����D�}|r�t|d�d�kr�|�d
�d�|��|r��t	7��S)a�Encode bytes-like object b using Ascii85 and return a bytes object.

    foldspaces is an optional flag that uses the special short sequence 'y'
    instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This
    feature is not supported by the "standard" Adobe encoding.

    wrapcol controls whether the output should have newline (b'\n') characters
    added to it. If this is non-zero, each output line will be at most this
    many characters long.

    pad controls whether the input is padded to a multiple of 4 before
    encoding. Note that the btoa implementation always pads.

    adobe controls whether the encoded byte sequence is framed with <~ and ~>,
    which is used by the Adobe implementation.
    NcSsg|]}t|f��qSr!r7r8r!r!r"r;Dsza85encode.<locals>.<listcomp>�!�vcSsg|]}tD]}||�qqSr!)�	_a85charsr<r!r!r"r;EsTr%rFcsg|]}�||���qSr!r!r8��resultrxr!r"r;Ms�rrLrp�
)
�
_a85chars2rRr|rw�	_A85START�maxr)�appendrs�_A85END)r>rorxrtryrvr!r}r"r/s$�

s 	

)rory�ignorecharsc	Cs�t|�}|rH|�t�s$td�t���|�t�r<|dd�}n|dd�}t�d�j	}g}|j
}g}|j
}|j}	|dD]�}
d|
kr�dkr�nnl||
�t|�d	kr�d
}|D]}
d||
d}q�z|||��Wn tj
k
r�td�d�YnX|	�qv|
d
k�r |�rtd��|d�qv|�rH|
dk�rH|�r>td��|d�qv|
|k�rVqvqvtd|
��qvd�|�}dt|�}
|
�r�|d|
�}|S)a�Decode the Ascii85 encoded bytes-like object or ASCII string b.

    foldspaces is a flag that specifies whether the 'y' short sequence should be
    accepted as shorthand for 4 consecutive spaces (ASCII 0x20). This feature is
    not supported by the "standard" Adobe encoding.

    adobe controls whether the input sequence is in Adobe Ascii85 format (i.e.
    is framed with <~ and ~>).

    ignorechars should be a byte string containing characters to ignore from the
    input. This should only contain whitespace characters, and by default
    contains all whitespace characters in ASCII.

    The result is returned as a bytes object.
    z1Ascii85 encoded byte sequences must end with {!r}r%���N�!Isuuuurz�ur@rrjzAscii85 overflow�zzz inside Ascii85 5-tuples�yzy inside Ascii85 5-tuples    zNon-Ascii85 digit found: %crprJ)r#�endswithr�r�format�
startswithr�rqrr�packr��clearr)�errorrs)r>roryr��packIreZdecoded_appendZcurrZcurr_appendZ
curr_clear�xrfr~rur!r!r"rXsZ
��





sU0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~cCs2tdkr$dd�tD�add�tD�at|tt|�S)z�Encode bytes-like object b in base85 format and return a bytes object.

    If pad is true, the input is padded with b'\0' so its length is a multiple of
    4 bytes before encoding.
    NcSsg|]}t|f��qSr!r7r8r!r!r"r;�szb85encode.<locals>.<listcomp>cSsg|]}tD]}||�qqSr!)�	_b85charsr<r!r!r"r;�s)�
_b85chars2�_b85alphabetr�rw)r>rtr!r!r"r�s	c
	CsJtdkr,dgdatt�D]\}}|t|<qt|�}t|�d}|d|}g}t�d�j}tdt|�d�D]�}|||d�}d}z|D]}|dt|}q�WnFt	k
r�t|�D]&\}}t|dkr�t
d||�d�q��YnXz|�||��Wqntjk
�r$t
d	|�d�YqnXqnd
�
|�}	|�rF|	d|�}	|	S)zqDecode the base85-encoded bytes-like object or ASCII string b

    The result is returned as a bytes object.
    N�r@�~r�rrjz#bad base85 character at position %dz+base85 overflow in hunk starting at byte %drp)�_b85decr^r�r#r)rqrrr�rRrrr�r�rs)
r>r:rTru�outr��chunkrf�jr~r!r!r"r
�sH

����

�LrJrHcCsX|�t�}|sqTt|�tkr>|�tt|��}|s4q>||7}qt�|�}|�|�qdS)z1Encode a file; input and output are binary files.N)�read�
MAXBINSIZEr)r'r(�write)�input�outputr �ns�liner!r!r"r�s


cCs(|��}|sq$t�|�}|�|�qdS)z1Decode a file; input and output are binary files.N)�readliner'r4r�)r�r�r�r r!r!r"r�s

c
Cs�zt|�}Wn8tk
rD}zd|jj}t|�|�W5d}~XYnX|jdkrjd|j|jjf}t|��|jdkr�d|j|jjf}t|��dS)Nz"expected bytes-like object, not %s)rTr>�Bz-expected single byte elements, not %r from %srFz(expected 1-D data, not %d-D data from %s)rrrrr��ndim)r �m�err�msgr!r!r"�_input_type_check�s
�
�r�cCsLt|�g}tdt|�t�D]$}|||t�}|�t�|��qd�|�S)zVEncode a bytestring into a bytes object containing multiple lines
    of base-64 data.rrp)r�rRr)r�r�r'r(rs)r �piecesr:r�r!r!r"rscCsddl}|�dtd�t|�S)zLegacy alias of encodebytes().rNzAencodestring() is a deprecated alias since 3.1, use encodebytes()r%)�warnings�warn�DeprecationWarningr�r r�r!r!r"�encodestrings�r�cCst|�t�|�S)z8Decode a bytestring of base-64 data into a bytes object.)r�r'r4rr!r!r"rscCsddl}|�dtd�t|�S)zLegacy alias of decodebytes().rNzHdecodestring() is a deprecated alias since Python 3.1, use decodebytes()r%)r�r�r�rr�r!r!r"�decodestring$s�r�c	
Csddl}ddl}z|�|jdd�d�\}}WnP|jk
r~}z0|j|_t|�td|jd�|�d�W5d}~XYnXt}|D]@\}}|dkr�t}|dkr�t	}|d	kr�t	}|d
kr�t
�dSq�|�r|ddk�rt|dd��}|||jj�W5QRXn||j
j|jj�dS)
zSmall main programrNrFZdeutz�usage: %s [-d|-e|-u|-t] [file|-]
        -d, -u: decode
        -e: encode (default)
        -t: encode and decode string 'Aladdin:open sesame'r%z-ez-dz-uz-t�-�rb)�sys�getopt�argvr��stderr�stdout�print�exitrr�test�open�buffer�stdin)	r�r�Zopts�argsr��func�or=�fr!r!r"�main.s2�r�cCsHd}tt|��t|�}tt|��t|�}tt|��||ksDt�dS)NsAladdin:open sesame)r�r+rrr*)Zs0�s1�s2r!r!r"r�Hsr��__main__)N)NF)FN)F)FFF)F)2�__doc__r1rqr'�__all__r-rOrr#rrrrr.r5r6rrrNrMr]rr	r
rr|r�r�r�rwrrr�r�r�r�rr
ZMAXLINESIZEr�rrr�rr�rr�r�r�rr!r!r!r"�<module>s��

	&
C

)H
-	
	


bdb.cpython-38.opt-1.pyc000064400000060533150335716500010676 0ustar00U

e5d8}�@s�dZddlZddlZddlZddlmZmZmZdddgZeeBeBZ	Gdd�de
�ZGdd�d�Zd	d
�Z
Gdd�d�Zdd
�Zdd�ZGdd�de�Zdd�Zdd�Zdd�ZdS)zDebugger basics�N)�CO_GENERATOR�CO_COROUTINE�CO_ASYNC_GENERATOR�BdbQuit�Bdb�
Breakpointc@seZdZdZdS)rz Exception to give up completely.N)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib64/python3.8/bdb.pyr
sc@sveZdZdZd[dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd\d&d'�Zd]d(d)�Zd*d+�Zd,d-�Zd.d/�Zd^d0d1�Zd2d3�Zd4d5�Zd_d7d8�Zd9d:�Zd;d<�Zd=d>�Z d?d@�Z!dAdB�Z"dCdD�Z#dEdF�Z$dGdH�Z%dIdJ�Z&dKdL�Z'dMdN�Z(d`dPdQ�Z)dadRdS�Z*dbdTdU�Z+dVdW�Z,dXdY�Z-dZe-_.dS)craGeneric Python debugger base class.

    This class takes care of details of the trace facility;
    a derived class should implement user interaction.
    The standard debugger class (pdb.Pdb) is an example.

    The optional skip argument must be an iterable of glob-style
    module name patterns.  The debugger will not step into frames
    that originate in a module that matches one of these patterns.
    Whether a frame is considered to originate in a certain module
    is determined by the __name__ in the frame globals.
    NcCs(|rt|�nd|_i|_i|_d|_dS)N)�set�skip�breaks�fncache�frame_returning)�selfrrrr
�__init__szBdb.__init__cCsR|d|dd�dkr|S|j�|�}|sNtj�|�}tj�|�}||j|<|S)a%Return canonical form of filename.

        For real filenames, the canonical form is a case-normalized (on
        case insensitive filesystems) absolute path.  'Filenames' with
        angle brackets, such as "<stdin>", generated in interactive
        mode, are returned unchanged.
        �<�����>)r�get�os�path�abspath�normcase)r�filename�canonicrrr
r%s
zBdb.canoniccCs&ddl}|��d|_|�dd�dS)z5Set values of attributes as ready to start debugging.rN)�	linecache�
checkcache�botframe�
_set_stopinfo)rr rrr
�reset6sz	Bdb.resetcCs�|jr
dS|dkr|�|�S|dkr0|�||�S|dkrD|�||�S|dkrX|�||�S|dkrf|jS|dkrt|jS|dkr�|jStd	t|��|jS)
aODispatch a trace function for debugged frames based on the event.

        This function is installed as the trace function for debugged
        frames. Its return value is the new trace function, which is
        usually itself. The default implementation decides how to
        dispatch a frame, depending on the type of event (passed in as a
        string) that is about to be executed.

        The event can be one of the following:
            line: A new line of code is going to be executed.
            call: A function is about to be called or another code block
                  is entered.
            return: A function or other code block is about to return.
            exception: An exception has occurred.
            c_call: A C function is about to be called.
            c_return: A C function has returned.
            c_exception: A C function has raised an exception.

        For the Python events, specialized functions (see the dispatch_*()
        methods) are called.  For the C events, no action is taken.

        The arg parameter depends on the previous event.
        N�lineZcall�returnZ	exceptionZc_callZc_exceptionZc_returnz*bdb.Bdb.dispatch: unknown debugging event:)�quitting�
dispatch_line�
dispatch_call�dispatch_return�dispatch_exception�trace_dispatch�print�repr)r�frameZevent�argrrr
r,=s$
zBdb.trace_dispatchcCs.|�|�s|�|�r(|�|�|jr(t�|jS)a	Invoke user function and return trace function for line event.

        If the debugger stops on the current line, invoke
        self.user_line(). Raise BdbQuit if self.quitting is set.
        Return self.trace_dispatch to continue tracing in this scope.
        )�	stop_here�
break_here�	user_liner'rr,�rr/rrr
r(hs

zBdb.dispatch_linecCsd|jdkr|j|_|jS|�|�s0|�|�s0dS|jrH|jjt@rH|jS|�	||�|j
r^t�|jS)aInvoke user function and return trace function for call event.

        If the debugger stops on this function call, invoke
        self.user_call(). Raise BbdQuit if self.quitting is set.
        Return self.trace_dispatch to continue tracing in this scope.
        N)r"�f_backr,r1�break_anywhere�	stopframe�f_code�co_flags�GENERATOR_AND_COROUTINE_FLAGS�	user_callr'r�rr/r0rrr
r)ts
zBdb.dispatch_callcCs||�|�s||jkrv|jr,|jjt@r,|jSz||_|�||�W5d|_X|j	rVt
�|j|krv|jdkrv|�dd�|jS)aInvoke user function and return trace function for return event.

        If the debugger stops on this function return, invoke
        self.user_return(). Raise BdbQuit if self.quitting is set.
        Return self.trace_dispatch to continue tracing in this scope.
        Nr)
r1�returnframer7r8r9r:r,r�user_returnr'r�
stoplinenor#r<rrr
r*�szBdb.dispatch_returncCs�|�|�rF|jjt@r.|dtkr.|ddks�|�||�|jr�t�nD|jr�||jk	r�|jjjt@r�|dtt	fkr�|�||�|jr�t�|j
S)aInvoke user function and return trace function for exception event.

        If the debugger stops on this exception, invoke
        self.user_exception(). Raise BdbQuit if self.quitting is set.
        Return self.trace_dispatch to continue tracing in this scope.
        r�N)r1r8r9r:�
StopIteration�user_exceptionr'rr7�
GeneratorExitr,r<rrr
r+�s$

�
���zBdb.dispatch_exceptioncCs.|dkrdS|jD]}t�||�rdSqdS)z4Return True if module_name matches any skip pattern.NFT)r�fnmatch)rZmodule_name�patternrrr
�is_skipped_module�s
zBdb.is_skipped_modulecCsN|jr|�|j�d��rdS||jkr@|jdkr4dS|j|jkS|jsJdSdS)z>Return True if frame is below the starting frame in the stack.rFrT)rrF�	f_globalsrr7r?�f_linenor4rrr
r1�s�

z
Bdb.stop_herecCs�|�|jj�}||jkrdS|j}||j|krJ|jj}||j|krJdSt|||�\}}|r�|j|_|r�|j	r�|�
t|j��dSdSdS)z�Return True if there is an effective breakpoint for this line.

        Check for line or function breakpoint and if in effect.
        Delete temporary breakpoints if effective() says to.
        FTN)rr8�co_filenamerrH�co_firstlineno�	effective�numberZ	currentbp�	temporary�do_clear�str)rr/r�lineno�bp�flagrrr
r2�s

zBdb.break_herecCstd��dS)zlRemove temporary breakpoint.

        Must implement in derived classes or get NotImplementedError.
        z)subclass of bdb must implement do_clear()N)�NotImplementedError)rr0rrr
rN�szBdb.do_clearcCs|�|jj�|jkS)zEReturn True if there is any breakpoint for frame's filename.
        )rr8rIrr4rrr
r6�szBdb.break_anywherecCsdS)z&Called if we might stop in a function.Nr)rr/Z
argument_listrrr
r;sz
Bdb.user_callcCsdS)z'Called when we stop or break at a line.Nrr4rrr
r3sz
Bdb.user_linecCsdS)z&Called when a return trap is set here.Nr)rr/Zreturn_valuerrr
r>	szBdb.user_returncCsdS)z$Called when we stop on an exception.Nr)rr/�exc_inforrr
rB
szBdb.user_exceptionrcCs||_||_d|_||_dS)z�Set the attributes for stopping.

        If stoplineno is greater than or equal to 0, then stop at line
        greater than or equal to the stopline.  If stoplineno is -1, then
        don't stop at all.
        FN)r7r=r'r?)rr7r=r?rrr
r#szBdb._set_stopinfocCs$|dkr|jd}|�|||�dS)zxStop when the line with the lineno greater than the current one is
        reached or when returning from current frame.Nr)rHr#)rr/rPrrr
�	set_until"s
z
Bdb.set_untilcCs0|jr |jj}|r |js |j|_|�dd�dS)zStop after one line of code.N)rr5�f_tracer,r#)rZcaller_framerrr
�set_step*s

zBdb.set_stepcCs|�|d�dS)z2Stop on the next line in or below the given frame.N)r#r4rrr
�set_next6szBdb.set_nextcCs.|jjt@r|�|dd�n|�|j|�dS)z)Stop when returning from the given frame.Nr)r8r9r:r#r5r4rrr
�
set_return:szBdb.set_returncCsL|dkrt��j}|��|r4|j|_||_|j}q|��t�|j�dS)znStart debugging from frame.

        If frame is not specified, debugging starts from caller's frame.
        N)	�sys�	_getframer5r$r,rVr"rW�settracer4rrr
�	set_traceAs
z
Bdb.set_tracecCsH|�|jdd�|jsDt�d�t��j}|rD||jk	rD|`|j}q*dS)z�Stop only at breakpoints or when finished.

        If there are no breakpoints, set the system trace function to None.
        Nr)r#r"rrZr\r[r5rVr4rrr
�set_continuePs

zBdb.set_continuecCs"|j|_d|_d|_t�d�dS)zuSet quitting attribute to True.

        Raises BdbQuit exception in the next call to a dispatch_*() method.
        NT)r"r7r=r'rZr\�rrrr
�set_quit_szBdb.set_quitFc
Csb|�|�}ddl}|�||�}|s.d||fS|j�|g�}||krN|�|�t|||||�}	dS)z�Set a new breakpoint for filename:lineno.

        If lineno doesn't exist for the filename, return an error message.
        The filename should be in canonical form.
        rNzLine %s:%d does not exist)rr �getliner�
setdefault�appendr)
rrrPrM�cond�funcnamer r%�listrQrrr
�	set_breakps

z
Bdb.set_breakcCs4||ftjkr|j|�|�|j|s0|j|=dS)aPrune breakpoints for filename:lineno.

        A list of breakpoints is maintained in the Bdb instance and in
        the Breakpoint class.  If a breakpoint in the Bdb instance no
        longer exists in the Breakpoint class, then it's removed from the
        Bdb instance.
        N)r�bplistr�remove�rrrPrrr
�
_prune_breaks�s
zBdb._prune_breakscCsj|�|�}||jkrd|S||j|kr6d||fStj||fdd�D]}|��qL|�||�dS)znDelete breakpoints for filename:lineno.

        If no breakpoints were set, return an error message.
        �There are no breakpoints in %szThere is no breakpoint at %s:%dN)rrrrh�deleteMerk)rrrPrQrrr
�clear_break�s


zBdb.clear_breakc
CsZz|�|�}Wn.tk
r<}zt|�WY�Sd}~XYnX|��|�|j|j�dS)zxDelete a breakpoint by its index in Breakpoint.bpbynumber.

        If arg is invalid, return an error message.
        N)�get_bpbynumber�
ValueErrorrOrmrk�filer%)rr0rQ�errrrr
�clear_bpbynumber�szBdb.clear_bpbynumbercCsX|�|�}||jkrd|S|j|D]$}tj||f}|D]}|��q<q&|j|=dS)z`Delete all breakpoints in filename.

        If none were set, return an error message.
        rlN)rrrrhrm)rrr%ZblistrQrrr
�clear_all_file_breaks�s

zBdb.clear_all_file_breakscCs,|js
dStjD]}|r|��qi|_dS)z]Delete all existing breakpoints.

        If none were set, return an error message.
        zThere are no breakpointsN)rr�
bpbynumberrm)rrQrrr
�clear_all_breaks�s

zBdb.clear_all_breakscCs�|std��zt|�}Wn"tk
r:td|�d�YnXztj|}Wn"tk
rltd|�d�YnX|dkr�td|��|S)z�Return a breakpoint by its index in Breakpoint.bybpnumber.

        For invalid arg values or if the breakpoint doesn't exist,
        raise a ValueError.
        zBreakpoint number expectedz Non-numeric breakpoint number %sNz!Breakpoint number %d out of rangezBreakpoint %d already deleted)rp�intrru�
IndexError)rr0rLrQrrr
ro�szBdb.get_bpbynumbercCs"|�|�}||jko ||j|kS)z9Return True if there is a breakpoint for filename:lineno.�rrrjrrr
�	get_break�s

�z
Bdb.get_breakcCs4|�|�}||jkr0||j|kr0tj||fp2gS)znReturn all breakpoints for filename:lineno.

        If no breakpoints are set, return an empty list.
        )rrrrhrjrrr
�
get_breaks�s

���zBdb.get_breakscCs&|�|�}||jkr|j|SgSdS)zrReturn all lines with breakpoints for filename.

        If no breakpoints are set, return an empty list.
        Nry)rrrrr
�get_file_breaks�s


zBdb.get_file_breakscCs|jS)z$Return all breakpoints that are set.)rr_rrr
�get_all_breaks�szBdb.get_all_breakscCs�g}|r|j|kr|j}|dk	rD|�||jf�||jkr<qD|j}q|��tdt|�d�}|dk	r�|�|j|j	f�|j}q^|dkr�tdt|�d�}||fS)z�Return a list of (frame, lineno) in a stack trace and a size.

        List starts with original calling frame, if there is one.
        Size may be number of frames above or below f.
        Nrr)
�tb_frame�tb_nextrcrHr"r5�reverse�max�len�	tb_lineno)r�f�t�stack�irrr
�	get_stack�s 
z
Bdb.get_stack�: cCs�ddl}ddl}|\}}|�|jj�}d||f}|jjrH||jj7}n|d7}|d7}d|jkr�|jd}	|d7}||�|	�7}|�|||j	�}
|
r�|||
�
�7}|S)a:Return a string with information about a stack entry.

        The stack entry frame_lineno is a (frame, lineno) tuple.  The
        return string contains the canonical filename, the function name
        or '<lambda>', the input arguments, the return value, and the
        line of code (if it exists).

        rNz%s(%r)z<lambda>z()Z
__return__z->)r �reprlibrr8rI�co_name�f_localsr.rarG�strip)rZframe_linenoZlprefixr r�r/rPr�s�rvr%rrr
�format_stack_entrys 	

zBdb.format_stack_entryc	Cs�|dkrddl}|j}|dkr"|}|��t|t�r@t|dd�}t�|j�z*zt
|||�Wntk
rrYnXW5d|_	t�d�XdS)z�Debug a statement executed via the exec() function.

        globals defaults to __main__.dict; locals defaults to globals.
        Nrz<string>�execT)�__main__�__dict__r$�
isinstancerO�compilerZr\r,r'r�r)r�cmd�globals�localsr�rrr
�run5s

zBdb.runc	Csz|dkrddl}|j}|dkr"|}|��t�|j�z,zt|||�WW�Stk
r^YnXW5d|_t�d�XdS)z�Debug an expression executed via the eval() function.

        globals defaults to __main__.dict; locals defaults to globals.
        NrT)	r�r�r$rZr\r,r'�evalr)r�exprr�r�r�rrr
�runevalKs
zBdb.runevalcCs|�|||�dS)z.For backwards-compatibility.  Defers to run().N)r�)rr�r�r�rrr
�runctx_sz
Bdb.runctxc	Os�t|�dkr|^}}}nV|s&td��nHd|krZ|�d�}|^}}ddl}|jdtdd�ntdt|�d	��|��t�|j	�d}z(z|||�}Wntk
r�YnXW5d
|_
t�d�X|S)zWDebug a single function call.

        Return the result of the function call.
        r@z6descriptor 'runcall' of 'Bdb' object needs an argument�funcrNz0Passing 'func' as keyword argument is deprecated)�
stacklevelz7runcall expected at least 1 positional argument, got %drT)r��	TypeError�pop�warnings�warn�DeprecationWarningr$rZr\r,r'r)�args�kwdsrr�r��resrrr
�runcallfs2

�
�
zBdb.runcallz($self, func, /, *args, **kwds))N)r)N)N)FNN)r�)NN)NN)/rr	r
rrrr$r,r(r)r*r+rFr1r2rNr6r;r3r>rBr#rUrWrXrYr]r^r`rgrkrnrsrtrvrorzr{r|r}r�r�r�r�r�r��__text_signature__rrrr
rs\
+	


�







cCst���dS)z<Start debugging with a Bdb instance from the caller's frame.N)rr]rrrr
r]�sr]c@sZeZdZdZdZiZdgZddd�Zdd�Zd	d
�Z	dd�Z
dd
d�Zdd�Zdd�Z
dS)ra�Breakpoint class.

    Implements temporary breakpoints, ignore counts, disabling and
    (re)-enabling, and conditionals.

    Breakpoints are indexed by number through bpbynumber and by
    the (file, line) tuple using bplist.  The former points to a
    single instance of class Breakpoint.  The latter points to a
    list of such instances since there may be more than one
    breakpoint per line.

    When creating a breakpoint, its associated filename should be
    in canonical form.  If funcname is defined, a breakpoint hit will be
    counted when the first line of that function is executed.  A
    conditional breakpoint always counts a hit.
    rNFcCs�||_d|_||_||_||_||_d|_d|_d|_t	j
|_t	j
d7_
|j�
|�||f|jkr||j||f�
|�n|g|j||f<dS)NTrr)re�func_first_executable_linerqr%rMrd�enabled�ignore�hitsr�nextrLrurcrh)rrqr%rMrdrerrr
r�szBreakpoint.__init__cCs>|j|jf}d|j|j<|j|�|�|j|s:|j|=dS)z�Delete the breakpoint from the list associated to a file:line.

        If it is the last breakpoint in that position, it also deletes
        the entry for the file:line.
        N)rqr%rurLrhri)r�indexrrr
rm�s

zBreakpoint.deleteMecCs
d|_dS)zMark the breakpoint as enabled.TN�r�r_rrr
�enable�szBreakpoint.enablecCs
d|_dS)z Mark the breakpoint as disabled.FNr�r_rrr
�disable�szBreakpoint.disablecCs"|dkrtj}t|��|d�dS)z�Print the output of bpformat().

        The optional out argument directs where the output is sent
        and defaults to standard output.
        N)rq)rZ�stdoutr-�bpformat)r�outrrr
�bpprint�szBreakpoint.bpprintcCs�|jrd}nd}|jr |d}n|d}d|j||j|jf}|jrT|d|jf7}|jrj|d|jf7}|jr�|jdkr�d	}nd
}|d|j|f7}|S)z�Return a string with information about the breakpoint.

        The information includes the breakpoint number, temporary
        status, file:line position, break condition, number of times to
        ignore, and number of times hit.

        zdel  zkeep zyes  zno   z%-4dbreakpoint   %s at %s:%dz
	stop only if %sz
	ignore next %d hitsrr��z"
	breakpoint already hit %d time%s)rMr�rLrqr%rdr�r�)rZdispZretZssrrr
r��s(
�
zBreakpoint.bpformatcCsd|j|j|jfS)z1Return a condensed description of the breakpoint.zbreakpoint %s at %s:%s)rLrqr%r_rrr
�__str__�szBreakpoint.__str__)FNN)N)rr	r
rr�rhrurrmr�r�r�r�r�rrrr
r�s


cCsN|js|j|jkrdSdS|jj|jkr,dS|js:|j|_|j|jkrJdSdS)aVReturn True if break should happen here.

    Whether a break should happen depends on the way that b (the breakpoint)
    was set.  If it was set via line number, check if b.line is the same as
    the one in the frame.  If it was set via function name, check if this is
    the right function and if it is on the first executable line.
    FT)rer%rHr8r�r�)�br/rrr
�
checkfuncnamesr�cCs�tj||f}|D]�}|jsqt||�s*q|jd7_|jsh|jdkrZ|jd8_qq�|dfSqzBt|j|j|j	�}|r�|jdkr�|jd8_n|dfWSWq|dfYSXqdS)aEDetermine which breakpoint for this file:line is to be acted upon.

    Called only if we know there is a breakpoint at this location.  Return
    the breakpoint that was triggered and a boolean that indicates if it is
    ok to delete a temporary breakpoint.  Return (None, None) if there is no
    matching breakpoint.
    rrTF)NN)
rrhr�r�r�rdr�r�rGr�)rqr%r/Z	possiblesr��valrrr
rK#s*


rKc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TdbcCs |jj}|sd}td||�dS)N�???z+++ call)r8r�r-)rr/r��namerrr
r;Tsz
Tdb.user_callcCsTddl}|jj}|sd}|�|jj�}|�||j|j�}td||j|d|�	��dS)Nrr�z+++�:)
r r8r�rrIrarHrGr-r�)rr/r r��fnr%rrr
r3Xsz
Tdb.user_linecCstd|�dS)Nz
+++ return�r-)rr/Zretvalrrr
r>_szTdb.user_returncCstd|�|��dS)Nz
+++ exception)r-r^)rr/Z	exc_stuffrrr
rBas
zTdb.user_exceptionN)rr	r
r;r3r>rBrrrr
r�Ssr�cCs&td|d�t|d�}td|�dS)Nzfoo(�)�
zbar returned)r-�bar)�n�xrrr
�fooesr�cCstd|d�|dS)Nzbar(r�r@r�)�arrr
r�jsr�cCst�}|�d�dS)Nzimport bdb; bdb.foo(10))r�r�)r�rrr
�testnsr�)rrDrZr�inspectrrr�__all__r:�	Exceptionrrr]rr�rKr�r�r�r�rrrr
�<module>s(
{t"0runpy.cpython-38.pyc000064400000017767150335716500010400 0ustar00U

e5d/�@sdZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
ddgZGdd�de�Z
Gdd	�d	e�Zd d
d�Zd!dd
�Zefdd�ZGdd�de�Zd"dd�Zd#dd�Zefdd�Zdd�Zd$dd�Zedk�reej�dk�r�edejd�nejd=eejd�dS)%aZrunpy.py - locating and running Python code using the module namespace

Provides support for locating and running Python scripts using the Python
module namespace instead of the native filesystem.

This allows Python code to play nicely with non-filesystem based PEP 302
importers when locating support scripts as well as when importing modules.
�N)�	read_code�get_importer�
run_module�run_pathc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_TempModulezCTemporarily replace a module in sys.modules with an empty namespacecCs||_t�|�|_g|_dS�N)�mod_name�types�
ModuleType�module�
_saved_module��selfr�r�/usr/lib64/python3.8/runpy.py�__init__sz_TempModule.__init__cCsB|j}z|j�tj|�Wntk
r0YnX|jtj|<|Sr)rr�append�sys�modules�KeyErrorrr
rrr�	__enter__ sz_TempModule.__enter__cGs.|jr|jdtj|j<n
tj|j=g|_dS�Nr)rrrr�r�argsrrr�__exit__)s
z_TempModule.__exit__N)�__name__�
__module__�__qualname__�__doc__rrrrrrrrs	rc@s$eZdZdd�Zdd�Zdd�ZdS)�_ModifiedArgv0cCs||_t�|_|_dSr)�value�object�_saved_value�	_sentinel)rr rrrr1sz_ModifiedArgv0.__init__cCs0|j|jk	rtd��tjd|_|jtjd<dS)NzAlready preserving saved valuer)r"r#�RuntimeErrorr�argvr )rrrrr5sz_ModifiedArgv0.__enter__cGs|j|_|jtjd<dSr)r#r r"rr%rrrrr;sz_ModifiedArgv0.__exit__N)rrrrrrrrrrr0src
	Csn|dk	r|�|�|dkr(d}|}d}	n |j}|j}|j}	|dkrH|j}|j|||	d|||d�t||�|S)z)Helper to run code in nominated namespaceN)r�__file__�
__cached__r�
__loader__�__package__�__spec__)�update�loader�origin�cached�parent�exec)
�codeZrun_globals�init_globalsr�mod_spec�pkg_name�script_namer,�fnamer.rrr�	_run_code@s*
�
r7c	
Cs^|dkr|n|j}t|��6}t|��"|jj}t|||||||�W5QRXW5QRX|��S)z5Helper to run code in new namespace with sys modifiedN)r-rrr�__dict__r7�copy)	r1r2rr3r4r5r6�temp_module�mod_globalsrrr�_run_module_codeZs�r<c
Cs2|�d�r|d��|�d�\}}}|r�zt|�WnHtk
rz}z*|jdksh|j|krj|�|jd�sj�W5d}~XYnXtj�|�}|dk	r�t|d�s�ddl	m
}dj||d�}|t|��zt
j�|�}WnJttttfk
�r}	z"d}||�|t|	�j|	��|	�W5d}	~	XYnX|dk�r2|d	|��|jdk	�r�|d
k�sT|�d��r\|d��z|d}
t|
|�WS|k
�r�}z"|tjk�r��|d
||f��W5d}~XYnX|j}|dk�r�|d|��z|�|�}Wn2tk
�r}z|t|��|�W5d}~XYnX|dk�r(|d|��|||fS)N�.z#Relative module names not supported�__path__r)�warnz�{mod_name!r} found in sys.modules after import of package {pkg_name!r}, but prior to execution of {mod_name!r}; this may result in unpredictable behaviour)rr4z:Error while finding module specification for {!r} ({}: {})zNo module named %s�__main__z	.__main__z%Cannot use package as __main__ modulez3%s; %r is a package and cannot be directly executedz0%r is a namespace package and cannot be executedzNo code object available for %s)�
startswith�
rpartition�
__import__�ImportError�namerr�get�hasattr�warningsr?�format�RuntimeWarning�	importlib�util�	find_spec�AttributeError�	TypeError�
ValueError�typer�submodule_search_locations�endswith�_get_module_detailsr,�get_code)
r�errorr4�_�eZexistingr?�msg�specZexZ
pkg_main_namer,r1rrrrThsd
��,
�
� 
rTc@seZdZdZdS)�_ErrorzBError that _run_module_as_main() should report without a tracebackN)rrrrrrrrr[�sr[Tc
Cs�z0|s|dkr t|t�\}}}ntt�\}}}Wn:tk
rj}zdtj|f}t�|�W5d}~XYnXtjdj}|r�|jtj	d<t
||dd|�S)a�Runs the designated module in the __main__ namespace

       Note that the executed module will have full access to the
       __main__ namespace. If this is not desirable, the run_module()
       function should be used to run the module code in a fresh namespace.

       At the very least, these variables in __main__ will be overwritten:
           __name__
           __file__
           __cached__
           __loader__
           __package__
    r@z%s: %sNr)rTr[�_get_main_module_detailsr�
executable�exitrr8r-r%r7)rZ
alter_argvr3r1�excrYZmain_globalsrrr�_run_module_as_main�s�r`FcCs@t|�\}}}|dkr|}|r,t||||�St|i|||�SdS)znExecute a module's code without importing it

       Returns the resulting top level namespace dictionary
    N)rTr<r7)rr2�run_nameZ	alter_sysr3r1rrrr�sc
Cs�d}tj|}tj|=z\zt|�WW�NStk
rn}z*|t|�kr\|d|tjdf�|��W5d}~XYnXW5|tj|<XdS)Nr@zcan't find %r module in %rr)rrrTrD�str�path)rVZ	main_nameZ
saved_mainr_rrrr\�s
��r\c	Csftj�t�|��}t�|��}t|�}W5QRX|dkr^t�|��}t|��|d�}W5QRX||fS)Nr0)	�osrc�abspath�fsdecode�io�	open_coder�compile�read)rar6Zdecoded_path�fr1rrr�_get_code_from_file�srlcCs$|dkrd}|�d�d}t|�}d}t|�jdkrFt|�jdkrFd}t|td��sX|rxt||�\}}t|||||d	�Stj	�
d|�znt
�\}}	}t|��P}
t|��<|
jj}t|||||	|���W5QR�W5QR�W�SQRXW5QRXW5ztj	�|�Wntk
�rYnXXdS)
a_Execute code located at the specified filesystem location

       Returns the resulting top level namespace dictionary

       The file path may refer directly to a Python script (i.e.
       one that could be directly executed with execfile) or else
       it may refer to a zipfile or directory containing a top
       level __main__.py script.
    Nz
<run_path>r=rFZimpZNullImporterT)r4r5)rBrrQrr�
isinstancerlr<rrc�insert�removerPr\rrrr8r7r9)Z	path_namer2rar4ZimporterZis_NullImporterr1r6rr3r:r;rrrr�s<
�
��8r@�z!No module specified for execution)�file)NNNNN)NNNNN)T)NNF)NN)rr�importlib.machineryrK�importlib.utilrgr	rdZpkgutilrr�__all__r!rrr7r<rDrT�	Exceptionr[r`rr\rlrr�lenr%�print�stderrrrrr�<module>sN��
�
:
�

1
argparse.cpython-38.opt-2.pyc000064400000147231150335716500011755 0ustar00U

e5dw�@s,dZddddddddd	d
ddd
ddddgZddlZddlZddlZddlZ	ddl
m
ZmZdZ
dZdZdZdZdZdZGdd�de�Zdd�ZGd d�de�ZGd!d�de�ZGd"d�de�ZGd#d�de�ZGd$d	�d	e�Zd%d&�ZGd'd�de�ZGd(d�de�ZGd)d�de�Z Gd*d+�d+e �Z!Gd,d-�d-e �Z"Gd.d/�d/e"�Z#Gd0d1�d1e"�Z$Gd2d3�d3e �Z%Gd4d5�d5e �Z&Gd6d7�d7e �Z'Gd8d9�d9e �Z(Gd:d;�d;e �Z)Gd<d=�d=e �Z*Gd>d?�d?e%�Z+Gd@d�de�Z,GdAd
�d
e�Z-GdBdC�dCe�Z.GdDdE�dEe.�Z/GdFdG�dGe/�Z0GdHd�dee.�Z1dS)Iz1.1�ArgumentParser�
ArgumentError�ArgumentTypeError�FileType�
HelpFormatter�ArgumentDefaultsHelpFormatter�RawDescriptionHelpFormatter�RawTextHelpFormatter�MetavarTypeHelpFormatter�	Namespace�Action�ONE_OR_MORE�OPTIONAL�PARSER�	REMAINDER�SUPPRESS�ZERO_OR_MORE�N)�gettext�ngettextz==SUPPRESS==�?�*�+zA...�...Z_unrecognized_argsc@s$eZdZdd�Zdd�Zdd�ZdS)�_AttributeHoldercCs�t|�j}g}i}|��D]}|�t|��q|��D],\}}|��rZ|�d||f�q6|||<q6|rz|�dt|��d|d�|�fS)N�%s=%rz**%s�%s(%s)�, )�type�__name__�	_get_args�append�repr�_get_kwargs�isidentifier�join)�selfZ	type_name�arg_stringsZ	star_args�arg�name�value�r*� /usr/lib64/python3.8/argparse.py�__repr__ts

z_AttributeHolder.__repr__cCst|j���S�N)�sorted�__dict__�items�r%r*r*r+r"�sz_AttributeHolder._get_kwargscCsgSr-r*r1r*r*r+r�sz_AttributeHolder._get_argsN)r�
__module__�__qualname__r,r"rr*r*r*r+rks	rcCs6|dkrgSt|�tkr$|dd�Sddl}|�|�S)Nr)r�list�copy)r0r5r*r*r+�_copy_items�sr6c@s�eZdZd:dd�Zdd�Zdd	�ZGd
d�de�Zdd
�Zdd�Z	dd�Z
dd�Zd;dd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�ZdS)<r��NcCs�|dkrt��j}|d8}||_||_t|t|d|d��|_||_d|_	d|_
d|_|�|d�|_
|j
|_t�dtj�|_t�d�|_dS)Nr7�rz\s+z\n\n\n+)�_shutil�get_terminal_size�columns�_prog�_indent_increment�min�max�_max_help_position�_width�_current_indent�_level�_action_max_length�_Section�
_root_section�_current_section�_re�compile�ASCII�_whitespace_matcher�_long_break_matcher)r%�progZindent_incrementZmax_help_position�widthr*r*r+�__init__�s 
�zHelpFormatter.__init__cCs"|j|j7_|jd7_dS�N��rCr>rDr1r*r*r+�_indent�szHelpFormatter._indentcCs"|j|j8_|jd8_dSrQrSr1r*r*r+�_dedent�szHelpFormatter._dedentc@seZdZddd�Zdd�ZdS)zHelpFormatter._SectionNcCs||_||_||_g|_dSr-)�	formatter�parent�headingr0)r%rVrWrXr*r*r+rP�szHelpFormatter._Section.__init__cCs�|jdk	r|j��|jj}|dd�|jD��}|jdk	rD|j��|sLdS|jtk	rz|jdk	rz|jj}d|d|jf}nd}|d||dg�S)NcSsg|]\}}||��qSr*r*)�.0�func�argsr*r*r+�
<listcomp>�sz6HelpFormatter._Section.format_help.<locals>.<listcomp>�z%*s%s:
�
)	rWrVrT�_join_partsr0rUrXrrC)r%r$Z	item_helpZcurrent_indentrXr*r*r+�format_help�s



z"HelpFormatter._Section.format_help)N)rr2r3rPr`r*r*r*r+rF�s
rFcCs|jj�||f�dSr-)rHr0r )r%rZr[r*r*r+�	_add_item�szHelpFormatter._add_itemcCs0|��|�||j|�}|�|jg�||_dSr-)rTrFrHrar`)r%rXZsectionr*r*r+�
start_section�szHelpFormatter.start_sectioncCs|jj|_|��dSr-)rHrWrUr1r*r*r+�end_section�s
zHelpFormatter.end_sectioncCs$|tk	r |dk	r |�|j|g�dSr-)rra�_format_text)r%�textr*r*r+�add_text�szHelpFormatter.add_textcCs&|tk	r"||||f}|�|j|�dSr-)rra�
_format_usage)r%�usage�actions�groups�prefixr[r*r*r+�	add_usage�szHelpFormatter.add_usagecCsv|jtk	rr|j}||�g}|�|�D]}|�||��q$tdd�|D��}||j}t|j|�|_|�|j	|g�dS)NcSsg|]}t|��qSr*��len�rY�sr*r*r+r\
sz.HelpFormatter.add_argument.<locals>.<listcomp>)
�helpr�_format_action_invocation�_iter_indented_subactionsr r@rCrEra�_format_action)r%�actionZget_invocationZinvocations�	subactionZinvocation_lengthZ
action_lengthr*r*r+�add_arguments


�zHelpFormatter.add_argumentcCs|D]}|�|�qdSr-)rw)r%rirur*r*r+�
add_argumentsszHelpFormatter.add_argumentscCs.|j��}|r*|j�d|�}|�d�d}|S)N�

r^)rGr`rM�sub�strip)r%rqr*r*r+r`s

zHelpFormatter.format_helpcCsd�dd�|D��S)Nr]cSsg|]}|r|tk	r|�qSr*)r)rY�partr*r*r+r\!s�z-HelpFormatter._join_parts.<locals>.<listcomp>)r$)r%Zpart_stringsr*r*r+r_ s
�zHelpFormatter._join_partscs|dkrtd�}|dk	r,|t|jd�}�n�|dkrL|sLdt|jd�}�n�|dk�rdt|jd�}g}g}|D] }|jr�|�|�qr|�|�qr|j}	|	|||�}
d�dd�||
fD��}|j|j�t	|�t	|��k�rd}|	||�}|	||�}
t
�||�}t
�||
�}d�fdd	�	}t	|�t	|�d
�k�r�dt	|�t	|�d}|�r|||g|||�}|�|||��n |�r�||g|||�}n|g}nZdt	|�}||}|||�}t	|�dk�r�g}|�|||��|�|||��|g|}d�|�}d
||fS)Nzusage: �rNz%(prog)s� cSsg|]}|r|�qSr*r*ror*r*r+r\Asz/HelpFormatter._format_usage.<locals>.<listcomp>z%\(.*?\)+(?=\s|$)|\[.*?\]+(?=\s|$)|\S+cs�g}g}|dk	rt|�d}nt|�d}|D]Z}|dt|��krn|rn|�|d�|��g}t|�d}|�|�|t|�d7}q.|r�|�|d�|��|dk	r�|dt|�d�|d<|S)NrRr~r)rnr r$)�parts�indentrk�lines�lineZline_lenr|��
text_widthr*r+�	get_linesUs"
z.HelpFormatter._format_usage.<locals>.get_linesg�?rRr^z%s%s

)N)
�_�dictr=�option_stringsr �_format_actions_usager$rBrCrnrI�findall�extend)r%rhrirjrkrN�	optionals�positionalsru�formatZaction_usageZpart_regexpZ	opt_usageZ	pos_usageZ	opt_partsZ	pos_partsr�r�r�rr*r�r+rg%sX
�




zHelpFormatter._format_usagec	Cs�t�}i}|D�]}z|�|jd�}Wntk
r@YqYqX|t|j�}|||�|jkr|jD]}|�|�qh|js�||kr�||d7<nd||<||kr�||d7<nd||<nF||kr�||d7<nd||<||k�r||d7<nd||<t|d|�D]}	d	||	<�qqg}
t|�D�]"\}	}|j	t
k�r�|
�d�|�|	�d	k�rr|�
|	�n"|�|	d�d	k�rX|�
|	d�n�|j�s�|�|�}|�||�}||k�r�|ddk�r�|d
dk�r�|dd
�}|
�|�nf|jd}
|jdk�rd|
}n"|�|�}|�||�}d|
|f}|j�sN||k�rNd
|}|
�|��q6t|dd�D]}	||	g|
|	|	�<�qhd�dd�|
D��}d}d}t�d|d|�}t�d|d|�}t�d||fd|�}t�dd|�}|��}|S)Nrz [�[�]z (�(�)rR�|����%s�%s %s�[%s]T)�reverser~cSsg|]}|dk	r|�qSr-r*)rY�itemr*r*r+r\�sz7HelpFormatter._format_actions_usage.<locals>.<listcomp>z[\[(]z[\])]z(%s) z\1� (%s)z%s *%sr]z\(([^|]*)\))�set�index�_group_actions�
ValueErrorrn�add�required�range�	enumeraterqrr �get�popr��#_get_default_metavar_for_positional�_format_args�nargs�!_get_default_metavar_for_optionalr.r$rIrzr{)r%rirj�
group_actionsZinserts�group�start�endru�ir�defaultr|�
option_string�args_stringre�open�closer*r*r+r��sz










z#HelpFormatter._format_actions_usagecCsFd|kr|t|jd�}t|j|jd�}d|j}|�|||�dS)Nz%(prog)r}�r~ry)r�r=r@rBrC�
_fill_text)r%rer�r�r*r*r+rd�s

zHelpFormatter._format_textc
Cs:t|jd|j�}t|j|d�}||jd}|�|�}|jsV|jd|f}d|}n@t|�|kr~|jd||f}d|}d}n|jd|f}d|}|}|g}|jr�|�	|�}	|�
|	|�}
|�d|d|
df�|
dd�D]}|�d|d|f�q�n|�d��s|�d�|�
|�D]}|�|�|���q|�|�S)	Nr7r�r]z%*s%s
z	%*s%-*s  rrRr^)r?rErAr@rBrCrrrqrn�_expand_help�_split_linesr �endswithrsrtr_)
r%ruZ
help_positionZ
help_widthZaction_widthZ
action_header�tupZindent_firstrZ	help_textZ
help_linesr�rvr*r*r+rt�s8
�



zHelpFormatter._format_actioncCs�|js&|�|�}|�||�d�\}|Sg}|jdkrB|�|j�n4|�|�}|�||�}|jD]}|�d||f�q^d�|�SdS)NrRrr�r)	r�r��_metavar_formatterr�r�r�r�r r$)r%rur��metavarrr�r�r*r*r+rr"s



z'HelpFormatter._format_action_invocationcsP|jdk	r|j�n.|jdk	r<dd�|jD�}dd�|��n|��fdd�}|S)NcSsg|]}t|��qSr*��str)rYZchoicer*r*r+r\>sz4HelpFormatter._metavar_formatter.<locals>.<listcomp>z{%s}�,cst�t�r�S�f|SdSr-)�
isinstance�tuple)Z
tuple_size��resultr*r+r�Cs
z0HelpFormatter._metavar_formatter.<locals>.format)r��choicesr$)r%ru�default_metavarZchoice_strsr�r*r�r+r�:s

z HelpFormatter._metavar_formattercCs�|�||�}|jdkr$d|d�}n�|jtkr<d|d�}n�|jtkrTd|d�}n�|jtkrld|d�}n�|jtkr|d}nt|jtkr�d|d�}n\|jtkr�d	}nLzd
d�t|j�D�}Wnt	k
r�t
d�d�YnXd
�|�||j�}|S)Nr�rRr�z
[%s [%s ...]]r7z%s [%s ...]rz%s ...r]cSsg|]}d�qS)r�r*)rYr�r*r*r+r\\sz.HelpFormatter._format_args.<locals>.<listcomp>zinvalid nargs valuer~)r�r�r
rrrrrr��	TypeErrorr�r$)r%rur�Zget_metavarr�Zformatsr*r*r+r�Js*






zHelpFormatter._format_argscCs�tt|�|jd�}t|�D]}||tkr||=qt|�D] }t||d�r:||j||<q:|�d�dk	r�d�dd�|dD��}||d<|�	|�|S)Nr}rr�rcSsg|]}t|��qSr*r�)rY�cr*r*r+r\ksz.HelpFormatter._expand_help.<locals>.<listcomp>)
r��varsr=r4r�hasattrrr�r$�_get_help_string)r%ruZparamsr(Zchoices_strr*r*r+r�bszHelpFormatter._expand_helpccs@z
|j}Wntk
rYnX|��|�EdH|��dSr-)�_get_subactions�AttributeErrorrTrU)r%ruZget_subactionsr*r*r+rsos
z'HelpFormatter._iter_indented_subactionscCs&|j�d|���}ddl}|�||�S)Nr~r)rLrzr{�textwrapZwrap)r%rerOr�r*r*r+r�yszHelpFormatter._split_linescCs,|j�d|���}ddl}|j||||d�S)Nr~r)Zinitial_indentZsubsequent_indent)rLrzr{r�Zfill)r%rerOr�r�r*r*r+r��s�zHelpFormatter._fill_textcCs|jSr-)rq�r%rur*r*r+r��szHelpFormatter._get_help_stringcCs
|j��Sr-)�dest�upperr�r*r*r+r��sz/HelpFormatter._get_default_metavar_for_optionalcCs|jSr-)r�r�r*r*r+r��sz1HelpFormatter._get_default_metavar_for_positional)r7r8N)N)rr2r3rPrTrU�objectrFrarbrcrfrlrwrxr`r_rgr�rdrtrrr�r�r�rsr�r�r�r�r�r*r*r*r+r�s<	�

`g/

c@seZdZdd�ZdS)rcs d��fdd�|jdd�D��S)Nr]c3s|]}�|VqdSr-r*)rYr��r�r*r+�	<genexpr>�sz9RawDescriptionHelpFormatter._fill_text.<locals>.<genexpr>T)�keepends)r$�
splitlines)r%rerOr�r*r�r+r��sz&RawDescriptionHelpFormatter._fill_textN)rr2r3r�r*r*r*r+r�sc@seZdZdd�ZdS)rcCs|��Sr-)r�)r%rerOr*r*r+r��sz!RawTextHelpFormatter._split_linesN)rr2r3r�r*r*r*r+r�sc@seZdZdd�ZdS)rcCs>|j}d|jkr:|jtk	r:ttg}|js2|j|kr:|d7}|S)Nz
%(default)z (default: %(default)s))rqr�rr
rr�r�)r%rurqZdefaulting_nargsr*r*r+r��s

z.ArgumentDefaultsHelpFormatter._get_help_stringN)rr2r3r�r*r*r*r+r�sc@seZdZdd�Zdd�ZdS)r	cCs|jjSr-�rrr�r*r*r+r��sz:MetavarTypeHelpFormatter._get_default_metavar_for_optionalcCs|jjSr-r�r�r*r*r+r��sz<MetavarTypeHelpFormatter._get_default_metavar_for_positionalN)rr2r3r�r�r*r*r*r+r	�scCsN|dkrdS|jrd�|j�S|jdtfkr2|jS|jdtfkrF|jSdSdS)N�/)r�r$r�rr�)�argumentr*r*r+�_get_action_name�sr�c@seZdZdd�Zdd�ZdS)rcCst|�|_||_dSr-)r��
argument_name�message)r%r�r�r*r*r+rP�s
zArgumentError.__init__cCs(|jdkrd}nd}|t|j|jd�S)Nz%(message)sz'argument %(argument_name)s: %(message)s)r�r�)r�r�r�)r%r�r*r*r+�__str__�s
�zArgumentError.__str__N)rr2r3rPr�r*r*r*r+r�sc@seZdZdS)rN)rr2r3r*r*r*r+r�sc@s(eZdZd	dd�Zdd�Zd
dd�ZdS)rNFcCs@||_||_||_||_||_||_||_||_|	|_|
|_	dSr-�
r�r�r��constr�rr�r�rqr��r%r�r�r�r�r�rr�r�rqr�r*r*r+rP)szAction.__init__c	s(ddddddddd	g	}�fd
d�|D�S)Nr�r�r�r�r�rr�rqr�csg|]}|t�|�f�qSr*��getattr�rYr(r1r*r+r\Ksz&Action._get_kwargs.<locals>.<listcomp>r*�r%�namesr*r1r+r"?s�zAction._get_kwargscCsttd���dS)Nz.__call__() not defined)�NotImplementedErrorr��r%�parser�	namespace�valuesr�r*r*r+�__call__MszAction.__call__)NNNNNFNN)N)rr2r3rPr"r�r*r*r*r+r�s6�
cs(eZdZd�fdd�	Zddd�Z�ZS)	�_StoreActionNFcsT|dkrtd��|dk	r,|tkr,tdt��tt|�j|||||||||	|
d�
dS)Nrz�nargs for store actions must be != 0; if you have nothing to store, actions such as store true or store const may be more appropriate� nargs must be %r to supply constr�)r�r
�superr�rPr���	__class__r*r+rPSs 
�z_StoreAction.__init__cCst||j|�dSr-)�setattrr�r�r*r*r+r�psz_StoreAction.__call__)NNNNNFNN)N�rr2r3rPr��
__classcell__r*r*r�r+r�Qs�r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_StoreConstActionNFc	s"tt|�j||d||||d�dS)Nr)r�r�r�r�r�r�rq)r�r�rP�r%r�r�r�r�r�rqr�r�r*r+rPvs
�z_StoreConstAction.__init__cCst||j|j�dSr-)r�r�r�r�r*r*r+r��sz_StoreConstAction.__call__)NFNN)Nr�r*r*r�r+r�ts�r�cseZdZd�fdd�	Z�ZS)�_StoreTrueActionFNcs tt|�j||d|||d�dS)NT�r�r�r�r�r�rq)r�r�rP�r%r�r�r�r�rqr�r*r+rP�s
�z_StoreTrueAction.__init__)FFN�rr2r3rPr�r*r*r�r+r��s�r�cseZdZd�fdd�	Z�ZS)�_StoreFalseActionTFNcs tt|�j||d|||d�dS)NFr�)r�r�rPr�r�r*r+rP�s
�z_StoreFalseAction.__init__)TFNr�r*r*r�r+r��s�r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�
_AppendActionNFcsT|dkrtd��|dk	r,|tkr,tdt��tt|�j|||||||||	|
d�
dS)Nrz�nargs for append actions must be != 0; if arg strings are not supplying the value to append, the append const action may be more appropriater�r�)r�r
r�r�rPr�r�r*r+rP�s 
�z_AppendAction.__init__cCs2t||jd�}t|�}|�|�t||j|�dSr-)r�r�r6r r��r%r�r�r�r�r0r*r*r+r��s
z_AppendAction.__call__)NNNNNFNN)Nr�r*r*r�r+r��s�r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_AppendConstActionNFc
s$tt|�j||d|||||d�dS)Nr)r�r�r�r�r�r�rqr�)r�r�rPr�r�r*r+rP�s
�z_AppendConstAction.__init__cCs4t||jd�}t|�}|�|j�t||j|�dSr-)r�r�r6r r�r�r�r*r*r+r��sz_AppendConstAction.__call__)NFNN)Nr�r*r*r�r+r��s�r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_CountActionNFcs tt|�j||d|||d�dS)Nr)r�r�r�r�r�rq)r�r�rPr�r�r*r+rP�s
�z_CountAction.__init__cCs0t||jd�}|dkrd}t||j|d�dS�NrrR)r�r�r�)r%r�r�r�r��countr*r*r+r��sz_CountAction.__call__)NFN)Nr�r*r*r�r+r��s
�r�cs.eZdZeedf�fdd�	Zddd�Z�ZS)�_HelpActionNcstt|�j|||d|d�dS�Nr)r�r�r�r�rq)r�r�rP)r%r�r�r�rqr�r*r+rPs
�z_HelpAction.__init__cCs|��|��dSr-)�
print_help�exitr�r*r*r+r�sz_HelpAction.__call__)N�rr2r3rrPr�r�r*r*r�r+r�s
�r�cs0eZdZdeedf�fdd�	Zddd�Z�ZS)�_VersionActionNz&show program's version number and exitcs$tt|�j|||d|d�||_dSr�)r�rrP�version)r%r�rr�r�rqr�r*r+rPs
�z_VersionAction.__init__cCsD|j}|dkr|j}|��}|�|�|�|��tj�|��dSr-)r�_get_formatterrf�_print_messager`�_sys�stdoutr)r%r�r�r�r�rrVr*r*r+r�(s
z_VersionAction.__call__)Nrr*r*r�r+rs�rcsPeZdZGdd�de�Zedddf�fdd�	Zdd�Zd	d
�Zd
dd�Z	�Z
S)�_SubParsersActioncseZdZ�fdd�Z�ZS)z&_SubParsersAction._ChoicesPseudoActioncs@|}}|r|dd�|�7}ttj|�}|jg|||d�dS)Nr�r)r�r�rqr�)r$r�r	�_ChoicesPseudoActionrP)r%r(�aliasesrqr�r�Zsupr�r*r+rP6s
�z/_SubParsersAction._ChoicesPseudoAction.__init__r�r*r*r�r+r
4sr
FNc	s<||_||_i|_g|_tt|�j||t|j|||d�dS)N)r�r�r�r�r�rqr�)�_prog_prefix�
_parser_class�_name_parser_map�_choices_actionsr�r	rPr)r%r�rN�parser_classr�r�rqr�r�r*r+rP>s	
�z_SubParsersAction.__init__cKs�|�d�dkr d|j|f|d<|�dd�}d|krX|�d�}|�|||�}|j�|�|jf|�}||j|<|D]}||j|<qr|S)NrNr�rr*rq)r�rr�r
rr r
r)r%r(�kwargsrrqZ
choice_actionr��aliasr*r*r+�
add_parserUs

z_SubParsersAction.add_parsercCs|jSr-)rr1r*r*r+r�lsz!_SubParsersAction._get_subactionscCs�|d}|dd�}|jtk	r,t||j|�z|j|}Wn<tk
rv|d�|j�d�}td�|}t||��YnX|�|d�\}	}t	|	��
�D]\}
}t||
|�q�|r�t	|��tg�t
|t��|�dS)NrrRr)�parser_namer�z5unknown parser %(parser_name)r (choices: %(choices)s))r�rr�r�KeyErrorr$r�r�parse_known_argsr�r0�
setdefault�_UNRECOGNIZED_ARGS_ATTRr�r�)r%r�r�r�r�rr&r[�msgZsubnamespace�keyr)r*r*r+r�os$

�	z_SubParsersAction.__call__)N)rr2r3rr
rrPrr�r�r�r*r*r�r+r	2s�r	c@seZdZddd�ZdS)�
_ExtendActionNcCs2t||jd�}t|�}|�|�t||j|�dSr-)r�r�r6r�r�r�r*r*r+r��s
z_ExtendAction.__call__)N)rr2r3r�r*r*r*r+r�src@s&eZdZd
dd�Zdd�Zdd	�ZdS)r�rr�NcCs||_||_||_||_dSr-)�_mode�_bufsize�	_encoding�_errors)r%�mode�bufsize�encoding�errorsr*r*r+rP�szFileType.__init__c
Cs�|dkr>d|jkrtjSd|jkr(tjStd�|j}t|��zt||j|j|j|j	�WSt
k
r�}z"||d�}td�}t||��W5d}~XYnXdS)N�-r�wzargument "-" with mode %r)�filename�errorz$can't open '%(filename)s': %(error)s)rr�stdinrr�r�r�rrr �OSErrorr)r%�stringr�er[r�r*r*r+r��s

�
zFileType.__call__cCsT|j|jf}d|jfd|jfg}d�dd�|D�dd�|D��}dt|�j|fS)Nr#r$rcSsg|]}|dkrt|��qS)r�)r!)rYr'r*r*r+r\�sz%FileType.__repr__.<locals>.<listcomp>cSs$g|]\}}|dk	rd||f�qS)Nrr*)rY�kwr'r*r*r+r\�s�r)rrrr r$rr)r%r[rZargs_strr*r*r+r,�s�zFileType.__repr__)rr�NN)rr2r3rPr�r,r*r*r*r+r�s
c@s$eZdZdd�Zdd�Zdd�ZdS)r
cKs|D]}t||||�qdSr-)r�)r%rr(r*r*r+rP�szNamespace.__init__cCst|t�stSt|�t|�kSr-)r�r
�NotImplementedr�)r%�otherr*r*r+�__eq__�s
zNamespace.__eq__cCs
||jkSr-)r/)r%rr*r*r+�__contains__�szNamespace.__contains__N)rr2r3rPr0r1r*r*r*r+r
�scs�eZdZ�fdd�Zdd�Zd&dd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd'dd�Zdd�Zd d!�Zd"d#�Zd$d%�Z�ZS)(�_ActionsContainercstt|���||_||_||_||_i|_|�ddt	�|�ddt	�|�ddt
�|�ddt�|�ddt�|�ddt
�|�ddt�|�ddt�|�dd	t�|�dd
t�|�ddt�|�ddt�|��g|_i|_g|_g|_i|_t�d
�|_g|_dS)NruZstoreZstore_const�
store_trueZstore_falser Zappend_constr�rqr�parsersr�z^-\d+$|^-\d*\.\d+$)r�r2rP�description�argument_default�prefix_chars�conflict_handler�_registries�registerr�r�r�r�r�r�r�r�rr	r�_get_handler�_actions�_option_string_actions�_action_groups�_mutually_exclusive_groups�	_defaultsrIrJ�_negative_number_matcher�_has_negative_number_optionals)r%r5r7r6r8r�r*r+rP�s4z_ActionsContainer.__init__cCs|j�|i�}|||<dSr-)r9r)r%�
registry_namer)r��registryr*r*r+r:sz_ActionsContainer.registerNcCs|j|�||�Sr-)r9r�)r%rCr)r�r*r*r+�
_registry_get sz_ActionsContainer._registry_getcKs2|j�|�|jD]}|j|kr||j|_qdSr-)r@�updater<r�r�)r%rrur*r*r+�set_defaults&s

z_ActionsContainer.set_defaultscCs8|jD]"}|j|kr|jdk	r|jSq|j�|d�Sr-)r<r�r�r@r�)r%r�rur*r*r+�get_default/s
z_ActionsContainer.get_defaultcOsD|j}|r&t|�dkrH|dd|krH|r:d|kr:td��|j||�}n|j||�}d|kr�|d}||jkr~|j||d<n|jdk	r�|j|d<|�|�}t|�s�td|f��|f|�}|�	d|j
|j
�}t|�s�td|f��|tkr�td	|f��t|d
��r:z|�
��|d�Wntk
�r8td��YnX|�|�S)NrRrr�z+dest supplied twice for positional argumentr�zunknown action "%s"r�%r is not callablez<%r is a FileType class object, instance of it must be passedrz,length of metavar tuple does not match nargs)r7rnr��_get_positional_kwargs�_get_optional_kwargsr@r6�_pop_action_class�callablerErrr�rr�r��_add_action)r%r[r�charsr�Zaction_classru�	type_funcr*r*r+rw9s:	 




�z_ActionsContainer.add_argumentcOs t|f|�|�}|j�|�|Sr-)�_ArgumentGroupr>r )r%r[rr�r*r*r+�add_argument_grouplsz$_ActionsContainer.add_argument_groupcKst|f|�}|j�|�|Sr-)�_MutuallyExclusiveGroupr?r )r%rr�r*r*r+�add_mutually_exclusive_groupqsz._ActionsContainer.add_mutually_exclusive_groupcCs`|�|�|j�|�||_|jD]}||j|<q"|jD]"}|j�|�r8|js8|j�d�q8|S)NT)	�_check_conflictr<r �	containerr�r=rA�matchrB)r%rur�r*r*r+rNvs


z_ActionsContainer._add_actioncCs|j�|�dSr-)r<�remover�r*r*r+�_remove_action�sz _ActionsContainer._remove_actioncCs�i}|jD].}|j|kr.td�}t||j��|||j<q
i}|jD]D}|j|krn|j|j|j|jd�||j<|jD]}||j||<qtqD|jD]&}|j	|j
d�}|jD]}|||<q�q�|jD]}|�||��
|�q�dS)Nz.cannot merge actions - two groups are named %r)�titler5r8)r�)r>rZr�r�rRr5r8r�r?rTr�r<r�rN)r%rVZtitle_group_mapr�rZ	group_mapru�mutex_groupr*r*r+�_add_container_actions�s0



�

�

z(_ActionsContainer._add_container_actionscKs^d|krtd�}t|��|�d�ttfkr2d|d<|�d�tkrPd|krPd|d<t||gd�S)Nr�z1'required' is an invalid argument for positionalsr�Tr��r�r�)r�r�r�r
rr�)r%r�rrr*r*r+rJ�sz(_ActionsContainer._get_positional_kwargsc	Os�g}g}|D]n}|d|jkr>||jd�}td�}t||��|�|�|d|jkrt|�dkr|d|jkr|�|�q|�dd�}|dkr�|r�|d}n|d}|�|j�}|s�td�}t||��|�dd�}t|||d	�S)
Nr)�optionr7zNinvalid option string %(option)r: must start with a character %(prefix_chars)rrRr�z%dest= is required for options like %rr%r�r])	r7r�r�r rnr��lstrip�replacer�)	r%r[rr�Zlong_option_stringsr�rr�Zdest_option_stringr*r*r+rK�s2�

z&_ActionsContainer._get_optional_kwargscCs|�d|�}|�d||�S)Nru)r�rE)r%rr�rur*r*r+rL�sz#_ActionsContainer._pop_action_classcCsFd|j}zt||�WStk
r@td�}t||j��YnXdS)Nz_handle_conflict_%sz%invalid conflict_resolution value: %r)r8r�r�r�r�)r%Zhandler_func_namerr*r*r+r;�s
z_ActionsContainer._get_handlercCsLg}|jD]&}||jkr
|j|}|�||f�q
|rH|��}|||�dSr-)r�r=r r;)r%ruZconfl_optionalsr�Zconfl_optionalr8r*r*r+rU�s


z!_ActionsContainer._check_conflictcCs6tddt|��}d�dd�|D��}t|||��dS)Nzconflicting option string: %szconflicting option strings: %srcSsg|]\}}|�qSr*r*)rYr�rur*r*r+r\	s�z<_ActionsContainer._handle_conflict_error.<locals>.<listcomp>)rrnr$r)r%ru�conflicting_actionsr�Zconflict_stringr*r*r+�_handle_conflict_errors�
�z(_ActionsContainer._handle_conflict_errorcCs>|D]4\}}|j�|�|j�|d�|js|j�|�qdSr-)r�rXr=r�rVrY)r%rurar�r*r*r+�_handle_conflict_resolves
z*_ActionsContainer._handle_conflict_resolve)N)N)rr2r3rPr:rErGrHrwrRrTrNrYr\rJrKrLr;rUrbrcr�r*r*r�r+r2�s$5
	
3($
		r2cs6eZdZd�fdd�	Z�fdd�Z�fdd�Z�ZS)	rQNcs�|j}|d|j�|d|j�|d|j�tt|�j}|fd|i|��||_g|_|j	|_	|j
|_
|j|_|j|_|j
|_
|j|_dS)Nr8r7r6r5)rr8r7r6r�rQrPrZr�r9r<r=r@rBr?)r%rVrZr5rrFZ
super_initr�r*r+rPs�z_ArgumentGroup.__init__cs tt|��|�}|j�|�|Sr-)r�rQrNr�r r�r�r*r+rN5sz_ArgumentGroup._add_actioncs tt|��|�|j�|�dSr-)r�rQrYr�rXr�r�r*r+rY:sz_ArgumentGroup._remove_action)NN�rr2r3rPrNrYr�r*r*r�r+rQsrQcs.eZdZd�fdd�	Zdd�Zdd�Z�ZS)	rSFcs tt|��|�||_||_dSr-)r�rSrPr��
_container)r%rVr�r�r*r+rPAsz _MutuallyExclusiveGroup.__init__cCs2|jrtd�}t|��|j�|�}|j�|�|S)Nz-mutually exclusive arguments must be optional)r�r�r�rerNr�r )r%rurr*r*r+rNFsz#_MutuallyExclusiveGroup._add_actioncCs|j�|�|j�|�dSr-)rerYr�rXr�r*r*r+rYNsz&_MutuallyExclusiveGroup._remove_action)Frdr*r*r�r+rS?srScs&eZdZddddgeddddddf�fdd�	Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	d@dd�Z
dAdd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�ZdBd%d&�ZdCd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�ZdDd5d6�ZdEd7d8�ZdFd9d:�ZdGd<d=�Zd>d?�Z �Z!S)HrNr%r(Tc
	s"tt|�j}
|
|||	|
d�|dkr6tj�tjd�}||_||_	||_
||_||_||_
||_|j}|td��|_|td��|_d|_dd�}|�dd|�d|kr�dn|d}|j
r�|j|d	|d
ddttd�d
�|D]<}|�|�z
|j}Wntk
�rYq�X|j�|�q�dS)N)r5r7r6r8rzpositional argumentszoptional argumentscSs|Sr-r*)r+r*r*r+�identity�sz)ArgumentParser.__init__.<locals>.identityrr%�hr7rqzshow this help message and exit)rur�rq)r�rrP�_os�path�basenamer�argvrNrh�epilog�formatter_class�fromfile_prefix_chars�add_help�allow_abbrevrRr��_positionals�
_optionals�_subparsersr:rwrr\r@r�rF)r%rNrhr5rl�parentsrmr7rnr6r8rorpZ	superinitZ	add_grouprfZdefault_prefixrW�defaultsr�r*r+rPfsJ�
�

zArgumentParser.__init__cs"ddddddg}�fdd�|D�S)	NrNrhr5rmr8rocsg|]}|t�|�f�qSr*r�r�r1r*r+r\�sz.ArgumentParser._get_kwargs.<locals>.<listcomp>r*r�r*r1r+r"�s�zArgumentParser._get_kwargsc	Ks�|jdk	r|�td��|�dt|��d|ks8d|krht|�dd��}t|�dd��}|�||�|_n|j|_|�d�dkr�|�	�}|�
�}|j}|�|j
||d�|����|d<|�|d�}|fd	gi|��}|j�|�|S)
Nz(cannot have multiple subparser argumentsrrZr5ZsubcommandsrNr]r4r�)rsr(r�rrr�rRrqr�r�_get_positional_actionsr?rlrhr`r{rLrN)	r%rrZr5rVr�rjZ
parsers_classrur*r*r+�add_subparsers�s$
zArgumentParser.add_subparserscCs$|jr|j�|�n|j�|�|Sr-)r�rrrNrqr�r*r*r+rN�szArgumentParser._add_actioncCsdd�|jD�S)NcSsg|]}|jr|�qSr*�r��rYrur*r*r+r\�s�z8ArgumentParser._get_optional_actions.<locals>.<listcomp>�r<r1r*r*r+�_get_optional_actions�s�z$ArgumentParser._get_optional_actionscCsdd�|jD�S)NcSsg|]}|js|�qSr*rxryr*r*r+r\�s�z:ArgumentParser._get_positional_actions.<locals>.<listcomp>rzr1r*r*r+rv�s�z&ArgumentParser._get_positional_actionscCs4|�||�\}}|r0td�}|�|d�|��|S�Nzunrecognized arguments: %sr~)rr�r(r$�r%r[r�rkrr*r*r+�
parse_args�s
zArgumentParser.parse_argscCs|dkrtjdd�}nt|�}|dkr.t�}|jD]4}|jtk	r4t||j�s4|jtk	r4t	||j|j�q4|j
D] }t||�spt	|||j
|�qpz>|�||�\}}t|t�r�|�
t|t��t|t�||fWStk
�rt��d}|�t|��YnXdSrQ)rrkr4r
r<r�rr�r�r�r@�_parse_known_argsrr�r��delattrr�exc_infor(r�)r%r[r�rur��errr*r*r+r�s,







zArgumentParser.parse_known_argscs�	jdk	r�	����i��	jD]R}|j}t|j�D]<\}}��|g�}|�|d|��|�||dd��q2qi�g}t��}	t|	�D]^\}}
|
dkr�|�d�|	D]}
|�d�q�q��	�	|
�}|dkr�d}n|�|<d}|�|�q�d�
|��t��t��d�����	fdd�	������	�fd	d
�}
�	�������	�fdd�}g�d
�
��r`t
��}nd}�
|k�r�t�
fdd��D��}�
|k�r�|�
�}|�
k�r�|�
�qdn|�
�
�k�r҈�
|�}��|�|�
|
�
��
�qd|�
�}���|d��g}�	jD]|}|�k�r|j�r(|�t|��nT|jdk	�rt|jt��rt�|j��r|jt�|j�k�rt�|j�	�||j���q|�r��	�td�d�
|���	jD]X}|j�r�|jD]}|�k�r��q��q�dd�|jD�}td�}�	�|d�
|���q���fS)NrR�--r%�A�Or]cs|��|���||�}||jk	rb��|���|g�D]*}|�kr6td�}t|�}t|||��q6|tk	rx|��||�dS)Nznot allowed with argument %s)r��_get_valuesr�r�r�r�rr)ruZargument_stringsr�Zargument_valuesZconflict_actionrZaction_name)�action_conflictsr��seen_actions�seen_non_default_actionsr%r*r+�take_action@s


z5ArgumentParser._parse_known_args.<locals>.take_actioncs~�|}|\}}}�j}g}|dkr:���|�|dS|dk	�r||d�}�j}|dkr�|d|kr�|�|g|f�|d}	|	|d}|dd�p�d}
�j}||kr�||}|
}ntd�}t|||��nB|dkr�|d}
|g}|�|||f��q\ntd�}t|||��q|d}�|d�}|||�}||}
�||
�}|�|||f��q\q|D]\}}}�|||��q`|
S)NrRr�rzignored explicit argument %r)�_match_argumentr r7r=r�r)�start_index�option_tuplerur��explicit_argZmatch_argumentZ
action_tuples�	arg_countrO�charZnew_explicit_argZ
optionals_mapr�stopr[r�Zselected_patterns)r&�arg_strings_pattern�extras�option_string_indicesr%r�r*r+�consume_optionalUsL



z:ArgumentParser._parse_known_args.<locals>.consume_optionalcsn�j}�|d�}|�|�}t�|�D]*\}}�|||�}||7}�||�q&�t|�d��dd�<|Sr-)�_match_arguments_partial�ziprn)r�Z
match_partialZselected_patternZ
arg_countsrur�r[)r&r�r�r%r�r*r+�consume_positionals�s
z=ArgumentParser._parse_known_args.<locals>.consume_positionalsrr�csg|]}|�kr|�qSr*r*)rYr�)r�r*r+r\�s�z4ArgumentParser._parse_known_args.<locals>.<listcomp>z(the following arguments are required: %srcSsg|]}|jtk	rt|��qSr*)rqrr�ryr*r*r+r\�s
�z#one of the arguments %s is requiredr~)N)rn�_read_args_from_filesr?r�r�rr��iterr �_parse_optionalr$r�rvr@r?r<r�r�r�r�r�r�r�r�r��
_get_valuer(r�)r%r&r�r[r�r�Zmutex_actionZ	conflictsZarg_string_pattern_partsZarg_strings_iter�
arg_stringr��patternr�r�Zmax_option_string_indexZnext_option_string_indexZpositionals_end_indexZstringsZ
stop_indexZrequired_actionsrur�r�rr*)r�r&r�r�r�r�r�r�r�r%r�r�r+rs�





J

�






�
���
�



�z ArgumentParser._parse_known_argsc
Cs�g}|D]�}|r|d|jkr*|�|�qzdt|dd���J}g}|����D]}|�|�D]}|�|�q\qN|�|�}|�|�W5QRXWqtk
r�t	�
�d}|�t|��YqXq|Sr�)
rnr r��readr��convert_arg_line_to_argsr�r�r*rr�r(r�)r%r&Znew_arg_stringsr�Z	args_file�arg_liner'r�r*r*r+r�s 
z$ArgumentParser._read_args_from_filescCs|gSr-r*)r%r�r*r*r+r�!sz'ArgumentParser.convert_arg_line_to_argscCsz|�|�}t�||�}|dkrldtd�ttd�ttd�i}|�|j�}|dkrbtdd|j�|j}t	||��t
|�d��S)Nzexpected one argumentzexpected at most one argumentzexpected at least one argumentzexpected %s argumentzexpected %s argumentsrR)�_get_nargs_patternrIrWr�r
rr�r�rrrnr�)r%rur��
nargs_patternrWZnargs_errorsrr*r*r+r�$s(
���
zArgumentParser._match_argumentcsrg}tt|�dd�D]X}|d|�}d��fdd�|D��}t�||�}|dk	r|�dd�|��D��qnq|S)Nrr�r]csg|]}��|��qSr*)r�ryr1r*r+r\@s�z;ArgumentParser._match_arguments_partial.<locals>.<listcomp>cSsg|]}t|��qSr*rm)rYr+r*r*r+r\Ds)r�rnr$rIrWr�rj)r%rir�r�r�Z
actions_slicer�rWr*r1r+r�:s�z'ArgumentParser._match_arguments_partialc
Cs|sdS|d|jkrdS||jkr8|j|}||dfSt|�dkrHdSd|kr~|�dd�\}}||jkr~|j|}|||fS|�|�}t|�dkr�d�dd�|D��}||d�}td�}|�||�nt|�dkr�|\}	|	S|j�	|�r�|j
s�dSd	|k�rdSd|dfS)
NrrR�=rcSsg|]\}}}|�qSr*r*)rYrur�r�r*r*r+r\is�z2ArgumentParser._parse_optional.<locals>.<listcomp>)r^Zmatchesz4ambiguous option: %(option)s could match %(matches)sr~)r7r=rn�split�_get_option_tuplesr$r�r(rArWrB)
r%r�rur�r�Z
option_tuplesZoptionsr[rr�r*r*r+r�Js>







�

zArgumentParser._parse_optionalc
Cs0g}|j}|d|kr�|d|kr�|jr~d|krB|�dd�\}}n|}d}|jD],}|�|�rP|j|}|||f}|�|�qPn�|d|k�r|d|k�r|}d}|dd�}|dd�}	|jD]T}||kr�|j|}|||	f}|�|�q�|�|�r�|j|}|||f}|�|�q�n|�td�|�|S)NrrRr�r7zunexpected option string: %s)r7rpr�r=�
startswithr r(r�)
r%r�r�rOZ
option_prefixr�rur�Zshort_option_prefixZshort_explicit_argr*r*r+r��s:









z!ArgumentParser._get_option_tuplescCs�|j}|dkrd}nf|tkr"d}nX|tkr0d}nJ|tkr>d}n<|tkrLd}n.|tkrZd}n |tkrhd}ndd	�d
|�}|jr�|�	d	d�}|�	dd�}|S)
Nz(-*A-*)z(-*A?-*)z	(-*[A-]*)z
(-*A[A-]*)z([-AO]*)z(-*A[-AO]*)z(-*-*)z(-*%s-*)z-*r�r]r%)
r�r
rrrrrr$r�r`)r%rur�r�r*r*r+r��s(z!ArgumentParser._get_nargs_patterncCs4|�||�\}}|r0td�}|�|d�|��|Sr|)�parse_known_intermixed_argsr�r(r$r}r*r*r+�parse_intermixed_args�s
z$ArgumentParser.parse_intermixed_argsc	s�|���dd��D�}|r,td|dj���fdd�|jD�rHtd���zN|j}z�|jdkrp|��dd�|_�D] }|j|_t	|_|j|_t	|_qt|�
||�\}}�D]J}t||j�r�t
||j�gkr�ddlm}|d	|j|f�t||j�q�W5�D]}|j|_|j|_q�X|��}zJ|D]}|j|_d
|_�q$|jD]}	|	j|	_d
|	_�q@|�
||�\}}
W5|D]}|j|_�qn|jD]}	|	j|	_�q�XW5||_X||
fS)NcSsg|]}|jttfkr|�qSr*)r�rrryr*r*r+r\�s�z>ArgumentParser.parse_known_intermixed_args.<locals>.<listcomp>z3parse_intermixed_args: positional arg with nargs=%srcs&g|]}|jD]}|�kr|j�qqSr*)r�r�)rYr�ru�r�r*r+r\�s
�z;parse_intermixed_args: positional in mutuallyExclusiveGroup�)�warnzDo not expect %s in %sF)rvr�r�r?rhZ
save_nargsZsave_defaultr��format_usagerrr�r�r��warningsr�r�r{Z
save_requiredr�)r%r[r��aZ
save_usageruZremaining_argsr�r�r�r�r*r�r+r��s`
�
��


�
z*ArgumentParser.parse_known_intermixed_argscs��jttfkr2z|�d�Wntk
r0YnX|sz�jtkrz�jrN�j}n�j}t	|t
�rv���|�}���|��n|s��jt
kr��js��jdk	r��j}n|}���|�n�t|�dkr�jdtfkr�|\}���|�}���|�n��jtk�r��fdd�|D�}np�jtk�r@��fdd�|D�}���|d�n>�jtk�rRt}n,��fdd�|D�}|D]}���|��qj|S)Nr�rRcsg|]}���|��qSr*�r��rY�v�rur%r*r+r\Z	sz.ArgumentParser._get_values.<locals>.<listcomp>csg|]}���|��qSr*r�r�r�r*r+r\^	srcsg|]}���|��qSr*r�r�r�r*r+r\g	s)r�rrrXr�r
r�r�r�r�r�r��_check_valuerrnr)r%rur&r)r�r�r*r�r+r�6	sD
�
zArgumentParser._get_valuesc	Cs�|�d|j|j�}t|�s0td�}t|||��z||�}Wn�tk
r~t|jdt|j��}tt	�
�d�}t||��YnLttfk
r�t|jdt|j��}||d�}td�}t|||��YnX|S)NrrIrrR)rr)z!invalid %(type)s value: %(value)r)
rErrMr�rrr�r!r�rr�r�r�)r%rur�rPrr�r(r[r*r*r+r�n	s 
zArgumentParser._get_valuecCsF|jdk	rB||jkrB|d�tt|j��d�}td�}t|||��dS)Nr)r)r�z3invalid choice: %(value)r (choose from %(choices)s))r�r$�mapr!r�r)r%rur)r[rr*r*r+r��	s�zArgumentParser._check_valuecCs$|��}|�|j|j|j�|��Sr-)rrlrhr<r?r`)r%rVr*r*r+r��	s
�zArgumentParser.format_usagecCst|��}|�|j|j|j�|�|j�|jD]0}|�|j	�|�|j�|�
|j�|��q.|�|j
�|��Sr-)rrlrhr<r?rfr5r>rbrZrxr�rcrlr`)r%rVZaction_groupr*r*r+r`�	s�

zArgumentParser.format_helpcCs|j|jd�S)Nr})rmrNr1r*r*r+r�	szArgumentParser._get_formattercCs"|dkrtj}|�|��|�dSr-)rrrr��r%�filer*r*r+�print_usage�	szArgumentParser.print_usagecCs"|dkrtj}|�|��|�dSr-)rrrr`r�r*r*r+r�	szArgumentParser.print_helpcCs |r|dkrtj}|�|�dSr-)r�stderr�write)r%r�r�r*r*r+r�	szArgumentParser._print_messagercCs |r|�|tj�t�|�dSr-)rrr�r)r%Zstatusr�r*r*r+r�	szArgumentParser.exitcCs0|�tj�|j|d�}|�dtd�|�dS)N)rNr�r7z%(prog)s: error: %(message)s
)r�rr�rNrr�)r%r�r[r*r*r+r(�	s	zArgumentParser.error)NN)NN)NN)NN)N)N)N)rN)"rr2r3rrPr"rwrNr{rvr~rrr�r�r�r�r�r�r�r�r�r�r�r�r�r`rr�rrrr(r�r*r*r�r+rSsT�@

#w:-1

M8


	
)2�__version__�__all__�osrh�rerIZshutilr:�sysrrr�rrr
rrrrrr�rr6rrrrr	r��	Exceptionrrrr�r�r�r�r�r�r�r�rr	rrr
r2rQrSrr*r*r*r+�<module>As~�z
	[#&]7:"argparse.cpython-38.pyc000064400000171507150335716500011020 0ustar00U

e5dw�@s0dZdZdddddddd	d
ddd
dddddgZddlZddlZddlZddl	Z
ddlmZm
Z
dZdZdZdZdZdZdZGdd�de�Zdd �ZGd!d�de�ZGd"d�de�ZGd#d	�d	e�ZGd$d�de�ZGd%d
�d
e�Zd&d'�ZGd(d�de�ZGd)d�de�Z Gd*d�de�Z!Gd+d,�d,e!�Z"Gd-d.�d.e!�Z#Gd/d0�d0e#�Z$Gd1d2�d2e#�Z%Gd3d4�d4e!�Z&Gd5d6�d6e!�Z'Gd7d8�d8e!�Z(Gd9d:�d:e!�Z)Gd;d<�d<e!�Z*Gd=d>�d>e!�Z+Gd?d@�d@e&�Z,GdAd�de�Z-GdBd�de�Z.GdCdD�dDe�Z/GdEdF�dFe/�Z0GdGdH�dHe0�Z1GdId�dee/�Z2dS)Ja�
Command-line parsing library

This module is an optparse-inspired command-line parsing library that:

    - handles both optional and positional arguments
    - produces highly informative usage messages
    - supports parsers that dispatch to sub-parsers

The following is a simple usage example that sums integers from the
command-line and writes the result to a file::

    parser = argparse.ArgumentParser(
        description='sum the integers at the command line')
    parser.add_argument(
        'integers', metavar='int', nargs='+', type=int,
        help='an integer to be summed')
    parser.add_argument(
        '--log', default=sys.stdout, type=argparse.FileType('w'),
        help='the file where the sum should be written')
    args = parser.parse_args()
    args.log.write('%s' % sum(args.integers))
    args.log.close()

The module contains the following public classes:

    - ArgumentParser -- The main entry point for command-line parsing. As the
        example above shows, the add_argument() method is used to populate
        the parser with actions for optional and positional arguments. Then
        the parse_args() method is invoked to convert the args at the
        command-line into an object with attributes.

    - ArgumentError -- The exception raised by ArgumentParser objects when
        there are errors with the parser's actions. Errors raised while
        parsing the command-line are caught by ArgumentParser and emitted
        as command-line messages.

    - FileType -- A factory for defining types of files to be created. As the
        example above shows, instances of FileType are typically passed as
        the type= argument of add_argument() calls.

    - Action -- The base class for parser actions. Typically actions are
        selected by passing strings like 'store_true' or 'append_const' to
        the action= argument of add_argument(). However, for greater
        customization of ArgumentParser actions, subclasses of Action may
        be defined and passed as the action= argument.

    - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter,
        ArgumentDefaultsHelpFormatter -- Formatter classes which
        may be passed as the formatter_class= argument to the
        ArgumentParser constructor. HelpFormatter is the default,
        RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser
        not to change the formatting for help text, and
        ArgumentDefaultsHelpFormatter adds information about argument defaults
        to the help.

All other classes in this module are considered implementation details.
(Also note that HelpFormatter and RawDescriptionHelpFormatter are only
considered public as object names -- the API of the formatter objects is
still considered an implementation detail.)
z1.1�ArgumentParser�
ArgumentError�ArgumentTypeError�FileType�
HelpFormatter�ArgumentDefaultsHelpFormatter�RawDescriptionHelpFormatter�RawTextHelpFormatter�MetavarTypeHelpFormatter�	Namespace�Action�ONE_OR_MORE�OPTIONAL�PARSER�	REMAINDER�SUPPRESS�ZERO_OR_MORE�N)�gettext�ngettextz==SUPPRESS==�?�*�+zA...�...Z_unrecognized_argsc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_AttributeHolderaAbstract base class that provides __repr__.

    The __repr__ method returns a string in the format::
        ClassName(attr=name, attr=name, ...)
    The attributes are determined either by a class-level attribute,
    '_kwarg_names', or by inspecting the instance __dict__.
    cCs�t|�j}g}i}|��D]}|�t|��q|��D],\}}|��rZ|�d||f�q6|||<q6|rz|�dt|��d|d�|�fS)N�%s=%rz**%s�%s(%s)�, )�type�__name__�	_get_args�append�repr�_get_kwargs�isidentifier�join)�selfZ	type_name�arg_stringsZ	star_args�arg�name�value�r*� /usr/lib64/python3.8/argparse.py�__repr__ts

z_AttributeHolder.__repr__cCst|j���S�N)�sorted�__dict__�items�r%r*r*r+r"�sz_AttributeHolder._get_kwargscCsgSr-r*r1r*r*r+r�sz_AttributeHolder._get_argsN)r�
__module__�__qualname__�__doc__r,r"rr*r*r*r+rksrcCs6|dkrgSt|�tkr$|dd�Sddl}|�|�S)Nr)r�list�copy)r0r6r*r*r+�_copy_items�sr7c@s�eZdZdZd;dd�Zdd�Zd	d
�ZGdd�de�Zd
d�Z	dd�Z
dd�Zdd�Zd<dd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�ZdS)=rz�Formatter for generating usage messages and argument help strings.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    ��NcCs�|dkrt��j}|d8}||_||_t|t|d|d��|_||_d|_	d|_
d|_|�|d�|_
|j
|_t�dtj�|_t�d�|_dS)Nr8�rz\s+z\n\n\n+)�_shutil�get_terminal_size�columns�_prog�_indent_increment�min�max�_max_help_position�_width�_current_indent�_level�_action_max_length�_Section�
_root_section�_current_section�_re�compile�ASCII�_whitespace_matcher�_long_break_matcher)r%�progZindent_incrementZmax_help_position�widthr*r*r+�__init__�s 
�zHelpFormatter.__init__cCs"|j|j7_|jd7_dS�N�)rDr?rEr1r*r*r+�_indent�szHelpFormatter._indentcCs4|j|j8_|jdks"td��|jd8_dS)NrzIndent decreased below 0.rS)rDr?�AssertionErrorrEr1r*r*r+�_dedent�szHelpFormatter._dedentc@seZdZddd�Zdd�ZdS)zHelpFormatter._SectionNcCs||_||_||_g|_dSr-)�	formatter�parent�headingr0)r%rWrXrYr*r*r+rQ�szHelpFormatter._Section.__init__cCs�|jdk	r|j��|jj}|dd�|jD��}|jdk	rD|j��|sLdS|jtk	rz|jdk	rz|jj}d|d|jf}nd}|d||dg�S)NcSsg|]\}}||��qSr*r*)�.0�func�argsr*r*r+�
<listcomp>�sz6HelpFormatter._Section.format_help.<locals>.<listcomp>�z%*s%s:
�
)	rXrWrT�_join_partsr0rVrYrrD)r%r$Z	item_helpZcurrent_indentrYr*r*r+�format_help�s



z"HelpFormatter._Section.format_help)N)rr2r3rQrar*r*r*r+rG�s
rGcCs|jj�||f�dSr-)rIr0r )r%r[r\r*r*r+�	_add_item�szHelpFormatter._add_itemcCs0|��|�||j|�}|�|jg�||_dSr-)rTrGrIrbra)r%rYZsectionr*r*r+�
start_section�szHelpFormatter.start_sectioncCs|jj|_|��dSr-)rIrXrVr1r*r*r+�end_section�s
zHelpFormatter.end_sectioncCs$|tk	r |dk	r |�|j|g�dSr-)rrb�_format_text)r%�textr*r*r+�add_text�szHelpFormatter.add_textcCs&|tk	r"||||f}|�|j|�dSr-)rrb�
_format_usage)r%�usage�actions�groups�prefixr\r*r*r+�	add_usage�szHelpFormatter.add_usagecCsv|jtk	rr|j}||�g}|�|�D]}|�||��q$tdd�|D��}||j}t|j|�|_|�|j	|g�dS)NcSsg|]}t|��qSr*��len�rZ�sr*r*r+r]
sz.HelpFormatter.add_argument.<locals>.<listcomp>)
�helpr�_format_action_invocation�_iter_indented_subactionsr rArDrFrb�_format_action)r%�actionZget_invocationZinvocations�	subactionZinvocation_lengthZ
action_lengthr*r*r+�add_arguments


�zHelpFormatter.add_argumentcCs|D]}|�|�qdSr-)rx)r%rjrvr*r*r+�
add_argumentsszHelpFormatter.add_argumentscCs.|j��}|r*|j�d|�}|�d�d}|S)N�

r_)rHrarN�sub�strip)r%rrr*r*r+ras

zHelpFormatter.format_helpcCsd�dd�|D��S)Nr^cSsg|]}|r|tk	r|�qSr*)r)rZ�partr*r*r+r]!s�z-HelpFormatter._join_parts.<locals>.<listcomp>)r$)r%Zpart_stringsr*r*r+r` s
�zHelpFormatter._join_partscs6|dkrtd�}|dk	r,|t|jd�}�n�|dkrL|sLdt|jd�}�n�|dk�r*dt|jd�}g}g}|D] }|jr�|�|�qr|�|�qr|j}	|	|||�}
d�dd�||
fD��}|j|j�t	|�t	|��k�r*d}|	||�}|	||�}
t
�||�}t
�||
�}d�|�|k�s&t�d�|�|
k�s:t�d�fdd	�	}t	|�t	|�d
�k�r�dt	|�t	|�d}|�r�||g|||�}|�
|||��n |�r�||g|||�}n|g}nZdt	|�}||}|||�}t	|�dk�rg}|�
|||��|�
|||��|g|}d�|�}d
||fS)Nzusage: �rOz%(prog)s� cSsg|]}|r|�qSr*r*rpr*r*r+r]Asz/HelpFormatter._format_usage.<locals>.<listcomp>z%\(.*?\)+(?=\s|$)|\[.*?\]+(?=\s|$)|\S+cs�g}g}|dk	rt|�d}nt|�d}|D]Z}|dt|��krn|rn|�|d�|��g}t|�d}|�|�|t|�d7}q.|r�|�|d�|��|dk	r�|dt|�d�|d<|S)NrSrr)ror r$)�parts�indentrl�lines�lineZline_lenr}��
text_widthr*r+�	get_linesUs"
z.HelpFormatter._format_usage.<locals>.get_linesg�?rSr_z%s%s

)N)�_�dictr>�option_stringsr �_format_actions_usager$rCrDrorJ�findallrU�extend)r%rirjrkrlrO�	optionals�positionalsrv�formatZaction_usageZpart_regexpZ	opt_usageZ	pos_usageZ	opt_partsZ	pos_partsr�r�r�r�r*r�r+rh%s\
�




zHelpFormatter._format_usagec	Cs�t�}i}|D�]}z|�|jd�}Wntk
r@YqYqX|t|j�}|||�|jkr|jD]}|�|�qh|js�||kr�||d7<nd||<||kr�||d7<nd||<nF||kr�||d7<nd||<||k�r||d7<nd||<t|d|�D]}	d	||	<�qqg}
t|�D�]"\}	}|j	t
k�r�|
�d�|�|	�d	k�rr|�
|	�n"|�|	d�d	k�rX|�
|	d�n�|j�s�|�|�}|�||�}||k�r�|ddk�r�|d
dk�r�|dd
�}|
�|�nf|jd}
|jdk�rd|
}n"|�|�}|�||�}d|
|f}|j�sN||k�rNd
|}|
�|��q6t|dd�D]}	||	g|
|	|	�<�qhd�dd�|
D��}d}d}t�d|d|�}t�d|d|�}t�d||fd|�}t�dd|�}|��}|S)Nrz [�[�]z (�(�)rS�|����%s�%s %s�[%s]T)�reversercSsg|]}|dk	r|�qSr-r*)rZ�itemr*r*r+r]�sz7HelpFormatter._format_actions_usage.<locals>.<listcomp>z[\[(]z[\])]z(%s) z\1� (%s)z%s *%sr^z\(([^|]*)\))�set�index�_group_actions�
ValueErrorro�add�required�range�	enumeraterrrr �get�popr��#_get_default_metavar_for_positional�_format_args�nargs�!_get_default_metavar_for_optionalr.r$rJr{r|)r%rjrk�
group_actionsZinserts�group�start�endrv�ir��defaultr}�
option_string�args_stringrf�open�closer*r*r+r��sz










z#HelpFormatter._format_actions_usagecCsFd|kr|t|jd�}t|j|jd�}d|j}|�|||�dS)Nz%(prog)r~�rrz)r�r>rArCrD�
_fill_text)r%rfr�r�r*r*r+re�s

zHelpFormatter._format_textc
Cs:t|jd|j�}t|j|d�}||jd}|�|�}|jsV|jd|f}d|}n@t|�|kr~|jd||f}d|}d}n|jd|f}d|}|}|g}|jr�|�	|�}	|�
|	|�}
|�d|d|
df�|
dd�D]}|�d|d|f�q�n|�d��s|�d�|�
|�D]}|�|�|���q|�|�S)	Nr8r�r^z%*s%s
z	%*s%-*s  rrSr_)r@rFrBrArCrDrsrrro�_expand_help�_split_linesr �endswithrtrur`)
r%rvZ
help_positionZ
help_widthZaction_widthZ
action_header�tupZindent_firstr�Z	help_textZ
help_linesr�rwr*r*r+ru�s8
�



zHelpFormatter._format_actioncCs�|js&|�|�}|�||�d�\}|Sg}|jdkrB|�|j�n4|�|�}|�||�}|jD]}|�d||f�q^d�|�SdS)NrSrr�r)	r�r��_metavar_formatterr�r�r�r�r r$)r%rvr��metavarr�r�r�r*r*r+rs"s



z'HelpFormatter._format_action_invocationcsP|jdk	r|j�n.|jdk	r<dd�|jD�}dd�|��n|��fdd�}|S)NcSsg|]}t|��qSr*��str)rZZchoicer*r*r+r]>sz4HelpFormatter._metavar_formatter.<locals>.<listcomp>z{%s}�,cst�t�r�S�f|SdSr-)�
isinstance�tuple)Z
tuple_size��resultr*r+r�Cs
z0HelpFormatter._metavar_formatter.<locals>.format)r��choicesr$)r%rv�default_metavarZchoice_strsr�r*r�r+r�:s

z HelpFormatter._metavar_formattercCs�|�||�}|jdkr$d|d�}n�|jtkr<d|d�}n�|jtkrTd|d�}n�|jtkrld|d�}n�|jtkr|d}nt|jtkr�d|d�}n\|jtkr�d	}nLzd
d�t|j�D�}Wnt	k
r�t
d�d�YnXd
�|�||j�}|S)Nr�rSr�z
[%s [%s ...]]r8z%s [%s ...]rz%s ...r^cSsg|]}d�qS)r�r*)rZr�r*r*r+r]\sz.HelpFormatter._format_args.<locals>.<listcomp>zinvalid nargs valuer)r�r�r
rrrrrr��	TypeErrorr�r$)r%rvr�Zget_metavarr�Zformatsr*r*r+r�Js*






zHelpFormatter._format_argscCs�tt|�|jd�}t|�D]}||tkr||=qt|�D] }t||d�r:||j||<q:|�d�dk	r�d�dd�|dD��}||d<|�	|�|S)Nr~rr�rcSsg|]}t|��qSr*r�)rZ�cr*r*r+r]ksz.HelpFormatter._expand_help.<locals>.<listcomp>)
r��varsr>r5r�hasattrrr�r$�_get_help_string)r%rvZparamsr(Zchoices_strr*r*r+r�bszHelpFormatter._expand_helpccs@z
|j}Wntk
rYnX|��|�EdH|��dSr-)�_get_subactions�AttributeErrorrTrV)r%rvZget_subactionsr*r*r+rtos
z'HelpFormatter._iter_indented_subactionscCs&|j�d|���}ddl}|�||�S)Nrr)rMr{r|�textwrapZwrap)r%rfrPr�r*r*r+r�yszHelpFormatter._split_linescCs,|j�d|���}ddl}|j||||d�S)Nrr)Zinitial_indentZsubsequent_indent)rMr{r|r�Zfill)r%rfrPr�r�r*r*r+r��s�zHelpFormatter._fill_textcCs|jSr-)rr�r%rvr*r*r+r��szHelpFormatter._get_help_stringcCs
|j��Sr-)�dest�upperr�r*r*r+r��sz/HelpFormatter._get_default_metavar_for_optionalcCs|jSr-)r�r�r*r*r+r��sz1HelpFormatter._get_default_metavar_for_positional)r8r9N)N) rr2r3r4rQrTrV�objectrGrbrcrdrgrmrxryrar`rhr�rerursr�r�r�rtr�r�r�r�r�r*r*r*r+r�s>�

`g/

c@seZdZdZdd�ZdS)rz�Help message formatter which retains any formatting in descriptions.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cs d��fdd�|jdd�D��S)Nr^c3s|]}�|VqdSr-r*)rZr��r�r*r+�	<genexpr>�sz9RawDescriptionHelpFormatter._fill_text.<locals>.<genexpr>T)�keepends)r$�
splitlines)r%rfrPr�r*r�r+r��sz&RawDescriptionHelpFormatter._fill_textN)rr2r3r4r�r*r*r*r+r�sc@seZdZdZdd�ZdS)rz�Help message formatter which retains formatting of all help text.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCs|��Sr-)r�)r%rfrPr*r*r+r��sz!RawTextHelpFormatter._split_linesN)rr2r3r4r�r*r*r*r+r�sc@seZdZdZdd�ZdS)rz�Help message formatter which adds default values to argument help.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCs>|j}d|jkr:|jtk	r:ttg}|js2|j|kr:|d7}|S)Nz
%(default)z (default: %(default)s))rrr�rr
rr�r�)r%rvrrZdefaulting_nargsr*r*r+r��s

z.ArgumentDefaultsHelpFormatter._get_help_stringN)rr2r3r4r�r*r*r*r+r�sc@s eZdZdZdd�Zdd�ZdS)r	aHelp message formatter which uses the argument 'type' as the default
    metavar value (instead of the argument 'dest')

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCs|jjSr-�rrr�r*r*r+r��sz:MetavarTypeHelpFormatter._get_default_metavar_for_optionalcCs|jjSr-r�r�r*r*r+r��sz<MetavarTypeHelpFormatter._get_default_metavar_for_positionalN)rr2r3r4r�r�r*r*r*r+r	�scCsN|dkrdS|jrd�|j�S|jdtfkr2|jS|jdtfkrF|jSdSdS)N�/)r�r$r�rr�)�argumentr*r*r+�_get_action_name�sr�c@s eZdZdZdd�Zdd�ZdS)rz�An error from creating or using an argument (optional or positional).

    The string value of this exception is the message, augmented with
    information about the argument that caused it.
    cCst|�|_||_dSr-)r��
argument_name�message)r%r�r�r*r*r+rQ�s
zArgumentError.__init__cCs(|jdkrd}nd}|t|j|jd�S)Nz%(message)sz'argument %(argument_name)s: %(message)s)r�r�)r�r�r�)r%r�r*r*r+�__str__�s
�zArgumentError.__str__N)rr2r3r4rQr�r*r*r*r+r�sc@seZdZdZdS)rz@An error from trying to convert a command line string to a type.N)rr2r3r4r*r*r*r+r�sc@s,eZdZdZd
dd�Zdd�Zddd	�ZdS)ra\	Information about how to convert command line strings to Python objects.

    Action objects are used by an ArgumentParser to represent the information
    needed to parse a single argument from one or more strings from the
    command line. The keyword arguments to the Action constructor are also
    all attributes of Action instances.

    Keyword Arguments:

        - option_strings -- A list of command-line option strings which
            should be associated with this action.

        - dest -- The name of the attribute to hold the created object(s)

        - nargs -- The number of command-line arguments that should be
            consumed. By default, one argument will be consumed and a single
            value will be produced.  Other values include:
                - N (an integer) consumes N arguments (and produces a list)
                - '?' consumes zero or one arguments
                - '*' consumes zero or more arguments (and produces a list)
                - '+' consumes one or more arguments (and produces a list)
            Note that the difference between the default and nargs=1 is that
            with the default, a single value will be produced, while with
            nargs=1, a list containing a single value will be produced.

        - const -- The value to be produced if the option is specified and the
            option uses an action that takes no values.

        - default -- The value to be produced if the option is not specified.

        - type -- A callable that accepts a single string argument, and
            returns the converted value.  The standard Python types str, int,
            float, and complex are useful examples of such callables.  If None,
            str is used.

        - choices -- A container of values that should be allowed. If not None,
            after a command-line argument has been converted to the appropriate
            type, an exception will be raised if it is not a member of this
            collection.

        - required -- True if the action must always be specified at the
            command line. This is only meaningful for optional command-line
            arguments.

        - help -- The help string describing the argument.

        - metavar -- The name to be used for the option's argument with the
            help string. If None, the 'dest' value will be used as the name.
    NFcCs@||_||_||_||_||_||_||_||_|	|_|
|_	dSr-�
r�r�r��constr�rr�r�rrr��r%r�r�r�r�r�rr�r�rrr�r*r*r+rQ)szAction.__init__c	s(ddddddddd	g	}�fd
d�|D�S)Nr�r�r�r�r�rr�rrr�csg|]}|t�|�f�qSr*��getattr�rZr(r1r*r+r]Ksz&Action._get_kwargs.<locals>.<listcomp>r*�r%�namesr*r1r+r"?s�zAction._get_kwargscCsttd���dS)Nz.__call__() not defined)�NotImplementedErrorr��r%�parser�	namespace�valuesr�r*r*r+�__call__MszAction.__call__)NNNNNFNN)N)rr2r3r4rQr"r�r*r*r*r+r�s5�
cs(eZdZd�fdd�	Zddd�Z�ZS)	�_StoreActionNFcsT|dkrtd��|dk	r,|tkr,tdt��tt|�j|||||||||	|
d�
dS)Nrz�nargs for store actions must be != 0; if you have nothing to store, actions such as store true or store const may be more appropriate� nargs must be %r to supply constr�)r�r
�superr�rQr���	__class__r*r+rQSs 
�z_StoreAction.__init__cCst||j|�dSr-)�setattrr�r�r*r*r+r�psz_StoreAction.__call__)NNNNNFNN)N�rr2r3rQr��
__classcell__r*r*r�r+r�Qs�r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_StoreConstActionNFc	s"tt|�j||d||||d�dS)Nr)r�r�r�r�r�r�rr)r�r�rQ�r%r�r�r�r�r�rrr�r�r*r+rQvs
�z_StoreConstAction.__init__cCst||j|j�dSr-)r�r�r�r�r*r*r+r��sz_StoreConstAction.__call__)NFNN)Nr�r*r*r�r+r�ts�r�cseZdZd�fdd�	Z�ZS)�_StoreTrueActionFNcs tt|�j||d|||d�dS)NT�r�r�r�r�r�rr)r�r�rQ�r%r�r�r�r�rrr�r*r+rQ�s
�z_StoreTrueAction.__init__)FFN�rr2r3rQr�r*r*r�r+r��s�r�cseZdZd�fdd�	Z�ZS)�_StoreFalseActionTFNcs tt|�j||d|||d�dS)NFr�)r�r�rQr�r�r*r+rQ�s
�z_StoreFalseAction.__init__)TFNr�r*r*r�r+r��s�r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�
_AppendActionNFcsT|dkrtd��|dk	r,|tkr,tdt��tt|�j|||||||||	|
d�
dS)Nrz�nargs for append actions must be != 0; if arg strings are not supplying the value to append, the append const action may be more appropriater�r�)r�r
r�r�rQr�r�r*r+rQ�s 
�z_AppendAction.__init__cCs2t||jd�}t|�}|�|�t||j|�dSr-)r�r�r7r r��r%r�r�r�r�r0r*r*r+r��s
z_AppendAction.__call__)NNNNNFNN)Nr�r*r*r�r+r��s�r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_AppendConstActionNFc
s$tt|�j||d|||||d�dS)Nr)r�r�r�r�r�r�rrr�)r�r�rQr�r�r*r+rQ�s
�z_AppendConstAction.__init__cCs4t||jd�}t|�}|�|j�t||j|�dSr-)r�r�r7r r�r�r�r*r*r+r��sz_AppendConstAction.__call__)NFNN)Nr�r*r*r�r+r��s�r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_CountActionNFcs tt|�j||d|||d�dS)Nr)r�r�r�r�r�rr)r�r�rQr�r�r*r+rQ�s
�z_CountAction.__init__cCs0t||jd�}|dkrd}t||j|d�dS�NrrS)r�r�r�)r%r�r�r�r��countr*r*r+r��sz_CountAction.__call__)NFN)Nr�r*r*r�r+r��s
�r�cs.eZdZeedf�fdd�	Zddd�Z�ZS)�_HelpActionNcstt|�j|||d|d�dS�Nr)r�r�r�r�rr)r�r�rQ)r%r�r�r�rrr�r*r+rQs
�z_HelpAction.__init__cCs|��|��dSr-)�
print_help�exitr�r*r*r+r�sz_HelpAction.__call__)N�rr2r3rrQr�r�r*r*r�r+r�s
�r�cs0eZdZdeedf�fdd�	Zddd�Z�ZS)�_VersionActionNz&show program's version number and exitcs$tt|�j|||d|d�||_dSr)r�rrQ�version)r%r�rr�r�rrr�r*r+rQs
�z_VersionAction.__init__cCsD|j}|dkr|j}|��}|�|�|�|��tj�|��dSr-)r�_get_formatterrg�_print_messagera�_sys�stdoutr)r%r�r�r�r�rrWr*r*r+r�(s
z_VersionAction.__call__)Nrr*r*r�r+rs�rcsPeZdZGdd�de�Zedddf�fdd�	Zdd�Zd	d
�Zd
dd�Z	�Z
S)�_SubParsersActioncseZdZ�fdd�Z�ZS)z&_SubParsersAction._ChoicesPseudoActioncs@|}}|r|dd�|�7}ttj|�}|jg|||d�dS)Nr�r)r�r�rrr�)r$r�r
�_ChoicesPseudoActionrQ)r%r(�aliasesrrr�r�Zsupr�r*r+rQ6s
�z/_SubParsersAction._ChoicesPseudoAction.__init__r�r*r*r�r+r4srFNc	s<||_||_i|_g|_tt|�j||t|j|||d�dS)N)r�r�r�r�r�rrr�)�_prog_prefix�
_parser_class�_name_parser_map�_choices_actionsr�r
rQr)r%r�rO�parser_classr�r�rrr�r�r*r+rQ>s	
�z_SubParsersAction.__init__cKs�|�d�dkr d|j|f|d<|�dd�}d|krX|�d�}|�|||�}|j�|�|jf|�}||j|<|D]}||j|<qr|S)NrOr�rr*rr)r�r
r�rrr rr)r%r(�kwargsrrrZ
choice_actionr��aliasr*r*r+�
add_parserUs

z_SubParsersAction.add_parsercCs|jSr-)rr1r*r*r+r�lsz!_SubParsersAction._get_subactionscCs�|d}|dd�}|jtk	r,t||j|�z|j|}Wn<tk
rv|d�|j�d�}td�|}t||��YnX|�|d�\}	}t	|	��
�D]\}
}t||
|�q�|r�t	|��tg�t
|t��|�dS)NrrSr)�parser_namer�z5unknown parser %(parser_name)r (choices: %(choices)s))r�rr�r�KeyErrorr$r�r�parse_known_argsr�r0�
setdefault�_UNRECOGNIZED_ARGS_ATTRr�r�)r%r�r�r�r�rr&r\�msgZsubnamespace�keyr)r*r*r+r�os$

�	z_SubParsersAction.__call__)N)rr2r3rrrrQrr�r�r�r*r*r�r+r
2s�r
c@seZdZddd�ZdS)�
_ExtendActionNcCs2t||jd�}t|�}|�|�t||j|�dSr-)r�r�r7r�r�r�r*r*r+r��s
z_ExtendAction.__call__)N)rr2r3r�r*r*r*r+r�src@s*eZdZdZddd�Zdd�Zd	d
�ZdS)ra�Factory for creating file object types

    Instances of FileType are typically passed as type= arguments to the
    ArgumentParser add_argument() method.

    Keyword Arguments:
        - mode -- A string indicating how the file is to be opened. Accepts the
            same values as the builtin open() function.
        - bufsize -- The file's desired buffer size. Accepts the same values as
            the builtin open() function.
        - encoding -- The file's encoding. Accepts the same values as the
            builtin open() function.
        - errors -- A string indicating how encoding and decoding errors are to
            be handled. Accepts the same value as the builtin open() function.
    �rr�NcCs||_||_||_||_dSr-)�_mode�_bufsize�	_encoding�_errors)r%�mode�bufsize�encoding�errorsr*r*r+rQ�szFileType.__init__c
Cs�|dkr>d|jkrtjSd|jkr(tjStd�|j}t|��zt||j|j|j|j	�WSt
k
r�}z"||d�}td�}t||��W5d}~XYnXdS)N�-r�wzargument "-" with mode %r)�filename�errorz$can't open '%(filename)s': %(error)s)rr�stdinr	r�r�r�rr r!�OSErrorr)r%�stringr�er\r�r*r*r+r��s

�
zFileType.__call__cCsT|j|jf}d|jfd|jfg}d�dd�|D�dd�|D��}dt|�j|fS)Nr$r%rcSsg|]}|dkrt|��qS)r�)r!)rZr'r*r*r+r]�sz%FileType.__repr__.<locals>.<listcomp>cSs$g|]\}}|dk	rd||f�qS)Nrr*)rZ�kwr'r*r*r+r]�s�r)rrr r!r$rr)r%r\rZargs_strr*r*r+r,�s�zFileType.__repr__)rr�NN)rr2r3r4rQr�r,r*r*r*r+r�s
c@s(eZdZdZdd�Zdd�Zdd�ZdS)	r
z�Simple object for storing attributes.

    Implements equality by attribute names and values, and provides a simple
    string representation.
    cKs|D]}t||||�qdSr-)r�)r%rr(r*r*r+rQ�szNamespace.__init__cCst|t�stSt|�t|�kSr-)r�r
�NotImplementedr�)r%�otherr*r*r+�__eq__�s
zNamespace.__eq__cCs
||jkSr-)r/)r%rr*r*r+�__contains__�szNamespace.__contains__N)rr2r3r4rQr1r2r*r*r*r+r
�scs�eZdZ�fdd�Zdd�Zd&dd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd'dd�Zdd�Zd d!�Zd"d#�Zd$d%�Z�ZS)(�_ActionsContainercstt|���||_||_||_||_i|_|�ddt	�|�ddt	�|�ddt
�|�ddt�|�ddt�|�ddt
�|�ddt�|�ddt�|�dd	t�|�dd
t�|�ddt�|�ddt�|��g|_i|_g|_g|_i|_t�d
�|_g|_dS)NrvZstoreZstore_const�
store_trueZstore_falser Zappend_constr�rrr�parsersr�z^-\d+$|^-\d*\.\d+$)r�r3rQ�description�argument_default�prefix_chars�conflict_handler�_registries�registerr�r�r�r�r�r�r�r�rr
r�_get_handler�_actions�_option_string_actions�_action_groups�_mutually_exclusive_groups�	_defaultsrJrK�_negative_number_matcher�_has_negative_number_optionals)r%r6r8r7r9r�r*r+rQ�s4z_ActionsContainer.__init__cCs|j�|i�}|||<dSr-)r:r)r%�
registry_namer)r��registryr*r*r+r;sz_ActionsContainer.registerNcCs|j|�||�Sr-)r:r�)r%rDr)r�r*r*r+�
_registry_get sz_ActionsContainer._registry_getcKs2|j�|�|jD]}|j|kr||j|_qdSr-)rA�updater=r�r�)r%rrvr*r*r+�set_defaults&s

z_ActionsContainer.set_defaultscCs8|jD]"}|j|kr|jdk	r|jSq|j�|d�Sr-)r=r�r�rAr�)r%r�rvr*r*r+�get_default/s
z_ActionsContainer.get_defaultcOsD|j}|r&t|�dkrH|dd|krH|r:d|kr:td��|j||�}n|j||�}d|kr�|d}||jkr~|j||d<n|jdk	r�|j|d<|�|�}t|�s�td|f��|f|�}|�	d|j
|j
�}t|�s�td	|f��|tkr�td
|f��t|d��r:z|�
��|d�Wntk
�r8td��YnX|�|�S)
z�
        add_argument(dest, ..., name=value, ...)
        add_argument(option_string, option_string, ..., name=value, ...)
        rSrr�z+dest supplied twice for positional argumentr�Nzunknown action "%s"r�%r is not callablez<%r is a FileType class object, instance of it must be passedrz,length of metavar tuple does not match nargs)r8ror��_get_positional_kwargs�_get_optional_kwargsrAr7�_pop_action_class�callablerFrrr�rr�r��_add_action)r%r\r�charsr�Zaction_classrv�	type_funcr*r*r+rx9s:	 




�z_ActionsContainer.add_argumentcOs t|f|�|�}|j�|�|Sr-)�_ArgumentGroupr?r )r%r\rr�r*r*r+�add_argument_grouplsz$_ActionsContainer.add_argument_groupcKst|f|�}|j�|�|Sr-)�_MutuallyExclusiveGroupr@r )r%rr�r*r*r+�add_mutually_exclusive_groupqsz._ActionsContainer.add_mutually_exclusive_groupcCs`|�|�|j�|�||_|jD]}||j|<q"|jD]"}|j�|�r8|js8|j�d�q8|S)NT)	�_check_conflictr=r �	containerr�r>rB�matchrC)r%rvr�r*r*r+rOvs


z_ActionsContainer._add_actioncCs|j�|�dSr-)r=�remover�r*r*r+�_remove_action�sz _ActionsContainer._remove_actioncCs�i}|jD].}|j|kr.td�}t||j��|||j<q
i}|jD]D}|j|krn|j|j|j|jd�||j<|jD]}||j||<qtqD|jD]&}|j	|j
d�}|jD]}|||<q�q�|jD]}|�||��
|�q�dS)Nz.cannot merge actions - two groups are named %r)�titler6r9)r�)r?r[r�r�rSr6r9r�r@rUr�r=r�rO)r%rWZtitle_group_mapr�rZ	group_maprv�mutex_groupr*r*r+�_add_container_actions�s0



�

�

z(_ActionsContainer._add_container_actionscKs^d|krtd�}t|��|�d�ttfkr2d|d<|�d�tkrPd|krPd|d<t||gd�S)Nr�z1'required' is an invalid argument for positionalsr�Tr��r�r�)r�r�r�r
rr�)r%r�rrr*r*r+rK�sz(_ActionsContainer._get_positional_kwargsc	Os�g}g}|D]n}|d|jkr>||jd�}td�}t||��|�|�|d|jkrt|�dkr|d|jkr|�|�q|�dd�}|dkr�|r�|d}n|d}|�|j�}|s�td�}t||��|�dd�}t|||d	�S)
Nr)�optionr8zNinvalid option string %(option)r: must start with a character %(prefix_chars)rrSr�z%dest= is required for options like %rr&r�r^)	r8r�r�r ror��lstrip�replacer�)	r%r\rr�Zlong_option_stringsr�rr�Zdest_option_stringr*r*r+rL�s2�

z&_ActionsContainer._get_optional_kwargscCs|�d|�}|�d||�S)Nrv)r�rF)r%rr�rvr*r*r+rM�sz#_ActionsContainer._pop_action_classcCsFd|j}zt||�WStk
r@td�}t||j��YnXdS)Nz_handle_conflict_%sz%invalid conflict_resolution value: %r)r9r�r�r�r�)r%Zhandler_func_namerr*r*r+r<�s
z_ActionsContainer._get_handlercCsLg}|jD]&}||jkr
|j|}|�||f�q
|rH|��}|||�dSr-)r�r>r r<)r%rvZconfl_optionalsr�Zconfl_optionalr9r*r*r+rV�s


z!_ActionsContainer._check_conflictcCs6tddt|��}d�dd�|D��}t|||��dS)Nzconflicting option string: %szconflicting option strings: %srcSsg|]\}}|�qSr*r*)rZr�rvr*r*r+r]	s�z<_ActionsContainer._handle_conflict_error.<locals>.<listcomp>)rror$r)r%rv�conflicting_actionsr�Zconflict_stringr*r*r+�_handle_conflict_errors�
�z(_ActionsContainer._handle_conflict_errorcCs>|D]4\}}|j�|�|j�|d�|js|j�|�qdSr-)r�rYr>r�rWrZ)r%rvrbr�r*r*r+�_handle_conflict_resolves
z*_ActionsContainer._handle_conflict_resolve)N)N)rr2r3rQr;rFrHrIrxrSrUrOrZr]rKrLrMr<rVrcrdr�r*r*r�r+r3�s$5
	
3($
		r3cs6eZdZd�fdd�	Z�fdd�Z�fdd�Z�ZS)	rRNcs�|j}|d|j�|d|j�|d|j�tt|�j}|fd|i|��||_g|_|j	|_	|j
|_
|j|_|j|_|j
|_
|j|_dS)Nr9r8r7r6)rr9r8r7r�rRrQr[r�r:r=r>rArCr@)r%rWr[r6rrGZ
super_initr�r*r+rQs�z_ArgumentGroup.__init__cs tt|��|�}|j�|�|Sr-)r�rRrOr�r r�r�r*r+rO5sz_ArgumentGroup._add_actioncs tt|��|�|j�|�dSr-)r�rRrZr�rYr�r�r*r+rZ:sz_ArgumentGroup._remove_action)NN�rr2r3rQrOrZr�r*r*r�r+rRsrRcs.eZdZd�fdd�	Zdd�Zdd�Z�ZS)	rTFcs tt|��|�||_||_dSr-)r�rTrQr��
_container)r%rWr�r�r*r+rQAsz _MutuallyExclusiveGroup.__init__cCs2|jrtd�}t|��|j�|�}|j�|�|S)Nz-mutually exclusive arguments must be optional)r�r�r�rfrOr�r )r%rvrr*r*r+rOFsz#_MutuallyExclusiveGroup._add_actioncCs|j�|�|j�|�dSr-)rfrZr�rYr�r*r*r+rZNsz&_MutuallyExclusiveGroup._remove_action)Frer*r*r�r+rT?srTcs*eZdZdZddddgeddddddf�fdd�	Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dAdd�ZdBdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdCd&d'�ZdDd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdEd6d7�ZdFd8d9�ZdGd:d;�ZdHd=d>�Z d?d@�Z!�Z"S)Ira�Object for parsing command line strings into Python objects.

    Keyword Arguments:
        - prog -- The name of the program (default: sys.argv[0])
        - usage -- A usage message (default: auto-generated from arguments)
        - description -- A description of what the program does
        - epilog -- Text following the argument descriptions
        - parents -- Parsers whose arguments should be copied into this one
        - formatter_class -- HelpFormatter class for printing help messages
        - prefix_chars -- Characters that prefix optional arguments
        - fromfile_prefix_chars -- Characters that prefix files containing
            additional arguments
        - argument_default -- The default value for all arguments
        - conflict_handler -- String indicating how to handle conflicts
        - add_help -- Add a -h/-help option
        - allow_abbrev -- Allow long options to be abbreviated unambiguously
    Nr&r)Tc
	s"tt|�j}
|
|||	|
d�|dkr6tj�tjd�}||_||_	||_
||_||_||_
||_|j}|td��|_|td��|_d|_dd�}|�dd|�d|kr�dn|d}|j
r�|j|d	|d
ddttd�d
�|D]<}|�|�z
|j}Wntk
�rYq�X|j�|�q�dS)N)r6r8r7r9rzpositional argumentszoptional argumentscSs|Sr-r*)r,r*r*r+�identity�sz)ArgumentParser.__init__.<locals>.identityrr&�hr8rrzshow this help message and exit)rvr�rr)r�rrQ�_os�path�basenamer�argvrOri�epilog�formatter_class�fromfile_prefix_chars�add_help�allow_abbrevrSr��_positionals�
_optionals�_subparsersr;rxrr]rAr�rG)r%rOrir6rm�parentsrnr8ror7r9rprqZ	superinitZ	add_grouprgZdefault_prefixrX�defaultsr�r*r+rQfsJ�
�

zArgumentParser.__init__cs"ddddddg}�fdd�|D�S)	NrOrir6rnr9rpcsg|]}|t�|�f�qSr*r�r�r1r*r+r]�sz.ArgumentParser._get_kwargs.<locals>.<listcomp>r*r�r*r1r+r"�s�zArgumentParser._get_kwargsc	Ks�|jdk	r|�td��|�dt|��d|ks8d|krht|�dd��}t|�dd��}|�||�|_n|j|_|�d�dkr�|�	�}|�
�}|j}|�|j
||d�|����|d<|�|d�}|fd	gi|��}|j�|�|S)
Nz(cannot have multiple subparser argumentsrr[r6ZsubcommandsrOr^r5r�)rtr)r�rrr�rSrrr�r�_get_positional_actionsr@rmrirar|rMrO)	r%rr[r6rWr�rkZ
parsers_classrvr*r*r+�add_subparsers�s$
zArgumentParser.add_subparserscCs$|jr|j�|�n|j�|�|Sr-)r�rsrOrrr�r*r*r+rO�szArgumentParser._add_actioncCsdd�|jD�S)NcSsg|]}|jr|�qSr*�r��rZrvr*r*r+r]�s�z8ArgumentParser._get_optional_actions.<locals>.<listcomp>�r=r1r*r*r+�_get_optional_actions�s�z$ArgumentParser._get_optional_actionscCsdd�|jD�S)NcSsg|]}|js|�qSr*ryrzr*r*r+r]�s�z:ArgumentParser._get_positional_actions.<locals>.<listcomp>r{r1r*r*r+rw�s�z&ArgumentParser._get_positional_actionscCs4|�||�\}}|r0td�}|�|d�|��|S�Nzunrecognized arguments: %sr)rr�r)r$�r%r\r�rlrr*r*r+�
parse_args�s
zArgumentParser.parse_argscCs|dkrtjdd�}nt|�}|dkr.t�}|jD]4}|jtk	r4t||j�s4|jtk	r4t	||j|j�q4|j
D] }t||�spt	|||j
|�qpz>|�||�\}}t|t�r�|�
t|t��t|t�||fWStk
�rt��d}|�t|��YnXdSrR)rrlr5r
r=r�rr�r�r�rA�_parse_known_argsrr�r��delattrr�exc_infor)r�)r%r\r�rvr��errr*r*r+r�s,







zArgumentParser.parse_known_argscs�	jdk	r�	����i��	jD]R}|j}t|j�D]<\}}��|g�}|�|d|��|�||dd��q2qi�g}t��}	t|	�D]^\}}
|
dkr�|�d�|	D]}
|�d�q�q��	�	|
�}|dkr�d}n|�|<d}|�|�q�d�
|��t��t��d�����	fdd�	������	�fd	d
�}
�	�������	�fdd�}g�d
�
��r`t
��}nd}�
|k�r�t�
fdd��D��}�
|k�r�|�
�}|�
k�r�|�
�qdn|�
�
�k�r҈�
|�}��|�|�
|
�
��
�qd|�
�}���|d��g}�	jD]|}|�k�r|j�r(|�t|��nT|jdk	�rt|jt��rt�|j��r|jt�|j�k�rt�|j�	�||j���q|�r��	�td�d�
|���	jD]X}|j�r�|jD]}|�k�r��q��q�dd�|jD�}td�}�	�|d�
|���q���fS)NrS�--r&�A�Or^cs|��|���||�}||jk	rb��|���|g�D]*}|�kr6td�}t|�}t|||��q6|tk	rx|��||�dS)Nznot allowed with argument %s)r��_get_valuesr�r�r�r�rr)rvZargument_stringsr�Zargument_valuesZconflict_actionrZaction_name)�action_conflictsr��seen_actions�seen_non_default_actionsr%r*r+�take_action@s


z5ArgumentParser._parse_known_args.<locals>.take_actioncs��|}|\}}}�j}g}|dkr:���|�|dS|dk	�r||d�}�j}|dkr�|d|kr�|�|g|f�|d}	|	|d}|dd�p�d}
�j}||kr�||}|
}ntd�}t|||��nB|dkr�|d}
|g}|�|||f��q\ntd�}t|||��q|d}�|d�}|||�}||}
�||
�}|�|||f��q\q|�sft�|D]\}}}�|||��qj|
S)NrSr�rzignored explicit argument %r)�_match_argumentr r8r>r�rrU)�start_index�option_tuplervr��explicit_argZmatch_argumentZ
action_tuples�	arg_countrP�charZnew_explicit_argZ
optionals_mapr�stopr\r�Zselected_patterns)r&�arg_strings_pattern�extras�option_string_indicesr%r�r*r+�consume_optionalUsN




z:ArgumentParser._parse_known_args.<locals>.consume_optionalcsn�j}�|d�}|�|�}t�|�D]*\}}�|||�}||7}�||�q&�t|�d��dd�<|Sr-)�_match_arguments_partial�zipro)r�Z
match_partialZselected_patternZ
arg_countsrvr�r\)r&r�r�r%r�r*r+�consume_positionals�s
z=ArgumentParser._parse_known_args.<locals>.consume_positionalsrr�csg|]}|�kr|�qSr*r*)rZr�)r�r*r+r]�s�z4ArgumentParser._parse_known_args.<locals>.<listcomp>z(the following arguments are required: %srcSsg|]}|jtk	rt|��qSr*)rrrr�rzr*r*r+r]�s
�z#one of the arguments %s is requiredr)N)ro�_read_args_from_filesr@r�r�rr��iterr �_parse_optionalr$r�rwrAr@r=r�r�r�r�r�r�r�r�r��
_get_valuer)r�)r%r&r�r\r�r�Zmutex_actionZ	conflictsZarg_string_pattern_partsZarg_strings_iter�
arg_stringr��patternr�r�Zmax_option_string_indexZnext_option_string_indexZpositionals_end_indexZstringsZ
stop_indexZrequired_actionsrvr�r�rr*)r�r&r�r�r�r�r�r�r�r%r�r�r+r�s�





J

�






�
���
�



�z ArgumentParser._parse_known_argsc
Cs�g}|D]�}|r|d|jkr*|�|�qzdt|dd���J}g}|����D]}|�|�D]}|�|�q\qN|�|�}|�|�W5QRXWqtk
r�t	�
�d}|�t|��YqXq|Sr�)
ror r��readr��convert_arg_line_to_argsr�r�r+rr�r)r�)r%r&Znew_arg_stringsr�Z	args_file�arg_liner'r�r*r*r+r�s 
z$ArgumentParser._read_args_from_filescCs|gSr-r*)r%r�r*r*r+r�!sz'ArgumentParser.convert_arg_line_to_argscCsz|�|�}t�||�}|dkrldtd�ttd�ttd�i}|�|j�}|dkrbtdd|j�|j}t	||��t
|�d��S)Nzexpected one argumentzexpected at most one argumentzexpected at least one argumentzexpected %s argumentzexpected %s argumentsrS)�_get_nargs_patternrJrXr�r
rr�r�rrror�)r%rvr��
nargs_patternrXZnargs_errorsrr*r*r+r�$s(
���
zArgumentParser._match_argumentcsrg}tt|�dd�D]X}|d|�}d��fdd�|D��}t�||�}|dk	r|�dd�|��D��qnq|S)Nrr�r^csg|]}��|��qSr*)r�rzr1r*r+r]@s�z;ArgumentParser._match_arguments_partial.<locals>.<listcomp>cSsg|]}t|��qSr*rn)rZr,r*r*r+r]Ds)r�ror$rJrXr�rk)r%rjr�r�r�Z
actions_slicer�rXr*r1r+r�:s�z'ArgumentParser._match_arguments_partialc
Cs|sdS|d|jkrdS||jkr8|j|}||dfSt|�dkrHdSd|kr~|�dd�\}}||jkr~|j|}|||fS|�|�}t|�dkr�d�dd�|D��}||d�}td�}|�||�nt|�dkr�|\}	|	S|j�	|�r�|j
s�dSd	|k�rdSd|dfS)
NrrS�=rcSsg|]\}}}|�qSr*r*)rZrvr�r�r*r*r+r]is�z2ArgumentParser._parse_optional.<locals>.<listcomp>)r_Zmatchesz4ambiguous option: %(option)s could match %(matches)sr)r8r>ro�split�_get_option_tuplesr$r�r)rBrXrC)
r%r�rvr�r�Z
option_tuplesZoptionsr\rr�r*r*r+r�Js>







�

zArgumentParser._parse_optionalc
Cs0g}|j}|d|kr�|d|kr�|jr~d|krB|�dd�\}}n|}d}|jD],}|�|�rP|j|}|||f}|�|�qPn�|d|k�r|d|k�r|}d}|dd�}|dd�}	|jD]T}||kr�|j|}|||	f}|�|�q�|�|�r�|j|}|||f}|�|�q�n|�td�|�|S)NrrSr�r8zunexpected option string: %s)r8rqr�r>�
startswithr r)r�)
r%r�r�rPZ
option_prefixr�rvr�Zshort_option_prefixZshort_explicit_argr*r*r+r��s:









z!ArgumentParser._get_option_tuplescCs�|j}|dkrd}nf|tkr"d}nX|tkr0d}nJ|tkr>d}n<|tkrLd}n.|tkrZd}n |tkrhd}ndd	�d
|�}|jr�|�	d	d�}|�	dd�}|S)
Nz(-*A-*)z(-*A?-*)z	(-*[A-]*)z
(-*A[A-]*)z([-AO]*)z(-*A[-AO]*)z(-*-*)z(-*%s-*)z-*r�r^r&)
r�r
rrrrrr$r�ra)r%rvr�r�r*r*r+r��s(z!ArgumentParser._get_nargs_patterncCs4|�||�\}}|r0td�}|�|d�|��|Sr})�parse_known_intermixed_argsr�r)r$r~r*r*r+�parse_intermixed_args�s
z$ArgumentParser.parse_intermixed_argsc	s�|���dd��D�}|r,td|dj���fdd�|jD�rHtd���zN|j}z�|jdkrp|��dd�|_�D] }|j|_t	|_|j|_t	|_qt|�
||�\}}�D]J}t||j�r�t
||j�gkr�ddlm}|d	|j|f�t||j�q�W5�D]}|j|_|j|_q�X|��}zJ|D]}|j|_d
|_�q$|jD]}	|	j|	_d
|	_�q@|�
||�\}}
W5|D]}|j|_�qn|jD]}	|	j|	_�q�XW5||_X||
fS)NcSsg|]}|jttfkr|�qSr*)r�rrrzr*r*r+r]�s�z>ArgumentParser.parse_known_intermixed_args.<locals>.<listcomp>z3parse_intermixed_args: positional arg with nargs=%srcs&g|]}|jD]}|�kr|j�qqSr*)r�r�)rZr�rv�r�r*r+r]�s
�z;parse_intermixed_args: positional in mutuallyExclusiveGroup�)�warnzDo not expect %s in %sF)rwr�r�r@riZ
save_nargsZsave_defaultr��format_usagerrr�r�r��warningsr�r�r|Z
save_requiredr�)r%r\r��aZ
save_usagervZremaining_argsr�r�r�r�r*r�r+r��s`
�
��


�
z*ArgumentParser.parse_known_intermixed_argscs��jttfkr2z|�d�Wntk
r0YnX|sz�jtkrz�jrN�j}n�j}t	|t
�rv���|�}���|��n|s��jt
kr��js��jdk	r��j}n|}���|�n�t|�dkr�jdtfkr�|\}���|�}���|�n��jtk�r��fdd�|D�}np�jtk�r@��fdd�|D�}���|d�n>�jtk�rRt}n,��fdd�|D�}|D]}���|��qj|S)Nr�rScsg|]}���|��qSr*�r��rZ�v�rvr%r*r+r]Z	sz.ArgumentParser._get_values.<locals>.<listcomp>csg|]}���|��qSr*r�r�r�r*r+r]^	srcsg|]}���|��qSr*r�r�r�r*r+r]g	s)r�rrrYr�r
r�r�r�r�r�r��_check_valuerror)r%rvr&r)r�r�r*r�r+r�6	sD
�
zArgumentParser._get_valuesc	Cs�|�d|j|j�}t|�s0td�}t|||��z||�}Wn�tk
r~t|jdt|j��}tt	�
�d�}t||��YnLttfk
r�t|jdt|j��}||d�}td�}t|||��YnX|S)NrrJrrS)rr)z!invalid %(type)s value: %(value)r)
rFrrNr�rrr�r!r�rr�r�r�)r%rvr�rQrr�r(r\r*r*r+r�n	s 
zArgumentParser._get_valuecCsF|jdk	rB||jkrB|d�tt|j��d�}td�}t|||��dS)Nr)r)r�z3invalid choice: %(value)r (choose from %(choices)s))r�r$�mapr!r�r)r%rvr)r\rr*r*r+r��	s�zArgumentParser._check_valuecCs$|��}|�|j|j|j�|��Sr-)rrmrir=r@ra)r%rWr*r*r+r��	s
�zArgumentParser.format_usagecCst|��}|�|j|j|j�|�|j�|jD]0}|�|j	�|�|j�|�
|j�|��q.|�|j
�|��Sr-)rrmrir=r@rgr6r?rcr[ryr�rdrmra)r%rWZaction_groupr*r*r+ra�	s�

zArgumentParser.format_helpcCs|j|jd�S)Nr~)rnrOr1r*r*r+r�	szArgumentParser._get_formattercCs"|dkrtj}|�|��|�dSr-)rr	rr��r%�filer*r*r+�print_usage�	szArgumentParser.print_usagecCs"|dkrtj}|�|��|�dSr-)rr	rrar�r*r*r+r�	szArgumentParser.print_helpcCs |r|dkrtj}|�|�dSr-)r�stderr�write)r%r�r�r*r*r+r�	szArgumentParser._print_messagercCs |r|�|tj�t�|�dSr-)rrr�r)r%Zstatusr�r*r*r+r�	szArgumentParser.exitcCs0|�tj�|j|d�}|�dtd�|�dS)z�error(message: string)

        Prints a usage message incorporating the message to stderr and
        exits.

        If you override this in a subclass, it should not return -- it
        should either exit or raise an exception.
        )rOr�r8z%(prog)s: error: %(message)s
N)r�rr�rOrr�)r%r�r\r*r*r+r)�	s	zArgumentParser.error)NN)NN)NN)NN)N)N)N)rN)#rr2r3r4rrQr"rxrOr|rwrrr�r�r�r�r�r�r�r�r�r�r�r�r�r�rarr�rrrr)r�r*r*r�r+rSsV�@

#w:-1

M8


	
)3r4�__version__�__all__�osri�rerJZshutilr;�sysrrr�rrr
rrrrrr�rr7rrrrr	r��	Exceptionrrrr�r�r�r�r�r�r�r�rr
rrr
r3rRrTrr*r*r*r+�<module>s�=�z
	[#&]7:"configparser.cpython-38.pyc000064400000131230150335716500011663 0ustar00U

e5df��@s�dZddlmZddlmZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddddd	d
ddd
ddddddddddddgZ
eZdZdZGdd�de�ZGdd�de�ZGdd�de�ZGd d�de�ZGd!d�de�ZGd"d	�d	e�ZGd#d�de�ZGd$d�de�ZGd%d
�d
e�ZGd&d
�d
e�ZGd'd�de�Ze�ZGd(d�d�Z Gd)d�de �Z!Gd*d�de �Z"Gd+d�de �Z#Gd,d�de�Z$Gd-d�de$�Z%Gd.d�de%�Z&Gd/d�de�Z'Gd0d�de�Z(dS)1a�Configuration file parser.

A configuration file consists of sections, lead by a "[section]" header,
and followed by "name: value" entries, with continuations and such in
the style of RFC 822.

Intrinsic defaults can be specified by passing them into the
ConfigParser constructor as a dictionary.

class:

ConfigParser -- responsible for parsing a list of
                    configuration files, and managing the parsed database.

    methods:

    __init__(defaults=None, dict_type=_default_dict, allow_no_value=False,
             delimiters=('=', ':'), comment_prefixes=('#', ';'),
             inline_comment_prefixes=None, strict=True,
             empty_lines_in_values=True, default_section='DEFAULT',
             interpolation=<unset>, converters=<unset>):
        Create the parser. When `defaults' is given, it is initialized into the
        dictionary or intrinsic defaults. The keys must be strings, the values
        must be appropriate for %()s string interpolation.

        When `dict_type' is given, it will be used to create the dictionary
        objects for the list of sections, for the options within a section, and
        for the default values.

        When `delimiters' is given, it will be used as the set of substrings
        that divide keys from values.

        When `comment_prefixes' is given, it will be used as the set of
        substrings that prefix comments in empty lines. Comments can be
        indented.

        When `inline_comment_prefixes' is given, it will be used as the set of
        substrings that prefix comments in non-empty lines.

        When `strict` is True, the parser won't allow for any section or option
        duplicates while reading from a single source (file, string or
        dictionary). Default is True.

        When `empty_lines_in_values' is False (default: True), each empty line
        marks the end of an option. Otherwise, internal empty lines of
        a multiline option are kept as part of the value.

        When `allow_no_value' is True (default: False), options without
        values are accepted; the value presented for these is None.

        When `default_section' is given, the name of the special section is
        named accordingly. By default it is called ``"DEFAULT"`` but this can
        be customized to point to any other valid section name. Its current
        value can be retrieved using the ``parser_instance.default_section``
        attribute and may be modified at runtime.

        When `interpolation` is given, it should be an Interpolation subclass
        instance. It will be used as the handler for option value
        pre-processing when using getters. RawConfigParser objects don't do
        any sort of interpolation, whereas ConfigParser uses an instance of
        BasicInterpolation. The library also provides a ``zc.buildbot``
        inspired ExtendedInterpolation implementation.

        When `converters` is given, it should be a dictionary where each key
        represents the name of a type converter and each value is a callable
        implementing the conversion from string to the desired datatype. Every
        converter gets its corresponding get*() method on the parser object and
        section proxies.

    sections()
        Return all the configuration section names, sans DEFAULT.

    has_section(section)
        Return whether the given section exists.

    has_option(section, option)
        Return whether the given option exists in the given section.

    options(section)
        Return list of configuration options for the named section.

    read(filenames, encoding=None)
        Read and parse the iterable of named configuration files, given by
        name.  A single filename is also allowed.  Non-existing files
        are ignored.  Return list of successfully read files.

    read_file(f, filename=None)
        Read and parse one configuration file, given as a file object.
        The filename defaults to f.name; it is only used in error
        messages (if f has no `name' attribute, the string `<???>' is used).

    read_string(string)
        Read configuration from a given string.

    read_dict(dictionary)
        Read configuration from a dictionary. Keys are section names,
        values are dictionaries with keys and values that should be present
        in the section. If the used dictionary type preserves order, sections
        and their keys will be added in order. Values are automatically
        converted to strings.

    get(section, option, raw=False, vars=None, fallback=_UNSET)
        Return a string value for the named option.  All % interpolations are
        expanded in the return values, based on the defaults passed into the
        constructor and the DEFAULT section.  Additional substitutions may be
        provided using the `vars' argument, which must be a dictionary whose
        contents override any pre-existing defaults. If `option' is a key in
        `vars', the value from `vars' is used.

    getint(section, options, raw=False, vars=None, fallback=_UNSET)
        Like get(), but convert value to an integer.

    getfloat(section, options, raw=False, vars=None, fallback=_UNSET)
        Like get(), but convert value to a float.

    getboolean(section, options, raw=False, vars=None, fallback=_UNSET)
        Like get(), but convert value to a boolean (currently case
        insensitively defined as 0, false, no, off for False, and 1, true,
        yes, on for True).  Returns False or True.

    items(section=_UNSET, raw=False, vars=None)
        If section is given, return a list of tuples with (name, value) for
        each option in the section. Otherwise, return a list of tuples with
        (section_name, section_proxy) for each section, including DEFAULTSECT.

    remove_section(section)
        Remove the given file section and all its options.

    remove_option(section, option)
        Remove the given option from the given section.

    set(section, option, value)
        Set the given option.

    write(fp, space_around_delimiters=True)
        Write the configuration state in .ini format. If
        `space_around_delimiters' is True (the default), delimiters
        between keys and values are surrounded by spaces.
�)�MutableMapping)�ChainMapN�NoSectionError�DuplicateOptionError�DuplicateSectionError�
NoOptionError�InterpolationError�InterpolationDepthError�InterpolationMissingOptionError�InterpolationSyntaxError�ParsingError�MissingSectionHeaderError�ConfigParser�SafeConfigParser�RawConfigParser�
Interpolation�BasicInterpolation�ExtendedInterpolation�LegacyInterpolation�SectionProxy�ConverterMapping�DEFAULTSECT�MAX_INTERPOLATION_DEPTHZDEFAULT�
c@s&eZdZdZddd�Zdd�ZeZdS)	�Errorz'Base class for ConfigParser exceptions.�cCs||_t�||�dS�N)�message�	Exception�__init__)�self�msg�r"�$/usr/lib64/python3.8/configparser.pyr�szError.__init__cCs|jSr)r�r r"r"r#�__repr__�szError.__repr__N)r)�__name__�
__module__�__qualname__�__doc__rr%�__str__r"r"r"r#r�s
rc@seZdZdZdd�ZdS)rz2Raised when no section matches a requested option.cCs$t�|d|f�||_|f|_dS)NzNo section: %r)rr�section�args�r r+r"r"r#r�szNoSectionError.__init__N�r&r'r(r)rr"r"r"r#r�sc@seZdZdZddd�ZdS)raRaised when a section is repeated in an input source.

    Possible repetitions that raise this exception are: multiple creation
    using the API or in strict parsers when a section is found more than once
    in a single input file, string or dictionary.
    NcCs�t|�dg}|dk	rRdt|�g}|dk	r8|�d�|��|�d�|�|�|}n|�dd�t�|d�|��||_||_	||_
|||f|_dS)N� already exists�While reading from � [line {0:2d}]z
: section rzSection r)�repr�append�format�extend�insertrr�joinr+�source�linenor,)r r+r8r9r!rr"r"r#r�s

zDuplicateSectionError.__init__)NNr.r"r"r"r#r�sc@seZdZdZddd�ZdS)rz�Raised by strict parsers when an option is repeated in an input source.

    Current implementation raises this exception only when an option is found
    more than once in a single file, string or dictionary.
    NcCs�t|�dt|�dg}|dk	rZdt|�g}|dk	r@|�d�|��|�d�|�|�|}n|�dd�t�|d�|��||_||_	||_
||_||||f|_dS)	Nz in section r/r0r1z	: option rzOption r)
r2r3r4r5r6rrr7r+�optionr8r9r,)r r+r:r8r9r!rr"r"r#r�s"�

zDuplicateOptionError.__init__)NNr.r"r"r"r#r�sc@seZdZdZdd�ZdS)rz!A requested option was not found.cCs.t�|d||f�||_||_||f|_dS)NzNo option %r in section: %r�rrr:r+r,)r r:r+r"r"r#r�s�zNoOptionError.__init__Nr.r"r"r"r#r�sc@seZdZdZdd�ZdS)rz0Base class for interpolation-related exceptions.cCs(t�||�||_||_|||f|_dSrr;)r r:r+r!r"r"r#rszInterpolationError.__init__Nr.r"r"r"r#r�sc@seZdZdZdd�ZdS)r
zAA string substitution required a setting which was not available.cCs8d�||||�}t�||||�||_||||f|_dS)Nz�Bad value substitution: option {!r} in section {!r} contains an interpolation key {!r} which is not a valid option name. Raw value: {!r})r4rr�	referencer,)r r:r+�rawvalr<r!r"r"r#rs�z(InterpolationMissingOptionError.__init__Nr.r"r"r"r#r
sc@seZdZdZdS)rz�Raised when the source text contains invalid syntax.

    Current implementation raises this exception when the source text into
    which substitutions are made does not conform to the required syntax.
    N)r&r'r(r)r"r"r"r#rsc@seZdZdZdd�ZdS)r	z0Raised when substitutions are nested too deeply.cCs0d�||t|�}t�||||�|||f|_dS)Nz�Recursion limit exceeded in value substitution: option {!r} in section {!r} contains an interpolation key which cannot be substituted in {} steps. Raw value: {!r})r4rrrr,)r r:r+r=r!r"r"r#rs�z InterpolationDepthError.__init__Nr.r"r"r"r#r	sc@s<eZdZdZd
dd�Zedd��Zejdd��Zdd	�ZdS)rz>Raised when a configuration file does not follow legal syntax.NcCsT|r|rtd��n|s$|s$td��n|r,|}t�|d|�||_g|_|f|_dS)Nz:Cannot specify both `filename' and `source'. Use `source'.z%Required argument `source' not given.z"Source contains parsing errors: %r)�
ValueErrorrrr8�errorsr,)r r8�filenamer"r"r#r,s

zParsingError.__init__cCstjdtdd�|jS)zDeprecated, use `source'.�SThe 'filename' attribute will be removed in future versions.  Use 'source' instead.���
stacklevel��warnings�warn�DeprecationWarningr8r$r"r"r#r@;s�zParsingError.filenamecCstjdtdd�||_dS)zDeprecated, user `source'.rArBrCNrE�r �valuer"r"r#r@Es�cCs*|j�||f�|jd||f7_dS)Nz
	[line %2d]: %s)r?r3r)r r9�liner"r"r#r3OszParsingError.append)NN)	r&r'r(r)r�propertyr@�setterr3r"r"r"r#r)s

	
	c@seZdZdZdd�ZdS)r
z@Raised when a key-value pair is found before any section header.cCs8t�|d|||f�||_||_||_|||f|_dS)Nz7File contains no section headers.
file: %r, line: %d
%r)rrr8r9rKr,)r r@r9rKr"r"r#rWs��z"MissingSectionHeaderError.__init__Nr.r"r"r"r#r
Tsc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)rzBDummy interpolation that passes the value through with no changes.cCs|Srr")r �parserr+r:rJ�defaultsr"r"r#�
before_getkszInterpolation.before_getcCs|Srr"�r rNr+r:rJr"r"r#�
before_setnszInterpolation.before_setcCs|Srr"rQr"r"r#�before_readqszInterpolation.before_readcCs|Srr"rQr"r"r#�before_writetszInterpolation.before_writeN)r&r'r(r)rPrRrSrTr"r"r"r#rhs
c@s2eZdZdZe�d�Zdd�Zdd�Zdd�Z	d	S)
ra!Interpolation as implemented in the classic ConfigParser.

    The option values can contain format strings which refer to other values in
    the same section, or values in the special default section.

    For example:

        something: %(dir)s/whatever

    would resolve the "%(dir)s" to the value of dir.  All reference
    expansions are done late, on demand. If a user needs to use a bare % in
    a configuration file, she can escape it by writing %%. Other % usage
    is considered a user error and raises `InterpolationSyntaxError'.z
%\(([^)]+)\)sc	Cs$g}|�||||||d�d�|�S�N�r��_interpolate_somer7�r rNr+r:rJrO�Lr"r"r#rP�szBasicInterpolation.before_getcCs<|�dd�}|j�d|�}d|kr8td||�d�f��|S)Nz%%r�%�1invalid interpolation syntax in %r at position %d��replace�_KEYCRE�subr>�find�r rNr+r:rJZ	tmp_valuer"r"r#rR�s�zBasicInterpolation.before_setc
Csj|j||d|d�}|tkr&t|||��|�rf|�d�}	|	dkrL|�|�dS|	dkrr|�|d|	��||	d�}|dd�}
|
dkr�|�d�|dd�}q&|
dk�rR|j�|�}|dkr�t||d|��|�|�	d��}||�
�d�}z||}
Wn&tk
�rt||||�d�YnXd|
k�rF|�
||||
|||d�n
|�|
�q&t||d	|f��q&dS)
NT��raw�fallbackr[rrVrB�(�'bad interpolation variable reference %rz/'%%' must be followed by '%%' or '(', found: %r)�getrr	rar3r_�matchr�optionxform�group�end�KeyErrorr
rX)r rNr:�accum�restr+�map�depthr=�p�c�m�var�vr"r"r#rX�s`



���
���z$BasicInterpolation._interpolate_someN�
r&r'r(r)�re�compiler_rPrRrXr"r"r"r#rxs

c@s2eZdZdZe�d�Zdd�Zdd�Zdd�Z	d	S)
rzyAdvanced variant of interpolation, supports the syntax used by
    `zc.buildout'. Enables interpolation between sections.z
\$\{([^}]+)\}c	Cs$g}|�||||||d�d�|�SrUrWrYr"r"r#rP�sz ExtendedInterpolation.before_getcCs<|�dd�}|j�d|�}d|kr8td||�d�f��|S)Nz$$r�$r\r]rbr"r"r#rR�s�z ExtendedInterpolation.before_setcCs�|j||d|d�}|tkr&t|||��|�r�|�d�}	|	dkrL|�|�dS|	dkrr|�|d|	��||	d�}|dd�}
|
dkr�|�d�|dd�}q&|
dk�r�|j�|�}|dkr�t||d|��|�d��	d	�}||�
�d�}|}
|}zrt|�dk�r|�|d�}||}nHt|�dk�rR|d}
|�|d�}|j|
|dd
�}nt||d|f��Wn2t
ttfk
�r�t|||d	�|��d�YnXd|k�r�|�|||||
t|j|
dd
��|d�n
|�|�q&t||d|f��q&dS)
NTrcrzrrVrB�{rg�:)rdzMore than one ':' found: %rz-'$' must be followed by '$' or '{', found: %r)rhrr	rar3r_rirrk�splitrl�lenrjrmrrr
r7rX�dict�items)r rNr:rnror+rprqr=rrrsrt�pathZsect�optrvr"r"r#rX�sx



�
���
���z'ExtendedInterpolation._interpolate_someNrwr"r"r"r#r�s

c@s6eZdZdZe�d�Zdd�Zdd�Ze	dd��Z
d	S)
rz{Deprecated interpolation used in old versions of ConfigParser.
    Use BasicInterpolation or ExtendedInterpolation instead.z%\(([^)]*)\)s|.c

Cs�|}t}|r�|d8}|r�d|kr�tj|j|d�}|j�||�}z||}Wq�tk
r�}	zt||||	jd�d�W5d}	~	XYq�Xqq�q|r�d|kr�t	|||��|S)NrVz%()rNr)
r�	functools�partial�_interpolation_replacer_r`rmr
r,r	)
r rNr+r:rJ�varsr=rqr^�er"r"r#rPs0���zLegacyInterpolation.before_getcCs|Srr"rQr"r"r#rR$szLegacyInterpolation.before_setcCs,|�d�}|dkr|��Sd|�|�SdS)NrVz%%(%s)s)rkrj)rirN�sr"r"r#r�'s
z*LegacyInterpolation._interpolation_replaceN)r&r'r(r)rxryr_rPrR�staticmethodr�r"r"r"r#r
s
c
s6eZdZdZdZdZdZe�Ze	�
ee	j�Ze	�
ej
dd�e	j�Ze	�
ej
dd�e	j�Ze	�
d�Zddddd	d	d	d	d
�Zded	fdd
dddeeed�dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdddd�Zdedd�Zdfd d!�Zdgd#d$�Zdhd%d&�Zd	ded'�d(d)�Z d*d+�Z!d	ded'�d,d-�Z"d	ded'�d.d/�Z#d	ded'�d0d1�Z$d	ded'�d2d3�Z%ed	df�fd4d5�	Z&d6d7�Z'd8d9�Z(d:d;�Z)did<d=�Z*djd>d?�Z+d@dA�Z,dBdC�Z-dDdE�Z.dFdG�Z/dHdI�Z0dJdK�Z1dLdM�Z2dNdO�Z3dPdQ�Z4dRdS�Z5dTdU�Z6dVdW�Z7dXdY�Z8dZd[�Z9d\d]�Z:d^d^d^d_�d`da�Z;e<dbdc��Z=�Z>S)krz,ConfigParser that does not do interpolation.z�
        \[                                 # [
        (?P<header>[^]]+)                  # very permissive!
        \]                                 # ]
        a�
        (?P<option>.*?)                    # very permissive!
        \s*(?P<vi>{delim})\s*              # any number of space/tab,
                                           # followed by any of the
                                           # allowed delimiters,
                                           # followed by any space/tab
        (?P<value>.*)$                     # everything up to eol
        a�
        (?P<option>.*?)                    # very permissive!
        \s*(?:                             # any number of space/tab,
        (?P<vi>{delim})\s*                 # optionally followed by
                                           # any of the allowed
                                           # delimiters, followed by any
                                           # space/tab
        (?P<value>.*))?$                   # everything up to eol
        z=|:�Zdelimz\STF)�1Zyes�trueZon�0ZnoZfalseZoffN��=r|)�#�;)�
delimiters�comment_prefixes�inline_comment_prefixes�strict�empty_lines_in_values�default_section�
interpolation�
convertersc
Cs<||_|��|_|��|_t|�|_|��|_t||	�|j|	<t|�|_|dkrd|rZ|j	n|j
|_nNd�dd�|D��}|r�t
�|jj|d�t
j�|_nt
�|jj|d�t
j�|_t|p�d�|_t|p�d�|_||_||_||_|	|_|
|_|jtkr�|j|_|jdk�rt�|_|tk	�r(|j�|�|�r8|�|�dS)Nr��|css|]}t�|�VqdSr)rx�escape)�.0�dr"r"r#�	<genexpr>jsz+RawConfigParser.__init__.<locals>.<genexpr>r�r")�_dict�	_sections�	_defaultsr�_converters�_proxiesr�tuple�_delimiters�	OPTCRE_NV�OPTCRE�_optcrer7rxry�_OPT_NV_TMPLr4�VERBOSE�	_OPT_TMPL�_comment_prefixes�_inline_comment_prefixes�_strict�_allow_no_value�_empty_lines_in_valuesr��_interpolation�_UNSET�_DEFAULT_INTERPOLATIONr�update�_read_defaults)
r rOZ	dict_typeZallow_no_valuer�r�r�r�r�r�r�r�r�r"r"r#rYs@




��

zRawConfigParser.__init__cCs|jSr)r�r$r"r"r#rO�szRawConfigParser.defaultscCst|j���S)z3Return a list of section names, excluding [DEFAULT])�listr��keysr$r"r"r#�sections�szRawConfigParser.sectionscCsJ||jkrtd|��||jkr(t|��|��|j|<t||�|j|<dS)z�Create a new section in the configuration.

        Raise DuplicateSectionError if a section by the specified name
        already exists. Raise ValueError if name is DEFAULT.
        zInvalid section name: %rN)r�r>r�rr�rr�r-r"r"r#�add_section�s

zRawConfigParser.add_sectioncCs
||jkS)z~Indicate whether the named section is present in the configuration.

        The DEFAULT section is not acknowledged.
        )r�r-r"r"r#�has_section�szRawConfigParser.has_sectioncCsJz|j|��}Wntk
r0t|�d�YnX|�|j�t|���S)z9Return a list of option names for the given section name.N)r��copyrmrr�r�r�r�)r r+Zoptsr"r"r#�options�szRawConfigParser.optionsc
Cs�t|tttjf�r|g}g}|D]f}z(t||d��}|�||�W5QRXWntk
rdYq YnXt|tj�r|t�|�}|�	|�q |S)a�Read and parse a filename or an iterable of filenames.

        Files that cannot be opened are silently ignored; this is
        designed so that you can specify an iterable of potential
        configuration file locations (e.g. current directory, user's
        home directory, systemwide directory), and all existing
        configuration files in the iterable will be read.  A single
        filename may also be given.

        Return list of successfully read files.
        )�encoding)
�
isinstance�str�bytes�os�PathLike�open�_read�OSError�fspathr3)r �	filenamesr�Zread_okr@�fpr"r"r#�read�s

zRawConfigParser.readcCs<|dkr,z
|j}Wntk
r*d}YnX|�||�dS)aPLike read() but the argument must be a file-like object.

        The `f' argument must be iterable, returning one line at a time.
        Optional second argument is the `source' specifying the name of the
        file being read. If not given, it is taken from f.name. If `f' has no
        `name' attribute, `<???>' is used.
        Nz<???>)�name�AttributeErrorr�)r �fr8r"r"r#�	read_file�s

zRawConfigParser.read_file�<string>cCst�|�}|�||�dS)z'Read configuration from a given string.N)�io�StringIOr�)r �stringr8Zsfiler"r"r#�read_string�s
zRawConfigParser.read_string�<dict>c
Cs�t�}|��D]�\}}t|�}z|�|�Wn(ttfk
rT|jrP||krP�YnX|�|�|��D]`\}}|�t|��}|dk	r�t|�}|jr�||f|kr�t	|||��|�||f�|�|||�qhqdS)aRead configuration from a dictionary.

        Keys are section names, values are dictionaries with keys and values
        that should be present in the section. If the used dictionary type
        preserves order, sections and their keys will be added in order.

        All types held in the dictionary are converted to strings during
        reading, including section names, option names and keys.

        Optional second argument is the `source' specifying the name of the
        dictionary being read.
        N)
�setr�r�r�rr>r��addrjr)r Z
dictionaryr8�elements_addedr+r��keyrJr"r"r#�	read_dict�s"

zRawConfigParser.read_dictcCs"tjdtdd�|j||d�dS)z"Deprecated, use read_file instead.zRThis method will be removed in future versions.  Use 'parser.read_file()' instead.rBrC)r8N)rFrGrHr�)r r�r@r"r"r#�readfp�s�zRawConfigParser.readfp�rdr�recCs�z|�||�}Wn(tk
r8|tkr,�n|YSYnX|�|�}z||}Wn0tk
r�|tkrtt||��n|YSYnX|s�|dkr�|S|j�|||||�SdS)a]Get an option value for a given section.

        If `vars' is provided, it must be a dictionary. The option is looked up
        in `vars' (if provided), `section', and in `DEFAULTSECT' in that order.
        If the key is not found and `fallback' is provided, it is used as
        a fallback value. `None' can be provided as a `fallback' value.

        If interpolation is enabled and the optional argument `raw' is False,
        all interpolations are expanded in the return values.

        Arguments `raw', `vars', and `fallback' are keyword only.

        The section DEFAULT is special.
        N)�
_unify_valuesrr�rjrmrr�rP)r r+r:rdr�rer�rJr"r"r#rh�s$
�zRawConfigParser.getcKs||j||f|��Sr)rh)r r+�convr:�kwargsr"r"r#�_get"szRawConfigParser._getc	KsJz|j|||f||d�|��WSttfk
rD|tkr<�|YSXdS)N)rdr�)r�rrr�)r r+r:r�rdr�rer�r"r"r#�	_get_conv%s�zRawConfigParser._get_convcKs|j||tf|||d�|��S�Nr�)r��int�r r+r:rdr�rer�r"r"r#�getint0s
��zRawConfigParser.getintcKs|j||tf|||d�|��Sr�)r��floatr�r"r"r#�getfloat5s
��zRawConfigParser.getfloatcKs |j|||jf|||d�|��Sr�)r��_convert_to_booleanr�r"r"r#�
getboolean:s��zRawConfigParser.getbooleancs��tkrt���S�j���z���j��Wn&tk
rV��jkrRt	���YnXt
����}|r�|��D]\}}|���|�<qp���fdd��|r��fdd���fdd�|D�S)a�Return a list of (name, value) tuples for each option in a section.

        All % interpolations are expanded in the return values, based on the
        defaults passed into the constructor, unless the optional argument
        `raw' is true.  Additional substitutions may be provided using the
        `vars' argument, which must be a dictionary whose contents overrides
        any pre-existing defaults.

        The section DEFAULT is special.
        cs�j���|�|��Sr)r�rP�r:)r�r+r r"r#�<lambda>Ws
�z'RawConfigParser.items.<locals>.<lambda>cs�|Srr"r�)r�r"r#r�Z�csg|]}|�|�f�qSr"r")r�r:)�value_getterr"r#�
<listcomp>[sz)RawConfigParser.items.<locals>.<listcomp>)
r��superr�r�r�r�r�rmr�rr�r�rj)r r+rdr�Z	orig_keysr�rJ��	__class__)r�r+r r�r#r�?s 


zRawConfigParser.itemscCs.|��D]}||}||=||fSt�dS)z�Remove a section from the parser and return it as
        a (section_name, section_proxy) tuple. If no section is present, raise
        KeyError.

        The section DEFAULT is never returned because it cannot be removed.
        N)r�rm�r r�rJr"r"r#�popitem]s
zRawConfigParser.popitemcCs|��Sr)�lower)r Z	optionstrr"r"r#rjjszRawConfigParser.optionxformcCsV|r||jkr"|�|�}||jkS||jkr0dS|�|�}||j|kpP||jkSdS)z�Check for the existence of a given option in a given section.
        If the specified `section' is None or an empty string, DEFAULT is
        assumed. If the specified `section' does not exist, returns False.FN)r�rjr�r�)r r+r:r"r"r#�
has_optionms



�zRawConfigParser.has_optioncCsl|r|j�||||�}|r$||jkr,|j}n.z|j|}Wntk
rXt|�d�YnX|||�|�<dS)zSet an option.N)r�rRr�r�r�rmrrj)r r+r:rJ�sectdictr"r"r#r�{s�zRawConfigParser.setcCsh|rd�|jd�}n
|jd}|jr>|�||j|j��|�|jD]}|�|||j|��|�qDdS)z�Write an .ini-format representation of the configuration state.

        If `space_around_delimiters' is True (the default), delimiters
        between keys and values are surrounded by spaces.
        z {} rN)r4r�r��_write_sectionr�r�r�)r r�Zspace_around_delimitersr�r+r"r"r#�write�s

�
�zRawConfigParser.writecCsx|�d�|��|D]T\}}|j�||||�}|dk	s<|jsR|t|��dd�}nd}|�d�||��q|�d�dS)z-Write a single section to the specified `fp'.z[{}]
N�
z
	rz{}{}
)r�r4r�rTr�r�r^)r r�Zsection_nameZ
section_itemsZ	delimiterr�rJr"r"r#r��s�zRawConfigParser._write_sectioncCsd|r||jkr|j}n.z|j|}Wntk
rBt|�d�YnX|�|�}||k}|r`||=|S)zRemove an option.N)r�r�r�rmrrj)r r+r:r��existedr"r"r#�
remove_option�s
zRawConfigParser.remove_optioncCs"||jk}|r|j|=|j|=|S)zRemove a file section.)r�r�)r r+r�r"r"r#�remove_section�s

zRawConfigParser.remove_sectioncCs&||jkr|�|�st|��|j|Sr)r�r�rmr��r r�r"r"r#�__getitem__�szRawConfigParser.__getitem__cCsX||kr|||krdS||jkr.|j��n||jkrF|j|��|�||i�dSr)r�r��clearr�r�r�r"r"r#�__setitem__�s

zRawConfigParser.__setitem__cCs2||jkrtd��|�|�s$t|��|�|�dS)Nz"Cannot remove the default section.)r�r>r�rmr�r�r"r"r#�__delitem__�s


zRawConfigParser.__delitem__cCs||jkp|�|�Sr)r�r�r�r"r"r#�__contains__�szRawConfigParser.__contains__cCst|j�dS)NrV)r~r�r$r"r"r#�__len__�szRawConfigParser.__len__cCst�|jf|j���Sr)�	itertools�chainr�r�r�r$r"r"r#�__iter__�szRawConfigParser.__iter__cCs t�}d}d}d}d}d}d}	t|dd�D�]�\}}
tj}dd�|jD�}|tjkr�|r�i}
|��D]T\}}|
�||d�}|dkr�qd||
|<|dks�|dkrd|
|d��rdt||�}qd|
}qJ|j	D]}|
�
��|�r�d}q�q�|tjkr�d}|
d|��
�}|�sN|j�rF|dk�rL|dk	�rL|�rL||dk	�rL||�
d�q*tj}q*|j�|
�}|�rh|��nd}|dk	�r�|�r�||k�r�||�
|�q*|}|j�|�}|�r<|�d	�}||jk�r�|j�r�||k�r�t|||��|j|}|�|�n@||jk�r
|j}n,|��}||j|<t||�|j|<|�|�d}q*|dk�rTt|||
��q*|j�|�}|�r�|�d
dd�\}}}|�s�|�|	|||
�}	|� |�!��}|j�r�||f|k�r�t"||||��|�||f�|dk	�r�|�
�}|g||<nd||<q*|�|	|||
�}	q*|�#�|	�r|	�dS)
aParse a sectioned configuration file.

        Each section in a configuration file contains a header, indicated by
        a name in square brackets (`[]'), plus key/value options, indicated by
        `name' and `value' delimited with a specific substring (`=' or `:' by
        default).

        Values can span multiple lines, as long as they are indented deeper
        than the first line of the value. Depending on the parser's mode, blank
        lines may be treated as parts of multiline values or ignored.

        Configuration files may include comments, prefixed by specific
        characters (`#' and `;' by default). Comments may appear on their own
        in an otherwise empty line or may be entered in lines holding values or
        section names.
        NrrV)�startcSsi|]
}|d�qS)���r")r�rrr"r"r#�
<dictcomp>�sz)RawConfigParser._read.<locals>.<dictcomp>rr�headerr:�virJ)$r��	enumerate�sys�maxsizer�r�ra�isspace�minr��strip�
startswithr�r3�NONSPACECRE�searchr�SECTCRErirkr�r�rr�r�r�r�rr�r
r��
_handle_errorrj�rstripr�_join_multiline_values)r r��fpnamer�ZcursectZsectnameZoptnamer9Zindent_levelr�rKZ
comment_startZinline_prefixesZ
next_prefixes�prefix�indexrJZfirst_nonspaceZcur_indent_levelZmor	Zoptvalr"r"r#r��s� 


��
��
�




��

zRawConfigParser._readcCsr|j|jf}t�|f|j���}|D]H\}}|��D]6\}}t|t�rTd�|��	�}|j
�||||�||<q4q$dS)Nr�)r�r�rrr�r�r�r�r7rr�rS)r rOZall_sectionsr+r�r��valr"r"r#r[s�
�z&RawConfigParser._join_multiline_valuescCs&|��D]\}}||j|�|�<qdS)zTRead the defaults passed in the initializer.
        Note: values can be non-string.N)r�r�rj)r rOr�rJr"r"r#r�gszRawConfigParser._read_defaultscCs |st|�}|�|t|��|Sr)rr3r2)r �excrr9rKr"r"r#rmszRawConfigParser._handle_errorcCs�i}z|j|}Wn(tk
r:||jkr6t|�d�YnXi}|rt|��D]&\}}|dk	rdt|�}|||�|�<qLt|||j�S)z�Create a sequence of lookups with 'vars' taking priority over
        the 'section' which takes priority over the DEFAULTSECT.

        N)	r�rmr�rr�r�rj�	_ChainMapr�)r r+r�ZsectiondictZvardictr�rJr"r"r#r�ss
zRawConfigParser._unify_valuescCs(|��|jkrtd|��|j|��S)zJReturn a boolean value translating from other types if necessary.
        zNot a boolean: %s)r��BOOLEAN_STATESr>rIr"r"r#r��sz#RawConfigParser._convert_to_booleanr)r+r:rJcCsDt|t�std��t|t�s$td��|jr.|r@t|t�s@td��dS)a�Raises a TypeError for non-string values.

        The only legal non-string value if we allow valueless
        options is None, so we need to check if the value is a
        string if:
        - we do not allow valueless options, or
        - we allow valueless options but the value is not None

        For compatibility reasons this method is not used in classic set()
        for RawConfigParsers. It is invoked in every case for mapping protocol
        access and in ConfigParser.set().
        zsection names must be stringszoption keys must be stringszoption values must be stringsN)r�r��	TypeErrorr��r r+r:rJr"r"r#�_validate_value_types�s



z%RawConfigParser._validate_value_typescCs|jSr)r�r$r"r"r#r��szRawConfigParser.converters)N)N)r�)r�)N)N)T)?r&r'r(r)Z
_SECT_TMPLr�r�rr�rxryr�rr4r�r�rr�
_default_dictrr�rrOr�r�r�r�r�r�r�r�r�rhr�r�r�r�r�r�r�rjr�r�r�r�r�r�r�r�r�rrrr�rr�rr�r�r rLr��
__classcell__r"r"r�r#r0s�

���(	




	%����




zcs<eZdZdZe�Zd	�fdd�	Z�fdd�Zdd�Z�Z	S)
rz(ConfigParser implementing interpolation.Ncs"|j||d�t��|||�dS)zmSet an option.  Extends RawConfigParser.set by validating type and
        interpolation syntax on the value.�r:rJN)r r�r�rr�r"r#r��szConfigParser.setcs|j|d�t��|�dS)z�Create a new section in the configuration.  Extends
        RawConfigParser.add_section by validating if the section name is
        a string.)r+N)r r�r�r-r�r"r#r��szConfigParser.add_sectioncCs0z"|j}t�|_|�|j|i�W5||_XdS)z�Reads the defaults passed in the initializer, implicitly converting
        values to strings like the rest of the API.

        Does not perform interpolation for backwards compatibility.
        N)r�rr�r�)r rOZhold_interpolationr"r"r#r��s
zConfigParser._read_defaults)N)
r&r'r(r)rr�r�r�r�r"r"r"r�r#r�s
cs eZdZdZ�fdd�Z�ZS)rz8ConfigParser alias for backwards compatibility purposes.cs"t�j||�tjdtdd�dS)Nz�The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.rBrC)r�rrFrGrH)r r,r�r�r"r#r�s�zSafeConfigParser.__init__)r&r'r(r)rr"r"r"r�r#r�sc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Ze
dd��Ze
dd��Zddddd�dd�ZdS)rz+A proxy for a single section from a parser.cCsF||_||_|jD].}d|}tj|jt||�d�}t|||�qdS)z@Creates a view on a section of the specified `name` in `parser`.rh��_implN)�_parser�_namer�r�r�rh�getattr�setattr)r rNr�r�r��getterr"r"r#r�s
zSectionProxy.__init__cCsd�|j�S)Nz
<Section: {}>)r4r'r$r"r"r#r%�szSectionProxy.__repr__cCs(|j�|j|�st|��|j�|j|�Sr)r&r�r'rmrhr�r"r"r#r��szSectionProxy.__getitem__cCs"|jj||d�|j�|j||�S)Nr#)r&r r�r'r�r"r"r#r��szSectionProxy.__setitem__cCs,|j�|j|�r |j�|j|�s(t|��dSr)r&r�r'r�rmr�r"r"r#r��s�zSectionProxy.__delitem__cCs|j�|j|�Sr)r&r�r'r�r"r"r#r�szSectionProxy.__contains__cCst|���Sr)r~�_optionsr$r"r"r#r�szSectionProxy.__len__cCs|����Sr)r+rr$r"r"r#r�szSectionProxy.__iter__cCs*|j|jjkr|j�|j�S|j��SdSr)r'r&r�r�rOr$r"r"r#r+�szSectionProxy._optionscCs|jSr)r&r$r"r"r#rNszSectionProxy.parsercCs|jSr)r'r$r"r"r#r�szSectionProxy.nameNF)rdr�r%cKs(|s|jj}||j|f|||d�|��S)z�Get an option value.

        Unless `fallback` is provided, `None` will be returned if the option
        is not found.

        r�)r&rhr')r r:rerdr�r%r�r"r"r#rhs
��zSectionProxy.get)N)r&r'r(r)rr%r�r�r�rrrr+rLrNr�rhr"r"r"r#r�s"	

�c@sJeZdZdZe�d�Zdd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�ZdS)ra/Enables reuse of get*() methods between the parser and section proxies.

    If a parser class implements a getter directly, the value for the given
    key will be ``None``. The presence of the converter name here enables
    section proxies to find and use the implementation on the parser class.
    z^get(?P<name>.+)$cCsR||_i|_t|j�D]6}|j�|�}|rtt|j|��s<qd|j|�d�<qdS)Nr�)r&�_data�dir�	GETTERCREri�callabler(rk)r rNr*rtr"r"r#r%szConverterMapping.__init__cCs
|j|Sr)r,r�r"r"r#r�.szConverterMapping.__getitem__c	Cs�zd|}Wn(tk
r4td�|t|����YnX|dkrFtd��||j|<tj|jj|d�}||_	t
|j||�|j��D] }tj|j|d�}t
|||�q�dS)NrhzIncompatible key: {} (type: {})z)Incompatible key: cannot use "" as a name)r�r$)
rr>r4�typer,r�r�r&r�Z	converterr)�valuesrh)r r�rJ�k�func�proxyr*r"r"r#r�1s �
zConverterMapping.__setitem__c	Cs~zd|p
d}Wntk
r,t|��YnX|j|=t�|jf|j���D],}zt||�WqLtk
rvYqLYqLXqLdS)Nrh)	rrmr,rrr&r1�delattrr�)r r�r2�instr"r"r#r�AszConverterMapping.__delitem__cCs
t|j�Sr)�iterr,r$r"r"r#rOszConverterMapping.__iter__cCs
t|j�Sr)r~r,r$r"r"r#rRszConverterMapping.__len__N)
r&r'r(r)rxryr.rr�r�r�rrr"r"r"r#rs
	))r)Zcollections.abcr�collectionsrrr�r�rr�rxrrF�__all__rr!rrrrrrrrrr
rr	rr
�objectr�rrrrrrrrrr"r"r"r#�<module>st
�	
	

+HJ&| 
F_pyio.cpython-38.pyc000064400000220541150335716500010324 0ustar00U

e5d�k�@s|dZddlZddlZddlZddlZddlZddlZddlmZ	ej
dkrXddlmZ
ndZ
ddlZddlmZmZmZmZdddhZeed	�r�e�ej�e�ej�d
ZeZeed�p�ejjZd7dd�Zdd�Zz
ejZWne k
�r�eZYnXGdd�d�Z!Gdd�d�Z"z
ej#Z#Wn(e k
�rHGdd�de$e%�Z#YnXGdd�dej&d�Z'ej'�(e'�Gdd�de'�Z)ej)�(e)�ddl*m+Z+e)�(e+�Gdd �d e'�Z,ej,�(e,�Gd!d"�d"e,�Z-Gd#d$�d$e,�Z.Gd%d&�d&e-�Z/Gd'd(�d(e-�Z0Gd)d*�d*e,�Z1Gd+d,�d,e0e/�Z2Gd-d.�d.e)�Z+Gd/d0�d0e'�Z3ej3�(e3�Gd1d2�d2ej4�Z5Gd3d4�d4e3�Z6Gd5d6�d6e6�Z7dS)8z)
Python implementation of the io module.
�N)�
allocate_lock>�win32�cygwin)�setmode)�__all__�SEEK_SET�SEEK_CUR�SEEK_END���	SEEK_HOLEi Zgettotalrefcount�r���Tc	Cs�t|t�st�|�}t|tttf�s0td|��t|t�sFtd|��t|t�s\td|��|dk	rzt|t�sztd|��|dk	r�t|t�s�td|��t|�}|td�s�t|�t|�kr�t	d|��d|k}	d	|k}
d
|k}d|k}d|k}
d
|k}d|k}d|k�rD|	�s"|�s"|�s"|
�r*t	d��ddl
}|�dtd�d}
|�rX|�rXt	d��|	|
||dk�rvt	d��|	�s�|
�s�|�s�|�s�t	d��|�r�|dk	�r�t	d��|�r�|dk	�r�t	d��|�r�|dk	�r�t	d��|�r|dk�rddl
}|�dt
d�t||	�rd�pd|
�r"d	�p$d|�r2d
�p4d|�rBd�pDd|
�rRd�pTd||d�}|}�z$d}|dk�s�|dk�r�|���r�d }d}|dk�r�t}zt�|���j}Wnttfk
�r�YnX|dk�r�|}|dk�r�t	d!��|dk�r|�r|WSt	d"��|
�r t||�}n<|	�s2|�s2|�r>t||�}n|
�rPt||�}nt	d#|��|}|�rl|WSt|||||�}|}||_|WS|���YnXdS)$a�Open file and return a stream.  Raise OSError upon failure.

    file is either a text or byte string giving the name (and the path
    if the file isn't in the current working directory) of the file to
    be opened or an integer file descriptor of the file to be
    wrapped. (If a file descriptor is given, it is closed when the
    returned I/O object is closed, unless closefd is set to False.)

    mode is an optional string that specifies the mode in which the file is
    opened. It defaults to 'r' which means open for reading in text mode. Other
    common values are 'w' for writing (truncating the file if it already
    exists), 'x' for exclusive creation of a new file, and 'a' for appending
    (which on some Unix systems, means that all writes append to the end of the
    file regardless of the current seek position). In text mode, if encoding is
    not specified the encoding used is platform dependent. (For reading and
    writing raw bytes use binary mode and leave encoding unspecified.) The
    available modes are:

    ========= ===============================================================
    Character Meaning
    --------- ---------------------------------------------------------------
    'r'       open for reading (default)
    'w'       open for writing, truncating the file first
    'x'       create a new file and open it for writing
    'a'       open for writing, appending to the end of the file if it exists
    'b'       binary mode
    't'       text mode (default)
    '+'       open a disk file for updating (reading and writing)
    'U'       universal newline mode (deprecated)
    ========= ===============================================================

    The default mode is 'rt' (open for reading text). For binary random
    access, the mode 'w+b' opens and truncates the file to 0 bytes, while
    'r+b' opens the file without truncation. The 'x' mode implies 'w' and
    raises an `FileExistsError` if the file already exists.

    Python distinguishes between files opened in binary and text modes,
    even when the underlying operating system doesn't. Files opened in
    binary mode (appending 'b' to the mode argument) return contents as
    bytes objects without any decoding. In text mode (the default, or when
    't' is appended to the mode argument), the contents of the file are
    returned as strings, the bytes having been first decoded using a
    platform-dependent encoding or using the specified encoding if given.

    'U' mode is deprecated and will raise an exception in future versions
    of Python.  It has no effect in Python 3.  Use newline to control
    universal newlines mode.

    buffering is an optional integer used to set the buffering policy.
    Pass 0 to switch buffering off (only allowed in binary mode), 1 to select
    line buffering (only usable in text mode), and an integer > 1 to indicate
    the size of a fixed-size chunk buffer.  When no buffering argument is
    given, the default buffering policy works as follows:

    * Binary files are buffered in fixed-size chunks; the size of the buffer
      is chosen using a heuristic trying to determine the underlying device's
      "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
      On many systems, the buffer will typically be 4096 or 8192 bytes long.

    * "Interactive" text files (files for which isatty() returns True)
      use line buffering.  Other text files use the policy described above
      for binary files.

    encoding is the str name of the encoding used to decode or encode the
    file. This should only be used in text mode. The default encoding is
    platform dependent, but any encoding supported by Python can be
    passed.  See the codecs module for the list of supported encodings.

    errors is an optional string that specifies how encoding errors are to
    be handled---this argument should not be used in binary mode. Pass
    'strict' to raise a ValueError exception if there is an encoding error
    (the default of None has the same effect), or pass 'ignore' to ignore
    errors. (Note that ignoring encoding errors can lead to data loss.)
    See the documentation for codecs.register for a list of the permitted
    encoding error strings.

    newline is a string controlling how universal newlines works (it only
    applies to text mode). It can be None, '', '\n', '\r', and '\r\n'.  It works
    as follows:

    * On input, if newline is None, universal newlines mode is
      enabled. Lines in the input can end in '\n', '\r', or '\r\n', and
      these are translated into '\n' before being returned to the
      caller. If it is '', universal newline mode is enabled, but line
      endings are returned to the caller untranslated. If it has any of
      the other legal values, input lines are only terminated by the given
      string, and the line ending is returned to the caller untranslated.

    * On output, if newline is None, any '\n' characters written are
      translated to the system default line separator, os.linesep. If
      newline is '', no translation takes place. If newline is any of the
      other legal values, any '\n' characters written are translated to
      the given string.

    closedfd is a bool. If closefd is False, the underlying file descriptor will
    be kept open when the file is closed. This does not work when a file name is
    given and must be True in that case.

    The newly created file is non-inheritable.

    A custom opener can be used by passing a callable as *opener*. The
    underlying file descriptor for the file object is then obtained by calling
    *opener* with (*file*, *flags*). *opener* must return an open file
    descriptor (passing os.open as *opener* results in functionality similar to
    passing None).

    open() returns a file object whose type depends on the mode, and
    through which the standard file operations such as reading and writing
    are performed. When open() is used to open a file in a text mode ('w',
    'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open
    a file in a binary mode, the returned class varies: in read binary
    mode, it returns a BufferedReader; in write binary and append binary
    modes, it returns a BufferedWriter, and in read/write mode, it returns
    a BufferedRandom.

    It is also possible to use a string or bytearray as a file for both
    reading and writing. For strings StringIO can be used like a file
    opened in a text mode, and for bytes a BytesIO can be used like a file
    opened in a binary mode.
    zinvalid file: %rzinvalid mode: %rzinvalid buffering: %rN�invalid encoding: %r�invalid errors: %rzaxrwb+tU�xr
�w�a�+�t�b�Uz4mode U cannot be combined with 'x', 'w', 'a', or '+'rz'U' mode is deprecatedrTz'can't have text and binary mode at oncer
z)can't have read/write/append mode at oncez/must have exactly one of read/write/append modez-binary mode doesn't take an encoding argumentz+binary mode doesn't take an errors argumentz+binary mode doesn't take a newline argumentzaline buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used�)�openerFrzinvalid buffering sizezcan't have unbuffered text I/Ozunknown mode: %r)�
isinstance�int�os�fspath�str�bytes�	TypeError�set�len�
ValueError�warnings�warn�DeprecationWarning�RuntimeWarning�FileIO�isatty�DEFAULT_BUFFER_SIZE�fstat�fileno�
st_blksize�OSError�AttributeError�BufferedRandom�BufferedWriter�BufferedReader�
TextIOWrapper�mode�close)�filer4�	buffering�encoding�errors�newline�closefdrZmodesZcreatingZreadingZwritingZ	appendingZupdating�textZbinaryr$�raw�result�line_bufferingZbs�buffer�rA�/usr/lib64/python3.8/_pyio.py�open)s�{




�������



rCcCs ddl}|�dtd�t|d�S)azOpens the provided file with mode ``'rb'``. This function
    should be used when the intent is to treat the contents as
    executable code.

    ``path`` should be an absolute path.

    When supported by the runtime, this function can be hooked
    in order to allow embedders more control over code files.
    This functionality is not supported on the current runtime.
    rNz(_pyio.open_code() may not be using hooksr�rb)r$r%r'rC)�pathr$rArArB�_open_code_with_warnings�rFc@seZdZdZddd�ZdS)�
DocDescriptorz%Helper for builtins.open.__doc__
    NcCs
dtjS)Nz\open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True)

)rC�__doc__)�self�obj�typrArArB�__get__s��zDocDescriptor.__get__)N)�__name__�
__module__�__qualname__rHrLrArArArBrGsrGc@seZdZdZe�Zdd�ZdS)�OpenWrapperz�Wrapper for builtins.open

    Trick so that open won't become a bound method when stored
    as a class variable (as dbm.dumb does).

    See initstdio() in Python/pylifecycle.c.
    cOs
t||�S�N)rC)�cls�args�kwargsrArArB�__new__,szOpenWrapper.__new__N)rMrNrOrHrGrUrArArArBrP"srPc@seZdZdS)�UnsupportedOperationN)rMrNrOrArArArBrV5srVc@s�eZdZdZdd�Zd6dd�Zdd�Zd7d
d�Zdd
�ZdZ	dd�Z
dd�Zdd�Zd8dd�Z
dd�Zd9dd�Zdd�Zd:dd�Zedd ��Zd;d!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd<d,d-�Zd.d/�Zd0d1�Zd=d2d3�Zd4d5�Zd	S)>�IOBaseaThe abstract base class for all I/O classes, acting on streams of
    bytes. There is no public constructor.

    This class provides dummy implementations for many methods that
    derived classes can override selectively; the default implementations
    represent a file that cannot be read, written or seeked.

    Even though IOBase does not declare read or write because
    their signatures will vary, implementations and clients should
    consider those methods part of the interface. Also, implementations
    may raise UnsupportedOperation when operations they do not support are
    called.

    The basic type used for binary data read from or written to a file is
    bytes. Other bytes-like objects are accepted as method arguments too.
    Text I/O classes work with str data.

    Note that calling any method (even inquiries) on a closed stream is
    undefined. Implementations may raise OSError in this case.

    IOBase (and its subclasses) support the iterator protocol, meaning
    that an IOBase object can be iterated over yielding the lines in a
    stream.

    IOBase also supports the :keyword:`with` statement. In this example,
    fp is closed after the suite of the with statement is complete:

    with open('spam.txt', 'r') as fp:
        fp.write('Spam and eggs!')
    cCstd|jj|f��dS)z@Internal: raise an OSError exception for unsupported operations.z%s.%s() not supportedN)rV�	__class__rM)rI�namerArArB�_unsupported\s
�zIOBase._unsupportedrcCs|�d�dS)a$Change stream position.

        Change the stream position to byte offset pos. Argument pos is
        interpreted relative to the position indicated by whence.  Values
        for whence are ints:

        * 0 -- start of stream (the default); offset should be zero or positive
        * 1 -- current stream position; offset may be negative
        * 2 -- end of stream; offset is usually negative
        Some operating systems / file systems could provide additional values.

        Return an int indicating the new absolute position.
        �seekN�rZ�rI�pos�whencerArArBr[cszIOBase.seekcCs|�dd�S)z5Return an int indicating the current stream position.rr
)r[�rIrArArB�tellsszIOBase.tellNcCs|�d�dS)z�Truncate file to size bytes.

        Size defaults to the current IO position as reported by tell().  Return
        the new size.
        �truncateNr\�rIr^rArArBrbwszIOBase.truncatecCs|��dS)zuFlush write buffers, if applicable.

        This is not implemented for read-only and non-blocking streams.
        N��_checkClosedr`rArArB�flush�szIOBase.flushFcCs |jsz|��W5d|_XdS)ziFlush and close the IO object.

        This method has no effect if the file is already closed.
        TN)�_IOBase__closedrfr`rArArBr5�szIOBase.closecCsVz
|j}Wntk
r YdSX|r*dStr8|��nz|��WnYnXdS)zDestructor.  Calls close().N)�closedr/�_IOBASE_EMITS_UNRAISABLEr5)rIrhrArArB�__del__�s

zIOBase.__del__cCsdS)z�Return a bool indicating whether object supports random access.

        If False, seek(), tell() and truncate() will raise OSError.
        This method may need to do a test seek().
        FrAr`rArArB�seekable�szIOBase.seekablecCs |��st|dkrdn|��dS)zEInternal: raise UnsupportedOperation if file is not seekable
        NzFile or stream is not seekable.)rkrV�rI�msgrArArB�_checkSeekable�s��zIOBase._checkSeekablecCsdS)zvReturn a bool indicating whether object was opened for reading.

        If False, read() will raise OSError.
        FrAr`rArArB�readable�szIOBase.readablecCs |��st|dkrdn|��dS)zEInternal: raise UnsupportedOperation if file is not readable
        NzFile or stream is not readable.)rorVrlrArArB�_checkReadable�s��zIOBase._checkReadablecCsdS)z�Return a bool indicating whether object was opened for writing.

        If False, write() and truncate() will raise OSError.
        FrAr`rArArB�writable�szIOBase.writablecCs |��st|dkrdn|��dS)zEInternal: raise UnsupportedOperation if file is not writable
        NzFile or stream is not writable.)rqrVrlrArArB�_checkWritable�s��zIOBase._checkWritablecCs|jS)z�closed: bool.  True iff the file has been closed.

        For backwards compatibility, this is a property, not a predicate.
        )rgr`rArArBrh�sz
IOBase.closedcCs|jrt|dkrdn|��dS)z7Internal: raise a ValueError if file is closed
        N�I/O operation on closed file.�rhr#rlrArArBre�s��zIOBase._checkClosedcCs|��|S)zCContext management protocol.  Returns self (an instance of IOBase).rdr`rArArB�	__enter__�szIOBase.__enter__cGs|��dS)z+Context management protocol.  Calls close()N)r5)rIrSrArArB�__exit__�szIOBase.__exit__cCs|�d�dS)z�Returns underlying file descriptor (an int) if one exists.

        An OSError is raised if the IO object does not use a file descriptor.
        r,Nr\r`rArArBr,�sz
IOBase.filenocCs|��dS)z{Return a bool indicating whether this is an 'interactive' stream.

        Return False if it can't be determined.
        Frdr`rArArBr)sz
IOBase.isattyrcs�t�d�r��fdd�}ndd�}�dkr0d�n4z
�j}Wn"tk
r\t��d���YnX|��t�}�dks~t|��kr���|��}|s�q�||7}|�d	�rjq�qjt|�S)
aNRead and return a line of bytes from the stream.

        If size is specified, at most size bytes will be read.
        Size should be an int.

        The line terminator is always b'\n' for binary files; for text
        files, the newlines argument to open can be used to select the line
        terminator(s) recognized.
        �peekcs>��d�}|sdS|�d�dp&t|�}�dkr:t|��}|S)Nr
�
r)rw�findr"�min)Z	readahead�n�rI�sizerArB�
nreadaheads

z#IOBase.readline.<locals>.nreadaheadcSsdS�Nr
rArArArArBr~ sNr� is not an integerrrx)	�hasattr�	__index__r/r �	bytearrayr"�read�endswithr)rIr}r~�
size_index�resrrAr|rB�readlines&
	

zIOBase.readlinecCs|��|SrQrdr`rArArB�__iter__5szIOBase.__iter__cCs|��}|st�|SrQ)r��
StopIteration�rI�linerArArB�__next__9szIOBase.__next__cCsP|dks|dkrt|�Sd}g}|D]&}|�|�|t|�7}||kr$qLq$|S)z�Return a list of lines from the stream.

        hint can be specified to control the number of lines read: no more
        lines will be read if the total size (in bytes/characters) of all
        lines so far exceeds hint.
        Nr)�list�appendr")rIZhintr{�linesr�rArArB�	readlines?s
zIOBase.readlinescCs |��|D]}|�|�qdS)z�Write a list of lines to the stream.

        Line separators are not added, so it is usual for each of the lines
        provided to have a line separator at the end.
        N)re�write)rIr�r�rArArB�
writelinesQszIOBase.writelines)r)N)N)N)N)N)r)N)rMrNrOrHrZr[rarbrfrgr5rjrkrnrorprqrr�propertyrhrerurvr,r)r�r�r�r�r�rArArArBrW9s6!







	

*
rW)�	metaclassc@s2eZdZdZddd�Zdd�Zdd�Zd	d
�ZdS)
�	RawIOBasezBase class for raw binary I/O.rcCsP|dkrd}|dkr|��St|���}|�|�}|dkr>dS||d�=t|�S)z�Read and return up to size bytes, where size is an int.

        Returns an empty bytes object on EOF, or None if the object is
        set not to block and has no data to read.
        Nrr)�readallr�r��readintor)rIr}rr{rArArBr�ls

zRawIOBase.readcCs4t�}|�t�}|sq ||7}q|r,t|�S|SdS)z+Read until EOF, using multiple read() call.N)r�r�r*r)rIr��datarArArBr�}s

zRawIOBase.readallcCs|�d�dS)z�Read bytes into a pre-allocated bytes-like object b.

        Returns an int representing the number of bytes read (0 for EOF), or
        None if the object is set not to block and has no data to read.
        r�Nr\�rIrrArArBr��szRawIOBase.readintocCs|�d�dS)z�Write the given buffer to the IO stream.

        Returns the number of bytes written, which may be less than the
        length of b in bytes.
        r�Nr\r�rArArBr��szRawIOBase.writeN)r)rMrNrOrHr�r�r�r�rArArArBr�^s

r�)r(c@sLeZdZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�BufferedIOBaseaBase class for buffered IO objects.

    The main difference with RawIOBase is that the read() method
    supports omitting the size argument, and does not have a default
    implementation that defers to readinto().

    In addition, read(), readinto() and write() may raise
    BlockingIOError if the underlying raw stream is in non-blocking
    mode and not ready; unlike their raw counterparts, they will never
    return None.

    A typical implementation should not inherit from a RawIOBase
    implementation, but wrap one.
    rcCs|�d�dS)a�Read and return up to size bytes, where size is an int.

        If the argument is omitted, None, or negative, reads and
        returns all data until EOF.

        If the argument is positive, and the underlying raw stream is
        not 'interactive', multiple raw reads may be issued to satisfy
        the byte count (unless EOF is reached first).  But for
        interactive raw streams (XXX and for pipes?), at most one raw
        read will be issued, and a short result does not imply that
        EOF is imminent.

        Returns an empty bytes array on EOF.

        Raises BlockingIOError if the underlying raw stream has no
        data at the moment.
        r�Nr\r|rArArBr��szBufferedIOBase.readcCs|�d�dS)zaRead up to size bytes with at most one read() system call,
        where size is an int.
        �read1Nr\r|rArArBr��szBufferedIOBase.read1cCs|j|dd�S)afRead bytes into a pre-allocated bytes-like object b.

        Like read(), this may issue multiple reads to the underlying raw
        stream, unless the latter is 'interactive'.

        Returns an int representing the number of bytes read (0 for EOF).

        Raises BlockingIOError if the underlying raw stream has no
        data at the moment.
        F�r���	_readintor�rArArBr��szBufferedIOBase.readintocCs|j|dd�S)z�Read bytes into buffer *b*, using at most one system call

        Returns an int representing the number of bytes read (0 for EOF).

        Raises BlockingIOError if the underlying raw stream has no
        data at the moment.
        Tr�r�r�rArArB�	readinto1�s	zBufferedIOBase.readinto1cCsVt|t�st|�}|�d�}|r0|�t|��}n|�t|��}t|�}||d|�<|S)N�B)r�
memoryview�castr�r"r�)rIrr�r�r{rArArBr��s

zBufferedIOBase._readintocCs|�d�dS)aWrite the given bytes buffer to the IO stream.

        Return the number of bytes written, which is always the length of b
        in bytes.

        Raises BlockingIOError if the buffer is full and the
        underlying raw stream cannot accept more data at the moment.
        r�Nr\r�rArArBr��s	zBufferedIOBase.writecCs|�d�dS)z�
        Separate the underlying raw stream from the buffer and return it.

        After the raw stream has been detached, the buffer is in an unusable
        state.
        �detachNr\r`rArArBr��szBufferedIOBase.detachN)r)r)rMrNrOrHr�r�r�r�r�r�r�rArArArBr��s

r�c@s�eZdZdZdd�Zd$dd�Zdd�Zd%d
d�Zdd
�Zdd�Z	dd�Z
dd�Zedd��Z
edd��Zedd��Zedd��Zdd�Zdd�Zd d!�Zd"d#�Zd	S)&�_BufferedIOMixinz�A mixin implementation of BufferedIOBase with an underlying raw stream.

    This passes most requests on to the underlying raw stream.  It
    does *not* provide implementations of read(), readinto() or
    write().
    cCs
||_dSrQ��_raw�rIr=rArArB�__init__sz_BufferedIOMixin.__init__rcCs"|j�||�}|dkrtd��|S)Nrz#seek() returned an invalid position)r=r[r.)rIr^r_Znew_positionrArArBr[sz_BufferedIOMixin.seekcCs|j��}|dkrtd��|S)Nrz#tell() returned an invalid position)r=rar.rcrArArBras
z_BufferedIOMixin.tellNcCs$|��|dkr|��}|j�|�SrQ)rfrar=rbrcrArArBrb$sz_BufferedIOMixin.truncatecCs|jrtd��|j��dS)N�flush on closed file)rhr#r=rfr`rArArBrf2sz_BufferedIOMixin.flushcCs.|jdk	r*|js*z|��W5|j��XdSrQ)r=rhr5rfr`rArArBr57sz_BufferedIOMixin.closecCs*|jdkrtd��|��|j}d|_|S)Nzraw stream already detached)r=r#rfr�r�rArArBr�?s
z_BufferedIOMixin.detachcCs
|j��SrQ)r=rkr`rArArBrkIsz_BufferedIOMixin.seekablecCs|jSrQr�r`rArArBr=Lsz_BufferedIOMixin.rawcCs|jjSrQ)r=rhr`rArArBrhPsz_BufferedIOMixin.closedcCs|jjSrQ)r=rYr`rArArBrYTsz_BufferedIOMixin.namecCs|jjSrQ)r=r4r`rArArBr4Xsz_BufferedIOMixin.modecCstd|jj�d���dS�Nzcannot pickle z object�r rXrMr`rArArB�__getstate__\sz_BufferedIOMixin.__getstate__cCsN|jj}|jj}z
|j}Wn tk
r:d�||�YSXd�|||�SdS)Nz<{}.{}>z<{}.{} name={!r}>)rXrNrOrYr/�format)rI�modnameZclsnamerYrArArB�__repr___s
z_BufferedIOMixin.__repr__cCs
|j��SrQ)r=r,r`rArArBr,ksz_BufferedIOMixin.filenocCs
|j��SrQ)r=r)r`rArArBr)nsz_BufferedIOMixin.isatty)r)N)rMrNrOrHr�r[rarbrfr5r�rkr�r=rhrYr4r�r�r,r)rArArArBr�
s*






r�cs�eZdZdZdZd!dd�Zdd�Zdd�Zd	d
�Z�fdd�Z	d"dd�Z
d#dd�Zdd�Zd$dd�Z
dd�Zd%dd�Zdd�Zdd�Zdd �Z�ZS)&�BytesIOz<Buffered I/O implementation using an in-memory bytes buffer.NcCs&t�}|dk	r||7}||_d|_dS�Nr)r��_buffer�_pos)rIZ
initial_bytes�bufrArArBr�zs
zBytesIO.__init__cCs|jrtd��|j��S)Nz__getstate__ on closed file)rhr#�__dict__�copyr`rArArBr��szBytesIO.__getstate__cCs|jrtd��t|j�S)z8Return the bytes value (contents) of the buffer
        zgetvalue on closed file)rhr#rr�r`rArArB�getvalue�szBytesIO.getvaluecCs|jrtd��t|j�S)z;Return a readable and writable view of the buffer.
        zgetbuffer on closed file)rhr#r�r�r`rArArB�	getbuffer�szBytesIO.getbuffercs"|jdk	r|j��t���dSrQ)r��clear�superr5r`�rXrArBr5�s

z
BytesIO.closercCs�|jrtd��|dkrd}n4z
|j}Wn"tk
rHt|�d���YnX|�}|dkrbt|j�}t|j�|jkrvdStt|j�|j|�}|j|j|�}||_t	|�S)N�read from closed filerr�r�)
rhr#r�r/r r"r�r�rzr)rIr}r�ZnewposrrArArBr��s"

zBytesIO.readcCs
|�|�S)z"This is the same as read.
        )r�r|rArArBr��sz
BytesIO.read1c	Cs�|jrtd��t|t�r td��t|��}|j}W5QRX|dkrFdS|j}|t|j	�krzd|t|j	�}|j	|7_	||j	|||�<|j|7_|S)N�write to closed file� can't write str to binary streamr�)
rhr#rrr r��nbytesr�r"r�)rIrZviewr{r^ZpaddingrArArBr��s

z
BytesIO.writercCs�|jrtd��z
|j}Wn"tk
r:t|�d���YnX|�}|dkrh|dkr`td|f��||_nD|dkr�td|j|�|_n(|dkr�tdt|j�|�|_ntd��|jS)Nzseek on closed filer�r�negative seek position %rr
rzunsupported whence value)	rhr#r�r/r r��maxr"r�)rIr^r_�	pos_indexrArArBr[�s"
zBytesIO.seekcCs|jrtd��|jS)N�tell on closed file)rhr#r�r`rArArBra�szBytesIO.tellcCsx|jrtd��|dkr|j}nJz
|j}Wn"tk
rJt|�d���YnX|�}|dkrhtd|f��|j|d�=|S)Nztruncate on closed filer�rznegative truncate position %r)rhr#r�r�r/r r�)rIr^r�rArArBrb�s
zBytesIO.truncatecCs|jrtd��dS�NrsTrtr`rArArBro�szBytesIO.readablecCs|jrtd��dSr�rtr`rArArBrq�szBytesIO.writablecCs|jrtd��dSr�rtr`rArArBrk�szBytesIO.seekable)N)r)r)r)N)rMrNrOrHr�r�r�r�r�r5r�r�r�r[rarbrorqrk�
__classcell__rArAr�rBr�rs 




r�c@sxeZdZdZefdd�Zdd�Zdd�Zdd	d
�Zddd�Z	ddd�Z
ddd�Zddd�Zdd�Z
dd�Zd dd�ZdS)!r2aBufferedReader(raw[, buffer_size])

    A buffer for a readable, sequential BaseRawIO object.

    The constructor creates a BufferedReader for the given readable raw
    stream and buffer_size. If buffer_size is omitted, DEFAULT_BUFFER_SIZE
    is used.
    cCsF|��std��t�||�|dkr,td��||_|��t�|_dS)zMCreate a new buffered reader using the given readable raw IO object.
        z "raw" argument must be readable.r�invalid buffer sizeN)	ror.r�r�r#�buffer_size�_reset_read_buf�Lock�
_read_lock�rIr=r�rArArBr�szBufferedReader.__init__cCs
|j��SrQ)r=ror`rArArBroszBufferedReader.readablecCsd|_d|_dS)Nr�r)�	_read_buf�	_read_posr`rArArBr�szBufferedReader._reset_read_bufNc
Cs@|dk	r|dkrtd��|j�|�|�W5QR�SQRXdS)z�Read size bytes.

        Returns exactly size bytes of data unless the underlying raw IO
        stream reaches EOF or if the call would block in non-blocking
        mode. If size is negative, read until EOF or until read() would
        block.
        Nrzinvalid number of bytes to read)r#r��_read_unlockedr|rArArBr� szBufferedReader.readcCs�d}d}|j}|j}|dks$|dkr�|��t|jd�rj|j��}|dkrZ||d�pXdS||d�|S||d�g}d}|j��}||kr�|}q�|t|�7}|�|�q|d�	|�p�|St|�|}	||	kr�|j|7_||||�S||d�g}t
|j|�}
|	|k�rH|j�|
�}||k�r.|}�qH|	t|�7}	|�|��qt||	�}d�	|�}||d�|_d|_|�r�|d|�S|S)Nr�)r�Nrr�r)
r�r�r�r�r=r�r�r"r��joinr�r�rz)rIr{Z
nodata_valZempty_valuesr�r^�chunkZchunksZcurrent_size�availZwanted�outrArArBr�-sL





zBufferedReader._read_unlockedrc
Cs(|j�|�|�W5QR�SQRXdS)z�Returns buffered bytes without advancing the position.

        The argument indicates a desired minimal number of bytes; we
        do at most one raw read to satisfy it.  We never return more
        than self.buffer_size.
        N)r��_peek_unlockedr|rArArBrwaszBufferedReader.peekcCsrt||j�}t|j�|j}||ks,|dkrb|j|}|j�|�}|rb|j|jd�||_d|_|j|jd�Sr�)rzr�r"r�r�r=r�)rIr{ZwantZhaveZto_readZcurrentrArArBr�ks
zBufferedReader._peek_unlockedrc
Cs^|dkr|j}|dkrdS|j�4|�d�|�t|t|j�|j��W5QR�SQRXdS)z<Reads up to size bytes, with at most one read() system call.rr�r
N)r�r�r�r�rzr"r�r�r|rArArBr�vs
�zBufferedReader.read1c	Cs
t|t�st|�}|jdkr dS|�d�}d}|j��|t|�kr�tt|j�|jt|��}|r�|j|j|j|�||||�<|j|7_||7}|t|�kr�q�t|�||j	kr�|j
�||d��}|s�q�||7}n|r�|s�|�d�s�q�|r6|r6q�q6W5QRX|S)z2Read data into *buf* with at most one system call.rr�Nr
)
rr�r�r�r�r"rzr�r�r�r=r�r�)rIr�r��writtenr�r{rArArBr��s6


�

zBufferedReader._readintocCst�|�t|j�|jSrQ)r�rar"r�r�r`rArArBra�szBufferedReader.tellc
Csd|tkrtd��|j�D|dkr4|t|j�|j8}t�|||�}|��|W5QR�SQRXdS)N�invalid whence valuer
)	�valid_seek_flagsr#r�r"r�r�r�r[r�r]rArArBr[�szBufferedReader.seek)N)N)r)r)r)r)rMrNrOrHr*r�ror�r�r�rwr�r�r�rar[rArArArBr2s	


4



.r2c@s`eZdZdZefdd�Zdd�Zdd�Zdd	d
�Zdd�Z	d
d�Z
dd�Zddd�Zdd�Z
dS)r1z�A buffer for a writeable sequential RawIO object.

    The constructor creates a BufferedWriter for the given writeable raw
    stream. If the buffer_size is not given, it defaults to
    DEFAULT_BUFFER_SIZE.
    cCsF|��std��t�||�|dkr,td��||_t�|_t�|_	dS)Nz "raw" argument must be writable.rr�)
rqr.r�r�r#r�r��
_write_bufr��_write_lockr�rArArBr��szBufferedWriter.__init__cCs
|j��SrQ)r=rqr`rArArBrq�szBufferedWriter.writablecCst|t�rtd��|j��|jr(td��t|j�|jkr@|�	�t|j�}|j�
|�t|j�|}t|j�|jkr�z|�	�Wnltk
r�}zNt|j�|jkr�t|j�|j}||8}|jd|j�|_t|j|j
|��W5d}~XYnX|W5QR�SQRXdS)Nr�r�)rrr r�rhr#r"r�r��_flush_unlocked�extend�BlockingIOError�errno�strerror)rIrZbeforer��eZoveragerArArBr��s(

"zBufferedWriter.writeNc
CsD|j�4|��|dkr"|j��}|j�|�W5QR�SQRXdSrQ)r�r�r=rarbrcrArArBrb�s

zBufferedWriter.truncatec	Cs|j�|��W5QRXdSrQ)r�r�r`rArArBrf�szBufferedWriter.flushcCs�|jrtd��|jr�z|j�|j�}Wntk
rBtd��YnX|dkrZttjdd��|t	|j�ksp|dkrxt
d��|jd|�=qdS)Nr�zHself.raw should implement RawIOBase: it should not raise BlockingIOErrorz)write could not complete without blockingrz*write() returned incorrect number of bytes)rhr#r�r=r�r��RuntimeErrorr�ZEAGAINr"r.�rIr{rArArBr�s �zBufferedWriter._flush_unlockedcCst�|�t|j�SrQ)r�rar"r�r`rArArBraszBufferedWriter.tellrc
CsD|tkrtd��|j�$|��t�|||�W5QR�SQRXdS)Nr�)r�r#r�r�r�r[r]rArArBr[s
zBufferedWriter.seekcCs`|j�$|jdks|jr&W5QR�dSW5QRXz|��W5|j�|j��W5QRXXdSrQ)r�r=rhr5rfr`rArArBr5szBufferedWriter.close)N)r)rMrNrOrHr*r�rqr�rbrfr�rar[r5rArArArBr1�s

r1c@s�eZdZdZefdd�Zddd�Zdd�Zd	d
�Zd dd
�Z	d!dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zedd��ZdS)"�BufferedRWPaira�A buffered reader and writer object together.

    A buffered reader object and buffered writer object put together to
    form a sequential IO object that can read and write. This is typically
    used with a socket or two-way pipe.

    reader and writer are RawIOBase objects that are readable and
    writeable respectively. If the buffer_size is omitted it defaults to
    DEFAULT_BUFFER_SIZE.
    cCs<|��std��|��s td��t||�|_t||�|_dS)zEConstructor.

        The arguments are two RawIO instances.
        z#"reader" argument must be readable.z#"writer" argument must be writable.N)ror.rqr2�readerr1�writer)rIr�r�r�rArArBr�<szBufferedRWPair.__init__rcCs|dkrd}|j�|�S�Nr)r�r�r|rArArBr�JszBufferedRWPair.readcCs|j�|�SrQ)r�r�r�rArArBr�OszBufferedRWPair.readintocCs|j�|�SrQ)r�r�r�rArArBr�RszBufferedRWPair.writercCs|j�|�SrQ)r�rwr|rArArBrwUszBufferedRWPair.peekcCs|j�|�SrQ)r�r�r|rArArBr�XszBufferedRWPair.read1cCs|j�|�SrQ)r�r�r�rArArBr�[szBufferedRWPair.readinto1cCs
|j��SrQ)r�ror`rArArBro^szBufferedRWPair.readablecCs
|j��SrQ)r�rqr`rArArBrqaszBufferedRWPair.writablecCs
|j��SrQ)r�rfr`rArArBrfdszBufferedRWPair.flushcCs z|j��W5|j��XdSrQ)r�r5r�r`rArArBr5gszBufferedRWPair.closecCs|j��p|j��SrQ)r�r)r�r`rArArBr)mszBufferedRWPair.isattycCs|jjSrQ)r�rhr`rArArBrhpszBufferedRWPair.closedN)r)r)r)rMrNrOrHr*r�r�r�r�rwr�r�rorqrfr5r)r�rhrArArArBr�,s


r�c@sneZdZdZefdd�Zddd�Zdd�Zdd
d�Zddd
�Z	dd�Z
ddd�Zddd�Zdd�Z
dd�Zd	S)r0z�A buffered interface to random access streams.

    The constructor creates a reader and writer for a seekable stream,
    raw, given in the first argument. If the buffer_size is omitted it
    defaults to DEFAULT_BUFFER_SIZE.
    cCs(|��t�|||�t�|||�dSrQ)rnr2r�r1r�rArArBr�~szBufferedRandom.__init__rc	Cs�|tkrtd��|��|jrJ|j� |j�|jt|j�d�W5QRX|j�||�}|j�|�	�W5QRX|dkr�t
d��|S)Nr�r
rz seek() returned invalid position)r�r#rfr�r�r=r[r�r"r�r.r]rArArBr[�s$zBufferedRandom.seekcCs|jrt�|�St�|�SdSrQ)r�r1rar2r`rArArBra�s
zBufferedRandom.tellNcCs|dkr|��}t�||�SrQ)rar1rbrcrArArBrb�szBufferedRandom.truncatecCs |dkrd}|��t�||�Sr�)rfr2r�r|rArArBr��szBufferedRandom.readcCs|��t�||�SrQ)rfr2r�r�rArArBr��szBufferedRandom.readintocCs|��t�||�SrQ)rfr2rwr|rArArBrw�szBufferedRandom.peekrcCs|��t�||�SrQ)rfr2r�r|rArArBr��szBufferedRandom.read1cCs|��t�||�SrQ)rfr2r�r�rArArBr��szBufferedRandom.readinto1c	CsF|jr:|j�(|j�|jt|j�d�|��W5QRXt�||�Sr)	r�r�r=r[r�r"r�r1r�r�rArArBr��s
zBufferedRandom.write)r)N)N)r)r)rMrNrOrHr*r�r[rarbr�r�rwr�r�r�rArArArBr0us




r0cs�eZdZdZdZdZdZdZdZdZ	d0dd�Z
dd	�Zd
d�Zdd
�Z
dd�Zd1dd�Zd2dd�Zdd�Zdd�Zdd�Zefdd�Zdd�Zd3dd�Z�fd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zed,d-��Zed.d/��Z �Z!S)4r(rFNTr
c
CsB|jdkr*z|jrt�|j�W5d|_Xt|t�r<td��t|t�r\|}|dkr`td��nd}t|t	�sxtd|f��t
|�t
d�ks�td|f��tdd�|D��d	ks�|�d
�d	kr�td��d|kr�d
|_
d
|_tjtjB}nTd|kr�d
|_d}n@d|k�rd
|_tjtjB}n"d|k�r8d
|_d
|_tjtjB}d
|k�rNd
|_d
|_|j�rj|j�rj|tjO}n|j�r~|tjO}n
|tjO}|ttdd�O}ttdd��p�ttdd�}||O}d}�zT|dk�r:|�s�td��|dk�r�t�||d�}n0|||�}t|t��std��|dk�r$td��|}|�s:t�|d�||_t�|�}	z(t�|	j��rpt t!j"t�#t!j"�|��Wnt$k
�r�YnXt|	dd�|_%|j%d	k�r�t&|_%t'�r�t'|tj(�||_)|j�rzt�*|dt+�Wn4tk
�r}
z|
j!t!j,k�r�W5d}
~
XYnXWn"|dk	�r0t�|��YnX||_dS)adOpen a file.  The mode can be 'r' (default), 'w', 'x' or 'a' for reading,
        writing, exclusive creation or appending.  The file will be created if it
        doesn't exist when opened for writing or appending; it will be truncated
        when opened for writing.  A FileExistsError will be raised if it already
        exists when opened for creating. Opening a file for creating implies
        writing so this mode behaves in a similar way to 'w'. Add a '+' to the mode
        to allow simultaneous reading and writing. A custom opener can be used by
        passing a callable as *opener*. The underlying file descriptor for the file
        object is then obtained by calling opener with (*name*, *flags*).
        *opener* must return an open file descriptor (passing os.open as *opener*
        results in functionality similar to passing None).
        rrz$integer argument expected, got floatznegative file descriptorzinvalid mode: %szxrwab+css|]}|dkVqdS)ZrwaxNrA)�.0�crArArB�	<genexpr>�sz"FileIO.__init__.<locals>.<genexpr>r
rzKMust have exactly one of create/read/write/append mode and at most one plusrTr
rr�O_BINARYZO_NOINHERIT�	O_CLOEXECNz'Cannot use closefd=False with file namei�zexpected integer from openerzNegative file descriptorFr-)-�_fd�_closefdrr5r�floatr rr#rr!�sum�count�_created�	_writable�O_EXCL�O_CREAT�	_readable�O_TRUNC�
_appending�O_APPEND�O_RDWR�O_RDONLY�O_WRONLY�getattrrCr.�set_inheritabler+�stat�S_ISDIR�st_mode�IsADirectoryErrorr�ZEISDIRr�r/�_blksizer*�_setmoder�rY�lseekr	ZESPIPE)rIr6r4r;r�fd�flagsZnoinherit_flagZowned_fdZfdfstatr�rArArBr��s�




$




�





�

zFileIO.__init__cCsB|jdkr>|jr>|js>ddl}|jd|ftd|d�|��dS)Nrzunclosed file %rr)�
stacklevel�source)r�r�rhr$r%�ResourceWarningr5)rIr$rArArBrjAs�zFileIO.__del__cCstd|jj�d���dSr�r�r`rArArBr�HszFileIO.__getstate__cCspd|jj|jjf}|jr"d|Sz
|j}Wn*tk
rVd||j|j|jfYSXd|||j|jfSdS)Nz%s.%sz
<%s [closed]>z<%s fd=%d mode=%r closefd=%r>z<%s name=%r mode=%r closefd=%r>)	rXrNrOrhrYr/r�r4r�)rI�
class_namerYrArArBr�Ks�
�
�zFileIO.__repr__cCs|jstd��dS)NzFile not open for reading)r�rVr`rArArBrpYszFileIO._checkReadablecCs|jstd��dS)NzFile not open for writing)r�rVrlrArArBrr]szFileIO._checkWritablecCsT|��|��|dks |dkr(|��Szt�|j|�WStk
rNYdSXdS)z�Read at most size bytes, returned as bytes.

        Only makes one system call, so less data may be returned than requested
        In non-blocking mode, returns None if no data is available.
        Return an empty bytes object at EOF.
        Nr)rerpr�rr�r�r�r|rArArBr�aszFileIO.readcCs�|��|��t}z6t�|jdt�}t�|j�j}||krH||d}Wnt	k
r^YnXt
�}t|�|kr�t|�}|t|t�7}|t|�}zt�
|j|�}Wntk
r�|r�Yq�YdSX|s�q�||7}qft|�S)z�Read all data from the file, returned as bytes.

        In non-blocking mode, returns as much as is immediately available,
        or None if no data is available.  Return an empty bytes object at EOF.
        rr
N)rerpr*rrr�rr+�st_sizer.r�r"r�r�r�r)rI�bufsizer^�endr>r{r�rArArBr�qs2
zFileIO.readallcCs4t|��d�}|�t|��}t|�}||d|�<|S)zSame as RawIOBase.readinto().r�N)r�r�r�r")rIr�mr�r{rArArBr��s
zFileIO.readintocCs<|��|��zt�|j|�WStk
r6YdSXdS)aWrite bytes b to file, return number written.

        Only makes one system call, so not all of the data may be written.
        The number of bytes actually written is returned.  In non-blocking mode,
        returns None if the write would block.
        N)rerrrr�r�r�r�rArArBr��szFileIO.writecCs*t|t�rtd��|��t�|j||�S)a�Move to new file position.

        Argument offset is a byte count.  Optional argument whence defaults to
        SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values
        are SEEK_CUR or 1 (move relative to current position, positive or negative),
        and SEEK_END or 2 (move relative to end of file, usually negative, although
        many platforms allow seeking beyond the end of a file).

        Note that not all file objects are seekable.
        zan integer is required)rr�r rerrr�r]rArArBr[�s
zFileIO.seekcCs|��t�|jdt�S)zYtell() -> int.  Current file position.

        Can raise OSError for non seekable files.r)rerrr�rr`rArArBra�szFileIO.tellcCs2|��|��|dkr |��}t�|j|�|S)z�Truncate the file to at most size bytes.

        Size defaults to the current file position, as returned by tell().
        The current file position is changed to the value of size.
        N)rerrrar�	ftruncater�r|rArArBrb�szFileIO.truncatecs.|js*z|jrt�|j�W5t���XdS)z�Close the file.

        A closed file cannot be used for further I/O operations.  close() may be
        called more than once without error.
        N)rhr�r5r�rr�r`r�rArBr5�s
zFileIO.closecCsF|��|jdkr@z|��Wntk
r8d|_YnXd|_|jS)z$True if file supports random-access.NFT)re�	_seekablerar.r`rArArBrk�s
zFileIO.seekablecCs|��|jS)z'True if file was opened in a read mode.)rer�r`rArArBro�szFileIO.readablecCs|��|jS)z(True if file was opened in a write mode.)rer�r`rArArBrq�szFileIO.writablecCs|��|jS)z3Return the underlying file descriptor (an integer).)rer�r`rArArBr,�sz
FileIO.filenocCs|��t�|j�S)z.True if the file is connected to a TTY device.)rerr)r�r`rArArBr)�sz
FileIO.isattycCs|jS)z6True if the file descriptor will be closed by close().)r�r`rArArBr;�szFileIO.closefdcCsJ|jr|jrdSdSn0|jr,|jr&dSdSn|jrB|jr<dSdSndSdS)	zString giving the file modezxb+Zxbzab+Zabzrb+rD�wbN)r�r�r�r�r`rArArBr4szFileIO.mode)r
TN)N)N)N)"rMrNrOr�r�r�r�r�rr�r�rjr�r�rprrr�r�r�r�rr[rarbr5rkrorqr,r)r�r;r4r�rArAr�rBr(�s<
y

#



r(c@s`eZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
�Ze	dd��Z
e	dd��Ze	dd��ZdS)�
TextIOBasez�Base class for text I/O.

    This class provides a character and line based interface to stream
    I/O. There is no public constructor.
    rcCs|�d�dS)z�Read at most size characters from stream, where size is an int.

        Read from underlying buffer until we have size characters or we hit EOF.
        If size is negative or omitted, read until EOF.

        Returns a string.
        r�Nr\r|rArArBr�szTextIOBase.readcCs|�d�dS)z.Write string s to stream and returning an int.r�Nr\)rI�srArArBr�(szTextIOBase.writeNcCs|�d�dS)z*Truncate size to pos, where pos is an int.rbNr\rcrArArBrb,szTextIOBase.truncatecCs|�d�dS)z_Read until newline or EOF.

        Returns an empty string if EOF is hit immediately.
        r�Nr\r`rArArBr�0szTextIOBase.readlinecCs|�d�dS)z�
        Separate the underlying buffer from the TextIOBase and return it.

        After the underlying buffer has been detached, the TextIO is in an
        unusable state.
        r�Nr\r`rArArBr�7szTextIOBase.detachcCsdS)zSubclasses should override.NrAr`rArArBr8@szTextIOBase.encodingcCsdS)z�Line endings translated so far.

        Only line endings translated during reading are considered.

        Subclasses should override.
        NrAr`rArArB�newlinesEszTextIOBase.newlinescCsdS)zMError setting of the decoder or encoder.

        Subclasses should override.NrAr`rArArBr9OszTextIOBase.errors)r)N)
rMrNrOrHr�r�rbr�r�r�r8rr9rArArArBrs


	

	rc@sTeZdZdZddd�Zddd�Zdd	�Zd
d�Zdd
�ZdZ	dZ
dZedd��Z
dS)�IncrementalNewlineDecodera+Codec used when reading a file in universal newlines mode.  It wraps
    another incremental decoder, translating \r\n and \r into \n.  It also
    records the types of newlines encountered.  When used with
    translate=False, it ensures that the newline sequence is returned in
    one piece.
    �strictcCs,tjj||d�||_||_d|_d|_dS)N)r9rF)�codecs�IncrementalDecoderr��	translate�decoder�seennl�	pendingcr)rIrrr9rArArBr�`s
z"IncrementalNewlineDecoder.__init__FcCs�|jdkr|}n|jj||d�}|jr<|s.|r<d|}d|_|�d�r\|s\|dd�}d|_|�d�}|�d�|}|�d�|}|j|o�|j|o�|jB|o�|jBO_|j	r�|r�|�
dd�}|r�|�
dd�}|S)N��final�
FrT�
�
)r�decoderr�r�r�_LF�_CR�_CRLFr�replace)rI�inputr�outputZcrlfZcrZlfrArArBr#gs*

�z IncrementalNewlineDecoder.decodecCs@|jdkrd}d}n|j��\}}|dK}|jr8|dO}||fS)Nr�rr
)r�getstater)rIr��flagrArArBr*�s
z"IncrementalNewlineDecoder.getstatecCs8|\}}t|d@�|_|jdk	r4|j�||d?f�dSr)�boolrr�setstate)rI�stater�r+rArArBr-�s
z"IncrementalNewlineDecoder.setstatecCs$d|_d|_|jdk	r |j��dS)NrF)rrr�resetr`rArArBr/�s
zIncrementalNewlineDecoder.resetr
r�cCs
d|jS)N)Nr"r )r r"r!)r"r!)r r!)r r"r!)rr`rArArBr�s�z"IncrementalNewlineDecoder.newlinesN)r)F)rMrNrOrHr�r#r*r-r/r$r%r&r�rrArArArBrYs

rc@sveZdZdZdZdZdOdd�Zdd�ZdPd	d
�Zdd�Z	e
d
d��Ze
dd��Ze
dd��Z
e
dd��Ze
dd��Zddeddd�dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Ze
d$d%��Ze
d&d'��Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�ZdQd4d5�Zd6d7�Z d8d9�Z!dRd;d<�Z"d=d>�Z#d?d@�Z$dSdAdB�Z%dCdD�Z&dTdEdF�Z'dUdGdH�Z(dIdJ�Z)dVdKdL�Z*e
dMdN��Z+dS)Wr3aCharacter and line based layer over a BufferedIOBase object, buffer.

    encoding gives the name of the encoding that the stream will be
    decoded or encoded with. It defaults to locale.getpreferredencoding(False).

    errors determines the strictness of encoding and decoding (see the
    codecs.register) and defaults to "strict".

    newline can be None, '', '\n', '\r', or '\r\n'.  It controls the
    handling of line endings. If it is None, universal newlines is
    enabled.  With this enabled, on input, the lines endings '\n', '\r',
    or '\r\n' are translated to '\n' before being returned to the
    caller. Conversely, on output, '\n' is translated to the system
    default line separator, os.linesep. If newline is any other of its
    legal values, that newline becomes the newline when the file is read
    and it is returned untranslated. On output, '\n' is converted to the
    newline.

    If line_buffering is True, a call to flush is implied when a call to
    write contains a newline character.
    iNFc		Cs|�|�|dkrvzt�|���}Wnttfk
r<YnX|dkrvzddl}Wntk
rjd}YnX|�d�}t	|t
�s�td|��t�
|�js�d}t||��|dkr�d}nt	|t
�s�td|��||_d|_d|_d|_|j��|_|_t|jd	�|_|�|||||�dS)
Nr�asciiFrzG%r is not a text encoding; use codecs.open() to handle arbitrary codecsrrrr�)�_check_newliner�device_encodingr,r/rV�locale�ImportErrorZgetpreferredencodingrrr#r�lookup�_is_text_encoding�LookupErrorr��_decoded_chars�_decoded_chars_used�	_snapshotr@rkr�_tellingr��
_has_read1�
_configure)	rIr@r8r9r:r?�
write_throughr4rmrArArBr��s>





�zTextIOWrapper.__init__cCs>|dk	r$t|t�s$tdt|�f��|dkr:td|f��dS)Nzillegal newline type: %r)Nrr"r r!zillegal newline value: %r)rrr �typer#)rIr:rArArBr2�szTextIOWrapper._check_newlinecCs�||_||_d|_d|_d|_||_|dk|_||_|dk|_|pHt	j
|_||_||_
|jr�|��r�|j��}|dkr�z|���d�Wntk
r�YnXdS)N�rr)�	_encoding�_errors�_encoder�_decoder�	_b2cratio�_readuniversal�_readtranslate�_readnl�_writetranslater�linesep�_writenl�_line_buffering�_write_throughrrqr@ra�_get_encoderr-r8)rIr8r9r:r?r?�positionrArArBr>�s&


zTextIOWrapper._configurecCs�d�|jj|jj�}z
|j}Wntk
r2YnX|d�|�7}z
|j}Wntk
r`YnX|d�|�7}|d�|j�S)Nz<{}.{}z name={0!r}z mode={0!r}z encoding={0!r}>)r�rXrNrOrYr/r4r8)rIr>rYr4rArArBr�!s
�

zTextIOWrapper.__repr__cCs|jSrQ)rBr`rArArBr82szTextIOWrapper.encodingcCs|jSrQ)rCr`rArArBr96szTextIOWrapper.errorscCs|jSrQ)rMr`rArArBr?:szTextIOWrapper.line_bufferingcCs|jSrQ)rNr`rArArBr?>szTextIOWrapper.write_throughcCs|jSrQ)r�r`rArArBr@BszTextIOWrapper.buffer)r8r9r:r?r?cCs�|jdk	r*|dk	s"|dk	s"|tk	r*td��|dkrH|dkrB|j}q^d}nt|t�s^td|��|dkrn|j}nt|t�s�td|��|tkr�|j}|�	|�|dkr�|j
}|dkr�|j}|��|�
|||||�dS)z`Reconfigure the text stream with new parameters.

        This also flushes the stream.
        NzPIt is not possible to set the encoding or newline of stream after the first readrrr)rE�EllipsisrVrCrrr rBrIr2r?r?rfr>)rIr8r9r:r?r?rArArB�reconfigureFs@
����



�zTextIOWrapper.reconfigurecCs|jrtd��|jS)Nrs)rhr#rr`rArArBrkoszTextIOWrapper.seekablecCs
|j��SrQ)r@ror`rArArBrotszTextIOWrapper.readablecCs
|j��SrQ)r@rqr`rArArBrqwszTextIOWrapper.writablecCs|j��|j|_dSrQ)r@rfrr<r`rArArBrfzs
zTextIOWrapper.flushcCs.|jdk	r*|js*z|��W5|j��XdSrQ)r@rhr5rfr`rArArBr5~szTextIOWrapper.closecCs|jjSrQ)r@rhr`rArArBrh�szTextIOWrapper.closedcCs|jjSrQ)r@rYr`rArArBrY�szTextIOWrapper.namecCs
|j��SrQ)r@r,r`rArArBr,�szTextIOWrapper.filenocCs
|j��SrQ)r@r)r`rArArBr)�szTextIOWrapper.isattycCs�|jrtd��t|t�s(td|jj��t|�}|js<|j	oBd|k}|rf|jrf|j
dkrf|�d|j
�}|jpr|�
�}|�|�}|j�|�|j	r�|s�d|kr�|��|�d�d|_|jr�|j��|S)zWrite data, where s is a strr�zcan't write %s to text streamr"r rN)rhr#rrr rXrMr"rJrMrLr'rDrO�encoder@r�rf�_set_decoded_charsr;rEr/)rIrZlengthZhaslf�encoderrrArArBr��s(
�


zTextIOWrapper.writecCst�|j�}||j�|_|jSrQ)r�getincrementalencoderrBrCrD)rIZmake_encoderrArArBrO�szTextIOWrapper._get_encodercCs2t�|j�}||j�}|jr(t||j�}||_|SrQ)r�getincrementaldecoderrBrCrGrrHrE)rIZmake_decoderrrArArB�_get_decoder�s
zTextIOWrapper._get_decodercCs||_d|_dS)zSet the _decoded_chars buffer.rN)r9r:)rI�charsrArArBrT�sz TextIOWrapper._set_decoded_charscCsF|j}|dkr|j|d�}n|j|||�}|jt|�7_|S)z'Advance into the _decoded_chars buffer.N)r:r9r")rIr{�offsetrYrArArB�_get_decoded_chars�sz TextIOWrapper._get_decoded_charscCs$|j|krtd��|j|8_dS)z!Rewind the _decoded_chars buffer.z"rewind decoded_chars out of boundsN)r:�AssertionErrorr�rArArB�_rewind_decoded_chars�s
z#TextIOWrapper._rewind_decoded_charscCs�|jdkrtd��|jr&|j��\}}|jr<|j�|j�}n|j�|j�}|}|j�	||�}|�
|�|r�t|�t|j�|_
nd|_
|jr�|||f|_|S)zQ
        Read and decode the next chunk of data from the BufferedReader.
        Nz
no decoderrA)rEr#r<r*r=r@r��_CHUNK_SIZEr�r#rTr"r9rFr;)rI�
dec_buffer�	dec_flags�input_chunk�eofZ
decoded_charsrArArB�_read_chunk�s 

zTextIOWrapper._read_chunkrcCs(||d>B|d>B|d>Bt|�d>BS)N�@���)r,)rIrPr`�
bytes_to_feed�need_eof�
chars_to_skiprArArB�_pack_cookie�s
�
�zTextIOWrapper._pack_cookiecCsFt|d�\}}t|d�\}}t|d�\}}t|d�\}}|||||fS)Nl)�divmod)rIZbigint�restrPr`rhrirjrArArB�_unpack_cookie	s
zTextIOWrapper._unpack_cookiec	CsR|jstd��|jstd��|��|j��}|j}|dksF|jdkrX|j	rTt
d��|S|j\}}|t|�8}|j}|dkr�|�
||�S|��}�z�t|j|�}d}|t|�ks�t
�|dk�r4|�d|f�t|�|d|���}	|	|k�r"|��\}
}|
�s|}||	8}�qF|t|
�8}d}q�||8}|d}q�d}|�d|f�||}|}
|dk�rl|�
||
�W��Sd}d}d}t|t|��D]x}|d7}|t|�|||d���7}|��\}}|�s�||k�r�||7}||8}|dd}
}}||k�r��q,�q�|t|jddd	��7}d}||k�r,td
��|�
||
|||�W�S|�|�XdS)N�!underlying stream is not seekablez(telling position disabled by next() callzpending decoded textrr
r�rTrz'can't reconstruct logical file position)rrVr<r.rfr@rarEr;r9r\r"r:rkr*r-rrFr#�range)rIrPrr`Z
next_inputrjZsaved_stateZ
skip_bytesZ	skip_backr{r�d�	start_posZstart_flagsZ	bytes_fedriZ
chars_decoded�ir_rArArBra
	s�








�zTextIOWrapper.tellcCs$|��|dkr|��}|j�|�SrQ)rfrar@rbrcrArArBrbm	szTextIOWrapper.truncatecCs*|jdkrtd��|��|j}d|_|S)Nzbuffer is already detached)r@r#rfr�)rIr@rArArBr�s	s
zTextIOWrapper.detachcs��fdd�}�jrtd���js(td��|tkrN|dkr@td��d}���}nZ|tkr�|dkrftd������j�	d|�}��
d�d�_�jr��j�
�||�|S|dkr�td	|f��|dkr�td
|f�������|�\}}}}}	�j�	|���
d�d�_|dk�r*�j�r*�j�
�n@�j�s>|�s>|	�rj�j�pL����_�j�d|f�|df�_|	�r��j�|�}
��
�j�|
|��||
f�_t�j�|	k�r�td��|	�_||�|S)
NcsHz�jp���}Wntk
r&YnX|dkr<|�d�n|��dS)z9Reset the encoder (merely useful for proper BOM handling)rN)rDrOr8r-r/)rPrUr`rArB�_reset_encoder|	sz*TextIOWrapper.seek.<locals>._reset_encoderr�rorz#can't do nonzero cur-relative seeksz#can't do nonzero end-relative seeksrzunsupported whence (%r)r�r�z#can't restore logical file position)rhr#rrVrrar	rfr@r[rTr;rEr/rnrXr-r�r#r"r9r.r:)rIZcookier_rtrPrrr`rhrirjrarAr`rBr[{	s`



�

�
zTextIOWrapper.seekcCs�|��|dkrd}n4z
|j}Wn"tk
rBt|�d���YnX|�}|jpV|��}|dkr�|��|j|j�	�dd�}|�
d�d|_|Sd}|�|�}t|�|kr�|s�|�
�}||�|t|��7}q�|SdS)Nrr�rTrrF)rpr�r/r rErXr[r#r@r�rTr;r"rc)rIr}r�rr>rbrArArBr��	s,
�


zTextIOWrapper.readcCs(d|_|��}|s$d|_|j|_t�|S)NF)r<r�r;rr�r�rArArBr��	szTextIOWrapper.__next__c	Cs
|jrtd��|dkrd}n4z
|j}Wn"tk
rHt|�d���YnX|�}|��}d}|jsj|��d}}|jr�|�	d|�}|dkr�|d}�q�nt
|�}n�|j�rF|�	d|�}|�	d|�}|dkr�|dkr�t
|�}n|d}�q�nX|dk�r|d}�q�n@||k�r|d}�q�n(||dk�r8|d}�q�n|d}�q�n(|�	|j�}|dk�rn|t
|j�}�q�|dk�r�t
|�|k�r�|}�q�|�
��r�|j�r��q��q�|j�r�||��7}qr|�d	�d|_|Sqr|dk�r�||k�r�|}|�t
|�|�|d|�S)
Nr�rr�rr"r
r rr)rhr#r�r/r r[rErXrHryr"rGrIrcr9rTr;r])	rIr}r�r��startr^�endposZnlposZcrposrArArBr��	st







zTextIOWrapper.readlinecCs|jr|jjSdSrQ)rErr`rArArBrH
szTextIOWrapper.newlines)NNNFF)NNNFF)N)rrrr)N)r)N)N),rMrNrOrHr^r�r�r2r>r�r�r8r9r?r?r@rQrRrkrorqrfr5rhrYr,r)r�rOrXrTr[r]rcrkrnrarbr�r[r�r�r�rrArArArBr3�s|�
(�
$




�)



*�

c

K
	
]r3csReZdZdZd�fdd�	Zdd�Zdd	�Zed
d��Zedd
��Z	dd�Z
�ZS)�StringIOz�Text I/O implementation using an in-memory buffer.

    The initial_value argument sets the value of object.  The newline
    argument is like the one of TextIOWrapper's constructor.
    rr"csftt|�jt�dd|d�|dkr(d|_|dk	rbt|t�sNtd�t	|�j
���|�|�|�d�dS)Nzutf-8�
surrogatepass)r8r9r:Fz*initial_value must be str or None, not {0}r)
r�rwr�r�rJrrr r�r@rMr�r[)rIZ
initial_valuer:r�rArBr�T
s�
�
zStringIO.__init__c	CsP|��|jp|��}|��}|��z|j|j��dd�W�S|�|�XdS)NTr)	rfrErXr*r/r-r#r@r�)rIrZ	old_staterArArBr�d
szStringIO.getvaluecCs
t�|�SrQ)�objectr�r`rArArBr�n
szStringIO.__repr__cCsdSrQrAr`rArArBr9s
szStringIO.errorscCsdSrQrAr`rArArBr8w
szStringIO.encodingcCs|�d�dS)Nr�r\r`rArArBr�{
szStringIO.detach)rr")rMrNrOrHr�r�r�r�r9r8r�r�rArAr�rBrwM
s


rw)r
rNNNTN)8rHr�abcrr�r��sys�_threadrr��platformZmsvcrtrr�iorrrr	r�r��addr�	SEEK_DATAr*r�r�dev_moderirCrF�	open_coder/rGrPrVr.r#�ABCMetarW�registerr��_ior(r�r�r�r2r1r�r0rrrr3rwrArArArB�<module>s�


�
[

	
$=
ghCiIJY@U$wave.cpython-38.opt-1.pyc000064400000043265150335716500011114 0ustar00U

e5d6G�@s�dZddlZdddddgZGdd�de�Zd	Zd
ZddlZddlZddl	Z	ddl
mZddlm
Z
ddlZe
d
d�ZGdd�d�ZGdd�d�Zddd�Zddd�ZdS)a%
Stuff to parse WAVE files.

Usage.

Reading WAVE files:
      f = wave.open(file, 'r')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods read(), seek(), and close().
When the setpos() and rewind() methods are not used, the seek()
method is not  necessary.

This returns an instance of a class with the following public methods:
      getnchannels()  -- returns number of audio channels (1 for
                         mono, 2 for stereo)
      getsampwidth()  -- returns sample width in bytes
      getframerate()  -- returns sampling frequency
      getnframes()    -- returns number of audio frames
      getcomptype()   -- returns compression type ('NONE' for linear samples)
      getcompname()   -- returns human-readable version of
                         compression type ('not compressed' linear samples)
      getparams()     -- returns a namedtuple consisting of all of the
                         above in the above order
      getmarkers()    -- returns None (for compatibility with the
                         aifc module)
      getmark(id)     -- raises an error since the mark does not
                         exist (for compatibility with the aifc module)
      readframes(n)   -- returns at most n frames of audio
      rewind()        -- rewind to the beginning of the audio stream
      setpos(pos)     -- seek to the specified position
      tell()          -- return the current position
      close()         -- close the instance (make it unusable)
The position returned by tell() and the position given to setpos()
are compatible and have nothing to do with the actual position in the
file.
The close() method is called automatically when the class instance
is destroyed.

Writing WAVE files:
      f = wave.open(file, 'w')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods write(), tell(), seek(), and
close().

This returns an instance of a class with the following public methods:
      setnchannels(n) -- set the number of channels
      setsampwidth(n) -- set the sample width
      setframerate(n) -- set the frame rate
      setnframes(n)   -- set the number of frames
      setcomptype(type, name)
                      -- set the compression type and the
                         human-readable compression type
      setparams(tuple)
                      -- set all parameters at once
      tell()          -- return current position in output file
      writeframesraw(data)
                      -- write audio frames without patching up the
                         file header
      writeframes(data)
                      -- write audio frames and patch up the file header
      close()         -- patch up the file header and close the
                         output file
You should set the parameters before the first writeframesraw or
writeframes.  The total number of frames does not need to be set,
but when it is set to the correct value, the header does not have to
be patched up.
It is best to first set all parameters, perhaps possibly the
compression type, and then write audio frames using writeframesraw.
When all frames have been written, either call writeframes(b'') or
close() to patch up the sizes in the header.
The close() method is called automatically when the class instance
is destroyed.
�N�open�openfp�Error�	Wave_read�
Wave_writec@seZdZdS)rN)�__name__�
__module__�__qualname__�r
r
�/usr/lib64/python3.8/wave.pyrNs�)N�b�hN�i)�Chunk)�
namedtuple�_wave_paramsz7nchannels sampwidth framerate nframes comptype compnamec@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,S)-raPVariables used in this class:

    These variables are available to the user though appropriate
    methods of this class:
    _file -- the open file with methods read(), close(), and seek()
              set through the __init__() method
    _nchannels -- the number of audio channels
              available through the getnchannels() method
    _nframes -- the number of audio frames
              available through the getnframes() method
    _sampwidth -- the number of bytes per audio sample
              available through the getsampwidth() method
    _framerate -- the sampling frequency
              available through the getframerate() method
    _comptype -- the AIFF-C compression type ('NONE' if AIFF)
              available through the getcomptype() method
    _compname -- the human-readable AIFF-C compression type
              available through the getcomptype() method
    _soundpos -- the position in the audio stream
              available through the tell() method, set through the
              setpos() method

    These variables are used internally only:
    _fmt_chunk_read -- 1 iff the FMT chunk has been read
    _data_seek_needed -- 1 iff positioned correctly in audio
              file for readframes()
    _data_chunk -- instantiation of a chunk class for the DATA chunk
    _framesize -- size of one frame in the file
    cCs�d|_d|_t|dd�|_|j��dkr0td��|j�d�dkrHtd��d|_d|_d|_	zt|jdd�}Wnt
k
r�Yq�YnX|��}|d	kr�|�|�d|_n2|d
kr�|js�td��||_|j|j
|_d|_	q�|��qT|jr�|js�td��dS)
Nr)Z	bigendian�RIFFz file does not start with RIFF id��WAVEznot a WAVE filer�fmt �datazdata chunk before fmt chunkz#fmt chunk and/or data chunk missing)�_convert�	_soundposr�_fileZgetnamer�readZ_fmt_chunk_read�_data_chunk�_data_seek_needed�EOFError�_read_fmt_chunkZ	chunksize�
_framesize�_nframes�skip)�self�file�chunkZ	chunknamer
r
r�initfp~s8


zWave_read.initfpcCsRd|_t|t�r"t�|d�}||_z|�|�Wn|jrF|���YnXdS)N�rb��_i_opened_the_file�
isinstance�str�builtinsrr&�close�r#�fr
r
r�__init__�s
zWave_read.__init__cCs|��dS�N�r-�r#r
r
r�__del__�szWave_read.__del__cCs|Sr1r
r3r
r
r�	__enter__�szWave_read.__enter__cGs|��dSr1r2�r#�argsr
r
r�__exit__�szWave_read.__exit__cCs|jSr1)rr3r
r
r�getfp�szWave_read.getfpcCsd|_d|_dS)Nrr)rrr3r
r
r�rewind�szWave_read.rewindcCs"d|_|j}|rd|_|��dSr1)rr)r-�r#r$r
r
rr-�s
zWave_read.closecCs|jSr1)rr3r
r
r�tell�szWave_read.tellcCs|jSr1)�
_nchannelsr3r
r
r�getnchannels�szWave_read.getnchannelscCs|jSr1)r!r3r
r
r�
getnframes�szWave_read.getnframescCs|jSr1)�
_sampwidthr3r
r
r�getsampwidth�szWave_read.getsampwidthcCs|jSr1)�
_framerater3r
r
r�getframerate�szWave_read.getframeratecCs|jSr1��	_comptyper3r
r
r�getcomptype�szWave_read.getcomptypecCs|jSr1��	_compnamer3r
r
r�getcompname�szWave_read.getcompnamecCs*t|��|��|��|��|��|���Sr1)rr>rArCr?rFrIr3r
r
r�	getparams�s�zWave_read.getparamscCsdSr1r
r3r
r
r�
getmarkers�szWave_read.getmarkerscCstd��dS�Nzno marks�r�r#�idr
r
r�getmark�szWave_read.getmarkcCs*|dks||jkrtd��||_d|_dS)Nrzposition not in ranger)r!rrr)r#�posr
r
r�setpos�szWave_read.setposcCs�|jr8|j�dd�|j|j}|r2|j�|d�d|_|dkrDdS|j�||j�}|jdkrxtjdkrxt	�
||j�}|jr�|r�|�|�}|jt|�|j
|j|_|S)Nr�r�big)rr�seekrr rr@�sys�	byteorder�audioop�byteswapr�lenr=)r#�nframesrQ�datar
r
r�
readframes�s

zWave_read.readframescCs�z$t�d|�d��\}|_|_}}Wntjk
r@td�YnX|tkr�zt�d|�d��d}Wntjk
r�td�YnX|dd|_|js�t	d��nt	d	|f��|js�t	d
��|j|j|_
d|_d|_dS)
Nz<HHLLH�z<H�r���bad sample widthzunknown format: %r�bad # of channels�NONEznot compressed)
�structZunpack_fromrr=rB�errorr�WAVE_FORMAT_PCMr@rr rErH)r#r%Z
wFormatTagZdwAvgBytesPerSecZwBlockAlign�	sampwidthr
r
rr�s$$
zWave_read._read_fmt_chunkN)rrr	�__doc__r&r0r4r5r8r9r:r-r<r>r?rArCrFrIrJrKrPrRr]rr
r
r
rr_s,
c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:S);ra�Variables used in this class:

    These variables are user settable through appropriate methods
    of this class:
    _file -- the open file with methods write(), close(), tell(), seek()
              set through the __init__() method
    _comptype -- the AIFF-C compression type ('NONE' in AIFF)
              set through the setcomptype() or setparams() method
    _compname -- the human-readable AIFF-C compression type
              set through the setcomptype() or setparams() method
    _nchannels -- the number of audio channels
              set through the setnchannels() or setparams() method
    _sampwidth -- the number of bytes per audio sample
              set through the setsampwidth() or setparams() method
    _framerate -- the sampling frequency
              set through the setframerate() or setparams() method
    _nframes -- the number of audio frames written to the header
              set through the setnframes() or setparams() method

    These variables are used internally only:
    _datalength -- the size of the audio samples written to the header
    _nframeswritten -- the number of frames actually written
    _datawritten -- the size of the audio samples actually written
    cCsRd|_t|t�r"t�|d�}||_z|�|�Wn|jrF|���YnXdS)N�wbr(r.r
r
rr0.s
zWave_write.__init__cCs@||_d|_d|_d|_d|_d|_d|_d|_d|_d|_	dS)NrF)
rrr=r@rBr!�_nframeswritten�_datawritten�_datalength�_headerwrittenr;r
r
rr&:szWave_write.initfpcCs|��dSr1r2r3r
r
rr4FszWave_write.__del__cCs|Sr1r
r3r
r
rr5IszWave_write.__enter__cGs|��dSr1r2r6r
r
rr8LszWave_write.__exit__cCs(|jrtd��|dkrtd��||_dS)N�0cannot change parameters after starting to writerrc)rlrr=)r#�	nchannelsr
r
r�setnchannelsRs
zWave_write.setnchannelscCs|jstd��|jS)Nznumber of channels not set)r=rr3r
r
rr>YszWave_write.getnchannelscCs0|jrtd��|dks|dkr&td��||_dS)Nrorrrb)rlrr@)r#rhr
r
r�setsampwidth^s
zWave_write.setsampwidthcCs|jstd��|jS)Nzsample width not set)r@rr3r
r
rrAeszWave_write.getsampwidthcCs0|jrtd��|dkrtd��tt|��|_dS)Nrorzbad frame rate)rlr�int�roundrB)r#�	framerater
r
r�setframeratejs
zWave_write.setframeratecCs|jstd��|jS)Nzframe rate not set)rBrr3r
r
rrCqszWave_write.getframeratecCs|jrtd��||_dS�Nro)rlrr!)r#r[r
r
r�
setnframesvszWave_write.setnframescCs|jSr1�rkr3r
r
rr?{szWave_write.getnframescCs.|jrtd��|dkrtd��||_||_dS)Nro)rdzunsupported compression type)rlrrErH)r#�comptype�compnamer
r
r�setcomptype~szWave_write.setcomptypecCs|jSr1rDr3r
r
rrF�szWave_write.getcomptypecCs|jSr1rGr3r
r
rrI�szWave_write.getcompnamecCsV|\}}}}}}|jrtd��|�|�|�|�|�|�|�|�|�||�dSrw)rlrrqrrrvrxr|)r#Zparamsrprhrur[rzr{r
r
r�	setparams�s



zWave_write.setparamscCs8|jr|jr|jstd��t|j|j|j|j|j|j�S)Nznot all parameters set)r=r@rBrrr!rErHr3r
r
rrJ�s�zWave_write.getparamscCstd��dS)Nzsetmark() not supportedrM)r#rOrQ�namer
r
r�setmark�szWave_write.setmarkcCstd��dSrLrMrNr
r
rrP�szWave_write.getmarkcCsdSr1r
r3r
r
rrK�szWave_write.getmarkerscCs|jSr1ryr3r
r
rr<�szWave_write.tellcCs�t|ttf�st|��d�}|�t|��t|�|j|j}|j	rN|�	|�}|jdkrpt
jdkrpt�
||j�}|j�|�|jt|�7_|j||_dS)N�BrrT)r*�bytes�	bytearray�
memoryview�cast�_ensure_header_writtenrZr@r=rrVrWrXrYr�writerlrk)r#r\r[r
r
r�writeframesraw�s
zWave_write.writeframesrawcCs"|�|�|j|jkr|��dSr1)r�rmrl�_patchheader)r#r\r
r
r�writeframes�s
zWave_write.writeframescCsXz2|jr0|�d�|j|jkr&|��|j��W5d|_|j}|rRd|_|��XdS)Nr)rr)r-r�rmrlr��flushr;r
r
rr-�s
zWave_write.closecCs>|js:|jstd��|js"td��|js0td��|�|�dS)Nz# channels not specifiedzsample width not specifiedzsampling rate not specified)rnr=rr@rB�
_write_header)r#Zdatasizer
r
rr��sz!Wave_write._ensure_header_writtencCs�|j�d�|js$||j|j|_|j|j|j|_z|j��|_Wntt	fk
rfd|_YnX|j�t
�dd|jdddt|j|j
|j|j
|j|j|j|jdd��|jdk	r�|j��|_|j�t
�d	|j��d
|_dS)Nrz<L4s4sLHHLLHH4s�$rr�rar�<LT)rr�r!r=r@rmr<�_form_length_pos�AttributeError�OSErrorre�packrgrB�_data_length_posrn)r#Z
initlengthr
r
rr��s2
�
zWave_write._write_headercCs�|j|jkrdS|j��}|j�|jd�|j�t�dd|j��|j�|j	d�|j�t�d|j��|j�|d�|j|_dS)Nrr�r�)
rlrmrr<rUr�r�rer�r�)r#Zcurposr
r
rr��s
zWave_write._patchheaderN) rrr	rir0r&r4r5r8rqr>rrrArvrCrxr?r|rFrIr}rJrrPrKr<r�r�r-r�r�r�r
r
r
rrs:


cCsJ|dkrt|d�r|j}nd}|dkr.t|�S|dkr>t|�Std��dS)N�moder')�rr')�wrjz$mode must be 'r', 'rb', 'w', or 'wb')�hasattrr�rrr�r/r�r
r
rr�s
cCstjdtdd�t||d�S)NzBwave.openfp is deprecated since Python 3.7. Use wave.open instead.r_)�
stacklevel)r�)�warnings�warn�DeprecationWarningrr�r
r
rrs
�)N)N)rir,�__all__�	ExceptionrrgZ_array_fmtsrXrerVr%r�collectionsrr�rrrrrr
r
r
r�<module>s(I�6d

bdb.cpython-38.opt-2.pyc000064400000037015150335716500010676 0ustar00U

e5d8}�@s�ddlZddlZddlZddlmZmZmZdddgZeeBeBZGdd�de	�Z
Gdd�d�Zdd	�ZGd
d�d�Z
dd�Zd
d�ZGdd�de�Zdd�Zdd�Zdd�ZdS)�N)�CO_GENERATOR�CO_COROUTINE�CO_ASYNC_GENERATOR�BdbQuit�Bdb�
Breakpointc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.8/bdb.pyr
sc@sreZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd[d%d&�Zd\d'd(�Zd)d*�Zd+d,�Zd-d.�Zd]d/d0�Zd1d2�Zd3d4�Zd^d6d7�Zd8d9�Zd:d;�Zd<d=�Zd>d?�Z d@dA�Z!dBdC�Z"dDdE�Z#dFdG�Z$dHdI�Z%dJdK�Z&dLdM�Z'd_dOdP�Z(d`dQdR�Z)dadSdT�Z*dUdV�Z+dWdX�Z,dYe,_-dS)brNcCs(|rt|�nd|_i|_i|_d|_dS�N)�set�skip�breaks�fncache�frame_returning)�selfrrrr�__init__szBdb.__init__cCsR|d|dd�dkr|S|j�|�}|sNtj�|�}tj�|�}||j|<|S)N�<�����>)r�get�os�path�abspath�normcase)r�filename�canonicrrrr%s
zBdb.canoniccCs&ddl}|��d|_|�dd�dS)Nr)�	linecache�
checkcache�botframe�
_set_stopinfo)rr rrr�reset6sz	Bdb.resetcCs�|jr
dS|dkr|�|�S|dkr0|�||�S|dkrD|�||�S|dkrX|�||�S|dkrf|jS|dkrt|jS|dkr�|jStdt|��|jS)	N�lineZcall�returnZ	exceptionZc_callZc_exceptionZc_returnz*bdb.Bdb.dispatch: unknown debugging event:)�quitting�
dispatch_line�
dispatch_call�dispatch_return�dispatch_exception�trace_dispatch�print�repr)r�frameZevent�argrrrr,=s$
zBdb.trace_dispatchcCs.|�|�s|�|�r(|�|�|jr(t�|jSr
)�	stop_here�
break_here�	user_liner'rr,�rr/rrrr(hs

zBdb.dispatch_linecCsd|jdkr|j|_|jS|�|�s0|�|�s0dS|jrH|jjt@rH|jS|�	||�|j
r^t�|jSr
)r"�f_backr,r1�break_anywhere�	stopframe�f_code�co_flags�GENERATOR_AND_COROUTINE_FLAGS�	user_callr'r�rr/r0rrrr)ts
zBdb.dispatch_callcCs||�|�s||jkrv|jr,|jjt@r,|jSz||_|�||�W5d|_X|j	rVt
�|j|krv|jdkrv|�dd�|jS�Nr)
r1�returnframer7r8r9r:r,r�user_returnr'r�
stoplinenor#r<rrrr*�szBdb.dispatch_returncCs�|�|�rF|jjt@r.|dtkr.|ddks�|�||�|jr�t�nD|jr�||jk	r�|jjjt@r�|dtt	fkr�|�||�|jr�t�|j
S)Nr�)r1r8r9r:�
StopIteration�user_exceptionr'rr7�
GeneratorExitr,r<rrrr+�s$

�
���zBdb.dispatch_exceptioncCs.|dkrdS|jD]}t�||�rdSqdS�NFT)r�fnmatch)rZmodule_name�patternrrr�is_skipped_module�s
zBdb.is_skipped_modulecCsN|jr|�|j�d��rdS||jkr@|jdkr4dS|j|jkS|jsJdSdS)NrFrT)rrH�	f_globalsrr7r@�f_linenor4rrrr1�s�

z
Bdb.stop_herecCs�|�|jj�}||jkrdS|j}||j|krJ|jj}||j|krJdSt|||�\}}|r�|j|_|r�|j	r�|�
t|j��dSdSdSrE)rr8�co_filenamerrJ�co_firstlineno�	effective�numberZ	currentbp�	temporary�do_clear�str)rr/r�lineno�bp�flagrrrr2�s

zBdb.break_herecCstd��dS)Nz)subclass of bdb must implement do_clear())�NotImplementedError)rr0rrrrP�szBdb.do_clearcCs|�|jj�|jkSr
)rr8rKrr4rrrr6�szBdb.break_anywherecCsdSr
r)rr/Z
argument_listrrrr;sz
Bdb.user_callcCsdSr
rr4rrrr3sz
Bdb.user_linecCsdSr
r)rr/Zreturn_valuerrrr?	szBdb.user_returncCsdSr
r)rr/�exc_inforrrrC
szBdb.user_exceptionrcCs||_||_d|_||_dS�NF)r7r>r'r@)rr7r>r@rrrr#szBdb._set_stopinfocCs$|dkr|jd}|�|||�dS)Nr)rJr#)rr/rRrrr�	set_until"s
z
Bdb.set_untilcCs0|jr |jj}|r |js |j|_|�dd�dSr
)rr5�f_tracer,r#)rZcaller_framerrr�set_step*s

zBdb.set_stepcCs|�|d�dSr
)r#r4rrr�set_next6szBdb.set_nextcCs.|jjt@r|�|dd�n|�|j|�dSr=)r8r9r:r#r5r4rrr�
set_return:szBdb.set_returncCsL|dkrt��j}|��|r4|j|_||_|j}q|��t�|j�dSr
)	�sys�	_getframer5r$r,rYr"rZ�settracer4rrr�	set_traceAs
z
Bdb.set_tracecCsH|�|jdd�|jsDt�d�t��j}|rD||jk	rD|`|j}q*dSr=)r#r"rr]r_r^r5rYr4rrr�set_continuePs

zBdb.set_continuecCs"|j|_d|_d|_t�d�dS�NT)r"r7r>r'r]r_�rrrr�set_quit_szBdb.set_quitFc
Csb|�|�}ddl}|�||�}|s.d||fS|j�|g�}||krN|�|�t|||||�}	dS)NrzLine %s:%d does not exist)rr �getliner�
setdefault�appendr)
rrrRrO�cond�funcnamer r%�listrSrrr�	set_breakps

z
Bdb.set_breakcCs4||ftjkr|j|�|�|j|s0|j|=dSr
)r�bplistr�remove�rrrRrrr�
_prune_breaks�s
zBdb._prune_breakscCsj|�|�}||jkrd|S||j|kr6d||fStj||fdd�D]}|��qL|�||�dS)N�There are no breakpoints in %szThere is no breakpoint at %s:%d)rrrrl�deleteMero)rrrRrSrrr�clear_break�s


zBdb.clear_breakc
CsZz|�|�}Wn.tk
r<}zt|�WY�Sd}~XYnX|��|�|j|j�dSr
)�get_bpbynumber�
ValueErrorrQrqro�filer%)rr0rS�errrrr�clear_bpbynumber�szBdb.clear_bpbynumbercCsX|�|�}||jkrd|S|j|D]$}tj||f}|D]}|��q<q&|j|=dS)Nrp)rrrrlrq)rrr%ZblistrSrrr�clear_all_file_breaks�s

zBdb.clear_all_file_breakscCs,|js
dStjD]}|r|��qi|_dS)NzThere are no breakpoints)rr�
bpbynumberrq)rrSrrr�clear_all_breaks�s

zBdb.clear_all_breakscCs�|std��zt|�}Wn"tk
r:td|�d�YnXztj|}Wn"tk
rltd|�d�YnX|dkr�td|��|S)NzBreakpoint number expectedz Non-numeric breakpoint number %sz!Breakpoint number %d out of rangezBreakpoint %d already deleted)rt�intrry�
IndexError)rr0rNrSrrrrs�szBdb.get_bpbynumbercCs"|�|�}||jko ||j|kSr
�rrrnrrr�	get_break�s

�z
Bdb.get_breakcCs4|�|�}||jkr0||j|kr0tj||fp2gSr
)rrrrlrnrrr�
get_breaks�s

���zBdb.get_breakscCs&|�|�}||jkr|j|SgSdSr
r})rrrrr�get_file_breaks�s


zBdb.get_file_breakscCs|jSr
)rrcrrr�get_all_breaks�szBdb.get_all_breakscCs�g}|r|j|kr|j}|dk	rD|�||jf�||jkr<qD|j}q|��tdt|�d�}|dk	r�|�|j|j	f�|j}q^|dkr�tdt|�d�}||fS)Nrr)
�tb_frame�tb_nextrgrJr"r5�reverse�max�len�	tb_lineno)r�f�t�stack�irrr�	get_stack�s 
z
Bdb.get_stack�: cCs�ddl}ddl}|\}}|�|jj�}d||f}|jjrH||jj7}n|d7}|d7}d|jkr�|jd}	|d7}||�|	�7}|�|||j	�}
|
r�|||
�
�7}|S)Nrz%s(%r)z<lambda>z()Z
__return__z->)r �reprlibrr8rK�co_name�f_localsr.rerI�strip)rZframe_linenoZlprefixr r�r/rRr�s�rvr%rrr�format_stack_entrys 	

zBdb.format_stack_entryc	Cs�|dkrddl}|j}|dkr"|}|��t|t�r@t|dd�}t�|j�z*zt
|||�Wntk
rrYnXW5d|_	t�d�XdS)Nrz<string>�execT)�__main__�__dict__r$�
isinstancerQ�compiler]r_r,r'r�r)r�cmd�globals�localsr�rrr�run5s

zBdb.runc	Csz|dkrddl}|j}|dkr"|}|��t�|j�z,zt|||�WW�Stk
r^YnXW5d|_t�d�XdS)NrT)	r�r�r$r]r_r,r'�evalr)r�exprr�r�r�rrr�runevalKs
zBdb.runevalcCs|�|||�dSr
)r�)rr�r�r�rrr�runctx_sz
Bdb.runctxc	Os�t|�dkr|^}}}nV|s&td��nHd|krZ|�d�}|^}}ddl}|jdtdd�ntdt|�d��|��t�|j	�d}z(z|||�}Wntk
r�YnXW5d	|_
t�d�X|S)
NrAz6descriptor 'runcall' of 'Bdb' object needs an argument�funcrz0Passing 'func' as keyword argument is deprecated)�
stacklevelz7runcall expected at least 1 positional argument, got %drT)r��	TypeError�pop�warnings�warn�DeprecationWarningr$r]r_r,r'r)�args�kwdsrr�r��resrrr�runcallfs2

�
�
zBdb.runcallz($self, func, /, *args, **kwds))N)r)N)N)FNN)r�)NN)NN).rr	r
rrr$r,r(r)r*r+rHr1r2rPr6r;r3r?rCr#rXrZr[r\r`rardrkrorrrwrxrzrsr~rr�r�r�r�r�r�r�r��__text_signature__rrrrrsZ
+	


�







cCst���dSr
)rr`rrrrr`�sr`c@sVeZdZdZiZdgZddd�Zdd�Zdd	�Zd
d�Z	ddd
�Z
dd�Zdd�ZdS)rrNFcCs�||_d|_||_||_||_||_d|_d|_d|_t	j
|_t	j
d7_
|j�
|�||f|jkr||j||f�
|�n|g|j||f<dS)NTrr)ri�func_first_executable_linerur%rOrh�enabled�ignore�hitsr�nextrNryrgrl)rrur%rOrhrirrrr�szBreakpoint.__init__cCs>|j|jf}d|j|j<|j|�|�|j|s:|j|=dSr
)rur%ryrNrlrm)r�indexrrrrq�s

zBreakpoint.deleteMecCs
d|_dSrb�r�rcrrr�enable�szBreakpoint.enablecCs
d|_dSrWr�rcrrr�disable�szBreakpoint.disablecCs"|dkrtj}t|��|d�dS)N)ru)r]�stdoutr-�bpformat)r�outrrr�bpprint�szBreakpoint.bpprintcCs�|jrd}nd}|jr |d}n|d}d|j||j|jf}|jrT|d|jf7}|jrj|d|jf7}|jr�|jdkr�d	}nd
}|d|j|f7}|S)Nzdel  zkeep zyes  zno   z%-4dbreakpoint   %s at %s:%dz
	stop only if %sz
	ignore next %d hitsrr��z"
	breakpoint already hit %d time%s)rOr�rNrur%rhr�r�)rZdispZretZssrrrr��s(
�
zBreakpoint.bpformatcCsd|j|j|jfS)Nzbreakpoint %s at %s:%s)rNrur%rcrrr�__str__�szBreakpoint.__str__)FNN)N)
rr	r
r�rlryrrqr�r�r�r�r�rrrrr�s


cCsN|js|j|jkrdSdS|jj|jkr,dS|js:|j|_|j|jkrJdSdSrE)rir%rJr8r�r�)�br/rrr�
checkfuncnamesr�cCs�tj||f}|D]�}|jsqt||�s*q|jd7_|jsh|jdkrZ|jd8_qq�|dfSqzBt|j|j|j	�}|r�|jdkr�|jd8_n|dfWSWq|dfYSXqdS)NrrTF)NN)
rrlr�r�r�rhr�r�rIr�)rur%r/Z	possiblesr��valrrrrM#s*


rMc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TdbcCs |jj}|sd}td||�dS)N�???z+++ call)r8r�r-)rr/r��namerrrr;Tsz
Tdb.user_callcCsTddl}|jj}|sd}|�|jj�}|�||j|j�}td||j|d|�	��dS)Nrr�z+++�:)
r r8r�rrKrerJrIr-r�)rr/r r��fnr%rrrr3Xsz
Tdb.user_linecCstd|�dS)Nz
+++ return�r-)rr/Zretvalrrrr?_szTdb.user_returncCstd|�|��dS)Nz
+++ exception)r-ra)rr/Z	exc_stuffrrrrCas
zTdb.user_exceptionN)rr	r
r;r3r?rCrrrrr�Ssr�cCs&td|d�t|d�}td|�dS)Nzfoo(�)�
zbar returned)r-�bar)�n�xrrr�fooesr�cCstd|d�|dS)Nzbar(r�rAr�)�arrrr�jsr�cCst�}|�d�dS)Nzimport bdb; bdb.foo(10))r�r�)r�rrr�testnsr�)rFr]r�inspectrrr�__all__r:�	Exceptionrrr`rr�rMr�r�r�r�rrrr�<module>s&
{t"0zipapp.cpython-38.opt-2.pyc000064400000011110150335716500011436 0ustar00U

e5do�@s�ddlZddlZddlZddlZddlZddlZddlZdddgZdZej	�
d�rXdZne��ZGdd�de
�Zejd	d
��Zdd�Zdd
d�Zddd�Zdd�Zddd�Zedkr�e�dS)�N�ZipAppError�create_archive�get_interpreterz8# -*- coding: utf-8 -*-
import {module}
{module}.{fn}()
�win�utf-8c@seZdZdS)rN)�__name__�
__module__�__qualname__�r
r
�/usr/lib64/python3.8/zipapp.pyr!sc	cs8t|ttjf�r.t||��}|VW5QRXn|VdS�N)�
isinstance�str�os�PathLike�open)�archive�mode�fr
r
r�_maybe_open%srcCs$|r d|�t�d}|�|�dS)N�#!�
)�encode�shebang_encoding�write)r�interpreterZshebangr
r
r�_write_file_prefix.src
Cs�t|d��Z}|�d�}|dkr*d}|��t|d��&}t||�|�|�t�||�W5QRXW5QRX|r�t|t�r�t	�
|t	�|�jtj
B�dS)N�rb�r��wb)r�read�readlinerr�shutilZcopyfileobjr
rr�chmod�stat�st_mode�S_IEXEC)rZnew_archiver�srcZfirst_2Zdstr
r
r�
_copy_archive5s


 r)Fc
Cs�d}t|d�rt|d�rd}nt�|�}|��r4d}|rHt|||�dS|��sXtd��|d��}|rt|rttd��|s�|s�td��d}|r�|�d	�\}	}
}td
d�|	�	d�D��}td
d�|�	d�D��}
|
d	kr�|r�|
s�td|��t
j|	|d�}|dk�r|�d�}nt|d��s"t�|�}t
|d���}t||�|�rDtjntj}tj|d|d��^}|�d�D]4}|�|�}|dk�s�||��rf|�||����qf|�r�|�d|�d��W5QRXW5QRX|�r�t|d��s�|�|��jtjB�dS)NFr!r"TzSource does not existz__main__.pyz8Cannot specify entry point if the source has __main__.pyzArchive has no entry point�:css|]}|��VqdSr��isidentifier��.0�partr
r
r�	<genexpr>{sz!create_archive.<locals>.<genexpr>�.css|]}|��VqdSrr+r-r
r
rr0|szInvalid entry point: )�module�fnz.pyzrr �w)�compression�*r)�hasattr�pathlib�Path�is_filer)�existsr�	partition�all�split�
MAIN_TEMPLATE�formatZwith_suffixrr�zipfileZZIP_DEFLATEDZ
ZIP_STOREDZZipFileZrglob�relative_torZas_posixZwritestrrr$r%r&r')�source�targetr�main�filter�
compressedZsource_is_fileZhas_mainZmain_py�mod�sepr3Zmod_okZfn_ok�fdr5�zZchildZarcnamer
r
rrLsX
�


�
&c
CsFt|d��2}|�d�dkr8|�����t�W5QR�SW5QRXdS)Nrrr)rr!r"�strip�decoder)rrr
r
rr�scCs<ddl}|��}|jddddd�|jddddd�|jd	d
ddd�|jdd
ddd�|jddddd�|jddd�|�|�}|jr�tj�|j�s�t	d��t
|j�}td�|p�d��t
�d�tj�|j��r|jdk�stj�|j��rtj�|j|j��rt	d��|j�rt	d��t|j|j|j|j|jd�dS)Nrz--outputz-ozAThe name of the output archive. Required if SOURCE is an archive.)�default�helpz--pythonz-pzEThe name of the Python interpreter to use (default: no shebang line).z--mainz-mzLThe main function of the application (default: use an existing __main__.py).z
--compressz-c�
store_truezQCompress files with the deflate method. Files are stored uncompressed by default.)�actionrOz--infoFz)Display the interpreter from the archive.)rNrQrOrCz'Source directory (or existing archive).)rOz%Can only get info for an archive filezInterpreter: {}z<none>z-In-place editing of archives is not supportedz,Cannot change the main function when copying)rrErG)�argparse�ArgumentParser�add_argument�
parse_args�infor�path�isfilerC�
SystemExitr�printr@�sys�exit�outputr;�samefilerEr�python�compress)�argsrR�parserrr
r
rrE�sN
�
�
�
�
��


�
�rE�__main__)N)NNNNF)N)�
contextlibrr8r#r%r[rA�__all__r?�platform�
startswithr�getfilesystemencoding�
ValueErrorr�contextmanagerrrr)rrrErr
r
r
r�<module>s0



�
J
1locale.cpython-38.opt-2.pyc000064400000072574150335716500011417 0ustar00U

e5do1�M@s*ddlZddlZddlZddlZddlZddlmZddlZddddddd	d
ddd
ddddddddddddgZ	dd�Z
dd�ZzddlTWnLe
k
r�dZd Zd!ZdZd"Zd#Zd$Zd%ZeZd&d	�Z�d�d'd�ZYnXde�kr�eZd
e�kr�e
ZeZiZe�e�d(d	��Zd)d*�Z �d�d,d-�Z!d.d/�Z"e�#d0�Z$�d�d1d2�Z%�d�d3d�Z&�d�d4d�Z'�d�d6d�Z(d7d�Zd8d9�Z)e*fd:d
�Z+d;d�Z,d<d=�Z-eZ.d>d?�Z/d@dA�Z0dBd�Z1dCdD�Z2dEdF�Z3�d�dHd�Z4efdId�Z5�d�dJd�ZefdKd�Z6ej7�8dL��r�d�dMd�Z9nRze:Wn<e;k
�rLe<edN��r<�d�dOd�Z9n�d�dPd�Z9YnX�d�dQd�Z9dRdRdSdTdTdUdVdWdXdYdSdZd[d\dSdSdSd]d^d_d`d\dadZdbdcd[dddedfdgdTdhdidUdjdkdldmdndodWdXdYdp�,Z=e>e=�?��D]"\Z@ZAe@�Bdqdr�Z@e=�Ce@eA��q�dsdsdsdtdudvdwdwdxdydzdzd{d|d}d~d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d~d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�dRd�dRdRd{d�dRdRd�d�d�d�d�d�d�d�d{d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d{d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d{d�d�d�d�d�d�d�d{d�d{dRd{d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d̐d�d�d�d�d�d�d�d�d�d�d�d�d�d	�d	�d
�dd��d�d
�d
�d
�d
�d
�d�d
�d�d�d�d�d�d�d�d�dd�d�d�d��d�d�d�dd͐d�d�d�d�d�d�d�d�d�d�d�d�d�dd�d�d��d�d�d �d �d �d!�d"�d#�d$�d%�d&�d&�d'�d(�d&�d&�d%�d%d{d�d{d�d{d�d)�d*�d)�d)�d+�d+�d+�d�d�d,�d-�d-�d-�d.�d.�d-�d-�d-�d-�d-�d/�d/�d/�d0�d/�d1�d2�d3�d3�d4�d5�d5�d6�d6�d6�d7�d6�d6�d8�d8�d9�d:�d;�d;�d<�d<�d=�d>�d?�d@�dA�dB�dC�dD�dD�dE�dE�dD�dB�dB�dF�dF�dG�dH�dI�dI�dJ�dK�dL�dM�dN�dN�dO�dP�dQ�dQ�dR�dR�dS�dT�dU�dU�dV�dV�dW�dW�dX�dYd�d��dZ�d[�d\�d]�d^�d_dǐd`d�dǐda�da�db�dc�db�db�db�db�dd�dd�de�de�dc�dc�da�df�df�dg�dh�di�di�dj�dk�dk�dl�dm�dn�do�dp�dq�dp�dr�dr�ds�ds�ds�dt�dudRdR�dv�dv�dw�dt�du�dt�dx�dy�dz�dz�dz�d{�d{�d|�dz�d}�d~�d~�d�d��d��d��d��d��d��d��d��d��d��d��d�d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d�d�d�d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d�d��d��d��d��d��d��d��d��d��d��dddddÐdÐdĐdĐdŐdƐdǐdȐdȐdɐdɐdʐdːd�d��d͐d�d��dϐdϐdАdѐd�d�d��dҐdҐdӐ�LZD�dԐdՐd֐dאdؐdِdڐdېdܐdݐdސdߐd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d��d��d��d��d��d��d��d��d��d��d��d�d�d�d�d�d�d�d�d�d	�d
�d�d�d
�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d �d!�d"�d#�d$�d%�d&�d'�d(�d)�d*�d+�d,�d-�d-�d.�d/�d0�d1�d2�d3�d4�d5�d6�d7�d8�d9�d:�d;�d<�d=�d>�d?�d@�dA�dB�dC�dD�dE�dF�dG�dH�dI�dJ�dK�dL�dM�dN�dO�dP�dQ�dR�dS�dT�dU�dV�dW�dX�dY�dZ�d[�d\�d]�d^�d_�d`�da�db�dc�dd�de�df�de�df�dg�dh�di�dj�dk�dl�dm�dl�dn�do�dp�dq�dr�ds�dt�du�dv�dw�dx�dy�dz�d{�d|�d}�d~�d�d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d��d���ZE�d��d��ZFzeWne;k
�
r�YnXe	�G�d��eH�d�k�r&eI�d��eI�eF�eI�eI�d��eI�e-�dS(��N)�str�	getlocale�getdefaultlocale�getpreferredencoding�Error�	setlocale�resetlocale�
localeconv�strcoll�strxfrmr�atof�atoi�format�
format_string�currency�	normalize�LC_CTYPE�
LC_COLLATE�LC_TIME�LC_MONETARY�
LC_NUMERIC�LC_ALL�CHAR_MAXcCs||k||kS�N�)�a�brr�/usr/lib64/python3.8/locale.py�_strcoll!srcCs|Srr)�srrr�_strxfrm'sr )�*�������cCs,dgddddgddddddddddddd�S)Nr"��.)�grouping�currency_symbol�n_sign_posn�
p_cs_precedes�
n_cs_precedes�mon_grouping�n_sep_by_space�
decimal_point�
negative_sign�
positive_sign�p_sep_by_space�int_curr_symbol�p_sign_posn�
thousands_sep�mon_thousands_sep�frac_digits�mon_decimal_point�int_frac_digitsrrrrrr	?s&�cCs|dkrtd��dS)N)Nr)�Cz*_locale emulation only supports "C" localer=)r)�category�valuerrrrWscCst�}tr|�t�|Sr)�_localeconv�_override_localeconv�update)�drrrr	ls
ccsJd}|D]<}|tkrdS|dkr:|dkr2td��|Vq2|V|}qdS)Nrzinvalid grouping)r�
ValueError)r+Z
last_interval�intervalrrr�_grouping_intervalszsrFFc
Cs�t�}||rdpd}||r dp"d}|s2|dfS|ddkr\|��}|t|�d�}|}nd}d}g}t|�D]B}	|r�|dd	kr�|}d}q�|�||	d��|d|	�}qp|r�|�|�|��||�|�|t|�t|�d
fS)Nr9r8r0r+r���� r)�
0123456789r')r	�rstrip�lenrF�append�reverse�join)
r�monetary�convr8r+�strippedZright_spacesZleft_spaces�groupsrErrr�_group�s2
�rScCsdd}|r&||dkr&|d7}|d8}qt|�d}|rT||dkrT|d8}|d8}q2|||d�S)NrrHr')rK)rZamountZlposZrposrrr�_strip_padding�s

rTzG%(?:\((?P<key>.*?)\))?(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]c	Gs�|r||f|}n||}|ddkr~d}|�d�}|rRt|d|d�\|d<}t�|r^dp`d}|�|�}|r�t||�}n2|ddkr�d}|r�t||d�\}}|r�t||�}|S)	NrGZeEfFgGrr*�rOr;r2Zdiu)�splitrSr	rNrT)	�percentr?r+rO�
additionalZ	formattedZseps�partsr2rrr�_format�s*
�

rZc
	Cs
tt�|��}t�d|�}t|tj�rjg}|D]8}|��ddkrN|�d�q.|�t	|��|||��q.n�t|t
�sz|f}g}d}|D]r}|��ddkr�|�d�q�|�d��d�}	|�t	|��||||f||d|d|	����|d|	7}q�t
|�}||S)Nz%srG�%rZ	modifiersr!r')�list�_percent_re�finditer�sub�
isinstance�_collections_abc�Mapping�grouprLrZ�tuple�count)
�f�valr+rOZpercentsZnew_fZnew_valZperc�iZ	starcountrrrr�s4
��cGs^ddl}|jdtdd�t�|�}|r:t|���t|�krJtdt|���t	||||f|��S)Nrz`This method will be removed in a future version of Python. Use 'locale.format_string()' instead.r()�
stacklevelzHformat() must be given exactly one %%char format specifier, %s not valid)
�warnings�warn�DeprecationWarningr]�matchrKrcrD�reprrZ)rWr?r+rOrXrjrmrrrr�s�
�TcCsft�}||rdpd}|dkr&td��td|t|�|dd�}d|d	}|r�||rXd
pZd}||dkrld
pnd}||dkr�dp�d}	|r�||	r�dp�d|}n||	r�dp�d|}||dkr�dp�d}
||dkr�dp�d}|
dkr�d|d}n`|
dk�r||}nL|
dk�r||}n8|
dk�r2|�d|�}n |
dk�rJ|�d	|�}n||}|�dd��d	d�S)Nr<r:r"z9Currency formatting is not possible using the 'C' locale.z%%.%ifTrU�<�>r6r,rr/r.r1r5rHr)r-r7r3r4�(�)r'r(r$r&)r	rDrZ�abs�replace)rgZsymbolr+Z
internationalrPZdigitsrZsmbZprecedesZ	separatedZsign_posZsignrrrrs6





cCs
td|�S)Nz%.12g)rZ)rgrrrr0scCs:t�}|d}|r|�|d�}|d}|r6|�|d�}|S)Nr8r)r2r*)r	rt)�stringrP�tsZddrrr�
delocalize4srwcCs|t|��Sr)rw)ru�funcrrrrDscCstt|��Sr)�intrw)rurrrr
HscCsBttd�tddd�}t|dt|��td�}t|dt|��dS)Nr)z%di�[r'�isg��Q�	@)rrr�printr
rr)�s1rrr�_testLs

r}cCs�d|kr|d|�d��}n|}t�|�}tjj�|��|�}|}|��}|tkr\t|}n(|�dd�}|�dd�}|tkr�t|}|d|S)Nr*�_r)�-)�index�	encodings�normalize_encoding�aliases�get�lower�locale_encoding_aliasrt)�code�encoding�langname�
norm_encodingrrr�_replace_encoding^s 
�
r�cCsR|dkrFd|kr|dS|�d�\}}}|dkr4|S|dkrFt|d�S|d|S)N�euror*z.ISO8859-15)�
ISO8859-15�UTF-8�	ISO8859-1r��@)�	partitionr�)r��modifierr~r�rrr�_append_modifierus
r�c	Cs�|��}d|kr|�dd�}d|kr6|�dd�\}}nd}d|krZ|�d�dd�\}}n|}d}|}|r�|�dd�}|�dd�}|d|7}|}|r�|d|7}t�|d�}|dk	r�|S|�rt�|d�}|dk	�rd|kr�t||�S|�dd�d��|k�r|S|�r�|}|�r"|d|7}t�|d�}|dk	�rnd|k�rLt||�S|�dd�\}}t||�d|S|�r�t�|d�}|dk	�r�d|k�r�t||�}t||�S|�dd�\}}|��|k�r�t||�d|S|S)	N�:r*r�r'r)r(rr~)r�rtrV�locale_aliasr�r�r�)	�
localenamer�r�r�r�Zlang_encr�Zlookup_nameZdefmodrrrr�s`








cCs~t|�}d|kr8|�dd�\}}|dkr8d|kr8|dfSd|krVt|�d�dd��S|dkrbdS|d	krnd
Std|��dS)Nr�r'r�r*�iso-8859-15r(r=)NNr��Nr�zunknown locale: %s)rrVrdrD)r�r�r�rrr�_parse_localename�sr�c	Cs\z4|\}}|dkrd}|dkr$|WS|d|WSWn"ttfk
rVtd�d�YnXdS)Nr=r*zXLocale must be None, a string, or an iterable of two strings -- language code, encoding.)�	TypeErrorrD)ZlocaletupleZlanguager�rrr�_build_localename�s�r��rrZLANG�LANGUAGEc	Cs�zddl}|��\}}Wnttfk
r0Yn8Xtjdkr`|r`|dd�dkr`t�t|d��}||fSddl	}|j
j}|D],}||d�}|r||dkr�|�d�d}q�q|d}t|�S)NrZwin32r(Z0xr�r�r=)
�_localeZ_getdefaultlocale�ImportError�AttributeError�sys�platform�windows_localer�ry�os�environrVr�)Zenvvarsr�r�r�r��lookupZvariabler�rrrr
s$
cCs(t|�}|tkr d|kr td��t|�S)N�;z category LC_ALL is not supported)�
_setlocalerr�r�)r>r�rrrr?s
cCs$|rt|t�stt|��}t||�Sr)r`�_builtin_strrr�r�)r>ZlocalerrrrQscCst|tt���dSr)r�r�r)r>rrrrbs�wincCstjjrdSddl}|�d�S)Nr�rF)r��flags�	utf8_mode�_bootlocaler)�do_setlocaler�rrrrnsZgetandroidapilevelcCsdSr�r)r�rrrr|scCs&tjjrdSt�d}|dkr"d}|S)Nr�r'�ascii)r�r�r�r)r��resrrrr�s
cCs`tjjrdSddl}|rDtt�}zttd�Wntk
rBYnX|�d�}|r\tt|�|S)Nr�rr)F)r�r�r�r�rrrr)r�r�Zoldloc�resultrrrr�s

r=r�ZJIS7ZeucJPzKOI8-CZCP1251ZCP1255ZCP1256z	ISO8859-2z	ISO8859-5r�z
ISO8859-10z
ISO8859-11z
ISO8859-13z
ISO8859-14z
ISO8859-16z	ISO8859-3z	ISO8859-4z	ISO8859-6z	ISO8859-7z	ISO8859-8z	ISO8859-9ZSJISZTACTISZeucKRr�zKOI8-RzKOI8-TzKOI8-UZRK1048),�437�c�enZjisZjis7ZajecZkoi8cZmicrosoftcp1251Zmicrosoftcp1255Zmicrosoftcp1256Z88591Z88592Z88595Z885915r��latin_1�	iso8859_1�
iso8859_10�
iso8859_11�
iso8859_13�
iso8859_14�
iso8859_15�
iso8859_16�	iso8859_2�	iso8859_3�	iso8859_4�	iso8859_5�	iso8859_6�	iso8859_7�	iso8859_8�	iso8859_9�
iso2022_jp�	shift_jis�tactis�euc_jp�euc_kr�utf_8�koi8_rZkoi8_tZkoi8_u�kz1048�cp1251�cp1255�cp1256r~r)zaz_AZ.KOI8-Czaa_DJ.ISO8859-1zaa_ER.UTF-8zaa_ET.UTF-8zaf_ZA.ISO8859-1zagr_PE.UTF-8zak_GH.UTF-8zam_ET.UTF-8zen_US.ISO8859-1zan_ES.ISO8859-15zanp_IN.UTF-8zar_AA.ISO8859-6zar_AE.ISO8859-6zar_BH.ISO8859-6zar_DZ.ISO8859-6zar_EG.ISO8859-6zar_IN.UTF-8zar_IQ.ISO8859-6zar_JO.ISO8859-6zar_KW.ISO8859-6zar_LB.ISO8859-6zar_LY.ISO8859-6zar_MA.ISO8859-6zar_OM.ISO8859-6zar_QA.ISO8859-6zar_SA.ISO8859-6zar_SD.ISO8859-6zar_SS.UTF-8zar_SY.ISO8859-6zar_TN.ISO8859-6zar_YE.ISO8859-6zas_IN.UTF-8zast_ES.ISO8859-15zayc_PE.UTF-8zaz_AZ.ISO8859-9Ezaz_IR.UTF-8zbe_BY.CP1251zbe_BY.UTF-8@latinzbg_BG.UTF-8zbem_ZM.UTF-8zber_DZ.UTF-8zber_MA.UTF-8zbg_BG.CP1251zbhb_IN.UTF-8zbho_IN.UTF-8zbho_NP.UTF-8zbi_VU.UTF-8zbn_BD.UTF-8zbn_IN.UTF-8zbo_CN.UTF-8zbo_IN.UTF-8znb_NO.ISO8859-1zbr_FR.ISO8859-1zbrx_IN.UTF-8zbs_BA.ISO8859-2zbyn_ER.UTF-8zfr_CA.ISO8859-1zen_US.UTF-8zca_ES.ISO8859-1zca_AD.ISO8859-1zca_ES.UTF-8@valenciazca_FR.ISO8859-1zca_IT.ISO8859-1zce_RU.UTF-8zzh_CN.eucCNzzh_TW.eucTWzchr_US.UTF-8zckb_IQ.UTF-8zcmn_TW.UTF-8zcrh_UA.UTF-8zhr_HR.ISO8859-2zcs_CZ.ISO8859-2zcsb_PL.UTF-8zcv_RU.UTF-8zcy_GB.ISO8859-1zda_DK.ISO8859-1zde_DE.ISO8859-1zde_AT.ISO8859-1zde_BE.ISO8859-1zde_CH.ISO8859-1zde_IT.ISO8859-1zde_LI.UTF-8zde_LU.ISO8859-1zdoi_IN.UTF-8znl_NL.ISO8859-1znl_BE.ISO8859-1zdv_MV.UTF-8zdz_BT.UTF-8zee_EE.ISO8859-4zet_EE.ISO8859-1zel_GR.ISO8859-7zel_CY.ISO8859-7zel_GR.ISO8859-15zen_AG.UTF-8zen_AU.ISO8859-1zen_BE.ISO8859-1zen_BW.ISO8859-1zen_CA.ISO8859-1zen_DK.ISO8859-1zen_DL.UTF-8zen_GB.ISO8859-1zen_HK.ISO8859-1zen_IE.ISO8859-1zen_IL.UTF-8zen_IN.ISO8859-1zen_NG.UTF-8zen_NZ.ISO8859-1zen_PH.ISO8859-1zen_SC.UTF-8zen_SG.ISO8859-1zen_US.ISO8859-15zen_ZA.ISO8859-1zen_ZM.UTF-8zen_ZW.ISO8859-1zen_ZS.UTF-8zen_EN.ISO8859-1zeo_XX.ISO8859-3zeo.UTF-8zeo_EO.ISO8859-3zeo_US.UTF-8zes_ES.ISO8859-1zes_AR.ISO8859-1zes_BO.ISO8859-1zes_CL.ISO8859-1zes_CO.ISO8859-1zes_CR.ISO8859-1zes_CU.UTF-8zes_DO.ISO8859-1zes_EC.ISO8859-1zes_GT.ISO8859-1zes_HN.ISO8859-1zes_MX.ISO8859-1zes_NI.ISO8859-1zes_PA.ISO8859-1zes_PE.ISO8859-1zes_PR.ISO8859-1zes_PY.ISO8859-1zes_SV.ISO8859-1zes_US.ISO8859-1zes_UY.ISO8859-1zes_VE.ISO8859-1zet_EE.ISO8859-15zeu_ES.ISO8859-1zeu_FR.ISO8859-1zfa_IR.UTF-8zfa_IR.ISIRI-3342zff_SN.UTF-8zfi_FI.ISO8859-15zfil_PH.UTF-8zfi_FI.ISO8859-1zfo_FO.ISO8859-1zfr_FR.ISO8859-1zfr_BE.ISO8859-1zfr_CH.ISO8859-1zfr_LU.ISO8859-1zfur_IT.UTF-8zfy_DE.UTF-8zfy_NL.UTF-8zga_IE.ISO8859-1zgl_ES.ISO8859-1zgd_GB.ISO8859-1zgez_ER.UTF-8zgez_ET.UTF-8zgu_IN.UTF-8zgv_GB.ISO8859-1zha_NG.UTF-8zhak_TW.UTF-8zhe_IL.ISO8859-8zhi_IN.ISCII-DEVzhif_FJ.UTF-8zhne_IN.UTF-8zhsb_DE.ISO8859-2zht_HT.UTF-8zhu_HU.ISO8859-2zhy_AM.UTF-8zhy_AM.ARMSCII_8zia.UTF-8zia_FR.UTF-8zis_IS.ISO8859-1zid_ID.ISO8859-1zig_NG.UTF-8zik_CA.UTF-8zit_IT.ISO8859-1zit_CH.ISO8859-1ziu_CA.NUNACOM-8ziw_IL.UTF-8zja_JP.eucJPz
ja_JP.SJISzka_GE.GEORGIAN-ACADEMYzka_GE.GEORGIAN-PSzkab_DZ.UTF-8z
kk_KZ.ptcp154zkl_GL.ISO8859-1zkm_KH.UTF-8zkn_IN.UTF-8zko_KR.eucKRzkok_IN.UTF-8zks_IN.UTF-8zks_IN.UTF-8@devanagarizku_TR.ISO8859-9zkw_GB.ISO8859-1zky_KG.UTF-8zlb_LU.UTF-8zlg_UG.ISO8859-10zli_BE.UTF-8zli_NL.UTF-8zlij_IT.UTF-8zlt_LT.ISO8859-13zln_CD.UTF-8zlo_LA.MULELAO-1zlo_LA.IBM-CP1133zlv_LV.ISO8859-13zlzh_TW.UTF-8zmag_IN.UTF-8zmai_IN.UTF-8zmai_NP.UTF-8zmfe_MU.UTF-8zmg_MG.ISO8859-15zmhr_RU.UTF-8zmi_NZ.ISO8859-1zmiq_NI.UTF-8zmjw_IN.UTF-8zmk_MK.ISO8859-5zml_IN.UTF-8zmn_MN.UTF-8zmni_IN.UTF-8zmr_IN.UTF-8zms_MY.ISO8859-1zmt_MT.ISO8859-3zmy_MM.UTF-8znan_TW.UTF-8znds_DE.UTF-8znds_NL.UTF-8zne_NP.UTF-8znhn_MX.UTF-8zniu_NU.UTF-8zniu_NZ.UTF-8znl_AW.UTF-8znn_NO.ISO8859-1zno_NO.ISO8859-1zny_NO.ISO8859-1znr_ZA.ISO8859-1znso_ZA.ISO8859-15zoc_FR.ISO8859-1zom_ET.UTF-8zom_KE.ISO8859-1zor_IN.UTF-8zos_RU.UTF-8zpa_IN.UTF-8zpa_PK.UTF-8zpap_AN.UTF-8zpap_AW.UTF-8zpap_CW.UTF-8zpd_US.ISO8859-1zpd_DE.ISO8859-1zph_PH.ISO8859-1zpl_PL.ISO8859-2zpt_PT.ISO8859-1zpt_BR.ISO8859-1zpp_AN.ISO8859-1zps_AF.UTF-8zquz_PE.UTF-8zraj_IN.UTF-8zro_RO.ISO8859-2zru_RU.UTF-8zru_UA.KOI8-Uzru_RU.KOI8-Rzrw_RW.ISO8859-1zsa_IN.UTF-8zsat_IN.UTF-8zsc_IT.UTF-8zsd_IN.UTF-8zsd_IN.UTF-8@devanagarizsd_PK.UTF-8zse_NO.UTF-8zsr_RS.UTF-8@latinzsgs_LT.UTF-8zsr_CS.ISO8859-2zsh_HR.ISO8859-2zshn_MM.UTF-8zshs_CA.UTF-8zsi_LK.UTF-8zsid_ET.UTF-8zsk_SK.ISO8859-2zsl_SI.ISO8859-2zsl_CS.ISO8859-2zsm_WS.UTF-8zso_DJ.ISO8859-1zso_ET.UTF-8zso_KE.ISO8859-1zso_SO.ISO8859-1zsr_CS.ISO8859-5zsq_AL.ISO8859-2zsq_MK.UTF-8zsr_RS.UTF-8zsr_CS.UTF-8@latinzsr_CS.UTF-8zsr_ME.UTF-8zsr_CS.CP1251zss_ZA.ISO8859-1zst_ZA.ISO8859-1zsv_SE.ISO8859-1zsv_FI.ISO8859-1zsw_KE.UTF-8zsw_TZ.UTF-8zszl_PL.UTF-8z
ta_IN.TSCII-0zta_LK.UTF-8ztcy_IN.UTF-8zte_IN.UTF-8ztg_TJ.KOI8-Czth_TH.ISO8859-11zth_TH.TIS620zthe_NP.UTF-8zti_ER.UTF-8zti_ET.UTF-8ztig_ER.UTF-8ztk_TM.UTF-8ztl_PH.ISO8859-1ztn_ZA.ISO8859-15zto_TO.UTF-8ztpi_PG.UTF-8ztr_TR.ISO8859-9ztr_CY.ISO8859-9zts_ZA.ISO8859-1ztt_RU.TATAR-CYRztt_RU.UTF-8@iqtelifzug_CN.UTF-8zuk_UA.KOI8-Uz	en_US.utfzunm_US.UTF-8zur_PK.CP1256zur_IN.UTF-8zuz_UZ.UTF-8zve_ZA.UTF-8z
vi_VN.TCVNzvi_VN.VISCIIzwa_BE.ISO8859-1zwae_CH.UTF-8zwal_ET.UTF-8zwo_SN.UTF-8zxh_ZA.ISO8859-1zyi_US.CP1255zyo_NG.UTF-8zyue_HK.UTF-8zyuw_PG.UTF-8zzh_CN.gb2312z
zh_TW.big5zzh_HK.big5hkscszzh_SG.GB2312z	zh_SG.GBKzzu_ZA.ISO8859-1(LZa3Za3_azz
a3_az.koicZaa_djZaa_erZaa_etZafZaf_zaZagr_peZak_ghZamZam_etZamericanZan_esZanp_inZarZar_aaZar_aeZar_bhZar_dzZar_egZar_inZar_iqZar_joZar_kwZar_lbZar_lyZar_maZar_omZar_qaZar_saZar_sdZar_ssZar_syZar_tnZar_ye�arabic�asZas_inZast_esZayc_peZazZaz_azzaz_az.iso88599eZaz_irZbezbe@latinz
be_bg.utf8Zbe_byzbe_by@latinZbem_zmZber_dzZber_maZbgZbg_bgzbhb_in.utf8Zbho_inZbho_npZbi_vuZbn_bdZbn_inZbo_cnZbo_inZbokmalubokmål�brZbr_frZbrx_inZbsZbs_baZ	bulgarianZbyn_err�zc-frenchzc.asciizc.enz
c.iso88591zc.utf8Zc_czc_c.cZcaZca_adZca_eszca_es@valenciaZca_frZca_itZcatalanZce_ruZcextendz	chinese-sz	chinese-tZchr_usZckb_iqZcmn_twZcrh_uaZcroatianZcsZcs_csZcs_czZcsb_plZcv_ruZcyZcy_gbZczZcz_czZczechZdaZda_dkZdanishZdanskZdeZde_atZde_beZde_chZde_deZde_itz
de_li.utf8Zde_luZdeutschZdoi_inZdutchzdutch.iso88591Zdv_mvZdz_btZeeZee_eeZeestiZelZel_cyZel_grz
el_gr@euror�Zen_agZen_auZen_beZen_bwZen_caZen_dkz
en_dl.utf8Zen_gbZen_hkZen_ieZen_ilZen_inZen_ngZen_nzZen_phz
en_sc.utf8Zen_sgZen_ukZen_uszen_us@euro@euroZen_zaZen_zmZen_zwz
en_zw.utf8Zeng_gbZenglishzenglish.iso88591Z
english_ukzenglish_united-stateszenglish_united-states.437Z
english_usZeozeo.utf8Zeo_eoz
eo_us.utf8Zeo_xxZesZes_arZes_boZes_clZes_coZes_crZes_cuZes_doZes_ecZes_esZes_gtZes_hnZes_mxZes_niZes_paZes_peZes_prZes_pyZes_svZes_usZes_uyZes_veZestonianZetZet_eeZeuZeu_esZeu_frZfaZfa_irzfa_ir.isiri3342Zff_snZfiZfi_fiZfil_phZfinnishZfoZfo_fo�frZfr_beZfr_caZfr_chZfr_frZfr_luu	françaisZfre_frZfrenchzfrench.iso88591Z
french_franceZfur_itZfy_deZfy_nlZgaZga_ieZgalegoZgalicianZgdZgd_gbZger_deZgermanzgerman.iso88591Zgerman_germanyZgez_erZgez_etZglZgl_es�greekZgu_inZgvZgv_gbZha_ngZhak_twZheZhe_il�hebrew�hiZhi_inzhi_in.isciidevZhif_fjZhneZhne_inZhrZhr_hrZhrvatskiZhsb_deZht_htZhuZhu_huZ	hungarianZhy_amzhy_am.armscii8ZiaZia_frZ	icelandic�idZid_idZig_ngZik_ca�inZin_idrzZis_isz
iso-8859-1r�z	iso8859-1z
iso8859-15�
iso_8859_1�iso_8859_15�itZit_chZit_itZitalianZiuZiu_caziu_ca.nunacom8ZiwZiw_ilz
iw_il.utf8ZjaZja_jpz	ja_jp.euczja_jp.mscodez	ja_jp.pckZjapanZjapanesezjapanese-euczjapanese.eucZjp_jpZkaZka_gezka_ge.georgianacademyzka_ge.georgianpszka_ge.georgianrsZkab_dzZkk_kzZklZkl_glZkm_khZknZkn_inZkoZko_krz	ko_kr.eucZkok_in�koreanz
korean.eucZksZks_inzks_in@devanagari.utf8Zku_tr�kwZkw_gbZkyZky_kgZlb_luZlg_ugZli_beZli_nlZlij_itZ
lithuanianZln_cd�loZlo_lazlo_la.cp1133zlo_la.ibmcp1133zlo_la.mulelao1�ltZlt_ltZlvZlv_lvZlzh_twZmag_inZmaiZmai_inZmai_npZmfe_muZmg_mgZmhr_ru�miZmi_nzZmiq_niZmjw_inZmkZmk_mkZmlZml_inZmn_mnZmni_inZmrZmr_inZmsZms_myZmtZmt_mtZmy_mmZnan_twZnbZnb_noZnds_deZnds_nlZne_npZnhn_mxZniu_nuZniu_nz�nlZnl_awZnl_beZnl_nlZnnZnn_noZnoz
no@nynorskZno_nozno_no.iso88591@bokmalzno_no.iso88591@nynorskZ	norwegianZnrZnr_zaZnsoZnso_zaZnyZny_noZnynorskZocZoc_frZom_etZom_ke�orZor_inZos_ruZpaZpa_inZpa_pkZpap_anZpap_awZpap_cwZpdZpd_deZpd_usZphZph_phZplZpl_plZpolishZ
portugueseZportuguese_brazil�posixz
posix-utf2ZppZpp_anZps_afZptZpt_brZpt_ptZquz_peZraj_inZroZro_roZromanianZruZru_ruZru_uaZrumanianZrussianZrwZrw_rwZsa_inZsat_inZsc_itZsdZsd_inzsd_in@devanagari.utf8Zsd_pkZse_noZ
serbocroatianZsgs_ltZshzsh_ba.iso88592@bosniaZsh_hrzsh_hr.iso88592Zsh_spZsh_yuZshn_mmZshs_caZsiZsi_lkZsid_etZsinhalaZskZsk_skZslZsl_csZsl_siZslovakZsloveneZ	slovenianZsm_wsZso_djZso_etZso_keZso_soZspZsp_yuZspanishZ
spanish_spainZsqZsq_alZsq_mk�srzsr@cyrilliczsr@latnZsr_cszsr_cs.iso88592@latnz
sr_cs@latnZsr_meZsr_rsz
sr_rs@latnZsr_spZsr_yuzsr_yu.cp1251@cyrilliczsr_yu.iso88592zsr_yu.iso88595zsr_yu.iso88595@cyrilliczsr_yu.microsoftcp1251@cyrillicz
sr_yu.utf8zsr_yu.utf8@cyrilliczsr_yu@cyrillicZssZss_za�stZst_zaZsvZsv_fiZsv_seZsw_keZsw_tzZswedishZszl_plZtaZta_inzta_in.tsciizta_in.tscii0Zta_lkztcy_in.utf8ZteZte_inZtgZtg_tjZthZth_thzth_th.tactiszth_th.tis620�thaiZthe_npZti_erZti_etZtig_erZtk_tmZtlZtl_phZtnZtn_zaZto_toZtpi_pgZtrZtr_cyZtr_trrvZts_zaZttZtt_ruztt_ru.tatarcyrz
tt_ru@iqtelifZturkishZug_cnZukZuk_uaZunivZ	universalzuniversal.utf8@ucs4Zunm_usZurZur_inZur_pkZuzZuz_uzzuz_uz@cyrillicZveZve_zaZviZvi_vnz
vi_vn.tcvnzvi_vn.tcvn5712zvi_vn.visciizvi_vn.viscii111ZwaZwa_beZwae_chZwal_etZwo_snZxhZxh_zaZyiZyi_usZyo_ngZyue_hkZyuw_pgZzhZzh_cnz
zh_cn.big5z	zh_cn.eucZzh_hkzzh_hk.big5hkZzh_sgz	zh_sg.gbkZzh_twz	zh_tw.euczzh_tw.euctwZzuZzu_zaZaf_ZAZsq_ALZgsw_FRZam_ETZar_SAZar_IQZar_EGZar_LYZar_DZZar_MAZar_TNZar_OMZar_YEZar_SYZar_JOZar_LBZar_KWZar_AEZar_BHZar_QAZhy_AMZas_INZaz_AZZba_RUZeu_ESZbe_BYZbn_INZbs_BAZbr_FRZbg_BGZca_ESZzh_CHSZzh_TWZzh_CNZzh_HKZzh_SGZzh_MOZzh_CHTZco_FRZhr_HRZhr_BAZcs_CZZda_DKZgbz_AFZdiv_MVZnl_NLZnl_BEZen_USZen_GBZen_AUZen_CAZen_NZZen_IEZen_ZAZen_JAZen_CBZen_BZZen_TTZen_ZWZen_PHZen_INZen_MYZet_EEZfo_FOZfil_PHZfi_FIZfr_FRZfr_BEZfr_CAZfr_CHZfr_LUZfr_MCZfy_NLZgl_ESZka_GEZde_DEZde_CHZde_ATZde_LUZde_LIZel_GRZkl_GLZgu_INZha_NGZhe_ILZhi_INZhu_HUZis_ISZid_IDZiu_CAZga_IEZit_ITZit_CHZja_JPZkn_INZkk_KZZkh_KHZqut_GTZrw_RWZkok_INZko_KRZky_KGZlo_LAZlv_LVZlt_LTZdsb_DEZlb_LUZmk_MKZms_MYZms_BNZml_INZmt_MTZmi_NZZarn_CLZmr_INZmoh_CAZmn_MNZmn_CNZne_NPZnb_NOZnn_NOZoc_FRZor_INZps_AFZfa_IRZpl_PLZpt_BRZpt_PTZpa_INZquz_BOZquz_ECZquz_PEZro_ROZrm_CHZru_RUZsmn_FIZsmj_NOZsmj_SEZse_NOZse_SEZse_FIZsms_FIZsma_NOZsma_SEZsa_INZsr_SPZsr_BAZsi_LKZns_ZAZtn_ZAZsk_SKZsl_SIZes_ESZes_MXZes_GTZes_CRZes_PAZes_DOZes_VEZes_COZes_PEZes_ARZes_ECZes_CLZes_URZes_PYZes_BOZes_SVZes_HNZes_NIZes_PRZes_USZsw_KEZsv_SEZsv_FIZsyr_SYZtg_TJZtmz_DZZta_INZtt_RUZte_INZth_THZbo_BTZbo_CNZtr_TRZtk_TMZug_CNZuk_UAZwen_DEZur_PKZur_INZuz_UZZvi_VNZcy_GBZwo_SNZxh_ZAZsah_RUZii_CNZyo_NGZzu_ZA)�i6ii�i^iiiiiiii i$i(i,i0i4i8i<i@i+iMi,i,imi-i#iEi ii~iir&iiiiii|i�iiiii�ieiii	i	i	i	i	i	i	i	 i	$i	(i	,i	0i	4i	@i	Di	Hi%i8idiiiiiiiibiVi7iiiiiiioiGihi
i9iii!i]i]i<iiiiKi?iSi�i�iWii@iTi&i'i.ini/i>i>iLi:i�iziNi|iPiPiaiii�iHici)iiiiFikikikiiii;$i;i;i;i;i;i; i;i;iOiiiii[ili2ii$i
i
i
i
i
i
i
i
 i
$i
(i
,i
0i
4i
8i
<i
@i
Di
Hi
Li
Pi
TiAiiiZi(i_iIiDiJiiQiQiiBi�i"i.i i iCiCi*iRi�i4i�ixiji5cCs�i}|fdd�}|�|d=td�td�t�\}}td|p@d�td|pNd�t�td	�td�|��D]@\}}t|d
�t|�\}}td|p�d�td|p�d�t�qpt�td
�td�t�|��D]B\}}t|d
�t|�\}}td|p�d�td|�pd�t�q�zttd�Wn$td�td�td�YnhXt�td�td�|��D]F\}}t|d
�t|�\}}td|�p�d�td|�p�d�t��qldS)NcSs0t���D] \}}|dd�dkr
|||<q
dS)Nr$ZLC_)�globals�items)�
categories�k�vrrr�_init_categories�sz'_print_locale.<locals>._init_categoriesrz4Locale defaults as determined by getdefaultlocale():zH------------------------------------------------------------------------z
Language: z(undefined)z
Encoding: zLocale settings on startup:z...z
   Language: z
   Encoding: z,Locale settings after calling resetlocale():r)zNOTE:z9setlocale(LC_ALL, "") does not support the default localez&given in the OS environment variables.z4Locale settings after calling setlocale(LC_ALL, ""):)r{rr�rrrr)r�r�Zlang�enc�namer>rrr�
_print_locale�sV



r��LC_MESSAGES�__main__zLocale aliasing:zNumber formatting:)N)F)FF)FF)FF)TFF)r�)N)T)T)T)T)Jr�r�Zencodings.aliases�rera�builtinsrr��	functools�__all__rr r�r�rrrrr�rrrrDrr	rr�rr
r@rA�wrapsrFrSrT�compiler]rZrrrrw�floatrr
r}r�r�r�rr�r�rrrr��
startswithr�CODESET�	NameError�hasattrr��sortedr�r�r�rt�
setdefaultr�r�r�rL�__name__r{rrrr�<module>
sr�	




%-S"5
$�6}�����
a��V:

csv.cpython-38.opt-2.pyc000064400000023221150335716500010734 0ustar00U

e5d?�@s<ddlZddlmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZddlmZddlmZddddd	d
ddd
ddddddddddddgZGdd
�d
�ZGdd�de�Zede�Gdd
�d
e�Zede�Gdd�de�Zede�Gd d�d�ZGd!d�d�ZzeWnek
�r(eZYnXGd"d�d�ZdS)#�N)�Error�__version__�writer�reader�register_dialect�unregister_dialect�get_dialect�
list_dialects�field_size_limit�
QUOTE_MINIMAL�	QUOTE_ALL�QUOTE_NONNUMERIC�
QUOTE_NONE�__doc__)�Dialect)�StringIOrrr
rrrr�excel�	excel_tabr
rrrrr	�Snifferrr�
DictReader�
DictWriter�unix_dialectc@s@eZdZdZdZdZdZdZdZdZ	dZ
dZdd�Zdd�Z
dS)r�FNcCs|jtkrd|_|��dS)NT)�	__class__r�_valid�	_validate��self�r�/usr/lib64/python3.8/csv.py�__init__*s
zDialect.__init__c
Cs@zt|�Wn.tk
r:}ztt|���W5d}~XYnXdS�N)�_Dialect�	TypeErrorr�str)r�errrr/szDialect._validate)�__name__�
__module__�__qualname__�_namer�	delimiter�	quotecharZ
escapechar�doublequote�skipinitialspace�lineterminator�quotingr rrrrrrsc@s$eZdZdZdZdZdZdZeZ	dS)r�,�"TF�
N)
r&r'r(r*r+r,r-r.rr/rrrrr6sc@seZdZdZdS)r�	N)r&r'r(r*rrrrr@sz	excel-tabc@s$eZdZdZdZdZdZdZeZ	dS)rr0r1TF�
N)
r&r'r(r*r+r,r-r.rr/rrrrrEsZunixc@s@eZdZddd�Zdd�Zedd��Zejd	d��Zd
d�ZdS)
rNrcOs6||_||_||_t||f|�|�|_||_d|_dS�Nr)�_fieldnames�restkey�restvalr�dialect�line_num)r�f�
fieldnamesr7r8r9�args�kwdsrrrr QszDictReader.__init__cCs|Sr!rrrrr�__iter__ZszDictReader.__iter__cCs@|jdkr0zt|j�|_Wntk
r.YnX|jj|_|jSr!)r6�nextr�
StopIterationr:rrrrr<]s

zDictReader.fieldnamescCs
||_dSr!)r6)r�valuerrrr<gscCs�|jdkr|jt|j�}|jj|_|gkr8t|j�}q$tt|j|��}t|j�}t|�}||krv||d�||j<n&||kr�|j|d�D]}|j||<q�|Sr5)	r:r<r@r�dict�zip�lenr7r8)r�row�dZlfZlr�keyrrr�__next__ks



zDictReader.__next__)NNNr)	r&r'r(r r?�propertyr<�setterrIrrrrrPs�
	
	
c@s6eZdZddd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)rr�raisercOsB||_||_|��dkr$td|��||_t||f|�|�|_dS)N)rL�ignorez-extrasaction (%s) must be 'raise' or 'ignore')r<r8�lower�
ValueError�extrasactionr)rr;r<r8rPr9r=r>rrrr �s�zDictWriter.__init__cCstt|j|j��}|�|�Sr!)rCrDr<�writerow)r�headerrrr�writeheader�szDictWriter.writeheadercsN�jdkr8����j}|r8tdd�dd�|D������fdd��jD�S)NrLz(dict contains fields not in fieldnames: z, cSsg|]}t|��qSr)�repr)�.0�xrrr�
<listcomp>�sz,DictWriter._dict_to_list.<locals>.<listcomp>c3s|]}��|�j�VqdSr!)�getr8)rUrH��rowdictrrr�	<genexpr>�sz+DictWriter._dict_to_list.<locals>.<genexpr>)rP�keysr<rO�join)rrZZwrong_fieldsrrYr�
_dict_to_list�s
�zDictWriter._dict_to_listcCs|j�|�|��Sr!)rrQr^)rrZrrrrQ�szDictWriter.writerowcCs|j�t|j|��Sr!)r�	writerows�mapr^)rZrowdictsrrrr_�szDictWriter.writerowsN)rrLr)r&r'r(r rSr^rQr_rrrrr�s�

c@s6eZdZdd�Zddd�Zdd�Zdd	�Zd
d�ZdS)
rcCsdddddg|_dS)Nr0r3�;� �:)�	preferredrrrrr �szSniffer.__init__NcCsd|�||�\}}}}|s(|�||�\}}|s4td��Gdd�dt�}||_||_|pVd|_||_|S)NzCould not determine delimiterc@seZdZdZdZeZdS)zSniffer.sniff.<locals>.dialectZsniffedr2N)r&r'r(r)r.rr/rrrrr9�sr9r1)�_guess_quote_and_delimiter�_guess_delimiterrrr,r*r+r-)r�sample�
delimitersr+r,r*r-r9rrr�sniff�s
�
�
z
Sniffer.sniffc	Cs�g}dD]*}t�|tjtjB�}|�|�}|rq4q|s<dSi}i}d}|j}	|D]�}
|	dd}|
|}|r�|�|d�d||<z|	dd}|
|}Wntk
r�YqRYnX|r�|dks�||kr�|�|d�d||<z|	dd}Wntk
�rYqRYnX|
|rR|d7}qRt||jd�}
|�rXt||jd�}|||k}|d	k�r`d
}nd
}d}t�dt�	|�|
d�tj�}|�
|��r�d
}nd}|
|||fS)N)zI(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)zG(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)zG(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\n)z-(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?:$|\n))rFNrr�quote��delimZspace�rHr4rz]((%(delim)s)|^)\W*%(quote)s[^%(delim)s\n]*%(quote)s[^%(delim)s\n]*%(quote)s\W*((%(delim)s)|$))rlrjTF)�re�compile�DOTALL�	MULTILINE�findall�
groupindexrX�KeyError�max�escape�search)r�datarhZmatchesZrestrZregexpZquotes�delimsZspacesrs�m�nrHr+rlr-Z	dq_regexpr,rrrre�s`




��z"Sniffer._guess_quote_and_delimitercCsttd|�d���}dd�td�D�}tdt|��}d}i}i}i}d|}	}
|	t|�k�rR|d7}||	|
�D]@}|D]6}|�|i�}
|�|�}|
�|d�d|
|<|
||<qxqp|��D]�}t||�	��}t|�dkr�|dddkr�q�t|�dk�rLt
|dd	�d
�||<|�||�||d||dtdd�|D��f||<q�|d||<q�|�	�}t
t||t|���}d
}d}t|�dk�r�||k�r�|D]T\}}|ddk�r�|ddk�r�|d||k�r�|dk�s�||k�r�|||<�q�|d8}�q�t|�dk�rDt|���d}|d�|�|d�d|�k}||fS|
}	|
|7}
qN|�s\dSt|�dk�r�|jD]@}||��k�rp|d�|�|d�d|�k}||fS�qpdd�|�	�D�}|��|dd}|d�|�|d�d|�k}||fS)Nr4cSsg|]}t|��qSr)�chr)rU�crrrrW-sz,Sniffer._guess_delimiter.<locals>.<listcomp>��
rrkcSs|dS)Nrkr)rVrrr�<lambda>G�z*Sniffer._guess_delimiter.<locals>.<lambda>rmcss|]}|dVqdS)rkNr)rU�itemrrrr[Lsz+Sniffer._guess_delimiter.<locals>.<genexpr>g�?g�������?g{�G�z�?z%c )rrcSsg|]\}}||f�qSrr)rU�k�vrrrrWvs���)�list�filter�split�range�minrErX�countr\�itemsru�remove�sum�floatrd�sort)rrxrh�asciiZchunkLengthZ	iterationZ
charFrequencyZmodesry�start�end�line�charZ
metaFrequencyZfreqr�ZmodeListZtotalZconsistencyZ	thresholdr�r�rlr-rGrrrrfs�

����

��zSniffer._guess_delimiterc
Cs�tt|�|�|��}t|�}t|�}i}t|�D]}d||<q0d}|D]�}|dkrVq�|d7}t|�|krlqFt|���D]x}	tt	t
fD]4}
z|
||	�Wq�Wq�ttfk
r�Yq�Xq�t||	�}
|
||	krx||	dkr�|
||	<qx||	=qxqFd}|�
�D]~\}	}t|�td�k�r@t||	�|k�r6|d7}n|d8}n<z|||	�Wn"ttfk
�rr|d7}Yn
X|d8}�q|dkS)Nr�rk)rrrir@rEr�r�r\�intr��complexrO�
OverflowErrorr��typer#)
rrgZrdrrR�columnsZcolumnTypes�i�checkedrF�colZthisTypeZ	hasHeaderZcolTyperrr�
has_headersJ






zSniffer.has_header)N)r&r'r(r rirerfr�rrrrr�s

Lg)rnZ_csvrrrrrrrr	r
rrr
rrrr"�ior�__all__rrrrrr��	NameErrorr�rrrrr�<module>sH@�


2
dummy_threading.cpython-38.pyc000064400000002130150335716500012355 0ustar00U

e5d�
�	@sdZddlmZddlZdZdZdZz�dekr:edZ
dZed	ed<dekr`edZdZed=dekrzedZ	dZed=ddlZeded
<ed=eded<ed=ddlTdd
lm
Z
W5er�eed<[[er�e	ed<[	[er�e
ed<[
ned=[[[XdS)aaFaux ``threading`` version using ``dummy_thread`` instead of ``thread``.

The module ``_dummy_threading`` is added to ``sys.modules`` in order
to not have ``threading`` considered imported.  Had ``threading`` been
directly imported it would have made all subsequent imports succeed
regardless of whether ``_thread`` was available which is not desired.

�)�modulesNF�	threadingZ_threading_local�_threadT�
_dummy_thread�_dummy_threadingZ_dummy__threading_local)�*)�__all__)�__doc__�sysrZsys_modulesrZholding_threadZholding_threadingZholding__threading_localZheld_threadingZheld__threading_localZheld_threadrrr�rr�'/usr/lib64/python3.8/dummy_threading.py�<module>sP_dummy_thread.cpython-38.opt-2.pyc000064400000006502150335716500012765 0ustar00U

e5d��@s�ddddddddgZdZeZifd	d�Zd
d�Zdd�Zdd�Zddd�Zdd�Z	Gdd�de
�ZGdd�de�Zda
dadd�Zd
S)�error�start_new_thread�exit�	get_ident�
allocate_lock�interrupt_main�LockType�RLocklcCs�t|�tt��krtd��t|�tt��kr4td��daz|||�Wn.tk
rZYnddl}|��YnXdatr�dat	�dS)Nz2nd arg must be a tuplez3rd arg must be a dictF�T)
�type�tuple�	TypeError�dict�_main�
SystemExit�	traceback�	print_exc�
_interrupt�KeyboardInterrupt)Zfunction�args�kwargsr�r�%/usr/lib64/python3.8/_dummy_thread.pyrs 
cCst�dS�N)rrrrrr=scCsdS�N�rrrrrrAscCst�Sr�rrrrrrJsNcCs|dk	rtd��dS)Nz'setting thread stack size not supportedr	)r)�sizerrr�
stack_sizeNsrcCst�Srrrrrr�
_set_sentinelTsrc@sBeZdZdd�Zddd�ZeZdd�Zd	d
�Zdd�Zd
d�Z	dS)rcCs
d|_dS)NF��
locked_status��selfrrr�__init__cszLockType.__init__N���cCsH|dks|rd|_dS|js&d|_dS|dkr@ddl}|�|�dSdS)NTr	F)r �time�sleep)r"�waitflag�timeoutr%rrr�acquirefs
zLockType.acquirecCs|��dSr)�release)r"�typ�val�tbrrr�__exit__�szLockType.__exit__cCs|js
t�d|_dS)NFT)r rr!rrrr*�szLockType.releasecCs|jSrrr!rrr�locked�szLockType.lockedcCs*d|jrdnd|jj|jjtt|��fS)Nz<%s %s.%s object at %s>r/Zunlocked)r �	__class__�
__module__�__qualname__�hex�idr!rrr�__repr__�s
�zLockType.__repr__)Nr$)
�__name__r1r2r#r)�	__enter__r.r*r/r5rrrrrXs
	cs6eZdZ�fdd�Zd	�fdd�	Z�fdd�Z�ZS)
rcst���d|_dS)Nr	)�superr#�_levelsr!�r0rrr#�s
zRLock.__init__Nr$cs$t��||�}|r |jd7_|Sr)r8r)r9)r"r'r(r/r:rrr)�sz
RLock.acquirecs4|jdkrt�|jdkr"t���|jd8_dS)Nr	r)r9rr8r*r!r:rrr*�s



z
RLock.release)Nr$)r6r1r2r#r)r*�
__classcell__rrr:rr�sFTcCstr
t�ndadS)NT)rrrrrrrr�s)N)�__all__�TIMEOUT_MAX�RuntimeErrorrrrrrrr�objectrrrrrrrrr�<module>s"
� 	
@antigravity.cpython-38.opt-2.pyc000064400000001217150335716500012503 0ustar00U

e5d��@s&ddlZddlZe�d�dd�ZdS)�Nzhttps://xkcd.com/353/cCs\t�|���}dd�|dd�|dd�fD�\}}td||dd�||dd�f�dS)NcSsg|]}dt�d|��qS)z%fz0.)�float�fromhex)�.0�x�r�#/usr/lib64/python3.8/antigravity.py�
<listcomp>szgeohash.<locals>.<listcomp>�� z	%d%s %d%s�)�hashlibZmd5Z	hexdigest�print)ZlatitudeZ	longitudeZdatedow�h�p�qrrr�geohashs&r)Z
webbrowserr�openrrrrr�<module>s
opcode.cpython-38.pyc000064400000012456150335716500010462 0ustar00U

e5d��
@s�dZddddddddd	d
ddd
g
ZzddlmZe�d�Wnek
rPYnXdZgZgZgZ	gZ
gZgZgZ
gZiZdd�ed�D�Zdd�Zdd�Zdd�Zdd�Zedd�edd �ed!d"�ed#d$�ed%d&�ed'd(�ed)d*�ed+d,�ed-d.�ed/d0�ed1d2�ed3d4�ed5d6�ed7d8�ed9d:�ed;d<�ed=d>�ed?d@�edAdB�edCdD�edEdF�edGdH�edIdJ�edKdL�edMdN�edOdP�edQdR�edSdT�edUdV�edWdX�edYdZ�ed[d\�ed]d^�ed_d`�edadb�edcdd�ededf�edgdh�edidj�edkdl�edmdn�edodp�edqdr�edsdt�edudv�edwdx�edydz�ed{d|�ed}d~�edd��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��d�Zed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��e�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��e�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�dƒed�dăed�dƃed�dȃed�dʃed�d̃e�d̡ed�d΃e�dΡed�dЃe�dСed�d҃ed�dԃed�dփed�d؃ed�dڃe
�dڡed�d܃e
�dܡed�dރe
�dޡed�d�e
�d�ed�d�ed�d�ed�d�ed�d�ed�d�ed�d�ed�d�e
�d�edd�d�Zed�d�ed�d�ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��e�d�d�e�d�d�e�d�d�e�d�d�e�d�d	�e�d
�d�[[[[�dS(
zy
opcode module - potentially shared between dis and other modules which
operate on bytecodes (e.g. peephole optimizers).
�cmp_op�hasconst�hasname�hasjrel�hasjabs�haslocal�
hascompare�hasfree�opname�opmap�
HAVE_ARGUMENT�EXTENDED_ARG�hasnargs�)�stack_effectr)�<z<=z==z!=�>z>=�inznot in�iszis notzexception matchZBADcCsg|]}d|f�qS)z<%r>�)�.0�oprr�/usr/lib64/python3.8/opcode.py�
<listcomp>%sr�cCs|t|<|t|<dS�N)r	r
��namerrrr�def_op'srcCst||�t�|�dSr)rr�appendrrrr�name_op+s
rcCst||�t�|�dSr)rrrrrrr�jrel_op/s
r cCst||�t�|�dSr)rrrrrrr�jabs_op3s
r!ZPOP_TOP�ZROT_TWO�Z	ROT_THREE�ZDUP_TOP�ZDUP_TOP_TWO�ZROT_FOUR�ZNOP�	ZUNARY_POSITIVE�
ZUNARY_NEGATIVE�Z	UNARY_NOT�ZUNARY_INVERT�ZBINARY_MATRIX_MULTIPLY�ZINPLACE_MATRIX_MULTIPLY�ZBINARY_POWER�ZBINARY_MULTIPLY�Z
BINARY_MODULO�Z
BINARY_ADD�ZBINARY_SUBTRACT�Z
BINARY_SUBSCR�ZBINARY_FLOOR_DIVIDE�ZBINARY_TRUE_DIVIDE�ZINPLACE_FLOOR_DIVIDE�ZINPLACE_TRUE_DIVIDE�Z	GET_AITER�2Z	GET_ANEXT�3ZBEFORE_ASYNC_WITH�4Z
BEGIN_FINALLY�5Z
END_ASYNC_FOR�6ZINPLACE_ADD�7ZINPLACE_SUBTRACT�8ZINPLACE_MULTIPLY�9ZINPLACE_MODULO�;ZSTORE_SUBSCR�<Z
DELETE_SUBSCR�=Z
BINARY_LSHIFT�>Z
BINARY_RSHIFT�?Z
BINARY_AND�@Z
BINARY_XOR�AZ	BINARY_OR�BZ
INPLACE_POWER�CZGET_ITER�DZGET_YIELD_FROM_ITER�EZ
PRINT_EXPR�FZLOAD_BUILD_CLASS�GZ
YIELD_FROM�HZ
GET_AWAITABLE�IZINPLACE_LSHIFT�KZINPLACE_RSHIFT�LZINPLACE_AND�MZINPLACE_XOR�NZ
INPLACE_OR�OZWITH_CLEANUP_START�QZWITH_CLEANUP_FINISH�RZRETURN_VALUE�SZIMPORT_STAR�TZSETUP_ANNOTATIONS�UZYIELD_VALUE�VZ	POP_BLOCK�WZEND_FINALLY�XZ
POP_EXCEPT�Y�ZZ
STORE_NAMEZDELETE_NAME�[ZUNPACK_SEQUENCE�\ZFOR_ITER�]Z	UNPACK_EX�^Z
STORE_ATTR�_ZDELETE_ATTR�`ZSTORE_GLOBAL�aZ
DELETE_GLOBAL�bZ
LOAD_CONST�dZ	LOAD_NAME�eZBUILD_TUPLE�fZ
BUILD_LIST�gZ	BUILD_SET�hZ	BUILD_MAP�iZ	LOAD_ATTR�jZ
COMPARE_OP�kZIMPORT_NAME�lZIMPORT_FROM�mZJUMP_FORWARD�nZJUMP_IF_FALSE_OR_POP�oZJUMP_IF_TRUE_OR_POP�pZ
JUMP_ABSOLUTE�qZPOP_JUMP_IF_FALSE�rZPOP_JUMP_IF_TRUE�sZLOAD_GLOBAL�tZ
SETUP_FINALLY�zZ	LOAD_FAST�|Z
STORE_FAST�}ZDELETE_FAST�~Z
RAISE_VARARGS�Z
CALL_FUNCTION�Z
MAKE_FUNCTION�ZBUILD_SLICE�ZLOAD_CLOSURE�Z
LOAD_DEREF�ZSTORE_DEREF�ZDELETE_DEREF�ZCALL_FUNCTION_KW�ZCALL_FUNCTION_EX�Z
SETUP_WITH�ZLIST_APPEND�ZSET_ADD�ZMAP_ADD�ZLOAD_CLASSDEREF��ZBUILD_LIST_UNPACK�ZBUILD_MAP_UNPACK�ZBUILD_MAP_UNPACK_WITH_CALL�ZBUILD_TUPLE_UNPACK�ZBUILD_SET_UNPACK�ZSETUP_ASYNC_WITH�ZFORMAT_VALUE�ZBUILD_CONST_KEY_MAP�ZBUILD_STRING�ZBUILD_TUPLE_UNPACK_WITH_CALL�ZLOAD_METHOD�ZCALL_METHOD�ZCALL_FINALLY�ZPOP_FINALLY�N)�__doc__�__all__Z_opcoderr�ImportErrorrrrrrrrrr
r
�ranger	rrr r!rrrrrr�<module>sF
�



























































































































cmd.cpython-38.opt-1.pyc000064400000030524150335716500010707 0ustar00U

e5d:�@s@dZddlZddlZdgZdZejejdZGdd�d�ZdS)a	A generic class to build line-oriented command interpreters.

Interpreters constructed with this class obey the following conventions:

1. End of file on input is processed as the command 'EOF'.
2. A command is parsed out of each line by collecting the prefix composed
   of characters in the identchars member.
3. A command `foo' is dispatched to a method 'do_foo()'; the do_ method
   is passed a single argument consisting of the remainder of the line.
4. Typing an empty line repeats the last command.  (Actually, it calls the
   method `emptyline', which may be overridden in a subclass.)
5. There is a predefined `help' method.  Given an argument `topic', it
   calls the command `help_topic'.  With no arguments, it lists all topics
   with defined help_ functions, broken into up to three topics; documented
   commands, miscellaneous help topics, and undocumented commands.
6. The command '?' is a synonym for `help'.  The command '!' is a synonym
   for `shell', if a do_shell method exists.
7. If completion is enabled, completing commands will be done automatically,
   and completing of commands args is done by calling complete_foo() with
   arguments text, line, begidx, endidx.  text is string we are matching
   against, all returned matches must begin with it.  line is the current
   input line (lstripped), begidx and endidx are the beginning and end
   indexes of the text being matched, which could be used to provide
   different completion depending upon which position the argument is in.

The `default' method may be overridden to intercept commands for which there
is no do_ method.

The `completedefault' method may be overridden to intercept completions for
commands that have no complete_ method.

The data member `self.ruler' sets the character used to draw separator lines
in the help messages.  If empty, no ruler line is drawn.  It defaults to "=".

If the value of `self.intro' is nonempty when the cmdloop method is called,
it is printed out on interpreter startup.  This value may be overridden
via an optional argument to the cmdloop() method.

The data members `self.doc_header', `self.misc_header', and
`self.undoc_header' set the headers used for the help function's
listings of documented functions, miscellaneous topics, and undocumented
functions respectively.
�N�Cmdz(Cmd) �_c@s�eZdZdZeZeZdZdZ	dZ
dZdZdZ
dZdZd	Zd0dd�Zd1d
d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Z d+d,�Z!d2d.d/�Z"dS)3raA simple framework for writing line-oriented command interpreters.

    These are often useful for test harnesses, administrative tools, and
    prototypes that will later be wrapped in a more sophisticated interface.

    A Cmd instance or subclass instance is a line-oriented interpreter
    framework.  There is no good reason to instantiate Cmd itself; rather,
    it's useful as a superclass of an interpreter class you define yourself
    in order to inherit Cmd's methods and encapsulate action methods.

    �=�Nz(Documented commands (type help <topic>):zMiscellaneous help topics:zUndocumented commands:z*** No help on %s��tabcCs@|dk	r||_ntj|_|dk	r(||_ntj|_g|_||_dS)a�Instantiate a line-oriented interpreter framework.

        The optional argument 'completekey' is the readline name of a
        completion key; it defaults to the Tab key. If completekey is
        not None and the readline module is available, command completion
        is done automatically. The optional arguments stdin and stdout
        specify alternate input and output file objects; if not specified,
        sys.stdin and sys.stdout are used.

        N)�stdin�sys�stdout�cmdqueue�completekey)�selfrrr
�r�/usr/lib64/python3.8/cmd.py�__init__LszCmd.__init__cCs�|��|jr\|jr\z2ddl}|��|_|�|j�|�|jd�Wnt	k
rZYnXz�|dk	rl||_
|j
r�|j�t
|j
�d�d}|�s4|jr�|j�d�}nl|jr�zt|j�}Wntk
r�d}YnXn<|j�|j�|j��|j��}t|��sd}n
|�d�}|�|�}|�|�}|�||�}q�|��W5|j�r�|j�r�zddl}|�|j�Wnt	k
�r~YnXXdS)z�Repeatedly issue a prompt, accept input, parse an initial prefix
        off the received input, and dispatch to action methods, passing them
        the remainder of the line as argument.

        rNz
: complete�
�EOFz
)�preloop�use_rawinputr�readlineZ
get_completerZ
old_completerZ
set_completer�complete�parse_and_bind�ImportError�intror
�write�strr�pop�input�prompt�EOFError�flushr�len�rstrip�precmd�onecmd�postcmd�postloop)r
rr�stop�linerrr�cmdloopbsN






zCmd.cmdloopcCs|S)z�Hook method executed just before the command line is
        interpreted, but after the input prompt is generated and issued.

        r�r
r(rrrr#�sz
Cmd.precmdcCs|S)z?Hook method executed just after a command dispatch is finished.r)r
r'r(rrrr%�szCmd.postcmdcCsdS)z>Hook method executed once when the cmdloop() method is called.Nr�r
rrrr�szCmd.preloopcCsdS)zYHook method executed once when the cmdloop() method is about to
        return.

        Nrr+rrrr&�szCmd.postloopcCs�|��}|sdd|fS|ddkr4d|dd�}n2|ddkrft|d�r\d|dd�}n
dd|fSdt|�}}||kr�|||jkr�|d}qt|d|�||d���}}|||fS)	z�Parse the line into a command name and a string containing
        the arguments.  Returns a tuple containing (command, args, line).
        'command' and 'args' may be None if the line couldn't be parsed.
        Nr�?zhelp r�!Zdo_shellzshell )�strip�hasattrr!�
identchars)r
r(�i�n�cmd�argrrr�	parseline�s



z
Cmd.parselinecCs�|�|�\}}}|s|��S|dkr.|�|�S||_|dkrBd|_|dkrT|�|�Szt|d|�}Wntk
r�|�|�YSX||�SdS)ahInterpret the argument as though it had been typed in response
        to the prompt.

        This may be overridden, but should not normally need to be;
        see the precmd() and postcmd() methods for useful execution hooks.
        The return value is a flag indicating whether interpretation of
        commands by the interpreter should stop.

        Nrr�do_)r5�	emptyline�default�lastcmd�getattr�AttributeError)r
r(r3r4�funcrrrr$�s


z
Cmd.onecmdcCs|jr|�|j�SdS)z�Called when an empty line is entered in response to the prompt.

        If this method is not overridden, it repeats the last nonempty
        command entered.

        N)r9r$r+rrrr7�sz
Cmd.emptylinecCs|j�d|�dS)z�Called on an input line when the command prefix is not recognized.

        If this method is not overridden, it prints an error message and
        returns.

        z*** Unknown syntax: %s
N)r
rr*rrrr8�szCmd.defaultcGsgS)z�Method called to complete an input line when no command-specific
        complete_*() method is available.

        By default, it returns an empty list.

        r)r
�ignoredrrr�completedefault�szCmd.completedefaultcsd|��fdd�|��D�S)Nr6cs"g|]}|���r|dd��qS)�N��
startswith��.0�a�Zdotextrr�
<listcomp>�s
z%Cmd.completenames.<locals>.<listcomp>)�	get_names)r
�textr=rrEr�
completenames�szCmd.completenamesc
Cs�|dkr�ddl}|��}|��}t|�t|�}|��|}|��|}|dkr�|�|�\}	}
}|	dkrp|j}q�zt|d|	�}Wq�t	k
r�|j}Yq�Xn|j
}|||||�|_z|j|WStk
r�YdSXdS)z�Return the next possible completion for 'text'.

        If a command has not been entered, then complete against command list.
        Otherwise try to call complete_<command> to get list of completions.
        rNrZ	complete_)
rZget_line_buffer�lstripr!Z
get_begidxZ
get_endidxr5r>r:r;rIZcompletion_matches�
IndexError)
r
rH�staterZorigliner(�strippedZbegidxZendidxr3�argsZfooZcompfuncrrrr�s*zCmd.completecCs
t|j�S)N)�dir�	__class__r+rrrrGsz
Cmd.get_namescs4t|j���}t�fdd�|��D��}t||B�S)Nc3s,|]$}|�d�d�r|dd�VqdS)�help_r�Nr@rB�rNrr�	<genexpr> s�z$Cmd.complete_help.<locals>.<genexpr>)�setrIrG�list)r
rNZcommandsZtopicsrrSr�
complete_helpszCmd.complete_helpcCs�|r�zt|d|�}Wn|tk
r�z4t|d|�j}|rX|j�dt|��WYdSWntk
rnYnX|j�dt|j|f��YdSX|��n|��}g}g}i}|D]$}|dd�dkr�d||dd�<q�|��d}	|D]p}|dd�dkr�||	k�rq�|}	|dd�}
|
|k�r8|�	|
�||
=q�t||�j�rR|�	|
�q�|�	|
�q�|j�dt|j
��|�|j|d	d
�|�|j
t|���d	d
�|�|j|d	d
�dS)zEList available commands with "help" or detailed help with "help cmd".rQr6�%s
NrRrrr?��P)r:r;�__doc__r
rr�nohelprG�sort�append�
doc_leader�print_topics�
doc_header�misc_headerrV�keys�undoc_header)r
r4r<�doc�namesZcmds_docZ
cmds_undoc�help�nameZprevnamer3rrr�do_help$sN



zCmd.do_helpcCs\|rX|j�dt|��|jr<|j�dt|jt|���|�||d�|j�d�dS)NrXrr)r
rr�rulerr!�	columnize)r
�headerZcmdsZcmdlenZmaxcolrrrr`RszCmd.print_topicsrZcs��s|j�d�dS�fdd�tt���D�}|rJtdd�tt|����t��}|dkrv|j�dt�d	��dStdt���D]�}||d|}g}d
}t|�D]h}	d	}
t|�D]2}|||	}||kr�q�|}
t|
t|
��}
q�|�	|
�||
d7}||kr��qq�||kr��q4q�t��}d}d	g}t|�D]�}g}t|�D]4}	|||	}||k�rld}
n�|}
|�	|
��qL|�r�|d
�s�|d
=�q�tt|��D]}	||	�
||	�||	<�q�|j�dtd�|����q<dS)z�Display a list of strings as a compact set of columns.

        Each column is only as wide as necessary.
        Columns are separated by two spaces (one was not legible enough).
        z<empty>
Ncsg|]}t�|t�s|�qSr)�
isinstancer)rCr1�rVrrrFds�z!Cmd.columnize.<locals>.<listcomp>z list[i] not a string for i in %sz, rrXr����r���z  )r
r�ranger!�	TypeError�join�mapr�maxr^�ljust)r
rVZdisplaywidthZ
nonstrings�sizeZnrowsZncolsZ	colwidthsZtotwidth�colZcolwidth�rowr1�xZtextsrrnrrkZs\�


z
Cmd.columnize)rNN)N)rZ)#�__name__�
__module__�__qualname__r[�PROMPTr�
IDENTCHARSr0rjr9rr_rarbrdr\rrr)r#r%rr&r5r$r7r8r>rIrrGrWrir`rkrrrrr4s<

4
		.)	r[�stringr	�__all__rZ
ascii_lettersZdigitsr�rrrrr�<module>s
,_strptime.cpython-38.pyc000064400000037256150335716500011224 0ustar00U

e5d�b�@s�dZddlZddlZddlZddlmZddlmZddlmZ	ddl
mZm
ZmZddlmZgZdd	�ZGd
d�de�ZGdd
�d
e�Ze�Ze�adZiadd�Zdd�Zddd�Z ddd�Z!ddd�Z"dS)a�Strptime-related classes and functions.

CLASSES:
    LocaleTime -- Discovers and stores locale-specific time information
    TimeRE -- Creates regexes for pattern matching a string of text containing
                time information

FUNCTIONS:
    _getlang -- Figure out what language is being used for the locale
    strptime -- Calculates the time struct represented by the passed-in string

�N)�compile)�
IGNORECASE)�escape)�date�	timedelta�timezone)�
allocate_lockcCst�tj�S�N)�localeZ	getlocale�LC_TIME�rr�!/usr/lib64/python3.8/_strptime.py�_getlangsrc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�
LocaleTimeakStores and handles locale-specific information related to time.

    ATTRIBUTES:
        f_weekday -- full weekday names (7-item list)
        a_weekday -- abbreviated weekday names (7-item list)
        f_month -- full month names (13-item list; dummy value in [0], which
                    is added by code)
        a_month -- abbreviated month names (13-item list, dummy value in
                    [0], which is added by code)
        am_pm -- AM/PM representation (2-item list)
        LC_date_time -- format string for date/time representation (string)
        LC_date -- format string for date representation (string)
        LC_time -- format string for time representation (string)
        timezone -- daylight- and non-daylight-savings timezone representation
                    (2-item list of sets)
        lang -- Language used by instance (2-item tuple)
    cCsht�|_|��|��|��|��|��t�|jkrDtd��tj	|j	ks\tj
|j
krdtd��dS)a�Set all attributes.

        Order of methods called matters for dependency reasons.

        The locale language is set at the offset and then checked again before
        exiting.  This is to make sure that the attributes were not set with a
        mix of information from more than one locale.  This would most likely
        happen when using threads where one thread calls a locale-dependent
        function while another thread changes the locale while the function in
        the other thread is still running.  Proper coding would call for
        locks to prevent changing the locale while locale-dependent code is
        running.  The check here is done in case someone does not think about
        doing this.

        Only other possible issue is if someone changed the timezone and did
        not call tz.tzset .  That is an issue for the programmer, though,
        since changing the timezone is worthless without that call.

        z$locale changed during initializationz&timezone changed during initializationN)r�lang�_LocaleTime__calc_weekday�_LocaleTime__calc_month�_LocaleTime__calc_am_pm�_LocaleTime__calc_timezone�_LocaleTime__calc_date_time�
ValueError�time�tzname�daylight)�selfrrr
�__init__1szLocaleTime.__init__cCs4dd�td�D�}dd�td�D�}||_||_dS)NcSsg|]}tj|���qSr)�calendarZday_abbr�lower��.0�irrr
�
<listcomp>Ssz-LocaleTime.__calc_weekday.<locals>.<listcomp>�cSsg|]}tj|���qSr)rZday_namerrrrr
r!Ts)�range�	a_weekday�	f_weekday)rr$r%rrr
Z__calc_weekdayPszLocaleTime.__calc_weekdaycCs4dd�td�D�}dd�td�D�}||_||_dS)NcSsg|]}tj|���qSr)rZ
month_abbrrrrrr
r!Zsz+LocaleTime.__calc_month.<locals>.<listcomp>�
cSsg|]}tj|���qSr)rZ
month_namerrrrr
r![s)r#�a_month�f_month)rr'r(rrr
Z__calc_monthXszLocaleTime.__calc_monthcCsJg}dD]6}t�ddd|ddddd	f	�}|�t�d
|����q||_dS)N)�������,�7��Lr�%p)r�struct_time�append�strftimer�am_pm)rr6�hour�
time_tuplerrr
Z__calc_am_pm_s
zLocaleTime.__calc_am_pmc
CsJt�d�}dddg}t�d|���|d<t�d|���|d<t�d|���|d<d|jdd	f|jd
df|jddf|jd
d
f|jddfdddddddddddg}|�	dd�|j
D��dD]d\}}||}|D]\}}|r�|�||�}q�t�d�}dt�||�k�rd}	nd }	|�d!|	�||<q�|d|_|d|_
|d|_dS)"N)	r+r,r-r*r.r/r0r1r�%cr�%xr)�%Xr0)�%z%%z%Ar,z%Bz%az%br2)Z1999z%Y)Z99z%y)Z22z%H)Z44z%M)Z55z%S)Z76z%j)Z17z%d)Z03�%m)�3r=)�2z%w)Z10z%IcSsg|]}|D]}|df�qqS)z%Zr)r�	tz_values�tzrrr
r!�s�z/LocaleTime.__calc_date_time.<locals>.<listcomp>))rr9)r)r:)r0r;)	r+r)r,r)r)r)�r,rZ00z%Wz%UZ11)rr3r5rr%r(r$r'r6�extendr�replace�LC_date_time�LC_date�LC_time)
rr8Z	date_timeZreplacement_pairs�offset�	directiveZcurrent_format�old�newZU_Wrrr
Z__calc_date_timeksH

�


zLocaleTime.__calc_date_timecCszzt��Wntk
r YnXtj|_tj|_tdd|jd��h�}|jrft|jd��h�}nt�}||f|_dS)N�utc�gmtrr))r�tzset�AttributeErrorrr�	frozensetrr)rZ	no_savingZ
has_savingrrr
Z__calc_timezone�szLocaleTime.__calc_timezoneN)
�__name__�
__module__�__qualname__�__doc__rrrrrrrrrr
rs-rcs:eZdZdZd�fdd�	Zdd�Zdd�Zd	d
�Z�ZS)�TimeREz4Handle conversion from format directives to regexes.Ncs|r||_nt�|_t�}|�ddddddddd	d
ddd
ddd|�|jjd�|�|jjd�|�|jjdd�d�|�|jjdd�d�|�|jj	d�|�dd�|jj
D�d�dd��|�d|�d��
dd��|�d|�|jj��|�d |�|jj��|�d!|�|jj��dS)"z^Create keys/values.

        Order of execution is important for dependency reasons.

        z)(?P<d>3[0-1]|[1-2]\d|0[1-9]|[1-9]| [1-9])z(?P<f>[0-9]{1,6})z(?P<H>2[0-3]|[0-1]\d|\d)z(?P<I>1[0-2]|0[1-9]|[1-9])z(?P<G>\d\d\d\d)zG(?P<j>36[0-6]|3[0-5]\d|[1-2]\d\d|0[1-9]\d|00[1-9]|[1-9]\d|0[1-9]|[1-9])z(?P<m>1[0-2]|0[1-9]|[1-9])z(?P<M>[0-5]\d|\d)z(?P<S>6[0-1]|[0-5]\d|\d)z(?P<U>5[0-3]|[0-4]\d|\d)z(?P<w>[0-6])z(?P<u>[1-7])z(?P<V>5[0-3]|0[1-9]|[1-4]\d|\d)z(?P<y>\d\d)z(?P<Y>\d\d\d\d)z2(?P<z>[+-]\d\d:?[0-5]\d(:?[0-5]\d(\.\d{1,6})?)?|Z)�A�ar)N�B�b�pcss|]}|D]
}|Vq
qdSr	r)rZtz_namesrArrr
�	<genexpr>�s�z"TimeRE.__init__.<locals>.<genexpr>�Zr<)�d�f�H�I�G�j�m�M�S�U�w�u�V�y�Y�zrVrWrXrYrZr\r<�Wrf�c�x�X)�locale_timer�superr�_TimeRE__seqToREr%r$r(r'r6r�__setitem__�__getitem__rD�patternrErFrG)rrq�base��	__class__rr
r�sF��zTimeRE.__init__cCsPt|tdd�}|D]}|dkrq(qdSd�dd�|D��}d||f}d|S)	aeConvert a list to a regex string for matching a directive.

        Want possible matching values to be from longest to shortest.  This
        prevents the possibility of a match occurring for a value that also
        a substring of a larger value that should have matched (e.g., 'abc'
        matching when 'abcdef' should have been the match).

        T)�key�reverse��|css|]}t|�VqdSr	)�	re_escape)rZstuffrrr
r[�sz#TimeRE.__seqToRE.<locals>.<genexpr>z	(?P<%s>%sz%s))�sorted�len�join)rZ
to_convertrI�valueZregexrrr
Z	__seqToRE�s	zTimeRE.__seqToREcCs�d}td�}|�d|�}td�}|�d|�}d|krv|�d�d}d||d	|d�|||f}||dd	�}q,d
||fS)z�Return regex pattern for the format string.

        Need to make sure that any characters that might be interpreted as
        regex syntax are escaped.

        r|z([\\.^$*+?\(\){}\[\]|])z\\\1z\s+z\\s+r<r)z%s%s%sNz%s%s)�
re_compile�sub�index)r�formatZprocessed_formatZregex_charsZwhitespace_replacementZdirective_indexrrr
rv�s
�zTimeRE.patterncCst|�|�t�S)z2Return a compiled re object for the format string.)r�rvr)rr�rrr
rszTimeRE.compile)N)	rQrRrSrTrrsrvr�
__classcell__rrrxr
rU�s
.rU�cCslt|dd���}|s,|dd}|dd}d|d}|dkrLd||S|d|d}d||SdS)z�Calculate the Julian day based on the year, week of the year, and day of
    the week, with week_start_day representing whether the week of the year
    assumes the week starts on Sunday or Monday (6 or 0).r)r"rN)�
datetime_date�weekday)�year�week_of_yearZday_of_week�week_starts_MonZ
first_weekdayZ
week_0_lengthZdays_to_weekrrr
�_calc_julian_from_U_or_Wsr�cCsdt|dd���d}|d||}|dkr\|t|dd���7}|d8}|t|dd���8}||fS)z�Calculate the Julian day based on the ISO 8601 year, week, and weekday.
    ISO weeks start on Mondays, with week 01 being the week containing 4 Jan.
    ISO week days range from 1 (Monday) to 7 (Sunday).
    r)�r,r")r�Z
isoweekday�	toordinal)�iso_year�iso_weekZiso_weekdayZ
correctionZordinalrrr
�_calc_julian_from_V%sr��%a %b %d %H:%M:%S %Yc,Cs.t||g�D]*\}}t|t�sd}t|�|t|����qt��tj}t	�|j
kshtj|jkshtj
|j
kr|t�at��tj}tt�tkr�t��t�|�}|�s&zt�|�}Wnntk
r�}z.|jd}|dkr�d}~td||f�d�W5d}~XYn$tk
�rtd|�d�YnX|t|<W5QRX|�|�}	|	�sPtd||f��t|�|	��k�rztd	||	��d���d}
}d
}}
d}}}}d}d}d}d}}d}d}}|	��}|��D�]d}|dk�rt|d�}|d
k�r�|d7}n|d7}�q�|dk�r t|d�}�q�|dk�r:t|d�}
�q�|dk�rTt|d�}�q�|dk�rv|j�|d� ��}�q�|dk�r�|j!�|d� ��}�q�|dk�r�t|d�}
�q�|dk�r�t|d�}�q�|dk�r<t|d�}|�dd�� �}|d|j"dfk�r|dk�r8d}n"||j"d
k�r.|dk�r.|d7}�q�|dk�rVt|d�}�q�|dk�rpt|d�}�q�|dk�r�|d}|ddt|�7}t|�}�q�|d k�r�|j#�|d � ��}�q�|d!k�r�|j$�|d!� ��}�q�|d"k�rt|d"�}|dk�rd}n|d
8}�q�|d#k�r:t|d#�}|d
8}�q�|d$k�rTt|d$�}�q�|d%k�r�t||�}|d&k�rzd}nd}�q�|d'k�r�t|d'�}�q�|d(k�r�|d(}|d)k�r�d}n�|d*d+k�r.|dd*�|d,d�}t|�d-k�r.|d-d+k�rd.|d(��}t|��|dd-�|dd�}t|d
d*��}t|d*d-��} t|d-d/��p`d�}!|d0d0| d0|!}|d1d�}"ddt|"�}#t|"|#�}|�%d2��r.|}|}np|d)k�r�|d)� �}$t|j&�D]N\}%}&|$|&k�r�tjdtjd
k�r tj
�r |$d3k�r �q�n
|%}�qʐqސq�|dk�rv|
dk	�rv|dk�sZ|dk�rbtd4��|dk	�r�td5��n0|dk�r�|dk	�r�|dk�r�td6��ntd7��d8}'|dk�r�|d9k�r�|
d:k�r�d;}d<}'n|dk�r�d}|dk�r�|dk	�r�|dk	�r |dk�rd<nd8}(t'||||(�}n(|
dk	�rH|dk	�rHt(|
||d
�\}}|dk	�r�|dk�r�|d
8}t)�*|��rtd=nd>})||)7}|dk�r�t+|||
��,�t+|d
d
��,�d
}n0t+�-|d
t+|d
d
��,��}*|*j.}|*j/}|*j0}
|dk�r�t+|||
��1�}|�d)�}+|'�rd}|||
|||||||+|f||fS)?z�Return a 2-tuple consisting of a time struct and an int containing
    the number of microseconds based on the input string and the
    format string.z*strptime() argument {} must be str, not {}r�\r<z&'%s' is a bad directive in format '%s'Nzstray %% in format '%s'z%time data %r does not match format %rzunconverted data remains: %sr)���rj�Di�ilrkrarcrXrYr]r_r`rZr|�rdrer^�0rBrVrWrgrhrb)rfrmrfrirlr\r,�:r�r�zInconsistent use of : in r"�<��-)rLrMzzISO year directive '%G' must be used with the ISO week directive '%V' and a weekday directive ('%A', '%a', '%w', or '%u').z`Day of the year directive '%j' is not compatible with ISO year directive '%G'. Use '%Y' instead.zzISO week directive '%V' must be used with the ISO year directive '%G' and a weekday directive ('%A', '%a', '%w', or '%u').zdISO week directive '%V' is incompatible with the year directive '%Y'. Use the ISO year '%G' instead.Fr0�ipTinim)2�	enumerate�
isinstance�str�	TypeErrorr��type�_cache_lock�
_TimeRE_cacherqrrrrrrU�_regex_cache�clearr��_CACHE_MAX_SIZE�getr�KeyError�argsr�
IndexError�match�end�	groupdict�keys�intr(r�rr'r6r%r$�
startswithrr�r�rZisleapr�r�Zfromordinalr��month�dayr�),�data_stringr�r��arg�msgrqZformat_regex�errZ
bad_directive�foundr�r�r�r�r7Zminute�second�fractionrA�gmtoff�gmtoff_fractionr�r�Zweek_of_year_startr�ZjulianZ
found_dictZ	group_keyZampm�srlZhoursZminutes�secondsZgmtoff_remainderZgmtoff_remainder_paddingZ
found_zoner�r@Z
leap_year_fixr�ZydayZdatetime_resultrrrr
�	_strptime5s�

�
�

��
��




























��





�
����

��r�cCs"t||�d}t�|dtj��S)zIReturn a time struct based on the input string and the
    format string.rN)r�rr3�_STRUCT_TM_ITEMS)r�r��ttrrr
�_strptime_time/sr�cCspt||�\}}}|dd�\}}|dd�|f}|dk	rht||d�}	|rVt|	|�}
nt|	�}
||
f7}||�S)zPReturn a class cls instance based on the input string and the
    format string.���NrB)r�Zmicroseconds)r��datetime_timedelta�datetime_timezone)�clsr�r�r�r�r�rr�r�ZtzdeltarArrr
�_strptime_datetime5s
r�)r�)r�)r�)#rTrr
r�rerr�rrr~Zdatetimerr�rr�rr��_threadrZ_thread_allocate_lock�__all__r�objectr�dictrUr�r�r�r�r�r�r�r�r�rrrr
�<module>s.
_
{
_osx_support.cpython-38.pyc000064400000026513150335716500011754 0ustar00U

e5dU�@s�dZddlZddlZddlZddddgZdZdZd	Zd-d
d�Zd.d
d�Z	dd�Z
dadd�Zda
dd�Zdd�Zdd�Zdadd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d�Zd*d�Zd+d�Zd,d�ZdS)/zShared OS X support functions.�N�compiler_fixup�customize_config_vars�customize_compiler�get_platform_osx)
�CFLAGSZLDFLAGSZCPPFLAGSZ
BASECFLAGS�	BLDSHARED�LDSHARED�CC�CXXZ	PY_CFLAGSZ
PY_LDFLAGSZPY_CPPFLAGSZPY_CORE_CFLAGSZPY_CORE_LDFLAGS)rrr	r
Z_OSX_SUPPORT_INITIAL_cCs�|dkrtjd}|�tj�}tj�|�\}}tjdkrH|dkrH|d}tj�|�s�|D]&}tj�	||�}tj�|�rX|SqXdS|SdS)z�Tries to find 'executable' in the directories listed in 'path'.

    A string listing directories separated by 'os.pathsep'; defaults to
    os.environ['PATH'].  Returns the complete filename or None if not found.
    N�PATHZwin32z.exe)
�os�environ�split�pathsep�path�splitext�sys�platform�isfile�join)�
executabler�paths�baseZext�p�f�r�$/usr/lib64/python3.8/_osx_support.py�_find_executables

rFc
Cs�ddl}zddl}|��}Wn(tk
rDtdt��fd�}YnX|�|��P}|rfd||jf}nd||jf}t�	|�s�|�
��d���ndW5QR�SQRXdS)z0Output from successful command execution or NonerNz/tmp/_osx_support.%szw+bz
%s >'%s' 2>&1z%s 2>/dev/null >'%s'zutf-8)
�
contextlib�tempfileZNamedTemporaryFile�ImportError�openr�getpid�closing�name�system�read�decode�strip)Z
commandstringZcapture_stderrrr�fp�cmdrrr�_read_output7s��
r+cCst|�ptd|f�pdS)z0Find a build tool on current path or using xcrunz/usr/bin/xcrun -find %s�)rr+)Ztoolnamerrr�_find_build_toolMs
��r-cCsxtdkrtdaztd�}Wntk
r,YnHXzt�d|���}W5|��X|dk	rtd�|�d��	d�dd��atS)z*Return the OS X system version as a stringNr,z0/System/Library/CoreServices/SystemVersion.plistz=<key>ProductUserVisibleVersion</key>\s*<string>(.*?)</string>�.��)
�_SYSTEM_VERSIONr!�OSError�close�re�searchr&r�groupr)r�mrrr�_get_system_versionVs
�
r8cCsLtdkrHt�}|rHztdd�|�d�D��aWntk
rFdaYnXtS)z}
    Return the macOS system version as a tuple

    The return value is safe to use to compare
    two version numbers.
    Ncss|]}t|�VqdS�N��int��.0�irrr�	<genexpr>�sz,_get_system_version_tuple.<locals>.<genexpr>r.r)�_SYSTEM_VERSION_TUPLEr8�tupler�
ValueError�Zosx_versionrrr�_get_system_version_tupleus
rDcCs"t|�D]}|�t�r||=qdS)z-Remove original unmodified values for testingN)�list�
startswith�_INITPRE)�_config_vars�krrr�_remove_original_values�s
rJcCs8|�|d�}||kr,t||kr,||t|<|||<dS)z@Save modified and original unmodified value of configuration varr,N)�getrG)rH�cvZnewvalueZoldvaluerrr�_save_modified_value�srMcCs�tdk	rtStd|fd�}d}|��D]T}|�d�r<d}q(|�d�rLd}q(|r(|��}|dkrfdaq(|�d	�r(|dd
�aq(tdkr�datS)z= Returns the root of the default SDK for this system, or '/' Nz%s -c -E -v - </dev/nullTFz#include <...>zEnd of search listz/usr/include�/z.sdk/usr/includei�)�_cache_default_sysrootr+�
splitlinesrFr(�endswith)�cc�contentsZ
in_incdirs�linerrr�_default_sysroot�s$


rUcCst�}|rt|dk�SdS)z=Returns True if universal builds are supported on this system��
�F)rD�boolrCrrr�_supports_universal_builds�srZcCst�}|r|dkSdS)z9Returns True if arm64 builds are supported on this system)�rF)rDrCrrr�_supports_arm64_builds�sr\cCs�dtjkr|S|d��d}}t|�s4td�}n<tj�|��d�rptd|�	dd�f�}|rpd|krptd�}|s|t
d	��||kr�tD]L}||kr�|tjkr�||��}|d
kr�|n|d|d<t||d�
|��q�|S)
z7Find appropriate C compiler for extension module buildsr	rZclangZgccz'%s' --version�'�'"'"'zllvm-gcczCannot locate working compilerr
z++� )rr
rrr-r�basenamerFr+�replace�SystemError�_COMPILER_CONFIG_VARSrMr)rHrRZoldcc�datarLZcv_splitrrr�_find_appropriate_compiler�s,

��recCsVtD]L}||kr|tjkr||}tjdd|tjd�}t�dd|�}t|||�q|S)z5Remove all universal build arguments from config vars�
-arch\s+\w+\sr_)�flagsz-isysroot\s*\S+)�_UNIVERSAL_CONFIG_VARSrr
r4�sub�ASCIIrM)rHrLrgrrr�_remove_universal_flagssrkcCs�dtjkr|St�d|d�dk	r�t�d|d�dd�f�}|r�tD]8}||krF|tjkrF||}t�dd	|�}t|||�qF|S)
z-Remove any unsupported archs from config varsr	z-arch\s+ppcrNzNecho 'int main{};' | '%s' -c -arch ppc -x c -o /dev/null /dev/null 2>/dev/nullr]r^z-arch\s+ppc\w*\sr_)	rr
r4r5r%rarhrirM)rHZstatusrLrgrrr�_remove_unsupported_archss
��	rlcCsddtjkr`tjd}tD]F}||krd||kr||}t�dd|�}|d|}t|||�q|S)z2Allow override of all archs with ARCHFLAGS env var�	ARCHFLAGS�-archrfr_)rr
rhr4rirM)rHZarchrLrgrrr�_override_all_archs:s

rocCsx|�dd�}t�d|�}|dk	rt|�d�}tj�|�sttD]8}||kr:|tjkr:||}t�	dd|�}t
|||�q:|S)z+Remove references to any SDKs not availablerr,z-isysroot\s*(\S+)Nr/z-isysroot\s*\S+(?:\s|$)r_)rKr4r5r6rr�existsrhr
rirM)rH�cflagsr7ZsdkrLrgrrr�_check_for_unavailable_sdkKs
rrc
Cs�d}}t|�}t�s d}}nd|k}tdd�|D��}|sHdtjkr�z|�d�}|||d�=WqHtk
r|Yq�YqHXqHnFt�s�tt	t
|���D].}||dkr�||dd	kr�|||d�=q�dtjkr�|s�|tjd��}|�r@d
d�t|�D�}|�s
�q@|d}||d
k�r0|||d�=q�|||d�=q�d}|}dd�t|�D�}|�sv|}dd�t|�D�}|D]B}||d
k�r�||d}�q�n||t
d
�d�}�q��qz|�r�tj
�|��s�ddlm}	|	�d|�|	�d�|S)ae
    This function will strip '-isysroot PATH' and '-arch ARCH' from the
    compile flags if the user has specified one them in extra_compile_flags.

    This is needed because '-arch ARCH' adds another architecture to the
    build, without a way to remove an architecture. Furthermore GCC will
    barf if multiple '-isysroot' arguments are present.
    FTrncss|]}|�d�r|VqdS)�	-isysrootN�rF)r=�argrrrr?ys
z!compiler_fixup.<locals>.<genexpr>rmr0r/�arm64cSsg|]\}}|�d�r|�qS�rsrt�r=r>�xrrr�
<listcomp>�s
z"compiler_fixup.<locals>.<listcomp>rrsNcSsg|]\}}|�d�r|�qSrwrtrxrrrrz�s
cSsg|]\}}|�d�r|�qSrwrtrxrrrrz�s
)�logz4Compiling with an SDK that doesn't seem to exist: %sz$Please check your Xcode installation)rErZ�anyrr
�indexrBr\�reversed�range�lenr�	enumerater�isdirZ	distutilsr{�warn)
Zcompiler_soZcc_argsZ	stripArchZstripSysrootr}�idx�indicesZsysrootZargvarr{rrrrfsZ	


�
cCs"t�st|�t|�t|�|S)a�Customize Python build configuration variables.

    Called internally from sysconfig with a mutable mapping
    containing name/value pairs parsed from the configured
    makefile used to build this interpreter.  Returns
    the mapping updated as needed to reflect the environment
    in which the interpreter is running; in the case of
    a Python from a binary installer, the installed
    environment may be very different from the build
    environment, i.e. different OS levels, different
    built tools, different available CPU architectures.

    This customization is performed whenever
    distutils.sysconfig.get_config_vars() is first
    called.  It may be used in environments where no
    compilers are present, i.e. when installing pure
    Python dists.  Customization of compiler paths
    and detection of unavailable archs is deferred
    until the first extension module build is
    requested (in distutils.sysconfig.customize_compiler).

    Currently called from distutils.sysconfig
    )rZrkrorr�rHrrrr�s
cCst|�t|�t|�|S)z�Customize compiler path and configuration variables.

    This customization is performed when the first
    extension module build is requested
    in distutils.sysconfig.customize_compiler).
    )rerlror�rrrr�s	cCs�|�dd�}t�p|}|p|}|�r�|}d}|�td|�dd��}|r�z$tdd�|�d�dd	�D��}Wq�tk
r�d
}Yq�Xnd
}|dk�rFd|��k�rFd
}t�d|�}tt	t
|���}t|�dkr�|d}nj|dkr�d}n\|dkr�d
}nN|dk�rd}n>|dk�rd}n.|dk�r&d}n|dk�r6d}ntd|f��n<|dk�rbtj
dk�r�d}n |dk�r�tj
dk�r~d }nd!}|||fS)"z Filter values for get_platform()ZMACOSX_DEPLOYMENT_TARGETr,Zmacosxrcss|]}t|�VqdSr9r:r<rrrr?sz#get_platform_osx.<locals>.<genexpr>r.rr0)rWrrVrnZfatz
-arch\s+(\S+)r/)rv�x86_64Z
universal2)�i386�ppc)r�r�Zintel)r�r�r�Zfat3)�ppc64r�Zfat64)r�r�r�r�Z	universalz%Don't know machine value for archs=%rr�lr�)ZPowerPCZPower_Macintoshr�r�)rKr8rGrArrBr(r4�findall�sorted�setr�r�maxsize)rHZosname�release�machineZmacverZ
macreleaserqZarchsrrrr�sX



�$




�

)N)F)�__doc__rr4r�__all__rhrcrGrr+r-r1r8r@rDrJrMrOrUrZr\rerkrlrorrrrrrrrrr�<module>sB�


	

>(Q)hashlib.cpython-38.opt-2.pyc000064400000011736150335716500011563 0ustar00U

&�.e� �	@svdZdZee�Zee�ZedZddddddd	d
hZzddlmZ	Wne
k
r`d
d�Z	YnXe	�stiZdd�Zdd�Z
e	�s�ddd�Zddd�Zz ddlZeZe
Ze�ej�ZWn$e
k
r�e	�r΂eZeZYnXddlmZzddlmZWne
k
�rYnXeD]DZzee�e�e<Wn*ek
�rTddlZe�de�YnX�q[[[[[
e���sp[[	dS)a3hashlib module - A common interface to many hash functions.

new(name, data=b'', **kwargs) - returns a new hash object implementing the
                                given hash function; initializing the hash
                                using the given binary data.

Named constructor functions are also available, these are faster
than using new(name):

md5(), sha1(), sha224(), sha256(), sha384(), sha512(), blake2b(), blake2s(),
sha3_224, sha3_256, sha3_384, sha3_512, shake_128, and shake_256.

More algorithms may be available on your platform but the above are guaranteed
to exist.  See the algorithms_guaranteed and algorithms_available attributes
to find out what algorithm names can be passed to new().

NOTE: If you want the adler32 or crc32 hash functions they are available in
the zlib module.

Choose your hash function wisely.  Some have known collision weaknesses.
sha384 and sha512 will be slow on 32 bit platforms.

Hash objects have these methods:
 - update(data): Update the hash object with the bytes in data. Repeated calls
                 are equivalent to a single call with the concatenation of all
                 the arguments.
 - digest():     Return the digest of the bytes passed to the update() method
                 so far as a bytes object.
 - hexdigest():  Like digest() except the digest is returned as a string
                 of double length, containing only hexadecimal digits.
 - copy():       Return a copy (clone) of the hash object. This can be used to
                 efficiently compute the digests of datas that share a common
                 initial substring.

For example, to obtain the digest of the byte string 'Nobody inspects the
spammish repetition':

    >>> import hashlib
    >>> m = hashlib.md5()
    >>> m.update(b"Nobody inspects")
    >>> m.update(b" the spammish repetition")
    >>> m.digest()
    b'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9'

More condensed:

    >>> hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest()
    'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2'

)�md5�sha1�sha224�sha256�sha384�sha512�blake2b�blake2s�sha3_224�sha3_256�sha3_384�sha3_512�	shake_128�	shake_256)�new�algorithms_guaranteed�algorithms_available�pbkdf2_hmacr	r
rrr
rrr�)�
get_fips_modecCsdS)Nr�rrr�/usr/lib64/python3.8/hashlib.py�_hashlib_get_fips_modeQsrc	Cs�t}|�|�}|dk	r|S�zB|dkrDddl}|j|d<|d<�n|dkrhddl}|j|d<|d<n�|dkr�ddl}|j|d	<|d
<|j|d<|d<n�|d
kr�ddl	}|j
|d<|d<|j|d<|d<n�|dkr�ddl}|j
|d<|j|d<nb|dk�r6ddl}|j|d<|j|d<|j|d<|j|d<n&|dk�r\ddl}|j|d<|j|d<Wntk
�rtYnX|�|�}|dk	�r�|Std|��dS)N>r�SHA1rrr>�MD5rrr>r�SHA224r�SHA256rrrr>r�SHA512�SHA384rrrrr>rrrr>rr	rr
r	r
rr>r
rr
rzunsupported hash type )�__builtin_constructor_cache�get�_sha1r�_md5r�_sha256rr�_sha512rr�_blake2rr�_sha3r	r
rrr
r�ImportError�
ValueError)	�name�cache�constructorr r!r"r#r$r%rrr�__get_builtin_constructorWsN









r+c	Cs^t�s|tkrt|�Sz"ttd|�}t��s4|�|WSttfk
rXt|�YSXdS)NZopenssl_)r�__block_openssl_constructorr+�getattr�_hashlibr�AttributeErrorr')r(�frrr�__get_openssl_constructor�sr1�cKst|�|f|�S�N)r+�r(�data�kwargsrrr�__py_new�sr7cKsft��s |tkr t|�|f|�Sztj||f|�WStk
r`t��rL�t|�|f|�YSXdSr3)r.rr,r+rr'r4rrr�
__hash_new�sr8N)r)�scryptzcode for hash %s was not found.)r2)r2)�__doc__Z__always_supported�setrr�__all__r,r.rrr&rr+r1r7r8rZ
__get_hash�unionZopenssl_md_meth_namesrr9Z__func_name�globalsr'ZloggingZ	exceptionrrrr�<module>sh5�,

�

tty.cpython-38.opt-2.pyc000064400000001711150335716500010761 0ustar00U

e5do�@sHddlTddgZdZdZdZdZdZdZd	Ze	fd
d�Z
e	fdd�ZdS)
�)�*�setraw�	setcbreak������cCs�t|�}|tttBtBtBtB@|t<|tt@|t<|t	t
tB@|t	<|t	tB|t	<|t
ttBtBtB@|t
<d|tt<d|tt<t|||�dS�Nrr)�	tcgetattr�IFLAGZBRKINTZICRNLZINPCKZISTRIPZIXON�OFLAGZOPOST�CFLAGZCSIZEZPARENBZCS8�LFLAG�ECHO�ICANONZIEXTENZISIG�CC�VMIN�VTIME�	tcsetattr��fdZwhen�mode�r�/usr/lib64/python3.8/tty.pyrs"cCsFt|�}|tttB@|t<d|tt<d|tt<t|||�dSr)rrrrrrrrrrrrrs
N)Ztermios�__all__r
rrrZISPEEDZOSPEEDrZ	TCSAFLUSHrrrrrr�<module>sprofile.cpython-38.pyc000064400000034675150335716500010660 0ustar00U

e5d�[�@sxdZddlZddlZddlZddlZdddgZGdd�d�Zdd	d�Zdd
d�ZGdd�d�Z	dd
�Z
edkrte
�dS)z Class for profiling Python code.�N�run�runctx�Profilec@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_Utilsz�Support class for utility functions which are shared by
    profile.py and cProfile.py modules.
    Not supposed to be used directly.
    cCs
||_dS�N)�profiler)�selfr�r	�/usr/lib64/python3.8/profile.py�__init__0sz_Utils.__init__cCsF|��}z(z|�|�Wntk
r,YnXW5|�|||�XdSr)r�_showr�
SystemExit)r�	statement�filename�sort�profr	r	r
r3s
z
_Utils.runcCsJ|��}z,z|�|||�Wntk
r0YnXW5|�|||�XdSr)rrrr
)rr�globals�localsrrrr	r	r
r<s
z
_Utils.runctxcCs"|dk	r|�|�n
|�|�dSr)�
dump_stats�print_stats)rrrrr	r	r
rEsz_Utils._showN)�__name__�
__module__�__qualname__�__doc__rrrrr	r	r	r
r*s
		r���cCstt��|||�S)aRun statement under profiler optionally saving results in filename

    This function takes a single argument that can be passed to the
    "exec" statement, and an optional file name.  In all cases this
    routine attempts to "exec" its first argument and gather profiling
    statistics from the execution. If no file name is present, then this
    function automatically prints a simple profiling report, sorted by the
    standard name string (file/line/function-name) that is presented in
    each line.
    )rrr)rrrr	r	r
rQscCstt��|||||�S)z�Run statement under profiler, supplying your own globals and locals,
    optionally saving results in filename.

    statement and filename have the same semantics as profile.run
    )rrr)rrrrrr	r	r
r^sc@s�eZdZdZdZd5dd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
ee
e
ee
e
d�Zdd�ZGdd�d�ZGdd�d�Zdd�Zdd �Zd6d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0e_d7d1d2�Zd3d4�ZdS)8raProfiler class.

    self.cur is always a tuple.  Each such tuple corresponds to a stack
    frame that is currently active (self.cur[-2]).  The following are the
    definitions of its members.  We use this external "parallel stack" to
    avoid contaminating the program that we are profiling. (old profiler
    used to write into the frames local dictionary!!) Derived classes
    can change the definition of some entries, as long as they leave
    [-2:] intact (frame and previous tuple).  In case an internal error is
    detected, the -3 element is used as the function name.

    [ 0] = Time that needs to be charged to the parent frame's function.
           It is used so that a function call will not have to access the
           timing data for the parent frame.
    [ 1] = Total time spent in this frame's function, excluding time in
           subfunctions (this latter is tallied in cur[2]).
    [ 2] = Total time spent in subfunctions, excluding time executing the
           frame's function (this latter is tallied in cur[1]).
    [-3] = Name of the function that corresponds to this frame.
    [-2] = Actual frame that we correspond to (used to sync exception handling).
    [-1] = Our parent 6-tuple (corresponds to frame.f_back).

    Timing data for each function is stored as a 5-tuple in the dictionary
    self.timings[].  The index is always the name stored in self.cur[-3].
    The following are the definitions of the members:

    [0] = The number of times this function was called, not counting direct
          or indirect recursion,
    [1] = Number of times this function appears on the stack, minus one
    [2] = Total time spent internal to this function
    [3] = Cumulative time that this function was present on the stack.  In
          non-recursive functions, this is the total execution time from start
          to finish of each invocation of a function, including time spent in
          all subfunctions.
    [4] = A dictionary indicating for each function name, the number of times
          it was called by us.
    rNcCs�i|_d|_d|_d|_|dkr&|j}||_|sHtj|_|_|j	|_
nl||_|��}zt|�}Wn"tk
r�||_|j	|_
Yn0X|dkr�|j
|_
n|j|_
|tfdd�}||_|��|_|�d�dS)N��cSs
||��Srr	)�timer�sumr	r	r
�get_time_timer�sz(Profile.__init__.<locals>.get_time_timerr)�timings�cur�cmd�c_func_name�bias�time�process_timer�get_time�trace_dispatch_i�
dispatcher�len�	TypeError�trace_dispatch�trace_dispatch_lr�t�
simulate_call)rrr$r.Zlengthrr	r	r
r�s0


zProfile.__init__cCs�|j}|�}|d|d|j|j}|dkr8|j|_|j||||�rd|�}|d|d|_n|�}|d|d||_dS)Nr��c_call�rr.r$rr#�dispatch)r�frame�event�argrr.�rr	r	r
r,�szProfile.trace_dispatchcCsT|j}|�|j|j}|dkr(|j|_|j||||�rD|�|_n|�||_dS�Nr1r2�rr4r5r6rr.r	r	r
r(�s
zProfile.trace_dispatch_icCs`|j}|�d|j|j}|dkr,|j|_|j||||�rL|�d|_n|�d||_dS)NgN@r1r2r9r	r	r
�trace_dispatch_mac�szProfile.trace_dispatch_maccCsT|j}|�|j|j}|dkr(|j|_|j||||�rD|�|_n|�||_dSr8)r'r.r$rr#r3)rr4r5r6r'r.r	r	r
r-�s
zProfile.trace_dispatch_lc	CsD|j\}}}}}}||k	r*|r*|�||�S|||||||f|_dS�Nr0)r!�trace_dispatch_return)	rr4r.�rpt�rit�ret�rfn�rframe�rcurr	r	r
�trace_dispatch_exception�s
z Profile.trace_dispatch_exceptioncCs|jr�|j|jdk	r�|j\}}}}}}t|tj�s�|j|jksXtd|||j||jf��|�|d�|jdks�|j|jdks�td|jdf��|j}	|	j|	j	|	j
f}
|dd|
||jf|_|j}|
|kr�||
\}}
}}}||
d|||f||
<nddddif||
<dS)N���zBad callr���r0)r!�f_back�
isinstancer�
fake_frame�AssertionErrorr<�f_code�co_filename�co_firstlineno�co_namer )rr4r.r=r>r?r@rArBZfcode�fnr �cc�ns�tt�ct�callersr	r	r
�trace_dispatch_calls4�
���zProfile.trace_dispatch_callc
Csndd|jf}|dd|||jf|_|j}||krX||\}}}}}	||d|||	f||<nddddif||<dS)Nrrr0)r#r!r )
rr4r.rNr rOrPrQrRrSr	r	r
�trace_dispatch_c_callszProfile.trace_dispatch_c_callcCs�||jdk	rB||jdjks0td|jdf��|�|jdd�|j\}}}}}}||}||}|\}	}
}}}
}|	|
|||||
|f|_|j}||\}}}}}|s�||}|d}||kr�||d||<nd||<||d||||f||<dS)NrDz
Bad returnrErr0)r!rFrIr<r )rr4r.r=r>r?r@rBZframe_totalZpptZpitZpetZpfn�pframeZpcurr rOrPrQrRrSr	r	r
r<"s$"zProfile.trace_dispatch_return)�callZ	exception�returnr1Zc_exceptionZc_returncCs"|jdrdS||_|�|�dS)Nr)r!r"r/)rr"r	r	r
�set_cmdXs
zProfile.set_cmdc@seZdZdd�Zdd�ZdS)zProfile.fake_codecCs||_||_||_d|_dS�Nr)rK�co_linerMrL)rr�line�namer	r	r
r^szProfile.fake_code.__init__cCst|j|j|jf�Sr)�reprrKr[rM�rr	r	r
�__repr__dszProfile.fake_code.__repr__N)rrrrr`r	r	r	r
�	fake_code]srac@seZdZdd�ZdS)zProfile.fake_framecCs||_||_dSr)rJrF)r�codeZpriorr	r	r
rhszProfile.fake_frame.__init__N)rrrrr	r	r	r
rHgsrHcCsF|�dd|�}|jr |jd}nd}|�||�}|jd||d�dS)NZprofilerrDrW)rar!rHr3)rr]rbrVr4r	r	r
r/lszProfile.simulate_callcCsJ|j}|�|j}|jdr:|jd||jd|�d}q|�||_dS)NrrXrDr)r'r.r!r3)rr'r.r	r	r
�simulate_cmd_completexs
zProfile.simulate_cmd_completercCs$ddl}|�|����|���dSrZ)�pstatsZStatsZ
strip_dirsZ
sort_statsr)rrrdr	r	r
r�szProfile.print_statsc	Cs0t|d��}|��t�|j|�W5QRXdS)N�wb)�open�create_stats�marshal�dump�stats)r�file�fr	r	r
r�szProfile.dump_statscCs|��|��dSr)rc�snapshot_statsr_r	r	r
rg�szProfile.create_statsc	Cs^i|_|j��D]H\}\}}}}}|��}d}|��D]}||7}q6|||||f|j|<qdSrZ)rjr �items�copy�values)	r�funcrOrPrQrRrSZncZcallcntr	r	r
rm�s
zProfile.snapshot_statscCsddl}|j}|�|||�SrZ)�__main__�__dict__r)rr"rr�dictr	r	r
r�szProfile.runc	Cs8|�|�t�|j�zt|||�W5t�d�X|Sr)rY�sys�
setprofiler)�exec)rr"rrr	r	r
r�s
zProfile.runctxc	Os�t|�dkr|^}}}nV|s&td��nHd|krZ|�d�}|^}}ddl}|jdtdd�ntdt|�d��|�t|��t�	|j
�z|||�W�St�	d�XdS)	Nrz:descriptor 'runcall' of 'Profile' object needs an argumentrqrz0Passing 'func' as keyword argument is deprecated)�
stacklevelz7runcall expected at least 1 positional argument, got %dr0)r*r+�pop�warnings�warn�DeprecationWarningrYr^rurvr))�args�kwrrqrzr	r	r
�runcall�s(

�
�zProfile.runcallz($self, func, /, *args, **kw)cCs<|jtk	rtd��|j}d|_z|�||�W�S||_XdS)Nz&Subclasses must override .calibrate().r)�	__class__rr+r$�_calibrate_inner)r�m�verboseZ
saved_biasr	r	r
�	calibrate�s
zProfile.calibratecCs|j}dd�}|fdd�}||�|�}||�|�}||}|rLtd|�t�}	|�}|	�dt�t��|�}||}
|r�td|
�d}d}|	j��D]0\\}
}}\}}}}}|d	kr�||7}||7}q�|r�td
|�td|�||dkr�td
|��||d|}|�rtd|�|S)NcSst|�D]}d}qdSr;��range)�n�i�xr	r	r
�f1sz$Profile._calibrate_inner.<locals>.f1cSst|�D]}|d�qdS)N�dr�)r�r�r�r	r	r
rlsz#Profile._calibrate_inner.<locals>.fz elapsed time without profiling =zf(m)zelapsed time with profiling =g)rlr�z!'CPU seconds' profiler reported =ztotal # calls =r0z internal error: total calls = %dg@z+mean stopwatch overhead per profile event =)	r'�printrrrrr rn�
ValueError)rr�r�r'r�rlZt0�t1Zelapsed_noprofile�pZelapsed_profileZtotal_callsZ
reported_timerr\�funcnamerOrPrQrRrSZmeanr	r	r
r��sB

�



zProfile._calibrate_inner)NN)r)r)rrrrr$rr,r(r:r-rCrTrUr<r3rYrarHr/rcrrrgrmrrr�__text_signature__r�r�r	r	r	r
rgsB&
''�



+
c
Cs�ddl}ddlm}d}||d�}d|_|jdddd	dd
�|jddd
ddd�|jdddddd
�tjdd�s�|��t�d�|�	�\}}|tjdd�<|j
dk	r�|j�|j
�|_
t
|�dk�r�|jr�ddl}d}|j|dd�}nR|d}	tj�d|j�|	��t�|	��}
t|
��|	d�}W5QRX|	dddd�}zt||d|j
|j�Wn6tk
�r�}zdt_t�|j�W5d}~XYnXn|��|S)Nr)�OptionParserzMprofile.py [-o output_file_path] [-s sort] [-m module | scriptfile] [arg] ...)�usageFz-oz	--outfile�outfilezSave stats to <outfile>)�dest�help�defaultz-m�module�
store_truezProfile a library module.)r��actionr�r�z-sz--sortrz?Sort order when printing to stdout, based on pstats.Stats classrr0rz(run_module(modname, run_name='__main__'))�
run_module�modnamerwrr)�__file__r�__package__�
__cached__)�osZoptparser�Zallow_interspersed_argsZ
add_optionru�argvZprint_usage�exit�
parse_argsr��path�abspathr*r��runpyr��insert�dirname�io�	open_code�compile�readrr�BrokenPipeError�stdout�errno)r�r�r��parserZoptionsr}r�rbZglobsZprogname�fp�excr	r	r
�main9s^

�
�
�

�� r�rr)Nr)Nr)rr�rur%rh�__all__rrrrr�rr	r	r	r
�<module>	s

'

	U9datetime.cpython-38.opt-1.pyc000064400000155202150335716500011741 0ustar00U

e5d�X�
@sVdZddlZddlZddlZdd�ZdZdZdZ	dd	d
d	dd	dd	d	dd	dd	g
Z
dgZdZe
dd�D]Z
e�e�ee
7Zqd[[
dd
�Zdd�Zdd�Zdd�Zdd�Zed�Zed�Zed�Zdd�Zddddddd d!d"d#d$d%d&g
Zdd'd(d)d*d+d,d-gZd.d/�Zdid1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(GdMdN�dN�Z)e)dO�e)_*e)dPdQdRdRdSdT�e)_+e)ddU�e)_,GdVdW�dW�Z-e-Z.e-ddd�e-_*e-ddXd	�e-_+e)ddY�e-_,GdZd[�d[�Z/e/Z0Gd\d]�d]�ZeZ1eddd�e_*edQdRdRdS�e_+e)ddU�e_,Gd^d_�d_e-�Z2e2ddd�e2_*e2ddXd	dQdRdRdS�e2_+e)ddU�e2_,d`da�Z3Gdbdc�dce/�Z4e4�5e)d��e4_6e4�5e)dQdRdd��e4_*e4�5e)dQdRdd��e4_+e2dedde4j6df�Z7zddgl8TWne9k
�r�YnXX[[[
[[[[7[	[[[$[#[%[&[!["[['[.[[[[[[[3[[[[1[0[[[([[ [ddhl8mZdS)jz�Concrete date/time and related types.

See http://www.iana.org/time-zones/repository/tz-link.html for
time zone and DST data sources.
�NcCs||krdS||krdSdS)Nr�������x�yrr� /usr/lib64/python3.8/datetime.py�_cmpsr	ri'i۹7r���cCs$|ddko"|ddkp"|ddkS)zyear -> 1 if leap year, else 0.�r�d�r)�yearrrr�_is_leap%srcCs(|d}|d|d|d|dS)z2year -> number of days before January 1st of year.r�mr
rrr)rrrrr�_days_before_year)srcCs|dkrt|�rdSt|S)z9year, month -> number of days in that month in that year.��)r�_DAYS_IN_MONTH�r�monthrrr�_days_in_month.srcCst||dkot|�S)zCyear, month -> number of days in year preceding first day of month.r)�_DAYS_BEFORE_MONTHrrrrr�_days_before_month5srcCs t||�}t|�t||�|S)z>year, month, day -> ordinal, considering 01-Jan-0001 as day 1.)rrr�rr�day�dimrrr�_ymd2ord:s
��ri��e�c	Cs�|d8}t|t�\}}|dd}t|t�\}}t|t�\}}t|d�\}}||d|d|7}|dkst|dkr�|dddfS|dko�|d	kp�|dk}|d
d?}t||dko�|}||kr�|d8}|t||dko�|8}||8}|||dfS)
z@ordinal -> (year, month, day), considering 01-Jan-0001 as day 1.rrrrr
�r
���2r!r)�divmod�_DI400Y�_DI100Y�_DI4Yrr)	�nZn400rZn100Zn4Zn1ZleapyearrZ	precedingrrr�_ord2ymdSs"r+ZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecZMonZTueZWedZThuZFriZSatZSunc	Cs>t|||�dd}t||�|}t�|||||||||f	�S)N��)rr�_time�struct_time)	r�m�d�hh�mm�ssZdstflagZwdayZdnumrrr�_build_struct_time�sr5�autocCstdddddd�}|dkr&|r dnd	}n|d
kr6|d}z||}Wntk
r^td��YnX|�||||�SdS)
Nz{:02d}z
{:02d}:{:02d}z{:02d}:{:02d}:{:02d}z{:02d}:{:02d}:{:02d}.{:03d}z{:02d}:{:02d}:{:02d}.{:06d})�hours�minutes�seconds�milliseconds�microsecondsr6r;r9r:��zUnknown timespec value)�KeyError�
ValueError�format)r2r3r4�us�timespecZspecs�fmtrrr�_format_time�s�rCcCs�d}|dk	r�|jdkr"d}|}nd}t|tdd��\}}t|tdd��\}}|d|||f7}|sj|jr�|d	|j7}|jr�|d
|j7}|S)N�r�-�+r�r7�r8z%s%02d:%02dz:%02d�.%06d)�daysr&�	timedeltar;r9)�off�s�signr2r3r4rrr�_format_offset�s

rOcCs�d}d}d}g}|j}dt|�}}	||	k�r�||}
|d7}|
dk�r�||	k�r�||}
|d7}|
dkr�|dkr�dt|dd�}|�|��q�|
dk�r^|dk�rRd}t|d	��rR|��}|dk	�rRd
}|jdkr�|}d}t|tdd��\}
}t|tdd
��\}}|j}|j	}|�r,d||
|||f}n&|�rDd||
||f}nd||
|f}|�|�n^|
dk�r�|dk�r�d}t|d��r�|�
�}|dk	�r�|�dd�}|�|�n|d�||
�n|d�q$||
�q$d�|�}t
�||�S)Nrr�%�fz%06d�microsecond�zrD�	utcoffsetrFrErGrHz%c%02d%02d%02d.%06dz%c%02d%02d%02dz
%c%02d%02d�Z�tznamez%%)�append�len�getattr�hasattrrTrJr&rKr9r;rV�replace�joinr.�strftime)�objectr?�	timetupleZfreplaceZzreplaceZZreplaceZ	newformat�push�ir*Zch�offsetrN�h�restr0rM�urrr�_wrap_strftime�sl


�










rfcCsjt|dd��}|ddkr,td|d��t|dd��}|ddkrPtd��t|dd	��}|||gS)
Nrr
rEzInvalid date separator: %sr!r-zInvalid date separator��
)�intr>)Zdtstrrrrrrr�_parse_isoformat_datesrjcCs
t|�}ddddg}d}tdd�D]t}||dkr:td��t|||d��||<|d7}|||d�}|rv|dkrzq�|dkr�td|��|d7}q"||k�r||dkr�td	��nN|d7}||}|d
kr�td	��t||d��|d<|dk�r|dd9<|S)Nrr#rzIncomplete time componentr�:zInvalid time separator: %c�.zInvalid microsecond component)r#r,r<)rX�ranger>ri)�tstr�len_str�
time_comps�pos�compZ	next_charZ
len_remainderrrr�_parse_hh_mm_ss_ffs2



rsc
Cs�t|�}|dkrtd��|�d�dp2|�d�d}|dkrL|d|d�n|}t|�}d}|dkr�||d�}t|�dkr�td��t|�}td	d
�|D��r�tj}nD||ddkr�dnd}t|d|d|d|dd
�}	t||	�}|�|�|S)NrzIsoformat time too shortrErrFr)r!rg�zMalformed time zone stringcss|]}|dkVqdS)rNr)�.0rrrr�	<genexpr>Tsz(_parse_isoformat_time.<locals>.<genexpr>rr#�r7r8r9r;)	rXr>�findrs�all�timezone�utcrKrW)
rnroZtz_posZtimestrrpZtziZtzstrZtz_compsZtzsignZtdrrr�_parse_isoformat_time;s,�
r|cCs&|dk	r"t|t�s"tdt|���dS)Nz4tzinfo.tzname() must return None or string, not '%s')�
isinstance�str�	TypeError�type)�namerrr�
_check_tznameds�r�cCs^|dkrdSt|t�s*td|t|�f��td�|krHtd�ksZntd||f��dS)Nz3tzinfo.%s() must return None or timedelta, not '%s'rzN%s()=%s, must be strictly between -timedelta(hours=24) and timedelta(hours=24))r}rKrr�r>)r�rbrrr�_check_utc_offsetos

� �r�cCs�t|t�r|St|t�r td��z|��}Wntk
r@Yn"Xt|t�s^tdt|�j��|S|}z|��}Wntk
r�YnDXt|t�s�tdt|�j��ddl	}|j
dt|�jtdd�|Stdt|�j��dS)Nz$integer argument expected, got floatz$__index__ returned non-int (type %s)z"__int__ returned non-int (type %s)rz$an integer is required (got type %s)r)�
stacklevel)r}ri�floatr�	__index__�AttributeErrorr��__name__�__int__�warnings�warn�DeprecationWarning)�valueZorigr�rrr�_check_int_field{sB


�
����r�cCs�t|�}t|�}t|�}t|kr,tks@ntdttf|��d|krTdks`ntd|��t||�}d|kr~|ks�ntd||��|||fS)Nzyear must be in %d..%drr"zmonth must be in 1..12zday must be in 1..%d)r��MINYEAR�MAXYEARr>rrrrr�_check_date_fields�s

r�cCs�t|�}t|�}t|�}t|�}d|kr4dks@ntd|��d|krTdks`ntd|��d|krtdks�ntd|��d|kr�dks�ntd|��|d	kr�td
|��|||||fS)Nr�zhour must be in 0..23�;zminute must be in 0..59zsecond must be in 0..59�?Bz microsecond must be in 0..999999)rrzfold must be either 0 or 1)r�r>)�hour�minute�secondrR�foldrrr�_check_time_fields�s




r�cCs|dk	rt|t�std��dS)Nz4tzinfo argument must be None or of a tzinfo subclass)r}�tzinfor)�tzrrr�_check_tzinfo_arg�sr�cCs tdt|�jt|�jf��dS)Nzcan't compare '%s' to '%s')rr�r�rrrr�	_cmperror�s�r�cCsRt||�\}}|d9}|dkr&||kn||k}|sF||krN|ddkrN|d7}|S)z�divide a by b and round result to the nearest integer

    When the ratio is exactly half-way between two integers,
    the even integer is returned.
    rrr)r&)�a�b�q�rZgreater_than_halfrrr�_divide_and_round�sr�c@seZdZdZdZd?dd�Zdd�Zdd	�Zd
d�Ze	dd
��Z
e	dd��Ze	dd��Zdd�Z
e
Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZeZd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Z d6d7�Z!d8d9�Z"d:d;�Z#d<d=�Z$d>S)@rKa�Represent the difference between two datetime objects.

    Supported operators:

    - add, subtract timedelta
    - unary plus, minus, abs
    - compare to timedelta
    - multiply, divide by int

    In addition, datetime supports subtraction of two datetime objects
    returning a timedelta, and addition or subtraction of a datetime
    and a timedelta giving a datetime.

    Representation: (days, seconds, microseconds).  Why?  Because I
    felt like it.
    )�_days�_seconds�
_microseconds�	_hashcodercCs�d}}	}
||d7}||d|d7}||d7}t|t�rtt�|�\}}t�|d�\}}
t|
�}	t|�}nd}|}t|t�r�t�|�\}}t|�}||7}n|}t|d�\}}||7}|	t|�7}	|d	}t|t��rt||�}t|d
�\}}t|d�\}}||7}|	|7}	n@t|�}t|d
�\}}t|d�\}}||7}|	|7}	t||�}t|d
�\}}
|	|7}	t|	d�\}}	||7}t|�dk�r�td|��t	�
|�}||_|	|_|
|_
d
|_|S)Nrr-�<�r<g�@g�Q���.A�@B�ɚ;z$timedelta # of days is too large: %dr)r}r��_math�modfrir&�round�abs�
OverflowErrorr^�__new__r�r�r�r�)�clsrJr9r;r:r8r7Zweeksr1rMr@ZdayfracZdaysecondsfracZdaysecondswholeZsecondsfracZusdouble�selfrrrr��sZ




ztimedelta.__new__cCspg}|jr|�d|j�|jr0|�d|j�|jrF|�d|j�|sT|�d�d|jj|jjd�|�fS)Nzdays=%dz
seconds=%dzmicroseconds=%d�0�	%s.%s(%s)�, )r�rWr�r��	__class__�
__module__�__qualname__r\)r��argsrrr�__repr__Ms
�ztimedelta.__repr__cCsdt|jd�\}}t|d�\}}d|||f}|jrLdd�}d||j�|}|jr`|d|j}|S)Nr�z%d:%02d:%02dcSs|t|�dkrdpdfS)NrrMrD)r�)r*rrr�plural`sz!timedelta.__str__.<locals>.pluralz
%d day%s, rI)r&r�r�r�)r�r3r4r2rMr�rrr�__str__[sztimedelta.__str__cCs|jd|jd|jdS)zTotal seconds in the duration.r�r�)rJr9r;�r�rrr�
total_secondsgs
��ztimedelta.total_secondscCs|jS�rJ�r�r�rrrrJmsztimedelta.dayscCs|jS�r9)r�r�rrrr9rsztimedelta.secondscCs|jS�r;)r�r�rrrr;wsztimedelta.microsecondscCs2t|t�r.t|j|j|j|j|j|j�StS�N�r}rKr�r�r��NotImplemented�r��otherrrr�__add__|s


�ztimedelta.__add__cCs2t|t�r.t|j|j|j|j|j|j�StSr�r�r�rrr�__sub__�s


�ztimedelta.__sub__cCst|t�r||StSr�)r}rKr�r�rrr�__rsub__�s

ztimedelta.__rsub__cCst|j|j|j�Sr�)rKr�r�r�r�rrr�__neg__�s�ztimedelta.__neg__cCs|Sr�rr�rrr�__pos__�sztimedelta.__pos__cCs|jdkr|S|SdS�Nrr�r�rrr�__abs__�s
ztimedelta.__abs__cCs`t|t�r(t|j||j||j|�St|t�r\|��}|��\}}tddt	|||��St
Sr�)r}rirKr�r�r�r��_to_microseconds�as_integer_ratior�r��r�r��usecr�r�rrr�__mul__�s

�
ztimedelta.__mul__cCs|jd|jd|jS)Nr�r��r�r�r�r�rrrr��s�ztimedelta._to_microsecondscCsNt|ttf�stS|��}t|t�r0||��St|t�rJtdd||�SdSr�)r}rirKr�r�)r�r�r�rrr�__floordiv__�s

ztimedelta.__floordiv__cCs~t|tttf�stS|��}t|t�r2||��St|t�rNtddt||��St|t�rz|��\}}tddt|||��SdSr�)r}rir�rKr�r�r�r�r�rrr�__truediv__�s


ztimedelta.__truediv__cCs*t|t�r&|��|��}tdd|�StSr�)r}rKr�r�)r�r�r�rrr�__mod__�s
ztimedelta.__mod__cCs4t|t�r0t|��|���\}}|tdd|�fStSr�)r}rKr&r�r�)r�r�r�r�rrr�
__divmod__�s
�ztimedelta.__divmod__cCs t|t�r|�|�dkStSdSr��r}rKr	r�r�rrr�__eq__�s
ztimedelta.__eq__cCs t|t�r|�|�dkStSdSr�r�r�rrr�__le__�s
ztimedelta.__le__cCs t|t�r|�|�dkStSdSr�r�r�rrr�__lt__�s
ztimedelta.__lt__cCs t|t�r|�|�dkStSdSr�r�r�rrr�__ge__�s
ztimedelta.__ge__cCs t|t�r|�|�dkStSdSr�r�r�rrr�__gt__�s
ztimedelta.__gt__cCst|��|���Sr�)r	�	_getstater�rrrr	�sztimedelta._cmpcCs|jdkrt|���|_|jS)Nr�r��hashr�r�rrr�__hash__�s
ztimedelta.__hash__cCs|jdkp|jdkp|jdkSr�r�r�rrr�__bool__s

��ztimedelta.__bool__cCs|j|j|jfSr�r�r�rrrr�
sztimedelta._getstatecCs|j|��fSr��r�r�r�rrr�
__reduce__
sztimedelta.__reduce__N)rrrrrrr)%r�r�r��__doc__�	__slots__r�r�r�r��propertyrJr9r;r��__radd__r�r�r�r�r�r��__rmul__r�r�r�r�r�r�r�r�r�r�r	r�r�r�r�rrrrrK�sR�
e


		
		rKi6e�r�r�r�r�)rJr7r8r9r;r�c@s@eZdZdZdZdDdd�Zedd��Zedd	��Zed
d��Z	edd
��Z
edd��Zdd�Zdd�Z
dd�Zdd�Zdd�ZeZedd��Zedd��Zedd��Zd d!�Zd"d#�ZdEd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Z e Z!d6d7�Z"d8d9�Z#d:d;�Z$d<d=�Z%d>d?�Z&d@dA�Z'dBdC�Z(dS)F�datea�Concrete date type.

    Constructors:

    __new__()
    fromtimestamp()
    today()
    fromordinal()

    Operators:

    __repr__, __str__
    __eq__, __le__, __lt__, __ge__, __gt__, __hash__
    __add__, __radd__, __sub__ (add/radd only with timedelta arg)

    Methods:

    timetuple()
    toordinal()
    weekday()
    isoweekday(), isocalendar(), isoformat()
    ctime()
    strftime()

    Properties (readonly):
    year, month, day
    )�_year�_month�_dayr�NcCs�|dkr�t|ttf�r�t|�dkr�dt|dd��krBdkr�nnTt|t�r|z|�d�}Wntk
rztd��YnXt�	|�}|�
|�d	|_|St|||�\}}}t�	|�}||_
||_||_d	|_|S)
zVConstructor.

        Arguments:

        year, month, day (required, base 1)
        Nr
rrr#r"�latin1znFailed to encode latin1 string when unpickling a date object. pickle.load(data, encoding='latin1') is assumed.r)r}�bytesr~rX�ord�encode�UnicodeEncodeErrorr>r^r��_date__setstater�r�r�r�r�)r�rrrr�rrrr�3s8�
���

�



zdate.__new__c	Cs(t�|�\	}}}}}}}}	}
||||�S)z;Construct a date from a POSIX timestamp (like time.time()).)r.�	localtime)r��trr0r1r2r3r4�weekday�jday�dstrrr�
fromtimestampUszdate.fromtimestampcCst��}|�|�S)z"Construct a date from time.time().�r.�timer��r�r�rrr�today[sz
date.todaycCst|�\}}}||||�S)z�Construct a date from a proleptic Gregorian ordinal.

        January 1 of year 1 is day 1.  Only the year, month and day are
        non-zero in the result.
        )r+)r�r*rr0r1rrr�fromordinalaszdate.fromordinalcCsHt|t�std��z|t|��WStk
rBtd|����YnXdS)z5Construct a date from the output of date.isoformat().�#fromisoformat: argument must be str�Invalid isoformat string: N)r}r~rrj�	Exceptionr>)r��date_stringrrr�
fromisoformatks
zdate.fromisoformatc	Cs�t|krtks$ntd|����d|kr8dks�nd}|dkrrt|dd�d}|dksn|dkrrt|�rrd	}|r�td
|����d|kr�dks�ntd|�d
���|dd|d}t|�}||}|t|��S)z|Construct a date from the ISO year, week number and weekday.

        This is the inverse of the date.isocalendar() functionzYear is out of range: r�5Trr-r
r#FzInvalid week: rgzInvalid weekday: z (range is [1, 7]))r�r�r>rr�_isoweek1mondayr+)	r�r�weekrZout_of_rangeZ
first_weekdayZ
day_offsetZday_1Zord_dayrrr�fromisocalendarws$�zdate.fromisocalendarcCs d|jj|jj|j|j|jfS)a5Convert to formal string, for repr().

        >>> dt = datetime(2010, 1, 1)
        >>> repr(dt)
        'datetime.datetime(2010, 1, 1, 0, 0)'

        >>> dt = datetime(2010, 1, 1, tzinfo=timezone.utc)
        >>> repr(dt)
        'datetime.datetime(2010, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)'
        z%s.%s(%d, %d, %d))r�r�r�r�r�r�r�rrrr��s�z
date.__repr__cCs.|��dpd}dt|t|j|j|jfS)�Return ctime() style string.r-z%s %s %2d 00:00:00 %04d)�	toordinal�	_DAYNAMES�_MONTHNAMESr�r�r��r�r�rrr�ctime�s�z
date.ctimecCst|||���S)zFormat using strftime().)rfr_�r�rBrrrr]�sz
date.strftimecCs:t|t�stdt|�j��t|�dkr2|�|�St|�S�Nzmust be str, not %sr�r}r~rr�r�rXr]rrrr�
__format__�s


zdate.__format__cCsd|j|j|jfS)z�Return the date formatted according to ISO.

        This is 'YYYY-MM-DD'.

        References:
        - http://www.w3.org/TR/NOTE-datetime
        - http://www.cl.cam.ac.uk/~mgk25/iso-time.html
        z%04d-%02d-%02d)r�r�r�r�rrr�	isoformat�s	zdate.isoformatcCs|jS)z
year (1-9999))r�r�rrrr�sz	date.yearcCs|jS)zmonth (1-12))r�r�rrrr�sz
date.monthcCs|jS)z
day (1-31))r�r�rrrr�szdate.daycCst|j|j|jdddd�S)�9Return local time tuple compatible with time.localtime().rr)r5r�r�r�r�rrrr_�s�zdate.timetuplecCst|j|j|j�S)z�Return proleptic Gregorian ordinal for the year, month and day.

        January 1 of year 1 is day 1.  Only the year, month and day values
        contribute to the result.
        )rr�r�r�r�rrrr�szdate.toordinalcCs:|dkr|j}|dkr|j}|dkr*|j}t|�|||�S)z;Return a new date with new values for the specified fields.N)r�r�r�r�)r�rrrrrrr[�szdate.replacecCst|t�r|�|�dkStSr��r}r�r	r�r�rrrr��s
zdate.__eq__cCst|t�r|�|�dkStSr�rr�rrrr�s
zdate.__le__cCst|t�r|�|�dkStSr�rr�rrrr�s
zdate.__lt__cCst|t�r|�|�dkStSr�rr�rrrr�
s
zdate.__ge__cCst|t�r|�|�dkStSr�rr�rrrr�s
zdate.__gt__cCsB|j|j|j}}}|j|j|j}}}t|||f|||f�Sr�)r�r�r�r	)r�r�rr0r1Zy2Zm2Zd2rrrr	sz	date._cmpcCs|jdkrt|���|_|jS)�Hash.rr�r�rrrr�s
z
date.__hash__cCsJt|t�rF|��|j}d|kr,tkr>nnt|��|�Std��tS)zAdd a date to a timedelta.r�result out of range)	r}rKrrJ�_MAXORDINALr�rr�r�)r�r��orrrr�%s
zdate.__add__cCsDt|t�r|t|j�St|t�r@|��}|��}t||�StS)z.Subtract two dates, or a date and a timedelta.)r}rKrJr�rr�)r�r��days1�days2rrrr�0s

zdate.__sub__cCs|��ddS)z:Return day of the week, where Monday == 0 ... Sunday == 6.r,r-�rr�rrrr�:szdate.weekdaycCs|��dpdS)z:Return day of the week, where Monday == 1 ... Sunday == 7.r-rr�rrr�
isoweekday@szdate.isoweekdaycCs�|j}t|�}t|j|j|j�}t||d�\}}|dkr^|d8}t|�}t||d�\}}n$|dkr�|t|d�kr�|d7}d}||d|dfS)a�Return a 3-tuple containing ISO year, week number, and weekday.

        The first ISO week of the year is the (Mon-Sun) week
        containing the year's first Thursday; everything else derives
        from that.

        The first week is 1; Monday is 1 ... Sunday is 7.

        ISO calendar algorithm taken from
        http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm
        (used with permission)
        r-rr�4)r�rrr�r�r&)r�r�week1mondayrr	rrrr�isocalendarEs
zdate.isocalendarcCs&t|jd�\}}t|||j|jg�fS�N�)r&r�r�r�r�)r��yhi�ylorrrr�cszdate._getstatecCs"|\}}|_|_|d||_dSr#)r�r�r�)r��stringr%r&rrr�
__setstategszdate.__setstatecCs|j|��fSr�r�r�rrrr�kszdate.__reduce__)NN)NNN))r�r�r�r�r�r��classmethodr�rrrr
r�rr]rrr�r�rrrr_rr[r�r�r�r�r�r	r�r�r�r�r�rr"r�r�r�rrrrr�sX
"


	

$



	
r�r"r�c@s<eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
S)r�z}Abstract base class for time zone info classes.

    Subclasses must override the name(), utcoffset() and dst() methods.
    rcCstd��dS)z%datetime -> string name of time zone.z&tzinfo subclass must override tzname()N��NotImplementedError�r��dtrrrrV|sz
tzinfo.tznamecCstd��dS)zIdatetime -> timedelta, positive for east of UTC, negative for west of UTCz)tzinfo subclass must override utcoffset()Nr*r,rrrrT�sztzinfo.utcoffsetcCstd��dS)z�datetime -> DST offset as timedelta, positive for east of UTC.

        Return 0 if DST not in effect.  utcoffset() must include the DST
        offset.
        z#tzinfo subclass must override dst()Nr*r,rrrr��sz
tzinfo.dstcCs�t|t�std��|j|k	r$td��|��}|dkr<td��|��}|dkrTtd��||}|r�||7}|��}|dkr�td��||S)z*datetime in UTC -> datetime in local time.z&fromutc() requires a datetime argumentzdt.tzinfo is not selfNz0fromutc() requires a non-None utcoffset() resultz*fromutc() requires a non-None dst() resultz;fromutc(): dt.dst gave inconsistent results; cannot convert)r}�datetimerr�r>rTr�)r�r-ZdtoffZdtdst�deltarrr�fromutc�s"

ztzinfo.fromutccCsft|dd�}|r|�}nd}t|dd�}|r4|�}nt|dd�pBd}|dkrV|j|fS|j||fSdS)N�__getinitargs__r�__getstate__�__dict__)rYr�)r�Zgetinitargsr��getstate�staterrrr��s
ztzinfo.__reduce__N)
r�r�r�r�r�rVrTr�r0r�rrrrr�usr�c@s*eZdZdZdZdBdd�dd�Zedd	��Zed
d��Zedd
��Z	edd��Z
edd��Zedd��Zdd�Z
dd�Zdd�Zdd�Zdd�ZdCdd �Zd!d"�Zd#d$�Zd%d&�ZdDd(d)�ZeZed*d+��Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdEdd�d7d8�ZdFd:d;�Z d<d=�Z!d>d?�Z"d@dA�Z#dS)Gr�a<Time with time zone.

    Constructors:

    __new__()

    Operators:

    __repr__, __str__
    __eq__, __le__, __lt__, __ge__, __gt__, __hash__

    Methods:

    strftime()
    isoformat()
    utcoffset()
    tzname()
    dst()

    Properties (readonly):
    hour, minute, second, microsecond, tzinfo, fold
    )�_hour�_minute�_second�_microsecond�_tzinfor��_foldrN�r�cCs�t|ttf�r�t|�dkr�t|dd��d@dkr�t|t�rhz|�d�}Wntk
rftd��YnXt�	|�}|�
||p~d�d	|_|St|||||�\}}}}}t
|�t�	|�}||_||_||_||_||_d	|_||_|S)
z�Constructor.

        Arguments:

        hour, minute (required)
        second, microsecond (default to zero)
        tzinfo (default to None)
        fold (keyword only, default to zero)
        r,rr�r$r�znFailed to encode latin1 string when unpickling a time object. pickle.load(data, encoding='latin1') is assumed.Nr)r}r�r~rXr�r�r�r>r^r��_time__setstater�r�r�r6r7r8r9r:r;)r�r�r�r�rRr�r�r�rrrr��s>
�
�

�
ztime.__new__cCs|jS�zhour (0-23)�r6r�rrrr��sz	time.hourcCs|jS�z
minute (0-59)�r7r�rrrr�sztime.minutecCs|jS�z
second (0-59)�r8r�rrrr�sztime.secondcCs|jS�zmicrosecond (0-999999)�r9r�rrrrRsztime.microsecondcCs|jS�ztimezone info object�r:r�rrrr�sztime.tzinfocCs|jSr��r;r�rrrr�sz	time.foldcCs$t|t�r|j|dd�dkStSdS)NT��allow_mixedr�r}r�r	r�r�rrrr�s
ztime.__eq__cCs t|t�r|�|�dkStSdSr�rLr�rrrr�#s
ztime.__le__cCs t|t�r|�|�dkStSdSr�rLr�rrrr�)s
ztime.__lt__cCs t|t�r|�|�dkStSdSr�rLr�rrrr�/s
ztime.__ge__cCs t|t�r|�|�dkStSdSr�rLr�rrrr�5s
ztime.__gt__Fc
Cs�|j}|j}d}}||kr"d}n|��}|��}||k}|rht|j|j|j|jf|j|j|j|jf�S|dksx|dkr�|r�dStd��|jd|j|tdd�}|jd|j|tdd�}	t||j|jf|	|j|jf�S)NTrz$cannot compare naive and aware timesr�rrH)	r:rTr	r6r7r8r9rrK)
r�r�rK�mytz�ottz�myoff�otoff�base_compareZmyhhmmZothhmmrrrr	;s2����z	time._cmpcCs�|jdkr�|jr|jdd�}n|}|��}|sBt|��d�|_nztt|j|j	d�|tdd��\}}|tdd�}d|kr�dkr�nntt
|||j|j��|_nt|||j|jf�|_|jS)	rrrr<�r7r8rrGrHr$)
r�r�r[rTr�r�r&rKr�r�r�r�rR)r�r��tzoffrcr0rrrr�Ws
�z
time.__hash__cCs|��}t|�S)z=Return formatted timezone offset (+xx:xx) or an empty string.)rTrO)r�rLrrr�_tzstrnsztime._tzstrcCs�|jdkrd|j|jf}n|jdkr2d|j}nd}d|jj|jj|j|j|f}|jdk	rx|dd�d|jd	}|jr�|dd�d
}|S)�%Convert to formal string, for repr().rz, %d, %dz, %drDz%s.%s(%d, %d%s)Nr�, tzinfo=%r�)�	, fold=1))	r9r8r�r�r�r6r7r:r;�r�rMrrrr�ss 

�
z
time.__repr__r6cCs0t|j|j|j|j|�}|��}|r,||7}|S)a�Return the time formatted according to ISO.

        The full format is 'HH:MM:SS.mmmmmm+zz:zz'. By default, the fractional
        part is omitted if self.microsecond == 0.

        The optional argument timespec specifies the number of additional
        terms of the time to include. Valid options are 'auto', 'hours',
        'minutes', 'seconds', 'milliseconds' and 'microseconds'.
        )rCr6r7r8r9rT)r�rArMr�rrrr�s
�ztime.isoformatcCsHt|t�std��z|t|��WStk
rBtd|����YnXdS)z0Construct a time from the output of isoformat().rrN)r}r~rr|rr>)r�Ztime_stringrrrr�s
ztime.fromisoformatc	Cs(ddd|j|j|jdddf	}t|||�S)z{Format using strftime().  The date part of the timestamp passed
        to underlying strftime should not be used.
        ilrrr)r6r7r8rf)r�rBr_rrrr]�s�z
time.strftimecCs:t|t�stdt|�j��t|�dkr2|�|�St|�Srrrrrrr�s


ztime.__format__cCs(|jdkrdS|j�d�}td|�|S)z^Return the timezone offset as timedelta, positive east of UTC
         (negative west of UTC).NrT�r:rTr��r�rbrrrrT�s


ztime.utcoffsetcCs&|jdkrdS|j�d�}t|�|S�aReturn the timezone name.

        Note that the name is 100% informational -- there's no requirement that
        it mean anything in particular. For example, "GMT", "UTC", "-500",
        "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies.
        N�r:rVr��r�r�rrrrV�s

ztime.tznamecCs(|jdkrdS|j�d�}td|�|S�aqReturn 0 if DST is not in effect, or the DST offset (as timedelta
        positive eastward) if DST is in effect.

        This is purely informational; the DST offset has already been added to
        the UTC offset returned by utcoffset() if applicable, so there's no
        need to consult dst() unless you're interested in displaying the DST
        info.
        Nr��r:r�r�r[rrrr��s
	

ztime.dstTcCsl|dkr|j}|dkr|j}|dkr*|j}|dkr8|j}|dkrF|j}|dkrT|j}t|�||||||d�S)z;Return a new time with new values for the specified fields.NTr<)r�r�r�rRr�r;r�)r�r�r�r�rRr�r�rrrr[�sztime.replacer#cCspt|jd�\}}t|d�\}}|j}|jr:|dkr:|d7}t||j|j|||g�}|jdkrb|fS||jfSdS�Nr$r#�)r&r9r6r;r�r7r8r:)r��protocol�us2�us3�us1rc�	basestaterrrr��s�
ztime._getstatecCst|dk	rt|t�std��|\}|_|_}}}|dkrHd|_|d|_nd|_||_|d>|Bd>|B|_||_dS)N�bad tzinfo state argr=rrbrrg)	r}�
_tzinfo_classrr7r8r;r6r9r:)r�r'r�rcrfrdrerrrr(�sztime.__setstatecCs|j|�|�fSr�r��r�rcrrr�
__reduce_ex__sztime.__reduce_ex__cCs
|�d�S�Nr�rkr�rrrr�sztime.__reduce__)rrrrN)F)r6)NNNNT)r#)$r�r�r�r�r�r�r�r�r�r�rRr�r�r�r�r�r�r�r	r�rTr�rr�r)rr]rrTrVr�r[r�r>rkr�rrrrr��sT(








		
��


r�c@s�eZdZdZejejZdddd�dd�Zedd��Z	ed	d
��Z
edd��Zed
d��Zedd��Z
edd��Zedd��Zededd��Zedd��Zedfdd��Zedd��Zedgdd��Zed d!��Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zdhdd�d0d1�Zd2d3�Zdid4d5�Zd6d7�Zdjd:d;�Z d<d=�Z!d>d?�Z"ed@dA��Z#dBdC�Z$dDdE�Z%dFdG�Z&dHdI�Z'dJdK�Z(dLdM�Z)dNdO�Z*dPdQ�Z+dkdSdT�Z,dUdV�Z-e-Z.dWdX�Z/dYdZ�Z0dld\d]�Z1d^d_�Z2d`da�Z3dbdc�Z4dS)mr.z�datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])

    The year, month and day arguments are required. tzinfo may be None, or an
    instance of a tzinfo subclass. The remaining arguments may be ints.
    Nrr<c	Cst|ttf�r�t|�dkr�dt|dd��d@kr>dkr�nnVt|t�rxzt|d�}Wntk
rvtd��YnXt�|�}
|
�	||�d	|
_
|
St|||�\}}}t|||||	�\}}}}}	t
|�t�|�}
||
_||
_||
_||
_||
_||
_||
_||
_d	|
_
|	|
_|
S)
Nrhrrr#r=r"r�zrFailed to encode latin1 string when unpickling a datetime object. pickle.load(data, encoding='latin1') is assumed.r)r}r�r~rXr�r�r>r^r��_datetime__setstater�r�r�r�r�r�r�r6r7r8r9r:r;)r�rrrr�r�r�rRr�r�r�rrrr�sL��

�

�
zdatetime.__new__cCs|jSr?r@r�rrrr�Csz
datetime.hourcCs|jSrArBr�rrrr�Hszdatetime.minutecCs|jSrCrDr�rrrr�Mszdatetime.secondcCs|jSrErFr�rrrrRRszdatetime.microsecondcCs|jSrGrHr�rrrr�Wszdatetime.tzinfocCs|jSr�rIr�rrrr�\sz
datetime.foldc	Cspt�|�\}}t|d�}|dkr4|d7}|d8}n|dkrL|d8}|d7}|rVtjntj}||�\	}}}	}
}}}
}}t|d�}||||	|
||||�}|dk�rbd}||kr�tj�	d�r�|S|||�dd	�\}}}	}
}}||||	|
||||�}||t
d|�}|jdk�rl|||t
dd��dd	�\}}}	}
}}||||	|
||||�}||k�rld|_n
|�
|�}|S)
��Construct a datetime from a POSIX timestamp (like time.time()).

        A timezone info object may be passed in as well.
        r�r�rrr�Nr��winr,)r�r�r�r.�gmtimer��min�sys�platform�
startswithrKrJr;r0)r�r�r{r�Zfracr@Z	converterrr0r1r2r3r4r�r�r��result�max_fold_secondsZprobe1ZtransZprobe2rrr�_fromtimestamp`s4


 *

zdatetime._fromtimestampcCst|�|�||dk	|�S)roN)r�rx)r�r�r�rrrr��szdatetime.fromtimestampcCs|�|dd�S)z6Construct a naive UTC datetime from a POSIX timestamp.TN)rxr�rrr�utcfromtimestamp�szdatetime.utcfromtimestampcCst��}|�||�S)zBConstruct a datetime from time.time() and optional time zone info.r�)r�r�r�rrr�now�szdatetime.nowcCst��}|�|�S)z*Construct a UTC datetime from time.time().)r.r�ryr�rrr�utcnow�szdatetime.utcnowTcCs\t|t�std��t|t�s$td��|dkr2|j}||j|j|j|j|j	|j
|j||jd�	S)z8Construct a datetime from a given date and a given time.z%date argument must be a date instancez%time argument must be a time instanceTr<)
r}�_date_classr�_time_classr�rrrr�r�r�rRr�)r�r�r�r�rrr�combine�s

�zdatetime.combinecCs�t|t�std��|dd�}|dd�}zt|�}Wn"tk
rXtd|����YnX|r�zt|�}Wq�tk
r�td|����Yq�Xndddddg}|||�S)z=Construct a datetime from the output of datetime.isoformat().rrrh�Nr)r}r~rrjr>r|)r�rZdstrrnZdate_componentsZtime_componentsrrrr�s
zdatetime.fromisoformatcCsD|��}|dkrd}n|r d}nd}t|j|j|j|j|j|j|�S)rNrrr)r�r5rrrr�r�r�)r�r�rrrr_�s�zdatetime.timetuplec
s�tddd��d}|�tdd�}�fdd�}||�|}||}||�}||kr�|||f|j}||�|}||kr�|Sn||}||}||�}	|	|kr�|S||kr�|Sttf|j||�S)zReturn integer POSIX timestamp.�rr�rcs>t�|�dd�\}}}}}}t||||||��tdd�S)Nr,rr)r.r�r.rK)rerr0r1r2r3r4�Zepochrr�local�szdatetime._mktime.<locals>.local)r.rKr��maxrr)
r�rwr�r�r�Zu1�t1Zu2r��t2rr�r�_mktime�s(zdatetime._mktimecCs0|jdkr |��}||jdS|t��SdS)zReturn POSIX timestamp as floatNr�)r:r�rR�_EPOCHr�rYrrr�	timestamp�s
zdatetime.timestampcCsT|��}|r||8}|j|j|j}}}|j|j|j}}}t||||||d�S)z4Return UTC time tuple compatible with time.gmtime().r)rTrrrr�r�r�r5)r�rbrr0r1r2r3r4rrr�utctimetupleszdatetime.utctimetuplecCst|j|j|j�S)zReturn the date part.)r�r�r�r�r�rrrr�sz
datetime.datecCst|j|j|j|j|jd�S)z'Return the time part, with tzinfo None.r<)r�r�r�r�rRr�r�rrrr�sz
datetime.timecCs t|j|j|j|j|j|jd�S)z'Return the time part, with same tzinfo.r<)r�r�r�r�rRr:r�r�rrr�timetzs�zdatetime.timetzc	
Cs�|dkr|j}|dkr|j}|dkr*|j}|dkr8|j}|dkrF|j}|dkrT|j}|dkrb|j}|dkrp|j}|	dkr~|j}	t	|�|||||||||	d�	S)z?Return a new datetime with new values for the specified fields.NTr<)
rrrr�r�r�rRr�r�r�)
r�rrrr�r�r�rRr�r�rrrr[s.�zdatetime.replacecCs\|jdkr|��}n|ttdd�}t�|�}t|dd��}|j}|j}t	t|d�|�S)Nrr�r,)
r�r�r�rKr.r�r.�	tm_gmtoff�tm_zonerz)r�ZtsZlocaltmr�ZgmtoffZzonerrr�_local_timezone4s


zdatetime._local_timezonecCs�|dkr|��}nt|t�s$td��|j}|dkrF|��}|�|�}n,|�|�}|dkrr|jdd���}|�|�}||kr~|S||j|d�}|�|�S)Nz)tz argument must be an instance of tzinfo�r�)r�r}r�rrTr[r0)r�r�rMZmyoffsetr{rrr�
astimezone@s 



zdatetime.astimezonecCs:|��dpd}dt|t|j|j|j|j|j|jfS)rr-z%s %s %2d %02d:%02d:%02d %04d)	rr
rr�r�r6r7r8r�rrrrr[s�zdatetime.ctime�Tr6cCsNd|j|j|j|ft|j|j|j|j|�}|��}t	|�}|rJ||7}|S)a�Return the time formatted according to ISO.

        The full format looks like 'YYYY-MM-DD HH:MM:SS.mmmmmm'.
        By default, the fractional part is omitted if self.microsecond == 0.

        If self.tzinfo is not None, the UTC offset is also attached, giving
        giving a full format of 'YYYY-MM-DD HH:MM:SS.mmmmmm+HH:MM'.

        Optional argument sep specifies the separator between date and
        time, default 'T'.

        The optional argument timespec specifies the number of additional
        terms of the time to include. Valid options are 'auto', 'hours',
        'minutes', 'seconds', 'milliseconds' and 'microseconds'.
        z%04d-%02d-%02d%c)
r�r�r�rCr6r7r8r9rTrO)r��seprArMrLr�rrrres��zdatetime.isoformatcCs�|j|j|j|j|j|j|jg}|ddkr2|d=|ddkrD|d=d|jj|jj	d�
tt|��f}|j
dk	r�|dd�d|j
d}|jr�|dd�d}|S)	rUrrr�r�NrVrWrX)r�r�r�r6r7r8r9r�r�r�r\�mapr~r:r;)r��LrMrrrr��s&��
zdatetime.__repr__cCs|jdd�S)zConvert to string, for str().� )r�)rr�rrrr��szdatetime.__str__cCsddl}|�|||�S)zKstring, format -> new datetime parsed from a string (like time.strptime()).rN)�	_strptimeZ_strptime_datetime)r�rr?r�rrr�strptime�szdatetime.strptimecCs(|jdkrdS|j�|�}td|�|S)z\Return the timezone offset as timedelta positive east of UTC (negative west of
        UTC).NrTrZr[rrrrT�s


zdatetime.utcoffsetcCs&|jdkrdS|j�|�}t|�|Sr\r]r^rrrrV�s

zdatetime.tznamecCs(|jdkrdS|j�|�}td|�|Sr_r`r[rrrr��s
	

zdatetime.dstcCs2t|t�r|j|dd�dkSt|t�s*tSdSdS)NTrJrF)r}r.r	r�r�r�rrrr��s


zdatetime.__eq__cCs4t|t�r|�|�dkSt|t�s&tSt||�dSr��r}r.r	r�r�r�r�rrrr��s


zdatetime.__le__cCs4t|t�r|�|�dkSt|t�s&tSt||�dSr�r�r�rrrr��s


zdatetime.__lt__cCs4t|t�r|�|�dkSt|t�s&tSt||�dSr�r�r�rrrr��s


zdatetime.__ge__cCs4t|t�r|�|�dkSt|t�s&tSt||�dSr�r�r�rrrr��s


zdatetime.__gt__Fc		Cs�|j}|j}d}}||kr"d}nT|��}|��}|rn||j|jd���krRdS||j|jd���krndS||k}|r�t|j|j|j|j|j	|j
|jf|j|j|j|j|j	|j
|jf�S|dks�|dkr�|r�dStd��||}|j
dkr�dS|r�dp�dS)NTr<rz(cannot compare naive and aware datetimesrrr)r:rTr[r�r	r�r�r�r6r7r8r9rrJ)	r�r�rKrMrNrOrPrQZdiffrrrr	�sF���
z
datetime._cmpc
Cs�t|t�stSt|��|j|j|j|jd�}||7}t|j	d�\}}t|d�\}}d|j
krhtkr�nn*t|��
t�|j
�t||||j|jd��Std��dS)zAdd a datetime and a timedelta.rwr�r�rr�rN)r}rKr�rr6r7r8r9r&r9rJrr�r~r�rr�r;r:r�)r�r�r/r�Zremr�r�rrrr�s&
���zdatetime.__add__c	Cs�t|t�s"t|t�r||StS|��}|��}|j|jd|jd}|j|jd|jd}t|||||j|j�}|j	|j	kr�|S|�
�}|�
�}||kr�|S|dks�|dkr�td��|||S)z6Subtract two datetimes, or a datetime and a timedelta.r�r�Nz(cannot mix naive and timezone-aware time)r}r.rKr�rr8r7r6r9r:rTr)	r�r�rrZsecs1Zsecs2�baserOrPrrrr�&s*



�zdatetime.__sub__cCs�|jdkr�|jr|jdd�}n|}|��}|dkrFt|��d�|_nDt|j|j|j	�}|j
d|jd|j}tt
|||j�|�|_|jS)Nrrr<r�r�)r�r�r[rTr�r�rrrrr�r�r�rKrR)r�r�rSrJr9rrrr�>s
zdatetime.__hash__r#c	Cs�t|jd�\}}t|jd�\}}t|d�\}}|j}|jrJ|dkrJ|d7}t||||j|j|j|j	|||g
�}|j
dkr~|fS||j
fSdSra)r&r�r9r�r;r�r�r6r7r8r:)	r�rcr%r&rdrerfr0rgrrrr�Os"�
zdatetime._getstatec	
Cs�|dk	rt|t�std��|\
}}}|_|_|_|_}}}|dkrTd|_|d|_nd|_||_|d||_	|d>|Bd>|B|_
||_dS)Nrhr=rrbrr$rg)r}rirr�r6r7r8r;r�r�r9r:)	r�r'r�r%r&r0rfrdrerrrr(^s"�zdatetime.__setstatecCs|j|�|�fSr�r�rjrrrrkmszdatetime.__reduce_ex__cCs
|�d�Srlrmr�rrrr�pszdatetime.__reduce__)NNrrrrN)N)N)T)NNNNNNNT)N)r�r6)F)r#)5r�r�r�r�r�r�r�r�r�r�r�r�rRr�r�r)rxr�ryrzr{r~rr_r�r�r�r�r[r�r�rrr�r�r�rTrVr�r�r�r�r�r�r	r�r�r�r�r�rnrkr�rrrrr.s���$






+	



#	��



	

%
r.cCs8d}t|dd�}|dd}||}||kr4|d7}|S)Nr#rr,r-)r)rZTHURSDAYZfirstdayZfirstweekdayr!rrrrysrc@s�eZdZdZe�Zefdd�Zeddd��Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Zdd�Zdd�Zeddd�ZeZedd��ZdS)rz)�_offset�_namecCslt|t�std��||jkr,|s&|jSd}nt|t�s>td��|j|krV|jks`ntd��|�	||�S)Nzoffset must be a timedeltazname must be a stringzYoffset must be a timedelta strictly between -timedelta(hours=24) and timedelta(hours=24).)
r}rKr�_Omittedr{r~�
_minoffset�
_maxoffsetr>�_create)r�rbr�rrrr��s


ztimezone.__new__NcCst�|�}||_||_|Sr�)r�r�r�r�)r�rbr�r�rrrr��s
ztimezone._createcCs|jdkr|jfS|j|jfS)zpickle supportN)r�r�r�rrrr1�s
ztimezone.__getinitargs__cCst|t�r|j|jkStSr�)r}rzr�r�r�rrrr��s
ztimezone.__eq__cCs
t|j�Sr�)r�r�r�rrrr��sztimezone.__hash__cCsL||jkrdS|jdkr0d|jj|jj|jfSd|jj|jj|j|jfS)aConvert to formal string, for repr().

        >>> tz = timezone.utc
        >>> repr(tz)
        'datetime.timezone.utc'
        >>> tz = timezone(timedelta(hours=-5), 'EST')
        >>> repr(tz)
        "datetime.timezone(datetime.timedelta(-1, 68400), 'EST')"
        zdatetime.timezone.utcNz	%s.%s(%r)z
%s.%s(%r, %r))r{r�r�r�r�r�r�rrrr��s


��ztimezone.__repr__cCs
|�d�Sr�)rVr�rrrr��sztimezone.__str__cCs$t|t�s|dkr|jStd��dS)Nz8utcoffset() argument must be a datetime instance or None)r}r.r�rr,rrrrT�sztimezone.utcoffsetcCs:t|t�s|dkr.|jdkr(|�|j�S|jStd��dS)Nz5tzname() argument must be a datetime instance or None)r}r.r��_name_from_offsetr�rr,rrrrV�s

ztimezone.tznamecCs"t|t�s|dkrdStd��dS)Nz2dst() argument must be a datetime instance or None)r}r.rr,rrrr��sztimezone.dstcCs2t|t�r&|j|k	rtd��||jStd��dS)Nzfromutc: dt.tzinfo is not selfz6fromutc() argument must be a datetime instance or None)r}r.r�r>r�rr,rrrr0�s



ztimezone.fromutcr$r)r7r;c
Cs�|sdS|td�kr d}|}nd}t|tdd��\}}t|tdd��\}}|j}|j}|r�d|�|d�d	|d�d	|d�d
|d��	S|r�d|�|d�d	|d�d	|d��Sd|�|d�d	|d��S)NZUTCrrErFrrGrHZ02drkrlZ06d)rKr&r9r;)r/rNr7rdr8r9r;rrrr��s( ztimezone._name_from_offset)N)r�r�r�r�r^r�r�r)r�r1r�r�r�r�rTrVr�r0rKr�r��staticmethodr�rrrrrz�s$	rzrRr�r�)�*)r�)r6):r�r�r.Zmathr�rsr	r�r�rrrZdbmrrWrrrrrr'r(r)r+rr
r5rCrOrfrjrsr|r�r�r�r�r�r�r�r�rKrrr�Z
resolutionr�r|r�rir}r.rrzr�r{r�Z	_datetime�ImportErrorrrrr�<module>s�

	?�
@') 
=

�[DXatG
zipapp.cpython-38.opt-1.pyc000064400000013340150335716500011444 0ustar00U

e5do�@s�ddlZddlZddlZddlZddlZddlZddlZdddgZdZej	�
d�rXdZne��ZGdd�de
�Zejd	d
��Zdd�Zdd
d�Zddd�Zdd�Zddd�Zedkr�e�dS)�N�ZipAppError�create_archive�get_interpreterz8# -*- coding: utf-8 -*-
import {module}
{module}.{fn}()
�win�utf-8c@seZdZdS)rN)�__name__�
__module__�__qualname__�r
r
�/usr/lib64/python3.8/zipapp.pyr!sc	cs8t|ttjf�r.t||��}|VW5QRXn|VdS�N)�
isinstance�str�os�PathLike�open)�archive�mode�fr
r
r�_maybe_open%srcCs$|r d|�t�d}|�|�dS)zWrite a shebang line.�#!�
N)�encode�shebang_encoding�write)r�interpreterZshebangr
r
r�_write_file_prefix.src
Cs�t|d��Z}|�d�}|dkr*d}|��t|d��&}t||�|�|�t�||�W5QRXW5QRX|r�t|t�r�t	�
|t	�|�jtj
B�dS)z8Copy an application archive, modifying the shebang line.�rb�r��wbN)r�read�readlinerr�shutilZcopyfileobjr
rr�chmod�stat�st_mode�S_IEXEC)rZnew_archiver�srcZfirst_2Zdstr
r
r�
_copy_archive5s


 r)Fc
Cs�d}t|d�rt|d�rd}nt�|�}|��r4d}|rHt|||�dS|��sXtd��|d��}|rt|rttd��|s�|s�td	��d}|r�|�d
�\}	}
}tdd�|	�	d
�D��}tdd�|�	d
�D��}
|
d
kr�|r�|
s�td|��t
j|	|d�}|dk�r|�d�}nt|d��s"t�|�}t
|d���}t||�|�rDtjntj}tj|d|d��^}|�d�D]4}|�|�}|dk�s�||��rf|�||����qf|�r�|�d|�d��W5QRXW5QRX|�r�t|d��s�|�|��jtjB�dS)abCreate an application archive from SOURCE.

    The SOURCE can be the name of a directory, or a filename or a file-like
    object referring to an existing archive.

    The content of SOURCE is packed into an application archive in TARGET,
    which can be a filename or a file-like object.  If SOURCE is a directory,
    TARGET can be omitted and will default to the name of SOURCE with .pyz
    appended.

    The created application archive will have a shebang line specifying
    that it should run with INTERPRETER (there will be no shebang line if
    INTERPRETER is None), and a __main__.py which runs MAIN (if MAIN is
    not specified, an existing __main__.py will be used).  It is an error
    to specify MAIN for anything other than a directory source with no
    __main__.py, and it is an error to omit MAIN if the directory has no
    __main__.py.
    Fr!r"TNzSource does not existz__main__.pyz8Cannot specify entry point if the source has __main__.pyzArchive has no entry point�:css|]}|��VqdSr��isidentifier��.0�partr
r
r�	<genexpr>{sz!create_archive.<locals>.<genexpr>�.css|]}|��VqdSrr+r-r
r
rr0|szInvalid entry point: )�module�fnz.pyzrr �w)�compression�*r)�hasattr�pathlib�Path�is_filer)�existsr�	partition�all�split�
MAIN_TEMPLATE�formatZwith_suffixrr�zipfileZZIP_DEFLATEDZ
ZIP_STOREDZZipFileZrglob�relative_torZas_posixZwritestrrr$r%r&r')�source�targetr�main�filter�
compressedZsource_is_fileZhas_mainZmain_py�mod�sepr3Zmod_okZfn_ok�fdr5�zZchildZarcnamer
r
rrLsX
�


�
&c
CsFt|d��2}|�d�dkr8|�����t�W5QR�SW5QRXdS)Nrrr)rr!r"�strip�decoder)rrr
r
rr�scCs<ddl}|��}|jddddd�|jdddd	d�|jd
dddd�|jd
dddd�|jddddd�|jddd�|�|�}|jr�tj�|j�s�t	d��t
|j�}td�|p�d��t
�d�tj�|j��r|jdk�stj�|j��rtj�|j|j��rt	d��|j�rt	d��t|j|j|j|j|jd�dS)z�Run the zipapp command line interface.

    The ARGS parameter lets you specify the argument list directly.
    Omitting ARGS (or setting it to None) works as for argparse, using
    sys.argv[1:] as the argument list.
    rNz--outputz-ozAThe name of the output archive. Required if SOURCE is an archive.)�default�helpz--pythonz-pzEThe name of the Python interpreter to use (default: no shebang line).z--mainz-mzLThe main function of the application (default: use an existing __main__.py).z
--compressz-c�
store_truezQCompress files with the deflate method. Files are stored uncompressed by default.)�actionrOz--infoFz)Display the interpreter from the archive.)rNrQrOrCz'Source directory (or existing archive).)rOz%Can only get info for an archive filezInterpreter: {}z<none>z-In-place editing of archives is not supportedz,Cannot change the main function when copying)rrErG)�argparse�ArgumentParser�add_argument�
parse_args�infor�path�isfilerC�
SystemExitr�printr@�sys�exit�outputr;�samefilerEr�python�compress)�argsrR�parserrr
r
rrE�sN
�
�
�
�
��


�
�rE�__main__)N)NNNNF)N)�
contextlibrr8r#r%r[rA�__all__r?�platform�
startswithr�getfilesystemencoding�
ValueErrorr�contextmanagerrrr)rrrErr
r
r
r�<module>s0



�
J
1plistlib.cpython-38.pyc000064400000065037150335716500011036 0ustar00U

e5d�}�
@s>dZddddddddd	d
ddd
g
ZddlZddlZddlZddlZddlZddlmZddl	Z	ddl
Z
ddlZddlZddl
mZddlmZejdded�Ze��ej�ejdd��Zdd�Zdd�Zdd�Zdd�ZGdd�d�ZGdd
�d
�ZdZe� d�Z!dLd!d"�Z"d#d$�Z#e� d%ej$�Z%d&d'�Z&d(d)�Z'd*d+�Z(Gd,d-�d-�Z)Gd.d/�d/�Z*Gd0d1�d1e*�Z+d2d3�Z,Gd4d�de-�Z.d5d6d7d8d9�Z/e0�Z1Gd:d;�d;�Z2d<d=�Z3e4e5e6eje7fZ8Gd>d?�d?e0�Z9d@dA�Z:e;e<e,e)e+dB�e=e<e:e2e9dB�iZ>ddCe<dD�dEd	�Z?ddCe<dD�dFd�Z@e;dCdGdH�dId
�ZAe;dGdCdJ�dKd�ZBdS)Ma�plistlib.py -- a tool to generate and parse MacOSX .plist files.

The property list (.plist) file format is a simple XML pickle supporting
basic object types, like dictionaries, lists, numbers and strings.
Usually the top level object is a dictionary.

To write out a plist file, use the dump(value, file)
function. 'value' is the top level object, 'file' is
a (writable) file object.

To parse a plist from a file, use the load(file) function,
with a (readable) file object as the only argument. It
returns the top level object (again, usually a dictionary).

To work with plist data in bytes objects, you can use loads()
and dumps().

Values can be strings, integers, floats, booleans, tuples, lists,
dictionaries (but only with string keys), Data, bytes, bytearray, or
datetime.datetime objects.

Generate Plist example:

    pl = dict(
        aString = "Doodah",
        aList = ["A", "B", 12, 32.1, [1, 2, 3]],
        aFloat = 0.1,
        anInt = 728,
        aDict = dict(
            anotherString = "<hello & hi there!>",
            aUnicodeValue = "M\xe4ssig, Ma\xdf",
            aTrueValue = True,
            aFalseValue = False,
        ),
        someData = b"<binary gunk>",
        someMoreData = b"<lots of binary gunk>" * 10,
        aDate = datetime.datetime.fromtimestamp(time.mktime(time.gmtime())),
    )
    with open(fileName, 'wb') as fp:
        dump(pl, fp)

Parse Plist example:

    with open(fileName, 'rb') as fp:
        pl = load(fp)
    print(pl["aKey"])
�	readPlist�
writePlist�readPlistFromBytes�writePlistToBytes�Data�InvalidFileException�FMT_XML�
FMT_BINARY�load�dump�loads�dumps�UID�N)�BytesIO)�warn)�ParserCreate�PlistFormatzFMT_XML FMT_BINARY)�modulec	cs2t|t�r(t||��}|VW5QRXn|VdS�N)�
isinstance�str�open)�
pathOrFile�mode�fp�r� /usr/lib64/python3.8/plistlib.py�_maybe_openOs
rc
Cs<tdtd�t|d��}t|ddd�W5QR�SQRXdS)z�
    Read a .plist from a path or file. pathOrFile should either
    be a file name, or a readable binary file object.

    This function is deprecated, use load instead.
    z8The readPlist function is deprecated, use load() instead��rbNF��fmt�use_builtin_types)r�DeprecationWarningrr	)rrrrrrYs�c	Cs8tdtd�t|d��}t||tddd�W5QRXdS)z�
    Write 'value' to a .plist file. 'pathOrFile' may either be a
    file name or a (writable) file object.

    This function is deprecated, use dump instead.
    z9The writePlist function is deprecated, use dump() insteadr�wbTF�r!�	sort_keys�skipkeysN)rr#rr
r)�valuerrrrrrfs�cCstdtd�tt|�ddd�S)z}
    Read a plist data from a bytes object. Return the root object.

    This function is deprecated, use loads instead.
    zBThe readPlistFromBytes function is deprecated, use loads() insteadrNFr )rr#r	r��datarrrrss
�cCs,tdtd�t�}t||tddd�|��S)zp
    Return 'value' as a plist-formatted bytes object.

    This function is deprecated, use dumps instead.
    zAThe writePlistToBytes function is deprecated, use dumps() insteadrTFr%)rr#rr
r�getvalue)r(�frrrr~s�c@s>eZdZdZdd�Zedd��Zddd�Zd	d
�Zdd�Z	d
S)rz]
    Wrapper for binary data.

    This class is deprecated, use a bytes object instead.
    cCst|t�std��||_dS)Nzdata must be as bytes)r�bytes�	TypeErrorr*��selfr*rrr�__init__�s
z
Data.__init__cCs|t|��Sr)�_decode_base64)�clsr*rrr�
fromBase64�szData.fromBase64�LcCst|j|�Sr)�_encode_base64r*)r0�
maxlinelengthrrr�asBase64�sz
Data.asBase64cCs4t||j�r|j|jkSt|t�r,|j|kStSdSr)r�	__class__r*r-�NotImplemented�r0�otherrrr�__eq__�s


zData.__eq__cCsd|jjt|j�fS�Nz%s(%s)�r9�__name__�reprr*�r0rrr�__repr__�sz
Data.__repr__N)r5)
r@�
__module__�__qualname__�__doc__r1�classmethodr4r8r=rCrrrrr�s

c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)r
cCs<t|t�std��|dkr"td��|dkr2td��||_dS)Nzdata must be an int�zUIDs cannot be >= 2**64r�UIDs must be positive)r�intr.�
ValueErrorr*r/rrrr1�s
zUID.__init__cCs|jSrr)rBrrr�	__index__�sz
UID.__index__cCsd|jjt|j�fSr>r?rBrrrrC�szUID.__repr__cCs|j|jffSr)r9r*rBrrr�
__reduce__�szUID.__reduce__cCst|t�stS|j|jkSr)rr
r:r*r;rrrr=�s
z
UID.__eq__cCs
t|j�Sr)�hashr*rBrrr�__hash__�szUID.__hash__N)	r@rDrEr1rLrCrMr=rOrrrrr
�s	s�<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
zv[\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]r5cCsP|dd}g}tdt|�|�D]$}||||�}|�t�|��q d�|�S)N��r�)�range�len�append�binasciiZ
b2a_base64�join)�sr7Z
maxbinsize�pieces�i�chunkrrrr6�sr6cCs(t|t�rt�|�d��St�|�SdS)N�utf-8)rrrVZ
a2b_base64�encode)rXrrrr2�s
r2z{(?P<year>\d\d\d\d)(?:-(?P<month>\d\d)(?:-(?P<day>\d\d)(?:T(?P<hour>\d\d)(?::(?P<minute>\d\d)(?::(?P<second>\d\d))?)?)?)?)?ZcCsLd}t�|���}g}|D]&}||}|dkr2qB|�t|��qtj|�S)N�ZyearZmonthZdayZhourZminute�second)�_dateParser�match�	groupdictrUrJ�datetime)rX�orderZgdZlst�key�valrrr�_date_from_string�srgcCs d|j|j|j|j|j|jfS)Nz%04d-%02d-%02dT%02d:%02d:%02dZr^)�drrr�_date_to_strings�ricCsZt�|�}|dk	rtd��|�dd�}|�dd�}|�dd�}|�dd�}|�d	d
�}|S)Nz<strings can't contains control characters; use bytes insteadz
�
�
�&z&amp;�<z&lt;�>z&gt;)�_controlCharPat�searchrK�replace)�text�mrrr�_escapes
rtc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)S)*�_PlistParsercCs"g|_d|_d|_||_||_dSr)�stack�current_key�root�_use_builtin_types�
_dict_type�r0r"�	dict_typerrrr1s
z_PlistParser.__init__cCsBt�|_|j|j_|j|j_|j|j_|j|j_	|j�
|�|jSr)r�parser�handle_begin_elementZStartElementHandler�handle_end_elementZEndElementHandler�handle_dataZCharacterDataHandler�handle_entity_declZEntityDeclHandlerZ	ParseFilerx)r0Zfileobjrrr�parses



z_PlistParser.parsecCstd��dS)Nz8XML entity declarations are not supported in plist files)r)r0Zentity_nameZis_parameter_entityr(�baseZ	system_idZ	public_idZ
notation_namerrrr�$sz_PlistParser.handle_entity_declcCs*g|_t|d|d�}|dk	r&||�dS)NZbegin_)r*�getattr)r0�element�attrs�handlerrrrr~*sz!_PlistParser.handle_begin_elementcCs"t|d|d�}|dk	r|�dS)NZend_)r�)r0r�r�rrrr0sz_PlistParser.handle_end_elementcCs|j�|�dSr)r*rUr/rrrr�5sz_PlistParser.handle_datacCs�|jdk	rFt|jdti��s.td|jj��||jd|j<d|_nB|jsT||_n4t|jdtg��sxtd|jj��|jd�|�dS)N���zunexpected element at line %d)	rwrrv�typerKr}�CurrentLineNumberrxrU�r0r(rrr�
add_object8s
��z_PlistParser.add_objectcCsd�|j�}g|_|S)N�)rWr*r/rrr�get_dataHsz_PlistParser.get_datacCs"|��}|�|�|j�|�dSr)rzr�rvrU)r0r�rhrrr�
begin_dictOs
z_PlistParser.begin_dictcCs*|jrtd|j|jjf��|j��dS)Nz%missing value for key '%s' at line %d)rwrKr}r�rv�poprBrrr�end_dictTs
�z_PlistParser.end_dictcCs8|jst|jdti��s*td|jj��|��|_dS)Nr�zunexpected key at line %d)rwrrvr�rKr}r�r�rBrrr�end_keyZs
�z_PlistParser.end_keycCsg}|�|�|j�|�dSr)r�rvrU)r0r��arrr�begin_array`s
z_PlistParser.begin_arraycCs|j��dSr)rvr�rBrrr�	end_arrayesz_PlistParser.end_arraycCs|�d�dS)NT�r�rBrrr�end_truehsz_PlistParser.end_truecCs|�d�dS)NFr�rBrrr�	end_falseksz_PlistParser.end_falsecCs@|��}|�d�s|�d�r.|�t|d��n|�t|��dS)NZ0xZ0X�)r��
startswithr�rJ)r0�rawrrr�end_integernsz_PlistParser.end_integercCs|�t|����dSr)r��floatr�rBrrr�end_realusz_PlistParser.end_realcCs|�|���dSr)r�r�rBrrr�
end_stringxsz_PlistParser.end_stringcCs2|jr|�t|����n|�t�|����dSr)ryr�r2r�rr4rBrrr�end_data{sz_PlistParser.end_datacCs|�t|����dSr)r�rgr�rBrrr�end_date�sz_PlistParser.end_dateN)r@rDrEr1r�r�r~rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrus(	ruc@s8eZdZddd�Zdd�Zdd�Zdd
d�Zdd
�Zd	S)�_DumbXMLWriterr�	cCs||_g|_||_||_dSr)�filerv�
_indent_level�indent)r0r��indent_levelr�rrrr1�sz_DumbXMLWriter.__init__cCs,|j�|�|�d|�|jd7_dS)Nz<%s>�)rvrU�writelnr��r0r�rrr�
begin_element�sz_DumbXMLWriter.begin_elementcCs@|jdkst�|j��|ks t�|jd8_|�d|�dS)Nrr�z</%s>)r��AssertionErrorrvr�r�r�rrr�end_element�sz_DumbXMLWriter.end_elementNcCs8|dk	r&t|�}|�d|||f�n|�d|�dS)Nz<%s>%s</%s>z<%s/>)rtr�)r0r�r(rrr�simple_element�sz_DumbXMLWriter.simple_elementcCsH|r8t|t�r|�d�}|j�|j|j�|j�|�|j�d�dS)Nr\�
)rrr]r��writer�r�)r0�linerrrr��s

z_DumbXMLWriter.writeln)rr�)N)r@rDrEr1r�r�r�r�rrrrr��s


r�c@sFeZdZddd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Z	dS)�_PlistWriterr�	r�TFcCs.|r|�t�t�||||�||_||_dSr)r��PLISTHEADERr�r1�
_sort_keys�	_skipkeys)r0r�r�r�ZwriteHeaderr&r'rrrr1�s

z_PlistWriter.__init__cCs"|�d�|�|�|�d�dS)Nz<plist version="1.0">z</plist>)r��write_valuer�rrrr��s

z_PlistWriter.writecCs4t|t�r|�d|��n|dkr0|�d��n|dkrD|�d�n�t|t�r�d|krbdkrxnn|�dd	|�nt|��n�t|t�r�|�d
t|��n�t|t�r�|�|�n|t|t	�r�|�
|�nft|ttf�r�|�
|�nLt|tj��r|�dt|��n,t|ttf��r |�|�ntdt|���dS)
N�stringT�trueFZfalsel����rHZintegerz%d�real�datezunsupported type: %s)rrr�rJ�
OverflowErrorr�rA�dict�
write_dictr�
write_datar-�	bytearray�write_bytesrcri�tuple�list�write_arrayr.r�r�rrrr��s.





z_PlistWriter.write_valuecCs|�|j�dSr)r�r*r/rrrr��sz_PlistWriter.write_datacCsz|�d�|jd8_tddt|j�dd�|j��}t||��d�D]}|rJ|�|�qJ|jd7_|�	d�dS)Nr*r�r�r5r�s        r�)
r�r��maxrTr�rqr6�splitr�r�)r0r*r7r�rrrr��s
�z_PlistWriter.write_bytescCs�|rt|�d�|jr"t|���}n|��}|D]8\}}t|t�sP|jrHq.td��|�d|�|�	|�q.|�
d�n
|�d�dS)Nr��keys must be stringsre)r�r��sorted�itemsrrr�r.r�r�r�)r0rhr�rer(rrrr��s

z_PlistWriter.write_dictcCs<|r.|�d�|D]}|�|�q|�d�n
|�d�dS)N�array)r�r�r�r�)r0r�r(rrrr�s
z_PlistWriter.write_arrayN)rr�r�TF)
r@rDrEr1r�r�r�r�r�r�rrrrr��s�

%
r�cCs�d}|D]}|�|�rdSqtjdftjdftjdffD]N\}}|�|�sNq:|D]4}||�d��|�}|dt|��|krRdSqRq:dS)N)s<?xmls<plistTr\z	utf-16-bez	utf-16-le�asciiF)r��codecs�BOM_UTF8�BOM_UTF16_BE�BOM_UTF16_LE�decoder]rT)�header�prefixesZpfxZbom�encoding�start�prefixrrr�_is_fmt_xmls
�
r�c@seZdZddd�ZdS)r�Invalid filecCst�||�dSr)rKr1)r0�messagerrrr12szInvalidFileException.__init__N)r�)r@rDrEr1rrrrr1s�B�H�L�Q)r�rrP�c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�_BinaryPlistParsera
    Read or write a binary plist file, following the description of the binary
    format.  Raise InvalidFileException in case of error, otherwise return the
    root object.

    see also: http://opensource.apple.com/source/CF/CF-744.18/CFBinaryPList.c
    cCs||_||_dSr)ryrzr{rrrr1Asz_BinaryPlistParser.__init__cCs�z~||_|j�dtj�|j�d�}t|�dkr6t��t�d|�\}|_	}}}|j�|�|�
||�|_tg||_
|�|�WStttjttfk
r�t��YnXdS)Ni��� z>6xBBQQQ)�_fp�seek�os�SEEK_END�readrTr�struct�unpack�	_ref_size�
_read_ints�_object_offsets�
_undefined�_objects�_read_object�OSError�
IndexError�errorr�rK)r0r�trailer�offset_size�num_objects�
top_object�offset_table_offsetrrrr�Es*
��z_BinaryPlistParser.parsecCsL|dkrH|j�d�dd@}d|>}dt|}t�||j�|��dS|S)z$ return the size of the next object.�r�rrQrn)r�r��_BINARY_FORMATr�r�)r0�tokenLrsrXr,rrr�	_get_size^sz_BinaryPlistParser._get_sizecst|j��|���tkr2t�d|�t�����S�rFt���|krLt��t��fdd�td�|��D��SdS)Nrnc3s&|]}t��||��d�VqdS)�bigN)rJ�
from_bytes)�.0rZ�r*�sizerr�	<genexpr>os�z0_BinaryPlistParser._read_ints.<locals>.<genexpr>r)	r�r�r�r�r�rTrr�rS)r0�nr�rr�rr�hs�z_BinaryPlistParser._read_intscCs|�||j�Sr)r�r�)r0r�rrr�
_read_refsrsz_BinaryPlistParser._read_refscs�j|}|tk	r|S�j|}�j�|��j�d�d}|d@|d@}}|dkr^d}�n�|dkrnd}�n�|dkr~d	}�n�|dkr�d
}�n�|dkr�tj�j�d|>�d|d
kd�}�nT|dkr�t�	d�j�d��d}�n0|dk�rt�	d�j�d��d}�n
|dk�rDt�	d�j�d��d}t
�
ddd�t
j|d�}�n�|dk�r���|�}�j�|�}t
|�|k�rxt���j�st|�}�n�|dk�rΈ�|�}�j�|�}	t
|	�|k�r�t��|	�d�}�n@|dk�r��|�d}�j�|�}	t
|	�|k�rt��|	�d�}n�|dk�r:tt��j�d|�d��}n�|dk�r���|�}��|�}
g}|�j|<|��fdd �|
D��n�|d!k�r��|�}��|�}��|�}
���}|�j|<z.t||
�D]\}}
��|
�|��|�<�q�Wntk
�rt��YnXnt��|�j|<|S)"zx
        read the object by reference.

        May recursively read sub-objects (content of an array/dict/set)
        r�r��r�Nr�F�	TrRr�r�rQ�Zsigned�"z>frP�#z>d�3��)Zseconds�@�Pr��`r�utf-16be��c3s|]}��|�VqdSr)r�)r��xrBrrr��sz2_BinaryPlistParser._read_object.<locals>.<genexpr>��)r�r�r�r�r�r�rJr�r�r�rcZ	timedeltar�rTrryrr�r
r�extendrz�zipr�r.)r0�ref�result�offset�tokenZtokenHr�r,rXr*Zobj_refsZkey_refs�k�orrBrr�us�

�



�















z_BinaryPlistParser._read_objectN)
r@rDrErFr1r�r�r�rr�rrrrr�9s

r�cCs,|dkrdS|dkrdS|dkr$dSdSdS)N�r��r�rPr�r)�countrrr�_count_to_size�src@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�_BinaryPlistWritercCs||_||_||_dSr)r�r�r�)r0rr&r'rrrr1�sz_BinaryPlistWriter.__init__c
Cs�g|_i|_i|_|�|�t|j�}dg||_t|�|_t|j|_	|j
�d�|jD]}|�|�qZ|�
|�}|j
��}t|�}dt||}|j
�tj|f|j���d}|||j|||f}	|j
�tjd|	���dS)Nr�bplist00rn�	>5xBBBQQQ)r)�_objlist�	_objtable�_objidtable�_flattenrTr�rr�r��_ref_formatr�r��
_write_object�
_getrefnum�tellr��pack)
r0r(r��objr�r�r�Z
offset_formatZsort_versionr�rrrr��s2





�z_BinaryPlistWriter.writec	Csrt|t�r"t|�|f|jkrZdSn8t|t�rHt|j�|jf|jkrZdSnt|�|jkrZdSt|j	�}|j	�
|�t|t�r�||jt|�|f<n0t|t�r�||jt|j�|jf<n||jt|�<t|t��rHg}g}|��}|j
r�t|�}|D]:\}}t|t��s|j�r
q�td��|�
|�|�
|�q�t�||�D]}|�|��q4n&t|ttf��rn|D]}|�|��q\dS)Nr�)r�_scalarsr�r!rr*�idr"rTr rUr�r�r�r�rr�r.�	itertools�chainr#r�r�)	r0r(Zrefnum�keys�valuesr�r�vrrrrr#sB





z_BinaryPlistWriter._flattencCsNt|t�r|jt|�|fSt|t�r<|jt|j�|jfS|jt|�SdSr)rr*r!r�rr*r"r+r�rrrr&Ns


z_BinaryPlistWriter._getrefnumcCs�|dkr"|j�t�d||B��n�|dkrH|j�t�d|dBd|��nh|dkrn|j�t�d|dBd|��nB|d	kr�|j�t�d
|dBd|��n|j�t�d|dBd
|��dS)Nr�z>Brz>BBBr�rz>BBH�rz>BBL�z>BBQ�)r�r�r�r()r0rr�rrr�_write_sizeVsz_BinaryPlistWriter._write_sizecs���|�}�j���j|<|dkr2�j�d��nl|dkrJ�j�d��nT|dkrb�j�d��n<t|t��rl|dkr�z�j�t�dd|��Wn tj	k
r�t
|�d�YnXn�|d	krԈj�t�d
d|��n�|dkr�j�t�d
d|��nt|dk�r�j�t�dd|��nR|dk�r8�j�t�dd|��n0|dk�r`�j�d|jdddd��nt
|���n2t|t��r��j�t�dd|���nt|t
j
��r�|t
�
ddd���}�j�t�dd|���n�t|t��r��dt|j���j�|j��n�t|ttf��r0��dt|���j�|��nnt|t��r�z|�d�}��dt|��Wn4tk
�r�|�d �}��d!t|�d"�YnX�j�|��n�t|t��r^|jdk�r�td#��n�|jd	k�r�j�t�d
d$|��nt|jdk�r
�j�t�d
d%|��nP|jdk�r.�j�t�dd&|��n,|jdk�rR�j�t�dd'|��nt
|���n@t|ttf��r��fd(d)�|D�}t|�}��d*|��j�tjd+�j|f|���n�t|t��r�gg}}�j�r�t|� ��}	n|� �}	|	D]J\}
}t|
t��s�j!�r�q�t"d,��|�#��|
��|�#��|���q�t|�}��d-|��j�tjd+�j|f|����j�tjd+�j|f|���nt"|��dS).N�F�Tr�rz>Bqr3rz>BBr�rz>BHr1rz>BLr2lz>BQrH�r�rz>Bdrrr�rrr�r	rr
rrIr���csg|]}��|��qSr)r&)r�rrBrr�
<listcomp>�sz4_BinaryPlistWriter._write_object.<locals>.<listcomp>r
rnr�r)$r&r�r'r�r�rrJr�r(r�r��to_bytesr�rcZ
total_secondsrr4rTr*r-r�rr]�UnicodeEncodeErrorr
rKr�r�r$r�r�r�r�r�r.rU)r0r(rr,�tZrefsrXZkeyRefsZvalRefsZ	rootItemsrr0rrBrr%fs�






$
"$z _BinaryPlistWriter._write_objectN)	r@rDrEr1r�r#r&r4r%rrrrr�s-0rcCs|dd�dkS)Nr�rr)r�rrr�_is_fmt_binary�sr?)�detectr}�writerT�r!r"r|cCsl|dkrJ|�d�}|�d�t��D]}|d|�r$|d}qVq$t��nt|d}|||d�}|�|�S)z�Read a .plist file. 'fp' should be a readable and binary file object.
    Return the unpacked root object (which usually is a dictionary).
    Nr�rr@r})r"r|)r�r��_FORMATSr/rr�)rr!r"r|r��info�P�prrrr	�s

cCst|�}t||||d�S)zqRead a .plist file from a bytes object.
    Return the unpacked root object (which usually is a dictionary).
    rB)rr	)r(r!r"r|rrrrr�s�Fr%cCs:|tkrtd|f��t|d|||d�}|�|�dS)zWWrite 'value' to a .plist file. 'fp' should be a writable,
    binary file object.
    zUnsupported format: %rrA)r&r'N)rCrKr�)r(rr!r&r'rArrrr
s�r!r'r&cCs t�}t|||||d�|��S)z?Return a bytes object with the contents for a .plist file.
    rG)rr
r+)r(r!r'r&rrrrrs)r5)CrF�__all__rVr��
contextlibrc�enum�iorr,r��rer��warningsrZxml.parsers.expatr�Enumr@r�globals�update�__members__�contextmanagerrrrrrrr
r��compileror6r2�ASCIIr`rgrirtrur�r�r�rKrr��objectr�r�rrrJr�r-r*rr?rr�rrCr	rr
rrrrr�<module>s�0�

	


'"�
	
s&d!$
a	���	pty.cpython-38.opt-1.pyc000064400000007565150335716500010771 0ustar00U

e5d��@s�dZddlmZddlZddlZddlZdddgZdZdZdZdZ	d	d�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zeefdd�Zeefdd�ZdS)zPseudo terminal utilities.�)�selectN�openpty�fork�spawn��c	Cs>z
t��WSttfk
r"YnXt�\}}t|�}||fS)zdopenpty() -> (master_fd, slave_fd)
    Open a pty master/slave pair, using os.openpty() if possible.)�osr�AttributeError�OSError�_open_terminal�
slave_open)�	master_fd�
slave_name�slave_fd�r�/usr/lib64/python3.8/pty.pyrs

c	CsLzt��\}}Wnttfk
r(YnXt�|�}t�|�||fSt�S)z�master_open() -> (master_fd, slave_name)
    Open a pty master and return the fd, and the filename of the slave end.
    Deprecated, use openpty() instead.)rrr	r
�ttyname�closer)r
rrrrr�master_open"s

rc
CsndD]\}dD]R}d||}zt�|tj�}Wntk
rFYqYnX|d||fSqtd��dS)z1Open pty master and return (master_fd, tty_name).ZpqrstuvwxyzPQRSTZ0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devicesN)r�open�O_RDWRr
)�x�yZpty_name�fdrrrr2s
rcCsrt�|tj�}zddlm}m}Wntk
r:|YSXz|||d�|||d�Wntk
rlYnX|S)z�slave_open(tty_name) -> slave_fd
    Open the pty slave and acquire the controlling terminal, returning
    opened filedescriptor.
    Deprecated, use openpty() instead.r)�ioctl�I_PUSHZptemZldterm)rrrZfcntlrr�ImportErrorr
)Ztty_name�resultrrrrrr>s
rc	Cs�zt��\}}Wnttfk
r(Yn4X|tkrTzt��Wntk
rRYnX||fSt�\}}t��}|tkr�t��t�|�t�	|t
�t�	|t�t�	|t�|tkr�t�|�t�
t�t�tj�}t�|�n
t�|�||fS)zdfork() -> (pid, master_fd)
    Fork and make the child a session leader with a controlling terminal.)r�forkptyr	r
�CHILD�setsidrrr�dup2�STDIN_FILENO�
STDOUT_FILENO�
STDERR_FILENOrrr)�pidrr
rZtmp_fdrrrrPs0



cCs"|rt�||�}||d�}qdS)z#Write all the data to a descriptor.N)r�write)r�data�nrrr�_writenxsr)cCst�|d�S)zDefault read function.i)r�read)rrrr�_read~sr+cCsv|tg}t|gg�\}}}||krF||�}|s:|�|�nt�t|�t|kr|t�}|sf|�t�qt||�qdS)z�Parent copy loop.
    Copies
            pty master -> standard output   (master_read)
            standard input -> pty master    (stdin_read)N)r"r�removerr&r#r))r
�master_read�
stdin_readZfdsZrfdsZwfdsZxfdsr'rrr�_copy�sr/cCs�t|�td�kr|f}t�d|�t�\}}|tkrHtj|df|��zt�t	�}t�
t	�d}Wntjk
r~d}YnXzt|||�Wn(t
k
r�|r�t�t	tj|�YnXt�|�t�|d�dS)zCreate a spawned process.�z	pty.spawnrr)�type�sys�auditrrr�execlp�ttyZ	tcgetattrr"Zsetraw�errorr/r
Z	tcsetattrZ	TCSAFLUSHr�waitpid)�argvr-r.r%r
�modeZrestorerrrr�s&




)�__doc__rrr2r5�__all__r"r#r$rrrrrrr)r+r/rrrrr�<module>s$
(posixpath.cpython-38.pyc000064400000024276150335716500011233 0ustar00U

e5d=�&@s^dZdZdZdZdZdZdZdZdZddl	Z	ddl
Z
ddlZddlZdd	lTd
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/g&Z
d0d1�Zd2d
�Zd3d�Zd4d�Zd5d�Zd6d�Zejje_d7d
�Zd8d�Zd9d�Zd:d�Zd;d�Zd<d�Zd=d�Zdadad>d�Zd?d�Zd@d �Z dAd,�Z!dBdC�Z"e
j#dDkZ$dGdEd.�Z%dFd/�Z&dS)Ha�Common operations on Posix pathnames.

Instead of importing this module directly, import os and refer to
this module as os.path.  The "os.path" name is an alias for this
module on Posix systems; on other systems (e.g. Windows),
os.path provides the same operations in a manner specific to that
platform, and is an alias to another module (e.g. ntpath).

Some of this can actually be useful on non-Posix systems too, e.g.
for manipulation of the pathname component of URLs.
�.�..�/�:z
/bin:/usr/binNz	/dev/null�)�*�normcase�isabs�join�
splitdrive�split�splitext�basename�dirname�commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�ismount�
expanduser�
expandvars�normpath�abspath�samefile�sameopenfile�samestat�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenames�relpath�
commonpathcCst|t�rdSdSdS)N�/r)�
isinstance�bytes��path�r2�!/usr/lib64/python3.8/posixpath.py�_get_sep)s
r4cCs
t�|�S)z6Normalize case of pathname.  Has no effect under Posix��os�fspath)�sr2r2r3r4scCst�|�}t|�}|�|�S)zTest whether a path is absolute)r6r7r4�
startswith)r8r#r2r2r3r<s
c
Gs�t�|�}t|�}|}z^|s,|dd�|ttj|�D]8}|�|�rL|}q8|rZ|�|�rd||7}q8|||7}q8Wn.tttfk
r�t	j
d|f|���YnX|S)z�Join two or more pathname components, inserting '/' as needed.
    If any component is an absolute path, all previous path components
    will be discarded.  An empty last part will result in a path that
    ends with a separator.Nrr	)r6r7r4�mapr9�endswith�	TypeError�AttributeError�BytesWarning�genericpath�_check_arg_types)�a�pr#r1�br2r2r3r	Gs 


cCs`t�|�}t|�}|�|�d}|d|�||d�}}|rX||t|�krX|�|�}||fS)z�Split a pathname.  Returns tuple "(head, tail)" where "tail" is
    everything after the final slash.  Either part may be empty.�N�r6r7r4�rfind�len�rstrip)rBr#�i�head�tailr2r2r3rds

cCs6t�|�}t|t�rd}d}nd}d}t�||d|�S)Nr-�.rr)r6r7r.r/r?�	_splitext)rBr#r'r2r2r3rus

cCst�|�}|dd�|fS)zJSplit a pathname into drive and path. On Posix, drive is always
    empty.Nrr5)rBr2r2r3r
�s
cCs,t�|�}t|�}|�|�d}||d�S)z)Returns the final component of a pathnamerDN)r6r7r4rF)rBr#rIr2r2r3r
�s
cCsNt�|�}t|�}|�|�d}|d|�}|rJ||t|�krJ|�|�}|S)z-Returns the directory component of a pathnamerDNrE)rBr#rIrJr2r2r3r�s

c
Cs8zt�|�}Wntttfk
r*YdSXt�|j�S)z&Test whether a path is a symbolic linkF)r6�lstat�OSError�
ValueErrorr=�stat�S_ISLNK�st_mode)r1�str2r2r3r�s
c	Cs.zt�|�Wnttfk
r(YdSXdS)zCTest whether a path exists.  Returns True for broken symbolic linksFT)r6rNrOrPr0r2r2r3r�s
c	Cs�zt�|�}Wnttfk
r(YdSXt�|j�r:dSt|t�rPt	|d�}n
t	|d�}t
|�}zt�|�}Wnttfk
r�YdSX|j}|j}||kr�dS|j}|j}||kr�dSdS)z$Test whether a path is a mount pointF�..rT)
r6rNrOrPrQrRrSr.r/r	r)�st_dev�st_ino)r1�s1�parent�s2�dev1�dev2�ino1�ino2r2r2r3r�s.

c	Cs<t�|�}t|t�rd}nd}|�|�s,|St|�}|�|d�}|dkrPt|�}|dkr�dtjkr�ddl	}z|�
t���j}Wq�t
k
r�|YSXn
tjd}nVddl	}|d|�}t|t�r�t|d�}z|�|�}Wnt
k
r�|YSX|j}t|t��rt�|�}d}nd	}|�|�}|||d��p:|S)
zOExpand ~ and ~user constructions.  If user or $HOME is unknown,
    do nothing.�~�~rDr�HOMEN�ASCIIr-r)r6r7r.r/r9r4�findrG�environ�pwd�getpwuid�getuid�pw_dir�KeyError�str�getpwnam�fsencoderH)	r1�tilder#rIre�userhome�name�pwent�rootr2r2r3r�sB








cCsZt�|�}t|t�rVd|kr |Sts:ddl}|�d|j�atj}d}d}t	tdd�}n:d|krb|St
s|ddl}|�d	|j�a
t
j}d
}d}tj}d}|||�}|s��qV|�d�\}}|�
d�}	|	�|�r�|	�|�r�|	dd
�}	z.|dk�rt�tjt�|	��}
n||	}
Wntk
�r&|}Yq�X||d�}|d|�|
}t|�}||7}q�|S)zZExpand shell variables of form $var and ${var}.  Unknown variables
    are left unchanged.�$rNs\$(\w+|\{[^}]*\})�{�}�environb�$z\$(\w+|\{[^}]*\})�{�}rD���)r6r7r.r/�	_varprogb�re�compilerb�search�getattr�_varprogrd�span�groupr9r;rl�fsdecoderirG)r1r{r}�start�endrdrI�m�jro�valuerKr2r2r3rsN






c	Cs�t�|�}t|t�r&d}d}d}d}nd}d}d}d}||krB|S|�|�}|rp|�|d	�rp|�|d
�spd	}|�|�}g}|D]J}|||fkr�q�||ks�|s�|r�|r�|d|kr�|�|�q�|r�|��q�|}|�|�}|r�|||}|p�|S)z0Normalize path, eliminating double slashes, etc.r-�rLrUr�rr��ry)	r6r7r.r/r9r�append�popr	)	r1r#�empty�dot�dotdot�initial_slashes�comps�	new_comps�compr2r2r3rNsJ


��
�
�

cCs@t�|�}t|�s8t|t�r&t��}nt��}t||�}t|�S)zReturn an absolute path.)	r6r7rr.r/�getcwdb�getcwdr	r)r1�cwdr2r2r3rts



cCs*t�|�}t|dd�|i�\}}t|�S)zlReturn the canonical path of the specified filename, eliminating any
symbolic links encountered in the path.Nr)r6r7�
_joinrealpathr)�filenamer1�okr2r2r3r)�s
c
Cst|t�rd}d}d}nd}d}d}t|�r<|dd�}|}|�r|�|�\}}}|r<||kr`q<||kr�|r�t|�\}}||kr�t|||�}q<|}q<t||�}t|�s�|}q<||kr�||}|dk	r�q<t||�dfSd||<t|t�	|�|�\}}	|	�st||�dfS|||<q<|d	fS)
Nr-rLrUrrrrDFT)
r.r/r�	partitionrr	rr�r6�readlink)
r1�rest�seenr#r!r"ro�_�newpathr�r2r2r3r��sH


r��darwinc	Cs�|std��t�|�}t|t�r.d}d}d}nd}d}d}|dkrH|}n
t�|�}zrd	d
�t|��|�D�}dd
�t|��|�D�}tt||g��}|gt|�|||d�}|s�|WSt	|�WSt
ttt
fk
r�t�d||��YnXdS)
z#Return a relative version of a pathzno path specifiedrLr-rUrrrNcSsg|]}|r|�qSr2r2��.0�xr2r2r3�
<listcomp>�szrelpath.<locals>.<listcomp>cSsg|]}|r|�qSr2r2r�r2r2r3r��sr+)rPr6r7r.r/rrrGrr	r<r=r>�DeprecationWarningr?r@)	r1r�r!r#r"�
start_list�	path_listrI�rel_listr2r2r3r+�s0



c		s2|std��tttj|��}t|dt�r4d�d�nd�d�zƇfdd�|D�}zt�fd	d
�|D��\}Wntk
r�td�d�YnX�fd
d�|D�}t|�}t	|�}|}t
|�D]$\}}|||kr�|d|�}q�q�|r�n
�dd�}|��|�WStt
fk
�r,tjd|���YnXdS)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr-rLrrcsg|]}|����qSr2)r)r�r1�r#r2r3r��szcommonpath.<locals>.<listcomp>c3s|]}|dd��kVqdS)NrDr2)r�rBr�r2r3�	<genexpr>�szcommonpath.<locals>.<genexpr>z%Can't mix absolute and relative pathsNcsg|]}�fdd�|D��qS)csg|]}|r|�kr|�qSr2r2)r��c�r!r2r3r�sz)commonpath.<locals>.<listcomp>.<listcomp>r2)r�r8r�r2r3r�sr,)r,)rP�tupler:r6r7r.r/�set�min�max�	enumerater	r<r=r?r@)	�paths�split_pathsrrXrZ�commonrIr��prefixr2)r!r#r3r,�s6)N)'�__doc__r!r"r'r#r$r%r&r(r6�sysrQr?�__all__r4rrr	rrrMr
r
rrrrrrrzrrrr)r��platformr*r+r,r2r2r2r3�<module>s��
	
	

*25&	3

)inspect.cpython-38.pyc000064400000235323150335716500010656 0ustar00U

e5d��@s�dZdZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlmZddlmZmZe�Zej��D]\ZZeede<q�dZdd	�Zd
d�Z dd
�Z!dd�Z"dd�Z#e$ed��rdd�Z%ndd�Z%e$ed��r*dd�Z&ndd�Z&dd�Z'dd�Z(dd�Z)d d!�Z*d"d#�Z+d$d%�Z,d&d'�Z-d(d)�Z.d*d+�Z/d,d-�Z0d.d/�Z1d0d1�Z2d2d3�Z3d4d5�Z4d6d7�Z5d�d8d9�Z6ed:d;�Z7d<d=�Z8d>d?�Z9dd@�dAdB�Z:dCdD�Z;dEdF�Z<dGdH�Z=dIdJ�Z>dKdL�Z?dMdN�Z@dOdP�ZAdQdR�ZBd�dSdT�ZCiZDiZEd�dUdV�ZFdWdX�ZGdYdZ�ZHGd[d\�d\eI�ZJGd]d^�d^�ZKd_d`�ZLdadb�ZMdcdd�ZNdedf�ZOd�dhdi�ZPedjdk�ZQdldm�ZRedndo�ZSdpdq�ZTedrds�ZUdtdu�ZVedvdw�ZWdxdy�ZXd�dzd{�ZYd|d}�ZZdddd~iie[dd��d�d��d�d��d�d��eYfd�d��Z\e[d�d��d�d��d�d��fd�d��Z]d�d��Z^d�d��Z_d�d��Z`ed�d��Zad�d��Zbed�d��Zcd�d�d��Zdd�d��Zeed�d�ecjf�Zgd�d�d��Zhd�d�d��Zid�d��Zjd�d�d��Zkd�d�d��Zlem�Znd�d��Zod�d��Zpd�d��Zqd�d��Zrd�d��Zsenfd�d��Ztd�Zud�Zvd�Zwd�Zxd�d��Zyd�d��Zzd�Z{d�Z|d�Z}d�Z~d�d��Zd�dÄZ�e�e�j��Z�e�e�j��Z�e�e�j�d��Z�e�e�e�ej�fZ�d�dƄZ�d�d�dȄZ�d�dʄZ�d�d̄Z�d�d΄Z�d�dЄZ�d�d҄Z�d�d�dՄZ��dd�dׄZ��dd�dلZ�d�d�dڜd�d܄Z�Gd�dބdރZ�Gd�d�d�Z�Gd�d�d�ej��Z�e�j�Z�e�j�Z�e�j�Z�e�j�Z�e�j�Z�e�d�e�d�e�d�e�d�e�d�iZ�Gd�d�d�Z�Gd�d�d�Z�Gd�d�d�Z�d�d�d�d�Z�d�d�Z�e�d�k�r�e��dS(aGet useful information from live Python objects.

This module encapsulates the interface provided by the internal special
attributes (co_*, im_*, tb_*, etc.) in a friendlier fashion.
It also provides some help for examining source code and class layout.

Here are some of the useful functions provided by this module:

    ismodule(), isclass(), ismethod(), isfunction(), isgeneratorfunction(),
        isgenerator(), istraceback(), isframe(), iscode(), isbuiltin(),
        isroutine() - check object types
    getmembers() - get members of an object that satisfy a given condition

    getfile(), getsourcefile(), getsource() - find an object's source code
    getdoc(), getcomments() - get documentation on an object
    getmodule() - determine the module that an object came from
    getclasstree() - arrange classes so as to represent their hierarchy

    getargvalues(), getcallargs() - get info about function arguments
    getfullargspec() - same, with support for Python 3 features
    formatargvalues() - format an argument spec
    getouterframes(), getinnerframes() - get info about frames
    currentframe() - get the current stack frame
    stack(), trace() - get info about frames on the stack or in a traceback

    signature() - get a Signature object for the callable
)zKa-Ping Yee <ping@lfw.org>z'Yury Selivanov <yselivanov@sprymix.com>�N)�
attrgetter)�
namedtuple�OrderedDictZCO_icCst|tj�S)z�Return true if the object is a module.

    Module objects provide these attributes:
        __cached__      pathname to byte compiled file
        __doc__         documentation string
        __file__        filename (missing for built-in modules))�
isinstance�types�
ModuleType��object�r
�/usr/lib64/python3.8/inspect.py�ismodule?srcCs
t|t�S)z�Return true if the object is a class.

    Class objects provide these attributes:
        __doc__         documentation string
        __module__      name of module in which this class was defined)r�typerr
r
r�isclassHsrcCst|tj�S)a_Return true if the object is an instance method.

    Instance method objects provide these attributes:
        __doc__         documentation string
        __name__        name with which this method was defined
        __func__        function object containing implementation of method
        __self__        instance to which this method is bound)rr�
MethodTyperr
r
r�ismethodPsrcCs:t|�st|�st|�rdSt|�}t|d�o8t|d�S)a�Return true if the object is a method descriptor.

    But not if ismethod() or isclass() or isfunction() are true.

    This is new in Python 2.2, and, for example, is true of int.__add__.
    An object passing this test has a __get__ attribute but not a __set__
    attribute, but beyond that the set of attributes varies.  __name__ is
    usually sensible, and __doc__ often is.

    Methods implemented via descriptors that also pass one of the other
    tests return false from the ismethoddescriptor() test, simply because
    the other tests promise more -- you can, e.g., count on having the
    __func__ attribute (etc) when an object passes ismethod().F�__get__�__set__�rr�
isfunctionr
�hasattr�r	�tpr
r
r�ismethoddescriptorZsrcCs8t|�st|�st|�rdSt|�}t|d�p6t|d�S)a}Return true if the object is a data descriptor.

    Data descriptors have a __set__ or a __delete__ attribute.  Examples are
    properties (defined in Python) and getsets and members (defined in C).
    Typically, data descriptors will also have __name__ and __doc__ attributes
    (properties, getsets, and members have both of these attributes), but this
    is not guaranteed.Fr�
__delete__rrr
r
r�isdatadescriptornsr�MemberDescriptorTypecCst|tj�S)��Return true if the object is a member descriptor.

        Member descriptors are specialized descriptors defined in extension
        modules.)rrrrr
r
r�ismemberdescriptor~srcCsdS)rFr
rr
r
rr�s�GetSetDescriptorTypecCst|tj�S)��Return true if the object is a getset descriptor.

        getset descriptors are specialized descriptors defined in extension
        modules.)rrrrr
r
r�isgetsetdescriptor�sr cCsdS)rFr
rr
r
rr �scCst|tj�S)a(Return true if the object is a user-defined function.

    Function objects provide these attributes:
        __doc__         documentation string
        __name__        name with which this function was defined
        __code__        code object containing compiled function bytecode
        __defaults__    tuple of any default values for arguments
        __globals__     global namespace in which this function was defined
        __annotations__ dict of parameter annotations
        __kwdefaults__  dict of keyword only parameters with defaults)rr�FunctionTyperr
r
rr�srcCs6t|�r|j}qt�|�}t|�s&dSt|jj|@�S)z�Return true if ``f`` is a function (or a method or functools.partial
    wrapper wrapping a function) whose code object has the given ``flag``
    set in its flags.F)r�__func__�	functools�_unwrap_partialr�bool�__code__�co_flags)�f�flagr
r
r�_has_code_flag�s
r*cCs
t|t�S)z�Return true if the object is a user-defined generator function.

    Generator function objects provide the same attributes as functions.
    See help(isfunction) for a list of attributes.)r*ZCO_GENERATOR��objr
r
r�isgeneratorfunction�sr-cCs
t|t�S)zuReturn true if the object is a coroutine function.

    Coroutine functions are defined with "async def" syntax.
    )r*ZCO_COROUTINEr+r
r
r�iscoroutinefunction�sr.cCs
t|t�S)z�Return true if the object is an asynchronous generator function.

    Asynchronous generator functions are defined with "async def"
    syntax and have "yield" expressions in their body.
    )r*ZCO_ASYNC_GENERATORr+r
r
r�isasyncgenfunction�sr/cCst|tj�S)z7Return true if the object is an asynchronous generator.)rr�AsyncGeneratorTyperr
r
r�
isasyncgen�sr1cCst|tj�S)aReturn true if the object is a generator.

    Generator objects provide these attributes:
        __iter__        defined to support iteration over container
        close           raises a new GeneratorExit exception inside the
                        generator to terminate the iteration
        gi_code         code object
        gi_frame        frame object or possibly None once the generator has
                        been exhausted
        gi_running      set to 1 when generator is executing, 0 otherwise
        next            return the next item from the container
        send            resumes the generator and "sends" a value that becomes
                        the result of the current yield-expression
        throw           used to raise an exception inside the generator)rr�
GeneratorTyperr
r
r�isgenerator�sr3cCst|tj�S)z)Return true if the object is a coroutine.)rr�
CoroutineTyperr
r
r�iscoroutine�sr5cCs6t|tj�p4t|tj�r(t|jjt@�p4t|tj	j
�S)z?Return true if object can be passed to an ``await`` expression.)rrr4r2r%�gi_coder'ZCO_ITERABLE_COROUTINE�collections�abc�	Awaitablerr
r
r�isawaitable�s��r:cCst|tj�S)abReturn true if the object is a traceback.

    Traceback objects provide these attributes:
        tb_frame        frame object at this level
        tb_lasti        index of last attempted instruction in bytecode
        tb_lineno       current line number in Python source code
        tb_next         next inner traceback object (called by this level))rr�
TracebackTyperr
r
r�istraceback�sr<cCst|tj�S)a`Return true if the object is a frame object.

    Frame objects provide these attributes:
        f_back          next outer frame object (this frame's caller)
        f_builtins      built-in namespace seen by this frame
        f_code          code object being executed in this frame
        f_globals       global namespace seen by this frame
        f_lasti         index of last attempted instruction in bytecode
        f_lineno        current line number in Python source code
        f_locals        local namespace seen by this frame
        f_trace         tracing function for this frame, or None)rr�	FrameTyperr
r
r�isframe�sr>cCst|tj�S)a�Return true if the object is a code object.

    Code objects provide these attributes:
        co_argcount         number of arguments (not including *, ** args
                            or keyword only arguments)
        co_code             string of raw compiled bytecode
        co_cellvars         tuple of names of cell variables
        co_consts           tuple of constants used in the bytecode
        co_filename         name of file in which this code object was created
        co_firstlineno      number of first line in Python source code
        co_flags            bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg
                            | 16=nested | 32=generator | 64=nofree | 128=coroutine
                            | 256=iterable_coroutine | 512=async_generator
        co_freevars         tuple of names of free variables
        co_posonlyargcount  number of positional only arguments
        co_kwonlyargcount   number of keyword only arguments (not including ** arg)
        co_lnotab           encoded mapping of line numbers to bytecode indices
        co_name             name with which this code object was defined
        co_names            tuple of names of local variables
        co_nlocals          number of local variables
        co_stacksize        virtual machine stack space required
        co_varnames         tuple of names of arguments and local variables)rr�CodeTyperr
r
r�iscodesr@cCst|tj�S)a,Return true if the object is a built-in function or method.

    Built-in functions and methods provide these attributes:
        __doc__         documentation string
        __name__        original name of this function or method
        __self__        instance to which a method is bound, or None)rr�BuiltinFunctionTyperr
r
r�	isbuiltinsrBcCs t|�pt|�pt|�pt|�S)z<Return true if the object is any kind of function or method.)rBrrrrr
r
r�	isroutine&s���rCcCs�t|t�sdS|jt@rdStt|�tj�s0dSt|d�r>dS|j�	�D]\}}t
|dd�rHdSqH|jD]6}t
|dd�D]$}t
||d�}t
|dd�rzdSqzqjdS)z:Return true if the object is an abstract base class (ABC).FT�__abstractmethods__�__isabstractmethod__r
N)rr
�	__flags__�TPFLAGS_IS_ABSTRACT�
issubclassr8�ABCMetar�__dict__�items�getattr�	__bases__)r	�name�value�baser
r
r�
isabstract-s"



rQc	Cst|�r|ft|�}nd}g}t�}t|�}z:|jD].}|j��D]\}}t|tj	�rD|�
|�qDq6Wntk
r|YnX|D]~}	zt||	�}
|	|kr�t�Wn:tk
r�|D]}|	|jkr�|j|	}
q�q�Yq�YnX|r�||
�r�|�
|	|
f�|�
|	�q�|jdd�d�|S)z�Return all members of an object as (name, value) pairs sorted by name.
    Optionally, only return members that satisfy a given predicate.r
cSs|dS)Nrr
)Zpairr
r
r�<lambda>n�zgetmembers.<locals>.<lambda>��key)r�getmro�set�dirrMrJrKrr�DynamicClassAttribute�append�AttributeErrorrL�add�sort)r	Z	predicate�mro�results�	processed�namesrP�k�vrUrOr
r
r�
getmembersEs:




rd�	Attributezname kind defining_class objectcCsTt|�}tt|��}tdd�|D��}|f|}||}t|�}|D].}|j��D]\}}t|tj�rR|�	|�qRqDg}	t
�}
|D�]�}d}d}
d}||
k�rzz|dkr�td��t||�}
Wn"tk
r�}zW5d}~XYn�Xt|
d|�}||k�rzd}d}|D] }t||d�}||
k�r|}�q|D]B}z|�
||�}Wntk
�rXY�q(YnX||
k�r(|}�q(|dk	�rz|}|D]0}||jk�r~|j|}||k�r�|}�q��q~|dk�r�q�|
dk	�r�|
n|}t|ttjf��r�d}|}nFt|ttjf��rd}|}n*t|t��rd	}|}nt|��r,d
}nd}|	�	t||||��|
�|�q�|	S)aNReturn list of attribute-descriptor tuples.

    For each name in dir(cls), the return list contains a 4-tuple
    with these elements:

        0. The name (a string).

        1. The kind of attribute this is, one of these strings:
               'class method'    created via classmethod()
               'static method'   created via staticmethod()
               'property'        created via property()
               'method'          any other flavor of method or descriptor
               'data'            not a method

        2. The class which defined this attribute (a class).

        3. The object as obtained by calling getattr; if this fails, or if the
           resulting object does not live anywhere in the class' mro (including
           metaclasses) then the object is looked up in the defining class's
           dict (found by walking the mro).

    If one of the items in dir(cls) is stored in the metaclass it will now
    be discovered and not have None be listed as the class in which it was
    defined.  Any items whose home class cannot be discovered are skipped.
    css|]}|ttfkr|VqdS�N)r
r	)�.0�clsr
r
r�	<genexpr>�sz'classify_class_attrs.<locals>.<genexpr>NrJz)__dict__ is special, don't want the proxy�__objclass__z
static methodzclass method�property�method�data)rVr
�tuplerXrJrKrrrYrZrW�	ExceptionrL�__getattr__r[�staticmethod�BuiltinMethodType�classmethod�ClassMethodDescriptorTyperkrCrer\)rhr^ZmetamroZclass_basesZ	all_basesrarPrbrc�resultr`rNZhomeclsZget_objZdict_obj�excZlast_clsZsrch_clsZsrch_objr,�kindr
r
r�classify_class_attrsss�












rxcCs|jS)zHReturn tuple of base classes (including cls) in method resolution order.)�__mro__)rhr
r
rrV�srV��stopcs|�dkrdd�}n�fdd�}|}t|�|i}t��}||�rx|j}t|�}||ks`t|�|krntd�|���|||<q6|S)anGet the object wrapped by *func*.

   Follows the chain of :attr:`__wrapped__` attributes returning the last
   object in the chain.

   *stop* is an optional callback accepting an object in the wrapper chain
   as its sole argument that allows the unwrapping to be terminated early if
   the callback returns a true value. If the callback never returns a true
   value, the last object in the chain is returned as usual. For example,
   :func:`signature` uses this to stop unwrapping if any object in the
   chain has a ``__signature__`` attribute defined.

   :exc:`ValueError` is raised if a cycle is encountered.

    NcSs
t|d�S�N�__wrapped__�r�r(r
r
r�_is_wrapper�szunwrap.<locals>._is_wrappercst|d�o�|�Sr|r~rrzr
rr�sz!wrapper loop when unwrapping {!r})�id�sys�getrecursionlimitr}�len�
ValueError�format)�funcr{r�r(ZmemoZrecursion_limitZid_funcr
rzr�unwrap�s

r�cCs|��}t|�t|���S)zBReturn the indent size, in spaces, at the start of a line of text.)�
expandtabsr��lstrip)�lineZexpliner
r
r�
indentsizesr�cCsNtj�|j�}|dkrdS|j�d�dd�D]}t||�}q.t|�sJdS|S)N�.���)r��modules�get�
__module__�__qualname__�splitrLr)r�rhrNr
r
r�
_findclasssr�c	Cst|�rT|jD]@}|tk	rz
|j}Wntk
r<YqYnX|dk	r|SqdSt|�r�|jj}|j}t|�r�t	t	||d�d�|jkr�|}n|j
}�n$t|�r�|j}t|�}|dks�t	||�|k	r�dSn�t
|��r|j}|j}t|��r|jd||jk�r|}n|j
}n�t|t��rP|j}|j}t|�}|dk�sJt	||�|k	�r�dSnnt|��sdt|��r�|j}|j}t	||�|k	�r�dSt|��r�t	|dd�}t|t��r�||k�r�||SndS|jD]F}zt	||�j}Wntk
�r�Y�q�YnX|dk	�r�|S�q�dS)Nr"r��	__slots__)rryr	�__doc__r[rr"�__name__�__self__rL�	__class__rr�rBr�rrk�fgetrrrjr�dict)r,rP�docrN�selfrhr��slotsr
r
r�_finddoc sn



�


�



r�c	Cshz
|j}Wntk
r YdSX|dkrRzt|�}Wnttfk
rPYdSXt|t�s`dSt|�S)z�Get the documentation string for an object.

    All tabs are expanded to spaces.  To clean up docstrings that are
    indented to line up with blocks of code, any whitespace than can be
    uniformly removed from the second line onwards is removed.N)r�r[r��	TypeErrorr�str�cleandoc)r	r�r
r
r�getdoc^s

r�cCs�z|���d�}Wntk
r(YdSXtj}|dd�D]*}t|���}|r<t|�|}t||�}q<|r||d��|d<|tjkr�tdt|��D]}|||d�||<q�|r�|ds�|�	�q�|r�|ds�|�	d�q�d�
|�SdS)z�Clean up indentation from docstrings.

    Any whitespace that can be uniformly removed from the second line
    onwards is removed.�
N�rr�)r�r��UnicodeErrorr��maxsizer�r��min�range�pop�join)r��linesZmarginr�Zcontent�indent�ir
r
rr�qs(

r�cCs�t|�r(t|dd�r|jStd�|���t|�rht|d�rZtj�	|j
�}t|dd�rZ|jStd�|���t|�rv|j}t
|�r�|j}t|�r�|j}t|�r�|j}t|�r�|jStd�t|�j���dS)z@Work out which source or compiled file an object was defined in.�__file__Nz{!r} is a built-in moduler�z{!r} is a built-in classzVmodule, class, method, function, traceback, frame, or code object was expected, got {})rrLr�r�r�rrr�r�r�r�rr"rr&r<�tb_framer>�f_coder@�co_filenamer
r�)r	�moduler
r
r�getfile�s.
�r�cCsTtj�|�}dd�tj��D�}|��|D]"\}}|�|�r,|d|�Sq,dS)z1Return the module name for a given file, or None.cSsg|]}t|�|f�qSr
)r�)rg�suffixr
r
r�
<listcomp>�s�z!getmodulename.<locals>.<listcomp>N)�os�path�basename�	importlib�	machinery�all_suffixesr]�endswith)r�Zfname�suffixesZneglenr�r
r
r�
getmodulename�s�
r�cs�t|��tjjdd�}|tjjdd�7}t�fdd�|D��r`tj���dtjj	d�nt�fdd�tjj
D��r~dStj���r��Stt
|��dd�dk	r��S�tjkr��SdS)z�Return the filename that can be used to locate an object's source.
    Return None if no way can be identified to get the source.
    Nc3s|]}��|�VqdSrf�r��rg�s��filenamer
rri�sz getsourcefile.<locals>.<genexpr>rc3s|]}��|�VqdSrfr�r�r�r
rri�s�
__loader__)r�r�r��DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXES�anyr�r��splitext�SOURCE_SUFFIXES�EXTENSION_SUFFIXES�existsrL�	getmodule�	linecache�cache)r	Zall_bytecode_suffixesr
r�r�
getsourcefile�s"
��
r�cCs,|dkrt|�pt|�}tj�tj�|��S)z�Return an absolute path to the source or compiled file for an object.

    The idea is for each object to have a unique origin, so this routine
    normalizes the result as much as possible.N)r�r�r�r��normcase�abspath)r	�	_filenamer
r
r�
getabsfile�sr�c
Cs�t|�r|St|d�r$tj�|j�S|dk	rD|tkrDtj�t|�Szt||�}Wntk
rhYdSX|tkr�tj�t|�Stj�	��
�D]\\}}t|�r�t|d�r�|j}|t�|d�kr�q�|t|<t|�}|j
t|<ttj�|�<q�|tk�rtj�t|�Stjd}t|d��s"dSt||j
��rJt||j
�}||k�rJ|Stjd}t||j
��r|t||j
�}	|	|k�r||SdS)zAReturn the module an object was defined in, or None if not found.r�Nr��__main__r��builtins)rrr�r�r�r��
modulesbyfiler�r��copyrKr��_filesbymodnamer�r�r��realpathrL)
r	r��file�modnamer�r(�mainZ
mainobjectZbuiltinZ
builtinobjectr
r
rr��sJ
�

�




r�cCs�t|�}|rt�|�n$t|�}|�d�r4|�d�s<td��t||�}|rZt�||j	�}n
t�|�}|sptd��t
|�r�|dfSt|��r |j}t
�d|d�}g}tt|��D]F}|�||�}|r�||ddkr�||fS|�|�d	�|f�q�|�r|��||dd	fStd
��t|��r0|j}t|��r@|j}t|��rP|j}t|��r`|j}t|��r�t|d��s~td��|jd	}	t
�d
�}|	dk�r�z||	}
Wnt k
�r�td��YnX|�|
��rؐq�|	d	}	�q�||	fStd��dS)abReturn the entire source file and starting line number for an object.

    The argument may be a module, class, method, function, traceback, frame,
    or code object.  The source code is returned as a list of all the lines
    in the file and the line number indexes a line in that list.  An OSError
    is raised if the source code cannot be retrieved.�<�>zsource code not availablezcould not get source coderz^(\s*)class\s*z\b�cr�zcould not find class definition�co_firstlinenoz"could not find function definitionz>^(\s*def\s)|(\s*async\s+def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)zlineno is out of boundszcould not find code objectN)!r�r��
checkcacher��
startswithr��OSErrorr��getlinesrJrrr��re�compiler�r��matchrZ�groupr]rr"rr&r<r�r>r�r@rr��
IndexError)r	r�r�r�rNZpatZ
candidatesr�r��lnumr�r
r
r�
findsourcesf










r�c	Cs.zt|�\}}Wnttfk
r*YdSXt|�r�d}|rT|ddd�dkrTd}|t|�krz||��dkrz|d}qT|t|�kr�||dd�dkr�g}|}|t|�kr�||dd�dkr�|�||���|d}q�d�|�S�n>|dk�r*t	||�}|d}|dk�r*||�
�dd�dk�r*t	||�|k�r*||���
�g}|dk�r�|d}||���
�}|dd�dk�r�t	||�|k�r�|g|dd�<|d}|dk�r��q�||���
�}�qt|�r�|d��dk�r�g|dd�<�q�|�r |d	��dk�r g|d	d�<�q�d�|�SdS)
zwGet lines of comments immediately preceding an object's source code.

    Returns None when source can't be found.
    Nr�z#!r�)��#r�r�r�)r�r�r�rr��striprZr�r�r�r�)r	r�r��startZcomments�endr�Zcommentr
r
r�getcommentsRsL
  

$�
$
r�c@seZdZdS)�
EndOfBlockN)r�r�r�r
r
r
rr�sr�c@s eZdZdZdd�Zdd�ZdS)�BlockFinderz@Provide a tokeneater() method to detect the end of a code block.cCs4d|_d|_d|_d|_d|_d|_d|_d|_dS)NrFr�)r��islambda�started�passline�indecorator�decoratorhasargs�last�	body_col0�r�r
r
r�__init__�szBlockFinder.__init__cCsr|jsB|jsB|dkrd|_n|dkr8|dkr2d|_d|_d|_�n,|dkrZ|jrVd|_�n|dkrv|jrtd|_d|_n�|tjkr�d|_|d|_|jr�t�|jr�|js�d|_n�|jr�n�|tj	kr�|j
dkr�|jr�|d	|_
|jd	|_d|_n�|tjk�r|jd	|_|jdk�rnt�nV|tj
k�rL|j
dk	�rn|d	|j
k�rn|d|_n"|jdk�rn|tj
tjfk�rnt�dS)
N�@T)�def�class�lambdar�(�)Frr�)r�r�r�r�r��tokenize�NEWLINEr�r��INDENTr�r��DEDENT�COMMENT�NL)r�r
�tokenZsrowcolZerowcolr�r
r
r�
tokeneater�sL





zBlockFinder.tokeneaterN)r�r�r�r�r�rr
r
r
rr��s
r�c	CsVt�}z(t�t|�j�}|D]}|j|�qWnttfk
rFYnX|d|j�S)z@Extract the block of code at the top of the given list of lines.N)	r�r�generate_tokens�iter�__next__rr��IndentationErrorr�)r�Zblockfinder�tokensZ_tokenr
r
r�getblock�srcCsbt|�}t|�\}}t|�r"|j}t|�s>t|�rF|jjdkrF|dfSt||d��|dfSdS)a�Return a list of source lines and starting line number for an object.

    The argument may be a module, class, method, function, traceback, frame,
    or code object.  The source code is returned as a list of the lines
    corresponding to the object and the line number indicates where in the
    original source file the first line of code was found.  An OSError is
    raised if the source code cannot be retrieved.z<module>rNr�)	r�r�r<r�rr>r��co_namer�r	r�r�r
r
r�getsourcelines�s�
�rcCst|�\}}d�|�S)aReturn the text of the source code for an object.

    The argument may be a module, class, method, function, traceback, frame,
    or code object.  The source code is returned as a single string.  An
    OSError is raised if the source code cannot be retrieved.r�)rr�rr
r
r�	getsource�srcCsRg}|jtdd�d�|D]2}|�||jf�||kr|�t||||��q|S)z-Recursive helper function for getclasstree().r�r�rT)r]rrZrM�walktree)�classes�children�parentr_r�r
r
rr�srFcCs�i}g}|D]d}|jr^|jD]>}||kr0g||<|||krJ||�|�|r||krqpqq||kr|�|�q|D]}||krv|�|�qvt||d�S)a�Arrange the given list of classes into a hierarchy of nested lists.

    Where a nested list appears, it contains classes derived from the class
    whose entry immediately precedes the list.  Each entry is a 2-tuple
    containing a class and a tuple of its base classes.  If the 'unique'
    argument is true, exactly one entry appears in the returned structure
    for each class in the given list.  Otherwise, classes using multiple
    inheritance and their descendants will appear multiple times.N)rMrZr)r�uniquer�rootsr�rr
r
r�getclasstree�s"	
r�	Argumentszargs, varargs, varkwc	Cs�t|�std�|���|j}|j}|j}t|d|��}t||||��}d}||7}d}|jt@rx|j|}|d}d}|jt	@r�|j|}t
||||�S)aGet information about the arguments accepted by a code object.

    Three things are returned: (args, varargs, varkw), where
    'args' is the list of argument names. Keyword-only arguments are
    appended. 'varargs' and 'varkw' are the names of the * and **
    arguments or None.z{!r} is not a code objectNrr�)r@r�r��co_varnames�co_argcount�co_kwonlyargcount�listr'�
CO_VARARGS�CO_VARKEYWORDSr)	�cora�nargsZnkwargs�args�
kwonlyargs�step�varargs�varkwr
r
r�getargss"



r,�ArgSpeczargs varargs keywords defaultscCsDtjdtdd�t|�\}}}}}}}|s.|r6td��t||||�S)aeGet the names and default values of a function's parameters.

    A tuple of four things is returned: (args, varargs, keywords, defaults).
    'args' is a list of the argument names, including keyword-only argument names.
    'varargs' and 'keywords' are the names of the * and ** parameters or None.
    'defaults' is an n-tuple of the default values of the last n parameters.

    This function is deprecated, as it does not support annotations or
    keyword-only parameters and will raise ValueError if either is present
    on the supplied callable.

    For a more structured introspection API, use inspect.signature() instead.

    Alternatively, use getfullargspec() for an API with a similar namedtuple
    based interface, but full support for annotations and keyword-only
    parameters.

    Deprecated since Python 3.5, use `inspect.getfullargspec()`.
    zhinspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()r���
stacklevelzgFunction has keyword-only parameters or annotations, use inspect.signature() API which can support them)�warnings�warn�DeprecationWarning�getfullargspecr�r-)r�r'r*r+�defaultsr(�kwonlydefaults�annr
r
r�
getargspec-s��r7�FullArgSpeczGargs, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotationsc
Cs|zt|ddtd�}Wn,tk
r@}ztd�|�W5d}~XYnXg}d}d}g}g}d}i}	d}i}
|j|jk	r||j|	d<|j��D]�}|j}|j	}
|t
kr�|�|
�|j|jk	r�||jf7}nv|t
kr�|�|
�|j|jk	r�||jf7}nJ|tkr�|
}n<|tk�r*|�|
�|j|jk	�r8|j|
|
<n|tk�r8|
}|j|jk	r�|j|	|
<q�|
�sZd}
|�sdd}t|||||||
|	�S)a$Get the names and default values of a callable object's parameters.

    A tuple of seven things is returned:
    (args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations).
    'args' is a list of the parameter names.
    'varargs' and 'varkw' are the names of the * and ** parameters or None.
    'defaults' is an n-tuple of the default values of the last n parameters.
    'kwonlyargs' is a list of keyword-only parameter names.
    'kwonlydefaults' is a dictionary mapping names from kwonlyargs to defaults.
    'annotations' is a dictionary mapping parameter names to annotations.

    Notable differences from inspect.signature():
      - the "self" parameter is always reported, even for bound methods
      - wrapper chains defined by __wrapped__ *not* unwrapped automatically
    F��follow_wrapper_chains�skip_bound_arg�sigclszunsupported callableNr
�return)�_signature_from_callable�	Signatureror��return_annotation�empty�
parameters�valuesrwrN�_POSITIONAL_ONLYrZ�default�_POSITIONAL_OR_KEYWORD�_VAR_POSITIONAL�
_KEYWORD_ONLY�_VAR_KEYWORD�
annotationr8)r��sig�exr'r*r+Zposonlyargsr(r4�annotations�
kwdefaults�paramrwrNr
r
rr3Nsb�






�r3�ArgInfozargs varargs keywords localscCs t|j�\}}}t||||j�S)a9Get information about arguments passed into a particular frame.

    A tuple of four things is returned: (args, varargs, varkw, locals).
    'args' is a list of the argument names.
    'varargs' and 'varkw' are the names of the * and ** arguments or None.
    'locals' is the locals dictionary of the given frame.)r,r�rP�f_locals)�framer'r*r+r
r
r�getargvalues�srScCsVt|dd�dkr t|��dd�St|t�rN|jd|fkr>|jS|jd|jSt|�S)Nr��typingztyping.r�r�r�)rL�repr�replacerr
r�r�)rJZbase_moduler
r
r�formatannotation�s
rWcst|dd���fdd�}|S)Nr�cs
t|��Srf)rW)rJ�r�r
r�_formatannotation�sz5formatannotationrelativeto.<locals>._formatannotation)rL)r	rYr
rXr�formatannotationrelativeto�srZr
cCsd|S�N�*r
�rNr
r
rrR�rSrRcCsd|S�N�**r
r]r
r
rrR�rScCsdt|�S�N�=�rU�rOr
r
rrR�rScCsd|S)Nz -> r
)�textr
r
rrR�rSc
s<ddlm}
|
dtdd����fdd�}g}|rBt|�t|�}t|�D]:\}}||�}|rz||krz||
|||�}|�|�qJ|dk	r�|�|||���n|r�|�d	�|r�|D]2}||�}|r�||kr�||
||�7}|�|�q�|dk	�r|�|	||���d
d�|�d}d
�k�r8||��d
��7}|S)a�Format an argument spec from the values returned by getfullargspec.

    The first seven arguments are (args, varargs, varkw, defaults,
    kwonlyargs, kwonlydefaults, annotations).  The other five arguments
    are the corresponding optional formatting functions that are called to
    turn names and values into strings.  The last argument is an optional
    function to format the sequence of arguments.

    Deprecated since Python 3.5: use the `signature` function and `Signature`
    objects.
    r)r1zc`formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directlyr�r.cs(�|�}|�kr$|d��|�7}|S)Nz: r
)�argru�rMrW�	formatargr
r�formatargandannotation�sz-formatargspec.<locals>.formatargandannotationNr\r�, rr=)r0r1r2r��	enumeraterZr�)r'r*r+r4r(r5rMrg�
formatvarargs�formatvarkw�formatvalueZ
formatreturnsrWr1rh�specsZfirstdefaultr�re�specZ	kwonlyargrur
rfr�
formatargspec�s<�


rpcCsd|Sr[r
r]r
r
rrRrScCsd|Sr^r
r]r
r
rrRrScCsdt|�Sr`rbrcr
r
rrRrScCs�|||fdd�}g}	tt|��D]}
|	�|||
��q |rV|	�||�|||��|rt|	�||�|||��dd�|	�dS)afFormat an argument spec from the 4 values returned by getargvalues.

    The first four arguments are (args, varargs, varkw, locals).  The
    next four arguments are the corresponding optional formatting functions
    that are called to turn names and values into strings.  The ninth
    argument is an optional function to format the sequence of arguments.cSs||�|||�Srfr
)rN�localsrgrmr
r
r�convertsz formatargvalues.<locals>.convertrrir)r�r�rZr�)r'r*r+rqrgrkrlrmrrrnr�r
r
r�formatargvaluess�
rscs��fdd�|D�}t|�}|dkr,|d}n>|dkr@dj|�}n*dj|dd��}|dd�=d	�|�|}td
|||rzdnd|dkr�d
nd|f��dS)Ncsg|]}|�krt|��qSr
rb)rgrN�rCr
rr�sz&_missing_arguments.<locals>.<listcomp>r�rr�z	{} and {}z, {} and {}���riz*%s() missing %i required %s argument%s: %s�
positional�keyword-onlyr�r�)r�r�r�r�)�f_nameZargnames�posrCra�missingr��tailr
rtr�_missing_argumentss 


��r|c
	s�t|�|}t�fdd�|D��}|r:|dk}	d|f}
n2|rTd}	d|t|�f}
nt|�dk}	tt|��}
d}|r�d}||dkr�d	nd||dkr�d	ndf}td
||
|	r�d	nd|||dkr�|s�dndf��dS)
Ncsg|]}|�kr|�qSr
r
)rgrertr
rr�)sz_too_many.<locals>.<listcomp>r�zat least %dTz
from %d to %dr�z7 positional argument%s (and %d keyword-only argument%s)r�z5%s() takes %s positional argument%s but %d%s %s givenZwasZwere)r�r�r�)
rxr'Zkwonlyr*ZdefcountZgivenrCZatleastZkwonly_givenZpluralrKZ
kwonly_sig�msgr
rtr�	_too_many's*���r~cOst|�}|\}}}}}}	}
|j}i}t|�rB|jdk	rB|jf|}t|�}
t|�}|r^t|�nd}t|
|�}t|�D]}|||||<qt|r�t||d��||<t||�}|r�i||<|�	�D]T\}}||kr�|s�t
d||f��||||<q�||k�rt
d||f��|||<q�|
|k�r<|�s<t||||||
|�|
|k�r�|d||�}|D]}||k�rZt||d|��qZt
|||d��D] \}}||k�r�||||<�q�d}|D]6}||k�r�|	�r�||	k�r�|	|||<n|d7}�q�|�rt||d|�|S)z�Get the mapping of arguments to values.

    A dict is returned, with keys the function argument names (including the
    names of the * and ** arguments, if any), and values the respective bound
    values from 'positional' and 'named'.Nrz*%s() got an unexpected keyword argument %rz(%s() got multiple values for argument %rTr�F)r3r�rr�r�r�r�rnrWrKr�r~r|rj)r�rvZnamedror'r*r+r4r(r5r6rxZ	arg2valueZnum_posZnum_argsZnum_defaults�nr�Zpossible_kwargs�kwrOZreqrerz�kwargr
r
r�getcallargs<sh
�
�
�



r��ClosureVarsz"nonlocals globals builtins unboundc	Cs�t|�r|j}t|�s$td�|���|j}|jdkr:i}ndd�t|j|j�D�}|j	}|�
dtj�}t
|�rt|j}i}i}t�}|jD]d}|dkr�q�z||||<Wq�tk
r�z||||<Wntk
r�|�|�YnXYq�Xq�t||||�S)a
    Get the mapping of free variables to their current values.

    Returns a named tuple of dicts mapping the current nonlocal, global
    and builtin references as seen by the body of the function. A final
    set of unbound names that could not be resolved is also provided.
    �{!r} is not a Python functionNcSsi|]\}}||j�qSr
)�
cell_contents)rg�varZcellr
r
r�
<dictcomp>�s�z"getclosurevars.<locals>.<dictcomp>�__builtins__)�None�True�False)rr"rr�r�r&�__closure__�zip�co_freevars�__globals__r�r�rJrrW�co_names�KeyErrorr\r�)	r��codeZ
nonlocal_varsZ	global_nsZ
builtin_nsZglobal_varsZbuiltin_varsZ
unbound_namesrNr
r
r�getclosurevarszs>	
�
�r��	Tracebackz+filename lineno function code_context indexr�cCs�t|�r|j}|j}n|j}t|�s2td�|���t|�p@t|�}|dkr�|d|d}zt	|�\}}Wnt
k
r�d}}Yq�Xtdt|t
|�|��}||||�}|d|}nd}}t|||jj||�S)a�Get information about a frame or traceback object.

    A tuple of five things is returned: the filename, the line number of
    the current line, the function name, a list of lines of context from
    the source code, and the index of the current line within that list.
    The optional second argument specifies the number of lines of context
    to return, which are centered around the current line.z'{!r} is not a frame or traceback objectrr�r�N)r<�	tb_linenor��f_linenor>r�r�r�r�r�r��maxr�r�r�r�r)rR�context�linenor�r�r�r��indexr
r
r�getframeinfo�s$r�cCs|jS)zCGet the line number from a frame object, allowing for optimization.)r��rRr
r
r�	getlineno�sr��	FrameInfor�cCs2g}|r.|ft||�}|�t|��|j}q|S)z�Get a list of records for a frame and all higher (calling) frames.

    Each record contains a frame object, filename, line number, function
    name, a list of lines of context, and index within the context.)r�rZr��f_back)rRr��	framelist�	frameinfor
r
r�getouterframes�sr�cCs4g}|r0|jft||�}|�t|��|j}q|S)z�Get a list of records for a traceback's frame and all lower frames.

    Each record contains a frame object, filename, line number, function
    name, a list of lines of context, and index within the context.)r�r�rZr��tb_next)�tbr�r�r�r
r
r�getinnerframes�sr�cCsttd�rt�d�SdS)z?Return the frame of the caller or None if this is not possible.�	_getframer�N)rr�r�r
r
r
r�currentframe�sr�cCstt�d�|�S)z@Return a list of records for the stack above the caller's frame.r�)r�r�r��r�r
r
r�stack�sr�cCstt��d|�S)zCReturn a list of records for the stack below the current exception.r�)r�r��exc_infor�r
r
r�trace�sr�cCstjd�|�S)Nry)r
rJr)�klassr
r
r�_static_getmrosr�cCs8i}zt�|d�}Wntk
r(YnXt�||t�S�NrJ)r	�__getattribute__r[r�r��	_sentinel)r,�attrZ
instance_dictr
r
r�_check_instancesr�c	CsHt|�D]:}tt|��tkrz|j|WStk
r@YqXqtSrf)r��_shadowed_dictr
r�rJr�)r�r��entryr
r
r�_check_class
sr�cCs(zt|�Wntk
r"YdSXdS�NFT)r�r�r+r
r
r�_is_types
r�c	Csntjd}t|�D]V}z|�|�d}Wntk
r<YqXt|�tjkr`|jdkr`|j|ks|Sqt	Sr�)
r
rJr�rr�rrr�rjr�)r��	dict_attrr�Z
class_dictr
r
rr�s
��
r�c	Cst}t|�s>t|�}t|�}|tks2t|�tjkrBt||�}n|}t||�}|tk	r�|tk	r�tt|�d�tk	r�tt|�d�tk	r�|S|tk	r�|S|tk	r�|S||kr�tt|��D]:}tt|��tkr�z|j	|WSt
k
r�Yq�Xq�|tk	r�|St|��dS)a�Retrieve attributes without triggering dynamic lookup via the
       descriptor protocol,  __getattr__ or __getattribute__.

       Note: this function may not be able to retrieve all attributes
       that getattr can fetch (like dynamically created attributes)
       and may find attributes that getattr can't (like descriptors
       that raise AttributeError). It can also return descriptor objects
       instead of instance members in some cases. See the
       documentation for details.
    rrN)r�r�r
r�rrr�r�r�rJr�r[)r,r�rEZinstance_resultr�r�Zklass_resultr�r
r
r�getattr_static+s:�
�r��GEN_CREATED�GEN_RUNNING�
GEN_SUSPENDED�
GEN_CLOSEDcCs,|jr
tS|jdkrtS|jjdkr(tStS)a#Get current state of a generator-iterator.

    Possible states are:
      GEN_CREATED: Waiting to start execution.
      GEN_RUNNING: Currently being executed by the interpreter.
      GEN_SUSPENDED: Currently suspended at a yield expression.
      GEN_CLOSED: Execution has completed.
    Nr�)�
gi_runningr��gi_framer��f_lastir�r�)�	generatorr
r
r�getgeneratorstate`s	
r�cCs:t|�std�|���t|dd�}|dk	r2|jjSiSdS)z�
    Get the mapping of generator local variables to their current values.

    A dict is returned, with the keys the local variable names and values the
    bound values.z{!r} is not a Python generatorr�N)r3r�r�rLr�rQ)r�rRr
r
r�getgeneratorlocalsrsr��CORO_CREATED�CORO_RUNNING�CORO_SUSPENDED�CORO_CLOSEDcCs,|jr
tS|jdkrtS|jjdkr(tStS)a&Get current state of a coroutine object.

    Possible states are:
      CORO_CREATED: Waiting to start execution.
      CORO_RUNNING: Currently being executed by the interpreter.
      CORO_SUSPENDED: Currently suspended at an await expression.
      CORO_CLOSED: Execution has completed.
    Nr�)�
cr_runningr��cr_framer�r�r�r�)�	coroutiner
r
r�getcoroutinestate�s	
r�cCs"t|dd�}|dk	r|jSiSdS)z�
    Get the mapping of coroutine local variables to their current values.

    A dict is returned, with the keys the local variable names and values the
    bound values.r�N)rLrQ)r�rRr
r
r�getcoroutinelocals�sr��
from_bytescCs8zt||�}Wntk
r$YdSXt|t�s4|SdS)z�Private helper. Checks if ``cls`` has an attribute
    named ``method_name`` and returns it only if it is a
    pure python function.
    N)rLr[r�_NonUserDefinedCallables)rhZmethod_nameZmethr
r
r�"_signature_get_user_defined_method�s
r�c
Cs�|j}t|���}|jpd}|jp$i}|r2||}z|j||�}Wn6tk
rx}zd�|�}	t|	�|�W5d}~XYnXd}
|��D�]\}}z|j	|}
Wnt
k
r�YnlX|jtkr�|�
|�q�|jtk�r||kr�d}
|j|
d�||<n|�
|j�q�|jtk�r|j|
d�||<|
r�|jtk	�s2t�|jtk�rb||jtd�}|||<|�|�q�|jttfk�r~|�|�q�|jtkr�|�
|j�q�|j|��d�S)	z�Private helper to calculate how 'wrapped_sig' signature will
    look like after applying a 'functools.partial' object (or alike)
    on it.
    r
z+partial object {!r} has incorrect argumentsNFT)rE�rw�rB)rBrrKr'�keywords�bind_partialr�r�r��	argumentsr�rwrDr�rFrVrNrH�AssertionError�move_to_endrIrGrC)�wrapped_sig�partialZ
extra_argsZ
old_params�
new_paramsZpartial_argsZpartial_keywordsZbarLr}Ztransform_to_kwonly�
param_namerOZ	arg_valueZ	new_paramr
r
r�_signature_get_partial�sN






r�cCslt|j���}|r$|djttfkr,td��|dj}|ttfkrP|dd�}n|t	k	r`td��|j
|d�S)zWPrivate helper to transform signatures for unbound
    functions to bound methods.
    rzinvalid method signaturer�Nzinvalid argument typer�)rnrBrCrwrIrHr�rFrDrGrV)rK�paramsrwr
r
r�_signature_bound_methods
r�cCs&t|�p$t|�p$t|t�p$|ttfkS)zxPrivate helper to test if `obj` is a callable that might
    support Argument Clinic's __text_signature__ protocol.
    )rBrrr�r
r	r+r
r
r�_signature_is_builtin.s��
�r�cCs�t|�rt|�rdSt|dd�}t|dd�}t|dt�}t|dt�}t|dd�}t|tj�o�t|t�o�|dksxt|t�o�|dks�t|t	�o�t|t	�S)z�Private helper to test if `obj` is a duck type of FunctionType.
    A good example of such objects are functions compiled with
    Cython, which have all attributes that a pure Python function
    would have, but have their code statically compiled.
    Fr�Nr&�__defaults__�__kwdefaults__�__annotations__)
�callablerrL�_voidrrr?r�rnr�)r,rNr�r4rNrMr
r
r�_signature_is_functionlike:s ����r�cCsr|�d�st�|�d�}|dkr*|�d�}|�d�}|dksH||ksHt�|�d�}|dksf||ksft�|d|�S)z� Private helper to get first parameter name from a
    __text_signature__ of a builtin method, which should
    be in the following format: '($param1, ...)'.
    Assumptions are that the first argument won't have
    a default value or an annotation.
    z($�,r�r�:rar�)r�r��find)roryZcposr
r
r�_signature_get_bound_paramSs



r�cCsd|s|ddfSd}d}dd�|�d�D�}t|�j}t�|�}d}d}g}|j}	d}
tj}tj}t|�}
|
j	tj
ksxt�|D]�}
|
j	|
j}}||kr�|dkr�|r�d}q||r�t�d}|
d	7}
q||d
kr�|r�t�|dks�t�d}|
d	}q|||k�r|dk�r|dk�s
t�|
}q||�r6d}||k�r.|dk�s6|	d
�|	|�|dkr||	d�q|d�
|�}|||fS)a�
    Private helper function. Takes a signature in Argument Clinic's
    extended signature format.

    Returns a tuple of three things:
      * that signature re-rendered in standard Python syntax,
      * the index of the "self" parameter (generally 0), or None if
        the function does not have a "self" parameter, and
      * the index of the last "positional only" parameter,
        or None if the signature has no positional-only parameters.
    NcSsg|]}|�d��qS)�ascii)�encode)rg�lr
r
rr�}sz6_signature_strip_non_python_syntax.<locals>.<listcomp>r�Frr�Tr��/�$rri� r�)r�rrrrZr�OP�
ERRORTOKEN�nextr
�ENCODINGr��stringr�)�	signature�self_parameter�last_positional_onlyr�r�Ztoken_streamZ
delayed_commaZskip_next_commardr\Zcurrent_parameterr�r��tr
r��clean_signaturer
r
r�"_signature_strip_non_python_syntaxjsZ





r�Tc	sjddl�|j�t|�\}}}d|d}z��|�}Wntk
rNd}YnXt|�j�sjtd�|���|j	d}	g��j
�t��d}i�t|dd�}
|
r�t
j�|
d�}|r�|j�t
j���	�fdd�����	fd	d
��
G��
fdd�d�j���f��������fd
d�	}t|	jj�}t|	jj�}
tj||
dd�}|dk	�rJ�j�n�j�ttt|���D](\}\}}|||�||k�r`�j��q`|	jj�r��j�||	jj���j�t|	jj |	jj!�D]\}}|||��q�|	jj"�r�j#�||	jj"��|dk	�r\��st$�t|dd�}|dk	}t%|�}|�rB|�s6|�rB��&d�n�dj'�jd�}|�d<|�|j
d�S)zdPrivate helper to parse content of '__text_signature__'
    and return a Signature based on it.
    rNzdef fooz: passz"{!r} builtin has invalid signaturer�cs(t|�j�st�|jdk	r"td��|jS)Nz'Annotations are not currently supported)rrer�rJr�)�node)�astr
r�
parse_name�s
z&_signature_fromstr.<locals>.parse_namecs|zt|��}Wn>tk
rLzt|��}Wntk
rFt��YnXYnXt|tttttt	d�f�rr��
|�St��dSrf)�eval�	NameError�RuntimeErrorrr��int�float�bytesr%r
ZConstant)r�rO)r��module_dict�sys_module_dictr
r�
wrap_value�s
z&_signature_fromstr.<locals>.wrap_valuecs(eZdZ��fdd�Z��fdd�ZdS)z,_signature_fromstr.<locals>.RewriteSymbolicscs\g}|}t|�j�r(|�|j�|j}qt|�j�s:t��|�|j�d�t	|��}�|�S)Nr�)
rrerZr�rO�Namer�r�r��reversed)r�r��arrO�r�rr
r�visit_Attribute�sz<_signature_fromstr.<locals>.RewriteSymbolics.visit_Attributecst|j�j�st���|j�Srf)rZctxZLoadr�r�)r�r�r	r
r�
visit_Name�sz7_signature_fromstr.<locals>.RewriteSymbolics.visit_NameN)r�r�r�r
rr
r	r
r�RewriteSymbolics�srcs��|�}|�krdS|rp|tk	rpz���|�}��|�}Wntk
rR�}YnX|�kr`dS|�k	rl|n|}���|�|�d��dS)N�rErJ)�_emptyZvisitZliteral_evalr�rZ)Z	name_nodeZdefault_noderErN�o)�	Parameterrr�rA�invalidrwrBr�r
r�p�s
z_signature_fromstr.<locals>.p)�	fillvaluer�r��r@)(r��_parameter_clsr��parse�SyntaxErrorrZModuler�r�ZbodyrAr	rLr�r�r�rJr�ZNodeTransformerrr'r4�	itertools�zip_longest�POSITIONAL_ONLY�POSITIONAL_OR_KEYWORDrjr"Zvararg�VAR_POSITIONAL�KEYWORD_ONLYr�r(Zkw_defaultsr��VAR_KEYWORDr�rr�rV)rhr,r�r;r�r�r�Zprogramr�r(Zmodule_namerr'r4rr�rNrEZ_selfZself_isboundZ
self_ismoduler
)rrr�rArrwrrBr�rrr�_signature_fromstr�sp�











rcCsBt|�std�|���t|dd�}|s4td�|���t||||�S)zHPrivate helper function to get signature for
    builtin callables.
    z%{!r} is not a Python builtin function�__text_signature__Nz#no signature found for builtin {!r})r�r�r�rLr�r)rhr�r;r�r
r
r�_signature_from_builtin<s�r!c	CsHd}t|�s(t|�rd}ntd�|���t|dd�}|rFt||||�S|j}|j}|j}|j	}|j
}	|d|�}
|j}||||�}|j}
|j
}|j}|r�t|�}nd}g}||}|	}|
d|�D]<}|r�tnt}|
�|t�}|�||||d��|r�|d8}q�t|
|d��D]L\}}|�r&tnt}|
�|t�}|�||||||d	��|�r|d8}�q|jt@�r�|||}|
�|t�}|�|||td��|D]B}t}|dk	�r�|�|t�}|
�|t�}|�|||t|d	���q�|jt@�r2||}|jt@�r
|d7}||}|
�|t�}|�|||td��|||
�d
t�|d�S)zCPrivate helper: constructs Signature for the given python function.FTr�r Nr)rJrwr�)rJrwrEr=�r@�__validate_parameters__)rr�r�r�rLrrr&r r�co_posonlyargcountr!r�r�r�r�rDrFr�rrZrjr'r#rGrHr$rI)rhr�r;Zis_duck_functionr�rZ	func_codeZ	pos_countZ	arg_namesZ
posonly_countrvZkeyword_only_countZkeyword_onlyrMr4rNZpos_default_countrBZnon_default_countZposonly_leftrNrwrJ�offsetrEr�r
r
r�_signature_from_functionLs�

�

�
�

�
�
�r&)r:r;c
Cs�t|�std�|���t|tj�rDt|j|||d�}|r@t|�S|S|rtt	|dd�d�}t|tj�rtt||||d�Sz
|j
}Wntk
r�Yn&X|dk	r�t|t�s�td�|���|Sz
|j
}Wntk
r�Yn�Xt|tj��rdt|j|||d�}t||d�}t|j���d	}|jtjk�r(|St|j���}|�rN||d	k	�sNt�|f|}	|j|	d
�St|��sxt|��r�t|||d�St|��r�t|||d�St|tj��r�t|j|||d�}t||�Sd}t|t ��r�t!t |�d�}
|
dk	�rt|
|||d�}nJt!|d
�}|dk	�r(t||||d�}n$t!|d�}|dk	�rLt||||d�}|dk�rX|j"dd�D]>}
z
|
j#}Wntk
�r�YnX|�rdt$|||�S�qdt |j"k�rX|j%t&j%k�r�|j't&j'k�r�|�(t&�St)d�|���nrt|t*��sXt!t |�d�}
|
dk	�rXzt|
|||d�}Wn8t)k
�rV}zd�|�}t)|�|�W5d}~XYnX|dk	�rt|�rpt|�S|St|tj+��r�d�|�}t)|��t)d�|���dS)zQPrivate helper function to get signature for arbitrary
    callable objects.
    z{!r} is not a callable objectr9cSs
t|d�S)N�
__signature__r~rr
r
rrR�rSz*_signature_from_callable.<locals>.<lambda>rzNz1unexpected object {!r} in __signature__ attributerfrr�)r;�__call__�__new__r�r�z(no signature found for builtin type {!r}zno signature found for {!r}z,no signature found for builtin function {!r}z+callable {!r} is not supported by signature),r�r�r�rrrr>r"r�r�r'r[r?�_partialmethodr#�
partialmethodr�r�rnrBrCrwrrr�rVrr�r&r�r!r�r
r�ryr rr�r	r)�
from_callabler�r�rA)r,r:r;r<rKr+r�Zfirst_wrapped_paramZ
sig_paramsr�Zcall�newZinitrPZtext_sigrLr}r
r
rr>�s
	��

��
�
�
�
��

�

�

�


�
�
�



r>c@seZdZdZdS)r�z1A private marker - used in Parameter & Signature.N�r�r�r�r�r
r
r
rr�t	sr�c@seZdZdZdS)rz6Marker object for Signature.empty and Parameter.empty.Nr.r
r
r
rrx	src@s4eZdZdZdZdZdZdZdd�Ze	dd	��Z
d
S)�_ParameterKindrr�r���cCs|jSrf)�_name_r�r
r
r�__str__�	sz_ParameterKind.__str__cCst|Srf)�_PARAM_NAME_MAPPINGr�r
r
r�description�	sz_ParameterKind.descriptionN)r�r�r�rrrrrr3rkr5r
r
r
rr/|	sr/zpositional-onlyzpositional or keywordzvariadic positionalrwzvariadic keywordc@s�eZdZdZdZeZeZe	Z
eZe
ZeZeed�dd�Zdd�Zdd	�Zed
d��Zedd
��Zedd��Zedd��Zeeeed�dd�Zdd�Zdd�Zdd�Zdd�ZdS)raRepresents a parameter in a function signature.

    Has the following public attributes:

    * name : str
        The name of the parameter as a string.
    * default : object
        The default value for the parameter if specified.  If the
        parameter has no default value, this attribute is set to
        `Parameter.empty`.
    * annotation
        The annotation for the parameter if specified.  If the
        parameter has no annotation, this attribute is set to
        `Parameter.empty`.
    * kind : str
        Describes how argument values are bound to the parameter.
        Possible values: `Parameter.POSITIONAL_ONLY`,
        `Parameter.POSITIONAL_OR_KEYWORD`, `Parameter.VAR_POSITIONAL`,
        `Parameter.KEYWORD_ONLY`, `Parameter.VAR_KEYWORD`.
    )�_name�_kind�_default�_annotationr
cCszt|�|_Wn$tk
r2td|�d���YnX|tk	rd|jttfkrdd}|�|jj�}t|��||_||_	|tkr�td��t
|t�s�d�t|�j
�}t|��|ddkr�|dd���r�|jtkr�d	}|�|jj�}t|��t|_d
�|dd��}|���std�|���||_dS)Nzvalue z is not a valid Parameter.kindz({} parameters cannot have default valuesz*name is a required attribute for Parameterzname must be a str, not a {}rr�r�zLimplicit arguments must be passed as positional or keyword arguments, not {}z
implicit{}z"{!r} is not a valid parameter name)r/r7r�rrGrIr�r5r8r9rr�r
r�r��isdigitrFrD�isidentifierr6)r�rNrwrErJr}r
r
rr��	s6

�
zParameter.__init__cCs t|�|j|jf|j|jd�fS)N�r8r9)r
r6r7r8r9r�r
r
r�
__reduce__�	s
��zParameter.__reduce__cCs|d|_|d|_dS)Nr8r9r<�r��stater
r
r�__setstate__�	s
zParameter.__setstate__cCs|jSrf)r6r�r
r
rrN�	szParameter.namecCs|jSrf)r8r�r
r
rrE�	szParameter.defaultcCs|jSrf)r9r�r
r
rrJ�	szParameter.annotationcCs|jSrf)r7r�r
r
rrw�	szParameter.kind)rNrwrJrEcCsL|tkr|j}|tkr|j}|tkr*|j}|tkr8|j}t|�||||d�S)z+Creates a customized copy of the Parameter.r
)r�r6r7r9r8r
)r�rNrwrJrEr
r
rrV�	szParameter.replacecCs�|j}|j}|jtk	r(d�|t|j��}|jtk	rb|jtk	rPd�|t|j��}nd�|t|j��}|tkrtd|}n|t	kr�d|}|S)Nz{}: {}z{} = {}z{}={}r\r_)
rwr6r9rr�rWr8rUrGrI)r�rw�	formattedr
r
rr3
s
�


zParameter.__str__cCsd�|jj|�S)Nz	<{} "{}">�r�r�r�r�r
r
r�__repr__#
szParameter.__repr__cCst|j|j|j|jf�Srf)�hashrNrwrJrEr�r
r
r�__hash__&
szParameter.__hash__cCsJ||krdSt|t�stS|j|jkoH|j|jkoH|j|jkoH|j|jkS�NT)rr�NotImplementedr6r7r8r9�r��otherr
r
r�__eq__)
s

�
�
�zParameter.__eq__N)r�r�r�r�r�rDrrFrrGrrHrrIrrrAr�r=r@rkrNrErJrwr�rVr3rCrErJr
r
r
rr�	s6(



�rc@sheZdZdZdZdd�Zedd��Zedd��Zed	d
��Z	dd�Z
d
d�Zdd�Zdd�Z
dd�ZdS)�BoundArgumentsaResult of `Signature.bind` call.  Holds the mapping of arguments
    to the function's parameters.

    Has the following public attributes:

    * arguments : OrderedDict
        An ordered mutable mapping of parameters' names to arguments' values.
        Does not contain arguments' default values.
    * signature : Signature
        The Signature object that created this instance.
    * args : tuple
        Tuple of positional arguments values.
    * kwargs : dict
        Dict of keyword arguments values.
    )r��
_signature�__weakref__cCs||_||_dSrf)r�rL)r�r�r�r
r
rr�G
szBoundArguments.__init__cCs|jSrf)rLr�r
r
rr�K
szBoundArguments.signaturec	Cs~g}|jj��D]d\}}|jttfkr*qvz|j|}Wntk
rRYqvYqX|jtkrj|�	|�q|�
|�qt|�Srf)rLrBrKrwrIrHr�r�rG�extendrZrn)r�r'r�rOrer
r
rr'O
s
zBoundArguments.argsc	Cs�i}d}|jj��D]x\}}|sD|jttfkr4d}n||jkrDd}q|sJqz|j|}Wntk
rlYqX|jtkr�|�|�q|||<q|Sr�)	rLrBrKrwrIrHr�r��update)r��kwargsZkwargs_startedr�rOrer
r
rrPf
s&


zBoundArguments.kwargsc	Cs�|j}g}|jj��D]x\}}z|�|||f�Wqtk
r�|jtk	rV|j}n$|jt	krfd}n|jt
krvi}nYq|�||f�YqXqt|�|_dS)z�Set default values for missing arguments.

        For variable-positional arguments (*args) the default is an
        empty tuple.

        For variable-keyword arguments (**kwargs) the default is an
        empty dict.
        r
N)r�rLrBrKrZr�rErrwrGrIr)r�r�Z
new_argumentsrNrO�valr
r
r�apply_defaults�
s	


zBoundArguments.apply_defaultscCs2||krdSt|t�stS|j|jko0|j|jkSrF)rrKrGr�r�rHr
r
rrJ�
s

�zBoundArguments.__eq__cCs|d|_|d|_dS)NrLr��rLr�r>r
r
rr@�
s
zBoundArguments.__setstate__cCs|j|jd�S)NrSrSr�r
r
r�__getstate__�
szBoundArguments.__getstate__cCs@g}|j��D]\}}|�d�||��qd�|jjd�|��S)Nz{}={!r}z	<{} ({})>ri)r�rKrZr�r�r�r�)r�r'rerOr
r
rrC�
szBoundArguments.__repr__N)r�r�r�r�r�r�rkr�r'rPrRrJr@rTrCr
r
r
rrK4
s


rKc@s�eZdZdZdZeZeZe	Z
d,e	dd�dd�Zedd	��Z
ed
d��Zedd�d
d��Zedd��Zedd��Zeed�dd�Zdd�Zdd�Zdd�Zdd�dd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�ZdS)-r?aA Signature object represents the overall signature of a function.
    It stores a Parameter object for each parameter accepted by the
    function, as well as information specific to the function itself.

    A Signature object has the following public attributes and methods:

    * parameters : OrderedDict
        An ordered mapping of parameters' names to the corresponding
        Parameter objects (keyword-only arguments are in the same order
        as listed in `code.co_varnames`).
    * return_annotation : object
        The annotation for the return type of the function if specified.
        If the function has no annotation for its return type, this
        attribute is set to `Signature.empty`.
    * bind(*args, **kwargs) -> BoundArguments
        Creates a mapping from positional and keyword arguments to
        parameters.
    * bind_partial(*args, **kwargs) -> BoundArguments
        Creates a partial mapping from positional and keyword arguments
        to parameters (simulating 'functools.partial' behavior.)
    )�_return_annotation�_parametersNTr"cCs�|dkrt�}n�|r�t�}t}d}t|�D]�\}}|j}	|j}
|	|krdd}|�|j|	j�}t|��n|	|krtd}|	}|	ttfkr�|j	t
kr�|r�d}t|��nd}|
|kr�d�|
�}t|��|||
<q*ntdd�|D��}t�|�|_
||_dS)	z�Constructs Signature from the given list of Parameter
        objects and 'return_annotation'.  All arguments are optional.
        NFz7wrong parameter order: {} parameter before {} parameterz-non-default argument follows default argumentTzduplicate parameter name: {!r}css|]}|j|fVqdSrfr]�rgrOr
r
rris�z%Signature.__init__.<locals>.<genexpr>)rrDrjrwrNr�r5r�rFrErr�MappingProxyTyperVrU)r�rBr@r#r�Ztop_kindZ
kind_defaults�idxrOrwrNr}r
r
rr��
sD��



�zSignature.__init__cCstjdtdd�t||�S)z�Constructs Signature for the given python function.

        Deprecated since Python 3.5, use `Signature.from_callable()`.
        z_inspect.Signature.from_function() is deprecated since Python 3.5, use Signature.from_callable()r�r.)r0r1r2r&�rhr�r
r
r�
from_functions
�zSignature.from_functioncCstjdtdd�t||�S)z�Constructs Signature for the given builtin function.

        Deprecated since Python 3.5, use `Signature.from_callable()`.
        z^inspect.Signature.from_builtin() is deprecated since Python 3.5, use Signature.from_callable()r�r.)r0r1r2r!rZr
r
r�from_builtins
�zSignature.from_builtin��follow_wrappedcCst|||d�S)z3Constructs Signature for the given callable object.)r<r:)r>)rhr,r^r
r
rr,#s�zSignature.from_callablecCs|jSrf)rVr�r
r
rrB)szSignature.parameterscCs|jSrf�rUr�r
r
rr@-szSignature.return_annotation)rBr@cCs0|tkr|j��}|tkr |j}t|�||d�S)z�Creates a customized copy of the Signature.
        Pass 'parameters' and/or 'return_annotation' arguments
        to override them in the new copy.
        r)r�rBrCrUr
)r�rBr@r
r
rrV1s
�zSignature.replacecCs8tdd�|j��D��}dd�|j��D�}|||jfS)Ncss|]}|jtkr|VqdSrf)rwrHrWr
r
rriAs
�z(Signature._hash_basis.<locals>.<genexpr>cSsi|]}|jtkr|j|�qSr
)rwrHrNrWr
r
rr�Ds
�z)Signature._hash_basis.<locals>.<dictcomp>)rnrBrCr@)r�r��
kwo_paramsr
r
r�_hash_basis@szSignature._hash_basiscCs(|��\}}}t|���}t|||f�Srf)ra�	frozensetrCrD)r�r�r`r@r
r
rrEIszSignature.__hash__cCs*||krdSt|t�stS|��|��kSrF)rr?rGrarHr
r
rrJNs

zSignature.__eq__F�r�cCs�t�}t|j���}d}t|�}zt|�}Wn�tk
�rzt|�}	Wntk
rfYY�q�Yn�X|	jtkrzY�q�n�|	j|kr�|	jt	kr�d}
|
j
|	jd�}
t|
�d�|	f}Y�q�nP|	jtks�|	j
tk	r�|	f}Y�q�n.|r�|	f}Y�q�nd}
|
j
|	jd�}
t|
�d�Yq Xzt|�}	Wn tk
�r:td�d�Yq X|	jttfk�rVtd�d�|	jtk�r�|g}|�|�t|�||	j<�q�|	j|k�r�|	jt	k�r�tdj
|	jd��d�|||	j<q d}t�||�D]�}	|	jtk�r�|	}�q�|	jtk�r�q�|	j}
z|�|
�}WnFtk
�rN|�sJ|	jtk�rJ|	j
tk�rJtdj
|
d��d�Yn(X|	jt	k�rntdj
|	jd���|||
<�q�|�r�|dk	�r�|||j<ntdj
tt|��d���|�||�S)	z#Private method. Don't use directly.r
zA{arg!r} parameter is positional only, but was passed as a keyword)reNz$missing a required argument: {arg!r}ztoo many positional argumentsz$multiple values for argument {arg!r}z*got an unexpected keyword argument {arg!r})rrrBrCr��
StopIterationrwrGrNrDr�r�rIrErrHrNrnr�chainr�r��_bound_arguments_cls)r�r'rPr�r�rBZ
parameters_exZarg_valsZarg_valrOr}rCZkwargs_paramr�r
r
r�_bindUs�




���
�������

��zSignature._bindcOs|�||�S)z�Get a BoundArguments object, that maps the passed `args`
        and `kwargs` to the function's signature.  Raises `TypeError`
        if the passed arguments can not be bound.
        �rg�r�r'rPr
r
r�bind�szSignature.bindcOs|j||dd�S)z�Get a BoundArguments object, that partially maps the
        passed `args` and `kwargs` to the function's signature.
        Raises `TypeError` if the passed arguments can not be bound.
        Trcrhrir
r
rr��szSignature.bind_partialcCs t|�t|j���fd|jifS�NrU)r
rnrVrCrUr�r
r
rr=�s�zSignature.__reduce__cCs|d|_dSrkr_r>r
r
rr@�szSignature.__setstate__cCsd�|jj|�S)Nz<{} {}>rBr�r
r
rrC�szSignature.__repr__c	Cs�g}d}d}|j��D]d}t|�}|j}|tkr6d}n|rH|�d�d}|tkrVd}n|tkrp|rp|�d�d}|�|�q|r�|�d�d�d�	|��}|j
tk	r�t|j
�}|d�|�7}|S)NFTr�r\z({})riz -> {})
rBrCr�rwrDrZrGrHr�r�r@rrW)	r�ruZrender_pos_only_separatorZrender_kw_only_separatorrOrArwZrenderedZannor
r
rr3�s0




zSignature.__str__)N)r�r�r�r�r�rrrKrfrrAr�rsr[r\r,rkrBr@r�rVrarErJrgrjr�r=r@rCr3r
r
r
rr?�
s<�7



	r?r]cCstj||d�S)z/Get a signature object for the passed callable.r])r?r,)r,r^r
r
rr�sr�c
Cs�ddl}ddl}|��}|jddd�|jdddd	d
�|��}|j}|�d�\}}}z|�|�}}	WnNtk
r�}
z0d�	|t
|
�j|
�}t|t
jd
�t
�d�W5d}
~
XYnX|r�|�d�}|	}|D]}
t||
�}q�|	jt
jk�rtdt
jd
�t
�d�|j�r�td�	|��td�	t|	���td�	|	j��||	k�rxtd�	t|	j���t|	d��r�td�	|	j��n6zt|�\}}Wntk
�r�YnXtd�	|��td�ntt|��dS)z6 Logic for inspecting an object given at command line rNr	zCThe object to be analysed. It supports the 'module:qualname' syntax)�helpz-dz	--details�
store_truez9Display info about the module rather than its source code)�actionrlr�zFailed to import {} ({}: {}))r�r�r�z#Can't get info for builtin modules.r�z
Target: {}z
Origin: {}z
Cached: {}z
Loader: {}�__path__zSubmodule search path: {}zLine: {}r�)�argparser��ArgumentParser�add_argument�
parse_argsr	�	partition�
import_moduleror�r
r��printr��stderr�exitr�rL�builtin_module_namesZdetailsr��
__cached__rUr�rror�r)rpr��parserr'�targetZmod_nameZ	has_attrs�attrsr,r�rvr}�parts�part�__r�r
r
r�_main$s`���



r�r�)N)N)N)F)N)r�)r�)r�)r�)r�)r
)T)T)T)�r��
__author__r8�disZcollections.abcr7�enum�importlib.machineryr�rr�r�r�r�rrrr0r#r��operatorrrr�globalsZmod_dictZCOMPILER_FLAG_NAMESrKrbrcrGrrrrrrrr rr*r-r.r/r1r3r5r:r<r>r@rBrCrQrdrerxrVr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�ror�r�rrrrrrr,r-r7r8r3rPrSrWrZr�rprsr|r~r�r�r�r�r�r��_fieldsr�r�r�r�r�r�r	r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r
r(Z_WrapperDescriptor�allZ_MethodWrapperrrJZ_ClassMethodWrapperrAr�r�r�r�r�r�r�r�rr!r&r>r�r�IntEnumr/rrDrrFrrGrrHrrIr4rrKr?r�r�r�r
r
r
r�<module>sz	




	
,
t$
>
	
.N->




�]


	�
;�
<
5

 



		0

�
LH
_�K�	k:
weakref.cpython-38.opt-1.pyc000064400000046042150335716500011572 0ustar00U

e5d�S�
@s�dZddlmZmZmZmZmZmZmZm	Z	ddl
mZmZddl
Z
ddlZddlZeefZddddd	d
ddd
ddddg
ZGdd�de�ZGdd�de
j�ZGdd�de�ZGdd	�d	e
j�ZGdd�d�ZdS)z{Weak reference support for Python.

This module is an implementation of PEP 205:

http://www.python.org/dev/peps/pep-0205/
�)�getweakrefcount�getweakrefs�ref�proxy�CallableProxyType�	ProxyType�
ReferenceType�_remove_dead_weakref)�WeakSet�_IterationGuardNrrrr�WeakKeyDictionaryrrr�
ProxyTypes�WeakValueDictionaryr
�
WeakMethod�finalizecsDeZdZdZdZddd�Z�fdd�Zdd	�Zd
d�Ze	j
Z
�ZS)
rz�
    A custom `weakref.ref` subclass which simulates a weak reference to
    a bound method, working around the lifetime problem of bound methods.
    )�	_func_ref�
_meth_type�_alive�__weakref__Ncs~z|j}|j}Wn(tk
r8td�t|���d�YnX��fdd�}t�|||�}t||�|_t|�|_	d|_
t|��|S)Nz)argument should be a bound method, not {}cs&��}|jr"d|_�dk	r"�|�dS�NF)r)�arg�self��callbackZself_wr��/usr/lib64/python3.8/weakref.py�_cb3s
zWeakMethod.__new__.<locals>._cbT)�__self__�__func__�AttributeError�	TypeError�format�typer�__new__rrr)�clsZmethr�obj�funcrrrrrr#,s 
��
zWeakMethod.__new__cs2t���}|��}|dks"|dkr&dS|�||�S�N)�super�__call__rr)rr%r&��	__class__rrr)Bs

zWeakMethod.__call__cCs:t|t�r6|jr|js||kSt�||�o4|j|jkSdSr)�
isinstancerrr�__eq__r�r�otherrrrr-Is

zWeakMethod.__eq__cCs:t|t�r6|jr|js||k	St�||�p4|j|jkSdS�NT)r,rrr�__ne__rr.rrrr1Ps

zWeakMethod.__ne__)N)�__name__�
__module__�__qualname__�__doc__�	__slots__r#r)r-r1r�__hash__�
__classcell__rrr*rr$s
c@s�eZdZdZd,dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZeZ
dd�Zd-dd�Zdd�Zdd�ZeZdd�Zd d!�Zd"d#�Zd$d%�Zd.d&d'�Zd/d(d)�Zd*d+�ZdS)0rz�Mapping class that references values weakly.

    Entries in the dictionary will be discarded when no strong
    reference to the value exists anymore
    rcKs>t|�tfdd�}||_g|_t�|_i|_|j|f|�dS)NcSs6|�}|dk	r2|jr$|j�|j�n||j|j�dSr')�
_iterating�_pending_removals�append�key�data)�wr�selfrefZ_atomic_removalrrrr�removegs
z,WeakValueDictionary.__init__.<locals>.remove)rr	�_remover:�setr9r=�update)rr/�kwr@rrr�__init__fs	zWeakValueDictionary.__init__cCs(|j}|j}|r$|��}t||�qdSr')r:r=�popr	)r�l�dr<rrr�_commit_removalsws
z$WeakValueDictionary._commit_removalscCs4|jr|��|j|�}|dkr,t|��n|SdSr'�r:rIr=�KeyError�rr<�orrr�__getitem__�s
zWeakValueDictionary.__getitem__cCs|jr|��|j|=dSr')r:rIr=�rr<rrr�__delitem__�szWeakValueDictionary.__delitem__cCs|jr|��t|j�Sr')r:rI�lenr=�rrrr�__len__�szWeakValueDictionary.__len__cCs>|jr|��z|j|�}Wntk
r4YdSX|dk	SrrJrLrrr�__contains__�sz WeakValueDictionary.__contains__cCsd|jjt|�fS�Nz<%s at %#x>�r+r2�idrRrrr�__repr__�szWeakValueDictionary.__repr__cCs&|jr|��t||j|�|j|<dSr')r:rI�KeyedRefrAr=�rr<�valuerrr�__setitem__�szWeakValueDictionary.__setitem__c	CsV|jr|��t�}t|��0|j��D]\}}|�}|dk	r(|||<q(W5QRX|Sr')r:rIrrr=�items)r�newr<r>rMrrr�copy�s
zWeakValueDictionary.copyc	Csjddlm}|jr|��|��}t|��6|j��D]$\}}|�}|dk	r6|||||�<q6W5QRX|S�Nr)�deepcopy)r_rar:rIr+rr=r])r�memorar^r<r>rMrrr�__deepcopy__�s
z WeakValueDictionary.__deepcopy__NcCsP|jr|��z|j|}Wntk
r4|YSX|�}|dkrH|S|SdSr'rJ)rr<�defaultr>rMrrr�get�s
zWeakValueDictionary.getc	csR|jr|��t|��2|j��D] \}}|�}|dk	r"||fVq"W5QRXdSr'�r:rIrr=r])r�kr>�vrrrr]�s
zWeakValueDictionary.itemsc	csJ|jr|��t|��*|j��D]\}}|�dk	r"|Vq"W5QRXdSr'rf)rrgr>rrr�keys�s

zWeakValueDictionary.keysc	cs6|jr|��t|��|j��EdHW5QRXdS)a�Return an iterator that yields the weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        N�r:rIrr=�valuesrRrrr�
itervaluerefs�s

z!WeakValueDictionary.itervaluerefsc	csJ|jr|��t|��*|j��D]}|�}|dk	r"|Vq"W5QRXdSr'rj�rr>r%rrrrk�s
zWeakValueDictionary.valuescCs8|jr|��|j��\}}|�}|dk	r||fSqdSr')r:rIr=�popitem)rr<r>rMrrrrn�szWeakValueDictionary.popitemcGs`|jr|��z|j�|��}Wntk
r8d}YnX|dkrX|rN|dSt|��n|SdS)Nr)r:rIr=rFrK)rr<�argsrMrrrrFs

zWeakValueDictionary.popcCs`z|j|�}Wntk
r(d}YnX|dkrX|jr@|��t||j|�|j|<|S|SdSr')r=rKr:rIrYrA)rr<rdrMrrr�
setdefaults
zWeakValueDictionary.setdefaultcKsz|jr|��|j}|dk	rRt|d�s.t|�}|��D]\}}t||j|�||<q6|��D]\}}t||j|�||<qZdS�Nr])r:rIr=�hasattr�dictr]rYrA)rr/�kwargsrHr<rMrrrrCs
zWeakValueDictionary.updatecCs|jr|��t|j���S)a~Return a list of weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        )r:rI�listr=rkrRrrr�	valuerefs(s
zWeakValueDictionary.valuerefs)r)N)N)N)r2r3r4r5rErIrNrPrSrTrXr\r_�__copy__rcrer]ri�__iter__rlrkrnrFrprCrvrrrrrZs.
			
			

cs,eZdZdZdZdd�Z�fdd�Z�ZS)rYa[Specialized reference that includes a key corresponding to the value.

    This is used in the WeakValueDictionary to avoid having to create
    a function object for each key stored in the mapping.  A shared
    callback object can use the 'key' attribute of a KeyedRef instead
    of getting a reference to the key from an enclosing scope.

    �r<cCst�|||�}||_|Sr')rr#r<)r"�obrr<rrrrr#CszKeyedRef.__new__cst��||�dSr')r(rE)rrzrr<r*rrrEHszKeyedRef.__init__)r2r3r4r5r6r#rEr8rrr*rrY7s	rYc@s�eZdZdZd+dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZeZ
dd�Zd,dd�Zdd�Zdd�Zdd�ZeZdd �Zd!d"�Zd#d$�Zd%d&�Zd-d'd(�Zd.d)d*�ZdS)/ra� Mapping class that references keys weakly.

    Entries in the dictionary will be discarded when there is no
    longer a strong reference to the key. This can be used to
    associate additional data with an object owned by other parts of
    an application without adding attributes to those objects. This
    can be especially useful with objects that override attribute
    accesses.
    NcCsFi|_t|�fdd�}||_g|_t�|_d|_|dk	rB|�|�dS)NcSs.|�}|dk	r*|jr"|j�|�n|j|=dSr')r9r:r;r=)rgr?rrrrr@Ys
z*WeakKeyDictionary.__init__.<locals>.removeF)r=rrAr:rBr9�
_dirty_lenrC)rrsr@rrrrEWszWeakKeyDictionary.__init__cCs:|j}|j}|r6z||��=Wqtk
r2YqXqdSr')r:r=rFrK)rrGrHrrrrIhsz"WeakKeyDictionary._commit_removalscs&|j��fdd�|jD�|_d|_dS)Ncsg|]}|�kr|�qSrr)�.0rg�rHrr�
<listcomp>wsz5WeakKeyDictionary._scrub_removals.<locals>.<listcomp>F)r=r:r{rRrr}r�_scrub_removalsusz!WeakKeyDictionary._scrub_removalscCsd|_|jt|�=dSr0)r{r=rrOrrrrPzszWeakKeyDictionary.__delitem__cCs|jt|�Sr')r=rrOrrrrN~szWeakKeyDictionary.__getitem__cCs(|jr|jr|��t|j�t|j�Sr')r{r:rrQr=rRrrrrS�szWeakKeyDictionary.__len__cCsd|jjt|�fSrUrVrRrrrrX�szWeakKeyDictionary.__repr__cCs||jt||j�<dSr')r=rrArZrrrr\�szWeakKeyDictionary.__setitem__c	CsHt�}t|��0|j��D]\}}|�}|dk	r|||<qW5QRX|Sr')rrr=r])rr^r<r[rMrrrr_�s
zWeakKeyDictionary.copyc	Cs\ddlm}|��}t|��6|j��D]$\}}|�}|dk	r(|||�||<q(W5QRX|Sr`)r_rar+rr=r])rrbrar^r<r[rMrrrrc�s
zWeakKeyDictionary.__deepcopy__cCs|j�t|�|�Sr')r=rer�rr<rdrrrre�szWeakKeyDictionary.getcCs.zt|�}Wntk
r"YdSX||jkSr)rr r=)rr<r>rrrrT�s
zWeakKeyDictionary.__contains__c	csDt|��2|j��D] \}}|�}|dk	r||fVqW5QRXdSr'�rr=r])rr>r[r<rrrr]�s

zWeakKeyDictionary.itemsc	cs8t|��&|jD]}|�}|dk	r|VqW5QRXdSr')rr=rmrrrri�s


zWeakKeyDictionary.keysc	cs<t|��*|j��D]\}}|�dk	r|VqW5QRXdSr'r�)rr>r[rrrrk�s

zWeakKeyDictionary.valuescCs
t|j�S)azReturn a list of weak references to the keys.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the keys around longer than needed.

        )rur=rRrrr�keyrefs�s
zWeakKeyDictionary.keyrefscCs0d|_|j��\}}|�}|dk	r||fSqdSr0)r{r=rn)rr<r[rMrrrrn�s
zWeakKeyDictionary.popitemcGsd|_|jjt|�f|��Sr0)r{r=rFr)rr<rorrrrF�szWeakKeyDictionary.popcCs|j�t||j�|�Sr')r=rprrAr�rrrrp�szWeakKeyDictionary.setdefaultcKs\|j}|dk	rFt|d�s$ti�|�}|��D]\}}||t||j�<q,t|�rX|�|�dSrq)r=rrr"r]rrArQrC)rrsrtrHr<r[rrrrC�s
zWeakKeyDictionary.update)N)N)N)N)r2r3r4r5rErIrrPrNrSrXr\r_rwrcrerTr]rirxrkr�rnrFrprCrrrrrLs.


	


c@s�eZdZdZdZiZdZe��Z	dZ
dZGdd�d�Zdd�Z
de
_dd
d�Zdd
�Zdd�Zedd��Zedd��Zejdd��Zdd�Zedd��Zedd��Zd	S)raClass for finalization of weakrefable objects

    finalize(obj, func, *args, **kwargs) returns a callable finalizer
    object which will be called when obj is garbage collected. The
    first time the finalizer is called it evaluates func(*arg, **kwargs)
    and returns the result. After this the finalizer is dead, and
    calling it just returns None.

    When the program exits any remaining finalizers for which the
    atexit attribute is true will be run in reverse order of creation.
    By default atexit is true.
    rFc@seZdZdZdS)zfinalize._Info)�weakrefr&rort�atexit�indexN)r2r3r4r6rrrr�_Infosr�cOs>t|�dkr|^}}}}n�|s(td��n�d|krDtdt|�d��|�d�}t|�dkr~|^}}}ddl}|jdtdd	�nFd
|kr�tdt|�d��|�d
�}|^}}ddl}|jdtdd	�t|�}|js�ddl}|�	|j
�dt_|��}t
||�|_||_||_|�pd|_d|_t|j�|_||j|<dt_dS)
N�z<descriptor '__init__' of 'finalize' object needs an argumentr&z9finalize expected at least 2 positional arguments, got %d��rz0Passing 'func' as keyword argument is deprecated)�
stacklevelr%z/Passing 'obj' as keyword argument is deprecatedT)rQr rF�warnings�warn�DeprecationWarning�tuple�_registered_with_atexitr��register�	_exitfuncrr�rr�r&rort�next�_index_iterr��	_registry�_dirty)rortrr%r&r�r��inforrrrEsR

�

�
�
�
zfinalize.__init__z&($self, obj, func, /, *args, **kwargs)NcCs0|j�|d�}|r,|js,|j|j|jp(i�SdS)zZIf alive then mark as dead and return func(*args, **kwargs);
        otherwise return NoneN)r�rF�	_shutdownr&rort)r�_r�rrrr)1s
zfinalize.__call__cCsH|j�|�}|o|��}|dk	rD|j�|d�rD||j|j|jp@ifSdS)z^If alive then mark as dead and return (obj, func, args, kwargs);
        otherwise return NoneN)r�rer�rFr&rort�rr�r%rrr�detach8szfinalize.detachcCs:|j�|�}|o|��}|dk	r6||j|j|jp2ifSdS)zMIf alive then return (obj, func, args, kwargs);
        otherwise return NoneN)r�rer�r&rortr�rrr�peek@sz
finalize.peekcCs
||jkS)zWhether finalizer is alive)r�rRrrr�aliveHszfinalize.alivecCs|j�|�}t|�o|jS)z*Whether finalizer should be called at exit�r�re�boolr�)rr�rrrr�Mszfinalize.atexitcCs|j�|�}|rt|�|_dSr'r�)rr[r�rrrr�SscCs^|j�|�}|o|��}|dkr6dt|�jt|�fSdt|�jt|�t|�jt|�fSdS)Nz<%s object at %#x; dead>z!<%s object at %#x; for %r at %#x>)r�rer�r"r2rWr�rrrrXYs�zfinalize.__repr__cCs2dd�|j��D�}|jdd�d�dd�|D�S)NcSsg|]\}}|jr||f�qSr)r��r|�f�irrrr~esz-finalize._select_for_exit.<locals>.<listcomp>cSs
|djS)Nr�)r�)�itemrrr�<lambda>f�z+finalize._select_for_exit.<locals>.<lambda>rycSsg|]\}}|�qSrrr�rrrr~gs)r�r]�sort)r$�Lrrr�_select_for_exitbszfinalize._select_for_exitcCs�d}z�|jr�ddl}|��r(d}|��d}|dks:tjrH|��}dt_|sNq�|�	�}z
|�Wq,t
k
r�tjt�
��Yq,Xq,W5dt_|r�|��XdS)NFTr)rr�Zenabler��gcZ	isenabledZdisabler�r�rF�	Exception�sys�
excepthook�exc_info)r$Zreenable_gcr�Zpendingr�rrrr�is,
zfinalize._exitfunc)N)r2r3r4r5r6r�r��	itertools�countr�r�r�r�rE�__text_signature__r)r�r��propertyr�r��setterrX�classmethodr�r�rrrrr�s0*



	
)r5�_weakrefrrrrrrrr	Z_weakrefsetr
r�_collections_abcr�r�r
�__all__r�MutableMappingrrYrrrrrr�<module>s0(
�6^_py_abc.cpython-38.opt-2.pyc000064400000006535150335716500011546 0ustar00U

e5d-�@s(ddlmZdd�ZGdd�de�ZdS)�)�WeakSetcCstjS�N)�ABCMeta�_abc_invalidation_counter�rr�/usr/lib64/python3.8/_py_abc.py�get_cache_tokensrcsReZdZdZ�fdd�Zdd�Zddd�Zd	d
�Zdd�Zd
d�Z	dd�Z
�ZS)rrc	s�t�j||||f|�}dd�|��D�}|D]:}t|dt��D]&}t||d�}t|dd�r>|�|�q>q,t|�|_t�|_	t�|_
t�|_tj
|_|S)NcSs h|]\}}t|dd�r|�qS)�__isabstractmethod__F)�getattr)�.0�name�valuerrr�	<setcomp>&s�z"ABCMeta.__new__.<locals>.<setcomp>�__abstractmethods__r	F)�super�__new__�itemsr
�set�add�	frozensetrr�
_abc_registry�
_abc_cache�_abc_negative_cacherr�_abc_negative_cache_version)	�mclsr�bases�	namespace�kwargs�clsZ	abstracts�baser
��	__class__rrr#s�
zABCMeta.__new__cCsPt|t�std��t||�r |St||�r2td��|j�|�tjd7_|S)NzCan only register classesz'Refusing to create an inheritance cycle�)	�
isinstance�type�	TypeError�
issubclass�RuntimeErrorrrrr)r�subclassrrr�register6s


zABCMeta.registerNcCs|td|j�d|j��|d�tdt���|d�|jD]@}|�d�r6t||�}t|t�r`t	|�}t|�d|��|d�q6dS)NzClass: �.)�filezInv. counter: Z_abc_z: )
�print�
__module__�__qualname__r�__dict__�
startswithr
r#rr)rr+rr
rrr�_dump_registryHs



zABCMeta._dump_registrycCs|j��dSr)r�clear�rrrr�_abc_registry_clearSszABCMeta._abc_registry_clearcCs|j��|j��dSr)rr2rr3rrr�_abc_caches_clearWs
zABCMeta._abc_caches_clearcsb|j}|�jkrdSt|�}||krH�jtjkr>|�jkr>dS��|�St�fdd�||fD��S)NTFc3s|]}��|�VqdSr)�__subclasscheck__)r�cr3rr�	<genexpr>jsz,ABCMeta.__instancecheck__.<locals>.<genexpr>)	r!rr$rrrrr6�any)r�instancer(Zsubtyperr3r�__instancecheck__\s
��
zABCMeta.__instancecheck__cCst|t�std��||jkr dS|jtjkr>t�|_tj|_n||jkrLdS|�	|�}|t
k	r�|rp|j�|�n|j�|�|S|t|dd�kr�|j�|�dS|j
D] }t||�r�|j�|�dSq�|��D] }t||�r�|j�|�dSq�|j�|�dS)Nz"issubclass() arg 1 must be a classTF�__mro__r)r#r$r%rrrrrr�__subclasshook__�NotImplementedrr
rr&�__subclasses__)rr(�okZrclsZsclsrrrr6ls8







zABCMeta.__subclasscheck__)N)�__name__r-r.rrr)r1r4r5r;r6�
__classcell__rrr rrs
rN)Z_weakrefsetrrr$rrrrr�<module>s
filecmp.cpython-38.pyc000064400000020355150335716500010625 0ustar00U

e5df&�@s�dZddlZddlZddlmZdddddgZiZd	Zd
ddd
ddddgZdd�Z	d"dd�Z
dd�Zdd�ZGdd�d�Z
d#dd�Zee
fdd�Zdd�Zdd �Zed!kr�e�dS)$z�Utilities for comparing files and directories.

Classes:
    dircmp

Functions:
    cmp(f1, f2, shallow=True) -> int
    cmpfiles(a, b, common) -> ([], [], [])
    clear_cache()

�N)�filterfalse�clear_cache�cmp�dircmp�cmpfiles�DEFAULT_IGNORESi ZRCSZCVSZtagsz.gitz.hgz.bzrZ_darcs�__pycache__cCst��dS)zClear the filecmp cache.N)�_cache�clear�rr�/usr/lib64/python3.8/filecmp.pyrsTcCs�tt�|��}tt�|��}|dtjks8|dtjkr<dS|rL||krLdS|d|dkr`dSt�||||f�}|dkr�t||�}tt�dkr�t�|t||||f<|S)a�Compare two files.

    Arguments:

    f1 -- First file name

    f2 -- Second file name

    shallow -- Just check stat signature (do not read the files).
               defaults to True.

    Return value:

    True if the files are the same, False otherwise.

    This function uses a cache for past comparisons and the results,
    with cache entries invalidated if their stat information
    changes.  The cache may be cleared by calling clear_cache().

    rFT�N�d)	�_sig�os�stat�S_IFREGr	�get�_do_cmp�lenr)�f1�f2�shallow�s1�s2Zoutcomerrrrs
cCst�|j�|j|jfS�N)r�S_IFMT�st_mode�st_size�st_mtime)�strrrrDs
�rc
Cs�t}t|d��n}t|d��X}|�|�}|�|�}||krPW5QR�W5QR�dS|sW5QR�W5QR�dSqW5QRXW5QRXdS)N�rbFT)�BUFSIZE�open�read)rr�bufsize�fp1�fp2Zb1Zb2rrrrIs

rc@s�eZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
ee	eeeeeeeeeeed�Zdd�ZdS)raMA class that manages the comparison of 2 directories.

    dircmp(a, b, ignore=None, hide=None)
      A and B are directories.
      IGNORE is a list of names to ignore,
        defaults to DEFAULT_IGNORES.
      HIDE is a list of names to hide,
        defaults to [os.curdir, os.pardir].

    High level usage:
      x = dircmp(dir1, dir2)
      x.report() -> prints a report on the differences between dir1 and dir2
       or
      x.report_partial_closure() -> prints report on differences between dir1
            and dir2, and reports on common immediate subdirectories.
      x.report_full_closure() -> like report_partial_closure,
            but fully recursive.

    Attributes:
     left_list, right_list: The files in dir1 and dir2,
        filtered by hide and ignore.
     common: a list of names in both dir1 and dir2.
     left_only, right_only: names only in dir1, dir2.
     common_dirs: subdirectories in both dir1 and dir2.
     common_files: files in both dir1 and dir2.
     common_funny: names in both dir1 and dir2 where the type differs between
        dir1 and dir2, or the name is not stat-able.
     same_files: list of identical files.
     diff_files: list of filenames which differ.
     funny_files: list of files which could not be compared.
     subdirs: a dictionary of dircmp objects, keyed by names in common_dirs.
     NcCsD||_||_|dkr$tjtjg|_n||_|dkr:t|_n||_dSr)�left�rightr�curdir�pardir�hider�ignore)�self�a�br-r,rrr�__init__xszdircmp.__init__cCsPtt�|j�|j|j�|_tt�|j�|j|j�|_|j�	�|j�	�dSr)
�_filterr�listdirr(r,r-�	left_listr)�
right_list�sort�r.rrr�phase0�s
�
�
z
dircmp.phase0cCs�ttttjj|j�|j��}ttttjj|j�|j��}tt|j	t
|j|���|_tt|j	t
|j|���|_tt|j	t
|j|���|_dSr)�dict�zip�mapr�path�normcaser4r5�list�__getitem__�filter�__contains__�commonr�	left_only�
right_only)r.r/r0rrr�phase1�s
z
dircmp.phase1c
Cs4g|_g|_g|_|jD�]}tj�|j|�}tj�|j|�}d}zt�	|�}Wn&t
k
rv}zd}W5d}~XYnXzt�	|�}Wn&t
k
r�}zd}W5d}~XYnX|�r"t	�|j�}t	�|j�}	||	kr�|j�
|�n>t	�|�r�|j�
|�n&t	�|��r|j�
|�n|j�
|�q|j�
|�qdS)Nr
r)�common_dirs�common_files�common_funnyrBrr<�joinr(r)r�OSErrorrr�append�S_ISDIR�S_ISREG)
r.�xZa_pathZb_path�okZa_statZwhyZb_statZa_typeZb_typerrr�phase2�s4
z
dircmp.phase2cCs&t|j|j|j�}|\|_|_|_dSr)rr(r)rG�
same_files�
diff_files�funny_files)r.Zxxrrr�phase3�sz
dircmp.phase3cCsNi|_|jD]<}tj�|j|�}tj�|j|�}t|||j|j	�|j|<qdSr)
�subdirsrFrr<rIr(r)rr-r,)r.rNZa_xZb_xrrr�phase4�s

z
dircmp.phase4cCs$|��|j��D]}|��qdSr)rVrU�values�phase4_closure�r.ZsdrrrrX�szdircmp.phase4_closurecCs�td|j|j�|jr2|j��td|jd|j�|jrT|j��td|jd|j�|jrp|j��td|j�|jr�|j��td|j�|jr�|j��td|j�|j	r�|j	��td|j	�|j
r�|j
��td|j
�dS)	NZdiffzOnly in�:zIdentical files :zDiffering files :zTrouble with common files :zCommon subdirectories :zCommon funny cases :)�printr(r)rCr6rDrQrRrSrFrHr7rrr�report�s,






z
dircmp.reportcCs*|��|j��D]}t�|��qdSr)r\rUrWr[rYrrr�report_partial_closure�szdircmp.report_partial_closurecCs*|��|j��D]}t�|��qdSr)r\rUrWr[�report_full_closurerYrrrr^�szdircmp.report_full_closure)rUrQrRrSrFrGrHrBrCrDr4r5cCs*||jkrt|��|j||�t||�Sr)�	methodmap�AttributeError�getattr)r.�attrrrr�__getattr__�s
zdircmp.__getattr__)NN)�__name__�
__module__�__qualname__�__doc__r1r8rErPrTrVrXr\r]r^r9r_rcrrrrrVs2!
#
�cCsJgggf}|D]6}tj�||�}tj�||�}|t|||��|�q|S)a]Compare common files in two directories.

    a, b -- directory names
    common -- list of file names found in both directories
    shallow -- if true, do comparison based solely on stat() information

    Returns a tuple of three lists:
      files that compare equal
      files that are different
      filenames that aren't regular files.

    )rr<rI�_cmprK)r/r0rBr�resrNZaxZbxrrrr�s
cCs0z|||||��WStk
r*YdSXdS)N�)rJ)r/r0Zsh�absrrrrrhsrhcCstt|j|��Sr)r>rrA)Zflist�skiprrrr2sr2cCsrddl}ddl}|�|jdd�d�\}}t|�dkrB|�dd��t|d|d�}d|krf|��n|��dS)Nrr
�rrjzneed exactly two args)z-r�)�sys�getopt�argvrZGetoptErrorrr^r\)rorpZoptions�argsZddrrr�demo$s
rs�__main__)T)T)rgrr�	itertoolsr�__all__r	r"rrrrrrrrkrhr2rsrdrrrr�<module>s6�
'
%
	subprocess.cpython-38.opt-1.pyc000064400000122200150335716500012325 0ustar00U

e5d�1�@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZdddddd	d
ddd
ddddgZ
zddlZddlZdZWn0ek
r�dZddlZddlZddlZYn�XddlmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&e
�'dddddddddddd d!d"d#d$d%d&d'g�Gd(d�de(�Z)Gd)d
�d
e)�Z*Gd*d�de)�Z+e�r�Gd+d�d�Z,Gd,d-�d-e-�Z.n&e/ed.d/�Z0e1ed0��r�ej2Z3nej4Z3e�r�dZ5d1d2�Z6ngZ5d3d2�Z6d4Z7d5Z8d6Z9d7d8�Z:d9d:�Z;dd;�d<d�Z<d=d�Z=dd;�d>d�Z>Gd?d�de?�Z@ddddd@�dAd�ZAdBdC�ZBdDd	�ZCdEd
�ZDdFdG�ZEeE�ZFGdHd�de?�ZGdS)Ia�Subprocesses with accessible I/O streams

This module allows you to spawn processes, connect to their
input/output/error pipes, and obtain their return codes.

For a complete description of this module see the Python documentation.

Main API
========
run(...): Runs a command, waits for it to complete, then returns a
          CompletedProcess instance.
Popen(...): A class for flexibly executing a command in a new process

Constants
---------
DEVNULL: Special value that indicates that os.devnull should be used
PIPE:    Special value that indicates a pipe should be created
STDOUT:  Special value that indicates that stderr should go to stdout


Older API
=========
call(...): Runs a command, waits for it to complete, then returns
    the return code.
check_call(...): Same as call() but raises CalledProcessError()
    if return code is not 0
check_output(...): Same as check_call() but returns the contents of
    stdout instead of a return code
getoutput(...): Runs a command in the shell, waits for it to complete,
    then returns the output
getstatusoutput(...): Runs a command in the shell, waits for it to complete,
    then returns a (exitcode, output) tuple
�N)�	monotonic�Popen�PIPE�STDOUT�call�
check_call�getstatusoutput�	getoutput�check_output�run�CalledProcessError�DEVNULL�SubprocessError�TimeoutExpired�CompletedProcessTF)�CREATE_NEW_CONSOLE�CREATE_NEW_PROCESS_GROUP�STD_INPUT_HANDLE�STD_OUTPUT_HANDLE�STD_ERROR_HANDLE�SW_HIDE�STARTF_USESTDHANDLES�STARTF_USESHOWWINDOW�ABOVE_NORMAL_PRIORITY_CLASS�BELOW_NORMAL_PRIORITY_CLASS�HIGH_PRIORITY_CLASS�IDLE_PRIORITY_CLASS�NORMAL_PRIORITY_CLASS�REALTIME_PRIORITY_CLASS�CREATE_NO_WINDOW�DETACHED_PROCESS�CREATE_DEFAULT_ERROR_MODE�CREATE_BREAKAWAY_FROM_JOBrrrrrrrr�STARTUPINFOrrrrrrrr r!r"c@seZdZdS)rN)�__name__�
__module__�__qualname__�r'r'�"/usr/lib64/python3.8/subprocess.pyr`sc@s<eZdZdZd
dd�Zdd�Zedd��Zejd	d��ZdS)rz�Raised when run() is called with check=True and the process
    returns a non-zero exit status.

    Attributes:
      cmd, returncode, stdout, stderr, output
    NcCs||_||_||_||_dS�N)�
returncode�cmd�output�stderr)�selfr*r+r,r-r'r'r(�__init__jszCalledProcessError.__init__cCsh|jrT|jdkrTzd|jt�|j�fWStk
rPd|j|jfYSXnd|j|jfSdS)NrzCommand '%s' died with %r.z)Command '%s' died with unknown signal %d.z.Command '%s' returned non-zero exit status %d.)r*r+�signalZSignals�
ValueError�r.r'r'r(�__str__ps���zCalledProcessError.__str__cCs|jS)z+Alias for output attribute, to match stderr�r,r2r'r'r(�stdout|szCalledProcessError.stdoutcCs
||_dSr)r4�r.�valuer'r'r(r5�s)NN�	r$r%r&�__doc__r/r3�propertyr5�setterr'r'r'r(rcs

c@s<eZdZdZd
dd�Zdd�Zedd��Zejd	d��ZdS)rz�This exception is raised when the timeout expires while waiting for a
    child process.

    Attributes:
        cmd, output, stdout, stderr, timeout
    NcCs||_||_||_||_dSr))r+�timeoutr,r-)r.r+r<r,r-r'r'r(r/�szTimeoutExpired.__init__cCsd|j|jfS)Nz'Command '%s' timed out after %s seconds)r+r<r2r'r'r(r3�s
�zTimeoutExpired.__str__cCs|jSr)r4r2r'r'r(r5�szTimeoutExpired.stdoutcCs
||_dSr)r4r6r'r'r(r5�s)NNr8r'r'r'r(r�s

c@s,eZdZddddddd�dd�Zdd�ZdS)r#rN��dwFlags�	hStdInput�
hStdOutput�	hStdError�wShowWindow�lpAttributeListcCs0||_||_||_||_||_|p(dgi|_dS)N�handle_listr=)r.r>r?r@rArBrCr'r'r(r/�szSTARTUPINFO.__init__cCs@|j��}d|kr"t|d�|d<t|j|j|j|j|j|d�S)NrDr=)	rC�copy�listr#r>r?r@rArB)r.Z	attr_listr'r'r(rE�s
�zSTARTUPINFO.copy)r$r%r&r/rEr'r'r'r(r#�s�	c@s2eZdZdZejfdd�Zdd�Zdd�ZeZ	dS)	�HandleFcCs|jsd|_||�dS)NT)�closed)r.�CloseHandler'r'r(�Close�szHandle.ClosecCs |jsd|_t|�Std��dS)NTzalready closed)rH�intr1r2r'r'r(�Detach�sz
Handle.DetachcCsd|jjt|�fS)Nz%s(%d))�	__class__r$rKr2r'r'r(�__repr__�szHandle.__repr__N)
r$r%r&rH�_winapirIrJrLrN�__del__r'r'r'r(rG�s
rGZPIPE_BUFi�PollSelectorcCsdSr)r'r'r'r'r(�_cleanup�srRc	Cs\tdkrdStdd�D]>}|jtjd�}|dk	rzt�|�Wqtk
rTYqXqdS)N��
_deadstate)�_active�_internal_poll�sys�maxsize�remover1)�inst�resr'r'r(rR�s���������cCs*g}tjj}|dkr&|�dd|�|S)zgReturn a list of command-line arguments reproducing the current
    optimization settings in sys.flags.r�-�O)rW�flags�optimize�append)�argsr7r'r'r(�"_optim_args_from_interpreter_flagss
recCsVddddddd�}t�}|��D].\}}ttj|�}|dkr |�d	||�q tjjrd|�d
�n$tjjrv|�d�tjjr�|�d�tj	d
d
�}tjj
}ttdi�}d|k}|dkr�|�d�n|r�|�d�|r�|�d�|D]}|�d|�q�|�r
|�d�dD]B}||k�r||}	|	dk�r4|}
nd||	f}
|�d|
f��q|S)z}Return a list of command-line arguments reproducing the current
    settings in sys.flags, sys.warnoptions and sys._xoptions.�d�B�S�v�b�q)�debug�dont_write_bytecode�no_site�verbose�
bytes_warning�quietrr_z-Iz-Ez-sN�	_xoptions�dev�zerror::BytesWarningzdefault::BytesWarning�defaultz-W)�-Xrs)Zfaulthandler�tracemallocZ
importtimeZshowalloccountZshowrefcount�utf8Tz%s=%srv)
re�items�getattrrWrarc�isolated�ignore_environment�no_user_site�warnoptionsrprY�extend)Zflag_opt_maprd�flag�optriZwarnoptsrpZxoptions�dev_moder7�argr'r'r(�_args_from_interpreter_flagssP�






r��r<c
OsLt||��8}z|j|d�WW5QR�S|���YnXW5QRXdS)z�Run command with arguments.  Wait for command to complete or
    timeout, then return the returncode attribute.

    The arguments are the same as for the Popen constructor.  Example:

    retcode = call(["ls", "-l"])
    r�N)r�wait�kill)r<�	popenargs�kwargs�pr'r'r(rLscOs6t||�}|r2|�d�}|dkr(|d}t||��dS)aORun command with arguments.  Wait for command to complete.  If
    the exit code was zero then return, otherwise raise
    CalledProcessError.  The CalledProcessError object will have the
    return code in the returncode attribute.

    The arguments are the same as for the call function.  Example:

    check_call(["ls", "-l"])
    rdNr)r�getr)r�r��retcoder+r'r'r(r]s



cOsbd|krtd��d|krJ|ddkrJ|�d�s8|�d�r>d}nd}||d<t|t|d	d
�|��jS)aRun command with arguments and return its output.

    If the exit code was non-zero it raises a CalledProcessError.  The
    CalledProcessError object will have the return code in the returncode
    attribute and output in the output attribute.

    The arguments are the same as for the Popen constructor.  Example:

    >>> check_output(["ls", "-l", "/dev/null"])
    b'crw-rw-rw- 1 root root 1, 3 Oct 18  2007 /dev/null\n'

    The stdout argument is not allowed as it is used internally.
    To capture standard error in the result, use stderr=STDOUT.

    >>> check_output(["/bin/sh", "-c",
    ...               "ls -l non_existent_file ; exit 0"],
    ...              stderr=STDOUT)
    b'ls: non_existent_file: No such file or directory\n'

    There is an additional optional argument, "input", allowing you to
    pass a string to the subprocess's stdin.  If you use this argument
    you may not also use the Popen constructor's "stdin" argument, as
    it too will be used internally.  Example:

    >>> check_output(["sed", "-e", "s/foo/bar/"],
    ...              input=b"when in the course of fooman events\n")
    b'when in the course of barman events\n'

    By default, all communication is in bytes, and therefore any "input"
    should be bytes, and the return value will be bytes.  If in text mode,
    any "input" should be a string, and the return value will be a string
    decoded according to locale encoding, or by "encoding" if set. Text mode
    is triggered by setting any of text, encoding, errors or universal_newlines.
    r5z3stdout argument not allowed, it will be overridden.�inputN�universal_newlines�text��T)r5r<�check)r1r�rrr5)r<r�r��emptyr'r'r(r
ps#�c@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
raEA process that has finished running.

    This is returned by run().

    Attributes:
      args: The list or str args passed to run().
      returncode: The exit code of the process, negative for signals.
      stdout: The standard output (None if not captured).
      stderr: The standard error (None if not captured).
    NcCs||_||_||_||_dSr))rdr*r5r-)r.rdr*r5r-r'r'r(r/�szCompletedProcess.__init__cCshd�|j�d�|j�g}|jdk	r4|�d�|j��|jdk	rP|�d�|j��d�t|�jd�|��S)Nz	args={!r}zreturncode={!r}zstdout={!r}zstderr={!r}z{}({})z, )	�formatrdr*r5rcr-�typer$�join)r.rdr'r'r(rN�s

�

zCompletedProcess.__repr__cCs |jrt|j|j|j|j��dS)z6Raise CalledProcessError if the exit code is non-zero.N)r*rrdr5r-r2r'r'r(�check_returncode�s�z!CompletedProcess.check_returncode)NN)r$r%r&r9r/rNr�r'r'r'r(r�s

	)r��capture_outputr<r�cOs |dk	r&|�d�dk	rtd��t|d<|r^|�d�dk	sF|�d�dk	rNtd��t|d<t|d<t||���}z|j||d�\}}Wn^tk
r�}	z,|��tr�|��\|	_|	_	n|�
��W5d}	~	XYn|���YnX|��}
|�r|
�rt|
|j
||d��W5QRXt|j
|
||�S)	aKRun command with arguments and return a CompletedProcess instance.

    The returned instance will have attributes args, returncode, stdout and
    stderr. By default, stdout and stderr are not captured, and those attributes
    will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them.

    If check is True and the exit code was non-zero, it raises a
    CalledProcessError. The CalledProcessError object will have the return code
    in the returncode attribute, and output & stderr attributes if those streams
    were captured.

    If timeout is given, and the process takes too long, a TimeoutExpired
    exception will be raised.

    There is an optional argument "input", allowing you to
    pass bytes or a string to the subprocess's stdin.  If you use this argument
    you may not also use the Popen constructor's "stdin" argument, as
    it will be used internally.

    By default, all communication is in bytes, and therefore any "input" should
    be bytes, and the stdout and stderr will be bytes. If in text mode, any
    "input" should be a string, and stdout and stderr will be strings decoded
    according to locale encoding, or by "encoding" if set. Text mode is
    triggered by setting any of text, encoding, errors or universal_newlines.

    The other arguments are the same as for the Popen constructor.
    N�stdinz/stdin and input arguments may not both be used.r5r-z@stdout and stderr arguments may not be used with capture_output.r��r,r-)r�r1rr�communicaterr��
_mswindowsr5r-r��pollrrdr)r�r�r<r�r�r�Zprocessr5r-�excr�r'r'r(r�s8�cCs�g}d}ttj|�D]�}g}|r*|�d�d|kp>d|kp>|}|rN|�d�|D]b}|dkrj|�|�qR|dkr�|�dt|�d�g}|�d�qR|r�|�|�g}|�|�qR|r�|�|�|r|�|�|�d�qd�|�S)	a�
    Translate a sequence of arguments into a command line
    string, using the same rules as the MS C runtime:

    1) Arguments are delimited by white space, which is either a
       space or a tab.

    2) A string surrounded by double quotation marks is
       interpreted as a single argument, regardless of white space
       contained within.  A quoted string can be embedded in an
       argument.

    3) A double quotation mark preceded by a backslash is
       interpreted as a literal double quotation mark.

    4) Backslashes are interpreted literally, unless they
       immediately precede a double quotation mark.

    5) If backslashes immediately precede a double quotation mark,
       every pair of backslashes is interpreted as a literal
       backslash.  If the number of backslashes is odd, the last
       backslash escapes the next double quotation mark as
       described in rule 3.
    F� �	�"�\�z\"r�)�map�os�fsdecoderc�lenrr�)�seq�resultZ	needquoter�Zbs_buf�cr'r'r(�list2cmdline	s4




r�c
Cslzt|ddtd�}d}Wn.tk
rF}z|j}|j}W5d}~XYnX|dd�dkrd|dd�}||fS)a�Return (exitcode, output) of executing cmd in a shell.

    Execute the string 'cmd' in a shell with 'check_output' and
    return a 2-tuple (status, output). The locale encoding is used
    to decode the output and process newlines.

    A trailing newline is stripped from the output.
    The exit status for the command can be interpreted
    according to the rules for the function 'wait'. Example:

    >>> import subprocess
    >>> subprocess.getstatusoutput('ls /bin/ls')
    (0, '/bin/ls')
    >>> subprocess.getstatusoutput('cat /bin/junk')
    (1, 'cat: /bin/junk: No such file or directory')
    >>> subprocess.getstatusoutput('/bin/junk')
    (127, 'sh: /bin/junk: not found')
    >>> subprocess.getstatusoutput('/bin/kill $$')
    (-15, '')
    T)�shellr�r-rNr\�
)r
rrr,r*)r+�dataZexitcodeZexr'r'r(rRscCst|�dS)a%Return output (stdout or stderr) of executing cmd in a shell.

    Like getstatusoutput(), except the exit status is ignored and the return
    value is a string containing the command's output.  Example:

    >>> import subprocess
    >>> subprocess.getoutput('ls /bin/ls')
    '/bin/ls'
    rt)r)r+r'r'r(r	qs
c
Cs�tsttd�sdStjdkr dSzjt�d�}|jdd�}t|�dkrHt�|d	}t	t
t|d�d
���}tjdkr�|dkr�|d
kr�WdSWnttt
fk
r�YnXdS)a�Check if posix_spawn() can be used for subprocess.

    subprocess requires a posix_spawn() implementation that properly reports
    errors to the parent process, & sets errno on the following failures:

    * Process attribute actions failed.
    * File actions failed.
    * exec() failed.

    Prefer an implementation which can use vfork() in some cases for best
    performance.
    �posix_spawnF�darwinT�CS_GNU_LIBC_VERSIONrt)�maxsplitr�r�.ZlinuxZglibc)r��)r��hasattrr�rW�platform�confstr�splitr�r1�tupler�rK�AttributeError�OSError)Zver�partsZlibc�versionr'r'r(�_use_posix_spawn~s 



r�c@s�eZdZdZdZdKdddd�d	d
�Zedd��Zejd
d��Zdd�Z	dd�Z
dd�Zej
ejfdd�Zdd�Zdd�ZdLdd�Zdd�Zdd�ZdMd d!�ZdNd"d#�Zd$d%�Ze�rd&d'�Zd(d)�Zd*d+�Zd,d-�Zdejej ej!fd.d/�Z"d0d1�Z#d2d3�Z$d4d5�Z%d6d7�Z&d8d9�Z'e'Z(n�d:d'�Zd;d<�Z)d=d-�Ze*j+e*j,e*j-e*j.e*j/e*j0fd>d?�Z1de*j2e*j3e4j5fd@d/�Z"dAdB�Z6dCd1�Z#dDd5�Z%dEdF�Z7dGd7�Z&dHd9�Z'dIdJ�Z(dS)Ora� Execute a child program in a new process.

    For a complete description of the arguments see the Python documentation.

    Arguments:
      args: A string, or a sequence of program arguments.

      bufsize: supplied as the buffering argument to the open() function when
          creating the stdin/stdout/stderr pipe file objects

      executable: A replacement program to execute.

      stdin, stdout and stderr: These specify the executed programs' standard
          input, standard output and standard error file handles, respectively.

      preexec_fn: (POSIX only) An object to be called in the child process
          just before the child is executed.

      close_fds: Controls closing or inheriting of file descriptors.

      shell: If true, the command will be executed through the shell.

      cwd: Sets the current directory before the child is executed.

      env: Defines the environment variables for the new process.

      text: If true, decode stdin, stdout and stderr using the given encoding
          (if set) or the system default otherwise.

      universal_newlines: Alias of text, provided for backwards compatibility.

      startupinfo and creationflags (Windows only)

      restore_signals (POSIX only)

      start_new_session (POSIX only)

      pass_fds (POSIX only)

      encoding and errors: Text mode encoding and error handling to use for
          file objects stdin, stdout and stderr.

    Attributes:
        stdin, stdout, stderr, pid, returncode
    Fr\NTrr')�encoding�errorsr�cCslt�t��|_d|_d|_|dkr(d}t|t�s:td��t	rP|dk	r�t
d��n8|rh|sht�dt
�d}|
dk	rxt
d��|d	kr�t
d
��||_d|_d|_d|_d|_d|_||_||_|dk	r�|dk	r�t|�t|�kr�td��|�|||�\}}}}}}t	�rN|dk�rt�|��d	�}|dk�r4t�|��d	�}|dk�rNt�|��d	�}|�pb|�pb|�pb||_d|_d|_|j�r�|d
k�r�d}d}nd}z�|dk�r�t� |d|�|_|j�r�tj!|jd|||d�|_|dk�rt� |d|�|_|j�rtj!|j||d�|_|dk�r:t� |d|�|_|j�r:tj!|j||d�|_|�"||||||
||
||	||||||||�Wn�t#d|j|j|jf�D]*}z|�$�Wnt%k
�r�YnX�q�|j�s`g}|t&k�r�|�'|�|t&k�r�|�'|�|t&k�r�|�'|�t(|d��r|�'|j)�|D]H}z*t	�r8t|t*��r8|�+�n
t,�$|�Wnt%k
�rZYnX�q�YnXdS)zCreate new Popen instance.NFr\zbufsize must be an integerz0preexec_fn is not supported on Windows platformszpass_fds overriding close_fds.Tz2startupinfo is only supported on Windows platformsrz4creationflags is only supported on Windows platformszlCannot disambiguate when both text and universal_newlines are supplied but different. Pass one or the other.g�?rt�wb)�
write_through�line_bufferingr�r��rb)r�r��_devnull)-rR�	threadingZLock�
_waitpid_lock�_input�_communication_started�
isinstancerK�	TypeErrorr�r1�warnings�warn�RuntimeWarningrdr�r5r-�pidr*r�r��boolr�_get_handles�msvcrtZopen_osfhandlerL�	text_mode�_sigint_wait_secs�_closed_child_pipe_fds�io�open�
TextIOWrapper�_execute_child�filter�closer�rrcr�r�rGrJr�)r.rd�bufsize�
executabler�r5r-�
preexec_fn�	close_fdsr��cwd�envr��startupinfo�
creationflags�restore_signals�start_new_session�pass_fdsr�r�r��p2cread�p2cwrite�c2pread�c2pwrite�errread�errwriter��fZto_close�fdr'r'r(r/�s�


��





�
�
��








zPopen.__init__cCs|jSr))r�r2r'r'r(r�~szPopen.universal_newlinescCst|�|_dSr))r�r�)r.r�r'r'r(r��scCs |�||�}|�dd��dd�S)Nz
r��
)�decode�replace)r.r�r�r�r'r'r(�_translate_newlines�szPopen._translate_newlinescCs|Sr)r'r2r'r'r(�	__enter__�szPopen.__enter__cCs�|jr|j��|jr |j��dz|jr4|j��W5|tkr�|jdkrrz|j|jd�Wntk
rpYnXd|_�dS|��XdS)Nrr�)	r5r�r-�KeyboardInterruptr��_waitrr�r�)r.�exc_typer7�	tracebackr'r'r(�__exit__�s 


zPopen.__exit__cCsT|js
dS|jdkr(|d|jt|d�|j|d�|jdkrPtdk	rPt�|�dS)Nzsubprocess %s is still running)�sourcerS)�_child_createdr*r��ResourceWarningrVrUrc)r.Z_maxsizeZ_warnr'r'r(rP�s

�z
Popen.__del__cCs"t|d�st�tjtj�|_|jS)Nr�)r�r�r��devnull�O_RDWRr�r2r'r'r(�_get_devnull�s
zPopen._get_devnullc
Cs�|rZz|j�|�WnDtk
r(Yn2tk
rX}z|jtjkrFn�W5d}~XYnXz|j��WnDtk
r|Yn2tk
r�}z|jtjkr�n�W5d}~XYnXdSr))r��write�BrokenPipeErrorr��errnoZEINVALr�)r.r�r�r'r'r(�_stdin_write�s"zPopen._stdin_writecCsT|jr|rtd��|dkr�|js�|j|j|jg�d�dkr�d}d}|jrT|�|�n6|jrp|j��}|j��n|jr�|j��}|j��|�	�n�|dk	r�t
�|}nd}z�z|�|||�\}}Wnhtk
�r,|dk	r�t
|j|�|��}n|j}d|_z|j|d�Wntk
�r$YnX�YnXW5d|_X|j	|�|�d�}||fS)a9Interact with process: Send data to stdin and close it.
        Read data from stdout and stderr, until end-of-file is
        reached.  Wait for process to terminate.

        The optional "input" argument should be data to be sent to the
        child process, or None, if no data should be sent to the child.
        communicate() returns a tuple (stdout, stderr).

        By default, all communication is in bytes, and therefore any
        "input" should be bytes, and the (stdout, stderr) will be bytes.
        If in text mode (indicated by self.text_mode), any "input" should
        be a string, and (stdout, stderr) will be strings decoded
        according to locale encoding, or by "encoding" if set. Text mode
        is triggered by setting any of text, encoding, errors or
        universal_newlines.
        z.Cannot send input after starting communicationNr�Trr�)r�r1r�r5r-�countr�readr�r��_time�_communicater��minr��_remaining_timer�r)r.r�r<r5r-�endtime�sigint_timeout�stsr'r'r(r��sH
�



�zPopen.communicatecCs|��S)zSCheck if child process has terminated. Set and return returncode
        attribute.)rVr2r'r'r(r�sz
Popen.pollcCs|dkrdS|t�SdS)z5Convenience for _communicate when computing timeouts.N)r)r.r	r'r'r(r"szPopen._remaining_timecCsL|dkrdS|st�|krHt|j||r0d�|�nd|r@d�|�ndd��dS)z2Convenience for checking if a timeout has expired.Nr�r�)rrrdr�)r.r	�orig_timeoutZ
stdout_seqZ
stderr_seq�skip_check_and_raiser'r'r(�_check_timeout*s�zPopen._check_timeoutcCs�|dk	rt�|}z|j|d�WStk
r�|dk	rLt|j|�|��}n|j}d|_z|j|d�Wntk
r|YnX�YnXdS)z=Wait for child process to terminate; returns self.returncode.Nr�r)rr�r�rr�rr)r.r<r	r
r'r'r(r�6s 
�z
Popen.waitc		Cs�t|dd�}t����}trX|dkr.|�|j�|dkrB|�|j�|dkr�|�|j�nr|dkr~|dkr~||kr~|�tj|�|dkr�|dkr�||kr�|�tj|�|dkr�|dkr�||kr�|�tj|�|dk	r�|�tj|�W5QRXd|_dS)Nr�r\T)	rz�
contextlib�	ExitStackr��callbackrJr�r�r�)	r.r�r�r�r�r�r�Z
devnull_fd�stackr'r'r(�_close_pipe_fdsMs$
zPopen._close_pipe_fdscCs~|dkr|dkr|dkrdSd\}}d\}}d\}}	|dkrtt�tj�}|dkr�t�dd�\}}
t|�}t�|
�nh|tkr�t�dd�\}}t|�t|�}}n<|tkr�t�	|�
��}n$t|t�r�t�	|�}nt�	|�
��}|�|�}|dk�r*t�tj�}|dk�r�t�dd�\}
}t|�}t�|
�nn|tk�rXt�dd�\}}t|�t|�}}n@|tk�rrt�	|�
��}n&t|t��r�t�	|�}nt�	|�
��}|�|�}|dk�r�t�tj�}	|	dk�rdt�dd�\}
}	t|	�}	t�|
�n~|tk�rt�dd�\}}	t|�t|	�}}	nP|tk�r$|}	n@|tk�r>t�	|�
��}	n&t|t��rVt�	|�}	nt�	|�
��}	|�|	�}	||||||	fS)�|Construct and return tuple with IO objects:
            p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
            N)r\r\r\r\r\r\�r\r\r)rOZGetStdHandlerZ
CreatePiperGrIrr
r�Z
get_osfhandler�r�rK�fileno�_make_inheritablerrr)r.r�r5r-r�r�r�r�r�r��_r'r'r(r�nst












�zPopen._get_handlescCs&t�t��|t��ddtj�}t|�S)z2Return a duplicate of handle, which is inheritablerrt)rOZDuplicateHandleZGetCurrentProcessZDUPLICATE_SAME_ACCESSrG)r.�handle�hr'r'r(r�s�zPopen._make_inheritablecCstdd�|D��S)z�Filter out console handles that can't be used
            in lpAttributeList["handle_list"] and make sure the list
            isn't empty. This also removes duplicate handles.cSs,h|]$}|d@dks$t�|�tjkr|�qS)�)rOZGetFileTypeZFILE_TYPE_CHAR)�.0rr'r'r(�	<setcomp>�s��z,Popen._filter_handle_list.<locals>.<setcomp>)rF)r.rDr'r'r(�_filter_handle_list�szPopen._filter_handle_listcCszt|t�rnNt|t�r.|
r"td��t|g�}n,t|tj�rR|
rFtd��t|g�}nt|�}|dk	rlt�|�}|dkr|t�}n|�	�}d|||fk}|r�|j
tjO_
||_
||_||_|j}t|o�d|ko�|d�}|s�|�r^|�r^|dkr�i}|_t|�dg��}|d<|�r0|t|�t|�t|�g7}|�|�|dd�<|�r^|�sZt�dt�d}|
�r�|j
tjO_
tj|_|�s�tj�d�}|�s�tj�d	d
�}tj�|dd�}tj�|��s�t d
��tj�|��r�|}n|}d�!||�}|dk	�rt�|�}t"�#d||||�z,t�%||ddt|�|	|||�	\}}}}W5|�$|||
|||�Xd|_&t'|�|_(||_)t�*|�dS)z$Execute program (MS Windows version)z$bytes args is not allowed on Windows�0path-like args is not allowed when shell is trueNr\rDz?startupinfo.lpAttributeList['handle_list'] overriding close_fdsFZComSpecZ
SystemRootr�ZSystem32zcmd.exez:shell not found: neither %ComSpec% nor %SystemRoot% is setz
{} /c "{}"�subprocess.PopenT)+r��str�bytesr�r�r��PathLiker�r#rEr>rOrr?r@rArCr�rFr�rKrr�r�r�rrrB�environ�pathr��isabs�FileNotFoundErrorr�rW�auditrZ
CreateProcessr�rG�_handler�rI)r.rdr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Zunused_restore_signalsZunused_start_new_sessionZuse_std_handlesZattribute_listZhave_handle_listrDZcomspecZsystem_rootZhpZhtr��tidr'r'r(r��s�


��
�
�

��
zPopen._execute_childcCs,|jdkr&||jd�|kr&||j�|_|jS)z�Check if child process has terminated.  Returns returncode
            attribute.

            This method is called by __del__, so it can only refer to objects
            in its local scope.

            Nr)r*r))r.rTZ_WaitForSingleObjectZ_WAIT_OBJECT_0Z_GetExitCodeProcessr'r'r(rVHs
zPopen._internal_pollcCs^|dkrtj}nt|d�}|jdkrXt�|j|�}|tjkrJt|j|��t�	|j�|_|jS)z-Internal implementation of wait() on Windows.Ni�)
rOZINFINITErKr*�WaitForSingleObjectr)ZWAIT_TIMEOUTrrd�GetExitCodeProcess)r.r<Ztimeout_millisr�r'r'r(r�Ys
�
zPopen._waitcCs|�|���|��dSr))rcrr�)r.Zfh�bufferr'r'r(�
_readerthreadiszPopen._readerthreadcCs\|jrBt|d�sBg|_tj|j|j|jfd�|_d|j_|j��|j	r�t|d�s�g|_
tj|j|j	|j
fd�|_d|j_|j��|jr�|�
|�|jdk	r�|j�|�|��|j��r�t|j|��|j	dk	r�|j�|�|��|j��r�t|j|��d}d}|j�r|j}|j��|j	�r0|j
}|j	��|�r>|dnd}|�rP|dnd}||fS)N�_stdout_buff)�targetrdT�_stderr_buffr)r5r�r/r�ZThreadr.Z
stdout_threadZdaemon�startr-r1Z
stderr_threadr�rr�rZis_aliverrdr�)r.r�r	rr5r-r'r'r(rnsJ
��

��







zPopen._communicatecCsl|jdk	rdS|tjkr"|��nF|tjkr>t�|jtj�n*|tjkrZt�|jtj�nt	d�
|���dS)�Send a signal to the process.NzUnsupported signal: {})r*r0�SIGTERM�	terminateZCTRL_C_EVENTr�r�r�ZCTRL_BREAK_EVENTr1r��r.Zsigr'r'r(�send_signal�s




zPopen.send_signalcCsX|jdk	rdSzt�|jd�Wn2tk
rRt�|j�}|tjkrH�||_YnXdS)zTerminates the process.Nrt)r*rOZTerminateProcessr)�PermissionErrorr,ZSTILL_ACTIVE)r.Zrcr'r'r(r5�s

zPopen.terminatec
Cs,d\}}d\}}d\}}	|dkr"n@|tkr8t��\}}n*|tkrJ|��}nt|t�rZ|}n|��}|dkrln@|tkr�t��\}}n*|tkr�|��}nt|t�r�|}n|��}|dkr�nf|tkr�t��\}}	nP|tkr�|dkr�|}	n
t	j
��}	n.|tk�r|��}	nt|t��r|}	n|��}	||||||	fS)rrNr\)rr��piper
r�r�rKrrrW�
__stdout__)
r.r�r5r-r�r�r�r�r�r�r'r'r(r��sP





�cCs�|dkrtj}i}|rJg}dD]"}
tt|
d�}|dk	r|�|�q||d<g}|||	fD]}|dkrX|�tj|f�qX|df|df|
dffD]"\}}|dkr�|�tj||f�q�|r�||d<tj|||f|�|_d	|_	|�
|||||	|
�dS)
z'Execute program using os.posix_spawn().N)�SIGPIPEZSIGXFZ�SIGXFSZZ	setsigdefr\rrtr��file_actionsT)r�r$rzr0rc�POSIX_SPAWN_CLOSE�POSIX_SPAWN_DUP2r�r�r�r)r.rdr�r�r�r�r�r�r�r�r�r�ZsigsetZsignameZsignumr=r�Zfd2r'r'r(�_posix_spawn�s<��zPopen._posix_spawnc)s�t|ttf�r|g}n(t|tj�r6|
r.td��|g}nt|�}|
rlttd�rPdnd}|dg|}�rl�|d<�dkr||d�t�	d�|||�t
�rtj����r|dk�r|�s|�s|dk�r|d	ks�|d
k�r|d	ks�|d
k�r|d	ks�|d
k�r|�s|�
|�|||||
|||�
dS�}t��\}}g}|dk�rT|�|�t�|�}�q2|D]}t�|��qX�zJz�|dk	�r�g}|��D]>\}}t�|�}d|k�r�td
��|�|dt�|���q�nd}t����tj����r�f}nt�fdd�t�|�D��}t|�}|�|�t�|||tttt|���|||||
||||||||�|_d|_W5t�|�X|� |||
|||�t!�}t�"|d�}||7}|�r�t#|�dk�r��q��q�W5t�|�X|�r�z6t�$|jd�\} }!| |jk�r�|�%|!�ntj&|_'Wnt(k
�rYnXz|�)dd
�\}"}#}$|$�*�}$Wn,tk
�rbd}"d}#d�+t|��}$YnXt,t-|"�*d�t.�}%t/|%t0��r�|#�r�t|#d�}&|$dk}'|'�r�d}$|}(n|}(|&dk�r�t�1|&�}$|%|&|$|(��|%|$��dS)zExecute program (POSIX version)rZgetandroidapilevelz/system/bin/shz/bin/shz-crNr r\r�r�=z!illegal environment variable namec3s"|]}tj�t�|���VqdSr))r�r%r��fsencode)r�dir�r�r'r(�	<genexpr>rs�z'Popen._execute_child.<locals>.<genexpr>TiP��:sSubprocessError�0z#Bad exception data from child: {!r}�ascii�Znoexecr�)2r�r!r"r�r#r�rFr�rWr(�_USE_POSIX_SPAWNr%�dirnamer@r9rc�dupr�ryrBr1r��
get_exec_path�set�add�_posixsubprocessZ	fork_exec�sortedr�rKr�r�r�	bytearrayrr��waitpid�_handle_exitstatusrXr*�ChildProcessErrorr�r�r�rz�builtinsr�
issubclassr��strerror))r.rdr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Z
unix_shellZorig_executableZerrpipe_readZ
errpipe_writeZlow_fds_to_closeZlow_fdZenv_list�kriZexecutable_listZfds_to_keepZerrpipe_data�partr�rZexception_nameZ	hex_errno�err_msgZchild_exception_typeZ	errno_numZchild_exec_never_calledZerr_filenamer'rDr(r� s"	��
�����������	�
�





�
�
�
��
�


cCsL||�r||�|_n2||�r*||�|_n||�r@||�|_ntd��dS)�:All callers to this function MUST hold self._waitpid_lock.zUnknown child exit status!N)r*r)r.rZ_WIFSIGNALEDZ	_WTERMSIGZ
_WIFEXITEDZ_WEXITSTATUSZ_WIFSTOPPEDZ	_WSTOPSIGr'r'r(rT�szPopen._handle_exitstatusc
Cs�|jdkr�|j�d�sdSz�z>|jdk	r4|jWW�pS||j|�\}}||jkrX|�|�WnBtk
r�}z$|dk	r|||_n|j|kr�d|_W5d}~XYnXW5|j��X|jS)z�Check if child process has terminated.  Returns returncode
            attribute.

            This method is called by __del__, so it cannot reference anything
            outside of the local scope (nor can any methods it calls).

            NFr)r*r��acquire�releaser�rTr�r)r.rTZ_waitpidZ_WNOHANGZ_ECHILDr�r�er'r'r(rV�s 	



cCs>zt�|j|�\}}Wntk
r4|j}d}YnX||fS)r\r)r�rSr�rU)r.Z
wait_flagsr�rr'r'r(�	_try_wait�s
zPopen._try_waitc	Cs|jdk	r|jS|dk	r�t�|}d}|j�d�r~z>|jdk	rDW�0q�|�tj�\}}||jkrn|�	|�W�q�W5|j��X|�
|�}|dkr�t|j|��t
|d|d�}t�|�q&n\|jdk�r|j�B|jdk	r�W5QR��q|�d�\}}||jk�r
|�	|�W5QRXq�|jS)z+Internal implementation of wait() on POSIX.Ng����Mb@?Frr�g�������?)r*rr�r]r^r`r��WNOHANGr�rTrrrdr�time�sleep)r.r<r	Zdelayr�rZ	remainingr'r'r(r��s6







c
Cs"|jrX|jsXz|j��Wntk
r.YnX|sXz|j��Wntk
rVYnXd}d}|js�i|_|jr~g|j|j<|jr�g|j|j<|jr�|j|j}|jr�|j|j}|�|�|j	r�t
|j	�}t����}|jr�|r�|�|jt
j�|j�r|jj�s|�|jt
j�|j�r6|jj�s6|�|jt
j�|���r�|�|�}|dk	�rz|dk�rz|j||||dd�td��|�|�}	|�||||�|	D]�\}
}|
j|jk�r6||j|jt�}z|jt�|
j|�7_Wn,tk
�r
|�|
j�|
j��Yn*X|jt|j	�k�r�|�|
j�|
j��nP|
j|j|jfk�r�t�|
jd�}
|
�st|�|
j�|
j��|j|
j�|
��q��q6W5QRX|j |�|�d�|dk	�r�d�!|�}|dk	�r�d�!|�}|j"�r|dk	�r�|�#||jj$|jj%�}|dk	�r|�#||jj$|jj%�}||fS)NrT)r
zN_check_timeout(..., skip_check_and_raise=True) failed to raise TimeoutExpired.i�r�r�)&r�r��flushrr�Z_fileobj2outputr5r-�_save_inputr��
memoryview�_PopenSelector�register�	selectorsZEVENT_WRITErHZ
EVENT_READZget_maprr�RuntimeError�selectZfileobj�
_input_offset�	_PIPE_BUFr�r�r�Z
unregisterr�rrcr�r�r�r�r�r�)r.r�r	rr5r-Z
input_viewZselectorr<Zready�keyZevents�chunkr�r'r'r(r's�





��
�
$




�
�cCsF|jrB|jdkrBd|_||_|dk	rB|jrB|j�|jj|jj�|_dS)Nr)r�r�rlr��encoder�r�)r.r�r'r'r(re�s�zPopen._save_inputcCs|jdkrt�|j|�dS)r3N)r*r�r�r�r6r'r'r(r7�s
cCs|�tj�dS)z/Terminate the process with SIGTERM
            N)r7r0r4r2r'r'r(r5�scCs|�tj�dS)z*Kill the process with SIGKILL
            N)r7r0�SIGKILLr2r'r'r(r��sz
Popen.kill)r\NNNNNTFNNNNrTFr')NN)F)N)8r$r%r&r9r�r/r:r�r;r�r�r�rWrXr�r�rPr�rr�r�rrr�rr�r�rrr�rOr+Z
WAIT_OBJECT_0r,rVr�r.rr7r5r�r@r��WIFSIGNALED�WTERMSIG�	WIFEXITED�WEXITSTATUS�
WIFSTOPPED�WSTOPSIGrTrSrarZECHILDr`rer'r'r'r(r�s�-��


D	�

H	
|�
26'�
�
#
)f)Hr9rVrr�r�rbr0rWr�r�rrr�__all__r�rOr��ModuleNotFoundErrorrPrkrirrrrrrrrrrrrrrrr r!r"r�	Exceptionrrrr#rKrGrzrmr�rQrgZSelectSelectorrUrRrrr
rer�rrr
�objectrrr�rr	r�rJrr'r'r'r(�<module>
s�"�P
�
%	


;3"�EI
/typing.cpython-38.pyc000064400000171726150335716500010531 0ustar00U

e5db
�G@s�dZddlmZmZddlZddlZddlZddlZddlZddl	Z
ddlZddlZddlm
Z
mZmZddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKgGZd�dMdN�ZdOdP�ZdQdR�ZdSdT�ZdUdV�ZdWdX�ZgZdYdZ�Zd[d\�ZGd]d^�d^�ZGd_d`�d`�ZGdadb�dbeedLdc�Zedddde�ZedGdfde�Zeddgde�Zeddhde�Z eddide�Z!eddjde�Z"eddkde�Z#Gdld	�d	edLdc�Z$Gdmd�deedLdc�Z%d7dd5d9d:d4d6dddn�	Z&dodp�Z'Gdqdr�dredLdc�Z(Gdsdt�dte(dLdc�Z)Gdud
�d
�Z*Gdvdw�dw�Z+Gdxdy�dy�Z,dzd{d|d}d~gZ-dd�d�d�d�d�d�d�d�d�g
Z.e-e.d�gZ/d�d��Z0d�d��Z1d�d��Z2d�d��Z3dd#ddd%dd!dd'd*g
d�d�gd��Z4Gd�d��d�e�Z5Gd�d
�d
e*e5d��Z6d�dI�Z7d�d?�Z8d�d��Z9ej:ej;ej<ej=e
eefZ>d�d�dC�Z?d�dB�Z@d�dA�ZAd�dE�ZBd�dF�ZCd�d��ZDd�dH�ZEd�d@�ZFe%d��ZGe%d��ZHe%d��ZIe%d�dLd��ZJe%d�dLd��ZKe%d�dLd��ZLe%d�dLd��ZMe%d�dLeNd��ZOe%d>ePeQ�ZRd�d�d��ZSeSejjTd��ZTeSejjUeJ�ZUeSejjVeJeMeKf�ZVeSejjWeJ�ZWeSejjXeJ�ZXeSejjYeJ�ZYeSejjZeJ�ZZeSejj[eJ�Z[eSejj\d��Z\eSejj]eJ�Z]eSejj^eJ�Z^e)ejj_d�dLd��Z_d�e__eSejj`eJ�ZaeSejjbeG�ZbeSejjceHeLf�ZceSejjdeHeIf�ZdeSejjeeJ�ZeeSejjfeG�ZfeSejjgd��Zge)ehd�d�dLd��Zid�ei_eSejeGd�d��ZkeSejleG�ZmeSeneGd�d��Z`eSeoeJd�d��ZpeSejjqeJ�ZqeSejjreH�ZreSejjseHeLf�ZseSejjteL�ZteSejueJ�ZveSejweJ�ZxeSeyeHeIfd�d��ZzeSej{eHeIf�Z|eSej}eHeIf�Z}eSej~eG�Z~eSejeHeIf�ZeSejj�eJeMeKf�Z�eSejj�eJeMf�Z�eSeNeOd�d��Z�d�e�_e7Gd�d0�d0e6��Z�e7Gd�d.�d.e6��Z�e7Gd�d-�d-e6��Z�e7Gd�d,�d,e6��Z�e7Gd�d/�d/e6��Z�e7Gd�d+�d+e6eJ��Z�e7Gd�d1�d1e6eJ��Z�d�dÄZ�d�Z�d�Z�Gd�dDŽd�eN�Z�Gd�d;�d;e�d��Z�d�dʄZ�d�dLd˜d�d̈́Z�d�dτZ�Gd�dфd�eN�Z�Gd�d<�d<eye�d��Z�d�dD�Z�eQZ�d�Z�Gd�dՄd�e*eR�Z�Gd�dׄd�e�eP�Z�Gd�dلd�e�eQ�Z�Gd�dۄdۃZ�e�d�e�_�e�ej�e�j�<eSe
j�eR�Z�eSe
j�eR�Z�Gd�dބdރZ	e�d�e	_�e	ej�e	j�<dS)�a=
The typing module: Support for gradual typing as defined by PEP 484.

At large scale, the structure of the module is following:
* Imports and exports, all public names should be explicitly added to __all__.
* Internal helper functions: these should never be used in code outside this module.
* _SpecialForm and its instances (special forms): Any, NoReturn, ClassVar, Union, Optional
* Two classes whose instances can be type arguments in addition to types: ForwardRef and TypeVar
* The core of internal generics API: _GenericAlias and _VariadicGenericAlias, the latter is
  currently only used by Tuple and Callable. All subscripted types like X[int], Union[int, str],
  etc., are instances of either of these classes.
* The public counterpart of the generics API consists of two classes: Generic and Protocol.
* Public helper functions: get_type_hints, overload, cast, no_type_check,
  no_type_check_decorator.
* Generic aliases for collections.abc ABCs and few additional protocols.
* Special types: NewType, NamedTuple, TypedDict.
* Wrapper submodules for re and io related types.
�)�abstractmethod�ABCMetaN)�WrapperDescriptorType�MethodWrapperType�MethodDescriptorType�Any�Callable�ClassVar�Final�
ForwardRef�Generic�Literal�Optional�Protocol�Tuple�Type�TypeVar�Union�AbstractSet�
ByteString�	Container�ContextManager�Hashable�	ItemsView�Iterable�Iterator�KeysView�Mapping�MappingView�MutableMapping�MutableSequence�
MutableSet�Sequence�Sized�
ValuesView�	Awaitable�
AsyncIterator�
AsyncIterable�	Coroutine�
Collection�AsyncGenerator�AsyncContextManager�
Reversible�SupportsAbs�
SupportsBytes�SupportsComplex�
SupportsFloat�
SupportsIndex�SupportsInt�
SupportsRound�ChainMap�Counter�Deque�Dict�DefaultDict�List�OrderedDict�Set�	FrozenSet�
NamedTuple�	TypedDict�	Generator�AnyStr�cast�final�get_args�
get_origin�get_type_hints�NewType�
no_type_check�no_type_check_decorator�NoReturn�overload�runtime_checkable�Text�
TYPE_CHECKINGTcCs�ttf}|r|ttf}|dkr(td�St|t�r:t|�St|t�r\|j	|kr\t
|�d���t|t�rr|tt
fks~|ttfkr�t
d|�d���t|tttf�r�|St|�s�t
|�d|d�d���|S)a�Check that the argument is a type, and return it (internal helper).

    As a special case, accept None and return type(None) instead. Also wrap strings
    into ForwardRef instances. Consider several corner cases, for example plain
    special forms like Union are not valid, while Union[int, str] is OK, etc.
    The msg argument is a human-readable error message, e.g::

        "Union[arg, ...]: arg should be a type."

    We append the repr() of the actual value (truncated to 100 chars).
    Nz is not valid as type argumentzPlain z Got z.100�.)rrr	r
�type�
isinstance�strr�
_GenericAlias�
__origin__�	TypeError�_SpecialFormrrIr�callable)�arg�msg�is_argumentZinvalid_generic_forms�rZ�/usr/lib64/python3.8/typing.py�_type_checkxs(

�
�r\cCsRt|t�r,|jdkr|jS|j�d|j��S|dkr8dSt|tj�rJ|jSt|�S)a;Return the repr() of an object, special-casing types (internal helper).

    If obj is a type, we return a shorter version than the default
    type.__repr__, based on the module and qualified name, which is
    typically enough to uniquely identify a type.  For everything
    else, we fall back on repr(obj).
    �builtinsrN.z...)rPrO�
__module__�__qualname__�types�FunctionType�__name__�repr)�objrZrZr[�
_type_repr�s

recs\g�|D]J}t|t�r(|�kr(��|�t|t�r|js���fdd�|jD��qt��S)z�Collect all type variable contained in types in order of
    first appearance (lexicographic order). For example::

        _collect_type_vars((T, List[S, T])) == (T, S)
    csg|]}|�kr|�qSrZrZ��.0�t��tvarsrZr[�
<listcomp>�sz&_collect_type_vars.<locals>.<listcomp>)rPr�appendrR�_special�extend�__parameters__�tuple)r`rhrZrir[�_collect_type_vars�s
rqcCs�t|t�s|St|j�}t|j�D]J\}}t|t�r\t|�D]\}}||kr<||||<q<q"t|||�||<q"|jtkr�tt	|�S|�
t	|��S)zjSubstitute type variables 'tvars' with substitutions 'subs'.
    These two must have the same length.
    )rPrR�list�__args__�	enumerater�_subs_tvarsrSrrp�	copy_with)�tprjZsubsZnew_args�arW�iZtvarrZrZr[ru�s



ruc	Cs^|jst|�d���t|�}t|j�}||krZtd||kr>dnd�d|�d|�d|����dS)	z�Check correct count for parameters of a generic cls (internal helper).
    This gives a nice error message in case of count mismatch.
    z is not a generic classzToo ZmanyZfewz parameters for z	; actual z, expected N)rorT�len)�cls�
parametersZalenZelenrZrZr[�_check_generic�s
r}cCs�g}|D]f}t|t�r.|jtkr.|�|j�qt|t�rdt|�dkrd|dtkrd|�|dd��q|�|�qt	|�}t|�t|�kr�g}|D] }||kr�|�|�|�
|�q�|}|r�t|��t|�S)zyAn internal helper for Union creation and substitution: flatten Unions
    among parameters, then remove duplicates.
    r�N)rPrRrSrrnrsrprzrl�set�remove�AssertionError)r|�params�pZ
all_paramsZ
new_paramsrhrZrZr[�_remove_dups_flatten�s""
r�cs4t�����t��j�t�����fdd��}|S)zInternal wrapper caching __getitem__ of generic types with a fallback to
    original function for non-hashable arguments.
    cs,z�||�WStk
r YnX�||�S�N�rT��args�kwds��cached�funcrZr[�inner�s
z_tp_cache.<locals>.inner)�	functools�	lru_cache�	_cleanupsrl�cache_clear�wraps)r�r�rZr�r[�	_tp_cache�s
r�csbt|t�r|����St|t�r^t��fdd�|jD��}||jkrH|S|�|�}|j|_|S|S)z�Evaluate all forward references in the given type t.
    For use of globalns and localns see the docstring for get_type_hints().
    c3s|]}t|���VqdSr�)�
_eval_type�rgrx��globalns�localnsrZr[�	<genexpr>sz_eval_type.<locals>.<genexpr>)rPr�	_evaluaterRrprsrvrm)rhr�r�Zev_args�resrZr�r[r�	s



r�c@seZdZdZdZdd�ZdS)�_FinalzMixin to prohibit subclassing)�__weakref__cOsd|krtd��dS)N�_rootz&Cannot subclass special typing classesr���selfr�r�rZrZr[�__init_subclass__sz_Final.__init_subclass__N)rbr^r_�__doc__�	__slots__r�rZrZrZr[r�sr�c@s eZdZdZdd�Zdd�ZdS)�
_Immutablez3Mixin to indicate that object should not be copied.cCs|Sr�rZ�r�rZrZr[�__copy__%sz_Immutable.__copy__cCs|Sr�rZ)r�ZmemorZrZr[�__deepcopy__(sz_Immutable.__deepcopy__N)rbr^r_r�r�r�rZrZrZr[r�"sr�cspeZdZdZdZ�fdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
edd��Z�ZS)rUzhInternal indicator of special typing constructs.
    See _doc instance attribute for specific docs.
    ��_nameZ_doccsBt|�dkr6t|dt�r6t|dt�r6td|����t��|�S)z�Constructor.

        This only exists to give a better error message in case
        someone tries to subclass a special typing object (not a good idea).
        �rr~zCannot subclass )rzrPrQrprT�super�__new__)r{r�r���	__class__rZr[r�3s��z_SpecialForm.__new__cCs||_||_dSr�r�)r��name�docrZrZr[�__init__@sz_SpecialForm.__init__cCst|t�stS|j|jkSr�)rPrU�NotImplementedr��r��otherrZrZr[�__eq__Ds
z_SpecialForm.__eq__cCst|jf�Sr�)�hashr�r�rZrZr[�__hash__Isz_SpecialForm.__hash__cCs
d|jS)N�typing.�r�r�rZrZr[�__repr__Lsz_SpecialForm.__repr__cCs|jSr�r�r�rZrZr[�
__reduce__Osz_SpecialForm.__reduce__cOstd|����dS)NzCannot instantiate r�r�rZrZr[�__call__Rsz_SpecialForm.__call__cCst|�d���dS)Nz! cannot be used with isinstance()r��r�rdrZrZr[�__instancecheck__Usz_SpecialForm.__instancecheck__cCst|�d���dS)Nz! cannot be used with issubclass()r��r�r{rZrZr[�__subclasscheck__Xsz_SpecialForm.__subclasscheck__cs�|jdkr(t||j�d��}t||f�S|jdkr�|dkrBtd��t|t�sR|f}d�t�fdd�|D��}t|�}t|�d	kr�|d
St||�S|jdkr�t|d�}t|t	d�fS|jd
kr�t||�St|�d���dS)N)r	r
z accepts only single type.rrZz Cannot take a Union of no types.z)Union[arg, ...]: each arg must be a type.c3s|]}t|��VqdSr��r\�rgr��rXrZr[r�fsz+_SpecialForm.__getitem__.<locals>.<genexpr>r~rrz#Optional[t] requires a single type.r
z is not subscriptable)
r�r\rRrTrPrpr�rzrrO)r�r|�itemrWrZr�r[�__getitem__[s(







z_SpecialForm.__getitem__)rbr^r_r�r�r�r�r�r�r�r�r�r�r�r�r��
__classcell__rZrZr�r[rU,s
rU)r�a`Special type indicating an unconstrained type.

    - Any is compatible with every type.
    - Any assumed to have all methods.
    - All values assumed to be instances of Any.

    Note that all the above statements are true from the point of view of
    static type checkers. At runtime, Any should not be used with instance
    or class checks.
    )r�aSpecial type indicating functions that never return.
    Example::

      from typing import NoReturn

      def stop() -> NoReturn:
          raise Exception('no way')

    This type is invalid in other positions, e.g., ``List[NoReturn]``
    will fail in static type checkers.
    a3Special type construct to mark class variables.

    An annotation wrapped in ClassVar indicates that a given
    attribute is intended to be used as a class variable and
    should not be set on instances of that class. Usage::

      class Starship:
          stats: ClassVar[Dict[str, int]] = {} # class variable
          damage: int = 10                     # instance variable

    ClassVar accepts only types and cannot be further subscribed.

    Note that ClassVar is not a class itself, and should not
    be used with isinstance() or issubclass().
    a�Special typing construct to indicate final names to type checkers.

    A final name cannot be re-assigned or overridden in a subclass.
    For example:

      MAX_SIZE: Final = 9000
      MAX_SIZE += 1  # Error reported by type checker

      class Connection:
          TIMEOUT: Final[int] = 10

      class FastConnector(Connection):
          TIMEOUT = 1  # Error reported by type checker

    There is no runtime checking of these properties.
    a'Union type; Union[X, Y] means either X or Y.

    To define a union, use e.g. Union[int, str].  Details:
    - The arguments must be types and there must be at least one.
    - None as an argument is a special case and is replaced by
      type(None).
    - Unions of unions are flattened, e.g.::

        Union[Union[int, str], float] == Union[int, str, float]

    - Unions of a single argument vanish, e.g.::

        Union[int] == int  # The constructor actually returns int

    - Redundant arguments are skipped, e.g.::

        Union[int, str, int] == Union[int, str]

    - When comparing unions, the argument order is ignored, e.g.::

        Union[int, str] == Union[str, int]

    - You cannot subclass or instantiate a union.
    - You can use Optional[X] as a shorthand for Union[X, None].
    zEOptional type.

    Optional[X] is equivalent to Union[X, None].
    a�Special typing form to define literal types (a.k.a. value types).

    This form can be used to indicate to type checkers that the corresponding
    variable or function parameter has a value equivalent to the provided
    literal (or one of several literals):

      def validate_simple(data: Any) -> Literal[True]:  # always returns True
          ...

      MODE = Literal['r', 'rb', 'w', 'wb']
      def open_helper(file: str, mode: MODE) -> str:
          ...

      open_helper('/some/path', 'r')  # Passes type check
      open_helper('/other/path', 'typo')  # Error in type checker

   Literal[...] cannot be subclassed. At runtime, an arbitrary value
   is allowed as type argument to Literal[...], but type checkers may
   impose restrictions.
    c@s>eZdZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)rz-Internal wrapper to hold a forward reference.)�__forward_arg__�__forward_code__�__forward_evaluated__�__forward_value__�__forward_is_argument__TcCsnt|t�std|����zt|dd�}Wn"tk
rJtd|����YnX||_||_d|_d|_||_	dS)Nz*Forward reference must be a string -- got z<string>�evalz/Forward reference must be an expression -- got F)
rPrQrT�compile�SyntaxErrorr�r�r�r�r�)r�rWrY�coderZrZr[r��s
zForwardRef.__init__cCsj|jr||k	rd|dkr(|dkr(i}}n|dkr6|}n|dkrB|}tt|j||�d|jd�|_d|_|jS)Nz*Forward references must evaluate to types.�rYT)r�r\r�r�r�r�)r�r�r�rZrZr[r��s
�zForwardRef._evaluatecCs>t|t�stS|jr2|jr2|j|jko0|j|jkS|j|jkSr�)rPrr�r�r�r�r�rZrZr[r�s

�zForwardRef.__eq__cCs
t|j�Sr�)r�r�r�rZrZr[r�szForwardRef.__hash__cCsd|j�d�S)NzForwardRef(�))r�r�rZrZr[r�szForwardRef.__repr__N)T)
rbr^r_r�r�r�r�r�r�r�rZrZrZr[r�s

c@s6eZdZdZdZdddd�dd�Zdd	�Zd
d�ZdS)ra�Type variable.

    Usage::

      T = TypeVar('T')  # Can be anything
      A = TypeVar('A', str, bytes)  # Must be str or bytes

    Type variables exist primarily for the benefit of static type
    checkers.  They serve as the parameters for generic types as well
    as for generic function definitions.  See class Generic for more
    information on generic types.  Generic functions work as follows:

      def repeat(x: T, n: int) -> List[T]:
          '''Return a list containing n references to x.'''
          return [x]*n

      def longest(x: A, y: A) -> A:
          '''Return the longest of two strings.'''
          return x if len(x) >= len(y) else y

    The latter example's signature is essentially the overloading
    of (str, str) -> str and (bytes, bytes) -> bytes.  Also note
    that if the arguments are instances of some subclass of str,
    the return type is still plain str.

    At runtime, isinstance(x, T) and issubclass(C, T) will raise TypeError.

    Type variables defined with covariant=True or contravariant=True
    can be used to declare covariant or contravariant generic types.
    See PEP 484 for more details. By default generic types are invariant
    in all type variables.

    Type variables can be introspected. e.g.:

      T.__name__ == 'T'
      T.__constraints__ == ()
      T.__covariant__ == False
      T.__contravariant__ = False
      A.__constraints__ == (str, bytes)

    Note that only type variables defined in global scope can be pickled.
    )rb�	__bound__�__constraints__�
__covariant__�__contravariant__NF)�bound�	covariant�
contravariantc	s�||_|r|rtd��t|�|_t|�|_|r>|dk	r>td��|rVt|�dkrVtd��d�t�fdd�|D��|_|r�t	|d�|_
nd|_
zt�d�j
�d	d
�}Wnttfk
r�d}YnX|dkr�||_dS)Nz"Bivariant types are not supported.z-Constraints cannot be combined with bound=...r~z"A single constraint is not allowedz:TypeVar(name, constraint, ...): constraints must be types.c3s|]}t|��VqdSr�r�rfr�rZr[r�Vsz#TypeVar.__init__.<locals>.<genexpr>zBound must be a type.rb�__main__�typing)rb�
ValueError�boolr�r�rTrzrpr�r\r��sys�	_getframe�	f_globals�get�AttributeErrorr^)r�r�r�r�r�ZconstraintsZdef_modrZr�r[r�Js(


zTypeVar.__init__cCs&|jrd}n|jrd}nd}||jS)N�+�-�~)r�r�rb)r��prefixrZrZr[r�bszTypeVar.__repr__cCs|jSr�)rbr�rZrZr[r�kszTypeVar.__reduce__)rbr^r_r�r�r�r�r�rZrZrZr[rs+�	)	rrrp�dictr�	frozenset�deque�defaultdictrOr;cCs|�d�o|�d�S)N�__)�
startswith�endswith)�attrrZrZr[�
_is_dunder�sr�cs�eZdZdZdddd�dd�Zedd	��Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
�fdd�Zdd�Zdd�Zdd�Z�ZS) rRa�The central part of internal API.

    This represents a generic version of type 'origin' with type arguments 'params'.
    There are two kind of these aliases: user defined and special. The special ones
    are wrappers around builtin collections and ABCs in collections.abc. These must
    have 'name' always set. If 'inst' is False, then the alias can't be instantiated,
    this is used by e.g. typing.List and typing.Dict.
    TFN)�inst�specialr�cCsz||_||_|r*|dkr*|j}t�||�}||_t|t�s@|f}||_tdd�|D��|_	t
|�|_d|_|sv|j
|_
dS)Ncss*|]"}|tkrdn|tkrdn|VqdS).rZN)�_TypingEllipsis�_TypingEmptyr�rZrZr[r��s�z)_GenericAlias.__init__.<locals>.<genexpr>)�_instrmrb�_normalize_aliasr�r�rPrprSrsrqror�r^)r��originr�r�r�r�Z	orig_namerZrZr[r��s 
�

z_GenericAlias.__init__cs^|jttfkrtd|����t|t�s,|f}d�t�fdd�|D��}t||�t||j|�S)Nz%Cannot subscript already-subscripted �*Parameters to generic types must be types.c3s|]}t|��VqdSr�r�r�r�rZr[r��sz,_GenericAlias.__getitem__.<locals>.<genexpr>)	rSrrrTrPrpr}ruro�r�r�rZr�r[r��s

z_GenericAlias.__getitem__cCst|j||j|jd�S)N)r�r�)rRrSr�r�r�rZrZr[rv�sz_GenericAlias.copy_withcCs�|jdks&t|j�dkrx|jdtkrx|jr8d|j}n
t|j�}|jshdd�dd�|jD���d	�}nd
}|�|��S|jr�dSdd�d
d�|jdd�D���dt|jd��d	�S)Nr�rr��[�, cSsg|]}t|��qSrZ�rer�rZrZr[rk�sz*_GenericAlias.__repr__.<locals>.<listcomp>�]�ztyping.Callableztyping.Callable[[cSsg|]}t|��qSrZr�r�rZrZr[rk�s���z], )r�rzrs�EllipsisrerSrm�join)r�r�r�rZrZr[r��s
��
 z_GenericAlias.__repr__cCsRt|t�stS|j|jkrdS|jtkrF|jtkrFt|j�t|j�kS|j|jkS)NF)rPrRr�rSrr�rsr�rZrZr[r��s
z_GenericAlias.__eq__cCs,|jtkrttt|j�f�St|j|jf�Sr�)rSrr�r�rsr�rZrZr[r��s
z_GenericAlias.__hash__cOsT|js$td|j�d|j���d���|j||�}z
||_Wntk
rNYnX|S)N�Type z cannot be instantiated; use z
() instead)r�rTr��lowerrS�__orig_class__r�)r�r��kwargs�resultrZrZr[r��s
z_GenericAlias.__call__cCs�|jrZg}|j|kr |�|j�|�|�}tdd�||dd�D��sR|�t�t|�S|jtkr�t|krpdS|�|�}||dd�D]}t|t	�r�||k	r�dSq�|jfS)Ncss"|]}t|t�pt|t�VqdSr�)rPrR�
issubclassr�rg�brZrZr[r��s�z0_GenericAlias.__mro_entries__.<locals>.<genexpr>r~rZ)
r�rSrl�index�anyrrprrPrR)r��basesr�ryrrZrZr[�__mro_entries__�s$

�


z_GenericAlias.__mro_entries__cCs*d|jkrt|�st|j|�St|��dS)NrS)�__dict__r��getattrrSr�)r�r�rZrZr[�__getattr__�sz_GenericAlias.__getattr__cs2t|�s|dkr t��||�nt|j||�dS)N)r�r�rm)r�r��__setattr__�setattrrS)r�r��valr�rZr[r�sz_GenericAlias.__setattr__cCs|�t|��Sr�)r�rOr�rZrZr[r�sz_GenericAlias.__instancecheck__cCs<|jr0t|t�st||j�S|jr0t|j|j�Std��dS)NzBSubscripted generics cannot be used with class and instance checks)rmrPrRrrSrTr�rZrZr[r�s
z_GenericAlias.__subclasscheck__cCs�|jr|jS|jr t�|j}n|j}|tkrht|j�dkrJ|jdtksht|jdd��|jdf}n*t	|j�}t|�dkr�t
|dt	�s�|\}tj||ffS)Nr�rr�r~)
rmr��globalsrSrrzrsr�rrrprP�operator�getitem)r�r�r�rZrZr[r�s��
z_GenericAlias.__reduce__)rbr^r_r�r�r�r�rvr�r�r�r�rrrr�r�r�r�rZrZr�r[rR�s
		rRcs,eZdZdZdd�Ze�fdd��Z�ZS)�_VariadicGenericAliasz�Same as _GenericAlias above but for variadic aliases. Currently,
    this is used only by special internal aliases: Tuple and Callable.
    cCs�|jdks|js|�|�St|t�r0t|�dkr8td��|\}}|tkrRt|f}n$t|t�sjtd|����t|�|f}|�|�S)Nrr�z6Callable must be used as Callable[[arg, ...], result].z1Callable[args, result]: args must be a list. Got )	r�rm�__getitem_inner__rPrprzrTr�rr)r�r�r�rrZrZr[r�"s


z!_VariadicGenericAlias.__getitem__cs
|jtkr�|jr�|dkr$|�tf�St|t�s4|f}t|�dkrl|ddkrld�t|d��}|�|tf�Sd�t�fdd	�|D��}|�|�S|jt	j
jkr�|jr�|\}}d
�t|��}|tkr�|�t|f�Sd�t�fdd	�|D��}||f}|�|�St
��|�S)
NrZr�r~.z Tuple[t, ...]: t must be a type.rz*Tuple[t0, t1, ...]: each t must be a type.c3s|]}t|��VqdSr�r�r�r�rZr[r�>sz:_VariadicGenericAlias.__getitem_inner__.<locals>.<genexpr>z.Callable[args, result]: result must be a type.z6Callable[[arg, ...], result]: each arg must be a type.c3s|]}t|��VqdSr�r�)rgrWr�rZr[r�Gs)rSrprmrvr�rPrzr\r��collections�abcrr�r�r�)r�r�r�r�rr�r�r[r2s.




z'_VariadicGenericAlias.__getitem_inner__)rbr^r_r�r�r�rr�rZrZr�r[rsrcs@eZdZdZdZdZ�fdd�Zedd��Z�fdd	�Z	�Z
S)
raCAbstract base class for generic types.

    A generic type is typically declared by inheriting from
    this class parameterized with one or more type variables.
    For example, a generic mapping type might be defined as::

      class Mapping(Generic[KT, VT]):
          def __getitem__(self, key: KT) -> VT:
              ...
          # Etc.

    This class can then be used as follows::

      def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
          try:
              return mapping[key]
          except KeyError:
              return default
    rZFcs^|ttfkrtd|j�d���t�jtjkrF|jtjk	rFt��|�}nt�j|f|�|�}|S)Nrz< cannot be instantiated; it can be used only as a base class)rrrTrbr�r��objectr�)r{r�r�rdr�rZr[r�dszGeneric.__new__cs�t|t�s|f}|s.|tk	r.td|j�d���d�t�fdd�|D��}|ttfkr�tdd�|D��sxtd|j�d���t	t
|��t	|�kr�td|j�d	���n
t||�t||�S)
NzParameter list to z[...] cannot be emptyr�c3s|]}t|��VqdSr�r�r�r�rZr[r�vsz,Generic.__class_getitem__.<locals>.<genexpr>css|]}t|t�VqdSr�)rPrr�rZrZr[r�yszParameters to z [...] must all be type variablesz[...] must all be unique)
rPrprrTr_rr�allrbrzrr}rR)r{r�rZr�r[�__class_getitem__ns&
���
zGeneric.__class_getitem__c
s
t�j||�g}d|jkr(t|jk}nt|jko:|jdk}|rHtd��d|jkr�t|j�}d}|jD].}t	|t
�rf|jtkrf|dk	r�td��|j}qf|dk	r�t
|�}t
|��|�ks�d��fdd�|D��}d�dd�|D��}	td	|�d
|	�d���|}t|�|_dS)N�__orig_bases__rz!Cannot inherit from plain Genericz0Cannot inherit from Generic[...] multiple types.r�c3s|]}|�krt|�VqdSr��rQrf�ZgvarsetrZr[r��sz,Generic.__init_subclass__.<locals>.<genexpr>css|]}t|�VqdSr�r)rg�grZrZr[r��szSome type variables (z) are not listed in Generic[r�)r�r�r
rr�	__bases__rbrTrqrPrRrSrorrrp)
r{r�rrj�errorZgvars�baseZtvarsetZs_varsZs_argsr�rr[r��s8




��zGeneric.__init_subclass__)rbr^r_r�r��_is_protocolr�r�rr�r�rZrZr�r[rMs

c@seZdZdZdS)r�z�Internal placeholder for () or []. Used by TupleMeta and CallableMeta
    to allow empty list/tuple in specific places, without allowing them
    to sneak in where prohibited.
    N�rbr^r_r�rZrZrZr[r��sr�c@seZdZdZdS)r�z(Internal placeholder for ... (ellipsis).Nr%rZrZrZr[r��sr�rorrr$�_is_runtime_protocol�__abstractmethods__�__annotations__r
r�r�r^r�r��__subclasshook__r��_MutableMapping__markercCsrt�}|jdd�D]X}|jdkr$qt|di�}t|j���t|���D] }|�d�sJ|tkrJ|�	|�qJq|S)z�Collect protocol members from a protocol class objects.

    This includes names actually defined in the class dictionary, as well
    as names that appear in annotations. Special names (above) are skipped.
    Nr�)rrr(Z_abc_)
r�__mro__rbrrrr
�keysr��EXCLUDED_ATTRIBUTES�add)r{�attrsr#�annotationsr�rZrZr[�_get_protocol_attrs�s
r1cst�fdd�t��D��S)Nc3s|]}tt�|d��VqdSr�)rVr�rgr��r{rZr[r��sz,_is_callable_members_only.<locals>.<genexpr>)rr1r3rZr3r[�_is_callable_members_only�sr4cOst|�jrtd��dS)Nz Protocols cannot be instantiated)rOr$rT)r�r�rrZrZr[�_no_init�s
r5c	Cs6zt�d�jddkWSttfk
r0YdSXdS)z�Allow instnance and class checks for special stdlib modules.

    The abc and functools modules indiscriminately call isinstance() and
    issubclass() on the whole MRO of a user class, which may contain protocols.
    r�rb)rr�TN)r�r�r�r�r�rZrZrZr[�_allow_reckless_class_cheks�sr6�AbstractContextManager�AbstractAsyncContextManager)zcollections.abc�
contextlibcseZdZ�fdd�Z�ZS)�
_ProtocolMetacsVt�dd�rt��r$t�j��r$dS�jrJt��fdd�t��D��rJdSt����S)Nr$FTc3s8|]0}t�|�o.tt�|d��p.t�|�dk	VqdSr�)�hasattrrVrr2�r{�instancerZr[r��s�
z2_ProtocolMeta.__instancecheck__.<locals>.<genexpr>)	rr4rr�r$rr1r�r�r<r�r<r[r��s�
��z_ProtocolMeta.__instancecheck__)rbr^r_r�r�rZrZr�r[r:�sr:cs,eZdZdZdZdZdZ�fdd�Z�ZS)raZBase class for protocol classes.

    Protocol classes are defined as::

        class Proto(Protocol):
            def meth(self) -> int:
                ...

    Such classes are primarily used with static type checkers that recognize
    structural subtyping (static duck-typing), for example::

        class C:
            def meth(self) -> int:
                return 0

        def func(x: Proto) -> int:
            return x.meth()

        func(C())  # Passes static type check

    See PEP 544 for details. Protocol classes decorated with
    @typing.runtime_checkable act as simple-minded runtime protocols that check
    only the presence of given attributes, ignoring their type signatures.
    Protocol classes can be generic, they are defined as::

        class GenProto(Protocol[T]):
            def meth(self) -> T:
                ...
    rZTFcs�t�j||��j�dd�s2tdd��jD���_�fdd�}d�jkrN|�_�jsXdS�jD]F}|tt	fks^|j
tkr�|jt|j
ks^t
|t	�r�|js^td|��q^t�_dS)	Nr$Fcss|]}|tkVqdSr�)rrrZrZr[r�)sz-Protocol.__init_subclass__.<locals>.<genexpr>cs��j�dd�stSt�dd�s0t�r(tStd��t��sJt�rBtStd��t|t�s\td��t	��D]v}|j
D]b}||jkr�|j|dkr�tSqdt|di�}t|tjj
�rn||krnt|t�rn|jrnqdqntSqddS)	Nr$Fr&zLInstance and class checks can only be used with @runtime_checkable protocolsz<Protocols with non-method members don't support issubclass()z"issubclass() arg 1 must be a classr(T)r
r�r�rr6rTr4rPrOr1r+rrrrrr$)r�r�r#r0r3rZr[�_proto_hook,s:


���
z/Protocol.__init_subclass__.<locals>._proto_hookr)z7Protocols can only inherit from other protocols, got %r)r�r�r
r�r
r!r$r)rrr^�_PROTO_WHITELISTrbrrTr5r�)r{r�rr>r#r�r3r[r�$s,&

�����zProtocol.__init_subclass__)	rbr^r_r�r�r$r&r�r�rZrZr�r[rs
)�	metaclasscCs&t|t�r|jstd|��d|_|S)a9Mark a protocol class as a runtime protocol.

    Such protocol can be used with isinstance() and issubclass().
    Raise TypeError if applied to a non-protocol class.
    This allows a simple-minded structural check very similar to
    one trick ponies in collections.abc such as Iterable.
    For example::

        @runtime_checkable
        class Closable(Protocol):
            def close(self): ...

        assert isinstance(open('/some/file'), Closable)

    Warning: this will check only the presence of the required methods,
    not their type signatures!
    zB@runtime_checkable can be only applied to protocol classes, got %rT)rrr$rTr&r3rZrZr[rKds�cCs|S)z�Cast a value to a type.

    This returns the value unchanged.  To the type checker this
    signals that the return value has the designated type, but at
    runtime we intentionally don't check anything (we want this
    to be as fast as possible).
    rZ)�typrrZrZr[rA}sc
Cs�z
|j}Wntk
r"iYSX|j}|j}|d|�}|jpDd}|j}|rXt|�ni}|t|�}t||d�|�D]\}}	||ks�t	�|	||<qz|S)z:Internal helper to extract the default arguments, by name.NrZ)
�__code__r��co_argcount�co_varnames�__defaults__�__kwdefaults__r�rz�zipr�)
r�r�Z	pos_countZ	arg_names�defaultsZ
kwdefaultsr�Z
pos_offsetr��valuerZrZr[�
_get_defaults�s



rJcCs�t|dd�riSt|t�r�i}t|j�D]z}|dkrDtj|jj}n|}|j�	di�}|�
�D]B\}}|dkrvtd�}t|t�r�t|dd�}t
|||�}|||<q^q(|S|dkr�t|tj�r�|j}n"|}	t|	d�r�|	j}	q�t|	di�}|dkr�|}n|dk�r|}t|dd�}|dk�r6t|t��r(iStd�|���t|�}
t|�}|�
�D]d\}}|dk�rhtd�}t|t��r|t|�}t
|||�}||
k�r�|
|dk�r�t|}|||<�qN|S)	a�Return type hints for an object.

    This is often the same as obj.__annotations__, but it handles
    forward references encoded as string literals, and if necessary
    adds Optional[t] if a default value equal to None is set.

    The argument may be a module, class, method, or function. The annotations
    are returned as a dictionary. For classes, annotations include also
    inherited members.

    TypeError is raised if the argument is not of a type that can contain
    annotations, and an empty dictionary is returned if no annotations are
    present.

    BEWARE -- the behavior of globalns and localns is counterintuitive
    (unless you are familiar with how eval() and exec() work).  The
    search order is locals first, then globals.

    - If no dict arguments are passed, an attempt is made to use the
      globals from obj (or the respective module's globals for classes),
      and these are also used as the locals.  If the object does not appear
      to have globals, an empty dictionary is used.

    - If one dict argument is passed, it is used for both globals and
      locals.

    - If two dict arguments are passed, they specify globals and
      locals, respectively.
    �__no_type_check__Nr(Fr��__wrapped__�__globals__z1{!r} is not a module, class, method, or function.)rrPrO�reversedr+r��modulesr^r
r��itemsrQrr�r`�
ModuleTyper;rL�_allowed_typesrT�formatrJr�r)rdr�r�Zhintsr#Zbase_globals�annr�rIZnsobjrHrZrZr[rE�s^




�
cCs t|t�r|jS|tkrtSdS)a�Get the unsubscripted version of a type.

    This supports generic types, Callable, Tuple, Union, Literal, Final and ClassVar.
    Return None for unsupported types. Examples::

        get_origin(Literal[42]) is Literal
        get_origin(int) is None
        get_origin(ClassVar[int]) is ClassVar
        get_origin(Generic) is Generic
        get_origin(Generic[T]) is Generic
        get_origin(Union[T, int]) is Union
        get_origin(List[Tuple[T, T]][int]) == list
    N)rPrRrSr)rwrZrZr[rD�s

cCsRt|t�rN|jsN|j}t|�tjjkrJ|dtk	rJt	|dd��|df}|SdS)a�Get type arguments with all substitutions performed.

    For unions, basic simplifications used by Union constructor are performed.
    Examples::
        get_args(Dict[str, int]) == (str, int)
        get_args(int) == ()
        get_args(Union[int, Union[T, int], str][int]) == (int, str)
        get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, int])
        get_args(Callable[[], T][int]) == ([], int)
    rNr�rZ)
rPrRrmrsrDrrrr�rr)rwr�rZrZr[rCscCs�t|t�rt|j��}|j��D]"\}}||j|fkr|�|�q|��D](}t|tj	�r`d|_
t|t�rJt|�qJz
d|_
Wntk
r�YnX|S)aIDecorator to indicate that annotations are not type hints.

    The argument must be a class or function; if it is a class, it
    applies recursively to all methods and classes defined in that class
    (but not to methods defined in its superclasses or subclasses).

    This mutates the function(s) or class(es) in place.
    T)
rPrOr
�copyrPr!�pop�valuesr`rarKrGrT)rWZ	arg_attrsr�rrdrZrZr[rGs	




cst����fdd��}|S)z�Decorator to give another decorator the @no_type_check effect.

    This wraps the decorator with something that wraps the decorated
    function in @no_type_check.
    cs�||�}t|�}|Sr�)rG)r�r�r���	decoratorrZr[�wrapped_decorator@s
z2no_type_check_decorator.<locals>.wrapped_decorator)r�r�)rYrZrZrXr[rH9scOstd��dS)z*Helper for @overload to raise when called.z�You should not call an overloaded function. A series of @overload-decorated functions outside a stub module should always be followed by an implementation that is not @overload-ed.N)�NotImplementedErrorr�rZrZr[�_overload_dummyIs�r\cCstS)a
Decorator for overloaded functions/methods.

    In a stub file, place two or more stub definitions for the same
    function in a row, each decorated with @overload.  For example:

      @overload
      def utf8(value: None) -> None: ...
      @overload
      def utf8(value: bytes) -> bytes: ...
      @overload
      def utf8(value: str) -> bytes: ...

    In a non-stub file (i.e. a regular .py file), do the same but
    follow it with an implementation.  The implementation should *not*
    be decorated with @overload.  For example:

      @overload
      def utf8(value: None) -> None: ...
      @overload
      def utf8(value: bytes) -> bytes: ...
      @overload
      def utf8(value: str) -> bytes: ...
      def utf8(value):
          # implementation goes here
    )r\)r�rZrZr[rJRscCs|S)aVA decorator to indicate final methods and final classes.

    Use this decorator to indicate to type checkers that the decorated
    method cannot be overridden, and decorated class cannot be subclassed.
    For example:

      class Base:
          @final
          def done(self) -> None:
              ...
      class Sub(Base):
          def done(self) -> None:  # Error reported by type checker
                ...

      @final
      class Leaf:
          ...
      class Other(Leaf):  # Error reported by type checker
          ...

    There is no runtime checking of these properties.
    rZ)�frZrZr[rBos�T�KT�VT�T_co)r��V_co�VT_co�T_contra)r��CT_co)r�r�cCst||d|d�S)NT)r�r�)rR)r�r�r�rZrZr[�_alias�srfrZ)r�a�Callable type; Callable[[int], str] is a function of (int) -> str.

    The subscription syntax must always be used with exactly two
    values: the argument list and the return type.  The argument list
    must be a list of types or ellipsis; the return type must be a single type.

    There is no syntax to indicate optional or keyword arguments,
    such function types are rarely used as callback types.
    F)r�r�a@Tuple type; Tuple[X, Y] is the cross-product type of X and Y.

    Example: Tuple[T1, T2] is a tuple of two elements corresponding
    to type variables T1 and T2.  Tuple[int, float, str] is a tuple
    of an int, a float and a string.

    To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
    )r�a�A special construct usable to annotate class objects.

    For example, suppose we have the following classes::

      class User: ...  # Abstract base for User classes
      class BasicUser(User): ...
      class ProUser(User): ...
      class TeamUser(User): ...

    And a function that takes a class argument that's a subclass of
    User and returns an instance of the corresponding class::

      U = TypeVar('U', bound=User)
      def new_user(user_class: Type[U]) -> U:
          user = user_class()
          # (Here we could write the user object to a database)
          return user

      joe = new_user(BasicUser)

    At this point the type checker knows that joe has type BasicUser.
    c@s&eZdZdZdZeed�dd��ZdS)r2z(An ABC with one abstract method __int__.rZ��returncCsdSr�rZr�rZrZr[�__int__�szSupportsInt.__int__N)rbr^r_r�r�r�intrirZrZrZr[r2�sc@s&eZdZdZdZeed�dd��ZdS)r0z*An ABC with one abstract method __float__.rZrgcCsdSr�rZr�rZrZr[�	__float__szSupportsFloat.__float__N)rbr^r_r�r�r�floatrkrZrZrZr[r0�sc@s&eZdZdZdZeed�dd��ZdS)r/z,An ABC with one abstract method __complex__.rZrgcCsdSr�rZr�rZrZr[�__complex__
szSupportsComplex.__complex__N)rbr^r_r�r�r�complexrmrZrZrZr[r/sc@s&eZdZdZdZeed�dd��ZdS)r.z*An ABC with one abstract method __bytes__.rZrgcCsdSr�rZr�rZrZr[�	__bytes__szSupportsBytes.__bytes__N)rbr^r_r�r�r�bytesrorZrZrZr[r.sc@s&eZdZdZdZeed�dd��ZdS)r1z*An ABC with one abstract method __index__.rZrgcCsdSr�rZr�rZrZr[�	__index__szSupportsIndex.__index__N)rbr^r_r�r�rrjrqrZrZrZr[r1sc@s&eZdZdZdZeed�dd��ZdS)r-zMAn ABC with one abstract method __abs__ that is covariant in its return type.rZrgcCsdSr�rZr�rZrZr[�__abs__(szSupportsAbs.__abs__N)rbr^r_r�r�rrarrrZrZrZr[r-#sc@s*eZdZdZdZedeed�dd��ZdS)	r3zOAn ABC with one abstract method __round__ that is covariant in its return type.rZr)�ndigitsrhcCsdSr�rZ)r�rsrZrZr[�	__round__2szSupportsRound.__round__N)r)	rbr^r_r�r�rrjrartrZrZrZr[r3-sc	std��fdd�|D�}t�|dd�|D��}t|�|_|_zt�d�j�dd�|_	Wnt
tfk
rnYnX|S)NzDNamedTuple('Name', [(f0, t0), (f1, t1), ...]); each t must be a typecsg|]\}}|t|��f�qSrZr��rg�nrhr�rZr[rk9sz!_make_nmtuple.<locals>.<listcomp>cSsg|]\}}|�qSrZrZrurZrZr[rk:sr�rbr�)r�
namedtupler�r(�_field_typesr�r�r�r�r^r�r�)r�r`�nm_tplrZr�r[�
_make_nmtuple7srz)r�r�r��__getnewargs__�_fields�_field_defaultsrx�_make�_replace�_asdictZ_source)r^rbr(cseZdZ�fdd�Z�ZS)�NamedTupleMetacs�|�dd�rt��||||�S|�di�}t||���}g}i}|D]H}||krl||}	|�|	�|	||<qD|rDtdj|d�|�	��d���qDt
|�|j_t|�|j_
||_|D]<}
|
tkr�td|
��q�|
tkr�|
|jkr�t||
||
�q�|S)Nr�Fr(zXNon-default namedtuple field {field_name} cannot follow default field(s) {default_names}r�)�
field_nameZ
default_namesz&Cannot overwrite NamedTuple attribute )r�r�r�rzrPrlrTrSrr,r�r(rprEr}�_prohibitedr�rmr|r)r{�typenamer�nsr`ryrHZ
defaults_dictr�Z
default_value�keyr�rZr[r�Os2

�
zNamedTupleMeta.__new__)rbr^r_r�r�rZrZr�r[r�Msr�c@s"eZdZdZdZdd�Zde_dS)r=a�Typed version of namedtuple.

    Usage in Python versions >= 3.6::

        class Employee(NamedTuple):
            name: str
            id: int

    This is equivalent to::

        Employee = collections.namedtuple('Employee', ['name', 'id'])

    The resulting class has an extra __annotations__ attribute, giving a
    dict that maps field names to types.  (The field names are also in
    the _fields attribute, which is part of the namedtuple API.)
    Alternative equivalent keyword syntax is also accepted::

        Employee = NamedTuple('Employee', name=str, id=int)

    In Python versions <= 3.5 use::

        Employee = NamedTuple('Employee', [('name', str), ('id', int)])
    TcOs�|std��|^}}|r"|^}}n4d|krN|�d�}ddl}|jdtdd�ntd��|r�z
|\}Wq�tk
r�tdt|�d�d	��d�Yq�Xn<d
|kr�t|�dkr�|�d
�}ddl}|jdtdd�nd}|dkr�|��}n|r�td
��t||�S)Nz*NamedTuple.__new__(): not enough argumentsr�rz4Passing 'typename' as keyword argument is deprecatedr�)�
stacklevelzGNamedTuple.__new__() missing 1 required positional argument: 'typename'z@NamedTuple.__new__() takes from 2 to 3 positional arguments but z were given�fieldsr~z2Passing 'fields' as keyword argument is deprecatedzIEither list of fields or keywords can be provided to NamedTuple, not both)	rTrV�warnings�warn�DeprecationWarningr�rzrPrz)r�rr{r�r�r�rZrZr[r��sB

�
�

�
zNamedTuple.__new__z*($cls, typename, fields=None, /, **kwargs)N)rbr^r_r�r�r��__text_signature__rZrZrZr[r=ls#cOs
t||�Sr�)r�)r{r�rrZrZr[�	_dict_new�sr�)�totalc	Ksj|dkr|}n|rtd��t|�|d�}zt�d�j�dd�|d<Wnttfk
r\YnXt|d|�S)Nz@TypedDict takes either a dict or keyword arguments, but not both)r(�	__total__r~rbr�r^rZ)	rTr�r�r�r�r�r�r��_TypedDictMeta)r{r�r�r�rr�rZrZr[�_typeddict_new�sr�cCstd��dS)Nz4TypedDict does not support instance and class checksr�)r{r�rZrZr[�_check_fails�sr�cs&eZdZd�fdd�	ZeZZ�ZS)r�Tcs�|dkrtnt|d<tt|��||tf|�}|�di�}d��fdd�|��D�}|D]}|�|j	�di��qV||_
t|d�s�||_|S)agCreate new typed dict class object.

        This method is called directly when TypedDict is subclassed,
        or via _typeddict_new when TypedDict is instantiated. This way
        TypedDict supports all three syntax forms described in its docstring.
        Subclasses and instances of TypedDict return actual dictionaries
        via _dict_new.
        r>r�r(z?TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a typecsi|]\}}|t|���qSrZr�)rgrvrwr�rZr[�
<dictcomp>�sz*_TypedDictMeta.__new__.<locals>.<dictcomp>r�)
r�r�r�r�r�r�r�rP�updater
r(r;r�)r{r�rr�r�Ztp_dictZannsr#r�r�r[r��s	
z_TypedDictMeta.__new__)T)rbr^r_r�r�r�r�r�rZrZr�r[r��sr�c@seZdZdZdS)r>a�A simple typed namespace. At runtime it is equivalent to a plain dict.

    TypedDict creates a dictionary type that expects all of its
    instances to have a certain set of keys, where each key is
    associated with a value of a consistent type. This expectation
    is not checked at runtime but is only enforced by type checkers.
    Usage::

        class Point2D(TypedDict):
            x: int
            y: int
            label: str

        a: Point2D = {'x': 1, 'y': 2, 'label': 'good'}  # OK
        b: Point2D = {'z': 3, 'label': 'bad'}           # Fails type check

        assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')

    The type info can be accessed via Point2D.__annotations__. TypedDict
    supports two additional equivalent forms::

        Point2D = TypedDict('Point2D', x=int, y=int, label=str)
        Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})

    By default, all keys must be present in a TypedDict. It is possible
    to override this by specifying totality.
    Usage::

        class point2D(TypedDict, total=False):
            x: int
            y: int

    This means that a point2D TypedDict can have any of the keys omitted.A type
    checker is only expected to support a literal False or True as the value of
    the total argument. True is the default, and makes all items defined in the
    class body be required.

    The class syntax is only supported in Python 3.6+, while two other
    syntax forms work for Python 2.7 and 3.2+
    Nr%rZrZrZr[r>�scCsdd�}||_||_|S)a%NewType creates simple unique types with almost zero
    runtime overhead. NewType(name, tp) is considered a subtype of tp
    by static type checkers. At runtime, NewType(name, tp) returns
    a dummy function that simply returns its argument. Usage::

        UserId = NewType('UserId', int)

        def name_by_id(user_id: UserId) -> str:
            ...

        UserId('user')          # Fails type check

        name_by_id(42)          # Fails type check
        name_by_id(UserId(42))  # OK

        num = UserId(5) + 1     # type: int
    cSs|Sr�rZ)�xrZrZr[�new_typeszNewType.<locals>.new_type)rbZ
__supertype__)r�rwr�rZrZr[rFsc@s�eZdZdZdZeeed�dd���Zeeed�dd���Z	edd�d	d
��Z
eeed�dd���Zee
d�d
d��Zedd�dd��Zeed�dd��Zed7e
ed�dd��Zeed�dd��Zed8e
ed�dd��Zed9e
eed�dd��Zed:e
e
e
d �d!d"��Zeed�d#d$��Zee
d�d%d&��Zed;e
e
d'�d(d)��Zeed�d*d+��Zeee
d,�d-d.��Zeeedd/�d0d1��Zed2d�d3d4��Zedd�d5d6��ZdS)<�IOa�Generic base class for TextIO and BinaryIO.

    This is an abstract, generic version of the return of open().

    NOTE: This does not distinguish between the different possible
    classes (text vs. binary, read vs. write vs. read/write,
    append-only, unbuffered).  The TextIO and BinaryIO subclasses
    below capture the distinctions between text vs. binary, which is
    pervasive in the interface; however we currently do not offer a
    way to track the other distinctions in the type system.
    rZrgcCsdSr�rZr�rZrZr[�mode=szIO.modecCsdSr�rZr�rZrZr[r�BszIO.nameNcCsdSr�rZr�rZrZr[�closeGszIO.closecCsdSr�rZr�rZrZr[�closedKsz	IO.closedcCsdSr�rZr�rZrZr[�filenoPsz	IO.filenocCsdSr�rZr�rZrZr[�flushTszIO.flushcCsdSr�rZr�rZrZr[�isattyXsz	IO.isattyr�)rvrhcCsdSr�rZ)r�rvrZrZr[�read\szIO.readcCsdSr�rZr�rZrZr[�readable`szIO.readable)�limitrhcCsdSr�rZ)r�r�rZrZr[�readlinedszIO.readline)�hintrhcCsdSr�rZ)r�r�rZrZr[�	readlineshszIO.readlinesr)�offset�whencerhcCsdSr�rZ)r�r�r�rZrZr[�seeklszIO.seekcCsdSr�rZr�rZrZr[�seekablepszIO.seekablecCsdSr�rZr�rZrZr[�telltszIO.tell)�sizerhcCsdSr�rZ)r�r�rZrZr[�truncatexszIO.truncatecCsdSr�rZr�rZrZr[�writable|szIO.writable��srhcCsdSr�rZ�r�r�rZrZr[�write�szIO.write)�linesrhcCsdSr�rZ)r�r�rZrZr[�
writelines�sz
IO.writelinesz
IO[AnyStr]cCsdSr�rZr�rZrZr[�	__enter__�szIO.__enter__cCsdSr�rZ)r�rOrI�	tracebackrZrZr[�__exit__�szIO.__exit__)r�)r�)r�)r)N) rbr^r_r�r��propertyrrQr�r�r�r�r�rjr�r�r�r@r�r�r�r9r�r�r�r�r�r�r�r�r�r�rZrZrZr[r�.sZr�c@sBeZdZdZdZeeeefe	d�dd��Z
edd�dd��Zd	S)
�BinaryIOz5Typed version of the return of open() in binary mode.rZr�cCsdSr�rZr�rZrZr[r��szBinaryIO.writergcCsdSr�rZr�rZrZr[r��szBinaryIO.__enter__N)rbr^r_r�r�rrrp�	bytearrayrjr�r�rZrZrZr[r��sr�c@s�eZdZdZdZeeed�dd���Zeee	d�dd���Z
eeee	d�dd	���Zeee
d�d
d���Zeeed�dd
���Zedd�dd��ZdS)�TextIOz3Typed version of the return of open() in text mode.rZrgcCsdSr�rZr�rZrZr[�buffer�sz
TextIO.buffercCsdSr�rZr�rZrZr[�encoding�szTextIO.encodingcCsdSr�rZr�rZrZr[�errors�sz
TextIO.errorscCsdSr�rZr�rZrZr[�line_buffering�szTextIO.line_bufferingcCsdSr�rZr�rZrZr[�newlines�szTextIO.newlinescCsdSr�rZr�rZrZr[r��szTextIO.__enter__N)rbr^r_r�r�r�rr�r�rQr�rr�r�r�rr�r�rZrZrZr[r��s&r�c@s&eZdZdZdddgZeZeZeZdS)�ioz)Wrapper namespace for IO generic classes.r�r�r�N)rbr^r_r��__all__r�r�r�rZrZrZr[r��s

r�z.ioc@s eZdZdZddgZeZeZdS)�rez&Wrapper namespace for re type aliases.�Pattern�MatchN)rbr^r_r�r�r�r�rZrZrZr[r��sr�z.re)T)NN)T)N)�r�rrrrZcollections.abcr9r�rr�Z	stdlib_rer�r`rrrr�r\rerqrur}r�r�r�r�r�r�rUrrIr	r
rrr
rrr�r�rRrrr�r�Z_TYPING_INTERNALSZ_SPECIAL_NAMESr-r1r4r5r6r?r:rrKrArJra�BuiltinFunctionType�
MethodTyperQrRrErDrCrGrHr\rJrBr^r_r`rarbrcrdrOrerprQr@rfrr%r(r'r&rrr,r#rr)rr;rr!rrr"r rrprrrr9r�r6rr�r<rrrr$r7rr8r+r�r7r�r8r:r5r4r?r*rr2r0r/r.r1r-r3rzr�rmr�r=r�r�r�r�r>rFrLrMr�r�r�r�rbrOr�r�rZrZrZr[�<module>s(�X
!
	
I��
�����2a�
/[����	b�
V	
�
�	�							@+c#	

stat.cpython-38.pyc000064400000010426150335716500010157 0ustar00U

e5dm�
@sLdZdZdZdZdZdZdZdZdZd	Z	d
Z
dd�Zd
d�ZdZ
dZdZdZdZdZdZdZdZdZdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Z d*Z!d+Z"e"Z#d,Z$d-Z%d.Z&d/Z'd0Z(d-Z)d.Z*d/Z+d1Z,d2Z-d3Z.d	Z/dZ0dZ1dZ2dZ3dZ4dZ5dZ6d	Z7d3Z8d2Z9dZ:d4Z;d5Z<d6Z=d7Z>d8Z?ed9fed:fed;fed<fe
d=fed>fed?ffe)d@ffe*dAffe+e!Bd:fe!dBfe+dCffe-d@ffe.dAffe/e"Bd:fe"dBfe/dCffe1d@ffe2dAffe3e$BdDfe$dEfe3dCfff
Z@dFdG�ZAd2ZBd*ZCd/ZDd3ZEdZFdZGdZHd.ZIdZJd5ZKdZLdZMd+ZNd,ZOdZPd-ZQd4ZRzddHlSTWneTk
�rFYnXdIS)JzoConstants/functions for interpreting results of os.stat() and os.lstat().

Suggested usage: from stat import *
����������	cCs|d@S)zMReturn the portion of the file's mode that can be set by
    os.chmod().
    i����moderr�/usr/lib64/python3.8/stat.py�S_IMODEsrcCs|d@S)zLReturn the portion of the file's mode that describes the
    file type.
    i�rrrrr�S_IFMTsri@i i`i�ii�i�cCst|�tkS)z(Return True if mode is from a directory.)r�S_IFDIRrrrr�S_ISDIR2srcCst|�tkS)z<Return True if mode is from a character special device file.)r�S_IFCHRrrrr�S_ISCHR6srcCst|�tkS)z8Return True if mode is from a block special device file.)r�S_IFBLKrrrr�S_ISBLK:srcCst|�tkS)z+Return True if mode is from a regular file.)r�S_IFREGrrrr�S_ISREG>srcCst|�tkS)z0Return True if mode is from a FIFO (named pipe).)r�S_IFIFOrrrr�S_ISFIFOBsrcCst|�tkS)z,Return True if mode is from a symbolic link.)r�S_IFLNKrrrr�S_ISLNKFsrcCst|�tkS)z%Return True if mode is from a socket.)r�S_IFSOCKrrrr�S_ISSOCKJsrcCsdS)z#Return True if mode is from a door.Frrrrr�S_ISDOORNsrcCsdS)z*Return True if mode is from an event port.Frrrrr�S_ISPORTRsr cCsdS)z'Return True if mode is from a whiteout.Frrrrr�S_ISWHTVsr!iii���@i��8� �iiiii �l�s�-�b�d�c�p�r�w�S�x�t�TcCsJg}tD]6}|D]"\}}||@|kr|�|�qq|�d�qd�|�S)z;Convert a file's mode to a string of the form '-rwxrwxrwx'.r*�)�_filemode_table�append�join)r
Zperm�table�bit�charrrr�filemode�s
r<)�*N)U�__doc__�ST_MODE�ST_INO�ST_DEV�ST_NLINK�ST_UID�ST_GID�ST_SIZE�ST_ATIME�ST_MTIME�ST_CTIMErrrrrrrrr�S_IFDOOR�S_IFPORT�S_IFWHTrrrrrrrrr r!�S_ISUID�S_ISGID�S_ENFMT�S_ISVTX�S_IREAD�S_IWRITE�S_IEXEC�S_IRWXU�S_IRUSR�S_IWUSR�S_IXUSR�S_IRWXG�S_IRGRP�S_IWGRP�S_IXGRP�S_IRWXO�S_IROTH�S_IWOTH�S_IXOTH�	UF_NODUMP�UF_IMMUTABLE�	UF_APPEND�	UF_OPAQUE�UF_NOUNLINK�
UF_COMPRESSED�	UF_HIDDEN�SF_ARCHIVED�SF_IMMUTABLE�	SF_APPEND�SF_NOUNLINK�SF_SNAPSHOTr6r<�FILE_ATTRIBUTE_ARCHIVE�FILE_ATTRIBUTE_COMPRESSED�FILE_ATTRIBUTE_DEVICE�FILE_ATTRIBUTE_DIRECTORY�FILE_ATTRIBUTE_ENCRYPTED�FILE_ATTRIBUTE_HIDDEN�FILE_ATTRIBUTE_INTEGRITY_STREAM�FILE_ATTRIBUTE_NORMAL�"FILE_ATTRIBUTE_NOT_CONTENT_INDEXED�FILE_ATTRIBUTE_NO_SCRUB_DATA�FILE_ATTRIBUTE_OFFLINE�FILE_ATTRIBUTE_READONLY�FILE_ATTRIBUTE_REPARSE_POINT�FILE_ATTRIBUTE_SPARSE_FILE�FILE_ATTRIBUTE_SYSTEM�FILE_ATTRIBUTE_TEMPORARY�FILE_ATTRIBUTE_VIRTUAL�_stat�ImportErrorrrrr�<module>s�	�
�
�
��optparse.cpython-38.opt-2.pyc000064400000105515150335716500012005 0ustar00U

e5d���@s�dZddddddddd	d
ddd
ddddgZdZddlZddlZddlZdd�ZzddlmZmZWn$e	k
r�dd�Zdd�ZYnXeZ
Gdd�de�ZGdd
�d
e�Z
Gdd�de
�ZGdd�de�ZGd d�de�ZGd!d"�d"e�ZGd#d	�d	�ZGd$d
�d
e�ZGd%d�de�Zd&d'�Zd(d)�Zee
d*�fee
d*�fee
d+�fee
d,�fd-�Zd.d/�Zd0d�Zd1ZGd2d�d�Zd3Zd4ZGd5d�d�Z Gd6d�d�Z!Gd7d�de!�Z"Gd8d�de!�Z#d9d:�Z$eZ%dS);z1.5.3�Option�make_option�
SUPPRESS_HELP�SUPPRESS_USAGE�Values�OptionContainer�OptionGroup�OptionParser�
HelpFormatter�IndentedHelpFormatter�TitledHelpFormatter�
OptParseError�OptionError�OptionConflictError�OptionValueError�BadOptionError�check_choicea"
Copyright (c) 2001-2006 Gregory P. Ward.  All rights reserved.
Copyright (c) 2002-2006 Python Software Foundation.  All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

  * Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.

  * Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.

  * Neither the name of the author nor the names of its
    contributors may be used to endorse or promote products derived from
    this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
�NcCsd|jjt|�|fS)Nz<%s at 0x%x: %s>)�	__class__�__name__�id��self�r� /usr/lib64/python3.8/optparse.py�_reprOsr)�gettext�ngettextcCs|S�Nr)�messagerrrr\srcCs|dkr|S|S�N�r)ZsingularZplural�nrrrr_src@seZdZdd�Zdd�ZdS)rcCs
||_dSr��msg�rr#rrr�__init__hszOptParseError.__init__cCs|jSrr"rrrr�__str__kszOptParseError.__str__N�r�
__module__�__qualname__r%r&rrrrrgsc@seZdZdd�Zdd�ZdS)r
cCs||_t|�|_dSr)r#�str�	option_id)rr#�optionrrrr%uszOptionError.__init__cCs |jrd|j|jfS|jSdS)Nz
option %s: %s)r+r#rrrrr&yszOptionError.__str__Nr'rrrrr
osc@seZdZdS)rN�rr(r)rrrrrsc@seZdZdS)rNr-rrrrr�sc@seZdZdd�Zdd�ZdS)rcCs
||_dSr)�opt_str�rr.rrrr%�szBadOptionError.__init__cCstd�|jS)Nzno such option: %s)�_r.rrrrr&�szBadOptionError.__str__Nr'rrrrr�sc@seZdZdd�Zdd�ZdS)�AmbiguousOptionErrorcCst�||�||_dSr)rr%�
possibilities)rr.r2rrrr%�szAmbiguousOptionError.__init__cCstd�|jd�|j�fS)Nzambiguous option: %s (%s?)�, )r0r.�joinr2rrrrr&�s�zAmbiguousOptionError.__str__Nr'rrrrr1�sr1c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd S)!r	Znonec	Cs�d|_||_|dkrLzttjd�}Wnttfk
rBd}YnX|d8}||_t|t	|d|d��|_
|_d|_d|_
d|_||_d|_i|_d|_d|_dS)	NZCOLUMNS�P��rz%defaultz%s %sz%s=%s)�parser�indent_increment�int�os�environ�KeyError�
ValueError�width�min�max�
help_position�max_help_position�current_indent�level�
help_width�short_first�default_tag�option_strings�_short_opt_fmt�
_long_opt_fmt�rr9rCr?rGrrrr%�s&
�
zHelpFormatter.__init__cCs
||_dSr)r8�rr8rrr�
set_parser�szHelpFormatter.set_parsercCs&|dkrtd|��d|d|_dS)N)�� z/invalid metavar delimiter for short options: %r�%s)r>rJ�rZdelimrrr�set_short_opt_delimiter�s
�z%HelpFormatter.set_short_opt_delimitercCs&|dkrtd|��d|d|_dS)N)�=rPz.invalid metavar delimiter for long options: %rrQ)r>rKrRrrr�set_long_opt_delimiter�s
�z$HelpFormatter.set_long_opt_delimitercCs"|j|j7_|jd7_dSr�rDr9rErrrr�indent�szHelpFormatter.indentcCs"|j|j8_|jd8_dSrrVrrrr�dedent�szHelpFormatter.dedentcCstd��dS�Nzsubclasses must implement��NotImplementedError�r�usagerrr�format_usage�szHelpFormatter.format_usagecCstd��dSrYrZ�rZheadingrrr�format_headingszHelpFormatter.format_headingcCs.t|j|jd�}d|j}tj||||d�S)N�rP)Zinitial_indentZsubsequent_indent)rAr?rD�textwrapZfill)r�textZ
text_widthrWrrr�_format_texts
�zHelpFormatter._format_textcCs|r|�|�dSdSdS�N�
rO�rd�r�descriptionrrr�format_descriptionsz HelpFormatter.format_descriptioncCs|rd|�|�dSdSdSrerg)r�epilogrrr�
format_epilogszHelpFormatter.format_epilogcCsP|jdks|js|jS|jj�|j�}|tks6|dkr<|j}|j�|jt	|��Sr)
r8rH�help�defaults�get�dest�
NO_DEFAULT�NO_DEFAULT_VALUE�replacer*)rr,Z
default_valuerrr�expand_defaultszHelpFormatter.expand_defaultcs�g}�j|}�j�jd}t|�|krBd�jd|f}�j}nd�jd||f}d}|�|�|jr���|�}t�|�j	�}|�d|d|df�|�
�fdd�|dd�D��n|d	d
kr�|�d
�d�|�S)Nr6�%*s%s
rOz	%*s%-*s  rcsg|]}d�jd|f�qS)rurO)rB)�.0�linerrr�
<listcomp>Es�z/HelpFormatter.format_option.<locals>.<listcomp>r ���rf)rIrBrD�len�appendrmrtrbZwraprF�extendr4)rr,�result�optsZ	opt_widthZindent_firstZ	help_textZ
help_linesrrr�
format_option(s&



�

zHelpFormatter.format_optioncCs�|��d}|jD],}|�|�}||j|<t|t|�|j�}q|��|jD]8}|jD],}|�|�}||j|<t|t|�|j�}qXqN|��|��t	|d|j
�|_t|j|jd�|_
dS)Nrr6ra)rW�option_list�format_option_stringsrIrArzrD�
option_groupsrXr@rCrBr?rF)rr8Zmax_len�optZstrings�grouprrr�store_option_stringsKs 






z"HelpFormatter.store_option_stringscst|��rF|jp|j�����fdd�|jD�}��fdd�|jD�}n|j}|j}�jrb||}n||}d�|�S)Ncsg|]}�j|�f�qSr)rJ)rvZsopt��metavarrrrrxas�z7HelpFormatter.format_option_strings.<locals>.<listcomp>csg|]}�j|�f�qSr)rK)rvZloptr�rrrxcs�r3)�takes_valuer�rp�upper�_short_opts�
_long_optsrGr4)rr,Z
short_optsZ	long_optsr~rr�rr�]s��
z#HelpFormatter.format_option_stringsN)rr(r)rrr%rNrSrUrWrXr^r`rdrjrlrtrr�r�rrrrr	�s +
#c@s&eZdZddd�Zdd�Zd	d
�ZdS)r
r6�Nr cCst�|||||�dSr�r	r%rLrrrr%ts�zIndentedHelpFormatter.__init__cCstd�|S)Nz
Usage: %s
)r0r\rrrr^|sz"IndentedHelpFormatter.format_usagecCsd|jd|fS)Nz%*s%s:
rO)rDr_rrrr`sz$IndentedHelpFormatter.format_heading)r6r�Nr �rr(r)r%r^r`rrrrr
ps�
c@s&eZdZd
dd�Zdd�Zdd	�ZdS)rrr�NcCst�|||||�dSrr�rLrrrr%�s�zTitledHelpFormatter.__init__cCsd|�td��|fS)Nz%s  %s
ZUsage)r`r0r\rrrr^�sz TitledHelpFormatter.format_usagecCsd|d|jt|�fS)Nz%s
%s
z=-)rErzr_rrrr`�sz"TitledHelpFormatter.format_heading)rr�Nrr�rrrrr�s�
cCsh|dd���dkrd}nD|dd���dkrDd}|dd�p@d}n|dd�dkrZd}nd}|||�S)	Nr6Z0x�Z0b�0r ��
)�lower)�val�type�radixrrr�
_parse_num�sr�cCs
t|t�Sr)r�r:)r�rrr�
_parse_int�sr�Zintegerzfloating-point�complex)r:�long�floatr�cCsHt|j\}}z
||�WStk
rBttd�|||f��YnXdS)Nzoption %s: invalid %s value: %r)�_builtin_cvtr�r>rr0)r,r��valueZcvtZwhatrrr�
check_builtin�s
�r�cCs:||jkr|Sd�tt|j��}ttd�|||f��dS)Nr3z.option %s: invalid choice: %r (choose from %s))�choicesr4�map�reprrr0)r,r�r�r�rrrr�s
��)ZNOZDEFAULTc@s�eZdZddddddddd	d
ddgZd
ZdZdZdZdZdZ	e
e
e
e
ed�ZdZ
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�ZeeeeeeegZ
d+d,�ZeZd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Z d7d8�Z!dS)9r�actionr�rp�default�nargs�constr��callback�
callback_args�callback_kwargsrmr�)
�store�store_const�
store_true�store_falser{�append_const�countr�rm�version)r�r�r�r�r{r�r�)r�r{r�)r�r{)r�r�)�stringr:r�r�r��choice)r:r�r�r�r�NcOsBg|_g|_|�|�}|�|�|�|�|jD]}||�q0dSr)r�r��_check_opt_strings�_set_opt_strings�
_set_attrs�
CHECK_METHODS)rr~�attrs�checkerrrrr%4s



zOption.__init__cCsdd�|D�}|std��|S)NcSsg|]}|r|�qSrr)rvr�rrrrxKsz-Option._check_opt_strings.<locals>.<listcomp>z+at least one option string must be supplied)�	TypeError)rr~rrrr�GszOption._check_opt_stringscCs�|D]�}t|�dkr$td||��qt|�dkrd|ddkrH|ddksVtd||��|j�|�q|dd�dkr�|ddks�td||��|j�|�qdS)	Nr6z>invalid option string %r: must be at least two characters longr�-r zMinvalid short option string %r: must be of the form -x, (x any non-dash char)�--zGinvalid long option string %r: must start with --, followed by non-dash)rzr
r�r{r�)rr~r�rrrr�Ps2������zOption._set_opt_stringscCsv|jD]F}||kr*t||||�||=q|dkr@t||t�qt||d�q|rrt|���}tdd�|�|��dS)Nr�zinvalid keyword arguments: %sr3)�ATTRS�setattrrq�sorted�keysr
r4)rr��attrrrrr�es
�zOption._set_attrscCs2|jdkrd|_n|j|jkr.td|j|��dS)Nr�zinvalid action: %r)r��ACTIONSr
rrrr�
_check_actionxs
zOption._check_actioncCs�|jdkr0|j|jkr�|jdk	r(d|_q�d|_n^t|jt�rF|jj|_|jdkrVd|_|j|jkrrtd|j|��|j|jkr�td|j|��dS)Nr�r�r*zinvalid option type: %rz$must not supply a type for action %r)	r�r��ALWAYS_TYPED_ACTIONSr��
isinstancer�TYPESr
�
TYPED_ACTIONSrrrr�_check_type~s 



�zOption._check_typecCsr|jdkrT|jdkr td|��qnt|jttf�sntdtt|j���d�d|��n|jdk	rntd|j|��dS)Nr�z/must supply a list of choices for type 'choice'z1choices must be a list of strings ('%s' supplied)�'r z#must not supply choices for type %r)r�r�r
r��tuple�listr*�splitrrrr�
_check_choice�s$

���
�zOption._check_choicecCs\|j|jkp|jdk	}|jdkrX|rX|jrH|jddd��dd�|_n|jdd|_dS)Nrr6r�r0r )r��
STORE_ACTIONSr�rpr�rsr�)rr�rrr�_check_dest�s�zOption._check_destcCs*|j|jkr&|jdk	r&td|j|��dS)Nz*'const' must not be supplied for action %r)r��
CONST_ACTIONSr�r
rrrr�_check_const�s
�zOption._check_constcCs<|j|jkr|jdkr8d|_n|jdk	r8td|j|��dS)Nr z*'nargs' must not be supplied for action %r)r�r�r�r
rrrr�_check_nargs�s

�zOption._check_nargscCs�|jdkrrt|j�s$td|j|��|jdk	rJt|jt�sJtd|j|��|jdk	r�t|jt�s�td|j|��nB|jdk	r�td|j|��|jdk	r�td|��|jdk	r�td|��dS)Nr�zcallback not callable: %rz3callback_args, if supplied, must be a tuple: not %rz4callback_kwargs, if supplied, must be a dict: not %rz.callback supplied (%r) for non-callback optionz.callback_args supplied for non-callback optionz0callback_kwargs supplied for non-callback option)	r��callabler�r
r�r�r�r��dictrrrr�_check_callback�sR

�

���

���
��
�
�zOption._check_callbackcCsd�|j|j�S)N�/)r4r�r�rrrrr&�szOption.__str__cCs
|jdk	Sr)r�rrrrr��szOption.takes_valuecCs|jr|jdS|jdSdS�Nr)r�r�rrrr�get_opt_string�s
zOption.get_opt_stringcCs*|j�|j�}|dkr|S||||�SdSr)�TYPE_CHECKERror�)rr�r�r�rrr�check_value�szOption.check_valuecs:|dk	r6�jdkr���|�St��fdd�|D��SdS)Nr csg|]}���|��qSr)r�)rv�v�r�rrrrxsz(Option.convert_value.<locals>.<listcomp>)r�r�r�)rr�r�rr�r�
convert_values
zOption.convert_valuecCs$|�||�}|�|j|j||||�Sr)r��take_actionr�rp)rr�r��valuesr8rrr�processs�zOption.processc	Cs:|dkrt|||��n|dkr2t|||j��n|dkrHt||d�n�|dkr^t||d�n�|dkrz|�|g��|�n�|dkr�|�|g��|j�n�|d	kr�t|||�|d
�d�n||dkr�|jp�d
}|jp�i}|j||||f|�|�nF|dk�r|��|��n*|dk�r(|�	�|��nt
d|j��dS)Nr�r�r�Tr�Fr{r�r�rr r�rrmr�zunknown action %r)r�r��ensure_valuer{r�r�r��
print_help�exit�
print_versionr>r�)	rr�rpr�r�r�r8�args�kwargsrrrr�s4





zOption.take_action)"rr(r)r�r�r�r�r�r�r�r�rr�r�r%r�r�r�r�r�r�r�r�r�r�r&r�__repr__r�r�r�r�r�r�rrrrr�sj�
�	
	�	ZSUPPRESSHELPZ
SUPPRESSUSAGEc@s^eZdZddd�Zdd�ZeZdd�Zdd	�Zd
d�Z	dd
�Z
ddd�Zddd�Zdd�Z
dS)rNcCs&|r"|��D]\}}t|||�qdSr)�itemsr�)rrnr�r�rrrr%9szValues.__init__cCs
t|j�Sr)r*�__dict__rrrrr&>szValues.__str__cCs2t|t�r|j|jkSt|t�r*|j|kStSdSr)r�rr�r��NotImplemented)r�otherrrr�__eq__Cs



z
Values.__eq__cCs6t|�D](}||kr||}|dk	rt|||�qdSr)�dirr�)rr�r�Zdvalrrr�_update_carefulKs
zValues._update_carefulcCs|j�|�dSr)r��update)rr�rrr�
_update_looseXszValues._update_loosecCs8|dkr|�|�n |dkr(|�|�ntd|��dS)N�carefulZloosezinvalid update mode: %r)r�r�r>)rr��moderrr�_update`s
zValues._updater�cCs&t|�tj|}|�t|�|�dSr)�
__import__�sys�modulesr��vars)r�modnamer��modrrr�read_modulehs
zValues.read_modulecCs&i}tt|���|�|�||�dSr)�exec�open�readr�)r�filenamer�r�rrr�	read_filemszValues.read_filecCs.t||�rt||�dkr$t|||�t||�Sr)�hasattr�getattrr�)rr�r�rrrr�rszValues.ensure_value)N)r�)r�)rr(r)r%r&rr�r�r�r�r�r�r�r�rrrrr7s



c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!S)"rcCs&|��||_|�|�|�|�dSr)�_create_option_list�option_class�set_conflict_handler�set_description)rr�conflict_handlerrirrrr%�s
zOptionContainer.__init__cCsi|_i|_i|_dSr��
_short_opt�	_long_optrnrrrr�_create_option_mappings�sz'OptionContainer._create_option_mappingscCs|j|_|j|_|j|_dSrrrMrrr�_share_option_mappings�sz&OptionContainer._share_option_mappingscCs|dkrtd|��||_dS)N)�error�resolvez$invalid conflict_resolution value %r)r>r)r�handlerrrrr�sz$OptionContainer.set_conflict_handlercCs
||_dSr�rirhrrrr�szOptionContainer.set_descriptioncCs|jSrr
rrrr�get_description�szOptionContainer.get_descriptioncCs|`|`|`dSrrrrrr�destroy�szOptionContainer.destroycCs�g}|jD]"}||jkr
|�||j|f�q
|jD]"}||jkr4|�||j|f�q4|r�|j}|dkr�tdd�dd�|D��|��nd|dkr�|D]V\}}|�d�r�|j�	|�|j|=n|j�	|�|j|=|js�|js�|j
j�	|�q�dS)Nr
z conflicting option string(s): %sr3cSsg|]}|d�qS)rr)rv�corrrrx�sz3OptionContainer._check_conflict.<locals>.<listcomp>rr�)r�rr{r�rrrr4�
startswith�remove�	containerr�)rr,Z
conflict_optsr�rZc_optionrrr�_check_conflict�s2



��

zOptionContainer._check_conflictcOs�t|dt�r|j||�}n8t|�dkrL|sL|d}t|t�sTtd|��ntd��|�|�|j�|�||_	|j
D]}||j|<qv|jD]}||j
|<q�|jdk	r�|jtk	r�|j|j|j<n|j|jkr�d|j|j<|S)Nrr znot an Option instance: %r�invalid arguments)r�r*rrzrr�rr�r{rr�rr�rrpr�rqrn)rr�r�r,r�rrr�
add_option�s(





zOptionContainer.add_optioncCs|D]}|�|�qdSr)r)rr�r,rrr�add_optionsszOptionContainer.add_optionscCs|j�|�p|j�|�Sr)rrorr/rrr�
get_options
�zOptionContainer.get_optioncCs||jkp||jkSr)rrr/rrr�
has_options
�zOptionContainer.has_optioncCsn|j�|�}|dkr |j�|�}|dkr4td|��|jD]}|j|=q:|jD]}|j|=qN|jj�|�dS)Nzno such option %r)	rrorr>r�r�rr�r)rr.r,r�rrr�
remove_options



zOptionContainer.remove_optioncCs>|js
dSg}|jD]}|jtk	r|�|�|��qd�|�S�NrO)r�rmrr{rr4)r�	formatterr}r,rrr�format_option_helps

z"OptionContainer.format_option_helpcCs|�|���Sr)rjr�rrrrrrj(sz"OptionContainer.format_descriptioncCs:g}|jr|�|�|��|jr0|�|�|��d�|�S)Nrf)rir{rjr�rr4�rrr}rrr�format_help+szOptionContainer.format_helpN)rr(r)r%rr	rrrrrrrrrrrrjr rrrrrxs  			c@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rNcCs$||_t�||j|j|�||_dSr)r8rr%rr�title)rr8r!rirrrr%6s�zOptionGroup.__init__cCsg|_|�|j�dSr)r�r	r8rrrrr<szOptionGroup._create_option_listcCs
||_dSr)r!)rr!rrr�	set_title@szOptionGroup.set_titlecCst�|�|`dSr)rrr�rrrrrCs
zOptionGroup.destroycCs0|�|j�}|��|t�||�7}|��|Sr)r`r!rWrr rXrrrrr Js
zOptionGroup.format_help)N)rr(r)r%rr"rr rrrrr4s

c
@s^eZdZgZddedddddddf
dd�Zdd�Zdd	�Zd
d�Zdd
�Z	dOdd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�ZdPd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�ZdQd;d<�Z d=d>�Z!d?d@�Z"dRdAdB�Z#dCdD�Z$dSdEdF�Z%dTdGdH�Z&dIdJ�Z'dUdKdL�Z(dVdMdN�Z)dS)WrNr
TcCsrt�||||�|�|�|	|_||_d|_d|_|dkr@t�}||_|j�	|�|
|_
|j||d�|��dS)NT)�add_help)
rr%�	set_usage�progr��allow_interspersed_args�process_default_valuesr
rrNrk�_populate_option_list�_init_parsing_state)rr]r�rr�rrirZadd_help_optionr%rkrrrr%�s(�
�zOptionParser.__init__cCs.t�|�|jD]}|��q|`|`|`dSr)rrr�r�r)rr�rrrr�s


zOptionParser.destroycCsg|_g|_|��dSr)r�r�rrrrrr�sz OptionParser._create_option_listcCs|jdddtd�d�dS)Nz-hz--helprmzshow this help message and exit�r�rm�rr0rrrr�_add_help_option�s�zOptionParser._add_help_optioncCs|jddtd�d�dS)Nz	--versionr�z&show program's version number and exitr*r+rrrr�_add_version_option�s�z OptionParser._add_version_optioncCs>|jr|�|j�|r |�|�|jr.|��|r:|��dSr)�standard_option_listrr�r-r,)rr�r#rrrr(�s
z"OptionParser._populate_option_listcCsd|_d|_d|_dSr)�rargs�largsr�rrrrr)�sz OptionParser._init_parsing_statecCsL|dkrtd�|_n4|tkr$d|_n$|���d�rB|dd�|_n||_dS)Nz%prog [options]zusage: �)r0r]rr�rr\rrrr$�szOptionParser.set_usagecCs
d|_dS)NT�r&rrrr�enable_interspersed_args�sz%OptionParser.enable_interspersed_argscCs
d|_dS)NFr2rrrr�disable_interspersed_argssz&OptionParser.disable_interspersed_argscCs
||_dSr)r')rr�rrr�set_process_default_valuessz'OptionParser.set_process_default_valuescCs||j|<dSr)rn)rrpr�rrr�set_defaultszOptionParser.set_defaultcKs|j�|�dSr)rnr�)rr�rrr�set_defaultsszOptionParser.set_defaultscCs*|jdd�}|jD]}|�|j�q|Sr)r�r�r|)rZoptionsr�rrr�_get_all_optionss
zOptionParser._get_all_optionscCs`|jst|j�S|j��}|��D]4}|�|j�}t|t�r"|�	�}|�
||�||j<q"t|�Sr)r'rrn�copyr8rorpr�r*r�r�)rrnr,r�r.rrr�get_default_valuess


zOptionParser.get_default_valuescOszt|dt�r t|f|�|�}nJt|�dkrb|sb|d}t|t�sNtd|��|j|k	rjtd��ntd��|j�|�|S)Nrr znot an OptionGroup instance: %rz"invalid OptionGroup (wrong parser)r)	r�r*rrzr�r8r>r�r{)rr�r�r�rrr�add_option_group+s


zOptionParser.add_option_groupcCs0|j�|�p|j�|�}|r,|j|k	r,|jSdSr)rrorr)rr.r,rrr�get_option_group;s
�zOptionParser.get_option_groupcCs&|dkrtjdd�S|dd�SdSr)r��argv)rr�rrr�	_get_argsEszOptionParser._get_argsc
Cs�|�|�}|dkr|��}||_g|_}||_z|�|||�}Wn4ttfk
rv}z|�t	|��W5d}~XYnX||}|�
||�Sr)r>r:r/r0r��
_process_argsrrr
r*�check_values)rr�r�r/r0�stop�errrrr�
parse_argsKs

 zOptionParser.parse_argscCs||fSrr)rr�r�rrrr@rszOptionParser.check_valuescCs�|r�|d}|dkr|d=dS|dd�dkr<|�||�q|dd�dkrft|�dkrf|�||�q|jr~|�|�|d=qdSqdS)Nrr�r6r r�)�_process_long_optrz�_process_short_optsr&r{)rr0r/r��argrrrr?s

zOptionParser._process_argscCst||j�Sr)�
_match_abbrevr)rr�rrr�_match_long_opt�szOptionParser._match_long_optc
Cs�|�d�}d|kr4|�dd�\}}|�d|�d}n|}d}|�|�}|j|}|��r�|j}t|�|kr�|�t	dd|�||d��q�|dkr�|�d�}	q�t
|d|��}	|d|�=n|r�|�td	�|�nd}	|�||	||�dS)
NrrTr TF�.%(option)s option requires %(number)d argument�/%(option)s option requires %(number)d arguments�r,Znumberz%s option does not take a value)
�popr��insertrHrr�r�rzr
rr�r0r�)
rr/r�rFr�Znext_argZhad_explicit_valuer,r�r�rrrrD�s6


��zOptionParser._process_long_optcCs�|�d�}d}d}|dd�D]�}d|}|j�|�}|d7}|sJt|��|��r�|t|�krv|�d||d��d}|j}	t|�|	kr�|�t	dd|	�||	d��q�|	dkr�|�d�}
q�t
|d|	��}
|d|	�=nd}
|�||
||�|rq�qdS)	NrFr r�TrIrJrK)rLrrorr�rzrMr�r
rr�r�)rr/r�rFrA�iZchr�r,r�r�rrrrE�s<
��z OptionParser._process_short_optscCs&|jdkrtj�tjd�S|jSdSr�)r%r;�path�basenamer�r=rrrr�
get_prog_names
zOptionParser.get_prog_namecCs|�d|���S)Nz%prog)rsrQ)r�srrr�expand_prog_nameszOptionParser.expand_prog_namecCs|�|j�Sr)rSrirrrrrszOptionParser.get_descriptionrcCs|rtj�|�t�|�dSr)r��stderr�writer�)rZstatusr#rrrr�szOptionParser.exitcCs(|�tj�|�dd|��|f�dS)Nr6z%s: error: %s
)�print_usager�rTr�rQr$rrrr
szOptionParser.errorcCs"|jr|j�|�|j��SdSdSr)r]rr^rSrrrr�	get_usage#s

�zOptionParser.get_usagecCs|jrt|��|d�dS�N)�file)r]�printrW�rrYrrrrV*s	zOptionParser.print_usagecCs|jr|�|j�SdSdSr)r�rSrrrr�get_version6szOptionParser.get_versioncCs|jrt|��|d�dSrX)r�rZr\r[rrrr�<szOptionParser.print_versioncCs�|dkr|j}|�|�g}|�|�td���|��|jrZ|�t�||��|�d�|j	D]}|�|�
|��|�d�q`|��d�|dd��S)NZOptionsrfrOry)
rr�r{r`r0rWr�rrr�r rXr4)rrr}r�rrrrGs


zOptionParser.format_option_helpcCs|�|j�Sr)rlrkrrrrrlXszOptionParser.format_epilogcCsn|dkr|j}g}|jr*|�|��d�|jrD|�|�|�d�|�|�|��|�|�|��d�|�Sre)	rr]r{rWrirjrrlr4rrrrr [szOptionParser.format_helpcCs |dkrtj}|�|���dSr)r��stdoutrUr r[rrrr�gszOptionParser.print_help)T)NN)rN)N)N)N)N)N)*rr(r)r.rr%rrr,r-r(r)r$r3r4r5r6r7r8r:r;r<r>rCr@r?rHrDrErQrSrr�r
rWrVr\r�rrlr r�rrrrrRs`F�
"

	

'
3	$)





csZ�|kr�S�fdd�|��D�}t|�dkr6|dS|sDt���n|��t�|��dS)Ncsg|]}|���r|�qSr)r)rvZword�rRrrrx�s
�z!_match_abbrev.<locals>.<listcomp>r r)r�rzr�sortr1)rRZwordmapr2rr^rrGts
rG)&�__version__�__all__Z
__copyright__r�r;rbrrr�ImportErrorr0�	Exceptionrr
rrrr1r	r
rr�r�r�r�r�r�rrqrrrrrrrrGrrrrr�<module>s�� 


P




�uA=&types.cpython-38.pyc000064400000021733150335716500010353 0ustar00U

e5d�%�@s�dZddlZdd�Zee�Zedd��Zeej�Zeej�Z	eej
�Zdd�Zee��Z
d	d
�Zee��Zdd�Ze�Zee�Ze��d
d�Ze�Zee�ZGdd�d�Zee�j�Zee�Zegj�Zeej�Zee�j�Z ee!j"�Z#ee$jd�Z%ee�Z&ze'�Wn:e'k
�rBe�(�dZ)ee)�Z*ee)j+�Z,dZ)[)YnXeej�Z-eej.�Z/[[[[[[d$dd�Z0dd�Z1d%dd�Z2dd�Z3Gdd�d�Z4Gdd�d�Z5d d!�Z6d"d#�e7�D�Z8dS)&zO
Define names for built-in types that aren't directly accessible as a builtin.
�NcCsdS�N�rrr�/usr/lib64/python3.8/types.py�_f�rcCsdSrrrrrr�<lambda>
rrcsd��fdd�}|jdS)N�csdSrrr��arr�fsz_cell_factory.<locals>.fr)�__closure__)rrr	r�
_cell_factorysr
ccs
dVdS)Nrrrrrr�_gsrc�sdSrrrrrr�_crrcCs
dVdSrrrrrr�_ag"src@seZdZdd�ZdS)�_CcCsdSrr��selfrrr�_m(rz_C._mN)�__name__�
__module__�__qualname__rrrrrr'sr�fromkeys�rcCsJt|�}t|||�\}}}|dk	r*||�||k	r:||d<||||f|�S)zBCreate a class object dynamically using the appropriate metaclass.N�__orig_bases__)�
resolve_bases�
prepare_class)�name�bases�kwds�	exec_body�resolved_bases�meta�nsrrr�	new_classEsr$cCs�t|�}d}d}t|�D]j\}}t|t�r,qt|d�s8q|�|�}d}t|t�sZtd��q||||||d�<|t|�d7}q|s�|St|�S)z8Resolve MRO entries dynamically as specified by PEP 560.Fr�__mro_entries__Tz#__mro_entries__ must return a tupler)	�list�	enumerate�
isinstance�type�hasattrr%�tuple�	TypeError�len)r�	new_bases�updated�shift�i�base�new_baserrrrOs"




rcCs~|dkri}nt|�}d|kr*|�d�}n|r<t|d�}nt}t|t�rTt||�}t|d�rp|j||f|�}ni}|||fS)azCall the __prepare__ method of the appropriate metaclass.

    Returns (metaclass, namespace, kwds) as a 3-tuple

    *metaclass* is the appropriate metaclass
    *namespace* is the prepared class namespace
    *kwds* is an updated copy of the passed in kwds argument with any
    'metaclass' entry removed. If no kwds argument is passed in, this will
    be an empty dict.
    N�	metaclassr�__prepare__)�dict�popr)r(�_calculate_metar*r5)rrrr"r#rrrrds


rcCs>|}|D]0}t|�}t||�r qt||�r0|}qtd��q|S)z%Calculate the most derived metaclass.zxmetaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases)r)�
issubclassr,)r"r�winnerr2�	base_metarrrr8�s


r8c@sLeZdZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�DynamicClassAttributeaRoute attribute access on a class to __getattr__.

    This is a descriptor, used to define attributes that act differently when
    accessed through an instance and through a class.  Instance access remains
    normal, but access to an attribute through a class will be routed to the
    class's __getattr__ method; this is done by raising AttributeError.

    This allows one to have properties active on an instance, and have virtual
    attributes on the class with the same name (see Enum for an example).

    NcCs>||_||_||_|p|j|_|dk|_tt|dd��|_dS)N�__isabstractmethod__F)�fget�fset�fdel�__doc__�
overwrite_doc�bool�getattrr=)rr>r?r@�docrrr�__init__�s
zDynamicClassAttribute.__init__cCs6|dkr|jr|St��n|jdkr,td��|�|�S)Nzunreadable attribute)r=�AttributeErrorr>)r�instance�
ownerclassrrr�__get__�s
zDynamicClassAttribute.__get__cCs"|jdkrtd��|�||�dS)Nzcan't set attribute)r?rG)rrH�valuerrr�__set__�s
zDynamicClassAttribute.__set__cCs |jdkrtd��|�|�dS)Nzcan't delete attribute)r@rG)rrHrrr�
__delete__�s
z DynamicClassAttribute.__delete__cCs8|jr|jnd}t|�||j|j|p(|j�}|j|_|Sr)rBrAr)r?r@)rr>�fdoc�resultrrr�getter�szDynamicClassAttribute.gettercCs$t|�|j||j|j�}|j|_|Sr)r)r>r@rArB)rr?rOrrr�setter�szDynamicClassAttribute.settercCs$t|�|j|j||j�}|j|_|Sr)r)r>r?rArB)rr@rOrrr�deleter�szDynamicClassAttribute.deleter)NNNN)N)rrrrArFrJrLrMrPrQrRrrrrr<�s


	r<c@s�eZdZdd�Zdd�Zdd�Zdd�Zed	d
��Zedd��Z	ed
d��Z
edd��ZeZe	Z
e
ZeZdd�Zdd�ZeZdS)�_GeneratorWrappercCs2||_|jtk|_t|dd�|_t|dd�|_dS)Nrr)�_GeneratorWrapper__wrapped�	__class__�
GeneratorType�_GeneratorWrapper__isgenrDrr)r�genrrrrF�sz_GeneratorWrapper.__init__cCs|j�|�Sr)rT�send)r�valrrrrY�sz_GeneratorWrapper.sendcGs|jj|f|��Sr)rT�throw)r�tp�restrrrr[�sz_GeneratorWrapper.throwcCs
|j��Sr)rT�closerrrrr^�sz_GeneratorWrapper.closecCs|jjSr)rT�gi_coderrrrr_�sz_GeneratorWrapper.gi_codecCs|jjSr)rT�gi_framerrrrr`�sz_GeneratorWrapper.gi_framecCs|jjSr)rT�
gi_runningrrrrra�sz_GeneratorWrapper.gi_runningcCs|jjSr)rT�gi_yieldfromrrrrrb�sz_GeneratorWrapper.gi_yieldfromcCs
t|j�Sr)�nextrTrrrr�__next__�sz_GeneratorWrapper.__next__cCs|jr|jS|Sr)rWrTrrrr�__iter__�sz_GeneratorWrapper.__iter__N)rrrrFrYr[r^�propertyr_r`rarb�cr_code�cr_frame�
cr_running�cr_awaitrdre�	__await__rrrrrS�s&



rScs�t��std���jtkrft�dd�jtkrf�jj}|d@r@�S|d@rf�j}|j|jdBd��_�Sddl	}ddl
�|�����fd	d
��}|S)z2Convert regular generator function to a coroutine.z$types.coroutine() expects a callable�__code__Ni�� �)�co_flagsrcsR�||�}|jtks*|jtkr.|jjd@r.|St|�j�rNt|�j�sNt|�S|S)Nrn)	rU�
CoroutineTyperVr_ror(�	Generator�	CoroutinerS)�args�kwargs�coro��_collections_abc�funcrr�wrappeds

�
�
�zcoroutine.<locals>.wrapped)�callabler,rU�FunctionTyperD�CodeTyperlro�replace�	functoolsrw�wraps)rxro�cor~ryrrvr�	coroutine�s"
�r�cCs g|]}|dd�dkr|�qS)Nr�_r)�.0�nrrr�
<listcomp>(sr�)rNN)rN)9rA�sysrr)r{�
LambdaTyperlr|�__dict__�MappingProxyType�implementation�SimpleNamespacer
�CellTyperrVrrpr^r�AsyncGeneratorTyperr�
MethodTyper-�BuiltinFunctionType�append�BuiltinMethodType�objectrF�WrapperDescriptorType�__str__�MethodWrapperType�str�join�MethodDescriptorTyper6�ClassMethodDescriptorType�
ModuleTyper,�exc_info�tb�
TracebackType�tb_frame�	FrameType�GetSetDescriptorType�__globals__�MemberDescriptorTyper$rrr8r<rSr��globals�__all__rrrr�<module>s\













 :%4opcode.cpython-38.opt-1.pyc000064400000012456150335716500011421 0ustar00U

e5d��
@s�dZddddddddd	d
ddd
g
ZzddlmZe�d�Wnek
rPYnXdZgZgZgZ	gZ
gZgZgZ
gZiZdd�ed�D�Zdd�Zdd�Zdd�Zdd�Zedd�edd �ed!d"�ed#d$�ed%d&�ed'd(�ed)d*�ed+d,�ed-d.�ed/d0�ed1d2�ed3d4�ed5d6�ed7d8�ed9d:�ed;d<�ed=d>�ed?d@�edAdB�edCdD�edEdF�edGdH�edIdJ�edKdL�edMdN�edOdP�edQdR�edSdT�edUdV�edWdX�edYdZ�ed[d\�ed]d^�ed_d`�edadb�edcdd�ededf�edgdh�edidj�edkdl�edmdn�edodp�edqdr�edsdt�edudv�edwdx�edydz�ed{d|�ed}d~�edd��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��d�Zed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��e�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��e�d��ed�d��ed�d��ed�d��ed�d��ed�d��ed�dƒed�dăed�dƃed�dȃed�dʃed�d̃e�d̡ed�d΃e�dΡed�dЃe�dСed�d҃ed�dԃed�dփed�d؃ed�dڃe
�dڡed�d܃e
�dܡed�dރe
�dޡed�d�e
�d�ed�d�ed�d�ed�d�ed�d�ed�d�ed�d�ed�d�e
�d�edd�d�Zed�d�ed�d�ed�d��ed�d��ed�d��ed�d��ed�d��ed�d��e�d�d�e�d�d�e�d�d�e�d�d�e�d�d	�e�d
�d�[[[[�dS(
zy
opcode module - potentially shared between dis and other modules which
operate on bytecodes (e.g. peephole optimizers).
�cmp_op�hasconst�hasname�hasjrel�hasjabs�haslocal�
hascompare�hasfree�opname�opmap�
HAVE_ARGUMENT�EXTENDED_ARG�hasnargs�)�stack_effectr)�<z<=z==z!=�>z>=�inznot in�iszis notzexception matchZBADcCsg|]}d|f�qS)z<%r>�)�.0�oprr�/usr/lib64/python3.8/opcode.py�
<listcomp>%sr�cCs|t|<|t|<dS�N)r	r
��namerrrr�def_op'srcCst||�t�|�dSr)rr�appendrrrr�name_op+s
rcCst||�t�|�dSr)rrrrrrr�jrel_op/s
r cCst||�t�|�dSr)rrrrrrr�jabs_op3s
r!ZPOP_TOP�ZROT_TWO�Z	ROT_THREE�ZDUP_TOP�ZDUP_TOP_TWO�ZROT_FOUR�ZNOP�	ZUNARY_POSITIVE�
ZUNARY_NEGATIVE�Z	UNARY_NOT�ZUNARY_INVERT�ZBINARY_MATRIX_MULTIPLY�ZINPLACE_MATRIX_MULTIPLY�ZBINARY_POWER�ZBINARY_MULTIPLY�Z
BINARY_MODULO�Z
BINARY_ADD�ZBINARY_SUBTRACT�Z
BINARY_SUBSCR�ZBINARY_FLOOR_DIVIDE�ZBINARY_TRUE_DIVIDE�ZINPLACE_FLOOR_DIVIDE�ZINPLACE_TRUE_DIVIDE�Z	GET_AITER�2Z	GET_ANEXT�3ZBEFORE_ASYNC_WITH�4Z
BEGIN_FINALLY�5Z
END_ASYNC_FOR�6ZINPLACE_ADD�7ZINPLACE_SUBTRACT�8ZINPLACE_MULTIPLY�9ZINPLACE_MODULO�;ZSTORE_SUBSCR�<Z
DELETE_SUBSCR�=Z
BINARY_LSHIFT�>Z
BINARY_RSHIFT�?Z
BINARY_AND�@Z
BINARY_XOR�AZ	BINARY_OR�BZ
INPLACE_POWER�CZGET_ITER�DZGET_YIELD_FROM_ITER�EZ
PRINT_EXPR�FZLOAD_BUILD_CLASS�GZ
YIELD_FROM�HZ
GET_AWAITABLE�IZINPLACE_LSHIFT�KZINPLACE_RSHIFT�LZINPLACE_AND�MZINPLACE_XOR�NZ
INPLACE_OR�OZWITH_CLEANUP_START�QZWITH_CLEANUP_FINISH�RZRETURN_VALUE�SZIMPORT_STAR�TZSETUP_ANNOTATIONS�UZYIELD_VALUE�VZ	POP_BLOCK�WZEND_FINALLY�XZ
POP_EXCEPT�Y�ZZ
STORE_NAMEZDELETE_NAME�[ZUNPACK_SEQUENCE�\ZFOR_ITER�]Z	UNPACK_EX�^Z
STORE_ATTR�_ZDELETE_ATTR�`ZSTORE_GLOBAL�aZ
DELETE_GLOBAL�bZ
LOAD_CONST�dZ	LOAD_NAME�eZBUILD_TUPLE�fZ
BUILD_LIST�gZ	BUILD_SET�hZ	BUILD_MAP�iZ	LOAD_ATTR�jZ
COMPARE_OP�kZIMPORT_NAME�lZIMPORT_FROM�mZJUMP_FORWARD�nZJUMP_IF_FALSE_OR_POP�oZJUMP_IF_TRUE_OR_POP�pZ
JUMP_ABSOLUTE�qZPOP_JUMP_IF_FALSE�rZPOP_JUMP_IF_TRUE�sZLOAD_GLOBAL�tZ
SETUP_FINALLY�zZ	LOAD_FAST�|Z
STORE_FAST�}ZDELETE_FAST�~Z
RAISE_VARARGS�Z
CALL_FUNCTION�Z
MAKE_FUNCTION�ZBUILD_SLICE�ZLOAD_CLOSURE�Z
LOAD_DEREF�ZSTORE_DEREF�ZDELETE_DEREF�ZCALL_FUNCTION_KW�ZCALL_FUNCTION_EX�Z
SETUP_WITH�ZLIST_APPEND�ZSET_ADD�ZMAP_ADD�ZLOAD_CLASSDEREF��ZBUILD_LIST_UNPACK�ZBUILD_MAP_UNPACK�ZBUILD_MAP_UNPACK_WITH_CALL�ZBUILD_TUPLE_UNPACK�ZBUILD_SET_UNPACK�ZSETUP_ASYNC_WITH�ZFORMAT_VALUE�ZBUILD_CONST_KEY_MAP�ZBUILD_STRING�ZBUILD_TUPLE_UNPACK_WITH_CALL�ZLOAD_METHOD�ZCALL_METHOD�ZCALL_FINALLY�ZPOP_FINALLY�N)�__doc__�__all__Z_opcoderr�ImportErrorrrrrrrrrr
r
�ranger	rrr r!rrrrrr�<module>sF
�



























































































































uuid.cpython-38.opt-2.pyc000064400000040051150335716500011107 0ustar00U

&�.e3w�@sddlZddlZddlmZdZejdkr4dZZn ddlZe��Z	e	dkZe	dkZdd	d
dg\Z
ZZZ
eZeZGdd
�d
e�ZGdd�d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zdaada zddl!Z!Wne"k
�rdZ!YnXd$d%�Z#d&d'�Z$d(d)�Z%d*d+�Z&e�rBeegZ'nJejd,k�rZeeegZ'n2ejd-k�rpeegZ'ne�r~egZ'neeeeegZ'ej(d.k�r�e$ge'Z)nej(d/k�r�e%ge'Z)ne'Z)da*dd0�d1d2�Z+da,d?d3d4�Z-d5d6�Z.d7d8�Z/d9d:�Z0ed;�Z1ed<�Z2ed=�Z3ed>�Z4dS)@�N)�EnumzKa-Ping Yee <ping@zesty.ca>)�win32�darwinFZAIXZLinuxzreserved for NCS compatibilityzspecified in RFC 4122z$reserved for Microsoft compatibilityzreserved for future definitionc@seZdZdZdZdZdS)�SafeUUIDr���N)�__name__�
__module__�__qualname__ZsafeZunsafe�unknown�rr�/usr/lib64/python3.8/uuid.pyrHsrc@s6eZdZdZd<ejd�dd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zedd��Zed d!��Zed"d#��Zed$d%��Zed&d'��Zed(d)��Zed*d+��Zed,d-��Zed.d/��Zed0d1��Zed2d3��Zed4d5��Zed6d7��Z ed8d9��Z!ed:d;��Z"dS)=�UUID)�int�is_safe�__weakref__N)rcCs�|||||g�d�dkr td��|dk	rl|�dd��dd�}|�d��dd�}t|�dkrbtd	��t|d
�}|dk	r�t|�d
kr�td��|ddd
�|ddd
�|ddd
�|dd�}|dk	r�t|�d
kr�td��tj|dd�}|dk	�rt|�dk�rtd��|\}}	}
}}}
d|k�r0dk�s:ntd��d|	k�rRdk�s\ntd��d|
k�rtdk�s~ntd��d|k�r�dk�s�ntd��d|k�r�dk�s�ntd��d|
k�r�dk�s�ntd ��|d>|B}|d!>|	d">B|
d#>B|d$>B|
B}|dk	�rDd|k�r:d%d&>k�sDntd'��|dk	�r�d%|k�rfdk�spntd(��|d)M}|d*O}|d+M}||d,>O}t�	|d-|�t�	|d.|�dS)/N�zGone of the hex, bytes, bytes_le, fields, or int arguments must be givenzurn:�zuuid:z{}�-� z$badly formed hexadecimal UUID string�z bytes_le is not a 16-char string�r���zbytes is not a 16-char string�big)�	byteorder�zfields is not a 6-tuplerlz*field 1 out of range (need a 32-bit value)iz*field 2 out of range (need a 16-bit value)z*field 3 out of range (need a 16-bit value)�z*field 4 out of range (need an 8-bit value)z*field 5 out of range (need an 8-bit value)�z*field 6 out of range (need a 48-bit value)�`�P�@�0��z*int is out of range (need a 128-bit value)zillegal version numberl�����l�����Lrr)
�count�	TypeError�replace�strip�len�
ValueError�int_�
from_bytes�object�__setattr__)�self�hex�bytes�bytes_le�fieldsr�versionr�time_low�time_mid�time_hi_version�clock_seq_hi_variant�
clock_seq_low�node�	clock_seqrrr�__init__�sx 
�
�
����

z
UUID.__init__cCs&d|ji}|jtjkr"|jj|d<|S�Nrr)rrrr
�value)r1�drrr�__getstate__�s
zUUID.__getstate__cCs:t�|d|d�t�|dd|kr.t|d�ntj�dSr?)r/r0rr
)r1�staterrr�__setstate__�s��zUUID.__setstate__cCst|t�r|j|jkStS�N��
isinstancer
r�NotImplemented�r1�otherrrr�__eq__�s
zUUID.__eq__cCst|t�r|j|jkStSrErFrIrrr�__lt__�s
zUUID.__lt__cCst|t�r|j|jkStSrErFrIrrr�__gt__�s
zUUID.__gt__cCst|t�r|j|jkStSrErFrIrrr�__le__�s
zUUID.__le__cCst|t�r|j|jkStSrErFrIrrr�__ge__s
zUUID.__ge__cCs
t|j�SrE)�hashr�r1rrr�__hash__sz
UUID.__hash__cCs|jSrE�rrQrrr�__int__szUUID.__int__cCsd|jjt|�fS)Nz%s(%r))�	__class__r�strrQrrr�__repr__sz
UUID.__repr__cCstd��dS)NzUUID objects are immutable)r()r1�namer@rrrr0szUUID.__setattr__cCsDd|j}d|dd�|dd�|dd�|dd�|dd�fS)N�%032xz%s-%s-%s-%s-%sr�r�rS)r1r2rrr�__str__s





�zUUID.__str__cCs|j�dd�S)Nrr)r�to_bytesrQrrrr3sz
UUID.bytescCs<|j}|ddd�|ddd�|ddd�|dd�S)Nrrrrr�r3)r1r3rrrr4s(
�z
UUID.bytes_lecCs|j|j|j|j|j|jfSrE)r7r8r9r:r;r<rQrrrr5 s
�zUUID.fieldscCs
|jd?S)NrrSrQrrrr7%sz
UUID.time_lowcCs|jd?d@S)Nr �rSrQrrrr8)sz
UUID.time_midcCs|jd?d@S)Nr!r_rSrQrrrr9-szUUID.time_hi_versioncCs|jd?d@S)N�8�rSrQrrrr:1szUUID.clock_seq_hi_variantcCs|jd?d@S)Nr"rarSrQrrrr;5szUUID.clock_seq_lowcCs|jd@d>|jd>B|jBS)N�r"r)r9r8r7rQrrr�time9s
��z	UUID.timecCs|jd@d>|jBS)N�?r)r:r;rQrrrr=>s�zUUID.clock_seqcCs
|jd@S)Nl���rSrQrrrr<Csz	UUID.nodecCs
d|jS)NrYrSrQrrrr2GszUUID.hexcCsdt|�S)Nz	urn:uuid:)rVrQrrr�urnKszUUID.urncCs2|jd@stS|jd@stS|jd@s*tStSdS)Nr%ll)r�RESERVED_NCS�RFC_4122�RESERVED_MICROSOFT�RESERVED_FUTURErQrrr�variantOs


zUUID.variantcCs |jtkrt|jd?d@�SdS)Nr&�)rjrgrrQrrrr6Zs
zUUID.version)NNNNNN)#rrr	�	__slots__rr
r>rBrDrKrLrMrNrOrRrTrWr0r\�propertyr3r4r5r7r8r9r:r;rcr=r<r2rerjr6rrrrr
Nsb4��V














r
c	Gs�ddl}ddl}ddl}|�|�}|dkrP|j�d�}|j||d�}|dkrPdSt|j�}d|d<|j|f||j	|j
|d�}|S)Nr)z/sbinz	/usr/sbin)�path�C�LC_ALL)�stdout�stderr�env)�os�shutil�
subprocessZwhich�pathsep�join�dict�environ�Popen�PIPEZDEVNULL)	�command�argsrtrurv�
executablernrs�procrrr�_popen`s

�r�cCs
|d@S)Nlr��macrrr�
_is_universal�sr�cCs�d}z�t|f|����}|s"WdS|��|jD]�}|������}tt|��D]x}|||krNzN|||�}	t|	�dd�d�}
t	|
�r�|
WW5QR�WS|p�|
}WqNt
tfk
r�YqNXqNq.W5QRXWntk
r�YnX|p�dS)N�:�r)
r��splitrq�lower�rstrip�ranger+rr)r�r,�
IndexError�OSError)r}r~Zhw_identifiersZ	get_index�first_local_macr��line�words�i�wordr�rrr�	_find_mac�s*
r�cCs4d}dD]&}td||dd��}|r*|SdSdS)N)shwaddrsethersaddress:slladdr)rz-az-avZifconfigcSs|dS�Nr#r�r�rrr�<lambda>�r�z#_ifconfig_getnode.<locals>.<lambda>�r�)�keywordsr~r�rrr�_ifconfig_getnode�sr�cCs tdddgdd��}|r|SdS)NZip�links
link/ethercSs|dSr�rr�rrrr��r�z_ip_getnode.<locals>.<lambda>r�r�rrr�_ip_getnode�sr�cCs�ddl}ddl}z|�|���}Wntk
r8YdSXtdd|�|�gdd��}|r\|Stdd|�|�gdd��}|r~|Stdd|�d|�gdd��}|r�|SdS)	NrZarpz-ancSsdS)Nrrr�rrrr��r�z_arp_getnode.<locals>.<lambda>cSs|dSr�rr�rrrr��r�z(%s)cSs|dS)N�rr�rrrr��r�)rt�socketZ
gethostbynameZgethostnamer�r��fsencode)rtr�Zip_addrr�rrr�_arp_getnode�s"�r�cCstdddgdd��S)NZlanscanz-aislan0cSsdS)Nrrr�rrrr��r�z"_lanscan_getnode.<locals>.<lambda>r�rrrr�_lanscan_getnode�sr�cCs&d}�z�tdd�}|sWdS|��|j������}z|�d�}Wn"tk
rdYW5QR�WdSX|jD]�}zl|����}||}t|�dkr�|�d�dkr�t	|�
dd�d�}t|�r�|WW5QR�WS|p�|}Wqlttfk
r�YqlXqlW5QRXWnt
k
�rYnX|�p$dS)	NZnetstatz-iasAddress�r�rr�r)r�rq�readliner�r��indexr,r+r'rr)r�r�r�)r�r�r�r�r�r�r�rrr�_netstat_getnode�s2

r�cCs<ddl}ddl}ddl}d}dddg}z:ddl}|�d�}|jj�|d�|�d|j	�
d��WnYnX|D]�}z$|j|j�
|d�dg|jd	d
�}Wntk
r�YqrYnX|�r|jD]d}	|	�d�d����}
|�d
|
�r�t|
�dd�d�}t|��r|W5QR�S|�p"|}q�W5QRXqr|�p:dS)Nrrzc:\windows\system32zc:\winnt\system32i,�mbcsZipconfigz/allZoem)rq�encoding�:rz((?:[0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]rr)rt�rerv�ctypes�create_string_buffer�windllZkernel32ZGetSystemDirectoryA�insertr@�decoder{rnrxr|r�rqr�r*r��	fullmatchrr)r�)rtr�rvr��dirsr��buffer�dirr�r�r@r�rrr�_ipconfig_getnode�s6

�



r�c	Cs6ddl}ddl}d}|��}|j|_|��|_}|��|�|�dkrLdS|�	�t
|j�D]�}|��|j
|_t|j|�|_|�|�dkr�q^|��|j|_t|j|�|_d�d�|_|��|_}|�|�dkr�q^|�	�|jdd�}t|�dk�rq^t�|d�}t|��r |S|�p(|}q^|�p4dS)Nr�*rrr)�	win32wnet�netbiosZNCBZNCBENUMZCommandZ	LANA_ENUMZBufferZ_packZNetbiosZ_unpackr�ZlengthZResetZNCBRESET�ordZlanaZLana_numZNCBASTAT�ljustZCallnameZADAPTER_STATUSZadapter_addressr+rr.r�)	r�r�r�ZncbZadaptersr�Zstatusr3r�rrr�_netbios_getnodes>
r�c
s�tdk	rdSdatjdkr8tt��j�d�d�dkr8ntdk	rPtj	a
tjadSz�ddl�ddl
�dg}tj�d�s~|�d�|D]�}z���j�|��}Wntk
r�Yq�YnXt|d	�r�|j���fd
d�a
da�qq�t|d
�r�|j�d�_��fdd�a
�qq�z�jj}Wnd}YnXt|dt|dd��aWn>tk
�r~}zddl}|�d|��t�W5d}~XYnXdS)NFr�.r�	Zuuid�win�c�uuid_generate_time_safecs ��d�}�|�}t|j�|fS�Nr�r�r3�raw)�_buffer�res)�_uuid_generate_time_safer�rr�_generate_time_safehs
r�T�uuid_generate_timecs ��d�}�|�t|j�dfSr�r�)r�)�_uuid_generate_timer�rrr�ss
ZUuidCreateSequentialZ
UuidCreatez/Could not find fallback ctypes uuid functions: )�_has_uuid_generate_time_safe�sys�platformrrt�uname�releaser��_uuidZgenerate_time_safer�Zhas_uuid_generate_time_safer�Zctypes.util�
startswith�appendZCDLL�utilZfind_library�	Exception�hasattrr�r�Zrestyper�Zrpcrt4�getattr�_UuidCreate�warnings�warn�
ImportWarning)Z	_libnamesZlibname�lib�excr�r)r�r�r�r�_load_system_functions:sT&






��r�cCst�t�\}}t|d�jS)Nr^)r�r�r
r<)�	uuid_time�_rrr�
_unix_getnode�s
r�cCs:ddl}t�|�d�}t|�dkr6tt|j�d�jSdS)Nrrr^)r�r�r�r�r
�bytes_r�r<)r�r�rrr�_windll_getnode�s

r�cCsddl}|�d�dBS)Nrr"l)�random�getrandbits)r�rrr�_random_getnode�sr�rr�posix�nt)�getterscCsdtdk	rtSttgD]H}z
|�aWnYqYnXtdk	rdtkrRdkrnqtSqdS)Nrr)�_node�_GETTERSr�)r��getterrrr�getnode�s	

 
r�cCst�tdk	rd||kr"dkrdnn>t�\}}zt|�}Wntk
rVtj}YnXt||d�Sddl}|��}|dd}tdk	r�|tkr�td}|a|dkr�ddl	}|�
d�}|d@}	|d?d	@}
|d
?d@}|d@}|d
?d@}
|dkr�t�}t|	|
||
||fdd�S)N)r3rr�dl@'Hw�
r#�l��rr_r"rbrarrd)r5r6)r�r�rr,r
r
rc�time_ns�_last_timestampr�r�r�)r<r=r�Zsafely_generatedrrcZnanosecondsZ	timestampr�r7r8r9r;r:rrr�uuid1�s> 

��r�cCs<ddlm}||jt|d�dd���}t|dd�dd�S)	Nr)�md5�utf-8F)Zusedforsecurityrr�r3r6)�hashlibr�r3�digestr
)�	namespacerXr�r�rrr�uuid3s�
r�cCstt�d�dd�S)Nrrr�)r
rt�urandomrrrr�uuid4sr�cCs8ddlm}||jt|d����}t|dd�dd�S)Nr)�sha1r�rrr�)r�r�r3r�r
)r�rXr�rPrrr�uuid5sr�z$6ba7b810-9dad-11d1-80b4-00c04fd430c8z$6ba7b811-9dad-11d1-80b4-00c04fd430c8z$6ba7b812-9dad-11d1-80b4-00c04fd430c8z$6ba7b814-9dad-11d1-80b4-00c04fd430c8)NN)5rtr��enumr�
__author__r�Z_AIXZ_LINUX�systemZ_platform_systemrfrgrhrirr-r3r�rr
r�r�r�r�r�r�r�r�r�r�r�r�r�r��ImportErrorr�r�r�r�Z_OS_GETTERSrXr�r�r�r�r�r�r�r�Z
NAMESPACE_DNSZ
NAMESPACE_URLZ
NAMESPACE_OIDZNAMESPACE_X500rrrr�<module>/s�

�"
$
T

�
'	pydoc.cpython-38.pyc000064400000243037150335716500010330 0ustar00U

��.e̠�@s�dZdgZdZdZdZddlZddlZddlZddl	Zddl
ZddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZdd	lmZd
d�Zdd
�Zdd�Z dd�Z!dd�Z"dd�Z#dd�Z$e�%dej&�Z'dd�Z(dd�Z)dd�Z*dd �Z+dxd!d"�Z,d#d$�Z-d%d&�Z.d'd(�Z/d)d*�Z0ifd+d,�Z1Gd-d.�d.e2�Z3d/d0�Z4difd1d2�Z5Gd3d4�d4�Z6Gd5d6�d6e�Z7Gd7d8�d8e6�Z8Gd9d:�d:e�Z9Gd;d<�d<e6�Z:Gd=d>�d>e:�Z;d?d@�a<dAdB�Z=dCdD�Z>dEdF�Z?dGdH�Z@dIdJ�ZAdKdL�ZBdMdN�ZCdOdP�ZDdydQdR�ZEe:�ZFe;�ZGe8�ZHdzdSdT�ZId{dVdW�ZJd|dXdY�ZKd}dZd[�ZLd~d]d^�ZMGd_d`�d`�ZNeN�ZOGdadb�db�ZPdcdd�ZQdedf�ZRddhdi�ZSd�djdkdl�dmdn�ZTdodp�ZUdqdr�ZVdsdt�ZWdudv�ZXeYdwk�r�eX�dS)�aGenerate Python documentation in HTML or text for interactive use.

At the Python interactive prompt, calling help(thing) on a Python object
documents the object, and calling help() starts up an interactive
help session.

Or, at the shell command line outside of Python:

Run "pydoc <name>" to show documentation on something.  <name> may be
the name of a function, module, package, or a dotted reference to a
class or function within a module or module in a package.  If the
argument contains a path segment delimiter (e.g. slash on Unix,
backslash on Windows) it is treated as the path to a Python source file.

Run "pydoc -k <keyword>" to search for a keyword in the synopsis lines
of all available modules.

Run "pydoc -n <hostname>" to start an HTTP server with the given
hostname (default: localhost) on the local machine.

Run "pydoc -p <port>" to start an HTTP server on the given port on the
local machine.  Port number 0 can be used to get an arbitrary unused port.

Run "pydoc -b" to start an HTTP server on an arbitrary unused port and
open a Web browser to interactively browse documentation.  Combine with
the -n and -p options to control the hostname and port used.

Run "pydoc -w <name>" to write out the HTML documentation for a module
to a file named "<name>.html".

Module docs for core modules are assumed to be in

    https://docs.python.org/X.Y/library/

This can be overridden by setting the PYTHONDOCS environment variable
to a different URL or to a local directory containing the Library
Reference Manual pages.
�helpzKa-Ping Yee <ping@lfw.org>z26 February 2001z�Guido van Rossum, for an excellent programming language.
Tommy Burnette, the original creator of manpy.
Paul Prescod, for all his work on onlinehelp.
Richard Chamberlain, for the first implementation of textdoc.
�N)�deque)�Repr)�format_exception_onlycCs\g}g}tjD]H}tj�|pd�}tj�|�}||krtj�|�r|�|�|�|�q|S)zAConvert sys.path into a list of absolute, existing, unique paths.�.)�sys�path�os�abspath�normcase�isdir�append)�dirsZnormdirs�dirZnormdir�r�/usr/lib64/python3.8/pydoc.py�pathdirsPs

rcCs.t�|�pt�|�}|r*t�dd|���p,dS)z-Get the doc string or comments for an object.z^ *
�)�inspect�getdocZgetcomments�re�sub�rstrip)�object�resultrrrr\srcCsf|���d�}t|�dkr&|ddfSt|�dkrX|d��sX|dd�|dd��fSdd�|�fS)z>Split a doc string into a synopsis line (if any) and the rest.�
�rr�N)�strip�split�lenr�join)�doc�linesrrr�splitdocasr$cCs"|j}|j|kr|jd|}|S)z@Get a class name and qualify it with a module name if necessary.r)�__name__�
__module__)r�modname�namerrr�	classnamejs
r)cCs>t�|�p:t�|�p:t�|�p:t�|�p:t�|�p:t�|�S)z>Check if an object is of a type that probably means it's data.)r�ismodule�isclass�	isroutineZisframeZistracebackZiscode�rrrr�isdataqs����r.cGs.|r*|d�|�|d��}|dd�}q|S)z/Do a series of global replacements on a string.rrrN)r!r)�textZpairsrrr�replacewsr0cCsXt|�|krTtd|dd�}td|d|�}|d|�d|t|�|d�S|S)zCOmit part of a string if needed to make it fit in a maximum length.r�rN�...)r �max)r/�maxlenZpreZpostrrr�cram~s
$r5z at 0x[0-9a-f]{6,16}(>+)$cCst�d|�S)z>Remove the hexadecimal id from a Python object representation.z\1)�_re_stripidr�r/rrr�stripid�sr8cCs<t�|�rdSt�|�r8t|dd�}t�|�p4|dkSdS)zo
    Returns True if fn is a bound method, regardless of whether
    fn was implemented in Python or in C.
    T�__self__NF)r�ismethod�	isbuiltin�getattrr*)�fn�selfrrr�_is_bound_method�s

r?cCs^i}t�|tj�D]\}}d||<q|jD]}|�t|��q*|��D]}t||�||<qF|S�Nr)r�
getmembersr,�	__bases__�update�
allmethods�keysr<)�cl�methods�key�value�baserrrrD�s

rDcCs8g}g}|D]"}||�r$|�|�q|�|�q||fS)z�Split sequence s via predicate, and return pair ([true], [false]).

    The return value is a 2-tuple of lists,
        ([x for x in s if predicate(x)],
         [x for x in s if not predicate(x)])
    �r
)�s�	predicateZyesZno�xrrr�_split_list�srOcCs\|dkrdS|�d�r$|�d�r$dS|�d�r<t|d�r<dS|dk	rL||kS|�d�SdS)	z3Decide whether to show documentation on a variable.>�	__slots__�__date__�__path__�__qualname__�__builtins__�__credits__�__doc__�
__author__�__version__�__file__r%�
__cached__r&�
__loader__�__spec__�__package__r�__r�_�_fieldsTN)�
startswith�endswith�hasattr)r(�all�objrrr�visiblename�srfcCsXg}t�|�D]D\}}}}t�|�r@d}t|t�r@|jdkr@d}|�||||f�q|S)zCWrap inspect.classify_class_attrs, with fixup for data descriptors.�data descriptorN�readonly property)r�classify_class_attrs�isdatadescriptor�
isinstance�property�fsetr
)r�resultsr(�kind�clsrIrrrri�s
rics\t|dg��z�fdd�t��D��Wntk
r>i�YnX�fdd�}|j|d�dS)zGSort the attrs list in-place by _fields and then alphabetically by namer`csi|]\}}||t���qSr)r )�.0�ir()�fieldsrr�
<dictcomp>�sz#sort_attributes.<locals>.<dictcomp>cs��|dd�|dfS�Nr)�get)�attr)�field_orderrr�<lambda>��z!sort_attributes.<locals>.<lambda>�rHN)r<�	enumerate�	TypeError�sort)�attrsrZkeyfuncr)rxrsr�sort_attributes�s
r�cCs:tj�|�r6dD]$}tj�tj�|d|��rdSqdS)z3Guess whether a path refers to a package directory.)z.pyz.pyc�__init__TF)r	rr�isfiler!)r�extrrr�	ispackage�s
r�cCs�|��}|dd�dks |��s0|��}|sq0q|��}|dd�dkrT|dd�}|dd�dkr�|dd�}|dd�dkr�|dd�}|��s�|��}|s�q�q�|�d�d	��}nd}|S)
Nr�#�zr"""r1�"""����\r)�readlinerr)�file�linerrrr�source_synopsis�s&r�c
	Cs t�|�j}|�|d�\}}|dks.||k�r|�ttjj��rJtjj	}n |�ttjj
��rftjj}nd}|dkr�zt�
|�}Wntk
r�YdSX|�t|�}W5QRXn^|d|�}tjjd||d�}ztj�|�}	WnYdSXtjd=|	j�r|	j��dnd}||f||<|S)z.Get the one-line summary out of a module file.)NNNZ__temp__��loaderr)r	�stat�st_mtimervrb�tuple�	importlib�	machinery�BYTECODE_SUFFIXES�SourcelessFileLoader�EXTENSION_SUFFIXES�ExtensionFileLoader�tokenize�open�OSErrorr��util�spec_from_file_location�
_bootstrap�_loadr�modulesrV�
splitlines)
�filename�cache�mtimeZ
lastupdaterZ
loader_clsr�r��spec�modulerrr�synopsis�s6



�r�c@s eZdZdZdd�Zdd�ZdS)�ErrorDuringImportzEErrors that occurred while trying to import something to document it.cCs||_|\|_|_|_dS�N)r��excrI�tb)r>r��exc_inforrrr�#szErrorDuringImport.__init__cCs|jj}d|j||jfS)Nzproblem in %s - %s: %s)r�r%r�rI)r>r�rrr�__str__'szErrorDuringImport.__str__N)r%r&rSrVr�r�rrrrr�!sr�c		Cs�tjj}t|d��}||�t|��k}W5QRXtj�|�}tj�	|�\}}|r`tj
�||�}ntj
�||�}tjj
|||d�}ztj�|�WSt|t����YnXdS)z<Import a Python source file or compiled file given its path.�rbr�N)r�r��MAGIC_NUMBERr��readr r	r�basename�splitext�_bootstrap_externalr��SourceFileLoaderr�r�r�r�rr�)	r�magicr�Zis_bytecoder�r(r�r�r�rrr�
importfile+sr�c	s z^|rT�tjkrT�tjkrT�fdd�tjD�}�g|D]}tj|||<tj|=q8t��}Wnzt��\}}}}	�tjkr�ttj�j|	��n>|tkr�t|j|	��n(t	|t
�r�|j�kr�YdSt�t����YnX��d�dd�D].}
zt
||
�}Wq�tk
�rYdSXq�|S)a�Import a module; handle errors; return None if the module isn't found.

    If the module *is* found but an exception occurs, it's wrapped in an
    ErrorDuringImport exception and reraised.  Unlike __import__, if a
    package path is specified, the module at the end of the path is returned,
    not the package at the beginning.  If the optional 'forceload' argument
    is 1, we reload the module from disk (unless it's a dynamic extension).csg|]}|��d�r|�qS)r)ra)rq�m�rrr�
<listcomp>Qszsafeimport.<locals>.<listcomp>Nrr)rr��builtin_module_names�
__import__r�r�rY�SyntaxErrorr��
issubclass�ImportErrorr(rr<�AttributeError)r�	forceloadr�ZsubsrHr�r�rIr��info�partrr�r�
safeimport=s.


r�c@sfeZdZej�ddejdd��Zddd�Z	d
dd�Z
e
ZZZ
ZZZe�d	�fd
d�ZdS)�Doc�
PYTHONDOCSz%https://docs.python.org/%d.%d/libraryNrcGs�||f|}zFt�|�r$|j|�WSt�|�r:|j|�WSt�|�rP|j|�WSWntk
rfYnXt�|�r||j	|�S|j
|�S)z%Generate documentation for an object.)rr*�	docmoduler+�docclassr,�
docroutiner�rj�docdata�docother)r>rr(�argsrrr�documentss




zDoc.documentcGs*d|odt|�t|�jf}t|��dS)z+Raise an exception for unimplemented types.z.don't know how to document object%s of type %s� N)�repr�typer%r})r>rr(r��messagerrr�fail�s
�zDoc.failZstdlibcCs�zt�|�}Wntk
r&d}YnXtj�d|j�}tj�|�}t	|t
t��r�|jdksz|�|�r�|�tj�
|d��s�|jdkr�|�d�r�d|�d�|j��f}q�tj�
||j��d	�}nd
}|S)z*Return the location of module docs or None�
(built-in)r�)
�errno�
exceptionsZgcZimp�marshal�posix�signalr�_threadZ	zipimportz
site-packages)z	xml.etreeztest.pydoc_mod)zhttp://zhttps://z%s/%s�/�.htmlN)r�
getabsfiler}r	�environrvr�rrrkr�r%rar!r�lower)r>rZbasedirr��doclocrrr�	getdocloc�s(
����
z
Doc.getdocloc)N)N)r%r&rSr	r�rvr�version_infor�r�r�r�r�r�r��docpropertyr��	sysconfigZget_pathr�rrrrr�ms��

r�c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZeZ	dd
�Z
eZdS)�HTMLReprzBClass for safely making an HTML representation of a Python object.cCs,t�|�d|_|_d|_d|_|_dS�N��
�d�rr��maxlist�maxtuple�maxdict�	maxstring�maxother�r>rrrr��s
zHTMLRepr.__init__cCst|dddddd�S)N�&z&amp;�<z&lt;�>z&gt;)r0�r>r/rrr�escape�szHTMLRepr.escapecCst�||�Sr�)rr��r>rrrrr��sz
HTMLRepr.reprcCsZtt|�d�r@dd�t|�j���}t||�r@t||�||�S|�ttt	|��|j
��S�Nr%�repr_r_)rcr�r!r%rr<r�r5r8r�r��r>rN�levelZ
methodnamerrr�repr1�s

zHTMLRepr.repr1cCs^t||j�}t|�}d|krJdt|dd�krJd|d|�|�|dSt�dd|�|��S)Nr��\\r�rrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z<font color="#c040c0">\1</font>)r5r�r�r0r�rr�r>rNr�ZtestZtestreprrrr�repr_string�s�zHTMLRepr.repr_stringcCs@z|�ttt|��|j��WS|�d|jj�YSXdS�Nz
<%s instance>)r�r5r8r�r��	__class__r%�r>rNr�rrr�
repr_instance�szHTMLRepr.repr_instanceN)r%r&rSrVr�r�r�r�r��repr_strrZrepr_unicoderrrrr��sr�c@seZdZdZe�ZejZejZdd�Zd1dd�Z	d2d
d�Z
dd
�Zdd�Zd3dd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdiiifdd �Zd4d!d"�Zd5d#d$�Zddiifd%d&�Zd'd(�Zddiiidfd)d*�Zd6d+d,�ZeZd7d-d.�Zd8d/d0�ZdS)9�HTMLDocz'Formatter class for HTML documentation.cCsd||fS)�Format an HTML page.z�<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
%s
</body></html>r)r>�title�contentsrrr�page�s�zHTMLDoc.pagercCsd|||||pdfS)zFormat a page heading.a'
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="%s">
<td valign=bottom>&nbsp;<br>
<font color="%s" face="helvetica, arial">&nbsp;<br>%s</font></td
><td align=right valign=bottom
><font color="%s" face="helvetica, arial">%s</font></td></tr></table>
    �&nbsp;r)r>r�fgcol�bgcolZextrasrrr�heading�s�zHTMLDoc.heading�Nrc	
Cs^|dkrdd|d}d|||f}	|r@|	d||||f}	n|	d|||f}	|	d|S)	z Format a section with a heading.Nz<tt>rz</tt>z�<p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="%s">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="%s" face="helvetica, arial">%s</font></td></tr>
    zR
<tr bgcolor="%s"><td rowspan=2>%s</td>
<td colspan=2>%s</td></tr>
<tr><td>%s</td>z(
<tr><td bgcolor="%s">%s</td><td>%s</td>z'
<td width="100%%">%s</td></tr></table>r)
r>rr	r
r�widthZpreludeZ
marginaliaZgaprrrr�section�s�
��zHTMLDoc.sectioncGsd|}|j|f|��S)z$Format a section with a big heading.z<big><strong>%s</strong></big>)r)r>rr�rrr�
bigsectionszHTMLDoc.bigsectionc
Cs&|�|���}t|dddddddd�	S)z!Format literal preformatted text.�

z
 
r�rr�<br>
)r��
expandtabsr0r�rrr�	preformat
s�zHTMLDoc.preformatr�cCs�d}t|�|d|}t|�D]X}|dd|}t|||||�D]$}|t|�krJ||||�d}qJ|d}q d|S)z0Format a list of items into a multi-column list.rrz<td width="%d%%" valign=top>r�rz</td>z7<table width="100%%" summary="list"><tr>%s</tr></table>)r �range)r>�list�formatZcolsr�rows�colrrrrr�multicolumns
zHTMLDoc.multicolumncCsd|S)Nz<font color="#909090">%s</font>rr�rrr�greyrzzHTMLDoc.greycGs*|D] }||krd|||fSq|S)z:Make a link for an identifier, given name-to-URL mappings.�<a href="%s">%s</a>r)r>r(Zdicts�dictrrr�namelinkszHTMLDoc.namelinkcCsN|jtj�|j�}}t||�rDt||�|krDd|j|t||�fSt||�S)zMake a link for a class.z<a href="%s.html#%s">%s</a>)r%rr�rvr&rcr<r))r>rr'r(r�rrr�	classlink%s�zHTMLDoc.classlinkcCsd|j|jfS)zMake a link for a module.�<a href="%s.html">%s</a>)r%r�rrr�
modulelink-szHTMLDoc.modulelinkcCsR|\}}}}|r|�|�S|r,d||f}nd|}|rBd|}n|}d||fS)z;Make a link for a module or package to display in an index.z
%s.%s.htmlz%s.htmlz"<strong>%s</strong>&nbsp;(package)r)r)r>Z
modpkginfor(rr��shadowed�urlr/rrr�
modpkglink1s

zHTMLDoc.modpkglinkcCsd||fS)zMake a link to source file.z<a href="file:%s">%s</a>r)r>r"rrrr�filelink@szHTMLDoc.filelinkcCs�|p|j}g}d}t�d�}|�||�}	|	s0�qh|	��\}
}|�||||
���|	��\}}
}}}}|
r�||��dd�}|�d||f�n�|r�dt|�}|�d|||�f�n�|r�dt|�}|�d|||�f�n�|�r"|||d�d	k�r|�d
|�	||��n|�d|�n@|||d�d	k�rP|�|�	||||��n|�|�	||��|}q|�|||d���d
�
|�S)z�Mark up some plain text, given a context of symbols to look for.
        Each context dictionary maps object names to anchor names.rzD\b((http|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?(\w+))�"z&quot;rz'http://www.rfc-editor.org/rfc/rfc%d.txtz(http://www.python.org/dev/peps/pep-%04d/r�(zself.zself.<strong>%s</strong>Nr)r�r�compile�search�spanr
�groupsr0�intrr!)r>r/r��funcs�classesrGrn�here�pattern�match�start�endrdZschemeZrfcZpepZselfdotr(r"rrr�markupDs:

zHTMLDoc.markupc
Cs�d}|D]�}t|�td�kr�|\}}|d}||�||�}|r�||fkr�g}|D]}	|�|�|	|��qR|dd�|�d}|d}qt|�tg�kr|d|�|||�}qd	|S)
zAProduce HTML for a class tree as given by inspect.getclasstree().rrz"<dt><font face="helvetica, arial">r&�, �)z
</font></dt>z
<dd>
%s</dd>
z
<dl>
%s</dl>
)r�rr
r!�
formattree)
r>�treer'�parentr�entry�c�bases�parentsrJrrrr6os&
�
zHTMLDoc.formattreec#
s�|j}z
|j}Wntk
r(d}YnX|�d�}g}tt|�d�D],}|�dd�|d|d��||f�qHd�||dd��}	d|	}
z&t�	|�}t
j�|�}��
||�}
Wntk
r�d}
YnXg}t|d��r6t|j�}|dd	�d
k�r"|dd�dk�r"|d	d���}|�d��|��t|d
��rX|���t|j���|�rp|
dd�|�}
��|�}|dk	�r�dt�}nd}��|
ddd|
|�}t�|tj�}gi}}t�|tj�D]Z\}}|dk	�s�t�|��p�||k�r�t|||��r�|�||f�d|||<||<�q�|D]�\}}|jD]n}|j|j}}tj �!|�}||k�r@|�r@t||��r@t"||�|k�r@||k�r@|d|||<||<�q@�q2gi}}t�|tj#�D]p\}}|dk	�s�t�$|��s�t�|�|k�r�t|||��r�|�||f�d|||<t�%|��r�||||<�q�g}t�|t&�D]&\}}t|||��rN|�||f��qN��'t(|��j)||�}|�o�d|}|d|}t|d��rg}t*�+|j,�D]\}}} |�||| df��q�|�-���.|�j/�}!|��0ddd|!�}n.|�r<��.|�fdd��}!|��0d dd|!�}|�r�d!d"�|D�}"��1t�2|"d�|�g}!|D]"\}}|!���3|||||���qj|��0d#dd$d%�|!��}|�r�g}!|D]"\}}|!���3|||||���q�|��0d&dd'd%�|!��}|�r:g}!|D]\}}|!���3||���q|��0d(dd)d*�|!��}t|d+��rn��'t|j4��j)�}!|��0d,dd|!�}t|d-��r���'t|j5��j)�}!|��0d.dd|!�}|S)/z/Produce HTML documentation for a module object.Nrrz5<a href="%s.html"><font color="#ffffff">%s</font></a>r��)<big><big><strong>%s</strong></big></big>r�rX��$Revision: �$z
version %srQz (%s)r4z-<br><a href="%(docloc)s">Module Reference</a>r�#ffffff�#7799eez<a href=".">index</a><br>r�z.html#z#-z<tt>%s</tt>z
<p>%s</p>
rRrzPackage Contentsz#aa55cccs��|d�Sr@)r ��tr�rrry�rzz#HTMLDoc.docmodule.<locals>.<lambda>ZModulescSsg|]\}}|�qSrr�rqrHrIrrrr��sz%HTMLDoc.docmodule.<locals>.<listcomp>ZClasses�#ee77aar�Z	Functionsz#eeaa77ZDataz#55aa55rrWZAuthorrUZCredits)6r%�__all__r�rrr r
r!rr��urllib�parseZquoter$r}rc�strrXrr�rQr��localsrrAr*r+�	getmodulerfrBr&rr�rvr<r,r;�
isfunctionr.r3rr�pkgutil�iter_modulesrRr~rr#rr6�getclasstreer�rWrU)#r>rr(�mod�ignoredrd�partsZlinksrrZ
linkedname�headrr"r$r��versionr�rr�r-ZcdictrHrIrJr'r�r,Zfdict�datar"�modpkgs�importer�ispkgr�	classlistrr�rr��s*


��


$


�

�

 

���
��������zHTMLDoc.docmodulec	s��j}|p|}�j}g}	|	j�G�fdd�d�}
|
��tt����}t|�dkr�����d�|D]}�d��|�j	��qd�d���������fdd�}
����fd	d
�}��������fdd�}�fd
d�t
��D�}i�|D]n\}}}}d|d|�|<}zt�|�}Wntk
�r4YnXz|�|<Wq�t
k
�rXYq�Xq�|�rx|�rr|���n|dd�t|�fdd��\}}�tjk	�r��tjk�r�|}�q\n"��k�r�d}nd����j	�}|d7}t|��|
d||dd��}|
d||dd��}|
d||dd��}|d||dd��}|d||d d��}|d!||d"d��}|gk�spt�|}�q\d#�|	�}	||k�r�d$||f}nd%|||f}|�r�g}|D]}|���|�j	���q�|d&d'�|�}d#}zt���}Wntt
fk
�rd(}YnX|�rFt|�}|�rF|d)k�rF|��|�d*}t��}|�rb||�p^d#}��|�j����}|�o�d+|}��|d,d-|	d.|�S)/z.Produce HTML documentation for a class object.cs eZdZdd�Z�fdd�ZdS)z(HTMLDoc.docclass.<locals>.HorizontalRulecSs
d|_dSru�Zneedoner�rrrr�sz1HTMLDoc.docclass.<locals>.HorizontalRule.__init__cs|jr�d�d|_dS)Nz<hr>
rr[r���pushrr�maybe	sz.HTMLDoc.docclass.<locals>.HorizontalRule.maybeN�r%r&rSr�r^rr\rr�HorizontalRulesr`rz&<dl><dt>Method resolution order:</dt>
z<dd>%s</dd>
�</dl>
cs�t||�\}}|r�����|�|D]d\}}}}zt�|�}Wn&tk
rf���||���YnX���||��������d�q&|S)Nr�rOr^r<�	Exceptionr�r���msgrrM�okr(ro�homeclsrI�r-r,�hr�mdictrQrr]r>rr�spills"�
zHTMLDoc.docclass.<locals>.spillcsJt||�\}}|rF����|�|D]\}}}}���||���q&|Sr��rOr^r�rd�rirQr]r>rr�spilldescriptors+sz*HTMLDoc.docclass.<locals>.spilldescriptorsc
s�t||�\}}|r�����|�|D]�\}}}}��t�|�|��}t|�sXt�|�rft|dd�}	nd}	|	dkr��d|�n0��t|��j	����}	d|	}	�d||	f��d�q&|S)NrVz<dl><dt>%s</dl>
z<dd><tt>%s</tt>z<dl><dt>%s%s</dl>
r)
rOr^r�r<�callablerrjr3rr)
rerrMrfr(rorgrIrJr"rhrr�	spilldata4s(�
z#HTMLDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qS�)re�rf�rqr(rorprIr-rrr�Is
�z$HTMLDoc.docclass.<locals>.<listcomp>r��-rcs|d�kS�NrrrC��	thisclassrrrybrzz"HTMLDoc.docclass.<locals>.<lambda>�defined here�inherited from %sz:<br>
z
Methods %scSs|ddkS�Nr�methodrrCrrrryrrzzClass methods %scSs|ddkS�Nrzclass methodrrCrrrrytrzzStatic methods %scSs|ddkS�Nrz
static methodrrCrrrryvrzzReadonly properties %scSs|ddkS�NrrhrrCrrrryxrzzData descriptors %scSs|ddkS�NrrgrrCrrrryzrzzData and other attributes %scSs|ddkS�NrrVrrCrrrry|rzrz*<a name="%s">class <strong>%s</strong></a>z/<strong>%s</strong> = <a name="%s">class %s</a>�(%s)r4N�()rz<tt>%s<br>&nbsp;</tt>z#000000z#ffc8d8r1)r%rBr
rr�getmror r^rr&rir<rcr}�popleftrO�builtinsrr��AssertionErrorr!�	signature�
ValueErrorrJr�rr3rr)r>rr(rQr,r-rR�realnamer;rr`�mrorJrkrnrprrHrorgrI�anchor�	inherited�tagrr<�declr��argspecr"r)	r-r,rirjrQrr]r>rwrr��s�
�
	
�

�

�
�
�
�
�
�

��
zHTMLDoc.docclasscCs|�d|�|��S�z)Format an argument default value as text.�=)rr�r�rrr�formatvalue�szHTMLDoc.formatvaluec	Cs�|j}|p|}|r|jpdd|}	d}
d}t|�r�|jj}|rZ||k	r�d|�||�}
n0|jdk	rzd|�|jj|�}
nd|�||�}
t�|�s�t�|�r�d}
nd}
||kr�d	|	|f}nD|r�t�||g�|kr�d
|jd||f}d}n|}d|	||f}d}t�	|��rlzt�
|�}Wnttfk
�r>d}YnX|�rlt
|�}|d
k�rld|}|dd�}|�svd}|
||�|�|
�o�|�d|
�}|�r�d|S|�t|�|j|||�}|�o�d|}d||fSdS)z;Produce HTML documentation for a function or method object.rrtr� from N� method of %s instance� unbound %s method�async z$<a name="%s"><strong>%s</strong></a>z<a href="#%s">%s</a>rz)<a name="%s"><strong>%s</strong></a> = %s�<lambda>z$<strong>%s</strong> <em>lambda</em> r��(...)z'<font face="helvetica, arial">%s</font>z<dl><dt>%s</dt></dl>
z<dd><tt>%s</tt></dd>z<dl><dt>%s</dt>%s</dl>
)r%r?r9r�rr�iscoroutinefunction�isasyncgenfunction�getattr_staticr,r�r�r}rJr�rr3rr)r>rr(rQr,r-rGrFr�r��note�skipdocs�imclass�asyncqualifierrZreallinkr�r�r�r"rrrr��s|
�
���

��zHTMLDoc.docroutinecCsNg}|j}|r|d|�|�t|�|j�}|r<|d|�|d�d�|�S)z1Produce html documentation for a data descriptor.z!<dl><dt><strong>%s</strong></dt>
z<dd><tt>%s</tt></dd>
rar)r
r3rrr!�r>rr(rQrFrnr]r"rrrr��szHTMLDoc.docdatacGs|rd|pd}||�|�S)z-Produce HTML documentation for a data object.z<strong>%s</strong> = r�r�)r>rr(rQrRZlhsrrrr��szHTMLDoc.docothercCs�g}|dkri}t�|g�D]<\}}}tdd�|D��r:q|�|d|||kf�d||<q|��|�||j�}|�|dd|�S)z2Generate an HTML index for a directory of modules.Ncss*|]"}dt|�kodknVqdS)i�i��N)�ord�rqZchrrr�	<genexpr>�sz HTMLDoc.index.<locals>.<genexpr>rrrArF)rNrO�anyr
r~rr#r)r>rr!rWrXr(rYrrrr�index�s
z
HTMLDoc.index)r)rrNr)r�)N)NN)NNN)NN)N)r%r&rSrVr��_repr_instancer�r�rrrrrrrrrr r#r$r3r6r�r�r�r�r�r�r�r�rrrrr�sH

�

+

y&�
A

rc@s4eZdZdZdd�Zdd�Zdd�ZeZdd	�Zd
S)�TextReprzAClass for safely making a text representation of a Python object.cCs,t�|�d|_|_d|_d|_|_dSr�r�r�rrrr�
s
zTextRepr.__init__cCsTtt|�d�r@dd�t|�j���}t||�r@t||�||�Sttt|��|j	�Sr�)
rcr�r!r%rr<r5r8r�r�r�rrrr�s

zTextRepr.repr1cCsHt||j�}t|�}d|krDdt|dd�krDd|d||dS|S)Nr�r�rr�r)r5r�r�r0r�rrrr�s
zTextRepr.repr_stringcCs4zttt|��|j�WSd|jjYSXdSr�)r5r8r�r�r�r%rrrrr%szTextRepr.repr_instanceN)	r%r&rSrVr�r�r�rrrrrrr�s	r�c@s~eZdZdZe�ZejZdd�Zddd�Zdd�Z	ddd�Z
dd
d�Zddd�Zdd�Z
ddd�Zddd�ZeZddd�Zd	S) �TextDocz'Formatter class for text documentation.cCsd�dd�|D��S)z(Format a string in bold by overstriking.rcss|]}|d|VqdS)�Nrr�rrrr�5szTextDoc.bold.<locals>.<genexpr>)r!r�rrr�bold3szTextDoc.bold�    cs>|sdS�fdd�|�d�D�}|r4|d��|d<d�|�S)z6Indent text by prepending a given prefix to each line.rcsg|]}�|�qSrr�rqr���prefixrrr�:sz"TextDoc.indent.<locals>.<listcomp>rr�)rrr!)r>r/r�r#rr�r�indent7szTextDoc.indentcCs$|�|���}|�|�d|dS)z&Format a section with a given heading.rr)r�rr�)r>rrZclean_contentsrrrr>szTextDoc.sectionNrc
	s�d}|D]�}t|�td�krr|\}}||t|��}|rh||fkrh�fdd�|D�}	|dd�|	�}|d}qt|�tg�kr||�|�||d�}q|S)	zBRender in text a class tree as returned by inspect.getclasstree().rrc3s|]}t|��VqdSr��r))rqr:�r'rrr�Msz%TextDoc.formattree.<locals>.<genexpr>r�r4rr�)r�r)r!r6)
r>r7r'r8r�rr9r:r;r<rr�rr6Es"
�zTextDoc.formattreec	Cs$|j}tt|��\}}|�d||o(d|�}t|dd�}|�|�}|dk	r`||�d|d�}|rt||�d|�}g}	t�|tj�D]<\}
}|dk	s�t�	|�p�||kr�t
|
||�r�|	�|
|f�q�g}t�|tj�D]F\}
}|dk	�st�
|��st�	|�|kr�t
|
||�r�|�|
|f�q�g}
t�|t�D]&\}
}t
|
||��r.|
�|
|f��q.g}t�}t|d��r�t�|j�D]6\}}}|�|�|�r�|�|d	�n
|�|��qx|��||�d
d�|��}g}t�|tj�D]0\}
}|j�|d��r�|
|k�r�|�|
��q�|�r6|��||�d
d�|��}|	�r�dd�|	D�}|�t�|d�|�g}|	D]\}
}|�|�||
|���qd||�dd�|��}|�r�g}|D]\}
}|�|�||
|���q�||�dd�|��}|
�r&g}|
D]"\}
}|�|j||
|dd���q�||�dd�|��}t|d��r�t|j�}|dd�dk�rp|dd�dk�rp|dd���}||�d|�}t|d��r�||�dt|j ��}t|d��r�||�dt|j!��}t|d ��r�||�d!t|j"��}zt�#|�}Wnt$k
�rd"}YnX||�d#|�}|S)$z5Produce text documentation for a given module object.�NAME� - rGNzMODULE REFERENCEa.

The following documentation is automatically generated from the Python
source files.  It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations.  When in doubt, consult the module reference at the
location listed above.
ZDESCRIPTIONrR�
 (package)zPACKAGE CONTENTSrrZ
SUBMODULEScSsg|]\}}|�qSrrrErrrr��sz%TextDoc.docmodule.<locals>.<listcomp>r�CLASSES�	FUNCTIONS�F)r4ZDATArXr>r?r�r@ZVERSIONrQZDATErWZAUTHORrUZCREDITSr�ZFILE)%r%r$rrr<r�rrAr+rLrfr
r,r;r.�setrcrNrOrR�addr~r!r*rar6rPr�r�rJrXrrQrWrUr�r})r>rr(rQZsynop�descrrdr�r-rHrIr,rVrWZ
modpkgs_namesrXr'rYZ
submodulesrZrrUr�rrrr�Us�
	�
��
��
�
$
zTextDoc.docmodulec	sZ�j}|p|}�j}�jfdd�}||kr:d��|�}n��|�d|}|rlt||�}	|dd�|	�}g}
|
j�zt���}Wnt	t
fk
r�d}YnX|r�t|�}|r�|dkrʈ||d	�t��}
|
r�|
d	�t
t����}t|�d
k�r*�d�|D]}�d||���q
�d
�tdd�t���D�tjd�}t|�}d}|�r��d�|d|�D]}�d|��qn||k�r��dt||�d��d
�G�fdd�d�}|�������fdd�}����fdd�}�����fdd�}�fdd�t��D�}|�r&|�r*|���n|dd
�t|�fd d!��\}}�tjk	�rn�tjk�rn|}�qn ��k�r~d"}nd#t��j�}t|��|d$||d%d!��}|d&||d'd!��}|d(||d)d!��}|d*||d+d!��}|d,||d-d!��}|d.||d/d!��}|gk�st�|}�qd	�|
�}
|
�s>|d	S|d	��|
��d0�d	S)1z4Produce text documentation for a given class object.cSs
t||�Sr�r�)r:r�rrr�makename�sz"TextDoc.docclass.<locals>.makename�class z	 = class r�r4Nr�rrzMethod resolution order:r�rcss.|]&}|j�d�s|jdkrt|j�VqdS)r_r�N)r%rar&rJ)rqrprrrr��s
�z#TextDoc.docclass.<locals>.<genexpr>r{r�zBuilt-in subclasses:z    ... and z other subclassescs eZdZdd�Z�fdd�ZdS)z(TextDoc.docclass.<locals>.HorizontalRulecSs
d|_dSrur[r�rrrr��sz1TextDoc.docclass.<locals>.HorizontalRule.__init__cs|jr�d�d|_dS)NzF----------------------------------------------------------------------rr[r�r\rrr^�sz.TextDoc.docclass.<locals>.HorizontalRule.maybeNr_rr\rrr`�sr`c
s�t||�\}}|r~����|�|D]V\}}}}zt�|�}Wn&tk
rf���||���Yq&X���||����q&|Sr�rbrd�rirQrr]r>rrrk�s�zTextDoc.docclass.<locals>.spillcsJt||�\}}|rF����|�|D]\}}}}���||���q&|Sr�rlrdrmrrrnsz*TextDoc.docclass.<locals>.spilldescriptorsc
	s�t||�\}}|r�����|�|D]v\}}}}t|�sDt�|�rNt|�}nd}zt�|�}	Wntk
r~|j|}	YnX��j	|	|�d|d�d�q&|S)Nr�)r4r"r)
rOr^rorrjrr<r��__dict__r�)
rerrMrfr(rorgrIr"rer�rrrps 
�z#TextDoc.docclass.<locals>.spilldatacs,g|]$\}}}}t|�d�r||||f�qSrqrrrsr-rrr�+s
�z$TextDoc.docclass.<locals>.<listcomp>rcs|d�kSrurrCrvrrry4rzz"TextDoc.docclass.<locals>.<lambda>rxryzMethods %s:
cSs|ddkSrzrrCrrrryCrzzClass methods %s:
cSs|ddkSr|rrCrrrryErzzStatic methods %s:
cSs|ddkSr}rrCrrrryGrzzReadonly properties %s:
cSs|ddkSr~rrCrrrryIrzzData descriptors %s:
cSs|ddkSrrrCrrrryKrzzData and other attributes %s:
cSs|ddkSr�rrCrrrryMrzz |  )r%rBr&r��mapr!r
rr�r�r}rJrrr�r �sortedr��__subclasses__r�rir�rOr�rr)r�r�r�r)r>rr(rQrRr�r;r�rr<rr�r�r"r�rJZ
subclassesZno_of_subclassesZMAX_SUBCLASSES_TO_DISPLAYZsubclassnamer`rkrnrprr�r�r)rirQrr]r>rwrr��s�

�

��	
�

�

�
�
�
�
�
�
zTextDoc.docclasscCsd|�|�Sr�r�r�rrrr�WszTextDoc.formatvaluec	Cs�|j}|p|}d}d}t|�rn|jj}|rB||k	rndt||�}n,|jdk	r`dt|jj|�}ndt||�}t�|�s�t�|�r�d}	nd}	||kr�|�|�}
n,|r�t�	||g�|kr�d}|�|�d	|}
d}t�
|��r<zt�|�}Wntt
fk
�rd}YnX|�r<t|�}|d
k�r<|�|�d}
|dd�}|�sFd
}|	|
||}
|�rd|
dSt|��ppd}|
d|�o�|�|���dSdS)z;Produce text documentation for a function or method object.rrr�Nr�r�r�r� = r�z lambda r�r�r)r%r?r9r�r)rr�r�r�r�r,r�r�r}rJrr�r)r>rr(rQrFr�r�r�r�r�rr�r�r�r"rrrr�[sV
�
�

zTextDoc.docroutinecCsTg}|j}|r$||�|��|d�t|�p.d}|rJ||�|��|d�d�|�S)z1Produce text documentation for a data descriptor.rr)r
r�rr�r!r�rrrr��szTextDoc.docdatac
Cs�|�|�}|rF|r|dpd|}|t|�}	|	dkrF|d|	�d}|rX|�|�dpZd|}|dk	r~|d|�t|��7}|S)z-Produce text documentation for a data object.r�rrNr2r)r�r r�r�rJ)
r>rr(rQr8r4r"r�r�Zchoprrrr��s
zTextDoc.docother)r�)Nr)NN)NN)NNN)NNN)NNNNN)r%r&rSrVr�r�r�r�r�rr6r�r�r�r�r�r�r�rrrrr�+s


e

7
r�c@seZdZdZdd�ZdS)�
_PlainTextDocz2Subclass of TextDoc which overrides string stylingcCs|Sr�rr�rrrr��sz_PlainTextDoc.boldN)r%r&rSrVr�rrrrr��sr�cCst�at|�dS)zCThe first time this is called, determine what kind of pager to use.N)�getpager�pagerr7rrrr��sr�c	s@ttjd�stSttjd�s tStj��r4tj��s8tStj�d�pNtj�d���r�tj	dkrj�fdd�Stj�d�dkr��fd	d�S�fd
d�Stj�d�dkr�tStj	dkr�dd�Sttd�r�t�
d
�dkr�dd�Sddl}|��\}}t�
|�z8ttd��r$t�
d|�dk�r$dd�W�StW�SW5t�|�XdS)z2Decide what method to use for paging through text.�isattyZMANPAGERZPAGER�win32cstt|���Sr���
tempfilepager�plainr7�Z	use_pagerrrry�rzzgetpager.<locals>.<lambda>ZTERM)ZdumbZemacscstt|���Sr�)�	pipepagerr�r7r�rrry�rzcs
t|��Sr��r�r7r�rrry�rzcSstt|�d�S)Nzmore <r�r7rrrry�rz�systemz(less) 2>/dev/nullrcSs
t|d�S)NZlessr�r7rrrry�rzNz	more "%s"cSs
t|d�S)NZmorer�r7rrrry�rz)rcr�stdin�
plainpager�stdoutr�r	r�rv�platformr��tempfileZmkstemp�close�unlink�ttypager)r��fdr�rr�rr��s6


 r�cCst�dd|�S)z%Remove boldface formatting from text.z.r)rrr7rrrr��sr�c	Cs�ddl}|j|d|jd�}zDtj|jdd��*}z|�|�Wntk
rPYnXW5QRXWntk
rrYnXz|�	�Wq�Wqttk
r�YqtXqtdS)z3Page through text by feeding it to another program.rNT)�shellr��backslashreplace)�errors)
�
subprocess�Popen�PIPE�io�
TextIOWrapperr��write�KeyboardInterruptr��wait)r/�cmdr��proc�piperrrr��sr�c
Cs~ddl}|���d}tj�|d�}t|ddtjdkr<t�d�ndd��}|�	|�W5QRXt�
|d|d	�W5QRXdS)
z<Page through text by invoking a program on a temporary file.rNz	pydoc.out�wr�r�)r��encodingz "r%)r�ZTemporaryDirectoryr	rr!r�rr��device_encodingr�r�)r/r�r�Ztempdirr�r�rrrr��s
��r�cCs$ttjdd�pd}|�|d��|�S)Nr��utf-8r�)r<rr��encode�decode)r/r�rrr�_escape_stdoutsr�c
Cs�tt|���d�}z2ddl}tj��}|�|�}|�|�dd�}Wn(t	t
tjfk
rld}dd�}YnX�z0zttj�dd��}Wntk
r�d}YnX|dkr�d	}|d}}tj�d�|d|��d�||d��r�tj�d
�tj��|�}	|	dk�rtj�d��q�n,|	d
k�rJtj�d||d�|d}q�|	dk�rn|||}|dk�rnd}tj�dd�||||��d�||}q�W5|�r�|�
||j|�XdS)z%Page through text on a text terminal.rrNcSstj�d�Sr@)rr�r�rrrrryrzzttypager.<locals>.<lambda>cSstj��dd�dd�S)Nr�r)rr�r�rrrrryrzZLINESr�z
-- more --)�q�Qz
          
)�
r)�b�B�)r�r�r�ttyrr��filenoZ	tcgetattrZ	setcbreakr�r�r��UnsupportedOperationZ	tcsetattrZ	TCSAFLUSHr+r	r�rvr�r�r�r!�flush)
r/r#r�r��oldZgetchar�hr�Zincr:rrrr�	sL








&r�cCstj�tt|���dS)z>Simply print unformatted text.  This is the ultimate fallback.N)rr�r�r�r�r7rrrr�5sr�cCs�t�|�r>|jtjkr d|jSt|d�r4d|jSd|jSt�|�rRd|jSt�|�rtd|jj	|jj|jfSt�
|�r�d|jj	|jj|jfSt�|�r�d|jSt�|�r�d	|jSt�
|�r�d
|jSt|�jS)z/Produce a short description of the given thing.zbuilt-in module rRzpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%sr�z	function zmethod )rr*r%rr�rcr;Zisgetsetdescriptor�__objclass__r&Zismemberdescriptorr+rMr:r�)�thingrrr�describe9s6







�
�





r�c	Cs�dd�|�d�D�}d\}}|t|�kr\td�|d|d��|�}|r\||d}}qq\q|rf|}nt}||d�D],}zt||�}Wqvtk
r�YdSXqv|S)z@Locate an object by name or dotted path, importing as necessary.cSsg|]}|r|�qSrr)rqr�rrrr�Vszlocate.<locals>.<listcomp>rruNr)rr r�r!r�r<r�)rr�rSr��nZ
nextmodulerr�rrr�locateTs r�cCsVt|t�r0t||�}|dkr(td|��||fSt|dd�}|t|t�rL|ndfSdS)zDGiven an object or a path to an object, get the object and its name.Nz~No Python documentation found for %r.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.r%)rkrJr�r�r<)r�r�rr(rrr�resolvems

�r� Python Library Documentation: %scCs�|dkrt}t||�\}}t|�}t�|�}|rTd|krT|d|d|�d��7}n|rn||k	rn|d|j7}t�|�s�t�|�s�t�	|�s�t�
|�s�t|�}|d7}||d|�||�S)zBRender text documentation, given an object or a path to an object.Nrz in z in module z objectr)
r/rr�rrL�rfindr%r*r+r,rjr�r�)r�rr�Zrendererrr(r�r�rrr�
render_doc{s&

���rc
Csfz2|dkrtt|||��n|�t|||t��Wn.ttfk
r`}zt|�W5d}~XYnXdS)zCDisplay text documentation, given an object or a path to an object.N)r�rr��	plaintextr�r��print)r�rr��outputrIrrrr"�sr"c
Cs�z`t||�\}}t�t|�t�||��}t|dddd��}|�|�W5QRXtd|d�Wn.tt	fk
r�}zt|�W5d}~XYnXdS)z<Write HTML documentation to a file in the current directory.r�r�r�)r�ZwroteN)
r�htmlrr�r�r�r�rr�r�)r�r�rr(rr�rIrrr�writedoc�srrcCs2|dkri}t�|g|�D]\}}}t|�qdS)zAWrite out HTML documentation for all modules in a directory tree.N)rN�
walk_packagesr)r�pkgpathZdonerXr'rYrrr�	writedocs�s

rcJ@s"eZdZddddddddddd	d
ddd
ddddddddddddddddddddd�#Zd d!�d"D�Zd�e�d'd(d)d*d+d,d-�Zd.d/d0d1d2d3d4d5d6d7d8d9d9d:d:d;�Ze��D]:\ZZ	e	D],Z
e�e
e�Zeekr�ed<eZeee
<q�q�d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdLdMdNdOdPdQddRdSdSdTdUdVdWdXdYdZd[d\d]d^d_d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{ddd|d}d~dd��IZd�d�d��Z
ed�d���Zed�d���Zd�d��Ze�Zefd�d��Zd�d��Zd�d��Zd�d��Zd�d��Zd�d�d��Zd�d��Zd�d��Zd�d��Zd�d�d��Zd�d�d��Zd�d��Zd�d�d��Z d�S)��Helperr�BOOLEAN�with)�assertr)�asyncr)�awaitr)�break�	while for)�classzCLASSES SPECIALMETHODS)�continuer)Zfunctionr)�del�BASICMETHODS�if)�elser�try)�forzbreak continue while�import)�globalznonlocal NAMESPACES)r�
TRUTHVALUE)r�MODULES)�in�SEQUENCEMETHODS�
COMPARISON)�lambdar�)�nonlocalzglobal NAMESPACES)�passr)�raise�
EXCEPTIONS)�returnr�)rr')�whilezbreak continue if TRUTHVALUE)rz CONTEXTMANAGERS EXCEPTIONS yield)�yieldr)#�False�None�True�and�asrrrrrr�defr�elifr�except�finallyr�fromrrrr �isr#r$�not�orr%r&r(rr)rr*cCsg|]}dD]}||�qqS)��'r%r)rq�pr�rrrr��szHelper.<listcomp>)r��fr��ur9�'''r%r�)�+rt�*�**r�z//�%�<<�>>r��|�^�~r�r��<=�>=�==�!=�<>)r�r�rGrHrIrJrK)rtrF)z+=z-=z*=z/=z%=z&=z|=z^=z<<=z>>=z**=z//=)rBrCr�rDrErF)�j�J)�STRINGS�	OPERATORSr"�UNARY�AUGMENTEDASSIGNMENT�BITWISE�COMPLEXzOPERATORS FORMATTING�POWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTS�ELLIPSISzSLICINGS DICTIONARYLITERALSz	def classrN�PRIVATENAMESzPRIVATENAMES SPECIALMETHODSZ
BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)rAr@�,rr2�:�@r�r_r^�`r&r5�[�]r�)�typeszRSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect)�stringsz4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES)zstring-methodszSTRINGS FORMATTING)Z
formatstringsrO)r^z:encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPES)ZnumberszINTEGER FLOAT COMPLEX TYPES)Zintegersz	int range)Zfloatingz
float math)Z	imaginaryz
complex cmath)Ztypesseqz$STRINGMETHODS FORMATTING range LISTS�DICTIONARIES)Ztypesfunctionsz	def TYPES)Ztypesmethodszclass def CLASSES TYPES)zbltin-code-objectszcompile FUNCTIONS TYPES)zbltin-type-objectsztypes TYPES�TYPES)zbltin-null-objectr)zbltin-ellipsis-object�SLICINGS)Zspecialattrsr)r]z!class SPECIALMETHODS PRIVATENAMES)Ztypesmodulesr)zoperator-summaryz�lambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIES�EXPRESSIONS)Zobjectsr`)ZspecialnameszbBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES)Z
customizationzhash repr str SPECIALMETHODS)zattribute-accesszATTRIBUTES SPECIALMETHODS)zcallable-typeszCALLS SPECIALMETHODS)�sequence-typesz(SEQUENCES SEQUENCEMETHODS SPECIALMETHODS)rczMAPPINGS SPECIALMETHODS)z
numeric-typesz*NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS)Z	execmodelz%NAMESPACES DYNAMICFEATURES EXCEPTIONS)Znamingz3global nonlocal ASSIGNMENT DELETION DYNAMICFEATURES)zdynamic-featuresr�
NAMESPACES)r�ztry except finally raise)Zconversionsr)Zidentifierszkeywords SPECIALIDENTIFIERS)z
id-classesr)zatom-identifiersr)z
atom-literalsz=STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS�	SEQUENCES)Z	exprlistszTUPLES LITERALS)ztypesseq-mutable�LISTLITERALS)ZlistszLISTS LITERALS)Ztypesmapping�DICTIONARYLITERALS)rzDICTIONARIES LITERALS)zattribute-referencesz(getattr hasattr setattr ATTRIBUTEMETHODS)Z
subscriptionsr!)Zslicingsr!)Zcallsrb)Zpowerrb)Zunaryrb)Zbinaryrb)Zshiftingrb)Zbitwiserb)ZcomparisonszEXPRESSIONS BASICMETHODS)ZbooleanszEXPRESSIONS TRUTHVALUEr)Z
assignmentrQ)Z	augassign�
NUMBERMETHODSrr()Zcompoundzfor while break continue)�truthz if while and or not BASICMETHODS)ZdebuggerZpdb)zcontext-managersr)Ir`rNZ
STRINGMETHODSZ
FORMATTING�UNICODEZNUMBERSZINTEGERZFLOATrSreZMAPPINGSr�ZMETHODSZCODEOBJECTSZTYPEOBJECTSZFRAMEOBJECTSZ
TRACEBACKSZNONErUZSPECIALATTRIBUTESr�rZPACKAGESrbrOZ
PRECEDENCEZOBJECTSZSPECIALMETHODSrZATTRIBUTEMETHODSZCALLABLEMETHODSr!ZMAPPINGMETHODSrhZ	EXECUTIONrdZDYNAMICFEATURESZSCOPINGZFRAMESr'ZCONVERSIONSZIDENTIFIERSZSPECIALIDENTIFIERSrVZLITERALSZTUPLESZ
TUPLELITERALSZLISTSrfr_rgZ
ATTRIBUTESZ
SUBSCRIPTSraZCALLSrTrPZBINARYZSHIFTINGrRr"r
Z	ASSERTIONZ
ASSIGNMENTrQZDELETIONZ	RETURNINGZ	IMPORTINGZCONDITIONALZLOOPINGrZ	DEBUGGINGZCONTEXTMANAGERSNcCs||_||_dSr�)�_input�_output)r>�inputrrrrr�^szHelper.__init__cCs|jp
tjSr�)rkrr�r�rrrrmbszHelper.inputcCs|jp
tjSr�)rlrr�r�rrrrfsz
Helper.outputcCs2t��dddkr|�dSd|jj|jjfS)Nrr1�?rz<%s.%s instance>)r�stackr�r&rSr�rrr�__repr__js�zHelper.__repr__cCs6||jk	r|�|�n|��|��|j�d�dS)Na
You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type "help(object)".  Executing "help('string')"
has the same effect as typing a particular string at the help> prompt.
)�_GoInteractiver�intro�interactrr��r>Zrequestrrr�__call__rs

zHelper.__call__c	Cs�|j�d�z|�d�}|s Wq�Wnttfk
r>Yq�YnX|��}t|�dkr�|d|dkrpdkr�nn |d|dd�kr�|dd�}|��dkr�q�|d	kr�|��q|�	|�qdS)
Nrzhelp> rrr�r8r)r��quitr)
rr��getliner��EOFErrorrr r�rrrrtrrrrss"

,�
zHelper.interactcCs8|jtjkrt|�S|j�|�|j��|j��SdS)z.Read one line, using input() when appropriate.N)rmrr�rr�r�r�)r>�promptrrrrw�s

zHelper.getlinecCs<t|�td�k�r|��}|dkr,|��n�|dkr>|��n�|dkrP|��n�|dkrb|��n�|dd�dkr�|�|��d�n�||jkr�|�|�nj|d	kr�t	t
|�d
�nR||jkr�|�|�n<||j
kr�|�|�n&|r�t	|d
|jd�nt	td
|jd�n$t|t��r|�nt	|d
|jd�|j�d�dS)
Nr�keywords�symbols�topicsr��zmodules r)r-r+r,zHelp on %s:)rr)r�r�listkeywords�listsymbols�
listtopics�listmodulesrr{�
showsymbolr"�evalrz�	showtopicr|rlrJrkrrr�rtrrrr�s6






zHelper.helpcCs$|j�d�dtjdd���dS)Na�
Welcome to Python {0}'s help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/{0}/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".
z%d.%dr)rr�rrr�r�rrrrr�s
�zHelper.intror��Pc	
Cs�tt|��}||}t|�|d|}t|�D]v}t|�D]\}|||}|t|�kr<|j�||�||dkr<|j�dd|dt||��q<|j�d�q0dS)Nrr�r)rr�r rrr�)	r>�items�columnsr
Zcolwr�rowrrrrrrr�s&zHelper.listcCs |j�d�|�|j���dS)NzN
Here is a list of the Python keywords.  Enter any keyword to get more help.

)rr�rrzrEr�rrrr~�szHelper.listkeywordscCs |j�d�|�|j���dS)Nzx
Here is a list of the punctuation symbols which Python assigns special meaning
to. Enter any symbol to get more help.

)rr�rr{rEr�rrrr�szHelper.listsymbolscCs |j�d�|�|j���dS)NzN
Here is a list of available topics.  Enter any topic name to get more help.

)rr�rr|rEr�rrrr��szHelper.listtopicscCs0zddl}Wn"tk
r.|j�d�YdSX|j�||j�|��}|sb|j�dt|��dSt|�td�kr~|�	||�S|\}}z|jj|}Wn*t
k
r�|j�dt|��YdSX|��d}|r�|p�dd|}|�r$ddl}dd�
|���d}	|�|	d	�}
|d
d�
|
�7}t|�dS)Nr�t
Sorry, topic and keyword documentation is not available because the
module "pydoc_data.topics" could not be found.
zno documentation found for %s
rrr��Related help topics: r4�Hz
%s
)�pydoc_data.topicsr�rr�r|rvrzr�r�r��KeyErrorr�textwrapr!rZwrapr�)r>�topic�
more_xrefs�
pydoc_data�target�label�xrefsr"r�r/Zwrapped_textrrrr��s4zHelper.showtopiccCs�zddl}Wntk
r"YdSX|j�||j�|��}|sFtd��t|t�r\|�||�S|\}}|jj|}|r�|pzdd|}||fS)a*Return unbuffered tuple of (topic, xrefs).

        If an error occurs here, the exception is caught and displayed by
        the url handler.

        This function duplicates the showtopic method but returns its
        result directly so it can be formatted for display in an html page.
        rN)r�rzcould not find topicrr�)	r�r�r|rvrzr�rkrJ�	_gettopic)r>r�r�r�r�r�r�r"rrrr�s	
zHelper._gettopiccCs*|j|}|�d�\}}}|�||�dS)Nr�)r{�	partitionr�)r>�symbolr�r�r_r�rrrr�!s
zHelper.showsymbolcsv|r |j�d�|��t|�nR|j�d�i}|fdd���fdd�}t�j�|d�|�|���|j�d�dS)	Nzy
Here is a list of modules whose name or summary contains '{}'.
If there are any, enter a module name to get more help.

zI
Please wait a moment while I gather a list of all available modules...

cSs>|r$|dd�dkr$|dd�d}|�d�dkr:d||<dS)N����	.__init__r�rrr)�find)rr'r�r�rrr�callback4sz$Helper.listmodules.<locals>.callbackcs�d|d�dSr�rr��r�rr�onerror9sz#Helper.listmodules.<locals>.onerror�r�z�
Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".
)rr�r�apropos�
ModuleScanner�runrrE)r>rHr�r�rr�rr�&s
�
zHelper.listmodules)r9r=r%r�)NN)r�r�)r)r)r)!r%r&rSrzZ_strprefixesZ_symbols_inverser{r�r�Zsymbols_r�rvr|r�rlrmrrprrqrursrwrrrrr~rr�r�r�r�r�rrrrr�sB�'���W



	


 
rc@seZdZdZddd�ZdS)r�z7An interruptible scanner that searches module synopses.Nc	Cs
|r|��}d|_i}tjD]p}|dkrd||<|dkrF|d|d�qt|�jpRd}|�d�d}|d|}|���|�dkr|d||�qtj	|d�D�]\\}	}}
|jr��q�|dkr�|d|d�q�zt�
|	|�}Wntk
r�Yq�YnX|j}t
|d	��rnz|�|�}
Wn(tk
�r:|�r2||�Yq�YnXtt�|
���pNd}t
|d
��rh|�|�}nd}n`ztj�|�}Wn(tk
�r�|�r�||�Yq�YnX|j�r�|j��dnd}t|dd�}|d|}|���|�dkr�||||�q�|�r|�dS)NF�__main__rrrrr�r��
get_source�get_filenamerY)r�rvrr�r�rVrr�rNr	�	_get_specr�r�rcr�rcr�r��StringIOr�r�r�r�r�r�r<)r>r�rHZ	completerr��seenr'r(r�rXrYr�r��sourcerr�rrrr�Gs`



zModuleScanner.run)NNN)r%r&rSrVr�rrrrr�Dsr�c	CsDdd�}dd�}t���"t�d�t�j|||d�W5QRXdS)zAPrint all the one-line module summaries that contain a substring.cSs6|dd�dkr |dd�d}t||o.d|�dS�Nr�r�r�z- )r�rr'r�rrrr��szapropos.<locals>.callbackcSsdSr�rr�rrrr��szapropos.<locals>.onerror�ignorer�N)�warnings�catch_warnings�filterwarningsr�r�)rHr�r�rrrr��s


r�cs�ddl�ddl�ddl�ddl�Gdd�d�jj��G�fdd�d�jj��G�����fdd�d�j�}||||�}|��|j	s�|j
s�t�d	�q~|S)
aAStart an HTTP server thread on a specific port.

    Start an HTML/text server thread, so HTML or text documents can be
    browsed dynamically and interactively with a Web browser.  Example use:

        >>> import time
        >>> import pydoc

        Define a URL handler.  To determine what the client is asking
        for, check the URL and content_type.

        Then get or generate some text or HTML code and return it.

        >>> def my_url_handler(url, content_type):
        ...     text = 'the URL sent was: (%s, %s)' % (url, content_type)
        ...     return text

        Start server thread on port 0.
        If you use port 0, the server will pick a random port number.
        You can then use serverthread.port to get the port number.

        >>> port = 0
        >>> serverthread = pydoc._start_server(my_url_handler, port)

        Check that the server is really started.  If it is, open browser
        and get first page.  Use serverthread.url as the starting page.

        >>> if serverthread.serving:
        ...    import webbrowser

        The next two lines are commented out so a browser doesn't open if
        doctest is run on this module.

        #...    webbrowser.open(serverthread.url)
        #True

        Let the server do its thing. We just need to monitor its status.
        Use time.sleep so the loop doesn't hog the CPU.

        >>> starttime = time.monotonic()
        >>> timeout = 1                    #seconds

        This is a short timeout for testing purposes.

        >>> while serverthread.serving:
        ...     time.sleep(.01)
        ...     if serverthread.serving and time.monotonic() - starttime > timeout:
        ...          serverthread.stop()
        ...          break

        Print any errors that may have occurred.

        >>> print(serverthread.error)
        None
   rNc@seZdZdd�Zdd�ZdS)z!_start_server.<locals>.DocHandlercSsX|j�d�rd}nd}|�d�|�dd|�|��|j�|�|j|��d��dS)	z�Process a request from an HTML browser.

            The URL received is in self.path.
            Get an HTML page from self.urlhandler and send it.
            z.css�text/css�	text/html��zContent-Typez%s; charset=UTF-8r�N)	rrbZ
send_responseZsend_headerZend_headersZwfiler��
urlhandlerr�)r>�content_typerrr�do_GET�s

��z(_start_server.<locals>.DocHandler.do_GETcWsdSr�r)r>r�rrr�log_message�sz-_start_server.<locals>.DocHandler.log_messageN)r%r&rSr�r�rrrr�
DocHandler�sr�cs(eZdZdd�Z�fdd�Zdd�ZdS)z _start_server.<locals>.DocServercSs6||_|j|f|_||_|j�||j|j�d|_dS�NF)�hostZaddressr�rJr��handlerrv)r>r��portr�rrrr��s
z)_start_server.<locals>.DocServer.__init__cs>|js2��|j��gggd�\}}}|r|��q|��dSr@)rv�selectZsocketr�Zhandle_requestZserver_close)r>ZrdZwrZex�r�rr�serve_until_quit�s

z1_start_server.<locals>.DocServer.serve_until_quitcSs |j�|�|jr|�|�dSr�)rJ�server_activater�r�rrrr��sz0_start_server.<locals>.DocServer.server_activateN)r%r&rSr�r�r�rr�rr�	DocServer�sr�cs:eZdZ�fdd�Z����fdd�Zdd�Zdd�Zd	S)
z#_start_server.<locals>.ServerThreadcs2||_||_t|�|_�j�|�d|_d|_dSr�)r�r�r+r��Threadr��serving�error)r>r�r�r�)�	threadingrrr��s
z,_start_server.<locals>.ServerThread.__init__c
sxzJ�jj�_��_�jj�_t|j��_�|j	|j
|j�}||_|�
�Wn(tk
rr}z
||_W5d}~XYnXdS)zStart the server.N)�server�
HTTPServerrJr�r�ZMessageZMessageClass�staticmethodr�r�r��ready�	docserverr�rcr�)r>Zdocsvr�e)r�r��email�httprrr�	s

z'_start_server.<locals>.ServerThread.runcSs,d|_|j|_|j|_d|j|jf|_dS)NTz
http://%s:%d/)r�r�Zserver_portr�r")r>r�rrrr�	sz)_start_server.<locals>.ServerThread.readycSs&d|j_|��d|_d|_d|_dS)z&Stop the server and this thread nicelyTNF)r�rvr!r�r"r�rrr�stop	s
z(_start_server.<locals>.ServerThread.stopN)r%r&rSr�r�r�r�r)r�r�r�r�r�rr�ServerThread�s
r�g{�G�z�?)
Zhttp.serverZ
email.messager�r�r�ZBaseHTTPRequestHandlerr�r�r1r�r��time�sleep)r��hostnamer�r��threadr)r�r�r�r�r�r�r�
_start_server�s8'r�r�c
s(G�fdd�dt�}|���fdd���fdd���fdd���fd	d
���fdd���fd
d���fdd���fdd����������fdd�}|�d�r�|dd�}|dk�rtj�tj�t��}tj�||�}t|��}d�|�	��W5QR�SQRXn|dk�r||�St
d||f��dS)aThe pydoc url handler for use with the pydoc server.

    If the content_type is 'text/css', the _pydoc.css style
    sheet is read and returned if it exits.

    If the content_type is 'text/html', then the result of
    get_html_page(url) is returned.
    cseZdZ�fdd�ZdS)z_url_handler.<locals>._HTMLDoccsd}d|}d||��|fS)rzpydoc_data/_pydoc.cssz1<link rel="stylesheet" type="text/css" href="%s">a<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Pydoc: %s</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
%s</head><body bgcolor="#f0f0f8">%s<div style="clear:both;padding-top:.5em;">%s</div>
</body></html>r)r>rr�css_pathZcss_link��html_navbarrrr2	s���z#_url_handler.<locals>._HTMLDoc.pageN)r%r&rSrrr�rr�_HTMLDoc0	sr�cs>��dt��t��dt��f�}d|��tjdd��fS)Nz%s [%s, %s]raZ
            <div style='float:left'>
                Python %s<br>%s
            </div>
            <div style='float:right'>
                <div style='text-align:center'>
                  <a href="index.html">Module Index</a>
                  : <a href="topics.html">Topics</a>
                  : <a href="keywords.html">Keywords</a>
                </div>
                <div>
                    <form action="get" style='display:inline;'>
                      <input type=text name=key size=15>
                      <input type=submit value="Get">
                    </form>&nbsp;
                    <form action="search" style='display:inline;'>
                      <input type=text name=key size=15>
                      <input type=submit value="Search">
                    </form>
                </div>
            </div>
            T)Zterse)r�r�Zpython_versionZpython_buildZpython_compiler)rU�rrrr�B	s
��z!_url_handler.<locals>.html_navbarcs�dd�}��ddd�}dd�tjD�}��||�}|d��d	dd
|�g}i}tjD]}|���||��qT|�d�dd
�|�fS)zModule Index page.cSsd||fS�Nrr�r(rrr�	bltinlink`	sz3_url_handler.<locals>.html_index.<locals>.bltinlinkz7<big><big><strong>Index of Modules</strong></big></big>rArBcSsg|]}|dkr|�qS)r�r)rqr(rrrr�f	s�z4_url_handler.<locals>.html_index.<locals>.<listcomp>z<p>zBuilt-in ModulesrFz|<p align=right><font color="#909090" face="helvetica,arial"><strong>pydoc</strong> by Ka-Ping Yee&lt;ping@lfw.org&gt;</font>zIndex of Modulesr)	rrr�rrrr
r�r!)r�r�namesrr�rr�rr�
html_index]	s*��
�z _url_handler.<locals>.html_indexc		s�g��fdd�}t���*t�d�dd�}t�j|||d�W5QRXdd�}g}��d	d
d�}�D]\}}|�||�|�qf|��d|d
d
d�|��}d|fS)zSearch results page.cs:|dd�dkr |dd�d}��||o0d|f�dSr�rKr��Z
search_resultrrr�{	sz3_url_handler.<locals>.html_search.<locals>.callbackr�cSsdSr�rr�rrrr��	sz2_url_handler.<locals>.html_search.<locals>.onerrorr�cSsd||fSr�rr�rrrr��	sz4_url_handler.<locals>.html_search.<locals>.bltinlinkz5<big><big><strong>Search Results</strong></big></big>rArBzkey = %srF�<br>zSearch Results)	r�r�r�r�r�rr
rr!)	rHr�r�r�rnrr(r�rr�r�r�html_searchv	s,

��z!_url_handler.<locals>.html_searchcsLdd�}��ddd�}ttj���}��||�}|��ddd|�}d|fS)zIndex of topic texts available.cSsd||fS�Nz<a href="topic?key=%s">%s</a>rr�rrrr��	sz4_url_handler.<locals>.html_topics.<locals>.bltinlink�,<big><big><strong>INDEX</strong></big></big>rArBZTopicsrF)rr�rr|rErr)r�rr�rr�rr�html_topics�	s��z!_url_handler.<locals>.html_topicscsL��ddd�}ttj���}dd�}��||�}|��ddd|�}d|fS)zIndex of keywords.r�rArBcSsd||fSr�rr�rrrr��	sz6_url_handler.<locals>.html_keywords.<locals>.bltinlinkZKeywordsrF)rr�rrzrErr)rr�r�rr�rr�
html_keywords�	s��z#_url_handler.<locals>.html_keywordscs�t��}t||�}|�|�\}}||jkr0d}nd}��d|dd�}d��|�}��|dd|�}|r�t|�	��}dd	�}��
||�}��d
dd|�}d||fd�|||f�fS)
zTopic or keyword help page.ZKEYWORDZTOPICr=rArBz
<pre>%s</pre>rFcSsd||fSr�rr�rrrr��	sz7_url_handler.<locals>.html_topicpage.<locals>.bltinlinkr�z%s %sr)
r�r�rr�rzrr3rr�rrrr!)r�ZbufZhtmlhelprr�rrr�r�rr�html_topicpage�	s2

��
�z$_url_handler.<locals>.html_topicpagecs@t|dd�}|dkr$|dkr$td��t|�}��||�}||fS)Nr)r�r,zcould not find object)r�r�r�r�)r"rer�contentr�rr�html_getobj�	sz!_url_handler.<locals>.html_getobjcsP��ddd�}d��fdd�tt|�|�D��}|��|dd|�}d||fS)	Nz,<big><big><strong>Error</strong></big></big>rArBr�c3s|]}��|�VqdSr�)r�r�r�rrr��	sz3_url_handler.<locals>.html_error.<locals>.<genexpr>z#bb0000z
Error - %s)rr!rr�r)r"r�rrr�rr�
html_error�	s���z _url_handler.<locals>.html_errorc
sr|}|�d�r|dd�}�z|dkr2��\}}n�|dkrF��\}}n�|dkrZ��\}}n�d|k�r$|�d�\}}}|dkr��|�\}}n�|d	kr�z�|�\}}Wn tk
r��|�\}}YnXn\|d
k�r|dkr��\}}n4z�|�\}}Wn"tk
�r�|�\}}YnXntd��n�|�\}}Wn2tk
�rd}z�||�\}}W5d}~XYnX��||�S)zGenerate an HTML page for url.r�N���)rr�r|rzr�z
search?keyz	topic?keyzget?keyz
bad pydoc url)rbr�r�rcr)r"Zcomplete_urlrr��opr_r�)rr�r�r�r�r�r�r�rr�
get_html_page�	s>



 z#_url_handler.<locals>.get_html_pager�rNr�rr�z"unknown content type %r for url %s)rrar	r�dirname�realpathrYr!r��	readlinesr})r"r�r�r�Z	path_herer��fpr)	rr�r�r�r�r�r�r�r�r�_url_handler'	s*	
(


"
r�T�	localhost)�open_browserr�c	Cs�ddl}tt||�}|jr(t|j�dS|jr�d}|rB|�|j�z~zZtd|j�t|�|jr�t	d�}|�
�}|dkr|q�qZ|dkr�|�|j�qZt|�qZWnttfk
r�t�YnXW5|jr�|��td�XdS)	z�Start the enhanced pydoc Web server and open a Web browser.

    Use port '0' to start the server on an arbitrary port.
    Set open_browser to False to suppress opening a browser.
    rNz"Server commands: [b]rowser, [q]uitzServer stoppedzServer ready atzserver> r�r�)
�
webbrowserr�r�r�rr�r�r"r�rmr�r�rx)r�r�r�r�ZserverthreadZserver_help_msgr�rrr�browse
s2
r�cCst|t�o|�tj�dkSru)rkrJr�r	�sep)rNrrr�ispath9
sr�cCsvd|kstj|kst��|kr"dStj�t�}tj�|�}|��}||krbtj�||�sb|�|�|�	dt���|S)z�Ensures current directory is on returned path, and argv0 directory is not

    Exception: argv0 dir is left alone if it's also pydoc's directory.

    Returns a new path entry list, or None if no adjustment is needed.
    rNr)
r	�curdir�getcwdrr�rY�copy�samefile�remove�insert)Z
given_pathZargv0Z
stdlib_dirZ
script_dir�revised_pathrrr�_get_revised_path<
s

r�cCs,ttjtjd�}|dk	r(|tjdd�<dS)z�Ensures current directory is on sys.path, and __main__ directory is not.

    Exception: __main__ dir is left alone if it's also pydoc's directory.
    rN)r�rr�argv)r�rrr�_adjust_cli_sys_pathX
sr�cCs�ddl}Gdd�dt�}t��zv|�tjdd�d�\}}d}d}d}d}d}|D]\\}	}
|	d	krld
}d
}|	dkr�t|
�WdS|	dkr�d
}|
}|	d
kr�d
}|	dkrTd
}|
}qT|r�t|||d�WdS|s�|�|D]�}t|��rtj	�
|��std|��q�z`t|��r&tj	�|��r&t
|�}|�rXt|��rNtj	�|��rNt|�nt|�n
t�|�Wq�tk
�r�}zt|�W5d}~XYq�Xq�WnN|j|fk
�r�tj	�tj	�tjd��d}
tdj|
tjd��YnXdS)z@Command-line interface (looks at sys.argv to decide what to do).rNc@seZdZdS)zcli.<locals>.BadUsageN)r%r&rSrrrr�BadUsagee
srrzbk:n:p:wFr�z-bTz-kz-pz-wz-n)r�r�zfile %r does not exista�pydoc - the Python documentation tool

{cmd} <name> ...
    Show text documentation on something.  <name> may be the name of a
    Python keyword, topic, function, module, or package, or a dotted
    reference to a class or function within a module or module in a
    package.  If <name> contains a '{sep}', it is used as the path to a
    Python source file to document. If name is 'keywords', 'topics',
    or 'modules', a listing of these things is displayed.

{cmd} -k <keyword>
    Search for a keyword in the synopsis lines of all available modules.

{cmd} -n <hostname>
    Start an HTTP server with the given hostname (default: localhost).

{cmd} -p <port>
    Start an HTTP server on the given port on the local machine.  Port
    number 0 can be used to get an arbitrary unused port.

{cmd} -b
    Start an HTTP server on an arbitrary unused port and open a Web browser
    to interactively browse documentation.  This option can be used in
    combination with -n and/or -p.

{cmd} -w <name> ...
    Write out the HTML documentation for a module to a file in the current
    directory.  If <name> contains a '{sep}', it is treated as a filename; if
    it names a directory, documentation is written for all the contents.
)r�r�)�getoptrcr�rr�r�r�r�r	r�existsrr�r�rrrrr�r�r�r�rr�)rrZoptsr�ZwritingZstart_serverr�r�r��opt�val�argrIr�rrr�clib
sd

 �rr�)NN)r)r)rrN)rrN)r)rN)r�)r)ZrVrGrWrQrUr�Zimportlib._bootstrapr�Zimportlib._bootstrap_external�importlib.machinery�importlib.utilrr�r	rNr�rrr�r�r�Zurllib.parserHr��collectionsr�reprlibr�	tracebackrrrr$r)r.r0r5r'�
IGNORECASEr6r8r?rDrOrfrir�r�r�r�rcr�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r/rrrrr"rrrrr�r�r�r�r�r�r�r�rr%rrrr�<module>s�&
	


'
0:*> ",

�
�


=
n%
U
difflib.cpython-38.opt-2.pyc000064400000060533150335716500011547 0ustar00U

e5dZH�@s4dddddddddd	d
dgZdd
lmZddlmZedd�Zdd�ZGdd�d�Z	d7dd�Z
dd�ZGdd�d�Zddl
Z
e
�d�jfdd�Zd8dd�Zdd�Zd9d"d�Zd#d$�Zd:d%d�Zd&d'�Zd;d*d	�Zdefd+d�Zddefd,d-�Zd.Zd/Zd0Zd1ZGd2d
�d
e�Z[
d3d�Z d4d5�Z!e"d6k�r0e!�dS)<�get_close_matches�ndiff�restore�SequenceMatcher�Differ�IS_CHARACTER_JUNK�IS_LINE_JUNK�context_diff�unified_diff�
diff_bytes�HtmlDiff�Match�)�nlargest)�
namedtupleza b sizecCs|rd||SdS)Ng@��?�)�matches�lengthrr�/usr/lib64/python3.8/difflib.py�_calculate_ratio&src@speZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
ddd�Zdd�Zdd�Z
dd�ZdS)rN�TcCs(||_d|_|_||_|�||�dS�N)�isjunk�a�b�autojunk�set_seqs)�selfrrrrrrr�__init__�s;zSequenceMatcher.__init__cCs|�|�|�|�dSr)�set_seq1�set_seq2)rrrrrrr�s	
zSequenceMatcher.set_seqscCs$||jkrdS||_d|_|_dSr)r�matching_blocks�opcodes)rrrrrr�s
zSequenceMatcher.set_seq1cCs2||jkrdS||_d|_|_d|_|��dSr)rr!r"�
fullbcount�_SequenceMatcher__chain_b)rrrrrr �s
zSequenceMatcher.set_seq2cCs�|j}i|_}t|�D]\}}|�|g�}|�|�qt�|_}|j}|r~|��D]}||�rV|�	|�qV|D]
}||=qrt�|_
}t|�}	|jr�|	dkr�|	dd}
|�
�D]\}}t|�|
kr�|�	|�q�|D]
}||=q�dS)N���d�)r�b2j�	enumerate�
setdefault�append�set�bjunkr�keys�addZbpopular�lenr�items)rrr(�i�elt�indicesZjunkrZpopular�nZntestZidxsrrrZ	__chain_b)s,
zSequenceMatcher.__chain_bcCs4|j|j|j|jjf\}}}}||d}	}
}i}g}
t||�D]�}|j}i}|�|||
�D]\}||krlq^||krxq�||dd�d}||<||kr^||d||d|}	}
}q^|}q@|	|k�r |
|k�r |||
d��s ||	d||
dk�r |	d|
d|d}	}
}q�|	||k�rt|
||k�rt|||
|��st||	|||
|k�rt|d7}�q |	|k�r�|
|k�r�|||
d��r�||	d||
dk�r�|	d|
d|d}	}
}�qt|	||k�r(|
||k�r(|||
|��r(||	|||
|k�r(|d}�q�t|	|
|�S�Nr
r')rrr(r-�__contains__�range�getr)r�alo�ahi�blo�bhirrr(ZisbjunkZbestiZbestjZbestsizeZj2lenZnothingr2Zj2lengetZnewj2len�j�krrr�find_longest_matchPsR8"����	�� ��z"SequenceMatcher.find_longest_matchcCs||jdk	r|jSt|j�t|j�}}d|d|fg}g}|r�|��\}}}}|�||||�\}	}
}}|r8|�|�||	kr�||
kr�|�||	||
f�|	||kr8|
||kr8|�|	|||
||f�q8|��d}
}}g}|D]V\}}}|
||k�r|||k�r||7}q�|�r,|�|
||f�|||}
}}q�|�rT|�|
||f�|�||df�tt	t
j|��|_|jS�Nr
)r!r0rr�popr@r+�sort�list�mapr�_make)r�la�lbZqueuer!r:r;r<r=r2r>r?�x�i1�j1Zk1Znon_adjacent�i2�j2Zk2rrr�get_matching_blocks�s8


z#SequenceMatcher.get_matching_blockscCs�|jdk	r|jSd}}g|_}|��D]�\}}}d}||krN||krNd}n||kr\d}n||krhd}|r�|�|||||f�||||}}|r*|�d||||f�q*|S)Nr
r�replace�delete�insert�equal)r"rNr+)rr2r>Zanswer�ai�bj�size�tagrrr�get_opcodess$

zSequenceMatcher.get_opcodes�c
csn|��}|sdg}|dddkrZ|d\}}}}}|t|||�|t|||�|f|d<|dddkr�|d\}}}}}||t|||�|t|||�f|d<||}g}	|D]�\}}}}}|dk�r(|||k�r(|	�||t|||�|t|||�f�|	Vg}	t|||�t|||�}}|	�|||||f�q�|	�rjt|	�dk�rd|	dddk�sj|	VdS)N)rRr
r'r
r'r
rR���r')rW�max�minr+r0)
rr5ZcodesrVrJrLrKrMZnn�grouprrr�get_grouped_opcodes<s(&&(&z#SequenceMatcher.get_grouped_opcodescCs0tdd�|��D��}t|t|j�t|j��S)Ncss|]}|dVqdS)rYNr)�.0Ztriplerrr�	<genexpr>�sz(SequenceMatcher.ratio.<locals>.<genexpr>)�sumrNrr0rr)rrrrr�rationszSequenceMatcher.ratiocCs�|jdkr4i|_}|jD]}|�|d�d||<q|j}i}|jd}}|jD]>}||�rf||}n|�|d�}|d||<|dkrP|d}qPt|t|j�t|j��Sr6)r#rr9r7rrr0)rr#r3ZavailZavailhasrZnumbrrr�quick_ratio�s






zSequenceMatcher.quick_ratiocCs*t|j�t|j�}}tt||�||�Sr)r0rrrr[)rrGrHrrr�real_quick_ratio�sz SequenceMatcher.real_quick_ratio)NrrT)rX)�__name__�
__module__�__qualname__rrrr r$r@rNrWr]rarbrcrrrrr+sl
@,'nG7
2rX�333333�?cCs�|dkstd|f��d|kr*dks:ntd|f��g}t�}|�|�|D]D}|�|�|��|krR|��|krR|��|krR|�|��|f�qRt||�}dd�|D�S)Nr
zn must be > 0: %rgrz cutoff must be in [0.0, 1.0]: %rcSsg|]\}}|�qSrr)r^ZscorerIrrr�
<listcomp>�sz%get_close_matches.<locals>.<listcomp>)	�
ValueErrorrr rrcrbrar+�	_nlargest)ZwordZ
possibilitiesr5�cutoff�result�srIrrrr�s"


�
�
cCsd�dd�t||�D��S)Nrcss*|]"\}}|dkr|��r|n|VqdS)� N)�isspace)r^�cZtag_crrrr_�s�z$_keep_original_ws.<locals>.<genexpr>)�join�zip)rmZtag_srrr�_keep_original_ws�s
�rsc@sFeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)rNcCs||_||_dSr��linejunk�charjunk)rrurvrrrrHszDiffer.__init__c
	cs�t|j||�}|��D]�\}}}}}|dkrB|�||||||�}	n\|dkr\|�d|||�}	nB|dkrv|�d|||�}	n(|dkr�|�d|||�}	ntd|f��|	EdHqdS)	NrOrP�-rQ�+rRrn�unknown tag %r)rrurW�_fancy_replace�_dumpri)
rrr�cruncherrVr:r;r<r=�grrr�compare_szDiffer.compareccs&t||�D]}d|||fVq
dS)Nz%s %s)r8)rrVrI�lo�hir2rrrr{�szDiffer._dumpc
csn||||kr2|�d|||�}|�d|||�}n |�d|||�}|�d|||�}||fD]}	|	EdHqZdS)Nrxrw)r{)
rrr:r;rr<r=�first�secondr}rrr�_plain_replace�szDiffer._plain_replaceccs:d\}}t|j�}	d\}
}t||�D]�}||}
|	�|
�t||�D]j}||}||
krl|
dkrD||}
}qD|	�|�|	��|krD|	��|krD|	��|krD|	��||}}}qDq$||kr�|
dkr�|�||||||�EdHdS|
|d}}}nd}
|�	||||||�EdH||||}}|
dk�r
d}}|	�
||�|	��D]�\}}}}}||||}}|dk�r�|d|7}|d|7}nb|dk�r�|d|7}nJ|d	k�r�|d
|7}n2|dk�r�|d|7}|d|7}ntd
|f���qH|�
||||�EdHn
d|V|�	||d|||d|�EdHdS)N)g�G�z��?g�?)NNrrrO�^rPrwrQrxrRrnry�  r')rrvr8r rrcrbrar��
_fancy_helperrrWri�_qformat)rrr:r;rr<r=Z
best_ratiorkr|ZeqiZeqjr>rTr2rSZbest_iZbest_jZaeltZbelt�atags�btagsrVZai1Zai2Zbj1Zbj2rGrHrrrrz�s\




�
�





zDiffer._fancy_replaceccsbg}||kr<||kr*|�||||||�}qT|�d|||�}n||krT|�d|||�}|EdHdS)Nrwrx)rzr{)rrr:r;rr<r=r}rrrr��szDiffer._fancy_helperccsXt||���}t||���}d|V|r8d|�d�Vd|V|rTd|�d�VdS)N�- z? �
�+ )rs�rstrip)rZalineZbliner�r�rrrr�s

zDiffer._qformat)NN)
rdrerfrr~r{r�rzr�r�rrrrr�s^
)^Nz
\s*(?:#\s*)?$cCs||�dk	Srr)�lineZpatrrrr3s� 	cCs||kSrr)ZchZwsrrrrCscCs:|d}||}|dkr"d�|�S|s.|d8}d�||�S�Nr'z{}z{},{}��format��start�stopZ	beginningrrrr�_format_range_unifiedZs
r�rr�ccsPt|||||||�d}td||��|�D�]}	|s|d}|rFd�|�nd}
|rXd�|�nd}d�||
|�Vd�|||�V|	d|	d}}
t|d	|
d
�}t|d|
d�}d
�|||�V|	D]�\}}}}}|dkr�|||�D]}d|Vq�q�|dk�r"|||�D]}d|V�q|dkr�|||�D]}d|V�q6q�q*dS)NFT�	{}r�
--- {}{}{}z
+++ {}{}{}r
rYr'�rX�z@@ -{} +{} @@{}rRrn>rPrOrw>rOrQrx)�_check_typesrr]r�r�)rr�fromfile�tofile�fromfiledate�
tofiledater5�lineterm�startedr\�fromdate�todater��last�file1_range�file2_rangerVrJrLrKrMr�rrrr	es0)
cCsB|d}||}|s|d8}|dkr.d�|�Sd�|||d�Sr�r�r�rrr�_format_range_context�s
r�ccs�t|||||||�tddddd�}d}	td||��|�D�]R}
|	s�d}	|rVd�|�nd	}|rhd�|�nd	}d
�|||�Vd�|||�V|
d|
d
}
}d|Vt|
d|d�}d�||�Vtdd�|
D���r|
D]8\}}}}}|dkr�|||�D]}|||V�qq�t|
d|d�}d�||�Vtdd�|
D��r:|
D]<\}}}}}|dk�rP|||�D]}|||V�qt�qPq:dS)Nr�r�z! r�)rQrPrOrRFTr�rz
*** {}{}{}r�r
rYz***************r'r�z
*** {} ****{}css |]\}}}}}|dkVqdS)>rPrONr�r^rV�_rrrr_�szcontext_diff.<locals>.<genexpr>rQrXr�z
--- {} ----{}css |]\}}}}}|dkVqdS)>rOrQNrr�rrrr_srP)r��dictrr]r�r��any)rrr�r�r�r�r5r��prefixr�r\r�r�r�r�r�rVrJrLr�r�r�rKrMrrrr�s4,

cGs�|r0t|dt�s0tdt|d�j|df��|r`t|dt�s`tdt|d�j|df��|D]}t|t�sdtd|f��qddS)Nr
z)lines to compare must be str, not %s (%r)z"all arguments must be str, not: %r)�
isinstance�str�	TypeError�typerd)rr�args�argrrrr�s��
r���
c		cs~dd�}	tt|	|��}tt|	|��}|	|�}|	|�}|	|�}|	|�}|	|�}|||||||||�}
|
D]}|�dd�VqfdS)Nc
SsRz|�dd�WStk
rL}z dt|�j|f}t|�|�W5d}~XYnXdS)N�ascii�surrogateescapez(all arguments must be bytes, not %s (%r))�decode�AttributeErrorr�rdr�)rm�err�msgrrrr�"s�zdiff_bytes.<locals>.decoder�r�)rDrE�encode)Zdfuncrrr�r�r�r�r5r�r��linesr�rrrr
scCst||��||�Sr)rr~)rrrurvrrrr5s#c#s�ddl}|�d��t||||��ddgf�fdd�	���fdd���fdd�}|�}|dkrj|EdH�n|d	7}d}ddg|}	}
d
}|d
kr�zt|�\}}
}Wntk
r�YdSX|	|}||
|f|
|<|	d	7}	q�|	|kr�dV|}n|	}d}	|�r"|	|}|	d	7}	|
|V|d	8}q�|d	}z@|�rht|�\}}
}|�rP|d	}n|d	8}||
|fV�q,Wqvtk
�r�YdSXqvdS)Nr
z
(\++|\-+|\^+)cs�||d7<|dkr2|||�d�dd�fS|dkr�|�d�|�d�}}g}|fdd�}��||�t|�D]<\}\}	}
|d|	�d|||	|
�d||
d�}qt|dd�}n*|�d�dd�}|s�d	}d||d}|||fS)
Nr'r
r��?cSs&|�|�d�d|��g�|�d�S)Nr'r
)r+r\�span)Zmatch_object�sub_inforrr�record_sub_info�sz3_mdiff.<locals>._make_line.<locals>.record_sub_info��rn)rB�sub�reversed)r�Z
format_key�sideZ	num_lines�textZmarkersr�r��keyZbegin�end)�	change_rerr�
_make_line�s 2z_mdiff.<locals>._make_linec3sng}d\}}t|�dkr*|�t�d��qd�dd�|D��}|�d�rP|}�n�|�d�r|�|dd	��|dd
�dfVq�n�|�d�r�|d
8}�|d
d	�ddfVq�nl|�d�rֈ|d
d	�d}}|d
d	}}�n>|�d��r�|dd	��|dd
�dfVq�n|�d��r0�|dd	��|dd
�dfVqn�|�d
��r\|d
8}�|d
d	�ddfVqn�|�d��r�|d
7}d�|dd
�dfVqn�|�d��r�d�|dd
�}}|d
d	}}n^|�d��r�|d
7}d�|dd
�dfVqn2|�d��r�|dd�dd	��|dd
�dfVq|d	k�r0|d
7}dV�q|d	k�rL|d
8}dV�q0|�d��r\dS||dfVqdS)N)r
r
r��XrcSsg|]}|d�qS)r
r�r^r�rrrrh�sz2_mdiff.<locals>._line_iterator.<locals>.<listcomp>z-?+?r�r
r'Tz--++rw)z--?+z--+r�z-+?z-?+z+--rx)r�z+-rnF)N�rr�T)r�NT)r0r+�nextrq�
startswith)r�Znum_blanks_pendingZnum_blanks_to_yieldrm�	from_line�to_line)r��diff_lines_iteratorrr�_line_iterator�sd



$



z_mdiff.<locals>._line_iteratorc3s���}gg}}t|�dks(t|�dkr�zt|�\}}}Wntk
rPYdSX|dk	rh|�||f�|dk	r|�||f�q|�d�\}}|�d�\}}|||p�|fVqdSrA)r0r��
StopIterationr+rB)Z
line_iterator�	fromlines�tolinesr�r��
found_diffZfromDiffZto_diff)r�rr�_line_pair_iterators

z#_mdiff.<locals>._line_pair_iteratorr'F)NNN)�re�compilerr�r�)r�r��contextrurvr�r�Zline_pair_iteratorZlines_to_write�indexZcontextLinesr�r�r�r2r)r�r�r�r�r�_mdiffZsR"
8X!



r�an
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>
    <meta http-equiv="Content-Type"
          content="text/html; charset=%(charset)s" />
    <title></title>
    <style type="text/css">%(styles)s
    </style>
</head>

<body>
    %(table)s%(legend)s
</body>

</html>aH
        table.diff {font-family:Courier; border:medium;}
        .diff_header {background-color:#e0e0e0}
        td.diff_header {text-align:right}
        .diff_next {background-color:#c0c0c0}
        .diff_add {background-color:#aaffaa}
        .diff_chg {background-color:#ffff77}
        .diff_sub {background-color:#ffaaaa}aZ
    <table class="diff" id="difflib_chg_%(prefix)s_top"
           cellspacing="0" cellpadding="0" rules="groups" >
        <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
        <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
        %(header_row)s
        <tbody>
%(data_rows)s        </tbody>
    </table>a�
    <table class="diff" summary="Legends">
        <tr> <th colspan="2"> Legends </th> </tr>
        <tr> <td> <table border="" summary="Colors">
                      <tr><th> Colors </th> </tr>
                      <tr><td class="diff_add">&nbsp;Added&nbsp;</td></tr>
                      <tr><td class="diff_chg">Changed</td> </tr>
                      <tr><td class="diff_sub">Deleted</td> </tr>
                  </table></td>
             <td> <table border="" summary="Links">
                      <tr><th colspan="2"> Links </th> </tr>
                      <tr><td>(f)irst change</td> </tr>
                      <tr><td>(n)ext change</td> </tr>
                      <tr><td>(t)op</td> </tr>
                  </table></td> </tr>
    </table>c@s�eZdZeZeZeZeZdZdddefdd�Z	dd	d
�dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zddd�ZdS)rr
�NcCs||_||_||_||_dSr)�_tabsize�_wrapcolumn�	_linejunk�	_charjunk)r�tabsizeZ
wrapcolumnrurvrrrr�szHtmlDiff.__init__rF�zutf-8)�charsetcCs:|jt|j|j|j||||||d�|d��|d��|�S)N)r��numlines)ZstylesZlegend�tabler��xmlcharrefreplace)�_file_templater��_styles�_legend�
make_tabler�r�)rr�r��fromdesc�todescr�r�r�rrr�	make_file�s����zHtmlDiff.make_filecs8�fdd���fdd�|D�}�fdd�|D�}||fS)Ncs6|�dd�}|��j�}|�dd�}|�dd��d�S)Nrnr��	r�)rO�
expandtabsr�r�)r�)rrr�expand_tabs�sz2HtmlDiff._tab_newline_replace.<locals>.expand_tabscsg|]}�|��qSrrr��r�rrrh�sz1HtmlDiff._tab_newline_replace.<locals>.<listcomp>csg|]}�|��qSrrr�r�rrrh�sr)rr�r�r)r�rr�_tab_newline_replace�s
	zHtmlDiff._tab_newline_replacecCs|s|�||f�dSt|�}|j}||ksB||�d�d|krT|�||f�dSd}d}d}||kr�||kr�||dkr�|d7}||}|d7}q`||dkr�|d7}d}q`|d7}|d7}q`|d|�}	||d�}
|r�|	d}	d||
}
|�||	f�|�|d|
�dS)Nr�rXr
rr'r��>)r+r0r��count�_split_line)rZ	data_listZline_numr�rUrZr2r5ZmarkZline1Zline2rrrr��s8


zHtmlDiff._split_lineccs�|D]�\}}}|dkr$|||fVq||\}}\}}gg}	}
|�|	||�|�|
||�|	sd|
r|	rt|	�d�}nd}|
r�|
�d�}nd}|||fVq\qdS)Nr
)rrn)r�rB)r�diffs�fromdata�todata�flagZfromlineZfromtextZtolineZtotext�fromlist�tolistrrr�
_line_wrapper0s 
zHtmlDiff._line_wrapperc	Cs�ggg}}}|D]r\}}}z4|�|jd|f|���|�|jd|f|���Wn(tk
rz|�d�|�d�YnX|�|�q|||fSr6)r+�_format_liner�)rr�r�r��flaglistr�r�r�rrr�_collect_linesLs
zHtmlDiff._collect_linescCsrzd|}d|j||f}Wntk
r6d}YnX|�dd��dd��dd	�}|�d
d���}d|||fS)
Nz%dz
 id="%s%s"r�&z&amp;r�z&gt;�<z&lt;rn�&nbsp;z<<td class="diff_header"%s>%s</td><td nowrap="nowrap">%s</td>)�_prefixr�rOr�)rr�r�Zlinenumr��idrrrr�as
�zHtmlDiff._format_linecCs0dtj}dtj}tjd7_||g|_dS)Nzfrom%d_zto%d_r')r�_default_prefixr)rZ
fromprefix�toprefixrrr�_make_prefixxs

zHtmlDiff._make_prefixcCs�|jd}dgt|�}dgt|�}d\}	}
d}t|�D]V\}}
|
r�|
s�d}
|}td||g�}d||	f||<|	d7}	d||	f||<q:d}
q:|s�dg}dg}dg}d}|r�d	g}|}n
d
g}}|ds�d||d<d|||<|||||fS)
Nr'r)r
Fr
Tz id="difflib_chg_%s_%d"z"<a href="#difflib_chg_%s_%d">n</a>Fz2<td></td><td>&nbsp;No Differences Found&nbsp;</td>z(<td></td><td>&nbsp;Empty File&nbsp;</td>z!<a href="#difflib_chg_%s_0">f</a>z#<a href="#difflib_chg_%s_top">t</a>)rr0r)rZ)rr�r�rr�r�r�next_id�	next_hrefZnum_chgZ	in_changer�r2r�rrr�_convert_flags�s>
�
zHtmlDiff._convert_flagsc
CsR|��|�||�\}}|r"|}nd}t||||j|jd�}|jrL|�|�}|�|�\}	}
}|�|	|
|||�\}	}
}}}
g}d}t	t
|��D]P}||dkr�|dkr�|�d�q�|�||
||||	||||
|f�q�|s�|�rddd|dd|f}nd}|jt
d�|�||jd	d
�}|�dd��d
d��dd��dd��dd�S)NrtzV            <tr><td class="diff_next"%s>%s</td>%s<td class="diff_next">%s</td>%s</tr>
r
z)        </tbody>        
        <tbody>
z <thead><tr>%s%s%s%s</tr></thead>z!<th class="diff_next"><br /></th>z+<th colspan="2" class="diff_header">%s</th>rr')Z	data_rows�
header_rowr�z+z<span class="diff_add">z-z<span class="diff_sub">z^z<span class="diff_chg">r�z</span>r�r)r	r�r�r�r�r�r�rrr8r0r+�_table_templater�rqrrO)rr�r�r�r�r�r�Z
context_linesr�r�r�rrr
rmZfmtr2r
r�rrrr��sl�
��

������zHtmlDiff.make_table)rrFr�)rrFr�)rdrerfr�r�rr�rrrr�r�r�r�rr�r	rr�rrrrr�s0�
��7/�ccsnzddd�t|�}Wn"tk
r8td|�d�YnXd|f}|D]"}|dd�|krF|dd�VqFdS)Nr�r�)r'r�z)unknown delta choice (must be 1 or 2): %rr�r�)�int�KeyErrorri)ZdeltaZwhichrV�prefixesr�rrrrs��cCsddl}ddl}|�|�SrA)�doctest�difflibZtestmod)rrrrr�_test!sr�__main__)rXrg)r�)rrrrrXr�)rrrrrXr�)r�r�r�r�rXr�)#�__all__�heapqrrj�collectionsrZ_namedtuplerrrrrsrr�r��matchrrr�r	r�rr�r
rr�r�r�rr��objectrrrrdrrrr�<module>s��


1	I
�
I�
L�
%�
	
a 
bz2.cpython-38.opt-1.pyc000064400000026267150335716500010652 0ustar00U

e5d1�@s�dZddddddgZdZdd	lmZdd
lZdd
lZdd
lZdd
l	Z	ddl
mZddlm
Z
mZdZd
ZdZe�ZGdd�de	j�Zddd�Zddd�Zdd�Zd
S)z�Interface to the libbzip2 compression library.

This module provides a file interface, classes for incremental
(de)compression, and functions for one-shot (de)compression.
�BZ2File�
BZ2Compressor�BZ2Decompressor�open�compress�
decompressz%Nadeem Vawda <nadeem.vawda@gmail.com>�)rN)�RLock)rr��c@s�eZdZdZdedfdd�Zdd�Zedd	��Zd
d�Z	dd
�Z
dd�Zdd�Zd)dd�Z
d*dd�Zd+dd�Zdd�Zd,dd�Zd-dd�Zd d!�Zd"d#�Zejfd$d%�Zd&d'�Zd(S).ra@A file object providing transparent bzip2 (de)compression.

    A BZ2File can act as a wrapper for an existing file object, or refer
    directly to a named file on disk.

    Note that BZ2File provides a *binary* file interface - data read is
    returned as bytes, and data to be written should be given as bytes.
    �r�	cCsTt�|_d|_d|_t|_|tk	r2tjdt	dd�d|krFdksPnt
d��|d	krbd
}t}nb|dkr~d}t}t
|�|_nF|d
kr�d}t}t
|�|_n*|dkr�d}t}t
|�|_nt
d|f��t|tttjf�r�t||�|_d|_||_n.t|d��st|d��r||_||_ntd��|jtk�rJtj|jttd�}t�|�|_nd|_dS)aOOpen a bzip2-compressed file.

        If filename is a str, bytes, or PathLike object, it gives the
        name of the file to be opened. Otherwise, it should be a file
        object, which will be used to read or write the compressed data.

        mode can be 'r' for reading (default), 'w' for (over)writing,
        'x' for creating exclusively, or 'a' for appending. These can
        equivalently be given as 'rb', 'wb', 'xb', and 'ab'.

        buffering is ignored since Python 3.0. Its use is deprecated.

        If mode is 'w', 'x' or 'a', compresslevel can be a number between 1
        and 9 specifying the level of compression: 1 produces the least
        compression, and 9 (default) produces the most compression.

        If mode is 'r', the input file may be the concatenation of
        multiple compressed streams.
        NFzGUse of 'buffering' argument is deprecated and ignored since Python 3.0.�)�
stacklevelr	rz%compresslevel must be between 1 and 9)�r�rbr)�w�wbr)�x�xbr)�a�abr�Invalid mode: %rT�read�writez6filename must be a str, bytes, file or PathLike object)Ztrailing_errorr)r�_lock�_fp�_closefp�_MODE_CLOSED�_mode�	_sentinel�warnings�warn�DeprecationWarning�
ValueError�
_MODE_READ�_MODE_WRITEr�_compressor�
isinstance�str�bytes�os�PathLike�
_builtin_open�hasattr�	TypeError�_compressionZDecompressReaderr�OSError�io�BufferedReader�_buffer�_pos)�self�filename�mode�	buffering�
compresslevelZ	mode_code�raw�r;�/usr/lib64/python3.8/bz2.py�__init__)sT��zBZ2File.__init__cCs�|j��|jtkr W5QR�dSz<|jtkr8|j��n"|jtkrZ|j�	|j
���d|_
W5z|jrp|j��W5d|_d|_t|_d|_XXW5QRXdS)z�Flush and close the file.

        May be called more than once without error. Once the file is
        closed, any other operation on it will raise a ValueError.
        NF)rrrrrr3�closer$r%rr&�flush�r5r;r;r<r>ps 



z
BZ2File.closecCs
|jtkS)zTrue if this file is closed.)rrr@r;r;r<�closed�szBZ2File.closedcCs|��|j��S)z3Return the file descriptor for the underlying file.)�_check_not_closedr�filenor@r;r;r<rC�szBZ2File.filenocCs|��o|j��S)z)Return whether the file supports seeking.)�readabler3�seekabler@r;r;r<rE�szBZ2File.seekablecCs|��|jtkS)z/Return whether the file was opened for reading.)rBrr$r@r;r;r<rD�szBZ2File.readablecCs|��|jtkS)z/Return whether the file was opened for writing.)rBrr%r@r;r;r<�writable�szBZ2File.writablerc
Cs2|j�"|��|j�|�W5QR�SQRXdS)z�Return buffered data without advancing the file position.

        Always returns at least one byte of data, unless at EOF.
        The exact number of bytes returned is unspecified.
        N)r�_check_can_readr3�peek)r5�nr;r;r<rH�szBZ2File.peek���c
Cs2|j�"|��|j�|�W5QR�SQRXdS)z�Read up to size uncompressed bytes from the file.

        If size is negative or omitted, read until EOF is reached.
        Returns b'' if the file is already at EOF.
        N)rrGr3r�r5�sizer;r;r<r�szBZ2File.readc
Cs@|j�0|��|dkrtj}|j�|�W5QR�SQRXdS)z�Read up to size uncompressed bytes, while trying to avoid
        making multiple reads from the underlying stream. Reads up to a
        buffer's worth of data if size is negative.

        Returns b'' if the file is at EOF.
        rN)rrGr1�DEFAULT_BUFFER_SIZEr3�read1rKr;r;r<rN�s
z
BZ2File.read1c
Cs2|j�"|��|j�|�W5QR�SQRXdS)zRRead bytes into b.

        Returns the number of bytes read (0 for EOF).
        N)rrGr3�readinto)r5�br;r;r<rO�szBZ2File.readintoc
CsVt|t�s$t|d�std��|��}|j�"|��|j�|�W5QR�SQRXdS)a
Read a line of uncompressed bytes from the file.

        The terminating newline (if present) is retained. If size is
        non-negative, no more than size bytes will be read (in which
        case the line may be incomplete). Returns b'' if already at EOF.
        �	__index__�Integer argument expectedN)	r'�intr-r.rQrrGr3�readlinerKr;r;r<rT�s

zBZ2File.readlinec
CsVt|t�s$t|d�std��|��}|j�"|��|j�|�W5QR�SQRXdS)z�Read a list of lines of uncompressed bytes from the file.

        size can be specified to control the number of lines read: no
        further lines will be read once the total size of the lines read
        so far equals or exceeds size.
        rQrRN)	r'rSr-r.rQrrGr3�	readlinesrKr;r;r<rU�s

zBZ2File.readlinesc
CsX|j�H|��|j�|�}|j�|�|jt|�7_t|�W5QR�SQRXdS)z�Write a byte string to the file.

        Returns the number of uncompressed bytes written, which is
        always len(data). Note that due to buffering, the file on disk
        may not reflect the data written until close() is called.
        N)rZ_check_can_writer&rrrr4�len)r5�dataZ
compressedr;r;r<r�sz
BZ2File.writec
Cs,|j�tj�||�W5QR�SQRXdS)z�Write a sequence of byte strings to the file.

        Returns the number of uncompressed bytes written.
        seq can be any iterable yielding byte strings.

        Line separators are not added between the written byte strings.
        N)rr/�
BaseStream�
writelines)r5�seqr;r;r<rY�szBZ2File.writelinesc
Cs4|j�$|��|j�||�W5QR�SQRXdS)a�Change the file position.

        The new position is specified by offset, relative to the
        position indicated by whence. Values for whence are:

            0: start of stream (default); offset must not be negative
            1: current stream position
            2: end of stream; offset must not be positive

        Returns the new file position.

        Note that seeking is emulated, so depending on the parameters,
        this operation may be extremely slow.
        N)rZ_check_can_seekr3�seek)r5�offset�whencer;r;r<r[szBZ2File.seekc
CsL|j�<|��|jtkr0|j��W5QR�S|jW5QR�SQRXdS)z!Return the current file position.N)rrBrr$r3�tellr4r@r;r;r<r^s

zBZ2File.tellN)r)rJ)rJ)rJ)rJ)�__name__�
__module__�__qualname__�__doc__rr=r>�propertyrArCrErDrFrHrrNrOrTrUrrYr1�SEEK_SETr[r^r;r;r;r<rs&	G





	

rrcCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|�dd�}t|||d	�}d|kr�t�||||�S|SdS)
aOpen a bzip2-compressed file in binary or text mode.

    The filename argument can be an actual filename (a str, bytes, or
    PathLike object), or an existing file object to read from or write
    to.

    The mode argument can be "r", "rb", "w", "wb", "x", "xb", "a" or
    "ab" for binary mode, or "rt", "wt", "xt" or "at" for text mode.
    The default mode is "rb", and the default compresslevel is 9.

    For binary mode, this function is equivalent to the BZ2File
    constructor: BZ2File(filename, mode, compresslevel). In this case,
    the encoding, errors and newline arguments must not be provided.

    For text mode, a BZ2File object is created, and wrapped in an
    io.TextIOWrapper instance with the specified encoding, error
    handling behavior, and line ending(s).

    �trPrNz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary moder)r9)r#�replacerr1�
TextIOWrapper)r6r7r9�encoding�errors�newlineZbz_modeZbinary_filer;r;r<r!scCst|�}|�|�|��S)z�Compress a block of data.

    compresslevel, if given, must be a number between 1 and 9.

    For incremental compression, use a BZ2Compressor object instead.
    )rrr?)rWr9�compr;r;r<rJscCshg}|r^t�}z|�|�}Wn tk
r<|r6Yq^n�YnX|�|�|jsVtd��|j}qd�|�S)zjDecompress a block of data.

    For incremental decompression, use a BZ2Decompressor object instead.
    zACompressed data ended before the end-of-stream marker was reached�)rrr0�append�eofr#Zunused_data�join)rWZresultsZdecomp�resr;r;r<rUs
)rrNNN)r)rb�__all__�
__author__�builtinsrr,r1r*r r/Z	threadingrZ_bz2rrrr$r%�objectrrXrrrr;r;r;r<�<module>s6��
)
chunk.cpython-38.opt-2.pyc000064400000005211150335716500011250 0ustar00U

e5d;�@sGdd�d�ZdS)c@sZeZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zddd�Zdd�Z	ddd�Z
dd�ZdS)�ChunkTFc	Cs�ddl}d|_||_|rd}nd}||_|�d�|_t|j�dkrFt�z |�|d|�d��d|_	Wn|j
k
r�td�YnX|r�|j	d|_	d|_z|j��|_
Wnttfk
r�d|_YnXd|_dS)	N�F�>�<��L�T)�struct�closed�align�file�read�	chunkname�len�EOFErrorZunpack_from�	chunksize�error�	size_read�tell�offset�AttributeError�OSError�seekable)�selfrr
Z	bigendianZ
inclheaderrZstrflag�r�/usr/lib64/python3.8/chunk.py�__init__4s, zChunk.__init__cCs|jS�N)r
�rrrr�getnameNsz
Chunk.getnamecCs|jSr)rrrrr�getsizeRsz
Chunk.getsizecCs |jsz|��W5d|_XdS)NT)r	�skiprrrr�closeVszChunk.closecCs|jrtd��dS)N�I/O operation on closed fileF)r	�
ValueErrorrrrr�isatty]szChunk.isattyrcCsv|jrtd��|jstd��|dkr0||j}n|dkrB||j}|dksT||jkrXt�|j�|j	|d�||_dS)Nr"zcannot seek��r)
r	r#rrrr�RuntimeErrorr�seekr)r�pos�whencerrrr(bs
z
Chunk.seekcCs|jrtd��|jS)Nr")r	r#rrrrrrusz
Chunk.tell���cCs�|jrtd��|j|jkrdS|dkr2|j|j}||j|jkrN|j|j}|j�|�}|jt|�|_|j|jkr�|jr�|jd@r�|j�d�}|jt|�|_|S)Nr"�rr%)r	r#rrrrrr
)r�size�data�dummyrrrrzs$��z
Chunk.readcCs�|jrtd��|jrnzD|j|j}|jr:|jd@r:|d}|j�|d�|j||_WdStk
rlYnX|j|jkr�t	d|j|j�}|�
|�}|snt�qndS)Nr"r%i )r	r#rrrr
rr(r�minrr)r�nr/rrrr �s"
z
Chunk.skipN)TTF)r)r+)�__name__�
__module__�__qualname__rrrr!r$r(rrr rrrrr3s


rN)rrrrr�<module>3r,telnetlib.cpython-38.opt-1.pyc000064400000043477150335716500012141 0ustar00U

e5d�Z�@sJdZddlZddlZddlZddlmZdgZdZdZ	e
dg�Ze
dg�Ze
dg�Z
e
d	g�Ze
d
g�Ze
dg�Ze
dg�Ze
dg�Ze
d
g�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Ze
dg�Z e
dg�Z!e
dg�Z"e
dg�Z#e
dg�Z$e
dg�Z%e
dg�Z&e
d g�Z'e
d!g�Z(e
d"g�Z)e
d#g�Z*e
d$g�Z+e
d%g�Z,e
d&g�Z-e
d'g�Z.e
d(g�Z/e
d)g�Z0e
d*g�Z1e
d+g�Z2e
dg�Z3e
d,g�Z4e
d-g�Z5e
d.g�Z6e
d/g�Z7e
d0g�Z8e
d1g�Z9e
d2g�Z:e
d3g�Z;e
d4g�Z<e
d5g�Z=e
d6g�Z>e
d7g�Z?e
d8g�Z@e
d9g�ZAe
d:g�ZBe
d;g�ZCe
d<g�ZDe
d=g�ZEe
d>g�ZFe
d?g�ZGe
d@g�ZHe
dAg�ZIe
dBg�ZJe
dCg�ZKe
dDg�ZLe
dEg�ZMe
dFg�ZNe
dGg�ZOe
dHg�ZPe
dg�ZQe
dg�ZReSedI��rejTZUnejVZUGdJd�d�ZWdKdL�ZXeYdMk�rFeX�dS)NaQTELNET client class.

Based on RFC 854: TELNET Protocol Specification, by J. Postel and
J. Reynolds

Example:

>>> from telnetlib import Telnet
>>> tn = Telnet('www.python.org', 79)   # connect to finger port
>>> tn.write(b'guido\r\n')
>>> print(tn.read_all())
Login       Name               TTY         Idle    When    Where
guido    Guido van Rossum      pts/2        <Dec  2 11:10> snag.cnri.reston..

>>>

Note that read_all() won't read until eof -- it just reads some data
-- but it guarantees to read at least one byte unless EOF is hit.

It is possible to pass a Telnet object to a selector in order to wait until
more data is available.  Note that in this case, read_eager() may return b''
even if there was data on the socket, because the protocol negotiation may have
eaten the data.  This is why EOFError is needed in some cases to distinguish
between "no data" and "connection closed" (since the socket also appears ready
for reading when it is closed).

To do:
- option negotiation
- timeout should be intrinsic to the connection object instead of an
  option on one of the read calls only

�N)�	monotonic�Telnet�������������������������������	�
���
������������������ �!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�0�1����PollSelectorc@seZdZdZddejfdd�Zdejfdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zd<dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd=d6d7�Zd8d9�Z d:d;�Z!dS)>ra�Telnet interface class.

    An instance of this class represents a connection to a telnet
    server.  The instance is initially not connected; the open()
    method must be used to establish a connection.  Alternatively, the
    host name and optional port number can be passed to the
    constructor, too.

    Don't try to reopen an already connected instance.

    This class has many read_*() methods.  Note that some of them
    raise EOFError when the end of the connection is read, because
    they can return an empty string for other reasons.  See the
    individual doc strings.

    read_until(expected, [timeout])
        Read until the expected string has been seen, or a timeout is
        hit (default is no timeout); may block.

    read_all()
        Read all data until EOF; may block.

    read_some()
        Read at least one byte or EOF; may block.

    read_very_eager()
        Read all data available already queued or on the socket,
        without blocking.

    read_eager()
        Read either data already queued or some data available on the
        socket, without blocking.

    read_lazy()
        Read all data in the raw queue (processing it first), without
        doing any socket I/O.

    read_very_lazy()
        Reads all data in the cooked queue, without doing any socket
        I/O.

    read_sb_data()
        Reads available data between SB ... SE sequence. Don't block.

    set_option_negotiation_callback(callback)
        Each time a telnet option is read on the input flow, this callback
        (if set) is called with the following parameters :
        callback(telnet socket, command, option)
            option will be chr(0) when there is no option.
        No other action is done afterwards by telnetlib.

    NrcCsht|_||_||_||_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
|dk	rd|�|||�dS)z�Constructor.

        When called without arguments, create an unconnected instance.
        With a hostname argument, it connects the instance; port number
        and timeout are optional.
        N�r)�
DEBUGLEVEL�
debuglevel�host�port�timeout�sock�rawq�irawq�cookedq�eof�iacseq�sb�sbdataq�option_callback�open��selfrLrMrN�r[�!/usr/lib64/python3.8/telnetlib.py�__init__�szTelnet.__init__cCsFd|_|st}||_||_||_t�d|||�t�||f|�|_	dS)z�Connect to a host.

        The optional second argument is the port number, which
        defaults to the standard telnet port (23).

        Don't try to reopen an already connected instance.
        rztelnetlib.Telnet.openN)
rS�TELNET_PORTrLrMrN�sys�audit�socketZcreate_connectionrOrYr[r[r\rX�szTelnet.opencCs|��dS)z#Destructor -- close the connection.N��close�rZr[r[r\�__del__�szTelnet.__del__cGs@|jdkr<td|j|jfdd�|r4t||�nt|�dS)z�Print a debug message, when the debug level is > 0.

        If extra arguments are present, they are substituted in the
        message using the standard string formatting operator.

        rzTelnet(%s,%s):� )�endN)rK�printrLrM)rZ�msg�argsr[r[r\ri�s

z
Telnet.msgcCs
||_dS)zhSet the debug level.

        The higher it is, the more debug output you get (on sys.stdout).

        N)rK)rZrKr[r[r\�set_debuglevel�szTelnet.set_debuglevelcCs.|j}d|_d|_d|_d|_|r*|��dS)zClose the connection.NTrIr)rOrSrTrUrc)rZrOr[r[r\rcszTelnet.closecCs|jS)z)Return the socket object used internally.)rOrdr[r[r\�
get_socketszTelnet.get_socketcCs
|j��S)z9Return the fileno() of the socket object used internally.)rO�filenordr[r[r\rmsz
Telnet.filenocCsBt|kr|�ttt�}t�d||�|�d|�|j�|�dS)z�Write a string to the socket, doubling any IAC characters.

        Can block if the connection is blocked.  May raise
        OSError if the connection is closed.

        ztelnetlib.Telnet.writezsend %rN)�IAC�replacer_r`rirO�sendall)rZ�bufferr[r[r\�writes
zTelnet.writec
Cs*t|�}|��|j�|�}|dkrN||}|jd|�}|j|d�|_|S|dk	r`t�|}t���}|�|tj�|j	�s|�
|�r�tdt|j�|�}|��|��|j�||�}|dkr�||}|jd|�}|j|d�|_|W5QR�S|dk	rv|t�}|dkrv�qqvW5QRX|�
�S)aRead until a given string is encountered or until timeout.

        When no match is found, return whatever is available instead,
        possibly the empty string.  Raise EOFError if the connection
        is closed and no cooked data is available.

        rN)�len�process_rawqrR�find�_time�_TelnetSelector�register�	selectors�
EVENT_READrS�select�max�	fill_rawq�read_very_lazy)rZ�matchrN�n�i�buf�deadline�selectorr[r[r\�
read_until&s8


zTelnet.read_untilcCs0|��|js |��|��q|j}d|_|S)z7Read all data until EOF; block until connection closed.rI)rtrSr}rR�rZr�r[r[r\�read_allKs
zTelnet.read_allcCs6|��|js&|js&|��|��q|j}d|_|S)z�Read at least one byte of cooked data unless EOF is hit.

        Return b'' if EOF is hit.  Block if no data is immediately
        available.

        rI)rtrRrSr}r�r[r[r\�	read_someUs
zTelnet.read_somecCs0|��|js(|��r(|��|��q|��S)aRead everything that's possible without blocking in I/O (eager).

        Raise EOFError if connection closed and no cooked data
        available.  Return b'' if no cooked data available otherwise.
        Don't block unless in the midst of an IAC sequence.

        )rtrS�
sock_availr}r~rdr[r[r\�read_very_eagerds

zTelnet.read_very_eagercCs6|��|js.|js.|��r.|��|��q|��S)z�Read readily available data.

        Raise EOFError if connection closed and no cooked data
        available.  Return b'' if no cooked data available otherwise.
        Don't block unless in the midst of an IAC sequence.

        )rtrRrSr�r}r~rdr[r[r\�
read_eagerrs

zTelnet.read_eagercCs|��|��S)aProcess and return data that's already in the queues (lazy).

        Raise EOFError if connection closed and no data available.
        Return b'' if no cooked data available otherwise.  Don't block
        unless in the midst of an IAC sequence.

        )rtr~rdr[r[r\�	read_lazy�szTelnet.read_lazycCs(|j}d|_|s$|jr$|js$td��|S)z�Return any data available in the cooked queue (very lazy).

        Raise EOFError if connection closed and no data available.
        Return b'' if no cooked data available otherwise.  Don't block.

        rIztelnet connection closed)rRrSrP�EOFErrorr�r[r[r\r~�s
zTelnet.read_very_lazycCs|j}d|_|S)aReturn any data available in the SB ... SE queue.

        Return b'' if no SB ... SE available. Should only be called
        after seeing a SB or SE command. When a new SB command is
        found, old unread SB data will be discarded. Don't block.

        rI)rVr�r[r[r\�read_sb_data�szTelnet.read_sb_datacCs
||_dS)zIProvide a callback function called after each receipt of a telnet option.N)rW)rZ�callbackr[r[r\�set_option_negotiation_callback�sz&Telnet.set_option_negotiation_callbackcCsRddg}�z|j�r|��}|jsf|tkr,q|dkr6q|tkrV||j|||j<qn|j|7_qt|j�dk�r$|ttt	t
fkr�|j|7_qd|_|tkr�||j|||j<nh|tkr�d|_d|_n&|t
kr�d|_|j|d|_d|d<|j�r|�|j|t�n|�dt|��qt|j�dkr|jdd�}d|_|}|ttfk�r�|�d|tk�rnd�ppd	t|��|j�r�|�|j||�n|j�tt
|�q|t	t
fkr|�d|t	k�r�d
�p�dt|��|j�r�|�|j||�q|j�tt|�qWn"tk
�r,d|_d|_YnX|j|d|_|j|d|_dS)
z�Transfer from raw queue to cooked queue.

        Set self.eof when connection is closed.  Don't block unless in
        the midst of an IAC sequence.

        rI�rrzIAC %d not recognizedrz	IAC %s %d�DO�DONT�WILL�WONTN)rP�rawq_getcharrT�theNULLrnrUrsr�r�r�r��SBrV�SErWrO�NOOPTri�ordrpr�rR)rZr��c�cmd�optr[r[r\rt�sp��zTelnet.process_rawqcCsZ|js|��|jrt�|j|j|jd�}|jd|_|jt|j�krVd|_d|_|S)z�Get next char from raw queue.

        Block if no data is immediately available.  Raise EOFError
        when connection is closed.

        rrIr)rPr}rSr�rQrs)rZr�r[r[r\r��szTelnet.rawq_getcharcCsL|jt|j�krd|_d|_|j�d�}|�d|�||_|j||_dS)z�Fill raw queue from exactly one recv() system call.

        Block if no data is immediately available.  Set self.eof when
        connection is closed.

        rIr�2zrecv %rN)rQrsrPrOZrecvrirSr�r[r[r\r}szTelnet.fill_rawqc
Cs:t��*}|�|tj�t|�d��W5QR�SQRXdS)z-Test whether data is available on the socket.rN)rwrxryrz�boolr{)rZr�r[r[r\r�szTelnet.sock_availc
Cs�tjdkr|��dSt���}|�|tj�|�tjtj�|��D]�\}}|j	|kr�z|�
�}Wn*tk
r�td�YW5QR�dSX|r�tj
�|�d��tj
��qD|j	tjkrDtj���d�}|s�W5QR�dS|�|�qDq<W5QRXdS)z9Interaction function, emulates a very dumb telnet client.Zwin32N�(*** Connection closed by remote host ***�ascii)r_�platform�mt_interactrwrxryrz�stdinr{Zfileobjr�r�rh�stdoutrr�decode�flush�readline�encode)rZr��keyZevents�text�liner[r[r\�interacts*

zTelnet.interactcCs<ddl}|�|jd�tj��}|s&q8|�|�d��qdS)z$Multithreaded version of interact().rNr[r�)�_thread�start_new_thread�listenerr_r�r�rrr�)rZr�r�r[r[r\r�3s
zTelnet.mt_interactcCsTz|��}Wntk
r*td�YdSX|rDtj�|�d��qtj��qdS)z>Helper for mt_interact() -- this executes in the other thread.r�Nr�)r�r�rhr_r�rrr�r�)rZ�datar[r[r\r�=szTelnet.listenerc
CsTd}|dd�}tt|��}|D]0}t||d�s |s>ddl}|�||�||<q |dk	rdt�|}t���}|�|tj	�|j
�s&|��|D]X}||�|j
�}|r�|��}	|j
d|	�}
|j
|	d�|_
|||
fW5QR�Sq�|dk	�r|�|�}|t�}|�s|dkrz�q&nqz|��qzW5QRX|��}
|
�sJ|j
�rJt�dd|
fS)a�Read until one from a list of a regular expressions matches.

        The first argument is a list of regular expressions, either
        compiled (re.Pattern instances) or uncompiled (strings).
        The optional second argument is a timeout, in seconds; default
        is no timeout.

        Return a tuple of three items: the index in the list of the
        first regular expression that matches; the re.Match object
        returned; and the text read up till and including the match.

        If EOF is read and no text was read, raise EOFError.
        Otherwise, when nothing matches, return (-1, None, text) where
        text is the text received so far (may be the empty string if a
        timeout happened).

        If a regular expression ends with a greedy match (e.g. '.*')
        or if more than one expression can match the same input, the
        results are undeterministic, and may depend on the I/O timing.

        N�searchr���)�rangers�hasattr�re�compilervrwrxryrzrSrtr�rRrgr{r}r~r�)rZ�listrNr��indicesr�r�r��m�er�Zreadyr[r[r\�expectJsB



z
Telnet.expectcCs|S�Nr[rdr[r[r\�	__enter__�szTelnet.__enter__cCs|��dSr�rb)rZ�type�value�	tracebackr[r[r\�__exit__�szTelnet.__exit__)N)N)"�__name__�
__module__�__qualname__�__doc__raZ_GLOBAL_DEFAULT_TIMEOUTr]rXrerirkrcrlrmrrr�r�r�r�r�r�r~r�r�rtr�r}r�r�r�r�r�r�r�r[r[r[r\r�s>5�


%

H

8c	Cs�d}tjdd�r2tjddkr2|d}tjd=qd}tjdd�rNtjd}d}tjdd�r�tjd}zt|�}Wn tk
r�t�|d�}YnXt��(}|�|�|j||dd	�|�	�W5QRXdS)
z�Test program for telnetlib.

    Usage: python telnetlib.py [-d] ... [host [port]]

    Default host is localhost; default port is 23.

    rrNz-dZ	localhostrZtcpg�?)rN)
r_�argv�int�
ValueErrorraZ
getservbynamerrkrXr�)rKrLrMZportstrZtnr[r[r\�test�s$



r��__main__)Zr�r_rary�timerrv�__all__rJr^�bytesrnr�r�r�r�r�r�ZNOPZDMZBRKZIPZAOZAYTZECZELZGAr�ZBINARYZECHOZRCPZSGAZNAMSZSTATUSZTMZRCTEZNAOLZNAOPZNAOCRDZNAOHTSZNAOHTDZNAOFFDZNAOVTSZNAOVTDZNAOLFDZXASCIIZLOGOUTZBMZDETZSUPDUPZSUPDUPOUTPUTZSNDLOCZTTYPEZEORZTUIDZOUTMRKZTTYLOCZVT3270REGIMEZX3PADZNAWSZTSPEEDZLFLOWZLINEMODEZXDISPLOCZOLD_ENVIRONZAUTHENTICATIONZENCRYPTZNEW_ENVIRONZTN3270EZXAUTH�CHARSETZRSPZCOM_PORT_OPTIONZSUPPRESS_LOCAL_ECHOZTLSZKERMITZSEND_URLZ	FORWARD_XZPRAGMA_LOGONZ
SSPI_LOGONZPRAGMA_HEARTBEATZEXOPLr�r�rHrwZSelectSelectorrr�r�r[r[r[r\�<module>s�#








































































reprlib.cpython-38.opt-1.pyc000064400000012271150335716500011602 0ustar00U

e5d��@s^dZdddgZddlZddlmZddlmZd
d	d�ZGd
d�d�Zdd�Z	e�Z
e
jZdS)zGRedo the builtin repr() (representation) but with limits on most sizes.�Repr�repr�recursive_repr�N)�islice)�	get_ident�...cs�fdd�}|S)zGDecorator to make a repr function return fillvalue for a recursive callcsXt�����fdd�}t�d�|_t�d�|_t�d�|_t�d�|_t�di�|_|S)Nc	sBt|�t�f}|�kr�S��|�z�|�}W5��|�X|S�N)�idr�add�discard)�self�key�result)�	fillvalue�repr_running�
user_function��/usr/lib64/python3.8/reprlib.py�wrappers
z<recursive_repr.<locals>.decorating_function.<locals>.wrapper�
__module__�__doc__�__name__�__qualname__�__annotations__)�set�getattrrrrrr)rr�r)rrr�decorating_functionsz+recursive_repr.<locals>.decorating_functionr)rrrrrr	sc@s~eZdZdd�Zdd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS) rcCsFd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
dS)N�����()�maxlevel�maxtuple�maxlist�maxarray�maxdict�maxset�maxfrozenset�maxdeque�	maxstring�maxlong�maxother)rrrr�__init__&sz
Repr.__init__cCs|�||j�Sr)�repr1r#)r�xrrrr3sz	Repr.reprcCsVt|�j}d|kr$|��}d�|�}t|d|�rFt|d|�||�S|�||�SdS)N� �_�repr_)�typer�split�join�hasattrr�
repr_instance)rr0�level�typename�partsrrrr/6s

z
Repr.repr1�c
s�t|�}|dkr|rd}nX|d�|j���fdd�t||�D�}	||krT|	�d�d�|	�}|dkrr|rr||}d|||fS)Nrr�csg|]}�|���qSrr)�.0�elem��newlevelr/rr�
<listcomp>Gsz'Repr._repr_iterable.<locals>.<listcomp>�, z%s%s%s)�lenr/r�appendr6)
rr0r9�left�right�maxiter�trail�n�s�piecesrr@r�_repr_iterable@s

zRepr._repr_iterablecCs|�||dd|jd�S)N�(�)�,)rMr$�rr0r9rrr�
repr_tupleMszRepr.repr_tuplecCs|�||dd|j�S)N�[�])rMr%rQrrr�	repr_listPszRepr.repr_listcCs,|sd|jSd|j}|�|||d|j�S)Nzarray('%s')z
array('%s', [�]))�typecoderMr&)rr0r9�headerrrr�
repr_arraySs

zRepr.repr_arraycCs$|sdSt|�}|�||dd|j�S)Nzset()�{�})�_possibly_sortedrMr(rQrrr�repr_setYsz
Repr.repr_setcCs$|sdSt|�}|�||dd|j�S)Nzfrozenset()zfrozenset({z}))r\rMr)rQrrr�repr_frozenset_s�zRepr.repr_frozensetcCs|�||dd|j�S)Nzdeque([rV)rMr*rQrrr�
repr_dequefszRepr.repr_dequecCs�t|�}|dkrdS|dkr dS|d}|j}g}tt|�|j�D].}|||�}||||�}	|�d||	f�qB||jkr�|�d�d�|�}
d|
fS)	Nrz{}z{...}r=z%s: %srrCz{%s})rDr/rr\r'rEr6)rr0r9rJrAr/rLr
�keyrepr�valreprrKrrr�	repr_dictis 



zRepr.repr_dictcCs�t�|d|j��}t|�|jkr�td|jdd�}td|jd|�}t�|d|�|t|�|d��}|d|�d|t|�|d�}|S�Nr��r)�builtinsrr+rD�max�rr0r9rK�i�jrrr�repr_strxs&$z
Repr.repr_strcCsht�|�}t|�|jkrdtd|jdd�}td|jd|�}|d|�d|t|�|d�}|Src)rfrrDr,rgrhrrr�repr_int�s
$z
Repr.repr_intcCs�zt�|�}Wn(tk
r6d|jjt|�fYSXt|�|jkr�td|jdd�}td|jd|�}|d|�d|t|�|d�}|S)Nz<%s instance at %#x>rrdrer)	rfr�	Exception�	__class__rr	rDr-rgrhrrrr8�s$zRepr.repr_instanceN)r<)rrrr.rr/rMrRrUrYr]r^r_rbrkrlr8rrrrr$s



	cCs,z
t|�WStk
r&t|�YSXdSr)�sortedrm�list)r0rrrr\�s
r\)r)r�__all__rf�	itertoolsr�_threadrrrr\�aReprrrrrr�<module>s

s	random.cpython-38.opt-1.pyc000064400000047216150335716500011432 0ustar00U

e5d�p�@sdZddlmZddlmZmZm	Z
mZm
ZddlmZmZmZmZddlmZddlmZmZddlm Z!m"Z#ddl$m$Z%dd	lZ&zdd
l'm(Z'Wn e)k
r�dd
l*m(Z'YnXddd
ddddddddddddddddddd d!d"gZ+d#ed$�ed%�Z,d%e
Z-ed&�Z.d'ed(�Z/d)Z0d*e0Z1dd	l2Z2Gd+d�de2j3�Z3Gd,d"�d"e3�Z4d-d.�Z5d5d0d1�Z6e3�Z7e7j8Z8e7j9Z9e7j:Z:e7j;Z;e7j<Z<e7j=Z=e7j>Z>e7j?Z?e7j@Z@e7jAZAe7jBZBe7jCZCe7jDZDe7jEZEe7jFZFe7jGZGe7jHZHe7jIZIe7jJZJe7jKZKe7jLZLe7jMZMeNe&d2��re&jOe7j8d3�ePd4k�re6�d	S)6a�Random variable generators.

    integers
    --------
           uniform within range

    sequences
    ---------
           pick random element
           pick random sample
           pick weighted random sample
           generate random permutation

    distributions on the real line:
    ------------------------------
           uniform
           triangular
           normal (Gaussian)
           lognormal
           negative exponential
           gamma
           beta
           pareto
           Weibull

    distributions on the circle (angles 0 to 2pi)
    ---------------------------------------------
           circular uniform
           von Mises

General notes on the underlying Mersenne Twister core generator:

* The period is 2**19937-1.
* It is one of the most extensively tested generators in existence.
* The random() method is implemented in C, executes in a single Python step,
  and is, therefore, threadsafe.

�)�warn)�log�exp�pi�e�ceil)�sqrt�acos�cos�sin)�urandom)�Set�Sequence)�
accumulate�repeat)�bisectN)�sha512�Random�seed�random�uniform�randint�choice�sample�	randrange�shuffle�
normalvariate�lognormvariate�expovariate�vonmisesvariate�gammavariate�
triangular�gauss�betavariate�
paretovariate�weibullvariate�getstate�setstate�getrandbits�choices�SystemRandom�g��@�@��?�@�5�cs$eZdZdZdZd?dd�Zdd�Zd@�fd	d
�	Z�fdd�Z�fd
d�Z	dd�Z
dd�Zdd�Zdde
fdd�Zdd�Zdd�Ze
de>fdd�ZeZdd�ZdAd d!�Zd"d#�ZdBddd$�d%d&�Zd'd(�ZdCd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Z d;d<�Z!d=d>�Z"�Z#S)Dra�Random number generator base class used by bound module functions.

    Used to instantiate instances of Random to get generators that don't
    share state.

    Class Random can also be subclassed if you want to use a different basic
    generator of your own devising: in that case, override the following
    methods:  random(), seed(), getstate(), and setstate().
    Optionally, implement a getrandbits() method so that randrange()
    can cover arbitrarily large ranges.

    �NcCs|�|�d|_dS)zeInitialize an instance.

        Optional argument x controls seeding, as for Random.seed().
        N)r�
gauss_next)�self�x�r6�/usr/lib64/python3.8/random.py�__init__^s
zRandom.__init__cKsJ|jD]>}d|jkrqFd|jkr.|j|_qFd|jkr|j|_qFqdS)aControl how subclasses generate random integers.

        The algorithm a subclass can use depends on the random() and/or
        getrandbits() implementation available to it and determines
        whether it can generate random integers from arbitrarily large
        ranges.
        �
_randbelowr(rN)�__mro__�__dict__�_randbelow_with_getrandbitsr9�_randbelow_without_getrandbits)�cls�kwargs�cr6r6r7�__init_subclass__gs	



zRandom.__init_subclass__r1cs�|dkr�t|ttf�r�t|t�r*|�d�n|}|rBt|d�d>nd}tt|�D]}d||Ad@}qP|t|�N}|dkr~dn|}|d	kr�t|tttf�r�t|t�r�|��}|t	|��
�7}t�|d
�}t
��|�d|_dS)aInitialize internal state from hashable object.

        None or no argument seeds from current time or from an operating
        system specific randomness source if available.

        If *a* is an int, all bits are used.

        For version 2 (the default), all of the bits are used if *a* is a str,
        bytes, or bytearray.  For version 1 (provided for reproducing random
        sequences from older versions of Python), the algorithm for str and
        bytes generates a narrower range of seeds.

        �zlatin-1r�iCBl����������r1�bigN)�
isinstance�str�bytes�decode�ord�map�len�	bytearray�encode�_sha512Zdigest�int�
from_bytes�superrr3)r4�a�versionr5r@��	__class__r6r7r{s
zRandom.seedcs|jt���|jfS)z9Return internal state; can be passed to setstate() later.)�VERSIONrSr&r3�r4rVr6r7r&�szRandom.getstatec
s�|d}|dkr*|\}}|_t��|�nt|dkr�|\}}|_ztdd�|D��}Wn(tk
r|}z
t|�W5d}~XYnXt��|�ntd||jf��dS)z:Restore internal state from object returned by getstate().rr2r1css|]}|dVqdS)lNr6)�.0r5r6r6r7�	<genexpr>�sz"Random.setstate.<locals>.<genexpr>Nz?state with version %s passed to Random.setstate() of version %s)r3rSr'�tuple�
ValueError�	TypeErrorrX)r4�staterUZ
internalstaterrVr6r7r'�s�zRandom.setstatecCs|��S�N)r&rYr6r6r7�__getstate__�szRandom.__getstate__cCs|�|�dSr`)r')r4r_r6r6r7�__setstate__�szRandom.__setstate__cCs|jd|��fS)Nr6)rWr&rYr6r6r7�
__reduce__�szRandom.__reduce__rBc
Cs||�}||krtd��|dkr:|dkr2|�|�Std��||�}||krRtd��||}|dkrx|dkrx||�|�S|dkr�td|||f��||�}||kr�td��|dkr�||d|}	n"|dkr�||d|}	ntd	��|	dkr�td��|||�|	�S)
z�Choose a random item from range(start, stop[, step]).

        This fixes the problem with randint() which includes the
        endpoint; in Python this is usually not what you want.

        z!non-integer arg 1 for randrange()Nrzempty range for randrange()z non-integer stop for randrange()rBz(empty range for randrange() (%d, %d, %d)z non-integer step for randrange()zzero step for randrange())r]r9)
r4�start�stop�step�_intZistartZistop�widthZistep�nr6r6r7r�s4

zRandom.randrangecCs|�||d�S)zJReturn random integer in range [a, b], including both end points.
        rB)r�r4rT�br6r6r7r�szRandom.randintcCs,|j}|��}||�}||kr(||�}q|S)zCReturn a random int in the range [0,n).  Raises ValueError if n==0.)r(�
bit_length)r4rir(�k�rr6r6r7r<�s
z"Random._randbelow_with_getrandbitscCsn|j}||kr$td�||�|�S|dkr4td��||}|||}|�}||kr^|�}qN|||�|S)z�Return a random int in the range [0,n).  Raises ValueError if n==0.

        The implementation does not use getrandbits, but only random.
        z�Underlying random() generator does not supply 
enough bits to choose from a population range this large.
To remove the range limitation, add a getrandbits() method.rzBoundary cannot be zero)r�_warnr])r4rirQ�maxsizerZrem�limitrnr6r6r7r=sz%Random._randbelow_without_getrandbitscCs:z|�t|��}Wntk
r0td�d�YnX||S)z2Choose a random element from a non-empty sequence.z$Cannot choose from an empty sequenceN)r9rMr]�
IndexError)r4�seq�ir6r6r7rs
z
Random.choicecCs�|dkrN|j}ttdt|���D]*}||d�}||||||<||<q nHt}ttdt|���D]0}||�|d�}||||||<||<qddS)z�Shuffle list x in place, and return None.

        Optional argument random is a 0-argument function returning a
        random float in [0.0, 1.0); if it is the default None, the
        standard random.random will be used.

        NrB)r9�reversed�rangerMrQ)r4r5r�	randbelowrt�jrgr6r6r7r%s	zRandom.shufflecCst|t�rt|�}t|t�s$td��|j}t|�}d|krF|ksPntd��dg|}d}|dkr�|dtt	|dd��7}||kr�t
|�}t|�D]0}|||�}	||	||<|||d	||	<q�nHt�}
|
j
}t|�D]2}||�}	|	|
kr�||�}	q�||	�||	||<q�|S)
a=Chooses k unique random elements from a population sequence or set.

        Returns a new list containing elements from the population while
        leaving the original population unchanged.  The resulting list is
        in selection order so that all sub-slices will also be valid random
        samples.  This allows raffle winners (the sample) to be partitioned
        into grand prize and second place winners (the subslices).

        Members of the population need not be hashable or unique.  If the
        population contains repeats, then each occurrence is a possible
        selection in the sample.

        To choose a sample in a range of integers, use range as an argument.
        This is especially fast and space efficient for sampling from a
        large population:   sample(range(10000000), 60)
        z>Population must be a sequence or set.  For dicts, use list(d).rz,Sample larger than population or is negativeN��r+r2rB)rG�_Setr\�	_Sequencer^r9rMr]�_ceil�_log�listrv�set�add)r4�
populationrmrwri�resultZsetsizeZpoolrtrxZselectedZselected_addr6r6r7r;s6)



z
Random.sample)�cum_weightsrmcs�|j�t����dkrV|dkrHt��d7�����fdd�td|�D�Stt|���n|dk	rftd��t���krztd��t��dd��d�������fd	d�td|�D�S)
z�Return a k sized list of population elements chosen with replacement.

        If the relative weights or cumulative weights are not specified,
        the selections are made with equal probability.

        N�csg|]}�������qSr6r6�rZrt)rgrir�rr6r7�
<listcomp>�sz"Random.choices.<locals>.<listcomp>z2Cannot specify both weights and cumulative weightsz3The number of weights does not match the populationrDrBcs$g|]}������d���qS)rr6r�)rr��hir�r�totalr6r7r��s�)	rrMrQ�_repeatr�_accumulater^r]�_bisect)r4r�Zweightsr�rmr6)rgrr�r�rir�rr�r7r)�s$�zRandom.choicescCs||||��S)zHGet a random number in the range [a, b) or [a, b] depending on rounding.�rrjr6r6r7r�szRandom.uniformr�r.cCs||��}z |dkrdn||||}Wntk
r@|YSX||krdd|}d|}||}}|||t||�S)z�Triangular distribution.

        Continuous distribution bounded by given lower and upper limits,
        and having a given mode value in-between.

        http://en.wikipedia.org/wiki/Triangular_distribution

        N��?r.)r�ZeroDivisionError�_sqrt)r4ZlowZhigh�mode�ur@r6r6r7r!�s	 

zRandom.triangularcCsP|j}|�}d|�}t|d|}||d}|t|�krqDq|||S)z\Normal distribution.

        mu is the mean, and sigma is the standard deviation.

        r.r�r-)r�
NV_MAGICCONSTr~)r4�mu�sigmar�u1�u2�zZzzr6r6r7r�s

zRandom.normalvariatecCst|�||��S)z�Log normal distribution.

        If you take the natural logarithm of this distribution, you'll get a
        normal distribution with mean mu and standard deviation sigma.
        mu can have any value, and sigma must be greater than zero.

        )�_expr)r4r�r�r6r6r7r�szRandom.lognormvariatecCstd|���|S)a^Exponential distribution.

        lambd is 1.0 divided by the desired mean.  It should be
        nonzero.  (The parameter would be called "lambda", but that is
        a reserved word in Python.)  Returned values range from 0 to
        positive infinity if lambd is positive, and from negative
        infinity to 0 if lambd is negative.

        r.)r~r)r4Zlambdr6r6r7r�szRandom.expovariatecCs�|j}|dkrt|�Sd|}|td||�}|�}tt|�}|||}|�}	|	d||ks�|	d|t|�kr4q�q4d|}
|
|d|
|}|�}|dkr�|t|�t}
n|t|�t}
|
S)aFCircular data distribution.

        mu is the mean angle, expressed in radians between 0 and 2*pi, and
        kappa is the concentration parameter, which must be greater than or
        equal to zero.  If kappa is equal to zero, this distribution reduces
        to a uniform random angle over the range 0 to 2*pi.

        g���ư>r�r.)r�TWOPIr��_cos�_pir��_acos)r4r�Zkappar�srnr�r��dr��q�fZu3Zthetar6r6r7r�s$
$zRandom.vonmisesvariatecCs~|dks|dkrtd��|j}|dkr�td|d�}|t}||}|�}d|kr`dksdqFqFd|�}t|d|�|}	|t|	�}
|||}|||	|
}|td|dks�|t|�krF|
|SqFn�|dkr�td|��|S|�}
t|t}||
}|dk�r$|d|}
nt|||�}
|�}|dk�r^||
|dk�rp�qrq�|t|
�kr�qrq�|
|SdS)	aZGamma distribution.  Not the gamma function!

        Conditions on the parameters are alpha > 0 and beta > 0.

        The probability distribution function is:

                    x ** (alpha - 1) * math.exp(-x / beta)
          pdf(x) =  --------------------------------------
                      math.gamma(alpha) * beta ** alpha

        r�z*gammavariate: alpha and beta must be > 0.0r.r,gH�����z>g�P���?r/N)r]rr��LOG4r~r��
SG_MAGICCONST�_e)r4�alpha�betarZainvZbbbZcccr�r��vr5r�rnr�rk�pr6r6r7r #s@
 

zRandom.gammavariatecCs`|j}|j}d|_|dkrT|�t}tdtd|���}t|�|}t|�||_|||S)z�Gaussian distribution.

        mu is the mean, and sigma is the standard deviation.  This is
        slightly faster than the normalvariate() function.

        Not thread-safe without a lock around calls.

        Ng�r.)rr3r�r�r~r��_sin)r4r�r�rr�Zx2piZg2radr6r6r7r"hs
zRandom.gausscCs0|�|d�}|dkrdS|||�|d�SdS)z�Beta distribution.

        Conditions on the parameters are alpha > 0 and beta > 0.
        Returned values range between 0 and 1.

        r.rr�N)r )r4r�r��yr6r6r7r#�s
zRandom.betavariatecCsd|��}d|d|S)z3Pareto distribution.  alpha is the shape parameter.r.r�)r4r�r�r6r6r7r$�szRandom.paretovariatecCs"d|��}|t|�d|S)zfWeibull distribution.

        alpha is the scale parameter and beta is the shape parameter.

        r.)rr~)r4r�r�r�r6r6r7r%�szRandom.weibullvariate)N)Nr1)N)N)r�r.N)$�__name__�
__module__�__qualname__�__doc__rXr8rArr&r'rarbrcrQrrr<�BPFr=r9rrrr)rr!rrrrr r"r#r$r%�
__classcell__r6r6rVr7rNs<

	 ,

G
0E5	c@s8eZdZdZdd�Zdd�Zdd�Zdd	�ZeZZ	d
S)r*z�Alternate random number generator using sources provided
    by the operating system (such as /dev/urandom on Unix or
    CryptGenRandom on Windows).

     Not available on all systems (see os.urandom() for details).
    cCst�td�d�d?tS)z3Get the next random number in the range [0.0, 1.0).rCrFr2)rQrR�_urandom�	RECIP_BPFrYr6r6r7r�szSystemRandom.randomcCs<|dkrtd��|dd}t�t|�d�}||d|?S)z:getrandbits(k) -> x.  Generates an int with k random bits.rz(number of bits must be greater than zerorC�rF)r]rQrRr�)r4rmZnumbytesr5r6r6r7r(�s
zSystemRandom.getrandbitscOsdS)z<Stub method.  Not used for a system random number generator.Nr6�r4�args�kwdsr6r6r7r�szSystemRandom.seedcOstd��dS)zAMethod should not be called for a system random number generator.z*System entropy source does not have state.N)�NotImplementedErrorr�r6r6r7�_notimplemented�szSystemRandom._notimplementedN)
r�r�r�r�rr(rr�r&r'r6r6r6r7r*�scCs�ddl}t|d|j�d}d}d}d}|��}t|�D]4}	||�}
||
7}||
|
}t|
|�}t|
|�}q6|��}tt||d�ddd	�||}t||||�}
td
||
||f�dS)Nr�timesr�g _�Bg _��r2zsec,� )�endz"avg %g, stddev %g, min %g, max %g
)	�time�printr��perf_counterrv�min�max�roundr�)ri�funcr�r�r�ZsqsumZsmallestZlargestZt0rtr5�t1ZavgZstddevr6r6r7�_test_generator�s(

�r���cCs�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td	�t|td
�t|td�t|td�t|td�t|td
�dS)Nr6)r�r.)g{�G�z�?r.)皙�����?r.)r�r,)r�r.)g�������?r.)r.r.)r,r.)g4@r.)gi@r.)�@r�)r�r.gUUUUUU�?)	r�rrrrr r"r#r!)�Nr6r6r7�_test�s r��fork)Zafter_in_child�__main__)r�)Qr��warningsrroZmathrr~rr�rr�rr�rr}rr�r	r�r
r�rr��osrr��_collections_abcr
r{rr|�	itertoolsrr�rr�rr��_osrPr�ImportErrorZhashlib�__all__r�r�r�r�r�r�Z_randomrr*r�r�Z_instrrrr!rrrrrr)rrrrr r"r#r$r%r&r'r(�hasattr�register_at_forkr�r6r6r6r7�<module>s�'�
{

weakref.cpython-38.pyc000064400000046100150335716500010626 0ustar00U

e5d�S�
@s�dZddlmZmZmZmZmZmZmZm	Z	ddl
mZmZddl
Z
ddlZddlZeefZddddd	d
ddd
ddddg
ZGdd�de�ZGdd�de
j�ZGdd�de�ZGdd	�d	e
j�ZGdd�d�ZdS)z{Weak reference support for Python.

This module is an implementation of PEP 205:

http://www.python.org/dev/peps/pep-0205/
�)�getweakrefcount�getweakrefs�ref�proxy�CallableProxyType�	ProxyType�
ReferenceType�_remove_dead_weakref)�WeakSet�_IterationGuardNrrrr�WeakKeyDictionaryrrr�
ProxyTypes�WeakValueDictionaryr
�
WeakMethod�finalizecsDeZdZdZdZddd�Z�fdd�Zdd	�Zd
d�Ze	j
Z
�ZS)
rz�
    A custom `weakref.ref` subclass which simulates a weak reference to
    a bound method, working around the lifetime problem of bound methods.
    )�	_func_ref�
_meth_type�_alive�__weakref__Ncs~z|j}|j}Wn(tk
r8td�t|���d�YnX��fdd�}t�|||�}t||�|_t|�|_	d|_
t|��|S)Nz)argument should be a bound method, not {}cs&��}|jr"d|_�dk	r"�|�dS�NF)r)�arg�self��callbackZself_wr��/usr/lib64/python3.8/weakref.py�_cb3s
zWeakMethod.__new__.<locals>._cbT)�__self__�__func__�AttributeError�	TypeError�format�typer�__new__rrr)�clsZmethr�obj�funcrrrrrr#,s 
��
zWeakMethod.__new__cs2t���}|��}|dks"|dkr&dS|�||�S�N)�super�__call__rr)rr%r&��	__class__rrr)Bs

zWeakMethod.__call__cCs:t|t�r6|jr|js||kSt�||�o4|j|jkSdSr)�
isinstancerrr�__eq__r�r�otherrrrr-Is

zWeakMethod.__eq__cCs:t|t�r6|jr|js||k	St�||�p4|j|jkSdS�NT)r,rrr�__ne__rr.rrrr1Ps

zWeakMethod.__ne__)N)�__name__�
__module__�__qualname__�__doc__�	__slots__r#r)r-r1r�__hash__�
__classcell__rrr*rr$s
c@s�eZdZdZd,dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZeZ
dd�Zd-dd�Zdd�Zdd�ZeZdd�Zd d!�Zd"d#�Zd$d%�Zd.d&d'�Zd/d(d)�Zd*d+�ZdS)0rz�Mapping class that references values weakly.

    Entries in the dictionary will be discarded when no strong
    reference to the value exists anymore
    rcKs>t|�tfdd�}||_g|_t�|_i|_|j|f|�dS)NcSs6|�}|dk	r2|jr$|j�|j�n||j|j�dSr')�
_iterating�_pending_removals�append�key�data)�wr�selfrefZ_atomic_removalrrrr�removegs
z,WeakValueDictionary.__init__.<locals>.remove)rr	�_remover:�setr9r=�update)rr/�kwr@rrr�__init__fs	zWeakValueDictionary.__init__cCs(|j}|j}|r$|��}t||�qdSr')r:r=�popr	)r�l�dr<rrr�_commit_removalsws
z$WeakValueDictionary._commit_removalscCs4|jr|��|j|�}|dkr,t|��n|SdSr'�r:rIr=�KeyError�rr<�orrr�__getitem__�s
zWeakValueDictionary.__getitem__cCs|jr|��|j|=dSr')r:rIr=�rr<rrr�__delitem__�szWeakValueDictionary.__delitem__cCs|jr|��t|j�Sr')r:rI�lenr=�rrrr�__len__�szWeakValueDictionary.__len__cCs>|jr|��z|j|�}Wntk
r4YdSX|dk	SrrJrLrrr�__contains__�sz WeakValueDictionary.__contains__cCsd|jjt|�fS�Nz<%s at %#x>�r+r2�idrRrrr�__repr__�szWeakValueDictionary.__repr__cCs&|jr|��t||j|�|j|<dSr')r:rI�KeyedRefrAr=�rr<�valuerrr�__setitem__�szWeakValueDictionary.__setitem__c	CsV|jr|��t�}t|��0|j��D]\}}|�}|dk	r(|||<q(W5QRX|Sr')r:rIrrr=�items)r�newr<r>rMrrr�copy�s
zWeakValueDictionary.copyc	Csjddlm}|jr|��|��}t|��6|j��D]$\}}|�}|dk	r6|||||�<q6W5QRX|S�Nr)�deepcopy)r_rar:rIr+rr=r])r�memorar^r<r>rMrrr�__deepcopy__�s
z WeakValueDictionary.__deepcopy__NcCsP|jr|��z|j|}Wntk
r4|YSX|�}|dkrH|S|SdSr'rJ)rr<�defaultr>rMrrr�get�s
zWeakValueDictionary.getc	csR|jr|��t|��2|j��D] \}}|�}|dk	r"||fVq"W5QRXdSr'�r:rIrr=r])r�kr>�vrrrr]�s
zWeakValueDictionary.itemsc	csJ|jr|��t|��*|j��D]\}}|�dk	r"|Vq"W5QRXdSr'rf)rrgr>rrr�keys�s

zWeakValueDictionary.keysc	cs6|jr|��t|��|j��EdHW5QRXdS)a�Return an iterator that yields the weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        N�r:rIrr=�valuesrRrrr�
itervaluerefs�s

z!WeakValueDictionary.itervaluerefsc	csJ|jr|��t|��*|j��D]}|�}|dk	r"|Vq"W5QRXdSr'rj�rr>r%rrrrk�s
zWeakValueDictionary.valuescCs8|jr|��|j��\}}|�}|dk	r||fSqdSr')r:rIr=�popitem)rr<r>rMrrrrn�szWeakValueDictionary.popitemcGs`|jr|��z|j�|��}Wntk
r8d}YnX|dkrX|rN|dSt|��n|SdS)Nr)r:rIr=rFrK)rr<�argsrMrrrrFs

zWeakValueDictionary.popcCs`z|j|�}Wntk
r(d}YnX|dkrX|jr@|��t||j|�|j|<|S|SdSr')r=rKr:rIrYrA)rr<rdrMrrr�
setdefaults
zWeakValueDictionary.setdefaultcKsz|jr|��|j}|dk	rRt|d�s.t|�}|��D]\}}t||j|�||<q6|��D]\}}t||j|�||<qZdS�Nr])r:rIr=�hasattr�dictr]rYrA)rr/�kwargsrHr<rMrrrrCs
zWeakValueDictionary.updatecCs|jr|��t|j���S)a~Return a list of weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        )r:rI�listr=rkrRrrr�	valuerefs(s
zWeakValueDictionary.valuerefs)r)N)N)N)r2r3r4r5rErIrNrPrSrTrXr\r_�__copy__rcrer]ri�__iter__rlrkrnrFrprCrvrrrrrZs.
			
			

cs,eZdZdZdZdd�Z�fdd�Z�ZS)rYa[Specialized reference that includes a key corresponding to the value.

    This is used in the WeakValueDictionary to avoid having to create
    a function object for each key stored in the mapping.  A shared
    callback object can use the 'key' attribute of a KeyedRef instead
    of getting a reference to the key from an enclosing scope.

    �r<cCst�|||�}||_|Sr')rr#r<)r"�obrr<rrrrr#CszKeyedRef.__new__cst��||�dSr')r(rE)rrzrr<r*rrrEHszKeyedRef.__init__)r2r3r4r5r6r#rEr8rrr*rrY7s	rYc@s�eZdZdZd+dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZeZ
dd�Zd,dd�Zdd�Zdd�Zdd�ZeZdd �Zd!d"�Zd#d$�Zd%d&�Zd-d'd(�Zd.d)d*�ZdS)/ra� Mapping class that references keys weakly.

    Entries in the dictionary will be discarded when there is no
    longer a strong reference to the key. This can be used to
    associate additional data with an object owned by other parts of
    an application without adding attributes to those objects. This
    can be especially useful with objects that override attribute
    accesses.
    NcCsFi|_t|�fdd�}||_g|_t�|_d|_|dk	rB|�|�dS)NcSs.|�}|dk	r*|jr"|j�|�n|j|=dSr')r9r:r;r=)rgr?rrrrr@Ys
z*WeakKeyDictionary.__init__.<locals>.removeF)r=rrAr:rBr9�
_dirty_lenrC)rrsr@rrrrEWszWeakKeyDictionary.__init__cCs:|j}|j}|r6z||��=Wqtk
r2YqXqdSr')r:r=rFrK)rrGrHrrrrIhsz"WeakKeyDictionary._commit_removalscs&|j��fdd�|jD�|_d|_dS)Ncsg|]}|�kr|�qSrr)�.0rg�rHrr�
<listcomp>wsz5WeakKeyDictionary._scrub_removals.<locals>.<listcomp>F)r=r:r{rRrr}r�_scrub_removalsusz!WeakKeyDictionary._scrub_removalscCsd|_|jt|�=dSr0)r{r=rrOrrrrPzszWeakKeyDictionary.__delitem__cCs|jt|�Sr')r=rrOrrrrN~szWeakKeyDictionary.__getitem__cCs(|jr|jr|��t|j�t|j�Sr')r{r:rrQr=rRrrrrS�szWeakKeyDictionary.__len__cCsd|jjt|�fSrUrVrRrrrrX�szWeakKeyDictionary.__repr__cCs||jt||j�<dSr')r=rrArZrrrr\�szWeakKeyDictionary.__setitem__c	CsHt�}t|��0|j��D]\}}|�}|dk	r|||<qW5QRX|Sr')rrr=r])rr^r<r[rMrrrr_�s
zWeakKeyDictionary.copyc	Cs\ddlm}|��}t|��6|j��D]$\}}|�}|dk	r(|||�||<q(W5QRX|Sr`)r_rar+rr=r])rrbrar^r<r[rMrrrrc�s
zWeakKeyDictionary.__deepcopy__cCs|j�t|�|�Sr')r=rer�rr<rdrrrre�szWeakKeyDictionary.getcCs.zt|�}Wntk
r"YdSX||jkSr)rr r=)rr<r>rrrrT�s
zWeakKeyDictionary.__contains__c	csDt|��2|j��D] \}}|�}|dk	r||fVqW5QRXdSr'�rr=r])rr>r[r<rrrr]�s

zWeakKeyDictionary.itemsc	cs8t|��&|jD]}|�}|dk	r|VqW5QRXdSr')rr=rmrrrri�s


zWeakKeyDictionary.keysc	cs<t|��*|j��D]\}}|�dk	r|VqW5QRXdSr'r�)rr>r[rrrrk�s

zWeakKeyDictionary.valuescCs
t|j�S)azReturn a list of weak references to the keys.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the keys around longer than needed.

        )rur=rRrrr�keyrefs�s
zWeakKeyDictionary.keyrefscCs0d|_|j��\}}|�}|dk	r||fSqdSr0)r{r=rn)rr<r[rMrrrrn�s
zWeakKeyDictionary.popitemcGsd|_|jjt|�f|��Sr0)r{r=rFr)rr<rorrrrF�szWeakKeyDictionary.popcCs|j�t||j�|�Sr')r=rprrAr�rrrrp�szWeakKeyDictionary.setdefaultcKs\|j}|dk	rFt|d�s$ti�|�}|��D]\}}||t||j�<q,t|�rX|�|�dSrq)r=rrr"r]rrArQrC)rrsrtrHr<r[rrrrC�s
zWeakKeyDictionary.update)N)N)N)N)r2r3r4r5rErIrrPrNrSrXr\r_rwrcrerTr]rirxrkr�rnrFrprCrrrrrLs.


	


c@s�eZdZdZdZiZdZe��Z	dZ
dZGdd�d�Zdd�Z
de
_dd
d�Zdd
�Zdd�Zedd��Zedd��Zejdd��Zdd�Zedd��Zedd��Zd	S)raClass for finalization of weakrefable objects

    finalize(obj, func, *args, **kwargs) returns a callable finalizer
    object which will be called when obj is garbage collected. The
    first time the finalizer is called it evaluates func(*arg, **kwargs)
    and returns the result. After this the finalizer is dead, and
    calling it just returns None.

    When the program exits any remaining finalizers for which the
    atexit attribute is true will be run in reverse order of creation.
    By default atexit is true.
    rFc@seZdZdZdS)zfinalize._Info)�weakrefr&rort�atexit�indexN)r2r3r4r6rrrr�_Infosr�cOs>t|�dkr|^}}}}n�|s(td��n�d|krDtdt|�d��|�d�}t|�dkr~|^}}}ddl}|jdtdd	�nFd
|kr�tdt|�d��|�d
�}|^}}ddl}|jdtdd	�t|�}|js�ddl}|�	|j
�dt_|��}t
||�|_||_||_|�pd|_d|_t|j�|_||j|<dt_dS)
N�z<descriptor '__init__' of 'finalize' object needs an argumentr&z9finalize expected at least 2 positional arguments, got %d��rz0Passing 'func' as keyword argument is deprecated)�
stacklevelr%z/Passing 'obj' as keyword argument is deprecatedT)rQr rF�warnings�warn�DeprecationWarning�tuple�_registered_with_atexitr��register�	_exitfuncrr�rr�r&rort�next�_index_iterr��	_registry�_dirty)rortrr%r&r�r��inforrrrEsR

�

�
�
�
zfinalize.__init__z&($self, obj, func, /, *args, **kwargs)NcCs0|j�|d�}|r,|js,|j|j|jp(i�SdS)zZIf alive then mark as dead and return func(*args, **kwargs);
        otherwise return NoneN)r�rF�	_shutdownr&rort)r�_r�rrrr)1s
zfinalize.__call__cCsH|j�|�}|o|��}|dk	rD|j�|d�rD||j|j|jp@ifSdS)z^If alive then mark as dead and return (obj, func, args, kwargs);
        otherwise return NoneN)r�rer�rFr&rort�rr�r%rrr�detach8szfinalize.detachcCs:|j�|�}|o|��}|dk	r6||j|j|jp2ifSdS)zMIf alive then return (obj, func, args, kwargs);
        otherwise return NoneN)r�rer�r&rortr�rrr�peek@sz
finalize.peekcCs
||jkS)zWhether finalizer is alive)r�rRrrr�aliveHszfinalize.alivecCs|j�|�}t|�o|jS)z*Whether finalizer should be called at exit�r�re�boolr�)rr�rrrr�Mszfinalize.atexitcCs|j�|�}|rt|�|_dSr'r�)rr[r�rrrr�SscCs^|j�|�}|o|��}|dkr6dt|�jt|�fSdt|�jt|�t|�jt|�fSdS)Nz<%s object at %#x; dead>z!<%s object at %#x; for %r at %#x>)r�rer�r"r2rWr�rrrrXYs�zfinalize.__repr__cCs2dd�|j��D�}|jdd�d�dd�|D�S)NcSsg|]\}}|jr||f�qSr)r��r|�f�irrrr~esz-finalize._select_for_exit.<locals>.<listcomp>cSs
|djS)Nr�)r�)�itemrrr�<lambda>f�z+finalize._select_for_exit.<locals>.<lambda>rycSsg|]\}}|�qSrrr�rrrr~gs)r�r]�sort)r$�Lrrr�_select_for_exitbszfinalize._select_for_exitcCs�d}z�|jr�ddl}|��r(d}|��d}|dks:tjrH|��}dt_|sNq�|�	�}z
|�Wn"t
k
r�tjt�
��YnX||jks,t�q,W5dt_|r�|��XdS)NFTr)rr�Zenabler��gcZ	isenabledZdisabler�r�rF�	Exception�sys�
excepthook�exc_info�AssertionError)r$Zreenable_gcr�Zpendingr�rrrr�is,
zfinalize._exitfunc)N)r2r3r4r5r6r�r��	itertools�countr�r�r�r�rE�__text_signature__r)r�r��propertyr�r��setterrX�classmethodr�r�rrrrr�s0*



	
)r5�_weakrefrrrrrrrr	Z_weakrefsetr
r�_collections_abcr�r�r
�__all__r�MutableMappingrrYrrrrrr�<module>s0(
�6^imp.cpython-38.opt-1.pyc000064400000023123150335716500010726 0ustar00U

e5d()�@s�dZddlmZmZmZmZmZmZmZm	Z	m
Z
zddlmZWnek
rXdZYnXddl
mZmZmZmZddlmZddlmZddlmZddlZddlZddlZddlZddlZddlZejd	ed
d�dZdZd
Z d
Z!dZ"dZ#dZ$dZ%dZ&dZ'dd�Z(dd�Z)dd�Z*d8dd�Z+dd�Z,dd�Z-Gd d!�d!�Z.Gd"d#�d#�Z/Gd$d%�d%e/ej0�Z1d9d&d'�Z2Gd(d)�d)e/e�Z3d:d*d+�Z4d,d-�Z5d.d/�Z6d;d0d1�Z7d2d3�Z8d4d5�Z9e�r�d<d6d7�Z:ndZ:dS)=z�This module provides the components needed to build your own __import__
function.  Undocumented functions are obsolete.

In most cases it is preferred you consider using the importlib module's
functionality over this module.

�)	�	lock_held�acquire_lock�release_lock�get_frozen_object�is_frozen_package�init_frozen�
is_builtin�	is_frozen�_fix_co_filename)�create_dynamicN)�_ERR_MSG�_exec�_load�_builtin_from_name)�SourcelessFileLoader)�	machinery)�utilzhthe imp module is deprecated in favour of importlib; see the module's documentation for alternative uses�)�
stacklevel��������	cCs
t�|�S)z_**DEPRECATED**

    Create a new module.

    The module is not entered into sys.modules.

    )�types�
ModuleType��name�r!�/usr/lib64/python3.8/imp.py�
new_module0sr#cCstjS)z@**DEPRECATED**

    Return the magic number for .pyc files.
    )r�MAGIC_NUMBERr!r!r!r"�	get_magic;sr%cCstjjS)z$Return the magic tag for .pyc files.)�sys�implementation�	cache_tagr!r!r!r"�get_tagCsr)c
Cs6t���$t�d�t�||�W5QR�SQRXdS)a�**DEPRECATED**

    Given the path to a .py file, return the path to its .pyc file.

    The .py file does not need to exist; this simply returns the path to the
    .pyc file calculated as if the .py file were imported.

    If debug_override is not None, then it must be a boolean and is used in
    place of sys.flags.optimize.

    If sys.implementation.cache_tag is None then NotImplementedError is raised.

    �ignoreN)�warnings�catch_warnings�simplefilterr�cache_from_source)�path�debug_overrider!r!r"r.Hs

r.cCs
t�|�S)a~**DEPRECATED**

    Given the path to a .pyc. file, return the path to its .py file.

    The .pyc file does not need to exist; this simply returns the path to
    the .py file calculated to correspond to the .pyc file.  If path does
    not conform to PEP 3147 format, ValueError will be raised. If
    sys.implementation.cache_tag is None then NotImplementedError is raised.

    )r�source_from_cache�r/r!r!r"r1[sr1cCs<dd�tjD�}dd�tjD�}dd�tjD�}|||S)�**DEPRECATED**cSsg|]}|dtf�qS��rb)�C_EXTENSION��.0�sr!r!r"�
<listcomp>ksz get_suffixes.<locals>.<listcomp>cSsg|]}|dtf�qS)�r)�	PY_SOURCEr7r!r!r"r:lscSsg|]}|dtf�qSr4)�PY_COMPILEDr7r!r!r"r:ms)r�EXTENSION_SUFFIXES�SOURCE_SUFFIXES�BYTECODE_SUFFIXES)�
extensions�source�bytecoder!r!r"�get_suffixesisrDc@s eZdZdZdd�Zdd�ZdS)�NullImporterz-**DEPRECATED**

    Null import object.

    cCs2|dkrtddd��ntj�|�r.td|d��dS)N�zempty pathnamer2zexisting directory)�ImportError�osr/�isdir)�selfr/r!r!r"�__init__zszNullImporter.__init__cCsdS)zAlways returns None.Nr!)rJ�fullnamer!r!r"�find_module�szNullImporter.find_moduleN)�__name__�
__module__�__qualname__�__doc__rKrMr!r!r!r"rErsrEcs.eZdZdZd�fdd�	Z�fdd�Z�ZS)�_HackedGetDatazMCompatibility support for 'file' arguments of various load_*()
    functions.Ncst��||�||_dS)N)�superrK�file)rJrLr/rT��	__class__r!r"rK�sz_HackedGetData.__init__c
s||jrl||jkrl|jjs0|j}d|jkr0|��|jjrJt|jd�|_}|�|��W5QR�SQRXnt��|�SdS)z;Gross hack to contort loader to deal w/ load_*()'s bad API.�br5N)	rTr/�closed�mode�close�open�readrS�get_data)rJr/rTrUr!r"r]�s
z_HackedGetData.get_data)N)rNrOrPrQrKr]�
__classcell__r!r!rUr"rR�srRc@seZdZdZdS)�_LoadSourceCompatibilityz5Compatibility support for implementing load_source().N�rNrOrPrQr!r!r!r"r_�sr_cCs\t|||�}tj|||d�}|tjkr8t|tj|�}nt|�}t�||�|_	|j	|j
_|S)N��loader)r_r�spec_from_file_locationr&�modulesr
rr�SourceFileLoader�
__loader__�__spec__rb�r �pathnamerTrb�spec�moduler!r!r"�load_source�s

rlc@seZdZdZdS)�_LoadCompiledCompatibilityz7Compatibility support for implementing load_compiled().Nr`r!r!r!r"rm�srmcCsZt|||�}tj|||d�}|tjkr8t|tj|�}nt|�}t||�|_|j|j	_
|S)r3ra)rmrrcr&rdr
rrrfrgrbrhr!r!r"�
load_compiled�s

rncCs�tj�|�rftjdd�tjdd�}|D]*}tj�|d|�}tj�|�r,|}qfq,td�	|���t
j||gd�}|tj
kr�t|tj
|�St|�SdS)r3NrKz{!r} is not a package)�submodule_search_locations)rHr/rIrr?r@�join�exists�
ValueError�formatrrcr&rdr
r)r r/rA�	extensionZ	init_pathrjr!r!r"�load_package�s ��
ruc	
Cs$|\}}}|r0|�d�r d|kr0td�|���n�|dkrX|tthkrXd�|�}t|��n�|tkrlt|||�S|tkr�t|||�S|tkr�tdk	r�|dkr�t	|d��}t|||�W5QR�SQRXnt|||�SnN|t
kr�t||�S|tk�r�t
|�S|tk�rt|�Sd�||�}t||d��dS)	z�**DEPRECATED**

    Load a module, given information returned by find_module().

    The module name must include the full package name, if any.

    )r;�U�+zinvalid file open mode {!r}Nz.file object required for import (type code {})r5z*Don't know how to import {} (type code {})r)�
startswithrrrsr<r=rlrnr6�load_dynamicr[�
PKG_DIRECTORYru�	C_BUILTIN�init_builtin�	PY_FROZENrrG)	r rT�filenameZdetails�suffixrY�type_�msgZopened_filer!r!r"�load_module�s.


 


r�c	Cs�t|t�std�t|����n$t|td�tf�sBtd�t|����|dkr�t|�rbddddtffSt	|�rzddddt
ffStj}|D]�}t
j�||�}dtjdfD]>}d|}t
j�||�}t
j�|�r�d|ddtffSq�t�D]2\}}}||}	t
j�||	�}t
j�|�r��q q�q��q:q�tt�|�|d��d}
d	|k�rnt|d
��}t�|j�d}
W5QRXt|||
d�}|||||ffS)a,**DEPRECATED**

    Search for a module.

    If path is omitted or None, search for a built-in, frozen or special
    module and continue search in sys.path. The module name cannot
    contain '.'; to search for a submodule of a package, pass the
    submodule name and the package's __path__.

    z'name' must be a str, not {}Nz%'path' must be None or a list, not {}rFz.pyrrKrrWr5)�encoding)�
isinstance�str�	TypeErrorrs�type�list�RuntimeErrorrr{r	r}r&r/rHrprr@�isfilerzrDrGrr[�tokenize�detect_encoding�readline)r r/�entryZpackage_directoryrZpackage_file_nameZ	file_pathrYr��	file_namer�rTr!r!r"rM�sB
�
rMcCs
t�|�S)zw**DEPRECATED**

    Reload the module and return it.

    The module must have been successfully imported before.

    )�	importlib�reload)rkr!r!r"r�2sr�cCs&z
t|�WStk
r YdSXdS)zl**DEPRECATED**

    Load and return a built-in module by name, or None is such module doesn't
    exist
    N)rrGrr!r!r"r|=s
r|cCs0ddl}|j�||�}|jj|||d�}t|�S)z:**DEPRECATED**

        Load an extension module.
        rN)r rb�origin)�importlib.machineryr�ExtensionFileLoader�
ModuleSpecr)r r/rTr�rbrjr!r!r"ryJs�ry)N)N)N)N)N);rQ�_imprrrrrrrr	r
rrGZimportlib._bootstraprr
rrZimportlib._bootstrap_externalrr�rrrHr&r�rr+�warn�DeprecationWarningZSEARCH_ERRORr<r=r6ZPY_RESOURCErzr{r}ZPY_CODERESOURCEZIMP_HOOKr#r%r)r.r1rDrErRrer_rlrmrnrur�rMr�r|ryr!r!r!r"�<module>sb,
�
	

#
4socket.cpython-38.opt-2.pyc000064400000045742150335716500011445 0ustar00U

e5d���@sddlZddlTddlZddlZddlZddlZddlmZmZzddlZWne	k
rddZYnXe
edd�Ze
edd�Ze
edd�Z
d	d
ddd
ddgZe�e�e��e�dedd��e�dedd��e�dedd��e�dedd��dZdZdd�ZeZej���d��r iZded<ded<d ed!<d"ed#<d$ed%<d&ed'<d(ed)<d*ed+<d,ed-<d.ed/<d0ed1<d2ed3<d4ed5<d6ed7<d8ed9<d:ed;<d<ed=<d>ed?<d@edA<dBedC<dDedE<dFedG<dHedI<dJedK<dLedM<dNedO<dPedQ<dRedS<dTedU<dVedW<dXedY<dZed[<d\ed]<d^ed_<d`eda<dbedc<ddede<dfedg<dhedi<djedk<dledm<dnedo<dpedq<dreds<dtedu<dvedw<dxedy<dzed{<d|ed}<d~ed<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<e�dءGd�dڄd�e�ZGd�d܄d�ej�Zd�d�d	�Ze ejdރ�rld�d�Z!e�d�e ed��r�de"dfd�d�Z#ne$e"dfd�d�Z#e�d�d�e#_%ee
hZ&Gd�d�d�ej'�Z(d�d�d
�Z)e*�Z+e+dfd�d�Z,d�d
�Z-e$dd�d�d�d�d�Z.d�d�d�Z/dS)��N)�*)�IntEnum�IntFlag�EBADF�	�EAGAIN��EWOULDBLOCK�fromfd�getfqdn�create_connection�
create_server�has_dualstack_ipv6�
AddressFamily�
SocketKindcCs|��o|�d�S)NZAF_��isupper�
startswith��C�r�/usr/lib64/python3.8/socket.py�<lambda>L�rcCs|��o|�d�S)NZSOCK_rrrrrrQrZMsgFlagcCs|��o|�d�S)NZMSG_rrrrrrVrZAddressInfocCs|��o|�d�S)NZAI_rrrrrr[rz	127.0.0.1z::1cCs(z
||�WStk
r"|YSXdS�N)�
ValueError)�valueZ
enum_klassrrr�_intenum_converteras
r�winz)Specified event object handle is invalid.�zInsufficient memory available.�z#One or more parameters are invalid.�WzOverlapped operation aborted.i�z2Overlapped I/O event object not in signaled state.i�z)Overlapped operation will complete later.i�zThe operation was interrupted.i'zA bad file handle was passed.i'zPermission denied.i'z!A fault occurred on the network??i'z#An invalid operation was attempted.i&'zToo many open files.i('z The socket operation would blocki3'z,A blocking operation is already in progress.i4'zOperation already in progress.i5'zSocket operation on nonsocket.i6'zDestination address required.i7'zMessage too long.i8'zProtocol wrong type for socket.i9'zBad protocol option.i:'zProtocol not supported.i;'zSocket type not supported.i<'zOperation not supported.i='zProtocol family not supported.i>'z0Address family not supported by protocol family.i?'zThe network address is in use.i@'z Cannot assign requested address.iA'zNetwork is down.iB'zNetwork is unreachable.iC'z$Network dropped connection on reset.iD'z!Software caused connection abort.iE'zThe connection has been reset.iF'zNo buffer space available.iG'zSocket is already connected.iH'zSocket is not connected.iI'zThe network has been shut down.iJ'zToo many references.iK'zThe operation timed out.iL'zConnection refused.iM'zCannot translate name.iN'zThe name is too long.iO'zThe host is down.iP'zThe host is unreachable.iQ'zDirectory not empty.iR'zToo many processes.iS'zUser quota exceeded.iT'zDisk quota exceeded.iU'zStale file handle reference.iV'zItem is remote.iW'z!Network subsystem is unavailable.ik'z!Winsock.dll version out of range.il'z(Successful WSAStartup not yet performed.im'zGraceful shutdown in progress.iu'z*No more results from WSALookupServiceNext.iv'zCall has been canceled.iw'z Procedure call table is invalid.ix'zService provider is invalid.iy'z&Service provider failed to initialize.iz'zSystem call failure.i{'zService not found.i|'zClass type not found.i}'i~'zCall was canceled.i'zDatabase query was refused.i�'zHost not found.i�*z Nonauthoritative host not found.i�*zThis is a nonrecoverable error.i�*z*Valid name, no data record requested type.i�*zQoS receivers.i�*zQoS senders.i�*zNo QoS senders.i�*zQoS no receivers.i+zQoS request confirmed.i+zQoS admission error.i+zQoS policy failure.i+zQoS bad style.i+zQoS bad object.i+zQoS traffic control error.i+zQoS generic error.i+zQoS service type error.i+zQoS flowspec error.i	+zInvalid QoS provider buffer.i
+zInvalid QoS filter style.i+i+zIncorrect QoS filter count.i
+zInvalid QoS object length.i+zIncorrect QoS flow count.i+zUnrecognized QoS object.i+zInvalid QoS policy object.i+zInvalid QoS flow descriptor.i+z'Invalid QoS provider-specific flowspec.i+z)Invalid QoS provider-specific filterspec.i+z&Invalid QoS shape discard mode object.i+z Invalid QoS shaping rate object.i+z!Reserved policy QoS element type.i+�errorTabc@seZdZdS)�_GiveupOnSendfileN)�__name__�
__module__�__qualname__rrrrr#�sr#cs(eZdZdddgZd8dd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
d9dddd�dd�Zee
d�rvd:dd�Zn
d;dd�Zd<dd�Zdd �Zd=d!d"�Zd#d$�Zejfd%d&�Zd'd(�Z�fd)d*�Ze�fd+d,��Ze�fd-d.��Ze
jd/k�rd0d1�Zd2d3�Znd4d1�Zd5d3�Zd6e_d7e_�ZS)>�socket�__weakref__�_io_refs�_closed���NcCsP|dkr,|dkrt}|dkr t}|dkr,d}tj�|||||�d|_d|_dS)Nr+rF)�AF_INET�SOCK_STREAM�_socketr'�__init__r)r*)�self�family�type�proto�filenorrrr/�szsocket.__init__cCs|Srr�r0rrr�	__enter__�szsocket.__enter__cGs|js|��dSr)r*�close)r0�argsrrr�__exit__�szsocket.__exit__cCs�t|dd�}d|jj|jj|r"dnd|��|j|j|jf}|s�z |��}|r^|dt	|�7}Wnt
k
rtYnXz |��}|r�|dt	|�7}Wnt
k
r�YnX|d7}|S)	Nr*Fz,<%s.%s%s fd=%i, family=%s, type=%s, proto=%iz	 [closed]�z
, laddr=%sz
, raddr=%s�>)�getattr�	__class__r%r&r4r1r2r3�getsockname�str�errorZgetpeername)r0�closed�sZladdrZraddrrrr�__repr__�s4
��zsocket.__repr__cCstd|jj�d���dS)Nzcannot pickle z object)�	TypeErrorr=r$r5rrr�__getstate__szsocket.__getstate__cCs6t|���}|j|j|j|j|d�}|�|���|S)N�r4)�dupr4r=r1r2r3�
settimeout�
gettimeout)r0�fd�sockrrrrGsz
socket.dupcCsF|��\}}t|j|j|j|d�}t�dkr>|��r>|�d�||fS)NrFT)Z_acceptr'r1r2r3ZgetdefaulttimeoutrI�setblocking)r0rJ�addrrKrrr�accepts

z
socket.accept�r)�encoding�errors�newlinec
Cs�t|�dddhks td|f��d|k}d|kp4|}d|k}d}	|rN|	d7}	|rZ|	d7}	t||	�}
|jd7_|dkr~d}|dkr�tj}|dkr�|s�td	��|
S|r�|r�t�|
|
|�}n|r�t�|
|�}nt�|
|�}|r�|St�	||||�}||_
|S)
NrO�w�bz&invalid mode %r (only r, w, b allowed)r:�r+rz!unbuffered streams must be binary)�setr�SocketIOr)�io�DEFAULT_BUFFER_SIZE�BufferedRWPair�BufferedReader�BufferedWriter�
TextIOWrapper�mode)
r0r^�	bufferingrPrQrRZwritingZreadingZbinaryZrawmode�raw�buffer�textrrr�makefile-s<
zsocket.makefile�sendfilerc
Cs�|�|||�|��}z|��}Wn0ttjfk
rR}zt|��W5d}~XYnXzt�|�j}Wn*t	k
r�}zt|��W5d}~XYnX|s�dSt
|p�|d�}|��}	|	dkr�td��t
td�r�t��}
nt��}
|
�|tj�d}|
j}tj}
z�|	�r||	��st�d��|�r0||}|dk�r0�q�z|
||||�}Wn`tk
�rh|	�s`|�Yq�Yq�t	k
�r�}z|dk�r�t|��|d�W5d}~XYq�X|dk�r��q�||7}||7}q�|W�S|dk�r�t
|d��r�|�|�XdS)Nri@�&non-blocking sockets are not supported�PollSelector�seekz	timed out)�_check_sendfile_paramsr4�AttributeErrorrX�UnsupportedOperationr#�os�fstat�st_size�OSError�minrIr�hasattr�	selectorsrfZSelectSelector�registerZEVENT_WRITEZselectrdrgr.�timeout�BlockingIOError)r0�file�offset�countZsocknor4�errZfsize�	blocksizersZselector�
total_sentZselector_selectZos_sendfile�sentrrr�_sendfile_use_sendfileYs^






zsocket._sendfile_use_sendfilecCstd��dS)Nz,os.sendfile() not available on this platform)r#�r0rurvrwrrrr|�s�c

Cs�|�|||�|��dkr"td��|r0|�|�|r>t|d�nd}d}|j}|j}z�|rpt|||�}|dkrpq�t||��}|s�q�z||�}	Wnt	k
r�Yq�Yq�X||	7}|	t
|�kr�||	d�}q�qTq�qT|W�S|dkr�t|d�r�|�||�XdS)Nrrei rg)rhrIrrgro�read�sendrp�
memoryviewrt�len)
r0rurvrwryrzZ	file_readZ	sock_send�datar{rrr�_sendfile_use_send�s8

zsocket._sendfile_use_sendcCsddt|dd�krtd��|jt@s*td��|dk	r`t|t�sJtd�|���|dkr`td�|���dS)NrTr^z$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})r)r<rr2r-�
isinstance�intrD�formatr}rrrrh�s

��zsocket._check_sendfile_paramscCs8z|�|||�WStk
r2|�|||�YSXdSr)r|r#r�r}rrrrd�szsocket.sendfilecCs*|jdkr|jd8_|jr&|��dS)NrrU)r)r*r7r5rrr�_decref_socketios�s
zsocket._decref_socketioscCs|�|�dSr)r7)r0Z_ssrrr�_real_close�szsocket._real_closecCsd|_|jdkr|��dS)NTr)r*r)r�r5rrrr7�s
zsocket.closecsd|_t���S)NT)r*�super�detachr5�r=rrr��sz
socket.detachcstt�jt�Sr)rr�r1rr5r�rrr1sz
socket.familycstt�jt�Sr)rr�r2rr5r�rrr2szsocket.type�ntcCst�|���Sr)rkZget_handle_inheritabler4r5rrr�get_inheritable
szsocket.get_inheritablecCst�|��|�dSr)rkZset_handle_inheritabler4�r0Zinheritablerrr�set_inheritableszsocket.set_inheritablecCst�|���Sr)rkr�r4r5rrrr�scCst�|��|�dSr)rkr�r4r�rrrr�sz&Get the inheritable flag of the socketz&Set the inheritable flag of the socket)r+r+r+N)rON)rN)rN)rN)rN) r$r%r&�	__slots__r/r6r9rCrErGrNrcrprkr|r�rhrdr�r.r'r�r7r��propertyr1r2�namer�r��__doc__�
__classcell__rrr�rr'�sD

�*
A

$


r'cCst|�}t||||�Sr)rGr')rJr1r2r3Znfdrrrr
sZsharecCstddd|�S�Nr)r')�inforrr�	fromshare#sr��
socketpaircCsh|dkr*zt}Wntk
r(t}YnXt�|||�\}}t||||���}t||||���}||fSr)ZAF_UNIX�	NameErrorr,r.r�r'r�)r1r2r3�arTrrrr�.s
c
	Cs|tkrt}n|tkrt}ntd��|tkr4td��|dkrDtd��t|||�}z�|�|df�|�	�|�
�dd�\}}t|||�}zP|�d�z|�||f�Wnt
tfk
r�YnX|�d�|��\}}	Wn|���YnXW5|��X||fS)Nz?Only AF_INET and AF_INET6 socket address families are supportedz)Only SOCK_STREAM socket type is supportedrzOnly protocol zero is supported�FT)r,�
_LOCALHOST�AF_INET6�
_LOCALHOST_V6rr-r'r7�bind�listenr>rL�connectrt�InterruptedErrorrN)
r1r2r3�hostZlsockrM�portZcsockZssock�_rrrr�Cs8


a8socketpair([family[, type[, proto]]]) -> (socket object, socket object)
Create a pair of socket objects from the sockets returned by the platform
socketpair() function.
The arguments are the same as for socket() except the default family is AF_UNIX
if defined on the platform; otherwise, the default is AF_INET.
csleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Z�fdd�Zd
d�Z	e
dd��Ze
dd��Zdd�Z
�ZS)rWcCsZ|dkrtd|��tj�|�||_d|kr6|d7}||_d|k|_d|k|_d|_dS)N)rOrSZrw�rb�wbZrwbzinvalid mode: %rrTrOrSF)	rrX�	RawIOBaser/�_sock�_mode�_reading�_writing�_timeout_occurred)r0rKr^rrrr/�s

zSocketIO.__init__c
Cs�|��|��|jrtd��z|j�|�WStk
rHd|_�Yqtk
r�}z|jdt	krpWY�
dS�W5d}~XYqXqdS)Nz!cannot read from timed out objectTr)
�_checkClosed�_checkReadabler�rnr�Z	recv_intorsr@r8�_blocking_errnos�r0rT�errr�readinto�s
zSocketIO.readintoc
Cs`|��|��z|j�|�WStk
rZ}z|jdtkrHWY�
dS�W5d}~XYnXdSr�)r��_checkWritabler�rr@r8r�r�rrr�write�s
zSocketIO.writecCs|jrtd��|jS�NzI/O operation on closed socket.)rArr�r5rrr�readable�szSocketIO.readablecCs|jrtd��|jSr�)rArr�r5rrr�writable�szSocketIO.writablecs|jrtd��t���Sr�)rArr��seekabler5r�rrr��szSocketIO.seekablecCs|��|j��Sr)r�r�r4r5rrrr4�szSocketIO.filenocCs|js|��SdSdS)Nr+)rAr4r5rrrr��sz
SocketIO.namecCs|jSr)r�r5rrrr^�sz
SocketIO.modecCs*|jr
dStj�|�|j��d|_dSr)rArXr�r7r�r�r5rrrr7�s

zSocketIO.close)r$r%r&r/r�r�r�r�r�r4r�r�r^r7r�rrr�rrWrs

rWr:cCsl|��}|r|dkrt�}zt|�\}}}Wntk
r@Yn(X|�d|�|D]}d|krRqhqR|}|S)Nz0.0.0.0r�.)�stripZgethostnameZ
gethostbyaddrr@�insert)r�Zhostname�aliasesZipaddrsrrrr�s	cCs�|\}}d}t||dt�D]�}|\}}}	}
}d}zDt|||	�}|tk	rP|�|�|r^|�|�|�|�d}|WStk
r�}
z|
}|dk	r�|��W5d}
~
XYqXq|dk	r�z|�W5d}Xntd��dS)Nrz!getaddrinfo returns an empty list)	�getaddrinfor-r'�_GLOBAL_DEFAULT_TIMEOUTrHr�r�r@r7)�addressrsZsource_addressr�r�rx�res�af�socktyper3�	canonname�sarKr�rrrrs.



c	Csltrttd�rttd�sdSz4ttt�� }|�ttd�W5QR�WdSQRXWnt	k
rfYdSXdS)N�IPPROTO_IPV6�IPV6_V6ONLYFrT)
�has_ipv6rpr.r'r�r-�
setsockoptr�r�r@)rKrrrr0s��F)r1�backlog�
reuse_port�dualstack_ipv6c
Csn|rttd�std��|r8t�s(td��|tkr8td��t|t�}�ztjdkr�ttd�r�z|�	t
td�Wntk
r�YnX|r�|�	t
t
d�tr�|tkr�|r�|�	ttd�n"ttd	�r�ttd
�r�|�	ttd�z|�|�Wn@tk
�r$}z d|j|f}t|j|�d�W5d}~XYnX|dk�r:|��n
|�|�|WStk
�rh|���YnXdS)N�SO_REUSEPORTz+SO_REUSEPORT not supported on this platformz-dualstack_ipv6 not supported on this platformz'dualstack_ipv6 requires AF_INET6 family)r��cygwin�SO_REUSEADDRrUrr�r�z+%s (while attempting to bind on address %r))rpr.rrr�r'r-rkr�r�Z
SOL_SOCKETr�r@r�r�r�r�r��strerror�errnor�r7)r�r1r�r�r�rKrx�msgrrrr
@sN


�
�� 


cCsPg}t�||||||�D]2}|\}}	}}
}|�t|t�t|	t�||
|f�q|Sr)r.r��appendrrr)r�r�r1r2r3�flagsZaddrlistr�r�r�r�r�rrrr��s�r�)r)r:)rrrr)0r.rk�sysrXrq�enumrrr��ImportErrorr<rrr	�__all__�extend�_get_exports_list�	_convert_r$r�r�rr'Z_realsocket�platform�lowerrr"r��	Exceptionr#r
rpr�r-r�r,r�r�r�rWr�objectr�rrr
r�rrrr�<module>1sF 
�����

F
	
$
u
�
-�Eio.cpython-38.opt-1.pyc000064400000006600150335716500010551 0ustar00U

e5d�
�@sjdZdZdddddddd	d
ddd
dddddddgZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZejZde_dZdZdZGdd�dejejd�ZGdd�deje�ZGdd
�d
eje�ZGdd�deje�Z e�!e
�ee
eeefD]Z"e�!e"��qeefD]Z"e �!e"��q ["zdd lm#Z#Wne$k
�rZYnXe�!e#�dS)!a�The io module provides the Python interfaces to stream handling. The
builtin open function is defined in this module.

At the top of the I/O hierarchy is the abstract base class IOBase. It
defines the basic interface to a stream. Note, however, that there is no
separation between reading and writing to streams; implementations are
allowed to raise an OSError if they do not support a given operation.

Extending IOBase is RawIOBase which deals simply with the reading and
writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide
an interface to OS files.

BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its
subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer
streams that are readable, writable, and both respectively.
BufferedRandom provides a buffered interface to random access
streams. BytesIO is a simple stream of in-memory bytes.

Another IOBase subclass, TextIOBase, deals with the encoding and decoding
of streams into text. TextIOWrapper, which extends it, is a buffered text
interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO
is an in-memory stream for text.

Argument names are not part of the specification, and only the arguments
of open() are intended to be used as keyword arguments.

data:

DEFAULT_BUFFER_SIZE

   An int containing the default buffer size used by the module's buffered
   I/O classes. open() uses the file's blksize (as obtained by os.stat) if
   possible.
z�Guido van Rossum <guido@python.org>, Mike Verdone <mike.verdone@gmail.com>, Mark Russell <mark.russell@zen.co.uk>, Antoine Pitrou <solipsis@pitrou.net>, Amaury Forgeot d'Arc <amauryfa@gmail.com>, Benjamin Peterson <benjamin@python.org>�BlockingIOError�open�	open_code�IOBase�	RawIOBase�FileIO�BytesIO�StringIO�BufferedIOBase�BufferedReader�BufferedWriter�BufferedRWPair�BufferedRandom�
TextIOBase�
TextIOWrapper�UnsupportedOperation�SEEK_SET�SEEK_CUR�SEEK_END�N)�DEFAULT_BUFFER_SIZErrrrrrrr
rrr
�IncrementalNewlineDecoderr�io��c@seZdZejjZdS)rN)�__name__�
__module__�__qualname__�_io�_IOBase�__doc__�r r �/usr/lib64/python3.8/io.pyrHs)�	metaclassc@seZdZejjZdS)rN)rrrr�
_RawIOBaserr r r r!rKsc@seZdZejjZdS)r	N)rrrr�_BufferedIOBaserr r r r!r	Nsc@seZdZejjZdS)rN)rrrr�_TextIOBaserr r r r!rQs)�_WindowsConsoleIO)%r�
__author__�__all__r�abcrrrrrrrrr
rrr
rr�OpenWrapperrrrrr�ABCMetarr#rr$r	r%r�register�klassr&�ImportErrorr r r r!�<module>sT$
�@
�pty.cpython-38.pyc000064400000007565150335716500010032 0ustar00U

e5d��@s�dZddlmZddlZddlZddlZdddgZdZdZdZdZ	d	d�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zeefdd�Zeefdd�ZdS)zPseudo terminal utilities.�)�selectN�openpty�fork�spawn��c	Cs>z
t��WSttfk
r"YnXt�\}}t|�}||fS)zdopenpty() -> (master_fd, slave_fd)
    Open a pty master/slave pair, using os.openpty() if possible.)�osr�AttributeError�OSError�_open_terminal�
slave_open)�	master_fd�
slave_name�slave_fd�r�/usr/lib64/python3.8/pty.pyrs

c	CsLzt��\}}Wnttfk
r(YnXt�|�}t�|�||fSt�S)z�master_open() -> (master_fd, slave_name)
    Open a pty master and return the fd, and the filename of the slave end.
    Deprecated, use openpty() instead.)rrr	r
�ttyname�closer)r
rrrrr�master_open"s

rc
CsndD]\}dD]R}d||}zt�|tj�}Wntk
rFYqYnX|d||fSqtd��dS)z1Open pty master and return (master_fd, tty_name).ZpqrstuvwxyzPQRSTZ0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devicesN)r�open�O_RDWRr
)�x�yZpty_name�fdrrrr2s
rcCsrt�|tj�}zddlm}m}Wntk
r:|YSXz|||d�|||d�Wntk
rlYnX|S)z�slave_open(tty_name) -> slave_fd
    Open the pty slave and acquire the controlling terminal, returning
    opened filedescriptor.
    Deprecated, use openpty() instead.r)�ioctl�I_PUSHZptemZldterm)rrrZfcntlrr�ImportErrorr
)Ztty_name�resultrrrrrr>s
rc	Cs�zt��\}}Wnttfk
r(Yn4X|tkrTzt��Wntk
rRYnX||fSt�\}}t��}|tkr�t��t�|�t�	|t
�t�	|t�t�	|t�|tkr�t�|�t�
t�t�tj�}t�|�n
t�|�||fS)zdfork() -> (pid, master_fd)
    Fork and make the child a session leader with a controlling terminal.)r�forkptyr	r
�CHILD�setsidrrr�dup2�STDIN_FILENO�
STDOUT_FILENO�
STDERR_FILENOrrr)�pidrr
rZtmp_fdrrrrPs0



cCs"|rt�||�}||d�}qdS)z#Write all the data to a descriptor.N)r�write)r�data�nrrr�_writenxsr)cCst�|d�S)zDefault read function.i)r�read)rrrr�_read~sr+cCsv|tg}t|gg�\}}}||krF||�}|s:|�|�nt�t|�t|kr|t�}|sf|�t�qt||�qdS)z�Parent copy loop.
    Copies
            pty master -> standard output   (master_read)
            standard input -> pty master    (stdin_read)N)r"r�removerr&r#r))r
�master_read�
stdin_readZfdsZrfdsZwfdsZxfdsr'rrr�_copy�sr/cCs�t|�td�kr|f}t�d|�t�\}}|tkrHtj|df|��zt�t	�}t�
t	�d}Wntjk
r~d}YnXzt|||�Wn(t
k
r�|r�t�t	tj|�YnXt�|�t�|d�dS)zCreate a spawned process.�z	pty.spawnrr)�type�sys�auditrrr�execlp�ttyZ	tcgetattrr"Zsetraw�errorr/r
Z	tcsetattrZ	TCSAFLUSHr�waitpid)�argvr-r.r%r
�modeZrestorerrrr�s&




)�__doc__rrr2r5�__all__r"r#r$rrrrrrr)r+r/rrrrr�<module>s$
(abc.cpython-38.opt-1.pyc000064400000012330150335716500010664 0ustar00U

e5d��@s�dZdd�ZGdd�de�ZGdd�de�ZGdd�de�Zz,d	d
lm	Z	m
Z
mZmZm
Z
mZmZmZWn*ek
r�d	dlmZm	Z	de_YnXGd
d�de�ZGdd�ded�ZdS)z3Abstract Base Classes (ABCs) according to PEP 3119.cCs
d|_|S)a<A decorator indicating abstract methods.

    Requires that the metaclass is ABCMeta or derived from it.  A
    class that has a metaclass derived from ABCMeta cannot be
    instantiated unless all of its abstract methods are overridden.
    The abstract methods can be called using any of the normal
    'super' call mechanisms.  abstractmethod() may be used to declare
    abstract methods for properties and descriptors.

    Usage:

        class C(metaclass=ABCMeta):
            @abstractmethod
            def my_abstract_method(self, ...):
                ...
    T)�__isabstractmethod__)�funcobj�r�/usr/lib64/python3.8/abc.py�abstractmethodsrcs$eZdZdZdZ�fdd�Z�ZS)�abstractclassmethodztA decorator indicating abstract classmethods.

    Deprecated, use 'classmethod' with 'abstractmethod' instead.
    Tcsd|_t��|�dS�NT�r�super�__init__��self�callable��	__class__rrr
$szabstractclassmethod.__init__��__name__�
__module__�__qualname__�__doc__rr
�
__classcell__rrrrrsrcs$eZdZdZdZ�fdd�Z�ZS)�abstractstaticmethodzvA decorator indicating abstract staticmethods.

    Deprecated, use 'staticmethod' with 'abstractmethod' instead.
    Tcsd|_t��|�dSrrrrrrr
1szabstractstaticmethod.__init__rrrrrr)src@seZdZdZdZdS)�abstractpropertyzoA decorator indicating abstract properties.

    Deprecated, use 'property' with 'abstractmethod' instead.
    TN)rrrrrrrrrr6sr�)�get_cache_token�	_abc_init�
_abc_register�_abc_instancecheck�_abc_subclasscheck�	_get_dump�_reset_registry�
_reset_caches)�ABCMetar�abccsReZdZdZ�fdd�Zdd�Zdd�Zdd	�Zddd�Zd
d�Z	dd�Z
�ZS)r!a�Metaclass for defining Abstract Base Classes (ABCs).

        Use this metaclass to create an ABC.  An ABC can be subclassed
        directly, and then acts as a mix-in class.  You can also register
        unrelated concrete classes (even built-in classes) and unrelated
        ABCs as 'virtual subclasses' -- these and their descendants will
        be considered subclasses of the registering ABC by the built-in
        issubclass() function, but the registering ABC won't show up in
        their MRO (Method Resolution Order) nor will method
        implementations defined by the registering ABC be callable (not
        even via super()).
        cs"t�j||||f|�}t|�|S)N)r	�__new__r)�mcls�name�bases�	namespace�kwargs�clsrrrr#TszABCMeta.__new__cCs
t||�S)z{Register a virtual subclass of an ABC.

            Returns the subclass, to allow usage as a class decorator.
            )r�r)�subclassrrr�registerYszABCMeta.registercCs
t||�S)z'Override for isinstance(instance, cls).)r)r)�instancerrr�__instancecheck__`szABCMeta.__instancecheck__cCs
t||�S)z'Override for issubclass(subclass, cls).)rr*rrr�__subclasscheck__dszABCMeta.__subclasscheck__NcCs�td|j�d|j��|d�tdt���|d�t|�\}}}}td|��|d�td|��|d�td|��|d�td|��|d�d	S)
z'Debug helper to print the ABC registry.zClass: �.)�filezInv. counter: z_abc_registry: z_abc_cache: z_abc_negative_cache: z_abc_negative_cache_version: N)�printrrrr)r)r1�
_abc_registry�
_abc_cache�_abc_negative_cache�_abc_negative_cache_versionrrr�_dump_registryhs�
�zABCMeta._dump_registrycCst|�dS)z.Clear the registry (for debugging or testing).N)r�r)rrr�_abc_registry_cleartszABCMeta._abc_registry_clearcCst|�dS)z,Clear the caches (for debugging or testing).N)r r8rrr�_abc_caches_clearxszABCMeta._abc_caches_clear)N)rrrrr#r,r.r/r7r9r:rrrrrr!Gs
r!c@seZdZdZdZdS)�ABCzVHelper class that provides a standard way to create an ABC using
    inheritance.
    rN)rrrr�	__slots__rrrrr;}sr;)�	metaclassN)rr�classmethodr�staticmethodr�propertyr�_abcrrrrrrrr �ImportErrorZ_py_abcr!r�typer;rrrr�<module>s

	,6pathlib.cpython-38.pyc000064400000126263150335716500010636 0ustar00U

e5d���@sjddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
mZmZddlmZddlmZmZmZmZmZmZmZddlmZdZejdkr�ddlZe� �dd	�d
kr�ddlm!Z!q�dZdZ!ndZd
dddddgZ"ee
eefZ#dZ$dd�Z%dd�Z&Gdd�de'�Z(Gdd�de(�Z)Gdd�de(�Z*e)�Z+e*�Z,Gdd�d�Z-Gd d!�d!e-�Z.e.�Z/d"d#�Z0e1ed$��r�e�2�e0�Z0Gd%d&�d&�Z3Gd'd(�d(�Z4Gd)d*�d*e3�Z5Gd+d,�d,e3�Z6Gd-d.�d.e3�Z7Gd/d0�d0e	�Z8Gd1d
�d
e'�Z9ej:�;e9�Gd2d�de9�Z<Gd3d�de9�Z=Gd4d�de9�Z>Gd5d�de>e<�Z?Gd6d�de>e=�Z@dS)7�N)�Sequence)�EINVAL�ENOENT�ENOTDIR�EBADF�ELOOP)�
attrgetter)�S_ISDIR�S_ISLNK�S_ISREG�S_ISSOCK�S_ISBLK�S_ISCHR�S_ISFIFO)�quote_from_bytesT�nt�)�r)�_getfinalpathnameF�PurePath�
PurePosixPath�PureWindowsPath�Path�	PosixPath�WindowsPath)��{i�cCs t|dd�tkpt|dd�tkS)N�errnoZwinerror)�getattr�_IGNORED_ERROS�_IGNORED_WINERRORS)Z	exception�r!�/usr/lib64/python3.8/pathlib.py�
_ignore_error.s�r#cCsd|kpd|kpd|kS)N�*�?�[r!)�patr!r!r"�_is_wildcard_pattern3sr(c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_FlavourzPA flavour implements a particular (platform-specific) set of path
    semantics.cCs|jj|_dS�N)�sep�join��selfr!r!r"�__init__=sz_Flavour.__init__cCsg}|j}|j}d}}t|�}|D]�}|s.q$|r>|�||�}|�|�\}}}	||	kr�t|	�|��D] }
|
rd|
dkrd|�t�|
��qdn|	r�|	dkr�|�t�|	��|s�|r$|s�|D]0}|s�q�|r�|�||�}|�|�d}|r�q�q�q�q$|s�|�r|�||�|�	�|||fS)N��.r)
r+�altsep�reversed�replace�	splitroot�split�append�sys�intern�reverse)r.�partsZparsedr+r2�drv�root�it�partZrel�xr!r!r"�parse_parts@s@
z_Flavour.parse_partscCsz|r*|sp|rp||||g|dd�fSnF|rb||ksJ|�|�|�|�krp||||dd�fSn||||fS|||fS)z�
        Join the two paths represented by the respective
        (drive, root, parts) tuples.  Return a new (drive, root, parts) tuple.
        �N)�casefold)r.r<r=r;Zdrv2Zroot2Zparts2r!r!r"�join_parsed_partsfsz_Flavour.join_parsed_partsN)�__name__�
__module__�__qualname__�__doc__r/rArDr!r!r!r"r)9s&r)c@s�eZdZdZdZdZeZej	dkZ
ed�ZdZ
ddd	d
hdd�ed
d�D�Bdd�ed
d�D�BZefdd�Zdd�Zdd�Zdd�Zd&dd�Ze
fdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%S)'�_WindowsFlavour�\�/TrZ4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZz\\?\ZCONZPRNZAUXZNULcCsh|]}d|�qS)zCOM%dr!��.0�ir!r!r"�	<setcomp>�sz_WindowsFlavour.<setcomp>rB�
cCsh|]}d|�qS)zLPT%dr!rLr!r!r"rO�scCs\|dd�}|dd�}||krP||krP|�|�\}}|dd�}|dd�}nd}|dd�}||kr�||kr�||kr�|�|d�}|dkr�|�||d�}||dkr�|dkr�t|�}|r�||d|�|||dd�fS|d|�|||dd�fSd}	}
|dk�r6||jk�r6|dd�}	|dd�}|}||k�rN|}
|�|�}||	|
|fS)NrrBrr0�����:)�_split_extended_path�find�len�
drive_letters�lstrip)r.r?r+�first�second�prefixZthird�indexZindex2r<r=r!r!r"r5�s6"

z_WindowsFlavour.splitrootcCs|��Sr*��lower�r.�sr!r!r"rC�sz_WindowsFlavour.casefoldcCsdd�|D�S)NcSsg|]}|���qSr!r])rM�pr!r!r"�
<listcomp>�sz2_WindowsFlavour.casefold_parts.<locals>.<listcomp>r!�r.r;r!r!r"�casefold_parts�sz_WindowsFlavour.casefold_partscCst�t�|�tj�jSr*)�re�compile�fnmatch�	translate�
IGNORECASE�	fullmatch�r.�patternr!r!r"�compile_pattern�sz_WindowsFlavour.compile_patternFcCs�t|�}|st��Sd}tdk	r�|r2|�t|��Sg}z|�t|��}WnBtk
r�|}tj�|�\}}|�|�||kr�|YSYq6Xtjj	|ft
|���Sq6dSr*)�str�os�getcwdr�_ext_to_normal�FileNotFoundError�pathr6r7r,r3)r.rs�strictr`Z
previous_sZ
tail_parts�tailr!r!r"�resolve�s$
z_WindowsFlavour.resolvecCsXd}|�|�rP|dd�}|dd�}|�d�rP||dd�7}d|dd�}||fS)Nr0�zUNC\rQrJ)�
startswith)r.r`Z
ext_prefixr[r!r!r"rT�s

z$_WindowsFlavour._split_extended_pathcCs|�|�dS�NrB)rTr_r!r!r"rq�sz_WindowsFlavour._ext_to_normalcCs6|sdS|d�d�rdS|d�d�d��|jkS)NFrz\\rRr1)rx�	partition�upper�reserved_namesrcr!r!r"�is_reserved�s
z_WindowsFlavour.is_reservedcCsd|j}t|�dkrJ|ddkrJ|��dd��d�}d|t|�d��fSdt|���d��SdS)NrrBrSrKz
file:///%s/%szutf-8zfile:)�driverV�as_posixrX�urlquote_from_bytes�encode)r.rsr~�restr!r!r"�make_uri�s�z_WindowsFlavour.make_uricCs�dtjkrtjd}nJdtjkrXztjd}Wntk
rFd}YnX|tjd}ntd��|r�tjd|kr�|�|f�\}}}|dtjdkr�td|��||d<|s�|r�|||�|d	d��}n
|�|�}|S)
NZUSERPROFILEZHOMEPATHZ	HOMEDRIVEr0zCan't determine home directoryZUSERNAMErR�%Can't determine home directory for %rrB)ro�environ�KeyError�RuntimeErrorrAr,)r.�username�userhomer<r=r;r!r!r"�
gethomedirs*


�
z_WindowsFlavour.gethomedirN)F)rErFrGr+r2�has_drv�ntpath�pathmodro�name�is_supported�setrWZext_namespace_prefix�ranger|r5rCrdrmrvrTrqr}r�r�r!r!r!r"rIxs.

���'

rIc@sleZdZdZdZdZeZej	dkZ
efdd�Zdd�Zd	d
�Z
dd�Zdd
d�Zdd�Zdd�Zdd�ZdS)�
_PosixFlavourrKr0FrcCsV|rH|d|krH|�|�}t|�t|�dkr<d|d|fSd||fSn
dd|fSdS)Nrrr0)rXrV)r.r?r+Z
stripped_partr!r!r"r5%s
z_PosixFlavour.splitrootcCs|Sr*r!r_r!r!r"rC4sz_PosixFlavour.casefoldcCs|Sr*r!rcr!r!r"rd7sz_PosixFlavour.casefold_partscCst�t�|��jSr*)rerfrgrhrjrkr!r!r"rm:sz_PosixFlavour.compile_patterncsJ|j�|j�i������fdd��|��r0dnt��}�|t|��pH�S)Ncs�|���rd}|���D]�}|r|dkr*q|dkrD|���\}}}q|���rX||}n|�|}|�kr��|}|dk	r~qtd|��z��|�}Wn6tk
r�}z|jtkr��r��|}W5d}~XYqXd�|<�||�}|�|<q|S)Nr0r1�..zSymlink loop from %r)	rxr6�
rpartition�endswithr��readlink�OSErrorrr)rsr�r��_�newpath�target�e��_resolveZaccessor�seenr+rtr!r"r�As4




z'_PosixFlavour.resolve.<locals>._resolver0)r+�	_accessor�is_absoluterorprn)r.rsrt�baser!r�r"rv=s)z_PosixFlavour.resolvecCsdS�NFr!rcr!r!r"r}msz_PosixFlavour.is_reservedcCst|�}dt|�S)Nzfile://)�bytesr�)r.rsZbpathr!r!r"r�psz_PosixFlavour.make_uricCs||s@ztjdWStk
r<ddl}|�t���jYSXn8ddl}z|�|�jWStk
rvtd|��YnXdS)N�HOMErr�)	ror�r��pwd�getpwuid�getuid�pw_dir�getpwnamr�)r.r�r�r!r!r"r�vs�z_PosixFlavour.gethomedirN)F)rErFrGr+r2r��	posixpathr�ror�r�r5rCrdrmrvr}r�r�r!r!r!r"r�s

0r�c@seZdZdZdS)�	_AccessorzjAn accessor implements a particular (system-specific or not) way of
    accessing paths on the filesystem.N)rErFrGrHr!r!r!r"r��sr�c@s�eZdZejZejZejZejZejZej	Z	e
ed�r>ejZndd�ZejZej
Z
e
ed�rdejZnedd��ZejZejZejZer�er�ejZq�dd�Zned	d��ZejZd
d�ZdS)
�_NormalAccessor�lchmodcCstd��dS)Nz%lchmod() not available on this system��NotImplementedError)r.Zpathobj�moder!r!r"r��sz_NormalAccessor.lchmod�linkcCstd��dS)Nz&os.link() not available on this systemr��r.r�r!r!r"�link_to�sz_NormalAccessor.link_tocCstd��dS)Nz&symlink() not available on this systemr���a�b�target_is_directoryr!r!r"�symlink�sz_NormalAccessor.symlinkcCst�||�Sr*)ror�r�r!r!r"r��scCs
t�|�Sr*)ror��r.rsr!r!r"r��sz_NormalAccessor.readlinkN)rErFrGro�stat�lstat�open�listdir�scandir�chmod�hasattrr��mkdir�unlinkr�r��staticmethod�rmdir�renamer4r�supports_symlinksr��utimer�r!r!r!r"r��s4




r�cCsR|d}|dd�}|dkr"t}n$d|kr4td��nt|�rBt}nt}||||�S)NrrB�**z:Invalid pattern: '**' can only be an entire path component)�_RecursiveWildcardSelector�
ValueErrorr(�_WildcardSelector�_PreciseSelector)�
pattern_parts�flavourr'�child_parts�clsr!r!r"�_make_selector�s
r��	lru_cachec@s eZdZdZdd�Zdd�ZdS)�	_SelectorzYA selector matches a specific glob pattern part against the children
    of a given path.cCs0||_|rt||�|_d|_nt�|_d|_dS)NTF)r�r��	successor�dironly�_TerminatingSelector)r.r�r�r!r!r"r/�sz_Selector.__init__cCs<t|�}|j}|j}|jj}||�s,tg�S|�||||�S)zuIterate over all child paths of `parent_path` matched by this
        selector.  This can contain parent_path itself.)�type�is_dir�existsr�r��iter�_select_from)r.�parent_pathZpath_clsr�r�r�r!r!r"�select_from�sz_Selector.select_fromN)rErFrGrHr/r�r!r!r!r"r��s	r�c@seZdZdd�ZdS)r�ccs
|VdSr*r!)r.r�r�r�r�r!r!r"r��sz!_TerminatingSelector._select_fromN)rErFrGr�r!r!r!r"r��sr�c@seZdZdd�Zdd�ZdS)r�cCs||_t�|||�dSr*)r�r�r/)r.r�r�r�r!r!r"r/sz_PreciseSelector.__init__ccs\z@|�|j�}|jr|n||�r>|j�||||�D]
}|Vq2Wntk
rVYdSXdSr*)�_make_child_relpathr�r�r�r��PermissionError)r.r�r�r�r�rsrar!r!r"r�sz_PreciseSelector._select_fromN�rErFrGr/r�r!r!r!r"r��sr�c@seZdZdd�Zdd�ZdS)r�cCs|�|�|_t�|||�dSr*)rm�matchr�r/�r.r'r�r�r!r!r"r/sz_WildcardSelector.__init__ccs�z�||��}t|�}W5QRX|D]�}|jrrz|��s:Wq"Wn4tk
rp}zt|�sX�WY�q"W5d}~XYnX|j}	|�|	�r"|�|	�}
|j�	|
|||�D]
}|Vq�q"Wnt
k
r�YdSXdSr*)�listr�r�r�r#r�r�r�r�r�r�)r.r�r�r�r��
scandir_it�entries�entryr�r�rsrar!r!r"r�s&


z_WildcardSelector._select_fromNr�r!r!r!r"r�sr�c@s$eZdZdd�Zdd�Zdd�ZdS)r�cCst�|||�dSr*)r�r/r�r!r!r"r//sz#_RecursiveWildcardSelector.__init__ccs�|Vz�||��}t|�}W5QRX|D]t}d}z|��}Wn,tk
rh}zt|�sX�W5d}~XYnX|r(|��s(|�|j�}	|�|	||�D]
}
|
Vq�q(Wntk
r�YdSXdSr�)	r�r�r�r#�
is_symlinkr�r��_iterate_directoriesr�)r.r�r�r�r�r�r�Zentry_is_dirr�rsrar!r!r"r�2s"
z/_RecursiveWildcardSelector._iterate_directoriesc	cs~zbt�}zL|jj}|�|||�D]0}|||||�D]}||kr2|V|�|�q2q W5|��XWntk
rxYdSXdSr*)r��clearr�r�r��addr�)	r.r�r�r�r�ZyieldedZsuccessor_selectZstarting_pointrar!r!r"r�Esz'_RecursiveWildcardSelector._select_fromN)rErFrGr/r�r�r!r!r!r"r�-sr�c@s4eZdZdZdZdd�Zdd�Zdd�Zd	d
�ZdS)�_PathParentszvThis object provides sequence-like access to the logical ancestors
    of a path.  Don't try to construct it yourself.)�_pathcls�_drv�_root�_partscCs&t|�|_|j|_|j|_|j|_dSr*)r�r�r�r�r�r�r!r!r"r/^s
z_PathParents.__init__cCs(|js|jrt|j�dSt|j�SdSry)r�r�rVr�r-r!r!r"�__len__esz_PathParents.__len__cCs@|dks|t|�krt|��|j�|j|j|jd|d��S)NrrB)rV�
IndexErrorr��_from_parsed_partsr�r�r�)r.�idxr!r!r"�__getitem__ks
�z_PathParents.__getitem__cCsd�|jj�S)Nz<{}.parents>)�formatr�rEr-r!r!r"�__repr__qsz_PathParents.__repr__N)	rErFrGrH�	__slots__r/r�r�r�r!r!r!r"r�Ysr�c@s�eZdZdZdZdd�Zdd�Zedd��ZedVd
d��Z	edWdd
��Z
edd��Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zed d!��Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zeed.�d/d0�Zeed1�d2d0�Zed3d4��Zed5d6��Z ed7d8��Z!ed9d:��Z"ed;d<��Z#d=d>�Z$d?d@�Z%dAdB�Z&edCdD��Z'dEdF�Z(dGdH�Z)dIdJ�Z*edKdL��Z+edMdN��Z,dOdP�Z-dQdR�Z.dSdT�Z/dUS)Xra|Base class for manipulating paths without I/O.

    PurePath represents a filesystem path and offers operations which
    don't imply any actual filesystem I/O.  Depending on your system,
    instantiating a PurePath will return either a PurePosixPath or a
    PureWindowsPath object.  You can also instantiate either of these classes
    directly, regardless of your system.
    )r�r�r��_str�_hash�_pparts�_cached_cpartscGs$|tkrtjdkrtnt}|�|�S)z�Construct a PurePath from one or several strings and or existing
        PurePath objects.  The strings and path objects are combined so as
        to yield a canonicalized path, which is incorporated into the
        new PurePath object.
        r)rror�rr�_from_parts)r��argsr!r!r"�__new__�szPurePath.__new__cCs|jt|j�fSr*)�	__class__�tupler�r-r!r!r"�
__reduce__�szPurePath.__reduce__cCsdg}|D]N}t|t�r"||j7}qt�|�}t|t�rF|�t|��qtdt|���q|j	�
|�S)NzNargument should be a str object or an os.PathLike object returning str, not %r)�
isinstancerr�ro�fspathrnr7�	TypeErrorr��_flavourrA)r�r�r;r�r!r!r"�_parse_args�s


��zPurePath._parse_argsTcCs<t�|�}|�|�\}}}||_||_||_|r8|��|Sr*)�objectr�rr�r�r��_init)r�r��initr.r<r=r;r!r!r"r��s
zPurePath._from_partscCs,t�|�}||_||_||_|r(|��|Sr*)rr�r�r�r�r)r�r<r=r;r	r.r!r!r"r��s
zPurePath._from_parsed_partscCs4|s|r$|||j�|dd��S|j�|�SdSry)rr,)r�r<r=r;r!r!r"�_format_parsed_parts�szPurePath._format_parsed_partscCsdSr*r!r-r!r!r"r�szPurePath._initcCs@|�|�\}}}|j�|j|j|j|||�\}}}|�|||�Sr*)rrrDr�r�r�r�)r.r�r<r=r;r!r!r"�_make_child�s�
zPurePath._make_childcCsBz|jWStk
r<|�|j|j|j�p.d|_|jYSXdS)z[Return the string representation of the path, suitable for
        passing to system calls.r1N)r��AttributeErrorr
r�r�r�r-r!r!r"�__str__�s��zPurePath.__str__cCst|�Sr*)rnr-r!r!r"�
__fspath__�szPurePath.__fspath__cCs|j}t|��|jd�S)zNReturn the string representation of the path with forward (/)
        slashes.rK)rrnr4r+�r.�fr!r!r"r�szPurePath.as_posixcCs
t�|�S)zaReturn the bytes representation of the path.  This is only
        recommended to use under Unix.)ro�fsencoder-r!r!r"�	__bytes__�szPurePath.__bytes__cCsd�|jj|���S)Nz{}({!r}))r�r�rErr-r!r!r"r��szPurePath.__repr__cCs|��std��|j�|�S)z Return the path as a 'file' URI.z.relative path can't be expressed as a file URI)r�r�rr�r-r!r!r"�as_uri�szPurePath.as_uricCs8z|jWStk
r2|j�|j�|_|jYSXdSr*)r�rrrdr�r-r!r!r"�_cparts�s
zPurePath._cpartscCs&t|t�stS|j|jko$|j|jkSr*)rr�NotImplementedrr�r.�otherr!r!r"�__eq__�s
zPurePath.__eq__cCs8z|jWStk
r2tt|j��|_|jYSXdSr*)r�r�hashrrr-r!r!r"�__hash__�s
zPurePath.__hash__cCs&t|t�r|j|jk	rtS|j|jkSr*�rrrrrrr!r!r"�__lt__szPurePath.__lt__cCs&t|t�r|j|jk	rtS|j|jkSr*rrr!r!r"�__le__	szPurePath.__le__cCs&t|t�r|j|jk	rtS|j|jkSr*rrr!r!r"�__gt__szPurePath.__gt__cCs&t|t�r|j|jk	rtS|j|jkSr*rrr!r!r"�__ge__szPurePath.__ge__r�z.The drive prefix (letter or UNC path), if any.)�docr�zThe root of the path, if any.cCs|j|j}|S)z/The concatenation of the drive and root, or ''.)r�r�)r.�anchorr!r!r"r!szPurePath.anchorcCs.|j}t|�|js|jrdndkr&dS|dS)z!The final path component, if any.rBrr0rR)r�rVr�r�rcr!r!r"r�$sz
PurePath.namecCsD|j}|�d�}d|kr,t|�dkr<nn||d�SdSdS)z{
        The final component's last suffix, if any.

        This includes the leading period. For example: '.txt'
        r1rrBNr0�r��rfindrV�r.r�rNr!r!r"�suffix,s

 zPurePath.suffixcCs:|j}|�d�rgS|�d�}dd�|�d�dd�D�S)z�
        A list of the final component's suffixes, if any.

        These include the leading periods. For example: ['.tar', '.gz']
        r1cSsg|]}d|�qS)r1r!)rMr%r!r!r"rbEsz%PurePath.suffixes.<locals>.<listcomp>rBN)r�r�rXr6�r.r�r!r!r"�suffixes:s


zPurePath.suffixescCsD|j}|�d�}d|kr,t|�dkr<nn|d|�S|SdS)z0The final path component, minus its last suffix.r1rrBNr"r$r!r!r"�stemGs

 z
PurePath.stemcCs�|jstd|f��|j�|f�\}}}|rX|d|jj|jjfksX|sX|sXt|�dkrdtd|��|�|j|j	|j
dd�|g�S)z-Return a new path with the file name changed.�%r has an empty namerRrBzInvalid name %rN)r�r�rrAr+r2rVr�r�r�r�)r.r�r<r=r;r!r!r"�	with_nameQs��
��zPurePath.with_namecCs�|j}|j|ks |jr.|j|kr.td|f��|r<|�d�rD|dkrPtd|��|j}|shtd|f��|j}|s|||}n|dt|��|}|�|j	|j
|jdd�|g�S)z�Return a new path with the file suffix changed.  If the path
        has no suffix, add given suffix.  If the given suffix is an empty
        string, remove the suffix from the path.
        zInvalid suffix %rr1r)NrR)rr+r2r�rxr�r%rVr�r�r�r�)r.r%rr�Z
old_suffixr!r!r"�with_suffix\s
�zPurePath.with_suffixc
Gs�|std��|j}|j}|j}|r8||g|dd�}n|}|�|�\}}}|rf||g|dd�}	n|}	t|	�}
|jj}|
dkr�|s�|r�n||d|
��||	�kr�|�|||�}t	d�
t|�t|����|�d|
dkr�|nd||
d��S)z�Return the relative path to another path identified by the passed
        arguments.  If the operation is not possible (because this is not
        a subpath of the other path), raise ValueError.
        zneed at least one argumentrBNrz{!r} does not start with {!r}r0)
rr�r�r�rrVrrdr
r�r�rnr�)
r.rr;r<r=Z	abs_partsZto_drvZto_rootZto_partsZto_abs_parts�n�cfZ	formattedr!r!r"�relative_toqs.	*�
�zPurePath.relative_tocCs4z|jWStk
r.t|j�|_|jYSXdS)zZAn object providing sequence-like access to the
        components in the filesystem path.N)r�rrr�r-r!r!r"r;�s
zPurePath.partscGs
|�|�S)z�Combine this path with one or several arguments, and return a
        new path representing either a subpath (if all arguments are relative
        paths) or a totally different path (if one of the arguments is
        anchored).
        )r)r.r�r!r!r"�joinpath�szPurePath.joinpathcCs,z|�|f�WStk
r&tYSXdSr*)rrr�r.�keyr!r!r"�__truediv__�szPurePath.__truediv__cCs2z|�|g|j�WStk
r,tYSXdSr*)r�r�rrr0r!r!r"�__rtruediv__�szPurePath.__rtruediv__cCs@|j}|j}|j}t|�dkr*|s&|r*|S|�|||dd��S)zThe logical parent of the path.rBNrR)r�r�r�rVr�)r.r<r=r;r!r!r"�parent�szPurePath.parentcCst|�S)z*A sequence of this path's logical parents.)r�r-r!r!r"�parents�szPurePath.parentscCs|js
dS|jjpt|j�S)zSTrue if the path is absolute (has both a root and, if applicable,
        a drive).F)r�rr��boolr�r-r!r!r"r��szPurePath.is_absolutecCs|j�|j�S)zaReturn True if the path contains one of the special names reserved
        by the system, if any.)rr}r�r-r!r!r"r}�szPurePath.is_reservedc	Cs�|jj}||�}|j�|f�\}}}|s0td��|rF|||j�krFdS|r\|||j�kr\dS|j}|sj|r�t|�t|�kr~dS|dd�}nt|�t|�kr�dStt	|�t	|��D]\}}t
�||�s�dSq�dS)zE
        Return True if this path matches the given pattern.
        z
empty patternFrBNT)rrCrAr�r�r�rrV�zipr3rgZfnmatchcase)	r.Zpath_patternr-r<r=Z	pat_partsr;r?r'r!r!r"r��s(zPurePath.matchN)T)T)0rErFrGrHr�r�r�classmethodrr�r�r
rrr
rrrr�r�propertyrrrrrrrrr~r=r!r�r%r'r(r*r+r.r;r/r2r3r4r5r�r}r�r!r!r!r"rusv

	


��





	 

	
c@seZdZdZeZdZdS)rz�PurePath subclass for non-Windows systems.

    On a POSIX system, instantiating a PurePath should return this object.
    However, you can also instantiate it directly on any system.
    r!N)rErFrGrH�_posix_flavourrr�r!r!r!r"r�sc@seZdZdZeZdZdS)rz�PurePath subclass for Windows systems.

    On a Windows system, instantiating a PurePath should return this object.
    However, you can also instantiate it directly on any system.
    r!N)rErFrGrH�_windows_flavourrr�r!r!r!r"r�sc@s�eZdZdZdZdd�Zdddd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dedd�Zdfdd�Ze
dd��Ze
dd��Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zdgd%d&�Zd'd(�Zd)d*�Zd+d,�Zdhd/d0�Zd1d2�Zdid3d4�Zd5d6�Zdjd7d8�Zdkd:d;�Zdld<d=�Zd>d?�Z d@dA�Z!dmdBdC�Z"dDdE�Z#dFdG�Z$dHdI�Z%dJdK�Z&dndLdM�Z'dNdO�Z(dPdQ�Z)dRdS�Z*dTdU�Z+dVdW�Z,dXdY�Z-dZd[�Z.d\d]�Z/d^d_�Z0d`da�Z1dbdc�Z2dS)ora�PurePath subclass that can make system calls.

    Path represents a filesystem path but unlike PurePath, also offers
    methods to do system calls on path objects. Depending on your system,
    instantiating a Path will return either a PosixPath or a WindowsPath
    object. You can also instantiate a PosixPath or WindowsPath directly,
    but cannot instantiate a WindowsPath on a POSIX system or vice versa.
    )r��_closedcOsL|tkrtjdkrtnt}|j|dd�}|jjs@td|j	f��|�
�|S)NrF�r	z$cannot instantiate %r on your system)rror�rrr�rr�r�rEr)r�r��kwargsr.r!r!r"r�s�zPath.__new__NcCs"d|_|dk	r|j|_nt|_dSr�)r<r��_normal_accessor)r.�templater!r!r"rs
z
Path._initcCs|j|g}|�|j|j|�Sr*)r�r�r�r�)r.r?r;r!r!r"r�#szPath._make_child_relpathcCs|jr|��|Sr*)r<�
_raise_closedr-r!r!r"�	__enter__)szPath.__enter__cCs
d|_dS)NT)r<)r.�t�v�tbr!r!r"�__exit__.sz
Path.__exit__cCstd��dS)NzI/O operation on closed path)r�r-r!r!r"rA1szPath._raise_closed�cCs|j�|||�Sr*)r�r�)r.r��flagsr�r!r!r"�_opener4szPath._opener�cCs|jr|��|j�|||�S)zm
        Open the file pointed by this path and return a file descriptor,
        as os.open() does.
        )r<rAr�r�)r.rHr�r!r!r"�	_raw_open8szPath._raw_opencCs|t���S)zjReturn a new path pointing to the current working directory
        (as returned by os.getcwd()).
        )rorp�r�r!r!r"�cwdCszPath.cwdcCs||�j�d��S)zrReturn a new path pointing to the user's home directory (as
        returned by os.path.expanduser('~')).
        N)rr�rLr!r!r"�homeJsz	Path.homecCsB|��}z|��}Wntk
r2t�|�}YnXtj�||�S)zoReturn whether other_path is the same or not as this file
        (as returned by os.path.samefile()).
        )r�rrors�samestat)r.Z
other_path�stZother_str!r!r"�samefileQsz
Path.samefileccsH|jr|��|j�|�D](}|dkr(q|�|�V|jr|��qdS)zyIterate over the files in this directory.  Does not yield any
        result for the special paths '.' and '..'.
        >r1r�N)r<rAr�r�r�r&r!r!r"�iterdir\szPath.iterdirccs`|std�|���|j�|f�\}}}|s.|r6td��tt|�|j�}|�|�D]
}|VqPdS)z�Iterate over this subtree and yield all existing files (of any
        kind, including directories) matching the given relative pattern.
        zUnacceptable pattern: {!r}�%Non-relative patterns are unsupportedN)r�r�rrAr�r�rr��r.rlr<r=r�Zselectorrar!r!r"�globjsz	Path.globccsR|j�|f�\}}}|s|r$td��tdt|�|j�}|�|�D]
}|VqBdS)z�Recursively yield all existing files (of any kind, including
        directories) matching the given relative pattern, anywhere in
        this subtree.
        rS)r�N)rrAr�r�rr�rTr!r!r"�rglobwsz
Path.rglobcCsD|jr|��|��r|S|jt��g|jdd�}|j|d�|S)aReturn an absolute version of this path.  This function works
        even if the path doesn't point to anything.

        No normalization is done, i.e. all '.' and '..' will be kept along.
        Use resolve() to get the canonical path to a file.
        Fr=�r@)r<rAr�r�rorpr�r)r.�objr!r!r"�absolute�sz
Path.absoluteFcCsh|jr|��|jj||d�}|dkr:|��t|���}|jj�|�}|j	|fdd�}|j
|d�|S)z�
        Make the path absolute, resolving all symlinks on the way and also
        normalizing it (for example turning slashes into backslashes under
        Windows).
        )rtNFr=rW)r<rArrvr�rnrYr��normpathr�r)r.rtr`ZnormedrXr!r!r"rv�szPath.resolvecCs|j�|�S)zh
        Return the result of the stat() system call on this path, like
        os.stat() does.
        )r�r�r-r!r!r"r��sz	Path.statcCsddl}|�|��j�jS)z:
        Return the login name of the file owner.
        rN)r�r�r��st_uidZpw_name)r.r�r!r!r"�owner�sz
Path.ownercCsddl}|�|��j�jS)z8
        Return the group name of the file gid.
        rN)�grpZgetgrgidr��st_gidZgr_name)r.r]r!r!r"�group�sz
Path.group�rrRc	Cs(|jr|��tj|||||||jd�S)z|
        Open the file pointed by this path and return a file object, as
        the built-in open() function does.
        )Zopener)r<rA�ior�rI)r.r��	buffering�encoding�errors�newliner!r!r"r��s
�z	Path.openc
Cs,|jdd��}|��W5QR�SQRXdS)zK
        Open the file in bytes mode, read it, and close the file.
        �rb�r�N�r��readrr!r!r"�
read_bytes�szPath.read_bytesc
Cs0|jd||d��}|��W5QR�SQRXdS)zJ
        Open the file in text mode, read it, and close the file.
        r`�r�rcrdNrh)r.rcrdrr!r!r"�	read_text�szPath.read_textc
Cs6t|�}|jdd��}|�|�W5QR�SQRXdS)zO
        Open the file in bytes mode, write to it, and close the file.
        �wbrgN)�
memoryviewr��write)r.�dataZviewrr!r!r"�write_bytes�szPath.write_bytesc
CsLt|t�std|jj��|jd||d��}|�|�W5QR�SQRXdS)zN
        Open the file in text mode, write to it, and close the file.
        zdata must be str, not %s�wrkN)rrnrr�rEr�ro)r.rprcrdrr!r!r"�
write_text�s
�zPath.write_textTcCsr|jr|��|r>z|j�|d�Wntk
r8YnXdStjtjB}|sX|tjO}|�	||�}t�
|�dS)zS
        Create this file with the given access mode, if it doesn't exist.
        N)r<rAr�r�r�ro�O_CREAT�O_WRONLY�O_EXCLrK�close)r.r��exist_okrH�fdr!r!r"�touch�s
z
Path.touchcCs�|jr|��z|j�||�Wndtk
rd|r>|j|kr@�|jjddd�|j|d|d�Yn"tk
r�|r~|��s��YnXdS)z<
        Create a new directory at this given path.
        T)r5rxFN)r<rAr�r�rrr4r�r�)r.r�r5rxr!r!r"r�sz
Path.mkdircCs |jr|��|j�||�dS)zF
        Change the permissions of the path, like os.chmod().
        N)r<rAr�r��r.r�r!r!r"r�sz
Path.chmodcCs |jr|��|j�||�dS)z�
        Like chmod(), except if the path points to a symlink, the symlink's
        permissions are changed, rather than its target's.
        N)r<rAr�r�r{r!r!r"r�szPath.lchmodcCs>|jr|��z|j�|�Wntk
r8|s4�YnXdS)zd
        Remove this file or link.
        If the path is a directory, use rmdir() instead.
        N)r<rAr�r�rr)r.Z
missing_okr!r!r"r�%szPath.unlinkcCs|jr|��|j�|�dS)zF
        Remove this directory.  The directory must be empty.
        N)r<rAr�r�r-r!r!r"r�2sz
Path.rmdircCs|jr|��|j�|�S)z�
        Like stat(), except if the path points to a symlink, the symlink's
        status information is returned, rather than its target's.
        )r<rAr�r�r-r!r!r"r�:sz
Path.lstatcCs&|jr|��|j�||�|�|�S)a2
        Rename this path to the target path.

        The target path may be absolute or relative. Relative paths are
        interpreted relative to the current working directory, *not* the
        directory of the Path object.

        Returns the new Path instance pointing to the target path.
        )r<rAr�r�r�r�r!r!r"r�Cs
zPath.renamecCs&|jr|��|j�||�|�|�S)aS
        Rename this path to the target path, overwriting if that path exists.

        The target path may be absolute or relative. Relative paths are
        interpreted relative to the current working directory, *not* the
        directory of the Path object.

        Returns the new Path instance pointing to the target path.
        )r<rAr�r4r�r�r!r!r"r4Rs
zPath.replacecCs"|jr|��|j�|||�dS)z�
        Make this path a symlink pointing to the target path.
        Note the order of arguments (link, target) is the reverse of os.symlink.
        N)r<rAr�r�)r.r�r�r!r!r"�
symlink_toaszPath.symlink_tocCs |jr|��|j�||�dS)aQ
        Make the target path a hard link pointing to this path.

        Note this function does not make this path a hard link to *target*,
        despite the implication of the function and argument names. The order
        of arguments (target, link) is the reverse of Path.symlink_to, but
        matches that of os.link.

        N)r<rAr�r�r�r!r!r"r�js
zPath.link_toc
CsXz|��WnFtk
r>}zt|�s(�WY�dSd}~XYntk
rRYdSXdS)z+
        Whether this path exists.
        FNT)r�r�r#r��r.r�r!r!r"r�zszPath.existsc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z3
        Whether this path is a directory.
        FN)r	r��st_moder�r#r�r}r!r!r"r��szPath.is_dirc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)zq
        Whether this path is a regular file (also True for symlinks pointing
        to regular files).
        FN)rr�r~r�r#r�r}r!r!r"�is_file�szPath.is_filecCsv|��r|��sdSt|j�}z|��j}Wntk
rBYdSX|��j}||krZdS|��j}|��j}||kS)z;
        Check if this path is a POSIX mount point
        FT)r�r�rr4r��st_devr��st_ino)r.r4Z
parent_devZdevZinoZ
parent_inor!r!r"�is_mount�s



z
Path.is_mountc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z7
        Whether this path is a symbolic link.
        FN)r
r�r~r�r#r�r}r!r!r"r��szPath.is_symlinkc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z6
        Whether this path is a block device.
        FN)r
r�r~r�r#r�r}r!r!r"�is_block_device�szPath.is_block_devicec
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z:
        Whether this path is a character device.
        FN)rr�r~r�r#r�r}r!r!r"�is_char_device�szPath.is_char_devicec
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z.
        Whether this path is a FIFO.
        FN)rr�r~r�r#r�r}r!r!r"�is_fifo�szPath.is_fifoc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z0
        Whether this path is a socket.
        FN)rr�r~r�r#r�r}r!r!r"�	is_socket�szPath.is_socketcCs`|js\|js\|jr\|jddd�dkr\|j�|jddd��}|�|g|jdd��S|S)zl Return a new path with expanded ~ and ~user constructs
        (as returned by os.path.expanduser)
        rNrB�~)r�r�r�rr�r�)r.Zhomedirr!r!r"�
expandusers��zPath.expanduser)N)rG)rJ)F)r`rRNNN)NN)NN)rGT)rJFF)F)F)3rErFrGrHr�r�rr�rBrFrArIrKr8rMrNrQrRrUrVrYrvr�r\r_r�rjrlrqrsrzr�r�r�r�r�r�r�r4r|r�r�r�rr�r�r�r�r�r�r�r!r!r!r"rsj�







�

	



	

	
	c@seZdZdZdZdS)rzsPath subclass for non-Windows systems.

    On a POSIX system, instantiating a Path should return this object.
    r!N)rErFrGrHr�r!r!r!r"rsc@s,eZdZdZdZdd�Zdd�Zdd�Zd	S)
rzqPath subclass for Windows systems.

    On a Windows system, instantiating a Path should return this object.
    r!cCstd��dS)Nz*Path.owner() is unsupported on this systemr�r-r!r!r"r\(szWindowsPath.ownercCstd��dS)Nz*Path.group() is unsupported on this systemr�r-r!r!r"r_+szWindowsPath.groupcCstd��dS)Nz-Path.is_mount() is unsupported on this systemr�r-r!r!r"r�.szWindowsPath.is_mountN)rErFrGrHr�r\r_r�r!r!r!r"r!s
)Arg�	functoolsrar�ror�rer8�_collections_abcrrrrrrr�operatorrr�r	r
rrr
rrZurllib.parserr�r�r�rZgetwindowsversionr�__all__rr r#r(rr)rIr�r;r:r�r�r?r�r�r�r�r�r�r�r�r�r�PathLike�registerrrrrrr!r!r!r"�<module>s|$
�
?&i8
,t

_dummy_thread.cpython-38.pyc000064400000013627150335716500012033 0ustar00U

e5d��@s�dZddddddddgZd	ZeZifd
d�Zdd�Zdd�Zd
d�Zddd�Z	dd�Z
Gdd�de�ZGdd�de�Z
dadadd�ZdS)a/Drop-in replacement for the thread module.

Meant to be used as a brain-dead substitute so that threaded code does
not need to be rewritten for when the thread module is not present.

Suggested usage is::

    try:
        import _thread
    except ImportError:
        import _dummy_thread as _thread

�error�start_new_thread�exit�	get_ident�
allocate_lock�interrupt_main�LockType�RLocklcCs�t|�tt��krtd��t|�tt��kr4td��daz|||�Wn.tk
rZYnddl}|��YnXdatr�dat	�dS)a�Dummy implementation of _thread.start_new_thread().

    Compatibility is maintained by making sure that ``args`` is a
    tuple and ``kwargs`` is a dictionary.  If an exception is raised
    and it is SystemExit (which can be done by _thread.exit()) it is
    caught and nothing is done; all other exceptions are printed out
    by using traceback.print_exc().

    If the executed function calls interrupt_main the KeyboardInterrupt will be
    raised when the function returns.

    z2nd arg must be a tuplez3rd arg must be a dictF�NT)
�type�tuple�	TypeError�dict�_main�
SystemExit�	traceback�	print_exc�
_interrupt�KeyboardInterrupt)Zfunction�args�kwargsr�r�%/usr/lib64/python3.8/_dummy_thread.pyrs 
cCst�dS)z'Dummy implementation of _thread.exit().N)rrrrrr=scCsdS)z�Dummy implementation of _thread.get_ident().

    Since this module should only be used when _threadmodule is not
    available, it is safe to assume that the current process is the
    only thread.  Thus a constant can be safely returned.
    �rrrrrrAscCst�S)z0Dummy implementation of _thread.allocate_lock().�rrrrrrJsNcCs|dk	rtd��dS)z-Dummy implementation of _thread.stack_size().Nz'setting thread stack size not supportedr	)r)�sizerrr�
stack_sizeNsrcCst�S)z0Dummy implementation of _thread._set_sentinel().rrrrr�
_set_sentinelTsrc@sFeZdZdZdd�Zddd�ZeZdd	�Zd
d�Zdd
�Z	dd�Z
dS)ra�Class implementing dummy implementation of _thread.LockType.

    Compatibility is maintained by maintaining self.locked_status
    which is a boolean that stores the state of the lock.  Pickling of
    the lock, though, should not be done since if the _thread module is
    then used with an unpickled ``lock()`` from here problems could
    occur from this class not having atomic methods.

    cCs
d|_dS)NF��
locked_status��selfrrr�__init__cszLockType.__init__N���cCsH|dks|rd|_dS|js&d|_dS|dkr@ddl}|�|�dSdS)a�Dummy implementation of acquire().

        For blocking calls, self.locked_status is automatically set to
        True and returned appropriately based on value of
        ``waitflag``.  If it is non-blocking, then the value is
        actually checked and not set if it is already acquired.  This
        is all done so that threading.Condition's assert statements
        aren't triggered and throw a little fit.

        NTr	F)r�time�sleep)r �waitflag�timeoutr#rrr�acquirefs
zLockType.acquirecCs|��dS�N)�release)r �typ�val�tbrrr�__exit__�szLockType.__exit__cCs|js
t�d|_dS)zRelease the dummy lock.FT)rrrrrrr)�szLockType.releasecCs|jSr(rrrrr�locked�szLockType.lockedcCs*d|jrdnd|jj|jjtt|��fS)Nz<%s %s.%s object at %s>r.Zunlocked)r�	__class__�
__module__�__qualname__�hex�idrrrr�__repr__�s
�zLockType.__repr__)Nr")�__name__r0r1�__doc__r!r'�	__enter__r-r)r.r4rrrrrXs

	cs:eZdZdZ�fdd�Zd
�fdd�	Z�fdd	�Z�ZS)raDummy implementation of threading._RLock.

    Re-entrant lock can be aquired multiple times and needs to be released
    just as many times. This dummy implemention does not check wheter the
    current thread actually owns the lock, but does accounting on the call
    counts.
    cst���d|_dS)Nr	)�superr!�_levelsr�r/rrr!�s
zRLock.__init__Nr"cs$t��||�}|r |jd7_|S)zEAquire the lock, can be called multiple times in succession.
        r)r8r'r9)r r%r&r.r:rrr'�sz
RLock.acquirecs4|jdkrt�|jdkr"t���|jd8_dS)zERelease needs to be called once for every call to acquire().
        r	rN)r9rr8r)rr:rrr)�s



z
RLock.release)Nr")r5r0r1r6r!r'r)�
__classcell__rrr:rr�sFTcCstr
t�ndadS)z^Set _interrupt flag to True to have start_new_thread raise
    KeyboardInterrupt upon exiting.TN)rrrrrrrr�s)N)r6�__all__�TIMEOUT_MAX�RuntimeErrorrrrrrrr�objectrrrrrrrrr�<module>s$
� 	
@dummy_threading.cpython-38.opt-1.pyc000064400000002130150335716500013314 0ustar00U

e5d�
�	@sdZddlmZddlZdZdZdZz�dekr:edZ
dZed	ed<dekr`edZdZed=dekrzedZ	dZed=ddlZeded
<ed=eded<ed=ddlTdd
lm
Z
W5er�eed<[[er�e	ed<[	[er�e
ed<[
ned=[[[XdS)aaFaux ``threading`` version using ``dummy_thread`` instead of ``thread``.

The module ``_dummy_threading`` is added to ``sys.modules`` in order
to not have ``threading`` considered imported.  Had ``threading`` been
directly imported it would have made all subsequent imports succeed
regardless of whether ``_thread`` was available which is not desired.

�)�modulesNF�	threadingZ_threading_local�_threadT�
_dummy_thread�_dummy_threadingZ_dummy__threading_local)�*)�__all__)�__doc__�sysrZsys_modulesrZholding_threadZholding_threadingZholding__threading_localZheld_threadingZheld__threading_localZheld_threadrrr�rr�'/usr/lib64/python3.8/dummy_threading.py�<module>sPtempfile.cpython-38.opt-2.pyc000064400000040751150335716500011755 0ustar00U

e5d�k�
@s�dddddddddd	d
ddg
Zd
dlZd
dlZd
dlZd
dlZd
dl	Z
d
dlZd
dl
mZd
dlZd
dlZd
dlZejZejejBejBZeed�r�eejOZeZeed�r�eejOZeed�r�ejZndZdZ e�Z!dd�Z"dd�Z#dd�Z$Gdd�d�Z%dd�Z&dd�Z'da(d d!�Z)d"d#�Z*d$d�Z+d%d�Z,da-d&d
�Z.d'd�Z/d<d)d�Z0d=d*d�Z1d+e dfd,d�Z2Gd-d.�d.�Z3Gd/d0�d0�Z4d>dd4�d5d�Z5ej6d6k�s�ej7d7k�r�e5Z8need8�a9d?dd4�d9d�Z8Gd:d�d�Z:Gd;d�de;�Z<dS)@�NamedTemporaryFile�
TemporaryFile�SpooledTemporaryFile�TemporaryDirectory�mkstemp�mkdtemp�mktemp�TMP_MAX�
gettempprefix�tempdir�
gettempdir�gettempprefixb�gettempdirb�N)�Random�
O_NOFOLLOW�O_BINARYi'ZtmpcCs.zt�|�Wntk
r$YdSXdSdS)NFT)�_os�lstat�OSError)�fn�r� /usr/lib64/python3.8/tempfile.py�_existsKs
rcGs\d}|D]B}|dkrqt|t�r6|tkr0td��t}q|tkrFtd��t}q|dkrXtS|S)Nz1Can't mix bytes and non-bytes in path components.)�
isinstance�bytes�str�	TypeError)�argsZreturn_type�argrrr�_infer_return_typeTs
rcCsdt|||�}|dkr|�}|dkr:|tkr0t}n
t�t�}|dkrX|tkrRt�}nt�}||||fS�N)rr�templater�fsencoderr
)�prefix�suffix�dir�output_typerrr�_sanitize_paramsis
r'c@s,eZdZdZedd��Zdd�Zdd�ZdS)	�_RandomNameSequenceZ%abcdefghijklmnopqrstuvwxyz0123456789_cCs,t��}|t|dd�kr&t�|_||_|jS)N�_rng_pid)r�getpid�getattr�_RandomZ_rngr))�selfZcur_pidrrr�rng�s
z_RandomNameSequence.rngcCs|Sr r�r-rrr�__iter__�sz_RandomNameSequence.__iter__cs0|j�|jj���fdd�td�D�}d�|�S)Ncsg|]}����qSrr)�.0Zdummy��cZchooserr�
<listcomp>�sz0_RandomNameSequence.__next__.<locals>.<listcomp>��)�
charactersr.Zchoice�range�join)r-Zlettersrr2r�__next__�sz_RandomNameSequence.__next__N)�__name__�
__module__�__qualname__r7�propertyr.r0r:rrrrr({s

r(c	Cs�g}dD]}t�|�}|r|�|�qtjdkrX|�tj�d�tj�d�ddddg�n|�d	d
dg�z|�t���Wn$t	t
fk
r�|�tj�YnX|S)N)ZTMPDIRZTEMPZTMP�ntz~\AppData\Local\Tempz%SYSTEMROOT%\Tempzc:\tempzc:\tmpz\tempz\tmpz/tmpz/var/tmpz/usr/tmp)r�getenv�append�name�extend�path�
expanduser�
expandvars�getcwd�AttributeErrorr�curdir)�dirlistZenvname�dirnamerrr�_candidate_tempdir_list�s&


�rLcCsFt�}t�}|D�]}|tjkr,tj�|�}td�D�]�}t|�}tj�||�}zft�	|t
d�}z<z*t
j	|ddd��}|�d�W5QRXW5t�|�XW5t�|�X|WStk
r�Yq4tk
�rtjdk�rtj�|��rt�|tj��rYq4YqYq4tk
�r,YqYq4Xq4qttjd|��dS)	N�d��wbF)�closefdsblatr?z)No usable temporary directory found in %s)r(rLrrIrD�abspathr8�nextr9�open�_bin_openflags�unlink�close�_io�write�FileExistsError�PermissionErrorrB�isdir�access�W_OKr�FileNotFoundError�_errnoZENOENT)ZnamerrJr%�seqrB�filename�fd�fprrr�_get_default_tempdir�s@	

�
��rdcCs2tdkr.t��ztdkr t�aW5t��XtSr )�_name_sequence�
_once_lock�acquire�releaser(rrrr�_get_candidate_names�s

ric
	Cs�t�}|tkrttj|�}tt�D]�}t|�}tj�	||||�}t
�d|�zt�||d�}	WnVt
k
rzYq"Yn@tk
r�tjdkr�tj�|�r�t�|tj�r�Yq"n�YnX|	tj�|�fSt
tjd��dS)Nztempfile.mkstemprNr?z#No usable temporary file name found)rir�maprr"r8rrRrDr9�_sys�auditrSrYrZrBr[r\r]rQr_�EEXIST)
r%ZpreZsuf�flagsr&�namesr`rB�filerbrrr�_mkstemp_inner�s*��rqcCstSr )r!rrrrr	
scCst�t��Sr )rr"r	rrrrrscCs2tdkr.t��ztdkr t�aW5t��XtSr )r
rfrgrhrdrrrrrs

cCst�t��Sr )rr"rrrrrr
#sFcCs2t|||�\}}}}|rt}nt}t|||||�Sr )r'�_text_openflagsrTrq)r$r#r%�textr&rnrrrr's
c	Cs�t|||�\}}}}t�}|tkr.ttj|�}tt�D]�}t|�}tj	�
||||�}t�d|�zt�
|d�WnVtk
r�Yq6Yn@tk
r�tjdkr�tj	�|�r�t�|tj�r�Yq6n�YnX|Sttjd��dS)Nztempfile.mkdtemp�r?z(No usable temporary directory name found)r'rirrjrr"r8rrRrDr9rkrl�mkdirrYrZrBr[r\r]r_rm)r$r#r%r&ror`rBrprrrrNs,
��r6cCs`|dkrt�}t�}tt�D]2}t|�}tj�||||�}t|�s|Sqt	t
jd��dS)Nz"No usable temporary filename found)rrir8rrRrrDr9rrYr_rm)r$r#r%ror`rBrprrrrvs
�c@sHeZdZdZdZddd�Zejdkr<ejfdd�Z	d	d
�Z
ndd�Z	dS)
�_TemporaryFileCloserNFTcCs||_||_||_dSr )rprB�delete�r-rprBrwrrr�__init__�sz_TemporaryFileCloser.__init__r?cCs<|js8|jdk	r8d|_z|j��W5|jr6||j�XdS�NT)�close_calledrprwrBrV)r-rUrrrrV�sz_TemporaryFileCloser.closecCs|��dSr )rVr/rrr�__del__�sz_TemporaryFileCloser.__del__cCs|jsd|_|j��dSrz)r{rprVr/rrrrV�s)T)r;r<r=rpr{ryrrBrUrVr|rrrrrv�s



rvc@s>eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)�_TemporaryFileWrapperTcCs$||_||_||_t|||�|_dSr )rprBrwrv�_closerrxrrrry�sz_TemporaryFileWrapper.__init__cs^|jd}t||�}t|d�rD|�t����fdd��}|j|_|}t|t�sZt|||�|S)Nrp�__call__cs
�||�Sr r)r�kwargs��funcrr�func_wrapper�sz7_TemporaryFileWrapper.__getattr__.<locals>.func_wrapper)	�__dict__r+�hasattr�
_functools�wrapsr~r�int�setattr)r-rBrp�ar�rr�r�__getattr__�s



z!_TemporaryFileWrapper.__getattr__cCs|j��|Sr )rp�	__enter__r/rrrr��s
z_TemporaryFileWrapper.__enter__cCs|j�|||�}|��|Sr )rp�__exit__rV)r-�exc�value�tb�resultrrrr��sz_TemporaryFileWrapper.__exit__cCs|j��dSr )r~rVr/rrrrV�sz_TemporaryFileWrapper.closeccs|jD]
}|VqdSr )rp)r-�linerrrr0�s
z_TemporaryFileWrapper.__iter__N)T)	r;r<r=ryr�r�r�rVr0rrrrr}�s
r}�w+b���T��errorscCs�t|||�\}}}}	t}
tjdkr0|r0|
tjO}
t||||
|	�\}}z$tj||||||d�}
t|
||�WSt	k
r�t�
|�t�|��YnXdS)Nr?��	buffering�newline�encodingr�)r'rTrrBZO_TEMPORARYrqrWrSr}�
BaseExceptionrUrV)�moder�r�r�r$r#r%rwr�r&rnrbrBrprrrrs 

�

�posix�cygwin�	O_TMPFILEc
Cs�t|||�\}}}}t}	tr�z$|	tjBtj@}
t�||
d�}Wn*tk
rXdaYnFtk
rjYn4Xzt	j||||||d�WSt�
|��YnXt||||	|�\}}z"t�|�t	j||||||d�WSt�
|��YnXdS)NrNFr�)
r'rT�_O_TMPFILE_WORKSrr��O_CREATrS�IsADirectoryErrorrrWrVrqrU)
r�r�r�r�r$r#r%r�r&rnZflags2rbrBrrrr2s<
�


�
c@s�eZdZdZd9dd�dd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�Z	dd�Z
edd��Zedd��Z
edd��Zdd�Zdd�Zdd �Zed!d"��Zed#d$��Zed%d&��Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zed/d0��Zd1d2�Zd:d3d4�Zd5d6�Zd7d8�ZdS);rFrr�r�Nr�c	
	CsTd|krt��|_ntjt��||	|d�|_||_d|_||||||||	d�|_dS)N�b)r�r�r�F)r�r�r$r#r�r�r%r�)rW�BytesIO�_file�
TextIOWrapper�	_max_size�_rolled�_TemporaryFileArgs)
r-�max_sizer�r�r�r�r$r#r%r�rrrryus"
��zSpooledTemporaryFile.__init__cCs,|jr
dS|j}|r(|��|kr(|��dSr )r�r��tell�rollover)r-rpr�rrr�_check�s
zSpooledTemporaryFile._checkcCsr|jr
dS|j}tf|j�}|_|`|��}t|d�rN|j�|���	��n|�|�	��|�
|d�d|_dS)N�bufferrT)r�r�rr�r�r�r�rX�detach�getvalue�seek)r-rpZnewfile�posrrrr��s
zSpooledTemporaryFile.rollovercCs|jjrtd��|S)Nz%Cannot enter context with closed file)r��closed�
ValueErrorr/rrrr��szSpooledTemporaryFile.__enter__cCs|j��dSr �r�rV�r-r�r�r�rrrr��szSpooledTemporaryFile.__exit__cCs
|j��Sr )r�r0r/rrrr0�szSpooledTemporaryFile.__iter__cCs|j��dSr r�r/rrrrV�szSpooledTemporaryFile.closecCs|jjSr )r�r�r/rrrr��szSpooledTemporaryFile.closedcCs|jjSr )r�r�r/rrrr��szSpooledTemporaryFile.encodingcCs|jjSr )r�r�r/rrrr��szSpooledTemporaryFile.errorscCs|��|j��Sr )r�r��filenor/rrrr��szSpooledTemporaryFile.filenocCs|j��dSr )r��flushr/rrrr��szSpooledTemporaryFile.flushcCs
|j��Sr )r��isattyr/rrrr��szSpooledTemporaryFile.isattycCs.z
|jjWStk
r(|jdYSXdS)Nr�)r�r�rHr�r/rrrr��s
zSpooledTemporaryFile.modecCs&z
|jjWStk
r YdSXdSr )r�rBrHr/rrrrB�s
zSpooledTemporaryFile.namecCs|jjSr )r��newlinesr/rrrr��szSpooledTemporaryFile.newlinescGs|jj|�Sr )r��read�r-rrrrr��szSpooledTemporaryFile.readcGs|jj|�Sr )r��readliner�rrrr��szSpooledTemporaryFile.readlinecGs|jj|�Sr )r��	readlinesr�rrrr��szSpooledTemporaryFile.readlinescGs|jj|�Sr )r�r�r�rrrr��szSpooledTemporaryFile.seekcCs|jjSr )r��	softspacer/rrrr��szSpooledTemporaryFile.softspacecCs
|j��Sr )r�r�r/rrrr��szSpooledTemporaryFile.tellcCs6|dkr|j��n||jkr&|��|j�|�dSr )r��truncater�r�)r-�sizerrrr��s

zSpooledTemporaryFile.truncatecCs|j}|�|�}|�|�|Sr )r�rXr�)r-�srp�rvrrrrX�s

zSpooledTemporaryFile.writecCs|j}|�|�}|�|�|Sr )r��
writelinesr�)r-�iterablerpr�rrrr��s

zSpooledTemporaryFile.writelines)rr�r�NNNNN)N)r;r<r=r�ryr�r�r�r�r0rVr>r�r�r�r�r�r�r�rBr�r�r�r�r�r�r�r�rXr�rrrrrnsR��







c@sNeZdZddd�Zedd��Zedd��Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)rNcCs0t|||�|_tj||j|jd�|�d�|_dS)NzImplicitly cleaning up {!r})�warn_message)rrB�_weakrefZfinalize�_cleanup�format�
_finalizer)r-r$r#r%rrrrys�zTemporaryDirectory.__init__cs ��fdd�}tj�|d�dS)Nc	s�t|dt�r�dd�}zV|�kr0|tj�|��||�zt�|�Wn"ttfk
rh��|�YnXWq�tk
r�Yq�Xnt|dt�r�n�dS)NrcSs6zt�|d�Wntk
r$YnXt�|d�dS)Nrrt)rZchflagsrH�chmod)rDrrr�
resetpermss
z?TemporaryDirectory._rmtree.<locals>.onerror.<locals>.resetperms)	�
issubclassrZrrDrKrUr��_rmtreer^)r�rD�exc_infor���clsrBrr�onerrorsz+TemporaryDirectory._rmtree.<locals>.onerror)r�)�_shutilZrmtree)r�rBr�rr�rr�szTemporaryDirectory._rmtreecCs|�|�t�|t�dSr )r��	_warnings�warn�ResourceWarning)r�rBr�rrrr�/s
zTemporaryDirectory._cleanupcCsd�|jj|j�S)Nz	<{} {!r}>)r��	__class__r;rBr/rrr�__repr__4szTemporaryDirectory.__repr__cCs|jSr )rBr/rrrr�7szTemporaryDirectory.__enter__cCs|��dSr )�cleanupr�rrrr�:szTemporaryDirectory.__exit__cCs|j��r|�|j�dSr )r�r�r�rBr/rrrr�=s
zTemporaryDirectory.cleanup)NNN)r;r<r=ry�classmethodr�r�r�r�r�r�rrrrr�s


)NNNF)NNN)r�r�NNNNNT)r�r�NNNNN)=�__all__�	functoolsr��warningsr��iorW�osrZshutilr��errnor_Zrandomrr,�sysrk�weakrefr��_thread�
allocate_lockZ_allocate_lock�O_RDWRr��O_EXCLrrr�rrTrrr!rfrrr'r(rLrdrerirqr	rr
rr
rrrrvr}rrB�platformrr�r�objectrrrrr�<module>s��





	-
'
( +?��'
��<_sysconfigdata__linux_x86_64-linux-gnu.cpython-38.pyc000064400000070732150335716500016527 0ustar00U

��.en���@s`dddddddddddddd	dd
ddd
dddddddddddddddddddddddddd d!d"d#dddd$d%dd&d'd(d$d)dddd*d+dddddddd,d$d$d$d$dd$dd$d$d$d$d$dddddddddd$dd$d$d$d$d$d$d$d$dd$d$d$d$d$dd$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$dd$d$d$dd$dd$dd$d$d$d$d$d$d$dd$d$d$d$d$d$d$d$d$dd$d$d$d$d$d$d$d$d$d$dd$d$d$d$d$d$dd$d$d$d$dd$d$d$d$d$d$d$d$dd$d$d$d$d$d$d$d$d$d$dd$ddd$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$dd$d$d$d$dd$d$d$d$d$ddd$d$dd$dddd$d$d$ddd$d$dddd$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$dd$d$d$d$d$d$d$d$dd$d$d$d$d$d$d$d$d$d$dd$d$dd$d$dd$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$dd$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$dd$d$d$d$d$d$dd$d$d$d$d$d$d$d$ddd$d$d$dd$d$ddd$d$d$d$d$d$d$dddddd$dd$d$dddddd$ddd$d$d$d$d$d$d$d$d$d$d$ddd$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$d$ddd$d$d$d$ddd$d$d$ddd$dd$d$d$d$d$d$d$d$d$d$d$d$d$d$ddd-ddd.d/d.d.d0d1d2dd3d4d5dd	d6ddd7dd8d9dd:d;dd<ddd=d>d?d@ddd)ddAdBddCdddd
dd$dDdEdFdGdddHddIdJd$dKddddLdMdddddddddNdOdPdddQd$d$dRdd
ddSddddTdUdddVddWd$dXdYddZd4d[d\dd]dd$ddd^d_d`dadbd7ddcddd=ded$dddfdgdhdgdfdhdfdfdgdgdfd\dfdfdfdfdgd$didjdkd$dldmddnd8d$dddddoddpdqdd$ddddrd$d6dsd$d$d$d$dddd$d$ddtdudsdvdwdwdsdx���ZdyS)z��ZarZrcsz!-Wno-unused-result -Wsign-comparez-IObjects -IInclude -IPythonz/usr/binz/usr/lib64/python3.8z-L. -lpython3.8zOgcc -pthread -shared -Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g�pythonzx86_64-redhat-linux-gnu�\zgcc -pthreadz-fPICa-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz?configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.ina-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvaK-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declarationz-Wl,-z,relro  -Wl,-z,now  -gz�-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -ga�'--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-ipv6' '--enable-shared' '--with-computed-gotos=yes' '--with-dbmliborder=gdbm:ndbm:bdb' '--with-system-expat' '--with-system-ffi' '--enable-loadable-sqlite-extensions' '--with-dtrace' '--with-lto' '--with-ssl-default-suites=openssl' '--with-valgrind' '--without-ensurepip' '--enable-optimizations' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS= -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv ' 'LDFLAGS= -Wl,-z,relro  -Wl,-z,now  -g ' 'CPPFLAGS=' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'z/usr/includez/usr/include/python3.8zA/builddir/build/BUILD/Python-3.8.17/build/optimized/coverage.infoz?/builddir/build/BUILD/Python-3.8.17/build/optimized/lcov-reportz2--no-branch-coverage --title "CPython lcov report"zN-IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Includezg++ -pthreadzE/usr /usr/lib64 /usr/lib64/python3.8 /usr/lib64/python3.8/lib-dynloadz /usr/lib64/python3.8/lib-dynloadi�zoREADME.rst ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Ext-dummyzInclude Lib Misc Ext-dummyzTREADME.rst ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in�.�z/usr/bin/dtracezInclude/pydtrace_probes.hzPython/pydtrace.ozdynload_shlib.oZnoz.cpython-38-x86_64-linux-gnu.soi�ZyeszG/usr/include /usr/include /usr/include/python3.8 /usr/include/python3.8z/usr/bin/install -cz/usr/bin/install -c -m 644z/usr/bin/install -c -m 755zlibpython3.8.so.1.0zModules/_io/_iomodule.hzg++ -pthread -sharedz:-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -gzlibpython3.8.soz3.8z
/usr/lib64z-lmzPython/z/usr/lib64/pkgconfigz0/usr/lib64/python3.8/config-3.8-x86_64-linux-gnuzlibpython3.8.az"-lcrypt -lpthread -ldl  -lutil -lmz0tkinter tkinter/test tkinter/test/test_tkinter \Zgccz-Xlinker -export-dynamic�trueZlnZlinuxz5/builddir/build/BUILD/Python-3.8.17/Modules/makesetupz/usr/share/manz/usr/bin/mkdir -pz�posix  errno  pwd  _sre  _codecs  _weakref  _functools  _operator  _collections  _abc  itertools  atexit  _signal  _stat  time  _thread  _locale  _io  faulthandler  _tracemalloc  _symtable  xxsubtypeavModules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/_abc.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_threadmodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  Modules/symtablemodule.o  Modules/xxsubtype.ozx86_64-linux-gnuz -DMULTIARCH=\"x86_64-linux-gnu\"z-Wl,--no-as-neededz-lssl -lcryptoa:-DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz:\ Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.oz-fprofile-generatez"-fprofile-use -fprofile-correctionz
-m test --pgoz
libpython3.sozno-frameworkz./python -Ez	python3.8a-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition  -fprofile-use -fprofile-correction -I/builddir/build/BUILD/Python-3.8.17/Include/internal -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Include -fPIC -DPy_BUILD_CORE_BUILTINa.-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition  -fprofile-use -fprofile-correction -I/builddir/build/BUILD/Python-3.8.17/Include/internala-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition  -fprofile-use -fprofile-correction -I/builddir/build/BUILD/Python-3.8.17/Include/internal -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Include -fPIC -DPy_BUILD_COREaT-Wl,-z,relro  -Wl,-z,now  -g  -Wl,-z,relro  -Wl,-z,now  -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g -lcryptoz"z"a-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g  -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g�a-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches   -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition  -fprofile-use -fprofile-correction -I/builddir/build/BUILD/Python-3.8.17/Include/internal -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.8.17/Include -fPICz)-x test_subprocess test_io test_lib2to3 \ZreadelfzMac/Resources/frameworkZvoidzCLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.8.17/build/optimizedz	@SGI_ABI@z/bin/shz.so���zcpython-38-x86_64-linux-gnuz2Parser Objects Python Modules Modules/_io Programsz:/builddir/build/BUILD/Python-3.8.17/Tools/gdb/libpython.pyz"/* Don't use ncurses extensions */z-szInclude Lib MisczLLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.8.17/build/optimized ./pythonz�LD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.8.17/build/optimized ./python /builddir/build/BUILD/Python-3.8.17/Tools/scripts/run_tests.pyi�zJpython3.8 /builddir/build/BUILD/Python-3.8.17/Tools/scripts/update_file.pyz#/builddir/build/BUILD/Python-3.8.17z)xml xml/dom xml/etree xml/parsers xml/saxz3/builddir/build/BUILD/Python-3.8.17/build/optimizedz
/usr/sharez/usr(�ZABIFLAGSZAC_APPLE_UNIVERSAL_BUILDZAIX_GENUINE_CPLUSPLUSZ	ALT_SOABIZANDROID_API_LEVELZARZARFLAGSZ
BASECFLAGSZBASECPPFLAGSZBASEMODLIBSZBINDIRZ
BINLIBDESTZ
BLDLIBRARYZ	BLDSHAREDZBUILDEXEZBUILDPYTHONZBUILD_GNU_TYPEZBYTESTR_DEPSZCCZCCSHAREDZCFLAGSZCFLAGSFORSHAREDZCFLAGS_ALIASINGZCONFIGFILESZCONFIGURE_CFLAGSZCONFIGURE_CFLAGS_NODISTZCONFIGURE_CPPFLAGSZCONFIGURE_LDFLAGSZCONFIGURE_LDFLAGS_NODISTZCONFIG_ARGSZCONFINCLUDEDIRZ
CONFINCLUDEPYZCOREPYTHONPATHZ
COVERAGE_INFOZCOVERAGE_REPORTZCOVERAGE_REPORT_OPTIONSZCPPFLAGSZCXXZDESTDIRSZDESTLIBZDESTPATHZ
DESTSHAREDZDFLAGSZDIRMODEZDISTZDISTDIRSZ	DISTFILESZ	DLINCLDIRZ
DLLLIBRARYZ"DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754ZDOUBLE_IS_BIG_ENDIAN_IEEE754ZDOUBLE_IS_LITTLE_ENDIAN_IEEE754ZDTRACEZDTRACE_DEPSZDTRACE_HEADERSZDTRACE_OBJSZDYNLOADFILEZENABLE_IPV6Z	ENSUREPIPZEXEZEXEMODEZ
EXTRATESTOPTSZ
EXT_SUFFIXZFILEMODEZFLOAT_WORDS_BIGENDIANZFLOCK_NEEDS_LIBBSDZGETPGRP_HAVE_ARGZGETTIMEOFDAY_NO_TZZ	GITBRANCHZGITTAGZ
GITVERSIONZGNULDZHAVE_ACCEPT4Z
HAVE_ACOSHZ
HAVE_ADDRINFOZ
HAVE_ALARMZHAVE_ALIGNED_REQUIREDZ
HAVE_ALLOCA_HZHAVE_ALTZONEZ
HAVE_ASINHZHAVE_ASM_TYPES_HZ
HAVE_ATANHZHAVE_BIND_TEXTDOMAIN_CODESETZHAVE_BLUETOOTH_BLUETOOTH_HZHAVE_BLUETOOTH_HZHAVE_BROKEN_MBSTOWCSZHAVE_BROKEN_NICEZHAVE_BROKEN_PIPE_BUFZHAVE_BROKEN_POLLZHAVE_BROKEN_POSIX_SEMAPHORESZHAVE_BROKEN_PTHREAD_SIGMASKZHAVE_BROKEN_SEM_GETVALUEZHAVE_BROKEN_UNSETENVZHAVE_BUILTIN_ATOMICZHAVE_CHFLAGSZ
HAVE_CHOWNZHAVE_CHROOTZ
HAVE_CLOCKZHAVE_CLOCK_GETRESZHAVE_CLOCK_GETTIMEZHAVE_CLOCK_SETTIMEZHAVE_COMPUTED_GOTOSZHAVE_CONFSTRZHAVE_CONIO_HZ
HAVE_COPYSIGNZHAVE_COPY_FILE_RANGEZHAVE_CRYPT_HZHAVE_CRYPT_RZHAVE_CTERMIDZHAVE_CTERMID_RZHAVE_CURSES_FILTERZ
HAVE_CURSES_HZHAVE_CURSES_HAS_KEYZHAVE_CURSES_IMMEDOKZHAVE_CURSES_IS_PADZHAVE_CURSES_IS_TERM_RESIZEDZHAVE_CURSES_RESIZETERMZHAVE_CURSES_RESIZE_TERMZHAVE_CURSES_SYNCOKZHAVE_CURSES_TYPEAHEADZHAVE_CURSES_USE_ENVZHAVE_CURSES_WCHGATZHAVE_DECL_ISFINITEZHAVE_DECL_ISINFZHAVE_DECL_ISNANZHAVE_DECL_RTLD_DEEPBINDZHAVE_DECL_RTLD_GLOBALZHAVE_DECL_RTLD_LAZYZHAVE_DECL_RTLD_LOCALZHAVE_DECL_RTLD_MEMBERZHAVE_DECL_RTLD_NODELETEZHAVE_DECL_RTLD_NOLOADZHAVE_DECL_RTLD_NOWZHAVE_DECL_TZNAMEZHAVE_DEVICE_MACROSZHAVE_DEV_PTCZ
HAVE_DEV_PTMXZ
HAVE_DIRECT_HZHAVE_DIRENT_D_TYPEZ
HAVE_DIRENT_HZ
HAVE_DIRFDZHAVE_DLFCN_HZHAVE_DLOPENZ	HAVE_DUP2Z	HAVE_DUP3Z$HAVE_DYLD_SHARED_CACHE_CONTAINS_PATHZHAVE_DYNAMIC_LOADINGZ
HAVE_ENDIAN_HZ
HAVE_EPOLLZHAVE_EPOLL_CREATE1ZHAVE_ERFZ	HAVE_ERFCZHAVE_ERRNO_HZ
HAVE_EXECVZHAVE_EXPLICIT_BZEROZHAVE_EXPLICIT_MEMSETZ
HAVE_EXPM1ZHAVE_FACCESSATZHAVE_FCHDIRZHAVE_FCHMODZ
HAVE_FCHMODATZHAVE_FCHOWNZ
HAVE_FCHOWNATZHAVE_FCNTL_HZHAVE_FDATASYNCZHAVE_FDOPENDIRZHAVE_FDWALKZHAVE_FEXECVEZHAVE_FINITEZ
HAVE_FLOCKZ	HAVE_FORKZHAVE_FORKPTYZHAVE_FPATHCONFZHAVE_FSEEK64ZHAVE_FSEEKOZHAVE_FSTATATZ
HAVE_FSTATVFSZ
HAVE_FSYNCZHAVE_FTELL64ZHAVE_FTELLOZ
HAVE_FTIMEZHAVE_FTRUNCATEZ
HAVE_FUTIMENSZHAVE_FUTIMESZHAVE_FUTIMESATZHAVE_GAI_STRERRORZ
HAVE_GAMMAZHAVE_GCC_ASM_FOR_MC68881ZHAVE_GCC_ASM_FOR_X64ZHAVE_GCC_ASM_FOR_X87ZHAVE_GCC_UINT128_TZHAVE_GETADDRINFOZHAVE_GETC_UNLOCKEDZHAVE_GETENTROPYZHAVE_GETGRGID_RZHAVE_GETGRNAM_RZHAVE_GETGROUPLISTZHAVE_GETGROUPSZHAVE_GETHOSTBYNAMEZHAVE_GETHOSTBYNAME_RZHAVE_GETHOSTBYNAME_R_3_ARGZHAVE_GETHOSTBYNAME_R_5_ARGZHAVE_GETHOSTBYNAME_R_6_ARGZHAVE_GETITIMERZHAVE_GETLOADAVGZ
HAVE_GETLOGINZHAVE_GETNAMEINFOZHAVE_GETPAGESIZEZHAVE_GETPEERNAMEZHAVE_GETPGIDZHAVE_GETPGRPZHAVE_GETPIDZHAVE_GETPRIORITYZ
HAVE_GETPWENTZHAVE_GETPWNAM_RZHAVE_GETPWUID_RZHAVE_GETRANDOMZHAVE_GETRANDOM_SYSCALLZHAVE_GETRESGIDZHAVE_GETRESUIDZHAVE_GETSIDZ
HAVE_GETSPENTZ
HAVE_GETSPNAMZHAVE_GETTIMEOFDAYZ
HAVE_GETWDZHAVE_GLIBC_MEMMOVE_BUGZ
HAVE_GRP_HZHAVE_HSTRERRORZHAVE_HTOLE64Z
HAVE_HYPOTZ
HAVE_IEEEFP_HZHAVE_IF_NAMEINDEXZHAVE_INET_ATONZHAVE_INET_PTONZHAVE_INITGROUPSZHAVE_INTTYPES_HZ	HAVE_IO_HZHAVE_IPA_PURE_CONST_BUGZ	HAVE_KILLZHAVE_KILLPGZHAVE_KQUEUEZHAVE_LANGINFO_HZHAVE_LARGEFILE_SUPPORTZ
HAVE_LCHFLAGSZHAVE_LCHMODZHAVE_LCHOWNZHAVE_LGAMMAZ
HAVE_LIBDLZHAVE_LIBDLDZHAVE_LIBIEEEZHAVE_LIBINTL_HZHAVE_LIBREADLINEZHAVE_LIBRESOLVZHAVE_LIBSENDFILEZHAVE_LIBUTIL_HZ	HAVE_LINKZHAVE_LINKATZHAVE_LINUX_CAN_BCM_HZHAVE_LINUX_CAN_HZHAVE_LINUX_CAN_RAW_FD_FRAMESZHAVE_LINUX_CAN_RAW_HZHAVE_LINUX_MEMFD_HZHAVE_LINUX_NETLINK_HZHAVE_LINUX_QRTR_HZHAVE_LINUX_RANDOM_HZHAVE_LINUX_TIPC_HZHAVE_LINUX_VM_SOCKETS_HZ
HAVE_LOCKFZ
HAVE_LOG1PZ	HAVE_LOG2ZHAVE_LONG_DOUBLEZ
HAVE_LSTATZHAVE_LUTIMESZHAVE_MADVISEZHAVE_MAKEDEVZHAVE_MBRTOWCZHAVE_MEMFD_CREATEZ
HAVE_MEMORY_HZHAVE_MEMRCHRZHAVE_MKDIRATZHAVE_MKFIFOZ
HAVE_MKFIFOATZ
HAVE_MKNODZHAVE_MKNODATZHAVE_MKTIMEZ	HAVE_MMAPZHAVE_MREMAPZHAVE_NCURSES_HZHAVE_NDIR_HZHAVE_NETPACKET_PACKET_HZ
HAVE_NET_IF_HZ	HAVE_NICEZHAVE_OPENATZHAVE_OPENPTYZ
HAVE_PATHCONFZ
HAVE_PAUSEZ
HAVE_PIPE2Z
HAVE_PLOCKZ	HAVE_POLLZHAVE_POLL_HZHAVE_POSIX_FADVISEZHAVE_POSIX_FALLOCATEZHAVE_POSIX_SPAWNZHAVE_POSIX_SPAWNPZ
HAVE_PREADZHAVE_PREADVZHAVE_PREADV2ZHAVE_PRLIMITZHAVE_PROCESS_HZHAVE_PROTOTYPESZHAVE_PTHREAD_CONDATTR_SETCLOCKZHAVE_PTHREAD_DESTRUCTORZHAVE_PTHREAD_GETCPUCLOCKIDZHAVE_PTHREAD_HZHAVE_PTHREAD_INITZHAVE_PTHREAD_KILLZHAVE_PTHREAD_SIGMASKZ
HAVE_PTY_HZHAVE_PUTENVZHAVE_PWRITEZHAVE_PWRITEVZ
HAVE_PWRITEV2Z
HAVE_READLINKZHAVE_READLINKATZ
HAVE_READVZ
HAVE_REALPATHZ
HAVE_RENAMEATZHAVE_RL_APPEND_HISTORYZHAVE_RL_CATCH_SIGNALZ#HAVE_RL_COMPLETION_APPEND_CHARACTERZ'HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOKZHAVE_RL_COMPLETION_MATCHESZ"HAVE_RL_COMPLETION_SUPPRESS_APPENDZHAVE_RL_PRE_INPUT_HOOKZHAVE_RL_RESIZE_TERMINALZ
HAVE_ROUNDZ
HAVE_RTPSPAWNZHAVE_SCHED_GET_PRIORITY_MAXZHAVE_SCHED_HZHAVE_SCHED_RR_GET_INTERVALZHAVE_SCHED_SETAFFINITYZHAVE_SCHED_SETPARAMZHAVE_SCHED_SETSCHEDULERZHAVE_SEM_GETVALUEZ
HAVE_SEM_OPENZHAVE_SEM_TIMEDWAITZHAVE_SEM_UNLINKZ
HAVE_SENDFILEZHAVE_SETEGIDZHAVE_SETEUIDZHAVE_SETGIDZHAVE_SETGROUPSZHAVE_SETHOSTNAMEZHAVE_SETITIMERZHAVE_SETLOCALEZHAVE_SETPGIDZHAVE_SETPGRPZHAVE_SETPRIORITYZ
HAVE_SETREGIDZHAVE_SETRESGIDZHAVE_SETRESUIDZ
HAVE_SETREUIDZHAVE_SETSIDZHAVE_SETUIDZHAVE_SETVBUFZ
HAVE_SHADOW_HZ
HAVE_SHM_OPENZHAVE_SHM_UNLINKZHAVE_SIGACTIONZHAVE_SIGALTSTACKZHAVE_SIGFILLSETZHAVE_SIGINFO_T_SI_BANDZHAVE_SIGINTERRUPTZ
HAVE_SIGNAL_HZHAVE_SIGPENDINGZ
HAVE_SIGRELSEZHAVE_SIGTIMEDWAITZHAVE_SIGWAITZHAVE_SIGWAITINFOZ
HAVE_SNPRINTFZHAVE_SOCKADDR_ALGZHAVE_SOCKADDR_SA_LENZHAVE_SOCKADDR_STORAGEZHAVE_SOCKETPAIRZHAVE_SPAWN_HZHAVE_SSIZE_TZHAVE_STATVFSZHAVE_STAT_TV_NSECZHAVE_STAT_TV_NSEC2ZHAVE_STDARG_PROTOTYPESZ
HAVE_STDINT_HZ
HAVE_STDLIB_HZHAVE_STD_ATOMICZHAVE_STRDUPZ
HAVE_STRFTIMEZHAVE_STRINGS_HZ
HAVE_STRING_HZHAVE_STRLCPYZHAVE_STROPTS_HZHAVE_STRSIGNALZHAVE_STRUCT_PASSWD_PW_GECOSZHAVE_STRUCT_PASSWD_PW_PASSWDZHAVE_STRUCT_STAT_ST_BIRTHTIMEZHAVE_STRUCT_STAT_ST_BLKSIZEZHAVE_STRUCT_STAT_ST_BLOCKSZHAVE_STRUCT_STAT_ST_FLAGSZHAVE_STRUCT_STAT_ST_GENZHAVE_STRUCT_STAT_ST_RDEVZHAVE_STRUCT_TM_TM_ZONEZHAVE_SYMLINKZHAVE_SYMLINKATZ	HAVE_SYNCZHAVE_SYSCONFZHAVE_SYSEXITS_HZHAVE_SYS_AUDIOIO_HZHAVE_SYS_BSDTTY_HZHAVE_SYS_DEVPOLL_HZHAVE_SYS_DIR_HZHAVE_SYS_ENDIAN_HZHAVE_SYS_EPOLL_HZHAVE_SYS_EVENT_HZHAVE_SYS_FILE_HZHAVE_SYS_IOCTL_HZHAVE_SYS_KERN_CONTROL_HZHAVE_SYS_LOADAVG_HZHAVE_SYS_LOCK_HZHAVE_SYS_MEMFD_HZHAVE_SYS_MKDEV_HZHAVE_SYS_MMAN_HZHAVE_SYS_MODEM_HZHAVE_SYS_NDIR_HZHAVE_SYS_PARAM_HZHAVE_SYS_POLL_HZHAVE_SYS_RANDOM_HZHAVE_SYS_RESOURCE_HZHAVE_SYS_SELECT_HZHAVE_SYS_SENDFILE_HZHAVE_SYS_SOCKET_HZHAVE_SYS_STATVFS_HZHAVE_SYS_STAT_HZHAVE_SYS_SYSCALL_HZHAVE_SYS_SYSMACROS_HZHAVE_SYS_SYS_DOMAIN_HZHAVE_SYS_TERMIO_HZHAVE_SYS_TIMES_HZHAVE_SYS_TIME_HZHAVE_SYS_TYPES_HZHAVE_SYS_UIO_HZ
HAVE_SYS_UN_HZHAVE_SYS_UTSNAME_HZHAVE_SYS_WAIT_HZHAVE_SYS_XATTR_HZHAVE_TCGETPGRPZHAVE_TCSETPGRPZHAVE_TEMPNAMZHAVE_TERMIOS_HZHAVE_TERM_HZHAVE_TGAMMAZHAVE_TIMEGMZ
HAVE_TIMESZHAVE_TMPFILEZHAVE_TMPNAMZ
HAVE_TMPNAM_RZHAVE_TM_ZONEZ
HAVE_TRUNCATEZHAVE_TZNAMEZ
HAVE_UCS4_TCLZ
HAVE_UNAMEZ
HAVE_UNISTD_HZ
HAVE_UNLINKATZ
HAVE_UNSETENVZHAVE_USABLE_WCHAR_TZHAVE_UTIL_HZHAVE_UTIMENSATZHAVE_UTIMESZHAVE_UTIME_HZHAVE_UUID_CREATEZHAVE_UUID_ENC_BEZHAVE_UUID_GENERATE_TIME_SAFEZHAVE_UUID_HZHAVE_UUID_UUID_HZ
HAVE_WAIT3Z
HAVE_WAIT4ZHAVE_WAITIDZHAVE_WAITPIDZHAVE_WCHAR_HZHAVE_WCSCOLLZ
HAVE_WCSFTIMEZHAVE_WCSXFRMZHAVE_WMEMCMPZHAVE_WORKING_TZSETZHAVE_WRITEVZ HAVE_X509_VERIFY_PARAM_SET1_HOSTZHAVE_ZLIB_COPYZHAVE__GETPTYZ
HOST_GNU_TYPEZINCLDIRSTOMAKEZ
INCLUDEDIRZ	INCLUDEPYZINSTALLZINSTALL_DATAZINSTALL_PROGRAMZINSTALL_SCRIPTZINSTALL_SHAREDZ
INSTSONAMEZIO_HZIO_OBJSZLDCXXSHAREDZLDFLAGSZ	LDLIBRARYZLDLIBRARYDIRZLDSHAREDZ	LDVERSIONZLIBCZLIBDESTZLIBDIRZLIBFFI_INCLUDEDIRZLIBMZ	LIBOBJDIRZLIBOBJSZLIBPCZLIBPLZ	LIBPYTHONZLIBRARYZLIBRARY_OBJSZLIBRARY_OBJS_OMIT_FROZENZLIBSZ
LIBSUBDIRSZLINKCCZ
LINKFORSHAREDZLIPO_32BIT_FLAGSZLIPO_INTEL64_FLAGSZ
LLVM_PROF_ERRZLLVM_PROF_FILEZLLVM_PROF_MERGERZLNZLOCALMODLIBSZMACHDEPZMACHDEP_OBJSZMACHDESTLIBZMACOSX_DEPLOYMENT_TARGETZMAINCCZMAJOR_IN_MKDEVZMAJOR_IN_SYSMACROSZ	MAKESETUPZMANDIRZMKDIR_PZMODBUILT_NAMESZMODDISABLED_NAMESZMODLIBSZMODOBJSZMODULE_OBJSZ	MULTIARCHZMULTIARCH_CPPFLAGSZMVWDELCH_IS_EXPRESSIONZNO_AS_NEEDEDZOBJECT_OBJSZOPENSSL_INCLUDESZOPENSSL_LDFLAGSZOPENSSL_LIBSZOPTZOTHER_LIBTOOL_OPTZPACKAGE_BUGREPORTZPACKAGE_NAMEZPACKAGE_STRINGZPACKAGE_TARNAMEZPACKAGE_URLZPACKAGE_VERSIONZPARSER_HEADERSZPARSER_OBJSZPGO_PROF_GEN_FLAGZPGO_PROF_USE_FLAGZPOBJSZPOSIX_SEMAPHORES_NOT_ENABLEDZPROFILE_TASKZ$PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INTZPTHREAD_SYSTEM_SCHED_SUPPORTEDZ
PY3LIBRARYZPYLONG_BITS_IN_DIGITZPYTHONZPYTHONFRAMEWORKZPYTHONFRAMEWORKDIRZPYTHONFRAMEWORKINSTALLDIRZPYTHONFRAMEWORKPREFIXZ
PYTHONPATHZPYTHON_FOR_BUILDZPYTHON_FOR_REGENZPYTHON_HEADERSZPYTHON_OBJSZPY_BUILTIN_MODULE_CFLAGSZ	PY_CFLAGSZPY_CFLAGS_NODISTZPY_COERCE_C_LOCALEZPY_CORE_CFLAGSZPY_CORE_LDFLAGSZPY_CPPFLAGSZPY_FORMAT_SIZE_TZ
PY_LDFLAGSZPY_LDFLAGS_NODISTZPY_SSL_DEFAULT_CIPHERSZPY_SSL_DEFAULT_CIPHER_STRINGZPY_STDMODULE_CFLAGSZPy_DEBUGZPy_ENABLE_SHAREDZPy_HASH_ALGORITHMZ
Py_TRACE_REFSZ
QUICKTESTOPTSZREADELFZ	RESSRCDIRZ
RETSIGTYPEZ	RUNSHAREDZ	SCRIPTDIRZSETPGRP_HAVE_ARGZSGI_ABIZSHELLZSHLIBSZSHLIB_SUFFIXZSHM_NEEDS_LIBRTZSIGNED_RIGHT_SHIFT_ZERO_FILLSZSITEPATHZ
SIZEOF_DOUBLEZSIZEOF_FLOATZ
SIZEOF_FPOS_TZ
SIZEOF_INTZSIZEOF_LONGZSIZEOF_LONG_DOUBLEZSIZEOF_LONG_LONGZSIZEOF_OFF_TZSIZEOF_PID_TZSIZEOF_PTHREAD_KEY_TZSIZEOF_PTHREAD_TZSIZEOF_SHORTZ
SIZEOF_SIZE_TZ
SIZEOF_TIME_TZSIZEOF_UINTPTR_TZ
SIZEOF_VOID_PZSIZEOF_WCHAR_TZSIZEOF__BOOLZSOABIZSRCDIRSZ
SRC_GDB_HOOKSZSTDC_HEADERSZSTRICT_SYSV_CURSESZ	STRIPFLAGZSUBDIRSZ
SUBDIRSTOOZSYSLIBSZSYS_SELECT_WITH_SYS_TIMEZTCLTK_INCLUDESZ
TCLTK_LIBSZTESTOPTSZTESTPATHZ
TESTPYTHONZTESTPYTHONOPTSZ
TESTRUNNERZTESTTIMEOUTZTIMEMODULE_LIBZTIME_WITH_SYS_TIMEZTM_IN_SYS_TIMEZUNICODE_DEPSZUNIVERSALSDKZUPDATE_FILEZUSE_COMPUTED_GOTOSZVERSIONZVPATHZWINDOW_HAS_FLAGSZWITH_DECIMAL_CONTEXTVARZWITH_DOC_STRINGSZWITH_DTRACEZ	WITH_DYLDZWITH_LIBINTLZWITH_NEXT_FRAMEWORKZ
WITH_PYMALLOCZ
WITH_VALGRINDZX87_DOUBLE_ROUNDINGZ
XMLLIBSUBDIRSZabs_builddirZ
abs_srcdirZdatarootdir�exec_prefix�prefixZsrcdirN)Zbuild_time_vars�rr�>/usr/lib64/python3.8/_sysconfigdata__linux_x86_64-linux-gnu.py�<module>sb2,/��������crypt.cpython-38.opt-2.pyc000064400000005247150335716500011312 0ustar00U

e5d�@s,ddlZzddlZWn0ek
rDejdkr8ed��ned��YnXddlZddlm	Z
ddlmZ
ejejdZe
�ZGdd	�d	e
d	d
��Zd%dd�dd
�Zd&dd�ZgZdd�dd�Zedddd�edddd�dD](Zeddeddee�dd�r��qq�eddd d!�ed"dd#d$�[[dS)'�NZwin32z,The crypt module is not supported on Windowsz;The required _crypt module was not built as part of CPython)�SystemRandom)�
namedtuplez./c@seZdZdd�ZdS)�_MethodcCsd�|j�S)Nz<crypt.METHOD_{}>)�format�name)�self�r�/usr/lib64/python3.8/crypt.py�__repr__sz_Method.__repr__N)�__name__�
__module__�__qualname__r
rrrr	rsrz name ident salt_chars total_size��roundscCsB|dkrtd}|dk	r4t|t�s4t|jj�d���|js@d}nd|j�d�}|jr�|jddkr�|dkrpd}n@t�|d�}|d|>kr�td��d	|kr�d
ks�ntd��||d�d�7}n^|jd
k�r|dk	�r d|kr�dks�ntd��|d|�d�7}n|dk	�r t|�d���|d�	dd�t
|j�D��7}|S)Nrz+ object cannot be interpreted as an integer��$�2��zrounds must be a power of 2��z%rounds out of the range 2**4 to 2**31Z02d)�5�6i�i�ɚ;z+rounds out of the range 1000 to 999_999_999zrounds=z$ doesn't support the rounds argumentcss|]}t�t�VqdS�N)�_srZchoice�
_saltchars)�.0�charrrr	�	<genexpr>Aszmksalt.<locals>.<genexpr>)�methods�
isinstance�int�	TypeError�	__class__rZident�
bit_length�
ValueError�join�rangeZ
salt_chars)�methodr�sZ
log_roundsrrr	�mksalts2

r*cCs&|dkst|t�rt|�}t�||�Sr)r rr*�_crypt�crypt)Zword�saltrrr	r,Es
r,cGsVt|f|��}|t�d|<t||d�}td|�}|rRt|�|jkrRt�|�dSdS)NZMETHOD_rrTF)r�globalsr*r,�lenZ
total_sizer�append)rr�argsr(r-�resultrrr	�_add_methodWs

r3ZSHA512r��jZSHA256r�?)�b�y�arZBLOWFISHr��;ZMD5�1��"ZCRYPT��
)N)N)�sys�_sysr+�ModuleNotFoundError�platform�ImportError�stringZ_stringZrandomrZ
_SystemRandom�collectionsrZ_namedtupleZ
ascii_lettersZdigitsrrrr*r,rr3Z_vr/rrrr	�<module>s0

	&

socket.cpython-38.pyc000064400000066215150335716500010503 0ustar00U

e5d���@sdZddlZddlTddlZddlZddlZddlZddlmZmZzddl	Z	Wne
k
rhdZ	YnXee	dd�Zee	dd�Z
ee	d	d�Zd
ddd
dddgZe�e�e��e�dedd��e�dedd��e�dedd��e�dedd��dZdZdd�ZeZej���d��r$iZded<ded <d!ed"<d#ed$<d%ed&<d'ed(<d)ed*<d+ed,<d-ed.<d/ed0<d1ed2<d3ed4<d5ed6<d7ed8<d9ed:<d;ed<<d=ed><d?ed@<dAedB<dCedD<dEedF<dGedH<dIedJ<dKedL<dMedN<dOedP<dQedR<dSedT<dUedV<dWedX<dYedZ<d[ed\<d]ed^<d_ed`<daedb<dcedd<deedf<dgedh<diedj<dkedl<dmedn<doedp<dqedr<dsedt<duedv<dwedx<dyedz<d{ed|<d}ed~<ded�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<d�ed�<e�d١Gd�dۄd�e�ZGd�d݄d�ej�Zd�d�d
�Z e!ejd߃�rpd�d�Z"e�d�e!ed��r�de#dfd�d�Z$ne%e#dfd�d�Z$e�d�d�e$_e
ehZ&Gd�d�d�ej'�Z(d�d�d�Z)e*�Z+e+dfd�d�Z,d�d�Z-e%dd�d�d�d�d
�Z.d�d�d�Z/dS)�a0This module provides socket operations and some related functions.
On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
On other systems, it only supports IP. Functions specific for a
socket are available as methods of the socket object.

Functions:

socket() -- create a new socket object
socketpair() -- create a pair of new socket objects [*]
fromfd() -- create a socket object from an open file descriptor [*]
fromshare() -- create a socket object from data received from socket.share() [*]
gethostname() -- return the current hostname
gethostbyname() -- map a hostname to its IP number
gethostbyaddr() -- map an IP number or hostname to DNS info
getservbyname() -- map a service name and a protocol name to a port number
getprotobyname() -- map a protocol name (e.g. 'tcp') to a number
ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order
htons(), htonl() -- convert 16, 32 bit int from host to network byte order
inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format
inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89)
socket.getdefaulttimeout() -- get the default timeout value
socket.setdefaulttimeout() -- set the default timeout value
create_connection() -- connects to an address, with an optional timeout and
                       optional source address.

 [*] not available on all platforms!

Special objects:

SocketType -- type object for socket objects
error -- exception raised for I/O errors
has_ipv6 -- boolean value indicating if IPv6 is supported

IntEnum constants:

AF_INET, AF_UNIX -- socket domains (first argument to socket() call)
SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument)

Integer constants:

Many other constants may be defined; these may be used in calls to
the setsockopt() and getsockopt() methods.
�N)�*)�IntEnum�IntFlag�EBADF�	�EAGAIN��EWOULDBLOCK�fromfd�getfqdn�create_connection�
create_server�has_dualstack_ipv6�
AddressFamily�
SocketKindcCs|��o|�d�S)NZAF_��isupper�
startswith��C�r�/usr/lib64/python3.8/socket.py�<lambda>L�rcCs|��o|�d�S)NZSOCK_rrrrrrQrZMsgFlagcCs|��o|�d�S)NZMSG_rrrrrrVrZAddressInfocCs|��o|�d�S)NZAI_rrrrrr[rz	127.0.0.1z::1cCs(z
||�WStk
r"|YSXdS)z{Convert a numeric family value to an IntEnum member.

    If it's not a known member, return the numeric value itself.
    N)�
ValueError)�valueZ
enum_klassrrr�_intenum_converteras
r�winz)Specified event object handle is invalid.�zInsufficient memory available.�z#One or more parameters are invalid.�WzOverlapped operation aborted.i�z2Overlapped I/O event object not in signaled state.i�z)Overlapped operation will complete later.i�zThe operation was interrupted.i'zA bad file handle was passed.i'zPermission denied.i'z!A fault occurred on the network??i'z#An invalid operation was attempted.i&'zToo many open files.i('z The socket operation would blocki3'z,A blocking operation is already in progress.i4'zOperation already in progress.i5'zSocket operation on nonsocket.i6'zDestination address required.i7'zMessage too long.i8'zProtocol wrong type for socket.i9'zBad protocol option.i:'zProtocol not supported.i;'zSocket type not supported.i<'zOperation not supported.i='zProtocol family not supported.i>'z0Address family not supported by protocol family.i?'zThe network address is in use.i@'z Cannot assign requested address.iA'zNetwork is down.iB'zNetwork is unreachable.iC'z$Network dropped connection on reset.iD'z!Software caused connection abort.iE'zThe connection has been reset.iF'zNo buffer space available.iG'zSocket is already connected.iH'zSocket is not connected.iI'zThe network has been shut down.iJ'zToo many references.iK'zThe operation timed out.iL'zConnection refused.iM'zCannot translate name.iN'zThe name is too long.iO'zThe host is down.iP'zThe host is unreachable.iQ'zDirectory not empty.iR'zToo many processes.iS'zUser quota exceeded.iT'zDisk quota exceeded.iU'zStale file handle reference.iV'zItem is remote.iW'z!Network subsystem is unavailable.ik'z!Winsock.dll version out of range.il'z(Successful WSAStartup not yet performed.im'zGraceful shutdown in progress.iu'z*No more results from WSALookupServiceNext.iv'zCall has been canceled.iw'z Procedure call table is invalid.ix'zService provider is invalid.iy'z&Service provider failed to initialize.iz'zSystem call failure.i{'zService not found.i|'zClass type not found.i}'i~'zCall was canceled.i'zDatabase query was refused.i�'zHost not found.i�*z Nonauthoritative host not found.i�*zThis is a nonrecoverable error.i�*z*Valid name, no data record requested type.i�*zQoS receivers.i�*zQoS senders.i�*zNo QoS senders.i�*zQoS no receivers.i+zQoS request confirmed.i+zQoS admission error.i+zQoS policy failure.i+zQoS bad style.i+zQoS bad object.i+zQoS traffic control error.i+zQoS generic error.i+zQoS service type error.i+zQoS flowspec error.i	+zInvalid QoS provider buffer.i
+zInvalid QoS filter style.i+i+zIncorrect QoS filter count.i
+zInvalid QoS object length.i+zIncorrect QoS flow count.i+zUnrecognized QoS object.i+zInvalid QoS policy object.i+zInvalid QoS flow descriptor.i+z'Invalid QoS provider-specific flowspec.i+z)Invalid QoS provider-specific filterspec.i+z&Invalid QoS shape discard mode object.i+z Invalid QoS shaping rate object.i+z!Reserved policy QoS element type.i+�errorTabc@seZdZdS)�_GiveupOnSendfileN)�__name__�
__module__�__qualname__rrrrr"�sr"cs,eZdZdZdddgZd9dd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zd:dddd�dd�Ze
ed�rzd;dd�Zn
d<dd�Zd=dd�Zd d!�Zd>d"d#�Zd$d%�Zejfd&d'�Zd(d)�Z�fd*d+�Ze�fd,d-��Ze�fd.d/��Zejd0k�rd1d2�Zd3d4�Znd5d2�Zd6d4�Zd7e_d8e_�ZS)?�socketz:A subclass of _socket.socket adding the makefile() method.�__weakref__�_io_refs�_closed���NcCsP|dkr,|dkrt}|dkr t}|dkr,d}tj�|||||�d|_d|_dS)Nr*rF)�AF_INET�SOCK_STREAM�_socketr&�__init__r(r))�self�family�type�proto�filenorrrr.�szsocket.__init__cCs|S�Nr�r/rrr�	__enter__�szsocket.__enter__cGs|js|��dSr4)r)�close)r/�argsrrr�__exit__�szsocket.__exit__cCs�t|dd�}d|jj|jj|r"dnd|��|j|j|jf}|s�z |��}|r^|dt	|�7}Wnt
k
rtYnXz |��}|r�|dt	|�7}Wnt
k
r�YnX|d7}|S)	zVWrap __repr__() to reveal the real class name and socket
        address(es).
        r)Fz,<%s.%s%s fd=%i, family=%s, type=%s, proto=%iz	 [closed]�z
, laddr=%sz
, raddr=%s�>)�getattr�	__class__r$r%r3r0r1r2�getsockname�str�errorZgetpeername)r/�closed�sZladdrZraddrrrr�__repr__�s4
��zsocket.__repr__cCstd|jj�d���dS)Nzcannot pickle z object)�	TypeErrorr=r#r5rrr�__getstate__szsocket.__getstate__cCs6t|���}|j|j|j|j|d�}|�|���|S)z�dup() -> socket object

        Duplicate the socket. Return a new socket object connected to the same
        system resource. The new socket is non-inheritable.
        �r3)�dupr3r=r0r1r2�
settimeout�
gettimeout)r/�fd�sockrrrrGsz
socket.dupcCsF|��\}}t|j|j|j|d�}t�dkr>|��r>|�d�||fS)z�accept() -> (socket object, address info)

        Wait for an incoming connection.  Return a new socket
        representing the connection, and the address of the client.
        For IP sockets, the address info is a pair (hostaddr, port).
        rFNT)Z_acceptr&r0r1r2ZgetdefaulttimeoutrI�setblocking)r/rJ�addrrKrrr�accepts

z
socket.accept�r)�encoding�errors�newlinec
Cst|�dddhks td|f��d|k}d|kp4|}|sB|sBt�d|k}d}	|rZ|	d7}	|rf|	d7}	t||	�}
|jd7_|dkr�d}|d	kr�tj}|d	kr�|s�td
��|
S|r�|r�t�|
|
|�}n&|r�t�|
|�}n|s�t�t�	|
|�}|r�|St�
||||�}||_|S)z�makefile(...) -> an I/O stream connected to the socket

        The arguments are as for io.open() after the filename, except the only
        supported mode values are 'r' (default), 'w' and 'b'.
        rO�w�bz&invalid mode %r (only r, w, b allowed)r:�Nr*rz!unbuffered streams must be binary)�setr�AssertionError�SocketIOr(�io�DEFAULT_BUFFER_SIZE�BufferedRWPair�BufferedReader�BufferedWriter�
TextIOWrapper�mode)
r/r_�	bufferingrPrQrRZwritingZreadingZbinaryZrawmode�raw�buffer�textrrr�makefile-s@
zsocket.makefile�sendfilerc
Cs�|�|||�|��}z|��}Wn0ttjfk
rR}zt|��W5d}~XYnXzt�|�j}Wn*t	k
r�}zt|��W5d}~XYnX|s�dSt
|p�|d�}|��}	|	dkr�td��t
td�r�t��}
nt��}
|
�|tj�d}|
j}tj}
z�|	�r||	��st�d��|�r0||}|dk�r0�q�z|
||||�}Wn`tk
�rh|	�s`|�Yq�Yq�t	k
�r�}z|dk�r�t|��|d�W5d}~XYq�X|dk�r��q�||7}||7}q�|W�S|dk�r�t
|d��r�|�|�XdS)Nri@�&non-blocking sockets are not supported�PollSelector�seekz	timed out)�_check_sendfile_paramsr3�AttributeErrorrY�UnsupportedOperationr"�os�fstat�st_size�OSError�minrIr�hasattr�	selectorsrgZSelectSelector�registerZEVENT_WRITEZselectrerhr-�timeout�BlockingIOError)r/�file�offset�countZsocknor3�errZfsize�	blocksizertZselector�
total_sentZselector_selectZos_sendfile�sentrrr�_sendfile_use_sendfileYs^






zsocket._sendfile_use_sendfilecCstd��dS)Nz,os.sendfile() not available on this platform)r"�r/rvrwrxrrrr}�s�c

Cs�|�|||�|��dkr"td��|r0|�|�|r>t|d�nd}d}|j}|j}z�|rpt|||�}|dkrpq�t||��}|s�q�z||�}	Wnt	k
r�Yq�Yq�X||	7}|	t
|�kr�||	d�}q�qTq�qT|W�S|dkr�t|d�r�|�||�XdS)Nrrfi rh)rirIrrhrp�read�sendrq�
memoryviewru�len)
r/rvrwrxrzr{Z	file_readZ	sock_send�datar|rrr�_sendfile_use_send�s8

zsocket._sendfile_use_sendcCsddt|dd�krtd��|jt@s*td��|dk	r`t|t�sJtd�|���|dkr`td�|���dS)NrTr_z$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})r)r<rr1r,�
isinstance�intrD�formatr~rrrri�s

��zsocket._check_sendfile_paramscCs8z|�|||�WStk
r2|�|||�YSXdS)a_sendfile(file[, offset[, count]]) -> sent

        Send a file until EOF is reached by using high-performance
        os.sendfile() and return the total number of bytes which
        were sent.
        *file* must be a regular file object opened in binary mode.
        If os.sendfile() is not available (e.g. Windows) or file is
        not a regular file socket.send() will be used instead.
        *offset* tells from where to start reading the file.
        If specified, *count* is the total number of bytes to transmit
        as opposed to sending the file until EOF is reached.
        File position is updated on return or also in case of error in
        which case file.tell() can be used to figure out the number of
        bytes which were sent.
        The socket must be of SOCK_STREAM type.
        Non-blocking sockets are not supported.
        N)r}r"r�r~rrrre�szsocket.sendfilecCs*|jdkr|jd8_|jr&|��dS)NrrU)r(r)r7r5rrr�_decref_socketios�s
zsocket._decref_socketioscCs|�|�dSr4)r7)r/Z_ssrrr�_real_close�szsocket._real_closecCsd|_|jdkr|��dS)NTr)r)r(r�r5rrrr7�s
zsocket.closecsd|_t���S)adetach() -> file descriptor

        Close the socket object without closing the underlying file descriptor.
        The object cannot be used after this call, but the file descriptor
        can be reused for other purposes.  The file descriptor is returned.
        T)r)�super�detachr5�r=rrr��sz
socket.detachcstt�jt�S)z@Read-only access to the address family for this socket.
        )rr�r0rr5r�rrr0sz
socket.familycstt�jt�S)z-Read-only access to the socket type.
        )rr�r1rr5r�rrr1szsocket.type�ntcCst�|���Sr4)rlZget_handle_inheritabler3r5rrr�get_inheritable
szsocket.get_inheritablecCst�|��|�dSr4)rlZset_handle_inheritabler3�r/Zinheritablerrr�set_inheritableszsocket.set_inheritablecCst�|���Sr4)rlr�r3r5rrrr�scCst�|��|�dSr4)rlr�r3r�rrrr�sz&Get the inheritable flag of the socketz&Set the inheritable flag of the socket)r*r*r*N)rON)rN)rN)rN)rN) r#r$r%�__doc__�	__slots__r.r6r9rCrErGrNrdrqrlr}r�rirer�r-r&r�r7r��propertyr0r1�namer�r��
__classcell__rrr�rr&�sF

�*
A

$


r&cCst|�}t||||�S)z� fromfd(fd, family, type[, proto]) -> socket object

    Create a socket object from a duplicate of the given file
    descriptor.  The remaining arguments are the same as for socket().
    )rGr&)rJr0r1r2Znfdrrrr
sZsharecCstddd|�S)z� fromshare(info) -> socket object

        Create a socket object from the bytes object returned by
        socket.share(pid).
        r)r&)�inforrr�	fromshare#sr��
socketpaircCsh|dkr*zt}Wntk
r(t}YnXt�|||�\}}t||||���}t||||���}||fS)aasocketpair([family[, type[, proto]]]) -> (socket object, socket object)

        Create a pair of socket objects from the sockets returned by the platform
        socketpair() function.
        The arguments are the same as for socket() except the default family is
        AF_UNIX if defined on the platform; otherwise, the default is AF_INET.
        N)ZAF_UNIX�	NameErrorr+r-r�r&r�)r0r1r2�arTrrrr�.s
c
	Cs|tkrt}n|tkrt}ntd��|tkr4td��|dkrDtd��t|||�}z�|�|df�|�	�|�
�dd�\}}t|||�}zP|�d�z|�||f�Wnt
tfk
r�YnX|�d�|��\}}	Wn|���YnXW5|��X||fS)Nz?Only AF_INET and AF_INET6 socket address families are supportedz)Only SOCK_STREAM socket type is supportedrzOnly protocol zero is supported�FT)r+�
_LOCALHOST�AF_INET6�
_LOCALHOST_V6rr,r&r7�bind�listenr>rL�connectru�InterruptedErrorrN)
r0r1r2�hostZlsockrM�portZcsockZssock�_rrrr�Cs8


a8socketpair([family[, type[, proto]]]) -> (socket object, socket object)
Create a pair of socket objects from the sockets returned by the platform
socketpair() function.
The arguments are the same as for socket() except the default family is AF_UNIX
if defined on the platform; otherwise, the default is AF_INET.
cspeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Z�fdd
�Z	dd�Z
edd��Zedd��Z
dd�Z�ZS)rXz�Raw I/O implementation for stream sockets.

    This class supports the makefile() method on sockets.  It provides
    the raw I/O interface on top of a socket object.
    cCsZ|dkrtd|��tj�|�||_d|kr6|d7}||_d|k|_d|k|_d|_dS)N)rOrSZrw�rb�wbZrwbzinvalid mode: %rrTrOrSF)	rrY�	RawIOBaser.�_sock�_mode�_reading�_writing�_timeout_occurred)r/rKr_rrrr.�s

zSocketIO.__init__c
Cs�|��|��|jrtd��z|j�|�WStk
rHd|_�Yqtk
r�}z|jdt	krpWY�
dS�W5d}~XYqXqdS)a3Read up to len(b) bytes into the writable buffer *b* and return
        the number of bytes read.  If the socket is non-blocking and no bytes
        are available, None is returned.

        If *b* is non-empty, a 0 return value indicates that the connection
        was shutdown at the other end.
        z!cannot read from timed out objectTrN)
�_checkClosed�_checkReadabler�ror�Z	recv_intortr@r8�_blocking_errnos�r/rT�errr�readinto�s
zSocketIO.readintoc
Cs`|��|��z|j�|�WStk
rZ}z|jdtkrHWY�
dS�W5d}~XYnXdS)aWrite the given bytes or bytearray object *b* to the socket
        and return the number of bytes written.  This can be less than
        len(b) if not all data could be written.  If the socket is
        non-blocking and no bytes could be written None is returned.
        rN)r��_checkWritabler�r�r@r8r�r�rrr�write�s
zSocketIO.writecCs|jrtd��|jS)z2True if the SocketIO is open for reading.
        �I/O operation on closed socket.)rArr�r5rrr�readable�szSocketIO.readablecCs|jrtd��|jS)z2True if the SocketIO is open for writing.
        r�)rArr�r5rrr�writable�szSocketIO.writablecs|jrtd��t���S)z2True if the SocketIO is open for seeking.
        r�)rArr��seekabler5r�rrr��szSocketIO.seekablecCs|��|j��S)z=Return the file descriptor of the underlying socket.
        )r�r�r3r5rrrr3�szSocketIO.filenocCs|js|��SdSdS)Nr*)rAr3r5rrrr��sz
SocketIO.namecCs|jSr4)r�r5rrrr_�sz
SocketIO.modecCs*|jr
dStj�|�|j��d|_dS)z�Close the SocketIO object.  This doesn't close the underlying
        socket, except if all references to it have disappeared.
        N)rArYr�r7r�r�r5rrrr7�s

zSocketIO.close)r#r$r%r�r.r�r�r�r�r�r3r�r�r_r7r�rrr�rrXrs

rXr:cCsl|��}|r|dkrt�}zt|�\}}}Wntk
r@Yn(X|�d|�|D]}d|krRqhqR|}|S)aGet fully qualified domain name from name.

    An empty argument is interpreted as meaning the local host.

    First the hostname returned by gethostbyaddr() is checked, then
    possibly existing aliases. In case no FQDN is available, hostname
    from gethostname() is returned.
    z0.0.0.0r�.)�stripZgethostnameZ
gethostbyaddrr@�insert)r�Zhostname�aliasesZipaddrsrrrr�s	cCs�|\}}d}t||dt�D]�}|\}}}	}
}d}zDt|||	�}|tk	rP|�|�|r^|�|�|�|�d}|WStk
r�}
z|
}|dk	r�|��W5d}
~
XYqXq|dk	r�z|�W5d}Xntd��dS)acConnect to *address* and return the socket object.

    Convenience function.  Connect to *address* (a 2-tuple ``(host,
    port)``) and return the socket object.  Passing the optional
    *timeout* parameter will set the timeout on the socket instance
    before attempting to connect.  If no *timeout* is supplied, the
    global default timeout setting returned by :func:`getdefaulttimeout`
    is used.  If *source_address* is set it must be a tuple of (host, port)
    for the socket to bind as a source address before making the connection.
    A host of '' or port 0 tells the OS to use the default.
    Nrz!getaddrinfo returns an empty list)	�getaddrinfor,r&�_GLOBAL_DEFAULT_TIMEOUTrHr�r�r@r7)�addressrtZsource_addressr�r�ry�res�af�socktyper2�	canonname�sarKr�rrrrs.



c	Csltrttd�rttd�sdSz4ttt�� }|�ttd�W5QR�WdSQRXWnt	k
rfYdSXdS)z�Return True if the platform supports creating a SOCK_STREAM socket
    which can handle both AF_INET and AF_INET6 (IPv4 / IPv6) connections.
    �IPPROTO_IPV6�IPV6_V6ONLYFrTN)
�has_ipv6rqr-r&r�r,�
setsockoptr�r�r@)rKrrrr0s��F)r0�backlog�
reuse_port�dualstack_ipv6c
Csn|rttd�std��|r8t�s(td��|tkr8td��t|t�}�ztjdkr�ttd�r�z|�	t
td�Wntk
r�YnX|r�|�	t
t
d�tr�|tkr�|r�|�	ttd�n"ttd	�r�ttd
�r�|�	ttd�z|�|�Wn@tk
�r$}z d|j|f}t|j|�d�W5d}~XYnX|dk�r:|��n
|�|�|WStk
�rh|���YnXdS)
a�Convenience function which creates a SOCK_STREAM type socket
    bound to *address* (a 2-tuple (host, port)) and return the socket
    object.

    *family* should be either AF_INET or AF_INET6.
    *backlog* is the queue size passed to socket.listen().
    *reuse_port* dictates whether to use the SO_REUSEPORT socket option.
    *dualstack_ipv6*: if true and the platform supports it, it will
    create an AF_INET6 socket able to accept both IPv4 or IPv6
    connections. When false it will explicitly disable this option on
    platforms that enable it by default (e.g. Linux).

    >>> with create_server(('', 8000)) as server:
    ...     while True:
    ...         conn, addr = server.accept()
    ...         # handle new connection
    �SO_REUSEPORTz+SO_REUSEPORT not supported on this platformz-dualstack_ipv6 not supported on this platformz'dualstack_ipv6 requires AF_INET6 family)r��cygwin�SO_REUSEADDRrUrr�r�z+%s (while attempting to bind on address %r)N)rqr-rrr�r&r,rlr�r�Z
SOL_SOCKETr�r@r�r�r�r�r��strerror�errnor�r7)r�r0r�r�r�rKry�msgrrrr
@sN


�
�� 


cCsPg}t�||||||�D]2}|\}}	}}
}|�t|t�t|	t�||
|f�q|S)a�Resolve host and port into list of address info entries.

    Translate the host/port argument into a sequence of 5-tuples that contain
    all the necessary arguments for creating a socket connected to that service.
    host is a domain name, a string representation of an IPv4/v6 address or
    None. port is a string service name such as 'http', a numeric port number or
    None. By passing None as the value of host and port, you can pass NULL to
    the underlying C API.

    The family, type and proto arguments can be optionally specified in order to
    narrow the list of addresses returned. Passing zero as a value for each of
    these arguments selects the full range of results.
    )r-r��appendrrr)r�r�r0r1r2�flagsZaddrlistr�r�r�r�r�rrrr��s�r�)r)r:)rrrr)0r�r-rl�sysrYrr�enumrrr��ImportErrorr<rrr	�__all__�extend�_get_exports_list�	_convert_r#r�r�rr&Z_realsocket�platform�lowerrr!r��	Exceptionr"r
rqr�r,r�r+r�r�rXr�objectr�rrr
r�rrrr�<module>sH- 
�����

F
	
$
u
�
-�Esubprocess.cpython-38.opt-2.pyc000064400000072746150335716500012351 0ustar00U

e5d�1�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddlm
Zddddddd	d
ddd
dddgZzddl
Z
ddlZdZWn0ek
r�dZddlZddlZddlZYn�XddlmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%e�&ddddddddddddd d!d"d#d$d%d&g�Gd'd�de'�Z(Gd(d�de(�Z)Gd)d�de(�Z*e�r�Gd*d�d�Z+Gd+d,�d,e,�Z-n&e.ed-d.�Z/e0ed/��r�ej1Z2nej3Z2e�r�dZ4d0d1�Z5ngZ4d2d1�Z5d3Z6d4Z7d5Z8d6d7�Z9d8d9�Z:dd:�d;d�Z;d<d�Z<dd:�d=d
�Z=Gd>d�de>�Z?ddddd?�d@d�Z@dAdB�ZAdCd�ZBdDd	�ZCdEdF�ZDeD�ZEGdGd�de>�ZFdS)H�N)�	monotonic�Popen�PIPE�STDOUT�call�
check_call�getstatusoutput�	getoutput�check_output�run�CalledProcessError�DEVNULL�SubprocessError�TimeoutExpired�CompletedProcessTF)�CREATE_NEW_CONSOLE�CREATE_NEW_PROCESS_GROUP�STD_INPUT_HANDLE�STD_OUTPUT_HANDLE�STD_ERROR_HANDLE�SW_HIDE�STARTF_USESTDHANDLES�STARTF_USESHOWWINDOW�ABOVE_NORMAL_PRIORITY_CLASS�BELOW_NORMAL_PRIORITY_CLASS�HIGH_PRIORITY_CLASS�IDLE_PRIORITY_CLASS�NORMAL_PRIORITY_CLASS�REALTIME_PRIORITY_CLASS�CREATE_NO_WINDOW�DETACHED_PROCESS�CREATE_DEFAULT_ERROR_MODE�CREATE_BREAKAWAY_FROM_JOBrrrrrrrr�STARTUPINFOrrrrrrrr r!r"c@seZdZdS)rN)�__name__�
__module__�__qualname__�r'r'�"/usr/lib64/python3.8/subprocess.pyr`sc@s8eZdZd	dd�Zdd�Zedd��Zejdd��ZdS)
rNcCs||_||_||_||_dS�N)�
returncode�cmd�output�stderr)�selfr*r+r,r-r'r'r(�__init__jszCalledProcessError.__init__cCsh|jrT|jdkrTzd|jt�|j�fWStk
rPd|j|jfYSXnd|j|jfSdS)NrzCommand '%s' died with %r.z)Command '%s' died with unknown signal %d.z.Command '%s' returned non-zero exit status %d.)r*r+�signalZSignals�
ValueError�r.r'r'r(�__str__ps���zCalledProcessError.__str__cCs|jSr)�r,r2r'r'r(�stdout|szCalledProcessError.stdoutcCs
||_dSr)r4�r.�valuer'r'r(r5�s)NN�r$r%r&r/r3�propertyr5�setterr'r'r'r(rcs

c@s8eZdZd	dd�Zdd�Zedd��Zejdd��ZdS)
rNcCs||_||_||_||_dSr))r+�timeoutr,r-)r.r+r;r,r-r'r'r(r/�szTimeoutExpired.__init__cCsd|j|jfS)Nz'Command '%s' timed out after %s seconds)r+r;r2r'r'r(r3�s
�zTimeoutExpired.__str__cCs|jSr)r4r2r'r'r(r5�szTimeoutExpired.stdoutcCs
||_dSr)r4r6r'r'r(r5�s)NNr8r'r'r'r(r�s

c@s,eZdZddddddd�dd�Zdd�ZdS)r#rN��dwFlags�	hStdInput�
hStdOutput�	hStdError�wShowWindow�lpAttributeListcCs0||_||_||_||_||_|p(dgi|_dS)N�handle_listr<)r.r=r>r?r@rArBr'r'r(r/�szSTARTUPINFO.__init__cCs@|j��}d|kr"t|d�|d<t|j|j|j|j|j|d�S)NrCr<)	rB�copy�listr#r=r>r?r@rA)r.Z	attr_listr'r'r(rD�s
�zSTARTUPINFO.copy)r$r%r&r/rDr'r'r'r(r#�s�	c@s2eZdZdZejfdd�Zdd�Zdd�ZeZ	dS)	�HandleFcCs|jsd|_||�dS)NT)�closed)r.�CloseHandler'r'r(�Close�szHandle.ClosecCs |jsd|_t|�Std��dS)NTzalready closed)rG�intr1r2r'r'r(�Detach�sz
Handle.DetachcCsd|jjt|�fS)Nz%s(%d))�	__class__r$rJr2r'r'r(�__repr__�szHandle.__repr__N)
r$r%r&rG�_winapirHrIrKrM�__del__r'r'r'r(rF�s
rFZPIPE_BUFi�PollSelectorcCsdSr)r'r'r'r'r(�_cleanup�srQc	Cs\tdkrdStdd�D]>}|jtjd�}|dk	rzt�|�Wqtk
rTYqXqdS)N��
_deadstate)�_active�_internal_poll�sys�maxsize�remover1)�inst�resr'r'r(rQ�s���������cCs*g}tjj}|dkr&|�dd|�|S)Nr�-�O)rV�flags�optimize�append)�argsr7r'r'r(�"_optim_args_from_interpreter_flagss
rdcCsVddddddd�}t�}|��D].\}}ttj|�}|dkr |�d	||�q tjjrd|�d
�n$tjjrv|�d�tjjr�|�d�tj	dd�}tjj
}ttd
i�}d|k}|dkr�|�d�n|r�|�d�|r�|�d�|D]}|�d|�q�|�r
|�d�dD]B}||k�r||}	|	dk�r4|}
nd||	f}
|�d|
f��q|S)N�d�B�S�v�b�q)�debug�dont_write_bytecode�no_site�verbose�
bytes_warning�quietrr^z-Iz-Ez-s�	_xoptions�dev�zerror::BytesWarningzdefault::BytesWarning�defaultz-W)�-Xrr)Zfaulthandler�tracemallocZ
importtimeZshowalloccountZshowrefcount�utf8Tz%s=%sru)
rd�items�getattrrVr`rb�isolated�ignore_environment�no_user_site�warnoptionsrorX�extend)Zflag_opt_maprc�flag�optrhZwarnoptsroZxoptions�dev_moder7�argr'r'r(�_args_from_interpreter_flagssP�






r��r;c
OsLt||��8}z|j|d�WW5QR�S|���YnXW5QRXdS)Nr�)r�wait�kill)r;�	popenargs�kwargs�pr'r'r(rLscOs6t||�}|r2|�d�}|dkr(|d}t||��dS)Nrcr)r�getr)r�r��retcoder+r'r'r(r]s



cOsbd|krtd��d|krJ|ddkrJ|�d�s8|�d�r>d}nd}||d<t|t|dd	�|��jS)
Nr5z3stdout argument not allowed, it will be overridden.�input�universal_newlines�text��T)r5r;�check)r1r�rrr5)r;r�r��emptyr'r'r(r
ps#�c@s&eZdZddd�Zdd�Zdd�ZdS)	rNcCs||_||_||_||_dSr))rcr*r5r-)r.rcr*r5r-r'r'r(r/�szCompletedProcess.__init__cCshd�|j�d�|j�g}|jdk	r4|�d�|j��|jdk	rP|�d�|j��d�t|�jd�|��S)Nz	args={!r}zreturncode={!r}zstdout={!r}zstderr={!r}z{}({})z, )	�formatrcr*r5rbr-�typer$�join)r.rcr'r'r(rM�s

�

zCompletedProcess.__repr__cCs |jrt|j|j|j|j��dSr))r*rrcr5r-r2r'r'r(�check_returncode�s�z!CompletedProcess.check_returncode)NN)r$r%r&r/rMr�r'r'r'r(r�s
	)r��capture_outputr;r�cOs |dk	r&|�d�dk	rtd��t|d<|r^|�d�dk	sF|�d�dk	rNtd��t|d<t|d<t||���}z|j||d�\}}Wn^tk
r�}	z,|��tr�|��\|	_|	_	n|�
��W5d}	~	XYn|���YnX|��}
|�r|
�rt|
|j
||d��W5QRXt|j
|
||�S)N�stdinz/stdin and input arguments may not both be used.r5r-z@stdout and stderr arguments may not be used with capture_output.r��r,r-)r�r1rr�communicaterr��
_mswindowsr5r-r��pollrrcr)r�r�r;r�r�r�Zprocessr5r-�excr�r'r'r(r�s8�cCs�g}d}ttj|�D]�}g}|r*|�d�d|kp>d|kp>|}|rN|�d�|D]b}|dkrj|�|�qR|dkr�|�dt|�d�g}|�d�qR|r�|�|�g}|�|�qR|r�|�|�|r|�|�|�d�qd�|�S)	NF� �	�"�\�z\"r�)�map�os�fsdecoderb�lenr~r�)�seq�resultZ	needquoter�Zbs_buf�cr'r'r(�list2cmdline	s4




r�c
Cslzt|ddtd�}d}Wn.tk
rF}z|j}|j}W5d}~XYnX|dd�dkrd|dd�}||fS)NT)�shellr�r-rr[�
)r
rrr,r*)r+�dataZexitcodeZexr'r'r(rRscCst|�dS�Nrs)r)r+r'r'r(r	qs
c
Cs�tsttd�sdStjdkr dSzjt�d�}|jdd�}t|�dkrHt�|d	}t	t
t|d�d
���}tjdkr�|dkr�|d
kr�WdSWnttt
fk
r�YnXdS)N�posix_spawnF�darwinT�CS_GNU_LIBC_VERSIONrs)�maxsplitr�r�.ZlinuxZglibc)r��)r��hasattrr�rV�platform�confstr�splitr�r1�tupler�rJ�AttributeError�OSError)Zver�partsZlibc�versionr'r'r(�_use_posix_spawn~s 



r�c@s�eZdZdZdJdddd�dd	�Zed
d��Zejdd��Zd
d�Zdd�Z	dd�Z
eje
jfdd�Zdd�Zdd�ZdKdd�Zdd�Zdd�ZdLdd �ZdMd!d"�Zd#d$�Ze�rd%d&�Zd'd(�Zd)d*�Zd+d,�Zdejejej fd-d.�Z!d/d0�Z"d1d2�Z#d3d4�Z$d5d6�Z%d7d8�Z&e&Z'n�d9d&�Zd:d;�Z(d<d,�Ze)j*e)j+e)j,e)j-e)j.e)j/fd=d>�Z0de)j1e)j2e3j4fd?d.�Z!d@dA�Z5dBd0�Z"dCd4�Z$dDdE�Z6dFd6�Z%dGd8�Z&dHdI�Z'dS)NrFr[NTrr')�encoding�errorsr�cCslt�t��|_d|_d|_|dkr(d}t|t�s:td��t	rP|dk	r�t
d��n8|rh|sht�dt
�d}|
dk	rxt
d��|dkr�t
d	��||_d|_d|_d|_d|_d|_||_||_|dk	r�|dk	r�t|�t|�kr�td
��|�|||�\}}}}}}t	�rN|dk�rt�|��d�}|dk�r4t�|��d�}|dk�rNt�|��d�}|�pb|�pb|�pb||_d|_d|_|j�r�|dk�r�d}d}nd}z�|dk�r�t� |d
|�|_|j�r�tj!|jd|||d�|_|dk�rt� |d|�|_|j�rtj!|j||d�|_|dk�r:t� |d|�|_|j�r:tj!|j||d�|_|�"||||||
||
||	||||||||�Wn�t#d|j|j|jf�D]*}z|�$�Wnt%k
�r�YnX�q�|j�s`g}|t&k�r�|�'|�|t&k�r�|�'|�|t&k�r�|�'|�t(|d��r|�'|j)�|D]H}z*t	�r8t|t*��r8|�+�n
t,�$|�Wnt%k
�rZYnX�q�YnXdS)NFr[zbufsize must be an integerz0preexec_fn is not supported on Windows platformszpass_fds overriding close_fds.Tz2startupinfo is only supported on Windows platformsrz4creationflags is only supported on Windows platformszlCannot disambiguate when both text and universal_newlines are supplied but different. Pass one or the other.g�?rs�wb)�
write_through�line_bufferingr�r��rb)r�r��_devnull)-rQ�	threadingZLock�
_waitpid_lock�_input�_communication_started�
isinstancerJ�	TypeErrorr�r1�warnings�warn�RuntimeWarningrcr�r5r-�pidr*r�r��boolr�_get_handles�msvcrtZopen_osfhandlerK�	text_mode�_sigint_wait_secs�_closed_child_pipe_fds�io�open�
TextIOWrapper�_execute_child�filter�closer�rrbr�r�rFrIr�)r.rc�bufsize�
executabler�r5r-�
preexec_fn�	close_fdsr��cwd�envr��startupinfo�
creationflags�restore_signals�start_new_session�pass_fdsr�r�r��p2cread�p2cwrite�c2pread�c2pwrite�errread�errwriter��fZto_close�fdr'r'r(r/�s�


��





�
�
��








zPopen.__init__cCs|jSr))r�r2r'r'r(r�~szPopen.universal_newlinescCst|�|_dSr))r�r�)r.r�r'r'r(r��scCs |�||�}|�dd��dd�S)Nz
r��
)�decode�replace)r.r�r�r�r'r'r(�_translate_newlines�szPopen._translate_newlinescCs|Sr)r'r2r'r'r(�	__enter__�szPopen.__enter__cCs�|jr|j��|jr |j��dz|jr4|j��W5|tkr�|jdkrrz|j|jd�Wntk
rpYnXd|_�dS|��XdS)Nrr�)	r5r�r-�KeyboardInterruptr��_waitrr�r�)r.�exc_typer7�	tracebackr'r'r(�__exit__�s 


zPopen.__exit__cCsT|js
dS|jdkr(|d|jt|d�|j|d�|jdkrPtdk	rPt�|�dS)Nzsubprocess %s is still running)�sourcerR)�_child_createdr*r��ResourceWarningrUrTrb)r.Z_maxsizeZ_warnr'r'r(rO�s

�z
Popen.__del__cCs"t|d�st�tjtj�|_|jS)Nr�)r�r�r��devnull�O_RDWRr�r2r'r'r(�_get_devnull�s
zPopen._get_devnullc
Cs�|rZz|j�|�WnDtk
r(Yn2tk
rX}z|jtjkrFn�W5d}~XYnXz|j��WnDtk
r|Yn2tk
r�}z|jtjkr�n�W5d}~XYnXdSr))r��write�BrokenPipeErrorr��errnoZEINVALr�)r.r�r�r'r'r(�_stdin_write�s"zPopen._stdin_writecCsT|jr|rtd��|dkr�|js�|j|j|jg�d�dkr�d}d}|jrT|�|�n6|jrp|j��}|j��n|jr�|j��}|j��|�	�n�|dk	r�t
�|}nd}z�z|�|||�\}}Wnhtk
�r,|dk	r�t
|j|�|��}n|j}d|_z|j|d�Wntk
�r$YnX�YnXW5d|_X|j	|�|�d�}||fS)Nz.Cannot send input after starting communicationr�Trr�)r�r1r�r5r-�countr�readr�r��_time�_communicater��minr��_remaining_timer�r)r.r�r;r5r-�endtime�sigint_timeout�stsr'r'r(r��sH
�



�zPopen.communicatecCs|��Sr))rUr2r'r'r(r�sz
Popen.pollcCs|dkrdS|t�SdSr))r)r.r	r'r'r(r"szPopen._remaining_timecCsL|dkrdS|st�|krHt|j||r0d�|�nd|r@d�|�ndd��dS)Nr�r�)rrrcr�)r.r	�orig_timeoutZ
stdout_seqZ
stderr_seq�skip_check_and_raiser'r'r(�_check_timeout*s�zPopen._check_timeoutcCs�|dk	rt�|}z|j|d�WStk
r�|dk	rLt|j|�|��}n|j}d|_z|j|d�Wntk
r|YnX�YnXdS)Nr�r)rr�r�rr�rr)r.r;r	r
r'r'r(r�6s 
�z
Popen.waitc		Cs�t|dd�}t����}trX|dkr.|�|j�|dkrB|�|j�|dkr�|�|j�nr|dkr~|dkr~||kr~|�tj|�|dkr�|dkr�||kr�|�tj|�|dkr�|dkr�||kr�|�tj|�|dk	r�|�tj|�W5QRXd|_dS)Nr�r[T)	ry�
contextlib�	ExitStackr��callbackrIr�r�r�)	r.r�r�r�r�r�r�Z
devnull_fd�stackr'r'r(�_close_pipe_fdsMs$
zPopen._close_pipe_fdscCs~|dkr|dkr|dkrdSd\}}d\}}d\}}	|dkrtt�tj�}|dkr�t�dd�\}}
t|�}t�|
�nh|tkr�t�dd�\}}t|�t|�}}n<|tkr�t�	|�
��}n$t|t�r�t�	|�}nt�	|�
��}|�|�}|dk�r*t�tj�}|dk�r�t�dd�\}
}t|�}t�|
�nn|tk�rXt�dd�\}}t|�t|�}}n@|tk�rrt�	|�
��}n&t|t��r�t�	|�}nt�	|�
��}|�|�}|dk�r�t�tj�}	|	dk�rdt�dd�\}
}	t|	�}	t�|
�n~|tk�rt�dd�\}}	t|�t|	�}}	nP|tk�r$|}	n@|tk�r>t�	|�
��}	n&t|t��rVt�	|�}	nt�	|�
��}	|�|	�}	||||||	fS)N)r[r[r[r[r[r[�r[r[r)rNZGetStdHandlerZ
CreatePiperFrHrr
r�Z
get_osfhandler�r�rJ�fileno�_make_inheritablerrr)r.r�r5r-r�r�r�r�r�r��_r'r'r(r�nst












�zPopen._get_handlescCs&t�t��|t��ddtj�}t|�S)Nrrs)rNZDuplicateHandleZGetCurrentProcessZDUPLICATE_SAME_ACCESSrF)r.�handle�hr'r'r(r�s�zPopen._make_inheritablecCstdd�|D��S)NcSs,h|]$}|d@dks$t�|�tjkr|�qS)�)rNZGetFileTypeZFILE_TYPE_CHAR)�.0rr'r'r(�	<setcomp>�s��z,Popen._filter_handle_list.<locals>.<setcomp>)rE)r.rCr'r'r(�_filter_handle_list�szPopen._filter_handle_listcCszt|t�rnNt|t�r.|
r"td��t|g�}n,t|tj�rR|
rFtd��t|g�}nt|�}|dk	rlt�|�}|dkr|t�}n|�	�}d|||fk}|r�|j
tjO_
||_
||_||_|j}t|o�d|ko�|d�}|s�|�r^|�r^|dkr�i}|_t|�dg��}|d<|�r0|t|�t|�t|�g7}|�|�|dd�<|�r^|�sZt�dt�d}|
�r�|j
tjO_
tj|_|�s�tj�d�}|�s�tj�dd	�}tj�|d
d�}tj�|��s�t d��tj�|��r�|}n|}d
�!||�}|dk	�rt�|�}t"�#d||||�z,t�%||ddt|�|	|||�	\}}}}W5|�$|||
|||�Xd|_&t'|�|_(||_)t�*|�dS)Nz$bytes args is not allowed on Windows�0path-like args is not allowed when shell is truer[rCz?startupinfo.lpAttributeList['handle_list'] overriding close_fdsFZComSpecZ
SystemRootr�ZSystem32zcmd.exez:shell not found: neither %ComSpec% nor %SystemRoot% is setz
{} /c "{}"�subprocess.PopenT)+r��str�bytesr�r�r��PathLiker�r#rDr=rNrr>r?r@rBr�rEr�rJrr�r�r�rrrA�environ�pathr��isabs�FileNotFoundErrorr�rV�auditrZ
CreateProcessr�rF�_handler�rH)r.rcr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Zunused_restore_signalsZunused_start_new_sessionZuse_std_handlesZattribute_listZhave_handle_listrCZcomspecZsystem_rootZhpZhtr��tidr'r'r(r��s�


��
�
�

��
zPopen._execute_childcCs,|jdkr&||jd�|kr&||j�|_|jS�Nr)r*r()r.rSZ_WaitForSingleObjectZ_WAIT_OBJECT_0Z_GetExitCodeProcessr'r'r(rUHs
zPopen._internal_pollcCs^|dkrtj}nt|d�}|jdkrXt�|j|�}|tjkrJt|j|��t�	|j�|_|jS)Ni�)
rNZINFINITErJr*�WaitForSingleObjectr(ZWAIT_TIMEOUTrrc�GetExitCodeProcess)r.r;Ztimeout_millisr�r'r'r(r�Ys
�
zPopen._waitcCs|�|���|��dSr))rbrr�)r.Zfh�bufferr'r'r(�
_readerthreadiszPopen._readerthreadcCs\|jrBt|d�sBg|_tj|j|j|jfd�|_d|j_|j��|j	r�t|d�s�g|_
tj|j|j	|j
fd�|_d|j_|j��|jr�|�
|�|jdk	r�|j�|�|��|j��r�t|j|��|j	dk	r�|j�|�|��|j��r�t|j|��d}d}|j�r|j}|j��|j	�r0|j
}|j	��|�r>|dnd}|�rP|dnd}||fS)N�_stdout_buff)�targetrcT�_stderr_buffr)r5r�r/r�ZThreadr.Z
stdout_threadZdaemon�startr-r1Z
stderr_threadr�rr�rZis_aliverrcr�)r.r�r	rr5r-r'r'r(rnsJ
��

��







zPopen._communicatecCsl|jdk	rdS|tjkr"|��nF|tjkr>t�|jtj�n*|tjkrZt�|jtj�nt	d�
|���dS)NzUnsupported signal: {})r*r0�SIGTERM�	terminateZCTRL_C_EVENTr�r�r�ZCTRL_BREAK_EVENTr1r��r.Zsigr'r'r(�send_signal�s




zPopen.send_signalcCsX|jdk	rdSzt�|jd�Wn2tk
rRt�|j�}|tjkrH�||_YnXdSr�)r*rNZTerminateProcessr(�PermissionErrorr,ZSTILL_ACTIVE)r.Zrcr'r'r(r4�s

zPopen.terminatec
Cs,d\}}d\}}d\}}	|dkr"n@|tkr8t��\}}n*|tkrJ|��}nt|t�rZ|}n|��}|dkrln@|tkr�t��\}}n*|tkr�|��}nt|t�r�|}n|��}|dkr�nf|tkr�t��\}}	nP|tkr�|dkr�|}	n
t	j
��}	n.|tk�r|��}	nt|t��r|}	n|��}	||||||	fS)Nrr[)rr��piper
r�r�rJrrrV�
__stdout__)
r.r�r5r-r�r�r�r�r�r�r'r'r(r��sP





�cCs�|dkrtj}i}|rJg}dD]"}
tt|
d�}|dk	r|�|�q||d<g}|||	fD]}|dkrX|�tj|f�qX|df|df|
dffD]"\}}|dkr�|�tj||f�q�|r�||d<tj|||f|�|_d|_	|�
|||||	|
�dS)	N)�SIGPIPEZSIGXFZ�SIGXFSZZ	setsigdefr[rrsr��file_actionsT)r�r#ryr0rb�POSIX_SPAWN_CLOSE�POSIX_SPAWN_DUP2r�r�r�r)r.rcr�r�r�r�r�r�r�r�r�r�ZsigsetZsignameZsignumr<r�Zfd2r'r'r(�_posix_spawn�s<��zPopen._posix_spawnc)s�t|ttf�r|g}n(t|tj�r6|
r.td��|g}nt|�}|
rlttd�rPdnd}|dg|}�rl�|d<�dkr||d�t�	d�|||�t
�rtj����r|dk�r|�s|�s|dk�r|dks�|d	k�r|dks�|d	k�r|dks�|d	k�r|�s|�
|�|||||
|||�
dS�}t��\}}g}|d
k�rT|�|�t�|�}�q2|D]}t�|��qX�zJz�|dk	�r�g}|��D]>\}}t�|�}d|k�r�td��|�|dt�|���q�nd}t����tj����r�f}nt�fd
d�t�|�D��}t|�}|�|�t�|||tttt|���|||||
||||||||�|_d|_W5t�|�X|� |||
|||�t!�}t�"|d�}||7}|�r�t#|�dk�r��q��q�W5t�|�X|�r�z6t�$|jd�\} }!| |jk�r�|�%|!�ntj&|_'Wnt(k
�rYnXz|�)dd	�\}"}#}$|$�*�}$Wn,tk
�rbd}"d}#d�+t|��}$YnXt,t-|"�*d�t.�}%t/|%t0��r�|#�r�t|#d�}&|$dk}'|'�r�d}$|}(n|}(|&dk�r�t�1|&�}$|%|&|$|(��|%|$��dS)NrZgetandroidapilevelz/system/bin/shz/bin/shz-crrr[r�r�=z!illegal environment variable namec3s"|]}tj�t�|���VqdSr))r�r$r��fsencode)r�dir�r�r'r(�	<genexpr>rs�z'Popen._execute_child.<locals>.<genexpr>TiP��:sSubprocessError�0z#Bad exception data from child: {!r}�ascii�Znoexecr�)2r�r r!r�r"r�rEr�rVr'�_USE_POSIX_SPAWNr$�dirnamer?r8rb�dupr�rxrAr1r��
get_exec_path�set�add�_posixsubprocessZ	fork_exec�sortedr�rJr�r�r�	bytearrayrr��waitpid�_handle_exitstatusrWr*�ChildProcessErrorr�r�r�ry�builtinsr�
issubclassr��strerror))r.rcr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Z
unix_shellZorig_executableZerrpipe_readZ
errpipe_writeZlow_fds_to_closeZlow_fdZenv_list�krhZexecutable_listZfds_to_keepZerrpipe_data�partr�rZexception_nameZ	hex_errno�err_msgZchild_exception_typeZ	errno_numZchild_exec_never_calledZerr_filenamer'rCr(r� s"	��
�����������	�
�





�
�
�
��
�


cCsL||�r||�|_n2||�r*||�|_n||�r@||�|_ntd��dS)NzUnknown child exit status!)r*r)r.rZ_WIFSIGNALEDZ	_WTERMSIGZ
_WIFEXITEDZ_WEXITSTATUSZ_WIFSTOPPEDZ	_WSTOPSIGr'r'r(rS�szPopen._handle_exitstatusc
Cs�|jdkr�|j�d�sdSz�z>|jdk	r4|jWW�pS||j|�\}}||jkrX|�|�WnBtk
r�}z$|dk	r|||_n|j|kr�d|_W5d}~XYnXW5|j��X|jS)NFr)r*r��acquire�releaser�rSr�r)r.rSZ_waitpidZ_WNOHANGZ_ECHILDr�r�er'r'r(rU�s 	



cCs>zt�|j|�\}}Wntk
r4|j}d}YnX||fSr*)r�rRr�rT)r.Z
wait_flagsr�rr'r'r(�	_try_wait�s
zPopen._try_waitc	Cs|jdk	r|jS|dk	r�t�|}d}|j�d�r~z>|jdk	rDW�0q�|�tj�\}}||jkrn|�	|�W�q�W5|j��X|�
|�}|dkr�t|j|��t
|d|d�}t�|�q&n\|jdk�r|j�B|jdk	r�W5QR��q|�d�\}}||jk�r
|�	|�W5QRXq�|jS)Ng����Mb@?Frr�g�������?)r*rr�r[r\r^r��WNOHANGr�rSrrrcr�time�sleep)r.r;r	Zdelayr�rZ	remainingr'r'r(r��s6







c
Cs"|jrX|jsXz|j��Wntk
r.YnX|sXz|j��Wntk
rVYnXd}d}|js�i|_|jr~g|j|j<|jr�g|j|j<|jr�|j|j}|jr�|j|j}|�|�|j	r�t
|j	�}t����}|jr�|r�|�|jt
j�|j�r|jj�s|�|jt
j�|j�r6|jj�s6|�|jt
j�|���r�|�|�}|dk	�rz|dk�rz|j||||dd�td��|�|�}	|�||||�|	D]�\}
}|
j|jk�r6||j|jt�}z|jt�|
j|�7_Wn,tk
�r
|�|
j�|
j��Yn*X|jt|j	�k�r�|�|
j�|
j��nP|
j|j|jfk�r�t�|
jd�}
|
�st|�|
j�|
j��|j|
j�|
��q��q6W5QRX|j |�|�d�|dk	�r�d�!|�}|dk	�r�d�!|�}|j"�r|dk	�r�|�#||jj$|jj%�}|dk	�r|�#||jj$|jj%�}||fS)NrT)r
zN_check_timeout(..., skip_check_and_raise=True) failed to raise TimeoutExpired.i�r�r�)&r�r��flushrr�Z_fileobj2outputr5r-�_save_inputr��
memoryview�_PopenSelector�register�	selectorsZEVENT_WRITErGZ
EVENT_READZget_maprr�RuntimeError�selectZfileobj�
_input_offset�	_PIPE_BUFr�r�r�Z
unregisterr�rrbr�r�r�r�r�r�)r.r�r	rr5r-Z
input_viewZselectorr;Zready�keyZevents�chunkr�r'r'r(r's�





��
�
$




�
�cCsF|jrB|jdkrBd|_||_|dk	rB|jrB|j�|jj|jj�|_dSr*)r�r�rjr��encoder�r�)r.r�r'r'r(rc�s�zPopen._save_inputcCs|jdkrt�|j|�dSr))r*r�r�r�r5r'r'r(r6�s
cCs|�tj�dSr))r6r0r3r2r'r'r(r4�scCs|�tj�dSr))r6r0�SIGKILLr2r'r'r(r��sz
Popen.kill)r[NNNNNTFNNNNrTFr')NN)F)N)7r$r%r&r�r/r9r�r:r�r�r�rVrWr�r�rOr�rr�r�rrr�rr�r�rrr�rNr+Z
WAIT_OBJECT_0r,rUr�r.rr6r4r�r?r��WIFSIGNALED�WTERMSIG�	WIFEXITED�WEXITSTATUS�
WIFSTOPPED�WSTOPSIGrSrRr_rZECHILDr^rcr'r'r'r(r�s�.��


D	�

H	
|�
26'�
�
#
)f)GrUrr�r�r`r0rVr�r�rrr�__all__r�rNr��ModuleNotFoundErrorrOrirgrrrrrrrrrrrrrrrr r!r"r~�	Exceptionrrrr#rJrFryrkr�rPreZSelectSelectorrTrQrrr
rdr�rrr
�objectrrr�rr	r�rIrr'r'r'r(�<module>,s��P
�
%	


;3"�EI
/functools.cpython-38.opt-1.pyc000064400000066377150335716500012177 0ustar00U

e5d��
@s�dZddddddddd	d
ddd
g
ZddlmZddlmZddlmZddlm	Z	dZ
dZe
efdd�Ze
efdd�Z
efdd�Zefdd�Zefdd�Zefdd�Zefdd �Zefd!d"�Zefd#d$�Zefd%d&�Zefd'd(�Zefd)d*�Zefd+d,�Zefd-d.�Zd/efd0efd1efgd1efd2efd/efgd2efd1efd0efgd0efd/efd2efgd3�Zd4d�Zd5d�Zzdd6lmZWnek
�r�YnXe �Z!e!fd7d�Z"zdd8lm"Z"Wnek
�r�YnXGd9d	�d	�Z#zdd:lm#Z#Wnek
�rYnXGd;d
�d
e �Z$d<d=�Z%ed>d?d@dAdBg�Z&GdCdD�dDe'�Z(e �fe)e*he+e,e-fdEdF�Z.dYdId�Z/dJdK�Z0zddLlm0Z0Wnek
�r�YnXdMdN�Z1dZdPdQ�Z2dRdS�Z3dTdU�Z4dVd�Z5GdWd�d�Z6e �Z7GdXd
�d
�Z8dOS)[zEfunctools.py - Tools for working with functions and callable objects
�update_wrapper�wraps�WRAPPER_ASSIGNMENTS�WRAPPER_UPDATES�total_ordering�
cmp_to_key�	lru_cache�reduce�partial�
partialmethod�singledispatch�singledispatchmethod�cached_property�)�get_cache_token)�
namedtuple)�recursive_repr)�RLock)�
__module__�__name__�__qualname__�__doc__�__annotations__)�__dict__c	Csf|D]4}zt||�}Wntk
r*YqXt|||�q|D]}t||��t||i��q>||_|S)aUpdate a wrapper function to look like the wrapped function

       wrapper is the function to be updated
       wrapped is the original function
       assigned is a tuple naming the attributes assigned directly
       from the wrapped function to the wrapper function (defaults to
       functools.WRAPPER_ASSIGNMENTS)
       updated is a tuple naming the attributes of the wrapper that
       are updated with the corresponding attribute from the wrapped
       function (defaults to functools.WRAPPER_UPDATES)
    )�getattr�AttributeError�setattr�update�__wrapped__)�wrapper�wrapped�assigned�updated�attr�value�r$�!/usr/lib64/python3.8/functools.pyr"scCstt|||d�S)a�Decorator factory to apply update_wrapper() to a wrapper function

       Returns a decorator that invokes update_wrapper() with the decorated
       function as the wrapper argument and the arguments to wraps() as the
       remaining arguments. Default arguments are as for update_wrapper().
       This is a convenience function to simplify applying partial() to
       update_wrapper().
    �rr r!)r	rr&r$r$r%r@s�cCs$|�|�}||kr|S|o"||kS)zIReturn a > b.  Computed by @total_ordering from (not a < b) and (a != b).��__lt__��self�other�NotImplemented�	op_resultr$r$r%�_gt_from_ltXs
r.cCs|�|�}|p||kS)zEReturn a <= b.  Computed by @total_ordering from (a < b) or (a == b).r'r)r$r$r%�_le_from_lt_s
r/cCs|�|�}||kr|S|S)z=Return a >= b.  Computed by @total_ordering from (not a < b).r'r)r$r$r%�_ge_from_ltds
r0cCs$|�|�}||kr|S|p"||kS)zJReturn a >= b.  Computed by @total_ordering from (not a <= b) or (a == b).��__le__r)r$r$r%�_ge_from_leks
r3cCs"|�|�}||kr|S|o ||kS)zFReturn a < b.  Computed by @total_ordering from (a <= b) and (a != b).r1r)r$r$r%�_lt_from_lers
r4cCs|�|�}||kr|S|S)z=Return a > b.  Computed by @total_ordering from (not a <= b).r1r)r$r$r%�_gt_from_leys
r5cCs$|�|�}||kr|S|o"||kS)zIReturn a < b.  Computed by @total_ordering from (not a > b) and (a != b).��__gt__r)r$r$r%�_lt_from_gt�s
r8cCs|�|�}|p||kS)zEReturn a >= b.  Computed by @total_ordering from (a > b) or (a == b).r6r)r$r$r%�_ge_from_gt�s
r9cCs|�|�}||kr|S|S)z=Return a <= b.  Computed by @total_ordering from (not a > b).r6r)r$r$r%�_le_from_gt�s
r:cCs$|�|�}||kr|S|p"||kS)zJReturn a <= b.  Computed by @total_ordering from (not a >= b) or (a == b).��__ge__r)r$r$r%�_le_from_ge�s
r=cCs"|�|�}||kr|S|o ||kS)zFReturn a > b.  Computed by @total_ordering from (a >= b) and (a != b).r;r)r$r$r%�_gt_from_ge�s
r>cCs|�|�}||kr|S|S)z=Return a < b.  Computed by @total_ordering from (not a >= b).r;r)r$r$r%�_lt_from_ge�s
r?r7r2r<r()r(r2r7r<csV�fdd�tD�}|std��t|�}t|D]"\}}||kr.||_t�||�q.�S)z6Class decorator that fills in missing ordering methodscs(h|] }t�|d�tt|d�k	r|�qS�N)r�object)�.0�op��clsr$r%�	<setcomp>�sz!total_ordering.<locals>.<setcomp>z6must define at least one ordering operation: < > <= >=)�_convert�
ValueError�maxrr)rE�roots�root�opname�opfuncr$rDr%r�scsG�fdd�dt�}|S)z,Convert a cmp= function into a key= functioncsZeZdZdgZdd�Z�fdd�Z�fdd�Z�fdd	�Z�fd
d�Z�fdd
�Z	dZ
dS)zcmp_to_key.<locals>.K�objcSs
||_dSr@�rN)r*rNr$r$r%�__init__�szcmp_to_key.<locals>.K.__init__cs�|j|j�dkS�NrrO�r*r+��mycmpr$r%r(�szcmp_to_key.<locals>.K.__lt__cs�|j|j�dkSrQrOrRrSr$r%r7�szcmp_to_key.<locals>.K.__gt__cs�|j|j�dkSrQrOrRrSr$r%�__eq__�szcmp_to_key.<locals>.K.__eq__cs�|j|j�dkSrQrOrRrSr$r%r2�szcmp_to_key.<locals>.K.__le__cs�|j|j�dkSrQrOrRrSr$r%r<�szcmp_to_key.<locals>.K.__ge__N)rrr�	__slots__rPr(r7rUr2r<�__hash__r$rSr$r%�K�srX)rA)rTrXr$rSr%r�s)rcCsZt|�}|tkr>zt|�}WqBtk
r:td�d�YqBXn|}|D]}|||�}qF|S)a�
    reduce(function, sequence[, initial]) -> value

    Apply a function of two arguments cumulatively to the items of a sequence,
    from left to right, so as to reduce the sequence to a single value.
    For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates
    ((((1+2)+3)+4)+5).  If initial is present, it is placed before the items
    of the sequence in the calculation, and serves as a default when the
    sequence is empty.
    z0reduce() of empty sequence with no initial valueN)�iter�_initial_missing�next�
StopIteration�	TypeError)ZfunctionZsequence�initial�itr#Zelementr$r$r%r�s)rcsJeZdZdZdZ�fdd�Zdd�Ze�dd��Zd	d
�Z	dd�Z
�ZS)
r	zSNew function with partial application of the given arguments
    and keywords.
    )�func�args�keywordsr�__weakref__csZt|�std��t|d�r4|j|}|j|�}|j}tt|��|�}||_||_||_|S)Nz#the first argument must be callabler`)	�callabler]�hasattrrarbr`�superr	�__new__)rEr`rarbr*��	__class__r$r%rgs


zpartial.__new__cOs|j|�}|j|j|�|�Sr@�rbr`ra)r*rarbr$r$r%�__call__%s
zpartial.__call__cCs�t|�j}t|j�g}|�dd�|jD��|�dd�|j��D��t|�jdkrld|�dd�	|��d�S|�dd�	|��d�S)	Ncss|]}t|�VqdSr@)�repr)rB�xr$r$r%�	<genexpr>-sz#partial.__repr__.<locals>.<genexpr>css |]\}}|�d|��VqdS)�=Nr$�rB�k�vr$r$r%rn.s�	functoolsz
functools.�(�, �))
�typerrlr`�extendrarb�itemsr�join)r*�qualnamerar$r$r%�__repr__)s
zpartial.__repr__cCs*t|�|jf|j|j|jpd|jp$dffSr@)rwr`rarbr�r*r$r$r%�
__reduce__3s�zpartial.__reduce__cCs�t|t�std��t|�dkr0tdt|�����|\}}}}t|�rrt|t�rr|dk	r`t|t�rr|dk	rzt|t�sztd��t|�}|dkr�i}nt|�tk	r�t|�}|dkr�i}||_||_||_	||_
dS)Nz(argument to __setstate__ must be a tuple�zexpected 4 items in state, got zinvalid partial state)�
isinstance�tupler]�lenrd�dictrwrr`rarb)r*�stater`ra�kwds�	namespacer$r$r%�__setstate__7s4
����zpartial.__setstate__)rrrrrVrgrkrr|r~r��
__classcell__r$r$rhr%r	s
	)r	c@sDeZdZdZdd�Zde_dd�Zdd�Zdd
d�Ze	dd
��Z
d	S)r
z�Method descriptor with partial application of the given arguments
    and keywords.

    Supports wrapping existing descriptors and handles non-descriptor
    callables as instance methods.
    cOs�t|�dkr|^}}}nV|s&td��nHd|krZ|�d�}|^}}ddl}|jdtdd�ntdt|�d��t|�}t|�s�t|d	�s�td
�	|���t
|t�r�|j|_|j
||_
|j|�|_n||_||_
||_dS)N�z8descriptor '__init__' of partialmethod needs an argumentr`rz0Passing 'func' as keyword argument is deprecated)�
stacklevelz8type 'partialmethod' takes at least one argument, got %d��__get__z${!r} is not callable or a descriptor)r�r]�pop�warnings�warn�DeprecationWarningr�rdre�formatr�r
r`rarb)rarbr*r`r�r$r$r%rP]s6

�
��
zpartialmethod.__init__z#($self, func, /, *args, **keywords)cCsNd�tt|j��}d�dd�|j��D��}d}|j|jj|jj	|j
||d�S)Nrucss|]\}}d�||�VqdS)z{}={!r}N)r�rpr$r$r%rn�s�z)partialmethod.__repr__.<locals>.<genexpr>z*{module}.{cls}({func}, {args}, {keywords}))�modulerEr`rarb)rz�maprlrarbryr�rirrr`)r*rarb�
format_stringr$r$r%r|�s
�
�zpartialmethod.__repr__cs�fdd�}�j|_�|_|S)Ncs �j|�}�j|f�j|�|�Sr@rj)�cls_or_selfrarbr}r$r%�_method�s
z3partialmethod._make_unbound_method.<locals>._method)�__isabstractmethod__�_partialmethod)r*r�r$r}r%�_make_unbound_method�sz"partialmethod._make_unbound_methodNcCs�t|jdd�}d}|dk	rd|||�}||jk	rdt|f|j�|j�}z|j|_Wntk
rbYnX|dkr||���||�}|S)Nr�)	rr`r	rarb�__self__rr�r�)r*rNrE�get�result�new_funcr$r$r%r��s

zpartialmethod.__get__cCst|jdd�S�Nr�F�rr`r}r$r$r%r��sz"partialmethod.__isabstractmethod__)N)rrrrrP�__text_signature__r|r�r��propertyr�r$r$r$r%r
Us"
cCst|t�r|j}q|Sr@)r�r	r`�r`r$r$r%�_unwrap_partial�s
r��	CacheInfo�hits�misses�maxsize�currsizec@s(eZdZdZdZefdd�Zdd�ZdS)�
_HashedSeqz� This class guarantees that hash() will be called no more than once
        per element.  This is important because the lru_cache() will hash
        the key multiple times on a cache miss.

    �	hashvaluecCs||dd�<||�|_dSr@�r�)r*�tup�hashr$r$r%rP�sz_HashedSeq.__init__cCs|jSr@r�r}r$r$r%rW�sz_HashedSeq.__hash__N)rrrrrVr�rPrWr$r$r$r%r��sr�c
s�|}|r&||7}|��D]}	||	7}q|rh||�fdd�|D��7}|r�||�fdd�|��D��7}n$||�dkr��|d�|kr�|dSt|�S)a�Make a cache key from optionally typed positional and keyword arguments

    The key is constructed in a way that is flat as possible rather than
    as a nested structure that would take more memory.

    If there is only a single argument and its data type is known to cache
    its hash value, then that argument is returned without a wrapper.  This
    saves space and improves lookup speed.

    c3s|]}�|�VqdSr@r$�rBrr�rwr$r%rn�sz_make_key.<locals>.<genexpr>c3s|]}�|�VqdSr@r$r�r�r$r%rn�sr�r)ry�valuesr�)
rar��typed�kwd_mark�	fasttypesr�rwr��key�itemr$r�r%�	_make_key�s
 r��Fcsnt�t�r�dkr\d�nDt��rLt�t�rL�d}�t|��t�}t||�S�dk	r\td����fdd�}|S)a�Least-recently-used cache decorator.

    If *maxsize* is set to None, the LRU features are disabled and the cache
    can grow without bound.

    If *typed* is True, arguments of different types will be cached separately.
    For example, f(3.0) and f(3) will be treated as distinct calls with
    distinct results.

    Arguments to the cached function must be hashable.

    View the cache statistics named tuple (hits, misses, maxsize, currsize)
    with f.cache_info().  Clear the cache and statistics with f.cache_clear().
    Access the underlying function with f.__wrapped__.

    See:  http://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)

    rr�Nz=Expected first argument to be an integer, a callable, or Nonecst|��t�}t||�Sr@)�_lru_cache_wrapper�
_CacheInfor)�
user_functionr�r�r�r$r%�decorating_function
sz&lru_cache.<locals>.decorating_function)r��intrd�boolr�r�rr])r�r�r�rr�r$r�r%r�s


�cs�t��t�d\����i�d�	�
d��j��j�t��
g���ddg�dd�<�dkrh�
�fdd�}nN�dkr����	��
���fdd�}n*���������	�
���
���fdd�}���	�
��
fdd	�}���	�
�
�fd
d�}||_||_|S)N)rr�r��rFcs�d7��||�}|S�Nr�r$)rar�r�)r�r�r$r%r$s
z#_lru_cache_wrapper.<locals>.wrappercsH�||��}�|��}|�k	r*�d7�|S�d7��||�}|�|<|Sr�r$)rar�r�r�)�cache�	cache_getr��make_keyr��sentinelr�r�r$r%r-s

c
s>�
||��}�	�z�|�}|dk	r~|\}}}}||�<||�<�
�}||�<�
�<||�<�
|�<�d7�|W5QR�S�d7�W5QRX�||�}�	��|�kr�n��r��
}	||	�<||	�<|	��
�
�}
�
�}d�
�<�
�<�|
=|	�|<n6�
�}|�
||g}||�<�
�<�|<���k�W5QRX|Sr�r$)rar�r��linkZ	link_prevZ	link_nextZ_keyr�ZlastZoldrootZoldkeyZ	oldresult)�KEY�NEXT�PREV�RESULTr�r��	cache_len�fullr��lockr�r�r�rKr�r�r$r%r<sB

c
s,���������W5QR�SQRXdS)zReport cache statisticsNr$r$)r�r�r�r�r�r�r$r%�
cache_infousz&_lru_cache_wrapper.<locals>.cache_infoc	s<��.�����ddg�dd�<d��d�W5QRXdS)z$Clear the cache and cache statisticsNrF)�clearr$)r�r�r�r�r�rKr$r%�cache_clearzs
z'_lru_cache_wrapper.<locals>.cache_clear)rAr�r��__len__rr�r�)r�r�r�r�rr�r�r$)r�r�r�r�r�r�r�r�r�r�r�r�r�r�rKr�r�r�r%r�s**9	r�)r�cCs�g}dd�|D�}|s|S|D]2}|d}|D]}||dd�kr.d}qq.qRq|dkrbtd��|�|�|D]}|d|krp|d=qpqdS)z�Merges MROs in *sequences* to a single MRO using the C3 algorithm.

    Adapted from http://www.python.org/download/releases/2.3/mro/.

    cSsg|]}|r|�qSr$r$�rB�sr$r$r%�
<listcomp>�sz_c3_merge.<locals>.<listcomp>rr�NzInconsistent hierarchy)�RuntimeError�append)�	sequencesr��s1�	candidate�s2�seqr$r$r%�	_c3_merge�s"
r�Nc
stt|j��D]$\}�t�d�rt|j�|}q8qd}�rDt��ng�t|jd|��}g}t|j|d��}�D]0�t|��rtt�fdd�|jD��st|���qt|D]���	��q��fdd�|D�}�fdd�|D�}�fd	d�|D�}	t
|gg|||	|g|g|g�S)
a�Computes the method resolution order using extended C3 linearization.

    If no *abcs* are given, the algorithm works exactly like the built-in C3
    linearization used for method resolution.

    If given, *abcs* is a list of abstract base classes that should be inserted
    into the resulting MRO. Unrelated ABCs are ignored and don't end up in the
    result. The algorithm inserts ABCs where their functionality is introduced,
    i.e. issubclass(cls, abc) returns True for the class itself but returns
    False for all its direct base classes. Implicit ABCs for a given class
    (either registered or inferred from the presence of a special method like
    __len__) are inserted directly after the last ABC explicitly listed in the
    MRO of said class. If two implicit ABCs end up next to each other in the
    resulting MRO, their ordering depends on the order of types in *abcs*.

    �__abstractmethods__rNc3s|]}t|��VqdSr@)�
issubclass)rB�b)�baser$r%rn�sz_c3_mro.<locals>.<genexpr>csg|]}t|�d��qS���abcs��_c3_mro�rBr�r�r$r%r��sz_c3_mro.<locals>.<listcomp>csg|]}t|�d��qSr�r�r�r�r$r%r��scsg|]}t|�d��qSr�r�r�r�r$r%r��s)�	enumerate�reversed�	__bases__rer��listr��anyr��remover�)
rEr��i�boundary�explicit_bases�abstract_bases�other_bases�explicit_c3_mros�abstract_c3_mros�
other_c3_mrosr$)r�r�r%r��sD
��������r�cs�t�j����fdd���fdd��D���fdd���fdd��D��t���g}�D]�}g}|��D]0}|�krht�|�rh|��fdd�|jD��qh|s�|�|�qX|jtd	d
�|D] }|D]}||kr�|�|�q�q�qXt�|d�S)z�Calculates the method resolution order for a given class *cls*.

    Includes relevant abstract base classes (with their respective bases) from
    the *types* iterable. Uses a modified C3 linearization algorithm.

    cs|�kot|d�ot�|�S)N�__mro__)rer�)�typ)�basesrEr$r%�
is_related�s�z _compose_mro.<locals>.is_relatedcsg|]}�|�r|�qSr$r$�rB�n)r�r$r%r��sz _compose_mro.<locals>.<listcomp>cs&�D]}||kr||jkrdSqdS)NTF)r�)r�r+)�typesr$r%�is_strict_base�sz$_compose_mro.<locals>.is_strict_basecsg|]}�|�s|�qSr$r$r�)r�r$r%r��scsg|]}|�kr|�qSr$r$r�)�type_setr$r%r��sT)r��reverser�)�setr��__subclasses__r�r��sortr�r�)rEr��mror��found�sub�subclsr$)r�rEr�r�r�r�r%�_compose_mro�s*

rcCstt||���}d}|D]R}|dk	r\||krX||jkrX||jkrXt||�sXtd�||���qj||kr|}q|�|�S)a^Returns the best matching implementation from *registry* for type *cls*.

    Where there is no registered implementation for a specific type, its method
    resolution order is used to find a more generic implementation.

    Note: if *registry* does not contain an implementation for the base
    *object* type, this function may return None.

    NzAmbiguous dispatch: {} or {})r�keysr�r�r�r�r�)rE�registryr�match�tr$r$r%�
_find_impls"
���r
cs�ddl}ddl}i�|���d����fdd��d����fdd�	���fdd�}t|d	d
��|�t<�|_�|_|���|_�j	|_
t||�|S)akSingle-dispatch generic function decorator.

    Transforms a function into a generic function, which can have different
    behaviours depending upon the type of its first argument. The decorated
    function acts as the default implementation, and additional
    implementations can be registered using the register() attribute of the
    generic function.
    rNcs|�dk	r"t�}�|kr"���|�z�|}WnHtk
rvz�|}Wntk
rht|��}YnX|�|<YnX|S)z�generic_func.dispatch(cls) -> <function implementation>

        Runs the dispatch algorithm to return the best available implementation
        for the given *cls* registered on *generic_func*.

        N)rr��KeyErrorr
)rE�
current_token�impl)�cache_token�dispatch_cacherr$r%�dispatch.sz singledispatch.<locals>.dispatchcs�|dkr�t�t�r ��fdd�St�di�}|s@td��d����}ddlm}tt||�����\}�t�t�s�td	|�d
��d���|��<�dkr�t	�d�r�t
�����|S)
z�generic_func.register(cls, func) -> func

        Registers a new implementation for the given *cls* on a *generic_func*.

        Ncs
��|�Sr@r$)�f)rE�registerr$r%�<lambda>N�z2singledispatch.<locals>.register.<locals>.<lambda>rz(Invalid first argument to `register()`: zS. Use either `@register(some_class)` or plain `@register` on an annotated function.r)�get_type_hintszInvalid annotation for z. z is not a class.r�)r�rwrr]�typingrr[rYryrerr�)rEr`�annr�argname)rrrrrDr%rEs(

�
�z singledispatch.<locals>.registercs&|st��d����|dj�||�S)Nz( requires at least 1 positional argumentr)r]ri)ra�kw)r�funcnamer$r%rfszsingledispatch.<locals>.wrapperrzsingledispatch function)N)r��weakref�WeakKeyDictionaryrrArr�MappingProxyTyperr��_clear_cacher)r`r�rrr$)rrrrrrr%rs!
c@s8eZdZdZdd�Zddd�Zddd�Zed	d
��ZdS)
rz�Single-dispatch generic method descriptor.

    Supports wrapping existing descriptors and handles non-descriptor
    callables as instance methods.
    cCs4t|�s t|d�s t|�d���t|�|_||_dS)Nr�z  is not callable or a descriptor)rdrer]r�
dispatcherr`�r*r`r$r$r%rPs
zsingledispatchmethod.__init__NcCs|jj||d�S)z�generic_method.register(cls, func) -> func

        Registers a new implementation for the given *cls* on a *generic_method*.
        r�)rr)r*rE�methodr$r$r%r�szsingledispatchmethod.registercs0���fdd�}�j|_�j|_t|�j�|S)Ncs$�j�|dj�}|����||�SrQ)rrrir�)ra�kwargsr!�rErNr*r$r%r��sz-singledispatchmethod.__get__.<locals>._method)r�rrr`)r*rNrEr�r$r#r%r��s
zsingledispatchmethod.__get__cCst|jdd�Sr�r�r}r$r$r%r��sz)singledispatchmethod.__isabstractmethod__)N)N)	rrrrrPrr�r�r�r$r$r$r%rxs


c@s&eZdZdd�Zdd�Zddd�ZdS)	r
cCs ||_d|_|j|_t�|_dSr@)r`�attrnamerrr�r r$r$r%rP�szcached_property.__init__cCs8|jdkr||_n"||jkr4td|j�d|�d���dS)Nz?Cannot assign the same cached_property to two different names (z and z).)r$r])r*�owner�namer$r$r%�__set_name__�s

�zcached_property.__set_name__Nc	Cs�|dkr|S|jdkrtd��z
|j}Wn8tk
r`dt|�j�d|j�d�}t|�d�YnX|�|jt�}|tkr�|j�n|�|jt�}|tkr�|�	|�}z|||j<Wn8tk
r�dt|�j�d|j�d�}t|�d�YnXW5QRX|S)NzGCannot use cached_property instance without calling __set_name__ on it.zNo '__dict__' attribute on z instance to cache z
 property.zThe '__dict__' attribute on z7 instance does not support item assignment for caching )
r$r]rrrwrr��
_NOT_FOUNDr�r`)r*�instancer%r��msg�valr$r$r%r��s2
�
�
�zcached_property.__get__)N)rrrrPr'r�r$r$r$r%r
�s	)r�F)N)9r�__all__�abcr�collectionsr�reprlibr�_threadrrrrrr,r.r/r0r3r4r5r8r9r:r=r>r?rGrr�
_functools�ImportErrorrArZrr	r
r�r�r�r�r��strr�rwr�r�rr�r�r�rr
rrr(r
r$r$r$r%�<module>s��
�
�
�����AX	�

,t
-)\(secrets.cpython-38.pyc000064400000004220150335716500010647 0ustar00U

e5d��@s�dZddddddddgZd	d
lZd	d
lZd	d
lZd	dlmZd	dlmZe�Z	e	j
Ze	jZd
d�Z
dZddd�Zddd�Zddd�Zd
S)z�Generate cryptographically strong pseudo-random numbers suitable for
managing secrets such as account authentication, tokens, and similar.

See PEP 506 for more information.
https://www.python.org/dev/peps/pep-0506/

�choice�	randbelow�randbits�SystemRandom�token_bytes�	token_hex�
token_urlsafe�compare_digest�N)r)rcCs|dkrtd��t�|�S)z(Return a random int in the range [0, n).r	zUpper bound must be positive.)�
ValueError�_sysrandZ
_randbelow)Zexclusive_upper_bound�r�/usr/lib64/python3.8/secrets.pyrs� cCs|dkrt}t�|�S)z�Return a random byte string containing *nbytes* bytes.

    If *nbytes* is ``None`` or not supplied, a reasonable
    default is used.

    >>> token_bytes(16)  #doctest:+SKIP
    b'\xebr\x17D*t\xae\xd4\xe3S\xb6\xe2\xebP1\x8b'

    N)�DEFAULT_ENTROPY�os�urandom��nbytesrrr
r#s
cCst�t|���d�S)a"Return a random text string, in hexadecimal.

    The string has *nbytes* random bytes, each byte converted to two
    hex digits.  If *nbytes* is ``None`` or not supplied, a reasonable
    default is used.

    >>> token_hex(16)  #doctest:+SKIP
    'f9bf78b9a18ce6d46a0cd2b0b86df9da'

    �ascii)�binasciiZhexlifyr�decoderrrr
r1scCst|�}t�|��d��d�S)z�Return a random URL-safe text string, in Base64 encoding.

    The string has *nbytes* random bytes.  If *nbytes* is ``None``
    or not supplied, a reasonable default is used.

    >>> token_urlsafe(16)  #doctest:+SKIP
    'Drmhze6EPcv0fN_81Bj-nA'

    �=r)r�base64Zurlsafe_b64encode�rstripr)r�tokrrr
r>s
)N)N)N)�__doc__�__all__rrrZhmacrZrandomrrZgetrandbitsrrrrrrrrrrr
�<module>s&�


crypt.cpython-38.opt-1.pyc000064400000006475150335716500011315 0ustar00U

e5d�@s0dZddlZzddlZWn0ek
rHejdkr<ed��ned��YnXddlZddl	m
Zddlm
ZejejdZe�ZGd	d
�d
ed
d��Zd&dd�d
d�Zd'dd�ZgZdd�dd�Zedddd�edddd�dD](Zeddeddee�dd�r��qq�edd d!d"�ed#dd$d%�[[dS)(zEWrapper to the POSIX crypt library call and associated functionality.�NZwin32z,The crypt module is not supported on Windowsz;The required _crypt module was not built as part of CPython)�SystemRandom)�
namedtuplez./c@seZdZdZdd�ZdS)�_MethodziClass representing a salt method per the Modular Crypt Format or the
    legacy 2-character crypt method.cCsd�|j�S)Nz<crypt.METHOD_{}>)�format�name)�self�r�/usr/lib64/python3.8/crypt.py�__repr__sz_Method.__repr__N)�__name__�
__module__�__qualname__�__doc__r
rrrr	rsrz name ident salt_chars total_size��roundscCsB|dkrtd}|dk	r4t|t�s4t|jj�d���|js@d}nd|j�d�}|jr�|jddkr�|dkrpd}n@t�|d�}|d|>kr�td	��d
|kr�dks�ntd��||d
�d�7}n^|jdk�r|dk	�r d|kr�dks�ntd��|d|�d�7}n|dk	�r t|�d���|d�	dd�t
|j�D��7}|S)zsGenerate a salt for the specified method.

    If not specified, the strongest available method will be used.

    Nrz+ object cannot be interpreted as an integer��$�2��zrounds must be a power of 2��z%rounds out of the range 2**4 to 2**31Z02d)�5�6i�i�ɚ;z+rounds out of the range 1000 to 999_999_999zrounds=z$ doesn't support the rounds argumentcss|]}t�t�VqdS)N)�_srZchoice�
_saltchars)�.0�charrrr	�	<genexpr>Aszmksalt.<locals>.<genexpr>)�methods�
isinstance�int�	TypeError�	__class__rZident�
bit_length�
ValueError�join�rangeZ
salt_chars)�methodr�sZ
log_roundsrrr	�mksalts2

r*cCs&|dkst|t�rt|�}t�||�S)aRReturn a string representing the one-way hash of a password, with a salt
    prepended.

    If ``salt`` is not specified or is ``None``, the strongest
    available method will be selected and a salt generated.  Otherwise,
    ``salt`` may be one of the ``crypt.METHOD_*`` values, or a string as
    returned by ``crypt.mksalt()``.

    N)r rr*�_crypt�crypt)Zword�saltrrr	r,Es
r,cGsVt|f|��}|t�d|<t||d�}td|�}|rRt|�|jkrRt�|�dSdS)NZMETHOD_rrTF)r�globalsr*r,�lenZ
total_sizer�append)rr�argsr(r-�resultrrr	�_add_methodWs

r3ZSHA512r��jZSHA256r�?)�b�y�arZBLOWFISHr��;ZMD5�1��"ZCRYPT��
)N)N)r�sys�_sysr+�ModuleNotFoundError�platform�ImportError�stringZ_stringZrandomrZ
_SystemRandom�collectionsrZ_namedtupleZ
ascii_lettersZdigitsrrrr*r,rr3Z_vr/rrrr	�<module>s2

	&

antigravity.cpython-38.pyc000064400000001437150335716500011547 0ustar00U

e5d��@s&ddlZddlZe�d�dd�ZdS)�Nzhttps://xkcd.com/353/cCs\t�|���}dd�|dd�|dd�fD�\}}td||dd�||dd�f�dS)z�Compute geohash() using the Munroe algorithm.

    >>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
    37.857713 -122.544543

    cSsg|]}dt�d|��qS)z%fz0.)�float�fromhex)�.0�x�r�#/usr/lib64/python3.8/antigravity.py�
<listcomp>szgeohash.<locals>.<listcomp>N�� z	%d%s %d%s�)�hashlibZmd5Z	hexdigest�print)ZlatitudeZ	longitudeZdatedow�h�p�qrrr�geohashs&r)Z
webbrowserr�openrrrrr�<module>s
cProfile.cpython-38.pyc000064400000012577150335716500010760 0ustar00U

e5db�@s�dZdddgZddlZddlZddlZddd�Zddd�Zejje_ejje_Gd	d�dej�Z	d
d�Z
dd
�Zedkr~e�dS)zUPython interface for the 'lsprof' profiler.
   Compatible with the 'profile' module.
�run�runctx�Profile�N���cCst�t��|||�S�N)�
_pyprofile�_Utilsrr)�	statement�filename�sort�r� /usr/lib64/python3.8/cProfile.pyrscCst�t��|||||�Sr)rrrr)r	�globals�localsr
rrrr
rs�c@s`eZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
de
_dd�Zdd�Z
dS)ra`Profile(timer=None, timeunit=None, subcalls=True, builtins=True)

    Builds a profiler object using the specified timer function.
    The default timer is a fast built-in one based on real time.
    For custom timer functions returning integers, timeunit can
    be a float specifying a scale (i.e. how long each integer unit
    is, in seconds).
    rcCs$ddl}|�|����|���dS�Nr)�pstats�StatsZ
strip_dirsZ
sort_stats�print_stats)�selfrrrrr
r)szProfile.print_statsc	Cs8ddl}t|d��}|��|�|j|�W5QRXdS)Nr�wb)�marshal�open�create_stats�dump�stats)r�filer�frrr
�
dump_stats-szProfile.dump_statscCs|��|��dSr)�disable�snapshot_stats�rrrr
r3szProfile.create_statsc
Cs,|��}i|_i}|D]P}t|j�}|j}||j}|j}|j}i}	|	|t|j�<|||||	f|j|<q|D]�}|j	rlt|j�}|j	D]�}
z|t|
j�}	Wnt
k
r�Yq�YnX|
j}||
j}|
j}|
j}||	k�r|	|}||d7}||d7}||d7}||d7}||||f|	|<q�qldS)Nr���)Zgetstatsr�label�codeZ	callcountZreccallcountZ
inlinetimeZ	totaltime�idZcalls�KeyError)r�entriesZcallersdicts�entry�funcZncZccZttZctZcallersZsubentry�prevrrr
r7s>






zProfile.snapshot_statscCsddl}|j}|�|||�Sr)�__main__�__dict__r)r�cmdr,�dictrrr
r]szProfile.runcCs(|��zt|||�W5|��X|Sr)�enabler�exec)rr.rrrrr
rbs

zProfile.runctxcOs�t|�dkr|^}}}nV|s&td��nHd|krZ|�d�}|^}}ddl}|jdtdd�ntdt|�d��|��z|||�W�S|��XdS)	Nr"z:descriptor 'runcall' of 'Profile' object needs an argumentr*rz0Passing 'func' as keyword argument is deprecated)�
stacklevelz7runcall expected at least 1 positional argument, got %dr!)�len�	TypeError�pop�warnings�warn�DeprecationWarningr0r)�args�kwrr*r6rrr
�runcallks&

�
�zProfile.runcallz($self, func, /, *args, **kw)cCs|��|Sr)r0r rrr
�	__enter__�szProfile.__enter__cGs|��dSr)r)r�exc_inforrr
�__exit__�szProfile.__exit__N)r)�__name__�
__module__�__qualname__�__doc__rrrrrrr;�__text_signature__r<r>rrrr
rs
&	cCs(t|t�rdd|fS|j|j|jfSdS)N�~r)�
isinstance�str�co_filename�co_firstlineno�co_name)r%rrr
r$�s

r$c
Cs�ddl}ddl}ddl}ddl}ddlm}d}||d�}d|_|jdddd	dd
�|jddd
ddt|j	j
�d�|jdddddd�|jdd�s�|��|�
d�|��\}}||jdd�<|jdk	r�|j�|j�|_t|�dk�r�|j�rd}	|j|dd�}
nR|d}|j�d|j�|��t�|��}t|��|d�}	W5QRX|dddd�}
zt|	|
d|j|j�Wn6tk
�r�}
zd|_|�
|
j�W5d}
~
XYnXn|��|S)Nr)�OptionParserzNcProfile.py [-o output_file_path] [-s sort] [-m module | scriptfile] [arg] ...)�usageFz-oz	--outfile�outfilezSave stats to <outfile>)�dest�help�defaultz-sz--sortrz?Sort order when printing to stdout, based on pstats.Stats classr)rMrNrO�choicesz-m�module�
store_truezProfile a library module)rM�actionrNrOr!r"z(run_module(modname, run_name='__main__'))�
run_module�modnamer1r,)�__file__r?�__package__�
__cached__) �os�sys�runpyrZoptparserJZallow_interspersed_argsZ
add_option�sortedrZsort_arg_dict_default�argvZprint_usage�exit�
parse_argsrL�path�abspathr3rQrT�insert�dirname�io�	open_code�compile�readrr�BrokenPipeError�stdout�errno)rYrZr[rrJrK�parserZoptionsr9r%ZglobsZprogname�fp�excrrr
�main�sd

�

�
�

�� rnr,)Nr)Nr)
rB�__all__Z_lsprofrdZprofilerrrZProfilerrr$rnr?rrrr
�<module>s




o;pathlib.cpython-38.opt-1.pyc000064400000126263150335716500011575 0ustar00U

e5d���@sjddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
mZmZddlmZddlmZmZmZmZmZmZmZddlmZdZejdkr�ddlZe� �dd	�d
kr�ddlm!Z!q�dZdZ!ndZd
dddddgZ"ee
eefZ#dZ$dd�Z%dd�Z&Gdd�de'�Z(Gdd�de(�Z)Gdd�de(�Z*e)�Z+e*�Z,Gdd�d�Z-Gd d!�d!e-�Z.e.�Z/d"d#�Z0e1ed$��r�e�2�e0�Z0Gd%d&�d&�Z3Gd'd(�d(�Z4Gd)d*�d*e3�Z5Gd+d,�d,e3�Z6Gd-d.�d.e3�Z7Gd/d0�d0e	�Z8Gd1d
�d
e'�Z9ej:�;e9�Gd2d�de9�Z<Gd3d�de9�Z=Gd4d�de9�Z>Gd5d�de>e<�Z?Gd6d�de>e=�Z@dS)7�N)�Sequence)�EINVAL�ENOENT�ENOTDIR�EBADF�ELOOP)�
attrgetter)�S_ISDIR�S_ISLNK�S_ISREG�S_ISSOCK�S_ISBLK�S_ISCHR�S_ISFIFO)�quote_from_bytesT�nt�)�r)�_getfinalpathnameF�PurePath�
PurePosixPath�PureWindowsPath�Path�	PosixPath�WindowsPath)��{i�cCs t|dd�tkpt|dd�tkS)N�errnoZwinerror)�getattr�_IGNORED_ERROS�_IGNORED_WINERRORS)Z	exception�r!�/usr/lib64/python3.8/pathlib.py�
_ignore_error.s�r#cCsd|kpd|kpd|kS)N�*�?�[r!)�patr!r!r"�_is_wildcard_pattern3sr(c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_FlavourzPA flavour implements a particular (platform-specific) set of path
    semantics.cCs|jj|_dS�N)�sep�join��selfr!r!r"�__init__=sz_Flavour.__init__cCsg}|j}|j}d}}t|�}|D]�}|s.q$|r>|�||�}|�|�\}}}	||	kr�t|	�|��D] }
|
rd|
dkrd|�t�|
��qdn|	r�|	dkr�|�t�|	��|s�|r$|s�|D]0}|s�q�|r�|�||�}|�|�d}|r�q�q�q�q$|s�|�r|�||�|�	�|||fS)N��.r)
r+�altsep�reversed�replace�	splitroot�split�append�sys�intern�reverse)r.�partsZparsedr+r2�drv�root�it�partZrel�xr!r!r"�parse_parts@s@
z_Flavour.parse_partscCsz|r*|sp|rp||||g|dd�fSnF|rb||ksJ|�|�|�|�krp||||dd�fSn||||fS|||fS)z�
        Join the two paths represented by the respective
        (drive, root, parts) tuples.  Return a new (drive, root, parts) tuple.
        �N)�casefold)r.r<r=r;Zdrv2Zroot2Zparts2r!r!r"�join_parsed_partsfsz_Flavour.join_parsed_partsN)�__name__�
__module__�__qualname__�__doc__r/rArDr!r!r!r"r)9s&r)c@s�eZdZdZdZdZeZej	dkZ
ed�ZdZ
ddd	d
hdd�ed
d�D�Bdd�ed
d�D�BZefdd�Zdd�Zdd�Zdd�Zd&dd�Ze
fdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%S)'�_WindowsFlavour�\�/TrZ4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZz\\?\ZCONZPRNZAUXZNULcCsh|]}d|�qS)zCOM%dr!��.0�ir!r!r"�	<setcomp>�sz_WindowsFlavour.<setcomp>rB�
cCsh|]}d|�qS)zLPT%dr!rLr!r!r"rO�scCs\|dd�}|dd�}||krP||krP|�|�\}}|dd�}|dd�}nd}|dd�}||kr�||kr�||kr�|�|d�}|dkr�|�||d�}||dkr�|dkr�t|�}|r�||d|�|||dd�fS|d|�|||dd�fSd}	}
|dk�r6||jk�r6|dd�}	|dd�}|}||k�rN|}
|�|�}||	|
|fS)NrrBrr0�����:)�_split_extended_path�find�len�
drive_letters�lstrip)r.r?r+�first�second�prefixZthird�indexZindex2r<r=r!r!r"r5�s6"

z_WindowsFlavour.splitrootcCs|��Sr*��lower�r.�sr!r!r"rC�sz_WindowsFlavour.casefoldcCsdd�|D�S)NcSsg|]}|���qSr!r])rM�pr!r!r"�
<listcomp>�sz2_WindowsFlavour.casefold_parts.<locals>.<listcomp>r!�r.r;r!r!r"�casefold_parts�sz_WindowsFlavour.casefold_partscCst�t�|�tj�jSr*)�re�compile�fnmatch�	translate�
IGNORECASE�	fullmatch�r.�patternr!r!r"�compile_pattern�sz_WindowsFlavour.compile_patternFcCs�t|�}|st��Sd}tdk	r�|r2|�t|��Sg}z|�t|��}WnBtk
r�|}tj�|�\}}|�|�||kr�|YSYq6Xtjj	|ft
|���Sq6dSr*)�str�os�getcwdr�_ext_to_normal�FileNotFoundError�pathr6r7r,r3)r.rs�strictr`Z
previous_sZ
tail_parts�tailr!r!r"�resolve�s$
z_WindowsFlavour.resolvecCsXd}|�|�rP|dd�}|dd�}|�d�rP||dd�7}d|dd�}||fS)Nr0�zUNC\rQrJ)�
startswith)r.r`Z
ext_prefixr[r!r!r"rT�s

z$_WindowsFlavour._split_extended_pathcCs|�|�dS�NrB)rTr_r!r!r"rq�sz_WindowsFlavour._ext_to_normalcCs6|sdS|d�d�rdS|d�d�d��|jkS)NFrz\\rRr1)rx�	partition�upper�reserved_namesrcr!r!r"�is_reserved�s
z_WindowsFlavour.is_reservedcCsd|j}t|�dkrJ|ddkrJ|��dd��d�}d|t|�d��fSdt|���d��SdS)NrrBrSrKz
file:///%s/%szutf-8zfile:)�driverV�as_posixrX�urlquote_from_bytes�encode)r.rsr~�restr!r!r"�make_uri�s�z_WindowsFlavour.make_uricCs�dtjkrtjd}nJdtjkrXztjd}Wntk
rFd}YnX|tjd}ntd��|r�tjd|kr�|�|f�\}}}|dtjdkr�td|��||d<|s�|r�|||�|d	d��}n
|�|�}|S)
NZUSERPROFILEZHOMEPATHZ	HOMEDRIVEr0zCan't determine home directoryZUSERNAMErR�%Can't determine home directory for %rrB)ro�environ�KeyError�RuntimeErrorrAr,)r.�username�userhomer<r=r;r!r!r"�
gethomedirs*


�
z_WindowsFlavour.gethomedirN)F)rErFrGr+r2�has_drv�ntpath�pathmodro�name�is_supported�setrWZext_namespace_prefix�ranger|r5rCrdrmrvrTrqr}r�r�r!r!r!r"rIxs.

���'

rIc@sleZdZdZdZdZeZej	dkZ
efdd�Zdd�Zd	d
�Z
dd�Zdd
d�Zdd�Zdd�Zdd�ZdS)�
_PosixFlavourrKr0FrcCsV|rH|d|krH|�|�}t|�t|�dkr<d|d|fSd||fSn
dd|fSdS)Nrrr0)rXrV)r.r?r+Z
stripped_partr!r!r"r5%s
z_PosixFlavour.splitrootcCs|Sr*r!r_r!r!r"rC4sz_PosixFlavour.casefoldcCs|Sr*r!rcr!r!r"rd7sz_PosixFlavour.casefold_partscCst�t�|��jSr*)rerfrgrhrjrkr!r!r"rm:sz_PosixFlavour.compile_patterncsJ|j�|j�i������fdd��|��r0dnt��}�|t|��pH�S)Ncs�|���rd}|���D]�}|r|dkr*q|dkrD|���\}}}q|���rX||}n|�|}|�kr��|}|dk	r~qtd|��z��|�}Wn6tk
r�}z|jtkr��r��|}W5d}~XYqXd�|<�||�}|�|<q|S)Nr0r1�..zSymlink loop from %r)	rxr6�
rpartition�endswithr��readlink�OSErrorrr)rsr�r��_�newpath�target�e��_resolveZaccessor�seenr+rtr!r"r�As4




z'_PosixFlavour.resolve.<locals>._resolver0)r+�	_accessor�is_absoluterorprn)r.rsrt�baser!r�r"rv=s)z_PosixFlavour.resolvecCsdS�NFr!rcr!r!r"r}msz_PosixFlavour.is_reservedcCst|�}dt|�S)Nzfile://)�bytesr�)r.rsZbpathr!r!r"r�psz_PosixFlavour.make_uricCs||s@ztjdWStk
r<ddl}|�t���jYSXn8ddl}z|�|�jWStk
rvtd|��YnXdS)N�HOMErr�)	ror�r��pwd�getpwuid�getuid�pw_dir�getpwnamr�)r.r�r�r!r!r"r�vs�z_PosixFlavour.gethomedirN)F)rErFrGr+r2r��	posixpathr�ror�r�r5rCrdrmrvr}r�r�r!r!r!r"r�s

0r�c@seZdZdZdS)�	_AccessorzjAn accessor implements a particular (system-specific or not) way of
    accessing paths on the filesystem.N)rErFrGrHr!r!r!r"r��sr�c@s�eZdZejZejZejZejZejZej	Z	e
ed�r>ejZndd�ZejZej
Z
e
ed�rdejZnedd��ZejZejZejZer�er�ejZq�dd�Zned	d��ZejZd
d�ZdS)
�_NormalAccessor�lchmodcCstd��dS)Nz%lchmod() not available on this system��NotImplementedError)r.Zpathobj�moder!r!r"r��sz_NormalAccessor.lchmod�linkcCstd��dS)Nz&os.link() not available on this systemr��r.r�r!r!r"�link_to�sz_NormalAccessor.link_tocCstd��dS)Nz&symlink() not available on this systemr���a�b�target_is_directoryr!r!r"�symlink�sz_NormalAccessor.symlinkcCst�||�Sr*)ror�r�r!r!r"r��scCs
t�|�Sr*)ror��r.rsr!r!r"r��sz_NormalAccessor.readlinkN)rErFrGro�stat�lstat�open�listdir�scandir�chmod�hasattrr��mkdir�unlinkr�r��staticmethod�rmdir�renamer4r�supports_symlinksr��utimer�r!r!r!r"r��s4




r�cCsR|d}|dd�}|dkr"t}n$d|kr4td��nt|�rBt}nt}||||�S)NrrB�**z:Invalid pattern: '**' can only be an entire path component)�_RecursiveWildcardSelector�
ValueErrorr(�_WildcardSelector�_PreciseSelector)�
pattern_parts�flavourr'�child_parts�clsr!r!r"�_make_selector�s
r��	lru_cachec@s eZdZdZdd�Zdd�ZdS)�	_SelectorzYA selector matches a specific glob pattern part against the children
    of a given path.cCs0||_|rt||�|_d|_nt�|_d|_dS)NTF)r�r��	successor�dironly�_TerminatingSelector)r.r�r�r!r!r"r/�sz_Selector.__init__cCs<t|�}|j}|j}|jj}||�s,tg�S|�||||�S)zuIterate over all child paths of `parent_path` matched by this
        selector.  This can contain parent_path itself.)�type�is_dir�existsr�r��iter�_select_from)r.�parent_pathZpath_clsr�r�r�r!r!r"�select_from�sz_Selector.select_fromN)rErFrGrHr/r�r!r!r!r"r��s	r�c@seZdZdd�ZdS)r�ccs
|VdSr*r!)r.r�r�r�r�r!r!r"r��sz!_TerminatingSelector._select_fromN)rErFrGr�r!r!r!r"r��sr�c@seZdZdd�Zdd�ZdS)r�cCs||_t�|||�dSr*)r�r�r/)r.r�r�r�r!r!r"r/sz_PreciseSelector.__init__ccs\z@|�|j�}|jr|n||�r>|j�||||�D]
}|Vq2Wntk
rVYdSXdSr*)�_make_child_relpathr�r�r�r��PermissionError)r.r�r�r�r�rsrar!r!r"r�sz_PreciseSelector._select_fromN�rErFrGr/r�r!r!r!r"r��sr�c@seZdZdd�Zdd�ZdS)r�cCs|�|�|_t�|||�dSr*)rm�matchr�r/�r.r'r�r�r!r!r"r/sz_WildcardSelector.__init__ccs�z�||��}t|�}W5QRX|D]�}|jrrz|��s:Wq"Wn4tk
rp}zt|�sX�WY�q"W5d}~XYnX|j}	|�|	�r"|�|	�}
|j�	|
|||�D]
}|Vq�q"Wnt
k
r�YdSXdSr*)�listr�r�r�r#r�r�r�r�r�r�)r.r�r�r�r��
scandir_it�entries�entryr�r�rsrar!r!r"r�s&


z_WildcardSelector._select_fromNr�r!r!r!r"r�sr�c@s$eZdZdd�Zdd�Zdd�ZdS)r�cCst�|||�dSr*)r�r/r�r!r!r"r//sz#_RecursiveWildcardSelector.__init__ccs�|Vz�||��}t|�}W5QRX|D]t}d}z|��}Wn,tk
rh}zt|�sX�W5d}~XYnX|r(|��s(|�|j�}	|�|	||�D]
}
|
Vq�q(Wntk
r�YdSXdSr�)	r�r�r�r#�
is_symlinkr�r��_iterate_directoriesr�)r.r�r�r�r�r�r�Zentry_is_dirr�rsrar!r!r"r�2s"
z/_RecursiveWildcardSelector._iterate_directoriesc	cs~zbt�}zL|jj}|�|||�D]0}|||||�D]}||kr2|V|�|�q2q W5|��XWntk
rxYdSXdSr*)r��clearr�r�r��addr�)	r.r�r�r�r�ZyieldedZsuccessor_selectZstarting_pointrar!r!r"r�Esz'_RecursiveWildcardSelector._select_fromN)rErFrGr/r�r�r!r!r!r"r�-sr�c@s4eZdZdZdZdd�Zdd�Zdd�Zd	d
�ZdS)�_PathParentszvThis object provides sequence-like access to the logical ancestors
    of a path.  Don't try to construct it yourself.)�_pathcls�_drv�_root�_partscCs&t|�|_|j|_|j|_|j|_dSr*)r�r�r�r�r�r�r!r!r"r/^s
z_PathParents.__init__cCs(|js|jrt|j�dSt|j�SdSry)r�r�rVr�r-r!r!r"�__len__esz_PathParents.__len__cCs@|dks|t|�krt|��|j�|j|j|jd|d��S)NrrB)rV�
IndexErrorr��_from_parsed_partsr�r�r�)r.�idxr!r!r"�__getitem__ks
�z_PathParents.__getitem__cCsd�|jj�S)Nz<{}.parents>)�formatr�rEr-r!r!r"�__repr__qsz_PathParents.__repr__N)	rErFrGrH�	__slots__r/r�r�r�r!r!r!r"r�Ysr�c@s�eZdZdZdZdd�Zdd�Zedd��ZedVd
d��Z	edWdd
��Z
edd��Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zed d!��Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zeed.�d/d0�Zeed1�d2d0�Zed3d4��Zed5d6��Z ed7d8��Z!ed9d:��Z"ed;d<��Z#d=d>�Z$d?d@�Z%dAdB�Z&edCdD��Z'dEdF�Z(dGdH�Z)dIdJ�Z*edKdL��Z+edMdN��Z,dOdP�Z-dQdR�Z.dSdT�Z/dUS)Xra|Base class for manipulating paths without I/O.

    PurePath represents a filesystem path and offers operations which
    don't imply any actual filesystem I/O.  Depending on your system,
    instantiating a PurePath will return either a PurePosixPath or a
    PureWindowsPath object.  You can also instantiate either of these classes
    directly, regardless of your system.
    )r�r�r��_str�_hash�_pparts�_cached_cpartscGs$|tkrtjdkrtnt}|�|�S)z�Construct a PurePath from one or several strings and or existing
        PurePath objects.  The strings and path objects are combined so as
        to yield a canonicalized path, which is incorporated into the
        new PurePath object.
        r)rror�rr�_from_parts)r��argsr!r!r"�__new__�szPurePath.__new__cCs|jt|j�fSr*)�	__class__�tupler�r-r!r!r"�
__reduce__�szPurePath.__reduce__cCsdg}|D]N}t|t�r"||j7}qt�|�}t|t�rF|�t|��qtdt|���q|j	�
|�S)NzNargument should be a str object or an os.PathLike object returning str, not %r)�
isinstancerr�ro�fspathrnr7�	TypeErrorr��_flavourrA)r�r�r;r�r!r!r"�_parse_args�s


��zPurePath._parse_argsTcCs<t�|�}|�|�\}}}||_||_||_|r8|��|Sr*)�objectr�rr�r�r��_init)r�r��initr.r<r=r;r!r!r"r��s
zPurePath._from_partscCs,t�|�}||_||_||_|r(|��|Sr*)rr�r�r�r�r)r�r<r=r;r	r.r!r!r"r��s
zPurePath._from_parsed_partscCs4|s|r$|||j�|dd��S|j�|�SdSry)rr,)r�r<r=r;r!r!r"�_format_parsed_parts�szPurePath._format_parsed_partscCsdSr*r!r-r!r!r"r�szPurePath._initcCs@|�|�\}}}|j�|j|j|j|||�\}}}|�|||�Sr*)rrrDr�r�r�r�)r.r�r<r=r;r!r!r"�_make_child�s�
zPurePath._make_childcCsBz|jWStk
r<|�|j|j|j�p.d|_|jYSXdS)z[Return the string representation of the path, suitable for
        passing to system calls.r1N)r��AttributeErrorr
r�r�r�r-r!r!r"�__str__�s��zPurePath.__str__cCst|�Sr*)rnr-r!r!r"�
__fspath__�szPurePath.__fspath__cCs|j}t|��|jd�S)zNReturn the string representation of the path with forward (/)
        slashes.rK)rrnr4r+�r.�fr!r!r"r�szPurePath.as_posixcCs
t�|�S)zaReturn the bytes representation of the path.  This is only
        recommended to use under Unix.)ro�fsencoder-r!r!r"�	__bytes__�szPurePath.__bytes__cCsd�|jj|���S)Nz{}({!r}))r�r�rErr-r!r!r"r��szPurePath.__repr__cCs|��std��|j�|�S)z Return the path as a 'file' URI.z.relative path can't be expressed as a file URI)r�r�rr�r-r!r!r"�as_uri�szPurePath.as_uricCs8z|jWStk
r2|j�|j�|_|jYSXdSr*)r�rrrdr�r-r!r!r"�_cparts�s
zPurePath._cpartscCs&t|t�stS|j|jko$|j|jkSr*)rr�NotImplementedrr�r.�otherr!r!r"�__eq__�s
zPurePath.__eq__cCs8z|jWStk
r2tt|j��|_|jYSXdSr*)r�r�hashrrr-r!r!r"�__hash__�s
zPurePath.__hash__cCs&t|t�r|j|jk	rtS|j|jkSr*�rrrrrrr!r!r"�__lt__szPurePath.__lt__cCs&t|t�r|j|jk	rtS|j|jkSr*rrr!r!r"�__le__	szPurePath.__le__cCs&t|t�r|j|jk	rtS|j|jkSr*rrr!r!r"�__gt__szPurePath.__gt__cCs&t|t�r|j|jk	rtS|j|jkSr*rrr!r!r"�__ge__szPurePath.__ge__r�z.The drive prefix (letter or UNC path), if any.)�docr�zThe root of the path, if any.cCs|j|j}|S)z/The concatenation of the drive and root, or ''.)r�r�)r.�anchorr!r!r"r!szPurePath.anchorcCs.|j}t|�|js|jrdndkr&dS|dS)z!The final path component, if any.rBrr0rR)r�rVr�r�rcr!r!r"r�$sz
PurePath.namecCsD|j}|�d�}d|kr,t|�dkr<nn||d�SdSdS)z{
        The final component's last suffix, if any.

        This includes the leading period. For example: '.txt'
        r1rrBNr0�r��rfindrV�r.r�rNr!r!r"�suffix,s

 zPurePath.suffixcCs:|j}|�d�rgS|�d�}dd�|�d�dd�D�S)z�
        A list of the final component's suffixes, if any.

        These include the leading periods. For example: ['.tar', '.gz']
        r1cSsg|]}d|�qS)r1r!)rMr%r!r!r"rbEsz%PurePath.suffixes.<locals>.<listcomp>rBN)r�r�rXr6�r.r�r!r!r"�suffixes:s


zPurePath.suffixescCsD|j}|�d�}d|kr,t|�dkr<nn|d|�S|SdS)z0The final path component, minus its last suffix.r1rrBNr"r$r!r!r"�stemGs

 z
PurePath.stemcCs�|jstd|f��|j�|f�\}}}|rX|d|jj|jjfksX|sX|sXt|�dkrdtd|��|�|j|j	|j
dd�|g�S)z-Return a new path with the file name changed.�%r has an empty namerRrBzInvalid name %rN)r�r�rrAr+r2rVr�r�r�r�)r.r�r<r=r;r!r!r"�	with_nameQs��
��zPurePath.with_namecCs�|j}|j|ks |jr.|j|kr.td|f��|r<|�d�rD|dkrPtd|��|j}|shtd|f��|j}|s|||}n|dt|��|}|�|j	|j
|jdd�|g�S)z�Return a new path with the file suffix changed.  If the path
        has no suffix, add given suffix.  If the given suffix is an empty
        string, remove the suffix from the path.
        zInvalid suffix %rr1r)NrR)rr+r2r�rxr�r%rVr�r�r�r�)r.r%rr�Z
old_suffixr!r!r"�with_suffix\s
�zPurePath.with_suffixc
Gs�|std��|j}|j}|j}|r8||g|dd�}n|}|�|�\}}}|rf||g|dd�}	n|}	t|	�}
|jj}|
dkr�|s�|r�n||d|
��||	�kr�|�|||�}t	d�
t|�t|����|�d|
dkr�|nd||
d��S)z�Return the relative path to another path identified by the passed
        arguments.  If the operation is not possible (because this is not
        a subpath of the other path), raise ValueError.
        zneed at least one argumentrBNrz{!r} does not start with {!r}r0)
rr�r�r�rrVrrdr
r�r�rnr�)
r.rr;r<r=Z	abs_partsZto_drvZto_rootZto_partsZto_abs_parts�n�cfZ	formattedr!r!r"�relative_toqs.	*�
�zPurePath.relative_tocCs4z|jWStk
r.t|j�|_|jYSXdS)zZAn object providing sequence-like access to the
        components in the filesystem path.N)r�rrr�r-r!r!r"r;�s
zPurePath.partscGs
|�|�S)z�Combine this path with one or several arguments, and return a
        new path representing either a subpath (if all arguments are relative
        paths) or a totally different path (if one of the arguments is
        anchored).
        )r)r.r�r!r!r"�joinpath�szPurePath.joinpathcCs,z|�|f�WStk
r&tYSXdSr*)rrr�r.�keyr!r!r"�__truediv__�szPurePath.__truediv__cCs2z|�|g|j�WStk
r,tYSXdSr*)r�r�rrr0r!r!r"�__rtruediv__�szPurePath.__rtruediv__cCs@|j}|j}|j}t|�dkr*|s&|r*|S|�|||dd��S)zThe logical parent of the path.rBNrR)r�r�r�rVr�)r.r<r=r;r!r!r"�parent�szPurePath.parentcCst|�S)z*A sequence of this path's logical parents.)r�r-r!r!r"�parents�szPurePath.parentscCs|js
dS|jjpt|j�S)zSTrue if the path is absolute (has both a root and, if applicable,
        a drive).F)r�rr��boolr�r-r!r!r"r��szPurePath.is_absolutecCs|j�|j�S)zaReturn True if the path contains one of the special names reserved
        by the system, if any.)rr}r�r-r!r!r"r}�szPurePath.is_reservedc	Cs�|jj}||�}|j�|f�\}}}|s0td��|rF|||j�krFdS|r\|||j�kr\dS|j}|sj|r�t|�t|�kr~dS|dd�}nt|�t|�kr�dStt	|�t	|��D]\}}t
�||�s�dSq�dS)zE
        Return True if this path matches the given pattern.
        z
empty patternFrBNT)rrCrAr�r�r�rrV�zipr3rgZfnmatchcase)	r.Zpath_patternr-r<r=Z	pat_partsr;r?r'r!r!r"r��s(zPurePath.matchN)T)T)0rErFrGrHr�r�r�classmethodrr�r�r
rrr
rrrr�r�propertyrrrrrrrrr~r=r!r�r%r'r(r*r+r.r;r/r2r3r4r5r�r}r�r!r!r!r"rusv

	


��





	 

	
c@seZdZdZeZdZdS)rz�PurePath subclass for non-Windows systems.

    On a POSIX system, instantiating a PurePath should return this object.
    However, you can also instantiate it directly on any system.
    r!N)rErFrGrH�_posix_flavourrr�r!r!r!r"r�sc@seZdZdZeZdZdS)rz�PurePath subclass for Windows systems.

    On a Windows system, instantiating a PurePath should return this object.
    However, you can also instantiate it directly on any system.
    r!N)rErFrGrH�_windows_flavourrr�r!r!r!r"r�sc@s�eZdZdZdZdd�Zdddd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dedd�Zdfdd�Ze
dd��Ze
dd��Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zdgd%d&�Zd'd(�Zd)d*�Zd+d,�Zdhd/d0�Zd1d2�Zdid3d4�Zd5d6�Zdjd7d8�Zdkd:d;�Zdld<d=�Zd>d?�Z d@dA�Z!dmdBdC�Z"dDdE�Z#dFdG�Z$dHdI�Z%dJdK�Z&dndLdM�Z'dNdO�Z(dPdQ�Z)dRdS�Z*dTdU�Z+dVdW�Z,dXdY�Z-dZd[�Z.d\d]�Z/d^d_�Z0d`da�Z1dbdc�Z2dS)ora�PurePath subclass that can make system calls.

    Path represents a filesystem path but unlike PurePath, also offers
    methods to do system calls on path objects. Depending on your system,
    instantiating a Path will return either a PosixPath or a WindowsPath
    object. You can also instantiate a PosixPath or WindowsPath directly,
    but cannot instantiate a WindowsPath on a POSIX system or vice versa.
    )r��_closedcOsL|tkrtjdkrtnt}|j|dd�}|jjs@td|j	f��|�
�|S)NrF�r	z$cannot instantiate %r on your system)rror�rrr�rr�r�rEr)r�r��kwargsr.r!r!r"r�s�zPath.__new__NcCs"d|_|dk	r|j|_nt|_dSr�)r<r��_normal_accessor)r.�templater!r!r"rs
z
Path._initcCs|j|g}|�|j|j|�Sr*)r�r�r�r�)r.r?r;r!r!r"r�#szPath._make_child_relpathcCs|jr|��|Sr*)r<�
_raise_closedr-r!r!r"�	__enter__)szPath.__enter__cCs
d|_dS)NT)r<)r.�t�v�tbr!r!r"�__exit__.sz
Path.__exit__cCstd��dS)NzI/O operation on closed path)r�r-r!r!r"rA1szPath._raise_closed�cCs|j�|||�Sr*)r�r�)r.r��flagsr�r!r!r"�_opener4szPath._opener�cCs|jr|��|j�|||�S)zm
        Open the file pointed by this path and return a file descriptor,
        as os.open() does.
        )r<rAr�r�)r.rHr�r!r!r"�	_raw_open8szPath._raw_opencCs|t���S)zjReturn a new path pointing to the current working directory
        (as returned by os.getcwd()).
        )rorp�r�r!r!r"�cwdCszPath.cwdcCs||�j�d��S)zrReturn a new path pointing to the user's home directory (as
        returned by os.path.expanduser('~')).
        N)rr�rLr!r!r"�homeJsz	Path.homecCsB|��}z|��}Wntk
r2t�|�}YnXtj�||�S)zoReturn whether other_path is the same or not as this file
        (as returned by os.path.samefile()).
        )r�rrors�samestat)r.Z
other_path�stZother_str!r!r"�samefileQsz
Path.samefileccsH|jr|��|j�|�D](}|dkr(q|�|�V|jr|��qdS)zyIterate over the files in this directory.  Does not yield any
        result for the special paths '.' and '..'.
        >r1r�N)r<rAr�r�r�r&r!r!r"�iterdir\szPath.iterdirccs`|std�|���|j�|f�\}}}|s.|r6td��tt|�|j�}|�|�D]
}|VqPdS)z�Iterate over this subtree and yield all existing files (of any
        kind, including directories) matching the given relative pattern.
        zUnacceptable pattern: {!r}�%Non-relative patterns are unsupportedN)r�r�rrAr�r�rr��r.rlr<r=r�Zselectorrar!r!r"�globjsz	Path.globccsR|j�|f�\}}}|s|r$td��tdt|�|j�}|�|�D]
}|VqBdS)z�Recursively yield all existing files (of any kind, including
        directories) matching the given relative pattern, anywhere in
        this subtree.
        rS)r�N)rrAr�r�rr�rTr!r!r"�rglobwsz
Path.rglobcCsD|jr|��|��r|S|jt��g|jdd�}|j|d�|S)aReturn an absolute version of this path.  This function works
        even if the path doesn't point to anything.

        No normalization is done, i.e. all '.' and '..' will be kept along.
        Use resolve() to get the canonical path to a file.
        Fr=�r@)r<rAr�r�rorpr�r)r.�objr!r!r"�absolute�sz
Path.absoluteFcCsh|jr|��|jj||d�}|dkr:|��t|���}|jj�|�}|j	|fdd�}|j
|d�|S)z�
        Make the path absolute, resolving all symlinks on the way and also
        normalizing it (for example turning slashes into backslashes under
        Windows).
        )rtNFr=rW)r<rArrvr�rnrYr��normpathr�r)r.rtr`ZnormedrXr!r!r"rv�szPath.resolvecCs|j�|�S)zh
        Return the result of the stat() system call on this path, like
        os.stat() does.
        )r�r�r-r!r!r"r��sz	Path.statcCsddl}|�|��j�jS)z:
        Return the login name of the file owner.
        rN)r�r�r��st_uidZpw_name)r.r�r!r!r"�owner�sz
Path.ownercCsddl}|�|��j�jS)z8
        Return the group name of the file gid.
        rN)�grpZgetgrgidr��st_gidZgr_name)r.r]r!r!r"�group�sz
Path.group�rrRc	Cs(|jr|��tj|||||||jd�S)z|
        Open the file pointed by this path and return a file object, as
        the built-in open() function does.
        )Zopener)r<rA�ior�rI)r.r��	buffering�encoding�errors�newliner!r!r"r��s
�z	Path.openc
Cs,|jdd��}|��W5QR�SQRXdS)zK
        Open the file in bytes mode, read it, and close the file.
        �rb�r�N�r��readrr!r!r"�
read_bytes�szPath.read_bytesc
Cs0|jd||d��}|��W5QR�SQRXdS)zJ
        Open the file in text mode, read it, and close the file.
        r`�r�rcrdNrh)r.rcrdrr!r!r"�	read_text�szPath.read_textc
Cs6t|�}|jdd��}|�|�W5QR�SQRXdS)zO
        Open the file in bytes mode, write to it, and close the file.
        �wbrgN)�
memoryviewr��write)r.�dataZviewrr!r!r"�write_bytes�szPath.write_bytesc
CsLt|t�std|jj��|jd||d��}|�|�W5QR�SQRXdS)zN
        Open the file in text mode, write to it, and close the file.
        zdata must be str, not %s�wrkN)rrnrr�rEr�ro)r.rprcrdrr!r!r"�
write_text�s
�zPath.write_textTcCsr|jr|��|r>z|j�|d�Wntk
r8YnXdStjtjB}|sX|tjO}|�	||�}t�
|�dS)zS
        Create this file with the given access mode, if it doesn't exist.
        N)r<rAr�r�r�ro�O_CREAT�O_WRONLY�O_EXCLrK�close)r.r��exist_okrH�fdr!r!r"�touch�s
z
Path.touchcCs�|jr|��z|j�||�Wndtk
rd|r>|j|kr@�|jjddd�|j|d|d�Yn"tk
r�|r~|��s��YnXdS)z<
        Create a new directory at this given path.
        T)r5rxFN)r<rAr�r�rrr4r�r�)r.r�r5rxr!r!r"r�sz
Path.mkdircCs |jr|��|j�||�dS)zF
        Change the permissions of the path, like os.chmod().
        N)r<rAr�r��r.r�r!r!r"r�sz
Path.chmodcCs |jr|��|j�||�dS)z�
        Like chmod(), except if the path points to a symlink, the symlink's
        permissions are changed, rather than its target's.
        N)r<rAr�r�r{r!r!r"r�szPath.lchmodcCs>|jr|��z|j�|�Wntk
r8|s4�YnXdS)zd
        Remove this file or link.
        If the path is a directory, use rmdir() instead.
        N)r<rAr�r�rr)r.Z
missing_okr!r!r"r�%szPath.unlinkcCs|jr|��|j�|�dS)zF
        Remove this directory.  The directory must be empty.
        N)r<rAr�r�r-r!r!r"r�2sz
Path.rmdircCs|jr|��|j�|�S)z�
        Like stat(), except if the path points to a symlink, the symlink's
        status information is returned, rather than its target's.
        )r<rAr�r�r-r!r!r"r�:sz
Path.lstatcCs&|jr|��|j�||�|�|�S)a2
        Rename this path to the target path.

        The target path may be absolute or relative. Relative paths are
        interpreted relative to the current working directory, *not* the
        directory of the Path object.

        Returns the new Path instance pointing to the target path.
        )r<rAr�r�r�r�r!r!r"r�Cs
zPath.renamecCs&|jr|��|j�||�|�|�S)aS
        Rename this path to the target path, overwriting if that path exists.

        The target path may be absolute or relative. Relative paths are
        interpreted relative to the current working directory, *not* the
        directory of the Path object.

        Returns the new Path instance pointing to the target path.
        )r<rAr�r4r�r�r!r!r"r4Rs
zPath.replacecCs"|jr|��|j�|||�dS)z�
        Make this path a symlink pointing to the target path.
        Note the order of arguments (link, target) is the reverse of os.symlink.
        N)r<rAr�r�)r.r�r�r!r!r"�
symlink_toaszPath.symlink_tocCs |jr|��|j�||�dS)aQ
        Make the target path a hard link pointing to this path.

        Note this function does not make this path a hard link to *target*,
        despite the implication of the function and argument names. The order
        of arguments (target, link) is the reverse of Path.symlink_to, but
        matches that of os.link.

        N)r<rAr�r�r�r!r!r"r�js
zPath.link_toc
CsXz|��WnFtk
r>}zt|�s(�WY�dSd}~XYntk
rRYdSXdS)z+
        Whether this path exists.
        FNT)r�r�r#r��r.r�r!r!r"r�zszPath.existsc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z3
        Whether this path is a directory.
        FN)r	r��st_moder�r#r�r}r!r!r"r��szPath.is_dirc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)zq
        Whether this path is a regular file (also True for symlinks pointing
        to regular files).
        FN)rr�r~r�r#r�r}r!r!r"�is_file�szPath.is_filecCsv|��r|��sdSt|j�}z|��j}Wntk
rBYdSX|��j}||krZdS|��j}|��j}||kS)z;
        Check if this path is a POSIX mount point
        FT)r�r�rr4r��st_devr��st_ino)r.r4Z
parent_devZdevZinoZ
parent_inor!r!r"�is_mount�s



z
Path.is_mountc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z7
        Whether this path is a symbolic link.
        FN)r
r�r~r�r#r�r}r!r!r"r��szPath.is_symlinkc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z6
        Whether this path is a block device.
        FN)r
r�r~r�r#r�r}r!r!r"�is_block_device�szPath.is_block_devicec
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z:
        Whether this path is a character device.
        FN)rr�r~r�r#r�r}r!r!r"�is_char_device�szPath.is_char_devicec
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z.
        Whether this path is a FIFO.
        FN)rr�r~r�r#r�r}r!r!r"�is_fifo�szPath.is_fifoc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z0
        Whether this path is a socket.
        FN)rr�r~r�r#r�r}r!r!r"�	is_socket�szPath.is_socketcCs`|js\|js\|jr\|jddd�dkr\|j�|jddd��}|�|g|jdd��S|S)zl Return a new path with expanded ~ and ~user constructs
        (as returned by os.path.expanduser)
        rNrB�~)r�r�r�rr�r�)r.Zhomedirr!r!r"�
expandusers��zPath.expanduser)N)rG)rJ)F)r`rRNNN)NN)NN)rGT)rJFF)F)F)3rErFrGrHr�r�rr�rBrFrArIrKr8rMrNrQrRrUrVrYrvr�r\r_r�rjrlrqrsrzr�r�r�r�r�r�r�r4r|r�r�r�rr�r�r�r�r�r�r�r!r!r!r"rsj�







�

	



	

	
	c@seZdZdZdZdS)rzsPath subclass for non-Windows systems.

    On a POSIX system, instantiating a Path should return this object.
    r!N)rErFrGrHr�r!r!r!r"rsc@s,eZdZdZdZdd�Zdd�Zdd�Zd	S)
rzqPath subclass for Windows systems.

    On a Windows system, instantiating a Path should return this object.
    r!cCstd��dS)Nz*Path.owner() is unsupported on this systemr�r-r!r!r"r\(szWindowsPath.ownercCstd��dS)Nz*Path.group() is unsupported on this systemr�r-r!r!r"r_+szWindowsPath.groupcCstd��dS)Nz-Path.is_mount() is unsupported on this systemr�r-r!r!r"r�.szWindowsPath.is_mountN)rErFrGrHr�r\r_r�r!r!r!r"r!s
)Arg�	functoolsrar�ror�rer8�_collections_abcrrrrrrr�operatorrr�r	r
rrr
rrZurllib.parserr�r�r�rZgetwindowsversionr�__all__rr r#r(rr)rIr�r;r:r�r�r?r�r�r�r�r�r�r�r�r�r�PathLike�registerrrrrrr!r!r!r"�<module>s|$
�
?&i8
,t

codecs.cpython-38.pyc000064400000102246150335716500010446 0ustar00U

e5d;��,@s�dZddlZddlZzddlTWn.ek
rNZzede��W5dZ[XYnXddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0g,Zd1Zd2Z	Z
d3ZZd4Z
d5Zejd6kr�e
ZZe
ZneZZeZe
ZeZe
ZeZGd7d�de�ZGd8d�d�ZGd9d�de�ZGd:d;�d;e�ZGd<d�de�ZGd=d>�d>e�ZGd?d�de�ZGd@d�de�Z GdAd�d�Z!GdBd�d�Z"d\dFd�Z#d]dGd�Z$dHd�Z%dId �Z&dJd!�Z'dKd"�Z(dLd#�Z)dMd$�Z*d^dNd'�Z+d_dOd(�Z,dPdQ�Z-dRdS�Z.z4e/dD�Z0e/dT�Z1e/dU�Z2e/dV�Z3e/dW�Z4e/dX�Z5Wn.e6k
�r`dZ0dZ1dZ2dZ3dZ4dZ5YnXdZ7e7�rtddl8Z8e9dYk�r�e$ej:dZd[�e_:e$ej;d[dZ�e_;dS)`z� codecs -- Python Codec Registry, API and helpers.


Written by Marc-Andre Lemburg (mal@lemburg.com).

(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.

�N)�*z%Failed to load the builtin codecs: %s�register�lookup�open�EncodedFile�BOM�BOM_BE�BOM_LE�BOM32_BE�BOM32_LE�BOM64_BE�BOM64_LE�BOM_UTF8�	BOM_UTF16�BOM_UTF16_LE�BOM_UTF16_BE�	BOM_UTF32�BOM_UTF32_LE�BOM_UTF32_BE�	CodecInfo�Codec�IncrementalEncoder�IncrementalDecoder�StreamReader�StreamWriter�StreamReaderWriter�
StreamRecoder�
getencoder�
getdecoder�getincrementalencoder�getincrementaldecoder�	getreader�	getwriter�encode�decode�
iterencode�
iterdecode�
strict_errors�
ignore_errors�replace_errors�xmlcharrefreplace_errors�backslashreplace_errors�namereplace_errors�register_error�lookup_errorss��s��s��s���littlec@s,eZdZdZdZd	dd�dd�Zdd�ZdS)
rz0Codec details when looking up the codec registryTN)�_is_text_encodingc
CsPt�|||||f�}	||	_||	_||	_||	_||	_||	_||	_|dk	rL||	_	|	S�N)
�tuple�__new__�namer#r$�incrementalencoder�incrementaldecoder�streamwriter�streamreaderr0)
�clsr#r$r8r7r5r6r4r0�self�r;�/usr/lib64/python3.8/codecs.pyr3^szCodecInfo.__new__cCsd|jj|jj|jt|�fS)Nz%<%s.%s object for encoding %s at %#x>)�	__class__�
__module__�__qualname__r4�id�r:r;r;r<�__repr__ms��zCodecInfo.__repr__)NNNNN)�__name__r>r?�__doc__r0r3rBr;r;r;r<rSs��c@s$eZdZdZddd�Zd	dd�ZdS)
ra9 Defines the interface for stateless encoders/decoders.

        The .encode()/.decode() methods may use different error
        handling schemes by providing the errors argument. These
        string values are predefined:

         'strict' - raise a ValueError error (or a subclass)
         'ignore' - ignore the character and continue with the next
         'replace' - replace with a suitable replacement character;
                    Python will use the official U+FFFD REPLACEMENT
                    CHARACTER for the builtin Unicode codecs on
                    decoding and '?' on encoding.
         'surrogateescape' - replace with private code points U+DCnn.
         'xmlcharrefreplace' - Replace with the appropriate XML
                               character reference (only for encoding).
         'backslashreplace'  - Replace with backslashed escape sequences.
         'namereplace'       - Replace with \N{...} escape sequences
                               (only for encoding).

        The set of allowed values can be extended via register_error.

    �strictcCst�dS)a# Encodes the object input and returns a tuple (output
            object, length consumed).

            errors defines the error handling to apply. It defaults to
            'strict' handling.

            The method may not store state in the Codec instance. Use
            StreamWriter for codecs which have to keep state in order to
            make encoding efficient.

            The encoder must be able to handle zero length input and
            return an empty object of the output object type in this
            situation.

        N��NotImplementedError�r:�input�errorsr;r;r<r#�szCodec.encodecCst�dS)a� Decodes the object input and returns a tuple (output
            object, length consumed).

            input must be an object which provides the bf_getreadbuf
            buffer slot. Python strings, buffer objects and memory
            mapped files are examples of objects providing this slot.

            errors defines the error handling to apply. It defaults to
            'strict' handling.

            The method may not store state in the Codec instance. Use
            StreamReader for codecs which have to keep state in order to
            make decoding efficient.

            The decoder must be able to handle zero length input and
            return an empty object of the output object type in this
            situation.

        NrFrHr;r;r<r$�szCodec.decodeN)rE)rE)rCr>r?rDr#r$r;r;r;r<rrs
c@s<eZdZdZddd�Zddd�Zdd	�Zd
d�Zdd
�ZdS)rz�
    An IncrementalEncoder encodes an input in multiple steps. The input can
    be passed piece by piece to the encode() method. The IncrementalEncoder
    remembers the state of the encoding process between calls to encode().
    rEcCs||_d|_dS)z�
        Creates an IncrementalEncoder instance.

        The IncrementalEncoder may use different error handling schemes by
        providing the errors keyword argument. See the module docstring
        for a list of possible values.
        �N)rJ�buffer�r:rJr;r;r<�__init__�szIncrementalEncoder.__init__FcCst�dS)zA
        Encodes input and returns the resulting object.
        NrF�r:rI�finalr;r;r<r#�szIncrementalEncoder.encodecCsdS)z:
        Resets the encoder to the initial state.
        Nr;rAr;r;r<�reset�szIncrementalEncoder.resetcCsdS)z:
        Return the current state of the encoder.
        rr;rAr;r;r<�getstate�szIncrementalEncoder.getstatecCsdS)zl
        Set the current state of the encoder. state must have been
        returned by getstate().
        Nr;�r:�stater;r;r<�setstate�szIncrementalEncoder.setstateN)rE)F)	rCr>r?rDrNr#rQrRrUr;r;r;r<r�s

c@sDeZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dS)�BufferedIncrementalEncoderz�
    This subclass of IncrementalEncoder can be used as the baseclass for an
    incremental encoder if the encoder must keep some of the output in a
    buffer between calls to encode().
    rEcCst�||�d|_dS�NrK)rrNrLrMr;r;r<rN�sz#BufferedIncrementalEncoder.__init__cCst�dSr1rF�r:rIrJrPr;r;r<�_buffer_encode�sz)BufferedIncrementalEncoder._buffer_encodeFcCs0|j|}|�||j|�\}}||d�|_|Sr1)rLrYrJ�r:rIrP�data�result�consumedr;r;r<r#�s
z!BufferedIncrementalEncoder.encodecCst�|�d|_dSrW)rrQrLrAr;r;r<rQ�s
z BufferedIncrementalEncoder.resetcCs
|jpdS�Nr�rLrAr;r;r<rR�sz#BufferedIncrementalEncoder.getstatecCs|pd|_dSrWr_rSr;r;r<rU�sz#BufferedIncrementalEncoder.setstateN)rE)F)
rCr>r?rDrNrYr#rQrRrUr;r;r;r<rV�s

rVc@s<eZdZdZddd�Zddd�Zdd	�Zd
d�Zdd
�ZdS)rz�
    An IncrementalDecoder decodes an input in multiple steps. The input can
    be passed piece by piece to the decode() method. The IncrementalDecoder
    remembers the state of the decoding process between calls to decode().
    rEcCs
||_dS)z�
        Create an IncrementalDecoder instance.

        The IncrementalDecoder may use different error handling schemes by
        providing the errors keyword argument. See the module docstring
        for a list of possible values.
        N)rJrMr;r;r<rNszIncrementalDecoder.__init__FcCst�dS)z@
        Decode input and returns the resulting object.
        NrFrOr;r;r<r$szIncrementalDecoder.decodecCsdS)z9
        Reset the decoder to the initial state.
        Nr;rAr;r;r<rQszIncrementalDecoder.resetcCsdS)a	
        Return the current state of the decoder.

        This must be a (buffered_input, additional_state_info) tuple.
        buffered_input must be a bytes object containing bytes that
        were passed to decode() that have not yet been converted.
        additional_state_info must be a non-negative integer
        representing the state of the decoder WITHOUT yet having
        processed the contents of buffered_input.  In the initial state
        and after reset(), getstate() must return (b"", 0).
        )�rr;rAr;r;r<rRszIncrementalDecoder.getstatecCsdS)z�
        Set the current state of the decoder.

        state must have been returned by getstate().  The effect of
        setstate((b"", 0)) must be equivalent to reset().
        Nr;rSr;r;r<rU'szIncrementalDecoder.setstateN)rE)F)	rCr>r?rDrNr$rQrRrUr;r;r;r<r�s


c@sDeZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dS)�BufferedIncrementalDecoderz�
    This subclass of IncrementalDecoder can be used as the baseclass for an
    incremental decoder if the decoder must be able to handle incomplete
    byte sequences.
    rEcCst�||�d|_dS�Nr`)rrNrLrMr;r;r<rN5sz#BufferedIncrementalDecoder.__init__cCst�dSr1rFrXr;r;r<�_buffer_decode:sz)BufferedIncrementalDecoder._buffer_decodeFcCs0|j|}|�||j|�\}}||d�|_|Sr1)rLrcrJrZr;r;r<r$?s
z!BufferedIncrementalDecoder.decodecCst�|�d|_dSrb)rrQrLrAr;r;r<rQGs
z BufferedIncrementalDecoder.resetcCs
|jdfSr^r_rAr;r;r<rRKsz#BufferedIncrementalDecoder.getstatecCs|d|_dSr^r_rSr;r;r<rUOsz#BufferedIncrementalDecoder.setstateN)rE)F)
rCr>r?rDrNrcr$rQrRrUr;r;r;r<ra/s

rac@sTeZdZddd�Zdd�Zdd�Zdd	�Zddd�Zefd
d�Z	dd�Z
dd�ZdS)rrEcCs||_||_dS)aw Creates a StreamWriter instance.

            stream must be a file-like object open for writing.

            The StreamWriter may use different error handling
            schemes by providing the errors keyword argument. These
            parameters are predefined:

             'strict' - raise a ValueError (or a subclass)
             'ignore' - ignore the character and continue with the next
             'replace'- replace with a suitable replacement character
             'xmlcharrefreplace' - Replace with the appropriate XML
                                   character reference.
             'backslashreplace'  - Replace with backslashed escape
                                   sequences.
             'namereplace'       - Replace with \N{...} escape sequences.

            The set of allowed parameter values can be extended via
            register_error.
        N)�streamrJ�r:rdrJr;r;r<rN\szStreamWriter.__init__cCs"|�||j�\}}|j�|�dS)z> Writes the object's contents encoded to self.stream.
        N)r#rJrd�write)r:�objectr[r]r;r;r<rfuszStreamWriter.writecCs|�d�|��dS)z[ Writes the concatenated list of strings to the stream
            using .write().
        rKN)rf�join�r:�listr;r;r<�
writelines|szStreamWriter.writelinescCsdS)a5 Flushes and resets the codec buffers used for keeping state.

            Calling this method should ensure that the data on the
            output is put into a clean state, that allows appending
            of new fresh data without having to rescan the whole
            stream to recover state.

        Nr;rAr;r;r<rQ�s
zStreamWriter.resetrcCs*|j�||�|dkr&|dkr&|��dSr^�rd�seekrQ�r:�offset�whencer;r;r<rm�szStreamWriter.seekcCs||j|�S�z? Inherit all other methods from the underlying stream.
        �rd�r:r4�getattrr;r;r<�__getattr__�szStreamWriter.__getattr__cCs|Sr1r;rAr;r;r<�	__enter__�szStreamWriter.__enter__cCs|j��dSr1�rd�close�r:�type�value�tbr;r;r<�__exit__�szStreamWriter.__exit__N)rE)r)rCr>r?rNrfrkrQrmrtrurvr}r;r;r;r<rZs

�
c@s�eZdZeZddd�Zd dd�Zd!dd	�Zd"dd
�Zd#dd�Z	dd�Z
d$dd�Zdd�Zdd�Z
efdd�Zdd�Zdd�Zd
S)%rrEcCs.||_||_d|_|��|_|j|_d|_dS)a� Creates a StreamReader instance.

            stream must be a file-like object open for reading.

            The StreamReader may use different error handling
            schemes by providing the errors keyword argument. These
            parameters are predefined:

             'strict' - raise a ValueError (or a subclass)
             'ignore' - ignore the character and continue with the next
             'replace'- replace with a suitable replacement character
             'backslashreplace' - Replace with backslashed escape sequences;

            The set of allowed parameter values can be extended via
            register_error.
        r`N)rdrJ�
bytebuffer�charbuffertype�_empty_charbuffer�
charbuffer�
linebufferrer;r;r<rN�s
zStreamReader.__init__cCst�dSr1rFrHr;r;r<r$�szStreamReader.decode���Fc
CsN|jr|j�|j�|_d|_|dkr(|}|dkrBt|j�|krB�q|dkrV|j��}n|j�|�}|j|}|st�qz|�||j	�\}}Wn`t
k
r�}zB|r�|�|d|j�|j	�\}}|jdd�}	t|	�dkrڂn�W5d}~XYnX||d�|_|j|7_|s(�qq(|dk�r,|j}
|j|_n|jd|�}
|j|d�|_|
S)a� Decodes data from the stream self.stream and returns the
            resulting object.

            chars indicates the number of decoded code points or bytes to
            return. read() will never return more data than requested,
            but it might return less, if there is not enough available.

            size indicates the approximate maximum number of decoded
            bytes or code points to read for decoding. The decoder
            can modify this setting as appropriate. The default value
            -1 indicates to read and decode as much as possible.  size
            is intended to prevent having to decode huge files in one
            step.

            If firstline is true, and a UnicodeDecodeError happens
            after the first line terminator in the input only the first line
            will be returned, the rest of the input will be kept until the
            next call to read().

            The method should use a greedy read strategy, meaning that
            it should read as much data as is allowed within the
            definition of the encoding and the given size, e.g.  if
            optional encoding endings or state markers are available
            on the stream, these should be read too.
        NrT��keepends�)
r�r�rhr��lenrd�readr~r$rJ�UnicodeDecodeError�start�
splitlines)r:�size�chars�	firstline�newdatar[�newchars�decodedbytes�exc�linesr\r;r;r<r��sD
�

zStreamReader.readNTc	Cs�|jrP|jd}|jd=t|j�dkr8|jd|_d|_|sL|jdd�d}|S|pVd}|j}|j|dd�}|r�t|t�r�|�d	�s�t|t	�r�|�d
�r�||jddd�7}||7}|jdd�}|�r�t|�dk�r8|d}|d=t|�dk�r|d|j7<||_d|_n|d|j|_|�s�|jdd�d}�q�|d}|djdd�d}||k�r�|j�
|dd��|j|_|�r�|}n|}�q�|�r�|dk	�r�|�r�|�s�|jdd�d}�q�|d
kr^|d9}q^|S)z� Read one line from the input stream and return the
            decoded data.

            size, if given, is passed as size argument to the
            read() method.

        rr�NFr��HT)r��
�
)r�r�r�i@�)r�r�r�r�r�r��
isinstance�str�endswith�bytesrh)	r:r�r��line�readsizer[r��line0withend�line0withoutendr;r;r<�readlinesd
��
�
zStreamReader.readlinecCs|��}|�|�S)aS Read all lines available on the input stream
            and return them as a list.

            Line breaks are implemented using the codec's decoder
            method and are included in the list entries.

            sizehint, if given, is ignored since there is no efficient
            way to finding the true end-of-line.

        )r�r�)r:�sizehintr�r[r;r;r<�	readlines^szStreamReader.readlinescCsd|_|j|_d|_dS)z� Resets the codec buffers used for keeping state.

            Note that no stream repositioning should take place.
            This method is primarily intended to be able to recover
            from decoding errors.

        r`N)r~r�r�r�rAr;r;r<rQms	zStreamReader.resetrcCs|j�||�|��dS)zp Set the input stream's current position.

            Resets the codec buffers used for keeping state.
        Nrlrnr;r;r<rmzszStreamReader.seekcCs|��}|r|St�dS)�4 Return the next decoded line from the input stream.N)r��
StopIteration)r:r�r;r;r<�__next__�szStreamReader.__next__cCs|Sr1r;rAr;r;r<�__iter__�szStreamReader.__iter__cCs||j|�Srqrrrsr;r;r<ru�szStreamReader.__getattr__cCs|Sr1r;rAr;r;r<rv�szStreamReader.__enter__cCs|j��dSr1rwryr;r;r<r}�szStreamReader.__exit__)rE)rE)r�r�F)NT)NT)r)rCr>r?r�rrNr$r�r�r�rQrmr�r�rtrurvr}r;r;r;r<r�s


P
K

�
c@s�eZdZdZdZd!dd�Zd"dd�Zd#d
d�Zd$dd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
d%dd�Zefdd�Zdd�Zdd �Zd	S)&ra StreamReaderWriter instances allow wrapping streams which
        work in both read and write modes.

        The design is such that one can use the factory functions
        returned by the codec.lookup() function to construct the
        instance.

    �unknownrEcCs(||_|||�|_|||�|_||_dS)aR Creates a StreamReaderWriter instance.

            stream must be a Stream-like object.

            Reader, Writer must be factory functions or classes
            providing the StreamReader, StreamWriter interface resp.

            Error handling is done in the same way as defined for the
            StreamWriter/Readers.

        N)rd�reader�writerrJ)r:rd�Reader�WriterrJr;r;r<rN�s
zStreamReaderWriter.__init__r�cCs|j�|�Sr1)r�r��r:r�r;r;r<r��szStreamReaderWriter.readNcCs|j�|�Sr1)r�r�r�r;r;r<r��szStreamReaderWriter.readlinecCs|j�|�Sr1)r�r�)r:r�r;r;r<r��szStreamReaderWriter.readlinescCs
t|j�S�r�)�nextr�rAr;r;r<r��szStreamReaderWriter.__next__cCs|Sr1r;rAr;r;r<r��szStreamReaderWriter.__iter__cCs|j�|�Sr1)r�rf)r:r[r;r;r<rf�szStreamReaderWriter.writecCs|j�|�Sr1)r�rkrir;r;r<rk�szStreamReaderWriter.writelinescCs|j��|j��dSr1�r�rQr�rAr;r;r<rQ�s
zStreamReaderWriter.resetrcCs6|j�||�|j��|dkr2|dkr2|j��dSr^)rdrmr�rQr�rnr;r;r<rm�s
zStreamReaderWriter.seekcCs||j|�Srqrrrsr;r;r<ru�szStreamReaderWriter.__getattr__cCs|Sr1r;rAr;r;r<rv�szStreamReaderWriter.__enter__cCs|j��dSr1rwryr;r;r<r}�szStreamReaderWriter.__exit__)rE)r�)N)N)r)rCr>r?rD�encodingrNr�r�r�r�r�rfrkrQrmrtrurvr}r;r;r;r<r�s 	




�
	c@s�eZdZdZdZdZd!dd�Zd"dd�Zd#d
d�Zd$dd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zd%dd�Zefdd�Zdd�Zdd �Zd	S)&raB StreamRecoder instances translate data from one encoding to another.

        They use the complete set of APIs returned by the
        codecs.lookup() function to implement their task.

        Data written to the StreamRecoder is first decoded into an
        intermediate format (depending on the "decode" codec) and then
        written to the underlying stream using an instance of the provided
        Writer class.

        In the other direction, data is read from the underlying stream using
        a Reader instance and then encoded and returned to the caller.

    r�rEcCs4||_||_||_|||�|_|||�|_||_dS)a� Creates a StreamRecoder instance which implements a two-way
            conversion: encode and decode work on the frontend (the
            data visible to .read() and .write()) while Reader and Writer
            work on the backend (the data in stream).

            You can use these objects to do transparent
            transcodings from e.g. latin-1 to utf-8 and back.

            stream must be a file-like object.

            encode and decode must adhere to the Codec interface; Reader and
            Writer must be factory functions or classes providing the
            StreamReader and StreamWriter interfaces resp.

            Error handling is done in the same way as defined for the
            StreamWriter/Readers.

        N)rdr#r$r�r�rJ)r:rdr#r$r�r�rJr;r;r<rNszStreamRecoder.__init__r�cCs"|j�|�}|�||j�\}}|Sr1)r�r�r#rJ�r:r�r[�bytesencodedr;r;r<r�#szStreamRecoder.readNcCs6|dkr|j��}n|j�|�}|�||j�\}}|Sr1)r�r�r#rJr�r;r;r<r�)s
zStreamRecoder.readlinecCs(|j��}|�||j�\}}|jdd�S)NTr�)r�r�r#rJr�)r:r�r[r�r;r;r<r�2s
zStreamRecoder.readlinescCs t|j�}|�||j�\}}|Sr�)r�r�r#rJ)r:r[r�r;r;r<r�8s
zStreamRecoder.__next__cCs|Sr1r;rAr;r;r<r�?szStreamRecoder.__iter__cCs|�||j�\}}|j�|�Sr1)r$rJr�rf)r:r[�bytesdecodedr;r;r<rfBszStreamRecoder.writecCs(d�|�}|�||j�\}}|j�|�Srb)rhr$rJr�rf)r:rjr[r�r;r;r<rkGs
zStreamRecoder.writelinescCs|j��|j��dSr1r�rAr;r;r<rQMs
zStreamRecoder.resetrcCs |j�||�|j�||�dSr1)r�rmr�rnr;r;r<rmRszStreamRecoder.seekcCs||j|�Srqrrrsr;r;r<ruXszStreamRecoder.__getattr__cCs|Sr1r;rAr;r;r<rv_szStreamRecoder.__enter__cCs|j��dSr1rwryr;r;r<r}bszStreamRecoder.__exit__)rE)r�)N)N)r)rCr>r?rD�
data_encoding�
file_encodingrNr�r�r�r�r�rfrkrQrmrtrurvr}r;r;r;r<r�s$�


	

�
�rrEr�cCst|dk	rd|kr|d}t�|||�}|dkr2|Sz&t|�}t||j|j|�}||_|WS|���YnXdS)aq Open an encoded file using the given mode and return
        a wrapped version providing transparent encoding/decoding.

        Note: The wrapped version will only accept the object format
        defined by the codecs, i.e. Unicode objects for most builtin
        codecs. Output is also codec dependent and will usually be
        Unicode as well.

        Underlying encoded files are always opened in binary mode.
        The default file mode is 'r', meaning to open the file in read mode.

        encoding specifies the encoding which is to be used for the
        file.

        errors may be given to define the error handling. It defaults
        to 'strict' which causes ValueErrors to be raised in case an
        encoding error occurs.

        buffering has the same meaning as for the builtin open() API.
        It defaults to -1 which means that the default buffer size will
        be used.

        The returned wrapped file object provides an extra attribute
        .encoding which allows querying the used encoding. This
        attribute is only available if an encoding was specified as
        parameter.

    N�b)�builtinsrrrr8r7r�rx)�filename�moder�rJ�	buffering�file�info�srwr;r;r<rgs�cCsF|dkr|}t|�}t|�}t||j|j|j|j|�}||_||_|S)a� Return a wrapped version of file which provides transparent
        encoding translation.

        Data written to the wrapped file is decoded according
        to the given data_encoding and then encoded to the underlying
        file using file_encoding. The intermediate data type
        will usually be Unicode but depends on the specified codecs.

        Bytes read from the file are decoded using file_encoding and then
        passed back to the caller encoded using data_encoding.

        If file_encoding is not given, it defaults to data_encoding.

        errors may be given to define the error handling. It defaults
        to 'strict' which causes ValueErrors to be raised in case an
        encoding error occurs.

        The returned wrapped file object provides two extra attributes
        .data_encoding and .file_encoding which reflect the given
        parameters of the same name. The attributes can be used for
        introspection by Python programs.

    N)rrr#r$r8r7r�r�)r�r�r�rJ�	data_info�	file_info�srr;r;r<r�s�cCs
t|�jS)z� Lookup up the codec for the given encoding and return
        its encoder function.

        Raises a LookupError in case the encoding cannot be found.

    )rr#�r�r;r;r<r�scCs
t|�jS)z� Lookup up the codec for the given encoding and return
        its decoder function.

        Raises a LookupError in case the encoding cannot be found.

    )rr$r�r;r;r<r�scCst|�j}|dkrt|��|S)z� Lookup up the codec for the given encoding and return
        its IncrementalEncoder class or factory function.

        Raises a LookupError in case the encoding cannot be found
        or the codecs doesn't provide an incremental encoder.

    N)rr5�LookupError)r��encoderr;r;r<r�s	
cCst|�j}|dkrt|��|S)z� Lookup up the codec for the given encoding and return
        its IncrementalDecoder class or factory function.

        Raises a LookupError in case the encoding cannot be found
        or the codecs doesn't provide an incremental decoder.

    N)rr6r�)r��decoderr;r;r<r �s	
cCs
t|�jS)z� Lookup up the codec for the given encoding and return
        its StreamReader class or factory function.

        Raises a LookupError in case the encoding cannot be found.

    )rr8r�r;r;r<r!�scCs
t|�jS)z� Lookup up the codec for the given encoding and return
        its StreamWriter class or factory function.

        Raises a LookupError in case the encoding cannot be found.

    )rr7r�r;r;r<r"�scksHt|�|f|�}|D]}|�|�}|r|Vq|�dd�}|rD|VdS)z�
    Encoding iterator.

    Encodes the input strings from the iterator using an IncrementalEncoder.

    errors and kwargs are passed through to the IncrementalEncoder
    constructor.
    rKTN)rr#)�iteratorr�rJ�kwargsr�rI�outputr;r;r<r%s	
cksHt|�|f|�}|D]}|�|�}|r|Vq|�dd�}|rD|VdS)z�
    Decoding iterator.

    Decodes the input strings from the iterator using an IncrementalDecoder.

    errors and kwargs are passed through to the IncrementalDecoder
    constructor.
    r`TN)r r$)r�r�rJr�r�rIr�r;r;r<r&s	
cCsdd�|D�S)z� make_identity_dict(rng) -> dict

        Return a dictionary where elements of the rng sequence are
        mapped to themselves.

    cSsi|]
}||�qSr;r;)�.0�ir;r;r<�
<dictcomp>/sz&make_identity_dict.<locals>.<dictcomp>r;)�rngr;r;r<�make_identity_dict'sr�cCs4i}|��D]"\}}||kr&|||<qd||<q|S)a� Creates an encoding map from a decoding map.

        If a target mapping in the decoding map occurs multiple
        times, then that target is mapped to None (undefined mapping),
        causing an exception when encountered by the charmap codec
        during translation.

        One example where this happens is cp875.py which decodes
        multiple character to \u001a.

    N)�items)�decoding_map�m�k�vr;r;r<�make_encoding_map1s


r��ignore�replace�xmlcharrefreplace�backslashreplace�namereplace�__main__zlatin-1zutf-8)r�NrEr�)NrE)rE)rE)<rDr��sys�_codecs�ImportErrorZwhy�SystemError�__all__rr	rrrrr�	byteorderrrrrr
r
rr2rrrgrrVrrarrrrrrrrrr r!r"r%r&r�r�r.r'r(r)r*r+r,r��_falseZ	encodingsrC�stdout�stdinr;r;r;r<�<module>s�	�
B("1+IzWt
0
&








netrc.cpython-38.pyc000064400000007303150335716500010317 0ustar00U

e5d��@sXdZddlZddlZddlZddgZGdd�de�ZGdd�d�ZedkrTe	e��dS)z-An object-oriented interface to .netrc files.�N�netrc�NetrcParseErrorc@s"eZdZdZddd�Zdd�ZdS)rz5Exception raised on syntax errors in the .netrc file.NcCs"||_||_||_t�||�dS)N)�filename�lineno�msg�	Exception�__init__)�selfrrr�r
�/usr/lib64/python3.8/netrc.pyrszNetrcParseError.__init__cCsd|j|j|jfS)Nz%s (%s, line %s))rrr)r	r
r
r�__str__szNetrcParseError.__str__)NN)�__name__�
__module__�__qualname__�__doc__rrr
r
r
rr
s
c@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)rNc	CsX|dk}|dkr&tj�tj�d�d�}i|_i|_t|��}|�|||�W5QRXdS)N�~z.netrc)�os�path�join�
expanduser�hosts�macros�open�_parse)r	�file�
default_netrc�fpr
r
rrs
znetrc.__init__cCs�t�|�}|jd7_|j�dd�|_|j}|��}}|sD�q�n�|ddkrt|j|kr(t|�dkr(|j��q(n�|dkr�|��}nt|dkr�d}nf|dkr�|��}g|j	|<d	|_
|j��}	|	r�|	d
kr�d|_
q(|j	|�|	�q�q(ntd|||j��d}
d}}i|j
|<|��}|�d��s.|d
k�rr|�rR|
||f|j
|<|�|�q(ntd||t|�f||j���q|dk�s�|dk�r�|��}
�q|dk�r�|��}�q|dk�r�tjdk�r�|�r�t�|���}
|
jt��k�rpddl}z|�|
j�d}Wn tk
�rd|
j}YnXz|�t���d}Wn"tk
�rXdt��}YnXtd||f||j��|
jtjtjB@�r�td||j��|��}ntd|||j���qq(dS)Nz !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~�#�r��machine�default�macdefz 	�
z 	
zbad toplevel token %r>rr"r!r z&malformed %s entry %s terminated by %s�login�user�account�password�posixzuid %sz9~/.netrc file owner (%s) does not match current user (%s)zY~/.netrc access too permissive: access permissions must restrict access to only the ownerzbad follower token %r)�shlexZ	wordcharsZ
commenters�replacerZ	get_token�lenZinstream�readlinerZ
whitespace�appendrr�
startswithZ
push_token�reprr�name�fstat�fileno�st_uid�getuid�pwd�getpwuid�KeyError�st_mode�stat�S_IRWXG�S_IRWXO)r	rrrZlexerZsaved_linenoZtoplevelZttZ	entryname�liner$r&r'Zpropr5Zfownerr%r
r
rr s�




�
�
��

���
�znetrc._parsecCs0||jkr|j|Sd|jkr(|jdSdSdS)z8Return a (user, account, password) tuple for given host.r!N)r)r	�hostr
r
r�authenticatorsqs




znetrc.authenticatorscCs�d}|j��D]X}|j|}|d|�d|d�d�7}|drR|d|d�d�7}|d|d	�d�7}q|j��D]4}|d
|�d�7}|j|D]}||7}q�|d7}qr|S)z3Dump the class data in the format of a .netrc file.rzmachine z
	login rr#rz		account z
	password �zmacdef )r�keysr)r	Zrepr=�attrsZmacror<r
r
r�__repr__zs


znetrc.__repr__)N)r
rrrrr>rBr
r
r
rrs
	Q	�__main__)
rrr)r9�__all__rrrr
�printr
r
r
r�<module>stcode.cpython-38.pyc000064400000023273150335716500010122 0ustar00U

e5d~)�@s�dZddlZddlZddlmZmZddddgZGdd�d�ZGd	d�de�Zdd
d�Z	e
dkr�ddlZe��Z
e
jdd
dd�e
��Zejs�ejjr�dZndZe	e�dS)z?Utilities needed to emulate Python's interactive interpreter.

�N)�CommandCompiler�compile_command�InteractiveInterpreter�InteractiveConsole�interactrc@sFeZdZdZddd�Zddd�Zd	d
�Zddd�Zd
d�Zdd�Z	dS)rz�Base class for InteractiveConsole.

    This class deals with parsing and interpreter state (the user's
    namespace); it doesn't deal with input buffering or prompting or
    input file naming (the filename is always passed in explicitly).

    NcCs$|dkrddd�}||_t�|_dS)aConstructor.

        The optional 'locals' argument specifies the dictionary in
        which code will be executed; it defaults to a newly created
        dictionary with key "__name__" set to "__console__" and key
        "__doc__" set to None.

        NZ__console__)�__name__�__doc__)�localsr�compile)�selfr	�r�/usr/lib64/python3.8/code.py�__init__s	
zInteractiveInterpreter.__init__�<input>�singlec
CsTz|�|||�}Wn&tttfk
r8|�|�YdSX|dkrFdS|�|�dS)a�Compile and run some source in the interpreter.

        Arguments are as for compile_command().

        One of several things can happen:

        1) The input is incorrect; compile_command() raised an
        exception (SyntaxError or OverflowError).  A syntax traceback
        will be printed by calling the showsyntaxerror() method.

        2) The input is incomplete, and more input is required;
        compile_command() returned None.  Nothing happens.

        3) The input is complete; compile_command() returned a code
        object.  The code is executed by calling self.runcode() (which
        also handles run-time exceptions, except for SystemExit).

        The return value is True in case 2, False in the other cases (unless
        an exception is raised).  The return value can be used to
        decide whether to use sys.ps1 or sys.ps2 to prompt the next
        line.

        FNT)r
�
OverflowError�SyntaxError�
ValueError�showsyntaxerror�runcode)r�source�filenameZsymbol�coderrr
�	runsource&s

z InteractiveInterpreter.runsourcecCs>zt||j�Wn(tk
r&�Yn|��YnXdS)a�Execute a code object.

        When an exception occurs, self.showtraceback() is called to
        display a traceback.  All exceptions are caught except
        SystemExit, which is reraised.

        A note about KeyboardInterrupt: this exception may occur
        elsewhere in this code, and may not always be caught.  The
        caller should be prepared to deal with it.

        N)�execr	�
SystemExit�
showtraceback)rrrrr
rMszInteractiveInterpreter.runcodecCs�t��\}}}|t_|t_|t_|rp|tkrpz|j\}\}}}}	Wntk
rVYnXt|||||	f�}|t_tjtj	kr�t
�||�}
|�d�
|
��nt�|||�dS)apDisplay the syntax error that just occurred.

        This doesn't display a stack trace because there isn't one.

        If a filename is given, it is stuffed in the exception instead
        of what was there before (because Python's parser always uses
        "<string>" when reading from a string).

        The output is written by self.write(), below.

        �N)�sys�exc_info�	last_type�
last_value�last_tracebackr�argsr�
excepthook�__excepthook__�	traceback�format_exception_only�write�join)rr�type�value�tb�msgZdummy_filename�lineno�offset�line�linesrrr
r`sz&InteractiveInterpreter.showsyntaxerrorcCs|t��\t_t_}}|t_zPt�|d|d|j�}tjtj	krT|�
d�|��nt�|d|d|�W5d}}XdS)z�Display the exception that just occurred.

        We remove the first stack item because it is our own code.

        The output is written by self.write(), below.

        Nr�r)rrr r!r"r&�format_exception�tb_nextr$r%r(r))rZlast_tbZeir1rrr
r�sz$InteractiveInterpreter.showtracebackcCstj�|�dS)z�Write a string.

        The base implementation writes to sys.stderr; a subclass may
        replace this with a different implementation.

        N)r�stderrr()r�datarrr
r(�szInteractiveInterpreter.write)N)rr)N)
r�
__module__�__qualname__rrrrrrr(rrrr
rs

'
#c@s>eZdZdZddd�Zdd�Zddd	�Zd
d�Zdd
d�ZdS)rz�Closely emulate the behavior of the interactive Python interpreter.

    This class builds on InteractiveInterpreter and adds prompting
    using the familiar sys.ps1 and sys.ps2, and input buffering.

    N�	<console>cCst�||�||_|��dS)z�Constructor.

        The optional locals argument will be passed to the
        InteractiveInterpreter base class.

        The optional filename argument should specify the (file)name
        of the input stream; it will show up in tracebacks.

        N)rrr�resetbuffer)rr	rrrr
r�s
zInteractiveConsole.__init__cCs
g|_dS)zReset the input buffer.N)�buffer)rrrr
r:�szInteractiveConsole.resetbuffercCsRz
tjWntk
r$dt_YnXz
tjWntk
rJdt_YnXd}|dkrx|�dtjtj||jjf�n|r�|�dt	|��d}zV|r�tj}ntj}z|�
|�}Wn&tk
r�|�d�YW�qYnX|�|�}Wq�t
k
�r|�d	�|��d}Yq�Xq�|dk�r6|�d
|jj�n|dk�rN|�d|�dS)a�Closely emulate the interactive Python console.

        The optional banner argument specifies the banner to print
        before the first interaction; by default it prints a banner
        similar to the one printed by the real Python interpreter,
        followed by the current class name in parentheses (so as not
        to confuse this with the real interpreter -- since it's so
        close!).

        The optional exitmsg argument specifies the exit message
        printed when exiting. Pass the empty string to suppress
        printing an exit message. If exitmsg is not given or None,
        a default message is printed.

        z>>> z... zFType "help", "copyright", "credits" or "license" for more information.NzPython %s on %s
%s
(%s)
z%s
r�
z
KeyboardInterrupt
znow exiting %s...
r)rZps1�AttributeErrorZps2r(�version�platform�	__class__r�str�	raw_input�EOFError�push�KeyboardInterruptr:)r�banner�exitmsgZcprt�more�promptr0rrr
r�sH


��



zInteractiveConsole.interactcCs6|j�|�d�|j�}|�||j�}|s2|��|S)aPush a line to the interpreter.

        The line should not have a trailing newline; it may have
        internal newlines.  The line is appended to a buffer and the
        interpreter's runsource() method is called with the
        concatenated contents of the buffer as source.  If this
        indicates that the command was executed or invalid, the buffer
        is reset; otherwise, the command is incomplete, and the buffer
        is left as it was after the line was appended.  The return
        value is 1 if more input is required, 0 if the line was dealt
        with in some way (this is the same as runsource()).

        r<)r;�appendr)rrr:)rr0rrHrrr
rD�szInteractiveConsole.pushrcCst|�S)aDWrite a prompt and read a line.

        The returned line does not include the trailing newline.
        When the user enters the EOF key sequence, EOFError is raised.

        The base implementation uses the built-in function
        input(); a subclass may replace this with a different
        implementation.

        )�input)rrIrrr
rBszInteractiveConsole.raw_input)Nr9)NN)r)	rr7r8rrr:rrDrBrrrr
r�s

6cCsJt|�}|dk	r||_n"zddl}Wntk
r8YnX|�||�dS)a&Closely emulate the interactive Python interpreter.

    This is a backwards compatible interface to the InteractiveConsole
    class.  When readfunc is not specified, it attempts to import the
    readline module to enable GNU readline if it is available.

    Arguments (all optional, all default to None):

    banner -- passed to InteractiveConsole.interact()
    readfunc -- if not None, replaces InteractiveConsole.raw_input()
    local -- passed to InteractiveInterpreter.__init__()
    exitmsg -- passed to InteractiveConsole.interact()

    Nr)rrB�readline�ImportErrorr)rFZreadfuncZlocalrGZconsolerLrrr
rs�__main__z-q�
store_truez*don't print version and copyright messages)�action�helpr)NNNN)rrr&Zcodeoprr�__all__rrrr�argparse�ArgumentParser�parser�add_argument�
parse_argsr#�q�flags�quietrFrrrr
�<module>s*�t
�copy.cpython-38.opt-2.pyc000064400000011103150335716500011107 0ustar00U

e5d�!�@sPddlZddlZddlmZGdd�de�ZeZzddlmZWne	k
rXdZYnXdddgZ
dd�ZiZZ
d	d
�Zed�eeeeeeeeeeeeejee�ee�ejejfD]Z ee
e <q�e!edd�Z e dk	r�ee
e <e"je
e"<e#je
e#<e$je
e$<e%je
e%<edk	�reje
e<[
[ dgfdd�Z&iZ'Z
d
d�Z(e(e
ed�<e(e
ee�<e(e
ee�<e(e
e<e(e
e<e(e
e<e(e
e<e(e
e<e(e
e<e(e
ej)<e(e
e<e(e
ej<e(e
ej<e(e
ej<e(e
e<e&fdd�Z*e*e
e"<e&fdd�Z+e+e
e<e&fdd�Z,e,e
e#<edk	�re,e
e<dd�Z-e-e
ej.<[
dd�Z/ddde&fdd�Z0[[[dS)�N)�dispatch_tablec@seZdZdS)�ErrorN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.8/copy.pyr7sr)�PyStringMap�copy�deepcopycCs�t|�}t�|�}|r||�St|t�r0t|�St|dd�}|dk	rL||�St�|�}|dk	rh||�}nBt|dd�}|dk	r�|d�}n$t|dd�}|r�|�}ntd|��t|t	�r�|St
|df|��S)N�__copy__�
__reduce_ex__��
__reduce__z%un(shallow)copyable object of type %s)�type�_copy_dispatch�get�
issubclass�_copy_immutable�getattrrr�
isinstance�str�_reconstruct)�x�cls�copier�reductor�rvrrrr
Bs,





cCs|S�Nr)rrrrrksr�CodeTypec	Cs |dkri}t|�}|�||�}||k	r,|St|�}t�|�}|dk	rR|||�}n�t|t�rht||�}n�t|dd�}|dk	r�||�}nzt�|�}|r�||�}nBt|dd�}|dk	r�|d�}n$t|dd�}|r�|�}ntd|��t	|t
�r�|}nt||f|��}||k	�r|||<t||�|S)N�__deepcopy__r
rrz"un(deep)copyable object of type %s)
�idrr�_deepcopy_dispatchr�_deepcopy_atomicrrrrrr�_keep_alive)	r�memoZ_nil�d�yrrrrrrrr�sD





�


cCs|Srr�rr%rrrr#�sr#cCs2g}||t|�<|j}|D]}||||��q|Sr)r!�append)rr%rr'r)�arrr�_deepcopy_list�sr+csh��fdd�|D�}z�t|�WStk
r6YnXt||�D]\}}||k	rBt|�}qdqB|}|S)Ncsg|]}�|���qSrr)�.0r*�rr%rr�
<listcomp>�sz#_deepcopy_tuple.<locals>.<listcomp>)r!�KeyError�zip�tuple)rr%rr'�k�jrr-r�_deepcopy_tuple�sr4cCs:i}||t|�<|��D]\}}|||�||||�<q|Sr)r!�items)rr%rr'�key�valuerrr�_deepcopy_dict�s
r8cCst|�|jt|j|��Sr)r�__func__r�__self__r(rrr�_deepcopy_method�sr;cCs>z|t|��|�Wn"tk
r8|g|t|�<YnXdSr)r!r)r/r(rrrr$�s
r$csb�dk	}|r$|r$��fdd�|D�}||�}	|r<|	�t|�<|dk	r�|rR�|��}t|	d�rh|	�|�n^t|t�r�t|�dkr�|\}}
nd}
|dk	r�|	j�|�|
dk	r�|
��D]\}}t	|	||�q�|dk	�r|r�|D]}
�|
��}
|	�
|
�q�n|D]}
|	�
|
�q�|dk	�r^|�rF|D]&\}}�|��}�|��}||	|<�qn|D]\}}||	|<�qJ|	S)Nc3s|]}�|��VqdSrr)r,�argr-rr�	<genexpr>sz_reconstruct.<locals>.<genexpr>�__setstate__�)r!�hasattrr>rr1�len�__dict__�updater5�setattrr))rr%�func�args�stateZlistiterZdictiterrZdeepr'Z	slotstater6r7�itemrr-rrsF







r)1�types�weakref�copyregr�	Exceptionr�errorZorg.python.corer	�ImportError�__all__r
rr&rr�int�float�bool�complexrr1�bytes�	frozenset�range�slice�property�BuiltinFunctionType�Ellipsis�NotImplemented�FunctionType�ref�tr�list�dict�set�	bytearrayrr"r#rr+r4r8r;�
MethodTyper$rrrrr�<module>3s�

'�






4





�
-threading.cpython-38.pyc000064400000116052150335716500011153 0ustar00U

e5d���@s2dZddlZddlZddlZddlmZddl	m
Z
ddlmZ
mZzddlmZWn ek
rtddlmZYnXddd	d
ddd
ddddddddddddddddgZejZejZejZejZzejZdZe�d�Wnek
r�d ZYnXej Z!z
ej"Z#Wnek
�rdZ#YnXej$Z$[da%da&d!d�Z'd"d�Z(eZ)d#d�Z"Gd$d%�d%�Z*e*Z+Gd&d	�d	�Z,Gd'd�d�Z-Gd(d�de-�Z.Gd)d�d�Z/Gd*d�d�Z0Gd+d�de1�Z2e�j3Z4e4�dLd-d.�Z5e�a6iZ7iZ8e
�Z9e�a:e;�a<Gd/d�d�Z=zdd0lm>a?m@ZAWnHek
�rVdd1lBmCZDdd2lmEZEeEdd3�Z@d4d�ZAd5d�a?YnXd6d7�ZFGd8d�de=�ZGGd9d:�d:e=�ZHGd;d<�d<e=�ZId=d
�ZJeJZKd>d�ZLeLZMd?d@�ZNdAd�ZOddBlmPZPeH�aQdCdD�ZRdEd�ZSzddFlmTZUWn"ek
�rddGlVmUZUYnXdHdI�ZWeXedJ��r.ejYeWdK�dS)Mz;Thread module emulating a subset of Java's threading model.�N)�	monotonic)�WeakSet)�islice�count)�deque�	get_ident�active_count�	Condition�current_thread�	enumerate�main_thread�TIMEOUT_MAX�Event�Lock�RLock�	Semaphore�BoundedSemaphore�Thread�Barrier�BrokenBarrierError�Timer�ThreadError�
setprofile�settrace�local�
stack_size�
excepthook�ExceptHookArgsT�
get_native_idFcCs|adS)z�Set a profile function for all threads started from the threading module.

    The func will be passed to sys.setprofile() for each thread, before its
    run() method is called.

    N)�
_profile_hook��func�r"�!/usr/lib64/python3.8/threading.pyr9scCs|adS)z�Set a trace function for all threads started from the threading module.

    The func will be passed to sys.settrace() for each thread, before its run()
    method is called.

    N)�_trace_hookr r"r"r#rCscOstdkrt||�St||�S)a2Factory function that returns a new reentrant lock.

    A reentrant lock must be released by the thread that acquired it. Once a
    thread has acquired a reentrant lock, the same thread may acquire it again
    without blocking; the thread must release it once for each time it has
    acquired it.

    N)�_CRLock�_PyRLock)�args�kwargsr"r"r#rQs	
c@sVeZdZdZdd�Zdd�Zddd	�ZeZd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)�_RLocka,This class implements reentrant lock objects.

    A reentrant lock must be released by the thread that acquired it. Once a
    thread has acquired a reentrant lock, the same thread may acquire it
    again without blocking; the thread must release it once for each time it
    has acquired it.

    cCst�|_d|_d|_dS�Nr)�_allocate_lock�_block�_owner�_count��selfr"r"r#�__init__hsz_RLock.__init__c	Cs^|j}zt|j}Wntk
r(YnXd|j��r:dnd|jj|jj||j	t
t|��fS)Nz)<%s %s.%s object owner=%r count=%d at %s>�lockedZunlocked)r-�_active�name�KeyErrorr,r2�	__class__�
__module__�__qualname__r.�hex�id)r0�ownerr"r"r#�__repr__ms
�z_RLock.__repr__T���cCsDt�}|j|kr"|jd7_dS|j�||�}|r@||_d|_|S)aAcquire a lock, blocking or non-blocking.

        When invoked without arguments: if this thread already owns the lock,
        increment the recursion level by one, and return immediately. Otherwise,
        if another thread owns the lock, block until the lock is unlocked. Once
        the lock is unlocked (not owned by any thread), then grab ownership, set
        the recursion level to one, and return. If more than one thread is
        blocked waiting until the lock is unlocked, only one at a time will be
        able to grab ownership of the lock. There is no return value in this
        case.

        When invoked with the blocking argument set to true, do the same thing
        as when called without arguments, and return true.

        When invoked with the blocking argument set to false, do not block. If a
        call without an argument would block, return false immediately;
        otherwise, do the same thing as when called without arguments, and
        return true.

        When invoked with the floating-point timeout argument set to a positive
        value, block for at most the number of seconds specified by timeout
        and as long as the lock cannot be acquired.  Return true if the lock has
        been acquired, false if the timeout has elapsed.

        �)rr-r.r,�acquire)r0�blocking�timeout�me�rcr"r"r#r?|s
z_RLock.acquirecCs<|jt�krtd��|jd|_}|s8d|_|j��dS)amRelease a lock, decrementing the recursion level.

        If after the decrement it is zero, reset the lock to unlocked (not owned
        by any thread), and if any other threads are blocked waiting for the
        lock to become unlocked, allow exactly one of them to proceed. If after
        the decrement the recursion level is still nonzero, the lock remains
        locked and owned by the calling thread.

        Only call this method when the calling thread owns the lock. A
        RuntimeError is raised if this method is called when the lock is
        unlocked.

        There is no return value.

        �cannot release un-acquired lockr>N)r-r�RuntimeErrorr.r,�release)r0rr"r"r#rF�sz_RLock.releasecCs|��dS�N�rF�r0�t�v�tbr"r"r#�__exit__�sz_RLock.__exit__cCs|j��|\|_|_dSrG)r,r?r.r-)r0�stater"r"r#�_acquire_restore�s
z_RLock._acquire_restorecCs<|jdkrtd��|j}d|_|j}d|_|j��||fS)NrrD)r.rEr-r,rF)r0rr;r"r"r#�
_release_save�s

z_RLock._release_savecCs|jt�kSrG)r-rr/r"r"r#�	_is_owned�sz_RLock._is_ownedN)Tr=)
�__name__r7r8�__doc__r1r<r?�	__enter__rFrMrOrPrQr"r"r"r#r)^s	
$
r)c@steZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
ddd�Zddd�Zddd�Z
dd�ZeZdS)r	ajClass that implements a condition variable.

    A condition variable allows one or more threads to wait until they are
    notified by another thread.

    If the lock argument is given and not None, it must be a Lock or RLock
    object, and it is used as the underlying lock. Otherwise, a new RLock object
    is created and used as the underlying lock.

    NcCs�|dkrt�}||_|j|_|j|_z|j|_Wntk
rDYnXz|j|_Wntk
rfYnXz|j|_Wntk
r�YnXt�|_	dSrG)
r�_lockr?rFrP�AttributeErrorrOrQ�_deque�_waiters�r0�lockr"r"r#r1�s$zCondition.__init__cCs
|j��SrG)rUrTr/r"r"r#rT�szCondition.__enter__cGs|jj|�SrG)rUrM)r0r'r"r"r#rM�szCondition.__exit__cCsd|jt|j�fS)Nz<Condition(%s, %d)>)rU�lenrXr/r"r"r#r<�szCondition.__repr__cCs|j��dSrG)rUrFr/r"r"r#rP�szCondition._release_savecCs|j��dSrG)rUr?)r0�xr"r"r#rOszCondition._acquire_restorecCs"|j�d�r|j��dSdSdS)NrFT)rUr?rFr/r"r"r#rQs
zCondition._is_ownedcCs�|��std��t�}|��|j�|�|��}d}z>|dkrN|��d}n |dkrd|�d|�}n
|�d�}|W�S|�|�|s�z|j�|�Wnt	k
r�YnXXdS)akWait until notified or until a timeout occurs.

        If the calling thread has not acquired the lock when this method is
        called, a RuntimeError is raised.

        This method releases the underlying lock, and then blocks until it is
        awakened by a notify() or notify_all() call for the same condition
        variable in another thread, or until the optional timeout occurs. Once
        awakened or timed out, it re-acquires the lock and returns.

        When the timeout argument is present and not None, it should be a
        floating point number specifying a timeout for the operation in seconds
        (or fractions thereof).

        When the underlying lock is an RLock, it is not released using its
        release() method, since this may not actually unlock the lock when it
        was acquired multiple times recursively. Instead, an internal interface
        of the RLock class is used, which really unlocks it even when it has
        been recursively acquired several times. Another internal interface is
        then used to restore the recursion level when the lock is reacquired.

        zcannot wait on un-acquired lockFNTr)
rQrEr+r?rX�appendrPrO�remove�
ValueError)r0rA�waiterZsaved_stateZgotitr"r"r#�waits*

zCondition.waitcCsXd}|}|�}|sT|dk	rB|dkr.t�|}n|t�}|dkrBqT|�|�|�}q|S)z�Wait until a condition evaluates to True.

        predicate should be a callable which result will be interpreted as a
        boolean value.  A timeout may be provided giving the maximum time to
        wait.

        Nr)�_timera)r0Z	predicaterA�endtimeZwaittime�resultr"r"r#�wait_for>s

zCondition.wait_forr>c	Csf|��std��|j}tt||��}|s,dS|D]0}|��z|�|�Wq0tk
r^Yq0Xq0dS)aKWake up one or more threads waiting on this condition, if any.

        If the calling thread has not acquired the lock when this method is
        called, a RuntimeError is raised.

        This method wakes up at most n of the threads waiting for the condition
        variable; it is a no-op if no threads are waiting.

        z!cannot notify on un-acquired lockN)rQrErXrW�_islicerFr^r_)r0�nZall_waitersZwaiters_to_notifyr`r"r"r#�notifyUs
zCondition.notifycCs|�t|j��dS)z�Wake up all threads waiting on this condition.

        If the calling thread has not acquired the lock when this method
        is called, a RuntimeError is raised.

        N)rhr[rXr/r"r"r#�
notify_alllszCondition.notify_all)N)N)N)r>)rRr7r8rSr1rTrMr<rPrOrQrarerhriZ	notifyAllr"r"r"r#r	�s
	
0

	c@s8eZdZdZd
dd�Zddd�ZeZd	d
�Zdd�ZdS)raGThis class implements semaphore objects.

    Semaphores manage a counter representing the number of release() calls minus
    the number of acquire() calls, plus an initial value. The acquire() method
    blocks if necessary until it can return without making the counter
    negative. If not given, value defaults to 1.

    r>cCs&|dkrtd��tt��|_||_dS)Nrz$semaphore initial value must be >= 0)r_r	r�_cond�_value�r0�valuer"r"r#r1�szSemaphore.__init__TNc	Cs�|s|dk	rtd��d}d}|j�f|jdkrr|s4q�|dk	rd|dkrPt�|}n|t�}|dkrdq�|j�|�q$|jd8_d}W5QRX|S)a�Acquire a semaphore, decrementing the internal counter by one.

        When invoked without arguments: if the internal counter is larger than
        zero on entry, decrement it by one and return immediately. If it is zero
        on entry, block, waiting until some other thread has called release() to
        make it larger than zero. This is done with proper interlocking so that
        if multiple acquire() calls are blocked, release() will wake exactly one
        of them up. The implementation may pick one at random, so the order in
        which blocked threads are awakened should not be relied on. There is no
        return value in this case.

        When invoked with blocking set to true, do the same thing as when called
        without arguments, and return true.

        When invoked with blocking set to false, do not block. If a call without
        an argument would block, return false immediately; otherwise, do the
        same thing as when called without arguments, and return true.

        When invoked with a timeout other than None, it will block for at
        most timeout seconds.  If acquire does not complete successfully in
        that interval, return false.  Return true otherwise.

        Nz.can't specify timeout for non-blocking acquireFrr>T)r_rjrkrbra)r0r@rArCrcr"r"r#r?�s$

zSemaphore.acquirec	Cs.|j�|jd7_|j��W5QRXdS)z�Release a semaphore, incrementing the internal counter by one.

        When the counter is zero on entry and another thread is waiting for it
        to become larger than zero again, wake up that thread.

        r>N)rjrkrhr/r"r"r#rF�szSemaphore.releasecCs|��dSrGrHrIr"r"r#rM�szSemaphore.__exit__)r>)TN)	rRr7r8rSr1r?rTrFrMr"r"r"r#rxs

-c@s"eZdZdZddd�Zdd�ZdS)	ra�Implements a bounded semaphore.

    A bounded semaphore checks to make sure its current value doesn't exceed its
    initial value. If it does, ValueError is raised. In most situations
    semaphores are used to guard resources with limited capacity.

    If the semaphore is released too many times it's a sign of a bug. If not
    given, value defaults to 1.

    Like regular semaphores, bounded semaphores manage a counter representing
    the number of release() calls minus the number of acquire() calls, plus an
    initial value. The acquire() method blocks if necessary until it can return
    without making the counter negative. If not given, value defaults to 1.

    r>cCst�||�||_dSrG)rr1�_initial_valuerlr"r"r#r1�szBoundedSemaphore.__init__c	CsB|j�2|j|jkrtd��|jd7_|j��W5QRXdS)a6Release a semaphore, incrementing the internal counter by one.

        When the counter is zero on entry and another thread is waiting for it
        to become larger than zero again, wake up that thread.

        If the number of releases exceeds the number of acquires,
        raise a ValueError.

        z!Semaphore released too many timesr>N)rjrkrnr_rhr/r"r"r#rF�s

zBoundedSemaphore.releaseN)r>)rRr7r8rSr1rFr"r"r"r#r�s
c@sFeZdZdZdd�Zdd�Zdd�ZeZdd	�Zd
d�Z	dd
d�Z
dS)rz�Class implementing event objects.

    Events manage a flag that can be set to true with the set() method and reset
    to false with the clear() method. The wait() method blocks until the flag is
    true.  The flag is initially false.

    cCstt��|_d|_dS)NF)r	rrj�_flagr/r"r"r#r1�szEvent.__init__cCs|j�t��dSrG)rjr1rr/r"r"r#�_reset_internal_locks�szEvent._reset_internal_lockscCs|jS)z5Return true if and only if the internal flag is true.)ror/r"r"r#�is_setszEvent.is_setc	Cs&|j�d|_|j��W5QRXdS)z�Set the internal flag to true.

        All threads waiting for it to become true are awakened. Threads
        that call wait() once the flag is true will not block at all.

        TN)rjrorir/r"r"r#�setsz	Event.setc	Cs|j�d|_W5QRXdS)z�Reset the internal flag to false.

        Subsequently, threads calling wait() will block until set() is called to
        set the internal flag to true again.

        FN)rjror/r"r"r#�clearszEvent.clearNc
Cs8|j�(|j}|s|j�|�}|W5QR�SQRXdS)aHBlock until the internal flag is true.

        If the internal flag is true on entry, return immediately. Otherwise,
        block until another thread calls set() to set the flag to true, or until
        the optional timeout occurs.

        When the timeout argument is present and not None, it should be a
        floating point number specifying a timeout for the operation in seconds
        (or fractions thereof).

        This method returns the internal flag on exit, so it will always return
        True except if a timeout is given and the operation times out.

        N)rjrora)r0rAZsignaledr"r"r#ras
z
Event.wait)N)rRr7r8rSr1rprqZisSetrrrsrar"r"r"r#r�s

c@s�eZdZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Ze
dd��Ze
dd��Ze
dd��ZdS)rz�Implements a Barrier.

    Useful for synchronizing a fixed number of threads at known synchronization
    points.  Threads block on 'wait()' and are simultaneously awoken once they
    have all made that call.

    NcCs.tt��|_||_||_||_d|_d|_dS)aWCreate a barrier, initialised to 'parties' threads.

        'action' is a callable which, when supplied, will be called by one of
        the threads after they have all entered the barrier and just prior to
        releasing them all. If a 'timeout' is provided, it is used as the
        default for all subsequent 'wait()' calls.

        rN)r	rrj�_action�_timeout�_parties�_stater.)r0�parties�actionrAr"r"r#r1Fs	zBarrier.__init__c
Cs�|dkr|j}|j�r|��|j}|jd7_z6|d|jkrL|��n
|�|�|W�W5QR�S|jd8_|��XW5QRXdS)aNWait for the barrier.

        When the specified number of threads have started waiting, they are all
        simultaneously awoken. If an 'action' was provided for the barrier, one
        of the threads will have executed that callback prior to returning.
        Returns an individual index number from 0 to 'parties-1'.

        Nr>)rurj�_enterr.�_exitrv�_release�_wait)r0rA�indexr"r"r#raVs	

zBarrier.waitcCs6|jdkr|j��q|jdkr$t�|jdks2t�dS)N�r=r>r)rwrjrar�AssertionErrorr/r"r"r#rzts


zBarrier._entercCs>z"|jr|��d|_|j��Wn|���YnXdS)Nr>)rtrwrjri�_breakr/r"r"r#r|szBarrier._releasecsB�j��fdd�|�s"���t��jdkr0t��jdks>t�dS)Ncs
�jdkSr*�rwr"r/r"r#�<lambda>��zBarrier._wait.<locals>.<lambda>rr>)rjrer�rrwr��r0rAr"r/r#r}�s
z
Barrier._waitcCs(|jdkr$|jdkr$d|_|j��dS)Nrr)r.rwrjrir/r"r"r#r{�s

z
Barrier._exitc	CsT|j�D|jdkr6|jdkr$d|_q<|jdkr<d|_nd|_|j��W5QRXdS)z�Reset the barrier to the initial state.

        Any threads currently waiting will get the BrokenBarrier exception
        raised.

        rr=���N)rjr.rwrir/r"r"r#�reset�s


z
Barrier.resetc	Cs|j�|��W5QRXdS)z�Place the barrier into a 'broken' state.

        Useful in case of error.  Any currently waiting threads and threads
        attempting to 'wait()' will have BrokenBarrierError raised.

        N)rjr�r/r"r"r#�abort�sz
Barrier.abortcCsd|_|j��dS)Nr�)rwrjrir/r"r"r#r��szBarrier._breakcCs|jS)z:Return the number of threads required to trip the barrier.)rvr/r"r"r#rx�szBarrier.partiescCs|jdkr|jSdS)z>Return the number of threads currently waiting at the barrier.r)rwr.r/r"r"r#�	n_waiting�s
zBarrier.n_waitingcCs
|jdkS)z0Return True if the barrier is in a broken state.r�r�r/r"r"r#�broken�szBarrier.broken)NN)N)rRr7r8rSr1rarzr|r}r{r�r�r��propertyrxr�r�r"r"r"r#r=s 




c@seZdZdS)rN)rRr7r8r"r"r"r#r�s�	Thread-%dcCs
|t�SrG)�_counter)�templater"r"r#�_newname�sr�c@seZdZdZdZd:dd�dd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zer\dd�Z
dd�Zdd�Zdd�Zdd�Zd;dd�Zd<d"d#�Zed$d%��Zejd&d%��Zed'd(��Zer�ed)d*��Zd+d,�Zd-d.�Zed/d0��Zejd1d0��Zd2d3�Zd4d5�Zd6d7�Zd8d9�ZdS)=raA class that represents a thread of control.

    This class can be safely subclassed in a limited fashion. There are two ways
    to specify the activity: by passing a callable object to the constructor, or
    by overriding the run() method in a subclass.

    FNr"��daemoncCs�|dkstd��|dkri}||_t|p,t��|_||_||_|dk	rN||_n
t�j	|_d|_
trhd|_d|_
t�|_d|_d|_tj|_t�|_t�|�dS)aKThis constructor should always be called with keyword arguments. Arguments are:

        *group* should be None; reserved for future extension when a ThreadGroup
        class is implemented.

        *target* is the callable object to be invoked by the run()
        method. Defaults to None, meaning nothing is called.

        *name* is the thread name. By default, a unique name is constructed of
        the form "Thread-N" where N is a small decimal number.

        *args* is the argument tuple for the target invocation. Defaults to ().

        *kwargs* is a dictionary of keyword arguments for the target
        invocation. Defaults to {}.

        If a subclass overrides the constructor, it must make sure to invoke
        the base class constructor (Thread.__init__()) before doing anything
        else to the thread.

        Nz#group argument must be None for nowFT)r��_target�strr��_name�_args�_kwargs�	_daemonicr
r��_ident�_HAVE_THREAD_NATIVE_ID�
_native_id�_tstate_lockr�_started�_is_stopped�_initialized�_sys�stderr�_stderr�_make_invoke_excepthook�_invoke_excepthook�	_dangling�add)r0�group�targetr4r'r(r�r"r"r#r1�s(
zThread.__init__cCs(|j��|r|��nd|_d|_dS�NT)r�rp�_set_tstate_lockr�r�)r0�is_aliver"r"r#rp(s


zThread._reset_internal_lockscCsl|jstd��d}|j��r d}|��|jr2d}|jr@|d7}|jdk	rX|d|j7}d|jj	|j
|fS)Nz Thread.__init__() was not called�initialZstartedZstoppedz daemonz %sz<%s(%s, %s)>)r�r�r�rqr�r�r�r�r6rRr�)r0Zstatusr"r"r#r<4s

zThread.__repr__cCs�|jstd��|j��r td��t�|t|<W5QRXzt|jd�Wn,tk
rtt�t|=W5QRX�YnX|j�	�dS)a-Start the thread's activity.

        It must be called at most once per thread object. It arranges for the
        object's run() method to be invoked in a separate thread of control.

        This method will raise a RuntimeError if called more than once on the
        same thread object.

        zthread.__init__() not calledz threads can only be started oncer"N)
r�rEr�rq�_active_limbo_lock�_limbo�_start_new_thread�
_bootstrap�	Exceptionrar/r"r"r#�startBs

zThread.startcCs.z|jr|j|j|j�W5|`|`|`XdS)aXMethod representing the thread's activity.

        You may override this method in a subclass. The standard run() method
        invokes the callable object passed to the object's constructor as the
        target argument, if any, with sequential and keyword arguments taken
        from the args and kwargs arguments, respectively.

        N)r�r�r�r/r"r"r#�run[s	z
Thread.runcCs4z|��Wn"|jr(tdkr(YdS�YnXdSrG)�_bootstrap_innerr�r�r/r"r"r#r�ls
zThread._bootstrapcCst�|_dSrG)rr�r/r"r"r#�
_set_ident�szThread._set_identcCst�|_dSrG)rr�r/r"r"r#�_set_native_id�szThread._set_native_idc	Cs8t�|_|j��|js4t�t�|j�W5QRXdS)z�
        Set a lock object which will be released by the interpreter when
        the underlying thread state (see pystate.h) gets deleted.
        N)�
_set_sentinelr�r?r��_shutdown_locks_lock�_shutdown_locksr�r/r"r"r#r��s

zThread._set_tstate_lockcCs�z�|��|��tr|��|j��t�|t|j	<t
|=W5QRXtrVt�
t�trdt�t�z|��Wn|�|�YnXW5t� ztt�=WnYnXW5QRXXdSrG)r�r3rr�r�r�r�r�rrr�r�r$r�rrrr�r�r/r"r"r#r��s,



zThread._bootstrap_innerc	CsJ|j}|dk	r|��rt�d|_d|_|jsFt�t�|�W5QRXdSr�)r�r2r�r�r�r�r��discardrYr"r"r#�_stop�szThread._stopc	Cst�tt�=W5QRXdS)zARemove current thread from the dict of currently running threads.N)r�r3rr/r"r"r#�_delete�szThread._deletecCsZ|jstd��|j��s td��|t�kr2td��|dkrD|��n|jt|d�d�dS)aWait until the thread terminates.

        This blocks the calling thread until the thread whose join() method is
        called terminates -- either normally or through an unhandled exception
        or until the optional timeout occurs.

        When the timeout argument is present and not None, it should be a
        floating point number specifying a timeout for the operation in seconds
        (or fractions thereof). As join() always returns None, you must call
        is_alive() after join() to decide whether a timeout happened -- if the
        thread is still alive, the join() call timed out.

        When the timeout argument is not present or None, the operation will
        block until the thread terminates.

        A thread can be join()ed many times.

        join() raises a RuntimeError if an attempt is made to join the current
        thread as that would cause a deadlock. It is also an error to join() a
        thread before it has been started and attempts to do so raises the same
        exception.

        �Thread.__init__() not calledz'cannot join thread before it is startedzcannot join current threadNr)rA)r�rEr�rqr
�_wait_for_tstate_lock�maxr�r"r"r#�join�s


zThread.joinTr=cCs:|j}|dkr|js6t�n|�||�r6|��|��dSrG)r�r�r�r?rFr�)r0�blockrArZr"r"r#r��szThread._wait_for_tstate_lockcCs|jstd��|jS)z�A string used for identification purposes only.

        It has no semantics. Multiple threads may be given the same name. The
        initial name is set by the constructor.

        r�)r�r�r�r/r"r"r#r4szThread.namecCs|jstd��t|�|_dS)Nr�)r�r�r�r��r0r4r"r"r#r4scCs|jstd��|jS)a4Thread identifier of this thread or None if it has not been started.

        This is a nonzero integer. See the get_ident() function. Thread
        identifiers may be recycled when a thread exits and another thread is
        created. The identifier is available even after the thread has exited.

        r�)r�r�r�r/r"r"r#�idents	zThread.identcCs|jstd��|jS)z�Native integral thread ID of this thread, or None if it has not been started.

            This is a non-negative integer. See the get_native_id() function.
            This represents the Thread ID as reported by the kernel.

            r�)r�r�r�r/r"r"r#�	native_id$szThread.native_idcCs4|jstd��|js|j��s"dS|�d�|jS)z�Return whether the thread is alive.

        This method returns True just before the run() method starts until just
        after the run() method terminates. The module function enumerate()
        returns a list of all alive threads.

        r�F)r�r�r�r�rqr�r/r"r"r#r�/s

zThread.is_alivecCs ddl}|jdtdd�|��S)zhReturn whether the thread is alive.

        This method is deprecated, use is_alive() instead.
        rNz/isAlive() is deprecated, use is_alive() instead�)�
stacklevel)�warnings�warn�DeprecationWarningr�)r0r�r"r"r#�isAlive=s�zThread.isAlivecCs|jstd��|jS)a�A boolean value indicating whether this thread is a daemon thread.

        This must be set before start() is called, otherwise RuntimeError is
        raised. Its initial value is inherited from the creating thread; the
        main thread is not a daemon thread and therefore all threads created in
        the main thread default to daemon = False.

        The entire Python program exits when only daemon threads are left.

        r�)r�r�r�r/r"r"r#r�Gsz
Thread.daemoncCs*|jstd��|j��r td��||_dS)Nr�z)cannot set daemon status of active thread)r�rEr�rqr��r0Zdaemonicr"r"r#r�Vs

cCs|jSrGr�r/r"r"r#�isDaemon^szThread.isDaemoncCs
||_dSrGr�r�r"r"r#�	setDaemonaszThread.setDaemoncCs|jSrG�r4r/r"r"r#�getNamedszThread.getNamecCs
||_dSrGr�r�r"r"r#�setNamegszThread.setName)NNNr"N)N)Tr=) rRr7r8rSr�r1rpr<r�r�r�r�r�r�r�r�r�r�r�r�r�r4�setterr�r�r�r�r�r�r�r�r�r"r"r"r#r�sR��/	
&









)�_excepthook�_ExceptHookArgs)�print_exception)�
namedtuplez'exc_type exc_value exc_traceback threadcCst|�SrG)r�)r'r"r"r#rwscCs�|jtkrdStdk	r(tjdk	r(tj}n$|jdk	rH|jj}|dkrLdSndS|jdk	r`|jj}nt�}td|�d�|dd�t	|j|j
|j|d�|��dS)z9
        Handle uncaught Thread.run() exception.
        NzException in thread �:T��file�flush)r�)
�exc_type�
SystemExitr�r��threadr�r4r�print�_print_exception�	exc_value�
exc_tracebackr�)r'r�r4r"r"r#rzs(



��csPt�tj��dkrtd���dkr*td��tj�t�t������fdd�}|S)Nzthreading.excepthook is Nonezsys.excepthook is Nonec
s�z�z,t}|dkr�}t��|f��}||�Wn�tk
r�}zbd|_~�dk	rb�jdk	rb�j}n|j}�d|dd��dk	r��jdk	r��j}n�}|���W5d}~XYnXW5d}XdS)NTz"Exception in threading.excepthook:r�)rrr��__suppress_context__r�r�)r�r'�hook�excr�Zsys_excepthook�Zlocal_printZ	local_sysZold_excepthookZold_sys_excepthookZsys_exc_infor"r#�invoke_excepthook�s*� z2_make_invoke_excepthook.<locals>.invoke_excepthook)rr�rE�exc_infor�)r�r"r�r#r��s r�c@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
rz�Call a function after a specified number of seconds:

            t = Timer(30.0, f, args=None, kwargs=None)
            t.start()
            t.cancel()     # stop the timer's action if it's still waiting

    NcCsFt�|�||_||_|dk	r"|ng|_|dk	r4|ni|_t�|_dSrG)rr1�interval�functionr'r(r�finished)r0r�r�r'r(r"r"r#r1�s
zTimer.__init__cCs|j��dS)z)Stop the timer if it hasn't finished yet.N)r�rrr/r"r"r#�cancel�szTimer.cancelcCs6|j�|j�|j��s(|j|j|j�|j��dSrG)r�rar�rqr�r'r(rrr/r"r"r#r��s
z	Timer.run)NN)rRr7r8rSr1r�r�r"r"r"r#r�s
c@seZdZdd�ZdS)�_MainThreadc	CsTtj|ddd�|��|j��|��tr6|��t�|t	|j
<W5QRXdS)NZ
MainThreadF�r4r�)rr1r�r�rrr�r�r�r�r3r�r/r"r"r#r1�s
z_MainThread.__init__N)rRr7r8r1r"r"r"r#r��sr�c@s.eZdZdd�Zdd�Zdd�Zd
dd	�ZdS)�_DummyThreadc	CsPtj|td�dd�|j��|��tr2|��t�|t	|j
<W5QRXdS)NzDummy-%dTr�)rr1r�r�rrr�r�r�r�r3r�r/r"r"r#r1s
z_DummyThread.__init__cCsdSrGr"r/r"r"r#r�
sz_DummyThread._stopcCs|js|j��st�dSr�)r�r�rqr�r/r"r"r#r�sz_DummyThread.is_aliveNcCsdstd��dS)NFzcannot join a dummy thread)r�r�r"r"r#r�sz_DummyThread.join)N)rRr7r8r1r�r�r�r"r"r"r#r�s
r�cCs,ztt�WStk
r&t�YSXdS)z�Return the current Thread object, corresponding to the caller's thread of control.

    If the caller's thread of control was not created through the threading
    module, a dummy thread object with limited functionality is returned.

    N)r3rr5r�r"r"r"r#r
sc
Cs,t�tt�tt�W5QR�SQRXdS)z�Return the number of Thread objects currently alive.

    The returned count is equal to the length of the list returned by
    enumerate().

    N)r�r[r3r�r"r"r"r#r(scCstt���tt���SrG)�listr3�valuesr�r"r"r"r#�
_enumerate4sr�c
Cs4t�&tt���tt���W5QR�SQRXdS)z�Return a list of all Thread objects currently alive.

    The list includes daemonic threads, dummy thread objects created by
    current_thread(), and the main thread. It excludes terminated threads and
    threads that have not yet been started.

    N)r�r�r3r�r�r"r"r"r#r8s)rc	Cs~tjr
dStj}|dk	st�|��s(t�|��t��t�tt	�}t	�
�W5QRX|s^qz|D]}|��|��qbq8dS)zS
    Wait until the Python thread state of all non-daemon threads get deleted.
    N)�_main_threadr�r�r�r2rFr�r�r�r�rsr?)ZtlockZlocksrZr"r"r#�	_shutdownKs	r�cCstS)z�Return the main thread object.

    In normal conditions, the main thread is the thread from which the
    Python interpreter was started.
    )r�r"r"r"r#rss)�_local)rc	Cs�t�ai}ztt�}Wntk
r2t�}YnX|at�at�a	t��tt
��}|�t�|D]>}||kr�|�
d�t�}||_|||<qb|�
d�|��qbt��t��t�|�tt�dks�t�W5QRXdS)zL
    Cleanup threading module state that should not exist after a fork.
    TFr>N)r+r�r3rr5r�r�r�rrr�r��updater�rpr�r�r�rsr[r�)Z
new_activeZcurrentZthreadsr�r�r"r"r#�_after_fork�s0






r��register_at_fork)Zafter_in_child)r�)ZrS�os�_os�sysr��_thread�timerrbZ_weakrefsetr�	itertoolsrrfrr.�_collectionsrrW�ImportError�collections�__all__�start_new_threadr��
allocate_lockr+r�rrr�r]rV�errorrrr%r
rr$rrrr)r&r	rrrrrEr�__next__r�r�r�r3r�r�r�rrr�rr�rr�r�	tracebackr�r�r�r�rr�r�r
Z
currentThreadrZactiveCountr�rrr�r�rr�rZ_threading_localr��hasattrr�r"r"r"r#�<module>s��




q'P&O
�5
(5_compat_pickle.cpython-38.opt-2.pyc000064400000012505150335716500013115 0ustar00U

e5d-"�+@s�dddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*�*Zd+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdL�!ZdMZzeWnek
r�Yn
XedN7ZeD]ZdefedOef<q�dPZeD]ZdQefedRef<q�edSdT�e��D��Z	edUdT�e��D��Z
e�dVdWdddd"d"dXdXdXd(dYdYdZ�
�e	�d[d(d\d]dVd^��e�d/d_d6d`da��e
�dbdcdddedfdgdhdidjdkdldmdndo�
�dpZeD]Zdqe
def<�q�drZ
e
D]Zdse
def<�q�dtS)u�builtins�copyregZqueueZsocketserverZconfigparser�reprlib�tkinter.filedialog�tkinter.simpledialogztkinter.colorchooserztkinter.commondialogztkinter.dialogztkinter.dndztkinter.fontztkinter.messageboxztkinter.scrolledtextztkinter.constantsztkinter.tixztkinter.ttkZtkinterZ_markupbase�winreg�_threadZ
_dummy_threadzdbm.bsdzdbm.dumbzdbm.ndbmzdbm.gnuz
xmlrpc.client�
xmlrpc.serverzhttp.clientz
html.entitieszhtml.parserzhttp.cookieszhttp.cookiejar�http.serverztest.support�
subprocess�urllib.parsezurllib.robotparser�urllib.request�dbmzcollections.abc)*�__builtin__Zcopy_regZQueueZSocketServerZConfigParser�reprZtkFileDialogZtkSimpleDialogZtkColorChooserZtkCommonDialogZDialogZTkdndZtkFontZtkMessageBoxZScrolledTextZTkconstantsZTixZttkZTkinterZ
markupbase�_winreg�threadZdummy_threadZdbhashZdumbdbmr
�gdbmZ	xmlrpclibZSimpleXMLRPCServerZhttplibZhtmlentitydefsZ
HTMLParserZCookieZ	cookielibZBaseHTTPServerztest.test_supportZcommandsZurlparseZrobotparser�urllib2ZanydbmZ_abcoll)r�range)�	functools�reduce)�sys�intern)r�chr)r�str)r�int)r�zip)r�map)r�filter)�	itertools�filterfalse)r�zip_longest)�collections�UserDict)r"�UserList)r"�
UserString)r
�whichdb)�socket�fromfd)zmultiprocessing.connection�
Connection)�multiprocessing.context�Process)zmultiprocessing.popen_fork�Popen)�urllib.error�ContentTooShortError)r�
getproxies)r�pathname2url)r�
quote_plus)r�quote)r�unquote_plus)r�unquote)r�url2pathname)r�
urlcleanup)r�	urlencode)r�urlopen)r�urlretrieve)r-�	HTTPError)r-�URLError)!)rZxrange�rr)rr)rZunichr)rZunicode)rZlong)rZizip)rZimap)rZifilter)rZifilterfalse)rZizip_longest)r#ZIterableUserDict)r$r$)r%r%)r&r&)�_socketr()Z_multiprocessingr))zmultiprocessing.processr+)zmultiprocessing.forkingr,)�urllibr.)r>r/)r>r0)r>r1)r>r2)r>r3)r>r4)r>r5)r>r6)r>r7)r>r8)r>r9)rr:)rr;)/�ArithmeticError�AssertionError�AttributeError�
BaseException�BufferError�BytesWarning�DeprecationWarning�EOFError�EnvironmentError�	Exception�FloatingPointError�
FutureWarning�
GeneratorExit�IOError�ImportError�
ImportWarning�IndentationError�
IndexError�KeyError�KeyboardInterrupt�LookupError�MemoryError�	NameError�NotImplementedError�OSError�
OverflowError�PendingDeprecationWarning�ReferenceError�RuntimeError�RuntimeWarning�
StopIteration�SyntaxError�
SyntaxWarning�SystemError�
SystemExit�TabError�	TypeError�UnboundLocalError�UnicodeDecodeError�UnicodeEncodeError�UnicodeError�UnicodeTranslateError�UnicodeWarning�UserWarning�
ValueError�Warning�ZeroDivisionError)�WindowsError�
exceptions)ZAuthenticationErrorZBufferTooShortZProcessError�TimeoutErrorr*Zmultiprocessingccs|]\}}||fVqdS�N���.0�k�vrrrr�&/usr/lib64/python3.8/_compat_pickle.py�	<genexpr>�srxccs|]\}}||fVqdSrqrrrsrrrrrwrx�s�picklezxml.etree.ElementTreer"�io)
ZcPickleZ_elementtree�
FileDialog�SimpleDialog�DocXMLRPCServer�SimpleHTTPServer�
CGIHTTPServerr#r$r%r&�StringIOZ	cStringIO�bz2rr)Z_bz2Z_dbm�
_functoolsZ_gdbm�_pickle)rrH)r'Z
SocketType))rZ
basestring)roZ
StandardError)r#r#�r'Z
_socketobjectr<)r{r{)r{�LoadFileDialog)r{�SaveFileDialog)r|r|)r}�
ServerHTMLDoc)r}�XMLRPCDocGenerator)r}�DocXMLRPCRequestHandler)r}r})r}�DocCGIXMLRPCRequestHandler)r~�SimpleHTTPRequestHandler)r�CGIHTTPRequestHandlerr�)
)r�r)rr{)rr�)rr�)rr|)rr�)rr�)rr�)rr})rr�)r	r�)r	r�)r=r')�BrokenPipeError�ChildProcessError�ConnectionAbortedError�ConnectionError�ConnectionRefusedError�ConnectionResetError�FileExistsError�FileNotFoundError�InterruptedError�IsADirectoryError�NotADirectoryError�PermissionError�ProcessLookupErrorrp)rorW)�ModuleNotFoundError)rorMN)ZIMPORT_MAPPINGZNAME_MAPPINGZPYTHON2_EXCEPTIONSrnrUZexcnameZMULTIPROCESSING_EXCEPTIONS�dict�itemsZREVERSE_IMPORT_MAPPINGZREVERSE_NAME_MAPPING�updateZPYTHON3_OSERROR_EXCEPTIONSZPYTHON3_IMPORTERROR_EXCEPTIONSrrrrrrrw�<module>	s�2�$3����rlcompleter.cpython-38.opt-2.pyc000064400000006026150335716500012475 0ustar00U

e5d��@s~ddlZddlZddlZdgZGdd�d�Zdd�ZzddlZWnek
rXdZYn"Xe�	e�j
�e�dd��d	ZdS)
�N�	Completerc@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rNcCs6|rt|t�std��|dkr&d|_nd|_||_dS)Nznamespace must be a dictionary�r)�
isinstance�dict�	TypeError�use_main_ns�	namespace)�selfr�r
�#/usr/lib64/python3.8/rlcompleter.py�__init__'szCompleter.__init__cCs�|jrtj|_|��sB|dkr>tr8t�d�t��dSdSndS|dkrld|kr`|�	|�|_
n|�|�|_
z|j
|WStk
r�YdSXdS)Nr�	��.)
r�__main__�__dict__r�strip�_readline_available�readlineZinsert_textZ	redisplay�attr_matches�matches�global_matches�
IndexError)r	�text�stater
r
r�completeBs$
zCompleter.completecCst|�r|d}|S)N�()�callable)r	�val�wordr
r
r�_callable_postfixaszCompleter._callable_postfixc	Cs�ddl}g}dh}t|�}|jD]J}|d|�|kr |�|�|dkrP|d}n|dkr`|d}|�|�q |jtjfD]J}|��D]<\}}|d|�|kr�||kr�|�|�|�|�	||��q�qx|S)Nr�__builtins__>�try�finally�:>�break�None�pass�continue�False�True�else� )
�keyword�len�kwlist�add�appendr�builtinsr�itemsr )	r	rr-r�seen�nrZnspacerr
r
rrfs$



zCompleter.global_matchesc	Cshddl}|�d|�}|sgS|�dd�\}}zt||j�}Wntk
rTgYSXtt|��}|�d�t	|d�r�|�
d�|�t|j
��g}t|�}	|dkr�d}
n|dkr�d	}
nd}
|D]t}|d|	�|kr�|
r�|d|	d�|
ks�d
||f}zt||�}
Wntk
�rYnX|�|
|�}|�|�q�|�s\|
�sF�q\|
dk�rVd	}
q�d}
q�|��|S)Nrz(\w+(\.\w+)*)\.(\w*)r�r!�	__class__r�_�__z%s.%s)�re�match�group�evalr�	Exception�set�dir�discard�hasattrr0�update�get_class_membersr7r.�getattrr r1�sort)r	rr:�m�expr�attrZ
thisobjectZwordsrr5Znoprefixrr;rr
r
rr�sR



��
zCompleter.attr_matches)N)�__name__�
__module__�__qualname__rrr rrr
r
r
rr&s

cCs.t|�}t|d�r*|jD]}|t|�}q|S)N�	__bases__)r@rBrMrD)�klassZret�baser
r
rrD�s


rDFcCs
t�d�S)N)r�
set_completerr
r
r
r�<lambda>��rQT)�atexitr2r�__all__rrDr�ImportErrorrrPr�registerr
r
r
r�<module> s
zipimport.cpython-38.pyc000064400000041575150335716500011252 0ustar00U

e5d-x�@sRdZddlZddlmZmZddlZddlZddlZddl	Z	ddl
Z
ddlZddgZej
Z
ejdd�ZGdd�de�ZiZee
�ZdZd	Zd
ZGdd�d�Ze
dd
d
fe
ddd
fddfZdd�Zdd�Zdd�Zdd�ZdZdadd�Z dd�Z!dd �Z"d!d"�Z#ee#j$�Z%d#d$�Z&d%d&�Z'd'd(�Z(d)d*�Z)d+d,�Z*d-d.�Z+Gd/d0�d0�Z,dS)1aPzipimport provides support for importing Python modules from Zip archives.

This module exports three objects:
- zipimporter: a class; its constructor takes a path to a Zip archive.
- ZipImportError: exception raised by zipimporter objects. It's a
  subclass of ImportError, so it can be caught as ImportError, too.
- _zip_directory_cache: a dict, mapping archive paths to zip directory
  info dicts, as used in zipimporter._files.

It is usually not needed to use the zipimport module explicitly; it is
used by the builtin import mechanism for sys.path items that are paths
to Zip archives.
�N)�_unpack_uint16�_unpack_uint32�ZipImportError�zipimporter�c@seZdZdS)rN)�__name__�
__module__�__qualname__�r
r
�!/usr/lib64/python3.8/zipimport.pyr!s�sPKi��c@sleZdZdZdd�Zddd�Zddd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)ra�zipimporter(archivepath) -> zipimporter object

    Create a new zipimporter instance. 'archivepath' must be a path to
    a zipfile, or to a specific path inside a zipfile. For example, it can be
    '/tmp/myimport.zip', or '/tmp/myimport.zip/mydirectory', if mydirectory is a
    valid directory inside the archive.

    'ZipImportError is raised if 'archivepath' doesn't point to a valid Zip
    archive.

    The 'archive' attribute of zipimporter objects contains the name of the
    zipfile targeted.
    c	Cs$t|t�sddl}|�|�}|s,td|d��tr<|�tt�}g}zt�	|�}WnHt
tfk
r�t�|�\}}||kr�td|d��|}|�
|�Yq@X|jd@dkr�td|d��q�q@zt|}Wn$tk
r�t|�}|t|<YnX||_||_tj|ddd��|_|j�r |jt7_dS)Nrzarchive path is empty��pathznot a Zip filei�i����)�
isinstance�str�os�fsdecoder�alt_path_sep�replace�path_sep�_bootstrap_external�
_path_stat�OSError�
ValueError�_path_split�append�st_mode�_zip_directory_cache�KeyError�_read_directory�_files�archive�
_path_join�prefix)�selfrrr$�st�dirname�basename�filesr
r
r�__init__?s:

zzipimporter.__init__NcCsNt||�}|dk	r|gfSt||�}t||�rFd|j�t�|��gfSdgfS)a�find_loader(fullname, path=None) -> self, str or None.

        Search for a module specified by 'fullname'. 'fullname' must be the
        fully qualified (dotted) module name. It returns the zipimporter
        instance itself if the module was found, a string containing the
        full path name if it's possibly a portion of a namespace package,
        or None otherwise. The optional 'path' argument is ignored -- it's
        there for compatibility with the importer protocol.
        N)�_get_module_info�_get_module_path�_is_dirr"r)r%�fullnamer�mi�modpathr
r
r�find_loaderms



zzipimporter.find_loadercCs|�||�dS)a�find_module(fullname, path=None) -> self or None.

        Search for a module specified by 'fullname'. 'fullname' must be the
        fully qualified (dotted) module name. It returns the zipimporter
        instance itself if the module was found, or None if it wasn't.
        The optional 'path' argument is ignored -- it's there for compatibility
        with the importer protocol.
        r)r1)r%r.rr
r
r�find_module�s	zzipimporter.find_modulecCst||�\}}}|S)z�get_code(fullname) -> code object.

        Return the code object for the specified module. Raise ZipImportError
        if the module couldn't be found.
        ��_get_module_code�r%r.�code�	ispackager0r
r
r�get_code�szzipimporter.get_codecCsvtr|�tt�}|}|�|jt�r:|t|jt�d�}z|j|}Wn tk
rhtdd|��YnXt	|j|�S)z�get_data(pathname) -> string with file data.

        Return the data associated with 'pathname'. Raise OSError if
        the file wasn't found.
        Nr�)
rrr�
startswithr"�lenr!rr�	_get_data)r%�pathname�key�	toc_entryr
r
r�get_data�szzipimporter.get_datacCst||�\}}}|S)zjget_filename(fullname) -> filename string.

        Return the filename for the specified module.
        r3r5r
r
r�get_filename�szzipimporter.get_filenamecCs�t||�}|dkr$td|��|d��t||�}|r@t�|d�}n
|�d�}z|j|}Wntk
rnYdSXt|j|��	�S)z�get_source(fullname) -> source string.

        Return the source code for the specified module. Raise ZipImportError
        if the module couldn't be found, return None if the archive does
        contain the module, but has no source for it.
        N�can't find module ��name�__init__.py�.py)
r+rr,rr#r!rr<r"�decode)r%r.r/r�fullpathr?r
r
r�
get_source�s


zzipimporter.get_sourcecCs(t||�}|dkr$td|��|d��|S)z�is_package(fullname) -> bool.

        Return True if the module specified by fullname is a package.
        Raise ZipImportError if the module couldn't be found.
        NrBrC)r+r)r%r.r/r
r
r�
is_package�s
zzipimporter.is_packagecCs�t||�\}}}tj�|�}|dks.t|t�s@t|�}|tj|<||_zT|rlt||�}t�	|j
|�}|g|_t|d�s|t
|_
t�|j||�t||j�Wntj|=�YnXztj|}Wn$tk
r�td|�d���YnXt�d||�|S)z�load_module(fullname) -> module.

        Load the module specified by 'fullname'. 'fullname' must be the
        fully qualified (dotted) module name. It returns the imported
        module, or raises ZipImportError if it wasn't found.
        N�__builtins__zLoaded module z not found in sys.moduleszimport {} # loaded from Zip {})r4�sys�modules�getr�_module_type�
__loader__r,rr#r"�__path__�hasattrrK�_fix_up_module�__dict__�execr�ImportError�
_bootstrap�_verbose_message)r%r.r6r7r0�modrrHr
r
r�load_module�s0


zzipimporter.load_modulecCsXz|�|�sWdSWntk
r*YdSXtjsNddlm}|�t�dt_t||�S)z�Return the ResourceReader for a package in a zip file.

        If 'fullname' is a package within the zip file, return the
        'ResourceReader' object for the package.  Otherwise return None.
        Nr)�ResourceReaderT)rJr�_ZipImportResourceReader�_registered�
importlib.abcr[�register)r%r.r[r
r
r�get_resource_readers


zzipimporter.get_resource_readercCsd|j�t�|j�d�S)Nz<zipimporter object "z">)r"rr$)r%r
r
r�__repr__"szzipimporter.__repr__)N)N)rrr	�__doc__r*r1r2r8r@rArIrJrZr`rar
r
r
rr-s.
 


&z__init__.pycTrEF)z.pycTF)rFFFcCs|j|�d�dS)N�.�)r$�
rpartition)r%r.r
r
rr,4sr,cCs|t}||jkS�N)rr!)r%r�dirpathr
r
rr-8sr-cCs8t||�}tD]$\}}}||}||jkr|SqdSrf)r,�_zip_searchorderr!)r%r.r�suffix�
isbytecoder7rHr
r
rr+As


r+c	Cs�zt�|�}Wn&tk
r4td|��|d��YnX|���z$|�td�|��}|�t�}Wn&tk
r�td|��|d��YnXt|�tkr�td|��|d��|dd�t	k�r�z|�dd�|��}Wn&tk
r�td|��|d��YnXt
|ttd�}z|�|�|��}Wn(tk
�rJtd|��|d��YnX|�t	�}|dk�rrtd|��|d��|||t�}t|�tk�r�td|��|d��|t|�|}t
|d	d
��}t
|d
d��}	||k�r�td|��|d��||	k�r
td
|��|d��||8}||	}
|
dk�r6td|��|d��i}d}z|�|�Wn(tk
�rttd|��|d��YnX|�d�}t|�dk�r�td��|dd�dk�r��q�t|�dk�r�td��t|dd��}
t|dd	��}t|d	d��}t|dd
��}t
|d
d��}t
|dd��}t
|dd��}t|dd��}t|dd��}t|dd��}t
|dd��}|||}||	k�r�td|��|d��||
7}z|�|�}Wn(tk
�r�td|��|d��YnXt|�|k�r�td|��|d��z2t|�||��||k�r*td|��|d��Wn(tk
�rTtd|��|d��YnX|
d@�rj|��}n6z|�d�}Wn&tk
�r�|�d��t�}YnX|�dt�}t�||�}||||||||f}|||<|d 7}�qvW5QRXt�d!||�|S)"Nzcan't open Zip file: r
rd�can't read Zip file: �rznot a Zip file: zcorrupt Zip file: ���zbad central directory size: zbad central directory offset: z&bad central directory size or offset: �.�EOF read where not expectedsPK��
����� �"�*zbad local header offset: i�ascii�latin1�/rz!zipimport: found {} names in {!r})�_io�	open_coderr�seek�END_CENTRAL_DIR_SIZE�tell�readr;�STRING_END_ARCHIVE�max�MAX_COMMENT_LEN�rfindr�EOFErrorrrG�UnicodeDecodeError�	translate�cp437_tablerrrr#rWrX)r"�fp�header_position�buffer�	file_size�max_comment_start�data�pos�header_size�
header_offset�
arc_offsetr)�count�flags�compress�time�date�crc�	data_size�	name_size�
extra_size�comment_size�file_offsetrDr�tr
r
rr `s�
���

�


�
�






r u�	

 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ cCsltrt�d�td��daz<zddlm}Wn&tk
rRt�d�td��YnXW5daXt�d�|S)Nzzipimport: zlib UNAVAILABLE�)can't decompress data; zlib not availableTFr��
decompresszzipimport: zlib available)�_importing_zlibrWrXr�zlibr��	Exceptionr�r
r
r�_get_decompress_func�s


r�c	Cs�|\}}}}}}}}	|dkr$td��t�|���}
z|
�|�Wn&tk
rftd|��|d��YnX|
�d�}t|�dkr�td��|dd�dkr�td	|��|d��t|d
d��}t|dd��}
d||
}||7}z|
�|�Wn(tk
�rtd|��|d��YnX|
�|�}t|�|k�r4td��W5QRX|dk�rL|Sz
t	�}Wnt
k
�rttd
��YnX||d�S)Nrznegative data sizerkr
rwrqrlsPKzbad local file header: �rvzzipimport: can't read datar�i�)rr~rr�rr�r;r�rr�r�)r"r?�datapathr�r�r�r�r�r�r�r�r�r�r�r��raw_datar�r
r
rr<s>



r<cCst||�dkS)Nr)�abs)�t1�t2r
r
r�	_eq_mtimeAsr�cCs<||d�}zt�|||�}Wntk
r2YdSX|d@dk}|r�|d@dk}tjdkr�|shtjdkr�t||�}	|	dk	r�t�tj|	�}
zt�||
||�Wntk
r�YdSXnTt	||�\}}|�r
t
t|dd��|�r�t|dd	��|k�r
t�
d
|���dSt�|d	d��}
t|
t��s8td|�d���|
S)
N)rDrrrrd�never�alwaysrrrmrnzbytecode is stale for zcompiled module z is not a code object)r�
_classify_pycrV�_imp�check_hash_based_pycs�_get_pyc_source�source_hash�_RAW_MAGIC_NUMBER�_validate_hash_pyc�_get_mtime_and_size_of_sourcer�rrWrX�marshal�loadsr�
_code_type�	TypeError)r%r=rHr.r��exc_detailsr��
hash_based�check_source�source_bytesr��source_mtime�source_sizer6r
r
r�_unmarshal_codeKsX�
��
��
���r�cCs|�dd�}|�dd�}|S)Ns
�
�
)r)�sourcer
r
r�_normalize_line_endings~sr�cCst|�}t||ddd�S)NrUT)�dont_inherit)r��compile)r=r�r
r
r�_compile_source�sr�cCsDt�|d?d|d?d@|d@|d?|d?d@|d@dd	d	d	f	�S)
N�	i������?rdr)r��mktime)�dr�r
r
r�_parse_dostime�s



�r�c
CstzR|dd�dkst�|dd�}|j|}|d}|d}|d}t||�|fWStttfk
rnYdSXdS)Nr��c�or���)rr)�AssertionErrorr!r�r�
IndexErrorr�)r%rr?r�r��uncompressed_sizer
r
rr��s
r�cCsV|dd�dkst�|dd�}z|j|}Wntk
rDYdSXt|j|�SdS)Nrr�)r�r!rr<r")r%rr?r
r
rr��sr�c	Cs�t||�}tD]�\}}}||}tjd|jt|dd�z|j|}Wntk
rXYqX|d}t|j|�}	|r�t	|||||	�}
n
t
||	�}
|
dkr�q|d}|
||fSqtd|��|d��dS)Nz
trying {}{}{}rd)�	verbosityrrBrC)r,rhrWrXr"rr!rr<r�r�r)r%r.rrirjr7rHr?r0r�r6r
r
rr4�s$

r4c@s<eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
S)r\z�Private class used to support ZipImport.get_resource_reader().

    This class is allowed to reference all the innards and private parts of
    the zipimporter.
    FcCs||_||_dSrf)rr.)r%rr.r
r
rr*�sz!_ZipImportResourceReader.__init__cCs\|j�dd�}|�d|��}ddlm}z||j�|��WStk
rVt|��YnXdS)Nrcr}r)�BytesIO)r.r�ior�rr@r�FileNotFoundError)r%�resource�fullname_as_pathrr�r
r
r�
open_resource�sz&_ZipImportResourceReader.open_resourcecCst�dSrf)r�)r%r�r
r
r�
resource_path�sz&_ZipImportResourceReader.resource_pathcCsH|j�dd�}|�d|��}z|j�|�Wntk
rBYdSXdS)Nrcr}FT)r.rrr@r)r%rDr�rr
r
r�is_resource�sz$_ZipImportResourceReader.is_resourcec		cs�ddlm}||j�|j��}|�|jj�}|jdks:t�|j	}t
�}|jjD]f}z||��|�}Wntk
r|YqNYnX|j	j}t
|�dkr�|jVqN||krN|�|�|VqNdS)Nr)�PathrE)�pathlibr�rrAr.�relative_tor"rDr��parent�setr!rr;�add)	r%r��
fullname_path�
relative_path�package_path�subdirs_seen�filename�relative�parent_namer
r
r�contents�s"


z!_ZipImportResourceReader.contentsN)
rrr	rbr]r*r�r�r�r�r
r
r
rr\�s	r\)-rb�_frozen_importlib_externalrrr�_frozen_importlibrWr�r~r�rLr��__all__r�path_separatorsrrVrr�typerOr�r�r�rrhr,r-r+r r�r�r�r<r�r��__code__r�r�r�r�r�r�r4r\r
r
r
r�<module>sX�		~�.
.

sre_compile.cpython-38.pyc000064400000035450150335716500011511 0ustar00U

e5dGh�@s$dZddlZddlZddlTejeks.td��eehZe	e
ehZe
ehZeehZeeehBZdZdd�eD�Zejfdd	�Zd
d�Zdd
�Zd-dd�ZejdZde>dZdZ ee!fdd�Z"dd�Z#dd�Z$dd�Z%dd�Z&dd�Z'dd �Z(d!d"�Z)d#d$�Z*d%d&�Z+d'd(�Z,d)d*�Z-d.d+d,�Z.dS)/zInternal support module for sre�N)�*zSRE module mismatch))�ii1)�si)�i�)iEi�i�)i�i�)i�i�)i�i�)i�i�)i�i�)i�i�)i�i�)i�i�)i�i�)i�i�)iai�)i�i�cs.i|]&}|D]��t�fdd�|D���qqS)c3s|]}�|kr|VqdS�N�)�.0�j��ir�#/usr/lib64/python3.8/sre_compile.py�	<genexpr>>sz<dictcomp>.<genexpr>)�tuple)r�trr
r�
<dictcomp>>s
�rcCs ||@r||M}||B|@Srr)�flags�	add_flags�	del_flags�
TYPE_FLAGSrrr�_combine_flagsAs
rcCs�|j}t}t}t}t}t}d}	d}
d}|t@r\|t@s\|t@rPt	j
}	t	j}
t}nt	j
}	t	j}
|D�]|\}}
||k�rr|t@s�||�||
�n�|t@r�|t|�||
�n�|	|
�s�||�||
�n�|
|
�}|s�|t|�||�n�||k�r|t|�||�nh|t�||�}|d�|tk�r2|t�|f||D]}|t�||��q@|t�||�|||<q`|tk�rt|
|	|
|�\}}|t@�r�|t@�r�|t�n(|�s�|t�n|�s�|t�n|t�||�}|d�t|||�||�|||<q`|tk�r*|t@�r |t�n|t�q`||k�r6|t@�rLt d|f��t!|
d��r�|t"k�rn|t#�n|t$�||�}|d�||
d�||
d�t%||
d|�|t&�||�|||<nl|t'�||�}|d�||
d�||
d�t%||
d|�||�|||<|t"k�r,|t(�n|t)�q`|t*k�r�|
\}}}}|�rj|t+�||dd�t%||t,|||��|�r�|t+�||ddd�q`||k�r�||�q`||k�rD||�||�}|d�|
ddk�r�|d�n*|
d�-�\}}||k�rt d��||�t%||
d|�|t&�||�|||<q`|t.k�r�||�||�}|d�t%||
|�|t&�||�|||<q`|t/k�r�||�|t0@�r�t1�2|
|
�}
|t@�r�t3�2|
|
�}
n|t@�r�t4�2|
|
�}
||
�q`|t5k�r�||�g}|j}|
dD]N}
||�}|d�t%||
|�|t6�|||��|d�||�|||<�q|t�|D]}||�|||<�qlq`|t7k�r�||�|t@�r�t8|
}
n|t@�r�t9|
}
||
�q`|t:k�r |t@�s�||�n,|t@�r�|t;�n|�s
|t<�n|t=�||
d�q`|t>k�r�||�||
dd�||�}|d�t%||
d|�|
d�r�|t6�||�}|d�||�|d||<t%||
d|�||�|||<n||�|d||<q`t d|f��q`dS)Nrz*internal: unsupported template operator %r��z(look-behind requires fixed-width patternz%internal: unsupported operand type %r)?�append�len�_LITERAL_CODES�_REPEATING_CODES�_SUCCESS_CODES�
_ASSERT_CODES�SRE_FLAG_IGNORECASE�SRE_FLAG_LOCALE�SRE_FLAG_UNICODE�_sre�unicode_iscased�unicode_tolower�_ignorecase_fixes�
ascii_iscased�
ascii_tolower�OP_LOCALE_IGNORE�	OP_IGNORE�OP_UNICODE_IGNORE�
IN_UNI_IGNORE�NOT_LITERAL�NEGATE�LITERAL�FAILURE�IN�_optimize_charset�
IN_LOC_IGNORE�	IN_IGNORE�_compile_charset�ANY�SRE_FLAG_DOTALL�ANY_ALL�SRE_FLAG_TEMPLATE�error�_simple�
MAX_REPEAT�
REPEAT_ONE�MIN_REPEAT_ONE�_compile�SUCCESS�REPEAT�	MAX_UNTIL�	MIN_UNTIL�
SUBPATTERN�MARKr�getwidth�CALL�AT�SRE_FLAG_MULTILINE�AT_MULTILINE�get�	AT_LOCALE�
AT_UNICODE�BRANCH�JUMP�CATEGORY�	CH_LOCALE�
CH_UNICODE�GROUPREF�GROUPREF_LOC_IGNORE�GROUPREF_IGNORE�GROUPREF_UNI_IGNORE�GROUPREF_EXISTS)�code�patternr�emit�_len�
LITERAL_CODES�REPEATING_CODES�
SUCCESS_CODES�ASSERT_CODES�iscased�tolower�fixes�op�av�lo�skip�k�charset�hascased�grouprr�p�hi�tail�
tailappend�skipyes�skipnorrrr=GsV
















































r=cCs�|j}|D]�\}}||�|tkr$q
|tkr6||�q
|tksF|tkr`||d�||d�q
|tkrt|�|�q
|tkr�|�|�q
|tkr�|t	@r�|t
|�q�|t@r�|t|�q�||�q
t
d|f��q
|t�dS)Nrrz%internal: unsupported set operator %r)rr,r-�RANGE�RANGE_UNI_IGNORE�CHARSET�extend�
BIGCHARSETrNrrOr rPr8r.)rfrrVrXrarbrrrr3�s,

r3c	Cs�g}g}td�}d}|D�]�\}}	�z,|tkr�|rv||	�}
d||
<|rd|
|krd||
D]}d||<qV|s~||	�r~d}nd||	<n�|tk�r&t|	d|	dd�}|�r|r�t||�D]*}
d||
<|
|kr�||
D]}d||<q�q�nt||�D]}
d||
<q�|�s$tt||��}n|D]}
d||
<�qn(|tk�r@|�||	f�n|�||	f�WnZtk
�r�t	|�dk�r�|dd7}Yq"|�r�d}|tk�r�t
}|�||	f�YnXqq"qg}d}|�d|�}|dk�rԐq(t	|�dk�r�d}�q(|�d|�}|dk�r|�|t	|�f��q(|�||f��q�|dk	�r�|D]>\}}||dk�r\|�t|f�n|�t||dff��q6||7}|�s�t	|�t	|�k�r�||fS||fSt	|�dk�r�t|�}|�t
|f�||7}||fSt|�}i}td�}d}t�}tdd	d�D]V}
||
|
d�}||k�r4||||
d<n$|||
d<||<|d7}||7}�qt|�}|gt|�|dd�<|�t|f�||7}||fS)
N�FrTr�i�ri)�	bytearrayr-ro�range�map�anyr,r�
IndexErrorrrp�find�
_mk_bitmaprq�bytes�_bytes_to_codesrs)rfr^�fixupr`�outrk�charmaprgrarbrcre�rr�runs�qri�data�comps�mapping�block�chunkrrrr0s�









r0�rs0111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111cs8|�t�ddd�����fdd�tt��d��D�S)N���cs"g|]}��|�|�d��qS)rr)rr��	_CODEBITS�_int�srr�
<listcomp>�s�z_mk_bitmap.<locals>.<listcomp>r)�	translate�_BITS_TRANSrwr)�bitsr�r�rr�rr|�s�r|cCs@t|��d�}|jtjkst�t|�|jt|�ks8t�|��S)N�I)�
memoryview�cast�itemsizer!�CODESIZE�AssertionErrorr�tolist)�b�arrrr~�sr~cCsDt|�dkrdS|d\}}|tkr<|ddko:t|d�S|tkS)NrFrr�)rrBr9�_UNIT_CODES)rirarbrrrr9�sr9cCsndgt|�}tdt|��D]L}||d}||||kr\|dkrNd||<q||d}q,|d||<q|S)aj
    Generate an overlap table for the following prefix.
    An overlap table is a table of the same size as the prefix which
    informs about the potential self-overlap for each index in the prefix:
    - if overlap[i] == 0, prefix[i:] can't overlap prefix[0:...]
    - if overlap[i] == k with 0 < k <= i, prefix[i-k+1:i+1] overlaps with
      prefix[0:k]
    rr)rrw)�prefix�tabler�idxrrr�_generate_overlap_table�s	r�cCs$|t@sdS|t@rtjStjSdSr)rr r!r"r%)rrrr�_get_iscased�s
r�cCs�g}|j}d}t|�}|jD]�\}}|tkrF|r<||�r<q�||�q|tkr�|\}}	}
}t||	|
�}|t@rz|t@rzq�t||�\}
}}|dkr�|dk	r�t	|�}n|dk	r�t	|�|}|�
|
�|s�q�qq�q||dfS||dfS)NTF)rr�r�r-rBrrr�_get_literal_prefixrrr)rWrr��prefixappend�prefix_skipr^rarbrhrrri�flags1�prefix1�prefix_skip1�got_allrrrr��s4



r�cCsd|js
dS|jd\}}|tk	r"qP|\}}}}t|||�}|t@r|t@rdSqt|�}|tkrz|rp||�rpdS||fgS|tkr�g}|j}	|dD]B}
|
s�dS|
d\}}|tkr�|r�||�s�|	||f�q�dSq�|S|t	k�r`|}|�r\|D]f\}}|tk�r||��rZdSq�|t
kr�|ddk�r4dStt|t
|d|dd���r�dSq�|SdS)Nrri��)r�rBrrrr�r-rLrr/roryrxrw)rWrrarbrhrrr^rf�
charsetappendrirrr�_get_charset_prefix�sN



 r�c
Cs||��\}}|tkrt}|dkr8|�tdd||g�dSg}d}g}|t@rT|t@srt||�\}}}|srt||�}|j}	|	t�t	|�}
|	d�d}|r�t
}|dkr�|r�|tB}n|r�|tB}|	|�|tkr�|	|�n|	t�|dt�}|	t
|t��|�r@|	t	|��|dk�rt	|�}|	|�|�|�|�t|��n(|�rht|�\}}|�r\t�t|||�t	|�|
||
<dS)Nr�)rD�MAXCODErr�INFOrrr�r�rr�SRE_INFO_PREFIX�SRE_INFO_LITERAL�SRE_INFO_CHARSET�minr�r0r�r3)
rVrWrrcrjr�r�rfr�rXrd�maskrgrrr�
_compile_infosT





r�cCst|ttf�Sr)�
isinstance�strr})�objrrr�isstringSsr�cCs8|jj|B}g}t|||�t||j|�|�t�|Sr)�staterr�r=r�rr>)rirrVrrr�_codeVs
r�cCsdd�dd�|D��S)N�[%s]�, css$|]}dtjdd|fVqdS)z%#0*xrN)r!r��r�xrrrr
fsz_hex_code.<locals>.<genexpr>)�join�rVrrr�	_hex_codeesr�csNddl�t��d�ttt��d���������fdd���dt���dS)Nrrc	s�dd�����fdd�
}��fdd�}�d7��}||k�r�|��|}|d7}t|}|tttttttfkrx||�q2|tt	t
ttt
ttfkr��|}|d7}||d|t|�f�q2|tk�r�|}|d7}tt|�}|dd�d	ks�t�|||dd��q2|tk�rV�|}|d7}tt|�}|dd
�dk�sBt�|||d
d��q2|ttttfk�r��|}|||||d��|d||�||7}q2|ttfk�r�||d�\}}	|d7}||d
||	t|�t|	�f�q2|tk�r||t�||dt���|dt7}q2|t k�rʈ|}|d7}t!d�"�fdd��||dt#j$�D���}
||||
�|dt#j$7}�d7�t%|�D].}|t�||dt���|dt7}�q��d8�q2|t&t't(t)t*fk�r��|}|d7}|||�q2|t+k�r(�|}|||||d�|d7}q2|t,k�r��|}|||||d�|�r��|d||�||7}|��|}|�r�|d|||d�n|t��qL|d7}q2|t-t.t/fk�r�||d�\}}}
|
t0k�r�d}
|||||
||d��|d||�||7}q2|t1k�rJ�||d�\}}||||||d�|d7}q2|t2t3fk�r��||d�\}}||||||d��|d||�||7}q2|t4k�rĈ||d�\}}}}
|
t0k�r�d}
|||t5|�||
||d�|d�|t6@�r��|d|d�\}}|d|�|d����|�}|ddd�"dd�|D��dd�"t7t|����|7�|d���|���|7�|t8@�r��d7�|d���||��d8�||7}q2t9|��q2�d8�dS)N)�tocsX|dk	r"��|�|d|ff7}td����kr6dndfd�dd�t|�dS)Nz(to %d)z%*d%s �:�.z  r��end)�add�print)r��args)�labels�level�offset_width�startrr�print_ps

�z!dis.<locals>.dis_.<locals>.print_cs"td�d�d�t|�dS)N� rr�)r�)r�)r�r�rr�print_2xsz"dis.<locals>.dis_.<locals>.print_2rz
%#02x (%r)�ZAT_�	Z	CATEGORY_rz%#02x %#02x (%r-%r)rt�c3s|]}|�tj�j�VqdSr)�to_bytesr!r��	byteorderr�)�sysrrr
�s�z$dis.<locals>.dis_.<locals>.<genexpr>�branch�	MAXREPEATr��z
  prefix_skipz  prefixr�r�css|]}d|VqdS)z%#02xNrr�rrrr
�sz(%r)�z	  overlap�in):�OPCODESr>r.r4r6r@rAr,r-r+�LITERAL_IGNORE�NOT_LITERAL_IGNORE�LITERAL_UNI_IGNORE�NOT_LITERAL_UNI_IGNORE�LITERAL_LOC_IGNORE�NOT_LITERAL_LOC_IGNORE�chrrFr��ATCODESr�rN�CHCODESr/r2r*r1rorprqr�r�rs�listr�r!r�rwrCrQrSrTrRrMrLr?r;r<r�rU�ASSERT�
ASSERT_NOTr��binr�rxr��
ValueError)r�r�r�r�rra�argrdrcrjr�r	r��maxr�
prefix_lenr�r��rV�dis_r�r�r�r�)r�rr�os�

�
�


 

�


�












�


zdis.<locals>.dis_)r��setrr�r�rr�r�dishsr�c	Cs�t|�r|}t�||�}nd}t||�}|t@r>t�t|�|jj}dg|jj	}|�
�D]\}}|||<q\t�|||jj
B||jj	d|t|��S)Nr)r��	sre_parse�parser��SRE_FLAG_DEBUGr�r�r��	groupdict�groups�itemsr!�compilerr)rirrWrV�
groupindex�
indexgrouprerrrrr��s(



�r�)NNN)r)/�__doc__r!r��
sre_constants�MAGICr�r-r+rr?�
MIN_REPEATr:rr>r.rr�r�rr4r/r��
_equivalencesr$rrr=r3r0r�r�r�r��intr|r~r9r�r�r�r�r�r�r�r�r�r�rrrr�<module>sJ
$��
3

	,;site.cpython-38.opt-2.pyc000064400000026047150335716500011116 0ustar00U

&�.eNU�@s"ddlZddlZddlZddlZddlZejejgadada	da
dd�Zdd�Zdd�Z
dd	�Zd
d�Zd1dd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd2dd�Zd3dd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Z ej!j"�se �d.d/�Z#e$d0k�re#�dS)4�NcGsBtjj|�}ztj�|�}Wntk
r0YnX|tj�|�fS�N)�os�path�join�abspath�OSError�normcase)�paths�dir�r�/usr/lib64/python3.8/site.py�makepath[sr
cCs�ttj���D]~}tt|dd�dd�dkr,qztj�|j�|_Wnt	t
tfk
rZYnXztj�|j�|_Wqt	t
tfk
r�YqXqdS)N�
__loader__�
__module__)�_frozen_importlib�_frozen_importlib_external)
�set�sys�modules�values�getattrrrr�__file__�AttributeErrorr�	TypeError�
__cached__)�mrrr�	abs_pathsds�rcCsPg}t�}tjD],}t|�\}}||kr|�|�|�|�q|tjdd�<|Sr)rrrr
�append�add)�L�known_pathsr
�dircaserrr�removeduppathsts

r"c	CsVt�}tjD]D}z&tj�|�r4t|�\}}|�|�Wqtk
rNYqYqXq|Sr)rrrr�existsr
rr)�d�item�_�itemcaserrr�_init_pathinfo�s
r(cCsr|dkrt�}d}nd}tj�||�}zt�t�|��}Wntk
rPYdSX|��t|�D]�\}}|�	d�rvqbzZ|�	d�r�t
|�Wqb|��}t||�\}}	|	|kr�tj�
|�r�tj�|�|�|	�Wqbtk
�rVtd�|d|�tjd�ddl}
|
jt���D](}|��D]}td	|tjd��q�qtd
tjd�Y�qZYqbXqbW5QRX|�rnd}|S)NTF�#)zimport zimport	z"Error processing line {:d} of {}:
�)�filerz  z
Remainder of file ignored)r(rrr�io�
TextIOWrapper�	open_coder�	enumerate�
startswith�exec�rstripr
r#rrr�	Exception�print�format�stderr�	traceback�format_exception�exc_info�
splitlines)�sitedir�namer �reset�fullname�f�n�liner
r!r7�recordrrr�
addpackage�sF

�rCcCs�|dkrt�}d}nd}t|�\}}||krBtj�|�|�|�zt�|�}Wntk
rfYdSXdd�|D�}t	|�D]}t
|||�q~|r�d}|S)NTFcSsg|]}|�d�r|�qS)z.pth)�endswith)�.0r<rrr�
<listcomp>�s
zaddsitedir.<locals>.<listcomp>)r(r
rrrrr�listdirr�sortedrC)r;r r=�sitedircase�namesr<rrr�
addsitedir�s$
rKcCs`tjjrdSttd�r4ttd�r4t��t��kr4dSttd�r\ttd�r\t��t��kr\dSdS)NF�getuid�geteuid�getgid�getegidT)	r�flags�no_user_site�hasattrrrMrLrOrNrrrr�check_enableusersite�s
rScCsztj�dd�}|r|Sdd�}tjdkrBtj�d�p6d}||d�Stjdkrptjrp|dd	tjd
tjdd��S|dd�S)
N�PYTHONUSERBASEcWstj�tjj|��Sr)rr�
expanduserr)�argsrrr�joinuser�sz_getuserbase.<locals>.joinuser�nt�APPDATA�~�Python�darwin�Libraryz%d.%d�z.local)r�environ�getr<r�platform�
_framework�version_info)�env_baserW�baserrr�_getuserbase�s


�rfcCsdtj}tjdkr,|�d|d�|d�d�StjdkrFtjrF|�d�S|�d|d�d	|d�d
�S)NrXz\Pythonrr*z\site-packagesr\z/lib/python/site-packagesz/lib/python�.z/site-packages)rrcrr<rarb)�userbase�versionrrr�	_get_path
s

rjcCstdkrt�atSr)�	USER_BASErfrrrr�getuserbasesrlcCst�}tdkrt|�atSr)rl�	USER_SITErj)rhrrr�getusersitepackages#srncCs$t�}tr tj�|�r t||�|Sr)rn�ENABLE_USER_SITErr�isdirrK)r �	user_siterrr�addusersitepackages1s
rrcCs�g}t�}|dkrt}|D]�}|r||kr,q|�|�tjdkr�|�tj�|ddtj	dd�d��|�tj�|ddtj
dd�d��q|�|�|�tj�|dd��|�tj�|dd��q|S)	N�/�lib64�python�z
site-packages�libzpython%d.%dr^)r�PREFIXESrr�seprrrrrirc)�prefixes�sitepackages�seen�prefixrrr�getsitepackages?s*

��
r~cCsBtrdtjkrt�dd�t|�D]}tj�|�r"t||�q"|S)N�RPM_BUILD_ROOTrz
/usr/local)	rorr_rx�insertr~rrprK)r rzr;rrr�addsitepackages^sr�cCs4tjdkrd}nd}t�d|�t_t�d|�t_dS)N�\zCtrl-Z plus ReturnzCtrl-D (i.e. EOF)�quit�exit)rry�
_sitebuiltins�Quitter�builtinsr�r�)�eofrrr�setquitms

r�cCs�t�dtj�t_tjdd�dkr2t�dd�t_nt�dd�t_gg}}ttd�r�tj	�
tj�}|�dd	g�|�tj	�
|tj�|tjg�t�d
d||�t_dS)N�	copyright��java�creditsz?Jython is maintained by the Jython developers (www.jython.org).z�    Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
    for supporting Python development.  See www.python.org for more information.rzLICENSE.txt�LICENSE�licensez'See https://www.python.org/psf/license/)r��_Printerrr�r�rar�rRrr�dirnamer�extendr�pardir�curdirr�)�files�dirs�hererrr�setcopyright}s$�

�r�cCst��t_dSr)r��_Helperr��helprrrr�	sethelper�sr�cCsdd�}|t_dS)Ncs�ddl}zddl�ddl}Wntk
r2YdSXt�dd�}|dk	r\d|kr\��d�n
��d�z���Wntk
r�YnX���dkr�t	j
�t	j
�d�d��z��
��Wntk
r�YnX��fd	d
�}|�|�dS)Nr�__doc__��libeditzbind ^I rl_completez
tab: completerZz.python_historycs(z����Wntk
r"YnXdSr)�write_history_filerr��history�readlinerr�
write_history�szCenablerlcompleter.<locals>.register_readline.<locals>.write_history)�atexitr��rlcompleter�ImportErrorr�parse_and_bind�read_init_filer�get_current_history_lengthrrrrU�read_history_file�register)r�r��readline_docr�rr�r�register_readline�s0
�z,enablerlcompleter.<locals>.register_readline)r�__interactivehook__)r�rrr�enablerlcompleter�s	0r�c	CsHtj}tjdkr*d|kr*tjd}t_ntj}tj�tj�|��\}}tj�	|�}dt_
d}dd�tj�||�tj�||�fD�}|�rD|d}d}	t|dd	��\}
|
D]P}d
|kr�|�
d
�\}}}
|����}|
��}
|dkr�|
��}	q�|dkr�|
t_
q�W5QRX|t_t_t|tjg�|	dk�r8t�dtj�ntjgad
a|S)Nr\�__PYVENV_LAUNCHER__z
pyvenv.cfgcSsg|]}tj�|�r|�qSr)rr�isfile)rE�conffilerrrrF�s�zvenv.<locals>.<listcomp>r�truezutf-8)�encoding�=zinclude-system-site-packages�homeF)rr_rra�_base_executable�
executabler�splitrr��_homer�open�	partition�strip�lowerr}�exec_prefixr�rxr�ro)r �envr��exe_dirr&�site_prefix�
conf_basename�candidate_confs�virtual_conf�system_siter?rA�key�valuerrr�venv�sB��

r�c
Cs�zBzddl}Wn0tk
r>}z|jdkr,n�W5d}~XYnXWnRtk
r�}z4tjjrltjt���ntj	�
d|jj|f�W5d}~XYnXdS)Nr�
sitecustomizez@Error in sitecustomize; set PYTHONVERBOSE for traceback:
%s: %s
)
r�r�r<r3rrP�verbose�
excepthookr9r6�write�	__class__�__name__)r��exc�errrrr�execsitecustomizes

��r�c
Cs�zBzddl}Wn0tk
r>}z|jdkr,n�W5d}~XYnXWnRtk
r�}z4tjjrltjt���ntj	�
d|jj|f�W5d}~XYnXdS)Nr�
usercustomizez@Error in usercustomize; set PYTHONVERBOSE for traceback:
%s: %s
)
r�r�r<r3rrPr�r�r9r6r�r�r�)r�r�r�rrr�execusercustomizes

��r�cCs~tjdd�}t�}|tjkr$t�t|�}tdkr:t�at|�}t|�}t	�t
�t�tjj
sjt�t�trzt�dSr)rrr"rr�rorSrrr�r�r�r�rP�isolatedr�r�r�)�	orig_pathr rrr�main/s"
r�cCs\d}tjdd�}|s�t�}t�}td�tjD]}td|f�q0td�td|tj�|�rbdndf�td	|tj�|�r�dndf�td
t�t�	d�g}d|kr�|�
t�d
|kr�|�
t�|�r(ttj
�|��tr�t�	d�n6tdk�rt�	d�n tdk�rt�	d�n
t�	d�n0ddl}t|�|tjdtj
f��t�	d�dS)Na�    %s [--user-base] [--user-site]

    Without arguments print some useful information
    With arguments print the value of USER_BASE and/or USER_SITE separated
    by '%s'.

    Exit codes with --user-base or --user-site:
      0 - user site directory is enabled
      1 - user site directory is disabled by user
      2 - uses site directory is disabled by super user
          or for security reasons
     >2 - unknown error
    r*zsys.path = [z    %r,�]zUSER_BASE: %r (%s)r#z
doesn't existzUSER_SITE: %r (%s)zENABLE_USER_SITE: %rrz--user-basez--user-siteFr^rv�
)r�argvrlrnr4rrrpror�rrkrm�pathsepr�textwrap�dedent)r�rV�	user_baserqr
�bufferr�rrr�_scriptQsD
��




r��__main__)N)N)N)%rrr�r�r,r}r�rxrormrkr
rr"r(rCrKrSrfrjrlrnrrr~r�r�r�r�r�r�r�r�r�rP�no_siter�r�rrrr�<module>HsF	
*
 


;4
3
string.cpython-38.pyc000064400000016206150335716500010514 0ustar00U

e5d')�@s�dZddddddddd	d
ddgZd
dlZdZdZdZeeZdZeddZdZ	dZ
eee
eZddd�Zd
dl
Zd
dlmZiZGdd�de�ZGdd�ded�ZGdd�d�ZdS)anA collection of string constants.

Public module variables:

whitespace -- a string containing all ASCII whitespace
ascii_lowercase -- a string containing all ASCII lowercase letters
ascii_uppercase -- a string containing all ASCII uppercase letters
ascii_letters -- a string containing all ASCII letters
digits -- a string containing all ASCII decimal digits
hexdigits -- a string containing all ASCII hexadecimal digits
octdigits -- a string containing all ASCII octal digits
punctuation -- a string containing all ASCII punctuation characters
printable -- a string containing all ASCII characters considered printable

�
ascii_letters�ascii_lowercase�ascii_uppercase�capwords�digits�	hexdigits�	octdigits�	printable�punctuation�
whitespace�	Formatter�Template�Nz 	

ZabcdefghijklmnopqrstuvwxyzZABCDEFGHIJKLMNOPQRSTUVWXYZ�
0123456789ZabcdefZABCDEFZ01234567z !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~cCs|pd�dd�|�|�D��S)a�capwords(s [,sep]) -> string

    Split the argument into words using split, capitalize each
    word using capitalize, and join the capitalized words using
    join.  If the optional second argument sep is absent or None,
    runs of whitespace characters are replaced by a single space
    and leading and trailing whitespace are removed, otherwise
    sep is used to split and join the words.

    � css|]}|��VqdS�N)�
capitalize)�.0�x�r�/usr/lib64/python3.8/string.py�	<genexpr>0szcapwords.<locals>.<genexpr>)�join�split)�s�seprrrr%s)�ChainMapcs eZdZdZ�fdd�Z�ZS)�_TemplateMetaclassa/
    %(delim)s(?:
      (?P<escaped>%(delim)s) |   # Escape sequence of two delimiters
      (?P<named>%(id)s)      |   # delimiter and a Python identifier
      {(?P<braced>%(bid)s)}  |   # delimiter and a braced identifier
      (?P<invalid>)              # Other ill-formed delimiter exprs
    )
    csbtt|��|||�d|kr$|j}n$tjt�|j�|j|jp@|jd�}t�	||j
tjB�|_dS)N�pattern)Zdelim�idZbid)�superr�__init__r�_re�escape�	delimiter�	idpattern�braceidpattern�compile�flags�VERBOSE)�cls�name�basesZdctr��	__class__rrr Cs

�z_TemplateMetaclass.__init__)�__name__�
__module__�__qualname__rr �
__classcell__rrr,rr9s	rc@sJeZdZdZdZdZdZejZ	dd�Z
dd�Zefd	d
�Z
efdd�ZdS)
rz.A string class for supporting $-substitutions.�$z(?a:[_a-z][_a-z0-9]*)NcCs
||_dSr)�template)�selfr3rrrr \szTemplate.__init__cCsd|�d�}|jd|�jdd�}|s.d}d}n"|td�|dd���}t|�}td||f��dS)N�invalidT)�keepends�����z.Invalid placeholder in string: line %d, col %d)�startr3�
splitlines�lenr�
ValueError)r4�mo�i�lines�colno�linenorrr�_invalidas
�zTemplate._invalidcs:�tkr|�n|rt|�����fdd�}�j�|�j�S)Ncsd|�d�p|�d�}|dk	r(t�|�S|�d�dk	r<�jS|�d�dk	rT��|�td�j��dS�N�namedZbracedZescapedr5z#Unrecognized named group in pattern)�group�strr#rCr=r�r>rE��mappingr4rr�convertss
�z$Template.substitute.<locals>.convert��_sentinel_dict�	_ChainMapr�subr3�r4rJZkwsrKrrIr�
substitutems
zTemplate.substitutecs:�tkr|�n|rt|�����fdd�}�j�|�j�S)Ncs�|�d�p|�d�}|dk	rHzt�|�WStk
rF|��YSX|�d�dk	r\�jS|�d�dk	rr|��Std�j��dSrD)rFrG�KeyErrorr#r=rrHrIrrrK�s�z)Template.safe_substitute.<locals>.convertrLrPrrIr�safe_substitute�s

zTemplate.safe_substitute)r.r/r0�__doc__r#r$r%r!�
IGNORECASEr'r rCrMrQrSrrrrrPs)�	metaclassc@sVeZdZdd�Zdd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)rcOs|�|||�Sr)�vformat)r4�
format_string�args�kwargsrrr�format�szFormatter.formatcCs.t�}|�||||d�\}}|�|||�|S)N�)�set�_vformat�check_unused_args)r4rXrYrZ�	used_args�result�_rrrrW�szFormatter.vformatr
c	Cs�|dkrtd��g}|�|�D]�\}}	}
}|r8|�|�|	dk	r|	dkrj|dkrXtd��t|�}	|d7}n|	��r�|r~td��d}|�|	||�\}}
|�|
�|�||�}|j|
||||d|d�\}
}|�|�	||
��qd�
|�|fS)Nr
zMax string recursion exceededr8FzJcannot switch from manual field specification to automatic field numberingr7)�auto_arg_index)r=�parse�appendrG�isdigit�	get_field�add�
convert_fieldr^�format_fieldr)r4rXrYrZr`Zrecursion_depthrcraZliteral_text�
field_name�format_spec�
conversion�objZarg_usedrrrr^�s<�


�
zFormatter._vformatcCst|t�r||S||SdSr)�
isinstance�int)r4�keyrYrZrrr�	get_value�s
zFormatter.get_valuecCsdSrr)r4r`rYrZrrrr_�szFormatter.check_unused_argscCs
t||�Sr)r[)r4�valuerlrrrrj�szFormatter.format_fieldcCsN|dkr|S|dkrt|�S|dkr,t|�S|dkr<t|�Std�|���dS)Nr�r�az"Unknown conversion specifier {0!s})rG�repr�asciir=r[)r4rsrmrrrri�szFormatter.convert_fieldcCs
t�|�Sr)�_stringZformatter_parser)r4rXrrrrdszFormatter.parsec	CsJt�|�\}}|�|||�}|D] \}}|r8t||�}q ||}q ||fSr)rxZformatter_field_name_splitrr�getattr)	r4rkrYrZ�first�restrnZis_attrr?rrrrg
s
zFormatter.get_fieldN)r
)r.r/r0r[rWr^rrr_rjrirdrgrrrrr�s�
6	)N)rT�__all__rxr
rrrrrrr	rr�rer!�collectionsrrNrM�typerrrrrrr�<module>s6�
Qgetpass.cpython-38.opt-1.pyc000064400000010124150335716500011604 0ustar00U

e5dj�@s�dZddlZddlZddlZddlZddlZdddgZGdd�de�Zddd	�Z	dd
d�Z
ddd
�Zddd�Zdd�Z
zddlZejejfWnBeefk
r�zddlZWnek
r�eZYnXe
ZYnXe	ZdS)a�Utilities to get a password and/or the current user name.

getpass(prompt[, stream]) - Prompt for a password, with echo turned off.
getuser() - Get the user name from the environment or password database.

GetPassWarning - This UserWarning is issued when getpass() cannot prevent
                 echoing of the password contents while reading.

On Windows, the msvcrt module will be used.

�N�getpass�getuser�GetPassWarningc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.8/getpass.pyrs�
Password: c
Cs�d}t�����}zJt�dtjtjB�}t�|d�}|�|�t�	|�}|�|�|sX|}Wnpt
k
r�}zR|��ztj
��}Wn&ttfk
r�d}t||�}YnXtj
}|s�tj}W5d}~XYnX|dk	�r�z�t�|�}|dd�}	|	dtjM<tj}
ttd��r|
tjO}
z t�||
|	�t|||d�}W5t�||
|�|��XWn@tjk
�r�|dk	�rz�||k	�r�|��t||�}YnX|�d�|W5QR�SQRXdS)aPrompt for a password, with echo turned off.

    Args:
      prompt: Written on stream to ask for the input.  Default: 'Password: '
      stream: A writable file object to display the prompt.  Defaults to
              the tty.  If no tty is available defaults to sys.stderr.
    Returns:
      The seKr3t input.
    Raises:
      EOFError: If our input tty or stdin was closed.
      GetPassWarning: When we were unable to turn echo off on the input.

    Always restores terminal settings before returning.
    Nz/dev/ttyzw+��TCSASOFT)�input�
)�
contextlib�	ExitStack�os�open�O_RDWR�O_NOCTTY�io�FileIO�
enter_context�
TextIOWrapper�OSError�close�sys�stdin�fileno�AttributeError�
ValueError�fallback_getpass�stderr�termios�	tcgetattrZECHOZ	TCSAFLUSH�hasattrr�	tcsetattr�flush�
_raw_input�error�write)�prompt�streamZpasswd�stack�fdZttyr
�e�old�newZtcsetattr_flagsrrr	�unix_getpasssR








r1cCs�tjtjk	rt||�S|D]}t�|�qd}t��}|dkst|dkrHqt|dkrTt�|dkrj|dd�}q.||}q.t�d�t�d�|S)z9Prompt for password with echo off, using Windows getch().��
r��N���)rr�	__stdin__r �msvcrtZputwchZgetwch�KeyboardInterrupt)r*r+�cZpwrrr	�win_getpassas 



r;cCs0tjdtdd�|stj}td|d�t||�S)Nz%Can not control echo on the terminal.�)�
stacklevelz&Warning: Password input may be echoed.)�file)�warnings�warnrrr!�printr')r*r+rrr	r xs�r r2cCs�|s
tj}|stj}t|�}|rpz|�|�Wn8tk
rf|�|jd�}|�|j�}|�|�YnX|�	�|�
�}|s�t�|ddkr�|dd�}|S)N�replacer6r)rr!r�strr)�UnicodeEncodeError�encode�encoding�decoder&�readline�EOFError)r*r+r
�linerrr	r'�s&r'cCs<dD]}tj�|�}|r|Sqddl}|�t���dS)z�Get the username from the environment or password database.

    First try various environment variables, then the password
    database.  This works on Windows as long as USERNAME is set.

    )ZLOGNAMEZUSERZLNAMEZUSERNAMErN)r�environ�get�pwd�getpwuid�getuid)�name�userrMrrr	r�s
)r
N)r
N)r
N)r2NN)�__doc__rrrrr?�__all__�UserWarningrr1r;r r'rr"r#r%�ImportErrorrr8rrrrr	�<module>s,

D

	


decimal.cpython-38.pyc000064400000000551150335716500010600 0ustar00U

e5d@�@svz0ddlTddlmZddlmZddlmZWn@ek
rpddlTddlmZddlmZddlmZYnXdS)�)�*)�__doc__)�__version__)�__libmpdec_version__N)Z_decimalrrr�ImportErrorZ
_pydecimal�rr�/usr/lib64/python3.8/decimal.py�<module>sselectors.cpython-38.opt-2.pyc000064400000031146150335716500012151 0ustar00U

e5d�H�@s�ddlmZmZddlmZddlmZddlZddlZddl	Z	dZ
dZdd�Zed	d
ddd
g�Z
de
_e	jdkr�de
j_de
j_de
j_de
j_Gdd�de�ZGdd�ded�ZGdd�de�ZGdd�de�ZGdd�de�Zeed�r�Gd d!�d!e�Zeed"��rGd#d$�d$e�Zeed%��r6Gd&d'�d'e�Zeed(��rRGd)d*�d*e�Zd*e�k�rdeZn:d$e�k�rveZn(d'e�k�r�eZnd!e�k�r�eZneZdS)+�)�ABCMeta�abstractmethod)�
namedtuple)�MappingN��c
Csft|t�r|}n<zt|���}Wn*tttfk
rJtd�|��d�YnX|dkrbtd�|���|S)NzInvalid file object: {!r}rzInvalid file descriptor: {})�
isinstance�int�fileno�AttributeError�	TypeError�
ValueError�format)�fileobj�fd�r�!/usr/lib64/python3.8/selectors.py�_fileobj_to_fds
��r�SelectorKeyrr�events�dataz�SelectorKey(fileobj, fd, events, data)

    Object used to associate a file object to its backing
    file descriptor, selected event mask, and attached data.
)��zFile object registered.zUnderlying file descriptor.z3Events that must be waited for on this file object.zzOptional opaque data associated to this file object.
    For example, this could be used to store a per-client session ID.c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_SelectorMappingcCs
||_dS�N)�	_selector)�selfZselectorrrr�__init__?sz_SelectorMapping.__init__cCst|jj�Sr)�lenr�
_fd_to_key�rrrr�__len__Bsz_SelectorMapping.__len__cCsDz|j�|�}|jj|WStk
r>td�|��d�YnXdS�N�{!r} is not registered)r�_fileobj_lookupr�KeyErrorr)rrrrrr�__getitem__Es
z_SelectorMapping.__getitem__cCst|jj�Sr)�iterrrr rrr�__iter__Lsz_SelectorMapping.__iter__N)�__name__�
__module__�__qualname__rr!r&r(rrrrr<src@sjeZdZeddd��Zedd��Zddd�Zeddd	��Zd
d�Zdd
�Z	edd��Z
dd�Zdd�ZdS)�BaseSelectorNcCst�dSr��NotImplementedError�rrrrrrr�register_szBaseSelector.registercCst�dSrr-)rrrrr�
unregistervszBaseSelector.unregistercCs|�|�|�|||�Sr)r1r0r/rrr�modify�s
zBaseSelector.modifycCst�dSrr-)r�timeoutrrr�select�szBaseSelector.selectcCsdSrrr rrr�close�szBaseSelector.closecCsL|��}|dkrtd��z
||WStk
rFtd�|��d�YnXdS)NzSelector is closedr#)�get_map�RuntimeErrorr%r)rr�mappingrrr�get_key�s
zBaseSelector.get_keycCst�dSrr-r rrrr6�szBaseSelector.get_mapcCs|Srrr rrr�	__enter__�szBaseSelector.__enter__cGs|��dSr)r5)r�argsrrr�__exit__�szBaseSelector.__exit__)N)N)N)
r)r*r+rr0r1r2r4r5r9r6r:r<rrrrr,Ps


r,)�	metaclassc@sPeZdZdd�Zdd�Zddd�Zdd	�Zdd
d�Zdd
�Zdd�Z	dd�Z
dS)�_BaseSelectorImplcCsi|_t|�|_dSr)rr�_mapr rrrr�sz_BaseSelectorImpl.__init__cCsNz
t|�WStk
rH|j��D]}|j|kr$|jYSq$�YnXdSr)rr
r�valuesrr�rr�keyrrrr$�s	

z!_BaseSelectorImpl._fileobj_lookupNcCsb|r|ttB@r td�|���t||�|�||�}|j|jkrRtd�||j���||j|j<|S)NzInvalid events: {!r}z"{!r} (FD {}) is already registered)	�
EVENT_READ�EVENT_WRITEr
rrr$rrr%�rrrrrBrrrr0�s�z_BaseSelectorImpl.registercCs@z|j�|�|��}Wn$tk
r:td�|��d�YnX|Sr")r�popr$r%rrArrrr1�s
z_BaseSelectorImpl.unregistercCs�z|j|�|�}Wn$tk
r8td�|��d�YnX||jkr^|�|�|�|||�}n"||jkr�|j|d�}||j|j	<|S)Nr#)r)
rr$r%rrr1r0r�_replacerrErrrr2�s


z_BaseSelectorImpl.modifycCs|j��d|_dSr)r�clearr?r rrrr5s
z_BaseSelectorImpl.closecCs|jSr)r?r rrrr6sz_BaseSelectorImpl.get_mapcCs(z|j|WStk
r"YdSXdSr)rr%)rrrrr�_key_from_fds	z_BaseSelectorImpl._key_from_fd)N)N)r)r*r+rr$r0r1r2r5r6rIrrrrr>�s


r>cs\eZdZ�fdd�Zd
�fdd�	Z�fdd�ZejdkrDdd	d
�Zne	j	Zddd�Z	�Z
S)�SelectSelectorcst���t�|_t�|_dSr)�superr�set�_readers�_writersr ��	__class__rrr%s
zSelectSelector.__init__Ncs@t��|||�}|t@r&|j�|j�|t@r<|j�|j�|Sr)rKr0rCrM�addrrDrNrErOrrr0*szSelectSelector.registercs,t��|�}|j�|j�|j�|j�|Sr)rKr1rM�discardrrNrArOrrr12szSelectSelector.unregisterZwin32cCs$t�||||�\}}}|||gfSr)r4)r�r�w�_r3�xrrr�_select9szSelectSelector._selectc	Cs�|dkrdnt|d�}g}z|�|j|jg|�\}}}Wntk
rP|YSXt|�}t|�}||BD]J}d}||kr�|tO}||kr�|tO}|�|�}|rj|�	|||j
@f�qj|S�Nr)�maxrWrMrN�InterruptedErrorrLrCrDrI�appendr)	rr3�readyrSrTrUrrrBrrrr4?s$

zSelectSelector.select)N)N)N)r)r*r+rr0r1�sys�platformrWr4�
__classcell__rrrOrrJ"s
rJcsZeZdZdZdZdZ�fdd�Zd�fdd�	Z�fdd�Zd
�fdd	�	Z	dd
d�Z
�ZS)�_PollLikeSelectorNcst���|��|_dSr)rKr�
_selector_clsrr rOrrr[s
z_PollLikeSelector.__init__cslt��|||�}d}|t@r&||jO}|t@r8||jO}z|j�|j|�Wnt��|��YnX|SrX)	rKr0rC�_EVENT_READrD�_EVENT_WRITErrr1)rrrrrBZ
poller_eventsrOrrr0_s

z_PollLikeSelector.registercs8t��|�}z|j�|j�Wntk
r2YnX|Sr)rKr1rr�OSErrorrArOrrr1msz_PollLikeSelector.unregistercs�z|j|�|�}Wn$tk
r8t|�d��d�YnXd}||jkr�d}|t@r^||jO}|t@rp||jO}z|j�	|j
|�Wnt��|��YnXd}||j
kr�d}|r�|j||d�}||j|j
<|S)Nz is not registeredFrT)rr)rr$r%rrCrbrDrcrr2rrKr1rrG)rrrrrBZchangedZselector_eventsrOrrr2ws.



z_PollLikeSelector.modifycCs�|dkrd}n|dkrd}nt�|d�}g}z|j�|�}Wntk
rV|YSX|D]V\}}d}||j@r||tO}||j@r�|tO}|�	|�}|r\|�
|||j@f�q\|S)Nr�@�@)�math�ceilr�pollrZrbrDrcrCrIr[r)rr3r\�
fd_event_listr�eventrrBrrrr4�s(

z_PollLikeSelector.select)N)N)N)r)r*r+rarbrcrr0r1r2r4r_rrrOrr`Us
r`rhc@seZdZejZejZejZ	dS)�PollSelectorN)
r)r*r+r4rhra�POLLINrb�POLLOUTrcrrrrrk�srk�epollcs@eZdZejZejZejZ	dd�Z
ddd�Z�fdd�Z�ZS)	�
EpollSelectorcCs
|j��Sr�rr
r rrrr
�szEpollSelector.filenoNc	Cs�|dkrd}n |dkrd}nt�|d�d}tt|j�d�}g}z|j�||�}Wntk
rl|YSX|D]V\}}d}|tj	@r�|t
O}|tj@r�|tO}|�
|�}|rr|�|||j@f�qr|S)N���rreg����MbP?r)rfrgrYrrrrhrZr4�EPOLLINrD�EPOLLOUTrCrIr[r)	rr3�max_evr\rirrjrrBrrrr4�s*

zEpollSelector.selectcs|j��t���dSr�rr5rKr rOrrr5�s
zEpollSelector.close)N)
r)r*r+r4rnrarrrbrsrcr
r5r_rrrOrro�s
 ro�devpollcs6eZdZejZejZejZ	dd�Z
�fdd�Z�ZS)�DevpollSelectorcCs
|j��Srrpr rrrr
�szDevpollSelector.filenocs|j��t���dSrrur rOrrr5�s
zDevpollSelector.close)
r)r*r+r4rvrarlrbrmrcr
r5r_rrrOrrw�s
rw�kqueuecsTeZdZ�fdd�Zdd�Zd�fdd�	Z�fdd	�Zdd
d�Z�fdd
�Z�Z	S)�KqueueSelectorcst���t��|_dSr)rKrr4rxrr rOrrr�s
zKqueueSelector.__init__cCs
|j��Srrpr rrrr
szKqueueSelector.filenoNcs�t��|||�}z`|t@r@t�|jtjtj�}|j�	|gdd�|t
@rnt�|jtjtj�}|j�	|gdd�Wnt��|��YnX|SrX)
rKr0rCr4�keventr�KQ_FILTER_READZ	KQ_EV_ADDr�controlrD�KQ_FILTER_WRITEr1)rrrrrB�kevrOrrr0s ��zKqueueSelector.registercs�t��|�}|jt@rVt�|jtjtj�}z|j	�
|gdd�Wntk
rTYnX|jt@r�t�|jtj
tj�}z|j	�
|gdd�Wntk
r�YnX|SrX)rKr1rrCr4rzrr{ZKQ_EV_DELETErr|rdrDr})rrrBr~rOrrr1s$
�
�zKqueueSelector.unregisterc
Cs�|dkrdnt|d�}t|j�}g}z|j�d||�}Wntk
rP|YSX|D]Z}|j}|j}d}|tj	kr||t
O}|tjkr�|tO}|�
|�}	|	rV|�|	||	j@f�qV|SrX)rYrrrr|rZZident�filterr4r{rCr}rDrIr[r)
rr3rtr\Zkev_listr~r�flagrrBrrrr4)s&




zKqueueSelector.selectcs|j��t���dSrrur rOrrr5?s
zKqueueSelector.close)N)N)
r)r*r+rr
r0r1r4r5r_rrrOrry�s
ry) �abcrr�collectionsrZcollections.abcrrfr4r]rCrDrr�__doc__�version_inforrrrrr,r>rJr`�hasattrrkrorwry�globalsZDefaultSelectorrrrr�<module>sJ
~T3Z
.Mcompileall.cpython-38.opt-2.pyc000064400000015575150335716500012277 0ustar00codeop.cpython-38.opt-2.pyc000064400000004467150335716500011425 0ustar00turtle.cpython-38.opt-2.pyc000064400000205521150335716500011465 0ustar00bisect.cpython-38.pyc000064400000004464150335716500010462 0ustar00glob.cpython-38.opt-2.pyc000064400000006534150335716500011074 0ustar00pkgutil.cpython-38.opt-1.pyc000064400000037722150335716500011632 0ustar00mailbox.cpython-38.opt-2.pyc000064400000150520150335716500011577 0ustar00datetime.cpython-38.opt-2.pyc000064400000134612150335716500011744 0ustar00pipes.cpython-38.opt-1.pyc000064400000017165150335716500011272 0ustar00ftplib.cpython-38.opt-1.pyc000064400000066551150335716500011435 0ustar00mailbox.cpython-38.pyc000064400000165552150335716500010652 0ustar00fractions.cpython-38.pyc000064400000044465150335716500011206 0ustar00cgi.cpython-38.opt-2.pyc000064400000043303150335716500010706 0ustar00zipfile.cpython-38.opt-2.pyc000064400000141176150335716500011615 0ustar00webbrowser.cpython-38.opt-1.pyc000064400000041301150335716500012320 0ustar00filecmp.cpython-38.opt-2.pyc000064400000013600150335716500011560 0ustar00_strptime.cpython-38.opt-1.pyc000064400000037256150335716500012163 0ustar00contextvars.cpython-38.opt-1.pyc000064400000000365150335716500012524 0ustar00keyword.cpython-38.opt-1.pyc000064400000001750150335716500011627 0ustar00shlex.cpython-38.opt-2.pyc000064400000015505150335716500011272 0ustar00codeop.cpython-38.pyc000064400000014423150335716500010456 0ustar00_weakrefset.cpython-38.pyc000064400000016662150335716500011513 0ustar00pkgutil.cpython-38.pyc000064400000037722150335716500010673 0ustar00decimal.cpython-38.opt-1.pyc000064400000000551150335716500011537 0ustar00pkgutil.cpython-38.opt-2.pyc000064400000025512150335716500011625 0ustar00selectors.cpython-38.opt-1.pyc000064400000041051150335716500012144 0ustar00getopt.cpython-38.pyc000064400000014201150335716500010501 0ustar00uu.cpython-38.opt-2.pyc000064400000006730150335716500010600 0ustar00smtplib.cpython-38.opt-2.pyc000064400000045462150335716500011626 0ustar00uu.cpython-38.pyc000064400000007314150335716500007637 0ustar00glob.cpython-38.opt-1.pyc000064400000010270150335716500011063 0ustar00this.cpython-38.pyc000064400000002357150335716500010157 0ustar00fractions.cpython-38.opt-1.pyc000064400000044465150335716500012145 0ustar00cmd.cpython-38.pyc000064400000030524150335716500007750 0ustar00poplib.cpython-38.opt-1.pyc000064400000032225150335716500011431 0ustar00nntplib.cpython-38.opt-1.pyc000064400000102270150335716500011610 0ustar00contextlib.cpython-38.opt-2.pyc000064400000034406150335716500012323 0ustar00imghdr.cpython-38.opt-1.pyc000064400000010030150335716500011404 0ustar00shelve.cpython-38.opt-1.pyc000064400000022424150335716500011432 0ustar00shutil.cpython-38.opt-2.pyc000064400000062422150335716500011457 0ustar00asynchat.cpython-38.opt-2.pyc000064400000012546150335716500011763 0ustar00_pyio.cpython-38.opt-1.pyc000064400000220515150335716500011264 0ustar00symbol.cpython-38.opt-1.pyc000064400000004546150335716500011456 0ustar00imaplib.cpython-38.pyc000064400000120600150335716500010615 0ustar00_weakrefset.cpython-38.opt-2.pyc000064400000016662150335716500012453 0ustar00uuid.cpython-38.opt-1.pyc000064400000056035150335716500011117 0ustar00mimetypes.cpython-38.opt-1.pyc000064400000037241150335716500012163 0ustar00trace.cpython-38.opt-1.pyc000064400000047120150335716500011242 0ustar00platform.cpython-38.pyc000064400000057410150335716500011034 0ustar00_sitebuiltins.cpython-38.pyc000064400000006633150335716500012066 0ustar00codeop.cpython-38.opt-1.pyc000064400000014423150335716500011415 0ustar00signal.cpython-38.pyc000064400000005435150335716500010465 0ustar00tempfile.cpython-38.opt-1.pyc000064400000055547150335716500011765 0ustar00filecmp.cpython-38.opt-1.pyc000064400000020355150335716500011564 0ustar00nturl2path.cpython-38.opt-2.pyc000064400000002457150335716500012254 0ustar00dummy_threading.cpython-38.opt-2.pyc000064400000001343150335716500013322 0ustar00tempfile.cpython-38.pyc000064400000055547150335716500011026 0ustar00smtpd.cpython-38.pyc000064400000063541150335716500010341 0ustar00pyclbr.cpython-38.opt-2.pyc000064400000015304150335716500011437 0ustar00mailcap.cpython-38.pyc000064400000016050150335716500010611 0ustar00_markupbase.cpython-38.pyc000064400000017160150335716500011477 0ustar00copy.cpython-38.opt-1.pyc000064400000015515150335716500011121 0ustar00operator.cpython-38.pyc000064400000032575150335716500011050 0ustar00weakref.cpython-38.opt-2.pyc000064400000037516150335716500011601 0ustar00this.cpython-38.opt-1.pyc000064400000002357150335716500011116 0ustar00os.cpython-38.opt-1.pyc000064400000075207150335716500010574 0ustar00__phello__.foo.cpython-38.opt-1.pyc000064400000000201150335716500012772 0ustar00struct.cpython-38.pyc000064400000000514150335716500010525 0ustar00statistics.cpython-38.opt-1.pyc000064400000100751150335716500012336 0ustar00tty.cpython-38.opt-1.pyc000064400000002066150335716500010764 0ustar00selectors.cpython-38.pyc000064400000041051150335716500011205 0ustar00_collections_abc.cpython-38.opt-1.pyc000064400000070107150335716500013427 0ustar00enum.cpython-38.pyc000064400000062554150335716500010161 0ustar00optparse.cpython-38.pyc000064400000135673150335716500011055 0ustar00gettext.cpython-38.opt-2.pyc000064400000041452150335716500011633 0ustar00code.cpython-38.opt-1.pyc000064400000023273150335716500011061 0ustar00mimetypes.cpython-38.pyc000064400000037241150335716500011224 0ustar00_threading_local.cpython-38.pyc000064400000014460150335716500012464 0ustar00signal.cpython-38.opt-1.pyc000064400000005435150335716500011424 0ustar00asynchat.cpython-38.opt-1.pyc000064400000015305150335716500011756 0ustar00sunau.cpython-38.opt-1.pyc000064400000041272150335716500011301 0ustar00tabnanny.cpython-38.opt-1.pyc000064400000015570150335716500011762 0ustar00mailcap.cpython-38.opt-1.pyc000064400000016050150335716500011550 0ustar00plistlib.cpython-38.opt-1.pyc000064400000064734150335716500012000 0ustar00uuid.cpython-38.pyc000064400000056243150335716500010161 0ustar00webbrowser.cpython-38.pyc000064400000041342150335716500011366 0ustar00warnings.cpython-38.opt-1.pyc000064400000031612150335716500011773 0ustar00symtable.cpython-38.pyc000064400000026074150335716500011032 0ustar00py_compile.cpython-38.pyc000064400000016332150335716500011346 0ustar00codecs.cpython-38.opt-1.pyc000064400000102246150335716500011405 0ustar00tracemalloc.cpython-38.opt-2.pyc000064400000037120150335716500012432 0ustar00getopt.cpython-38.opt-2.pyc000064400000007145150335716500011452 0ustar00turtle.cpython-38.pyc000064400000375750150335716500010541 0ustar00xdrlib.cpython-38.opt-1.pyc000064400000020037150335716500011426 0ustar00ssl.cpython-38.opt-2.pyc000064400000101524150335716500010745 0ustar00tarfile.cpython-38.pyc000064400000211663150335716500010640 0ustar00contextlib.cpython-38.opt-1.pyc000064400000047322150335716500012323 0ustar00pstats.cpython-38.opt-1.pyc000064400000053064150335716500011466 0ustar00abc.cpython-38.pyc000064400000012330150335716500007725 0ustar00timeit.cpython-38.opt-2.pyc000064400000013445150335716500011443 0ustar00pipes.cpython-38.pyc000064400000017165150335716500010333 0ustar00pdb.cpython-38.opt-2.pyc000064400000100516150335716500010711 0ustar00random.cpython-38.opt-2.pyc000064400000031516150335716500011427 0ustar00os.cpython-38.pyc000064400000075247150335716500007641 0ustar00tty.cpython-38.pyc000064400000002066150335716500010025 0ustar00aifc.cpython-38.opt-1.pyc000064400000061604150335716500011051 0ustar00webbrowser.cpython-38.opt-2.pyc000064400000034527150335716500012335 0ustar00_markupbase.cpython-38.opt-1.pyc000064400000016704150335716500012441 0ustar00fileinput.cpython-38.opt-2.pyc000064400000017127150335716500012150 0ustar00_strptime.cpython-38.opt-2.pyc000064400000030036150335716500012151 0ustar00_pydecimal.cpython-38.pyc000064400000471741150335716500011325 0ustar00_collections_abc.cpython-38.pyc000064400000070107150335716500012470 0ustar00imghdr.cpython-38.pyc000064400000010030150335716500010445 0ustar00locale.cpython-38.opt-1.pyc000064400000103603150335716500011402 0ustar00aifc.cpython-38.opt-2.pyc000064400000047455150335716500011062 0ustar00numbers.cpython-38.opt-2.pyc000064400000020225150335716500011615 0ustar00socketserver.cpython-38.opt-2.pyc000064400000034467150335716500012676 0ustar00cgitb.cpython-38.pyc000064400000023650150335716500010277 0ustar00hashlib.cpython-38.pyc000064400000012457150335716500010624 0ustar00numbers.cpython-38.pyc000064400000027654150335716500010672 0ustar00getpass.cpython-38.pyc000064400000010124150335716500010645 0ustar00pprint.cpython-38.opt-2.pyc000064400000033377150335716500011472 0ustar00dataclasses.cpython-38.pyc000064400000056147150335716500011505 0ustar00asyncore.cpython-38.pyc000064400000037236150335716500011037 0ustar00shlex.cpython-38.pyc000064400000016562150335716500010336 0ustar00tabnanny.cpython-38.opt-2.pyc000064400000013723150335716500011761 0ustar00genericpath.cpython-38.pyc000064400000007643150335716500011504 0ustar00stat.cpython-38.opt-2.pyc000064400000007007150335716500011120 0ustar00pickle.cpython-38.opt-2.pyc000064400000117731150335716500011422 0ustar00ipaddress.cpython-38.opt-1.pyc000064400000165113150335716500012125 0ustar00__phello__.foo.cpython-38.pyc000064400000000201150335716500012033 0ustar00locale.cpython-38.pyc000064400000103603150335716500010443 0ustar00tarfile.cpython-38.opt-1.pyc000064400000211624150335716500011574 0ustar00queue.cpython-38.pyc000064400000024604150335716500010333 0ustar00pprint.cpython-38.pyc000064400000037633150335716500010531 0ustar00antigravity.cpython-38.opt-1.pyc000064400000001437150335716500012506 0ustar00tabnanny.cpython-38.pyc000064400000015570150335716500011023 0ustar00quopri.cpython-38.pyc000064400000013166150335716500010527 0ustar00_py_abc.cpython-38.opt-1.pyc000064400000011032150335716500011531 0ustar00imp.cpython-38.pyc000064400000023123150335716500007767 0ustar00zipapp.cpython-38.pyc000064400000013340150335716500010505 0ustar00string.cpython-38.opt-1.pyc000064400000016206150335716500011453 0ustar00symtable.cpython-38.opt-2.pyc000064400000024315150335716500011766 0ustar00formatter.cpython-38.opt-1.pyc000064400000042213150335716500012145 0ustar00imaplib.cpython-38.opt-2.pyc000064400000065060150335716500011565 0ustar00_dummy_thread.cpython-38.opt-1.pyc000064400000013627150335716500012772 0ustar00runpy.cpython-38.opt-1.pyc000064400000017767150335716500011337 0ustar00compileall.cpython-38.opt-1.pyc000064400000022304150335716500012262 0ustar00site.cpython-38.pyc000064400000041121150335716500010144 0ustar00datetime.cpython-38.pyc000064400000157527150335716500011016 0ustar00genericpath.cpython-38.opt-1.pyc000064400000007643150335716500012443 0ustar00pstats.cpython-38.opt-2.pyc000064400000046130150335716500011463 0ustar00sndhdr.cpython-38.opt-1.pyc000064400000015517150335716500011433 0ustar00operator.cpython-38.opt-1.pyc000064400000032575150335716500012007 0ustar00py_compile.cpython-38.opt-1.pyc000064400000016332150335716500012305 0ustar00_sysconfigdata__linux_x86_64-linux-gnu.cpython-38.opt-1.pyc000064400000070732150335716500017466 0ustar00stat.cpython-38.opt-1.pyc000064400000010426150335716500011116 0ustar00base64.cpython-38.opt-2.pyc000064400000026076150335716500011240 0ustar00codecs.cpython-38.opt-2.pyc000064400000043730150335716500011410 0ustar00ast.cpython-38.opt-1.pyc000064400000040532150335716500010733 0ustar00shelve.cpython-38.opt-2.pyc000064400000012335150335716500011433 0ustar00quopri.cpython-38.opt-2.pyc000064400000010673150335716500011467 0ustar00difflib.cpython-38.opt-1.pyc000064400000164012150335716500011543 0ustar00random.cpython-38.pyc000064400000047216150335716500010473 0ustar00lzma.cpython-38.pyc000064400000027364150335716500010160 0ustar00socketserver.cpython-38.pyc000064400000061423150335716500011726 0ustar00sre_parse.cpython-38.pyc000064400000052221150335716500011166 0ustar00sysconfig.cpython-38.opt-1.pyc000064400000036751150335716500012160 0ustar00glob.cpython-38.pyc000064400000010371150335716500010126 0ustar00secrets.cpython-38.opt-2.pyc000064400000002156150335716500011615 0ustar00zipfile.cpython-38.opt-1.pyc000064400000162157150335716500011616 0ustar00telnetlib.cpython-38.opt-2.pyc000064400000024761150335716500012135 0ustar00symbol.cpython-38.opt-2.pyc000064400000004432150335716500011451 0ustar00sre_compile.cpython-38.opt-1.pyc000064400000035106150335716500012446 0ustar00gzip.cpython-38.opt-2.pyc000064400000033756150335716500011130 0ustar00sunau.cpython-38.pyc000064400000041272150335716500010342 0ustar00_pyio.cpython-38.opt-2.pyc000064400000143740150335716500011271 0ustar00xdrlib.cpython-38.pyc000064400000020037150335716500010467 0ustar00ftplib.cpython-38.opt-2.pyc000064400000043447150335716500011435 0ustar00nntplib.cpython-38.pyc000064400000102270150335716500010651 0ustar00imghdr.cpython-38.opt-2.pyc000064400000007335150335716500011423 0ustar00pickletools.cpython-38.pyc000064400000203206150335716500011534 0ustar00statistics.cpython-38.opt-2.pyc000064400000042242150335716500012337 0ustar00types.cpython-38.opt-2.pyc000064400000017425150335716500011316 0ustar00__future__.cpython-38.opt-1.pyc000064400000010100150335716500012236 0ustar00asyncore.cpython-38.opt-2.pyc000064400000034752150335716500011777 0ustar00tarfile.cpython-38.opt-2.pyc000064400000155175150335716500011605 0ustar00inspect.cpython-38.opt-1.pyc000064400000234666150335716500011626 0ustar00netrc.cpython-38.opt-2.pyc000064400000006725150335716500011266 0ustar00profile.cpython-38.opt-2.pyc000064400000026506150335716500011612 0ustar00_bootlocale.cpython-38.opt-2.pyc000064400000001742150335716500012427 0ustar00genericpath.cpython-38.opt-2.pyc000064400000005463150335716500012442 0ustar00sre_parse.cpython-38.opt-2.pyc000064400000052062150335716500012131 0ustar00pstats.cpython-38.pyc000064400000053064150335716500010527 0ustar00__phello__.foo.cpython-38.opt-2.pyc000064400000000201150335716500012773 0ustar00