ó
    Eñi2  ã                  óÄ   • S SK Jr  S SKJr  S SKJr  S SKJr  S SKJ	r	J
r
JrJr  SSKJrJr  SSKJrJrJr   " S	 S
5      r " S S5      r\\\4   r\\   r " S S5      rg)é    )Úannotations)Úaliases)Údumps)Úsub)ÚAnyÚIteratorÚListÚTupleé   )ÚRE_POSSIBLE_ENCODING_INDICATIONÚTOO_BIG_SEQUENCE)Ú	iana_nameÚis_multi_byte_encodingÚunicode_rangec                  óÔ  • \ rS rSr  S             SS jjrSS jrSS jr\SS j5       rS S jr	S S jr
S!S	 jr\S S
 j5       r\S"S j5       r\S#S j5       r\S#S j5       r\S"S j5       r\S S j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\S$S j5       r\S%S j5       r\S#S j5       r\S"S j5       r\S"S j5       rS&S'S jjr\S(S j5       rSrg))ÚCharsetMatché   Nc                óž   • Xl         X l        X0l        XPl        X@l        S U l        / U l        SU l        S U l        S U l	        X`l
        Xpl        g )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           ÚV/home/mande/repo/quber/.venv/lib/python3.13/site-packages/charset_normalizer/models.pyÚ__init__ÚCharsetMatch.__init__   sQ   € ð ,3Œà.ŒØ'6ÔØ,5ŒØ%3ÔØ15ˆÔà+-ˆŒØ,/ˆÔ"à-1ˆÔØ,0ˆÔà#2Œà3IÕ$ó    c                óú   • [        U[        5      (       d.  [        U[        5      (       a  [        U5      U R                  :H  $ gU R                  UR                  :H  =(       a    U R
                  UR
                  :H  $ )NF)Ú
isinstancer   Ústrr   ÚencodingÚfingerprint©r"   Úothers     r*   Ú__eq__ÚCharsetMatch.__eq__)   s\   € Ü˜%¤×.Ñ.Ü˜%¤×%Ñ%Ü  Ó'¨4¯=©=Ñ8Ð8ØØ�}‰} §¡Ñ.×X°4×3CÑ3CÀu×GXÑGXÑ3XÐXr-   c                óò  • [        U[        5      (       d  [        e[        U R                  UR                  -
  5      n[        U R
                  UR
                  -
  5      nUS:  a  US:”  a  U R
                  UR
                  :„  $ US:  aU  US::  aO  [        U R                  5      [        :¼  a  U R                  UR                  :  $ U R                  UR                  :„  $ U R                  UR                  :  $ )zA
Implemented to make sorted available upon CharsetMatches items.
g{®Gázt?g{®Gáz”?)
r/   r   Ú
ValueErrorÚabsÚchaosÚ	coherenceÚlenr   r   Úmulti_byte_usage)r"   r4   Úchaos_differenceÚcoherence_differences       r*   Ú__lt__ÚCharsetMatch.__lt__0   sÍ   € ô ˜%¤×.Ñ.ÜÐä"% d§j¡j°5·;±;Ñ&>Ó"?ÐÜ&)¨$¯.©.¸5¿?¹?Ñ*JÓ&KÐð ˜eÓ#Ð(<¸tÓ(CØ—>‘> E§O¡OÑ3Ð3Ø Ó%Ð*>À$Ó*Fô �4—=‘=Ó!Ô%5Ó5Ø—z‘z E§K¡KÑ/Ð/Ø×(Ñ(¨5×+AÑ+AÑAÐAà�z‰z˜EŸK™KÑ'Ð'r-   c                ó\   • S[        [        U 5      5      [        U R                  5      -  -
  $ )Ng      ð?)r<   r0   Úraw©r"   s    r*   r=   ÚCharsetMatch.multi_byte_usageF   s"   € à”cœ#˜d›)“n¤s¨4¯8©8£}Ñ4Ñ5Ð5r-   c                ó2  • U R                   c  [        U R                  U R                  S5      U l         U R                  (       aH  U R                  S:X  a8  U R                   (       a'  U R                   S   S:X  a  U R                   SS  U l         U R                   $ )NÚstrictÚutf_7r   u   ï»¿r   )r    r0   r   r   r   rD   s    r*   Ú__str__ÚCharsetMatch.__str__J   sn   € à�<‰<ÑÜ˜tŸ}™}¨d¯n©n¸hÓGˆDŒLð
 ×$×$Ø—N‘N gÓ-Ø—L—LØ—L‘L ‘O xÓ/à#Ÿ|™|¨A¨BÐ/�”Ø�|‰|Ðr-   c                ó<   • SU R                    SU R                   S3$ )Nz<CharsetMatch 'z' fp(z)>)r1   r2   rD   s    r*   Ú__repr__ÚCharsetMatch.__repr__Z   s"   € Ø  §¡ ¨u°T×5EÑ5EÐ4FÀbÐIÐIr-   c                óÄ   • [        U[        5      (       a  X:X  a$  [        SR                  UR                  5      5      eS Ul        U R                  R                  U5        g )Nz;Unable to add instance <{}> as a submatch of a CharsetMatch)r/   r   r8   ÚformatÚ	__class__r    r   Úappendr3   s     r*   Úadd_submatchÚCharsetMatch.add_submatch]   sP   € Ü˜%¤×.Ñ.°%³-ÜØM×TÑTØ—O‘Oóóð ð ˆŒØ�‰×Ñ˜EÕ"r-   c                ó   • U R                   $ ©N)r   rD   s    r*   r1   ÚCharsetMatch.encodingh   s   € à�~‰~Ðr-   c                óÒ   • / n[         R                  " 5        HK  u  p#U R                  U:X  a  UR                  U5        M(  U R                  U:X  d  M:  UR                  U5        MM     U$ )zr
Encoding name are known by many name, using this could help when searching for IBM855 when it's listed as CP855.
)r   Úitemsr1   rQ   )r"   Úalso_known_asÚuÚps       r*   Úencoding_aliasesÚCharsetMatch.encoding_aliasesl   sW   € ð
 $&ˆÜ—M’M–O‰DˆAØ�}‰} Ó!Ø×$Ñ$ QÖ'Ø—‘ !Õ#Ø×$Ñ$ QÖ'ñ	 $ð
 Ðr-   c                ó   • U R                   $ rU   ©r   rD   s    r*   ÚbomÚCharsetMatch.bomy   ó   € à×#Ñ#Ð#r-   c                ó   • U R                   $ rU   r_   rD   s    r*   Úbyte_order_markÚCharsetMatch.byte_order_mark}   rb   r-   c                óJ   • U R                    Vs/ s H  oS   PM	     sn$ s  snf )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'   ÚCharsetMatch.languages�   s"   € ð #ŸošoÓ.šo˜�!”™oÑ.Ð.ùÒ.s   � c                ó,  • U R                   (       dr  SU R                  ;   a  gSSKJnJn  [        U R                  5      (       a  U" U R                  5      OU" U R                  5      n[        U5      S:X  d  SU;   a  gUS   $ U R                   S   S   $ )zz
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   r1   r<   )r"   rm   rn   r'   s       r*   ÚlanguageÚCharsetMatch.language‰   sŠ   € ð ��ð ˜$×4Ñ4Ó4Ø ÷ Xô *¨$¯-©-×8Ñ8ñ & d§m¡mÔ4á'¨¯©Ó6ð ô �9‹~ Ó" m°yÓ&@Ø à˜Q‘<Ðà�‰˜qÑ! !Ñ$Ð$r-   c                ó   • U R                   $ rU   )r   rD   s    r*   r:   ÚCharsetMatch.chaos¥   s   € à×$Ñ$Ð$r-   c                óJ   • U R                   (       d  gU R                   S   S   $ )Nr   r   r   rg   rD   s    r*   r;   ÚCharsetMatch.coherence©   s    € à��ØØ�‰˜qÑ! !Ñ$Ð$r-   c                ó0   • [        U R                  S-  SS9$ ©Néd   é   )Úndigits)Úroundr:   rD   s    r*   Úpercent_chaosÚCharsetMatch.percent_chaos¯   s   € ä�T—Z‘Z #Ñ%¨qÑ1Ð1r-   c                ó0   • [        U R                  S-  SS9$ ry   )r}   r;   rD   s    r*   Úpercent_coherenceÚCharsetMatch.percent_coherence³   s   € ä�T—^‘^ cÑ)°1Ñ5Ð5r-   c                ó   • U R                   $ )z
Original untouched bytes.
)r   rD   s    r*   rC   ÚCharsetMatch.raw·   s   € ð
 �}‰}Ðr-   c                ó   • U R                   $ rU   )r   rD   s    r*   ÚsubmatchÚCharsetMatch.submatch¾   s   € à�|‰|Ðr-   c                ó2   • [        U R                  5      S:„  $ ©Nr   )r<   r   rD   s    r*   Úhas_submatchÚCharsetMatch.has_submatchÂ   s   € ä�4—<‘<Ó  1Ñ$Ð$r-   c                ó  • U R                   b  U R                   $ [        U 5       Vs/ s H  n[        U5      PM     nn[        [	        U Vs1 s H  o3(       d  M  UiM     sn5      5      U l         U R                   $ s  snf s  snf rU   )r   r0   r   ÚsortedÚlist)r"   ÚcharÚdetected_rangesÚrs       r*   Ú	alphabetsÚCharsetMatch.alphabetsÆ   sp   € à×ÑÑ+Ø×'Ñ'Ð'äMPÐQUÌYÓ,WÊYÀT¬]¸4Ö-@ÉYˆÐ,Wä%¤d±Ó+L²°!Ë!¯A±Ñ+LÓ&MÓNˆÔØ×#Ñ#Ð#ùò -Xùâ+Ls   §A<Á
BÁBc                ót   • U R                   /U R                   Vs/ s H  oR                  PM     sn-   $ s  snf )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   r1   )r"   Úms     r*   rp   Ú"CharsetMatch.could_be_from_charsetÐ   s.   € ð —‘Ð°t·|²|Ó"D²|°!§:¤:±|Ñ"DÑDÐDùÒ"Ds   ›5c                ó:  ^ • T R                   b  T R                   U:w  ar  UT l         [        T 5      nT R                  b<  T R                  R                  5       S;  a  [	        [
        U 4S jUSS SS9nX2SS -   nUR                  US5      T l        T R                  $ )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                óî   >• U R                   U R                  5       S   U R                  5       S    R                  U R                  5       S   [	        TR
                  5      R                  SS5      5      $ )Nr   r   Ú_Ú-)ÚstringÚspanÚreplaceÚgroupsr   r   )r•   r"   s    €r*   Ú<lambda>Ú%CharsetMatch.output.<locals>.<lambda>è   sW   ø€ ˜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   r0   r!   Úlowerr   r   Úencoder   )r"   r1   Údecoded_stringÚpatched_headers   `   r*   ÚoutputÚ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                ó*   • [        [        U 5      5      $ )zM
Retrieve a hash fingerprint of the decoded payload, used for deduplication.
)Úhashr0   rD   s    r*   r2   ÚCharsetMatch.fingerprintö   s   € ô
 ”C˜“I‹Ðr-   )r   r   r   r   r   r   r   r   r   r!   r    r   )NN)r#   úbytes | bytearrayr$   r0   r%   Úfloatr&   Úboolr'   ÚCoherenceMatchesr(   ú
str | Noner)   r±   )r4   ÚobjectÚreturnr¯   )r³   r®   ©r³   r0   )r4   r   r³   ÚNone)r³   ú	list[str]©r³   r¯   )r³   r­   )r³   zlist[CharsetMatch])r™   )r1   r0   r³   Úbytes©r³   Úint)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r+   r5   r@   Úpropertyr=   rI   rL   rR   r1   r\   r`   rd   r'   rr   r:   r;   r~   r�   rC   r†   rŠ   r’   rp   r¨   r2   Ú__static_attributes__© r-   r*   r   r      sÑ  † ð '+Ø-1ðJà"ðJð ðJð ð	Jð
 ðJð $ðJð $ðJð !+õJô8Yô(ð, ó6ó ð6ôô Jô	#ð óó ðð ó
ó ð
ð ó$ó ð$ð ó$ó ð$ð ó/ó ð/ð ó%ó ð%ð6 ó%ó ð%ð ó%ó ð%ð
 ó2ó ð2ð ó6ó ð6ð óó ðð óó ðð ó%ó ð%ð ó$ó ð$ð óEó ðEö$ð: óó ór-   r   c                  ól   • \ rS rSrSrSSS jjrSS jrSS jrSS jrSS jr	SS	 jr
SS
 jrSS jrSrg)ÚCharsetMatcheséþ   z§
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                óB   • U(       a  [        U5      U l        g / U l        g rU   )r�   Ú_results)r"   Úresultss     r*   r+   ÚCharsetMatches.__init__  s   € Þ?F¬F°7«Oˆ�ÈBˆ�r-   c              #  ó8   #   • U R                    S h  v•N   g  N7frU   ©rÆ   rD   s    r*   Ú__iter__ÚCharsetMatches.__iter__  s   é € Ø—=‘=× Ó ùs   ‚’“c                óä   • [        U[        5      (       a  U R                  U   $ [        U[        5      (       a2  [	        US5      nU R                   H  nXR
                  ;   d  M  Us  $    [        e)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/   rº   rÆ   r0   r   rp   ÚKeyError)r"   ÚitemÚresults      r*   Ú__getitem__ÚCharsetMatches.__getitem__
  s_   € ô
 �dœC× Ñ Ø—=‘= Ñ&Ð&Ü�dœC× Ñ Ü˜T 5Ó)ˆDØŸ-œ-�Ø×7Ñ7Õ7Ø!’Mñ (ô ˆr-   c                ó,   • [        U R                  5      $ rU   ©r<   rÆ   rD   s    r*   Ú__len__ÚCharsetMatches.__len__  s   € Ü�4—=‘=Ó!Ð!r-   c                ó2   • [        U R                  5      S:„  $ r‰   rÔ   rD   s    r*   Ú__bool__ÚCharsetMatches.__bool__  s   € Ü�4—=‘=Ó! AÑ%Ð%r-   c                óä  • [        U[        5      (       d-  [        SR                  [	        UR
                  5      5      5      e[        UR                  5      [        :  a\  U R                   HL  nUR                  UR                  :X  d  M  UR                  UR                  :X  d  M;  UR                  U5          g   U R                  R                  U5        [        U R                  5      U l	        g)zf
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   r8   rO   r0   rP   r<   rC   r   rÆ   r2   r:   rR   rQ   r�   )r"   rÏ   Úmatchs      r*   rQ   ÚCharsetMatches.append  s±   € ô
 ˜$¤×-Ñ-ÜØ?×FÑFÜ˜Ÿ™Ó'óóð ô ˆt�x‰x‹=Ô+Ó+ØŸœ�Ø×$Ñ$¨×(8Ñ(8Õ8¸U¿[¹[ÈDÏJÉJÕ=VØ×&Ñ& tÔ,Ùñ 'ð 	�‰×Ñ˜TÔ"Ü˜tŸ}™}Ó-ˆ�r-   c                óD   • U R                   (       d  gU R                   S   $ )zA
Simply return the first match. Strict equivalent to matches[0].
Nr   rÊ   rD   s    r*   ÚbestÚCharsetMatches.best2  s   € ð �}�}ØØ�}‰}˜QÑÐr-   c                ó"   • U R                  5       $ )z@
Redundant method, call the method best(). Kept for BC reasons.
)rÞ   rD   s    r*   ÚfirstÚCharsetMatches.first:  s   € ð �y‰y‹{Ðr-   rÊ   rU   )rÇ   zlist[CharsetMatch] | None)r³   zIterator[CharsetMatch])rÏ   z	int | strr³   r   r¹   r·   )rÏ   r   r³   rµ   )r³   zCharsetMatch | None)r»   r¼   r½   r¾   Ú__doc__r+   rË   rÑ   rÕ   rØ   rQ   rÞ   rá   rÀ   rÁ   r-   r*   rÃ   rÃ   þ   s0   † ñö
Oô!ôô"ô&ô.ô( ÷r-   rÃ   c                  óh   • \ rS rSr                      SS jr\SS j5       rS	S jrSrg)
ÚCliDetectionResultiE  c                óˆ   • Xl         X l        X l        X0l        X@l        XPl        X`l        Xpl        X€l        X�l	        X°l
        g rU   )ÚpathÚunicode_pathr1   r\   Úalternative_encodingsrr   r’   r&   r:   r;   Úis_preferred)r"   rç   r1   r\   ré   rr   r’   r&   r:   r;   rè   rê   s               r*   r+   ÚCliDetectionResult.__init__F  s@   € ð Œ	Ø(4ÔØ$,ŒØ+;ÔØ0EÔ"Ø%ŒØ$-ŒØ$2ÔØ!Œ
Ø )ŒØ".Õr-   c                óú   • U R                   U R                  U R                  U R                  U R                  U R
                  U R                  U R                  U R                  U R                  U R                  S.$ )N©rç   r1   r\   ré   rr   r’   r&   r:   r;   rè   rê   rí   rD   s    r*   Ú__dict__ÚCliDetectionResult.__dict__`  se   € ð —I‘IØŸ™Ø $× 5Ñ 5Ø%)×%?Ñ%?ØŸ™ØŸ™Ø"×1Ñ1Ø—Z‘ZØŸ™Ø ×-Ñ-Ø ×-Ñ-ñ
ð 	
r-   c                ó,   • [        U R                  SSS9$ )NTé   )Úensure_asciiÚindent)r   rî   rD   s    r*   Úto_jsonÚCliDetectionResult.to_jsonp  s   € Ü�T—]‘]°¸aÑ@Ð@r-   )r’   ré   r:   r;   r1   r\   r&   rê   rr   rç   rè   N)rç   r0   r1   r±   r\   r¶   ré   r¶   rr   r0   r’   r¶   r&   r¯   r:   r®   r;   r®   rè   r±   rê   r¯   )r³   zdict[str, Any]r´   )	r»   r¼   r½   r¾   r+   r¿   rî   rô   rÀ   rÁ   r-   r*   rå   rå   E  s�   † ð/àð/ð ð/ð $ð	/ð
  )ð/ð ð/ð ð/ð ð/ð ð/ð ð/ð !ð/ð ô/ð4 ó
ó ð
÷Ar-   rå   N)Ú
__future__r   Úencodings.aliasesr   Újsonr   Úrer   Útypingr   r   r	   r
   Úconstantr   r   Úutilsr   r   r   r   rÃ   r0   r®   ÚCoherenceMatchr°   rå   rÁ   r-   r*   Ú<module>rþ      sa   ðÝ "å %Ý Ý ß -Ó -ç Gß CÑ C÷oñ o÷d@ñ @ðF �s˜E�zÑ"€Ø˜Ñ'Ð ÷,Aò ,Ar-   