Your IP : 18.116.52.29


Current Path : /opt/alt/python34/lib64/python3.4/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/__pycache__/warnings.cpython-34.pyo

�
e f�7�@s�dZddlZddddddd	d
gZdddd�Zddd�Zd
ed
dddd�Zedddd�Zdd	�ZGdd�de	�Z
dd�Zdd�Zdd�Z
dd�Zdddd�Zddddd�ZGdd �d e�ZGd!d
�d
e�ZdZyDdd"lmZmZmZmZmZmZeZeZd#ZWn6ek
r�gZd$ZiZdad%d&�ZYnXeej�esyee gZ!e!j"e#�xe!D]Z$ed'd(e$�q�Wej%j&Z&e&dkrd)Z'ne&r&d$Z'nd'Z'ee'd(e(d*d�e)ed+�rZd,Z*nd'Z*ee*d(e+d*d�n[dS)-z&Python part of the warnings subsystem.�N�warn�
warn_explicit�showwarning�
formatwarning�filterwarnings�simplefilter�
resetwarnings�catch_warningsc
Csd|dkr(tj}|dkr(dSny#|jt|||||��Wntk
r_YnXdS)z7Hook to write a warning to a file; replace if you like.N)�sys�stderr�writer�OSError)�message�category�filename�lineno�file�line�r�-/opt/alt/python34/lib64/python3.4/warnings.pyr
s	#
cCspddl}d|||j|f}|dkrC|j||�n|}|rl|j�}|d|7}n|S)z.Function to format a warning the standard way.rNz%s:%s: %s: %s
z  %s
)�	linecache�__name__�getline�strip)rrrrrr�srrrrs$�FcCsjddl}||j||j�||j|�|f}|rOtj|�ntjd|�t�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)�re�compile�I�filters�append�insert�_filters_mutated)�actionrr�modulerr r�itemrrrr s	cCsF|d|d|f}|r+tj|�ntjd|�t�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
    Nr)rr r!r")r#rrr r%rrrr=s
cCsgtdd�<t�dS)zAClear the list of warning filters, so that no filters are active.N)rr"rrrrrRsc@seZdZdZdS)�_OptionErrorz,Exception used by option processing helpers.N)r�
__module__�__qualname__�__doc__rrrrr&Wsr&cCsaxZ|D]R}yt|�Wqtk
rX}ztd|dtj�WYdd}~XqXqWdS)NzInvalid -W option ignored:r)�
_setoptionr&�printr
r)�args�arg�msgrrr�_processoptions\s

r/cCsPddl}|jd�}t|�dkrCtd|f��nx#t|�dkrh|jd�qFWdd�|D�\}}}}}t|�}|j|�}t|�}|j|�}|r�|d}n|r0y%t|�}|dkr�t	�nWq6t	t
fk
r,td	|f��Yq6Xnd}t|||||�dS)
Nr�:�ztoo many fields (max 5): %rrcSsg|]}|j��qSr)r)�.0rrrr�
<listcomp>ks	z_setoption.<locals>.<listcomp>�$zinvalid lineno %r)r�split�lenr&r �
_getaction�escape�_getcategory�int�
ValueError�
OverflowErrorr)r-r�partsr#rrr$rrrrr*ds.	

r*cCsU|s
dS|dkrdSx!d	D]}|j|�r!|Sq!Wtd|f��dS)
N�default�all�always�ignorer$�once�errorzinvalid action: %r)zdefaultzalwayszignorezmodulezoncezerror)�
startswithr&)r#�arrrr7s
r7cCs>ddl}|stS|jd|�rcyt|�}Wqtk
r_td|f��YqXn�|jd�}|d|�}||dd�}yt|dd|g�}Wn%tk
r�td|f��YnXyt	||�}Wn%t
k
rtd|f��YnXt|t�s:td|f��n|S)Nrz^[a-zA-Z0-9_]+$zunknown warning category: %r�.�zinvalid module name: %rzinvalid warning category: %r)r�Warning�match�eval�	NameErrorr&�rfind�
__import__�ImportError�getattr�AttributeError�
issubclass)rr�cat�ir$�klass�mrrrr9�s,


r9rGc
CsZt|t�r|j}n|dkr0t}nytj|�}Wn!tk
rftj}d}YnX|j}|j	}d|kr�|d}nd}|j
d�}|r�|j�}|jd�r(|dd�}q(nJ|dkrytj
d	}Wqtk
rd}YqXn|s(|}n|jd
i�}	t||||||	|�dS)
z:Issue a warning, or maybe ignore it or raise an exception.NrGrz<string>�__file__�.pyc�.pyo�__main__rZ__warningregistry__)rWrX���)�
isinstancerH�	__class__�UserWarningr
�	_getframer;�__dict__�	f_globals�f_lineno�get�lower�endswith�argvrP�
setdefaultr)
rr�
stacklevelZcaller�globalsrr$rZfnl�registryrrrr�s:	
			

	cCs�t|�}|dkrV|p!d}|dd�j�dkrV|dd�}qVn|dkrki}n|jdd�tkr�|j�t|d<nt|t�r�t|�}|j}n|}||�}|||f}|j|�r�dSx�t	D]|}	|	\}
}}}
}|dks2|j
|�r�t||�r�|
dks\|
j
|�r�|dkst||kr�Pq�q�Wt}
|
dkr�d||<dSddl
}|j||�|
dkr�|�n|
d	krd||<||f}tj|�rdSdt|<n�|
d
krnt|
dkrcd||<||df}|j|�rVdSd||<n/|
dkr|d||<ntd
|
|	f��tt�s�td��nt||||�dS)Nz	<unknown>�z.py�versionrrArGrCrBr@r$r>z1Unrecognized action (%r) in warnings.filters:
 %sz:warnings.showwarning() must be set to a function or method���rl)r:rcrb�_filters_version�clearr[rH�strr\rrIrQ�
defaultactionr�getlines�onceregistry�RuntimeError�callabler�	TypeError)rrrrr$ri�module_globals�text�keyr%r#r.rR�mod�lnrZoncekeyZaltkeyrrrr�sn	



	




c@s:eZdZdZd
Zddd	d
�Zdd�ZdS)�WarningMessagez0Holds the result of a single showwarning() call.rrrrrrNc	CsMt�}x%|jD]}t||||�qW|r@|jnd|_dS)N)�locals�_WARNING_DETAILS�setattrr�_category_name)	�selfrrrrrr�local_values�attrrrr�__init__s	zWarningMessage.__init__cCs&d|j|j|j|j|jfS)NzD{message : %r, category : %r, filename : %r, lineno : %s, line : %r})rrrrr)r�rrr�__str__#szWarningMessage.__str__)zmessagezcategoryzfilenamezlinenozfilezline)rr'r(r)r}r�r�rrrrr{sr{c@sReZdZdZdddddd�Zdd	�Zd
d�Zdd
�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.

    �recordFr$NcCs8||_|dkr"tjdn||_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�:s	"zcatch_warnings.__init__cCsrg}|jr|jd�n|jtjdk	rL|jd|j�nt|�j}d|dj|�fS)Nzrecord=Truer�z	module=%rz%s(%s)z, )r�r r�r
r��typer�join)r�r,�namerrr�__repr__Fs	zcatch_warnings.__repr__cs�|jrtd|��nd|_|jj|_|jdd�|j_|jj�|jj|_|jr�g��fdd�}||j_�SdSdS)NzCannot enter %r twiceTcs�jt||��dS)N)r r{)r,�kwargs)�logrrrYsz-catch_warnings.__enter__.<locals>.showwarning)	r�rsr�r�_filtersr"r�_showwarningr�)r�rr)r�r�	__enter__Os		
	zcatch_warnings.__enter__cGsK|jstd|��n|j|j_|jj�|j|j_dS)Nz%Cannot exit %r without entering first)r�rsr�r�rr"r�r)r��exc_inforrr�__exit__`s
	
zcatch_warnings.__exit__)rr'r(r)r�r�r�r�rrrrr	)s
	)r�_defaultaction�
_onceregistryrrr"Tr>cCstd7adS)NrG)rmrrrrr"sr"rArrCr �gettotalrefcountr@),r)r
�__all__rrrHrrr�	Exceptionr&r/r*r7r9rr�objectr{r	Z_warnings_defaults�	_warningsrr�r�r"rprrrNrm�warnoptions�
ImportWarning�PendingDeprecationWarningZsilencer �DeprecationWarning�cls�flags�
bytes_warningZbytes_action�BytesWarning�hasattrZresource_action�ResourceWarningrrrr�<module>sb		

)HG.




			

?>