Viewing File: /opt/alt/python35/lib64/python3.5/__pycache__/warnings.cpython-35.opt-1.pyc



Yf=@sdZddlZddddddd	d
gZddddZdddZd
ed
ddddZeddddZddZdd	Z	Gddde
ZddZddZ
ddZddZddZd d!Zdd"d#dZdddd$dZGd%d&d&eZGd'd
d
eZdZyDdd(lmZmZmZmZmZmZeZeZd)ZWn6ek
rgZd*ZiZd"a d+d,ZYnXeej!ese"e#gZ$e$j%e&xe$D]Z'ed-d.e'qWej(j)Z)e)d"kr;d/Z*ne)rJd*Z*nd-Z*ee*d.e+d0d"e,ed1r~d2Z-nd-Z-ee-d.e.d0d"[dS)3z&Python part of the warnings subsystem.Nwarn
warn_explicitshowwarning
formatwarningfilterwarningssimplefilter
resetwarningscatch_warningsc
Csa|dkr%tj}|dkr%dSy#|jt|||||Wntk
r\YnXdS)z7Hook to write a warning to a file; replace if you like.N)sysstderrwriterOSError)messagecategoryfilenamelinenofileliner-/opt/alt/python35/lib64/python3.5/warnings.pyr
s	#
cCsd|||j|f}|dkrby"ddl}|j||}Wntk
rad}YnX|r|j}|d|7}|S)z.Function to format a warning the standard way.z%s:%s: %s: %s
Nrz  %s
)__name__	linecachegetline	Exceptionstrip)rrrrrsrrrrrs
FcCsDddl}t||j||j||j||d|dS)aInsert 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
    rNappend)re_add_filtercompileI)actionrrmodulerrrrrrr&s	cCs t|d|d|d|dS)aInsert 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
    Nr)r)r"rrrrrrr>scGsc|s?ytj|Wntk
r+YnXtjd|n|tkrXtj|tdS)Nr)filtersremove
ValueErrorinsertr_filters_mutated)ritemrrrrNs

rcCsgtdd<tdS)zAClear the list of warning filters, so that no filters are active.N)r$r(rrrrr\sc@seZdZdZdS)_OptionErrorz,Exception used by option processing helpers.N)r
__module____qualname____doc__rrrrr*asr*cCsaxZ|D]R}yt|Wqtk
rX}ztd|dtjWYdd}~XqXqWdS)NzInvalid -W option ignored:r)
_setoptionr*printr
r)argsargmsgrrr_processoptionsfs

r3cCsGddl}|jd}t|dkr@td|fx#t|dkre|jdqCWdd|D\}}}}}t|}|j|}t|}|j|}|r|d}|r'y"t|}|dkrt	Wq-t	t
fk
r#td	|fYq-Xnd}t|||||dS)
Nr:ztoo many fields (max 5): %rrcSsg|]}|jqSr)r).0rrrr
<listcomp>us	z_setoption.<locals>.<listcomp>$zinvalid lineno %r)rsplitlenr*r
_getactionescape_getcategoryintr&
OverflowErrorr)r1rpartsr"rrr#rrrrr.ns.	

r.cCsU|s
dS|dkrdSx!d	D]}|j|r!|Sq!Wtd|fdS)
Ndefaultallalwaysignorer#onceerrorzinvalid action: %r)rArCrDr#rErF)
startswithr*)r"arrrr;s
r;cCs;ddl}|stS|jd|rcyt|}Wqtk
r_td|fYqXn|jd}|d|}||dd}yt|dd|g}Wn%tk
rtd|fYnXyt	||}Wn%t
k
rtd|fYnXt|ts7td|f|S)Nrz^[a-zA-Z0-9_]+$zunknown warning category: %r.zinvalid module name: %rzinvalid warning category: %r)rWarningmatcheval	NameErrorr*rfind
__import__ImportErrorgetattrAttributeError
issubclass)rrcatir#klassmrrrr=s,


r=cCs"|jj}d|ko!d|kS)zFSignal whether the frame is an internal CPython implementation detail.	importlib
_bootstrap)f_codeco_filename)framerrrr_is_internal_framesr^cCs5|j}x%|dk	r0t|r0|j}qW|S)z;Find the next frame that doesn't involve CPython internals.N)f_backr^)r]rrr_next_external_frames	
r`rJcCst|tr|j}|dkr*t}t|toEt|tsftdjt|jy|dkst	t
jdrt
j|}nHt
jd}x6t|dD]$}t
|}|dkrtqWWn!tk
rt
j}d}YnX|j}|j}d|kr4|d}nd}|jd}|r}|j}	|	jdr|dd}nD|dkryt
jd	}Wntk
rd}YnX|s|}|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}'rJrz<string>__file__z.pyc__main__rZ__warningregistry__)
isinstancerK	__class__UserWarningtyperT	TypeErrorformatrr^r
	_getframeranger`r&__dict__	f_globalsf_linenogetlowerendswithargvrS
setdefaultr)rr
stacklevelr]xglobalsrr#rZfnlregistryrrrrsL		!
			

cCst|}|dkrP|p!d}|ddjdkrP|dd}|dkrbi}|jddtkr|jt|d<t|trt|}|j}n|}||}|||f}|j|rdSxt	D]y}	|	\}
}}}
}|dks&|j
|rt||r|
dksP|
j
|r|dksh||krPqWt}
|
dkrd||<dSddl
}|j|||
dkr||
d	krd||<||f}tj|rdSdt|<n|
d
krnt|
dkrQd||<||df}|j|rDdSd||<n/|
dkrjd||<ntd
|
|	fttstdt||||dS)Nz	<unknown>z.pyversionrrDrJrFrErCr#rAz1Unrecognized action (%r) in warnings.filters:
 %sz:warnings.showwarning() must be set to a function or methodrz)r>rpro_filters_versionclearrdrKstrrer$rLrT
defaultactionrgetlinesonceregistryRuntimeErrorcallablerrh)rrrrr#rwmodule_globalstextkeyr)r"r2rUmodlnrZoncekeyZaltkeyrrrrsn








c@s:eZdZdZd
Zddd	d
ZddZdS)WarningMessagez0Holds the result of a single showwarning() call.rrrrrrNc	CsMt}x%|jD]}t||||qW|r@|jnd|_dS)N)locals_WARNING_DETAILSsetattrr_category_name)	selfrrrrrrlocal_valuesattrrrr__init__@s	zWarningMessage.__init__cCs&d|j|j|j|j|jfS)NzD{message : %r, category : %r, filename : %r, lineno : %s, line : %r})rrrrr)rrrr__str__GszWarningMessage.__str__)rrrrrr)rr+r,r-rrrrrrrr9src@sReZdZdZddddddZdd	Zd
dZdd
ZdS)r	aA 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.

    recordFr#NcCs8||_|dkr"tjdn||_d|_dS)zSpecify 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.

        NwarningsF)_recordr
modules_module_entered)rrr#rrrr^s	"zcatch_warnings.__init__cCslg}|jr|jd|jtjdk	rF|jd|jt|j}d|dj|fS)Nzrecord=Truerz	module=%rz%s(%s)z, )rrrr
rrgrjoin)rr0namerrr__repr__js	
zcatch_warnings.__repr__cs|jrtd|d|_|jj|_|jdd|j_|jj|jj|_|jrgfdd}||j_SdSdS)NzCannot enter %r twiceTcsjt||dS)N)rr)r0kwargs)logrrr}sz-catch_warnings.__enter__.<locals>.showwarning)	rrrr$_filtersr(r_showwarningr)rrr)rr	__enter__ss		
	zcatch_warnings.__enter__cGsH|jstd||j|j_|jj|j|j_dS)Nz%Cannot exit %r without entering first)rrrrr$r(rr)rexc_inforrr__exit__s
	
zcatch_warnings.__exit__)rr+r,r-rrrrrrrrr	Ms
	)r$_defaultaction
_onceregistryrrr(TrAcCstd7adS)NrJ)r{rrrrr(sr(rDrrFrgettotalrefcountrC)/r-r
__all__rrrKrrrrrr*r3r.r;r=r^r`rrobjectrr	Z_warnings_defaults	_warningsr$rrr(r~rrQr{warnoptions
ImportWarningPendingDeprecationWarningZsilencerDeprecationWarningclsflags
bytes_warningZbytes_actionBytesWarninghasattrZresource_actionResourceWarningrrrr<module>sh		
	5HG.




			
Back to Directory File Manager