U e5d�L�@s�dZddlZddddddd d gZdd+d�Zd?d,d�ZGd-d.�d.e�ZGd/d �d e�Zd0d1�Zz0dd2lmZm Z m!Z!mZmZm"Z"e Z#e!Z$d3Z%Wn2e&k �rngZd4Z#iZ$d*a'd5d6�Z"dZ%YnXeej(�e%�s�e)ed7��s�e d4e*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_warningscCst||||||�}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/lib64/python3.8/warnings.pyr scCst||||d|�}t|�S)�.Function to format a warning the standard way.N)r �_formatwarnmsg_impl)r rrrrrrrrrscCsP|j}|dkr tj}|dkr dSt|�}z|�|�Wntk rJYnXdS�N)r�sys�stderr�_formatwarnmsg�write�OSError)rr�textrrrr sr c Cs�|jj}|j�d|j�d|�d|j�d�}|jdkrpzddl}|�|j|j�}Wqvtk rld}d}YqvXn|j}|r�|� �}|d|7}|j dk �r�z ddl }Wntk r�d}d}Yn4X|� �}z|� |j �}Wntk r�d}YnX|dk �r�|d7}|D]t}|d|j|jf7}z$|dk �rB|�|j|j�}nd}Wntk �rbd}YnX|�r |� �}|d |7}�q n|�s�||�d �7}|S) N�:z: � rz %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__rrr r� linecache�getline� Exception�strip�source� tracemalloc� is_tracing�get_object_traceback) rr�sr"rr'�tracing�tb�framerrrr#sT"         �  rcCsdzt}Wntk rYn= 0N��append) �AssertionError� isinstance�str�type� issubclass�Warning�int�re�compile�I� _add_filter)�actionr rr<rrArIrrrr�s& �� cCsH|dkstd|f��t|t�r(|dks0td��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 r7r>rr?Nr@)rBrCrHrL)rMrrrArrrr�s ��cGsR|s6zt�|�Wntk r&YnXt�d|�n|tkrHt�|�t�dS)Nr)�filters�remove� ValueError�insertrA�_filters_mutated)rA�itemrrrrL�s rLcCsgtdd�<t�dS)zAClear the list of warning filters, so that no filters are active.N)rNrRrrrrr�s c@seZdZdZdS)� _OptionErrorz,Exception used by option processing helpers.N)r!� __module__� __qualname__�__doc__rrrrrT�srTc CsN|D]D}z t|�Wqtk rF}ztd|tjd�W5d}~XYqXqdS)NzInvalid -W option ignored:)r)� _setoptionrT�printrr)�args�argrrrr�_processoptions�s  r\c Cs�|�d�}t|�dkr$td|f��t|�dkr<|�d�q$dd�|D�\}}}}}t|�}t|�}|sl|rtddl}|r�|�|�}|r�|�|�d}|r�zt|�}|dkr�t �Wq�t t fk r�td |f�d�Yq�Xnd}t |||||�dS) Nr�ztoo many fields (max 5): %rr6cSsg|] }|���qSr)r%)�.0r*rrr� �s�z_setoption..rz\Zzinvalid lineno %r) �split�lenrTrA� _getaction� _getcategoryrI�escaperHrP� OverflowErrorr)r[�partsrMr rr<rrIrrrrX�s2    � rXcCsB|sdS|dkrdSdD]}|�|�r|Sqtd|f��dS)Nr;�allr:)r;r:r9r<r=r8r>)� startswithrT)rM�arrrrb�s  rbcCs�|stSd|krddl}|}nJ|�d�\}}}zt|dd|g�}Wn$tk rftd|f�d�YnXzt||�}Wn$tk r�td|f�d�YnXt|t�s�td|f��|S)N�.rzinvalid module name: %rzunknown warning category: %rzinvalid warning category: %r) rG�builtins� rpartition� __import__� ImportErrorrT�getattr�AttributeErrorrF)r�m�klassr<�_�catrrrrc�s" rccCs|jj}d|kod|kS)zFSignal whether the frame is an internal CPython implementation detail.� importlib� _bootstrap)�f_code� co_filename)r-rrrr�_is_internal_framesrycCs"|j}|dk rt|�r|j}q|S)z;Find the next frame that doesn't involve CPython internals.N)�f_backry)r-rrr�_next_external_framesr{�c Cst|t�r|j}|dkrt}t|t�r0t|t�sDtd�t|�j���zV|dks\t t � d��rht � |�}n0t � d�}t |d�D]}t |�}|dkr~t�q~Wn"tk r�t j}d}d}YnX|j}|jj}|j}d|kr�|d} nd} |�di�} t||||| | ||�dS)z:Issue a warning, or maybe ignore it or raise an exception.Nz/category must be a Warning subclass, not '{:s}'r|rr!zZ__warningregistry__)rCrG� __class__� UserWarningrErFr1�formatr!ryr� _getframe�ranger{rP�__dict__� f_globalsrwrx�f_lineno� setdefaultr) r r� stacklevelr&r-�x�globalsrrr<�registryrrrrs> �      �cCs�t|�}|dkr8|pd}|dd���dkr8|dd�}|dkrDi}|�dd�tkrd|��t|d<t|t�r~t|�}|j}n |}||�}|||f} |�| �r�dSt D]V} | \} } } }}| dks�| � |�r�t || �r�|dks�|� |�r�|dks�||kr��qq�t } | dk�rdSddl }|�||�| dk�r2|�| dk�rfd || <||f}t�|��r\dSd t|<nf| d k�rrnZ| d k�r�d || <||df}|�|��r�dSd ||<n$| d k�r�d || <ntd | | f��t|||||�} t| �dS)Nz �����z.py�versionrr9r8r=r|r:r<r;z1Unrecognized action (%r) in warnings.filters: %s)rH�lower�get�_filters_version�clearrCrGrDr}rN�matchrF� defaultactionr"�getlines� onceregistry� RuntimeErrorr r3)r rrrr<r��module_globalsr&r�keyrSrMrrt�modZlnr"ZoncekeyZaltkeyrrrrGs|    �����             ��c@s"eZdZdZddd�Zdd�ZdS)r )r rrrrrr&NcCs>||_||_||_||_||_||_||_|r4|jnd|_dSr) r rrrrrr&r!�_category_name)�selfr rrrrrr&rrr�__init__�szWarningMessage.__init__cCsd|j|j|j|j|jfS)NzD{message : %r, category : %r, filename : %r, lineno : %s, line : %r})r r�rrr)r�rrr�__str__�s��zWarningMessage.__str__)NNN)r!rUrV�_WARNING_DETAILSr�r�rrrrr �s � r c@s8eZdZdZddd�dd�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. FN)�recordr<cCs(||_|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�r<rrrr��szcatch_warnings.__init__cCsPg}|jr|�d�|jtjdk r4|�d|j�t|�j}d|d�|�fS)Nz record=Truer�z module=%rz%s(%s)z, )r�rAr�rr�rEr!�join)r�rZ�namerrr�__repr__�s  zcatch_warnings.__repr__cCs~|jrtd|��d|_|jj|_|jdd�|j_|j��|jj|_|jj|_|j rvg}|j |j_|jj |j_|SdSdS)NzCannot enter %r twiceT) r�r�r�rN�_filtersrRr� _showwarningr r�rAr/)r��logrrr� __enter__�s       zcatch_warnings.__enter__cGs>|jstd|��|j|j_|j��|j|j_|j|j_dS)Nz%Cannot exit %r without entering first) r�r�r�r�rNrRr�rr )r��exc_inforrr�__exit__�s     zcatch_warnings.__exit__)r!rUrVrWr�r�r�r�rrrrr �s   cszd�j�d�g}�jdk rVddl�ddl}��fdd�}|�d�||�t|���7}d�|��d�}t |t d �d �dS) Nz coroutine 'z' was never awaited rc3s4t�j�D]$\}}}��||�}||||fVq dSr)�reversed� cr_originr#)rr�funcnamer��coror"rr�extract�s z*_warn_unawaited_coroutine..extractz-Coroutine created at (most recent call last) r6r �)rr�r&) rVr�r"� tracebackrA� format_list�listr��rstripr�RuntimeWarning)r�� msg_linesr�r�rrr�r�_warn_unawaited_coroutine�s �  r�)rN�_defaultaction� _onceregistryrrrRTr;cCs td7adS)Nr|)r�rrrrrRsrRZgettotalrefcount�__main__)rr<rAr9)rrA)NN)N)Nr|N)NNNN).rWr�__all__rrr rr/r3r4rrGrrrLrr$rTr\rXrbrcryr{rr�objectr r r�� _warningsrNr�r�rRr�r�Z_warnings_defaultsrnr�� warnoptions�hasattr�DeprecationWarning�PendingDeprecationWarning� ImportWarning�ResourceWarningrrrr�s|�  ; � #  )� GC    �