관리-도구
편집 파일: models.cpython-311.pyc
� �܋fo3 � � � d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dl m Z d dlmZmZ mZmZmZmZmZmZ dd lmZmZ dd lmZ ddlmZmZmZ G d� d � � Z G d� d� � Zeee f Z!ee! Z" G d� d� � Z#dS )� N)�Counter)�aliases)�sha256)�dumps)�sub)�Anyr �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�� � Zedee fd�� � 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 �P/opt/cloudlinux/venv/lib64/python3.11/site-packages/charset_normalizer/models.py�__init__zCharsetMatch.__init__ s[ � � '�� �.���'6���,5���%3���48���+-���,/��"�04���/3���&5����� �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__1 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__: s� � � �%��.�.� ���"%�d�j�5�;�&>�"?�"?��&)�$�.�5�?�*J�&K�&K�� �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_usageM s&