Viewing File: /opt/alt/python35/lib64/python3.5/site-packages/yaml/__pycache__/constructor.cpython-35.pyc



5[c@s
ddddgZddlTddlTddlZddlZddlZddlZddlZddlZddl	Z	Gddde
ZGd	ddZGd
ddeZ
e
jde
je
jde
je
jd
e
je
jde
je
jde
je
jde
je
jde
je
jde
je
jde
je
jde
je
jde
je
jde
je
jde
jGddde
Zejdejejdejejdejejdejejdejejdejejdej ejdejejd ej!ejd!ejejd"ej"ejd#ejej#d$ej$ej#d%ej%ej#d&ej&ej#d'ej'ej#d(ej(dS))BaseConstructorSafeConstructorConstructorConstructorError)*Nc@seZdZdS)rN)__name__
__module____qualname__rr/constructor.pyr
sc@seZdZiZiZddZddZddZddZd	d
Z	ddd
Z
ddZdddZdddZ
dddZeddZeddZdS)rcCs(i|_i|_g|_d|_dS)NF)constructed_objectsrecursive_objectsstate_generatorsdeep_construct)selfrrr__init__s			zBaseConstructor.__init__cCs
|jS)N)
check_node)rrrr
check_dataszBaseConstructor.check_datacCs#|jr|j|jSdS)N)rconstruct_documentZget_node)rrrrget_dataszBaseConstructor.get_datacCs)|j}|dk	r%|j|SdS)N)Zget_single_noder)rnoderrrget_single_data!s
zBaseConstructor.get_single_datacCsr|j|}xA|jrR|j}g|_x|D]}x|D]}qAWq4WqWi|_i|_d|_|S)NF)construct_objectrr
rr)rrdatar	generatordummyrrrr(s		

			z"BaseConstructor.construct_documentFc
Cs-||jkr|j|S|r2|j}d|_||jkrYtddd|jd|j|<d}d}|j|jkr|j|j}nx|jD]?}|jj|r|jt	|d}|j|}PqWd|jkr|j}|jd}nvd|jkr+|jd}nWt
|trI|jj
}n9t
|trg|jj}nt
|tr|jj}|dkr|||}n||||}t
|tjr|}t|}|jrx!|D]}	qWn|jj|||j|<|j|=|r)||_|S)NTz$found unconstructable recursive node)r
rrr
start_marktagyaml_constructorsyaml_multi_constructors
startswithlen
isinstance
ScalarNode	__class__construct_scalarSequenceNodeconstruct_sequenceMappingNodeconstruct_mappingtypes
GeneratorTypenextrappend)
rrdeepZold_deepconstructorZ
tag_suffix
tag_prefixrrrrrrr5sX			

		


	z BaseConstructor.construct_objectcCs5t|ts.tddd|j|j|jS)Nz$expected a scalar node, but found %s)r#r$ridrvalue)rrrrrr&gs
	
z BaseConstructor.construct_scalarcsKt|ts.tddd|j|jfdd|jDS)Nz&expected a sequence node, but found %scs%g|]}j|dqS)r/)r).0Zchild)r/rrr
<listcomp>ss	z6BaseConstructor.construct_sequence.<locals>.<listcomp>)r#r'rr2rr3)rrr/r)r/rrr(ns	
z"BaseConstructor.construct_sequencecCst|ts.tddd|j|ji}xx|jD]m\}}|j|d|}t|tjstd|jd|j|j|d|}|||<q>W|S)Nz%expected a mapping node, but found %sr/zwhile constructing a mappingzfound unhashable key)	r#r)rr2rr3rcollectionsHashable)rrr/mappingkey_node
value_nodekeyr3rrrr*vs	
z!BaseConstructor.construct_mappingcCst|ts.tddd|j|jg}xT|jD]I\}}|j|d|}|j|d|}|j||fq>W|S)Nz%expected a mapping node, but found %sr/)r#r)rr2rr3rr.)rrr/pairsr9r:r;r3rrrconstruct_pairss	
zBaseConstructor.construct_pairscCs2d|jkr!|jj|_||j|<dS)Nr)__dict__rcopy)clsrr0rrradd_constructorszBaseConstructor.add_constructorcCs2d|jkr!|jj|_||j|<dS)Nr )r>r r?)r@r1Zmulti_constructorrrradd_multi_constructorsz%BaseConstructor.add_multi_constructorN)rr	r
rr rrrrrrr&r(r*r=classmethodrArBrrrrr
s
2cs\eZdZfddZddZdfddZdd	Zd
dddd
dddddddiZddZddZ	dZ
xe
e
e
kre
e
9Z
qWe
e
ZddZddZ
ejdejZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,ZS)-rcsUt|trEx3|jD](\}}|jdkr|j|SqWtj|S)Nztag:yaml.org,2002:value)r#r)r3rr&super)rrr9r:)r%rrr&s
z SafeConstructor.construct_scalarc	Csg}d}xj|t|jkrx|j|\}}|jdkrF|j|=t|tr|j||j|jqut|tr!g}x_|jD]T}t|tstd|j	d|j
|j	|j||j|jqW|jx@|D]}|j|qWqutd|j	d|j
|j	q|jdkrkd|_|d7}q|d7}qW|r||j|_dS)	Nrztag:yaml.org,2002:mergezwhile constructing a mappingz,expected a mapping for merging, but found %sz@expected a mapping or list of mappings for merging, but found %sztag:yaml.org,2002:valueztag:yaml.org,2002:strr)
r"r3rr#r)flatten_mappingextendr'rrr2r.reverse)	rrmergeindexr9r:Zsubmergesubnoder3rrrrEs>




	
zSafeConstructor.flatten_mappingFcs2t|tr|j|tj|d|S)Nr/)r#r)rErDr*)rrr/)r%rrr*s
z!SafeConstructor.construct_mappingcCs|j|dS)N)r&)rrrrrconstruct_yaml_nulls
z#SafeConstructor.construct_yaml_nullyesTnotruefalseZonZoffcCs |j|}|j|jS)N)r&bool_valueslower)rrr3rrrconstruct_yaml_boolsz#SafeConstructor.construct_yaml_boolcCsc|j|}|jdd}d}|ddkr=d}|ddkr]|dd}|dkrmdS|jdr|t|d	dd	S|jd
r|t|d	ddS|ddkr|t|dSd
|krQdd|jd
D}|jd}d}x&|D]}|||7}|d9}q'W||S|t|SdS)N_rr-z+-0Z0bZ0x:cSsg|]}t|qSr)int)r4partrrrr5s	z6SafeConstructor.construct_yaml_int.<locals>.<listcomp><r)r&replacer!r[splitrG)rrr3signdigitsbasedigitrrrconstruct_yaml_ints2

z"SafeConstructor.construct_yaml_intgu<7~cCs|j|}|jddj}d}|ddkrCd}|ddkrc|dd}|dkrz||jS|dkr|jSd	|krd
d|jd	D}|jd}d}x&|D]}|||7}|d
9}qW||S|t|SdS)NrSrTrrrUz+-z.infz.nanrZcSsg|]}t|qSr)float)r4r\rrrr5
s	z8SafeConstructor.construct_yaml_float.<locals>.<listcomp>gr]rr^)r&r_rQ	inf_value	nan_valuer`rGrf)rrr3rarbrcrdrrrconstruct_yaml_floats*

z$SafeConstructor.construct_yaml_floatcCsy|j|jd}WnAtk
r_}z!tddd||jWYdd}~XnXy-ttdrtj|Stj|SWnDt	j
k
r}z!tddd||jWYdd}~XnXdS)Nasciiz,failed to convert base64 data into ascii: %sdecodebytesz failed to decode base64 data: %s)r&encodeUnicodeEncodeErrorrrhasattrbase64rkdecodestringbinasciiError)rrr3excrrrconstruct_yaml_binarys	
	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]))?))?)?$cCs|j|}|jj|j}|j}t|d}t|d}t|d}|ds}tj|||St|d}t|d}	t|d}
d}|dr|ddd	}x t|d	kr|d
7}qWt|}d}|dret|d}
t|d
p0d}tj	d|
d|}|ddkre|}tj|||||	|
|}|r||8}|S)NyearmonthdayhourminutesecondrfractionrVZtz_signtz_hour	tz_minuteZhoursZminutesrU)
r&timestamp_regexpmatchr3	groupdictr[datetimeZdater"Z	timedelta)rrr3rvaluesrurvrwrxryrzr{Zdeltar}r~rrrrconstruct_yaml_timestamp4s8


!
z(SafeConstructor.construct_yaml_timestampccsg}|Vt|ts<td|jd|j|jx|jD]}t|ts}td|jd|j|jt|jdkrtd|jdt|j|j|jd\}}|j|}|j|}|j	||fqFWdS)Nz!while constructing an ordered mapz!expected a sequence, but found %sz,expected a mapping of length 1, but found %srz2expected a single mapping item, but found %d itemsr)
r#r'rrr2r3r)r"rr.)rrZomaprJr9r:r;r3rrrconstruct_yaml_omapRs$
z#SafeConstructor.construct_yaml_omapccsg}|Vt|ts<td|jd|j|jx|jD]}t|ts}td|jd|j|jt|jdkrtd|jdt|j|j|jd\}}|j|}|j|}|j	||fqFWdS)Nzwhile constructing pairsz!expected a sequence, but found %sz,expected a mapping of length 1, but found %srz2expected a single mapping item, but found %d itemsr)
r#r'rrr2r3r)r"rr.)rrr<rJr9r:r;r3rrrconstruct_yaml_pairshs$
z$SafeConstructor.construct_yaml_pairsccs.t}|V|j|}|j|dS)N)setr*update)rrrr3rrrconstruct_yaml_set}s	z"SafeConstructor.construct_yaml_setcCs
|j|S)N)r&)rrrrrconstruct_yaml_strsz"SafeConstructor.construct_yaml_strccs%g}|V|j|j|dS)N)rFr()rrrrrrconstruct_yaml_seqsz"SafeConstructor.construct_yaml_seqccs+i}|V|j|}|j|dS)N)r*r)rrrr3rrrconstruct_yaml_mapsz"SafeConstructor.construct_yaml_mapccsk|j|}|Vt|drH|j|dd}|j|n|j|}|jj|dS)N__setstate__r/T)__new__rnr*rr>r)rrr@rstaterrrconstruct_yaml_objectsz%SafeConstructor.construct_yaml_objectcCs#tddd|j|jdS)Nz0could not determine a constructor for the tag %r)rrr)rrrrrconstruct_undefineds	
z#SafeConstructor.construct_undefined)rr	r
r&rEr*rKrPrRrergrhrirtrecompileXrrrrrrrrrrrr)r%rrs:#

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:setztag:yaml.org,2002:strztag:yaml.org,2002:seqztag:yaml.org,2002:mapc@seZdZddZddZddZddZd	d
ZddZd
dZ	ddZ
ddZddZdddddZ
ddZddZdddZdd ZdS)!rcCs
|j|S)N)r&)rrrrrconstruct_python_strsz Constructor.construct_python_strcCs
|j|S)N)r&)rrrrrconstruct_python_unicodesz$Constructor.construct_python_unicodecCsy|j|jd}WnAtk
r_}z!tddd||jWYdd}~XnXy-ttdrtj|Stj|SWnDt	j
k
r}z!tddd||jWYdd}~XnXdS)Nrjz,failed to convert base64 data into ascii: %srkz failed to decode base64 data: %s)r&rlrmrrrnrorkrprqrr)rrr3rsrrrconstruct_python_bytess	
	z"Constructor.construct_python_bytescCs
|j|S)N)re)rrrrrconstruct_python_longsz!Constructor.construct_python_longcCst|j|S)N)complexr&)rrrrrconstruct_python_complexsz$Constructor.construct_python_complexcCst|j|S)N)tupler()rrrrrconstruct_python_tuplesz"Constructor.construct_python_tuplecCs{|std|d|yt|WnDtk
ro}z$td|d||f|WYdd}~XnXtj|S)Nz"while constructing a Python modulez+expected non-empty name appended to the tagzcannot find module %r (%s))r
__import__ImportErrorsysmodules)rnamemarkrsrrrfind_python_modules		)zConstructor.find_python_modulecCs|std|d|d|krB|jdd\}}nd}|}yt|WnDtk
r}z$td|d||f|WYdd}~XnXtj|}t||std|d||jf|t||S)Nz"while constructing a Python objectz+expected non-empty name appended to the tag.rbuiltinszcannot find module %r (%s)zcannot find %r in the module %r)	rrsplitrrrrrnrgetattr)rrrmodule_nameZobject_namersmodulerrrfind_python_names$		)
	zConstructor.find_python_namecCsG|j|}|r4td|jd||j|j||jS)Nz while constructing a Python namez&expected the empty value, but found %r)r&rrr)rsuffixrr3rrrconstruct_python_names
z!Constructor.construct_python_namecCsG|j|}|r4td|jd||j|j||jS)Nz"while constructing a Python modulez&expected the empty value, but found %r)r&rrr)rrrr3rrrconstruct_python_modules
z#Constructor.construct_python_moduleNFcCsf|sg}|si}|j||j}|rUt|trU|j|||S|||SdS)N)rrr#typer)rrrargskwdsnewobjr@rrrmake_python_instance"sz Constructor.make_python_instancecCst|dr|j|ni}t|trRt|dkrR|\}}t|drt|jj|n|r|j|x*|jD]\}}tt	||qWdS)NrrWr>)
rnrr#rr"r>ritemssetattrobject)rinstancer	slotstater;r3rrrset_python_instance_state.s!
z%Constructor.set_python_instance_stateccsU|j||dd}|Vt|d}|j|d|}|j||dS)NrTrr/)rrnr*r)rrrrr/rrrrconstruct_python_object<s
z#Constructor.construct_python_objectcCst|tr?|j|dd}i}i}g}i}no|j|dd}	|	jdg}|	jdi}|	jdi}|	jdg}|	jdi}|j|||||}
|r|j|
||r|
j||rx|D]}|||
|<qW|
S)Nr/Trrr	listitems	dictitems)r#r'r(r*getrrrF)rrrrrrrrrr3rr;rrrconstruct_python_object_applyEs*	

z)Constructor.construct_python_object_applycCs|j||ddS)NrT)r)rrrrrrconstruct_python_object_newhsz'Constructor.construct_python_object_new)rr	r
rrrrrrrrrrrrrrrrrrrrs	#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:z tag:yaml.org,2002:python/module:z tag:yaml.org,2002:python/object:z&tag:yaml.org,2002:python/object/apply:z$tag:yaml.org,2002:python/object/new:))__all__errorZnodesr6rrorqrrr+ZMarkedYAMLErrorrrrrArKrRrerirtrrrrrrrrrrrrrrrrBrrrrrrrrr<module>s		

T











	

















Back to Directory File Manager