Ë
    qûà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y)é    )Ú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	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zdd„Zdd„Zedd„«       Zdd„Zdd„Z	dd„Z
edd	„«       Zed d
„«       Zed!d„«       Zed!d„«       Zed d„«       Zedd„«       Zedd„«       Zedd„«       Zedd„«       Zedd„«       Zed"d„«       Zed#d„«       Zed!d„«       Zed d„«       Zed d„«       Zd$d%d„Zedd„«       Zy)&ÚCharsetMatchNc                ó¬   — || _         || _        || _        || _        || _        d | _        g | _        d| _        d | _        d | _	        || _
        || _        y )Nç        )Ú_payloadÚ	_encodingÚ_mean_mess_ratioÚ
_languagesÚ_has_sig_or_bomÚ_unicode_rangesÚ_leavesÚ_mean_coherence_ratioÚ_output_payloadÚ_output_encodingÚ_stringÚ_preemptive_declaration)ÚselfÚpayloadÚguessed_encodingÚmean_mess_ratioÚhas_sig_or_bomÚ	languagesÚdecoded_payloadÚpreemptive_declarations           úW/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/charset_normalizer/models.pyÚ__init__zCharsetMatch.__init__   s_   € ð  'ˆŒà.ˆŒØ'6ˆÔØ,5ˆŒØ%3ˆÔØ15ˆÔà+-ˆŒØ,/ˆÔ"à-1ˆÔØ,0ˆÔà#2ˆŒà3IˆÕ$ó    c                óÜ   — t        |t        «      s)t        |t        «      rt        |«      | j                  k(  S y| j                  |j                  k(  xr | j
                  |j
                  k(  S )NF)Ú
isinstancer   Ústrr   ÚencodingÚfingerprint©r"   Úothers     r*   Ú__eq__zCharsetMatch.__eq__*   sV   € Ü˜%¤Ô.Ü˜%¤Ô%Ü  Ó'¨4¯=©=Ñ8Ð8ØØ�}‰} §¡Ñ.ÒX°4×3CÑ3CÀu×GXÑGXÑ3XÐXr,   c                óÞ  — t        |t        «      st        ‚t        | j                  |j                  z
  «      }t        | j
                  |j
                  z
  «      }|dk  r|dkD  r| j
                  |j
                  kD  S |dk  rS|dk  rNt        | j                  «      t        k\  r| j                  |j                  k  S | j                  |j                  kD  S | j                  |j                  k  S )zQ
        Implemented to make sorted available upon CharsetMatches items.
        g{®Gáz„?g{®Gáz”?)
r.   r   Ú
ValueErrorÚabsÚchaosÚ	coherenceÚlenr   r   Úmulti_byte_usage)r"   r3   Úchaos_differenceÚcoherence_differences       r*   Ú__lt__zCharsetMatch.__lt__1   sÊ   € ô ˜%¤Ô.ÜÐä"% d§j¡j°5·;±;Ñ&>Ó"?ÐÜ&)¨$¯.©.¸5¿?¹?Ñ*JÓ&KÐð ˜dÒ"Ð';¸dÒ'BØ—>‘> E§O¡OÑ3Ð3Ø Ò$Ð)=ÀÒ)Eô �4—=‘=Ó!Ô%5Ò5Ø—z‘z E§K¡KÑ/Ð/Ø×(Ñ(¨5×+AÑ+AÑAÐAà�z‰z˜EŸK™KÑ'Ð'r,   c                ó\   — dt        t        | «      «      t        | j                  «      z  z
  S )Ng      ð?)r:   r/   Úraw©r"   s    r*   r;   zCharsetMatch.multi_byte_usageG   s"   € à”cœ#˜d›)“n¤s¨4¯8©8£}Ñ4Ñ5Ð5r,   c                ó~   — | j                   €&t        | j                  | j                  d«      | _         | j                   S )NÚstrict)r    r/   r   r   rA   s    r*   Ú__str__zCharsetMatch.__str__K   s.   € à�<‰<ÐÜ˜tŸ}™}¨d¯n©n¸hÓGˆDŒLØ�|‰|Ðr,   c                ó<   — d| j                   › d| j                  › d�S )Nz<CharsetMatch 'z' bytes(z)>)r0   r1   rA   s    r*   Ú__repr__zCharsetMatch.__repr__Q   s"   € Ø  §¡ ¨x¸×8HÑ8HÐ7IÈÐLÐLr,   c                óº   — t        |t        «      r|| k(  r$t        dj                  |j                  «      «      ‚d |_        | j                  j                  |«       y )Nz;Unable to add instance <{}> as a submatch of a CharsetMatch)r.   r   r6   ÚformatÚ	__class__r    r   Úappendr2   s     r*   Úadd_submatchzCharsetMatch.add_submatchT   sO   € Ü˜%¤Ô.°%¸4²-ÜØM×TÑTØ—O‘Oóóð ð ˆŒØ�‰×Ñ˜EÕ"r,   c                ó   — | j                   S ©N)r   rA   s    r*   r0   zCharsetMatch.encoding_   s   € à�~‰~Ðr,   c                óÆ   — g }t        j                  «       D ]G  \  }}| j                  |k(  r|j                  |«       Œ'| j                  |k(  sŒ7|j                  |«       ŒI |S )z‚
        Encoding name are known by many name, using this could help when searching for IBM855 when it's listed as CP855.
        )r   Úitemsr0   rJ   )r"   Úalso_known_asÚuÚps       r*   Úencoding_aliaseszCharsetMatch.encoding_aliasesc   s^   € ð
 $&ˆÜ—M‘M“Oò 	(‰DˆAˆqØ�}‰} Ò!Ø×$Ñ$ QÕ'Ø—‘ !Ó#Ø×$Ñ$ QÕ'ð		(ð
 Ðr,   c                ó   — | j                   S rM   ©r   rA   s    r*   ÚbomzCharsetMatch.bomp   ó   € à×#Ñ#Ð#r,   c                ó   — | j                   S rM   rU   rA   s    r*   Úbyte_order_markzCharsetMatch.byte_order_markt   rW   r,   c                óF   — | j                   D �cg c]  }|d   ‘Œ	 c}S c c}w )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'.
        r   ©r   )r"   Úes     r*   r'   zCharsetMatch.languagesx   s    € ð #Ÿo™oÖ.˜��!“Ò.Ð.ùÒ.s   �c                ó  — | j                   shd| j                  v ryddlm}m} t        | j                  «      r || j                  «      n || j                  «      }t        |«      dk(  sd|v ry|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.cdr`   ra   r   r0   r:   )r"   r`   ra   r'   s       r*   ÚlanguagezCharsetMatch.language€   s‡   € ð �Šð ˜$×4Ñ4Ñ4Ø ÷ Xô *¨$¯-©-Ô8ñ & d§m¡mÔ4á'¨¯©Ó6ð ô �9‹~ Ò" m°yÑ&@Ø à˜Q‘<Ðà�‰˜qÑ! !Ñ$Ð$r,   c                ó   — | j                   S rM   )r   rA   s    r*   r8   zCharsetMatch.chaosœ   s   € à×$Ñ$Ð$r,   c                ó@   — | j                   sy| j                   d   d   S )Nr   r   r   r[   rA   s    r*   r9   zCharsetMatch.coherence    s    € à�ŠØØ�‰˜qÑ! !Ñ$Ð$r,   c                ó6   — t        | j                  dz  d¬«      S ©Néd   é   )Úndigits)Úroundr8   rA   s    r*   Úpercent_chaoszCharsetMatch.percent_chaos¦   s   € ä�T—Z‘Z #Ñ%¨qÔ1Ð1r,   c                ó6   — t        | j                  dz  d¬«      S ri   )rm   r9   rA   s    r*   Úpercent_coherencezCharsetMatch.percent_coherenceª   s   € ä�T—^‘^ cÑ)°1Ô5Ð5r,   c                ó   — | j                   S )z+
        Original untouched bytes.
        )r   rA   s    r*   r@   zCharsetMatch.raw®   s   € ð
 �}‰}Ðr,   c                ó   — | j                   S rM   )r   rA   s    r*   ÚsubmatchzCharsetMatch.submatchµ   s   € à�|‰|Ðr,   c                ó2   — t        | j                  «      dkD  S ©Nr   )r:   r   rA   s    r*   Úhas_submatchzCharsetMatch.has_submatch¹   s   € ä�4—<‘<Ó  1Ñ$Ð$r,   c                óô   — | j                   �| j                   S t        | «      D �cg c]  }t        |«      ‘Œ }}t        t	        |D �ch c]  }|sŒ|’Œ	 c}«      «      | _         | j                   S c c}w c c}w rM   )r   r/   r   ÚsortedÚlist)r"   ÚcharÚdetected_rangesÚrs       r*   Ú	alphabetszCharsetMatch.alphabets½   sk   € à×ÑÐ+Ø×'Ñ'Ð'äMPÐQUËYÖ,WÀT¬]¸4Õ-@Ð,WˆÐ,Wä%¤d°Ö+L°!Ê!ªAÒ+LÓ&MÓNˆÔØ×#Ñ#Ð#ùò -Xùâ+Ls   ¦A0ÁA5ÁA5c                óp   — | j                   g| j                  D �cg c]  }|j                  ‘Œ c}z   S c c}w )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'.
        )r   r   r0   )r"   Úms     r*   rc   z"CharsetMatch.could_be_from_charsetÇ   s,   € ð —‘Ð°t·|±|Ö"D°! 1§:£:Ò"DÑDÐDùÒ"Ds   ›3c                ó6  ‡ — ‰ j                   �‰ j                   |k7  rr|‰ _         t        ‰ «      }‰ j                  �=‰ j                  j                  «       dvr!t	        t
        ˆ fd„|dd d¬«      }||dd z   }|j                  |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Úutf8Úutf_8c                óî   •— | j                   | j                  «       d   | j                  «       d    j                  | j                  «       d   t	        ‰j
                  «      j                  dd«      «      S )Nr   r   Ú_ú-)ÚstringÚspanÚreplaceÚgroupsr   r   )r   r"   s    €r*   ú<lambda>z%CharsetMatch.output.<locals>.<lambda>ß   sY   ø€ ˜aŸh™h q§v¡v£x°¡{°Q·V±V³X¸a±[ÐA×IÑIØŸ™›
 1™Ü! $×"7Ñ"7Ó8×@Ñ@ÀÀcÓJó€ r,   i    r   )Úcountrˆ   )r   r/   r!   Úlowerr   r   Úencoder   )r"   r0   Údecoded_stringÚpatched_headers   `   r*   ÚoutputzCharsetMatch.outputÐ   s¬   ø€ ð
 × Ñ Ð(¨D×,AÑ,AÀXÒ,MØ$,ˆDÔ!Ü  ›YˆNà×,Ñ,Ð8Ø×0Ñ0×6Ñ6Ó8Ø1ñ2ô "%Ü3óð # 5 DÐ)Øô"�ð "0°.ÀÀÐ2GÑ!G�à#1×#8Ñ#8¸À9Ó#MˆDÔ à×#Ñ#Ð#r,   c                óP   — t        | j                  «       «      j                  «       S )zw
        Retrieve the unique SHA256 computed using the transformed (re-encoded) payload. Not the original one.
        )r   r�   Ú	hexdigestrA   s    r*   r1   zCharsetMatch.fingerprintí   s   € ô
 �d—k‘k“mÓ$×.Ñ.Ó0Ð0r,   )NN)r#   Úbytesr$   r/   r%   Úfloatr&   Úboolr'   ÚCoherenceMatchesr(   ú
str | Noner)   r—   )r3   ÚobjectÚreturnr•   )r™   r”   ©r™   r/   )r3   r   r™   ÚNone)r™   ú	list[str]©r™   r•   )r™   r“   )r™   zlist[CharsetMatch])r‚   )r0   r/   r™   r“   )Ú__name__Ú
__module__Ú__qualname__r+   r4   r>   Úpropertyr;   rD   rF   rK   r0   rS   rV   rY   r'   re   r8   r9   rn   rp   r@   rs   rv   r}   rc   r�   r1   © r,   r*   r   r      sÑ  „ ð '+Ø-1ðJàðJð ðJð ð	Jð
 ðJð $ðJð $ðJð !+óJó8Yó(ð, ò6ó ð6óóMó	#ð òó ðð ò
ó ð
ð ò$ó ð$ð ò$ó ð$ð ò/ó ð/ð ò%ó ð%ð6 ò%ó ð%ð ò%ó ð%ð
 ò2ó ð2ð ò6ó ð6ð òó ðð òó ðð ò%ó ð%ð ò$ó ð$ð òEó ðEô$ð: ò1ó ñ1r,   r   c                  óR   — 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y)Ú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.
    Nc                ó8   — |rt        |«      | _        y g | _        y rM   )rx   Ú_results)r"   Úresultss     r*   r+   zCharsetMatches.__init__û   s   € Ù?F¬F°7«Oˆ�ÈBˆ�r,   c              #  ó8   K  — | j                   E d {  –—†  y 7 Œ­wrM   ©r¦   rA   s    r*   Ú__iter__zCharsetMatches.__iter__þ   s   è ø€ Ø—=‘=× Ò ús   ‚’“c                óÊ   — t        |t        «      r| j                  |   S t        |t        «      r/t	        |d«      }| j                  D ]  }||j
                  v sŒ|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¦   r/   r   rc   ÚKeyError)r"   ÚitemÚresults      r*   Ú__getitem__zCharsetMatches.__getitem__  s`   € ô
 �dœCÔ Ø—=‘= Ñ&Ð&Ü�dœCÔ Ü˜T 5Ó)ˆDØŸ-™-ò "�Ø˜6×7Ñ7Ò7Ø!’Mð"ô ˆr,   c                ó,   — t        | j                  «      S rM   ©r:   r¦   rA   s    r*   Ú__len__zCharsetMatches.__len__  s   € Ü�4—=‘=Ó!Ð!r,   c                ó2   — t        | j                  «      dkD  S ru   r²   rA   s    r*   Ú__bool__zCharsetMatches.__bool__  s   € Ü�4—=‘=Ó! AÑ%Ð%r,   c                óÎ  — t        |t        «      s-t        dj                  t	        |j
                  «      «      «      ‚t        |j                  «      t        k  rW| j                  D ]H  }|j                  |j                  k(  sŒ|j                  |j                  k(  sŒ7|j                  |«        y | j                  j                  |«       t        | j                  «      | _	        y)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   r6   rH   r/   rI   r:   r@   r   r¦   r1   r8   rK   rJ   rx   )r"   r®   Úmatchs      r*   rJ   zCharsetMatches.append  s³   € ô
 ˜$¤Ô-ÜØ?×FÑFÜ˜Ÿ™Ó'óóð ô ˆt�x‰x‹=Ô+Ò+ØŸ™ò �Ø×$Ñ$¨×(8Ñ(8Ó8¸U¿[¹[ÈDÏJÉJÓ=VØ×&Ñ& tÔ,Ùðð 	�‰×Ñ˜TÔ"Ü˜tŸ}™}Ó-ˆ�r,   c                ó:   — | j                   sy| j                   d   S )zQ
        Simply return the first match. Strict equivalent to matches[0].
        Nr   r©   rA   s    r*   ÚbestzCharsetMatches.best)  s   € ð �}Š}ØØ�}‰}˜QÑÐr,   c                ó"   — | j                  «       S )zP
        Redundant method, call the method best(). Kept for BC reasons.
        )r¹   rA   s    r*   ÚfirstzCharsetMatches.first1  s   € ð �y‰y‹{Ðr,   rM   )r§   zlist[CharsetMatch] | None)r™   zIterator[CharsetMatch])r®   z	int | strr™   r   )r™   r¬   r�   )r®   r   r™   r›   )r™   zCharsetMatch | None)rž   rŸ   r    Ú__doc__r+   rª   r°   r³   rµ   rJ   r¹   r»   r¢   r,   r*   r¤   r¤   õ   s0   „ ñô
Oó!óó"ó&ó.ó( ôr,   r¤   c                  óZ   — e Zd Z	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zedd„«       Zdd„Zy)ÚCliDetectionResultc                óž   — || _         |
| _        || _        || _        || _        || _        || _        || _        || _        |	| _	        || _
        y rM   )ÚpathÚunicode_pathr0   rS   Úalternative_encodingsre   r}   r&   r8   r9   Úis_preferred)r"   rÀ   r0   rS   rÂ   re   r}   r&   r8   r9   rÁ   rÃ   s               r*   r+   zCliDetectionResult.__init__=  sV   € ð ˆŒ	Ø(4ˆÔØ$,ˆŒØ+;ˆÔØ0EˆÔ"Ø%ˆŒØ$-ˆŒØ$2ˆÔØ!ˆŒ
Ø )ˆŒØ".ˆÕr,   c                óú   — | j                   | j                  | j                  | j                  | j                  | j
                  | j                  | j                  | j                  | j                  | j                  dœS )N©rÀ   r0   rS   rÂ   re   r}   r&   r8   r9   rÁ   rÃ   rÅ   rA   s    r*   Ú__dict__zCliDetectionResult.__dict__W  se   € ð —I‘IØŸ™Ø $× 5Ñ 5Ø%)×%?Ñ%?ØŸ™ØŸ™Ø"×1Ñ1Ø—Z‘ZØŸ™Ø ×-Ñ-Ø ×-Ñ-ñ
ð 	
r,   c                ó2   — t        | j                  dd¬«      S )NTé   )Úensure_asciiÚindent)r   rÆ   rA   s    r*   Úto_jsonzCliDetectionResult.to_jsong  s   € Ü�T—]‘]°¸aÔ@Ð@r,   N)rÀ   r/   r0   r—   rS   rœ   rÂ   rœ   re   r/   r}   rœ   r&   r•   r8   r”   r9   r”   rÁ   r—   rÃ   r•   )r™   zdict[str, Any]rš   )rž   rŸ   r    r+   r¡   rÆ   rË   r¢   r,   r*   r¾   r¾   <  s�   „ ð/àð/ð ð/ð $ð	/ð
  )ð/ð ð/ð ð/ð ð/ð ð/ð ð/ð !ð/ð ó/ð4 ò
ó ð
ôAr,   r¾   N)Ú
__future__r   Úencodings.aliasesr   Úhashlibr   Újsonr   Úrer   Útypingr   r	   r
   r   Úconstantr   r   Úutilsr   r   r   r   r¤   r/   r”   ÚCoherenceMatchr–   r¾   r¢   r,   r*   ú<module>rÕ      sd   ðÝ "å %Ý Ý Ý ß -Ó -ç Gß CÑ C÷e1ñ e1÷P@ñ @ðF �s˜E�zÑ"€Ø˜Ñ'Ð ÷,Aò ,Ar,   