o `r3@sddlTddlTddlTddlTddlTddlTdZzddlTdZWn e y-dZYnwddl Z ddiZ dDdd Z Gd dde Zd d Zefd dZefddZefddZefddZdDddZdDddZddZddZddZdd Zd!d"Zd#d$Zdedddddfd%d&Zdeddddddddddf d'd(Zdefd)d*Z dedddddddddddddfd+d,Z!defd-d.Z"dDd/d0Z#dDd1d2Z$ddefd3d4Z%ddefd5d6Z&dDd7d8Z'dDd9d:Z(efd;d<Z)efd=d>Z*Gd?d@d@e+Z,GdAdBdBe,dCZ-dS)E)*z5.4.1TFNYAMLLoadWarningcCs>|durtSt|tur|D]}|tvr||t|<qdSdSN)_warnings_enabledtypedict)settingskeyr //usr/lib/python3/dist-packages/yaml/__init__.pywarningss  r c@s eZdZdS)rN)__name__ __module__ __qualname__r r r r r(scCs4tddurdSddl}d|}|j|tdddS)NrFrzcalling yaml.%s() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.) stacklevel)rr warnr)methodr messager r r load_warning+s rccL||}z|r|V|s W|dSW|dS|w)z9 Scan a YAML stream and produce scanning tokens. N) check_token get_tokendisposestreamLoaderloaderr r r scan:  rccr)z9 Parse a YAML stream and produce parsing events. N) check_event get_eventrrr r r parseEr r#cCs&||}z |W|S|w)zj Parse the first YAML document in a stream and produce the corresponding representation tree. )get_single_noderrr r r composePsr%ccr)zb Parse all YAML documents in a stream and produce corresponding representation trees. N) check_nodeget_noderrr r r compose_all[s  r(cCs:|dur tdt}||}z |W|S|w)zd Parse the first YAML document in a stream and produce the corresponding Python object. Nload)r FullLoaderget_single_datarrr r r r)gsr)ccs`|dur tdt}||}z|r$|V|sW|dSW|dS|w)z\ Parse all YAML documents in a stream and produce corresponding Python objects. Nload_all)rr* check_dataget_datarrr r r r,vs  r,cC t|tS)z Parse the first YAML document in a stream and produce the corresponding Python object. Resolve all tags except those known to be unsafe on untrusted input. )r)r*rr r r full_load r1cCr/)z Parse all YAML documents in a stream and produce corresponding Python objects. Resolve all tags except those known to be unsafe on untrusted input. )r,r*r0r r r full_load_allr2r3cCr/)z Parse the first YAML document in a stream and produce the corresponding Python object. Resolve only basic YAML tags. This is known to be safe for untrusted input. )r) SafeLoaderr0r r r safe_loadr2r5cCr/)z Parse all YAML documents in a stream and produce corresponding Python objects. Resolve only basic YAML tags. This is known to be safe for untrusted input. )r,r4r0r r r safe_load_allr2r6cCr/)z Parse the first YAML document in a stream and produce the corresponding Python object. Resolve all tags, even those known to be unsafe on untrusted input. )r) UnsafeLoaderr0r r r unsafe_loadr2r8cCr/)z Parse all YAML documents in a stream and produce corresponding Python objects. Resolve all tags, even those known to be unsafe on untrusted input. )r,r7r0r r r unsafe_load_allr2r9c Cshd}|dur t}|j}|||||||d} z|D]} | | qW| n| w|r2|SdS)zl Emit YAML parsing events into a stream. If stream is None, return the produced string instead. N) canonicalindentwidth allow_unicode line_break)ioStringIOgetvalueemitr) eventsrDumperr:r;r<r=r>rAdumpereventr r r rBs  rBc  Csd} |dur|durt}nt}|j} ||||||||| | | | d }z||D]}||q,|W|n|w| rH| SdS)z Serialize a sequence of representation trees into a YAML stream. If stream is None, return the produced string instead. N) r:r;r<r=r>encodingversiontagsexplicit_start explicit_end)r?r@BytesIOrAopen serializecloser)nodesrrDr:r;r<r=r>rGrJrKrHrIrArEnoder r r serialize_alls(     rRcKt|g|fd|i|S)zx Serialize a representation tree into a YAML stream. If stream is None, return the produced string instead. rD)rR)rQrrDkwdsr r r rNrNcCsd}|dur| durt}nt}|j}||||||||| | | || | |d}z||D]}||q/|W|n|w|rK|SdS)z Serialize a sequence of Python objects into a YAML stream. If stream is None, return the produced string instead. N) default_styledefault_flow_styler:r;r<r=r>rGrHrIrJrK sort_keys)r?r@rLrArM representrOr) documentsrrDrVrWr:r;r<r=r>rGrJrKrHrIrXrArEdatar r r dump_alls,    r\cKrS)zr Serialize a Python object into a YAML stream. If stream is None, return the produced string instead. rD)r\)r[rrDrTr r r dumprUr]cKst||fdti|S)z Serialize a sequence of Python objects into a YAML stream. Produce only basic YAML tags. If stream is None, return the produced string instead. rDr\ SafeDumper)rZrrTr r r safe_dump_all$sr`cKst|g|fdti|S)z Serialize a Python object into a YAML stream. Produce only basic YAML tags. If stream is None, return the produced string instead. rDr^)r[rrTr r r safe_dump,sracCZ|durtj|||tj|||tj|||n||||||||dS)z Add an implicit scalar detector. If an implicit scalar value matches the given regexp, the corresponding tag is assigned to the scalar. first is a sequence of possible initial characters or None. N)rradd_implicit_resolverr*r7)tagregexpfirstrrDr r r rc4s rccCrb)z Add a path based resolver for the given tag. A path is a list of keys that forms a path to a node in the representation tree. Keys can be string values, integers, or None. N)rradd_path_resolverr*r7)rdpathkindrrDr r r rgDs rgcCF|durtj||tj||tj||dS|||dS)z Add a constructor for the given tag. Constructor is a function that accepts a Loader instance and a node object and produces the corresponding Python object. N)rradd_constructorr*r7)rd constructorrr r r rkSs rkcCrj)a  Add a multi-constructor for the given tag prefix. Multi-constructor is called for a node if its tag starts with tag_prefix. Multi-constructor accepts a Loader instance, a tag suffix, and a node object and produces the corresponding Python object. N)rradd_multi_constructorr*r7) tag_prefixmulti_constructorrr r r rm`s rmcC|||dS)z Add a representer for the given type. Representer is a function accepting a Dumper instance and an instance of the given data type and producing the corresponding representation node. N)add_representer) data_type representerrDr r r rqnrqcCrp)z Add a representer for the given type. Multi-representer is a function accepting a Dumper instance and an instance of the given data type or subtype and producing the corresponding representation node. N)add_multi_representer)rrmulti_representerrDr r r ruwrtrucs eZdZdZfddZZS)YAMLObjectMetaclassz' The metaclass for YAMLObject. cstt||||d|vr<|ddur>t|jtr)|jD] }||j|jqn |j|j|j|j ||j dSdSdS)Nyaml_tag) superrw__init__ isinstance yaml_loaderlistrkrx from_yaml yaml_dumperrqto_yaml)clsnamebasesrTr __class__r r rzs  zYAMLObjectMetaclass.__init__)rrr__doc__rz __classcell__r r rr rwsrwc@sBeZdZdZdZeeegZe Z dZ dZ e ddZe ddZdS) YAMLObjectza An object that can dump itself to a YAML stream and load itself from a YAML stream. r NcCs |||S)zC Convert a representation node to a Python object. )construct_yaml_object)rrrQr r r r~s zYAMLObject.from_yamlcCs|j|j|||jdS)zC Convert a Python object to a representation node. ) flow_style)represent_yaml_objectrxyaml_flow_style)rrEr[r r r rs zYAMLObject.to_yaml)rrrr __slots__rr*r7r|rDrrxr classmethodr~rr r r r rs  r) metaclassr).errortokensrCrPrrE __version__cyaml__with_libyaml__ ImportErrorr?rr RuntimeWarningrrrrr#r%r(r)r,r1r3r5r6r8r9rDrBrRrNr\r]r`rarcrgrkrmrqrurrwrr r r r s|              !