3
4^^8H                 @   s  d Z ddlZddddddd	d
gZd;ddZd<ddZdd Zdd ZeZdd ZeZ	dd Z
dedddfddZeddfddZdd Zdd	 ZG dd deZdd Zd d! Zd"d# Zd$d% Zd&d' Zd(d) Zd=d+dZd>d,dZG d-d. d.eZG d/d
 d
eZdZy0dd0lmZm Z m!Z!mZmZm"Z" e Z#e!Z$d1ZW n. e%k
rf   g Zd2Z#i Z$d*a&d3d4 Z"Y nX eej' es e(e)gZ*e*j+e, xe*D ]Z-ed5e-d6 qW ej.j/Z/e/d*krd7Z0ne/rd2Z0nd5Z0ee0e1d*d8 e2ed9rd:Z3nd5Z3ee3e4d*d8 [dS )?z&Python part of the warnings subsystem.    Nwarnwarn_explicitshowwarningformatwarningfilterwarningssimplefilterresetwarningscatch_warningsc             C   s   t | |||||}t| dS )z7Hook to write a warning to a file; replace if you like.N)WarningMessage_showwarnmsg_impl)messagecategoryfilenamelinenofilelinemsg r   o/home/aldo/Documentos/tesis/tesis/device auto/pruebas pulsar/pruebaclonado/envClonado/lib/python3.6/warnings.pyr   
   s    c             C   s   t | |||d|}t|S )z.Function to format a warning the standard way.N)r
   _formatwarnmsg_impl)r   r   r   r   r   r   r   r   r   r      s    c             C   sP   | j }|d kr tj}|d kr d S t| }y|j| W n tk
rJ   Y nX d S )N)r   sysstderr_formatwarnmsgwriteOSError)r   r   textr   r   r   r      s    r   c             C   sL  d| j | j| jj| jf }| jd kr`ydd l}|j| j | j}W qf tk
r\   d }d }Y qfX n| j}|r~|j	 }|d| 7 }| j
d k	rHydd l}|j| j
}W n tk
r   d }Y nX |d k	rH|d7 }xx|D ]p}|d|j |jf 7 }y$|d k	r
|j|j |j}nd }W n tk
r*   d }Y nX |r|j	 }|d| 7 }qW |S )Nz%s:%s: %s: %s
r   z  %s
z.Object allocated at (most recent call first):
z  File "%s", lineno %s
z    %s
)r   r   r   __name__r   r   	linecacheZgetline	ExceptionstripsourcetracemallocZget_object_traceback)r   sr   r   r!   tbframer   r   r   r   #   sF    






r   c             C   sd   yt }W n tk
r   Y n<X |tk	rXt|s6td|| j| j| j| j| j	| j
 dS t|  dS )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   r   r   r   r   r   )r   Zswr   r   r   _showwarnmsgU   s    r)   c             C   sJ   yt }W n tk
r   Y n&X |tk	rB|| j| j| j| j| jdS t| S )z.Function to format a warning the standard way.)r   )	r   r%   _formatwarning_origr   r   r   r   r   r   )r   Zfwr   r   r   r   j   s    
r    Fc             C   s   ddl }| dkstd	| f t|ts0td
t|tsBtdt|tsTtdt|tsftdt|trx|dkstdt| |j	||j
||j	|||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
    r   Nerrorignorealwaysdefaultmoduleoncezinvalid action: %rzmessage must be a stringzcategory must be a classz#category must be a Warning subclasszmodule must be a stringzlineno must be an int >= 0)append)r,   r-   r.   r/   r0   r1   )reAssertionError
isinstancestrtype
issubclassWarningint_add_filtercompileI)actionr   r   r0   r   r2   r3   r   r   r   r   w   s    c             C   sH   | dkst d| f t|tr(|dks0t d	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
    r,   r-   r.   r/   r0   r1   zinvalid action: %rr   zlineno must be an int >= 0N)r2   )r,   r-   r.   r/   r0   r1   )r4   r5   r:   r;   )r>   r   r   r2   r   r   r   r      s
    
c             G   sR   | s6yt j| W n tk
r&   Y nX t jd| n|t krHt j| t  d S )Nr   )filtersremove
ValueErrorinsertr2   _filters_mutated)r2   itemr   r   r   r;      s    
r;   c               C   s   g t dd< t  dS )zAClear the list of warning filters, so that no filters are active.N)r?   rC   r   r   r   r   r      s    c               @   s   e Zd ZdZdS )_OptionErrorz,Exception used by option processing helpers.N)r   
__module____qualname____doc__r   r   r   r   rE      s   rE   c             C   sR   xL| D ]D}yt | W q tk
rH } ztd|tjd W Y d d }~X qX qW d S )NzInvalid -W option ignored:)r   )
_setoptionrE   printr   r   )argsargr   r   r   r   _processoptions   s
    
rM   c             C   s   dd l }| jd}t|dkr,td| f xt|dk rF|jd q.W dd |D \}}}}}t|}|j|}t|}|j|}|r|d }|ryt|}|dk rt	W q t	t
fk
r   td	|f Y qX nd}t||||| d S )
Nr   :   ztoo many fields (max 5): %rr+   c             S   s   g | ]}|j  qS r   )r   ).0r"   r   r   r   
<listcomp>   s   z_setoption.<locals>.<listcomp>$zinvalid lineno %r)r3   splitlenrE   r2   
_getactionZescape_getcategoryr:   rA   OverflowErrorr   )rL   r3   partsr>   r   r   r0   r   r   r   r   rI      s.    


rI   c             C   sB   | sdS | dkrdS xd	D ]}|j | r|S qW td| f d S )
Nr/   allr.   r-   r0   r1   r,   zinvalid action: %r)r/   r.   r-   r0   r1   r,   )
startswithrE   )r>   ar   r   r   rU      s     

rU   c             C   s   dd l }| stS |jd| rNyt| }W q tk
rJ   td| f Y qX n| jd}| d | }| |d d  }yt|d d |g}W n" tk
r   td|f Y nX yt	||}W n" t
k
r   td| f Y nX t|tstd| f |S )Nr   z^[a-zA-Z0-9_]+$zunknown warning category: %r.   zinvalid module name: %rzinvalid warning category: %r)r3   r9   matchevalr%   rE   rfind
__import__ImportErrorgetattrAttributeErrorr8   )r   r3   catir0   Zklassmr   r   r   rV      s,    

rV   c             C   s   | j j}d|kod|kS )zFSignal whether the frame is an internal CPython implementation detail.	importlib
_bootstrap)f_codeco_filename)r$   r   r   r   r   _is_internal_frame   s    rl   c             C   s&   | j } x| dk	r t| r | j } qW | S )z;Find the next frame that doesn't involve CPython internals.N)f_backrl   )r$   r   r   r   _next_external_frame  s    
rn   r]   c             C   sv  t | tr| j}|dkrt}t |to.t|tsDtdjt|jyZ|dks\t	t
jdrht
j|}n4t
jd}x(t|d D ]}t|}|dkrtqW W n tk
r   t
j}d}Y nX |j}|j}d|kr|d }nd}|jd}	|	r|	j }
|
jdrP|	dd }	n>|dkrFyt
jd	 }	W n tk
rD   d}	Y nX |	sP|}	|jd
i }t| ||	||||| dS )z:Issue a warning, or maybe ignore it or raise an exception.Nz/category must be a Warning subclass, not '{:s}'r]   r   z<string>__file__z.pyc__main__r   Z__warningregistry__)r5   r9   	__class__UserWarningr7   r8   r(   formatr   rl   r   	_getframerangern   rA   __dict__	f_globalsf_linenogetlowerendswithargvrd   
setdefaultr   )r   r   
stacklevelr    r$   xglobalsr   r0   r   Zfnlregistryr   r   r   r     sL    






c             C   s  t |}|d kr8|pd}|dd  j dkr8|d d }|d krDi }|jddtkrd|j  t|d< t| tr~t| }| j}n| }|| } |||f}	|j|	rd S x^t	D ]R}
|
\}}}}}|d ks|j
|rt||r|d ks|j
|r|dks||krP qW t}|dkrd||	< d S dd l}|j|| |dkr:| |d	krnd||	< ||f}tj|rdd S dt|< nf|d
krznZ|dkrd||	< ||df}|j|rd S d||< n$|dkrd||	< ntd||
f t| ||||}t| d S )Nz	<unknown>   z.pyversionr   r-   r]   r,   r1   r.   r0   r/   z1Unrecognized action (%r) in warnings.filters:
 %sr   )r:   r{   rz   _filters_versionclearr5   r9   r6   rr   r?   r^   r8   defaultactionr   ZgetlinesonceregistryRuntimeErrorr
   r)   )r   r   r   r   r0   r   Zmodule_globalsr    r   keyrD   r>   r   re   modZlnr   ZoncekeyZaltkeyr   r   r   r   A  sl    














c               @   s"   e Zd ZdZdd	d
Zdd ZdS )r
   r   r   r   r   r   r   r    Nc       
      C   s:   t  }x| jD ]}	t| |	||	  qW |r0|jnd | _d S )N)locals_WARNING_DETAILSsetattrr   _category_name)
selfr   r   r   r   r   r   r    Zlocal_valuesattrr   r   r   __init__  s    zWarningMessage.__init__c             C   s   d| j | j| j| j| jf S )NzD{message : %r, category : %r, filename : %r, lineno : %s, line : %r})r   r   r   r   r   )r   r   r   r   __str__  s    zWarningMessage.__str__)r   r   r   r   r   r   r    )NNN)r   rF   rG   r   r   r   r   r   r   r   r
     s
     
r
   c               @   s8   e Zd ZdZdddddZdd Zd	d
 Zdd ZdS )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)recordr0   c            C   s(   || _ |dkrtjd n|| _d| _dS )zSpecify 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   r0   r   r   r   r     s    zcatch_warnings.__init__c             C   sP   g }| j r|jd | jtjd k	r4|jd| j  t| j}d|dj|f S )Nzrecord=Truer   z	module=%rz%s(%s)z, )r   r2   r   r   r   r7   r   join)r   rK   namer   r   r   __repr__  s    

zcatch_warnings.__repr__c             C   s~   | j rtd|  d| _ | jj| _| jd d  | j_| jj  | jj| _| jj| _| j	rvg }|j
| j_| jj| j_|S d S d S )NzCannot enter %r twiceT)r   r   r   r?   _filtersrC   r   _showwarningr   r   r2   r&   )r   Zlogr   r   r   	__enter__  s    




zcatch_warnings.__enter__c             G   s>   | j std|  | j| j_| jj  | j| j_| j| j_d S )Nz%Cannot exit %r without entering first)	r   r   r   r   r?   rC   r   r   r   )r   exc_infor   r   r   __exit__  s    


zcatch_warnings.__exit__)r   rF   rG   rH   r   r   r   r   r   r   r   r   r	     s
   	)r?   _defaultaction_onceregistryr   r   rC   Tr/   c               C   s   t d7 a d S )Nr]   )r   r   r   r   r   rC     s    rC   r-   )r   r,   )r   r2   gettotalrefcountr.   )NN)N)Nr]   N)NNNN)5rH   r   __all__r   r   r   r   r&   r)   r*   r   r9   r   r   r;   r   r   rE   rM   rI   rU   rV   rl   rn   r   r   objectr
   r	   Z_warnings_defaults	_warningsr?   r   r   rC   r   r   rb   r   warnoptionsImportWarningPendingDeprecationWarningZsilencer2   DeprecationWarningclsflagsbytes_warningZbytes_actionBytesWarninghasattrZresource_actionResourceWarningr   r   r   r   <module>   sv   

0
	
5 
FJ 



