ó
    ychYX  ã                  óP  • S SK Jr  S SK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JrJr  SSKJr  SS	KJrJr  SS
KJrJrJrJrJrJrJr  \R<                  " S5      r\R@                  " 5       r!\!RE                  \RF                  " S5      5                 S                     SS jjr$         S                     SS jjr%         S                     SS jjr&         S                     SS jjr'g)é    )ÚannotationsN)ÚPathLike)ÚBinaryIOé   )Úcoherence_ratioÚencoding_languagesÚmb_encoding_languagesÚmerge_coherence_ratios)ÚIANA_SUPPORTEDÚTOO_BIG_SEQUENCEÚTOO_SMALL_SEQUENCEÚTRACE)Ú
mess_ratio)ÚCharsetMatchÚCharsetMatches)Úany_specified_encodingÚcut_sequence_chunksÚ	iana_nameÚidentify_sig_or_bomÚis_cp_similarÚis_multi_byte_encodingÚshould_strip_sig_or_bomÚcharset_normalizerz)%(asctime)s | %(levelname)s | %(message)sc
                ój  • [        U [        [        45      (       d#  [        SR	                  [        U 5      5      5      eU(       aB  [        R                  n
[        R                  [        5        [        R                  [        5        [        U 5      nUS:X  a{  [        R                  S5        U(       aE  [        R                  [        5        [        R                  W
=(       d    [        R                   5        [#        [%        U SSS/ S5      /5      $ UbG  [        R'                  [        S	S
R)                  U5      5        U Vs/ s H  n[+        US5      PM     nnO/ nUbG  [        R'                  [        SS
R)                  U5      5        U Vs/ s H  n[+        US5      PM     nnO/ nX²U-  ::  a!  [        R'                  [        SUUU5        SnUnUS:”  a  X±-  U:  a  [-        X±-  5      n[        U 5      [.        :  n[        U 5      [0        :¬  nU(       a*  [        R'                  [        SR	                  U5      5        O0U(       a)  [        R'                  [        SR	                  U5      5        / nU(       a  [3        U 5      OSnUb,  UR5                  U5        [        R'                  [        SU5        [7        5       n/ n/ nSnSnSn[#        5       n[#        5       n[9        U 5      u  nnUb6  UR5                  U5        [        R'                  [        S[        U5      U5        UR5                  S5        SU;  a  UR5                  S5        U[:        -    GH  nU(       a  UU;  a  M  U(       a  UU;   a  M"  UU;   a  M*  UR=                  U5        SnUU:H  nU=(       a    [?        U5      nUS;   a$  U(       d  [        R'                  [        SU5        M€  US;   a$  U(       d  [        R'                  [        SU5        Mª   [A        U5      n U(       a8  USL a3  [G        USL a  U S[-        S5       OU [        U5      [-        S5       US9  O[G        USL a  U OU [        U5      S US9n Sn!U H  n"[M        UU"5      (       d  M  Sn!  O   U!(       a  [        R'                  [        SUW"5        GMZ  [O        U(       d  SO
[        U5      U[-        X±-  5      5      n#U=(       a    USL=(       a    [        U5      U:  n$U$(       a  [        R'                  [        SU5        [-        [        U#5      S-  5      n%[Q        U%S5      n%Sn&Sn'/ n(/ n) [S        U UU#UUUUUU5	       H{  n*U(R5                  U*5        U)R5                  [U        U*UUSL =(       a    S[        U5      s=:*  =(       a    S:*  Os  5      5        U)S    U:¼  a  U&S-  n&U&U%:¼  d  U(       d  Mt  USL d  M{    O    U'(       d+  U(       a$  U(       d   U [-        S"5      S RW                  US#S$9  U)(       a  [Y        U)5      [        U)5      -  OSn+U+U:¼  d  U&U%:¼  av  UR5                  U5        [        R'                  [        S&UU&[[        U+S'-  S(S)95        U	(       a3  USSU4;   a*  U'(       d#  [%        U UUS/ UUS*9n,UU:X  a  U,nOUS:X  a  U,nOU,nGM[  [        R'                  [        S+U[[        U+S'-  S(S)95        U(       d  []        U5      n-O[_        U5      n-U-(       a3  [        R'                  [        S,R	                  U[G        U-5      5      5        / n.US:w  a?  U( H9  n*[a        U*UU-(       a  S-R)                  U-5      OS5      n/U.R5                  U/5        M;     [c        U.5      n0U0(       a*  [        R'                  [        S.R	                  U0U5      5        [%        U UU+UU0USL d	  UUSS4;   a  UOSUS*9n1UR5                  U15        UUSS4;   a€  U+S/:  az  U+S:X  ac  [        R                  S0U1Rd                  5        U(       a.  [        R                  [        5        [        R                  W
5        [#        U1/5      s  $ UR5                  U15        [        U5      (       aˆ  Ub  UU;   a  SU;   ay  SU;   as  URg                  5       n2[        R                  S0U2Rd                  5        U(       a.  [        R                  [        5        [        R                  W
5        [#        U2/5      s  $ UU:X  d  GM·  [        R                  S1U5        U(       a.  [        R                  [        5        [        R                  W
5        [#        UU   /5      s  $    [        U5      S:X  añ  U(       d  U(       d  U(       a  [        R'                  [        S25        U(       a2  [        R                  S3URd                  5        UR5                  U5        O‰U(       a  Ub+  U(       a!  U(       a  URh                  URh                  :w  d  Ub'  [        R                  S45        UR5                  U5        O-U(       a&  [        R                  S55        UR5                  U5        U(       a<  [        R                  S6URg                  5       Rd                  [        U5      S-
  5        O[        R                  S75        U(       a.  [        R                  [        5        [        R                  W
5        U$ s  snf s  snf ! [B        [D        4 a     [        R'                  [        SU5         GMÝ  f = f! [H        [J        4 aW  n [        U [J        5      (       d%  [        R'                  [        SU[G        U 5      5        UR5                  U5         Sn A GMC  Sn A ff = f! [H         a4  n [        R'                  [        S!U[G        U 5      5        U%n&Sn' Sn A GNýSn A ff = f! [H         aB  n [        R'                  [        S%U[G        U 5      5        UR5                  U5         Sn A GMÓ  Sn A ff = f)8a2  
Given a raw bytes sequence, return the best possibles charset usable to render str objects.
If there is no results, it is a strong indicator that the source is binary/not text.
By default, the process will extract 5 blocks of 512o each to assess the mess and coherence of a given sequence.
And will give up a particular code page after 20% of measured mess. Those criteria are customizable at will.

The preemptive behavior DOES NOT replace the traditional detection workflow, it prioritize a particular code page
but never take it for granted. Can improve the performance.

You may want to focus your attention to some code page or/and not others, use cp_isolation and cp_exclusion for that
purpose.

This function will strip the SIG in the payload/sequence every time except on UTF-16, UTF-32.
By default the library does not setup any handler other than the NullHandler, if you choose to set the 'explain'
toggle to True it will alter the logger configuration to add a StreamHandler that is suitable for debugging.
Custom logging format and handler can be set manually.
z3Expected object of type bytes or bytearray, got: {}r   z<Encoding detection on empty bytes, assuming utf_8 intention.Úutf_8g        FÚ Nz`cp_isolation is set. use this flag for debugging purpose. limited list of encoding allowed : %s.z, zacp_exclusion is set. use this flag for debugging purpose. limited list of encoding excluded : %s.z^override steps (%i) and chunk_size (%i) as content does not fit (%i byte(s) given) parameters.r   z>Trying to detect encoding from a tiny portion of ({}) byte(s).zIUsing lazy str decoding because the payload is quite large, ({}) byte(s).z@Detected declarative mark in sequence. Priority +1 given for %s.zIDetected a SIG or BOM mark on first %i byte(s). Priority +1 given for %s.Úascii>   Úutf_16Úutf_32z\Encoding %s won't be tested as-is because it require a BOM. Will try some sub-encoder LE/BE.>   Úutf_7zREncoding %s won't be tested as-is because detection is unreliable without BOM/SIG.z2Encoding %s does not provide an IncrementalDecoderg    €„A)Úencodingz9Code page %s does not fit given bytes sequence at ALL. %sTzW%s is deemed too similar to code page %s and was consider unsuited already. Continuing!zpCode page %s is a multi byte encoding table and it appear that at least one character was encoded using n-bytes.é   é   éÿÿÿÿzaLazyStr Loading: After MD chunk decode, code page %s does not fit given bytes sequence at ALL. %sg     jè@Ústrict)Úerrorsz^LazyStr Loading: After final lookup, code page %s does not fit given bytes sequence at ALL. %szc%s was excluded because of initial chaos probing. Gave up %i time(s). Computed mean chaos is %f %%.éd   é   )Úndigits)Úpreemptive_declarationz=%s passed initial chaos probing. Mean measured chaos is %f %%z&{} should target any language(s) of {}Ú,z We detected language {} using {}çš™™™™™¹?z.Encoding detection: %s is most likely the one.zoEncoding detection: %s is most likely the one as we detected a BOM or SIG within the beginning of the sequence.zONothing got out of the detection process. Using ASCII/UTF-8/Specified fallback.z7Encoding detection: %s will be used as a fallback matchz:Encoding detection: utf_8 will be used as a fallback matchz:Encoding detection: ascii will be used as a fallback matchz]Encoding detection: Found %s as plausible (best-candidate) for content. With %i alternatives.z=Encoding detection: Unable to determine any suitable charset.)5Ú
isinstanceÚ	bytearrayÚbytesÚ	TypeErrorÚformatÚtypeÚloggerÚlevelÚ
addHandlerÚexplain_handlerÚsetLevelr   ÚlenÚdebugÚremoveHandlerÚloggingÚWARNINGr   r   ÚlogÚjoinr   Úintr   r   r   ÚappendÚsetr   r   Úaddr   r   ÚModuleNotFoundErrorÚImportErrorÚstrÚUnicodeDecodeErrorÚLookupErrorr   ÚrangeÚmaxr   r   ÚdecodeÚsumÚroundr   r	   r   r
   r!   ÚbestÚfingerprint)3Ú	sequencesÚstepsÚ
chunk_sizeÚ	thresholdÚcp_isolationÚcp_exclusionÚpreemptive_behaviourÚexplainÚlanguage_thresholdÚenable_fallbackÚprevious_logger_levelÚlengthÚcpÚis_too_small_sequenceÚis_too_large_sequenceÚprioritized_encodingsÚspecified_encodingÚtestedÚtested_but_hard_failureÚtested_but_soft_failureÚfallback_asciiÚfallback_u8Úfallback_specifiedÚresultsÚearly_stop_resultsÚsig_encodingÚsig_payloadÚencoding_ianaÚdecoded_payloadÚbom_or_sig_availableÚstrip_sig_or_bomÚis_multi_byte_decoderÚeÚsimilar_soft_failure_testÚencoding_soft_failedÚr_Úmulti_byte_bonusÚmax_chunk_gave_upÚearly_stop_countÚlazy_str_hard_failureÚ	md_chunksÚ	md_ratiosÚchunkÚmean_mess_ratioÚfallback_entryÚtarget_languagesÚ	cd_ratiosÚchunk_languagesÚcd_ratios_mergedÚcurrent_matchÚprobable_results3                                                      Ú_/var/www/djangovue.mamus.xyz/django/venv/lib/python3.13/site-packages/charset_normalizer/api.pyÚ
from_bytesrƒ   !   sU  € ô< �i¤)¬UÐ!3×4Ñ4ÜØA×HÑHÜ�Y“óó
ð 	
ö Ü%+§\¡\ÐÜ×Ñœ/Ô*Ü�‰œÔä�i“.€Fà�ƒ{Ü�‰ÐSÔTÞÜ× Ñ ¤Ô1Ü�O‰OÐ1×D´W·_±_ÔEÜœ|¨I°wÀÀUÈBÐPRÓSÐTÓUÐUàÑÜ�
‰
Üð5à�I‰I�lÓ#ô		
ñ 8DÓD²|°œ	 " eÖ,±|ˆÐDˆàˆàÑÜ�
‰
Üð6à�I‰I�lÓ#ô		
ñ 8DÓD²|°œ	 " eÖ,±|ˆÐDˆàˆà˜uÑ$Ó%Ü�
‰
ÜØlØØØô	
ð ˆØˆ
àˆqƒy�V‘^ jÓ0Ü˜™Ó(ˆ
ä"% i£.Ô3EÑ"EÐÜ"% i£.Ô4DÑ"DÐæÜ�
‰
ÜØL×SÑSØóõ	
ö 
Ü�
‰
ÜØW×^Ñ^Øóô	
ð (*Ðö .BÔ˜yÔ)Àtð ð Ñ%Ø×$Ñ$Ð%7Ô8Ü�
‰
ÜØNØô	
ô “u€FØ)+ÐØ)+Ðà*.€NØ'+€KØ.2Ðä,Ó.€Gä)7Ó)9Ðä 3°IÓ >Ñ€L�+àÑØ×$Ñ$ \Ô2Ü�
‰
ÜØWÜ�ÓØô		
ð × Ñ  Ô)àÐ+Ó+Ø×$Ñ$ WÔ-à.´Õ?ˆÞ˜M°Ó=Ùæ˜M¨\Ó9Ùà˜FÓ"Ùà�
‰
�=Ô!à&*ˆØ%1°]Ñ%BÐØ!5÷ "
Ô:QØó;
Ðð Ð0Ó0Ö9MÜ�J‰JÜØnØôñ
 Ø˜IÓ%Ö.BÜ�J‰JÜØdØôñ
 ð	Ü*@ÀÓ*OÐ!ð	Þ$Ð)>À%Ò)GÜð ,¨uÒ4ð " +¤C¨£IÑ.à&¤s¨;Ó'7¼#¸d»)ÐDà*óô #&ð ,¨uÒ4ñ "à&¤s¨;Ó'7Ð'9Ð:à*ñ#‘ð& +0Ð!ã$;Ð Ü˜]Ð,@×AÓAØ,0Ð)Ùñ %<ö
 %Ü�J‰JÜØiØØ$ô	ò äÞ)‰A¬s°;Ó/?ØÜ�‘Óó
ˆð "÷ .Ø tÐ+÷.ä�OÓ$ vÑ-ð 	ö Ü�J‰JÜð-àô	ô "%¤S¨£W¨q¡[Ó!1ÐäÐ 1°1Ó5ÐØ !ÐØ %Ðà!ˆ	Øˆ	ð'	)Ü,ØØØØØ$Ø ØØ%Øö
�ð × Ñ  Ô'à× Ñ ÜØØ!Ø 4˜×G¨A´°\Ó1B×,GÓ,GÀaÔ,Góôð ˜R‘= IÓ-Ø$¨Ñ)Ð$à$Ð(9Ó9ß(Ð(Ð-=ÀÔ-Fáò7
öV &Þ%Þ)ð
Øœ#˜d›)˜+Ð&×-Ñ-¨mÀHÐ-ÑMö EN¤ Y£´#°i³.Ò!@ÐSVˆØ˜iÓ'Ð+;Ð?PÓ+PØ#×*Ñ*¨=Ô9Ü�J‰JÜð0àØ Ü�o¨Ñ+°QÑ7ôö  Ø! g¨wÐ8JÐ%KÓKÞ-ä!-ØØ!ØØØØ#Ø+=ñ"�ð !Ð$6Ó6Ø)7Ñ&Ø" gÓ-Ø%3‘Nà"0�KÚä�
‰
ÜØKØÜ�/ CÑ'°Ñ3ô		
ö %Ü*<¸]Ó*KÑä4°]ÓCÐæÜ�J‰JÜØ8×?Ñ?Ø!¤3Ð'7Ó#8óôð ˆ	ð ˜GÓ#Û"�Ü"1ØØ&Þ2B�C—H‘HÐ-Ô.Èó#�ð × Ñ  Ö1ñ #ô 2°)Ó<ÐæÜ�J‰JÜØ2×9Ñ9Ø$ móôô %ØØØØ Øð *¨UÒ2Ø$Ð);¸WÀgÐ(NÓNñ  ð
 à#5ñ
ˆð" 	�‰�}Ô%ð Ð0°'¸7ÐCÓCØ #Ó%ð  #Ó%Ü—‘ØDØ!×*Ñ*ôö Ü×(Ñ(¬Ô9Ü—O‘OÐ$9Ô:Ü% } oÓ6Ò6à×%Ñ% mÔ4ô Ð"×#Ñ#Ø#Ñ+Ð/AÀVÓ/KØ˜6Ó!Ø˜6Ó!à,>×,CÑ,CÓ,EˆOÜ�L‰LØ@Ø×(Ñ(ôö Ü×$Ñ$¤_Ô5Ü—‘Ð 5Ô6ä! ?Ð"3Ó4Ò4à˜LÖ(Ü�L‰Lð1àôö
 Ü×$Ñ$¤_Ô5Ü—‘Ð 5Ô6Ü! 7¨=Ñ#9Ð":Ó;Ò;ñ}	 @ô@
 ˆ7ƒ|�qÓÞž.Ö,>Ü�J‰JÜØaôö
 Ü�L‰LØIØ"×+Ñ+ôð �N‰NÐ-Õ.æ˜^Ñ3æÞ"Ø×+Ñ+¨~×/IÑ/IÓIàÑ'ä�L‰LÐUÔVØ�N‰N˜;Õ'ÞÜ�L‰LÐUÔVØ�N‰N˜>Ô*æÜ�‰ØkØ�L‰L‹N×#Ñ#Ü�‹L˜1Ñõ	
ô 	�‰ÐTÔUæÜ×Ñœ_Ô-Ü�‰Ð-Ô.à€NùòE Eùò Eøôb $¤[Ð1ó 	Ü�J‰JÜØDØôó
 ð	ûô6 #¤KÐ0ó 		Ü˜a¤×-Ñ-Ü—
‘
ÜØOØ!Ü˜“Fô	ð $×*Ñ*¨=Ô9Þûð		ûôl ó
	)ô �J‰JÜØsØÜ�A“ô	ð  1ÐØ$(Ö!ûð
	)ûô* &ó Ü—
‘
ÜØtØ!Ü˜“Fô	ð (×.Ñ.¨}Ô=Þûðús€   Åk>ÆlÐlÐ>l;Ñl;ÕBn%×n%×n%×n%×7o&ì+l8ì7l8ì;n"íAnîn"î%
o#î/)oïo#ï&
p2ï06p-ð-p2c
                óF   • [        U R                  5       UUUUUUUUU	5
      $ )zz
Same thing than the function from_bytes but using a file pointer that is already ready.
Will not close the file pointer.
)rƒ   Úread)
ÚfprP   rQ   rR   rS   rT   rU   rV   rW   rX   s
             r‚   Úfrom_fpr‡      s5   € ô  Ø
�‰‹	ØØØØØØØØØóð ó    c
                óx   • [        U S5       n
[        U
UUUUUUUUU	5
      sSSS5        $ ! , (       d  f       g= f)z‰
Same thing than the function from_bytes but with one extra step. Opening and reading given file path in binary mode.
Can raise IOError.
ÚrbN)Úopenr‡   )ÚpathrP   rQ   rR   rS   rT   rU   rV   rW   rX   r†   s              r‚   Ú	from_pathr�   >  sB   € ô  
ˆd�DÔ	˜RÜØØØØØØØ ØØØó
÷ 
×	×	ús   �+«
9c
                ó  • [        U [        [        45      (       a  [        U UUUUUUUUU	S9
n
U
(       + $ [        U [        [
        45      (       a  [        U UUUUUUUUU	S9
n
U
(       + $ [        U UUUUUUUUU	S9
n
U
(       + $ )a  
Detect if the given input (file, bytes, or path) points to a binary file. aka. not a string.
Based on the same main heuristic algorithms and default kwargs at the sole exception that fallbacks match
are disabled to be stricter around ASCII-compatible but unlikely to be a string.
)	rP   rQ   rR   rS   rT   rU   rV   rW   rX   )r-   rE   r   r�   r/   r.   rƒ   r‡   )Úfp_or_path_or_payloadrP   rQ   rR   rS   rT   rU   rV   rW   rX   Úguessess              r‚   Ú	is_binaryr‘   ]  sÏ   € ô" Ð'¬#¬x¨×9Ñ9ÜØ!ØØ!ØØ%Ø%Ø!5ØØ1Ø+ñ
ˆðZ Œ;ÐôC 
ØäÜð	
÷
ñ 
ô Ø!ØØ!ØØ%Ø%Ø!5ØØ1Ø+ñ
ˆð4 Œ;Ðô Ø!ØØ!ØØ%Ø%Ø!5ØØ1Ø+ñ
ˆð Œ;Ðrˆ   )	é   é   çš™™™™™É?NNTFr,   T)rO   zbytes | bytearrayrP   r?   rQ   r?   rR   ÚfloatrS   úlist[str] | NonerT   r–   rU   ÚboolrV   r—   rW   r•   rX   r—   Úreturnr   )r†   r   rP   r?   rQ   r?   rR   r•   rS   r–   rT   r–   rU   r—   rV   r—   rW   r•   rX   r—   r˜   r   )rŒ   zstr | bytes | PathLikerP   r?   rQ   r?   rR   r•   rS   r–   rT   r–   rU   r—   rV   r—   rW   r•   rX   r—   r˜   r   )	r’   r“   r”   NNTFr,   F)r�   z!PathLike | str | BinaryIO | bytesrP   r?   rQ   r?   rR   r•   rS   r–   rT   r–   rU   r—   rV   r—   rW   r•   rX   r—   r˜   r—   )(Ú
__future__r   r;   Úosr   Útypingr   Úcdr   r   r	   r
   Úconstantr   r   r   r   Úmdr   Úmodelsr   r   Úutilsr   r   r   r   r   r   r   Ú	getLoggerr3   ÚStreamHandlerr6   ÚsetFormatterÚ	Formatterrƒ   r‡   r�   r‘   © rˆ   r‚   Ú<module>r¦      s¶  ðÝ "ã Ý Ý ÷ó ÷ RÓ QÝ ß 0÷÷ ñ ð 
×	Ò	Ð/Ó	0€Ø×'Ò'Ó)€Ø × Ñ Ø×ÒÐAÓBôð ØØØ%)Ø%)Ø!%ØØ #Ø ð|Ø ð|àð|ð ð|ð ð	|ð
 #ð|ð #ð|ð ð|ð ð|ð ð|ð ð|ð õ|ðB ØØØ%)Ø%)Ø!%ØØ #Ø ðØðàðð ðð ð	ð
 #ðð #ðð ðð ðð ðð ðð õð@ ØØØ%)Ø%)Ø!%ØØ #Ø ð
Ø
 ð
àð
ð ð
ð ð	
ð
 #ð
ð #ð
ð ð
ð ð
ð ð
ð ð
ð õ
ðB ØØØ%)Ø%)Ø!%ØØ #Ø!ð?Ø<ð?àð?ð ð?ð ð	?ð
 #ð?ð #ð?ð ð?ð ð?ð ð?ð ð?ð 
ö?rˆ   