
    *pj                       % 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
JrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJr  SSKJrJrJrJ r J!r!J"r"J#r#  \\-  \-  \-  \-  r$S\%S'    " S	 S
5      r&\" SS9S)S j5       r'\(" S5       V s/ s H  n \&" \)" U 5      5      PM     sn r*S\%S'    " S S5      r+ " S S\+5      r, " S S\+5      r- " S S\+5      r. " S S\+5      r/ " S S\+5      r0 " S S\+5      r1 " S S \+5      r2 " S! S"\+5      r3 " S# S$\+5      r4 " S% S&\+5      r5\" SS9      S*S' j5       r6 S+       S,S( jjr7gs  sn f )-    )annotations)	lru_cache)	getLogger   )COMMON_CJK_CHARACTERSCOMMON_SAFE_ASCII_CHARACTERSTRACECompatibleFamillyRange_ACCENTUATED_ARABIC_ARABIC_ISOLATED_FORM&_BASIC_LATIN_COMPATIBLE_RANGE_FAMILIES_CJK_COMPATIBLE_RANGE_FAMILIES#_COMPATIBLE_WITH_ANY_RANGE_FAMILIES_HANGUL_HALFWIDTH_KATAKANA	_HIRAGANA	_KATAKANA_LATIN	_LIGATURE_RANGE_FAMILIES_SENTENCE_OPEN_PUNCTUATION_SUPERSCRIPT_THAI)_character_flagsis_emoticonis_punctuationis_separator	is_symbolremove_accentunicode_rangeint_GLYPH_MASKc                  @   \ rS rSr% SrSrS\S'   S\S'   S\S'   S\S	'   S\S
'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S '   S\S!'   S\S"'   S\S#'   S'S$ jrS%rg&)(CharInfo,   z>Pre-computed character properties shared across all detectors.)	character	printablealphaupperlowerspacedigitis_asciicase_variableflagsaccentuatedlatinis_cjkis_katakanais_halfwidth_katakana	is_arabicis_ligatureis_superscriptis_sentence_open_punctuationis_glyphpunctsymrangesepemoticonsafe
common_cjk
unaccentedstrr(   boolr)   r*   r+   r,   r-   r.   r/   r0   r#   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   
str | Noner>   r?   r@   rA   rB   rC   c                P
   Xl         [        U5      nUS:  Ga  SU l        SU l        Xl        SU l        SU l        U[        ;   U l        SU l	        SU l
        SU l        SU l        SU l        SU l        SU l        SU l        SUs=::  a  S::  aV  O  OSSU l        SU l        SU l        SU l        SU l        SU l        SU l        [0        U l        SU l        SU l        SU l        GO#SUs=::  a  S::  aV  O  OSSU l        SU l        SU l        SU l        SU l        SU l        SU l        [0        U l        SU l        SU l        SU l        GOSUs=::  a  S	::  aR  O  OOSU l        SU l        SU l        SU l        SU l        SU l        SU l        S
U l        SU l        SU l        SU l        GOaUS:X  d  SUs=::  a  S::  aU  O  ORSU l        SU l        SU l        SU l        SU l        US:H  U l        SU l        S
U l        SU l        SU l        SU l        GOUR;                  5       U l        SU l        SU l        SU l        SU l        SU l        SU l        S
U l        SU l        U R,                  (       a  [=        U5      OSU l        U R,                  (       a  [?        U5      OSU l        GOdSU l        SU l        UR;                  5       U l        URA                  5       U l        URC                  5       U l        URE                  5       U l        URG                  5       U l        URI                  5       U l        U R&                  U R$                  :g  U l        [K        U5      nU R"                  (       a  SU l        O[M        U5      U l        X0l        [O        U[P        -  5      U l        [O        U[0        -  5      U l        [O        U[R        -  5      U l	        [O        U[T        -  5      U l
        [O        U[V        -  5      U l        [O        U[X        -  5      U l        [O        U[Z        -  5      U l        [O        U[\        -  5      U l        [O        U[^        -  5      U l        [O        U[`        -  5      U l        U R4                  (       a"  U R                  (       a  [c        U5      U l        OXl        U R                  =(       a	    U[d        ;   U l        U R,                  (       a!  [=        U5      U l        [?        U5      U l        OSU l        SU l        [g        U5      U l4        [k        U5      U l6        g)zcCompute all properties for *character* (built once per codepoint,
every branch assigns every slot).   TFA   Z   a   z   0   9   r       	      N)7r(   ordr/   r2   rC   r@   rB   r   rA   r4   r5   r6   r7   r8   r9   r:   r;   r*   r+   r,   r-   r.   r)   r0   r   r1   r3   r<   r=   isprintabler   r    isalphaisupperislowerisspaceisdigitr   r   rE   r   r   r   r   r   r   r   r   r$   r!   r   r"   r>   r   r?   )selfr(   or1   s       Q/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/charset_normalizer/md.py__init__CharInfo.__init__k   sD    # Ys7 DM$D'O!DM#DO!%AADIDK$D).D&"DN$D"'D05D-!DMQ}"}!
!
"
"
"
!%%)"#
!
"
 qC!
"
!
"
"
!%%)"#
!
"
 qB"
"
"
"
!
!%%*"
"
"
 bQ!\r\"
"
"
!
"
!"b%*"
"
"
  "+!6!6!8"
"
"
"
"
%*"
"
:>..^I6e
37>>9Y/u "DMDI&224DN"**,DJ"**,DJ"**,DJ"**,DJ"**,DJ!%tzz!9D *)4Ezz % +I 6J#EL$89Defn-DJut|,DK#EI$56D)-e6I.I)JD&!%'/2DN#EI$56D"&u|';"<D04U=W5W0XD- !45DMzzd.."/	":"+"kkPi;P.PDO ~~+I6
$Y/"
 "9-
	*    )r2   r*   r0   r(   rB   r.   r@   r1   r7   r/   r4   r;   r6   r5   r8   r:   r9   r3   r,   r)   r<   r>   rA   r?   r-   r=   rC   r+   N)r(   rD   returnNone)	__name__
__module____qualname____firstlineno____doc__	__slots____annotations__r\   __static_attributes__ r^   r[   r&   r&   ,   s    HI> NOKKKKKNJKLO"&&NK	I	IN
JOH+r^   r&   N)maxsizec                    [        U 5      $ )zBBuild (once per codepoint) and cache the CharInfo for *character*.)r&   )r(   s    r[   
_char_inforl      s     Ir^   rH   zlist[CharInfo]_ASCII_CHAR_INFOc                  D    \ rS rSrSrSrSS jrS	S jr\S
S j5       r	Sr
g)MessDetectorPlugini  zm
Base abstract class used for mess detection plugins.
All detectors MUST extend and implement given methods.
ri   c                    [         e)zq
The main routine to be executed upon character.
Insert the logic in witch the text would be considered chaotic.
NotImplementedErrorrY   r(   infos      r[   	feed_infoMessDetectorPlugin.feed_info  s
    
 "!r^   c                    [         e)z2
Permit to reset the plugin to the initial state.
rq   rY   s    r[   resetMessDetectorPlugin.reset  s
     "!r^   c                    [         e)zm
Compute the chaos ratio based on what your feed() has seen.
Must NOT be lower than 0.; No restriction gt 0.
rq   rx   s    r[   ratioMessDetectorPlugin.ratio  s
     "!r^   Nr(   rD   rt   r&   r_   r`   r_   r`   r_   float)ra   rb   rc   rd   re   rf   ru   ry   propertyr|   rh   ri   r^   r[   ro   ro     s,    
 I"" " "r^   ro   c                  J    \ rS rSrSrS	S jrS
S jrS	S jr\SS j5       r	Sr
g) TooManySymbolOrPunctuationPlugini"  _punctuation_count_symbol_count_character_count_last_printable_charc                <    SU l         SU l        SU l        S U l        g Nr   r   rx   s    r[   r\   )TooManySymbolOrPunctuationPlugin.__init__*  s"    '("#%&04!r^   c                X   U =R                   S-  sl         XR                  :w  a  UR                  (       do  UR                  (       a  U =R                  S-  sl        OHUR
                  (       d7  UR                  (       a&  UR                  (       d  U =R                  S-  sl        Xl        g)1Optimized feed using pre-computed character info.r      N)	r   r   rA   r<   r   r.   r=   r@   r   rs   s      r[   ru   *TooManySymbolOrPunctuationPlugin.feed_info1  sg    "111$))zz''1,'ZZDHHT]]""a'"$-!r^   c                .    SU l         SU l        SU l        g r   )r   r   r   rx   s    r[   ry   &TooManySymbolOrPunctuationPlugin.reset=  s    "# !r^   c                    U R                   S:X  a  gU R                  U R                  -   U R                   -  nUS:  a  U$ S$ )Nr           333333?)r   r   r   )rY   ratio_of_punctuations     r[   r|   &TooManySymbolOrPunctuationPlugin.ratioB  sO      A% ##d&8&88!!'" (<s'B#KKr^   )r   r   r   r   Nr   r~   r   ra   rb   rc   rd   rf   r\   ru   ry   r   r|   rh   ri   r^   r[   r   r   "  s.    I5
.
 L Lr^   r   c                  J    \ rS rSrSrS	S jrS
S jrS	S jr\SS j5       r	Sr
g)TooManyAccentuatedPluginiN  r   _accentuated_countc                     SU l         SU l        g r   r   rx   s    r[   r\   !TooManyAccentuatedPlugin.__init__Q  s    %&'(r^   c                |    U =R                   S-  sl         UR                  (       a  U =R                  S-  sl        ggr   r   N)r   r2   r   rs   s      r[   ru   "TooManyAccentuatedPlugin.feed_infoU  s2    "##q(# r^   c                     SU l         SU l        g r   r   rx   s    r[   ry   TooManyAccentuatedPlugin.reset\  s     !"#r^   c                j    U R                   S:  a  gU R                  U R                   -  nUS:  a  U$ S$ )N   r   gffffff?r   )rY   ratio_of_accentuations     r[   r|   TooManyAccentuatedPlugin.ratio`  s=      1$'+'>'>AVAV'V(=(E$N3Nr^   )r   r   Nr   r~   r   r   ri   r^   r[   r   r   N  s,    :I))$ O Or^   r   c                  J    \ rS rSrSrS	S jrS
S jrS	S jr\SS j5       r	Sr
g)UnprintablePluginii  _unprintable_countr   _has_escapec                .    SU l         SU l        SU l        g Nr   Fr   rx   s    r[   r\   UnprintablePlugin.__init__l  s    '(%&!&r^   c                    US:X  a  SU l         UR                  (       d2  UR                  (       d!  US:w  a  US:w  a  U =R                  S-  sl        U =R                  S-  sl        g)r   Tu   ﻿r   N)r   r)   r-   r   r   rs   s      r[   ru   UnprintablePlugin.feed_infoq  sT    #D JJV#X%##q(#"r^   c                     SU l         SU l        g r   )r   r   rx   s    r[   ry   UnprintablePlugin.reset  s    "# r^   c                    U R                   S:X  a  gU R                  (       a  gU R                  S-  U R                   -  $ )Nr   r         ?r   r   r   r   rx   s    r[   r|   UnprintablePlugin.ratio  s;      A%''!+t/D/DDDr^   r   Nr   r~   r   r   ri   r^   r[   r   r   i  s,    II'
#! E Er^   r   c                  J    \ rS rSrSrS	S jrS
S jrS	S jr\SS j5       r	Sr
g)SuspiciousDuplicateAccentPlugini  _successive_countr   _last_latin_character_last_was_accentuatedc                <    SU l         SU l        S U l        SU l        g r   r   rx   s    r[   r\   (SuspiciousDuplicateAccentPlugin.__init__  s"    &'%&6:"+0"r^   c                   U =R                   S-  sl         U R                  b  UR                  (       a  U R                  (       az  UR                  (       a0  U R                  R                  (       a  U =R
                  S-  sl        UR                  U R                  R                  :X  a  U =R
                  S-  sl        X l        UR                  U l        gr   )r   r   r2   r   r+   r   rC   rs   s      r[   ru   )SuspiciousDuplicateAccentPlugin.feed_info  s    "&&2  **zzd88>>&&!+&$"<"<"G"GG&&!+&%)"%)%5%5"r^   c                <    SU l         SU l        S U l        SU l        g r   r   rx   s    r[   ry   %SuspiciousDuplicateAccentPlugin.reset  s"    !" !%)"%*"r^   c                \    U R                   S:X  a  gU R                  S-  U R                   -  $ )Nr   r   r   )r   r   rx   s    r[   r|   %SuspiciousDuplicateAccentPlugin.ratio  s/      A%&&*d.C.CCCr^   )r   r   r   r   Nr   r~   r   r   ri   r^   r[   r   r     s.    I16+ D Dr^   r   c                  J    \ rS rSrSrS	S jrS
S jrS	S jr\SS j5       r	Sr
g)SuspiciousRangei  "_suspicious_successive_range_countr   _last_printable_seen_last_printable_rangec                <    SU l         SU l        S U l        S U l        g r   r   rx   s    r[   r\   SuspiciousRange.__init__  s"    78/%&04!15"r^   c                   U =R                   S-  sl         UR                  (       d"  UR                  (       d  UR                  (       a  SU l        SU l        gU R                  c  Xl        UR                  U l        gU R
                  nUR                  nX4:w  d  Uc%  [        X45      (       a  U =R                  S-  sl        Xl        X@l        gr   )	r   r-   r<   rA   r   r   r>    is_suspiciously_successive_ranger   )rY   r(   rt   unicode_range_aunicode_range_bs        r[   ru   SuspiciousRange.feed_info  s    "::tyy(,D%)-D&$$,(1%)-D&&*&@&@&*jj -1H/QQ771<7$-!%4"r^   c                <    SU l         SU l        S U l        S U l        g r   )r   r   r   r   rx   s    r[   ry   SuspiciousRange.reset  s"     !23/$(!%)"r^   c                `    U R                   S::  a  gU R                  S-  U R                   -  nU$ )NrQ   r   r   )r   r   )rY   ratio_of_suspicious_range_usages     r[   r|   SuspiciousRange.ratio  s<      B& 33a7!!2"' /.r^   )r   r   r   r   Nr   r~   r   r   ri   r^   r[   r   r     s,    I652* / /r^   r   c                  J    \ rS rSrSrS	S jrS
S jrS	S jr\SS j5       r	Sr
g)SuperWeirdWordPlugini  _word_count_bad_word_count_foreign_long_count_is_current_word_bad_foreign_long_watchr   _bad_character_count_buffer_length_buffer_last_char_buffer_last_char_accentuated_buffer_accent_count_buffer_glyph_count_buffer_upper_count_buffer_first_lower_buffer_has_non_ascii_buffer_last_char_ligature_buffer_has_internal_ligature_is_current_word_invalid_invalid_word_countc                   SU l         SU l        SU l        SU l        SU l        SU l        SU l        SU l        S U l        SU l	        SU l
        SU l        SU l        SU l        SU l        SU l        SU l        SU l        SU l        g r   r   rx   s    r[   r\   SuperWeirdWordPlugin.__init__
  s     !$%() */!). %&)*!#$-138*)*!() () ). +0"05'38*.3%() r^   c                   UR                   (       Ga<  U R                  (       a  SU l        UR                  U l        U R                  S:X  a  UR
                  U l        U =R                  S-  sl        Xl        UR                  (       a  U =R                  S-  sl	        UR                  (       d  SU l        UR                  U l        UR                  (       a  U =R                  S-  sl        UR                  (       a  U =R                   S-  sl        gU R"                  (       d)  UR$                  (       a  UR                  (       a  SU l        gU R                  (       d  gUR&                  (       d"  UR(                  (       a  U R                  (       a  SU l        SU l        UR.                  (       d#  UR0                  (       d  UR2                  (       GaQ  U =R4                  S-  sl        U R                  nU =R6                  U-  sl        US:  a  U R                  U-  S:  a  SU l        OU R                  (       aL  U R                  R9                  5       (       a-  U R                  U:w  a  U =R:                  S-  sl        SU l        O~U R                   S:X  a  SU l        U =R:                  S-  sl        OQU R                  (       a@  U R                  (       a/  U R                  US-
  :X  a  U =R:                  S-  sl        SU l        US:  a\  U R"                  (       aK  U R                  S:  =(       a    U R                  U-  S:*  nU(       d  U =R:                  S-  sl        SU l        U R*                  (       a1  U =R<                  S-  sl        U =R>                  U-  sl        S	U l        U R,                  (       a  U =R@                  S-  sl         S	U l        S	U l        SU l        SU l        S	U l        SU l        SU l        SU l	        S	U l        S	U l        S	U l        S	U l        gUS
;  aN  URB                  (       d<  URD                  (       a*  SU l        U =R                  S-  sl        Xl        S	U l        gggg)r   Tr   r   N         ?   r   F>   -<=>_|~)#r*   r   r   r8   r   r,   r   r   r+   r   r/   r   r2   r   r   r;   r   r   r3   r:   r9   r   r   r-   r<   r?   r   r   rU   r   r   r   r   r.   r=   )rY   r(   rt   buffer_lengthprobable_camel_caseds        r[   ru   SuperWeirdWordPlugin.feed_info"  s   :::..592.2.>.>D+""a'+/::(1$%."zz((A-(==-1*151A1AD.))Q.)}}((A-(  --tzzTEUEU+/("",,D$F$F(,D%,0D)::txxx!!%!4!4M!!]2!!,,}<C04D-66..668800MA,,1,04D---204D-,,1,..0000MA4EE
 ,,1,04D-"t'?'?,,q0 H00=@CG %
 ,,,1,04D-(($$)$))]:),1),,((A-(05-',D$"#D%)D"16D.()D%'(D$'(D$',D$).D&.3D+16D.@@JJ(,D%1$%."16D.   Ar^   c                   SU l         S U l        SU l        SU l        SU l        SU l        SU l        SU l        SU l        SU l	        SU l
        SU l        SU l        SU l        SU l        SU l        SU l        SU l        SU l        g r   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rx   s    r[   ry   SuperWeirdWordPlugin.reset  s    !%-2*$)!#(   !$%!#$ $%!#$ #$ #( %*"*/'-2*(-%#$ r^   c                    U R                   (       a  gU R                  S::  a  U R                  S:X  a  gU R                  U R                  -  $ )Nr   
   r   r   )r   r   r   r   r   rx   s    r[   r|   SuperWeirdWordPlugin.ratio  sC    ##r!d&>&>!&C((4+@+@@@r^   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Nr   r~   r   r   ri   r^   r[   r   r     s0    I,*0b7H%* A Ar^   r   c                  N    \ rS rSrSrSrS	S jrS
S jrS	S jr\	SS j5       r
Srg)CjkUncommonPlugini  z4
Detect messy CJK text that probably means nothing.
r   _uncommon_countc                     SU l         SU l        g r   r  rx   s    r[   r\   CjkUncommonPlugin.__init__  s    %&$%r^   c                |    U =R                   S-  sl         UR                  (       d  U =R                  S-  sl        ggr   )r   rB   r  rs   s      r[   ru   CjkUncommonPlugin.feed_info  s0    "  A%  r^   c                     SU l         SU l        g r   r  rx   s    r[   ry   CjkUncommonPlugin.reset  s     ! r^   c                p    U R                   S:  a  gU R                  U R                   -  nUS:  a  US-  $ S$ )Nr   r   r      r  )rY   uncommon_form_usages     r[   r|   CjkUncommonPlugin.ratio  sD      1$%)%9%9D<Q<Q%Q +>*C"Q&LLr^   Nr   r~   r   ra   rb   rc   rd   re   rf   r\   ru   ry   r   r|   rh   ri   r^   r[   r  r    s3     8I&&! M Mr^   r  c                  N    \ rS rSrSrSrS
S jrSS jrS
S jr\	SS j5       r
Srg	)SuspiciousKatakanaPlugini  zDDetect implausible halfwidth Katakana and uncommon CJK combinations._katakana_count_halfwidth_katakana_count
_cjk_count_uncommon_cjk_countc                <    SU l         SU l        SU l        SU l        g r   r  rx   s    r[   r\   !SuspiciousKatakanaPlugin.__init__  s!    $%./& () r^   c                   UR                   (       a<  U =R                  S-  sl        UR                  (       a  U =R                  S-  sl        gU =R                  S-  sl        UR
                  (       d  U =R                  S-  sl        ggr   )r5   r  r6   r  r  rB   r  rs   s      r[   ru   "SuspiciousKatakanaPlugin.feed_info  sd      A% ))..!3.1$$)$ r^   c                <    SU l         SU l        SU l        SU l        g r   r  rx   s    r[   ry   SuspiciousKatakanaPlugin.reset  s!     )*&#$ r^   c                    U R                   S:  a?  U R                   U R                  :X  a%  SU R                  s=::  a  U R                  :X  a   g  gg)Nr      r   r   )r  r  r  r  rx   s    r[   r|   SuspiciousKatakanaPlugin.ratio  sK     **a/..$2F2FFT__@(@(@@ A r^   )r  r  r  r  Nr   r~   r   r  ri   r^   r[   r  r    s/    NI*
*%  r^   r  c                  J    \ rS rSrSrS	S jrS
S jrS	S jr\SS j5       r	Sr
g)ArchaicUpperLowerPlugini  _buf_character_count_since_last_sep_successive_upper_lower_count#_successive_upper_lower_count_finalr   _last_alpha_seen_upper_last_alpha_seen_lower_current_ascii_onlyc                t    SU l         SU l        SU l        SU l        SU l        SU l        SU l        SU l        g )NFr   Tr%  rx   s    r[   r\    ArchaicUpperLowerPlugin.__init__  sA    	45,23*890%&,1#,1#)- r^   c                   UR                   =(       a    UR                  nU(       + nU(       a  U R                  S:  a  U R                  S::  aA  UR                  (       d0  U R                  (       d  U =R
                  U R                  -  sl        SU l        SU l        SU l        U =R                  S-  sl        SU l        gU R                  (       a  UR                  (       d  SU l        U R                  S:  a  UR                  (       a  U R                  (       d"  UR                  (       aG  U R                  (       a6  U R                  (       a  U =R                  S-  sl        SU l        OSU l        OSU l        U =R                  S-  sl        U =R                  S-  sl        UR                  U l        UR                  U l        g)r   r   @   Fr   TNr   )r*   r0   r'  r.   r,  r)  r(  r&  r   r/   r+   r+  r,   r*  )rY   r(   rt   is_concerned	chunk_seps        r[   ru   !ArchaicUpperLowerPlugin.feed_info  sE   !ZZ>D,>,>**	==A44:

0088668 23D.34D0DI!!Q&!'+D$##DMM',D$//!3

t::

t::9966!;6 %DI $DI!	",,1,&*jj#&*jj#r^   c                t    SU l         SU l        SU l        SU l        SU l        SU l        SU l        SU l        g )Nr   FT)r   r'  r(  r)  r*  r+  r&  r,  rx   s    r[   ry   ArchaicUpperLowerPlugin.reset;  sA     !/0,-.*340&+#&+#	#' r^   c                V    U R                   S:X  a  gU R                  U R                   -  $ )Nr   r   )r   r)  rx   s    r[   r|   ArchaicUpperLowerPlugin.ratioE  s*      A%77$:O:OOOr^   )r&  r   r'  r,  r+  r*  r(  r)  Nr   r~   r   r   ri   r^   r[   r$  r$    s/    	I.)1V( P Pr^   r$  c                  J    \ rS rSrSrSS jrSS jrS	S jr\S
S j5       r	Sr
g)ArabicIsolatedFormPluginiM  r   _isolated_form_countc                     SU l         SU l        g r   r:  rx   s    r[   r\   !ArabicIsolatedFormPlugin.__init__P  s    %&)*!r^   c                     SU l         SU l        g r   r:  rx   s    r[   ry   ArabicIsolatedFormPlugin.resetT  s     !$%!r^   c                    U =R                   S-  sl         UR                  [        -  (       a  U =R                  S-  sl        ggr   )r   r1   r   r;  rs   s      r[   ru   "ArabicIsolatedFormPlugin.feed_infoX  s6    "::--%%*% .r^   c                Z    U R                   S:  a  gU R                  U R                   -  nU$ )Nr   r   r:  )rY   isolated_form_usages     r[   r|   ArabicIsolatedFormPlugin.ratio_  s0      1$%)%>%>AVAV%V""r^   Nr   r~   r   )ra   rb   rc   rd   rf   r\   ry   ru   r   r|   rh   ri   r^   r[   r9  r9  M  s*    <I+&+ # #r^   r9  c                    U b  Uc  g[         U    n[         U   nX#:X  a  gU[        ;   d
  U[        ;   a  g[        X#5      [        ;   a  gU S:X  a	  U[        ;  $ US:X  a	  U[        ;  $ g)zW
Determine if two Unicode ranges seen next to each other can be considered suspicious.
TFzBasic Latin)r   r   r
   r   r   )r   r   	familly_a	familly_bs       r[   r   r   i  s     /"9$_5I$_5I 	88;;i37QQ -' FFF-' FFFr^   c           
     r   [        U 5      nUS:  a  SnOUS:  a  SnOSnU R                  5       n[        n[        n[	        5       n[        5       n	[        5       n
[        5       n[        5       n[        5       n[        5       n[        5       n[        5       n[        5       nUR                  nU	R                  nU
R                  nUR                  nUR                  nUR                  nUR                  nUR                  nUR                  nUR                  n[        SX45       GH  nU UUU-     GH  n[!        U5      nUS:  a  UU   nOU" U5      nU" UU5        U" UU5        U(       a  UR"                  (       a	  U" UU5        MX  U" UU5        UR"                  (       a  U" UU5        U" UU5        UR$                  (       d  M  U" UU5        UR&                  (       a	  U" UU5        UR(                  (       a  U" UU5        U" UU5        OUR*                  (       a	  U" UU5        UR,                  (       d  GM  U" UU5        GM     UR.                  U	R.                  -   U
R.                  -   UR.                  -   UR.                  -   UR.                  -   UR.                  -   UR.                  -   UR.                  -   UR.                  -   n U U:  d  GM    O   US   n!U" SU!5        U(       d	  U" SU!5        U" SU!5        UR.                  U	R.                  -   U
R.                  -   UR.                  -   UR.                  -   UR.                  -   UR.                  -   UR.                  -   UR.                  -   UR.                  -   n U(       a  [1        S	5      n"U"R3                  [4        S
U SU  SU 35        US:  a8  U"R3                  [4        SU SS  35        U"R3                  [4        SU SS  35        XXXXUU4
 H2  n#U"R3                  [4        U#R6                   SU#R.                   35        M4     [9        U S5      $ )zo
Compute a mess ratio given a decoded bytes sequence. The maximum threshold does stop the computation earlier.
i  rO   i   r0  rH   r   r  
charset_normalizerzIMess-detector extended-analysis start. intermediary_mean_mess_ratio_calc=z mean_mess_ratio=z maximum_threshold=   zStarting with: NzEnding with: iz: r!  )lenisasciirm   rl   r   r   r   r   r   r   r  r  r$  r9  ru   r>   rR   r)   r*   r3   r4   r5   r7   r|   r   logr	   	__class__round)$decoded_sequencemaximum_thresholddebugseq_lenstepis_pure_ascii
ascii_info	char_infod_spd_tad_upd_sdad_srd_swd_cud_skd_aud_ai	d_sp_feed	d_ta_feed	d_up_feed
d_sda_feed	d_sr_feed	d_sw_feed	d_cu_feed	d_sk_feed	d_au_feed	d_ai_feedblock_startr(   	codepointrt   mean_mess_rationl_infologgerdts$                                       r[   
mess_ratiors    s    '(G}	4
 +224M
 "JI .N-OD%=%?D/1D-L-NE+-D!5!7D/1D%=%?D$;$=D%=%?D IIIJIIIIIIQ.)+d8JKI !^I3!), + i&i&>>i.i& ~~)T*)T* zzz)T*::y$/;;i.i.%%i.>>>i.S LX JJjjjj kk jj	
 jj jj jj jj jj	 	 //u /z R.$ dG$$  JJjjjj kk jj	
 jj jj jj jj jj	 	 /0

1156GGX Y!!2 35	
 R<JJu0@"0E/FGHJJu.>su.E-FGHtDD$OBJJub
;< P !$$r^   )r(   rD   r_   r&   )r   rF   r   rF   r_   rE   )g?F)rQ  rD   rR  r   rS  rE   r_   r   )8
__future__r   	functoolsr   loggingr   constantr   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   utilsr   r   r   r   r    r!   r"   r$   rg   r&   rl   r>   chrrm   ro   r   r   r   r   r   r   r  r  r$  r9  r   rs  )
_codepoints   0r[   <module>r{     s   "       .   '>I-	9EAS AG+ G+X 4  16c
$0:*HS_
$ . 
" "<)L'9 )LXO1 O6"E* "EJ)D&8 )DX6/( 6/rpA- pAfM* MD+1 +\TP0 TPn#1 #8 4  2< 	   H JOZ%Z%.3Z%BFZ%
Z%]$s   	E