+
    ij0                        ^ RI Ht ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
HtHtHtHt ^RIHtHt ^RIHtHtHt  ! R	 R
4      t ! R R4      t]]]3,          t]],          t ! R R4      tR# )    )annotations)aliases)sha256)dumps)sub)AnyIteratorListTuple)RE_POSSIBLE_ENCODING_INDICATIONTOO_BIG_SEQUENCE)	iana_nameis_multi_byte_encodingunicode_rangec                     ] tR t^tR3R R lltR R ltR R lt]R R	 l4       tR
 R lt	R R lt
R R lt]R R l4       t]R R l4       t]R R l4       t]R R l4       t]R R l4       t]R R l4       t]R R l4       t]R R l4       t]R  R! l4       t]R" R# l4       t]R$ R% l4       t]R& R' l4       t]R( R) l4       t]R* R+ l4       t]R, R- l4       tR4R. R/ llt]R0 R1 l4       tR2tR# )5CharsetMatchNc               4    V ^8  d   QhRRRRRRRRR	R
RRRR/# )   payloadbytesguessed_encodingstrmean_mess_ratiofloathas_sig_or_bombool	languagesCoherenceMatchesdecoded_payload
str | Nonepreemptive_declaration )formats   "_/Users/ahmad/.openclaw/workspace/venv/lib/python3.14/site-packages/charset_normalizer/models.py__annotate__CharsetMatch.__annotate__   sY     J JJ J 	J
 J $J $J !+J    c                	    Wn         W n        W0n        WPn        W@n        R V n        . V n        RV n        R V n        R V n	        W`n
        Wpn        R # )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   &&&&&&&&r$   __init__CharsetMatch.__init__   sQ      '.'6,5%315+-,/"-1,0#23I$r'   c                    V ^8  d   QhRRRR/# r   otherobjectreturnr   r"   )r#   s   "r$   r%   r&   *   s     Y YF Yt Yr'   c                	   \        V\        4      '       g1   \        V\        4      '       d   \        V4      V P                  8H  # R # V P                  VP                  8H  ;'       d    V P
                  VP
                  8H  # )F)
isinstancer   r   r   encodingfingerprintr6   r;   s   &&r$   __eq__CharsetMatch.__eq__*   s_    %..%%% '4==88}}.XX43C3CuGXGX3XXr'   c                    V ^8  d   QhRRRR/# r:   r"   )r#   s   "r$   r%   r&   1   s     ( (F (t (r'   c                   \        V\        4      '       g   \        h\        V P                  VP                  ,
          4      p\        V P
                  VP
                  ,
          4      pVR8  d!   VR8  d   V P
                  VP
                  8  # VR8  dX   VR8:  dQ   \        V P                  4      \        8  d   V P                  VP                  8  # V P                  VP                  8  # V P                  VP                  8  # )zA
Implemented to make sorted available upon CharsetMatches items.
g{Gz?g{Gz?)
r?   r   
ValueErrorabschaos	coherencelenr*   r   multi_byte_usage)r6   r;   chaos_differencecoherence_differences   &&  r$   __lt__CharsetMatch.__lt__1   s     %.."%djj5;;&>"?&)$..5??*J&K d"';d'B>>EOO33$)=)E 4==!%55zzEKK//((5+A+AAAzzEKK''r'   c                   V ^8  d   QhRR/# r   r=   r   r"   )r#   s   "r$   r%   r&   H   s     6 6% 6r'   c                	l    R \        \        V 4      4      \        V P                  4      ,          ,
          # )g      ?)rK   r   rawr6   s   &r$   rL   CharsetMatch.multi_byte_usageG   s"    c#d)ns488}455r'   c                   V ^8  d   QhRR/# r   r=   r   r"   )r#   s   "r$   r%   r&   K   s       r'   c                	    V P                   f'   \        V P                  V P                  R4      V n         V P                   # )Nstrict)r4   r   r*   r+   rU   s   &r$   __str__CharsetMatch.__str__K   s.    <<t}}dnnhGDL||r'   c                   V ^8  d   QhRR/# rX   r"   )r#   s   "r$   r%   r&   Q   s     M M# Mr'   c                	<    R V P                    RV P                   R2# )z<CharsetMatch 'z' bytes(z)>)r@   rA   rU   s   &r$   __repr__CharsetMatch.__repr__Q   s"     x8H8H7ILLr'   c                    V ^8  d   QhRRRR/# )r   r;   r   r=   Noner"   )r#   s   "r$   r%   r&   T   s     	# 	#, 	#4 	#r'   c                	    \        V\        4      '       d   W8X  d%   \        R P                  VP                  4      4      hRVn        V P                  P                  V4       R# )z;Unable to add instance <{}> as a submatch of a CharsetMatchN)r?   r   rG   r#   	__class__r4   r0   appendrB   s   &&r$   add_submatchCharsetMatch.add_submatchT   sP    %..%-MTTOO  E"r'   c                   V ^8  d   QhRR/# rX   r"   )r#   s   "r$   r%   r&   `   s      # r'   c                	    V P                   # N)r+   rU   s   &r$   r@   CharsetMatch.encoding_   s    ~~r'   c                   V ^8  d   QhRR/# r   r=   	list[str]r"   )r#   s   "r$   r%   r&   d   s     
 
) 
r'   c                    . p\         P                  ! 4        FM  w  r#V P                  V8X  d   VP                  V4       K)  V P                  V8X  g   K<  VP                  V4       KO  	  V# )zr
Encoding name are known by many name, using this could help when searching for IBM855 when it's listed as CP855.
)r   itemsr@   re   )r6   also_known_asups   &   r$   encoding_aliasesCharsetMatch.encoding_aliasesc   sW    
 $&MMODA}}!$$Q'!#$$Q'	 $
 r'   c                   V ^8  d   QhRR/# r   r=   r   r"   )r#   s   "r$   r%   r&   q   s     $ $T $r'   c                	    V P                   # rj   r.   rU   s   &r$   bomCharsetMatch.bomp       ###r'   c                   V ^8  d   QhRR/# rw   r"   )r#   s   "r$   r%   r&   u   s     $ $ $r'   c                	    V P                   # rj   ry   rU   s   &r$   byte_order_markCharsetMatch.byte_order_markt   r|   r'   c                   V ^8  d   QhRR/# rm   r"   )r#   s   "r$   r%   r&   y   s     / /9 /r'   c                P    V P                    Uu. uF  q^ ,          NK  	  up# u upi )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-   )r6   es   & r$   r   CharsetMatch.languagesx   s$     #oo.o!o...s   #c                   V ^8  d   QhRR/# rX   r"   )r#   s   "r$   r%   r&      s     % %# %r'   c                R   V P                   '       g}   RV P                  9   d   R# ^ RIHpHp \        V P                  4      '       d   V! V P                  4      MV! V P                  4      p\        V4      ^ 8X  g   RV9   d   R# V^ ,          # V P                   ^ ,          ^ ,          # )zz
Most probable language found in decoded sequence. If none were detected or inferred, the property will return
"Unknown".
asciiEnglish)encoding_languagesmb_encoding_languageszLatin BasedUnknown)r-   could_be_from_charsetcharset_normalizer.cdr   r   r   r@   rK   )r6   r   r   r   s   &   r$   languageCharsetMatch.language   s      $444  X *$--88 &dmm4'6  9~"my&@ Q<q!!$$r'   c                   V ^8  d   QhRR/# rR   r"   )r#   s   "r$   r%   r&      s     % %u %r'   c                	    V P                   # rj   )r,   rU   s   &r$   rI   CharsetMatch.chaos   s    $$$r'   c                   V ^8  d   QhRR/# rR   r"   )r#   s   "r$   r%   r&      s     % %5 %r'   c                	^    V P                   '       g   R # V P                   ^ ,          ^,          # )r)   r   rU   s   &r$   rJ   CharsetMatch.coherence   s"    q!!$$r'   c                   V ^8  d   QhRR/# rR   r"   )r#   s   "r$   r%   r&      s     2 2u 2r'   c                	>    \        V P                  ^d,          ^R7      # d   )ndigits)roundrI   rU   s   &r$   percent_chaosCharsetMatch.percent_chaos   s    TZZ#%q11r'   c                   V ^8  d   QhRR/# rR   r"   )r#   s   "r$   r%   r&      s     6 65 6r'   c                	>    \        V P                  ^d,          ^R7      # r   )r   rJ   rU   s   &r$   percent_coherenceCharsetMatch.percent_coherence   s    T^^c)155r'   c                   V ^8  d   QhRR/# )r   r=   r   r"   )r#   s   "r$   r%   r&      s      U r'   c                    V P                   # )z
Original untouched bytes.
)r*   rU   s   &r$   rT   CharsetMatch.raw   s    
 }}r'   c                   V ^8  d   QhRR/# )r   r=   zlist[CharsetMatch]r"   )r#   s   "r$   r%   r&      s      , r'   c                	    V P                   # rj   )r0   rU   s   &r$   submatchCharsetMatch.submatch   s    ||r'   c                   V ^8  d   QhRR/# rw   r"   )r#   s   "r$   r%   r&      s     % %d %r'   c                	2    \        V P                  4      ^ 8  # r   )rK   r0   rU   s   &r$   has_submatchCharsetMatch.has_submatch   s    4<< 1$$r'   c                   V ^8  d   QhRR/# rm   r"   )r#   s   "r$   r%   r&      s     $ $9 $r'   c                	   V P                   e   V P                   # \        V 4       Uu. uF  p\        V4      NK  	  pp\        \	        V Uu0 uF  q3'       g   K  VkK  	  up4      4      V n         V P                   # u upi u upi rj   )r/   r   r   sortedlist)r6   chardetected_rangesrs   &   r$   	alphabetsCharsetMatch.alphabets   sr    +'''MPQUY,WYT]4-@Y,W%d+L!!AA+L&MN### -X+Ls   A<	BBc                   V ^8  d   QhRR/# rm   r"   )r#   s   "r$   r%   r&      s     E Ey Er'   c                z    V P                   .V P                   Uu. uF  qP                  NK  	  up,           # u upi )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+   r0   r@   )r6   ms   & r$   r   "CharsetMatch.could_be_from_charset   s.     t||"D|!::|"DDD"Ds   8c                    V ^8  d   QhRRRR/# )r   r@   r   r=   r   r"   )r#   s   "r$   r%   r&      s     $ $s $ $r'   c                `  a  S P                   e   S P                   V8w  d   VS n         \        S 4      pS P                  eM   S P                  P                  4       R9  d.   \	        \
        V 3R lVR,          ^R7      pW2R,          ,           pVP                  VR4      S n        S P                  # )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.
c                  < V P                   V P                  4       ^ ,          V P                  4       ^,           P                  V P                  4       ^ ,          \	        SP
                  4      P                  RR4      4      # )r   _-)stringspanreplacegroupsr   r3   )r   r6   s   &r$   <lambda>%CharsetMatch.output.<locals>.<lambda>   sW    ahhqvvx{QVVXa[AII
1!$"7"78@@cJr'   :Ni    N)count:i    NNr   )zutf-8utf8utf_8)r3   r   r5   lowerr   r   encoder2   )r6   r@   decoded_stringpatched_headers   f&  r$   outputCharsetMatch.output   s    
   (D,A,AX,M$,D! YN,,80066812 "%3 #5)" "02G!G#1#8#89#MD ###r'   c                   V ^8  d   QhRR/# rX   r"   )r#   s   "r$   r%   r&      s     1 1S 1r'   c                P    \        V P                  4       4      P                  4       # )zg
Retrieve the unique SHA256 computed using the transformed (re-encoded) payload. Not the original one.
)r   r   	hexdigestrU   s   &r$   rA   CharsetMatch.fingerprint   s    
 dkkm$..00r'   )r+   r.   r-   r0   r1   r,   r3   r2   r*   r5   r4   r/   )NN)r   )__name__
__module____qualname____firstlineno__r7   rC   rO   propertyrL   r[   r_   rf   r@   rt   rz   r   r   r   rI   rJ   r   r   rT   r   r   r   r   r   rA   __static_attributes__r"   r'   r$   r   r      s~   J8Y(, 6 6M	#   
 
 $ $ $ $ / / % %6 % % % %
 2 2 6 6     % % $ $ E E$: 1 1r'   r   c                  ~    ] tR t^tRtRR R lltR R ltR R ltR	 R
 ltR R lt	R R lt
R R ltR R ltRtR# )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                   V ^8  d   QhRR/# )r   resultszlist[CharsetMatch] | Noner"   )r#   s   "r$   r%   CharsetMatches.__annotate__   s     O O 9 Or'   c                	H    V'       d   \        V4      V n        R # . V n        R # rj   )r   _results)r6   r   s   &&r$   r7   CharsetMatches.__init__   s    ?FF7OBr'   c                   V ^8  d   QhRR/# )r   r=   zIterator[CharsetMatch]r"   )r#   s   "r$   r%   r      s     ! !0 !r'   c              #  	:   "   V P                    R j  xL
  R #  L5irj   r   rU   s   &r$   __iter__CharsetMatches.__iter__   s     ==  s   c                    V ^8  d   QhRRRR/# )r   itemz	int | strr=   r   r"   )r#   s   "r$   r%   r     s      	 l r'   c                    \        V\        4      '       d   V P                  V,          # \        V\        4      '       d4   \	        VR4      pV P                   F  pWP
                  9   g   K  Vu # 	  \        h)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   r   KeyError)r6   r   results   && r$   __getitem__CharsetMatches.__getitem__  s_    
 dC  ==&&dC  T5)D--777!M ( r'   c                   V ^8  d   QhRR/# )r   r=   r   r"   )r#   s   "r$   r%   r     s     " " "r'   c                	,    \        V P                  4      # rj   rK   r   rU   s   &r$   __len__CharsetMatches.__len__  s    4==!!r'   c                   V ^8  d   QhRR/# rw   r"   )r#   s   "r$   r%   r     s     & &$ &r'   c                	2    \        V P                  4      ^ 8  # r   r   rU   s   &r$   __bool__CharsetMatches.__bool__  s    4==!A%%r'   c                    V ^8  d   QhRRRR/# )r   r   r   r=   rb   r"   )r#   s   "r$   r%   r     s     . .< .D .r'   c                   \        V\        4      '       g.   \        RP                  \	        VP
                  4      4      4      h\        VP                  4      \        8  d`   V P                   FO  pVP                  VP                  8X  g   K   VP                  VP                  8X  g   K=  VP                  V4        R# 	  V P                  P                  V4       \        V P                  4      V n	        R# )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   rG   r#   r   rd   rK   rT   r   r   rA   rI   rf   re   r   )r6   r   matchs   && r$   re   CharsetMatches.append  s    
 $--?FF'  txx=++$$(8(88U[[DJJ=V&&t, ' 	T"t}}-r'   c                   V ^8  d   QhRR/# r   r=   zCharsetMatch | Noner"   )r#   s   "r$   r%   r   )  s        )  r'   c                P    V P                   '       g   R# V P                   ^ ,          # )zA
Simply return the first match. Strict equivalent to matches[0].
Nr   rU   s   &r$   bestCharsetMatches.best)  s     }}}}}Qr'   c                   V ^8  d   QhRR/# r   r"   )r#   s   "r$   r%   r   1  s      * r'   c                "    V P                  4       # )z@
Redundant method, call the method best(). Kept for BC reasons.
)r   rU   s   &r$   firstCharsetMatches.first1  s     yy{r'   r   rj   )r   r   r   r   __doc__r7   r   r   r   r   re   r   r  r   r"   r'   r$   r   r      s5    
O!"&.(  r'   r   c                  D    ] tR tRtR R lt]R R l4       tR R ltRtR	# )
CliDetectionResulti<  c               D    V ^8  d   QhRRRRRRRRRRR	RR
RRRRRRRRR/# )r   pathr   r@   r    rt   rn   alternative_encodingsr   r   r   r   rI   r   rJ   unicode_pathis_preferredr"   )r#   s   "r$   r%   CliDetectionResult.__annotate__=  sx     / // / $	/
  )/ / / / / / !/ /r'   c                	    Wn         Wn        W n        W0n        W@n        WPn        W`n        Wpn        Wn        Wn	        Wn
        R # rj   )r	  r  r@   rt   r
  r   r   r   rI   rJ   r  )r6   r	  r@   rt   r
  r   r   r   rI   rJ   r  r  s   &&&&&&&&&&&&r$   r7   CliDetectionResult.__init__=  s@     	(4$,+;0E"%$-$2!
 )".r'   c                   V ^8  d   QhRR/# )r   r=   zdict[str, Any]r"   )r#   s   "r$   r%   r  X  s     
 
. 
r'   c                	   R V P                   RV P                  RV P                  RV P                  RV P                  RV P
                  RV P                  RV P                  RV P                  R	V P                  R
V P                  /# r	  r@   rt   r
  r   r   r   rI   rJ   r  r  r  rU   s   &r$   __dict__CliDetectionResult.__dict__W  s{     DII 5 5#T%?%?d11TZZD--D--
 	
r'   c                   V ^8  d   QhRR/# rX   r"   )r#   s   "r$   r%   r  g  s     A A Ar'   c                	2    \        V P                  R ^R7      # )T)ensure_asciiindent)r   r  rU   s   &r$   to_jsonCliDetectionResult.to_jsong  s    T]]a@@r'   )r   r
  rI   rJ   r@   rt   r   r  r   r	  r  N)	r   r   r   r   r7   r   r  r  r   r"   r'   r$   r  r  <  s'    /4 
 
A 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1P@ @F sEz"' ,A ,Ar'   