File: //opt/alt/python37/lib64/python3.7/__pycache__/warnings.cpython-37.opt-1.pyc
B
    � fpN  �               @   s�  d Z ddlZddddddd	d
gZd<dd�Zd=dd�Zd
d� Zdd� ZeZdd� ZeZ	dd� Z
dedddfdd�Zeddfdd�Z
dd� Zdd	� ZG dd� de�Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd>d+d�Zd?d,d�ZG d-d.� d.e�ZG d/d
� d
e�Zd0d1� Zy0dd2lmZm Z m!Z!mZmZm"Z" e Z#e!Z$d3Z%W n2 e&k
�rn   g Zd4Z#i Z$d*a'd5d6� Z"dZ%Y nX eej(� e%�s�e)ed7��s�ed4e*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_warningsc             C   s   t | |||||�}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/python37/lib64/python3.7/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 kr tj}|d kr d S t| �}y|�|� W n tk
rJ   Y nX d S )N)r   �sys�stderr�_formatwarnmsg�write�OSError)r   r   �textr   r   r   r      s    r   c       	   	   C   s�  | j j}| j� d| j� d|� d| j� d�}| jd krpydd l}|�| j| j�}W qv tk
rl   d }d }Y qvX n| j}|r�|�	� }|d| 7 }| j
d k	�r�ydd l}W n tk
r�   d}d }Y n4X |�� }y|�
| j
�}W n tk
r�   d }Y nX |d k	�r�|d7 }x�|D ]t}|d|j|jf 7 }y$|d k	�rD|�|j|j�}nd }W n tk
�rd   d }Y nX |�r|�	� }|d	| 7 }�qW n|�s�||� d
�7 }|S )N�:z: �
r   z  %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__r   r   r   r   �	linecache�getline�	Exception�strip�source�tracemalloc�
is_tracing�get_object_traceback)	r   r
   �sr   r   r$   �tracing�tb�framer   r   r   r   #   sR    "
r   c             C   sd   yt }W n tk
r   Y n<X |tk	rXt|�s6td��|| j| j| j| j| j	| j
� dS t| � 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
   r   r   r   r   r   )r   �swr   r   r   �_showwarnmsg`   s    r0   c             C   sH   yt }W n tk
r   Y n$X |tk	r@|| j| j| j| j| j�S t| �S )z.Function to format a warning the standard way.)	r   r+   �_formatwarning_origr   r
   r   r   r   r   )r   �fwr   r   r   r   u   s    
r   � Fc             C   sT   |s|rddl }|r$|�||j�}nd}|r8|�|�}nd}t| |||||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
    r   N)�append)�re�compile�I�_add_filter)�actionr   r
   �moduler   r4   r5   r   r   r   r   �   s    c             C   s   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
    N)r4   )r8   )r9   r
   r   r4   r   r   r   r   �   s    c             G   sR   | s6yt �|� W n tk
r&   Y nX t �d|� n|t krHt �|� t�  d S )Nr   )�filters�remove�
ValueError�insertr4   �_filters_mutated)r4   �itemr   r   r   r8   �   s    
r8   c               C   s   g t dd�<