Viewing File: /opt/alt/python38/lib64/python3.8/site-packages/yaml/__pycache__/constructor.cpython-38.pyc

U

b`o@s^ddddddgZddlTddlTdd	lZdd	lZdd	lZdd	lZdd	lZdd	l	Z	dd	l
Z
Gd
ddeZGdddZ
Gddde
Zed
ejedejedejedejedejedejedejedejedejedejedejedejed	ejGdddeZedejedejedejedejedej edejed ej!ed!ejed"ej"ed#ejed$ej#ed%eje$d&ej%Gd'ddeZ&e&$d(e&j'e&$d)e&j(e&$d*e&j)e&$d+e&j*Gd,dde&Z+d	S)-BaseConstructorSafeConstructorFullConstructorUnsafeConstructorConstructorConstructorError)*Nc@seZdZdS)rN__name__
__module____qualname__rrC/opt/alt/python38/lib64/python3.8/site-packages/yaml/constructor.pyrsc@seZdZiZiZddZddZddZddZd	d
Z	ddZ
dddZddZdddZ
dddZd ddZeddZeddZdS)!rcCsi|_i|_g|_d|_dSNF)constructed_objectsrecursive_objectsstate_generatorsdeep_constructselfrrr__init__szBaseConstructor.__init__cCs|SN)
check_noderrrr
check_dataszBaseConstructor.check_datacCs&||r"tddd|fddS)zBlock special attributes/methods from being set in a newly created
        object, to prevent user-controlled methods from being called during
        deserializationNz,blacklisted key '%s' in instance state found)get_state_keys_blacklist_regexpmatchr)rkeyrrrcheck_state_key"s
zBaseConstructor.check_state_keycCs|r||SdSr)rconstruct_documentZget_noderrrrget_data*szBaseConstructor.get_datacCs|}|dk	r||SdSr)Zget_single_noderrnoderrrget_single_data/s
zBaseConstructor.get_single_datacCsH||}|jr2|j}g|_|D]}|D]}q(q q
i|_i|_d|_|Sr)construct_objectrrrr)rr"datar	generatordummyrrrr6s
z"BaseConstructor.construct_documentFc
Cs||jkr|j|S|r$|j}d|_||jkr>tddd|jd|j|<d}d}|j|jkrj|j|j}n|jD]:}|dk	rp|j|rp|jt	|d}|j|}qqpd|jkr|j}|jd}nTd|jkr|jd}n>t
|tr|jj
}n*t
|tr|jj}nt
|tr|jj}|dkr2|||}n||||}t
|tjrz|}t|}|jrn|D]}	qdn|j|||j|<|j|=|r||_|S)NTz$found unconstructable recursive node)rrrr
start_marktagyaml_constructorsyaml_multi_constructors
startswithlen
isinstance
ScalarNode	__class__construct_scalarSequenceNodeconstruct_sequenceMappingNodeconstruct_mappingtypes
GeneratorTypenextrappend)
rr"deepZold_deepconstructorZ
tag_suffix
tag_prefixr%r&r'rrrr$Cs\












z BaseConstructor.construct_objectcCs&t|ts tddd|j|j|jS)Nz$expected a scalar node, but found %s)r.r/ridr(valuer!rrrr1us
z BaseConstructor.construct_scalarcs6t|ts tddd|j|jfdd|jDS)Nz&expected a sequence node, but found %scsg|]}j|dqS)r:)r$).0Zchildr:rrr
<listcomp>sz6BaseConstructor.construct_sequence.<locals>.<listcomp>)r.r2rr=r(r>rr"r:rrArr3|s
z"BaseConstructor.construct_sequencecCs|t|ts tddd|j|ji}|jD]L\}}|j||d}t|tjj	s`td|jd|j|j||d}|||<q*|S)N%expected a mapping node, but found %sr?while constructing a mappingzfound unhashable key)
r.r4rr=r(r>r$collectionsabcHashable)rr"r:mappingkey_node
value_noderr>rrrr5s 

z!BaseConstructor.construct_mappingcCsbt|ts tddd|j|jg}|jD]2\}}|j||d}|j||d}|||fq*|S)NrDr?)r.r4rr=r(r>r$r9)rr"r:pairsrJrKrr>rrrconstruct_pairss
zBaseConstructor.construct_pairscCs$d|jkr|j|_||j|<dS)Nr*)__dict__r*copy)clsr)r;rrradd_constructors
zBaseConstructor.add_constructorcCs$d|jkr|j|_||j|<dS)Nr+)rNr+rO)rPr<Zmulti_constructorrrradd_multi_constructors
z%BaseConstructor.add_multi_constructorN)F)F)F)F)rrr
r*r+rrrr r#rr$r1r3r5rMclassmethodrQrRrrrrrs"
2



cseZdZfddZddZd(fdd	Zdd	Zd
dd
dd
ddZdd
ZddZ	dZ
e
e
e
krne
e
9Z
qXe
e
ZddZddZ
edejZddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'ZZS))rcs>t|tr2|jD] \}}|jdkr||Sqt|S)Ntag:yaml.org,2002:value)r.r4r>r)r1super)rr"rJrKr0rrr1s


z SafeConstructor.construct_scalarc	Csg}d}|t|jkr|j|\}}|jdkr|j|=t|trZ||||jnt|trg}|jD]<}t|tstd|j	d|j
|j	||||jqn||D]}||qntd|j	d|j
|j	q|jdkrd|_|d7}q|d7}q|r||j|_dS)	Nr	ztag:yaml.org,2002:mergerEz,expected a mapping for merging, but found %sz@expected a mapping or list of mappings for merging, but found %srTtag:yaml.org,2002:strr)
r-r>r)r.r4flatten_mappingextendr2rr(r=r9reverse)	rr"mergeindexrJrKZsubmergesubnoder>rrrrXsJ









zSafeConstructor.flatten_mappingFcs$t|tr||tj||dS)Nr?)r.r4rXrUr5rCrVrrr5s

z!SafeConstructor.construct_mappingcCs||dSrr1r!rrrconstruct_yaml_nulls
z#SafeConstructor.construct_yaml_nullT)ZyesZnotrueZfalseZonZoffcCs||}|j|Sr)r1bool_valueslower)rr"r>rrrconstruct_yaml_bools
z#SafeConstructor.construct_yaml_boolcCs||}|dd}d}|ddkr*d}|ddkrB|dd}|dkrNdS|d	rn|t|d
dd
S|dr|t|d
ddS|ddkr|t|d
Sd|krdd|dD}|d}d}|D]}|||7}|d9}q||S|t|SdS)N_rr	-+-0Z0bZ0x:cSsg|]}t|qSr)intr@partrrrrBsz6SafeConstructor.construct_yaml_int.<locals>.<listcomp><)r1replacer,rnsplitrZrr"r>ZsignZdigitsbaseZdigitrrrconstruct_yaml_ints2




z"SafeConstructor.construct_yaml_intgu<7~cCs||}|dd}d}|ddkr.d}|ddkrF|dd}|dkrX||jS|d	krf|jSd
|krdd|d
D}|d}d
}|D]}|||7}|d9}q||S|t|SdS)Nrdrerr	rfrgrhz.infz.nanrmcSsg|]}t|qSr)floatrorrrrBsz8SafeConstructor.construct_yaml_float.<locals>.<listcomp>grq)r1rrrb	inf_value	nan_valuersrZrwrtrrrconstruct_yaml_floats*


z$SafeConstructor.construct_yaml_floatc
Csz||d}Wn6tk
rJ}ztddd||jW5d}~XYnXz&ttdrdt|WSt|WSWn8t	j
k
r}ztddd||jW5d}~XYnXdSNasciiz,failed to convert base64 data into ascii: %sdecodebytesz failed to decode base64 data: %sr1encodeUnicodeEncodeErrorrr(hasattrbase64r}ZdecodestringbinasciiErrorrr"r>excrrrconstruct_yaml_binary&s 
z%SafeConstructor.construct_yaml_binarya^(?P<year>[0-9][0-9][0-9][0-9])
                -(?P<month>[0-9][0-9]?)
                -(?P<day>[0-9][0-9]?)
                (?:(?:[Tt]|[ \t]+)
                (?P<hour>[0-9][0-9]?)
                :(?P<minute>[0-9][0-9])
                :(?P<second>[0-9][0-9])
                (?:\.(?P<fraction>[0-9]*))?
                (?:[ \t]*(?P<tz>Z|(?P<tz_sign>[-+])(?P<tz_hour>[0-9][0-9]?)
                (?::(?P<tz_minute>[0-9][0-9]))?))?)?$c
Cs<||}|j|j}|}t|d}t|d}t|d}|dsZt|||St|d}t|d}	t|d}
d}d}|dr|ddd	}t|d	kr|d
7}qt|}|drt|d}
t|d
pd}tj	|
|d}|ddkr|}t
|}n|dr"tj
j}tj|||||	|
||dS)Nyearmonthdayhourminutesecondr	fractionriZtz_signtz_hour	tz_minute)ZhoursZminutesrfZtz)tzinfo)r1timestamp_regexprr>	groupdictrndatetimedater-Z	timedeltatimezoneZutc)rr"r>rvaluesrrrrrrrrrrZdeltarrrconstruct_yaml_timestampBs<



z(SafeConstructor.construct_yaml_timestampccsg}|Vt|ts,td|jd|j|j|jD]}t|tsXtd|jd|j|jt|jdkrtd|jdt|j|j|jd\}}||}||}|	||fq2dS)Nz!while constructing an ordered map!expected a sequence, but found %s,expected a mapping of length 1, but found %sr2expected a single mapping item, but found %d itemsr	
r.r2rr(r=r>r4r-r$r9)rr"Zomapr]rJrKrr>rrrconstruct_yaml_omapas,




z#SafeConstructor.construct_yaml_omapccsg}|Vt|ts,td|jd|j|j|jD]}t|tsXtd|jd|j|jt|jdkrtd|jdt|j|j|jd\}}||}||}|	||fq2dS)Nzwhile constructing pairsrrrrr	r)rr"rLr]rJrKrr>rrrconstruct_yaml_pairsws,




z$SafeConstructor.construct_yaml_pairsccs$t}|V||}||dSr)setr5updaterr"r%r>rrrconstruct_yaml_sets
z"SafeConstructor.construct_yaml_setcCs
||Srr^r!rrrconstruct_yaml_strsz"SafeConstructor.construct_yaml_strccsg}|V|||dSr)rYr3)rr"r%rrrconstruct_yaml_seqsz"SafeConstructor.construct_yaml_seqccs"i}|V||}||dSr)r5rrrrrconstruct_yaml_maps
z"SafeConstructor.construct_yaml_mapccsN||}|Vt|dr4|j|dd}||n||}|j|dS)N__setstate__Tr?)__new__rr5rrNr)rr"rPr%staterrrconstruct_yaml_objects


z%SafeConstructor.construct_yaml_objectcCstddd|j|jdS)Nz0could not determine a constructor for the tag %r)rr)r(r!rrrconstruct_undefinedsz#SafeConstructor.construct_undefined)F)rrr
r1rXr5r_rarcrvrxryrzrrecompileXrrrrrrrrrr
__classcell__rrrVrrs@#	

	
ztag:yaml.org,2002:nullztag:yaml.org,2002:boolztag:yaml.org,2002:intztag:yaml.org,2002:floatztag:yaml.org,2002:binaryztag:yaml.org,2002:timestampztag:yaml.org,2002:omapztag:yaml.org,2002:pairsztag:yaml.org,2002:setrWztag:yaml.org,2002:seqztag:yaml.org,2002:mapc@seZdZddZddZddZddZd	d
ZddZd
dZ	ddZ
d%ddZd&ddZddZ
ddZd'ddZd(ddZdd Zd)d!d"Zd#d$ZdS)*rcCsddgS)Nz^extend$z^__.*__$rrrrrget_state_keys_blacklistsz(FullConstructor.get_state_keys_blacklistcCs.t|ds(tdd|d|_|jS)Nstate_keys_blacklist_regexp(|))rrrjoinrrrrrrrs
z/FullConstructor.get_state_keys_blacklist_regexpcCs
||Srr^r!rrrconstruct_python_strsz$FullConstructor.construct_python_strcCs
||Srr^r!rrrconstruct_python_unicodesz(FullConstructor.construct_python_unicodec
Csz||d}Wn6tk
rJ}ztddd||jW5d}~XYnXz&ttdrdt|WSt|WSWn8t	j
k
r}ztddd||jW5d}~XYnXdSr{r~rrrrconstruct_python_bytess 
z&FullConstructor.construct_python_bytescCs
||Sr)rvr!rrrconstruct_python_longsz%FullConstructor.construct_python_longcCst||Sr)complexr1r!rrrconstruct_python_complexsz(FullConstructor.construct_python_complexcCst||Sr)tupler3r!rrrconstruct_python_tuple
sz&FullConstructor.construct_python_tupleFc
Cs|std|d||r\zt|Wn8tk
rZ}ztd|d||f|W5d}~XYnX|tjkrxtd|d||tj|S)N"while constructing a Python module+expected non-empty name appended to the tagcannot find module %r (%s)module %r is not imported)r
__import__ImportErrorsysmodules)rnamemarkunsaferrrrfind_python_module
s&

z"FullConstructor.find_python_modulec
Cs|std|d|d|kr,|dd\}}nd}|}|r~zt|Wn8tk
r|}ztd|d||f|W5d}~XYnX|tjkrtd|d||tj|}t||std|d||jf|t||S)	Nz"while constructing a Python objectr.rbuiltinsrrzcannot find %r in the module %r)	rrsplitrrrrrrgetattr)rrrrZmodule_nameZobject_namermodulerrrfind_python_names>



z FullConstructor.find_python_namecCs2||}|r$td|jd||j|||jS)Nz while constructing a Python name&expected the empty value, but found %r)r1rr(rrsuffixr"r>rrrconstruct_python_name5s
z%FullConstructor.construct_python_namecCs2||}|r$td|jd||j|||jS)Nrr)r1rr(rrrrrconstruct_python_module<s
z'FullConstructor.construct_python_moduleNcCst|sg}|si}|||j}|sFt|tsFtd|jdt||j|rft|trf|j|f||S|||SdS)Nz$while constructing a Python instancezexpected a class, but found %r)rr(r.typerr)rrr"argskwdsnewobjrrPrrrmake_python_instanceCs
z$FullConstructor.make_python_instancecCst|dr||ni}t|tr8t|dkr8|\}}t|drp|sb|rb|D]}||qR|j|n|r~|||	D]"\}}|s||t
|||qdS)NrrjrN)rrr.rr-keysrrNritemssetattr)rinstancerrZ	slotstaterr>rrrset_python_instance_stateSs 



z)FullConstructor.set_python_instance_stateccs>|j||dd}|Vt|d}|j||d}|||dS)NTrrr?)rrr5r)rrr"rr:rrrrconstruct_python_objectfs

z'FullConstructor.construct_python_objectcCst|tr*|j|dd}i}i}g}i}nJ|j|dd}	|	dg}|	di}|	di}|	dg}|	di}||||||}
|r||
||r|
||r|D]}|||
|<q|
S)NTr?rrr	listitems	dictitems)r.r2r3r5getrrrY)rrr"rrrrrrr>rrrrrconstruct_python_object_applyos*

z-FullConstructor.construct_python_object_applycCs|j||ddS)NTr)r)rrr"rrrconstruct_python_object_newsz+FullConstructor.construct_python_object_new)F)F)NNFF)F)F)rrr
rrrrrrrrrrrrrrrrrrrrrrs*



	
#ztag:yaml.org,2002:python/noneztag:yaml.org,2002:python/boolztag:yaml.org,2002:python/strz tag:yaml.org,2002:python/unicodeztag:yaml.org,2002:python/bytesztag:yaml.org,2002:python/intztag:yaml.org,2002:python/longztag:yaml.org,2002:python/floatz tag:yaml.org,2002:python/complexztag:yaml.org,2002:python/listztag:yaml.org,2002:python/tupleztag:yaml.org,2002:python/dictztag:yaml.org,2002:python/name:csBeZdZfddZfddZdfdd	Zfd	d
ZZS)rcstt|j||ddSNT)r)rUrrrrrrVrrrsz$UnsafeConstructor.find_python_modulecstt|j||ddSr)rUrrrrVrrrsz"UnsafeConstructor.find_python_nameNFcstt|j|||||ddSr)rUrr)rrr"rrrrVrrrs
z&UnsafeConstructor.make_python_instancecstt|j||ddSr)rUrr)rrrrVrrrs

z+UnsafeConstructor.set_python_instance_state)NNF)rrr
rrrrrrrrVrrsz tag:yaml.org,2002:python/module:z tag:yaml.org,2002:python/object:z$tag:yaml.org,2002:python/object/new:z&tag:yaml.org,2002:python/object/apply:c@seZdZdS)rNr
rrrrrs),__all__errorZnodesZcollections.abcrFrrrrrr6ZMarkedYAMLErrorrrrrQr_rcrvrzrrrrrrrrrrrrrrrrrRrrrrrrrrrrr<module>s	84
Back to Directory File Manager