File: //lib/python3.10/__pycache__/warnings.cpython-310.pyc
o
    E�h�L  �                   @   s�  d Z ddlZg d�Zd=dd�Zd>dd�Zdd	� Zd
d� ZeZdd
� ZeZ	dd� Z
dedddfdd�Zeddfdd�Z
dd� Zdd� ZG dd� de�Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd?d)d*�Z		d@d+d,�ZG d-d.� d.e�ZG d/d0� d0e�Zd1d2� Zzdd3lmZm Z m!Z!mZmZm"Z" e Z#e!Z$d4Z%W n e&y�   g Zd5Z#i Z$d(a'd6d7� Z"dZ%Y nw eej(� e%s�e)ed8�s�ed5e*d9d(d:� e
d;e*d(d<� e
d;e+d(d<� e
d;e,d(d<� e
d;e-d(d<� [%dS )Az&Python part of the warnings subsystem.�    N)�warn�
warn_explicit�showwarning�
formatwarning�filterwarnings�simplefilter�
resetwarnings�catch_warningsc                 C   s   t | |||||�}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/lib/python3.10/warnings.pyr   
   s   r   c                 C   s   t | |||d|�}t|�S )�.Function to format a warning the standard way.N)r   �_formatwarnmsg_impl)r
   r   r   r   r   r   r   r   r   r      s   r   c                 C   sN   | j }|d u rtj}|d u rd S t| �}z|�|� W d S  ty&   Y d S w �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 u r6zdd l}|�| j| j�}W n ty5   d }d }Y nw | j}|rE|�	� }|d| 7 }| j
d ur�zdd l}W n
 ty]   d}d }Y nw |�� }z|�
| j
�}W n tyu   d }Y nw |d ur�|d7 }|D ]5}|d|j|jf 7 }z|d ur�|�|j|j�}nd }W n ty�   d }Y nw |r�|�	� }|d	| 7 }q�|S |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"