Your IP : 216.73.216.196


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

B

�ˀX �@sGdd�de�ZdS)c@s,eZdZdZdZdd�Zdd�Zdd�ZdS)	�BaseMatchera�
    Base class that ensures sub-classes that implement custom matchers can be
    registered and have the only method that is required.

    Usage:

    .. code-block:: python

        from betamax import Betamax, BaseMatcher

        class MyMatcher(BaseMatcher):
            name = 'my'

            def match(self, request, recorded_request):
                # My fancy matching algorithm

        Betamax.register_request_matcher(MyMatcher)

    The last line is absolutely necessary.

    The `match` method will be given a `requests.PreparedRequest` object and a
    dictionary. The dictionary always has the following keys:

    - url
    - method
    - body
    - headers

    NcCs|jstd��|��dS)NzMatchers require names)�name�
ValueError�on_init)�self�r�F/opt/alt/python37/lib/python3.7/site-packages/betamax/matchers/base.py�__init__&szBaseMatcher.__init__cCsdS)amMethod to implement if you wish something to happen in ``__init__``.

        The return value is not checked and this is called at the end of
        ``__init__``. It is meant to provide the matcher author a way to
        perform things during initialization of the instance that would
        otherwise require them to override ``BaseMatcher.__init__``.
        Nr)rrrrr+szBaseMatcher.on_initcCstd|jj��dS)a(A method that must be implemented by the user.

        :param PreparedRequest request: A requests PreparedRequest object
        :param dict recorded_request: A dictionary containing the serialized
            request in the cassette
        :returns bool: True if they match else False
        z*The match method must be implemented on %sN)�NotImplementedError�	__class__�__name__)r�requestZrecorded_requestrrr�match5szBaseMatcher.match)r�
__module__�__qualname__�__doc__rrrr
rrrrrs

rN)�objectrrrrr�<module>�