Your IP : 3.133.136.95


Current Path : /opt/alt/python36/lib64/python3.6/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/__pycache__/warnings.cpython-36.pyc

3

� f8H�
@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�-/opt/alt/python36/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 





?>