§
    Qp°dä,  ã                   óà   — 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
mZmZmZ ddl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 )é    )Úaliases)Úsha256)Údumps)ÚAnyÚDictÚIteratorÚListÚOptionalÚTupleÚUnioné   )ÚTOO_BIG_SEQUENCE)Ú	iana_nameÚis_multi_byte_encodingÚunicode_rangec                   ó¨  — e Zd Z	 d%dededededddee         fd	„Zd
e	defd„Z
d
e	defd„Zedefd„¦   «         Zdefd„Zdefd„Zd&d„Zedefd„¦   «         Zedee         fd„¦   «         Zedefd„¦   «         Zedefd„¦   «         Zedee         fd„¦   «         Zedefd„¦   «         Zedefd„¦   «         Zedefd„¦   «         Zedefd„¦   «         Zedefd„¦   «         Zedefd„¦   «         Zeded          fd„¦   «         Zedefd„¦   «         Zedee         fd„¦   «         Zedee         fd „¦   «         Z d'd"edefd#„Z!edefd$„¦   «         Z"dS )(Ú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          ú^/var/www/pp.vulcan-creative.com/venv/lib/python3.11/site-packages/charset_normalizer/models.pyÚ__init__zCharsetMatch.__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(   r,   s     r)   Ú__eq__zCharsetMatch.__eq__$   ss   € Ý˜%¥Ñ.Ô.ð 	ÝØ8×?Ò?Ý˜œÑ(Ô(­#¨d¬nÑ*=Ô*=ñô ñô ð ð
 Œ} ¤Ò.ÐX°4Ô3CÀuÔGXÒ3XÐXr+   c                 óN  — t          |t          ¦  «        st          ‚t          | j        |j        z
  ¦  «        }t          | j        |j        z
  ¦  «        }|dk     r<|dk    r6|dk    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   )r/   r   Ú
ValueErrorÚabsÚchaosÚ	coherenceÚmulti_byte_usage)r(   r,   Úchaos_differenceÚcoherence_differences       r)   Ú__lt__zCharsetMatch.__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   — dt          t          | ¦  «        ¦  «        t          | j        ¦  «        z  z
  S )Ng      ð?)Úlenr2   Úraw©r(   s    r)   r=   zCharsetMatch.multi_byte_usage@   s&   € à•S�˜T™œ‘^”^¥c¨$¬(¡m¤mÑ3Ñ3Ð3r+   c                 ó^   — | j         € t          | j        | j        d¦  «        | _         | j         S )NÚstrict)r'   r2   r   r   rD   s    r)   Ú__str__zCharsetMatch.__str__D   s)   € àŒ<ÐÝ˜tœ}¨d¬n¸hÑGÔGˆDŒLØŒ|Ðr+   c                 óB   — d                      | j        | j        ¦  «        S )Nz<CharsetMatch '{}' bytes({})>)r1   r4   r5   rD   s    r)   Ú__repr__zCharsetMatch.__repr__J   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)r/   r   r9   r1   r3   r'   r#   Úappendr6   s     r)   Úadd_submatchzCharsetMatch.add_submatchM   sk   € Ý˜%¥Ñ.Ô.ð 	°%¸4²-°-ÝØM×TÒTØ”Oñô ñô ð ð ˆŒØŒ×Ò˜EÑ"Ô"Ð"Ð"Ð"r+   c                 ó   — | j         S ©N)r   rD   s    r)   r4   zCharsetMatch.encodingX   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   Úitemsr4   rK   )r(   Úalso_known_asÚuÚps       r)   Úencoding_aliaseszCharsetMatch.encoding_aliases\   sn   € ð
 $&ˆÝ”M‘O”Oð 	(ð 	(‰DˆAˆqØŒ} Ò!Ð!Ø×$Ò$ QÑ'Ô'Ð'Ð'Ø” !Ò#Ð#Ø×$Ò$ QÑ'Ô'Ð'øØÐr+   c                 ó   — | j         S rN   ©r!   rD   s    r)   ÚbomzCharsetMatch.bomi   ó   € àÔ#Ð#r+   c                 ó   — | j         S rN   rV   rD   s    r)   Úbyte_order_markzCharsetMatch.byte_order_markm   rX   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>w   s   € Ð.Ð.Ð.˜��!”Ð.Ð.Ð.r+   ©r    rD   s    r)   r   zCharsetMatch.languagesq   s   € ð /Ð.˜dœoÐ.Ñ.Ô.Ð.r+   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.cdre   rf   r   r4   rB   )r(   re   rf   r   s       r)   ÚlanguagezCharsetMatch.languagey   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 rN   )r   rD   s    r)   r;   zCharsetMatch.chaos•   s   € àÔ$Ð$r+   c                 ó:   — | j         sdS | j         d         d         S )Nr   r   r   ra   rD   s    r)   r<   zCharsetMatch.coherence™   s#   € àŒð 	Ø�3ØŒ˜qÔ! !Ô$Ð$r+   c                 ó4   — t          | j        dz  d¬¦  «        S ©Néd   é   )Úndigits)Úroundr;   rD   s    r)   Úpercent_chaoszCharsetMatch.percent_chaosŸ   s   € å�T”Z #Ñ%¨qÐ1Ñ1Ô1Ð1r+   c                 ó4   — t          | j        dz  d¬¦  «        S rn   )rr   r<   rD   s    r)   Úpercent_coherencezCharsetMatch.percent_coherence£   s   € å�T”^ cÑ)°1Ð5Ñ5Ô5Ð5r+   c                 ó   — | j         S )z+
        Original untouched bytes.
        )r   rD   s    r)   rC   zCharsetMatch.raw§   s   € ð
 Œ}Ðr+   c                 ó   — | j         S rN   )r#   rD   s    r)   ÚsubmatchzCharsetMatch.submatch®   s
   € àŒ|Ðr+   c                 ó2   — t          | j        ¦  «        dk    S ©Nr   )rB   r#   rD   s    r)   Úhas_submatchzCharsetMatch.has_submatch²   s   € å�4”<Ñ Ô  1Ò$Ð$r+   c                 ó´   — | j         �| j         S d„ t          | ¦  «        D ¦   «         }t          t          d„ |D ¦   «         ¦  «        ¦  «        | _         | j         S )Nc                 ó,   — g | ]}t          |¦  «        ‘ŒS r]   )r   )r^   Úchars     r)   r`   z*CharsetMatch.alphabets.<locals>.<listcomp>»   s-   € ð 0
ð 0
ð 0
Ø$(�M˜$ÑÔð0
ð 0
ð 0
r+   c                 ó   — h | ]}|¯|’ŒS r]   r]   )r^   Úrs     r)   ú	<setcomp>z)CharsetMatch.alphabets.<locals>.<setcomp>¿   s   € Ð+LÐ+LÐ+L°!È!Ð+L¨AÐ+LÐ+LÐ+Lr+   )r"   r2   ÚsortedÚlist)r(   Údetected_rangess     r)   Ú	alphabetszCharsetMatch.alphabets¶   sj   € àÔÐ+ØÔ'Ð'ð0
ð 0
Ý,/°©I¬Ið0
ñ 0
ô 0
ˆõ  &¥dÐ+LÐ+L°Ð+LÑ+LÔ+LÑ&MÔ&MÑNÔNˆÔØÔ#Ð#r+   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 r]   )r4   )r^   Úms     r)   r`   z6CharsetMatch.could_be_from_charset.<locals>.<listcomp>É   s   € Ð"DÐ"DÐ"D°! 1¤:Ð"DÐ"DÐ"Dr+   )r   r#   rD   s    r)   rh   z"CharsetMatch.could_be_from_charsetÂ   s%   € ð ”ÐÐ"DÐ"D°t´|Ð"DÑ"DÔ"DÑDÐDr+   Úutf_8r4   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&   r2   Úencoder%   )r(   r4   s     r)   ÚoutputzCharsetMatch.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�   Ú	hexdigestrD   s    r)   r5   zCharsetMatch.fingerprintÖ   s&   € õ
 �d—k’k‘m”mÑ$Ô$×.Ò.Ñ0Ô0Ð0r+   rN   )r,   r   r-   N)r‰   )#Ú__name__Ú
__module__Ú__qualname__Úbytesr2   ÚfloatÚboolr
   r*   Úobjectr7   r@   Úpropertyr=   rG   rI   rL   r4   r	   rT   rW   rZ   r   rj   r;   r<   rs   ru   rC   rx   r{   r…   rh   r�   r5   r]   r+   r)   r   r   
   sá  € € € € € ð *.ð6ð 6àð6ð ð6ð ð	6ð
 ð6ð &ð6ð " #œð6ð 6ð 6ð 6ð2Y˜Fð Y tð Yð Yð Yð Yð(˜Fð ( tð (ð (ð (ð (ð& ð4 %ð 4ð 4ð 4ñ „Xð4ð˜ð ð ð ð ð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 Zd ZdZddeee                  fd„Zdee         fd„Z	de
eef         defd„Zdefd	„Zdefd
„Zdeddfd„Zded         fd„Zded         f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Úresultsc                 ó6   — |rt          |¦  «        ng | _        d S rN   )r‚   Ú_results)r(   rš   s     r)   r*   zCharsetMatches.__init__ä   s   € Ø?FÐ,N­F°7©O¬O¨OÈBˆŒˆˆr+   r-   c              #   ó$   K  — | j         E d {V —† d S rN   ©rœ   rD   s    r)   Ú__iter__zCharsetMatches.__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)r/   Úintrœ   r2   r   rh   ÚKeyError)r(   r    Úresults      r)   Ú__getitem__zCharsetMatches.__getitem__ê   sv   € õ
 �d�CÑ Ô ð 	'Ø”= Ô&Ð&Ý�d�CÑ Ô ð 	"Ý˜T 5Ñ)Ô)ˆDØœ-ð "ð "�Ø˜6Ô7Ð7Ð7Ø!�M�M�Mð 8åˆr+   c                 ó*   — t          | j        ¦  «        S rN   ©rB   rœ   rD   s    r)   Ú__len__zCharsetMatches.__len__ø   s   € Ý�4”=Ñ!Ô!Ð!r+   c                 ó2   — t          | j        ¦  «        dk    S rz   r§   rD   s    r)   Ú__bool__zCharsetMatches.__bool__û   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|                     |¦  «          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)r/   r   r9   r1   r2   r3   rB   rC   r   rœ   r5   r;   rL   rK   r‚   )r(   r    Úmatchs      r)   rK   zCharsetMatches.appendþ   sÕ   € õ
 ˜$¥Ñ-Ô-ð 	ÝØ?×FÒFÝ˜œÑ'Ô'ñô ñô ð õ ˆtŒx‰=Œ=Õ,Ò,Ð,Øœð ð �ØÔ$¨Ô(8Ò8Ð8¸U¼[ÈDÌJÒ=VÐ=VØ×&Ò& tÑ,Ô,Ð,Ø�F�FøØŒ×Ò˜TÑ"Ô"Ð"Ý˜tœ}Ñ-Ô-ˆŒˆˆr+   r   c                 ó.   — | j         sdS | j         d         S )zQ
        Simply return the first match. Strict equivalent to matches[0].
        Nr   rž   rD   s    r)   ÚbestzCharsetMatches.best  s    € ð Œ}ð 	Ø�4ØŒ}˜QÔÐr+   c                 ó*   — |                       ¦   «         S )zP
        Redundant method, call the method best(). Kept for BC reasons.
        )r®   rD   s    r)   ÚfirstzCharsetMatches.first  s   € ð �yŠy‰{Œ{Ðr+   rN   )r�   r‘   r’   Ú__doc__r
   r	   r   r*   r   rŸ   r   r¢   r2   r¥   r¨   r•   rª   rK   r®   r°   r]   r+   r)   r™   r™   Þ   s0  € € € € € ðð ð
Oð O ¨¨lÔ);Ô <ð Oð Oð Oð Oð!˜( <Ô0ð !ð !ð !ð !ð  c¨3 h¤ð °Lð ð ð ð ð"˜ð "ð "ð "ð "ð&˜$ð &ð &ð &ð &ð.˜<ð .¨Dð .ð .ð .ð .ð( �h˜~Ô.ð  ð  ð  ð  ð�x Ô/ð ð ð ð ð ð r+   r™   c                   ó¶   — e Zd Zdedee         dee         dee         dedee         deded	ed
ee         defd„Ze	de
eef         fd„¦   «         Zdefd„ZdS )ÚCliDetectionResultÚpathr4   rT   Úalternative_encodingsrj   r…   r   r;   r<   Úunicode_pathÚis_preferredc                 ó    — || _         |
| _        || _        || _        || _        || _        || _        || _        || _        |	| _	        || _
        d S rN   )r´   r¶   r4   rT   rµ   rj   r…   r   r;   r<   r·   )r(   r´   r4   rT   rµ   rj   r…   r   r;   r<   r¶   r·   s               r)   r*   zCliDetectionResult.__init__&  s\   € ð ˆŒ	Ø+7ˆÔØ'/ˆŒØ+;ˆÔØ0EˆÔ"Ø%ˆŒØ$-ˆŒØ$2ˆÔØ!ˆŒ
Ø )ˆŒØ".ˆÔÐÐr+   r-   c                 óŒ   — | j         | j        | j        | j        | j        | j        | j        | j        | j        | j	        | j
        dœS )N©r´   r4   rT   rµ   rj   r…   r   r;   r<   r¶   r·   rº   rD   s    r)   Ú__dict__zCliDetectionResult.__dict__@  sO   € ð ”IØœØ $Ô 5Ø%)Ô%?ØœØœØ"Ô1Ø”ZØœØ Ô-Ø Ô-ð
ð 
ð 	
r+   c                 ó0   — t          | j        dd¬¦  «        S )NTé   )Úensure_asciiÚindent)r   r»   rD   s    r)   Úto_jsonzCliDetectionResult.to_jsonP  s   € Ý�T”]°¸aÐ@Ñ@Ô@Ð@r+   N)r�   r‘   r’   r2   r
   r	   r•   r”   r*   r—   r   r   r»   rÀ   r]   r+   r)   r³   r³   %  sù   € € € € € ð/àð/ð ˜3”-ð/ð ˜sœ)ð	/ð
  $ Cœyð/ð ð/ð ˜”9ð/ð ð/ð ð/ð ð/ð ˜s”mð/ð ð/ð /ð /ð /ð4 ð
˜$˜s C˜xœ.ð 
ð 
ð 
ñ „Xð
ðA˜ð Að Að Að Að Að Ar+   r³   N)Úencodings.aliasesr   Úhashlibr   Újsonr   Útypingr   r   r   r	   r
   r   r   Úconstantr   Úutilsr   r   r   r   r™   r2   r”   ÚCoherenceMatchr   r³   r]   r+   r)   ú<module>rÈ      sZ  ðØ %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø 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ðQ1ð Q1ð Q1ð Q1ð Q1ñ Q1ô Q1ð Q1ðh@ð @ð @ð @ð @ñ @ô @ð @ðF �s˜E�zÔ"€Ø˜Ô'Ð ð,Að ,Að ,Að ,Að ,Añ ,Aô ,Að ,Að ,Að ,Ar+   