Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/warnings.pyo

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�
��c	@s1dZddkZddkZddkZdddddgZgZdZhZdd	d
�Z	dddd�Z
dd�Zd
�Zde
dddd�Ze
ddd�Zd�Zdefd��YZd�Zd�Zd�Zd�Zeei�eddedd	�eddedd	�dS(s&Python part of the warnings subsystem.i�Ntwarntshowwarningt
formatwarningtfilterwarningst
resetwarningstdefaultic
Csdt|t�o
|i}n|djo
t}nyti|�}Wn"tj
oti}d}nX|i	}|i
}d|jo|d}nd}|id�}|o.|i�}|i
d�o|d }q2nP|djo1ytid	}Wq!tj
o
d}q!Xn|p
|}n|id
h�}	t||||||	|�dS(
s:Issue a warning, or maybe ignore it or raise an exception.it__name__s<string>t__file__s.pycs.pyoi�t__main__it__warningregistry__N(s.pycs.pyo(t
isinstancetWarningt	__class__tNonetUserWarningtsyst	_getframet
ValueErrort__dict__t	f_globalstf_linenotgettlowertendswithtargvtAttributeErrort
setdefaultt
warn_explicit(
tmessagetcategoryt
stackleveltcallertglobalstlinenotmoduletfilenametfnltregistry((s/sys/lib/python/warnings.pyRs:


			


c	Cs�|djo6|pd}|di�djo|d }qCn|djo
h}nt|t�ot|�}|i}n|}||�}|||f}|i|�odSnx�tD]�}	|	\}
}}}
}|djp|i|�oLt	||�o<|
djp|
i|�o|djp
||joPq�q�Wt
}
|
djod||<dSnti||�|
djo
|�n|
djo<d||<||f}t
i|�odSndt
|<n�|
d	jon~|
d
jo?d||<||df}|i|�odSnd||<n2|
djod||<ntd|
|	f��t||||�dS(
Ns	<unknown>i�s.pyitignoreiterrortoncetalwaysR"Rs1Unrecognized action (%r) in warnings.filters:
 %s(R
RR
RtstrRRtfilterstmatcht
issubclasst
defaultactiont	linecachetgetlinestonceregistrytRuntimeErrorR(RRR#R!R"R%tmodule_globalsttexttkeytitemtactiontmsgtcattmodtlntoncekeytaltkey((s/sys/lib/python/warnings.pyR@sb




	









c	CsT|djo
ti}ny |it||||��Wntj
onXdS(s7Hook to write a warning to a file; replace if you like.N(R
RtstderrtwriteRtIOError(RRR#R!tfile((s/sys/lib/python/warnings.pyR�s

 cCsRd|||i|f}ti||�i�}|o|d|d}n|S(s.Function to format a warning the standard way.s%s:%s: %s: %s
s  s
(RR/tgetlinetstrip(RRR#R!tstline((s/sys/lib/python/warnings.pyR�s
ticCseddk}||i||i�||i|�|f}|oti|�ntid|�dS(s�Insert an entry into the list of warnings filters (at the front).

    Use assertions to check that all arguments have the right type.i�Ni(tretcompiletIR+tappendtinsert(R7RRR"R!RJRGR6((s/sys/lib/python/warnings.pyR�s
cCsA|d|d|f}|oti|�ntid|�dS(s�Insert a simple entry into the list of warnings filters (at the front).

    A simple filter matches all modules and messages.
    iN(R
R+RJRK(R7RR!RJR6((s/sys/lib/python/warnings.pytsimplefilter�s	cCsgt(dS(sAClear the list of warning filters, so that no filters are active.N(R+(((s/sys/lib/python/warnings.pyR�st_OptionErrorcBseZdZRS(s,Exception used by option processing helpers.(Rt
__module__t__doc__(((s/sys/lib/python/warnings.pyRM�scCsNxG|D]?}yt|�Wqtj
o}tidI|IJqXqWdS(NsInvalid -W option ignored:(t
_setoptionRMRR>(targstargR8((s/sys/lib/python/warnings.pyt_processoptions�sc
Csoddk}|id�}t|�djotd|f��nx%t|�djo|id�qHWg}|D]}||i�qx~\}}}}}	t|�}|i|�}t|�}|i|�}|o|d}n|	oZy't	|	�}	|	djo
t
�nWqUt
tfj
otd|	f��qUXnd}	t|||||	�dS(	Ni�t:istoo many fields (max 5): %rRFt$isinvalid lineno %r(
RGtsplittlenRMRJRCt
_getactiontescapet_getcategorytintRt
OverflowErrorR(
RRRGtpartst_[1]RDR7RRR"R!((s/sys/lib/python/warnings.pyRP�s./
cCsd|pdSn|djodSnx&d	D]}|i|�o|Sq+q+Wtd|f��dS(
NRtallR)R&R"R(R'sinvalid action: %r(sdefaultsalwayssignoresmodulesonceserror(t
startswithRM(R7ta((s/sys/lib/python/warnings.pyRX�scCs>ddk}|ptSn|id|�o=yt|�}Wqtj
otd|f��qXn�|id�}|| }||d}yt|dd|g�}Wn&t	j
otd|f��nXyt
||�}Wn&tj
otd|f��nXt|t�ptd|f��n|S(Ni�s^[a-zA-Z0-9_]+$sunknown warning category: %rt.isinvalid module name: %rsinvalid warning category: %r(
RGRR,tevalt	NameErrorRMtrfindt
__import__R
tImportErrortgetattrRR-(RRGR9tiR"tklasstm((s/sys/lib/python/warnings.pyRZ�s,
R&RRJ(RORttypesR/t__all__R+R.R1R
RRRRRRRLRt	ExceptionRMRSRPRXRZtwarnoptionstPendingDeprecationWarningt
ImportWarning(((s/sys/lib/python/warnings.pys<module>s.	
)?						
	


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.