3 \8H� @sdZddlZddddddd d gZd;d d�Zdd,d�ZGd-d.�d.e�ZGd/d �d e�ZdZy0dd0lmZm Z m!Z!mZmZm"Z"e Z#e!Z$d1ZWn.e%k �rfgZd2Z#iZ$d*a&d3d4�Z"YnXeej'�e�se(e)gZ*e*j+e,�xe*D]Z-e d5e-d6��q�Wej.j/Z/e/d*k�r�d7Z0ne/�r�d2Z0nd5Z0e e0e1d*d8�e2ed9��r�d:Z3nd5Z3e e3e4d*d8�[dS)?z&Python part of the warnings subsystem.�N�warn� warn_explicit� showwarning� formatwarning�filterwarnings� simplefilter� resetwarnings�catch_warningscCst||||||�}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� /usr/lib64/python3.6/warnings.pyr scCst||||d|�}t|�S)z.Function to format a warning the standard way.N)r �_formatwarnmsg_impl)r r rrrrrrrrsc CsP|j}|dkr tj}|dkr dSt|�}y|j|�Wntk rJYnXdS)N)r�sys�stderr�_formatwarnmsg�write�OSError)rr�textrrrr sr cCsLd|j|j|jj|jf}|jdkr`yddl}|j|j|j�}Wqftk r\d}d}YqfXn|j}|r~|j �}|d|7}|j dk �rHyddl }|j |j �}Wntk r�d}YnX|dk �rH|d7}xx|D]p}|d|j|jf7}y$|dk �r |j|j|j�}nd}Wntk �r*d}YnX|r�|j �}|d|7}q�W|S)Nz%s:%s: %s: %s rz %s z.Object allocated at (most recent call first): z File "%s", lineno %s z %s ) rrr �__name__r r� linecache�getline� Exception�strip�source� tracemalloc�get_object_traceback)r�srrr"�tb�framerrrr#sF          rcCsdyt}Wntk rYn= 0)�append)r0r1r2r3r4r5) �re�AssertionError� isinstance�str�type� issubclass�Warning�int� _add_filter�compile�I)�actionr r r4rr6r7rrrrws cCsH|d kstd|f��t|t�r(|dks0td ��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 r0r1r2r3r4r5zinvalid action: %rrzlineno must be an int >= 0N)r6)r0r1r2r3r4r5)r8r9r>r?)rBr rr6rrrr�s c GsR|s6ytj|�Wntk r&YnXtjd|�n|tkrHtj|�t�dS)Nr)�filters�remove� ValueError�insertr6�_filters_mutated)r6�itemrrrr?�s r?cCsgtdd�<t�dS)zAClear the list of warning filters, so that no filters are active.N)rCrGrrrrr�s c@seZdZdZdS)� _OptionErrorz,Exception used by option processing helpers.N)r� __module__� __qualname__�__doc__rrrrrI�srIcCsRxL|D]D}y t|�Wqtk rH}ztd|tjd�WYdd}~XqXqWdS)NzInvalid -W option ignored:)r)� _setoptionrI�printrr)�args�argrrrr�_processoptions�s   rQcCs�ddl}|jd�}t|�dkr,td|f��xt|�dkrF|jd�q.Wdd�|D�\}}}}}t|�}|j|�}t|�}|j|�}|r�|d}|r�yt|�}|dkr�t �Wq�t t fk r�td |f��Yq�Xnd}t |||||�dS) Nr�:�ztoo many fields (max 5): %rr/cSsg|] }|j��qSr)r )�.0r$rrr� �sz_setoption..�$zinvalid lineno %r) r7�split�lenrIr6� _getaction�escape� _getcategoryr>rE� OverflowErrorr)rPr7�partsrBr r r4rrrrrM�s.    rMcCsB|sdS|dkrdSxd D]}|j|�r|SqWtd|f��dS) Nr3�allr2r1r4r5r0zinvalid action: %r)r3r2r1r4r5r0)� startswithrI)rB�arrrrY�s  rYcCs�ddl}|stS|jd|�rNy t|�}Wq�tk rJtd|f��Yq�Xn�|jd�}|d|�}||dd�}yt|dd|g�}Wn"tk r�td|f��YnXyt ||�}Wn"t k r�td|f��YnXt |t�s�td|f��|S)Nrz^[a-zA-Z0-9_]+$zunknown warning category: %r�.�zinvalid module name: %rzinvalid warning category: %r) r7r=�match�evalr'rI�rfind� __import__� ImportError�getattr�AttributeErrorr<)r r7�cat�ir4�klass�mrrrr[�s,     r[cCs|jj}d|kod|kS)zFSignal whether the frame is an internal CPython implementation detail.� importlib� _bootstrap)�f_code� co_filename)r&rrrr�_is_internal_frame�srrcCs&|j}x|dk r t|�r |j}qW|S)z;Find the next frame that doesn't involve CPython internals.N)�f_backrr)r&rrr�_next_external_frames rtrbc Csvt|t�r|j}|dkrt}t|t�o.t|t�sDtdjt|�j���yZ|dks\t t j d��rht j |�}n4t j d�}x(t |d�D]}t |�}|dkr�t�q�WWntk r�t j}d}YnX|j}|j}d|kr�|d}nd}|jd�} | �r| j�} | jd��rP| dd �} n>|dk�rFyt jd } Wntk �rDd} YnX| �sP|} |jd i�} t||| ||| ||�dS) z:Issue a warning, or maybe ignore it or raise an exception.Nz/category must be a Warning subclass, not '{:s}'rbrz�__file__z.pyc�__main__rZ__warningregistry__�����)r9r=� __class__� UserWarningr;r<r*�formatrrrr� _getframe�rangertrE�__dict__� f_globals�f_lineno�get�lower�endswith�argvri� setdefaultr) r r � stacklevelr!r&�x�globalsrr4rZfnl�registryrrrr sL           cCs�t|�}|dkr8|pd}|dd�j�dkr8|dd�}|dkrDi}|jdd�tkrd|j�t|d<t|t�r~t|�}|j}n |}||�}|||f} |j| �r�dSx^t D]R} | \} } } }}| dks�| j |�r�t || �r�|dks�|j |�r�|dks�||kr�Pq�Wt } | dk�rd|| <dSddl }|j||�| dk�r:|�| d k�rnd|| <||f}tj|��rddSdt|<nf| d k�rznZ| d k�r�d|| <||df}|j|��r�dSd||<n$| d k�r�d|| <ntd | | f��t|||||�} t| �dS)Nz �z.py�versionrr1rbr0r5r2r4r3z1Unrecognized action (%r) in warnings.filters: %s�����r�)r>r�r��_filters_version�clearr9r=r:rxrCrcr<� defaultactionr�getlines� onceregistry� RuntimeErrorr r,)r r rrr4r��module_globalsr!r�keyrHrBrrj�mod�lnrZoncekeyZaltkeyrrrrAsl                    c@s"eZdZd Zdd d �Zd d �ZdS)r r r rrrrr!Nc Cs:t�}x|jD]} t|| || �qW|r0|jnd|_dS)N)�locals�_WARNING_DETAILS�setattrr�_category_name) �selfr r rrrrr!� local_values�attrrrr�__init__�s zWarningMessage.__init__cCsd|j|j|j|j|jfS)NzD{message : %r, category : %r, filename : %r, lineno : %s, line : %r})r r�rrr)r�rrr�__str__�szWarningMessage.__str__)r r rrrrr!)NNN)rrJrKr�r�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)�recordr4cCs(||_|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�r4rrrr��szcatch_warnings.__init__cCsPg}|jr|jd�|jtjdk r4|jd|j�t|�j}d|dj|�fS)Nz record=Truer�z module=%rz%s(%s)z, )r�r6r�rr�r;r�join)r�rO�namerrr�__repr__�s  zcatch_warnings.__repr__cCs~|jrtd|��d|_|jj|_|jdd�|j_|jj�|jj|_|jj|_|j rvg}|j |j_|jj |j_|SdSdS)NzCannot enter %r twiceT) r�r�r�rC�_filtersrGr� _showwarningr r�r6r()r��logrrr� __enter__�s       zcatch_warnings.__enter__cGs>|jstd|��|j|j_|jj�|j|j_|j|j_dS)Nz%Cannot exit %r without entering first) r�r�r�r�rCrGr�rr )r��exc_inforrr�__exit__�s     zcatch_warnings.__exit__)rrJrKrLr�r�r�r�rrrrr �s   )rC�_defaultaction� _onceregistryrrrGTr3cCs td7adS)Nrb)r�rrrrrG�srGr1)r r0)r r6�gettotalrefcountr2)NN)N)NrbN)NNNN)5rLr�__all__rrr rr(r,r-rr=rrr?rrrIrQrMrYr[rrrtrr�objectr r Z_warnings_defaults� _warningsrCr�r�rGr�r�rgr�� warnoptions� ImportWarning�PendingDeprecationWarningZsilencer6�DeprecationWarning�cls�flags� bytes_warningZ bytes_action� BytesWarning�hasattrZresource_action�ResourceWarningrrrr�sv  0    5 FJ