§
    bÒ³gj0  ã                  óð   — d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZmZmZmZ ddlmZmZ dd	lmZmZmZ  G d
„ d¦  «        Z G d„ d¦  «        Zeeef         Zee         Z G d„ d¦  «        ZdS )é    )Úannotations)Úaliases)Úsha256)Údumps)Úsub)ÚAnyÚIteratorÚListÚTupleé   )ÚRE_POSSIBLE_ENCODING_INDICATIONÚTOO_BIG_SEQUENCE)Ú	iana_nameÚis_multi_byte_encodingÚunicode_rangec                  óæ  — e Zd Z	 	 d/d0d„Zd1d„Zd1d„Zed2d„¦   «         Zd3d„Zd3d„Z	d4d„Z
ed3d„¦   «         Zed5d„¦   «         Zed6d„¦   «         Zed6d„¦   «         Zed5d„¦   «         Zed3d „¦   «         Zed2d!„¦   «         Zed2d"„¦   «         Zed2d#„¦   «         Zed2d$„¦   «         Zed7d%„¦   «         Zed8d'„¦   «         Zed6d(„¦   «         Zed5d)„¦   «         Zed5d*„¦   «         Zd9d:d-„Zed3d.„¦   «         ZdS );ÚCharsetMatchNÚpayloadÚbytesÚguessed_encodingÚstrÚmean_mess_ratioÚfloatÚhas_sig_or_bomÚboolÚ	languagesÚCoherenceMatchesÚdecoded_payloadú
str | NoneÚpreemptive_declarationc                ó®   — || _         || _        || _        || _        || _        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Ú_preemptive_declaration)Úselfr   r   r   r   r   r   r    s           úW/var/www/html/mpstechhub/venv/lib/python3.11/site-packages/charset_normalizer/models.pyÚ__init__zCharsetMatch.__init__   se   € ð  'ˆŒà.ˆŒØ'6ˆÔØ,5ˆŒØ%3ˆÔØ15ˆÔà+-ˆŒØ,/ˆÔ"à-1ˆÔØ,0ˆÔà#2ˆŒà3IˆÔ$Ð$Ð$ó    ÚotherÚobjectÚreturnc                óÊ   — t          |t          ¦  «        s/t          |t          ¦  «        rt          |¦  «        | j        k    S dS | j        |j        k    o| j        |j        k    S )NF)Ú
isinstancer   r   r   ÚencodingÚfingerprint©r/   r3   s     r0   Ú__eq__zCharsetMatch.__eq__*   s_   € Ý˜%¥Ñ.Ô.ð 	Ý˜%¥Ñ%Ô%ð 9Ý  Ñ'Ô'¨4¬=Ò8Ð8Ø�5ØŒ} ¤Ò.ÐX°4Ô3CÀuÔGXÒ3XÐXr2   c                ó”  — t          |t          ¦  «        st          ‚t          | j        |j        z
  ¦  «        }t          | j        |j        z
  ¦  «        }|dk     r|dk    r| j        |j        k    S |dk     rC|dk    r=t          | j        ¦  «        t          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”?)
r7   r   Ú
ValueErrorÚabsÚchaosÚ	coherenceÚlenr#   r   Úmulti_byte_usage)r/   r3   Úchaos_differenceÚcoherence_differences       r0   Ú__lt__zCharsetMatch.__lt__1   sÎ   € õ ˜%¥Ñ.Ô.ð 	ÝÐå"% d¤j°5´;Ñ&>Ñ"?Ô"?ÐÝ&)¨$¬.¸5¼?Ñ*JÑ&KÔ&KÐð ˜dÒ"Ð"Ð';¸dÒ'BÐ'BØ”> E¤OÒ3Ð3Ø Ò$Ð$Ð)=ÀÒ)EÐ)Eõ �4”=Ñ!Ô!Õ%5Ò5Ð5Ø”z E¤KÒ/Ð/ØÔ(¨5Ô+AÒAÐAàŒz˜EœKÒ'Ð'r2   c                ój   — dt          t          | ¦  «        ¦  «        t          | j        ¦  «        z  z
  S )Ng      ð?)rA   r   Úraw©r/   s    r0   rB   zCharsetMatch.multi_byte_usageG   s&   € à•c�#˜d™)œ)‘n”n¥s¨4¬8¡}¤}Ñ4Ñ5Ð5r2   c                ó^   — | j         € t          | j        | j        d¦  «        | _         | j         S )NÚstrict)r-   r   r#   r$   rH   s    r0   Ú__str__zCharsetMatch.__str__K   s)   € àŒ<ÐÝ˜tœ}¨d¬n¸hÑGÔGˆDŒLØŒ|Ðr2   c                ó(   — d| j         › d| j        › d�S )Nz<CharsetMatch 'z' bytes(z)>)r8   r9   rH   s    r0   Ú__repr__zCharsetMatch.__repr__Q   s    € ØL ¤ÐLÐL¸Ô8HÐLÐLÐLÐLr2   ÚNonec                óÌ   — t          |t          ¦  «        r|| k    r't          d                     |j        ¦  «        ¦  «        ‚d |_        | j                             |¦  «         d S )Nz;Unable to add instance <{}> as a submatch of a CharsetMatch)r7   r   r=   ÚformatÚ	__class__r-   r)   Úappendr:   s     r0   Úadd_submatchzCharsetMatch.add_submatchT   sk   € Ý˜%¥Ñ.Ô.ð 	°%¸4²-°-ÝØM×TÒTØ”Oñô ñô ð ð ˆŒØŒ×Ò˜EÑ"Ô"Ð"Ð"Ð"r2   c                ó   — | j         S ©N)r$   rH   s    r0   r8   zCharsetMatch.encoding_   s
   € àŒ~Ðr2   ú	list[str]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   rR   )r/   Úalso_known_asÚuÚps       r0   Úencoding_aliaseszCharsetMatch.encoding_aliasesc   sn   € ð
 $&ˆÝ”M‘O”Oð 	(ð 	(‰DˆAˆqØŒ} Ò!Ð!Ø×$Ò$ QÑ'Ô'Ð'Ð'Ø” !Ò#Ð#Ø×$Ò$ QÑ'Ô'Ð'øØÐr2   c                ó   — | j         S rU   ©r'   rH   s    r0   ÚbomzCharsetMatch.bomp   ó   € àÔ#Ð#r2   c                ó   — | j         S rU   r^   rH   s    r0   Úbyte_order_markzCharsetMatch.byte_order_markt   r`   r2   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     r0   ú
<listcomp>z*CharsetMatch.languages.<locals>.<listcomp>~   s   € Ð.Ð.Ð.˜��!”Ð.Ð.Ð.r2   ©r&   rH   s    r0   r   zCharsetMatch.languagesx   s   € ð /Ð.˜dœoÐ.Ñ.Ô.Ð.r2   c                ó  — | j         shd| j        v rdS ddlm}m} t          | j        ¦  «        r || j        ¦  «        n || j        ¦  «        }t          |¦  «        dk    sd|v rdS |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_languageszLatin BasedÚUnknown)r&   Úcould_be_from_charsetÚcharset_normalizer.cdrm   rn   r   r8   rA   )r/   rm   rn   r   s       r0   ÚlanguagezCharsetMatch.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Ô! !Ô$Ð$r2   c                ó   — | j         S rU   )r%   rH   s    r0   r?   zCharsetMatch.chaosœ   s   € àÔ$Ð$r2   c                ó:   — | j         sdS | j         d         d         S )Nr"   r   r   ri   rH   s    r0   r@   zCharsetMatch.coherence    s#   € àŒð 	Ø�3ØŒ˜qÔ! !Ô$Ð$r2   c                ó4   — t          | j        dz  d¬¦  «        S ©Néd   é   )Úndigits)Úroundr?   rH   s    r0   Úpercent_chaoszCharsetMatch.percent_chaos¦   s   € å�T”Z #Ñ%¨qÐ1Ñ1Ô1Ð1r2   c                ó4   — t          | j        dz  d¬¦  «        S rv   )rz   r@   rH   s    r0   Úpercent_coherencezCharsetMatch.percent_coherenceª   s   € å�T”^ cÑ)°1Ð5Ñ5Ô5Ð5r2   c                ó   — | j         S )z+
        Original untouched bytes.
        )r#   rH   s    r0   rG   zCharsetMatch.raw®   s   € ð
 Œ}Ðr2   úlist[CharsetMatch]c                ó   — | j         S rU   )r)   rH   s    r0   ÚsubmatchzCharsetMatch.submatchµ   s
   € àŒ|Ðr2   c                ó2   — t          | j        ¦  «        dk    S ©Nr   )rA   r)   rH   s    r0   Úhas_submatchzCharsetMatch.has_submatch¹   s   € å�4”<Ñ Ô  1Ò$Ð$r2   c                ó´   — | j         �| j         S d„ t          | ¦  «        D ¦   «         }t          t          d„ |D ¦   «         ¦  «        ¦  «        | _         | j         S )Nc                ó,   — g | ]}t          |¦  «        ‘ŒS re   )r   )rf   Úchars     r0   rh   z*CharsetMatch.alphabets.<locals>.<listcomp>Â   s    € Ð,WÐ,WÐ,WÀT­]¸4Ñ-@Ô-@Ð,WÐ,WÐ,Wr2   c                ó   — h | ]}|¯|’ŒS re   re   )rf   Úrs     r0   ú	<setcomp>z)CharsetMatch.alphabets.<locals>.<setcomp>Ä   s   € Ð+LÐ+LÐ+L°!È!Ð+L¨AÐ+LÐ+LÐ+Lr2   )r(   r   ÚsortedÚlist)r/   Údetected_rangess     r0   Ú	alphabetszCharsetMatch.alphabets½   s^   € àÔÐ+ØÔ'Ð'à,WÐ,WÍSÐQUÉYÌYÐ,WÑ,WÔ,Wˆå%¥dÐ+LÐ+L°Ð+LÑ+LÔ+LÑ&MÔ&MÑNÔNˆÔØÔ#Ð#r2   c                ó6   — | j         gd„ | 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 re   )r8   )rf   Úms     r0   rh   z6CharsetMatch.could_be_from_charset.<locals>.<listcomp>Î   s   € Ð"DÐ"DÐ"D°! 1¤:Ð"DÐ"DÐ"Dr2   )r$   r)   rH   s    r0   rp   z"CharsetMatch.could_be_from_charsetÇ   s%   € ð ”ÐÐ"DÐ"D°t´|Ð"DÑ"DÔ"DÑDÐDr2   Úutf_8r8   c                ó<  ‡ — ‰ j         �‰ j         |k    rƒ|‰ _         t          ‰ ¦  «        }‰ j        �K‰ j                             ¦   «         dvr0t	          t
          ˆ fd„|dd…         d¬¦  «        }||dd…         z   }|                     |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)zutf-8Úutf8r’   c                ó&  •— | j         |                      ¦   «         d         |                      ¦   «         d         …                              |                      ¦   «         d         t	          ‰j        ¦  «                             dd¦  «        ¦  «        S )Nr   r   Ú_ú-)ÚstringÚspanÚreplaceÚgroupsr   r,   )r‘   r/   s    €r0   ú<lambda>z%CharsetMatch.output.<locals>.<lambda>ß   sh   ø€ ˜aœh q§v¢v¡x¤x°¤{°Q·V²V±X´X¸a´[Ð'@ÔA×IÒIØŸš™
œ
 1œÝ! $Ô"7Ñ8Ô8×@Ò@ÀÀcÑJÔJñô € r2   i    r   )Úcountrš   )r,   r   r.   Úlowerr   r   Úencoder+   )r/   r8   Údecoded_stringÚpatched_headers   `   r0   ÚoutputzCharsetMatch.outputÐ   sÊ   ø€ ð
 Ô Ð(¨DÔ,AÀXÒ,MÐ,MØ$,ˆDÔ!Ý  ™YœYˆNàÔ,Ð8ØÔ0×6Ò6Ñ8Ô8Ø1ð2ð 2õ "%Ý3ðð ð ð ð # 5 D 5Ô)Øð"ñ "ô "�ð "0°.ÀÀÀÔ2GÑ!G�à#1×#8Ò#8¸À9Ñ#MÔ#MˆDÔ àÔ#Ð#r2   c                óh   — t          |                      ¦   «         ¦  «                             ¦   «         S )zw
        Retrieve the unique SHA256 computed using the transformed (re-encoded) payload. Not the original one.
        )r   r¢   Ú	hexdigestrH   s    r0   r9   zCharsetMatch.fingerprintí   s&   € õ
 �d—k’k‘m”mÑ$Ô$×.Ò.Ñ0Ô0Ð0r2   )NN)r   r   r   r   r   r   r   r   r   r   r   r   r    r   )r3   r4   r5   r   )r5   r   ©r5   r   )r3   r   r5   rN   )r5   rV   ©r5   r   )r5   r   )r5   r   )r’   )r8   r   r5   r   )Ú__name__Ú
__module__Ú__qualname__r1   r;   rE   ÚpropertyrB   rK   rM   rS   r8   r\   r_   rb   r   rr   r?   r@   r{   r}   rG   r�   r„   rŽ   rp   r¢   r9   re   r2   r0   r   r      sã  € € € € € ð '+Ø-1ðJð Jð Jð Jð Jð8Yð Yð Yð Yð(ð (ð (ð (ð, ð6ð 6ð 6ñ „Xð6ðð ð ð ðMð Mð Mð Mð	#ð 	#ð 	#ð 	#ð ðð ð ñ „Xðð ð
ð 
ð 
ñ „Xð
ð ð$ð $ð $ñ „Xð$ð ð$ð $ð $ñ „Xð$ð ð/ð /ð /ñ „Xð/ð ð%ð %ð %ñ „Xð%ð6 ð%ð %ð %ñ „Xð%ð ð%ð %ð %ñ „Xð%ð
 ð2ð 2ð 2ñ „Xð2ð ð6ð 6ð 6ñ „Xð6ð ðð ð ñ „Xðð ðð ð ñ „Xðð ð%ð %ð %ñ „Xð%ð ð$ð $ð $ñ „Xð$ð ðEð Eð Eñ „XðEð$ð $ð $ð $ð $ð: ð1ð 1ð 1ñ „Xð1ð 1ð 1r2   r   c                  óT   — e Zd ZdZddd„Zdd„Zdd„Zdd„Zdd„Zdd„Z	dd„Z
dd„ZdS )Ú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Úresultsúlist[CharsetMatch] | Nonec                ó6   — |rt          |¦  «        ng | _        d S rU   )r‹   Ú_results)r/   r­   s     r0   r1   zCharsetMatches.__init__û   s   € Ø?FÐ,N­F°7©O¬O¨OÈBˆŒˆˆr2   r5   úIterator[CharsetMatch]c              #  ó$   K  — | j         E d {V —† d S rU   ©r°   rH   s    r0   Ú__iter__zCharsetMatches.__iter__þ   s&   è è € Ø”=Ð Ð Ð Ð Ð Ð Ð Ð Ð r2   Úitemú	int | strr   c                óÌ   — 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)r7   Úintr°   r   r   rp   ÚKeyError)r/   rµ   Úresults      r0   Ú__getitem__zCharsetMatches.__getitem__  sv   € õ
 �d�CÑ Ô ð 	'Ø”= Ô&Ð&Ý�d�CÑ Ô ð 	"Ý˜T 5Ñ)Ô)ˆDØœ-ð "ð "�Ø˜6Ô7Ð7Ð7Ø!�M�M�Mð 8åˆr2   r¸   c                ó*   — t          | j        ¦  «        S rU   ©rA   r°   rH   s    r0   Ú__len__zCharsetMatches.__len__  s   € Ý�4”=Ñ!Ô!Ð!r2   r   c                ó2   — t          | j        ¦  «        dk    S rƒ   r½   rH   s    r0   Ú__bool__zCharsetMatches.__bool__  s   € Ý�4”=Ñ!Ô! AÒ%Ð%r2   rN   c                ó¼  — t          |t          ¦  «        s4t          d                     t	          |j        ¦  «        ¦  «        ¦  «        ‚t          |j        ¦  «        t          k     rB| j	        D ]:}|j
        |j
        k    r(|j        |j        k    r|                     |¦  «          dS Œ;| j	                             |¦  «         t          | j	        ¦  «        | _	        dS )z~
        Insert a single match. Will be inserted accordingly to preserve sort.
        Can be inserted as a submatch.
        z-Cannot append instance '{}' to CharsetMatchesN)r7   r   r=   rP   r   rQ   rA   rG   r   r°   r9   r?   rS   rR   r‹   )r/   rµ   Úmatchs      r0   rR   zCharsetMatches.append  sÕ   € õ
 ˜$¥Ñ-Ô-ð 	ÝØ?×FÒFÝ˜œÑ'Ô'ñô ñô ð õ ˆtŒx‰=Œ=Õ+Ò+Ð+Øœð ð �ØÔ$¨Ô(8Ò8Ð8¸U¼[ÈDÌJÒ=VÐ=VØ×&Ò& tÑ,Ô,Ð,Ø�F�FøØŒ×Ò˜TÑ"Ô"Ð"Ý˜tœ}Ñ-Ô-ˆŒˆˆr2   úCharsetMatch | Nonec                ó.   — | j         sdS | j         d         S )zQ
        Simply return the first match. Strict equivalent to matches[0].
        Nr   r³   rH   s    r0   ÚbestzCharsetMatches.best)  s    € ð Œ}ð 	Ø�4ØŒ}˜QÔÐr2   c                ó*   — |                       ¦   «         S )zP
        Redundant method, call the method best(). Kept for BC reasons.
        )rÅ   rH   s    r0   ÚfirstzCharsetMatches.first1  s   € ð �yŠy‰{Œ{Ðr2   rU   )r­   r®   )r5   r±   )rµ   r¶   r5   r   )r5   r¸   r¦   )rµ   r   r5   rN   )r5   rÃ   )r§   r¨   r©   Ú__doc__r1   r´   r»   r¾   rÀ   rR   rÅ   rÇ   re   r2   r0   r¬   r¬   õ   sÈ   € € € € € ðð ð
Oð Oð Oð Oð Oð!ð !ð !ð !ðð ð ð ð"ð "ð "ð "ð&ð &ð &ð &ð.ð .ð .ð .ð( ð  ð  ð  ðð ð ð ð ð r2   r¬   c                  ó6   — e Zd Zdd„Zedd„¦   «         Zdd„ZdS )ÚCliDetectionResultÚpathr   r8   r   r\   rV   Úalternative_encodingsrr   rŽ   r   r   r?   r   r@   Úunicode_pathÚis_preferredc                ó    — || _         |
| _        || _        || _        || _        || _        || _        || _        || _        |	| _	        || _
        d S rU   )rË   rÍ   r8   r\   rÌ   rr   rŽ   r   r?   r@   rÎ   )r/   rË   r8   r\   rÌ   rr   rŽ   r   r?   r@   rÍ   rÎ   s               r0   r1   zCliDetectionResult.__init__=  s\   € ð ˆŒ	Ø(4ˆÔØ$,ˆŒØ+;ˆÔØ0EˆÔ"Ø%ˆŒØ$-ˆŒØ$2ˆÔØ!ˆŒ
Ø )ˆŒØ".ˆÔÐÐr2   r5   údict[str, Any]c                óŒ   — | j         | j        | j        | j        | j        | j        | j        | j        | j        | j	        | j
        dœS )N©rË   r8   r\   rÌ   rr   rŽ   r   r?   r@   rÍ   rÎ   rÒ   rH   s    r0   Ú__dict__zCliDetectionResult.__dict__W  sO   € ð ”IØœØ $Ô 5Ø%)Ô%?ØœØœØ"Ô1Ø”ZØœØ Ô-Ø Ô-ð
ð 
ð 	
r2   c                ó0   — t          | j        dd¬¦  «        S )NTé   )Úensure_asciiÚindent)r   rÓ   rH   s    r0   Úto_jsonzCliDetectionResult.to_jsong  s   € Ý�T”]°¸aÐ@Ñ@Ô@Ð@r2   N)rË   r   r8   r   r\   rV   rÌ   rV   rr   r   rŽ   rV   r   r   r?   r   r@   r   rÍ   r   rÎ   r   )r5   rÐ   r¥   )r§   r¨   r©   r1   rª   rÓ   rØ   re   r2   r0   rÊ   rÊ   <  sb   € € € € € ð/ð /ð /ð /ð4 ð
ð 
ð 
ñ „Xð
ðAð Að Að Að Að Ar2   rÊ   N)Ú
__future__r   Úencodings.aliasesr   Úhashlibr   Újsonr   Úrer   Útypingr   r	   r
   r   Úconstantr   r   Úutilsr   r   r   r   r¬   r   r   ÚCoherenceMatchr   rÊ   re   r2   r0   ú<module>râ      sr  ðØ "Ð "Ð "Ð "Ð "Ð "à %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -à GÐ GÐ GÐ GÐ GÐ GÐ GÐ GØ CÐ CÐ CÐ CÐ CÐ CÐ CÐ CÐ CÐ Cðe1ð e1ð e1ð e1ð e1ñ e1ô e1ð e1ðP@ð @ð @ð @ð @ñ @ô @ð @ðF �s˜E�zÔ"€Ø˜Ô'Ð ð,Að ,Að ,Að ,Að ,Añ ,Aô ,Að ,Að ,Að ,Ar2   