Your IP : 216.73.216.196


Current Path : /opt/alt/python37/lib/python3.7/site-packages/betamax/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/betamax/__pycache__/configure.cpython-37.pyc

B

�ˀX��@s ddlmZGdd�de�ZdS)�)�Cassettecs�eZdZdZdZdd�Zdd�Z�fdd�Zdd
d�Zddd
�Z	e
dd��Zejdd��Ze
dd��Z
e
jdd��Z
dd�Z�ZS)�
Configurationa>This object acts as a proxy to configure different parts of Betamax.

    You should only ever encounter this object when configuring the library as
    a whole. For example:

    .. code::

        with Betamax.configure() as config:
            config.cassette_library_dir = 'tests/cassettes/'
            config.default_cassette_options['record_mode'] = 'once'
            config.default_cassette_options['match_requests_on'] = ['uri']
            config.define_cassette_placeholder('<URI>', 'http://httpbin.org')
            config.preserve_exact_body_bytes = True

    z
vcr/cassettescCs|S)N�)�selfrr�B/opt/alt/python37/lib/python3.7/site-packages/betamax/configure.py�	__enter__szConfiguration.__enter__cGsdS)Nr)r�argsrrr�__exit__szConfiguration.__exit__cs*|dkrd|j|<ntt|��||�dS)NZpreserve_exact_body_bytesT)�default_cassette_options�superr�__setattr__)rZprop�value)�	__class__rrrszConfiguration.__setattr__NcCstjd�|�dS)a�Register a function to call before playing back an interaction.

        Example usage:

        .. code-block:: python

            def before_playback(interaction, cassette):
                pass

            with Betamax.configure() as config:
                config.before_playback(callback=before_playback)

        :param str tag:
            Limits the interactions passed to the function based on the
            interaction's tag (currently unsupported).
        :param callable callback:
            The function which either accepts just an interaction or an
            interaction and a cassette and mutates the interaction before
            returning.
        �before_playbackN)r�hooks�append)r�tag�callbackrrrr$szConfiguration.before_playbackcCstjd�|�dS)a�Register a function to call before recording an interaction.

        Example usage:

        .. code-block:: python

            def before_record(interaction, cassette):
                pass

            with Betamax.configure() as config:
                config.before_record(callback=before_record)

        :param str tag:
            Limits the interactions passed to the function based on the
            interaction's tag (currently unsupported).
        :param callable callback:
            The function which either accepts just an interaction or an
            interaction and a cassette and mutates the interaction before
            returning.
        �
before_recordN)rrr)rrrrrrr;szConfiguration.before_recordcCstjS)z9Retrieve and set the directory to store the cassettes in.)r�CASSETTE_LIBRARY_DIR)rrrr�cassette_library_dirRsz"Configuration.cassette_library_dircCs
|t_dS)N)rr)rr
rrrrWscCstjS)aRetrieve and set the default cassette options.

        The options include:

        - ``match_requests_on``
        - ``placeholders``
        - ``re_record_interval``
        - ``record_mode``
        - ``preserve_exact_body_bytes``

        Other options will be ignored.
        )rr
)rrrrr
[sz&Configuration.default_cassette_optionscCs
|t_dS)N)rr
)rr
rrrr
kscCs|jd�||d��dS)aoDefine a placeholder value for some text.

        This also will replace the placeholder text with the text you wish it
        to use when replaying interactions from cassettes.

        :param str placeholder: (required), text to be used as a placeholder
        :param str replace: (required), text to be replaced or replacing the
            placeholder
        Zplaceholders)�placeholder�replaceN)r
r)rrrrrr�define_cassette_placeholderos

z)Configuration.define_cassette_placeholder)NN)NN)�__name__�
__module__�__qualname__�__doc__rrr	rrr�propertyr�setterr
r�
__classcell__rr)rrrs

rN)Zcassetter�objectrrrrr�<module>s