Team Ai
Datasetpublic

codekingpro/portable-devtools

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

2��j�;��R�%SrSSKJr SSKJrJr SSKJr SSKJ	r	J3r4 SSKJrJ
r
Jr SSKrSSKrSSKrSSKJr SS	KJr SS5KJr \(aSSKJrJrJrJr SSKJr \"S
S/5r S\!S'\"5r"S\!S'\RF"S5r$\RJ"5r&S+Sjr'Sr("SS\)5r*"SS\*5r+"SS\*5r,\"SS9"SS\)55r-"SS \-\5r."S!S"\)5r/"S#S$\)5r0"S%S&\)5r1"S'S(5r2\ \"4S)jr3\3"5r4\44S*jr5g),z26Validation errors, and some surrounding helpers.7�)�annotations)�defaultdict�deque)�pformat)�dedent�indent)�
TYPE_CHECKING�Any�ClassVarN)�define)�Unresolvable)�_utils)�Iterable�Mapping�MutableMapping�Sequence)�_types�anyOf�oneOfzfrozenset[str]�WEAK_MATCHES�STRONG_MATCHESz^[a-zA-Z][a-zA-Z0-9_]*$c�H�[[USSS9U5R5$)zH8Format something for an error message as prettily as we currently can.9�HF)�width�10sort_dicts)rr�lstrip)�thing�prefixs  �[D:\code\apps\devtools\python\user_packages\Python313\site-packages\jsonschema/exceptions.py�_prettyr  s#���'�%�r�e�<�f�E�L�L�N�N�c��US:Xa.[R"[R[SS9 [$[S[SU35e)N�RefResolutionError���11stacklevelzmodule z has no attribute )�warnings�warn�_RefResolutionError�_DEPRECATION_MESSAGE�DeprecationWarning�AttributeError�__name__)�names r�__getattr__r/'sG���#�#��
�
��4�4���	12�13#�"�14�7�8�*�,>�t�f�E�15F�Fr!c16�^�\rSrSr%S\S'S\S'\SSS\\\SS\417SU4SjjjrSSjrSS	jr\	SS18j5r19\SSj5r\SSj5r
\SS
j5rSSSjjrSrSSjrSrU=r$)�_Error�2z
ClassVar[str]�!_word_for_schema_in_error_message�#_word_for_instance_in_error_message�Nc�@>�[T
U]UUUUUUUUU	U20521 Xl[U5=UlUl[U	5=UlUl[U5Ul	U=Ul22UlX lX`l
XplX�lX�lX�lUH	nXlM g�N)�super�__init__�messager�path�
relative_path�schema_path�relative_schema_path�list�context�cause�	__cause__�	validator�validator_value�instance�schema�parent�
_type_checker)�selfr:rCr;rAr@rDrErFr=rG�type_checker�error�	__class__s             �rr9�_Error.__init__7s����	�������������	23���).�t��4��	�D�&�7<�[�7I�I���4�4��G�}���&+�+��24�T�^�"��.�� �
�����)���E��L�r!c�R�SURRSUR<S3$)N�<�: �>)rLr-r:�rIs r�__repr__�_Error.__repr__`s'���4�>�>�*�*�+�2�d�l�l�-=�Q�?�?r!c�.�URURURUR4n[	SU55(aUR25$[R"UR[UR5SSS9n[R"URURS9nSn[SUR26SUR<SUS[URUS	9S27US[URUS	9S3
R55$)Nc3�0# �UHo[Lv� M g7fr7)�_unset)�.0�ms  r�	<genexpr>�!_Error.__str__.<locals>.<genexpr>gs���:�$9�q�F�{�$9�s������)�	container�indices�                z            z 28 29            Failed validating z in z:30                �rz31 32            On �
33            )rCrDrErF�anyr:r�format_as_indexr3r?r>r4r<rr �rstrip)rI�essential_for_verboser=�
instance_pathrs     r�__str__�_Error.__str__cs���N�N�D�0�0�$�-�-����!34���:�$9�:�:�:��<�<���,�,��<�<���2�2�3�C�R�8�35���.�.��>�>��&�&�36�
����
�
�\�\�N��#�~�~�0��[�M�B�����V�4�5�6��������v�6�7�8
�
����3738�39	40r!c�.�U"S0UR5D6$)Nr5��	_contents)�cls�others  r�create_from�_Error.create_from�s���'�U�_�_�&�'�'r!c��URnUcUR$[UR5nUR[	UR4155 U$r7)rGr<r�42extendleft�reversed�
absolute_path�rIrGr;s   rrs�_Error.absolute_path�sH�������>��%�%�%��T�'�'�(�������!5�!5�6�7��r!c��URnUcUR$[UR5nUR[	UR4355 U$r7)rGr>rrqrr�absolute_schema_pathrts   rrw�_Error.absolute_schema_path�sH�������>��,�,�,��T�.�.�/�������!<�!<�=�>��r!c�(�SnURHn[U[5(aUS[U5-S--
nM.[RU5(a44USU--
nMRUR
SS5R
SS5nUS	U-S45--
nM� U$)N�$�[�]�.�\z\\�'z\'z['z'])rs�46isinstance�int�str�&_JSON_PATH_COMPATIBLE_PROPERTY_PATTERN�match�replace)rIr;�elem�escaped_elems    r�	json_path�_Error.json_path�s������&�&�D��$��$�$���c�$�i��#�-�-��7�=�=�d�C�C���d�47�"��#�|�|�D�&�9�A�A�#�u�M����|�+�d�2�2��'��r!c��UbUR[LaXlUR5H%up4[X5[LdM[	XU5 M' gr7)rHrW�items�getattr�setattr)rIrJ�kwargs�k�vs     r�_set�_Error._set�sF��48�#��(:�(:�f�(D�!-���L�L�N�D�A��t��6�)����#�#r!c�H�SnUVs0sHo"[X5_M sn$s snf)N)49r:rAr@rCrDr;r=rErFrG)r�)rI�attrs�attrs   rrk�_Error._contents�s+��50��7<�<�e�d�g�d�)�)�e�<�<��<s�c��^�TRSn[U[5(a&TR51R
TRU5$[U4SjU55$![[4a gf=f)N�typeFc3�p># �UH+nTRRTRU5v� M- g7fr7)rH�is_typerE)rX�
expected_typerIs  �rrZ�'_Error._matches_type.<locals>.<genexpr>�s2����52�!)�
�
���&�&�t�}�}�m�D�D�!)�s�36)	rF�KeyError�	TypeErrorr�r�rHr�rErb)rI�expecteds` r�
_matches_type�_Error._matches_type�su���	��{�{�6�*�H��h��$�$��%�%�-�-�d�m�m�X�F�F��53�!)�54�55�	56��
�)�$�	��	�s�A"�"A5�4A5)rBrHrAr@rEr:rGr;r<r>rFr=rCrD)r:r�rCr�r;�Iterable[str | int]rAzException | NonerDr57rEr58rFzMapping[str, Any] | boolr=r�rGz
_Error | NonerJz_types.TypeChecker�return�None�r�r�)rmr1)r�zSequence[str | int]r7)rJz_types.TypeChecker | Noner�r59r�r�)r��bool)r-�60__module__�__qualname__�__firstlineno__�__annotations__rWr9rSrg�classmethodrn�propertyrsrwr�r�rkr��__static_attributes__�
__classcell__�rLs@rr1r12s6���'4�4�)6�6�61 �$&�"&��%��+1�+-� $�+1�' ��' ��' �"�	' �62 �' ��' ��' �)�' �)�' ��' �)�' �63�' �' �R@�64�:�(��(����������65��66�37�67$�/�68$��69$�70�	71$�=�
72�
73r!r1c� �\rSrSrSrSrSrSrg)�ValidationError��z274An instance was invalid under a provided schema.75rFrEr5N�r-r�r�r��__doc__r3r4r�r5r!rr�r��s���)1�%�*4�'r!r�c� �\rSrSrSrSrSrSrg)�SchemaError��z:76A schema was invalid under its corresponding metaschema.77�78metaschemarFr5Nr�r5r!rr�r��s���)5�%�*2�'r!r�F)�slotsc�8�\rSrSr%SrSrS\S'SrS79SjrSr	g	)r)��z80A ref could not be resolved.81z�jsonschema.exceptions.RefResolutionError is deprecated as of version 4.18.0. If you wish to catch potential reference resolution errors, directly catch referencing.exceptions.Unresolvable.�	Exception�_causec�r�URURLa[$URUR:H$r7)rL�NotImplementedr��rIrms  r�__eq__�_RefResolutionError.__eq__�s+���>�>����0�!�!��{�{�e�l�l�*�*r!c�,�[UR5$r7)r�r�rRs rrg�_RefResolutionError.__str__�s���4�;�;��r!r5Nr�)82r-r�r�r�r�r*r�r�rgr�r5r!rr)r)�s#���83	>��
��+�84 r!r)c�<�\rSrSrS85SjrSrSrSrSrSr	Sr86g	)�_WrappedReferencingError��c�2�[RUSU5 g)N�_wrapped)�object�__setattr__)rIrAs  rr9�!_WrappedReferencingError.__init__�s�����4��U�3r!c���URURLaURUR:H$URURRLaURU:H$[$r7)rLr�r�r�s  rr��_WrappedReferencingError.__eq__�sP���?�?�d�n�n�,��=�=�E�N�N�2�2�
�_�_��
�
� 7� 7�
7��=�=�E�)�)��r!c�.�[URU5$r7)r�r�)rIr�s  rr/�$_WrappedReferencingError.__getattr__�s���t�}�}�d�+�+r!c�,�[UR5$r7)�hashr�rRs r�__hash__�!_WrappedReferencingError.__hash__�s���D�M�M�"�"r!c�$�SUR<S3$)Nz<WrappedReferencingError rQ)r�rRs rrS�!_WrappedReferencingError.__repr__s��*�4�=�=�*;�1�=�=r!c�`�URRRSUR3$)NrP)r�rLr-rRs rrg� _WrappedReferencingError.__str__s(���-�-�)�)�2�2�3�2�d�m�m�_�E�Er!r5N)rA�
_Unresolvable)r-r�r�r�r9r�r/r�rSrgr�r5r!rr�r��s!��4��,�#�>�Fr!r�c�,�\rSrSrSrSSjrSSjrSrg)	�UndefinedTypeChecki	zF87A type checker was asked to check a type it did not have registered.88c��Xlgr7�r�)rIr�s  rr9�UndefinedTypeCheck.__init__s���	r!c�$�SUR<S3$)NzType z  is unknown to this type checkerr�rRs rrg�UndefinedTypeCheck.__str__s���t�y�y�m�#C�D�Dr!r�N)r�r�r�r�r��r-r�r�r�r�r9rgr�r5r!rr�r�	s����Er!r�c�$�\rSrSrSrSrSrSrg)�UnknownTypeizH89A validator was asked to validate an instance against an unknown type.90c�(�XlX lX0lgr7)r�rErF)rIr�rErFs    rr9�UnknownType.__init__s���	� �
��r!c��Sn[SUR<S[URUS9S[URUS9S3R55$)Nr_z            Unknown type z, for validator with schema:91                r`z792 93            While checking instance:94                ra)rr�r rFrErd)rIrs  rrg�UnknownType.__str__sc�������)�)��'�����V�4�5�6�����v�6�7�8
�
����95�	96r!)rErFr�Nr�r5r!rr�r�s����9798r!r�c�6^�\rSrSrSrSU4SjjrSrSrU=r$)�FormatErrori-z99Validating a format failed.100c�L>�[TU]X5 XlU=UlUlgr7)r8r9r:rArB)rIr:rArLs   �rr9�FormatError.__init__2s#���
����(���&+�+��101�T�^r!c��UR$r7)r:rRs rrg�FormatError.__str__7s���|�|�r!)rBrAr:r7)	r-r�r�r�r�r9rgr�r�r�s@rr�r�-s����,�102�r!r�c�f�\rSrSrSr\rS
SSjjrSSjrSr	SSjr103SrSrS	r
\S1045rSrg)�	ErrorTreei;z>105ErrorTrees make it easier to check which validations failed.106c���0Ul[UR5UlUHEnUnURHnX4nM	 X#RUR107'URUlMG gr7)�errorsrrLrkr;rCrE�	_instance)rIr�rKr]�elements     rr9�ErrorTree.__init__Bs\��<>���2=�d�n�n�2M����E��I� �:�:��%�.�	�&�05���U�_�_�-�"'�.�.�I��
r!c��XR;$)z3108Check whether ``instance[index]`` has any errors.109rj�rI�indexs  r�__contains__�ErrorTree.__contains__Ns�����&�&r!c�n�UR[LaX;aURU URU$)a!110Retrieve the child tree one level down at the given ``index``.111 112If the index is not in the instance that this tree corresponds113to and is not known by this tree, whatever error would be raised114by ``instance.__getitem__`` will be propagated (usually this is115some subclass of `LookupError`.116)r�rWrkr�s  r�__getitem__�ErrorTree.__getitem__Ts0���>�>��'�E�,=��N�N�5�!��~�~�e�$�$r!c�T�[R"S[SS9 X RU'g)z�117Add an error to the tree at the given ``index``.118 119.. deprecated:: v4.20.0120 121    Setting items on an `ErrorTree` is deprecated without replacement.122    To populate a tree, provide all of its sub-errors when you123    construct the tree.124z8ErrorTree.__setitem__ is deprecated without replacement.r$r%N)r'r(r+rk)rIr��values   r�__setitem__�ErrorTree.__setitem__as'��	�
�
�F���	125�126!&���u�r!c�,�[UR5$)zI127Iterate (non-recursively) over the indices in the instance with errors.128)�iterrkrRs r�__iter__�ErrorTree.__iter__rs���D�N�N�#�#r!c��UR$)z129Return the `total_errors`.130)�total_errorsrRs r�__len__�ErrorTree.__len__xs��� � � r!c�l�[U5nUS:XaSOSnSURRSUSUS3$)N�rKr�rOz (z total z)>)�lenrLr-)rI�totalr�s   rrS�ErrorTree.__repr__~s>���D�	��!�Q�J��H���4�>�>�*�*�+�2�e�W�G�F�8�2�F�Fr!c��[SURR555n[UR5U-$)zD131The total number of errors in the entire tree, including children.132c3�<# �UHup[U5v� M g7fr7)r)rX�_�trees   rrZ�)ErrorTree.total_errors.<locals>.<genexpr>�s���K�4J���3�t�9�9�4J�s�)�sumrkr�rr�)rI�child_errorss  rr�ErrorTree.total_errors�s5��133�K�D�N�N�4H�4H�4J�K�K���4�;�;��,�.�.r!)rkr�N)r5)r�zIterable[ValidationError])r��	str | int)r�rr�r�)r-r�r�r�r�rWr�r9r�r�r�rrrSr�rr�r5r!rr�r�;sF����I�1341�'�%�&�"$�!�G�135�/��/r!r�c�^^�UU4SjnU$)aG136Create a key function that can be used to sort errors by relevance.137 138Arguments:139    weak (set):140        a collection of validation keywords to consider to be141        "weak".  If there are two errors at the same level of the142        instance and one is in the set of weak validation keywords,143        the other error will take priority. By default, :kw:`anyOf`144        and :kw:`oneOf` are considered weak keywords and will be145        superseded by other same-level validation errors.146 147    strong (set):148        a collection of validation keywords to consider to be149        "strong"150 151c�>�URn[UR5*URUT;UT;UR5(+4$r7)rCrr;r�)rKrC�strong�weaks  ��r�	relevance�by_relevance.<locals>.relevance�sJ����O�O�	�
����_���J�J��T�!�����#�#�%�%�152�	153r!r5)rrrs`` r�by_relevancer�s���&154��r!c��[XSS9nUcgUR(aa[R"SURUS9n[	U5S:XaU"US5U"US5:XaU$USnUR(aMaU$)aq155Try to find an error that appears to be the best match among given errors.156 157In general, errors that are higher up in the instance (i.e. for which158`ValidationError.path` is shorter) are considered better matches,159since they indicate "more" is wrong with the instance.160 161If the resulting match is either :kw:`oneOf` or :kw:`anyOf`, the162*opposite* assumption is made -- i.e. the deepest error is picked,163since these keywords only need to match once, and any other errors164may not be relevant.165 166Arguments:167    errors (collections.abc.Iterable):168 169        the errors to select from. Do not provide a mixture of170        errors from different validation attempts (i.e. from171        different instances or schemas), since it won't produce172        sensical output.173 174    key (collections.abc.Callable):175 176        the key to use when sorting errors. See `relevance` and177        transitively `by_relevance` for more details (the default is178        to sort with the defaults of that function). Changing the179        default is only useful if you want to change the function180        that rates errors but still want the error context descent181        done by this function.182 183Returns:184    the best matching error, or ``None`` if the iterable was empty185 186.. note::187 188    This function is a heuristic. Its return value may change for a given189    set of inputs from version to version if better heuristics are added.190 191N)�key�defaultr$)rrr192)�maxr@�heapq�	nsmallestr)r�r�best�smallests    r�193best_matchr&�s}��N�v��-�D��|��194�,�,��?�?�1�d�l�l��<���x�=�A��#�h�q�k�"2�c�(�1�+�6F�"F��K���{��
�,�,�,��Kr!)rr195rr�)6r��196__future__r�collectionsrr�pprintr�textwraprr�typingr	r197rr"�rer'r�r�referencing.exceptionsr
r��198jsonschemar�collections.abcrrrrr�	frozensetrr�r�compiler��UnsetrWr r/r�r1r�r�r)r�r�r�r�r�rrr&r5r!r�<module>r3s3���#�*��#�/�/��	���@���K�K�!�(�'�7�);�<��n�<�!*����,�)+���4M�)N�&�	�����O�G�S199�Y�S200�l5�f�5�3�&�3��e�� �)� �� �,F�2�M�F�0	E��	E�201�)�202�0�)��N/�N/�b#�>��@
�N�	��%�2r!
codekingpro/portable-devtools · Team Ai