§
    ¾rÊcÆ  ã                  ó¾   — d Z ddlmZ ddlmZmZmZmZ ddlZej	        dk    r	ddlm
Z
mZ nddlm
Z
mZ erddlZddlmZ ddlmZ e G d	„ d
e
¦  «        ¦   «         ZdS )z4
typing.Protocol classes for jsonschema interfaces.
é    )Úannotations)ÚTYPE_CHECKINGÚAnyÚClassVarÚIteratorN)é   é   )ÚProtocolÚruntime_checkable)ÚValidationError)ÚRefResolverc                  ó”   — e Zd ZU dZded<   ded<   ded<   ded<   d	ed
<   	 	 d!d"d„Zed#d„¦   «         Zd$d„Zd%d„Z	d&d„Z
d'd„Zd(d „ZdS ))Ú	Validatoraã  
    The protocol to which all validator classes should adhere.

    :argument schema: the schema that the validator object
        will validate with. It is assumed to be valid, and providing
        an invalid schema can lead to undefined behavior. See
        `Validator.check_schema` to validate a schema first.
    :argument resolver: an instance of `jsonschema.RefResolver` that will be
        used to resolve :kw:`$ref` properties (JSON references). If
        unprovided, one will be created.
    :argument format_checker: an instance of `jsonschema.FormatChecker`
        whose `jsonschema.FormatChecker.conforms` method will be called to
        check and see if instances conform to each :kw:`format`
        property present in the schema. If unprovided, no validation
        will be done for :kw:`format`. Certain formats require
        additional packages to be installed (ipv5, uri, color, date-time).
        The required packages can be found at the bottom of this page.
    zClassVar[dict]ÚMETA_SCHEMAÚ
VALIDATORSz ClassVar[jsonschema.TypeChecker]ÚTYPE_CHECKERz"ClassVar[jsonschema.FormatChecker]ÚFORMAT_CHECKERúdict | boolÚschemaNÚresolverúRefResolver | NoneÚformat_checkerújsonschema.FormatChecker | NoneÚreturnÚNonec                ó   — d S )N© )Úselfr   r   r   s       ú6/usr/lib/python3/dist-packages/jsonschema/protocols.pyÚ__init__zValidator.__init__Y   s	   € ð 	ˆó    Údictc                ó   — dS )z­
        Validate the given schema against the validator's `META_SCHEMA`.

        :raises: `jsonschema.exceptions.SchemaError` if the schema
            is invalid
        Nr   )Úclsr   s     r   Úcheck_schemazValidator.check_schemaa   ó   € € € r!   Úinstancer   ÚtypeÚstrÚboolc                ó   — dS )zÛ
        Check if the instance is of the given (JSON Schema) type.

        :type type: str
        :rtype: bool
        :raises: `jsonschema.exceptions.UnknownType` if ``type``
            is not a known type.
        Nr   )r   r'   r(   s      r   Úis_typezValidator.is_typej   r&   r!   c                ó   — dS )zÔ
        Check if the instance is valid under the current `schema`.

        :rtype: bool

        >>> schema = {"maxItems" : 2}
        >>> Draft202012Validator(schema).is_valid([2, 3, 4])
        False
        Nr   ©r   r'   s     r   Úis_validzValidator.is_validt   r&   r!   úIterator[ValidationError]c                ó   — dS )a)  
        Lazily yield each of the validation errors in the given instance.

        :rtype: an `collections.abc.Iterable` of
            `jsonschema.exceptions.ValidationError`\s

        >>> schema = {
        ...     "type" : "array",
        ...     "items" : {"enum" : [1, 2, 3]},
        ...     "maxItems" : 2,
        ... }
        >>> v = Draft202012Validator(schema)
        >>> for error in sorted(v.iter_errors([2, 3, 4]), key=str):
        ...     print(error.message)
        4 is not one of [1, 2, 3]
        [2, 3, 4] is too long
        Nr   r.   s     r   Úiter_errorszValidator.iter_errors   r&   r!   c                ó   — dS )a{  
        Check if the instance is valid under the current `schema`.

        :raises: `jsonschema.exceptions.ValidationError` if the
            instance is invalid

        >>> schema = {"maxItems" : 2}
        >>> Draft202012Validator(schema).validate([2, 3, 4])
        Traceback (most recent call last):
            ...
        ValidationError: [2, 3, 4] is too long
        Nr   r.   s     r   ÚvalidatezValidator.validate’   r&   r!   ú'Validator'c                ó   — dS )al  
        Create a new validator like this one, but with given changes.

        Preserves all other attributes, so can be used to e.g. create a
        validator with a different schema but with the same :kw:`$ref`
        resolution behavior.

        >>> validator = Draft202012Validator({})
        >>> validator.evolve(schema={"type": "number"})
        Draft202012Validator(schema={'type': 'number'}, format_checker=None)

        The returned object satisfies the validator protocol, but may not
        be of the same concrete class! In particular this occurs
        when a :kw:`$ref` occurs to a schema with a different
        :kw:`$schema` than this one (i.e. for a different draft).

        >>> validator.evolve(
        ...     schema={"$schema": Draft7Validator.META_SCHEMA["$id"]}
        ... )
        Draft7Validator(schema=..., format_checker=None)
        Nr   )r   Úkwargss     r   ÚevolvezValidator.evolve    r&   r!   )NN)r   r   r   r   r   r   r   r   )r   r"   r   r   )r'   r   r(   r)   r   r*   )r'   r"   r   r*   )r'   r"   r   r0   )r'   r"   r   r   )r   r5   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r    Úclassmethodr%   r,   r/   r2   r4   r8   r   r!   r   r   r   0   s  € € € € € € ðð ð*  ÐÐÑð
 ÐÐÑð 3Ð2Ð2Ñ2ð 7Ð6Ð6Ñ6ð ÐÐÑð
 (,Ø:>ð	ð ð ð ð ð ðð ð ñ „[ððð ð ð ð	ð 	ð 	ð 	ðð ð ð ð&ð ð ð ðð ð ð ð ð r!   r   )r<   Ú
__future__r   Útypingr   r   r   r   ÚsysÚversion_infor
   r   Útyping_extensionsÚ
jsonschemaÚjsonschema.exceptionsr   Újsonschema.validatorsr   r   r   r!   r   ú<module>rG      s  ððð ð #Ð "Ð "Ð "Ð "Ð "à 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø 
€
€
€
ð Ô�vÒÐØ2Ð2Ð2Ð2Ð2Ð2Ð2Ð2Ð2à=Ð=Ð=Ð=Ð=Ð=Ð=Ð=ð ð ØÐÐÐà 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø -Ð -Ð -Ð -Ð -Ð -ð ðDð Dð Dð Dð D�ñ Dô Dñ ÔðDð Dð Dr!   