OwlCyberSecurity - MANAGER
Edit File: models.cpython-311.pyc
� �������h�3���������������������������d�dl�Z�d�dlmZ�d�dlmZ�d�dlmZ�d�dlmZ�d�dl m Z �d�dlmZm Z mZmZmZmZmZ�dd lmZmZ�dd lmZ�ddlmZmZmZ��G�d��d ������������Z�G�d��d������������Zeeef���������Z ee ���������Z!�G�d��d������������Z"dS�)�����N)�Counter)�aliases)�sha256)�dumps)�sub)�Any�Dict�Iterator�List�Optional�Tuple�Union����)�NOT_PRINTABLE_PATTERN�TOO_BIG_SEQUENCE)� mess_ratio)� iana_name�is_multi_byte_encoding� unicode_rangec������������������������e�Zd�Z �d*dededededddee���������fd �Zd e defd�Z d e defd �Zedefd���������������Z edefd���������������Zedefd���������������Zedefd���������������Zdefd�Zdefd�Zd+d�Zedefd���������������Zedee���������fd���������������Zedefd���������������Zedefd���������������Zedee���������fd���������������Zedefd���������������Zedefd���������������Zedefd���������������Zedefd���������������Zedefd���������������Zedefd���������������Z eded����������fd ���������������Z!edefd!���������������Z"edee���������fd"���������������Z#edee���������fd#���������������Z$d,d$�Z%d,d%�Z&d-d'edefd(�Z'edefd)���������������Z(dS�).�CharsetMatchN�payload�guessed_encoding�mean_mess_ratio�has_sig_or_bom� languages�CoherenceMatches�decoded_payloadc�����������������������||�_���������||�_��������||�_��������||�_��������||�_��������d�|�_��������g�|�_��������d|�_��������d�|�_��������d�|�_ ��������||�_ ��������d�S�)N���������)�_payload� _encoding�_mean_mess_ratio� _languages�_has_sig_or_bom�_unicode_ranges�_leaves�_mean_coherence_ratio�_output_payload�_output_encoding�_string)�selfr���r���r���r���r���r���s��� �y/builddir/build/BUILD/imunify360-venv-2.5.2/opt/imunify360/venv/lib/python3.11/site-packages/charset_normalizer/models.py�__init__zCharsetMatch.__init__���s[������� �� �)��� /���#���-���#������%(��"�#��� $���&����������other�returnc�����������������������t����������|t����������������������sGt����������d���������������������t ����������|j��������������������t ����������|�j���������������������������������������������|�j��������|j��������k����o|�j��������|j��������k����S�)Nz&__eq__ cannot be invoked on {} and {}.)� isinstancer���� TypeError�format�str� __class__�encoding�fingerprint�r,���r0���s��� r-����__eq__zCharsetMatch.__eq__(���ss�������%��.�.�� ��8�?�?����(�(�#�d�n�*=�*=�������� � ��}���.�X�4�3C�u�GX�3X�Xr/���c������������������N����t����������|t����������������������st�����������t����������|�j��������|j��������z ��������������}t����������|�j��������|j��������z ��������������}|dk�����r<|dk����r6|dk����r |�j��������|j��������k����r|�j��������|j��������k����S�|�j��������|j��������k����S�|�j��������|j��������k�����S�)zQ Implemented to make sorted available upon CharsetMatches items. g{�G�z�?g{�G�z�?r ���)r3���r���� ValueError�abs�chaos� coherence�multi_byte_usage)r,���r0����chaos_difference�coherence_differences��� r-����__lt__zCharsetMatch.__lt__1���s���������%��.�.�� ����t�z�E�K�7�8�8��"�4�>�E�O�#C�D�D����d�"�"�';�d�'B�'B��3�&�&�4�>�U�_�+L�+L��,�u�/E�E�E��>�E�O�3�3��z�E�K�'�'r/���c������������������j�����dt����������t����������|�������������������������t����������|�j��������������������z��z ��S�)N��������?)�lenr6����raw�r,���s��� r-���rA���zCharsetMatch.multi_byte_usageD���s&�������S��T���^�^�c�$�(�m�m�3�3�3r/���c������������������p�����t����������j��������dt�����������������������t����������t ����������|�������������d������������S�)z� Check once again chaos in decoded text, except this time, with full content. Use with caution, this can be very slow. Notice: Will be removed in 3.0 z=chaos_secondary_pass is deprecated and will be removed in 3.0rF���)�warnings�warn�DeprecationWarningr���r6���rI���s��� r-����chaos_secondary_passz!CharsetMatch.chaos_secondary_passH���s6������� � �K�� �� �� ���#�d�)�)�S�)�)�)r/���c������������������:�����t����������j��������dt�����������������������dS�)zy Coherence ratio on the first non-latin language detected if ANY. Notice: Will be removed in 3.0 z<coherence_non_latin is deprecated and will be removed in 3.0r ���)rK���rL���rM���rI���s��� r-����coherence_non_latinz CharsetMatch.coherence_non_latinU���s%������� � �J�� �� �� ���sr/���c������������������������t����������j��������dt�����������������������t����������t����������dt����������|������������������������������������������������������������}t����������|�����������������������������������������������S�)z_ Word counter instance on decoded text. Notice: Will be removed in 3.0 z2w_counter is deprecated and will be removed in 3.0� ) rK���rL���rM���r���r���r6����lowerr����split)r,����string_printable_onlys��� r-���� w_counterzCharsetMatch.w_countera���s^������� � �@�BT� �� �� ��!$�$9�3��D� � ���@Q�@Q� R� R���,�2�2�4�4�5�5�5r/���c������������������^�����|�j���������� t����������|�j��������|�j��������d������������|�_���������|�j���������S�)N�strict)r+���r6���r!���r"���rI���s��� r-����__str__zCharsetMatch.__str__o���s)�������<���t�}�d�n�h�G�G�D�L��|�r/���c������������������B�����d����������������������|�j��������|�j��������������������S�)Nz<CharsetMatch '{}' bytes({})>)r5���r8���r9���rI���s��� r-����__repr__zCharsetMatch.__repr__u���s������.�5�5�d�m�T�EU�V�V�Vr/���c������������������������t����������|t����������������������r||�k����r't����������d���������������������|j���������������������������������d�|_��������|�j�����������������������������|�������������d�S�)Nz;Unable to add instance <{}> as a submatch of a CharsetMatch)r3���r���r=���r5���r7���r+���r'����appendr:���s��� r-����add_submatchzCharsetMatch.add_submatchx���sk�������%��.�.�� �%�4�-�-��M�T�T��O�������� ���� �����E�"�"�"�"�"r/���c�����������������������|�j���������S��N)r"���rI���s��� r-���r8���zCharsetMatch.encoding����s �������~�r/���c�����������������������g�}t����������j����������������������D�]F\��}}|�j��������|k����r|���������������������|��������������&|�j��������|k����r|���������������������|��������������G|S�)z� Encoding name are known by many name, using this could help when searching for IBM855 when it's listed as CP855. )r����itemsr8���r]���)r,���� also_known_as�u�ps��� r-����encoding_aliaseszCharsetMatch.encoding_aliases����sn������ �� ��M�O�O�� (�� (�D�A�q��}��!�!��$�$�Q�'�'�'�'���!�#�#��$�$�Q�'�'�'���r/���c�����������������������|�j���������S�r`����r%���rI���s��� r-����bomzCharsetMatch.bom������������#�#r/���c�����������������������|�j���������S�r`���rh���rI���s��� r-����byte_order_markzCharsetMatch.byte_order_mark����rj���r/���c������������������$�����d��|�j���������D���������������S�)z� Return the complete list of possible languages found in decoded sequence. Usually not really useful. Returned list may be empty even if 'language' property return something != 'Unknown'. c�����������������������g�|�] }|d������������S�)r�����)�.0�es��� r-���� <listcomp>z*CharsetMatch.languages.<locals>.<listcomp>����s������.�.�.���!��.�.�.r/����r$���rI���s��� r-���r���zCharsetMatch.languages����s�������/�.�d�o�.�.�.�.r/���c����������������������|�j���������shd|�j��������v�rdS�ddlm}m}�t����������|�j��������������������r�||�j��������������������n�||�j��������������������}t����������|������������dk����sd|v�rdS�|d���������S�|�j���������d���������d���������S�)z� Most probable language found in decoded sequence. If none were detected or inferred, the property will return "Unknown". �ascii�Englishr���)�encoding_languages�mb_encoding_languageszLatin Based�Unknown)r$����could_be_from_charset�charset_normalizer.cdrw���rx���r���r8���rG���)r,���rw���rx���r���s��� r-����languagezCharsetMatch.language����s����������� ���$�4�4�4� �y�� X�W�W�W�W�W�W�W��*�$�-�8�8�7�%�%�d�m�4�4�4�'�'�� �6�6�� ���9�~�~��"�"�m�y�&@�&@� �y��Q�<����q�!�!�$�$r/���c�����������������������|�j���������S�r`���)r#���rI���s��� r-���r?���zCharsetMatch.chaos����s�������$�$r/���c������������������:�����|�j���������sdS�|�j���������d���������d���������S�)Nr ���r���r���rs���rI���s��� r-���r@���zCharsetMatch.coherence����s#��������� ��3���q�!�!�$�$r/���c������������������4�����t����������|�j��������dz��d�������������S��N�d�������)�ndigits)�roundr?���rI���s��� r-���� percent_chaoszCharsetMatch.percent_chaos����s�������T�Z�#�%�q�1�1�1�1r/���c������������������4�����t����������|�j��������dz��d�������������S�r����)r����r@���rI���s��� r-����percent_coherencezCharsetMatch.percent_coherence����s�������T�^�c�)�1�5�5�5�5r/���c�����������������������|�j���������S�)z+ Original untouched bytes. )r!���rI���s��� r-���rH���zCharsetMatch.raw����s������ ��}�r/���c�����������������������|�j���������S�r`���)r'���rI���s��� r-����submatchzCharsetMatch.submatch����s �������|�r/���c������������������2�����t����������|�j��������������������dk����S��Nr���)rG���r'���rI���s��� r-����has_submatchzCharsetMatch.has_submatch����s�������4�<� � �1�$�$r/���c�����������������������|�j����������|�j���������S�d��t����������|�������������D���������������}t����������t����������d��|D���������������������������������������|�_���������|�j���������S�)Nc������������������,�����g�|�]}t����������|��������������S�ro���)r���)rp����chars��� r-���rr���z*CharsetMatch.alphabets.<locals>.<listcomp>����s-������� �� �� �$(�M�$��� �� �� r/���c�����������������������h�|�]}|�|��S�ro���ro���)rp����rs��� r-���� <setcomp>z)CharsetMatch.alphabets.<locals>.<setcomp>����s������+L�+L�+L�!�!�+L�A�+L�+L�+Lr/���)r&���r6����sorted�list)r,����detected_rangess��� r-���� alphabetszCharsetMatch.alphabets����sj��������+��'�'� �� �,/��I�I� �� �� ��� &�d�+L�+L��+L�+L�+L�&M�&M�N�N����#�#r/���c������������������6�����|�j���������gd��|�j��������D���������������z���S�)z� The complete list of encoding that output the exact SAME str result and therefore could be the originating encoding. This list does include the encoding available in property 'encoding'. c�����������������������g�|�] }|j����������� S�ro���)r8���)rp����ms��� r-���rr���z6CharsetMatch.could_be_from_charset.<locals>.<listcomp>����s������"D�"D�"D�!�1�:�"D�"D�"Dr/���)r"���r'���rI���s��� r-���rz���z"CharsetMatch.could_be_from_charset����s%����������"D�"D�t�|�"D�"D�"D�D�Dr/���c�����������������������|�S��z> Kept for BC reasons. Will be removed in 3.0. ro���rI���s��� r-����firstzCharsetMatch.first����� ��������r/���c�����������������������|�S�r����ro���rI���s��� r-����bestzCharsetMatch.best����r����r/����utf_8r8���c�����������������������|�j����������|�j���������|k����r/||�_���������t����������|����������������������������������|d������������|�_��������|�j��������S�)z� Method to get re-encoded bytes payload using given target encoding. Default to UTF-8. Any errors will be simply ignored by the encoder NOT replaced. N�replace)r*���r6����encoder)���)r,���r8���s��� r-����outputzCharsetMatch.output��sI������ �� �(�D�,A�X�,M�,M�$,�D�!�#&�t�9�9�#3�#3�H�i�#H�#H�D� ��#�#r/���c������������������h�����t����������|�����������������������������������������������������������������������������������S�)zw Retrieve the unique SHA256 computed using the transformed (re-encoded) payload. Not the original one. )r���r����� hexdigestrI���s��� r-���r9���zCharsetMatch.fingerprint ��s&������ ��d�k�k�m�m�$�$�.�.�0�0�0r/���r`���)r0���r���r1���N)r1���r���)r����))�__name__� __module__�__qualname__�bytesr6����float�boolr���r.����objectr;���rD����propertyrA���rN���rP���r���rV���rY���r[���r^���r8���r���rf���ri���rl���r���r|���r?���r@���r����r����rH���r����r����r����rz���r����r����r����r9���ro���r/���r-���r���r������s~��������������*.�'��'��'���'��� '� ��'��&� '��"�#��'��'��'��'�2Y�F��Y�t��Y��Y��Y��Y�(�F��(�t��(��(��(��(�&��4�%��4��4��4���X�4��� *�e�� *�� *�� *���X� *��� �U�� �� �� ���X� ���6�7��6��6��6���X�6�����������W�#��W��W��W��W� #�� #�� #�� #����#���������X���� �$�s�)�� �� �� ���X� ���$�T��$��$��$���X�$���$���$��$��$���X�$���/�4��9��/��/��/���X�/���%�#��%��%��%���X�%�6��%�u��%��%��%���X�%���%�5��%��%��%���X�%� ��2�u��2��2��2���X�2���6�5��6��6��6���X�6����U���������X�����$�~�.���������X����%�d��%��%��%���X�%��� $�4��9�� $�� $�� $���X� $���E�t�C�y��E��E��E���X�E��������������� $�� $�s�� $��� $�� $�� $�� $���1�S��1��1��1���X�1��1��1r/���r���c�������������������������e�Zd�ZdZddee���������fd�Zdee���������fd�Zde e ef���������defd�Zde fd �Z defd �Zdeddfd�Zded���������fd �Zded���������fd�ZdS�)�CharsetMatchesz� Container with every CharsetMatch items ordered by default from most probable to the less one. Act like a list(iterable) but does not implements all related methods. N�resultsc������������������6�����|rt����������|������������ng�|�_��������d�S�r`���)r�����_results)r,���r����s��� r-���r.���zCharsetMatches.__init__��s������+2�:��w������ � � r/���r1���c��������������#����$���K����|�j���������E�d�{V����d�S�r`����r����rI���s��� r-����__iter__zCharsetMatches.__iter__��s&�����������=� � � � � � � � � r/����itemc������������������������t����������|t����������������������r |�j��������|���������S�t����������|t����������������������r't ����������|d������������}|�j��������D�]}||j��������v�r|c�S��t�����������)z� Retrieve a single item either by its position or encoding name (alias may be used here). Raise KeyError upon invalid index or encoding not present in results. F)r3����intr����r6���r���rz����KeyError)r,���r�����results��� r-����__getitem__zCharsetMatches.__getitem__!��sv������ ��d�C� � �� '��=��&�&��d�C� � �� "��T�5�)�)�D��-�� "�� "���6�7�7�7�!�M�M�M��8��r/���c������������������*�����t����������|�j��������������������S�r`����rG���r����rI���s��� r-����__len__zCharsetMatches.__len__/��s�������4�=�!�!�!r/���c������������������2�����t����������|�j��������������������dk����S�r����r����rI���s��� r-����__bool__zCharsetMatches.__bool__2��s�������4�=�!�!�A�%�%r/���c����������������������t����������|t����������������������s4t����������d���������������������t ����������|j���������������������������������������������t ����������|j��������������������t����������k����rB|�j ��������D�]:}|j ��������|j ��������k����r(|j��������|j��������k����r|���������������������|��������������dS��;|�j ��������� ��������������������|�������������t����������|�j ��������������������|�_ ��������dS�)z~ Insert a single match. Will be inserted accordingly to preserve sort. Can be inserted as a submatch. z-Cannot append instance '{}' to CharsetMatchesN)r3���r���r=���r5���r6���r7���rG���rH���r���r����r9���r?���r^���r]���r����)r,���r�����matchs��� r-���r]���zCharsetMatches.append5��s������� ��$��-�-�� ��?�F�F����'�'�������� ���t�x�=�=�,�,�,���� �� ���$��(8�8�8�U�[�D�J�=V�=V��&�&�t�,�,�,��F�F��� ���T�"�"�"��t�}�-�-�� � � r/���r���c������������������.�����|�j���������sdS�|�j���������d���������S�)zQ Simply return the first match. Strict equivalent to matches[0]. Nr���r����rI���s��� r-���r����zCharsetMatches.bestI��s ��������}�� ��4��}�Q��r/���c������������������*�����|�������������������������������������S�)zP Redundant method, call the method best(). Kept for BC reasons. )r����rI���s��� r-���r����zCharsetMatches.firstQ��s��������y�y�{�{�r/���r`���)r����r����r�����__doc__r���r���r.���r ���r����r���r����r6���r����r����r����r����r]���r���r����r����ro���r/���r-���r����r������s%���������������� ;��;��\� 2��;��;��;��;�!�(�<�0��!��!��!��!���c�3�h����L���������"���"��"��"��"�&�$��&��&��&��&�.�<��.�D��.��.��.��.�( �h�~�.�� �� �� �� ��x��/������������r/���r����c�������������������������e�Zd�Zdedee���������dee���������dee���������dedee���������deded ed ee���������defd�Ze d e eef���������fd���������������Zd efd�Z dS�)�CliDetectionResult�pathr8���rf����alternative_encodingsr|���r����r���r?���r@����unicode_path�is_preferredc�����������������������||�_���������| |�_��������||�_��������||�_��������||�_��������||�_��������||�_��������||�_��������||�_��������| |�_ ��������||�_ ��������d�S�r`���)r����r����r8���rf���r����r|���r����r���r?���r@���r����)r,���r����r8���rf���r����r|���r����r���r?���r@���r����r����s��� r-���r.���zCliDetectionResult.__init__]��s\��������� �(��� �� � 0���%:��"� �� �"���,����� �"���(����r/���r1���c�����������������������|�j���������|�j��������|�j��������|�j��������|�j��������|�j��������|�j��������|�j��������|�j��������|�j ��������|�j ��������d�S�)N�r����r8���rf���r����r|���r����r���r?���r@���r����r����r����rI���s��� r-����__dict__zCliDetectionResult.__dict__w��sO��������I�� � $� 5�%)�%?�� ���"�1��Z��� �-� �-� �� �� r/���c������������������0�����t����������|�j��������dd�������������S�)NT����)�ensure_ascii�indent)r���r����rI���s��� r-����to_jsonzCliDetectionResult.to_json���s�������T�]��a�@�@�@�@r/���N)r����r����r����r6���r���r���r����r����r.���r����r ���r���r����r����ro���r/���r-���r����r����\��s���������������)��)���3�-�)���s�)� )� � $�C�y�)��� )����9�)���)���)���)���s�m�)���)��)��)��)�4�� �$�s�C�x�.�� �� �� ���X� �A���A��A��A��A��A��Ar/���r����)#rK����collectionsr����encodings.aliasesr����hashlibr����jsonr����rer����typingr���r ���r ���r���r���r ���r����constantr���r����mdr����utilsr���r���r���r���r����r6���r�����CoherenceMatchr���r����ro���r/���r-����<module>r�������s�����������������������%��%��%��%��%��%��������������������������������������D��D��D��D��D��D��D��D��D��D��D��D��D��D��D��D��D��D��=��=��=��=��=��=��=��=��������������C��C��C��C��C��C��C��C��C��C�D1��D1��D1��D1��D1��D1��D1��D1�N@��@��@��@��@��@��@��@�F��s�E�z�"����'���,A��,A��,A��,A��,A��,A��,A��,A��,A��,Ar/���