Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
protocols.cpython-313.pyc158 linesDownload Raw Back to __pycache__
1�

2��j���SrSSKJr SSKJrJrJrJrJr \(a SSK	J3r4Jr SSKr
SSKJr SSKJr SSKrSSKr\"SS	\55rg)5z46typing.Protocol classes for jsonschema interfaces.7�)�annotations)�
TYPE_CHECKING�Any�ClassVar�Protocol�runtime_checkable)�Iterable�MappingN)�_typing)�ValidationErrorc���\rSrSr%SrS\S'S\S'S\S'S\S	'S8\S'S\S
'SSS.SSjjjr\SSj5rSSjr	SSjr9SSjrSSjrS Sjr
Srg)!�	Validator�'aS10The protocol to which all validator classes adhere.11 12Arguments:13 14    schema:15 16        The schema that the validator object will validate with.17        It is assumed to be valid, and providing18        an invalid schema can lead to undefined behavior. See19        `Validator.check_schema` to validate a schema first.20 21    registry:22 23        a schema registry that will be used for looking up JSON references24 25    resolver:26 27        a resolver that will be used to resolve :kw:`$ref`28        properties (JSON references). If unprovided, one will be created.29 30        .. deprecated:: v4.18.031 32            `RefResolver <_RefResolver>` has been deprecated in favor of33            `referencing`, and with it, this argument.34 35    format_checker:36 37        if provided, a checker which will be used to assert about38        :kw:`format` properties present in the schema. If unprovided,39        *no* format validation is done, and the presence of format40        within schemas is strictly informational. Certain formats41        require additional packages to be installed in order to assert42        against instances. Ensure you've installed `jsonschema` with43        its `extra (optional) dependencies <index:extras>` when44        invoking ``pip``.45 46.. deprecated:: v4.12.047 48    Subclassing validator classes now explicitly warns this is not part of49    their public API.50 51zClassVar[Mapping]�META_SCHEMA�52VALIDATORSz ClassVar[jsonschema.TypeChecker]�TYPE_CHECKERz"ClassVar[jsonschema.FormatChecker]�FORMAT_CHECKERz
_typing.id_of�ID_OF�Mapping | bool�schemaN.)�registryc��g)N�)�selfr�resolver�format_checkerrs     �ZD:\code\apps\devtools\python\user_packages\Python313\site-packages\jsonschema/protocols.py�__init__�Validator.__init__ls���c��g)z�53Validate the given schema against the validator's `META_SCHEMA`.54 55Raises:56 57    `jsonschema.exceptions.SchemaError`:58 59        if the schema is invalid60 61Nr)�clsrs  r�check_schema�Validator.check_schemau��r c��g)aC62Check if the instance is of the given (JSON Schema) type.63 64Arguments:65 66    instance:67 68        the value to check69 70    type:71 72        the name of a known (JSON Schema) type73 74Returns:75 76    whether the instance is of the given type77 78Raises:79 80    `jsonschema.exceptions.UnknownType`:81 82        if ``type`` is not a known type83 84Nr)r�instance�types   r�is_type�Validator.is_type�r%r c��g)z�85Check if the instance is valid under the current `schema`.86 87Returns:88 89    whether the instance is valid or not90 91>>> schema = {"maxItems" : 2}92>>> Draft202012Validator(schema).is_valid([2, 3, 4])93False94 95Nr�rr's  r�is_valid�Validator.is_valid�r%r c��g)a�96Lazily yield each of the validation errors in the given instance.97 98>>> schema = {99...     "type" : "array",100...     "items" : {"enum" : [1, 2, 3]},101...     "maxItems" : 2,102... }103>>> v = Draft202012Validator(schema)104>>> for error in sorted(v.iter_errors([2, 3, 4]), key=str):105...     print(error.message)1064 is not one of [1, 2, 3]107[2, 3, 4] is too long108 109.. deprecated:: v4.0.0110 111    Calling this function with a second schema argument is deprecated.112    Use `Validator.evolve` instead.113Nrr,s  r�iter_errors�Validator.iter_errors�r%r c��g)a>114Check if the instance is valid under the current `schema`.115 116Raises:117 118    `jsonschema.exceptions.ValidationError`:119 120        if the instance is invalid121 122>>> schema = {"maxItems" : 2}123>>> Draft202012Validator(schema).validate([2, 3, 4])124Traceback (most recent call last):125    ...126ValidationError: [2, 3, 4] is too long127 128Nrr,s  r�validate�Validator.validate�r%r c��g)a�129Create a new validator like this one, but with given changes.130 131Preserves all other attributes, so can be used to e.g. create a132validator with a different schema but with the same :kw:`$ref`133resolution behavior.134 135>>> validator = Draft202012Validator({})136>>> validator.evolve(schema={"type": "number"})137Draft202012Validator(schema={'type': 'number'}, format_checker=None)138 139The returned object satisfies the validator protocol, but may not140be of the same concrete class! In particular this occurs141when a :kw:`$ref` occurs to a schema with a different142:kw:`$schema` than this one (i.e. for a different draft).143 144>>> validator.evolve(145...     schema={"$schema": Draft7Validator.META_SCHEMA["$id"]}146... )147Draft7Validator(schema=..., format_checker=None)148Nr)r�kwargss  r�evolve�Validator.evolve�r%r r)NN)149rrrrrzjsonschema.FormatChecker | Nonerz%referencing.jsonschema.SchemaRegistry�return�None)rrr9r:)r'rr(�strr9�bool)r'rr9r<)r'rr9zIterable[ValidationError])r'rr9r:)r9r)�__name__�150__module__�__qualname__�__firstlineno__�__doc__�__annotations__r�classmethodr#r)r-r0r3r7�__static_attributes__rr rrr's���*�\#�"�151"�!�3�2�7�6���
��152�:>�	�;>�
�����8�	�8�
�153���154��155��4��*�$r r)rA�156__future__r�typingrrrrr�collections.abcr	r157�referencing.jsonschema�referencing�158jsonschemar�jsonschema.exceptionsr�jsonschema.validatorsrrr r�<module>rMsJ���#�L�L��1�!�"�5�� ��~��~��~r 
codekingpro/portable-devtools · Team Ai