OwlCyberSecurity - MANAGER
Edit File: exceptions.cpython-311.pyc
� �������h�(����������������������������d�Z�ddlmZmZ�ddlZddlZddlZddlZddlm Z �ddl mZmZ��e ddg������������Z�e ��������������Z�e j����������������������Z�G�d��d e������������Z�G�d ��de������������Z�G�d��d e������������Z�ej��������d��������������G�d��de��������������������������Z�G�d��de������������Z�G�d��de������������Z�G�d��de������������Z�G�d��de������������Zeefd�Z�e��������������Zefd�ZdS�)z2 Validation errors, and some surrounding helpers. �����)�defaultdict�dequeN)�_utils)�PY3� iteritems�anyOf�oneOfc������������ ���������������e�Zd�Zedddeeeddf ��fd� Zd��Zd��ZereZnd��Ze d����������������Z ed����������������Zed ����������������Z d ��Zd��Z��xZS�)�_Error��Nc�����������������������t����������t����������|����������������������������������||||||||| | � ��� ���������||�_��������t ����������|������������x|�_��������|�_��������t ����������| ������������x|�_��������|�_��������t����������|������������|�_ ��������|x|�_��������|�_��������||�_ ��������||�_��������||�_��������||�_��������| |�_��������|D�] }|�|_��������� d�S��N)�superr����__init__�messager����path� relative_path�schema_path�relative_schema_path�list�context�cause� __cause__� validator�validator_value�instance�schema�parent) �selfr���r���r���r���r���r���r���r���r���r����error� __class__s ��� ��u/builddir/build/BUILD/imunify360-venv-2.5.2/opt/imunify360/venv/lib/python3.11/site-packages/jsonschema/exceptions.pyr���z_Error.__init__���s��������� �f�d���$�$����������� �� �� �����).�t���4�� �D�&�7<�[�7I�7I�I���4�4��G�}�}���&+�+�� �T�^�"���.��� �� ��������� �� �E��E�L�L� �� �����c������������������2�����d|�j���������j���������d|�j���������d�S�)N�<z: �>)r!����__name__r����r���s��� r"����__repr__z_Error.__repr__=���s ��������!�^�4�4�4�d�l�l�l�C�Cr#���c������������������>����|�j���������|�j��������|�j��������|�j��������f}t ����������d��|D���������������������������r|�j��������S�t ����������j��������|�j��������d�������������}t ����������j��������|�j��������d�������������}|�j��������t����������j ��������d� ����������������������������������������������|�j���������|�j��������t����������j ��������t����������|�j��������������������d�d����������������������t����������j��������|������������|�j��������t����������j ��������|�j��������������������t����������j��������|������������fz��z���S�)Nc��������������3����(���K����|�] }|t�����������u�V����d�S�r���)�_unset)�.0�ms��� r"���� <genexpr>z%_Error.__unicode__.<locals>.<genexpr>D���s&����������:�:�q�q�F�{�:�:�:�:�:�:r#����H�����widthzl Failed validating %r in %s%s: %s On %s%s: %s ���)r���r���r���r����anyr����pprint�pformat�textwrap�dedent�rstrip�!_word_for_schema_in_error_messager����format_as_indexr���r����indent�#_word_for_instance_in_error_messager���)r����essential_for_verbose�pschema� pinstances��� r"����__unicode__z_Error.__unicode__@���s ������N�D�0�$�-���! ����:�:�$9�:�:�:�:�:�� ��<���.���B�7�7�7���N�4�=��;�;�;� ��|�h�o��/������ �� �� �N��2��"�4��(A�#B�#B�3�B�3�#G�H�H��M�'�"�"��4��"�4�#5�6�6��M�)�$�$� � �� �� r#���c������������������F�����t����������|����������������������������������d������������S��Nzutf-8��unicode�encoder(���s��� r"����__str__z_Error.__str__^�����������4�=�=�'�'��0�0�0r#���c������������������6������|�di�|��������������������������������������S�)Nr����� _contents)�cls�others��� r"����create_fromz_Error.create_froma���s"�������s�'�'�U�_�_�&�&�'�'�'r#���c�����������������������|�j���������}|�|�j��������S�t����������|�j��������������������}|���������������������t ����������|j���������������������������������|S�r���)r���r���r���� extendleft�reversed� absolute_path�r���r���r���s��� r"���rR���z_Error.absolute_pathe���sI����������>��%�%��T�'�(�(�������!5�6�6�7�7�7��r#���c�����������������������|�j���������}|�|�j��������S�t����������|�j��������������������}|���������������������t ����������|j���������������������������������|S�r���)r���r���r���rP���rQ����absolute_schema_pathrS���s��� r"���rU���z_Error.absolute_schema_patho���sI����������>��,�,��T�.�/�/�������!<�=�=�>�>�>��r#���c�����������������������t����������|������������D�]-\��}}t����������|�|������������t����������u�rt����������|�||��������������.d�S�r���)r����getattrr,����setattr)r����kwargs�k�vs��� r"����_setz_Error._sety���sO�������f�%�%�� $�� $�D�A�q��t�Q���6�)�)���a��#�#�#�� $�� $r#���c������������������>�������d}t������������fd�|D���������������������������S�)N) r���r���r���r���r���r���r���r���r���r���c��������������3����<����K����|�]}|t�����������|������������fV����d�S�r���)rW���)r-����attrr���s��� �r"���r/���z#_Error._contents.<locals>.<genexpr>����s2�����������B�B�D�T�7�4��.�.�/�B�B�B�B�B�Br#���)�dict)r����attrss���` r"���rK���z_Error._contents~���s/������� ����B�B�B�B�E�B�B�B�B�B�Br#���)r'���� __module__�__qualname__r,���r���r)���rA���r���rG����classmethodrN����propertyrR���rU���r\���rK���� __classcell__�r!���s���@r"���r���r������s���������������� ��������% ��% ��% ��% ��% ��% �ND��D��D� �� �� �6���1���� 1�� 1�� 1���(��(���[�(��������X���������X��$��$��$� C��C��C��C��C��C��Cr#���r���c�������������������������e�Zd�ZdZdZdZdS�)�ValidationErrorz: An instance was invalid under a provided schema. r���r���N�r'���rb���rc����__doc__r:���r=���r���r#���r"���ri���ri�������s(������������������)1�%�*4�'�'�'r#���ri���c�������������������������e�Zd�ZdZdZdZdS�)�SchemaErrorzB A schema was invalid under its corresponding metaschema. � metaschemar���Nrj���r���r#���r"���rm���rm�������s(������������������)5�%�*2�'�'�'r#���rm���T)�hashc��������������������6�����e�Zd�ZdZ�ej����������������������Zd��ZdS�)�RefResolutionErrorz& A ref could not be resolved. c������������������*�����t����������|�j��������������������S�r���)�str�_causer(���s��� r"���rG���zRefResolutionError.__str__����s�������4�;���r#���N)r'���rb���rc���rk���r_����ibrt���rG���r���r#���r"���rq���rq�������s<�������������������T�W�Y�Y�F� �� �� �� �� r#���rq���c��������������������0�����e�Zd�ZdZd��Zd��ZereZdS�d��ZdS�)�UndefinedTypeCheckzN A type checker was asked to check a type it did not have registered. c�����������������������||�_���������d�S�r�����type)r���rz���s��� r"���r���zUndefinedTypeCheck.__init__����s �������� � � r#���c�����������������������d|�j���������z��S�)Nz'Type %r is unknown to this type checkerry���r(���s��� r"���rA���zUndefinedTypeCheck.__unicode__����s������8�4�9�D�Dr#���c������������������F�����t����������|����������������������������������d������������S�rC���rD���r(���s��� r"���rG���zUndefinedTypeCheck.__str__����rH���r#���N�r'���rb���rc���rk���r���rA���r���rG���r���r#���r"���rw���rw�������sa����������������������E��E��E����1����� 1�� 1�� 1�� 1�� 1r#���rw���c��������������������0�����e�Zd�ZdZd��Zd��ZereZdS�d��ZdS�)�UnknownTypezP A validator was asked to validate an instance against an unknown type. c������������������0�����||�_���������||�_��������||�_��������d�S�r���)rz���r���r���)r���rz���r���r���s��� r"���r���zUnknownType.__init__����s�������� � �� �����r#���c����������������������t����������j��������|�j��������d�������������}t����������j��������|�j��������d�������������}t ����������j��������d�����������������������������������������������|�j��������t����������j ��������|������������t����������j ��������|������������fz��S�)Nr0���r1���z� Unknown type %r for validator with schema: %s While checking instance: %s ) r5���r6���r���r���r7���r8���r9���rz���r���r<���)r���r?���r@���s��� r"���rA���zUnknownType.__unicode__����s{�������.���B�7�7�7���N�4�=��;�;�;� ���� ������ �� ���Y�� �g�.�.�� �i�0H�0H�I�J�� Jr#���c������������������F�����t����������|����������������������������������d������������S�rC���rD���r(���s��� r"���rG���zUnknownType.__str__����rH���r#���Nr}���r���r#���r"���r���r�������sa���������������������� J�� J�� J����1����� 1�� 1�� 1�� 1�� 1r#���r���c��������������������@�������e�Zd�ZdZd��fd� Zd��ZereZ��xZS�d��Z��xZS�)�FormatErrorz% Validating a format failed. Nc������������������������t����������t����������|����������������������������������||�������������||�_��������|x|�_��������|�_��������d�S�r���)r���r����r���r���r���r���)r���r���r���r!���s��� �r"���r���zFormatError.__init__����s<������� �k�4� � �)�)�'�5�9�9�9����&+�+�� �T�^�^�^r#���c�����������������������|�j���������S�r���)r���r(���s��� r"���rA���zFormatError.__unicode__����s �������|�r#���c������������������6�����|�j������������������������������d������������S�rC���)r���rF���r(���s��� r"���rG���zFormatError.__str__����s�������<�&�&�w�/�/�/r#���r���) r'���rb���rc���rk���r���rA���r���rG���rf���rg���s���@r"���r����r��������s|������������������,��,��,��,��,��,� ��������0������� 0�� 0�� 0�� 0�� 0�� 0�� 0r#���r����c��������������������X�����e�Zd�ZdZeZdd�Zd��Zd��Zd��Z d��Z d��Zd ��Ze d ����������������ZdS�) � ErrorTreezF ErrorTrees make it easier to check which validations failed. r���c�����������������������i�|�_���������t����������|�j��������������������|�_��������|D�]1}|�}|j��������D�] }||���������}�||j���������|j��������<���|j��������|_���������2d�S�r���)�errorsr���r!���rK���r���r���r���� _instance)r���r����r ���� container�elements��� r"���r���zErrorTree.__init__����sq���������$�T�^�4�4����� 1�� 1�E��I� �:�� /�� /��%�g�.� � �05�I��U�_�-�"'�.�I��� 1�� 1r#���c�����������������������||�j���������v�S�)zC Check whether ``instance[index]`` has any errors. rJ����r����indexs��� r"����__contains__zErrorTree.__contains__����s������ ����&�&r#���c������������������Z�����|�j���������t����������ur||�vr |�j���������|����������|�j��������|���������S�)a\�� Retrieve the child tree one level down at the given ``index``. If the index is not in the instance that this tree corresponds to and is not known by this tree, whatever error would be raised by ``instance.__getitem__`` will be propagated (usually this is some subclass of `exceptions.LookupError`. )r����r,���rK���r����s��� r"����__getitem__zErrorTree.__getitem__��s5��������>��'�'�E��,=�,=��N�5�!�!��~�e�$�$r#���c�����������������������||�j���������|<���dS�)zB Add an error to the tree at the given ``index``. NrJ���)r���r�����values��� r"����__setitem__zErrorTree.__setitem__��s�������!&���u���r#���c������������������*�����t����������|�j��������������������S�)zY Iterate (non-recursively) over the indices in the instance with errors. )�iterrK���r(���s��� r"����__iter__zErrorTree.__iter__��s������ ��D�N�#�#�#r#���c�����������������������|�j���������S�)z, Return the `total_errors`. )�total_errorsr(���s��� r"����__len__zErrorTree.__len__��s �������� � r#���c������������������B�����d|�j���������j���������dt����������|��������������d�S�)Nr%���z (z total errors)>)r!���r'����lenr(���s��� r"���r)���zErrorTree.__repr__"��s$��������+/�>�+B�+B�+B�C��I�I�I�I�N�Nr#���c�����������������������t����������d��t����������|�j��������������������D���������������������������}t����������|�j��������������������|z���S�)zT The total number of errors in the entire tree, including children. c��������������3����:���K����|�]\��}}t����������|������������V����d�S�r���)r����)r-����_�trees��� r"���r/���z)ErrorTree.total_errors.<locals>.<genexpr>+��s,����������N�N���D�3�t�9�9�N�N�N�N�N�Nr#���)�sumr���rK���r����r����)r����child_errorss��� r"���r����zErrorTree.total_errors%��s?��������N�N�I�d�n�4M�4M�N�N�N�N�N���4�;���,�.�.r#���N)r���)r'���rb���rc���rk���r,���r����r���r����r����r����r����r����r)���re���r����r���r#���r"���r����r��������s��������������������I� 1�� 1�� 1�� 1�'��'��'�%��%��%�&��&��&�$��$��$�!��!��!�O��O��O���/��/���X�/��/��/r#���r����c�����������������������������fd�}|S�)aq�� Create a key function that can be used to sort errors by relevance. Arguments: weak (set): a collection of validator names to consider to be "weak". If there are two errors at the same level of the instance and one is in the set of weak validator names, the other error will take priority. By default, :validator:`anyOf` and :validator:`oneOf` are considered weak validators and will be superseded by other same-level validation errors. strong (set): a collection of validator names to consider to be "strong" c������������������J������|�j���������}t����������|�j���������������������|�v|�v�fS�r���)r���r����r���)r ���r����strong�weaks��� ��r"���� relevancezby_relevance.<locals>.relevance?��s,��������O� ��E�J�����$�!6� �V�8K�K�Kr#���r���)r����r����r����s���`` r"����by_relevancer����/��s0�������� L��L��L��L��L��L���r#���c������������������������t����������|�������������}�t����������|�d������������}|�dS�t����������t����������j��������|g|�������������|�������������}|j��������rt ����������|j��������|�������������}|j���������|S�)a��� Try to find an error that appears to be the best match among given errors. In general, errors that are higher up in the instance (i.e. for which `ValidationError.path` is shorter) are considered better matches, since they indicate "more" is wrong with the instance. If the resulting match is either :validator:`oneOf` or :validator:`anyOf`, the *opposite* assumption is made -- i.e. the deepest error is picked, since these validators only need to match once, and any other errors may not be relevant. Arguments: errors (collections.Iterable): the errors to select from. Do not provide a mixture of errors from different validation attempts (i.e. from different instances or schemas), since it won't produce sensical output. key (collections.Callable): the key to use when sorting errors. See `relevance` and transitively `by_relevance` for more details (the default is to sort with the defaults of that function). Changing the default is only useful if you want to change the function that rates errors but still want the error context descent done by this function. Returns: the best matching error, or ``None`` if the iterable was empty .. note:: This function is a heuristic. Its return value may change for a given set of inputs from version to version if better heuristics are added. N)�key)r�����next�max� itertools�chainr����min)r����r�����bests��� r"���� best_matchr����H��sx������L��&�\�\�F������D��|����y���v�v�.�.�C�8�8�8�D� �,��*��4�<�S�)�)�)����,��*��Kr#���) rk����collectionsr���r���r����r5���r7���r_���� jsonschemar����jsonschema.compatr���r���� frozenset�WEAK_MATCHES�STRONG_MATCHES�Unsetr,���� Exceptionr���ri���rm����srq���rw���r���r�����objectr����r����r����r����r���r#���r"����<module>r�������sy��������+��*��*��*��*��*��*��*���������� � � � ������������������������,��,��,��,��,��,��,��,���y�'�7�+�,�,������� ������nC��nC��nC��nC��nC�Y��nC��nC��nC�b5��5��5��5��5�f��5��5��5�3��3��3��3��3�&��3��3��3�����T���� �� �� �� �� ��� �� ���� �1��1��1��1��1���1��1��1�$1��1��1��1��1�)��1��1��1�:0��0��0��0��0�)��0��0��0�(E/��E/��E/��E/��E/���E/��E/��E/�P�#�>���������,� �L�N�N� ��%��.��.��.��.��.��.r#���