§
    ½Ë”j9  ã                   ó¢  — d dl mZ d dlZ	 d dlmZ d dlmZ n# e$ r d dlmZ d dlm	Z Y nw xY w G d„ de¦  «        Z
d	„ Zd
„ Zd„ Zd„ Ze
                     de¦  «         e
                     de¦  «         e
                     de¦  «         e
                     de¦  «         e
                     de¦  «          G d„ de¦  «        Zd„ Zd„ Zd„ ZdS )é    )ÚBytesION)ÚCDumper)ÚCSafeLoader©ÚDumper)Ú
SafeLoaderc                   ó   — e Zd ZdZdS )Ú_CassetteLoadera  A safe YAML loader for cassettes.

    It refuses the dangerous ``!!python/object``/``!!python/object/apply``/
    ``!!python/object/new``/``!!python/module``/``!!python/name`` tags that the
    full loader would execute (CVE-class: arbitrary code execution via
    untrusted cassette files), while still constructing the handful of benign
    Python-specific tags that vcrpy cassettes legitimately contain: plain
    strings, tuples, and serialized ``BytesIO`` request bodies. This keeps
    existing cassettes loadable.

    Note the ``BytesIO`` constructor is bound to the *exact* tag and rebuilds
    the buffer from its (safely constructed) byte content only. It never
    invokes PyYAML's generic object machinery, so it cannot be used to
    instantiate an arbitrary class.
    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úLC:\Projects\DSCons\.venv\Lib\site-packages\vcr/serializers/yamlserializer.pyr
   r
      s   € € € € € ðð ð ð r   r
   c                 ó,   — |                       |¦  «        S ©N)Úconstruct_scalar©ÚloaderÚnodes     r   Ú_construct_python_strr       s   € Ø×"Ò" 4Ñ(Ô(Ð(r   c                 óF   — t          |                      |¦  «        ¦  «        S r   )ÚtupleÚconstruct_sequencer   s     r   Ú_construct_python_tupler   $   s   € Ý�×*Ò*¨4Ñ0Ô0Ñ1Ô1Ð1r   c                 óì   — |                       |d¬¦  «        }|                     d¦  «        pd}|r|d         nd}t          |t          ¦  «        r|                     d¦  «        }t          |pd¦  «        S )NT©ÚdeepÚstate)r   r   r   zutf-8)Úconstruct_mappingÚgetÚ
isinstanceÚstrÚencoder   )r   r   Úmappingr    Údatas        r   Ú_construct_bytesior(   (   sy   € ð
 ×&Ò& t°$Ð&Ñ7Ô7€GØ�KŠK˜Ñ Ô Ð* F€EØÐ%ˆ5�Œ8ˆ8 #€DÝ�$�ÑÔð $Ø�{Š{˜7Ñ#Ô#ˆÝ�4�;˜3ÑÔÐr   c                 ó’   — |                       |d¬¦  «        }|                     d¦  «        pg f}t          |r|d         ng ¦  «        S )NTr   Úargsr   )r!   r"   Úiter)r   r   r&   r*   s       r   Ú_construct_iterr,   5   sO   € ð
 ×&Ò& t°$Ð&Ñ7Ô7€GØ�;Š;�vÑÔÐ' 2 %€DÝ˜4Ð'��Q”� RÑ(Ô(Ð(r   ztag:yaml.org,2002:python/strz tag:yaml.org,2002:python/unicodeztag:yaml.org,2002:python/tuplez/tag:yaml.org,2002:python/object/new:_io.BytesIOz3tag:yaml.org,2002:python/object/apply:builtins.iterc                   ó&   ‡ — e Zd ZdZeZˆ fd„Zˆ xZS )Ú_CassetteDumpera  A YAML dumper that refuses to emit what the cassette loader can't read.

    PyYAML's full dumper happily turns any Python object into a
    ``!!python/object*`` tag, but the safe cassette loader refuses those tags,
    so recording such a cassette would succeed and then fail to load on replay
    (#1007). Refuse at record time instead, before anything is written. The
    check uses the paired loader's constructor table, so any tag the loader
    can construct is also dumpable and the two sides stay symmetric.
    c                 ó  •— t          ¦   «                              |¦  «        }|j        }t          |t          ¦  «        rI|                     d¦  «        r4|| j        j        vr&t          j	         
                    d|›d|›d�¦  «        ‚|S )Nztag:yaml.org,2002:python/zzCassette not saved: the request or response contains a Python object that the safe YAML loader would refuse to load back (a  ). Keep custom Python objects out of recorded requests/responses, or register a serializer that supports this object on your VCR instance:

    from vcr.serializers import yamlserializer

    my_vcr.register_serializer("yaml", yamlserializer.with_custom_tags({
        z§: my_constructor,  # def my_constructor(loader, node): ...
    }))

See https://vcrpy.readthedocs.io/en/latest/advanced.html#cassettes-containing-custom-python-objects)ÚsuperÚrepresent_dataÚtagr#   r$   Ú
startswithÚloader_classÚyaml_constructorsÚyamlÚrepresenterÚRepresenterError)Úselfr'   r   r2   Ú	__class__s       €r   r1   z_CassetteDumper.represent_dataS   s£   ø€ Ý‰wŒw×%Ò% dÑ+Ô+ˆØŒhˆå�s�CÑ Ô ð	à—’Ð:Ñ;Ô;ð	ð ˜4Ô,Ô>Ð>Ð>åÔ"×3Ò3ð
>ØORð
>ð 
>ð ð
>ð 
>ð 
>ñô ð ð ˆr   )r   r   r   r   r
   r4   r1   Ú__classcell__)r:   s   @r   r.   r.   F   sI   ø€ € € € € ðð ð #€Lðð ð ð ð ð ð ð ð r   r.   c                 óú   ‡‡— t          dt          fi ¦  «        Š|                      ¦   «         D ]\  }}‰                     ||¦  «         Œt          dt          fd‰i¦  «        Š G ˆˆfd„d¦  «        } |¦   «         S )ap  Build a YAML serializer that can record and replay custom Python objects.

    ``constructors`` maps YAML tags to PyYAML constructor callables. The
    returned serializer's loader knows how to construct those tags, and its
    dumper therefore allows saving them; everything else stays as locked down
    as the default serializer. Register the result on a VCR instance::

        my_vcr.register_serializer("yaml", yamlserializer.with_custom_tags({
            "tag:yaml.org,2002:python/object/new:myapp.CustomHeader":
                lambda loader, node: CustomHeader(loader.construct_sequence(node)[0]),
        }))
    Ú_CustomTagCassetteLoaderÚ_CustomTagCassetteDumperr4   c                   óD   •— e Zd Zeˆfd„¦   «         Zeˆ fd„¦   «         ZdS )ú.with_custom_tags.<locals>._CustomTagSerializerc                 ó0   •— t          j        | ‰¬¦  «        S ©N)ÚLoader)r6   Úload)Úcassette_stringr   s    €r   Údeserializez:with_custom_tags.<locals>._CustomTagSerializer.deserialize~   s   ø€ å”9˜_°VÐ<Ñ<Ô<Ð<r   c                 ó0   •— t          j        | ‰¬¦  «        S ©Nr   )r6   Údump)Úcassette_dictÚdumpers    €r   Ú	serializez8with_custom_tags.<locals>._CustomTagSerializer.serialize‚   s   ø€ å”9˜]°6Ð:Ñ:Ô:Ð:r   N)r   r   r   ÚstaticmethodrF   rL   )rK   r   s   €€r   Ú_CustomTagSerializerr@   }   s]   ø€ € € € € Ø	ð	=ð 	=ð 	=ð 	=ñ 
Œð	=ð 
ð	;ð 	;ð 	;ð 	;ñ 
Œð	;ð 	;ð 	;r   rN   )Útyper
   ÚitemsÚadd_constructorr.   )Úconstructorsr2   ÚconstructorrN   rK   r   s       @@r   Úwith_custom_tagsrT   k   s·   øø€ õ Ð,­Ð.@À"ÑEÔE€FØ(×.Ò.Ñ0Ô0ð 1ð 1Ñˆˆ[Ø×Ò˜s KÑ0Ô0Ð0Ð0ÝÐ,­Ð.@À>ÐSYÐBZÑ[Ô[€Fð;ð ;ð ;ð ;ð ;ð ;ð ;ð ;ñ ;ô ;ð ;ð  ÐÑ!Ô!Ð!r   c                 ó8   — t          j        | t          ¬¦  «        S rB   )r6   rD   r
   )rE   s    r   rF   rF   ‰   s   € ÝŒ9�_­_Ð=Ñ=Ô=Ð=r   c                 ó8   — t          j        | t          ¬¦  «        S rH   )r6   rI   r.   )rJ   s    r   rL   rL   �   s   € ÝŒ9�]­?Ð;Ñ;Ô;Ð;r   )Úior   r6   r   Ú_BaseDumperr   Ú_BaseLoaderÚImportErrorr   r   r
   r   r   r(   r,   rQ   r.   rT   rF   rL   r   r   r   ú<module>r[      sÓ  ðØ Ð Ð Ð Ð Ð à €€€ð/Ø+Ð+Ð+Ð+Ð+Ð+Ø/Ð/Ð/Ð/Ð/Ð/Ð/øØð /ð /ð /Ø*Ð*Ð*Ð*Ð*Ð*Ø.Ð.Ð.Ð.Ð.Ð.Ð.Ð.ð/øøøð
ð ð ð ð �kñ ô ð ð$)ð )ð )ð2ð 2ð 2ð
 ð 
 ð 
 ð)ð )ð )ð × Ò Ð >Ð@UÑ VÔ VÐ VØ × Ò Ð BÐDYÑ ZÔ ZÐ ZØ × Ò Ð @ÐBYÑ ZÔ ZÐ ZØ × Ò Ð QÐSeÑ fÔ fÐ fØ × Ò Ð UÐWfÑ gÔ gÐ gð"ð "ð "ð "ð "�kñ "ô "ð "ðJ"ð "ð "ð<>ð >ð >ð<ð <ð <ð <ð <s   Œ ™-¬-